From: Cris Di Sclafani Date: Fri, 30 Oct 2020 16:37:44 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=696a4f1c90b9b5c03dbbe8af1ce42eebeaedafe3;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4bf721b..30ab127 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-30T16:11:05.968Z", "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-30T16:28:18.552Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9ea340e..588839a 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-30T16:11:05.968Z", "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-30T16:28:18.552Z", "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 3eb96f5..35acddf 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 _0x285b=['STRING','contactManager','integration','motionbar','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','TEXT','sequelize','VIRTUAL','getDataValue','action'];(function(_0x593bb8,_0x1a2efa){var _0x1b0ecb=function(_0x3b6e40){while(--_0x3b6e40){_0x593bb8['push'](_0x593bb8['shift']());}};_0x1b0ecb(++_0x1a2efa);}(_0x285b,0x184));var _0xb285=function(_0x18129a,_0x5c4a20){_0x18129a=_0x18129a-0x0;var _0x5ae32b=_0x285b[_0x18129a];return _0x5ae32b;};'use strict';var Sequelize=require(_0xb285('0x0'));module['exports']={'name':{'type':Sequelize[_0xb285('0x1')],'get':function(_0x59df98){return this[_0xb285('0x2')](_0xb285('0x3'));}},'action':{'type':Sequelize[_0xb285('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb285('0x5'),_0xb285('0x6'),_0xb285('0x7'),'jscripty','urlForward',_0xb285('0x8'),_0xb285('0x9'),_0xb285('0xa')]],'msg':_0xb285('0xb')}},'comment':_0xb285('0xb')},'data1':{'type':Sequelize[_0xb285('0x4')](0x1000),'comment':_0xb285('0xc')},'data2':{'type':Sequelize[_0xb285('0x4')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0xb285('0x4')](0x1000)},'data5':{'type':Sequelize[_0xb285('0x4')](0x1000)},'data6':{'type':Sequelize[_0xb285('0x4')]},'data7':{'type':Sequelize[_0xb285('0xd')]}}; \ No newline at end of file +var _0x79d8=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','exports','VIRTUAL','getDataValue','action','contactManager','jscripty','urlForward'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x79d8,0x77));var _0x879d=function(_0x8fe28a,_0x344f7a){_0x8fe28a=_0x8fe28a-0x0;var _0xb5fae0=_0x79d8[_0x8fe28a];return _0xb5fae0;};'use strict';var Sequelize=require('sequelize');module[_0x879d('0x0')]={'name':{'type':Sequelize[_0x879d('0x1')],'get':function(_0x475b32){return this[_0x879d('0x2')](_0x879d('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x879d('0x4'),'integration','motionbar',_0x879d('0x5'),_0x879d('0x6'),'browser',_0x879d('0x7'),_0x879d('0x8')]],'msg':_0x879d('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'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[_0x879d('0xa')](0x1000),'comment':_0x879d('0xb')},'data3':{'type':Sequelize[_0x879d('0xa')](0x1000),'comment':_0x879d('0xc')},'data4':{'type':Sequelize[_0x879d('0xa')](0x1000)},'data5':{'type':Sequelize[_0x879d('0xa')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x879d('0xd')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 7be53f0..786e933 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 _0xf653=['apply','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range'];(function(_0x433451,_0x125dc6){var _0x57be5d=function(_0x3acda3){while(--_0x3acda3){_0x433451['push'](_0x433451['shift']());}};_0x57be5d(++_0x125dc6);}(_0xf653,0x176));var _0x3f65=function(_0x11585e,_0xf27910){_0x11585e=_0x11585e-0x0;var _0x4fe508=_0xf653[_0x11585e];return _0x4fe508;};'use strict';var pdf=require(_0x3f65('0x0'));var emlformat=require(_0x3f65('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3f65('0x2'));var jsonpatch=require(_0x3f65('0x3'));var rp=require(_0x3f65('0x4'));var moment=require(_0x3f65('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3f65('0x6'));var util=require('util');var path=require(_0x3f65('0x7'));var sox=require(_0x3f65('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f65('0x9'));var squel=require(_0x3f65('0xa'));var crypto=require(_0x3f65('0xb'));var jsforce=require(_0x3f65('0xc'));var deskjs=require(_0x3f65('0xd'));var toCsv=require(_0x3f65('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f65('0xf'));var authService=require(_0x3f65('0x10'));var qs=require(_0x3f65('0x11'));var as=require(_0x3f65('0x12'));var hardwareService=require(_0x3f65('0x13'));var logger=require(_0x3f65('0x14'))(_0x3f65('0x15'));var utils=require('../../config/utils');var config=require(_0x3f65('0x16'));var db=require(_0x3f65('0x17'))['db'];function respondWithStatusCode(_0x596504,_0x1b974c){_0x1b974c=_0x1b974c||0xcc;return function(_0x4fbd6e){if(_0x4fbd6e){return _0x596504[_0x3f65('0x18')](_0x1b974c);}return _0x596504[_0x3f65('0x19')](_0x1b974c)[_0x3f65('0x1a')]();};}function respondWithResult(_0x1a9bc5,_0x2dc0b9){_0x2dc0b9=_0x2dc0b9||0xc8;return function(_0x1e4132){if(_0x1e4132){return _0x1a9bc5[_0x3f65('0x19')](_0x2dc0b9)[_0x3f65('0x1b')](_0x1e4132);}};}function respondWithFilteredResult(_0x3392ec,_0x4e7daf){return function(_0x24d89e){if(_0x24d89e){var _0x72f178=_0x24d89e['count'],_0x56b867=_0x4e7daf[_0x3f65('0x1c')],_0x439edf=_0x4e7daf['offset']+_0x4e7daf[_0x3f65('0x1d')],_0x3a0c66;if(_0x439edf>=_0x72f178){_0x439edf=_0x72f178;_0x3a0c66=0xc8;}else{_0x3a0c66=0xce;}_0x3392ec[_0x3f65('0x19')](_0x3a0c66);return _0x3392ec['set'](_0x3f65('0x1e'),_0x56b867+'-'+_0x439edf+'/'+_0x72f178)[_0x3f65('0x1b')](_0x24d89e);}return null;};}function patchUpdates(_0x50a1ff){return function(_0x5cc3af){try{jsonpatch[_0x3f65('0x1f')](_0x5cc3af,_0x50a1ff,!![]);}catch(_0x6652a2){return BPromise['reject'](_0x6652a2);}return _0x5cc3af[_0x3f65('0x20')]();};}function saveUpdates(_0x3b8ecc,_0x1d876e){return function(_0xe21e22){if(_0xe21e22){return _0xe21e22[_0x3f65('0x21')](_0x3b8ecc)[_0x3f65('0x22')](function(_0xd4ba66){return _0xd4ba66;});}return null;};}function removeEntity(_0x541954,_0x13b64f){return function(_0x558c55){if(_0x558c55){return _0x558c55[_0x3f65('0x23')]()[_0x3f65('0x22')](function(){_0x541954[_0x3f65('0x19')](0xcc)[_0x3f65('0x1a')]();});}};}function handleEntityNotFound(_0x3a03e8,_0x1c7949){return function(_0x378a00){if(!_0x378a00){_0x3a03e8[_0x3f65('0x18')](0x194);}return _0x378a00;};}function handleError(_0x56e5ad,_0x2dd92b){_0x2dd92b=_0x2dd92b||0x1f4;return function(_0x103bdf){logger[_0x3f65('0x24')](_0x103bdf[_0x3f65('0x25')]);if(_0x103bdf['name']){delete _0x103bdf[_0x3f65('0x26')];}_0x56e5ad[_0x3f65('0x19')](_0x2dd92b)[_0x3f65('0x27')](_0x103bdf);};}exports['update']=function(_0x369d26,_0x407979){if(_0x369d26[_0x3f65('0x28')]['id']){delete _0x369d26['body']['id'];}return db[_0x3f65('0x29')][_0x3f65('0x2a')]({'where':{'id':_0x369d26[_0x3f65('0x2b')]['id']}})[_0x3f65('0x22')](handleEntityNotFound(_0x407979,null))[_0x3f65('0x22')](saveUpdates(_0x369d26[_0x3f65('0x28')],null))[_0x3f65('0x22')](respondWithResult(_0x407979,null))[_0x3f65('0x2c')](handleError(_0x407979,null));};exports[_0x3f65('0x23')]=function(_0x417728,_0x388fa4){return db[_0x3f65('0x29')][_0x3f65('0x2a')]({'where':{'id':_0x417728[_0x3f65('0x2b')]['id']}})[_0x3f65('0x22')](handleEntityNotFound(_0x388fa4,null))[_0x3f65('0x22')](removeEntity(_0x388fa4,null))[_0x3f65('0x2c')](handleError(_0x388fa4,null));}; \ No newline at end of file +var _0xe3db=['html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','body','find','catch','destroy','Action'];(function(_0xbe972f,_0x4dd944){var _0x43ba76=function(_0x855e0b){while(--_0x855e0b){_0xbe972f['push'](_0xbe972f['shift']());}};_0x43ba76(++_0x4dd944);}(_0xe3db,0xc8));var _0xbe3d=function(_0x346891,_0x23a17c){_0x346891=_0x346891-0x0;var _0x5d19dc=_0xe3db[_0x346891];return _0x5d19dc;};'use strict';var pdf=require(_0xbe3d('0x0'));var emlformat=require(_0xbe3d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbe3d('0x2'));var jsonpatch=require(_0xbe3d('0x3'));var rp=require(_0xbe3d('0x4'));var moment=require(_0xbe3d('0x5'));var BPromise=require(_0xbe3d('0x6'));var Mustache=require(_0xbe3d('0x7'));var util=require(_0xbe3d('0x8'));var path=require(_0xbe3d('0x9'));var sox=require(_0xbe3d('0xa'));var csv=require(_0xbe3d('0xb'));var ejs=require(_0xbe3d('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbe3d('0xd'));var crypto=require(_0xbe3d('0xe'));var jsforce=require(_0xbe3d('0xf'));var deskjs=require(_0xbe3d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbe3d('0x11'));var Papa=require(_0xbe3d('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbe3d('0x13'));var as=require(_0xbe3d('0x14'));var hardwareService=require(_0xbe3d('0x15'));var logger=require(_0xbe3d('0x16'))(_0xbe3d('0x17'));var utils=require(_0xbe3d('0x18'));var config=require(_0xbe3d('0x19'));var db=require(_0xbe3d('0x1a'))['db'];function respondWithStatusCode(_0x1ff83c,_0x276e4c){_0x276e4c=_0x276e4c||0xcc;return function(_0x4d25e7){if(_0x4d25e7){return _0x1ff83c[_0xbe3d('0x1b')](_0x276e4c);}return _0x1ff83c['status'](_0x276e4c)[_0xbe3d('0x1c')]();};}function respondWithResult(_0x177643,_0x399333){_0x399333=_0x399333||0xc8;return function(_0x1a142b){if(_0x1a142b){return _0x177643[_0xbe3d('0x1d')](_0x399333)[_0xbe3d('0x1e')](_0x1a142b);}};}function respondWithFilteredResult(_0x20b01f,_0x98ce08){return function(_0x2bb8c2){if(_0x2bb8c2){var _0x1e8ecc=_0x2bb8c2[_0xbe3d('0x1f')],_0x2a45ef=_0x98ce08['offset'],_0x196b9a=_0x98ce08[_0xbe3d('0x20')]+_0x98ce08[_0xbe3d('0x21')],_0x113b23;if(_0x196b9a>=_0x1e8ecc){_0x196b9a=_0x1e8ecc;_0x113b23=0xc8;}else{_0x113b23=0xce;}_0x20b01f[_0xbe3d('0x1d')](_0x113b23);return _0x20b01f[_0xbe3d('0x22')](_0xbe3d('0x23'),_0x2a45ef+'-'+_0x196b9a+'/'+_0x1e8ecc)[_0xbe3d('0x1e')](_0x2bb8c2);}return null;};}function patchUpdates(_0x1d2ccc){return function(_0x2b3db3){try{jsonpatch[_0xbe3d('0x24')](_0x2b3db3,_0x1d2ccc,!![]);}catch(_0x5f0b4b){return BPromise[_0xbe3d('0x25')](_0x5f0b4b);}return _0x2b3db3[_0xbe3d('0x26')]();};}function saveUpdates(_0x466c2a,_0x1c802f){return function(_0x316a83){if(_0x316a83){return _0x316a83[_0xbe3d('0x27')](_0x466c2a)[_0xbe3d('0x28')](function(_0x271a7e){return _0x271a7e;});}return null;};}function removeEntity(_0x431ba1,_0x37b211){return function(_0x2a44c0){if(_0x2a44c0){return _0x2a44c0['destroy']()[_0xbe3d('0x28')](function(){_0x431ba1[_0xbe3d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24501a,_0x4b755a){return function(_0x638959){if(!_0x638959){_0x24501a[_0xbe3d('0x1b')](0x194);}return _0x638959;};}function handleError(_0x4b87bc,_0x1f2cd0){_0x1f2cd0=_0x1f2cd0||0x1f4;return function(_0x297595){logger[_0xbe3d('0x29')](_0x297595[_0xbe3d('0x2a')]);if(_0x297595[_0xbe3d('0x2b')]){delete _0x297595[_0xbe3d('0x2b')];}_0x4b87bc[_0xbe3d('0x1d')](_0x1f2cd0)[_0xbe3d('0x2c')](_0x297595);};}exports[_0xbe3d('0x27')]=function(_0x4f41a7,_0x14a7f1){if(_0x4f41a7['body']['id']){delete _0x4f41a7[_0xbe3d('0x2d')]['id'];}return db['Action'][_0xbe3d('0x2e')]({'where':{'id':_0x4f41a7['params']['id']}})[_0xbe3d('0x28')](handleEntityNotFound(_0x14a7f1,null))[_0xbe3d('0x28')](saveUpdates(_0x4f41a7[_0xbe3d('0x2d')],null))[_0xbe3d('0x28')](respondWithResult(_0x14a7f1,null))[_0xbe3d('0x2f')](handleError(_0x14a7f1,null));};exports[_0xbe3d('0x30')]=function(_0x217bbe,_0x5e0810){return db[_0xbe3d('0x31')][_0xbe3d('0x2e')]({'where':{'id':_0x217bbe['params']['id']}})['then'](handleEntityNotFound(_0x5e0810,null))[_0xbe3d('0x28')](removeEntity(_0x5e0810,null))[_0xbe3d('0x2f')](handleError(_0x5e0810,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 7710eb3..9be12ee 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 _0xe5fa=['exports','define','Action','tools_actions','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./action.attributes'];(function(_0x1bd727,_0x1ce3ab){var _0x1658ba=function(_0x1a18cf){while(--_0x1a18cf){_0x1bd727['push'](_0x1bd727['shift']());}};_0x1658ba(++_0x1ce3ab);}(_0xe5fa,0x130));var _0xae5f=function(_0x577768,_0x23ba31){_0x577768=_0x577768-0x0;var _0xb9444d=_0xe5fa[_0x577768];return _0xb9444d;};'use strict';var _=require(_0xae5f('0x0'));var util=require(_0xae5f('0x1'));var logger=require(_0xae5f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xae5f('0x3'));var rp=require(_0xae5f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae5f('0x5'));var config=require(_0xae5f('0x6'));var attributes=require(_0xae5f('0x7'));module[_0xae5f('0x8')]=function(_0x1df4ce,_0x61c0d){return _0x1df4ce[_0xae5f('0x9')](_0xae5f('0xa'),attributes,{'tableName':_0xae5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e96=['define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports'];(function(_0x30f87a,_0x2cce5a){var _0x3a8efc=function(_0x225d6b){while(--_0x225d6b){_0x30f87a['push'](_0x30f87a['shift']());}};_0x3a8efc(++_0x2cce5a);}(_0x8e96,0xfe));var _0x68e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e96[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x68e9('0x0'));var util=require(_0x68e9('0x1'));var logger=require(_0x68e9('0x2'))(_0x68e9('0x3'));var moment=require(_0x68e9('0x4'));var BPromise=require(_0x68e9('0x5'));var rp=require(_0x68e9('0x6'));var fs=require('fs');var path=require(_0x68e9('0x7'));var rimraf=require(_0x68e9('0x8'));var config=require(_0x68e9('0x9'));var attributes=require(_0x68e9('0xa'));module[_0x68e9('0xb')]=function(_0x1ddb5c,_0x273582){return _0x1ddb5c[_0x68e9('0xc')]('Action',attributes,{'tableName':_0x68e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index dd53512..9c6f7cd 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(_0xff22a,_0x5e704f){var _0x13f45f=function(_0x6ec3f){while(--_0x6ec3f){_0xff22a['push'](_0xff22a['shift']());}};_0x13f45f(++_0x5e704f);}(_0x70e0,0x17b));var _0x070e=function(_0xfab20b,_0x2676ed){_0xfab20b=_0xfab20b-0x0;var _0x334e7c=_0x70e0[_0xfab20b];return _0x334e7c;};'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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0x19d7cf,_0x2b78ef){var _0x1057ea=function(_0x1aff93){while(--_0x1aff93){_0x19d7cf['push'](_0x19d7cf['shift']());}};_0x1057ea(++_0x2b78ef);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xcb91[_0x41c381];return _0x427981;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('Action,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 8f4f7dd..165b396 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 _0xd4be=['update','delete','isAuthenticated','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x5a0252,_0x34e35d){var _0x30887=function(_0x4451b9){while(--_0x4451b9){_0x5a0252['push'](_0x5a0252['shift']());}};_0x30887(++_0x34e35d);}(_0xd4be,0x189));var _0xed4b=function(_0x3e6920,_0x5a1352){_0x3e6920=_0x3e6920-0x0;var _0x3bbd9f=_0xd4be[_0x3e6920];return _0x3bbd9f;};'use strict';var multer=require(_0xed4b('0x0'));var util=require('util');var path=require(_0xed4b('0x1'));var timeout=require(_0xed4b('0x2'));var express=require('express');var router=express[_0xed4b('0x3')]();var auth=require(_0xed4b('0x4'));var interaction=require(_0xed4b('0x5'));var config=require(_0xed4b('0x6'));var controller=require(_0xed4b('0x7'));router[_0xed4b('0x8')](_0xed4b('0x9'),auth['isAuthenticated'](),controller[_0xed4b('0xa')]);router[_0xed4b('0xb')](_0xed4b('0x9'),auth[_0xed4b('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8238=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated'];(function(_0x450ad9,_0x1152f7){var _0x17e64e=function(_0x53efac){while(--_0x53efac){_0x450ad9['push'](_0x450ad9['shift']());}};_0x17e64e(++_0x1152f7);}(_0x8238,0x18b));var _0x8823=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x8238[_0x43a37c];return _0x5d1d40;};'use strict';var multer=require(_0x8823('0x0'));var util=require(_0x8823('0x1'));var path=require(_0x8823('0x2'));var timeout=require(_0x8823('0x3'));var express=require(_0x8823('0x4'));var router=express[_0x8823('0x5')]();var auth=require(_0x8823('0x6'));var interaction=require(_0x8823('0x7'));var config=require(_0x8823('0x8'));var controller=require(_0x8823('0x9'));router[_0x8823('0xa')](_0x8823('0xb'),auth[_0x8823('0xc')](),controller[_0x8823('0xd')]);router[_0x8823('0xe')](_0x8823('0xb'),auth[_0x8823('0xc')](),controller[_0x8823('0xf')]);module[_0x8823('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0695733..5f3b5c0 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 _0xf478=['exports','TEXT','sequelize'];(function(_0x50cd58,_0x2ea444){var _0x27c4a8=function(_0x1522bb){while(--_0x1522bb){_0x50cd58['push'](_0x50cd58['shift']());}};_0x27c4a8(++_0x2ea444);}(_0xf478,0xb0));var _0x8f47=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xf478[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x8f47('0x0'));module[_0x8f47('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8f47('0x2')]},'joins':{'type':Sequelize[_0x8f47('0x2')]}}; \ No newline at end of file +var _0xacb9=['sequelize','STRING','TEXT'];(function(_0x17c7f0,_0x1746d5){var _0x366efd=function(_0x489d0f){while(--_0x489d0f){_0x17c7f0['push'](_0x17c7f0['shift']());}};_0x366efd(++_0x1746d5);}(_0xacb9,0x66));var _0x9acb=function(_0x19cbcc,_0x44384e){_0x19cbcc=_0x19cbcc-0x0;var _0x44d405=_0xacb9[_0x19cbcc];return _0x44d405;};'use strict';var Sequelize=require(_0x9acb('0x0'));module['exports']={'name':{'type':Sequelize[_0x9acb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9acb('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9acb('0x2')]},'joins':{'type':Sequelize[_0x9acb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 8b6af04..05c9a7f 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 _0x9221=['filter','merge','options','include','findAll','rows','show','rawAttributes','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','No\x20available\x20data','output','web','fullPath','randomstring','generate','csv','custom','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','%s.%s\x20=\x20%s.%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','count','limit','set','Content-Range','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','VIRTUAL'];(function(_0x564df0,_0xfb8dfe){var _0x1ba957=function(_0x2a2845){while(--_0x2a2845){_0x564df0['push'](_0x564df0['shift']());}};_0x1ba957(++_0xfb8dfe);}(_0x9221,0x64));var _0x1922=function(_0xde0a7f,_0x33437f){_0xde0a7f=_0xde0a7f-0x0;var _0x1b5b69=_0x9221[_0xde0a7f];return _0x1b5b69;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1922('0x0'));var rimraf=require(_0x1922('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1922('0x2'));var rp=require(_0x1922('0x3'));var moment=require('moment');var BPromise=require(_0x1922('0x4'));var Mustache=require(_0x1922('0x5'));var util=require(_0x1922('0x6'));var path=require(_0x1922('0x7'));var sox=require(_0x1922('0x8'));var csv=require(_0x1922('0x9'));var ejs=require(_0x1922('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1922('0xb'));var crypto=require(_0x1922('0xc'));var jsforce=require(_0x1922('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1922('0x9'));var querystring=require('querystring');var Papa=require(_0x1922('0xe'));var Redis=require(_0x1922('0xf'));var authService=require(_0x1922('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1922('0x11'));var hardwareService=require(_0x1922('0x12'));var logger=require('../../config/logger')(_0x1922('0x13'));var utils=require('../../config/utils');var config=require(_0x1922('0x14'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1922('0x15'))[_0x1922('0x16')];function respondWithStatusCode(_0x2db5b9,_0x58cfe7){_0x58cfe7=_0x58cfe7||0xcc;return function(_0x514b6d){if(_0x514b6d){return _0x2db5b9[_0x1922('0x17')](_0x58cfe7);}return _0x2db5b9[_0x1922('0x18')](_0x58cfe7)[_0x1922('0x19')]();};}function respondWithResult(_0x3116dc,_0x33b35d){_0x33b35d=_0x33b35d||0xc8;return function(_0x4a76f7){if(_0x4a76f7){return _0x3116dc[_0x1922('0x18')](_0x33b35d)['json'](_0x4a76f7);}};}function respondWithFilteredResult(_0x6b9389,_0x474f72){return function(_0x22e548){if(_0x22e548){var _0x207ff4=_0x22e548[_0x1922('0x1a')],_0x533390=_0x474f72['offset'],_0x459511=_0x474f72['offset']+_0x474f72[_0x1922('0x1b')],_0x195b86;if(_0x459511>=_0x207ff4){_0x459511=_0x207ff4;_0x195b86=0xc8;}else{_0x195b86=0xce;}_0x6b9389['status'](_0x195b86);return _0x6b9389[_0x1922('0x1c')](_0x1922('0x1d'),_0x533390+'-'+_0x459511+'/'+_0x207ff4)['json'](_0x22e548);}return null;};}function patchUpdates(_0x4c60f8){return function(_0xdd6f6c){try{jsonpatch['apply'](_0xdd6f6c,_0x4c60f8,!![]);}catch(_0x23984c){return BPromise[_0x1922('0x1e')](_0x23984c);}return _0xdd6f6c[_0x1922('0x1f')]();};}function saveUpdates(_0x1803be,_0x5dacc5){return function(_0x2f2c49){if(_0x2f2c49){return _0x2f2c49[_0x1922('0x20')](_0x1803be)[_0x1922('0x21')](function(_0x15fd74){return _0x15fd74;});}return null;};}function removeEntity(_0x554f8b,_0xa5a368){return function(_0x287af9){if(_0x287af9){return _0x287af9[_0x1922('0x22')]()['then'](function(){var _0x29b92f=_0x287af9['get']({'plain':!![]});var _0x547b8c=_0x1922('0x23');return db[_0x1922('0x24')][_0x1922('0x22')]({'where':{'type':_0x547b8c,'resourceId':_0x29b92f['id']}})[_0x1922('0x21')](function(){return _0x287af9;});})[_0x1922('0x21')](function(){_0x554f8b[_0x1922('0x18')](0xcc)[_0x1922('0x19')]();});}};}function handleEntityNotFound(_0x1402ae,_0x341b01){return function(_0x12f468){if(!_0x12f468){_0x1402ae[_0x1922('0x17')](0x194);}return _0x12f468;};}function handleError(_0x49176c,_0x3db249){_0x3db249=_0x3db249||0x1f4;return function(_0x58ebb5){logger[_0x1922('0x25')](_0x58ebb5[_0x1922('0x26')]);if(_0x58ebb5[_0x1922('0x27')]){delete _0x58ebb5[_0x1922('0x27')];}_0x49176c[_0x1922('0x18')](_0x3db249)[_0x1922('0x28')](_0x58ebb5);};}exports[_0x1922('0x29')]=function(_0x6f6d8c,_0x5c6535){var _0x4b0799={},_0x17ecaa={},_0x153ebd={'count':0x0,'rows':[]};var _0x353c71=_[_0x1922('0x2a')](db[_0x1922('0x2b')]['rawAttributes'],function(_0x10f398){return{'name':_0x10f398[_0x1922('0x2c')],'type':_0x10f398[_0x1922('0x2d')][_0x1922('0x2e')]};});_0x17ecaa[_0x1922('0x2f')]=_[_0x1922('0x2a')](_0x353c71,_0x1922('0x27'));_0x17ecaa['query']=_[_0x1922('0x30')](_0x6f6d8c[_0x1922('0x31')]);_0x17ecaa[_0x1922('0x32')]=_[_0x1922('0x33')](_0x17ecaa[_0x1922('0x2f')],_0x17ecaa[_0x1922('0x31')]);_0x4b0799['attributes']=_[_0x1922('0x33')](_0x17ecaa[_0x1922('0x2f')],qs[_0x1922('0x34')](_0x6f6d8c[_0x1922('0x31')][_0x1922('0x34')]));_0x4b0799[_0x1922('0x35')]=_0x4b0799[_0x1922('0x35')]['length']?_0x4b0799[_0x1922('0x35')]:_0x17ecaa[_0x1922('0x2f')];if(!_0x6f6d8c[_0x1922('0x31')][_0x1922('0x36')](_0x1922('0x37'))){_0x4b0799[_0x1922('0x1b')]=qs['limit'](_0x6f6d8c[_0x1922('0x31')][_0x1922('0x1b')]);_0x4b0799['offset']=qs[_0x1922('0x38')](_0x6f6d8c[_0x1922('0x31')]['offset']);}_0x4b0799[_0x1922('0x39')]=qs[_0x1922('0x3a')](_0x6f6d8c[_0x1922('0x31')]['sort']);_0x4b0799[_0x1922('0x3b')]=qs[_0x1922('0x32')](_['pick'](_0x6f6d8c[_0x1922('0x31')],_0x17ecaa[_0x1922('0x32')]),_0x353c71);if(_0x6f6d8c[_0x1922('0x31')]['filter']){_0x4b0799[_0x1922('0x3b')]=_['merge'](_0x4b0799[_0x1922('0x3b')],{'$or':_['map'](_0x353c71,function(_0x53572f){if(_0x53572f[_0x1922('0x2d')]!==_0x1922('0x3c')){var _0x5f423d={};_0x5f423d[_0x53572f[_0x1922('0x27')]]={'$like':'%'+_0x6f6d8c[_0x1922('0x31')][_0x1922('0x3d')]+'%'};return _0x5f423d;}})});}_0x4b0799=_[_0x1922('0x3e')]({},_0x4b0799,_0x6f6d8c[_0x1922('0x3f')]);var _0x4c2295={'where':_0x4b0799['where']};return db[_0x1922('0x2b')][_0x1922('0x1a')](_0x4c2295)[_0x1922('0x21')](function(_0x1183a7){_0x153ebd[_0x1922('0x1a')]=_0x1183a7;if(_0x6f6d8c[_0x1922('0x31')]['includeAll']){_0x4b0799[_0x1922('0x40')]=[{'all':!![]}];}return db[_0x1922('0x2b')][_0x1922('0x41')](_0x4b0799);})[_0x1922('0x21')](function(_0x29b8af){_0x153ebd[_0x1922('0x42')]=_0x29b8af;return _0x153ebd;})[_0x1922('0x21')](respondWithFilteredResult(_0x5c6535,_0x4b0799))['catch'](handleError(_0x5c6535,null));};exports[_0x1922('0x43')]=function(_0x1e474b,_0x3f9f64){var _0x5df17d={'raw':![],'where':{'id':_0x1e474b['params']['id']}},_0x18a891={};_0x18a891[_0x1922('0x2f')]=_[_0x1922('0x30')](db[_0x1922('0x2b')][_0x1922('0x44')]);_0x18a891[_0x1922('0x31')]=_['keys'](_0x1e474b[_0x1922('0x31')]);_0x18a891[_0x1922('0x32')]=_[_0x1922('0x33')](_0x18a891[_0x1922('0x2f')],_0x18a891['query']);_0x5df17d[_0x1922('0x35')]=_['intersection'](_0x18a891[_0x1922('0x2f')],qs[_0x1922('0x34')](_0x1e474b[_0x1922('0x31')][_0x1922('0x34')]));_0x5df17d[_0x1922('0x35')]=_0x5df17d[_0x1922('0x35')][_0x1922('0x45')]?_0x5df17d['attributes']:_0x18a891['model'];if(_0x1e474b['query'][_0x1922('0x46')]){_0x5df17d[_0x1922('0x40')]=[{'all':!![]}];}_0x5df17d=_[_0x1922('0x3e')]({},_0x5df17d,_0x1e474b[_0x1922('0x3f')]);return db[_0x1922('0x2b')][_0x1922('0x47')](_0x5df17d)[_0x1922('0x21')](handleEntityNotFound(_0x3f9f64,null))[_0x1922('0x21')](respondWithResult(_0x3f9f64,null))['catch'](handleError(_0x3f9f64,null));};exports[_0x1922('0x48')]=function(_0x2b4179,_0x4ed204){return db[_0x1922('0x2b')][_0x1922('0x48')](_0x2b4179[_0x1922('0x49')],{})[_0x1922('0x21')](function(_0x1e6d2f){var _0x5b51c2=_0x2b4179['user']['get']({'plain':!![]});if(!_0x5b51c2)throw new Error(_0x1922('0x4a'));if(_0x5b51c2['role']==='user'){var _0x28adf1=_0x1e6d2f[_0x1922('0x4b')]({'plain':!![]});var _0x22d668='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x22d668,'userProfileId':_0x5b51c2['userProfileId']},'raw':!![]})[_0x1922('0x21')](function(_0x2abb8a){if(_0x2abb8a&&_0x2abb8a[_0x1922('0x4c')]===0x0){return db[_0x1922('0x24')]['create']({'name':_0x28adf1[_0x1922('0x27')],'resourceId':_0x28adf1['id'],'type':_0x1922('0x23'),'sectionId':_0x2abb8a['id']},{})[_0x1922('0x21')](function(){return _0x1e6d2f;});}else{return _0x1e6d2f;}})[_0x1922('0x4d')](function(_0x494b84){logger[_0x1922('0x25')](_0x1922('0x4e'),_0x494b84);throw _0x494b84;});}return _0x1e6d2f;})['then'](respondWithResult(_0x4ed204,0xc9))[_0x1922('0x4d')](handleError(_0x4ed204,null));};exports[_0x1922('0x20')]=function(_0x12a89f,_0x245d6f){if(_0x12a89f[_0x1922('0x49')]['id']){delete _0x12a89f[_0x1922('0x49')]['id'];}return db[_0x1922('0x2b')][_0x1922('0x47')]({'where':{'id':_0x12a89f[_0x1922('0x4f')]['id']}})[_0x1922('0x21')](handleEntityNotFound(_0x245d6f,null))[_0x1922('0x21')](saveUpdates(_0x12a89f[_0x1922('0x49')],null))[_0x1922('0x21')](respondWithResult(_0x245d6f,null))[_0x1922('0x4d')](handleError(_0x245d6f,null));};exports[_0x1922('0x22')]=function(_0x57faf7,_0x11d8b6){return db[_0x1922('0x2b')][_0x1922('0x47')]({'where':{'id':_0x57faf7[_0x1922('0x4f')]['id']}})['then'](handleEntityNotFound(_0x11d8b6,null))['then'](removeEntity(_0x11d8b6,null))['catch'](handleError(_0x11d8b6,null));};exports[_0x1922('0x50')]=function(_0x2777dd,_0x1eef02){var _0x46fb40=0xa;var _0x34c109=[_0x1922('0x51'),_0x1922('0x52'),_0x1922('0x53'),_0x1922('0x54')];var _0x4b2aa0={'SUM':_0x1922('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1922('0x56'),'MAX':'MAX(%s)','MIN':_0x1922('0x57'),'AVG':_0x1922('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1922('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xecb766={'SEC_TO_TIME':_0x1922('0x5a'),'DATE':_0x1922('0x5b'),'HOUR':_0x1922('0x5c'),'ROUND':_0x1922('0x5d'),'UNIX_TIMESTAMP':_0x1922('0x5e')};var _0x53e7ee=function(_0x1e6863){return!_[_0x1922('0x5f')]([_0x1922('0x60'),_0x1922('0x61'),_0x1922('0x62'),_0x1922('0x63')],_0x1e6863);};var _0x10a7ce=function(_0x39f5da){if(!_0x39f5da||!_0x39f5da[_0x1922('0x64')][_0x1922('0x45')]){return'';}for(var _0x41f53f='(',_0x4ff467=0x0;_0x4ff467<_0x39f5da[_0x1922('0x64')][_0x1922('0x45')];_0x4ff467+=0x1){_0x4ff467>0x0&&(_0x41f53f+='\x20'+_0x39f5da[_0x1922('0x65')]+'\x20');_0x41f53f+=_0x39f5da[_0x1922('0x64')][_0x4ff467][_0x1922('0x66')]?_0x10a7ce(_0x39f5da[_0x1922('0x64')][_0x4ff467][_0x1922('0x66')]):_0x39f5da[_0x1922('0x64')][_0x4ff467][_0x1922('0x67')]+'\x20'+_0x39f5da[_0x1922('0x64')][_0x4ff467][_0x1922('0x68')]+(_0x53e7ee(_0x39f5da['rules'][_0x4ff467][_0x1922('0x68')])?'\x20'+_0x39f5da[_0x1922('0x64')][_0x4ff467][_0x1922('0x69')]:'');}return _0x41f53f+')';};var _0x481d81={'where':{'id':_0x2777dd[_0x1922('0x4f')]['id']}},_0x214eb4,_0x2dbb37,_0x287726,_0x4cda1d,_0x48b311;_0x481d81=_['merge']({},_0x481d81,_0x2777dd[_0x1922('0x3f')]);return db[_0x1922('0x2b')][_0x1922('0x47')](_0x481d81)[_0x1922('0x21')](function(_0x51a42d){if(_0x51a42d){_0x214eb4=_0x51a42d;return _0x51a42d[_0x1922('0x6a')]();}return null;})[_0x1922('0x21')](function(_0x20a5ec){if(_0x20a5ec){if(!_0x20a5ec[_0x1922('0x45')]){throw new db[(_0x1922('0x6b'))]['ValidationErrorItem'](_0x1922('0x6c'),0x193);}_0x2dbb37=_0x20a5ec;return db['AnalyticMetric'][_0x1922('0x41')]({'raw':!![]});}return null;})[_0x1922('0x21')](function(_0x139285){if(_0x139285){_0x287726=_['keyBy'](_0x139285,'id');var _0x432706;var _0x577174=squel['select']();_0x577174[_0x1922('0x6d')](_0x214eb4['table']);for(var _0x6c5001=0x0;_0x6c5001<_0x2dbb37[_0x1922('0x45')];_0x6c5001+=0x1){_0x432706=_0x2dbb37[_0x6c5001][_0x1922('0x6e')]?_0x287726[_0x2dbb37[_0x6c5001][_0x1922('0x6e')]][_0x1922('0x6f')]:_0x2dbb37[_0x6c5001][_0x1922('0x67')];_0x432706=_0x2dbb37[_0x6c5001][_0x1922('0x70')]?_[_0x1922('0x71')](_0x4b2aa0[_0x2dbb37[_0x6c5001]['function']],'%s',_0x432706):_0x432706;_0x432706=_0x2dbb37[_0x6c5001][_0x1922('0x72')]?_[_0x1922('0x71')](_0xecb766[_0x2dbb37[_0x6c5001][_0x1922('0x72')]],'%s',_0x432706):_0x432706;if(_0x2dbb37[_0x6c5001][_0x1922('0x73')]){_0x577174[_0x1922('0x66')](_0x432706);}_0x2dbb37[_0x6c5001][_0x1922('0x74')]&&_0x577174[_0x1922('0x39')](_0x432706,_0x2dbb37[_0x6c5001][_0x1922('0x74')]===_0x1922('0x75')?![]:!![]);_0x577174[_0x1922('0x67')](_0x432706,_0x2dbb37[_0x6c5001][_0x1922('0x76')]||_0x432706);}if(_0x214eb4['joins']){_0x214eb4[_0x1922('0x77')]=JSON[_0x1922('0x78')](_0x214eb4[_0x1922('0x77')]);for(var _0x413e52=0x0;_0x413e52<_0x214eb4[_0x1922('0x77')][_0x1922('0x45')];_0x413e52+=0x1){if(_0x214eb4[_0x1922('0x77')][_0x413e52][_0x1922('0x2d')]&&_[_0x1922('0x5f')](_0x34c109,_0x214eb4[_0x1922('0x77')][_0x413e52][_0x1922('0x2d')])&&_0x214eb4[_0x1922('0x77')][_0x413e52][_0x1922('0x79')]&&_0x214eb4[_0x1922('0x77')][_0x413e52][_0x1922('0x7a')]&&_0x214eb4[_0x1922('0x77')][_0x413e52][_0x1922('0x7b')]){_0x577174[_0x214eb4[_0x1922('0x77')][_0x413e52][_0x1922('0x2d')]](_0x214eb4[_0x1922('0x77')][_0x413e52][_0x1922('0x7a')],null,util[_0x1922('0x72')]('%s.%s\x20=\x20%s.%s',_0x214eb4[_0x1922('0x7c')],_0x214eb4[_0x1922('0x77')][_0x413e52][_0x1922('0x79')],_0x214eb4[_0x1922('0x77')][_0x413e52][_0x1922('0x7a')],_0x214eb4['joins'][_0x413e52][_0x1922('0x7b')]));}}}if(_0x214eb4['conditions']){_0x214eb4[_0x1922('0x7d')]=JSON[_0x1922('0x78')](_0x214eb4[_0x1922('0x7d')]);_0x577174[_0x1922('0x3b')](_0x10a7ce(_0x214eb4[_0x1922('0x7d')][_0x1922('0x66')]));}_0x48b311=_0x577174[_0x1922('0x7e')]();_0x577174['limit'](_0x46fb40);_0x577174[_0x1922('0x38')](0x0);logger[_0x1922('0x7f')](_0x1922('0x80'),_0x577174[_0x1922('0x81')]());return db[_0x1922('0x82')][_0x1922('0x31')](_0x577174[_0x1922('0x81')](),{'type':db['sequelize'][_0x1922('0x83')][_0x1922('0x84')]});}})[_0x1922('0x21')](respondWithResult(_0x1eef02,null))[_0x1922('0x4d')](handleError(_0x1eef02,null));};function runReport(_0x3dbf8d,_0x32b23f,_0x22981e){var _0x14b419=_0x32b23f[_0x1922('0x27')];var _0x239e0f=0xa;var _0x50bc2a=[_0x1922('0x51'),'left_join',_0x1922('0x53'),_0x1922('0x54')];var _0x28b5d8={'SUM':_0x1922('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1922('0x85'),'MIN':_0x1922('0x57'),'AVG':_0x1922('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1922('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x12204f={'SEC_TO_TIME':_0x1922('0x5a'),'DATE':_0x1922('0x5b'),'HOUR':_0x1922('0x5c'),'ROUND':_0x1922('0x5d'),'UNIX_TIMESTAMP':_0x1922('0x5e')};var _0x13dba6=function(_0x3688c5){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1922('0x62'),_0x1922('0x63')],_0x3688c5);};var _0xc04653=function(_0x137fd8){if(!_0x137fd8||!_0x137fd8['rules'][_0x1922('0x45')]){return'';}for(var _0x4dcb1b='(',_0x48b387=0x0;_0x48b387<_0x137fd8['rules'][_0x1922('0x45')];_0x48b387+=0x1){_0x48b387>0x0&&(_0x4dcb1b+='\x20'+_0x137fd8[_0x1922('0x65')]+'\x20');_0x4dcb1b+=_0x137fd8[_0x1922('0x64')][_0x48b387]['group']?_0xc04653(_0x137fd8['rules'][_0x48b387][_0x1922('0x66')]):_0x137fd8[_0x1922('0x64')][_0x48b387][_0x1922('0x67')]+'\x20'+_0x137fd8[_0x1922('0x64')][_0x48b387][_0x1922('0x68')]+(_0x13dba6(_0x137fd8['rules'][_0x48b387][_0x1922('0x68')])?'\x20'+_0x137fd8['rules'][_0x48b387][_0x1922('0x69')]:'');}return _0x4dcb1b+')';};var _0x4672a3={'where':{'id':_0x3dbf8d['id']}},_0x2c70b6,_0x158d39,_0x203037,_0x3137ec,_0x175278;_0x4672a3=_[_0x1922('0x3e')]({},_0x4672a3,_0x22981e);return db[_0x1922('0x2b')][_0x1922('0x47')](_0x4672a3)[_0x1922('0x21')](function(_0x5ab8a4){if(_0x5ab8a4){_0x2c70b6=_0x5ab8a4;return _0x5ab8a4[_0x1922('0x6a')]();}return null;})[_0x1922('0x21')](function(_0xde6c2c){if(_0xde6c2c){if(!_0xde6c2c[_0x1922('0x45')]){throw new db['Sequelize'][(_0x1922('0x86'))](_0x1922('0x6c'),0x193);}_0x158d39=_0xde6c2c;return db[_0x1922('0x87')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x4949e3){if(_0x4949e3){_0x203037=_[_0x1922('0x88')](_0x4949e3,'id');var _0x59a204;var _0x5da23c=squel[_0x1922('0x89')]();_0x5da23c[_0x1922('0x6d')](_0x2c70b6[_0x1922('0x7c')]);for(var _0x4f6c99=0x0;_0x4f6c99<_0x158d39[_0x1922('0x45')];_0x4f6c99+=0x1){_0x59a204=_0x158d39[_0x4f6c99][_0x1922('0x6e')]?_0x203037[_0x158d39[_0x4f6c99]['MetricId']][_0x1922('0x6f')]:_0x158d39[_0x4f6c99][_0x1922('0x67')];_0x59a204=_0x158d39[_0x4f6c99][_0x1922('0x70')]?_[_0x1922('0x71')](_0x28b5d8[_0x158d39[_0x4f6c99][_0x1922('0x70')]],'%s',_0x59a204):_0x59a204;_0x59a204=_0x158d39[_0x4f6c99][_0x1922('0x72')]?_[_0x1922('0x71')](_0x12204f[_0x158d39[_0x4f6c99][_0x1922('0x72')]],'%s',_0x59a204):_0x59a204;if(_0x158d39[_0x4f6c99][_0x1922('0x73')]){_0x5da23c[_0x1922('0x66')](_0x59a204);}_0x158d39[_0x4f6c99][_0x1922('0x74')]&&_0x5da23c[_0x1922('0x39')](_0x59a204,_0x158d39[_0x4f6c99][_0x1922('0x74')]===_0x1922('0x75')?![]:!![]);_0x5da23c[_0x1922('0x67')](_0x59a204,_0x158d39[_0x4f6c99]['alias']||_0x59a204);}if(_0x2c70b6[_0x1922('0x77')]){_0x2c70b6[_0x1922('0x77')]=JSON[_0x1922('0x78')](_0x2c70b6['joins']);for(var _0x76e378=0x0;_0x76e378<_0x2c70b6[_0x1922('0x77')][_0x1922('0x45')];_0x76e378+=0x1){if(_0x2c70b6['joins'][_0x76e378][_0x1922('0x2d')]&&_[_0x1922('0x5f')](_0x50bc2a,_0x2c70b6[_0x1922('0x77')][_0x76e378]['type'])&&_0x2c70b6[_0x1922('0x77')][_0x76e378]['parentKey']&&_0x2c70b6[_0x1922('0x77')][_0x76e378][_0x1922('0x7a')]&&_0x2c70b6[_0x1922('0x77')][_0x76e378][_0x1922('0x7b')]){_0x5da23c[_0x2c70b6[_0x1922('0x77')][_0x76e378][_0x1922('0x2d')]](_0x2c70b6[_0x1922('0x77')][_0x76e378]['foreignTable'],null,util[_0x1922('0x72')]('%s.%s\x20=\x20%s.%s',_0x2c70b6[_0x1922('0x7c')],_0x2c70b6[_0x1922('0x77')][_0x76e378][_0x1922('0x79')],_0x2c70b6[_0x1922('0x77')][_0x76e378]['foreignTable'],_0x2c70b6[_0x1922('0x77')][_0x76e378][_0x1922('0x7b')]));}}}if(_0x2c70b6[_0x1922('0x7d')]){_0x2c70b6[_0x1922('0x7d')]=JSON['parse'](_0x2c70b6['conditions']);_0x5da23c['where'](_0xc04653(_0x2c70b6[_0x1922('0x7d')]['group']));}_0x175278=_0x5da23c[_0x1922('0x7e')]();_0x5da23c['limit'](_0x239e0f);_0x5da23c[_0x1922('0x38')](0x0);logger[_0x1922('0x7f')](_0x1922('0x80'),_0x5da23c[_0x1922('0x81')]());return db[_0x1922('0x82')][_0x1922('0x31')](_0x5da23c[_0x1922('0x81')](),{'type':db['sequelize']['QueryTypes'][_0x1922('0x84')]});}})['then'](function(_0x5d1035){if(!_0x5d1035[_0x1922('0x45')]){throw new db['Sequelize']['ValidationErrorItem'](_0x1922('0x8a'),0xcc);}if(_0x32b23f[_0x1922('0x8b')]===_0x1922('0x8c')){return null;}var _0x471455=_[_0x1922('0x3e')](_0x32b23f,{'name':_0x32b23f[_0x1922('0x8d')]||_0x32b23f[_0x1922('0x27')]||_0x2c70b6[_0x1922('0x27')],'basename':_0x14b419,'savename':util[_0x1922('0x72')]('%s-%s.%s',_0x32b23f[_0x1922('0x27')]||_0x2c70b6[_0x1922('0x27')],require(_0x1922('0x8e'))[_0x1922('0x8f')](0x4),_0x32b23f[_0x1922('0x8b')]||_0x1922('0x90')),'reportId':_0x2c70b6['id'],'reportType':_0x1922('0x91')});return db['AnalyticExtractedReport'][_0x1922('0x48')](_0x471455,{'raw':!![]});})['then'](function(_0x5aa486){if(_0x2c70b6['table']===_0x1922('0x92')){_0x175278[_0x1922('0x3b')](_0x2c70b6[_0x1922('0x7c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x32b23f[_0x1922('0x93')],_0x32b23f[_0x1922('0x94')]);}else{_0x175278[_0x1922('0x3b')](_0x2c70b6['table']+_0x1922('0x95'),_0x32b23f[_0x1922('0x93')],_0x32b23f[_0x1922('0x94')]);}if(_0x5aa486){logger['info'](_0x1922('0x96'),_0x175278[_0x1922('0x81')]());require(_0x1922('0x97'))['fork'](path['join'](__dirname,_0x1922('0x98'),_0x5aa486[_0x1922('0x8b')]),[_0x5aa486['id'],_0x175278[_0x1922('0x81')](),path[_0x1922('0x51')](__dirname,_0x1922('0x99'),_0x5aa486[_0x1922('0x9a')]),_0x14b419]);return _0x5aa486;}else{var _0x259fe0=squel['select']();_0x259fe0[_0x1922('0x6d')]('('+_0x175278[_0x1922('0x81')]()+')','countTable');_0x259fe0[_0x1922('0x67')](_0x1922('0x9b'),_0x1922('0x1a'));_0x175278[_0x1922('0x1b')](_0x32b23f[_0x1922('0x1b')]||_0x239e0f);_0x175278[_0x1922('0x38')](_0x32b23f[_0x1922('0x38')]||0x0);return dbH[_0x1922('0x82')][_0x1922('0x31')](_0x259fe0[_0x1922('0x81')](),{'type':dbH[_0x1922('0x82')][_0x1922('0x83')][_0x1922('0x84')]})['then'](function(_0x19caee){if(!_0x19caee[_0x1922('0x45')]){_0x3137ec=0x0;}else{_0x3137ec=_0x19caee[0x0][_0x1922('0x1a')]||0x0;}return dbH[_0x1922('0x82')][_0x1922('0x31')](_0x175278[_0x1922('0x81')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x1922('0x21')](function(_0x16695a){return{'rows':_0x16695a||[],'count':_0x3137ec};});}});}exports[_0x1922('0x9c')]=function(_0x482413,_0x254300){return runReport(_0x482413[_0x1922('0x4f')],_0x482413[_0x1922('0x31')],_0x482413['options'])[_0x1922('0x21')](respondWithResult(_0x254300,null))[_0x1922('0x4d')](handleError(_0x254300,null));};exports[_0x1922('0x9d')]=runReport;exports[_0x1922('0x31')]=function(_0x5d9d28,_0x1b2e71){var _0x7bd6d0=0xa;var _0x181a90=[_0x1922('0x51'),'left_join',_0x1922('0x53'),_0x1922('0x54')];var _0x5caa8d={'SUM':_0x1922('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1922('0x85'),'MIN':_0x1922('0x57'),'AVG':_0x1922('0x58'),'GROUP_CONCAT':_0x1922('0x9e'),'GROUP_CONCAT ASC':_0x1922('0x59'),'GROUP_CONCAT DESC':_0x1922('0x9f')};var _0x4fa8e1={'SEC_TO_TIME':_0x1922('0x5a'),'DATE':_0x1922('0x5b'),'HOUR':_0x1922('0x5c'),'ROUND':_0x1922('0x5d'),'UNIX_TIMESTAMP':_0x1922('0x5e')};var _0x2cff0c=function(_0x495d7c){return!_[_0x1922('0x5f')]([_0x1922('0x60'),_0x1922('0x61'),_0x1922('0x62'),_0x1922('0x63')],_0x495d7c);};var _0x4dce6e=function(_0x5e3fa2){if(!_0x5e3fa2||!_0x5e3fa2[_0x1922('0x64')][_0x1922('0x45')]){return'';}for(var _0x464977='(',_0x2e3c5d=0x0;_0x2e3c5d<_0x5e3fa2['rules'][_0x1922('0x45')];_0x2e3c5d+=0x1){_0x2e3c5d>0x0&&(_0x464977+='\x20'+_0x5e3fa2[_0x1922('0x65')]+'\x20');_0x464977+=_0x5e3fa2[_0x1922('0x64')][_0x2e3c5d][_0x1922('0x66')]?_0x4dce6e(_0x5e3fa2['rules'][_0x2e3c5d][_0x1922('0x66')]):_0x5e3fa2[_0x1922('0x64')][_0x2e3c5d][_0x1922('0x67')]+'\x20'+_0x5e3fa2[_0x1922('0x64')][_0x2e3c5d][_0x1922('0x68')]+(_0x2cff0c(_0x5e3fa2['rules'][_0x2e3c5d][_0x1922('0x68')])?'\x20'+_0x5e3fa2[_0x1922('0x64')][_0x2e3c5d][_0x1922('0x69')]:'');}return _0x464977+')';};var _0x60c7d={'where':{'id':_0x5d9d28[_0x1922('0x4f')]['id']}},_0x5dabda,_0x3e96f0,_0x4eb7d0,_0x5dc157,_0x53a9b9;_0x60c7d=_[_0x1922('0x3e')]({},_0x60c7d,_0x5d9d28[_0x1922('0x3f')]);return db[_0x1922('0x2b')][_0x1922('0x47')](_0x60c7d)[_0x1922('0x21')](function(_0x4cc90b){if(_0x4cc90b){_0x5dabda=_0x4cc90b;return _0x4cc90b[_0x1922('0x6a')]();}return null;})[_0x1922('0x21')](function(_0x51d0cd){if(_0x51d0cd){if(!_0x51d0cd[_0x1922('0x45')]){throw new db['Sequelize'][(_0x1922('0x86'))](_0x1922('0x6c'),0x193);}_0x3e96f0=_0x51d0cd;return db[_0x1922('0x87')]['findAll']({'raw':!![]});}return null;})[_0x1922('0x21')](function(_0x537ed0){if(_0x537ed0){_0x4eb7d0=_[_0x1922('0x88')](_0x537ed0,'id');var _0x1fd925;var _0x3f8672=squel['select']();_0x3f8672[_0x1922('0x6d')](_0x5dabda[_0x1922('0x7c')]);for(var _0x35d2b3=0x0;_0x35d2b3<_0x3e96f0[_0x1922('0x45')];_0x35d2b3+=0x1){_0x1fd925=_0x3e96f0[_0x35d2b3][_0x1922('0x6e')]?_0x4eb7d0[_0x3e96f0[_0x35d2b3]['MetricId']][_0x1922('0x6f')]:_0x3e96f0[_0x35d2b3]['field'];_0x1fd925=_0x3e96f0[_0x35d2b3][_0x1922('0x70')]?_[_0x1922('0x71')](_0x5caa8d[_0x3e96f0[_0x35d2b3][_0x1922('0x70')]],'%s',_0x1fd925):_0x1fd925;_0x1fd925=_0x3e96f0[_0x35d2b3][_0x1922('0x72')]?_[_0x1922('0x71')](_0x4fa8e1[_0x3e96f0[_0x35d2b3]['format']],'%s',_0x1fd925):_0x1fd925;if(_0x3e96f0[_0x35d2b3][_0x1922('0x73')]){_0x3f8672['group'](_0x1fd925);}_0x3e96f0[_0x35d2b3]['orderBy']&&_0x3f8672[_0x1922('0x39')](_0x1fd925,_0x3e96f0[_0x35d2b3]['orderBy']==='DESC'?![]:!![]);_0x3f8672['field'](_0x1fd925,_0x3e96f0[_0x35d2b3][_0x1922('0x76')]||_0x1fd925);}if(_0x5dabda['joins']){_0x5dabda['joins']=JSON[_0x1922('0x78')](_0x5dabda['joins']);for(var _0x56e1b3=0x0;_0x56e1b3<_0x5dabda[_0x1922('0x77')]['length'];_0x56e1b3+=0x1){if(_0x5dabda[_0x1922('0x77')][_0x56e1b3][_0x1922('0x2d')]&&_[_0x1922('0x5f')](_0x181a90,_0x5dabda[_0x1922('0x77')][_0x56e1b3]['type'])&&_0x5dabda[_0x1922('0x77')][_0x56e1b3][_0x1922('0x79')]&&_0x5dabda[_0x1922('0x77')][_0x56e1b3][_0x1922('0x7a')]&&_0x5dabda['joins'][_0x56e1b3][_0x1922('0x7b')]){_0x3f8672[_0x5dabda['joins'][_0x56e1b3][_0x1922('0x2d')]](_0x5dabda[_0x1922('0x77')][_0x56e1b3][_0x1922('0x7a')],null,util['format'](_0x1922('0xa0'),_0x5dabda[_0x1922('0x7c')],_0x5dabda[_0x1922('0x77')][_0x56e1b3][_0x1922('0x79')],_0x5dabda[_0x1922('0x77')][_0x56e1b3][_0x1922('0x7a')],_0x5dabda[_0x1922('0x77')][_0x56e1b3][_0x1922('0x7b')]));}}}if(_0x5dabda[_0x1922('0x7d')]){_0x5dabda['conditions']=JSON[_0x1922('0x78')](_0x5dabda[_0x1922('0x7d')]);_0x3f8672[_0x1922('0x3b')](_0x4dce6e(_0x5dabda[_0x1922('0x7d')][_0x1922('0x66')]));}_0x53a9b9=_0x3f8672[_0x1922('0x7e')]();_0x3f8672[_0x1922('0x1b')](_0x7bd6d0);_0x3f8672['offset'](0x0);logger[_0x1922('0x7f')](_0x1922('0x80'),_0x3f8672[_0x1922('0x81')]());return db['sequelize']['query'](_0x3f8672[_0x1922('0x81')](),{'type':db[_0x1922('0x82')]['QueryTypes'][_0x1922('0x84')]});}})[_0x1922('0x21')](function(){return{'sql':_0x53a9b9[_0x1922('0x81')]()};})['then'](respondWithResult(_0x1b2e71,null))[_0x1922('0x4d')](handleError(_0x1b2e71,null));}; \ No newline at end of file +var _0x53d5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','SUM(%s)','COUNT(%s)','MAX(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','Sequelize','AnalyticMetric','format','order','clone','SELECT','No\x20available\x20data','output','web','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','select','countTable','COUNT(*)','runReport','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','map','AnalyticCustomReport'];(function(_0xa1a05b,_0x59de8f){var _0x41155b=function(_0x201126){while(--_0x201126){_0xa1a05b['push'](_0xa1a05b['shift']());}};_0x41155b(++_0x59de8f);}(_0x53d5,0x1cc));var _0x553d=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0x53d5[_0x12a554];return _0x244ba0;};'use strict';var pdf=require(_0x553d('0x0'));var emlformat=require(_0x553d('0x1'));var rimraf=require(_0x553d('0x2'));var zipdir=require(_0x553d('0x3'));var jsonpatch=require(_0x553d('0x4'));var rp=require(_0x553d('0x5'));var moment=require(_0x553d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x553d('0x7'));var util=require(_0x553d('0x8'));var path=require(_0x553d('0x9'));var sox=require(_0x553d('0xa'));var csv=require(_0x553d('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x553d('0xc'));var squel=require(_0x553d('0xd'));var crypto=require(_0x553d('0xe'));var jsforce=require(_0x553d('0xf'));var deskjs=require(_0x553d('0x10'));var toCsv=require(_0x553d('0xb'));var querystring=require(_0x553d('0x11'));var Papa=require(_0x553d('0x12'));var Redis=require(_0x553d('0x13'));var authService=require(_0x553d('0x14'));var qs=require(_0x553d('0x15'));var as=require(_0x553d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x553d('0x17'));var utils=require('../../config/utils');var config=require(_0x553d('0x18'));var db=require(_0x553d('0x19'))['db'];var dbH=require(_0x553d('0x19'))[_0x553d('0x1a')];function respondWithStatusCode(_0x41f6c1,_0x4285c0){_0x4285c0=_0x4285c0||0xcc;return function(_0x44b9ee){if(_0x44b9ee){return _0x41f6c1[_0x553d('0x1b')](_0x4285c0);}return _0x41f6c1[_0x553d('0x1c')](_0x4285c0)[_0x553d('0x1d')]();};}function respondWithResult(_0x3cb13c,_0xd11e74){_0xd11e74=_0xd11e74||0xc8;return function(_0x52ded8){if(_0x52ded8){return _0x3cb13c[_0x553d('0x1c')](_0xd11e74)['json'](_0x52ded8);}};}function respondWithFilteredResult(_0x1d4f35,_0x2de0c1){return function(_0x12b505){if(_0x12b505){var _0x529b37=_0x12b505[_0x553d('0x1e')],_0x4e4f78=_0x2de0c1['offset'],_0x321038=_0x2de0c1[_0x553d('0x1f')]+_0x2de0c1[_0x553d('0x20')],_0x1cbce6;if(_0x321038>=_0x529b37){_0x321038=_0x529b37;_0x1cbce6=0xc8;}else{_0x1cbce6=0xce;}_0x1d4f35[_0x553d('0x1c')](_0x1cbce6);return _0x1d4f35[_0x553d('0x21')](_0x553d('0x22'),_0x4e4f78+'-'+_0x321038+'/'+_0x529b37)[_0x553d('0x23')](_0x12b505);}return null;};}function patchUpdates(_0x719651){return function(_0x19a984){try{jsonpatch[_0x553d('0x24')](_0x19a984,_0x719651,!![]);}catch(_0x861db3){return BPromise[_0x553d('0x25')](_0x861db3);}return _0x19a984['save']();};}function saveUpdates(_0x11bc86,_0x42cd9a){return function(_0x4c5f0f){if(_0x4c5f0f){return _0x4c5f0f[_0x553d('0x26')](_0x11bc86)[_0x553d('0x27')](function(_0x4d00e3){return _0x4d00e3;});}return null;};}function removeEntity(_0x5bbd2d,_0x4a6e0e){return function(_0x55fbe1){if(_0x55fbe1){return _0x55fbe1[_0x553d('0x28')]()['then'](function(){var _0x82dd3a=_0x55fbe1[_0x553d('0x29')]({'plain':!![]});var _0x2e4f1b=_0x553d('0x2a');return db[_0x553d('0x2b')]['destroy']({'where':{'type':_0x2e4f1b,'resourceId':_0x82dd3a['id']}})['then'](function(){return _0x55fbe1;});})[_0x553d('0x27')](function(){_0x5bbd2d['status'](0xcc)[_0x553d('0x1d')]();});}};}function handleEntityNotFound(_0x185b8a,_0x517a1c){return function(_0x677832){if(!_0x677832){_0x185b8a[_0x553d('0x1b')](0x194);}return _0x677832;};}function handleError(_0x2c4577,_0x5cda9e){_0x5cda9e=_0x5cda9e||0x1f4;return function(_0x1f3f5c){logger[_0x553d('0x2c')](_0x1f3f5c[_0x553d('0x2d')]);if(_0x1f3f5c['name']){delete _0x1f3f5c[_0x553d('0x2e')];}_0x2c4577[_0x553d('0x1c')](_0x5cda9e)[_0x553d('0x2f')](_0x1f3f5c);};}exports['index']=function(_0x37ddd7,_0x180a66){var _0xc3d157={},_0x5ce4ab={},_0x4315a9={'count':0x0,'rows':[]};var _0x4b70b3=_[_0x553d('0x30')](db[_0x553d('0x31')][_0x553d('0x32')],function(_0x615816){return{'name':_0x615816[_0x553d('0x33')],'type':_0x615816[_0x553d('0x34')][_0x553d('0x35')]};});_0x5ce4ab[_0x553d('0x36')]=_['map'](_0x4b70b3,_0x553d('0x2e'));_0x5ce4ab[_0x553d('0x37')]=_[_0x553d('0x38')](_0x37ddd7[_0x553d('0x37')]);_0x5ce4ab[_0x553d('0x39')]=_[_0x553d('0x3a')](_0x5ce4ab[_0x553d('0x36')],_0x5ce4ab[_0x553d('0x37')]);_0xc3d157['attributes']=_[_0x553d('0x3a')](_0x5ce4ab[_0x553d('0x36')],qs[_0x553d('0x3b')](_0x37ddd7['query'][_0x553d('0x3b')]));_0xc3d157[_0x553d('0x3c')]=_0xc3d157[_0x553d('0x3c')][_0x553d('0x3d')]?_0xc3d157[_0x553d('0x3c')]:_0x5ce4ab[_0x553d('0x36')];if(!_0x37ddd7[_0x553d('0x37')][_0x553d('0x3e')]('nolimit')){_0xc3d157['limit']=qs[_0x553d('0x20')](_0x37ddd7[_0x553d('0x37')]['limit']);_0xc3d157[_0x553d('0x1f')]=qs['offset'](_0x37ddd7['query'][_0x553d('0x1f')]);}_0xc3d157['order']=qs[_0x553d('0x3f')](_0x37ddd7['query'][_0x553d('0x3f')]);_0xc3d157[_0x553d('0x40')]=qs['filters'](_['pick'](_0x37ddd7[_0x553d('0x37')],_0x5ce4ab[_0x553d('0x39')]),_0x4b70b3);if(_0x37ddd7[_0x553d('0x37')][_0x553d('0x41')]){_0xc3d157['where']=_[_0x553d('0x42')](_0xc3d157[_0x553d('0x40')],{'$or':_['map'](_0x4b70b3,function(_0xfac8ee){if(_0xfac8ee['type']!==_0x553d('0x43')){var _0xa4e41e={};_0xa4e41e[_0xfac8ee[_0x553d('0x2e')]]={'$like':'%'+_0x37ddd7[_0x553d('0x37')]['filter']+'%'};return _0xa4e41e;}})});}_0xc3d157=_['merge']({},_0xc3d157,_0x37ddd7[_0x553d('0x44')]);var _0x40657a={'where':_0xc3d157[_0x553d('0x40')]};return db[_0x553d('0x31')][_0x553d('0x1e')](_0x40657a)[_0x553d('0x27')](function(_0x403f4a){_0x4315a9[_0x553d('0x1e')]=_0x403f4a;if(_0x37ddd7[_0x553d('0x37')][_0x553d('0x45')]){_0xc3d157['include']=[{'all':!![]}];}return db[_0x553d('0x31')][_0x553d('0x46')](_0xc3d157);})['then'](function(_0x3fce6f){_0x4315a9[_0x553d('0x47')]=_0x3fce6f;return _0x4315a9;})['then'](respondWithFilteredResult(_0x180a66,_0xc3d157))[_0x553d('0x48')](handleError(_0x180a66,null));};exports[_0x553d('0x49')]=function(_0x40bc7a,_0x103405){var _0x263169={'raw':![],'where':{'id':_0x40bc7a['params']['id']}},_0x29bb2a={};_0x29bb2a[_0x553d('0x36')]=_[_0x553d('0x38')](db[_0x553d('0x31')]['rawAttributes']);_0x29bb2a[_0x553d('0x37')]=_[_0x553d('0x38')](_0x40bc7a['query']);_0x29bb2a[_0x553d('0x39')]=_[_0x553d('0x3a')](_0x29bb2a[_0x553d('0x36')],_0x29bb2a[_0x553d('0x37')]);_0x263169[_0x553d('0x3c')]=_[_0x553d('0x3a')](_0x29bb2a[_0x553d('0x36')],qs[_0x553d('0x3b')](_0x40bc7a[_0x553d('0x37')]['fields']));_0x263169[_0x553d('0x3c')]=_0x263169['attributes'][_0x553d('0x3d')]?_0x263169['attributes']:_0x29bb2a[_0x553d('0x36')];if(_0x40bc7a[_0x553d('0x37')]['includeAll']){_0x263169[_0x553d('0x4a')]=[{'all':!![]}];}_0x263169=_[_0x553d('0x42')]({},_0x263169,_0x40bc7a[_0x553d('0x44')]);return db[_0x553d('0x31')][_0x553d('0x4b')](_0x263169)['then'](handleEntityNotFound(_0x103405,null))[_0x553d('0x27')](respondWithResult(_0x103405,null))['catch'](handleError(_0x103405,null));};exports[_0x553d('0x4c')]=function(_0x842722,_0x3bb264){return db[_0x553d('0x31')][_0x553d('0x4c')](_0x842722[_0x553d('0x4d')],{})[_0x553d('0x27')](function(_0x29259a){var _0x460a98=_0x842722[_0x553d('0x4e')][_0x553d('0x29')]({'plain':!![]});if(!_0x460a98)throw new Error(_0x553d('0x4f'));if(_0x460a98[_0x553d('0x50')]===_0x553d('0x4e')){var _0x1d07eb=_0x29259a[_0x553d('0x29')]({'plain':!![]});var _0x2dd4ce='Reports';return db[_0x553d('0x51')][_0x553d('0x4b')]({'where':{'name':_0x2dd4ce,'userProfileId':_0x460a98[_0x553d('0x52')]},'raw':!![]})[_0x553d('0x27')](function(_0x58a8ef){if(_0x58a8ef&&_0x58a8ef['autoAssociation']===0x0){return db[_0x553d('0x2b')][_0x553d('0x4c')]({'name':_0x1d07eb[_0x553d('0x2e')],'resourceId':_0x1d07eb['id'],'type':_0x553d('0x2a'),'sectionId':_0x58a8ef['id']},{})[_0x553d('0x27')](function(){return _0x29259a;});}else{return _0x29259a;}})[_0x553d('0x48')](function(_0x378823){logger[_0x553d('0x2c')](_0x553d('0x53'),_0x378823);throw _0x378823;});}return _0x29259a;})['then'](respondWithResult(_0x3bb264,0xc9))[_0x553d('0x48')](handleError(_0x3bb264,null));};exports[_0x553d('0x26')]=function(_0x24cf0c,_0x3eae07){if(_0x24cf0c['body']['id']){delete _0x24cf0c['body']['id'];}return db[_0x553d('0x31')][_0x553d('0x4b')]({'where':{'id':_0x24cf0c[_0x553d('0x54')]['id']}})[_0x553d('0x27')](handleEntityNotFound(_0x3eae07,null))[_0x553d('0x27')](saveUpdates(_0x24cf0c[_0x553d('0x4d')],null))[_0x553d('0x27')](respondWithResult(_0x3eae07,null))[_0x553d('0x48')](handleError(_0x3eae07,null));};exports['destroy']=function(_0x2402d5,_0x5a9540){return db[_0x553d('0x31')]['find']({'where':{'id':_0x2402d5[_0x553d('0x54')]['id']}})['then'](handleEntityNotFound(_0x5a9540,null))['then'](removeEntity(_0x5a9540,null))[_0x553d('0x48')](handleError(_0x5a9540,null));};exports[_0x553d('0x55')]=function(_0x5c3c6f,_0x26f753){var _0x2d70e4=0xa;var _0x3333cc=['join',_0x553d('0x56'),_0x553d('0x57'),_0x553d('0x58')];var _0x5b2117={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x553d('0x59'),'MAX':'MAX(%s)','MIN':_0x553d('0x5a'),'AVG':_0x553d('0x5b'),'GROUP_CONCAT':_0x553d('0x5c'),'GROUP_CONCAT ASC':_0x553d('0x5d'),'GROUP_CONCAT DESC':_0x553d('0x5e')};var _0x50b4b8={'SEC_TO_TIME':_0x553d('0x5f'),'DATE':_0x553d('0x60'),'HOUR':_0x553d('0x61'),'ROUND':_0x553d('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3fc5be=function(_0x2107a1){return!_[_0x553d('0x63')]([_0x553d('0x64'),_0x553d('0x65'),_0x553d('0x66'),'IS\x20NOT\x20EMPTY'],_0x2107a1);};var _0x46bc00=function(_0x4512d4){if(!_0x4512d4||!_0x4512d4[_0x553d('0x67')][_0x553d('0x3d')]){return'';}for(var _0x5dfb14='(',_0x340593=0x0;_0x340593<_0x4512d4[_0x553d('0x67')][_0x553d('0x3d')];_0x340593+=0x1){_0x340593>0x0&&(_0x5dfb14+='\x20'+_0x4512d4[_0x553d('0x68')]+'\x20');_0x5dfb14+=_0x4512d4['rules'][_0x340593][_0x553d('0x69')]?_0x46bc00(_0x4512d4[_0x553d('0x67')][_0x340593]['group']):_0x4512d4[_0x553d('0x67')][_0x340593][_0x553d('0x6a')]+'\x20'+_0x4512d4[_0x553d('0x67')][_0x340593]['condition']+(_0x3fc5be(_0x4512d4[_0x553d('0x67')][_0x340593][_0x553d('0x6b')])?'\x20'+_0x4512d4[_0x553d('0x67')][_0x340593][_0x553d('0x6c')]:'');}return _0x5dfb14+')';};var _0xd47742={'where':{'id':_0x5c3c6f[_0x553d('0x54')]['id']}},_0x9ab505,_0x467e8e,_0x3d114f,_0x1e8a88,_0xedd062;_0xd47742=_[_0x553d('0x42')]({},_0xd47742,_0x5c3c6f[_0x553d('0x44')]);return db[_0x553d('0x31')][_0x553d('0x4b')](_0xd47742)[_0x553d('0x27')](function(_0x2e8d86){if(_0x2e8d86){_0x9ab505=_0x2e8d86;return _0x2e8d86[_0x553d('0x6d')]();}return null;})[_0x553d('0x27')](function(_0x360c16){if(_0x360c16){if(!_0x360c16[_0x553d('0x3d')]){throw new db['Sequelize'][(_0x553d('0x6e'))](_0x553d('0x6f'),0x193);}_0x467e8e=_0x360c16;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x553d('0x27')](function(_0xf6df3a){if(_0xf6df3a){_0x3d114f=_[_0x553d('0x70')](_0xf6df3a,'id');var _0x327e2d;var _0x308dcd=squel['select']();_0x308dcd[_0x553d('0x71')](_0x9ab505[_0x553d('0x72')]);for(var _0x421fb3=0x0;_0x421fb3<_0x467e8e[_0x553d('0x3d')];_0x421fb3+=0x1){_0x327e2d=_0x467e8e[_0x421fb3][_0x553d('0x73')]?_0x3d114f[_0x467e8e[_0x421fb3][_0x553d('0x73')]][_0x553d('0x74')]:_0x467e8e[_0x421fb3][_0x553d('0x6a')];_0x327e2d=_0x467e8e[_0x421fb3][_0x553d('0x75')]?_[_0x553d('0x76')](_0x5b2117[_0x467e8e[_0x421fb3]['function']],'%s',_0x327e2d):_0x327e2d;_0x327e2d=_0x467e8e[_0x421fb3]['format']?_[_0x553d('0x76')](_0x50b4b8[_0x467e8e[_0x421fb3]['format']],'%s',_0x327e2d):_0x327e2d;if(_0x467e8e[_0x421fb3][_0x553d('0x77')]){_0x308dcd[_0x553d('0x69')](_0x327e2d);}_0x467e8e[_0x421fb3]['orderBy']&&_0x308dcd['order'](_0x327e2d,_0x467e8e[_0x421fb3][_0x553d('0x78')]===_0x553d('0x79')?![]:!![]);_0x308dcd[_0x553d('0x6a')](_0x327e2d,_0x467e8e[_0x421fb3][_0x553d('0x7a')]||_0x327e2d);}if(_0x9ab505[_0x553d('0x7b')]){_0x9ab505[_0x553d('0x7b')]=JSON[_0x553d('0x7c')](_0x9ab505['joins']);for(var _0x12a111=0x0;_0x12a111<_0x9ab505['joins'][_0x553d('0x3d')];_0x12a111+=0x1){if(_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x34')]&&_[_0x553d('0x63')](_0x3333cc,_0x9ab505[_0x553d('0x7b')][_0x12a111]['type'])&&_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7d')]&&_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7e')]&&_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7f')]){_0x308dcd[_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x34')]](_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7e')],null,util['format'](_0x553d('0x80'),_0x9ab505[_0x553d('0x72')],_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7d')],_0x9ab505['joins'][_0x12a111]['foreignTable'],_0x9ab505[_0x553d('0x7b')][_0x12a111][_0x553d('0x7f')]));}}}if(_0x9ab505['conditions']){_0x9ab505[_0x553d('0x81')]=JSON[_0x553d('0x7c')](_0x9ab505[_0x553d('0x81')]);_0x308dcd[_0x553d('0x40')](_0x46bc00(_0x9ab505[_0x553d('0x81')][_0x553d('0x69')]));}_0xedd062=_0x308dcd['clone']();_0x308dcd[_0x553d('0x20')](_0x2d70e4);_0x308dcd[_0x553d('0x1f')](0x0);logger[_0x553d('0x82')](_0x553d('0x83'),_0x308dcd[_0x553d('0x84')]());return db[_0x553d('0x85')][_0x553d('0x37')](_0x308dcd[_0x553d('0x84')](),{'type':db[_0x553d('0x85')][_0x553d('0x86')]['SELECT']});}})[_0x553d('0x27')](respondWithResult(_0x26f753,null))[_0x553d('0x48')](handleError(_0x26f753,null));};function runReport(_0x4f7c61,_0x1c2bcb,_0x25b48f){var _0x5c15c9=_0x1c2bcb['name'];var _0x7052e3=0xa;var _0x41e2ab=[_0x553d('0x87'),_0x553d('0x56'),_0x553d('0x57'),_0x553d('0x58')];var _0x52687d={'SUM':_0x553d('0x88'),'COUNT':_0x553d('0x89'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x553d('0x8a'),'MIN':_0x553d('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x553d('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4de36b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x553d('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x553d('0x62'),'UNIX_TIMESTAMP':_0x553d('0x8b')};var _0x54a149=function(_0x1cefaa){return!_[_0x553d('0x63')](['IS\x20NULL',_0x553d('0x65'),_0x553d('0x66'),_0x553d('0x8c')],_0x1cefaa);};var _0x36dbbe=function(_0x4b07cd){if(!_0x4b07cd||!_0x4b07cd['rules'][_0x553d('0x3d')]){return'';}for(var _0x2c64d8='(',_0x9141e1=0x0;_0x9141e1<_0x4b07cd['rules'][_0x553d('0x3d')];_0x9141e1+=0x1){_0x9141e1>0x0&&(_0x2c64d8+='\x20'+_0x4b07cd['operator']+'\x20');_0x2c64d8+=_0x4b07cd['rules'][_0x9141e1]['group']?_0x36dbbe(_0x4b07cd[_0x553d('0x67')][_0x9141e1]['group']):_0x4b07cd[_0x553d('0x67')][_0x9141e1][_0x553d('0x6a')]+'\x20'+_0x4b07cd[_0x553d('0x67')][_0x9141e1]['condition']+(_0x54a149(_0x4b07cd['rules'][_0x9141e1][_0x553d('0x6b')])?'\x20'+_0x4b07cd[_0x553d('0x67')][_0x9141e1][_0x553d('0x6c')]:'');}return _0x2c64d8+')';};var _0x5c934b={'where':{'id':_0x4f7c61['id']}},_0x13258d,_0x494746,_0x24a52b,_0xedb9c1,_0x22e9e9;_0x5c934b=_[_0x553d('0x42')]({},_0x5c934b,_0x25b48f);return db[_0x553d('0x31')][_0x553d('0x4b')](_0x5c934b)['then'](function(_0x4f6bbc){if(_0x4f6bbc){_0x13258d=_0x4f6bbc;return _0x4f6bbc[_0x553d('0x6d')]();}return null;})[_0x553d('0x27')](function(_0x2b0619){if(_0x2b0619){if(!_0x2b0619[_0x553d('0x3d')]){throw new db[(_0x553d('0x8d'))][(_0x553d('0x6e'))](_0x553d('0x6f'),0x193);}_0x494746=_0x2b0619;return db[_0x553d('0x8e')][_0x553d('0x46')]({'raw':!![]});}return null;})[_0x553d('0x27')](function(_0x4621e9){if(_0x4621e9){_0x24a52b=_['keyBy'](_0x4621e9,'id');var _0xcde992;var _0x3a5e94=squel['select']();_0x3a5e94[_0x553d('0x71')](_0x13258d[_0x553d('0x72')]);for(var _0x1424ee=0x0;_0x1424ee<_0x494746[_0x553d('0x3d')];_0x1424ee+=0x1){_0xcde992=_0x494746[_0x1424ee]['MetricId']?_0x24a52b[_0x494746[_0x1424ee][_0x553d('0x73')]]['metric']:_0x494746[_0x1424ee][_0x553d('0x6a')];_0xcde992=_0x494746[_0x1424ee][_0x553d('0x75')]?_['replace'](_0x52687d[_0x494746[_0x1424ee]['function']],'%s',_0xcde992):_0xcde992;_0xcde992=_0x494746[_0x1424ee]['format']?_[_0x553d('0x76')](_0x4de36b[_0x494746[_0x1424ee][_0x553d('0x8f')]],'%s',_0xcde992):_0xcde992;if(_0x494746[_0x1424ee][_0x553d('0x77')]){_0x3a5e94['group'](_0xcde992);}_0x494746[_0x1424ee][_0x553d('0x78')]&&_0x3a5e94[_0x553d('0x90')](_0xcde992,_0x494746[_0x1424ee][_0x553d('0x78')]==='DESC'?![]:!![]);_0x3a5e94['field'](_0xcde992,_0x494746[_0x1424ee][_0x553d('0x7a')]||_0xcde992);}if(_0x13258d[_0x553d('0x7b')]){_0x13258d[_0x553d('0x7b')]=JSON[_0x553d('0x7c')](_0x13258d[_0x553d('0x7b')]);for(var _0x110ca2=0x0;_0x110ca2<_0x13258d[_0x553d('0x7b')][_0x553d('0x3d')];_0x110ca2+=0x1){if(_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x34')]&&_[_0x553d('0x63')](_0x41e2ab,_0x13258d[_0x553d('0x7b')][_0x110ca2]['type'])&&_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x7d')]&&_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x7e')]&&_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x7f')]){_0x3a5e94[_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x34')]](_0x13258d['joins'][_0x110ca2][_0x553d('0x7e')],null,util[_0x553d('0x8f')](_0x553d('0x80'),_0x13258d[_0x553d('0x72')],_0x13258d['joins'][_0x110ca2]['parentKey'],_0x13258d[_0x553d('0x7b')][_0x110ca2][_0x553d('0x7e')],_0x13258d[_0x553d('0x7b')][_0x110ca2]['foreignKey']));}}}if(_0x13258d[_0x553d('0x81')]){_0x13258d[_0x553d('0x81')]=JSON['parse'](_0x13258d[_0x553d('0x81')]);_0x3a5e94[_0x553d('0x40')](_0x36dbbe(_0x13258d[_0x553d('0x81')][_0x553d('0x69')]));}_0x22e9e9=_0x3a5e94[_0x553d('0x91')]();_0x3a5e94['limit'](_0x7052e3);_0x3a5e94[_0x553d('0x1f')](0x0);logger[_0x553d('0x82')](_0x553d('0x83'),_0x3a5e94[_0x553d('0x84')]());return db[_0x553d('0x85')]['query'](_0x3a5e94[_0x553d('0x84')](),{'type':db[_0x553d('0x85')][_0x553d('0x86')][_0x553d('0x92')]});}})[_0x553d('0x27')](function(_0x2d8413){if(!_0x2d8413[_0x553d('0x3d')]){throw new db[(_0x553d('0x8d'))]['ValidationErrorItem'](_0x553d('0x93'),0xcc);}if(_0x1c2bcb[_0x553d('0x94')]===_0x553d('0x95')){return null;}var _0x2f4448=_[_0x553d('0x42')](_0x1c2bcb,{'name':_0x1c2bcb['fullPath']||_0x1c2bcb['name']||_0x13258d[_0x553d('0x2e')],'basename':_0x5c15c9,'savename':util[_0x553d('0x8f')]('%s-%s.%s',_0x1c2bcb[_0x553d('0x2e')]||_0x13258d['name'],require(_0x553d('0x96'))[_0x553d('0x97')](0x4),_0x1c2bcb['output']||_0x553d('0x98')),'reportId':_0x13258d['id'],'reportType':_0x553d('0x99')});return db[_0x553d('0x9a')]['create'](_0x2f4448,{'raw':!![]});})[_0x553d('0x27')](function(_0x57546f){if(_0x13258d[_0x553d('0x72')]===_0x553d('0x9b')){_0x22e9e9[_0x553d('0x40')](_0x13258d[_0x553d('0x72')]+_0x553d('0x9c'),_0x1c2bcb[_0x553d('0x9d')],_0x1c2bcb[_0x553d('0x9e')]);}else{_0x22e9e9[_0x553d('0x40')](_0x13258d[_0x553d('0x72')]+_0x553d('0x9f'),_0x1c2bcb[_0x553d('0x9d')],_0x1c2bcb[_0x553d('0x9e')]);}if(_0x57546f){logger[_0x553d('0xa0')](_0x553d('0xa1'),_0x22e9e9[_0x553d('0x84')]());require(_0x553d('0xa2'))[_0x553d('0xa3')](path[_0x553d('0x87')](__dirname,_0x553d('0xa4'),_0x57546f['output']),[_0x57546f['id'],_0x22e9e9[_0x553d('0x84')](),path[_0x553d('0x87')](__dirname,_0x553d('0xa5'),_0x57546f['savename']),_0x5c15c9]);return _0x57546f;}else{var _0x490b72=squel[_0x553d('0xa6')]();_0x490b72[_0x553d('0x71')]('('+_0x22e9e9['toString']()+')',_0x553d('0xa7'));_0x490b72['field'](_0x553d('0xa8'),'count');_0x22e9e9['limit'](_0x1c2bcb[_0x553d('0x20')]||_0x7052e3);_0x22e9e9['offset'](_0x1c2bcb['offset']||0x0);return dbH[_0x553d('0x85')][_0x553d('0x37')](_0x490b72['toString'](),{'type':dbH[_0x553d('0x85')][_0x553d('0x86')][_0x553d('0x92')]})[_0x553d('0x27')](function(_0x4b5a55){if(!_0x4b5a55[_0x553d('0x3d')]){_0xedb9c1=0x0;}else{_0xedb9c1=_0x4b5a55[0x0]['count']||0x0;}return dbH[_0x553d('0x85')]['query'](_0x22e9e9['toString'](),{'type':dbH['sequelize'][_0x553d('0x86')]['SELECT']});})[_0x553d('0x27')](function(_0x8e4533){return{'rows':_0x8e4533||[],'count':_0xedb9c1};});}});}exports['run']=function(_0x40b52a,_0x1aef80){return runReport(_0x40b52a[_0x553d('0x54')],_0x40b52a[_0x553d('0x37')],_0x40b52a[_0x553d('0x44')])[_0x553d('0x27')](respondWithResult(_0x1aef80,null))['catch'](handleError(_0x1aef80,null));};exports[_0x553d('0xa9')]=runReport;exports[_0x553d('0x37')]=function(_0x207517,_0x13d67a){var _0x36d0c7=0xa;var _0x456b27=[_0x553d('0x87'),_0x553d('0x56'),_0x553d('0x57'),_0x553d('0x58')];var _0x4174b1={'SUM':'SUM(%s)','COUNT':_0x553d('0x89'),'COUNT DISTINCT':_0x553d('0x59'),'MAX':_0x553d('0x8a'),'MIN':_0x553d('0x5a'),'AVG':_0x553d('0x5b'),'GROUP_CONCAT':_0x553d('0x5c'),'GROUP_CONCAT ASC':_0x553d('0x5d'),'GROUP_CONCAT DESC':_0x553d('0x5e')};var _0x42a164={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x553d('0x60'),'HOUR':_0x553d('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x86407=function(_0x16e5d7){return!_[_0x553d('0x63')]([_0x553d('0x64'),_0x553d('0x65'),_0x553d('0x66'),_0x553d('0x8c')],_0x16e5d7);};var _0x25c3a3=function(_0xaa9b48){if(!_0xaa9b48||!_0xaa9b48['rules']['length']){return'';}for(var _0x1da206='(',_0xcde81b=0x0;_0xcde81b<_0xaa9b48[_0x553d('0x67')]['length'];_0xcde81b+=0x1){_0xcde81b>0x0&&(_0x1da206+='\x20'+_0xaa9b48[_0x553d('0x68')]+'\x20');_0x1da206+=_0xaa9b48[_0x553d('0x67')][_0xcde81b][_0x553d('0x69')]?_0x25c3a3(_0xaa9b48[_0x553d('0x67')][_0xcde81b][_0x553d('0x69')]):_0xaa9b48[_0x553d('0x67')][_0xcde81b][_0x553d('0x6a')]+'\x20'+_0xaa9b48[_0x553d('0x67')][_0xcde81b]['condition']+(_0x86407(_0xaa9b48[_0x553d('0x67')][_0xcde81b][_0x553d('0x6b')])?'\x20'+_0xaa9b48[_0x553d('0x67')][_0xcde81b][_0x553d('0x6c')]:'');}return _0x1da206+')';};var _0x3e9b25={'where':{'id':_0x207517[_0x553d('0x54')]['id']}},_0xd2590a,_0x4dff60,_0x4d34f7,_0x550dd6,_0x24b170;_0x3e9b25=_[_0x553d('0x42')]({},_0x3e9b25,_0x207517['options']);return db['AnalyticCustomReport']['find'](_0x3e9b25)[_0x553d('0x27')](function(_0x41b3b1){if(_0x41b3b1){_0xd2590a=_0x41b3b1;return _0x41b3b1[_0x553d('0x6d')]();}return null;})[_0x553d('0x27')](function(_0x5ac0a3){if(_0x5ac0a3){if(!_0x5ac0a3[_0x553d('0x3d')]){throw new db[(_0x553d('0x8d'))]['ValidationErrorItem'](_0x553d('0x6f'),0x193);}_0x4dff60=_0x5ac0a3;return db[_0x553d('0x8e')][_0x553d('0x46')]({'raw':!![]});}return null;})[_0x553d('0x27')](function(_0x2bf047){if(_0x2bf047){_0x4d34f7=_[_0x553d('0x70')](_0x2bf047,'id');var _0x40d1f0;var _0x3913b2=squel[_0x553d('0xa6')]();_0x3913b2['from'](_0xd2590a['table']);for(var _0x38efec=0x0;_0x38efec<_0x4dff60[_0x553d('0x3d')];_0x38efec+=0x1){_0x40d1f0=_0x4dff60[_0x38efec]['MetricId']?_0x4d34f7[_0x4dff60[_0x38efec]['MetricId']][_0x553d('0x74')]:_0x4dff60[_0x38efec][_0x553d('0x6a')];_0x40d1f0=_0x4dff60[_0x38efec][_0x553d('0x75')]?_[_0x553d('0x76')](_0x4174b1[_0x4dff60[_0x38efec][_0x553d('0x75')]],'%s',_0x40d1f0):_0x40d1f0;_0x40d1f0=_0x4dff60[_0x38efec]['format']?_[_0x553d('0x76')](_0x42a164[_0x4dff60[_0x38efec][_0x553d('0x8f')]],'%s',_0x40d1f0):_0x40d1f0;if(_0x4dff60[_0x38efec][_0x553d('0x77')]){_0x3913b2[_0x553d('0x69')](_0x40d1f0);}_0x4dff60[_0x38efec][_0x553d('0x78')]&&_0x3913b2[_0x553d('0x90')](_0x40d1f0,_0x4dff60[_0x38efec][_0x553d('0x78')]===_0x553d('0x79')?![]:!![]);_0x3913b2[_0x553d('0x6a')](_0x40d1f0,_0x4dff60[_0x38efec][_0x553d('0x7a')]||_0x40d1f0);}if(_0xd2590a[_0x553d('0x7b')]){_0xd2590a['joins']=JSON[_0x553d('0x7c')](_0xd2590a[_0x553d('0x7b')]);for(var _0x362eb4=0x0;_0x362eb4<_0xd2590a['joins'][_0x553d('0x3d')];_0x362eb4+=0x1){if(_0xd2590a[_0x553d('0x7b')][_0x362eb4]['type']&&_['includes'](_0x456b27,_0xd2590a[_0x553d('0x7b')][_0x362eb4][_0x553d('0x34')])&&_0xd2590a[_0x553d('0x7b')][_0x362eb4][_0x553d('0x7d')]&&_0xd2590a[_0x553d('0x7b')][_0x362eb4][_0x553d('0x7e')]&&_0xd2590a['joins'][_0x362eb4]['foreignKey']){_0x3913b2[_0xd2590a[_0x553d('0x7b')][_0x362eb4]['type']](_0xd2590a[_0x553d('0x7b')][_0x362eb4]['foreignTable'],null,util['format'](_0x553d('0x80'),_0xd2590a[_0x553d('0x72')],_0xd2590a[_0x553d('0x7b')][_0x362eb4]['parentKey'],_0xd2590a[_0x553d('0x7b')][_0x362eb4][_0x553d('0x7e')],_0xd2590a[_0x553d('0x7b')][_0x362eb4][_0x553d('0x7f')]));}}}if(_0xd2590a[_0x553d('0x81')]){_0xd2590a['conditions']=JSON[_0x553d('0x7c')](_0xd2590a[_0x553d('0x81')]);_0x3913b2[_0x553d('0x40')](_0x25c3a3(_0xd2590a[_0x553d('0x81')][_0x553d('0x69')]));}_0x24b170=_0x3913b2[_0x553d('0x91')]();_0x3913b2[_0x553d('0x20')](_0x36d0c7);_0x3913b2[_0x553d('0x1f')](0x0);logger[_0x553d('0x82')]('Limited\x20Query:',_0x3913b2[_0x553d('0x84')]());return db[_0x553d('0x85')][_0x553d('0x37')](_0x3913b2[_0x553d('0x84')](),{'type':db[_0x553d('0x85')][_0x553d('0x86')][_0x553d('0x92')]});}})['then'](function(){return{'sql':_0x24b170[_0x553d('0x84')]()};})[_0x553d('0x27')](respondWithResult(_0x13d67a,null))[_0x553d('0x48')](handleError(_0x13d67a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5f06686..06c8c03 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 _0x5b53=['path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x25e3d3,_0x1d2882){var _0x42ad83=function(_0x5f3010){while(--_0x5f3010){_0x25e3d3['push'](_0x25e3d3['shift']());}};_0x42ad83(++_0x1d2882);}(_0x5b53,0xe4));var _0x35b5=function(_0x1f49d5,_0x178592){_0x1f49d5=_0x1f49d5-0x0;var _0x2fbcda=_0x5b53[_0x1f49d5];return _0x2fbcda;};'use strict';var _=require(_0x35b5('0x0'));var util=require(_0x35b5('0x1'));var logger=require(_0x35b5('0x2'))(_0x35b5('0x3'));var moment=require(_0x35b5('0x4'));var BPromise=require('bluebird');var rp=require(_0x35b5('0x5'));var fs=require('fs');var path=require(_0x35b5('0x6'));var rimraf=require(_0x35b5('0x7'));var config=require(_0x35b5('0x8'));var attributes=require(_0x35b5('0x9'));module[_0x35b5('0xa')]=function(_0x1b61f2,_0x25ed8f){return _0x1b61f2['define'](_0x35b5('0xb'),attributes,{'tableName':_0x35b5('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ab7=['define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x518e12,_0x3491ad){var _0x1da7ff=function(_0x528771){while(--_0x528771){_0x518e12['push'](_0x518e12['shift']());}};_0x1da7ff(++_0x3491ad);}(_0x1ab7,0x17d));var _0x71ab=function(_0x2d9da3,_0x63174d){_0x2d9da3=_0x2d9da3-0x0;var _0x2a8d6a=_0x1ab7[_0x2d9da3];return _0x2a8d6a;};'use strict';var _=require(_0x71ab('0x0'));var util=require(_0x71ab('0x1'));var logger=require(_0x71ab('0x2'))('api');var moment=require(_0x71ab('0x3'));var BPromise=require(_0x71ab('0x4'));var rp=require(_0x71ab('0x5'));var fs=require('fs');var path=require(_0x71ab('0x6'));var rimraf=require(_0x71ab('0x7'));var config=require(_0x71ab('0x8'));var attributes=require(_0x71ab('0x9'));module[_0x71ab('0xa')]=function(_0x5424b7,_0x4d8087){return _0x5424b7[_0x71ab('0xb')](_0x71ab('0xc'),attributes,{'tableName':_0x71ab('0xd'),'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 da9354e..eea895f 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 _0xb8fa=['jayson/promise','client','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','info','lodash','moment','bluebird','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5d575c,_0x38008f){var _0x27f2ba=function(_0x4c1f81){while(--_0x4c1f81){_0x5d575c['push'](_0x5d575c['shift']());}};_0x27f2ba(++_0x38008f);}(_0xb8fa,0xb5));var _0xab8f=function(_0x19faba,_0x47751f){_0x19faba=_0x19faba-0x0;var _0x32f8ed=_0xb8fa[_0x19faba];return _0x32f8ed;};'use strict';var _=require(_0xab8f('0x0'));var util=require('util');var moment=require(_0xab8f('0x1'));var BPromise=require(_0xab8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab8f('0x3'));var logger=require(_0xab8f('0x4'))('rpc');var config=require(_0xab8f('0x5'));var jayson=require(_0xab8f('0x6'));var client=jayson[_0xab8f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x96ced5,_0x16ce68,_0x3d0c98){return new BPromise(function(_0x48b63f,_0x339d9a){return client[_0xab8f('0x8')](_0x96ced5,_0x3d0c98)[_0xab8f('0x9')](function(_0x226973){logger['info'](_0xab8f('0xa'),_0x16ce68,_0xab8f('0xb'));logger[_0xab8f('0xc')](_0xab8f('0xd'),_0x16ce68,_0xab8f('0xb'),JSON['stringify'](_0x226973));if(_0x226973[_0xab8f('0xe')]){if(_0x226973[_0xab8f('0xe')]['code']===0x1f4){logger['error'](_0xab8f('0xa'),_0x16ce68,_0x226973['error'][_0xab8f('0xf')]);return _0x339d9a(_0x226973['error'][_0xab8f('0xf')]);}logger[_0xab8f('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x16ce68,_0x226973[_0xab8f('0xe')]['message']);return _0x48b63f(_0x226973[_0xab8f('0xe')][_0xab8f('0xf')]);}else{logger[_0xab8f('0x10')](_0xab8f('0xa'),_0x16ce68,_0xab8f('0xb'));_0x48b63f(_0x226973['result'][_0xab8f('0xf')]);}})['catch'](function(_0x34eca4){logger[_0xab8f('0xe')](_0xab8f('0xa'),_0x16ce68,_0x34eca4);_0x339d9a(_0x34eca4);});});} \ No newline at end of file +var _0xe788=['debug','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xe788,0x1b7));var _0x8e78=function(_0xce80db,_0x199dd9){_0xce80db=_0xce80db-0x0;var _0x1fc16f=_0xe788[_0xce80db];return _0x1fc16f;};'use strict';var _=require('lodash');var util=require(_0x8e78('0x0'));var moment=require('moment');var BPromise=require(_0x8e78('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e78('0x2'));var db=require(_0x8e78('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8e78('0x4'));var client=jayson[_0x8e78('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a073b,_0x54c8a8,_0x3c25ce){return new BPromise(function(_0x410108,_0x155e47){return client[_0x8e78('0x6')](_0x5a073b,_0x3c25ce)[_0x8e78('0x7')](function(_0x3eb71){logger[_0x8e78('0x8')](_0x8e78('0x9'),_0x54c8a8,_0x8e78('0xa'));logger[_0x8e78('0xb')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x54c8a8,_0x8e78('0xa'),JSON[_0x8e78('0xc')](_0x3eb71));if(_0x3eb71[_0x8e78('0xd')]){if(_0x3eb71[_0x8e78('0xd')][_0x8e78('0xe')]===0x1f4){logger[_0x8e78('0xd')](_0x8e78('0x9'),_0x54c8a8,_0x3eb71[_0x8e78('0xd')][_0x8e78('0xf')]);return _0x155e47(_0x3eb71[_0x8e78('0xd')][_0x8e78('0xf')]);}logger[_0x8e78('0xd')](_0x8e78('0x9'),_0x54c8a8,_0x3eb71[_0x8e78('0xd')][_0x8e78('0xf')]);return _0x410108(_0x3eb71[_0x8e78('0xd')][_0x8e78('0xf')]);}else{logger[_0x8e78('0x8')](_0x8e78('0x9'),_0x54c8a8,_0x8e78('0xa'));_0x410108(_0x3eb71[_0x8e78('0x10')][_0x8e78('0xf')]);}})[_0x8e78('0x11')](function(_0x20a091){logger['error'](_0x8e78('0x9'),_0x54c8a8,_0x20a091);_0x155e47(_0x20a091);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index cc0005d..140c402 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 _0x20ab=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','put','update','delete','destroy','exports','multer','util'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x20ab,0x11e));var _0xb20a=function(_0x5a3f92,_0x23e7df){_0x5a3f92=_0x5a3f92-0x0;var _0x467063=_0x20ab[_0x5a3f92];return _0x467063;};'use strict';var multer=require(_0xb20a('0x0'));var util=require(_0xb20a('0x1'));var path=require(_0xb20a('0x2'));var timeout=require(_0xb20a('0x3'));var express=require(_0xb20a('0x4'));var router=express['Router']();var auth=require(_0xb20a('0x5'));var interaction=require(_0xb20a('0x6'));var config=require(_0xb20a('0x7'));var controller=require(_0xb20a('0x8'));router[_0xb20a('0x9')]('/',auth[_0xb20a('0xa')](),controller[_0xb20a('0xb')]);router[_0xb20a('0x9')](_0xb20a('0xc'),auth[_0xb20a('0xa')](),controller[_0xb20a('0xd')]);router[_0xb20a('0x9')]('/:id/preview',auth[_0xb20a('0xa')](),controller[_0xb20a('0xe')]);router[_0xb20a('0x9')](_0xb20a('0xf'),auth[_0xb20a('0xa')](),controller[_0xb20a('0x10')]);router[_0xb20a('0x9')](_0xb20a('0x11'),auth[_0xb20a('0xa')](),controller[_0xb20a('0x12')]);router['post']('/',auth[_0xb20a('0xa')](),controller['create']);router[_0xb20a('0x13')](_0xb20a('0xc'),auth['isAuthenticated'](),controller[_0xb20a('0x14')]);router[_0xb20a('0x15')]('/:id',auth[_0xb20a('0xa')](),controller[_0xb20a('0x16')]);module[_0xb20a('0x17')]=router; \ No newline at end of file +var _0xbf78=['../../config/environment','./analyticCustomReport.controller','get','index','show','isAuthenticated','preview','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xbf78,0xda));var _0x8bf7=function(_0x176820,_0x38d7e7){_0x176820=_0x176820-0x0;var _0x53a7f0=_0xbf78[_0x176820];return _0x53a7f0;};'use strict';var multer=require(_0x8bf7('0x0'));var util=require(_0x8bf7('0x1'));var path=require(_0x8bf7('0x2'));var timeout=require(_0x8bf7('0x3'));var express=require(_0x8bf7('0x4'));var router=express[_0x8bf7('0x5')]();var auth=require(_0x8bf7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8bf7('0x7'));var controller=require(_0x8bf7('0x8'));router[_0x8bf7('0x9')]('/',auth['isAuthenticated'](),controller[_0x8bf7('0xa')]);router[_0x8bf7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8bf7('0xb')]);router[_0x8bf7('0x9')]('/:id/preview',auth[_0x8bf7('0xc')](),controller[_0x8bf7('0xd')]);router[_0x8bf7('0x9')]('/:id/run',auth[_0x8bf7('0xc')](),controller[_0x8bf7('0xe')]);router['get'](_0x8bf7('0xf'),auth[_0x8bf7('0xc')](),controller[_0x8bf7('0x10')]);router[_0x8bf7('0x11')]('/',auth[_0x8bf7('0xc')](),controller[_0x8bf7('0x12')]);router[_0x8bf7('0x13')](_0x8bf7('0x14'),auth[_0x8bf7('0xc')](),controller[_0x8bf7('0x15')]);router[_0x8bf7('0x16')](_0x8bf7('0x14'),auth['isAuthenticated'](),controller[_0x8bf7('0x17')]);module[_0x8bf7('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 414fbca..e9413c6 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 _0xc7c1=['TEXT','sequelize','exports','STRING'];(function(_0x5e0be1,_0x57f577){var _0x4de49f=function(_0x50c87e){while(--_0x50c87e){_0x5e0be1['push'](_0x5e0be1['shift']());}};_0x4de49f(++_0x57f577);}(_0xc7c1,0x1dd));var _0x1c7c=function(_0x5d9c75,_0x1f8017){_0x5d9c75=_0x5d9c75-0x0;var _0x170893=_0xc7c1[_0x5d9c75];return _0x170893;};'use strict';var Sequelize=require(_0x1c7c('0x0'));module[_0x1c7c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1c7c('0x2')]},'parent':{'type':Sequelize[_0x1c7c('0x2')]},'table':{'type':Sequelize[_0x1c7c('0x2')]},'conditions':{'type':Sequelize[_0x1c7c('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5c56=['TEXT','sequelize','STRING'];(function(_0x1c31fc,_0x39514d){var _0x400ade=function(_0x32e2e1){while(--_0x32e2e1){_0x1c31fc['push'](_0x1c31fc['shift']());}};_0x400ade(++_0x39514d);}(_0x5c56,0x169));var _0x65c5=function(_0x293e45,_0x559614){_0x293e45=_0x293e45-0x0;var _0x4df8d8=_0x5c56[_0x293e45];return _0x4df8d8;};'use strict';var Sequelize=require(_0x65c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x65c5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x65c5('0x1')]},'parent':{'type':Sequelize[_0x65c5('0x1')]},'table':{'type':Sequelize[_0x65c5('0x1')]},'conditions':{'type':Sequelize[_0x65c5('0x2')]},'joins':{'type':Sequelize[_0x65c5('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index ff871a6..a685835 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 _0x5590=['bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','end','json','count','offset','limit','status','set','reject','save','then','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticDefaultReport','includeAll','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','parse','joins','foreignKey','foreignTable','parentKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NULL','getFields','ValidationErrorItem','findAll','%s.%s\x20=\x20%s.%s','clone','SELECT','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','run','runReport','left_join','HOUR(%s)','html-pdf','eml-format','fast-json-patch','request-promise','moment'];(function(_0x2b8911,_0x563ff5){var _0xe81db6=function(_0x4e1285){while(--_0x4e1285){_0x2b8911['push'](_0x2b8911['shift']());}};_0xe81db6(++_0x563ff5);}(_0x5590,0xa3));var _0x0559=function(_0x20dc55,_0x1c5f3f){_0x20dc55=_0x20dc55-0x0;var _0x165ff7=_0x5590[_0x20dc55];return _0x165ff7;};'use strict';var pdf=require(_0x0559('0x0'));var emlformat=require(_0x0559('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0559('0x2'));var rp=require(_0x0559('0x3'));var moment=require(_0x0559('0x4'));var BPromise=require(_0x0559('0x5'));var Mustache=require(_0x0559('0x6'));var util=require(_0x0559('0x7'));var path=require(_0x0559('0x8'));var sox=require('sox');var csv=require(_0x0559('0x9'));var ejs=require(_0x0559('0xa'));var fs=require('fs');var _=require(_0x0559('0xb'));var squel=require('squel');var crypto=require(_0x0559('0xc'));var jsforce=require(_0x0559('0xd'));var deskjs=require(_0x0559('0xe'));var toCsv=require(_0x0559('0x9'));var querystring=require(_0x0559('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0559('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0559('0x11'));var hardwareService=require(_0x0559('0x12'));var logger=require(_0x0559('0x13'))(_0x0559('0x14'));var utils=require('../../config/utils');var config=require(_0x0559('0x15'));var db=require(_0x0559('0x16'))['db'];var dbH=require(_0x0559('0x16'))[_0x0559('0x17')];function respondWithStatusCode(_0x1162c0,_0xf80638){_0xf80638=_0xf80638||0xcc;return function(_0x2e4ff9){if(_0x2e4ff9){return _0x1162c0['sendStatus'](_0xf80638);}return _0x1162c0['status'](_0xf80638)[_0x0559('0x18')]();};}function respondWithResult(_0x79c83b,_0x11f3cc){_0x11f3cc=_0x11f3cc||0xc8;return function(_0x1448a4){if(_0x1448a4){return _0x79c83b['status'](_0x11f3cc)[_0x0559('0x19')](_0x1448a4);}};}function respondWithFilteredResult(_0x375bee,_0x3e700e){return function(_0x55a608){if(_0x55a608){var _0x248c8b=_0x55a608[_0x0559('0x1a')],_0x149322=_0x3e700e[_0x0559('0x1b')],_0x1121ed=_0x3e700e[_0x0559('0x1b')]+_0x3e700e[_0x0559('0x1c')],_0x395afa;if(_0x1121ed>=_0x248c8b){_0x1121ed=_0x248c8b;_0x395afa=0xc8;}else{_0x395afa=0xce;}_0x375bee[_0x0559('0x1d')](_0x395afa);return _0x375bee[_0x0559('0x1e')]('Content-Range',_0x149322+'-'+_0x1121ed+'/'+_0x248c8b)[_0x0559('0x19')](_0x55a608);}return null;};}function patchUpdates(_0xddf64c){return function(_0x1e77f9){try{jsonpatch['apply'](_0x1e77f9,_0xddf64c,!![]);}catch(_0x55110e){return BPromise[_0x0559('0x1f')](_0x55110e);}return _0x1e77f9[_0x0559('0x20')]();};}function saveUpdates(_0x19612e,_0x1ac2ca){return function(_0x1e3d88){if(_0x1e3d88){return _0x1e3d88['update'](_0x19612e)[_0x0559('0x21')](function(_0x30e39d){return _0x30e39d;});}return null;};}function removeEntity(_0x5bb773,_0x5eec86){return function(_0x181378){if(_0x181378){return _0x181378['destroy']()[_0x0559('0x21')](function(){var _0x3afdc3=_0x181378[_0x0559('0x22')]({'plain':!![]});var _0x54cbe8=_0x0559('0x23');return db[_0x0559('0x24')]['destroy']({'where':{'type':_0x54cbe8,'resourceId':_0x3afdc3['id']}})[_0x0559('0x21')](function(){return _0x181378;});})[_0x0559('0x21')](function(){_0x5bb773[_0x0559('0x1d')](0xcc)[_0x0559('0x18')]();});}};}function handleEntityNotFound(_0x4ba079,_0xd05726){return function(_0x10b7ec){if(!_0x10b7ec){_0x4ba079[_0x0559('0x25')](0x194);}return _0x10b7ec;};}function handleError(_0x58d89f,_0xe6593a){_0xe6593a=_0xe6593a||0x1f4;return function(_0x4d3df1){logger[_0x0559('0x26')](_0x4d3df1[_0x0559('0x27')]);if(_0x4d3df1[_0x0559('0x28')]){delete _0x4d3df1['name'];}_0x58d89f[_0x0559('0x1d')](_0xe6593a)[_0x0559('0x29')](_0x4d3df1);};}exports[_0x0559('0x2a')]=function(_0x5e00e6,_0x2a6db0){var _0x5a8d68={},_0x543fdc={},_0x9b8ff4={'count':0x0,'rows':[]};var _0x51828c=_[_0x0559('0x2b')](db['AnalyticDefaultReport'][_0x0559('0x2c')],function(_0x5a6d84){return{'name':_0x5a6d84[_0x0559('0x2d')],'type':_0x5a6d84[_0x0559('0x2e')][_0x0559('0x2f')]};});_0x543fdc['model']=_['map'](_0x51828c,_0x0559('0x28'));_0x543fdc[_0x0559('0x30')]=_[_0x0559('0x31')](_0x5e00e6[_0x0559('0x30')]);_0x543fdc['filters']=_['intersection'](_0x543fdc['model'],_0x543fdc['query']);_0x5a8d68[_0x0559('0x32')]=_[_0x0559('0x33')](_0x543fdc[_0x0559('0x34')],qs['fields'](_0x5e00e6['query'][_0x0559('0x35')]));_0x5a8d68[_0x0559('0x32')]=_0x5a8d68[_0x0559('0x32')][_0x0559('0x36')]?_0x5a8d68[_0x0559('0x32')]:_0x543fdc['model'];if(!_0x5e00e6[_0x0559('0x30')][_0x0559('0x37')](_0x0559('0x38'))){_0x5a8d68['limit']=qs[_0x0559('0x1c')](_0x5e00e6[_0x0559('0x30')][_0x0559('0x1c')]);_0x5a8d68[_0x0559('0x1b')]=qs[_0x0559('0x1b')](_0x5e00e6['query']['offset']);}_0x5a8d68[_0x0559('0x39')]=qs[_0x0559('0x3a')](_0x5e00e6[_0x0559('0x30')]['sort']);_0x5a8d68[_0x0559('0x3b')]=qs[_0x0559('0x3c')](_[_0x0559('0x3d')](_0x5e00e6[_0x0559('0x30')],_0x543fdc[_0x0559('0x3c')]),_0x51828c);if(_0x5e00e6['query']['filter']){_0x5a8d68[_0x0559('0x3b')]=_[_0x0559('0x3e')](_0x5a8d68['where'],{'$or':_['map'](_0x51828c,function(_0x445424){if(_0x445424[_0x0559('0x2e')]!==_0x0559('0x3f')){var _0x29e92f={};_0x29e92f[_0x445424[_0x0559('0x28')]]={'$like':'%'+_0x5e00e6['query'][_0x0559('0x40')]+'%'};return _0x29e92f;}})});}_0x5a8d68=_['merge']({},_0x5a8d68,_0x5e00e6[_0x0559('0x41')]);var _0x31ac91={'where':_0x5a8d68['where']};return db[_0x0559('0x42')][_0x0559('0x1a')](_0x31ac91)[_0x0559('0x21')](function(_0x1a7a50){_0x9b8ff4[_0x0559('0x1a')]=_0x1a7a50;if(_0x5e00e6[_0x0559('0x30')][_0x0559('0x43')]){_0x5a8d68['include']=[{'all':!![]}];}return db[_0x0559('0x42')]['findAll'](_0x5a8d68);})['then'](function(_0x23c390){_0x9b8ff4['rows']=_0x23c390;return _0x9b8ff4;})[_0x0559('0x21')](respondWithFilteredResult(_0x2a6db0,_0x5a8d68))[_0x0559('0x44')](handleError(_0x2a6db0,null));};exports[_0x0559('0x45')]=function(_0x430e7a,_0x20b9c0){var _0x3fe3f1={'raw':!![],'where':{'id':_0x430e7a[_0x0559('0x46')]['id']}},_0x4876cb={};_0x4876cb[_0x0559('0x34')]=_['keys'](db[_0x0559('0x42')]['rawAttributes']);_0x4876cb[_0x0559('0x30')]=_[_0x0559('0x31')](_0x430e7a[_0x0559('0x30')]);_0x4876cb[_0x0559('0x3c')]=_['intersection'](_0x4876cb[_0x0559('0x34')],_0x4876cb[_0x0559('0x30')]);_0x3fe3f1['attributes']=_['intersection'](_0x4876cb['model'],qs[_0x0559('0x35')](_0x430e7a[_0x0559('0x30')][_0x0559('0x35')]));_0x3fe3f1['attributes']=_0x3fe3f1[_0x0559('0x32')][_0x0559('0x36')]?_0x3fe3f1[_0x0559('0x32')]:_0x4876cb[_0x0559('0x34')];if(_0x430e7a[_0x0559('0x30')]['includeAll']){_0x3fe3f1[_0x0559('0x47')]=[{'all':!![]}];}_0x3fe3f1=_[_0x0559('0x3e')]({},_0x3fe3f1,_0x430e7a[_0x0559('0x41')]);return db[_0x0559('0x42')][_0x0559('0x48')](_0x3fe3f1)[_0x0559('0x21')](handleEntityNotFound(_0x20b9c0,null))['then'](respondWithResult(_0x20b9c0,null))[_0x0559('0x44')](handleError(_0x20b9c0,null));};exports[_0x0559('0x49')]=function(_0x585079,_0x449b7a){return db[_0x0559('0x42')][_0x0559('0x49')](_0x585079[_0x0559('0x4a')],{})[_0x0559('0x21')](function(_0x407a83){var _0x2a2778=_0x585079['user'][_0x0559('0x22')]({'plain':!![]});if(!_0x2a2778)throw new Error(_0x0559('0x4b'));if(_0x2a2778[_0x0559('0x4c')]===_0x0559('0x4d')){var _0x2c3202=_0x407a83[_0x0559('0x22')]({'plain':!![]});var _0x10b8ca=_0x0559('0x4e');return db['UserProfileSection'][_0x0559('0x48')]({'where':{'name':_0x10b8ca,'userProfileId':_0x2a2778['userProfileId']},'raw':!![]})['then'](function(_0x39c5be){if(_0x39c5be&&_0x39c5be[_0x0559('0x4f')]===0x0){return db[_0x0559('0x24')][_0x0559('0x49')]({'name':_0x2c3202[_0x0559('0x28')],'resourceId':_0x2c3202['id'],'type':_0x0559('0x23'),'sectionId':_0x39c5be['id']},{})[_0x0559('0x21')](function(){return _0x407a83;});}else{return _0x407a83;}})[_0x0559('0x44')](function(_0xe1df84){logger[_0x0559('0x26')](_0x0559('0x50'),_0xe1df84);throw _0xe1df84;});}return _0x407a83;})[_0x0559('0x21')](respondWithResult(_0x449b7a,0xc9))[_0x0559('0x44')](handleError(_0x449b7a,null));};exports[_0x0559('0x51')]=function(_0x1deb5e,_0x4a6863){if(_0x1deb5e[_0x0559('0x4a')]['id']){delete _0x1deb5e[_0x0559('0x4a')]['id'];}return db[_0x0559('0x42')][_0x0559('0x48')]({'where':{'id':_0x1deb5e[_0x0559('0x46')]['id']}})[_0x0559('0x21')](handleEntityNotFound(_0x4a6863,null))[_0x0559('0x21')](saveUpdates(_0x1deb5e[_0x0559('0x4a')],null))[_0x0559('0x21')](respondWithResult(_0x4a6863,null))[_0x0559('0x44')](handleError(_0x4a6863,null));};exports[_0x0559('0x52')]=function(_0x227344,_0x31b479){return db[_0x0559('0x42')][_0x0559('0x48')]({'where':{'id':_0x227344['params']['id']}})[_0x0559('0x21')](handleEntityNotFound(_0x31b479,null))[_0x0559('0x21')](removeEntity(_0x31b479,null))[_0x0559('0x44')](handleError(_0x31b479,null));};exports[_0x0559('0x53')]=function(_0x459932,_0x203a4d){var _0x703e0b=0xa;var _0x34a751=[_0x0559('0x54'),'left_join',_0x0559('0x55'),_0x0559('0x56')];var _0x3e45d4={'SUM':_0x0559('0x57'),'COUNT':_0x0559('0x58'),'COUNT DISTINCT':_0x0559('0x59'),'MAX':_0x0559('0x5a'),'MIN':_0x0559('0x5b'),'AVG':_0x0559('0x5c'),'GROUP_CONCAT':_0x0559('0x5d'),'GROUP_CONCAT ASC':_0x0559('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x38bfc3={'SEC_TO_TIME':_0x0559('0x5f'),'DATE':_0x0559('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x0559('0x61'),'UNIX_TIMESTAMP':_0x0559('0x62')};var _0x4e7187=function(_0x42d524){return!_[_0x0559('0x63')](['IS\x20NULL',_0x0559('0x64'),_0x0559('0x65'),_0x0559('0x66')],_0x42d524);};var _0x335726=function(_0x371f0b){if(!_0x371f0b||!_0x371f0b[_0x0559('0x67')][_0x0559('0x36')]){return'';}for(var _0x4eb636='(',_0x365108=0x0;_0x365108<_0x371f0b[_0x0559('0x67')][_0x0559('0x36')];_0x365108+=0x1){_0x365108>0x0&&(_0x4eb636+='\x20'+_0x371f0b[_0x0559('0x68')]+'\x20');_0x4eb636+=_0x371f0b[_0x0559('0x67')][_0x365108][_0x0559('0x69')]?_0x335726(_0x371f0b[_0x0559('0x67')][_0x365108]['group']):_0x371f0b['rules'][_0x365108][_0x0559('0x6a')]+'\x20'+_0x371f0b[_0x0559('0x67')][_0x365108][_0x0559('0x6b')]+(_0x4e7187(_0x371f0b['rules'][_0x365108]['condition'])?'\x20'+_0x371f0b[_0x0559('0x67')][_0x365108][_0x0559('0x6c')]:'');}return _0x4eb636+')';};var _0x3ca899={'where':{'id':_0x459932[_0x0559('0x46')]['id']}},_0xdfc5ee,_0x2ab1cf,_0x5a1338,_0x19f46a,_0x264b2e;_0x3ca899=_['merge']({},_0x3ca899,_0x459932[_0x0559('0x41')]);return db['AnalyticDefaultReport'][_0x0559('0x48')](_0x3ca899)[_0x0559('0x21')](function(_0xf9d9d){if(_0xf9d9d){_0xdfc5ee=_0xf9d9d;return _0xf9d9d['getFields']();}return null;})[_0x0559('0x21')](function(_0x117c4d){if(_0x117c4d){if(!_0x117c4d[_0x0559('0x36')]){throw new db[(_0x0559('0x6d'))]['ValidationErrorItem'](_0x0559('0x6e'),0x193);}_0x2ab1cf=_0x117c4d;return db[_0x0559('0x6f')]['findAll']({'raw':!![]});}return null;})[_0x0559('0x21')](function(_0x4adb42){if(_0x4adb42){_0x5a1338=_[_0x0559('0x70')](_0x4adb42,'id');var _0x5d31ab;var _0x5854cb=squel[_0x0559('0x71')]();_0x5854cb[_0x0559('0x72')](_0xdfc5ee[_0x0559('0x73')]);for(var _0x2f3025=0x0;_0x2f3025<_0x2ab1cf[_0x0559('0x36')];_0x2f3025+=0x1){_0x5d31ab=_0x2ab1cf[_0x2f3025][_0x0559('0x74')]?_0x5a1338[_0x2ab1cf[_0x2f3025]['MetricId']][_0x0559('0x75')]:_0x2ab1cf[_0x2f3025][_0x0559('0x6a')];_0x5d31ab=_0x2ab1cf[_0x2f3025][_0x0559('0x76')]?_[_0x0559('0x77')](_0x3e45d4[_0x2ab1cf[_0x2f3025][_0x0559('0x76')]],'%s',_0x5d31ab):_0x5d31ab;_0x5d31ab=_0x2ab1cf[_0x2f3025][_0x0559('0x78')]?_[_0x0559('0x77')](_0x38bfc3[_0x2ab1cf[_0x2f3025]['format']],'%s',_0x5d31ab):_0x5d31ab;if(_0x2ab1cf[_0x2f3025][_0x0559('0x79')]){_0x5854cb[_0x0559('0x69')](_0x5d31ab);}_0x2ab1cf[_0x2f3025][_0x0559('0x7a')]&&_0x5854cb[_0x0559('0x39')](_0x5d31ab,_0x2ab1cf[_0x2f3025][_0x0559('0x7a')]===_0x0559('0x7b')?![]:!![]);_0x5854cb['field'](_0x5d31ab,_0x2ab1cf[_0x2f3025][_0x0559('0x7c')]||_0x5d31ab);}if(_0xdfc5ee['joins']){_0xdfc5ee['joins']=JSON[_0x0559('0x7d')](_0xdfc5ee[_0x0559('0x7e')]);for(var _0x11aaf1=0x0;_0x11aaf1<_0xdfc5ee[_0x0559('0x7e')][_0x0559('0x36')];_0x11aaf1+=0x1){if(_0xdfc5ee[_0x0559('0x7e')][_0x11aaf1][_0x0559('0x2e')]&&_[_0x0559('0x63')](_0x34a751,_0xdfc5ee[_0x0559('0x7e')][_0x11aaf1][_0x0559('0x2e')])&&_0xdfc5ee[_0x0559('0x7e')][_0x11aaf1]['parentKey']&&_0xdfc5ee['joins'][_0x11aaf1]['foreignTable']&&_0xdfc5ee[_0x0559('0x7e')][_0x11aaf1][_0x0559('0x7f')]){_0x5854cb[_0xdfc5ee[_0x0559('0x7e')][_0x11aaf1]['type']](_0xdfc5ee['joins'][_0x11aaf1][_0x0559('0x80')],null,util[_0x0559('0x78')]('%s.%s\x20=\x20%s.%s',_0xdfc5ee[_0x0559('0x73')],_0xdfc5ee['joins'][_0x11aaf1][_0x0559('0x81')],_0xdfc5ee[_0x0559('0x7e')][_0x11aaf1][_0x0559('0x80')],_0xdfc5ee[_0x0559('0x7e')][_0x11aaf1]['foreignKey']));}}}if(_0xdfc5ee[_0x0559('0x82')]){_0xdfc5ee['conditions']=JSON[_0x0559('0x7d')](_0xdfc5ee[_0x0559('0x82')]);_0x5854cb[_0x0559('0x3b')](_0x335726(_0xdfc5ee[_0x0559('0x82')]['group']));}_0x264b2e=_0x5854cb['clone']();_0x5854cb[_0x0559('0x1c')](_0x703e0b);_0x5854cb[_0x0559('0x1b')](0x0);logger[_0x0559('0x83')](_0x0559('0x84'),_0x5854cb[_0x0559('0x85')]());return db['sequelize']['query'](_0x5854cb[_0x0559('0x85')](),{'type':db[_0x0559('0x86')][_0x0559('0x87')]['SELECT']});}})['then'](respondWithResult(_0x203a4d,null))[_0x0559('0x44')](handleError(_0x203a4d,null));};function runReport(_0x2996ad,_0x250c40,_0x1476aa){var _0xa4d601=_0x250c40[_0x0559('0x28')];var _0x4bff15=0xa;var _0x431c28=[_0x0559('0x54'),'left_join',_0x0559('0x55'),_0x0559('0x56')];var _0x29e264={'SUM':_0x0559('0x57'),'COUNT':_0x0559('0x58'),'COUNT DISTINCT':_0x0559('0x59'),'MAX':_0x0559('0x5a'),'MIN':_0x0559('0x5b'),'AVG':_0x0559('0x5c'),'GROUP_CONCAT':_0x0559('0x5d'),'GROUP_CONCAT ASC':_0x0559('0x5e'),'GROUP_CONCAT DESC':_0x0559('0x88')};var _0x28a8c6={'SEC_TO_TIME':_0x0559('0x5f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x0559('0x61'),'UNIX_TIMESTAMP':_0x0559('0x62')};var _0x29200f=function(_0x37f2d7){return!_[_0x0559('0x63')]([_0x0559('0x89'),_0x0559('0x64'),'IS\x20EMPTY',_0x0559('0x66')],_0x37f2d7);};var _0x4b0ce9=function(_0x1f8a80){if(!_0x1f8a80||!_0x1f8a80[_0x0559('0x67')][_0x0559('0x36')]){return'';}for(var _0x259f89='(',_0xaa526d=0x0;_0xaa526d<_0x1f8a80[_0x0559('0x67')][_0x0559('0x36')];_0xaa526d+=0x1){_0xaa526d>0x0&&(_0x259f89+='\x20'+_0x1f8a80[_0x0559('0x68')]+'\x20');_0x259f89+=_0x1f8a80[_0x0559('0x67')][_0xaa526d][_0x0559('0x69')]?_0x4b0ce9(_0x1f8a80[_0x0559('0x67')][_0xaa526d][_0x0559('0x69')]):_0x1f8a80[_0x0559('0x67')][_0xaa526d]['field']+'\x20'+_0x1f8a80['rules'][_0xaa526d][_0x0559('0x6b')]+(_0x29200f(_0x1f8a80['rules'][_0xaa526d][_0x0559('0x6b')])?'\x20'+_0x1f8a80[_0x0559('0x67')][_0xaa526d][_0x0559('0x6c')]:'');}return _0x259f89+')';};var _0x1dff3d={'where':{'id':_0x2996ad['id']}},_0x1ae67e,_0x2cd6e2,_0x37b0f3,_0x513bc3,_0x44951d;_0x1dff3d=_['merge']({},_0x1dff3d,_0x1476aa);return db[_0x0559('0x42')][_0x0559('0x48')](_0x1dff3d)[_0x0559('0x21')](function(_0x1c02ab){if(_0x1c02ab){_0x1ae67e=_0x1c02ab;return _0x1c02ab[_0x0559('0x8a')]();}return null;})[_0x0559('0x21')](function(_0x43fcbe){if(_0x43fcbe){if(!_0x43fcbe[_0x0559('0x36')]){throw new db[(_0x0559('0x6d'))][(_0x0559('0x8b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2cd6e2=_0x43fcbe;return db[_0x0559('0x6f')][_0x0559('0x8c')]({'raw':!![]});}return null;})['then'](function(_0x226a5f){if(_0x226a5f){_0x37b0f3=_[_0x0559('0x70')](_0x226a5f,'id');var _0xc5ec84;var _0x34d5fa=squel[_0x0559('0x71')]();_0x34d5fa['from'](_0x1ae67e['table']);for(var _0x50cf9f=0x0;_0x50cf9f<_0x2cd6e2['length'];_0x50cf9f+=0x1){_0xc5ec84=_0x2cd6e2[_0x50cf9f]['MetricId']?_0x37b0f3[_0x2cd6e2[_0x50cf9f][_0x0559('0x74')]][_0x0559('0x75')]:_0x2cd6e2[_0x50cf9f][_0x0559('0x6a')];_0xc5ec84=_0x2cd6e2[_0x50cf9f]['function']?_['replace'](_0x29e264[_0x2cd6e2[_0x50cf9f][_0x0559('0x76')]],'%s',_0xc5ec84):_0xc5ec84;_0xc5ec84=_0x2cd6e2[_0x50cf9f][_0x0559('0x78')]?_['replace'](_0x28a8c6[_0x2cd6e2[_0x50cf9f]['format']],'%s',_0xc5ec84):_0xc5ec84;if(_0x2cd6e2[_0x50cf9f][_0x0559('0x79')]){_0x34d5fa['group'](_0xc5ec84);}_0x2cd6e2[_0x50cf9f]['orderBy']&&_0x34d5fa[_0x0559('0x39')](_0xc5ec84,_0x2cd6e2[_0x50cf9f][_0x0559('0x7a')]==='DESC'?![]:!![]);_0x34d5fa[_0x0559('0x6a')](_0xc5ec84,_0x2cd6e2[_0x50cf9f][_0x0559('0x7c')]||_0xc5ec84);}if(_0x1ae67e['joins']){_0x1ae67e[_0x0559('0x7e')]=JSON[_0x0559('0x7d')](_0x1ae67e[_0x0559('0x7e')]);for(var _0x4339f0=0x0;_0x4339f0<_0x1ae67e[_0x0559('0x7e')][_0x0559('0x36')];_0x4339f0+=0x1){if(_0x1ae67e['joins'][_0x4339f0][_0x0559('0x2e')]&&_['includes'](_0x431c28,_0x1ae67e[_0x0559('0x7e')][_0x4339f0][_0x0559('0x2e')])&&_0x1ae67e['joins'][_0x4339f0][_0x0559('0x81')]&&_0x1ae67e[_0x0559('0x7e')][_0x4339f0][_0x0559('0x80')]&&_0x1ae67e['joins'][_0x4339f0]['foreignKey']){_0x34d5fa[_0x1ae67e[_0x0559('0x7e')][_0x4339f0][_0x0559('0x2e')]](_0x1ae67e[_0x0559('0x7e')][_0x4339f0][_0x0559('0x80')],null,util[_0x0559('0x78')](_0x0559('0x8d'),_0x1ae67e[_0x0559('0x73')],_0x1ae67e[_0x0559('0x7e')][_0x4339f0][_0x0559('0x81')],_0x1ae67e[_0x0559('0x7e')][_0x4339f0][_0x0559('0x80')],_0x1ae67e[_0x0559('0x7e')][_0x4339f0][_0x0559('0x7f')]));}}}if(_0x1ae67e[_0x0559('0x82')]){_0x1ae67e['conditions']=JSON['parse'](_0x1ae67e[_0x0559('0x82')]);_0x34d5fa[_0x0559('0x3b')](_0x4b0ce9(_0x1ae67e[_0x0559('0x82')][_0x0559('0x69')]));}_0x44951d=_0x34d5fa[_0x0559('0x8e')]();_0x34d5fa['limit'](_0x4bff15);_0x34d5fa[_0x0559('0x1b')](0x0);logger['debug'](_0x0559('0x84'),_0x34d5fa[_0x0559('0x85')]());return db[_0x0559('0x86')][_0x0559('0x30')](_0x34d5fa[_0x0559('0x85')](),{'type':db[_0x0559('0x86')][_0x0559('0x87')][_0x0559('0x8f')]});}})['then'](function(_0x551563){if(!_0x551563['length']){throw new db[(_0x0559('0x6d'))][(_0x0559('0x8b'))]('No\x20available\x20data',0xcc);}if(_0x250c40[_0x0559('0x90')]===_0x0559('0x91')){return null;}var _0x2993fd=_[_0x0559('0x3e')](_0x250c40,{'name':_0x250c40[_0x0559('0x92')]||_0x250c40[_0x0559('0x28')]||_0x1ae67e[_0x0559('0x28')],'basename':_0xa4d601,'savename':util[_0x0559('0x78')]('%s-%s.%s',_0x250c40[_0x0559('0x28')]||_0x1ae67e[_0x0559('0x28')],require(_0x0559('0x93'))[_0x0559('0x94')](0x4),_0x250c40[_0x0559('0x90')]||_0x0559('0x95')),'reportId':_0x1ae67e['id'],'reportType':_0x0559('0x96')});return db[_0x0559('0x97')][_0x0559('0x49')](_0x2993fd,{'raw':!![]});})['then'](function(_0x13c655){if(_0x1ae67e[_0x0559('0x73')]===_0x0559('0x98')){_0x44951d[_0x0559('0x3b')](_0x1ae67e[_0x0559('0x73')]+_0x0559('0x99'),_0x250c40[_0x0559('0x9a')],_0x250c40['endDate']);}else{_0x44951d[_0x0559('0x3b')](_0x1ae67e[_0x0559('0x73')]+_0x0559('0x9b'),_0x250c40[_0x0559('0x9a')],_0x250c40['endDate']);}if(_0x13c655){logger[_0x0559('0x9c')](_0x0559('0x9d'),_0x44951d[_0x0559('0x85')]());require(_0x0559('0x9e'))[_0x0559('0x9f')](path[_0x0559('0x54')](__dirname,'../../components/export/',_0x13c655[_0x0559('0x90')]),[_0x13c655['id'],_0x44951d['toString'](),path[_0x0559('0x54')](__dirname,_0x0559('0xa0'),_0x13c655[_0x0559('0xa1')]),_0xa4d601]);return _0x13c655;}else{var _0x43fe3d=squel[_0x0559('0x71')]();_0x43fe3d[_0x0559('0x72')]('('+_0x44951d['toString']()+')',_0x0559('0xa2'));_0x43fe3d[_0x0559('0x6a')](_0x0559('0xa3'),_0x0559('0x1a'));_0x44951d[_0x0559('0x1c')](_0x250c40['limit']||_0x4bff15);_0x44951d['offset'](_0x250c40[_0x0559('0x1b')]||0x0);return dbH['sequelize'][_0x0559('0x30')](_0x43fe3d[_0x0559('0x85')](),{'type':dbH['sequelize'][_0x0559('0x87')][_0x0559('0x8f')]})[_0x0559('0x21')](function(_0x1d2e16){if(!_0x1d2e16['length']){_0x513bc3=0x0;}else{_0x513bc3=_0x1d2e16[0x0][_0x0559('0x1a')]||0x0;}return dbH[_0x0559('0x86')][_0x0559('0x30')](_0x44951d[_0x0559('0x85')](),{'type':dbH['sequelize'][_0x0559('0x87')][_0x0559('0x8f')]});})['then'](function(_0x44a7ef){return{'rows':_0x44a7ef||[],'count':_0x513bc3};});}});}exports[_0x0559('0xa4')]=function(_0x4783d0,_0x16880d){return runReport(_0x4783d0[_0x0559('0x46')],_0x4783d0[_0x0559('0x30')],_0x4783d0['options'])[_0x0559('0x21')](respondWithResult(_0x16880d,null))[_0x0559('0x44')](handleError(_0x16880d,null));};exports[_0x0559('0xa5')]=runReport;exports['query']=function(_0x3b72a5,_0x28eb31){var _0x233070=0xa;var _0x1bd3dc=[_0x0559('0x54'),_0x0559('0xa6'),'right_join',_0x0559('0x56')];var _0x58cf98={'SUM':_0x0559('0x57'),'COUNT':_0x0559('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x0559('0x5a'),'MIN':_0x0559('0x5b'),'AVG':_0x0559('0x5c'),'GROUP_CONCAT':_0x0559('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0559('0x88')};var _0x234d22={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x0559('0x60'),'HOUR':_0x0559('0xa7'),'ROUND':_0x0559('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x42e1fa=function(_0x3a4767){return!_[_0x0559('0x63')]([_0x0559('0x89'),'IS\x20NOT\x20NULL',_0x0559('0x65'),_0x0559('0x66')],_0x3a4767);};var _0x3a28ef=function(_0x58b9bd){if(!_0x58b9bd||!_0x58b9bd['rules'][_0x0559('0x36')]){return'';}for(var _0xa1c90f='(',_0x3838e6=0x0;_0x3838e6<_0x58b9bd[_0x0559('0x67')][_0x0559('0x36')];_0x3838e6+=0x1){_0x3838e6>0x0&&(_0xa1c90f+='\x20'+_0x58b9bd[_0x0559('0x68')]+'\x20');_0xa1c90f+=_0x58b9bd[_0x0559('0x67')][_0x3838e6][_0x0559('0x69')]?_0x3a28ef(_0x58b9bd[_0x0559('0x67')][_0x3838e6][_0x0559('0x69')]):_0x58b9bd['rules'][_0x3838e6][_0x0559('0x6a')]+'\x20'+_0x58b9bd[_0x0559('0x67')][_0x3838e6]['condition']+(_0x42e1fa(_0x58b9bd[_0x0559('0x67')][_0x3838e6][_0x0559('0x6b')])?'\x20'+_0x58b9bd[_0x0559('0x67')][_0x3838e6][_0x0559('0x6c')]:'');}return _0xa1c90f+')';};var _0xcb4fdc={'where':{'id':_0x3b72a5[_0x0559('0x46')]['id']}},_0x2cf79e,_0x37abfb,_0xb15eb2,_0x3c7706,_0x2c1aac;_0xcb4fdc=_[_0x0559('0x3e')]({},_0xcb4fdc,_0x3b72a5[_0x0559('0x41')]);return db[_0x0559('0x42')][_0x0559('0x48')](_0xcb4fdc)[_0x0559('0x21')](function(_0x19d35a){if(_0x19d35a){_0x2cf79e=_0x19d35a;return _0x19d35a[_0x0559('0x8a')]();}return null;})[_0x0559('0x21')](function(_0x56347f){if(_0x56347f){if(!_0x56347f[_0x0559('0x36')]){throw new db['Sequelize']['ValidationErrorItem'](_0x0559('0x6e'),0x193);}_0x37abfb=_0x56347f;return db[_0x0559('0x6f')][_0x0559('0x8c')]({'raw':!![]});}return null;})[_0x0559('0x21')](function(_0xca169e){if(_0xca169e){_0xb15eb2=_[_0x0559('0x70')](_0xca169e,'id');var _0x54d328;var _0x25aa20=squel[_0x0559('0x71')]();_0x25aa20['from'](_0x2cf79e[_0x0559('0x73')]);for(var _0x2b7ecb=0x0;_0x2b7ecb<_0x37abfb['length'];_0x2b7ecb+=0x1){_0x54d328=_0x37abfb[_0x2b7ecb][_0x0559('0x74')]?_0xb15eb2[_0x37abfb[_0x2b7ecb][_0x0559('0x74')]][_0x0559('0x75')]:_0x37abfb[_0x2b7ecb]['field'];_0x54d328=_0x37abfb[_0x2b7ecb][_0x0559('0x76')]?_[_0x0559('0x77')](_0x58cf98[_0x37abfb[_0x2b7ecb][_0x0559('0x76')]],'%s',_0x54d328):_0x54d328;_0x54d328=_0x37abfb[_0x2b7ecb][_0x0559('0x78')]?_[_0x0559('0x77')](_0x234d22[_0x37abfb[_0x2b7ecb][_0x0559('0x78')]],'%s',_0x54d328):_0x54d328;if(_0x37abfb[_0x2b7ecb][_0x0559('0x79')]){_0x25aa20[_0x0559('0x69')](_0x54d328);}_0x37abfb[_0x2b7ecb]['orderBy']&&_0x25aa20[_0x0559('0x39')](_0x54d328,_0x37abfb[_0x2b7ecb][_0x0559('0x7a')]==='DESC'?![]:!![]);_0x25aa20[_0x0559('0x6a')](_0x54d328,_0x37abfb[_0x2b7ecb][_0x0559('0x7c')]||_0x54d328);}if(_0x2cf79e[_0x0559('0x7e')]){_0x2cf79e[_0x0559('0x7e')]=JSON[_0x0559('0x7d')](_0x2cf79e[_0x0559('0x7e')]);for(var _0x175fdd=0x0;_0x175fdd<_0x2cf79e[_0x0559('0x7e')][_0x0559('0x36')];_0x175fdd+=0x1){if(_0x2cf79e[_0x0559('0x7e')][_0x175fdd][_0x0559('0x2e')]&&_[_0x0559('0x63')](_0x1bd3dc,_0x2cf79e[_0x0559('0x7e')][_0x175fdd][_0x0559('0x2e')])&&_0x2cf79e[_0x0559('0x7e')][_0x175fdd][_0x0559('0x81')]&&_0x2cf79e['joins'][_0x175fdd][_0x0559('0x80')]&&_0x2cf79e[_0x0559('0x7e')][_0x175fdd][_0x0559('0x7f')]){_0x25aa20[_0x2cf79e[_0x0559('0x7e')][_0x175fdd][_0x0559('0x2e')]](_0x2cf79e[_0x0559('0x7e')][_0x175fdd]['foreignTable'],null,util[_0x0559('0x78')](_0x0559('0x8d'),_0x2cf79e[_0x0559('0x73')],_0x2cf79e[_0x0559('0x7e')][_0x175fdd][_0x0559('0x81')],_0x2cf79e[_0x0559('0x7e')][_0x175fdd][_0x0559('0x80')],_0x2cf79e[_0x0559('0x7e')][_0x175fdd][_0x0559('0x7f')]));}}}if(_0x2cf79e[_0x0559('0x82')]){_0x2cf79e[_0x0559('0x82')]=JSON[_0x0559('0x7d')](_0x2cf79e[_0x0559('0x82')]);_0x25aa20['where'](_0x3a28ef(_0x2cf79e[_0x0559('0x82')][_0x0559('0x69')]));}_0x2c1aac=_0x25aa20['clone']();_0x25aa20[_0x0559('0x1c')](_0x233070);_0x25aa20['offset'](0x0);logger[_0x0559('0x83')]('Limited\x20Query:',_0x25aa20[_0x0559('0x85')]());return db[_0x0559('0x86')][_0x0559('0x30')](_0x25aa20['toString'](),{'type':db['sequelize'][_0x0559('0x87')][_0x0559('0x8f')]});}})[_0x0559('0x21')](function(){return{'sql':_0x2c1aac[_0x0559('0x85')]()};})[_0x0559('0x21')](respondWithResult(_0x28eb31,null))['catch'](handleError(_0x28eb31,null));}; \ No newline at end of file +var _0xe5ed=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','dbH','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','DefaultReports','end','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','include','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','getFields','keyBy','web','fullPath','%s-%s.%s','generate','output','csv','default','AnalyticExtractedReport','startDate','endDate','Run\x20Query:','fork','../../components/export/','../../files/reports','from','countTable','COUNT(*)','count','run','runReport','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1cc1f4,_0x1aecb8){var _0x16efd2=function(_0x50c4c4){while(--_0x50c4c4){_0x1cc1f4['push'](_0x1cc1f4['shift']());}};_0x16efd2(++_0x1aecb8);}(_0xe5ed,0x134));var _0xde5e=function(_0x38c3cd,_0x1e14dd){_0x38c3cd=_0x38c3cd-0x0;var _0x2afec4=_0xe5ed[_0x38c3cd];return _0x2afec4;};'use strict';var pdf=require(_0xde5e('0x0'));var emlformat=require(_0xde5e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xde5e('0x2'));var jsonpatch=require(_0xde5e('0x3'));var rp=require(_0xde5e('0x4'));var moment=require(_0xde5e('0x5'));var BPromise=require(_0xde5e('0x6'));var Mustache=require('mustache');var util=require(_0xde5e('0x7'));var path=require(_0xde5e('0x8'));var sox=require(_0xde5e('0x9'));var csv=require(_0xde5e('0xa'));var ejs=require(_0xde5e('0xb'));var fs=require('fs');var _=require(_0xde5e('0xc'));var squel=require(_0xde5e('0xd'));var crypto=require(_0xde5e('0xe'));var jsforce=require(_0xde5e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xde5e('0xa'));var querystring=require('querystring');var Papa=require(_0xde5e('0x10'));var Redis=require(_0xde5e('0x11'));var authService=require(_0xde5e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde5e('0x13'));var hardwareService=require(_0xde5e('0x14'));var logger=require(_0xde5e('0x15'))(_0xde5e('0x16'));var utils=require('../../config/utils');var config=require(_0xde5e('0x17'));var db=require(_0xde5e('0x18'))['db'];var dbH=require('../../mysqldb')[_0xde5e('0x19')];function respondWithStatusCode(_0x1ac059,_0x4c1983){_0x4c1983=_0x4c1983||0xcc;return function(_0x21172b){if(_0x21172b){return _0x1ac059[_0xde5e('0x1a')](_0x4c1983);}return _0x1ac059[_0xde5e('0x1b')](_0x4c1983)['end']();};}function respondWithResult(_0x189290,_0x2b61d6){_0x2b61d6=_0x2b61d6||0xc8;return function(_0x4da468){if(_0x4da468){return _0x189290[_0xde5e('0x1b')](_0x2b61d6)['json'](_0x4da468);}};}function respondWithFilteredResult(_0x5a9ba6,_0x461bea){return function(_0x57d32e){if(_0x57d32e){var _0x3e7af4=_0x57d32e['count'],_0x373a08=_0x461bea[_0xde5e('0x1c')],_0x539bc4=_0x461bea[_0xde5e('0x1c')]+_0x461bea[_0xde5e('0x1d')],_0x22c5bf;if(_0x539bc4>=_0x3e7af4){_0x539bc4=_0x3e7af4;_0x22c5bf=0xc8;}else{_0x22c5bf=0xce;}_0x5a9ba6[_0xde5e('0x1b')](_0x22c5bf);return _0x5a9ba6[_0xde5e('0x1e')](_0xde5e('0x1f'),_0x373a08+'-'+_0x539bc4+'/'+_0x3e7af4)[_0xde5e('0x20')](_0x57d32e);}return null;};}function patchUpdates(_0x539b03){return function(_0x3b6fbf){try{jsonpatch[_0xde5e('0x21')](_0x3b6fbf,_0x539b03,!![]);}catch(_0x533546){return BPromise[_0xde5e('0x22')](_0x533546);}return _0x3b6fbf[_0xde5e('0x23')]();};}function saveUpdates(_0xe46dbd,_0x195761){return function(_0x7495f8){if(_0x7495f8){return _0x7495f8[_0xde5e('0x24')](_0xe46dbd)[_0xde5e('0x25')](function(_0x59e51e){return _0x59e51e;});}return null;};}function removeEntity(_0x56a86c,_0x11c962){return function(_0x3fe3e7){if(_0x3fe3e7){return _0x3fe3e7['destroy']()['then'](function(){var _0x2b4024=_0x3fe3e7[_0xde5e('0x26')]({'plain':!![]});var _0x44e273=_0xde5e('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x44e273,'resourceId':_0x2b4024['id']}})[_0xde5e('0x25')](function(){return _0x3fe3e7;});})[_0xde5e('0x25')](function(){_0x56a86c[_0xde5e('0x1b')](0xcc)[_0xde5e('0x28')]();});}};}function handleEntityNotFound(_0x3c9cc9,_0x5a5212){return function(_0x482afe){if(!_0x482afe){_0x3c9cc9[_0xde5e('0x1a')](0x194);}return _0x482afe;};}function handleError(_0x1358f5,_0x59d9dc){_0x59d9dc=_0x59d9dc||0x1f4;return function(_0x2d75a0){logger[_0xde5e('0x29')](_0x2d75a0[_0xde5e('0x2a')]);if(_0x2d75a0['name']){delete _0x2d75a0[_0xde5e('0x2b')];}_0x1358f5['status'](_0x59d9dc)['send'](_0x2d75a0);};}exports[_0xde5e('0x2c')]=function(_0x2543fe,_0x5c395f){var _0x1e0a6a={},_0x1bb24b={},_0x4137c0={'count':0x0,'rows':[]};var _0x15ac8b=_[_0xde5e('0x2d')](db[_0xde5e('0x2e')][_0xde5e('0x2f')],function(_0x5b3b01){return{'name':_0x5b3b01['fieldName'],'type':_0x5b3b01['type'][_0xde5e('0x30')]};});_0x1bb24b[_0xde5e('0x31')]=_[_0xde5e('0x2d')](_0x15ac8b,_0xde5e('0x2b'));_0x1bb24b[_0xde5e('0x32')]=_[_0xde5e('0x33')](_0x2543fe[_0xde5e('0x32')]);_0x1bb24b[_0xde5e('0x34')]=_['intersection'](_0x1bb24b['model'],_0x1bb24b[_0xde5e('0x32')]);_0x1e0a6a['attributes']=_[_0xde5e('0x35')](_0x1bb24b[_0xde5e('0x31')],qs['fields'](_0x2543fe[_0xde5e('0x32')][_0xde5e('0x36')]));_0x1e0a6a[_0xde5e('0x37')]=_0x1e0a6a[_0xde5e('0x37')][_0xde5e('0x38')]?_0x1e0a6a['attributes']:_0x1bb24b[_0xde5e('0x31')];if(!_0x2543fe[_0xde5e('0x32')]['hasOwnProperty']('nolimit')){_0x1e0a6a[_0xde5e('0x1d')]=qs[_0xde5e('0x1d')](_0x2543fe['query'][_0xde5e('0x1d')]);_0x1e0a6a[_0xde5e('0x1c')]=qs['offset'](_0x2543fe['query']['offset']);}_0x1e0a6a[_0xde5e('0x39')]=qs[_0xde5e('0x3a')](_0x2543fe['query'][_0xde5e('0x3a')]);_0x1e0a6a['where']=qs[_0xde5e('0x34')](_['pick'](_0x2543fe[_0xde5e('0x32')],_0x1bb24b[_0xde5e('0x34')]),_0x15ac8b);if(_0x2543fe[_0xde5e('0x32')][_0xde5e('0x3b')]){_0x1e0a6a[_0xde5e('0x3c')]=_[_0xde5e('0x3d')](_0x1e0a6a[_0xde5e('0x3c')],{'$or':_[_0xde5e('0x2d')](_0x15ac8b,function(_0x49fcbb){if(_0x49fcbb[_0xde5e('0x3e')]!==_0xde5e('0x3f')){var _0x212676={};_0x212676[_0x49fcbb[_0xde5e('0x2b')]]={'$like':'%'+_0x2543fe[_0xde5e('0x32')][_0xde5e('0x3b')]+'%'};return _0x212676;}})});}_0x1e0a6a=_['merge']({},_0x1e0a6a,_0x2543fe[_0xde5e('0x40')]);var _0x46e208={'where':_0x1e0a6a[_0xde5e('0x3c')]};return db['AnalyticDefaultReport']['count'](_0x46e208)[_0xde5e('0x25')](function(_0x7a3b84){_0x4137c0['count']=_0x7a3b84;if(_0x2543fe[_0xde5e('0x32')][_0xde5e('0x41')]){_0x1e0a6a['include']=[{'all':!![]}];}return db[_0xde5e('0x2e')][_0xde5e('0x42')](_0x1e0a6a);})[_0xde5e('0x25')](function(_0x2f9363){_0x4137c0[_0xde5e('0x43')]=_0x2f9363;return _0x4137c0;})['then'](respondWithFilteredResult(_0x5c395f,_0x1e0a6a))['catch'](handleError(_0x5c395f,null));};exports[_0xde5e('0x44')]=function(_0x16bc4f,_0x38f3e5){var _0x5bc0c2={'raw':!![],'where':{'id':_0x16bc4f['params']['id']}},_0x206fe0={};_0x206fe0[_0xde5e('0x31')]=_[_0xde5e('0x33')](db[_0xde5e('0x2e')][_0xde5e('0x2f')]);_0x206fe0['query']=_[_0xde5e('0x33')](_0x16bc4f[_0xde5e('0x32')]);_0x206fe0[_0xde5e('0x34')]=_[_0xde5e('0x35')](_0x206fe0[_0xde5e('0x31')],_0x206fe0[_0xde5e('0x32')]);_0x5bc0c2[_0xde5e('0x37')]=_[_0xde5e('0x35')](_0x206fe0[_0xde5e('0x31')],qs[_0xde5e('0x36')](_0x16bc4f[_0xde5e('0x32')][_0xde5e('0x36')]));_0x5bc0c2[_0xde5e('0x37')]=_0x5bc0c2[_0xde5e('0x37')][_0xde5e('0x38')]?_0x5bc0c2['attributes']:_0x206fe0[_0xde5e('0x31')];if(_0x16bc4f[_0xde5e('0x32')][_0xde5e('0x41')]){_0x5bc0c2[_0xde5e('0x45')]=[{'all':!![]}];}_0x5bc0c2=_[_0xde5e('0x3d')]({},_0x5bc0c2,_0x16bc4f[_0xde5e('0x40')]);return db[_0xde5e('0x2e')]['find'](_0x5bc0c2)[_0xde5e('0x25')](handleEntityNotFound(_0x38f3e5,null))[_0xde5e('0x25')](respondWithResult(_0x38f3e5,null))[_0xde5e('0x46')](handleError(_0x38f3e5,null));};exports[_0xde5e('0x47')]=function(_0x45de89,_0x111246){return db[_0xde5e('0x2e')][_0xde5e('0x47')](_0x45de89['body'],{})[_0xde5e('0x25')](function(_0x8de5ed){var _0x3b5943=_0x45de89['user']['get']({'plain':!![]});if(!_0x3b5943)throw new Error(_0xde5e('0x48'));if(_0x3b5943['role']===_0xde5e('0x49')){var _0x5f3a84=_0x8de5ed[_0xde5e('0x26')]({'plain':!![]});var _0x80d5b1=_0xde5e('0x4a');return db[_0xde5e('0x4b')][_0xde5e('0x4c')]({'where':{'name':_0x80d5b1,'userProfileId':_0x3b5943[_0xde5e('0x4d')]},'raw':!![]})[_0xde5e('0x25')](function(_0x31d310){if(_0x31d310&&_0x31d310[_0xde5e('0x4e')]===0x0){return db[_0xde5e('0x4f')][_0xde5e('0x47')]({'name':_0x5f3a84['name'],'resourceId':_0x5f3a84['id'],'type':_0xde5e('0x27'),'sectionId':_0x31d310['id']},{})[_0xde5e('0x25')](function(){return _0x8de5ed;});}else{return _0x8de5ed;}})[_0xde5e('0x46')](function(_0x1fc2df){logger['error'](_0xde5e('0x50'),_0x1fc2df);throw _0x1fc2df;});}return _0x8de5ed;})['then'](respondWithResult(_0x111246,0xc9))[_0xde5e('0x46')](handleError(_0x111246,null));};exports[_0xde5e('0x24')]=function(_0x5d64da,_0x56e60c){if(_0x5d64da[_0xde5e('0x51')]['id']){delete _0x5d64da['body']['id'];}return db[_0xde5e('0x2e')][_0xde5e('0x4c')]({'where':{'id':_0x5d64da[_0xde5e('0x52')]['id']}})[_0xde5e('0x25')](handleEntityNotFound(_0x56e60c,null))[_0xde5e('0x25')](saveUpdates(_0x5d64da['body'],null))[_0xde5e('0x25')](respondWithResult(_0x56e60c,null))[_0xde5e('0x46')](handleError(_0x56e60c,null));};exports[_0xde5e('0x53')]=function(_0xfef2b8,_0x155417){return db[_0xde5e('0x2e')][_0xde5e('0x4c')]({'where':{'id':_0xfef2b8['params']['id']}})[_0xde5e('0x25')](handleEntityNotFound(_0x155417,null))[_0xde5e('0x25')](removeEntity(_0x155417,null))[_0xde5e('0x46')](handleError(_0x155417,null));};exports[_0xde5e('0x54')]=function(_0x3241cb,_0x168820){var _0x11cd6f=0xa;var _0x50e0ad=[_0xde5e('0x55'),_0xde5e('0x56'),_0xde5e('0x57'),_0xde5e('0x58')];var _0x13a313={'SUM':_0xde5e('0x59'),'COUNT':_0xde5e('0x5a'),'COUNT DISTINCT':_0xde5e('0x5b'),'MAX':_0xde5e('0x5c'),'MIN':'MIN(%s)','AVG':_0xde5e('0x5d'),'GROUP_CONCAT':_0xde5e('0x5e'),'GROUP_CONCAT ASC':_0xde5e('0x5f'),'GROUP_CONCAT DESC':_0xde5e('0x60')};var _0x3464b8={'SEC_TO_TIME':_0xde5e('0x61'),'DATE':_0xde5e('0x62'),'HOUR':_0xde5e('0x63'),'ROUND':_0xde5e('0x64'),'UNIX_TIMESTAMP':_0xde5e('0x65')};var _0x2ca0e7=function(_0x1a691f){return!_['includes']([_0xde5e('0x66'),_0xde5e('0x67'),_0xde5e('0x68'),_0xde5e('0x69')],_0x1a691f);};var _0x59f888=function(_0x5cc11f){if(!_0x5cc11f||!_0x5cc11f[_0xde5e('0x6a')][_0xde5e('0x38')]){return'';}for(var _0xac5ed5='(',_0xc847ec=0x0;_0xc847ec<_0x5cc11f[_0xde5e('0x6a')][_0xde5e('0x38')];_0xc847ec+=0x1){_0xc847ec>0x0&&(_0xac5ed5+='\x20'+_0x5cc11f[_0xde5e('0x6b')]+'\x20');_0xac5ed5+=_0x5cc11f[_0xde5e('0x6a')][_0xc847ec][_0xde5e('0x6c')]?_0x59f888(_0x5cc11f[_0xde5e('0x6a')][_0xc847ec][_0xde5e('0x6c')]):_0x5cc11f[_0xde5e('0x6a')][_0xc847ec][_0xde5e('0x6d')]+'\x20'+_0x5cc11f[_0xde5e('0x6a')][_0xc847ec][_0xde5e('0x6e')]+(_0x2ca0e7(_0x5cc11f[_0xde5e('0x6a')][_0xc847ec][_0xde5e('0x6e')])?'\x20'+_0x5cc11f['rules'][_0xc847ec][_0xde5e('0x6f')]:'');}return _0xac5ed5+')';};var _0x5095b3={'where':{'id':_0x3241cb['params']['id']}},_0x525cde,_0x50c07e,_0x48c8c0,_0x5cead0,_0x4f6a3c;_0x5095b3=_['merge']({},_0x5095b3,_0x3241cb[_0xde5e('0x40')]);return db['AnalyticDefaultReport']['find'](_0x5095b3)['then'](function(_0x3761c5){if(_0x3761c5){_0x525cde=_0x3761c5;return _0x3761c5['getFields']();}return null;})[_0xde5e('0x25')](function(_0x3e7f2e){if(_0x3e7f2e){if(!_0x3e7f2e[_0xde5e('0x38')]){throw new db[(_0xde5e('0x70'))][(_0xde5e('0x71'))](_0xde5e('0x72'),0x193);}_0x50c07e=_0x3e7f2e;return db[_0xde5e('0x73')][_0xde5e('0x42')]({'raw':!![]});}return null;})[_0xde5e('0x25')](function(_0x541dfa){if(_0x541dfa){_0x48c8c0=_['keyBy'](_0x541dfa,'id');var _0x576329;var _0x4de16c=squel[_0xde5e('0x74')]();_0x4de16c['from'](_0x525cde[_0xde5e('0x75')]);for(var _0x23ebc8=0x0;_0x23ebc8<_0x50c07e[_0xde5e('0x38')];_0x23ebc8+=0x1){_0x576329=_0x50c07e[_0x23ebc8][_0xde5e('0x76')]?_0x48c8c0[_0x50c07e[_0x23ebc8]['MetricId']][_0xde5e('0x77')]:_0x50c07e[_0x23ebc8][_0xde5e('0x6d')];_0x576329=_0x50c07e[_0x23ebc8]['function']?_['replace'](_0x13a313[_0x50c07e[_0x23ebc8][_0xde5e('0x78')]],'%s',_0x576329):_0x576329;_0x576329=_0x50c07e[_0x23ebc8][_0xde5e('0x79')]?_[_0xde5e('0x7a')](_0x3464b8[_0x50c07e[_0x23ebc8][_0xde5e('0x79')]],'%s',_0x576329):_0x576329;if(_0x50c07e[_0x23ebc8][_0xde5e('0x7b')]){_0x4de16c['group'](_0x576329);}_0x50c07e[_0x23ebc8][_0xde5e('0x7c')]&&_0x4de16c[_0xde5e('0x39')](_0x576329,_0x50c07e[_0x23ebc8]['orderBy']===_0xde5e('0x7d')?![]:!![]);_0x4de16c[_0xde5e('0x6d')](_0x576329,_0x50c07e[_0x23ebc8][_0xde5e('0x7e')]||_0x576329);}if(_0x525cde[_0xde5e('0x7f')]){_0x525cde[_0xde5e('0x7f')]=JSON[_0xde5e('0x80')](_0x525cde[_0xde5e('0x7f')]);for(var _0x1fe7a7=0x0;_0x1fe7a7<_0x525cde[_0xde5e('0x7f')]['length'];_0x1fe7a7+=0x1){if(_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['type']&&_['includes'](_0x50e0ad,_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['type'])&&_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['parentKey']&&_0x525cde[_0xde5e('0x7f')][_0x1fe7a7][_0xde5e('0x81')]&&_0x525cde[_0xde5e('0x7f')][_0x1fe7a7][_0xde5e('0x82')]){_0x4de16c[_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['type']](_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['foreignTable'],null,util[_0xde5e('0x79')](_0xde5e('0x83'),_0x525cde[_0xde5e('0x75')],_0x525cde[_0xde5e('0x7f')][_0x1fe7a7][_0xde5e('0x84')],_0x525cde[_0xde5e('0x7f')][_0x1fe7a7]['foreignTable'],_0x525cde[_0xde5e('0x7f')][_0x1fe7a7][_0xde5e('0x82')]));}}}if(_0x525cde[_0xde5e('0x85')]){_0x525cde['conditions']=JSON[_0xde5e('0x80')](_0x525cde[_0xde5e('0x85')]);_0x4de16c[_0xde5e('0x3c')](_0x59f888(_0x525cde[_0xde5e('0x85')][_0xde5e('0x6c')]));}_0x4f6a3c=_0x4de16c[_0xde5e('0x86')]();_0x4de16c[_0xde5e('0x1d')](_0x11cd6f);_0x4de16c[_0xde5e('0x1c')](0x0);logger[_0xde5e('0x87')](_0xde5e('0x88'),_0x4de16c[_0xde5e('0x89')]());return db[_0xde5e('0x8a')][_0xde5e('0x32')](_0x4de16c[_0xde5e('0x89')](),{'type':db[_0xde5e('0x8a')][_0xde5e('0x8b')][_0xde5e('0x8c')]});}})[_0xde5e('0x25')](respondWithResult(_0x168820,null))[_0xde5e('0x46')](handleError(_0x168820,null));};function runReport(_0x5c7365,_0x25306e,_0x2e28c7){var _0x1a00d3=_0x25306e[_0xde5e('0x2b')];var _0x486586=0xa;var _0xe875bd=[_0xde5e('0x55'),_0xde5e('0x56'),_0xde5e('0x57'),_0xde5e('0x58')];var _0x8c3520={'SUM':_0xde5e('0x59'),'COUNT':_0xde5e('0x5a'),'COUNT DISTINCT':_0xde5e('0x5b'),'MAX':'MAX(%s)','MIN':_0xde5e('0x8d'),'AVG':_0xde5e('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xc288bc={'SEC_TO_TIME':_0xde5e('0x61'),'DATE':_0xde5e('0x62'),'HOUR':'HOUR(%s)','ROUND':_0xde5e('0x64'),'UNIX_TIMESTAMP':_0xde5e('0x65')};var _0x17c99e=function(_0x669dda){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xde5e('0x69')],_0x669dda);};var _0x594a4f=function(_0x5bd2da){if(!_0x5bd2da||!_0x5bd2da[_0xde5e('0x6a')][_0xde5e('0x38')]){return'';}for(var _0x2552e8='(',_0x311d92=0x0;_0x311d92<_0x5bd2da[_0xde5e('0x6a')][_0xde5e('0x38')];_0x311d92+=0x1){_0x311d92>0x0&&(_0x2552e8+='\x20'+_0x5bd2da[_0xde5e('0x6b')]+'\x20');_0x2552e8+=_0x5bd2da[_0xde5e('0x6a')][_0x311d92]['group']?_0x594a4f(_0x5bd2da[_0xde5e('0x6a')][_0x311d92][_0xde5e('0x6c')]):_0x5bd2da[_0xde5e('0x6a')][_0x311d92][_0xde5e('0x6d')]+'\x20'+_0x5bd2da[_0xde5e('0x6a')][_0x311d92][_0xde5e('0x6e')]+(_0x17c99e(_0x5bd2da[_0xde5e('0x6a')][_0x311d92][_0xde5e('0x6e')])?'\x20'+_0x5bd2da[_0xde5e('0x6a')][_0x311d92][_0xde5e('0x6f')]:'');}return _0x2552e8+')';};var _0x8cc6dd={'where':{'id':_0x5c7365['id']}},_0x48e5c1,_0x22d871,_0x5e8bf4,_0xb2f246,_0x31d0b5;_0x8cc6dd=_[_0xde5e('0x3d')]({},_0x8cc6dd,_0x2e28c7);return db['AnalyticDefaultReport'][_0xde5e('0x4c')](_0x8cc6dd)[_0xde5e('0x25')](function(_0x996903){if(_0x996903){_0x48e5c1=_0x996903;return _0x996903[_0xde5e('0x8e')]();}return null;})['then'](function(_0x3a876f){if(_0x3a876f){if(!_0x3a876f[_0xde5e('0x38')]){throw new db[(_0xde5e('0x70'))]['ValidationErrorItem'](_0xde5e('0x72'),0x193);}_0x22d871=_0x3a876f;return db['AnalyticMetric'][_0xde5e('0x42')]({'raw':!![]});}return null;})[_0xde5e('0x25')](function(_0x4f6697){if(_0x4f6697){_0x5e8bf4=_[_0xde5e('0x8f')](_0x4f6697,'id');var _0x389e86;var _0x66b37a=squel[_0xde5e('0x74')]();_0x66b37a['from'](_0x48e5c1['table']);for(var _0x388045=0x0;_0x388045<_0x22d871[_0xde5e('0x38')];_0x388045+=0x1){_0x389e86=_0x22d871[_0x388045][_0xde5e('0x76')]?_0x5e8bf4[_0x22d871[_0x388045][_0xde5e('0x76')]]['metric']:_0x22d871[_0x388045][_0xde5e('0x6d')];_0x389e86=_0x22d871[_0x388045]['function']?_['replace'](_0x8c3520[_0x22d871[_0x388045][_0xde5e('0x78')]],'%s',_0x389e86):_0x389e86;_0x389e86=_0x22d871[_0x388045][_0xde5e('0x79')]?_[_0xde5e('0x7a')](_0xc288bc[_0x22d871[_0x388045][_0xde5e('0x79')]],'%s',_0x389e86):_0x389e86;if(_0x22d871[_0x388045][_0xde5e('0x7b')]){_0x66b37a['group'](_0x389e86);}_0x22d871[_0x388045][_0xde5e('0x7c')]&&_0x66b37a[_0xde5e('0x39')](_0x389e86,_0x22d871[_0x388045][_0xde5e('0x7c')]==='DESC'?![]:!![]);_0x66b37a['field'](_0x389e86,_0x22d871[_0x388045][_0xde5e('0x7e')]||_0x389e86);}if(_0x48e5c1[_0xde5e('0x7f')]){_0x48e5c1[_0xde5e('0x7f')]=JSON[_0xde5e('0x80')](_0x48e5c1['joins']);for(var _0x2028b6=0x0;_0x2028b6<_0x48e5c1[_0xde5e('0x7f')]['length'];_0x2028b6+=0x1){if(_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x3e')]&&_['includes'](_0xe875bd,_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x3e')])&&_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x84')]&&_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x81')]&&_0x48e5c1['joins'][_0x2028b6][_0xde5e('0x82')]){_0x66b37a[_0x48e5c1[_0xde5e('0x7f')][_0x2028b6]['type']](_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x81')],null,util[_0xde5e('0x79')](_0xde5e('0x83'),_0x48e5c1[_0xde5e('0x75')],_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x84')],_0x48e5c1[_0xde5e('0x7f')][_0x2028b6][_0xde5e('0x81')],_0x48e5c1['joins'][_0x2028b6][_0xde5e('0x82')]));}}}if(_0x48e5c1[_0xde5e('0x85')]){_0x48e5c1[_0xde5e('0x85')]=JSON[_0xde5e('0x80')](_0x48e5c1[_0xde5e('0x85')]);_0x66b37a[_0xde5e('0x3c')](_0x594a4f(_0x48e5c1['conditions']['group']));}_0x31d0b5=_0x66b37a[_0xde5e('0x86')]();_0x66b37a[_0xde5e('0x1d')](_0x486586);_0x66b37a['offset'](0x0);logger[_0xde5e('0x87')](_0xde5e('0x88'),_0x66b37a[_0xde5e('0x89')]());return db['sequelize']['query'](_0x66b37a[_0xde5e('0x89')](),{'type':db[_0xde5e('0x8a')][_0xde5e('0x8b')][_0xde5e('0x8c')]});}})[_0xde5e('0x25')](function(_0x464dbe){if(!_0x464dbe[_0xde5e('0x38')]){throw new db[(_0xde5e('0x70'))][(_0xde5e('0x71'))]('No\x20available\x20data',0xcc);}if(_0x25306e['output']===_0xde5e('0x90')){return null;}var _0x3745ac=_[_0xde5e('0x3d')](_0x25306e,{'name':_0x25306e[_0xde5e('0x91')]||_0x25306e['name']||_0x48e5c1[_0xde5e('0x2b')],'basename':_0x1a00d3,'savename':util[_0xde5e('0x79')](_0xde5e('0x92'),_0x25306e['name']||_0x48e5c1['name'],require('randomstring')[_0xde5e('0x93')](0x4),_0x25306e[_0xde5e('0x94')]||_0xde5e('0x95')),'reportId':_0x48e5c1['id'],'reportType':_0xde5e('0x96')});return db[_0xde5e('0x97')][_0xde5e('0x47')](_0x3745ac,{'raw':!![]});})['then'](function(_0x378916){if(_0x48e5c1[_0xde5e('0x75')]==='cdr'){_0x31d0b5['where'](_0x48e5c1['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x25306e[_0xde5e('0x98')],_0x25306e[_0xde5e('0x99')]);}else{_0x31d0b5[_0xde5e('0x3c')](_0x48e5c1[_0xde5e('0x75')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x25306e[_0xde5e('0x98')],_0x25306e[_0xde5e('0x99')]);}if(_0x378916){logger['info'](_0xde5e('0x9a'),_0x31d0b5[_0xde5e('0x89')]());require('child_process')[_0xde5e('0x9b')](path[_0xde5e('0x55')](__dirname,_0xde5e('0x9c'),_0x378916[_0xde5e('0x94')]),[_0x378916['id'],_0x31d0b5[_0xde5e('0x89')](),path[_0xde5e('0x55')](__dirname,_0xde5e('0x9d'),_0x378916['savename']),_0x1a00d3]);return _0x378916;}else{var _0x1aeef5=squel[_0xde5e('0x74')]();_0x1aeef5[_0xde5e('0x9e')]('('+_0x31d0b5['toString']()+')',_0xde5e('0x9f'));_0x1aeef5['field'](_0xde5e('0xa0'),'count');_0x31d0b5['limit'](_0x25306e[_0xde5e('0x1d')]||_0x486586);_0x31d0b5['offset'](_0x25306e[_0xde5e('0x1c')]||0x0);return dbH['sequelize'][_0xde5e('0x32')](_0x1aeef5[_0xde5e('0x89')](),{'type':dbH[_0xde5e('0x8a')][_0xde5e('0x8b')][_0xde5e('0x8c')]})['then'](function(_0x46de48){if(!_0x46de48[_0xde5e('0x38')]){_0xb2f246=0x0;}else{_0xb2f246=_0x46de48[0x0][_0xde5e('0xa1')]||0x0;}return dbH['sequelize'][_0xde5e('0x32')](_0x31d0b5[_0xde5e('0x89')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xde5e('0x25')](function(_0x204bb5){return{'rows':_0x204bb5||[],'count':_0xb2f246};});}});}exports[_0xde5e('0xa2')]=function(_0x5878fd,_0x5ecf63){return runReport(_0x5878fd[_0xde5e('0x52')],_0x5878fd[_0xde5e('0x32')],_0x5878fd['options'])['then'](respondWithResult(_0x5ecf63,null))[_0xde5e('0x46')](handleError(_0x5ecf63,null));};exports[_0xde5e('0xa3')]=runReport;exports[_0xde5e('0x32')]=function(_0x49fa06,_0x55a599){var _0x1664c5=0xa;var _0x11fa98=['join',_0xde5e('0x56'),_0xde5e('0x57'),_0xde5e('0x58')];var _0x35e8fa={'SUM':_0xde5e('0x59'),'COUNT':_0xde5e('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xde5e('0x5c'),'MIN':_0xde5e('0x8d'),'AVG':_0xde5e('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xde5e('0x60')};var _0x32f718={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xde5e('0x63'),'ROUND':_0xde5e('0x64'),'UNIX_TIMESTAMP':_0xde5e('0x65')};var _0x536657=function(_0x2888ca){return!_['includes']([_0xde5e('0x66'),_0xde5e('0x67'),'IS\x20EMPTY',_0xde5e('0x69')],_0x2888ca);};var _0x599c26=function(_0x3d5d0a){if(!_0x3d5d0a||!_0x3d5d0a['rules'][_0xde5e('0x38')]){return'';}for(var _0x1044b3='(',_0x4b5865=0x0;_0x4b5865<_0x3d5d0a[_0xde5e('0x6a')]['length'];_0x4b5865+=0x1){_0x4b5865>0x0&&(_0x1044b3+='\x20'+_0x3d5d0a[_0xde5e('0x6b')]+'\x20');_0x1044b3+=_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865][_0xde5e('0x6c')]?_0x599c26(_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865][_0xde5e('0x6c')]):_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865][_0xde5e('0x6d')]+'\x20'+_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865][_0xde5e('0x6e')]+(_0x536657(_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865]['condition'])?'\x20'+_0x3d5d0a[_0xde5e('0x6a')][_0x4b5865]['value']:'');}return _0x1044b3+')';};var _0x45cc53={'where':{'id':_0x49fa06[_0xde5e('0x52')]['id']}},_0x557d0f,_0x2135e3,_0x402af7,_0x279cc3,_0x5cd87c;_0x45cc53=_[_0xde5e('0x3d')]({},_0x45cc53,_0x49fa06[_0xde5e('0x40')]);return db['AnalyticDefaultReport']['find'](_0x45cc53)[_0xde5e('0x25')](function(_0xf424db){if(_0xf424db){_0x557d0f=_0xf424db;return _0xf424db[_0xde5e('0x8e')]();}return null;})[_0xde5e('0x25')](function(_0x27d6ca){if(_0x27d6ca){if(!_0x27d6ca[_0xde5e('0x38')]){throw new db[(_0xde5e('0x70'))][(_0xde5e('0x71'))](_0xde5e('0x72'),0x193);}_0x2135e3=_0x27d6ca;return db[_0xde5e('0x73')][_0xde5e('0x42')]({'raw':!![]});}return null;})[_0xde5e('0x25')](function(_0x412e32){if(_0x412e32){_0x402af7=_['keyBy'](_0x412e32,'id');var _0x2f4ab0;var _0x1c7a80=squel['select']();_0x1c7a80[_0xde5e('0x9e')](_0x557d0f[_0xde5e('0x75')]);for(var _0x56b66b=0x0;_0x56b66b<_0x2135e3[_0xde5e('0x38')];_0x56b66b+=0x1){_0x2f4ab0=_0x2135e3[_0x56b66b][_0xde5e('0x76')]?_0x402af7[_0x2135e3[_0x56b66b]['MetricId']]['metric']:_0x2135e3[_0x56b66b][_0xde5e('0x6d')];_0x2f4ab0=_0x2135e3[_0x56b66b][_0xde5e('0x78')]?_[_0xde5e('0x7a')](_0x35e8fa[_0x2135e3[_0x56b66b]['function']],'%s',_0x2f4ab0):_0x2f4ab0;_0x2f4ab0=_0x2135e3[_0x56b66b][_0xde5e('0x79')]?_[_0xde5e('0x7a')](_0x32f718[_0x2135e3[_0x56b66b][_0xde5e('0x79')]],'%s',_0x2f4ab0):_0x2f4ab0;if(_0x2135e3[_0x56b66b][_0xde5e('0x7b')]){_0x1c7a80[_0xde5e('0x6c')](_0x2f4ab0);}_0x2135e3[_0x56b66b][_0xde5e('0x7c')]&&_0x1c7a80[_0xde5e('0x39')](_0x2f4ab0,_0x2135e3[_0x56b66b][_0xde5e('0x7c')]===_0xde5e('0x7d')?![]:!![]);_0x1c7a80[_0xde5e('0x6d')](_0x2f4ab0,_0x2135e3[_0x56b66b][_0xde5e('0x7e')]||_0x2f4ab0);}if(_0x557d0f[_0xde5e('0x7f')]){_0x557d0f[_0xde5e('0x7f')]=JSON[_0xde5e('0x80')](_0x557d0f[_0xde5e('0x7f')]);for(var _0x3399ec=0x0;_0x3399ec<_0x557d0f[_0xde5e('0x7f')][_0xde5e('0x38')];_0x3399ec+=0x1){if(_0x557d0f[_0xde5e('0x7f')][_0x3399ec]['type']&&_['includes'](_0x11fa98,_0x557d0f[_0xde5e('0x7f')][_0x3399ec][_0xde5e('0x3e')])&&_0x557d0f['joins'][_0x3399ec][_0xde5e('0x84')]&&_0x557d0f[_0xde5e('0x7f')][_0x3399ec]['foreignTable']&&_0x557d0f[_0xde5e('0x7f')][_0x3399ec][_0xde5e('0x82')]){_0x1c7a80[_0x557d0f[_0xde5e('0x7f')][_0x3399ec][_0xde5e('0x3e')]](_0x557d0f[_0xde5e('0x7f')][_0x3399ec]['foreignTable'],null,util[_0xde5e('0x79')]('%s.%s\x20=\x20%s.%s',_0x557d0f[_0xde5e('0x75')],_0x557d0f[_0xde5e('0x7f')][_0x3399ec][_0xde5e('0x84')],_0x557d0f[_0xde5e('0x7f')][_0x3399ec][_0xde5e('0x81')],_0x557d0f['joins'][_0x3399ec][_0xde5e('0x82')]));}}}if(_0x557d0f[_0xde5e('0x85')]){_0x557d0f['conditions']=JSON[_0xde5e('0x80')](_0x557d0f['conditions']);_0x1c7a80[_0xde5e('0x3c')](_0x599c26(_0x557d0f[_0xde5e('0x85')][_0xde5e('0x6c')]));}_0x5cd87c=_0x1c7a80[_0xde5e('0x86')]();_0x1c7a80[_0xde5e('0x1d')](_0x1664c5);_0x1c7a80[_0xde5e('0x1c')](0x0);logger[_0xde5e('0x87')](_0xde5e('0x88'),_0x1c7a80[_0xde5e('0x89')]());return db[_0xde5e('0x8a')][_0xde5e('0x32')](_0x1c7a80[_0xde5e('0x89')](),{'type':db[_0xde5e('0x8a')]['QueryTypes'][_0xde5e('0x8c')]});}})[_0xde5e('0x25')](function(){return{'sql':_0x5cd87c[_0xde5e('0x89')]()};})[_0xde5e('0x25')](respondWithResult(_0x55a599,null))['catch'](handleError(_0x55a599,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5a52fa4..94d30ff 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 _0x53ec=['bluebird','path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment'];(function(_0x35bec1,_0x147b9e){var _0x466feb=function(_0x31fee0){while(--_0x31fee0){_0x35bec1['push'](_0x35bec1['shift']());}};_0x466feb(++_0x147b9e);}(_0x53ec,0x192));var _0xc53e=function(_0x4b88f8,_0x20ae18){_0x4b88f8=_0x4b88f8-0x0;var _0x15ecc5=_0x53ec[_0x4b88f8];return _0x15ecc5;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['analytics_default_reports','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x23a2ce,_0x4cc6bd){var _0x5f4552=function(_0x1bd2a3){while(--_0x1bd2a3){_0x23a2ce['push'](_0x23a2ce['shift']());}};_0x5f4552(++_0x4cc6bd);}(_0x326f,0xd1));var _0xf326=function(_0xbd90a2,_0x253135){_0xbd90a2=_0xbd90a2-0x0;var _0x35a02d=_0x326f[_0xbd90a2];return _0x35a02d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index cee9d7b..d352a3b 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 _0x854f=['rpc','../../config/environment','jayson/promise','client','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x17ec7f,_0x58da09){var _0x242d6=function(_0x219373){while(--_0x219373){_0x17ec7f['push'](_0x17ec7f['shift']());}};_0x242d6(++_0x58da09);}(_0x854f,0xc1));var _0xf854=function(_0x1190fd,_0x411d3a){_0x1190fd=_0x1190fd-0x0;var _0xe9b99f=_0x854f[_0x1190fd];return _0xe9b99f;};'use strict';var _=require(_0xf854('0x0'));var util=require(_0xf854('0x1'));var moment=require(_0xf854('0x2'));var BPromise=require(_0xf854('0x3'));var rs=require(_0xf854('0x4'));var fs=require('fs');var Redis=require(_0xf854('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf854('0x6'));var logger=require('../../config/logger')(_0xf854('0x7'));var config=require(_0xf854('0x8'));var jayson=require(_0xf854('0x9'));var client=jayson[_0xf854('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x93d685,_0x36e8a2,_0x191a63){return new BPromise(function(_0x6d2799,_0x44be6b){return client['request'](_0x93d685,_0x191a63)[_0xf854('0xb')](function(_0x321775){logger['info'](_0xf854('0xc'),_0x36e8a2,_0xf854('0xd'));logger[_0xf854('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x36e8a2,_0xf854('0xd'),JSON[_0xf854('0xf')](_0x321775));if(_0x321775[_0xf854('0x10')]){if(_0x321775[_0xf854('0x10')]['code']===0x1f4){logger[_0xf854('0x10')](_0xf854('0xc'),_0x36e8a2,_0x321775[_0xf854('0x10')][_0xf854('0x11')]);return _0x44be6b(_0x321775[_0xf854('0x10')][_0xf854('0x11')]);}logger[_0xf854('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x36e8a2,_0x321775[_0xf854('0x10')][_0xf854('0x11')]);return _0x6d2799(_0x321775['error'][_0xf854('0x11')]);}else{logger[_0xf854('0x12')](_0xf854('0xc'),_0x36e8a2,'request\x20sent');_0x6d2799(_0x321775[_0xf854('0x13')][_0xf854('0x11')]);}})['catch'](function(_0x5900f6){logger[_0xf854('0x10')](_0xf854('0xc'),_0x36e8a2,_0x5900f6);_0x44be6b(_0x5900f6);});});} \ No newline at end of file +var _0x2c54=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x53103d,_0x31a2e6){var _0x28d7cc=function(_0x4d8c85){while(--_0x4d8c85){_0x53103d['push'](_0x53103d['shift']());}};_0x28d7cc(++_0x31a2e6);}(_0x2c54,0x136));var _0x42c5=function(_0x17f918,_0x1099a9){_0x17f918=_0x17f918-0x0;var _0x556249=_0x2c54[_0x17f918];return _0x556249;};'use strict';var _=require(_0x42c5('0x0'));var util=require(_0x42c5('0x1'));var moment=require(_0x42c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x42c5('0x3'));var fs=require('fs');var Redis=require(_0x42c5('0x4'));var db=require(_0x42c5('0x5'))['db'];var utils=require(_0x42c5('0x6'));var logger=require(_0x42c5('0x7'))(_0x42c5('0x8'));var config=require('../../config/environment');var jayson=require(_0x42c5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1959c1,_0x44516e,_0x38d528){return new BPromise(function(_0x134cb6,_0x14538f){return client[_0x42c5('0xa')](_0x1959c1,_0x38d528)[_0x42c5('0xb')](function(_0x3ca4de){logger[_0x42c5('0xc')](_0x42c5('0xd'),_0x44516e,_0x42c5('0xe'));logger[_0x42c5('0xf')](_0x42c5('0x10'),_0x44516e,_0x42c5('0xe'),JSON[_0x42c5('0x11')](_0x3ca4de));if(_0x3ca4de[_0x42c5('0x12')]){if(_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x13')]===0x1f4){logger[_0x42c5('0x12')](_0x42c5('0xd'),_0x44516e,_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x14')]);return _0x14538f(_0x3ca4de['error']['message']);}logger[_0x42c5('0x12')](_0x42c5('0xd'),_0x44516e,_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x14')]);return _0x134cb6(_0x3ca4de['error'][_0x42c5('0x14')]);}else{logger[_0x42c5('0xc')](_0x42c5('0xd'),_0x44516e,'request\x20sent');_0x134cb6(_0x3ca4de[_0x42c5('0x15')]['message']);}})['catch'](function(_0x466b47){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x44516e,_0x466b47);_0x14538f(_0x466b47);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index c63ddcf..c827605 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 _0x0d36=['query','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','preview','run','/:id/query'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x0d36,0x1d3));var _0x60d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0d36[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x60d3('0x0'));var util=require(_0x60d3('0x1'));var path=require(_0x60d3('0x2'));var timeout=require(_0x60d3('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x60d3('0x4'));var interaction=require(_0x60d3('0x5'));var config=require(_0x60d3('0x6'));var controller=require(_0x60d3('0x7'));router[_0x60d3('0x8')]('/',auth[_0x60d3('0x9')](),controller[_0x60d3('0xa')]);router[_0x60d3('0x8')](_0x60d3('0xb'),auth['isAuthenticated'](),controller[_0x60d3('0xc')]);router[_0x60d3('0x8')]('/:id/preview',auth[_0x60d3('0x9')](),controller[_0x60d3('0xd')]);router[_0x60d3('0x8')]('/:id/run',auth[_0x60d3('0x9')](),controller[_0x60d3('0xe')]);router[_0x60d3('0x8')](_0x60d3('0xf'),auth['isAuthenticated'](),controller[_0x60d3('0x10')]);router[_0x60d3('0x11')]('/',auth['isAuthenticated'](),controller[_0x60d3('0x12')]);router[_0x60d3('0x13')](_0x60d3('0xb'),auth[_0x60d3('0x9')](),controller[_0x60d3('0x14')]);router['delete'](_0x60d3('0xb'),auth[_0x60d3('0x9')](),controller[_0x60d3('0x15')]);module[_0x60d3('0x16')]=router; \ No newline at end of file +var _0xc4cf=['/:id/preview','run','query','post','create','put','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x23e3e7,_0x93dea){var _0x123ecd=function(_0x3de24b){while(--_0x3de24b){_0x23e3e7['push'](_0x23e3e7['shift']());}};_0x123ecd(++_0x93dea);}(_0xc4cf,0x98));var _0xfc4c=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xc4cf[_0x36ed48];return _0x51c63a;};'use strict';var multer=require('multer');var util=require(_0xfc4c('0x0'));var path=require(_0xfc4c('0x1'));var timeout=require('connect-timeout');var express=require(_0xfc4c('0x2'));var router=express[_0xfc4c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfc4c('0x4'));var config=require(_0xfc4c('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0xfc4c('0x6')]('/',auth[_0xfc4c('0x7')](),controller[_0xfc4c('0x8')]);router[_0xfc4c('0x6')](_0xfc4c('0x9'),auth[_0xfc4c('0x7')](),controller['show']);router[_0xfc4c('0x6')](_0xfc4c('0xa'),auth['isAuthenticated'](),controller['preview']);router[_0xfc4c('0x6')]('/:id/run',auth[_0xfc4c('0x7')](),controller[_0xfc4c('0xb')]);router['get']('/:id/query',auth[_0xfc4c('0x7')](),controller[_0xfc4c('0xc')]);router[_0xfc4c('0xd')]('/',auth[_0xfc4c('0x7')](),controller[_0xfc4c('0xe')]);router[_0xfc4c('0xf')](_0xfc4c('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xfc4c('0x10')](_0xfc4c('0x9'),auth[_0xfc4c('0x7')](),controller['destroy']);module[_0xfc4c('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 21c241c..0cded43 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 _0xfec6=['sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x1de193,_0x425f95){var _0x56a717=function(_0x225134){while(--_0x225134){_0x1de193['push'](_0x1de193['shift']());}};_0x56a717(++_0x425f95);}(_0xfec6,0x138));var _0x6fec=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfec6[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x6fec('0x0'));var moment=require(_0x6fec('0x1'));module[_0x6fec('0x2')]={'name':{'type':Sequelize[_0x6fec('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x6fec('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x6fec('0x4')](_0x6fec('0x5'),_0x6fec('0x6'),_0x6fec('0x7')),'allowNull':![],'defaultValue':_0x6fec('0x5')},'savename':{'type':Sequelize[_0x6fec('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x6fec('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x6fec('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x6fec('0x4')](_0x6fec('0x9'),_0x6fec('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x6fec('0xb')](0xb)[_0x6fec('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x88a3=['ENUM','pdf','DATE','manual','scheduled','exports','STRING'];(function(_0x3ca6ef,_0x571897){var _0x51c58c=function(_0x3b95c7){while(--_0x3b95c7){_0x3ca6ef['push'](_0x3ca6ef['shift']());}};_0x51c58c(++_0x571897);}(_0x88a3,0x17f));var _0x388a=function(_0x25f805,_0x59caf3){_0x25f805=_0x25f805-0x0;var _0xf6628f=_0x88a3[_0x25f805];return _0xf6628f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x388a('0x0')]={'name':{'type':Sequelize[_0x388a('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x388a('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x388a('0x2')]('csv',_0x388a('0x3'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x388a('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x388a('0x4')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x388a('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x388a('0x2')](_0x388a('0x5'),_0x388a('0x6')),'allowNull':![],'defaultValue':_0x388a('0x5')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x388a('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 08dd43e..726258d 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 _0x5875=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','end','sendStatus','name','send','index','AnalyticExtractedReport','rawAttributes','type','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','params','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','format','%s.%s','html-pdf','rimraf','zip-dir','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3b7bca,_0x53fed9){var _0x3edf39=function(_0x53e5c1){while(--_0x53e5c1){_0x3b7bca['push'](_0x3b7bca['shift']());}};_0x3edf39(++_0x53fed9);}(_0x5875,0x16d));var _0x5587=function(_0xace2b2,_0x1b54ca){_0xace2b2=_0xace2b2-0x0;var _0x4c7854=_0x5875[_0xace2b2];return _0x4c7854;};'use strict';var pdf=require(_0x5587('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5587('0x1'));var zipdir=require(_0x5587('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5587('0x3'));var BPromise=require(_0x5587('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5587('0x5'));var sox=require(_0x5587('0x6'));var csv=require(_0x5587('0x7'));var ejs=require(_0x5587('0x8'));var fs=require('fs');var _=require(_0x5587('0x9'));var squel=require(_0x5587('0xa'));var crypto=require(_0x5587('0xb'));var jsforce=require(_0x5587('0xc'));var deskjs=require(_0x5587('0xd'));var toCsv=require(_0x5587('0x7'));var querystring=require(_0x5587('0xe'));var Papa=require('papaparse');var Redis=require(_0x5587('0xf'));var authService=require(_0x5587('0x10'));var qs=require(_0x5587('0x11'));var as=require(_0x5587('0x12'));var hardwareService=require(_0x5587('0x13'));var logger=require(_0x5587('0x14'))('api');var utils=require(_0x5587('0x15'));var config=require(_0x5587('0x16'));var db=require(_0x5587('0x17'))['db'];function respondWithStatusCode(_0x1cfae7,_0x2e7120){_0x2e7120=_0x2e7120||0xcc;return function(_0x134608){if(_0x134608){return _0x1cfae7['sendStatus'](_0x2e7120);}return _0x1cfae7[_0x5587('0x18')](_0x2e7120)['end']();};}function respondWithResult(_0x2f9930,_0x4a4d11){_0x4a4d11=_0x4a4d11||0xc8;return function(_0x3ffe31){if(_0x3ffe31){return _0x2f9930[_0x5587('0x18')](_0x4a4d11)[_0x5587('0x19')](_0x3ffe31);}};}function respondWithFilteredResult(_0x592e76,_0x33373f){return function(_0x3eba5e){if(_0x3eba5e){var _0x4fd222=_0x3eba5e['count'],_0x52966f=_0x33373f[_0x5587('0x1a')],_0x43d6ff=_0x33373f[_0x5587('0x1a')]+_0x33373f['limit'],_0x3ce054;if(_0x43d6ff>=_0x4fd222){_0x43d6ff=_0x4fd222;_0x3ce054=0xc8;}else{_0x3ce054=0xce;}_0x592e76[_0x5587('0x18')](_0x3ce054);return _0x592e76['set'](_0x5587('0x1b'),_0x52966f+'-'+_0x43d6ff+'/'+_0x4fd222)[_0x5587('0x19')](_0x3eba5e);}return null;};}function patchUpdates(_0x4c1cdd){return function(_0x2bb382){try{jsonpatch[_0x5587('0x1c')](_0x2bb382,_0x4c1cdd,!![]);}catch(_0x36e92c){return BPromise[_0x5587('0x1d')](_0x36e92c);}return _0x2bb382[_0x5587('0x1e')]();};}function saveUpdates(_0x5262f8,_0xa3d146){return function(_0x43d7d5){if(_0x43d7d5){return _0x43d7d5[_0x5587('0x1f')](_0x5262f8)[_0x5587('0x20')](function(_0x70a4a3){return _0x70a4a3;});}return null;};}function removeEntity(_0x1c98f8,_0x19f8bf){return function(_0x2d6adb){if(_0x2d6adb){return _0x2d6adb[_0x5587('0x21')]()[_0x5587('0x20')](function(){var _0x206f5d=_0x2d6adb[_0x5587('0x22')]({'plain':!![]});var _0x34010f=_0x5587('0x23');return db[_0x5587('0x24')][_0x5587('0x21')]({'where':{'type':_0x34010f,'resourceId':_0x206f5d['id']}})[_0x5587('0x20')](function(){return _0x2d6adb;});})['then'](function(){_0x1c98f8[_0x5587('0x18')](0xcc)[_0x5587('0x25')]();});}};}function handleEntityNotFound(_0x19c4cd,_0xdec845){return function(_0x360739){if(!_0x360739){_0x19c4cd[_0x5587('0x26')](0x194);}return _0x360739;};}function handleError(_0x5ab060,_0x3f0a5c){_0x3f0a5c=_0x3f0a5c||0x1f4;return function(_0x1dfa6a){logger['error'](_0x1dfa6a['stack']);if(_0x1dfa6a[_0x5587('0x27')]){delete _0x1dfa6a[_0x5587('0x27')];}_0x5ab060[_0x5587('0x18')](_0x3f0a5c)[_0x5587('0x28')](_0x1dfa6a);};}exports[_0x5587('0x29')]=function(_0x33712d,_0x46d983){var _0x30b4d6={},_0x4cf3e2={},_0x273e88={'count':0x0,'rows':[]};var _0x19664a=_['map'](db[_0x5587('0x2a')][_0x5587('0x2b')],function(_0x243450){return{'name':_0x243450['fieldName'],'type':_0x243450[_0x5587('0x2c')]['key']};});_0x4cf3e2[_0x5587('0x2d')]=_[_0x5587('0x2e')](_0x19664a,'name');_0x4cf3e2['query']=_[_0x5587('0x2f')](_0x33712d['query']);_0x4cf3e2[_0x5587('0x30')]=_['intersection'](_0x4cf3e2[_0x5587('0x2d')],_0x4cf3e2[_0x5587('0x31')]);_0x30b4d6[_0x5587('0x32')]=_[_0x5587('0x33')](_0x4cf3e2[_0x5587('0x2d')],qs[_0x5587('0x34')](_0x33712d[_0x5587('0x31')][_0x5587('0x34')]));_0x30b4d6['attributes']=_0x30b4d6[_0x5587('0x32')][_0x5587('0x35')]?_0x30b4d6[_0x5587('0x32')]:_0x4cf3e2[_0x5587('0x2d')];if(!_0x33712d[_0x5587('0x31')][_0x5587('0x36')](_0x5587('0x37'))){_0x30b4d6[_0x5587('0x38')]=qs[_0x5587('0x38')](_0x33712d['query']['limit']);_0x30b4d6[_0x5587('0x1a')]=qs['offset'](_0x33712d[_0x5587('0x31')][_0x5587('0x1a')]);}_0x30b4d6[_0x5587('0x39')]=qs['sort'](_0x33712d[_0x5587('0x31')][_0x5587('0x3a')]);_0x30b4d6[_0x5587('0x3b')]=qs[_0x5587('0x30')](_[_0x5587('0x3c')](_0x33712d[_0x5587('0x31')],_0x4cf3e2[_0x5587('0x30')]),_0x19664a);if(_0x33712d['query'][_0x5587('0x3d')]){_0x30b4d6[_0x5587('0x3b')]=_[_0x5587('0x3e')](_0x30b4d6[_0x5587('0x3b')],{'$or':_['map'](_0x19664a,function(_0x2a0220){if(_0x2a0220[_0x5587('0x2c')]!==_0x5587('0x3f')){var _0x4b821e={};_0x4b821e[_0x2a0220[_0x5587('0x27')]]={'$like':'%'+_0x33712d[_0x5587('0x31')][_0x5587('0x3d')]+'%'};return _0x4b821e;}})});}_0x30b4d6=_[_0x5587('0x3e')]({},_0x30b4d6,_0x33712d['options']);var _0xf3828d={'where':_0x30b4d6[_0x5587('0x3b')]};return db[_0x5587('0x2a')][_0x5587('0x40')](_0xf3828d)[_0x5587('0x20')](function(_0x30d3f4){_0x273e88[_0x5587('0x40')]=_0x30d3f4;if(_0x33712d[_0x5587('0x31')][_0x5587('0x41')]){_0x30b4d6[_0x5587('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x5587('0x43')](_0x30b4d6);})['then'](function(_0x1a59d0){_0x273e88[_0x5587('0x44')]=_0x1a59d0;return _0x273e88;})['then'](respondWithFilteredResult(_0x46d983,_0x30b4d6))[_0x5587('0x45')](handleError(_0x46d983,null));};exports[_0x5587('0x46')]=function(_0x4fc4e9,_0x55361e){var _0x3952d6={'raw':!![],'where':{'id':_0x4fc4e9['params']['id']}},_0x18f325={};_0x18f325[_0x5587('0x2d')]=_[_0x5587('0x2f')](db[_0x5587('0x2a')][_0x5587('0x2b')]);_0x18f325[_0x5587('0x31')]=_[_0x5587('0x2f')](_0x4fc4e9[_0x5587('0x31')]);_0x18f325[_0x5587('0x30')]=_[_0x5587('0x33')](_0x18f325[_0x5587('0x2d')],_0x18f325[_0x5587('0x31')]);_0x3952d6['attributes']=_['intersection'](_0x18f325[_0x5587('0x2d')],qs[_0x5587('0x34')](_0x4fc4e9[_0x5587('0x31')]['fields']));_0x3952d6['attributes']=_0x3952d6['attributes'][_0x5587('0x35')]?_0x3952d6['attributes']:_0x18f325[_0x5587('0x2d')];if(_0x4fc4e9[_0x5587('0x31')]['includeAll']){_0x3952d6[_0x5587('0x42')]=[{'all':!![]}];}_0x3952d6=_[_0x5587('0x3e')]({},_0x3952d6,_0x4fc4e9[_0x5587('0x47')]);return db[_0x5587('0x2a')][_0x5587('0x48')](_0x3952d6)[_0x5587('0x20')](handleEntityNotFound(_0x55361e,null))[_0x5587('0x20')](respondWithResult(_0x55361e,null))['catch'](handleError(_0x55361e,null));};exports[_0x5587('0x49')]=function(_0x3a1ce2,_0x5a2b4){return db['AnalyticExtractedReport'][_0x5587('0x49')](_0x3a1ce2[_0x5587('0x4a')],{})[_0x5587('0x20')](function(_0x4cbd48){var _0x40f4f9=_0x3a1ce2[_0x5587('0x4b')][_0x5587('0x22')]({'plain':!![]});if(!_0x40f4f9)throw new Error(_0x5587('0x4c'));if(_0x40f4f9[_0x5587('0x4d')]===_0x5587('0x4b')){var _0x2c0d32=_0x4cbd48[_0x5587('0x22')]({'plain':!![]});var _0x57d8bd=_0x5587('0x23');return db[_0x5587('0x4e')]['find']({'where':{'name':_0x57d8bd,'userProfileId':_0x40f4f9[_0x5587('0x4f')]},'raw':!![]})[_0x5587('0x20')](function(_0x4c573f){if(_0x4c573f&&_0x4c573f['autoAssociation']===0x0){return db['UserProfileResource'][_0x5587('0x49')]({'name':_0x2c0d32[_0x5587('0x27')],'resourceId':_0x2c0d32['id'],'type':_0x4c573f['name'],'sectionId':_0x4c573f['id']},{})[_0x5587('0x20')](function(){return _0x4cbd48;});}else{return _0x4cbd48;}})[_0x5587('0x45')](function(_0x3821b){logger[_0x5587('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3821b);throw _0x3821b;});}return _0x4cbd48;})[_0x5587('0x20')](respondWithResult(_0x5a2b4,0xc9))['catch'](handleError(_0x5a2b4,null));};exports[_0x5587('0x1f')]=function(_0x4be487,_0x5ecdaf){if(_0x4be487[_0x5587('0x4a')]['id']){delete _0x4be487[_0x5587('0x4a')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4be487[_0x5587('0x51')]['id']}})[_0x5587('0x20')](handleEntityNotFound(_0x5ecdaf,null))[_0x5587('0x20')](saveUpdates(_0x4be487[_0x5587('0x4a')],null))[_0x5587('0x20')](respondWithResult(_0x5ecdaf,null))['catch'](handleError(_0x5ecdaf,null));};exports[_0x5587('0x21')]=function(_0x192ecd,_0x4839b2){return db[_0x5587('0x2a')][_0x5587('0x48')]({'where':{'id':_0x192ecd['params']['id']}})['then'](handleEntityNotFound(_0x4839b2,null))[_0x5587('0x20')](removeEntity(_0x4839b2,null))[_0x5587('0x45')](handleError(_0x4839b2,null));};exports[_0x5587('0x52')]=function(_0x6c20c3,_0xeac94,_0xed2682){return db[_0x5587('0x2a')][_0x5587('0x48')]({'where':{'id':_0x6c20c3['params']['id']},'attributes':[_0x5587('0x27'),_0x5587('0x53'),_0x5587('0x54'),_0x5587('0x55')],'raw':!![]})[_0x5587('0x20')](handleEntityNotFound(_0xeac94,null))[_0x5587('0x20')](function(_0x183988){if(_0x183988){if(!fs[_0x5587('0x56')](path[_0x5587('0x57')](config[_0x5587('0x58')],_0x5587('0x59'),_0x183988[_0x5587('0x54')]))){throw new db[(_0x5587('0x5a'))][(_0x5587('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x6c20c3[_0x5587('0x31')][_0x5587('0x5c')]){return _0xeac94[_0x5587('0x26')](0xc8);}return _0xeac94[_0x5587('0x52')](path[_0x5587('0x57')](config['root'],_0x5587('0x59'),_0x183988[_0x5587('0x54')]),util[_0x5587('0x5d')](_0x5587('0x5e'),_0x183988['basename']||_0x183988[_0x5587('0x27')],_0x183988[_0x5587('0x55')]['toLowerCase']()));}})['catch'](handleError(_0xeac94,null));}; \ No newline at end of file +var _0xdf1e=['request-promise','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','apply','reject','then','destroy','get','ExtractedReports','end','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','output','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0xdf1e,0x154));var _0xedf1=function(_0x48aabe,_0x1d3ad3){_0x48aabe=_0x48aabe-0x0;var _0x174865=_0xdf1e[_0x48aabe];return _0x174865;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xedf1('0x0'));var rimraf=require(_0xedf1('0x1'));var zipdir=require(_0xedf1('0x2'));var jsonpatch=require(_0xedf1('0x3'));var rp=require(_0xedf1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xedf1('0x5'));var path=require(_0xedf1('0x6'));var sox=require(_0xedf1('0x7'));var csv=require(_0xedf1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xedf1('0x9'));var squel=require('squel');var crypto=require(_0xedf1('0xa'));var jsforce=require(_0xedf1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xedf1('0x8'));var querystring=require(_0xedf1('0xc'));var Papa=require(_0xedf1('0xd'));var Redis=require('ioredis');var authService=require(_0xedf1('0xe'));var qs=require(_0xedf1('0xf'));var as=require(_0xedf1('0x10'));var hardwareService=require(_0xedf1('0x11'));var logger=require(_0xedf1('0x12'))('api');var utils=require(_0xedf1('0x13'));var config=require(_0xedf1('0x14'));var db=require(_0xedf1('0x15'))['db'];function respondWithStatusCode(_0x36c130,_0x1fb0ec){_0x1fb0ec=_0x1fb0ec||0xcc;return function(_0x56ee29){if(_0x56ee29){return _0x36c130[_0xedf1('0x16')](_0x1fb0ec);}return _0x36c130[_0xedf1('0x17')](_0x1fb0ec)['end']();};}function respondWithResult(_0x550a48,_0xd45e6e){_0xd45e6e=_0xd45e6e||0xc8;return function(_0x331e83){if(_0x331e83){return _0x550a48[_0xedf1('0x17')](_0xd45e6e)['json'](_0x331e83);}};}function respondWithFilteredResult(_0x44632f,_0x50fd06){return function(_0x1f9a9a){if(_0x1f9a9a){var _0x241c19=_0x1f9a9a[_0xedf1('0x18')],_0x1dcd68=_0x50fd06[_0xedf1('0x19')],_0x184e6d=_0x50fd06[_0xedf1('0x19')]+_0x50fd06[_0xedf1('0x1a')],_0xada7d4;if(_0x184e6d>=_0x241c19){_0x184e6d=_0x241c19;_0xada7d4=0xc8;}else{_0xada7d4=0xce;}_0x44632f['status'](_0xada7d4);return _0x44632f[_0xedf1('0x1b')]('Content-Range',_0x1dcd68+'-'+_0x184e6d+'/'+_0x241c19)['json'](_0x1f9a9a);}return null;};}function patchUpdates(_0xf0812f){return function(_0x237ddf){try{jsonpatch[_0xedf1('0x1c')](_0x237ddf,_0xf0812f,!![]);}catch(_0x21092a){return BPromise[_0xedf1('0x1d')](_0x21092a);}return _0x237ddf['save']();};}function saveUpdates(_0x1026da,_0x41ebd5){return function(_0x122982){if(_0x122982){return _0x122982['update'](_0x1026da)[_0xedf1('0x1e')](function(_0xe8b02c){return _0xe8b02c;});}return null;};}function removeEntity(_0x4ef19f,_0x4c6b0d){return function(_0x40d347){if(_0x40d347){return _0x40d347[_0xedf1('0x1f')]()[_0xedf1('0x1e')](function(){var _0x9be4ae=_0x40d347[_0xedf1('0x20')]({'plain':!![]});var _0x1b9a73=_0xedf1('0x21');return db['UserProfileResource'][_0xedf1('0x1f')]({'where':{'type':_0x1b9a73,'resourceId':_0x9be4ae['id']}})[_0xedf1('0x1e')](function(){return _0x40d347;});})[_0xedf1('0x1e')](function(){_0x4ef19f['status'](0xcc)[_0xedf1('0x22')]();});}};}function handleEntityNotFound(_0x5b057b,_0x4b0868){return function(_0xf7f66){if(!_0xf7f66){_0x5b057b[_0xedf1('0x16')](0x194);}return _0xf7f66;};}function handleError(_0x20e2e9,_0x2cada7){_0x2cada7=_0x2cada7||0x1f4;return function(_0x52c350){logger[_0xedf1('0x23')](_0x52c350[_0xedf1('0x24')]);if(_0x52c350[_0xedf1('0x25')]){delete _0x52c350[_0xedf1('0x25')];}_0x20e2e9[_0xedf1('0x17')](_0x2cada7)[_0xedf1('0x26')](_0x52c350);};}exports[_0xedf1('0x27')]=function(_0x452469,_0x23ee2f){var _0x4fd742={},_0x96ca00={},_0x556d3c={'count':0x0,'rows':[]};var _0x30d368=_[_0xedf1('0x28')](db[_0xedf1('0x29')][_0xedf1('0x2a')],function(_0x178a1b){return{'name':_0x178a1b[_0xedf1('0x2b')],'type':_0x178a1b[_0xedf1('0x2c')][_0xedf1('0x2d')]};});_0x96ca00[_0xedf1('0x2e')]=_[_0xedf1('0x28')](_0x30d368,_0xedf1('0x25'));_0x96ca00['query']=_[_0xedf1('0x2f')](_0x452469[_0xedf1('0x30')]);_0x96ca00['filters']=_[_0xedf1('0x31')](_0x96ca00['model'],_0x96ca00['query']);_0x4fd742[_0xedf1('0x32')]=_[_0xedf1('0x31')](_0x96ca00['model'],qs[_0xedf1('0x33')](_0x452469[_0xedf1('0x30')]['fields']));_0x4fd742[_0xedf1('0x32')]=_0x4fd742['attributes'][_0xedf1('0x34')]?_0x4fd742[_0xedf1('0x32')]:_0x96ca00[_0xedf1('0x2e')];if(!_0x452469['query'][_0xedf1('0x35')](_0xedf1('0x36'))){_0x4fd742[_0xedf1('0x1a')]=qs[_0xedf1('0x1a')](_0x452469['query'][_0xedf1('0x1a')]);_0x4fd742['offset']=qs[_0xedf1('0x19')](_0x452469['query'][_0xedf1('0x19')]);}_0x4fd742[_0xedf1('0x37')]=qs['sort'](_0x452469[_0xedf1('0x30')][_0xedf1('0x38')]);_0x4fd742['where']=qs[_0xedf1('0x39')](_['pick'](_0x452469[_0xedf1('0x30')],_0x96ca00[_0xedf1('0x39')]),_0x30d368);if(_0x452469[_0xedf1('0x30')]['filter']){_0x4fd742[_0xedf1('0x3a')]=_[_0xedf1('0x3b')](_0x4fd742[_0xedf1('0x3a')],{'$or':_[_0xedf1('0x28')](_0x30d368,function(_0x259c4d){if(_0x259c4d[_0xedf1('0x2c')]!==_0xedf1('0x3c')){var _0x2b0771={};_0x2b0771[_0x259c4d[_0xedf1('0x25')]]={'$like':'%'+_0x452469[_0xedf1('0x30')][_0xedf1('0x3d')]+'%'};return _0x2b0771;}})});}_0x4fd742=_['merge']({},_0x4fd742,_0x452469[_0xedf1('0x3e')]);var _0x824481={'where':_0x4fd742[_0xedf1('0x3a')]};return db[_0xedf1('0x29')][_0xedf1('0x18')](_0x824481)[_0xedf1('0x1e')](function(_0x41ea32){_0x556d3c[_0xedf1('0x18')]=_0x41ea32;if(_0x452469['query'][_0xedf1('0x3f')]){_0x4fd742['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xedf1('0x40')](_0x4fd742);})[_0xedf1('0x1e')](function(_0x11924c){_0x556d3c[_0xedf1('0x41')]=_0x11924c;return _0x556d3c;})[_0xedf1('0x1e')](respondWithFilteredResult(_0x23ee2f,_0x4fd742))[_0xedf1('0x42')](handleError(_0x23ee2f,null));};exports['show']=function(_0x2ec2f8,_0x363987){var _0x4bfecb={'raw':!![],'where':{'id':_0x2ec2f8[_0xedf1('0x43')]['id']}},_0x3eec93={};_0x3eec93['model']=_[_0xedf1('0x2f')](db[_0xedf1('0x29')][_0xedf1('0x2a')]);_0x3eec93[_0xedf1('0x30')]=_[_0xedf1('0x2f')](_0x2ec2f8[_0xedf1('0x30')]);_0x3eec93['filters']=_[_0xedf1('0x31')](_0x3eec93[_0xedf1('0x2e')],_0x3eec93[_0xedf1('0x30')]);_0x4bfecb[_0xedf1('0x32')]=_[_0xedf1('0x31')](_0x3eec93[_0xedf1('0x2e')],qs[_0xedf1('0x33')](_0x2ec2f8[_0xedf1('0x30')][_0xedf1('0x33')]));_0x4bfecb[_0xedf1('0x32')]=_0x4bfecb['attributes'][_0xedf1('0x34')]?_0x4bfecb[_0xedf1('0x32')]:_0x3eec93[_0xedf1('0x2e')];if(_0x2ec2f8['query'][_0xedf1('0x3f')]){_0x4bfecb[_0xedf1('0x44')]=[{'all':!![]}];}_0x4bfecb=_[_0xedf1('0x3b')]({},_0x4bfecb,_0x2ec2f8[_0xedf1('0x3e')]);return db[_0xedf1('0x29')][_0xedf1('0x45')](_0x4bfecb)[_0xedf1('0x1e')](handleEntityNotFound(_0x363987,null))[_0xedf1('0x1e')](respondWithResult(_0x363987,null))['catch'](handleError(_0x363987,null));};exports['create']=function(_0x1b5b7b,_0x50cde9){return db['AnalyticExtractedReport'][_0xedf1('0x46')](_0x1b5b7b[_0xedf1('0x47')],{})['then'](function(_0x72c7e9){var _0x286b71=_0x1b5b7b[_0xedf1('0x48')]['get']({'plain':!![]});if(!_0x286b71)throw new Error(_0xedf1('0x49'));if(_0x286b71['role']===_0xedf1('0x48')){var _0x407af8=_0x72c7e9['get']({'plain':!![]});var _0x3419d8=_0xedf1('0x21');return db['UserProfileSection'][_0xedf1('0x45')]({'where':{'name':_0x3419d8,'userProfileId':_0x286b71[_0xedf1('0x4a')]},'raw':!![]})[_0xedf1('0x1e')](function(_0x2f8b28){if(_0x2f8b28&&_0x2f8b28['autoAssociation']===0x0){return db[_0xedf1('0x4b')][_0xedf1('0x46')]({'name':_0x407af8['name'],'resourceId':_0x407af8['id'],'type':_0x2f8b28[_0xedf1('0x25')],'sectionId':_0x2f8b28['id']},{})[_0xedf1('0x1e')](function(){return _0x72c7e9;});}else{return _0x72c7e9;}})[_0xedf1('0x42')](function(_0x21e078){logger[_0xedf1('0x23')](_0xedf1('0x4c'),_0x21e078);throw _0x21e078;});}return _0x72c7e9;})[_0xedf1('0x1e')](respondWithResult(_0x50cde9,0xc9))['catch'](handleError(_0x50cde9,null));};exports['update']=function(_0x33abca,_0x136614){if(_0x33abca[_0xedf1('0x47')]['id']){delete _0x33abca['body']['id'];}return db[_0xedf1('0x29')][_0xedf1('0x45')]({'where':{'id':_0x33abca[_0xedf1('0x43')]['id']}})[_0xedf1('0x1e')](handleEntityNotFound(_0x136614,null))[_0xedf1('0x1e')](saveUpdates(_0x33abca[_0xedf1('0x47')],null))['then'](respondWithResult(_0x136614,null))[_0xedf1('0x42')](handleError(_0x136614,null));};exports[_0xedf1('0x1f')]=function(_0x3b7f7c,_0x22177d){return db[_0xedf1('0x29')][_0xedf1('0x45')]({'where':{'id':_0x3b7f7c[_0xedf1('0x43')]['id']}})[_0xedf1('0x1e')](handleEntityNotFound(_0x22177d,null))[_0xedf1('0x1e')](removeEntity(_0x22177d,null))[_0xedf1('0x42')](handleError(_0x22177d,null));};exports[_0xedf1('0x4d')]=function(_0x408eda,_0x212cff,_0x3a67e9){return db[_0xedf1('0x29')][_0xedf1('0x45')]({'where':{'id':_0x408eda[_0xedf1('0x43')]['id']},'attributes':[_0xedf1('0x25'),'basename','savename',_0xedf1('0x4e')],'raw':!![]})[_0xedf1('0x1e')](handleEntityNotFound(_0x212cff,null))[_0xedf1('0x1e')](function(_0x38bf08){if(_0x38bf08){if(!fs[_0xedf1('0x4f')](path['join'](config[_0xedf1('0x50')],_0xedf1('0x51'),_0x38bf08['savename']))){throw new db['Sequelize'][(_0xedf1('0x52'))](_0xedf1('0x53'));}if(_0x408eda[_0xedf1('0x30')]['exists']){return _0x212cff[_0xedf1('0x16')](0xc8);}return _0x212cff[_0xedf1('0x4d')](path['join'](config[_0xedf1('0x50')],'server/files/reports',_0x38bf08['savename']),util['format']('%s.%s',_0x38bf08[_0xedf1('0x54')]||_0x38bf08[_0xedf1('0x25')],_0x38bf08[_0xedf1('0x4e')][_0xedf1('0x55')]()));}})['catch'](handleError(_0x212cff,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 55a81ee..69a2152 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 _0xe2a3=['rimraf','../../config/environment','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5cf70e,_0x5c75b6){var _0x2dcd16=function(_0x53d93b){while(--_0x53d93b){_0x5cf70e['push'](_0x5cf70e['shift']());}};_0x2dcd16(++_0x5c75b6);}(_0xe2a3,0xd1));var _0x3e2a=function(_0x2d0794,_0x4215e2){_0x2d0794=_0x2d0794-0x0;var _0x5ced85=_0xe2a3[_0x2d0794];return _0x5ced85;};'use strict';var _=require(_0x3e2a('0x0'));var util=require(_0x3e2a('0x1'));var logger=require(_0x3e2a('0x2'))(_0x3e2a('0x3'));var moment=require(_0x3e2a('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e2a('0x5'));var fs=require('fs');var path=require(_0x3e2a('0x6'));var rimraf=require(_0x3e2a('0x7'));var config=require(_0x3e2a('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0x3e2a('0x9')]=function(_0x18b343,_0x490d3f){return _0x18b343[_0x3e2a('0xa')](_0x3e2a('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2c4=['request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','moment','bluebird'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xb2c4,0x104));var _0x4b2c=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0xb2c4[_0x339129];return _0x1570df;};'use strict';var _=require(_0x4b2c('0x0'));var util=require(_0x4b2c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4b2c('0x2'));var BPromise=require(_0x4b2c('0x3'));var rp=require(_0x4b2c('0x4'));var fs=require('fs');var path=require(_0x4b2c('0x5'));var rimraf=require('rimraf');var config=require(_0x4b2c('0x6'));var attributes=require(_0x4b2c('0x7'));module[_0x4b2c('0x8')]=function(_0x1e6bad,_0x398b0e){return _0x1e6bad[_0x4b2c('0x9')](_0x4b2c('0xa'),attributes,{'tableName':_0x4b2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index c649428..4a3abfb 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 _0x32df=['code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x59a4d7,_0x4b0ee9){var _0x1c4b1b=function(_0x45de37){while(--_0x45de37){_0x59a4d7['push'](_0x59a4d7['shift']());}};_0x1c4b1b(++_0x4b0ee9);}(_0x32df,0x1d0));var _0xf32d=function(_0x447dc6,_0x4e29c8){_0x447dc6=_0x447dc6-0x0;var _0x36f1ae=_0x32df[_0x447dc6];return _0x36f1ae;};'use strict';var _=require('lodash');var util=require(_0xf32d('0x0'));var moment=require(_0xf32d('0x1'));var BPromise=require(_0xf32d('0x2'));var rs=require(_0xf32d('0x3'));var fs=require('fs');var Redis=require(_0xf32d('0x4'));var db=require(_0xf32d('0x5'))['db'];var utils=require(_0xf32d('0x6'));var logger=require(_0xf32d('0x7'))(_0xf32d('0x8'));var config=require(_0xf32d('0x9'));var jayson=require(_0xf32d('0xa'));var client=jayson['client'][_0xf32d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x348ce9,_0x5ebc48,_0x1991bb){return new BPromise(function(_0x21f90e,_0xbf4d2e){return client[_0xf32d('0xc')](_0x348ce9,_0x1991bb)['then'](function(_0x63bc0d){logger[_0xf32d('0xd')](_0xf32d('0xe'),_0x5ebc48,_0xf32d('0xf'));logger['debug'](_0xf32d('0x10'),_0x5ebc48,_0xf32d('0xf'),JSON[_0xf32d('0x11')](_0x63bc0d));if(_0x63bc0d[_0xf32d('0x12')]){if(_0x63bc0d['error'][_0xf32d('0x13')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5ebc48,_0x63bc0d[_0xf32d('0x12')]['message']);return _0xbf4d2e(_0x63bc0d[_0xf32d('0x12')][_0xf32d('0x14')]);}logger[_0xf32d('0x12')](_0xf32d('0xe'),_0x5ebc48,_0x63bc0d[_0xf32d('0x12')][_0xf32d('0x14')]);return _0x21f90e(_0x63bc0d[_0xf32d('0x12')]['message']);}else{logger[_0xf32d('0xd')](_0xf32d('0xe'),_0x5ebc48,'request\x20sent');_0x21f90e(_0x63bc0d['result'][_0xf32d('0x14')]);}})['catch'](function(_0x10f944){logger[_0xf32d('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5ebc48,_0x10f944);_0xbf4d2e(_0x10f944);});});} \ No newline at end of file +var _0x4763=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x145067,_0x3bcadb){var _0x2b4929=function(_0x4dac72){while(--_0x4dac72){_0x145067['push'](_0x145067['shift']());}};_0x2b4929(++_0x3bcadb);}(_0x4763,0xb9));var _0x3476=function(_0x161a36,_0x338da9){_0x161a36=_0x161a36-0x0;var _0x21ceea=_0x4763[_0x161a36];return _0x21ceea;};'use strict';var _=require(_0x3476('0x0'));var util=require(_0x3476('0x1'));var moment=require(_0x3476('0x2'));var BPromise=require(_0x3476('0x3'));var rs=require(_0x3476('0x4'));var fs=require('fs');var Redis=require(_0x3476('0x5'));var db=require(_0x3476('0x6'))['db'];var utils=require(_0x3476('0x7'));var logger=require(_0x3476('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3476('0x9'));var client=jayson[_0x3476('0xa')][_0x3476('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x592a62,_0x8a069a,_0x4fec5a){return new BPromise(function(_0x102f7b,_0x453c34){return client[_0x3476('0xc')](_0x592a62,_0x4fec5a)[_0x3476('0xd')](function(_0x190c88){logger[_0x3476('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x8a069a,_0x3476('0xf'));logger['debug'](_0x3476('0x10'),_0x8a069a,_0x3476('0xf'),JSON[_0x3476('0x11')](_0x190c88));if(_0x190c88[_0x3476('0x12')]){if(_0x190c88[_0x3476('0x12')][_0x3476('0x13')]===0x1f4){logger[_0x3476('0x12')](_0x3476('0x14'),_0x8a069a,_0x190c88[_0x3476('0x12')][_0x3476('0x15')]);return _0x453c34(_0x190c88[_0x3476('0x12')][_0x3476('0x15')]);}logger[_0x3476('0x12')](_0x3476('0x14'),_0x8a069a,_0x190c88[_0x3476('0x12')][_0x3476('0x15')]);return _0x102f7b(_0x190c88[_0x3476('0x12')][_0x3476('0x15')]);}else{logger['info'](_0x3476('0x14'),_0x8a069a,_0x3476('0xf'));_0x102f7b(_0x190c88[_0x3476('0x16')][_0x3476('0x15')]);}})[_0x3476('0x17')](function(_0x155769){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x8a069a,_0x155769);_0x453c34(_0x155769);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 9299795..1a31216 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 _0xd7a4=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','/:id/download','download','create','put','update','delete','destroy'];(function(_0x2981bb,_0x279cdf){var _0x5137f4=function(_0x52929e){while(--_0x52929e){_0x2981bb['push'](_0x2981bb['shift']());}};_0x5137f4(++_0x279cdf);}(_0xd7a4,0x11f));var _0x4d7a=function(_0x11c2b9,_0x2ae165){_0x11c2b9=_0x11c2b9-0x0;var _0x4471c3=_0xd7a4[_0x11c2b9];return _0x4471c3;};'use strict';var multer=require(_0x4d7a('0x0'));var util=require(_0x4d7a('0x1'));var path=require(_0x4d7a('0x2'));var timeout=require(_0x4d7a('0x3'));var express=require(_0x4d7a('0x4'));var router=express[_0x4d7a('0x5')]();var auth=require(_0x4d7a('0x6'));var interaction=require(_0x4d7a('0x7'));var config=require(_0x4d7a('0x8'));var controller=require(_0x4d7a('0x9'));router['get']('/',auth[_0x4d7a('0xa')](),controller[_0x4d7a('0xb')]);router[_0x4d7a('0xc')](_0x4d7a('0xd'),auth[_0x4d7a('0xa')](),controller['show']);router[_0x4d7a('0xc')](_0x4d7a('0xe'),auth[_0x4d7a('0xa')](),controller[_0x4d7a('0xf')]);router['post']('/',auth[_0x4d7a('0xa')](),controller[_0x4d7a('0x10')]);router[_0x4d7a('0x11')](_0x4d7a('0xd'),auth[_0x4d7a('0xa')](),controller[_0x4d7a('0x12')]);router[_0x4d7a('0x13')](_0x4d7a('0xd'),auth['isAuthenticated'](),controller[_0x4d7a('0x14')]);module[_0x4d7a('0x15')]=router; \ No newline at end of file +var _0x750a=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy'];(function(_0x11d4f8,_0x35ebc7){var _0x4f349f=function(_0x43fdc8){while(--_0x43fdc8){_0x11d4f8['push'](_0x11d4f8['shift']());}};_0x4f349f(++_0x35ebc7);}(_0x750a,0x140));var _0xa750=function(_0x2f1477,_0x4857be){_0x2f1477=_0x2f1477-0x0;var _0x5ada87=_0x750a[_0x2f1477];return _0x5ada87;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var auth=require(_0xa750('0x3'));var interaction=require(_0xa750('0x4'));var config=require(_0xa750('0x5'));var controller=require(_0xa750('0x6'));router[_0xa750('0x7')]('/',auth[_0xa750('0x8')](),controller[_0xa750('0x9')]);router[_0xa750('0x7')](_0xa750('0xa'),auth[_0xa750('0x8')](),controller[_0xa750('0xb')]);router['get']('/:id/download',auth[_0xa750('0x8')](),controller['download']);router[_0xa750('0xc')]('/',auth[_0xa750('0x8')](),controller['create']);router[_0xa750('0xd')](_0xa750('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xa750('0xe')]('/:id',auth[_0xa750('0x8')](),controller[_0xa750('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 0a2ca8d..ea3bd9a 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 _0x326f=['STRING','BOOLEAN','sequelize'];(function(_0x24b8ec,_0x3c8c5b){var _0x1d1b63=function(_0x316c98){while(--_0x316c98){_0x24b8ec['push'](_0x24b8ec['shift']());}};_0x1d1b63(++_0x3c8c5b);}(_0x326f,0xd1));var _0xf326=function(_0x8454bb,_0x59b283){_0x8454bb=_0x8454bb-0x0;var _0x445f0d=_0x326f[_0x8454bb];return _0x445f0d;};'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 +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5f547a,_0x373527){var _0x412ad0=function(_0x28d9af){while(--_0x28d9af){_0x5f547a['push'](_0x5f547a['shift']());}};_0x412ad0(++_0x373527);}(_0x5fc3,0xa8));var _0x35fc=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0x5fc3[_0xa4c85];return _0x172c1f;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index c40234c..33c7d95 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 _0x9485=['status','end','json','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','limit','offset','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','AnalyticFieldReport','findAll','catch','show','params','fields','find','create','body','bulkCreate','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x5df59d,_0x56c539){var _0x125935=function(_0xb1060d){while(--_0xb1060d){_0x5df59d['push'](_0x5df59d['shift']());}};_0x125935(++_0x56c539);}(_0x9485,0x8b));var _0x5948=function(_0x3cb71e,_0x121dd1){_0x3cb71e=_0x3cb71e-0x0;var _0x401a11=_0x9485[_0x3cb71e];return _0x401a11;};'use strict';var pdf=require(_0x5948('0x0'));var emlformat=require(_0x5948('0x1'));var rimraf=require(_0x5948('0x2'));var zipdir=require(_0x5948('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5948('0x4'));var moment=require(_0x5948('0x5'));var BPromise=require(_0x5948('0x6'));var Mustache=require('mustache');var util=require(_0x5948('0x7'));var path=require(_0x5948('0x8'));var sox=require(_0x5948('0x9'));var csv=require(_0x5948('0xa'));var ejs=require(_0x5948('0xb'));var fs=require('fs');var _=require(_0x5948('0xc'));var squel=require('squel');var crypto=require(_0x5948('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5948('0xe'));var toCsv=require(_0x5948('0xa'));var querystring=require('querystring');var Papa=require(_0x5948('0xf'));var Redis=require(_0x5948('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5948('0x11'));var as=require(_0x5948('0x12'));var hardwareService=require(_0x5948('0x13'));var logger=require(_0x5948('0x14'))(_0x5948('0x15'));var utils=require(_0x5948('0x16'));var config=require(_0x5948('0x17'));var db=require(_0x5948('0x18'))['db'];function respondWithStatusCode(_0x233d7e,_0x35af62){_0x35af62=_0x35af62||0xcc;return function(_0x3070f5){if(_0x3070f5){return _0x233d7e['sendStatus'](_0x35af62);}return _0x233d7e[_0x5948('0x19')](_0x35af62)[_0x5948('0x1a')]();};}function respondWithResult(_0x1028a6,_0x23a656){_0x23a656=_0x23a656||0xc8;return function(_0xe55911){if(_0xe55911){return _0x1028a6[_0x5948('0x19')](_0x23a656)[_0x5948('0x1b')](_0xe55911);}};}function respondWithFilteredResult(_0x36fd89,_0x4691fc){return function(_0x3565df){if(_0x3565df){var _0x281324=_0x3565df[_0x5948('0x1c')],_0x203968=_0x4691fc['offset'],_0x1cc566=_0x4691fc['offset']+_0x4691fc['limit'],_0xf46ff8;if(_0x1cc566>=_0x281324){_0x1cc566=_0x281324;_0xf46ff8=0xc8;}else{_0xf46ff8=0xce;}_0x36fd89[_0x5948('0x19')](_0xf46ff8);return _0x36fd89[_0x5948('0x1d')](_0x5948('0x1e'),_0x203968+'-'+_0x1cc566+'/'+_0x281324)[_0x5948('0x1b')](_0x3565df);}return null;};}function patchUpdates(_0x22cc28){return function(_0x1957d3){try{jsonpatch['apply'](_0x1957d3,_0x22cc28,!![]);}catch(_0xacffa2){return BPromise[_0x5948('0x1f')](_0xacffa2);}return _0x1957d3[_0x5948('0x20')]();};}function saveUpdates(_0x392397,_0x4a4edf){return function(_0x40410c){if(_0x40410c){return _0x40410c[_0x5948('0x21')](_0x392397)[_0x5948('0x22')](function(_0x7a4ed5){return _0x7a4ed5;});}return null;};}function removeEntity(_0x38925e,_0x416e76){return function(_0x31110a){if(_0x31110a){return _0x31110a[_0x5948('0x23')]()[_0x5948('0x22')](function(){_0x38925e[_0x5948('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f2571,_0x5e0f16){return function(_0x255228){if(!_0x255228){_0x1f2571[_0x5948('0x24')](0x194);}return _0x255228;};}function handleError(_0x47374f,_0x2cd86e){_0x2cd86e=_0x2cd86e||0x1f4;return function(_0x385821){logger[_0x5948('0x25')](_0x385821[_0x5948('0x26')]);if(_0x385821[_0x5948('0x27')]){delete _0x385821['name'];}_0x47374f['status'](_0x2cd86e)['send'](_0x385821);};}exports[_0x5948('0x28')]=function(_0x37b4aa,_0xe4629a){var _0x499c35={},_0x4a9630={},_0x45d99b={'count':0x0,'rows':[]};var _0x47b55e=_[_0x5948('0x29')](db['AnalyticFieldReport'][_0x5948('0x2a')],function(_0x2d1f6c){return{'name':_0x2d1f6c[_0x5948('0x2b')],'type':_0x2d1f6c[_0x5948('0x2c')][_0x5948('0x2d')]};});_0x4a9630[_0x5948('0x2e')]=_['map'](_0x47b55e,'name');_0x4a9630[_0x5948('0x2f')]=_[_0x5948('0x30')](_0x37b4aa['query']);_0x4a9630['filters']=_['intersection'](_0x4a9630[_0x5948('0x2e')],_0x4a9630[_0x5948('0x2f')]);_0x499c35[_0x5948('0x31')]=_[_0x5948('0x32')](_0x4a9630['model'],qs['fields'](_0x37b4aa[_0x5948('0x2f')]['fields']));_0x499c35[_0x5948('0x31')]=_0x499c35['attributes'][_0x5948('0x33')]?_0x499c35[_0x5948('0x31')]:_0x4a9630[_0x5948('0x2e')];if(!_0x37b4aa[_0x5948('0x2f')][_0x5948('0x34')](_0x5948('0x35'))){_0x499c35[_0x5948('0x36')]=qs[_0x5948('0x36')](_0x37b4aa[_0x5948('0x2f')][_0x5948('0x36')]);_0x499c35['offset']=qs[_0x5948('0x37')](_0x37b4aa[_0x5948('0x2f')]['offset']);}_0x499c35[_0x5948('0x38')]=qs['sort'](_0x37b4aa[_0x5948('0x2f')][_0x5948('0x39')]);_0x499c35['where']=qs[_0x5948('0x3a')](_['pick'](_0x37b4aa[_0x5948('0x2f')],_0x4a9630[_0x5948('0x3a')]),_0x47b55e);if(_0x37b4aa[_0x5948('0x2f')][_0x5948('0x3b')]){_0x499c35[_0x5948('0x3c')]=_[_0x5948('0x3d')](_0x499c35[_0x5948('0x3c')],{'$or':_[_0x5948('0x29')](_0x47b55e,function(_0x444882){if(_0x444882[_0x5948('0x2c')]!==_0x5948('0x3e')){var _0x5328ea={};_0x5328ea[_0x444882['name']]={'$like':'%'+_0x37b4aa['query']['filter']+'%'};return _0x5328ea;}})});}_0x499c35=_['merge']({},_0x499c35,_0x37b4aa[_0x5948('0x3f')]);var _0x26e175={'where':_0x499c35[_0x5948('0x3c')]};return db['AnalyticFieldReport'][_0x5948('0x1c')](_0x26e175)[_0x5948('0x22')](function(_0x54dd66){_0x45d99b[_0x5948('0x1c')]=_0x54dd66;if(_0x37b4aa['query'][_0x5948('0x40')]){_0x499c35[_0x5948('0x41')]=[{'all':!![]}];}return db[_0x5948('0x42')][_0x5948('0x43')](_0x499c35);})['then'](function(_0x2f1705){_0x45d99b['rows']=_0x2f1705;return _0x45d99b;})[_0x5948('0x22')](respondWithFilteredResult(_0xe4629a,_0x499c35))[_0x5948('0x44')](handleError(_0xe4629a,null));};exports[_0x5948('0x45')]=function(_0x24cdfb,_0x1d215c){var _0xba70a9={'raw':![],'where':{'id':_0x24cdfb[_0x5948('0x46')]['id']}},_0xfb7984={};_0xfb7984[_0x5948('0x2e')]=_[_0x5948('0x30')](db[_0x5948('0x42')]['rawAttributes']);_0xfb7984[_0x5948('0x2f')]=_[_0x5948('0x30')](_0x24cdfb[_0x5948('0x2f')]);_0xfb7984[_0x5948('0x3a')]=_[_0x5948('0x32')](_0xfb7984[_0x5948('0x2e')],_0xfb7984[_0x5948('0x2f')]);_0xba70a9[_0x5948('0x31')]=_[_0x5948('0x32')](_0xfb7984[_0x5948('0x2e')],qs[_0x5948('0x47')](_0x24cdfb['query'][_0x5948('0x47')]));_0xba70a9[_0x5948('0x31')]=_0xba70a9[_0x5948('0x31')][_0x5948('0x33')]?_0xba70a9['attributes']:_0xfb7984['model'];if(_0x24cdfb[_0x5948('0x2f')][_0x5948('0x40')]){_0xba70a9['include']=[{'all':!![]}];}_0xba70a9=_[_0x5948('0x3d')]({},_0xba70a9,_0x24cdfb['options']);return db[_0x5948('0x42')][_0x5948('0x48')](_0xba70a9)[_0x5948('0x22')](handleEntityNotFound(_0x1d215c,null))[_0x5948('0x22')](respondWithResult(_0x1d215c,null))['catch'](handleError(_0x1d215c,null));};exports[_0x5948('0x49')]=function(_0x1d68b5,_0x4754d8){return db['AnalyticFieldReport'][_0x5948('0x49')](_0x1d68b5[_0x5948('0x4a')],{})['then'](respondWithResult(_0x4754d8,0xc9))[_0x5948('0x44')](handleError(_0x4754d8,null));};exports[_0x5948('0x4b')]=function(_0x38c6ca,_0x128d84){return db[_0x5948('0x42')]['bulkCreate'](_0x38c6ca[_0x5948('0x4a')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x128d84,0xc9))[_0x5948('0x44')](handleError(_0x128d84,null));};exports['update']=function(_0xeaf4ab,_0x17ee20){if(_0xeaf4ab[_0x5948('0x4a')]['id']){delete _0xeaf4ab[_0x5948('0x4a')]['id'];}return db[_0x5948('0x42')][_0x5948('0x48')]({'where':{'id':_0xeaf4ab[_0x5948('0x46')]['id']}})[_0x5948('0x22')](handleEntityNotFound(_0x17ee20,null))[_0x5948('0x22')](saveUpdates(_0xeaf4ab[_0x5948('0x4a')],null))[_0x5948('0x22')](respondWithResult(_0x17ee20,null))[_0x5948('0x44')](handleError(_0x17ee20,null));};exports[_0x5948('0x23')]=function(_0x227923,_0x27cf8b){return db[_0x5948('0x42')][_0x5948('0x48')]({'where':{'id':_0x227923[_0x5948('0x46')]['id']}})[_0x5948('0x22')](handleEntityNotFound(_0x27cf8b,null))[_0x5948('0x22')](removeEntity(_0x27cf8b,null))[_0x5948('0x44')](handleError(_0x27cf8b,null));};exports[_0x5948('0x4c')]=function(_0x2be4b4,_0x298ea2){return db['AnalyticFieldReport'][_0x5948('0x23')]({'where':{'id':_0x2be4b4[_0x5948('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x5948('0x22')](respondWithResult(_0x298ea2,0xcc))['catch'](handleError(_0x298ea2,null));};exports[_0x5948('0x4d')]=function(_0x108534,_0x5224f3,_0x1efd79){return db[_0x5948('0x4e')]['findOne']({'where':{'id':_0x108534[_0x5948('0x46')]['id']}})[_0x5948('0x22')](handleEntityNotFound(_0x5224f3,null))[_0x5948('0x22')](function(_0x281a74){if(_0x281a74){return db[_0x5948('0x4f')][_0x5948('0x50')](function(_0x4c12fe){return db['AnalyticFieldReport'][_0x5948('0x23')]({'where':{'CustomReportId':_0x108534[_0x5948('0x46')]['id']},'transaction':_0x4c12fe})['then'](function(_0x2ac84d){var _0x1b288d=_['map'](_0x108534[_0x5948('0x4a')],function(_0x288239){delete _0x288239['id'];_0x288239[_0x5948('0x51')]=_0x108534[_0x5948('0x46')]['id'];return _0x288239;});return db['AnalyticFieldReport'][_0x5948('0x4b')](_0x1b288d,{'transaction':_0x4c12fe});});})[_0x5948('0x22')](function(){return db[_0x5948('0x42')][_0x5948('0x43')]({'where':{'CustomReportId':_0x108534[_0x5948('0x46')]['id']}});});}})['then'](respondWithResult(_0x5224f3,null))[_0x5948('0x44')](handleError(_0x5224f3,null));}; \ No newline at end of file +var _0x8ce1=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','query','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticFieldReport','includeAll','include','findAll','catch','params','keys','length','find','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','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'];(function(_0x105afe,_0x108680){var _0xcbded=function(_0x85a3a8){while(--_0x85a3a8){_0x105afe['push'](_0x105afe['shift']());}};_0xcbded(++_0x108680);}(_0x8ce1,0x183));var _0x18ce=function(_0xc89c4d,_0x3a2aba){_0xc89c4d=_0xc89c4d-0x0;var _0x55fc31=_0x8ce1[_0xc89c4d];return _0x55fc31;};'use strict';var pdf=require(_0x18ce('0x0'));var emlformat=require(_0x18ce('0x1'));var rimraf=require(_0x18ce('0x2'));var zipdir=require(_0x18ce('0x3'));var jsonpatch=require(_0x18ce('0x4'));var rp=require(_0x18ce('0x5'));var moment=require(_0x18ce('0x6'));var BPromise=require(_0x18ce('0x7'));var Mustache=require(_0x18ce('0x8'));var util=require(_0x18ce('0x9'));var path=require(_0x18ce('0xa'));var sox=require(_0x18ce('0xb'));var csv=require(_0x18ce('0xc'));var ejs=require(_0x18ce('0xd'));var fs=require('fs');var _=require(_0x18ce('0xe'));var squel=require(_0x18ce('0xf'));var crypto=require('crypto');var jsforce=require(_0x18ce('0x10'));var deskjs=require(_0x18ce('0x11'));var toCsv=require(_0x18ce('0xc'));var querystring=require(_0x18ce('0x12'));var Papa=require('papaparse');var Redis=require(_0x18ce('0x13'));var authService=require(_0x18ce('0x14'));var qs=require(_0x18ce('0x15'));var as=require(_0x18ce('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x17'));var utils=require(_0x18ce('0x18'));var config=require(_0x18ce('0x19'));var db=require(_0x18ce('0x1a'))['db'];function respondWithStatusCode(_0x249697,_0x5e8c23){_0x5e8c23=_0x5e8c23||0xcc;return function(_0xbd514b){if(_0xbd514b){return _0x249697[_0x18ce('0x1b')](_0x5e8c23);}return _0x249697[_0x18ce('0x1c')](_0x5e8c23)[_0x18ce('0x1d')]();};}function respondWithResult(_0x2158aa,_0x5daf04){_0x5daf04=_0x5daf04||0xc8;return function(_0x176797){if(_0x176797){return _0x2158aa[_0x18ce('0x1c')](_0x5daf04)[_0x18ce('0x1e')](_0x176797);}};}function respondWithFilteredResult(_0x3c40c4,_0x46e346){return function(_0x36b5da){if(_0x36b5da){var _0x17460e=_0x36b5da[_0x18ce('0x1f')],_0x4a934f=_0x46e346[_0x18ce('0x20')],_0x959ce=_0x46e346[_0x18ce('0x20')]+_0x46e346[_0x18ce('0x21')],_0x1357ef;if(_0x959ce>=_0x17460e){_0x959ce=_0x17460e;_0x1357ef=0xc8;}else{_0x1357ef=0xce;}_0x3c40c4['status'](_0x1357ef);return _0x3c40c4[_0x18ce('0x22')](_0x18ce('0x23'),_0x4a934f+'-'+_0x959ce+'/'+_0x17460e)[_0x18ce('0x1e')](_0x36b5da);}return null;};}function patchUpdates(_0x56644c){return function(_0x35e446){try{jsonpatch[_0x18ce('0x24')](_0x35e446,_0x56644c,!![]);}catch(_0xb3725c){return BPromise['reject'](_0xb3725c);}return _0x35e446[_0x18ce('0x25')]();};}function saveUpdates(_0x19084e,_0x5d22cd){return function(_0x29c1ab){if(_0x29c1ab){return _0x29c1ab[_0x18ce('0x26')](_0x19084e)[_0x18ce('0x27')](function(_0x392f6d){return _0x392f6d;});}return null;};}function removeEntity(_0x31b789,_0xd41f29){return function(_0x35abf9){if(_0x35abf9){return _0x35abf9[_0x18ce('0x28')]()[_0x18ce('0x27')](function(){_0x31b789['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d2299,_0x32e910){return function(_0x576ecc){if(!_0x576ecc){_0x5d2299[_0x18ce('0x1b')](0x194);}return _0x576ecc;};}function handleError(_0x1b7e0b,_0x3fe231){_0x3fe231=_0x3fe231||0x1f4;return function(_0x4fedbd){logger['error'](_0x4fedbd['stack']);if(_0x4fedbd[_0x18ce('0x29')]){delete _0x4fedbd[_0x18ce('0x29')];}_0x1b7e0b[_0x18ce('0x1c')](_0x3fe231)[_0x18ce('0x2a')](_0x4fedbd);};}exports[_0x18ce('0x2b')]=function(_0xc3cd4,_0x5583c6){var _0x5279f8={},_0x573e41={},_0x1ff3b1={'count':0x0,'rows':[]};var _0x3719a2=_[_0x18ce('0x2c')](db['AnalyticFieldReport'][_0x18ce('0x2d')],function(_0xf2683f){return{'name':_0xf2683f[_0x18ce('0x2e')],'type':_0xf2683f['type']['key']};});_0x573e41['model']=_[_0x18ce('0x2c')](_0x3719a2,_0x18ce('0x29'));_0x573e41['query']=_['keys'](_0xc3cd4[_0x18ce('0x2f')]);_0x573e41[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x573e41['model'],_0x573e41['query']);_0x5279f8[_0x18ce('0x32')]=_[_0x18ce('0x31')](_0x573e41[_0x18ce('0x33')],qs[_0x18ce('0x34')](_0xc3cd4[_0x18ce('0x2f')][_0x18ce('0x34')]));_0x5279f8[_0x18ce('0x32')]=_0x5279f8[_0x18ce('0x32')]['length']?_0x5279f8['attributes']:_0x573e41[_0x18ce('0x33')];if(!_0xc3cd4[_0x18ce('0x2f')]['hasOwnProperty'](_0x18ce('0x35'))){_0x5279f8['limit']=qs[_0x18ce('0x21')](_0xc3cd4['query'][_0x18ce('0x21')]);_0x5279f8[_0x18ce('0x20')]=qs[_0x18ce('0x20')](_0xc3cd4['query']['offset']);}_0x5279f8[_0x18ce('0x36')]=qs[_0x18ce('0x37')](_0xc3cd4['query']['sort']);_0x5279f8[_0x18ce('0x38')]=qs[_0x18ce('0x30')](_[_0x18ce('0x39')](_0xc3cd4[_0x18ce('0x2f')],_0x573e41[_0x18ce('0x30')]),_0x3719a2);if(_0xc3cd4[_0x18ce('0x2f')][_0x18ce('0x3a')]){_0x5279f8[_0x18ce('0x38')]=_[_0x18ce('0x3b')](_0x5279f8[_0x18ce('0x38')],{'$or':_[_0x18ce('0x2c')](_0x3719a2,function(_0x465f70){if(_0x465f70[_0x18ce('0x3c')]!=='VIRTUAL'){var _0x2e997b={};_0x2e997b[_0x465f70[_0x18ce('0x29')]]={'$like':'%'+_0xc3cd4[_0x18ce('0x2f')][_0x18ce('0x3a')]+'%'};return _0x2e997b;}})});}_0x5279f8=_[_0x18ce('0x3b')]({},_0x5279f8,_0xc3cd4[_0x18ce('0x3d')]);var _0x112954={'where':_0x5279f8[_0x18ce('0x38')]};return db[_0x18ce('0x3e')][_0x18ce('0x1f')](_0x112954)['then'](function(_0x590fb7){_0x1ff3b1[_0x18ce('0x1f')]=_0x590fb7;if(_0xc3cd4[_0x18ce('0x2f')][_0x18ce('0x3f')]){_0x5279f8[_0x18ce('0x40')]=[{'all':!![]}];}return db[_0x18ce('0x3e')][_0x18ce('0x41')](_0x5279f8);})[_0x18ce('0x27')](function(_0x59a821){_0x1ff3b1['rows']=_0x59a821;return _0x1ff3b1;})[_0x18ce('0x27')](respondWithFilteredResult(_0x5583c6,_0x5279f8))[_0x18ce('0x42')](handleError(_0x5583c6,null));};exports['show']=function(_0x34a3d9,_0x1ee4db){var _0x2941ce={'raw':![],'where':{'id':_0x34a3d9[_0x18ce('0x43')]['id']}},_0x361944={};_0x361944[_0x18ce('0x33')]=_[_0x18ce('0x44')](db[_0x18ce('0x3e')][_0x18ce('0x2d')]);_0x361944[_0x18ce('0x2f')]=_[_0x18ce('0x44')](_0x34a3d9[_0x18ce('0x2f')]);_0x361944['filters']=_[_0x18ce('0x31')](_0x361944[_0x18ce('0x33')],_0x361944[_0x18ce('0x2f')]);_0x2941ce[_0x18ce('0x32')]=_[_0x18ce('0x31')](_0x361944[_0x18ce('0x33')],qs[_0x18ce('0x34')](_0x34a3d9['query']['fields']));_0x2941ce[_0x18ce('0x32')]=_0x2941ce[_0x18ce('0x32')][_0x18ce('0x45')]?_0x2941ce[_0x18ce('0x32')]:_0x361944['model'];if(_0x34a3d9[_0x18ce('0x2f')][_0x18ce('0x3f')]){_0x2941ce[_0x18ce('0x40')]=[{'all':!![]}];}_0x2941ce=_['merge']({},_0x2941ce,_0x34a3d9['options']);return db[_0x18ce('0x3e')][_0x18ce('0x46')](_0x2941ce)['then'](handleEntityNotFound(_0x1ee4db,null))[_0x18ce('0x27')](respondWithResult(_0x1ee4db,null))[_0x18ce('0x42')](handleError(_0x1ee4db,null));};exports[_0x18ce('0x47')]=function(_0x11010f,_0x22cdf6){return db[_0x18ce('0x3e')][_0x18ce('0x47')](_0x11010f['body'],{})[_0x18ce('0x27')](respondWithResult(_0x22cdf6,0xc9))[_0x18ce('0x42')](handleError(_0x22cdf6,null));};exports[_0x18ce('0x48')]=function(_0x1e445d,_0x227fb6){return db[_0x18ce('0x3e')][_0x18ce('0x48')](_0x1e445d[_0x18ce('0x49')],{'raw':![],'individualHooks':!![]})[_0x18ce('0x27')](respondWithResult(_0x227fb6,0xc9))[_0x18ce('0x42')](handleError(_0x227fb6,null));};exports[_0x18ce('0x26')]=function(_0x3f9960,_0x37bbed){if(_0x3f9960[_0x18ce('0x49')]['id']){delete _0x3f9960['body']['id'];}return db[_0x18ce('0x3e')][_0x18ce('0x46')]({'where':{'id':_0x3f9960['params']['id']}})[_0x18ce('0x27')](handleEntityNotFound(_0x37bbed,null))['then'](saveUpdates(_0x3f9960[_0x18ce('0x49')],null))['then'](respondWithResult(_0x37bbed,null))[_0x18ce('0x42')](handleError(_0x37bbed,null));};exports[_0x18ce('0x28')]=function(_0x3d5b1b,_0xdfa85e){return db['AnalyticFieldReport'][_0x18ce('0x46')]({'where':{'id':_0x3d5b1b['params']['id']}})['then'](handleEntityNotFound(_0xdfa85e,null))[_0x18ce('0x27')](removeEntity(_0xdfa85e,null))[_0x18ce('0x42')](handleError(_0xdfa85e,null));};exports[_0x18ce('0x4a')]=function(_0x5f164a,_0x51266d){return db[_0x18ce('0x3e')][_0x18ce('0x28')]({'where':{'id':_0x5f164a[_0x18ce('0x2f')][_0x18ce('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x51266d,0xcc))['catch'](handleError(_0x51266d,null));};exports[_0x18ce('0x4c')]=function(_0x4b095c,_0x3833de,_0xf5eec5){return db[_0x18ce('0x4d')]['findOne']({'where':{'id':_0x4b095c[_0x18ce('0x43')]['id']}})[_0x18ce('0x27')](handleEntityNotFound(_0x3833de,null))[_0x18ce('0x27')](function(_0x59326d){if(_0x59326d){return db[_0x18ce('0x4e')][_0x18ce('0x4f')](function(_0x25bcb8){return db['AnalyticFieldReport'][_0x18ce('0x28')]({'where':{'CustomReportId':_0x4b095c[_0x18ce('0x43')]['id']},'transaction':_0x25bcb8})[_0x18ce('0x27')](function(_0x9fce1a){var _0x55161d=_['map'](_0x4b095c[_0x18ce('0x49')],function(_0x35a30f){delete _0x35a30f['id'];_0x35a30f[_0x18ce('0x50')]=_0x4b095c[_0x18ce('0x43')]['id'];return _0x35a30f;});return db[_0x18ce('0x3e')][_0x18ce('0x48')](_0x55161d,{'transaction':_0x25bcb8});});})[_0x18ce('0x27')](function(){return db['AnalyticFieldReport'][_0x18ce('0x41')]({'where':{'CustomReportId':_0x4b095c[_0x18ce('0x43')]['id']}});});}})['then'](respondWithResult(_0x3833de,null))[_0x18ce('0x42')](handleError(_0x3833de,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a6a80be..1a4ad87 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 _0xc54d=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc54d,0x144));var _0xdc54=function(_0x53b3ee,_0x12feb7){_0x53b3ee=_0x53b3ee-0x0;var _0x50fae3=_0xc54d[_0x53b3ee];return _0x50fae3;};'use strict';var _=require(_0xdc54('0x0'));var util=require(_0xdc54('0x1'));var logger=require(_0xdc54('0x2'))('api');var moment=require(_0xdc54('0x3'));var BPromise=require(_0xdc54('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc54('0x5'));var rimraf=require(_0xdc54('0x6'));var config=require(_0xdc54('0x7'));var attributes=require(_0xdc54('0x8'));module[_0xdc54('0x9')]=function(_0x1960bc,_0x1085c8){return _0x1960bc[_0xdc54('0xa')](_0xdc54('0xb'),attributes,{'tableName':_0xdc54('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9f8=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','../../config/logger','api'];(function(_0x3deac5,_0x27c6bb){var _0x1d6898=function(_0x2347fe){while(--_0x2347fe){_0x3deac5['push'](_0x3deac5['shift']());}};_0x1d6898(++_0x27c6bb);}(_0xd9f8,0xed));var _0x8d9f=function(_0x4b67f5,_0x226f72){_0x4b67f5=_0x4b67f5-0x0;var _0x3a627a=_0xd9f8[_0x4b67f5];return _0x3a627a;};'use strict';var _=require(_0x8d9f('0x0'));var util=require('util');var logger=require(_0x8d9f('0x1'))(_0x8d9f('0x2'));var moment=require('moment');var BPromise=require(_0x8d9f('0x3'));var rp=require(_0x8d9f('0x4'));var fs=require('fs');var path=require(_0x8d9f('0x5'));var rimraf=require(_0x8d9f('0x6'));var config=require(_0x8d9f('0x7'));var attributes=require(_0x8d9f('0x8'));module[_0x8d9f('0x9')]=function(_0x31ba12,_0x4d073c){return _0x31ba12[_0x8d9f('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x8d9f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index ade5a48..cef6c33 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 _0xd818=['AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x41699c,_0x317092){var _0xb1e0ad=function(_0x205f83){while(--_0x205f83){_0x41699c['push'](_0x41699c['shift']());}};_0xb1e0ad(++_0x317092);}(_0xd818,0x1d4));var _0x8d81=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xd818[_0x25701b];return _0x3a8a2c;};'use strict';var _=require(_0x8d81('0x0'));var util=require(_0x8d81('0x1'));var moment=require('moment');var BPromise=require(_0x8d81('0x2'));var rs=require(_0x8d81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8d81('0x4'))(_0x8d81('0x5'));var config=require(_0x8d81('0x6'));var jayson=require(_0x8d81('0x7'));var client=jayson[_0x8d81('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x143e27,_0x4163e7,_0x2619a1){return new BPromise(function(_0x27661b,_0x2359f8){return client[_0x8d81('0x9')](_0x143e27,_0x2619a1)[_0x8d81('0xa')](function(_0x499b75){logger[_0x8d81('0xb')](_0x8d81('0xc'),_0x4163e7,_0x8d81('0xd'));logger[_0x8d81('0xe')](_0x8d81('0xf'),_0x4163e7,_0x8d81('0xd'),JSON[_0x8d81('0x10')](_0x499b75));if(_0x499b75[_0x8d81('0x11')]){if(_0x499b75[_0x8d81('0x11')]['code']===0x1f4){logger[_0x8d81('0x11')](_0x8d81('0xc'),_0x4163e7,_0x499b75[_0x8d81('0x11')][_0x8d81('0x12')]);return _0x2359f8(_0x499b75[_0x8d81('0x11')][_0x8d81('0x12')]);}logger[_0x8d81('0x11')](_0x8d81('0xc'),_0x4163e7,_0x499b75[_0x8d81('0x11')][_0x8d81('0x12')]);return _0x27661b(_0x499b75[_0x8d81('0x11')][_0x8d81('0x12')]);}else{logger[_0x8d81('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4163e7,_0x8d81('0xd'));_0x27661b(_0x499b75[_0x8d81('0x13')]['message']);}})[_0x8d81('0x14')](function(_0x1d8c2a){logger[_0x8d81('0x11')](_0x8d81('0xc'),_0x4163e7,_0x1d8c2a);_0x2359f8(_0x1d8c2a);});});} \ No newline at end of file +var _0xea9b=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x4be29e,_0x43f28a){var _0x52f7d1=function(_0xe6e6a9){while(--_0xe6e6a9){_0x4be29e['push'](_0x4be29e['shift']());}};_0x52f7d1(++_0x43f28a);}(_0xea9b,0x1e4));var _0xbea9=function(_0x6839e1,_0x424ff0){_0x6839e1=_0x6839e1-0x0;var _0x57cd23=_0xea9b[_0x6839e1];return _0x57cd23;};'use strict';var _=require(_0xbea9('0x0'));var util=require(_0xbea9('0x1'));var moment=require(_0xbea9('0x2'));var BPromise=require('bluebird');var rs=require(_0xbea9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbea9('0x4'));var logger=require(_0xbea9('0x5'))('rpc');var config=require(_0xbea9('0x6'));var jayson=require(_0xbea9('0x7'));var client=jayson[_0xbea9('0x8')][_0xbea9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19cbd3,_0x5a88f2,_0x48ce83){return new BPromise(function(_0x3a4322,_0x57a7d1){return client[_0xbea9('0xa')](_0x19cbd3,_0x48ce83)[_0xbea9('0xb')](function(_0x436480){logger[_0xbea9('0xc')](_0xbea9('0xd'),_0x5a88f2,_0xbea9('0xe'));logger[_0xbea9('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x5a88f2,_0xbea9('0xe'),JSON[_0xbea9('0x10')](_0x436480));if(_0x436480['error']){if(_0x436480[_0xbea9('0x11')][_0xbea9('0x12')]===0x1f4){logger[_0xbea9('0x11')](_0xbea9('0xd'),_0x5a88f2,_0x436480[_0xbea9('0x11')][_0xbea9('0x13')]);return _0x57a7d1(_0x436480[_0xbea9('0x11')]['message']);}logger['error'](_0xbea9('0xd'),_0x5a88f2,_0x436480[_0xbea9('0x11')][_0xbea9('0x13')]);return _0x3a4322(_0x436480[_0xbea9('0x11')][_0xbea9('0x13')]);}else{logger[_0xbea9('0xc')](_0xbea9('0xd'),_0x5a88f2,_0xbea9('0xe'));_0x3a4322(_0x436480[_0xbea9('0x14')][_0xbea9('0x13')]);}})[_0xbea9('0x15')](function(_0xce612a){logger['error'](_0xbea9('0xd'),_0x5a88f2,_0xce612a);_0x57a7d1(_0xce612a);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 28da650..ef4f018 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0xe14b=['addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate'];(function(_0x3c2c2a,_0x2bce72){var _0xf1156b=function(_0x2d874e){while(--_0x2d874e){_0x3c2c2a['push'](_0x3c2c2a['shift']());}};_0xf1156b(++_0x2bce72);}(_0xe14b,0x93));var _0xbe14=function(_0x180237,_0xfd4959){_0x180237=_0x180237-0x0;var _0x56fa74=_0xe14b[_0x180237];return _0x56fa74;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['post']('/:id/create_many',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['put'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);module[_0xbe14('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 3436844..bfe12de 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 _0x980c=['TEXT','sequelize','exports','STRING','name'];(function(_0x5f4ba1,_0x4a0182){var _0xe72ee8=function(_0x4480d1){while(--_0x4480d1){_0x5f4ba1['push'](_0x5f4ba1['shift']());}};_0xe72ee8(++_0x4a0182);}(_0x980c,0x100));var _0xc980=function(_0x23a248,_0x49d017){_0x23a248=_0x23a248-0x0;var _0x3240a8=_0x980c[_0x23a248];return _0x3240a8;};'use strict';var Sequelize=require(_0xc980('0x0'));module[_0xc980('0x1')]={'name':{'type':Sequelize[_0xc980('0x2')],'allowNull':![],'unique':_0xc980('0x3')},'table':{'type':Sequelize[_0xc980('0x2')]},'metric':{'type':Sequelize[_0xc980('0x4')]},'description':{'type':Sequelize[_0xc980('0x2')]}}; \ No newline at end of file +var _0xac4a=['exports','STRING','name','TEXT','sequelize'];(function(_0x2628cd,_0x46ee78){var _0x71580d=function(_0xe8cce5){while(--_0xe8cce5){_0x2628cd['push'](_0x2628cd['shift']());}};_0x71580d(++_0x46ee78);}(_0xac4a,0x13f));var _0xaac4=function(_0x3a01cf,_0x15f90c){_0x3a01cf=_0x3a01cf-0x0;var _0x5e4f5a=_0xac4a[_0x3a01cf];return _0x5e4f5a;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'name':{'type':Sequelize[_0xaac4('0x2')],'allowNull':![],'unique':_0xaac4('0x3')},'table':{'type':Sequelize[_0xaac4('0x2')]},'metric':{'type':Sequelize[_0xaac4('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 0b98ecd..1306bc3 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 _0xa5fa=['fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','include','findAll','catch','show','params','keys','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','Metrics','destroy','end','stack','name','send','AnalyticMetric'];(function(_0x4c3b0e,_0x4bf25d){var _0x31c3ef=function(_0x27ea59){while(--_0x27ea59){_0x4c3b0e['push'](_0x4c3b0e['shift']());}};_0x31c3ef(++_0x4bf25d);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xa5fa[_0x33554b];return _0x256954;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaa5f('0x0'));var rimraf=require(_0xaa5f('0x1'));var zipdir=require(_0xaa5f('0x2'));var jsonpatch=require(_0xaa5f('0x3'));var rp=require('request-promise');var moment=require(_0xaa5f('0x4'));var BPromise=require(_0xaa5f('0x5'));var Mustache=require('mustache');var util=require(_0xaa5f('0x6'));var path=require(_0xaa5f('0x7'));var sox=require(_0xaa5f('0x8'));var csv=require(_0xaa5f('0x9'));var ejs=require(_0xaa5f('0xa'));var fs=require('fs');var _=require(_0xaa5f('0xb'));var squel=require(_0xaa5f('0xc'));var crypto=require(_0xaa5f('0xd'));var jsforce=require(_0xaa5f('0xe'));var deskjs=require(_0xaa5f('0xf'));var toCsv=require(_0xaa5f('0x9'));var querystring=require('querystring');var Papa=require(_0xaa5f('0x10'));var Redis=require(_0xaa5f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa5f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa5f('0x14'));var db=require(_0xaa5f('0x15'))['db'];function respondWithStatusCode(_0x206ed3,_0x9aeae9){_0x9aeae9=_0x9aeae9||0xcc;return function(_0x252ae0){if(_0x252ae0){return _0x206ed3['sendStatus'](_0x9aeae9);}return _0x206ed3[_0xaa5f('0x16')](_0x9aeae9)['end']();};}function respondWithResult(_0x372881,_0x23f872){_0x23f872=_0x23f872||0xc8;return function(_0x31eabc){if(_0x31eabc){return _0x372881[_0xaa5f('0x16')](_0x23f872)[_0xaa5f('0x17')](_0x31eabc);}};}function respondWithFilteredResult(_0x5a4c41,_0x4fc828){return function(_0x1f37fb){if(_0x1f37fb){var _0x291042=_0x1f37fb[_0xaa5f('0x18')],_0xb0bfb6=_0x4fc828[_0xaa5f('0x19')],_0x4265ab=_0x4fc828[_0xaa5f('0x19')]+_0x4fc828[_0xaa5f('0x1a')],_0x27fdca;if(_0x4265ab>=_0x291042){_0x4265ab=_0x291042;_0x27fdca=0xc8;}else{_0x27fdca=0xce;}_0x5a4c41[_0xaa5f('0x16')](_0x27fdca);return _0x5a4c41[_0xaa5f('0x1b')](_0xaa5f('0x1c'),_0xb0bfb6+'-'+_0x4265ab+'/'+_0x291042)['json'](_0x1f37fb);}return null;};}function patchUpdates(_0x1c072){return function(_0x4c0a9d){try{jsonpatch[_0xaa5f('0x1d')](_0x4c0a9d,_0x1c072,!![]);}catch(_0x358d2e){return BPromise[_0xaa5f('0x1e')](_0x358d2e);}return _0x4c0a9d[_0xaa5f('0x1f')]();};}function saveUpdates(_0x21cd23,_0x194691){return function(_0x2d8fc3){if(_0x2d8fc3){return _0x2d8fc3[_0xaa5f('0x20')](_0x21cd23)[_0xaa5f('0x21')](function(_0x10f287){return _0x10f287;});}return null;};}function removeEntity(_0x998ab5,_0x5238a8){return function(_0x1e917d){if(_0x1e917d){return _0x1e917d['destroy']()[_0xaa5f('0x21')](function(){var _0x34ca72=_0x1e917d['get']({'plain':!![]});var _0x1baa2e=_0xaa5f('0x22');return db['UserProfileResource'][_0xaa5f('0x23')]({'where':{'type':_0x1baa2e,'resourceId':_0x34ca72['id']}})[_0xaa5f('0x21')](function(){return _0x1e917d;});})[_0xaa5f('0x21')](function(){_0x998ab5[_0xaa5f('0x16')](0xcc)[_0xaa5f('0x24')]();});}};}function handleEntityNotFound(_0xacbded,_0x3d7bca){return function(_0x2fba7d){if(!_0x2fba7d){_0xacbded['sendStatus'](0x194);}return _0x2fba7d;};}function handleError(_0x2445a6,_0x3a66e8){_0x3a66e8=_0x3a66e8||0x1f4;return function(_0x1ed8eb){logger['error'](_0x1ed8eb[_0xaa5f('0x25')]);if(_0x1ed8eb[_0xaa5f('0x26')]){delete _0x1ed8eb[_0xaa5f('0x26')];}_0x2445a6['status'](_0x3a66e8)[_0xaa5f('0x27')](_0x1ed8eb);};}exports['index']=function(_0x5990d2,_0x27d1a4){var _0x50998f={},_0x1bffec={},_0x4e0ec9={'count':0x0,'rows':[]};var _0x4c5dc0=_['map'](db[_0xaa5f('0x28')]['rawAttributes'],function(_0x310828){return{'name':_0x310828[_0xaa5f('0x29')],'type':_0x310828['type']['key']};});_0x1bffec[_0xaa5f('0x2a')]=_['map'](_0x4c5dc0,_0xaa5f('0x26'));_0x1bffec[_0xaa5f('0x2b')]=_['keys'](_0x5990d2[_0xaa5f('0x2b')]);_0x1bffec[_0xaa5f('0x2c')]=_[_0xaa5f('0x2d')](_0x1bffec['model'],_0x1bffec[_0xaa5f('0x2b')]);_0x50998f[_0xaa5f('0x2e')]=_['intersection'](_0x1bffec['model'],qs['fields'](_0x5990d2['query'][_0xaa5f('0x2f')]));_0x50998f[_0xaa5f('0x2e')]=_0x50998f[_0xaa5f('0x2e')][_0xaa5f('0x30')]?_0x50998f[_0xaa5f('0x2e')]:_0x1bffec[_0xaa5f('0x2a')];if(!_0x5990d2[_0xaa5f('0x2b')]['hasOwnProperty'](_0xaa5f('0x31'))){_0x50998f[_0xaa5f('0x1a')]=qs[_0xaa5f('0x1a')](_0x5990d2[_0xaa5f('0x2b')][_0xaa5f('0x1a')]);_0x50998f[_0xaa5f('0x19')]=qs['offset'](_0x5990d2[_0xaa5f('0x2b')][_0xaa5f('0x19')]);}_0x50998f[_0xaa5f('0x32')]=qs[_0xaa5f('0x33')](_0x5990d2[_0xaa5f('0x2b')]['sort']);_0x50998f['where']=qs[_0xaa5f('0x2c')](_[_0xaa5f('0x34')](_0x5990d2[_0xaa5f('0x2b')],_0x1bffec[_0xaa5f('0x2c')]),_0x4c5dc0);if(_0x5990d2['query'][_0xaa5f('0x35')]){_0x50998f[_0xaa5f('0x36')]=_[_0xaa5f('0x37')](_0x50998f[_0xaa5f('0x36')],{'$or':_[_0xaa5f('0x38')](_0x4c5dc0,function(_0x1869c2){if(_0x1869c2[_0xaa5f('0x39')]!==_0xaa5f('0x3a')){var _0xc6deec={};_0xc6deec[_0x1869c2[_0xaa5f('0x26')]]={'$like':'%'+_0x5990d2[_0xaa5f('0x2b')]['filter']+'%'};return _0xc6deec;}})});}_0x50998f=_[_0xaa5f('0x37')]({},_0x50998f,_0x5990d2[_0xaa5f('0x3b')]);var _0xcd9c30={'where':_0x50998f[_0xaa5f('0x36')]};return db[_0xaa5f('0x28')][_0xaa5f('0x18')](_0xcd9c30)[_0xaa5f('0x21')](function(_0xa490d9){_0x4e0ec9[_0xaa5f('0x18')]=_0xa490d9;if(_0x5990d2[_0xaa5f('0x2b')]['includeAll']){_0x50998f[_0xaa5f('0x3c')]=[{'all':!![]}];}return db['AnalyticMetric'][_0xaa5f('0x3d')](_0x50998f);})[_0xaa5f('0x21')](function(_0x17bb4d){_0x4e0ec9['rows']=_0x17bb4d;return _0x4e0ec9;})[_0xaa5f('0x21')](respondWithFilteredResult(_0x27d1a4,_0x50998f))[_0xaa5f('0x3e')](handleError(_0x27d1a4,null));};exports[_0xaa5f('0x3f')]=function(_0x528b08,_0x12a8e4){var _0x179be8={'raw':!![],'where':{'id':_0x528b08[_0xaa5f('0x40')]['id']}},_0x1ac9b6={};_0x1ac9b6['model']=_[_0xaa5f('0x41')](db[_0xaa5f('0x28')][_0xaa5f('0x42')]);_0x1ac9b6[_0xaa5f('0x2b')]=_[_0xaa5f('0x41')](_0x528b08[_0xaa5f('0x2b')]);_0x1ac9b6[_0xaa5f('0x2c')]=_[_0xaa5f('0x2d')](_0x1ac9b6['model'],_0x1ac9b6[_0xaa5f('0x2b')]);_0x179be8['attributes']=_[_0xaa5f('0x2d')](_0x1ac9b6['model'],qs[_0xaa5f('0x2f')](_0x528b08[_0xaa5f('0x2b')]['fields']));_0x179be8[_0xaa5f('0x2e')]=_0x179be8[_0xaa5f('0x2e')][_0xaa5f('0x30')]?_0x179be8['attributes']:_0x1ac9b6['model'];if(_0x528b08['query'][_0xaa5f('0x43')]){_0x179be8['include']=[{'all':!![]}];}_0x179be8=_[_0xaa5f('0x37')]({},_0x179be8,_0x528b08[_0xaa5f('0x3b')]);return db[_0xaa5f('0x28')][_0xaa5f('0x44')](_0x179be8)['then'](handleEntityNotFound(_0x12a8e4,null))[_0xaa5f('0x21')](respondWithResult(_0x12a8e4,null))[_0xaa5f('0x3e')](handleError(_0x12a8e4,null));};exports[_0xaa5f('0x45')]=function(_0x231ad1,_0x27ea4b){return db[_0xaa5f('0x28')][_0xaa5f('0x45')](_0x231ad1[_0xaa5f('0x46')],{})[_0xaa5f('0x21')](function(_0x16f8bf){var _0x3ea553=_0x231ad1[_0xaa5f('0x47')][_0xaa5f('0x48')]({'plain':!![]});if(!_0x3ea553)throw new Error(_0xaa5f('0x49'));if(_0x3ea553[_0xaa5f('0x4a')]===_0xaa5f('0x47')){var _0x554e6d=_0x16f8bf[_0xaa5f('0x48')]({'plain':!![]});var _0x242cd3=_0xaa5f('0x22');return db[_0xaa5f('0x4b')][_0xaa5f('0x44')]({'where':{'name':_0x242cd3,'userProfileId':_0x3ea553[_0xaa5f('0x4c')]},'raw':!![]})[_0xaa5f('0x21')](function(_0x4aa556){if(_0x4aa556&&_0x4aa556[_0xaa5f('0x4d')]===0x0){return db[_0xaa5f('0x4e')][_0xaa5f('0x45')]({'name':_0x554e6d[_0xaa5f('0x26')],'resourceId':_0x554e6d['id'],'type':_0x4aa556['name'],'sectionId':_0x4aa556['id']},{})[_0xaa5f('0x21')](function(){return _0x16f8bf;});}else{return _0x16f8bf;}})[_0xaa5f('0x3e')](function(_0x36c4aa){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36c4aa);throw _0x36c4aa;});}return _0x16f8bf;})['then'](respondWithResult(_0x27ea4b,0xc9))['catch'](handleError(_0x27ea4b,null));};exports['update']=function(_0x509c61,_0x1f47a0){if(_0x509c61[_0xaa5f('0x46')]['id']){delete _0x509c61[_0xaa5f('0x46')]['id'];}return db[_0xaa5f('0x28')][_0xaa5f('0x44')]({'where':{'id':_0x509c61[_0xaa5f('0x40')]['id']}})['then'](handleEntityNotFound(_0x1f47a0,null))['then'](saveUpdates(_0x509c61[_0xaa5f('0x46')],null))[_0xaa5f('0x21')](respondWithResult(_0x1f47a0,null))['catch'](handleError(_0x1f47a0,null));};exports[_0xaa5f('0x23')]=function(_0x2e6895,_0x2b815d){return db[_0xaa5f('0x28')][_0xaa5f('0x44')]({'where':{'id':_0x2e6895[_0xaa5f('0x40')]['id']}})[_0xaa5f('0x21')](handleEntityNotFound(_0x2b815d,null))['then'](removeEntity(_0x2b815d,null))['catch'](handleError(_0x2b815d,null));}; \ No newline at end of file +var _0x3c66=['../../config/utils','../../config/environment','end','status','offset','set','Content-Range','json','reject','then','get','Metrics','UserProfileResource','destroy','sendStatus','stack','name','send','map','AnalyticMetric','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3cb59b,_0x355c05){var _0xe3ee86=function(_0xcd563f){while(--_0xcd563f){_0x3cb59b['push'](_0x3cb59b['shift']());}};_0xe3ee86(++_0x355c05);}(_0x3c66,0x8b));var _0x63c6=function(_0x5ddefc,_0x2dd5ee){_0x5ddefc=_0x5ddefc-0x0;var _0x4315ed=_0x3c66[_0x5ddefc];return _0x4315ed;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x63c6('0x0'));var jsonpatch=require(_0x63c6('0x1'));var rp=require(_0x63c6('0x2'));var moment=require(_0x63c6('0x3'));var BPromise=require(_0x63c6('0x4'));var Mustache=require(_0x63c6('0x5'));var util=require(_0x63c6('0x6'));var path=require(_0x63c6('0x7'));var sox=require(_0x63c6('0x8'));var csv=require(_0x63c6('0x9'));var ejs=require(_0x63c6('0xa'));var fs=require('fs');var _=require(_0x63c6('0xb'));var squel=require('squel');var crypto=require(_0x63c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x63c6('0xd'));var toCsv=require(_0x63c6('0x9'));var querystring=require('querystring');var Papa=require(_0x63c6('0xe'));var Redis=require(_0x63c6('0xf'));var authService=require(_0x63c6('0x10'));var qs=require(_0x63c6('0x11'));var as=require(_0x63c6('0x12'));var hardwareService=require(_0x63c6('0x13'));var logger=require('../../config/logger')(_0x63c6('0x14'));var utils=require(_0x63c6('0x15'));var config=require(_0x63c6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c58ee,_0x598a34){_0x598a34=_0x598a34||0xcc;return function(_0x528dc1){if(_0x528dc1){return _0x4c58ee['sendStatus'](_0x598a34);}return _0x4c58ee['status'](_0x598a34)[_0x63c6('0x17')]();};}function respondWithResult(_0x69911c,_0x1cd490){_0x1cd490=_0x1cd490||0xc8;return function(_0x9c3ab3){if(_0x9c3ab3){return _0x69911c[_0x63c6('0x18')](_0x1cd490)['json'](_0x9c3ab3);}};}function respondWithFilteredResult(_0x286eb8,_0x19fbb3){return function(_0x58ce24){if(_0x58ce24){var _0x2b835a=_0x58ce24['count'],_0x4b1964=_0x19fbb3[_0x63c6('0x19')],_0x50b819=_0x19fbb3[_0x63c6('0x19')]+_0x19fbb3['limit'],_0x1abfbd;if(_0x50b819>=_0x2b835a){_0x50b819=_0x2b835a;_0x1abfbd=0xc8;}else{_0x1abfbd=0xce;}_0x286eb8[_0x63c6('0x18')](_0x1abfbd);return _0x286eb8[_0x63c6('0x1a')](_0x63c6('0x1b'),_0x4b1964+'-'+_0x50b819+'/'+_0x2b835a)[_0x63c6('0x1c')](_0x58ce24);}return null;};}function patchUpdates(_0x16aa5e){return function(_0x48a8db){try{jsonpatch['apply'](_0x48a8db,_0x16aa5e,!![]);}catch(_0x491c80){return BPromise[_0x63c6('0x1d')](_0x491c80);}return _0x48a8db['save']();};}function saveUpdates(_0x569960,_0xb7ba4f){return function(_0x46c9b3){if(_0x46c9b3){return _0x46c9b3['update'](_0x569960)[_0x63c6('0x1e')](function(_0x2898e5){return _0x2898e5;});}return null;};}function removeEntity(_0x1bf63b,_0x3f9360){return function(_0x430a6e){if(_0x430a6e){return _0x430a6e['destroy']()[_0x63c6('0x1e')](function(){var _0x3d180e=_0x430a6e[_0x63c6('0x1f')]({'plain':!![]});var _0x35098c=_0x63c6('0x20');return db[_0x63c6('0x21')][_0x63c6('0x22')]({'where':{'type':_0x35098c,'resourceId':_0x3d180e['id']}})[_0x63c6('0x1e')](function(){return _0x430a6e;});})['then'](function(){_0x1bf63b[_0x63c6('0x18')](0xcc)[_0x63c6('0x17')]();});}};}function handleEntityNotFound(_0xee6da9,_0x59cd9f){return function(_0x52f9b1){if(!_0x52f9b1){_0xee6da9[_0x63c6('0x23')](0x194);}return _0x52f9b1;};}function handleError(_0x5575c1,_0x2a0ccf){_0x2a0ccf=_0x2a0ccf||0x1f4;return function(_0x4c23e8){logger['error'](_0x4c23e8[_0x63c6('0x24')]);if(_0x4c23e8[_0x63c6('0x25')]){delete _0x4c23e8[_0x63c6('0x25')];}_0x5575c1['status'](_0x2a0ccf)[_0x63c6('0x26')](_0x4c23e8);};}exports['index']=function(_0x1c6a20,_0x6c39e4){var _0x393424={},_0x47315c={},_0xe77aa8={'count':0x0,'rows':[]};var _0x6f36be=_[_0x63c6('0x27')](db[_0x63c6('0x28')]['rawAttributes'],function(_0x772b2f){return{'name':_0x772b2f[_0x63c6('0x29')],'type':_0x772b2f[_0x63c6('0x2a')][_0x63c6('0x2b')]};});_0x47315c['model']=_[_0x63c6('0x27')](_0x6f36be,'name');_0x47315c['query']=_[_0x63c6('0x2c')](_0x1c6a20[_0x63c6('0x2d')]);_0x47315c[_0x63c6('0x2e')]=_[_0x63c6('0x2f')](_0x47315c[_0x63c6('0x30')],_0x47315c[_0x63c6('0x2d')]);_0x393424[_0x63c6('0x31')]=_['intersection'](_0x47315c[_0x63c6('0x30')],qs['fields'](_0x1c6a20[_0x63c6('0x2d')]['fields']));_0x393424[_0x63c6('0x31')]=_0x393424['attributes'][_0x63c6('0x32')]?_0x393424['attributes']:_0x47315c['model'];if(!_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x33')](_0x63c6('0x34'))){_0x393424['limit']=qs[_0x63c6('0x35')](_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x35')]);_0x393424[_0x63c6('0x19')]=qs['offset'](_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x19')]);}_0x393424['order']=qs[_0x63c6('0x36')](_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x36')]);_0x393424[_0x63c6('0x37')]=qs[_0x63c6('0x2e')](_[_0x63c6('0x38')](_0x1c6a20[_0x63c6('0x2d')],_0x47315c[_0x63c6('0x2e')]),_0x6f36be);if(_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x39')]){_0x393424[_0x63c6('0x37')]=_[_0x63c6('0x3a')](_0x393424['where'],{'$or':_[_0x63c6('0x27')](_0x6f36be,function(_0x576d3a){if(_0x576d3a[_0x63c6('0x2a')]!==_0x63c6('0x3b')){var _0x4d7512={};_0x4d7512[_0x576d3a['name']]={'$like':'%'+_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x39')]+'%'};return _0x4d7512;}})});}_0x393424=_[_0x63c6('0x3a')]({},_0x393424,_0x1c6a20[_0x63c6('0x3c')]);var _0x357fd5={'where':_0x393424['where']};return db[_0x63c6('0x28')]['count'](_0x357fd5)['then'](function(_0x267b5c){_0xe77aa8[_0x63c6('0x3d')]=_0x267b5c;if(_0x1c6a20[_0x63c6('0x2d')][_0x63c6('0x3e')]){_0x393424[_0x63c6('0x3f')]=[{'all':!![]}];}return db[_0x63c6('0x28')][_0x63c6('0x40')](_0x393424);})[_0x63c6('0x1e')](function(_0x28f0e5){_0xe77aa8[_0x63c6('0x41')]=_0x28f0e5;return _0xe77aa8;})[_0x63c6('0x1e')](respondWithFilteredResult(_0x6c39e4,_0x393424))[_0x63c6('0x42')](handleError(_0x6c39e4,null));};exports[_0x63c6('0x43')]=function(_0x1e88d9,_0x1cb47c){var _0x1ebd6b={'raw':!![],'where':{'id':_0x1e88d9[_0x63c6('0x44')]['id']}},_0x6b1ec8={};_0x6b1ec8[_0x63c6('0x30')]=_['keys'](db[_0x63c6('0x28')]['rawAttributes']);_0x6b1ec8['query']=_['keys'](_0x1e88d9['query']);_0x6b1ec8[_0x63c6('0x2e')]=_[_0x63c6('0x2f')](_0x6b1ec8['model'],_0x6b1ec8[_0x63c6('0x2d')]);_0x1ebd6b['attributes']=_[_0x63c6('0x2f')](_0x6b1ec8[_0x63c6('0x30')],qs[_0x63c6('0x45')](_0x1e88d9[_0x63c6('0x2d')]['fields']));_0x1ebd6b[_0x63c6('0x31')]=_0x1ebd6b[_0x63c6('0x31')][_0x63c6('0x32')]?_0x1ebd6b[_0x63c6('0x31')]:_0x6b1ec8[_0x63c6('0x30')];if(_0x1e88d9[_0x63c6('0x2d')][_0x63c6('0x3e')]){_0x1ebd6b[_0x63c6('0x3f')]=[{'all':!![]}];}_0x1ebd6b=_['merge']({},_0x1ebd6b,_0x1e88d9[_0x63c6('0x3c')]);return db[_0x63c6('0x28')][_0x63c6('0x46')](_0x1ebd6b)['then'](handleEntityNotFound(_0x1cb47c,null))[_0x63c6('0x1e')](respondWithResult(_0x1cb47c,null))[_0x63c6('0x42')](handleError(_0x1cb47c,null));};exports[_0x63c6('0x47')]=function(_0x63b552,_0x41b4b0){return db['AnalyticMetric'][_0x63c6('0x47')](_0x63b552[_0x63c6('0x48')],{})['then'](function(_0x3fcba7){var _0x21a7e3=_0x63b552[_0x63c6('0x49')][_0x63c6('0x1f')]({'plain':!![]});if(!_0x21a7e3)throw new Error(_0x63c6('0x4a'));if(_0x21a7e3[_0x63c6('0x4b')]==='user'){var _0x114727=_0x3fcba7[_0x63c6('0x1f')]({'plain':!![]});var _0x224f27=_0x63c6('0x20');return db['UserProfileSection'][_0x63c6('0x46')]({'where':{'name':_0x224f27,'userProfileId':_0x21a7e3[_0x63c6('0x4c')]},'raw':!![]})['then'](function(_0x39b940){if(_0x39b940&&_0x39b940[_0x63c6('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x114727[_0x63c6('0x25')],'resourceId':_0x114727['id'],'type':_0x39b940[_0x63c6('0x25')],'sectionId':_0x39b940['id']},{})[_0x63c6('0x1e')](function(){return _0x3fcba7;});}else{return _0x3fcba7;}})[_0x63c6('0x42')](function(_0x4b00a4){logger['error'](_0x63c6('0x4e'),_0x4b00a4);throw _0x4b00a4;});}return _0x3fcba7;})['then'](respondWithResult(_0x41b4b0,0xc9))[_0x63c6('0x42')](handleError(_0x41b4b0,null));};exports[_0x63c6('0x4f')]=function(_0x262f64,_0x248291){if(_0x262f64[_0x63c6('0x48')]['id']){delete _0x262f64['body']['id'];}return db[_0x63c6('0x28')][_0x63c6('0x46')]({'where':{'id':_0x262f64[_0x63c6('0x44')]['id']}})['then'](handleEntityNotFound(_0x248291,null))['then'](saveUpdates(_0x262f64[_0x63c6('0x48')],null))[_0x63c6('0x1e')](respondWithResult(_0x248291,null))[_0x63c6('0x42')](handleError(_0x248291,null));};exports[_0x63c6('0x22')]=function(_0x41a057,_0x3c4665){return db[_0x63c6('0x28')]['find']({'where':{'id':_0x41a057[_0x63c6('0x44')]['id']}})[_0x63c6('0x1e')](handleEntityNotFound(_0x3c4665,null))[_0x63c6('0x1e')](removeEntity(_0x3c4665,null))[_0x63c6('0x42')](handleError(_0x3c4665,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b4a4f3b..7fa53b9 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 _0x9120=['AnalyticMetric','analytics_metrics','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0x9120,0x141));var _0x0912=function(_0x32d728,_0x3e3fa7){_0x32d728=_0x32d728-0x0;var _0x42dc5f=_0x9120[_0x32d728];return _0x42dc5f;};'use strict';var _=require(_0x0912('0x0'));var util=require(_0x0912('0x1'));var logger=require('../../config/logger')(_0x0912('0x2'));var moment=require(_0x0912('0x3'));var BPromise=require(_0x0912('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0912('0x5'));var rimraf=require(_0x0912('0x6'));var config=require(_0x0912('0x7'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x46aba6,_0x3c1996){return _0x46aba6[_0x0912('0x8')](_0x0912('0x9'),attributes,{'tableName':_0x0912('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4243=['define','analytics_metrics','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./analyticMetric.attributes','exports'];(function(_0x487d4a,_0x49d74f){var _0x12fa91=function(_0x253b4f){while(--_0x253b4f){_0x487d4a['push'](_0x487d4a['shift']());}};_0x12fa91(++_0x49d74f);}(_0x4243,0x91));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3424('0x0'));var util=require('util');var logger=require(_0x3424('0x1'))(_0x3424('0x2'));var moment=require(_0x3424('0x3'));var BPromise=require(_0x3424('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3424('0x5'));var rimraf=require(_0x3424('0x6'));var config=require('../../config/environment');var attributes=require(_0x3424('0x7'));module[_0x3424('0x8')]=function(_0x2660b9,_0x4fead7){return _0x2660b9[_0x3424('0x9')]('AnalyticMetric',attributes,{'tableName':_0x3424('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 9afd157..80c2cae 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 _0x7b58=['jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x484c1b,_0x39e661){var _0x1cee5b=function(_0x324d44){while(--_0x324d44){_0x484c1b['push'](_0x484c1b['shift']());}};_0x1cee5b(++_0x39e661);}(_0x7b58,0x8b));var _0x87b5=function(_0x482815,_0x3601b1){_0x482815=_0x482815-0x0;var _0x272d11=_0x7b58[_0x482815];return _0x272d11;};'use strict';var _=require('lodash');var util=require(_0x87b5('0x0'));var moment=require('moment');var BPromise=require(_0x87b5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87b5('0x2'));var db=require(_0x87b5('0x3'))['db'];var utils=require(_0x87b5('0x4'));var logger=require(_0x87b5('0x5'))(_0x87b5('0x6'));var config=require(_0x87b5('0x7'));var jayson=require(_0x87b5('0x8'));var client=jayson[_0x87b5('0x9')][_0x87b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f44d6,_0x5091e0,_0x3b2a66){return new BPromise(function(_0x1c654a,_0x48ec39){return client[_0x87b5('0xb')](_0x4f44d6,_0x3b2a66)[_0x87b5('0xc')](function(_0x1a07ff){logger[_0x87b5('0xd')](_0x87b5('0xe'),_0x5091e0,'request\x20sent');logger[_0x87b5('0xf')](_0x87b5('0x10'),_0x5091e0,_0x87b5('0x11'),JSON['stringify'](_0x1a07ff));if(_0x1a07ff['error']){if(_0x1a07ff['error'][_0x87b5('0x12')]===0x1f4){logger[_0x87b5('0x13')](_0x87b5('0xe'),_0x5091e0,_0x1a07ff[_0x87b5('0x13')][_0x87b5('0x14')]);return _0x48ec39(_0x1a07ff['error'][_0x87b5('0x14')]);}logger[_0x87b5('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x5091e0,_0x1a07ff[_0x87b5('0x13')]['message']);return _0x1c654a(_0x1a07ff[_0x87b5('0x13')]['message']);}else{logger[_0x87b5('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x5091e0,'request\x20sent');_0x1c654a(_0x1a07ff['result']['message']);}})['catch'](function(_0x1be69c){logger[_0x87b5('0x13')](_0x87b5('0xe'),_0x5091e0,_0x1be69c);_0x48ec39(_0x1be69c);});});} \ No newline at end of file +var _0x028d=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x1db389,_0x5158cf){var _0x204699=function(_0x3d0404){while(--_0x3d0404){_0x1db389['push'](_0x1db389['shift']());}};_0x204699(++_0x5158cf);}(_0x028d,0x85));var _0xd028=function(_0x449120,_0x179535){_0x449120=_0x449120-0x0;var _0x4216b2=_0x028d[_0x449120];return _0x4216b2;};'use strict';var _=require(_0xd028('0x0'));var util=require(_0xd028('0x1'));var moment=require(_0xd028('0x2'));var BPromise=require('bluebird');var rs=require(_0xd028('0x3'));var fs=require('fs');var Redis=require(_0xd028('0x4'));var db=require(_0xd028('0x5'))['db'];var utils=require(_0xd028('0x6'));var logger=require(_0xd028('0x7'))(_0xd028('0x8'));var config=require(_0xd028('0x9'));var jayson=require(_0xd028('0xa'));var client=jayson[_0xd028('0xb')][_0xd028('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d4946,_0x4e4473,_0x4655de){return new BPromise(function(_0x5e4ccc,_0x1cab3f){return client[_0xd028('0xd')](_0x1d4946,_0x4655de)[_0xd028('0xe')](function(_0x1d5025){logger[_0xd028('0xf')](_0xd028('0x10'),_0x4e4473,'request\x20sent');logger[_0xd028('0x11')](_0xd028('0x12'),_0x4e4473,_0xd028('0x13'),JSON['stringify'](_0x1d5025));if(_0x1d5025[_0xd028('0x14')]){if(_0x1d5025[_0xd028('0x14')][_0xd028('0x15')]===0x1f4){logger[_0xd028('0x14')](_0xd028('0x10'),_0x4e4473,_0x1d5025[_0xd028('0x14')][_0xd028('0x16')]);return _0x1cab3f(_0x1d5025[_0xd028('0x14')][_0xd028('0x16')]);}logger[_0xd028('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x4e4473,_0x1d5025[_0xd028('0x14')][_0xd028('0x16')]);return _0x5e4ccc(_0x1d5025[_0xd028('0x14')]['message']);}else{logger[_0xd028('0xf')](_0xd028('0x10'),_0x4e4473,_0xd028('0x13'));_0x5e4ccc(_0x1d5025[_0xd028('0x17')]['message']);}})[_0xd028('0x18')](function(_0x5d7d9d){logger[_0xd028('0x14')](_0xd028('0x10'),_0x4e4473,_0x5d7d9d);_0x1cab3f(_0x5d7d9d);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d759580..67b6bf1 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 _0xe2fe=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','/:id','post','create','put','update','exports','multer'];(function(_0x55e847,_0x25f0cb){var _0x170885=function(_0x2d2b8b){while(--_0x2d2b8b){_0x55e847['push'](_0x55e847['shift']());}};_0x170885(++_0x25f0cb);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var auth=require(_0xee2f('0x3'));var interaction=require(_0xee2f('0x4'));var config=require(_0xee2f('0x5'));var controller=require(_0xee2f('0x6'));router['get']('/',auth[_0xee2f('0x7')](),controller[_0xee2f('0x8')]);router['get'](_0xee2f('0x9'),auth[_0xee2f('0x7')](),controller['show']);router[_0xee2f('0xa')]('/',auth['isAuthenticated'](),controller[_0xee2f('0xb')]);router[_0xee2f('0xc')]('/:id',auth[_0xee2f('0x7')](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xee2f('0xe')]=router; \ No newline at end of file +var _0x6d38=['path','connect-timeout','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x3e1e92,_0x1a8c2a){var _0xc32d72=function(_0x559b87){while(--_0x559b87){_0x3e1e92['push'](_0x3e1e92['shift']());}};_0xc32d72(++_0x1a8c2a);}(_0x6d38,0x1ef));var _0x86d3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6d38[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x86d3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x86d3('0x4'));var controller=require(_0x86d3('0x5'));router[_0x86d3('0x6')]('/',auth['isAuthenticated'](),controller[_0x86d3('0x7')]);router[_0x86d3('0x6')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller['show']);router['post']('/',auth[_0x86d3('0x9')](),controller[_0x86d3('0xa')]);router[_0x86d3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xc')]);router[_0x86d3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 61ab6ce..46914fb 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 _0x183e=['exports','TEXT','sequelize'];(function(_0x34bb74,_0x1394c8){var _0x4c03a1=function(_0x47c7de){while(--_0x47c7de){_0x34bb74['push'](_0x34bb74['shift']());}};_0x4c03a1(++_0x1394c8);}(_0x183e,0x12b));var _0xe183=function(_0x32d46f,_0x4dcab3){_0x32d46f=_0x32d46f-0x0;var _0x501629=_0x183e[_0x32d46f];return _0x501629;};'use strict';var Sequelize=require(_0xe183('0x0'));module[_0xe183('0x1')]={'tree':{'type':Sequelize[_0xe183('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdbcb=['TEXT','sequelize','exports'];(function(_0x28181a,_0x365a35){var _0x52da6f=function(_0x5194fd){while(--_0x5194fd){_0x28181a['push'](_0x28181a['shift']());}};_0x52da6f(++_0x365a35);}(_0xdbcb,0xdf));var _0xbdbc=function(_0x14806a,_0x14d122){_0x14806a=_0x14806a-0x0;var _0x12e125=_0xdbcb[_0x14806a];return _0x12e125;};'use strict';var Sequelize=require(_0xbdbc('0x0'));module[_0xbdbc('0x1')]={'tree':{'type':Sequelize[_0xbdbc('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 341c4de..b7c1a23 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 _0xc98c=['sox','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','apply','reject','save','update','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','then','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0xc98c,0x1ba));var _0xcc98=function(_0x2add96,_0x166a6a){_0x2add96=_0x2add96-0x0;var _0xa59bc=_0xc98c[_0x2add96];return _0xa59bc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xcc98('0x0'));var zipdir=require(_0xcc98('0x1'));var jsonpatch=require(_0xcc98('0x2'));var rp=require(_0xcc98('0x3'));var moment=require(_0xcc98('0x4'));var BPromise=require(_0xcc98('0x5'));var Mustache=require(_0xcc98('0x6'));var util=require(_0xcc98('0x7'));var path=require('path');var sox=require(_0xcc98('0x8'));var csv=require('to-csv');var ejs=require(_0xcc98('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcc98('0xa'));var crypto=require(_0xcc98('0xb'));var jsforce=require(_0xcc98('0xc'));var deskjs=require(_0xcc98('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcc98('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcc98('0xf'));var qs=require(_0xcc98('0x10'));var as=require(_0xcc98('0x11'));var hardwareService=require(_0xcc98('0x12'));var logger=require(_0xcc98('0x13'))(_0xcc98('0x14'));var utils=require(_0xcc98('0x15'));var config=require(_0xcc98('0x16'));var db=require(_0xcc98('0x17'))['db'];function respondWithStatusCode(_0x21fb9e,_0x2ec386){_0x2ec386=_0x2ec386||0xcc;return function(_0x434af3){if(_0x434af3){return _0x21fb9e[_0xcc98('0x18')](_0x2ec386);}return _0x21fb9e['status'](_0x2ec386)[_0xcc98('0x19')]();};}function respondWithResult(_0x2f9e7e,_0x3717a5){_0x3717a5=_0x3717a5||0xc8;return function(_0x588e7c){if(_0x588e7c){return _0x2f9e7e[_0xcc98('0x1a')](_0x3717a5)[_0xcc98('0x1b')](_0x588e7c);}};}function respondWithFilteredResult(_0x542aee,_0x1976ad){return function(_0xfc16b4){if(_0xfc16b4){var _0x360bc3=_0xfc16b4[_0xcc98('0x1c')],_0x238447=_0x1976ad[_0xcc98('0x1d')],_0x2c31e8=_0x1976ad[_0xcc98('0x1d')]+_0x1976ad['limit'],_0x14d9b6;if(_0x2c31e8>=_0x360bc3){_0x2c31e8=_0x360bc3;_0x14d9b6=0xc8;}else{_0x14d9b6=0xce;}_0x542aee[_0xcc98('0x1a')](_0x14d9b6);return _0x542aee['set']('Content-Range',_0x238447+'-'+_0x2c31e8+'/'+_0x360bc3)[_0xcc98('0x1b')](_0xfc16b4);}return null;};}function patchUpdates(_0x3e571d){return function(_0x38f036){try{jsonpatch[_0xcc98('0x1e')](_0x38f036,_0x3e571d,!![]);}catch(_0x369fe2){return BPromise[_0xcc98('0x1f')](_0x369fe2);}return _0x38f036[_0xcc98('0x20')]();};}function saveUpdates(_0x5c7c12,_0x206978){return function(_0xf4900d){if(_0xf4900d){return _0xf4900d[_0xcc98('0x21')](_0x5c7c12)['then'](function(_0xdbb134){return _0xdbb134;});}return null;};}function removeEntity(_0x1bad20,_0x24df82){return function(_0x3d305c){if(_0x3d305c){return _0x3d305c['destroy']()['then'](function(){_0x1bad20[_0xcc98('0x1a')](0xcc)[_0xcc98('0x19')]();});}};}function handleEntityNotFound(_0x3a00d9,_0x5f3992){return function(_0x1967a2){if(!_0x1967a2){_0x3a00d9[_0xcc98('0x18')](0x194);}return _0x1967a2;};}function handleError(_0x28abc4,_0xde4ff6){_0xde4ff6=_0xde4ff6||0x1f4;return function(_0x43e2e9){logger[_0xcc98('0x22')](_0x43e2e9[_0xcc98('0x23')]);if(_0x43e2e9[_0xcc98('0x24')]){delete _0x43e2e9[_0xcc98('0x24')];}_0x28abc4['status'](_0xde4ff6)[_0xcc98('0x25')](_0x43e2e9);};}exports[_0xcc98('0x26')]=function(_0x3b2d0d,_0x1cac2c){var _0x389421={},_0x25b388={},_0x20a032={'count':0x0,'rows':[]};var _0x4452f0=_[_0xcc98('0x27')](db[_0xcc98('0x28')]['rawAttributes'],function(_0x27da76){return{'name':_0x27da76[_0xcc98('0x29')],'type':_0x27da76[_0xcc98('0x2a')][_0xcc98('0x2b')]};});_0x25b388['model']=_['map'](_0x4452f0,_0xcc98('0x24'));_0x25b388['query']=_[_0xcc98('0x2c')](_0x3b2d0d[_0xcc98('0x2d')]);_0x25b388[_0xcc98('0x2e')]=_[_0xcc98('0x2f')](_0x25b388[_0xcc98('0x30')],_0x25b388['query']);_0x389421[_0xcc98('0x31')]=_[_0xcc98('0x2f')](_0x25b388[_0xcc98('0x30')],qs[_0xcc98('0x32')](_0x3b2d0d[_0xcc98('0x2d')][_0xcc98('0x32')]));_0x389421[_0xcc98('0x31')]=_0x389421[_0xcc98('0x31')][_0xcc98('0x33')]?_0x389421[_0xcc98('0x31')]:_0x25b388[_0xcc98('0x30')];if(!_0x3b2d0d['query'][_0xcc98('0x34')](_0xcc98('0x35'))){_0x389421[_0xcc98('0x36')]=qs[_0xcc98('0x36')](_0x3b2d0d['query'][_0xcc98('0x36')]);_0x389421[_0xcc98('0x1d')]=qs['offset'](_0x3b2d0d[_0xcc98('0x2d')]['offset']);}_0x389421[_0xcc98('0x37')]=qs[_0xcc98('0x38')](_0x3b2d0d[_0xcc98('0x2d')][_0xcc98('0x38')]);_0x389421[_0xcc98('0x39')]=qs['filters'](_[_0xcc98('0x3a')](_0x3b2d0d[_0xcc98('0x2d')],_0x25b388['filters']),_0x4452f0);if(_0x3b2d0d[_0xcc98('0x2d')]['filter']){_0x389421[_0xcc98('0x39')]=_[_0xcc98('0x3b')](_0x389421['where'],{'$or':_['map'](_0x4452f0,function(_0x29ceaa){if(_0x29ceaa[_0xcc98('0x2a')]!==_0xcc98('0x3c')){var _0x40f7e8={};_0x40f7e8[_0x29ceaa['name']]={'$like':'%'+_0x3b2d0d[_0xcc98('0x2d')]['filter']+'%'};return _0x40f7e8;}})});}_0x389421=_[_0xcc98('0x3b')]({},_0x389421,_0x3b2d0d[_0xcc98('0x3d')]);var _0x3a63cc={'where':_0x389421[_0xcc98('0x39')]};return db[_0xcc98('0x28')][_0xcc98('0x1c')](_0x3a63cc)[_0xcc98('0x3e')](function(_0x4c8236){_0x20a032[_0xcc98('0x1c')]=_0x4c8236;if(_0x3b2d0d[_0xcc98('0x2d')]['includeAll']){_0x389421[_0xcc98('0x3f')]=[{'all':!![]}];}return db[_0xcc98('0x28')][_0xcc98('0x40')](_0x389421);})[_0xcc98('0x3e')](function(_0x3446ab){_0x20a032[_0xcc98('0x41')]=_0x3446ab;return _0x20a032;})[_0xcc98('0x3e')](respondWithFilteredResult(_0x1cac2c,_0x389421))[_0xcc98('0x42')](handleError(_0x1cac2c,null));};exports[_0xcc98('0x43')]=function(_0x1ec541,_0x19eb3f){var _0x5c1e77={'raw':!![],'where':{'id':_0x1ec541[_0xcc98('0x44')]['id']}},_0x550048={};_0x550048[_0xcc98('0x30')]=_[_0xcc98('0x2c')](db[_0xcc98('0x28')][_0xcc98('0x45')]);_0x550048[_0xcc98('0x2d')]=_[_0xcc98('0x2c')](_0x1ec541[_0xcc98('0x2d')]);_0x550048[_0xcc98('0x2e')]=_[_0xcc98('0x2f')](_0x550048['model'],_0x550048[_0xcc98('0x2d')]);_0x5c1e77[_0xcc98('0x31')]=_[_0xcc98('0x2f')](_0x550048[_0xcc98('0x30')],qs[_0xcc98('0x32')](_0x1ec541[_0xcc98('0x2d')][_0xcc98('0x32')]));_0x5c1e77[_0xcc98('0x31')]=_0x5c1e77['attributes'][_0xcc98('0x33')]?_0x5c1e77[_0xcc98('0x31')]:_0x550048[_0xcc98('0x30')];if(_0x1ec541['query'][_0xcc98('0x46')]){_0x5c1e77[_0xcc98('0x3f')]=[{'all':!![]}];}_0x5c1e77=_['merge']({},_0x5c1e77,_0x1ec541[_0xcc98('0x3d')]);return db[_0xcc98('0x28')]['find'](_0x5c1e77)[_0xcc98('0x3e')](handleEntityNotFound(_0x19eb3f,null))[_0xcc98('0x3e')](respondWithResult(_0x19eb3f,null))['catch'](handleError(_0x19eb3f,null));};exports[_0xcc98('0x47')]=function(_0x28189b,_0x4bec49){return db[_0xcc98('0x28')][_0xcc98('0x47')](_0x28189b[_0xcc98('0x48')],{})['then'](respondWithResult(_0x4bec49,0xc9))[_0xcc98('0x42')](handleError(_0x4bec49,null));};exports['update']=function(_0x50616a,_0x1705e7){if(_0x50616a[_0xcc98('0x48')]['id']){delete _0x50616a[_0xcc98('0x48')]['id'];}return db[_0xcc98('0x28')][_0xcc98('0x49')]({'where':{'id':_0x50616a[_0xcc98('0x44')]['id']}})[_0xcc98('0x3e')](handleEntityNotFound(_0x1705e7,null))[_0xcc98('0x3e')](saveUpdates(_0x50616a['body'],null))[_0xcc98('0x3e')](respondWithResult(_0x1705e7,null))['catch'](handleError(_0x1705e7,null));};exports[_0xcc98('0x4a')]=function(_0x65c32a,_0x252efc){return db['AnalyticTreeReport'][_0xcc98('0x49')]({'where':{'id':_0x65c32a[_0xcc98('0x44')]['id']}})[_0xcc98('0x3e')](handleEntityNotFound(_0x252efc,null))[_0xcc98('0x3e')](removeEntity(_0x252efc,null))[_0xcc98('0x42')](handleError(_0x252efc,null));}; \ No newline at end of file +var _0xf1dc=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','catch','show','find','create','body','params','destroy','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x5b4aae,_0x32a354){var _0x2698e2=function(_0x292b81){while(--_0x292b81){_0x5b4aae['push'](_0x5b4aae['shift']());}};_0x2698e2(++_0x32a354);}(_0xf1dc,0x1b8));var _0xcf1d=function(_0x344db7,_0x397fcf){_0x344db7=_0x344db7-0x0;var _0x31ff0b=_0xf1dc[_0x344db7];return _0x31ff0b;};'use strict';var pdf=require(_0xcf1d('0x0'));var emlformat=require(_0xcf1d('0x1'));var rimraf=require(_0xcf1d('0x2'));var zipdir=require(_0xcf1d('0x3'));var jsonpatch=require(_0xcf1d('0x4'));var rp=require(_0xcf1d('0x5'));var moment=require(_0xcf1d('0x6'));var BPromise=require(_0xcf1d('0x7'));var Mustache=require(_0xcf1d('0x8'));var util=require('util');var path=require('path');var sox=require(_0xcf1d('0x9'));var csv=require('to-csv');var ejs=require(_0xcf1d('0xa'));var fs=require('fs');var _=require(_0xcf1d('0xb'));var squel=require(_0xcf1d('0xc'));var crypto=require(_0xcf1d('0xd'));var jsforce=require(_0xcf1d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcf1d('0xf'));var querystring=require(_0xcf1d('0x10'));var Papa=require(_0xcf1d('0x11'));var Redis=require(_0xcf1d('0x12'));var authService=require(_0xcf1d('0x13'));var qs=require(_0xcf1d('0x14'));var as=require(_0xcf1d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf1d('0x16'))(_0xcf1d('0x17'));var utils=require(_0xcf1d('0x18'));var config=require(_0xcf1d('0x19'));var db=require(_0xcf1d('0x1a'))['db'];function respondWithStatusCode(_0x432f0d,_0x155be1){_0x155be1=_0x155be1||0xcc;return function(_0x103476){if(_0x103476){return _0x432f0d[_0xcf1d('0x1b')](_0x155be1);}return _0x432f0d[_0xcf1d('0x1c')](_0x155be1)[_0xcf1d('0x1d')]();};}function respondWithResult(_0x51b61e,_0x2ba226){_0x2ba226=_0x2ba226||0xc8;return function(_0x1122ed){if(_0x1122ed){return _0x51b61e['status'](_0x2ba226)[_0xcf1d('0x1e')](_0x1122ed);}};}function respondWithFilteredResult(_0x240ef5,_0x10e1f0){return function(_0x26f443){if(_0x26f443){var _0x45ddb1=_0x26f443[_0xcf1d('0x1f')],_0x19bbf9=_0x10e1f0[_0xcf1d('0x20')],_0x15259e=_0x10e1f0[_0xcf1d('0x20')]+_0x10e1f0[_0xcf1d('0x21')],_0x19b880;if(_0x15259e>=_0x45ddb1){_0x15259e=_0x45ddb1;_0x19b880=0xc8;}else{_0x19b880=0xce;}_0x240ef5[_0xcf1d('0x1c')](_0x19b880);return _0x240ef5[_0xcf1d('0x22')]('Content-Range',_0x19bbf9+'-'+_0x15259e+'/'+_0x45ddb1)['json'](_0x26f443);}return null;};}function patchUpdates(_0x23504a){return function(_0x4e6afe){try{jsonpatch[_0xcf1d('0x23')](_0x4e6afe,_0x23504a,!![]);}catch(_0xc0f744){return BPromise[_0xcf1d('0x24')](_0xc0f744);}return _0x4e6afe[_0xcf1d('0x25')]();};}function saveUpdates(_0x2b191d,_0x3cbb65){return function(_0x399083){if(_0x399083){return _0x399083[_0xcf1d('0x26')](_0x2b191d)[_0xcf1d('0x27')](function(_0x33537b){return _0x33537b;});}return null;};}function removeEntity(_0x3e5efe,_0x12fe34){return function(_0x94cc8){if(_0x94cc8){return _0x94cc8['destroy']()[_0xcf1d('0x27')](function(){_0x3e5efe['status'](0xcc)[_0xcf1d('0x1d')]();});}};}function handleEntityNotFound(_0x638a6c,_0x4a2494){return function(_0x2ef185){if(!_0x2ef185){_0x638a6c['sendStatus'](0x194);}return _0x2ef185;};}function handleError(_0x259e28,_0x1208b5){_0x1208b5=_0x1208b5||0x1f4;return function(_0x548654){logger[_0xcf1d('0x28')](_0x548654['stack']);if(_0x548654[_0xcf1d('0x29')]){delete _0x548654[_0xcf1d('0x29')];}_0x259e28[_0xcf1d('0x1c')](_0x1208b5)['send'](_0x548654);};}exports[_0xcf1d('0x2a')]=function(_0xf847ea,_0x5bbd2b){var _0x48d198={},_0x3a3ef0={},_0x192fc4={'count':0x0,'rows':[]};var _0x4557bb=_[_0xcf1d('0x2b')](db[_0xcf1d('0x2c')][_0xcf1d('0x2d')],function(_0x54e20c){return{'name':_0x54e20c[_0xcf1d('0x2e')],'type':_0x54e20c[_0xcf1d('0x2f')][_0xcf1d('0x30')]};});_0x3a3ef0[_0xcf1d('0x31')]=_['map'](_0x4557bb,_0xcf1d('0x29'));_0x3a3ef0[_0xcf1d('0x32')]=_[_0xcf1d('0x33')](_0xf847ea[_0xcf1d('0x32')]);_0x3a3ef0[_0xcf1d('0x34')]=_[_0xcf1d('0x35')](_0x3a3ef0[_0xcf1d('0x31')],_0x3a3ef0[_0xcf1d('0x32')]);_0x48d198[_0xcf1d('0x36')]=_['intersection'](_0x3a3ef0['model'],qs['fields'](_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x37')]));_0x48d198[_0xcf1d('0x36')]=_0x48d198[_0xcf1d('0x36')][_0xcf1d('0x38')]?_0x48d198[_0xcf1d('0x36')]:_0x3a3ef0[_0xcf1d('0x31')];if(!_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x39')](_0xcf1d('0x3a'))){_0x48d198[_0xcf1d('0x21')]=qs[_0xcf1d('0x21')](_0xf847ea[_0xcf1d('0x32')]['limit']);_0x48d198[_0xcf1d('0x20')]=qs['offset'](_0xf847ea['query']['offset']);}_0x48d198[_0xcf1d('0x3b')]=qs['sort'](_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x3c')]);_0x48d198['where']=qs[_0xcf1d('0x34')](_['pick'](_0xf847ea[_0xcf1d('0x32')],_0x3a3ef0['filters']),_0x4557bb);if(_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x3d')]){_0x48d198[_0xcf1d('0x3e')]=_[_0xcf1d('0x3f')](_0x48d198[_0xcf1d('0x3e')],{'$or':_[_0xcf1d('0x2b')](_0x4557bb,function(_0x23e583){if(_0x23e583[_0xcf1d('0x2f')]!==_0xcf1d('0x40')){var _0x1c6a48={};_0x1c6a48[_0x23e583[_0xcf1d('0x29')]]={'$like':'%'+_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x3d')]+'%'};return _0x1c6a48;}})});}_0x48d198=_[_0xcf1d('0x3f')]({},_0x48d198,_0xf847ea['options']);var _0x13bf0d={'where':_0x48d198[_0xcf1d('0x3e')]};return db[_0xcf1d('0x2c')][_0xcf1d('0x1f')](_0x13bf0d)[_0xcf1d('0x27')](function(_0x4c508e){_0x192fc4[_0xcf1d('0x1f')]=_0x4c508e;if(_0xf847ea[_0xcf1d('0x32')][_0xcf1d('0x41')]){_0x48d198[_0xcf1d('0x42')]=[{'all':!![]}];}return db[_0xcf1d('0x2c')]['findAll'](_0x48d198);})['then'](function(_0x26f03f){_0x192fc4['rows']=_0x26f03f;return _0x192fc4;})[_0xcf1d('0x27')](respondWithFilteredResult(_0x5bbd2b,_0x48d198))[_0xcf1d('0x43')](handleError(_0x5bbd2b,null));};exports[_0xcf1d('0x44')]=function(_0x247fe1,_0x3e0276){var _0x4bdb38={'raw':!![],'where':{'id':_0x247fe1['params']['id']}},_0x4944e5={};_0x4944e5[_0xcf1d('0x31')]=_[_0xcf1d('0x33')](db['AnalyticTreeReport'][_0xcf1d('0x2d')]);_0x4944e5['query']=_[_0xcf1d('0x33')](_0x247fe1[_0xcf1d('0x32')]);_0x4944e5['filters']=_[_0xcf1d('0x35')](_0x4944e5[_0xcf1d('0x31')],_0x4944e5[_0xcf1d('0x32')]);_0x4bdb38[_0xcf1d('0x36')]=_[_0xcf1d('0x35')](_0x4944e5[_0xcf1d('0x31')],qs['fields'](_0x247fe1[_0xcf1d('0x32')][_0xcf1d('0x37')]));_0x4bdb38[_0xcf1d('0x36')]=_0x4bdb38[_0xcf1d('0x36')][_0xcf1d('0x38')]?_0x4bdb38[_0xcf1d('0x36')]:_0x4944e5[_0xcf1d('0x31')];if(_0x247fe1[_0xcf1d('0x32')]['includeAll']){_0x4bdb38[_0xcf1d('0x42')]=[{'all':!![]}];}_0x4bdb38=_[_0xcf1d('0x3f')]({},_0x4bdb38,_0x247fe1['options']);return db[_0xcf1d('0x2c')][_0xcf1d('0x45')](_0x4bdb38)[_0xcf1d('0x27')](handleEntityNotFound(_0x3e0276,null))[_0xcf1d('0x27')](respondWithResult(_0x3e0276,null))[_0xcf1d('0x43')](handleError(_0x3e0276,null));};exports[_0xcf1d('0x46')]=function(_0x57c47c,_0x5d6c84){return db[_0xcf1d('0x2c')][_0xcf1d('0x46')](_0x57c47c[_0xcf1d('0x47')],{})[_0xcf1d('0x27')](respondWithResult(_0x5d6c84,0xc9))['catch'](handleError(_0x5d6c84,null));};exports['update']=function(_0x398d3c,_0x20133c){if(_0x398d3c[_0xcf1d('0x47')]['id']){delete _0x398d3c[_0xcf1d('0x47')]['id'];}return db[_0xcf1d('0x2c')][_0xcf1d('0x45')]({'where':{'id':_0x398d3c[_0xcf1d('0x48')]['id']}})[_0xcf1d('0x27')](handleEntityNotFound(_0x20133c,null))['then'](saveUpdates(_0x398d3c[_0xcf1d('0x47')],null))['then'](respondWithResult(_0x20133c,null))['catch'](handleError(_0x20133c,null));};exports[_0xcf1d('0x49')]=function(_0x2db647,_0x1b900f){return db[_0xcf1d('0x2c')][_0xcf1d('0x45')]({'where':{'id':_0x2db647['params']['id']}})[_0xcf1d('0x27')](handleEntityNotFound(_0x1b900f,null))[_0xcf1d('0x27')](removeEntity(_0x1b900f,null))['catch'](handleError(_0x1b900f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index e4e28c4..be518bb 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 _0xade8=['define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x12a5ac,_0x4cb0d2){var _0x282958=function(_0x3ae041){while(--_0x3ae041){_0x12a5ac['push'](_0x12a5ac['shift']());}};_0x282958(++_0x4cb0d2);}(_0xade8,0xe3));var _0x8ade=function(_0xa77f8b,_0x3a8fdb){_0xa77f8b=_0xa77f8b-0x0;var _0x341b0d=_0xade8[_0xa77f8b];return _0x341b0d;};'use strict';var _=require(_0x8ade('0x0'));var util=require(_0x8ade('0x1'));var logger=require('../../config/logger')(_0x8ade('0x2'));var moment=require(_0x8ade('0x3'));var BPromise=require(_0x8ade('0x4'));var rp=require(_0x8ade('0x5'));var fs=require('fs');var path=require(_0x8ade('0x6'));var rimraf=require(_0x8ade('0x7'));var config=require(_0x8ade('0x8'));var attributes=require(_0x8ade('0x9'));module[_0x8ade('0xa')]=function(_0x276ed3,_0x42ab64){return _0x276ed3[_0x8ade('0xb')](_0x8ade('0xc'),attributes,{'tableName':_0x8ade('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1422=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x309d2c,_0x3efb7b){var _0x44bdd4=function(_0x5d68d4){while(--_0x5d68d4){_0x309d2c['push'](_0x309d2c['shift']());}};_0x44bdd4(++_0x3efb7b);}(_0x1422,0x18c));var _0x2142=function(_0x3c2318,_0x3c3687){_0x3c2318=_0x3c2318-0x0;var _0x4fc71f=_0x1422[_0x3c2318];return _0x4fc71f;};'use strict';var _=require(_0x2142('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2142('0x1'));var moment=require(_0x2142('0x2'));var BPromise=require(_0x2142('0x3'));var rp=require(_0x2142('0x4'));var fs=require('fs');var path=require(_0x2142('0x5'));var rimraf=require(_0x2142('0x6'));var config=require(_0x2142('0x7'));var attributes=require(_0x2142('0x8'));module[_0x2142('0x9')]=function(_0x18d8a8,_0x38f0eb){return _0x18d8a8[_0x2142('0xa')](_0x2142('0xb'),attributes,{'tableName':_0x2142('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index bbe89ca..ee14f4d 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 _0x0b8f=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x2920f6,_0x28b957){var _0x46efaa=function(_0x6a2bc){while(--_0x6a2bc){_0x2920f6['push'](_0x2920f6['shift']());}};_0x46efaa(++_0x28b957);}(_0x0b8f,0x105));var _0xf0b8=function(_0x341cb0,_0x5281eb){_0x341cb0=_0x341cb0-0x0;var _0x11e21d=_0x0b8f[_0x341cb0];return _0x11e21d;};'use strict';var _=require(_0xf0b8('0x0'));var util=require(_0xf0b8('0x1'));var moment=require(_0xf0b8('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0b8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0b8('0x4'))['db'];var utils=require(_0xf0b8('0x5'));var logger=require(_0xf0b8('0x6'))(_0xf0b8('0x7'));var config=require(_0xf0b8('0x8'));var jayson=require(_0xf0b8('0x9'));var client=jayson[_0xf0b8('0xa')][_0xf0b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11be94,_0x423682,_0x5752c0){return new BPromise(function(_0x109592,_0x1406c5){return client[_0xf0b8('0xc')](_0x11be94,_0x5752c0)['then'](function(_0x147de4){logger[_0xf0b8('0xd')](_0xf0b8('0xe'),_0x423682,_0xf0b8('0xf'));logger[_0xf0b8('0x10')](_0xf0b8('0x11'),_0x423682,_0xf0b8('0xf'),JSON[_0xf0b8('0x12')](_0x147de4));if(_0x147de4[_0xf0b8('0x13')]){if(_0x147de4[_0xf0b8('0x13')]['code']===0x1f4){logger[_0xf0b8('0x13')](_0xf0b8('0xe'),_0x423682,_0x147de4['error'][_0xf0b8('0x14')]);return _0x1406c5(_0x147de4[_0xf0b8('0x13')][_0xf0b8('0x14')]);}logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x423682,_0x147de4[_0xf0b8('0x13')][_0xf0b8('0x14')]);return _0x109592(_0x147de4['error'][_0xf0b8('0x14')]);}else{logger[_0xf0b8('0xd')](_0xf0b8('0xe'),_0x423682,_0xf0b8('0xf'));_0x109592(_0x147de4[_0xf0b8('0x15')][_0xf0b8('0x14')]);}})['catch'](function(_0x25044d){logger[_0xf0b8('0x13')](_0xf0b8('0xe'),_0x423682,_0x25044d);_0x1406c5(_0x25044d);});});} \ No newline at end of file +var _0x5d4a=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error'];(function(_0xce3950,_0x2aa683){var _0x163fbc=function(_0x5d9868){while(--_0x5d9868){_0xce3950['push'](_0xce3950['shift']());}};_0x163fbc(++_0x2aa683);}(_0x5d4a,0xfe));var _0xa5d4=function(_0x3ea266,_0x3dfa17){_0x3ea266=_0x3ea266-0x0;var _0x473fc0=_0x5d4a[_0x3ea266];return _0x473fc0;};'use strict';var _=require(_0xa5d4('0x0'));var util=require(_0xa5d4('0x1'));var moment=require(_0xa5d4('0x2'));var BPromise=require(_0xa5d4('0x3'));var rs=require(_0xa5d4('0x4'));var fs=require('fs');var Redis=require(_0xa5d4('0x5'));var db=require(_0xa5d4('0x6'))['db'];var utils=require(_0xa5d4('0x7'));var logger=require(_0xa5d4('0x8'))(_0xa5d4('0x9'));var config=require('../../config/environment');var jayson=require(_0xa5d4('0xa'));var client=jayson['client'][_0xa5d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x552eb9,_0x1d7a61,_0x27a1e8){return new BPromise(function(_0x4f9bf6,_0x11df96){return client[_0xa5d4('0xc')](_0x552eb9,_0x27a1e8)['then'](function(_0x17c201){logger[_0xa5d4('0xd')](_0xa5d4('0xe'),_0x1d7a61,_0xa5d4('0xf'));logger[_0xa5d4('0x10')](_0xa5d4('0x11'),_0x1d7a61,_0xa5d4('0xf'),JSON['stringify'](_0x17c201));if(_0x17c201['error']){if(_0x17c201[_0xa5d4('0x12')]['code']===0x1f4){logger[_0xa5d4('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1d7a61,_0x17c201[_0xa5d4('0x12')]['message']);return _0x11df96(_0x17c201[_0xa5d4('0x12')]['message']);}logger[_0xa5d4('0x12')](_0xa5d4('0xe'),_0x1d7a61,_0x17c201[_0xa5d4('0x12')]['message']);return _0x4f9bf6(_0x17c201[_0xa5d4('0x12')]['message']);}else{logger[_0xa5d4('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1d7a61,_0xa5d4('0xf'));_0x4f9bf6(_0x17c201[_0xa5d4('0x13')]['message']);}})[_0xa5d4('0x14')](function(_0x3f2e84){logger[_0xa5d4('0x12')](_0xa5d4('0xe'),_0x1d7a61,_0x3f2e84);_0x11df96(_0x3f2e84);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 1410c5a..f0ee33c 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 _0x02fe=['Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x33f1f1,_0x3f2a10){var _0x3052d4=function(_0x2d62ad){while(--_0x2d62ad){_0x33f1f1['push'](_0x33f1f1['shift']());}};_0x3052d4(++_0x3f2a10);}(_0x02fe,0x105));var _0xe02f=function(_0x23c581,_0x43d94d){_0x23c581=_0x23c581-0x0;var _0x188e1e=_0x02fe[_0x23c581];return _0x188e1e;};'use strict';var multer=require(_0xe02f('0x0'));var util=require(_0xe02f('0x1'));var path=require(_0xe02f('0x2'));var timeout=require(_0xe02f('0x3'));var express=require(_0xe02f('0x4'));var router=express[_0xe02f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe02f('0x6'));var config=require(_0xe02f('0x7'));var controller=require(_0xe02f('0x8'));router[_0xe02f('0x9')]('/',auth[_0xe02f('0xa')](),controller[_0xe02f('0xb')]);router[_0xe02f('0x9')](_0xe02f('0xc'),auth[_0xe02f('0xa')](),controller['show']);router[_0xe02f('0xd')]('/',auth['isAuthenticated'](),controller[_0xe02f('0xe')]);router[_0xe02f('0xf')](_0xe02f('0xc'),auth['isAuthenticated'](),controller[_0xe02f('0x10')]);router[_0xe02f('0x11')]('/:id',auth[_0xe02f('0xa')](),controller[_0xe02f('0x12')]);module['exports']=router; \ No newline at end of file +var _0xad87=['./analyticTreeReport.controller','isAuthenticated','index','get','post','put','/:id','update','destroy','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x135904,_0x1e252b){var _0x1ce7d5=function(_0x25a721){while(--_0x25a721){_0x135904['push'](_0x135904['shift']());}};_0x1ce7d5(++_0x1e252b);}(_0xad87,0xf9));var _0x7ad8=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xad87[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x7ad8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7ad8('0x1'));var express=require(_0x7ad8('0x2'));var router=express[_0x7ad8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7ad8('0x4'));var config=require(_0x7ad8('0x5'));var controller=require(_0x7ad8('0x6'));router['get']('/',auth[_0x7ad8('0x7')](),controller[_0x7ad8('0x8')]);router[_0x7ad8('0x9')]('/:id',auth[_0x7ad8('0x7')](),controller['show']);router[_0x7ad8('0xa')]('/',auth[_0x7ad8('0x7')](),controller['create']);router[_0x7ad8('0xb')](_0x7ad8('0xc'),auth[_0x7ad8('0x7')](),controller[_0x7ad8('0xd')]);router['delete']('/:id',auth[_0x7ad8('0x7')](),controller[_0x7ad8('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index b26af50..94c3475 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 _0x32c9=['STRING'];(function(_0x2cd1fb,_0x291f55){var _0x48fd2b=function(_0x18e23e){while(--_0x18e23e){_0x2cd1fb['push'](_0x2cd1fb['shift']());}};_0x48fd2b(++_0x291f55);}(_0x32c9,0x154));var _0x932c=function(_0x229e0a,_0x288c0a){_0x229e0a=_0x229e0a-0x0;var _0x36315d=_0x32c9[_0x229e0a];return _0x36315d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x932c('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x932c('0x0')]}}; \ No newline at end of file +var _0x72c9=['STRING'];(function(_0x565c9d,_0x1127c9){var _0x5036b9=function(_0x16aaed){while(--_0x16aaed){_0x565c9d['push'](_0x565c9d['shift']());}};_0x5036b9(++_0x1127c9);}(_0x72c9,0x1be));var _0x972c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72c9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x972c('0x0')]},'basename':{'type':Sequelize[_0x972c('0x0')]},'type':{'type':Sequelize[_0x972c('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 4f3983d..9119746 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 _0x540d=['get','omit','createdAt','body','updatedAt','create','destroy','file','originalname','basename','filename','mimetype','download','findOne','join','root','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','end','count','offset','limit','status','set','json','apply','reject','save','update','then','error','stack','name','send','index','map','Attachment','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','show','rawAttributes','find','catch','clone','params'];(function(_0x14c66a,_0x2c05bb){var _0xf13aa0=function(_0x3a851c){while(--_0x3a851c){_0x14c66a['push'](_0x14c66a['shift']());}};_0xf13aa0(++_0x2c05bb);}(_0x540d,0x100));var _0xd540=function(_0xfc94e,_0x1976cf){_0xfc94e=_0xfc94e-0x0;var _0x13b4fe=_0x540d[_0xfc94e];return _0x13b4fe;};'use strict';var pdf=require(_0xd540('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd540('0x1'));var rp=require(_0xd540('0x2'));var moment=require(_0xd540('0x3'));var BPromise=require(_0xd540('0x4'));var Mustache=require(_0xd540('0x5'));var util=require('util');var path=require(_0xd540('0x6'));var sox=require(_0xd540('0x7'));var csv=require(_0xd540('0x8'));var ejs=require(_0xd540('0x9'));var fs=require('fs');var _=require(_0xd540('0xa'));var squel=require(_0xd540('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd540('0xc'));var authService=require(_0xd540('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xd540('0xe'));var hardwareService=require(_0xd540('0xf'));var logger=require('../../config/logger')(_0xd540('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd540('0x11'))['db'];function respondWithStatusCode(_0x408841,_0x269d41){_0x269d41=_0x269d41||0xcc;return function(_0x8348da){if(_0x8348da){return _0x408841['sendStatus'](_0x269d41);}return _0x408841['status'](_0x269d41)[_0xd540('0x12')]();};}function respondWithResult(_0x179696,_0x272e34){_0x272e34=_0x272e34||0xc8;return function(_0x5cc2d2){if(_0x5cc2d2){return _0x179696['status'](_0x272e34)['json'](_0x5cc2d2);}};}function respondWithFilteredResult(_0x506651,_0x25b36a){return function(_0x3b08e3){if(_0x3b08e3){var _0xc4d6fe=_0x3b08e3[_0xd540('0x13')],_0x6326d8=_0x25b36a[_0xd540('0x14')],_0x33bb34=_0x25b36a[_0xd540('0x14')]+_0x25b36a[_0xd540('0x15')],_0x3c2da0;if(_0x33bb34>=_0xc4d6fe){_0x33bb34=_0xc4d6fe;_0x3c2da0=0xc8;}else{_0x3c2da0=0xce;}_0x506651[_0xd540('0x16')](_0x3c2da0);return _0x506651[_0xd540('0x17')]('Content-Range',_0x6326d8+'-'+_0x33bb34+'/'+_0xc4d6fe)[_0xd540('0x18')](_0x3b08e3);}return null;};}function patchUpdates(_0x297fca){return function(_0x178344){try{jsonpatch[_0xd540('0x19')](_0x178344,_0x297fca,!![]);}catch(_0x4f0b99){return BPromise[_0xd540('0x1a')](_0x4f0b99);}return _0x178344[_0xd540('0x1b')]();};}function saveUpdates(_0x5b9d4a,_0x255d38){return function(_0x2aa757){if(_0x2aa757){return _0x2aa757[_0xd540('0x1c')](_0x5b9d4a)['then'](function(_0xc308f8){return _0xc308f8;});}return null;};}function removeEntity(_0x5b5bfe,_0x2e875c){return function(_0x227e11){if(_0x227e11){return _0x227e11['destroy']()[_0xd540('0x1d')](function(){_0x5b5bfe[_0xd540('0x16')](0xcc)[_0xd540('0x12')]();});}};}function handleEntityNotFound(_0xdc1aca,_0x15cbb0){return function(_0x54846d){if(!_0x54846d){_0xdc1aca['sendStatus'](0x194);}return _0x54846d;};}function handleError(_0x42bd26,_0x192dd5){_0x192dd5=_0x192dd5||0x1f4;return function(_0x556e32){logger[_0xd540('0x1e')](_0x556e32[_0xd540('0x1f')]);if(_0x556e32[_0xd540('0x20')]){delete _0x556e32[_0xd540('0x20')];}_0x42bd26[_0xd540('0x16')](_0x192dd5)[_0xd540('0x21')](_0x556e32);};}exports[_0xd540('0x22')]=function(_0x4779c1,_0xc490de){var _0x446c1f={},_0x3df895={},_0x3b75a6={'count':0x0,'rows':[]};var _0x5b378b=_[_0xd540('0x23')](db[_0xd540('0x24')]['rawAttributes'],function(_0x42e835){return{'name':_0x42e835[_0xd540('0x25')],'type':_0x42e835[_0xd540('0x26')][_0xd540('0x27')]};});_0x3df895[_0xd540('0x28')]=_[_0xd540('0x23')](_0x5b378b,'name');_0x3df895[_0xd540('0x29')]=_[_0xd540('0x2a')](_0x4779c1[_0xd540('0x29')]);_0x3df895[_0xd540('0x2b')]=_[_0xd540('0x2c')](_0x3df895[_0xd540('0x28')],_0x3df895[_0xd540('0x29')]);_0x446c1f['attributes']=_['intersection'](_0x3df895['model'],qs[_0xd540('0x2d')](_0x4779c1[_0xd540('0x29')][_0xd540('0x2d')]));_0x446c1f[_0xd540('0x2e')]=_0x446c1f['attributes'][_0xd540('0x2f')]?_0x446c1f['attributes']:_0x3df895[_0xd540('0x28')];if(!_0x4779c1[_0xd540('0x29')][_0xd540('0x30')](_0xd540('0x31'))){_0x446c1f[_0xd540('0x15')]=qs[_0xd540('0x15')](_0x4779c1[_0xd540('0x29')][_0xd540('0x15')]);_0x446c1f['offset']=qs['offset'](_0x4779c1['query'][_0xd540('0x14')]);}_0x446c1f['order']=qs[_0xd540('0x32')](_0x4779c1[_0xd540('0x29')]['sort']);_0x446c1f[_0xd540('0x33')]=qs['filters'](_['pick'](_0x4779c1[_0xd540('0x29')],_0x3df895[_0xd540('0x2b')]),_0x5b378b);if(_0x4779c1['query'][_0xd540('0x34')]){_0x446c1f[_0xd540('0x33')]=_[_0xd540('0x35')](_0x446c1f[_0xd540('0x33')],{'$or':_[_0xd540('0x23')](_0x5b378b,function(_0x561832){if(_0x561832[_0xd540('0x26')]!==_0xd540('0x36')){var _0x24a033={};_0x24a033[_0x561832[_0xd540('0x20')]]={'$like':'%'+_0x4779c1['query']['filter']+'%'};return _0x24a033;}})});}_0x446c1f=_[_0xd540('0x35')]({},_0x446c1f,_0x4779c1['options']);var _0x39c5b9={'where':_0x446c1f[_0xd540('0x33')]};return db[_0xd540('0x24')]['count'](_0x39c5b9)[_0xd540('0x1d')](function(_0x58acf0){_0x3b75a6[_0xd540('0x13')]=_0x58acf0;if(_0x4779c1[_0xd540('0x29')][_0xd540('0x37')]){_0x446c1f[_0xd540('0x38')]=[{'all':!![]}];}return db['Attachment'][_0xd540('0x39')](_0x446c1f);})[_0xd540('0x1d')](function(_0x1807e1){_0x3b75a6['rows']=_0x1807e1;return _0x3b75a6;})['then'](respondWithFilteredResult(_0xc490de,_0x446c1f))['catch'](handleError(_0xc490de,null));};exports[_0xd540('0x3a')]=function(_0x22e219,_0x5663e1){var _0x29f8eb={'raw':!![],'where':{'id':_0x22e219['params']['id']}},_0x3d9088={};_0x3d9088[_0xd540('0x28')]=_[_0xd540('0x2a')](db[_0xd540('0x24')][_0xd540('0x3b')]);_0x3d9088[_0xd540('0x29')]=_[_0xd540('0x2a')](_0x22e219[_0xd540('0x29')]);_0x3d9088['filters']=_['intersection'](_0x3d9088['model'],_0x3d9088[_0xd540('0x29')]);_0x29f8eb[_0xd540('0x2e')]=_[_0xd540('0x2c')](_0x3d9088['model'],qs['fields'](_0x22e219[_0xd540('0x29')][_0xd540('0x2d')]));_0x29f8eb[_0xd540('0x2e')]=_0x29f8eb[_0xd540('0x2e')][_0xd540('0x2f')]?_0x29f8eb[_0xd540('0x2e')]:_0x3d9088['model'];if(_0x22e219[_0xd540('0x29')][_0xd540('0x37')]){_0x29f8eb[_0xd540('0x38')]=[{'all':!![]}];}_0x29f8eb=_[_0xd540('0x35')]({},_0x29f8eb,_0x22e219['options']);return db[_0xd540('0x24')][_0xd540('0x3c')](_0x29f8eb)['then'](handleEntityNotFound(_0x5663e1,null))['then'](respondWithResult(_0x5663e1,null))[_0xd540('0x3d')](handleError(_0x5663e1,null));};exports[_0xd540('0x3e')]=function(_0x2a4835,_0x25bf26){var _0x1454ab={'where':{'id':_0x2a4835[_0xd540('0x3f')]['id']}},_0x49a98e={};_0x49a98e[_0xd540('0x28')]=_[_0xd540('0x2a')](db['Attachment'][_0xd540('0x3b')]);_0x1454ab[_0xd540('0x2e')]=_[_0xd540('0x2c')](_0x49a98e[_0xd540('0x28')],qs[_0xd540('0x2d')](_0x2a4835[_0xd540('0x29')][_0xd540('0x2d')]));_0x1454ab[_0xd540('0x2e')]=_0x1454ab[_0xd540('0x2e')]['length']?_0x1454ab[_0xd540('0x2e')]:_0x49a98e[_0xd540('0x28')];if(_0x2a4835['query']['includeAll']){_0x1454ab[_0xd540('0x38')]=[{'all':!![]}];}_0x1454ab=_[_0xd540('0x35')]({},_0x1454ab,_0x2a4835['options']);return db['Attachment']['find'](_0x1454ab)[_0xd540('0x1d')](handleEntityNotFound(_0x25bf26,null))[_0xd540('0x1d')](function(_0xbf987){if(_0xbf987){var _0x2427d4=_0xbf987[_0xd540('0x40')]({'plain':!![]});_0x2427d4=qs[_0xd540('0x41')](_0x2427d4,['id',_0xd540('0x42'),'updatedAt']);_0x2a4835[_0xd540('0x43')]=_[_0xd540('0x41')](_0x2a4835[_0xd540('0x43')],['id',_0xd540('0x42'),_0xd540('0x44')]);return db[_0xd540('0x24')][_0xd540('0x45')](_[_0xd540('0x35')](_0x2427d4,_0x2a4835[_0xd540('0x43')]),{'include':_0x2a4835['query'][_0xd540('0x37')]?[{'all':!![]}]:undefined});}})[_0xd540('0x1d')](respondWithResult(_0x25bf26,0xc9))[_0xd540('0x3d')](handleError(_0x25bf26,null));};exports['update']=function(_0x3ba3dc,_0x1ed644){if(_0x3ba3dc['body']['id']){delete _0x3ba3dc[_0xd540('0x43')]['id'];}return db[_0xd540('0x24')]['find']({'where':{'id':_0x3ba3dc['params']['id']}})[_0xd540('0x1d')](handleEntityNotFound(_0x1ed644,null))[_0xd540('0x1d')](saveUpdates(_0x3ba3dc[_0xd540('0x43')],null))[_0xd540('0x1d')](respondWithResult(_0x1ed644,null))[_0xd540('0x3d')](handleError(_0x1ed644,null));};exports[_0xd540('0x46')]=function(_0x547b9d,_0x3099ed){return db[_0xd540('0x24')]['find']({'where':{'id':_0x547b9d[_0xd540('0x3f')]['id']}})[_0xd540('0x1d')](handleEntityNotFound(_0x3099ed,null))['then'](removeEntity(_0x3099ed,null))[_0xd540('0x3d')](handleError(_0x3099ed,null));};exports[_0xd540('0x45')]=function(_0x281049,_0x3aec76,_0x246b24){_0x281049[_0xd540('0x43')][_0xd540('0x20')]=_0x281049[_0xd540('0x47')][_0xd540('0x48')];_0x281049['body'][_0xd540('0x49')]=_0x281049[_0xd540('0x47')][_0xd540('0x4a')];_0x281049[_0xd540('0x43')][_0xd540('0x26')]=_0x281049[_0xd540('0x47')][_0xd540('0x4b')];return db[_0xd540('0x24')][_0xd540('0x45')](_0x281049[_0xd540('0x43')])[_0xd540('0x1d')](respondWithResult(_0x3aec76,0xc9))[_0xd540('0x3d')](handleError(_0x3aec76,null));};exports[_0xd540('0x4c')]=function(_0x6c2345,_0x2df7ad,_0x4825bf){return db[_0xd540('0x24')][_0xd540('0x4d')]({'where':{'id':_0x6c2345[_0xd540('0x3f')]['id']},'raw':!![]})[_0xd540('0x1d')](handleEntityNotFound(_0x2df7ad,null))['then'](function(_0x55e498){if(_0x55e498){return _0x2df7ad[_0xd540('0x4c')](path[_0xd540('0x4e')](config[_0xd540('0x4f')],'server/files/attachments/',_0x55e498[_0xd540('0x49')]));}})[_0xd540('0x3d')](handleError(_0x2df7ad,null));}; \ No newline at end of file +var _0x88db=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','index','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','Attachment','findAll','rows','catch','show','params','find','clone','get','omit','updatedAt','body','file','originalname','basename','filename','download','findOne','root','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x18f1f6,_0x316d99){var _0x292635=function(_0x821524){while(--_0x821524){_0x18f1f6['push'](_0x18f1f6['shift']());}};_0x292635(++_0x316d99);}(_0x88db,0x13c));var _0xb88d=function(_0x37a41a,_0x3bb1ad){_0x37a41a=_0x37a41a-0x0;var _0x3382b0=_0x88db[_0x37a41a];return _0x3382b0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb88d('0x0'));var rimraf=require(_0xb88d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb88d('0x2'));var moment=require(_0xb88d('0x3'));var BPromise=require(_0xb88d('0x4'));var Mustache=require(_0xb88d('0x5'));var util=require('util');var path=require(_0xb88d('0x6'));var sox=require(_0xb88d('0x7'));var csv=require(_0xb88d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb88d('0x9'));var squel=require('squel');var crypto=require(_0xb88d('0xa'));var jsforce=require(_0xb88d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb88d('0x8'));var querystring=require(_0xb88d('0xc'));var Papa=require(_0xb88d('0xd'));var Redis=require('ioredis');var authService=require(_0xb88d('0xe'));var qs=require(_0xb88d('0xf'));var as=require(_0xb88d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb88d('0x11'))(_0xb88d('0x12'));var utils=require(_0xb88d('0x13'));var config=require(_0xb88d('0x14'));var db=require(_0xb88d('0x15'))['db'];function respondWithStatusCode(_0x14b42f,_0x5a035d){_0x5a035d=_0x5a035d||0xcc;return function(_0x552886){if(_0x552886){return _0x14b42f['sendStatus'](_0x5a035d);}return _0x14b42f[_0xb88d('0x16')](_0x5a035d)[_0xb88d('0x17')]();};}function respondWithResult(_0x581312,_0x3fdc91){_0x3fdc91=_0x3fdc91||0xc8;return function(_0x578fd5){if(_0x578fd5){return _0x581312[_0xb88d('0x16')](_0x3fdc91)[_0xb88d('0x18')](_0x578fd5);}};}function respondWithFilteredResult(_0x434337,_0x306ead){return function(_0x44328a){if(_0x44328a){var _0x26e916=_0x44328a[_0xb88d('0x19')],_0xdd63ea=_0x306ead[_0xb88d('0x1a')],_0x4ad575=_0x306ead[_0xb88d('0x1a')]+_0x306ead[_0xb88d('0x1b')],_0x8d0e8f;if(_0x4ad575>=_0x26e916){_0x4ad575=_0x26e916;_0x8d0e8f=0xc8;}else{_0x8d0e8f=0xce;}_0x434337[_0xb88d('0x16')](_0x8d0e8f);return _0x434337[_0xb88d('0x1c')](_0xb88d('0x1d'),_0xdd63ea+'-'+_0x4ad575+'/'+_0x26e916)[_0xb88d('0x18')](_0x44328a);}return null;};}function patchUpdates(_0x5c31f8){return function(_0x256a6c){try{jsonpatch['apply'](_0x256a6c,_0x5c31f8,!![]);}catch(_0x103eff){return BPromise[_0xb88d('0x1e')](_0x103eff);}return _0x256a6c[_0xb88d('0x1f')]();};}function saveUpdates(_0x33e25b,_0x29bae9){return function(_0x4c532c){if(_0x4c532c){return _0x4c532c[_0xb88d('0x20')](_0x33e25b)[_0xb88d('0x21')](function(_0x39c71c){return _0x39c71c;});}return null;};}function removeEntity(_0x104ed1,_0x5c4b2f){return function(_0x36aa7f){if(_0x36aa7f){return _0x36aa7f[_0xb88d('0x22')]()[_0xb88d('0x21')](function(){_0x104ed1['status'](0xcc)[_0xb88d('0x17')]();});}};}function handleEntityNotFound(_0x513fad,_0x1275e4){return function(_0x50b303){if(!_0x50b303){_0x513fad[_0xb88d('0x23')](0x194);}return _0x50b303;};}function handleError(_0x301582,_0x5601a2){_0x5601a2=_0x5601a2||0x1f4;return function(_0x36bb92){logger[_0xb88d('0x24')](_0x36bb92[_0xb88d('0x25')]);if(_0x36bb92['name']){delete _0x36bb92['name'];}_0x301582[_0xb88d('0x16')](_0x5601a2)[_0xb88d('0x26')](_0x36bb92);};}exports[_0xb88d('0x27')]=function(_0xcc62cd,_0x41020b){var _0xc9089a={},_0x2375d5={},_0x1b4a8={'count':0x0,'rows':[]};var _0x3f32a9=_['map'](db['Attachment'][_0xb88d('0x28')],function(_0x1f2846){return{'name':_0x1f2846[_0xb88d('0x29')],'type':_0x1f2846[_0xb88d('0x2a')][_0xb88d('0x2b')]};});_0x2375d5[_0xb88d('0x2c')]=_[_0xb88d('0x2d')](_0x3f32a9,_0xb88d('0x2e'));_0x2375d5[_0xb88d('0x2f')]=_[_0xb88d('0x30')](_0xcc62cd['query']);_0x2375d5['filters']=_[_0xb88d('0x31')](_0x2375d5[_0xb88d('0x2c')],_0x2375d5['query']);_0xc9089a['attributes']=_[_0xb88d('0x31')](_0x2375d5[_0xb88d('0x2c')],qs[_0xb88d('0x32')](_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x32')]));_0xc9089a[_0xb88d('0x33')]=_0xc9089a['attributes'][_0xb88d('0x34')]?_0xc9089a['attributes']:_0x2375d5['model'];if(!_0xcc62cd['query'][_0xb88d('0x35')](_0xb88d('0x36'))){_0xc9089a[_0xb88d('0x1b')]=qs[_0xb88d('0x1b')](_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x1b')]);_0xc9089a[_0xb88d('0x1a')]=qs['offset'](_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x1a')]);}_0xc9089a[_0xb88d('0x37')]=qs[_0xb88d('0x38')](_0xcc62cd[_0xb88d('0x2f')]['sort']);_0xc9089a[_0xb88d('0x39')]=qs['filters'](_[_0xb88d('0x3a')](_0xcc62cd[_0xb88d('0x2f')],_0x2375d5['filters']),_0x3f32a9);if(_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x3b')]){_0xc9089a['where']=_[_0xb88d('0x3c')](_0xc9089a[_0xb88d('0x39')],{'$or':_[_0xb88d('0x2d')](_0x3f32a9,function(_0x429322){if(_0x429322[_0xb88d('0x2a')]!=='VIRTUAL'){var _0x590c0d={};_0x590c0d[_0x429322[_0xb88d('0x2e')]]={'$like':'%'+_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x3b')]+'%'};return _0x590c0d;}})});}_0xc9089a=_[_0xb88d('0x3c')]({},_0xc9089a,_0xcc62cd[_0xb88d('0x3d')]);var _0x4ce4f8={'where':_0xc9089a['where']};return db['Attachment']['count'](_0x4ce4f8)[_0xb88d('0x21')](function(_0x2d9ffa){_0x1b4a8[_0xb88d('0x19')]=_0x2d9ffa;if(_0xcc62cd[_0xb88d('0x2f')][_0xb88d('0x3e')]){_0xc9089a[_0xb88d('0x3f')]=[{'all':!![]}];}return db[_0xb88d('0x40')][_0xb88d('0x41')](_0xc9089a);})[_0xb88d('0x21')](function(_0x4ab7db){_0x1b4a8[_0xb88d('0x42')]=_0x4ab7db;return _0x1b4a8;})['then'](respondWithFilteredResult(_0x41020b,_0xc9089a))[_0xb88d('0x43')](handleError(_0x41020b,null));};exports[_0xb88d('0x44')]=function(_0x33f758,_0x4123a6){var _0x4821ae={'raw':!![],'where':{'id':_0x33f758[_0xb88d('0x45')]['id']}},_0x3952b1={};_0x3952b1[_0xb88d('0x2c')]=_['keys'](db[_0xb88d('0x40')]['rawAttributes']);_0x3952b1[_0xb88d('0x2f')]=_[_0xb88d('0x30')](_0x33f758[_0xb88d('0x2f')]);_0x3952b1['filters']=_[_0xb88d('0x31')](_0x3952b1['model'],_0x3952b1[_0xb88d('0x2f')]);_0x4821ae[_0xb88d('0x33')]=_[_0xb88d('0x31')](_0x3952b1['model'],qs[_0xb88d('0x32')](_0x33f758['query'][_0xb88d('0x32')]));_0x4821ae[_0xb88d('0x33')]=_0x4821ae[_0xb88d('0x33')][_0xb88d('0x34')]?_0x4821ae[_0xb88d('0x33')]:_0x3952b1[_0xb88d('0x2c')];if(_0x33f758[_0xb88d('0x2f')]['includeAll']){_0x4821ae[_0xb88d('0x3f')]=[{'all':!![]}];}_0x4821ae=_[_0xb88d('0x3c')]({},_0x4821ae,_0x33f758['options']);return db['Attachment'][_0xb88d('0x46')](_0x4821ae)[_0xb88d('0x21')](handleEntityNotFound(_0x4123a6,null))['then'](respondWithResult(_0x4123a6,null))[_0xb88d('0x43')](handleError(_0x4123a6,null));};exports[_0xb88d('0x47')]=function(_0x4a12a2,_0x223c5e){var _0x4724f5={'where':{'id':_0x4a12a2[_0xb88d('0x45')]['id']}},_0x456283={};_0x456283['model']=_[_0xb88d('0x30')](db[_0xb88d('0x40')]['rawAttributes']);_0x4724f5[_0xb88d('0x33')]=_['intersection'](_0x456283[_0xb88d('0x2c')],qs['fields'](_0x4a12a2[_0xb88d('0x2f')][_0xb88d('0x32')]));_0x4724f5[_0xb88d('0x33')]=_0x4724f5['attributes']['length']?_0x4724f5[_0xb88d('0x33')]:_0x456283[_0xb88d('0x2c')];if(_0x4a12a2['query'][_0xb88d('0x3e')]){_0x4724f5[_0xb88d('0x3f')]=[{'all':!![]}];}_0x4724f5=_[_0xb88d('0x3c')]({},_0x4724f5,_0x4a12a2[_0xb88d('0x3d')]);return db[_0xb88d('0x40')]['find'](_0x4724f5)[_0xb88d('0x21')](handleEntityNotFound(_0x223c5e,null))['then'](function(_0x15b7a9){if(_0x15b7a9){var _0x24e296=_0x15b7a9[_0xb88d('0x48')]({'plain':!![]});_0x24e296=qs[_0xb88d('0x49')](_0x24e296,['id','createdAt',_0xb88d('0x4a')]);_0x4a12a2[_0xb88d('0x4b')]=_[_0xb88d('0x49')](_0x4a12a2[_0xb88d('0x4b')],['id','createdAt',_0xb88d('0x4a')]);return db['Attachment']['create'](_['merge'](_0x24e296,_0x4a12a2[_0xb88d('0x4b')]),{'include':_0x4a12a2[_0xb88d('0x2f')][_0xb88d('0x3e')]?[{'all':!![]}]:undefined});}})[_0xb88d('0x21')](respondWithResult(_0x223c5e,0xc9))[_0xb88d('0x43')](handleError(_0x223c5e,null));};exports[_0xb88d('0x20')]=function(_0x9ebb2a,_0x4041ed){if(_0x9ebb2a[_0xb88d('0x4b')]['id']){delete _0x9ebb2a['body']['id'];}return db[_0xb88d('0x40')][_0xb88d('0x46')]({'where':{'id':_0x9ebb2a[_0xb88d('0x45')]['id']}})[_0xb88d('0x21')](handleEntityNotFound(_0x4041ed,null))[_0xb88d('0x21')](saveUpdates(_0x9ebb2a[_0xb88d('0x4b')],null))['then'](respondWithResult(_0x4041ed,null))[_0xb88d('0x43')](handleError(_0x4041ed,null));};exports[_0xb88d('0x22')]=function(_0x192d87,_0x268839){return db[_0xb88d('0x40')][_0xb88d('0x46')]({'where':{'id':_0x192d87[_0xb88d('0x45')]['id']}})[_0xb88d('0x21')](handleEntityNotFound(_0x268839,null))[_0xb88d('0x21')](removeEntity(_0x268839,null))[_0xb88d('0x43')](handleError(_0x268839,null));};exports['create']=function(_0x907f24,_0x34846b,_0x2faa3a){_0x907f24[_0xb88d('0x4b')][_0xb88d('0x2e')]=_0x907f24[_0xb88d('0x4c')][_0xb88d('0x4d')];_0x907f24[_0xb88d('0x4b')][_0xb88d('0x4e')]=_0x907f24[_0xb88d('0x4c')][_0xb88d('0x4f')];_0x907f24[_0xb88d('0x4b')][_0xb88d('0x2a')]=_0x907f24[_0xb88d('0x4c')]['mimetype'];return db[_0xb88d('0x40')]['create'](_0x907f24[_0xb88d('0x4b')])[_0xb88d('0x21')](respondWithResult(_0x34846b,0xc9))[_0xb88d('0x43')](handleError(_0x34846b,null));};exports[_0xb88d('0x50')]=function(_0x22b33f,_0x32f1e1,_0x3fca3){return db['Attachment'][_0xb88d('0x51')]({'where':{'id':_0x22b33f[_0xb88d('0x45')]['id']},'raw':!![]})[_0xb88d('0x21')](handleEntityNotFound(_0x32f1e1,null))[_0xb88d('0x21')](function(_0x42f1a6){if(_0x42f1a6){return _0x32f1e1['download'](path['join'](config[_0xb88d('0x52')],'server/files/attachments/',_0x42f1a6[_0xb88d('0x4e')]));}})[_0xb88d('0x43')](handleError(_0x32f1e1,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index de00fe0..d2f5aca 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 _0x8ce3=['./attachment.attributes','Attachment','attachments','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xaae0d4,_0x357c6c){var _0xdec0cf=function(_0x522afb){while(--_0x522afb){_0xaae0d4['push'](_0xaae0d4['shift']());}};_0xdec0cf(++_0x357c6c);}(_0x8ce3,0xc3));var _0x38ce=function(_0x447b8f,_0x396387){_0x447b8f=_0x447b8f-0x0;var _0x237474=_0x8ce3[_0x447b8f];return _0x237474;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var logger=require('../../config/logger')(_0x38ce('0x2'));var moment=require(_0x38ce('0x3'));var BPromise=require(_0x38ce('0x4'));var rp=require(_0x38ce('0x5'));var fs=require('fs');var path=require(_0x38ce('0x6'));var rimraf=require(_0x38ce('0x7'));var config=require(_0x38ce('0x8'));var attributes=require(_0x38ce('0x9'));module['exports']=function(_0x372f86,_0xb24f4c){return _0x372f86['define'](_0x38ce('0xa'),attributes,{'tableName':_0x38ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdb7=['request-promise','path','rimraf','./attachment.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x549928,_0x363b7a){_0x549928=_0x549928-0x0;var _0x941e27=_0xbdb7[_0x549928];return _0x941e27;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 0806329..d867baf 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 _0x985a=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','debug','lodash','util','moment'];(function(_0x46ab02,_0x5b35ac){var _0x35870d=function(_0x3f7ac8){while(--_0x3f7ac8){_0x46ab02['push'](_0x46ab02['shift']());}};_0x35870d(++_0x5b35ac);}(_0x985a,0x14d));var _0xa985=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x985a[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa985('0x0'));var util=require(_0xa985('0x1'));var moment=require(_0xa985('0x2'));var BPromise=require(_0xa985('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa985('0x4'))['db'];var utils=require(_0xa985('0x5'));var logger=require(_0xa985('0x6'))(_0xa985('0x7'));var config=require(_0xa985('0x8'));var jayson=require(_0xa985('0x9'));var client=jayson['client'][_0xa985('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xacaf3a,_0x2db7c6,_0x2dba64){return new BPromise(function(_0x29a191,_0x229a9e){return client['request'](_0xacaf3a,_0x2dba64)[_0xa985('0xb')](function(_0x29495f){logger[_0xa985('0xc')](_0xa985('0xd'),_0x2db7c6,_0xa985('0xe'));logger['debug'](_0xa985('0xf'),_0x2db7c6,'request\x20sent',JSON[_0xa985('0x10')](_0x29495f));if(_0x29495f[_0xa985('0x11')]){if(_0x29495f[_0xa985('0x11')]['code']===0x1f4){logger[_0xa985('0x11')](_0xa985('0xd'),_0x2db7c6,_0x29495f['error'][_0xa985('0x12')]);return _0x229a9e(_0x29495f['error'][_0xa985('0x12')]);}logger[_0xa985('0x11')](_0xa985('0xd'),_0x2db7c6,_0x29495f['error']['message']);return _0x29a191(_0x29495f[_0xa985('0x11')][_0xa985('0x12')]);}else{logger[_0xa985('0xc')](_0xa985('0xd'),_0x2db7c6,_0xa985('0xe'));_0x29a191(_0x29495f[_0xa985('0x13')][_0xa985('0x12')]);}})[_0xa985('0x14')](function(_0x2a0391){logger['error']('Attachment,\x20%s,\x20%s',_0x2db7c6,_0x2a0391);_0x229a9e(_0x2a0391);});});}exports[_0xa985('0x15')]=function(_0x9bd25f){var _0x1974ec=this;return new Promise(function(_0x247653,_0x5d595e){return db[_0xa985('0x16')][_0xa985('0x17')](_0x9bd25f[_0xa985('0x18')],{'raw':_0x9bd25f['options']?_0x9bd25f[_0xa985('0x19')][_0xa985('0x1a')]===undefined?!![]:![]:!![]})[_0xa985('0xb')](function(_0xc97495){logger['info'](_0xa985('0x15'),_0x9bd25f);logger[_0xa985('0x1b')](_0xa985('0x15'),_0x9bd25f,JSON[_0xa985('0x10')](_0xc97495));_0x247653(_0xc97495);})['catch'](function(_0x3f55c4){logger[_0xa985('0x11')]('CreateAttachment',_0x3f55c4[_0xa985('0x12')],_0x9bd25f);_0x5d595e(_0x1974ec[_0xa985('0x11')](0x1f4,_0x3f55c4[_0xa985('0x12')]));});});}; \ No newline at end of file +var _0x5cf5=['../../config/environment','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Attachment','create','body','options','CreateAttachment','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x189626,_0x396521){var _0xbfc0f1=function(_0x33b433){while(--_0x33b433){_0x189626['push'](_0x189626['shift']());}};_0xbfc0f1(++_0x396521);}(_0x5cf5,0xae));var _0x55cf=function(_0x3dec58,_0x2fb4bb){_0x3dec58=_0x3dec58-0x0;var _0x25360c=_0x5cf5[_0x3dec58];return _0x25360c;};'use strict';var _=require('lodash');var util=require(_0x55cf('0x0'));var moment=require('moment');var BPromise=require(_0x55cf('0x1'));var rs=require(_0x55cf('0x2'));var fs=require('fs');var Redis=require(_0x55cf('0x3'));var db=require(_0x55cf('0x4'))['db'];var utils=require(_0x55cf('0x5'));var logger=require(_0x55cf('0x6'))(_0x55cf('0x7'));var config=require(_0x55cf('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x55cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c2de2,_0x24dff1,_0x401a38){return new BPromise(function(_0x4e6c04,_0xe33d50){return client['request'](_0x2c2de2,_0x401a38)[_0x55cf('0xa')](function(_0x2212f6){logger[_0x55cf('0xb')](_0x55cf('0xc'),_0x24dff1,_0x55cf('0xd'));logger[_0x55cf('0xe')](_0x55cf('0xf'),_0x24dff1,'request\x20sent',JSON[_0x55cf('0x10')](_0x2212f6));if(_0x2212f6[_0x55cf('0x11')]){if(_0x2212f6['error'][_0x55cf('0x12')]===0x1f4){logger[_0x55cf('0x11')]('Attachment,\x20%s,\x20%s',_0x24dff1,_0x2212f6[_0x55cf('0x11')][_0x55cf('0x13')]);return _0xe33d50(_0x2212f6[_0x55cf('0x11')][_0x55cf('0x13')]);}logger[_0x55cf('0x11')](_0x55cf('0xc'),_0x24dff1,_0x2212f6[_0x55cf('0x11')][_0x55cf('0x13')]);return _0x4e6c04(_0x2212f6[_0x55cf('0x11')][_0x55cf('0x13')]);}else{logger[_0x55cf('0xb')](_0x55cf('0xc'),_0x24dff1,'request\x20sent');_0x4e6c04(_0x2212f6[_0x55cf('0x14')][_0x55cf('0x13')]);}})['catch'](function(_0x3f0191){logger[_0x55cf('0x11')]('Attachment,\x20%s,\x20%s',_0x24dff1,_0x3f0191);_0xe33d50(_0x3f0191);});});}exports['CreateAttachment']=function(_0x339aa9){var _0x349902=this;return new Promise(function(_0x2a2bea,_0x549548){return db[_0x55cf('0x15')][_0x55cf('0x16')](_0x339aa9[_0x55cf('0x17')],{'raw':_0x339aa9[_0x55cf('0x18')]?_0x339aa9[_0x55cf('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x55cf('0xa')](function(_0x57d7cd){logger[_0x55cf('0xb')](_0x55cf('0x19'),_0x339aa9);logger[_0x55cf('0xe')]('CreateAttachment',_0x339aa9,JSON[_0x55cf('0x10')](_0x57d7cd));_0x2a2bea(_0x57d7cd);})['catch'](function(_0x5706a0){logger[_0x55cf('0x11')](_0x55cf('0x19'),_0x5706a0['message'],_0x339aa9);_0x549548(_0x349902[_0x55cf('0x11')](0x1f4,_0x5706a0[_0x55cf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 2638c91..dc2e175 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 _0x0664=['../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','download','clone','diskStorage','server/files/attachments/','format','%s-%s','now','originalname','post','single','create','delete','destroy','exports','util','connect-timeout','express'];(function(_0x5cdbf4,_0x3f9cc5){var _0x3dbc6a=function(_0x15db90){while(--_0x15db90){_0x5cdbf4['push'](_0x5cdbf4['shift']());}};_0x3dbc6a(++_0x3f9cc5);}(_0x0664,0x93));var _0x4066=function(_0x2883fc,_0x10aa0c){_0x2883fc=_0x2883fc-0x0;var _0x54106e=_0x0664[_0x2883fc];return _0x54106e;};'use strict';var multer=require('multer');var util=require(_0x4066('0x0'));var path=require('path');var timeout=require(_0x4066('0x1'));var express=require(_0x4066('0x2'));var router=express['Router']();var auth=require(_0x4066('0x3'));var interaction=require(_0x4066('0x4'));var config=require(_0x4066('0x5'));var controller=require(_0x4066('0x6'));router[_0x4066('0x7')]('/',auth[_0x4066('0x8')](),controller[_0x4066('0x9')]);router[_0x4066('0x7')](_0x4066('0xa'),auth[_0x4066('0x8')](),controller['show']);router[_0x4066('0x7')]('/:id/download',auth[_0x4066('0x8')](),controller[_0x4066('0xb')]);router['post']('/:id/clone',auth[_0x4066('0x8')](),controller[_0x4066('0xc')]);var upload=multer({'storage':multer[_0x4066('0xd')]({'destination':function(_0x41ad8b,_0x5ec830,_0x551059){_0x551059(null,path['join'](config['root'],_0x4066('0xe')));},'filename':function(_0x1b1712,_0x10c353,_0x12d36c){_0x12d36c(null,util[_0x4066('0xf')](_0x4066('0x10'),Date[_0x4066('0x11')](),_0x10c353[_0x4066('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4066('0x13')]('/',upload[_0x4066('0x14')]('file'),controller[_0x4066('0x15')]);router['put'](_0x4066('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x4066('0x16')](_0x4066('0xa'),auth[_0x4066('0x8')](),controller[_0x4066('0x17')]);module[_0x4066('0x18')]=router; \ No newline at end of file +var _0x57b7=['show','/:id/download','download','/:id/clone','diskStorage','join','root','format','now','originalname','post','file','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./attachment.controller','get','isAuthenticated','/:id'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x57b7,0x160));var _0x757b=function(_0x1b5216,_0x2cc215){_0x1b5216=_0x1b5216-0x0;var _0x17cf41=_0x57b7[_0x1b5216];return _0x17cf41;};'use strict';var multer=require(_0x757b('0x0'));var util=require(_0x757b('0x1'));var path=require(_0x757b('0x2'));var timeout=require(_0x757b('0x3'));var express=require(_0x757b('0x4'));var router=express[_0x757b('0x5')]();var auth=require(_0x757b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x757b('0x7'));var controller=require(_0x757b('0x8'));router[_0x757b('0x9')]('/',auth[_0x757b('0xa')](),controller['index']);router[_0x757b('0x9')](_0x757b('0xb'),auth[_0x757b('0xa')](),controller[_0x757b('0xc')]);router[_0x757b('0x9')](_0x757b('0xd'),auth[_0x757b('0xa')](),controller[_0x757b('0xe')]);router['post'](_0x757b('0xf'),auth[_0x757b('0xa')](),controller['clone']);var upload=multer({'storage':multer[_0x757b('0x10')]({'destination':function(_0x5a0164,_0x35be15,_0x4cd8a4){_0x4cd8a4(null,path[_0x757b('0x11')](config[_0x757b('0x12')],'server/files/attachments/'));},'filename':function(_0x2af9cb,_0xf94550,_0x5d6f0e){_0x5d6f0e(null,util[_0x757b('0x13')]('%s-%s',Date[_0x757b('0x14')](),_0xf94550[_0x757b('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x757b('0x16')]('/',upload['single'](_0x757b('0x17')),controller[_0x757b('0x18')]);router[_0x757b('0x19')]('/:id',auth[_0x757b('0xa')](),controller[_0x757b('0x1a')]);router['delete'](_0x757b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x757b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d705757..b2007c2 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 _0xff77=['use','clientID','clientSecret','callbackURL','findOne','allowedLoginAttempts','then','find','value','admin','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','add','minutes','clearBlockUser','getLicense','passport-google-oauth20','Strategy','../../config/environment','../../components/auth/service','signToken','login','google','email','callback','/login'];(function(_0x355c3b,_0xae147a){var _0xcf072=function(_0x37dea0){while(--_0x37dea0){_0x355c3b['push'](_0x355c3b['shift']());}};_0xcf072(++_0xae147a);}(_0xff77,0x1c6));var _0x7ff7=function(_0xbf806a,_0x138c27){_0xbf806a=_0xbf806a-0x0;var _0x2c8f13=_0xff77[_0xbf806a];return _0x2c8f13;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0x7ff7('0x0'))[_0x7ff7('0x1')];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require(_0x7ff7('0x2'));var signToken=require(_0x7ff7('0x3'))[_0x7ff7('0x4')];var utils=require('../../config/utils');exports[_0x7ff7('0x5')]=passport['authenticate'](_0x7ff7('0x6'),{'failureRedirect':'/login','scope':['profile',_0x7ff7('0x7')],'session':![]});exports[_0x7ff7('0x8')]=passport['authenticate']('google',{'failureRedirect':_0x7ff7('0x9'),'session':![]});passport[_0x7ff7('0xa')](new GoogleStrategy({'clientID':config[_0x7ff7('0x6')]?config['google'][_0x7ff7('0xb')]:'id','clientSecret':config[_0x7ff7('0x6')]?config[_0x7ff7('0x6')][_0x7ff7('0xc')]:'secret','callbackURL':config['google']?config['google'][_0x7ff7('0xd')]:''},function(_0x117be2,_0x2e79b0,_0x360439,_0x1b120e){var _0x57ed11,_0x24fbda;return db['Setting'][_0x7ff7('0xe')]({'where':{'id':0x1},'attributes':[_0x7ff7('0xf'),'blockDuration'],'raw':!![]})[_0x7ff7('0x10')](function(_0x53f307){_0x57ed11=_0x53f307;return db['User'][_0x7ff7('0x11')]({'where':{'email':_['map'](_0x360439['emails'],_0x7ff7('0x12')),'role':{'$or':[_0x7ff7('0x13'),'user',_0x7ff7('0x14')]}}});})[_0x7ff7('0x10')](function(_0x557cba){_0x24fbda=_0x557cba;if(_0x24fbda){if(_0x24fbda[_0x7ff7('0x15')]){return _0x1b120e(_0x7ff7('0x16'));}else if(_0x57ed11[_0x7ff7('0x17')]>0x0){if(_0x24fbda[_0x7ff7('0x18')]){if(moment(_0x24fbda['blockedAt'])[_0x7ff7('0x19')](_0x57ed11[_0x7ff7('0x17')],_0x7ff7('0x1a'))>moment()){return _0x1b120e(_0x7ff7('0x16'));}else{return utils[_0x7ff7('0x1b')](_0x24fbda,0x0,![],null)['then'](function(){return utils[_0x7ff7('0x1c')](_0x24fbda);})['then'](function(){return _0x1b120e(null,_0x24fbda);});}}else{return utils[_0x7ff7('0x1c')](_0x24fbda)[_0x7ff7('0x10')](function(){return _0x1b120e(null,_0x24fbda);});}}else{return utils[_0x7ff7('0x1c')](_0x24fbda)[_0x7ff7('0x10')](function(){return _0x1b120e(null,_0x24fbda);});}}return _0x1b120e(_0x7ff7('0x16'));})['catch'](function(_0x58e940){_0x1b120e(_0x58e940);});})); \ No newline at end of file +var _0x82c3=['admin','agent','disabled','blocked','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','/login','email','callback','authenticate','use','clientID','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','value'];(function(_0x3aeb36,_0x312dc9){var _0xa2ef21=function(_0x50a46b){while(--_0x50a46b){_0x3aeb36['push'](_0x3aeb36['shift']());}};_0xa2ef21(++_0x312dc9);}(_0x82c3,0x1e5));var _0x382c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x82c3[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x382c('0x0'));var passport=require(_0x382c('0x1'));var GoogleStrategy=require(_0x382c('0x2'))['Strategy'];var moment=require(_0x382c('0x3'));var db=require(_0x382c('0x4'))['db'];var config=require(_0x382c('0x5'));var signToken=require(_0x382c('0x6'))[_0x382c('0x7')];var utils=require(_0x382c('0x8'));exports[_0x382c('0x9')]=passport['authenticate'](_0x382c('0xa'),{'failureRedirect':_0x382c('0xb'),'scope':['profile',_0x382c('0xc')],'session':![]});exports[_0x382c('0xd')]=passport[_0x382c('0xe')](_0x382c('0xa'),{'failureRedirect':_0x382c('0xb'),'session':![]});passport[_0x382c('0xf')](new GoogleStrategy({'clientID':config[_0x382c('0xa')]?config[_0x382c('0xa')][_0x382c('0x10')]:'id','clientSecret':config[_0x382c('0xa')]?config[_0x382c('0xa')]['clientSecret']:'secret','callbackURL':config[_0x382c('0xa')]?config[_0x382c('0xa')]['callbackURL']:''},function(_0x45bfba,_0x53d2b2,_0x57463c,_0x5b25d8){var _0x129346,_0x558dda;return db[_0x382c('0x11')][_0x382c('0x12')]({'where':{'id':0x1},'attributes':[_0x382c('0x13'),_0x382c('0x14')],'raw':!![]})[_0x382c('0x15')](function(_0x98967d){_0x129346=_0x98967d;return db[_0x382c('0x16')][_0x382c('0x17')]({'where':{'email':_['map'](_0x57463c['emails'],_0x382c('0x18')),'role':{'$or':[_0x382c('0x19'),'user',_0x382c('0x1a')]}}});})[_0x382c('0x15')](function(_0x44f03e){_0x558dda=_0x44f03e;if(_0x558dda){if(_0x558dda[_0x382c('0x1b')]){return _0x5b25d8('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x129346['blockDuration']>0x0){if(_0x558dda[_0x382c('0x1c')]){if(moment(_0x558dda['blockedAt'])['add'](_0x129346[_0x382c('0x14')],_0x382c('0x1d'))>moment()){return _0x5b25d8(_0x382c('0x1e'));}else{return utils[_0x382c('0x1f')](_0x558dda,0x0,![],null)['then'](function(){return utils['getLicense'](_0x558dda);})[_0x382c('0x15')](function(){return _0x5b25d8(null,_0x558dda);});}}else{return utils[_0x382c('0x20')](_0x558dda)[_0x382c('0x15')](function(){return _0x5b25d8(null,_0x558dda);});}}else{return utils[_0x382c('0x20')](_0x558dda)['then'](function(){return _0x5b25d8(null,_0x558dda);});}}return _0x5b25d8(_0x382c('0x1e'));})[_0x382c('0x21')](function(_0xacb30b){_0x5b25d8(_0xacb30b);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index df78373..510b709 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 _0xf46a=['Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf46a,0xa4));var _0xaf46=function(_0x46a7e6,_0x2119e6){_0x46a7e6=_0x46a7e6-0x0;var _0xf102b1=_0xf46a[_0x46a7e6];return _0xf102b1;};'use strict';var express=require(_0xaf46('0x0'));var passport=require('passport');var router=express[_0xaf46('0x1')]();var controller=require(_0xaf46('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xaf46('0x3'));router[_0xaf46('0x4')]('/',controller[_0xaf46('0x5')]);router[_0xaf46('0x4')](_0xaf46('0x6'),controller[_0xaf46('0x7')],authService[_0xaf46('0x8')],userController[_0xaf46('0x5')],authService[_0xaf46('0x9')]);module[_0xaf46('0xa')]=router; \ No newline at end of file +var _0x261b=['login','setTokenCookie','exports','express','passport','get','callback'];(function(_0x154d1d,_0x32c6e7){var _0x5d2db0=function(_0x4bd51d){while(--_0x4bd51d){_0x154d1d['push'](_0x154d1d['shift']());}};_0x5d2db0(++_0x32c6e7);}(_0x261b,0x15a));var _0xb261=function(_0x1ee87e,_0x370081){_0x1ee87e=_0x1ee87e-0x0;var _0x3aaf74=_0x261b[_0x1ee87e];return _0x3aaf74;};'use strict';var express=require(_0xb261('0x0'));var passport=require(_0xb261('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0xb261('0x2')]('/',controller['login']);router[_0xb261('0x2')]('/callback',controller[_0xb261('0x3')],authService['isMiddleware'],userController[_0xb261('0x4')],authService[_0xb261('0x5')]);module[_0xb261('0x6')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index f117376..6d9e6a3 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 _0x2b55=['password','salt','role','disabled','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','clearBlockUser','blocked','add','minutes','getLicense','catch','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','then','name'];(function(_0x32034d,_0x3cd7a9){var _0xe6a87d=function(_0xb9262c){while(--_0xb9262c){_0x32034d['push'](_0x32034d['shift']());}};_0xe6a87d(++_0x3cd7a9);}(_0x2b55,0x180));var _0x52b5=function(_0x27ee9f,_0x4e179e){_0x27ee9f=_0x27ee9f-0x0;var _0x2b9066=_0x2b55[_0x27ee9f];return _0x2b9066;};'use strict';var util=require(_0x52b5('0x0'));var passport=require(_0x52b5('0x1'));var LocalStrategy=require(_0x52b5('0x2'))[_0x52b5('0x3')];var jayson=require(_0x52b5('0x4'));var _=require(_0x52b5('0x5'));var rs=require(_0x52b5('0x6'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x52b5('0x7'));var utils=require(_0x52b5('0x8'));var client=jayson[_0x52b5('0x9')][_0x52b5('0xa')]({'port':0x232b});function localAuthenticate(_0x3582ad,_0x1c1ea2,_0x2bf6ad,_0x2af60a){var _0x4a0c79,_0x5548eb;return db[_0x52b5('0xb')][_0x52b5('0xc')]({'where':{'id':0x1},'attributes':[_0x52b5('0xd'),'blockDuration'],'raw':!![]})[_0x52b5('0xe')](function(_0x22b926){_0x4a0c79=_0x22b926;return _0x3582ad[_0x52b5('0xc')]({'attributes':['id',_0x52b5('0xf'),_0x52b5('0x10'),_0x52b5('0x11'),_0x52b5('0x12'),_0x52b5('0x13'),'blocked','blockedAt',_0x52b5('0x14')],'where':{'name':_0x1c1ea2,'role':{'$or':[_0x52b5('0x15'),_0x52b5('0x16'),_0x52b5('0x17')]}}});})[_0x52b5('0xe')](function(_0x46fa25){if(!_0x46fa25||_0x46fa25&&_0x46fa25[_0x52b5('0xf')]!==_0x1c1ea2){throw new Error(_0x52b5('0x18'));}else{_0x5548eb=_0x46fa25;return _0x5548eb;}})[_0x52b5('0xe')](function(){_0x5548eb['authenticate'](_0x2bf6ad,function(_0x1e43c5,_0xf3dfdf){var _0x29afb5=_0x5548eb[_0x52b5('0x14')]+0x1;if(_0x1e43c5){return _0x2af60a(_0x1e43c5);}else if(!_0xf3dfdf){if(_0x5548eb[_0x52b5('0x13')]){return _0x2af60a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4a0c79['allowedLoginAttempts']>0x0){if(_0x5548eb['blocked']){if(_0x4a0c79[_0x52b5('0x19')]>0x0){if(moment(_0x5548eb[_0x52b5('0x1a')])['add'](_0x4a0c79[_0x52b5('0x19')],'minutes')>moment()){return _0x2af60a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x5548eb,_0x29afb5,![],null)[_0x52b5('0xe')](function(){return _0x2af60a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x2af60a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x29afb5>=_0x4a0c79[_0x52b5('0xd')]){return utils['clearBlockUser'](_0x5548eb,0x0,!![],moment())['then'](function(){return _0x2af60a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x52b5('0x1b')](_0x5548eb,_0x29afb5,![],null)['then'](function(){return _0x2af60a(null,![],{'message':_0x52b5('0x18')});});}}}else{return _0x2af60a(null,![],{'message':_0x52b5('0x18')});}}else{if(_0x5548eb[_0x52b5('0x13')]){return _0x2af60a(null,![],{'message':_0x52b5('0x18')});}else if(_0x4a0c79[_0x52b5('0xd')]>0x0){if(_0x5548eb[_0x52b5('0x1c')]){if(_0x4a0c79['blockDuration']>0x0){if(moment(_0x5548eb['blockedAt'])[_0x52b5('0x1d')](_0x4a0c79[_0x52b5('0x19')],_0x52b5('0x1e'))>moment()){return _0x2af60a(null,![],{'message':_0x52b5('0x18')});}else{return utils[_0x52b5('0x1b')](_0x5548eb,0x0,![],null)[_0x52b5('0xe')](function(){return utils[_0x52b5('0x1f')](_0x5548eb);})[_0x52b5('0xe')](function(){return _0x2af60a(null,_0x5548eb);});}}else{return _0x2af60a(null,![],{'message':_0x52b5('0x18')});}}else{return utils['clearBlockUser'](_0x5548eb,0x0,![],null)['then'](function(){return utils[_0x52b5('0x1f')](_0x5548eb);})[_0x52b5('0xe')](function(){return _0x2af60a(null,_0x5548eb);})['catch'](function(_0x40fd99){return _0x2af60a(null,![],_0x40fd99);});}}else{if(_0x5548eb[_0x52b5('0x1c')]){return _0x2af60a(null,![],{'message':_0x52b5('0x18')});}else{return utils[_0x52b5('0x1f')](_0x5548eb)[_0x52b5('0xe')](function(){return _0x2af60a(null,_0x5548eb);});}}}});})[_0x52b5('0x20')](function(_0x227d8e){return _0x2af60a(null,![],_0x227d8e);});}function sendServiceMail(_0x4c4ccf){return db['MailAccount'][_0x52b5('0x21')]({'where':{'service':!![]},'attributes':['id',_0x52b5('0xf'),_0x52b5('0x22')],'include':[{'model':db['MailServerOut'],'as':_0x52b5('0x23')}]})['then'](function(_0x345f94){if(!_0x345f94){throw new Error(_0x52b5('0x24'));}var _0x3cd5bd={'tls':{'rejectUnauthorized':![]}};if(_0x345f94['Smtp'][_0x52b5('0x25')]){_0x3cd5bd[_0x52b5('0x25')]=_0x345f94[_0x52b5('0x23')][_0x52b5('0x25')];}else{_0x3cd5bd[_0x52b5('0x26')]=_0x345f94[_0x52b5('0x23')][_0x52b5('0x26')];_0x3cd5bd[_0x52b5('0x27')]=_0x345f94['Smtp'][_0x52b5('0x27')];_0x3cd5bd[_0x52b5('0x28')]=_0x345f94[_0x52b5('0x23')][_0x52b5('0x28')];}if(_0x345f94[_0x52b5('0x23')][_0x52b5('0x29')]){_0x3cd5bd[_0x52b5('0x2a')]={'user':_0x345f94[_0x52b5('0x23')][_0x52b5('0x16')],'pass':_0x345f94[_0x52b5('0x23')][_0x52b5('0x2b')]};}var _0xedb170={'account':_0x3cd5bd,'message':_['merge']({'from':util[_0x52b5('0x2c')]('\x22%s\x22\x20<%s>',_0x345f94['name'],_0x345f94['email']||_0x345f94[_0x52b5('0x23')][_0x52b5('0x16')])},_0x4c4ccf)};return client[_0x52b5('0x2d')](_0x52b5('0x2e'),_0xedb170);})['then'](function(_0x245a93){if(_0x245a93[_0x52b5('0x2f')]){throw new Error(util[_0x52b5('0x2c')](_0x52b5('0x30'),_0x245a93['error'][_0x52b5('0x31')]||JSON[_0x52b5('0x32')](_0x245a93[_0x52b5('0x2f')])));}return!![];});}function handleError(_0x2c0d35,_0x186154,_0x4bc0dd){return _0x2c0d35['status'](_0x186154||0x1f4)[_0x52b5('0x33')]({'message':_0x4bc0dd?_0x4bc0dd[_0x52b5('0x31')]||_0x4bc0dd:''});}function checkPasswordPattern(_0x39da26,_0x1bcf2a,_0x2865c1){if(_0x2865c1){var _0x172cb2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x172cb2[_0x52b5('0x34')](_0x1bcf2a)){return _0x39da26;}else{throw new Error(_0x52b5('0x35'));}}else{return _0x39da26;}}exports[_0x52b5('0x36')]=function(_0x64a110,_0x2473b2,_0x2ced2b){passport['authenticate']('local',function(_0x5c7d1b,_0x4e7b2d,_0x1cf3ab){var _0xbc167=_0x5c7d1b||_0x1cf3ab;if(_0xbc167){return handleError(_0x2473b2,0x191,_0xbc167);}if(!_0x4e7b2d){return handleError(_0x2473b2,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x36df80={'payload':{'id':_0x4e7b2d['id'],'role':_0x4e7b2d['role']},'options':{'expiresIn':0x15180}};return authService[_0x52b5('0x37')](_0x36df80)[_0x52b5('0xe')](function(_0x40050a){_0x2473b2['json']({'id':_0x4e7b2d['id'],'token':_0x40050a,'statusCall':'','isAlreadyLogged':_0x4e7b2d[_0x52b5('0x38')]});});}})(_0x64a110,_0x2473b2,_0x2ced2b);};exports[_0x52b5('0x39')]=function(_0x478710,_0x41392f,_0x4d71b7){if(!_0x478710[_0x52b5('0x3a')]['email']){return handleError(_0x41392f,0x1f4,{'message':_0x52b5('0x3b')});}var _0x32e2a6=rs[_0x52b5('0x3c')]();_0x478710['body'][_0x52b5('0x22')]=_0x478710[_0x52b5('0x3a')]['email']['trim']()['toLowerCase']();var _0x2db94e;return db['Setting'][_0x52b5('0xc')]({'where':{'id':0x1},'attributes':[_0x52b5('0xd'),_0x52b5('0x19')],'raw':!![]})[_0x52b5('0xe')](function(_0xab33a1){_0x2db94e=_0xab33a1;return db[_0x52b5('0x3d')][_0x52b5('0x21')]({'where':{'email':_0x478710[_0x52b5('0x3a')][_0x52b5('0x22')]}});})[_0x52b5('0xe')](function(_0x52cc04){if(!_0x52cc04){throw new Error(_0x52b5('0x3e'));}if(_0x52cc04[_0x52b5('0x13')]){throw new Error(_0x52b5('0x3f'));}if(_0x52cc04[_0x52b5('0x1c')]){if(moment(_0x52cc04[_0x52b5('0x1a')])['add'](_0x2db94e['blockDuration'],_0x52b5('0x1e'))>moment()){throw new Error(_0x52b5('0x40'));}else{_0x52cc04['blocked']=![];_0x52cc04[_0x52b5('0x1a')]=null;}}_0x52cc04['resetPasswordToken']=_0x32e2a6;_0x52cc04[_0x52b5('0x41')]=Date['now']()+0x36ee80;return _0x52cc04[_0x52b5('0x42')]();})[_0x52b5('0xe')](function(){return sendServiceMail({'to':_0x478710['body'][_0x52b5('0x22')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x52b5('0x43')+_0x52b5('0x44')+'http://'+_0x478710[_0x52b5('0x45')][_0x52b5('0x26')]+_0x52b5('0x46')+_0x32e2a6+'\x0a\x0a'+_0x52b5('0x47')});})[_0x52b5('0xe')](function(){_0x41392f[_0x52b5('0x48')](0xc8)[_0x52b5('0x33')]({'message':_0x52b5('0x49')});})[_0x52b5('0x20')](function(_0x56c9ff){return handleError(_0x41392f,0x1f4,_0x56c9ff);});};exports[_0x52b5('0x4a')]=function(_0x309199,_0x2d6e67,_0x35f558){var _0x22e928;return db[_0x52b5('0x3d')][_0x52b5('0x21')]({'where':{'resetPasswordToken':_0x309199[_0x52b5('0x4b')][_0x52b5('0x4c')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x412e58){_0x22e928=_0x412e58;if(!_0x22e928){throw new Error(_0x52b5('0x4d'));}return db[_0x52b5('0xb')][_0x52b5('0xc')]({'attributes':['id','securePassword']});})[_0x52b5('0xe')](function(_0xbcffd6){return checkPasswordPattern(_0xbcffd6,_0x309199[_0x52b5('0x3a')]['password'],_0xbcffd6['securePassword']);})[_0x52b5('0xe')](function(){_0x22e928['password']=_0x309199[_0x52b5('0x3a')][_0x52b5('0x10')];_0x22e928['resetPasswordToken']=null;_0x22e928[_0x52b5('0x41')]=null;return _0x22e928[_0x52b5('0x42')]();})['then'](function(){_0x2d6e67[_0x52b5('0x48')](0xc8)[_0x52b5('0x33')]({'message':_0x52b5('0x4e')});})[_0x52b5('0x20')](function(_0x259401){return handleError(_0x2d6e67,0x1f4,_0x259401);});};passport[_0x52b5('0x4f')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x1939c5,_0x56b5a5,_0x3fb565){return localAuthenticate(db['User'],_0x1939c5,_0x56b5a5,_0x3fb565);})); \ No newline at end of file +var _0xb4c7=['json','online','Email\x20parameter\x20is\x20missing','generate','body','email','trim','User','find','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','resetPasswordExpires','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','use','util','passport','passport-local','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','blockedAt','loginAttempts','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','add','clearBlockUser','minutes','getLicense','catch','blocked','MailAccount','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','message','test','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x188cc8,_0xd39746){var _0x4cb155=function(_0x2d2a6c){while(--_0x2d2a6c){_0x188cc8['push'](_0x188cc8['shift']());}};_0x4cb155(++_0xd39746);}(_0xb4c7,0x19c));var _0x7b4c=function(_0x6939e9,_0x1ea346){_0x6939e9=_0x6939e9-0x0;var _0x32f2dc=_0xb4c7[_0x6939e9];return _0x32f2dc;};'use strict';var util=require(_0x7b4c('0x0'));var passport=require(_0x7b4c('0x1'));var LocalStrategy=require(_0x7b4c('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require('lodash');var rs=require('randomstring');var moment=require('moment');var db=require(_0x7b4c('0x3'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x7b4c('0x4'));var client=jayson[_0x7b4c('0x5')][_0x7b4c('0x6')]({'port':0x232b});function localAuthenticate(_0x23ef23,_0x45631a,_0x390317,_0x5905c8){var _0x236939,_0x390d28;return db[_0x7b4c('0x7')][_0x7b4c('0x8')]({'where':{'id':0x1},'attributes':[_0x7b4c('0x9'),_0x7b4c('0xa')],'raw':!![]})['then'](function(_0x1660a7){_0x236939=_0x1660a7;return _0x23ef23[_0x7b4c('0x8')]({'attributes':['id',_0x7b4c('0xb'),_0x7b4c('0xc'),'salt','role','disabled','blocked',_0x7b4c('0xd'),_0x7b4c('0xe')],'where':{'name':_0x45631a,'role':{'$or':['admin',_0x7b4c('0xf'),_0x7b4c('0x10')]}}});})[_0x7b4c('0x11')](function(_0x24ba8c){if(!_0x24ba8c||_0x24ba8c&&_0x24ba8c[_0x7b4c('0xb')]!==_0x45631a){throw new Error(_0x7b4c('0x12'));}else{_0x390d28=_0x24ba8c;return _0x390d28;}})[_0x7b4c('0x11')](function(){_0x390d28['authenticate'](_0x390317,function(_0x2061c3,_0x411f28){var _0x2ed4a9=_0x390d28[_0x7b4c('0xe')]+0x1;if(_0x2061c3){return _0x5905c8(_0x2061c3);}else if(!_0x411f28){if(_0x390d28[_0x7b4c('0x13')]){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else if(_0x236939['allowedLoginAttempts']>0x0){if(_0x390d28['blocked']){if(_0x236939[_0x7b4c('0xa')]>0x0){if(moment(_0x390d28[_0x7b4c('0xd')])[_0x7b4c('0x14')](_0x236939[_0x7b4c('0xa')],'minutes')>moment()){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else{return utils[_0x7b4c('0x15')](_0x390d28,_0x2ed4a9,![],null)[_0x7b4c('0x11')](function(){return _0x5905c8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}}else{if(_0x2ed4a9>=_0x236939[_0x7b4c('0x9')]){return utils[_0x7b4c('0x15')](_0x390d28,0x0,!![],moment())['then'](function(){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});});}else{return utils[_0x7b4c('0x15')](_0x390d28,_0x2ed4a9,![],null)[_0x7b4c('0x11')](function(){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});});}}}else{return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}}else{if(_0x390d28[_0x7b4c('0x13')]){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else if(_0x236939['allowedLoginAttempts']>0x0){if(_0x390d28['blocked']){if(_0x236939[_0x7b4c('0xa')]>0x0){if(moment(_0x390d28[_0x7b4c('0xd')])[_0x7b4c('0x14')](_0x236939['blockDuration'],_0x7b4c('0x16'))>moment()){return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}else{return utils[_0x7b4c('0x15')](_0x390d28,0x0,![],null)[_0x7b4c('0x11')](function(){return utils[_0x7b4c('0x17')](_0x390d28);})[_0x7b4c('0x11')](function(){return _0x5905c8(null,_0x390d28);});}}else{return _0x5905c8(null,![],{'message':_0x7b4c('0x12')});}}else{return utils[_0x7b4c('0x15')](_0x390d28,0x0,![],null)['then'](function(){return utils[_0x7b4c('0x17')](_0x390d28);})['then'](function(){return _0x5905c8(null,_0x390d28);})[_0x7b4c('0x18')](function(_0x10066c){return _0x5905c8(null,![],_0x10066c);});}}else{if(_0x390d28[_0x7b4c('0x19')]){return _0x5905c8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x7b4c('0x17')](_0x390d28)[_0x7b4c('0x11')](function(){return _0x5905c8(null,_0x390d28);});}}}});})[_0x7b4c('0x18')](function(_0x4a2b36){return _0x5905c8(null,![],_0x4a2b36);});}function sendServiceMail(_0x3b52b1){return db[_0x7b4c('0x1a')]['find']({'where':{'service':!![]},'attributes':['id',_0x7b4c('0xb'),'email'],'include':[{'model':db[_0x7b4c('0x1b')],'as':_0x7b4c('0x1c')}]})['then'](function(_0x3d6ab1){if(!_0x3d6ab1){throw new Error(_0x7b4c('0x1d'));}var _0x504695={'tls':{'rejectUnauthorized':![]}};if(_0x3d6ab1['Smtp']['service']){_0x504695[_0x7b4c('0x1e')]=_0x3d6ab1[_0x7b4c('0x1c')]['service'];}else{_0x504695[_0x7b4c('0x1f')]=_0x3d6ab1['Smtp'][_0x7b4c('0x1f')];_0x504695[_0x7b4c('0x20')]=_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0x20')];_0x504695[_0x7b4c('0x21')]=_0x3d6ab1[_0x7b4c('0x1c')]['secure'];}if(_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0x22')]){_0x504695[_0x7b4c('0x23')]={'user':_0x3d6ab1['Smtp'][_0x7b4c('0xf')],'pass':_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0x24')]};}var _0x5ab237={'account':_0x504695,'message':_[_0x7b4c('0x25')]({'from':util['format'](_0x7b4c('0x26'),_0x3d6ab1[_0x7b4c('0xb')],_0x3d6ab1['email']||_0x3d6ab1[_0x7b4c('0x1c')][_0x7b4c('0xf')])},_0x3b52b1)};return client['request'](_0x7b4c('0x27'),_0x5ab237);})[_0x7b4c('0x11')](function(_0x45e6db){if(_0x45e6db[_0x7b4c('0x28')]){throw new Error(util[_0x7b4c('0x29')](_0x7b4c('0x2a'),_0x45e6db[_0x7b4c('0x28')]['message']||JSON[_0x7b4c('0x2b')](_0x45e6db[_0x7b4c('0x28')])));}return!![];});}function handleError(_0x51b1af,_0x54a074,_0x309320){return _0x51b1af[_0x7b4c('0x2c')](_0x54a074||0x1f4)['send']({'message':_0x309320?_0x309320[_0x7b4c('0x2d')]||_0x309320:''});}function checkPasswordPattern(_0x3cf8a3,_0x4f44da,_0x33d650){if(_0x33d650){var _0x34f9a8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x34f9a8[_0x7b4c('0x2e')](_0x4f44da)){return _0x3cf8a3;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3cf8a3;}}exports['login']=function(_0xf08f83,_0x301b19,_0x443277){passport[_0x7b4c('0x2f')](_0x7b4c('0x30'),function(_0x58d9f7,_0x36bf10,_0x3b9bbe){var _0x29121a=_0x58d9f7||_0x3b9bbe;if(_0x29121a){return handleError(_0x301b19,0x191,_0x29121a);}if(!_0x36bf10){return handleError(_0x301b19,0x194,{'message':_0x7b4c('0x31')});}else{var _0x5f1bd9={'payload':{'id':_0x36bf10['id'],'role':_0x36bf10['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5f1bd9)[_0x7b4c('0x11')](function(_0x118209){_0x301b19[_0x7b4c('0x32')]({'id':_0x36bf10['id'],'token':_0x118209,'statusCall':'','isAlreadyLogged':_0x36bf10[_0x7b4c('0x33')]});});}})(_0xf08f83,_0x301b19,_0x443277);};exports['forgot']=function(_0x471229,_0x3107d1,_0x3f90f7){if(!_0x471229['body']['email']){return handleError(_0x3107d1,0x1f4,{'message':_0x7b4c('0x34')});}var _0x34574c=rs[_0x7b4c('0x35')]();_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')]=_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')][_0x7b4c('0x38')]()['toLowerCase']();var _0x589000;return db['Setting'][_0x7b4c('0x8')]({'where':{'id':0x1},'attributes':[_0x7b4c('0x9'),_0x7b4c('0xa')],'raw':!![]})[_0x7b4c('0x11')](function(_0x41da3b){_0x589000=_0x41da3b;return db[_0x7b4c('0x39')][_0x7b4c('0x3a')]({'where':{'email':_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')]}});})[_0x7b4c('0x11')](function(_0x27215e){if(!_0x27215e){throw new Error(_0x7b4c('0x3b'));}if(_0x27215e[_0x7b4c('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x27215e[_0x7b4c('0x19')]){if(moment(_0x27215e[_0x7b4c('0xd')])[_0x7b4c('0x14')](_0x589000['blockDuration'],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x27215e[_0x7b4c('0x19')]=![];_0x27215e[_0x7b4c('0xd')]=null;}}_0x27215e[_0x7b4c('0x3c')]=_0x34574c;_0x27215e[_0x7b4c('0x3d')]=Date['now']()+0x36ee80;return _0x27215e[_0x7b4c('0x3e')]();})['then'](function(){return sendServiceMail({'to':_0x471229[_0x7b4c('0x36')][_0x7b4c('0x37')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7b4c('0x3f')+_0x7b4c('0x40')+_0x471229[_0x7b4c('0x41')][_0x7b4c('0x1f')]+_0x7b4c('0x42')+_0x34574c+'\x0a\x0a'+_0x7b4c('0x43')});})[_0x7b4c('0x11')](function(){_0x3107d1[_0x7b4c('0x2c')](0xc8)[_0x7b4c('0x44')]({'message':_0x7b4c('0x45')});})[_0x7b4c('0x18')](function(_0x5bc9fe){return handleError(_0x3107d1,0x1f4,_0x5bc9fe);});};exports[_0x7b4c('0x46')]=function(_0x18bbc0,_0x29ff26,_0x249c2a){var _0x2240f3;return db[_0x7b4c('0x39')][_0x7b4c('0x3a')]({'where':{'resetPasswordToken':_0x18bbc0[_0x7b4c('0x47')][_0x7b4c('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x7b4c('0x11')](function(_0x4b6126){_0x2240f3=_0x4b6126;if(!_0x2240f3){throw new Error(_0x7b4c('0x49'));}return db['Setting'][_0x7b4c('0x8')]({'attributes':['id',_0x7b4c('0x4a')]});})[_0x7b4c('0x11')](function(_0x1f9157){return checkPasswordPattern(_0x1f9157,_0x18bbc0[_0x7b4c('0x36')]['password'],_0x1f9157[_0x7b4c('0x4a')]);})[_0x7b4c('0x11')](function(){_0x2240f3[_0x7b4c('0xc')]=_0x18bbc0[_0x7b4c('0x36')]['password'];_0x2240f3[_0x7b4c('0x3c')]=null;_0x2240f3[_0x7b4c('0x3d')]=null;return _0x2240f3[_0x7b4c('0x3e')]();})[_0x7b4c('0x11')](function(){_0x29ff26[_0x7b4c('0x2c')](0xc8)[_0x7b4c('0x44')]({'message':_0x7b4c('0x4b')});})[_0x7b4c('0x18')](function(_0x4f4ee6){return handleError(_0x29ff26,0x1f4,_0x4f4ee6);});};passport[_0x7b4c('0x4c')](new LocalStrategy({'usernameField':'name','passwordField':_0x7b4c('0xc')},function(_0x127a2f,_0x1fe74e,_0x1ab2bb){return localAuthenticate(db[_0x7b4c('0x39')],_0x127a2f,_0x1fe74e,_0x1ab2bb);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 6127864..3f02cfc 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 _0xcf66=['post','login','/forgot','forgot','reset','express','Router','./authLocal.controller'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xcf66,0x185));var _0x6cf6=function(_0x5c2afd,_0x504fad){_0x5c2afd=_0x5c2afd-0x0;var _0x42d163=_0xcf66[_0x5c2afd];return _0x42d163;};'use strict';var express=require(_0x6cf6('0x0'));var router=express[_0x6cf6('0x1')]();var controller=require(_0x6cf6('0x2'));router[_0x6cf6('0x3')]('/',controller[_0x6cf6('0x4')]);router[_0x6cf6('0x3')](_0x6cf6('0x5'),controller[_0x6cf6('0x6')]);router[_0x6cf6('0x3')]('/reset/:token',controller[_0x6cf6('0x7')]);module['exports']=router; \ No newline at end of file +var _0xbbc3=['/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login','forgot'];(function(_0x514c5e,_0x8c0875){var _0x34c3e6=function(_0x3d78d2){while(--_0x3d78d2){_0x514c5e['push'](_0x514c5e['shift']());}};_0x34c3e6(++_0x8c0875);}(_0xbbc3,0x17d));var _0x3bbc=function(_0x3cb2b7,_0x2338b6){_0x3cb2b7=_0x3cb2b7-0x0;var _0xac954a=_0xbbc3[_0x3cb2b7];return _0xac954a;};'use strict';var express=require(_0x3bbc('0x0'));var router=express[_0x3bbc('0x1')]();var controller=require(_0x3bbc('0x2'));router[_0x3bbc('0x3')]('/',controller[_0x3bbc('0x4')]);router['post']('/forgot',controller[_0x3bbc('0x5')]);router[_0x3bbc('0x3')](_0x3bbc('0x6'),controller[_0x3bbc('0x7')]);module[_0x3bbc('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 9cff631..278be83 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 _0x3776=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x4d73b1,_0x91ab71){var _0xe394f9=function(_0x47dd5d){while(--_0x47dd5d){_0x4d73b1['push'](_0x4d73b1['shift']());}};_0xe394f9(++_0x91ab71);}(_0x3776,0x1be));var _0x6377=function(_0x24d92a,_0x5dcc4d){_0x24d92a=_0x24d92a-0x0;var _0x2d5aed=_0x3776[_0x24d92a];return _0x2d5aed;};'use strict';var Sequelize=require('sequelize');module[_0x6377('0x0')]={'name':{'type':Sequelize[_0x6377('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x6377('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6377('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xf0e3=['INTEGER','sequelize','STRING'];(function(_0x1f3a44,_0xffe53f){var _0x4339df=function(_0x151bbe){while(--_0x151bbe){_0x1f3a44['push'](_0x1f3a44['shift']());}};_0x4339df(++_0xffe53f);}(_0xf0e3,0x6a));var _0x3f0e=function(_0x1876a7,_0x47ff27){_0x1876a7=_0x1876a7-0x0;var _0x3f5528=_0xf0e3[_0x1876a7];return _0x3f5528;};'use strict';var Sequelize=require(_0x3f0e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f0e('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x3f0e('0x1')]},'description':{'type':Sequelize[_0x3f0e('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3f0e('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 13c0105..eda81be 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 _0xe10e=['destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Automation','count','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','nolimit','addActions','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','then'];(function(_0x29fa16,_0x17c91e){var _0x139696=function(_0x192279){while(--_0x192279){_0x29fa16['push'](_0x29fa16['shift']());}};_0x139696(++_0x17c91e);}(_0xe10e,0x87));var _0xee10=function(_0x2e81c9,_0x15a07c){_0x2e81c9=_0x2e81c9-0x0;var _0x217cf2=_0xe10e[_0x2e81c9];return _0x217cf2;};'use strict';var pdf=require(_0xee10('0x0'));var emlformat=require(_0xee10('0x1'));var rimraf=require(_0xee10('0x2'));var zipdir=require(_0xee10('0x3'));var jsonpatch=require(_0xee10('0x4'));var rp=require(_0xee10('0x5'));var moment=require(_0xee10('0x6'));var BPromise=require(_0xee10('0x7'));var Mustache=require(_0xee10('0x8'));var util=require('util');var path=require(_0xee10('0x9'));var sox=require('sox');var csv=require(_0xee10('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee10('0xb'));var squel=require(_0xee10('0xc'));var crypto=require(_0xee10('0xd'));var jsforce=require(_0xee10('0xe'));var deskjs=require(_0xee10('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee10('0x10'));var Redis=require(_0xee10('0x11'));var authService=require(_0xee10('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xee10('0x13'));var hardwareService=require(_0xee10('0x14'));var logger=require(_0xee10('0x15'))(_0xee10('0x16'));var utils=require(_0xee10('0x17'));var config=require(_0xee10('0x18'));var db=require(_0xee10('0x19'))['db'];function respondWithStatusCode(_0x2d1410,_0x95ae82){_0x95ae82=_0x95ae82||0xcc;return function(_0x5a91b2){if(_0x5a91b2){return _0x2d1410[_0xee10('0x1a')](_0x95ae82);}return _0x2d1410[_0xee10('0x1b')](_0x95ae82)[_0xee10('0x1c')]();};}function respondWithResult(_0x374086,_0x43549f){_0x43549f=_0x43549f||0xc8;return function(_0x541049){if(_0x541049){return _0x374086[_0xee10('0x1b')](_0x43549f)[_0xee10('0x1d')](_0x541049);}};}function respondWithFilteredResult(_0x1844af,_0x3bf93e){return function(_0x231b72){if(_0x231b72){var _0x5ae504=_0x231b72['count'],_0x59b6cf=_0x3bf93e[_0xee10('0x1e')],_0x47cd94=_0x3bf93e[_0xee10('0x1e')]+_0x3bf93e[_0xee10('0x1f')],_0x2ab24c;if(_0x47cd94>=_0x5ae504){_0x47cd94=_0x5ae504;_0x2ab24c=0xc8;}else{_0x2ab24c=0xce;}_0x1844af[_0xee10('0x1b')](_0x2ab24c);return _0x1844af['set'](_0xee10('0x20'),_0x59b6cf+'-'+_0x47cd94+'/'+_0x5ae504)['json'](_0x231b72);}return null;};}function patchUpdates(_0x3b99ad){return function(_0x253fe3){try{jsonpatch[_0xee10('0x21')](_0x253fe3,_0x3b99ad,!![]);}catch(_0x394110){return BPromise[_0xee10('0x22')](_0x394110);}return _0x253fe3['save']();};}function saveUpdates(_0x20a481,_0x1ad0d0){return function(_0x50684b){if(_0x50684b){return _0x50684b[_0xee10('0x23')](_0x20a481)[_0xee10('0x24')](function(_0x15a4dd){return _0x15a4dd;});}return null;};}function removeEntity(_0x4e13ea,_0x876f83){return function(_0x4e1d46){if(_0x4e1d46){return _0x4e1d46[_0xee10('0x25')]()[_0xee10('0x24')](function(){_0x4e13ea[_0xee10('0x1b')](0xcc)[_0xee10('0x1c')]();});}};}function handleEntityNotFound(_0x5c9bb3,_0x189713){return function(_0x1ca64b){if(!_0x1ca64b){_0x5c9bb3[_0xee10('0x1a')](0x194);}return _0x1ca64b;};}function handleError(_0x18ba76,_0x56923f){_0x56923f=_0x56923f||0x1f4;return function(_0x5d8dae){logger['error'](_0x5d8dae[_0xee10('0x26')]);if(_0x5d8dae[_0xee10('0x27')]){delete _0x5d8dae['name'];}_0x18ba76['status'](_0x56923f)[_0xee10('0x28')](_0x5d8dae);};}exports[_0xee10('0x29')]=function(_0x49eee2,_0x222c17){var _0x1f2591={},_0x34944a={},_0x59c20d={'count':0x0,'rows':[]};var _0x3e349b=_[_0xee10('0x2a')](db['Automation'][_0xee10('0x2b')],function(_0x3bebeb){return{'name':_0x3bebeb[_0xee10('0x2c')],'type':_0x3bebeb[_0xee10('0x2d')][_0xee10('0x2e')]};});_0x34944a[_0xee10('0x2f')]=_[_0xee10('0x2a')](_0x3e349b,'name');_0x34944a[_0xee10('0x30')]=_[_0xee10('0x31')](_0x49eee2[_0xee10('0x30')]);_0x34944a[_0xee10('0x32')]=_['intersection'](_0x34944a[_0xee10('0x2f')],_0x34944a[_0xee10('0x30')]);_0x1f2591['attributes']=_['intersection'](_0x34944a[_0xee10('0x2f')],qs[_0xee10('0x33')](_0x49eee2['query'][_0xee10('0x33')]));_0x1f2591[_0xee10('0x34')]=_0x1f2591[_0xee10('0x34')][_0xee10('0x35')]?_0x1f2591['attributes']:_0x34944a[_0xee10('0x2f')];if(!_0x49eee2[_0xee10('0x30')][_0xee10('0x36')]('nolimit')){_0x1f2591[_0xee10('0x1f')]=qs[_0xee10('0x1f')](_0x49eee2['query']['limit']);_0x1f2591[_0xee10('0x1e')]=qs['offset'](_0x49eee2[_0xee10('0x30')][_0xee10('0x1e')]);}_0x1f2591[_0xee10('0x37')]=qs[_0xee10('0x38')](_0x49eee2[_0xee10('0x30')][_0xee10('0x38')]);_0x1f2591[_0xee10('0x39')]=qs[_0xee10('0x32')](_[_0xee10('0x3a')](_0x49eee2['query'],_0x34944a[_0xee10('0x32')]),_0x3e349b);if(_0x49eee2[_0xee10('0x30')][_0xee10('0x3b')]){_0x1f2591['where']=_[_0xee10('0x3c')](_0x1f2591[_0xee10('0x39')],{'$or':_[_0xee10('0x2a')](_0x3e349b,function(_0xadfc80){if(_0xadfc80[_0xee10('0x2d')]!==_0xee10('0x3d')){var _0x181ad5={};_0x181ad5[_0xadfc80[_0xee10('0x27')]]={'$like':'%'+_0x49eee2['query']['filter']+'%'};return _0x181ad5;}})});}_0x1f2591=_[_0xee10('0x3c')]({},_0x1f2591,_0x49eee2[_0xee10('0x3e')]);var _0x7d6208={'where':_0x1f2591['where']};return db[_0xee10('0x3f')][_0xee10('0x40')](_0x7d6208)[_0xee10('0x24')](function(_0x3ffdff){_0x59c20d[_0xee10('0x40')]=_0x3ffdff;if(_0x49eee2[_0xee10('0x30')][_0xee10('0x41')]){_0x1f2591[_0xee10('0x42')]=[{'all':!![]}];}return db[_0xee10('0x3f')][_0xee10('0x43')](_0x1f2591);})[_0xee10('0x24')](function(_0x30010c){_0x59c20d[_0xee10('0x44')]=_0x30010c;return _0x59c20d;})[_0xee10('0x24')](respondWithFilteredResult(_0x222c17,_0x1f2591))[_0xee10('0x45')](handleError(_0x222c17,null));};exports[_0xee10('0x46')]=function(_0x38f684,_0x373635){var _0xa27329={'raw':![],'where':{'id':_0x38f684[_0xee10('0x47')]['id']}},_0x4cf160={};_0x4cf160['model']=_['keys'](db[_0xee10('0x3f')][_0xee10('0x2b')]);_0x4cf160[_0xee10('0x30')]=_[_0xee10('0x31')](_0x38f684[_0xee10('0x30')]);_0x4cf160[_0xee10('0x32')]=_['intersection'](_0x4cf160[_0xee10('0x2f')],_0x4cf160[_0xee10('0x30')]);_0xa27329[_0xee10('0x34')]=_[_0xee10('0x48')](_0x4cf160[_0xee10('0x2f')],qs['fields'](_0x38f684['query']['fields']));_0xa27329[_0xee10('0x34')]=_0xa27329[_0xee10('0x34')][_0xee10('0x35')]?_0xa27329[_0xee10('0x34')]:_0x4cf160['model'];if(_0x38f684[_0xee10('0x30')]['includeAll']){_0xa27329[_0xee10('0x42')]=[{'all':!![]}];}_0xa27329=_[_0xee10('0x3c')]({},_0xa27329,_0x38f684[_0xee10('0x3e')]);return db['Automation'][_0xee10('0x49')](_0xa27329)['then'](handleEntityNotFound(_0x373635,null))[_0xee10('0x24')](respondWithResult(_0x373635,null))[_0xee10('0x45')](handleError(_0x373635,null));};exports[_0xee10('0x4a')]=function(_0x373ece,_0x50f68e){return db['Automation'][_0xee10('0x4a')](_0x373ece['body'],{})[_0xee10('0x24')](respondWithResult(_0x50f68e,0xc9))[_0xee10('0x45')](handleError(_0x50f68e,null));};exports['update']=function(_0x2c3f4c,_0x44cb2e){if(_0x2c3f4c[_0xee10('0x4b')]['id']){delete _0x2c3f4c[_0xee10('0x4b')]['id'];}return db[_0xee10('0x3f')][_0xee10('0x49')]({'where':{'id':_0x2c3f4c['params']['id']}})[_0xee10('0x24')](handleEntityNotFound(_0x44cb2e,null))[_0xee10('0x24')](saveUpdates(_0x2c3f4c['body'],null))[_0xee10('0x24')](respondWithResult(_0x44cb2e,null))['catch'](handleError(_0x44cb2e,null));};exports['destroy']=function(_0x13e871,_0x3a5d51){return db[_0xee10('0x3f')][_0xee10('0x49')]({'where':{'id':_0x13e871[_0xee10('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a5d51,null))[_0xee10('0x24')](removeEntity(_0x3a5d51,null))[_0xee10('0x45')](handleError(_0x3a5d51,null));};exports[_0xee10('0x4c')]=function(_0x38cfdf,_0x5d990e,_0x423ccd){return db[_0xee10('0x4d')][_0xee10('0x49')]({'where':{'id':_0x38cfdf[_0xee10('0x47')]['id']}})[_0xee10('0x24')](handleEntityNotFound(_0x5d990e,null))[_0xee10('0x24')](function(_0x410ef6){if(_0x410ef6){return _0x410ef6[_0xee10('0x4c')](_0x38cfdf[_0xee10('0x4b')][_0xee10('0x4e')],_[_0xee10('0x4f')](_0x38cfdf[_0xee10('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x5d990e,null))['catch'](handleError(_0x5d990e,null));};exports[_0xee10('0x50')]=function(_0x5b9378,_0x2cd852,_0x5828f9){var _0x374140={};var _0x590545={};var _0x14f455;var _0x5678f3;return db['Automation'][_0xee10('0x51')]({'where':{'id':_0x5b9378['params']['id']}})[_0xee10('0x24')](handleEntityNotFound(_0x2cd852,null))[_0xee10('0x24')](function(_0x478611){if(_0x478611){_0x14f455=_0x478611;_0x590545[_0xee10('0x2f')]=_['keys'](db[_0xee10('0x4d')][_0xee10('0x2b')]);_0x590545[_0xee10('0x30')]=_['keys'](_0x5b9378[_0xee10('0x30')]);_0x590545[_0xee10('0x32')]=_[_0xee10('0x48')](_0x590545['model'],_0x590545[_0xee10('0x30')]);_0x374140[_0xee10('0x34')]=_[_0xee10('0x48')](_0x590545[_0xee10('0x2f')],qs[_0xee10('0x33')](_0x5b9378[_0xee10('0x30')][_0xee10('0x33')]));_0x374140['attributes']=_0x374140[_0xee10('0x34')]['length']?_0x374140['attributes']:_0x590545[_0xee10('0x2f')];_0x374140[_0xee10('0x37')]=qs['sort'](_0x5b9378['query'][_0xee10('0x38')]);_0x374140[_0xee10('0x39')]=qs['filters'](_['pick'](_0x5b9378[_0xee10('0x30')],_0x590545['filters']));if(_0x5b9378[_0xee10('0x30')]['filter']){_0x374140[_0xee10('0x39')]=_[_0xee10('0x3c')](_0x374140['where'],{'$or':_[_0xee10('0x2a')](_0x374140[_0xee10('0x34')],function(_0x4b5f5d){var _0x53ece0={};_0x53ece0[_0x4b5f5d]={'$like':'%'+_0x5b9378['query'][_0xee10('0x3b')]+'%'};return _0x53ece0;})});}_0x374140=_['merge']({},_0x374140,_0x5b9378[_0xee10('0x3e')]);return _0x14f455[_0xee10('0x50')](_0x374140);}})[_0xee10('0x24')](function(_0x2bc474){if(_0x2bc474){_0x5678f3=_0x2bc474['length'];if(!_0x5b9378[_0xee10('0x30')][_0xee10('0x36')](_0xee10('0x52'))){_0x374140[_0xee10('0x1f')]=qs[_0xee10('0x1f')](_0x5b9378[_0xee10('0x30')]['limit']);_0x374140[_0xee10('0x1e')]=qs[_0xee10('0x1e')](_0x5b9378[_0xee10('0x30')][_0xee10('0x1e')]);}return _0x14f455['getConditions'](_0x374140);}})[_0xee10('0x24')](function(_0x416c1b){if(_0x416c1b){return _0x416c1b?{'count':_0x5678f3,'rows':_0x416c1b}:null;}})[_0xee10('0x24')](respondWithResult(_0x2cd852,null))[_0xee10('0x45')](handleError(_0x2cd852,null));};exports[_0xee10('0x53')]=function(_0x4f579e,_0x26ac6b,_0x273ec4){return db[_0xee10('0x54')]['find']({'where':{'id':_0x4f579e[_0xee10('0x47')]['id']}})[_0xee10('0x24')](handleEntityNotFound(_0x26ac6b,null))[_0xee10('0x24')](function(_0x200914){if(_0x200914){return _0x200914['addActions'](_0x4f579e['body']['ids'],_[_0xee10('0x4f')](_0x4f579e[_0xee10('0x4b')],[_0xee10('0x4e'),'id'])||{});}})[_0xee10('0x24')](respondWithResult(_0x26ac6b,null))[_0xee10('0x45')](handleError(_0x26ac6b,null));};exports[_0xee10('0x55')]=function(_0x4b9076,_0xe6c7d5,_0x5ea5ab){var _0x308cb3={};var _0x18c204={};var _0x2d622f;var _0x1d567d;return db['Automation'][_0xee10('0x51')]({'where':{'id':_0x4b9076[_0xee10('0x47')]['id']}})[_0xee10('0x24')](handleEntityNotFound(_0xe6c7d5,null))['then'](function(_0x2a0b85){if(_0x2a0b85){_0x2d622f=_0x2a0b85;_0x18c204[_0xee10('0x2f')]=_[_0xee10('0x31')](db[_0xee10('0x54')][_0xee10('0x2b')]);_0x18c204[_0xee10('0x30')]=_['keys'](_0x4b9076[_0xee10('0x30')]);_0x18c204[_0xee10('0x32')]=_[_0xee10('0x48')](_0x18c204[_0xee10('0x2f')],_0x18c204[_0xee10('0x30')]);_0x308cb3[_0xee10('0x34')]=_['intersection'](_0x18c204[_0xee10('0x2f')],qs[_0xee10('0x33')](_0x4b9076[_0xee10('0x30')]['fields']));_0x308cb3['attributes']=_0x308cb3[_0xee10('0x34')]['length']?_0x308cb3[_0xee10('0x34')]:_0x18c204[_0xee10('0x2f')];_0x308cb3[_0xee10('0x37')]=qs[_0xee10('0x38')](_0x4b9076[_0xee10('0x30')][_0xee10('0x38')]);_0x308cb3['where']=qs['filters'](_[_0xee10('0x3a')](_0x4b9076[_0xee10('0x30')],_0x18c204[_0xee10('0x32')]));if(_0x4b9076[_0xee10('0x30')]['filter']){_0x308cb3[_0xee10('0x39')]=_[_0xee10('0x3c')](_0x308cb3[_0xee10('0x39')],{'$or':_[_0xee10('0x2a')](_0x308cb3[_0xee10('0x34')],function(_0x4be7bd){var _0x4349cf={};_0x4349cf[_0x4be7bd]={'$like':'%'+_0x4b9076[_0xee10('0x30')]['filter']+'%'};return _0x4349cf;})});}_0x308cb3=_[_0xee10('0x3c')]({},_0x308cb3,_0x4b9076[_0xee10('0x3e')]);return _0x2d622f['getActions'](_0x308cb3);}})[_0xee10('0x24')](function(_0x56822c){if(_0x56822c){_0x1d567d=_0x56822c[_0xee10('0x35')];if(!_0x4b9076['query'][_0xee10('0x36')](_0xee10('0x52'))){_0x308cb3['limit']=qs['limit'](_0x4b9076[_0xee10('0x30')]['limit']);_0x308cb3[_0xee10('0x1e')]=qs['offset'](_0x4b9076[_0xee10('0x30')][_0xee10('0x1e')]);}return _0x2d622f['getActions'](_0x308cb3);}})[_0xee10('0x24')](function(_0x188ca5){if(_0x188ca5){return _0x188ca5?{'count':_0x1d567d,'rows':_0x188ca5}:null;}})['then'](respondWithResult(_0xe6c7d5,null))[_0xee10('0x45')](handleError(_0xe6c7d5,null));}; \ No newline at end of file +var _0x1000=['include','findAll','catch','keys','find','create','body','params','addConditions','Condition','ids','findOne','length','sort','getConditions','addActions','Action','omit','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Automation','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x1b6195,_0x1d6d41){var _0x5f0498=function(_0x4ff152){while(--_0x4ff152){_0x1b6195['push'](_0x1b6195['shift']());}};_0x5f0498(++_0x1d6d41);}(_0x1000,0x1c1));var _0x0100=function(_0x4c82af,_0x362c51){_0x4c82af=_0x4c82af-0x0;var _0x21d4ec=_0x1000[_0x4c82af];return _0x21d4ec;};'use strict';var pdf=require(_0x0100('0x0'));var emlformat=require(_0x0100('0x1'));var rimraf=require(_0x0100('0x2'));var zipdir=require(_0x0100('0x3'));var jsonpatch=require(_0x0100('0x4'));var rp=require(_0x0100('0x5'));var moment=require(_0x0100('0x6'));var BPromise=require(_0x0100('0x7'));var Mustache=require(_0x0100('0x8'));var util=require(_0x0100('0x9'));var path=require(_0x0100('0xa'));var sox=require(_0x0100('0xb'));var csv=require('to-csv');var ejs=require(_0x0100('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0100('0xd'));var jsforce=require(_0x0100('0xe'));var deskjs=require(_0x0100('0xf'));var toCsv=require(_0x0100('0x10'));var querystring=require(_0x0100('0x11'));var Papa=require(_0x0100('0x12'));var Redis=require(_0x0100('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x0100('0x14'));var as=require(_0x0100('0x15'));var hardwareService=require(_0x0100('0x16'));var logger=require(_0x0100('0x17'))('api');var utils=require(_0x0100('0x18'));var config=require(_0x0100('0x19'));var db=require(_0x0100('0x1a'))['db'];function respondWithStatusCode(_0x50d0c6,_0x3eb98d){_0x3eb98d=_0x3eb98d||0xcc;return function(_0xad4a22){if(_0xad4a22){return _0x50d0c6['sendStatus'](_0x3eb98d);}return _0x50d0c6[_0x0100('0x1b')](_0x3eb98d)[_0x0100('0x1c')]();};}function respondWithResult(_0x5b590,_0xa5ae46){_0xa5ae46=_0xa5ae46||0xc8;return function(_0x2c042b){if(_0x2c042b){return _0x5b590[_0x0100('0x1b')](_0xa5ae46)[_0x0100('0x1d')](_0x2c042b);}};}function respondWithFilteredResult(_0x1abcb7,_0x97360d){return function(_0x5a2be0){if(_0x5a2be0){var _0x1b5339=_0x5a2be0[_0x0100('0x1e')],_0xfa133=_0x97360d[_0x0100('0x1f')],_0x560c76=_0x97360d[_0x0100('0x1f')]+_0x97360d[_0x0100('0x20')],_0x2305a0;if(_0x560c76>=_0x1b5339){_0x560c76=_0x1b5339;_0x2305a0=0xc8;}else{_0x2305a0=0xce;}_0x1abcb7[_0x0100('0x1b')](_0x2305a0);return _0x1abcb7['set'](_0x0100('0x21'),_0xfa133+'-'+_0x560c76+'/'+_0x1b5339)[_0x0100('0x1d')](_0x5a2be0);}return null;};}function patchUpdates(_0x163e89){return function(_0x22bb91){try{jsonpatch[_0x0100('0x22')](_0x22bb91,_0x163e89,!![]);}catch(_0x222856){return BPromise[_0x0100('0x23')](_0x222856);}return _0x22bb91[_0x0100('0x24')]();};}function saveUpdates(_0x4bd1f0,_0x318246){return function(_0x19d42e){if(_0x19d42e){return _0x19d42e[_0x0100('0x25')](_0x4bd1f0)[_0x0100('0x26')](function(_0x101b00){return _0x101b00;});}return null;};}function removeEntity(_0x5efc06,_0x5ef6ba){return function(_0x2a20f4){if(_0x2a20f4){return _0x2a20f4[_0x0100('0x27')]()[_0x0100('0x26')](function(){_0x5efc06[_0x0100('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56a15c,_0x50c8ff){return function(_0x53e103){if(!_0x53e103){_0x56a15c[_0x0100('0x28')](0x194);}return _0x53e103;};}function handleError(_0x5f5512,_0xc5d5a4){_0xc5d5a4=_0xc5d5a4||0x1f4;return function(_0x38e29e){logger[_0x0100('0x29')](_0x38e29e[_0x0100('0x2a')]);if(_0x38e29e[_0x0100('0x2b')]){delete _0x38e29e[_0x0100('0x2b')];}_0x5f5512['status'](_0xc5d5a4)[_0x0100('0x2c')](_0x38e29e);};}exports[_0x0100('0x2d')]=function(_0x4c0de7,_0x3beda9){var _0xc4f511={},_0x1899c6={},_0x50ad97={'count':0x0,'rows':[]};var _0x4a6876=_[_0x0100('0x2e')](db[_0x0100('0x2f')][_0x0100('0x30')],function(_0x1f89a9){return{'name':_0x1f89a9['fieldName'],'type':_0x1f89a9[_0x0100('0x31')][_0x0100('0x32')]};});_0x1899c6[_0x0100('0x33')]=_[_0x0100('0x2e')](_0x4a6876,'name');_0x1899c6['query']=_['keys'](_0x4c0de7[_0x0100('0x34')]);_0x1899c6[_0x0100('0x35')]=_['intersection'](_0x1899c6[_0x0100('0x33')],_0x1899c6['query']);_0xc4f511['attributes']=_[_0x0100('0x36')](_0x1899c6[_0x0100('0x33')],qs[_0x0100('0x37')](_0x4c0de7[_0x0100('0x34')]['fields']));_0xc4f511[_0x0100('0x38')]=_0xc4f511[_0x0100('0x38')]['length']?_0xc4f511['attributes']:_0x1899c6['model'];if(!_0x4c0de7[_0x0100('0x34')][_0x0100('0x39')](_0x0100('0x3a'))){_0xc4f511['limit']=qs[_0x0100('0x20')](_0x4c0de7['query'][_0x0100('0x20')]);_0xc4f511[_0x0100('0x1f')]=qs[_0x0100('0x1f')](_0x4c0de7[_0x0100('0x34')][_0x0100('0x1f')]);}_0xc4f511[_0x0100('0x3b')]=qs['sort'](_0x4c0de7[_0x0100('0x34')]['sort']);_0xc4f511[_0x0100('0x3c')]=qs['filters'](_[_0x0100('0x3d')](_0x4c0de7[_0x0100('0x34')],_0x1899c6[_0x0100('0x35')]),_0x4a6876);if(_0x4c0de7[_0x0100('0x34')][_0x0100('0x3e')]){_0xc4f511[_0x0100('0x3c')]=_[_0x0100('0x3f')](_0xc4f511[_0x0100('0x3c')],{'$or':_['map'](_0x4a6876,function(_0x35a256){if(_0x35a256[_0x0100('0x31')]!==_0x0100('0x40')){var _0x11e849={};_0x11e849[_0x35a256['name']]={'$like':'%'+_0x4c0de7[_0x0100('0x34')][_0x0100('0x3e')]+'%'};return _0x11e849;}})});}_0xc4f511=_[_0x0100('0x3f')]({},_0xc4f511,_0x4c0de7[_0x0100('0x41')]);var _0xcf18f6={'where':_0xc4f511[_0x0100('0x3c')]};return db[_0x0100('0x2f')]['count'](_0xcf18f6)['then'](function(_0x557dec){_0x50ad97[_0x0100('0x1e')]=_0x557dec;if(_0x4c0de7[_0x0100('0x34')][_0x0100('0x42')]){_0xc4f511[_0x0100('0x43')]=[{'all':!![]}];}return db[_0x0100('0x2f')][_0x0100('0x44')](_0xc4f511);})['then'](function(_0x4734b6){_0x50ad97['rows']=_0x4734b6;return _0x50ad97;})[_0x0100('0x26')](respondWithFilteredResult(_0x3beda9,_0xc4f511))[_0x0100('0x45')](handleError(_0x3beda9,null));};exports['show']=function(_0x37505f,_0x44740d){var _0x370b4f={'raw':![],'where':{'id':_0x37505f['params']['id']}},_0x5362c0={};_0x5362c0[_0x0100('0x33')]=_['keys'](db[_0x0100('0x2f')]['rawAttributes']);_0x5362c0[_0x0100('0x34')]=_[_0x0100('0x46')](_0x37505f['query']);_0x5362c0[_0x0100('0x35')]=_[_0x0100('0x36')](_0x5362c0['model'],_0x5362c0[_0x0100('0x34')]);_0x370b4f['attributes']=_['intersection'](_0x5362c0[_0x0100('0x33')],qs['fields'](_0x37505f['query']['fields']));_0x370b4f[_0x0100('0x38')]=_0x370b4f['attributes']['length']?_0x370b4f[_0x0100('0x38')]:_0x5362c0['model'];if(_0x37505f[_0x0100('0x34')][_0x0100('0x42')]){_0x370b4f['include']=[{'all':!![]}];}_0x370b4f=_[_0x0100('0x3f')]({},_0x370b4f,_0x37505f['options']);return db[_0x0100('0x2f')][_0x0100('0x47')](_0x370b4f)[_0x0100('0x26')](handleEntityNotFound(_0x44740d,null))[_0x0100('0x26')](respondWithResult(_0x44740d,null))[_0x0100('0x45')](handleError(_0x44740d,null));};exports[_0x0100('0x48')]=function(_0x5df47d,_0x44fc72){return db[_0x0100('0x2f')][_0x0100('0x48')](_0x5df47d[_0x0100('0x49')],{})[_0x0100('0x26')](respondWithResult(_0x44fc72,0xc9))[_0x0100('0x45')](handleError(_0x44fc72,null));};exports[_0x0100('0x25')]=function(_0x2e140f,_0xf284f4){if(_0x2e140f[_0x0100('0x49')]['id']){delete _0x2e140f[_0x0100('0x49')]['id'];}return db[_0x0100('0x2f')]['find']({'where':{'id':_0x2e140f[_0x0100('0x4a')]['id']}})['then'](handleEntityNotFound(_0xf284f4,null))['then'](saveUpdates(_0x2e140f[_0x0100('0x49')],null))[_0x0100('0x26')](respondWithResult(_0xf284f4,null))['catch'](handleError(_0xf284f4,null));};exports['destroy']=function(_0x2416aa,_0x3e34f1){return db[_0x0100('0x2f')]['find']({'where':{'id':_0x2416aa[_0x0100('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3e34f1,null))[_0x0100('0x26')](removeEntity(_0x3e34f1,null))[_0x0100('0x45')](handleError(_0x3e34f1,null));};exports[_0x0100('0x4b')]=function(_0x338e17,_0x52cbc7,_0x45e43c){return db[_0x0100('0x4c')][_0x0100('0x47')]({'where':{'id':_0x338e17['params']['id']}})[_0x0100('0x26')](handleEntityNotFound(_0x52cbc7,null))[_0x0100('0x26')](function(_0x1c4c9a){if(_0x1c4c9a){return _0x1c4c9a[_0x0100('0x4b')](_0x338e17[_0x0100('0x49')][_0x0100('0x4d')],_['omit'](_0x338e17['body'],['ids','id'])||{});}})[_0x0100('0x26')](respondWithResult(_0x52cbc7,null))[_0x0100('0x45')](handleError(_0x52cbc7,null));};exports['getConditions']=function(_0xa07366,_0x3a448c,_0x5ae39b){var _0x4730d2={};var _0x120960={};var _0x3028bb;var _0x6314ac;return db['Automation'][_0x0100('0x4e')]({'where':{'id':_0xa07366[_0x0100('0x4a')]['id']}})[_0x0100('0x26')](handleEntityNotFound(_0x3a448c,null))[_0x0100('0x26')](function(_0x54d526){if(_0x54d526){_0x3028bb=_0x54d526;_0x120960['model']=_[_0x0100('0x46')](db[_0x0100('0x4c')][_0x0100('0x30')]);_0x120960['query']=_[_0x0100('0x46')](_0xa07366[_0x0100('0x34')]);_0x120960[_0x0100('0x35')]=_[_0x0100('0x36')](_0x120960['model'],_0x120960[_0x0100('0x34')]);_0x4730d2[_0x0100('0x38')]=_[_0x0100('0x36')](_0x120960[_0x0100('0x33')],qs['fields'](_0xa07366['query']['fields']));_0x4730d2['attributes']=_0x4730d2[_0x0100('0x38')][_0x0100('0x4f')]?_0x4730d2['attributes']:_0x120960[_0x0100('0x33')];_0x4730d2[_0x0100('0x3b')]=qs[_0x0100('0x50')](_0xa07366[_0x0100('0x34')]['sort']);_0x4730d2['where']=qs['filters'](_['pick'](_0xa07366[_0x0100('0x34')],_0x120960[_0x0100('0x35')]));if(_0xa07366['query'][_0x0100('0x3e')]){_0x4730d2[_0x0100('0x3c')]=_[_0x0100('0x3f')](_0x4730d2[_0x0100('0x3c')],{'$or':_['map'](_0x4730d2[_0x0100('0x38')],function(_0x16f8c0){var _0x4a3a28={};_0x4a3a28[_0x16f8c0]={'$like':'%'+_0xa07366[_0x0100('0x34')][_0x0100('0x3e')]+'%'};return _0x4a3a28;})});}_0x4730d2=_['merge']({},_0x4730d2,_0xa07366['options']);return _0x3028bb[_0x0100('0x51')](_0x4730d2);}})[_0x0100('0x26')](function(_0x110dda){if(_0x110dda){_0x6314ac=_0x110dda[_0x0100('0x4f')];if(!_0xa07366[_0x0100('0x34')][_0x0100('0x39')](_0x0100('0x3a'))){_0x4730d2[_0x0100('0x20')]=qs['limit'](_0xa07366[_0x0100('0x34')][_0x0100('0x20')]);_0x4730d2[_0x0100('0x1f')]=qs[_0x0100('0x1f')](_0xa07366[_0x0100('0x34')]['offset']);}return _0x3028bb[_0x0100('0x51')](_0x4730d2);}})['then'](function(_0x4ea365){if(_0x4ea365){return _0x4ea365?{'count':_0x6314ac,'rows':_0x4ea365}:null;}})['then'](respondWithResult(_0x3a448c,null))[_0x0100('0x45')](handleError(_0x3a448c,null));};exports[_0x0100('0x52')]=function(_0x361f99,_0x2e27da,_0x3e29bb){return db[_0x0100('0x53')][_0x0100('0x47')]({'where':{'id':_0x361f99[_0x0100('0x4a')]['id']}})[_0x0100('0x26')](handleEntityNotFound(_0x2e27da,null))['then'](function(_0x406ae2){if(_0x406ae2){return _0x406ae2['addActions'](_0x361f99[_0x0100('0x49')][_0x0100('0x4d')],_[_0x0100('0x54')](_0x361f99[_0x0100('0x49')],[_0x0100('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x2e27da,null))[_0x0100('0x45')](handleError(_0x2e27da,null));};exports[_0x0100('0x55')]=function(_0x315edb,_0x17c7ff,_0x181f44){var _0x3b818a={};var _0x19b21f={};var _0x456e61;var _0x1711a6;return db['Automation'][_0x0100('0x4e')]({'where':{'id':_0x315edb['params']['id']}})[_0x0100('0x26')](handleEntityNotFound(_0x17c7ff,null))[_0x0100('0x26')](function(_0x4f098c){if(_0x4f098c){_0x456e61=_0x4f098c;_0x19b21f[_0x0100('0x33')]=_[_0x0100('0x46')](db[_0x0100('0x53')]['rawAttributes']);_0x19b21f['query']=_[_0x0100('0x46')](_0x315edb[_0x0100('0x34')]);_0x19b21f[_0x0100('0x35')]=_[_0x0100('0x36')](_0x19b21f[_0x0100('0x33')],_0x19b21f[_0x0100('0x34')]);_0x3b818a[_0x0100('0x38')]=_[_0x0100('0x36')](_0x19b21f[_0x0100('0x33')],qs['fields'](_0x315edb[_0x0100('0x34')][_0x0100('0x37')]));_0x3b818a[_0x0100('0x38')]=_0x3b818a[_0x0100('0x38')][_0x0100('0x4f')]?_0x3b818a[_0x0100('0x38')]:_0x19b21f[_0x0100('0x33')];_0x3b818a[_0x0100('0x3b')]=qs['sort'](_0x315edb['query'][_0x0100('0x50')]);_0x3b818a[_0x0100('0x3c')]=qs[_0x0100('0x35')](_[_0x0100('0x3d')](_0x315edb[_0x0100('0x34')],_0x19b21f['filters']));if(_0x315edb[_0x0100('0x34')][_0x0100('0x3e')]){_0x3b818a[_0x0100('0x3c')]=_[_0x0100('0x3f')](_0x3b818a[_0x0100('0x3c')],{'$or':_[_0x0100('0x2e')](_0x3b818a[_0x0100('0x38')],function(_0x581ce9){var _0x38d489={};_0x38d489[_0x581ce9]={'$like':'%'+_0x315edb['query'][_0x0100('0x3e')]+'%'};return _0x38d489;})});}_0x3b818a=_[_0x0100('0x3f')]({},_0x3b818a,_0x315edb[_0x0100('0x41')]);return _0x456e61[_0x0100('0x55')](_0x3b818a);}})[_0x0100('0x26')](function(_0xd40579){if(_0xd40579){_0x1711a6=_0xd40579['length'];if(!_0x315edb[_0x0100('0x34')][_0x0100('0x39')](_0x0100('0x3a'))){_0x3b818a['limit']=qs[_0x0100('0x20')](_0x315edb[_0x0100('0x34')][_0x0100('0x20')]);_0x3b818a[_0x0100('0x1f')]=qs[_0x0100('0x1f')](_0x315edb[_0x0100('0x34')][_0x0100('0x1f')]);}return _0x456e61[_0x0100('0x55')](_0x3b818a);}})[_0x0100('0x26')](function(_0x559864){if(_0x559864){return _0x559864?{'count':_0x1711a6,'rows':_0x559864}:null;}})['then'](respondWithResult(_0x17c7ff,null))[_0x0100('0x45')](handleError(_0x17c7ff,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 94575f7..2e3c4aa 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 _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x3c7d35,_0x21c78d){var _0x5aa547=function(_0x5782f2){while(--_0x5782f2){_0x3c7d35['push'](_0x3c7d35['shift']());}};_0x5aa547(++_0x21c78d);}(_0xb138,0x1dd));var _0x8b13=function(_0x4058be,_0x1550c3){_0x4058be=_0x4058be-0x0;var _0x23fdd8=_0xb138[_0x4058be];return _0x23fdd8;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb458=['path','rimraf','./automation.attributes','define','Automation','tools_automations','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x447029,_0x147609){var _0x533de8=function(_0x17586f){while(--_0x17586f){_0x447029['push'](_0x447029['shift']());}};_0x533de8(++_0x147609);}(_0xb458,0x103));var _0x8b45=function(_0x39b9b3,_0x3e9a66){_0x39b9b3=_0x39b9b3-0x0;var _0x4977c8=_0xb458[_0x39b9b3];return _0x4977c8;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require(_0x8b45('0x4'));var fs=require('fs');var path=require(_0x8b45('0x5'));var rimraf=require(_0x8b45('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b45('0x7'));module['exports']=function(_0x5cc2d5,_0xe8d774){return _0x5cc2d5[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'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 d2b1108..399c438 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 _0x39bf=['Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1e8042,_0x2d4ee4){var _0x30a1ed=function(_0x3fa1b2){while(--_0x3fa1b2){_0x1e8042['push'](_0x1e8042['shift']());}};_0x30a1ed(++_0x2d4ee4);}(_0x39bf,0x131));var _0xf39b=function(_0xc5fb7c,_0x457195){_0xc5fb7c=_0xc5fb7c-0x0;var _0x1b6f91=_0x39bf[_0xc5fb7c];return _0x1b6f91;};'use strict';var _=require(_0xf39b('0x0'));var util=require(_0xf39b('0x1'));var moment=require(_0xf39b('0x2'));var BPromise=require(_0xf39b('0x3'));var rs=require(_0xf39b('0x4'));var fs=require('fs');var Redis=require(_0xf39b('0x5'));var db=require(_0xf39b('0x6'))['db'];var utils=require(_0xf39b('0x7'));var logger=require('../../config/logger')(_0xf39b('0x8'));var config=require(_0xf39b('0x9'));var jayson=require(_0xf39b('0xa'));var client=jayson['client'][_0xf39b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8fdf2f,_0x2b5a04,_0xb3f009){return new BPromise(function(_0x31d850,_0x120546){return client[_0xf39b('0xc')](_0x8fdf2f,_0xb3f009)[_0xf39b('0xd')](function(_0x565014){logger['info'](_0xf39b('0xe'),_0x2b5a04,_0xf39b('0xf'));logger[_0xf39b('0x10')](_0xf39b('0x11'),_0x2b5a04,_0xf39b('0xf'),JSON[_0xf39b('0x12')](_0x565014));if(_0x565014['error']){if(_0x565014['error']['code']===0x1f4){logger[_0xf39b('0x13')]('Automation,\x20%s,\x20%s',_0x2b5a04,_0x565014[_0xf39b('0x13')][_0xf39b('0x14')]);return _0x120546(_0x565014['error']['message']);}logger[_0xf39b('0x13')](_0xf39b('0xe'),_0x2b5a04,_0x565014[_0xf39b('0x13')][_0xf39b('0x14')]);return _0x31d850(_0x565014[_0xf39b('0x13')][_0xf39b('0x14')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x2b5a04,_0xf39b('0xf'));_0x31d850(_0x565014[_0xf39b('0x15')][_0xf39b('0x14')]);}})[_0xf39b('0x16')](function(_0x1ca10d){logger[_0xf39b('0x13')](_0xf39b('0xe'),_0x2b5a04,_0x1ca10d);_0x120546(_0x1ca10d);});});} \ No newline at end of file +var _0xb7a7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','stringify','error','code','message','Automation,\x20%s,\x20%s','info'];(function(_0x22cd8c,_0x3a75f7){var _0x597bd9=function(_0x5a55bf){while(--_0x5a55bf){_0x22cd8c['push'](_0x22cd8c['shift']());}};_0x597bd9(++_0x3a75f7);}(_0xb7a7,0x98));var _0x7b7a=function(_0x4460ae,_0x1dfe5){_0x4460ae=_0x4460ae-0x0;var _0x51d9ff=_0xb7a7[_0x4460ae];return _0x51d9ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b7a('0x0'));var BPromise=require(_0x7b7a('0x1'));var rs=require(_0x7b7a('0x2'));var fs=require('fs');var Redis=require(_0x7b7a('0x3'));var db=require(_0x7b7a('0x4'))['db'];var utils=require(_0x7b7a('0x5'));var logger=require(_0x7b7a('0x6'))(_0x7b7a('0x7'));var config=require(_0x7b7a('0x8'));var jayson=require(_0x7b7a('0x9'));var client=jayson['client'][_0x7b7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dd368,_0x270c21,_0x1c21a5){return new BPromise(function(_0x550fdf,_0x4a56b9){return client['request'](_0x2dd368,_0x1c21a5)[_0x7b7a('0xb')](function(_0x544736){logger['info']('Automation,\x20%s,\x20%s',_0x270c21,_0x7b7a('0xc'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x270c21,_0x7b7a('0xc'),JSON[_0x7b7a('0xd')](_0x544736));if(_0x544736[_0x7b7a('0xe')]){if(_0x544736[_0x7b7a('0xe')][_0x7b7a('0xf')]===0x1f4){logger[_0x7b7a('0xe')]('Automation,\x20%s,\x20%s',_0x270c21,_0x544736[_0x7b7a('0xe')][_0x7b7a('0x10')]);return _0x4a56b9(_0x544736[_0x7b7a('0xe')]['message']);}logger[_0x7b7a('0xe')](_0x7b7a('0x11'),_0x270c21,_0x544736[_0x7b7a('0xe')][_0x7b7a('0x10')]);return _0x550fdf(_0x544736[_0x7b7a('0xe')]['message']);}else{logger[_0x7b7a('0x12')](_0x7b7a('0x11'),_0x270c21,_0x7b7a('0xc'));_0x550fdf(_0x544736['result'][_0x7b7a('0x10')]);}})['catch'](function(_0x354948){logger[_0x7b7a('0xe')](_0x7b7a('0x11'),_0x270c21,_0x354948);_0x4a56b9(_0x354948);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index a3f510e..243f7a6 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 _0x9b05=['express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','getConditions','getActions','post','/:id/conditions','addConditions','addActions','/:id','update','delete','destroy','util','path','connect-timeout'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x9b05,0x1cb));var _0x59b0=function(_0x5c3429,_0x305dbc){_0x5c3429=_0x5c3429-0x0;var _0x3e8263=_0x9b05[_0x5c3429];return _0x3e8263;};'use strict';var multer=require('multer');var util=require(_0x59b0('0x0'));var path=require(_0x59b0('0x1'));var timeout=require(_0x59b0('0x2'));var express=require(_0x59b0('0x3'));var router=express[_0x59b0('0x4')]();var auth=require(_0x59b0('0x5'));var interaction=require(_0x59b0('0x6'));var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x59b0('0x7')]('/',auth[_0x59b0('0x8')](),controller[_0x59b0('0x9')]);router[_0x59b0('0x7')]('/:id',auth[_0x59b0('0x8')](),controller[_0x59b0('0xa')]);router[_0x59b0('0x7')]('/:id/conditions',auth[_0x59b0('0x8')](),controller[_0x59b0('0xb')]);router[_0x59b0('0x7')]('/:id/actions',auth[_0x59b0('0x8')](),controller[_0x59b0('0xc')]);router[_0x59b0('0xd')]('/',auth[_0x59b0('0x8')](),controller['create']);router[_0x59b0('0xd')](_0x59b0('0xe'),auth[_0x59b0('0x8')](),controller[_0x59b0('0xf')]);router[_0x59b0('0xd')]('/:id/actions',auth['isAuthenticated'](),controller[_0x59b0('0x10')]);router['put'](_0x59b0('0x11'),auth['isAuthenticated'](),controller[_0x59b0('0x12')]);router[_0x59b0('0x13')]('/:id',auth[_0x59b0('0x8')](),controller[_0x59b0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa4a9=['../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4fb73e,_0x17f37d){var _0x14de68=function(_0xf5eeed){while(--_0xf5eeed){_0x4fb73e['push'](_0x4fb73e['shift']());}};_0x14de68(++_0x17f37d);}(_0xa4a9,0x126));var _0x9a4a=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xa4a9[_0x1992f1];return _0x413dfe;};'use strict';var multer=require(_0x9a4a('0x0'));var util=require(_0x9a4a('0x1'));var path=require('path');var timeout=require(_0x9a4a('0x2'));var express=require(_0x9a4a('0x3'));var router=express[_0x9a4a('0x4')]();var auth=require(_0x9a4a('0x5'));var interaction=require(_0x9a4a('0x6'));var config=require(_0x9a4a('0x7'));var controller=require(_0x9a4a('0x8'));router[_0x9a4a('0x9')]('/',auth[_0x9a4a('0xa')](),controller[_0x9a4a('0xb')]);router[_0x9a4a('0x9')](_0x9a4a('0xc'),auth[_0x9a4a('0xa')](),controller[_0x9a4a('0xd')]);router[_0x9a4a('0x9')](_0x9a4a('0xe'),auth[_0x9a4a('0xa')](),controller[_0x9a4a('0xf')]);router[_0x9a4a('0x9')](_0x9a4a('0x10'),auth['isAuthenticated'](),controller[_0x9a4a('0x11')]);router[_0x9a4a('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9a4a('0x12')](_0x9a4a('0xe'),auth['isAuthenticated'](),controller[_0x9a4a('0x13')]);router[_0x9a4a('0x12')]('/:id/actions',auth[_0x9a4a('0xa')](),controller[_0x9a4a('0x14')]);router['put'](_0x9a4a('0xc'),auth[_0x9a4a('0xa')](),controller[_0x9a4a('0x15')]);router[_0x9a4a('0x16')](_0x9a4a('0xc'),auth[_0x9a4a('0xa')](),controller[_0x9a4a('0x17')]);module[_0x9a4a('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index da583a8..7b0977b 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 _0xbd87=['DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x493c6d,_0xb6668f){var _0x29da08=function(_0xb33e20){while(--_0xb33e20){_0x493c6d['push'](_0x493c6d['shift']());}};_0x29da08(++_0xb6668f);}(_0xbd87,0x1af));var _0x7bd8=function(_0x573399,_0xcc8f15){_0x573399=_0x573399-0x0;var _0x171548=_0xbd87[_0x573399];return _0x171548;};'use strict';var Sequelize=require(_0x7bd8('0x0'));module['exports']={'name':{'type':Sequelize[_0x7bd8('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x7bd8('0x2')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x7bd8('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x7bd8('0x3')},'limitCalls':{'type':Sequelize[_0x7bd8('0x4')](0x4)[_0x7bd8('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7bd8('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7bd8('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x7bd8('0x4')](0x3)[_0x7bd8('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7bd8('0x4')](0x3)[_0x7bd8('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7bd8('0x7')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7bd8('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7bd8('0x8')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7bd8('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7bd8('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7bd8('0x4')](0x3)[_0x7bd8('0x5')],'defaultValue':0x3,'comment':_0x7bd8('0xa')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7bd8('0x4')](0x5)[_0x7bd8('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7bd8('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7bd8('0xb')},'dialTimezone':{'type':Sequelize[_0x7bd8('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7bd8('0x1')],'defaultValue':_0x7bd8('0xc')},'dialCheckDuplicateType':{'type':Sequelize[_0x7bd8('0xd')](_0x7bd8('0xe'),_0x7bd8('0xf'),'onlyIfOpen'),'defaultValue':_0x7bd8('0xe')},'dialAMDActive':{'type':Sequelize[_0x7bd8('0x10')],'defaultValue':0x0,'comment':_0x7bd8('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7bd8('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x7bd8('0x4')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7bd8('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7bd8('0x4')](0x9)[_0x7bd8('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7bd8('0x4')](0x9)[_0x7bd8('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7bd8('0x13')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x7bd8('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7bd8('0x4')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7bd8('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7bd8('0x4')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7bd8('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7bd8('0x4')](0x5)[_0x7bd8('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7bd8('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7bd8('0x4')](0x9)[_0x7bd8('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7bd8('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7bd8('0xd')](_0x7bd8('0x18'),_0x7bd8('0x19')),'defaultValue':_0x7bd8('0x18')},'dialPrefix':{'type':Sequelize[_0x7bd8('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7bd8('0x4')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x7bd8('0x4')](0x3)[_0x7bd8('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7bd8('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7bd8('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7bd8('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7bd8('0x4')](0x5)[_0x7bd8('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7bd8('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7bd8('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x7bd8('0x4')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7bd8('0x4')](0x3)[_0x7bd8('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7bd8('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7bd8('0x4')](0x5)[_0x7bd8('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7bd8('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x7bd8('0x4')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7bd8('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7bd8('0x4')](0x5)[_0x7bd8('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7bd8('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7bd8('0x4')](0x3)[_0x7bd8('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7bd8('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7bd8('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7bd8('0x22')}}; \ No newline at end of file +var _0x3ecd=['ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','exports','STRING','name'];(function(_0xd10919,_0x2d66ab){var _0x3e88f4=function(_0x32dbae){while(--_0x32dbae){_0xd10919['push'](_0xd10919['shift']());}};_0x3e88f4(++_0x2d66ab);}(_0x3ecd,0x173));var _0xd3ec=function(_0x5b9f70,_0x28f96b){_0x5b9f70=_0x5b9f70-0x0;var _0x2ef954=_0x3ecd[_0x5b9f70];return _0x2ef954;};'use strict';var Sequelize=require('sequelize');module[_0xd3ec('0x0')]={'name':{'type':Sequelize[_0xd3ec('0x1')],'unique':_0xd3ec('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xd3ec('0x3')),'allowNull':![],'defaultValue':_0xd3ec('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xd3ec('0x4')],'defaultValue':0x0,'comment':_0xd3ec('0x5')},'limitCalls':{'type':Sequelize[_0xd3ec('0x6')](0x4)[_0xd3ec('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xd3ec('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3ec('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3ec('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3ec('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3ec('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3ec('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd3ec('0xd')},'dialTimezone':{'type':Sequelize[_0xd3ec('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xd3ec('0x1')],'defaultValue':_0xd3ec('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xd3ec('0xf')](_0xd3ec('0x10'),_0xd3ec('0x11'),_0xd3ec('0x12')),'defaultValue':_0xd3ec('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd3ec('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd3ec('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd3ec('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd3ec('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd3ec('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd3ec('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd3ec('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd3ec('0x6')](0x9)[_0xd3ec('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd3ec('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd3ec('0xf')](_0xd3ec('0x1a'),'ASC'),'defaultValue':_0xd3ec('0x1a')},'dialPrefix':{'type':Sequelize[_0xd3ec('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xd3ec('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd3ec('0x1b')},'dialCutDigit':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd3ec('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3ec('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3ec('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xd3ec('0x6')](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3ec('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd3ec('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd3ec('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd3ec('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd3ec('0x6')](0x5)[_0xd3ec('0x7')],'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 08714be..3e765d6 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 _0x9d1a=['createdAt','updatedAt','autoAssociation','getHoppers','CmHopper','nolimit','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','CampaignId','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','scheduledAt','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','update','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit'];(function(_0x356ba8,_0x2b3e31){var _0x2f9af1=function(_0x1178d6){while(--_0x1178d6){_0x356ba8['push'](_0x356ba8['shift']());}};_0x2f9af1(++_0x2b3e31);}(_0x9d1a,0x13b));var _0xa9d1=function(_0x3a55a7,_0x1c2b0a){_0x3a55a7=_0x3a55a7-0x0;var _0x5caec0=_0x9d1a[_0x3a55a7];return _0x5caec0;};'use strict';var pdf=require(_0xa9d1('0x0'));var emlformat=require(_0xa9d1('0x1'));var rimraf=require(_0xa9d1('0x2'));var zipdir=require(_0xa9d1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9d1('0x4'));var moment=require(_0xa9d1('0x5'));var BPromise=require(_0xa9d1('0x6'));var Mustache=require(_0xa9d1('0x7'));var util=require(_0xa9d1('0x8'));var path=require(_0xa9d1('0x9'));var sox=require(_0xa9d1('0xa'));var csv=require(_0xa9d1('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa9d1('0xc'));var crypto=require('crypto');var jsforce=require(_0xa9d1('0xd'));var deskjs=require(_0xa9d1('0xe'));var toCsv=require(_0xa9d1('0xb'));var querystring=require(_0xa9d1('0xf'));var Papa=require(_0xa9d1('0x10'));var Redis=require(_0xa9d1('0x11'));var authService=require(_0xa9d1('0x12'));var qs=require(_0xa9d1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9d1('0x14'));var utils=require(_0xa9d1('0x15'));var config=require('../../config/environment');var db=require(_0xa9d1('0x16'))['db'];function respondWithStatusCode(_0x34b416,_0x21810a){_0x21810a=_0x21810a||0xcc;return function(_0x52ff84){if(_0x52ff84){return _0x34b416[_0xa9d1('0x17')](_0x21810a);}return _0x34b416[_0xa9d1('0x18')](_0x21810a)[_0xa9d1('0x19')]();};}function respondWithResult(_0x56d4bc,_0x58536f){_0x58536f=_0x58536f||0xc8;return function(_0x581a5a){if(_0x581a5a){return _0x56d4bc[_0xa9d1('0x18')](_0x58536f)[_0xa9d1('0x1a')](_0x581a5a);}};}function respondWithFilteredResult(_0x1b7bbb,_0x5b6703){return function(_0x3d2919){if(_0x3d2919){var _0x15eab7=_0x3d2919[_0xa9d1('0x1b')],_0x4a26af=_0x5b6703['offset'],_0x5298d9=_0x5b6703['offset']+_0x5b6703[_0xa9d1('0x1c')],_0x1e0eed;if(_0x5298d9>=_0x15eab7){_0x5298d9=_0x15eab7;_0x1e0eed=0xc8;}else{_0x1e0eed=0xce;}_0x1b7bbb[_0xa9d1('0x18')](_0x1e0eed);return _0x1b7bbb['set'](_0xa9d1('0x1d'),_0x4a26af+'-'+_0x5298d9+'/'+_0x15eab7)[_0xa9d1('0x1a')](_0x3d2919);}return null;};}function patchUpdates(_0x5a755c){return function(_0x2615b9){try{jsonpatch['apply'](_0x2615b9,_0x5a755c,!![]);}catch(_0x49b631){return BPromise['reject'](_0x49b631);}return _0x2615b9['save']();};}function saveUpdates(_0x311991,_0x4066eb){return function(_0x30541d){if(_0x30541d){return _0x30541d[_0xa9d1('0x1e')](_0x311991)['then'](function(_0x8e2a0b){return _0x8e2a0b;});}return null;};}function removeEntity(_0x18cc58,_0x3c967f){return function(_0x4bdeaf){if(_0x4bdeaf){return _0x4bdeaf[_0xa9d1('0x1f')]()[_0xa9d1('0x20')](function(){var _0x798eb3=_0x4bdeaf[_0xa9d1('0x21')]({'plain':!![]});var _0x2e5ae0=_0xa9d1('0x22');return db[_0xa9d1('0x23')][_0xa9d1('0x1f')]({'where':{'type':_0x2e5ae0,'resourceId':_0x798eb3['id']}})[_0xa9d1('0x20')](function(){return _0x4bdeaf;});})[_0xa9d1('0x20')](function(){_0x18cc58['status'](0xcc)[_0xa9d1('0x19')]();});}};}function handleEntityNotFound(_0xa5795c,_0x427749){return function(_0x5549bb){if(!_0x5549bb){_0xa5795c['sendStatus'](0x194);}return _0x5549bb;};}function handleError(_0x4e64b4,_0x30a4e7){_0x30a4e7=_0x30a4e7||0x1f4;return function(_0x20d68b){logger[_0xa9d1('0x24')](_0x20d68b[_0xa9d1('0x25')]);if(_0x20d68b[_0xa9d1('0x26')]){delete _0x20d68b[_0xa9d1('0x26')];}_0x4e64b4[_0xa9d1('0x18')](_0x30a4e7)['send'](_0x20d68b);};}exports[_0xa9d1('0x27')]=function(_0x2d86a3,_0xe34198){var _0x138599={},_0x561caf={},_0x325431={'count':0x0,'rows':[]};var _0x252e36=_[_0xa9d1('0x28')](db[_0xa9d1('0x29')][_0xa9d1('0x2a')],function(_0x3fe467){return{'name':_0x3fe467[_0xa9d1('0x2b')],'type':_0x3fe467[_0xa9d1('0x2c')][_0xa9d1('0x2d')]};});_0x561caf[_0xa9d1('0x2e')]=_['map'](_0x252e36,_0xa9d1('0x26'));_0x561caf[_0xa9d1('0x2f')]=_[_0xa9d1('0x30')](_0x2d86a3[_0xa9d1('0x2f')]);_0x561caf[_0xa9d1('0x31')]=_[_0xa9d1('0x32')](_0x561caf[_0xa9d1('0x2e')],_0x561caf['query']);_0x138599[_0xa9d1('0x33')]=_[_0xa9d1('0x32')](_0x561caf[_0xa9d1('0x2e')],qs[_0xa9d1('0x34')](_0x2d86a3['query'][_0xa9d1('0x34')]));_0x138599['attributes']=_0x138599[_0xa9d1('0x33')][_0xa9d1('0x35')]?_0x138599['attributes']:_0x561caf['model'];if(!_0x2d86a3['query'][_0xa9d1('0x36')]('nolimit')){_0x138599[_0xa9d1('0x1c')]=qs[_0xa9d1('0x1c')](_0x2d86a3[_0xa9d1('0x2f')][_0xa9d1('0x1c')]);_0x138599[_0xa9d1('0x37')]=qs[_0xa9d1('0x37')](_0x2d86a3[_0xa9d1('0x2f')][_0xa9d1('0x37')]);}_0x138599[_0xa9d1('0x38')]=qs[_0xa9d1('0x39')](_0x2d86a3[_0xa9d1('0x2f')]['sort']);_0x138599[_0xa9d1('0x3a')]=qs['filters'](_[_0xa9d1('0x3b')](_0x2d86a3[_0xa9d1('0x2f')],_0x561caf['filters']),_0x252e36);if(_0x2d86a3['query']['filter']){_0x138599[_0xa9d1('0x3a')]=_[_0xa9d1('0x3c')](_0x138599[_0xa9d1('0x3a')],{'$or':_['map'](_0x252e36,function(_0xe38137){if(_0xe38137[_0xa9d1('0x2c')]!=='VIRTUAL'){var _0x3f8112={};_0x3f8112[_0xe38137[_0xa9d1('0x26')]]={'$like':'%'+_0x2d86a3[_0xa9d1('0x2f')][_0xa9d1('0x3d')]+'%'};return _0x3f8112;}})});}_0x138599=_[_0xa9d1('0x3c')]({},_0x138599,_0x2d86a3[_0xa9d1('0x3e')]);var _0x2af535={'where':_0x138599[_0xa9d1('0x3a')]};return db[_0xa9d1('0x29')]['count'](_0x2af535)['then'](function(_0x3ff8a8){_0x325431[_0xa9d1('0x1b')]=_0x3ff8a8;if(_0x2d86a3[_0xa9d1('0x2f')][_0xa9d1('0x3f')]){_0x138599[_0xa9d1('0x40')]=[{'all':!![]}];}return db[_0xa9d1('0x29')][_0xa9d1('0x41')](_0x138599);})[_0xa9d1('0x20')](function(_0x38fe39){_0x325431[_0xa9d1('0x42')]=_0x38fe39;return _0x325431;})[_0xa9d1('0x20')](respondWithFilteredResult(_0xe34198,_0x138599))['catch'](handleError(_0xe34198,null));};exports[_0xa9d1('0x43')]=function(_0x135d52,_0x33a3cd){var _0x42ad0d={'raw':![],'where':{'id':_0x135d52[_0xa9d1('0x44')]['id']}},_0x27c69e={};_0x27c69e['model']=_['keys'](db[_0xa9d1('0x29')][_0xa9d1('0x2a')]);_0x27c69e[_0xa9d1('0x2f')]=_[_0xa9d1('0x30')](_0x135d52[_0xa9d1('0x2f')]);_0x27c69e[_0xa9d1('0x31')]=_[_0xa9d1('0x32')](_0x27c69e['model'],_0x27c69e[_0xa9d1('0x2f')]);_0x42ad0d[_0xa9d1('0x33')]=_[_0xa9d1('0x32')](_0x27c69e[_0xa9d1('0x2e')],qs[_0xa9d1('0x34')](_0x135d52[_0xa9d1('0x2f')][_0xa9d1('0x34')]));_0x42ad0d[_0xa9d1('0x33')]=_0x42ad0d[_0xa9d1('0x33')][_0xa9d1('0x35')]?_0x42ad0d[_0xa9d1('0x33')]:_0x27c69e['model'];if(_0x135d52['query'][_0xa9d1('0x3f')]){_0x42ad0d[_0xa9d1('0x40')]=[{'all':!![]}];}_0x42ad0d=_[_0xa9d1('0x3c')]({},_0x42ad0d,_0x135d52[_0xa9d1('0x3e')]);return db[_0xa9d1('0x29')][_0xa9d1('0x45')](_0x42ad0d)[_0xa9d1('0x20')](handleEntityNotFound(_0x33a3cd,null))[_0xa9d1('0x20')](respondWithResult(_0x33a3cd,null))[_0xa9d1('0x46')](handleError(_0x33a3cd,null));};exports[_0xa9d1('0x47')]=function(_0x4912f0,_0x5c50aa){return db['Campaign']['create'](_0x4912f0[_0xa9d1('0x48')],{})[_0xa9d1('0x20')](function(_0x129a36){var _0x157be5=_0x4912f0[_0xa9d1('0x49')]['get']({'plain':!![]});if(!_0x157be5)throw new Error(_0xa9d1('0x4a'));if(_0x157be5[_0xa9d1('0x4b')]===_0xa9d1('0x49')){var _0x18487f=_0x129a36[_0xa9d1('0x21')]({'plain':!![]});var _0x560c95=_0xa9d1('0x22');return db[_0xa9d1('0x4c')]['find']({'where':{'name':_0x560c95,'userProfileId':_0x157be5[_0xa9d1('0x4d')]},'raw':!![]})[_0xa9d1('0x20')](function(_0x5a010a){if(_0x5a010a&&_0x5a010a['autoAssociation']===0x0){return db[_0xa9d1('0x23')][_0xa9d1('0x47')]({'name':_0x18487f[_0xa9d1('0x26')],'resourceId':_0x18487f['id'],'type':_0x5a010a[_0xa9d1('0x26')],'sectionId':_0x5a010a['id']},{})[_0xa9d1('0x20')](function(){return _0x129a36;});}else{return _0x129a36;}})[_0xa9d1('0x46')](function(_0xbae3ed){logger[_0xa9d1('0x24')](_0xa9d1('0x4e'),_0xbae3ed);throw _0xbae3ed;});}return _0x129a36;})[_0xa9d1('0x20')](respondWithResult(_0x5c50aa,0xc9))[_0xa9d1('0x46')](handleError(_0x5c50aa,null));};exports[_0xa9d1('0x4f')]=function(_0x1c4f48,_0x21df84){var _0x5e73f5={'where':{'id':_0x1c4f48[_0xa9d1('0x44')]['id']}},_0x3f793a={};_0x3f793a[_0xa9d1('0x2e')]=_[_0xa9d1('0x30')](db[_0xa9d1('0x29')][_0xa9d1('0x2a')]);_0x5e73f5[_0xa9d1('0x33')]=_[_0xa9d1('0x32')](_0x3f793a[_0xa9d1('0x2e')],qs[_0xa9d1('0x34')](_0x1c4f48[_0xa9d1('0x2f')][_0xa9d1('0x34')]));_0x5e73f5[_0xa9d1('0x33')]=_0x5e73f5[_0xa9d1('0x33')][_0xa9d1('0x35')]?_0x5e73f5['attributes']:_0x3f793a['model'];if(_0x1c4f48[_0xa9d1('0x2f')][_0xa9d1('0x3f')]){_0x5e73f5[_0xa9d1('0x40')]=[{'all':!![]}];}_0x5e73f5=_['merge']({},_0x5e73f5,_0x1c4f48[_0xa9d1('0x3e')]);return db[_0xa9d1('0x29')][_0xa9d1('0x45')](_0x5e73f5)[_0xa9d1('0x20')](handleEntityNotFound(_0x21df84,null))[_0xa9d1('0x20')](function(_0x27775f){if(_0x27775f){var _0xe66220=_0x27775f[_0xa9d1('0x21')]({'plain':!![]});_0xe66220=qs[_0xa9d1('0x50')](_0xe66220,['id',_0xa9d1('0x51'),_0xa9d1('0x52')]);_0x1c4f48[_0xa9d1('0x48')]=_['omit'](_0x1c4f48['body'],['id',_0xa9d1('0x51'),_0xa9d1('0x52')]);return db[_0xa9d1('0x29')][_0xa9d1('0x47')](_['merge'](_0xe66220,_0x1c4f48[_0xa9d1('0x48')]),{'include':_0x1c4f48[_0xa9d1('0x2f')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x1c1674){var _0x1498c3=_0x1c4f48[_0xa9d1('0x49')][_0xa9d1('0x21')]({'plain':!![]});if(!_0x1498c3)throw new Error(_0xa9d1('0x4a'));if(_0x1498c3[_0xa9d1('0x4b')]===_0xa9d1('0x49')){var _0x166384=_0x1c1674['get']({'plain':!![]});var _0x266eb4=_0xa9d1('0x22');return db['UserProfileSection'][_0xa9d1('0x45')]({'where':{'name':_0x266eb4,'userProfileId':_0x1498c3['userProfileId']},'raw':!![]})[_0xa9d1('0x20')](function(_0x430210){if(_0x430210&&_0x430210[_0xa9d1('0x53')]===0x0){return db[_0xa9d1('0x23')][_0xa9d1('0x47')]({'name':_0x166384[_0xa9d1('0x26')],'resourceId':_0x166384['id'],'type':_0x430210[_0xa9d1('0x26')],'sectionId':_0x430210['id']},{})['then'](function(){return _0x1c1674;});}else{return _0x1c1674;}})[_0xa9d1('0x46')](function(_0x2dcf34){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2dcf34);throw _0x2dcf34;});}return _0x1c1674;});}})[_0xa9d1('0x20')](respondWithResult(_0x21df84,0xc9))[_0xa9d1('0x46')](handleError(_0x21df84,null));};exports['update']=function(_0x2ac8a9,_0x2a34f2){if(_0x2ac8a9[_0xa9d1('0x48')]['id']){delete _0x2ac8a9[_0xa9d1('0x48')]['id'];}return db[_0xa9d1('0x29')][_0xa9d1('0x45')]({'where':{'id':_0x2ac8a9[_0xa9d1('0x44')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x2a34f2,null))['then'](saveUpdates(_0x2ac8a9[_0xa9d1('0x48')],null))[_0xa9d1('0x20')](respondWithResult(_0x2a34f2,null))[_0xa9d1('0x46')](handleError(_0x2a34f2,null));};exports[_0xa9d1('0x1f')]=function(_0x524773,_0x5ef934){return db[_0xa9d1('0x29')][_0xa9d1('0x45')]({'where':{'id':_0x524773[_0xa9d1('0x44')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x5ef934,null))[_0xa9d1('0x20')](removeEntity(_0x5ef934,null))['catch'](handleError(_0x5ef934,null));};exports[_0xa9d1('0x54')]=function(_0x5b18d3,_0x2c285b,_0x254754){var _0x33a8a2={'raw':!![],'where':{}};var _0x894073={};var _0x5826b8={'count':0x0,'rows':[]};return db[_0xa9d1('0x29')]['findOne']({'where':{'id':_0x5b18d3[_0xa9d1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c285b,null))[_0xa9d1('0x20')](function(_0x476fa9){if(_0x476fa9){_0x894073[_0xa9d1('0x2e')]=_[_0xa9d1('0x30')](db[_0xa9d1('0x55')]['rawAttributes']);_0x894073['query']=_[_0xa9d1('0x30')](_0x5b18d3[_0xa9d1('0x2f')]);_0x894073[_0xa9d1('0x31')]=_[_0xa9d1('0x32')](_0x894073['model'],_0x894073[_0xa9d1('0x2f')]);_0x33a8a2[_0xa9d1('0x33')]=_['intersection'](_0x894073['model'],qs['fields'](_0x5b18d3[_0xa9d1('0x2f')][_0xa9d1('0x34')]));_0x33a8a2[_0xa9d1('0x33')]=_0x33a8a2['attributes']['length']?_0x33a8a2[_0xa9d1('0x33')]:_0x894073[_0xa9d1('0x2e')];if(!_0x5b18d3['query'][_0xa9d1('0x36')](_0xa9d1('0x56'))){_0x33a8a2[_0xa9d1('0x1c')]=qs['limit'](_0x5b18d3['query']['limit']);_0x33a8a2['offset']=qs[_0xa9d1('0x37')](_0x5b18d3['query'][_0xa9d1('0x37')]);}_0x33a8a2[_0xa9d1('0x38')]=qs[_0xa9d1('0x39')](_0x5b18d3[_0xa9d1('0x2f')][_0xa9d1('0x39')]);_0x33a8a2['where']=qs[_0xa9d1('0x31')](_[_0xa9d1('0x3b')](_0x5b18d3['query'],_0x894073['filters']));_0x33a8a2[_0xa9d1('0x3a')]['CampaignId']=_0x476fa9['id'];if(_0x5b18d3['query'][_0xa9d1('0x3d')]){_0x33a8a2[_0xa9d1('0x3a')]=_[_0xa9d1('0x3c')](_0x33a8a2[_0xa9d1('0x3a')],{'$or':_[_0xa9d1('0x28')](_0x33a8a2[_0xa9d1('0x33')],function(_0x977a53){var _0x557727={};_0x557727[_0x977a53]={'$like':'%'+_0x5b18d3['query'][_0xa9d1('0x3d')]+'%'};return _0x557727;})});}_0x33a8a2=_[_0xa9d1('0x3c')]({},_0x33a8a2,_0x5b18d3[_0xa9d1('0x3e')]);return db[_0xa9d1('0x55')][_0xa9d1('0x1b')]({'where':_0x33a8a2['where']})[_0xa9d1('0x20')](function(_0x18c403){_0x5826b8[_0xa9d1('0x1b')]=_0x18c403;if(_0x5b18d3['query']['includeAll']){_0x33a8a2['include']=[{'all':!![]}];}return db[_0xa9d1('0x55')][_0xa9d1('0x41')](_0x33a8a2);})[_0xa9d1('0x20')](function(_0x3948ad){_0x5826b8['rows']=_0x3948ad;return _0x5826b8;});}})['then'](respondWithFilteredResult(_0x2c285b,_0x33a8a2))[_0xa9d1('0x46')](handleError(_0x2c285b,null));};exports[_0xa9d1('0x57')]=function(_0x1b969e,_0x14a828,_0x54ab20){var _0x3cc2b6={'raw':!![],'where':{}};var _0x1b86f1={};var _0x4783df={'count':0x0,'rows':[]};return db[_0xa9d1('0x29')][_0xa9d1('0x58')]({'where':{'id':_0x1b969e[_0xa9d1('0x44')]['id']}})['then'](handleEntityNotFound(_0x14a828,null))[_0xa9d1('0x20')](function(_0x470ff){if(_0x470ff){_0x1b86f1[_0xa9d1('0x2e')]=_[_0xa9d1('0x30')](db[_0xa9d1('0x59')][_0xa9d1('0x2a')]);_0x1b86f1[_0xa9d1('0x2f')]=_[_0xa9d1('0x30')](_0x1b969e[_0xa9d1('0x2f')]);_0x1b86f1[_0xa9d1('0x31')]=_[_0xa9d1('0x32')](_0x1b86f1[_0xa9d1('0x2e')],_0x1b86f1[_0xa9d1('0x2f')]);_0x3cc2b6[_0xa9d1('0x33')]=_['intersection'](_0x1b86f1[_0xa9d1('0x2e')],qs[_0xa9d1('0x34')](_0x1b969e[_0xa9d1('0x2f')][_0xa9d1('0x34')]));_0x3cc2b6[_0xa9d1('0x33')]=_0x3cc2b6[_0xa9d1('0x33')][_0xa9d1('0x35')]?_0x3cc2b6['attributes']:_0x1b86f1['model'];if(!_0x1b969e[_0xa9d1('0x2f')][_0xa9d1('0x36')](_0xa9d1('0x56'))){_0x3cc2b6['limit']=qs['limit'](_0x1b969e[_0xa9d1('0x2f')][_0xa9d1('0x1c')]);_0x3cc2b6[_0xa9d1('0x37')]=qs['offset'](_0x1b969e[_0xa9d1('0x2f')][_0xa9d1('0x37')]);}_0x3cc2b6[_0xa9d1('0x38')]=qs[_0xa9d1('0x39')](_0x1b969e[_0xa9d1('0x2f')][_0xa9d1('0x39')]);_0x3cc2b6[_0xa9d1('0x3a')]=qs[_0xa9d1('0x31')](_[_0xa9d1('0x3b')](_0x1b969e[_0xa9d1('0x2f')],_0x1b86f1[_0xa9d1('0x31')]));_0x3cc2b6['where']['CampaignId']=_0x470ff['id'];if(_0x1b969e['query'][_0xa9d1('0x3d')]){_0x3cc2b6['where']=_[_0xa9d1('0x3c')](_0x3cc2b6['where'],{'$or':_[_0xa9d1('0x28')](_0x3cc2b6[_0xa9d1('0x33')],function(_0x14328f){var _0x1825ca={};_0x1825ca[_0x14328f]={'$like':'%'+_0x1b969e[_0xa9d1('0x2f')][_0xa9d1('0x3d')]+'%'};return _0x1825ca;})});}_0x3cc2b6=_['merge']({},_0x3cc2b6,_0x1b969e[_0xa9d1('0x3e')]);return db[_0xa9d1('0x59')]['count']({'where':_0x3cc2b6['where']})[_0xa9d1('0x20')](function(_0x308bc7){_0x4783df[_0xa9d1('0x1b')]=_0x308bc7;if(_0x1b969e[_0xa9d1('0x2f')][_0xa9d1('0x3f')]){_0x3cc2b6['include']=[{'all':!![]}];}return db[_0xa9d1('0x59')][_0xa9d1('0x41')](_0x3cc2b6);})[_0xa9d1('0x20')](function(_0x40955d){_0x4783df[_0xa9d1('0x42')]=_0x40955d;return _0x4783df;});}})[_0xa9d1('0x20')](respondWithFilteredResult(_0x14a828,_0x3cc2b6))[_0xa9d1('0x46')](handleError(_0x14a828,null));};exports['getHopperFinals']=function(_0x485e34,_0x31716d,_0x25ab52){var _0x467a2d={'raw':!![],'where':{}};var _0x4f58ee={};var _0x11b5ae={'count':0x0,'rows':[]};return db[_0xa9d1('0x29')][_0xa9d1('0x58')]({'where':{'id':_0x485e34[_0xa9d1('0x44')]['id']}})['then'](handleEntityNotFound(_0x31716d,null))['then'](function(_0x219a0a){if(_0x219a0a){_0x4f58ee[_0xa9d1('0x2e')]=_[_0xa9d1('0x30')](db[_0xa9d1('0x5a')][_0xa9d1('0x2a')]);_0x4f58ee['query']=_[_0xa9d1('0x30')](_0x485e34[_0xa9d1('0x2f')]);_0x4f58ee[_0xa9d1('0x31')]=_[_0xa9d1('0x32')](_0x4f58ee[_0xa9d1('0x2e')],_0x4f58ee['query']);_0x467a2d[_0xa9d1('0x33')]=_[_0xa9d1('0x32')](_0x4f58ee[_0xa9d1('0x2e')],qs[_0xa9d1('0x34')](_0x485e34[_0xa9d1('0x2f')][_0xa9d1('0x34')]));_0x467a2d[_0xa9d1('0x33')]=_0x467a2d[_0xa9d1('0x33')][_0xa9d1('0x35')]?_0x467a2d[_0xa9d1('0x33')]:_0x4f58ee['model'];if(!_0x485e34[_0xa9d1('0x2f')][_0xa9d1('0x36')](_0xa9d1('0x56'))){_0x467a2d['limit']=qs['limit'](_0x485e34[_0xa9d1('0x2f')][_0xa9d1('0x1c')]);_0x467a2d[_0xa9d1('0x37')]=qs[_0xa9d1('0x37')](_0x485e34['query'][_0xa9d1('0x37')]);}_0x467a2d[_0xa9d1('0x38')]=qs[_0xa9d1('0x39')](_0x485e34['query'][_0xa9d1('0x39')]);_0x467a2d[_0xa9d1('0x3a')]=qs[_0xa9d1('0x31')](_[_0xa9d1('0x3b')](_0x485e34['query'],_0x4f58ee['filters']));_0x467a2d[_0xa9d1('0x3a')][_0xa9d1('0x5b')]=_0x219a0a['id'];if(_0x485e34[_0xa9d1('0x2f')][_0xa9d1('0x3d')]){_0x467a2d[_0xa9d1('0x3a')]=_[_0xa9d1('0x3c')](_0x467a2d[_0xa9d1('0x3a')],{'$or':_[_0xa9d1('0x28')](_0x467a2d['attributes'],function(_0x1987c3){var _0x5b1a0b={};_0x5b1a0b[_0x1987c3]={'$like':'%'+_0x485e34[_0xa9d1('0x2f')]['filter']+'%'};return _0x5b1a0b;})});}_0x467a2d=_[_0xa9d1('0x3c')]({},_0x467a2d,_0x485e34['options']);return db[_0xa9d1('0x5a')][_0xa9d1('0x1b')]({'where':_0x467a2d[_0xa9d1('0x3a')]})[_0xa9d1('0x20')](function(_0x3ab814){_0x11b5ae['count']=_0x3ab814;if(_0x485e34[_0xa9d1('0x2f')][_0xa9d1('0x3f')]){_0x467a2d[_0xa9d1('0x40')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xa9d1('0x41')](_0x467a2d);})[_0xa9d1('0x20')](function(_0x2958d0){_0x11b5ae[_0xa9d1('0x42')]=_0x2958d0;return _0x11b5ae;});}})[_0xa9d1('0x20')](respondWithFilteredResult(_0x31716d,_0x467a2d))[_0xa9d1('0x46')](handleError(_0x31716d,null));};exports[_0xa9d1('0x5c')]=function(_0x1e968d,_0x3237cc,_0x56a30e){var _0x4f5fd9={'raw':!![],'where':{}};var _0x4c9dbc={};var _0x30ef6b={'count':0x0,'rows':[]};return db[_0xa9d1('0x29')][_0xa9d1('0x58')]({'where':{'id':_0x1e968d[_0xa9d1('0x44')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x3237cc,null))[_0xa9d1('0x20')](function(_0x3bb3a1){if(_0x3bb3a1){_0x4c9dbc[_0xa9d1('0x2e')]=_[_0xa9d1('0x30')](db[_0xa9d1('0x5d')]['rawAttributes']);_0x4c9dbc[_0xa9d1('0x2f')]=_[_0xa9d1('0x30')](_0x1e968d['query']);_0x4c9dbc['filters']=_['intersection'](_0x4c9dbc[_0xa9d1('0x2e')],_0x4c9dbc['query']);_0x4f5fd9[_0xa9d1('0x33')]=_['intersection'](_0x4c9dbc[_0xa9d1('0x2e')],qs[_0xa9d1('0x34')](_0x1e968d['query'][_0xa9d1('0x34')]));_0x4f5fd9[_0xa9d1('0x33')]=_0x4f5fd9['attributes'][_0xa9d1('0x35')]?_0x4f5fd9[_0xa9d1('0x33')]:_0x4c9dbc[_0xa9d1('0x2e')];if(!_0x1e968d[_0xa9d1('0x2f')][_0xa9d1('0x36')](_0xa9d1('0x56'))){_0x4f5fd9[_0xa9d1('0x1c')]=qs[_0xa9d1('0x1c')](_0x1e968d['query'][_0xa9d1('0x1c')]);_0x4f5fd9[_0xa9d1('0x37')]=qs[_0xa9d1('0x37')](_0x1e968d['query'][_0xa9d1('0x37')]);}_0x4f5fd9[_0xa9d1('0x38')]=qs['sort'](_0x1e968d[_0xa9d1('0x2f')]['sort']);_0x4f5fd9[_0xa9d1('0x3a')]=qs[_0xa9d1('0x31')](_[_0xa9d1('0x3b')](_0x1e968d[_0xa9d1('0x2f')],_0x4c9dbc[_0xa9d1('0x31')]));_0x4f5fd9[_0xa9d1('0x3a')][_0xa9d1('0x5b')]=_0x3bb3a1['id'];if(_0x1e968d[_0xa9d1('0x2f')][_0xa9d1('0x3d')]){_0x4f5fd9[_0xa9d1('0x3a')]=_[_0xa9d1('0x3c')](_0x4f5fd9['where'],{'$or':_['map'](_0x4f5fd9[_0xa9d1('0x33')],function(_0x1c0de4){var _0x52028c={};_0x52028c[_0x1c0de4]={'$like':'%'+_0x1e968d[_0xa9d1('0x2f')][_0xa9d1('0x3d')]+'%'};return _0x52028c;})});}_0x4f5fd9=_[_0xa9d1('0x3c')]({},_0x4f5fd9,_0x1e968d[_0xa9d1('0x3e')]);return db[_0xa9d1('0x5d')][_0xa9d1('0x1b')]({'where':_0x4f5fd9[_0xa9d1('0x3a')]})[_0xa9d1('0x20')](function(_0x1d56a5){_0x30ef6b[_0xa9d1('0x1b')]=_0x1d56a5;if(_0x1e968d[_0xa9d1('0x2f')][_0xa9d1('0x3f')]){_0x4f5fd9[_0xa9d1('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xa9d1('0x41')](_0x4f5fd9);})[_0xa9d1('0x20')](function(_0x201496){_0x30ef6b['rows']=_0x201496;return _0x30ef6b;});}})[_0xa9d1('0x20')](respondWithFilteredResult(_0x3237cc,_0x4f5fd9))[_0xa9d1('0x46')](handleError(_0x3237cc,null));};exports[_0xa9d1('0x5e')]=function(_0x2865cf,_0x9fb664,_0x4b8145){var _0x409576={};var _0x4323b1={};var _0x32966a;var _0x424041;return db[_0xa9d1('0x29')][_0xa9d1('0x58')]({'where':{'id':_0x2865cf[_0xa9d1('0x44')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x9fb664,null))[_0xa9d1('0x20')](function(_0x37e7cc){if(_0x37e7cc){_0x32966a=_0x37e7cc;_0x4323b1['model']=_['keys'](db[_0xa9d1('0x5f')][_0xa9d1('0x2a')]);_0x4323b1[_0xa9d1('0x2f')]=_[_0xa9d1('0x30')](_0x2865cf[_0xa9d1('0x2f')]);_0x4323b1[_0xa9d1('0x31')]=_[_0xa9d1('0x32')](_0x4323b1['model'],_0x4323b1[_0xa9d1('0x2f')]);_0x409576[_0xa9d1('0x33')]=_['intersection'](_0x4323b1[_0xa9d1('0x2e')],qs[_0xa9d1('0x34')](_0x2865cf[_0xa9d1('0x2f')][_0xa9d1('0x34')]));_0x409576['attributes']=_0x409576[_0xa9d1('0x33')][_0xa9d1('0x35')]?_0x409576[_0xa9d1('0x33')]:_0x4323b1[_0xa9d1('0x2e')];_0x409576[_0xa9d1('0x38')]=qs[_0xa9d1('0x39')](_0x2865cf[_0xa9d1('0x2f')]['sort']);_0x409576[_0xa9d1('0x3a')]=qs['filters'](_['pick'](_0x2865cf['query'],_0x4323b1['filters']));if(_0x2865cf[_0xa9d1('0x2f')]['filter']){_0x409576['where']=_[_0xa9d1('0x3c')](_0x409576['where'],{'$or':_[_0xa9d1('0x28')](_0x409576['attributes'],function(_0x5a8aee){var _0x2910b4={};_0x2910b4[_0x5a8aee]={'$like':'%'+_0x2865cf[_0xa9d1('0x2f')]['filter']+'%'};return _0x2910b4;})});}_0x409576=_[_0xa9d1('0x3c')]({},_0x409576,_0x2865cf['options']);return _0x32966a[_0xa9d1('0x5e')](_0x409576);}})[_0xa9d1('0x20')](function(_0x4ba0ca){if(_0x4ba0ca){_0x424041=_0x4ba0ca[_0xa9d1('0x35')];if(!_0x2865cf['query'][_0xa9d1('0x36')](_0xa9d1('0x56'))){_0x409576[_0xa9d1('0x1c')]=qs[_0xa9d1('0x1c')](_0x2865cf[_0xa9d1('0x2f')][_0xa9d1('0x1c')]);_0x409576[_0xa9d1('0x37')]=qs[_0xa9d1('0x37')](_0x2865cf[_0xa9d1('0x2f')][_0xa9d1('0x37')]);}return _0x32966a[_0xa9d1('0x5e')](_0x409576);}})['then'](function(_0x28e7fa){if(_0x28e7fa){return _0x28e7fa?{'count':_0x424041,'rows':_0x28e7fa}:null;}})['then'](respondWithResult(_0x9fb664,null))[_0xa9d1('0x46')](handleError(_0x9fb664,null));};exports['addLists']=function(_0x22d812,_0x53eb9f,_0x42cfdd){var _0x3564b9,_0x10e547;return db[_0xa9d1('0x29')][_0xa9d1('0x45')]({'where':{'id':_0x22d812['params']['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x53eb9f,null))[_0xa9d1('0x20')](function(_0xea00b9){if(_0xea00b9){_0x10e547=_0xea00b9;return _0xea00b9[_0xa9d1('0x60')](_0x22d812[_0xa9d1('0x48')][_0xa9d1('0x61')],_['omit'](_0x22d812['body'],[_0xa9d1('0x61'),'id'])||{});}return null;})['spread'](function(_0x1a35ac){var _0x233e66;_0x3564b9=_0x1a35ac||[];var _0x597de7=[];if(_0x1a35ac){for(var _0x230301=0x0;_0x230301<_0x1a35ac[_0xa9d1('0x35')];_0x230301+=0x1){var _0x230b70=_0x1a35ac[_0x230301]['get']({'plain':!![]});_0x10e547['dialCheckDuplicateType']=_0x22d812[_0xa9d1('0x48')]['dialCheckDuplicateType']?_0x22d812[_0xa9d1('0x48')][_0xa9d1('0x62')]:_0x10e547[_0xa9d1('0x62')];switch(_0x10e547[_0xa9d1('0x62')]){case _0xa9d1('0x63'):_0x233e66=squel['insert']()['into'](_0xa9d1('0x64'))[_0xa9d1('0x65')]([_0xa9d1('0x66'),'scheduledAt',_0xa9d1('0x67'),_0xa9d1('0x68'),_0xa9d1('0x5b'),_0xa9d1('0x51'),'updatedAt'],squel[_0xa9d1('0x69')]()[_0xa9d1('0x6a')]('phone','phone')['field']('NOW()',_0xa9d1('0x6b'))[_0xa9d1('0x6a')]('id',_0xa9d1('0x67'))[_0xa9d1('0x6a')](_0x230b70[_0xa9d1('0x6c')][_0xa9d1('0x6d')](),_0xa9d1('0x68'))['field'](_0x22d812[_0xa9d1('0x44')]['id']['toString'](),_0xa9d1('0x5b'))['field'](_0xa9d1('0x6e'),_0xa9d1('0x51'))[_0xa9d1('0x6a')](_0xa9d1('0x6e'),_0xa9d1('0x52'))[_0xa9d1('0x6f')](_0xa9d1('0x70'))['where'](_0xa9d1('0x71'))[_0xa9d1('0x3a')](_0xa9d1('0x72'),_0x230b70['CmListId'][_0xa9d1('0x6d')]())['where'](_0xa9d1('0x73'))[_0xa9d1('0x3a')](_0xa9d1('0x74'),squel[_0xa9d1('0x69')]()[_0xa9d1('0x6a')](_0xa9d1('0x75'))[_0xa9d1('0x6f')](_0xa9d1('0x76'))['where'](_0xa9d1('0x77'),_0x22d812['params']['id'][_0xa9d1('0x6d')]()))[_0xa9d1('0x3a')](_0xa9d1('0x74'),squel[_0xa9d1('0x69')]()[_0xa9d1('0x6a')](_0xa9d1('0x78'))[_0xa9d1('0x6f')]('cm_hopper')[_0xa9d1('0x3a')](_0xa9d1('0x77'),_0x22d812['params']['id']['toString']())))[_0xa9d1('0x6d')]();break;case _0xa9d1('0x79'):_0x233e66=squel[_0xa9d1('0x7a')]()[_0xa9d1('0x7b')](_0xa9d1('0x64'))[_0xa9d1('0x65')](['phone','scheduledAt',_0xa9d1('0x67'),_0xa9d1('0x68'),_0xa9d1('0x5b'),_0xa9d1('0x51'),_0xa9d1('0x52')],squel['select']()[_0xa9d1('0x6a')](_0xa9d1('0x66'),_0xa9d1('0x66'))[_0xa9d1('0x6a')]('NOW()',_0xa9d1('0x6b'))['field']('id','ContactId')['field'](_0x230b70[_0xa9d1('0x6c')][_0xa9d1('0x6d')](),_0xa9d1('0x68'))['field'](_0x22d812[_0xa9d1('0x44')]['id']['toString'](),_0xa9d1('0x5b'))['field'](_0xa9d1('0x6e'),'createdAt')['field'](_0xa9d1('0x6e'),_0xa9d1('0x52'))[_0xa9d1('0x6f')](_0xa9d1('0x70'))[_0xa9d1('0x3a')]('deletedAt\x20IS\x20NULL')[_0xa9d1('0x3a')](_0xa9d1('0x72'),_0x230b70['CmListId']['toString']())[_0xa9d1('0x3a')](_0xa9d1('0x73'))[_0xa9d1('0x3a')](_0xa9d1('0x74'),squel[_0xa9d1('0x69')]()[_0xa9d1('0x6a')](_0xa9d1('0x78'))[_0xa9d1('0x6f')]('cm_hopper')[_0xa9d1('0x3a')](_0xa9d1('0x77'),_0x22d812['params']['id'][_0xa9d1('0x6d')]())))[_0xa9d1('0x6d')]();break;default:_0x233e66=squel[_0xa9d1('0x7a')]()[_0xa9d1('0x7b')](_0xa9d1('0x64'))[_0xa9d1('0x65')]([_0xa9d1('0x66'),_0xa9d1('0x6b'),'ContactId',_0xa9d1('0x68'),_0xa9d1('0x5b'),_0xa9d1('0x51'),'updatedAt'],squel['select']()[_0xa9d1('0x6a')](_0xa9d1('0x66'),_0xa9d1('0x66'))[_0xa9d1('0x6a')](_0xa9d1('0x6e'),'scheduledAt')[_0xa9d1('0x6a')]('id',_0xa9d1('0x67'))[_0xa9d1('0x6a')](_0x230b70[_0xa9d1('0x6c')][_0xa9d1('0x6d')](),_0xa9d1('0x68'))[_0xa9d1('0x6a')](_0x22d812[_0xa9d1('0x44')]['id'][_0xa9d1('0x6d')](),_0xa9d1('0x5b'))[_0xa9d1('0x6a')](_0xa9d1('0x6e'),'createdAt')[_0xa9d1('0x6a')](_0xa9d1('0x6e'),_0xa9d1('0x52'))[_0xa9d1('0x6f')](_0xa9d1('0x70'))[_0xa9d1('0x3a')](_0xa9d1('0x71'))[_0xa9d1('0x3a')](_0xa9d1('0x72'),_0x230b70[_0xa9d1('0x6c')]['toString']())[_0xa9d1('0x3a')](_0xa9d1('0x73')))[_0xa9d1('0x6d')]();}_0x597de7[_0xa9d1('0x7c')](db[_0xa9d1('0x7d')][_0xa9d1('0x2f')](_0x233e66));}return BPromise[_0xa9d1('0x7e')](_0x597de7);}})[_0xa9d1('0x20')](function(){return _0x3564b9;})[_0xa9d1('0x20')](respondWithResult(_0x53eb9f,null))[_0xa9d1('0x46')](handleError(_0x53eb9f,null));};exports[_0xa9d1('0x7f')]=function(_0x4148f8,_0x54181b,_0x5cb6be){return db[_0xa9d1('0x29')][_0xa9d1('0x45')]({'where':{'id':_0x4148f8[_0xa9d1('0x44')]['id']}})['then'](handleEntityNotFound(_0x54181b,null))[_0xa9d1('0x20')](function(_0x375524){if(_0x375524){return _0x375524[_0xa9d1('0x7f')](_0x4148f8[_0xa9d1('0x2f')][_0xa9d1('0x61')]);}})['then'](function(_0x812f68){if(_0x812f68){return db[_0xa9d1('0x55')][_0xa9d1('0x1f')]({'where':{'ListId':_0x4148f8['query'][_0xa9d1('0x61')],'CampaignId':_0x4148f8[_0xa9d1('0x44')]['id']}})[_0xa9d1('0x20')](function(){return _0x812f68;});}})[_0xa9d1('0x20')](respondWithStatusCode(_0x54181b,null))[_0xa9d1('0x46')](handleError(_0x54181b,null));};exports[_0xa9d1('0x80')]=function(_0x1eacac,_0x334142,_0x5b7dea){var _0x11a469={'raw':!![],'where':{}};var _0x38d931={};var _0x28d3e5={'count':0x0,'rows':[]};return db[_0xa9d1('0x29')][_0xa9d1('0x58')]({'where':{'id':_0x1eacac[_0xa9d1('0x44')]['id']}})['then'](handleEntityNotFound(_0x334142,null))[_0xa9d1('0x20')](function(_0x558cfe){if(_0x558cfe){_0x38d931[_0xa9d1('0x2e')]=_['keys'](db[_0xa9d1('0x5f')][_0xa9d1('0x2a')]);_0x38d931[_0xa9d1('0x2f')]=_['keys'](_0x1eacac['query']);_0x38d931[_0xa9d1('0x31')]=_[_0xa9d1('0x32')](_0x38d931[_0xa9d1('0x2e')],_0x38d931[_0xa9d1('0x2f')]);_0x11a469[_0xa9d1('0x33')]=_[_0xa9d1('0x32')](_0x38d931['model'],qs[_0xa9d1('0x34')](_0x1eacac['query'][_0xa9d1('0x34')]));_0x11a469[_0xa9d1('0x33')]=_0x11a469['attributes'][_0xa9d1('0x35')]?_0x11a469['attributes']:_0x38d931[_0xa9d1('0x2e')];if(!_0x1eacac[_0xa9d1('0x2f')]['hasOwnProperty']('nolimit')){_0x11a469['limit']=qs[_0xa9d1('0x1c')](_0x1eacac[_0xa9d1('0x2f')][_0xa9d1('0x1c')]);_0x11a469[_0xa9d1('0x37')]=qs[_0xa9d1('0x37')](_0x1eacac[_0xa9d1('0x2f')]['offset']);}_0x11a469[_0xa9d1('0x38')]=qs['sort'](_0x1eacac['query']['sort']);_0x11a469[_0xa9d1('0x3a')]=qs['filters'](_['pick'](_0x1eacac[_0xa9d1('0x2f')],_0x38d931[_0xa9d1('0x31')]));_0x11a469[_0xa9d1('0x3a')][_0xa9d1('0x5b')]=_0x558cfe['id'];if(_0x1eacac[_0xa9d1('0x2f')][_0xa9d1('0x3d')]){_0x11a469['where']=_[_0xa9d1('0x3c')](_0x11a469[_0xa9d1('0x3a')],{'$or':_[_0xa9d1('0x28')](_0x11a469[_0xa9d1('0x33')],function(_0x4cbd07){var _0x36db6d={};_0x36db6d[_0x4cbd07]={'$like':'%'+_0x1eacac[_0xa9d1('0x2f')][_0xa9d1('0x3d')]+'%'};return _0x36db6d;})});}_0x11a469=_[_0xa9d1('0x3c')]({},_0x11a469,_0x1eacac['options']);return db[_0xa9d1('0x5f')][_0xa9d1('0x1b')]({'where':_0x11a469[_0xa9d1('0x3a')]})[_0xa9d1('0x20')](function(_0x5ec75f){_0x28d3e5[_0xa9d1('0x1b')]=_0x5ec75f;if(_0x1eacac[_0xa9d1('0x2f')][_0xa9d1('0x3f')]){_0x11a469[_0xa9d1('0x40')]=[{'all':!![]}];}return db[_0xa9d1('0x5f')][_0xa9d1('0x41')](_0x11a469);})[_0xa9d1('0x20')](function(_0x5b7361){_0x28d3e5[_0xa9d1('0x42')]=_0x5b7361;return _0x28d3e5;});}})[_0xa9d1('0x20')](respondWithFilteredResult(_0x334142,_0x11a469))[_0xa9d1('0x46')](handleError(_0x334142,null));};exports[_0xa9d1('0x81')]=function(_0x3c8ad9,_0x1029b4,_0x392e30){var _0x53118d,_0x3b7f8c;return db[_0xa9d1('0x29')][_0xa9d1('0x45')]({'where':{'id':_0x3c8ad9[_0xa9d1('0x44')]['id']}})[_0xa9d1('0x20')](handleEntityNotFound(_0x1029b4,null))[_0xa9d1('0x20')](function(_0x5285c8){if(_0x5285c8){_0x3b7f8c=_0x5285c8;return _0x5285c8[_0xa9d1('0x81')](_0x3c8ad9['body'][_0xa9d1('0x61')],_[_0xa9d1('0x50')](_0x3c8ad9[_0xa9d1('0x48')],[_0xa9d1('0x61'),'id'])||{});}return null;})[_0xa9d1('0x82')](function(_0x27baf2){var _0x45267c;_0x53118d=_0x27baf2||[];var _0x3036e5=[];if(_0x27baf2){for(var _0x28ac10=0x0;_0x28ac10<_0x27baf2[_0xa9d1('0x35')];_0x28ac10+=0x1){var _0x4fc503=_0x27baf2[_0x28ac10]['get']({'plain':!![]});_0x45267c=squel[_0xa9d1('0x7a')]()[_0xa9d1('0x7b')]('cm_hopper_black')[_0xa9d1('0x65')]([_0xa9d1('0x66'),_0xa9d1('0x67'),_0xa9d1('0x68'),'CampaignId','createdAt','updatedAt'],squel['select']()[_0xa9d1('0x6a')](_0xa9d1('0x66'),'phone')[_0xa9d1('0x6a')]('id',_0xa9d1('0x67'))[_0xa9d1('0x6a')](_0x4fc503['CmListId'][_0xa9d1('0x6d')](),_0xa9d1('0x68'))['field'](_0x3c8ad9[_0xa9d1('0x44')]['id']['toString'](),'CampaignId')['field'](_0xa9d1('0x6e'),'createdAt')[_0xa9d1('0x6a')](_0xa9d1('0x6e'),'updatedAt')['from'](_0xa9d1('0x70'))[_0xa9d1('0x3a')](_0xa9d1('0x71'))[_0xa9d1('0x3a')](_0xa9d1('0x72'),_0x4fc503[_0xa9d1('0x6c')][_0xa9d1('0x6d')]())[_0xa9d1('0x3a')](_0xa9d1('0x73')))[_0xa9d1('0x6d')]();_0x3036e5[_0xa9d1('0x7c')](db[_0xa9d1('0x7d')]['query'](_0x45267c));}return BPromise[_0xa9d1('0x7e')](_0x3036e5);}})[_0xa9d1('0x20')](function(){return _0x53118d;})[_0xa9d1('0x20')](respondWithResult(_0x1029b4,null))[_0xa9d1('0x46')](handleError(_0x1029b4,null));};exports[_0xa9d1('0x83')]=function(_0x4d238a,_0x4411b5,_0x4e85f0){return db[_0xa9d1('0x29')][_0xa9d1('0x45')]({'where':{'id':_0x4d238a[_0xa9d1('0x44')]['id']}})['then'](handleEntityNotFound(_0x4411b5,null))[_0xa9d1('0x20')](function(_0x1b1d08){if(_0x1b1d08){return _0x1b1d08[_0xa9d1('0x83')](_0x4d238a[_0xa9d1('0x2f')][_0xa9d1('0x61')]);}})[_0xa9d1('0x20')](function(_0x333eb7){if(_0x333eb7){return db[_0xa9d1('0x5d')][_0xa9d1('0x1f')]({'where':{'ListId':_0x4d238a['query'][_0xa9d1('0x61')],'CampaignId':_0x4d238a[_0xa9d1('0x44')]['id']}})['then'](function(){return _0x333eb7;});}})[_0xa9d1('0x20')](respondWithStatusCode(_0x4411b5,null))[_0xa9d1('0x46')](handleError(_0x4411b5,null));}; \ No newline at end of file +var _0x5559=['CmHopperHistory','rows','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','ContactId','select','field','phone','NOW()','scheduledAt','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','insert','push','sequelize','addBlackLists','cm_hopper_black','ListId\x20=\x20?','all','removeBlackLists','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','Campaign','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','catch','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','clone','include','omit','createdAt','updatedAt','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','order','pick','CampaignId','getHopperHistories'];(function(_0x3eebe3,_0x3574d0){var _0x357678=function(_0x348cf0){while(--_0x348cf0){_0x3eebe3['push'](_0x3eebe3['shift']());}};_0x357678(++_0x3574d0);}(_0x5559,0x1b6));var _0x9555=function(_0x246bd0,_0x313a52){_0x246bd0=_0x246bd0-0x0;var _0x15f1e0=_0x5559[_0x246bd0];return _0x15f1e0;};'use strict';var pdf=require(_0x9555('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9555('0x1'));var zipdir=require(_0x9555('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9555('0x3'));var moment=require('moment');var BPromise=require(_0x9555('0x4'));var Mustache=require(_0x9555('0x5'));var util=require('util');var path=require(_0x9555('0x6'));var sox=require(_0x9555('0x7'));var csv=require(_0x9555('0x8'));var ejs=require(_0x9555('0x9'));var fs=require('fs');var _=require(_0x9555('0xa'));var squel=require('squel');var crypto=require(_0x9555('0xb'));var jsforce=require(_0x9555('0xc'));var deskjs=require(_0x9555('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9555('0xe'));var Papa=require(_0x9555('0xf'));var Redis=require(_0x9555('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9555('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9555('0x12'));var logger=require(_0x9555('0x13'))(_0x9555('0x14'));var utils=require(_0x9555('0x15'));var config=require(_0x9555('0x16'));var db=require(_0x9555('0x17'))['db'];function respondWithStatusCode(_0x1bc8d7,_0x48d41f){_0x48d41f=_0x48d41f||0xcc;return function(_0x585986){if(_0x585986){return _0x1bc8d7[_0x9555('0x18')](_0x48d41f);}return _0x1bc8d7[_0x9555('0x19')](_0x48d41f)[_0x9555('0x1a')]();};}function respondWithResult(_0x146280,_0x2b5988){_0x2b5988=_0x2b5988||0xc8;return function(_0x54fa00){if(_0x54fa00){return _0x146280['status'](_0x2b5988)[_0x9555('0x1b')](_0x54fa00);}};}function respondWithFilteredResult(_0x4eda60,_0x1f52b2){return function(_0x484f0e){if(_0x484f0e){var _0x1dffbf=_0x484f0e[_0x9555('0x1c')],_0x2b6518=_0x1f52b2[_0x9555('0x1d')],_0x174f50=_0x1f52b2['offset']+_0x1f52b2[_0x9555('0x1e')],_0x345fe5;if(_0x174f50>=_0x1dffbf){_0x174f50=_0x1dffbf;_0x345fe5=0xc8;}else{_0x345fe5=0xce;}_0x4eda60[_0x9555('0x19')](_0x345fe5);return _0x4eda60[_0x9555('0x1f')](_0x9555('0x20'),_0x2b6518+'-'+_0x174f50+'/'+_0x1dffbf)[_0x9555('0x1b')](_0x484f0e);}return null;};}function patchUpdates(_0x38c734){return function(_0x1f8c4a){try{jsonpatch['apply'](_0x1f8c4a,_0x38c734,!![]);}catch(_0x2d3582){return BPromise[_0x9555('0x21')](_0x2d3582);}return _0x1f8c4a['save']();};}function saveUpdates(_0x780a60,_0x40b990){return function(_0x5776cc){if(_0x5776cc){return _0x5776cc['update'](_0x780a60)['then'](function(_0x266d9f){return _0x266d9f;});}return null;};}function removeEntity(_0x3acc2b,_0x1728ff){return function(_0x6432c7){if(_0x6432c7){return _0x6432c7[_0x9555('0x22')]()[_0x9555('0x23')](function(){var _0x40998a=_0x6432c7[_0x9555('0x24')]({'plain':!![]});var _0x35b192=_0x9555('0x25');return db[_0x9555('0x26')][_0x9555('0x22')]({'where':{'type':_0x35b192,'resourceId':_0x40998a['id']}})['then'](function(){return _0x6432c7;});})[_0x9555('0x23')](function(){_0x3acc2b[_0x9555('0x19')](0xcc)[_0x9555('0x1a')]();});}};}function handleEntityNotFound(_0x457ce8,_0xbfd949){return function(_0x15788e){if(!_0x15788e){_0x457ce8[_0x9555('0x18')](0x194);}return _0x15788e;};}function handleError(_0x5e0260,_0x2277d){_0x2277d=_0x2277d||0x1f4;return function(_0x614b56){logger[_0x9555('0x27')](_0x614b56[_0x9555('0x28')]);if(_0x614b56[_0x9555('0x29')]){delete _0x614b56['name'];}_0x5e0260['status'](_0x2277d)[_0x9555('0x2a')](_0x614b56);};}exports['index']=function(_0x93b12f,_0x57ef15){var _0x368209={},_0x5826e3={},_0x1127cc={'count':0x0,'rows':[]};var _0xc48367=_['map'](db[_0x9555('0x2b')][_0x9555('0x2c')],function(_0x2d7669){return{'name':_0x2d7669[_0x9555('0x2d')],'type':_0x2d7669[_0x9555('0x2e')]['key']};});_0x5826e3[_0x9555('0x2f')]=_[_0x9555('0x30')](_0xc48367,'name');_0x5826e3[_0x9555('0x31')]=_[_0x9555('0x32')](_0x93b12f[_0x9555('0x31')]);_0x5826e3[_0x9555('0x33')]=_['intersection'](_0x5826e3['model'],_0x5826e3[_0x9555('0x31')]);_0x368209[_0x9555('0x34')]=_[_0x9555('0x35')](_0x5826e3[_0x9555('0x2f')],qs[_0x9555('0x36')](_0x93b12f[_0x9555('0x31')][_0x9555('0x36')]));_0x368209[_0x9555('0x34')]=_0x368209[_0x9555('0x34')][_0x9555('0x37')]?_0x368209[_0x9555('0x34')]:_0x5826e3[_0x9555('0x2f')];if(!_0x93b12f['query'][_0x9555('0x38')](_0x9555('0x39'))){_0x368209[_0x9555('0x1e')]=qs['limit'](_0x93b12f[_0x9555('0x31')][_0x9555('0x1e')]);_0x368209[_0x9555('0x1d')]=qs['offset'](_0x93b12f[_0x9555('0x31')][_0x9555('0x1d')]);}_0x368209['order']=qs[_0x9555('0x3a')](_0x93b12f[_0x9555('0x31')][_0x9555('0x3a')]);_0x368209[_0x9555('0x3b')]=qs[_0x9555('0x33')](_['pick'](_0x93b12f['query'],_0x5826e3[_0x9555('0x33')]),_0xc48367);if(_0x93b12f[_0x9555('0x31')][_0x9555('0x3c')]){_0x368209['where']=_[_0x9555('0x3d')](_0x368209[_0x9555('0x3b')],{'$or':_[_0x9555('0x30')](_0xc48367,function(_0x2054f7){if(_0x2054f7[_0x9555('0x2e')]!==_0x9555('0x3e')){var _0x15dd5c={};_0x15dd5c[_0x2054f7[_0x9555('0x29')]]={'$like':'%'+_0x93b12f['query'][_0x9555('0x3c')]+'%'};return _0x15dd5c;}})});}_0x368209=_[_0x9555('0x3d')]({},_0x368209,_0x93b12f['options']);var _0x959f1c={'where':_0x368209[_0x9555('0x3b')]};return db[_0x9555('0x2b')][_0x9555('0x1c')](_0x959f1c)[_0x9555('0x23')](function(_0x1fa2f1){_0x1127cc[_0x9555('0x1c')]=_0x1fa2f1;if(_0x93b12f[_0x9555('0x31')][_0x9555('0x3f')]){_0x368209['include']=[{'all':!![]}];}return db['Campaign'][_0x9555('0x40')](_0x368209);})['then'](function(_0x779bce){_0x1127cc['rows']=_0x779bce;return _0x1127cc;})[_0x9555('0x23')](respondWithFilteredResult(_0x57ef15,_0x368209))[_0x9555('0x41')](handleError(_0x57ef15,null));};exports['show']=function(_0x5c03c0,_0x342405){var _0x521107={'raw':![],'where':{'id':_0x5c03c0[_0x9555('0x42')]['id']}},_0x225daa={};_0x225daa['model']=_['keys'](db[_0x9555('0x2b')][_0x9555('0x2c')]);_0x225daa['query']=_[_0x9555('0x32')](_0x5c03c0[_0x9555('0x31')]);_0x225daa['filters']=_[_0x9555('0x35')](_0x225daa['model'],_0x225daa[_0x9555('0x31')]);_0x521107[_0x9555('0x34')]=_[_0x9555('0x35')](_0x225daa[_0x9555('0x2f')],qs[_0x9555('0x36')](_0x5c03c0['query'][_0x9555('0x36')]));_0x521107[_0x9555('0x34')]=_0x521107[_0x9555('0x34')][_0x9555('0x37')]?_0x521107[_0x9555('0x34')]:_0x225daa[_0x9555('0x2f')];if(_0x5c03c0['query'][_0x9555('0x3f')]){_0x521107['include']=[{'all':!![]}];}_0x521107=_[_0x9555('0x3d')]({},_0x521107,_0x5c03c0[_0x9555('0x43')]);return db[_0x9555('0x2b')]['find'](_0x521107)[_0x9555('0x23')](handleEntityNotFound(_0x342405,null))[_0x9555('0x23')](respondWithResult(_0x342405,null))[_0x9555('0x41')](handleError(_0x342405,null));};exports[_0x9555('0x44')]=function(_0x16dfa0,_0x3d28b4){return db[_0x9555('0x2b')][_0x9555('0x44')](_0x16dfa0[_0x9555('0x45')],{})['then'](function(_0x40bb43){var _0x2dbeaf=_0x16dfa0['user']['get']({'plain':!![]});if(!_0x2dbeaf)throw new Error(_0x9555('0x46'));if(_0x2dbeaf['role']==='user'){var _0x16acb7=_0x40bb43['get']({'plain':!![]});var _0x59f038=_0x9555('0x25');return db[_0x9555('0x47')][_0x9555('0x48')]({'where':{'name':_0x59f038,'userProfileId':_0x2dbeaf[_0x9555('0x49')]},'raw':!![]})[_0x9555('0x23')](function(_0x4e8621){if(_0x4e8621&&_0x4e8621[_0x9555('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x16acb7[_0x9555('0x29')],'resourceId':_0x16acb7['id'],'type':_0x4e8621['name'],'sectionId':_0x4e8621['id']},{})[_0x9555('0x23')](function(){return _0x40bb43;});}else{return _0x40bb43;}})[_0x9555('0x41')](function(_0x34f375){logger[_0x9555('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34f375);throw _0x34f375;});}return _0x40bb43;})[_0x9555('0x23')](respondWithResult(_0x3d28b4,0xc9))[_0x9555('0x41')](handleError(_0x3d28b4,null));};exports[_0x9555('0x4b')]=function(_0x362c76,_0x36d9c5){var _0x5e0edc={'where':{'id':_0x362c76[_0x9555('0x42')]['id']}},_0x4ff75b={};_0x4ff75b[_0x9555('0x2f')]=_['keys'](db[_0x9555('0x2b')]['rawAttributes']);_0x5e0edc['attributes']=_[_0x9555('0x35')](_0x4ff75b[_0x9555('0x2f')],qs['fields'](_0x362c76[_0x9555('0x31')]['fields']));_0x5e0edc['attributes']=_0x5e0edc[_0x9555('0x34')][_0x9555('0x37')]?_0x5e0edc[_0x9555('0x34')]:_0x4ff75b[_0x9555('0x2f')];if(_0x362c76[_0x9555('0x31')][_0x9555('0x3f')]){_0x5e0edc[_0x9555('0x4c')]=[{'all':!![]}];}_0x5e0edc=_['merge']({},_0x5e0edc,_0x362c76[_0x9555('0x43')]);return db[_0x9555('0x2b')]['find'](_0x5e0edc)[_0x9555('0x23')](handleEntityNotFound(_0x36d9c5,null))['then'](function(_0x54afe5){if(_0x54afe5){var _0x4f790b=_0x54afe5[_0x9555('0x24')]({'plain':!![]});_0x4f790b=qs[_0x9555('0x4d')](_0x4f790b,['id',_0x9555('0x4e'),_0x9555('0x4f')]);_0x362c76[_0x9555('0x45')]=_[_0x9555('0x4d')](_0x362c76[_0x9555('0x45')],['id','createdAt','updatedAt']);return db[_0x9555('0x2b')][_0x9555('0x44')](_[_0x9555('0x3d')](_0x4f790b,_0x362c76[_0x9555('0x45')]),{'include':_0x362c76[_0x9555('0x31')][_0x9555('0x3f')]?[{'all':!![]}]:undefined})[_0x9555('0x23')](function(_0x139170){var _0x5e4dd1=_0x362c76[_0x9555('0x50')][_0x9555('0x24')]({'plain':!![]});if(!_0x5e4dd1)throw new Error(_0x9555('0x46'));if(_0x5e4dd1['role']===_0x9555('0x50')){var _0x2ff618=_0x139170['get']({'plain':!![]});var _0x48c9b7=_0x9555('0x25');return db[_0x9555('0x47')][_0x9555('0x48')]({'where':{'name':_0x48c9b7,'userProfileId':_0x5e4dd1[_0x9555('0x49')]},'raw':!![]})[_0x9555('0x23')](function(_0x4aeace){if(_0x4aeace&&_0x4aeace[_0x9555('0x4a')]===0x0){return db['UserProfileResource'][_0x9555('0x44')]({'name':_0x2ff618['name'],'resourceId':_0x2ff618['id'],'type':_0x4aeace['name'],'sectionId':_0x4aeace['id']},{})[_0x9555('0x23')](function(){return _0x139170;});}else{return _0x139170;}})[_0x9555('0x41')](function(_0x5e2137){logger[_0x9555('0x27')](_0x9555('0x51'),_0x5e2137);throw _0x5e2137;});}return _0x139170;});}})['then'](respondWithResult(_0x36d9c5,0xc9))['catch'](handleError(_0x36d9c5,null));};exports[_0x9555('0x52')]=function(_0x5ac172,_0x58940a){if(_0x5ac172[_0x9555('0x45')]['id']){delete _0x5ac172[_0x9555('0x45')]['id'];}return db['Campaign']['find']({'where':{'id':_0x5ac172[_0x9555('0x42')]['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x58940a,null))[_0x9555('0x23')](saveUpdates(_0x5ac172[_0x9555('0x45')],null))[_0x9555('0x23')](respondWithResult(_0x58940a,null))['catch'](handleError(_0x58940a,null));};exports[_0x9555('0x22')]=function(_0x2c91e7,_0x1440bc){return db[_0x9555('0x2b')][_0x9555('0x48')]({'where':{'id':_0x2c91e7[_0x9555('0x42')]['id']}})['then'](handleEntityNotFound(_0x1440bc,null))[_0x9555('0x23')](removeEntity(_0x1440bc,null))[_0x9555('0x41')](handleError(_0x1440bc,null));};exports[_0x9555('0x53')]=function(_0x304099,_0x47c225,_0x48ee98){var _0x477507={'raw':!![],'where':{}};var _0x5c6a5f={};var _0x2f5c61={'count':0x0,'rows':[]};return db[_0x9555('0x2b')][_0x9555('0x54')]({'where':{'id':_0x304099[_0x9555('0x42')]['id']}})['then'](handleEntityNotFound(_0x47c225,null))[_0x9555('0x23')](function(_0x3c57d1){if(_0x3c57d1){_0x5c6a5f['model']=_[_0x9555('0x32')](db[_0x9555('0x55')][_0x9555('0x2c')]);_0x5c6a5f[_0x9555('0x31')]=_[_0x9555('0x32')](_0x304099[_0x9555('0x31')]);_0x5c6a5f[_0x9555('0x33')]=_[_0x9555('0x35')](_0x5c6a5f[_0x9555('0x2f')],_0x5c6a5f[_0x9555('0x31')]);_0x477507[_0x9555('0x34')]=_['intersection'](_0x5c6a5f[_0x9555('0x2f')],qs[_0x9555('0x36')](_0x304099[_0x9555('0x31')]['fields']));_0x477507['attributes']=_0x477507[_0x9555('0x34')][_0x9555('0x37')]?_0x477507[_0x9555('0x34')]:_0x5c6a5f[_0x9555('0x2f')];if(!_0x304099[_0x9555('0x31')][_0x9555('0x38')](_0x9555('0x39'))){_0x477507[_0x9555('0x1e')]=qs[_0x9555('0x1e')](_0x304099['query'][_0x9555('0x1e')]);_0x477507['offset']=qs[_0x9555('0x1d')](_0x304099[_0x9555('0x31')]['offset']);}_0x477507[_0x9555('0x56')]=qs['sort'](_0x304099[_0x9555('0x31')][_0x9555('0x3a')]);_0x477507[_0x9555('0x3b')]=qs[_0x9555('0x33')](_[_0x9555('0x57')](_0x304099[_0x9555('0x31')],_0x5c6a5f[_0x9555('0x33')]));_0x477507[_0x9555('0x3b')][_0x9555('0x58')]=_0x3c57d1['id'];if(_0x304099[_0x9555('0x31')][_0x9555('0x3c')]){_0x477507[_0x9555('0x3b')]=_['merge'](_0x477507[_0x9555('0x3b')],{'$or':_[_0x9555('0x30')](_0x477507[_0x9555('0x34')],function(_0x1bd86e){var _0x180680={};_0x180680[_0x1bd86e]={'$like':'%'+_0x304099['query'][_0x9555('0x3c')]+'%'};return _0x180680;})});}_0x477507=_[_0x9555('0x3d')]({},_0x477507,_0x304099[_0x9555('0x43')]);return db[_0x9555('0x55')][_0x9555('0x1c')]({'where':_0x477507[_0x9555('0x3b')]})[_0x9555('0x23')](function(_0x2d3eb1){_0x2f5c61[_0x9555('0x1c')]=_0x2d3eb1;if(_0x304099[_0x9555('0x31')][_0x9555('0x3f')]){_0x477507['include']=[{'all':!![]}];}return db[_0x9555('0x55')][_0x9555('0x40')](_0x477507);})[_0x9555('0x23')](function(_0x39e5e0){_0x2f5c61['rows']=_0x39e5e0;return _0x2f5c61;});}})[_0x9555('0x23')](respondWithFilteredResult(_0x47c225,_0x477507))[_0x9555('0x41')](handleError(_0x47c225,null));};exports[_0x9555('0x59')]=function(_0x248c72,_0x1367f0,_0x27bc0c){var _0x39460c={'raw':!![],'where':{}};var _0x20d9d2={};var _0x5b0aa2={'count':0x0,'rows':[]};return db[_0x9555('0x2b')][_0x9555('0x54')]({'where':{'id':_0x248c72['params']['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x1367f0,null))[_0x9555('0x23')](function(_0x9d8d49){if(_0x9d8d49){_0x20d9d2['model']=_[_0x9555('0x32')](db[_0x9555('0x5a')][_0x9555('0x2c')]);_0x20d9d2[_0x9555('0x31')]=_[_0x9555('0x32')](_0x248c72[_0x9555('0x31')]);_0x20d9d2[_0x9555('0x33')]=_['intersection'](_0x20d9d2[_0x9555('0x2f')],_0x20d9d2[_0x9555('0x31')]);_0x39460c[_0x9555('0x34')]=_[_0x9555('0x35')](_0x20d9d2[_0x9555('0x2f')],qs['fields'](_0x248c72['query'][_0x9555('0x36')]));_0x39460c[_0x9555('0x34')]=_0x39460c['attributes'][_0x9555('0x37')]?_0x39460c[_0x9555('0x34')]:_0x20d9d2[_0x9555('0x2f')];if(!_0x248c72['query'][_0x9555('0x38')](_0x9555('0x39'))){_0x39460c[_0x9555('0x1e')]=qs[_0x9555('0x1e')](_0x248c72[_0x9555('0x31')]['limit']);_0x39460c[_0x9555('0x1d')]=qs[_0x9555('0x1d')](_0x248c72[_0x9555('0x31')][_0x9555('0x1d')]);}_0x39460c['order']=qs['sort'](_0x248c72['query'][_0x9555('0x3a')]);_0x39460c[_0x9555('0x3b')]=qs['filters'](_[_0x9555('0x57')](_0x248c72['query'],_0x20d9d2[_0x9555('0x33')]));_0x39460c[_0x9555('0x3b')]['CampaignId']=_0x9d8d49['id'];if(_0x248c72['query'][_0x9555('0x3c')]){_0x39460c['where']=_[_0x9555('0x3d')](_0x39460c['where'],{'$or':_['map'](_0x39460c[_0x9555('0x34')],function(_0x193854){var _0x1223a3={};_0x1223a3[_0x193854]={'$like':'%'+_0x248c72['query'][_0x9555('0x3c')]+'%'};return _0x1223a3;})});}_0x39460c=_['merge']({},_0x39460c,_0x248c72[_0x9555('0x43')]);return db[_0x9555('0x5a')]['count']({'where':_0x39460c[_0x9555('0x3b')]})['then'](function(_0x33602c){_0x5b0aa2[_0x9555('0x1c')]=_0x33602c;if(_0x248c72[_0x9555('0x31')][_0x9555('0x3f')]){_0x39460c[_0x9555('0x4c')]=[{'all':!![]}];}return db[_0x9555('0x5a')]['findAll'](_0x39460c);})[_0x9555('0x23')](function(_0x4ac7ac){_0x5b0aa2[_0x9555('0x5b')]=_0x4ac7ac;return _0x5b0aa2;});}})[_0x9555('0x23')](respondWithFilteredResult(_0x1367f0,_0x39460c))[_0x9555('0x41')](handleError(_0x1367f0,null));};exports[_0x9555('0x5c')]=function(_0x519fb1,_0x1b01c3,_0x2d158c){var _0x44cba7={'raw':!![],'where':{}};var _0x31e7ae={};var _0x27d892={'count':0x0,'rows':[]};return db[_0x9555('0x2b')][_0x9555('0x54')]({'where':{'id':_0x519fb1['params']['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x1b01c3,null))[_0x9555('0x23')](function(_0x19e483){if(_0x19e483){_0x31e7ae[_0x9555('0x2f')]=_['keys'](db['CmHopperFinal'][_0x9555('0x2c')]);_0x31e7ae['query']=_[_0x9555('0x32')](_0x519fb1[_0x9555('0x31')]);_0x31e7ae[_0x9555('0x33')]=_[_0x9555('0x35')](_0x31e7ae[_0x9555('0x2f')],_0x31e7ae[_0x9555('0x31')]);_0x44cba7[_0x9555('0x34')]=_[_0x9555('0x35')](_0x31e7ae[_0x9555('0x2f')],qs[_0x9555('0x36')](_0x519fb1['query'][_0x9555('0x36')]));_0x44cba7[_0x9555('0x34')]=_0x44cba7[_0x9555('0x34')][_0x9555('0x37')]?_0x44cba7[_0x9555('0x34')]:_0x31e7ae['model'];if(!_0x519fb1[_0x9555('0x31')][_0x9555('0x38')]('nolimit')){_0x44cba7['limit']=qs['limit'](_0x519fb1[_0x9555('0x31')][_0x9555('0x1e')]);_0x44cba7[_0x9555('0x1d')]=qs['offset'](_0x519fb1[_0x9555('0x31')][_0x9555('0x1d')]);}_0x44cba7[_0x9555('0x56')]=qs['sort'](_0x519fb1['query'][_0x9555('0x3a')]);_0x44cba7[_0x9555('0x3b')]=qs[_0x9555('0x33')](_[_0x9555('0x57')](_0x519fb1[_0x9555('0x31')],_0x31e7ae[_0x9555('0x33')]));_0x44cba7[_0x9555('0x3b')][_0x9555('0x58')]=_0x19e483['id'];if(_0x519fb1[_0x9555('0x31')][_0x9555('0x3c')]){_0x44cba7[_0x9555('0x3b')]=_['merge'](_0x44cba7['where'],{'$or':_[_0x9555('0x30')](_0x44cba7[_0x9555('0x34')],function(_0xc27ce6){var _0x21e22a={};_0x21e22a[_0xc27ce6]={'$like':'%'+_0x519fb1[_0x9555('0x31')][_0x9555('0x3c')]+'%'};return _0x21e22a;})});}_0x44cba7=_[_0x9555('0x3d')]({},_0x44cba7,_0x519fb1[_0x9555('0x43')]);return db[_0x9555('0x5d')]['count']({'where':_0x44cba7[_0x9555('0x3b')]})['then'](function(_0x4b7057){_0x27d892[_0x9555('0x1c')]=_0x4b7057;if(_0x519fb1[_0x9555('0x31')][_0x9555('0x3f')]){_0x44cba7[_0x9555('0x4c')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x9555('0x40')](_0x44cba7);})[_0x9555('0x23')](function(_0x38ed5d){_0x27d892[_0x9555('0x5b')]=_0x38ed5d;return _0x27d892;});}})[_0x9555('0x23')](respondWithFilteredResult(_0x1b01c3,_0x44cba7))[_0x9555('0x41')](handleError(_0x1b01c3,null));};exports['getHopperBlacks']=function(_0x43dc3b,_0x3f00f5,_0x4f8736){var _0x276a63={'raw':!![],'where':{}};var _0x495cd5={};var _0x30977f={'count':0x0,'rows':[]};return db[_0x9555('0x2b')][_0x9555('0x54')]({'where':{'id':_0x43dc3b['params']['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x3f00f5,null))['then'](function(_0x468e42){if(_0x468e42){_0x495cd5[_0x9555('0x2f')]=_[_0x9555('0x32')](db[_0x9555('0x5e')][_0x9555('0x2c')]);_0x495cd5[_0x9555('0x31')]=_[_0x9555('0x32')](_0x43dc3b[_0x9555('0x31')]);_0x495cd5[_0x9555('0x33')]=_['intersection'](_0x495cd5[_0x9555('0x2f')],_0x495cd5[_0x9555('0x31')]);_0x276a63['attributes']=_[_0x9555('0x35')](_0x495cd5[_0x9555('0x2f')],qs[_0x9555('0x36')](_0x43dc3b[_0x9555('0x31')][_0x9555('0x36')]));_0x276a63['attributes']=_0x276a63[_0x9555('0x34')][_0x9555('0x37')]?_0x276a63['attributes']:_0x495cd5[_0x9555('0x2f')];if(!_0x43dc3b[_0x9555('0x31')][_0x9555('0x38')]('nolimit')){_0x276a63[_0x9555('0x1e')]=qs[_0x9555('0x1e')](_0x43dc3b[_0x9555('0x31')][_0x9555('0x1e')]);_0x276a63[_0x9555('0x1d')]=qs['offset'](_0x43dc3b[_0x9555('0x31')][_0x9555('0x1d')]);}_0x276a63[_0x9555('0x56')]=qs[_0x9555('0x3a')](_0x43dc3b[_0x9555('0x31')][_0x9555('0x3a')]);_0x276a63[_0x9555('0x3b')]=qs[_0x9555('0x33')](_[_0x9555('0x57')](_0x43dc3b[_0x9555('0x31')],_0x495cd5[_0x9555('0x33')]));_0x276a63['where']['CampaignId']=_0x468e42['id'];if(_0x43dc3b[_0x9555('0x31')][_0x9555('0x3c')]){_0x276a63['where']=_[_0x9555('0x3d')](_0x276a63[_0x9555('0x3b')],{'$or':_[_0x9555('0x30')](_0x276a63[_0x9555('0x34')],function(_0x202a68){var _0x27d9c0={};_0x27d9c0[_0x202a68]={'$like':'%'+_0x43dc3b['query'][_0x9555('0x3c')]+'%'};return _0x27d9c0;})});}_0x276a63=_['merge']({},_0x276a63,_0x43dc3b[_0x9555('0x43')]);return db['CmHopperBlack']['count']({'where':_0x276a63[_0x9555('0x3b')]})[_0x9555('0x23')](function(_0x299739){_0x30977f[_0x9555('0x1c')]=_0x299739;if(_0x43dc3b[_0x9555('0x31')][_0x9555('0x3f')]){_0x276a63[_0x9555('0x4c')]=[{'all':!![]}];}return db[_0x9555('0x5e')][_0x9555('0x40')](_0x276a63);})[_0x9555('0x23')](function(_0x19b8e1){_0x30977f[_0x9555('0x5b')]=_0x19b8e1;return _0x30977f;});}})[_0x9555('0x23')](respondWithFilteredResult(_0x3f00f5,_0x276a63))[_0x9555('0x41')](handleError(_0x3f00f5,null));};exports[_0x9555('0x5f')]=function(_0x1080c0,_0x731436,_0x21a536){var _0x3b6fe1={};var _0x5107d7={};var _0xf696d7;var _0x1ec9ff;return db[_0x9555('0x2b')]['findOne']({'where':{'id':_0x1080c0[_0x9555('0x42')]['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x731436,null))['then'](function(_0x555a2a){if(_0x555a2a){_0xf696d7=_0x555a2a;_0x5107d7[_0x9555('0x2f')]=_[_0x9555('0x32')](db[_0x9555('0x60')][_0x9555('0x2c')]);_0x5107d7['query']=_[_0x9555('0x32')](_0x1080c0[_0x9555('0x31')]);_0x5107d7[_0x9555('0x33')]=_[_0x9555('0x35')](_0x5107d7[_0x9555('0x2f')],_0x5107d7[_0x9555('0x31')]);_0x3b6fe1[_0x9555('0x34')]=_[_0x9555('0x35')](_0x5107d7['model'],qs[_0x9555('0x36')](_0x1080c0[_0x9555('0x31')]['fields']));_0x3b6fe1[_0x9555('0x34')]=_0x3b6fe1[_0x9555('0x34')]['length']?_0x3b6fe1['attributes']:_0x5107d7[_0x9555('0x2f')];_0x3b6fe1['order']=qs['sort'](_0x1080c0[_0x9555('0x31')][_0x9555('0x3a')]);_0x3b6fe1['where']=qs[_0x9555('0x33')](_[_0x9555('0x57')](_0x1080c0[_0x9555('0x31')],_0x5107d7[_0x9555('0x33')]));if(_0x1080c0[_0x9555('0x31')][_0x9555('0x3c')]){_0x3b6fe1['where']=_['merge'](_0x3b6fe1[_0x9555('0x3b')],{'$or':_[_0x9555('0x30')](_0x3b6fe1['attributes'],function(_0x707ede){var _0x2c901f={};_0x2c901f[_0x707ede]={'$like':'%'+_0x1080c0[_0x9555('0x31')][_0x9555('0x3c')]+'%'};return _0x2c901f;})});}_0x3b6fe1=_[_0x9555('0x3d')]({},_0x3b6fe1,_0x1080c0[_0x9555('0x43')]);return _0xf696d7[_0x9555('0x5f')](_0x3b6fe1);}})[_0x9555('0x23')](function(_0x4847c5){if(_0x4847c5){_0x1ec9ff=_0x4847c5[_0x9555('0x37')];if(!_0x1080c0[_0x9555('0x31')][_0x9555('0x38')](_0x9555('0x39'))){_0x3b6fe1[_0x9555('0x1e')]=qs['limit'](_0x1080c0[_0x9555('0x31')]['limit']);_0x3b6fe1[_0x9555('0x1d')]=qs[_0x9555('0x1d')](_0x1080c0['query'][_0x9555('0x1d')]);}return _0xf696d7[_0x9555('0x5f')](_0x3b6fe1);}})[_0x9555('0x23')](function(_0x1ea8a4){if(_0x1ea8a4){return _0x1ea8a4?{'count':_0x1ec9ff,'rows':_0x1ea8a4}:null;}})[_0x9555('0x23')](respondWithResult(_0x731436,null))[_0x9555('0x41')](handleError(_0x731436,null));};exports[_0x9555('0x61')]=function(_0x3e7d74,_0x411d3a,_0x5c139f){var _0x4a30ce,_0x222954;return db[_0x9555('0x2b')][_0x9555('0x48')]({'where':{'id':_0x3e7d74['params']['id']}})['then'](handleEntityNotFound(_0x411d3a,null))[_0x9555('0x23')](function(_0x19f612){if(_0x19f612){_0x222954=_0x19f612;return _0x19f612[_0x9555('0x61')](_0x3e7d74[_0x9555('0x45')][_0x9555('0x62')],_[_0x9555('0x4d')](_0x3e7d74[_0x9555('0x45')],[_0x9555('0x62'),'id'])||{});}return null;})[_0x9555('0x63')](function(_0x570a5a){var _0x18e2fb;_0x4a30ce=_0x570a5a||[];var _0x4272e4=[];if(_0x570a5a){for(var _0x261e47=0x0;_0x261e47<_0x570a5a['length'];_0x261e47+=0x1){var _0x36e9cd=_0x570a5a[_0x261e47][_0x9555('0x24')]({'plain':!![]});_0x222954[_0x9555('0x64')]=_0x3e7d74['body']['dialCheckDuplicateType']?_0x3e7d74[_0x9555('0x45')][_0x9555('0x64')]:_0x222954[_0x9555('0x64')];switch(_0x222954[_0x9555('0x64')]){case _0x9555('0x65'):_0x18e2fb=squel['insert']()[_0x9555('0x66')](_0x9555('0x67'))[_0x9555('0x68')](['phone','scheduledAt',_0x9555('0x69'),'ListId',_0x9555('0x58'),_0x9555('0x4e'),_0x9555('0x4f')],squel[_0x9555('0x6a')]()[_0x9555('0x6b')](_0x9555('0x6c'),_0x9555('0x6c'))['field'](_0x9555('0x6d'),_0x9555('0x6e'))[_0x9555('0x6b')]('id',_0x9555('0x69'))['field'](_0x36e9cd[_0x9555('0x6f')][_0x9555('0x70')](),_0x9555('0x71'))[_0x9555('0x6b')](_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')](),_0x9555('0x58'))[_0x9555('0x6b')](_0x9555('0x6d'),_0x9555('0x4e'))['field'](_0x9555('0x6d'),'updatedAt')[_0x9555('0x72')](_0x9555('0x73'))[_0x9555('0x3b')](_0x9555('0x74'))[_0x9555('0x3b')]('ListId\x20=\x20?',_0x36e9cd[_0x9555('0x6f')][_0x9555('0x70')]())[_0x9555('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0x9555('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9555('0x6a')]()['field'](_0x9555('0x75'))[_0x9555('0x72')](_0x9555('0x76'))['where'](_0x9555('0x77'),_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')]()))[_0x9555('0x3b')](_0x9555('0x78'),squel[_0x9555('0x6a')]()[_0x9555('0x6b')](_0x9555('0x79'))[_0x9555('0x72')](_0x9555('0x67'))[_0x9555('0x3b')]('CampaignId\x20=\x20?',_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')]())))[_0x9555('0x70')]();break;case _0x9555('0x7a'):_0x18e2fb=squel['insert']()[_0x9555('0x66')](_0x9555('0x67'))['fromQuery']([_0x9555('0x6c'),_0x9555('0x6e'),_0x9555('0x69'),_0x9555('0x71'),'CampaignId',_0x9555('0x4e'),_0x9555('0x4f')],squel[_0x9555('0x6a')]()['field']('phone',_0x9555('0x6c'))[_0x9555('0x6b')](_0x9555('0x6d'),_0x9555('0x6e'))[_0x9555('0x6b')]('id','ContactId')[_0x9555('0x6b')](_0x36e9cd[_0x9555('0x6f')][_0x9555('0x70')](),_0x9555('0x71'))[_0x9555('0x6b')](_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')](),_0x9555('0x58'))[_0x9555('0x6b')](_0x9555('0x6d'),'createdAt')[_0x9555('0x6b')](_0x9555('0x6d'),_0x9555('0x4f'))[_0x9555('0x72')]('cm_contacts')[_0x9555('0x3b')](_0x9555('0x74'))['where']('ListId\x20=\x20?',_0x36e9cd[_0x9555('0x6f')][_0x9555('0x70')]())[_0x9555('0x3b')](_0x9555('0x7b'))[_0x9555('0x3b')](_0x9555('0x78'),squel[_0x9555('0x6a')]()['field'](_0x9555('0x79'))[_0x9555('0x72')](_0x9555('0x67'))[_0x9555('0x3b')](_0x9555('0x77'),_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')]())))[_0x9555('0x70')]();break;default:_0x18e2fb=squel[_0x9555('0x7c')]()[_0x9555('0x66')]('cm_hopper')[_0x9555('0x68')]([_0x9555('0x6c'),_0x9555('0x6e'),_0x9555('0x69'),_0x9555('0x71'),_0x9555('0x58'),_0x9555('0x4e'),_0x9555('0x4f')],squel[_0x9555('0x6a')]()[_0x9555('0x6b')](_0x9555('0x6c'),_0x9555('0x6c'))['field'](_0x9555('0x6d'),_0x9555('0x6e'))[_0x9555('0x6b')]('id',_0x9555('0x69'))['field'](_0x36e9cd[_0x9555('0x6f')][_0x9555('0x70')](),_0x9555('0x71'))[_0x9555('0x6b')](_0x3e7d74[_0x9555('0x42')]['id'][_0x9555('0x70')](),'CampaignId')['field'](_0x9555('0x6d'),_0x9555('0x4e'))[_0x9555('0x6b')](_0x9555('0x6d'),_0x9555('0x4f'))[_0x9555('0x72')](_0x9555('0x73'))[_0x9555('0x3b')](_0x9555('0x74'))[_0x9555('0x3b')]('ListId\x20=\x20?',_0x36e9cd['CmListId']['toString']())['where'](_0x9555('0x7b')))[_0x9555('0x70')]();}_0x4272e4[_0x9555('0x7d')](db[_0x9555('0x7e')]['query'](_0x18e2fb));}return BPromise['all'](_0x4272e4);}})[_0x9555('0x23')](function(){return _0x4a30ce;})['then'](respondWithResult(_0x411d3a,null))['catch'](handleError(_0x411d3a,null));};exports['removeLists']=function(_0x28b233,_0x5cafb1,_0x41c3fc){return db[_0x9555('0x2b')][_0x9555('0x48')]({'where':{'id':_0x28b233[_0x9555('0x42')]['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x5cafb1,null))[_0x9555('0x23')](function(_0x5467b9){if(_0x5467b9){return _0x5467b9['removeLists'](_0x28b233[_0x9555('0x31')][_0x9555('0x62')]);}})['then'](function(_0x406e3d){if(_0x406e3d){return db[_0x9555('0x55')]['destroy']({'where':{'ListId':_0x28b233[_0x9555('0x31')][_0x9555('0x62')],'CampaignId':_0x28b233['params']['id']}})[_0x9555('0x23')](function(){return _0x406e3d;});}})[_0x9555('0x23')](respondWithStatusCode(_0x5cafb1,null))['catch'](handleError(_0x5cafb1,null));};exports['getBlackLists']=function(_0x40924a,_0x5792d4,_0x3892ac){var _0x38db97={'raw':!![],'where':{}};var _0x2b40d3={};var _0x4d96a3={'count':0x0,'rows':[]};return db['Campaign'][_0x9555('0x54')]({'where':{'id':_0x40924a[_0x9555('0x42')]['id']}})['then'](handleEntityNotFound(_0x5792d4,null))[_0x9555('0x23')](function(_0x261a45){if(_0x261a45){_0x2b40d3['model']=_[_0x9555('0x32')](db['CmList'][_0x9555('0x2c')]);_0x2b40d3[_0x9555('0x31')]=_['keys'](_0x40924a[_0x9555('0x31')]);_0x2b40d3[_0x9555('0x33')]=_[_0x9555('0x35')](_0x2b40d3[_0x9555('0x2f')],_0x2b40d3[_0x9555('0x31')]);_0x38db97[_0x9555('0x34')]=_[_0x9555('0x35')](_0x2b40d3['model'],qs['fields'](_0x40924a['query'][_0x9555('0x36')]));_0x38db97[_0x9555('0x34')]=_0x38db97[_0x9555('0x34')][_0x9555('0x37')]?_0x38db97[_0x9555('0x34')]:_0x2b40d3[_0x9555('0x2f')];if(!_0x40924a[_0x9555('0x31')][_0x9555('0x38')](_0x9555('0x39'))){_0x38db97['limit']=qs[_0x9555('0x1e')](_0x40924a['query'][_0x9555('0x1e')]);_0x38db97['offset']=qs[_0x9555('0x1d')](_0x40924a[_0x9555('0x31')][_0x9555('0x1d')]);}_0x38db97[_0x9555('0x56')]=qs['sort'](_0x40924a[_0x9555('0x31')][_0x9555('0x3a')]);_0x38db97['where']=qs[_0x9555('0x33')](_[_0x9555('0x57')](_0x40924a[_0x9555('0x31')],_0x2b40d3[_0x9555('0x33')]));_0x38db97[_0x9555('0x3b')]['CampaignId']=_0x261a45['id'];if(_0x40924a['query'][_0x9555('0x3c')]){_0x38db97['where']=_[_0x9555('0x3d')](_0x38db97[_0x9555('0x3b')],{'$or':_[_0x9555('0x30')](_0x38db97['attributes'],function(_0x59c7d9){var _0x8b3d03={};_0x8b3d03[_0x59c7d9]={'$like':'%'+_0x40924a[_0x9555('0x31')][_0x9555('0x3c')]+'%'};return _0x8b3d03;})});}_0x38db97=_[_0x9555('0x3d')]({},_0x38db97,_0x40924a['options']);return db[_0x9555('0x60')]['count']({'where':_0x38db97['where']})[_0x9555('0x23')](function(_0x174a7a){_0x4d96a3['count']=_0x174a7a;if(_0x40924a[_0x9555('0x31')][_0x9555('0x3f')]){_0x38db97[_0x9555('0x4c')]=[{'all':!![]}];}return db[_0x9555('0x60')]['findAll'](_0x38db97);})[_0x9555('0x23')](function(_0x3f7d59){_0x4d96a3['rows']=_0x3f7d59;return _0x4d96a3;});}})[_0x9555('0x23')](respondWithFilteredResult(_0x5792d4,_0x38db97))[_0x9555('0x41')](handleError(_0x5792d4,null));};exports[_0x9555('0x7f')]=function(_0x1ec83f,_0x3967cc,_0x30561e){var _0x2ea255,_0x38f4c3;return db['Campaign'][_0x9555('0x48')]({'where':{'id':_0x1ec83f[_0x9555('0x42')]['id']}})['then'](handleEntityNotFound(_0x3967cc,null))['then'](function(_0x162dcd){if(_0x162dcd){_0x38f4c3=_0x162dcd;return _0x162dcd[_0x9555('0x7f')](_0x1ec83f[_0x9555('0x45')]['ids'],_[_0x9555('0x4d')](_0x1ec83f[_0x9555('0x45')],[_0x9555('0x62'),'id'])||{});}return null;})['spread'](function(_0xb5fc31){var _0x44f023;_0x2ea255=_0xb5fc31||[];var _0x159c27=[];if(_0xb5fc31){for(var _0x53ce0a=0x0;_0x53ce0a<_0xb5fc31[_0x9555('0x37')];_0x53ce0a+=0x1){var _0x195257=_0xb5fc31[_0x53ce0a][_0x9555('0x24')]({'plain':!![]});_0x44f023=squel['insert']()[_0x9555('0x66')](_0x9555('0x80'))[_0x9555('0x68')]([_0x9555('0x6c'),_0x9555('0x69'),'ListId',_0x9555('0x58'),_0x9555('0x4e'),_0x9555('0x4f')],squel[_0x9555('0x6a')]()[_0x9555('0x6b')](_0x9555('0x6c'),_0x9555('0x6c'))[_0x9555('0x6b')]('id','ContactId')[_0x9555('0x6b')](_0x195257[_0x9555('0x6f')][_0x9555('0x70')](),_0x9555('0x71'))[_0x9555('0x6b')](_0x1ec83f['params']['id'][_0x9555('0x70')](),_0x9555('0x58'))[_0x9555('0x6b')](_0x9555('0x6d'),_0x9555('0x4e'))['field'](_0x9555('0x6d'),_0x9555('0x4f'))[_0x9555('0x72')](_0x9555('0x73'))[_0x9555('0x3b')](_0x9555('0x74'))[_0x9555('0x3b')](_0x9555('0x81'),_0x195257[_0x9555('0x6f')][_0x9555('0x70')]())[_0x9555('0x3b')](_0x9555('0x7b')))[_0x9555('0x70')]();_0x159c27[_0x9555('0x7d')](db[_0x9555('0x7e')][_0x9555('0x31')](_0x44f023));}return BPromise[_0x9555('0x82')](_0x159c27);}})['then'](function(){return _0x2ea255;})[_0x9555('0x23')](respondWithResult(_0x3967cc,null))[_0x9555('0x41')](handleError(_0x3967cc,null));};exports[_0x9555('0x83')]=function(_0x5b876e,_0x4150e1,_0x4f2e41){return db['Campaign'][_0x9555('0x48')]({'where':{'id':_0x5b876e[_0x9555('0x42')]['id']}})[_0x9555('0x23')](handleEntityNotFound(_0x4150e1,null))['then'](function(_0x4b9300){if(_0x4b9300){return _0x4b9300[_0x9555('0x83')](_0x5b876e['query'][_0x9555('0x62')]);}})[_0x9555('0x23')](function(_0x474d37){if(_0x474d37){return db['CmHopperBlack'][_0x9555('0x22')]({'where':{'ListId':_0x5b876e[_0x9555('0x31')]['ids'],'CampaignId':_0x5b876e[_0x9555('0x42')]['id']}})[_0x9555('0x23')](function(){return _0x474d37;});}})[_0x9555('0x23')](respondWithStatusCode(_0x4150e1,null))[_0x9555('0x41')](handleError(_0x4150e1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 3b2db59..1de9026 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(_0x3f05f0,_0x1b5044){var _0x4a9042=function(_0x1f8146){while(--_0x1f8146){_0x3f05f0['push'](_0x3f05f0['shift']());}};_0x4a9042(++_0x1b5044);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1d6ca0,_0x399b61){var _0x2482d7=function(_0x58d987){while(--_0x58d987){_0x1d6ca0['push'](_0x1d6ca0['shift']());}};_0x2482d7(++_0x399b61);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 022706f..771fa56 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(_0x5dacbf,_0x2a2417){var _0x5974db=function(_0x5a49f1){while(--_0x5a49f1){_0x5dacbf['push'](_0x5dacbf['shift']());}};_0x5974db(++_0x2a2417);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x555058,_0x4ffaa0){var _0x1cf606=function(_0xfc65ba){while(--_0xfc65ba){_0x555058['push'](_0x555058['shift']());}};_0x1cf606(++_0x4ffaa0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 1503ae6..342e23d 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 _0x0154=['getHoppers','get','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addBlackLists','put','/:id','update','destroy','delete','removeLists','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','show'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x0154,0xcf));var _0x4015=function(_0x19847f,_0x3348b9){_0x19847f=_0x19847f-0x0;var _0x1b1c91=_0x0154[_0x19847f];return _0x1b1c91;};'use strict';var multer=require(_0x4015('0x0'));var util=require(_0x4015('0x1'));var path=require(_0x4015('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4015('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4015('0x4'));var config=require(_0x4015('0x5'));var controller=require(_0x4015('0x6'));router['get']('/',auth[_0x4015('0x7')](),controller[_0x4015('0x8')]);router['get']('/:id',auth[_0x4015('0x7')](),controller[_0x4015('0x9')]);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller[_0x4015('0xa')]);router[_0x4015('0xb')]('/:id/hopper_histories',auth[_0x4015('0x7')](),controller[_0x4015('0xc')]);router[_0x4015('0xb')](_0x4015('0xd'),auth[_0x4015('0x7')](),controller[_0x4015('0xe')]);router[_0x4015('0xb')](_0x4015('0xf'),auth[_0x4015('0x7')](),controller[_0x4015('0x10')]);router[_0x4015('0xb')](_0x4015('0x11'),auth[_0x4015('0x7')](),controller['getLists']);router[_0x4015('0xb')](_0x4015('0x12'),auth['isAuthenticated'](),controller[_0x4015('0x13')]);router[_0x4015('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x4015('0x15'),auth[_0x4015('0x7')](),controller[_0x4015('0x16')]);router[_0x4015('0x14')](_0x4015('0x11'),auth[_0x4015('0x7')](),controller['addLists']);router[_0x4015('0x14')](_0x4015('0x12'),auth[_0x4015('0x7')](),controller[_0x4015('0x17')]);router[_0x4015('0x18')](_0x4015('0x19'),auth['isAuthenticated'](),controller[_0x4015('0x1a')]);router['delete'](_0x4015('0x19'),auth['isAuthenticated'](),controller[_0x4015('0x1b')]);router[_0x4015('0x1c')](_0x4015('0x11'),auth[_0x4015('0x7')](),controller[_0x4015('0x1d')]);router[_0x4015('0x1c')]('/:id/blacklists',auth[_0x4015('0x7')](),controller['removeBlackLists']);module[_0x4015('0x1e')]=router; \ No newline at end of file +var _0x93f5=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addBlackLists','delete','removeLists','removeBlackLists','exports','multer','connect-timeout'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x93f5,0x10c));var _0x593f=function(_0x373a97,_0x26a9cf){_0x373a97=_0x373a97-0x0;var _0x3bb6a9=_0x93f5[_0x373a97];return _0x3bb6a9;};'use strict';var multer=require(_0x593f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x593f('0x1'));var express=require(_0x593f('0x2'));var router=express[_0x593f('0x3')]();var auth=require(_0x593f('0x4'));var interaction=require(_0x593f('0x5'));var config=require(_0x593f('0x6'));var controller=require(_0x593f('0x7'));router[_0x593f('0x8')]('/',auth[_0x593f('0x9')](),controller[_0x593f('0xa')]);router[_0x593f('0x8')](_0x593f('0xb'),auth[_0x593f('0x9')](),controller[_0x593f('0xc')]);router['get'](_0x593f('0xd'),auth[_0x593f('0x9')](),controller[_0x593f('0xe')]);router[_0x593f('0x8')]('/:id/hopper_histories',auth[_0x593f('0x9')](),controller['getHopperHistories']);router[_0x593f('0x8')]('/:id/hopper_finals',auth[_0x593f('0x9')](),controller[_0x593f('0xf')]);router[_0x593f('0x8')]('/:id/hopper_black',auth[_0x593f('0x9')](),controller[_0x593f('0x10')]);router[_0x593f('0x8')]('/:id/lists',auth[_0x593f('0x9')](),controller[_0x593f('0x11')]);router['get'](_0x593f('0x12'),auth[_0x593f('0x9')](),controller[_0x593f('0x13')]);router[_0x593f('0x14')]('/',auth[_0x593f('0x9')](),controller[_0x593f('0x15')]);router[_0x593f('0x14')](_0x593f('0x16'),auth[_0x593f('0x9')](),controller[_0x593f('0x17')]);router[_0x593f('0x14')](_0x593f('0x18'),auth['isAuthenticated'](),controller['addLists']);router[_0x593f('0x14')](_0x593f('0x12'),auth[_0x593f('0x9')](),controller[_0x593f('0x19')]);router['put'](_0x593f('0xb'),auth[_0x593f('0x9')](),controller['update']);router['delete'](_0x593f('0xb'),auth[_0x593f('0x9')](),controller['destroy']);router[_0x593f('0x1a')](_0x593f('0x18'),auth[_0x593f('0x9')](),controller[_0x593f('0x1b')]);router[_0x593f('0x1a')]('/:id/blacklists',auth[_0x593f('0x9')](),controller[_0x593f('0x1c')]);module[_0x593f('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 8215afa..00c86ef 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 _0xd6c2=['getDataValue','key','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x58a50b,_0x5735da){var _0x485d87=function(_0x508c69){while(--_0x508c69){_0x58a50b['push'](_0x58a50b['shift']());}};_0x485d87(++_0x5735da);}(_0xd6c2,0x183));var _0x2d6c=function(_0x18c021,_0x2b5c86){_0x18c021=_0x18c021-0x0;var _0x35b581=_0xd6c2[_0x18c021];return _0x35b581;};'use strict';var Sequelize=require(_0x2d6c('0x0'));module[_0x2d6c('0x1')]={'key':{'type':Sequelize[_0x2d6c('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x2d6c('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2d6c('0x4')],'get':function(){return this[_0x2d6c('0x5')](_0x2d6c('0x6'));}}}; \ No newline at end of file +var _0x66e6=['STRING','VIRTUAL','getDataValue','sequelize','exports','TEXT'];(function(_0x57a402,_0x40596b){var _0x753a36=function(_0x13b76b){while(--_0x13b76b){_0x57a402['push'](_0x57a402['shift']());}};_0x753a36(++_0x40596b);}(_0x66e6,0x135));var _0x666e=function(_0x161615,_0x4e5d22){_0x161615=_0x161615-0x0;var _0x5fc280=_0x66e6[_0x161615];return _0x5fc280;};'use strict';var Sequelize=require(_0x666e('0x0'));module[_0x666e('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x666e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x666e('0x3')]},'name':{'type':Sequelize[_0x666e('0x4')],'get':function(){return this[_0x666e('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 7a1282b..d695c9c 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 _0xeb1f=['request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','CannedAnswers','UserProfileResource','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','include','find','update','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x50fecb,_0x2b0104){var _0x567fb5=function(_0x48d35c){while(--_0x48d35c){_0x50fecb['push'](_0x50fecb['shift']());}};_0x567fb5(++_0x2b0104);}(_0xeb1f,0x113));var _0xfeb1=function(_0x1e7d14,_0x16ea12){_0x1e7d14=_0x1e7d14-0x0;var _0x27777b=_0xeb1f[_0x1e7d14];return _0x27777b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfeb1('0x0'));var rimraf=require(_0xfeb1('0x1'));var zipdir=require(_0xfeb1('0x2'));var jsonpatch=require(_0xfeb1('0x3'));var rp=require(_0xfeb1('0x4'));var moment=require(_0xfeb1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfeb1('0x6'));var util=require(_0xfeb1('0x7'));var path=require(_0xfeb1('0x8'));var sox=require(_0xfeb1('0x9'));var csv=require(_0xfeb1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfeb1('0xb'));var squel=require(_0xfeb1('0xc'));var crypto=require(_0xfeb1('0xd'));var jsforce=require(_0xfeb1('0xe'));var deskjs=require(_0xfeb1('0xf'));var toCsv=require(_0xfeb1('0xa'));var querystring=require(_0xfeb1('0x10'));var Papa=require(_0xfeb1('0x11'));var Redis=require(_0xfeb1('0x12'));var authService=require(_0xfeb1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfeb1('0x14'));var hardwareService=require(_0xfeb1('0x15'));var logger=require(_0xfeb1('0x16'))(_0xfeb1('0x17'));var utils=require('../../config/utils');var config=require(_0xfeb1('0x18'));var db=require(_0xfeb1('0x19'))['db'];function respondWithStatusCode(_0x4eb22e,_0x51c9b9){_0x51c9b9=_0x51c9b9||0xcc;return function(_0x95c4a7){if(_0x95c4a7){return _0x4eb22e[_0xfeb1('0x1a')](_0x51c9b9);}return _0x4eb22e[_0xfeb1('0x1b')](_0x51c9b9)[_0xfeb1('0x1c')]();};}function respondWithResult(_0x5885eb,_0x2897bd){_0x2897bd=_0x2897bd||0xc8;return function(_0x586aed){if(_0x586aed){return _0x5885eb[_0xfeb1('0x1b')](_0x2897bd)[_0xfeb1('0x1d')](_0x586aed);}};}function respondWithFilteredResult(_0x2e850f,_0x3b4d4c){return function(_0x7f7921){if(_0x7f7921){var _0x3243ff=_0x7f7921[_0xfeb1('0x1e')],_0xf9bca2=_0x3b4d4c[_0xfeb1('0x1f')],_0x5933f0=_0x3b4d4c[_0xfeb1('0x1f')]+_0x3b4d4c[_0xfeb1('0x20')],_0x1c455b;if(_0x5933f0>=_0x3243ff){_0x5933f0=_0x3243ff;_0x1c455b=0xc8;}else{_0x1c455b=0xce;}_0x2e850f[_0xfeb1('0x1b')](_0x1c455b);return _0x2e850f[_0xfeb1('0x21')](_0xfeb1('0x22'),_0xf9bca2+'-'+_0x5933f0+'/'+_0x3243ff)[_0xfeb1('0x1d')](_0x7f7921);}return null;};}function patchUpdates(_0x9fd156){return function(_0xadaadd){try{jsonpatch[_0xfeb1('0x23')](_0xadaadd,_0x9fd156,!![]);}catch(_0x598780){return BPromise[_0xfeb1('0x24')](_0x598780);}return _0xadaadd[_0xfeb1('0x25')]();};}function saveUpdates(_0x301cb4,_0x41cf91){return function(_0x3e69db){if(_0x3e69db){return _0x3e69db['update'](_0x301cb4)['then'](function(_0x406c45){return _0x406c45;});}return null;};}function removeEntity(_0x333b7c,_0x2ddd4b){return function(_0x23dbb0){if(_0x23dbb0){return _0x23dbb0[_0xfeb1('0x26')]()[_0xfeb1('0x27')](function(){var _0x9dbbdf=_0x23dbb0[_0xfeb1('0x28')]({'plain':!![]});var _0x4f7266=_0xfeb1('0x29');return db[_0xfeb1('0x2a')][_0xfeb1('0x26')]({'where':{'type':_0x4f7266,'resourceId':_0x9dbbdf['id']}})[_0xfeb1('0x27')](function(){return _0x23dbb0;});})[_0xfeb1('0x27')](function(){_0x333b7c[_0xfeb1('0x1b')](0xcc)[_0xfeb1('0x1c')]();});}};}function handleEntityNotFound(_0x478b2c,_0x4d627b){return function(_0x49b6b1){if(!_0x49b6b1){_0x478b2c[_0xfeb1('0x1a')](0x194);}return _0x49b6b1;};}function handleError(_0x2bfae3,_0x3d5f2b){_0x3d5f2b=_0x3d5f2b||0x1f4;return function(_0x4a0d76){logger['error'](_0x4a0d76[_0xfeb1('0x2b')]);if(_0x4a0d76['name']){delete _0x4a0d76[_0xfeb1('0x2c')];}_0x2bfae3[_0xfeb1('0x1b')](_0x3d5f2b)['send'](_0x4a0d76);};}exports['index']=function(_0x5e66c3,_0xcd72c4){var _0x37430e={},_0x1879f2={},_0x5496cf={'count':0x0,'rows':[]};var _0x1aea40=_[_0xfeb1('0x2d')](db[_0xfeb1('0x2e')][_0xfeb1('0x2f')],function(_0x55db3c){return{'name':_0x55db3c[_0xfeb1('0x30')],'type':_0x55db3c[_0xfeb1('0x31')][_0xfeb1('0x32')]};});_0x1879f2[_0xfeb1('0x33')]=_['map'](_0x1aea40,_0xfeb1('0x2c'));_0x1879f2[_0xfeb1('0x34')]=_[_0xfeb1('0x35')](_0x5e66c3[_0xfeb1('0x34')]);_0x1879f2['filters']=_[_0xfeb1('0x36')](_0x1879f2[_0xfeb1('0x33')],_0x1879f2['query']);_0x37430e[_0xfeb1('0x37')]=_[_0xfeb1('0x36')](_0x1879f2[_0xfeb1('0x33')],qs[_0xfeb1('0x38')](_0x5e66c3[_0xfeb1('0x34')][_0xfeb1('0x38')]));_0x37430e[_0xfeb1('0x37')]=_0x37430e['attributes']['length']?_0x37430e['attributes']:_0x1879f2['model'];if(!_0x5e66c3[_0xfeb1('0x34')][_0xfeb1('0x39')](_0xfeb1('0x3a'))){_0x37430e['limit']=qs[_0xfeb1('0x20')](_0x5e66c3[_0xfeb1('0x34')][_0xfeb1('0x20')]);_0x37430e['offset']=qs[_0xfeb1('0x1f')](_0x5e66c3['query'][_0xfeb1('0x1f')]);}_0x37430e[_0xfeb1('0x3b')]=qs[_0xfeb1('0x3c')](_0x5e66c3[_0xfeb1('0x34')][_0xfeb1('0x3c')]);_0x37430e['where']=qs[_0xfeb1('0x3d')](_[_0xfeb1('0x3e')](_0x5e66c3['query'],_0x1879f2[_0xfeb1('0x3d')]),_0x1aea40);if(_0x5e66c3[_0xfeb1('0x34')]['filter']){_0x37430e[_0xfeb1('0x3f')]=_['merge'](_0x37430e[_0xfeb1('0x3f')],{'$or':_['map'](_0x1aea40,function(_0x281273){if(_0x281273[_0xfeb1('0x31')]!==_0xfeb1('0x40')){var _0x264bb5={};_0x264bb5[_0x281273[_0xfeb1('0x2c')]]={'$like':'%'+_0x5e66c3['query'][_0xfeb1('0x41')]+'%'};return _0x264bb5;}})});}_0x37430e=_[_0xfeb1('0x42')]({},_0x37430e,_0x5e66c3[_0xfeb1('0x43')]);var _0x29f279={'where':_0x37430e[_0xfeb1('0x3f')]};return db[_0xfeb1('0x2e')]['count'](_0x29f279)[_0xfeb1('0x27')](function(_0x36eaad){_0x5496cf['count']=_0x36eaad;if(_0x5e66c3[_0xfeb1('0x34')][_0xfeb1('0x44')]){_0x37430e['include']=[{'all':!![]}];}return db[_0xfeb1('0x2e')][_0xfeb1('0x45')](_0x37430e);})[_0xfeb1('0x27')](function(_0x2476dc){_0x5496cf[_0xfeb1('0x46')]=_0x2476dc;return _0x5496cf;})[_0xfeb1('0x27')](respondWithFilteredResult(_0xcd72c4,_0x37430e))[_0xfeb1('0x47')](handleError(_0xcd72c4,null));};exports[_0xfeb1('0x48')]=function(_0x2e538b,_0x3a8325){var _0x46e02d={'raw':!![],'where':{'id':_0x2e538b['params']['id']}},_0x18edb3={};_0x18edb3[_0xfeb1('0x33')]=_['keys'](db[_0xfeb1('0x2e')][_0xfeb1('0x2f')]);_0x18edb3[_0xfeb1('0x34')]=_[_0xfeb1('0x35')](_0x2e538b['query']);_0x18edb3['filters']=_['intersection'](_0x18edb3[_0xfeb1('0x33')],_0x18edb3[_0xfeb1('0x34')]);_0x46e02d[_0xfeb1('0x37')]=_[_0xfeb1('0x36')](_0x18edb3[_0xfeb1('0x33')],qs['fields'](_0x2e538b[_0xfeb1('0x34')][_0xfeb1('0x38')]));_0x46e02d[_0xfeb1('0x37')]=_0x46e02d[_0xfeb1('0x37')]['length']?_0x46e02d[_0xfeb1('0x37')]:_0x18edb3['model'];if(_0x2e538b[_0xfeb1('0x34')]['includeAll']){_0x46e02d[_0xfeb1('0x49')]=[{'all':!![]}];}_0x46e02d=_[_0xfeb1('0x42')]({},_0x46e02d,_0x2e538b[_0xfeb1('0x43')]);return db[_0xfeb1('0x2e')][_0xfeb1('0x4a')](_0x46e02d)['then'](handleEntityNotFound(_0x3a8325,null))['then'](respondWithResult(_0x3a8325,null))[_0xfeb1('0x47')](handleError(_0x3a8325,null));};exports[_0xfeb1('0x4b')]=function(_0x3a1251,_0x1b1559){if(_0x3a1251[_0xfeb1('0x4c')]['id']){delete _0x3a1251[_0xfeb1('0x4c')]['id'];}return db[_0xfeb1('0x2e')][_0xfeb1('0x4a')]({'where':{'id':_0x3a1251[_0xfeb1('0x4d')]['id']}})[_0xfeb1('0x27')](handleEntityNotFound(_0x1b1559,null))[_0xfeb1('0x27')](saveUpdates(_0x3a1251[_0xfeb1('0x4c')],null))[_0xfeb1('0x27')](respondWithResult(_0x1b1559,null))[_0xfeb1('0x47')](handleError(_0x1b1559,null));};exports[_0xfeb1('0x26')]=function(_0x20d951,_0x3105e9){return db[_0xfeb1('0x2e')]['find']({'where':{'id':_0x20d951[_0xfeb1('0x4d')]['id']}})[_0xfeb1('0x27')](handleEntityNotFound(_0x3105e9,null))['then'](removeEntity(_0x3105e9,null))[_0xfeb1('0x47')](handleError(_0x3105e9,null));};exports['create']=function(_0x237296,_0x309990){var _0x1485d3={'key':_0x237296[_0xfeb1('0x4c')]['key']};if(_0x237296[_0xfeb1('0x4c')][_0xfeb1('0x4e')]){_0x1485d3['MailAccountId']=_0x237296[_0xfeb1('0x4c')]['MailAccountId'];}else if(_0x237296[_0xfeb1('0x4c')][_0xfeb1('0x4f')]){_0x1485d3[_0xfeb1('0x4f')]=_0x237296[_0xfeb1('0x4c')]['SmsAccountId'];}else if(_0x237296['body'][_0xfeb1('0x50')]){_0x1485d3[_0xfeb1('0x50')]=_0x237296[_0xfeb1('0x4c')][_0xfeb1('0x50')];}else if(_0x237296[_0xfeb1('0x4c')][_0xfeb1('0x51')]){_0x1485d3[_0xfeb1('0x51')]=_0x237296['body']['ChatWebsiteId'];}return db[_0xfeb1('0x2e')][_0xfeb1('0x4a')]({'where':_0x1485d3})[_0xfeb1('0x27')](function(_0x4dc2aa){if(_0x4dc2aa){throw new db[(_0xfeb1('0x52'))]['ValidationError'](_0xfeb1('0x53'));}return db[_0xfeb1('0x2e')][_0xfeb1('0x54')](_0x237296['body']);})[_0xfeb1('0x27')](function(_0x2db91e){var _0x1372d7=_0x237296[_0xfeb1('0x55')]['get']({'plain':!![]});if(!_0x1372d7)throw new Error(_0xfeb1('0x56'));if(_0x1372d7[_0xfeb1('0x57')]===_0xfeb1('0x55')){var _0x5e6b5e=_0x2db91e['get']({'plain':!![]});return db[_0xfeb1('0x58')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x1372d7[_0xfeb1('0x59')]},'raw':!![]})[_0xfeb1('0x27')](function(_0x971c37){if(_0x971c37&&_0x971c37[_0xfeb1('0x5a')]===0x0){return db['UserProfileResource'][_0xfeb1('0x54')]({'name':_0x5e6b5e[_0xfeb1('0x2c')],'resourceId':_0x5e6b5e['id'],'type':_0x971c37['name'],'sectionId':_0x971c37['id']},{})['then'](function(){return _0x2db91e;});}else{return _0x2db91e;}})[_0xfeb1('0x47')](function(_0x89f6e2){logger[_0xfeb1('0x5b')](_0xfeb1('0x5c'),_0x89f6e2);throw _0x89f6e2;});}return _0x2db91e;})['then'](respondWithResult(_0x309990,0xc9))[_0xfeb1('0x47')](handleError(_0x309990,null));}; \ No newline at end of file +var _0x9d64=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','CannedAnswer','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x14cf9d,_0x2cb74f){var _0x440d43=function(_0x2f48ed){while(--_0x2f48ed){_0x14cf9d['push'](_0x14cf9d['shift']());}};_0x440d43(++_0x2cb74f);}(_0x9d64,0x1b8));var _0x49d6=function(_0x20fdee,_0xd5d836){_0x20fdee=_0x20fdee-0x0;var _0x41bf2b=_0x9d64[_0x20fdee];return _0x41bf2b;};'use strict';var pdf=require(_0x49d6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x49d6('0x1'));var zipdir=require(_0x49d6('0x2'));var jsonpatch=require(_0x49d6('0x3'));var rp=require(_0x49d6('0x4'));var moment=require(_0x49d6('0x5'));var BPromise=require(_0x49d6('0x6'));var Mustache=require(_0x49d6('0x7'));var util=require(_0x49d6('0x8'));var path=require(_0x49d6('0x9'));var sox=require(_0x49d6('0xa'));var csv=require(_0x49d6('0xb'));var ejs=require(_0x49d6('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x49d6('0xd'));var crypto=require(_0x49d6('0xe'));var jsforce=require(_0x49d6('0xf'));var deskjs=require(_0x49d6('0x10'));var toCsv=require(_0x49d6('0xb'));var querystring=require(_0x49d6('0x11'));var Papa=require(_0x49d6('0x12'));var Redis=require(_0x49d6('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x49d6('0x14'));var as=require(_0x49d6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x49d6('0x16'));var config=require(_0x49d6('0x17'));var db=require(_0x49d6('0x18'))['db'];function respondWithStatusCode(_0x39e5b5,_0x165218){_0x165218=_0x165218||0xcc;return function(_0x5e24a4){if(_0x5e24a4){return _0x39e5b5[_0x49d6('0x19')](_0x165218);}return _0x39e5b5[_0x49d6('0x1a')](_0x165218)['end']();};}function respondWithResult(_0x3c48dc,_0x41a99c){_0x41a99c=_0x41a99c||0xc8;return function(_0x181d11){if(_0x181d11){return _0x3c48dc[_0x49d6('0x1a')](_0x41a99c)['json'](_0x181d11);}};}function respondWithFilteredResult(_0x1d8d48,_0x4b18f0){return function(_0x3e975a){if(_0x3e975a){var _0x402f92=_0x3e975a[_0x49d6('0x1b')],_0x2d1a22=_0x4b18f0[_0x49d6('0x1c')],_0xb8a118=_0x4b18f0[_0x49d6('0x1c')]+_0x4b18f0[_0x49d6('0x1d')],_0x343df3;if(_0xb8a118>=_0x402f92){_0xb8a118=_0x402f92;_0x343df3=0xc8;}else{_0x343df3=0xce;}_0x1d8d48[_0x49d6('0x1a')](_0x343df3);return _0x1d8d48[_0x49d6('0x1e')](_0x49d6('0x1f'),_0x2d1a22+'-'+_0xb8a118+'/'+_0x402f92)[_0x49d6('0x20')](_0x3e975a);}return null;};}function patchUpdates(_0x2635bd){return function(_0x36d573){try{jsonpatch[_0x49d6('0x21')](_0x36d573,_0x2635bd,!![]);}catch(_0x38f531){return BPromise[_0x49d6('0x22')](_0x38f531);}return _0x36d573['save']();};}function saveUpdates(_0x217cfd,_0x196511){return function(_0x1ab03e){if(_0x1ab03e){return _0x1ab03e[_0x49d6('0x23')](_0x217cfd)[_0x49d6('0x24')](function(_0x13a166){return _0x13a166;});}return null;};}function removeEntity(_0x5f518c,_0x2772c5){return function(_0x4997da){if(_0x4997da){return _0x4997da[_0x49d6('0x25')]()[_0x49d6('0x24')](function(){var _0x53a98d=_0x4997da[_0x49d6('0x26')]({'plain':!![]});var _0x1ab64c='CannedAnswers';return db[_0x49d6('0x27')][_0x49d6('0x25')]({'where':{'type':_0x1ab64c,'resourceId':_0x53a98d['id']}})[_0x49d6('0x24')](function(){return _0x4997da;});})['then'](function(){_0x5f518c[_0x49d6('0x1a')](0xcc)[_0x49d6('0x28')]();});}};}function handleEntityNotFound(_0x2026b6,_0x4024b4){return function(_0x269b9a){if(!_0x269b9a){_0x2026b6[_0x49d6('0x19')](0x194);}return _0x269b9a;};}function handleError(_0x476d1f,_0x397932){_0x397932=_0x397932||0x1f4;return function(_0x32dda0){logger[_0x49d6('0x29')](_0x32dda0[_0x49d6('0x2a')]);if(_0x32dda0['name']){delete _0x32dda0[_0x49d6('0x2b')];}_0x476d1f['status'](_0x397932)[_0x49d6('0x2c')](_0x32dda0);};}exports[_0x49d6('0x2d')]=function(_0x4a97d2,_0x1f41e2){var _0x19447e={},_0x33846a={},_0x282a70={'count':0x0,'rows':[]};var _0x1272ef=_['map'](db[_0x49d6('0x2e')]['rawAttributes'],function(_0x3a0059){return{'name':_0x3a0059[_0x49d6('0x2f')],'type':_0x3a0059[_0x49d6('0x30')][_0x49d6('0x31')]};});_0x33846a[_0x49d6('0x32')]=_[_0x49d6('0x33')](_0x1272ef,'name');_0x33846a[_0x49d6('0x34')]=_[_0x49d6('0x35')](_0x4a97d2[_0x49d6('0x34')]);_0x33846a[_0x49d6('0x36')]=_[_0x49d6('0x37')](_0x33846a[_0x49d6('0x32')],_0x33846a['query']);_0x19447e[_0x49d6('0x38')]=_[_0x49d6('0x37')](_0x33846a[_0x49d6('0x32')],qs[_0x49d6('0x39')](_0x4a97d2[_0x49d6('0x34')]['fields']));_0x19447e['attributes']=_0x19447e[_0x49d6('0x38')][_0x49d6('0x3a')]?_0x19447e[_0x49d6('0x38')]:_0x33846a['model'];if(!_0x4a97d2['query'][_0x49d6('0x3b')](_0x49d6('0x3c'))){_0x19447e['limit']=qs['limit'](_0x4a97d2[_0x49d6('0x34')][_0x49d6('0x1d')]);_0x19447e[_0x49d6('0x1c')]=qs['offset'](_0x4a97d2['query'][_0x49d6('0x1c')]);}_0x19447e[_0x49d6('0x3d')]=qs['sort'](_0x4a97d2[_0x49d6('0x34')][_0x49d6('0x3e')]);_0x19447e['where']=qs['filters'](_[_0x49d6('0x3f')](_0x4a97d2[_0x49d6('0x34')],_0x33846a[_0x49d6('0x36')]),_0x1272ef);if(_0x4a97d2[_0x49d6('0x34')][_0x49d6('0x40')]){_0x19447e[_0x49d6('0x41')]=_[_0x49d6('0x42')](_0x19447e['where'],{'$or':_['map'](_0x1272ef,function(_0x298d9b){if(_0x298d9b[_0x49d6('0x30')]!==_0x49d6('0x43')){var _0xa3fd34={};_0xa3fd34[_0x298d9b['name']]={'$like':'%'+_0x4a97d2[_0x49d6('0x34')][_0x49d6('0x40')]+'%'};return _0xa3fd34;}})});}_0x19447e=_[_0x49d6('0x42')]({},_0x19447e,_0x4a97d2['options']);var _0x24f0a9={'where':_0x19447e[_0x49d6('0x41')]};return db[_0x49d6('0x2e')][_0x49d6('0x1b')](_0x24f0a9)[_0x49d6('0x24')](function(_0x10399d){_0x282a70[_0x49d6('0x1b')]=_0x10399d;if(_0x4a97d2[_0x49d6('0x34')]['includeAll']){_0x19447e[_0x49d6('0x44')]=[{'all':!![]}];}return db[_0x49d6('0x2e')][_0x49d6('0x45')](_0x19447e);})[_0x49d6('0x24')](function(_0x42557f){_0x282a70[_0x49d6('0x46')]=_0x42557f;return _0x282a70;})[_0x49d6('0x24')](respondWithFilteredResult(_0x1f41e2,_0x19447e))[_0x49d6('0x47')](handleError(_0x1f41e2,null));};exports[_0x49d6('0x48')]=function(_0x1d2b29,_0x7c1b00){var _0x495194={'raw':!![],'where':{'id':_0x1d2b29[_0x49d6('0x49')]['id']}},_0x985a84={};_0x985a84['model']=_[_0x49d6('0x35')](db[_0x49d6('0x2e')]['rawAttributes']);_0x985a84[_0x49d6('0x34')]=_[_0x49d6('0x35')](_0x1d2b29[_0x49d6('0x34')]);_0x985a84['filters']=_[_0x49d6('0x37')](_0x985a84[_0x49d6('0x32')],_0x985a84[_0x49d6('0x34')]);_0x495194['attributes']=_['intersection'](_0x985a84['model'],qs[_0x49d6('0x39')](_0x1d2b29[_0x49d6('0x34')]['fields']));_0x495194[_0x49d6('0x38')]=_0x495194['attributes'][_0x49d6('0x3a')]?_0x495194[_0x49d6('0x38')]:_0x985a84[_0x49d6('0x32')];if(_0x1d2b29[_0x49d6('0x34')]['includeAll']){_0x495194['include']=[{'all':!![]}];}_0x495194=_[_0x49d6('0x42')]({},_0x495194,_0x1d2b29[_0x49d6('0x4a')]);return db[_0x49d6('0x2e')][_0x49d6('0x4b')](_0x495194)[_0x49d6('0x24')](handleEntityNotFound(_0x7c1b00,null))[_0x49d6('0x24')](respondWithResult(_0x7c1b00,null))[_0x49d6('0x47')](handleError(_0x7c1b00,null));};exports[_0x49d6('0x23')]=function(_0x45e131,_0x42f3ef){if(_0x45e131[_0x49d6('0x4c')]['id']){delete _0x45e131['body']['id'];}return db[_0x49d6('0x2e')][_0x49d6('0x4b')]({'where':{'id':_0x45e131['params']['id']}})[_0x49d6('0x24')](handleEntityNotFound(_0x42f3ef,null))[_0x49d6('0x24')](saveUpdates(_0x45e131[_0x49d6('0x4c')],null))[_0x49d6('0x24')](respondWithResult(_0x42f3ef,null))[_0x49d6('0x47')](handleError(_0x42f3ef,null));};exports['destroy']=function(_0x56c8d3,_0x52e4f4){return db[_0x49d6('0x2e')]['find']({'where':{'id':_0x56c8d3[_0x49d6('0x49')]['id']}})[_0x49d6('0x24')](handleEntityNotFound(_0x52e4f4,null))['then'](removeEntity(_0x52e4f4,null))[_0x49d6('0x47')](handleError(_0x52e4f4,null));};exports[_0x49d6('0x4d')]=function(_0xdd05e,_0xdb4039){var _0x2a197b={'key':_0xdd05e[_0x49d6('0x4c')]['key']};if(_0xdd05e['body'][_0x49d6('0x4e')]){_0x2a197b[_0x49d6('0x4e')]=_0xdd05e[_0x49d6('0x4c')][_0x49d6('0x4e')];}else if(_0xdd05e[_0x49d6('0x4c')][_0x49d6('0x4f')]){_0x2a197b['SmsAccountId']=_0xdd05e['body'][_0x49d6('0x4f')];}else if(_0xdd05e['body'][_0x49d6('0x50')]){_0x2a197b['OpenchannelAccountId']=_0xdd05e[_0x49d6('0x4c')]['OpenchannelAccountId'];}else if(_0xdd05e['body'][_0x49d6('0x51')]){_0x2a197b[_0x49d6('0x51')]=_0xdd05e[_0x49d6('0x4c')][_0x49d6('0x51')];}return db[_0x49d6('0x2e')][_0x49d6('0x4b')]({'where':_0x2a197b})[_0x49d6('0x24')](function(_0x2b7906){if(_0x2b7906){throw new db[(_0x49d6('0x52'))][(_0x49d6('0x53'))](_0x49d6('0x54'));}return db[_0x49d6('0x2e')][_0x49d6('0x4d')](_0xdd05e[_0x49d6('0x4c')]);})['then'](function(_0x3a7173){var _0x2f8916=_0xdd05e['user'][_0x49d6('0x26')]({'plain':!![]});if(!_0x2f8916)throw new Error(_0x49d6('0x55'));if(_0x2f8916['role']===_0x49d6('0x56')){var _0x45e576=_0x3a7173[_0x49d6('0x26')]({'plain':!![]});return db[_0x49d6('0x57')][_0x49d6('0x4b')]({'where':{'name':'CannedAnswers','userProfileId':_0x2f8916[_0x49d6('0x58')]},'raw':!![]})[_0x49d6('0x24')](function(_0x3d35c2){if(_0x3d35c2&&_0x3d35c2[_0x49d6('0x59')]===0x0){return db[_0x49d6('0x27')][_0x49d6('0x4d')]({'name':_0x45e576['name'],'resourceId':_0x45e576['id'],'type':_0x3d35c2['name'],'sectionId':_0x3d35c2['id']},{})[_0x49d6('0x24')](function(){return _0x3a7173;});}else{return _0x3a7173;}})['catch'](function(_0x1c5d88){logger['error'](_0x49d6('0x5a'),_0x1c5d88);throw _0x1c5d88;});}return _0x3a7173;})[_0x49d6('0x24')](respondWithResult(_0xdb4039,0xc9))['catch'](handleError(_0xdb4039,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0719180..9cd26a4 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 _0xf725=['../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf725,0x7e));var _0x5f72=function(_0x2b5880,_0x86beda){_0x2b5880=_0x2b5880-0x0;var _0x1c0979=_0xf725[_0x2b5880];return _0x1c0979;};'use strict';var _=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var logger=require(_0x5f72('0x2'))(_0x5f72('0x3'));var moment=require(_0x5f72('0x4'));var BPromise=require(_0x5f72('0x5'));var rp=require(_0x5f72('0x6'));var fs=require('fs');var path=require(_0x5f72('0x7'));var rimraf=require(_0x5f72('0x8'));var config=require(_0x5f72('0x9'));var attributes=require('./cannedAnswer.attributes');module[_0x5f72('0xa')]=function(_0x14a92d,_0x3f2ca7){return _0x14a92d[_0x5f72('0xb')](_0x5f72('0xc'),attributes,{'tableName':_0x5f72('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f72('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x291c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x291c,0x137));var _0xc291=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x291c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var logger=require(_0xc291('0x2'))(_0xc291('0x3'));var moment=require(_0xc291('0x4'));var BPromise=require(_0xc291('0x5'));var rp=require(_0xc291('0x6'));var fs=require('fs');var path=require(_0xc291('0x7'));var rimraf=require(_0xc291('0x8'));var config=require(_0xc291('0x9'));var attributes=require(_0xc291('0xa'));module['exports']=function(_0x2c96a8,_0x5f2563){return _0x2c96a8['define'](_0xc291('0xb'),attributes,{'tableName':_0xc291('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc291('0xd'),'collate':_0xc291('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 922da8a..aa5c240 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 _0x7b84=['lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2efc07,_0x427db4){var _0xb625c8=function(_0x26caff){while(--_0x26caff){_0x2efc07['push'](_0x2efc07['shift']());}};_0xb625c8(++_0x427db4);}(_0x7b84,0xab));var _0x47b8=function(_0x2d7d6e,_0x11ada3){_0x2d7d6e=_0x2d7d6e-0x0;var _0x198cc9=_0x7b84[_0x2d7d6e];return _0x198cc9;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x47b8('0x2'));var fs=require('fs');var Redis=require(_0x47b8('0x3'));var db=require(_0x47b8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x47b8('0x5'));var config=require(_0x47b8('0x6'));var jayson=require(_0x47b8('0x7'));var client=jayson[_0x47b8('0x8')][_0x47b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x189627,_0x39f6c1,_0x209a86){return new BPromise(function(_0x2300d3,_0x4cfd25){return client['request'](_0x189627,_0x209a86)['then'](function(_0x347856){logger[_0x47b8('0xa')](_0x47b8('0xb'),_0x39f6c1,_0x47b8('0xc'));logger['debug'](_0x47b8('0xd'),_0x39f6c1,_0x47b8('0xc'),JSON[_0x47b8('0xe')](_0x347856));if(_0x347856[_0x47b8('0xf')]){if(_0x347856[_0x47b8('0xf')][_0x47b8('0x10')]===0x1f4){logger['error'](_0x47b8('0xb'),_0x39f6c1,_0x347856['error'][_0x47b8('0x11')]);return _0x4cfd25(_0x347856['error'][_0x47b8('0x11')]);}logger['error'](_0x47b8('0xb'),_0x39f6c1,_0x347856[_0x47b8('0xf')][_0x47b8('0x11')]);return _0x2300d3(_0x347856['error'][_0x47b8('0x11')]);}else{logger[_0x47b8('0xa')](_0x47b8('0xb'),_0x39f6c1,'request\x20sent');_0x2300d3(_0x347856[_0x47b8('0x12')][_0x47b8('0x11')]);}})['catch'](function(_0x149da4){logger[_0x47b8('0xf')](_0x47b8('0xb'),_0x39f6c1,_0x149da4);_0x4cfd25(_0x149da4);});});} \ No newline at end of file +var _0xb6c2=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6c2,0x17a));var _0x2b6c=function(_0x365894,_0x352184){_0x365894=_0x365894-0x0;var _0x3e2edd=_0xb6c2[_0x365894];return _0x3e2edd;};'use strict';var _=require(_0x2b6c('0x0'));var util=require('util');var moment=require(_0x2b6c('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b6c('0x2'));var fs=require('fs');var Redis=require(_0x2b6c('0x3'));var db=require(_0x2b6c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b6c('0x5'))(_0x2b6c('0x6'));var config=require('../../config/environment');var jayson=require(_0x2b6c('0x7'));var client=jayson['client'][_0x2b6c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b671b,_0x5e5286,_0x33cb84){return new BPromise(function(_0x166d4d,_0xf84283){return client['request'](_0x4b671b,_0x33cb84)['then'](function(_0x38c52e){logger['info'](_0x2b6c('0x9'),_0x5e5286,_0x2b6c('0xa'));logger[_0x2b6c('0xb')](_0x2b6c('0xc'),_0x5e5286,_0x2b6c('0xa'),JSON[_0x2b6c('0xd')](_0x38c52e));if(_0x38c52e[_0x2b6c('0xe')]){if(_0x38c52e['error'][_0x2b6c('0xf')]===0x1f4){logger[_0x2b6c('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x5e5286,_0x38c52e[_0x2b6c('0xe')]['message']);return _0xf84283(_0x38c52e[_0x2b6c('0xe')][_0x2b6c('0x10')]);}logger[_0x2b6c('0xe')](_0x2b6c('0x9'),_0x5e5286,_0x38c52e['error']['message']);return _0x166d4d(_0x38c52e[_0x2b6c('0xe')][_0x2b6c('0x10')]);}else{logger[_0x2b6c('0x11')](_0x2b6c('0x9'),_0x5e5286,_0x2b6c('0xa'));_0x166d4d(_0x38c52e['result'][_0x2b6c('0x10')]);}})[_0x2b6c('0x12')](function(_0x14e8d1){logger[_0x2b6c('0xe')](_0x2b6c('0x9'),_0x5e5286,_0x14e8d1);_0xf84283(_0x14e8d1);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 8254a68..95f56a5 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 _0x35c8=['/:id','show','post','create','update','delete','destroy','exports','path','express','Router','../../components/auth/service','./cannedAnswer.controller','isAuthenticated','get'];(function(_0x1d6c20,_0x45d9c2){var _0xab8304=function(_0xeb158b){while(--_0xeb158b){_0x1d6c20['push'](_0x1d6c20['shift']());}};_0xab8304(++_0x45d9c2);}(_0x35c8,0x125));var _0x835c=function(_0x135365,_0x21fb8d){_0x135365=_0x135365-0x0;var _0x5eb255=_0x35c8[_0x135365];return _0x5eb255;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x835c('0x0'));var timeout=require('connect-timeout');var express=require(_0x835c('0x1'));var router=express[_0x835c('0x2')]();var auth=require(_0x835c('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x835c('0x4'));router['get']('/',auth[_0x835c('0x5')](),controller['index']);router[_0x835c('0x6')](_0x835c('0x7'),auth['isAuthenticated'](),controller[_0x835c('0x8')]);router[_0x835c('0x9')]('/',auth[_0x835c('0x5')](),controller[_0x835c('0xa')]);router['put'](_0x835c('0x7'),auth[_0x835c('0x5')](),controller[_0x835c('0xb')]);router[_0x835c('0xc')](_0x835c('0x7'),auth['isAuthenticated'](),controller[_0x835c('0xd')]);module[_0x835c('0xe')]=router; \ No newline at end of file +var _0x3e48=['create','put','update','delete','destroy','exports','util','path','Router','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x21398a,_0x2a677c){var _0x1d60cd=function(_0x1e4a56){while(--_0x1e4a56){_0x21398a['push'](_0x21398a['shift']());}};_0x1d60cd(++_0x2a677c);}(_0x3e48,0x86));var _0x83e4=function(_0x1d74ee,_0x37842b){_0x1d74ee=_0x1d74ee-0x0;var _0x308b1e=_0x3e48[_0x1d74ee];return _0x308b1e;};'use strict';var multer=require('multer');var util=require(_0x83e4('0x0'));var path=require(_0x83e4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x83e4('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x83e4('0x3'));var controller=require('./cannedAnswer.controller');router[_0x83e4('0x4')]('/',auth[_0x83e4('0x5')](),controller[_0x83e4('0x6')]);router['get'](_0x83e4('0x7'),auth[_0x83e4('0x5')](),controller[_0x83e4('0x8')]);router[_0x83e4('0x9')]('/',auth[_0x83e4('0x5')](),controller[_0x83e4('0xa')]);router[_0x83e4('0xb')](_0x83e4('0x7'),auth['isAuthenticated'](),controller[_0x83e4('0xc')]);router[_0x83e4('0xd')](_0x83e4('0x7'),auth[_0x83e4('0x5')](),controller[_0x83e4('0xe')]);module[_0x83e4('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index b76a681..4e1281f 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 _0x109b=['INTEGER','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x57e8e9,_0x59b275){var _0x1f1a6d=function(_0x23038f){while(--_0x23038f){_0x57e8e9['push'](_0x57e8e9['shift']());}};_0x1f1a6d(++_0x59b275);}(_0x109b,0x119));var _0xb109=function(_0x3588e7,_0x342e30){_0x3588e7=_0x3588e7-0x0;var _0x607444=_0x109b[_0x3588e7];return _0x607444;};'use strict';var Sequelize=require('sequelize');module[_0xb109('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xb109('0x1')},'clid':{'type':Sequelize[_0xb109('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xb109('0x2')]},'channel':{'type':Sequelize[_0xb109('0x2')]},'dstchannel':{'type':Sequelize[_0xb109('0x2')]},'lastapp':{'type':Sequelize[_0xb109('0x2')]},'lastdata':{'type':Sequelize[_0xb109('0x2')]},'duration':{'type':Sequelize[_0xb109('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb109('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb109('0x2')]},'amaflags':{'type':Sequelize[_0xb109('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xb109('0x2')]},'uniqueid':{'type':Sequelize[_0xb109('0x2')]},'linkedid':{'type':Sequelize[_0xb109('0x2')]},'sequence':{'type':Sequelize[_0xb109('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb109('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1549=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x528e64,_0x5f2d9f){var _0x22dd1e=function(_0x5cf6ad){while(--_0x5cf6ad){_0x528e64['push'](_0x528e64['shift']());}};_0x22dd1e(++_0x5f2d9f);}(_0x1549,0x192));var _0x9154=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x1549[_0x3e6d5d];return _0x238923;};'use strict';var Sequelize=require(_0x9154('0x0'));module[_0x9154('0x1')]={'calldate':{'type':Sequelize[_0x9154('0x2')],'allowNull':![],'defaultValue':_0x9154('0x3')},'clid':{'type':Sequelize[_0x9154('0x4')]},'src':{'type':Sequelize[_0x9154('0x4')]},'dst':{'type':Sequelize[_0x9154('0x4')]},'dcontext':{'type':Sequelize[_0x9154('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x9154('0x4')]},'lastapp':{'type':Sequelize[_0x9154('0x4')]},'lastdata':{'type':Sequelize[_0x9154('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9154('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9154('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9154('0x4')]},'userfield':{'type':Sequelize[_0x9154('0x4')]},'uniqueid':{'type':Sequelize[_0x9154('0x4')]},'linkedid':{'type':Sequelize[_0x9154('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x9154('0x4')]},'type':{'type':Sequelize[_0x9154('0x4')]},'tag':{'type':Sequelize[_0x9154('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index e6766d5..f1458d1 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 _0x1d99=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','options','count','includeAll','findAll','rows','catch','show','params','Cdr','create','body','find','describe','html-pdf','rimraf'];(function(_0x9919f6,_0x956dda){var _0x3d6acb=function(_0x227d6e){while(--_0x227d6e){_0x9919f6['push'](_0x9919f6['shift']());}};_0x3d6acb(++_0x956dda);}(_0x1d99,0x1d2));var _0x91d9=function(_0x191fb6,_0x5612de){_0x191fb6=_0x191fb6-0x0;var _0x57458f=_0x1d99[_0x191fb6];return _0x57458f;};'use strict';var pdf=require(_0x91d9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91d9('0x1'));var zipdir=require(_0x91d9('0x2'));var jsonpatch=require(_0x91d9('0x3'));var rp=require(_0x91d9('0x4'));var moment=require(_0x91d9('0x5'));var BPromise=require(_0x91d9('0x6'));var Mustache=require(_0x91d9('0x7'));var util=require(_0x91d9('0x8'));var path=require(_0x91d9('0x9'));var sox=require('sox');var csv=require(_0x91d9('0xa'));var ejs=require(_0x91d9('0xb'));var fs=require('fs');var _=require(_0x91d9('0xc'));var squel=require(_0x91d9('0xd'));var crypto=require(_0x91d9('0xe'));var jsforce=require(_0x91d9('0xf'));var deskjs=require(_0x91d9('0x10'));var toCsv=require(_0x91d9('0xa'));var querystring=require(_0x91d9('0x11'));var Papa=require(_0x91d9('0x12'));var Redis=require(_0x91d9('0x13'));var authService=require(_0x91d9('0x14'));var qs=require(_0x91d9('0x15'));var as=require(_0x91d9('0x16'));var hardwareService=require(_0x91d9('0x17'));var logger=require('../../config/logger')(_0x91d9('0x18'));var utils=require(_0x91d9('0x19'));var config=require(_0x91d9('0x1a'));var db=require(_0x91d9('0x1b'))['db'];function respondWithStatusCode(_0x44d43e,_0x372e40){_0x372e40=_0x372e40||0xcc;return function(_0x298e34){if(_0x298e34){return _0x44d43e[_0x91d9('0x1c')](_0x372e40);}return _0x44d43e[_0x91d9('0x1d')](_0x372e40)[_0x91d9('0x1e')]();};}function respondWithResult(_0x1a10b4,_0x5bac0b){_0x5bac0b=_0x5bac0b||0xc8;return function(_0x854dbb){if(_0x854dbb){return _0x1a10b4[_0x91d9('0x1d')](_0x5bac0b)['json'](_0x854dbb);}};}function respondWithFilteredResult(_0x23f6b5,_0x507f46){return function(_0x5327e3){if(_0x5327e3){var _0x5df10c=_0x5327e3['count'],_0x1d7e5e=_0x507f46['offset'],_0x19d4d1=_0x507f46['offset']+_0x507f46[_0x91d9('0x1f')],_0x6cefee;if(_0x19d4d1>=_0x5df10c){_0x19d4d1=_0x5df10c;_0x6cefee=0xc8;}else{_0x6cefee=0xce;}_0x23f6b5[_0x91d9('0x1d')](_0x6cefee);return _0x23f6b5[_0x91d9('0x20')](_0x91d9('0x21'),_0x1d7e5e+'-'+_0x19d4d1+'/'+_0x5df10c)[_0x91d9('0x22')](_0x5327e3);}return null;};}function patchUpdates(_0x242eae){return function(_0x2b4bc7){try{jsonpatch[_0x91d9('0x23')](_0x2b4bc7,_0x242eae,!![]);}catch(_0x24fb5f){return BPromise[_0x91d9('0x24')](_0x24fb5f);}return _0x2b4bc7[_0x91d9('0x25')]();};}function saveUpdates(_0x3f3a11,_0x30f29b){return function(_0x1662ea){if(_0x1662ea){return _0x1662ea[_0x91d9('0x26')](_0x3f3a11)[_0x91d9('0x27')](function(_0x49376c){return _0x49376c;});}return null;};}function removeEntity(_0x30dbf5,_0xa279f0){return function(_0x14acb2){if(_0x14acb2){return _0x14acb2[_0x91d9('0x28')]()['then'](function(){_0x30dbf5[_0x91d9('0x1d')](0xcc)[_0x91d9('0x1e')]();});}};}function handleEntityNotFound(_0x40ead3,_0x3f3a35){return function(_0x22c054){if(!_0x22c054){_0x40ead3[_0x91d9('0x1c')](0x194);}return _0x22c054;};}function handleError(_0x3698dc,_0x3710cd){_0x3710cd=_0x3710cd||0x1f4;return function(_0x4cfe27){logger[_0x91d9('0x29')](_0x4cfe27['stack']);if(_0x4cfe27[_0x91d9('0x2a')]){delete _0x4cfe27[_0x91d9('0x2a')];}_0x3698dc['status'](_0x3710cd)['send'](_0x4cfe27);};}exports[_0x91d9('0x2b')]=function(_0x27bd37,_0x456771){var _0x471b3f={},_0x25cea4={},_0x5859fd={'count':0x0,'rows':[]};var _0x16dd01=_[_0x91d9('0x2c')](db['Cdr'][_0x91d9('0x2d')],function(_0x862ac2){return{'name':_0x862ac2['fieldName'],'type':_0x862ac2['type'][_0x91d9('0x2e')]};});_0x25cea4[_0x91d9('0x2f')]=_[_0x91d9('0x2c')](_0x16dd01,'name');_0x25cea4['query']=_[_0x91d9('0x30')](_0x27bd37['query']);_0x25cea4[_0x91d9('0x31')]=_[_0x91d9('0x32')](_0x25cea4['model'],_0x25cea4[_0x91d9('0x33')]);_0x471b3f[_0x91d9('0x34')]=_[_0x91d9('0x32')](_0x25cea4[_0x91d9('0x2f')],qs[_0x91d9('0x35')](_0x27bd37[_0x91d9('0x33')][_0x91d9('0x35')]));_0x471b3f['attributes']=_0x471b3f[_0x91d9('0x34')][_0x91d9('0x36')]?_0x471b3f[_0x91d9('0x34')]:_0x25cea4[_0x91d9('0x2f')];if(!_0x27bd37[_0x91d9('0x33')][_0x91d9('0x37')](_0x91d9('0x38'))){_0x471b3f[_0x91d9('0x1f')]=qs[_0x91d9('0x1f')](_0x27bd37[_0x91d9('0x33')][_0x91d9('0x1f')]);_0x471b3f[_0x91d9('0x39')]=qs[_0x91d9('0x39')](_0x27bd37['query'][_0x91d9('0x39')]);}_0x471b3f[_0x91d9('0x3a')]=qs[_0x91d9('0x3b')](_0x27bd37[_0x91d9('0x33')][_0x91d9('0x3b')]);_0x471b3f[_0x91d9('0x3c')]=qs['filters'](_[_0x91d9('0x3d')](_0x27bd37[_0x91d9('0x33')],_0x25cea4[_0x91d9('0x31')]),_0x16dd01);if(_0x27bd37[_0x91d9('0x33')][_0x91d9('0x3e')]){_0x471b3f[_0x91d9('0x3c')]=_[_0x91d9('0x3f')](_0x471b3f['where'],{'$or':_[_0x91d9('0x2c')](_0x16dd01,function(_0x124d29){if(_0x124d29[_0x91d9('0x40')]!=='VIRTUAL'){var _0x2805b4={};_0x2805b4[_0x124d29[_0x91d9('0x2a')]]={'$like':'%'+_0x27bd37[_0x91d9('0x33')]['filter']+'%'};return _0x2805b4;}})});}_0x471b3f=_[_0x91d9('0x3f')]({},_0x471b3f,_0x27bd37[_0x91d9('0x41')]);var _0x5943a2={'where':_0x471b3f[_0x91d9('0x3c')]};return db['Cdr'][_0x91d9('0x42')](_0x5943a2)['then'](function(_0x2fdc72){_0x5859fd['count']=_0x2fdc72;if(_0x27bd37[_0x91d9('0x33')][_0x91d9('0x43')]){_0x471b3f['include']=[{'all':!![]}];}return db['Cdr'][_0x91d9('0x44')](_0x471b3f);})[_0x91d9('0x27')](function(_0x2eee6d){_0x5859fd[_0x91d9('0x45')]=_0x2eee6d;return _0x5859fd;})[_0x91d9('0x27')](respondWithFilteredResult(_0x456771,_0x471b3f))[_0x91d9('0x46')](handleError(_0x456771,null));};exports[_0x91d9('0x47')]=function(_0x42d2c9,_0x3993f1){var _0xd829ff={'raw':!![],'where':{'id':_0x42d2c9[_0x91d9('0x48')]['id']}},_0x16d3cd={};_0x16d3cd[_0x91d9('0x2f')]=_[_0x91d9('0x30')](db[_0x91d9('0x49')]['rawAttributes']);_0x16d3cd['query']=_[_0x91d9('0x30')](_0x42d2c9[_0x91d9('0x33')]);_0x16d3cd[_0x91d9('0x31')]=_[_0x91d9('0x32')](_0x16d3cd[_0x91d9('0x2f')],_0x16d3cd[_0x91d9('0x33')]);_0xd829ff[_0x91d9('0x34')]=_[_0x91d9('0x32')](_0x16d3cd['model'],qs[_0x91d9('0x35')](_0x42d2c9[_0x91d9('0x33')]['fields']));_0xd829ff[_0x91d9('0x34')]=_0xd829ff[_0x91d9('0x34')][_0x91d9('0x36')]?_0xd829ff['attributes']:_0x16d3cd[_0x91d9('0x2f')];if(_0x42d2c9[_0x91d9('0x33')][_0x91d9('0x43')]){_0xd829ff['include']=[{'all':!![]}];}_0xd829ff=_[_0x91d9('0x3f')]({},_0xd829ff,_0x42d2c9[_0x91d9('0x41')]);return db['Cdr']['find'](_0xd829ff)['then'](handleEntityNotFound(_0x3993f1,null))[_0x91d9('0x27')](respondWithResult(_0x3993f1,null))['catch'](handleError(_0x3993f1,null));};exports[_0x91d9('0x4a')]=function(_0x4918e8,_0x1928e2){return db['Cdr'][_0x91d9('0x4a')](_0x4918e8['body'],{})[_0x91d9('0x27')](respondWithResult(_0x1928e2,0xc9))['catch'](handleError(_0x1928e2,null));};exports[_0x91d9('0x26')]=function(_0x279e8d,_0x43ce9c){if(_0x279e8d['body']['id']){delete _0x279e8d[_0x91d9('0x4b')]['id'];}return db['Cdr'][_0x91d9('0x4c')]({'where':{'id':_0x279e8d['params']['id']}})[_0x91d9('0x27')](handleEntityNotFound(_0x43ce9c,null))[_0x91d9('0x27')](saveUpdates(_0x279e8d[_0x91d9('0x4b')],null))[_0x91d9('0x27')](respondWithResult(_0x43ce9c,null))[_0x91d9('0x46')](handleError(_0x43ce9c,null));};exports[_0x91d9('0x28')]=function(_0x146c85,_0x35743b){return db[_0x91d9('0x49')][_0x91d9('0x4c')]({'where':{'id':_0x146c85[_0x91d9('0x48')]['id']}})[_0x91d9('0x27')](handleEntityNotFound(_0x35743b,null))[_0x91d9('0x27')](removeEntity(_0x35743b,null))['catch'](handleError(_0x35743b,null));};exports[_0x91d9('0x4d')]=function(_0x3a1806,_0x236229){return db[_0x91d9('0x49')][_0x91d9('0x4d')]()['then'](respondWithResult(_0x236229,null))[_0x91d9('0x46')](handleError(_0x236229,null));}; \ No newline at end of file +var _0x4103=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','limit','set','Content-Range','save','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','where','pick','filter','Cdr','count','includeAll','findAll','catch','show','params','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x28d506,_0x1144d2){var _0x252461=function(_0x1af38e){while(--_0x1af38e){_0x28d506['push'](_0x28d506['shift']());}};_0x252461(++_0x1144d2);}(_0x4103,0xc1));var _0x3410=function(_0x385b97,_0x478845){_0x385b97=_0x385b97-0x0;var _0x5b2363=_0x4103[_0x385b97];return _0x5b2363;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3410('0x0'));var rimraf=require(_0x3410('0x1'));var zipdir=require(_0x3410('0x2'));var jsonpatch=require(_0x3410('0x3'));var rp=require(_0x3410('0x4'));var moment=require(_0x3410('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3410('0x6'));var util=require(_0x3410('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3410('0x8'));var ejs=require(_0x3410('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3410('0xa'));var crypto=require(_0x3410('0xb'));var jsforce=require(_0x3410('0xc'));var deskjs=require(_0x3410('0xd'));var toCsv=require(_0x3410('0x8'));var querystring=require('querystring');var Papa=require(_0x3410('0xe'));var Redis=require(_0x3410('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3410('0x10'));var as=require(_0x3410('0x11'));var hardwareService=require(_0x3410('0x12'));var logger=require(_0x3410('0x13'))(_0x3410('0x14'));var utils=require(_0x3410('0x15'));var config=require('../../config/environment');var db=require(_0x3410('0x16'))['db'];function respondWithStatusCode(_0xa222ca,_0x397491){_0x397491=_0x397491||0xcc;return function(_0x1290b){if(_0x1290b){return _0xa222ca['sendStatus'](_0x397491);}return _0xa222ca[_0x3410('0x17')](_0x397491)[_0x3410('0x18')]();};}function respondWithResult(_0x2c053f,_0x1dd5d8){_0x1dd5d8=_0x1dd5d8||0xc8;return function(_0x46ddc6){if(_0x46ddc6){return _0x2c053f[_0x3410('0x17')](_0x1dd5d8)[_0x3410('0x19')](_0x46ddc6);}};}function respondWithFilteredResult(_0x5335bf,_0x1d9057){return function(_0x3ad2f7){if(_0x3ad2f7){var _0x535800=_0x3ad2f7['count'],_0x5bd7cc=_0x1d9057['offset'],_0x365093=_0x1d9057['offset']+_0x1d9057[_0x3410('0x1a')],_0x489c1b;if(_0x365093>=_0x535800){_0x365093=_0x535800;_0x489c1b=0xc8;}else{_0x489c1b=0xce;}_0x5335bf[_0x3410('0x17')](_0x489c1b);return _0x5335bf[_0x3410('0x1b')](_0x3410('0x1c'),_0x5bd7cc+'-'+_0x365093+'/'+_0x535800)[_0x3410('0x19')](_0x3ad2f7);}return null;};}function patchUpdates(_0x10b128){return function(_0x3e3b87){try{jsonpatch['apply'](_0x3e3b87,_0x10b128,!![]);}catch(_0x18ca58){return BPromise['reject'](_0x18ca58);}return _0x3e3b87[_0x3410('0x1d')]();};}function saveUpdates(_0x408132,_0x198278){return function(_0x4224ca){if(_0x4224ca){return _0x4224ca['update'](_0x408132)[_0x3410('0x1e')](function(_0x4a16d3){return _0x4a16d3;});}return null;};}function removeEntity(_0x4e25b6,_0x48985d){return function(_0x376c25){if(_0x376c25){return _0x376c25[_0x3410('0x1f')]()[_0x3410('0x1e')](function(){_0x4e25b6['status'](0xcc)[_0x3410('0x18')]();});}};}function handleEntityNotFound(_0x53db7c,_0x1b8813){return function(_0x3ef7a8){if(!_0x3ef7a8){_0x53db7c[_0x3410('0x20')](0x194);}return _0x3ef7a8;};}function handleError(_0xd0bf97,_0x1735cf){_0x1735cf=_0x1735cf||0x1f4;return function(_0x2d753c){logger[_0x3410('0x21')](_0x2d753c[_0x3410('0x22')]);if(_0x2d753c[_0x3410('0x23')]){delete _0x2d753c['name'];}_0xd0bf97['status'](_0x1735cf)[_0x3410('0x24')](_0x2d753c);};}exports[_0x3410('0x25')]=function(_0x3b4a0e,_0x5de0e7){var _0x2eda0a={},_0x2ac91f={},_0x2b4471={'count':0x0,'rows':[]};var _0x4210f0=_['map'](db['Cdr'][_0x3410('0x26')],function(_0x782e0){return{'name':_0x782e0[_0x3410('0x27')],'type':_0x782e0[_0x3410('0x28')][_0x3410('0x29')]};});_0x2ac91f[_0x3410('0x2a')]=_[_0x3410('0x2b')](_0x4210f0,'name');_0x2ac91f['query']=_[_0x3410('0x2c')](_0x3b4a0e[_0x3410('0x2d')]);_0x2ac91f[_0x3410('0x2e')]=_[_0x3410('0x2f')](_0x2ac91f['model'],_0x2ac91f[_0x3410('0x2d')]);_0x2eda0a[_0x3410('0x30')]=_['intersection'](_0x2ac91f[_0x3410('0x2a')],qs[_0x3410('0x31')](_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x31')]));_0x2eda0a['attributes']=_0x2eda0a[_0x3410('0x30')][_0x3410('0x32')]?_0x2eda0a[_0x3410('0x30')]:_0x2ac91f[_0x3410('0x2a')];if(!_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x33')]('nolimit')){_0x2eda0a['limit']=qs['limit'](_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x1a')]);_0x2eda0a[_0x3410('0x34')]=qs[_0x3410('0x34')](_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x34')]);}_0x2eda0a['order']=qs[_0x3410('0x35')](_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x35')]);_0x2eda0a[_0x3410('0x36')]=qs['filters'](_[_0x3410('0x37')](_0x3b4a0e['query'],_0x2ac91f['filters']),_0x4210f0);if(_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x38')]){_0x2eda0a['where']=_['merge'](_0x2eda0a['where'],{'$or':_[_0x3410('0x2b')](_0x4210f0,function(_0x5d6835){if(_0x5d6835[_0x3410('0x28')]!=='VIRTUAL'){var _0xad137c={};_0xad137c[_0x5d6835[_0x3410('0x23')]]={'$like':'%'+_0x3b4a0e['query']['filter']+'%'};return _0xad137c;}})});}_0x2eda0a=_['merge']({},_0x2eda0a,_0x3b4a0e['options']);var _0x575602={'where':_0x2eda0a['where']};return db[_0x3410('0x39')][_0x3410('0x3a')](_0x575602)[_0x3410('0x1e')](function(_0x2e6543){_0x2b4471[_0x3410('0x3a')]=_0x2e6543;if(_0x3b4a0e[_0x3410('0x2d')][_0x3410('0x3b')]){_0x2eda0a['include']=[{'all':!![]}];}return db['Cdr'][_0x3410('0x3c')](_0x2eda0a);})[_0x3410('0x1e')](function(_0x305628){_0x2b4471['rows']=_0x305628;return _0x2b4471;})[_0x3410('0x1e')](respondWithFilteredResult(_0x5de0e7,_0x2eda0a))[_0x3410('0x3d')](handleError(_0x5de0e7,null));};exports[_0x3410('0x3e')]=function(_0x5038d8,_0x1cac8c){var _0x3083c6={'raw':!![],'where':{'id':_0x5038d8[_0x3410('0x3f')]['id']}},_0x5510b9={};_0x5510b9[_0x3410('0x2a')]=_['keys'](db[_0x3410('0x39')][_0x3410('0x26')]);_0x5510b9[_0x3410('0x2d')]=_[_0x3410('0x2c')](_0x5038d8[_0x3410('0x2d')]);_0x5510b9[_0x3410('0x2e')]=_[_0x3410('0x2f')](_0x5510b9['model'],_0x5510b9[_0x3410('0x2d')]);_0x3083c6[_0x3410('0x30')]=_[_0x3410('0x2f')](_0x5510b9[_0x3410('0x2a')],qs[_0x3410('0x31')](_0x5038d8[_0x3410('0x2d')][_0x3410('0x31')]));_0x3083c6[_0x3410('0x30')]=_0x3083c6[_0x3410('0x30')][_0x3410('0x32')]?_0x3083c6[_0x3410('0x30')]:_0x5510b9['model'];if(_0x5038d8[_0x3410('0x2d')][_0x3410('0x3b')]){_0x3083c6['include']=[{'all':!![]}];}_0x3083c6=_['merge']({},_0x3083c6,_0x5038d8[_0x3410('0x40')]);return db['Cdr']['find'](_0x3083c6)[_0x3410('0x1e')](handleEntityNotFound(_0x1cac8c,null))[_0x3410('0x1e')](respondWithResult(_0x1cac8c,null))['catch'](handleError(_0x1cac8c,null));};exports['create']=function(_0x29d0e7,_0x5a3c61){return db[_0x3410('0x39')][_0x3410('0x41')](_0x29d0e7[_0x3410('0x42')],{})[_0x3410('0x1e')](respondWithResult(_0x5a3c61,0xc9))['catch'](handleError(_0x5a3c61,null));};exports[_0x3410('0x43')]=function(_0xc8832c,_0x555d0e){if(_0xc8832c[_0x3410('0x42')]['id']){delete _0xc8832c[_0x3410('0x42')]['id'];}return db['Cdr'][_0x3410('0x44')]({'where':{'id':_0xc8832c['params']['id']}})[_0x3410('0x1e')](handleEntityNotFound(_0x555d0e,null))['then'](saveUpdates(_0xc8832c[_0x3410('0x42')],null))[_0x3410('0x1e')](respondWithResult(_0x555d0e,null))[_0x3410('0x3d')](handleError(_0x555d0e,null));};exports[_0x3410('0x1f')]=function(_0x32717a,_0x110956){return db[_0x3410('0x39')][_0x3410('0x44')]({'where':{'id':_0x32717a[_0x3410('0x3f')]['id']}})[_0x3410('0x1e')](handleEntityNotFound(_0x110956,null))[_0x3410('0x1e')](removeEntity(_0x110956,null))[_0x3410('0x3d')](handleError(_0x110956,null));};exports[_0x3410('0x45')]=function(_0x2b856f,_0x3dc152){return db[_0x3410('0x39')][_0x3410('0x45')]()[_0x3410('0x1e')](respondWithResult(_0x3dc152,null))[_0x3410('0x3d')](handleError(_0x3dc152,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index d66e09c..1beed9d 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 _0xab44=['src','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','disposition','dst'];(function(_0x4ae1fa,_0x751466){var _0x136e51=function(_0x52c2b6){while(--_0x52c2b6){_0x4ae1fa['push'](_0x4ae1fa['shift']());}};_0x136e51(++_0x751466);}(_0xab44,0xb6));var _0x4ab4=function(_0x5403c3,_0x7fcfab){_0x5403c3=_0x5403c3-0x0;var _0x3d0b92=_0xab44[_0x5403c3];return _0x3d0b92;};'use strict';var _=require(_0x4ab4('0x0'));var util=require(_0x4ab4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4ab4('0x2'));var BPromise=require(_0x4ab4('0x3'));var rp=require(_0x4ab4('0x4'));var fs=require('fs');var path=require(_0x4ab4('0x5'));var rimraf=require(_0x4ab4('0x6'));var config=require(_0x4ab4('0x7'));var attributes=require(_0x4ab4('0x8'));module[_0x4ab4('0x9')]=function(_0x12ccf2,_0x4f336f){return _0x12ccf2['define'](_0x4ab4('0xa'),attributes,{'tableName':_0x4ab4('0xb'),'paranoid':![],'indexes':[{'name':_0x4ab4('0xc'),'fields':['accountcode']},{'name':_0x4ab4('0xd'),'fields':['calldate']},{'name':_0x4ab4('0xe'),'fields':[_0x4ab4('0xe')]},{'name':'dst','fields':[_0x4ab4('0xf')]},{'name':_0x4ab4('0x10'),'fields':[_0x4ab4('0x10')]},{'name':_0x4ab4('0x11'),'fields':[_0x4ab4('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3baf=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','moment','bluebird','./cdr.attributes','exports','define','Cdr'];(function(_0x27ffcc,_0x359062){var _0x3b1abf=function(_0x303894){while(--_0x303894){_0x27ffcc['push'](_0x27ffcc['shift']());}};_0x3b1abf(++_0x359062);}(_0x3baf,0x70));var _0xf3ba=function(_0x80d21a,_0x26fc3b){_0x80d21a=_0x80d21a-0x0;var _0x239369=_0x3baf[_0x80d21a];return _0x239369;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf3ba('0x2'));var BPromise=require(_0xf3ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf3ba('0x4'));module[_0xf3ba('0x5')]=function(_0x3d3d1a,_0x51f035){return _0x3d3d1a[_0xf3ba('0x6')](_0xf3ba('0x7'),attributes,{'tableName':_0xf3ba('0x8'),'paranoid':![],'indexes':[{'name':_0xf3ba('0x9'),'fields':[_0xf3ba('0x9')]},{'name':'calldate','fields':[_0xf3ba('0xa')]},{'name':_0xf3ba('0xb'),'fields':[_0xf3ba('0xb')]},{'name':_0xf3ba('0xc'),'fields':[_0xf3ba('0xc')]},{'name':'src','fields':[_0xf3ba('0xd')]},{'name':_0xf3ba('0xe'),'fields':[_0xf3ba('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 64874e5..82b39ee 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 _0xb0bd=['../../config/utils','rpc','http','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x2f5c3e,_0x239e81){var _0x39eb21=function(_0x52704c){while(--_0x52704c){_0x2f5c3e['push'](_0x2f5c3e['shift']());}};_0x39eb21(++_0x239e81);}(_0xb0bd,0x1e9));var _0xdb0b=function(_0x18bf56,_0xd8a728){_0x18bf56=_0x18bf56-0x0;var _0x57c73f=_0xb0bd[_0x18bf56];return _0x57c73f;};'use strict';var _=require('lodash');var util=require(_0xdb0b('0x0'));var moment=require(_0xdb0b('0x1'));var BPromise=require(_0xdb0b('0x2'));var rs=require(_0xdb0b('0x3'));var fs=require('fs');var Redis=require(_0xdb0b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb0b('0x5'));var logger=require('../../config/logger')(_0xdb0b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xdb0b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xf7ecca,_0x40d1f6,_0x44e002){return new BPromise(function(_0x24751f,_0x2a94e7){return client[_0xdb0b('0x8')](_0xf7ecca,_0x44e002)[_0xdb0b('0x9')](function(_0x305732){logger[_0xdb0b('0xa')]('Cdr,\x20%s,\x20%s',_0x40d1f6,_0xdb0b('0xb'));logger['debug'](_0xdb0b('0xc'),_0x40d1f6,'request\x20sent',JSON[_0xdb0b('0xd')](_0x305732));if(_0x305732[_0xdb0b('0xe')]){if(_0x305732['error'][_0xdb0b('0xf')]===0x1f4){logger[_0xdb0b('0xe')](_0xdb0b('0x10'),_0x40d1f6,_0x305732[_0xdb0b('0xe')][_0xdb0b('0x11')]);return _0x2a94e7(_0x305732[_0xdb0b('0xe')][_0xdb0b('0x11')]);}logger[_0xdb0b('0xe')](_0xdb0b('0x10'),_0x40d1f6,_0x305732[_0xdb0b('0xe')][_0xdb0b('0x11')]);return _0x24751f(_0x305732[_0xdb0b('0xe')]['message']);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x40d1f6,_0xdb0b('0xb'));_0x24751f(_0x305732[_0xdb0b('0x12')][_0xdb0b('0x11')]);}})['catch'](function(_0x2753af){logger['error']('Cdr,\x20%s,\x20%s',_0x40d1f6,_0x2753af);_0x2a94e7(_0x2753af);});});} \ No newline at end of file +var _0xe76b=['rpc','../../config/environment','client','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x81ec48,_0x50f33d){var _0xe16980=function(_0x1a8eea){while(--_0x1a8eea){_0x81ec48['push'](_0x81ec48['shift']());}};_0xe16980(++_0x50f33d);}(_0xe76b,0xfe));var _0xbe76=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0xe76b[_0x4843f9];return _0x193c6a;};'use strict';var _=require(_0xbe76('0x0'));var util=require('util');var moment=require(_0xbe76('0x1'));var BPromise=require(_0xbe76('0x2'));var rs=require(_0xbe76('0x3'));var fs=require('fs');var Redis=require(_0xbe76('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe76('0x5'));var logger=require('../../config/logger')(_0xbe76('0x6'));var config=require(_0xbe76('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbe76('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e0e84,_0x28ac0c,_0x2bb7b7){return new BPromise(function(_0x55ba02,_0x3ad248){return client['request'](_0x3e0e84,_0x2bb7b7)[_0xbe76('0x9')](function(_0x200896){logger[_0xbe76('0xa')](_0xbe76('0xb'),_0x28ac0c,_0xbe76('0xc'));logger['debug'](_0xbe76('0xd'),_0x28ac0c,_0xbe76('0xc'),JSON[_0xbe76('0xe')](_0x200896));if(_0x200896[_0xbe76('0xf')]){if(_0x200896[_0xbe76('0xf')][_0xbe76('0x10')]===0x1f4){logger[_0xbe76('0xf')](_0xbe76('0xb'),_0x28ac0c,_0x200896[_0xbe76('0xf')][_0xbe76('0x11')]);return _0x3ad248(_0x200896[_0xbe76('0xf')][_0xbe76('0x11')]);}logger[_0xbe76('0xf')](_0xbe76('0xb'),_0x28ac0c,_0x200896[_0xbe76('0xf')][_0xbe76('0x11')]);return _0x55ba02(_0x200896[_0xbe76('0xf')][_0xbe76('0x11')]);}else{logger['info'](_0xbe76('0xb'),_0x28ac0c,'request\x20sent');_0x55ba02(_0x200896[_0xbe76('0x12')][_0xbe76('0x11')]);}})[_0xbe76('0x13')](function(_0x4f7e12){logger[_0xbe76('0xf')](_0xbe76('0xb'),_0x28ac0c,_0x4f7e12);_0x3ad248(_0x4f7e12);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3f20d27..2f69bff 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 _0x80a2=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','./cdr.controller','isAuthenticated','index','get','/describe','describe','create','put'];(function(_0x50a635,_0x158de3){var _0x15fcdf=function(_0x16342e){while(--_0x16342e){_0x50a635['push'](_0x50a635['shift']());}};_0x15fcdf(++_0x158de3);}(_0x80a2,0x1eb));var _0x280a=function(_0x1be64c,_0x4d5645){_0x1be64c=_0x1be64c-0x0;var _0x57552e=_0x80a2[_0x1be64c];return _0x57552e;};'use strict';var multer=require(_0x280a('0x0'));var util=require(_0x280a('0x1'));var path=require(_0x280a('0x2'));var timeout=require(_0x280a('0x3'));var express=require(_0x280a('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x280a('0x5'));router['get']('/',auth[_0x280a('0x6')](),controller[_0x280a('0x7')]);router[_0x280a('0x8')](_0x280a('0x9'),auth[_0x280a('0x6')](),controller[_0x280a('0xa')]);router[_0x280a('0x8')]('/:id',auth[_0x280a('0x6')](),controller['show']);router['post']('/',auth[_0x280a('0x6')](),controller[_0x280a('0xb')]);router[_0x280a('0xc')](_0x280a('0xd'),auth[_0x280a('0x6')](),controller[_0x280a('0xe')]);router[_0x280a('0xf')](_0x280a('0xd'),auth[_0x280a('0x6')](),controller[_0x280a('0x10')]);module[_0x280a('0x11')]=router; \ No newline at end of file +var _0x4ef2=['create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1cc5ac,_0x44fa9a){var _0x1bf3c0=function(_0xf3751f){while(--_0xf3751f){_0x1cc5ac['push'](_0x1cc5ac['shift']());}};_0x1bf3c0(++_0x44fa9a);}(_0x4ef2,0x16d));var _0x24ef=function(_0x1c2b30,_0x226b8a){_0x1c2b30=_0x1c2b30-0x0;var _0xb8f3c3=_0x4ef2[_0x1c2b30];return _0xb8f3c3;};'use strict';var multer=require(_0x24ef('0x0'));var util=require(_0x24ef('0x1'));var path=require(_0x24ef('0x2'));var timeout=require(_0x24ef('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x24ef('0x4'));var interaction=require(_0x24ef('0x5'));var config=require('../../config/environment');var controller=require(_0x24ef('0x6'));router[_0x24ef('0x7')]('/',auth[_0x24ef('0x8')](),controller[_0x24ef('0x9')]);router['get'](_0x24ef('0xa'),auth['isAuthenticated'](),controller[_0x24ef('0xb')]);router['get'](_0x24ef('0xc'),auth[_0x24ef('0x8')](),controller[_0x24ef('0xd')]);router[_0x24ef('0xe')]('/',auth['isAuthenticated'](),controller[_0x24ef('0xf')]);router[_0x24ef('0x10')]('/:id',auth[_0x24ef('0x8')](),controller[_0x24ef('0x11')]);router[_0x24ef('0x12')](_0x24ef('0xc'),auth[_0x24ef('0x8')](),controller['destroy']);module[_0x24ef('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 2e52007..e832288 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 _0x4cd1=['*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x96c1fe,_0x25f9da){var _0x5dce5b=function(_0x42fe85){while(--_0x42fe85){_0x96c1fe['push'](_0x96c1fe['shift']());}};_0x5dce5b(++_0x25f9da);}(_0x4cd1,0x1bd));var _0x14cd=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x4cd1[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x14cd('0x0'));module['exports']={'priority':{'type':Sequelize[_0x14cd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x14cd('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x14cd('0x2')],'defaultValue':_0x14cd('0x3')}}; \ No newline at end of file +var _0x6408=['TEXT','exports','INTEGER','STRING'];(function(_0x5c28cc,_0x23d0b4){var _0x580dec=function(_0x3633bf){while(--_0x3633bf){_0x5c28cc['push'](_0x5c28cc['shift']());}};_0x580dec(++_0x23d0b4);}(_0x6408,0x1d5));var _0x8640=function(_0x5bd1cb,_0x164492){_0x5bd1cb=_0x5bd1cb-0x0;var _0x4371d8=_0x6408[_0x5bd1cb];return _0x4371d8;};'use strict';var Sequelize=require('sequelize');module[_0x8640('0x0')]={'priority':{'type':Sequelize[_0x8640('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8640('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8640('0x3')]()},'description':{'type':Sequelize[_0x8640('0x2')]},'interval':{'type':Sequelize[_0x8640('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index b2928e2..aa6e661 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 _0x577a=['error','stack','name','send','show','model','rawAttributes','keys','query','intersection','fields','attributes','length','merge','options','ChatApplication','find','catch','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','status','end','json','offset','limit','Content-Range','reject','then','destroy','sendStatus'];(function(_0x2d89f3,_0x58d58e){var _0x5add9f=function(_0x10569e){while(--_0x10569e){_0x2d89f3['push'](_0x2d89f3['shift']());}};_0x5add9f(++_0x58d58e);}(_0x577a,0x1c5));var _0xa577=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x577a[_0x39096d];return _0x13da4f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa577('0x0'));var rimraf=require(_0xa577('0x1'));var zipdir=require(_0xa577('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa577('0x3'));var moment=require(_0xa577('0x4'));var BPromise=require(_0xa577('0x5'));var Mustache=require('mustache');var util=require(_0xa577('0x6'));var path=require(_0xa577('0x7'));var sox=require(_0xa577('0x8'));var csv=require(_0xa577('0x9'));var ejs=require(_0xa577('0xa'));var fs=require('fs');var _=require(_0xa577('0xb'));var squel=require(_0xa577('0xc'));var crypto=require(_0xa577('0xd'));var jsforce=require(_0xa577('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa577('0x9'));var querystring=require(_0xa577('0xf'));var Papa=require(_0xa577('0x10'));var Redis=require(_0xa577('0x11'));var authService=require(_0xa577('0x12'));var qs=require(_0xa577('0x13'));var as=require(_0xa577('0x14'));var hardwareService=require(_0xa577('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa577('0x16'))['db'];function respondWithStatusCode(_0xe40491,_0x3a7885){_0x3a7885=_0x3a7885||0xcc;return function(_0x5001b8){if(_0x5001b8){return _0xe40491['sendStatus'](_0x3a7885);}return _0xe40491[_0xa577('0x17')](_0x3a7885)[_0xa577('0x18')]();};}function respondWithResult(_0xf346d0,_0x491531){_0x491531=_0x491531||0xc8;return function(_0x1c4131){if(_0x1c4131){return _0xf346d0['status'](_0x491531)[_0xa577('0x19')](_0x1c4131);}};}function respondWithFilteredResult(_0x41d2e7,_0x3a66ee){return function(_0x9285c7){if(_0x9285c7){var _0x4ac9e6=_0x9285c7['count'],_0x3ecacd=_0x3a66ee[_0xa577('0x1a')],_0x374bb9=_0x3a66ee[_0xa577('0x1a')]+_0x3a66ee[_0xa577('0x1b')],_0x47da78;if(_0x374bb9>=_0x4ac9e6){_0x374bb9=_0x4ac9e6;_0x47da78=0xc8;}else{_0x47da78=0xce;}_0x41d2e7['status'](_0x47da78);return _0x41d2e7['set'](_0xa577('0x1c'),_0x3ecacd+'-'+_0x374bb9+'/'+_0x4ac9e6)[_0xa577('0x19')](_0x9285c7);}return null;};}function patchUpdates(_0x3acd0e){return function(_0x3f432){try{jsonpatch['apply'](_0x3f432,_0x3acd0e,!![]);}catch(_0x144879){return BPromise[_0xa577('0x1d')](_0x144879);}return _0x3f432['save']();};}function saveUpdates(_0x1f6ebb,_0x5880dc){return function(_0x389d0c){if(_0x389d0c){return _0x389d0c['update'](_0x1f6ebb)[_0xa577('0x1e')](function(_0x25208d){return _0x25208d;});}return null;};}function removeEntity(_0x18fe95,_0x2f1f7b){return function(_0x3d9ebb){if(_0x3d9ebb){return _0x3d9ebb[_0xa577('0x1f')]()[_0xa577('0x1e')](function(){_0x18fe95[_0xa577('0x17')](0xcc)[_0xa577('0x18')]();});}};}function handleEntityNotFound(_0x367c5a,_0x334666){return function(_0xc0bf42){if(!_0xc0bf42){_0x367c5a[_0xa577('0x20')](0x194);}return _0xc0bf42;};}function handleError(_0x509972,_0x5a4975){_0x5a4975=_0x5a4975||0x1f4;return function(_0x1e579e){logger[_0xa577('0x21')](_0x1e579e[_0xa577('0x22')]);if(_0x1e579e[_0xa577('0x23')]){delete _0x1e579e[_0xa577('0x23')];}_0x509972[_0xa577('0x17')](_0x5a4975)[_0xa577('0x24')](_0x1e579e);};}exports[_0xa577('0x25')]=function(_0x1885f4,_0x5d417d){var _0x3dd31a={'raw':!![],'where':{'id':_0x1885f4['params']['id']}},_0x36f78b={};_0x36f78b[_0xa577('0x26')]=_['keys'](db['ChatApplication'][_0xa577('0x27')]);_0x36f78b['query']=_[_0xa577('0x28')](_0x1885f4[_0xa577('0x29')]);_0x36f78b['filters']=_[_0xa577('0x2a')](_0x36f78b['model'],_0x36f78b['query']);_0x3dd31a['attributes']=_[_0xa577('0x2a')](_0x36f78b['model'],qs[_0xa577('0x2b')](_0x1885f4[_0xa577('0x29')][_0xa577('0x2b')]));_0x3dd31a[_0xa577('0x2c')]=_0x3dd31a['attributes'][_0xa577('0x2d')]?_0x3dd31a[_0xa577('0x2c')]:_0x36f78b[_0xa577('0x26')];if(_0x1885f4['query']['includeAll']){_0x3dd31a['include']=[{'all':!![]}];}_0x3dd31a=_[_0xa577('0x2e')]({},_0x3dd31a,_0x1885f4[_0xa577('0x2f')]);return db[_0xa577('0x30')][_0xa577('0x31')](_0x3dd31a)[_0xa577('0x1e')](handleEntityNotFound(_0x5d417d,null))[_0xa577('0x1e')](respondWithResult(_0x5d417d,null))[_0xa577('0x32')](handleError(_0x5d417d,null));};exports[_0xa577('0x33')]=function(_0x138e77,_0xf857de){if(_0x138e77['body']['id']){delete _0x138e77[_0xa577('0x34')]['id'];}return db['ChatApplication'][_0xa577('0x31')]({'where':{'id':_0x138e77[_0xa577('0x35')]['id']}})['then'](handleEntityNotFound(_0xf857de,null))[_0xa577('0x1e')](saveUpdates(_0x138e77['body'],null))[_0xa577('0x1e')](respondWithResult(_0xf857de,null))[_0xa577('0x32')](handleError(_0xf857de,null));};exports[_0xa577('0x1f')]=function(_0x1808bc,_0x217c10){return db[_0xa577('0x30')][_0xa577('0x31')]({'where':{'id':_0x1808bc[_0xa577('0x35')]['id']}})[_0xa577('0x1e')](handleEntityNotFound(_0x217c10,null))[_0xa577('0x1e')](removeEntity(_0x217c10,null))[_0xa577('0x32')](handleError(_0x217c10,null));}; \ No newline at end of file +var _0xd397=['intersection','model','fields','attributes','length','includeAll','merge','options','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','show','params','keys','ChatApplication','query','filters'];(function(_0x55b8dd,_0x2c756d){var _0x5d73f6=function(_0x50d6e0){while(--_0x50d6e0){_0x55b8dd['push'](_0x55b8dd['shift']());}};_0x5d73f6(++_0x2c756d);}(_0xd397,0xb0));var _0x7d39=function(_0xf473b5,_0x490528){_0xf473b5=_0xf473b5-0x0;var _0x1e43b4=_0xd397[_0xf473b5];return _0x1e43b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7d39('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d39('0x1'));var jsonpatch=require(_0x7d39('0x2'));var rp=require(_0x7d39('0x3'));var moment=require(_0x7d39('0x4'));var BPromise=require(_0x7d39('0x5'));var Mustache=require(_0x7d39('0x6'));var util=require('util');var path=require(_0x7d39('0x7'));var sox=require(_0x7d39('0x8'));var csv=require(_0x7d39('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d39('0xa'));var squel=require(_0x7d39('0xb'));var crypto=require(_0x7d39('0xc'));var jsforce=require(_0x7d39('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7d39('0x9'));var querystring=require(_0x7d39('0xe'));var Papa=require(_0x7d39('0xf'));var Redis=require('ioredis');var authService=require(_0x7d39('0x10'));var qs=require(_0x7d39('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7d39('0x12'));var config=require(_0x7d39('0x13'));var db=require(_0x7d39('0x14'))['db'];function respondWithStatusCode(_0x256347,_0x1d6107){_0x1d6107=_0x1d6107||0xcc;return function(_0x506770){if(_0x506770){return _0x256347[_0x7d39('0x15')](_0x1d6107);}return _0x256347[_0x7d39('0x16')](_0x1d6107)[_0x7d39('0x17')]();};}function respondWithResult(_0x1e930c,_0x93bebf){_0x93bebf=_0x93bebf||0xc8;return function(_0x14f11a){if(_0x14f11a){return _0x1e930c[_0x7d39('0x16')](_0x93bebf)['json'](_0x14f11a);}};}function respondWithFilteredResult(_0x500295,_0x279aa7){return function(_0x2bed49){if(_0x2bed49){var _0x23a04d=_0x2bed49[_0x7d39('0x18')],_0x31f720=_0x279aa7[_0x7d39('0x19')],_0x59ba75=_0x279aa7[_0x7d39('0x19')]+_0x279aa7[_0x7d39('0x1a')],_0x13f884;if(_0x59ba75>=_0x23a04d){_0x59ba75=_0x23a04d;_0x13f884=0xc8;}else{_0x13f884=0xce;}_0x500295['status'](_0x13f884);return _0x500295[_0x7d39('0x1b')](_0x7d39('0x1c'),_0x31f720+'-'+_0x59ba75+'/'+_0x23a04d)[_0x7d39('0x1d')](_0x2bed49);}return null;};}function patchUpdates(_0x1471e2){return function(_0x2b4271){try{jsonpatch['apply'](_0x2b4271,_0x1471e2,!![]);}catch(_0x285473){return BPromise[_0x7d39('0x1e')](_0x285473);}return _0x2b4271[_0x7d39('0x1f')]();};}function saveUpdates(_0xffb9d3,_0x2e7e0d){return function(_0x5455e8){if(_0x5455e8){return _0x5455e8[_0x7d39('0x20')](_0xffb9d3)['then'](function(_0x2714a6){return _0x2714a6;});}return null;};}function removeEntity(_0x2d18ce,_0x2c0b1e){return function(_0x44cdae){if(_0x44cdae){return _0x44cdae[_0x7d39('0x21')]()[_0x7d39('0x22')](function(){_0x2d18ce[_0x7d39('0x16')](0xcc)[_0x7d39('0x17')]();});}};}function handleEntityNotFound(_0x8ec04a,_0x1678d0){return function(_0x9e19c5){if(!_0x9e19c5){_0x8ec04a[_0x7d39('0x15')](0x194);}return _0x9e19c5;};}function handleError(_0x257452,_0x5bb40a){_0x5bb40a=_0x5bb40a||0x1f4;return function(_0x51e8aa){logger[_0x7d39('0x23')](_0x51e8aa[_0x7d39('0x24')]);if(_0x51e8aa[_0x7d39('0x25')]){delete _0x51e8aa[_0x7d39('0x25')];}_0x257452['status'](_0x5bb40a)['send'](_0x51e8aa);};}exports[_0x7d39('0x26')]=function(_0x2032a4,_0x1ab92a){var _0x426352={'raw':!![],'where':{'id':_0x2032a4[_0x7d39('0x27')]['id']}},_0xa10153={};_0xa10153['model']=_[_0x7d39('0x28')](db[_0x7d39('0x29')]['rawAttributes']);_0xa10153[_0x7d39('0x2a')]=_['keys'](_0x2032a4[_0x7d39('0x2a')]);_0xa10153[_0x7d39('0x2b')]=_[_0x7d39('0x2c')](_0xa10153[_0x7d39('0x2d')],_0xa10153[_0x7d39('0x2a')]);_0x426352['attributes']=_['intersection'](_0xa10153[_0x7d39('0x2d')],qs['fields'](_0x2032a4[_0x7d39('0x2a')][_0x7d39('0x2e')]));_0x426352['attributes']=_0x426352[_0x7d39('0x2f')][_0x7d39('0x30')]?_0x426352['attributes']:_0xa10153[_0x7d39('0x2d')];if(_0x2032a4['query'][_0x7d39('0x31')]){_0x426352['include']=[{'all':!![]}];}_0x426352=_[_0x7d39('0x32')]({},_0x426352,_0x2032a4[_0x7d39('0x33')]);return db[_0x7d39('0x29')][_0x7d39('0x34')](_0x426352)[_0x7d39('0x22')](handleEntityNotFound(_0x1ab92a,null))[_0x7d39('0x22')](respondWithResult(_0x1ab92a,null))[_0x7d39('0x35')](handleError(_0x1ab92a,null));};exports[_0x7d39('0x20')]=function(_0x3f9890,_0x1cac0c){if(_0x3f9890['body']['id']){delete _0x3f9890[_0x7d39('0x36')]['id'];}return db[_0x7d39('0x29')]['find']({'where':{'id':_0x3f9890[_0x7d39('0x27')]['id']}})[_0x7d39('0x22')](handleEntityNotFound(_0x1cac0c,null))[_0x7d39('0x22')](saveUpdates(_0x3f9890[_0x7d39('0x36')],null))[_0x7d39('0x22')](respondWithResult(_0x1cac0c,null))['catch'](handleError(_0x1cac0c,null));};exports[_0x7d39('0x21')]=function(_0x46f841,_0x62e3b1){return db['ChatApplication'][_0x7d39('0x34')]({'where':{'id':_0x46f841['params']['id']}})['then'](handleEntityNotFound(_0x62e3b1,null))[_0x7d39('0x22')](removeEntity(_0x62e3b1,null))['catch'](handleError(_0x62e3b1,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 8a23f3f..499e298 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 _0x59fa=['utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf','define','ChatApplication','utf8mb4'];(function(_0x57c432,_0xea04b5){var _0x34f0bd=function(_0x14b97b){while(--_0x14b97b){_0x57c432['push'](_0x57c432['shift']());}};_0x34f0bd(++_0xea04b5);}(_0x59fa,0x123));var _0xa59f=function(_0xa9a766,_0x41224a){_0xa9a766=_0xa9a766-0x0;var _0x55c51d=_0x59fa[_0xa9a766];return _0x55c51d;};'use strict';var _=require(_0xa59f('0x0'));var util=require(_0xa59f('0x1'));var logger=require(_0xa59f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa59f('0x3'));var rp=require(_0xa59f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa59f('0x5'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module['exports']=function(_0x2b735a,_0x57d8c0){return _0x2b735a[_0xa59f('0x6')](_0xa59f('0x7'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa59f('0x8'),'collate':_0xa59f('0x9')});}; \ No newline at end of file +var _0x989e=['../../config/logger','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','chat_applications','lodash'];(function(_0x306ce1,_0x51a3bc){var _0x1a9c67=function(_0x409b69){while(--_0x409b69){_0x306ce1['push'](_0x306ce1['shift']());}};_0x1a9c67(++_0x51a3bc);}(_0x989e,0x1ad));var _0xe989=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0x989e[_0x1305e3];return _0x1068e9;};'use strict';var _=require(_0xe989('0x0'));var util=require('util');var logger=require(_0xe989('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe989('0x2'));var fs=require('fs');var path=require(_0xe989('0x3'));var rimraf=require(_0xe989('0x4'));var config=require(_0xe989('0x5'));var attributes=require(_0xe989('0x6'));module[_0xe989('0x7')]=function(_0x4c42ed,_0x607e0d){return _0x4c42ed[_0xe989('0x8')]('ChatApplication',attributes,{'tableName':_0xe989('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index a01d61a..b71fe58 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 _0xd96b=['../../config/environment','jayson/promise','client','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0xd96b,0x189));var _0xbd96=function(_0xff6b9,_0x257f63){_0xff6b9=_0xff6b9-0x0;var _0x25aaa9=_0xd96b[_0xff6b9];return _0x25aaa9;};'use strict';var _=require(_0xbd96('0x0'));var util=require(_0xbd96('0x1'));var moment=require(_0xbd96('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd96('0x3'));var db=require(_0xbd96('0x4'))['db'];var utils=require(_0xbd96('0x5'));var logger=require('../../config/logger')(_0xbd96('0x6'));var config=require(_0xbd96('0x7'));var jayson=require(_0xbd96('0x8'));var client=jayson[_0xbd96('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32181d,_0x4027f7,_0x525dd5){return new BPromise(function(_0x2591d0,_0x4177e6){return client['request'](_0x32181d,_0x525dd5)['then'](function(_0x4cc4ad){logger[_0xbd96('0xa')]('ChatApplication,\x20%s,\x20%s',_0x4027f7,_0xbd96('0xb'));logger[_0xbd96('0xc')](_0xbd96('0xd'),_0x4027f7,_0xbd96('0xb'),JSON[_0xbd96('0xe')](_0x4cc4ad));if(_0x4cc4ad['error']){if(_0x4cc4ad[_0xbd96('0xf')][_0xbd96('0x10')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x4027f7,_0x4cc4ad[_0xbd96('0xf')][_0xbd96('0x11')]);return _0x4177e6(_0x4cc4ad['error']['message']);}logger[_0xbd96('0xf')]('ChatApplication,\x20%s,\x20%s',_0x4027f7,_0x4cc4ad[_0xbd96('0xf')][_0xbd96('0x11')]);return _0x2591d0(_0x4cc4ad[_0xbd96('0xf')][_0xbd96('0x11')]);}else{logger[_0xbd96('0xa')](_0xbd96('0x12'),_0x4027f7,_0xbd96('0xb'));_0x2591d0(_0x4cc4ad['result'][_0xbd96('0x11')]);}})[_0xbd96('0x13')](function(_0x11dc1d){logger[_0xbd96('0xf')]('ChatApplication,\x20%s,\x20%s',_0x4027f7,_0x11dc1d);_0x4177e6(_0x11dc1d);});});} \ No newline at end of file +var _0xd056=['ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1a048d,_0x186b58){var _0x196ff4=function(_0x249410){while(--_0x249410){_0x1a048d['push'](_0x1a048d['shift']());}};_0x196ff4(++_0x186b58);}(_0xd056,0x142));var _0x6d05=function(_0x27f7a9,_0x41ad09){_0x27f7a9=_0x27f7a9-0x0;var _0x93555a=_0xd056[_0x27f7a9];return _0x93555a;};'use strict';var _=require('lodash');var util=require(_0x6d05('0x0'));var moment=require(_0x6d05('0x1'));var BPromise=require(_0x6d05('0x2'));var rs=require(_0x6d05('0x3'));var fs=require('fs');var Redis=require(_0x6d05('0x4'));var db=require(_0x6d05('0x5'))['db'];var utils=require(_0x6d05('0x6'));var logger=require('../../config/logger')(_0x6d05('0x7'));var config=require(_0x6d05('0x8'));var jayson=require(_0x6d05('0x9'));var client=jayson[_0x6d05('0xa')][_0x6d05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x170ecd,_0x1824e8,_0x16b779){return new BPromise(function(_0x2305c8,_0x13ceef){return client[_0x6d05('0xc')](_0x170ecd,_0x16b779)['then'](function(_0x1c7bce){logger[_0x6d05('0xd')](_0x6d05('0xe'),_0x1824e8,'request\x20sent');logger[_0x6d05('0xf')](_0x6d05('0x10'),_0x1824e8,_0x6d05('0x11'),JSON[_0x6d05('0x12')](_0x1c7bce));if(_0x1c7bce[_0x6d05('0x13')]){if(_0x1c7bce[_0x6d05('0x13')][_0x6d05('0x14')]===0x1f4){logger['error'](_0x6d05('0xe'),_0x1824e8,_0x1c7bce[_0x6d05('0x13')][_0x6d05('0x15')]);return _0x13ceef(_0x1c7bce[_0x6d05('0x13')][_0x6d05('0x15')]);}logger[_0x6d05('0x13')](_0x6d05('0xe'),_0x1824e8,_0x1c7bce['error'][_0x6d05('0x15')]);return _0x2305c8(_0x1c7bce[_0x6d05('0x13')]['message']);}else{logger[_0x6d05('0xd')]('ChatApplication,\x20%s,\x20%s',_0x1824e8,_0x6d05('0x11'));_0x2305c8(_0x1c7bce[_0x6d05('0x16')][_0x6d05('0x15')]);}})[_0x6d05('0x17')](function(_0x16ae33){logger[_0x6d05('0x13')](_0x6d05('0xe'),_0x1824e8,_0x16ae33);_0x13ceef(_0x16ae33);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a49f3f6..aaf6ad1 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 _0x7a80=['../../config/environment','./chatApplication.controller','get','show','put','/:id','isAuthenticated','update','delete','destroy','util','path','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a80,0x106));var _0x07a8=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x7a80[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require('multer');var util=require(_0x07a8('0x0'));var path=require(_0x07a8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x07a8('0x2'));var interaction=require(_0x07a8('0x3'));var config=require(_0x07a8('0x4'));var controller=require(_0x07a8('0x5'));router[_0x07a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x07a8('0x7')]);router[_0x07a8('0x8')](_0x07a8('0x9'),auth[_0x07a8('0xa')](),controller[_0x07a8('0xb')]);router[_0x07a8('0xc')]('/:id',auth[_0x07a8('0xa')](),controller[_0x07a8('0xd')]);module['exports']=router; \ No newline at end of file +var _0x477e=['isAuthenticated','show','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x180ace,_0x33aba2){var _0x4bf2c2=function(_0x43aa40){while(--_0x43aa40){_0x180ace['push'](_0x180ace['shift']());}};_0x4bf2c2(++_0x33aba2);}(_0x477e,0xf5));var _0xe477=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x477e[_0x13b392];return _0x39db24;};'use strict';var multer=require(_0xe477('0x0'));var util=require(_0xe477('0x1'));var path=require(_0xe477('0x2'));var timeout=require(_0xe477('0x3'));var express=require(_0xe477('0x4'));var router=express[_0xe477('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe477('0x6'));var config=require(_0xe477('0x7'));var controller=require('./chatApplication.controller');router[_0xe477('0x8')](_0xe477('0x9'),auth[_0xe477('0xa')](),controller[_0xe477('0xb')]);router[_0xe477('0xc')]('/:id',auth[_0xe477('0xa')](),controller[_0xe477('0xd')]);router['delete']('/:id',auth[_0xe477('0xa')](),controller[_0xe477('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index a41b7d2..6b07ec7 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 _0xb730=['STRING','BOOLEAN'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xb730,0xde));var _0x0b73=function(_0xb38e01,_0xb2bc77){_0xb38e01=_0xb38e01-0x0;var _0x350691=_0xb730[_0xb38e01];return _0x350691;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0b73('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x0b73('0x0')]},'write':{'type':Sequelize[_0x0b73('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3554=['exports','STRING','sequelize'];(function(_0x45fca3,_0x98e48){var _0xd50f35=function(_0x5e806d){while(--_0x5e806d){_0x45fca3['push'](_0x45fca3['shift']());}};_0xd50f35(++_0x98e48);}(_0x3554,0x176));var _0x4355=function(_0x1d08d2,_0x20b66f){_0x1d08d2=_0x1d08d2-0x0;var _0x3a988b=_0x3554[_0x1d08d2];return _0x3a988b;};'use strict';var Sequelize=require(_0x4355('0x0'));module[_0x4355('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4355('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b13b65c..73666ce 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 _0x6729=['limit','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','rows','show','params','keys','length','include','create','body','find','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','getMembers','removeMembers','addMessage','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x6729,0x178));var _0x9672=function(_0x1faf4e,_0x542bb0){_0x1faf4e=_0x1faf4e-0x0;var _0x3eb789=_0x6729[_0x1faf4e];return _0x3eb789;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9672('0x0'));var rimraf=require(_0x9672('0x1'));var zipdir=require(_0x9672('0x2'));var jsonpatch=require(_0x9672('0x3'));var rp=require(_0x9672('0x4'));var moment=require(_0x9672('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9672('0x6'));var util=require(_0x9672('0x7'));var path=require(_0x9672('0x8'));var sox=require('sox');var csv=require(_0x9672('0x9'));var ejs=require(_0x9672('0xa'));var fs=require('fs');var _=require(_0x9672('0xb'));var squel=require(_0x9672('0xc'));var crypto=require(_0x9672('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9672('0xe'));var toCsv=require(_0x9672('0x9'));var querystring=require(_0x9672('0xf'));var Papa=require(_0x9672('0x10'));var Redis=require(_0x9672('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9672('0x12'));var as=require(_0x9672('0x13'));var hardwareService=require(_0x9672('0x14'));var logger=require(_0x9672('0x15'))(_0x9672('0x16'));var utils=require(_0x9672('0x17'));var config=require(_0x9672('0x18'));var db=require(_0x9672('0x19'))['db'];config[_0x9672('0x1a')]=_[_0x9672('0x1b')](config[_0x9672('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9672('0x1a')]));require('./chatGroup.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9672('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x5d41cb,_0x437adc,_0x199cc5){if(_0x199cc5){var _0x28ddc9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28ddc9[_0x9672('0x1d')](_0x437adc)){return _0x5d41cb;}else{throw new db[(_0x9672('0x1e'))][(_0x9672('0x1f'))](_0x9672('0x20'));}}else{return _0x5d41cb;}}function respondWithRpcPromise(_0x4983bb,_0x50069f,_0x12ca6a,_0x5a7664){return new BPromise(function(_0x50e085,_0x3d358a){var _0x20a175=_0x5a7664||client;return _0x20a175['request'](_0x4983bb,_0x12ca6a)['then'](function(_0x316d2b){logger[_0x9672('0x21')](_0x9672('0x22'),_0x50069f,_0x9672('0x23'));logger[_0x9672('0x24')](_0x9672('0x25'),_0x50069f,_0x9672('0x23'),JSON[_0x9672('0x26')](_0x316d2b));if(_0x316d2b[_0x9672('0x27')]){if(_0x316d2b[_0x9672('0x27')][_0x9672('0x28')]===0x1f4){logger[_0x9672('0x27')](_0x9672('0x22'),_0x50069f,_0x316d2b['error']['message']);return _0x3d358a(_0x316d2b[_0x9672('0x27')][_0x9672('0x29')]);}logger['error'](_0x9672('0x22'),_0x50069f,_0x316d2b['error'][_0x9672('0x29')]);return _0x50e085(_0x316d2b[_0x9672('0x27')][_0x9672('0x29')]);}else{logger[_0x9672('0x21')](_0x9672('0x22'),_0x50069f,_0x9672('0x23'));_0x50e085(_0x316d2b['result'][_0x9672('0x29')]);}})[_0x9672('0x2a')](function(_0x22e328){logger[_0x9672('0x27')]('ChatGroup,\x20%s,\x20%s',_0x50069f,_0x22e328);_0x3d358a(_0x22e328);});});}function respondWithStatusCode(_0x1b13a1,_0x533220){_0x533220=_0x533220||0xcc;return function(_0x305d48){if(_0x305d48){return _0x1b13a1[_0x9672('0x2b')](_0x533220);}return _0x1b13a1[_0x9672('0x2c')](_0x533220)['end']();};}function respondWithResult(_0xb4949d,_0x2624cd){_0x2624cd=_0x2624cd||0xc8;return function(_0x5f1f3e){if(_0x5f1f3e){return _0xb4949d[_0x9672('0x2c')](_0x2624cd)[_0x9672('0x2d')](_0x5f1f3e);}};}function respondWithFilteredResult(_0x2d1010,_0x46adf4){return function(_0x4df39a){if(_0x4df39a){var _0x34cf69=_0x4df39a[_0x9672('0x2e')],_0xe85088=_0x46adf4[_0x9672('0x2f')],_0x52104d=_0x46adf4[_0x9672('0x2f')]+_0x46adf4[_0x9672('0x30')],_0x3a7cf0;if(_0x52104d>=_0x34cf69){_0x52104d=_0x34cf69;_0x3a7cf0=0xc8;}else{_0x3a7cf0=0xce;}_0x2d1010[_0x9672('0x2c')](_0x3a7cf0);return _0x2d1010['set'](_0x9672('0x31'),_0xe85088+'-'+_0x52104d+'/'+_0x34cf69)[_0x9672('0x2d')](_0x4df39a);}return null;};}function patchUpdates(_0x2da449){return function(_0x18380c){try{jsonpatch[_0x9672('0x32')](_0x18380c,_0x2da449,!![]);}catch(_0x25c216){return BPromise[_0x9672('0x33')](_0x25c216);}return _0x18380c[_0x9672('0x34')]();};}function saveUpdates(_0x14ff8c,_0x5294d5){return function(_0x5f54b1){if(_0x5f54b1){return _0x5f54b1[_0x9672('0x35')](_0x14ff8c)[_0x9672('0x36')](function(_0x37ccf1){return _0x37ccf1;});}return null;};}function removeEntity(_0x568d0f,_0x136b58){return function(_0x485b4b){if(_0x485b4b){return _0x485b4b[_0x9672('0x37')]()[_0x9672('0x36')](function(){_0x568d0f[_0x9672('0x2c')](0xcc)[_0x9672('0x38')]();});}};}function handleEntityNotFound(_0x11ac68,_0x3f15da){return function(_0x5c6a0c){if(!_0x5c6a0c){_0x11ac68['sendStatus'](0x194);}return _0x5c6a0c;};}function handleError(_0x2aabee,_0x38b9f8){_0x38b9f8=_0x38b9f8||0x1f4;return function(_0x537e70){logger[_0x9672('0x27')](_0x537e70[_0x9672('0x39')]);if(_0x537e70[_0x9672('0x3a')]){delete _0x537e70[_0x9672('0x3a')];}_0x2aabee[_0x9672('0x2c')](_0x38b9f8)[_0x9672('0x3b')](_0x537e70);};}exports[_0x9672('0x3c')]=function(_0x187293,_0x33e26e){var _0x35fe6a={},_0x2de0cb={},_0x3a5dfb={'count':0x0,'rows':[]};var _0x4c5303=_[_0x9672('0x3d')](db[_0x9672('0x3e')][_0x9672('0x3f')],function(_0x27359c){return{'name':_0x27359c[_0x9672('0x40')],'type':_0x27359c[_0x9672('0x41')][_0x9672('0x42')]};});_0x2de0cb[_0x9672('0x43')]=_[_0x9672('0x3d')](_0x4c5303,_0x9672('0x3a'));_0x2de0cb[_0x9672('0x44')]=_['keys'](_0x187293['query']);_0x2de0cb[_0x9672('0x45')]=_['intersection'](_0x2de0cb[_0x9672('0x43')],_0x2de0cb[_0x9672('0x44')]);_0x35fe6a[_0x9672('0x46')]=_[_0x9672('0x47')](_0x2de0cb[_0x9672('0x43')],qs[_0x9672('0x48')](_0x187293[_0x9672('0x44')][_0x9672('0x48')]));_0x35fe6a[_0x9672('0x46')]=_0x35fe6a[_0x9672('0x46')]['length']?_0x35fe6a[_0x9672('0x46')]:_0x2de0cb[_0x9672('0x43')];if(!_0x187293['query'][_0x9672('0x49')](_0x9672('0x4a'))){_0x35fe6a[_0x9672('0x30')]=qs['limit'](_0x187293[_0x9672('0x44')][_0x9672('0x30')]);_0x35fe6a['offset']=qs[_0x9672('0x2f')](_0x187293[_0x9672('0x44')][_0x9672('0x2f')]);}_0x35fe6a[_0x9672('0x4b')]=qs[_0x9672('0x4c')](_0x187293[_0x9672('0x44')][_0x9672('0x4c')]);_0x35fe6a['where']=qs[_0x9672('0x45')](_['pick'](_0x187293[_0x9672('0x44')],_0x2de0cb[_0x9672('0x45')]),_0x4c5303);if(_0x187293[_0x9672('0x44')][_0x9672('0x4d')]){_0x35fe6a[_0x9672('0x4e')]=_[_0x9672('0x4f')](_0x35fe6a[_0x9672('0x4e')],{'$or':_['map'](_0x4c5303,function(_0x23c389){if(_0x23c389['type']!=='VIRTUAL'){var _0x32f04e={};_0x32f04e[_0x23c389[_0x9672('0x3a')]]={'$like':'%'+_0x187293[_0x9672('0x44')][_0x9672('0x4d')]+'%'};return _0x32f04e;}})});}_0x35fe6a=_['merge']({},_0x35fe6a,_0x187293[_0x9672('0x50')]);var _0x4f37db={'where':_0x35fe6a[_0x9672('0x4e')]};return db[_0x9672('0x3e')]['count'](_0x4f37db)[_0x9672('0x36')](function(_0x2228b4){_0x3a5dfb['count']=_0x2228b4;if(_0x187293[_0x9672('0x44')][_0x9672('0x51')]){_0x35fe6a['include']=[{'all':!![]}];}return db['ChatGroup'][_0x9672('0x52')](_0x35fe6a);})[_0x9672('0x36')](function(_0x395d7a){_0x3a5dfb[_0x9672('0x53')]=_0x395d7a;return _0x3a5dfb;})[_0x9672('0x36')](respondWithFilteredResult(_0x33e26e,_0x35fe6a))[_0x9672('0x2a')](handleError(_0x33e26e,null));};exports[_0x9672('0x54')]=function(_0x1d8682,_0x25c76d){var _0x52aea1={'raw':!![],'where':{'id':_0x1d8682[_0x9672('0x55')]['id']}},_0x2e0858={};_0x2e0858[_0x9672('0x43')]=_['keys'](db[_0x9672('0x3e')]['rawAttributes']);_0x2e0858['query']=_[_0x9672('0x56')](_0x1d8682[_0x9672('0x44')]);_0x2e0858[_0x9672('0x45')]=_['intersection'](_0x2e0858[_0x9672('0x43')],_0x2e0858['query']);_0x52aea1[_0x9672('0x46')]=_[_0x9672('0x47')](_0x2e0858[_0x9672('0x43')],qs[_0x9672('0x48')](_0x1d8682[_0x9672('0x44')][_0x9672('0x48')]));_0x52aea1[_0x9672('0x46')]=_0x52aea1[_0x9672('0x46')][_0x9672('0x57')]?_0x52aea1[_0x9672('0x46')]:_0x2e0858['model'];if(_0x1d8682['query'][_0x9672('0x51')]){_0x52aea1[_0x9672('0x58')]=[{'all':!![]}];}_0x52aea1=_[_0x9672('0x4f')]({},_0x52aea1,_0x1d8682[_0x9672('0x50')]);return db[_0x9672('0x3e')]['find'](_0x52aea1)['then'](handleEntityNotFound(_0x25c76d,null))['then'](respondWithResult(_0x25c76d,null))['catch'](handleError(_0x25c76d,null));};exports[_0x9672('0x59')]=function(_0x3ba7df,_0xb0c88){return db[_0x9672('0x3e')][_0x9672('0x59')](_0x3ba7df[_0x9672('0x5a')],{})[_0x9672('0x36')](respondWithResult(_0xb0c88,0xc9))[_0x9672('0x2a')](handleError(_0xb0c88,null));};exports[_0x9672('0x35')]=function(_0xde30b,_0x54c317){if(_0xde30b[_0x9672('0x5a')]['id']){delete _0xde30b[_0x9672('0x5a')]['id'];}return db[_0x9672('0x3e')]['find']({'where':{'id':_0xde30b[_0x9672('0x55')]['id']}})['then'](handleEntityNotFound(_0x54c317,null))[_0x9672('0x36')](saveUpdates(_0xde30b[_0x9672('0x5a')],null))[_0x9672('0x36')](respondWithResult(_0x54c317,null))[_0x9672('0x2a')](handleError(_0x54c317,null));};exports[_0x9672('0x37')]=function(_0x5803bc,_0x462159){return db[_0x9672('0x3e')][_0x9672('0x5b')]({'where':{'id':_0x5803bc['params']['id']}})[_0x9672('0x36')](handleEntityNotFound(_0x462159,null))[_0x9672('0x36')](removeEntity(_0x462159,null))[_0x9672('0x2a')](handleError(_0x462159,null));};exports[_0x9672('0x5c')]=function(_0xc09bfe,_0x14e14a){return db[_0x9672('0x3e')][_0x9672('0x5c')]()['then'](respondWithResult(_0x14e14a,null))[_0x9672('0x2a')](handleError(_0x14e14a,null));};exports['getUnread']=function(_0x15e043,_0x3f5ffa,_0x540243){return db[_0x9672('0x5d')][_0x9672('0x2e')]({'where':{'ChatGroupId':_0x15e043['params']['id'],'ToId':_0x15e043[_0x9672('0x5e')]['id'],'read':![]}})['then'](function(_0x3a73e9){return{'id':_[_0x9672('0x5f')](_0x15e043[_0x9672('0x55')]['id']),'count':_0x3a73e9};})[_0x9672('0x36')](respondWithResult(_0x3f5ffa,null))['catch'](handleError(_0x3f5ffa,null));};exports[_0x9672('0x60')]=function(_0x458972,_0x4f8550,_0x2dab2a){return db['ChatGroup'][_0x9672('0x5b')]({'where':{'id':_0x458972[_0x9672('0x55')]['id']}})[_0x9672('0x36')](handleEntityNotFound(_0x4f8550,null))[_0x9672('0x36')](function(_0x396857){if(_0x396857){return _0x396857[_0x9672('0x60')](_0x458972[_0x9672('0x5a')][_0x9672('0x61')],_[_0x9672('0x62')](_0x458972[_0x9672('0x5a')],[_0x9672('0x61'),'id'])||{});}})[_0x9672('0x36')](respondWithResult(_0x4f8550,null))[_0x9672('0x2a')](handleError(_0x4f8550,null));};exports['getMembers']=function(_0x209e3e,_0x1a56ca,_0x526d31){var _0x20607a={};var _0x44fe0f={};var _0x5aee2d;var _0xf6e5d2;return db[_0x9672('0x3e')][_0x9672('0x63')]({'where':{'id':_0x209e3e[_0x9672('0x55')]['id']}})[_0x9672('0x36')](handleEntityNotFound(_0x1a56ca,null))[_0x9672('0x36')](function(_0x4b7029){if(_0x4b7029){_0x5aee2d=_0x4b7029;_0x44fe0f[_0x9672('0x43')]=_['keys'](db['User'][_0x9672('0x3f')]);_0x44fe0f[_0x9672('0x44')]=_[_0x9672('0x56')](_0x209e3e[_0x9672('0x44')]);_0x44fe0f[_0x9672('0x45')]=_[_0x9672('0x47')](_0x44fe0f[_0x9672('0x43')],_0x44fe0f[_0x9672('0x44')]);_0x20607a[_0x9672('0x46')]=_[_0x9672('0x47')](_0x44fe0f[_0x9672('0x43')],qs[_0x9672('0x48')](_0x209e3e['query'][_0x9672('0x48')]));_0x20607a[_0x9672('0x46')]=_0x20607a[_0x9672('0x46')][_0x9672('0x57')]?_0x20607a[_0x9672('0x46')]:_0x44fe0f['model'];_0x20607a[_0x9672('0x4b')]=qs[_0x9672('0x4c')](_0x209e3e[_0x9672('0x44')][_0x9672('0x4c')]);_0x20607a[_0x9672('0x4e')]=qs[_0x9672('0x45')](_['pick'](_0x209e3e[_0x9672('0x44')],_0x44fe0f[_0x9672('0x45')]));if(_0x209e3e[_0x9672('0x44')][_0x9672('0x4d')]){_0x20607a[_0x9672('0x4e')]=_[_0x9672('0x4f')](_0x20607a[_0x9672('0x4e')],{'$or':_[_0x9672('0x3d')](_0x20607a[_0x9672('0x46')],function(_0x2854c3){var _0x44ca6d={};_0x44ca6d[_0x2854c3]={'$like':'%'+_0x209e3e[_0x9672('0x44')][_0x9672('0x4d')]+'%'};return _0x44ca6d;})});}_0x20607a=_[_0x9672('0x4f')]({},_0x20607a,_0x209e3e[_0x9672('0x50')]);return _0x5aee2d[_0x9672('0x64')](_0x20607a);}})['then'](function(_0x55fae5){if(_0x55fae5){_0xf6e5d2=_0x55fae5['length'];if(!_0x209e3e[_0x9672('0x44')]['hasOwnProperty']('nolimit')){_0x20607a[_0x9672('0x30')]=qs[_0x9672('0x30')](_0x209e3e[_0x9672('0x44')][_0x9672('0x30')]);_0x20607a[_0x9672('0x2f')]=qs[_0x9672('0x2f')](_0x209e3e[_0x9672('0x44')][_0x9672('0x2f')]);}return _0x5aee2d[_0x9672('0x64')](_0x20607a);}})['then'](function(_0x44c68c){if(_0x44c68c){return _0x44c68c?{'count':_0xf6e5d2,'rows':_0x44c68c}:null;}})[_0x9672('0x36')](respondWithResult(_0x1a56ca,null))[_0x9672('0x2a')](handleError(_0x1a56ca,null));};exports[_0x9672('0x65')]=function(_0x4ff11c,_0x494a3d,_0x4d0a05){return db[_0x9672('0x3e')][_0x9672('0x5b')]({'where':{'id':_0x4ff11c[_0x9672('0x55')]['id']}})['then'](handleEntityNotFound(_0x494a3d,null))[_0x9672('0x36')](function(_0x19df98){if(_0x19df98){return _0x19df98['removeMembers'](_0x4ff11c['query'][_0x9672('0x61')]);}})[_0x9672('0x36')](respondWithStatusCode(_0x494a3d,null))['catch'](handleError(_0x494a3d,null));};exports[_0x9672('0x66')]=function(_0x4a37f8,_0x55dcb9,_0x44b4bb){if(_0x4a37f8[_0x9672('0x5a')]['id']){delete _0x4a37f8['body']['id'];}return db['ChatGroup'][_0x9672('0x5b')]({'where':{'id':_0x4a37f8[_0x9672('0x55')]['id']}})[_0x9672('0x36')](handleEntityNotFound(_0x55dcb9,null))[_0x9672('0x36')](function(_0x34ef24){if(_0x34ef24){_0x4a37f8['body']['ChatGroupId']=_0x34ef24['id'];return db['ChatInternalMessage'][_0x9672('0x59')](_0x4a37f8['body']);}})[_0x9672('0x36')](respondWithResult(_0x55dcb9,null))[_0x9672('0x2a')](handleError(_0x55dcb9,null));};exports[_0x9672('0x67')]=function(_0x2dca28,_0x3a4af5,_0x3ad3e1){var _0x26dc58={};var _0x1ca11b={};var _0x530876;var _0x2b250d;return db['ChatGroup']['findOne']({'where':{'id':_0x2dca28['params']['id']}})[_0x9672('0x36')](handleEntityNotFound(_0x3a4af5,null))[_0x9672('0x36')](function(_0x2c77fb){if(_0x2c77fb){_0x530876=_0x2c77fb;_0x1ca11b[_0x9672('0x43')]=_[_0x9672('0x56')](db[_0x9672('0x5d')][_0x9672('0x3f')]);_0x1ca11b[_0x9672('0x44')]=_['keys'](_0x2dca28[_0x9672('0x44')]);_0x1ca11b[_0x9672('0x45')]=_['intersection'](_0x1ca11b[_0x9672('0x43')],_0x1ca11b['query']);_0x26dc58[_0x9672('0x46')]=_[_0x9672('0x47')](_0x1ca11b[_0x9672('0x43')],qs['fields'](_0x2dca28[_0x9672('0x44')]['fields']));_0x26dc58['attributes']=_0x26dc58[_0x9672('0x46')]['length']?_0x26dc58[_0x9672('0x46')]:_0x1ca11b[_0x9672('0x43')];_0x26dc58[_0x9672('0x4b')]=qs[_0x9672('0x4c')](_0x2dca28[_0x9672('0x44')][_0x9672('0x4c')]);_0x26dc58[_0x9672('0x4e')]=qs[_0x9672('0x45')](_['pick'](_0x2dca28['query'],_0x1ca11b[_0x9672('0x45')]));if(_0x2dca28['query'][_0x9672('0x4d')]){_0x26dc58[_0x9672('0x4e')]=_[_0x9672('0x4f')](_0x26dc58['where'],{'$or':_['map'](_0x26dc58[_0x9672('0x46')],function(_0x14a49){var _0x573897={};_0x573897[_0x14a49]={'$like':'%'+_0x2dca28[_0x9672('0x44')][_0x9672('0x4d')]+'%'};return _0x573897;})});}if(_0x2dca28[_0x9672('0x44')]['$gte']){var _0x1e7490=_0x2dca28[_0x9672('0x44')]['$gte']['split'](',');var _0x6a918={};_0x6a918[_0x1e7490[0x0]]={'$gte':moment(_0x1e7490[0x1])[_0x9672('0x68')](_0x9672('0x69'))};_0x26dc58[_0x9672('0x4e')]=_['merge'](_0x26dc58['where'],_0x6a918);}_0x26dc58=_['merge']({},_0x26dc58,_0x2dca28[_0x9672('0x50')]);return _0x530876[_0x9672('0x67')](_0x26dc58);}})[_0x9672('0x36')](function(_0x4044cc){if(_0x4044cc){_0x2b250d=_0x4044cc[_0x9672('0x57')];if(!_0x2dca28[_0x9672('0x44')][_0x9672('0x49')](_0x9672('0x4a'))){_0x26dc58[_0x9672('0x30')]=qs['limit'](_0x2dca28[_0x9672('0x44')][_0x9672('0x30')]);_0x26dc58[_0x9672('0x2f')]=qs[_0x9672('0x2f')](_0x2dca28[_0x9672('0x44')][_0x9672('0x2f')]);}return _0x530876[_0x9672('0x67')](_0x26dc58);}})[_0x9672('0x36')](function(_0x1c0e0b){if(_0x1c0e0b){return _0x1c0e0b?{'count':_0x2b250d,'rows':_0x1c0e0b}:null;}})[_0x9672('0x36')](respondWithResult(_0x3a4af5,null))[_0x9672('0x2a')](handleError(_0x3a4af5,null));}; \ No newline at end of file +var _0x5107=['name','index','map','ChatGroup','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','create','body','find','destroy','describe','ChatInternalMessage','count','toInteger','omit','ids','findOne','User','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./chatGroup.socket','register','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','update','stack'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x5107,0x170));var _0x7510=function(_0x10f967,_0x28917b){_0x10f967=_0x10f967-0x0;var _0x4022e1=_0x5107[_0x10f967];return _0x4022e1;};'use strict';var pdf=require(_0x7510('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7510('0x1'));var jsonpatch=require(_0x7510('0x2'));var rp=require(_0x7510('0x3'));var moment=require(_0x7510('0x4'));var BPromise=require(_0x7510('0x5'));var Mustache=require(_0x7510('0x6'));var util=require(_0x7510('0x7'));var path=require(_0x7510('0x8'));var sox=require(_0x7510('0x9'));var csv=require(_0x7510('0xa'));var ejs=require(_0x7510('0xb'));var fs=require('fs');var _=require(_0x7510('0xc'));var squel=require(_0x7510('0xd'));var crypto=require(_0x7510('0xe'));var jsforce=require(_0x7510('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7510('0xa'));var querystring=require('querystring');var Papa=require(_0x7510('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7510('0x11'));var as=require(_0x7510('0x12'));var hardwareService=require(_0x7510('0x13'));var logger=require(_0x7510('0x14'))('api');var utils=require(_0x7510('0x15'));var config=require(_0x7510('0x16'));var db=require(_0x7510('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x7510('0x18'),'port':0x18eb});var socket=require(_0x7510('0x19'))(new Redis(config[_0x7510('0x1a')]));require(_0x7510('0x1b'))[_0x7510('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7510('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x3c0122,_0x1b1ab8,_0x186c75){if(_0x186c75){var _0x185496=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x185496['test'](_0x1b1ab8)){return _0x3c0122;}else{throw new db['Sequelize'][(_0x7510('0x1e'))](_0x7510('0x1f'));}}else{return _0x3c0122;}}function respondWithRpcPromise(_0x45fef5,_0x568caf,_0x3ae05c,_0x2af845){return new BPromise(function(_0x2e5aeb,_0x32e146){var _0x25096b=_0x2af845||client;return _0x25096b[_0x7510('0x20')](_0x45fef5,_0x3ae05c)[_0x7510('0x21')](function(_0x289547){logger[_0x7510('0x22')](_0x7510('0x23'),_0x568caf,'request\x20sent');logger[_0x7510('0x24')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x568caf,_0x7510('0x25'),JSON[_0x7510('0x26')](_0x289547));if(_0x289547[_0x7510('0x27')]){if(_0x289547[_0x7510('0x27')][_0x7510('0x28')]===0x1f4){logger[_0x7510('0x27')]('ChatGroup,\x20%s,\x20%s',_0x568caf,_0x289547[_0x7510('0x27')][_0x7510('0x29')]);return _0x32e146(_0x289547[_0x7510('0x27')][_0x7510('0x29')]);}logger[_0x7510('0x27')](_0x7510('0x23'),_0x568caf,_0x289547[_0x7510('0x27')][_0x7510('0x29')]);return _0x2e5aeb(_0x289547[_0x7510('0x27')]['message']);}else{logger[_0x7510('0x22')](_0x7510('0x23'),_0x568caf,_0x7510('0x25'));_0x2e5aeb(_0x289547[_0x7510('0x2a')][_0x7510('0x29')]);}})[_0x7510('0x2b')](function(_0x54b760){logger[_0x7510('0x27')](_0x7510('0x23'),_0x568caf,_0x54b760);_0x32e146(_0x54b760);});});}function respondWithStatusCode(_0x3e7c52,_0x567bf6){_0x567bf6=_0x567bf6||0xcc;return function(_0x56be33){if(_0x56be33){return _0x3e7c52[_0x7510('0x2c')](_0x567bf6);}return _0x3e7c52[_0x7510('0x2d')](_0x567bf6)[_0x7510('0x2e')]();};}function respondWithResult(_0x3b54e6,_0x18582c){_0x18582c=_0x18582c||0xc8;return function(_0x381131){if(_0x381131){return _0x3b54e6[_0x7510('0x2d')](_0x18582c)['json'](_0x381131);}};}function respondWithFilteredResult(_0x49ae98,_0x59bed2){return function(_0x3ef9b6){if(_0x3ef9b6){var _0x3a321b=_0x3ef9b6['count'],_0x9b6d1=_0x59bed2['offset'],_0x34bb3e=_0x59bed2[_0x7510('0x2f')]+_0x59bed2[_0x7510('0x30')],_0x1b5f9b;if(_0x34bb3e>=_0x3a321b){_0x34bb3e=_0x3a321b;_0x1b5f9b=0xc8;}else{_0x1b5f9b=0xce;}_0x49ae98[_0x7510('0x2d')](_0x1b5f9b);return _0x49ae98[_0x7510('0x31')](_0x7510('0x32'),_0x9b6d1+'-'+_0x34bb3e+'/'+_0x3a321b)[_0x7510('0x33')](_0x3ef9b6);}return null;};}function patchUpdates(_0x70c9){return function(_0x14f4b0){try{jsonpatch[_0x7510('0x34')](_0x14f4b0,_0x70c9,!![]);}catch(_0x2ef167){return BPromise[_0x7510('0x35')](_0x2ef167);}return _0x14f4b0['save']();};}function saveUpdates(_0x19960f,_0x2f78f2){return function(_0x157029){if(_0x157029){return _0x157029[_0x7510('0x36')](_0x19960f)[_0x7510('0x21')](function(_0x437016){return _0x437016;});}return null;};}function removeEntity(_0x196cb1,_0x5857a1){return function(_0x208be9){if(_0x208be9){return _0x208be9['destroy']()[_0x7510('0x21')](function(){_0x196cb1[_0x7510('0x2d')](0xcc)[_0x7510('0x2e')]();});}};}function handleEntityNotFound(_0x21522e,_0x1f1c2b){return function(_0x1d9729){if(!_0x1d9729){_0x21522e[_0x7510('0x2c')](0x194);}return _0x1d9729;};}function handleError(_0x11abd0,_0x1856de){_0x1856de=_0x1856de||0x1f4;return function(_0xda2e21){logger[_0x7510('0x27')](_0xda2e21[_0x7510('0x37')]);if(_0xda2e21[_0x7510('0x38')]){delete _0xda2e21['name'];}_0x11abd0['status'](_0x1856de)['send'](_0xda2e21);};}exports[_0x7510('0x39')]=function(_0xbb0ad3,_0x36b2b6){var _0x3342d5={},_0x3ee27a={},_0xbdc8ab={'count':0x0,'rows':[]};var _0x5ef298=_[_0x7510('0x3a')](db[_0x7510('0x3b')][_0x7510('0x3c')],function(_0x217372){return{'name':_0x217372[_0x7510('0x3d')],'type':_0x217372['type'][_0x7510('0x3e')]};});_0x3ee27a['model']=_['map'](_0x5ef298,_0x7510('0x38'));_0x3ee27a[_0x7510('0x3f')]=_['keys'](_0xbb0ad3['query']);_0x3ee27a[_0x7510('0x40')]=_['intersection'](_0x3ee27a[_0x7510('0x41')],_0x3ee27a[_0x7510('0x3f')]);_0x3342d5[_0x7510('0x42')]=_[_0x7510('0x43')](_0x3ee27a[_0x7510('0x41')],qs['fields'](_0xbb0ad3[_0x7510('0x3f')][_0x7510('0x44')]));_0x3342d5[_0x7510('0x42')]=_0x3342d5[_0x7510('0x42')][_0x7510('0x45')]?_0x3342d5['attributes']:_0x3ee27a[_0x7510('0x41')];if(!_0xbb0ad3['query'][_0x7510('0x46')](_0x7510('0x47'))){_0x3342d5['limit']=qs[_0x7510('0x30')](_0xbb0ad3[_0x7510('0x3f')][_0x7510('0x30')]);_0x3342d5[_0x7510('0x2f')]=qs[_0x7510('0x2f')](_0xbb0ad3['query'][_0x7510('0x2f')]);}_0x3342d5[_0x7510('0x48')]=qs['sort'](_0xbb0ad3[_0x7510('0x3f')][_0x7510('0x49')]);_0x3342d5[_0x7510('0x4a')]=qs[_0x7510('0x40')](_[_0x7510('0x4b')](_0xbb0ad3[_0x7510('0x3f')],_0x3ee27a['filters']),_0x5ef298);if(_0xbb0ad3[_0x7510('0x3f')][_0x7510('0x4c')]){_0x3342d5[_0x7510('0x4a')]=_['merge'](_0x3342d5['where'],{'$or':_['map'](_0x5ef298,function(_0x174a0a){if(_0x174a0a['type']!==_0x7510('0x4d')){var _0x808969={};_0x808969[_0x174a0a[_0x7510('0x38')]]={'$like':'%'+_0xbb0ad3['query'][_0x7510('0x4c')]+'%'};return _0x808969;}})});}_0x3342d5=_[_0x7510('0x4e')]({},_0x3342d5,_0xbb0ad3[_0x7510('0x4f')]);var _0x26b1e1={'where':_0x3342d5['where']};return db[_0x7510('0x3b')]['count'](_0x26b1e1)[_0x7510('0x21')](function(_0xc749e3){_0xbdc8ab['count']=_0xc749e3;if(_0xbb0ad3[_0x7510('0x3f')][_0x7510('0x50')]){_0x3342d5[_0x7510('0x51')]=[{'all':!![]}];}return db[_0x7510('0x3b')][_0x7510('0x52')](_0x3342d5);})[_0x7510('0x21')](function(_0x45cf9f){_0xbdc8ab['rows']=_0x45cf9f;return _0xbdc8ab;})[_0x7510('0x21')](respondWithFilteredResult(_0x36b2b6,_0x3342d5))[_0x7510('0x2b')](handleError(_0x36b2b6,null));};exports[_0x7510('0x53')]=function(_0x29f49c,_0x1b4c0b){var _0x1282ca={'raw':!![],'where':{'id':_0x29f49c[_0x7510('0x54')]['id']}},_0x19f14f={};_0x19f14f[_0x7510('0x41')]=_[_0x7510('0x55')](db[_0x7510('0x3b')][_0x7510('0x3c')]);_0x19f14f[_0x7510('0x3f')]=_[_0x7510('0x55')](_0x29f49c[_0x7510('0x3f')]);_0x19f14f[_0x7510('0x40')]=_[_0x7510('0x43')](_0x19f14f['model'],_0x19f14f[_0x7510('0x3f')]);_0x1282ca[_0x7510('0x42')]=_[_0x7510('0x43')](_0x19f14f['model'],qs[_0x7510('0x44')](_0x29f49c['query'][_0x7510('0x44')]));_0x1282ca[_0x7510('0x42')]=_0x1282ca[_0x7510('0x42')][_0x7510('0x45')]?_0x1282ca[_0x7510('0x42')]:_0x19f14f[_0x7510('0x41')];if(_0x29f49c['query']['includeAll']){_0x1282ca[_0x7510('0x51')]=[{'all':!![]}];}_0x1282ca=_[_0x7510('0x4e')]({},_0x1282ca,_0x29f49c[_0x7510('0x4f')]);return db[_0x7510('0x3b')]['find'](_0x1282ca)[_0x7510('0x21')](handleEntityNotFound(_0x1b4c0b,null))[_0x7510('0x21')](respondWithResult(_0x1b4c0b,null))[_0x7510('0x2b')](handleError(_0x1b4c0b,null));};exports['create']=function(_0x10837f,_0x5310c0){return db[_0x7510('0x3b')][_0x7510('0x56')](_0x10837f[_0x7510('0x57')],{})[_0x7510('0x21')](respondWithResult(_0x5310c0,0xc9))[_0x7510('0x2b')](handleError(_0x5310c0,null));};exports[_0x7510('0x36')]=function(_0x5e2c05,_0x3190ab){if(_0x5e2c05[_0x7510('0x57')]['id']){delete _0x5e2c05['body']['id'];}return db[_0x7510('0x3b')][_0x7510('0x58')]({'where':{'id':_0x5e2c05[_0x7510('0x54')]['id']}})[_0x7510('0x21')](handleEntityNotFound(_0x3190ab,null))['then'](saveUpdates(_0x5e2c05['body'],null))[_0x7510('0x21')](respondWithResult(_0x3190ab,null))[_0x7510('0x2b')](handleError(_0x3190ab,null));};exports[_0x7510('0x59')]=function(_0x3482ad,_0xd61358){return db[_0x7510('0x3b')]['find']({'where':{'id':_0x3482ad[_0x7510('0x54')]['id']}})[_0x7510('0x21')](handleEntityNotFound(_0xd61358,null))['then'](removeEntity(_0xd61358,null))[_0x7510('0x2b')](handleError(_0xd61358,null));};exports[_0x7510('0x5a')]=function(_0x4aa298,_0x4e12de){return db[_0x7510('0x3b')][_0x7510('0x5a')]()[_0x7510('0x21')](respondWithResult(_0x4e12de,null))[_0x7510('0x2b')](handleError(_0x4e12de,null));};exports['getUnread']=function(_0x3bec0a,_0x342f1c,_0x4381d0){return db[_0x7510('0x5b')][_0x7510('0x5c')]({'where':{'ChatGroupId':_0x3bec0a[_0x7510('0x54')]['id'],'ToId':_0x3bec0a['user']['id'],'read':![]}})[_0x7510('0x21')](function(_0x4f490a){return{'id':_[_0x7510('0x5d')](_0x3bec0a[_0x7510('0x54')]['id']),'count':_0x4f490a};})[_0x7510('0x21')](respondWithResult(_0x342f1c,null))['catch'](handleError(_0x342f1c,null));};exports['addMembers']=function(_0x300ad7,_0x38895f,_0x592f09){return db[_0x7510('0x3b')]['find']({'where':{'id':_0x300ad7['params']['id']}})[_0x7510('0x21')](handleEntityNotFound(_0x38895f,null))[_0x7510('0x21')](function(_0xc868a3){if(_0xc868a3){return _0xc868a3['addMembers'](_0x300ad7['body']['ids'],_[_0x7510('0x5e')](_0x300ad7['body'],[_0x7510('0x5f'),'id'])||{});}})[_0x7510('0x21')](respondWithResult(_0x38895f,null))[_0x7510('0x2b')](handleError(_0x38895f,null));};exports['getMembers']=function(_0x4d4e8a,_0x3f3c7c,_0x203e97){var _0x94a10d={};var _0x242e7c={};var _0x20ee28;var _0x4e009f;return db[_0x7510('0x3b')][_0x7510('0x60')]({'where':{'id':_0x4d4e8a[_0x7510('0x54')]['id']}})['then'](handleEntityNotFound(_0x3f3c7c,null))[_0x7510('0x21')](function(_0x21a347){if(_0x21a347){_0x20ee28=_0x21a347;_0x242e7c[_0x7510('0x41')]=_[_0x7510('0x55')](db[_0x7510('0x61')][_0x7510('0x3c')]);_0x242e7c[_0x7510('0x3f')]=_[_0x7510('0x55')](_0x4d4e8a[_0x7510('0x3f')]);_0x242e7c['filters']=_[_0x7510('0x43')](_0x242e7c[_0x7510('0x41')],_0x242e7c['query']);_0x94a10d[_0x7510('0x42')]=_['intersection'](_0x242e7c['model'],qs[_0x7510('0x44')](_0x4d4e8a[_0x7510('0x3f')][_0x7510('0x44')]));_0x94a10d[_0x7510('0x42')]=_0x94a10d['attributes']['length']?_0x94a10d[_0x7510('0x42')]:_0x242e7c[_0x7510('0x41')];_0x94a10d['order']=qs[_0x7510('0x49')](_0x4d4e8a[_0x7510('0x3f')][_0x7510('0x49')]);_0x94a10d[_0x7510('0x4a')]=qs[_0x7510('0x40')](_[_0x7510('0x4b')](_0x4d4e8a[_0x7510('0x3f')],_0x242e7c[_0x7510('0x40')]));if(_0x4d4e8a[_0x7510('0x3f')]['filter']){_0x94a10d[_0x7510('0x4a')]=_['merge'](_0x94a10d[_0x7510('0x4a')],{'$or':_[_0x7510('0x3a')](_0x94a10d[_0x7510('0x42')],function(_0x235202){var _0x5cc36b={};_0x5cc36b[_0x235202]={'$like':'%'+_0x4d4e8a[_0x7510('0x3f')][_0x7510('0x4c')]+'%'};return _0x5cc36b;})});}_0x94a10d=_[_0x7510('0x4e')]({},_0x94a10d,_0x4d4e8a[_0x7510('0x4f')]);return _0x20ee28[_0x7510('0x62')](_0x94a10d);}})['then'](function(_0x3786f9){if(_0x3786f9){_0x4e009f=_0x3786f9[_0x7510('0x45')];if(!_0x4d4e8a[_0x7510('0x3f')]['hasOwnProperty'](_0x7510('0x47'))){_0x94a10d[_0x7510('0x30')]=qs['limit'](_0x4d4e8a[_0x7510('0x3f')][_0x7510('0x30')]);_0x94a10d['offset']=qs['offset'](_0x4d4e8a[_0x7510('0x3f')][_0x7510('0x2f')]);}return _0x20ee28['getMembers'](_0x94a10d);}})[_0x7510('0x21')](function(_0x52b028){if(_0x52b028){return _0x52b028?{'count':_0x4e009f,'rows':_0x52b028}:null;}})[_0x7510('0x21')](respondWithResult(_0x3f3c7c,null))['catch'](handleError(_0x3f3c7c,null));};exports[_0x7510('0x63')]=function(_0x253927,_0x273922,_0x5a7135){return db[_0x7510('0x3b')]['find']({'where':{'id':_0x253927['params']['id']}})[_0x7510('0x21')](handleEntityNotFound(_0x273922,null))[_0x7510('0x21')](function(_0x382c8e){if(_0x382c8e){return _0x382c8e[_0x7510('0x63')](_0x253927[_0x7510('0x3f')][_0x7510('0x5f')]);}})[_0x7510('0x21')](respondWithStatusCode(_0x273922,null))[_0x7510('0x2b')](handleError(_0x273922,null));};exports[_0x7510('0x64')]=function(_0x5b9537,_0x1335d4,_0x17c2d0){if(_0x5b9537[_0x7510('0x57')]['id']){delete _0x5b9537[_0x7510('0x57')]['id'];}return db[_0x7510('0x3b')][_0x7510('0x58')]({'where':{'id':_0x5b9537['params']['id']}})[_0x7510('0x21')](handleEntityNotFound(_0x1335d4,null))[_0x7510('0x21')](function(_0x1494d2){if(_0x1494d2){_0x5b9537['body'][_0x7510('0x65')]=_0x1494d2['id'];return db[_0x7510('0x5b')][_0x7510('0x56')](_0x5b9537[_0x7510('0x57')]);}})[_0x7510('0x21')](respondWithResult(_0x1335d4,null))[_0x7510('0x2b')](handleError(_0x1335d4,null));};exports[_0x7510('0x66')]=function(_0x4a8f0c,_0x3a1ea2,_0x2a5f98){var _0x5bed96={};var _0x504d9a={};var _0x23ed70;var _0x3c10a5;return db[_0x7510('0x3b')]['findOne']({'where':{'id':_0x4a8f0c[_0x7510('0x54')]['id']}})['then'](handleEntityNotFound(_0x3a1ea2,null))[_0x7510('0x21')](function(_0x53c484){if(_0x53c484){_0x23ed70=_0x53c484;_0x504d9a[_0x7510('0x41')]=_[_0x7510('0x55')](db[_0x7510('0x5b')][_0x7510('0x3c')]);_0x504d9a[_0x7510('0x3f')]=_[_0x7510('0x55')](_0x4a8f0c[_0x7510('0x3f')]);_0x504d9a['filters']=_[_0x7510('0x43')](_0x504d9a[_0x7510('0x41')],_0x504d9a[_0x7510('0x3f')]);_0x5bed96[_0x7510('0x42')]=_[_0x7510('0x43')](_0x504d9a['model'],qs[_0x7510('0x44')](_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x44')]));_0x5bed96[_0x7510('0x42')]=_0x5bed96[_0x7510('0x42')]['length']?_0x5bed96[_0x7510('0x42')]:_0x504d9a[_0x7510('0x41')];_0x5bed96['order']=qs[_0x7510('0x49')](_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x49')]);_0x5bed96[_0x7510('0x4a')]=qs['filters'](_['pick'](_0x4a8f0c[_0x7510('0x3f')],_0x504d9a['filters']));if(_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x4c')]){_0x5bed96['where']=_[_0x7510('0x4e')](_0x5bed96[_0x7510('0x4a')],{'$or':_[_0x7510('0x3a')](_0x5bed96[_0x7510('0x42')],function(_0x5104ca){var _0x5a110d={};_0x5a110d[_0x5104ca]={'$like':'%'+_0x4a8f0c[_0x7510('0x3f')]['filter']+'%'};return _0x5a110d;})});}if(_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x67')]){var _0x511f9a=_0x4a8f0c['query']['$gte'][_0x7510('0x68')](',');var _0x5a5f4c={};_0x5a5f4c[_0x511f9a[0x0]]={'$gte':moment(_0x511f9a[0x1])['format'](_0x7510('0x69'))};_0x5bed96[_0x7510('0x4a')]=_['merge'](_0x5bed96[_0x7510('0x4a')],_0x5a5f4c);}_0x5bed96=_[_0x7510('0x4e')]({},_0x5bed96,_0x4a8f0c[_0x7510('0x4f')]);return _0x23ed70[_0x7510('0x66')](_0x5bed96);}})[_0x7510('0x21')](function(_0x35e96b){if(_0x35e96b){_0x3c10a5=_0x35e96b[_0x7510('0x45')];if(!_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x46')](_0x7510('0x47'))){_0x5bed96[_0x7510('0x30')]=qs[_0x7510('0x30')](_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x30')]);_0x5bed96[_0x7510('0x2f')]=qs[_0x7510('0x2f')](_0x4a8f0c[_0x7510('0x3f')][_0x7510('0x2f')]);}return _0x23ed70[_0x7510('0x66')](_0x5bed96);}})[_0x7510('0x21')](function(_0x1c8671){if(_0x1c8671){return _0x1c8671?{'count':_0x3c10a5,'rows':_0x1c8671}:null;}})['then'](respondWithResult(_0x3a1ea2,null))[_0x7510('0x2b')](handleError(_0x3a1ea2,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 93f3c29..256be1d 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0xadb5,0xad));var _0x5adb=function(_0x2ca37e,_0x1cfcd3){_0x2ca37e=_0x2ca37e-0x0;var _0xdce261=_0xadb5[_0x2ca37e];return _0xdce261;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0x187645,_0x5d77ed){var _0x177b32=function(_0x15f74a){while(--_0x15f74a){_0x187645['push'](_0x187645['shift']());}};_0x177b32(++_0x5d77ed);}(_0xb10b,0x12a));var _0xbb10=function(_0xa3d9a7,_0x1cf219){_0xa3d9a7=_0xa3d9a7-0x0;var _0x48080a=_0xb10b[_0xa3d9a7];return _0x48080a;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatGroupEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatGroupEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatGroup[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index d534f59..2c81f17 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 _0x6075=['path','rimraf','../../config/environment','exports','chat_groups','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x6075,0x191));var _0x5607=function(_0x47f89e,_0x577991){_0x47f89e=_0x47f89e-0x0;var _0x57a161=_0x6075[_0x47f89e];return _0x57a161;};'use strict';var _=require('lodash');var util=require(_0x5607('0x0'));var logger=require(_0x5607('0x1'))(_0x5607('0x2'));var moment=require(_0x5607('0x3'));var BPromise=require(_0x5607('0x4'));var rp=require(_0x5607('0x5'));var fs=require('fs');var path=require(_0x5607('0x6'));var rimraf=require(_0x5607('0x7'));var config=require(_0x5607('0x8'));var attributes=require('./chatGroup.attributes');module[_0x5607('0x9')]=function(_0xabf691,_0x14b9f4){return _0xabf691['define']('ChatGroup',attributes,{'tableName':_0x5607('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc03e=['rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','lodash','api','bluebird','path'];(function(_0x2ad406,_0x46ed34){var _0x254fcf=function(_0xcedceb){while(--_0xcedceb){_0x2ad406['push'](_0x2ad406['shift']());}};_0x254fcf(++_0x46ed34);}(_0xc03e,0x15a));var _0xec03=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xc03e[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec03('0x1'));var moment=require('moment');var BPromise=require(_0xec03('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec03('0x3'));var rimraf=require(_0xec03('0x4'));var config=require(_0xec03('0x5'));var attributes=require(_0xec03('0x6'));module[_0xec03('0x7')]=function(_0x1ce78a,_0x31db21){return _0x1ce78a[_0xec03('0x8')](_0xec03('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 709beb8..4ad4641 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 _0xb498=['defaults','localhost','socket.io-emitter','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','http','redis'];(function(_0x1866ae,_0x21b0ac){var _0x4ec0f4=function(_0x4b4a5f){while(--_0x4b4a5f){_0x1866ae['push'](_0x1866ae['shift']());}};_0x4ec0f4(++_0x21b0ac);}(_0xb498,0x6f));var _0x8b49=function(_0x60aa22,_0x358f6a){_0x60aa22=_0x60aa22-0x0;var _0x3b1bc=_0xb498[_0x60aa22];return _0x3b1bc;};'use strict';var _=require(_0x8b49('0x0'));var util=require(_0x8b49('0x1'));var moment=require(_0x8b49('0x2'));var BPromise=require(_0x8b49('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b49('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8b49('0x5'));var jayson=require(_0x8b49('0x6'));var client=jayson['client'][_0x8b49('0x7')]({'port':0x232a});config[_0x8b49('0x8')]=_[_0x8b49('0x9')](config[_0x8b49('0x8')],{'host':_0x8b49('0xa'),'port':0x18eb});var socket=require(_0x8b49('0xb'))(new Redis(config[_0x8b49('0x8')]));require(_0x8b49('0xc'))['register'](socket);function respondWithRpcPromise(_0x47d4e9,_0x1d9814,_0x3fadae){return new BPromise(function(_0x285b8c,_0x1373a6){return client[_0x8b49('0xd')](_0x47d4e9,_0x3fadae)['then'](function(_0x33a353){logger[_0x8b49('0xe')](_0x8b49('0xf'),_0x1d9814,_0x8b49('0x10'));logger[_0x8b49('0x11')](_0x8b49('0x12'),_0x1d9814,_0x8b49('0x10'),JSON[_0x8b49('0x13')](_0x33a353));if(_0x33a353[_0x8b49('0x14')]){if(_0x33a353[_0x8b49('0x14')]['code']===0x1f4){logger[_0x8b49('0x14')](_0x8b49('0xf'),_0x1d9814,_0x33a353[_0x8b49('0x14')]['message']);return _0x1373a6(_0x33a353[_0x8b49('0x14')][_0x8b49('0x15')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x1d9814,_0x33a353[_0x8b49('0x14')][_0x8b49('0x15')]);return _0x285b8c(_0x33a353['error']['message']);}else{logger['info'](_0x8b49('0xf'),_0x1d9814,_0x8b49('0x10'));_0x285b8c(_0x33a353[_0x8b49('0x16')][_0x8b49('0x15')]);}})[_0x8b49('0x17')](function(_0x231423){logger['error'](_0x8b49('0xf'),_0x1d9814,_0x231423);_0x1373a6(_0x231423);});});} \ No newline at end of file +var _0x1106=['defaults','localhost','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','client','http','redis'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x1106,0x1b0));var _0x6110=function(_0x1ebb6f,_0x3c28bb){_0x1ebb6f=_0x1ebb6f-0x0;var _0x99ca75=_0x1106[_0x1ebb6f];return _0x99ca75;};'use strict';var _=require(_0x6110('0x0'));var util=require(_0x6110('0x1'));var moment=require(_0x6110('0x2'));var BPromise=require(_0x6110('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6110('0x4'));var logger=require(_0x6110('0x5'))('rpc');var config=require(_0x6110('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6110('0x7')][_0x6110('0x8')]({'port':0x232a});config[_0x6110('0x9')]=_[_0x6110('0xa')](config[_0x6110('0x9')],{'host':_0x6110('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6110('0xc'))[_0x6110('0xd')](socket);function respondWithRpcPromise(_0x59df67,_0x400ecb,_0x19bc07){return new BPromise(function(_0x140f6e,_0xa08c05){return client[_0x6110('0xe')](_0x59df67,_0x19bc07)[_0x6110('0xf')](function(_0x3e3157){logger['info'](_0x6110('0x10'),_0x400ecb,'request\x20sent');logger['debug'](_0x6110('0x11'),_0x400ecb,_0x6110('0x12'),JSON[_0x6110('0x13')](_0x3e3157));if(_0x3e3157[_0x6110('0x14')]){if(_0x3e3157[_0x6110('0x14')][_0x6110('0x15')]===0x1f4){logger['error'](_0x6110('0x10'),_0x400ecb,_0x3e3157[_0x6110('0x14')][_0x6110('0x16')]);return _0xa08c05(_0x3e3157['error'][_0x6110('0x16')]);}logger[_0x6110('0x14')](_0x6110('0x10'),_0x400ecb,_0x3e3157[_0x6110('0x14')][_0x6110('0x16')]);return _0x140f6e(_0x3e3157[_0x6110('0x14')][_0x6110('0x16')]);}else{logger[_0x6110('0x17')](_0x6110('0x10'),_0x400ecb,'request\x20sent');_0x140f6e(_0x3e3157[_0x6110('0x18')][_0x6110('0x16')]);}})[_0x6110('0x19')](function(_0x51c650){logger['error'](_0x6110('0x10'),_0x400ecb,_0x51c650);_0xa08c05(_0x51c650);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 114820d..413b165 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 _0x637d=['chatGroup:','./chatGroup.events','save','update','emit'];(function(_0xbb5c26,_0xa31f41){var _0x5008e8=function(_0x2fac80){while(--_0x2fac80){_0xbb5c26['push'](_0xbb5c26['shift']());}};_0x5008e8(++_0xa31f41);}(_0x637d,0x141));var _0xd637=function(_0x5d5c90,_0x595ad6){_0x5d5c90=_0x5d5c90-0x0;var _0x2f7de3=_0x637d[_0x5d5c90];return _0x2f7de3;};'use strict';var ChatGroupEvents=require(_0xd637('0x0'));var events=[_0xd637('0x1'),'remove',_0xd637('0x2')];function createListener(_0x389b0b,_0x3d5830){return function(_0x116f85){_0x3d5830[_0xd637('0x3')](_0x389b0b,_0x116f85);};}function removeListener(_0x1b8ec0,_0x171099){return function(){ChatGroupEvents['removeListener'](_0x1b8ec0,_0x171099);};}exports['register']=function(_0x51bd8c){for(var _0x56191c=0x0,_0x558ca8=events['length'];_0x56191c<_0x558ca8;_0x56191c++){var _0x4f3c62=events[_0x56191c];var _0xf7c315=createListener(_0xd637('0x4')+_0x4f3c62,_0x51bd8c);ChatGroupEvents['on'](_0x4f3c62,_0xf7c315);}}; \ No newline at end of file +var _0x5565=['length','chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x470516,_0x264108){var _0xdc5aa9=function(_0x990af2){while(--_0x990af2){_0x470516['push'](_0x470516['shift']());}};_0xdc5aa9(++_0x264108);}(_0x5565,0xec));var _0x5556=function(_0x2d5c4b,_0x14ee20){_0x2d5c4b=_0x2d5c4b-0x0;var _0x1d6300=_0x5565[_0x2d5c4b];return _0x1d6300;};'use strict';var ChatGroupEvents=require(_0x5556('0x0'));var events=[_0x5556('0x1'),_0x5556('0x2'),_0x5556('0x3')];function createListener(_0x2b9d86,_0x3e5a37){return function(_0x806f34){_0x3e5a37[_0x5556('0x4')](_0x2b9d86,_0x806f34);};}function removeListener(_0x35d420,_0x495256){return function(){ChatGroupEvents[_0x5556('0x5')](_0x35d420,_0x495256);};}exports[_0x5556('0x6')]=function(_0x497696){for(var _0x14ef8a=0x0,_0x539bd1=events[_0x5556('0x7')];_0x14ef8a<_0x539bd1;_0x14ef8a++){var _0x2997b6=events[_0x14ef8a];var _0x3445ef=createListener(_0x5556('0x8')+_0x2997b6,_0x497696);ChatGroupEvents['on'](_0x2997b6,_0x3445ef);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index ac64035..ac663b7 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 _0xf066=['getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','delete','removeMembers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/unread'];(function(_0x5ad6d8,_0x5f5032){var _0x34df5b=function(_0x411f00){while(--_0x411f00){_0x5ad6d8['push'](_0x5ad6d8['shift']());}};_0x34df5b(++_0x5f5032);}(_0xf066,0xdc));var _0x6f06=function(_0x367816,_0x35633c){_0x367816=_0x367816-0x0;var _0x2cdde2=_0xf066[_0x367816];return _0x2cdde2;};'use strict';var multer=require(_0x6f06('0x0'));var util=require(_0x6f06('0x1'));var path=require(_0x6f06('0x2'));var timeout=require(_0x6f06('0x3'));var express=require(_0x6f06('0x4'));var router=express[_0x6f06('0x5')]();var auth=require(_0x6f06('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6f06('0x7'));var controller=require('./chatGroup.controller');router[_0x6f06('0x8')]('/',auth[_0x6f06('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6f06('0xa')]);router['get'](_0x6f06('0xb'),auth[_0x6f06('0x9')](),controller[_0x6f06('0xc')]);router[_0x6f06('0x8')](_0x6f06('0xd'),auth[_0x6f06('0x9')](),controller[_0x6f06('0xe')]);router[_0x6f06('0x8')](_0x6f06('0xf'),auth['isAuthenticated'](),controller[_0x6f06('0x10')]);router['get'](_0x6f06('0x11'),auth[_0x6f06('0x9')](),controller[_0x6f06('0x12')]);router[_0x6f06('0x13')]('/',auth[_0x6f06('0x9')](),controller[_0x6f06('0x14')]);router[_0x6f06('0x13')](_0x6f06('0xf'),auth[_0x6f06('0x9')](),controller[_0x6f06('0x15')]);router[_0x6f06('0x13')](_0x6f06('0x11'),auth[_0x6f06('0x9')](),controller['addMessage']);router[_0x6f06('0x16')](_0x6f06('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6f06('0xb'),auth[_0x6f06('0x9')](),controller['destroy']);router[_0x6f06('0x17')]('/:id/members',auth[_0x6f06('0x9')](),controller[_0x6f06('0x18')]);module[_0x6f06('0x19')]=router; \ No newline at end of file +var _0xfdd4=['/describe','describe','/:id','isAuthenticated','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get'];(function(_0x58ee3d,_0x3751ad){var _0xa6e391=function(_0x5c0996){while(--_0x5c0996){_0x58ee3d['push'](_0x58ee3d['shift']());}};_0xa6e391(++_0x3751ad);}(_0xfdd4,0x15f));var _0x4fdd=function(_0x35b7ba,_0x155c7f){_0x35b7ba=_0x35b7ba-0x0;var _0x25ea5e=_0xfdd4[_0x35b7ba];return _0x25ea5e;};'use strict';var multer=require(_0x4fdd('0x0'));var util=require(_0x4fdd('0x1'));var path=require(_0x4fdd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4fdd('0x3')]();var auth=require(_0x4fdd('0x4'));var interaction=require(_0x4fdd('0x5'));var config=require(_0x4fdd('0x6'));var controller=require(_0x4fdd('0x7'));router[_0x4fdd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4fdd('0x8')](_0x4fdd('0x9'),auth['isAuthenticated'](),controller[_0x4fdd('0xa')]);router[_0x4fdd('0x8')](_0x4fdd('0xb'),auth[_0x4fdd('0xc')](),controller['show']);router[_0x4fdd('0x8')]('/:id/unread',auth[_0x4fdd('0xc')](),controller[_0x4fdd('0xd')]);router['get'](_0x4fdd('0xe'),auth['isAuthenticated'](),controller[_0x4fdd('0xf')]);router[_0x4fdd('0x8')](_0x4fdd('0x10'),auth[_0x4fdd('0xc')](),controller[_0x4fdd('0x11')]);router[_0x4fdd('0x12')]('/',auth[_0x4fdd('0xc')](),controller[_0x4fdd('0x13')]);router[_0x4fdd('0x12')](_0x4fdd('0xe'),auth[_0x4fdd('0xc')](),controller[_0x4fdd('0x14')]);router[_0x4fdd('0x12')](_0x4fdd('0x10'),auth[_0x4fdd('0xc')](),controller['addMessage']);router[_0x4fdd('0x15')]('/:id',auth[_0x4fdd('0xc')](),controller['update']);router[_0x4fdd('0x16')]('/:id',auth[_0x4fdd('0xc')](),controller['destroy']);router[_0x4fdd('0x16')]('/:id/members',auth[_0x4fdd('0xc')](),controller['removeMembers']);module[_0x4fdd('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index eff0754..a1e6d9d 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 _0x4cf4=['INTEGER','ENUM','thumb','star','TEXT','STRING','DATE','out','sequelize','exports','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cf4,0x168));var _0x44cf=function(_0x4432c6,_0x156a8d){_0x4432c6=_0x4432c6-0x0;var _0x193cb7=_0x4cf4[_0x4432c6];return _0x193cb7;};'use strict';var Sequelize=require(_0x44cf('0x0'));module[_0x44cf('0x1')]={'closed':{'type':Sequelize[_0x44cf('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x44cf('0x3')]},'ratingType':{'type':Sequelize[_0x44cf('0x4')]('star',_0x44cf('0x5')),'defaultValue':_0x44cf('0x6')},'ratingMessage':{'type':Sequelize[_0x44cf('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x44cf('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x44cf('0x9')]},'disposition':{'type':Sequelize[_0x44cf('0x8')]},'note':{'type':Sequelize[_0x44cf('0x8')]},'browserName':{'type':Sequelize[_0x44cf('0x8')]},'browserVersion':{'type':Sequelize[_0x44cf('0x8')]},'osName':{'type':Sequelize[_0x44cf('0x8')]},'osVersion':{'type':Sequelize[_0x44cf('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x44cf('0x8')]},'referer':{'type':Sequelize[_0x44cf('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x44cf('0x7')]('long')},'read1stAt':{'type':Sequelize[_0x44cf('0x9')]},'lastMsgAt':{'type':Sequelize[_0x44cf('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x44cf('0x4')]('in',_0x44cf('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x44cf('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x44cf('0x7')]}}; \ No newline at end of file +var _0xed42=['long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x5b6cf1,_0x32fdcd){var _0x46278c=function(_0x53fd9b){while(--_0x53fd9b){_0x5b6cf1['push'](_0x5b6cf1['shift']());}};_0x46278c(++_0x32fdcd);}(_0xed42,0x146));var _0x2ed4=function(_0x31985d,_0x41283d){_0x31985d=_0x31985d-0x0;var _0x5b2017=_0xed42[_0x31985d];return _0x5b2017;};'use strict';var Sequelize=require(_0x2ed4('0x0'));module[_0x2ed4('0x1')]={'closed':{'type':Sequelize[_0x2ed4('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2ed4('0x3')]},'ratingType':{'type':Sequelize[_0x2ed4('0x4')](_0x2ed4('0x5'),_0x2ed4('0x6')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x2ed4('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x2ed4('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2ed4('0x9')]},'disposition':{'type':Sequelize[_0x2ed4('0x8')]},'note':{'type':Sequelize[_0x2ed4('0x8')]},'browserName':{'type':Sequelize[_0x2ed4('0x8')]},'browserVersion':{'type':Sequelize[_0x2ed4('0x8')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x2ed4('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x2ed4('0x8')]},'deviceType':{'type':Sequelize[_0x2ed4('0x8')]},'referer':{'type':Sequelize[_0x2ed4('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2ed4('0x7')](_0x2ed4('0xa'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x2ed4('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x2ed4('0x4')]('in',_0x2ed4('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2ed4('0x8')]},'customerPort':{'type':Sequelize[_0x2ed4('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x2ed4('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index cc5ef8f..7cf9860 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 _0xf61e=['abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','file','originalname','basename','filename','mimetype','Unauthorized','Attachment','attachId','download','join','root','server/files/attachments/','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','Messages','CmContact','format','agentAlias','customer','%s%d','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','fullname','addTags','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','transcript-%d-%s.zip','ChatWebsite','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\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','Owner','browserName','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','pipe','out','lastName','renderFile','downloadInteraction.html','toFile','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','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','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','send','map','TagIds','Tags','split','push','index','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','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','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','ChatInteraction','a.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','params','includeAll','include','options','create','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','user','ChatMessage','updateAttributes','customUpdate'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf61e,0x191));var _0xef61=function(_0x5a7559,_0x20cc1d){_0x5a7559=_0x5a7559-0x0;var _0x33c1e4=_0xf61e[_0x5a7559];return _0x33c1e4;};'use strict';var pdf=require(_0xef61('0x0'));var emlformat=require(_0xef61('0x1'));var rimraf=require(_0xef61('0x2'));var zipdir=require(_0xef61('0x3'));var jsonpatch=require(_0xef61('0x4'));var rp=require(_0xef61('0x5'));var moment=require(_0xef61('0x6'));var BPromise=require(_0xef61('0x7'));var Mustache=require(_0xef61('0x8'));var util=require(_0xef61('0x9'));var path=require(_0xef61('0xa'));var sox=require(_0xef61('0xb'));var csv=require('to-csv');var ejs=require(_0xef61('0xc'));var fs=require('fs');var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var db=require(_0xef61('0x1b'))['db'];config[_0xef61('0x1c')]=_[_0xef61('0x1d')](config[_0xef61('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xef61('0x1e'))(new Redis(config['redis']));require(_0xef61('0x1f'))[_0xef61('0x20')](socket);var jayson=require(_0xef61('0x21'));var client=jayson[_0xef61('0x22')]['http']({'port':0x232b});var client9004=jayson[_0xef61('0x22')][_0xef61('0x23')]({'port':0x232c});function checkPasswordPattern(_0x1224c2,_0x78ff22,_0x588a61){if(_0x588a61){var _0x66fa62=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x66fa62[_0xef61('0x24')](_0x78ff22)){return _0x1224c2;}else{throw new db['Sequelize'][(_0xef61('0x25'))](_0xef61('0x26'));}}else{return _0x1224c2;}}function respondWithRpcPromise(_0x36f558,_0x22dc1b,_0xfc36d6,_0x28315a){return new BPromise(function(_0xdd5e38,_0x55f887){var _0x39443d=_0x28315a||client;return _0x39443d[_0xef61('0x27')](_0x36f558,_0xfc36d6)['then'](function(_0xb7ba69){logger[_0xef61('0x28')](_0xef61('0x29'),_0x22dc1b,_0xef61('0x2a'));logger[_0xef61('0x2b')](_0xef61('0x2c'),_0x22dc1b,_0xef61('0x2a'),JSON['stringify'](_0xb7ba69));if(_0xb7ba69['error']){if(_0xb7ba69[_0xef61('0x2d')]['code']===0x1f4){logger[_0xef61('0x2d')]('ChatInteraction,\x20%s,\x20%s',_0x22dc1b,_0xb7ba69['error'][_0xef61('0x2e')]);return _0x55f887(_0xb7ba69['error']['message']);}logger[_0xef61('0x2d')](_0xef61('0x29'),_0x22dc1b,_0xb7ba69[_0xef61('0x2d')][_0xef61('0x2e')]);return _0xdd5e38(_0xb7ba69['error'][_0xef61('0x2e')]);}else{logger['info'](_0xef61('0x29'),_0x22dc1b,_0xef61('0x2a'));_0xdd5e38(_0xb7ba69[_0xef61('0x2f')][_0xef61('0x2e')]);}})[_0xef61('0x30')](function(_0x45ece2){logger[_0xef61('0x2d')](_0xef61('0x29'),_0x22dc1b,_0x45ece2);_0x55f887(_0x45ece2);});});}function respondWithStatusCode(_0x297df7,_0x1ee27b){_0x1ee27b=_0x1ee27b||0xcc;return function(_0x3a16ba){if(_0x3a16ba){return _0x297df7[_0xef61('0x31')](_0x1ee27b);}return _0x297df7[_0xef61('0x32')](_0x1ee27b)[_0xef61('0x33')]();};}function respondWithResult(_0x1f3572,_0x85978){_0x85978=_0x85978||0xc8;return function(_0x39c15e){if(_0x39c15e){return _0x1f3572[_0xef61('0x32')](_0x85978)[_0xef61('0x34')](_0x39c15e);}};}function respondWithFilteredResult(_0x2fe908,_0x43bc47){return function(_0x53fa3b){if(_0x53fa3b){var _0x4f35ad=_0x53fa3b[_0xef61('0x35')],_0x51d5d1=_0x43bc47['offset'],_0x38b522=_0x43bc47[_0xef61('0x36')]+_0x43bc47[_0xef61('0x37')],_0x36713e;if(_0x38b522>=_0x4f35ad){_0x38b522=_0x4f35ad;_0x36713e=0xc8;}else{_0x36713e=0xce;}_0x2fe908['status'](_0x36713e);return _0x2fe908[_0xef61('0x38')]('Content-Range',_0x51d5d1+'-'+_0x38b522+'/'+_0x4f35ad)['json'](_0x53fa3b);}return null;};}function patchUpdates(_0x307b70){return function(_0x48b6db){try{jsonpatch[_0xef61('0x39')](_0x48b6db,_0x307b70,!![]);}catch(_0x5ee9e4){return BPromise[_0xef61('0x3a')](_0x5ee9e4);}return _0x48b6db[_0xef61('0x3b')]();};}function saveUpdates(_0x23db9c,_0x14c05c){return function(_0x4378e5){if(_0x4378e5){return _0x4378e5[_0xef61('0x3c')](_0x23db9c)[_0xef61('0x3d')](function(_0x232cd8){return _0x232cd8;});}return null;};}function removeEntity(_0x1c622c,_0xb9d080){return function(_0x5f15ef){if(_0x5f15ef){return _0x5f15ef[_0xef61('0x3e')]()[_0xef61('0x3d')](function(){_0x1c622c[_0xef61('0x32')](0xcc)[_0xef61('0x33')]();});}};}function handleEntityNotFound(_0x310954,_0x534935){return function(_0x1c38dc){if(!_0x1c38dc){_0x310954[_0xef61('0x31')](0x194);}return _0x1c38dc;};}function handleError(_0x291944,_0x53bdb9){_0x53bdb9=_0x53bdb9||0x1f4;return function(_0x59b97b){logger['error'](_0x59b97b[_0xef61('0x3f')]);if(_0x59b97b['name']){delete _0x59b97b['name'];}_0x291944['status'](_0x53bdb9)[_0xef61('0x40')](_0x59b97b);};}function getInteractionUsers(_0x294063,_0x54e37a){return new BPromise(function(_0x508dc7,_0x53c9ef){try{if(_0x54e37a[_0x294063['id']]){_0x294063['Users']=_[_0xef61('0x41')](_0x54e37a[_0x294063['id']],function(_0x32ad44){return{'id':_0x32ad44['id'],'fullname':_0x32ad44['fullname']};});}}catch(_0x41aaeb){_0x53c9ef(_0x41aaeb);}_0x508dc7(_0x294063);});}function getInteractionTags(_0x12f442,_0x74ced){return new BPromise(function(_0x217f2b,_0x49e7c4){try{if(_0x12f442[_0xef61('0x42')]){_0x12f442[_0xef61('0x43')]=[];_0x12f442[_0xef61('0x42')][_0xef61('0x44')](',')['forEach'](function(_0x5f1928){_0x12f442[_0xef61('0x43')][_0xef61('0x45')](_0x74ced[_0x5f1928]);});}delete _0x12f442[_0xef61('0x42')];}catch(_0x53abdb){_0x49e7c4(_0x53abdb);}_0x217f2b(_0x12f442);});}function updateChatInteraction(_0x3eee46,_0x361705,_0x1d8a77){return new BPromise(function(_0x2a7a4d,_0x50bc00){return getInteractionUsers(_0x3eee46,_0x1d8a77)['then'](function(_0x52bbe3){return getInteractionTags(_0x52bbe3,_0x361705);})[_0xef61('0x3d')](function(_0x43b93b){_0x2a7a4d(_0x43b93b);})[_0xef61('0x30')](function(_0xe40d){_0x50bc00(_0xe40d);});});}exports[_0xef61('0x46')]=function(_0x272143,_0xc9b467){var _0x50e47f={},_0x2dbd96={},_0x2f1b49={'count':0x0,'rows':[]};var _0x20395d=_[_0xef61('0x41')](db['ChatInteraction'][_0xef61('0x47')],function(_0x4686df){return{'name':_0x4686df[_0xef61('0x48')],'type':_0x4686df[_0xef61('0x49')][_0xef61('0x4a')]};});_0x2dbd96[_0xef61('0x4b')]=_['map'](_0x20395d,_0xef61('0x4c'));_0x2dbd96[_0xef61('0x4d')]=_[_0xef61('0x4e')](_0x272143['query']);_0x2dbd96[_0xef61('0x4f')]=_[_0xef61('0x50')](_0x2dbd96[_0xef61('0x4b')],_0x2dbd96[_0xef61('0x4d')]);_0x50e47f[_0xef61('0x51')]=_[_0xef61('0x50')](_0x2dbd96['model'],qs[_0xef61('0x52')](_0x272143[_0xef61('0x4d')]['fields']));_0x50e47f[_0xef61('0x51')]=_0x50e47f[_0xef61('0x51')][_0xef61('0x53')]?_0x50e47f[_0xef61('0x51')]:_0x2dbd96['model'];if(!_0x272143[_0xef61('0x4d')][_0xef61('0x54')](_0xef61('0x55'))){_0x50e47f['limit']=qs[_0xef61('0x37')](_0x272143[_0xef61('0x4d')]['limit']);_0x50e47f[_0xef61('0x36')]=qs[_0xef61('0x36')](_0x272143[_0xef61('0x4d')][_0xef61('0x36')]);}_0x50e47f[_0xef61('0x56')]=qs[_0xef61('0x57')](_0x272143[_0xef61('0x4d')]['sort']);_0x50e47f[_0xef61('0x58')]=qs['filters'](_[_0xef61('0x59')](_0x272143[_0xef61('0x4d')],_0x2dbd96[_0xef61('0x4f')]),_0x20395d);var _0x193f46=[];var _0x20950a=squel[_0xef61('0x5a')]()[_0xef61('0x5b')]('id')[_0xef61('0x5b')](_0xef61('0x4c'))['field'](_0xef61('0x5c'))[_0xef61('0x5d')]('tools_tags');var _0x5316ac=squel[_0xef61('0x5a')]()[_0xef61('0x5b')]('u.id')[_0xef61('0x5b')]('u.fullname')[_0xef61('0x5b')](_0xef61('0x5e'))[_0xef61('0x5d')](_0xef61('0x5f'),'ui')[_0xef61('0x60')](_0xef61('0x61'),'u','u.id\x20=\x20ui.UserId');var _0x474dad=squel[_0xef61('0x5a')]()['from'](_0xef61('0x62'),'i')[_0xef61('0x60')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xef61('0x60')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xef61('0x63'),'a',_0xef61('0x64'))['left_join'](_0xef61('0x65'),'me',_0xef61('0x66'))[_0xef61('0x60')](_0xef61('0x67'),'it',_0xef61('0x68'))[_0xef61('0x60')](_0xef61('0x69'),'t',_0xef61('0x6a'));var _0x55c6f3=squel['expr']();var _0x1cb2ef=[];var _0x1a2e7e=squel[_0xef61('0x6b')]();var _0x1cc851;if(_0x272143[_0xef61('0x4d')]['search']){_0x1cc851=as[_0xef61('0x6c')](_0x272143['query']['search']);var _0x290a23=_0x1cc851[_0xef61('0x6d')];for(var _0x224f3a=0x0;_0x224f3a<_0x1cc851['conditions'][_0xef61('0x53')];_0x224f3a++){var _0x1a8f8f=_0x1cc851[_0xef61('0x6e')][_0x224f3a];var _0x824157='i';var _0x156888=_[_0xef61('0x6f')](_0x20395d,[_0xef61('0x4c'),_0x1a8f8f[_0xef61('0x5b')]]);if(!_0x156888){switch(_0x1a8f8f[_0xef61('0x5b')]){case _0xef61('0x70'):if(_0x1a8f8f['value']==0x1){_0x474dad[_0xef61('0x71')]('`'+_0x1a8f8f['field']+'`\x20=\x200');}else{_0x474dad[_0xef61('0x71')]('`'+_0x1a8f8f[_0xef61('0x5b')]+_0xef61('0x72'));}break;case _0xef61('0x73'):if(_0x1a8f8f[_0xef61('0x74')]===_0xef61('0x75')){if(_0x1a8f8f['value']['split']('\x20')[_0xef61('0x53')]>0x1){_0x55c6f3[_0x290a23](_0xef61('0x76'),qs[_0xef61('0x77')](_0x1a8f8f[_0xef61('0x78')]),null);}else{var _0x2921b9='%'+_0x1a8f8f[_0xef61('0x78')]+'%';_0x55c6f3[_0x290a23](_0xef61('0x79'),_0x2921b9,_0x2921b9,_0x2921b9);}}else{_0x156888=_[_0xef61('0x6f')](_0x20395d,[_0xef61('0x4c'),_0xef61('0x7a')]);_0x1a8f8f[_0xef61('0x5b')]='ContactId';_0x18c5fb=as[_0xef61('0x7b')](_0x824157,_0x156888[_0xef61('0x49')],_0x1a8f8f);_0x55c6f3[_0x290a23](_0x18c5fb['text'],_0x18c5fb[_0xef61('0x78')][_0xef61('0x7c')],_0x18c5fb[_0xef61('0x78')][_0xef61('0x33')]);}break;case _0xef61('0x7d'):var _0x2deefe=_0x1a8f8f[_0xef61('0x78')][_0xef61('0x44')](',')['map'](function(_0x3ecb8d){return Number(_0x3ecb8d);});_0x2deefe['forEach'](function(_0x58a059){_0x1a2e7e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58a059+',%');});_0x1cb2ef=_[_0xef61('0x7e')](_0x1cb2ef,_0x2deefe);break;case _0xef61('0x7f'):if(_0x1a8f8f[_0xef61('0x74')]==='$substring'){_0x55c6f3[_0x290a23](_0xef61('0x80'),'%'+_0x1a8f8f[_0xef61('0x78')]+'%',null);}else{_0x156888=_[_0xef61('0x6f')](_0x20395d,[_0xef61('0x4c'),_0xef61('0x81')]);_0x1a8f8f[_0xef61('0x5b')]=_0xef61('0x81');_0x18c5fb=as[_0xef61('0x7b')](_0x824157,_0x156888[_0xef61('0x49')],_0x1a8f8f);_0x55c6f3[_0x290a23](_0x18c5fb[_0xef61('0x82')],_0x18c5fb[_0xef61('0x78')][_0xef61('0x7c')],_0x18c5fb[_0xef61('0x78')][_0xef61('0x33')]);}break;case _0xef61('0x83'):_0x18c5fb=as[_0xef61('0x7b')]('me',null,_0x1a8f8f);_0x55c6f3[_0x290a23](_0x18c5fb[_0xef61('0x82')],_0x18c5fb[_0xef61('0x78')]['start'],_0x18c5fb[_0xef61('0x78')][_0xef61('0x33')]);break;}}else{var _0x18c5fb=as[_0xef61('0x7b')](_0x824157,_0x156888[_0xef61('0x49')],_0x1a8f8f);_0x55c6f3[_0x290a23](_0x18c5fb[_0xef61('0x82')],_0x18c5fb['value'][_0xef61('0x7c')],_0x18c5fb[_0xef61('0x78')]['end']);}}}else{var _0x2855a2=_(_0x272143['query'])[_0xef61('0x4e')]()[_0xef61('0x41')](function(_0x5c4000){return _[_0xef61('0x84')](_0x20395d,['name',_0x5c4000])?_0x5c4000:undefined;})[_0xef61('0x85')]()[_0xef61('0x78')]();if(!_['isEmpty'](_0x2855a2)){_0x2855a2['forEach'](function(_0x40284e){if(_0x40284e===_0xef61('0x86')){_0x474dad[_0xef61('0x58')](_0xef61('0x87'),[][_0xef61('0x88')](_0x272143['query'][_0x40284e]));}else if(_0x40284e===_0xef61('0x89')){var _0x2db1d1=JSON[_0xef61('0x8a')](_0x272143[_0xef61('0x4d')][_0x40284e])[_0xef61('0x8b')];var _0x1aa9c3=JSON['parse'](_0x272143[_0xef61('0x4d')][_0x40284e])['$lte'];_0x474dad[_0xef61('0x58')](_0xef61('0x8c'),_0x2db1d1,_0x1aa9c3);}else{if(_0x272143[_0xef61('0x4d')][_0x40284e]===_0xef61('0x8d')){_0x474dad[_0xef61('0x58')]('i.'+_0x40284e+_0xef61('0x8e'));}else{_0x474dad[_0xef61('0x58')]('i.'+_0x40284e+_0xef61('0x8f'),_0x272143[_0xef61('0x4d')][_0x40284e]);}}});}if(_0x272143[_0xef61('0x4d')][_0xef61('0x90')]){if(_0x272143[_0xef61('0x4d')][_0xef61('0x90')]==0x1){_0x474dad['having'](_0xef61('0x91'));}else{_0x474dad[_0xef61('0x71')](_0xef61('0x92'));}}if(_0x272143[_0xef61('0x4d')]['tag']){_0x1cb2ef=_[_0xef61('0x93')](_0x272143['query']['tag'])?_0x272143[_0xef61('0x4d')]['tag']:new Array(_0x272143[_0xef61('0x4d')]['tag']);_0x1cb2ef['forEach'](function(_0xab59f1){_0x1a2e7e['or'](_0xef61('0x94'),'%,'+_0xab59f1+',%');});}if(_0x272143['query'][_0xef61('0x95')]){var _0x4a2e8c=_0x272143[_0xef61('0x4d')][_0xef61('0x95')][_0xef61('0x96')]('\x5c','\x5c\x5c')[_0xef61('0x96')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xef61('0x97')](_0x4a2e8c)){_0x55c6f3['or']('i.id\x20LIKE\x20?',_0x4a2e8c+'%');}else{_0x55c6f3['or'](_0xef61('0x98'),qs[_0xef61('0x77')](_0x4a2e8c))['or'](_0xef61('0x99'),_0x4a2e8c+'%');}}}_0x474dad[_0xef61('0x58')](_0x55c6f3);_0x474dad[_0xef61('0x9a')](_0xef61('0x9b'));var _0x24f417={'type':db[_0xef61('0x9c')][_0xef61('0x9d')]['SELECT'],'raw':!![]};var _0xaa6e48=_0x474dad['clone']();_0xaa6e48[_0xef61('0x5b')](_0xef61('0x9b'));_0xaa6e48['field'](_0xef61('0x9e'),'unreadMessages');if(_0x50e47f['order']){_0x50e47f[_0xef61('0x56')][_0xef61('0x9f')](function(_0x4cdabf){_0x474dad[_0xef61('0x56')]('i.'+_0x4cdabf[0x0],_0x4cdabf[0x1]===_0xef61('0xa0')?![]:!![]);});}if(!_['isEmpty'](_0x1cb2ef)){_0x474dad[_0xef61('0x71')](_0x1a2e7e);_0xaa6e48[_0xef61('0x58')]('t.id\x20IN\x20?',_0x1cb2ef);}BPromise[_0xef61('0xa1')]()['then'](function(){if(!_0x1cc851){if(_0x272143[_0xef61('0x4d')][_0xef61('0x86')]||_0x272143[_0xef61('0x4d')][_0xef61('0xa2')])return;_0xaa6e48['where'](_0xef61('0xa3'));_0x474dad[_0xef61('0x58')](_0xef61('0xa3'));return;}return _0x272143['user'][_0xef61('0xa4')]({'attributes':['id'],'raw':!![]})[_0xef61('0x3d')](function(_0x5a4338){if(_['isEmpty'](_0x5a4338)){_0xaa6e48[_0xef61('0x58')](_0xef61('0xa5'));_0x474dad[_0xef61('0x58')](_0xef61('0xa5'));}else{_0xaa6e48[_0xef61('0x58')](_0xef61('0x87'),_[_0xef61('0x41')](_0x5a4338,'id'));_0x474dad[_0xef61('0x58')](_0xef61('0x87'),_[_0xef61('0x41')](_0x5a4338,'id'));}});})[_0xef61('0x3d')](function(){db[_0xef61('0xa6')][_0xef61('0x4d')](_0xaa6e48[_0xef61('0xa7')](),_0x24f417)[_0xef61('0x3d')](function(_0x2f5888){_0x2f1b49['count']=_0x2f5888[_0xef61('0x53')];if(_0x2f1b49[_0xef61('0x35')]===0x0)return[];return db[_0xef61('0xa6')][_0xef61('0x4d')](_0x20950a[_0xef61('0xa7')](),_0x24f417)[_0xef61('0x3d')](function(_0x29ef4b){_0x193f46=_[_0xef61('0xa8')](_0x29ef4b,'id');_0x24f417=_[_0xef61('0xa9')](_0x24f417,{'model':db[_0xef61('0xaa')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x272143[_0xef61('0x4d')][_0xef61('0x52')]){_0x50e47f['attributes'][_0xef61('0x9f')](function(_0xe465b9){_0x474dad['field']('i.'+_0xe465b9);});}else{_0x474dad[_0xef61('0x5b')](_0xef61('0x9e'),_0xef61('0x70'));_0x474dad[_0xef61('0x5b')](_0xef61('0xab'),'Account.key');_0x474dad[_0xef61('0x5b')]('a.mandatoryDisposition',_0xef61('0xac'));_0x474dad[_0xef61('0x5b')](_0xef61('0xad'));_0x474dad[_0xef61('0x5b')](_0xef61('0xae'),_0xef61('0xaf'));_0x474dad[_0xef61('0x5b')](_0xef61('0xb0'),'Contact.lastName');_0x474dad[_0xef61('0x5b')](_0xef61('0xb1'),_0xef61('0xb2'));_0x474dad[_0xef61('0x5b')](_0xef61('0xb3'),_0xef61('0xb4'));_0x474dad[_0xef61('0x5b')](_0xef61('0xb5'),_0xef61('0xb6'));_0x474dad['field'](_0xef61('0xb7'),_0xef61('0xb8'));_0x474dad[_0xef61('0x5b')](_0xef61('0xb9'),'Owner.fullname');_0x474dad['field'](_0xef61('0xba'),_0xef61('0xbb'));_0x474dad[_0xef61('0x5b')](_0xef61('0xbc'),_0xef61('0x42'));}if(_0x50e47f[_0xef61('0x37')])_0x474dad[_0xef61('0x37')](_0x50e47f['limit']);if(_0x50e47f[_0xef61('0x36')])_0x474dad[_0xef61('0x36')](_0x50e47f[_0xef61('0x36')]);return db[_0xef61('0xa6')][_0xef61('0x4d')](_0x474dad['toString'](),_0x24f417);})[_0xef61('0x3d')](function(_0x4acd84){_0x5316ac[_0xef61('0x58')](_0xef61('0xbd'),_[_0xef61('0x41')](_0x4acd84,'id'));return db[_0xef61('0xa6')][_0xef61('0x4d')](_0x5316ac[_0xef61('0xa7')](),_0x24f417)['then'](function(_0x2387b1){var _0x10e5f0=_[_0xef61('0xbe')](_0x2387b1,_0xef61('0xbf'));var _0x3b4645=[];_0x4acd84[_0xef61('0x9f')](function(_0x174dc6){_0x3b4645['push'](updateChatInteraction(_0x174dc6,_0x193f46,_0x10e5f0));});return BPromise[_0xef61('0xc0')](_0x3b4645);});});})[_0xef61('0x3d')](function(_0x86913){_0x2f1b49['rows']=_0x86913;return _0x2f1b49;})['then'](respondWithFilteredResult(_0xc9b467,_0x50e47f));})[_0xef61('0x30')](handleError(_0xc9b467,null));};exports[_0xef61('0xc1')]=function(_0x4fcd85,_0x116997){var _0x1a9418={'raw':![],'where':{'id':_0x4fcd85[_0xef61('0xc2')]['id']}},_0x30e931={};_0x30e931[_0xef61('0x4b')]=_[_0xef61('0x4e')](db[_0xef61('0xaa')][_0xef61('0x47')]);_0x30e931['query']=_[_0xef61('0x4e')](_0x4fcd85[_0xef61('0x4d')]);_0x30e931[_0xef61('0x4f')]=_[_0xef61('0x50')](_0x30e931[_0xef61('0x4b')],_0x30e931['query']);_0x1a9418[_0xef61('0x51')]=_['intersection'](_0x30e931[_0xef61('0x4b')],qs[_0xef61('0x52')](_0x4fcd85[_0xef61('0x4d')]['fields']));_0x1a9418['attributes']=_0x1a9418[_0xef61('0x51')][_0xef61('0x53')]?_0x1a9418['attributes']:_0x30e931['model'];if(_0x4fcd85[_0xef61('0x4d')][_0xef61('0xc3')]){_0x1a9418[_0xef61('0xc4')]=[{'all':!![]}];}_0x1a9418=_[_0xef61('0xa9')]({},_0x1a9418,_0x4fcd85[_0xef61('0xc5')]);return db[_0xef61('0xaa')][_0xef61('0x6f')](_0x1a9418)[_0xef61('0x3d')](handleEntityNotFound(_0x116997,null))[_0xef61('0x3d')](respondWithResult(_0x116997,null))[_0xef61('0x30')](handleError(_0x116997,null));};exports[_0xef61('0xc6')]=function(_0x49f528,_0x1e9123){return db[_0xef61('0xaa')]['create'](_0x49f528[_0xef61('0x83')],{})[_0xef61('0x3d')](respondWithResult(_0x1e9123,0xc9))[_0xef61('0x30')](handleError(_0x1e9123,null));};exports[_0xef61('0x3c')]=function(_0x139c1a,_0x3df536){if(_0x139c1a['body']['id']){delete _0x139c1a[_0xef61('0x83')]['id'];}return db[_0xef61('0xaa')][_0xef61('0x6f')]({'where':{'id':_0x139c1a[_0xef61('0xc2')]['id']}})[_0xef61('0x3d')](handleEntityNotFound(_0x3df536,null))[_0xef61('0x3d')](saveUpdates(_0x139c1a['body'],null))['then'](respondWithResult(_0x3df536,null))[_0xef61('0x30')](handleError(_0x3df536,null));};exports[_0xef61('0x3e')]=function(_0xad48e2,_0x230efd){return db[_0xef61('0xaa')][_0xef61('0x6f')]({'where':{'id':_0xad48e2[_0xef61('0xc2')]['id']}})['then'](handleEntityNotFound(_0x230efd,null))['then'](removeEntity(_0x230efd,null))[_0xef61('0x30')](handleError(_0x230efd,null));};exports[_0xef61('0xc7')]=function(_0x29d63f,_0x20d16f){return db[_0xef61('0xaa')]['describe']()[_0xef61('0x3d')](respondWithResult(_0x20d16f,null))['catch'](handleError(_0x20d16f,null));};exports[_0xef61('0xc8')]=function(_0x5b8d82,_0x42b2ae){var _0x5957b4=_0x5b8d82['params']['id'];var _0x3b3c1a;var _0x1f9210;var _0x21c701;return db[_0xef61('0xaa')][_0xef61('0xc9')]({'where':{'id':_0x5957b4}})['then'](function(_0x50058b){_0x3b3c1a=_0x50058b;return db['ChatWebsite'][_0xef61('0xc9')]({'where':{'id':_0x50058b['ChatWebsiteId']},'attributes':['id',_0xef61('0xca'),_0xef61('0xcb')],'raw':!![]});})[_0xef61('0x3d')](function(_0x33d595){if(_0x33d595&&_0x33d595[_0xef61('0xca')]&&_0x33d595[_0xef61('0xcb')]){_0x1f9210=_0x33d595;var _0x473ade={'rejectUnauthorized':![],'method':'POST','uri':_0xef61('0xcc'),'headers':{'X-APIKEY':_0x33d595['vidaooApiKey']},'body':{'name':_0xef61('0xcd')+_0x5957b4},'redirect':_0xef61('0xce'),'json':!![]};return rp(_0x473ade);}else{throw new db[(_0xef61('0x9c'))][(_0xef61('0x25'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xef61('0x3d')](function(_0x45c0f4){_0x21c701=_0x45c0f4;if(_0x21c701['id']){var _0xd85491={'body':_0x21c701['join_url'],'ChatWebsiteId':_0x1f9210['id'],'ChatInteractionId':_0x3b3c1a['id'],'direction':'out','UserId':_0x5b8d82[_0xef61('0xcf')]['id']};return db[_0xef61('0xd0')]['create'](_0xd85491,{});}else{throw new db[(_0xef61('0x9c'))][(_0xef61('0x25'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x3b3c1a[_0xef61('0xd1')]({'vidaooSessionId':_0x21c701['id']});})[_0xef61('0x3d')](respondWithResult(_0x42b2ae,null))['catch'](handleError(_0x42b2ae,null));};exports[_0xef61('0xd2')]=function(_0x5d2765,_0x101d3f){if(_0x5d2765['body']['id']){delete _0x5d2765[_0xef61('0x83')]['id'];}return db['ChatInteraction'][_0xef61('0x6f')]({'where':{'id':_0x5d2765['params']['id']}})[_0xef61('0x3d')](handleEntityNotFound(_0x101d3f,null))[_0xef61('0x3d')](saveUpdates(_0x5d2765['body'],null))[_0xef61('0x3d')](respondWithResult(_0x101d3f,null))[_0xef61('0x30')](handleError(_0x101d3f,null));};exports[_0xef61('0xd3')]=function(_0x524b9c,_0x4c63f8,_0x41592a){if(_0x524b9c[_0xef61('0x83')]['id']){delete _0x524b9c['body']['id'];}return db['ChatInteraction'][_0xef61('0x6f')]({'where':{'id':_0x524b9c[_0xef61('0xc2')]['id']}})['then'](function(_0x15aa64){if(!_0x15aa64){logger['error'](_0xef61('0xd4'),_0xef61('0xd3'),0x194,_0xef61('0xd5'));_0x4c63f8[_0xef61('0x31')](0x194);}else{if(_0x15aa64[_0xef61('0x81')]){throw new db[(_0xef61('0x9c'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x15aa64;})[_0xef61('0x3d')](function(_0x3489f1){if(_0x3489f1){return _0x3489f1[_0xef61('0x3c')]({'closed':_0x524b9c[_0xef61('0x83')][_0xef61('0xd6')],'disposition':_0x524b9c[_0xef61('0x83')][_0xef61('0xd7')]})[_0xef61('0x3d')](function(_0x5c45bd){return _0x5c45bd;});}})[_0xef61('0x3d')](function(_0x122139){return respondWithRpcPromise(_0xef61('0xd8'),_0xef61('0xd3'),_0x524b9c[_0xef61('0x83')],client9004);})[_0xef61('0x3d')](respondWithResult(_0x4c63f8,null))[_0xef61('0x30')](handleError(_0x4c63f8,null));};exports['attachmentUpload']=function(_0x68c83c,_0x2d57fd,_0x1b3118){_0x68c83c[_0xef61('0x83')][_0xef61('0x4c')]=_0x68c83c[_0xef61('0xd9')][_0xef61('0xda')];_0x68c83c['body'][_0xef61('0xdb')]=_0x68c83c[_0xef61('0xd9')][_0xef61('0xdc')];_0x68c83c[_0xef61('0x83')][_0xef61('0x49')]=_0x68c83c[_0xef61('0xd9')][_0xef61('0xdd')];return db['Attachment'][_0xef61('0xc6')](_0x68c83c[_0xef61('0x83')])['then'](respondWithResult(_0x2d57fd,0xc9))['catch'](handleError(_0x2d57fd,null));};exports['attachmentDownload']=function(_0x46e9fa,_0x268cd9,_0x40d0a){return db['ChatInteraction'][_0xef61('0xc9')]({'where':{'id':_0x46e9fa[_0xef61('0xc2')]['id']},'raw':!![]})[_0xef61('0x3d')](handleEntityNotFound(_0x268cd9,null))[_0xef61('0x3d')](function(_0x4c057a){if(_0x4c057a){if(_0x4c057a[_0xef61('0xd6')]){return _0x268cd9[_0xef61('0x32')](0x193)[_0xef61('0x34')]({'status':0x193,'message':_0xef61('0xde')});}return db[_0xef61('0xdf')]['findOne']({'where':{'id':_0x46e9fa[_0xef61('0x4d')][_0xef61('0xe0')]},'raw':!![]})[_0xef61('0x3d')](handleEntityNotFound(_0x268cd9,null));}})[_0xef61('0x3d')](function(_0x56ef){if(_0x56ef){return _0x268cd9[_0xef61('0xe1')](path[_0xef61('0xe2')](config[_0xef61('0xe3')],_0xef61('0xe4'),_0x56ef[_0xef61('0xdb')]));}})[_0xef61('0x30')](handleError(_0x268cd9,null));};exports['close']=function(_0x13d81c,_0x5a00e5){var _0x4fdf48=null;var _0x4a714f=null;var _0x5df068=null;var _0xf4b971=null;if(_0x13d81c[_0xef61('0x83')]['id']){delete _0x13d81c[_0xef61('0x83')]['id'];}if(_0x13d81c[_0xef61('0x83')][_0xef61('0xe5')]){_0xf4b971=path['join'](config['root'],_0xef61('0xe6'),util['format'](_0xef61('0xe7'),Date[_0xef61('0xe8')]()));_0x13d81c[_0xef61('0x83')]['pathTranscript']=_0xf4b971;}return db[_0xef61('0xaa')][_0xef61('0x6f')]({'where':{'id':_0x13d81c[_0xef61('0xc2')]['id']},'include':[{'model':db[_0xef61('0xd0')],'as':_0xef61('0xe9'),'include':[{'model':db[_0xef61('0x7f')],'as':'User'}]}]})[_0xef61('0x3d')](handleEntityNotFound(_0x5a00e5,null))[_0xef61('0x3d')](saveUpdates(_0x13d81c[_0xef61('0x83')],null))[_0xef61('0x3d')](function(_0x5559f4){if(_0x5559f4){_0x4fdf48=_0x5559f4;return db['ChatWebsite'][_0xef61('0x6f')]({'where':{'id':_0x4fdf48[_0xef61('0x86')]}});}})[_0xef61('0x3d')](function(_0x48f1a8){if(_0x48f1a8){_0x5df068=_0x48f1a8;return db[_0xef61('0xea')][_0xef61('0x6f')]({'where':{'id':_0x4fdf48['ContactId']}});}})[_0xef61('0x3d')](function(_0x89e31b){if(_0x89e31b){_0x4a714f=_0x89e31b;if(_0xf4b971){var _0x48d02a=null;for(var _0x980546=0x1;_0x980546<_0x4fdf48[_0xef61('0xe9')][_0xef61('0x53')];++_0x980546){_0x48d02a=_0x4fdf48[_0xef61('0xe9')][_0x980546];var _0x187335=_0x48d02a[_0xef61('0x81')]?util[_0xef61('0xeb')]('%s%d',_0x5df068[_0xef61('0xec')],_0x48d02a[_0xef61('0x81')]):'System';var _0xf43ed=_0x13d81c['body'][_0xef61('0xed')]||util[_0xef61('0xeb')](_0xef61('0xee'),_0xef61('0xef'),_0x48d02a[_0xef61('0x7a')]);switch(_0x5df068[_0xef61('0xf0')]){case _0xef61('0xf1'):_0x187335=_0x48d02a[_0xef61('0x81')]?util['format'](_0xef61('0xee'),_0x5df068[_0xef61('0xec')],_0x48d02a['UserId']):_0xef61('0xf2');break;case _0xef61('0xf3'):_0x187335=_0x48d02a[_0xef61('0x81')]?_0x48d02a['User'][_0xef61('0xf4')]||_0x48d02a[_0xef61('0x7f')]['fullname']:_0xef61('0xf2');break;case'agent_fullname':_0x187335=_0x48d02a['UserId']?_0x48d02a[_0xef61('0x7f')]['fullname']:_0xef61('0xf2');break;default:_0x187335=_0x48d02a[_0xef61('0x81')]?util[_0xef61('0xeb')](_0xef61('0xee'),_0x5df068[_0xef61('0xec')],_0x48d02a[_0xef61('0x81')]):_0xef61('0xf2');}var _0x33c62c=util[_0xef61('0xeb')](_0xef61('0xf5'),moment(_0x48d02a[_0xef61('0x89')])['format'](_0xef61('0xf6')),_0x48d02a[_0xef61('0xf7')]==='in'?_0xf43ed:_0x187335,_0x48d02a[_0xef61('0x83')]);if(!_0x48d02a[_0xef61('0xf8')]){fs[_0xef61('0xf9')](_0xf4b971,_0x33c62c);}}return db[_0xef61('0xfa')][_0xef61('0xc9')]({'where':{'service':!![]},'include':[{'model':db[_0xef61('0xfb')],'as':_0xef61('0xfc'),'raw':!![]}]});}}})['then'](function(_0x2e2c6b){if(_0x2e2c6b&&_0x2e2c6b[_0xef61('0xfc')]&&_0x13d81c[_0xef61('0x83')]){var _0x286345={'tls':{'rejectUnauthorized':![]}};if(_0x2e2c6b[_0xef61('0xfc')][_0xef61('0xfd')]){_0x286345[_0xef61('0xfd')]=_0x2e2c6b[_0xef61('0xfc')][_0xef61('0xfd')];}else{_0x286345[_0xef61('0xfe')]=_0x2e2c6b['Smtp']['host'];_0x286345['port']=_0x2e2c6b[_0xef61('0xfc')][_0xef61('0xff')];_0x286345[_0xef61('0x100')]=_0x2e2c6b[_0xef61('0xfc')][_0xef61('0x100')];}if(_0x2e2c6b['Smtp']['authentication']){_0x286345[_0xef61('0x101')]={'user':_0x2e2c6b[_0xef61('0xfc')][_0xef61('0xcf')],'pass':_0x2e2c6b[_0xef61('0xfc')][_0xef61('0x102')]};}return respondWithRpcPromise(_0xef61('0x103'),_0xef61('0x104'),{'account':_0x286345,'message':{'from':util[_0xef61('0xeb')](_0xef61('0x105'),_0x2e2c6b[_0xef61('0x4c')],_0x2e2c6b[_0xef61('0x106')]||_0x2e2c6b[_0xef61('0xfc')][_0xef61('0xcf')]),'to':_0x13d81c[_0xef61('0x83')][_0xef61('0xe5')],'subject':'Mail\x20Transcript','text':util[_0xef61('0xeb')](_0xef61('0x107'),_0x13d81c[_0xef61('0x83')][_0xef61('0xe5')]),'attachments':[{'path':_0xf4b971}]}})[_0xef61('0x3d')](function(){return _0x4fdf48;})['catch'](function(_0x277ce0){console[_0xef61('0x2d')](_0x277ce0);});}else{return _0x4fdf48;}})['then'](respondWithStatusCode(_0x5a00e5,0xc8))['catch'](handleError(_0x5a00e5,null));};exports[_0xef61('0x108')]=function(_0xc7f66a,_0x355a60,_0x105dd7){return db[_0xef61('0xd0')][_0xef61('0x6f')]({'where':{'id':_0xc7f66a[_0xef61('0xc2')]['id']}})[_0xef61('0x3d')](handleEntityNotFound(_0x355a60,null))['then'](function(_0x4adc94){if(_0x4adc94){return _0x4adc94['addMessage'](_0xc7f66a[_0xef61('0x83')][_0xef61('0x109')],_[_0xef61('0x10a')](_0xc7f66a[_0xef61('0x83')],[_0xef61('0x109'),'id'])||{});}})[_0xef61('0x3d')](respondWithResult(_0x355a60,null))['catch'](handleError(_0x355a60,null));};exports[_0xef61('0x10b')]=function(_0x17542d,_0x4bcb68,_0x5dcf03){var _0x378ed4={'raw':![],'where':{}};var _0x144743={};var _0x481f72={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xef61('0xc9')]({'where':{'id':_0x17542d[_0xef61('0xc2')]['id']}})[_0xef61('0x3d')](handleEntityNotFound(_0x4bcb68,null))[_0xef61('0x3d')](function(_0x2943f1){if(_0x2943f1){_0x144743[_0xef61('0x4b')]=_[_0xef61('0x4e')](db[_0xef61('0xd0')][_0xef61('0x47')]);_0x144743['query']=_[_0xef61('0x4e')](_0x17542d['query']);_0x144743['filters']=_['intersection'](_0x144743[_0xef61('0x4b')],_0x144743['query']);_0x378ed4[_0xef61('0x51')]=_[_0xef61('0x50')](_0x144743[_0xef61('0x4b')],qs['fields'](_0x17542d[_0xef61('0x4d')][_0xef61('0x52')]));_0x378ed4[_0xef61('0x51')]=_0x378ed4[_0xef61('0x51')]['length']?_0x378ed4[_0xef61('0x51')]:_0x144743[_0xef61('0x4b')];if(!_0x17542d['query'][_0xef61('0x54')](_0xef61('0x55'))){_0x378ed4[_0xef61('0x37')]=qs[_0xef61('0x37')](_0x17542d[_0xef61('0x4d')]['limit']);_0x378ed4['offset']=qs[_0xef61('0x36')](_0x17542d[_0xef61('0x4d')][_0xef61('0x36')]);}_0x378ed4['order']=qs['sort'](_0x17542d[_0xef61('0x4d')]['sort']);_0x378ed4[_0xef61('0x58')]=qs[_0xef61('0x4f')](_['pick'](_0x17542d[_0xef61('0x4d')],_0x144743['filters']));_0x378ed4[_0xef61('0x58')]['ChatInteractionId']=_0x2943f1['id'];if(_0x17542d['query'][_0xef61('0x95')]){_0x378ed4[_0xef61('0x58')]=_[_0xef61('0xa9')](_0x378ed4[_0xef61('0x58')],{'$or':_[_0xef61('0x41')](_0x378ed4['attributes'],function(_0x7b1d25){var _0x647a08={};_0x647a08[_0x7b1d25]={'$like':'%'+_0x17542d[_0xef61('0x4d')][_0xef61('0x95')]+'%'};return _0x647a08;})});}if(_0x17542d['query'][_0xef61('0x8b')]){var _0x1152d0=_0x17542d[_0xef61('0x4d')][_0xef61('0x8b')]['split'](',');var _0x2955b0={};_0x2955b0[_0x1152d0[0x0]]={'$gte':moment(_0x1152d0[0x1])['format'](_0xef61('0x10c'))};_0x378ed4[_0xef61('0x58')]=_[_0xef61('0xa9')](_0x378ed4['where'],_0x2955b0);}_0x378ed4=_[_0xef61('0xa9')]({},_0x378ed4,_0x17542d[_0xef61('0xc5')]);return db['ChatMessage']['count']({'where':_0x378ed4[_0xef61('0x58')]})[_0xef61('0x3d')](function(_0x37d082){_0x481f72[_0xef61('0x35')]=_0x37d082;if(_0x17542d[_0xef61('0x4d')]['includeAll']){_0x378ed4['include']=[{'all':!![]}];}return db[_0xef61('0xd0')][_0xef61('0x10d')](_0x378ed4);})[_0xef61('0x3d')](function(_0x42247e){_0x481f72[_0xef61('0x10e')]=_0x42247e;return _0x481f72;});}})[_0xef61('0x3d')](respondWithFilteredResult(_0x4bcb68,_0x378ed4))['catch'](handleError(_0x4bcb68,null));};exports['getMyMessages']=function(_0x45bef1,_0x27872e,_0x481728){var _0xc89702={'where':{}},_0xd9c38b={},_0x586025={'count':0x0,'rows':[]};return db[_0xef61('0xaa')][_0xef61('0xc9')]({'where':{'id':_0x45bef1[_0xef61('0xc2')]['id']}})[_0xef61('0x3d')](handleEntityNotFound(_0x27872e,null))[_0xef61('0x3d')](function(_0x23a89e){if(_0x23a89e){_0xd9c38b[_0xef61('0x4b')]=_[_0xef61('0x4e')](db[_0xef61('0xd0')][_0xef61('0x47')]);_0xd9c38b[_0xef61('0x4d')]=_[_0xef61('0x4e')](_0x45bef1[_0xef61('0x4d')]);_0xd9c38b[_0xef61('0x4f')]=_['intersection'](_0xd9c38b[_0xef61('0x4b')],_0xd9c38b[_0xef61('0x4d')]);_0xc89702[_0xef61('0x51')]=_['intersection'](_0xd9c38b[_0xef61('0x4b')],qs['fields'](_0x45bef1['query'][_0xef61('0x52')]));_0xc89702['attributes']=_0xc89702[_0xef61('0x51')]['length']?_0xc89702[_0xef61('0x51')]:_0xd9c38b[_0xef61('0x4b')];if(!_0x45bef1[_0xef61('0x4d')]['hasOwnProperty'](_0xef61('0x55'))){_0xc89702['limit']=qs['limit'](_0x45bef1[_0xef61('0x4d')][_0xef61('0x37')]);_0xc89702[_0xef61('0x36')]=qs[_0xef61('0x36')](_0x45bef1[_0xef61('0x4d')][_0xef61('0x36')]);}_0xc89702[_0xef61('0x56')]=qs[_0xef61('0x57')](_0x45bef1[_0xef61('0x4d')][_0xef61('0x57')]);_0xc89702['where']=qs[_0xef61('0x4f')](_[_0xef61('0x59')](_0x45bef1[_0xef61('0x4d')],_0xd9c38b[_0xef61('0x4f')]));_0xc89702['where'][_0xef61('0xbf')]=_0x23a89e['id'];if(_0x45bef1[_0xef61('0x4d')][_0xef61('0x95')]){_0xc89702[_0xef61('0x58')]=_[_0xef61('0xa9')](_0xc89702['where'],{'$or':_[_0xef61('0x41')](_0xc89702[_0xef61('0x51')],function(_0x20c061){var _0x547f17={};_0x547f17[_0x20c061]={'$like':'%'+_0x45bef1['query'][_0xef61('0x95')]+'%'};return _0x547f17;})});}_0xc89702[_0xef61('0x58')][_0xef61('0xf8')]=![];if(_0x45bef1[_0xef61('0x4d')]['id']){_0xc89702[_0xef61('0x58')]['id']={'$gt':_0x45bef1[_0xef61('0x4d')]['id']};}_0xc89702=_[_0xef61('0xa9')]({},_0xc89702,_0x45bef1[_0xef61('0xc5')]);return db['ChatMessage'][_0xef61('0x35')]({'where':_0xc89702[_0xef61('0x58')]})['then'](function(_0x1d2666){_0x586025[_0xef61('0x35')]=_0x1d2666;_0xc89702[_0xef61('0xc4')]=[];if(_0x45bef1[_0xef61('0x4d')]['includeAgent']){_0xc89702[_0xef61('0xc4')]['push']({'model':db['User'],'as':'User','attributes':['id',_0xef61('0x10f'),_0xef61('0xf4')]});}if(_0x45bef1[_0xef61('0x4d')][_0xef61('0xc3')]){_0xc89702[_0xef61('0xc4')]=[{'all':!![]}];}return db[_0xef61('0xd0')][_0xef61('0x10d')](_0xc89702);})[_0xef61('0x3d')](function(_0x207921){_0x586025['rows']=_0x207921;return _0x586025;});}})[_0xef61('0x3d')](respondWithFilteredResult(_0x27872e,_0xc89702))[_0xef61('0x30')](handleError(_0x27872e,null));};exports[_0xef61('0x110')]=function(_0x9a7a8b,_0x389969,_0x21d111){return db['ChatInteraction'][_0xef61('0x6f')]({'where':{'id':_0x9a7a8b[_0xef61('0xc2')]['id']}})[_0xef61('0x3d')](handleEntityNotFound(_0x389969,null))['then'](function(_0x5e49d5){if(_0x5e49d5){return _0x5e49d5['setTags'](_0x9a7a8b[_0xef61('0x83')][_0xef61('0x109')],_[_0xef61('0x10a')](_0x9a7a8b[_0xef61('0x83')],[_0xef61('0x109'),'id'])||{})['spread'](function(){return db[_0xef61('0x7d')][_0xef61('0x10d')]({'attributes':['id','name',_0xef61('0x5c')],'where':{'id':_0x9a7a8b[_0xef61('0x83')]['ids']}});})[_0xef61('0x3d')](function(_0xc2342f){socket['emit'](_0xef61('0x111'),{'id':Number(_0x9a7a8b['params']['id']),'tags':_0xc2342f||[]});return{'id':Number(_0x9a7a8b[_0xef61('0xc2')]['id']),'tags':_0xc2342f||[]};});}})[_0xef61('0x3d')](respondWithResult(_0x389969,null))[_0xef61('0x30')](handleError(_0x389969,null));};exports[_0xef61('0x112')]=function(_0x15a336,_0x3f06d9,_0x5cab65){return db[_0xef61('0xaa')]['find']({'where':{'id':_0x15a336[_0xef61('0xc2')]['id']}})['then'](handleEntityNotFound(_0x3f06d9,null))[_0xef61('0x3d')](function(_0x2e7b2c){if(_0x2e7b2c){return _0x2e7b2c[_0xef61('0x112')](_0x15a336['query'][_0xef61('0x109')]);}})[_0xef61('0x3d')](respondWithStatusCode(_0x3f06d9,null))[_0xef61('0x30')](handleError(_0x3f06d9,null));};exports[_0xef61('0xe1')]=function(_0x49b6ed,_0x403cde){var _0x5666f5=moment()[_0xef61('0x113')]()['toString']();var _0x2ff347=path[_0xef61('0xe2')](config[_0xef61('0xe3')],'server',_0xef61('0x114'),_0xef61('0x115'));var _0x14dd41=path[_0xef61('0xe2')](config[_0xef61('0xe3')],_0xef61('0x116'),_0xef61('0x114'),_0xef61('0x117'));var _0x425e28=path['join'](_0x2ff347,_0x5666f5);var _0x5433f7=util[_0xef61('0xeb')](_0xef61('0x118'),_0x49b6ed['params']['id'],_0x5666f5);var _0x2b4ca8=path['join'](_0x2ff347,_0x5433f7);var _0x34c8be=[];_0x34c8be['push']({'model':db[_0xef61('0x7f')],'as':_0xef61('0x7f'),'attributes':['id','fullname'],'raw':!![]});_0x34c8be['push']({'model':db[_0xef61('0xea')],'as':_0xef61('0x73'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x49b6ed[_0xef61('0x4d')]['attachments']){_0x34c8be[_0xef61('0x45')]({'model':db[_0xef61('0xdf')],'as':'Attachment','raw':!![]});}var _0x5e57a6=[{'model':db[_0xef61('0xd0')],'as':_0xef61('0xe9'),'attributes':['id',_0xef61('0x83'),'createdAt',_0xef61('0xf7'),_0xef61('0xf8'),_0xef61('0x90')],'include':_0x34c8be}];_0x5e57a6['push']({'model':db[_0xef61('0x119')],'as':_0xef61('0x11a'),'attributes':['id',_0xef61('0x4c')]});_0x5e57a6[_0xef61('0x45')]({'model':db[_0xef61('0x7f')],'as':'Owner','attributes':['id',_0xef61('0x10f')]});return db[_0xef61('0xaa')][_0xef61('0x6f')]({'where':{'id':_0x49b6ed[_0xef61('0xc2')]['id']},'include':_0x5e57a6})[_0xef61('0x3d')](handleEntityNotFound(_0x403cde,null))[_0xef61('0x3d')](function(_0x3a6150){if(_0x3a6150){var _0x26c7cf=_0x3a6150[_0xef61('0x11b')]({'plain':!![]});fs['mkdirSync'](_0x425e28);var _0x382243={'format':'A4','border':'10px','header':{'height':_0xef61('0x11c'),'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':'30px','contents':{'default':util[_0xef61('0xeb')](_0xef61('0x11d'),util[_0xef61('0xeb')]('%s\x20#%d',_0xef61('0x11e'),_0x26c7cf['id']),moment()['format'](_0xef61('0x11f'))['toString']())}}};var _0x118d3b={'channel':_0xef61('0x11e'),'account':_0x26c7cf[_0xef61('0x11a')]['name'],'agent':_0x26c7cf[_0xef61('0x120')]?_0x26c7cf[_0xef61('0x120')]['fullname']:'N.A.','createdAt':moment(_0x26c7cf[_0xef61('0x89')])[_0xef61('0xeb')](_0xef61('0x10c'))[_0xef61('0xa7')](),'closedAt':_0x26c7cf['closed']?moment(_0x26c7cf['closedAt'])[_0xef61('0xeb')](_0xef61('0x10c'))[_0xef61('0xa7')]():'','disposition':_0x26c7cf[_0xef61('0xd7')],'chatInfo':{'browser':_0x26c7cf[_0xef61('0x121')],'os':_0x26c7cf[_0xef61('0x122')],'referer':_0x26c7cf[_0xef61('0x123')],'customerIp':_0x26c7cf[_0xef61('0x124')],'customerPort':_0x26c7cf['customerPort']?_0x26c7cf[_0xef61('0x125')]:_0xef61('0x126')},'messages':_(_0x26c7cf[_0xef61('0xe9')])[_0xef61('0x127')]()[_0xef61('0x95')]({'secret':![]})[_0xef61('0x41')](function(_0x56f0d1){if(_0x56f0d1[_0xef61('0xdf')]){var _0x1fe687=path[_0xef61('0xe2')](_0x14dd41,_0x56f0d1[_0xef61('0xdf')][_0xef61('0xdb')]);if(fs[_0xef61('0x128')](_0x1fe687)){fs['createReadStream'](_0x1fe687)[_0xef61('0x129')](fs['createWriteStream'](path[_0xef61('0xe2')](_0x425e28,_0x56f0d1[_0xef61('0xdf')][_0xef61('0xdb')])));}}return{'date':moment(_0x56f0d1[_0xef61('0x89')])[_0xef61('0xeb')](_0xef61('0x10c'))[_0xef61('0xa7')](),'sender':_0x56f0d1['direction']===_0xef61('0x12a')?_0x56f0d1[_0xef61('0x7f')]?_0x56f0d1[_0xef61('0x7f')][_0xef61('0x10f')]:_0xef61('0xf2'):_0x56f0d1[_0xef61('0x73')]['firstName']+(_0x56f0d1[_0xef61('0x73')][_0xef61('0x12b')]?'\x20'+_0x56f0d1[_0xef61('0x73')][_0xef61('0x12b')]:''),'body':_0x56f0d1[_0xef61('0xdf')]?_0x56f0d1[_0xef61('0xdf')][_0xef61('0xdb')]:_0x56f0d1['body'],'direction':_0x56f0d1[_0xef61('0xf7')]==='out'?'A':'C','secret':_0x56f0d1[_0xef61('0xf8')],'read':_0x56f0d1[_0xef61('0x90')],'attachment':_0x56f0d1[_0xef61('0xdf')]};})[_0xef61('0x78')]()};return ejs[_0xef61('0x12c')](path[_0xef61('0xe2')](config[_0xef61('0xe3')],_0xef61('0x116'),'views',_0xef61('0x12d')),{'interaction':_0x118d3b})[_0xef61('0x3d')](function(_0x2d16a1){return new BPromise(function(_0x4a934f,_0x4c9d25){pdf[_0xef61('0xc6')](_0x2d16a1,_0x382243)[_0xef61('0x12e')](path[_0xef61('0xe2')](_0x425e28,'transcript-'+_0x26c7cf['id']+'-'+_0x5666f5+'.pdf'),function(_0x301182,_0x2d6635){if(_0x301182)return _0x4c9d25(_0x301182);_0x4a934f(_0x2d6635);});});})[_0xef61('0x3d')](function(){return new BPromise(function(_0x237557,_0x2b5612){zipdir(_0x425e28,{'saveTo':_0x2b4ca8},function(_0x58f00c,_0x473842){if(_0x58f00c)return _0x2b5612(_0x58f00c);return _0x237557(_0x473842);});})['then'](function(){return new BPromise(function(_0x4f5458,_0x342806){rimraf(_0x425e28,function(_0x332a90){if(_0x332a90)_0x342806(_0x332a90);return _0x4f5458();});});})[_0xef61('0x3d')](function(){return _0x403cde[_0xef61('0xe1')](_0x2b4ca8,_0x5433f7,function(_0x34ae3a){if(_0x34ae3a){console[_0xef61('0x12f')](_0xef61('0x130'),_0x34ae3a);}else{fs[_0xef61('0x131')](_0x2b4ca8);}});});});}else{return _0x403cde['sendStatus'](0xc8);}})[_0xef61('0x30')](handleError(_0x403cde,null));}; \ No newline at end of file +var _0x323f=['some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','ChatInteraction','a.key','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','params','rawAttributes','includeAll','include','merge','options','create','body','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','Error\x20in\x20Vidaoo\x20configuration','out','user','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','download','join','root','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','ChatMessage','CmContact','Messages','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','Smtp','service','host','port','secure','authentication','auth','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','getMessages','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','alias','addTags','setTags','omit','spread','emit','removeTags','unix','tmp','server','transcript-%d-%s.zip','firstName','attachments','Account','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','Owner','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','lastName','renderFile','downloadInteraction.html','toFile','log','err','unlinkSync','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','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','end','stack','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','key','model','name','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','search','sqlOperator','conditions','length','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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','type'];(function(_0x3c603b,_0x36f6f1){var _0x322e5b=function(_0x433482){while(--_0x433482){_0x3c603b['push'](_0x3c603b['shift']());}};_0x322e5b(++_0x36f6f1);}(_0x323f,0x1ee));var _0xf323=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x323f[_0x5b561d];return _0x431060;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf323('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf323('0x1'));var jsonpatch=require(_0xf323('0x2'));var rp=require(_0xf323('0x3'));var moment=require(_0xf323('0x4'));var BPromise=require(_0xf323('0x5'));var Mustache=require(_0xf323('0x6'));var util=require(_0xf323('0x7'));var path=require(_0xf323('0x8'));var sox=require(_0xf323('0x9'));var csv=require(_0xf323('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf323('0xb'));var squel=require(_0xf323('0xc'));var crypto=require(_0xf323('0xd'));var jsforce=require(_0xf323('0xe'));var deskjs=require(_0xf323('0xf'));var toCsv=require(_0xf323('0xa'));var querystring=require(_0xf323('0x10'));var Papa=require(_0xf323('0x11'));var Redis=require(_0xf323('0x12'));var authService=require(_0xf323('0x13'));var qs=require(_0xf323('0x14'));var as=require(_0xf323('0x15'));var hardwareService=require(_0xf323('0x16'));var logger=require(_0xf323('0x17'))(_0xf323('0x18'));var utils=require(_0xf323('0x19'));var config=require(_0xf323('0x1a'));var db=require('../../mysqldb')['db'];config[_0xf323('0x1b')]=_[_0xf323('0x1c')](config[_0xf323('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xf323('0x1d'))(new Redis(config[_0xf323('0x1b')]));require(_0xf323('0x1e'))[_0xf323('0x1f')](socket);var jayson=require(_0xf323('0x20'));var client=jayson[_0xf323('0x21')]['http']({'port':0x232b});var client9004=jayson['client'][_0xf323('0x22')]({'port':0x232c});function checkPasswordPattern(_0x447517,_0x38fd4c,_0x3858ee){if(_0x3858ee){var _0x3db58a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3db58a['test'](_0x38fd4c)){return _0x447517;}else{throw new db[(_0xf323('0x23'))][(_0xf323('0x24'))](_0xf323('0x25'));}}else{return _0x447517;}}function respondWithRpcPromise(_0x44671c,_0x49b115,_0x2db977,_0x272aec){return new BPromise(function(_0x1a459d,_0x41b2cb){var _0x5955ea=_0x272aec||client;return _0x5955ea[_0xf323('0x26')](_0x44671c,_0x2db977)[_0xf323('0x27')](function(_0x5baab2){logger[_0xf323('0x28')](_0xf323('0x29'),_0x49b115,_0xf323('0x2a'));logger[_0xf323('0x2b')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x49b115,_0xf323('0x2a'),JSON[_0xf323('0x2c')](_0x5baab2));if(_0x5baab2[_0xf323('0x2d')]){if(_0x5baab2['error'][_0xf323('0x2e')]===0x1f4){logger[_0xf323('0x2d')](_0xf323('0x29'),_0x49b115,_0x5baab2[_0xf323('0x2d')][_0xf323('0x2f')]);return _0x41b2cb(_0x5baab2[_0xf323('0x2d')][_0xf323('0x2f')]);}logger[_0xf323('0x2d')](_0xf323('0x29'),_0x49b115,_0x5baab2['error'][_0xf323('0x2f')]);return _0x1a459d(_0x5baab2[_0xf323('0x2d')][_0xf323('0x2f')]);}else{logger[_0xf323('0x28')](_0xf323('0x29'),_0x49b115,_0xf323('0x2a'));_0x1a459d(_0x5baab2['result'][_0xf323('0x2f')]);}})['catch'](function(_0x1570d4){logger[_0xf323('0x2d')]('ChatInteraction,\x20%s,\x20%s',_0x49b115,_0x1570d4);_0x41b2cb(_0x1570d4);});});}function respondWithStatusCode(_0x46663b,_0x3c95ce){_0x3c95ce=_0x3c95ce||0xcc;return function(_0x2b6254){if(_0x2b6254){return _0x46663b[_0xf323('0x30')](_0x3c95ce);}return _0x46663b[_0xf323('0x31')](_0x3c95ce)['end']();};}function respondWithResult(_0x44c944,_0x34b536){_0x34b536=_0x34b536||0xc8;return function(_0x12c7d5){if(_0x12c7d5){return _0x44c944[_0xf323('0x31')](_0x34b536)[_0xf323('0x32')](_0x12c7d5);}};}function respondWithFilteredResult(_0x36bd3f,_0x17cb4d){return function(_0x1723b7){if(_0x1723b7){var _0x139adc=_0x1723b7[_0xf323('0x33')],_0x52300b=_0x17cb4d[_0xf323('0x34')],_0x3f23cf=_0x17cb4d[_0xf323('0x34')]+_0x17cb4d['limit'],_0x15187c;if(_0x3f23cf>=_0x139adc){_0x3f23cf=_0x139adc;_0x15187c=0xc8;}else{_0x15187c=0xce;}_0x36bd3f[_0xf323('0x31')](_0x15187c);return _0x36bd3f[_0xf323('0x35')](_0xf323('0x36'),_0x52300b+'-'+_0x3f23cf+'/'+_0x139adc)[_0xf323('0x32')](_0x1723b7);}return null;};}function patchUpdates(_0x3c849a){return function(_0x485cbf){try{jsonpatch[_0xf323('0x37')](_0x485cbf,_0x3c849a,!![]);}catch(_0x1a0d27){return BPromise[_0xf323('0x38')](_0x1a0d27);}return _0x485cbf[_0xf323('0x39')]();};}function saveUpdates(_0x4fc6bd,_0x17b4e6){return function(_0x5658db){if(_0x5658db){return _0x5658db[_0xf323('0x3a')](_0x4fc6bd)[_0xf323('0x27')](function(_0x4ff3c1){return _0x4ff3c1;});}return null;};}function removeEntity(_0x3dcac7,_0x47ba23){return function(_0x3c6a07){if(_0x3c6a07){return _0x3c6a07['destroy']()[_0xf323('0x27')](function(){_0x3dcac7['status'](0xcc)[_0xf323('0x3b')]();});}};}function handleEntityNotFound(_0x82a6ca,_0x4e0e51){return function(_0x4964a5){if(!_0x4964a5){_0x82a6ca['sendStatus'](0x194);}return _0x4964a5;};}function handleError(_0x8b24f2,_0x277a6c){_0x277a6c=_0x277a6c||0x1f4;return function(_0x79e636){logger[_0xf323('0x2d')](_0x79e636[_0xf323('0x3c')]);if(_0x79e636['name']){delete _0x79e636['name'];}_0x8b24f2['status'](_0x277a6c)[_0xf323('0x3d')](_0x79e636);};}function getInteractionUsers(_0x59fee2,_0x11d564){return new BPromise(function(_0x47e7a2,_0x431bc){try{if(_0x11d564[_0x59fee2['id']]){_0x59fee2[_0xf323('0x3e')]=_[_0xf323('0x3f')](_0x11d564[_0x59fee2['id']],function(_0x325fa9){return{'id':_0x325fa9['id'],'fullname':_0x325fa9[_0xf323('0x40')]};});}}catch(_0x48a6c4){_0x431bc(_0x48a6c4);}_0x47e7a2(_0x59fee2);});}function getInteractionTags(_0x3d8ddb,_0x3bbe02){return new BPromise(function(_0x408b66,_0x27ddcc){try{if(_0x3d8ddb[_0xf323('0x41')]){_0x3d8ddb[_0xf323('0x42')]=[];_0x3d8ddb[_0xf323('0x41')][_0xf323('0x43')](',')[_0xf323('0x44')](function(_0x13b8cb){_0x3d8ddb[_0xf323('0x42')][_0xf323('0x45')](_0x3bbe02[_0x13b8cb]);});}delete _0x3d8ddb[_0xf323('0x41')];}catch(_0x388d80){_0x27ddcc(_0x388d80);}_0x408b66(_0x3d8ddb);});}function updateChatInteraction(_0x2c89dd,_0x33b1b2,_0x5bb658){return new BPromise(function(_0x502114,_0x1818c4){return getInteractionUsers(_0x2c89dd,_0x5bb658)[_0xf323('0x27')](function(_0x2864f7){return getInteractionTags(_0x2864f7,_0x33b1b2);})[_0xf323('0x27')](function(_0xd9c79d){_0x502114(_0xd9c79d);})[_0xf323('0x46')](function(_0x2746e3){_0x1818c4(_0x2746e3);});});}exports[_0xf323('0x47')]=function(_0x1c0136,_0x320592){var _0x2c0854={},_0x247149={},_0x121599={'count':0x0,'rows':[]};var _0x48d4df=_[_0xf323('0x3f')](db['ChatInteraction']['rawAttributes'],function(_0x410792){return{'name':_0x410792['fieldName'],'type':_0x410792['type'][_0xf323('0x48')]};});_0x247149[_0xf323('0x49')]=_[_0xf323('0x3f')](_0x48d4df,_0xf323('0x4a'));_0x247149[_0xf323('0x4b')]=_[_0xf323('0x4c')](_0x1c0136[_0xf323('0x4b')]);_0x247149[_0xf323('0x4d')]=_[_0xf323('0x4e')](_0x247149[_0xf323('0x49')],_0x247149[_0xf323('0x4b')]);_0x2c0854['attributes']=_[_0xf323('0x4e')](_0x247149['model'],qs[_0xf323('0x4f')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x4f')]));_0x2c0854[_0xf323('0x50')]=_0x2c0854['attributes']['length']?_0x2c0854[_0xf323('0x50')]:_0x247149['model'];if(!_0x1c0136[_0xf323('0x4b')]['hasOwnProperty'](_0xf323('0x51'))){_0x2c0854[_0xf323('0x52')]=qs['limit'](_0x1c0136[_0xf323('0x4b')][_0xf323('0x52')]);_0x2c0854[_0xf323('0x34')]=qs[_0xf323('0x34')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x34')]);}_0x2c0854[_0xf323('0x53')]=qs[_0xf323('0x54')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x54')]);_0x2c0854[_0xf323('0x55')]=qs[_0xf323('0x4d')](_[_0xf323('0x56')](_0x1c0136['query'],_0x247149[_0xf323('0x4d')]),_0x48d4df);var _0x18ad3e=[];var _0x27b191=squel[_0xf323('0x57')]()[_0xf323('0x58')]('id')[_0xf323('0x58')]('name')[_0xf323('0x58')](_0xf323('0x59'))['from'](_0xf323('0x5a'));var _0x2909cf=squel['select']()['field'](_0xf323('0x5b'))[_0xf323('0x58')](_0xf323('0x5c'))[_0xf323('0x58')](_0xf323('0x5d'))[_0xf323('0x5e')](_0xf323('0x5f'),'ui')[_0xf323('0x60')]('users','u',_0xf323('0x61'));var _0x198a2b=squel[_0xf323('0x57')]()[_0xf323('0x5e')](_0xf323('0x62'),'i')[_0xf323('0x60')](_0xf323('0x63'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf323('0x60')](_0xf323('0x64'),'o',_0xf323('0x65'))[_0xf323('0x60')](_0xf323('0x66'),'a',_0xf323('0x67'))[_0xf323('0x60')](_0xf323('0x68'),'me',_0xf323('0x69'))['left_join'](_0xf323('0x6a'),'it',_0xf323('0x6b'))[_0xf323('0x60')]('tools_tags','t',_0xf323('0x6c'));var _0x2ad9d4=squel['expr']();var _0x2506fd=[];var _0x475f95=squel['expr']();var _0xee9a9;if(_0x1c0136[_0xf323('0x4b')]['search']){_0xee9a9=as[_0xf323('0x6d')](_0x1c0136[_0xf323('0x4b')][_0xf323('0x6e')]);var _0x2db2b1=_0xee9a9[_0xf323('0x6f')];for(var _0x291e36=0x0;_0x291e36<_0xee9a9[_0xf323('0x70')][_0xf323('0x71')];_0x291e36++){var _0x2b164b=_0xee9a9['conditions'][_0x291e36];var _0xd1902b='i';var _0x31942f=_['find'](_0x48d4df,[_0xf323('0x4a'),_0x2b164b[_0xf323('0x58')]]);if(!_0x31942f){switch(_0x2b164b['field']){case _0xf323('0x72'):if(_0x2b164b[_0xf323('0x73')]==0x1){_0x198a2b[_0xf323('0x74')]('`'+_0x2b164b[_0xf323('0x58')]+'`\x20=\x200');}else{_0x198a2b[_0xf323('0x74')]('`'+_0x2b164b[_0xf323('0x58')]+_0xf323('0x75'));}break;case _0xf323('0x76'):if(_0x2b164b['operator']===_0xf323('0x77')){if(_0x2b164b[_0xf323('0x73')][_0xf323('0x43')]('\x20')[_0xf323('0x71')]>0x1){_0x2ad9d4[_0x2db2b1](_0xf323('0x78'),qs[_0xf323('0x79')](_0x2b164b[_0xf323('0x73')]),null);}else{var _0x1a91c8='%'+_0x2b164b[_0xf323('0x73')]+'%';_0x2ad9d4[_0x2db2b1](_0xf323('0x7a'),_0x1a91c8,_0x1a91c8,_0x1a91c8);}}else{_0x31942f=_[_0xf323('0x7b')](_0x48d4df,[_0xf323('0x4a'),_0xf323('0x7c')]);_0x2b164b[_0xf323('0x58')]=_0xf323('0x7c');_0x53b408=as['buildExpression'](_0xd1902b,_0x31942f['type'],_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408[_0xf323('0x7d')],_0x53b408[_0xf323('0x73')][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')][_0xf323('0x3b')]);}break;case _0xf323('0x7f'):var _0x550a6a=_0x2b164b[_0xf323('0x73')][_0xf323('0x43')](',')[_0xf323('0x3f')](function(_0x3add7c){return Number(_0x3add7c);});_0x550a6a['forEach'](function(_0x5e0382){_0x475f95['or'](_0xf323('0x80'),'%,'+_0x5e0382+',%');});_0x2506fd=_[_0xf323('0x81')](_0x2506fd,_0x550a6a);break;case _0xf323('0x82'):if(_0x2b164b[_0xf323('0x83')]===_0xf323('0x77')){_0x2ad9d4[_0x2db2b1](_0xf323('0x84'),'%'+_0x2b164b[_0xf323('0x73')]+'%',null);}else{_0x31942f=_['find'](_0x48d4df,['name',_0xf323('0x85')]);_0x2b164b[_0xf323('0x58')]=_0xf323('0x85');_0x53b408=as[_0xf323('0x86')](_0xd1902b,_0x31942f[_0xf323('0x87')],_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408[_0xf323('0x7d')],_0x53b408['value'][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')]['end']);}break;case'body':_0x53b408=as[_0xf323('0x86')]('me',null,_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408[_0xf323('0x7d')],_0x53b408['value'][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')][_0xf323('0x3b')]);break;}}else{var _0x53b408=as[_0xf323('0x86')](_0xd1902b,_0x31942f['type'],_0x2b164b);_0x2ad9d4[_0x2db2b1](_0x53b408['text'],_0x53b408[_0xf323('0x73')][_0xf323('0x7e')],_0x53b408[_0xf323('0x73')][_0xf323('0x3b')]);}}}else{var _0x258e1a=_(_0x1c0136['query'])[_0xf323('0x4c')]()[_0xf323('0x3f')](function(_0x27a406){return _[_0xf323('0x88')](_0x48d4df,['name',_0x27a406])?_0x27a406:undefined;})[_0xf323('0x89')]()[_0xf323('0x73')]();if(!_[_0xf323('0x8a')](_0x258e1a)){_0x258e1a[_0xf323('0x44')](function(_0x4b8408){if(_0x4b8408===_0xf323('0x8b')){_0x198a2b[_0xf323('0x55')](_0xf323('0x8c'),[][_0xf323('0x8d')](_0x1c0136['query'][_0x4b8408]));}else if(_0x4b8408===_0xf323('0x8e')){var _0x36e7b9=JSON[_0xf323('0x8f')](_0x1c0136['query'][_0x4b8408])['$gte'];var _0x391ebe=JSON['parse'](_0x1c0136[_0xf323('0x4b')][_0x4b8408])[_0xf323('0x90')];_0x198a2b[_0xf323('0x55')](_0xf323('0x91'),_0x36e7b9,_0x391ebe);}else{if(_0x1c0136['query'][_0x4b8408]===_0xf323('0x92')){_0x198a2b[_0xf323('0x55')]('i.'+_0x4b8408+_0xf323('0x93'));}else{_0x198a2b[_0xf323('0x55')]('i.'+_0x4b8408+_0xf323('0x94'),_0x1c0136['query'][_0x4b8408]);}}});}if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x95')]){if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x95')]==0x1){_0x198a2b['having']('`unreadMessages`\x20=\x200');}else{_0x198a2b[_0xf323('0x74')](_0xf323('0x96'));}}if(_0x1c0136['query'][_0xf323('0x97')]){_0x2506fd=_['isArray'](_0x1c0136[_0xf323('0x4b')][_0xf323('0x97')])?_0x1c0136[_0xf323('0x4b')]['tag']:new Array(_0x1c0136[_0xf323('0x4b')][_0xf323('0x97')]);_0x2506fd['forEach'](function(_0x1400fe){_0x475f95['or'](_0xf323('0x80'),'%,'+_0x1400fe+',%');});}if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x98')]){var _0x249639=_0x1c0136['query'][_0xf323('0x98')][_0xf323('0x99')]('\x5c','\x5c\x5c')[_0xf323('0x99')]('\x27\x27',_0xf323('0x9a'));if(qs[_0xf323('0x9b')](_0x249639)){_0x2ad9d4['or']('i.id\x20LIKE\x20?',_0x249639+'%');}else{_0x2ad9d4['or'](_0xf323('0x9c'),qs['getFullTextValue'](_0x249639))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x249639+'%');}}}_0x198a2b['where'](_0x2ad9d4);_0x198a2b[_0xf323('0x9d')](_0xf323('0x9e'));var _0x2604a3={'type':db['Sequelize'][_0xf323('0x9f')][_0xf323('0xa0')],'raw':!![]};var _0x4d3478=_0x198a2b[_0xf323('0xa1')]();_0x4d3478[_0xf323('0x58')](_0xf323('0x9e'));_0x4d3478[_0xf323('0x58')](_0xf323('0xa2'),_0xf323('0x72'));if(_0x2c0854[_0xf323('0x53')]){_0x2c0854[_0xf323('0x53')]['forEach'](function(_0x31da2b){_0x198a2b[_0xf323('0x53')]('i.'+_0x31da2b[0x0],_0x31da2b[0x1]===_0xf323('0xa3')?![]:!![]);});}if(!_['isEmpty'](_0x2506fd)){_0x198a2b['having'](_0x475f95);_0x4d3478[_0xf323('0x55')](_0xf323('0xa4'),_0x2506fd);}BPromise[_0xf323('0xa5')]()[_0xf323('0x27')](function(){if(!_0xee9a9){if(_0x1c0136[_0xf323('0x4b')]['ChatWebsiteId']||_0x1c0136['query'][_0xf323('0xa6')])return;_0x4d3478[_0xf323('0x55')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x198a2b[_0xf323('0x55')](_0xf323('0xa7'));return;}return _0x1c0136['user'][_0xf323('0xa8')]({'attributes':['id'],'raw':!![]})[_0xf323('0x27')](function(_0x13d2ef){if(_[_0xf323('0x8a')](_0x13d2ef)){_0x4d3478['where'](_0xf323('0xa9'));_0x198a2b[_0xf323('0x55')](_0xf323('0xa9'));}else{_0x4d3478[_0xf323('0x55')](_0xf323('0x8c'),_[_0xf323('0x3f')](_0x13d2ef,'id'));_0x198a2b[_0xf323('0x55')](_0xf323('0x8c'),_[_0xf323('0x3f')](_0x13d2ef,'id'));}});})['then'](function(){db[_0xf323('0xaa')][_0xf323('0x4b')](_0x4d3478[_0xf323('0xab')](),_0x2604a3)['then'](function(_0x478491){_0x121599[_0xf323('0x33')]=_0x478491['length'];if(_0x121599['count']===0x0)return[];return db[_0xf323('0xaa')][_0xf323('0x4b')](_0x27b191[_0xf323('0xab')](),_0x2604a3)['then'](function(_0x587a21){_0x18ad3e=_[_0xf323('0xac')](_0x587a21,'id');_0x2604a3=_['merge'](_0x2604a3,{'model':db[_0xf323('0xad')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c0136[_0xf323('0x4b')][_0xf323('0x4f')]){_0x2c0854[_0xf323('0x50')]['forEach'](function(_0x18528a){_0x198a2b['field']('i.'+_0x18528a);});}else{_0x198a2b[_0xf323('0x58')](_0xf323('0xa2'),'unreadMessages');_0x198a2b[_0xf323('0x58')](_0xf323('0xae'),'Account.key');_0x198a2b[_0xf323('0x58')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x198a2b['field'](_0xf323('0xaf'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb0'),_0xf323('0xb1'));_0x198a2b[_0xf323('0x58')]('c.lastName',_0xf323('0xb2'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb3'),_0xf323('0xb4'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb5'),_0xf323('0xb6'));_0x198a2b[_0xf323('0x58')]('c.mobile',_0xf323('0xb7'));_0x198a2b[_0xf323('0x58')](_0xf323('0xb8'),'Contact.fax');_0x198a2b['field']('o.fullname',_0xf323('0xb9'));_0x198a2b[_0xf323('0x58')](_0xf323('0xba'),_0xf323('0xbb'));_0x198a2b[_0xf323('0x58')](_0xf323('0xbc'),_0xf323('0x41'));}if(_0x2c0854[_0xf323('0x52')])_0x198a2b['limit'](_0x2c0854[_0xf323('0x52')]);if(_0x2c0854[_0xf323('0x34')])_0x198a2b[_0xf323('0x34')](_0x2c0854[_0xf323('0x34')]);return db[_0xf323('0xaa')][_0xf323('0x4b')](_0x198a2b[_0xf323('0xab')](),_0x2604a3);})[_0xf323('0x27')](function(_0x44dffe){_0x2909cf['where'](_0xf323('0xbd'),_[_0xf323('0x3f')](_0x44dffe,'id'));return db[_0xf323('0xaa')][_0xf323('0x4b')](_0x2909cf[_0xf323('0xab')](),_0x2604a3)[_0xf323('0x27')](function(_0x46c286){var _0x55bfa8=_[_0xf323('0xbe')](_0x46c286,_0xf323('0xbf'));var _0x1e79af=[];_0x44dffe[_0xf323('0x44')](function(_0x1ef7ba){_0x1e79af[_0xf323('0x45')](updateChatInteraction(_0x1ef7ba,_0x18ad3e,_0x55bfa8));});return BPromise[_0xf323('0xc0')](_0x1e79af);});});})[_0xf323('0x27')](function(_0x59283f){_0x121599['rows']=_0x59283f;return _0x121599;})[_0xf323('0x27')](respondWithFilteredResult(_0x320592,_0x2c0854));})[_0xf323('0x46')](handleError(_0x320592,null));};exports[_0xf323('0xc1')]=function(_0x1d534f,_0x4914da){var _0x53c9c5={'raw':![],'where':{'id':_0x1d534f[_0xf323('0xc2')]['id']}},_0x34003e={};_0x34003e[_0xf323('0x49')]=_[_0xf323('0x4c')](db[_0xf323('0xad')][_0xf323('0xc3')]);_0x34003e[_0xf323('0x4b')]=_['keys'](_0x1d534f['query']);_0x34003e['filters']=_['intersection'](_0x34003e[_0xf323('0x49')],_0x34003e['query']);_0x53c9c5[_0xf323('0x50')]=_[_0xf323('0x4e')](_0x34003e[_0xf323('0x49')],qs[_0xf323('0x4f')](_0x1d534f[_0xf323('0x4b')]['fields']));_0x53c9c5[_0xf323('0x50')]=_0x53c9c5[_0xf323('0x50')]['length']?_0x53c9c5['attributes']:_0x34003e[_0xf323('0x49')];if(_0x1d534f[_0xf323('0x4b')][_0xf323('0xc4')]){_0x53c9c5[_0xf323('0xc5')]=[{'all':!![]}];}_0x53c9c5=_[_0xf323('0xc6')]({},_0x53c9c5,_0x1d534f[_0xf323('0xc7')]);return db[_0xf323('0xad')][_0xf323('0x7b')](_0x53c9c5)['then'](handleEntityNotFound(_0x4914da,null))['then'](respondWithResult(_0x4914da,null))[_0xf323('0x46')](handleError(_0x4914da,null));};exports[_0xf323('0xc8')]=function(_0x2dffc1,_0x4ab7cb){return db[_0xf323('0xad')]['create'](_0x2dffc1['body'],{})[_0xf323('0x27')](respondWithResult(_0x4ab7cb,0xc9))[_0xf323('0x46')](handleError(_0x4ab7cb,null));};exports[_0xf323('0x3a')]=function(_0x225fc9,_0x47b370){if(_0x225fc9[_0xf323('0xc9')]['id']){delete _0x225fc9[_0xf323('0xc9')]['id'];}return db[_0xf323('0xad')][_0xf323('0x7b')]({'where':{'id':_0x225fc9[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x47b370,null))['then'](saveUpdates(_0x225fc9[_0xf323('0xc9')],null))[_0xf323('0x27')](respondWithResult(_0x47b370,null))[_0xf323('0x46')](handleError(_0x47b370,null));};exports[_0xf323('0xca')]=function(_0x3bd242,_0x208860){return db[_0xf323('0xad')][_0xf323('0x7b')]({'where':{'id':_0x3bd242[_0xf323('0xc2')]['id']}})['then'](handleEntityNotFound(_0x208860,null))[_0xf323('0x27')](removeEntity(_0x208860,null))[_0xf323('0x46')](handleError(_0x208860,null));};exports[_0xf323('0xcb')]=function(_0xcf3ca1,_0x2f99d9){return db['ChatInteraction'][_0xf323('0xcb')]()[_0xf323('0x27')](respondWithResult(_0x2f99d9,null))[_0xf323('0x46')](handleError(_0x2f99d9,null));};exports[_0xf323('0xcc')]=function(_0xd5d557,_0x2409c9){var _0x297107=_0xd5d557[_0xf323('0xc2')]['id'];var _0x57162c;var _0x2b75c4;var _0x23ec08;return db[_0xf323('0xad')][_0xf323('0xcd')]({'where':{'id':_0x297107}})[_0xf323('0x27')](function(_0x1f1e6d){_0x57162c=_0x1f1e6d;return db[_0xf323('0xce')][_0xf323('0xcd')]({'where':{'id':_0x1f1e6d[_0xf323('0x8b')]},'attributes':['id',_0xf323('0xcf'),'vidaooEscalation'],'raw':!![]});})[_0xf323('0x27')](function(_0x34d500){if(_0x34d500&&_0x34d500['vidaooApiKey']&&_0x34d500[_0xf323('0xd0')]){_0x2b75c4=_0x34d500;var _0x2a75dc={'rejectUnauthorized':![],'method':_0xf323('0xd1'),'uri':_0xf323('0xd2'),'headers':{'X-APIKEY':_0x34d500[_0xf323('0xcf')]},'body':{'name':_0xf323('0xd3')+_0x297107},'redirect':'follow','json':!![]};return rp(_0x2a75dc);}else{throw new db['Sequelize']['ValidationError'](_0xf323('0xd4'));}})[_0xf323('0x27')](function(_0x5f72f4){_0x23ec08=_0x5f72f4;if(_0x23ec08['id']){var _0x29206f={'body':_0x23ec08['join_url'],'ChatWebsiteId':_0x2b75c4['id'],'ChatInteractionId':_0x57162c['id'],'direction':_0xf323('0xd5'),'UserId':_0xd5d557[_0xf323('0xd6')]['id']};return db['ChatMessage'][_0xf323('0xc8')](_0x29206f,{});}else{throw new db[(_0xf323('0x23'))]['ValidationError'](_0xf323('0xd7'));}})[_0xf323('0x27')](function(){return _0x57162c[_0xf323('0xd8')]({'vidaooSessionId':_0x23ec08['id']});})[_0xf323('0x27')](respondWithResult(_0x2409c9,null))['catch'](handleError(_0x2409c9,null));};exports[_0xf323('0xd9')]=function(_0x33eaec,_0x44c50){if(_0x33eaec[_0xf323('0xc9')]['id']){delete _0x33eaec[_0xf323('0xc9')]['id'];}return db['ChatInteraction'][_0xf323('0x7b')]({'where':{'id':_0x33eaec[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x44c50,null))[_0xf323('0x27')](saveUpdates(_0x33eaec[_0xf323('0xc9')],null))[_0xf323('0x27')](respondWithResult(_0x44c50,null))[_0xf323('0x46')](handleError(_0x44c50,null));};exports['abandon']=function(_0x45368e,_0x32824f,_0x38c95a){if(_0x45368e[_0xf323('0xc9')]['id']){delete _0x45368e[_0xf323('0xc9')]['id'];}return db[_0xf323('0xad')]['find']({'where':{'id':_0x45368e[_0xf323('0xc2')]['id']}})['then'](function(_0x3c82b5){if(!_0x3c82b5){logger[_0xf323('0x2d')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xf323('0xda'),0x194,_0xf323('0xdb'));_0x32824f['sendStatus'](0x194);}else{if(_0x3c82b5['UserId']){throw new db[(_0xf323('0x23'))][(_0xf323('0x24'))](_0xf323('0xdc'));}}return _0x3c82b5;})[_0xf323('0x27')](function(_0x43db55){if(_0x43db55){return _0x43db55[_0xf323('0x3a')]({'closed':_0x45368e[_0xf323('0xc9')][_0xf323('0xdd')],'disposition':_0x45368e[_0xf323('0xc9')][_0xf323('0xde')]})['then'](function(_0x192e61){return _0x192e61;});}})[_0xf323('0x27')](function(_0x5487b0){return respondWithRpcPromise(_0xf323('0xdf'),'abandon',_0x45368e[_0xf323('0xc9')],client9004);})[_0xf323('0x27')](respondWithResult(_0x32824f,null))[_0xf323('0x46')](handleError(_0x32824f,null));};exports[_0xf323('0xe0')]=function(_0xaf34a7,_0x4316ba,_0x43d6e6){_0xaf34a7[_0xf323('0xc9')][_0xf323('0x4a')]=_0xaf34a7['file'][_0xf323('0xe1')];_0xaf34a7[_0xf323('0xc9')][_0xf323('0xe2')]=_0xaf34a7[_0xf323('0xe3')][_0xf323('0xe4')];_0xaf34a7[_0xf323('0xc9')][_0xf323('0x87')]=_0xaf34a7[_0xf323('0xe3')][_0xf323('0xe5')];return db[_0xf323('0xe6')][_0xf323('0xc8')](_0xaf34a7['body'])['then'](respondWithResult(_0x4316ba,0xc9))[_0xf323('0x46')](handleError(_0x4316ba,null));};exports[_0xf323('0xe7')]=function(_0x66b6c5,_0x21d723,_0x56e3e0){return db['ChatInteraction']['findOne']({'where':{'id':_0x66b6c5['params']['id']},'raw':!![]})[_0xf323('0x27')](handleEntityNotFound(_0x21d723,null))[_0xf323('0x27')](function(_0x310050){if(_0x310050){if(_0x310050[_0xf323('0xdd')]){return _0x21d723[_0xf323('0x31')](0x193)[_0xf323('0x32')]({'status':0x193,'message':'Unauthorized'});}return db[_0xf323('0xe6')][_0xf323('0xcd')]({'where':{'id':_0x66b6c5['query']['attachId']},'raw':!![]})[_0xf323('0x27')](handleEntityNotFound(_0x21d723,null));}})[_0xf323('0x27')](function(_0x3ef481){if(_0x3ef481){return _0x21d723[_0xf323('0xe8')](path[_0xf323('0xe9')](config[_0xf323('0xea')],'server/files/attachments/',_0x3ef481[_0xf323('0xe2')]));}})['catch'](handleError(_0x21d723,null));};exports['close']=function(_0x1123cc,_0x133040){var _0x34fac4=null;var _0x159080=null;var _0x34c2a2=null;var _0x48bc44=null;if(_0x1123cc[_0xf323('0xc9')]['id']){delete _0x1123cc[_0xf323('0xc9')]['id'];}if(_0x1123cc['body'][_0xf323('0xeb')]){_0x48bc44=path['join'](config['root'],_0xf323('0xec'),util['format'](_0xf323('0xed'),Date[_0xf323('0xee')]()));_0x1123cc[_0xf323('0xc9')]['pathTranscript']=_0x48bc44;}return db[_0xf323('0xad')][_0xf323('0x7b')]({'where':{'id':_0x1123cc['params']['id']},'include':[{'model':db[_0xf323('0xef')],'as':'Messages','include':[{'model':db[_0xf323('0x82')],'as':_0xf323('0x82')}]}]})[_0xf323('0x27')](handleEntityNotFound(_0x133040,null))[_0xf323('0x27')](saveUpdates(_0x1123cc[_0xf323('0xc9')],null))[_0xf323('0x27')](function(_0x222b46){if(_0x222b46){_0x34fac4=_0x222b46;return db[_0xf323('0xce')][_0xf323('0x7b')]({'where':{'id':_0x34fac4['ChatWebsiteId']}});}})[_0xf323('0x27')](function(_0x2a005b){if(_0x2a005b){_0x34c2a2=_0x2a005b;return db[_0xf323('0xf0')][_0xf323('0x7b')]({'where':{'id':_0x34fac4['ContactId']}});}})[_0xf323('0x27')](function(_0x3665f3){if(_0x3665f3){_0x159080=_0x3665f3;if(_0x48bc44){var _0x2b5870=null;for(var _0x304899=0x1;_0x304899<_0x34fac4['Messages'][_0xf323('0x71')];++_0x304899){_0x2b5870=_0x34fac4[_0xf323('0xf1')][_0x304899];var _0x2309d1=_0x2b5870[_0xf323('0x85')]?util[_0xf323('0xf2')](_0xf323('0xf3'),_0x34c2a2[_0xf323('0xf4')],_0x2b5870[_0xf323('0x85')]):_0xf323('0xf5');var _0x3a6587=_0x1123cc[_0xf323('0xc9')][_0xf323('0xf6')]||util['format'](_0xf323('0xf3'),_0xf323('0xf7'),_0x2b5870[_0xf323('0x7c')]);switch(_0x34c2a2[_0xf323('0xf8')]){case'website_alias':_0x2309d1=_0x2b5870[_0xf323('0x85')]?util[_0xf323('0xf2')](_0xf323('0xf3'),_0x34c2a2['agentAlias'],_0x2b5870[_0xf323('0x85')]):_0xf323('0xf5');break;case _0xf323('0xf9'):_0x2309d1=_0x2b5870['UserId']?_0x2b5870[_0xf323('0x82')]['alias']||_0x2b5870[_0xf323('0x82')][_0xf323('0x40')]:_0xf323('0xf5');break;case _0xf323('0xfa'):_0x2309d1=_0x2b5870[_0xf323('0x85')]?_0x2b5870[_0xf323('0x82')]['fullname']:_0xf323('0xf5');break;default:_0x2309d1=_0x2b5870[_0xf323('0x85')]?util[_0xf323('0xf2')](_0xf323('0xf3'),_0x34c2a2[_0xf323('0xf4')],_0x2b5870[_0xf323('0x85')]):_0xf323('0xf5');}var _0x5af161=util[_0xf323('0xf2')]('[%s]\x20%s:\x20%s\x0a',moment(_0x2b5870[_0xf323('0x8e')])[_0xf323('0xf2')](_0xf323('0xfb')),_0x2b5870[_0xf323('0xfc')]==='in'?_0x3a6587:_0x2309d1,_0x2b5870[_0xf323('0xc9')]);if(!_0x2b5870[_0xf323('0xfd')]){fs[_0xf323('0xfe')](_0x48bc44,_0x5af161);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf323('0xff'),'raw':!![]}]});}}})[_0xf323('0x27')](function(_0x25bd4d){if(_0x25bd4d&&_0x25bd4d['Smtp']&&_0x1123cc['body']){var _0x1836a5={'tls':{'rejectUnauthorized':![]}};if(_0x25bd4d['Smtp'][_0xf323('0x100')]){_0x1836a5[_0xf323('0x100')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x100')];}else{_0x1836a5[_0xf323('0x101')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x101')];_0x1836a5[_0xf323('0x102')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x102')];_0x1836a5[_0xf323('0x103')]=_0x25bd4d[_0xf323('0xff')][_0xf323('0x103')];}if(_0x25bd4d[_0xf323('0xff')][_0xf323('0x104')]){_0x1836a5[_0xf323('0x105')]={'user':_0x25bd4d['Smtp'][_0xf323('0xd6')],'pass':_0x25bd4d[_0xf323('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf323('0x106'),{'account':_0x1836a5,'message':{'from':util['format'](_0xf323('0x107'),_0x25bd4d[_0xf323('0x4a')],_0x25bd4d['email']||_0x25bd4d[_0xf323('0xff')][_0xf323('0xd6')]),'to':_0x1123cc[_0xf323('0xc9')]['mailTranscript'],'subject':_0xf323('0x108'),'text':util['format'](_0xf323('0x109'),_0x1123cc[_0xf323('0xc9')][_0xf323('0xeb')]),'attachments':[{'path':_0x48bc44}]}})[_0xf323('0x27')](function(){return _0x34fac4;})[_0xf323('0x46')](function(_0x4068d7){console[_0xf323('0x2d')](_0x4068d7);});}else{return _0x34fac4;}})['then'](respondWithStatusCode(_0x133040,0xc8))[_0xf323('0x46')](handleError(_0x133040,null));};exports[_0xf323('0x10a')]=function(_0x1c5bcf,_0x406bd6,_0x28d50f){return db[_0xf323('0xef')]['find']({'where':{'id':_0x1c5bcf[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x406bd6,null))[_0xf323('0x27')](function(_0x305680){if(_0x305680){return _0x305680['addMessage'](_0x1c5bcf[_0xf323('0xc9')][_0xf323('0x10b')],_['omit'](_0x1c5bcf['body'],['ids','id'])||{});}})[_0xf323('0x27')](respondWithResult(_0x406bd6,null))[_0xf323('0x46')](handleError(_0x406bd6,null));};exports[_0xf323('0x10c')]=function(_0x2adc91,_0x51fc4f,_0x1e8abd){var _0x1f80af={'raw':![],'where':{}};var _0x92a2ff={};var _0x51b00e={'count':0x0,'rows':[]};return db[_0xf323('0xad')]['findOne']({'where':{'id':_0x2adc91[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x51fc4f,null))['then'](function(_0x3e9e09){if(_0x3e9e09){_0x92a2ff[_0xf323('0x49')]=_[_0xf323('0x4c')](db[_0xf323('0xef')][_0xf323('0xc3')]);_0x92a2ff[_0xf323('0x4b')]=_[_0xf323('0x4c')](_0x2adc91[_0xf323('0x4b')]);_0x92a2ff[_0xf323('0x4d')]=_[_0xf323('0x4e')](_0x92a2ff[_0xf323('0x49')],_0x92a2ff[_0xf323('0x4b')]);_0x1f80af[_0xf323('0x50')]=_[_0xf323('0x4e')](_0x92a2ff[_0xf323('0x49')],qs['fields'](_0x2adc91['query'][_0xf323('0x4f')]));_0x1f80af[_0xf323('0x50')]=_0x1f80af['attributes'][_0xf323('0x71')]?_0x1f80af['attributes']:_0x92a2ff[_0xf323('0x49')];if(!_0x2adc91['query'][_0xf323('0x10d')](_0xf323('0x51'))){_0x1f80af['limit']=qs[_0xf323('0x52')](_0x2adc91[_0xf323('0x4b')]['limit']);_0x1f80af['offset']=qs[_0xf323('0x34')](_0x2adc91[_0xf323('0x4b')][_0xf323('0x34')]);}_0x1f80af[_0xf323('0x53')]=qs[_0xf323('0x54')](_0x2adc91[_0xf323('0x4b')][_0xf323('0x54')]);_0x1f80af['where']=qs[_0xf323('0x4d')](_[_0xf323('0x56')](_0x2adc91[_0xf323('0x4b')],_0x92a2ff[_0xf323('0x4d')]));_0x1f80af[_0xf323('0x55')][_0xf323('0xbf')]=_0x3e9e09['id'];if(_0x2adc91['query'][_0xf323('0x98')]){_0x1f80af[_0xf323('0x55')]=_[_0xf323('0xc6')](_0x1f80af[_0xf323('0x55')],{'$or':_[_0xf323('0x3f')](_0x1f80af[_0xf323('0x50')],function(_0x60a04b){var _0x1cfee7={};_0x1cfee7[_0x60a04b]={'$like':'%'+_0x2adc91[_0xf323('0x4b')][_0xf323('0x98')]+'%'};return _0x1cfee7;})});}if(_0x2adc91[_0xf323('0x4b')][_0xf323('0x10e')]){var _0x475de5=_0x2adc91['query'][_0xf323('0x10e')][_0xf323('0x43')](',');var _0x4c8e1c={};_0x4c8e1c[_0x475de5[0x0]]={'$gte':moment(_0x475de5[0x1])[_0xf323('0xf2')](_0xf323('0x10f'))};_0x1f80af[_0xf323('0x55')]=_['merge'](_0x1f80af[_0xf323('0x55')],_0x4c8e1c);}_0x1f80af=_[_0xf323('0xc6')]({},_0x1f80af,_0x2adc91[_0xf323('0xc7')]);return db[_0xf323('0xef')][_0xf323('0x33')]({'where':_0x1f80af['where']})[_0xf323('0x27')](function(_0x52bcaf){_0x51b00e[_0xf323('0x33')]=_0x52bcaf;if(_0x2adc91[_0xf323('0x4b')][_0xf323('0xc4')]){_0x1f80af['include']=[{'all':!![]}];}return db[_0xf323('0xef')][_0xf323('0x110')](_0x1f80af);})[_0xf323('0x27')](function(_0x52ffbe){_0x51b00e[_0xf323('0x111')]=_0x52ffbe;return _0x51b00e;});}})['then'](respondWithFilteredResult(_0x51fc4f,_0x1f80af))['catch'](handleError(_0x51fc4f,null));};exports[_0xf323('0x112')]=function(_0x278588,_0x5a36ae,_0x36992a){var _0x2ca568={'where':{}},_0x3a0fa5={},_0x5e6d69={'count':0x0,'rows':[]};return db[_0xf323('0xad')][_0xf323('0xcd')]({'where':{'id':_0x278588['params']['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x5a36ae,null))['then'](function(_0x5aec46){if(_0x5aec46){_0x3a0fa5[_0xf323('0x49')]=_[_0xf323('0x4c')](db[_0xf323('0xef')]['rawAttributes']);_0x3a0fa5[_0xf323('0x4b')]=_['keys'](_0x278588[_0xf323('0x4b')]);_0x3a0fa5[_0xf323('0x4d')]=_[_0xf323('0x4e')](_0x3a0fa5['model'],_0x3a0fa5[_0xf323('0x4b')]);_0x2ca568['attributes']=_['intersection'](_0x3a0fa5['model'],qs[_0xf323('0x4f')](_0x278588[_0xf323('0x4b')][_0xf323('0x4f')]));_0x2ca568['attributes']=_0x2ca568['attributes'][_0xf323('0x71')]?_0x2ca568['attributes']:_0x3a0fa5['model'];if(!_0x278588[_0xf323('0x4b')]['hasOwnProperty'](_0xf323('0x51'))){_0x2ca568[_0xf323('0x52')]=qs[_0xf323('0x52')](_0x278588[_0xf323('0x4b')][_0xf323('0x52')]);_0x2ca568[_0xf323('0x34')]=qs[_0xf323('0x34')](_0x278588[_0xf323('0x4b')][_0xf323('0x34')]);}_0x2ca568['order']=qs[_0xf323('0x54')](_0x278588[_0xf323('0x4b')]['sort']);_0x2ca568[_0xf323('0x55')]=qs[_0xf323('0x4d')](_['pick'](_0x278588[_0xf323('0x4b')],_0x3a0fa5[_0xf323('0x4d')]));_0x2ca568[_0xf323('0x55')][_0xf323('0xbf')]=_0x5aec46['id'];if(_0x278588[_0xf323('0x4b')][_0xf323('0x98')]){_0x2ca568[_0xf323('0x55')]=_[_0xf323('0xc6')](_0x2ca568[_0xf323('0x55')],{'$or':_[_0xf323('0x3f')](_0x2ca568[_0xf323('0x50')],function(_0x28ac5d){var _0x4273c3={};_0x4273c3[_0x28ac5d]={'$like':'%'+_0x278588[_0xf323('0x4b')][_0xf323('0x98')]+'%'};return _0x4273c3;})});}_0x2ca568[_0xf323('0x55')][_0xf323('0xfd')]=![];if(_0x278588[_0xf323('0x4b')]['id']){_0x2ca568[_0xf323('0x55')]['id']={'$gt':_0x278588[_0xf323('0x4b')]['id']};}_0x2ca568=_['merge']({},_0x2ca568,_0x278588['options']);return db['ChatMessage'][_0xf323('0x33')]({'where':_0x2ca568['where']})[_0xf323('0x27')](function(_0x2d9822){_0x5e6d69[_0xf323('0x33')]=_0x2d9822;_0x2ca568[_0xf323('0xc5')]=[];if(_0x278588[_0xf323('0x4b')][_0xf323('0x113')]){_0x2ca568[_0xf323('0xc5')]['push']({'model':db[_0xf323('0x82')],'as':'User','attributes':['id',_0xf323('0x40'),_0xf323('0x114')]});}if(_0x278588['query'][_0xf323('0xc4')]){_0x2ca568[_0xf323('0xc5')]=[{'all':!![]}];}return db[_0xf323('0xef')][_0xf323('0x110')](_0x2ca568);})[_0xf323('0x27')](function(_0xeb3641){_0x5e6d69[_0xf323('0x111')]=_0xeb3641;return _0x5e6d69;});}})[_0xf323('0x27')](respondWithFilteredResult(_0x5a36ae,_0x2ca568))[_0xf323('0x46')](handleError(_0x5a36ae,null));};exports[_0xf323('0x115')]=function(_0x1ea2bc,_0x2bc841,_0xede2f5){return db[_0xf323('0xad')]['find']({'where':{'id':_0x1ea2bc[_0xf323('0xc2')]['id']}})[_0xf323('0x27')](handleEntityNotFound(_0x2bc841,null))[_0xf323('0x27')](function(_0x4685aa){if(_0x4685aa){return _0x4685aa[_0xf323('0x116')](_0x1ea2bc['body'][_0xf323('0x10b')],_[_0xf323('0x117')](_0x1ea2bc[_0xf323('0xc9')],[_0xf323('0x10b'),'id'])||{})[_0xf323('0x118')](function(){return db[_0xf323('0x7f')]['findAll']({'attributes':['id',_0xf323('0x4a'),_0xf323('0x59')],'where':{'id':_0x1ea2bc[_0xf323('0xc9')][_0xf323('0x10b')]}});})[_0xf323('0x27')](function(_0x22c859){socket[_0xf323('0x119')]('chatInteractionTags:save',{'id':Number(_0x1ea2bc[_0xf323('0xc2')]['id']),'tags':_0x22c859||[]});return{'id':Number(_0x1ea2bc[_0xf323('0xc2')]['id']),'tags':_0x22c859||[]};});}})[_0xf323('0x27')](respondWithResult(_0x2bc841,null))['catch'](handleError(_0x2bc841,null));};exports[_0xf323('0x11a')]=function(_0x5d1897,_0x46a215,_0x2c0eb0){return db['ChatInteraction'][_0xf323('0x7b')]({'where':{'id':_0x5d1897[_0xf323('0xc2')]['id']}})['then'](handleEntityNotFound(_0x46a215,null))[_0xf323('0x27')](function(_0x158624){if(_0x158624){return _0x158624[_0xf323('0x11a')](_0x5d1897[_0xf323('0x4b')][_0xf323('0x10b')]);}})['then'](respondWithStatusCode(_0x46a215,null))[_0xf323('0x46')](handleError(_0x46a215,null));};exports[_0xf323('0xe8')]=function(_0x32d6e6,_0x4902ad){var _0x110c46=moment()[_0xf323('0x11b')]()[_0xf323('0xab')]();var _0x45f6ea=path['join'](config['root'],'server','files',_0xf323('0x11c'));var _0xd80f1a=path[_0xf323('0xe9')](config['root'],_0xf323('0x11d'),'files','attachments');var _0x4125c2=path[_0xf323('0xe9')](_0x45f6ea,_0x110c46);var _0x2940da=util[_0xf323('0xf2')](_0xf323('0x11e'),_0x32d6e6['params']['id'],_0x110c46);var _0x5dc95e=path['join'](_0x45f6ea,_0x2940da);var _0x4ce60a=[];_0x4ce60a[_0xf323('0x45')]({'model':db[_0xf323('0x82')],'as':_0xf323('0x82'),'attributes':['id','fullname'],'raw':!![]});_0x4ce60a['push']({'model':db[_0xf323('0xf0')],'as':_0xf323('0x76'),'attributes':['id',_0xf323('0x11f'),'lastName'],'raw':!![]});if(_0x32d6e6[_0xf323('0x4b')][_0xf323('0x120')]){_0x4ce60a[_0xf323('0x45')]({'model':db[_0xf323('0xe6')],'as':_0xf323('0xe6'),'raw':!![]});}var _0x4437c4=[{'model':db[_0xf323('0xef')],'as':_0xf323('0xf1'),'attributes':['id','body',_0xf323('0x8e'),'direction','secret',_0xf323('0x95')],'include':_0x4ce60a}];_0x4437c4[_0xf323('0x45')]({'model':db[_0xf323('0xce')],'as':_0xf323('0x121'),'attributes':['id',_0xf323('0x4a')]});_0x4437c4['push']({'model':db[_0xf323('0x82')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction'][_0xf323('0x7b')]({'where':{'id':_0x32d6e6['params']['id']},'include':_0x4437c4})[_0xf323('0x27')](handleEntityNotFound(_0x4902ad,null))[_0xf323('0x27')](function(_0x24c285){if(_0x24c285){var _0x6ba94a=_0x24c285['get']({'plain':!![]});fs[_0xf323('0x122')](_0x4125c2);var _0x45a36e={'format':'A4','border':_0xf323('0x123'),'header':{'height':_0xf323('0x124'),'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':_0xf323('0x125'),'contents':{'default':util[_0xf323('0xf2')](_0xf323('0x126'),util[_0xf323('0xf2')](_0xf323('0x127'),_0xf323('0x128'),_0x6ba94a['id']),moment()[_0xf323('0xf2')]('YYYY-MM-DD')['toString']())}}};var _0x159fa8={'channel':_0xf323('0x128'),'account':_0x6ba94a['Account'][_0xf323('0x4a')],'agent':_0x6ba94a[_0xf323('0x129')]?_0x6ba94a[_0xf323('0x129')]['fullname']:_0xf323('0x12a'),'createdAt':moment(_0x6ba94a['createdAt'])[_0xf323('0xf2')](_0xf323('0x10f'))['toString'](),'closedAt':_0x6ba94a[_0xf323('0xdd')]?moment(_0x6ba94a[_0xf323('0x12b')])[_0xf323('0xf2')](_0xf323('0x10f'))['toString']():'','disposition':_0x6ba94a['disposition'],'chatInfo':{'browser':_0x6ba94a[_0xf323('0x12c')],'os':_0x6ba94a['osName'],'referer':_0x6ba94a[_0xf323('0x12d')],'customerIp':_0x6ba94a[_0xf323('0x12e')],'customerPort':_0x6ba94a[_0xf323('0x12f')]?_0x6ba94a[_0xf323('0x12f')]:_0xf323('0x12a')},'messages':_(_0x6ba94a[_0xf323('0xf1')])[_0xf323('0x130')]()[_0xf323('0x98')]({'secret':![]})[_0xf323('0x3f')](function(_0x435051){if(_0x435051['Attachment']){var _0xdec264=path[_0xf323('0xe9')](_0xd80f1a,_0x435051[_0xf323('0xe6')]['basename']);if(fs[_0xf323('0x131')](_0xdec264)){fs['createReadStream'](_0xdec264)[_0xf323('0x132')](fs[_0xf323('0x133')](path[_0xf323('0xe9')](_0x4125c2,_0x435051[_0xf323('0xe6')]['basename'])));}}return{'date':moment(_0x435051[_0xf323('0x8e')])['format'](_0xf323('0x10f'))[_0xf323('0xab')](),'sender':_0x435051[_0xf323('0xfc')]===_0xf323('0xd5')?_0x435051['User']?_0x435051[_0xf323('0x82')][_0xf323('0x40')]:'System':_0x435051[_0xf323('0x76')][_0xf323('0x11f')]+(_0x435051[_0xf323('0x76')][_0xf323('0x134')]?'\x20'+_0x435051[_0xf323('0x76')][_0xf323('0x134')]:''),'body':_0x435051['Attachment']?_0x435051[_0xf323('0xe6')][_0xf323('0xe2')]:_0x435051['body'],'direction':_0x435051['direction']===_0xf323('0xd5')?'A':'C','secret':_0x435051[_0xf323('0xfd')],'read':_0x435051['read'],'attachment':_0x435051['Attachment']};})[_0xf323('0x73')]()};return ejs[_0xf323('0x135')](path['join'](config[_0xf323('0xea')],_0xf323('0x11d'),'views',_0xf323('0x136')),{'interaction':_0x159fa8})[_0xf323('0x27')](function(_0x4665a3){return new BPromise(function(_0x6432fc,_0x112d75){pdf[_0xf323('0xc8')](_0x4665a3,_0x45a36e)[_0xf323('0x137')](path['join'](_0x4125c2,'transcript-'+_0x6ba94a['id']+'-'+_0x110c46+'.pdf'),function(_0x29320e,_0xa2c54d){if(_0x29320e)return _0x112d75(_0x29320e);_0x6432fc(_0xa2c54d);});});})[_0xf323('0x27')](function(){return new BPromise(function(_0x3072e8,_0x4568eb){zipdir(_0x4125c2,{'saveTo':_0x5dc95e},function(_0x3bb14b,_0x5a60c4){if(_0x3bb14b)return _0x4568eb(_0x3bb14b);return _0x3072e8(_0x5a60c4);});})[_0xf323('0x27')](function(){return new BPromise(function(_0x31bb0e,_0x70872f){rimraf(_0x4125c2,function(_0x4b4435){if(_0x4b4435)_0x70872f(_0x4b4435);return _0x31bb0e();});});})[_0xf323('0x27')](function(){return _0x4902ad[_0xf323('0xe8')](_0x5dc95e,_0x2940da,function(_0x3625a2){if(_0x3625a2){console[_0xf323('0x138')](_0xf323('0x139'),_0x3625a2);}else{fs[_0xf323('0x13a')](_0x5dc95e);}});});});}else{return _0x4902ad['sendStatus'](0xc8);}})[_0xf323('0x46')](handleError(_0x4902ad,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 1d3114b..ac0ee96 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 _0x736c=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','setDataValue','length','emit','catch','hasOwnProperty','hook'];(function(_0xde4288,_0x29ffa9){var _0x5d9a57=function(_0xd2b305){while(--_0xd2b305){_0xde4288['push'](_0xde4288['shift']());}};_0x5d9a57(++_0x29ffa9);}(_0x736c,0x190));var _0xc736=function(_0x33be9b,_0x1d357b){_0x33be9b=_0x33be9b-0x0;var _0x121164=_0x736c[_0x33be9b];return _0x121164;};'use strict';var EventEmitter=require(_0xc736('0x0'));var ChatInteraction=require(_0xc736('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xc736('0x1'))['db'][_0xc736('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc736('0x3')](0x0);var events={'afterCreate':_0xc736('0x4'),'afterUpdate':_0xc736('0x5'),'afterDestroy':_0xc736('0x6')};function emitEvent(_0xb57164){return function(_0x3f00f0,_0x4c262f,_0x5b2a92){_0x3f00f0[_0xc736('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x58245d){_0x3f00f0['setDataValue'](_0xc736('0x8'),_0x58245d[_0xc736('0x9')](function(_0x268e4a){return{'id':_0x268e4a['id']};}));return ChatMessage[_0xc736('0xa')]({'where':{'ChatInteractionId':_0x3f00f0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc736('0xb')](function(_0x21458b){_0x3f00f0[_0xc736('0xc')]('unreadMessages',_0x21458b[_0xc736('0xd')]);ChatInteractionEvents[_0xc736('0xe')](_0xb57164+':'+_0x3f00f0['id'],_0x3f00f0);ChatInteractionEvents[_0xc736('0xe')](_0xb57164,_0x3f00f0);_0x5b2a92(null);})[_0xc736('0xf')](_0x5b2a92(null));};}for(var e in events){if(events[_0xc736('0x10')](e)){var event=events[e];ChatInteraction[_0xc736('0x11')](e,emitEvent(event));}}module[_0xc736('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0xc7ce=['hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','then','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x525d35,_0xe67489){var _0x4813d2=function(_0x4a6dc8){while(--_0x4a6dc8){_0x525d35['push'](_0x525d35['shift']());}};_0x4813d2(++_0xe67489);}(_0xc7ce,0x18e));var _0xec7c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc7ce[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0xec7c('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xec7c('0x1')];var ChatMessage=require(_0xec7c('0x2'))['db'][_0xec7c('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xec7c('0x4')](0x0);var events={'afterCreate':_0xec7c('0x5'),'afterUpdate':_0xec7c('0x6'),'afterDestroy':_0xec7c('0x7')};function emitEvent(_0x5aecc4){return function(_0x4b9037,_0x18b845,_0x4cb5db){_0x4b9037['getUsers']({'attributes':['id'],'raw':!![]})[_0xec7c('0x8')](function(_0x4d6931){_0x4b9037['setDataValue']('Users',_0x4d6931['map'](function(_0x20b06c){return{'id':_0x20b06c['id']};}));return ChatMessage[_0xec7c('0x9')]({'where':{'ChatInteractionId':_0x4b9037['id'],'direction':'in','read':![]},'raw':!![]});})[_0xec7c('0x8')](function(_0x4c2caf){_0x4b9037[_0xec7c('0xa')](_0xec7c('0xb'),_0x4c2caf[_0xec7c('0xc')]);ChatInteractionEvents[_0xec7c('0xd')](_0x5aecc4+':'+_0x4b9037['id'],_0x4b9037);ChatInteractionEvents[_0xec7c('0xd')](_0x5aecc4,_0x4b9037);_0x4cb5db(null);})[_0xec7c('0xe')](_0x4cb5db(null));};}for(var e in events){if(events[_0xec7c('0xf')](e)){var event=events[e];ChatInteraction[_0xec7c('0x10')](e,emitEvent(event));}}module[_0xec7c('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 4bed9c6..336b129 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 _0x70a2=['ChatInteraction','chat_interactions','format','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','./chatInteraction.attributes','exports','define'];(function(_0x34f2c5,_0x4fbb6a){var _0x2b1049=function(_0x2d1fc){while(--_0x2d1fc){_0x34f2c5['push'](_0x34f2c5['shift']());}};_0x2b1049(++_0x4fbb6a);}(_0x70a2,0x11d));var _0x270a=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0x70a2[_0x2718c7];return _0x59d89c;};'use strict';var _=require(_0x270a('0x0'));var util=require('util');var logger=require(_0x270a('0x1'))(_0x270a('0x2'));var moment=require(_0x270a('0x3'));var BPromise=require(_0x270a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x270a('0x5'));var config=require('../../config/environment');var attributes=require(_0x270a('0x6'));module[_0x270a('0x7')]=function(_0x524220,_0x4532da){return _0x524220[_0x270a('0x8')](_0x270a('0x9'),attributes,{'tableName':_0x270a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35bb80,_0x2d2855,_0x17f221){if(_0x35bb80['changed']('closed')){_0x35bb80['closedAt']=moment()[_0x270a('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x17f221(null,_0x35bb80);}},'charset':_0x270a('0xc'),'collate':_0x270a('0xd')});}; \ No newline at end of file +var _0xe943=['chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xe943,0x1e7));var _0x3e94=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0xe943[_0x4c4042];return _0xbd10dc;};'use strict';var _=require(_0x3e94('0x0'));var util=require(_0x3e94('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3e94('0x2'));var rp=require(_0x3e94('0x3'));var fs=require('fs');var path=require(_0x3e94('0x4'));var rimraf=require(_0x3e94('0x5'));var config=require(_0x3e94('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x3e94('0x7')]=function(_0x3c10c5,_0x67a2d9){return _0x3c10c5[_0x3e94('0x8')]('ChatInteraction',attributes,{'tableName':_0x3e94('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d569e,_0x56768e,_0x3ed678){if(_0x3d569e[_0x3e94('0xa')](_0x3e94('0xb'))){_0x3d569e['closedAt']=moment()[_0x3e94('0xc')](_0x3e94('0xd'));}_0x3ed678(null,_0x3d569e);}},'charset':_0x3e94('0xe'),'collate':_0x3e94('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b9889e4..7c9433d 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 _0x6246=['redis','socket.io-emitter','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','ChatInteraction','update','body','options','raw','attributes','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','where','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6246,0x154));var _0x6624=function(_0x2242bf,_0x23b98d){_0x2242bf=_0x2242bf-0x0;var _0x2dc874=_0x6246[_0x2242bf];return _0x2dc874;};'use strict';var _=require(_0x6624('0x0'));var util=require('util');var moment=require(_0x6624('0x1'));var BPromise=require(_0x6624('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6624('0x3'));var db=require(_0x6624('0x4'))['db'];var utils=require(_0x6624('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6624('0x6'));var jayson=require(_0x6624('0x7'));var client=jayson[_0x6624('0x8')][_0x6624('0x9')]({'port':0x232a});config['redis']=_[_0x6624('0xa')](config[_0x6624('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6624('0xc'))(new Redis(config[_0x6624('0xb')]));require('./chatInteraction.socket')[_0x6624('0xd')](socket);function respondWithRpcPromise(_0x4f2add,_0x330dcd,_0x4bdf43){return new BPromise(function(_0x5820e7,_0x56e625){return client['request'](_0x4f2add,_0x4bdf43)[_0x6624('0xe')](function(_0x4a04bb){logger[_0x6624('0xf')](_0x6624('0x10'),_0x330dcd,_0x6624('0x11'));logger[_0x6624('0x12')](_0x6624('0x13'),_0x330dcd,_0x6624('0x11'),JSON['stringify'](_0x4a04bb));if(_0x4a04bb[_0x6624('0x14')]){if(_0x4a04bb[_0x6624('0x14')]['code']===0x1f4){logger[_0x6624('0x14')](_0x6624('0x10'),_0x330dcd,_0x4a04bb[_0x6624('0x14')][_0x6624('0x15')]);return _0x56e625(_0x4a04bb[_0x6624('0x14')][_0x6624('0x15')]);}logger[_0x6624('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x330dcd,_0x4a04bb[_0x6624('0x14')][_0x6624('0x15')]);return _0x5820e7(_0x4a04bb[_0x6624('0x14')][_0x6624('0x15')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x330dcd,_0x6624('0x11'));_0x5820e7(_0x4a04bb[_0x6624('0x16')][_0x6624('0x15')]);}})[_0x6624('0x17')](function(_0x34c080){logger[_0x6624('0x14')](_0x6624('0x10'),_0x330dcd,_0x34c080);_0x56e625(_0x34c080);});});}exports['UpdateChatInteraction']=function(_0x229839){var _0x54caae=this;return new Promise(function(_0x51a9cf,_0x4c70ee){return db[_0x6624('0x18')][_0x6624('0x19')](_0x229839[_0x6624('0x1a')],{'raw':_0x229839[_0x6624('0x1b')]?_0x229839['options'][_0x6624('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x229839[_0x6624('0x1b')]?_0x229839['options']['where']||null:null,'attributes':_0x229839['options']?_0x229839[_0x6624('0x1b')][_0x6624('0x1d')]||null:null,'limit':_0x229839[_0x6624('0x1b')]?_0x229839[_0x6624('0x1b')]['limit']||null:null})[_0x6624('0xe')](function(_0xc1b225){logger[_0x6624('0xf')](_0x6624('0x1e'),_0x229839);logger['debug'](_0x6624('0x1e'),_0x229839,JSON[_0x6624('0x1f')](_0xc1b225));_0x51a9cf(_0xc1b225);})[_0x6624('0x17')](function(_0x433e1a){logger['error']('UpdateChatInteraction',_0x433e1a[_0x6624('0x15')],_0x229839);_0x4c70ee(_0x54caae[_0x6624('0x14')](0x1f4,_0x433e1a[_0x6624('0x15')]));});});};exports[_0x6624('0x20')]=function(_0x170001){return new Promise(function(_0x1b60f4,_0x55c9fa){return db[_0x6624('0x18')][_0x6624('0x21')]({'where':_0x170001['options']?_0x170001['options'][_0x6624('0x22')]||null:null})[_0x6624('0xe')](function(_0x5cff5e){if(_0x5cff5e){return _0x5cff5e['addTags'](_0x170001[_0x6624('0x1a')][_0x6624('0x23')],_[_0x6624('0x24')](_0x170001[_0x6624('0x1a')],['ids','id'])||{});}})[_0x6624('0x25')](function(_0x527f69){logger[_0x6624('0xf')](_0x6624('0x26'),_0x170001);logger[_0x6624('0x12')]('AddTags',_0x170001,JSON[_0x6624('0x1f')](_0x527f69));_0x1b60f4(_0x527f69);})[_0x6624('0x17')](function(_0x59e3a1){logger[_0x6624('0x14')](_0x6624('0x26'),_0x59e3a1[_0x6624('0x15')],_0x170001);_0x55c9fa(_this[_0x6624('0x14')](0x1f4,_0x59e3a1['message']));});});}; \ No newline at end of file +var _0x8ee1=['register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','raw','where','attributes','limit','UpdateChatInteraction','ChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x8ee1,0x6f));var _0x18ee=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x8ee1[_0x5db99b];return _0x4b2d0e;};'use strict';var _=require(_0x18ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x18ee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18ee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x18ee('0x3'));var logger=require(_0x18ee('0x4'))(_0x18ee('0x5'));var config=require(_0x18ee('0x6'));var jayson=require(_0x18ee('0x7'));var client=jayson[_0x18ee('0x8')][_0x18ee('0x9')]({'port':0x232a});config[_0x18ee('0xa')]=_[_0x18ee('0xb')](config[_0x18ee('0xa')],{'host':_0x18ee('0xc'),'port':0x18eb});var socket=require(_0x18ee('0xd'))(new Redis(config[_0x18ee('0xa')]));require(_0x18ee('0xe'))[_0x18ee('0xf')](socket);function respondWithRpcPromise(_0x3d2b74,_0x116567,_0x30fcf6){return new BPromise(function(_0x470d5a,_0x4b9eb1){return client['request'](_0x3d2b74,_0x30fcf6)[_0x18ee('0x10')](function(_0x4dcbd4){logger[_0x18ee('0x11')](_0x18ee('0x12'),_0x116567,_0x18ee('0x13'));logger[_0x18ee('0x14')](_0x18ee('0x15'),_0x116567,_0x18ee('0x13'),JSON[_0x18ee('0x16')](_0x4dcbd4));if(_0x4dcbd4[_0x18ee('0x17')]){if(_0x4dcbd4[_0x18ee('0x17')][_0x18ee('0x18')]===0x1f4){logger['error'](_0x18ee('0x12'),_0x116567,_0x4dcbd4[_0x18ee('0x17')][_0x18ee('0x19')]);return _0x4b9eb1(_0x4dcbd4[_0x18ee('0x17')][_0x18ee('0x19')]);}logger[_0x18ee('0x17')](_0x18ee('0x12'),_0x116567,_0x4dcbd4[_0x18ee('0x17')][_0x18ee('0x19')]);return _0x470d5a(_0x4dcbd4[_0x18ee('0x17')][_0x18ee('0x19')]);}else{logger['info'](_0x18ee('0x12'),_0x116567,_0x18ee('0x13'));_0x470d5a(_0x4dcbd4[_0x18ee('0x1a')][_0x18ee('0x19')]);}})[_0x18ee('0x1b')](function(_0x4c5d28){logger[_0x18ee('0x17')](_0x18ee('0x12'),_0x116567,_0x4c5d28);_0x4b9eb1(_0x4c5d28);});});}exports['UpdateChatInteraction']=function(_0x1f2cbf){var _0x3e30eb=this;return new Promise(function(_0xf066ce,_0x5962e6){return db['ChatInteraction']['update'](_0x1f2cbf[_0x18ee('0x1c')],{'raw':_0x1f2cbf['options']?_0x1f2cbf[_0x18ee('0x1d')][_0x18ee('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f2cbf[_0x18ee('0x1d')]?_0x1f2cbf['options'][_0x18ee('0x1f')]||null:null,'attributes':_0x1f2cbf['options']?_0x1f2cbf['options'][_0x18ee('0x20')]||null:null,'limit':_0x1f2cbf[_0x18ee('0x1d')]?_0x1f2cbf[_0x18ee('0x1d')][_0x18ee('0x21')]||null:null})['then'](function(_0x492c5b){logger['info'](_0x18ee('0x22'),_0x1f2cbf);logger[_0x18ee('0x14')](_0x18ee('0x22'),_0x1f2cbf,JSON['stringify'](_0x492c5b));_0xf066ce(_0x492c5b);})['catch'](function(_0x2d4523){logger['error'](_0x18ee('0x22'),_0x2d4523[_0x18ee('0x19')],_0x1f2cbf);_0x5962e6(_0x3e30eb[_0x18ee('0x17')](0x1f4,_0x2d4523['message']));});});};exports['AddTagsToChatInteraction']=function(_0x56b1db){return new Promise(function(_0x10016e,_0x7029e7){return db[_0x18ee('0x23')][_0x18ee('0x24')]({'where':_0x56b1db[_0x18ee('0x1d')]?_0x56b1db[_0x18ee('0x1d')]['where']||null:null})[_0x18ee('0x10')](function(_0x26e12f){if(_0x26e12f){return _0x26e12f[_0x18ee('0x25')](_0x56b1db['body'][_0x18ee('0x26')],_[_0x18ee('0x27')](_0x56b1db[_0x18ee('0x1c')],[_0x18ee('0x26'),'id'])||{});}})[_0x18ee('0x28')](function(_0x54e53e){logger[_0x18ee('0x11')](_0x18ee('0x29'),_0x56b1db);logger[_0x18ee('0x14')](_0x18ee('0x29'),_0x56b1db,JSON[_0x18ee('0x16')](_0x54e53e));_0x10016e(_0x54e53e);})[_0x18ee('0x1b')](function(_0x48429f){logger[_0x18ee('0x17')](_0x18ee('0x29'),_0x48429f[_0x18ee('0x19')],_0x56b1db);_0x7029e7(_this[_0x18ee('0x17')](0x1f4,_0x48429f[_0x18ee('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 8759d55..331aa6d 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 _0xdeb7=['remove','update','removeListener','register','length'];(function(_0x3b45a2,_0x1e63e6){var _0x4efc4d=function(_0x4a721d){while(--_0x4a721d){_0x3b45a2['push'](_0x3b45a2['shift']());}};_0x4efc4d(++_0x1e63e6);}(_0xdeb7,0x82));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x7deb('0x0'),_0x7deb('0x1')];function createListener(_0x1c4802,_0x4f1f20){return function(_0x2b2505){_0x4f1f20['emit'](_0x1c4802,_0x2b2505);};}function removeListener(_0x286855,_0x417c3c){return function(){ChatInteractionEvents[_0x7deb('0x2')](_0x286855,_0x417c3c);};}exports[_0x7deb('0x3')]=function(_0x15bb09){for(var _0x5ec230=0x0,_0x24a053=events[_0x7deb('0x4')];_0x5ec230<_0x24a053;_0x5ec230++){var _0x569f16=events[_0x5ec230];var _0xba3484=createListener('chatInteraction:'+_0x569f16,_0x15bb09);ChatInteractionEvents['on'](_0x569f16,_0xba3484);}}; \ No newline at end of file +var _0x3aea=['chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x3aea,0x101));var _0xa3ae=function(_0x13f13f,_0x31328f){_0x13f13f=_0x13f13f-0x0;var _0x49858a=_0x3aea[_0x13f13f];return _0x49858a;};'use strict';var ChatInteractionEvents=require(_0xa3ae('0x0'));var events=[_0xa3ae('0x1'),_0xa3ae('0x2'),_0xa3ae('0x3')];function createListener(_0x14582a,_0x40e1fa){return function(_0x5043ef){_0x40e1fa[_0xa3ae('0x4')](_0x14582a,_0x5043ef);};}function removeListener(_0x3a4161,_0x10e0f3){return function(){ChatInteractionEvents[_0xa3ae('0x5')](_0x3a4161,_0x10e0f3);};}exports['register']=function(_0x177c3e){for(var _0x4f9ea6=0x0,_0x4393a6=events[_0xa3ae('0x6')];_0x4f9ea6<_0x4393a6;_0x4f9ea6++){var _0x3bcbd8=events[_0x4f9ea6];var _0x1d7180=createListener(_0xa3ae('0x7')+_0x3bcbd8,_0x177c3e);ChatInteractionEvents['on'](_0x3bcbd8,_0x1d7180);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index bfe2d8a..c8f6e98 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 _0x8ba6=['isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','/:id','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','removeTags','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x9b2fb1,_0x746c6c){var _0x407f07=function(_0x5e467b){while(--_0x5e467b){_0x9b2fb1['push'](_0x9b2fb1['shift']());}};_0x407f07(++_0x746c6c);}(_0x8ba6,0x11b));var _0x68ba=function(_0x462616,_0x5a325d){_0x462616=_0x462616-0x0;var _0x16eea7=_0x8ba6[_0x462616];return _0x16eea7;};'use strict';var multer=require(_0x68ba('0x0'));var util=require('util');var path=require(_0x68ba('0x1'));var timeout=require('connect-timeout');var express=require(_0x68ba('0x2'));var router=express[_0x68ba('0x3')]();var auth=require(_0x68ba('0x4'));var interaction=require(_0x68ba('0x5'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x68ba('0x6')]('/',auth[_0x68ba('0x7')](),controller[_0x68ba('0x8')]);router[_0x68ba('0x6')](_0x68ba('0x9'),auth[_0x68ba('0x7')](),controller[_0x68ba('0xa')]);router[_0x68ba('0x6')]('/:id',auth[_0x68ba('0xb')](),controller[_0x68ba('0xc')]);router[_0x68ba('0x6')](_0x68ba('0xd'),auth[_0x68ba('0xb')](),controller[_0x68ba('0xe')]);router[_0x68ba('0x6')](_0x68ba('0xf'),auth[_0x68ba('0x7')](),controller[_0x68ba('0x10')]);router['get'](_0x68ba('0x11'),auth[_0x68ba('0xb')](),controller['getMyMessages']);router['get'](_0x68ba('0x12'),auth['isAuthenticated'](),controller[_0x68ba('0x13')]);router[_0x68ba('0x14')]('/',auth[_0x68ba('0x7')](),controller[_0x68ba('0x15')]);router[_0x68ba('0x14')](_0x68ba('0x16'),auth[_0x68ba('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x68ba('0x17')]({'destination':function(_0x1a17c2,_0x1ce168,_0x438dcc){_0x438dcc(null,path[_0x68ba('0x18')](config['root'],_0x68ba('0x19')));},'filename':function(_0x22bcda,_0x48d8e2,_0x575e36){_0x575e36(null,util[_0x68ba('0x1a')](_0x68ba('0x1b'),Date[_0x68ba('0x1c')](),_0x48d8e2[_0x68ba('0x1d')][_0x68ba('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x68ba('0x14')](_0x68ba('0x1f'),upload[_0x68ba('0x20')](_0x68ba('0x21')),controller[_0x68ba('0x22')]);router[_0x68ba('0x14')](_0x68ba('0xf'),auth[_0x68ba('0xb')](),controller['addMessage']);router['post'](_0x68ba('0x23'),auth['isAuthenticated'](),interaction[_0x68ba('0x24')](_0x68ba('0x25'),_0x68ba('0x26')),controller['addTags']);router['put'](_0x68ba('0x27'),auth[_0x68ba('0x7')](),interaction[_0x68ba('0x24')](_0x68ba('0x25'),'chatinteraction:update'),controller['update']);router[_0x68ba('0x28')](_0x68ba('0x29'),controller[_0x68ba('0x2a')]);router['put'](_0x68ba('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0x68ba('0x2c')]);router[_0x68ba('0x28')](_0x68ba('0x2d'),controller['close']);router[_0x68ba('0x2e')]('/:id',auth['isAuthenticated'](),interaction[_0x68ba('0x24')]('chat',_0x68ba('0x2f')),controller['destroy']);router[_0x68ba('0x2e')](_0x68ba('0x23'),auth['isAuthenticated'](),controller[_0x68ba('0x30')]);module['exports']=router; \ No newline at end of file +var _0xef0f=['destroy','removeTags','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','join','root','server/files/attachments/','%s-%s','now','originalname','replace','single','attachmentUpload','addMessage','/:id/tags','addTags','/:id','tracked','chat','chatinteraction:update','update','customUpdate','put','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy'];(function(_0x533b9b,_0x1f4612){var _0x2a96e3=function(_0x1ade52){while(--_0x1ade52){_0x533b9b['push'](_0x533b9b['shift']());}};_0x2a96e3(++_0x1f4612);}(_0xef0f,0x168));var _0xfef0=function(_0x3174a9,_0x19494b){_0x3174a9=_0x3174a9-0x0;var _0x22664a=_0xef0f[_0x3174a9];return _0x22664a;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var auth=require(_0xfef0('0x4'));var interaction=require(_0xfef0('0x5'));var config=require(_0xfef0('0x6'));var controller=require('./chatInteraction.controller');router[_0xfef0('0x7')]('/',auth[_0xfef0('0x8')](),controller[_0xfef0('0x9')]);router[_0xfef0('0x7')](_0xfef0('0xa'),auth[_0xfef0('0x8')](),controller['describe']);router[_0xfef0('0x7')]('/:id',auth[_0xfef0('0xb')](),controller[_0xfef0('0xc')]);router[_0xfef0('0x7')](_0xfef0('0xd'),auth[_0xfef0('0xb')](),controller[_0xfef0('0xe')]);router[_0xfef0('0x7')](_0xfef0('0xf'),auth[_0xfef0('0x8')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x7')](_0xfef0('0x11'),auth[_0xfef0('0xb')](),controller[_0xfef0('0x12')]);router['get'](_0xfef0('0x13'),auth[_0xfef0('0x8')](),controller[_0xfef0('0x14')]);router[_0xfef0('0x15')]('/',auth[_0xfef0('0x8')](),controller[_0xfef0('0x16')]);router[_0xfef0('0x15')]('/:id/vidaoo',auth[_0xfef0('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5acdd0,_0x118b8d,_0x284b6d){_0x284b6d(null,path[_0xfef0('0x17')](config[_0xfef0('0x18')],_0xfef0('0x19')));},'filename':function(_0x3f9a6c,_0x155833,_0x2887e6){_0x2887e6(null,util['format'](_0xfef0('0x1a'),Date[_0xfef0('0x1b')](),_0x155833[_0xfef0('0x1c')][_0xfef0('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfef0('0x15')]('/:id/attachment_upload',upload[_0xfef0('0x1e')]('file'),controller[_0xfef0('0x1f')]);router[_0xfef0('0x15')](_0xfef0('0xf'),auth['isChatInteractionAuthorized'](),controller[_0xfef0('0x20')]);router['post'](_0xfef0('0x21'),auth[_0xfef0('0x8')](),interaction['tracked']('chat','chatinteraction:addtags'),controller[_0xfef0('0x22')]);router['put'](_0xfef0('0x23'),auth[_0xfef0('0x8')](),interaction[_0xfef0('0x24')](_0xfef0('0x25'),_0xfef0('0x26')),controller[_0xfef0('0x27')]);router['put']('/:id/custom_update',controller[_0xfef0('0x28')]);router[_0xfef0('0x29')](_0xfef0('0x2a'),auth[_0xfef0('0xb')](),controller[_0xfef0('0x2b')]);router[_0xfef0('0x29')](_0xfef0('0x2c'),controller[_0xfef0('0x2d')]);router[_0xfef0('0x2e')]('/:id',auth[_0xfef0('0x8')](),interaction[_0xfef0('0x24')](_0xfef0('0x25'),_0xfef0('0x2f')),controller[_0xfef0('0x30')]);router[_0xfef0('0x2e')](_0xfef0('0x21'),auth[_0xfef0('0x8')](),controller[_0xfef0('0x31')]);module[_0xfef0('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index d8378ca..124af82 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 _0x4975=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4975,0x86));var _0x5497=function(_0x36023e,_0x46c0c6){_0x36023e=_0x36023e-0x0;var _0x19baaf=_0x4975[_0x36023e];return _0x19baaf;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'body':{'type':Sequelize[_0x5497('0x1')](_0x5497('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5497('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5497('0x4')]}}; \ No newline at end of file +var _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x6ebfd,_0x2fcad1){var _0x2df645=function(_0x536ee8){while(--_0x536ee8){_0x6ebfd['push'](_0x6ebfd['shift']());}};_0x2df645(++_0x2fcad1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65f6('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index ed6e060..15efb32 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 _0x7cbb=['UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','messages','FromId','ToId','-createdAt','all','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','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','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','find','body','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','user','fullname','userpic','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x25bf54,_0x14cb7d){var _0x575858=function(_0x296fcf){while(--_0x296fcf){_0x25bf54['push'](_0x25bf54['shift']());}};_0x575858(++_0x14cb7d);}(_0x7cbb,0x1bd));var _0xb7cb=function(_0x3a892e,_0x3b89fd){_0x3a892e=_0x3a892e-0x0;var _0x53d557=_0x7cbb[_0x3a892e];return _0x53d557;};'use strict';var pdf=require(_0xb7cb('0x0'));var emlformat=require(_0xb7cb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb7cb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb7cb('0x3'));var moment=require(_0xb7cb('0x4'));var BPromise=require(_0xb7cb('0x5'));var Mustache=require(_0xb7cb('0x6'));var util=require(_0xb7cb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb7cb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb7cb('0x9'));var squel=require(_0xb7cb('0xa'));var crypto=require(_0xb7cb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb7cb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb7cb('0xd'));var Papa=require(_0xb7cb('0xe'));var Redis=require(_0xb7cb('0xf'));var authService=require(_0xb7cb('0x10'));var qs=require(_0xb7cb('0x11'));var as=require(_0xb7cb('0x12'));var hardwareService=require(_0xb7cb('0x13'));var logger=require(_0xb7cb('0x14'))(_0xb7cb('0x15'));var utils=require(_0xb7cb('0x16'));var config=require(_0xb7cb('0x17'));var db=require(_0xb7cb('0x18'))['db'];config[_0xb7cb('0x19')]=_[_0xb7cb('0x1a')](config[_0xb7cb('0x19')],{'host':_0xb7cb('0x1b'),'port':0x18eb});var socket=require(_0xb7cb('0x1c'))(new Redis(config[_0xb7cb('0x19')]));require(_0xb7cb('0x1d'))[_0xb7cb('0x1e')](socket);function respondWithStatusCode(_0x33457e,_0x1855f0){_0x1855f0=_0x1855f0||0xcc;return function(_0xec344a){if(_0xec344a){return _0x33457e[_0xb7cb('0x1f')](_0x1855f0);}return _0x33457e[_0xb7cb('0x20')](_0x1855f0)[_0xb7cb('0x21')]();};}function respondWithResult(_0x11fd63,_0x416369){_0x416369=_0x416369||0xc8;return function(_0xcdb288){if(_0xcdb288){return _0x11fd63[_0xb7cb('0x20')](_0x416369)[_0xb7cb('0x22')](_0xcdb288);}};}function respondWithFilteredResult(_0x1e2021,_0x4ba232){return function(_0x5880d9){if(_0x5880d9){var _0x3cde6c=_0x5880d9[_0xb7cb('0x23')],_0x7ae34=_0x4ba232[_0xb7cb('0x24')],_0x47f370=_0x4ba232[_0xb7cb('0x24')]+_0x4ba232[_0xb7cb('0x25')],_0x27da33;if(_0x47f370>=_0x3cde6c){_0x47f370=_0x3cde6c;_0x27da33=0xc8;}else{_0x27da33=0xce;}_0x1e2021['status'](_0x27da33);return _0x1e2021['set'](_0xb7cb('0x26'),_0x7ae34+'-'+_0x47f370+'/'+_0x3cde6c)[_0xb7cb('0x22')](_0x5880d9);}return null;};}function patchUpdates(_0x5bbb1f){return function(_0xae055){try{jsonpatch[_0xb7cb('0x27')](_0xae055,_0x5bbb1f,!![]);}catch(_0x17a816){return BPromise[_0xb7cb('0x28')](_0x17a816);}return _0xae055[_0xb7cb('0x29')]();};}function saveUpdates(_0x61822e,_0x270439){return function(_0xb86722){if(_0xb86722){return _0xb86722['update'](_0x61822e)[_0xb7cb('0x2a')](function(_0x36725a){return _0x36725a;});}return null;};}function removeEntity(_0xf9e7a5,_0x3b28ef){return function(_0x214b13){if(_0x214b13){return _0x214b13['destroy']()[_0xb7cb('0x2a')](function(){_0xf9e7a5[_0xb7cb('0x20')](0xcc)[_0xb7cb('0x21')]();});}};}function handleEntityNotFound(_0x333160,_0x550584){return function(_0x3f89d7){if(!_0x3f89d7){_0x333160[_0xb7cb('0x1f')](0x194);}return _0x3f89d7;};}function handleError(_0x2f2a08,_0x4288ba){_0x4288ba=_0x4288ba||0x1f4;return function(_0x2c1f48){logger[_0xb7cb('0x2b')](_0x2c1f48[_0xb7cb('0x2c')]);if(_0x2c1f48[_0xb7cb('0x2d')]){delete _0x2c1f48[_0xb7cb('0x2d')];}_0x2f2a08['status'](_0x4288ba)[_0xb7cb('0x2e')](_0x2c1f48);};}exports[_0xb7cb('0x2f')]=function(_0x584a9b,_0x1ff8d5){var _0x17a5de={},_0x528408={},_0x232c6c={'count':0x0,'rows':[]};var _0x38712a=_[_0xb7cb('0x30')](db[_0xb7cb('0x31')][_0xb7cb('0x32')],function(_0xdafbb1){return{'name':_0xdafbb1[_0xb7cb('0x33')],'type':_0xdafbb1[_0xb7cb('0x34')]['key']};});_0x528408[_0xb7cb('0x35')]=_[_0xb7cb('0x30')](_0x38712a,_0xb7cb('0x2d'));_0x528408['query']=_[_0xb7cb('0x36')](_0x584a9b[_0xb7cb('0x37')]);_0x528408[_0xb7cb('0x38')]=_['intersection'](_0x528408[_0xb7cb('0x35')],_0x528408['query']);_0x17a5de['attributes']=_[_0xb7cb('0x39')](_0x528408[_0xb7cb('0x35')],qs[_0xb7cb('0x3a')](_0x584a9b[_0xb7cb('0x37')][_0xb7cb('0x3a')]));_0x17a5de[_0xb7cb('0x3b')]=_0x17a5de['attributes'][_0xb7cb('0x3c')]?_0x17a5de[_0xb7cb('0x3b')]:_0x528408['model'];if(!_0x584a9b['query'][_0xb7cb('0x3d')]('nolimit')){_0x17a5de[_0xb7cb('0x25')]=qs[_0xb7cb('0x25')](_0x584a9b[_0xb7cb('0x37')][_0xb7cb('0x25')]);_0x17a5de['offset']=qs[_0xb7cb('0x24')](_0x584a9b[_0xb7cb('0x37')][_0xb7cb('0x24')]);}_0x17a5de[_0xb7cb('0x3e')]=qs[_0xb7cb('0x3f')](_0x584a9b[_0xb7cb('0x37')][_0xb7cb('0x3f')]);_0x17a5de['where']=qs[_0xb7cb('0x38')](_[_0xb7cb('0x40')](_0x584a9b[_0xb7cb('0x37')],_0x528408['filters']),_0x38712a);if(_0x584a9b[_0xb7cb('0x37')][_0xb7cb('0x41')]){_0x17a5de[_0xb7cb('0x42')]=_[_0xb7cb('0x43')](_0x17a5de[_0xb7cb('0x42')],{'$or':_[_0xb7cb('0x30')](_0x38712a,function(_0x27c195){if(_0x27c195[_0xb7cb('0x34')]!=='VIRTUAL'){var _0x2b87ba={};_0x2b87ba[_0x27c195['name']]={'$like':'%'+_0x584a9b[_0xb7cb('0x37')]['filter']+'%'};return _0x2b87ba;}})});}_0x17a5de=_[_0xb7cb('0x43')]({},_0x17a5de,_0x584a9b[_0xb7cb('0x44')]);var _0x19f287={'where':_0x17a5de['where']};return db[_0xb7cb('0x31')][_0xb7cb('0x23')](_0x19f287)['then'](function(_0x486054){_0x232c6c[_0xb7cb('0x23')]=_0x486054;if(_0x584a9b['query'][_0xb7cb('0x45')]){_0x17a5de[_0xb7cb('0x46')]=[{'all':!![]}];}return db[_0xb7cb('0x31')][_0xb7cb('0x47')](_0x17a5de);})[_0xb7cb('0x2a')](function(_0xb4bbfe){_0x232c6c['rows']=_0xb4bbfe;return _0x232c6c;})[_0xb7cb('0x2a')](respondWithFilteredResult(_0x1ff8d5,_0x17a5de))[_0xb7cb('0x48')](handleError(_0x1ff8d5,null));};exports[_0xb7cb('0x49')]=function(_0x1b0849,_0x423b99){var _0x232b0e={'raw':!![],'where':{'id':_0x1b0849[_0xb7cb('0x4a')]['id']}},_0x356240={};_0x356240[_0xb7cb('0x35')]=_[_0xb7cb('0x36')](db['ChatInternalMessage'][_0xb7cb('0x32')]);_0x356240['query']=_['keys'](_0x1b0849[_0xb7cb('0x37')]);_0x356240[_0xb7cb('0x38')]=_[_0xb7cb('0x39')](_0x356240[_0xb7cb('0x35')],_0x356240[_0xb7cb('0x37')]);_0x232b0e[_0xb7cb('0x3b')]=_[_0xb7cb('0x39')](_0x356240[_0xb7cb('0x35')],qs[_0xb7cb('0x3a')](_0x1b0849[_0xb7cb('0x37')][_0xb7cb('0x3a')]));_0x232b0e['attributes']=_0x232b0e[_0xb7cb('0x3b')][_0xb7cb('0x3c')]?_0x232b0e['attributes']:_0x356240[_0xb7cb('0x35')];if(_0x1b0849['query'][_0xb7cb('0x45')]){_0x232b0e[_0xb7cb('0x46')]=[{'all':!![]}];}_0x232b0e=_[_0xb7cb('0x43')]({},_0x232b0e,_0x1b0849[_0xb7cb('0x44')]);return db[_0xb7cb('0x31')][_0xb7cb('0x4b')](_0x232b0e)['then'](handleEntityNotFound(_0x423b99,null))[_0xb7cb('0x2a')](respondWithResult(_0x423b99,null))[_0xb7cb('0x48')](handleError(_0x423b99,null));};exports['create']=function(_0x5cf51b,_0x165c95){return db[_0xb7cb('0x31')]['create'](_0x5cf51b[_0xb7cb('0x4c')],{})[_0xb7cb('0x2a')](respondWithResult(_0x165c95,0xc9))[_0xb7cb('0x48')](handleError(_0x165c95,null));};exports['update']=function(_0x32ae3b,_0x3a642c){if(_0x32ae3b[_0xb7cb('0x4c')]['id']){delete _0x32ae3b[_0xb7cb('0x4c')]['id'];}return db[_0xb7cb('0x31')][_0xb7cb('0x4b')]({'where':{'id':_0x32ae3b[_0xb7cb('0x4a')]['id']}})[_0xb7cb('0x2a')](handleEntityNotFound(_0x3a642c,null))[_0xb7cb('0x2a')](saveUpdates(_0x32ae3b[_0xb7cb('0x4c')],null))[_0xb7cb('0x2a')](respondWithResult(_0x3a642c,null))['catch'](handleError(_0x3a642c,null));};exports['destroy']=function(_0x2ff467,_0x367894){return db['ChatInternalMessage'][_0xb7cb('0x4b')]({'where':{'id':_0x2ff467['params']['id']}})[_0xb7cb('0x2a')](handleEntityNotFound(_0x367894,null))[_0xb7cb('0x2a')](removeEntity(_0x367894,null))[_0xb7cb('0x48')](handleError(_0x367894,null));};exports[_0xb7cb('0x4d')]=function(_0x23ca88,_0x237741){return db[_0xb7cb('0x31')][_0xb7cb('0x4d')]()[_0xb7cb('0x2a')](respondWithResult(_0x237741,null))[_0xb7cb('0x48')](handleError(_0x237741,null));};function wrapUser(_0x55f414){return function(_0x5a0920){var _0x3e24fd=_0x55f414[_0xb7cb('0x4e')]({'plain':!![]});_0x3e24fd['messages']=[];if(_0x5a0920){_0x3e24fd[_0xb7cb('0x4f')]=_0x5a0920[_0xb7cb('0x50')];_0x3e24fd[_0xb7cb('0x51')]=_0x5a0920;}else{_0x3e24fd[_0xb7cb('0x4f')]=moment(0x0)[_0xb7cb('0x52')](_0xb7cb('0x53'));_0x3e24fd['lastMessage']={};}return _0x3e24fd;};}exports[_0xb7cb('0x54')]=function(_0x580f16,_0x497c15,_0x365625){var _0x2a54fe=[];return db['User']['findAll']({'where':{'role':['agent','admin',_0xb7cb('0x55')]},'attributes':['id',_0xb7cb('0x56'),_0xb7cb('0x2d'),'role',_0xb7cb('0x57'),'internal',_0xb7cb('0x58'),_0xb7cb('0x59'),_0xb7cb('0x5a'),_0xb7cb('0x5b')],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':_0xb7cb('0x5c'),'attributes':['id',_0xb7cb('0x2d'),_0xb7cb('0x34')],'through':{'attributes':[]}}]})[_0xb7cb('0x2a')](function(_0x4c088d){if(_0x4c088d){var _0x5362a6=_0x580f16[_0xb7cb('0x55')]['get']({'plain':!![]});if(!_0x5362a6)throw new Error(_0xb7cb('0x5d'));if(_0x5362a6[_0xb7cb('0x5e')]===_0xb7cb('0x55')){return db[_0xb7cb('0x5f')]['find']({'where':{'name':_0xb7cb('0x60'),'userProfileId':_0x5362a6[_0xb7cb('0x61')]},'raw':!![]})[_0xb7cb('0x2a')](function(_0x346677){if(_0x346677){if(_0x346677['autoAssociation']===0x0){return db[_0xb7cb('0x62')][_0xb7cb('0x47')]({'where':{'sectionId':_0x346677['id']},'raw':!![]})[_0xb7cb('0x2a')](function(_0x499958){var _0x2cc992=[];if(_[_0xb7cb('0x63')](_0x499958)){_0x2cc992=_[_0xb7cb('0x41')](_0x4c088d,function(_0x4279fb){if(_0x4279fb[_0xb7cb('0x5e')]!=='agent'){return _0x4279fb;}});return _0x2cc992;}else{for(var _0x378975=0x0;_0x378975<_0x4c088d[_0xb7cb('0x3c')];_0x378975++){var _0x453727=_0x4c088d[_0x378975];if(_0x453727[_0xb7cb('0x5e')]===_0xb7cb('0x64')){var _0x1ab33f=_[_0xb7cb('0x4b')](_0x499958,function(_0x47be69){return _0x47be69[_0xb7cb('0x65')]===_0x453727['id'];});if(_0x1ab33f)_0x2cc992[_0xb7cb('0x66')](_0x453727);}else{_0x2cc992['push'](_0x453727);}}return _0x2cc992;}});}else{return _0x4c088d;}}else{var _0x572254=_[_0xb7cb('0x41')](_0x4c088d,function(_0x191275){if(_0x191275['role']!==_0xb7cb('0x64')){return _0x191275;}});return _0x572254;}});}else{return _0x4c088d;}}})[_0xb7cb('0x2a')](function(_0x6a2fc2){var _0xebbd15=[];if(_0x6a2fc2){_0x2a54fe=_0x6a2fc2;for(var _0x3ed945=0x0;_0x3ed945<_0x6a2fc2[_0xb7cb('0x3c')];_0x3ed945+=0x1){_0x2a54fe[_0x3ed945][_0xb7cb('0x67')]=[];_0xebbd15[_0xb7cb('0x66')](db[_0xb7cb('0x31')][_0xb7cb('0x4b')]({'where':{'FromId':[_0x580f16[_0xb7cb('0x55')]['id'],_0x6a2fc2[_0x3ed945]['id']],'ToId':[_0x580f16[_0xb7cb('0x55')]['id'],_0x6a2fc2[_0x3ed945]['id']],'ChatGroupId':null},'attributes':['id',_0xb7cb('0x50'),_0xb7cb('0x68'),_0xb7cb('0x69'),'read',_0xb7cb('0x4c')],'order':qs['sort'](_0xb7cb('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb7cb('0x2a')](wrapUser(_0x6a2fc2[_0x3ed945])));}return BPromise[_0xb7cb('0x6b')](_0xebbd15);}return[];})[_0xb7cb('0x2a')](function(_0x3ffd43){return{'rows':_0x3ffd43,'count':_0x3ffd43[_0xb7cb('0x3c')]};})[_0xb7cb('0x2a')](respondWithResult(_0x497c15,null))[_0xb7cb('0x48')](handleError(_0x497c15,null));}; \ No newline at end of file +var _0x0afb=['isEmpty','agent','resourceId','push','createdAt','ToId','read','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','get','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource'];(function(_0x20d571,_0x1f5ab2){var _0x323885=function(_0x5b8c5b){while(--_0x5b8c5b){_0x20d571['push'](_0x20d571['shift']());}};_0x323885(++_0x1f5ab2);}(_0x0afb,0x155));var _0xb0af=function(_0x4b3a79,_0x4abb5b){_0x4b3a79=_0x4b3a79-0x0;var _0x1a1756=_0x0afb[_0x4b3a79];return _0x1a1756;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb0af('0x0'));var zipdir=require(_0xb0af('0x1'));var jsonpatch=require(_0xb0af('0x2'));var rp=require(_0xb0af('0x3'));var moment=require(_0xb0af('0x4'));var BPromise=require(_0xb0af('0x5'));var Mustache=require(_0xb0af('0x6'));var util=require('util');var path=require(_0xb0af('0x7'));var sox=require(_0xb0af('0x8'));var csv=require(_0xb0af('0x9'));var ejs=require(_0xb0af('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb0af('0xb'));var jsforce=require(_0xb0af('0xc'));var deskjs=require(_0xb0af('0xd'));var toCsv=require(_0xb0af('0x9'));var querystring=require(_0xb0af('0xe'));var Papa=require(_0xb0af('0xf'));var Redis=require('ioredis');var authService=require(_0xb0af('0x10'));var qs=require(_0xb0af('0x11'));var as=require(_0xb0af('0x12'));var hardwareService=require(_0xb0af('0x13'));var logger=require('../../config/logger')(_0xb0af('0x14'));var utils=require('../../config/utils');var config=require(_0xb0af('0x15'));var db=require('../../mysqldb')['db'];config[_0xb0af('0x16')]=_[_0xb0af('0x17')](config[_0xb0af('0x16')],{'host':_0xb0af('0x18'),'port':0x18eb});var socket=require(_0xb0af('0x19'))(new Redis(config[_0xb0af('0x16')]));require('./chatInternalMessage.socket')[_0xb0af('0x1a')](socket);function respondWithStatusCode(_0x392ac7,_0x5986e0){_0x5986e0=_0x5986e0||0xcc;return function(_0xcadb33){if(_0xcadb33){return _0x392ac7[_0xb0af('0x1b')](_0x5986e0);}return _0x392ac7[_0xb0af('0x1c')](_0x5986e0)[_0xb0af('0x1d')]();};}function respondWithResult(_0x443954,_0x3f5177){_0x3f5177=_0x3f5177||0xc8;return function(_0x4cdcb8){if(_0x4cdcb8){return _0x443954[_0xb0af('0x1c')](_0x3f5177)[_0xb0af('0x1e')](_0x4cdcb8);}};}function respondWithFilteredResult(_0x2b869e,_0x51d266){return function(_0x335b6d){if(_0x335b6d){var _0x48c4e0=_0x335b6d['count'],_0x1cd808=_0x51d266[_0xb0af('0x1f')],_0x55a959=_0x51d266['offset']+_0x51d266[_0xb0af('0x20')],_0x5a69f9;if(_0x55a959>=_0x48c4e0){_0x55a959=_0x48c4e0;_0x5a69f9=0xc8;}else{_0x5a69f9=0xce;}_0x2b869e[_0xb0af('0x1c')](_0x5a69f9);return _0x2b869e[_0xb0af('0x21')](_0xb0af('0x22'),_0x1cd808+'-'+_0x55a959+'/'+_0x48c4e0)['json'](_0x335b6d);}return null;};}function patchUpdates(_0x416be7){return function(_0x32614d){try{jsonpatch[_0xb0af('0x23')](_0x32614d,_0x416be7,!![]);}catch(_0x4f2368){return BPromise['reject'](_0x4f2368);}return _0x32614d[_0xb0af('0x24')]();};}function saveUpdates(_0x1bf522,_0x650ba0){return function(_0x53d13d){if(_0x53d13d){return _0x53d13d[_0xb0af('0x25')](_0x1bf522)['then'](function(_0x1f600c){return _0x1f600c;});}return null;};}function removeEntity(_0xb95974,_0x258339){return function(_0x535b0f){if(_0x535b0f){return _0x535b0f[_0xb0af('0x26')]()[_0xb0af('0x27')](function(){_0xb95974[_0xb0af('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f47c8,_0x982182){return function(_0xfa2ccd){if(!_0xfa2ccd){_0x4f47c8[_0xb0af('0x1b')](0x194);}return _0xfa2ccd;};}function handleError(_0x2fa1ab,_0x305188){_0x305188=_0x305188||0x1f4;return function(_0x352e16){logger[_0xb0af('0x28')](_0x352e16[_0xb0af('0x29')]);if(_0x352e16[_0xb0af('0x2a')]){delete _0x352e16[_0xb0af('0x2a')];}_0x2fa1ab[_0xb0af('0x1c')](_0x305188)[_0xb0af('0x2b')](_0x352e16);};}exports['index']=function(_0x8f2d19,_0x496a3e){var _0x50394c={},_0x12bf92={},_0x2e5119={'count':0x0,'rows':[]};var _0x3de69b=_[_0xb0af('0x2c')](db[_0xb0af('0x2d')][_0xb0af('0x2e')],function(_0x2c2d98){return{'name':_0x2c2d98[_0xb0af('0x2f')],'type':_0x2c2d98[_0xb0af('0x30')][_0xb0af('0x31')]};});_0x12bf92[_0xb0af('0x32')]=_[_0xb0af('0x2c')](_0x3de69b,'name');_0x12bf92['query']=_[_0xb0af('0x33')](_0x8f2d19[_0xb0af('0x34')]);_0x12bf92[_0xb0af('0x35')]=_[_0xb0af('0x36')](_0x12bf92['model'],_0x12bf92[_0xb0af('0x34')]);_0x50394c[_0xb0af('0x37')]=_[_0xb0af('0x36')](_0x12bf92[_0xb0af('0x32')],qs[_0xb0af('0x38')](_0x8f2d19[_0xb0af('0x34')]['fields']));_0x50394c[_0xb0af('0x37')]=_0x50394c[_0xb0af('0x37')][_0xb0af('0x39')]?_0x50394c['attributes']:_0x12bf92[_0xb0af('0x32')];if(!_0x8f2d19[_0xb0af('0x34')][_0xb0af('0x3a')](_0xb0af('0x3b'))){_0x50394c[_0xb0af('0x20')]=qs[_0xb0af('0x20')](_0x8f2d19[_0xb0af('0x34')]['limit']);_0x50394c[_0xb0af('0x1f')]=qs[_0xb0af('0x1f')](_0x8f2d19[_0xb0af('0x34')][_0xb0af('0x1f')]);}_0x50394c[_0xb0af('0x3c')]=qs[_0xb0af('0x3d')](_0x8f2d19[_0xb0af('0x34')][_0xb0af('0x3d')]);_0x50394c[_0xb0af('0x3e')]=qs['filters'](_[_0xb0af('0x3f')](_0x8f2d19['query'],_0x12bf92['filters']),_0x3de69b);if(_0x8f2d19['query'][_0xb0af('0x40')]){_0x50394c[_0xb0af('0x3e')]=_[_0xb0af('0x41')](_0x50394c['where'],{'$or':_[_0xb0af('0x2c')](_0x3de69b,function(_0x39c0d0){if(_0x39c0d0[_0xb0af('0x30')]!==_0xb0af('0x42')){var _0xaf3b2a={};_0xaf3b2a[_0x39c0d0[_0xb0af('0x2a')]]={'$like':'%'+_0x8f2d19[_0xb0af('0x34')]['filter']+'%'};return _0xaf3b2a;}})});}_0x50394c=_['merge']({},_0x50394c,_0x8f2d19[_0xb0af('0x43')]);var _0x2f0ac0={'where':_0x50394c[_0xb0af('0x3e')]};return db['ChatInternalMessage']['count'](_0x2f0ac0)[_0xb0af('0x27')](function(_0x3ead43){_0x2e5119[_0xb0af('0x44')]=_0x3ead43;if(_0x8f2d19[_0xb0af('0x34')][_0xb0af('0x45')]){_0x50394c[_0xb0af('0x46')]=[{'all':!![]}];}return db[_0xb0af('0x2d')][_0xb0af('0x47')](_0x50394c);})[_0xb0af('0x27')](function(_0x1b0744){_0x2e5119[_0xb0af('0x48')]=_0x1b0744;return _0x2e5119;})['then'](respondWithFilteredResult(_0x496a3e,_0x50394c))[_0xb0af('0x49')](handleError(_0x496a3e,null));};exports['show']=function(_0x34d99c,_0x338ded){var _0x22faff={'raw':!![],'where':{'id':_0x34d99c[_0xb0af('0x4a')]['id']}},_0x4ebefa={};_0x4ebefa[_0xb0af('0x32')]=_[_0xb0af('0x33')](db[_0xb0af('0x2d')][_0xb0af('0x2e')]);_0x4ebefa[_0xb0af('0x34')]=_['keys'](_0x34d99c['query']);_0x4ebefa['filters']=_[_0xb0af('0x36')](_0x4ebefa['model'],_0x4ebefa[_0xb0af('0x34')]);_0x22faff['attributes']=_['intersection'](_0x4ebefa[_0xb0af('0x32')],qs['fields'](_0x34d99c['query'][_0xb0af('0x38')]));_0x22faff[_0xb0af('0x37')]=_0x22faff[_0xb0af('0x37')][_0xb0af('0x39')]?_0x22faff['attributes']:_0x4ebefa['model'];if(_0x34d99c['query']['includeAll']){_0x22faff[_0xb0af('0x46')]=[{'all':!![]}];}_0x22faff=_[_0xb0af('0x41')]({},_0x22faff,_0x34d99c[_0xb0af('0x43')]);return db[_0xb0af('0x2d')][_0xb0af('0x4b')](_0x22faff)[_0xb0af('0x27')](handleEntityNotFound(_0x338ded,null))[_0xb0af('0x27')](respondWithResult(_0x338ded,null))[_0xb0af('0x49')](handleError(_0x338ded,null));};exports[_0xb0af('0x4c')]=function(_0x268141,_0x155f77){return db['ChatInternalMessage'][_0xb0af('0x4c')](_0x268141[_0xb0af('0x4d')],{})['then'](respondWithResult(_0x155f77,0xc9))[_0xb0af('0x49')](handleError(_0x155f77,null));};exports[_0xb0af('0x25')]=function(_0x5434cb,_0x55efd7){if(_0x5434cb['body']['id']){delete _0x5434cb[_0xb0af('0x4d')]['id'];}return db[_0xb0af('0x2d')][_0xb0af('0x4b')]({'where':{'id':_0x5434cb[_0xb0af('0x4a')]['id']}})[_0xb0af('0x27')](handleEntityNotFound(_0x55efd7,null))['then'](saveUpdates(_0x5434cb[_0xb0af('0x4d')],null))[_0xb0af('0x27')](respondWithResult(_0x55efd7,null))[_0xb0af('0x49')](handleError(_0x55efd7,null));};exports[_0xb0af('0x26')]=function(_0x33b16e,_0x102f9f){return db['ChatInternalMessage'][_0xb0af('0x4b')]({'where':{'id':_0x33b16e[_0xb0af('0x4a')]['id']}})[_0xb0af('0x27')](handleEntityNotFound(_0x102f9f,null))[_0xb0af('0x27')](removeEntity(_0x102f9f,null))['catch'](handleError(_0x102f9f,null));};exports[_0xb0af('0x4e')]=function(_0xfb1a28,_0x429b14){return db[_0xb0af('0x2d')]['describe']()[_0xb0af('0x27')](respondWithResult(_0x429b14,null))[_0xb0af('0x49')](handleError(_0x429b14,null));};function wrapUser(_0x5e7e8f){return function(_0x5e245a){var _0x39f52f=_0x5e7e8f[_0xb0af('0x4f')]({'plain':!![]});_0x39f52f['messages']=[];if(_0x5e245a){_0x39f52f[_0xb0af('0x50')]=_0x5e245a['createdAt'];_0x39f52f[_0xb0af('0x51')]=_0x5e245a;}else{_0x39f52f[_0xb0af('0x50')]=moment(0x0)[_0xb0af('0x52')](_0xb0af('0x53'));_0x39f52f[_0xb0af('0x51')]={};}return _0x39f52f;};}exports[_0xb0af('0x54')]=function(_0x2becf3,_0x570fe7,_0x14b05b){var _0x5d8317=[];return db[_0xb0af('0x55')][_0xb0af('0x47')]({'where':{'role':['agent',_0xb0af('0x56'),_0xb0af('0x57')]},'attributes':['id',_0xb0af('0x58'),_0xb0af('0x2a'),_0xb0af('0x59'),_0xb0af('0x5a'),_0xb0af('0x5b'),_0xb0af('0x5c'),_0xb0af('0x5d'),_0xb0af('0x5e'),'showWebBar'],'order':qs[_0xb0af('0x3d')](_0xb0af('0x5f')),'include':[{'model':db[_0xb0af('0x60')],'as':_0xb0af('0x61'),'attributes':['id',_0xb0af('0x2a'),_0xb0af('0x30')],'through':{'attributes':[]}}]})['then'](function(_0x5d8579){if(_0x5d8579){var _0x1bc9a3=_0x2becf3[_0xb0af('0x57')][_0xb0af('0x4f')]({'plain':!![]});if(!_0x1bc9a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bc9a3[_0xb0af('0x59')]===_0xb0af('0x57')){return db[_0xb0af('0x62')][_0xb0af('0x4b')]({'where':{'name':_0xb0af('0x63'),'userProfileId':_0x1bc9a3[_0xb0af('0x64')]},'raw':!![]})[_0xb0af('0x27')](function(_0x47216e){if(_0x47216e){if(_0x47216e[_0xb0af('0x65')]===0x0){return db[_0xb0af('0x66')][_0xb0af('0x47')]({'where':{'sectionId':_0x47216e['id']},'raw':!![]})[_0xb0af('0x27')](function(_0x292832){var _0x148fa9=[];if(_[_0xb0af('0x67')](_0x292832)){_0x148fa9=_[_0xb0af('0x40')](_0x5d8579,function(_0x4c87ca){if(_0x4c87ca['role']!==_0xb0af('0x68')){return _0x4c87ca;}});return _0x148fa9;}else{for(var _0x3d9f18=0x0;_0x3d9f18<_0x5d8579[_0xb0af('0x39')];_0x3d9f18++){var _0x56b79f=_0x5d8579[_0x3d9f18];if(_0x56b79f[_0xb0af('0x59')]===_0xb0af('0x68')){var _0x2f9a16=_[_0xb0af('0x4b')](_0x292832,function(_0x328cd4){return _0x328cd4[_0xb0af('0x69')]===_0x56b79f['id'];});if(_0x2f9a16)_0x148fa9[_0xb0af('0x6a')](_0x56b79f);}else{_0x148fa9[_0xb0af('0x6a')](_0x56b79f);}}return _0x148fa9;}});}else{return _0x5d8579;}}else{var _0x573997=_[_0xb0af('0x40')](_0x5d8579,function(_0x1fc3df){if(_0x1fc3df[_0xb0af('0x59')]!=='agent'){return _0x1fc3df;}});return _0x573997;}});}else{return _0x5d8579;}}})[_0xb0af('0x27')](function(_0x41a06f){var _0x358d0f=[];if(_0x41a06f){_0x5d8317=_0x41a06f;for(var _0x260a58=0x0;_0x260a58<_0x41a06f['length'];_0x260a58+=0x1){_0x5d8317[_0x260a58]['messages']=[];_0x358d0f['push'](db['ChatInternalMessage'][_0xb0af('0x4b')]({'where':{'FromId':[_0x2becf3['user']['id'],_0x41a06f[_0x260a58]['id']],'ToId':[_0x2becf3['user']['id'],_0x41a06f[_0x260a58]['id']],'ChatGroupId':null},'attributes':['id',_0xb0af('0x6b'),'FromId',_0xb0af('0x6c'),_0xb0af('0x6d'),_0xb0af('0x4d')],'order':qs[_0xb0af('0x3d')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xb0af('0x27')](wrapUser(_0x41a06f[_0x260a58])));}return BPromise[_0xb0af('0x6e')](_0x358d0f);}return[];})[_0xb0af('0x27')](function(_0x2ad91c){return{'rows':_0x2ad91c,'count':_0x2ad91c[_0xb0af('0x39')]};})[_0xb0af('0x27')](respondWithResult(_0x570fe7,null))[_0xb0af('0x49')](handleError(_0x570fe7,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index b31eaed..90d4a63 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 _0xac22=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x5ab340,_0x3bf3e4){var _0x2ed5b7=function(_0x3178f9){while(--_0x3178f9){_0x5ab340['push'](_0x5ab340['shift']());}};_0x2ed5b7(++_0x3bf3e4);}(_0xac22,0x138));var _0x2ac2=function(_0xedb2da,_0x155f02){_0xedb2da=_0xedb2da-0x0;var _0x5029d1=_0xac22[_0xedb2da];return _0x5029d1;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x2ac2('0x0'))['db'][_0x2ac2('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2ac2('0x2')](0x0);var events={'afterCreate':_0x2ac2('0x3'),'afterUpdate':_0x2ac2('0x4'),'afterDestroy':_0x2ac2('0x5')};function emitEvent(_0x186380){return function(_0x569df4,_0x37ea79,_0xc88ac2){ChatInternalMessageEvents[_0x2ac2('0x6')](_0x186380+':'+_0x569df4['id'],_0x569df4);ChatInternalMessageEvents['emit'](_0x186380,_0x569df4);_0xc88ac2(null);};}for(var e in events){if(events[_0x2ac2('0x7')](e)){var event=events[e];ChatInternalMessage[_0x2ac2('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xb1d3=['update','remove','emit','exports','events','save'];(function(_0x4a3077,_0x395129){var _0x220e7d=function(_0x3a1f18){while(--_0x3a1f18){_0x4a3077['push'](_0x4a3077['shift']());}};_0x220e7d(++_0x395129);}(_0xb1d3,0xe8));var _0x3b1d=function(_0x2c6559,_0x3a3d99){_0x2c6559=_0x2c6559-0x0;var _0x1a0f7e=_0xb1d3[_0x2c6559];return _0x1a0f7e;};'use strict';var EventEmitter=require(_0x3b1d('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b1d('0x1'),'afterUpdate':_0x3b1d('0x2'),'afterDestroy':_0x3b1d('0x3')};function emitEvent(_0x22b67a){return function(_0x5b94ab,_0x18e301,_0x32cd1d){ChatInternalMessageEvents[_0x3b1d('0x4')](_0x22b67a+':'+_0x5b94ab['id'],_0x5b94ab);ChatInternalMessageEvents[_0x3b1d('0x4')](_0x22b67a,_0x5b94ab);_0x32cd1d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x3b1d('0x5')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b8073b6..b4b11f5 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 _0x1271=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x415fb4,_0x2f5297){var _0x5ec582=function(_0x880bcf){while(--_0x880bcf){_0x415fb4['push'](_0x415fb4['shift']());}};_0x5ec582(++_0x2f5297);}(_0x1271,0xfe));var _0x1127=function(_0x120a87,_0x4a0305){_0x120a87=_0x120a87-0x0;var _0x3b8ac9=_0x1271[_0x120a87];return _0x3b8ac9;};'use strict';var _=require(_0x1127('0x0'));var util=require(_0x1127('0x1'));var logger=require(_0x1127('0x2'))(_0x1127('0x3'));var moment=require(_0x1127('0x4'));var BPromise=require(_0x1127('0x5'));var rp=require(_0x1127('0x6'));var fs=require('fs');var path=require(_0x1127('0x7'));var rimraf=require(_0x1127('0x8'));var config=require(_0x1127('0x9'));var attributes=require('./chatInternalMessage.attributes');module[_0x1127('0xa')]=function(_0x424b4f,_0x2ac1fb){return _0x424b4f[_0x1127('0xb')](_0x1127('0xc'),attributes,{'tableName':_0x1127('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1127('0xe'),'collate':_0x1127('0xf')});}; \ No newline at end of file +var _0x9a98=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0x9a98,0xd0));var _0x89a9=function(_0x1fe4b4,_0x38b356){_0x1fe4b4=_0x1fe4b4-0x0;var _0x457c07=_0x9a98[_0x1fe4b4];return _0x457c07;};'use strict';var _=require('lodash');var util=require(_0x89a9('0x0'));var logger=require(_0x89a9('0x1'))('api');var moment=require(_0x89a9('0x2'));var BPromise=require(_0x89a9('0x3'));var rp=require(_0x89a9('0x4'));var fs=require('fs');var path=require(_0x89a9('0x5'));var rimraf=require(_0x89a9('0x6'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x89a9('0x7')]=function(_0x444db5,_0xa02b63){return _0x444db5['define'](_0x89a9('0x8'),attributes,{'tableName':_0x89a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x89a9('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index faf846c..49df19e 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 _0x67c3=['../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x338f1f,_0x4cfd8d){var _0x140699=function(_0x360e40){while(--_0x360e40){_0x338f1f['push'](_0x338f1f['shift']());}};_0x140699(++_0x4cfd8d);}(_0x67c3,0x174));var _0x367c=function(_0x43f084,_0xb48804){_0x43f084=_0x43f084-0x0;var _0x2a6dde=_0x67c3[_0x43f084];return _0x2a6dde;};'use strict';var _=require(_0x367c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x367c('0x1'));var rs=require(_0x367c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x367c('0x3'))['db'];var utils=require(_0x367c('0x4'));var logger=require('../../config/logger')(_0x367c('0x5'));var config=require(_0x367c('0x6'));var jayson=require(_0x367c('0x7'));var client=jayson[_0x367c('0x8')][_0x367c('0x9')]({'port':0x232a});config['redis']=_[_0x367c('0xa')](config[_0x367c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x367c('0xc'))(new Redis(config[_0x367c('0xb')]));require(_0x367c('0xd'))[_0x367c('0xe')](socket);function respondWithRpcPromise(_0x2c75b0,_0x551bd0,_0x55a418){return new BPromise(function(_0x25bcaa,_0x17f2ff){return client[_0x367c('0xf')](_0x2c75b0,_0x55a418)[_0x367c('0x10')](function(_0x3e0cd3){logger['info'](_0x367c('0x11'),_0x551bd0,_0x367c('0x12'));logger['debug'](_0x367c('0x13'),_0x551bd0,_0x367c('0x12'),JSON[_0x367c('0x14')](_0x3e0cd3));if(_0x3e0cd3[_0x367c('0x15')]){if(_0x3e0cd3[_0x367c('0x15')][_0x367c('0x16')]===0x1f4){logger[_0x367c('0x15')](_0x367c('0x11'),_0x551bd0,_0x3e0cd3[_0x367c('0x15')][_0x367c('0x17')]);return _0x17f2ff(_0x3e0cd3[_0x367c('0x15')][_0x367c('0x17')]);}logger[_0x367c('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x551bd0,_0x3e0cd3[_0x367c('0x15')][_0x367c('0x17')]);return _0x25bcaa(_0x3e0cd3[_0x367c('0x15')]['message']);}else{logger[_0x367c('0x18')](_0x367c('0x11'),_0x551bd0,_0x367c('0x12'));_0x25bcaa(_0x3e0cd3[_0x367c('0x19')][_0x367c('0x17')]);}})[_0x367c('0x1a')](function(_0x48c824){logger[_0x367c('0x15')](_0x367c('0x11'),_0x551bd0,_0x48c824);_0x17f2ff(_0x48c824);});});} \ No newline at end of file +var _0x9400=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring'];(function(_0x12a5a7,_0x3f04d4){var _0x5e868e=function(_0x221c26){while(--_0x221c26){_0x12a5a7['push'](_0x12a5a7['shift']());}};_0x5e868e(++_0x3f04d4);}(_0x9400,0x7e));var _0x0940=function(_0x3e9b6a,_0x325018){_0x3e9b6a=_0x3e9b6a-0x0;var _0x5da136=_0x9400[_0x3e9b6a];return _0x5da136;};'use strict';var _=require(_0x0940('0x0'));var util=require(_0x0940('0x1'));var moment=require(_0x0940('0x2'));var BPromise=require('bluebird');var rs=require(_0x0940('0x3'));var fs=require('fs');var Redis=require(_0x0940('0x4'));var db=require(_0x0940('0x5'))['db'];var utils=require(_0x0940('0x6'));var logger=require(_0x0940('0x7'))(_0x0940('0x8'));var config=require(_0x0940('0x9'));var jayson=require(_0x0940('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x0940('0xb')]=_[_0x0940('0xc')](config[_0x0940('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0940('0xd'))(new Redis(config[_0x0940('0xb')]));require(_0x0940('0xe'))['register'](socket);function respondWithRpcPromise(_0x2a59a7,_0x1587be,_0x2a52e7){return new BPromise(function(_0x521202,_0x3dea85){return client['request'](_0x2a59a7,_0x2a52e7)[_0x0940('0xf')](function(_0x47242e){logger['info'](_0x0940('0x10'),_0x1587be,_0x0940('0x11'));logger[_0x0940('0x12')](_0x0940('0x13'),_0x1587be,_0x0940('0x11'),JSON[_0x0940('0x14')](_0x47242e));if(_0x47242e[_0x0940('0x15')]){if(_0x47242e[_0x0940('0x15')]['code']===0x1f4){logger[_0x0940('0x15')](_0x0940('0x10'),_0x1587be,_0x47242e[_0x0940('0x15')]['message']);return _0x3dea85(_0x47242e[_0x0940('0x15')]['message']);}logger[_0x0940('0x15')](_0x0940('0x10'),_0x1587be,_0x47242e['error']['message']);return _0x521202(_0x47242e[_0x0940('0x15')][_0x0940('0x16')]);}else{logger[_0x0940('0x17')](_0x0940('0x10'),_0x1587be,_0x0940('0x11'));_0x521202(_0x47242e[_0x0940('0x18')][_0x0940('0x16')]);}})[_0x0940('0x19')](function(_0x4e4edf){logger[_0x0940('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x1587be,_0x4e4edf);_0x3dea85(_0x4e4edf);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c96951b..30d6552 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 _0x9cff=['save','remove','update','emit','removeListener','register','length','chatInternalMessage:'];(function(_0xfef029,_0x357dbe){var _0x48b0ce=function(_0x750e15){while(--_0x750e15){_0xfef029['push'](_0xfef029['shift']());}};_0x48b0ce(++_0x357dbe);}(_0x9cff,0x1b0));var _0xf9cf=function(_0x309d44,_0x44520a){_0x309d44=_0x309d44-0x0;var _0x240e99=_0x9cff[_0x309d44];return _0x240e99;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xf9cf('0x0'),_0xf9cf('0x1'),_0xf9cf('0x2')];function createListener(_0x55364a,_0x197da2){return function(_0x142fc6){_0x197da2[_0xf9cf('0x3')](_0x55364a,_0x142fc6);};}function removeListener(_0x5060e0,_0x2da91){return function(){ChatInternalMessageEvents[_0xf9cf('0x4')](_0x5060e0,_0x2da91);};}exports[_0xf9cf('0x5')]=function(_0x183113){for(var _0xcacbdc=0x0,_0x27e2b1=events[_0xf9cf('0x6')];_0xcacbdc<_0x27e2b1;_0xcacbdc++){var _0x19d7f9=events[_0xcacbdc];var _0x1c29f6=createListener(_0xf9cf('0x7')+_0x19d7f9,_0x183113);ChatInternalMessageEvents['on'](_0x19d7f9,_0x1c29f6);}}; \ No newline at end of file +var _0x4853=['save','update','emit','length','chatInternalMessage:'];(function(_0x2f7cdf,_0x3dd24b){var _0x34fa6d=function(_0x3c2007){while(--_0x3c2007){_0x2f7cdf['push'](_0x2f7cdf['shift']());}};_0x34fa6d(++_0x3dd24b);}(_0x4853,0x11d));var _0x3485=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4853[_0x14add3];return _0x4a174f;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x3485('0x0'),'remove',_0x3485('0x1')];function createListener(_0x1ca548,_0x38f2de){return function(_0x2e51d9){_0x38f2de[_0x3485('0x2')](_0x1ca548,_0x2e51d9);};}function removeListener(_0xd1a964,_0x4ef6c0){return function(){ChatInternalMessageEvents['removeListener'](_0xd1a964,_0x4ef6c0);};}exports['register']=function(_0x249d2c){for(var _0x7512e3=0x0,_0x2442dd=events[_0x3485('0x3')];_0x7512e3<_0x2442dd;_0x7512e3++){var _0x41a183=events[_0x7512e3];var _0x29502b=createListener(_0x3485('0x4')+_0x41a183,_0x249d2c);ChatInternalMessageEvents['on'](_0x41a183,_0x29502b);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index a79cc35..b7bc82c 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 _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/users','getUsers','show','post','create','put','delete','/:id','destroy','exports','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'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('./chatInternalMessage.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',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',controller['update']);router[_0x49c4('0x11')](_0x49c4('0x12'),auth['isAuthenticated'](),controller[_0x49c4('0x13')]);module[_0x49c4('0x14')]=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(_0x58fca4,_0x55acce){var _0x5b9174=function(_0x2878a3){while(--_0x2878a3){_0x58fca4['push'](_0x58fca4['shift']());}};_0x5b9174(++_0x55acce);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/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 05833d0..32a0a64 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 _0x2f45=['exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2f45,0x90));var _0x52f4=function(_0x5eea51,_0x3aa3be){_0x5eea51=_0x5eea51-0x0;var _0x5c2acb=_0x2f45[_0x5eea51];return _0x5c2acb;};'use strict';var Sequelize=require('sequelize');module[_0x52f4('0x0')]={'body':{'type':Sequelize['TEXT'](_0x52f4('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x52f4('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x52f4('0x3')]('in',_0x52f4('0x4')),'defaultValue':_0x52f4('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x52f4('0x5')]}}; \ No newline at end of file +var _0x105e=['medium','BOOLEAN','ENUM','out','DATE','sequelize','TEXT'];(function(_0x6d83e5,_0x53c962){var _0x3f6c02=function(_0x1e56cf){while(--_0x1e56cf){_0x6d83e5['push'](_0x6d83e5['shift']());}};_0x3f6c02(++_0x53c962);}(_0x105e,0xd7));var _0xe105=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x105e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe105('0x0'));module['exports']={'body':{'type':Sequelize[_0xe105('0x1')](_0xe105('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xe105('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe105('0x4')]('in',_0xe105('0x5')),'defaultValue':_0xe105('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe105('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6cc433d..39164dc 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 _0x565c=['read','format','UserId','user','Contact','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','stringify','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','acceptmessage','parse','formData','agent','get','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','EventManager','rejectmessage','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','http','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','code','error','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','include','findAll','rows','show','params','find','create','body','describe','chat-interactions','accept'];(function(_0x359d3e,_0x9d9e5b){var _0x533931=function(_0x553875){while(--_0x553875){_0x359d3e['push'](_0x359d3e['shift']());}};_0x533931(++_0x9d9e5b);}(_0x565c,0x10f));var _0xc565=function(_0x217fad,_0x4b3d4f){_0x217fad=_0x217fad-0x0;var _0x51514d=_0x565c[_0x217fad];return _0x51514d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc565('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc565('0x1'));var jsonpatch=require(_0xc565('0x2'));var rp=require(_0xc565('0x3'));var moment=require(_0xc565('0x4'));var BPromise=require(_0xc565('0x5'));var Mustache=require(_0xc565('0x6'));var util=require(_0xc565('0x7'));var path=require(_0xc565('0x8'));var sox=require('sox');var csv=require(_0xc565('0x9'));var ejs=require(_0xc565('0xa'));var fs=require('fs');var _=require(_0xc565('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc565('0xc'));var deskjs=require(_0xc565('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc565('0xe'));var Papa=require(_0xc565('0xf'));var Redis=require(_0xc565('0x10'));var authService=require(_0xc565('0x11'));var qs=require(_0xc565('0x12'));var as=require(_0xc565('0x13'));var hardwareService=require(_0xc565('0x14'));var logger=require(_0xc565('0x15'))(_0xc565('0x16'));var utils=require(_0xc565('0x17'));var config=require(_0xc565('0x18'));var db=require(_0xc565('0x19'))['db'];config[_0xc565('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc565('0x1b'))(new Redis(config[_0xc565('0x1a')]));require('./chatMessage.socket')[_0xc565('0x1c')](socket);var jayson=require(_0xc565('0x1d'));var client=jayson['client'][_0xc565('0x1e')]({'port':0x232c});var client9002=jayson[_0xc565('0x1f')][_0xc565('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x154fa9,_0x2949af,_0x22dc94){if(_0x22dc94){var _0x843be1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x843be1['test'](_0x2949af)){return _0x154fa9;}else{throw new db[(_0xc565('0x20'))][(_0xc565('0x21'))](_0xc565('0x22'));}}else{return _0x154fa9;}}function respondWithRpcPromise(_0x159bcd,_0x2c73aa,_0x2d2032,_0x55431c){return new BPromise(function(_0x4ca876,_0x384198){var _0x25901b=_0x55431c||client;return _0x25901b[_0xc565('0x23')](_0x159bcd,_0x2d2032)[_0xc565('0x24')](function(_0x2b1234){logger[_0xc565('0x25')](_0xc565('0x26'),_0x2c73aa,_0xc565('0x27'));logger['debug'](_0xc565('0x28'),_0x2c73aa,_0xc565('0x27'),JSON['stringify'](_0x2b1234));if(_0x2b1234['error']){if(_0x2b1234['error'][_0xc565('0x29')]===0x1f4){logger['error'](_0xc565('0x26'),_0x2c73aa,_0x2b1234[_0xc565('0x2a')][_0xc565('0x2b')]);return _0x384198(_0x2b1234[_0xc565('0x2a')][_0xc565('0x2b')]);}logger['error'](_0xc565('0x26'),_0x2c73aa,_0x2b1234[_0xc565('0x2a')]['message']);return _0x4ca876(_0x2b1234[_0xc565('0x2a')][_0xc565('0x2b')]);}else{logger[_0xc565('0x25')](_0xc565('0x26'),_0x2c73aa,_0xc565('0x27'));_0x4ca876(_0x2b1234['result']['message']);}})[_0xc565('0x2c')](function(_0x2a045d){logger[_0xc565('0x2a')](_0xc565('0x26'),_0x2c73aa,_0x2a045d);_0x384198(_0x2a045d);});});}function respondWithStatusCode(_0x33f071,_0x32bf29){_0x32bf29=_0x32bf29||0xcc;return function(_0x1fa7e9){if(_0x1fa7e9){return _0x33f071[_0xc565('0x2d')](_0x32bf29);}return _0x33f071[_0xc565('0x2e')](_0x32bf29)[_0xc565('0x2f')]();};}function respondWithResult(_0x4c47b6,_0x55c12f){_0x55c12f=_0x55c12f||0xc8;return function(_0x476264){if(_0x476264){return _0x4c47b6[_0xc565('0x2e')](_0x55c12f)[_0xc565('0x30')](_0x476264);}};}function respondWithFilteredResult(_0x19020f,_0x1da215){return function(_0x4e5b34){if(_0x4e5b34){var _0x38bc7b=_0x4e5b34[_0xc565('0x31')],_0x627034=_0x1da215[_0xc565('0x32')],_0x2671f6=_0x1da215[_0xc565('0x32')]+_0x1da215[_0xc565('0x33')],_0x5ca95a;if(_0x2671f6>=_0x38bc7b){_0x2671f6=_0x38bc7b;_0x5ca95a=0xc8;}else{_0x5ca95a=0xce;}_0x19020f[_0xc565('0x2e')](_0x5ca95a);return _0x19020f['set'](_0xc565('0x34'),_0x627034+'-'+_0x2671f6+'/'+_0x38bc7b)['json'](_0x4e5b34);}return null;};}function patchUpdates(_0x11caf9){return function(_0x417f5f){try{jsonpatch[_0xc565('0x35')](_0x417f5f,_0x11caf9,!![]);}catch(_0x5bfc58){return BPromise[_0xc565('0x36')](_0x5bfc58);}return _0x417f5f[_0xc565('0x37')]();};}function saveUpdates(_0x5354c2,_0x34989b){return function(_0x133c3e){if(_0x133c3e){return _0x133c3e[_0xc565('0x38')](_0x5354c2)[_0xc565('0x24')](function(_0x253445){return _0x253445;});}return null;};}function removeEntity(_0x22b5d5,_0x1c995c){return function(_0x3dc600){if(_0x3dc600){return _0x3dc600[_0xc565('0x39')]()[_0xc565('0x24')](function(){_0x22b5d5[_0xc565('0x2e')](0xcc)[_0xc565('0x2f')]();});}};}function handleEntityNotFound(_0x4bc9c8,_0x29683e){return function(_0x2c2f0b){if(!_0x2c2f0b){_0x4bc9c8[_0xc565('0x2d')](0x194);}return _0x2c2f0b;};}function handleError(_0x166159,_0xa7d27f){_0xa7d27f=_0xa7d27f||0x1f4;return function(_0x484613){logger[_0xc565('0x2a')](_0x484613[_0xc565('0x3a')]);if(_0x484613[_0xc565('0x3b')]){delete _0x484613[_0xc565('0x3b')];}_0x166159[_0xc565('0x2e')](_0xa7d27f)[_0xc565('0x3c')](_0x484613);};}exports[_0xc565('0x3d')]=function(_0x9fbe55,_0x2f1766){var _0x15ff97={},_0x460a5f={},_0x5db7e2={'count':0x0,'rows':[]};var _0x4173b3=_[_0xc565('0x3e')](db[_0xc565('0x3f')]['rawAttributes'],function(_0x12c3eb){return{'name':_0x12c3eb[_0xc565('0x40')],'type':_0x12c3eb['type']['key']};});_0x460a5f[_0xc565('0x41')]=_[_0xc565('0x3e')](_0x4173b3,_0xc565('0x3b'));_0x460a5f[_0xc565('0x42')]=_[_0xc565('0x43')](_0x9fbe55[_0xc565('0x42')]);_0x460a5f[_0xc565('0x44')]=_[_0xc565('0x45')](_0x460a5f[_0xc565('0x41')],_0x460a5f[_0xc565('0x42')]);_0x15ff97[_0xc565('0x46')]=_['intersection'](_0x460a5f['model'],qs[_0xc565('0x47')](_0x9fbe55['query'][_0xc565('0x47')]));_0x15ff97[_0xc565('0x46')]=_0x15ff97[_0xc565('0x46')][_0xc565('0x48')]?_0x15ff97[_0xc565('0x46')]:_0x460a5f[_0xc565('0x41')];if(!_0x9fbe55[_0xc565('0x42')][_0xc565('0x49')]('nolimit')){_0x15ff97['limit']=qs[_0xc565('0x33')](_0x9fbe55[_0xc565('0x42')][_0xc565('0x33')]);_0x15ff97['offset']=qs[_0xc565('0x32')](_0x9fbe55['query']['offset']);}_0x15ff97[_0xc565('0x4a')]=qs['sort'](_0x9fbe55['query'][_0xc565('0x4b')]);_0x15ff97[_0xc565('0x4c')]=qs[_0xc565('0x44')](_[_0xc565('0x4d')](_0x9fbe55[_0xc565('0x42')],_0x460a5f['filters']),_0x4173b3);if(_0x9fbe55[_0xc565('0x42')]['filter']){_0x15ff97[_0xc565('0x4c')]=_[_0xc565('0x4e')](_0x15ff97[_0xc565('0x4c')],{'$or':_['map'](_0x4173b3,function(_0x4a7dc7){if(_0x4a7dc7[_0xc565('0x4f')]!==_0xc565('0x50')){var _0x381fb3={};_0x381fb3[_0x4a7dc7[_0xc565('0x3b')]]={'$like':'%'+_0x9fbe55[_0xc565('0x42')]['filter']+'%'};return _0x381fb3;}})});}_0x15ff97=_[_0xc565('0x4e')]({},_0x15ff97,_0x9fbe55['options']);var _0x414464={'where':_0x15ff97[_0xc565('0x4c')]};return db[_0xc565('0x3f')][_0xc565('0x31')](_0x414464)['then'](function(_0x58489f){_0x5db7e2[_0xc565('0x31')]=_0x58489f;if(_0x9fbe55[_0xc565('0x42')]['includeAll']){_0x15ff97[_0xc565('0x51')]=[{'all':!![]}];}return db[_0xc565('0x3f')][_0xc565('0x52')](_0x15ff97);})[_0xc565('0x24')](function(_0x57590b){_0x5db7e2[_0xc565('0x53')]=_0x57590b;return _0x5db7e2;})[_0xc565('0x24')](respondWithFilteredResult(_0x2f1766,_0x15ff97))[_0xc565('0x2c')](handleError(_0x2f1766,null));};exports[_0xc565('0x54')]=function(_0x2741cb,_0x4168f3){var _0x45a100={'raw':!![],'where':{'id':_0x2741cb[_0xc565('0x55')]['id']}},_0xa007e={};_0xa007e['model']=_['keys'](db['ChatMessage']['rawAttributes']);_0xa007e[_0xc565('0x42')]=_[_0xc565('0x43')](_0x2741cb[_0xc565('0x42')]);_0xa007e['filters']=_['intersection'](_0xa007e[_0xc565('0x41')],_0xa007e[_0xc565('0x42')]);_0x45a100['attributes']=_[_0xc565('0x45')](_0xa007e[_0xc565('0x41')],qs[_0xc565('0x47')](_0x2741cb['query'][_0xc565('0x47')]));_0x45a100[_0xc565('0x46')]=_0x45a100[_0xc565('0x46')][_0xc565('0x48')]?_0x45a100[_0xc565('0x46')]:_0xa007e[_0xc565('0x41')];if(_0x2741cb[_0xc565('0x42')]['includeAll']){_0x45a100[_0xc565('0x51')]=[{'all':!![]}];}_0x45a100=_[_0xc565('0x4e')]({},_0x45a100,_0x2741cb['options']);return db[_0xc565('0x3f')][_0xc565('0x56')](_0x45a100)[_0xc565('0x24')](handleEntityNotFound(_0x4168f3,null))[_0xc565('0x24')](respondWithResult(_0x4168f3,null))[_0xc565('0x2c')](handleError(_0x4168f3,null));};exports[_0xc565('0x57')]=function(_0x54ed4b,_0x5165aa){return db[_0xc565('0x3f')]['create'](_0x54ed4b[_0xc565('0x58')],{})['then'](respondWithResult(_0x5165aa,0xc9))[_0xc565('0x2c')](handleError(_0x5165aa,null));};exports[_0xc565('0x38')]=function(_0x3436dc,_0x1ce022){if(_0x3436dc[_0xc565('0x58')]['id']){delete _0x3436dc['body']['id'];}return db[_0xc565('0x3f')][_0xc565('0x56')]({'where':{'id':_0x3436dc[_0xc565('0x55')]['id']}})[_0xc565('0x24')](handleEntityNotFound(_0x1ce022,null))['then'](saveUpdates(_0x3436dc[_0xc565('0x58')],null))[_0xc565('0x24')](respondWithResult(_0x1ce022,null))[_0xc565('0x2c')](handleError(_0x1ce022,null));};exports[_0xc565('0x39')]=function(_0x5e6f19,_0x20af4a){return db[_0xc565('0x3f')]['find']({'where':{'id':_0x5e6f19[_0xc565('0x55')]['id']}})['then'](handleEntityNotFound(_0x20af4a,null))[_0xc565('0x24')](removeEntity(_0x20af4a,null))[_0xc565('0x2c')](handleError(_0x20af4a,null));};exports['describe']=function(_0x261487,_0x20ba1f){return db[_0xc565('0x3f')][_0xc565('0x59')]()[_0xc565('0x24')](respondWithResult(_0x20ba1f,null))[_0xc565('0x2c')](handleError(_0x20ba1f,null));};var interaction_log=require(_0xc565('0x15'))(_0xc565('0x5a'));exports[_0xc565('0x5b')]=function(_0x5dce74,_0x93ea58,_0x45ef1e){var _0x29d322={'channel':'chat'};if(_0x5dce74[_0xc565('0x58')]['id']){delete _0x5dce74[_0xc565('0x58')]['id'];}_0x5dce74[_0xc565('0x58')][_0xc565('0x5c')]=!![];_0x5dce74['body']['readAt']=moment()[_0xc565('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5dce74['body'][_0xc565('0x5e')]=_0x5dce74[_0xc565('0x58')]['UserId']||_0x5dce74[_0xc565('0x5f')]['id'];return db[_0xc565('0x3f')][_0xc565('0x56')]({'where':{'id':_0x5dce74[_0xc565('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xc565('0x60')}]})[_0xc565('0x24')](handleEntityNotFound(_0x93ea58,null))[_0xc565('0x24')](saveUpdates(_0x5dce74['body'],null))[_0xc565('0x24')](function(_0x25129a){if(_0x25129a){_0x29d322['message']=_0x25129a['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x25129a[_0xc565('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x93ea58,null))[_0xc565('0x24')](function(_0x5188bb){if(_0x5188bb){return _0x5188bb['update']({'UserId':_0x5dce74[_0xc565('0x58')][_0xc565('0x5e')],'read1stAt':_['isNil'](_0x5188bb[_0xc565('0x62')])?moment()['format'](_0xc565('0x63')):undefined});}return null;})[_0xc565('0x24')](function(_0x133a7d){if(_0x133a7d){_0x29d322[_0xc565('0x64')]=_0x133a7d['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5dce74[_0xc565('0x5f')]['id'],_0x5dce74['user']['name'],_0x5dce74['user'][_0xc565('0x65')],_0x29d322['interaction']['id'],_0x5dce74['body']?JSON[_0xc565('0x66')](_0x5dce74[_0xc565('0x58')]):_0xc565('0x67'));return respondWithRpcPromise(_0xc565('0x68'),_0xc565('0x69'),_0x29d322);}return null;})[_0xc565('0x24')](function(_0x32a4a7){if(_0x32a4a7){if(_0x5dce74[_0xc565('0x58')][_0xc565('0x6a')]){_0x29d322[_0xc565('0x2b')]['interface']=util[_0xc565('0x5d')](_0xc565('0x6b'),_0x5dce74[_0xc565('0x5f')][_0xc565('0x3b')]);_0x29d322[_0xc565('0x2b')][_0xc565('0x6c')]=_0x29d322[_0xc565('0x6c')];_0x29d322['message'][_0xc565('0x6d')]=_0xc565('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xc565('0x6e'),'message':_[_0xc565('0x4e')](_0x29d322['message'],JSON[_0xc565('0x6f')](_0x29d322[_0xc565('0x64')][_0xc565('0x70')]))},client9002)[_0xc565('0x24')](function(){return _0x29d322;});}return _0x29d322;}return null;})[_0xc565('0x24')](respondWithResult(_0x93ea58,null))['catch'](handleError(_0x93ea58,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['reject']=function(_0x406e17,_0x54dab4,_0x2cfea1){var _0x55e011={'agent':{},'channel':'chat'};if(_0x406e17['body']['id']){delete _0x406e17[_0xc565('0x58')]['id'];}_0x406e17['body']['UserId']=_0x406e17[_0xc565('0x58')][_0xc565('0x5e')]||_0x406e17['user']['id'];_0x55e011[_0xc565('0x71')]['id']=_0x406e17[_0xc565('0x58')][_0xc565('0x5e')];return db[_0xc565('0x3f')][_0xc565('0x56')]({'where':{'id':_0x406e17[_0xc565('0x55')]['id'],'UserId':null}})[_0xc565('0x24')](handleEntityNotFound(_0x54dab4,null))[_0xc565('0x24')](function(_0x568e3a){if(_0x568e3a){_0x55e011['message']=_0x568e3a[_0xc565('0x72')]({'plain':!![]});return db[_0xc565('0x73')][_0xc565('0x56')]({'where':{'id':_0x568e3a[_0xc565('0x61')]}});}return null;})[_0xc565('0x24')](handleEntityNotFound(_0x54dab4,null))['then'](function(_0x403ad5){if(_0x403ad5){_0x55e011[_0xc565('0x64')]=_0x403ad5[_0xc565('0x72')]({'plain':!![]});interaction_log[_0xc565('0x25')](_0xc565('0x74'),_0x406e17[_0xc565('0x5f')]['id'],_0x406e17['user'][_0xc565('0x3b')],_0x406e17[_0xc565('0x5f')]['role'],_0x55e011['interaction']['id'],_0x406e17[_0xc565('0x58')]?JSON[_0xc565('0x66')](_0x406e17['body']):_0xc565('0x67'));return respondWithRpcPromise(_0xc565('0x75'),_0xc565('0x76'),_0x55e011);}return null;})[_0xc565('0x24')](function(_0x33d06b){if(_0x33d06b){_0x33d06b[_0xc565('0x2b')]['interface']=util[_0xc565('0x5d')]('SIP/%s',_0x406e17[_0xc565('0x5f')][_0xc565('0x3b')]);_0x33d06b['message'][_0xc565('0x6c')]=_0x55e011['channel'];_0x33d06b[_0xc565('0x2b')]['event']='reject';respondWithRpcPromise(_0xc565('0x77'),_0xc565('0x77'),{'event':_0xc565('0x78'),'message':_0x33d06b[_0xc565('0x2b')]},client9002);return _0x55e011;}return null;})[_0xc565('0x24')](respondWithResult(_0x54dab4,null))[_0xc565('0x2c')](handleError(_0x54dab4,null));}; \ No newline at end of file +var _0x5f36=['acceptmessage','parse','formData','chat-interactions','agent','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./chatMessage.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','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','ChatMessage','include','findAll','rows','show','params','options','find','create','body','destroy','accept','chat','read','readAt','format','UserId','user','CmContact','Contact','get','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f36,0x8c));var _0x65f3=function(_0x1e9a97,_0x58cd90){_0x1e9a97=_0x1e9a97-0x0;var _0xcfc391=_0x5f36[_0x1e9a97];return _0xcfc391;};'use strict';var pdf=require(_0x65f3('0x0'));var emlformat=require(_0x65f3('0x1'));var rimraf=require(_0x65f3('0x2'));var zipdir=require(_0x65f3('0x3'));var jsonpatch=require(_0x65f3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x65f3('0x5'));var Mustache=require(_0x65f3('0x6'));var util=require(_0x65f3('0x7'));var path=require('path');var sox=require(_0x65f3('0x8'));var csv=require(_0x65f3('0x9'));var ejs=require(_0x65f3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x65f3('0xb'));var crypto=require(_0x65f3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x65f3('0xd'));var toCsv=require(_0x65f3('0x9'));var querystring=require(_0x65f3('0xe'));var Papa=require(_0x65f3('0xf'));var Redis=require(_0x65f3('0x10'));var authService=require(_0x65f3('0x11'));var qs=require(_0x65f3('0x12'));var as=require(_0x65f3('0x13'));var hardwareService=require(_0x65f3('0x14'));var logger=require(_0x65f3('0x15'))(_0x65f3('0x16'));var utils=require(_0x65f3('0x17'));var config=require(_0x65f3('0x18'));var db=require('../../mysqldb')['db'];config[_0x65f3('0x19')]=_[_0x65f3('0x1a')](config[_0x65f3('0x19')],{'host':_0x65f3('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x65f3('0x1c'))[_0x65f3('0x1d')](socket);var jayson=require(_0x65f3('0x1e'));var client=jayson[_0x65f3('0x1f')][_0x65f3('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x65f3('0x20')]({'port':0x232a});function checkPasswordPattern(_0x26fb2c,_0x2a1627,_0x2929f8){if(_0x2929f8){var _0x13b1b0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x13b1b0[_0x65f3('0x21')](_0x2a1627)){return _0x26fb2c;}else{throw new db[(_0x65f3('0x22'))][(_0x65f3('0x23'))](_0x65f3('0x24'));}}else{return _0x26fb2c;}}function respondWithRpcPromise(_0x5c78ff,_0x461a10,_0x28dc95,_0x3c2ff6){return new BPromise(function(_0x1afee8,_0x2a809a){var _0x3a4f95=_0x3c2ff6||client;return _0x3a4f95[_0x65f3('0x25')](_0x5c78ff,_0x28dc95)[_0x65f3('0x26')](function(_0x37c2ed){logger[_0x65f3('0x27')](_0x65f3('0x28'),_0x461a10,_0x65f3('0x29'));logger[_0x65f3('0x2a')](_0x65f3('0x2b'),_0x461a10,_0x65f3('0x29'),JSON[_0x65f3('0x2c')](_0x37c2ed));if(_0x37c2ed[_0x65f3('0x2d')]){if(_0x37c2ed[_0x65f3('0x2d')][_0x65f3('0x2e')]===0x1f4){logger[_0x65f3('0x2d')](_0x65f3('0x28'),_0x461a10,_0x37c2ed[_0x65f3('0x2d')][_0x65f3('0x2f')]);return _0x2a809a(_0x37c2ed[_0x65f3('0x2d')]['message']);}logger[_0x65f3('0x2d')]('ChatMessage,\x20%s,\x20%s',_0x461a10,_0x37c2ed[_0x65f3('0x2d')][_0x65f3('0x2f')]);return _0x1afee8(_0x37c2ed[_0x65f3('0x2d')][_0x65f3('0x2f')]);}else{logger[_0x65f3('0x27')](_0x65f3('0x28'),_0x461a10,_0x65f3('0x29'));_0x1afee8(_0x37c2ed[_0x65f3('0x30')][_0x65f3('0x2f')]);}})[_0x65f3('0x31')](function(_0x49850c){logger[_0x65f3('0x2d')](_0x65f3('0x28'),_0x461a10,_0x49850c);_0x2a809a(_0x49850c);});});}function respondWithStatusCode(_0xa39a2d,_0x12dba5){_0x12dba5=_0x12dba5||0xcc;return function(_0x3690a1){if(_0x3690a1){return _0xa39a2d[_0x65f3('0x32')](_0x12dba5);}return _0xa39a2d[_0x65f3('0x33')](_0x12dba5)[_0x65f3('0x34')]();};}function respondWithResult(_0x3f7ae6,_0x146215){_0x146215=_0x146215||0xc8;return function(_0x1951b1){if(_0x1951b1){return _0x3f7ae6[_0x65f3('0x33')](_0x146215)['json'](_0x1951b1);}};}function respondWithFilteredResult(_0x3ca401,_0x433b08){return function(_0x348af4){if(_0x348af4){var _0x53a100=_0x348af4[_0x65f3('0x35')],_0x17d696=_0x433b08[_0x65f3('0x36')],_0x2adff6=_0x433b08[_0x65f3('0x36')]+_0x433b08[_0x65f3('0x37')],_0x474edc;if(_0x2adff6>=_0x53a100){_0x2adff6=_0x53a100;_0x474edc=0xc8;}else{_0x474edc=0xce;}_0x3ca401['status'](_0x474edc);return _0x3ca401[_0x65f3('0x38')]('Content-Range',_0x17d696+'-'+_0x2adff6+'/'+_0x53a100)['json'](_0x348af4);}return null;};}function patchUpdates(_0x2e30a4){return function(_0x4000dc){try{jsonpatch[_0x65f3('0x39')](_0x4000dc,_0x2e30a4,!![]);}catch(_0x2eb768){return BPromise[_0x65f3('0x3a')](_0x2eb768);}return _0x4000dc[_0x65f3('0x3b')]();};}function saveUpdates(_0x26d21f,_0x369c5b){return function(_0x585087){if(_0x585087){return _0x585087[_0x65f3('0x3c')](_0x26d21f)[_0x65f3('0x26')](function(_0x86e9fa){return _0x86e9fa;});}return null;};}function removeEntity(_0x13b0b4,_0x2954dd){return function(_0x1f5775){if(_0x1f5775){return _0x1f5775['destroy']()['then'](function(){_0x13b0b4[_0x65f3('0x33')](0xcc)[_0x65f3('0x34')]();});}};}function handleEntityNotFound(_0x4a548f,_0x1e30b7){return function(_0x23f432){if(!_0x23f432){_0x4a548f[_0x65f3('0x32')](0x194);}return _0x23f432;};}function handleError(_0x174de9,_0x3c31d3){_0x3c31d3=_0x3c31d3||0x1f4;return function(_0x46ac2c){logger[_0x65f3('0x2d')](_0x46ac2c[_0x65f3('0x3d')]);if(_0x46ac2c['name']){delete _0x46ac2c['name'];}_0x174de9[_0x65f3('0x33')](_0x3c31d3)[_0x65f3('0x3e')](_0x46ac2c);};}exports[_0x65f3('0x3f')]=function(_0x2a6e11,_0x470b45){var _0x2849e3={},_0x55769e={},_0x4a06ca={'count':0x0,'rows':[]};var _0x5a1371=_[_0x65f3('0x40')](db['ChatMessage'][_0x65f3('0x41')],function(_0xf56f4f){return{'name':_0xf56f4f[_0x65f3('0x42')],'type':_0xf56f4f[_0x65f3('0x43')][_0x65f3('0x44')]};});_0x55769e[_0x65f3('0x45')]=_[_0x65f3('0x40')](_0x5a1371,_0x65f3('0x46'));_0x55769e[_0x65f3('0x47')]=_[_0x65f3('0x48')](_0x2a6e11[_0x65f3('0x47')]);_0x55769e[_0x65f3('0x49')]=_[_0x65f3('0x4a')](_0x55769e[_0x65f3('0x45')],_0x55769e[_0x65f3('0x47')]);_0x2849e3['attributes']=_[_0x65f3('0x4a')](_0x55769e[_0x65f3('0x45')],qs[_0x65f3('0x4b')](_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x4b')]));_0x2849e3[_0x65f3('0x4c')]=_0x2849e3[_0x65f3('0x4c')][_0x65f3('0x4d')]?_0x2849e3[_0x65f3('0x4c')]:_0x55769e['model'];if(!_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x4e')](_0x65f3('0x4f'))){_0x2849e3[_0x65f3('0x37')]=qs[_0x65f3('0x37')](_0x2a6e11['query'][_0x65f3('0x37')]);_0x2849e3['offset']=qs[_0x65f3('0x36')](_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x36')]);}_0x2849e3[_0x65f3('0x50')]=qs[_0x65f3('0x51')](_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x51')]);_0x2849e3[_0x65f3('0x52')]=qs[_0x65f3('0x49')](_['pick'](_0x2a6e11['query'],_0x55769e['filters']),_0x5a1371);if(_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x53')]){_0x2849e3[_0x65f3('0x52')]=_['merge'](_0x2849e3[_0x65f3('0x52')],{'$or':_['map'](_0x5a1371,function(_0x12b8ca){if(_0x12b8ca[_0x65f3('0x43')]!==_0x65f3('0x54')){var _0x155fcb={};_0x155fcb[_0x12b8ca[_0x65f3('0x46')]]={'$like':'%'+_0x2a6e11[_0x65f3('0x47')][_0x65f3('0x53')]+'%'};return _0x155fcb;}})});}_0x2849e3=_[_0x65f3('0x55')]({},_0x2849e3,_0x2a6e11['options']);var _0x12b2fc={'where':_0x2849e3[_0x65f3('0x52')]};return db[_0x65f3('0x56')][_0x65f3('0x35')](_0x12b2fc)['then'](function(_0x16a426){_0x4a06ca[_0x65f3('0x35')]=_0x16a426;if(_0x2a6e11[_0x65f3('0x47')]['includeAll']){_0x2849e3[_0x65f3('0x57')]=[{'all':!![]}];}return db['ChatMessage'][_0x65f3('0x58')](_0x2849e3);})[_0x65f3('0x26')](function(_0x218f27){_0x4a06ca[_0x65f3('0x59')]=_0x218f27;return _0x4a06ca;})[_0x65f3('0x26')](respondWithFilteredResult(_0x470b45,_0x2849e3))[_0x65f3('0x31')](handleError(_0x470b45,null));};exports[_0x65f3('0x5a')]=function(_0x10d58e,_0x39cbc2){var _0x5a0986={'raw':!![],'where':{'id':_0x10d58e[_0x65f3('0x5b')]['id']}},_0x1c57b2={};_0x1c57b2[_0x65f3('0x45')]=_['keys'](db[_0x65f3('0x56')][_0x65f3('0x41')]);_0x1c57b2[_0x65f3('0x47')]=_[_0x65f3('0x48')](_0x10d58e[_0x65f3('0x47')]);_0x1c57b2[_0x65f3('0x49')]=_[_0x65f3('0x4a')](_0x1c57b2[_0x65f3('0x45')],_0x1c57b2[_0x65f3('0x47')]);_0x5a0986[_0x65f3('0x4c')]=_['intersection'](_0x1c57b2[_0x65f3('0x45')],qs['fields'](_0x10d58e[_0x65f3('0x47')][_0x65f3('0x4b')]));_0x5a0986[_0x65f3('0x4c')]=_0x5a0986['attributes'][_0x65f3('0x4d')]?_0x5a0986[_0x65f3('0x4c')]:_0x1c57b2[_0x65f3('0x45')];if(_0x10d58e[_0x65f3('0x47')]['includeAll']){_0x5a0986[_0x65f3('0x57')]=[{'all':!![]}];}_0x5a0986=_[_0x65f3('0x55')]({},_0x5a0986,_0x10d58e[_0x65f3('0x5c')]);return db[_0x65f3('0x56')][_0x65f3('0x5d')](_0x5a0986)[_0x65f3('0x26')](handleEntityNotFound(_0x39cbc2,null))[_0x65f3('0x26')](respondWithResult(_0x39cbc2,null))[_0x65f3('0x31')](handleError(_0x39cbc2,null));};exports[_0x65f3('0x5e')]=function(_0xa274df,_0x32b504){return db[_0x65f3('0x56')][_0x65f3('0x5e')](_0xa274df[_0x65f3('0x5f')],{})[_0x65f3('0x26')](respondWithResult(_0x32b504,0xc9))[_0x65f3('0x31')](handleError(_0x32b504,null));};exports[_0x65f3('0x3c')]=function(_0x18f4c8,_0x5d6da4){if(_0x18f4c8['body']['id']){delete _0x18f4c8[_0x65f3('0x5f')]['id'];}return db[_0x65f3('0x56')][_0x65f3('0x5d')]({'where':{'id':_0x18f4c8[_0x65f3('0x5b')]['id']}})[_0x65f3('0x26')](handleEntityNotFound(_0x5d6da4,null))[_0x65f3('0x26')](saveUpdates(_0x18f4c8[_0x65f3('0x5f')],null))[_0x65f3('0x26')](respondWithResult(_0x5d6da4,null))[_0x65f3('0x31')](handleError(_0x5d6da4,null));};exports[_0x65f3('0x60')]=function(_0x58ca8f,_0x5a59ed){return db[_0x65f3('0x56')][_0x65f3('0x5d')]({'where':{'id':_0x58ca8f['params']['id']}})[_0x65f3('0x26')](handleEntityNotFound(_0x5a59ed,null))['then'](removeEntity(_0x5a59ed,null))[_0x65f3('0x31')](handleError(_0x5a59ed,null));};exports['describe']=function(_0x2d6d8a,_0x1b8e04){return db['ChatMessage']['describe']()[_0x65f3('0x26')](respondWithResult(_0x1b8e04,null))[_0x65f3('0x31')](handleError(_0x1b8e04,null));};var interaction_log=require(_0x65f3('0x15'))('chat-interactions');exports[_0x65f3('0x61')]=function(_0x5dfeeb,_0x4d0c1b,_0x513229){var _0x551829={'channel':_0x65f3('0x62')};if(_0x5dfeeb[_0x65f3('0x5f')]['id']){delete _0x5dfeeb[_0x65f3('0x5f')]['id'];}_0x5dfeeb['body'][_0x65f3('0x63')]=!![];_0x5dfeeb[_0x65f3('0x5f')][_0x65f3('0x64')]=moment()[_0x65f3('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x5dfeeb[_0x65f3('0x5f')][_0x65f3('0x66')]=_0x5dfeeb[_0x65f3('0x5f')]['UserId']||_0x5dfeeb[_0x65f3('0x67')]['id'];return db['ChatMessage']['find']({'where':{'id':_0x5dfeeb['params']['id'],'UserId':null},'include':[{'model':db[_0x65f3('0x68')],'as':_0x65f3('0x69')}]})[_0x65f3('0x26')](handleEntityNotFound(_0x4d0c1b,null))[_0x65f3('0x26')](saveUpdates(_0x5dfeeb['body'],null))['then'](function(_0x93b302){if(_0x93b302){_0x551829[_0x65f3('0x2f')]=_0x93b302[_0x65f3('0x6a')]({'plain':!![]});return db['ChatInteraction'][_0x65f3('0x5d')]({'where':{'id':_0x93b302[_0x65f3('0x6b')]}});}return null;})[_0x65f3('0x26')](handleEntityNotFound(_0x4d0c1b,null))[_0x65f3('0x26')](function(_0x33ba35){if(_0x33ba35){return _0x33ba35[_0x65f3('0x3c')]({'UserId':_0x5dfeeb[_0x65f3('0x5f')][_0x65f3('0x66')],'read1stAt':_['isNil'](_0x33ba35[_0x65f3('0x6c')])?moment()[_0x65f3('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x65f3('0x26')](function(_0x1c7cf8){if(_0x1c7cf8){_0x551829['interaction']=_0x1c7cf8[_0x65f3('0x6a')]({'plain':!![]});interaction_log[_0x65f3('0x27')](_0x65f3('0x6d'),_0x5dfeeb[_0x65f3('0x67')]['id'],_0x5dfeeb[_0x65f3('0x67')][_0x65f3('0x46')],_0x5dfeeb['user'][_0x65f3('0x6e')],_0x551829[_0x65f3('0x6f')]['id'],_0x5dfeeb[_0x65f3('0x5f')]?JSON[_0x65f3('0x2c')](_0x5dfeeb[_0x65f3('0x5f')]):_0x65f3('0x70'));return respondWithRpcPromise(_0x65f3('0x71'),'acceptMessage',_0x551829);}return null;})['then'](function(_0x3f49fa){if(_0x3f49fa){if(_0x5dfeeb[_0x65f3('0x5f')][_0x65f3('0x72')]){_0x551829[_0x65f3('0x2f')][_0x65f3('0x73')]=util[_0x65f3('0x65')](_0x65f3('0x74'),_0x5dfeeb[_0x65f3('0x67')][_0x65f3('0x46')]);_0x551829['message'][_0x65f3('0x75')]=_0x551829[_0x65f3('0x75')];_0x551829[_0x65f3('0x2f')][_0x65f3('0x76')]=_0x65f3('0x61');return respondWithRpcPromise(_0x65f3('0x77'),_0x65f3('0x77'),{'event':_0x65f3('0x78'),'message':_['merge'](_0x551829[_0x65f3('0x2f')],JSON[_0x65f3('0x79')](_0x551829['interaction'][_0x65f3('0x7a')]))},client9002)[_0x65f3('0x26')](function(){return _0x551829;});}return _0x551829;}return null;})[_0x65f3('0x26')](respondWithResult(_0x4d0c1b,null))[_0x65f3('0x31')](handleError(_0x4d0c1b,null));};var interaction_log=require(_0x65f3('0x15'))(_0x65f3('0x7b'));exports[_0x65f3('0x3a')]=function(_0x4982ec,_0x231ff9,_0x368dd8){var _0x4f24b6={'agent':{},'channel':_0x65f3('0x62')};if(_0x4982ec[_0x65f3('0x5f')]['id']){delete _0x4982ec[_0x65f3('0x5f')]['id'];}_0x4982ec[_0x65f3('0x5f')][_0x65f3('0x66')]=_0x4982ec[_0x65f3('0x5f')][_0x65f3('0x66')]||_0x4982ec[_0x65f3('0x67')]['id'];_0x4f24b6[_0x65f3('0x7c')]['id']=_0x4982ec[_0x65f3('0x5f')][_0x65f3('0x66')];return db[_0x65f3('0x56')][_0x65f3('0x5d')]({'where':{'id':_0x4982ec[_0x65f3('0x5b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x231ff9,null))[_0x65f3('0x26')](function(_0xf0f87f){if(_0xf0f87f){_0x4f24b6['message']=_0xf0f87f[_0x65f3('0x6a')]({'plain':!![]});return db[_0x65f3('0x7d')][_0x65f3('0x5d')]({'where':{'id':_0xf0f87f[_0x65f3('0x6b')]}});}return null;})[_0x65f3('0x26')](handleEntityNotFound(_0x231ff9,null))[_0x65f3('0x26')](function(_0x28f7e0){if(_0x28f7e0){_0x4f24b6[_0x65f3('0x6f')]=_0x28f7e0[_0x65f3('0x6a')]({'plain':!![]});interaction_log[_0x65f3('0x27')](_0x65f3('0x7e'),_0x4982ec[_0x65f3('0x67')]['id'],_0x4982ec[_0x65f3('0x67')][_0x65f3('0x46')],_0x4982ec[_0x65f3('0x67')]['role'],_0x4f24b6[_0x65f3('0x6f')]['id'],_0x4982ec[_0x65f3('0x5f')]?JSON[_0x65f3('0x2c')](_0x4982ec['body']):_0x65f3('0x70'));return respondWithRpcPromise(_0x65f3('0x7f'),_0x65f3('0x80'),_0x4f24b6);}return null;})[_0x65f3('0x26')](function(_0x4818da){if(_0x4818da){_0x4818da[_0x65f3('0x2f')][_0x65f3('0x73')]=util[_0x65f3('0x65')](_0x65f3('0x74'),_0x4982ec[_0x65f3('0x67')]['name']);_0x4818da[_0x65f3('0x2f')][_0x65f3('0x75')]=_0x4f24b6[_0x65f3('0x75')];_0x4818da[_0x65f3('0x2f')][_0x65f3('0x76')]=_0x65f3('0x3a');respondWithRpcPromise(_0x65f3('0x77'),_0x65f3('0x77'),{'event':_0x65f3('0x81'),'message':_0x4818da['message']},client9002);return _0x4f24b6;}return null;})[_0x65f3('0x26')](respondWithResult(_0x231ff9,null))[_0x65f3('0x31')](handleError(_0x231ff9,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index e8e05c8..883de11 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 _0x8e02=['events','ChatMessage','setMaxListeners','save','update','remove','emit','hook'];(function(_0x3b9c4c,_0x208154){var _0x33e636=function(_0x576e99){while(--_0x576e99){_0x3b9c4c['push'](_0x3b9c4c['shift']());}};_0x33e636(++_0x208154);}(_0x8e02,0x1e8));var _0x28e0=function(_0x2170f4,_0x25eaf1){_0x2170f4=_0x2170f4-0x0;var _0x33bb21=_0x8e02[_0x2170f4];return _0x33bb21;};'use strict';var EventEmitter=require(_0x28e0('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x28e0('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x28e0('0x2')](0x0);var events={'afterCreate':_0x28e0('0x3'),'afterUpdate':_0x28e0('0x4'),'afterDestroy':_0x28e0('0x5')};function emitEvent(_0x1921ad){return function(_0x47919b,_0x4561ba,_0x2dd43f){ChatMessageEvents[_0x28e0('0x6')](_0x1921ad+':'+_0x47919b['id'],_0x47919b);ChatMessageEvents[_0x28e0('0x6')](_0x1921ad,_0x47919b);_0x2dd43f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x28e0('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x95d0=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x43b629,_0x3fcb3c){var _0x23f6f8=function(_0x384d52){while(--_0x384d52){_0x43b629['push'](_0x43b629['shift']());}};_0x23f6f8(++_0x3fcb3c);}(_0x95d0,0x17b));var _0x095d=function(_0x517172,_0x11273e){_0x517172=_0x517172-0x0;var _0x3c5770=_0x95d0[_0x517172];return _0x3c5770;};'use strict';var EventEmitter=require(_0x095d('0x0'));var ChatMessage=require(_0x095d('0x1'))['db'][_0x095d('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x095d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x095d('0x4')};function emitEvent(_0xb27d09){return function(_0x2b9a77,_0x260b4d,_0x366ca7){ChatMessageEvents[_0x095d('0x5')](_0xb27d09+':'+_0x2b9a77['id'],_0x2b9a77);ChatMessageEvents['emit'](_0xb27d09,_0x2b9a77);_0x366ca7(null);};}for(var e in events){if(events[_0x095d('0x6')](e)){var event=events[e];ChatMessage[_0x095d('0x7')](e,emitEvent(event));}}module[_0x095d('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a6e3a8b..6a689f2 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 _0xfebb=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','utf8mb4_unicode_ci','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfebb,0x16b));var _0xbfeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbfeb('0x0'));var util=require(_0xbfeb('0x1'));var logger=require(_0xbfeb('0x2'))(_0xbfeb('0x3'));var moment=require(_0xbfeb('0x4'));var BPromise=require('bluebird');var rp=require(_0xbfeb('0x5'));var fs=require('fs');var path=require(_0xbfeb('0x6'));var rimraf=require('rimraf');var config=require(_0xbfeb('0x7'));var attributes=require(_0xbfeb('0x8'));module[_0xbfeb('0x9')]=function(_0x4f594f,_0xd257aa){return _0x4f594f[_0xbfeb('0xa')](_0xbfeb('0xb'),attributes,{'tableName':_0xbfeb('0xc'),'paranoid':![],'indexes':[{'name':_0xbfeb('0xd'),'fields':[_0xbfeb('0xe')],'type':_0xbfeb('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x673bd1,_0x42bba1,_0x344888){var _0x3b3bfa=_0x4f594f['models'];var _0x4ef001=_0x673bd1['get']({'plain':!![]});if(_0x4ef001[_0xbfeb('0x10')][_0xbfeb('0x11')]()==='in'||_0x4ef001[_0xbfeb('0x10')][_0xbfeb('0x11')]()==='out'&&!_0x4ef001['secret']&&!_['isNil'](_0x4ef001[_0xbfeb('0x12')])){_0x3b3bfa[_0xbfeb('0x13')][_0xbfeb('0x14')]({'where':{'id':_0x4ef001[_0xbfeb('0x15')]}})[_0xbfeb('0x16')](function(_0x1ca3c1){if(_0x1ca3c1){_0x1ca3c1['update']({'lastMsgAt':_0x4ef001[_0xbfeb('0x17')],'lastMsgDirection':_0x4ef001[_0xbfeb('0x10')][_0xbfeb('0x11')]()});}})[_0xbfeb('0x18')](function(_0x4cdb31){console['error'](_0x4cdb31);});}_0x344888();}},'charset':'utf8mb4','collate':_0xbfeb('0x19')});}; \ No newline at end of file +var _0x514f=['findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','api','moment','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction'];(function(_0x125c77,_0x5ae623){var _0x3b7a0=function(_0x6ed97d){while(--_0x6ed97d){_0x125c77['push'](_0x125c77['shift']());}};_0x3b7a0(++_0x5ae623);}(_0x514f,0xb6));var _0xf514=function(_0x4d4efb,_0x39c4fd){_0x4d4efb=_0x4d4efb-0x0;var _0x100eea=_0x514f[_0x4d4efb];return _0x100eea;};'use strict';var _=require(_0xf514('0x0'));var util=require(_0xf514('0x1'));var logger=require('../../config/logger')(_0xf514('0x2'));var moment=require(_0xf514('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf514('0x4'));var rimraf=require('rimraf');var config=require(_0xf514('0x5'));var attributes=require(_0xf514('0x6'));module[_0xf514('0x7')]=function(_0x310c8e,_0x3764b9){return _0x310c8e[_0xf514('0x8')](_0xf514('0x9'),attributes,{'tableName':_0xf514('0xa'),'paranoid':![],'indexes':[{'name':_0xf514('0xb'),'fields':['body'],'type':_0xf514('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x533e9d,_0x3ddfc0,_0xddebd6){var _0x268209=_0x310c8e['models'];var _0x38310b=_0x533e9d[_0xf514('0xd')]({'plain':!![]});if(_0x38310b[_0xf514('0xe')]['toLowerCase']()==='in'||_0x38310b[_0xf514('0xe')][_0xf514('0xf')]()===_0xf514('0x10')&&!_0x38310b[_0xf514('0x11')]&&!_[_0xf514('0x12')](_0x38310b[_0xf514('0x13')])){_0x268209[_0xf514('0x14')][_0xf514('0x15')]({'where':{'id':_0x38310b[_0xf514('0x16')]}})[_0xf514('0x17')](function(_0x1b1fce){if(_0x1b1fce){_0x1b1fce[_0xf514('0x18')]({'lastMsgAt':_0x38310b[_0xf514('0x19')],'lastMsgDirection':_0x38310b[_0xf514('0xe')][_0xf514('0xf')]()});}})[_0xf514('0x1a')](function(_0x467b75){console[_0xf514('0x1b')](_0x467b75);});}_0xddebd6();}},'charset':_0xf514('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 2e9848a..ce05b05 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 _0x83ec=['ChatMessage,\x20%s,\x20%s','message','create','options','raw','CreateChatMessage','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','then','info','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5669a5,_0x5cbb95){var _0x3995ef=function(_0x2ad6d3){while(--_0x2ad6d3){_0x5669a5['push'](_0x5669a5['shift']());}};_0x3995ef(++_0x5cbb95);}(_0x83ec,0x1bb));var _0xc83e=function(_0x2a623f,_0x275a97){_0x2a623f=_0x2a623f-0x0;var _0x2cdca2=_0x83ec[_0x2a623f];return _0x2cdca2;};'use strict';var _=require(_0xc83e('0x0'));var util=require('util');var moment=require(_0xc83e('0x1'));var BPromise=require(_0xc83e('0x2'));var rs=require(_0xc83e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc83e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc83e('0x5'));var config=require(_0xc83e('0x6'));var jayson=require(_0xc83e('0x7'));var client=jayson[_0xc83e('0x8')]['http']({'port':0x232a});config[_0xc83e('0x9')]=_[_0xc83e('0xa')](config['redis'],{'host':_0xc83e('0xb'),'port':0x18eb});var socket=require(_0xc83e('0xc'))(new Redis(config[_0xc83e('0x9')]));require(_0xc83e('0xd'))['register'](socket);function respondWithRpcPromise(_0x26a8fe,_0x145131,_0x2c3f91){return new BPromise(function(_0x1909eb,_0x44ee43){return client['request'](_0x26a8fe,_0x2c3f91)[_0xc83e('0xe')](function(_0x472f95){logger[_0xc83e('0xf')]('ChatMessage,\x20%s,\x20%s',_0x145131,'request\x20sent');logger['debug'](_0xc83e('0x10'),_0x145131,_0xc83e('0x11'),JSON[_0xc83e('0x12')](_0x472f95));if(_0x472f95[_0xc83e('0x13')]){if(_0x472f95[_0xc83e('0x13')][_0xc83e('0x14')]===0x1f4){logger[_0xc83e('0x13')](_0xc83e('0x15'),_0x145131,_0x472f95[_0xc83e('0x13')][_0xc83e('0x16')]);return _0x44ee43(_0x472f95['error'][_0xc83e('0x16')]);}logger[_0xc83e('0x13')](_0xc83e('0x15'),_0x145131,_0x472f95[_0xc83e('0x13')][_0xc83e('0x16')]);return _0x1909eb(_0x472f95[_0xc83e('0x13')][_0xc83e('0x16')]);}else{logger[_0xc83e('0xf')](_0xc83e('0x15'),_0x145131,_0xc83e('0x11'));_0x1909eb(_0x472f95['result'][_0xc83e('0x16')]);}})['catch'](function(_0x4c5889){logger[_0xc83e('0x13')]('ChatMessage,\x20%s,\x20%s',_0x145131,_0x4c5889);_0x44ee43(_0x4c5889);});});}exports['CreateChatMessage']=function(_0x41b0f9){var _0xf24e95=this;return new Promise(function(_0x36ffa4,_0x533197){return db['ChatMessage'][_0xc83e('0x17')](_0x41b0f9['body'],{'raw':_0x41b0f9['options']?_0x41b0f9[_0xc83e('0x18')][_0xc83e('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x545ff3){logger[_0xc83e('0xf')](_0xc83e('0x1a'),_0x41b0f9);logger[_0xc83e('0x1b')]('CreateChatMessage',_0x41b0f9,JSON[_0xc83e('0x12')](_0x545ff3));_0x36ffa4(_0x545ff3);})[_0xc83e('0x1c')](function(_0x4b0a0f){logger[_0xc83e('0x13')](_0xc83e('0x1a'),_0x4b0a0f[_0xc83e('0x16')],_0x41b0f9);_0x533197(_0xf24e95[_0xc83e('0x13')](0x1f4,_0x4b0a0f[_0xc83e('0x16')]));});});}; \ No newline at end of file +var _0x25cf=['CreateChatMessage','ChatMessage','create','options','info','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x1e73fc,_0x533750){var _0xeceac4=function(_0x2c6dda){while(--_0x2c6dda){_0x1e73fc['push'](_0x1e73fc['shift']());}};_0xeceac4(++_0x533750);}(_0x25cf,0x17e));var _0xf25c=function(_0x1fd275,_0xcc9e18){_0x1fd275=_0x1fd275-0x0;var _0x2f7280=_0x25cf[_0x1fd275];return _0x2f7280;};'use strict';var _=require(_0xf25c('0x0'));var util=require(_0xf25c('0x1'));var moment=require(_0xf25c('0x2'));var BPromise=require('bluebird');var rs=require(_0xf25c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf25c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf25c('0x5'));var config=require(_0xf25c('0x6'));var jayson=require(_0xf25c('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xf25c('0x8')]=_[_0xf25c('0x9')](config[_0xf25c('0x8')],{'host':_0xf25c('0xa'),'port':0x18eb});var socket=require(_0xf25c('0xb'))(new Redis(config[_0xf25c('0x8')]));require(_0xf25c('0xc'))[_0xf25c('0xd')](socket);function respondWithRpcPromise(_0x157f53,_0x626e40,_0x251a38){return new BPromise(function(_0x533ba1,_0x4111ce){return client[_0xf25c('0xe')](_0x157f53,_0x251a38)[_0xf25c('0xf')](function(_0x2c946a){logger['info'](_0xf25c('0x10'),_0x626e40,_0xf25c('0x11'));logger[_0xf25c('0x12')](_0xf25c('0x13'),_0x626e40,'request\x20sent',JSON[_0xf25c('0x14')](_0x2c946a));if(_0x2c946a[_0xf25c('0x15')]){if(_0x2c946a[_0xf25c('0x15')]['code']===0x1f4){logger[_0xf25c('0x15')](_0xf25c('0x10'),_0x626e40,_0x2c946a[_0xf25c('0x15')]['message']);return _0x4111ce(_0x2c946a[_0xf25c('0x15')][_0xf25c('0x16')]);}logger[_0xf25c('0x15')](_0xf25c('0x10'),_0x626e40,_0x2c946a['error'][_0xf25c('0x16')]);return _0x533ba1(_0x2c946a['error'][_0xf25c('0x16')]);}else{logger['info'](_0xf25c('0x10'),_0x626e40,_0xf25c('0x11'));_0x533ba1(_0x2c946a[_0xf25c('0x17')]['message']);}})['catch'](function(_0x1ffd4b){logger['error'](_0xf25c('0x10'),_0x626e40,_0x1ffd4b);_0x4111ce(_0x1ffd4b);});});}exports[_0xf25c('0x18')]=function(_0x5c7734){var _0xcc12ec=this;return new Promise(function(_0x420f29,_0x3444b6){return db[_0xf25c('0x19')][_0xf25c('0x1a')](_0x5c7734['body'],{'raw':_0x5c7734[_0xf25c('0x1b')]?_0x5c7734[_0xf25c('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xf25c('0xf')](function(_0x249289){logger[_0xf25c('0x1c')]('CreateChatMessage',_0x5c7734);logger[_0xf25c('0x12')]('CreateChatMessage',_0x5c7734,JSON[_0xf25c('0x14')](_0x249289));_0x420f29(_0x249289);})['catch'](function(_0x4b81b4){logger[_0xf25c('0x15')](_0xf25c('0x18'),_0x4b81b4[_0xf25c('0x16')],_0x5c7734);_0x3444b6(_0xcc12ec['error'](0x1f4,_0x4b81b4['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e6fdee2..a477d20 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 _0x1967=['remove','update','emit','removeListener','length','save'];(function(_0xfc8a66,_0x23e658){var _0x561927=function(_0x2e309c){while(--_0x2e309c){_0xfc8a66['push'](_0xfc8a66['shift']());}};_0x561927(++_0x23e658);}(_0x1967,0x173));var _0x7196=function(_0x31a5dd,_0x1ee33d){_0x31a5dd=_0x31a5dd-0x0;var _0x2052e8=_0x1967[_0x31a5dd];return _0x2052e8;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2')];function createListener(_0x35803d,_0x3319fa){return function(_0xa80a3f){_0x3319fa[_0x7196('0x3')](_0x35803d,_0xa80a3f);};}function removeListener(_0x1aaddd,_0x458ae8){return function(){ChatMessageEvents[_0x7196('0x4')](_0x1aaddd,_0x458ae8);};}exports['register']=function(_0x36b01e){for(var _0x186175=0x0,_0x194746=events[_0x7196('0x5')];_0x186175<_0x194746;_0x186175++){var _0x266a6e=events[_0x186175];var _0xad78a=createListener('chatMessage:'+_0x266a6e,_0x36b01e);ChatMessageEvents['on'](_0x266a6e,_0xad78a);}}; \ No newline at end of file +var _0x5d58=['register'];(function(_0x1966ad,_0x43f2f3){var _0x5d7637=function(_0x24b943){while(--_0x24b943){_0x1966ad['push'](_0x1966ad['shift']());}};_0x5d7637(++_0x43f2f3);}(_0x5d58,0x187));var _0x85d5=function(_0x1aa871,_0x11f9b8){_0x1aa871=_0x1aa871-0x0;var _0x26dc2c=_0x5d58[_0x1aa871];return _0x26dc2c;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save','remove','update'];function createListener(_0x501631,_0x64d32c){return function(_0x1eff3b){_0x64d32c['emit'](_0x501631,_0x1eff3b);};}function removeListener(_0x1469fc,_0x30bfe8){return function(){ChatMessageEvents['removeListener'](_0x1469fc,_0x30bfe8);};}exports[_0x85d5('0x0')]=function(_0x2d457a){for(var _0x578fad=0x0,_0x46e7b4=events['length'];_0x578fad<_0x46e7b4;_0x578fad++){var _0x98c963=events[_0x578fad];var _0x3fecca=createListener('chatMessage:'+_0x98c963,_0x2d457a);ChatMessageEvents['on'](_0x98c963,_0x3fecca);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index f3ad7e0..0c7480d 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 _0xc163=['update','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/:id','post','tracked','chat','chatmessage:create','put'];(function(_0x42ab81,_0x5e8d63){var _0x37f3c0=function(_0x19e4e2){while(--_0x19e4e2){_0x42ab81['push'](_0x42ab81['shift']());}};_0x37f3c0(++_0x5e8d63);}(_0xc163,0x13a));var _0x3c16=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc163[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3c16('0x0'));var util=require(_0x3c16('0x1'));var path=require(_0x3c16('0x2'));var timeout=require('connect-timeout');var express=require(_0x3c16('0x3'));var router=express['Router']();var auth=require(_0x3c16('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3c16('0x5'));var controller=require(_0x3c16('0x6'));router['get']('/',auth[_0x3c16('0x7')](),controller[_0x3c16('0x8')]);router[_0x3c16('0x9')]('/describe',auth[_0x3c16('0x7')](),controller['describe']);router[_0x3c16('0x9')](_0x3c16('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3c16('0xb')]('/',auth[_0x3c16('0x7')](),interaction[_0x3c16('0xc')](_0x3c16('0xd'),_0x3c16('0xe')),controller['create']);router[_0x3c16('0xf')](_0x3c16('0xa'),controller[_0x3c16('0x10')]);router[_0x3c16('0xf')]('/:id/accept',auth[_0x3c16('0x7')](),controller['accept']);router[_0x3c16('0xf')](_0x3c16('0x11'),auth[_0x3c16('0x7')](),controller[_0x3c16('0x12')]);router[_0x3c16('0x13')]('/:id',auth[_0x3c16('0x7')](),controller[_0x3c16('0x14')]);module[_0x3c16('0x15')]=router; \ No newline at end of file +var _0x737b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chatmessage:create','create','put','update','reject','delete','exports'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x737b,0x113));var _0xb737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x737b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb737('0x0'));var util=require(_0xb737('0x1'));var path=require(_0xb737('0x2'));var timeout=require(_0xb737('0x3'));var express=require(_0xb737('0x4'));var router=express[_0xb737('0x5')]();var auth=require(_0xb737('0x6'));var interaction=require(_0xb737('0x7'));var config=require('../../config/environment');var controller=require(_0xb737('0x8'));router[_0xb737('0x9')]('/',auth[_0xb737('0xa')](),controller[_0xb737('0xb')]);router[_0xb737('0x9')](_0xb737('0xc'),auth[_0xb737('0xa')](),controller[_0xb737('0xd')]);router[_0xb737('0x9')](_0xb737('0xe'),auth[_0xb737('0xa')](),controller[_0xb737('0xf')]);router[_0xb737('0x10')]('/',auth[_0xb737('0xa')](),interaction[_0xb737('0x11')]('chat',_0xb737('0x12')),controller[_0xb737('0x13')]);router[_0xb737('0x14')](_0xb737('0xe'),controller[_0xb737('0x15')]);router['put']('/:id/accept',auth[_0xb737('0xa')](),controller['accept']);router[_0xb737('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xb737('0x16')]);router[_0xb737('0x17')](_0xb737('0xe'),auth[_0xb737('0xa')](),controller['destroy']);module[_0xb737('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 84c0c01..2b9f938 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 _0x9b75=['medium','sequelize','TEXT'];(function(_0x2d49ee,_0x445589){var _0x4f3888=function(_0x4d2005){while(--_0x4d2005){_0x2d49ee['push'](_0x2d49ee['shift']());}};_0x4f3888(++_0x445589);}(_0x9b75,0x11e));var _0x59b7=function(_0xb4a369,_0x4cf2d4){_0xb4a369=_0xb4a369-0x0;var _0x11846e=_0x9b75[_0xb4a369];return _0x11846e;};'use strict';var Sequelize=require(_0x59b7('0x0'));module['exports']={'body':{'type':Sequelize[_0x59b7('0x1')](_0x59b7('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x6b57=['medium','sequelize'];(function(_0x5d316a,_0x513433){var _0x2f22c4=function(_0x2c8e14){while(--_0x2c8e14){_0x5d316a['push'](_0x5d316a['shift']());}};_0x2f22c4(++_0x513433);}(_0x6b57,0x189));var _0x76b5=function(_0x58d5c3,_0x15c603){_0x58d5c3=_0x58d5c3-0x0;var _0x429aa6=_0x6b57[_0x58d5c3];return _0x429aa6;};'use strict';var Sequelize=require(_0x76b5('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x76b5('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 763bd69..f671137 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 _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','ChatOfflineMessage','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(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'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['ChatOfflineMessage']['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['ChatOfflineMessage'][_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['ChatOfflineMessage'][_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['ChatOfflineMessage'][_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 +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','ChatOfflineMessage','rawAttributes','fieldName','type','name','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where'];(function(_0x3b1a35,_0x34bf56){var _0x1679ec=function(_0x5b8782){while(--_0x5b8782){_0x3b1a35['push'](_0x3b1a35['shift']());}};_0x1679ec(++_0x34bf56);}(_0x3baf,0xf7));var _0xf3ba=function(_0x283b97,_0x2dd687){_0x283b97=_0x283b97-0x0;var _0xe5cbb9=_0x3baf[_0x283b97];return _0xe5cbb9;};'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['ChatOfflineMessage'][_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/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 12bf3fc..4fddcf8 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 _0x441b=['utf8mb4','lodash','api','moment','bluebird','path','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x441b,0xab));var _0xb441=function(_0x399124,_0x34f584){_0x399124=_0x399124-0x0;var _0x355e09=_0x441b[_0x399124];return _0x355e09;};'use strict';var _=require(_0xb441('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb441('0x1'));var moment=require(_0xb441('0x2'));var BPromise=require(_0xb441('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb441('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatOfflineMessage.attributes');module[_0xb441('0x5')]=function(_0x5ce4e4,_0x298b6a){return _0x5ce4e4[_0xb441('0x6')](_0xb441('0x7'),attributes,{'tableName':_0xb441('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb441('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xae77=['lodash','bluebird','request-promise','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x13a80b,_0x28ca68){var _0x4ddbe6=function(_0x4d0ab9){while(--_0x4d0ab9){_0x13a80b['push'](_0x13a80b['shift']());}};_0x4ddbe6(++_0x28ca68);}(_0xae77,0x1cc));var _0x7ae7=function(_0x55328,_0x56beb2){_0x55328=_0x55328-0x0;var _0x4216da=_0xae77[_0x55328];return _0x4216da;};'use strict';var _=require(_0x7ae7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7ae7('0x1'));var rp=require(_0x7ae7('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7ae7('0x3'));var attributes=require(_0x7ae7('0x4'));module[_0x7ae7('0x5')]=function(_0x4280b8,_0xf020f7){return _0x4280b8[_0x7ae7('0x6')]('ChatOfflineMessage',attributes,{'tableName':_0x7ae7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7ae7('0x8'),'collate':_0x7ae7('0x9')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 4ea81a0..86a9bec 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 _0x1456=['request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0x1456,0x99));var _0x6145=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0x1456[_0xc14df7];return _0x34a445;};'use strict';var _=require(_0x6145('0x0'));var util=require(_0x6145('0x1'));var moment=require(_0x6145('0x2'));var BPromise=require('bluebird');var rs=require(_0x6145('0x3'));var fs=require('fs');var Redis=require(_0x6145('0x4'));var db=require(_0x6145('0x5'))['db'];var utils=require(_0x6145('0x6'));var logger=require('../../config/logger')(_0x6145('0x7'));var config=require(_0x6145('0x8'));var jayson=require(_0x6145('0x9'));var client=jayson[_0x6145('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19b17e,_0x150706,_0x5cfeac){return new BPromise(function(_0x4f78c6,_0x26e98e){return client[_0x6145('0xb')](_0x19b17e,_0x5cfeac)[_0x6145('0xc')](function(_0x240fcb){logger[_0x6145('0xd')](_0x6145('0xe'),_0x150706,_0x6145('0xf'));logger[_0x6145('0x10')](_0x6145('0x11'),_0x150706,_0x6145('0xf'),JSON[_0x6145('0x12')](_0x240fcb));if(_0x240fcb[_0x6145('0x13')]){if(_0x240fcb[_0x6145('0x13')][_0x6145('0x14')]===0x1f4){logger[_0x6145('0x13')](_0x6145('0xe'),_0x150706,_0x240fcb[_0x6145('0x13')][_0x6145('0x15')]);return _0x26e98e(_0x240fcb[_0x6145('0x13')][_0x6145('0x15')]);}logger[_0x6145('0x13')](_0x6145('0xe'),_0x150706,_0x240fcb[_0x6145('0x13')][_0x6145('0x15')]);return _0x4f78c6(_0x240fcb[_0x6145('0x13')][_0x6145('0x15')]);}else{logger[_0x6145('0xd')](_0x6145('0xe'),_0x150706,'request\x20sent');_0x4f78c6(_0x240fcb[_0x6145('0x16')][_0x6145('0x15')]);}})[_0x6145('0x17')](function(_0x536a7c){logger[_0x6145('0x13')](_0x6145('0xe'),_0x150706,_0x536a7c);_0x26e98e(_0x536a7c);});});} \ No newline at end of file +var _0x7155=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment'];(function(_0x21fded,_0x203183){var _0x5927de=function(_0x1e5762){while(--_0x1e5762){_0x21fded['push'](_0x21fded['shift']());}};_0x5927de(++_0x203183);}(_0x7155,0x1cd));var _0x5715=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7155[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5715('0x0'));var BPromise=require(_0x5715('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5715('0x2'));var db=require(_0x5715('0x3'))['db'];var utils=require(_0x5715('0x4'));var logger=require(_0x5715('0x5'))(_0x5715('0x6'));var config=require(_0x5715('0x7'));var jayson=require(_0x5715('0x8'));var client=jayson[_0x5715('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dc34a,_0x5de47a,_0x64cecc){return new BPromise(function(_0x150810,_0x464c7d){return client[_0x5715('0xa')](_0x5dc34a,_0x64cecc)[_0x5715('0xb')](function(_0x31212b){logger[_0x5715('0xc')](_0x5715('0xd'),_0x5de47a,_0x5715('0xe'));logger['debug'](_0x5715('0xf'),_0x5de47a,_0x5715('0xe'),JSON[_0x5715('0x10')](_0x31212b));if(_0x31212b['error']){if(_0x31212b[_0x5715('0x11')][_0x5715('0x12')]===0x1f4){logger[_0x5715('0x11')](_0x5715('0xd'),_0x5de47a,_0x31212b[_0x5715('0x11')][_0x5715('0x13')]);return _0x464c7d(_0x31212b['error'][_0x5715('0x13')]);}logger[_0x5715('0x11')](_0x5715('0xd'),_0x5de47a,_0x31212b['error'][_0x5715('0x13')]);return _0x150810(_0x31212b['error'][_0x5715('0x13')]);}else{logger[_0x5715('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5de47a,'request\x20sent');_0x150810(_0x31212b[_0x5715('0x14')][_0x5715('0x13')]);}})[_0x5715('0x15')](function(_0x2d5fd8){logger[_0x5715('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5de47a,_0x2d5fd8);_0x464c7d(_0x2d5fd8);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 922e9b9..06124c6 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 _0x9bb9=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./chatOfflineMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','post','create','delete'];(function(_0x492850,_0x280443){var _0x254a15=function(_0x59725c){while(--_0x59725c){_0x492850['push'](_0x492850['shift']());}};_0x254a15(++_0x280443);}(_0x9bb9,0x1e8));var _0x99bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bb9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x99bb('0x0'));var util=require(_0x99bb('0x1'));var path=require('path');var timeout=require(_0x99bb('0x2'));var express=require(_0x99bb('0x3'));var router=express[_0x99bb('0x4')]();var auth=require(_0x99bb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x99bb('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x99bb('0x7')]);router[_0x99bb('0x8')](_0x99bb('0x9'),auth[_0x99bb('0xa')](),controller[_0x99bb('0xb')]);router[_0x99bb('0x8')](_0x99bb('0xc'),auth[_0x99bb('0xa')](),controller['show']);router[_0x99bb('0xd')]('/',auth[_0x99bb('0xa')](),controller[_0x99bb('0xe')]);router['put'](_0x99bb('0xc'),auth[_0x99bb('0xa')](),controller['update']);router[_0x99bb('0xf')]('/:id',auth[_0x99bb('0xa')](),controller[_0x99bb('0x10')]);module[_0x99bb('0x11')]=router; \ No newline at end of file +var _0x489f=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2c42c8,_0x47255d){var _0x3625c1=function(_0x16ca1f){while(--_0x16ca1f){_0x2c42c8['push'](_0x2c42c8['shift']());}};_0x3625c1(++_0x47255d);}(_0x489f,0x74));var _0xf489=function(_0x168a88,_0x3cc193){_0x168a88=_0x168a88-0x0;var _0x40943b=_0x489f[_0x168a88];return _0x40943b;};'use strict';var multer=require(_0xf489('0x0'));var util=require(_0xf489('0x1'));var path=require(_0xf489('0x2'));var timeout=require(_0xf489('0x3'));var express=require(_0xf489('0x4'));var router=express['Router']();var auth=require(_0xf489('0x5'));var interaction=require(_0xf489('0x6'));var config=require(_0xf489('0x7'));var controller=require(_0xf489('0x8'));router[_0xf489('0x9')]('/',auth[_0xf489('0xa')](),controller['index']);router['get'](_0xf489('0xb'),auth[_0xf489('0xa')](),controller[_0xf489('0xc')]);router[_0xf489('0x9')](_0xf489('0xd'),auth[_0xf489('0xa')](),controller[_0xf489('0xe')]);router[_0xf489('0xf')]('/',auth[_0xf489('0xa')](),controller[_0xf489('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf489('0x11')](_0xf489('0xd'),auth[_0xf489('0xa')](),controller[_0xf489('0x12')]);module[_0xf489('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index d8982e2..54602c0 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 _0x29e7=['ENUM','timeout','mouseOver','sequelize','STRING'];(function(_0xbfc389,_0x5aad2e){var _0x31583a=function(_0x3fddcd){while(--_0x3fddcd){_0xbfc389['push'](_0xbfc389['shift']());}};_0x31583a(++_0x5aad2e);}(_0x29e7,0x107));var _0x729e=function(_0xbe8a1e,_0x34b388){_0xbe8a1e=_0xbe8a1e-0x0;var _0x359277=_0x29e7[_0xbe8a1e];return _0x359277;};'use strict';var Sequelize=require(_0x729e('0x0'));module['exports']={'name':{'type':Sequelize[_0x729e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x729e('0x2')]('mouseOver',_0x729e('0x3')),'defaultValue':_0x729e('0x4')},'selector':{'type':Sequelize[_0x729e('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4c5f=['STRING','mouseOver','sequelize','exports'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x4c5f,0xe6));var _0xf4c5=function(_0x592dea,_0x410e09){_0x592dea=_0x592dea-0x0;var _0xaf3266=_0x4c5f[_0x592dea];return _0xaf3266;};'use strict';var Sequelize=require(_0xf4c5('0x0'));module[_0xf4c5('0x1')]={'name':{'type':Sequelize[_0xf4c5('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf4c5('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xf4c5('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a290262..b73d5db 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 _0xd8b0=['eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show','params','keys','rawAttributes','filters','model','attributes','intersection','length','query','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','html-pdf'];(function(_0xe28139,_0x427723){var _0x17a410=function(_0xcda3d){while(--_0xcda3d){_0xe28139['push'](_0xe28139['shift']());}};_0x17a410(++_0x427723);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={'raw':!![],'where':{'id':_0xa2af02[_0x0d8b('0x28')]['id']}},_0x28f639={};_0x28f639['model']=_[_0x0d8b('0x29')](db['ChatProactiveAction'][_0x0d8b('0x2a')]);_0x28f639['query']=_[_0x0d8b('0x29')](_0xa2af02['query']);_0x28f639[_0x0d8b('0x2b')]=_['intersection'](_0x28f639[_0x0d8b('0x2c')],_0x28f639['query']);_0x59a905[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x28f639[_0x0d8b('0x2c')],qs['fields'](_0xa2af02['query']['fields']));_0x59a905[_0x0d8b('0x2d')]=_0x59a905['attributes'][_0x0d8b('0x2f')]?_0x59a905['attributes']:_0x28f639['model'];if(_0xa2af02[_0x0d8b('0x30')][_0x0d8b('0x31')]){_0x59a905[_0x0d8b('0x32')]=[{'all':!![]}];}_0x59a905=_[_0x0d8b('0x33')]({},_0x59a905,_0xa2af02[_0x0d8b('0x34')]);return db[_0x0d8b('0x35')][_0x0d8b('0x36')](_0x59a905)[_0x0d8b('0x22')](handleEntityNotFound(_0x4fe6f9,null))['then'](respondWithResult(_0x4fe6f9,null))[_0x0d8b('0x37')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x38')]=function(_0x4b3ea0,_0xb18586){return db[_0x0d8b('0x35')][_0x0d8b('0x38')](_0x4b3ea0['body'],{})[_0x0d8b('0x22')](respondWithResult(_0xb18586,0xc9))[_0x0d8b('0x37')](handleError(_0xb18586,null));};exports[_0x0d8b('0x21')]=function(_0x31ceba,_0x933e01){if(_0x31ceba['body']['id']){delete _0x31ceba[_0x0d8b('0x39')]['id'];}return db[_0x0d8b('0x35')]['find']({'where':{'id':_0x31ceba[_0x0d8b('0x28')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x933e01,null))[_0x0d8b('0x22')](saveUpdates(_0x31ceba[_0x0d8b('0x39')],null))[_0x0d8b('0x22')](respondWithResult(_0x933e01,null))['catch'](handleError(_0x933e01,null));};exports['destroy']=function(_0x41b4f9,_0x5c2c04){return db['ChatProactiveAction'][_0x0d8b('0x36')]({'where':{'id':_0x41b4f9[_0x0d8b('0x28')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x5c2c04,null))[_0x0d8b('0x22')](removeEntity(_0x5c2c04,null))[_0x0d8b('0x37')](handleError(_0x5c2c04,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(_0xe63b9d,_0x15c6c5){var _0x21d653=function(_0xaa126f){while(--_0xaa126f){_0xe63b9d['push'](_0xe63b9d['shift']());}};_0x21d653(++_0x15c6c5);}(_0x70e0,0x17b));var _0x070e=function(_0xe3762e,_0x4a49b9){_0xe3762e=_0xe3762e-0x0;var _0x4d6151=_0x70e0[_0xe3762e];return _0x4d6151;};'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 0aea584..f3888b0 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 _0xf981=['moment','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','api'];(function(_0x493b19,_0x19b6bc){var _0x1cbab8=function(_0x4a1576){while(--_0x4a1576){_0x493b19['push'](_0x493b19['shift']());}};_0x1cbab8(++_0x19b6bc);}(_0xf981,0x8a));var _0x1f98=function(_0x36bd10,_0x4c8261){_0x36bd10=_0x36bd10-0x0;var _0x18327a=_0xf981[_0x36bd10];return _0x18327a;};'use strict';var _=require(_0x1f98('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1f98('0x1'));var moment=require(_0x1f98('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f98('0x3'));var rimraf=require(_0x1f98('0x4'));var config=require(_0x1f98('0x5'));var attributes=require(_0x1f98('0x6'));module[_0x1f98('0x7')]=function(_0xca4d71,_0xac53d9){return _0xca4d71['define'](_0x1f98('0x8'),attributes,{'tableName':_0x1f98('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x343c=['util','../../config/logger','api','bluebird','path','rimraf','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x343c,0x7e));var _0xc343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x343c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xc343('0x0'));var logger=require(_0xc343('0x1'))(_0xc343('0x2'));var moment=require('moment');var BPromise=require(_0xc343('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc343('0x4'));var rimraf=require(_0xc343('0x5'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0xc343('0x6')]=function(_0x21daaa,_0x12867b){return _0x21daaa['define'](_0xc343('0x7'),attributes,{'tableName':_0xc343('0x8'),'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 20fe2bd..bbe2e58 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 _0x07b8=['info','request\x20sent','error','code','ChatProactiveAction,\x20%s,\x20%s','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request'];(function(_0x55ec67,_0x1c90d5){var _0x1350f6=function(_0x5ed223){while(--_0x5ed223){_0x55ec67['push'](_0x55ec67['shift']());}};_0x1350f6(++_0x1c90d5);}(_0x07b8,0xf6));var _0x807b=function(_0x18d50f,_0x124aff){_0x18d50f=_0x18d50f-0x0;var _0x8ce385=_0x07b8[_0x18d50f];return _0x8ce385;};'use strict';var _=require('lodash');var util=require(_0x807b('0x0'));var moment=require(_0x807b('0x1'));var BPromise=require('bluebird');var rs=require(_0x807b('0x2'));var fs=require('fs');var Redis=require(_0x807b('0x3'));var db=require(_0x807b('0x4'))['db'];var utils=require(_0x807b('0x5'));var logger=require('../../config/logger')(_0x807b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x807b('0x7')][_0x807b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d79d,_0x3a0212,_0x3e91e4){return new BPromise(function(_0x28115b,_0x24baec){return client[_0x807b('0x9')](_0x5d79d,_0x3e91e4)['then'](function(_0x4d580d){logger[_0x807b('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x3a0212,_0x807b('0xb'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3a0212,_0x807b('0xb'),JSON['stringify'](_0x4d580d));if(_0x4d580d['error']){if(_0x4d580d[_0x807b('0xc')][_0x807b('0xd')]===0x1f4){logger[_0x807b('0xc')](_0x807b('0xe'),_0x3a0212,_0x4d580d['error'][_0x807b('0xf')]);return _0x24baec(_0x4d580d[_0x807b('0xc')][_0x807b('0xf')]);}logger[_0x807b('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x3a0212,_0x4d580d[_0x807b('0xc')][_0x807b('0xf')]);return _0x28115b(_0x4d580d[_0x807b('0xc')][_0x807b('0xf')]);}else{logger[_0x807b('0xa')](_0x807b('0xe'),_0x3a0212,'request\x20sent');_0x28115b(_0x4d580d['result']['message']);}})['catch'](function(_0x3c098){logger[_0x807b('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x3a0212,_0x3c098);_0x24baec(_0x3c098);});});} \ No newline at end of file +var _0x45ca=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x203a3b,_0x58128b){var _0x1aaace=function(_0x40e645){while(--_0x40e645){_0x203a3b['push'](_0x203a3b['shift']());}};_0x1aaace(++_0x58128b);}(_0x45ca,0x122));var _0xa45c=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x45ca[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xa45c('0x0'));var util=require(_0xa45c('0x1'));var moment=require(_0xa45c('0x2'));var BPromise=require(_0xa45c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa45c('0x4'));var db=require(_0xa45c('0x5'))['db'];var utils=require(_0xa45c('0x6'));var logger=require(_0xa45c('0x7'))(_0xa45c('0x8'));var config=require(_0xa45c('0x9'));var jayson=require(_0xa45c('0xa'));var client=jayson[_0xa45c('0xb')][_0xa45c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e7aeb,_0xf76ecd,_0x282582){return new BPromise(function(_0x4c90a0,_0x332942){return client[_0xa45c('0xd')](_0x1e7aeb,_0x282582)['then'](function(_0x22bdc4){logger[_0xa45c('0xe')](_0xa45c('0xf'),_0xf76ecd,_0xa45c('0x10'));logger[_0xa45c('0x11')](_0xa45c('0x12'),_0xf76ecd,'request\x20sent',JSON[_0xa45c('0x13')](_0x22bdc4));if(_0x22bdc4[_0xa45c('0x14')]){if(_0x22bdc4[_0xa45c('0x14')][_0xa45c('0x15')]===0x1f4){logger[_0xa45c('0x14')](_0xa45c('0xf'),_0xf76ecd,_0x22bdc4[_0xa45c('0x14')][_0xa45c('0x16')]);return _0x332942(_0x22bdc4[_0xa45c('0x14')][_0xa45c('0x16')]);}logger['error'](_0xa45c('0xf'),_0xf76ecd,_0x22bdc4['error'][_0xa45c('0x16')]);return _0x4c90a0(_0x22bdc4['error'][_0xa45c('0x16')]);}else{logger[_0xa45c('0xe')](_0xa45c('0xf'),_0xf76ecd,_0xa45c('0x10'));_0x4c90a0(_0x22bdc4[_0xa45c('0x17')]['message']);}})['catch'](function(_0x3bd106){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0xf76ecd,_0x3bd106);_0x332942(_0x3bd106);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index aae56e3..06566aa 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 _0xbb5b=['/:id','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','post'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xbb5b,0x154));var _0xbbb5=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0xbb5b[_0x5180c3];return _0x55c975;};'use strict';var multer=require(_0xbbb5('0x0'));var util=require('util');var path=require(_0xbbb5('0x1'));var timeout=require('connect-timeout');var express=require(_0xbbb5('0x2'));var router=express[_0xbbb5('0x3')]();var auth=require(_0xbbb5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbbb5('0x5'));var controller=require('./chatProactiveAction.controller');router['get']('/:id',auth[_0xbbb5('0x6')](),controller['show']);router[_0xbbb5('0x7')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbbb5('0x8'),auth[_0xbbb5('0x6')](),controller[_0xbbb5('0x9')]);router[_0xbbb5('0xa')]('/:id',auth[_0xbbb5('0x6')](),controller['destroy']);module[_0xbbb5('0xb')]=router; \ No newline at end of file +var _0x3dff=['../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x3dff,0x1bc));var _0xf3df=function(_0x103216,_0x6fdbb7){_0x103216=_0x103216-0x0;var _0x5012f6=_0x3dff[_0x103216];return _0x5012f6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf3df('0x0'));var express=require('express');var router=express[_0xf3df('0x1')]();var auth=require(_0xf3df('0x2'));var interaction=require(_0xf3df('0x3'));var config=require(_0xf3df('0x4'));var controller=require(_0xf3df('0x5'));router[_0xf3df('0x6')](_0xf3df('0x7'),auth[_0xf3df('0x8')](),controller[_0xf3df('0x9')]);router[_0xf3df('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf3df('0xb')](_0xf3df('0x7'),auth['isAuthenticated'](),controller[_0xf3df('0xc')]);router[_0xf3df('0xd')](_0xf3df('0x7'),auth['isAuthenticated'](),controller[_0xf3df('0xe')]);module[_0xf3df('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ca994e1..b02c293 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 _0x6a84=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x5c3f80,_0x4c9cd0){var _0x48872c=function(_0x42dc02){while(--_0x42dc02){_0x5c3f80['push'](_0x5c3f80['shift']());}};_0x48872c(++_0x4c9cd0);}(_0x6a84,0x116));var _0x46a8=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x6a84[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0x46a8('0x0'));module[_0x46a8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x46a8('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x46a8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x46a8('0x4'),_0x46a8('0x5'),_0x46a8('0x6'))}}; \ No newline at end of file +var _0xdaab=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','name','STRING'];(function(_0x3e31b3,_0x4bbc02){var _0x2d701b=function(_0x277b0f){while(--_0x277b0f){_0x3e31b3['push'](_0x3e31b3['shift']());}};_0x2d701b(++_0x4bbc02);}(_0xdaab,0x1b5));var _0xbdaa=function(_0x4cd727,_0x37335e){_0x4cd727=_0x4cd727-0x0;var _0x9f3a81=_0xdaab[_0x4cd727];return _0x9f3a81;};'use strict';var Sequelize=require('sequelize');module[_0xbdaa('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xbdaa('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbdaa('0x2')]},'timeout':{'type':Sequelize[_0xbdaa('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbdaa('0x4')](_0xbdaa('0x5'),_0xbdaa('0x6'),_0xbdaa('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e3ba594..771974a 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 _0x9f3f=['forEach','emit','userChatQueue:save','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','ChatQueues','stack','name','send','map','ChatQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','find','create','body','user','UserProfileSection','autoAssociation','UserProfileResource','params','describe','findOne','UserChatQueue','order','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9f3f,0xae));var _0xf9f3=function(_0x2cb870,_0x178ba3){_0x2cb870=_0x2cb870-0x0;var _0x559f67=_0x9f3f[_0x2cb870];return _0x559f67;};'use strict';var pdf=require(_0xf9f3('0x0'));var emlformat=require(_0xf9f3('0x1'));var rimraf=require(_0xf9f3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf9f3('0x3'));var moment=require(_0xf9f3('0x4'));var BPromise=require(_0xf9f3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf9f3('0x6'));var sox=require(_0xf9f3('0x7'));var csv=require(_0xf9f3('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf9f3('0x9'));var squel=require(_0xf9f3('0xa'));var crypto=require(_0xf9f3('0xb'));var jsforce=require(_0xf9f3('0xc'));var deskjs=require(_0xf9f3('0xd'));var toCsv=require(_0xf9f3('0x8'));var querystring=require('querystring');var Papa=require(_0xf9f3('0xe'));var Redis=require('ioredis');var authService=require(_0xf9f3('0xf'));var qs=require(_0xf9f3('0x10'));var as=require(_0xf9f3('0x11'));var hardwareService=require(_0xf9f3('0x12'));var logger=require(_0xf9f3('0x13'))(_0xf9f3('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf9f3('0x15'))['db'];config[_0xf9f3('0x16')]=_[_0xf9f3('0x17')](config[_0xf9f3('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9f3('0x18'))(new Redis(config['redis']));require(_0xf9f3('0x19'))[_0xf9f3('0x1a')](socket);var jayson=require(_0xf9f3('0x1b'));var client=jayson[_0xf9f3('0x1c')][_0xf9f3('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x5288d7,_0x8648c3,_0x46cfb8){if(_0x46cfb8){var _0x5d4869=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d4869[_0xf9f3('0x1e')](_0x8648c3)){return _0x5288d7;}else{throw new db[(_0xf9f3('0x1f'))][(_0xf9f3('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 _0x5288d7;}}function respondWithRpcPromise(_0x272f4f,_0x538451,_0x5b5e6b,_0x304926){return new BPromise(function(_0x4b096a,_0x5efd52){var _0x3c9e8a=_0x304926||client;return _0x3c9e8a[_0xf9f3('0x21')](_0x272f4f,_0x5b5e6b)[_0xf9f3('0x22')](function(_0x17921d){logger[_0xf9f3('0x23')](_0xf9f3('0x24'),_0x538451,_0xf9f3('0x25'));logger[_0xf9f3('0x26')](_0xf9f3('0x27'),_0x538451,_0xf9f3('0x25'),JSON[_0xf9f3('0x28')](_0x17921d));if(_0x17921d[_0xf9f3('0x29')]){if(_0x17921d[_0xf9f3('0x29')][_0xf9f3('0x2a')]===0x1f4){logger[_0xf9f3('0x29')](_0xf9f3('0x24'),_0x538451,_0x17921d[_0xf9f3('0x29')][_0xf9f3('0x2b')]);return _0x5efd52(_0x17921d[_0xf9f3('0x29')][_0xf9f3('0x2b')]);}logger[_0xf9f3('0x29')](_0xf9f3('0x24'),_0x538451,_0x17921d[_0xf9f3('0x29')][_0xf9f3('0x2b')]);return _0x4b096a(_0x17921d[_0xf9f3('0x29')]['message']);}else{logger['info'](_0xf9f3('0x24'),_0x538451,_0xf9f3('0x25'));_0x4b096a(_0x17921d[_0xf9f3('0x2c')][_0xf9f3('0x2b')]);}})[_0xf9f3('0x2d')](function(_0x31f131){logger[_0xf9f3('0x29')](_0xf9f3('0x24'),_0x538451,_0x31f131);_0x5efd52(_0x31f131);});});}function respondWithStatusCode(_0x262dc5,_0x86c730){_0x86c730=_0x86c730||0xcc;return function(_0x40c733){if(_0x40c733){return _0x262dc5[_0xf9f3('0x2e')](_0x86c730);}return _0x262dc5[_0xf9f3('0x2f')](_0x86c730)[_0xf9f3('0x30')]();};}function respondWithResult(_0x4add60,_0x14176a){_0x14176a=_0x14176a||0xc8;return function(_0x125736){if(_0x125736){return _0x4add60[_0xf9f3('0x2f')](_0x14176a)[_0xf9f3('0x31')](_0x125736);}};}function respondWithFilteredResult(_0x283230,_0x17d8cd){return function(_0x4690aa){if(_0x4690aa){var _0x33d2a1=_0x4690aa[_0xf9f3('0x32')],_0x1a8543=_0x17d8cd[_0xf9f3('0x33')],_0x54f935=_0x17d8cd[_0xf9f3('0x33')]+_0x17d8cd[_0xf9f3('0x34')],_0x3ddc46;if(_0x54f935>=_0x33d2a1){_0x54f935=_0x33d2a1;_0x3ddc46=0xc8;}else{_0x3ddc46=0xce;}_0x283230[_0xf9f3('0x2f')](_0x3ddc46);return _0x283230[_0xf9f3('0x35')](_0xf9f3('0x36'),_0x1a8543+'-'+_0x54f935+'/'+_0x33d2a1)[_0xf9f3('0x31')](_0x4690aa);}return null;};}function patchUpdates(_0x35e6a1){return function(_0xcaa6e3){try{jsonpatch[_0xf9f3('0x37')](_0xcaa6e3,_0x35e6a1,!![]);}catch(_0x5e8793){return BPromise[_0xf9f3('0x38')](_0x5e8793);}return _0xcaa6e3['save']();};}function saveUpdates(_0x1f7329,_0x4ab98b){return function(_0x2b87b9){if(_0x2b87b9){return _0x2b87b9[_0xf9f3('0x39')](_0x1f7329)[_0xf9f3('0x22')](function(_0x14f779){return _0x14f779;});}return null;};}function removeEntity(_0x395001,_0x158ade){return function(_0x1d7dc1){if(_0x1d7dc1){return _0x1d7dc1[_0xf9f3('0x3a')]()['then'](function(){var _0x5ebcce=_0x1d7dc1[_0xf9f3('0x3b')]({'plain':!![]});var _0x52daf3=_0xf9f3('0x3c');return db['UserProfileResource'][_0xf9f3('0x3a')]({'where':{'type':_0x52daf3,'resourceId':_0x5ebcce['id']}})[_0xf9f3('0x22')](function(){return _0x1d7dc1;});})[_0xf9f3('0x22')](function(){_0x395001['status'](0xcc)[_0xf9f3('0x30')]();});}};}function handleEntityNotFound(_0x20f1ae,_0x36df4e){return function(_0xe8d6b7){if(!_0xe8d6b7){_0x20f1ae['sendStatus'](0x194);}return _0xe8d6b7;};}function handleError(_0x6066d8,_0x30e79b){_0x30e79b=_0x30e79b||0x1f4;return function(_0x24a4c8){logger[_0xf9f3('0x29')](_0x24a4c8[_0xf9f3('0x3d')]);if(_0x24a4c8[_0xf9f3('0x3e')]){delete _0x24a4c8['name'];}_0x6066d8['status'](_0x30e79b)[_0xf9f3('0x3f')](_0x24a4c8);};}exports['index']=function(_0x1c6d49,_0x6ee063){var _0xc8f07f={},_0x1722b8={},_0x432a1d={'count':0x0,'rows':[]};var _0x5e0315=_[_0xf9f3('0x40')](db[_0xf9f3('0x41')][_0xf9f3('0x42')],function(_0x439073){return{'name':_0x439073[_0xf9f3('0x43')],'type':_0x439073['type'][_0xf9f3('0x44')]};});_0x1722b8[_0xf9f3('0x45')]=_[_0xf9f3('0x40')](_0x5e0315,_0xf9f3('0x3e'));_0x1722b8[_0xf9f3('0x46')]=_[_0xf9f3('0x47')](_0x1c6d49['query']);_0x1722b8['filters']=_[_0xf9f3('0x48')](_0x1722b8[_0xf9f3('0x45')],_0x1722b8['query']);_0xc8f07f[_0xf9f3('0x49')]=_[_0xf9f3('0x48')](_0x1722b8[_0xf9f3('0x45')],qs[_0xf9f3('0x4a')](_0x1c6d49[_0xf9f3('0x46')][_0xf9f3('0x4a')]));_0xc8f07f['attributes']=_0xc8f07f['attributes'][_0xf9f3('0x4b')]?_0xc8f07f['attributes']:_0x1722b8[_0xf9f3('0x45')];if(!_0x1c6d49[_0xf9f3('0x46')][_0xf9f3('0x4c')](_0xf9f3('0x4d'))){_0xc8f07f[_0xf9f3('0x34')]=qs[_0xf9f3('0x34')](_0x1c6d49[_0xf9f3('0x46')][_0xf9f3('0x34')]);_0xc8f07f[_0xf9f3('0x33')]=qs[_0xf9f3('0x33')](_0x1c6d49[_0xf9f3('0x46')][_0xf9f3('0x33')]);}_0xc8f07f['order']=qs[_0xf9f3('0x4e')](_0x1c6d49[_0xf9f3('0x46')][_0xf9f3('0x4e')]);_0xc8f07f['where']=qs[_0xf9f3('0x4f')](_[_0xf9f3('0x50')](_0x1c6d49[_0xf9f3('0x46')],_0x1722b8[_0xf9f3('0x4f')]),_0x5e0315);if(_0x1c6d49[_0xf9f3('0x46')][_0xf9f3('0x51')]){_0xc8f07f[_0xf9f3('0x52')]=_[_0xf9f3('0x53')](_0xc8f07f[_0xf9f3('0x52')],{'$or':_[_0xf9f3('0x40')](_0x5e0315,function(_0x2daf81){if(_0x2daf81['type']!==_0xf9f3('0x54')){var _0x55764e={};_0x55764e[_0x2daf81[_0xf9f3('0x3e')]]={'$like':'%'+_0x1c6d49[_0xf9f3('0x46')][_0xf9f3('0x51')]+'%'};return _0x55764e;}})});}_0xc8f07f=_[_0xf9f3('0x53')]({},_0xc8f07f,_0x1c6d49[_0xf9f3('0x55')]);var _0x167f23={'where':_0xc8f07f[_0xf9f3('0x52')]};return db[_0xf9f3('0x41')][_0xf9f3('0x32')](_0x167f23)[_0xf9f3('0x22')](function(_0x42c711){_0x432a1d[_0xf9f3('0x32')]=_0x42c711;if(_0x1c6d49[_0xf9f3('0x46')][_0xf9f3('0x56')]){_0xc8f07f[_0xf9f3('0x57')]=[{'all':!![]}];}return db['ChatQueue'][_0xf9f3('0x58')](_0xc8f07f);})[_0xf9f3('0x22')](function(_0x4b190e){_0x432a1d['rows']=_0x4b190e;return _0x432a1d;})[_0xf9f3('0x22')](respondWithFilteredResult(_0x6ee063,_0xc8f07f))[_0xf9f3('0x2d')](handleError(_0x6ee063,null));};exports[_0xf9f3('0x59')]=function(_0x53aee2,_0x5c72f4){var _0x818539={'raw':!![],'where':{'id':_0x53aee2['params']['id']}},_0x5eae1f={};_0x5eae1f[_0xf9f3('0x45')]=_[_0xf9f3('0x47')](db[_0xf9f3('0x41')]['rawAttributes']);_0x5eae1f[_0xf9f3('0x46')]=_['keys'](_0x53aee2[_0xf9f3('0x46')]);_0x5eae1f[_0xf9f3('0x4f')]=_[_0xf9f3('0x48')](_0x5eae1f[_0xf9f3('0x45')],_0x5eae1f[_0xf9f3('0x46')]);_0x818539[_0xf9f3('0x49')]=_['intersection'](_0x5eae1f['model'],qs[_0xf9f3('0x4a')](_0x53aee2[_0xf9f3('0x46')][_0xf9f3('0x4a')]));_0x818539[_0xf9f3('0x49')]=_0x818539[_0xf9f3('0x49')][_0xf9f3('0x4b')]?_0x818539['attributes']:_0x5eae1f[_0xf9f3('0x45')];if(_0x53aee2[_0xf9f3('0x46')][_0xf9f3('0x56')]){_0x818539['include']=[{'all':!![]}];}_0x818539=_[_0xf9f3('0x53')]({},_0x818539,_0x53aee2[_0xf9f3('0x55')]);return db['ChatQueue'][_0xf9f3('0x5a')](_0x818539)[_0xf9f3('0x22')](handleEntityNotFound(_0x5c72f4,null))[_0xf9f3('0x22')](respondWithResult(_0x5c72f4,null))[_0xf9f3('0x2d')](handleError(_0x5c72f4,null));};exports[_0xf9f3('0x5b')]=function(_0x24ca81,_0x1edafd){return db[_0xf9f3('0x41')]['create'](_0x24ca81[_0xf9f3('0x5c')],{})['then'](function(_0x4e52e6){var _0x1daa9d=_0x24ca81[_0xf9f3('0x5d')]['get']({'plain':!![]});if(!_0x1daa9d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1daa9d['role']==='user'){var _0x124545=_0x4e52e6[_0xf9f3('0x3b')]({'plain':!![]});var _0x4cb7bd=_0xf9f3('0x3c');return db[_0xf9f3('0x5e')][_0xf9f3('0x5a')]({'where':{'name':_0x4cb7bd,'userProfileId':_0x1daa9d['userProfileId']},'raw':!![]})[_0xf9f3('0x22')](function(_0x4f87c8){if(_0x4f87c8&&_0x4f87c8[_0xf9f3('0x5f')]===0x0){return db[_0xf9f3('0x60')]['create']({'name':_0x124545['name'],'resourceId':_0x124545['id'],'type':_0x4f87c8['name'],'sectionId':_0x4f87c8['id']},{})['then'](function(){return _0x4e52e6;});}else{return _0x4e52e6;}})[_0xf9f3('0x2d')](function(_0x276972){logger[_0xf9f3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x276972);throw _0x276972;});}return _0x4e52e6;})[_0xf9f3('0x22')](respondWithResult(_0x1edafd,0xc9))[_0xf9f3('0x2d')](handleError(_0x1edafd,null));};exports[_0xf9f3('0x39')]=function(_0x18cb84,_0x5df7a7){if(_0x18cb84[_0xf9f3('0x5c')]['id']){delete _0x18cb84[_0xf9f3('0x5c')]['id'];}return db[_0xf9f3('0x41')][_0xf9f3('0x5a')]({'where':{'id':_0x18cb84[_0xf9f3('0x61')]['id']}})[_0xf9f3('0x22')](handleEntityNotFound(_0x5df7a7,null))['then'](saveUpdates(_0x18cb84[_0xf9f3('0x5c')],null))['then'](respondWithResult(_0x5df7a7,null))['catch'](handleError(_0x5df7a7,null));};exports['destroy']=function(_0x4a2fe1,_0x382d70){return db[_0xf9f3('0x41')][_0xf9f3('0x5a')]({'where':{'id':_0x4a2fe1[_0xf9f3('0x61')]['id']}})[_0xf9f3('0x22')](handleEntityNotFound(_0x382d70,null))[_0xf9f3('0x22')](removeEntity(_0x382d70,null))[_0xf9f3('0x2d')](handleError(_0x382d70,null));};exports[_0xf9f3('0x62')]=function(_0x42b82e,_0x51dedb){return db[_0xf9f3('0x41')][_0xf9f3('0x62')]()['then'](respondWithResult(_0x51dedb,null))[_0xf9f3('0x2d')](handleError(_0x51dedb,null));};exports['getMembers']=function(_0x5dea13,_0x3aa86e,_0x4cf3ab){var _0x53828f={'raw':!![],'where':{}},_0x1262b4={},_0x422040;return db['ChatQueue'][_0xf9f3('0x63')]({'where':{'id':_0x5dea13[_0xf9f3('0x61')]['id']}})[_0xf9f3('0x22')](handleEntityNotFound(_0x3aa86e,null))[_0xf9f3('0x22')](function(_0x54d68f){if(_0x54d68f){_0x422040=_0x54d68f[_0xf9f3('0x3b')]({'plain':!![]});_0x1262b4[_0xf9f3('0x45')]=_[_0xf9f3('0x47')](db[_0xf9f3('0x64')]['rawAttributes']);_0x1262b4[_0xf9f3('0x46')]=_[_0xf9f3('0x47')](_0x5dea13[_0xf9f3('0x46')]);_0x1262b4[_0xf9f3('0x4f')]=_[_0xf9f3('0x48')](_0x1262b4[_0xf9f3('0x45')],_0x1262b4[_0xf9f3('0x46')]);_0x53828f[_0xf9f3('0x49')]=_[_0xf9f3('0x48')](_0x1262b4[_0xf9f3('0x45')],qs[_0xf9f3('0x4a')](_0x5dea13[_0xf9f3('0x46')][_0xf9f3('0x4a')]));_0x53828f[_0xf9f3('0x49')]=_0x53828f[_0xf9f3('0x49')]['length']?_0x53828f[_0xf9f3('0x49')]:_0x1262b4[_0xf9f3('0x45')];if(!_0x5dea13[_0xf9f3('0x46')]['hasOwnProperty'](_0xf9f3('0x4d'))){_0x53828f[_0xf9f3('0x34')]=qs[_0xf9f3('0x34')](_0x5dea13['query'][_0xf9f3('0x34')]);_0x53828f[_0xf9f3('0x33')]=qs[_0xf9f3('0x33')](_0x5dea13[_0xf9f3('0x46')][_0xf9f3('0x33')]);}_0x53828f[_0xf9f3('0x65')]=qs[_0xf9f3('0x4e')](_0x5dea13[_0xf9f3('0x46')][_0xf9f3('0x4e')]);_0x53828f[_0xf9f3('0x52')]=qs[_0xf9f3('0x4f')](_['pick'](_0x5dea13[_0xf9f3('0x46')],_0x1262b4[_0xf9f3('0x4f')]));_0x53828f[_0xf9f3('0x52')][_0xf9f3('0x66')]=_0x54d68f['id'];if(_0x5dea13[_0xf9f3('0x46')][_0xf9f3('0x51')]){_0x53828f[_0xf9f3('0x52')]=_['merge'](_0x53828f['where'],{'$or':_['map'](_0x53828f['attributes'],function(_0x37cc9a){var _0xd1e3b9={};_0xd1e3b9[_0x37cc9a]={'$like':'%'+_0x5dea13[_0xf9f3('0x46')][_0xf9f3('0x51')]+'%'};return _0xd1e3b9;})});}_0x53828f=_[_0xf9f3('0x53')]({},_0x53828f,_0x5dea13['options']);return db[_0xf9f3('0x64')][_0xf9f3('0x58')](_0x53828f);}})[_0xf9f3('0x22')](function(_0x43b89a){if(_0x43b89a){return db[_0xf9f3('0x67')][_0xf9f3('0x68')]({'where':{'id':_[_0xf9f3('0x40')](_0x43b89a,'UserId'),'role':_0xf9f3('0x69')},'attributes':['id',_0xf9f3('0x3e'),_0xf9f3('0x6a'),_0xf9f3('0x6b'),_0xf9f3('0x6c')]});}})[_0xf9f3('0x22')](function(_0x4dbdfe){if(_0x4dbdfe){return{'count':_0x4dbdfe[_0xf9f3('0x32')],'rows':_[_0xf9f3('0x40')](_0x4dbdfe[_0xf9f3('0x6d')],function(_0xf68813){return{'membername':_0xf68813[_0xf9f3('0x3e')],'UserId':_0xf68813['id'],'queue_name':_0x422040[_0xf9f3('0x3e')],'ChatQueueId':_0x422040['id'],'interface':util[_0xf9f3('0x6e')](_0xf9f3('0x6f'),'SIP',_0xf68813['name']),'penalty':0x0,'paused':_0xf68813['chatPause'],'createdAt':_0xf68813[_0xf9f3('0x6c')],'updatedAt':_0xf68813['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3aa86e,_0x53828f))[_0xf9f3('0x2d')](handleError(_0x3aa86e,null));};exports[_0xf9f3('0x70')]=function(_0x2998cc,_0x54a126,_0x4f7d86){var _0x12899a={};var _0x4ac61={};var _0x50bef7;var _0x1c4cb8;return db['ChatQueue'][_0xf9f3('0x63')]({'where':{'id':_0x2998cc['params']['id']}})[_0xf9f3('0x22')](handleEntityNotFound(_0x54a126,null))[_0xf9f3('0x22')](function(_0x184d95){if(_0x184d95){_0x50bef7=_0x184d95;_0x4ac61[_0xf9f3('0x45')]=_[_0xf9f3('0x47')](db[_0xf9f3('0x71')][_0xf9f3('0x42')]);_0x4ac61[_0xf9f3('0x46')]=_[_0xf9f3('0x47')](_0x2998cc['query']);_0x4ac61[_0xf9f3('0x4f')]=_['intersection'](_0x4ac61[_0xf9f3('0x45')],_0x4ac61['query']);_0x12899a['attributes']=_[_0xf9f3('0x48')](_0x4ac61[_0xf9f3('0x45')],qs['fields'](_0x2998cc[_0xf9f3('0x46')][_0xf9f3('0x4a')]));_0x12899a[_0xf9f3('0x49')]=_0x12899a[_0xf9f3('0x49')][_0xf9f3('0x4b')]?_0x12899a[_0xf9f3('0x49')]:_0x4ac61[_0xf9f3('0x45')];_0x12899a['order']=qs[_0xf9f3('0x4e')](_0x2998cc[_0xf9f3('0x46')][_0xf9f3('0x4e')]);_0x12899a[_0xf9f3('0x52')]=qs['filters'](_[_0xf9f3('0x50')](_0x2998cc[_0xf9f3('0x46')],_0x4ac61[_0xf9f3('0x4f')]));if(_0x2998cc['query']['filter']){_0x12899a[_0xf9f3('0x52')]=_[_0xf9f3('0x53')](_0x12899a[_0xf9f3('0x52')],{'$or':_[_0xf9f3('0x40')](_0x12899a[_0xf9f3('0x49')],function(_0xc6ae5){var _0xc22a14={};_0xc22a14[_0xc6ae5]={'$like':'%'+_0x2998cc[_0xf9f3('0x46')][_0xf9f3('0x51')]+'%'};return _0xc22a14;})});}_0x12899a=_[_0xf9f3('0x53')]({},_0x12899a,_0x2998cc[_0xf9f3('0x55')]);return _0x50bef7[_0xf9f3('0x70')](_0x12899a);}})[_0xf9f3('0x22')](function(_0x266174){if(_0x266174){_0x1c4cb8=_0x266174[_0xf9f3('0x4b')];if(!_0x2998cc[_0xf9f3('0x46')]['hasOwnProperty'](_0xf9f3('0x4d'))){_0x12899a[_0xf9f3('0x34')]=qs['limit'](_0x2998cc[_0xf9f3('0x46')][_0xf9f3('0x34')]);_0x12899a[_0xf9f3('0x33')]=qs[_0xf9f3('0x33')](_0x2998cc['query'][_0xf9f3('0x33')]);}return _0x50bef7['getTeams'](_0x12899a);}})[_0xf9f3('0x22')](function(_0x5d1d45){if(_0x5d1d45){return _0x5d1d45?{'count':_0x1c4cb8,'rows':_0x5d1d45}:null;}})['then'](respondWithResult(_0x54a126,null))[_0xf9f3('0x2d')](handleError(_0x54a126,null));};exports['addTeams']=function(_0x326e3d,_0x3bc21c,_0x4ce36e){var _0x5079eb=_0x326e3d['body'][_0xf9f3('0x72')];return db[_0xf9f3('0x71')][_0xf9f3('0x58')]({'where':{'id':_0x5079eb},'attributes':['id'],'include':[{'model':db[_0xf9f3('0x67')],'as':_0xf9f3('0x73'),'attributes':['id','name',_0xf9f3('0x74'),_0xf9f3('0x75'),_0xf9f3('0x76')],'raw':!![]}]})[_0xf9f3('0x22')](function(_0x3949f3){if(_0x3949f3){var _0xace2b4=_[_0xf9f3('0x77')](_0x3949f3,function(_0x50bee4){var _0x1877a3=_0x50bee4[_0xf9f3('0x3b')]({'plain':!![]});return _0x1877a3[_0xf9f3('0x73')];});return db[_0xf9f3('0x41')]['find']({'where':{'id':_0x326e3d[_0xf9f3('0x61')]['id']}})['then'](function(_0x32beb2){return db[_0xf9f3('0x78')][_0xf9f3('0x79')](function(_0x489b4c){return _0x32beb2[_0xf9f3('0x7a')](_0x5079eb,{'transaction':_0x489b4c})[_0xf9f3('0x22')](function(){return BPromise['each'](_0xace2b4,function(_0x8f05d0){return db[_0xf9f3('0x64')][_0xf9f3('0x7b')]({'where':{'UserId':_0x8f05d0['id'],'ChatQueueId':_0x326e3d[_0xf9f3('0x61')]['id']},'transaction':_0x489b4c});});})[_0xf9f3('0x22')](function(){_0xace2b4[_0xf9f3('0x7c')](function(_0x1bb45a){socket[_0xf9f3('0x7d')](_0xf9f3('0x7e'),{'UserId':_0x1bb45a['id'],'ChatQueueId':_0x32beb2['id']});});});});});}})[_0xf9f3('0x22')](respondWithStatusCode(_0x3bc21c,null))[_0xf9f3('0x2d')](handleError(_0x3bc21c,null));};exports[_0xf9f3('0x7f')]=function(_0x3bba79,_0x3cce29,_0x4a4686){return db[_0xf9f3('0x71')][_0xf9f3('0x58')]({'where':{'id':_0x3bba79['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xf9f3('0x67')],'as':_0xf9f3('0x73'),'attributes':['id'],'raw':!![]}]})[_0xf9f3('0x22')](handleEntityNotFound(_0x3cce29,null))['then'](function(_0x16579a){var _0x40717a=_[_0xf9f3('0x40')](_0x16579a,'id');var _0x1e11d0=[];var _0xeb5686=[];var _0x54a67f=squel[_0xf9f3('0x80')]();_0x54a67f['field'](_0xf9f3('0x81'))[_0xf9f3('0x82')](_0xf9f3('0x83'),'tq')[_0xf9f3('0x84')](_0xf9f3('0x85'),'ut',_0xf9f3('0x86'))['where'](_0xf9f3('0x87'),_0x3bba79[_0xf9f3('0x61')]['id']);for(var _0x50c749=0x0;_0x50c749<_0x16579a[_0xf9f3('0x4b')];_0x50c749+=0x1){let _0xb856fc=_0x16579a[_0x50c749];for(var _0x206277=0x0;_0x206277<_0xb856fc[_0xf9f3('0x73')]['length'];_0x206277+=0x1){let _0x209d4f=_0xb856fc[_0xf9f3('0x73')][_0x206277];var _0x12e8e2=_0x54a67f['clone']();_0x12e8e2[_0xf9f3('0x52')]('ut.UserId\x20=\x20?',_0x209d4f['id']);_0xeb5686['push'](db[_0xf9f3('0x78')]['query'](_0x12e8e2['toString'](),{'type':db['sequelize'][_0xf9f3('0x88')][_0xf9f3('0x89')]})[_0xf9f3('0x22')](function(_0x362392){if(_0x362392[_0xf9f3('0x4b')]===0x1){return _0x209d4f['id'];}else{var _0x4e5efd=_['every'](_['map'](_0x362392,'TeamId'),function(_0xef2d36){return _[_0xf9f3('0x8a')](_0x40717a,_0xef2d36);});if(_0x4e5efd){return _0x209d4f['id'];}}}));}}return BPromise[_0xf9f3('0x8b')](_0xeb5686)[_0xf9f3('0x22')](function(_0x4354fb){_0x1e11d0=_(_0x1e11d0)['union'](_0x4354fb)[_0xf9f3('0x8c')]()[_0xf9f3('0x8d')]();return db['ChatQueue'][_0xf9f3('0x5a')]({'where':{'id':_0x3bba79[_0xf9f3('0x61')]['id']}})['then'](function(_0x228917){return db[_0xf9f3('0x78')][_0xf9f3('0x79')](function(_0x21ea3c){return _0x228917[_0xf9f3('0x7f')](_0x3bba79[_0xf9f3('0x46')][_0xf9f3('0x72')],{'transaction':_0x21ea3c})[_0xf9f3('0x22')](function(){if(!_[_0xf9f3('0x8e')](_0x1e11d0)){return _0x228917[_0xf9f3('0x8f')](_0x1e11d0,{'transaction':_0x21ea3c});}})[_0xf9f3('0x22')](function(){_0x1e11d0[_0xf9f3('0x7c')](function(_0x1562ee){socket[_0xf9f3('0x7d')](_0xf9f3('0x90'),{'UserId':_0x1562ee,'ChatQueueId':_0x228917['id']});});});});});});})['then'](respondWithStatusCode(_0x3cce29,null))['catch'](handleError(_0x3cce29,null));};exports[_0xf9f3('0x91')]=function(_0x3f447c,_0x61e660,_0x17c359){return db[_0xf9f3('0x41')][_0xf9f3('0x5a')]({'where':{'id':_0x3f447c[_0xf9f3('0x61')]['id']}})[_0xf9f3('0x22')](handleEntityNotFound(_0x61e660,null))['then'](function(_0x1ab8bc){if(_0x1ab8bc){return _0x1ab8bc[_0xf9f3('0x91')](_0x3f447c[_0xf9f3('0x5c')][_0xf9f3('0x72')],_[_0xf9f3('0x92')](_0x3f447c['body'],[_0xf9f3('0x72'),'id'])||{})['spread'](function(_0x56904b){for(var _0x17e6b9=0x0;_0x17e6b9<_0x3f447c[_0xf9f3('0x5c')][_0xf9f3('0x72')][_0xf9f3('0x4b')];_0x17e6b9+=0x1){socket[_0xf9f3('0x7d')](_0xf9f3('0x7e'),{'UserId':_0x3f447c[_0xf9f3('0x5c')][_0xf9f3('0x72')][_0x17e6b9],'ChatQueueId':_0x3f447c['params']['id']});}return _0x56904b;});}})['then'](respondWithResult(_0x61e660,null))[_0xf9f3('0x2d')](handleError(_0x61e660,null));};exports[_0xf9f3('0x8f')]=function(_0x617ce5,_0xf7ee40,_0x107259){return db[_0xf9f3('0x41')][_0xf9f3('0x5a')]({'where':{'id':_0x617ce5[_0xf9f3('0x61')]['id']}})[_0xf9f3('0x22')](handleEntityNotFound(_0xf7ee40,null))[_0xf9f3('0x22')](function(_0x593ddb){if(_0x593ddb){return _0x593ddb[_0xf9f3('0x8f')](_0x617ce5[_0xf9f3('0x46')][_0xf9f3('0x72')])[_0xf9f3('0x22')](function(){if(_[_0xf9f3('0x93')](_0x617ce5[_0xf9f3('0x46')][_0xf9f3('0x72')])){for(var _0x528862=0x0;_0x528862<_0x617ce5[_0xf9f3('0x46')]['ids'][_0xf9f3('0x4b')];_0x528862+=0x1){socket['emit'](_0xf9f3('0x90'),{'UserId':Number(_0x617ce5[_0xf9f3('0x46')][_0xf9f3('0x72')][_0x528862]),'ChatQueueId':Number(_0x617ce5['params']['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x617ce5[_0xf9f3('0x46')]['ids']),'ChatQueueId':Number(_0x617ce5[_0xf9f3('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0xf7ee40,null))[_0xf9f3('0x2d')](handleError(_0xf7ee40,null));};exports[_0xf9f3('0x94')]=function(_0x3985c0,_0xb8bf5f,_0x266168){var _0x17696a={};var _0x424b2f={};var _0x7ca857;var _0x5253d8;return db[_0xf9f3('0x41')][_0xf9f3('0x63')]({'where':{'id':_0x3985c0[_0xf9f3('0x61')]['id']}})[_0xf9f3('0x22')](handleEntityNotFound(_0xb8bf5f,null))[_0xf9f3('0x22')](function(_0x4f57dc){if(_0x4f57dc){_0x7ca857=_0x4f57dc;_0x424b2f[_0xf9f3('0x45')]=_[_0xf9f3('0x47')](db['User']['rawAttributes']);_0x424b2f[_0xf9f3('0x46')]=_[_0xf9f3('0x47')](_0x3985c0[_0xf9f3('0x46')]);_0x424b2f[_0xf9f3('0x4f')]=_[_0xf9f3('0x48')](_0x424b2f['model'],_0x424b2f[_0xf9f3('0x46')]);_0x17696a[_0xf9f3('0x49')]=_['intersection'](_0x424b2f[_0xf9f3('0x45')],qs[_0xf9f3('0x4a')](_0x3985c0['query']['fields']));_0x17696a[_0xf9f3('0x49')]=_0x17696a['attributes'][_0xf9f3('0x4b')]?_0x17696a['attributes']:_0x424b2f['model'];_0x17696a[_0xf9f3('0x65')]=qs[_0xf9f3('0x4e')](_0x3985c0[_0xf9f3('0x46')][_0xf9f3('0x4e')]);_0x17696a[_0xf9f3('0x52')]=qs['filters'](_['pick'](_0x3985c0[_0xf9f3('0x46')],_0x424b2f['filters']));if(_0x3985c0['query'][_0xf9f3('0x51')]){_0x17696a['where']=_[_0xf9f3('0x53')](_0x17696a[_0xf9f3('0x52')],{'$or':_[_0xf9f3('0x40')](_0x17696a[_0xf9f3('0x49')],function(_0x1439e3){var _0x150245={};_0x150245[_0x1439e3]={'$like':'%'+_0x3985c0['query'][_0xf9f3('0x51')]+'%'};return _0x150245;})});}_0x17696a=_[_0xf9f3('0x53')]({},_0x17696a,_0x3985c0[_0xf9f3('0x55')]);return _0x7ca857[_0xf9f3('0x94')](_0x17696a);}})[_0xf9f3('0x22')](function(_0x5be103){if(_0x5be103){_0x5253d8=_0x5be103['length'];if(!_0x3985c0[_0xf9f3('0x46')]['hasOwnProperty'](_0xf9f3('0x4d'))){_0x17696a[_0xf9f3('0x34')]=qs[_0xf9f3('0x34')](_0x3985c0['query'][_0xf9f3('0x34')]);_0x17696a['offset']=qs[_0xf9f3('0x33')](_0x3985c0[_0xf9f3('0x46')][_0xf9f3('0x33')]);}return _0x7ca857[_0xf9f3('0x94')](_0x17696a);}})[_0xf9f3('0x22')](function(_0x32a513){if(_0x32a513){return _0x32a513?{'count':_0x5253d8,'rows':_0x32a513}:null;}})[_0xf9f3('0x22')](respondWithResult(_0xb8bf5f,null))[_0xf9f3('0x2d')](handleError(_0xb8bf5f,null));}; \ No newline at end of file +var _0x23b2=['chatPause','updatedAt','createdAt','format','SIP','getTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','from','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','isArray','userChatQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','./chatQueue.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','get','ChatQueues','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','UserChatQueue','hasOwnProperty','ChatQueueId','User','agent'];(function(_0x487360,_0x3c8497){var _0x4c211a=function(_0x74696e){while(--_0x74696e){_0x487360['push'](_0x487360['shift']());}};_0x4c211a(++_0x3c8497);}(_0x23b2,0x15e));var _0x223b=function(_0x537744,_0x11afa7){_0x537744=_0x537744-0x0;var _0x2c999a=_0x23b2[_0x537744];return _0x2c999a;};'use strict';var pdf=require(_0x223b('0x0'));var emlformat=require(_0x223b('0x1'));var rimraf=require(_0x223b('0x2'));var zipdir=require(_0x223b('0x3'));var jsonpatch=require(_0x223b('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x223b('0x5'));var Mustache=require(_0x223b('0x6'));var util=require(_0x223b('0x7'));var path=require(_0x223b('0x8'));var sox=require(_0x223b('0x9'));var csv=require(_0x223b('0xa'));var ejs=require(_0x223b('0xb'));var fs=require('fs');var _=require(_0x223b('0xc'));var squel=require(_0x223b('0xd'));var crypto=require('crypto');var jsforce=require(_0x223b('0xe'));var deskjs=require(_0x223b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x223b('0x10'));var authService=require(_0x223b('0x11'));var qs=require(_0x223b('0x12'));var as=require(_0x223b('0x13'));var hardwareService=require(_0x223b('0x14'));var logger=require('../../config/logger')(_0x223b('0x15'));var utils=require(_0x223b('0x16'));var config=require(_0x223b('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x223b('0x18')](config[_0x223b('0x19')],{'host':_0x223b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x223b('0x19')]));require(_0x223b('0x1b'))[_0x223b('0x1c')](socket);var jayson=require(_0x223b('0x1d'));var client=jayson[_0x223b('0x1e')][_0x223b('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x2bf46b,_0x4a2459,_0x4387b0){if(_0x4387b0){var _0x31cd1f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31cd1f[_0x223b('0x20')](_0x4a2459)){return _0x2bf46b;}else{throw new db[(_0x223b('0x21'))][(_0x223b('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 _0x2bf46b;}}function respondWithRpcPromise(_0x56e5de,_0x1b6955,_0x8b27d6,_0x1bc457){return new BPromise(function(_0x598aec,_0x322d7c){var _0x14986a=_0x1bc457||client;return _0x14986a[_0x223b('0x23')](_0x56e5de,_0x8b27d6)['then'](function(_0x15cd9e){logger[_0x223b('0x24')](_0x223b('0x25'),_0x1b6955,_0x223b('0x26'));logger[_0x223b('0x27')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1b6955,_0x223b('0x26'),JSON['stringify'](_0x15cd9e));if(_0x15cd9e[_0x223b('0x28')]){if(_0x15cd9e['error']['code']===0x1f4){logger[_0x223b('0x28')](_0x223b('0x25'),_0x1b6955,_0x15cd9e['error']['message']);return _0x322d7c(_0x15cd9e['error'][_0x223b('0x29')]);}logger['error'](_0x223b('0x25'),_0x1b6955,_0x15cd9e[_0x223b('0x28')]['message']);return _0x598aec(_0x15cd9e['error']['message']);}else{logger[_0x223b('0x24')]('ChatQueue,\x20%s,\x20%s',_0x1b6955,_0x223b('0x26'));_0x598aec(_0x15cd9e[_0x223b('0x2a')][_0x223b('0x29')]);}})[_0x223b('0x2b')](function(_0x4e110d){logger[_0x223b('0x28')](_0x223b('0x25'),_0x1b6955,_0x4e110d);_0x322d7c(_0x4e110d);});});}function respondWithStatusCode(_0x725309,_0xbb0ded){_0xbb0ded=_0xbb0ded||0xcc;return function(_0x1563d6){if(_0x1563d6){return _0x725309['sendStatus'](_0xbb0ded);}return _0x725309[_0x223b('0x2c')](_0xbb0ded)[_0x223b('0x2d')]();};}function respondWithResult(_0x3f0193,_0x260203){_0x260203=_0x260203||0xc8;return function(_0x5122a4){if(_0x5122a4){return _0x3f0193[_0x223b('0x2c')](_0x260203)[_0x223b('0x2e')](_0x5122a4);}};}function respondWithFilteredResult(_0xb9f096,_0x49fd83){return function(_0x3638cc){if(_0x3638cc){var _0x1cd36a=_0x3638cc['count'],_0x176fd2=_0x49fd83[_0x223b('0x2f')],_0x19f215=_0x49fd83[_0x223b('0x2f')]+_0x49fd83['limit'],_0x536f90;if(_0x19f215>=_0x1cd36a){_0x19f215=_0x1cd36a;_0x536f90=0xc8;}else{_0x536f90=0xce;}_0xb9f096['status'](_0x536f90);return _0xb9f096[_0x223b('0x30')](_0x223b('0x31'),_0x176fd2+'-'+_0x19f215+'/'+_0x1cd36a)['json'](_0x3638cc);}return null;};}function patchUpdates(_0x599d30){return function(_0x228fa2){try{jsonpatch['apply'](_0x228fa2,_0x599d30,!![]);}catch(_0x44a7a1){return BPromise[_0x223b('0x32')](_0x44a7a1);}return _0x228fa2[_0x223b('0x33')]();};}function saveUpdates(_0x1b3ba0,_0x1d469b){return function(_0x1aabc9){if(_0x1aabc9){return _0x1aabc9[_0x223b('0x34')](_0x1b3ba0)['then'](function(_0x4a8899){return _0x4a8899;});}return null;};}function removeEntity(_0x5d42f9,_0x1832dd){return function(_0x50e7c2){if(_0x50e7c2){return _0x50e7c2[_0x223b('0x35')]()[_0x223b('0x36')](function(){var _0x3fba14=_0x50e7c2[_0x223b('0x37')]({'plain':!![]});var _0xc3ed75=_0x223b('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0xc3ed75,'resourceId':_0x3fba14['id']}})[_0x223b('0x36')](function(){return _0x50e7c2;});})['then'](function(){_0x5d42f9[_0x223b('0x2c')](0xcc)[_0x223b('0x2d')]();});}};}function handleEntityNotFound(_0xbb435e,_0x291b15){return function(_0x5c44b2){if(!_0x5c44b2){_0xbb435e[_0x223b('0x39')](0x194);}return _0x5c44b2;};}function handleError(_0x562354,_0x3ad5ef){_0x3ad5ef=_0x3ad5ef||0x1f4;return function(_0x2664c9){logger['error'](_0x2664c9[_0x223b('0x3a')]);if(_0x2664c9['name']){delete _0x2664c9[_0x223b('0x3b')];}_0x562354['status'](_0x3ad5ef)[_0x223b('0x3c')](_0x2664c9);};}exports[_0x223b('0x3d')]=function(_0x34567d,_0x4f9daa){var _0x2a3cfd={},_0x28d18b={},_0x4b1ef5={'count':0x0,'rows':[]};var _0x10dfdf=_[_0x223b('0x3e')](db[_0x223b('0x3f')][_0x223b('0x40')],function(_0x4061f6){return{'name':_0x4061f6['fieldName'],'type':_0x4061f6['type'][_0x223b('0x41')]};});_0x28d18b[_0x223b('0x42')]=_[_0x223b('0x3e')](_0x10dfdf,_0x223b('0x3b'));_0x28d18b[_0x223b('0x43')]=_[_0x223b('0x44')](_0x34567d[_0x223b('0x43')]);_0x28d18b['filters']=_[_0x223b('0x45')](_0x28d18b['model'],_0x28d18b['query']);_0x2a3cfd['attributes']=_[_0x223b('0x45')](_0x28d18b[_0x223b('0x42')],qs['fields'](_0x34567d[_0x223b('0x43')][_0x223b('0x46')]));_0x2a3cfd[_0x223b('0x47')]=_0x2a3cfd[_0x223b('0x47')][_0x223b('0x48')]?_0x2a3cfd[_0x223b('0x47')]:_0x28d18b[_0x223b('0x42')];if(!_0x34567d[_0x223b('0x43')]['hasOwnProperty'](_0x223b('0x49'))){_0x2a3cfd[_0x223b('0x4a')]=qs[_0x223b('0x4a')](_0x34567d[_0x223b('0x43')][_0x223b('0x4a')]);_0x2a3cfd[_0x223b('0x2f')]=qs[_0x223b('0x2f')](_0x34567d[_0x223b('0x43')][_0x223b('0x2f')]);}_0x2a3cfd[_0x223b('0x4b')]=qs[_0x223b('0x4c')](_0x34567d['query'][_0x223b('0x4c')]);_0x2a3cfd['where']=qs[_0x223b('0x4d')](_[_0x223b('0x4e')](_0x34567d[_0x223b('0x43')],_0x28d18b['filters']),_0x10dfdf);if(_0x34567d[_0x223b('0x43')][_0x223b('0x4f')]){_0x2a3cfd[_0x223b('0x50')]=_[_0x223b('0x51')](_0x2a3cfd[_0x223b('0x50')],{'$or':_[_0x223b('0x3e')](_0x10dfdf,function(_0x64743b){if(_0x64743b[_0x223b('0x52')]!==_0x223b('0x53')){var _0x3068ea={};_0x3068ea[_0x64743b['name']]={'$like':'%'+_0x34567d['query'][_0x223b('0x4f')]+'%'};return _0x3068ea;}})});}_0x2a3cfd=_[_0x223b('0x51')]({},_0x2a3cfd,_0x34567d[_0x223b('0x54')]);var _0x8d7de9={'where':_0x2a3cfd['where']};return db[_0x223b('0x3f')][_0x223b('0x55')](_0x8d7de9)[_0x223b('0x36')](function(_0x143548){_0x4b1ef5[_0x223b('0x55')]=_0x143548;if(_0x34567d[_0x223b('0x43')][_0x223b('0x56')]){_0x2a3cfd[_0x223b('0x57')]=[{'all':!![]}];}return db[_0x223b('0x3f')][_0x223b('0x58')](_0x2a3cfd);})['then'](function(_0x2bb2d4){_0x4b1ef5[_0x223b('0x59')]=_0x2bb2d4;return _0x4b1ef5;})[_0x223b('0x36')](respondWithFilteredResult(_0x4f9daa,_0x2a3cfd))[_0x223b('0x2b')](handleError(_0x4f9daa,null));};exports['show']=function(_0x42fd77,_0x5dff47){var _0x39e52c={'raw':!![],'where':{'id':_0x42fd77['params']['id']}},_0x58b313={};_0x58b313[_0x223b('0x42')]=_[_0x223b('0x44')](db[_0x223b('0x3f')][_0x223b('0x40')]);_0x58b313['query']=_[_0x223b('0x44')](_0x42fd77[_0x223b('0x43')]);_0x58b313['filters']=_[_0x223b('0x45')](_0x58b313['model'],_0x58b313[_0x223b('0x43')]);_0x39e52c[_0x223b('0x47')]=_[_0x223b('0x45')](_0x58b313['model'],qs[_0x223b('0x46')](_0x42fd77[_0x223b('0x43')]['fields']));_0x39e52c[_0x223b('0x47')]=_0x39e52c[_0x223b('0x47')][_0x223b('0x48')]?_0x39e52c[_0x223b('0x47')]:_0x58b313[_0x223b('0x42')];if(_0x42fd77[_0x223b('0x43')][_0x223b('0x56')]){_0x39e52c[_0x223b('0x57')]=[{'all':!![]}];}_0x39e52c=_[_0x223b('0x51')]({},_0x39e52c,_0x42fd77[_0x223b('0x54')]);return db[_0x223b('0x3f')]['find'](_0x39e52c)[_0x223b('0x36')](handleEntityNotFound(_0x5dff47,null))[_0x223b('0x36')](respondWithResult(_0x5dff47,null))['catch'](handleError(_0x5dff47,null));};exports[_0x223b('0x5a')]=function(_0x2cee91,_0x5147c0){return db[_0x223b('0x3f')]['create'](_0x2cee91[_0x223b('0x5b')],{})[_0x223b('0x36')](function(_0x51e992){var _0x5c55dc=_0x2cee91[_0x223b('0x5c')][_0x223b('0x37')]({'plain':!![]});if(!_0x5c55dc)throw new Error(_0x223b('0x5d'));if(_0x5c55dc[_0x223b('0x5e')]==='user'){var _0x3ff12d=_0x51e992[_0x223b('0x37')]({'plain':!![]});var _0x24693d=_0x223b('0x38');return db[_0x223b('0x5f')][_0x223b('0x60')]({'where':{'name':_0x24693d,'userProfileId':_0x5c55dc[_0x223b('0x61')]},'raw':!![]})[_0x223b('0x36')](function(_0x262c2b){if(_0x262c2b&&_0x262c2b['autoAssociation']===0x0){return db['UserProfileResource'][_0x223b('0x5a')]({'name':_0x3ff12d[_0x223b('0x3b')],'resourceId':_0x3ff12d['id'],'type':_0x262c2b[_0x223b('0x3b')],'sectionId':_0x262c2b['id']},{})[_0x223b('0x36')](function(){return _0x51e992;});}else{return _0x51e992;}})[_0x223b('0x2b')](function(_0x389660){logger[_0x223b('0x28')](_0x223b('0x62'),_0x389660);throw _0x389660;});}return _0x51e992;})[_0x223b('0x36')](respondWithResult(_0x5147c0,0xc9))[_0x223b('0x2b')](handleError(_0x5147c0,null));};exports[_0x223b('0x34')]=function(_0x4759f6,_0x262059){if(_0x4759f6[_0x223b('0x5b')]['id']){delete _0x4759f6[_0x223b('0x5b')]['id'];}return db[_0x223b('0x3f')][_0x223b('0x60')]({'where':{'id':_0x4759f6[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x262059,null))[_0x223b('0x36')](saveUpdates(_0x4759f6[_0x223b('0x5b')],null))[_0x223b('0x36')](respondWithResult(_0x262059,null))[_0x223b('0x2b')](handleError(_0x262059,null));};exports[_0x223b('0x35')]=function(_0x440d61,_0x467474){return db[_0x223b('0x3f')]['find']({'where':{'id':_0x440d61['params']['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x467474,null))[_0x223b('0x36')](removeEntity(_0x467474,null))[_0x223b('0x2b')](handleError(_0x467474,null));};exports['describe']=function(_0x310d00,_0x2f84f6){return db[_0x223b('0x3f')]['describe']()[_0x223b('0x36')](respondWithResult(_0x2f84f6,null))[_0x223b('0x2b')](handleError(_0x2f84f6,null));};exports['getMembers']=function(_0x2f14f5,_0x4a19b0,_0x5b6c36){var _0x4e08e3={'raw':!![],'where':{}},_0xf42ef4={},_0x2c6154;return db[_0x223b('0x3f')][_0x223b('0x64')]({'where':{'id':_0x2f14f5[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x4a19b0,null))[_0x223b('0x36')](function(_0x5d6ad1){if(_0x5d6ad1){_0x2c6154=_0x5d6ad1['get']({'plain':!![]});_0xf42ef4[_0x223b('0x42')]=_[_0x223b('0x44')](db[_0x223b('0x65')][_0x223b('0x40')]);_0xf42ef4[_0x223b('0x43')]=_['keys'](_0x2f14f5['query']);_0xf42ef4[_0x223b('0x4d')]=_[_0x223b('0x45')](_0xf42ef4[_0x223b('0x42')],_0xf42ef4[_0x223b('0x43')]);_0x4e08e3[_0x223b('0x47')]=_[_0x223b('0x45')](_0xf42ef4[_0x223b('0x42')],qs[_0x223b('0x46')](_0x2f14f5[_0x223b('0x43')][_0x223b('0x46')]));_0x4e08e3[_0x223b('0x47')]=_0x4e08e3[_0x223b('0x47')][_0x223b('0x48')]?_0x4e08e3[_0x223b('0x47')]:_0xf42ef4['model'];if(!_0x2f14f5['query'][_0x223b('0x66')]('nolimit')){_0x4e08e3['limit']=qs[_0x223b('0x4a')](_0x2f14f5[_0x223b('0x43')][_0x223b('0x4a')]);_0x4e08e3[_0x223b('0x2f')]=qs['offset'](_0x2f14f5[_0x223b('0x43')][_0x223b('0x2f')]);}_0x4e08e3[_0x223b('0x4b')]=qs[_0x223b('0x4c')](_0x2f14f5['query'][_0x223b('0x4c')]);_0x4e08e3[_0x223b('0x50')]=qs[_0x223b('0x4d')](_['pick'](_0x2f14f5['query'],_0xf42ef4['filters']));_0x4e08e3[_0x223b('0x50')][_0x223b('0x67')]=_0x5d6ad1['id'];if(_0x2f14f5[_0x223b('0x43')][_0x223b('0x4f')]){_0x4e08e3[_0x223b('0x50')]=_['merge'](_0x4e08e3[_0x223b('0x50')],{'$or':_[_0x223b('0x3e')](_0x4e08e3[_0x223b('0x47')],function(_0x3f83bf){var _0x146fe4={};_0x146fe4[_0x3f83bf]={'$like':'%'+_0x2f14f5['query']['filter']+'%'};return _0x146fe4;})});}_0x4e08e3=_[_0x223b('0x51')]({},_0x4e08e3,_0x2f14f5[_0x223b('0x54')]);return db[_0x223b('0x65')][_0x223b('0x58')](_0x4e08e3);}})[_0x223b('0x36')](function(_0x51755c){if(_0x51755c){return db[_0x223b('0x68')]['findAndCountAll']({'where':{'id':_[_0x223b('0x3e')](_0x51755c,'UserId'),'role':_0x223b('0x69')},'attributes':['id','name',_0x223b('0x6a'),_0x223b('0x6b'),_0x223b('0x6c')]});}})[_0x223b('0x36')](function(_0x7e8b15){if(_0x7e8b15){return{'count':_0x7e8b15[_0x223b('0x55')],'rows':_[_0x223b('0x3e')](_0x7e8b15[_0x223b('0x59')],function(_0x44dff9){return{'membername':_0x44dff9[_0x223b('0x3b')],'UserId':_0x44dff9['id'],'queue_name':_0x2c6154[_0x223b('0x3b')],'ChatQueueId':_0x2c6154['id'],'interface':util[_0x223b('0x6d')]('%s/%s',_0x223b('0x6e'),_0x44dff9[_0x223b('0x3b')]),'penalty':0x0,'paused':_0x44dff9[_0x223b('0x6a')],'createdAt':_0x44dff9[_0x223b('0x6c')],'updatedAt':_0x44dff9[_0x223b('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4a19b0,_0x4e08e3))[_0x223b('0x2b')](handleError(_0x4a19b0,null));};exports[_0x223b('0x6f')]=function(_0xfafece,_0x58c77a,_0x565962){var _0x1f57a9={};var _0x269fd6={};var _0x2f0ed7;var _0x28aa33;return db[_0x223b('0x3f')]['findOne']({'where':{'id':_0xfafece[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x58c77a,null))[_0x223b('0x36')](function(_0x2bf8ab){if(_0x2bf8ab){_0x2f0ed7=_0x2bf8ab;_0x269fd6[_0x223b('0x42')]=_[_0x223b('0x44')](db['Team'][_0x223b('0x40')]);_0x269fd6[_0x223b('0x43')]=_[_0x223b('0x44')](_0xfafece['query']);_0x269fd6[_0x223b('0x4d')]=_[_0x223b('0x45')](_0x269fd6[_0x223b('0x42')],_0x269fd6['query']);_0x1f57a9[_0x223b('0x47')]=_['intersection'](_0x269fd6[_0x223b('0x42')],qs[_0x223b('0x46')](_0xfafece['query'][_0x223b('0x46')]));_0x1f57a9['attributes']=_0x1f57a9[_0x223b('0x47')]['length']?_0x1f57a9['attributes']:_0x269fd6[_0x223b('0x42')];_0x1f57a9['order']=qs[_0x223b('0x4c')](_0xfafece['query'][_0x223b('0x4c')]);_0x1f57a9[_0x223b('0x50')]=qs[_0x223b('0x4d')](_[_0x223b('0x4e')](_0xfafece[_0x223b('0x43')],_0x269fd6['filters']));if(_0xfafece[_0x223b('0x43')][_0x223b('0x4f')]){_0x1f57a9['where']=_[_0x223b('0x51')](_0x1f57a9[_0x223b('0x50')],{'$or':_[_0x223b('0x3e')](_0x1f57a9['attributes'],function(_0x1cbc28){var _0x1eda33={};_0x1eda33[_0x1cbc28]={'$like':'%'+_0xfafece['query'][_0x223b('0x4f')]+'%'};return _0x1eda33;})});}_0x1f57a9=_['merge']({},_0x1f57a9,_0xfafece[_0x223b('0x54')]);return _0x2f0ed7['getTeams'](_0x1f57a9);}})[_0x223b('0x36')](function(_0x399d6e){if(_0x399d6e){_0x28aa33=_0x399d6e['length'];if(!_0xfafece['query'][_0x223b('0x66')]('nolimit')){_0x1f57a9[_0x223b('0x4a')]=qs[_0x223b('0x4a')](_0xfafece[_0x223b('0x43')][_0x223b('0x4a')]);_0x1f57a9[_0x223b('0x2f')]=qs['offset'](_0xfafece[_0x223b('0x43')][_0x223b('0x2f')]);}return _0x2f0ed7[_0x223b('0x6f')](_0x1f57a9);}})[_0x223b('0x36')](function(_0x1dbf53){if(_0x1dbf53){return _0x1dbf53?{'count':_0x28aa33,'rows':_0x1dbf53}:null;}})[_0x223b('0x36')](respondWithResult(_0x58c77a,null))[_0x223b('0x2b')](handleError(_0x58c77a,null));};exports['addTeams']=function(_0x3c1005,_0x9dfcba,_0x52d7b5){var _0x4fdec5=_0x3c1005[_0x223b('0x5b')][_0x223b('0x70')];return db[_0x223b('0x71')][_0x223b('0x58')]({'where':{'id':_0x4fdec5},'attributes':['id'],'include':[{'model':db['User'],'as':_0x223b('0x72'),'attributes':['id',_0x223b('0x3b'),_0x223b('0x73'),_0x223b('0x74'),_0x223b('0x75')],'raw':!![]}]})[_0x223b('0x36')](function(_0x53f430){if(_0x53f430){var _0x300a2e=_[_0x223b('0x76')](_0x53f430,function(_0x4dcc3c){var _0x28dd2e=_0x4dcc3c[_0x223b('0x37')]({'plain':!![]});return _0x28dd2e[_0x223b('0x72')];});return db[_0x223b('0x3f')][_0x223b('0x60')]({'where':{'id':_0x3c1005[_0x223b('0x63')]['id']}})[_0x223b('0x36')](function(_0x229197){return db[_0x223b('0x77')][_0x223b('0x78')](function(_0x658a78){return _0x229197[_0x223b('0x79')](_0x4fdec5,{'transaction':_0x658a78})['then'](function(){return BPromise[_0x223b('0x7a')](_0x300a2e,function(_0x312eb5){return db[_0x223b('0x65')][_0x223b('0x7b')]({'where':{'UserId':_0x312eb5['id'],'ChatQueueId':_0x3c1005[_0x223b('0x63')]['id']},'transaction':_0x658a78});});})[_0x223b('0x36')](function(){_0x300a2e[_0x223b('0x7c')](function(_0xeda2fd){socket[_0x223b('0x7d')](_0x223b('0x7e'),{'UserId':_0xeda2fd['id'],'ChatQueueId':_0x229197['id']});});});});});}})['then'](respondWithStatusCode(_0x9dfcba,null))[_0x223b('0x2b')](handleError(_0x9dfcba,null));};exports[_0x223b('0x7f')]=function(_0x293408,_0x28069c,_0xe79029){return db[_0x223b('0x71')][_0x223b('0x58')]({'where':{'id':_0x293408[_0x223b('0x43')][_0x223b('0x70')]},'attributes':['id'],'include':[{'model':db[_0x223b('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x223b('0x36')](handleEntityNotFound(_0x28069c,null))[_0x223b('0x36')](function(_0x17b423){var _0x47077b=_[_0x223b('0x3e')](_0x17b423,'id');var _0x1136d3=[];var _0x275ed8=[];var _0x5e9ee9=squel[_0x223b('0x80')]();_0x5e9ee9[_0x223b('0x81')]('tq.TeamId')[_0x223b('0x82')]('team_has_chat_queues','tq')[_0x223b('0x83')](_0x223b('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x223b('0x50')]('ChatQueueId\x20=\x20?',_0x293408[_0x223b('0x63')]['id']);for(var _0x1799c1=0x0;_0x1799c1<_0x17b423[_0x223b('0x48')];_0x1799c1+=0x1){let _0xa64683=_0x17b423[_0x1799c1];for(var _0x474fa2=0x0;_0x474fa2<_0xa64683[_0x223b('0x72')][_0x223b('0x48')];_0x474fa2+=0x1){let _0x4a7597=_0xa64683[_0x223b('0x72')][_0x474fa2];var _0x3dfc8c=_0x5e9ee9[_0x223b('0x85')]();_0x3dfc8c[_0x223b('0x50')](_0x223b('0x86'),_0x4a7597['id']);_0x275ed8[_0x223b('0x87')](db[_0x223b('0x77')][_0x223b('0x43')](_0x3dfc8c[_0x223b('0x88')](),{'type':db[_0x223b('0x77')][_0x223b('0x89')][_0x223b('0x8a')]})['then'](function(_0x9ae836){if(_0x9ae836[_0x223b('0x48')]===0x1){return _0x4a7597['id'];}else{var _0x44e9d0=_[_0x223b('0x8b')](_[_0x223b('0x3e')](_0x9ae836,_0x223b('0x8c')),function(_0x272fb0){return _[_0x223b('0x8d')](_0x47077b,_0x272fb0);});if(_0x44e9d0){return _0x4a7597['id'];}}}));}}return BPromise[_0x223b('0x8e')](_0x275ed8)['then'](function(_0x2eb8db){_0x1136d3=_(_0x1136d3)[_0x223b('0x8f')](_0x2eb8db)[_0x223b('0x90')]()[_0x223b('0x91')]();return db[_0x223b('0x3f')][_0x223b('0x60')]({'where':{'id':_0x293408[_0x223b('0x63')]['id']}})[_0x223b('0x36')](function(_0x4a9039){return db[_0x223b('0x77')][_0x223b('0x78')](function(_0x58bab9){return _0x4a9039[_0x223b('0x7f')](_0x293408[_0x223b('0x43')][_0x223b('0x70')],{'transaction':_0x58bab9})[_0x223b('0x36')](function(){if(!_['isEmpty'](_0x1136d3)){return _0x4a9039[_0x223b('0x92')](_0x1136d3,{'transaction':_0x58bab9});}})[_0x223b('0x36')](function(){_0x1136d3[_0x223b('0x7c')](function(_0x192260){socket[_0x223b('0x7d')]('userChatQueue:remove',{'UserId':_0x192260,'ChatQueueId':_0x4a9039['id']});});});});});});})[_0x223b('0x36')](respondWithStatusCode(_0x28069c,null))[_0x223b('0x2b')](handleError(_0x28069c,null));};exports[_0x223b('0x93')]=function(_0x5cd9f7,_0x4b0229,_0x25701f){return db[_0x223b('0x3f')]['find']({'where':{'id':_0x5cd9f7[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x4b0229,null))[_0x223b('0x36')](function(_0x45bd57){if(_0x45bd57){return _0x45bd57[_0x223b('0x93')](_0x5cd9f7[_0x223b('0x5b')][_0x223b('0x70')],_[_0x223b('0x94')](_0x5cd9f7[_0x223b('0x5b')],[_0x223b('0x70'),'id'])||{})['spread'](function(_0x1c207f){for(var _0x1c9faf=0x0;_0x1c9faf<_0x5cd9f7[_0x223b('0x5b')]['ids']['length'];_0x1c9faf+=0x1){socket[_0x223b('0x7d')](_0x223b('0x7e'),{'UserId':_0x5cd9f7[_0x223b('0x5b')]['ids'][_0x1c9faf],'ChatQueueId':_0x5cd9f7['params']['id']});}return _0x1c207f;});}})['then'](respondWithResult(_0x4b0229,null))['catch'](handleError(_0x4b0229,null));};exports['removeAgents']=function(_0x5e5e67,_0x29d898,_0x46c5f2){return db[_0x223b('0x3f')][_0x223b('0x60')]({'where':{'id':_0x5e5e67[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x29d898,null))[_0x223b('0x36')](function(_0x56afff){if(_0x56afff){return _0x56afff[_0x223b('0x92')](_0x5e5e67[_0x223b('0x43')][_0x223b('0x70')])[_0x223b('0x36')](function(){if(_[_0x223b('0x95')](_0x5e5e67[_0x223b('0x43')]['ids'])){for(var _0x2b5c89=0x0;_0x2b5c89<_0x5e5e67[_0x223b('0x43')][_0x223b('0x70')][_0x223b('0x48')];_0x2b5c89+=0x1){socket['emit'](_0x223b('0x96'),{'UserId':Number(_0x5e5e67['query']['ids'][_0x2b5c89]),'ChatQueueId':Number(_0x5e5e67[_0x223b('0x63')]['id'])});}}else{socket[_0x223b('0x7d')]('userChatQueue:remove',{'UserId':Number(_0x5e5e67[_0x223b('0x43')][_0x223b('0x70')]),'ChatQueueId':Number(_0x5e5e67[_0x223b('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x29d898,null))['catch'](handleError(_0x29d898,null));};exports['getAgents']=function(_0x864799,_0x4ae963,_0x51274c){var _0x12ab72={};var _0x1253ed={};var _0x471079;var _0x27e0f5;return db[_0x223b('0x3f')][_0x223b('0x64')]({'where':{'id':_0x864799[_0x223b('0x63')]['id']}})[_0x223b('0x36')](handleEntityNotFound(_0x4ae963,null))[_0x223b('0x36')](function(_0x12e5cc){if(_0x12e5cc){_0x471079=_0x12e5cc;_0x1253ed[_0x223b('0x42')]=_['keys'](db['User'][_0x223b('0x40')]);_0x1253ed[_0x223b('0x43')]=_[_0x223b('0x44')](_0x864799['query']);_0x1253ed[_0x223b('0x4d')]=_[_0x223b('0x45')](_0x1253ed[_0x223b('0x42')],_0x1253ed[_0x223b('0x43')]);_0x12ab72['attributes']=_['intersection'](_0x1253ed['model'],qs[_0x223b('0x46')](_0x864799[_0x223b('0x43')][_0x223b('0x46')]));_0x12ab72[_0x223b('0x47')]=_0x12ab72['attributes']['length']?_0x12ab72['attributes']:_0x1253ed[_0x223b('0x42')];_0x12ab72['order']=qs[_0x223b('0x4c')](_0x864799['query'][_0x223b('0x4c')]);_0x12ab72[_0x223b('0x50')]=qs[_0x223b('0x4d')](_[_0x223b('0x4e')](_0x864799[_0x223b('0x43')],_0x1253ed['filters']));if(_0x864799['query'][_0x223b('0x4f')]){_0x12ab72[_0x223b('0x50')]=_[_0x223b('0x51')](_0x12ab72[_0x223b('0x50')],{'$or':_[_0x223b('0x3e')](_0x12ab72[_0x223b('0x47')],function(_0x502cc2){var _0x4a1c8c={};_0x4a1c8c[_0x502cc2]={'$like':'%'+_0x864799[_0x223b('0x43')][_0x223b('0x4f')]+'%'};return _0x4a1c8c;})});}_0x12ab72=_[_0x223b('0x51')]({},_0x12ab72,_0x864799[_0x223b('0x54')]);return _0x471079['getAgents'](_0x12ab72);}})['then'](function(_0x563db8){if(_0x563db8){_0x27e0f5=_0x563db8[_0x223b('0x48')];if(!_0x864799[_0x223b('0x43')][_0x223b('0x66')]('nolimit')){_0x12ab72[_0x223b('0x4a')]=qs['limit'](_0x864799[_0x223b('0x43')][_0x223b('0x4a')]);_0x12ab72['offset']=qs[_0x223b('0x2f')](_0x864799[_0x223b('0x43')][_0x223b('0x2f')]);}return _0x471079[_0x223b('0x97')](_0x12ab72);}})[_0x223b('0x36')](function(_0x2f6808){if(_0x2f6808){return _0x2f6808?{'count':_0x27e0f5,'rows':_0x2f6808}:null;}})[_0x223b('0x36')](respondWithResult(_0x4ae963,null))[_0x223b('0x2b')](handleError(_0x4ae963,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 9c373eb..0ac3d7e 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x57fb13,_0x45645d){var _0x2e2ac8=function(_0x4ce104){while(--_0x4ce104){_0x57fb13['push'](_0x57fb13['shift']());}};_0x2e2ac8(++_0x45645d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x314123,_0x3384dc){_0x314123=_0x314123-0x0;var _0x14e309=_0x5f2f[_0x314123];return _0x14e309;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x150397,_0x258581){var _0x5cadab=function(_0x3052d6){while(--_0x3052d6){_0x150397['push'](_0x150397['shift']());}};_0x5cadab(++_0x258581);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];ChatQueue[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index de7dafd..9961590 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 _0x64d1=['api','moment','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','lodash','../../config/logger'];(function(_0x416bb1,_0x965f5e){var _0x48fc39=function(_0x51acc1){while(--_0x51acc1){_0x416bb1['push'](_0x416bb1['shift']());}};_0x48fc39(++_0x965f5e);}(_0x64d1,0xb9));var _0x164d=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x64d1[_0x5cc8b9];return _0x58892e;};'use strict';var _=require(_0x164d('0x0'));var util=require('util');var logger=require(_0x164d('0x1'))(_0x164d('0x2'));var moment=require(_0x164d('0x3'));var BPromise=require('bluebird');var rp=require(_0x164d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x164d('0x5'));var config=require(_0x164d('0x6'));var attributes=require(_0x164d('0x7'));module[_0x164d('0x8')]=function(_0x34f875,_0x5d7478){return _0x34f875['define'](_0x164d('0x9'),attributes,{'tableName':_0x164d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c1b=['define','ChatQueue','chat_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9c1b,0x153));var _0xb9c1=function(_0x5aece9,_0x2bbb9a){_0x5aece9=_0x5aece9-0x0;var _0x1c46d6=_0x9c1b[_0x5aece9];return _0x1c46d6;};'use strict';var _=require('lodash');var util=require(_0xb9c1('0x0'));var logger=require(_0xb9c1('0x1'))(_0xb9c1('0x2'));var moment=require('moment');var BPromise=require(_0xb9c1('0x3'));var rp=require(_0xb9c1('0x4'));var fs=require('fs');var path=require(_0xb9c1('0x5'));var rimraf=require(_0xb9c1('0x6'));var config=require(_0xb9c1('0x7'));var attributes=require('./chatQueue.attributes');module[_0xb9c1('0x8')]=function(_0x289d19,_0x4abfa1){return _0x289d19[_0xb9c1('0x9')](_0xb9c1('0xa'),attributes,{'tableName':_0xb9c1('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 44d1e0a..c4d6bfb 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 _0x52b8=['find','util','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http','redis','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','map','model','ShowChatQueue'];(function(_0x315b61,_0x4bb11e){var _0x3521e8=function(_0x5e6389){while(--_0x5e6389){_0x315b61['push'](_0x315b61['shift']());}};_0x3521e8(++_0x4bb11e);}(_0x52b8,0xd3));var _0x852b=function(_0x4ed496,_0x2852d1){_0x4ed496=_0x4ed496-0x0;var _0x3597cc=_0x52b8[_0x4ed496];return _0x3597cc;};'use strict';var _=require('lodash');var util=require(_0x852b('0x0'));var moment=require('moment');var BPromise=require(_0x852b('0x1'));var rs=require(_0x852b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x852b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x852b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x852b('0x5'));var client=jayson['client'][_0x852b('0x6')]({'port':0x232a});config[_0x852b('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x852b('0x8'))(new Redis(config[_0x852b('0x7')]));require(_0x852b('0x9'))[_0x852b('0xa')](socket);function respondWithRpcPromise(_0x1d5387,_0x5d4c6a,_0x213e24){return new BPromise(function(_0x12e3f4,_0x41a36b){return client[_0x852b('0xb')](_0x1d5387,_0x213e24)[_0x852b('0xc')](function(_0x56a9e7){logger[_0x852b('0xd')](_0x852b('0xe'),_0x5d4c6a,'request\x20sent');logger[_0x852b('0xf')](_0x852b('0x10'),_0x5d4c6a,'request\x20sent',JSON[_0x852b('0x11')](_0x56a9e7));if(_0x56a9e7[_0x852b('0x12')]){if(_0x56a9e7[_0x852b('0x12')]['code']===0x1f4){logger[_0x852b('0x12')](_0x852b('0xe'),_0x5d4c6a,_0x56a9e7[_0x852b('0x12')][_0x852b('0x13')]);return _0x41a36b(_0x56a9e7[_0x852b('0x12')][_0x852b('0x13')]);}logger[_0x852b('0x12')](_0x852b('0xe'),_0x5d4c6a,_0x56a9e7['error']['message']);return _0x12e3f4(_0x56a9e7[_0x852b('0x12')][_0x852b('0x13')]);}else{logger[_0x852b('0xd')]('ChatQueue,\x20%s,\x20%s',_0x5d4c6a,_0x852b('0x14'));_0x12e3f4(_0x56a9e7[_0x852b('0x15')][_0x852b('0x13')]);}})[_0x852b('0x16')](function(_0x16491a){logger[_0x852b('0x12')](_0x852b('0xe'),_0x5d4c6a,_0x16491a);_0x41a36b(_0x16491a);});});}exports[_0x852b('0x17')]=function(_0xa928f9){var _0x28326a=this;return new Promise(function(_0x272808,_0x15118e){return db[_0x852b('0x18')][_0x852b('0x19')]({'raw':_0xa928f9[_0x852b('0x1a')]?_0xa928f9[_0x852b('0x1a')][_0x852b('0x1b')]===undefined?!![]:![]:!![],'where':_0xa928f9[_0x852b('0x1a')]?_0xa928f9[_0x852b('0x1a')][_0x852b('0x1c')]||null:null,'attributes':_0xa928f9[_0x852b('0x1a')]?_0xa928f9[_0x852b('0x1a')][_0x852b('0x1d')]||null:null,'limit':_0xa928f9[_0x852b('0x1a')]?_0xa928f9['options']['limit']||null:null,'include':_0xa928f9[_0x852b('0x1a')]?_0xa928f9[_0x852b('0x1a')][_0x852b('0x1e')]?_[_0x852b('0x1f')](_0xa928f9[_0x852b('0x1a')][_0x852b('0x1e')],function(_0x2f8409){return{'model':db[_0x2f8409[_0x852b('0x20')]],'as':_0x2f8409['as'],'attributes':_0x2f8409[_0x852b('0x1d')],'include':_0x2f8409[_0x852b('0x1e')]?_[_0x852b('0x1f')](_0x2f8409[_0x852b('0x1e')],function(_0x5b586e){return{'model':db[_0x5b586e['model']],'as':_0x5b586e['as'],'attributes':_0x5b586e['attributes'],'include':_0x5b586e[_0x852b('0x1e')]?_[_0x852b('0x1f')](_0x5b586e[_0x852b('0x1e')],function(_0x399b1d){return{'model':db[_0x399b1d[_0x852b('0x20')]],'as':_0x399b1d['as'],'attributes':_0x399b1d[_0x852b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x852b('0xc')](function(_0x450838){logger[_0x852b('0xd')](_0x852b('0x17'),_0xa928f9);logger['debug']('GetChatQueue',_0xa928f9,JSON['stringify'](_0x450838));_0x272808(_0x450838);})['catch'](function(_0x4ca7ab){logger[_0x852b('0x12')]('GetChatQueue',_0x4ca7ab[_0x852b('0x13')],_0xa928f9);_0x15118e(_0x28326a[_0x852b('0x12')](0x1f4,_0x4ca7ab[_0x852b('0x13')]));});});};exports[_0x852b('0x21')]=function(_0x2c92ca){var _0x788147=this;return new Promise(function(_0x12c879,_0x4b7876){return db[_0x852b('0x18')][_0x852b('0x22')]({'raw':_0x2c92ca[_0x852b('0x1a')]?_0x2c92ca[_0x852b('0x1a')][_0x852b('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c92ca[_0x852b('0x1a')]?_0x2c92ca[_0x852b('0x1a')]['where']||null:null,'attributes':_0x2c92ca[_0x852b('0x1a')]?_0x2c92ca[_0x852b('0x1a')][_0x852b('0x1d')]||null:null,'include':_0x2c92ca[_0x852b('0x1a')]?_0x2c92ca[_0x852b('0x1a')]['include']?_[_0x852b('0x1f')](_0x2c92ca[_0x852b('0x1a')][_0x852b('0x1e')],function(_0x36955a){return{'model':db[_0x36955a[_0x852b('0x20')]],'as':_0x36955a['as'],'attributes':_0x36955a[_0x852b('0x1d')],'include':_0x36955a['include']?_[_0x852b('0x1f')](_0x36955a['include'],function(_0x4860f4){return{'model':db[_0x4860f4['model']],'as':_0x4860f4['as'],'attributes':_0x4860f4[_0x852b('0x1d')],'include':_0x4860f4[_0x852b('0x1e')]?_['map'](_0x4860f4['include'],function(_0x55df50){return{'model':db[_0x55df50[_0x852b('0x20')]],'as':_0x55df50['as'],'attributes':_0x55df50['attributes']};}):[]};}):[]};}):[]:[]})[_0x852b('0xc')](function(_0xb3e125){logger[_0x852b('0xd')](_0x852b('0x21'),_0x2c92ca);logger[_0x852b('0xf')](_0x852b('0x21'),_0x2c92ca,JSON[_0x852b('0x11')](_0xb3e125));_0x12c879(_0xb3e125);})[_0x852b('0x16')](function(_0x2c19f6){logger['error'](_0x852b('0x21'),_0x2c19f6[_0x852b('0x13')],_0x2c92ca);_0x4b7876(_0x788147[_0x852b('0x12')](0x1f4,_0x2c19f6['message']));});});}; \ No newline at end of file +var _0x9660=['error','code','message','info','result','ChatQueue','options','raw','where','attributes','limit','include','model','map','GetChatQueue','ShowChatQueue','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xb61065,_0x159992){var _0x3f3fcb=function(_0x3aa3f4){while(--_0x3aa3f4){_0xb61065['push'](_0xb61065['shift']());}};_0x3f3fcb(++_0x159992);}(_0x9660,0x1f1));var _0x0966=function(_0x43ec56,_0x1a66cc){_0x43ec56=_0x43ec56-0x0;var _0x5ad932=_0x9660[_0x43ec56];return _0x5ad932;};'use strict';var _=require(_0x0966('0x0'));var util=require('util');var moment=require(_0x0966('0x1'));var BPromise=require(_0x0966('0x2'));var rs=require(_0x0966('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0966('0x4'))['db'];var utils=require(_0x0966('0x5'));var logger=require(_0x0966('0x6'))(_0x0966('0x7'));var config=require(_0x0966('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0966('0x9')][_0x0966('0xa')]({'port':0x232a});config[_0x0966('0xb')]=_[_0x0966('0xc')](config[_0x0966('0xb')],{'host':_0x0966('0xd'),'port':0x18eb});var socket=require(_0x0966('0xe'))(new Redis(config['redis']));require(_0x0966('0xf'))[_0x0966('0x10')](socket);function respondWithRpcPromise(_0x32907f,_0x205f0b,_0x8ece1c){return new BPromise(function(_0x2add4f,_0x3282ee){return client[_0x0966('0x11')](_0x32907f,_0x8ece1c)[_0x0966('0x12')](function(_0x8e557e){logger['info'](_0x0966('0x13'),_0x205f0b,_0x0966('0x14'));logger[_0x0966('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x205f0b,'request\x20sent',JSON[_0x0966('0x16')](_0x8e557e));if(_0x8e557e[_0x0966('0x17')]){if(_0x8e557e[_0x0966('0x17')][_0x0966('0x18')]===0x1f4){logger[_0x0966('0x17')](_0x0966('0x13'),_0x205f0b,_0x8e557e['error'][_0x0966('0x19')]);return _0x3282ee(_0x8e557e['error'][_0x0966('0x19')]);}logger[_0x0966('0x17')](_0x0966('0x13'),_0x205f0b,_0x8e557e[_0x0966('0x17')][_0x0966('0x19')]);return _0x2add4f(_0x8e557e['error'][_0x0966('0x19')]);}else{logger[_0x0966('0x1a')](_0x0966('0x13'),_0x205f0b,_0x0966('0x14'));_0x2add4f(_0x8e557e[_0x0966('0x1b')]['message']);}})['catch'](function(_0x27e6c3){logger[_0x0966('0x17')](_0x0966('0x13'),_0x205f0b,_0x27e6c3);_0x3282ee(_0x27e6c3);});});}exports['GetChatQueue']=function(_0x550310){var _0x5bd210=this;return new Promise(function(_0x4543e7,_0x1ae53c){return db[_0x0966('0x1c')]['findAll']({'raw':_0x550310[_0x0966('0x1d')]?_0x550310[_0x0966('0x1d')][_0x0966('0x1e')]===undefined?!![]:![]:!![],'where':_0x550310[_0x0966('0x1d')]?_0x550310[_0x0966('0x1d')][_0x0966('0x1f')]||null:null,'attributes':_0x550310[_0x0966('0x1d')]?_0x550310[_0x0966('0x1d')][_0x0966('0x20')]||null:null,'limit':_0x550310[_0x0966('0x1d')]?_0x550310[_0x0966('0x1d')][_0x0966('0x21')]||null:null,'include':_0x550310['options']?_0x550310[_0x0966('0x1d')][_0x0966('0x22')]?_['map'](_0x550310[_0x0966('0x1d')][_0x0966('0x22')],function(_0x325b78){return{'model':db[_0x325b78[_0x0966('0x23')]],'as':_0x325b78['as'],'attributes':_0x325b78[_0x0966('0x20')],'include':_0x325b78['include']?_[_0x0966('0x24')](_0x325b78[_0x0966('0x22')],function(_0x43dd51){return{'model':db[_0x43dd51[_0x0966('0x23')]],'as':_0x43dd51['as'],'attributes':_0x43dd51[_0x0966('0x20')],'include':_0x43dd51[_0x0966('0x22')]?_['map'](_0x43dd51[_0x0966('0x22')],function(_0x499699){return{'model':db[_0x499699[_0x0966('0x23')]],'as':_0x499699['as'],'attributes':_0x499699['attributes']};}):[]};}):[]};}):[]:[]})[_0x0966('0x12')](function(_0x123188){logger[_0x0966('0x1a')](_0x0966('0x25'),_0x550310);logger[_0x0966('0x15')](_0x0966('0x25'),_0x550310,JSON['stringify'](_0x123188));_0x4543e7(_0x123188);})['catch'](function(_0x504075){logger['error'](_0x0966('0x25'),_0x504075[_0x0966('0x19')],_0x550310);_0x1ae53c(_0x5bd210['error'](0x1f4,_0x504075[_0x0966('0x19')]));});});};exports[_0x0966('0x26')]=function(_0x463aa4){var _0x41642a=this;return new Promise(function(_0x5adbab,_0x724614){return db['ChatQueue']['find']({'raw':_0x463aa4[_0x0966('0x1d')]?_0x463aa4[_0x0966('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x463aa4['options']?_0x463aa4['options'][_0x0966('0x1f')]||null:null,'attributes':_0x463aa4['options']?_0x463aa4[_0x0966('0x1d')][_0x0966('0x20')]||null:null,'include':_0x463aa4[_0x0966('0x1d')]?_0x463aa4[_0x0966('0x1d')]['include']?_['map'](_0x463aa4[_0x0966('0x1d')][_0x0966('0x22')],function(_0x2c0545){return{'model':db[_0x2c0545[_0x0966('0x23')]],'as':_0x2c0545['as'],'attributes':_0x2c0545[_0x0966('0x20')],'include':_0x2c0545['include']?_[_0x0966('0x24')](_0x2c0545['include'],function(_0x8eb3aa){return{'model':db[_0x8eb3aa[_0x0966('0x23')]],'as':_0x8eb3aa['as'],'attributes':_0x8eb3aa['attributes'],'include':_0x8eb3aa['include']?_[_0x0966('0x24')](_0x8eb3aa[_0x0966('0x22')],function(_0x12cf4c){return{'model':db[_0x12cf4c[_0x0966('0x23')]],'as':_0x12cf4c['as'],'attributes':_0x12cf4c[_0x0966('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0966('0x12')](function(_0xe1d9ba){logger[_0x0966('0x1a')]('ShowChatQueue',_0x463aa4);logger[_0x0966('0x15')](_0x0966('0x26'),_0x463aa4,JSON['stringify'](_0xe1d9ba));_0x5adbab(_0xe1d9ba);})[_0x0966('0x27')](function(_0x435b75){logger[_0x0966('0x17')]('ShowChatQueue',_0x435b75[_0x0966('0x19')],_0x463aa4);_0x724614(_0x41642a['error'](0x1f4,_0x435b75[_0x0966('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index d56b500..33bc6b1 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x3c6125,_0x3b2a9c){var _0x2f47b8=function(_0x214650){while(--_0x214650){_0x3c6125['push'](_0x3c6125['shift']());}};_0x2f47b8(++_0x3b2a9c);}(_0xb10b,0x12a));var _0xbb10=function(_0x27c021,_0x190f72){_0x27c021=_0x27c021-0x0;var _0x1d0700=_0xb10b[_0x27c021];return _0x1d0700;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x59ee9c,_0x43f62d){var _0x44a2a8=function(_0x5b2c33){while(--_0x5b2c33){_0x59ee9c['push'](_0x59ee9c['shift']());}};_0x44a2a8(++_0x43f62d);}(_0xb10b,0x12a));var _0xbb10=function(_0x49684e,_0x9a24fb){_0x49684e=_0x49684e-0x0;var _0x54062f=_0xb10b[_0x49684e];return _0x54062f;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 432aa1a..4d6e692 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 _0xe397=['put','/:id','update','destroy','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents'];(function(_0x37b7be,_0x5447b1){var _0x19cca6=function(_0x268cd5){while(--_0x268cd5){_0x37b7be['push'](_0x37b7be['shift']());}};_0x19cca6(++_0x5447b1);}(_0xe397,0xa2));var _0x7e39=function(_0x1e49ee,_0x3257b6){_0x1e49ee=_0x1e49ee-0x0;var _0x3dcf1e=_0xe397[_0x1e49ee];return _0x3dcf1e;};'use strict';var multer=require(_0x7e39('0x0'));var util=require(_0x7e39('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7e39('0x2')]();var auth=require(_0x7e39('0x3'));var interaction=require(_0x7e39('0x4'));var config=require(_0x7e39('0x5'));var controller=require(_0x7e39('0x6'));router[_0x7e39('0x7')]('/',auth[_0x7e39('0x8')](),controller['index']);router[_0x7e39('0x7')](_0x7e39('0x9'),auth[_0x7e39('0x8')](),controller[_0x7e39('0xa')]);router[_0x7e39('0x7')]('/:id',auth[_0x7e39('0x8')](),controller[_0x7e39('0xb')]);router[_0x7e39('0x7')]('/:id/members',auth[_0x7e39('0x8')](),controller[_0x7e39('0xc')]);router[_0x7e39('0x7')](_0x7e39('0xd'),auth[_0x7e39('0x8')](),controller[_0x7e39('0xe')]);router[_0x7e39('0x7')](_0x7e39('0xf'),auth[_0x7e39('0x8')](),controller['getAgents']);router[_0x7e39('0x10')]('/',auth['isAuthenticated'](),controller[_0x7e39('0x11')]);router[_0x7e39('0x10')](_0x7e39('0xd'),auth[_0x7e39('0x8')](),controller[_0x7e39('0x12')]);router[_0x7e39('0x10')](_0x7e39('0xf'),auth[_0x7e39('0x8')](),controller[_0x7e39('0x13')]);router[_0x7e39('0x14')](_0x7e39('0x15'),auth[_0x7e39('0x8')](),controller[_0x7e39('0x16')]);router['delete'](_0x7e39('0x15'),auth[_0x7e39('0x8')](),controller[_0x7e39('0x17')]);router[_0x7e39('0x18')](_0x7e39('0xd'),auth[_0x7e39('0x8')](),controller['removeTeams']);router[_0x7e39('0x18')]('/:id/users',auth[_0x7e39('0x8')](),controller['removeAgents']);module[_0x7e39('0x19')]=router; \ No newline at end of file +var _0xe29f=['express','Router','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','util','connect-timeout'];(function(_0x397007,_0x133ceb){var _0x3cc47a=function(_0x5a9e7f){while(--_0x5a9e7f){_0x397007['push'](_0x397007['shift']());}};_0x3cc47a(++_0x133ceb);}(_0xe29f,0x132));var _0xfe29=function(_0xe78015,_0xd60f5d){_0xe78015=_0xe78015-0x0;var _0x3fa910=_0xe29f[_0xe78015];return _0x3fa910;};'use strict';var multer=require('multer');var util=require(_0xfe29('0x0'));var path=require('path');var timeout=require(_0xfe29('0x1'));var express=require(_0xfe29('0x2'));var router=express[_0xfe29('0x3')]();var auth=require(_0xfe29('0x4'));var interaction=require(_0xfe29('0x5'));var config=require('../../config/environment');var controller=require(_0xfe29('0x6'));router[_0xfe29('0x7')]('/',auth[_0xfe29('0x8')](),controller[_0xfe29('0x9')]);router[_0xfe29('0x7')](_0xfe29('0xa'),auth[_0xfe29('0x8')](),controller[_0xfe29('0xb')]);router['get'](_0xfe29('0xc'),auth[_0xfe29('0x8')](),controller[_0xfe29('0xd')]);router[_0xfe29('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0xfe29('0xe')]);router[_0xfe29('0x7')](_0xfe29('0xf'),auth[_0xfe29('0x8')](),controller[_0xfe29('0x10')]);router['get']('/:id/users',auth[_0xfe29('0x8')](),controller[_0xfe29('0x11')]);router[_0xfe29('0x12')]('/',auth[_0xfe29('0x8')](),controller[_0xfe29('0x13')]);router[_0xfe29('0x12')](_0xfe29('0xf'),auth[_0xfe29('0x8')](),controller['addTeams']);router[_0xfe29('0x12')](_0xfe29('0x14'),auth['isAuthenticated'](),controller[_0xfe29('0x15')]);router[_0xfe29('0x16')](_0xfe29('0xc'),auth[_0xfe29('0x8')](),controller[_0xfe29('0x17')]);router[_0xfe29('0x18')](_0xfe29('0xc'),auth[_0xfe29('0x8')](),controller[_0xfe29('0x19')]);router[_0xfe29('0x18')](_0xfe29('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xfe29('0x18')]('/:id/users',auth[_0xfe29('0x8')](),controller[_0xfe29('0x1a')]);module[_0xfe29('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 da56ac3..5b5e656 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 _0x7b4b=['moment','sequelize','exports','STRING','DATE'];(function(_0x2bfa06,_0x351e03){var _0x58811b=function(_0x624504){while(--_0x624504){_0x2bfa06['push'](_0x2bfa06['shift']());}};_0x58811b(++_0x351e03);}(_0x7b4b,0xa0));var _0xb7b4=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0x7b4b[_0x1ac77b];return _0x161584;};'use strict';var moment=require(_0xb7b4('0x0'));var Sequelize=require(_0xb7b4('0x1'));module[_0xb7b4('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb7b4('0x3')]},'joinAt':{'type':Sequelize[_0xb7b4('0x4')]},'leaveAt':{'type':Sequelize[_0xb7b4('0x4')]},'acceptAt':{'type':Sequelize[_0xb7b4('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb7b4('0x3')]}}; \ No newline at end of file +var _0xee7b=['moment','sequelize','exports','STRING','DATE'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xee7b,0x177));var _0xbee7=function(_0x522030,_0x3ed0ad){_0x522030=_0x522030-0x0;var _0x1b9d5b=_0xee7b[_0x522030];return _0x1b9d5b;};'use strict';var moment=require(_0xbee7('0x0'));var Sequelize=require(_0xbee7('0x1'));module[_0xbee7('0x2')]={'uniqueid':{'type':Sequelize[_0xbee7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbee7('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbee7('0x4')]},'acceptAt':{'type':Sequelize[_0xbee7('0x4')]},'exitAt':{'type':Sequelize[_0xbee7('0x4')]},'reason':{'type':Sequelize[_0xbee7('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 5b8e27e..d9e79bd 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 _0xd8b0=['intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','ChatQueueReport','count','includeAll','include','findAll','catch','show','params','options','create','body','find','destroy','describe','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys'];(function(_0xd2b6cb,_0x474f4d){var _0x1205ad=function(_0x7afc84){while(--_0x7afc84){_0xd2b6cb['push'](_0xd2b6cb['shift']());}};_0x1205ad(++_0x474f4d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){_0x33fb87[_0x0d8b('0x17')](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x38efc8,_0x221071){return function(_0x2c64e2){if(!_0x2c64e2){_0x38efc8[_0x0d8b('0x16')](0x194);}return _0x2c64e2;};}function handleError(_0x4562cb,_0x27b695){_0x27b695=_0x27b695||0x1f4;return function(_0x5e5bc3){logger[_0x0d8b('0x23')](_0x5e5bc3[_0x0d8b('0x24')]);if(_0x5e5bc3['name']){delete _0x5e5bc3[_0x0d8b('0x25')];}_0x4562cb['status'](_0x27b695)[_0x0d8b('0x26')](_0x5e5bc3);};}exports[_0x0d8b('0x27')]=function(_0xa2af02,_0x4fe6f9){var _0x59a905={},_0x28f639={},_0x3ef745={'count':0x0,'rows':[]};var _0x4c05ee=_[_0x0d8b('0x28')](db['ChatQueueReport'][_0x0d8b('0x29')],function(_0x4b59e5){return{'name':_0x4b59e5[_0x0d8b('0x2a')],'type':_0x4b59e5['type'][_0x0d8b('0x2b')]};});_0x28f639['model']=_[_0x0d8b('0x28')](_0x4c05ee,'name');_0x28f639[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0xa2af02[_0x0d8b('0x2c')]);_0x28f639['filters']=_['intersection'](_0x28f639['model'],_0x28f639[_0x0d8b('0x2c')]);_0x59a905['attributes']=_[_0x0d8b('0x2e')](_0x28f639['model'],qs['fields'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x2f')]));_0x59a905[_0x0d8b('0x30')]=_0x59a905[_0x0d8b('0x30')][_0x0d8b('0x31')]?_0x59a905[_0x0d8b('0x30')]:_0x28f639[_0x0d8b('0x32')];if(!_0xa2af02[_0x0d8b('0x2c')]['hasOwnProperty'](_0x0d8b('0x33'))){_0x59a905[_0x0d8b('0x1b')]=qs['limit'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1b')]);_0x59a905[_0x0d8b('0x1a')]=qs['offset'](_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}_0x59a905[_0x0d8b('0x34')]=qs[_0x0d8b('0x35')](_0xa2af02[_0x0d8b('0x2c')]['sort']);_0x59a905[_0x0d8b('0x36')]=qs[_0x0d8b('0x37')](_['pick'](_0xa2af02[_0x0d8b('0x2c')],_0x28f639[_0x0d8b('0x37')]),_0x4c05ee);if(_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x59a905[_0x0d8b('0x36')]=_['merge'](_0x59a905['where'],{'$or':_[_0x0d8b('0x28')](_0x4c05ee,function(_0x5c2c04){if(_0x5c2c04['type']!==_0x0d8b('0x39')){var _0x2e279c={};_0x2e279c[_0x5c2c04[_0x0d8b('0x25')]]={'$like':'%'+_0xa2af02[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x2e279c;}})});}_0x59a905=_[_0x0d8b('0x3a')]({},_0x59a905,_0xa2af02['options']);var _0x6e5bab={'where':_0x59a905[_0x0d8b('0x36')]};return db[_0x0d8b('0x3b')][_0x0d8b('0x3c')](_0x6e5bab)[_0x0d8b('0x22')](function(_0x1a39ad){_0x3ef745[_0x0d8b('0x3c')]=_0x1a39ad;if(_0xa2af02['query'][_0x0d8b('0x3d')]){_0x59a905[_0x0d8b('0x3e')]=[{'all':!![]}];}return db[_0x0d8b('0x3b')][_0x0d8b('0x3f')](_0x59a905);})['then'](function(_0xe0bf42){_0x3ef745['rows']=_0xe0bf42;return _0x3ef745;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4fe6f9,_0x59a905))[_0x0d8b('0x40')](handleError(_0x4fe6f9,null));};exports[_0x0d8b('0x41')]=function(_0x26ac10,_0x35fa7e){var _0x3e632e={'raw':!![],'where':{'id':_0x26ac10[_0x0d8b('0x42')]['id']}},_0x1ff17d={};_0x1ff17d[_0x0d8b('0x32')]=_[_0x0d8b('0x2d')](db['ChatQueueReport']['rawAttributes']);_0x1ff17d['query']=_['keys'](_0x26ac10['query']);_0x1ff17d[_0x0d8b('0x37')]=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],_0x1ff17d['query']);_0x3e632e['attributes']=_[_0x0d8b('0x2e')](_0x1ff17d[_0x0d8b('0x32')],qs[_0x0d8b('0x2f')](_0x26ac10['query'][_0x0d8b('0x2f')]));_0x3e632e[_0x0d8b('0x30')]=_0x3e632e['attributes']['length']?_0x3e632e[_0x0d8b('0x30')]:_0x1ff17d['model'];if(_0x26ac10[_0x0d8b('0x2c')]['includeAll']){_0x3e632e['include']=[{'all':!![]}];}_0x3e632e=_[_0x0d8b('0x3a')]({},_0x3e632e,_0x26ac10[_0x0d8b('0x43')]);return db['ChatQueueReport']['find'](_0x3e632e)['then'](handleEntityNotFound(_0x35fa7e,null))['then'](respondWithResult(_0x35fa7e,null))[_0x0d8b('0x40')](handleError(_0x35fa7e,null));};exports[_0x0d8b('0x44')]=function(_0xd9d4c3,_0x490eda){return db[_0x0d8b('0x3b')][_0x0d8b('0x44')](_0xd9d4c3[_0x0d8b('0x45')],{})[_0x0d8b('0x22')](respondWithResult(_0x490eda,0xc9))[_0x0d8b('0x40')](handleError(_0x490eda,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x45')]['id']){delete _0x11d22b[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x3b')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x45')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x40')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x47')]=function(_0x574b90,_0x371fa0){return db['ChatQueueReport']['find']({'where':{'id':_0x574b90[_0x0d8b('0x42')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x371fa0,null))[_0x0d8b('0x22')](removeEntity(_0x371fa0,null))[_0x0d8b('0x40')](handleError(_0x371fa0,null));};exports['describe']=function(_0x131579,_0x1106d6){return db[_0x0d8b('0x3b')][_0x0d8b('0x48')]()[_0x0d8b('0x22')](respondWithResult(_0x1106d6,null))['catch'](handleError(_0x1106d6,null));}; \ No newline at end of file +var _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(_0x250175,_0x19ba42){var _0x679d6f=function(_0x3fbce6){while(--_0x3fbce6){_0x250175['push'](_0x250175['shift']());}};_0x679d6f(++_0x19ba42);}(_0xe706,0xa3));var _0x6e70=function(_0x209581,_0x11f596){_0x209581=_0x209581-0x0;var _0x2fed45=_0xe706[_0x209581];return _0x2fed45;};'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 2b48058..ed7d1a1 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 _0xcf6f=['./chatQueueReport.attributes','exports','define','ChatQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4151c3,_0x2e247c){var _0x191a21=function(_0x4b7b47){while(--_0x4b7b47){_0x4151c3['push'](_0x4151c3['shift']());}};_0x191a21(++_0x2e247c);}(_0xcf6f,0x67));var _0xfcf6=function(_0x4b53d1,_0x3a87ea){_0x4b53d1=_0x4b53d1-0x0;var _0x20a201=_0xcf6f[_0x4b53d1];return _0x20a201;};'use strict';var _=require(_0xfcf6('0x0'));var util=require(_0xfcf6('0x1'));var logger=require(_0xfcf6('0x2'))(_0xfcf6('0x3'));var moment=require(_0xfcf6('0x4'));var BPromise=require(_0xfcf6('0x5'));var rp=require(_0xfcf6('0x6'));var fs=require('fs');var path=require(_0xfcf6('0x7'));var rimraf=require('rimraf');var config=require(_0xfcf6('0x8'));var attributes=require(_0xfcf6('0x9'));module[_0xfcf6('0xa')]=function(_0x361abd,_0x2ab3c6){return _0x361abd[_0xfcf6('0xb')](_0xfcf6('0xc'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0xfcf6('0xd'),'fields':[_0xfcf6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdac=['path','rimraf','exports','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x46f4aa,_0x3086e6){var _0x197c3a=function(_0x5cf206){while(--_0x5cf206){_0x46f4aa['push'](_0x46f4aa['shift']());}};_0x197c3a(++_0x3086e6);}(_0xcdac,0x175));var _0xccda=function(_0x218e36,_0x3daecb){_0x218e36=_0x218e36-0x0;var _0x10eb6d=_0xcdac[_0x218e36];return _0x10eb6d;};'use strict';var _=require(_0xccda('0x0'));var util=require('util');var logger=require(_0xccda('0x1'))(_0xccda('0x2'));var moment=require(_0xccda('0x3'));var BPromise=require(_0xccda('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xccda('0x5'));var rimraf=require(_0xccda('0x6'));var config=require('../../config/environment');var attributes=require('./chatQueueReport.attributes');module[_0xccda('0x7')]=function(_0x307331,_0x59dfb3){return _0x307331['define']('ChatQueueReport',attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0xccda('0x8'),'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 046b59d..4070dba 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 _0xafdc=['ChatQueueReport,\x20%s,\x20%s','message','create','options','raw','CreateChatQueueReport','stringify','catch','UpdateChatQueueReport','ChatQueueReport','update','body','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xafdc,0x1af));var _0xcafd=function(_0x2ac608,_0x4ffc74){_0x2ac608=_0x2ac608-0x0;var _0x1e9151=_0xafdc[_0x2ac608];return _0x1e9151;};'use strict';var _=require(_0xcafd('0x0'));var util=require(_0xcafd('0x1'));var moment=require('moment');var BPromise=require(_0xcafd('0x2'));var rs=require(_0xcafd('0x3'));var fs=require('fs');var Redis=require(_0xcafd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcafd('0x5'));var logger=require('../../config/logger')(_0xcafd('0x6'));var config=require(_0xcafd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcafd('0x8')][_0xcafd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33710e,_0x26ebe6,_0x1568ca){return new BPromise(function(_0x186ce0,_0x175f56){return client[_0xcafd('0xa')](_0x33710e,_0x1568ca)[_0xcafd('0xb')](function(_0x37d151){logger[_0xcafd('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x26ebe6,_0xcafd('0xd'));logger[_0xcafd('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x26ebe6,_0xcafd('0xd'),JSON['stringify'](_0x37d151));if(_0x37d151[_0xcafd('0xf')]){if(_0x37d151[_0xcafd('0xf')][_0xcafd('0x10')]===0x1f4){logger[_0xcafd('0xf')](_0xcafd('0x11'),_0x26ebe6,_0x37d151['error'][_0xcafd('0x12')]);return _0x175f56(_0x37d151['error'][_0xcafd('0x12')]);}logger[_0xcafd('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x26ebe6,_0x37d151['error'][_0xcafd('0x12')]);return _0x186ce0(_0x37d151[_0xcafd('0xf')][_0xcafd('0x12')]);}else{logger[_0xcafd('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x26ebe6,'request\x20sent');_0x186ce0(_0x37d151['result'][_0xcafd('0x12')]);}})['catch'](function(_0x382551){logger[_0xcafd('0xf')](_0xcafd('0x11'),_0x26ebe6,_0x382551);_0x175f56(_0x382551);});});}exports['CreateChatQueueReport']=function(_0xe67922){var _0x5040af=this;return new Promise(function(_0x47f55a,_0x1abc43){return db['ChatQueueReport'][_0xcafd('0x13')](_0xe67922['body'],{'raw':_0xe67922[_0xcafd('0x14')]?_0xe67922[_0xcafd('0x14')][_0xcafd('0x15')]===undefined?!![]:![]:!![]})[_0xcafd('0xb')](function(_0xc28bcc){logger['info'](_0xcafd('0x16'),_0xe67922);logger[_0xcafd('0xe')](_0xcafd('0x16'),_0xe67922,JSON[_0xcafd('0x17')](_0xc28bcc));_0x47f55a(_0xc28bcc);})[_0xcafd('0x18')](function(_0x146f13){logger['error'](_0xcafd('0x16'),_0x146f13[_0xcafd('0x12')],_0xe67922);_0x1abc43(_0x5040af[_0xcafd('0xf')](0x1f4,_0x146f13[_0xcafd('0x12')]));});});};exports[_0xcafd('0x19')]=function(_0x59bb96){var _0x314b01=this;return new Promise(function(_0x343b35,_0x3ba3b1){return db[_0xcafd('0x1a')][_0xcafd('0x1b')](_0x59bb96[_0xcafd('0x1c')],{'raw':_0x59bb96[_0xcafd('0x14')]?_0x59bb96[_0xcafd('0x14')][_0xcafd('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59bb96[_0xcafd('0x14')]?_0x59bb96[_0xcafd('0x14')][_0xcafd('0x1d')]||null:null,'attributes':_0x59bb96[_0xcafd('0x14')]?_0x59bb96['options'][_0xcafd('0x1e')]||null:null,'limit':_0x59bb96['options']?_0x59bb96['options'][_0xcafd('0x1f')]||null:null})[_0xcafd('0xb')](function(_0x5b5cf3){logger[_0xcafd('0xc')](_0xcafd('0x19'),_0x59bb96);logger['debug']('UpdateChatQueueReport',_0x59bb96,JSON[_0xcafd('0x17')](_0x5b5cf3));_0x343b35(_0x5b5cf3);})['catch'](function(_0x5be84a){logger['error'](_0xcafd('0x19'),_0x5be84a[_0xcafd('0x12')],_0x59bb96);_0x3ba3b1(_0x314b01[_0xcafd('0xf')](0x1f4,_0x5be84a[_0xcafd('0x12')]));});});}; \ No newline at end of file +var _0x3821=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','body','options','debug','UpdateChatQueueReport','update','raw','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x2d10f7,_0x36abd0){var _0x94c2f7=function(_0xcb5708){while(--_0xcb5708){_0x2d10f7['push'](_0x2d10f7['shift']());}};_0x94c2f7(++_0x36abd0);}(_0x3821,0x1c1));var _0x1382=function(_0x400bb4,_0x1b710e){_0x400bb4=_0x400bb4-0x0;var _0x4b1c24=_0x3821[_0x400bb4];return _0x4b1c24;};'use strict';var _=require(_0x1382('0x0'));var util=require(_0x1382('0x1'));var moment=require(_0x1382('0x2'));var BPromise=require('bluebird');var rs=require(_0x1382('0x3'));var fs=require('fs');var Redis=require(_0x1382('0x4'));var db=require(_0x1382('0x5'))['db'];var utils=require(_0x1382('0x6'));var logger=require(_0x1382('0x7'))('rpc');var config=require(_0x1382('0x8'));var jayson=require(_0x1382('0x9'));var client=jayson[_0x1382('0xa')][_0x1382('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3aa3c0,_0x11b84e,_0x1e70e0){return new BPromise(function(_0x498673,_0xd74af4){return client[_0x1382('0xc')](_0x3aa3c0,_0x1e70e0)[_0x1382('0xd')](function(_0x42229e){logger[_0x1382('0xe')](_0x1382('0xf'),_0x11b84e,_0x1382('0x10'));logger['debug'](_0x1382('0x11'),_0x11b84e,_0x1382('0x10'),JSON[_0x1382('0x12')](_0x42229e));if(_0x42229e[_0x1382('0x13')]){if(_0x42229e['error'][_0x1382('0x14')]===0x1f4){logger[_0x1382('0x13')](_0x1382('0xf'),_0x11b84e,_0x42229e[_0x1382('0x13')][_0x1382('0x15')]);return _0xd74af4(_0x42229e['error'][_0x1382('0x15')]);}logger[_0x1382('0x13')](_0x1382('0xf'),_0x11b84e,_0x42229e[_0x1382('0x13')][_0x1382('0x15')]);return _0x498673(_0x42229e[_0x1382('0x13')][_0x1382('0x15')]);}else{logger[_0x1382('0xe')](_0x1382('0xf'),_0x11b84e,_0x1382('0x10'));_0x498673(_0x42229e['result'][_0x1382('0x15')]);}})[_0x1382('0x16')](function(_0x4c88cb){logger[_0x1382('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x11b84e,_0x4c88cb);_0xd74af4(_0x4c88cb);});});}exports[_0x1382('0x17')]=function(_0x42618d){var _0x486f7d=this;return new Promise(function(_0x3972d5,_0x144f74){return db[_0x1382('0x18')]['create'](_0x42618d[_0x1382('0x19')],{'raw':_0x42618d[_0x1382('0x1a')]?_0x42618d['options']['raw']===undefined?!![]:![]:!![]})[_0x1382('0xd')](function(_0x37ea46){logger[_0x1382('0xe')](_0x1382('0x17'),_0x42618d);logger[_0x1382('0x1b')](_0x1382('0x17'),_0x42618d,JSON['stringify'](_0x37ea46));_0x3972d5(_0x37ea46);})[_0x1382('0x16')](function(_0x2e5d0d){logger[_0x1382('0x13')]('CreateChatQueueReport',_0x2e5d0d['message'],_0x42618d);_0x144f74(_0x486f7d['error'](0x1f4,_0x2e5d0d[_0x1382('0x15')]));});});};exports[_0x1382('0x1c')]=function(_0x107a3f){var _0x34dc21=this;return new Promise(function(_0x597b8a,_0x59f19){return db[_0x1382('0x18')][_0x1382('0x1d')](_0x107a3f[_0x1382('0x19')],{'raw':_0x107a3f['options']?_0x107a3f[_0x1382('0x1a')][_0x1382('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x107a3f[_0x1382('0x1a')]?_0x107a3f[_0x1382('0x1a')][_0x1382('0x1f')]||null:null,'attributes':_0x107a3f['options']?_0x107a3f['options']['attributes']||null:null,'limit':_0x107a3f[_0x1382('0x1a')]?_0x107a3f[_0x1382('0x1a')][_0x1382('0x20')]||null:null})['then'](function(_0x1f119d){logger[_0x1382('0xe')](_0x1382('0x1c'),_0x107a3f);logger[_0x1382('0x1b')](_0x1382('0x1c'),_0x107a3f,JSON['stringify'](_0x1f119d));_0x597b8a(_0x1f119d);})[_0x1382('0x16')](function(_0x4b0836){logger[_0x1382('0x13')](_0x1382('0x1c'),_0x4b0836[_0x1382('0x15')],_0x107a3f);_0x59f19(_0x34dc21['error'](0x1f4,_0x4b0836[_0x1382('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 7fe710d..b99b109 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 _0xaa78=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaa78,0x172));var _0x8aa7=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0xaa78[_0x35d59c];return _0x18cd27;};'use strict';var multer=require(_0x8aa7('0x0'));var util=require(_0x8aa7('0x1'));var path=require(_0x8aa7('0x2'));var timeout=require(_0x8aa7('0x3'));var express=require(_0x8aa7('0x4'));var router=express['Router']();var auth=require(_0x8aa7('0x5'));var interaction=require(_0x8aa7('0x6'));var config=require(_0x8aa7('0x7'));var controller=require(_0x8aa7('0x8'));router[_0x8aa7('0x9')]('/',auth[_0x8aa7('0xa')](),controller['index']);router[_0x8aa7('0x9')](_0x8aa7('0xb'),auth[_0x8aa7('0xa')](),controller[_0x8aa7('0xc')]);router['get'](_0x8aa7('0xd'),auth[_0x8aa7('0xa')](),controller[_0x8aa7('0xe')]);router[_0x8aa7('0xf')]('/',auth[_0x8aa7('0xa')](),controller[_0x8aa7('0x10')]);router[_0x8aa7('0x11')](_0x8aa7('0xd'),auth[_0x8aa7('0xa')](),controller[_0x8aa7('0x12')]);router['delete'](_0x8aa7('0xd'),auth[_0x8aa7('0xa')](),controller[_0x8aa7('0x13')]);module['exports']=router; \ No newline at end of file +var _0x92a5=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x31081a,_0x5abeb6){var _0x2fb5ba=function(_0x48579c){while(--_0x48579c){_0x31081a['push'](_0x31081a['shift']());}};_0x2fb5ba(++_0x5abeb6);}(_0x92a5,0x12b));var _0x592a=function(_0x33fa54,_0x42fd34){_0x33fa54=_0x33fa54-0x0;var _0xd9f968=_0x92a5[_0x33fa54];return _0xd9f968;};'use strict';var multer=require(_0x592a('0x0'));var util=require(_0x592a('0x1'));var path=require(_0x592a('0x2'));var timeout=require(_0x592a('0x3'));var express=require(_0x592a('0x4'));var router=express[_0x592a('0x5')]();var auth=require(_0x592a('0x6'));var interaction=require(_0x592a('0x7'));var config=require(_0x592a('0x8'));var controller=require(_0x592a('0x9'));router[_0x592a('0xa')]('/',auth[_0x592a('0xb')](),controller[_0x592a('0xc')]);router[_0x592a('0xa')](_0x592a('0xd'),auth[_0x592a('0xb')](),controller[_0x592a('0xe')]);router[_0x592a('0xa')](_0x592a('0xf'),auth[_0x592a('0xb')](),controller[_0x592a('0x10')]);router['post']('/',auth[_0x592a('0xb')](),controller[_0x592a('0x11')]);router[_0x592a('0x12')](_0x592a('0xf'),auth[_0x592a('0xb')](),controller[_0x592a('0x13')]);router[_0x592a('0x14')](_0x592a('0xf'),auth[_0x592a('0xb')](),controller[_0x592a('0x15')]);module[_0x592a('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 9331003..e18cf3f 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 _0x9944=['account','DATE','NOW','moment','sequelize','exports','STRING','ENUM'];(function(_0x870c69,_0x90aae5){var _0x5116fc=function(_0x298b97){while(--_0x298b97){_0x870c69['push'](_0x870c69['shift']());}};_0x5116fc(++_0x90aae5);}(_0x9944,0x1d3));var _0x4994=function(_0xb51ada,_0xc5907a){_0xb51ada=_0xb51ada-0x0;var _0x25da2c=_0x9944[_0xb51ada];return _0x25da2c;};'use strict';var moment=require(_0x4994('0x0'));var Sequelize=require(_0x4994('0x1'));module[_0x4994('0x2')]={'uniqueid':{'type':Sequelize[_0x4994('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4994('0x4')](_0x4994('0x5'),'agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x4994('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x4994('0x7')]}}; \ No newline at end of file +var _0x96bf=['STRING','ENUM','account','agent','queue','DATE','moment','sequelize','exports'];(function(_0x4e69f7,_0x2031af){var _0x67b5e2=function(_0x50b8b1){while(--_0x50b8b1){_0x4e69f7['push'](_0x4e69f7['shift']());}};_0x67b5e2(++_0x2031af);}(_0x96bf,0x1ad));var _0xf96b=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0x96bf[_0x28e74e];return _0xb45ac1;};'use strict';var moment=require(_0xf96b('0x0'));var Sequelize=require(_0xf96b('0x1'));module[_0xf96b('0x2')]={'uniqueid':{'type':Sequelize[_0xf96b('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf96b('0x4')](_0xf96b('0x5'),_0xf96b('0x6'),_0xf96b('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xf96b('0x8')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index eaf907b..503eee6 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 _0xc535=['../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','destroy','end','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','intersection','length','include','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','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5a8564,_0x501224){var _0x44b336=function(_0x2aa2c0){while(--_0x2aa2c0){_0x5a8564['push'](_0x5a8564['shift']());}};_0x44b336(++_0x501224);}(_0xc535,0x126));var _0x5c53=function(_0x3f5018,_0x2cfba6){_0x3f5018=_0x3f5018-0x0;var _0x3da6fc=_0xc535[_0x3f5018];return _0x3da6fc;};'use strict';var pdf=require(_0x5c53('0x0'));var emlformat=require(_0x5c53('0x1'));var rimraf=require(_0x5c53('0x2'));var zipdir=require(_0x5c53('0x3'));var jsonpatch=require(_0x5c53('0x4'));var rp=require(_0x5c53('0x5'));var moment=require(_0x5c53('0x6'));var BPromise=require(_0x5c53('0x7'));var Mustache=require(_0x5c53('0x8'));var util=require(_0x5c53('0x9'));var path=require(_0x5c53('0xa'));var sox=require(_0x5c53('0xb'));var csv=require(_0x5c53('0xc'));var ejs=require(_0x5c53('0xd'));var fs=require('fs');var _=require(_0x5c53('0xe'));var squel=require(_0x5c53('0xf'));var crypto=require(_0x5c53('0x10'));var jsforce=require(_0x5c53('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x5c53('0xc'));var querystring=require(_0x5c53('0x12'));var Papa=require('papaparse');var Redis=require(_0x5c53('0x13'));var authService=require(_0x5c53('0x14'));var qs=require(_0x5c53('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c53('0x16'));var logger=require(_0x5c53('0x17'))(_0x5c53('0x18'));var utils=require(_0x5c53('0x19'));var config=require(_0x5c53('0x1a'));var db=require(_0x5c53('0x1b'))['db'];function respondWithStatusCode(_0x22d248,_0x1770d1){_0x1770d1=_0x1770d1||0xcc;return function(_0xea5cd7){if(_0xea5cd7){return _0x22d248[_0x5c53('0x1c')](_0x1770d1);}return _0x22d248[_0x5c53('0x1d')](_0x1770d1)['end']();};}function respondWithResult(_0x341d20,_0x24f8ff){_0x24f8ff=_0x24f8ff||0xc8;return function(_0x584791){if(_0x584791){return _0x341d20[_0x5c53('0x1d')](_0x24f8ff)[_0x5c53('0x1e')](_0x584791);}};}function respondWithFilteredResult(_0x4e4bd2,_0x5bc8c8){return function(_0x237a12){if(_0x237a12){var _0x9be1db=_0x237a12[_0x5c53('0x1f')],_0x35c5b8=_0x5bc8c8[_0x5c53('0x20')],_0x5bfa28=_0x5bc8c8[_0x5c53('0x20')]+_0x5bc8c8[_0x5c53('0x21')],_0x9a35d1;if(_0x5bfa28>=_0x9be1db){_0x5bfa28=_0x9be1db;_0x9a35d1=0xc8;}else{_0x9a35d1=0xce;}_0x4e4bd2[_0x5c53('0x1d')](_0x9a35d1);return _0x4e4bd2[_0x5c53('0x22')]('Content-Range',_0x35c5b8+'-'+_0x5bfa28+'/'+_0x9be1db)[_0x5c53('0x1e')](_0x237a12);}return null;};}function patchUpdates(_0x5013fd){return function(_0x8f7449){try{jsonpatch[_0x5c53('0x23')](_0x8f7449,_0x5013fd,!![]);}catch(_0xb50165){return BPromise[_0x5c53('0x24')](_0xb50165);}return _0x8f7449['save']();};}function saveUpdates(_0x19d1af,_0x5e10bb){return function(_0x4c9a26){if(_0x4c9a26){return _0x4c9a26[_0x5c53('0x25')](_0x19d1af)[_0x5c53('0x26')](function(_0x22233f){return _0x22233f;});}return null;};}function removeEntity(_0x28fe49,_0x4608b6){return function(_0x1b3d0c){if(_0x1b3d0c){return _0x1b3d0c[_0x5c53('0x27')]()[_0x5c53('0x26')](function(){_0x28fe49['status'](0xcc)[_0x5c53('0x28')]();});}};}function handleEntityNotFound(_0x4019e3,_0x242b48){return function(_0x4c2b37){if(!_0x4c2b37){_0x4019e3[_0x5c53('0x1c')](0x194);}return _0x4c2b37;};}function handleError(_0x25659d,_0x9eb03){_0x9eb03=_0x9eb03||0x1f4;return function(_0x4b8b03){logger[_0x5c53('0x29')](_0x4b8b03[_0x5c53('0x2a')]);if(_0x4b8b03[_0x5c53('0x2b')]){delete _0x4b8b03['name'];}_0x25659d['status'](_0x9eb03)[_0x5c53('0x2c')](_0x4b8b03);};}exports['index']=function(_0x4312a7,_0x1aaea9){var _0x313c78={},_0x106e79={},_0x3640bc={'count':0x0,'rows':[]};var _0x350c99=_[_0x5c53('0x2d')](db[_0x5c53('0x2e')][_0x5c53('0x2f')],function(_0x6efcf0){return{'name':_0x6efcf0[_0x5c53('0x30')],'type':_0x6efcf0[_0x5c53('0x31')][_0x5c53('0x32')]};});_0x106e79[_0x5c53('0x33')]=_['map'](_0x350c99,_0x5c53('0x2b'));_0x106e79[_0x5c53('0x34')]=_[_0x5c53('0x35')](_0x4312a7[_0x5c53('0x34')]);_0x106e79[_0x5c53('0x36')]=_['intersection'](_0x106e79[_0x5c53('0x33')],_0x106e79[_0x5c53('0x34')]);_0x313c78[_0x5c53('0x37')]=_['intersection'](_0x106e79['model'],qs[_0x5c53('0x38')](_0x4312a7['query'][_0x5c53('0x38')]));_0x313c78['attributes']=_0x313c78[_0x5c53('0x37')]['length']?_0x313c78[_0x5c53('0x37')]:_0x106e79[_0x5c53('0x33')];if(!_0x4312a7[_0x5c53('0x34')][_0x5c53('0x39')](_0x5c53('0x3a'))){_0x313c78[_0x5c53('0x21')]=qs[_0x5c53('0x21')](_0x4312a7[_0x5c53('0x34')]['limit']);_0x313c78[_0x5c53('0x20')]=qs[_0x5c53('0x20')](_0x4312a7[_0x5c53('0x34')][_0x5c53('0x20')]);}_0x313c78[_0x5c53('0x3b')]=qs[_0x5c53('0x3c')](_0x4312a7[_0x5c53('0x34')][_0x5c53('0x3c')]);_0x313c78[_0x5c53('0x3d')]=qs[_0x5c53('0x36')](_[_0x5c53('0x3e')](_0x4312a7[_0x5c53('0x34')],_0x106e79['filters']),_0x350c99);if(_0x4312a7[_0x5c53('0x34')][_0x5c53('0x3f')]){_0x313c78[_0x5c53('0x3d')]=_[_0x5c53('0x40')](_0x313c78[_0x5c53('0x3d')],{'$or':_[_0x5c53('0x2d')](_0x350c99,function(_0x47fe3d){if(_0x47fe3d['type']!==_0x5c53('0x41')){var _0x248b48={};_0x248b48[_0x47fe3d[_0x5c53('0x2b')]]={'$like':'%'+_0x4312a7[_0x5c53('0x34')]['filter']+'%'};return _0x248b48;}})});}_0x313c78=_[_0x5c53('0x40')]({},_0x313c78,_0x4312a7[_0x5c53('0x42')]);var _0x21286d={'where':_0x313c78[_0x5c53('0x3d')]};return db[_0x5c53('0x2e')][_0x5c53('0x1f')](_0x21286d)[_0x5c53('0x26')](function(_0x377834){_0x3640bc['count']=_0x377834;if(_0x4312a7[_0x5c53('0x34')][_0x5c53('0x43')]){_0x313c78['include']=[{'all':!![]}];}return db[_0x5c53('0x2e')][_0x5c53('0x44')](_0x313c78);})[_0x5c53('0x26')](function(_0x5b2a3c){_0x3640bc[_0x5c53('0x45')]=_0x5b2a3c;return _0x3640bc;})[_0x5c53('0x26')](respondWithFilteredResult(_0x1aaea9,_0x313c78))[_0x5c53('0x46')](handleError(_0x1aaea9,null));};exports[_0x5c53('0x47')]=function(_0x4ce267,_0x51b0b1){var _0x494ead={'raw':!![],'where':{'id':_0x4ce267['params']['id']}},_0x13299a={};_0x13299a[_0x5c53('0x33')]=_[_0x5c53('0x35')](db['ChatTransferReport'][_0x5c53('0x2f')]);_0x13299a[_0x5c53('0x34')]=_[_0x5c53('0x35')](_0x4ce267[_0x5c53('0x34')]);_0x13299a['filters']=_[_0x5c53('0x48')](_0x13299a['model'],_0x13299a['query']);_0x494ead[_0x5c53('0x37')]=_[_0x5c53('0x48')](_0x13299a[_0x5c53('0x33')],qs[_0x5c53('0x38')](_0x4ce267[_0x5c53('0x34')]['fields']));_0x494ead['attributes']=_0x494ead[_0x5c53('0x37')][_0x5c53('0x49')]?_0x494ead['attributes']:_0x13299a['model'];if(_0x4ce267[_0x5c53('0x34')][_0x5c53('0x43')]){_0x494ead[_0x5c53('0x4a')]=[{'all':!![]}];}_0x494ead=_['merge']({},_0x494ead,_0x4ce267[_0x5c53('0x42')]);return db[_0x5c53('0x2e')][_0x5c53('0x4b')](_0x494ead)[_0x5c53('0x26')](handleEntityNotFound(_0x51b0b1,null))[_0x5c53('0x26')](respondWithResult(_0x51b0b1,null))[_0x5c53('0x46')](handleError(_0x51b0b1,null));};exports[_0x5c53('0x4c')]=function(_0x12d548,_0x571a70){return db[_0x5c53('0x2e')]['create'](_0x12d548[_0x5c53('0x4d')],{})[_0x5c53('0x26')](respondWithResult(_0x571a70,0xc9))[_0x5c53('0x46')](handleError(_0x571a70,null));};exports[_0x5c53('0x25')]=function(_0x3574dc,_0x2d71c4){if(_0x3574dc[_0x5c53('0x4d')]['id']){delete _0x3574dc[_0x5c53('0x4d')]['id'];}return db[_0x5c53('0x2e')][_0x5c53('0x4b')]({'where':{'id':_0x3574dc[_0x5c53('0x4e')]['id']}})[_0x5c53('0x26')](handleEntityNotFound(_0x2d71c4,null))[_0x5c53('0x26')](saveUpdates(_0x3574dc[_0x5c53('0x4d')],null))[_0x5c53('0x26')](respondWithResult(_0x2d71c4,null))[_0x5c53('0x46')](handleError(_0x2d71c4,null));};exports[_0x5c53('0x27')]=function(_0x349675,_0x6220d1){return db[_0x5c53('0x2e')][_0x5c53('0x4b')]({'where':{'id':_0x349675['params']['id']}})[_0x5c53('0x26')](handleEntityNotFound(_0x6220d1,null))['then'](removeEntity(_0x6220d1,null))['catch'](handleError(_0x6220d1,null));};exports[_0x5c53('0x4f')]=function(_0x3e01a9,_0x5195f7){return db[_0x5c53('0x2e')]['describe']()[_0x5c53('0x26')](respondWithResult(_0x5195f7,null))['catch'](handleError(_0x5195f7,null));}; \ No newline at end of file +var _0x509f=['fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','ChatTransferReport','rawAttributes','type','key','model','query','attributes','intersection'];(function(_0x4322c6,_0x28f126){var _0x4e7537=function(_0x3cf272){while(--_0x3cf272){_0x4322c6['push'](_0x4322c6['shift']());}};_0x4e7537(++_0x28f126);}(_0x509f,0xe5));var _0xf509=function(_0x48cc4e,_0x3fd06a){_0x48cc4e=_0x48cc4e-0x0;var _0x5d6f9c=_0x509f[_0x48cc4e];return _0x5d6f9c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf509('0x0'));var rimraf=require(_0xf509('0x1'));var zipdir=require(_0xf509('0x2'));var jsonpatch=require(_0xf509('0x3'));var rp=require(_0xf509('0x4'));var moment=require(_0xf509('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf509('0x6'));var util=require(_0xf509('0x7'));var path=require('path');var sox=require(_0xf509('0x8'));var csv=require('to-csv');var ejs=require(_0xf509('0x9'));var fs=require('fs');var _=require(_0xf509('0xa'));var squel=require(_0xf509('0xb'));var crypto=require(_0xf509('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf509('0xd'));var querystring=require(_0xf509('0xe'));var Papa=require(_0xf509('0xf'));var Redis=require(_0xf509('0x10'));var authService=require(_0xf509('0x11'));var qs=require(_0xf509('0x12'));var as=require(_0xf509('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf509('0x14'));var utils=require(_0xf509('0x15'));var config=require(_0xf509('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x394c31,_0x4ee2ef){_0x4ee2ef=_0x4ee2ef||0xcc;return function(_0x5882b6){if(_0x5882b6){return _0x394c31['sendStatus'](_0x4ee2ef);}return _0x394c31[_0xf509('0x17')](_0x4ee2ef)['end']();};}function respondWithResult(_0x3f9a03,_0x43949f){_0x43949f=_0x43949f||0xc8;return function(_0x4b7c9d){if(_0x4b7c9d){return _0x3f9a03[_0xf509('0x17')](_0x43949f)[_0xf509('0x18')](_0x4b7c9d);}};}function respondWithFilteredResult(_0x3deebd,_0x35a450){return function(_0x940d00){if(_0x940d00){var _0x140624=_0x940d00['count'],_0x33a70e=_0x35a450[_0xf509('0x19')],_0x3434d0=_0x35a450[_0xf509('0x19')]+_0x35a450[_0xf509('0x1a')],_0x56b3e8;if(_0x3434d0>=_0x140624){_0x3434d0=_0x140624;_0x56b3e8=0xc8;}else{_0x56b3e8=0xce;}_0x3deebd['status'](_0x56b3e8);return _0x3deebd['set'](_0xf509('0x1b'),_0x33a70e+'-'+_0x3434d0+'/'+_0x140624)[_0xf509('0x18')](_0x940d00);}return null;};}function patchUpdates(_0x13460f){return function(_0x5e1243){try{jsonpatch[_0xf509('0x1c')](_0x5e1243,_0x13460f,!![]);}catch(_0x10a481){return BPromise[_0xf509('0x1d')](_0x10a481);}return _0x5e1243[_0xf509('0x1e')]();};}function saveUpdates(_0x7affa4,_0xc8e21a){return function(_0x4cb34a){if(_0x4cb34a){return _0x4cb34a[_0xf509('0x1f')](_0x7affa4)[_0xf509('0x20')](function(_0x2c06a2){return _0x2c06a2;});}return null;};}function removeEntity(_0x543c81,_0x28750e){return function(_0x4c2852){if(_0x4c2852){return _0x4c2852[_0xf509('0x21')]()['then'](function(){_0x543c81[_0xf509('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4572,_0xebd646){return function(_0x38413b){if(!_0x38413b){_0x5a4572[_0xf509('0x22')](0x194);}return _0x38413b;};}function handleError(_0x3ee925,_0x4bd90f){_0x4bd90f=_0x4bd90f||0x1f4;return function(_0x33d588){logger[_0xf509('0x23')](_0x33d588['stack']);if(_0x33d588[_0xf509('0x24')]){delete _0x33d588[_0xf509('0x24')];}_0x3ee925[_0xf509('0x17')](_0x4bd90f)[_0xf509('0x25')](_0x33d588);};}exports['index']=function(_0x24a60b,_0x1fe60a){var _0x478573={},_0x18a1ce={},_0x56aef5={'count':0x0,'rows':[]};var _0x2b04b9=_[_0xf509('0x26')](db[_0xf509('0x27')][_0xf509('0x28')],function(_0x3d4e6b){return{'name':_0x3d4e6b['fieldName'],'type':_0x3d4e6b[_0xf509('0x29')][_0xf509('0x2a')]};});_0x18a1ce[_0xf509('0x2b')]=_[_0xf509('0x26')](_0x2b04b9,_0xf509('0x24'));_0x18a1ce['query']=_['keys'](_0x24a60b['query']);_0x18a1ce['filters']=_['intersection'](_0x18a1ce[_0xf509('0x2b')],_0x18a1ce[_0xf509('0x2c')]);_0x478573[_0xf509('0x2d')]=_[_0xf509('0x2e')](_0x18a1ce[_0xf509('0x2b')],qs[_0xf509('0x2f')](_0x24a60b[_0xf509('0x2c')][_0xf509('0x2f')]));_0x478573[_0xf509('0x2d')]=_0x478573[_0xf509('0x2d')][_0xf509('0x30')]?_0x478573[_0xf509('0x2d')]:_0x18a1ce[_0xf509('0x2b')];if(!_0x24a60b[_0xf509('0x2c')][_0xf509('0x31')](_0xf509('0x32'))){_0x478573['limit']=qs[_0xf509('0x1a')](_0x24a60b[_0xf509('0x2c')][_0xf509('0x1a')]);_0x478573[_0xf509('0x19')]=qs[_0xf509('0x19')](_0x24a60b[_0xf509('0x2c')][_0xf509('0x19')]);}_0x478573['order']=qs[_0xf509('0x33')](_0x24a60b['query'][_0xf509('0x33')]);_0x478573[_0xf509('0x34')]=qs[_0xf509('0x35')](_[_0xf509('0x36')](_0x24a60b['query'],_0x18a1ce[_0xf509('0x35')]),_0x2b04b9);if(_0x24a60b[_0xf509('0x2c')][_0xf509('0x37')]){_0x478573[_0xf509('0x34')]=_[_0xf509('0x38')](_0x478573[_0xf509('0x34')],{'$or':_[_0xf509('0x26')](_0x2b04b9,function(_0xd8f10a){if(_0xd8f10a[_0xf509('0x29')]!==_0xf509('0x39')){var _0x34a574={};_0x34a574[_0xd8f10a[_0xf509('0x24')]]={'$like':'%'+_0x24a60b[_0xf509('0x2c')]['filter']+'%'};return _0x34a574;}})});}_0x478573=_[_0xf509('0x38')]({},_0x478573,_0x24a60b['options']);var _0x34bd75={'where':_0x478573[_0xf509('0x34')]};return db[_0xf509('0x27')]['count'](_0x34bd75)[_0xf509('0x20')](function(_0x47bf4a){_0x56aef5[_0xf509('0x3a')]=_0x47bf4a;if(_0x24a60b[_0xf509('0x2c')][_0xf509('0x3b')]){_0x478573[_0xf509('0x3c')]=[{'all':!![]}];}return db[_0xf509('0x27')]['findAll'](_0x478573);})[_0xf509('0x20')](function(_0xfc6d66){_0x56aef5['rows']=_0xfc6d66;return _0x56aef5;})[_0xf509('0x20')](respondWithFilteredResult(_0x1fe60a,_0x478573))[_0xf509('0x3d')](handleError(_0x1fe60a,null));};exports[_0xf509('0x3e')]=function(_0x86d523,_0x3c13f8){var _0x789b06={'raw':!![],'where':{'id':_0x86d523['params']['id']}},_0xa7c444={};_0xa7c444[_0xf509('0x2b')]=_['keys'](db['ChatTransferReport'][_0xf509('0x28')]);_0xa7c444[_0xf509('0x2c')]=_[_0xf509('0x3f')](_0x86d523[_0xf509('0x2c')]);_0xa7c444[_0xf509('0x35')]=_[_0xf509('0x2e')](_0xa7c444[_0xf509('0x2b')],_0xa7c444[_0xf509('0x2c')]);_0x789b06[_0xf509('0x2d')]=_['intersection'](_0xa7c444[_0xf509('0x2b')],qs[_0xf509('0x2f')](_0x86d523[_0xf509('0x2c')][_0xf509('0x2f')]));_0x789b06[_0xf509('0x2d')]=_0x789b06[_0xf509('0x2d')][_0xf509('0x30')]?_0x789b06[_0xf509('0x2d')]:_0xa7c444[_0xf509('0x2b')];if(_0x86d523[_0xf509('0x2c')][_0xf509('0x3b')]){_0x789b06[_0xf509('0x3c')]=[{'all':!![]}];}_0x789b06=_[_0xf509('0x38')]({},_0x789b06,_0x86d523['options']);return db[_0xf509('0x27')][_0xf509('0x40')](_0x789b06)[_0xf509('0x20')](handleEntityNotFound(_0x3c13f8,null))['then'](respondWithResult(_0x3c13f8,null))[_0xf509('0x3d')](handleError(_0x3c13f8,null));};exports[_0xf509('0x41')]=function(_0x2e5609,_0xfac99c){return db['ChatTransferReport'][_0xf509('0x41')](_0x2e5609['body'],{})[_0xf509('0x20')](respondWithResult(_0xfac99c,0xc9))[_0xf509('0x3d')](handleError(_0xfac99c,null));};exports[_0xf509('0x1f')]=function(_0x513727,_0x7d51da){if(_0x513727[_0xf509('0x42')]['id']){delete _0x513727[_0xf509('0x42')]['id'];}return db[_0xf509('0x27')]['find']({'where':{'id':_0x513727['params']['id']}})[_0xf509('0x20')](handleEntityNotFound(_0x7d51da,null))[_0xf509('0x20')](saveUpdates(_0x513727['body'],null))[_0xf509('0x20')](respondWithResult(_0x7d51da,null))[_0xf509('0x3d')](handleError(_0x7d51da,null));};exports[_0xf509('0x21')]=function(_0x13b24b,_0x5e4a72){return db['ChatTransferReport']['find']({'where':{'id':_0x13b24b[_0xf509('0x43')]['id']}})[_0xf509('0x20')](handleEntityNotFound(_0x5e4a72,null))[_0xf509('0x20')](removeEntity(_0x5e4a72,null))[_0xf509('0x3d')](handleError(_0x5e4a72,null));};exports[_0xf509('0x44')]=function(_0x1b9cc6,_0x574e46){return db[_0xf509('0x27')][_0xf509('0x44')]()[_0xf509('0x20')](respondWithResult(_0x574e46,null))[_0xf509('0x3d')](handleError(_0x574e46,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index ae06850..a9570cc 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 _0x00bb=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x10316a,_0x125dc8){var _0x36ac2e=function(_0x140e35){while(--_0x140e35){_0x10316a['push'](_0x10316a['shift']());}};_0x36ac2e(++_0x125dc8);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x00bb[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[{'name':_0xb00b('0xb'),'fields':[_0xb00b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b84=['rimraf','../../config/environment','ChatTransferReport','uniqueid','lodash','util','moment','path'];(function(_0x5b4003,_0x3ab475){var _0x1f2643=function(_0x5dcd6e){while(--_0x5dcd6e){_0x5b4003['push'](_0x5b4003['shift']());}};_0x1f2643(++_0x3ab475);}(_0x4b84,0x1cc));var _0x44b8=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x4b84[_0x51fe5f];return _0x4abce9;};'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('./chatTransferReport.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x44b8('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index bb51be8..6fe8577 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 _0x352b=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','ChatTransferReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x50385c,_0x3d1e5f){var _0x3a4888=function(_0x3cb14d){while(--_0x3cb14d){_0x50385c['push'](_0x50385c['shift']());}};_0x3a4888(++_0x3d1e5f);}(_0x352b,0x1c1));var _0xb352=function(_0x545c7e,_0x2400c1){_0x545c7e=_0x545c7e-0x0;var _0x1a38ff=_0x352b[_0x545c7e];return _0x1a38ff;};'use strict';var _=require('lodash');var util=require(_0xb352('0x0'));var moment=require(_0xb352('0x1'));var BPromise=require(_0xb352('0x2'));var rs=require(_0xb352('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb352('0x4'))(_0xb352('0x5'));var config=require(_0xb352('0x6'));var jayson=require(_0xb352('0x7'));var client=jayson[_0xb352('0x8')][_0xb352('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x494308,_0x26ba3d,_0x1e79ca){return new BPromise(function(_0x77da32,_0x4ec57e){return client[_0xb352('0xa')](_0x494308,_0x1e79ca)[_0xb352('0xb')](function(_0x2dea54){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x26ba3d,_0xb352('0xc'));logger['debug'](_0xb352('0xd'),_0x26ba3d,_0xb352('0xc'),JSON[_0xb352('0xe')](_0x2dea54));if(_0x2dea54[_0xb352('0xf')]){if(_0x2dea54[_0xb352('0xf')]['code']===0x1f4){logger[_0xb352('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x26ba3d,_0x2dea54['error'][_0xb352('0x10')]);return _0x4ec57e(_0x2dea54[_0xb352('0xf')]['message']);}logger[_0xb352('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x26ba3d,_0x2dea54[_0xb352('0xf')]['message']);return _0x77da32(_0x2dea54[_0xb352('0xf')][_0xb352('0x10')]);}else{logger[_0xb352('0x11')](_0xb352('0x12'),_0x26ba3d,_0xb352('0xc'));_0x77da32(_0x2dea54[_0xb352('0x13')][_0xb352('0x10')]);}})[_0xb352('0x14')](function(_0x23f00b){logger['error'](_0xb352('0x12'),_0x26ba3d,_0x23f00b);_0x4ec57e(_0x23f00b);});});} \ No newline at end of file +var _0xeb59=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util'];(function(_0xf47939,_0x124b6a){var _0x5f1ec1=function(_0x58f724){while(--_0x58f724){_0xf47939['push'](_0xf47939['shift']());}};_0x5f1ec1(++_0x124b6a);}(_0xeb59,0x89));var _0x9eb5=function(_0x2e78e9,_0x42957c){_0x2e78e9=_0x2e78e9-0x0;var _0x35aad4=_0xeb59[_0x2e78e9];return _0x35aad4;};'use strict';var _=require('lodash');var util=require(_0x9eb5('0x0'));var moment=require(_0x9eb5('0x1'));var BPromise=require(_0x9eb5('0x2'));var rs=require(_0x9eb5('0x3'));var fs=require('fs');var Redis=require(_0x9eb5('0x4'));var db=require(_0x9eb5('0x5'))['db'];var utils=require(_0x9eb5('0x6'));var logger=require(_0x9eb5('0x7'))('rpc');var config=require(_0x9eb5('0x8'));var jayson=require(_0x9eb5('0x9'));var client=jayson[_0x9eb5('0xa')][_0x9eb5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34e93a,_0x545fc4,_0x41dd37){return new BPromise(function(_0x2bff37,_0x57fbd5){return client[_0x9eb5('0xc')](_0x34e93a,_0x41dd37)[_0x9eb5('0xd')](function(_0x5835c4){logger[_0x9eb5('0xe')](_0x9eb5('0xf'),_0x545fc4,_0x9eb5('0x10'));logger[_0x9eb5('0x11')](_0x9eb5('0x12'),_0x545fc4,_0x9eb5('0x10'),JSON['stringify'](_0x5835c4));if(_0x5835c4['error']){if(_0x5835c4[_0x9eb5('0x13')][_0x9eb5('0x14')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x545fc4,_0x5835c4['error'][_0x9eb5('0x15')]);return _0x57fbd5(_0x5835c4[_0x9eb5('0x13')][_0x9eb5('0x15')]);}logger[_0x9eb5('0x13')](_0x9eb5('0xf'),_0x545fc4,_0x5835c4['error'][_0x9eb5('0x15')]);return _0x2bff37(_0x5835c4[_0x9eb5('0x13')][_0x9eb5('0x15')]);}else{logger[_0x9eb5('0xe')](_0x9eb5('0xf'),_0x545fc4,_0x9eb5('0x10'));_0x2bff37(_0x5835c4['result'][_0x9eb5('0x15')]);}})[_0x9eb5('0x16')](function(_0x3e85f3){logger[_0x9eb5('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x545fc4,_0x3e85f3);_0x57fbd5(_0x3e85f3);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 499ba27..082d52a 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x4d4ad3,_0x59f0a0){var _0x64d9b2=function(_0x2949d1){while(--_0x2949d1){_0x4d4ad3['push'](_0x4d4ad3['shift']());}};_0x64d9b2(++_0x59f0a0);}(_0x2032,0xd9));var _0x2203=function(_0x20ebbc,_0x432fc7){_0x20ebbc=_0x20ebbc-0x0;var _0x1036b1=_0x2032[_0x20ebbc];return _0x1036b1;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 8ee6387..ae3dff5 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 _0x5549=['parse','setDataValue','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','exports','STRING','email','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','stringify','input','text','getDataValue','onlineForm'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5549,0x1f4));var _0x9554=function(_0x748161,_0x5eddd4){_0x748161=_0x748161-0x0;var _0x5daa87=_0x5549[_0x748161];return _0x5daa87;};'use strict';var Sequelize=require(_0x9554('0x0'));var rs=require(_0x9554('0x1'));module[_0x9554('0x2')]={'name':{'type':Sequelize[_0x9554('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x9554('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x9554('0x3')]},'mapKey':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0x4')},'mapKeyOffline':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9554('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x9554('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9554('0x3')],'allowNull':![],'defaultValue':_0x9554('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9554('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x9554('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x9554('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x9554('0x8')](_0x9554('0x9'),_0x9554('0xa')),'defaultValue':_0x9554('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0xb')},'offline_chat_button':{'type':Sequelize[_0x9554('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0xc')},'download_transcript':{'type':Sequelize[_0x9554('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0xd')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x9554('0xe')]},'closingQuestion':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9554('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0x10')},'noteTitle':{'type':Sequelize[_0x9554('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x9554('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0x11')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x9554('0x12')},'skipMessageButton':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0x13')},'conditionAgreement':{'type':Sequelize[_0x9554('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x9554('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9554('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9554('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x9554('0x14')},'ratingType':{'type':Sequelize[_0x9554('0x8')](_0x9554('0x15'),_0x9554('0x16')),'defaultValue':_0x9554('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x9554('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9554('0xe')],'defaultValue':function(){return JSON[_0x9554('0x17')]({'items':[{'type':_0x9554('0x18'),'variable':null,'config':{'placeholder':'name','type':_0x9554('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x9554('0x18'),'props':{'title':_0x9554('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x9554('0x1a')](_0x9554('0x1b'))?JSON[_0x9554('0x1c')](this[_0x9554('0x1a')](_0x9554('0x1b'))):{};},'set':function(_0x4356b9){return this[_0x9554('0x1d')](_0x9554('0x1b'),JSON[_0x9554('0x17')](_0x4356b9));}},'offlineForm':{'type':Sequelize[_0x9554('0xe')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x9554('0x18'),'props':{'title':_0x9554('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x9554('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x9554('0x1e')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x9554('0x1f'))?JSON[_0x9554('0x1c')](this[_0x9554('0x1a')](_0x9554('0x1f'))):{};},'set':function(_0x52946c){return this[_0x9554('0x1d')](_0x9554('0x1f'),JSON[_0x9554('0x17')](_0x52946c));}},'token':{'type':Sequelize[_0x9554('0x3')],'defaultValue':function(){return rs[_0x9554('0x20')]();}},'autoclose':{'type':Sequelize[_0x9554('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9554('0x3')]},'forwardOffline':{'type':Sequelize[_0x9554('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9554('0x3')]},'waitingTitle':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0x21')},'waitingMessage':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x9554('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0x9554('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9554('0x24')},'skipUnmanaged':{'type':Sequelize[_0x9554('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0x12')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9554('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x9554('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9554('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9554('0x25');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x9554('0x26')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0x27')},'verticalAlignment':{'type':Sequelize[_0x9554('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x9554('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9554('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9554('0x3')],'allowNull':![],'defaultValue':_0x9554('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9554('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9554('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9554('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9554('0x3')],'defaultValue':_0x9554('0x29')},'systemAvatar':{'type':Sequelize[_0x9554('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9554('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9554('0x2a'),'set':function(_0xf166cf){if(!_0xf166cf)this[_0x9554('0x1d')]('mandatoryDispositionPauseId',null);this[_0x9554('0x1d')](_0x9554('0x2b'),_0xf166cf);}},'vidaooEscalation':{'type':Sequelize[_0x9554('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9554('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1bce=['Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','input','name','getDataValue','onlineForm','parse','setDataValue','stringify','textarea','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','randomstring','STRING','address','email','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Type\x20a\x20message'];(function(_0x32ee50,_0x564493){var _0x12a1b3=function(_0x3d6bc8){while(--_0x3d6bc8){_0x32ee50['push'](_0x32ee50['shift']());}};_0x12a1b3(++_0x564493);}(_0x1bce,0x73));var _0xe1bc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1bce[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xe1bc('0x0'));var rs=require(_0xe1bc('0x1'));module['exports']={'name':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![],'unique':_0xe1bc('0x3')},'description':{'type':Sequelize[_0xe1bc('0x2')]},'mapKey':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x4')},'mapKeyOffline':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x4')},'key':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![],'defaultValue':_0xe1bc('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![],'defaultValue':_0xe1bc('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xe1bc('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xe1bc('0x8')](_0xe1bc('0x9'),'squared'),'defaultValue':_0xe1bc('0x9')},'header_online':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0xb')},'download_transcript':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xe1bc('0xc')},'defaultWhiteLabel':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xe1bc('0xd')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xe1bc('0xe')},'formSubmitSuccessMessage':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x10')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe1bc('0x11')},'closingMessageButton':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x12')},'skipMessageButton':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x13')},'conditionAgreement':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x14')},'ratingType':{'type':Sequelize[_0xe1bc('0x8')](_0xe1bc('0x15'),_0xe1bc('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xe1bc('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xe1bc('0x17'),'variable':null,'config':{'placeholder':_0xe1bc('0x18'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xe1bc('0x17'),'props':{'title':_0xe1bc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xe1bc('0x4'),'type':_0xe1bc('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe1bc('0x19')](_0xe1bc('0x1a'))?JSON[_0xe1bc('0x1b')](this[_0xe1bc('0x19')](_0xe1bc('0x1a'))):{};},'set':function(_0x16631e){return this[_0xe1bc('0x1c')](_0xe1bc('0x1a'),JSON[_0xe1bc('0x1d')](_0x16631e));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xe1bc('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xe1bc('0x4'),'type':'email'},'variable':null},{'type':_0xe1bc('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xe1bc('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0xe1bc('0x19')]('offlineForm')?JSON['parse'](this[_0xe1bc('0x19')](_0xe1bc('0x20'))):{};},'set':function(_0x345da1){return this[_0xe1bc('0x1c')](_0xe1bc('0x20'),JSON[_0xe1bc('0x1d')](_0x345da1));}},'token':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':function(){return rs[_0xe1bc('0x21')]();}},'autoclose':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xe1bc('0x2')]},'forwardOffline':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x22')},'waitingMessage':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x23')},'offlineMessageSubject':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x24')},'skipUnmanaged':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x12')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xe1bc('0xd')]},'showAgentAvatar':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xe1bc('0x2')]},'notificationTemplate':{'type':Sequelize[_0xe1bc('0xd')],'defaultValue':function(){return _0xe1bc('0x25');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xe1bc('0x26')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x27')},'verticalAlignment':{'type':Sequelize[_0xe1bc('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xe1bc('0x2')]},'customerAvatar':{'type':Sequelize[_0xe1bc('0xd')]},'showCustomerAvatar':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xe1bc('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xe1bc('0x2')],'allowNull':![],'defaultValue':_0xe1bc('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe1bc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe1bc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':_0xe1bc('0x29')},'systemAvatar':{'type':Sequelize[_0xe1bc('0xd')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe1bc('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![],'comment':_0xe1bc('0x2a'),'set':function(_0x59bc1f){if(!_0x59bc1f)this[_0xe1bc('0x1c')]('mandatoryDispositionPauseId',null);this[_0xe1bc('0x1c')](_0xe1bc('0x2b'),_0x59bc1f);}},'vidaooEscalation':{'type':Sequelize[_0xe1bc('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index f330b19..0ca6bc9 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 _0xf6de=['chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','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','Contacts','DESC','Applications','List','account','applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','x-real-port','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ContactId','interaction','ChatInteraction','spread','lastName','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','offline','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','push','some','server/files/chat/iframe.js','remote','x-real-ip','connection','remoteAddress','referer','replace','alignment','verticalAlignment','textColor','addApplications','sequelize','destroy','ChatApplication','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','ChatProactiveAction','getFields','false','getOfflineMessages','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.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','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','status','end','json','count','offset','limit','apply','reject','save','update','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','describe','addDisposition','ChatWebsiteId','Disposition','include','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','findAll','removeAnswers','sitepic','file','addAvatar','filename','addCustomerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','customerAvatar','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult'];(function(_0x2c8058,_0x32c22d){var _0x1779e2=function(_0x593a3d){while(--_0x593a3d){_0x2c8058['push'](_0x2c8058['shift']());}};_0x1779e2(++_0x32c22d);}(_0xf6de,0x1b4));var _0xef6d=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xf6de[_0x1deb03];return _0x189fe7;};'use strict';var pdf=require(_0xef6d('0x0'));var emlformat=require(_0xef6d('0x1'));var rimraf=require(_0xef6d('0x2'));var zipdir=require(_0xef6d('0x3'));var jsonpatch=require(_0xef6d('0x4'));var rp=require(_0xef6d('0x5'));var moment=require(_0xef6d('0x6'));var BPromise=require(_0xef6d('0x7'));var Mustache=require(_0xef6d('0x8'));var util=require(_0xef6d('0x9'));var path=require(_0xef6d('0xa'));var sox=require(_0xef6d('0xb'));var csv=require('to-csv');var ejs=require(_0xef6d('0xc'));var fs=require('fs');var _=require(_0xef6d('0xd'));var squel=require(_0xef6d('0xe'));var crypto=require('crypto');var jsforce=require(_0xef6d('0xf'));var deskjs=require(_0xef6d('0x10'));var toCsv=require(_0xef6d('0x11'));var querystring=require(_0xef6d('0x12'));var Papa=require(_0xef6d('0x13'));var Redis=require(_0xef6d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xef6d('0x15'));var as=require(_0xef6d('0x16'));var hardwareService=require(_0xef6d('0x17'));var logger=require(_0xef6d('0x18'))(_0xef6d('0x19'));var utils=require(_0xef6d('0x1a'));var config=require(_0xef6d('0x1b'));var db=require(_0xef6d('0x1c'))['db'];config[_0xef6d('0x1d')]=_[_0xef6d('0x1e')](config[_0xef6d('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xef6d('0x1f'))(new Redis(config[_0xef6d('0x1d')]));require(_0xef6d('0x20'))[_0xef6d('0x21')](socket);var jayson=require(_0xef6d('0x22'));var client=jayson[_0xef6d('0x23')][_0xef6d('0x24')]({'port':0x232c});var client9002=jayson[_0xef6d('0x23')][_0xef6d('0x24')]({'port':0x232a});var client9003=jayson[_0xef6d('0x23')][_0xef6d('0x24')]({'port':0x232b});function checkPasswordPattern(_0x79e751,_0x35b25f,_0x52cc81){if(_0x52cc81){var _0x5b0d24=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b0d24[_0xef6d('0x25')](_0x35b25f)){return _0x79e751;}else{throw new db['Sequelize'][(_0xef6d('0x26'))](_0xef6d('0x27'));}}else{return _0x79e751;}}function respondWithRpcPromise(_0x5ce6f9,_0x44bda,_0x34f599,_0x33d6ed){return new BPromise(function(_0x430a74,_0x457a36){var _0x4d4830=_0x33d6ed||client;return _0x4d4830[_0xef6d('0x28')](_0x5ce6f9,_0x34f599)[_0xef6d('0x29')](function(_0x549b2a){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x44bda,_0xef6d('0x2a'));logger[_0xef6d('0x2b')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x44bda,'request\x20sent',JSON[_0xef6d('0x2c')](_0x549b2a));if(_0x549b2a['error']){if(_0x549b2a[_0xef6d('0x2d')][_0xef6d('0x2e')]===0x1f4){logger[_0xef6d('0x2d')](_0xef6d('0x2f'),_0x44bda,_0x549b2a[_0xef6d('0x2d')][_0xef6d('0x30')]);return _0x457a36(_0x549b2a[_0xef6d('0x2d')][_0xef6d('0x30')]);}logger[_0xef6d('0x2d')]('ChatWebsite,\x20%s,\x20%s',_0x44bda,_0x549b2a['error'][_0xef6d('0x30')]);return _0x430a74(_0x549b2a[_0xef6d('0x2d')]['message']);}else{logger[_0xef6d('0x31')](_0xef6d('0x2f'),_0x44bda,'request\x20sent');_0x430a74(_0x549b2a[_0xef6d('0x32')]['message']);}})['catch'](function(_0x4afaca){logger[_0xef6d('0x2d')](_0xef6d('0x2f'),_0x44bda,_0x4afaca);_0x457a36(_0x4afaca);});});}function respondWithStatusCode(_0x52e830,_0x43395f){_0x43395f=_0x43395f||0xcc;return function(_0x2cb19d){if(_0x2cb19d){return _0x52e830['sendStatus'](_0x43395f);}return _0x52e830[_0xef6d('0x33')](_0x43395f)[_0xef6d('0x34')]();};}function respondWithResult(_0xfdbbe1,_0x2a69db){_0x2a69db=_0x2a69db||0xc8;return function(_0x296087){if(_0x296087){return _0xfdbbe1[_0xef6d('0x33')](_0x2a69db)[_0xef6d('0x35')](_0x296087);}};}function respondWithFilteredResult(_0x3620af,_0x578eee){return function(_0x523c9b){if(_0x523c9b){var _0x5d9655=_0x523c9b[_0xef6d('0x36')],_0x1f8f83=_0x578eee[_0xef6d('0x37')],_0x287148=_0x578eee['offset']+_0x578eee[_0xef6d('0x38')],_0x1cd1aa;if(_0x287148>=_0x5d9655){_0x287148=_0x5d9655;_0x1cd1aa=0xc8;}else{_0x1cd1aa=0xce;}_0x3620af[_0xef6d('0x33')](_0x1cd1aa);return _0x3620af['set']('Content-Range',_0x1f8f83+'-'+_0x287148+'/'+_0x5d9655)[_0xef6d('0x35')](_0x523c9b);}return null;};}function patchUpdates(_0x347490){return function(_0x181efb){try{jsonpatch[_0xef6d('0x39')](_0x181efb,_0x347490,!![]);}catch(_0x15b6a3){return BPromise[_0xef6d('0x3a')](_0x15b6a3);}return _0x181efb[_0xef6d('0x3b')]();};}function saveUpdates(_0x3c164a,_0x33c6f9){return function(_0x4192d6){if(_0x4192d6){return _0x4192d6[_0xef6d('0x3c')](_0x3c164a)['then'](function(_0x3a843b){return _0x3a843b;});}return null;};}function removeEntity(_0x388863,_0x5e97b1){return function(_0xb379df){if(_0xb379df){return _0xb379df['destroy']()[_0xef6d('0x29')](function(){var _0x22a659=_0xb379df[_0xef6d('0x3d')]({'plain':!![]});var _0x38e750=_0xef6d('0x3e');return db[_0xef6d('0x3f')]['destroy']({'where':{'type':_0x38e750,'resourceId':_0x22a659['id']}})[_0xef6d('0x29')](function(){return _0xb379df;});})[_0xef6d('0x29')](function(){_0x388863[_0xef6d('0x33')](0xcc)[_0xef6d('0x34')]();});}};}function handleEntityNotFound(_0x518e95,_0x486b1f){return function(_0x2508e3){if(!_0x2508e3){_0x518e95[_0xef6d('0x40')](0x194);}return _0x2508e3;};}function handleError(_0x3f1fc6,_0x181773){_0x181773=_0x181773||0x1f4;return function(_0x524025){logger[_0xef6d('0x2d')](_0x524025[_0xef6d('0x41')]);if(_0x524025['name']){delete _0x524025[_0xef6d('0x42')];}_0x3f1fc6[_0xef6d('0x33')](_0x181773)[_0xef6d('0x43')](_0x524025);};}exports['index']=function(_0xef62cd,_0x1d0eba){var _0x5e4483={'include':[{'model':db[_0xef6d('0x44')],'as':_0xef6d('0x45')}]},_0x24d41f={},_0x321187={'count':0x0,'rows':[]};var _0x224933=_[_0xef6d('0x46')](db[_0xef6d('0x47')][_0xef6d('0x48')],function(_0x5cf381){return{'name':_0x5cf381['fieldName'],'type':_0x5cf381[_0xef6d('0x49')]['key']};});_0x24d41f[_0xef6d('0x4a')]=_[_0xef6d('0x46')](_0x224933,_0xef6d('0x42'));_0x24d41f[_0xef6d('0x4b')]=_[_0xef6d('0x4c')](_0xef62cd[_0xef6d('0x4b')]);_0x24d41f['filters']=_['intersection'](_0x24d41f[_0xef6d('0x4a')],_0x24d41f[_0xef6d('0x4b')]);_0x5e4483[_0xef6d('0x4d')]=_[_0xef6d('0x4e')](_0x24d41f['model'],qs[_0xef6d('0x4f')](_0xef62cd[_0xef6d('0x4b')][_0xef6d('0x4f')]));_0x5e4483[_0xef6d('0x4d')]=_0x5e4483[_0xef6d('0x4d')]['length']?_0x5e4483[_0xef6d('0x4d')]:_0x24d41f[_0xef6d('0x4a')];if(!_0xef62cd[_0xef6d('0x4b')][_0xef6d('0x50')](_0xef6d('0x51'))){_0x5e4483[_0xef6d('0x38')]=qs[_0xef6d('0x38')](_0xef62cd[_0xef6d('0x4b')][_0xef6d('0x38')]);_0x5e4483[_0xef6d('0x37')]=qs[_0xef6d('0x37')](_0xef62cd[_0xef6d('0x4b')]['offset']);}_0x5e4483[_0xef6d('0x52')]=qs[_0xef6d('0x53')](_0xef62cd['query'][_0xef6d('0x53')]);_0x5e4483['where']=qs[_0xef6d('0x54')](_[_0xef6d('0x55')](_0xef62cd[_0xef6d('0x4b')],_0x24d41f['filters']),_0x224933);if(_0xef62cd[_0xef6d('0x4b')][_0xef6d('0x56')]){_0x5e4483[_0xef6d('0x57')]=_['merge'](_0x5e4483['where'],{'$or':_[_0xef6d('0x46')](_0x224933,function(_0x40c767){if(_0x40c767[_0xef6d('0x49')]!==_0xef6d('0x58')){var _0x515835={};_0x515835[_0x40c767[_0xef6d('0x42')]]={'$like':'%'+_0xef62cd[_0xef6d('0x4b')][_0xef6d('0x56')]+'%'};return _0x515835;}})});}_0x5e4483=_[_0xef6d('0x59')]({},_0x5e4483,_0xef62cd[_0xef6d('0x5a')]);var _0x21c571={'where':_0x5e4483[_0xef6d('0x57')]};return db[_0xef6d('0x47')][_0xef6d('0x36')](_0x21c571)[_0xef6d('0x29')](function(_0x4d8446){_0x321187[_0xef6d('0x36')]=_0x4d8446;if(_0xef62cd[_0xef6d('0x4b')][_0xef6d('0x5b')]){_0x5e4483['include']=[{'all':!![]}];}return db[_0xef6d('0x47')]['findAll'](_0x5e4483);})[_0xef6d('0x29')](function(_0x1f72c2){_0x321187[_0xef6d('0x5c')]=_0x1f72c2;return _0x321187;})[_0xef6d('0x29')](respondWithFilteredResult(_0x1d0eba,_0x5e4483))[_0xef6d('0x5d')](handleError(_0x1d0eba,null));};exports[_0xef6d('0x5e')]=function(_0x19d1b6,_0x37ac31){var _0x2a90c8={'raw':![],'where':{'id':_0x19d1b6[_0xef6d('0x5f')]['id']},'include':[{'model':db[_0xef6d('0x44')],'as':_0xef6d('0x45')}]},_0x20a5f0={};_0x20a5f0[_0xef6d('0x4a')]=_[_0xef6d('0x4c')](db[_0xef6d('0x47')]['rawAttributes']);_0x20a5f0['query']=_['keys'](_0x19d1b6[_0xef6d('0x4b')]);_0x20a5f0[_0xef6d('0x54')]=_[_0xef6d('0x4e')](_0x20a5f0[_0xef6d('0x4a')],_0x20a5f0[_0xef6d('0x4b')]);_0x2a90c8[_0xef6d('0x4d')]=_[_0xef6d('0x4e')](_0x20a5f0[_0xef6d('0x4a')],qs[_0xef6d('0x4f')](_0x19d1b6[_0xef6d('0x4b')][_0xef6d('0x4f')]));_0x2a90c8[_0xef6d('0x4d')]=_0x2a90c8[_0xef6d('0x4d')][_0xef6d('0x60')]?_0x2a90c8[_0xef6d('0x4d')]:_0x20a5f0[_0xef6d('0x4a')];if(_0x19d1b6['query'][_0xef6d('0x5b')]){_0x2a90c8['include']=[{'all':!![]}];}_0x2a90c8=_[_0xef6d('0x59')]({},_0x2a90c8,_0x19d1b6['options']);return db['ChatWebsite']['find'](_0x2a90c8)['then'](handleEntityNotFound(_0x37ac31,null))[_0xef6d('0x29')](respondWithResult(_0x37ac31,null))[_0xef6d('0x5d')](handleError(_0x37ac31,null));};exports['create']=function(_0x4c4157,_0x3b07d0){return db['ChatWebsite'][_0xef6d('0x61')](_0x4c4157[_0xef6d('0x62')],{})['then'](function(_0x24c8cd){var _0x53f3b8=_0x4c4157[_0xef6d('0x63')][_0xef6d('0x3d')]({'plain':!![]});if(!_0x53f3b8)throw new Error(_0xef6d('0x64'));if(_0x53f3b8[_0xef6d('0x65')]===_0xef6d('0x63')){var _0x315d76=_0x24c8cd[_0xef6d('0x3d')]({'plain':!![]});var _0x26cd62=_0xef6d('0x3e');return db['UserProfileSection'][_0xef6d('0x66')]({'where':{'name':_0x26cd62,'userProfileId':_0x53f3b8['userProfileId']},'raw':!![]})[_0xef6d('0x29')](function(_0x192663){if(_0x192663&&_0x192663[_0xef6d('0x67')]===0x0){return db['UserProfileResource'][_0xef6d('0x61')]({'name':_0x315d76[_0xef6d('0x42')],'resourceId':_0x315d76['id'],'type':_0x192663['name'],'sectionId':_0x192663['id']},{})[_0xef6d('0x29')](function(){return _0x24c8cd;});}else{return _0x24c8cd;}})[_0xef6d('0x5d')](function(_0x10a375){logger[_0xef6d('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10a375);throw _0x10a375;});}return _0x24c8cd;})[_0xef6d('0x29')](respondWithResult(_0x3b07d0,0xc9))[_0xef6d('0x5d')](handleError(_0x3b07d0,null));};exports[_0xef6d('0x3c')]=function(_0x5dee7b,_0x48b53b){if(_0x5dee7b[_0xef6d('0x62')]['id']){delete _0x5dee7b['body']['id'];}return db[_0xef6d('0x47')][_0xef6d('0x66')]({'where':{'id':_0x5dee7b[_0xef6d('0x5f')]['id']},'include':[{'model':db[_0xef6d('0x44')],'as':_0xef6d('0x45')}]})[_0xef6d('0x29')](handleEntityNotFound(_0x48b53b,null))[_0xef6d('0x29')](saveUpdates(_0x5dee7b[_0xef6d('0x62')],null))[_0xef6d('0x29')](respondWithResult(_0x48b53b,null))['catch'](handleError(_0x48b53b,null));};exports['destroy']=function(_0x521770,_0x434eec){return db[_0xef6d('0x47')][_0xef6d('0x66')]({'where':{'id':_0x521770[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x434eec,null))[_0xef6d('0x29')](removeEntity(_0x434eec,null))[_0xef6d('0x5d')](handleError(_0x434eec,null));};exports['describe']=function(_0xc49e43,_0x170838){return db[_0xef6d('0x47')][_0xef6d('0x68')]()[_0xef6d('0x29')](respondWithResult(_0x170838,null))[_0xef6d('0x5d')](handleError(_0x170838,null));};exports[_0xef6d('0x69')]=function(_0x283113,_0x3d4f79,_0x1ae502){if(_0x283113[_0xef6d('0x62')]['id']){delete _0x283113['body']['id'];}return db[_0xef6d('0x47')][_0xef6d('0x66')]({'where':{'id':_0x283113['params']['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x3d4f79,null))[_0xef6d('0x29')](function(_0x1a9d5f){if(_0x1a9d5f){_0x283113[_0xef6d('0x62')][_0xef6d('0x6a')]=_0x1a9d5f['id'];return db[_0xef6d('0x6b')]['create'](_0x283113[_0xef6d('0x62')]);}})[_0xef6d('0x29')](respondWithResult(_0x3d4f79,null))[_0xef6d('0x5d')](handleError(_0x3d4f79,null));};exports['getDispositions']=function(_0x254b1b,_0x8450c7,_0x5d3c2d){var _0x3cb749={'raw':![],'where':{}};var _0x5c0704={};var _0x230629={'count':0x0,'rows':[]};return db[_0xef6d('0x47')]['findOne']({'where':{'id':_0x254b1b[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x8450c7,null))['then'](function(_0x4069a4){if(_0x4069a4){_0x5c0704[_0xef6d('0x4a')]=_[_0xef6d('0x4c')](db[_0xef6d('0x6b')][_0xef6d('0x48')]);_0x5c0704[_0xef6d('0x4b')]=_[_0xef6d('0x4c')](_0x254b1b[_0xef6d('0x4b')]);_0x5c0704['filters']=_[_0xef6d('0x4e')](_0x5c0704[_0xef6d('0x4a')],_0x5c0704['query']);_0x3cb749[_0xef6d('0x4d')]=_[_0xef6d('0x4e')](_0x5c0704[_0xef6d('0x4a')],qs[_0xef6d('0x4f')](_0x254b1b[_0xef6d('0x4b')][_0xef6d('0x4f')]));_0x3cb749[_0xef6d('0x4d')]=_0x3cb749[_0xef6d('0x4d')]['length']?_0x3cb749['attributes']:_0x5c0704['model'];if(!_0x254b1b[_0xef6d('0x4b')][_0xef6d('0x50')](_0xef6d('0x51'))){_0x3cb749[_0xef6d('0x38')]=qs[_0xef6d('0x38')](_0x254b1b['query'][_0xef6d('0x38')]);_0x3cb749[_0xef6d('0x37')]=qs[_0xef6d('0x37')](_0x254b1b[_0xef6d('0x4b')][_0xef6d('0x37')]);}_0x3cb749[_0xef6d('0x52')]=qs['sort'](_0x254b1b['query'][_0xef6d('0x53')]);_0x3cb749[_0xef6d('0x57')]=qs[_0xef6d('0x54')](_[_0xef6d('0x55')](_0x254b1b[_0xef6d('0x4b')],_0x5c0704[_0xef6d('0x54')]));_0x3cb749['where'][_0xef6d('0x6a')]=_0x4069a4['id'];if(_0x254b1b['query']['filter']){_0x3cb749[_0xef6d('0x57')]=_[_0xef6d('0x59')](_0x3cb749['where'],{'$or':_[_0xef6d('0x46')](_0x3cb749[_0xef6d('0x4d')],function(_0x3f237a){var _0x324533={};_0x324533[_0x3f237a]={'$like':'%'+_0x254b1b[_0xef6d('0x4b')][_0xef6d('0x56')]+'%'};return _0x324533;})});}_0x3cb749=_[_0xef6d('0x59')]({},_0x3cb749,_0x254b1b[_0xef6d('0x5a')]);return db[_0xef6d('0x6b')][_0xef6d('0x36')]({'where':_0x3cb749['where']})[_0xef6d('0x29')](function(_0x4f80ab){_0x230629[_0xef6d('0x36')]=_0x4f80ab;if(_0x254b1b[_0xef6d('0x4b')][_0xef6d('0x5b')]){_0x3cb749[_0xef6d('0x6c')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3cb749);})['then'](function(_0x33b7c2){_0x230629['rows']=_0x33b7c2;return _0x230629;});}})[_0xef6d('0x29')](respondWithFilteredResult(_0x8450c7,_0x3cb749))['catch'](handleError(_0x8450c7,null));};exports[_0xef6d('0x6d')]=function(_0x2970b2,_0x585f63,_0x294651){return db[_0xef6d('0x47')][_0xef6d('0x66')]({'where':{'id':_0x2970b2[_0xef6d('0x5f')]['id']}})['then'](handleEntityNotFound(_0x585f63,null))['then'](function(_0x587b54){if(_0x587b54){return _0x587b54[_0xef6d('0x6d')](_0x2970b2['query'][_0xef6d('0x6e')]);}})[_0xef6d('0x29')](respondWithStatusCode(_0x585f63,null))['catch'](handleError(_0x585f63,null));};exports[_0xef6d('0x6f')]=function(_0x248010,_0x5a5057,_0x1359ab){if(_0x248010[_0xef6d('0x62')]['id']){delete _0x248010['body']['id'];}return db[_0xef6d('0x47')]['find']({'where':{'id':_0x248010[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x5a5057,null))['then'](function(_0x2c060a){if(_0x2c060a){_0x248010[_0xef6d('0x62')][_0xef6d('0x6a')]=_0x2c060a['id'];return db['CannedAnswer'][_0xef6d('0x61')](_0x248010[_0xef6d('0x62')]);}})[_0xef6d('0x29')](respondWithResult(_0x5a5057,null))[_0xef6d('0x5d')](handleError(_0x5a5057,null));};exports[_0xef6d('0x70')]=function(_0x11e192,_0x578d0f,_0x37ca9a){var _0x2908f6={'raw':![],'where':{}};var _0x56d66f={};var _0x1c2e1b={'count':0x0,'rows':[]};return db[_0xef6d('0x47')][_0xef6d('0x71')]({'where':{'id':_0x11e192[_0xef6d('0x5f')]['id']}})['then'](handleEntityNotFound(_0x578d0f,null))[_0xef6d('0x29')](function(_0x2ddf63){if(_0x2ddf63){_0x56d66f[_0xef6d('0x4a')]=_['keys'](db['CannedAnswer'][_0xef6d('0x48')]);_0x56d66f[_0xef6d('0x4b')]=_['keys'](_0x11e192[_0xef6d('0x4b')]);_0x56d66f[_0xef6d('0x54')]=_['intersection'](_0x56d66f[_0xef6d('0x4a')],_0x56d66f[_0xef6d('0x4b')]);_0x2908f6['attributes']=_[_0xef6d('0x4e')](_0x56d66f['model'],qs['fields'](_0x11e192[_0xef6d('0x4b')]['fields']));_0x2908f6[_0xef6d('0x4d')]=_0x2908f6[_0xef6d('0x4d')][_0xef6d('0x60')]?_0x2908f6['attributes']:_0x56d66f['model'];if(!_0x11e192[_0xef6d('0x4b')][_0xef6d('0x50')](_0xef6d('0x51'))){_0x2908f6[_0xef6d('0x38')]=qs[_0xef6d('0x38')](_0x11e192[_0xef6d('0x4b')][_0xef6d('0x38')]);_0x2908f6[_0xef6d('0x37')]=qs['offset'](_0x11e192[_0xef6d('0x4b')][_0xef6d('0x37')]);}_0x2908f6[_0xef6d('0x52')]=qs[_0xef6d('0x53')](_0x11e192[_0xef6d('0x4b')][_0xef6d('0x53')]);_0x2908f6[_0xef6d('0x57')]=qs[_0xef6d('0x54')](_[_0xef6d('0x55')](_0x11e192[_0xef6d('0x4b')],_0x56d66f[_0xef6d('0x54')]));_0x2908f6[_0xef6d('0x57')][_0xef6d('0x6a')]=_0x2ddf63['id'];if(_0x11e192[_0xef6d('0x4b')]['filter']){_0x2908f6[_0xef6d('0x57')]=_[_0xef6d('0x59')](_0x2908f6[_0xef6d('0x57')],{'$or':_['map'](_0x2908f6[_0xef6d('0x4d')],function(_0x525593){var _0xa0381e={};_0xa0381e[_0x525593]={'$like':'%'+_0x11e192[_0xef6d('0x4b')]['filter']+'%'};return _0xa0381e;})});}_0x2908f6=_[_0xef6d('0x59')]({},_0x2908f6,_0x11e192['options']);return db[_0xef6d('0x72')][_0xef6d('0x36')]({'where':_0x2908f6[_0xef6d('0x57')]})[_0xef6d('0x29')](function(_0x476d55){_0x1c2e1b[_0xef6d('0x36')]=_0x476d55;if(_0x11e192[_0xef6d('0x4b')][_0xef6d('0x5b')]){_0x2908f6['include']=[{'all':!![]}];}return db[_0xef6d('0x72')][_0xef6d('0x73')](_0x2908f6);})[_0xef6d('0x29')](function(_0x6e0117){_0x1c2e1b[_0xef6d('0x5c')]=_0x6e0117;return _0x1c2e1b;});}})[_0xef6d('0x29')](respondWithFilteredResult(_0x578d0f,_0x2908f6))[_0xef6d('0x5d')](handleError(_0x578d0f,null));};exports['removeAnswers']=function(_0x5f0587,_0x11b30c,_0x51488d){return db[_0xef6d('0x47')]['find']({'where':{'id':_0x5f0587[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x11b30c,null))[_0xef6d('0x29')](function(_0x190ded){if(_0x190ded){return _0x190ded[_0xef6d('0x74')](_0x5f0587[_0xef6d('0x4b')][_0xef6d('0x6e')]);}})['then'](respondWithStatusCode(_0x11b30c,null))[_0xef6d('0x5d')](handleError(_0x11b30c,null));};exports['addLogo']=function(_0x518b71,_0x33a44b,_0x7b057d){_0x518b71['body'][_0xef6d('0x75')]=_0x518b71[_0xef6d('0x76')]['filename'];return db['ChatWebsite'][_0xef6d('0x66')]({'where':{'id':_0x518b71['params']['id']}})['then'](handleEntityNotFound(_0x33a44b,null))[_0xef6d('0x29')](saveUpdates(_0x518b71[_0xef6d('0x62')],null))['then'](respondWithResult(_0x33a44b,null))[_0xef6d('0x5d')](handleError(_0x33a44b,null));};exports[_0xef6d('0x77')]=function(_0x85cd14,_0x427b0c,_0x3aeca4){_0x85cd14[_0xef6d('0x62')]['agentAvatar']=_0x85cd14[_0xef6d('0x76')][_0xef6d('0x78')];return db['ChatWebsite']['find']({'where':{'id':_0x85cd14[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x427b0c,null))[_0xef6d('0x29')](saveUpdates(_0x85cd14[_0xef6d('0x62')],null))[_0xef6d('0x29')](respondWithResult(_0x427b0c,null))[_0xef6d('0x5d')](handleError(_0x427b0c,null));};exports[_0xef6d('0x79')]=function(_0x3bf1b3,_0x3cbe2f,_0x23adf5){_0x3bf1b3[_0xef6d('0x62')]['customerAvatar']=_0x3bf1b3[_0xef6d('0x76')][_0xef6d('0x78')];return db[_0xef6d('0x47')][_0xef6d('0x66')]({'where':{'id':_0x3bf1b3[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x3cbe2f,null))[_0xef6d('0x29')](saveUpdates(_0x3bf1b3[_0xef6d('0x62')],null))['then'](respondWithResult(_0x3cbe2f,null))['catch'](handleError(_0x3cbe2f,null));};exports[_0xef6d('0x7a')]=function(_0x2e0d8b,_0xb62a6c,_0x4400f7){_0x2e0d8b[_0xef6d('0x62')][_0xef6d('0x7b')]=_0x2e0d8b[_0xef6d('0x76')][_0xef6d('0x78')];return db[_0xef6d('0x47')]['find']({'where':{'id':_0x2e0d8b[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0xb62a6c,null))[_0xef6d('0x29')](saveUpdates(_0x2e0d8b[_0xef6d('0x62')],null))[_0xef6d('0x29')](respondWithResult(_0xb62a6c,null))[_0xef6d('0x5d')](handleError(_0xb62a6c,null));};exports['getLogo']=function(_0x167ec0,_0xca75d4,_0x4aa535){var _0x50ea95=path[_0xef6d('0x7c')](config[_0xef6d('0x7d')],_0xef6d('0x7e'));var _0x2419fe={'where':{'id':_0x167ec0[_0xef6d('0x5f')]['id']},'attributes':['id',_0xef6d('0x75')],'raw':!![]};var _0x415bcf=![];return require(_0xef6d('0x7f'))[_0xef6d('0x80')]()[_0xef6d('0x29')](function(_0x5c5320){if(_0x5c5320){_0x415bcf=_0x5c5320[_0xef6d('0x81')];}})[_0xef6d('0x29')](function(){return db[_0xef6d('0x47')]['find'](_0x2419fe);})[_0xef6d('0x29')](handleEntityNotFound(_0xca75d4,null))[_0xef6d('0x29')](function(_0x1e84a2){if(_0x1e84a2){if(!_[_0xef6d('0x82')](_0x1e84a2[_0xef6d('0x75')])){if(fs['existsSync'](path[_0xef6d('0x7c')](config[_0xef6d('0x7d')],_0xef6d('0x83'),_0x1e84a2['sitepic']))&&_0x415bcf){_0x50ea95=path[_0xef6d('0x7c')](config['root'],_0xef6d('0x83'),_0x1e84a2[_0xef6d('0x75')]);}}return _0xca75d4[_0xef6d('0x84')](_0x50ea95);}})[_0xef6d('0x5d')](handleError(_0xca75d4,null));};exports[_0xef6d('0x85')]=function(_0x31189f,_0x5b4663,_0x656a6c){var _0x5583df=path[_0xef6d('0x7c')](config[_0xef6d('0x7d')],_0xef6d('0x86'));var _0x436fa0={'where':{'id':_0x31189f[_0xef6d('0x5f')]['id']},'attributes':['id',_0xef6d('0x87')],'raw':!![]};return db[_0xef6d('0x47')][_0xef6d('0x66')](_0x436fa0)[_0xef6d('0x29')](handleEntityNotFound(_0x5b4663,null))[_0xef6d('0x29')](function(_0x15f533){if(_0x15f533){if(!_[_0xef6d('0x82')](_0x15f533[_0xef6d('0x87')])){if(fs['existsSync'](path['join'](config[_0xef6d('0x7d')],_0xef6d('0x88'),_0x15f533['agentAvatar']))){_0x5583df=path[_0xef6d('0x7c')](config[_0xef6d('0x7d')],'server/files/images/avatars/',_0x15f533['agentAvatar']);}}return _0x5b4663[_0xef6d('0x84')](_0x5583df);}})[_0xef6d('0x5d')](handleError(_0x5b4663,null));};exports[_0xef6d('0x89')]=function(_0x2af48e,_0x2d8a6e,_0x19a3c3){var _0x5aa494=path[_0xef6d('0x7c')](config[_0xef6d('0x7d')],'server/files/images/avatars/customer_avatar.png');var _0x2c8983={'where':{'id':_0x2af48e[_0xef6d('0x5f')]['id']},'attributes':['id',_0xef6d('0x8a'),_0xef6d('0x8b')],'raw':!![]};return db['ChatWebsite']['find'](_0x2c8983)[_0xef6d('0x29')](handleEntityNotFound(_0x2d8a6e,null))['then'](function(_0xfaf613){if(_0xfaf613){if(!_[_0xef6d('0x82')](_0xfaf613['customerAvatar'])){if(fs[_0xef6d('0x8c')](path[_0xef6d('0x7c')](config[_0xef6d('0x7d')],_0xef6d('0x88'),_0xfaf613[_0xef6d('0x8a')]))&&_0xfaf613[_0xef6d('0x8b')]){_0x5aa494=path[_0xef6d('0x7c')](config['root'],_0xef6d('0x88'),_0xfaf613['customerAvatar']);}}return _0x2d8a6e[_0xef6d('0x84')](_0x5aa494);}})[_0xef6d('0x5d')](handleError(_0x2d8a6e,null));};exports[_0xef6d('0x8d')]=function(_0x586576,_0x722469,_0x44d0c1){var _0x333954=path[_0xef6d('0x7c')](config[_0xef6d('0x7d')],_0xef6d('0x8e'));var _0x245096={'where':{'id':_0x586576[_0xef6d('0x5f')]['id']},'attributes':['id',_0xef6d('0x7b')],'raw':!![]};return db[_0xef6d('0x47')][_0xef6d('0x66')](_0x245096)[_0xef6d('0x29')](handleEntityNotFound(_0x722469,null))[_0xef6d('0x29')](function(_0x317a73){if(_0x317a73){if(!_[_0xef6d('0x82')](_0x317a73[_0xef6d('0x7b')])){if(fs[_0xef6d('0x8c')](path[_0xef6d('0x7c')](config[_0xef6d('0x7d')],_0xef6d('0x88'),_0x317a73[_0xef6d('0x7b')]))){_0x333954=path[_0xef6d('0x7c')](config['root'],_0xef6d('0x88'),_0x317a73[_0xef6d('0x7b')]);}}return _0x722469[_0xef6d('0x84')](_0x333954);}})[_0xef6d('0x5d')](handleError(_0x722469,null));};exports['notify']=function(_0x43dfd6,_0x451b9e,_0x68550f){var _0x2b1794=require(_0xef6d('0x8f'));var _0x501d8d=new _0x2b1794();var _0x5ccc75=_0x501d8d[_0xef6d('0x90')](_0x43dfd6[_0xef6d('0x91')][_0xef6d('0x92')])[_0xef6d('0x93')]();var _0x20a269={'body':_0x43dfd6['body'],'channel':_0xef6d('0x94')};var _0x590832=[];var _0x3a8bf5=[];var _0x2cf016={};var _0x29721c=![];return db[_0xef6d('0x95')][_0xef6d('0x68')]()[_0xef6d('0x29')](function(_0x365885){if(!_0x365885){throw new db[(_0xef6d('0x96'))][(_0xef6d('0x26'))](_0xef6d('0x97'));}_0x590832=_[_0xef6d('0x98')](_['keys'](_0x365885),[_0xef6d('0x99'),_0xef6d('0x9a')]);_0x3a8bf5=_['difference'](_[_0xef6d('0x4c')](_0x365885),[_0xef6d('0x99'),'updatedAt',_0xef6d('0x9b'),_0xef6d('0x9c')]);if(_0x43dfd6['body']['id']){delete _0x43dfd6[_0xef6d('0x62')]['id'];}if(_[_0xef6d('0x82')](_0x43dfd6[_0xef6d('0x62')][_0xef6d('0x9d')])){throw new db[(_0xef6d('0x96'))][(_0xef6d('0x26'))](_0xef6d('0x9e'));}if(_[_0xef6d('0x82')](_0x43dfd6[_0xef6d('0x62')]['body'])||_0x43dfd6['body'][_0xef6d('0x62')]===''){throw new db['Sequelize'][(_0xef6d('0x26'))](_0xef6d('0x9f'));}if(_[_0xef6d('0x82')](_0x43dfd6['body']['mapKey'])){throw new db[(_0xef6d('0x96'))][(_0xef6d('0x26'))](_0xef6d('0xa0')+_0x3a8bf5);}if(!_[_0xef6d('0xa1')](_0x3a8bf5,_0x43dfd6['body'][_0xef6d('0xa2')])){throw new db['Sequelize']['ValidationError'](_0xef6d('0xa3')+_0x3a8bf5);}_0x2cf016[_0x43dfd6['body'][_0xef6d('0xa2')]]=_0x43dfd6[_0xef6d('0x62')][_0xef6d('0x9d')];})[_0xef6d('0x29')](function(){return db['ChatWebsite'][_0xef6d('0x66')]({'where':{'id':_0x43dfd6[_0xef6d('0x5f')]['id']},'include':[{'model':db[_0xef6d('0xa4')],'as':'List','include':[{'model':db[_0xef6d('0x95')],'as':_0xef6d('0xa5'),'where':_0x2cf016,'limit':0x1,'order':[[_0xef6d('0x9a'),_0xef6d('0xa6')]]}]},{'model':db['ChatApplication'],'as':_0xef6d('0xa7')}]});})['then'](handleEntityNotFound(_0x451b9e,null))[_0xef6d('0x29')](function(_0x530d0e){if(_0x530d0e&&_0x530d0e[_0xef6d('0xa8')]){_0x20a269[_0xef6d('0xa9')]=_0x530d0e;_0x20a269[_0xef6d('0xaa')]=_0x530d0e['Applications'];_0x20a269[_0xef6d('0xab')]=_0x530d0e[_0xef6d('0xa8')];_0x20a269['applications']=_[_0xef6d('0xac')](_0x20a269[_0xef6d('0xaa')],[_0xef6d('0xad')],[_0xef6d('0xae')]);if(_0x20a269[_0xef6d('0xa9')]['Applications']){delete _0x20a269[_0xef6d('0xa9')][_0xef6d('0xa7')];}if(_0x20a269['account']['List']&&_0x20a269[_0xef6d('0xa9')][_0xef6d('0xa8')]['Contacts'][_0xef6d('0x60')]){return _0x20a269[_0xef6d('0xa9')][_0xef6d('0xa8')][_0xef6d('0xa5')][0x0];}var _0x26c172=_[_0xef6d('0x1e')](_0x43dfd6[_0xef6d('0x62')],{'firstName':_0x43dfd6['body'][_0xef6d('0x9d')],'ListId':_0x530d0e[_0xef6d('0x9c')]});_0x26c172[_0x43dfd6[_0xef6d('0x62')][_0xef6d('0xa2')]]=_0x43dfd6[_0xef6d('0x62')]['from'];return db['CmContact'][_0xef6d('0x61')](_0x26c172,{'fields':_0x590832,'raw':!![]});}})[_0xef6d('0x29')](handleEntityNotFound(_0x451b9e,null))[_0xef6d('0x29')](function(_0x42c364){_0x20a269[_0xef6d('0xaf')]=_0x42c364;var _0x3474f1=_0x43dfd6[_0xef6d('0x62')][_0xef6d('0xb0')];if(_0x43dfd6[_0xef6d('0x91')]['cf-connecting-ip']){_0x3474f1=_0x43dfd6['headers'][_0xef6d('0xb1')];}else if(_0x43dfd6[_0xef6d('0x91')]['x-forwarded-for']){_0x3474f1=_[_0xef6d('0xb2')](_0x43dfd6[_0xef6d('0x91')][_0xef6d('0xb3')][_0xef6d('0xb4')](','));}if(_0x42c364){var _0x2ba56d={'ContactId':_0x42c364['id'],'ChatWebsiteId':_0x43dfd6[_0xef6d('0x5f')]['id'],'from':(_0x42c364[_0xef6d('0xb5')]||'')+'\x20'+(_0x42c364['lastName']||''),'customerIp':_0x3474f1,'customerPort':_0x43dfd6[_0xef6d('0x91')][_0xef6d('0xb6')]?_0x43dfd6[_0xef6d('0x91')][_0xef6d('0xb6')]:null,'referer':_0x43dfd6['body']['referer'],'browserName':_0x5ccc75[_0xef6d('0xb7')][_0xef6d('0x42')]&&_0x5ccc75[_0xef6d('0xb7')][_0xef6d('0xb8')]?util[_0xef6d('0xb9')]('%s\x20%s',_0x5ccc75[_0xef6d('0xb7')][_0xef6d('0x42')],_0x5ccc75[_0xef6d('0xb7')][_0xef6d('0xb8')]):_0xef6d('0xba'),'browserVersion':_0x5ccc75[_0xef6d('0xb7')][_0xef6d('0xb8')]||_0xef6d('0xba'),'osName':util[_0xef6d('0xb9')](_0xef6d('0xbb'),_0x5ccc75['os'][_0xef6d('0x42')],_0x5ccc75['os']['version']),'osVersion':_0x5ccc75['os'][_0xef6d('0xb8')],'deviceModel':_0x5ccc75[_0xef6d('0xbc')][_0xef6d('0x4a')]&&_0x5ccc75[_0xef6d('0xbc')][_0xef6d('0xbd')]?util['format'](_0xef6d('0xbe'),_0x5ccc75[_0xef6d('0xbc')][_0xef6d('0x4a')],_0x5ccc75['device']['vendor'],_0x5ccc75[_0xef6d('0xbc')]['type']):null,'deviceVendor':_0x5ccc75[_0xef6d('0xbc')]['vendor'],'deviceType':_0x5ccc75[_0xef6d('0xbc')][_0xef6d('0x49')],'formData':JSON[_0xef6d('0x2c')](_0x43dfd6['body'])};var _0x1755c0={'ChatWebsiteId':_0x43dfd6[_0xef6d('0x5f')]['id'],'closed':![]};if(_0x43dfd6[_0xef6d('0x62')][_0xef6d('0xbf')]){_0x1755c0[_0xef6d('0xbf')]=_0x43dfd6[_0xef6d('0x62')][_0xef6d('0xbf')];return db['ChatInteraction'][_0xef6d('0x66')]({'where':_0x1755c0})[_0xef6d('0x29')](function(_0x2e2953){if(_0x2e2953){return[_0x2e2953,![]];}_0x2ba56d[_0xef6d('0xbf')]=_0x43dfd6[_0xef6d('0x62')][_0xef6d('0xbf')];_0x2ba56d[_0xef6d('0xc0')]=_0x43dfd6[_0xef6d('0x62')]['externalUrl'];return db['ChatInteraction'][_0xef6d('0x61')](_0x2ba56d)['then'](function(_0x43647c){return[_0x43647c,!![]];});});}_0x1755c0[_0xef6d('0xc1')]=_0x42c364['id'];if(_0x43dfd6[_0xef6d('0x62')][_0xef6d('0xc2')]&&_0x43dfd6[_0xef6d('0x62')][_0xef6d('0xc2')]['id']){_0x1755c0['id']=_0x43dfd6[_0xef6d('0x62')][_0xef6d('0xc2')]['id'];return db[_0xef6d('0xc3')][_0xef6d('0x66')]({'where':_0x1755c0})[_0xef6d('0x29')](function(_0x27f403){if(_0x27f403){return[_0x27f403,![]];}return db[_0xef6d('0xc3')][_0xef6d('0x61')](_0x2ba56d)['then'](function(_0x41ab9a){return[_0x41ab9a,!![]];});});}return db[_0xef6d('0xc3')][_0xef6d('0x61')](_0x2ba56d)[_0xef6d('0x29')](function(_0x43cfac){return[_0x43cfac,!![]];});}})[_0xef6d('0xc4')](function(_0x1a1e65,_0x195342){if(_0x1a1e65){_0x29721c=_0x195342;if(!_0x195342){var _0x2538cd={'from':(_0x20a269[_0xef6d('0xaf')][_0xef6d('0xb5')]||'')+'\x20'+(_0x20a269[_0xef6d('0xaf')][_0xef6d('0xc5')]||'')};if(_0x43dfd6['body'][_0xef6d('0xbf')]&&_0x43dfd6[_0xef6d('0x62')]['messageId']&&_0x43dfd6[_0xef6d('0x62')][_0xef6d('0xbf')]!=_0x43dfd6['body']['messageId']){_0x2538cd['threadId']=_0x43dfd6[_0xef6d('0x62')][_0xef6d('0xc6')];}return _0x1a1e65[_0xef6d('0x3c')](_0x2538cd);}else{return _0x1a1e65;}}})['then'](function(_0x22ca6f){_0x20a269[_0xef6d('0xc2')]=_0x22ca6f[_0xef6d('0x3d')]({'plain':!![]});_0x20a269['interaction'][_0xef6d('0xc7')]=_0x29721c;if(_0x20a269[_0xef6d('0xc2')]['created']){if(_0x20a269[_0xef6d('0xa9')]['autoclose']){_0x20a269[_0xef6d('0xaa')]['push']({'id':0x0,'priority':_0x20a269[_0xef6d('0xaa')]['length']+0x1,'app':_0xef6d('0xc8'),'appdata':_0xef6d('0xc9'),'interval':_0xef6d('0xca')});}}return db[_0xef6d('0xcb')]['create']({'body':_0x43dfd6[_0xef6d('0x62')][_0xef6d('0x62')],'ChatWebsiteId':_0x43dfd6['params']['id'],'ChatInteractionId':_0x22ca6f['id'],'direction':'in','ContactId':_0x20a269[_0xef6d('0xaf')]['id'],'AttachmentId':_0x43dfd6[_0xef6d('0x62')][_0xef6d('0xcc')]});})[_0xef6d('0x29')](function(_0x1831d4){_0x20a269[_0xef6d('0x30')]=_0x1831d4;if(_0x20a269[_0xef6d('0xc2')][_0xef6d('0xcd')]){return db['User'][_0xef6d('0x66')]({'attributes':['id',_0xef6d('0x42')],'where':{'id':_0x20a269[_0xef6d('0xc2')][_0xef6d('0xcd')]}})[_0xef6d('0x29')](function(_0x40b0f4){if(_0x40b0f4){_0x20a269[_0xef6d('0xaa')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x40b0f4[_0xef6d('0x42')]+','+(_0x20a269[_0xef6d('0xa9')][_0xef6d('0xce')]||0xa),'interval':_0xef6d('0xca')});_0x20a269[_0xef6d('0xcf')]=!![];}return respondWithRpcPromise('Start',_0xef6d('0xd0'),_0x20a269);});}return respondWithRpcPromise('Start',_0xef6d('0xd0'),_0x20a269);})[_0xef6d('0x29')](function(_0x2e6ffd){respondWithRpcPromise(_0xef6d('0xd1'),'EventManager',{'event':'notify','message':_0x2e6ffd},client9002);return _0x2e6ffd;})['then'](respondWithResult(_0x451b9e,null))['catch'](handleError(_0x451b9e,null));};exports[_0xef6d('0xd2')]=function(_0x38f089,_0x275404,_0x1fb302){var _0x4c0dc4,_0x5ca656,_0x5c51d6;var _0x330d11=[];var _0x5cbe89=[];var _0x1273fb={};return db[_0xef6d('0x95')][_0xef6d('0x68')]()[_0xef6d('0x29')](function(_0x41312b){if(!_0x41312b){throw new db['Sequelize'][(_0xef6d('0x26'))]('no\x20available\x20attributes');}_0x5cbe89=_[_0xef6d('0x98')](_['keys'](_0x41312b),[_0xef6d('0x99'),_0xef6d('0x9a')]);_0x330d11=_[_0xef6d('0x98')](_[_0xef6d('0x4c')](_0x41312b),[_0xef6d('0x99'),_0xef6d('0x9a'),_0xef6d('0x9b'),'ListId']);if(_0x38f089[_0xef6d('0x62')]['id']){delete _0x38f089[_0xef6d('0x62')]['id'];}if(_[_0xef6d('0x82')](_0x38f089['body'][_0xef6d('0x9d')])){throw _0x275404['status'](0x1f4)[_0xef6d('0x43')](new db[(_0xef6d('0x96'))][(_0xef6d('0x26'))](_0xef6d('0x9e')));}if(_[_0xef6d('0x82')](_0x38f089[_0xef6d('0x62')]['body'])||_0x38f089['body']['body']===''){throw _0x275404['status'](0x1f4)[_0xef6d('0x43')](new db[(_0xef6d('0x96'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xef6d('0x82')](_0x38f089[_0xef6d('0x62')][_0xef6d('0xd3')])){throw _0x275404[_0xef6d('0x33')](0x1f4)[_0xef6d('0x43')](new db[(_0xef6d('0x96'))][(_0xef6d('0x26'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x330d11));}if(!_[_0xef6d('0xa1')](_0x330d11,_0x38f089['body'][_0xef6d('0xd3')])){throw _0x275404[_0xef6d('0x33')](0x1f4)[_0xef6d('0x43')](new db[(_0xef6d('0x96'))][(_0xef6d('0x26'))](_0xef6d('0xd4')+_0x330d11));}_0x1273fb[_0x38f089[_0xef6d('0x62')][_0xef6d('0xd3')]]=_0x38f089['body'][_0xef6d('0x9d')];})[_0xef6d('0x29')](function(){return db[_0xef6d('0x47')][_0xef6d('0x66')]({'where':{'id':_0x38f089['params']['id']},'include':[{'model':db['CmList'],'as':_0xef6d('0xa8')}]});})[_0xef6d('0x29')](handleEntityNotFound(_0x275404,null))[_0xef6d('0x29')](function(_0x3b5b22){if(_0x3b5b22&&_0x3b5b22[_0xef6d('0xa8')]){_0x5ca656=_0x3b5b22;var _0x4ce26d=_['defaults'](_0x38f089['body'],{'firstName':_0x38f089[_0xef6d('0x62')]['from'],'phone':_0x38f089[_0xef6d('0x62')][_0xef6d('0x9d')],'ListId':_0x3b5b22[_0xef6d('0x9c')]});_0x4ce26d[_0x38f089['body'][_0xef6d('0xd3')]]=_0x38f089[_0xef6d('0x62')][_0xef6d('0x9d')];return db[_0xef6d('0x95')][_0xef6d('0xd5')]({'where':_0x1273fb,'defaults':_0x4ce26d});}})[_0xef6d('0xc4')](function(_0x559a15){if(_0x559a15){_0x5c51d6=_0x559a15;var _0x5f41ec=fs[_0xef6d('0xd6')](path[_0xef6d('0x7c')](config[_0xef6d('0x7d')],_0xef6d('0xd7')),_0xef6d('0xd8'));var _0x2f1f56=ejs[_0xef6d('0xd9')](_0x5f41ec,{'body':_[_0xef6d('0xda')](_0x38f089[_0xef6d('0x62')][_0xef6d('0x62')]),'bodyTitle':_0x5ca656[_0xef6d('0xdb')]});return db[_0xef6d('0xdc')][_0xef6d('0x61')]({'body':_0x2f1f56,'ContactId':_0x559a15['id'],'ChatWebsiteId':_0x5ca656['id']});}})[_0xef6d('0x29')](function(_0x52daa8){if(_0x52daa8){_0x4c0dc4=_0x52daa8;return db['MailAccount'][_0xef6d('0x71')]({'where':{'service':!![]},'include':[{'model':db[_0xef6d('0xdd')],'as':_0xef6d('0xde'),'raw':!![]}]});}})[_0xef6d('0x29')](function(_0x32c96f){if(_0x32c96f&&_0x32c96f['Smtp']&&_0x5ca656[_0xef6d('0xdf')]){var _0x26d0f2={'tls':{'rejectUnauthorized':![]}};if(_0x32c96f[_0xef6d('0xde')]['service']){_0x26d0f2['service']=_0x32c96f[_0xef6d('0xde')]['service'];}else{_0x26d0f2['host']=_0x32c96f[_0xef6d('0xde')][_0xef6d('0xe0')];_0x26d0f2[_0xef6d('0xe1')]=_0x32c96f['Smtp'][_0xef6d('0xe1')];_0x26d0f2['secure']=_0x32c96f[_0xef6d('0xde')][_0xef6d('0xe2')];}if(_0x32c96f[_0xef6d('0xde')][_0xef6d('0xe3')]){_0x26d0f2[_0xef6d('0xe4')]={'user':_0x32c96f[_0xef6d('0xde')][_0xef6d('0x63')],'pass':_0x32c96f['Smtp'][_0xef6d('0xe5')]};}return respondWithRpcPromise(_0xef6d('0xe6'),_0xef6d('0xe7'),{'account':_0x26d0f2,'message':{'from':util[_0xef6d('0xb9')](_0xef6d('0xe8'),_0x32c96f[_0xef6d('0x42')],_0x32c96f[_0xef6d('0xe9')]||_0x32c96f['Smtp'][_0xef6d('0x63')]),'to':_0x5ca656[_0xef6d('0xdf')],'subject':_0x5ca656['offlineMessageSubject'],'text':_0x4c0dc4[_0xef6d('0x62')]}},client9003)[_0xef6d('0x29')](function(){return _0x4c0dc4;})[_0xef6d('0x5d')](function(_0x53bd46){console[_0xef6d('0x2d')](_0x53bd46);});}})[_0xef6d('0x29')](function(){if(_0x4c0dc4){return _0x4c0dc4;}})[_0xef6d('0x29')](respondWithResult(_0x275404,null))[_0xef6d('0x5d')](handleError(_0x275404,null));};exports[_0xef6d('0xea')]=function(_0x102cf4,_0x391477,_0x5cb301){return db[_0xef6d('0xc3')][_0xef6d('0x66')]({'where':{'id':_0x102cf4[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x391477,null))[_0xef6d('0x29')](function(_0x4e2480){if(_0x4e2480){return _0x4e2480['addInteraction'](_0x102cf4['body'][_0xef6d('0x6e')],_[_0xef6d('0xeb')](_0x102cf4[_0xef6d('0x62')],['ids','id'])||{});}})[_0xef6d('0x29')](respondWithResult(_0x391477,null))['catch'](handleError(_0x391477,null));};exports[_0xef6d('0xec')]=function(_0x34c672,_0x3b76e0,_0x4cf8c2){var _0x32e09d={'raw':![],'where':{}};var _0x48bea2={};var _0x1c83ca={'count':0x0,'rows':[]};return db[_0xef6d('0x47')][_0xef6d('0x71')]({'where':{'id':_0x34c672[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x3b76e0,null))[_0xef6d('0x29')](function(_0x529aa2){if(_0x529aa2){_0x48bea2[_0xef6d('0x4a')]=_[_0xef6d('0x4c')](db[_0xef6d('0xc3')][_0xef6d('0x48')]);_0x48bea2[_0xef6d('0x4b')]=_[_0xef6d('0x4c')](_0x34c672[_0xef6d('0x4b')]);_0x48bea2['filters']=_[_0xef6d('0x4e')](_0x48bea2[_0xef6d('0x4a')],_0x48bea2[_0xef6d('0x4b')]);_0x32e09d[_0xef6d('0x4d')]=_[_0xef6d('0x4e')](_0x48bea2['model'],qs[_0xef6d('0x4f')](_0x34c672['query'][_0xef6d('0x4f')]));_0x32e09d['attributes']=_0x32e09d['attributes']['length']?_0x32e09d[_0xef6d('0x4d')]:_0x48bea2[_0xef6d('0x4a')];if(!_0x34c672['query'][_0xef6d('0x50')](_0xef6d('0x51'))){_0x32e09d[_0xef6d('0x38')]=qs[_0xef6d('0x38')](_0x34c672[_0xef6d('0x4b')][_0xef6d('0x38')]);_0x32e09d[_0xef6d('0x37')]=qs[_0xef6d('0x37')](_0x34c672['query'][_0xef6d('0x37')]);}_0x32e09d[_0xef6d('0x52')]=qs[_0xef6d('0x53')](_0x34c672[_0xef6d('0x4b')][_0xef6d('0x53')]);_0x32e09d['where']=qs[_0xef6d('0x54')](_[_0xef6d('0x55')](_0x34c672['query'],_0x48bea2[_0xef6d('0x54')]));_0x32e09d['where'][_0xef6d('0x6a')]=_0x529aa2['id'];if(_0x34c672[_0xef6d('0x4b')][_0xef6d('0x56')]){_0x32e09d['where']=_['merge'](_0x32e09d['where'],{'$or':_['map'](_0x32e09d[_0xef6d('0x4d')],function(_0x39fc98){var _0x24d910={};_0x24d910[_0x39fc98]={'$like':'%'+_0x34c672[_0xef6d('0x4b')][_0xef6d('0x56')]+'%'};return _0x24d910;})});}_0x32e09d=_['merge']({},_0x32e09d,_0x34c672[_0xef6d('0x5a')]);return db[_0xef6d('0xc3')][_0xef6d('0x36')]({'where':_0x32e09d[_0xef6d('0x57')]})[_0xef6d('0x29')](function(_0x588359){_0x1c83ca['count']=_0x588359;if(_0x34c672[_0xef6d('0x4b')][_0xef6d('0x5b')]){_0x32e09d['include']=[{'model':db[_0xef6d('0x95')],'as':_0xef6d('0xed'),'required':![]},{'model':db['User'],'as':_0xef6d('0xee'),'attributes':['name',_0xef6d('0xef'),_0xef6d('0xf0')],'required':![]},{'model':db['Tag'],'as':_0xef6d('0xf1'),'attributes':['id','name',_0xef6d('0xf2')],'where':_0x34c672[_0xef6d('0x4b')][_0xef6d('0xf3')]?{'id':_0x34c672[_0xef6d('0x4b')][_0xef6d('0xf3')]}:undefined,'required':_0x34c672[_0xef6d('0x4b')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0xef6d('0x73')](_0x32e09d);})[_0xef6d('0x29')](function(_0x1e0532){_0x1c83ca['rows']=_0x1e0532;return _0x1c83ca;});}})['then'](respondWithFilteredResult(_0x3b76e0,_0x32e09d))['catch'](handleError(_0x3b76e0,null));};function iftimePromise(_0x4a47ba,_0x1e5776){return respondWithRpcPromise(_0xef6d('0xf4'),'getSnippet',{'command':_0x1e5776[_0xef6d('0xf5')]?util['format'](_0xef6d('0xf6'),_0x4a47ba[_0xef6d('0xf7')],_0x1e5776[_0xef6d('0xf5')]):util[_0xef6d('0xb9')](_0xef6d('0xf8'),_0x4a47ba['interval'])},client9002)[_0xef6d('0x29')](function(_0x4da9a8){var _0xd6a68e=_0x4da9a8&&_0x4da9a8[_0xef6d('0xf9')](_0xef6d('0xfa'))>=0x0?!![]:![];logger[_0xef6d('0x31')](_0xef6d('0xfb'),_0x1e5776['id'],_0x4a47ba['id'],_0x4a47ba[_0xef6d('0xf7')],_0xd6a68e?_0xef6d('0xfc'):'OFFLINE',_0x1e5776[_0xef6d('0xf5')]?_0x1e5776[_0xef6d('0xf5')]:_0xef6d('0xfd'));return _0xd6a68e;})['catch'](function(_0x13c6b3){logger['error'](_0xef6d('0xfb'),_0x1e5776['id'],_0x4a47ba['id'],_0x4a47ba[_0xef6d('0xf7')],util[_0xef6d('0xfe')](_0x13c6b3,{'showHidden':![],'depth':null}),_0x1e5776[_0xef6d('0xf5')]?_0x1e5776['timezone']:'No\x20timezone');return![];});}exports[_0xef6d('0xff')]=function(_0x294c82,_0xdf31e3,_0x42df88){var _0x4e1a73=0x0;var _0x2b5b4f=0x0;var _0x24a11f=![];var _0xe65e58;var _0x690020;return db[_0xef6d('0x47')][_0xef6d('0x66')]({'where':{'id':_0x294c82[_0xef6d('0x5f')]['id']},'include':[{'model':db['Interval'],'as':_0xef6d('0x100'),'include':[{'model':db[_0xef6d('0x100')],'as':_0xef6d('0x101'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xef6d('0x29')](handleEntityNotFound(_0xdf31e3,null))[_0xef6d('0x29')](function(_0x171cf7){if(_0x171cf7){_0xe65e58=_0x171cf7;return _0x171cf7[_0xef6d('0x102')]({'raw':!![]});}})[_0xef6d('0x29')](function(_0x1e99c7){if(_0xe65e58){if(_0x1e99c7){_0x690020=_0x1e99c7;}}return require('../../config/license/util')['getLicense']();})[_0xef6d('0x29')](function(_0x2e26c7){if(_0x2e26c7){_0x2b5b4f=_0x2e26c7[_0xef6d('0x103')];_0x24a11f=_0x2e26c7['custom'];}})[_0xef6d('0x29')](function(){return db[_0xef6d('0xc3')][_0xef6d('0x36')]({'where':{'closed':![]}});})['then'](function(_0x523c64){_0x4e1a73=_0x523c64;if(_0x2b5b4f&&_0x523c64>_0x2b5b4f){return db[_0xef6d('0x104')][_0xef6d('0x71')]({'where':{'id':0x1}})[_0xef6d('0x29')](function(_0x9d815){if(_0x9d815){_0x9d815['increment'](_0xef6d('0x105'));}});}})[_0xef6d('0x29')](function(){if(_0xe65e58[_0xef6d('0x100')]&&_0xe65e58[_0xef6d('0x100')][_0xef6d('0x101')]){var _0x4bcc00=[];for(var _0x1512dc=0x0;_0x1512dc<_0xe65e58[_0xef6d('0x100')][_0xef6d('0x101')][_0xef6d('0x60')];_0x1512dc++){var _0x3ada8f=_0xe65e58[_0xef6d('0x100')][_0xef6d('0x101')][_0x1512dc][_0xef6d('0x3d')]({'plain':!![]});_0x4bcc00[_0xef6d('0x106')](iftimePromise(_0x3ada8f,_0xe65e58));}return BPromise['all'](_0x4bcc00)[_0xef6d('0x29')](function(_0xe4fe74){return _[_0xef6d('0x107')](_0xe4fe74);});}else{return!![];}})[_0xef6d('0x29')](function(_0x578979){var _0x116149=fs[_0xef6d('0xd6')](path[_0xef6d('0x7c')](config['root'],_0xef6d('0x108')),'utf8');var _0x57f96d={'remote':_0xe65e58[_0xef6d('0x109')],'query':querystring[_0xef6d('0x2c')](_[_0xef6d('0x59')](_0xe65e58[_0xef6d('0x3d')]({'plain':!![]}),{'customerIp':_0x294c82[_0xef6d('0x91')][_0xef6d('0xb3')]||_0x294c82[_0xef6d('0x91')][_0xef6d('0x10a')]||_0x294c82[_0xef6d('0x10b')][_0xef6d('0x10c')]||_0x294c82['ip'],'referer':_0x294c82[_0xef6d('0x91')][_0xef6d('0x10d')],'openedInteractions':_0x4e1a73,'maxInteractions':_0x2b5b4f,'virtual':_0x24a11f[_0xef6d('0x103')],'online':_0x578979,'custom':_0x24a11f}))[_0xef6d('0x10e')](/'/g,'\x5c\x27')};_0xdf31e3[_0xef6d('0x43')](ejs['render'](Mustache['render'](_0x116149,_0x57f96d),{'proactiveActions':_0x690020,'alignment':_0xe65e58[_0xef6d('0x10f')],'verticalAlignment':_0xe65e58[_0xef6d('0x110')],'div_color':_0xe65e58['color'],'text_color':_0xe65e58[_0xef6d('0x111')]}));})[_0xef6d('0x5d')](handleError(_0xdf31e3,null));};exports[_0xef6d('0x112')]=function(_0x2b37f7,_0x4b5e88,_0x583b2c){return db[_0xef6d('0x47')]['findOne']({'where':{'id':_0x2b37f7[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x4b5e88,null))[_0xef6d('0x29')](function(_0x425192){if(_0x425192){return db[_0xef6d('0x113')]['transaction'](function(_0x175293){return db['ChatApplication'][_0xef6d('0x114')]({'where':{'ChatWebsiteId':_0x2b37f7[_0xef6d('0x5f')]['id']},'transaction':_0x175293})['then'](function(_0xd9a7a6){var _0x45fe4c=_[_0xef6d('0x46')](_0x2b37f7[_0xef6d('0x62')],function(_0x150e45){_0x150e45['ChatWebsiteId']=_0x2b37f7[_0xef6d('0x5f')]['id'];return _0x150e45;});return db[_0xef6d('0x115')][_0xef6d('0x116')](_0x45fe4c,{'transaction':_0x175293});});})[_0xef6d('0x29')](function(){return db[_0xef6d('0x115')][_0xef6d('0x117')]({'where':{'ChatWebsiteId':_0x2b37f7[_0xef6d('0x5f')]['id']},'order':_0xef6d('0xad')});});}})[_0xef6d('0x29')](respondWithResult(_0x4b5e88,null))[_0xef6d('0x5d')](handleError(_0x4b5e88,null));};exports[_0xef6d('0x118')]=function(_0x453820,_0x5315c1,_0x23697e){var _0x2f4980={};var _0x25f591={};var _0x48403f;var _0x90e6d8;return db['ChatWebsite'][_0xef6d('0x71')]({'where':{'id':_0x453820[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x5315c1,null))[_0xef6d('0x29')](function(_0x52a423){if(_0x52a423){_0x48403f=_0x52a423;_0x25f591[_0xef6d('0x4a')]=_[_0xef6d('0x4c')](db[_0xef6d('0x115')][_0xef6d('0x48')]);_0x25f591[_0xef6d('0x4b')]=_['keys'](_0x453820[_0xef6d('0x4b')]);_0x25f591[_0xef6d('0x54')]=_[_0xef6d('0x4e')](_0x25f591['model'],_0x25f591[_0xef6d('0x4b')]);_0x2f4980['attributes']=_[_0xef6d('0x4e')](_0x25f591[_0xef6d('0x4a')],qs['fields'](_0x453820[_0xef6d('0x4b')][_0xef6d('0x4f')]));_0x2f4980['attributes']=_0x2f4980[_0xef6d('0x4d')][_0xef6d('0x60')]?_0x2f4980['attributes']:_0x25f591[_0xef6d('0x4a')];_0x2f4980[_0xef6d('0x52')]=qs[_0xef6d('0x53')](_0x453820[_0xef6d('0x4b')][_0xef6d('0x53')]);_0x2f4980[_0xef6d('0x57')]=qs[_0xef6d('0x54')](_['pick'](_0x453820[_0xef6d('0x4b')],_0x25f591[_0xef6d('0x54')]));if(_0x453820[_0xef6d('0x4b')][_0xef6d('0x56')]){_0x2f4980[_0xef6d('0x57')]=_[_0xef6d('0x59')](_0x2f4980[_0xef6d('0x57')],{'$or':_['map'](_0x2f4980['attributes'],function(_0x1daf5a){var _0x544f9b={};_0x544f9b[_0x1daf5a]={'$like':'%'+_0x453820[_0xef6d('0x4b')][_0xef6d('0x56')]+'%'};return _0x544f9b;})});}_0x2f4980=_[_0xef6d('0x59')]({},_0x2f4980,_0x453820[_0xef6d('0x5a')]);return _0x48403f[_0xef6d('0x118')](_0x2f4980);}})['then'](function(_0x3f9c12){if(_0x3f9c12){_0x90e6d8=_0x3f9c12[_0xef6d('0x60')];if(!_0x453820[_0xef6d('0x4b')]['hasOwnProperty']('nolimit')){_0x2f4980[_0xef6d('0x38')]=qs[_0xef6d('0x38')](_0x453820[_0xef6d('0x4b')][_0xef6d('0x38')]);_0x2f4980[_0xef6d('0x37')]=qs['offset'](_0x453820[_0xef6d('0x4b')][_0xef6d('0x37')]);}return _0x48403f[_0xef6d('0x118')](_0x2f4980);}})[_0xef6d('0x29')](function(_0x17b542){if(_0x17b542){return _0x17b542?{'count':_0x90e6d8,'rows':_0x17b542}:null;}})[_0xef6d('0x29')](respondWithResult(_0x5315c1,null))[_0xef6d('0x5d')](handleError(_0x5315c1,null));};exports['addProactiveActions']=function(_0x3239f3,_0x4685dc,_0x496528){return db[_0xef6d('0x119')][_0xef6d('0x66')]({'where':{'id':_0x3239f3[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x4685dc,null))['then'](function(_0x99e926){if(_0x99e926){return _0x99e926['addProactiveActions'](_0x3239f3[_0xef6d('0x62')][_0xef6d('0x6e')],_[_0xef6d('0xeb')](_0x3239f3[_0xef6d('0x62')],[_0xef6d('0x6e'),'id'])||{});}})[_0xef6d('0x29')](respondWithResult(_0x4685dc,null))['catch'](handleError(_0x4685dc,null));};exports[_0xef6d('0x102')]=function(_0x5ba453,_0x21c9bc,_0x2344ca){var _0xe16dae={};var _0x9c8553={};var _0x564421;var _0x45a789;return db[_0xef6d('0x47')][_0xef6d('0x71')]({'where':{'id':_0x5ba453[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x21c9bc,null))[_0xef6d('0x29')](function(_0x308d18){if(_0x308d18){_0x564421=_0x308d18;_0x9c8553[_0xef6d('0x4a')]=_[_0xef6d('0x4c')](db[_0xef6d('0x11a')][_0xef6d('0x48')]);_0x9c8553['query']=_['keys'](_0x5ba453[_0xef6d('0x4b')]);_0x9c8553[_0xef6d('0x54')]=_[_0xef6d('0x4e')](_0x9c8553[_0xef6d('0x4a')],_0x9c8553['query']);_0xe16dae[_0xef6d('0x4d')]=_[_0xef6d('0x4e')](_0x9c8553['model'],qs['fields'](_0x5ba453[_0xef6d('0x4b')][_0xef6d('0x4f')]));_0xe16dae['attributes']=_0xe16dae[_0xef6d('0x4d')][_0xef6d('0x60')]?_0xe16dae[_0xef6d('0x4d')]:_0x9c8553[_0xef6d('0x4a')];_0xe16dae['order']=qs[_0xef6d('0x53')](_0x5ba453['query']['sort']);_0xe16dae[_0xef6d('0x57')]=qs['filters'](_[_0xef6d('0x55')](_0x5ba453[_0xef6d('0x4b')],_0x9c8553[_0xef6d('0x54')]));if(_0x5ba453[_0xef6d('0x4b')]['filter']){_0xe16dae['where']=_[_0xef6d('0x59')](_0xe16dae[_0xef6d('0x57')],{'$or':_[_0xef6d('0x46')](_0xe16dae['attributes'],function(_0xdefeed){var _0x410217={};_0x410217[_0xdefeed]={'$like':'%'+_0x5ba453[_0xef6d('0x4b')]['filter']+'%'};return _0x410217;})});}_0xe16dae=_['merge']({},_0xe16dae,_0x5ba453[_0xef6d('0x5a')]);return _0x564421[_0xef6d('0x102')](_0xe16dae);}})['then'](function(_0xbb603e){if(_0xbb603e){_0x45a789=_0xbb603e[_0xef6d('0x60')];if(!_0x5ba453[_0xef6d('0x4b')][_0xef6d('0x50')](_0xef6d('0x51'))){_0xe16dae[_0xef6d('0x38')]=qs[_0xef6d('0x38')](_0x5ba453[_0xef6d('0x4b')]['limit']);_0xe16dae[_0xef6d('0x37')]=qs[_0xef6d('0x37')](_0x5ba453[_0xef6d('0x4b')]['offset']);}return _0x564421[_0xef6d('0x102')](_0xe16dae);}})[_0xef6d('0x29')](function(_0x5d67da){if(_0x5d67da){return _0x5d67da?{'count':_0x45a789,'rows':_0x5d67da}:null;}})[_0xef6d('0x29')](respondWithResult(_0x21c9bc,null))['catch'](handleError(_0x21c9bc,null));};exports[_0xef6d('0x11b')]=function(_0x2aebcf,_0x4f3dc5,_0x1f8194){var _0x35d975=_0x2aebcf[_0xef6d('0x4b')]['online']===_0xef6d('0x11c')?'offlineForm':'onlineForm';return db[_0xef6d('0x47')][_0xef6d('0x66')]({'attributes':['id',_0x35d975],'where':{'id':_0x2aebcf[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x4f3dc5,null))[_0xef6d('0x29')](function(_0x25e141){if(_0x25e141){var _0x52045d=_0x25e141[_0x35d975];var _0x4c8b55=_0x52045d&&_0x52045d['items']?_0x52045d['items']:[];_0x4f3dc5[_0xef6d('0x43')]({'fromKey':_[_0xef6d('0x82')](_0x52045d['fromKey'])?undefined:_0x52045d['fromKey'],'count':_0x4c8b55[_0xef6d('0x60')],'rows':_0x4c8b55});}})[_0xef6d('0x5d')](handleError(_0x4f3dc5,null));};exports[_0xef6d('0x11d')]=function(_0x4847f0,_0x248f73,_0x1a455f){var _0x594231={'raw':![],'where':{}};var _0x50f2e3={};var _0x32ed8e={'count':0x0,'rows':[]};return db[_0xef6d('0x47')][_0xef6d('0x71')]({'where':{'id':_0x4847f0[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x248f73,null))[_0xef6d('0x29')](function(_0x57d000){if(_0x57d000){_0x50f2e3['model']=_['keys'](db[_0xef6d('0xdc')]['rawAttributes']);_0x50f2e3[_0xef6d('0x4b')]=_['keys'](_0x4847f0[_0xef6d('0x4b')]);_0x50f2e3[_0xef6d('0x54')]=_[_0xef6d('0x4e')](_0x50f2e3[_0xef6d('0x4a')],_0x50f2e3[_0xef6d('0x4b')]);_0x594231[_0xef6d('0x4d')]=_[_0xef6d('0x4e')](_0x50f2e3[_0xef6d('0x4a')],qs['fields'](_0x4847f0[_0xef6d('0x4b')][_0xef6d('0x4f')]));_0x594231[_0xef6d('0x4d')]=_0x594231['attributes']['length']?_0x594231[_0xef6d('0x4d')]:_0x50f2e3[_0xef6d('0x4a')];if(!_0x4847f0[_0xef6d('0x4b')]['hasOwnProperty'](_0xef6d('0x51'))){_0x594231[_0xef6d('0x38')]=qs[_0xef6d('0x38')](_0x4847f0[_0xef6d('0x4b')][_0xef6d('0x38')]);_0x594231['offset']=qs[_0xef6d('0x37')](_0x4847f0['query']['offset']);}_0x594231[_0xef6d('0x52')]=qs[_0xef6d('0x53')](_0x4847f0[_0xef6d('0x4b')][_0xef6d('0x53')]);_0x594231[_0xef6d('0x57')]=qs[_0xef6d('0x54')](_[_0xef6d('0x55')](_0x4847f0[_0xef6d('0x4b')],_0x50f2e3[_0xef6d('0x54')]));_0x594231[_0xef6d('0x57')][_0xef6d('0x6a')]=_0x57d000['id'];if(_0x4847f0[_0xef6d('0x4b')]['filter']){_0x594231[_0xef6d('0x57')]=_[_0xef6d('0x59')](_0x594231[_0xef6d('0x57')],{'$or':_[_0xef6d('0x46')](_0x594231['attributes'],function(_0x84c297){var _0xa84543={};_0xa84543[_0x84c297]={'$like':'%'+_0x4847f0['query'][_0xef6d('0x56')]+'%'};return _0xa84543;})});}_0x594231=_[_0xef6d('0x59')]({},_0x594231,_0x4847f0[_0xef6d('0x5a')]);return db[_0xef6d('0xdc')][_0xef6d('0x36')]({'where':_0x594231['where']})[_0xef6d('0x29')](function(_0x435ea4){_0x32ed8e[_0xef6d('0x36')]=_0x435ea4;if(_0x4847f0[_0xef6d('0x4b')][_0xef6d('0x5b')]){_0x594231['include']=[{'all':!![]}];}else{_0x594231[_0xef6d('0x6c')]=[{'model':db[_0xef6d('0x95')],'as':_0xef6d('0xed'),'required':![]}];}return db[_0xef6d('0xdc')][_0xef6d('0x73')](_0x594231);})[_0xef6d('0x29')](function(_0x4d0c93){_0x32ed8e[_0xef6d('0x5c')]=_0x4d0c93;return _0x32ed8e;});}})['then'](respondWithFilteredResult(_0x248f73,_0x594231))[_0xef6d('0x5d')](handleError(_0x248f73,null));};exports['addAgents']=function(_0x35e7e7,_0x33a98c,_0x41ecdc){return db[_0xef6d('0x47')]['find']({'where':{'id':_0x35e7e7['params']['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x33a98c,null))['then'](function(_0x4528fd){if(_0x4528fd){return _0x4528fd['addAgents'](_0x35e7e7[_0xef6d('0x62')]['ids'],_[_0xef6d('0xeb')](_0x35e7e7[_0xef6d('0x62')],[_0xef6d('0x6e'),'id'])||{})[_0xef6d('0xc4')](function(_0x3d316c){for(var _0x158a2c=0x0;_0x158a2c<_0x35e7e7[_0xef6d('0x62')][_0xef6d('0x6e')][_0xef6d('0x60')];_0x158a2c+=0x1){socket[_0xef6d('0x11e')](_0xef6d('0x11f'),{'UserId':_0x35e7e7['body']['ids'][_0x158a2c],'ChatWebsiteId':_0x35e7e7[_0xef6d('0x5f')]['id']});}return _0x3d316c;});}})[_0xef6d('0x29')](respondWithResult(_0x33a98c,null))['catch'](handleError(_0x33a98c,null));};exports[_0xef6d('0x120')]=function(_0x58465d,_0x5aa662,_0x3d1652){return db[_0xef6d('0x47')][_0xef6d('0x66')]({'where':{'id':_0x58465d[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x5aa662,null))['then'](function(_0xbd9351){if(_0xbd9351){return _0xbd9351[_0xef6d('0x120')](_0x58465d['query'][_0xef6d('0x6e')])[_0xef6d('0x29')](function(){if(_[_0xef6d('0x121')](_0x58465d[_0xef6d('0x4b')][_0xef6d('0x6e')])){for(var _0x3f09d9=0x0;_0x3f09d9<_0x58465d['query']['ids']['length'];_0x3f09d9+=0x1){socket['emit'](_0xef6d('0x122'),{'UserId':Number(_0x58465d[_0xef6d('0x4b')]['ids'][_0x3f09d9]),'ChatWebsiteId':Number(_0x58465d[_0xef6d('0x5f')]['id'])});}}else{socket[_0xef6d('0x11e')](_0xef6d('0x122'),{'UserId':Number(_0x58465d[_0xef6d('0x4b')][_0xef6d('0x6e')]),'ChatWebsiteId':Number(_0x58465d[_0xef6d('0x5f')]['id'])});}});}})[_0xef6d('0x29')](respondWithStatusCode(_0x5aa662,null))[_0xef6d('0x5d')](handleError(_0x5aa662,null));};exports[_0xef6d('0x123')]=function(_0x50cfe1,_0x1c00bf,_0x670382){var _0xf4baa6={};var _0x4b7c4e={};var _0x3ea177;var _0x2b8d4e;return db['ChatWebsite']['findOne']({'where':{'id':_0x50cfe1[_0xef6d('0x5f')]['id']}})[_0xef6d('0x29')](handleEntityNotFound(_0x1c00bf,null))['then'](function(_0x367a13){if(_0x367a13){_0x3ea177=_0x367a13;_0x4b7c4e[_0xef6d('0x4a')]=_['keys'](db['User']['rawAttributes']);_0x4b7c4e[_0xef6d('0x4b')]=_[_0xef6d('0x4c')](_0x50cfe1['query']);_0x4b7c4e[_0xef6d('0x54')]=_[_0xef6d('0x4e')](_0x4b7c4e[_0xef6d('0x4a')],_0x4b7c4e[_0xef6d('0x4b')]);_0xf4baa6['attributes']=_[_0xef6d('0x4e')](_0x4b7c4e[_0xef6d('0x4a')],qs[_0xef6d('0x4f')](_0x50cfe1[_0xef6d('0x4b')]['fields']));_0xf4baa6[_0xef6d('0x4d')]=_0xf4baa6['attributes'][_0xef6d('0x60')]?_0xf4baa6[_0xef6d('0x4d')]:_0x4b7c4e[_0xef6d('0x4a')];_0xf4baa6['order']=qs[_0xef6d('0x53')](_0x50cfe1['query'][_0xef6d('0x53')]);_0xf4baa6['where']=qs[_0xef6d('0x54')](_['pick'](_0x50cfe1[_0xef6d('0x4b')],_0x4b7c4e[_0xef6d('0x54')]));if(_0x50cfe1['query']['filter']){_0xf4baa6[_0xef6d('0x57')]=_[_0xef6d('0x59')](_0xf4baa6[_0xef6d('0x57')],{'$or':_[_0xef6d('0x46')](_0xf4baa6['attributes'],function(_0xd8deea){var _0x25dc17={};_0x25dc17[_0xd8deea]={'$like':'%'+_0x50cfe1[_0xef6d('0x4b')]['filter']+'%'};return _0x25dc17;})});}_0xf4baa6=_[_0xef6d('0x59')]({},_0xf4baa6,_0x50cfe1[_0xef6d('0x5a')]);return _0x3ea177['getAgents'](_0xf4baa6);}})[_0xef6d('0x29')](function(_0x234d10){if(_0x234d10){_0x2b8d4e=_0x234d10[_0xef6d('0x60')];if(!_0x50cfe1['query'][_0xef6d('0x50')]('nolimit')){_0xf4baa6[_0xef6d('0x38')]=qs[_0xef6d('0x38')](_0x50cfe1['query'][_0xef6d('0x38')]);_0xf4baa6['offset']=qs[_0xef6d('0x37')](_0x50cfe1[_0xef6d('0x4b')][_0xef6d('0x37')]);}return _0x3ea177[_0xef6d('0x123')](_0xf4baa6);}})['then'](function(_0x5c6f75){if(_0x5c6f75){return _0x5c6f75?{'count':_0x2b8d4e,'rows':_0x5c6f75}:null;}})[_0xef6d('0x29')](respondWithResult(_0x1c00bf,null))[_0xef6d('0x5d')](handleError(_0x1c00bf,null));}; \ No newline at end of file +var _0xa116=['file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','../../config/license/util','custom','isNil','root','join','server/files/images/logos/','download','getAvatar','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','getResult','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','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','DESC','ChatApplication','Applications','account','applications','list','priority','asc','Contacts','defaults','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','lastName','messageId','created','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','offline','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','utf8','toPairs','offlineMessageBody','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','hasOwnProperty','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','License','push','all','some','server/files/chat/iframe.js','remote','connection','replace','render','alignment','addApplications','sequelize','transaction','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.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','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','destroy','get','end','stack','name','send','index','map','ChatWebsite','fieldName','type','model','query','keys','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filters','filter','merge','includeAll','findAll','rows','show','Pause','mandatoryDispositionPause','rawAttributes','options','create','body','user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','find','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','include','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic'];(function(_0xdd7981,_0x375aca){var _0xc705ae=function(_0xd8cb4d){while(--_0xd8cb4d){_0xdd7981['push'](_0xdd7981['shift']());}};_0xc705ae(++_0x375aca);}(_0xa116,0x1dd));var _0x6a11=function(_0x52ef6a,_0x544601){_0x52ef6a=_0x52ef6a-0x0;var _0x597102=_0xa116[_0x52ef6a];return _0x597102;};'use strict';var pdf=require(_0x6a11('0x0'));var emlformat=require(_0x6a11('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6a11('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a11('0x3'));var moment=require(_0x6a11('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6a11('0x5'));var util=require(_0x6a11('0x6'));var path=require(_0x6a11('0x7'));var sox=require(_0x6a11('0x8'));var csv=require('to-csv');var ejs=require(_0x6a11('0x9'));var fs=require('fs');var _=require(_0x6a11('0xa'));var squel=require(_0x6a11('0xb'));var crypto=require('crypto');var jsforce=require(_0x6a11('0xc'));var deskjs=require(_0x6a11('0xd'));var toCsv=require(_0x6a11('0xe'));var querystring=require(_0x6a11('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6a11('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6a11('0x11'));var hardwareService=require(_0x6a11('0x12'));var logger=require('../../config/logger')(_0x6a11('0x13'));var utils=require(_0x6a11('0x14'));var config=require('../../config/environment');var db=require(_0x6a11('0x15'))['db'];config[_0x6a11('0x16')]=_['defaults'](config[_0x6a11('0x16')],{'host':_0x6a11('0x17'),'port':0x18eb});var socket=require(_0x6a11('0x18'))(new Redis(config['redis']));require(_0x6a11('0x19'))[_0x6a11('0x1a')](socket);var jayson=require(_0x6a11('0x1b'));var client=jayson[_0x6a11('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x6a11('0x1c')][_0x6a11('0x1d')]({'port':0x232a});var client9003=jayson[_0x6a11('0x1c')][_0x6a11('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x559acb,_0x41728c,_0x129889){if(_0x129889){var _0x44a004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x44a004[_0x6a11('0x1e')](_0x41728c)){return _0x559acb;}else{throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))](_0x6a11('0x21'));}}else{return _0x559acb;}}function respondWithRpcPromise(_0x4288ec,_0x273b0e,_0x1f8c99,_0x106e2e){return new BPromise(function(_0x13eebb,_0x483fe4){var _0x109b06=_0x106e2e||client;return _0x109b06[_0x6a11('0x22')](_0x4288ec,_0x1f8c99)[_0x6a11('0x23')](function(_0x2e31bb){logger[_0x6a11('0x24')](_0x6a11('0x25'),_0x273b0e,_0x6a11('0x26'));logger[_0x6a11('0x27')](_0x6a11('0x28'),_0x273b0e,_0x6a11('0x26'),JSON[_0x6a11('0x29')](_0x2e31bb));if(_0x2e31bb[_0x6a11('0x2a')]){if(_0x2e31bb[_0x6a11('0x2a')][_0x6a11('0x2b')]===0x1f4){logger['error'](_0x6a11('0x25'),_0x273b0e,_0x2e31bb[_0x6a11('0x2a')][_0x6a11('0x2c')]);return _0x483fe4(_0x2e31bb[_0x6a11('0x2a')][_0x6a11('0x2c')]);}logger[_0x6a11('0x2a')](_0x6a11('0x25'),_0x273b0e,_0x2e31bb[_0x6a11('0x2a')][_0x6a11('0x2c')]);return _0x13eebb(_0x2e31bb[_0x6a11('0x2a')][_0x6a11('0x2c')]);}else{logger[_0x6a11('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x273b0e,_0x6a11('0x26'));_0x13eebb(_0x2e31bb[_0x6a11('0x2d')][_0x6a11('0x2c')]);}})[_0x6a11('0x2e')](function(_0x62984a){logger[_0x6a11('0x2a')](_0x6a11('0x25'),_0x273b0e,_0x62984a);_0x483fe4(_0x62984a);});});}function respondWithStatusCode(_0x565cdf,_0x20fa9e){_0x20fa9e=_0x20fa9e||0xcc;return function(_0x1928b3){if(_0x1928b3){return _0x565cdf[_0x6a11('0x2f')](_0x20fa9e);}return _0x565cdf[_0x6a11('0x30')](_0x20fa9e)['end']();};}function respondWithResult(_0x2d4790,_0x16e705){_0x16e705=_0x16e705||0xc8;return function(_0x45b7f7){if(_0x45b7f7){return _0x2d4790[_0x6a11('0x30')](_0x16e705)[_0x6a11('0x31')](_0x45b7f7);}};}function respondWithFilteredResult(_0x4cc6dd,_0x48f317){return function(_0x315df6){if(_0x315df6){var _0x4a1e5b=_0x315df6[_0x6a11('0x32')],_0x5139ce=_0x48f317[_0x6a11('0x33')],_0x35ec37=_0x48f317[_0x6a11('0x33')]+_0x48f317['limit'],_0x131f3a;if(_0x35ec37>=_0x4a1e5b){_0x35ec37=_0x4a1e5b;_0x131f3a=0xc8;}else{_0x131f3a=0xce;}_0x4cc6dd['status'](_0x131f3a);return _0x4cc6dd[_0x6a11('0x34')](_0x6a11('0x35'),_0x5139ce+'-'+_0x35ec37+'/'+_0x4a1e5b)[_0x6a11('0x31')](_0x315df6);}return null;};}function patchUpdates(_0xe99a9f){return function(_0x1c742c){try{jsonpatch['apply'](_0x1c742c,_0xe99a9f,!![]);}catch(_0x575fe5){return BPromise[_0x6a11('0x36')](_0x575fe5);}return _0x1c742c[_0x6a11('0x37')]();};}function saveUpdates(_0x21db49,_0x388e28){return function(_0x131337){if(_0x131337){return _0x131337[_0x6a11('0x38')](_0x21db49)[_0x6a11('0x23')](function(_0xd65e9a){return _0xd65e9a;});}return null;};}function removeEntity(_0xc7bb83,_0x264d38){return function(_0x420401){if(_0x420401){return _0x420401[_0x6a11('0x39')]()[_0x6a11('0x23')](function(){var _0x512ff0=_0x420401[_0x6a11('0x3a')]({'plain':!![]});var _0x436ba8='ChatWebsites';return db['UserProfileResource'][_0x6a11('0x39')]({'where':{'type':_0x436ba8,'resourceId':_0x512ff0['id']}})[_0x6a11('0x23')](function(){return _0x420401;});})['then'](function(){_0xc7bb83[_0x6a11('0x30')](0xcc)[_0x6a11('0x3b')]();});}};}function handleEntityNotFound(_0x57ab23,_0x399d77){return function(_0x582d88){if(!_0x582d88){_0x57ab23[_0x6a11('0x2f')](0x194);}return _0x582d88;};}function handleError(_0x41fcbe,_0x4b0e05){_0x4b0e05=_0x4b0e05||0x1f4;return function(_0x3b1d64){logger['error'](_0x3b1d64[_0x6a11('0x3c')]);if(_0x3b1d64[_0x6a11('0x3d')]){delete _0x3b1d64['name'];}_0x41fcbe[_0x6a11('0x30')](_0x4b0e05)[_0x6a11('0x3e')](_0x3b1d64);};}exports[_0x6a11('0x3f')]=function(_0x440c8e,_0x51d8d6){var _0x3879ec={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x47665e={},_0x2f19a0={'count':0x0,'rows':[]};var _0x123067=_[_0x6a11('0x40')](db[_0x6a11('0x41')]['rawAttributes'],function(_0x6ff130){return{'name':_0x6ff130[_0x6a11('0x42')],'type':_0x6ff130[_0x6a11('0x43')]['key']};});_0x47665e[_0x6a11('0x44')]=_[_0x6a11('0x40')](_0x123067,_0x6a11('0x3d'));_0x47665e[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x440c8e['query']);_0x47665e['filters']=_[_0x6a11('0x47')](_0x47665e[_0x6a11('0x44')],_0x47665e[_0x6a11('0x45')]);_0x3879ec['attributes']=_[_0x6a11('0x47')](_0x47665e[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0x440c8e[_0x6a11('0x45')][_0x6a11('0x48')]));_0x3879ec[_0x6a11('0x49')]=_0x3879ec[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x3879ec['attributes']:_0x47665e['model'];if(!_0x440c8e[_0x6a11('0x45')]['hasOwnProperty'](_0x6a11('0x4b'))){_0x3879ec[_0x6a11('0x4c')]=qs[_0x6a11('0x4c')](_0x440c8e['query'][_0x6a11('0x4c')]);_0x3879ec[_0x6a11('0x33')]=qs[_0x6a11('0x33')](_0x440c8e['query'][_0x6a11('0x33')]);}_0x3879ec['order']=qs[_0x6a11('0x4d')](_0x440c8e[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x3879ec[_0x6a11('0x4e')]=qs['filters'](_[_0x6a11('0x4f')](_0x440c8e['query'],_0x47665e[_0x6a11('0x50')]),_0x123067);if(_0x440c8e[_0x6a11('0x45')][_0x6a11('0x51')]){_0x3879ec['where']=_[_0x6a11('0x52')](_0x3879ec[_0x6a11('0x4e')],{'$or':_['map'](_0x123067,function(_0xf2068){if(_0xf2068[_0x6a11('0x43')]!=='VIRTUAL'){var _0x3d30ae={};_0x3d30ae[_0xf2068['name']]={'$like':'%'+_0x440c8e['query'][_0x6a11('0x51')]+'%'};return _0x3d30ae;}})});}_0x3879ec=_[_0x6a11('0x52')]({},_0x3879ec,_0x440c8e['options']);var _0x2df374={'where':_0x3879ec[_0x6a11('0x4e')]};return db[_0x6a11('0x41')][_0x6a11('0x32')](_0x2df374)[_0x6a11('0x23')](function(_0x275933){_0x2f19a0[_0x6a11('0x32')]=_0x275933;if(_0x440c8e[_0x6a11('0x45')][_0x6a11('0x53')]){_0x3879ec['include']=[{'all':!![]}];}return db[_0x6a11('0x41')][_0x6a11('0x54')](_0x3879ec);})[_0x6a11('0x23')](function(_0x98e2ea){_0x2f19a0[_0x6a11('0x55')]=_0x98e2ea;return _0x2f19a0;})[_0x6a11('0x23')](respondWithFilteredResult(_0x51d8d6,_0x3879ec))[_0x6a11('0x2e')](handleError(_0x51d8d6,null));};exports[_0x6a11('0x56')]=function(_0xf16eaf,_0x17f32e){var _0x40597c={'raw':![],'where':{'id':_0xf16eaf['params']['id']},'include':[{'model':db[_0x6a11('0x57')],'as':_0x6a11('0x58')}]},_0x497619={};_0x497619[_0x6a11('0x44')]=_[_0x6a11('0x46')](db['ChatWebsite'][_0x6a11('0x59')]);_0x497619['query']=_['keys'](_0xf16eaf[_0x6a11('0x45')]);_0x497619['filters']=_[_0x6a11('0x47')](_0x497619[_0x6a11('0x44')],_0x497619['query']);_0x40597c[_0x6a11('0x49')]=_[_0x6a11('0x47')](_0x497619[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0xf16eaf['query'][_0x6a11('0x48')]));_0x40597c['attributes']=_0x40597c['attributes'][_0x6a11('0x4a')]?_0x40597c[_0x6a11('0x49')]:_0x497619[_0x6a11('0x44')];if(_0xf16eaf[_0x6a11('0x45')]['includeAll']){_0x40597c['include']=[{'all':!![]}];}_0x40597c=_[_0x6a11('0x52')]({},_0x40597c,_0xf16eaf[_0x6a11('0x5a')]);return db[_0x6a11('0x41')]['find'](_0x40597c)[_0x6a11('0x23')](handleEntityNotFound(_0x17f32e,null))[_0x6a11('0x23')](respondWithResult(_0x17f32e,null))[_0x6a11('0x2e')](handleError(_0x17f32e,null));};exports[_0x6a11('0x5b')]=function(_0x4c2b4e,_0x286d65){return db[_0x6a11('0x41')][_0x6a11('0x5b')](_0x4c2b4e[_0x6a11('0x5c')],{})[_0x6a11('0x23')](function(_0x5a357c){var _0x270179=_0x4c2b4e[_0x6a11('0x5d')]['get']({'plain':!![]});if(!_0x270179)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x270179[_0x6a11('0x5e')]===_0x6a11('0x5d')){var _0x4d5282=_0x5a357c[_0x6a11('0x3a')]({'plain':!![]});var _0x3b9b41=_0x6a11('0x5f');return db[_0x6a11('0x60')]['find']({'where':{'name':_0x3b9b41,'userProfileId':_0x270179[_0x6a11('0x61')]},'raw':!![]})['then'](function(_0x24306e){if(_0x24306e&&_0x24306e[_0x6a11('0x62')]===0x0){return db[_0x6a11('0x63')][_0x6a11('0x5b')]({'name':_0x4d5282['name'],'resourceId':_0x4d5282['id'],'type':_0x24306e[_0x6a11('0x3d')],'sectionId':_0x24306e['id']},{})[_0x6a11('0x23')](function(){return _0x5a357c;});}else{return _0x5a357c;}})[_0x6a11('0x2e')](function(_0x3a1d5b){logger[_0x6a11('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a1d5b);throw _0x3a1d5b;});}return _0x5a357c;})[_0x6a11('0x23')](respondWithResult(_0x286d65,0xc9))['catch'](handleError(_0x286d65,null));};exports[_0x6a11('0x38')]=function(_0x384471,_0x238e06){if(_0x384471[_0x6a11('0x5c')]['id']){delete _0x384471[_0x6a11('0x5c')]['id'];}return db['ChatWebsite'][_0x6a11('0x64')]({'where':{'id':_0x384471[_0x6a11('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0x6a11('0x58')}]})[_0x6a11('0x23')](handleEntityNotFound(_0x238e06,null))[_0x6a11('0x23')](saveUpdates(_0x384471[_0x6a11('0x5c')],null))[_0x6a11('0x23')](respondWithResult(_0x238e06,null))[_0x6a11('0x2e')](handleError(_0x238e06,null));};exports[_0x6a11('0x39')]=function(_0x1eb110,_0x1d45ac){return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x1eb110[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x1d45ac,null))['then'](removeEntity(_0x1d45ac,null))[_0x6a11('0x2e')](handleError(_0x1d45ac,null));};exports[_0x6a11('0x66')]=function(_0x25328a,_0x4c4603){return db[_0x6a11('0x41')][_0x6a11('0x66')]()[_0x6a11('0x23')](respondWithResult(_0x4c4603,null))[_0x6a11('0x2e')](handleError(_0x4c4603,null));};exports[_0x6a11('0x67')]=function(_0x4f2748,_0x35409f,_0x4ee1fe){if(_0x4f2748[_0x6a11('0x5c')]['id']){delete _0x4f2748[_0x6a11('0x5c')]['id'];}return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x4f2748['params']['id']}})['then'](handleEntityNotFound(_0x35409f,null))[_0x6a11('0x23')](function(_0x2ec050){if(_0x2ec050){_0x4f2748[_0x6a11('0x5c')][_0x6a11('0x68')]=_0x2ec050['id'];return db[_0x6a11('0x69')][_0x6a11('0x5b')](_0x4f2748['body']);}})['then'](respondWithResult(_0x35409f,null))[_0x6a11('0x2e')](handleError(_0x35409f,null));};exports[_0x6a11('0x6a')]=function(_0x5aecdc,_0x47defc,_0x59580a){var _0x552413={'raw':![],'where':{}};var _0x24884a={};var _0x40e2e5={'count':0x0,'rows':[]};return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x5aecdc[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x47defc,null))[_0x6a11('0x23')](function(_0x3ae472){if(_0x3ae472){_0x24884a[_0x6a11('0x44')]=_[_0x6a11('0x46')](db[_0x6a11('0x69')][_0x6a11('0x59')]);_0x24884a[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x5aecdc[_0x6a11('0x45')]);_0x24884a['filters']=_['intersection'](_0x24884a['model'],_0x24884a[_0x6a11('0x45')]);_0x552413[_0x6a11('0x49')]=_[_0x6a11('0x47')](_0x24884a['model'],qs[_0x6a11('0x48')](_0x5aecdc['query']['fields']));_0x552413['attributes']=_0x552413[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x552413[_0x6a11('0x49')]:_0x24884a[_0x6a11('0x44')];if(!_0x5aecdc[_0x6a11('0x45')]['hasOwnProperty']('nolimit')){_0x552413[_0x6a11('0x4c')]=qs[_0x6a11('0x4c')](_0x5aecdc[_0x6a11('0x45')][_0x6a11('0x4c')]);_0x552413['offset']=qs[_0x6a11('0x33')](_0x5aecdc['query']['offset']);}_0x552413[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x5aecdc[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x552413[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_[_0x6a11('0x4f')](_0x5aecdc[_0x6a11('0x45')],_0x24884a[_0x6a11('0x50')]));_0x552413[_0x6a11('0x4e')][_0x6a11('0x68')]=_0x3ae472['id'];if(_0x5aecdc['query'][_0x6a11('0x51')]){_0x552413[_0x6a11('0x4e')]=_['merge'](_0x552413[_0x6a11('0x4e')],{'$or':_[_0x6a11('0x40')](_0x552413[_0x6a11('0x49')],function(_0x194754){var _0x1988ec={};_0x1988ec[_0x194754]={'$like':'%'+_0x5aecdc[_0x6a11('0x45')]['filter']+'%'};return _0x1988ec;})});}_0x552413=_['merge']({},_0x552413,_0x5aecdc[_0x6a11('0x5a')]);return db[_0x6a11('0x69')]['count']({'where':_0x552413[_0x6a11('0x4e')]})['then'](function(_0x5a9632){_0x40e2e5['count']=_0x5a9632;if(_0x5aecdc[_0x6a11('0x45')][_0x6a11('0x53')]){_0x552413[_0x6a11('0x6d')]=[{'all':!![]}];}return db[_0x6a11('0x69')][_0x6a11('0x54')](_0x552413);})[_0x6a11('0x23')](function(_0x18da79){_0x40e2e5['rows']=_0x18da79;return _0x40e2e5;});}})[_0x6a11('0x23')](respondWithFilteredResult(_0x47defc,_0x552413))['catch'](handleError(_0x47defc,null));};exports[_0x6a11('0x6e')]=function(_0x1f598a,_0x33a474,_0xa7460c){return db[_0x6a11('0x41')]['find']({'where':{'id':_0x1f598a['params']['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x33a474,null))[_0x6a11('0x23')](function(_0x25e0d1){if(_0x25e0d1){return _0x25e0d1[_0x6a11('0x6e')](_0x1f598a[_0x6a11('0x45')][_0x6a11('0x6f')]);}})[_0x6a11('0x23')](respondWithStatusCode(_0x33a474,null))[_0x6a11('0x2e')](handleError(_0x33a474,null));};exports['addAnswer']=function(_0x55c7de,_0x48acb1,_0xff402c){if(_0x55c7de[_0x6a11('0x5c')]['id']){delete _0x55c7de[_0x6a11('0x5c')]['id'];}return db[_0x6a11('0x41')]['find']({'where':{'id':_0x55c7de[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x48acb1,null))[_0x6a11('0x23')](function(_0x3d44b9){if(_0x3d44b9){_0x55c7de['body'][_0x6a11('0x68')]=_0x3d44b9['id'];return db['CannedAnswer'][_0x6a11('0x5b')](_0x55c7de[_0x6a11('0x5c')]);}})['then'](respondWithResult(_0x48acb1,null))[_0x6a11('0x2e')](handleError(_0x48acb1,null));};exports[_0x6a11('0x70')]=function(_0x51c0d1,_0x38b17f,_0x2f847b){var _0x24f75e={'raw':![],'where':{}};var _0x166357={};var _0x9b450e={'count':0x0,'rows':[]};return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x51c0d1[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x38b17f,null))['then'](function(_0x35c887){if(_0x35c887){_0x166357[_0x6a11('0x44')]=_[_0x6a11('0x46')](db[_0x6a11('0x71')][_0x6a11('0x59')]);_0x166357['query']=_[_0x6a11('0x46')](_0x51c0d1[_0x6a11('0x45')]);_0x166357[_0x6a11('0x50')]=_[_0x6a11('0x47')](_0x166357['model'],_0x166357[_0x6a11('0x45')]);_0x24f75e['attributes']=_['intersection'](_0x166357[_0x6a11('0x44')],qs['fields'](_0x51c0d1[_0x6a11('0x45')]['fields']));_0x24f75e[_0x6a11('0x49')]=_0x24f75e[_0x6a11('0x49')]['length']?_0x24f75e['attributes']:_0x166357['model'];if(!_0x51c0d1['query']['hasOwnProperty'](_0x6a11('0x4b'))){_0x24f75e['limit']=qs[_0x6a11('0x4c')](_0x51c0d1[_0x6a11('0x45')][_0x6a11('0x4c')]);_0x24f75e[_0x6a11('0x33')]=qs[_0x6a11('0x33')](_0x51c0d1[_0x6a11('0x45')][_0x6a11('0x33')]);}_0x24f75e[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x51c0d1[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x24f75e[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_[_0x6a11('0x4f')](_0x51c0d1[_0x6a11('0x45')],_0x166357[_0x6a11('0x50')]));_0x24f75e['where'][_0x6a11('0x68')]=_0x35c887['id'];if(_0x51c0d1[_0x6a11('0x45')][_0x6a11('0x51')]){_0x24f75e['where']=_[_0x6a11('0x52')](_0x24f75e[_0x6a11('0x4e')],{'$or':_['map'](_0x24f75e['attributes'],function(_0x1d1a15){var _0x69b72={};_0x69b72[_0x1d1a15]={'$like':'%'+_0x51c0d1[_0x6a11('0x45')]['filter']+'%'};return _0x69b72;})});}_0x24f75e=_[_0x6a11('0x52')]({},_0x24f75e,_0x51c0d1[_0x6a11('0x5a')]);return db[_0x6a11('0x71')][_0x6a11('0x32')]({'where':_0x24f75e['where']})[_0x6a11('0x23')](function(_0x47c78a){_0x9b450e['count']=_0x47c78a;if(_0x51c0d1[_0x6a11('0x45')]['includeAll']){_0x24f75e['include']=[{'all':!![]}];}return db[_0x6a11('0x71')][_0x6a11('0x54')](_0x24f75e);})[_0x6a11('0x23')](function(_0x54ba67){_0x9b450e[_0x6a11('0x55')]=_0x54ba67;return _0x9b450e;});}})['then'](respondWithFilteredResult(_0x38b17f,_0x24f75e))[_0x6a11('0x2e')](handleError(_0x38b17f,null));};exports[_0x6a11('0x72')]=function(_0xdf089a,_0x3c40a2,_0x397149){return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0xdf089a[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x3c40a2,null))[_0x6a11('0x23')](function(_0x59fc6b){if(_0x59fc6b){return _0x59fc6b[_0x6a11('0x72')](_0xdf089a[_0x6a11('0x45')][_0x6a11('0x6f')]);}})['then'](respondWithStatusCode(_0x3c40a2,null))[_0x6a11('0x2e')](handleError(_0x3c40a2,null));};exports[_0x6a11('0x73')]=function(_0xeba92c,_0x2f0e75,_0x14c724){_0xeba92c[_0x6a11('0x5c')][_0x6a11('0x74')]=_0xeba92c[_0x6a11('0x75')][_0x6a11('0x76')];return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0xeba92c[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x2f0e75,null))[_0x6a11('0x23')](saveUpdates(_0xeba92c['body'],null))[_0x6a11('0x23')](respondWithResult(_0x2f0e75,null))[_0x6a11('0x2e')](handleError(_0x2f0e75,null));};exports[_0x6a11('0x77')]=function(_0x3713f7,_0x1e8e60,_0x170ebc){_0x3713f7['body']['agentAvatar']=_0x3713f7['file'][_0x6a11('0x76')];return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x3713f7['params']['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x1e8e60,null))[_0x6a11('0x23')](saveUpdates(_0x3713f7[_0x6a11('0x5c')],null))['then'](respondWithResult(_0x1e8e60,null))[_0x6a11('0x2e')](handleError(_0x1e8e60,null));};exports[_0x6a11('0x78')]=function(_0x25befa,_0x2674c8,_0x251f27){_0x25befa[_0x6a11('0x5c')][_0x6a11('0x79')]=_0x25befa[_0x6a11('0x75')][_0x6a11('0x76')];return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x25befa['params']['id']}})['then'](handleEntityNotFound(_0x2674c8,null))['then'](saveUpdates(_0x25befa['body'],null))['then'](respondWithResult(_0x2674c8,null))['catch'](handleError(_0x2674c8,null));};exports[_0x6a11('0x7a')]=function(_0x3cb73b,_0x587c5d,_0x7a0b8){_0x3cb73b[_0x6a11('0x5c')][_0x6a11('0x7b')]=_0x3cb73b['file'][_0x6a11('0x76')];return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x3cb73b[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x587c5d,null))[_0x6a11('0x23')](saveUpdates(_0x3cb73b[_0x6a11('0x5c')],null))[_0x6a11('0x23')](respondWithResult(_0x587c5d,null))['catch'](handleError(_0x587c5d,null));};exports[_0x6a11('0x7c')]=function(_0x5ba127,_0x30b649,_0x3a4571){var _0x4242ce=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0x42955b={'where':{'id':_0x5ba127['params']['id']},'attributes':['id',_0x6a11('0x74')],'raw':!![]};var _0x4aa5e4=![];return require(_0x6a11('0x7d'))['getLicense']()[_0x6a11('0x23')](function(_0x4a66fe){if(_0x4a66fe){_0x4aa5e4=_0x4a66fe[_0x6a11('0x7e')];}})[_0x6a11('0x23')](function(){return db[_0x6a11('0x41')][_0x6a11('0x64')](_0x42955b);})[_0x6a11('0x23')](handleEntityNotFound(_0x30b649,null))[_0x6a11('0x23')](function(_0x4514fe){if(_0x4514fe){if(!_[_0x6a11('0x7f')](_0x4514fe[_0x6a11('0x74')])){if(fs['existsSync'](path['join'](config[_0x6a11('0x80')],'server/files/images/logos/',_0x4514fe[_0x6a11('0x74')]))&&_0x4aa5e4){_0x4242ce=path[_0x6a11('0x81')](config[_0x6a11('0x80')],_0x6a11('0x82'),_0x4514fe[_0x6a11('0x74')]);}}return _0x30b649[_0x6a11('0x83')](_0x4242ce);}})[_0x6a11('0x2e')](handleError(_0x30b649,null));};exports[_0x6a11('0x84')]=function(_0x453acd,_0x399792,_0x330d03){var _0x4da06d=path[_0x6a11('0x81')](config[_0x6a11('0x80')],'server/files/images/avatars/default_avatar.png');var _0x3bd0e3={'where':{'id':_0x453acd[_0x6a11('0x65')]['id']},'attributes':['id',_0x6a11('0x85')],'raw':!![]};return db[_0x6a11('0x41')][_0x6a11('0x64')](_0x3bd0e3)['then'](handleEntityNotFound(_0x399792,null))[_0x6a11('0x23')](function(_0x4c73b0){if(_0x4c73b0){if(!_[_0x6a11('0x7f')](_0x4c73b0[_0x6a11('0x85')])){if(fs[_0x6a11('0x86')](path[_0x6a11('0x81')](config[_0x6a11('0x80')],'server/files/images/avatars/',_0x4c73b0[_0x6a11('0x85')]))){_0x4da06d=path['join'](config[_0x6a11('0x80')],_0x6a11('0x87'),_0x4c73b0['agentAvatar']);}}return _0x399792['download'](_0x4da06d);}})['catch'](handleError(_0x399792,null));};exports[_0x6a11('0x88')]=function(_0x14f406,_0x11b747,_0x28292f){var _0x294ace=path['join'](config[_0x6a11('0x80')],'server/files/images/avatars/customer_avatar.png');var _0x148236={'where':{'id':_0x14f406[_0x6a11('0x65')]['id']},'attributes':['id',_0x6a11('0x79'),_0x6a11('0x89')],'raw':!![]};return db[_0x6a11('0x41')]['find'](_0x148236)['then'](handleEntityNotFound(_0x11b747,null))[_0x6a11('0x23')](function(_0x428ef1){if(_0x428ef1){if(!_[_0x6a11('0x7f')](_0x428ef1[_0x6a11('0x79')])){if(fs[_0x6a11('0x86')](path[_0x6a11('0x81')](config[_0x6a11('0x80')],_0x6a11('0x87'),_0x428ef1[_0x6a11('0x79')]))&&_0x428ef1[_0x6a11('0x89')]){_0x294ace=path[_0x6a11('0x81')](config['root'],_0x6a11('0x87'),_0x428ef1['customerAvatar']);}}return _0x11b747['download'](_0x294ace);}})[_0x6a11('0x2e')](handleError(_0x11b747,null));};exports['getSystemAvatar']=function(_0x2f81ce,_0x513d56,_0x2d3db0){var _0x19ba39=path[_0x6a11('0x81')](config[_0x6a11('0x80')],_0x6a11('0x8a'));var _0x47f4a1={'where':{'id':_0x2f81ce[_0x6a11('0x65')]['id']},'attributes':['id',_0x6a11('0x7b')],'raw':!![]};return db[_0x6a11('0x41')][_0x6a11('0x64')](_0x47f4a1)[_0x6a11('0x23')](handleEntityNotFound(_0x513d56,null))[_0x6a11('0x23')](function(_0x40d32f){if(_0x40d32f){if(!_[_0x6a11('0x7f')](_0x40d32f['systemAvatar'])){if(fs[_0x6a11('0x86')](path[_0x6a11('0x81')](config[_0x6a11('0x80')],'server/files/images/avatars/',_0x40d32f[_0x6a11('0x7b')]))){_0x19ba39=path[_0x6a11('0x81')](config[_0x6a11('0x80')],_0x6a11('0x87'),_0x40d32f['systemAvatar']);}}return _0x513d56['download'](_0x19ba39);}})[_0x6a11('0x2e')](handleError(_0x513d56,null));};exports['notify']=function(_0x4c030a,_0x104118,_0x5974bd){var _0x3e88d9=require(_0x6a11('0x8b'));var _0x29323c=new _0x3e88d9();var _0x28b2e0=_0x29323c[_0x6a11('0x8c')](_0x4c030a[_0x6a11('0x8d')]['user-agent'])[_0x6a11('0x8e')]();var _0xbe964d={'body':_0x4c030a[_0x6a11('0x5c')],'channel':_0x6a11('0x8f')};var _0x3d2778=[];var _0x8bbe20=[];var _0x347ed3={};var _0xa23c90=![];return db[_0x6a11('0x90')][_0x6a11('0x66')]()['then'](function(_0x2f2f49){if(!_0x2f2f49){throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))](_0x6a11('0x91'));}_0x3d2778=_[_0x6a11('0x92')](_[_0x6a11('0x46')](_0x2f2f49),[_0x6a11('0x93'),_0x6a11('0x94')]);_0x8bbe20=_[_0x6a11('0x92')](_[_0x6a11('0x46')](_0x2f2f49),['createdAt','updatedAt',_0x6a11('0x95'),_0x6a11('0x96')]);if(_0x4c030a[_0x6a11('0x5c')]['id']){delete _0x4c030a[_0x6a11('0x5c')]['id'];}if(_[_0x6a11('0x7f')](_0x4c030a['body'][_0x6a11('0x97')])){throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))]('from\x20is\x20mandatory');}if(_[_0x6a11('0x7f')](_0x4c030a[_0x6a11('0x5c')]['body'])||_0x4c030a[_0x6a11('0x5c')][_0x6a11('0x5c')]===''){throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))](_0x6a11('0x98'));}if(_[_0x6a11('0x7f')](_0x4c030a[_0x6a11('0x5c')]['mapKey'])){throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))](_0x6a11('0x99')+_0x8bbe20);}if(!_[_0x6a11('0x9a')](_0x8bbe20,_0x4c030a[_0x6a11('0x5c')][_0x6a11('0x9b')])){throw new db[(_0x6a11('0x1f'))]['ValidationError'](_0x6a11('0x9c')+_0x8bbe20);}_0x347ed3[_0x4c030a['body'][_0x6a11('0x9b')]]=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0x97')];})[_0x6a11('0x23')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x4c030a['params']['id']},'include':[{'model':db[_0x6a11('0x9d')],'as':_0x6a11('0x9e'),'include':[{'model':db[_0x6a11('0x90')],'as':'Contacts','where':_0x347ed3,'limit':0x1,'order':[['updatedAt',_0x6a11('0x9f')]]}]},{'model':db[_0x6a11('0xa0')],'as':_0x6a11('0xa1')}]});})[_0x6a11('0x23')](handleEntityNotFound(_0x104118,null))[_0x6a11('0x23')](function(_0x270855){if(_0x270855&&_0x270855[_0x6a11('0x9e')]){_0xbe964d[_0x6a11('0xa2')]=_0x270855;_0xbe964d[_0x6a11('0xa3')]=_0x270855[_0x6a11('0xa1')];_0xbe964d[_0x6a11('0xa4')]=_0x270855[_0x6a11('0x9e')];_0xbe964d[_0x6a11('0xa3')]=_['orderBy'](_0xbe964d[_0x6a11('0xa3')],[_0x6a11('0xa5')],[_0x6a11('0xa6')]);if(_0xbe964d[_0x6a11('0xa2')][_0x6a11('0xa1')]){delete _0xbe964d[_0x6a11('0xa2')][_0x6a11('0xa1')];}if(_0xbe964d[_0x6a11('0xa2')]['List']&&_0xbe964d['account'][_0x6a11('0x9e')][_0x6a11('0xa7')][_0x6a11('0x4a')]){return _0xbe964d['account'][_0x6a11('0x9e')][_0x6a11('0xa7')][0x0];}var _0x261b8f=_[_0x6a11('0xa8')](_0x4c030a[_0x6a11('0x5c')],{'firstName':_0x4c030a['body']['from'],'ListId':_0x270855[_0x6a11('0x96')]});_0x261b8f[_0x4c030a['body'][_0x6a11('0x9b')]]=_0x4c030a[_0x6a11('0x5c')]['from'];return db['CmContact'][_0x6a11('0x5b')](_0x261b8f,{'fields':_0x3d2778,'raw':!![]});}})['then'](handleEntityNotFound(_0x104118,null))[_0x6a11('0x23')](function(_0x5c11bd){_0xbe964d['contact']=_0x5c11bd;var _0x894730=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xa9')];if(_0x4c030a[_0x6a11('0x8d')]['cf-connecting-ip']){_0x894730=_0x4c030a[_0x6a11('0x8d')][_0x6a11('0xaa')];}else if(_0x4c030a['headers'][_0x6a11('0xab')]){_0x894730=_[_0x6a11('0xac')](_0x4c030a[_0x6a11('0x8d')][_0x6a11('0xab')][_0x6a11('0xad')](','));}if(_0x5c11bd){var _0x34729b={'ContactId':_0x5c11bd['id'],'ChatWebsiteId':_0x4c030a[_0x6a11('0x65')]['id'],'from':(_0x5c11bd[_0x6a11('0xae')]||'')+'\x20'+(_0x5c11bd['lastName']||''),'customerIp':_0x894730,'customerPort':_0x4c030a[_0x6a11('0x8d')][_0x6a11('0xaf')]?_0x4c030a[_0x6a11('0x8d')][_0x6a11('0xaf')]:null,'referer':_0x4c030a['body'][_0x6a11('0xb0')],'browserName':_0x28b2e0[_0x6a11('0xb1')][_0x6a11('0x3d')]&&_0x28b2e0[_0x6a11('0xb1')][_0x6a11('0xb2')]?util[_0x6a11('0xb3')](_0x6a11('0xb4'),_0x28b2e0[_0x6a11('0xb1')][_0x6a11('0x3d')],_0x28b2e0['browser'][_0x6a11('0xb2')]):_0x6a11('0xb5'),'browserVersion':_0x28b2e0[_0x6a11('0xb1')]['version']||_0x6a11('0xb5'),'osName':util[_0x6a11('0xb3')](_0x6a11('0xb4'),_0x28b2e0['os'][_0x6a11('0x3d')],_0x28b2e0['os'][_0x6a11('0xb2')]),'osVersion':_0x28b2e0['os'][_0x6a11('0xb2')],'deviceModel':_0x28b2e0['device'][_0x6a11('0x44')]&&_0x28b2e0[_0x6a11('0xb6')][_0x6a11('0xb7')]?util[_0x6a11('0xb3')](_0x6a11('0xb8'),_0x28b2e0[_0x6a11('0xb6')][_0x6a11('0x44')],_0x28b2e0['device'][_0x6a11('0xb7')],_0x28b2e0[_0x6a11('0xb6')][_0x6a11('0x43')]):null,'deviceVendor':_0x28b2e0[_0x6a11('0xb6')][_0x6a11('0xb7')],'deviceType':_0x28b2e0[_0x6a11('0xb6')][_0x6a11('0x43')],'formData':JSON[_0x6a11('0x29')](_0x4c030a[_0x6a11('0x5c')])};var _0x647031={'ChatWebsiteId':_0x4c030a[_0x6a11('0x65')]['id'],'closed':![]};if(_0x4c030a['body'][_0x6a11('0xb9')]){_0x647031[_0x6a11('0xb9')]=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xb9')];return db[_0x6a11('0xba')][_0x6a11('0x64')]({'where':_0x647031})[_0x6a11('0x23')](function(_0x101dc9){if(_0x101dc9){return[_0x101dc9,![]];}_0x34729b[_0x6a11('0xb9')]=_0x4c030a['body']['threadId'];_0x34729b[_0x6a11('0xbb')]=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xbb')];return db[_0x6a11('0xba')]['create'](_0x34729b)['then'](function(_0x596c9d){return[_0x596c9d,!![]];});});}_0x647031[_0x6a11('0xbc')]=_0x5c11bd['id'];if(_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xbd')]&&_0x4c030a['body'][_0x6a11('0xbd')]['id']){_0x647031['id']=_0x4c030a[_0x6a11('0x5c')]['interaction']['id'];return db[_0x6a11('0xba')]['find']({'where':_0x647031})['then'](function(_0x3effa6){if(_0x3effa6){return[_0x3effa6,![]];}return db[_0x6a11('0xba')][_0x6a11('0x5b')](_0x34729b)['then'](function(_0x225fb3){return[_0x225fb3,!![]];});});}return db[_0x6a11('0xba')]['create'](_0x34729b)[_0x6a11('0x23')](function(_0x466fe5){return[_0x466fe5,!![]];});}})[_0x6a11('0xbe')](function(_0x253f51,_0x26783e){if(_0x253f51){_0xa23c90=_0x26783e;if(!_0x26783e){var _0x1540b8={'from':(_0xbe964d[_0x6a11('0xbf')][_0x6a11('0xae')]||'')+'\x20'+(_0xbe964d[_0x6a11('0xbf')][_0x6a11('0xc0')]||'')};if(_0x4c030a[_0x6a11('0x5c')]['threadId']&&_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xc1')]&&_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xb9')]!=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xc1')]){_0x1540b8[_0x6a11('0xb9')]=_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xc1')];}return _0x253f51[_0x6a11('0x38')](_0x1540b8);}else{return _0x253f51;}}})[_0x6a11('0x23')](function(_0xc9560b){_0xbe964d[_0x6a11('0xbd')]=_0xc9560b[_0x6a11('0x3a')]({'plain':!![]});_0xbe964d[_0x6a11('0xbd')][_0x6a11('0xc2')]=_0xa23c90;if(_0xbe964d[_0x6a11('0xbd')][_0x6a11('0xc2')]){if(_0xbe964d['account']['autoclose']){_0xbe964d[_0x6a11('0xa3')]['push']({'id':0x0,'priority':_0xbe964d[_0x6a11('0xa3')][_0x6a11('0x4a')]+0x1,'app':_0x6a11('0xc3'),'appdata':_0x6a11('0xc4'),'interval':'*,*,*,*'});}}return db[_0x6a11('0xc5')][_0x6a11('0x5b')]({'body':_0x4c030a['body'][_0x6a11('0x5c')],'ChatWebsiteId':_0x4c030a[_0x6a11('0x65')]['id'],'ChatInteractionId':_0xc9560b['id'],'direction':'in','ContactId':_0xbe964d[_0x6a11('0xbf')]['id'],'AttachmentId':_0x4c030a[_0x6a11('0x5c')][_0x6a11('0xc6')]});})[_0x6a11('0x23')](function(_0x144844){_0xbe964d[_0x6a11('0x2c')]=_0x144844;if(_0xbe964d[_0x6a11('0xbd')][_0x6a11('0xc7')]){return db[_0x6a11('0xc8')][_0x6a11('0x64')]({'attributes':['id',_0x6a11('0x3d')],'where':{'id':_0xbe964d[_0x6a11('0xbd')]['UserId']}})[_0x6a11('0x23')](function(_0x4899df){if(_0x4899df){_0xbe964d['applications'][_0x6a11('0xc9')]({'id':0x0,'priority':0x0,'app':_0x6a11('0xca'),'appdata':_0x4899df[_0x6a11('0x3d')]+','+(_0xbe964d[_0x6a11('0xa2')]['waitForTheAssignedAgent']||0xa),'interval':_0x6a11('0xcb')});_0xbe964d[_0x6a11('0xcc')]=!![];}return respondWithRpcPromise(_0x6a11('0xcd'),_0x6a11('0xce'),_0xbe964d);});}return respondWithRpcPromise(_0x6a11('0xcd'),_0x6a11('0xce'),_0xbe964d);})[_0x6a11('0x23')](function(_0x3a8d61){respondWithRpcPromise(_0x6a11('0xcf'),_0x6a11('0xcf'),{'event':_0x6a11('0xd0'),'message':_0x3a8d61},client9002);return _0x3a8d61;})['then'](respondWithResult(_0x104118,null))[_0x6a11('0x2e')](handleError(_0x104118,null));};exports[_0x6a11('0xd1')]=function(_0x4b01c2,_0x20921e,_0x32f77a){var _0x18608d,_0x5e7f95,_0x1225ea;var _0x4f94c9=[];var _0xfd0c34=[];var _0x307785={};return db[_0x6a11('0x90')][_0x6a11('0x66')]()[_0x6a11('0x23')](function(_0x4e2e52){if(!_0x4e2e52){throw new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))]('no\x20available\x20attributes');}_0xfd0c34=_[_0x6a11('0x92')](_[_0x6a11('0x46')](_0x4e2e52),['createdAt','updatedAt']);_0x4f94c9=_['difference'](_['keys'](_0x4e2e52),['createdAt','updatedAt','CompanyId',_0x6a11('0x96')]);if(_0x4b01c2['body']['id']){delete _0x4b01c2['body']['id'];}if(_[_0x6a11('0x7f')](_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0x97')])){throw _0x20921e[_0x6a11('0x30')](0x1f4)[_0x6a11('0x3e')](new db[(_0x6a11('0x1f'))][(_0x6a11('0x20'))](_0x6a11('0xd2')));}if(_[_0x6a11('0x7f')](_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0x5c')])||_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0x5c')]===''){throw _0x20921e[_0x6a11('0x30')](0x1f4)[_0x6a11('0x3e')](new db['Sequelize']['ValidationError'](_0x6a11('0x98')));}if(_[_0x6a11('0x7f')](_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0xd3')])){throw _0x20921e[_0x6a11('0x30')](0x1f4)[_0x6a11('0x3e')](new db['Sequelize'][(_0x6a11('0x20'))](_0x6a11('0xd4')+_0x4f94c9));}if(!_[_0x6a11('0x9a')](_0x4f94c9,_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0xd3')])){throw _0x20921e[_0x6a11('0x30')](0x1f4)['send'](new db[(_0x6a11('0x1f'))]['ValidationError'](_0x6a11('0xd5')+_0x4f94c9));}_0x307785[_0x4b01c2['body']['mapKeyOffline']]=_0x4b01c2[_0x6a11('0x5c')]['from'];})['then'](function(){return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x4b01c2['params']['id']},'include':[{'model':db[_0x6a11('0x9d')],'as':_0x6a11('0x9e')}]});})['then'](handleEntityNotFound(_0x20921e,null))['then'](function(_0x4a8698){if(_0x4a8698&&_0x4a8698[_0x6a11('0x9e')]){_0x5e7f95=_0x4a8698;var _0x3be7fc=_['defaults'](_0x4b01c2[_0x6a11('0x5c')],{'firstName':_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0x97')],'phone':_0x4b01c2[_0x6a11('0x5c')]['from'],'ListId':_0x4a8698[_0x6a11('0x96')]});_0x3be7fc[_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0xd3')]]=_0x4b01c2['body'][_0x6a11('0x97')];return db[_0x6a11('0x90')][_0x6a11('0xd6')]({'where':_0x307785,'defaults':_0x3be7fc});}})[_0x6a11('0xbe')](function(_0x32e022){if(_0x32e022){_0x1225ea=_0x32e022;var _0x5be1c0=fs[_0x6a11('0xd7')](path[_0x6a11('0x81')](config[_0x6a11('0x80')],'server/files/templates/chatOfflineMessage.ejs'),_0x6a11('0xd8'));var _0x51ea6a=ejs['render'](_0x5be1c0,{'body':_[_0x6a11('0xd9')](_0x4b01c2[_0x6a11('0x5c')][_0x6a11('0x5c')]),'bodyTitle':_0x5e7f95[_0x6a11('0xda')]});return db['ChatOfflineMessage'][_0x6a11('0x5b')]({'body':_0x51ea6a,'ContactId':_0x32e022['id'],'ChatWebsiteId':_0x5e7f95['id']});}})[_0x6a11('0x23')](function(_0x5010fa){if(_0x5010fa){_0x18608d=_0x5010fa;return db[_0x6a11('0xdb')][_0x6a11('0x6b')]({'where':{'service':!![]},'include':[{'model':db[_0x6a11('0xdc')],'as':_0x6a11('0xdd'),'raw':!![]}]});}})['then'](function(_0x5ed113){if(_0x5ed113&&_0x5ed113['Smtp']&&_0x5e7f95['forwardOfflineAddress']){var _0x5b6fa8={'tls':{'rejectUnauthorized':![]}};if(_0x5ed113[_0x6a11('0xdd')]['service']){_0x5b6fa8['service']=_0x5ed113[_0x6a11('0xdd')][_0x6a11('0xde')];}else{_0x5b6fa8[_0x6a11('0xdf')]=_0x5ed113['Smtp'][_0x6a11('0xdf')];_0x5b6fa8['port']=_0x5ed113['Smtp'][_0x6a11('0xe0')];_0x5b6fa8[_0x6a11('0xe1')]=_0x5ed113['Smtp'][_0x6a11('0xe1')];}if(_0x5ed113[_0x6a11('0xdd')][_0x6a11('0xe2')]){_0x5b6fa8[_0x6a11('0xe3')]={'user':_0x5ed113[_0x6a11('0xdd')][_0x6a11('0x5d')],'pass':_0x5ed113[_0x6a11('0xdd')][_0x6a11('0xe4')]};}return respondWithRpcPromise(_0x6a11('0xe5'),_0x6a11('0xe6'),{'account':_0x5b6fa8,'message':{'from':util[_0x6a11('0xb3')](_0x6a11('0xe7'),_0x5ed113[_0x6a11('0x3d')],_0x5ed113[_0x6a11('0xe8')]||_0x5ed113[_0x6a11('0xdd')][_0x6a11('0x5d')]),'to':_0x5e7f95[_0x6a11('0xe9')],'subject':_0x5e7f95[_0x6a11('0xea')],'text':_0x18608d[_0x6a11('0x5c')]}},client9003)['then'](function(){return _0x18608d;})['catch'](function(_0x222c9a){console[_0x6a11('0x2a')](_0x222c9a);});}})[_0x6a11('0x23')](function(){if(_0x18608d){return _0x18608d;}})['then'](respondWithResult(_0x20921e,null))[_0x6a11('0x2e')](handleError(_0x20921e,null));};exports[_0x6a11('0xeb')]=function(_0x47be27,_0x100070,_0x20d4d7){return db[_0x6a11('0xba')]['find']({'where':{'id':_0x47be27[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x100070,null))[_0x6a11('0x23')](function(_0x3a1d90){if(_0x3a1d90){return _0x3a1d90['addInteraction'](_0x47be27[_0x6a11('0x5c')][_0x6a11('0x6f')],_[_0x6a11('0xec')](_0x47be27['body'],[_0x6a11('0x6f'),'id'])||{});}})[_0x6a11('0x23')](respondWithResult(_0x100070,null))[_0x6a11('0x2e')](handleError(_0x100070,null));};exports[_0x6a11('0xed')]=function(_0x1a8385,_0x273303,_0x576c56){var _0x5d21fd={'raw':![],'where':{}};var _0x5d0942={};var _0x59b96b={'count':0x0,'rows':[]};return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x1a8385[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x273303,null))[_0x6a11('0x23')](function(_0x35f7b9){if(_0x35f7b9){_0x5d0942[_0x6a11('0x44')]=_[_0x6a11('0x46')](db[_0x6a11('0xba')][_0x6a11('0x59')]);_0x5d0942[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x1a8385['query']);_0x5d0942[_0x6a11('0x50')]=_[_0x6a11('0x47')](_0x5d0942[_0x6a11('0x44')],_0x5d0942['query']);_0x5d21fd['attributes']=_[_0x6a11('0x47')](_0x5d0942[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0x1a8385[_0x6a11('0x45')]['fields']));_0x5d21fd['attributes']=_0x5d21fd[_0x6a11('0x49')]['length']?_0x5d21fd[_0x6a11('0x49')]:_0x5d0942['model'];if(!_0x1a8385[_0x6a11('0x45')][_0x6a11('0xee')](_0x6a11('0x4b'))){_0x5d21fd[_0x6a11('0x4c')]=qs['limit'](_0x1a8385['query'][_0x6a11('0x4c')]);_0x5d21fd[_0x6a11('0x33')]=qs['offset'](_0x1a8385[_0x6a11('0x45')][_0x6a11('0x33')]);}_0x5d21fd['order']=qs[_0x6a11('0x4d')](_0x1a8385[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x5d21fd[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_[_0x6a11('0x4f')](_0x1a8385[_0x6a11('0x45')],_0x5d0942[_0x6a11('0x50')]));_0x5d21fd[_0x6a11('0x4e')][_0x6a11('0x68')]=_0x35f7b9['id'];if(_0x1a8385[_0x6a11('0x45')]['filter']){_0x5d21fd[_0x6a11('0x4e')]=_[_0x6a11('0x52')](_0x5d21fd['where'],{'$or':_[_0x6a11('0x40')](_0x5d21fd[_0x6a11('0x49')],function(_0x31e99){var _0x5f4e00={};_0x5f4e00[_0x31e99]={'$like':'%'+_0x1a8385[_0x6a11('0x45')][_0x6a11('0x51')]+'%'};return _0x5f4e00;})});}_0x5d21fd=_[_0x6a11('0x52')]({},_0x5d21fd,_0x1a8385[_0x6a11('0x5a')]);return db['ChatInteraction']['count']({'where':_0x5d21fd[_0x6a11('0x4e')]})[_0x6a11('0x23')](function(_0x12f4ca){_0x59b96b[_0x6a11('0x32')]=_0x12f4ca;if(_0x1a8385[_0x6a11('0x45')]['includeAll']){_0x5d21fd[_0x6a11('0x6d')]=[{'model':db[_0x6a11('0x90')],'as':_0x6a11('0xef'),'required':![]},{'model':db[_0x6a11('0xc8')],'as':_0x6a11('0xf0'),'attributes':[_0x6a11('0x3d'),_0x6a11('0xf1'),_0x6a11('0xf2')],'required':![]},{'model':db[_0x6a11('0xf3')],'as':_0x6a11('0xf4'),'attributes':['id',_0x6a11('0x3d'),_0x6a11('0xf5')],'where':_0x1a8385[_0x6a11('0x45')][_0x6a11('0xf6')]?{'id':_0x1a8385[_0x6a11('0x45')][_0x6a11('0xf6')]}:undefined,'required':_0x1a8385[_0x6a11('0x45')]['tag']?!![]:![]}];}return db[_0x6a11('0xba')][_0x6a11('0x54')](_0x5d21fd);})[_0x6a11('0x23')](function(_0x32384e){_0x59b96b[_0x6a11('0x55')]=_0x32384e;return _0x59b96b;});}})[_0x6a11('0x23')](respondWithFilteredResult(_0x273303,_0x5d21fd))[_0x6a11('0x2e')](handleError(_0x273303,null));};function iftimePromise(_0x3cbe02,_0x468e49){return respondWithRpcPromise(_0x6a11('0xf7'),_0x6a11('0xf8'),{'command':_0x468e49[_0x6a11('0xf9')]?util[_0x6a11('0xb3')](_0x6a11('0xfa'),_0x3cbe02[_0x6a11('0xfb')],_0x468e49[_0x6a11('0xf9')]):util['format']('iftime\x20%s',_0x3cbe02[_0x6a11('0xfb')])},client9002)[_0x6a11('0x23')](function(_0x29e40a){var _0x5ca58c=_0x29e40a&&_0x29e40a['indexOf'](_0x6a11('0xfc'))>=0x0?!![]:![];logger[_0x6a11('0x24')](_0x6a11('0xfd'),_0x468e49['id'],_0x3cbe02['id'],_0x3cbe02[_0x6a11('0xfb')],_0x5ca58c?_0x6a11('0xfe'):_0x6a11('0xff'),_0x468e49[_0x6a11('0xf9')]?_0x468e49[_0x6a11('0xf9')]:_0x6a11('0x100'));return _0x5ca58c;})[_0x6a11('0x2e')](function(_0x5549cc){logger[_0x6a11('0x2a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x468e49['id'],_0x3cbe02['id'],_0x3cbe02[_0x6a11('0xfb')],util[_0x6a11('0x101')](_0x5549cc,{'showHidden':![],'depth':null}),_0x468e49[_0x6a11('0xf9')]?_0x468e49['timezone']:_0x6a11('0x100'));return![];});}exports[_0x6a11('0xf8')]=function(_0x6fa38a,_0x5f08f9,_0x4c8535){var _0xb4e136=0x0;var _0x365ae9=0x0;var _0x4f70c0=![];var _0x287626;var _0x33cb81;return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x6fa38a['params']['id']},'include':[{'model':db[_0x6a11('0x102')],'as':_0x6a11('0x102'),'include':[{'model':db[_0x6a11('0x102')],'as':_0x6a11('0x103'),'attributes':['id',_0x6a11('0xfb')],'raw':!![]}]}]})[_0x6a11('0x23')](handleEntityNotFound(_0x5f08f9,null))[_0x6a11('0x23')](function(_0x435084){if(_0x435084){_0x287626=_0x435084;return _0x435084[_0x6a11('0x104')]({'raw':!![]});}})[_0x6a11('0x23')](function(_0x4a2b9f){if(_0x287626){if(_0x4a2b9f){_0x33cb81=_0x4a2b9f;}}return require('../../config/license/util')[_0x6a11('0x105')]();})[_0x6a11('0x23')](function(_0x52cdc6){if(_0x52cdc6){_0x365ae9=_0x52cdc6[_0x6a11('0x106')];_0x4f70c0=_0x52cdc6[_0x6a11('0x7e')];}})[_0x6a11('0x23')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})[_0x6a11('0x23')](function(_0x225820){_0xb4e136=_0x225820;if(_0x365ae9&&_0x225820>_0x365ae9){return db[_0x6a11('0x107')][_0x6a11('0x6b')]({'where':{'id':0x1}})[_0x6a11('0x23')](function(_0x1b3a43){if(_0x1b3a43){_0x1b3a43['increment']('chatLicenseExceeded');}});}})['then'](function(){if(_0x287626[_0x6a11('0x102')]&&_0x287626[_0x6a11('0x102')][_0x6a11('0x103')]){var _0x512c1b=[];for(var _0x223a77=0x0;_0x223a77<_0x287626[_0x6a11('0x102')]['Intervals'][_0x6a11('0x4a')];_0x223a77++){var _0x55f711=_0x287626[_0x6a11('0x102')][_0x6a11('0x103')][_0x223a77][_0x6a11('0x3a')]({'plain':!![]});_0x512c1b[_0x6a11('0x108')](iftimePromise(_0x55f711,_0x287626));}return BPromise[_0x6a11('0x109')](_0x512c1b)[_0x6a11('0x23')](function(_0x14a996){return _[_0x6a11('0x10a')](_0x14a996);});}else{return!![];}})['then'](function(_0x5f07da){var _0x1c0130=fs[_0x6a11('0xd7')](path[_0x6a11('0x81')](config[_0x6a11('0x80')],_0x6a11('0x10b')),'utf8');var _0x211c53={'remote':_0x287626[_0x6a11('0x10c')],'query':querystring['stringify'](_[_0x6a11('0x52')](_0x287626[_0x6a11('0x3a')]({'plain':!![]}),{'customerIp':_0x6fa38a[_0x6a11('0x8d')][_0x6a11('0xab')]||_0x6fa38a[_0x6a11('0x8d')]['x-real-ip']||_0x6fa38a[_0x6a11('0x10d')]['remoteAddress']||_0x6fa38a['ip'],'referer':_0x6fa38a['headers'][_0x6a11('0xb0')],'openedInteractions':_0xb4e136,'maxInteractions':_0x365ae9,'virtual':_0x4f70c0[_0x6a11('0x106')],'online':_0x5f07da,'custom':_0x4f70c0}))[_0x6a11('0x10e')](/'/g,'\x5c\x27')};_0x5f08f9[_0x6a11('0x3e')](ejs[_0x6a11('0x10f')](Mustache['render'](_0x1c0130,_0x211c53),{'proactiveActions':_0x33cb81,'alignment':_0x287626[_0x6a11('0x110')],'verticalAlignment':_0x287626['verticalAlignment'],'div_color':_0x287626['color'],'text_color':_0x287626['textColor']}));})['catch'](handleError(_0x5f08f9,null));};exports[_0x6a11('0x111')]=function(_0x472454,_0x25d8ef,_0xdae604){return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x472454[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x25d8ef,null))[_0x6a11('0x23')](function(_0x3dc4da){if(_0x3dc4da){return db[_0x6a11('0x112')][_0x6a11('0x113')](function(_0x497f8b){return db[_0x6a11('0xa0')][_0x6a11('0x39')]({'where':{'ChatWebsiteId':_0x472454[_0x6a11('0x65')]['id']},'transaction':_0x497f8b})[_0x6a11('0x23')](function(_0x26be69){var _0x19edc7=_[_0x6a11('0x40')](_0x472454['body'],function(_0x360a04){_0x360a04[_0x6a11('0x68')]=_0x472454[_0x6a11('0x65')]['id'];return _0x360a04;});return db[_0x6a11('0xa0')]['bulkCreate'](_0x19edc7,{'transaction':_0x497f8b});});})['then'](function(){return db[_0x6a11('0xa0')][_0x6a11('0x114')]({'where':{'ChatWebsiteId':_0x472454['params']['id']},'order':'priority'});});}})[_0x6a11('0x23')](respondWithResult(_0x25d8ef,null))['catch'](handleError(_0x25d8ef,null));};exports[_0x6a11('0x115')]=function(_0x142cde,_0x447fe3,_0x58d99a){var _0x392753={};var _0x148b36={};var _0x12675e;var _0x3e3641;return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x142cde['params']['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x447fe3,null))[_0x6a11('0x23')](function(_0x28c21b){if(_0x28c21b){_0x12675e=_0x28c21b;_0x148b36[_0x6a11('0x44')]=_[_0x6a11('0x46')](db['ChatApplication'][_0x6a11('0x59')]);_0x148b36[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x142cde[_0x6a11('0x45')]);_0x148b36[_0x6a11('0x50')]=_[_0x6a11('0x47')](_0x148b36[_0x6a11('0x44')],_0x148b36[_0x6a11('0x45')]);_0x392753[_0x6a11('0x49')]=_[_0x6a11('0x47')](_0x148b36[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0x142cde['query']['fields']));_0x392753[_0x6a11('0x49')]=_0x392753[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x392753[_0x6a11('0x49')]:_0x148b36[_0x6a11('0x44')];_0x392753[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x142cde['query'][_0x6a11('0x4d')]);_0x392753[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_[_0x6a11('0x4f')](_0x142cde[_0x6a11('0x45')],_0x148b36['filters']));if(_0x142cde[_0x6a11('0x45')][_0x6a11('0x51')]){_0x392753[_0x6a11('0x4e')]=_[_0x6a11('0x52')](_0x392753['where'],{'$or':_[_0x6a11('0x40')](_0x392753[_0x6a11('0x49')],function(_0x2813e2){var _0x56cfd5={};_0x56cfd5[_0x2813e2]={'$like':'%'+_0x142cde[_0x6a11('0x45')][_0x6a11('0x51')]+'%'};return _0x56cfd5;})});}_0x392753=_['merge']({},_0x392753,_0x142cde[_0x6a11('0x5a')]);return _0x12675e[_0x6a11('0x115')](_0x392753);}})[_0x6a11('0x23')](function(_0x506e31){if(_0x506e31){_0x3e3641=_0x506e31[_0x6a11('0x4a')];if(!_0x142cde[_0x6a11('0x45')][_0x6a11('0xee')](_0x6a11('0x4b'))){_0x392753['limit']=qs['limit'](_0x142cde['query'][_0x6a11('0x4c')]);_0x392753['offset']=qs[_0x6a11('0x33')](_0x142cde['query']['offset']);}return _0x12675e[_0x6a11('0x115')](_0x392753);}})['then'](function(_0x405cca){if(_0x405cca){return _0x405cca?{'count':_0x3e3641,'rows':_0x405cca}:null;}})[_0x6a11('0x23')](respondWithResult(_0x447fe3,null))[_0x6a11('0x2e')](handleError(_0x447fe3,null));};exports[_0x6a11('0x116')]=function(_0x4078d2,_0x5878c0,_0x160355){return db[_0x6a11('0x117')][_0x6a11('0x64')]({'where':{'id':_0x4078d2[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x5878c0,null))[_0x6a11('0x23')](function(_0x3d6492){if(_0x3d6492){return _0x3d6492[_0x6a11('0x116')](_0x4078d2[_0x6a11('0x5c')][_0x6a11('0x6f')],_[_0x6a11('0xec')](_0x4078d2[_0x6a11('0x5c')],[_0x6a11('0x6f'),'id'])||{});}})[_0x6a11('0x23')](respondWithResult(_0x5878c0,null))[_0x6a11('0x2e')](handleError(_0x5878c0,null));};exports[_0x6a11('0x104')]=function(_0x10e4cc,_0x1700c6,_0x1e6ee0){var _0x4d78e9={};var _0x4868ca={};var _0x1ffb2f;var _0x2a017e;return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x10e4cc[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x1700c6,null))['then'](function(_0x4b2b54){if(_0x4b2b54){_0x1ffb2f=_0x4b2b54;_0x4868ca[_0x6a11('0x44')]=_[_0x6a11('0x46')](db[_0x6a11('0x118')][_0x6a11('0x59')]);_0x4868ca[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x10e4cc[_0x6a11('0x45')]);_0x4868ca['filters']=_[_0x6a11('0x47')](_0x4868ca['model'],_0x4868ca[_0x6a11('0x45')]);_0x4d78e9['attributes']=_['intersection'](_0x4868ca['model'],qs[_0x6a11('0x48')](_0x10e4cc[_0x6a11('0x45')]['fields']));_0x4d78e9['attributes']=_0x4d78e9[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x4d78e9[_0x6a11('0x49')]:_0x4868ca[_0x6a11('0x44')];_0x4d78e9[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x10e4cc[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x4d78e9['where']=qs[_0x6a11('0x50')](_[_0x6a11('0x4f')](_0x10e4cc[_0x6a11('0x45')],_0x4868ca['filters']));if(_0x10e4cc[_0x6a11('0x45')][_0x6a11('0x51')]){_0x4d78e9['where']=_[_0x6a11('0x52')](_0x4d78e9[_0x6a11('0x4e')],{'$or':_[_0x6a11('0x40')](_0x4d78e9['attributes'],function(_0x4a789b){var _0x20a87d={};_0x20a87d[_0x4a789b]={'$like':'%'+_0x10e4cc[_0x6a11('0x45')][_0x6a11('0x51')]+'%'};return _0x20a87d;})});}_0x4d78e9=_[_0x6a11('0x52')]({},_0x4d78e9,_0x10e4cc[_0x6a11('0x5a')]);return _0x1ffb2f[_0x6a11('0x104')](_0x4d78e9);}})[_0x6a11('0x23')](function(_0x4d3b48){if(_0x4d3b48){_0x2a017e=_0x4d3b48['length'];if(!_0x10e4cc[_0x6a11('0x45')]['hasOwnProperty'](_0x6a11('0x4b'))){_0x4d78e9[_0x6a11('0x4c')]=qs['limit'](_0x10e4cc[_0x6a11('0x45')]['limit']);_0x4d78e9[_0x6a11('0x33')]=qs[_0x6a11('0x33')](_0x10e4cc[_0x6a11('0x45')][_0x6a11('0x33')]);}return _0x1ffb2f[_0x6a11('0x104')](_0x4d78e9);}})[_0x6a11('0x23')](function(_0x1c6fc3){if(_0x1c6fc3){return _0x1c6fc3?{'count':_0x2a017e,'rows':_0x1c6fc3}:null;}})[_0x6a11('0x23')](respondWithResult(_0x1700c6,null))[_0x6a11('0x2e')](handleError(_0x1700c6,null));};exports[_0x6a11('0x119')]=function(_0x2ff0cc,_0x423f40,_0x535193){var _0x1a1148=_0x2ff0cc[_0x6a11('0x45')][_0x6a11('0x11a')]===_0x6a11('0x11b')?_0x6a11('0x11c'):_0x6a11('0x11d');return db[_0x6a11('0x41')][_0x6a11('0x64')]({'attributes':['id',_0x1a1148],'where':{'id':_0x2ff0cc['params']['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x423f40,null))[_0x6a11('0x23')](function(_0x4587d5){if(_0x4587d5){var _0x37b0bd=_0x4587d5[_0x1a1148];var _0x5b7364=_0x37b0bd&&_0x37b0bd['items']?_0x37b0bd[_0x6a11('0x11e')]:[];_0x423f40[_0x6a11('0x3e')]({'fromKey':_['isNil'](_0x37b0bd['fromKey'])?undefined:_0x37b0bd[_0x6a11('0x11f')],'count':_0x5b7364['length'],'rows':_0x5b7364});}})[_0x6a11('0x2e')](handleError(_0x423f40,null));};exports[_0x6a11('0x120')]=function(_0x56590a,_0x448381,_0x1d9f1e){var _0x3352b0={'raw':![],'where':{}};var _0x151141={};var _0x21550e={'count':0x0,'rows':[]};return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x56590a[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x448381,null))['then'](function(_0x24a0d5){if(_0x24a0d5){_0x151141[_0x6a11('0x44')]=_[_0x6a11('0x46')](db['ChatOfflineMessage']['rawAttributes']);_0x151141[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x56590a[_0x6a11('0x45')]);_0x151141['filters']=_[_0x6a11('0x47')](_0x151141['model'],_0x151141[_0x6a11('0x45')]);_0x3352b0[_0x6a11('0x49')]=_[_0x6a11('0x47')](_0x151141[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0x56590a[_0x6a11('0x45')]['fields']));_0x3352b0[_0x6a11('0x49')]=_0x3352b0[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x3352b0['attributes']:_0x151141[_0x6a11('0x44')];if(!_0x56590a[_0x6a11('0x45')]['hasOwnProperty'](_0x6a11('0x4b'))){_0x3352b0[_0x6a11('0x4c')]=qs[_0x6a11('0x4c')](_0x56590a['query'][_0x6a11('0x4c')]);_0x3352b0[_0x6a11('0x33')]=qs[_0x6a11('0x33')](_0x56590a['query']['offset']);}_0x3352b0[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x56590a[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x3352b0[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_['pick'](_0x56590a['query'],_0x151141[_0x6a11('0x50')]));_0x3352b0[_0x6a11('0x4e')][_0x6a11('0x68')]=_0x24a0d5['id'];if(_0x56590a['query']['filter']){_0x3352b0[_0x6a11('0x4e')]=_[_0x6a11('0x52')](_0x3352b0[_0x6a11('0x4e')],{'$or':_[_0x6a11('0x40')](_0x3352b0[_0x6a11('0x49')],function(_0x4b7e99){var _0x5cf989={};_0x5cf989[_0x4b7e99]={'$like':'%'+_0x56590a['query']['filter']+'%'};return _0x5cf989;})});}_0x3352b0=_['merge']({},_0x3352b0,_0x56590a[_0x6a11('0x5a')]);return db[_0x6a11('0x121')]['count']({'where':_0x3352b0[_0x6a11('0x4e')]})[_0x6a11('0x23')](function(_0x35269c){_0x21550e['count']=_0x35269c;if(_0x56590a[_0x6a11('0x45')][_0x6a11('0x53')]){_0x3352b0[_0x6a11('0x6d')]=[{'all':!![]}];}else{_0x3352b0[_0x6a11('0x6d')]=[{'model':db['CmContact'],'as':'Contact','required':![]}];}return db['ChatOfflineMessage'][_0x6a11('0x54')](_0x3352b0);})[_0x6a11('0x23')](function(_0x38770e){_0x21550e[_0x6a11('0x55')]=_0x38770e;return _0x21550e;});}})[_0x6a11('0x23')](respondWithFilteredResult(_0x448381,_0x3352b0))[_0x6a11('0x2e')](handleError(_0x448381,null));};exports[_0x6a11('0x122')]=function(_0x3b85c8,_0x4885fb,_0xa2b10){return db[_0x6a11('0x41')][_0x6a11('0x64')]({'where':{'id':_0x3b85c8[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x4885fb,null))[_0x6a11('0x23')](function(_0x24438f){if(_0x24438f){return _0x24438f[_0x6a11('0x122')](_0x3b85c8[_0x6a11('0x5c')][_0x6a11('0x6f')],_[_0x6a11('0xec')](_0x3b85c8[_0x6a11('0x5c')],['ids','id'])||{})[_0x6a11('0xbe')](function(_0x213361){for(var _0x3dd89a=0x0;_0x3dd89a<_0x3b85c8[_0x6a11('0x5c')][_0x6a11('0x6f')]['length'];_0x3dd89a+=0x1){socket[_0x6a11('0x123')](_0x6a11('0x124'),{'UserId':_0x3b85c8[_0x6a11('0x5c')]['ids'][_0x3dd89a],'ChatWebsiteId':_0x3b85c8[_0x6a11('0x65')]['id']});}return _0x213361;});}})[_0x6a11('0x23')](respondWithResult(_0x4885fb,null))[_0x6a11('0x2e')](handleError(_0x4885fb,null));};exports[_0x6a11('0x125')]=function(_0xc83350,_0x5ea9f7,_0x1dd9d2){return db[_0x6a11('0x41')]['find']({'where':{'id':_0xc83350[_0x6a11('0x65')]['id']}})['then'](handleEntityNotFound(_0x5ea9f7,null))[_0x6a11('0x23')](function(_0x25ea5a){if(_0x25ea5a){return _0x25ea5a['removeAgents'](_0xc83350[_0x6a11('0x45')][_0x6a11('0x6f')])[_0x6a11('0x23')](function(){if(_[_0x6a11('0x126')](_0xc83350[_0x6a11('0x45')][_0x6a11('0x6f')])){for(var _0x381515=0x0;_0x381515<_0xc83350[_0x6a11('0x45')]['ids'][_0x6a11('0x4a')];_0x381515+=0x1){socket[_0x6a11('0x123')]('userChatWebsite:remove',{'UserId':Number(_0xc83350[_0x6a11('0x45')][_0x6a11('0x6f')][_0x381515]),'ChatWebsiteId':Number(_0xc83350[_0x6a11('0x65')]['id'])});}}else{socket['emit'](_0x6a11('0x127'),{'UserId':Number(_0xc83350[_0x6a11('0x45')]['ids']),'ChatWebsiteId':Number(_0xc83350[_0x6a11('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x5ea9f7,null))['catch'](handleError(_0x5ea9f7,null));};exports[_0x6a11('0x128')]=function(_0x36475f,_0x3d90c8,_0x15375a){var _0x49a98={};var _0x5bc55f={};var _0xd498f0;var _0x53346c;return db[_0x6a11('0x41')][_0x6a11('0x6b')]({'where':{'id':_0x36475f[_0x6a11('0x65')]['id']}})[_0x6a11('0x23')](handleEntityNotFound(_0x3d90c8,null))['then'](function(_0x3614f1){if(_0x3614f1){_0xd498f0=_0x3614f1;_0x5bc55f[_0x6a11('0x44')]=_[_0x6a11('0x46')](db[_0x6a11('0xc8')][_0x6a11('0x59')]);_0x5bc55f[_0x6a11('0x45')]=_[_0x6a11('0x46')](_0x36475f[_0x6a11('0x45')]);_0x5bc55f[_0x6a11('0x50')]=_[_0x6a11('0x47')](_0x5bc55f[_0x6a11('0x44')],_0x5bc55f[_0x6a11('0x45')]);_0x49a98[_0x6a11('0x49')]=_[_0x6a11('0x47')](_0x5bc55f[_0x6a11('0x44')],qs[_0x6a11('0x48')](_0x36475f[_0x6a11('0x45')][_0x6a11('0x48')]));_0x49a98['attributes']=_0x49a98[_0x6a11('0x49')][_0x6a11('0x4a')]?_0x49a98['attributes']:_0x5bc55f[_0x6a11('0x44')];_0x49a98[_0x6a11('0x6c')]=qs[_0x6a11('0x4d')](_0x36475f[_0x6a11('0x45')][_0x6a11('0x4d')]);_0x49a98[_0x6a11('0x4e')]=qs[_0x6a11('0x50')](_['pick'](_0x36475f[_0x6a11('0x45')],_0x5bc55f[_0x6a11('0x50')]));if(_0x36475f[_0x6a11('0x45')]['filter']){_0x49a98[_0x6a11('0x4e')]=_[_0x6a11('0x52')](_0x49a98[_0x6a11('0x4e')],{'$or':_[_0x6a11('0x40')](_0x49a98[_0x6a11('0x49')],function(_0x30efba){var _0xc2b095={};_0xc2b095[_0x30efba]={'$like':'%'+_0x36475f[_0x6a11('0x45')][_0x6a11('0x51')]+'%'};return _0xc2b095;})});}_0x49a98=_[_0x6a11('0x52')]({},_0x49a98,_0x36475f[_0x6a11('0x5a')]);return _0xd498f0[_0x6a11('0x128')](_0x49a98);}})['then'](function(_0x365e73){if(_0x365e73){_0x53346c=_0x365e73[_0x6a11('0x4a')];if(!_0x36475f[_0x6a11('0x45')][_0x6a11('0xee')](_0x6a11('0x4b'))){_0x49a98[_0x6a11('0x4c')]=qs['limit'](_0x36475f[_0x6a11('0x45')]['limit']);_0x49a98[_0x6a11('0x33')]=qs['offset'](_0x36475f[_0x6a11('0x45')]['offset']);}return _0xd498f0['getAgents'](_0x49a98);}})[_0x6a11('0x23')](function(_0x2d2398){if(_0x2d2398){return _0x2d2398?{'count':_0x53346c,'rows':_0x2d2398}:null;}})['then'](respondWithResult(_0x3d90c8,null))[_0x6a11('0x2e')](handleError(_0x3d90c8,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index d4a4930..4247ec2 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 _0xf14b=['exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x273417,_0x23d212){var _0x3fdfc1=function(_0x5a13f6){while(--_0x5a13f6){_0x273417['push'](_0x273417['shift']());}};_0x3fdfc1(++_0x23d212);}(_0xf14b,0xdd));var _0xbf14=function(_0x6c00b2,_0x2769d4){_0x6c00b2=_0x6c00b2-0x0;var _0x255585=_0xf14b[_0x6c00b2];return _0x255585;};'use strict';var EventEmitter=require(_0xbf14('0x0'));var ChatWebsite=require(_0xbf14('0x1'))['db'][_0xbf14('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbf14('0x3')](0x0);var events={'afterCreate':_0xbf14('0x4'),'afterUpdate':_0xbf14('0x5'),'afterDestroy':_0xbf14('0x6')};function emitEvent(_0x933794){return function(_0x1c9f49,_0x3afb15,_0x52d8f7){ChatWebsiteEvents[_0xbf14('0x7')](_0x933794+':'+_0x1c9f49['id'],_0x1c9f49);ChatWebsiteEvents[_0xbf14('0x7')](_0x933794,_0x1c9f49);_0x52d8f7(null);};}for(var e in events){if(events[_0xbf14('0x8')](e)){var event=events[e];ChatWebsite[_0xbf14('0x9')](e,emitEvent(event));}}module[_0xbf14('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x0d6a=['emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x286eb4,_0x5eecb2){var _0x22b5d8=function(_0xe264c4){while(--_0xe264c4){_0x286eb4['push'](_0x286eb4['shift']());}};_0x22b5d8(++_0x5eecb2);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x0d6a[_0x87b0ff];return _0x3bc0b2;};'use strict';var EventEmitter=require(_0xa0d6('0x0'));var ChatWebsite=require(_0xa0d6('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa0d6('0x2')](0x0);var events={'afterCreate':_0xa0d6('0x3'),'afterUpdate':_0xa0d6('0x4'),'afterDestroy':_0xa0d6('0x5')};function emitEvent(_0x71d654){return function(_0x236047,_0x344b8d,_0x3454b6){ChatWebsiteEvents[_0xa0d6('0x6')](_0x71d654+':'+_0x236047['id'],_0x236047);ChatWebsiteEvents[_0xa0d6('0x6')](_0x71d654,_0x236047);_0x3454b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xa0d6('0x7')](e,emitEvent(event));}}module[_0xa0d6('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 33fa803..1e6ddd2 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 _0x330c=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites'];(function(_0x7611ce,_0x4a4441){var _0x67d3ab=function(_0x1456d8){while(--_0x1456d8){_0x7611ce['push'](_0x7611ce['shift']());}};_0x67d3ab(++_0x4a4441);}(_0x330c,0x186));var _0xc330=function(_0x3f3e39,_0x34f57a){_0x3f3e39=_0x3f3e39-0x0;var _0x1b62d1=_0x330c[_0x3f3e39];return _0x1b62d1;};'use strict';var _=require(_0xc330('0x0'));var util=require(_0xc330('0x1'));var logger=require(_0xc330('0x2'))(_0xc330('0x3'));var moment=require('moment');var BPromise=require(_0xc330('0x4'));var rp=require(_0xc330('0x5'));var fs=require('fs');var path=require(_0xc330('0x6'));var rimraf=require(_0xc330('0x7'));var config=require(_0xc330('0x8'));var attributes=require(_0xc330('0x9'));module['exports']=function(_0x4f49fb,_0x53d0ca){return _0x4f49fb[_0xc330('0xa')](_0xc330('0xb'),attributes,{'tableName':_0xc330('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3ed=['api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','lodash','util','../../config/logger'];(function(_0x573010,_0x2923c4){var _0x84c43d=function(_0x22c44d){while(--_0x22c44d){_0x573010['push'](_0x573010['shift']());}};_0x84c43d(++_0x2923c4);}(_0xe3ed,0x8d));var _0xde3e=function(_0x275d2a,_0x1829b3){_0x275d2a=_0x275d2a-0x0;var _0x51fa6e=_0xe3ed[_0x275d2a];return _0x51fa6e;};'use strict';var _=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var logger=require(_0xde3e('0x2'))(_0xde3e('0x3'));var moment=require(_0xde3e('0x4'));var BPromise=require(_0xde3e('0x5'));var rp=require(_0xde3e('0x6'));var fs=require('fs');var path=require(_0xde3e('0x7'));var rimraf=require('rimraf');var config=require(_0xde3e('0x8'));var attributes=require(_0xde3e('0x9'));module['exports']=function(_0x3405cc,_0x5e9013){return _0x3405cc[_0xde3e('0xa')](_0xde3e('0xb'),attributes,{'tableName':'chat_websites','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 a58ae56..bd24862 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 _0xc6ac=['http','defaults','redis','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x53ca29,_0x348b49){_0x53ca29=_0x53ca29-0x0;var _0x163bce=_0xc6ac[_0x53ca29];return _0x163bce;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});config['redis']=_[_0xcc6a('0xe')](config[_0xcc6a('0xf')],{'host':_0xcc6a('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc6a('0xf')]));require(_0xcc6a('0x11'))[_0xcc6a('0x12')](socket);function respondWithRpcPromise(_0x463ebb,_0x3eb04a,_0x5e91a2){return new BPromise(function(_0x30a004,_0x290119){return client[_0xcc6a('0x13')](_0x463ebb,_0x5e91a2)['then'](function(_0x1d91a5){logger[_0xcc6a('0x14')](_0xcc6a('0x15'),_0x3eb04a,'request\x20sent');logger['debug'](_0xcc6a('0x16'),_0x3eb04a,_0xcc6a('0x17'),JSON[_0xcc6a('0x18')](_0x1d91a5));if(_0x1d91a5['error']){if(_0x1d91a5['error'][_0xcc6a('0x19')]===0x1f4){logger[_0xcc6a('0x1a')](_0xcc6a('0x15'),_0x3eb04a,_0x1d91a5[_0xcc6a('0x1a')][_0xcc6a('0x1b')]);return _0x290119(_0x1d91a5[_0xcc6a('0x1a')][_0xcc6a('0x1b')]);}logger[_0xcc6a('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x3eb04a,_0x1d91a5['error']['message']);return _0x30a004(_0x1d91a5[_0xcc6a('0x1a')][_0xcc6a('0x1b')]);}else{logger[_0xcc6a('0x14')](_0xcc6a('0x15'),_0x3eb04a,_0xcc6a('0x17'));_0x30a004(_0x1d91a5[_0xcc6a('0x1c')][_0xcc6a('0x1b')]);}})[_0xcc6a('0x1d')](function(_0x374e51){logger[_0xcc6a('0x1a')](_0xcc6a('0x15'),_0x3eb04a,_0x374e51);_0x290119(_0x374e51);});});} \ No newline at end of file +var _0xda2d=['error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2a6f7d,_0x350dbd){var _0x40f067=function(_0x1b521c){while(--_0x1b521c){_0x2a6f7d['push'](_0x2a6f7d['shift']());}};_0x40f067(++_0x350dbd);}(_0xda2d,0x102));var _0xdda2=function(_0x43c36f,_0x4b2584){_0x43c36f=_0x43c36f-0x0;var _0x36b325=_0xda2d[_0x43c36f];return _0x36b325;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});config[_0xdda2('0xa')]=_[_0xdda2('0xb')](config[_0xdda2('0xa')],{'host':_0xdda2('0xc'),'port':0x18eb});var socket=require(_0xdda2('0xd'))(new Redis(config['redis']));require(_0xdda2('0xe'))[_0xdda2('0xf')](socket);function respondWithRpcPromise(_0x4df6b8,_0x1c11b2,_0x2f3454){return new BPromise(function(_0x42d990,_0x346119){return client[_0xdda2('0x10')](_0x4df6b8,_0x2f3454)[_0xdda2('0x11')](function(_0x26fe81){logger[_0xdda2('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x1c11b2,'request\x20sent');logger['debug'](_0xdda2('0x13'),_0x1c11b2,_0xdda2('0x14'),JSON[_0xdda2('0x15')](_0x26fe81));if(_0x26fe81[_0xdda2('0x16')]){if(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x17')]===0x1f4){logger[_0xdda2('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x346119(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x18')]);}logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x42d990(_0x26fe81['error'][_0xdda2('0x18')]);}else{logger['info'](_0xdda2('0x19'),_0x1c11b2,_0xdda2('0x14'));_0x42d990(_0x26fe81[_0xdda2('0x1a')][_0xdda2('0x18')]);}})[_0xdda2('0x1b')](function(_0x17015f){logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x17015f);_0x346119(_0x17015f);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f7e5173..6ae3e8d 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x233d00,_0x41a7bb){var _0x4296f7=function(_0x255991){while(--_0x255991){_0x233d00['push'](_0x233d00['shift']());}};_0x4296f7(++_0x41a7bb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x31cc6e,_0x4da430){_0x31cc6e=_0x31cc6e-0x0;var _0x39a234=_0x5f2f[_0x31cc6e];return _0x39a234;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x21c068,_0x369d6a){var _0x5cf199=function(_0x2c0159){while(--_0x2c0159){_0x21c068['push'](_0x21c068['shift']());}};_0x5cf199(++_0x369d6a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ed4e5,_0x1fe79f){_0x4ed4e5=_0x4ed4e5-0x0;var _0x3fdaea=_0x5f2f[_0x4ed4e5];return _0x3fdaea;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 8614f27..9872673 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 _0xb7cb=['getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','single','file','diskStorage','server/files/images/avatars/','originalname','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','offline','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages'];(function(_0x1fb7e7,_0x154a74){var _0x1cea80=function(_0x5083e2){while(--_0x5083e2){_0x1fb7e7['push'](_0x1fb7e7['shift']());}};_0x1cea80(++_0x154a74);}(_0xb7cb,0x1d1));var _0xbb7c=function(_0x414810,_0x5e924d){_0x414810=_0x414810-0x0;var _0x2d4df5=_0xb7cb[_0x414810];return _0x2d4df5;};'use strict';var multer=require(_0xbb7c('0x0'));var util=require('util');var path=require(_0xbb7c('0x1'));var timeout=require('connect-timeout');var express=require(_0xbb7c('0x2'));var router=express[_0xbb7c('0x3')]();var auth=require(_0xbb7c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbb7c('0x5'));var controller=require('./chatWebsite.controller');router[_0xbb7c('0x6')]('/',auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x8')]);router['get'](_0xbb7c('0x9'),auth[_0xbb7c('0x7')](),controller[_0xbb7c('0xa')]);router['get'](_0xbb7c('0xb'),auth['isAuthenticated'](),controller[_0xbb7c('0xc')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xbb7c('0xd')]);router['get']('/:id/canned_answers',auth[_0xbb7c('0x7')](),controller[_0xbb7c('0xe')]);router[_0xbb7c('0x6')](_0xbb7c('0xf'),controller[_0xbb7c('0x10')]);router['get'](_0xbb7c('0x11'),controller[_0xbb7c('0x12')]);router[_0xbb7c('0x6')](_0xbb7c('0x13'),controller[_0xbb7c('0x14')]);router[_0xbb7c('0x6')](_0xbb7c('0x15'),controller[_0xbb7c('0x16')]);router[_0xbb7c('0x6')](_0xbb7c('0x17'),auth['isAuthenticated'](),controller[_0xbb7c('0x18')]);router[_0xbb7c('0x6')](_0xbb7c('0x19'),controller[_0xbb7c('0x1a')]);router['get']('/:id/applications',auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x1b')]);router[_0xbb7c('0x6')]('/:id/proactive_actions',auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x1c')]);router[_0xbb7c('0x6')](_0xbb7c('0x1d'),controller[_0xbb7c('0x1e')]);router['get'](_0xbb7c('0x1f'),auth['isAuthenticated'](),controller[_0xbb7c('0x20')]);router['get'](_0xbb7c('0x21'),auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x22')]);router[_0xbb7c('0x23')]('/',auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x24')]);router['post'](_0xbb7c('0x25'),auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x26')]);router[_0xbb7c('0x23')]('/:id/canned_answers',auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x431503,_0x11d055,_0x4eb156){_0x4eb156(null,path[_0xbb7c('0x28')](config[_0xbb7c('0x29')],_0xbb7c('0x2a')));},'filename':function(_0x3878ba,_0x403b1d,_0x3cdcb7){_0x3cdcb7(null,util[_0xbb7c('0x2b')](_0xbb7c('0x2c'),Date[_0xbb7c('0x2d')](),_0x403b1d['originalname']));}})});router[_0xbb7c('0x23')]('/:id/logo',upload[_0xbb7c('0x2e')](_0xbb7c('0x2f')),controller['addLogo']);var upload=multer({'storage':multer[_0xbb7c('0x30')]({'destination':function(_0x34c32a,_0x20bf93,_0x3eae9b){_0x3eae9b(null,path['join'](config[_0xbb7c('0x29')],_0xbb7c('0x31')));},'filename':function(_0x5b478b,_0x561df3,_0x440b3b){_0x440b3b(null,util['format'](_0xbb7c('0x2c'),Date[_0xbb7c('0x2d')](),_0x561df3[_0xbb7c('0x32')]));}})});router[_0xbb7c('0x23')](_0xbb7c('0x11'),upload[_0xbb7c('0x2e')]('file'),controller[_0xbb7c('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x27d8da,_0x39cb44,_0xe3d614){_0xe3d614(null,path[_0xbb7c('0x28')](config[_0xbb7c('0x29')],_0xbb7c('0x31')));},'filename':function(_0x3da48c,_0x2455f2,_0x2b7c8b){_0x2b7c8b(null,util[_0xbb7c('0x2b')](_0xbb7c('0x2c'),Date[_0xbb7c('0x2d')](),_0x2455f2['originalname']));}})});router[_0xbb7c('0x23')](_0xbb7c('0x13'),upload['single'](_0xbb7c('0x2f')),controller[_0xbb7c('0x34')]);var upload=multer({'storage':multer[_0xbb7c('0x30')]({'destination':function(_0x3236aa,_0x57825c,_0x346d73){_0x346d73(null,path[_0xbb7c('0x28')](config[_0xbb7c('0x29')],_0xbb7c('0x31')));},'filename':function(_0xa68751,_0x439705,_0x381508){_0x381508(null,util[_0xbb7c('0x2b')](_0xbb7c('0x2c'),Date['now'](),_0x439705[_0xbb7c('0x32')]));}})});router[_0xbb7c('0x23')]('/:id/system_avatar',upload[_0xbb7c('0x2e')](_0xbb7c('0x2f')),controller[_0xbb7c('0x35')]);router[_0xbb7c('0x23')](_0xbb7c('0x36'),controller[_0xbb7c('0x37')]);router['post']('/:id/offline',controller[_0xbb7c('0x38')]);router['post'](_0xbb7c('0x17'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xbb7c('0x23')](_0xbb7c('0x39'),auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x3a')]);router[_0xbb7c('0x23')](_0xbb7c('0x3b'),auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x3c')]);router[_0xbb7c('0x23')](_0xbb7c('0x21'),auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x3d')]);router[_0xbb7c('0x3e')]('/:id',auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x3f')]);router[_0xbb7c('0x40')]('/:id',auth['isAuthenticated'](),controller[_0xbb7c('0x41')]);router['delete']('/:id/dispositions',auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x42')]);router[_0xbb7c('0x40')](_0xbb7c('0x43'),auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x44')]);router[_0xbb7c('0x40')](_0xbb7c('0x21'),auth[_0xbb7c('0x7')](),controller[_0xbb7c('0x45')]);module[_0xbb7c('0x46')]=router; \ No newline at end of file +var _0xa2f0=['/:id/users','addAgents','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','originalname','single','file','addLogo','server/files/images/avatars/','format','addAvatar','now','addCustomerAvatar','/:id/notify','offline','addInteraction','addApplications','addProactiveActions'];(function(_0x2a30e4,_0x5dc2b9){var _0x15e52d=function(_0x45e617){while(--_0x45e617){_0x2a30e4['push'](_0x2a30e4['shift']());}};_0x15e52d(++_0x5dc2b9);}(_0xa2f0,0x82));var _0x0a2f=function(_0x399fd7,_0x212098){_0x399fd7=_0x399fd7-0x0;var _0x57f548=_0xa2f0[_0x399fd7];return _0x57f548;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0a2f('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x0a2f('0x1'));var interaction=require(_0x0a2f('0x2'));var config=require(_0x0a2f('0x3'));var controller=require(_0x0a2f('0x4'));router['get']('/',auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x6')]);router[_0x0a2f('0x7')](_0x0a2f('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x0a2f('0x9'),auth['isAuthenticated'](),controller[_0x0a2f('0xa')]);router['get'](_0x0a2f('0xb'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0xc')]);router[_0x0a2f('0x7')](_0x0a2f('0xd'),auth['isAuthenticated'](),controller[_0x0a2f('0xe')]);router[_0x0a2f('0x7')](_0x0a2f('0xf'),controller['getLogo']);router[_0x0a2f('0x7')](_0x0a2f('0x10'),controller['getAvatar']);router[_0x0a2f('0x7')](_0x0a2f('0x11'),controller[_0x0a2f('0x12')]);router[_0x0a2f('0x7')](_0x0a2f('0x13'),controller[_0x0a2f('0x14')]);router[_0x0a2f('0x7')](_0x0a2f('0x15'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x16')]);router[_0x0a2f('0x7')](_0x0a2f('0x17'),controller[_0x0a2f('0x18')]);router[_0x0a2f('0x7')](_0x0a2f('0x19'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x1a')]);router['get'](_0x0a2f('0x1b'),auth['isAuthenticated'](),controller[_0x0a2f('0x1c')]);router[_0x0a2f('0x7')]('/:id/fields',controller[_0x0a2f('0x1d')]);router[_0x0a2f('0x7')](_0x0a2f('0x1e'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x0a2f('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x0a2f('0x5')](),controller['create']);router[_0x0a2f('0x1f')]('/:id/dispositions',auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x20')]);router[_0x0a2f('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x0a2f('0x21')]);var upload=multer({'storage':multer[_0x0a2f('0x22')]({'destination':function(_0x6001d2,_0x5d33db,_0x291515){_0x291515(null,path[_0x0a2f('0x23')](config[_0x0a2f('0x24')],_0x0a2f('0x25')));},'filename':function(_0x789509,_0x2581b1,_0xf19694){_0xf19694(null,util['format'](_0x0a2f('0x26'),Date['now'](),_0x2581b1[_0x0a2f('0x27')]));}})});router[_0x0a2f('0x1f')](_0x0a2f('0xf'),upload[_0x0a2f('0x28')](_0x0a2f('0x29')),controller[_0x0a2f('0x2a')]);var upload=multer({'storage':multer[_0x0a2f('0x22')]({'destination':function(_0xad0919,_0x17ad6a,_0x25e3d0){_0x25e3d0(null,path[_0x0a2f('0x23')](config[_0x0a2f('0x24')],_0x0a2f('0x2b')));},'filename':function(_0x35f26d,_0x3979f3,_0x42fcf5){_0x42fcf5(null,util[_0x0a2f('0x2c')](_0x0a2f('0x26'),Date['now'](),_0x3979f3[_0x0a2f('0x27')]));}})});router[_0x0a2f('0x1f')](_0x0a2f('0x10'),upload['single'](_0x0a2f('0x29')),controller[_0x0a2f('0x2d')]);var upload=multer({'storage':multer[_0x0a2f('0x22')]({'destination':function(_0x3d64b3,_0x562e0e,_0x3883a8){_0x3883a8(null,path[_0x0a2f('0x23')](config[_0x0a2f('0x24')],_0x0a2f('0x2b')));},'filename':function(_0x200c12,_0x3a5e97,_0x576818){_0x576818(null,util[_0x0a2f('0x2c')](_0x0a2f('0x26'),Date[_0x0a2f('0x2e')](),_0x3a5e97[_0x0a2f('0x27')]));}})});router[_0x0a2f('0x1f')](_0x0a2f('0x11'),upload[_0x0a2f('0x28')](_0x0a2f('0x29')),controller[_0x0a2f('0x2f')]);var upload=multer({'storage':multer[_0x0a2f('0x22')]({'destination':function(_0x1eda7e,_0x279290,_0x515b67){_0x515b67(null,path[_0x0a2f('0x23')](config['root'],_0x0a2f('0x2b')));},'filename':function(_0x20be0e,_0x52e3d1,_0x2d7662){_0x2d7662(null,util[_0x0a2f('0x2c')]('%s-%s',Date['now'](),_0x52e3d1['originalname']));}})});router['post']('/:id/system_avatar',upload[_0x0a2f('0x28')]('file'),controller['addSystemAvatar']);router['post'](_0x0a2f('0x30'),controller['notify']);router['post']('/:id/offline',controller[_0x0a2f('0x31')]);router[_0x0a2f('0x1f')](_0x0a2f('0x15'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x32')]);router['post']('/:id/applications',auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x33')]);router[_0x0a2f('0x1f')](_0x0a2f('0x1b'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x34')]);router['post'](_0x0a2f('0x35'),auth['isAuthenticated'](),controller[_0x0a2f('0x36')]);router['put'](_0x0a2f('0x9'),auth[_0x0a2f('0x5')](),controller['update']);router['delete'](_0x0a2f('0x9'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x37')]);router[_0x0a2f('0x38')](_0x0a2f('0xb'),auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x39')]);router[_0x0a2f('0x38')]('/:id/canned_answers',auth[_0x0a2f('0x5')](),controller[_0x0a2f('0x3a')]);router[_0x0a2f('0x38')]('/:id/users',auth['isAuthenticated'](),controller[_0x0a2f('0x3b')]);module[_0x0a2f('0x3c')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 9558567..0f5182e 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 _0xfd50=['Google','exports','STRING','ENUM','AmazonAWS'];(function(_0x51666b,_0x48e537){var _0x1858fa=function(_0x578ff0){while(--_0x578ff0){_0x51666b['push'](_0x51666b['shift']());}};_0x1858fa(++_0x48e537);}(_0xfd50,0x178));var _0x0fd5=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xfd50[_0x3305de];return _0x3b5a84;};'use strict';var Sequelize=require('sequelize');module[_0x0fd5('0x0')]={'name':{'type':Sequelize[_0x0fd5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0fd5('0x2')](_0x0fd5('0x3'),_0x0fd5('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x0fd5('0x1')]}}; \ No newline at end of file +var _0x90b5=['ENUM','AmazonAWS','Google','sequelize','STRING'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x90b5,0x139));var _0x590b=function(_0x17d89a,_0x483545){_0x17d89a=_0x17d89a-0x0;var _0x3ba40b=_0x90b5[_0x17d89a];return _0x3ba40b;};'use strict';var Sequelize=require(_0x590b('0x0'));module['exports']={'name':{'type':Sequelize[_0x590b('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x590b('0x2')](_0x590b('0x3'),_0x590b('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e128ca7..e457beb 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 _0x3a8a=['CloudProvider','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','offset','sort','pick','filter','where','merge','options','include','rows','show','params','includeAll','find','catch','create','body','destroy','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map'];(function(_0x33fcc3,_0x34fef5){var _0x458f97=function(_0x235de6){while(--_0x235de6){_0x33fcc3['push'](_0x33fcc3['shift']());}};_0x458f97(++_0x34fef5);}(_0x3a8a,0x1bc));var _0xa3a8=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x3a8a[_0x126558];return _0x1f6d14;};'use strict';var pdf=require(_0xa3a8('0x0'));var emlformat=require(_0xa3a8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa3a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa3a8('0x3'));var BPromise=require(_0xa3a8('0x4'));var Mustache=require(_0xa3a8('0x5'));var util=require(_0xa3a8('0x6'));var path=require(_0xa3a8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa3a8('0x8'));var fs=require('fs');var _=require(_0xa3a8('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa3a8('0xa'));var deskjs=require(_0xa3a8('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa3a8('0xc'));var Papa=require('papaparse');var Redis=require(_0xa3a8('0xd'));var authService=require(_0xa3a8('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3a8('0xf'));var logger=require('../../config/logger')(_0xa3a8('0x10'));var utils=require(_0xa3a8('0x11'));var config=require(_0xa3a8('0x12'));var db=require(_0xa3a8('0x13'))['db'];function respondWithStatusCode(_0x2f5151,_0x142594){_0x142594=_0x142594||0xcc;return function(_0x6b9b3c){if(_0x6b9b3c){return _0x2f5151[_0xa3a8('0x14')](_0x142594);}return _0x2f5151[_0xa3a8('0x15')](_0x142594)[_0xa3a8('0x16')]();};}function respondWithResult(_0x5e8257,_0x3f0a9c){_0x3f0a9c=_0x3f0a9c||0xc8;return function(_0x7a6d95){if(_0x7a6d95){return _0x5e8257[_0xa3a8('0x15')](_0x3f0a9c)[_0xa3a8('0x17')](_0x7a6d95);}};}function respondWithFilteredResult(_0x4130e1,_0x4bfbd1){return function(_0x1e6521){if(_0x1e6521){var _0x4db7e2=_0x1e6521[_0xa3a8('0x18')],_0x4395d8=_0x4bfbd1['offset'],_0x2aab0c=_0x4bfbd1['offset']+_0x4bfbd1[_0xa3a8('0x19')],_0x2cea21;if(_0x2aab0c>=_0x4db7e2){_0x2aab0c=_0x4db7e2;_0x2cea21=0xc8;}else{_0x2cea21=0xce;}_0x4130e1['status'](_0x2cea21);return _0x4130e1[_0xa3a8('0x1a')](_0xa3a8('0x1b'),_0x4395d8+'-'+_0x2aab0c+'/'+_0x4db7e2)['json'](_0x1e6521);}return null;};}function patchUpdates(_0x55735b){return function(_0x43603b){try{jsonpatch[_0xa3a8('0x1c')](_0x43603b,_0x55735b,!![]);}catch(_0x26df1d){return BPromise[_0xa3a8('0x1d')](_0x26df1d);}return _0x43603b[_0xa3a8('0x1e')]();};}function saveUpdates(_0x31c9f7,_0x3ad392){return function(_0x5744a0){if(_0x5744a0){return _0x5744a0[_0xa3a8('0x1f')](_0x31c9f7)[_0xa3a8('0x20')](function(_0x29a0a4){return _0x29a0a4;});}return null;};}function removeEntity(_0x3dcaf9,_0x1080f0){return function(_0x244e02){if(_0x244e02){return _0x244e02['destroy']()['then'](function(){_0x3dcaf9[_0xa3a8('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36b661,_0x8b49f9){return function(_0x629342){if(!_0x629342){_0x36b661[_0xa3a8('0x14')](0x194);}return _0x629342;};}function handleError(_0x2e95ad,_0x1bb1e0){_0x1bb1e0=_0x1bb1e0||0x1f4;return function(_0x2ea3d4){logger[_0xa3a8('0x21')](_0x2ea3d4[_0xa3a8('0x22')]);if(_0x2ea3d4[_0xa3a8('0x23')]){delete _0x2ea3d4[_0xa3a8('0x23')];}_0x2e95ad['status'](_0x1bb1e0)[_0xa3a8('0x24')](_0x2ea3d4);};}exports[_0xa3a8('0x25')]=function(_0x4d1127,_0x232f44){var _0x5e49e9={},_0x5cf71d={},_0x2fdd4c={'count':0x0,'rows':[]};var _0x471e85=_[_0xa3a8('0x26')](db[_0xa3a8('0x27')][_0xa3a8('0x28')],function(_0xfab802){return{'name':_0xfab802[_0xa3a8('0x29')],'type':_0xfab802[_0xa3a8('0x2a')][_0xa3a8('0x2b')]};});_0x5cf71d['model']=_[_0xa3a8('0x26')](_0x471e85,_0xa3a8('0x23'));_0x5cf71d[_0xa3a8('0x2c')]=_[_0xa3a8('0x2d')](_0x4d1127[_0xa3a8('0x2c')]);_0x5cf71d[_0xa3a8('0x2e')]=_[_0xa3a8('0x2f')](_0x5cf71d[_0xa3a8('0x30')],_0x5cf71d[_0xa3a8('0x2c')]);_0x5e49e9['attributes']=_[_0xa3a8('0x2f')](_0x5cf71d[_0xa3a8('0x30')],qs[_0xa3a8('0x31')](_0x4d1127[_0xa3a8('0x2c')][_0xa3a8('0x31')]));_0x5e49e9[_0xa3a8('0x32')]=_0x5e49e9[_0xa3a8('0x32')][_0xa3a8('0x33')]?_0x5e49e9['attributes']:_0x5cf71d[_0xa3a8('0x30')];if(!_0x4d1127[_0xa3a8('0x2c')]['hasOwnProperty']('nolimit')){_0x5e49e9[_0xa3a8('0x19')]=qs['limit'](_0x4d1127[_0xa3a8('0x2c')]['limit']);_0x5e49e9[_0xa3a8('0x34')]=qs['offset'](_0x4d1127[_0xa3a8('0x2c')]['offset']);}_0x5e49e9['order']=qs[_0xa3a8('0x35')](_0x4d1127[_0xa3a8('0x2c')]['sort']);_0x5e49e9['where']=qs[_0xa3a8('0x2e')](_[_0xa3a8('0x36')](_0x4d1127[_0xa3a8('0x2c')],_0x5cf71d[_0xa3a8('0x2e')]),_0x471e85);if(_0x4d1127['query'][_0xa3a8('0x37')]){_0x5e49e9[_0xa3a8('0x38')]=_[_0xa3a8('0x39')](_0x5e49e9[_0xa3a8('0x38')],{'$or':_[_0xa3a8('0x26')](_0x471e85,function(_0x401c50){if(_0x401c50['type']!=='VIRTUAL'){var _0x1c711c={};_0x1c711c[_0x401c50[_0xa3a8('0x23')]]={'$like':'%'+_0x4d1127[_0xa3a8('0x2c')]['filter']+'%'};return _0x1c711c;}})});}_0x5e49e9=_[_0xa3a8('0x39')]({},_0x5e49e9,_0x4d1127[_0xa3a8('0x3a')]);var _0x499519={'where':_0x5e49e9[_0xa3a8('0x38')]};return db['CloudProvider']['count'](_0x499519)['then'](function(_0x2523aa){_0x2fdd4c['count']=_0x2523aa;if(_0x4d1127['query']['includeAll']){_0x5e49e9[_0xa3a8('0x3b')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x5e49e9);})['then'](function(_0x2a1fb7){_0x2fdd4c[_0xa3a8('0x3c')]=_0x2a1fb7;return _0x2fdd4c;})[_0xa3a8('0x20')](respondWithFilteredResult(_0x232f44,_0x5e49e9))['catch'](handleError(_0x232f44,null));};exports[_0xa3a8('0x3d')]=function(_0x1c3c6a,_0x2d5996){var _0x5891ce={'raw':!![],'where':{'id':_0x1c3c6a[_0xa3a8('0x3e')]['id']}},_0x31b7e1={};_0x31b7e1[_0xa3a8('0x30')]=_[_0xa3a8('0x2d')](db['CloudProvider'][_0xa3a8('0x28')]);_0x31b7e1['query']=_[_0xa3a8('0x2d')](_0x1c3c6a[_0xa3a8('0x2c')]);_0x31b7e1[_0xa3a8('0x2e')]=_[_0xa3a8('0x2f')](_0x31b7e1[_0xa3a8('0x30')],_0x31b7e1[_0xa3a8('0x2c')]);_0x5891ce[_0xa3a8('0x32')]=_[_0xa3a8('0x2f')](_0x31b7e1[_0xa3a8('0x30')],qs[_0xa3a8('0x31')](_0x1c3c6a[_0xa3a8('0x2c')][_0xa3a8('0x31')]));_0x5891ce[_0xa3a8('0x32')]=_0x5891ce['attributes'][_0xa3a8('0x33')]?_0x5891ce[_0xa3a8('0x32')]:_0x31b7e1['model'];if(_0x1c3c6a[_0xa3a8('0x2c')][_0xa3a8('0x3f')]){_0x5891ce[_0xa3a8('0x3b')]=[{'all':!![]}];}_0x5891ce=_[_0xa3a8('0x39')]({},_0x5891ce,_0x1c3c6a[_0xa3a8('0x3a')]);return db['CloudProvider'][_0xa3a8('0x40')](_0x5891ce)['then'](handleEntityNotFound(_0x2d5996,null))['then'](respondWithResult(_0x2d5996,null))[_0xa3a8('0x41')](handleError(_0x2d5996,null));};exports[_0xa3a8('0x42')]=function(_0x51482c,_0x1ee492){return db[_0xa3a8('0x27')][_0xa3a8('0x42')](_0x51482c[_0xa3a8('0x43')],{})[_0xa3a8('0x20')](respondWithResult(_0x1ee492,0xc9))[_0xa3a8('0x41')](handleError(_0x1ee492,null));};exports[_0xa3a8('0x1f')]=function(_0x3b9f46,_0x815b09){if(_0x3b9f46['body']['id']){delete _0x3b9f46[_0xa3a8('0x43')]['id'];}return db['CloudProvider'][_0xa3a8('0x40')]({'where':{'id':_0x3b9f46['params']['id']}})[_0xa3a8('0x20')](handleEntityNotFound(_0x815b09,null))['then'](saveUpdates(_0x3b9f46[_0xa3a8('0x43')],null))[_0xa3a8('0x20')](respondWithResult(_0x815b09,null))[_0xa3a8('0x41')](handleError(_0x815b09,null));};exports[_0xa3a8('0x44')]=function(_0x1f0ebb,_0x37f4ee){return db[_0xa3a8('0x27')][_0xa3a8('0x40')]({'where':{'id':_0x1f0ebb[_0xa3a8('0x3e')]['id']}})[_0xa3a8('0x20')](handleEntityNotFound(_0x37f4ee,null))[_0xa3a8('0x20')](removeEntity(_0x37f4ee,null))['catch'](handleError(_0x37f4ee,null));}; \ No newline at end of file +var _0x71a3=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','destroy','error','name','index','map','CloudProvider','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','create','body','params','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x71a3,0x150));var _0x371a=function(_0x2e4bbc,_0x3b0036){_0x2e4bbc=_0x2e4bbc-0x0;var _0x517b41=_0x71a3[_0x2e4bbc];return _0x517b41;};'use strict';var pdf=require(_0x371a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x371a('0x1'));var zipdir=require(_0x371a('0x2'));var jsonpatch=require(_0x371a('0x3'));var rp=require(_0x371a('0x4'));var moment=require(_0x371a('0x5'));var BPromise=require(_0x371a('0x6'));var Mustache=require(_0x371a('0x7'));var util=require('util');var path=require('path');var sox=require(_0x371a('0x8'));var csv=require('to-csv');var ejs=require(_0x371a('0x9'));var fs=require('fs');var _=require(_0x371a('0xa'));var squel=require(_0x371a('0xb'));var crypto=require(_0x371a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x371a('0xd'));var querystring=require(_0x371a('0xe'));var Papa=require(_0x371a('0xf'));var Redis=require(_0x371a('0x10'));var authService=require(_0x371a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x371a('0x12'));var hardwareService=require(_0x371a('0x13'));var logger=require('../../config/logger')(_0x371a('0x14'));var utils=require('../../config/utils');var config=require(_0x371a('0x15'));var db=require(_0x371a('0x16'))['db'];function respondWithStatusCode(_0xac2808,_0x2d1b34){_0x2d1b34=_0x2d1b34||0xcc;return function(_0xc8789e){if(_0xc8789e){return _0xac2808[_0x371a('0x17')](_0x2d1b34);}return _0xac2808[_0x371a('0x18')](_0x2d1b34)[_0x371a('0x19')]();};}function respondWithResult(_0x8db71a,_0x8e0bf0){_0x8e0bf0=_0x8e0bf0||0xc8;return function(_0x376e86){if(_0x376e86){return _0x8db71a[_0x371a('0x18')](_0x8e0bf0)[_0x371a('0x1a')](_0x376e86);}};}function respondWithFilteredResult(_0x2f6930,_0x2f3943){return function(_0x56f40c){if(_0x56f40c){var _0x48e373=_0x56f40c[_0x371a('0x1b')],_0x327fcc=_0x2f3943[_0x371a('0x1c')],_0x2e5293=_0x2f3943[_0x371a('0x1c')]+_0x2f3943[_0x371a('0x1d')],_0xed16c7;if(_0x2e5293>=_0x48e373){_0x2e5293=_0x48e373;_0xed16c7=0xc8;}else{_0xed16c7=0xce;}_0x2f6930['status'](_0xed16c7);return _0x2f6930[_0x371a('0x1e')](_0x371a('0x1f'),_0x327fcc+'-'+_0x2e5293+'/'+_0x48e373)[_0x371a('0x1a')](_0x56f40c);}return null;};}function patchUpdates(_0x46798c){return function(_0x3bb1cc){try{jsonpatch['apply'](_0x3bb1cc,_0x46798c,!![]);}catch(_0x1392b6){return BPromise['reject'](_0x1392b6);}return _0x3bb1cc['save']();};}function saveUpdates(_0x4b0605,_0x214df6){return function(_0x2d625c){if(_0x2d625c){return _0x2d625c[_0x371a('0x20')](_0x4b0605)[_0x371a('0x21')](function(_0x33ee9f){return _0x33ee9f;});}return null;};}function removeEntity(_0x257707,_0xaf126c){return function(_0x554906){if(_0x554906){return _0x554906[_0x371a('0x22')]()['then'](function(){_0x257707['status'](0xcc)[_0x371a('0x19')]();});}};}function handleEntityNotFound(_0x3013fe,_0x23ee17){return function(_0x480e54){if(!_0x480e54){_0x3013fe[_0x371a('0x17')](0x194);}return _0x480e54;};}function handleError(_0x355203,_0x42880a){_0x42880a=_0x42880a||0x1f4;return function(_0x430cf1){logger[_0x371a('0x23')](_0x430cf1['stack']);if(_0x430cf1['name']){delete _0x430cf1[_0x371a('0x24')];}_0x355203[_0x371a('0x18')](_0x42880a)['send'](_0x430cf1);};}exports[_0x371a('0x25')]=function(_0xc55827,_0x32aca1){var _0x32216b={},_0x4b0d3a={},_0x351d3c={'count':0x0,'rows':[]};var _0x178d74=_[_0x371a('0x26')](db[_0x371a('0x27')]['rawAttributes'],function(_0x138b49){return{'name':_0x138b49[_0x371a('0x28')],'type':_0x138b49[_0x371a('0x29')][_0x371a('0x2a')]};});_0x4b0d3a[_0x371a('0x2b')]=_['map'](_0x178d74,_0x371a('0x24'));_0x4b0d3a[_0x371a('0x2c')]=_[_0x371a('0x2d')](_0xc55827[_0x371a('0x2c')]);_0x4b0d3a[_0x371a('0x2e')]=_['intersection'](_0x4b0d3a[_0x371a('0x2b')],_0x4b0d3a[_0x371a('0x2c')]);_0x32216b['attributes']=_[_0x371a('0x2f')](_0x4b0d3a[_0x371a('0x2b')],qs['fields'](_0xc55827[_0x371a('0x2c')][_0x371a('0x30')]));_0x32216b[_0x371a('0x31')]=_0x32216b['attributes']['length']?_0x32216b['attributes']:_0x4b0d3a['model'];if(!_0xc55827[_0x371a('0x2c')][_0x371a('0x32')](_0x371a('0x33'))){_0x32216b[_0x371a('0x1d')]=qs[_0x371a('0x1d')](_0xc55827[_0x371a('0x2c')][_0x371a('0x1d')]);_0x32216b['offset']=qs[_0x371a('0x1c')](_0xc55827[_0x371a('0x2c')][_0x371a('0x1c')]);}_0x32216b[_0x371a('0x34')]=qs[_0x371a('0x35')](_0xc55827[_0x371a('0x2c')][_0x371a('0x35')]);_0x32216b[_0x371a('0x36')]=qs[_0x371a('0x2e')](_[_0x371a('0x37')](_0xc55827['query'],_0x4b0d3a[_0x371a('0x2e')]),_0x178d74);if(_0xc55827[_0x371a('0x2c')][_0x371a('0x38')]){_0x32216b[_0x371a('0x36')]=_[_0x371a('0x39')](_0x32216b[_0x371a('0x36')],{'$or':_['map'](_0x178d74,function(_0x2e6bff){if(_0x2e6bff[_0x371a('0x29')]!==_0x371a('0x3a')){var _0x444d03={};_0x444d03[_0x2e6bff[_0x371a('0x24')]]={'$like':'%'+_0xc55827['query'][_0x371a('0x38')]+'%'};return _0x444d03;}})});}_0x32216b=_[_0x371a('0x39')]({},_0x32216b,_0xc55827[_0x371a('0x3b')]);var _0x5bd738={'where':_0x32216b['where']};return db[_0x371a('0x27')]['count'](_0x5bd738)[_0x371a('0x21')](function(_0x1c001d){_0x351d3c[_0x371a('0x1b')]=_0x1c001d;if(_0xc55827['query'][_0x371a('0x3c')]){_0x32216b[_0x371a('0x3d')]=[{'all':!![]}];}return db[_0x371a('0x27')][_0x371a('0x3e')](_0x32216b);})[_0x371a('0x21')](function(_0x272db7){_0x351d3c[_0x371a('0x3f')]=_0x272db7;return _0x351d3c;})[_0x371a('0x21')](respondWithFilteredResult(_0x32aca1,_0x32216b))[_0x371a('0x40')](handleError(_0x32aca1,null));};exports['show']=function(_0x50f63c,_0x52feeb){var _0x82faaa={'raw':!![],'where':{'id':_0x50f63c['params']['id']}},_0x4b690d={};_0x4b690d[_0x371a('0x2b')]=_[_0x371a('0x2d')](db[_0x371a('0x27')][_0x371a('0x41')]);_0x4b690d[_0x371a('0x2c')]=_[_0x371a('0x2d')](_0x50f63c[_0x371a('0x2c')]);_0x4b690d[_0x371a('0x2e')]=_[_0x371a('0x2f')](_0x4b690d[_0x371a('0x2b')],_0x4b690d[_0x371a('0x2c')]);_0x82faaa[_0x371a('0x31')]=_[_0x371a('0x2f')](_0x4b690d['model'],qs[_0x371a('0x30')](_0x50f63c['query'][_0x371a('0x30')]));_0x82faaa[_0x371a('0x31')]=_0x82faaa[_0x371a('0x31')]['length']?_0x82faaa[_0x371a('0x31')]:_0x4b690d[_0x371a('0x2b')];if(_0x50f63c[_0x371a('0x2c')][_0x371a('0x3c')]){_0x82faaa['include']=[{'all':!![]}];}_0x82faaa=_[_0x371a('0x39')]({},_0x82faaa,_0x50f63c['options']);return db[_0x371a('0x27')]['find'](_0x82faaa)['then'](handleEntityNotFound(_0x52feeb,null))['then'](respondWithResult(_0x52feeb,null))[_0x371a('0x40')](handleError(_0x52feeb,null));};exports['create']=function(_0x2ce2f3,_0x1abfdc){return db[_0x371a('0x27')][_0x371a('0x42')](_0x2ce2f3['body'],{})['then'](respondWithResult(_0x1abfdc,0xc9))[_0x371a('0x40')](handleError(_0x1abfdc,null));};exports[_0x371a('0x20')]=function(_0x215a8b,_0x30b810){if(_0x215a8b[_0x371a('0x43')]['id']){delete _0x215a8b[_0x371a('0x43')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x215a8b[_0x371a('0x44')]['id']}})[_0x371a('0x21')](handleEntityNotFound(_0x30b810,null))[_0x371a('0x21')](saveUpdates(_0x215a8b[_0x371a('0x43')],null))[_0x371a('0x21')](respondWithResult(_0x30b810,null))[_0x371a('0x40')](handleError(_0x30b810,null));};exports['destroy']=function(_0x19e1ec,_0x3dcc31){return db['CloudProvider'][_0x371a('0x45')]({'where':{'id':_0x19e1ec[_0x371a('0x44')]['id']}})[_0x371a('0x21')](handleEntityNotFound(_0x3dcc31,null))['then'](removeEntity(_0x3dcc31,null))[_0x371a('0x40')](handleError(_0x3dcc31,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 4dbe7bf..00a1111 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 _0x7da5=['exports','CloudProvider','cloud_providers','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7da5,0xbe));var _0x57da=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x7da5[_0x543084];return _0x306a57;};'use strict';var _=require(_0x57da('0x0'));var util=require(_0x57da('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x57da('0x2'));var rp=require(_0x57da('0x3'));var fs=require('fs');var path=require(_0x57da('0x4'));var rimraf=require(_0x57da('0x5'));var config=require(_0x57da('0x6'));var attributes=require(_0x57da('0x7'));module[_0x57da('0x8')]=function(_0x559f2e,_0x4e8261){return _0x559f2e['define'](_0x57da('0x9'),attributes,{'tableName':_0x57da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91ab=['util','api','moment','bluebird','path','./cloudProvider.attributes','define','CloudProvider','lodash'];(function(_0x4af21e,_0x5da1e5){var _0xb733a7=function(_0x48bfa6){while(--_0x48bfa6){_0x4af21e['push'](_0x4af21e['shift']());}};_0xb733a7(++_0x5da1e5);}(_0x91ab,0x104));var _0xb91a=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x91ab[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0xb91a('0x0'));var util=require(_0xb91a('0x1'));var logger=require('../../config/logger')(_0xb91a('0x2'));var moment=require(_0xb91a('0x3'));var BPromise=require(_0xb91a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb91a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb91a('0x6'));module['exports']=function(_0x2c3892,_0xa42f31){return _0x2c3892[_0xb91a('0x7')](_0xb91a('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 77a459d..e6e0026 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 _0x6f6b=['info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CloudProvider,\x20%s,\x20%s','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x2d29ca,_0xd723fe){var _0x5d30ef=function(_0x35a41e){while(--_0x35a41e){_0x2d29ca['push'](_0x2d29ca['shift']());}};_0x5d30ef(++_0xd723fe);}(_0x6f6b,0x136));var _0xb6f6=function(_0x3e6478,_0x58d025){_0x3e6478=_0x3e6478-0x0;var _0x3f821a=_0x6f6b[_0x3e6478];return _0x3f821a;};'use strict';var _=require('lodash');var util=require(_0xb6f6('0x0'));var moment=require('moment');var BPromise=require(_0xb6f6('0x1'));var rs=require(_0xb6f6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6f6('0x3'))['db'];var utils=require(_0xb6f6('0x4'));var logger=require(_0xb6f6('0x5'))(_0xb6f6('0x6'));var config=require('../../config/environment');var jayson=require(_0xb6f6('0x7'));var client=jayson[_0xb6f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3edb1e,_0x1d6020,_0x43887e){return new BPromise(function(_0x533632,_0x410ae4){return client[_0xb6f6('0x9')](_0x3edb1e,_0x43887e)['then'](function(_0x393a46){logger[_0xb6f6('0xa')]('CloudProvider,\x20%s,\x20%s',_0x1d6020,_0xb6f6('0xb'));logger[_0xb6f6('0xc')](_0xb6f6('0xd'),_0x1d6020,_0xb6f6('0xb'),JSON[_0xb6f6('0xe')](_0x393a46));if(_0x393a46[_0xb6f6('0xf')]){if(_0x393a46[_0xb6f6('0xf')][_0xb6f6('0x10')]===0x1f4){logger[_0xb6f6('0xf')]('CloudProvider,\x20%s,\x20%s',_0x1d6020,_0x393a46[_0xb6f6('0xf')]['message']);return _0x410ae4(_0x393a46[_0xb6f6('0xf')][_0xb6f6('0x11')]);}logger['error'](_0xb6f6('0x12'),_0x1d6020,_0x393a46[_0xb6f6('0xf')]['message']);return _0x533632(_0x393a46[_0xb6f6('0xf')][_0xb6f6('0x11')]);}else{logger[_0xb6f6('0xa')](_0xb6f6('0x12'),_0x1d6020,_0xb6f6('0xb'));_0x533632(_0x393a46[_0xb6f6('0x13')][_0xb6f6('0x11')]);}})['catch'](function(_0x5961b7){logger[_0xb6f6('0xf')](_0xb6f6('0x12'),_0x1d6020,_0x5961b7);_0x410ae4(_0x5961b7);});});} \ No newline at end of file +var _0xc91a=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x437167,_0x5070d3){var _0x4400ce=function(_0x2d848c){while(--_0x2d848c){_0x437167['push'](_0x437167['shift']());}};_0x4400ce(++_0x5070d3);}(_0xc91a,0x9a));var _0xac91=function(_0x170194,_0x351d4c){_0x170194=_0x170194-0x0;var _0xe390ea=_0xc91a[_0x170194];return _0xe390ea;};'use strict';var _=require(_0xac91('0x0'));var util=require(_0xac91('0x1'));var moment=require(_0xac91('0x2'));var BPromise=require('bluebird');var rs=require(_0xac91('0x3'));var fs=require('fs');var Redis=require(_0xac91('0x4'));var db=require(_0xac91('0x5'))['db'];var utils=require(_0xac91('0x6'));var logger=require('../../config/logger')(_0xac91('0x7'));var config=require(_0xac91('0x8'));var jayson=require(_0xac91('0x9'));var client=jayson[_0xac91('0xa')][_0xac91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51f499,_0x2fad70,_0x4604f1){return new BPromise(function(_0x4a5e33,_0x25f496){return client[_0xac91('0xc')](_0x51f499,_0x4604f1)[_0xac91('0xd')](function(_0x472ee2){logger[_0xac91('0xe')](_0xac91('0xf'),_0x2fad70,_0xac91('0x10'));logger[_0xac91('0x11')](_0xac91('0x12'),_0x2fad70,_0xac91('0x10'),JSON['stringify'](_0x472ee2));if(_0x472ee2[_0xac91('0x13')]){if(_0x472ee2[_0xac91('0x13')][_0xac91('0x14')]===0x1f4){logger[_0xac91('0x13')](_0xac91('0xf'),_0x2fad70,_0x472ee2[_0xac91('0x13')][_0xac91('0x15')]);return _0x25f496(_0x472ee2[_0xac91('0x13')][_0xac91('0x15')]);}logger[_0xac91('0x13')](_0xac91('0xf'),_0x2fad70,_0x472ee2[_0xac91('0x13')][_0xac91('0x15')]);return _0x4a5e33(_0x472ee2[_0xac91('0x13')][_0xac91('0x15')]);}else{logger[_0xac91('0xe')](_0xac91('0xf'),_0x2fad70,_0xac91('0x10'));_0x4a5e33(_0x472ee2[_0xac91('0x16')][_0xac91('0x15')]);}})[_0xac91('0x17')](function(_0x76b2b2){logger[_0xac91('0x13')](_0xac91('0xf'),_0x2fad70,_0x76b2b2);_0x25f496(_0x76b2b2);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 7d741c5..a05d850 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 _0xba6f=['create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show'];(function(_0x1ece80,_0x4c7f83){var _0x40b146=function(_0x5f1bbd){while(--_0x5f1bbd){_0x1ece80['push'](_0x1ece80['shift']());}};_0x40b146(++_0x4c7f83);}(_0xba6f,0x1bf));var _0xfba6=function(_0x5d0c1e,_0x132dd6){_0x5d0c1e=_0x5d0c1e-0x0;var _0x3ad7b0=_0xba6f[_0x5d0c1e];return _0x3ad7b0;};'use strict';var multer=require('multer');var util=require(_0xfba6('0x0'));var path=require(_0xfba6('0x1'));var timeout=require(_0xfba6('0x2'));var express=require(_0xfba6('0x3'));var router=express[_0xfba6('0x4')]();var auth=require(_0xfba6('0x5'));var interaction=require(_0xfba6('0x6'));var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router[_0xfba6('0x7')]('/',auth[_0xfba6('0x8')](),controller[_0xfba6('0x9')]);router[_0xfba6('0x7')](_0xfba6('0xa'),auth[_0xfba6('0x8')](),controller[_0xfba6('0xb')]);router['post']('/',auth[_0xfba6('0x8')](),controller[_0xfba6('0xc')]);router[_0xfba6('0xd')]('/:id',auth[_0xfba6('0x8')](),controller['update']);router[_0xfba6('0xe')]('/:id',auth[_0xfba6('0x8')](),controller[_0xfba6('0xf')]);module[_0xfba6('0x10')]=router; \ No newline at end of file +var _0x8c47=['/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','index','isAuthenticated','show','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c47,0xc6));var _0x78c4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8c47[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x78c4('0x0'));var util=require(_0x78c4('0x1'));var path=require(_0x78c4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78c4('0x3')]();var auth=require(_0x78c4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x78c4('0x5'));var controller=require(_0x78c4('0x6'));router[_0x78c4('0x7')]('/',auth['isAuthenticated'](),controller[_0x78c4('0x8')]);router[_0x78c4('0x7')]('/:id',auth[_0x78c4('0x9')](),controller[_0x78c4('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x78c4('0xb')]);router['put'](_0x78c4('0xc'),auth[_0x78c4('0x9')](),controller['update']);router['delete'](_0x78c4('0xc'),auth['isAuthenticated'](),controller[_0x78c4('0xd')]);module[_0x78c4('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 7f7580e..dc663fc 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 _0xf28b=['STRING','sequelize','exports','name'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xf28b,0xf1));var _0xbf28=function(_0x419515,_0x1f4947){_0x419515=_0x419515-0x0;var _0x26e525=_0xf28b[_0x419515];return _0x26e525;};'use strict';var Sequelize=require(_0xbf28('0x0'));module[_0xbf28('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbf28('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbf28('0x3')]},'companyId':{'type':Sequelize[_0xbf28('0x3')]},'website':{'type':Sequelize[_0xbf28('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbf28('0x3')]},'type':{'type':Sequelize[_0xbf28('0x3')]},'street':{'type':Sequelize[_0xbf28('0x3')]},'postalCode':{'type':Sequelize[_0xbf28('0x3')]},'city':{'type':Sequelize[_0xbf28('0x3')]},'country':{'type':Sequelize[_0xbf28('0x3')]},'email':{'type':Sequelize[_0xbf28('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbf28('0x3')]},'sStreet':{'type':Sequelize[_0xbf28('0x3')]},'sPostalCode':{'type':Sequelize[_0xbf28('0x3')]},'sCity':{'type':Sequelize[_0xbf28('0x3')]},'sCountry':{'type':Sequelize[_0xbf28('0x3')]},'description':{'type':Sequelize[_0xbf28('0x3')]}}; \ No newline at end of file +var _0x7626=['exports','STRING','name','sequelize'];(function(_0x535b18,_0xebb0ca){var _0x1efba7=function(_0x2d4a38){while(--_0x2d4a38){_0x535b18['push'](_0x535b18['shift']());}};_0x1efba7(++_0xebb0ca);}(_0x7626,0x17f));var _0x6762=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x7626[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require(_0x6762('0x0'));module[_0x6762('0x1')]={'name':{'type':Sequelize[_0x6762('0x2')],'unique':_0x6762('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x6762('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x6762('0x2')]},'phone':{'type':Sequelize[_0x6762('0x2')]},'fax':{'type':Sequelize[_0x6762('0x2')]},'type':{'type':Sequelize[_0x6762('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6762('0x2')]},'country':{'type':Sequelize[_0x6762('0x2')]},'email':{'type':Sequelize[_0x6762('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6762('0x2')]},'sStreet':{'type':Sequelize[_0x6762('0x2')]},'sPostalCode':{'type':Sequelize[_0x6762('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x6762('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 99a6d6d..9470a12 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 _0x654d=['eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','get','UserProfileResource','destroy','error','stack','send','index','CmCompany','keys','query','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addContacts','CmContact','ids','omit','findOne','length','order','getContacts','html-pdf'];(function(_0x392cc1,_0x43e6f){var _0x10ba0a=function(_0x1006bf){while(--_0x1006bf){_0x392cc1['push'](_0x392cc1['shift']());}};_0x10ba0a(++_0x43e6f);}(_0x654d,0x153));var _0xd654=function(_0x26c445,_0xcff7bc){_0x26c445=_0x26c445-0x0;var _0x331127=_0x654d[_0x26c445];return _0x331127;};'use strict';var pdf=require(_0xd654('0x0'));var emlformat=require(_0xd654('0x1'));var rimraf=require(_0xd654('0x2'));var zipdir=require(_0xd654('0x3'));var jsonpatch=require(_0xd654('0x4'));var rp=require('request-promise');var moment=require(_0xd654('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd654('0x6'));var util=require(_0xd654('0x7'));var path=require('path');var sox=require(_0xd654('0x8'));var csv=require(_0xd654('0x9'));var ejs=require(_0xd654('0xa'));var fs=require('fs');var _=require(_0xd654('0xb'));var squel=require(_0xd654('0xc'));var crypto=require('crypto');var jsforce=require(_0xd654('0xd'));var deskjs=require(_0xd654('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd654('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd654('0x10'));var qs=require(_0xd654('0x11'));var as=require(_0xd654('0x12'));var hardwareService=require(_0xd654('0x13'));var logger=require('../../config/logger')(_0xd654('0x14'));var utils=require(_0xd654('0x15'));var config=require('../../config/environment');var db=require(_0xd654('0x16'))['db'];function respondWithStatusCode(_0x283c75,_0x3b040f){_0x3b040f=_0x3b040f||0xcc;return function(_0x5338e5){if(_0x5338e5){return _0x283c75[_0xd654('0x17')](_0x3b040f);}return _0x283c75[_0xd654('0x18')](_0x3b040f)['end']();};}function respondWithResult(_0x94b633,_0x25b621){_0x25b621=_0x25b621||0xc8;return function(_0x5b2a26){if(_0x5b2a26){return _0x94b633[_0xd654('0x18')](_0x25b621)[_0xd654('0x19')](_0x5b2a26);}};}function respondWithFilteredResult(_0xbd79f3,_0x275ef0){return function(_0x175d09){if(_0x175d09){var _0x494bd8=_0x175d09[_0xd654('0x1a')],_0x3b95b8=_0x275ef0[_0xd654('0x1b')],_0x1bf82b=_0x275ef0[_0xd654('0x1b')]+_0x275ef0[_0xd654('0x1c')],_0x3c50e4;if(_0x1bf82b>=_0x494bd8){_0x1bf82b=_0x494bd8;_0x3c50e4=0xc8;}else{_0x3c50e4=0xce;}_0xbd79f3[_0xd654('0x18')](_0x3c50e4);return _0xbd79f3[_0xd654('0x1d')](_0xd654('0x1e'),_0x3b95b8+'-'+_0x1bf82b+'/'+_0x494bd8)[_0xd654('0x19')](_0x175d09);}return null;};}function patchUpdates(_0x476636){return function(_0x428168){try{jsonpatch[_0xd654('0x1f')](_0x428168,_0x476636,!![]);}catch(_0x26123d){return BPromise[_0xd654('0x20')](_0x26123d);}return _0x428168['save']();};}function saveUpdates(_0x42df61,_0x5b2351){return function(_0x5e89c6){if(_0x5e89c6){return _0x5e89c6['update'](_0x42df61)[_0xd654('0x21')](function(_0x2e44ab){return _0x2e44ab;});}return null;};}function removeEntity(_0x369fe6,_0x1c1308){return function(_0x325a45){if(_0x325a45){return _0x325a45['destroy']()[_0xd654('0x21')](function(){var _0x4113f9=_0x325a45[_0xd654('0x22')]({'plain':!![]});var _0x297e51='Companies';return db[_0xd654('0x23')][_0xd654('0x24')]({'where':{'type':_0x297e51,'resourceId':_0x4113f9['id']}})[_0xd654('0x21')](function(){return _0x325a45;});})[_0xd654('0x21')](function(){_0x369fe6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35710b,_0x3ca96a){return function(_0x576bf3){if(!_0x576bf3){_0x35710b[_0xd654('0x17')](0x194);}return _0x576bf3;};}function handleError(_0x319654,_0x4ee823){_0x4ee823=_0x4ee823||0x1f4;return function(_0x686019){logger[_0xd654('0x25')](_0x686019[_0xd654('0x26')]);if(_0x686019['name']){delete _0x686019['name'];}_0x319654[_0xd654('0x18')](_0x4ee823)[_0xd654('0x27')](_0x686019);};}exports[_0xd654('0x28')]=function(_0x2c2fb4,_0xa4e297){var _0x17c5a1={},_0x154dfa={},_0x168a63={'count':0x0,'rows':[]};return db[_0xd654('0x29')]['describe']()[_0xd654('0x21')](function(_0x3beb4b){_0x154dfa['model']=_[_0xd654('0x2a')](_0x3beb4b);_0x154dfa['query']=_[_0xd654('0x2a')](_0x2c2fb4[_0xd654('0x2b')]);_0x154dfa['filters']=_['intersection'](_0x154dfa[_0xd654('0x2c')],_0x154dfa['query']);_0x17c5a1['attributes']=_[_0xd654('0x2d')](_0x154dfa[_0xd654('0x2c')],qs[_0xd654('0x2e')](_0x2c2fb4[_0xd654('0x2b')][_0xd654('0x2e')]));_0x17c5a1['attributes']=_0x17c5a1['attributes']['length']?_0x17c5a1[_0xd654('0x2f')]:_0x154dfa[_0xd654('0x2c')];if(!_0x2c2fb4['query'][_0xd654('0x30')](_0xd654('0x31'))){_0x17c5a1[_0xd654('0x1c')]=qs['limit'](_0x2c2fb4[_0xd654('0x2b')][_0xd654('0x1c')]);_0x17c5a1[_0xd654('0x1b')]=qs[_0xd654('0x1b')](_0x2c2fb4['query'][_0xd654('0x1b')]);}_0x17c5a1['order']=qs['sort'](_0x2c2fb4['query'][_0xd654('0x32')]);_0x17c5a1[_0xd654('0x33')]=qs[_0xd654('0x34')](_[_0xd654('0x35')](_0x2c2fb4[_0xd654('0x2b')],_0x154dfa[_0xd654('0x34')]),_0x3beb4b);if(_0x2c2fb4[_0xd654('0x2b')]['filter']){_0x17c5a1[_0xd654('0x33')]=_[_0xd654('0x36')](_0x17c5a1[_0xd654('0x33')],{'$or':_[_0xd654('0x37')](_0x17c5a1[_0xd654('0x2f')],function(_0x155c62){var _0x1e614a={};_0x1e614a[_0x155c62]={'$like':'%'+_0x2c2fb4[_0xd654('0x2b')][_0xd654('0x38')]+'%'};return _0x1e614a;})});}_0x17c5a1=_[_0xd654('0x36')]({},_0x17c5a1,_0x2c2fb4[_0xd654('0x39')]);var _0x3e208a={'where':_0x17c5a1[_0xd654('0x33')]};return db['CmCompany'][_0xd654('0x1a')](_0x3e208a)[_0xd654('0x21')](function(_0x1c747f){_0x168a63[_0xd654('0x1a')]=_0x1c747f;if(_0x2c2fb4[_0xd654('0x2b')][_0xd654('0x3a')]){_0x17c5a1[_0xd654('0x3b')]=[{'all':!![]}];}return db[_0xd654('0x29')][_0xd654('0x3c')](_0x17c5a1);})[_0xd654('0x21')](function(_0x1a1cf7){_0x168a63[_0xd654('0x3d')]=_0x1a1cf7;return _0x168a63;})[_0xd654('0x21')](respondWithFilteredResult(_0xa4e297,_0x17c5a1))['catch'](handleError(_0xa4e297,null));})[_0xd654('0x3e')](handleError(_0xa4e297,null));};exports[_0xd654('0x3f')]=function(_0x3ba5bb,_0x499120){var _0x3bf11a={'raw':![],'where':{'id':_0x3ba5bb[_0xd654('0x40')]['id']}},_0x4b0671={};_0x4b0671[_0xd654('0x2c')]=_['keys'](db[_0xd654('0x29')]['rawAttributes']);_0x4b0671[_0xd654('0x2b')]=_['keys'](_0x3ba5bb['query']);_0x4b0671[_0xd654('0x34')]=_[_0xd654('0x2d')](_0x4b0671[_0xd654('0x2c')],_0x4b0671['query']);_0x3bf11a['attributes']=_[_0xd654('0x2d')](_0x4b0671[_0xd654('0x2c')],qs[_0xd654('0x2e')](_0x3ba5bb[_0xd654('0x2b')]['fields']));_0x3bf11a['attributes']=_0x3bf11a['attributes']['length']?_0x3bf11a['attributes']:_0x4b0671[_0xd654('0x2c')];if(_0x3ba5bb[_0xd654('0x2b')][_0xd654('0x3a')]){_0x3bf11a[_0xd654('0x3b')]=[{'all':!![]}];}_0x3bf11a=_['merge']({},_0x3bf11a,_0x3ba5bb['options']);return db[_0xd654('0x29')][_0xd654('0x41')](_0x3bf11a)[_0xd654('0x21')](handleEntityNotFound(_0x499120,null))['then'](respondWithResult(_0x499120,null))[_0xd654('0x3e')](handleError(_0x499120,null));};exports['create']=function(_0x322bb2,_0x3b5468){return db[_0xd654('0x29')][_0xd654('0x42')](_0x322bb2['body'],{})[_0xd654('0x21')](function(_0x462e4f){var _0x5394fc=_0x322bb2[_0xd654('0x43')][_0xd654('0x22')]({'plain':!![]});if(!_0x5394fc)throw new Error(_0xd654('0x44'));if(_0x5394fc[_0xd654('0x45')]===_0xd654('0x43')){var _0x461237=_0x462e4f[_0xd654('0x22')]({'plain':!![]});var _0x40fbae=_0xd654('0x46');return db['UserProfileSection']['find']({'where':{'name':_0x40fbae,'userProfileId':_0x5394fc['userProfileId']},'raw':!![]})[_0xd654('0x21')](function(_0x56321c){if(_0x56321c&&_0x56321c[_0xd654('0x47')]===0x0){return db['UserProfileResource'][_0xd654('0x42')]({'name':_0x461237[_0xd654('0x48')],'resourceId':_0x461237['id'],'type':_0x56321c[_0xd654('0x48')],'sectionId':_0x56321c['id']},{})[_0xd654('0x21')](function(){return _0x462e4f;});}else{return _0x462e4f;}})[_0xd654('0x3e')](function(_0x535385){logger[_0xd654('0x25')](_0xd654('0x49'),_0x535385);throw _0x535385;});}return _0x462e4f;})['then'](respondWithResult(_0x3b5468,0xc9))[_0xd654('0x3e')](handleError(_0x3b5468,null));};exports[_0xd654('0x4a')]=function(_0x324900,_0xeb963){if(_0x324900[_0xd654('0x4b')]['id']){delete _0x324900[_0xd654('0x4b')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x324900['params']['id']}})['then'](handleEntityNotFound(_0xeb963,null))['then'](saveUpdates(_0x324900[_0xd654('0x4b')],null))[_0xd654('0x21')](respondWithResult(_0xeb963,null))[_0xd654('0x3e')](handleError(_0xeb963,null));};exports[_0xd654('0x24')]=function(_0x27e980,_0x36a99e){return db[_0xd654('0x29')][_0xd654('0x41')]({'where':{'id':_0x27e980[_0xd654('0x40')]['id']}})[_0xd654('0x21')](handleEntityNotFound(_0x36a99e,null))['then'](removeEntity(_0x36a99e,null))[_0xd654('0x3e')](handleError(_0x36a99e,null));};exports[_0xd654('0x4c')]=function(_0x116c76,_0x15a6c3){return db[_0xd654('0x29')][_0xd654('0x4c')]()[_0xd654('0x21')](respondWithResult(_0x15a6c3,null))[_0xd654('0x3e')](handleError(_0x15a6c3,null));};exports[_0xd654('0x4d')]=function(_0x53c0e0,_0x577aaf,_0x3c9b3d){return db[_0xd654('0x4e')][_0xd654('0x41')]({'where':{'id':_0x53c0e0[_0xd654('0x40')]['id']}})[_0xd654('0x21')](handleEntityNotFound(_0x577aaf,null))['then'](function(_0x2af779){if(_0x2af779){return _0x2af779['addContacts'](_0x53c0e0[_0xd654('0x4b')][_0xd654('0x4f')],_[_0xd654('0x50')](_0x53c0e0[_0xd654('0x4b')],[_0xd654('0x4f'),'id'])||{});}})[_0xd654('0x21')](respondWithResult(_0x577aaf,null))[_0xd654('0x3e')](handleError(_0x577aaf,null));};exports['getContacts']=function(_0xac2a7a,_0xc8e36f,_0x3466cf){var _0x576595={};var _0x36eb2b={};var _0x1edced;var _0x3c063b;return db[_0xd654('0x29')][_0xd654('0x51')]({'where':{'id':_0xac2a7a[_0xd654('0x40')]['id']}})[_0xd654('0x21')](handleEntityNotFound(_0xc8e36f,null))[_0xd654('0x21')](function(_0x7468d9){if(_0x7468d9){_0x1edced=_0x7468d9;_0x36eb2b[_0xd654('0x2c')]=_['keys'](db[_0xd654('0x4e')]['rawAttributes']);_0x36eb2b[_0xd654('0x2b')]=_[_0xd654('0x2a')](_0xac2a7a['query']);_0x36eb2b[_0xd654('0x34')]=_[_0xd654('0x2d')](_0x36eb2b[_0xd654('0x2c')],_0x36eb2b[_0xd654('0x2b')]);_0x576595[_0xd654('0x2f')]=_[_0xd654('0x2d')](_0x36eb2b[_0xd654('0x2c')],qs[_0xd654('0x2e')](_0xac2a7a[_0xd654('0x2b')]['fields']));_0x576595['attributes']=_0x576595[_0xd654('0x2f')][_0xd654('0x52')]?_0x576595[_0xd654('0x2f')]:_0x36eb2b[_0xd654('0x2c')];_0x576595[_0xd654('0x53')]=qs[_0xd654('0x32')](_0xac2a7a['query']['sort']);_0x576595['where']=qs[_0xd654('0x34')](_['pick'](_0xac2a7a[_0xd654('0x2b')],_0x36eb2b[_0xd654('0x34')]));if(_0xac2a7a[_0xd654('0x2b')][_0xd654('0x38')]){_0x576595[_0xd654('0x33')]=_[_0xd654('0x36')](_0x576595[_0xd654('0x33')],{'$or':_[_0xd654('0x37')](_0x576595[_0xd654('0x2f')],function(_0x208a0c){var _0x14c8b7={};_0x14c8b7[_0x208a0c]={'$like':'%'+_0xac2a7a[_0xd654('0x2b')]['filter']+'%'};return _0x14c8b7;})});}_0x576595=_[_0xd654('0x36')]({},_0x576595,_0xac2a7a[_0xd654('0x39')]);return _0x1edced['getContacts'](_0x576595);}})[_0xd654('0x21')](function(_0x12cb32){if(_0x12cb32){_0x3c063b=_0x12cb32['length'];if(!_0xac2a7a[_0xd654('0x2b')][_0xd654('0x30')](_0xd654('0x31'))){_0x576595[_0xd654('0x1c')]=qs['limit'](_0xac2a7a[_0xd654('0x2b')][_0xd654('0x1c')]);_0x576595[_0xd654('0x1b')]=qs[_0xd654('0x1b')](_0xac2a7a['query'][_0xd654('0x1b')]);}return _0x1edced[_0xd654('0x54')](_0x576595);}})[_0xd654('0x21')](function(_0x5c7a1c){if(_0x5c7a1c){return _0x5c7a1c?{'count':_0x3c063b,'rows':_0x5c7a1c}:null;}})[_0xd654('0x21')](respondWithResult(_0xc8e36f,null))[_0xd654('0x3e')](handleError(_0xc8e36f,null));}; \ No newline at end of file +var _0x5189=['moment','bluebird','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','apply','save','update','then','get','Companies','UserProfileResource','destroy','error','stack','name','send','index','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','where','merge','map','CmCompany','count','includeAll','findAll','catch','show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','omit','ids','getContacts','sort','pick','options','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2550ca,_0x5d385b){var _0x13bed4=function(_0x182491){while(--_0x182491){_0x2550ca['push'](_0x2550ca['shift']());}};_0x13bed4(++_0x5d385b);}(_0x5189,0x143));var _0x9518=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x5189[_0xbe40ad];return _0x50fac9;};'use strict';var pdf=require(_0x9518('0x0'));var emlformat=require(_0x9518('0x1'));var rimraf=require(_0x9518('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9518('0x3'));var rp=require(_0x9518('0x4'));var moment=require(_0x9518('0x5'));var BPromise=require(_0x9518('0x6'));var Mustache=require('mustache');var util=require(_0x9518('0x7'));var path=require('path');var sox=require(_0x9518('0x8'));var csv=require('to-csv');var ejs=require(_0x9518('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9518('0xa'));var crypto=require(_0x9518('0xb'));var jsforce=require(_0x9518('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9518('0xd'));var querystring=require(_0x9518('0xe'));var Papa=require(_0x9518('0xf'));var Redis=require('ioredis');var authService=require(_0x9518('0x10'));var qs=require(_0x9518('0x11'));var as=require(_0x9518('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9518('0x13'));var utils=require(_0x9518('0x14'));var config=require(_0x9518('0x15'));var db=require(_0x9518('0x16'))['db'];function respondWithStatusCode(_0x4dd9a8,_0x3e1597){_0x3e1597=_0x3e1597||0xcc;return function(_0x44d6a0){if(_0x44d6a0){return _0x4dd9a8[_0x9518('0x17')](_0x3e1597);}return _0x4dd9a8[_0x9518('0x18')](_0x3e1597)[_0x9518('0x19')]();};}function respondWithResult(_0x4e5510,_0x3202c0){_0x3202c0=_0x3202c0||0xc8;return function(_0x555ffa){if(_0x555ffa){return _0x4e5510['status'](_0x3202c0)[_0x9518('0x1a')](_0x555ffa);}};}function respondWithFilteredResult(_0x4966b2,_0x2de378){return function(_0x16f747){if(_0x16f747){var _0x1fd468=_0x16f747['count'],_0x9cacb1=_0x2de378[_0x9518('0x1b')],_0x5c089e=_0x2de378['offset']+_0x2de378['limit'],_0x11eaea;if(_0x5c089e>=_0x1fd468){_0x5c089e=_0x1fd468;_0x11eaea=0xc8;}else{_0x11eaea=0xce;}_0x4966b2[_0x9518('0x18')](_0x11eaea);return _0x4966b2[_0x9518('0x1c')]('Content-Range',_0x9cacb1+'-'+_0x5c089e+'/'+_0x1fd468)[_0x9518('0x1a')](_0x16f747);}return null;};}function patchUpdates(_0x146b1a){return function(_0x4b8ab7){try{jsonpatch[_0x9518('0x1d')](_0x4b8ab7,_0x146b1a,!![]);}catch(_0x516d38){return BPromise['reject'](_0x516d38);}return _0x4b8ab7[_0x9518('0x1e')]();};}function saveUpdates(_0xda71a4,_0x233bd4){return function(_0x50cebb){if(_0x50cebb){return _0x50cebb[_0x9518('0x1f')](_0xda71a4)['then'](function(_0x241400){return _0x241400;});}return null;};}function removeEntity(_0x3fb724,_0x9fb47e){return function(_0x45e98e){if(_0x45e98e){return _0x45e98e['destroy']()[_0x9518('0x20')](function(){var _0x549b20=_0x45e98e[_0x9518('0x21')]({'plain':!![]});var _0x4110d0=_0x9518('0x22');return db[_0x9518('0x23')][_0x9518('0x24')]({'where':{'type':_0x4110d0,'resourceId':_0x549b20['id']}})['then'](function(){return _0x45e98e;});})['then'](function(){_0x3fb724[_0x9518('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b49fa,_0x241bcd){return function(_0x33b76f){if(!_0x33b76f){_0x4b49fa['sendStatus'](0x194);}return _0x33b76f;};}function handleError(_0x2c94a9,_0x1cc1cb){_0x1cc1cb=_0x1cc1cb||0x1f4;return function(_0x929340){logger[_0x9518('0x25')](_0x929340[_0x9518('0x26')]);if(_0x929340[_0x9518('0x27')]){delete _0x929340[_0x9518('0x27')];}_0x2c94a9[_0x9518('0x18')](_0x1cc1cb)[_0x9518('0x28')](_0x929340);};}exports[_0x9518('0x29')]=function(_0x2f0682,_0x11e363){var _0x8d7799={},_0x379e14={},_0x59441d={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x9518('0x20')](function(_0x229056){_0x379e14['model']=_[_0x9518('0x2a')](_0x229056);_0x379e14[_0x9518('0x2b')]=_['keys'](_0x2f0682[_0x9518('0x2b')]);_0x379e14[_0x9518('0x2c')]=_[_0x9518('0x2d')](_0x379e14['model'],_0x379e14[_0x9518('0x2b')]);_0x8d7799[_0x9518('0x2e')]=_['intersection'](_0x379e14['model'],qs[_0x9518('0x2f')](_0x2f0682[_0x9518('0x2b')][_0x9518('0x2f')]));_0x8d7799[_0x9518('0x2e')]=_0x8d7799['attributes'][_0x9518('0x30')]?_0x8d7799['attributes']:_0x379e14[_0x9518('0x31')];if(!_0x2f0682[_0x9518('0x2b')][_0x9518('0x32')](_0x9518('0x33'))){_0x8d7799[_0x9518('0x34')]=qs[_0x9518('0x34')](_0x2f0682['query']['limit']);_0x8d7799['offset']=qs[_0x9518('0x1b')](_0x2f0682[_0x9518('0x2b')][_0x9518('0x1b')]);}_0x8d7799[_0x9518('0x35')]=qs['sort'](_0x2f0682['query']['sort']);_0x8d7799['where']=qs[_0x9518('0x2c')](_['pick'](_0x2f0682[_0x9518('0x2b')],_0x379e14[_0x9518('0x2c')]),_0x229056);if(_0x2f0682[_0x9518('0x2b')]['filter']){_0x8d7799[_0x9518('0x36')]=_[_0x9518('0x37')](_0x8d7799[_0x9518('0x36')],{'$or':_[_0x9518('0x38')](_0x8d7799[_0x9518('0x2e')],function(_0xbafe1e){var _0x3d6394={};_0x3d6394[_0xbafe1e]={'$like':'%'+_0x2f0682[_0x9518('0x2b')]['filter']+'%'};return _0x3d6394;})});}_0x8d7799=_[_0x9518('0x37')]({},_0x8d7799,_0x2f0682['options']);var _0x1c4e2c={'where':_0x8d7799[_0x9518('0x36')]};return db[_0x9518('0x39')][_0x9518('0x3a')](_0x1c4e2c)[_0x9518('0x20')](function(_0x195079){_0x59441d[_0x9518('0x3a')]=_0x195079;if(_0x2f0682['query'][_0x9518('0x3b')]){_0x8d7799['include']=[{'all':!![]}];}return db['CmCompany'][_0x9518('0x3c')](_0x8d7799);})['then'](function(_0x2d08ca){_0x59441d['rows']=_0x2d08ca;return _0x59441d;})[_0x9518('0x20')](respondWithFilteredResult(_0x11e363,_0x8d7799))['catch'](handleError(_0x11e363,null));})[_0x9518('0x3d')](handleError(_0x11e363,null));};exports[_0x9518('0x3e')]=function(_0x2e4a0b,_0x5205ce){var _0x275212={'raw':![],'where':{'id':_0x2e4a0b['params']['id']}},_0x1c282a={};_0x1c282a[_0x9518('0x31')]=_[_0x9518('0x2a')](db['CmCompany'][_0x9518('0x3f')]);_0x1c282a[_0x9518('0x2b')]=_[_0x9518('0x2a')](_0x2e4a0b['query']);_0x1c282a[_0x9518('0x2c')]=_[_0x9518('0x2d')](_0x1c282a['model'],_0x1c282a['query']);_0x275212[_0x9518('0x2e')]=_['intersection'](_0x1c282a[_0x9518('0x31')],qs[_0x9518('0x2f')](_0x2e4a0b[_0x9518('0x2b')]['fields']));_0x275212['attributes']=_0x275212[_0x9518('0x2e')][_0x9518('0x30')]?_0x275212[_0x9518('0x2e')]:_0x1c282a['model'];if(_0x2e4a0b[_0x9518('0x2b')]['includeAll']){_0x275212['include']=[{'all':!![]}];}_0x275212=_[_0x9518('0x37')]({},_0x275212,_0x2e4a0b['options']);return db[_0x9518('0x39')]['find'](_0x275212)[_0x9518('0x20')](handleEntityNotFound(_0x5205ce,null))[_0x9518('0x20')](respondWithResult(_0x5205ce,null))['catch'](handleError(_0x5205ce,null));};exports[_0x9518('0x40')]=function(_0x10dc4f,_0x1863aa){return db[_0x9518('0x39')]['create'](_0x10dc4f[_0x9518('0x41')],{})[_0x9518('0x20')](function(_0x5efd3d){var _0xa20460=_0x10dc4f[_0x9518('0x42')]['get']({'plain':!![]});if(!_0xa20460)throw new Error(_0x9518('0x43'));if(_0xa20460[_0x9518('0x44')]===_0x9518('0x42')){var _0x80fcfe=_0x5efd3d[_0x9518('0x21')]({'plain':!![]});var _0x5d1c89=_0x9518('0x22');return db['UserProfileSection'][_0x9518('0x45')]({'where':{'name':_0x5d1c89,'userProfileId':_0xa20460[_0x9518('0x46')]},'raw':!![]})[_0x9518('0x20')](function(_0x208e49){if(_0x208e49&&_0x208e49['autoAssociation']===0x0){return db[_0x9518('0x23')][_0x9518('0x40')]({'name':_0x80fcfe[_0x9518('0x27')],'resourceId':_0x80fcfe['id'],'type':_0x208e49[_0x9518('0x27')],'sectionId':_0x208e49['id']},{})['then'](function(){return _0x5efd3d;});}else{return _0x5efd3d;}})[_0x9518('0x3d')](function(_0x210249){logger[_0x9518('0x25')](_0x9518('0x47'),_0x210249);throw _0x210249;});}return _0x5efd3d;})[_0x9518('0x20')](respondWithResult(_0x1863aa,0xc9))[_0x9518('0x3d')](handleError(_0x1863aa,null));};exports['update']=function(_0x318e5d,_0x27e6c9){if(_0x318e5d[_0x9518('0x41')]['id']){delete _0x318e5d[_0x9518('0x41')]['id'];}return db[_0x9518('0x39')]['find']({'where':{'id':_0x318e5d[_0x9518('0x48')]['id']}})[_0x9518('0x20')](handleEntityNotFound(_0x27e6c9,null))['then'](saveUpdates(_0x318e5d[_0x9518('0x41')],null))[_0x9518('0x20')](respondWithResult(_0x27e6c9,null))[_0x9518('0x3d')](handleError(_0x27e6c9,null));};exports[_0x9518('0x24')]=function(_0x5eb9b6,_0x5497b6){return db['CmCompany'][_0x9518('0x45')]({'where':{'id':_0x5eb9b6[_0x9518('0x48')]['id']}})[_0x9518('0x20')](handleEntityNotFound(_0x5497b6,null))[_0x9518('0x20')](removeEntity(_0x5497b6,null))['catch'](handleError(_0x5497b6,null));};exports['describe']=function(_0x43d366,_0x50387e){return db['CmCompany'][_0x9518('0x49')]()[_0x9518('0x20')](respondWithResult(_0x50387e,null))['catch'](handleError(_0x50387e,null));};exports[_0x9518('0x4a')]=function(_0x4e8de7,_0x11ef0e,_0x2e5c08){return db[_0x9518('0x4b')]['find']({'where':{'id':_0x4e8de7[_0x9518('0x48')]['id']}})[_0x9518('0x20')](handleEntityNotFound(_0x11ef0e,null))[_0x9518('0x20')](function(_0x3f293b){if(_0x3f293b){return _0x3f293b['addContacts'](_0x4e8de7[_0x9518('0x41')]['ids'],_[_0x9518('0x4c')](_0x4e8de7[_0x9518('0x41')],[_0x9518('0x4d'),'id'])||{});}})[_0x9518('0x20')](respondWithResult(_0x11ef0e,null))[_0x9518('0x3d')](handleError(_0x11ef0e,null));};exports[_0x9518('0x4e')]=function(_0x239b36,_0x482dae,_0x6795aa){var _0x4c92a9={};var _0x3d2abd={};var _0x4b5f4c;var _0x4c998b;return db[_0x9518('0x39')]['findOne']({'where':{'id':_0x239b36['params']['id']}})[_0x9518('0x20')](handleEntityNotFound(_0x482dae,null))[_0x9518('0x20')](function(_0x4323e2){if(_0x4323e2){_0x4b5f4c=_0x4323e2;_0x3d2abd['model']=_['keys'](db[_0x9518('0x4b')]['rawAttributes']);_0x3d2abd[_0x9518('0x2b')]=_[_0x9518('0x2a')](_0x239b36[_0x9518('0x2b')]);_0x3d2abd[_0x9518('0x2c')]=_[_0x9518('0x2d')](_0x3d2abd[_0x9518('0x31')],_0x3d2abd[_0x9518('0x2b')]);_0x4c92a9[_0x9518('0x2e')]=_[_0x9518('0x2d')](_0x3d2abd['model'],qs[_0x9518('0x2f')](_0x239b36[_0x9518('0x2b')][_0x9518('0x2f')]));_0x4c92a9['attributes']=_0x4c92a9[_0x9518('0x2e')]['length']?_0x4c92a9[_0x9518('0x2e')]:_0x3d2abd['model'];_0x4c92a9[_0x9518('0x35')]=qs[_0x9518('0x4f')](_0x239b36[_0x9518('0x2b')][_0x9518('0x4f')]);_0x4c92a9[_0x9518('0x36')]=qs['filters'](_[_0x9518('0x50')](_0x239b36['query'],_0x3d2abd[_0x9518('0x2c')]));if(_0x239b36['query']['filter']){_0x4c92a9[_0x9518('0x36')]=_['merge'](_0x4c92a9[_0x9518('0x36')],{'$or':_['map'](_0x4c92a9[_0x9518('0x2e')],function(_0x5a2551){var _0x5d085f={};_0x5d085f[_0x5a2551]={'$like':'%'+_0x239b36[_0x9518('0x2b')]['filter']+'%'};return _0x5d085f;})});}_0x4c92a9=_[_0x9518('0x37')]({},_0x4c92a9,_0x239b36[_0x9518('0x51')]);return _0x4b5f4c['getContacts'](_0x4c92a9);}})[_0x9518('0x20')](function(_0x26096a){if(_0x26096a){_0x4c998b=_0x26096a['length'];if(!_0x239b36[_0x9518('0x2b')][_0x9518('0x32')](_0x9518('0x33'))){_0x4c92a9[_0x9518('0x34')]=qs[_0x9518('0x34')](_0x239b36['query']['limit']);_0x4c92a9[_0x9518('0x1b')]=qs[_0x9518('0x1b')](_0x239b36['query'][_0x9518('0x1b')]);}return _0x4b5f4c['getContacts'](_0x4c92a9);}})[_0x9518('0x20')](function(_0x1350a4){if(_0x1350a4){return _0x1350a4?{'count':_0x4c998b,'rows':_0x1350a4}:null;}})[_0x9518('0x20')](respondWithResult(_0x482dae,null))[_0x9518('0x3d')](handleError(_0x482dae,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c531345..4de4f65 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 _0x0ff5=['api','moment','bluebird','request-promise','path','rimraf','exports','cm_companies','lodash','../../config/logger'];(function(_0x5c3249,_0x221647){var _0x5a2458=function(_0x4cb973){while(--_0x4cb973){_0x5c3249['push'](_0x5c3249['shift']());}};_0x5a2458(++_0x221647);}(_0x0ff5,0x166));var _0x50ff=function(_0x569a45,_0x2da15b){_0x569a45=_0x569a45-0x0;var _0x1a5ef8=_0x0ff5[_0x569a45];return _0x1a5ef8;};'use strict';var _=require(_0x50ff('0x0'));var util=require('util');var logger=require(_0x50ff('0x1'))(_0x50ff('0x2'));var moment=require(_0x50ff('0x3'));var BPromise=require(_0x50ff('0x4'));var rp=require(_0x50ff('0x5'));var fs=require('fs');var path=require(_0x50ff('0x6'));var rimraf=require(_0x50ff('0x7'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x50ff('0x8')]=function(_0x4d470d,_0x26156a){return _0x4d470d['define']('CmCompany',attributes,{'tableName':_0x50ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8053=['path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','util','../../config/logger','api','moment','bluebird'];(function(_0x59c6a1,_0x27b198){var _0x1f6560=function(_0x18a9b8){while(--_0x18a9b8){_0x59c6a1['push'](_0x59c6a1['shift']());}};_0x1f6560(++_0x27b198);}(_0x8053,0xa3));var _0x3805=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x8053[_0x5c1345];return _0x1c070d;};'use strict';var _=require('lodash');var util=require(_0x3805('0x0'));var logger=require(_0x3805('0x1'))(_0x3805('0x2'));var moment=require(_0x3805('0x3'));var BPromise=require(_0x3805('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3805('0x5'));var rimraf=require(_0x3805('0x6'));var config=require(_0x3805('0x7'));var attributes=require(_0x3805('0x8'));module[_0x3805('0x9')]=function(_0x1b27a0,_0x1eed0b){return _0x1b27a0[_0x3805('0xa')](_0x3805('0xb'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 7bd4d0e..f28e9a5 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 _0xbd89=['message','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmCompany,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x382bdd,_0x4e0534){var _0x1f29d8=function(_0x201f49){while(--_0x201f49){_0x382bdd['push'](_0x382bdd['shift']());}};_0x1f29d8(++_0x4e0534);}(_0xbd89,0xa3));var _0x9bd8=function(_0x15243b,_0x340ea5){_0x15243b=_0x15243b-0x0;var _0x337790=_0xbd89[_0x15243b];return _0x337790;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9bd8('0x0'));var BPromise=require(_0x9bd8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bd8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9bd8('0x3'));var logger=require(_0x9bd8('0x4'))(_0x9bd8('0x5'));var config=require(_0x9bd8('0x6'));var jayson=require(_0x9bd8('0x7'));var client=jayson['client'][_0x9bd8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2deed8,_0x16f7de,_0x92d570){return new BPromise(function(_0x1fd911,_0x3e9e4e){return client[_0x9bd8('0x9')](_0x2deed8,_0x92d570)['then'](function(_0x299e3a){logger[_0x9bd8('0xa')](_0x9bd8('0xb'),_0x16f7de,'request\x20sent');logger[_0x9bd8('0xc')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x16f7de,_0x9bd8('0xd'),JSON[_0x9bd8('0xe')](_0x299e3a));if(_0x299e3a[_0x9bd8('0xf')]){if(_0x299e3a['error'][_0x9bd8('0x10')]===0x1f4){logger[_0x9bd8('0xf')](_0x9bd8('0xb'),_0x16f7de,_0x299e3a[_0x9bd8('0xf')][_0x9bd8('0x11')]);return _0x3e9e4e(_0x299e3a[_0x9bd8('0xf')][_0x9bd8('0x11')]);}logger[_0x9bd8('0xf')](_0x9bd8('0xb'),_0x16f7de,_0x299e3a[_0x9bd8('0xf')][_0x9bd8('0x11')]);return _0x1fd911(_0x299e3a[_0x9bd8('0xf')][_0x9bd8('0x11')]);}else{logger[_0x9bd8('0xa')]('CmCompany,\x20%s,\x20%s',_0x16f7de,'request\x20sent');_0x1fd911(_0x299e3a[_0x9bd8('0x12')][_0x9bd8('0x11')]);}})[_0x9bd8('0x13')](function(_0x19ca5f){logger['error'](_0x9bd8('0xb'),_0x16f7de,_0x19ca5f);_0x3e9e4e(_0x19ca5f);});});} \ No newline at end of file +var _0x8e98=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x368755,_0x53ff2d){var _0x242683=function(_0x383f80){while(--_0x383f80){_0x368755['push'](_0x368755['shift']());}};_0x242683(++_0x53ff2d);}(_0x8e98,0x66));var _0x88e9=function(_0x2fccb1,_0x5099d4){_0x2fccb1=_0x2fccb1-0x0;var _0x562ce3=_0x8e98[_0x2fccb1];return _0x562ce3;};'use strict';var _=require(_0x88e9('0x0'));var util=require('util');var moment=require(_0x88e9('0x1'));var BPromise=require(_0x88e9('0x2'));var rs=require(_0x88e9('0x3'));var fs=require('fs');var Redis=require(_0x88e9('0x4'));var db=require(_0x88e9('0x5'))['db'];var utils=require(_0x88e9('0x6'));var logger=require(_0x88e9('0x7'))('rpc');var config=require(_0x88e9('0x8'));var jayson=require(_0x88e9('0x9'));var client=jayson[_0x88e9('0xa')][_0x88e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x370cac,_0x159e89,_0x136d3a){return new BPromise(function(_0x439a35,_0x30a06e){return client[_0x88e9('0xc')](_0x370cac,_0x136d3a)['then'](function(_0x402599){logger[_0x88e9('0xd')](_0x88e9('0xe'),_0x159e89,_0x88e9('0xf'));logger[_0x88e9('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x159e89,_0x88e9('0xf'),JSON[_0x88e9('0x11')](_0x402599));if(_0x402599['error']){if(_0x402599[_0x88e9('0x12')][_0x88e9('0x13')]===0x1f4){logger[_0x88e9('0x12')]('CmCompany,\x20%s,\x20%s',_0x159e89,_0x402599[_0x88e9('0x12')][_0x88e9('0x14')]);return _0x30a06e(_0x402599[_0x88e9('0x12')][_0x88e9('0x14')]);}logger[_0x88e9('0x12')]('CmCompany,\x20%s,\x20%s',_0x159e89,_0x402599[_0x88e9('0x12')][_0x88e9('0x14')]);return _0x439a35(_0x402599[_0x88e9('0x12')][_0x88e9('0x14')]);}else{logger[_0x88e9('0xd')](_0x88e9('0xe'),_0x159e89,'request\x20sent');_0x439a35(_0x402599[_0x88e9('0x15')][_0x88e9('0x14')]);}})[_0x88e9('0x16')](function(_0x15c741){logger[_0x88e9('0x12')](_0x88e9('0xe'),_0x159e89,_0x15c741);_0x30a06e(_0x15c741);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 75c5cd8..102b615 100644 --- a/server/api/cmCompany/index.js +++ b/server/api/cmCompany/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmCompany.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x8')](_0x7995('0xe'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0x10')](_0x7995('0xe'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0xedd9=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','util'];(function(_0x3eab79,_0x3868a4){var _0x45fc2f=function(_0x2c53c6){while(--_0x2c53c6){_0x3eab79['push'](_0x3eab79['shift']());}};_0x45fc2f(++_0x3868a4);}(_0xedd9,0xfc));var _0x9edd=function(_0x53c58d,_0x592b13){_0x53c58d=_0x53c58d-0x0;var _0x5e514a=_0xedd9[_0x53c58d];return _0x5e514a;};'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('./cmCompany.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/describe',auth[_0x9edd('0x9')](),controller['describe']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['get'](_0x9edd('0xd'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0xf')]('/:id/contacts',auth[_0x9edd('0x9')](),controller[_0x9edd('0x11')]);router[_0x9edd('0x12')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x13')]);router[_0x9edd('0x14')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0x15')]);module[_0x9edd('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index bf20bd1..7beece4 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 _0xeb21=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x3455a1,_0x1c1eda){var _0x2b42f8=function(_0x103617){while(--_0x103617){_0x3455a1['push'](_0x3455a1['shift']());}};_0x2b42f8(++_0x1c1eda);}(_0xeb21,0x156));var _0x1eb2=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0xeb21[_0x333714];return _0x4c211e;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0x1eb2('0x0')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1eb2('0x0')]},'city':{'type':Sequelize[_0x1eb2('0x0')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1eb2('0x1')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x1eb2('0x0')]},'fax':{'type':Sequelize[_0x1eb2('0x0')]},'email':{'type':Sequelize[_0x1eb2('0x0')]},'url':{'type':Sequelize[_0x1eb2('0x0')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x1eb2('0x0')]},'twitter':{'type':Sequelize[_0x1eb2('0x0')]},'skype':{'type':Sequelize[_0x1eb2('0x0')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x1eb2('0x0')]},'line':{'type':Sequelize[_0x1eb2('0x0')]},'wechat':{'type':Sequelize[_0x1eb2('0x0')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x1eb2('0x2')]},'priority':{'type':Sequelize[_0x1eb2('0x2')](0x2)[_0x1eb2('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1eb2('0x4')],'defaultValue':Sequelize[_0x1eb2('0x5')]},'dialTimezone':{'type':Sequelize[_0x1eb2('0x0')]},'utcOffset':{'type':Sequelize[_0x1eb2('0x2')]}}; \ No newline at end of file +var _0x29b3=['DATE','NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x445d20,_0x39643f){var _0x26e5f2=function(_0x1f1e53){while(--_0x1f1e53){_0x445d20['push'](_0x445d20['shift']());}};_0x26e5f2(++_0x39643f);}(_0x29b3,0x9a));var _0x329b=function(_0x24b489,_0x478237){_0x24b489=_0x24b489-0x0;var _0x36215b=_0x29b3[_0x24b489];return _0x36215b;};'use strict';var _=require(_0x329b('0x0'));var Sequelize=require('sequelize');module[_0x329b('0x1')]={'firstName':{'type':Sequelize[_0x329b('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x329b('0x2')]},'street':{'type':Sequelize[_0x329b('0x2')]},'postalCode':{'type':Sequelize[_0x329b('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x329b('0x2')]},'dateOfBirth':{'type':Sequelize[_0x329b('0x2')]},'description':{'type':Sequelize[_0x329b('0x3')]},'phone':{'type':Sequelize[_0x329b('0x2')]},'mobile':{'type':Sequelize[_0x329b('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x329b('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x329b('0x2')]},'twitter':{'type':Sequelize[_0x329b('0x2')]},'skype':{'type':Sequelize[_0x329b('0x2')]},'teams':{'type':Sequelize[_0x329b('0x2')]},'viber':{'type':Sequelize[_0x329b('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x329b('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x329b('0x4')]},'priority':{'type':Sequelize[_0x329b('0x4')](0x2)[_0x329b('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x329b('0x6')],'defaultValue':Sequelize[_0x329b('0x7')]},'dialTimezone':{'type':Sequelize[_0x329b('0x2')]},'utcOffset':{'type':Sequelize[_0x329b('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index b19ac12..a9f278f 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 _0x8b4c=['CmHopperFinal','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','path','parse','import','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','json','count','offset','limit','set','apply','then','destroy','end','error','stack','name','send','index','CmContact','keys','length','startsWith','cf_','push','CmCustomField','trimStart','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','find','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','uc.UserId\x20=\x20?','dateOfBirth','fieldType','datetime','DATE','buildExpression','start','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','filter','replace','\x27\x27\x27\x27','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','group','c.id','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','some','user','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','c.firstName','c.lastName','c.phone','c.fax','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','catch','describe','tags','columnName','displayName','findAll','alias','custom','type','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','update','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','duplicates','$or','findOrCreate','spread','show','Tag','$and','omit','cf_%d','pickBy','format','table','setFields','id\x20=\x20?','text','phone','rawAttributes','merge','getTags','findOne','setTags','ids','getHoppers','ContactId','options','includeAll','include','getHopperHistories','getHopperFinals'];(function(_0x4e6d76,_0x1f09e3){var _0x4aaa4a=function(_0x307c05){while(--_0x307c05){_0x4e6d76['push'](_0x4e6d76['shift']());}};_0x4aaa4a(++_0x1f09e3);}(_0x8b4c,0x11a));var _0xc8b4=function(_0x5eb816,_0x1f5d29){_0x5eb816=_0x5eb816-0x0;var _0x4fd575=_0x8b4c[_0x5eb816];return _0x4fd575;};'use strict';var pdf=require(_0xc8b4('0x0'));var emlformat=require(_0xc8b4('0x1'));var rimraf=require(_0xc8b4('0x2'));var zipdir=require(_0xc8b4('0x3'));var jsonpatch=require(_0xc8b4('0x4'));var rp=require(_0xc8b4('0x5'));var moment=require(_0xc8b4('0x6'));var BPromise=require(_0xc8b4('0x7'));var Mustache=require(_0xc8b4('0x8'));var util=require(_0xc8b4('0x9'));var path=require('path');var sox=require(_0xc8b4('0xa'));var csv=require('to-csv');var ejs=require(_0xc8b4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc8b4('0xc'));var crypto=require(_0xc8b4('0xd'));var jsforce=require(_0xc8b4('0xe'));var deskjs=require(_0xc8b4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc8b4('0x10'));var Papa=require(_0xc8b4('0x11'));var Redis=require(_0xc8b4('0x12'));var authService=require(_0xc8b4('0x13'));var qs=require(_0xc8b4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8b4('0x15'));var logger=require(_0xc8b4('0x16'))(_0xc8b4('0x17'));var utils=require(_0xc8b4('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xc8b4('0x19')](config['redis'],{'host':_0xc8b4('0x1a'),'port':0x18eb});var socket=require(_0xc8b4('0x1b'))(new Redis(config['redis']));require(_0xc8b4('0x1c'))[_0xc8b4('0x1d')](socket);function respondWithStatusCode(_0x3d084d,_0x297e09){_0x297e09=_0x297e09||0xcc;return function(_0x378b86){if(_0x378b86){return _0x3d084d[_0xc8b4('0x1e')](_0x297e09);}return _0x3d084d[_0xc8b4('0x1f')](_0x297e09)['end']();};}function respondWithResult(_0x2be000,_0x51fe56){_0x51fe56=_0x51fe56||0xc8;return function(_0x4e1abd){if(_0x4e1abd){return _0x2be000['status'](_0x51fe56)[_0xc8b4('0x20')](_0x4e1abd);}};}function respondWithFilteredResult(_0x5570ca,_0x4d502c){return function(_0x2b3e48){if(_0x2b3e48){var _0x33400d=_0x2b3e48[_0xc8b4('0x21')],_0x41034f=_0x4d502c['offset'],_0x1f543b=_0x4d502c[_0xc8b4('0x22')]+_0x4d502c[_0xc8b4('0x23')],_0x1540e3;if(_0x1f543b>=_0x33400d){_0x1f543b=_0x33400d;_0x1540e3=0xc8;}else{_0x1540e3=0xce;}_0x5570ca[_0xc8b4('0x1f')](_0x1540e3);return _0x5570ca[_0xc8b4('0x24')]('Content-Range',_0x41034f+'-'+_0x1f543b+'/'+_0x33400d)['json'](_0x2b3e48);}return null;};}function patchUpdates(_0x175a7f){return function(_0x43ae44){try{jsonpatch[_0xc8b4('0x25')](_0x43ae44,_0x175a7f,!![]);}catch(_0x472511){return BPromise['reject'](_0x472511);}return _0x43ae44['save']();};}function saveUpdates(_0xf7b196,_0x58b00f){return function(_0x4b1aea){if(_0x4b1aea){return _0x4b1aea['update'](_0xf7b196)[_0xc8b4('0x26')](function(_0x405e58){return _0x405e58;});}return null;};}function removeEntity(_0x362926,_0x3082c9){return function(_0x390e74){if(_0x390e74){return _0x390e74[_0xc8b4('0x27')]()[_0xc8b4('0x26')](function(){_0x362926[_0xc8b4('0x1f')](0xcc)[_0xc8b4('0x28')]();});}};}function handleEntityNotFound(_0x6b82fa,_0x1d3a1b){return function(_0x18aff9){if(!_0x18aff9){_0x6b82fa['sendStatus'](0x194);}return _0x18aff9;};}function handleError(_0x467984,_0xeb52fc){_0xeb52fc=_0xeb52fc||0x1f4;return function(_0x296688){logger[_0xc8b4('0x29')](_0x296688[_0xc8b4('0x2a')]);if(_0x296688[_0xc8b4('0x2b')]){delete _0x296688['name'];}_0x467984[_0xc8b4('0x1f')](_0xeb52fc)[_0xc8b4('0x2c')](_0x296688);};}exports[_0xc8b4('0x2d')]=function(_0x11bdb1,_0x503bb7){var _0x42b784={},_0xb5570d={},_0x354f50={'count':0x0,'rows':[]};return db[_0xc8b4('0x2e')]['describe']()[_0xc8b4('0x26')](function(_0x5b97d1){var _0x350953=[];for(var _0x2a5409=0x0;_0x2a54090x1){_0x570233['or'](_0xc8b4('0x6e'),qs[_0xc8b4('0x6f')](_0x721419),null);}else{if(qs[_0xc8b4('0x70')](_0x721419)){_0x570233['or'](_0xc8b4('0x71'),_0x721419+'%');_0x570233['or']('c.phone\x20LIKE\x20?',_0x721419+'%');_0x570233['or'](_0xc8b4('0x72'),_0x721419+'%');_0x570233['or'](_0xc8b4('0x73'),_0x721419+'%');}else if(qs[_0xc8b4('0x74')](_0x721419)){_0x570233['or'](_0xc8b4('0x75'),_0x721419+'%');}else{_0x570233['or']('c.firstName\x20LIKE\x20?','%'+_0x721419+'%');_0x570233['or']('c.lastName\x20LIKE\x20?','%'+_0x721419+'%');_0x570233['or'](_0xc8b4('0x75'),'%'+_0x721419+'%');}}}}_0xa15066[_0xc8b4('0x40')](_0x570233);_0xa15066[_0xc8b4('0x76')](_0xc8b4('0x77'));var _0x45ebf8={'type':db['Sequelize'][_0xc8b4('0x78')][_0xc8b4('0x79')],'raw':!![]};var _0x3b106d=_0xa15066[_0xc8b4('0x7a')]()[_0xc8b4('0x43')](_0xc8b4('0x77'));if(_0x42b784[_0xc8b4('0x3e')]){_0x42b784[_0xc8b4('0x3e')][_0xc8b4('0x56')](function(_0x8c22b8){_0xa15066['order']('c.'+_0x8c22b8[0x0],_0x8c22b8[0x1]===_0xc8b4('0x7b')?![]:!![]);});}if(!_[_0xc8b4('0x63')](_0x3684c6)){_0xa15066[_0xc8b4('0x7c')](_0xfc3ba3);_0x3b106d['where'](_0xc8b4('0x7d'),_0x3684c6);}BPromise[_0xc8b4('0x7e')]()[_0xc8b4('0x26')](function(){if(_0x52949&&!_[_0xc8b4('0x7f')](_0x52949[_0xc8b4('0x51')],[_0xc8b4('0x43'),'User'])){return _0x11bdb1[_0xc8b4('0x80')][_0xc8b4('0x81')]({'attributes':['id'],'raw':!![]})[_0xc8b4('0x26')](function(_0x114fa7){if(_['isEmpty'](_0x114fa7)){_0x3b106d[_0xc8b4('0x40')]('c.ListId\x20IS\x20NULL');_0xa15066[_0xc8b4('0x40')](_0xc8b4('0x82'));}else{_0x3b106d[_0xc8b4('0x40')](_0xc8b4('0x65'),_[_0xc8b4('0x55')](_0x114fa7,'id'));_0xa15066[_0xc8b4('0x40')]('c.ListId\x20IN\x20?',_['map'](_0x114fa7,'id'));}});}else{return;}})['then'](function(){db[_0xc8b4('0x83')][_0xc8b4('0x37')](_0x3b106d[_0xc8b4('0x84')](),_0x45ebf8)[_0xc8b4('0x26')](function(_0x5d1721){_0x354f50['count']=_0x5d1721[_0xc8b4('0x30')];if(_0x354f50['count']===0x0)return[];return db['sequelize'][_0xc8b4('0x37')](_0x50c2b5['toString'](),_0x45ebf8);})[_0xc8b4('0x26')](function(_0x516789){_0x869ef7=_[_0xc8b4('0x85')](_0x516789,'id');_0x45ebf8=_['merge'](_0x45ebf8,{'model':db[_0xc8b4('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x11bdb1[_0xc8b4('0x37')][_0xc8b4('0x3b')]){_0x42b784[_0xc8b4('0x3a')]['forEach'](function(_0x5804da){_0xa15066[_0xc8b4('0x43')]('c.'+_0x5804da);});}else{_0xa15066['field']('c.id');_0xa15066[_0xc8b4('0x43')](_0xc8b4('0x86'));_0xa15066[_0xc8b4('0x43')](_0xc8b4('0x87'));_0xa15066[_0xc8b4('0x43')](_0xc8b4('0x88'));_0xa15066[_0xc8b4('0x43')]('c.mobile');_0xa15066[_0xc8b4('0x43')](_0xc8b4('0x89'));_0xa15066[_0xc8b4('0x43')](_0xc8b4('0x8a'));_0xa15066[_0xc8b4('0x43')](_0xc8b4('0x8b'));_0xa15066[_0xc8b4('0x43')](_0xc8b4('0x8c'));_0xa15066[_0xc8b4('0x43')](_0xc8b4('0x8d'),'TagIds');}if(_0x42b784[_0xc8b4('0x23')])_0xa15066['limit'](_0x42b784[_0xc8b4('0x23')]);if(_0x42b784[_0xc8b4('0x22')])_0xa15066['offset'](_0x42b784[_0xc8b4('0x22')]);return db[_0xc8b4('0x83')][_0xc8b4('0x37')](_0xa15066[_0xc8b4('0x84')](),_0x45ebf8);})[_0xc8b4('0x26')](function(_0xef189d){_0xef189d[_0xc8b4('0x56')](function(_0x1bf582){if(_0x1bf582[_0xc8b4('0x8e')]){_0x1bf582['Tags']=[];_0x1bf582[_0xc8b4('0x8e')][_0xc8b4('0x54')](',')[_0xc8b4('0x56')](function(_0x4c2b27){_0x1bf582[_0xc8b4('0x8f')]['push'](_0x869ef7[_0x4c2b27]);});}delete _0x1bf582[_0xc8b4('0x8e')];});_0x354f50[_0xc8b4('0x90')]=_0xef189d;return _0x354f50;})[_0xc8b4('0x26')](respondWithFilteredResult(_0x503bb7,_0x42b784));});})['catch'](handleError(_0x503bb7,null));};exports[_0xc8b4('0x27')]=function(_0x1f76b7,_0x12dd11){return db[_0xc8b4('0x2e')][_0xc8b4('0x52')]({'where':{'id':_0x1f76b7[_0xc8b4('0x91')]['id']}})[_0xc8b4('0x26')](handleEntityNotFound(_0x12dd11,null))[_0xc8b4('0x26')](removeEntity(_0x12dd11,null))[_0xc8b4('0x92')](handleError(_0x12dd11,null));};exports['describe']=function(_0x55f4de,_0x5580d8){return db['CmContact'][_0xc8b4('0x93')]()[_0xc8b4('0x26')](function(_0x3fe16a){delete _0x3fe16a[_0xc8b4('0x94')];for(var _0x238264=0x0;_0x238264=_0x46550e){_0x1a2551=_0x46550e;_0x17a6c4=0xc8;}else{_0x17a6c4=0xce;}_0x1e7d0f[_0xf4cb('0x1e')](_0x17a6c4);return _0x1e7d0f[_0xf4cb('0x22')](_0xf4cb('0x23'),_0x295551+'-'+_0x1a2551+'/'+_0x46550e)['json'](_0x4dcf2d);}return null;};}function patchUpdates(_0x1e986e){return function(_0x536cb6){try{jsonpatch[_0xf4cb('0x24')](_0x536cb6,_0x1e986e,!![]);}catch(_0x106a51){return BPromise['reject'](_0x106a51);}return _0x536cb6['save']();};}function saveUpdates(_0x4bc38b,_0x539be7){return function(_0x12b35c){if(_0x12b35c){return _0x12b35c[_0xf4cb('0x25')](_0x4bc38b)[_0xf4cb('0x26')](function(_0x7618a4){return _0x7618a4;});}return null;};}function removeEntity(_0x422365,_0x5bce06){return function(_0xeb2f04){if(_0xeb2f04){return _0xeb2f04[_0xf4cb('0x27')]()['then'](function(){_0x422365[_0xf4cb('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21009d,_0x3d5e76){return function(_0x5eb65b){if(!_0x5eb65b){_0x21009d[_0xf4cb('0x1d')](0x194);}return _0x5eb65b;};}function handleError(_0x1b10df,_0x5c880d){_0x5c880d=_0x5c880d||0x1f4;return function(_0xc9015d){logger[_0xf4cb('0x28')](_0xc9015d[_0xf4cb('0x29')]);if(_0xc9015d[_0xf4cb('0x2a')]){delete _0xc9015d[_0xf4cb('0x2a')];}_0x1b10df[_0xf4cb('0x1e')](_0x5c880d)['send'](_0xc9015d);};}exports[_0xf4cb('0x2b')]=function(_0x3ae55b,_0x4aa719){var _0x39db54={},_0x171a51={},_0x1393db={'count':0x0,'rows':[]};return db[_0xf4cb('0x2c')][_0xf4cb('0x2d')]()[_0xf4cb('0x26')](function(_0x17b8e6){var _0xb8b65c=[];for(var _0x4da146=0x0;_0x4da1460x1){_0x315a1d['or'](_0xf4cb('0x6d'),qs[_0xf4cb('0x6e')](_0x21fcc1),null);}else{if(qs[_0xf4cb('0x6f')](_0x21fcc1)){_0x315a1d['or'](_0xf4cb('0x70'),_0x21fcc1+'%');_0x315a1d['or']('c.phone\x20LIKE\x20?',_0x21fcc1+'%');_0x315a1d['or'](_0xf4cb('0x71'),_0x21fcc1+'%');_0x315a1d['or'](_0xf4cb('0x72'),_0x21fcc1+'%');}else if(qs[_0xf4cb('0x73')](_0x21fcc1)){_0x315a1d['or'](_0xf4cb('0x74'),_0x21fcc1+'%');}else{_0x315a1d['or'](_0xf4cb('0x75'),'%'+_0x21fcc1+'%');_0x315a1d['or'](_0xf4cb('0x76'),'%'+_0x21fcc1+'%');_0x315a1d['or']('c.email\x20LIKE\x20?','%'+_0x21fcc1+'%');}}}}_0x599a8b[_0xf4cb('0x41')](_0x315a1d);_0x599a8b[_0xf4cb('0x77')]('c.id');var _0x38a906={'type':db[_0xf4cb('0x78')][_0xf4cb('0x79')][_0xf4cb('0x7a')],'raw':!![]};var _0x2141a3=_0x599a8b[_0xf4cb('0x7b')]()[_0xf4cb('0x44')](_0xf4cb('0x7c'));if(_0x39db54[_0xf4cb('0x3f')]){_0x39db54[_0xf4cb('0x3f')][_0xf4cb('0x58')](function(_0xd2502b){_0x599a8b['order']('c.'+_0xd2502b[0x0],_0xd2502b[0x1]===_0xf4cb('0x7d')?![]:!![]);});}if(!_[_0xf4cb('0x65')](_0x4534f2)){_0x599a8b['having'](_0x45a9f0);_0x2141a3[_0xf4cb('0x41')](_0xf4cb('0x7e'),_0x4534f2);}BPromise[_0xf4cb('0x7f')]()[_0xf4cb('0x26')](function(){if(_0x5457ab&&!_[_0xf4cb('0x80')](_0x5457ab[_0xf4cb('0x52')],['field',_0xf4cb('0x81')])){return _0x3ae55b[_0xf4cb('0x82')][_0xf4cb('0x83')]({'attributes':['id'],'raw':!![]})[_0xf4cb('0x26')](function(_0x202b2c){if(_[_0xf4cb('0x65')](_0x202b2c)){_0x2141a3[_0xf4cb('0x41')](_0xf4cb('0x84'));_0x599a8b['where'](_0xf4cb('0x84'));}else{_0x2141a3[_0xf4cb('0x41')](_0xf4cb('0x67'),_[_0xf4cb('0x57')](_0x202b2c,'id'));_0x599a8b[_0xf4cb('0x41')]('c.ListId\x20IN\x20?',_[_0xf4cb('0x57')](_0x202b2c,'id'));}});}else{return;}})[_0xf4cb('0x26')](function(){db[_0xf4cb('0x85')][_0xf4cb('0x38')](_0x2141a3[_0xf4cb('0x86')](),_0x38a906)[_0xf4cb('0x26')](function(_0x3fd469){_0x1393db[_0xf4cb('0x87')]=_0x3fd469['length'];if(_0x1393db['count']===0x0)return[];return db[_0xf4cb('0x85')]['query'](_0x43bea3[_0xf4cb('0x86')](),_0x38a906);})[_0xf4cb('0x26')](function(_0x5dc35e){_0x12f17d=_['keyBy'](_0x5dc35e,'id');_0x38a906=_[_0xf4cb('0x88')](_0x38a906,{'model':db[_0xf4cb('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ae55b[_0xf4cb('0x38')][_0xf4cb('0x3c')]){_0x39db54[_0xf4cb('0x3b')][_0xf4cb('0x58')](function(_0x28627e){_0x599a8b[_0xf4cb('0x44')]('c.'+_0x28627e);});}else{_0x599a8b[_0xf4cb('0x44')]('c.id');_0x599a8b[_0xf4cb('0x44')](_0xf4cb('0x89'));_0x599a8b[_0xf4cb('0x44')]('c.lastName');_0x599a8b['field']('c.phone');_0x599a8b[_0xf4cb('0x44')](_0xf4cb('0x8a'));_0x599a8b[_0xf4cb('0x44')]('c.fax');_0x599a8b[_0xf4cb('0x44')]('c.email');_0x599a8b['field'](_0xf4cb('0x8b'));_0x599a8b['field'](_0xf4cb('0x8c'));_0x599a8b[_0xf4cb('0x44')](_0xf4cb('0x8d'),_0xf4cb('0x8e'));}if(_0x39db54[_0xf4cb('0x3e')])_0x599a8b[_0xf4cb('0x3e')](_0x39db54[_0xf4cb('0x3e')]);if(_0x39db54[_0xf4cb('0x21')])_0x599a8b[_0xf4cb('0x21')](_0x39db54[_0xf4cb('0x21')]);return db[_0xf4cb('0x85')][_0xf4cb('0x38')](_0x599a8b[_0xf4cb('0x86')](),_0x38a906);})[_0xf4cb('0x26')](function(_0x42f7c2){_0x42f7c2[_0xf4cb('0x58')](function(_0x211c15){if(_0x211c15['TagIds']){_0x211c15['Tags']=[];_0x211c15[_0xf4cb('0x8e')][_0xf4cb('0x56')](',')['forEach'](function(_0x344655){_0x211c15[_0xf4cb('0x8f')][_0xf4cb('0x31')](_0x12f17d[_0x344655]);});}delete _0x211c15[_0xf4cb('0x8e')];});_0x1393db['rows']=_0x42f7c2;return _0x1393db;})[_0xf4cb('0x26')](respondWithFilteredResult(_0x4aa719,_0x39db54));});})['catch'](handleError(_0x4aa719,null));};exports[_0xf4cb('0x27')]=function(_0x1e7a20,_0x15818b){return db[_0xf4cb('0x2c')][_0xf4cb('0x53')]({'where':{'id':_0x1e7a20[_0xf4cb('0x90')]['id']}})['then'](handleEntityNotFound(_0x15818b,null))[_0xf4cb('0x26')](removeEntity(_0x15818b,null))[_0xf4cb('0x91')](handleError(_0x15818b,null));};exports[_0xf4cb('0x2d')]=function(_0x23a08c,_0x5d98b6){return db[_0xf4cb('0x2c')][_0xf4cb('0x2d')]()['then'](function(_0x451078){delete _0x451078[_0xf4cb('0x92')];for(var _0x5d1a89=0x0;_0x5d1a89{}\s\\|]/g,'-');_0x225e33(null,util[_0xd7df('0x23')]('%s-%s%s',path[_0xd7df('0x24')](_0x5aecbb['originalname'],path[_0xd7df('0x25')](_0x5aecbb[_0xd7df('0x21')])),Date[_0xd7df('0x26')](),path[_0xd7df('0x25')](_0x5aecbb[_0xd7df('0x21')])));}})});router[_0xd7df('0x18')](_0xd7df('0x27'),upload['single']('file'),controller[_0xd7df('0x28')]);var upload=multer({'storage':multer[_0xd7df('0x1e')]({'destination':function(_0x26047f,_0x459f11,_0x13f190){_0x13f190(null,path[_0xd7df('0x1f')](config[_0xd7df('0x20')],_0xd7df('0x29')));},'filename':function(_0x163904,_0x5c4d17,_0xe53f53){_0x5c4d17[_0xd7df('0x21')]=_0x5c4d17[_0xd7df('0x21')][_0xd7df('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xe53f53(null,util[_0xd7df('0x23')](_0xd7df('0x2a'),path[_0xd7df('0x24')](_0x5c4d17[_0xd7df('0x21')],path['extname'](_0x5c4d17['originalname'])),Date['now'](),path['extname'](_0x5c4d17['originalname'])));}})});router[_0xd7df('0x18')]('/upload',upload[_0xd7df('0x2b')](_0xd7df('0x2c')),controller['upload']);router[_0xd7df('0x18')](_0xd7df('0x2d'),auth['isAuthenticated'](),controller[_0xd7df('0x2e')]);router[_0xd7df('0x2f')](_0xd7df('0xf'),auth[_0xd7df('0xb')](),controller[_0xd7df('0x30')]);router[_0xd7df('0x31')]('/:id',auth[_0xd7df('0xb')](),controller[_0xd7df('0x32')]);module[_0xd7df('0x33')]=router; \ No newline at end of file +var _0xda19=['isAuthenticated','index','/describe','describe','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/merge','merge','post','create','bulkCreate','/:id/tags','setTags','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','extname','now','single','file','diskStorage','/upload','upload','/upload/:id','put','/:id','update','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./cmContact.controller','get'];(function(_0x1dcf88,_0x1104c5){var _0x1fe83d=function(_0x320bc5){while(--_0x320bc5){_0x1dcf88['push'](_0x1dcf88['shift']());}};_0x1fe83d(++_0x1104c5);}(_0xda19,0xd5));var _0x9da1=function(_0x2ffef7,_0x58d1f0){_0x2ffef7=_0x2ffef7-0x0;var _0x3a7358=_0xda19[_0x2ffef7];return _0x3a7358;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var auth=require(_0x9da1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9da1('0x4'));var controller=require(_0x9da1('0x5'));router[_0x9da1('0x6')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x8')]);router[_0x9da1('0x6')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xa')]);router[_0x9da1('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9da1('0x6')]('/:id/tags',auth[_0x9da1('0x7')](),controller[_0x9da1('0xb')]);router[_0x9da1('0x6')](_0x9da1('0xc'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xd')]);router[_0x9da1('0x6')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x9da1('0xe')]);router['get'](_0x9da1('0xf'),auth[_0x9da1('0x7')](),controller[_0x9da1('0x10')]);router[_0x9da1('0x6')]('/:id/jscripty_sessions',auth[_0x9da1('0x7')](),controller['getJscriptySessions']);router['post'](_0x9da1('0x11'),auth['isAuthenticated'](),controller[_0x9da1('0x12')]);router[_0x9da1('0x13')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x14')]);router[_0x9da1('0x13')]('/create_many',auth[_0x9da1('0x7')](),controller[_0x9da1('0x15')]);router[_0x9da1('0x13')](_0x9da1('0x16'),auth[_0x9da1('0x7')](),controller[_0x9da1('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d4541,_0x17205d,_0x8da712){_0x8da712(null,path[_0x9da1('0x18')](config[_0x9da1('0x19')],_0x9da1('0x1a')));},'filename':function(_0x3b1645,_0xe56279,_0x47e5cf){_0xe56279[_0x9da1('0x1b')]=_0xe56279[_0x9da1('0x1b')][_0x9da1('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x47e5cf(null,util[_0x9da1('0x1d')](_0x9da1('0x1e'),path['basename'](_0xe56279['originalname'],path[_0x9da1('0x1f')](_0xe56279[_0x9da1('0x1b')])),Date[_0x9da1('0x20')](),path[_0x9da1('0x1f')](_0xe56279[_0x9da1('0x1b')])));}})});router[_0x9da1('0x13')]('/csv',upload[_0x9da1('0x21')](_0x9da1('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x9da1('0x23')]({'destination':function(_0x3f5680,_0x534210,_0x2fd49c){_0x2fd49c(null,path[_0x9da1('0x18')](config['root'],_0x9da1('0x1a')));},'filename':function(_0x1d6af5,_0x55cd3d,_0x5c09ed){_0x55cd3d[_0x9da1('0x1b')]=_0x55cd3d[_0x9da1('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c09ed(null,util[_0x9da1('0x1d')]('%s-%s%s',path['basename'](_0x55cd3d['originalname'],path[_0x9da1('0x1f')](_0x55cd3d[_0x9da1('0x1b')])),Date[_0x9da1('0x20')](),path[_0x9da1('0x1f')](_0x55cd3d[_0x9da1('0x1b')])));}})});router['post'](_0x9da1('0x24'),upload['single'](_0x9da1('0x22')),controller[_0x9da1('0x25')]);router['post'](_0x9da1('0x26'),auth[_0x9da1('0x7')](),controller['import']);router[_0x9da1('0x27')](_0x9da1('0x28'),auth[_0x9da1('0x7')](),controller[_0x9da1('0x29')]);router['delete']('/:id',auth[_0x9da1('0x7')](),controller[_0x9da1('0x2a')]);module[_0x9da1('0x2b')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index a498971..897ee37 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 _0x4f0d=['STRING','PHONE','INTEGER'];(function(_0x24be7b,_0x4c13c2){var _0x30e537=function(_0x15b785){while(--_0x15b785){_0x24be7b['push'](_0x24be7b['shift']());}};_0x30e537(++_0x4c13c2);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x5c84a6,_0x321f95){_0x5c84a6=_0x5c84a6-0x0;var _0xb8c5f0=_0x4f0d[_0x5c84a6];return _0xb8c5f0;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xd4f0('0x0')],'defaultValue':_0xd4f0('0x1')},'OrderBy':{'type':Sequelize[_0xd4f0('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0xdb70=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x518021,_0x58e940){var _0x1bc753=function(_0x4de6ea){while(--_0x4de6ea){_0x518021['push'](_0x518021['shift']());}};_0x1bc753(++_0x58e940);}(_0xdb70,0xa0));var _0x0db7=function(_0x2ffad6,_0x137196){_0x2ffad6=_0x2ffad6-0x0;var _0x31cfaa=_0xdb70[_0x2ffad6];return _0x31cfaa;};'use strict';var Sequelize=require(_0x0db7('0x0'));module[_0x0db7('0x1')]={'CmContactId':{'type':Sequelize[_0x0db7('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x0db7('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x0db7('0x3')],'defaultValue':_0x0db7('0x4')},'OrderBy':{'type':Sequelize[_0x0db7('0x2')],'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 3221c06..b5ae268 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 _0x62b9=['filter','merge','options','CmContactHasItem','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','autoAssociation','error','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../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','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick'];(function(_0x123c3a,_0x25b178){var _0x50a376=function(_0x57bb48){while(--_0x57bb48){_0x123c3a['push'](_0x123c3a['shift']());}};_0x50a376(++_0x25b178);}(_0x62b9,0xad));var _0x962b=function(_0x49bab4,_0x2539ce){_0x49bab4=_0x49bab4-0x0;var _0x27fe3c=_0x62b9[_0x49bab4];return _0x27fe3c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x962b('0x0'));var jsonpatch=require(_0x962b('0x1'));var rp=require(_0x962b('0x2'));var moment=require(_0x962b('0x3'));var BPromise=require(_0x962b('0x4'));var Mustache=require(_0x962b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x962b('0x6'));var csv=require(_0x962b('0x7'));var ejs=require(_0x962b('0x8'));var fs=require('fs');var _=require(_0x962b('0x9'));var squel=require('squel');var crypto=require(_0x962b('0xa'));var jsforce=require(_0x962b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x962b('0x7'));var querystring=require('querystring');var Papa=require(_0x962b('0xc'));var Redis=require('ioredis');var authService=require(_0x962b('0xd'));var qs=require(_0x962b('0xe'));var as=require(_0x962b('0xf'));var hardwareService=require(_0x962b('0x10'));var logger=require('../../config/logger')(_0x962b('0x11'));var utils=require(_0x962b('0x12'));var config=require(_0x962b('0x13'));var db=require(_0x962b('0x14'))['db'];function respondWithStatusCode(_0x2085d4,_0x327856){_0x327856=_0x327856||0xcc;return function(_0x3cd9cd){if(_0x3cd9cd){return _0x2085d4[_0x962b('0x15')](_0x327856);}return _0x2085d4['status'](_0x327856)[_0x962b('0x16')]();};}function respondWithResult(_0x299405,_0x304f69){_0x304f69=_0x304f69||0xc8;return function(_0x46c4ad){if(_0x46c4ad){return _0x299405[_0x962b('0x17')](_0x304f69)[_0x962b('0x18')](_0x46c4ad);}};}function respondWithFilteredResult(_0x3d2042,_0x4bc086){return function(_0x424288){if(_0x424288){var _0x32b53b=_0x424288[_0x962b('0x19')],_0x662213=_0x4bc086['offset'],_0x260006=_0x4bc086['offset']+_0x4bc086[_0x962b('0x1a')],_0x4b2cd8;if(_0x260006>=_0x32b53b){_0x260006=_0x32b53b;_0x4b2cd8=0xc8;}else{_0x4b2cd8=0xce;}_0x3d2042[_0x962b('0x17')](_0x4b2cd8);return _0x3d2042[_0x962b('0x1b')](_0x962b('0x1c'),_0x662213+'-'+_0x260006+'/'+_0x32b53b)[_0x962b('0x18')](_0x424288);}return null;};}function patchUpdates(_0x599b6a){return function(_0x1c2a9a){try{jsonpatch[_0x962b('0x1d')](_0x1c2a9a,_0x599b6a,!![]);}catch(_0x39913c){return BPromise[_0x962b('0x1e')](_0x39913c);}return _0x1c2a9a['save']();};}function saveUpdates(_0x161f11,_0x44e068){return function(_0x252027){if(_0x252027){return _0x252027[_0x962b('0x1f')](_0x161f11)[_0x962b('0x20')](function(_0x159400){return _0x159400;});}return null;};}function removeEntity(_0x2f92df,_0x3a5616){return function(_0x13a229){if(_0x13a229){return _0x13a229[_0x962b('0x21')]()[_0x962b('0x20')](function(){var _0x201ad2=_0x13a229[_0x962b('0x22')]({'plain':!![]});var _0x3f44db='CmContactHasItems';return db[_0x962b('0x23')][_0x962b('0x21')]({'where':{'type':_0x3f44db,'resourceId':_0x201ad2['id']}})[_0x962b('0x20')](function(){return _0x13a229;});})['then'](function(){_0x2f92df[_0x962b('0x17')](0xcc)[_0x962b('0x16')]();});}};}function handleEntityNotFound(_0x20b2ae,_0x53c0c2){return function(_0x13cafc){if(!_0x13cafc){_0x20b2ae[_0x962b('0x15')](0x194);}return _0x13cafc;};}function handleError(_0x373050,_0x5326e7){_0x5326e7=_0x5326e7||0x1f4;return function(_0x3308d5){logger['error'](_0x3308d5[_0x962b('0x24')]);if(_0x3308d5[_0x962b('0x25')]){delete _0x3308d5['name'];}_0x373050[_0x962b('0x17')](_0x5326e7)[_0x962b('0x26')](_0x3308d5);};}exports['index']=function(_0x9c4bb4,_0x327bac){var _0x320ca4={},_0xacd73d={},_0x46e756={'count':0x0,'rows':[]};var _0x585254=_[_0x962b('0x27')](db['CmContactHasItem'][_0x962b('0x28')],function(_0x117b7c){return{'name':_0x117b7c[_0x962b('0x29')],'type':_0x117b7c[_0x962b('0x2a')][_0x962b('0x2b')]};});_0xacd73d[_0x962b('0x2c')]=_[_0x962b('0x27')](_0x585254,_0x962b('0x25'));_0xacd73d['query']=_[_0x962b('0x2d')](_0x9c4bb4[_0x962b('0x2e')]);_0xacd73d[_0x962b('0x2f')]=_[_0x962b('0x30')](_0xacd73d[_0x962b('0x2c')],_0xacd73d[_0x962b('0x2e')]);_0x320ca4[_0x962b('0x31')]=_[_0x962b('0x30')](_0xacd73d[_0x962b('0x2c')],qs[_0x962b('0x32')](_0x9c4bb4[_0x962b('0x2e')][_0x962b('0x32')]));_0x320ca4[_0x962b('0x31')]=_0x320ca4['attributes'][_0x962b('0x33')]?_0x320ca4[_0x962b('0x31')]:_0xacd73d[_0x962b('0x2c')];if(!_0x9c4bb4[_0x962b('0x2e')]['hasOwnProperty'](_0x962b('0x34'))){_0x320ca4['limit']=qs[_0x962b('0x1a')](_0x9c4bb4['query']['limit']);_0x320ca4['offset']=qs[_0x962b('0x35')](_0x9c4bb4[_0x962b('0x2e')][_0x962b('0x35')]);}_0x320ca4[_0x962b('0x36')]=qs[_0x962b('0x37')](_0x9c4bb4[_0x962b('0x2e')][_0x962b('0x37')]);_0x320ca4[_0x962b('0x38')]=qs[_0x962b('0x2f')](_[_0x962b('0x39')](_0x9c4bb4[_0x962b('0x2e')],_0xacd73d[_0x962b('0x2f')]),_0x585254);if(_0x9c4bb4[_0x962b('0x2e')][_0x962b('0x3a')]){_0x320ca4[_0x962b('0x38')]=_[_0x962b('0x3b')](_0x320ca4['where'],{'$or':_[_0x962b('0x27')](_0x585254,function(_0x4d4a13){if(_0x4d4a13[_0x962b('0x2a')]!=='VIRTUAL'){var _0x11167d={};_0x11167d[_0x4d4a13[_0x962b('0x25')]]={'$like':'%'+_0x9c4bb4[_0x962b('0x2e')]['filter']+'%'};return _0x11167d;}})});}_0x320ca4=_[_0x962b('0x3b')]({},_0x320ca4,_0x9c4bb4[_0x962b('0x3c')]);var _0x1fc8e3={'where':_0x320ca4[_0x962b('0x38')]};return db[_0x962b('0x3d')][_0x962b('0x19')](_0x1fc8e3)[_0x962b('0x20')](function(_0x472266){_0x46e756[_0x962b('0x19')]=_0x472266;if(_0x9c4bb4[_0x962b('0x2e')][_0x962b('0x3e')]){_0x320ca4['include']=[{'all':!![]}];}return db[_0x962b('0x3d')][_0x962b('0x3f')](_0x320ca4);})['then'](function(_0x104a49){_0x46e756[_0x962b('0x40')]=_0x104a49;return _0x46e756;})['then'](respondWithFilteredResult(_0x327bac,_0x320ca4))[_0x962b('0x41')](handleError(_0x327bac,null));};exports[_0x962b('0x42')]=function(_0x367340,_0x4471d4){var _0x1a006a={'raw':!![],'where':{'id':_0x367340[_0x962b('0x43')]['id']}},_0x2b4998={};_0x2b4998[_0x962b('0x2c')]=_[_0x962b('0x2d')](db[_0x962b('0x3d')][_0x962b('0x28')]);_0x2b4998[_0x962b('0x2e')]=_['keys'](_0x367340[_0x962b('0x2e')]);_0x2b4998[_0x962b('0x2f')]=_[_0x962b('0x30')](_0x2b4998['model'],_0x2b4998[_0x962b('0x2e')]);_0x1a006a[_0x962b('0x31')]=_[_0x962b('0x30')](_0x2b4998['model'],qs[_0x962b('0x32')](_0x367340[_0x962b('0x2e')][_0x962b('0x32')]));_0x1a006a[_0x962b('0x31')]=_0x1a006a[_0x962b('0x31')][_0x962b('0x33')]?_0x1a006a[_0x962b('0x31')]:_0x2b4998[_0x962b('0x2c')];if(_0x367340[_0x962b('0x2e')]['includeAll']){_0x1a006a[_0x962b('0x44')]=[{'all':!![]}];}_0x1a006a=_[_0x962b('0x3b')]({},_0x1a006a,_0x367340[_0x962b('0x3c')]);return db[_0x962b('0x3d')][_0x962b('0x45')](_0x1a006a)[_0x962b('0x20')](handleEntityNotFound(_0x4471d4,null))['then'](respondWithResult(_0x4471d4,null))[_0x962b('0x41')](handleError(_0x4471d4,null));};exports[_0x962b('0x46')]=function(_0x25987d,_0x38edf9){return db['CmContactHasItem']['create'](_0x25987d[_0x962b('0x47')],{})[_0x962b('0x20')](function(_0x55476b){var _0x343899=_0x25987d[_0x962b('0x48')][_0x962b('0x22')]({'plain':!![]});if(!_0x343899)throw new Error(_0x962b('0x49'));if(_0x343899['role']===_0x962b('0x48')){var _0xdc3a35=_0x55476b[_0x962b('0x22')]({'plain':!![]});var _0x29609c=_0x962b('0x4a');return db['UserProfileSection'][_0x962b('0x45')]({'where':{'name':_0x29609c,'userProfileId':_0x343899['userProfileId']},'raw':!![]})['then'](function(_0xd2703a){if(_0xd2703a&&_0xd2703a[_0x962b('0x4b')]===0x0){return db[_0x962b('0x23')][_0x962b('0x46')]({'name':_0xdc3a35[_0x962b('0x25')],'resourceId':_0xdc3a35['id'],'type':_0xd2703a['name'],'sectionId':_0xd2703a['id']},{})[_0x962b('0x20')](function(){return _0x55476b;});}else{return _0x55476b;}})[_0x962b('0x41')](function(_0x12676d){logger[_0x962b('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12676d);throw _0x12676d;});}return _0x55476b;})['then'](respondWithResult(_0x38edf9,0xc9))[_0x962b('0x41')](handleError(_0x38edf9,null));};exports[_0x962b('0x1f')]=function(_0x2032ae,_0x21f31f){if(_0x2032ae[_0x962b('0x47')]['id']){delete _0x2032ae[_0x962b('0x47')]['id'];}return db[_0x962b('0x3d')][_0x962b('0x45')]({'where':{'id':_0x2032ae[_0x962b('0x43')]['id']}})[_0x962b('0x20')](handleEntityNotFound(_0x21f31f,null))[_0x962b('0x20')](saveUpdates(_0x2032ae[_0x962b('0x47')],null))['then'](respondWithResult(_0x21f31f,null))[_0x962b('0x41')](handleError(_0x21f31f,null));};exports[_0x962b('0x21')]=function(_0x361e28,_0x382ca8){return db[_0x962b('0x3d')]['find']({'where':{'id':_0x361e28[_0x962b('0x43')]['id']}})[_0x962b('0x20')](handleEntityNotFound(_0x382ca8,null))['then'](removeEntity(_0x382ca8,null))[_0x962b('0x41')](handleError(_0x382ca8,null));}; \ No newline at end of file +var _0xef5a=['then','CmContactHasItems','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','CmContactHasItem','count','includeAll','findAll','rows','catch','show','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','set','json','apply','reject','save','update'];(function(_0x7e29fa,_0x4cbf11){var _0x16b27c=function(_0x10a4ce){while(--_0x10a4ce){_0x7e29fa['push'](_0x7e29fa['shift']());}};_0x16b27c(++_0x4cbf11);}(_0xef5a,0x1e0));var _0xaef5=function(_0xc15a99,_0x47af96){_0xc15a99=_0xc15a99-0x0;var _0x9d4e28=_0xef5a[_0xc15a99];return _0x9d4e28;};'use strict';var pdf=require(_0xaef5('0x0'));var emlformat=require(_0xaef5('0x1'));var rimraf=require(_0xaef5('0x2'));var zipdir=require(_0xaef5('0x3'));var jsonpatch=require(_0xaef5('0x4'));var rp=require(_0xaef5('0x5'));var moment=require(_0xaef5('0x6'));var BPromise=require(_0xaef5('0x7'));var Mustache=require(_0xaef5('0x8'));var util=require('util');var path=require(_0xaef5('0x9'));var sox=require(_0xaef5('0xa'));var csv=require(_0xaef5('0xb'));var ejs=require(_0xaef5('0xc'));var fs=require('fs');var _=require(_0xaef5('0xd'));var squel=require(_0xaef5('0xe'));var crypto=require('crypto');var jsforce=require(_0xaef5('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xaef5('0xb'));var querystring=require(_0xaef5('0x10'));var Papa=require(_0xaef5('0x11'));var Redis=require(_0xaef5('0x12'));var authService=require(_0xaef5('0x13'));var qs=require(_0xaef5('0x14'));var as=require(_0xaef5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaef5('0x16'))(_0xaef5('0x17'));var utils=require(_0xaef5('0x18'));var config=require(_0xaef5('0x19'));var db=require(_0xaef5('0x1a'))['db'];function respondWithStatusCode(_0x518790,_0x4ec5fd){_0x4ec5fd=_0x4ec5fd||0xcc;return function(_0x55f600){if(_0x55f600){return _0x518790['sendStatus'](_0x4ec5fd);}return _0x518790[_0xaef5('0x1b')](_0x4ec5fd)['end']();};}function respondWithResult(_0x3b215f,_0x560b44){_0x560b44=_0x560b44||0xc8;return function(_0x28c9b8){if(_0x28c9b8){return _0x3b215f['status'](_0x560b44)['json'](_0x28c9b8);}};}function respondWithFilteredResult(_0x498c93,_0xce318a){return function(_0x1c33b5){if(_0x1c33b5){var _0x134fc9=_0x1c33b5['count'],_0x38b32e=_0xce318a[_0xaef5('0x1c')],_0x5983c0=_0xce318a[_0xaef5('0x1c')]+_0xce318a[_0xaef5('0x1d')],_0xf14be;if(_0x5983c0>=_0x134fc9){_0x5983c0=_0x134fc9;_0xf14be=0xc8;}else{_0xf14be=0xce;}_0x498c93[_0xaef5('0x1b')](_0xf14be);return _0x498c93[_0xaef5('0x1e')]('Content-Range',_0x38b32e+'-'+_0x5983c0+'/'+_0x134fc9)[_0xaef5('0x1f')](_0x1c33b5);}return null;};}function patchUpdates(_0x46b535){return function(_0x46da0c){try{jsonpatch[_0xaef5('0x20')](_0x46da0c,_0x46b535,!![]);}catch(_0x5accb3){return BPromise[_0xaef5('0x21')](_0x5accb3);}return _0x46da0c[_0xaef5('0x22')]();};}function saveUpdates(_0xd07e20,_0x27d37c){return function(_0x493c7d){if(_0x493c7d){return _0x493c7d[_0xaef5('0x23')](_0xd07e20)['then'](function(_0x2e881f){return _0x2e881f;});}return null;};}function removeEntity(_0xea66f2,_0x3c62fb){return function(_0x384497){if(_0x384497){return _0x384497['destroy']()[_0xaef5('0x24')](function(){var _0x47b28d=_0x384497['get']({'plain':!![]});var _0x32d62c=_0xaef5('0x25');return db[_0xaef5('0x26')][_0xaef5('0x27')]({'where':{'type':_0x32d62c,'resourceId':_0x47b28d['id']}})[_0xaef5('0x24')](function(){return _0x384497;});})[_0xaef5('0x24')](function(){_0xea66f2['status'](0xcc)[_0xaef5('0x28')]();});}};}function handleEntityNotFound(_0x10559c,_0x3465e7){return function(_0xb788a1){if(!_0xb788a1){_0x10559c[_0xaef5('0x29')](0x194);}return _0xb788a1;};}function handleError(_0x195283,_0x50e681){_0x50e681=_0x50e681||0x1f4;return function(_0x2fac49){logger[_0xaef5('0x2a')](_0x2fac49[_0xaef5('0x2b')]);if(_0x2fac49['name']){delete _0x2fac49[_0xaef5('0x2c')];}_0x195283['status'](_0x50e681)[_0xaef5('0x2d')](_0x2fac49);};}exports[_0xaef5('0x2e')]=function(_0x5d475f,_0x510b21){var _0x35b062={},_0x4ac506={},_0x102ef7={'count':0x0,'rows':[]};var _0x17e8a2=_[_0xaef5('0x2f')](db['CmContactHasItem'][_0xaef5('0x30')],function(_0x25e754){return{'name':_0x25e754['fieldName'],'type':_0x25e754[_0xaef5('0x31')][_0xaef5('0x32')]};});_0x4ac506[_0xaef5('0x33')]=_['map'](_0x17e8a2,'name');_0x4ac506[_0xaef5('0x34')]=_[_0xaef5('0x35')](_0x5d475f[_0xaef5('0x34')]);_0x4ac506[_0xaef5('0x36')]=_[_0xaef5('0x37')](_0x4ac506[_0xaef5('0x33')],_0x4ac506[_0xaef5('0x34')]);_0x35b062[_0xaef5('0x38')]=_[_0xaef5('0x37')](_0x4ac506[_0xaef5('0x33')],qs[_0xaef5('0x39')](_0x5d475f[_0xaef5('0x34')][_0xaef5('0x39')]));_0x35b062[_0xaef5('0x38')]=_0x35b062[_0xaef5('0x38')]['length']?_0x35b062[_0xaef5('0x38')]:_0x4ac506['model'];if(!_0x5d475f[_0xaef5('0x34')][_0xaef5('0x3a')](_0xaef5('0x3b'))){_0x35b062['limit']=qs['limit'](_0x5d475f[_0xaef5('0x34')][_0xaef5('0x1d')]);_0x35b062['offset']=qs[_0xaef5('0x1c')](_0x5d475f[_0xaef5('0x34')]['offset']);}_0x35b062['order']=qs[_0xaef5('0x3c')](_0x5d475f[_0xaef5('0x34')][_0xaef5('0x3c')]);_0x35b062[_0xaef5('0x3d')]=qs[_0xaef5('0x36')](_['pick'](_0x5d475f[_0xaef5('0x34')],_0x4ac506[_0xaef5('0x36')]),_0x17e8a2);if(_0x5d475f[_0xaef5('0x34')][_0xaef5('0x3e')]){_0x35b062[_0xaef5('0x3d')]=_[_0xaef5('0x3f')](_0x35b062[_0xaef5('0x3d')],{'$or':_[_0xaef5('0x2f')](_0x17e8a2,function(_0x3fb390){if(_0x3fb390['type']!==_0xaef5('0x40')){var _0x20ec60={};_0x20ec60[_0x3fb390[_0xaef5('0x2c')]]={'$like':'%'+_0x5d475f[_0xaef5('0x34')][_0xaef5('0x3e')]+'%'};return _0x20ec60;}})});}_0x35b062=_[_0xaef5('0x3f')]({},_0x35b062,_0x5d475f[_0xaef5('0x41')]);var _0x1ec58b={'where':_0x35b062[_0xaef5('0x3d')]};return db[_0xaef5('0x42')][_0xaef5('0x43')](_0x1ec58b)[_0xaef5('0x24')](function(_0x3f8706){_0x102ef7[_0xaef5('0x43')]=_0x3f8706;if(_0x5d475f[_0xaef5('0x34')][_0xaef5('0x44')]){_0x35b062['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0xaef5('0x45')](_0x35b062);})[_0xaef5('0x24')](function(_0x5d81b5){_0x102ef7[_0xaef5('0x46')]=_0x5d81b5;return _0x102ef7;})[_0xaef5('0x24')](respondWithFilteredResult(_0x510b21,_0x35b062))[_0xaef5('0x47')](handleError(_0x510b21,null));};exports[_0xaef5('0x48')]=function(_0x2111aa,_0xa823e2){var _0x143da5={'raw':!![],'where':{'id':_0x2111aa['params']['id']}},_0x400d98={};_0x400d98[_0xaef5('0x33')]=_[_0xaef5('0x35')](db[_0xaef5('0x42')][_0xaef5('0x30')]);_0x400d98[_0xaef5('0x34')]=_[_0xaef5('0x35')](_0x2111aa['query']);_0x400d98[_0xaef5('0x36')]=_[_0xaef5('0x37')](_0x400d98['model'],_0x400d98[_0xaef5('0x34')]);_0x143da5[_0xaef5('0x38')]=_[_0xaef5('0x37')](_0x400d98[_0xaef5('0x33')],qs[_0xaef5('0x39')](_0x2111aa[_0xaef5('0x34')][_0xaef5('0x39')]));_0x143da5['attributes']=_0x143da5[_0xaef5('0x38')][_0xaef5('0x49')]?_0x143da5[_0xaef5('0x38')]:_0x400d98[_0xaef5('0x33')];if(_0x2111aa[_0xaef5('0x34')]['includeAll']){_0x143da5[_0xaef5('0x4a')]=[{'all':!![]}];}_0x143da5=_[_0xaef5('0x3f')]({},_0x143da5,_0x2111aa['options']);return db[_0xaef5('0x42')][_0xaef5('0x4b')](_0x143da5)['then'](handleEntityNotFound(_0xa823e2,null))[_0xaef5('0x24')](respondWithResult(_0xa823e2,null))[_0xaef5('0x47')](handleError(_0xa823e2,null));};exports[_0xaef5('0x4c')]=function(_0x401206,_0x5a2df9){return db[_0xaef5('0x42')][_0xaef5('0x4c')](_0x401206[_0xaef5('0x4d')],{})[_0xaef5('0x24')](function(_0x2ba783){var _0x2ed3ec=_0x401206[_0xaef5('0x4e')]['get']({'plain':!![]});if(!_0x2ed3ec)throw new Error(_0xaef5('0x4f'));if(_0x2ed3ec[_0xaef5('0x50')]===_0xaef5('0x4e')){var _0x26f4bb=_0x2ba783[_0xaef5('0x51')]({'plain':!![]});var _0x5126b9=_0xaef5('0x25');return db[_0xaef5('0x52')]['find']({'where':{'name':_0x5126b9,'userProfileId':_0x2ed3ec[_0xaef5('0x53')]},'raw':!![]})[_0xaef5('0x24')](function(_0x26e76c){if(_0x26e76c&&_0x26e76c['autoAssociation']===0x0){return db[_0xaef5('0x26')][_0xaef5('0x4c')]({'name':_0x26f4bb[_0xaef5('0x2c')],'resourceId':_0x26f4bb['id'],'type':_0x26e76c[_0xaef5('0x2c')],'sectionId':_0x26e76c['id']},{})[_0xaef5('0x24')](function(){return _0x2ba783;});}else{return _0x2ba783;}})[_0xaef5('0x47')](function(_0x3e695b){logger[_0xaef5('0x2a')](_0xaef5('0x54'),_0x3e695b);throw _0x3e695b;});}return _0x2ba783;})['then'](respondWithResult(_0x5a2df9,0xc9))[_0xaef5('0x47')](handleError(_0x5a2df9,null));};exports[_0xaef5('0x23')]=function(_0x1fc50f,_0x22a5b4){if(_0x1fc50f[_0xaef5('0x4d')]['id']){delete _0x1fc50f[_0xaef5('0x4d')]['id'];}return db[_0xaef5('0x42')]['find']({'where':{'id':_0x1fc50f[_0xaef5('0x55')]['id']}})['then'](handleEntityNotFound(_0x22a5b4,null))[_0xaef5('0x24')](saveUpdates(_0x1fc50f[_0xaef5('0x4d')],null))[_0xaef5('0x24')](respondWithResult(_0x22a5b4,null))[_0xaef5('0x47')](handleError(_0x22a5b4,null));};exports[_0xaef5('0x27')]=function(_0x433fcc,_0x83dc87){return db[_0xaef5('0x42')][_0xaef5('0x4b')]({'where':{'id':_0x433fcc[_0xaef5('0x55')]['id']}})['then'](handleEntityNotFound(_0x83dc87,null))[_0xaef5('0x24')](removeEntity(_0x83dc87,null))['catch'](handleError(_0x83dc87,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 46bf125..fc9108c 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 _0x687b=['rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x5de6c9,_0x471538){var _0x4f45f6=function(_0xe0c086){while(--_0xe0c086){_0x5de6c9['push'](_0x5de6c9['shift']());}};_0x4f45f6(++_0x471538);}(_0x687b,0x14a));var _0xb687=function(_0x5bd953,_0x307788){_0x5bd953=_0x5bd953-0x0;var _0x4ac021=_0x687b[_0x5bd953];return _0x4ac021;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x4ab50c,_0x1185aa){var _0x45a39a=function(_0x2dd5a3){while(--_0x2dd5a3){_0x4ab50c['push'](_0x4ab50c['shift']());}};_0x45a39a(++_0x1185aa);}(_0x323f,0x1ee));var _0xf323=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x323f[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'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 5132616..49103f9 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 _0xd8e0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','CmContactHasItem,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x55547d,_0x33d115){var _0x244162=function(_0x454bd4){while(--_0x454bd4){_0x55547d['push'](_0x55547d['shift']());}};_0x244162(++_0x33d115);}(_0xd8e0,0x111));var _0x0d8e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd8e0[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x0d8e('0x0'));var util=require(_0x0d8e('0x1'));var moment=require(_0x0d8e('0x2'));var BPromise=require(_0x0d8e('0x3'));var rs=require(_0x0d8e('0x4'));var fs=require('fs');var Redis=require(_0x0d8e('0x5'));var db=require(_0x0d8e('0x6'))['db'];var utils=require(_0x0d8e('0x7'));var logger=require(_0x0d8e('0x8'))(_0x0d8e('0x9'));var config=require(_0x0d8e('0xa'));var jayson=require(_0x0d8e('0xb'));var client=jayson[_0x0d8e('0xc')][_0x0d8e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x25f147,_0x37a624,_0x43befc){return new BPromise(function(_0x1bf76c,_0x4a714a){return client[_0x0d8e('0xe')](_0x25f147,_0x43befc)[_0x0d8e('0xf')](function(_0xa8436e){logger[_0x0d8e('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x37a624,_0x0d8e('0x11'));logger[_0x0d8e('0x12')](_0x0d8e('0x13'),_0x37a624,_0x0d8e('0x11'),JSON[_0x0d8e('0x14')](_0xa8436e));if(_0xa8436e['error']){if(_0xa8436e[_0x0d8e('0x15')]['code']===0x1f4){logger[_0x0d8e('0x15')](_0x0d8e('0x16'),_0x37a624,_0xa8436e[_0x0d8e('0x15')][_0x0d8e('0x17')]);return _0x4a714a(_0xa8436e[_0x0d8e('0x15')][_0x0d8e('0x17')]);}logger[_0x0d8e('0x15')]('CmContactHasItem,\x20%s,\x20%s',_0x37a624,_0xa8436e['error'][_0x0d8e('0x17')]);return _0x1bf76c(_0xa8436e['error'][_0x0d8e('0x17')]);}else{logger[_0x0d8e('0x10')](_0x0d8e('0x16'),_0x37a624,_0x0d8e('0x11'));_0x1bf76c(_0xa8436e[_0x0d8e('0x18')][_0x0d8e('0x17')]);}})['catch'](function(_0x102ba3){logger[_0x0d8e('0x15')]('CmContactHasItem,\x20%s,\x20%s',_0x37a624,_0x102ba3);_0x4a714a(_0x102ba3);});});} \ No newline at end of file +var _0x26ae=['client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0x26ae,0x73));var _0xe26a=function(_0x41e52a,_0x2de181){_0x41e52a=_0x41e52a-0x0;var _0x45c51d=_0x26ae[_0x41e52a];return _0x45c51d;};'use strict';var _=require(_0xe26a('0x0'));var util=require(_0xe26a('0x1'));var moment=require(_0xe26a('0x2'));var BPromise=require(_0xe26a('0x3'));var rs=require(_0xe26a('0x4'));var fs=require('fs');var Redis=require(_0xe26a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe26a('0x6'));var logger=require(_0xe26a('0x7'))(_0xe26a('0x8'));var config=require('../../config/environment');var jayson=require(_0xe26a('0x9'));var client=jayson[_0xe26a('0xa')][_0xe26a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56b560,_0x437063,_0x51e187){return new BPromise(function(_0x4adc60,_0x1ab7b8){return client[_0xe26a('0xc')](_0x56b560,_0x51e187)[_0xe26a('0xd')](function(_0x4c307c){logger[_0xe26a('0xe')](_0xe26a('0xf'),_0x437063,_0xe26a('0x10'));logger[_0xe26a('0x11')](_0xe26a('0x12'),_0x437063,_0xe26a('0x10'),JSON[_0xe26a('0x13')](_0x4c307c));if(_0x4c307c['error']){if(_0x4c307c[_0xe26a('0x14')][_0xe26a('0x15')]===0x1f4){logger['error'](_0xe26a('0xf'),_0x437063,_0x4c307c['error']['message']);return _0x1ab7b8(_0x4c307c[_0xe26a('0x14')][_0xe26a('0x16')]);}logger['error'](_0xe26a('0xf'),_0x437063,_0x4c307c[_0xe26a('0x14')][_0xe26a('0x16')]);return _0x4adc60(_0x4c307c[_0xe26a('0x14')][_0xe26a('0x16')]);}else{logger[_0xe26a('0xe')](_0xe26a('0xf'),_0x437063,'request\x20sent');_0x4adc60(_0x4c307c[_0xe26a('0x17')]['message']);}})[_0xe26a('0x18')](function(_0x38916a){logger['error'](_0xe26a('0xf'),_0x437063,_0x38916a);_0x1ab7b8(_0x38916a);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 5017348..f1b0759 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 _0x8d49=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer'];(function(_0x442fab,_0x30eabf){var _0x3c1a32=function(_0x5ac7bf){while(--_0x5ac7bf){_0x442fab['push'](_0x442fab['shift']());}};_0x3c1a32(++_0x30eabf);}(_0x8d49,0x11f));var _0x98d4=function(_0x2a1473,_0x14d397){_0x2a1473=_0x2a1473-0x0;var _0x46be48=_0x8d49[_0x2a1473];return _0x46be48;};'use strict';var multer=require(_0x98d4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x98d4('0x1'));var express=require(_0x98d4('0x2'));var router=express['Router']();var auth=require(_0x98d4('0x3'));var interaction=require(_0x98d4('0x4'));var config=require(_0x98d4('0x5'));var controller=require('./cmContactHasItem.controller');router[_0x98d4('0x6')]('/',auth['isAuthenticated'](),controller[_0x98d4('0x7')]);router[_0x98d4('0x6')](_0x98d4('0x8'),auth[_0x98d4('0x9')](),controller['show']);router[_0x98d4('0xa')]('/',auth[_0x98d4('0x9')](),controller[_0x98d4('0xb')]);router[_0x98d4('0xc')](_0x98d4('0x8'),auth[_0x98d4('0x9')](),controller[_0x98d4('0xd')]);router['delete'](_0x98d4('0x8'),auth[_0x98d4('0x9')](),controller[_0x98d4('0xe')]);module[_0x98d4('0xf')]=router; \ No newline at end of file +var _0x882a=['put','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','show','post','create'];(function(_0x464ee6,_0x498f85){var _0x34d7f0=function(_0x18683e){while(--_0x18683e){_0x464ee6['push'](_0x464ee6['shift']());}};_0x34d7f0(++_0x498f85);}(_0x882a,0x95));var _0xa882=function(_0x379a3d,_0x439b33){_0x379a3d=_0x379a3d-0x0;var _0x3acb8=_0x882a[_0x379a3d];return _0x3acb8;};'use strict';var multer=require(_0xa882('0x0'));var util=require('util');var path=require(_0xa882('0x1'));var timeout=require(_0xa882('0x2'));var express=require(_0xa882('0x3'));var router=express['Router']();var auth=require(_0xa882('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa882('0x5'));var controller=require(_0xa882('0x6'));router[_0xa882('0x7')]('/',auth[_0xa882('0x8')](),controller[_0xa882('0x9')]);router[_0xa882('0x7')]('/:id',auth[_0xa882('0x8')](),controller[_0xa882('0xa')]);router[_0xa882('0xb')]('/',auth[_0xa882('0x8')](),controller[_0xa882('0xc')]);router[_0xa882('0xd')](_0xa882('0xe'),auth[_0xa882('0x8')](),controller[_0xa882('0xf')]);router[_0xa882('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xa882('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index c60aeb7..be8b7aa 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 _0xf85c=['INTEGER','STRING','sequelize','exports'];(function(_0x3a7949,_0x5ff89){var _0x56df57=function(_0x35c6f8){while(--_0x35c6f8){_0x3a7949['push'](_0x3a7949['shift']());}};_0x56df57(++_0x5ff89);}(_0xf85c,0x11e));var _0xcf85=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xf85c[_0x2aa0e7];return _0x1472c0;};'use strict';var Sequelize=require(_0xcf85('0x0'));module[_0xcf85('0x1')]={'CmContactId':{'type':Sequelize[_0xcf85('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xcf85('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x5eac=['INTEGER','sequelize','exports'];(function(_0x19258b,_0x22e850){var _0x5be66a=function(_0x24e321){while(--_0x24e321){_0x19258b['push'](_0x19258b['shift']());}};_0x5be66a(++_0x22e850);}(_0x5eac,0x85));var _0xc5ea=function(_0x353ca6,_0x1bf806){_0x353ca6=_0x353ca6-0x0;var _0x314a39=_0x5eac[_0x353ca6];return _0x314a39;};'use strict';var Sequelize=require(_0xc5ea('0x0'));module[_0xc5ea('0x1')]={'CmContactId':{'type':Sequelize[_0xc5ea('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index c9f966d..ed8c40e 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 _0x4c1a=['rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','update','html-pdf','eml-format','rimraf','request-promise','moment','util','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','end','status','offset','limit','set','Content-Range','json','apply','reject','save','then','get','CmContactHasPhones','UserProfileResource','destroy','error','stack','name','send','CmContactHasPhone'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x4c1a,0x1b2));var _0xa4c1=function(_0x393255,_0x44b68d){_0x393255=_0x393255-0x0;var _0x2c68c9=_0x4c1a[_0x393255];return _0x2c68c9;};'use strict';var pdf=require(_0xa4c1('0x0'));var emlformat=require(_0xa4c1('0x1'));var rimraf=require(_0xa4c1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa4c1('0x3'));var moment=require(_0xa4c1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa4c1('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa4c1('0x6'));var fs=require('fs');var _=require(_0xa4c1('0x7'));var squel=require('squel');var crypto=require(_0xa4c1('0x8'));var jsforce=require(_0xa4c1('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa4c1('0xa'));var Papa=require(_0xa4c1('0xb'));var Redis=require(_0xa4c1('0xc'));var authService=require(_0xa4c1('0xd'));var qs=require(_0xa4c1('0xe'));var as=require(_0xa4c1('0xf'));var hardwareService=require(_0xa4c1('0x10'));var logger=require(_0xa4c1('0x11'))('api');var utils=require(_0xa4c1('0x12'));var config=require(_0xa4c1('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f7184,_0x2c4bdd){_0x2c4bdd=_0x2c4bdd||0xcc;return function(_0x4e6b26){if(_0x4e6b26){return _0x3f7184['sendStatus'](_0x2c4bdd);}return _0x3f7184['status'](_0x2c4bdd)[_0xa4c1('0x14')]();};}function respondWithResult(_0x208540,_0x4e5d86){_0x4e5d86=_0x4e5d86||0xc8;return function(_0x5928b9){if(_0x5928b9){return _0x208540[_0xa4c1('0x15')](_0x4e5d86)['json'](_0x5928b9);}};}function respondWithFilteredResult(_0x4749cf,_0x30bdda){return function(_0x23f7e0){if(_0x23f7e0){var _0x9ea15=_0x23f7e0['count'],_0x1f9f62=_0x30bdda[_0xa4c1('0x16')],_0x9ab4dd=_0x30bdda[_0xa4c1('0x16')]+_0x30bdda[_0xa4c1('0x17')],_0x51a4a5;if(_0x9ab4dd>=_0x9ea15){_0x9ab4dd=_0x9ea15;_0x51a4a5=0xc8;}else{_0x51a4a5=0xce;}_0x4749cf[_0xa4c1('0x15')](_0x51a4a5);return _0x4749cf[_0xa4c1('0x18')](_0xa4c1('0x19'),_0x1f9f62+'-'+_0x9ab4dd+'/'+_0x9ea15)[_0xa4c1('0x1a')](_0x23f7e0);}return null;};}function patchUpdates(_0x3a8ed6){return function(_0x441236){try{jsonpatch[_0xa4c1('0x1b')](_0x441236,_0x3a8ed6,!![]);}catch(_0xe6f549){return BPromise[_0xa4c1('0x1c')](_0xe6f549);}return _0x441236[_0xa4c1('0x1d')]();};}function saveUpdates(_0x39359c,_0x1da925){return function(_0x965d10){if(_0x965d10){return _0x965d10['update'](_0x39359c)[_0xa4c1('0x1e')](function(_0x237198){return _0x237198;});}return null;};}function removeEntity(_0x2d4ffc,_0x292e33){return function(_0x57d21f){if(_0x57d21f){return _0x57d21f['destroy']()[_0xa4c1('0x1e')](function(){var _0x2db9cf=_0x57d21f[_0xa4c1('0x1f')]({'plain':!![]});var _0x515c59=_0xa4c1('0x20');return db[_0xa4c1('0x21')][_0xa4c1('0x22')]({'where':{'type':_0x515c59,'resourceId':_0x2db9cf['id']}})[_0xa4c1('0x1e')](function(){return _0x57d21f;});})[_0xa4c1('0x1e')](function(){_0x2d4ffc[_0xa4c1('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43a103,_0x366a40){return function(_0x1fbcd0){if(!_0x1fbcd0){_0x43a103['sendStatus'](0x194);}return _0x1fbcd0;};}function handleError(_0x3f65a7,_0x234c92){_0x234c92=_0x234c92||0x1f4;return function(_0x3897ed){logger[_0xa4c1('0x23')](_0x3897ed[_0xa4c1('0x24')]);if(_0x3897ed[_0xa4c1('0x25')]){delete _0x3897ed[_0xa4c1('0x25')];}_0x3f65a7['status'](_0x234c92)[_0xa4c1('0x26')](_0x3897ed);};}exports['index']=function(_0x4be8b0,_0x2876af){var _0x2cab7e={},_0x5e6b89={},_0x52cf39={'count':0x0,'rows':[]};var _0x58f297=_['map'](db[_0xa4c1('0x27')][_0xa4c1('0x28')],function(_0x451850){return{'name':_0x451850['fieldName'],'type':_0x451850[_0xa4c1('0x29')][_0xa4c1('0x2a')]};});_0x5e6b89['model']=_[_0xa4c1('0x2b')](_0x58f297,_0xa4c1('0x25'));_0x5e6b89[_0xa4c1('0x2c')]=_[_0xa4c1('0x2d')](_0x4be8b0[_0xa4c1('0x2c')]);_0x5e6b89[_0xa4c1('0x2e')]=_[_0xa4c1('0x2f')](_0x5e6b89[_0xa4c1('0x30')],_0x5e6b89[_0xa4c1('0x2c')]);_0x2cab7e[_0xa4c1('0x31')]=_[_0xa4c1('0x2f')](_0x5e6b89[_0xa4c1('0x30')],qs['fields'](_0x4be8b0['query'][_0xa4c1('0x32')]));_0x2cab7e['attributes']=_0x2cab7e[_0xa4c1('0x31')]['length']?_0x2cab7e['attributes']:_0x5e6b89[_0xa4c1('0x30')];if(!_0x4be8b0[_0xa4c1('0x2c')][_0xa4c1('0x33')](_0xa4c1('0x34'))){_0x2cab7e[_0xa4c1('0x17')]=qs['limit'](_0x4be8b0[_0xa4c1('0x2c')]['limit']);_0x2cab7e[_0xa4c1('0x16')]=qs[_0xa4c1('0x16')](_0x4be8b0[_0xa4c1('0x2c')][_0xa4c1('0x16')]);}_0x2cab7e['order']=qs[_0xa4c1('0x35')](_0x4be8b0[_0xa4c1('0x2c')][_0xa4c1('0x35')]);_0x2cab7e[_0xa4c1('0x36')]=qs[_0xa4c1('0x2e')](_[_0xa4c1('0x37')](_0x4be8b0[_0xa4c1('0x2c')],_0x5e6b89[_0xa4c1('0x2e')]),_0x58f297);if(_0x4be8b0['query'][_0xa4c1('0x38')]){_0x2cab7e[_0xa4c1('0x36')]=_[_0xa4c1('0x39')](_0x2cab7e[_0xa4c1('0x36')],{'$or':_[_0xa4c1('0x2b')](_0x58f297,function(_0x2a394a){if(_0x2a394a['type']!==_0xa4c1('0x3a')){var _0x27694e={};_0x27694e[_0x2a394a[_0xa4c1('0x25')]]={'$like':'%'+_0x4be8b0[_0xa4c1('0x2c')][_0xa4c1('0x38')]+'%'};return _0x27694e;}})});}_0x2cab7e=_['merge']({},_0x2cab7e,_0x4be8b0['options']);var _0x1c1aec={'where':_0x2cab7e['where']};return db[_0xa4c1('0x27')][_0xa4c1('0x3b')](_0x1c1aec)[_0xa4c1('0x1e')](function(_0x3fcecf){_0x52cf39[_0xa4c1('0x3b')]=_0x3fcecf;if(_0x4be8b0[_0xa4c1('0x2c')][_0xa4c1('0x3c')]){_0x2cab7e[_0xa4c1('0x3d')]=[{'all':!![]}];}return db[_0xa4c1('0x27')][_0xa4c1('0x3e')](_0x2cab7e);})[_0xa4c1('0x1e')](function(_0x2523dd){_0x52cf39[_0xa4c1('0x3f')]=_0x2523dd;return _0x52cf39;})[_0xa4c1('0x1e')](respondWithFilteredResult(_0x2876af,_0x2cab7e))[_0xa4c1('0x40')](handleError(_0x2876af,null));};exports[_0xa4c1('0x41')]=function(_0x3c8c6d,_0x5cda11){var _0x3560bb={'raw':!![],'where':{'id':_0x3c8c6d[_0xa4c1('0x42')]['id']}},_0x58bd2e={};_0x58bd2e[_0xa4c1('0x30')]=_[_0xa4c1('0x2d')](db[_0xa4c1('0x27')][_0xa4c1('0x28')]);_0x58bd2e['query']=_[_0xa4c1('0x2d')](_0x3c8c6d['query']);_0x58bd2e[_0xa4c1('0x2e')]=_[_0xa4c1('0x2f')](_0x58bd2e[_0xa4c1('0x30')],_0x58bd2e[_0xa4c1('0x2c')]);_0x3560bb[_0xa4c1('0x31')]=_[_0xa4c1('0x2f')](_0x58bd2e[_0xa4c1('0x30')],qs[_0xa4c1('0x32')](_0x3c8c6d[_0xa4c1('0x2c')][_0xa4c1('0x32')]));_0x3560bb[_0xa4c1('0x31')]=_0x3560bb[_0xa4c1('0x31')][_0xa4c1('0x43')]?_0x3560bb[_0xa4c1('0x31')]:_0x58bd2e[_0xa4c1('0x30')];if(_0x3c8c6d[_0xa4c1('0x2c')][_0xa4c1('0x3c')]){_0x3560bb[_0xa4c1('0x3d')]=[{'all':!![]}];}_0x3560bb=_[_0xa4c1('0x39')]({},_0x3560bb,_0x3c8c6d[_0xa4c1('0x44')]);return db['CmContactHasPhone']['find'](_0x3560bb)[_0xa4c1('0x1e')](handleEntityNotFound(_0x5cda11,null))['then'](respondWithResult(_0x5cda11,null))[_0xa4c1('0x40')](handleError(_0x5cda11,null));};exports['create']=function(_0x3a2d57,_0x2d3b24){return db[_0xa4c1('0x27')][_0xa4c1('0x45')](_0x3a2d57[_0xa4c1('0x46')],{})[_0xa4c1('0x1e')](function(_0x57603f){var _0x2f09af=_0x3a2d57[_0xa4c1('0x47')][_0xa4c1('0x1f')]({'plain':!![]});if(!_0x2f09af)throw new Error(_0xa4c1('0x48'));if(_0x2f09af[_0xa4c1('0x49')]===_0xa4c1('0x47')){var _0x3a6f4d=_0x57603f['get']({'plain':!![]});var _0x5ef981=_0xa4c1('0x20');return db[_0xa4c1('0x4a')][_0xa4c1('0x4b')]({'where':{'name':_0x5ef981,'userProfileId':_0x2f09af[_0xa4c1('0x4c')]},'raw':!![]})[_0xa4c1('0x1e')](function(_0x2fc3ac){if(_0x2fc3ac&&_0x2fc3ac[_0xa4c1('0x4d')]===0x0){return db[_0xa4c1('0x21')][_0xa4c1('0x45')]({'name':_0x3a6f4d[_0xa4c1('0x25')],'resourceId':_0x3a6f4d['id'],'type':_0x2fc3ac[_0xa4c1('0x25')],'sectionId':_0x2fc3ac['id']},{})[_0xa4c1('0x1e')](function(){return _0x57603f;});}else{return _0x57603f;}})[_0xa4c1('0x40')](function(_0x2cadec){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cadec);throw _0x2cadec;});}return _0x57603f;})['then'](respondWithResult(_0x2d3b24,0xc9))['catch'](handleError(_0x2d3b24,null));};exports[_0xa4c1('0x4e')]=function(_0x3194a5,_0xf09b3a){if(_0x3194a5['body']['id']){delete _0x3194a5[_0xa4c1('0x46')]['id'];}return db[_0xa4c1('0x27')][_0xa4c1('0x4b')]({'where':{'id':_0x3194a5['params']['id']}})[_0xa4c1('0x1e')](handleEntityNotFound(_0xf09b3a,null))[_0xa4c1('0x1e')](saveUpdates(_0x3194a5['body'],null))['then'](respondWithResult(_0xf09b3a,null))[_0xa4c1('0x40')](handleError(_0xf09b3a,null));};exports['destroy']=function(_0x19386e,_0xe7e5cb){return db[_0xa4c1('0x27')][_0xa4c1('0x4b')]({'where':{'id':_0x19386e[_0xa4c1('0x42')]['id']}})[_0xa4c1('0x1e')](handleEntityNotFound(_0xe7e5cb,null))[_0xa4c1('0x1e')](removeEntity(_0xe7e5cb,null))['catch'](handleError(_0xe7e5cb,null));}; \ No newline at end of file +var _0x810d=['rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','get','CmContactHasPhones','UserProfileResource','destroy','error','stack','name','send','index','map','CmContactHasPhone','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x3d0979,_0xe0866a){var _0x1beb42=function(_0x506708){while(--_0x506708){_0x3d0979['push'](_0x3d0979['shift']());}};_0x1beb42(++_0xe0866a);}(_0x810d,0xf8));var _0xd810=function(_0x34252d,_0x4d1457){_0x34252d=_0x34252d-0x0;var _0x208e44=_0x810d[_0x34252d];return _0x208e44;};'use strict';var pdf=require(_0xd810('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd810('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd810('0x2'));var rp=require(_0xd810('0x3'));var moment=require(_0xd810('0x4'));var BPromise=require(_0xd810('0x5'));var Mustache=require(_0xd810('0x6'));var util=require('util');var path=require(_0xd810('0x7'));var sox=require(_0xd810('0x8'));var csv=require(_0xd810('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd810('0xa'));var crypto=require(_0xd810('0xb'));var jsforce=require(_0xd810('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd810('0x9'));var querystring=require('querystring');var Papa=require(_0xd810('0xd'));var Redis=require(_0xd810('0xe'));var authService=require(_0xd810('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd810('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd810('0x11'));var utils=require(_0xd810('0x12'));var config=require(_0xd810('0x13'));var db=require(_0xd810('0x14'))['db'];function respondWithStatusCode(_0x41c80e,_0x327291){_0x327291=_0x327291||0xcc;return function(_0x354242){if(_0x354242){return _0x41c80e[_0xd810('0x15')](_0x327291);}return _0x41c80e[_0xd810('0x16')](_0x327291)[_0xd810('0x17')]();};}function respondWithResult(_0x425c09,_0x40d384){_0x40d384=_0x40d384||0xc8;return function(_0x232226){if(_0x232226){return _0x425c09[_0xd810('0x16')](_0x40d384)[_0xd810('0x18')](_0x232226);}};}function respondWithFilteredResult(_0x383d99,_0x22acb3){return function(_0x2eaec0){if(_0x2eaec0){var _0x35d6c2=_0x2eaec0[_0xd810('0x19')],_0x4b02aa=_0x22acb3[_0xd810('0x1a')],_0x2ff163=_0x22acb3['offset']+_0x22acb3[_0xd810('0x1b')],_0x3b4fce;if(_0x2ff163>=_0x35d6c2){_0x2ff163=_0x35d6c2;_0x3b4fce=0xc8;}else{_0x3b4fce=0xce;}_0x383d99[_0xd810('0x16')](_0x3b4fce);return _0x383d99[_0xd810('0x1c')](_0xd810('0x1d'),_0x4b02aa+'-'+_0x2ff163+'/'+_0x35d6c2)['json'](_0x2eaec0);}return null;};}function patchUpdates(_0x47ac2c){return function(_0x125fb2){try{jsonpatch[_0xd810('0x1e')](_0x125fb2,_0x47ac2c,!![]);}catch(_0x30a93b){return BPromise[_0xd810('0x1f')](_0x30a93b);}return _0x125fb2['save']();};}function saveUpdates(_0x26d28a,_0xded8f1){return function(_0x34514e){if(_0x34514e){return _0x34514e['update'](_0x26d28a)[_0xd810('0x20')](function(_0x18aab8){return _0x18aab8;});}return null;};}function removeEntity(_0x58904c,_0x196889){return function(_0x597774){if(_0x597774){return _0x597774['destroy']()['then'](function(){var _0x4280c=_0x597774[_0xd810('0x21')]({'plain':!![]});var _0x375453=_0xd810('0x22');return db[_0xd810('0x23')][_0xd810('0x24')]({'where':{'type':_0x375453,'resourceId':_0x4280c['id']}})['then'](function(){return _0x597774;});})[_0xd810('0x20')](function(){_0x58904c['status'](0xcc)[_0xd810('0x17')]();});}};}function handleEntityNotFound(_0x4ad418,_0x83ce2b){return function(_0x3ffbca){if(!_0x3ffbca){_0x4ad418[_0xd810('0x15')](0x194);}return _0x3ffbca;};}function handleError(_0x283d84,_0x5af743){_0x5af743=_0x5af743||0x1f4;return function(_0x120422){logger[_0xd810('0x25')](_0x120422[_0xd810('0x26')]);if(_0x120422['name']){delete _0x120422[_0xd810('0x27')];}_0x283d84['status'](_0x5af743)[_0xd810('0x28')](_0x120422);};}exports[_0xd810('0x29')]=function(_0x3b8ad0,_0x451cbc){var _0xc96768={},_0x29026f={},_0x37c664={'count':0x0,'rows':[]};var _0xdbbfc=_[_0xd810('0x2a')](db[_0xd810('0x2b')]['rawAttributes'],function(_0x1e0842){return{'name':_0x1e0842['fieldName'],'type':_0x1e0842[_0xd810('0x2c')][_0xd810('0x2d')]};});_0x29026f[_0xd810('0x2e')]=_[_0xd810('0x2a')](_0xdbbfc,_0xd810('0x27'));_0x29026f[_0xd810('0x2f')]=_[_0xd810('0x30')](_0x3b8ad0[_0xd810('0x2f')]);_0x29026f[_0xd810('0x31')]=_['intersection'](_0x29026f['model'],_0x29026f[_0xd810('0x2f')]);_0xc96768[_0xd810('0x32')]=_[_0xd810('0x33')](_0x29026f['model'],qs['fields'](_0x3b8ad0['query'][_0xd810('0x34')]));_0xc96768[_0xd810('0x32')]=_0xc96768[_0xd810('0x32')][_0xd810('0x35')]?_0xc96768[_0xd810('0x32')]:_0x29026f[_0xd810('0x2e')];if(!_0x3b8ad0['query']['hasOwnProperty']('nolimit')){_0xc96768[_0xd810('0x1b')]=qs[_0xd810('0x1b')](_0x3b8ad0[_0xd810('0x2f')]['limit']);_0xc96768['offset']=qs[_0xd810('0x1a')](_0x3b8ad0['query'][_0xd810('0x1a')]);}_0xc96768[_0xd810('0x36')]=qs[_0xd810('0x37')](_0x3b8ad0[_0xd810('0x2f')][_0xd810('0x37')]);_0xc96768[_0xd810('0x38')]=qs[_0xd810('0x31')](_[_0xd810('0x39')](_0x3b8ad0[_0xd810('0x2f')],_0x29026f['filters']),_0xdbbfc);if(_0x3b8ad0[_0xd810('0x2f')][_0xd810('0x3a')]){_0xc96768[_0xd810('0x38')]=_[_0xd810('0x3b')](_0xc96768[_0xd810('0x38')],{'$or':_[_0xd810('0x2a')](_0xdbbfc,function(_0x2f4c36){if(_0x2f4c36[_0xd810('0x2c')]!==_0xd810('0x3c')){var _0x18a63e={};_0x18a63e[_0x2f4c36['name']]={'$like':'%'+_0x3b8ad0[_0xd810('0x2f')][_0xd810('0x3a')]+'%'};return _0x18a63e;}})});}_0xc96768=_[_0xd810('0x3b')]({},_0xc96768,_0x3b8ad0[_0xd810('0x3d')]);var _0x8b63c8={'where':_0xc96768[_0xd810('0x38')]};return db['CmContactHasPhone'][_0xd810('0x19')](_0x8b63c8)['then'](function(_0x880a3){_0x37c664[_0xd810('0x19')]=_0x880a3;if(_0x3b8ad0['query'][_0xd810('0x3e')]){_0xc96768[_0xd810('0x3f')]=[{'all':!![]}];}return db[_0xd810('0x2b')][_0xd810('0x40')](_0xc96768);})[_0xd810('0x20')](function(_0x35fc45){_0x37c664[_0xd810('0x41')]=_0x35fc45;return _0x37c664;})[_0xd810('0x20')](respondWithFilteredResult(_0x451cbc,_0xc96768))[_0xd810('0x42')](handleError(_0x451cbc,null));};exports[_0xd810('0x43')]=function(_0x22e551,_0x444e69){var _0x1b99ef={'raw':!![],'where':{'id':_0x22e551['params']['id']}},_0x2d0ab6={};_0x2d0ab6['model']=_['keys'](db['CmContactHasPhone'][_0xd810('0x44')]);_0x2d0ab6[_0xd810('0x2f')]=_['keys'](_0x22e551[_0xd810('0x2f')]);_0x2d0ab6['filters']=_[_0xd810('0x33')](_0x2d0ab6['model'],_0x2d0ab6[_0xd810('0x2f')]);_0x1b99ef[_0xd810('0x32')]=_[_0xd810('0x33')](_0x2d0ab6[_0xd810('0x2e')],qs['fields'](_0x22e551['query']['fields']));_0x1b99ef[_0xd810('0x32')]=_0x1b99ef[_0xd810('0x32')][_0xd810('0x35')]?_0x1b99ef[_0xd810('0x32')]:_0x2d0ab6['model'];if(_0x22e551[_0xd810('0x2f')][_0xd810('0x3e')]){_0x1b99ef['include']=[{'all':!![]}];}_0x1b99ef=_['merge']({},_0x1b99ef,_0x22e551[_0xd810('0x3d')]);return db[_0xd810('0x2b')][_0xd810('0x45')](_0x1b99ef)[_0xd810('0x20')](handleEntityNotFound(_0x444e69,null))[_0xd810('0x20')](respondWithResult(_0x444e69,null))['catch'](handleError(_0x444e69,null));};exports[_0xd810('0x46')]=function(_0x3a37a3,_0x2c8c26){return db['CmContactHasPhone'][_0xd810('0x46')](_0x3a37a3[_0xd810('0x47')],{})[_0xd810('0x20')](function(_0x4c00b7){var _0xa5bd09=_0x3a37a3[_0xd810('0x48')]['get']({'plain':!![]});if(!_0xa5bd09)throw new Error(_0xd810('0x49'));if(_0xa5bd09[_0xd810('0x4a')]==='user'){var _0x485fe9=_0x4c00b7[_0xd810('0x21')]({'plain':!![]});var _0x248eba=_0xd810('0x22');return db[_0xd810('0x4b')][_0xd810('0x45')]({'where':{'name':_0x248eba,'userProfileId':_0xa5bd09[_0xd810('0x4c')]},'raw':!![]})[_0xd810('0x20')](function(_0x3b5515){if(_0x3b5515&&_0x3b5515['autoAssociation']===0x0){return db[_0xd810('0x23')][_0xd810('0x46')]({'name':_0x485fe9[_0xd810('0x27')],'resourceId':_0x485fe9['id'],'type':_0x3b5515[_0xd810('0x27')],'sectionId':_0x3b5515['id']},{})[_0xd810('0x20')](function(){return _0x4c00b7;});}else{return _0x4c00b7;}})['catch'](function(_0x2200f7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2200f7);throw _0x2200f7;});}return _0x4c00b7;})[_0xd810('0x20')](respondWithResult(_0x2c8c26,0xc9))['catch'](handleError(_0x2c8c26,null));};exports[_0xd810('0x4d')]=function(_0x187cae,_0x57cbfd){if(_0x187cae[_0xd810('0x47')]['id']){delete _0x187cae[_0xd810('0x47')]['id'];}return db[_0xd810('0x2b')][_0xd810('0x45')]({'where':{'id':_0x187cae[_0xd810('0x4e')]['id']}})['then'](handleEntityNotFound(_0x57cbfd,null))['then'](saveUpdates(_0x187cae[_0xd810('0x47')],null))['then'](respondWithResult(_0x57cbfd,null))['catch'](handleError(_0x57cbfd,null));};exports[_0xd810('0x24')]=function(_0xa02525,_0x109def){return db[_0xd810('0x2b')][_0xd810('0x45')]({'where':{'id':_0xa02525[_0xd810('0x4e')]['id']}})[_0xd810('0x20')](handleEntityNotFound(_0x109def,null))[_0xd810('0x20')](removeEntity(_0x109def,null))[_0xd810('0x42')](handleError(_0x109def,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 8078b81..d3d78ee 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 _0x1404=['exports','define','cm_contact_has_phones','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes'];(function(_0x382f72,_0x575a83){var _0x5ae106=function(_0x1ee3d7){while(--_0x1ee3d7){_0x382f72['push'](_0x382f72['shift']());}};_0x5ae106(++_0x575a83);}(_0x1404,0x1e3));var _0x4140=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1404[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x4140('0x0'));var util=require(_0x4140('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4140('0x2'));var BPromise=require(_0x4140('0x3'));var rp=require(_0x4140('0x4'));var fs=require('fs');var path=require(_0x4140('0x5'));var rimraf=require(_0x4140('0x6'));var config=require(_0x4140('0x7'));var attributes=require(_0x4140('0x8'));module[_0x4140('0x9')]=function(_0x378389,_0x145ee4){return _0x378389[_0x4140('0xa')]('CmContactHasPhone',attributes,{'tableName':_0x4140('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eb8=['request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','CmContactHasPhone','cm_contact_has_phones','lodash','api','bluebird'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2eb8,0x147));var _0x82eb=function(_0x5dec4e,_0x184e9b){_0x5dec4e=_0x5dec4e-0x0;var _0x240d25=_0x2eb8[_0x5dec4e];return _0x240d25;};'use strict';var _=require(_0x82eb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x82eb('0x1'));var moment=require('moment');var BPromise=require(_0x82eb('0x2'));var rp=require(_0x82eb('0x3'));var fs=require('fs');var path=require(_0x82eb('0x4'));var rimraf=require(_0x82eb('0x5'));var config=require(_0x82eb('0x6'));var attributes=require(_0x82eb('0x7'));module[_0x82eb('0x8')]=function(_0x5025d2,_0x5c802a){return _0x5025d2['define'](_0x82eb('0x9'),attributes,{'tableName':_0x82eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index 1b4d47b..8fa51e1 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 _0xd457=['request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmContactHasPhone,\x20%s,\x20%s'];(function(_0x3b2397,_0x4d52e8){var _0x4a81ea=function(_0xf92c9e){while(--_0xf92c9e){_0x3b2397['push'](_0x3b2397['shift']());}};_0x4a81ea(++_0x4d52e8);}(_0xd457,0x1e9));var _0x7d45=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xd457[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x7d45('0x0'));var util=require(_0x7d45('0x1'));var moment=require(_0x7d45('0x2'));var BPromise=require(_0x7d45('0x3'));var rs=require(_0x7d45('0x4'));var fs=require('fs');var Redis=require(_0x7d45('0x5'));var db=require(_0x7d45('0x6'))['db'];var utils=require(_0x7d45('0x7'));var logger=require(_0x7d45('0x8'))(_0x7d45('0x9'));var config=require(_0x7d45('0xa'));var jayson=require(_0x7d45('0xb'));var client=jayson[_0x7d45('0xc')][_0x7d45('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x43d9dd,_0x18ea06,_0x509d62){return new BPromise(function(_0x3fe197,_0xcc9ec4){return client['request'](_0x43d9dd,_0x509d62)[_0x7d45('0xe')](function(_0x409c27){logger[_0x7d45('0xf')](_0x7d45('0x10'),_0x18ea06,_0x7d45('0x11'));logger['debug']('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x18ea06,'request\x20sent',JSON[_0x7d45('0x12')](_0x409c27));if(_0x409c27[_0x7d45('0x13')]){if(_0x409c27[_0x7d45('0x13')][_0x7d45('0x14')]===0x1f4){logger['error'](_0x7d45('0x10'),_0x18ea06,_0x409c27[_0x7d45('0x13')][_0x7d45('0x15')]);return _0xcc9ec4(_0x409c27[_0x7d45('0x13')]['message']);}logger[_0x7d45('0x13')](_0x7d45('0x10'),_0x18ea06,_0x409c27[_0x7d45('0x13')][_0x7d45('0x15')]);return _0x3fe197(_0x409c27['error'][_0x7d45('0x15')]);}else{logger[_0x7d45('0xf')]('CmContactHasPhone,\x20%s,\x20%s',_0x18ea06,'request\x20sent');_0x3fe197(_0x409c27['result'][_0x7d45('0x15')]);}})[_0x7d45('0x16')](function(_0x4ddf7e){logger[_0x7d45('0x13')](_0x7d45('0x10'),_0x18ea06,_0x4ddf7e);_0xcc9ec4(_0x4ddf7e);});});} \ No newline at end of file +var _0xa9c0=['CmContactHasPhone,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','client','http','request','CmContactHasPhone,\x20%s,\x20%s','debug'];(function(_0xd58823,_0x15c483){var _0x249c0a=function(_0x4b8b67){while(--_0x4b8b67){_0xd58823['push'](_0xd58823['shift']());}};_0x249c0a(++_0x15c483);}(_0xa9c0,0x19f));var _0x0a9c=function(_0x286c23,_0x55b89d){_0x286c23=_0x286c23-0x0;var _0x3a4027=_0xa9c0[_0x286c23];return _0x3a4027;};'use strict';var _=require('lodash');var util=require(_0x0a9c('0x0'));var moment=require(_0x0a9c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9c('0x3'));var logger=require(_0x0a9c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a9c('0x5')][_0x0a9c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x45ec54,_0x568b35,_0x51f1ff){return new BPromise(function(_0x2e9551,_0x430134){return client[_0x0a9c('0x7')](_0x45ec54,_0x51f1ff)['then'](function(_0x296b9b){logger['info'](_0x0a9c('0x8'),_0x568b35,'request\x20sent');logger[_0x0a9c('0x9')](_0x0a9c('0xa'),_0x568b35,'request\x20sent',JSON['stringify'](_0x296b9b));if(_0x296b9b[_0x0a9c('0xb')]){if(_0x296b9b['error'][_0x0a9c('0xc')]===0x1f4){logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x296b9b['error'][_0x0a9c('0xd')]);return _0x430134(_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);}logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);return _0x2e9551(_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);}else{logger[_0x0a9c('0xe')](_0x0a9c('0x8'),_0x568b35,'request\x20sent');_0x2e9551(_0x296b9b[_0x0a9c('0xf')][_0x0a9c('0xd')]);}})[_0x0a9c('0x10')](function(_0x8066d4){logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x8066d4);_0x430134(_0x8066d4);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 4be0d9b..2cb78db 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 _0xf1bb=['get','isAuthenticated','index','post','put','/:id','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller'];(function(_0x1512f2,_0x9e4a17){var _0x414707=function(_0x17e28d){while(--_0x17e28d){_0x1512f2['push'](_0x1512f2['shift']());}};_0x414707(++_0x9e4a17);}(_0xf1bb,0xb3));var _0xbf1b=function(_0x4e3c7c,_0x2120bb){_0x4e3c7c=_0x4e3c7c-0x0;var _0x43def5=_0xf1bb[_0x4e3c7c];return _0x43def5;};'use strict';var multer=require(_0xbf1b('0x0'));var util=require(_0xbf1b('0x1'));var path=require(_0xbf1b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf1b('0x3'));var router=express[_0xbf1b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbf1b('0x5'));var config=require(_0xbf1b('0x6'));var controller=require(_0xbf1b('0x7'));router[_0xbf1b('0x8')]('/',auth[_0xbf1b('0x9')](),controller[_0xbf1b('0xa')]);router[_0xbf1b('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xbf1b('0xb')]('/',auth[_0xbf1b('0x9')](),controller['create']);router[_0xbf1b('0xc')](_0xbf1b('0xd'),auth[_0xbf1b('0x9')](),controller[_0xbf1b('0xe')]);router[_0xbf1b('0xf')](_0xbf1b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xbf1b('0x10')]=router; \ No newline at end of file +var _0xe1ca=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller'];(function(_0x176b19,_0x2270ca){var _0x1a1ac7=function(_0xda0598){while(--_0xda0598){_0x176b19['push'](_0x176b19['shift']());}};_0x1a1ac7(++_0x2270ca);}(_0xe1ca,0x12b));var _0xae1c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe1ca[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xae1c('0x0'));var util=require(_0xae1c('0x1'));var path=require('path');var timeout=require(_0xae1c('0x2'));var express=require('express');var router=express[_0xae1c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xae1c('0x4'));var config=require(_0xae1c('0x5'));var controller=require(_0xae1c('0x6'));router[_0xae1c('0x7')]('/',auth[_0xae1c('0x8')](),controller[_0xae1c('0x9')]);router[_0xae1c('0x7')](_0xae1c('0xa'),auth[_0xae1c('0x8')](),controller[_0xae1c('0xb')]);router[_0xae1c('0xc')]('/',auth[_0xae1c('0x8')](),controller[_0xae1c('0xd')]);router[_0xae1c('0xe')](_0xae1c('0xa'),auth[_0xae1c('0x8')](),controller[_0xae1c('0xf')]);router['delete'](_0xae1c('0xa'),auth[_0xae1c('0x8')](),controller[_0xae1c('0x10')]);module[_0xae1c('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 71593e5..b962c6a 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 _0x9ea7=['select','parse','values','isArray','stringify','BOOLEAN','lodash','exports','alias','setDataValue','STRING','TEXT','long','getDataValue'];(function(_0x2a9197,_0x5225eb){var _0x588c8a=function(_0x4698ee){while(--_0x4698ee){_0x2a9197['push'](_0x2a9197['shift']());}};_0x588c8a(++_0x5225eb);}(_0x9ea7,0x110));var _0x79ea=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0x9ea7[_0x217c2e];return _0x22b7d8;};'use strict';var Sequelize=require('sequelize');var _=require(_0x79ea('0x0'));module[_0x79ea('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x351e11){return this['getDataValue'](_0x79ea('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x521c9f){this[_0x79ea('0x3')](_0x79ea('0x2'),_0x521c9f?_0x521c9f:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x79ea('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x79ea('0x5')](_0x79ea('0x6')),'get':function(){if(this[_0x79ea('0x7')]('type')===_0x79ea('0x8')){return JSON[_0x79ea('0x9')](this[_0x79ea('0x7')](_0x79ea('0xa')));}else{return this[_0x79ea('0x7')]('values');}},'set':function(_0x6cffdb){if(Array[_0x79ea('0xb')](_0x6cffdb)){this[_0x79ea('0x3')](_0x79ea('0xa'),JSON[_0x79ea('0xc')](_0x6cffdb));}else{this[_0x79ea('0x3')]('values',_0x6cffdb);}}},'required':{'type':Sequelize[_0x79ea('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x0623=['sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','values','stringify'];(function(_0x3af5e2,_0x44e9a){var _0x31c297=function(_0xd590de){while(--_0xd590de){_0x3af5e2['push'](_0x3af5e2['shift']());}};_0x31c297(++_0x44e9a);}(_0x0623,0x145));var _0x3062=function(_0x3edbeb,_0x12e9c9){_0x3edbeb=_0x3edbeb-0x0;var _0x139c27=_0x0623[_0x3edbeb];return _0x139c27;};'use strict';var Sequelize=require(_0x3062('0x0'));var _=require('lodash');module[_0x3062('0x1')]={'name':{'type':Sequelize[_0x3062('0x2')],'get':function(_0x21a7a9){return this[_0x3062('0x3')](_0x3062('0x4'));}},'alias':{'type':Sequelize[_0x3062('0x5')],'allowNull':![],'set':function(_0x347077){this[_0x3062('0x6')](_0x3062('0x4'),_0x347077?_0x347077:this[_0x3062('0x3')](_0x3062('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x3062('0x8')](_0x3062('0x9')),'get':function(){if(this[_0x3062('0x3')](_0x3062('0xa'))==='select'){return JSON['parse'](this[_0x3062('0x3')](_0x3062('0xb')));}else{return this['getDataValue'](_0x3062('0xb'));}},'set':function(_0x2a3e0d){if(Array['isArray'](_0x2a3e0d)){this[_0x3062('0x6')](_0x3062('0xb'),JSON[_0x3062('0xc')](_0x2a3e0d));}else{this[_0x3062('0x6')]('values',_0x2a3e0d);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0f8874f..954036d 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 _0x77b5=['BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','apply','reject','save','update','destroy','then','error','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','fields','attributes','length','nolimit','offset','order','sort','where','merge','filter','options','includeAll','findAll','rows','catch','show','include','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','switch'];(function(_0x319855,_0x55a20d){var _0xfb7f50=function(_0x391c7f){while(--_0x391c7f){_0x319855['push'](_0x319855['shift']());}};_0xfb7f50(++_0x55a20d);}(_0x77b5,0x16f));var _0x577b=function(_0x253d18,_0x414538){_0x253d18=_0x253d18-0x0;var _0x120401=_0x77b5[_0x253d18];return _0x120401;};'use strict';var pdf=require(_0x577b('0x0'));var emlformat=require(_0x577b('0x1'));var rimraf=require(_0x577b('0x2'));var zipdir=require(_0x577b('0x3'));var jsonpatch=require(_0x577b('0x4'));var rp=require('request-promise');var moment=require(_0x577b('0x5'));var BPromise=require(_0x577b('0x6'));var Mustache=require('mustache');var util=require(_0x577b('0x7'));var path=require(_0x577b('0x8'));var sox=require(_0x577b('0x9'));var csv=require(_0x577b('0xa'));var ejs=require(_0x577b('0xb'));var fs=require('fs');var _=require(_0x577b('0xc'));var squel=require(_0x577b('0xd'));var crypto=require(_0x577b('0xe'));var jsforce=require(_0x577b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x577b('0x10'));var Papa=require('papaparse');var Redis=require(_0x577b('0x11'));var authService=require(_0x577b('0x12'));var qs=require(_0x577b('0x13'));var as=require(_0x577b('0x14'));var hardwareService=require(_0x577b('0x15'));var logger=require(_0x577b('0x16'))(_0x577b('0x17'));var utils=require(_0x577b('0x18'));var config=require(_0x577b('0x19'));var db=require(_0x577b('0x1a'))['db'];function respondWithStatusCode(_0x16ce2f,_0x3b1ea6){_0x3b1ea6=_0x3b1ea6||0xcc;return function(_0x46fbb8){if(_0x46fbb8){return _0x16ce2f[_0x577b('0x1b')](_0x3b1ea6);}return _0x16ce2f[_0x577b('0x1c')](_0x3b1ea6)[_0x577b('0x1d')]();};}function respondWithResult(_0xa26945,_0x54d111){_0x54d111=_0x54d111||0xc8;return function(_0x2c5064){if(_0x2c5064){return _0xa26945[_0x577b('0x1c')](_0x54d111)[_0x577b('0x1e')](_0x2c5064);}};}function respondWithFilteredResult(_0x504237,_0x4117dc){return function(_0x35e86d){if(_0x35e86d){var _0xeaa137=_0x35e86d[_0x577b('0x1f')],_0x59d82c=_0x4117dc['offset'],_0x39c3f9=_0x4117dc['offset']+_0x4117dc[_0x577b('0x20')],_0x454e9f;if(_0x39c3f9>=_0xeaa137){_0x39c3f9=_0xeaa137;_0x454e9f=0xc8;}else{_0x454e9f=0xce;}_0x504237['status'](_0x454e9f);return _0x504237['set']('Content-Range',_0x59d82c+'-'+_0x39c3f9+'/'+_0xeaa137)[_0x577b('0x1e')](_0x35e86d);}return null;};}function patchUpdates(_0x497fab){return function(_0x20ab1a){try{jsonpatch[_0x577b('0x21')](_0x20ab1a,_0x497fab,!![]);}catch(_0x29b1ee){return BPromise[_0x577b('0x22')](_0x29b1ee);}return _0x20ab1a[_0x577b('0x23')]();};}function saveUpdates(_0xec96e3,_0x32b8bb){return function(_0x1cc8c7){if(_0x1cc8c7){return _0x1cc8c7[_0x577b('0x24')](_0xec96e3)['then'](function(_0x576c45){return _0x576c45;});}return null;};}function removeEntity(_0x3688ce,_0x5a629a){return function(_0x17741b){if(_0x17741b){return _0x17741b[_0x577b('0x25')]()[_0x577b('0x26')](function(){_0x3688ce[_0x577b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27811e,_0x42a6ec){return function(_0x338bc2){if(!_0x338bc2){_0x27811e[_0x577b('0x1b')](0x194);}return _0x338bc2;};}function handleError(_0x5030c5,_0x6bbb39){_0x6bbb39=_0x6bbb39||0x1f4;return function(_0x52e826){logger[_0x577b('0x27')](_0x52e826['stack']);if(_0x52e826[_0x577b('0x28')]){delete _0x52e826[_0x577b('0x28')];}_0x5030c5[_0x577b('0x1c')](_0x6bbb39)[_0x577b('0x29')](_0x52e826);};}exports[_0x577b('0x2a')]=function(_0x6ac3a3,_0x168e21){var _0x428752={},_0x5c526b={},_0x4dada3={'count':0x0,'rows':[]};var _0x198694=_['map'](db[_0x577b('0x2b')][_0x577b('0x2c')],function(_0x90b416){return{'name':_0x90b416[_0x577b('0x2d')],'type':_0x90b416[_0x577b('0x2e')][_0x577b('0x2f')]};});_0x5c526b[_0x577b('0x30')]=_[_0x577b('0x31')](_[_0x577b('0x32')](_0x198694,_0x577b('0x28')),[_0x577b('0x28')]);_0x5c526b[_0x577b('0x33')]=_[_0x577b('0x34')](_0x6ac3a3[_0x577b('0x33')]);_0x5c526b[_0x577b('0x35')]=_[_0x577b('0x36')](_0x5c526b[_0x577b('0x30')],_0x5c526b[_0x577b('0x33')]);_0x428752['attributes']=_[_0x577b('0x36')](_0x5c526b[_0x577b('0x30')],qs[_0x577b('0x37')](_0x6ac3a3[_0x577b('0x33')]['fields']));_0x428752['attributes']=_0x428752[_0x577b('0x38')][_0x577b('0x39')]?_0x428752['attributes']:_0x5c526b[_0x577b('0x30')];if(!_0x6ac3a3[_0x577b('0x33')]['hasOwnProperty'](_0x577b('0x3a'))){_0x428752[_0x577b('0x20')]=qs[_0x577b('0x20')](_0x6ac3a3[_0x577b('0x33')][_0x577b('0x20')]);_0x428752['offset']=qs['offset'](_0x6ac3a3['query'][_0x577b('0x3b')]);}_0x428752[_0x577b('0x3c')]=qs[_0x577b('0x3d')](_0x6ac3a3[_0x577b('0x33')]['sort']);_0x428752[_0x577b('0x3e')]=qs[_0x577b('0x35')](_['pick'](_0x6ac3a3['query'],_0x5c526b[_0x577b('0x35')]),_0x198694);if(_0x6ac3a3[_0x577b('0x33')]['filter']){_0x428752[_0x577b('0x3e')]=_[_0x577b('0x3f')](_0x428752[_0x577b('0x3e')],{'$or':_[_0x577b('0x32')](_0x198694,function(_0x31b5e2){if(_0x31b5e2[_0x577b('0x2e')]!=='VIRTUAL'){var _0x40bc17={};_0x40bc17[_0x31b5e2[_0x577b('0x28')]]={'$like':'%'+_0x6ac3a3['query'][_0x577b('0x40')]+'%'};return _0x40bc17;}})});}_0x428752=_[_0x577b('0x3f')]({},_0x428752,_0x6ac3a3[_0x577b('0x41')]);var _0x30e52a={'where':_0x428752[_0x577b('0x3e')]};return db[_0x577b('0x2b')][_0x577b('0x1f')](_0x30e52a)[_0x577b('0x26')](function(_0x37bf75){_0x4dada3[_0x577b('0x1f')]=_0x37bf75;if(_0x6ac3a3['query'][_0x577b('0x42')]){_0x428752['include']=[{'all':!![]}];}return db[_0x577b('0x2b')][_0x577b('0x43')](_0x428752);})[_0x577b('0x26')](function(_0x823469){_0x4dada3[_0x577b('0x44')]=_0x823469;return _0x4dada3;})['then'](respondWithFilteredResult(_0x168e21,_0x428752))[_0x577b('0x45')](handleError(_0x168e21,null));};exports[_0x577b('0x46')]=function(_0x503838,_0x1f86b7){var _0x2ecc01={'raw':!![],'where':{'id':_0x503838['params']['id']}},_0x59d2ac={};_0x59d2ac[_0x577b('0x30')]=_[_0x577b('0x34')](db[_0x577b('0x2b')]['rawAttributes']);_0x59d2ac[_0x577b('0x33')]=_[_0x577b('0x34')](_0x503838[_0x577b('0x33')]);_0x59d2ac[_0x577b('0x35')]=_[_0x577b('0x36')](_0x59d2ac[_0x577b('0x30')],_0x59d2ac[_0x577b('0x33')]);_0x2ecc01[_0x577b('0x38')]=_[_0x577b('0x36')](_0x59d2ac[_0x577b('0x30')],qs[_0x577b('0x37')](_0x503838[_0x577b('0x33')][_0x577b('0x37')]));_0x2ecc01['attributes']=_0x2ecc01[_0x577b('0x38')][_0x577b('0x39')]?_0x2ecc01[_0x577b('0x38')]:_0x59d2ac['model'];if(_0x503838[_0x577b('0x33')][_0x577b('0x42')]){_0x2ecc01[_0x577b('0x47')]=[{'all':!![]}];}_0x2ecc01=_[_0x577b('0x3f')]({},_0x2ecc01,_0x503838[_0x577b('0x41')]);return db[_0x577b('0x2b')][_0x577b('0x48')](_0x2ecc01)[_0x577b('0x26')](handleEntityNotFound(_0x1f86b7,null))[_0x577b('0x26')](respondWithResult(_0x1f86b7,null))[_0x577b('0x45')](handleError(_0x1f86b7,null));};exports[_0x577b('0x24')]=function(_0x2d4091,_0x6b7d1b){if(_0x2d4091[_0x577b('0x49')]['id']){delete _0x2d4091[_0x577b('0x49')]['id'];}return db['CmCustomField'][_0x577b('0x48')]({'where':{'id':_0x2d4091[_0x577b('0x4a')]['id']}})[_0x577b('0x26')](handleEntityNotFound(_0x6b7d1b,null))[_0x577b('0x26')](saveUpdates(_0x2d4091[_0x577b('0x49')],null))[_0x577b('0x26')](respondWithResult(_0x6b7d1b,null))['catch'](handleError(_0x6b7d1b,null));};exports[_0x577b('0x25')]=function(_0x2e2437,_0x11ff55){return db[_0x577b('0x2b')][_0x577b('0x48')]({'where':{'id':_0x2e2437[_0x577b('0x4a')]['id']}})[_0x577b('0x26')](handleEntityNotFound(_0x11ff55,null))[_0x577b('0x26')](removeEntity(_0x11ff55,null))[_0x577b('0x45')](handleError(_0x11ff55,null));};exports[_0x577b('0x4b')]=function(_0x19cba4,_0xa8dde4){var _0x22e27b;return db[_0x577b('0x4c')][_0x577b('0x4d')](function(_0x4c06e8){return db['CmCustomField'][_0x577b('0x4b')](_0x19cba4[_0x577b('0x49')],{'transaction':_0x4c06e8})[_0x577b('0x26')](function(_0x52b4fd){_0x22e27b=_0x52b4fd;var _0x15ec99={'type':db[_0x577b('0x4e')][_0x577b('0x4f')],'transaction':_0x4c06e8};switch(_0x19cba4['body'][_0x577b('0x2e')]){case _0x577b('0x50'):_0x15ec99[_0x577b('0x2e')]=db[_0x577b('0x4e')][_0x577b('0x4f')];break;case _0x577b('0x51'):_0x15ec99[_0x577b('0x2e')]=db[_0x577b('0x4e')]['INTEGER'];break;case _0x577b('0x52'):_0x15ec99['type']=db[_0x577b('0x4e')][_0x577b('0x53')];_0x15ec99[_0x577b('0x54')]=![];break;default:}return db['sequelize'][_0x577b('0x55')][_0x577b('0x56')](_0x577b('0x57'),util[_0x577b('0x58')](_0x577b('0x59'),_0x22e27b['id']),_0x15ec99);})['then'](function(){return _0x22e27b;});})['then'](respondWithResult(_0xa8dde4,0xc9))[_0x577b('0x45')](handleError(_0xa8dde4,null));}; \ No newline at end of file +var _0x1083=['ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','differenceBy','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','CmCustomField','includeAll','findAll','catch','show','include','find','body','params','create','Sequelize','TEXT','type','text','INTEGER','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv'];(function(_0x452286,_0x4726da){var _0x2e6556=function(_0x4bb077){while(--_0x4bb077){_0x452286['push'](_0x452286['shift']());}};_0x2e6556(++_0x4726da);}(_0x1083,0x19b));var _0x3108=function(_0x14ea70,_0xb97bbd){_0x14ea70=_0x14ea70-0x0;var _0x1dbaff=_0x1083[_0x14ea70];return _0x1dbaff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3108('0x0'));var rimraf=require(_0x3108('0x1'));var zipdir=require(_0x3108('0x2'));var jsonpatch=require(_0x3108('0x3'));var rp=require(_0x3108('0x4'));var moment=require(_0x3108('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3108('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3108('0x7'));var csv=require(_0x3108('0x8'));var ejs=require(_0x3108('0x9'));var fs=require('fs');var _=require(_0x3108('0xa'));var squel=require(_0x3108('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3108('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3108('0xd'));var Papa=require(_0x3108('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3108('0xf'));var as=require(_0x3108('0x10'));var hardwareService=require(_0x3108('0x11'));var logger=require(_0x3108('0x12'))('api');var utils=require(_0x3108('0x13'));var config=require(_0x3108('0x14'));var db=require(_0x3108('0x15'))['db'];function respondWithStatusCode(_0x1a6622,_0xfc25e1){_0xfc25e1=_0xfc25e1||0xcc;return function(_0x2f15b9){if(_0x2f15b9){return _0x1a6622['sendStatus'](_0xfc25e1);}return _0x1a6622['status'](_0xfc25e1)[_0x3108('0x16')]();};}function respondWithResult(_0x2f33d0,_0x45a7a1){_0x45a7a1=_0x45a7a1||0xc8;return function(_0x30ad78){if(_0x30ad78){return _0x2f33d0[_0x3108('0x17')](_0x45a7a1)[_0x3108('0x18')](_0x30ad78);}};}function respondWithFilteredResult(_0x438531,_0x31d3db){return function(_0x5ed45e){if(_0x5ed45e){var _0x2db071=_0x5ed45e[_0x3108('0x19')],_0x357695=_0x31d3db[_0x3108('0x1a')],_0x14e2af=_0x31d3db[_0x3108('0x1a')]+_0x31d3db[_0x3108('0x1b')],_0xa49ea7;if(_0x14e2af>=_0x2db071){_0x14e2af=_0x2db071;_0xa49ea7=0xc8;}else{_0xa49ea7=0xce;}_0x438531[_0x3108('0x17')](_0xa49ea7);return _0x438531[_0x3108('0x1c')](_0x3108('0x1d'),_0x357695+'-'+_0x14e2af+'/'+_0x2db071)[_0x3108('0x18')](_0x5ed45e);}return null;};}function patchUpdates(_0x28b4e8){return function(_0x55a06e){try{jsonpatch['apply'](_0x55a06e,_0x28b4e8,!![]);}catch(_0x125f87){return BPromise['reject'](_0x125f87);}return _0x55a06e[_0x3108('0x1e')]();};}function saveUpdates(_0x4000a2,_0x2abc1c){return function(_0x2a4fbe){if(_0x2a4fbe){return _0x2a4fbe[_0x3108('0x1f')](_0x4000a2)['then'](function(_0x20a0d5){return _0x20a0d5;});}return null;};}function removeEntity(_0x519140,_0x241230){return function(_0x4d7ee2){if(_0x4d7ee2){return _0x4d7ee2[_0x3108('0x20')]()[_0x3108('0x21')](function(){_0x519140[_0x3108('0x17')](0xcc)[_0x3108('0x16')]();});}};}function handleEntityNotFound(_0x3c3230,_0x5c1628){return function(_0x1d2149){if(!_0x1d2149){_0x3c3230[_0x3108('0x22')](0x194);}return _0x1d2149;};}function handleError(_0x38e58d,_0x3df812){_0x3df812=_0x3df812||0x1f4;return function(_0x3ef26b){logger[_0x3108('0x23')](_0x3ef26b[_0x3108('0x24')]);if(_0x3ef26b[_0x3108('0x25')]){delete _0x3ef26b[_0x3108('0x25')];}_0x38e58d[_0x3108('0x17')](_0x3df812)[_0x3108('0x26')](_0x3ef26b);};}exports[_0x3108('0x27')]=function(_0x18ebd3,_0x2da18f){var _0x2caf60={},_0xddb697={},_0x135fbc={'count':0x0,'rows':[]};var _0x58bf51=_[_0x3108('0x28')](db['CmCustomField'][_0x3108('0x29')],function(_0x5b9f3c){return{'name':_0x5b9f3c[_0x3108('0x2a')],'type':_0x5b9f3c['type']['key']};});_0xddb697[_0x3108('0x2b')]=_[_0x3108('0x2c')](_[_0x3108('0x28')](_0x58bf51,'name'),[_0x3108('0x25')]);_0xddb697['query']=_[_0x3108('0x2d')](_0x18ebd3['query']);_0xddb697[_0x3108('0x2e')]=_[_0x3108('0x2f')](_0xddb697['model'],_0xddb697[_0x3108('0x30')]);_0x2caf60[_0x3108('0x31')]=_[_0x3108('0x2f')](_0xddb697[_0x3108('0x2b')],qs[_0x3108('0x32')](_0x18ebd3['query']['fields']));_0x2caf60[_0x3108('0x31')]=_0x2caf60[_0x3108('0x31')][_0x3108('0x33')]?_0x2caf60['attributes']:_0xddb697[_0x3108('0x2b')];if(!_0x18ebd3[_0x3108('0x30')]['hasOwnProperty'](_0x3108('0x34'))){_0x2caf60[_0x3108('0x1b')]=qs[_0x3108('0x1b')](_0x18ebd3[_0x3108('0x30')][_0x3108('0x1b')]);_0x2caf60[_0x3108('0x1a')]=qs['offset'](_0x18ebd3[_0x3108('0x30')][_0x3108('0x1a')]);}_0x2caf60[_0x3108('0x35')]=qs[_0x3108('0x36')](_0x18ebd3['query'][_0x3108('0x36')]);_0x2caf60['where']=qs['filters'](_[_0x3108('0x37')](_0x18ebd3[_0x3108('0x30')],_0xddb697[_0x3108('0x2e')]),_0x58bf51);if(_0x18ebd3[_0x3108('0x30')][_0x3108('0x38')]){_0x2caf60[_0x3108('0x39')]=_[_0x3108('0x3a')](_0x2caf60['where'],{'$or':_[_0x3108('0x28')](_0x58bf51,function(_0x476b4f){if(_0x476b4f['type']!==_0x3108('0x3b')){var _0xd2ded={};_0xd2ded[_0x476b4f['name']]={'$like':'%'+_0x18ebd3[_0x3108('0x30')][_0x3108('0x38')]+'%'};return _0xd2ded;}})});}_0x2caf60=_['merge']({},_0x2caf60,_0x18ebd3[_0x3108('0x3c')]);var _0x50e4bd={'where':_0x2caf60[_0x3108('0x39')]};return db[_0x3108('0x3d')][_0x3108('0x19')](_0x50e4bd)[_0x3108('0x21')](function(_0x35492c){_0x135fbc[_0x3108('0x19')]=_0x35492c;if(_0x18ebd3[_0x3108('0x30')][_0x3108('0x3e')]){_0x2caf60['include']=[{'all':!![]}];}return db[_0x3108('0x3d')][_0x3108('0x3f')](_0x2caf60);})[_0x3108('0x21')](function(_0x322732){_0x135fbc['rows']=_0x322732;return _0x135fbc;})['then'](respondWithFilteredResult(_0x2da18f,_0x2caf60))[_0x3108('0x40')](handleError(_0x2da18f,null));};exports[_0x3108('0x41')]=function(_0x3a6bb4,_0x3b101f){var _0x1667c6={'raw':!![],'where':{'id':_0x3a6bb4['params']['id']}},_0x10cf0e={};_0x10cf0e[_0x3108('0x2b')]=_['keys'](db[_0x3108('0x3d')][_0x3108('0x29')]);_0x10cf0e[_0x3108('0x30')]=_[_0x3108('0x2d')](_0x3a6bb4[_0x3108('0x30')]);_0x10cf0e[_0x3108('0x2e')]=_['intersection'](_0x10cf0e['model'],_0x10cf0e[_0x3108('0x30')]);_0x1667c6[_0x3108('0x31')]=_['intersection'](_0x10cf0e[_0x3108('0x2b')],qs[_0x3108('0x32')](_0x3a6bb4['query'][_0x3108('0x32')]));_0x1667c6[_0x3108('0x31')]=_0x1667c6[_0x3108('0x31')][_0x3108('0x33')]?_0x1667c6[_0x3108('0x31')]:_0x10cf0e[_0x3108('0x2b')];if(_0x3a6bb4[_0x3108('0x30')][_0x3108('0x3e')]){_0x1667c6[_0x3108('0x42')]=[{'all':!![]}];}_0x1667c6=_[_0x3108('0x3a')]({},_0x1667c6,_0x3a6bb4[_0x3108('0x3c')]);return db['CmCustomField'][_0x3108('0x43')](_0x1667c6)[_0x3108('0x21')](handleEntityNotFound(_0x3b101f,null))[_0x3108('0x21')](respondWithResult(_0x3b101f,null))[_0x3108('0x40')](handleError(_0x3b101f,null));};exports['update']=function(_0x413ca0,_0x5234d9){if(_0x413ca0[_0x3108('0x44')]['id']){delete _0x413ca0[_0x3108('0x44')]['id'];}return db[_0x3108('0x3d')][_0x3108('0x43')]({'where':{'id':_0x413ca0['params']['id']}})[_0x3108('0x21')](handleEntityNotFound(_0x5234d9,null))[_0x3108('0x21')](saveUpdates(_0x413ca0[_0x3108('0x44')],null))[_0x3108('0x21')](respondWithResult(_0x5234d9,null))[_0x3108('0x40')](handleError(_0x5234d9,null));};exports['destroy']=function(_0x36b22b,_0x402100){return db[_0x3108('0x3d')][_0x3108('0x43')]({'where':{'id':_0x36b22b[_0x3108('0x45')]['id']}})[_0x3108('0x21')](handleEntityNotFound(_0x402100,null))[_0x3108('0x21')](removeEntity(_0x402100,null))[_0x3108('0x40')](handleError(_0x402100,null));};exports[_0x3108('0x46')]=function(_0x421cb0,_0x14f74d){var _0x503f48;return db['sequelize']['transaction'](function(_0x53524a){return db[_0x3108('0x3d')]['create'](_0x421cb0['body'],{'transaction':_0x53524a})['then'](function(_0x3221bf){_0x503f48=_0x3221bf;var _0x47a3db={'type':db[_0x3108('0x47')][_0x3108('0x48')],'transaction':_0x53524a};switch(_0x421cb0[_0x3108('0x44')][_0x3108('0x49')]){case _0x3108('0x4a'):_0x47a3db[_0x3108('0x49')]=db['Sequelize'][_0x3108('0x48')];break;case'number':_0x47a3db[_0x3108('0x49')]=db[_0x3108('0x47')][_0x3108('0x4b')];break;case _0x3108('0x4c'):_0x47a3db['type']=db[_0x3108('0x47')][_0x3108('0x4d')];_0x47a3db['defaultValue']=![];break;default:}return db[_0x3108('0x4e')][_0x3108('0x4f')][_0x3108('0x50')](_0x3108('0x51'),util[_0x3108('0x52')](_0x3108('0x53'),_0x503f48['id']),_0x47a3db);})['then'](function(){return _0x503f48;});})[_0x3108('0x21')](respondWithResult(_0x14f74d,0xc9))['catch'](handleError(_0x14f74d,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 108cb9b..9b3e894 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 _0xd23d=['bluebird','request-promise','./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','../../config/logger','api','moment'];(function(_0x5e794f,_0x4168b2){var _0x521552=function(_0xfb51eb){while(--_0xfb51eb){_0x5e794f['push'](_0x5e794f['shift']());}};_0x521552(++_0x4168b2);}(_0xd23d,0xa0));var _0xdd23=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0xd23d[_0x33080e];return _0x407395;};'use strict';var _=require(_0xdd23('0x0'));var util=require(_0xdd23('0x1'));var logger=require(_0xdd23('0x2'))(_0xdd23('0x3'));var moment=require(_0xdd23('0x4'));var BPromise=require(_0xdd23('0x5'));var rp=require(_0xdd23('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdd23('0x7'));module[_0xdd23('0x8')]=function(_0x7232e8,_0xa5bdac){return _0x7232e8[_0xdd23('0x9')](_0xdd23('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0137=['./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x0137,0x1d8));var _0x7013=function(_0x486eff,_0x5cb3b0){_0x486eff=_0x486eff-0x0;var _0x95293b=_0x0137[_0x486eff];return _0x95293b;};'use strict';var _=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var logger=require(_0x7013('0x2'))(_0x7013('0x3'));var moment=require(_0x7013('0x4'));var BPromise=require('bluebird');var rp=require(_0x7013('0x5'));var fs=require('fs');var path=require(_0x7013('0x6'));var rimraf=require(_0x7013('0x7'));var config=require(_0x7013('0x8'));var attributes=require(_0x7013('0x9'));module[_0x7013('0xa')]=function(_0x50b822,_0x24cb85){return _0x50b822[_0x7013('0xb')]('CmCustomField',attributes,{'tableName':_0x7013('0xc'),'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 02daea8..1842a21 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 _0xb903=['http','request','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','CmCustomField,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b93c5,_0x393266){var _0x1cfab5=function(_0x58c905){while(--_0x58c905){_0x1b93c5['push'](_0x1b93c5['shift']());}};_0x1cfab5(++_0x393266);}(_0xb903,0x185));var _0x3b90=function(_0x2fa7b1,_0x4e906d){_0x2fa7b1=_0x2fa7b1-0x0;var _0x26172d=_0xb903[_0x2fa7b1];return _0x26172d;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('CmCustomField,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file +var _0x579c=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x29c6fa,_0x2772bf){var _0x50a582=function(_0x4e3c55){while(--_0x4e3c55){_0x29c6fa['push'](_0x29c6fa['shift']());}};_0x50a582(++_0x2772bf);}(_0x579c,0xda));var _0xc579=function(_0x5240b8,_0x5ecbfa){_0x5240b8=_0x5240b8-0x0;var _0x5d0ff5=_0x579c[_0x5240b8];return _0x5d0ff5;};'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);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4caa966..f4b2c4a 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 _0x6df9=['/:id','update','multer','util','connect-timeout','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','put'];(function(_0x84a85,_0x54e55c){var _0x1c2943=function(_0x99a250){while(--_0x99a250){_0x84a85['push'](_0x84a85['shift']());}};_0x1c2943(++_0x54e55c);}(_0x6df9,0x84));var _0x96df=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6df9[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x96df('0x0'));var util=require(_0x96df('0x1'));var path=require('path');var timeout=require(_0x96df('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x96df('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x96df('0x4'));var controller=require('./cmCustomField.controller');router[_0x96df('0x5')]('/',auth['isAuthenticated'](),controller[_0x96df('0x6')]);router[_0x96df('0x5')]('/:id',auth[_0x96df('0x7')](),controller[_0x96df('0x8')]);router[_0x96df('0x9')]('/',auth[_0x96df('0x7')](),controller['create']);router[_0x96df('0xa')](_0x96df('0xb'),auth['isAuthenticated'](),controller[_0x96df('0xc')]);router['delete'](_0x96df('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x326b=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','get'];(function(_0x2f6a03,_0x39377b){var _0x307eff=function(_0x2c4edd){while(--_0x2c4edd){_0x2f6a03['push'](_0x2f6a03['shift']());}};_0x307eff(++_0x39377b);}(_0x326b,0x1dc));var _0xb326=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0x326b[_0x556634];return _0x4429fd;};'use strict';var multer=require(_0xb326('0x0'));var util=require(_0xb326('0x1'));var path=require(_0xb326('0x2'));var timeout=require(_0xb326('0x3'));var express=require(_0xb326('0x4'));var router=express[_0xb326('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb326('0x6'));var config=require('../../config/environment');var controller=require(_0xb326('0x7'));router['get']('/',auth[_0xb326('0x8')](),controller['index']);router[_0xb326('0x9')](_0xb326('0xa'),auth[_0xb326('0x8')](),controller[_0xb326('0xb')]);router[_0xb326('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb326('0xd')](_0xb326('0xa'),auth[_0xb326('0x8')](),controller[_0xb326('0xe')]);router[_0xb326('0xf')](_0xb326('0xa'),auth[_0xb326('0x8')](),controller[_0xb326('0x10')]);module[_0xb326('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 8cb7f6b..1f374a4 100644 --- a/server/api/cmHopper/cmHopper.attributes.js +++ b/server/api/cmHopper/cmHopper.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x167e60,_0x5ce9d7){var _0x53ef7c=function(_0x442e2b){while(--_0x442e2b){_0x167e60['push'](_0x167e60['shift']());}};_0x53ef7c(++_0x5ce9d7);}(_0x5fab,0x177));var _0xb5fa=function(_0x371b64,_0x67b4bb){_0x371b64=_0x371b64-0x0;var _0x3cf3b1=_0x5fab[_0x371b64];return _0x3cf3b1;};'use strict';var moment=require(_0xb5fa('0x0'));var Sequelize=require(_0xb5fa('0x1'));module['exports']={'phone':{'type':Sequelize[_0xb5fa('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb5fa('0x4')],'defaultValue':moment()[_0xb5fa('0x5')](_0xb5fa('0x6'))},'countbusyretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb5fa('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xb5fa('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb5fa('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb5fa('0x7')],'unique':_0xb5fa('0x9')},'UserId':{'type':Sequelize[_0xb5fa('0x7')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xb5fa('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb5fa('0x7')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb5fa('0x2')]}}; \ No newline at end of file +var _0xc6ac=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4cab58,_0x2119a0){_0x4cab58=_0x4cab58-0x0;var _0x1fe4b4=_0xc6ac[_0x4cab58];return _0x1fe4b4;};'use strict';var moment=require(_0xcc6a('0x0'));var Sequelize=require(_0xcc6a('0x1'));module[_0xcc6a('0x2')]={'phone':{'type':Sequelize[_0xcc6a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xcc6a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xcc6a('0x5')],'defaultValue':moment()[_0xcc6a('0x6')](_0xcc6a('0x7'))},'countbusyretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xcc6a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcc6a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcc6a('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xcc6a('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xcc6a('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xcc6a('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xcc6a('0x8')],'unique':_0xcc6a('0xa')},'UserId':{'type':Sequelize[_0xcc6a('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xcc6a('0x8')],'unique':_0xcc6a('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcc6a('0x8')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xcc6a('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index f558872..61ca363 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 _0xa4a6=['merge','includeAll','include','findAll','rows','show','keys','length','options','find','catch','create','update','body','params','describe','destroy','VoiceQueueId','CampaignId','omit','dataValues','createdAt','campaign','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','getVoiceQueues','outbound','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','preview','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','push','utcOffset','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','then','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','filters','intersection','model','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notILike','$overlap','$contains','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x7b1ac1,_0x357625){var _0x290df3=function(_0x1798f2){while(--_0x1798f2){_0x7b1ac1['push'](_0x7b1ac1['shift']());}};_0x290df3(++_0x357625);}(_0xa4a6,0xdf));var _0x6a4a=function(_0x4ffe46,_0x3d3b54){_0x4ffe46=_0x4ffe46-0x0;var _0x1467ef=_0xa4a6[_0x4ffe46];return _0x1467ef;};'use strict';var pdf=require(_0x6a4a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6a4a('0x1'));var zipdir=require(_0x6a4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a4a('0x3'));var moment=require(_0x6a4a('0x4'));var BPromise=require(_0x6a4a('0x5'));var Mustache=require(_0x6a4a('0x6'));var util=require('util');var path=require(_0x6a4a('0x7'));var sox=require(_0x6a4a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6a4a('0x9'));var squel=require(_0x6a4a('0xa'));var crypto=require(_0x6a4a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6a4a('0xc'));var querystring=require(_0x6a4a('0xd'));var Papa=require(_0x6a4a('0xe'));var Redis=require(_0x6a4a('0xf'));var shared=require(_0x6a4a('0x10'));var authService=require(_0x6a4a('0x11'));var qs=require(_0x6a4a('0x12'));var as=require(_0x6a4a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a4a('0x14'))(_0x6a4a('0x15'));var utils=require(_0x6a4a('0x16'));var config=require('../../config/environment');var db=require(_0x6a4a('0x17'))['db'];function respondWithStatusCode(_0x40fa77,_0x5a505c){_0x5a505c=_0x5a505c||0xcc;return function(_0x1b427b){if(_0x1b427b){return _0x40fa77[_0x6a4a('0x18')](_0x5a505c);}return _0x40fa77['status'](_0x5a505c)['end']();};}function respondWithResult(_0x3ffc92,_0x11c03f){_0x11c03f=_0x11c03f||0xc8;return function(_0x3e6648){if(_0x3e6648){return _0x3ffc92[_0x6a4a('0x19')](_0x11c03f)[_0x6a4a('0x1a')](_0x3e6648);}};}function respondWithFilteredResult(_0x27ecce,_0x13785a){return function(_0x4ab020){if(_0x4ab020){var _0x15bec7=_0x4ab020[_0x6a4a('0x1b')],_0x60e4bc=_0x13785a[_0x6a4a('0x1c')],_0x13d7ba=_0x13785a[_0x6a4a('0x1c')]+_0x13785a[_0x6a4a('0x1d')],_0x1baec5;if(_0x13d7ba>=_0x15bec7){_0x13d7ba=_0x15bec7;_0x1baec5=0xc8;}else{_0x1baec5=0xce;}_0x27ecce['status'](_0x1baec5);return _0x27ecce[_0x6a4a('0x1e')](_0x6a4a('0x1f'),_0x60e4bc+'-'+_0x13d7ba+'/'+_0x15bec7)[_0x6a4a('0x1a')](_0x4ab020);}return null;};}function patchUpdates(_0x5bd4c5){return function(_0x37561b){try{jsonpatch['apply'](_0x37561b,_0x5bd4c5,!![]);}catch(_0x4a9c58){return BPromise[_0x6a4a('0x20')](_0x4a9c58);}return _0x37561b['save']();};}function saveUpdates(_0x468684,_0x12e012){return function(_0x3fdc35){if(_0x3fdc35){return _0x3fdc35['update'](_0x468684)[_0x6a4a('0x21')](function(_0x4f2031){return _0x4f2031;});}return null;};}function removeEntity(_0x1d7ca5,_0x5d9f0b){return function(_0x11dd4c){if(_0x11dd4c){return _0x11dd4c['destroy']()[_0x6a4a('0x21')](function(){_0x1d7ca5[_0x6a4a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5459d7,_0x3ad9c3){return function(_0x1baf49){if(!_0x1baf49){_0x5459d7[_0x6a4a('0x18')](0x194);}return _0x1baf49;};}function handleError(_0x2143fe,_0x1bca6b){_0x1bca6b=_0x1bca6b||0x1f4;return function(_0x5a64ff){logger[_0x6a4a('0x22')](_0x5a64ff[_0x6a4a('0x23')]);if(_0x5a64ff[_0x6a4a('0x24')]){delete _0x5a64ff['name'];}_0x2143fe[_0x6a4a('0x19')](_0x1bca6b)[_0x6a4a('0x25')](_0x5a64ff);};}exports[_0x6a4a('0x26')]=function(_0x39721c,_0x2b20c5){var _0x21a1f3={},_0x1a0c7a={},_0x47b226={'count':0x0,'rows':[]};var _0x44e6b8=_[_0x6a4a('0x27')](db[_0x6a4a('0x28')][_0x6a4a('0x29')],function(_0x564d6c){return{'name':_0x564d6c[_0x6a4a('0x2a')],'type':_0x564d6c[_0x6a4a('0x2b')][_0x6a4a('0x2c')]};});_0x1a0c7a['model']=_[_0x6a4a('0x27')](_0x44e6b8,_0x6a4a('0x24'));_0x1a0c7a['query']=_['keys'](_0x39721c[_0x6a4a('0x2d')]);_0x1a0c7a[_0x6a4a('0x2e')]=_[_0x6a4a('0x2f')](_0x1a0c7a[_0x6a4a('0x30')],_0x1a0c7a[_0x6a4a('0x2d')]);_0x1a0c7a[_0x6a4a('0x2e')]=_[_0x6a4a('0x31')](_0x1a0c7a[_0x6a4a('0x2e')],[_0x6a4a('0x32'),_0x6a4a('0x33'),_0x6a4a('0x34'),_0x6a4a('0x35'),_0x6a4a('0x36'),_0x6a4a('0x37'),_0x6a4a('0x38'),_0x6a4a('0x39'),'$not',_0x6a4a('0x3a'),_0x6a4a('0x3b'),_0x6a4a('0x3c'),_0x6a4a('0x3d'),_0x6a4a('0x3e'),'$notLike','$iLike',_0x6a4a('0x3f'),_0x6a4a('0x3e'),_0x6a4a('0x40'),_0x6a4a('0x41'),'$contained',_0x6a4a('0x42')]);_0x21a1f3[_0x6a4a('0x43')]=_['intersection'](_0x1a0c7a[_0x6a4a('0x30')],qs[_0x6a4a('0x44')](_0x39721c[_0x6a4a('0x2d')][_0x6a4a('0x44')]));_0x21a1f3[_0x6a4a('0x43')]=_0x21a1f3[_0x6a4a('0x43')]['length']?_0x21a1f3[_0x6a4a('0x43')]:_0x1a0c7a['model'];if(!_0x39721c[_0x6a4a('0x2d')][_0x6a4a('0x45')](_0x6a4a('0x46'))){_0x21a1f3[_0x6a4a('0x1d')]=qs[_0x6a4a('0x1d')](_0x39721c[_0x6a4a('0x2d')][_0x6a4a('0x1d')]);_0x21a1f3[_0x6a4a('0x1c')]=qs['offset'](_0x39721c[_0x6a4a('0x2d')]['offset']);}_0x21a1f3[_0x6a4a('0x47')]=qs[_0x6a4a('0x48')](_0x39721c[_0x6a4a('0x2d')][_0x6a4a('0x48')]);_0x21a1f3['where']=qs['filters'](_['pick'](_0x39721c[_0x6a4a('0x2d')],_0x1a0c7a[_0x6a4a('0x2e')]),_0x44e6b8);if(_0x39721c[_0x6a4a('0x2d')][_0x6a4a('0x49')]){_0x21a1f3[_0x6a4a('0x4a')]=_[_0x6a4a('0x4b')](_0x21a1f3[_0x6a4a('0x4a')],{'$or':_[_0x6a4a('0x27')](_0x44e6b8,function(_0x44a928){if(_0x44a928[_0x6a4a('0x2b')]!=='VIRTUAL'){var _0x40f5b4={};_0x40f5b4[_0x44a928[_0x6a4a('0x24')]]={'$like':'%'+_0x39721c['query'][_0x6a4a('0x49')]+'%'};return _0x40f5b4;}})});}_0x21a1f3=_[_0x6a4a('0x4b')]({},_0x21a1f3,_0x39721c['options']);var _0x5ac6cf={'where':_0x21a1f3[_0x6a4a('0x4a')]};return db[_0x6a4a('0x28')]['count'](_0x5ac6cf)['then'](function(_0x28f7cc){_0x47b226[_0x6a4a('0x1b')]=_0x28f7cc;if(_0x39721c[_0x6a4a('0x2d')][_0x6a4a('0x4c')]){_0x21a1f3[_0x6a4a('0x4d')]=[{'all':!![]}];}return db[_0x6a4a('0x28')][_0x6a4a('0x4e')](_0x21a1f3);})[_0x6a4a('0x21')](function(_0xfd24){_0x47b226[_0x6a4a('0x4f')]=_0xfd24;return _0x47b226;})['then'](respondWithFilteredResult(_0x2b20c5,_0x21a1f3))['catch'](handleError(_0x2b20c5,null));};exports[_0x6a4a('0x50')]=function(_0x2277fb,_0x4e811e){var _0x44a0f4={'raw':!![],'where':{'id':_0x2277fb['params']['id']}},_0x494aa1={};_0x494aa1[_0x6a4a('0x30')]=_[_0x6a4a('0x51')](db[_0x6a4a('0x28')][_0x6a4a('0x29')]);_0x494aa1[_0x6a4a('0x2d')]=_[_0x6a4a('0x51')](_0x2277fb[_0x6a4a('0x2d')]);_0x494aa1[_0x6a4a('0x2e')]=_[_0x6a4a('0x2f')](_0x494aa1[_0x6a4a('0x30')],_0x494aa1['query']);_0x44a0f4['attributes']=_['intersection'](_0x494aa1[_0x6a4a('0x30')],qs[_0x6a4a('0x44')](_0x2277fb[_0x6a4a('0x2d')][_0x6a4a('0x44')]));_0x44a0f4[_0x6a4a('0x43')]=_0x44a0f4[_0x6a4a('0x43')][_0x6a4a('0x52')]?_0x44a0f4[_0x6a4a('0x43')]:_0x494aa1[_0x6a4a('0x30')];if(_0x2277fb[_0x6a4a('0x2d')][_0x6a4a('0x4c')]){_0x44a0f4[_0x6a4a('0x4d')]=[{'all':!![]}];}_0x44a0f4=_[_0x6a4a('0x4b')]({},_0x44a0f4,_0x2277fb[_0x6a4a('0x53')]);return db[_0x6a4a('0x28')][_0x6a4a('0x54')](_0x44a0f4)['then'](handleEntityNotFound(_0x4e811e,null))[_0x6a4a('0x21')](respondWithResult(_0x4e811e,null))[_0x6a4a('0x55')](handleError(_0x4e811e,null));};exports[_0x6a4a('0x56')]=function(_0x6a50c9,_0x108212){return db['CmHopper'][_0x6a4a('0x56')](_0x6a50c9['body'],{})[_0x6a4a('0x21')](respondWithResult(_0x108212,0xc9))[_0x6a4a('0x55')](handleError(_0x108212,null));};exports[_0x6a4a('0x57')]=function(_0x2653d5,_0x20b0d9){if(_0x2653d5[_0x6a4a('0x58')]['id']){delete _0x2653d5['body']['id'];}return db[_0x6a4a('0x28')]['find']({'where':{'id':_0x2653d5[_0x6a4a('0x59')]['id']}})[_0x6a4a('0x21')](handleEntityNotFound(_0x20b0d9,null))[_0x6a4a('0x21')](saveUpdates(_0x2653d5[_0x6a4a('0x58')],null))[_0x6a4a('0x21')](respondWithResult(_0x20b0d9,null))[_0x6a4a('0x55')](handleError(_0x20b0d9,null));};exports[_0x6a4a('0x5a')]=function(_0x47417d,_0x3ccebc){return db[_0x6a4a('0x28')]['describe']()['then'](respondWithResult(_0x3ccebc,null))[_0x6a4a('0x55')](handleError(_0x3ccebc,null));};exports[_0x6a4a('0x5b')]=function(_0x389ac1,_0x29bb58){var _0x5d8539;return db['CmHopper'][_0x6a4a('0x54')]({'where':{'id':_0x389ac1['params']['id']}})['then'](handleEntityNotFound(_0x29bb58,null))[_0x6a4a('0x21')](function(_0x41e791){if(_0x41e791){return _0x41e791[_0x6a4a('0x5b')]()[_0x6a4a('0x21')](function(_0x55c390){return _0x55c390;});}})['then'](function(_0x48e4d5){_0x5d8539=_0x48e4d5;if(_0x48e4d5){if(_0x48e4d5[_0x6a4a('0x5c')]||_0x48e4d5[_0x6a4a('0x5d')]){return db[_0x48e4d5[_0x6a4a('0x5c')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x48e4d5[_0x6a4a('0x5c')]?_0x48e4d5[_0x6a4a('0x5c')]:_0x48e4d5['CampaignId']},'attributes':['id',_0x6a4a('0x24')],'raw':!![]});}}})[_0x6a4a('0x21')](function(_0x22f9b7){var _0x3649e6={};if(_0x22f9b7){_[_0x6a4a('0x4b')](_0x3649e6,_[_0x6a4a('0x5e')](_0x5d8539[_0x6a4a('0x5f')],[_0x6a4a('0x60'),'updatedAt','id']));_0x3649e6['state']=0x15;_0x3649e6['statedesc']='deleted';_0x3649e6[_0x6a4a('0x61')]=_0x22f9b7[_0x6a4a('0x24')];_0x3649e6[_0x6a4a('0x62')]=_0x389ac1[_0x6a4a('0x63')][_0x6a4a('0x24')];_0x3649e6['UserId']=_0x389ac1[_0x6a4a('0x63')]['id'];_0x3649e6[_0x6a4a('0x64')]=!![];_0x3649e6[_0x6a4a('0x65')]=moment()[_0x6a4a('0x66')](_0x6a4a('0x67'));_0x3649e6[_0x6a4a('0x68')]=_0x5d8539[_0x6a4a('0x69')];_0x3649e6['campaigntype']=_0x5d8539[_0x6a4a('0x5c')]?_0x6a4a('0x6a'):_0x6a4a('0x6b');return db[_0x6a4a('0x6c')][_0x6a4a('0x54')]({'where':{'id':_0x3649e6['ContactId']},'attributes':[_0x6a4a('0x6d'),_0x6a4a('0x6e')]})['then'](function(_0xa0fa4e){if(!_[_0x6a4a('0x6f')](_0x29bb58)&&!_['isNil'](_0xa0fa4e['firstName'])){_0x3649e6[_0x6a4a('0x70')]=_0xa0fa4e[_0x6a4a('0x6d')];if(!_[_0x6a4a('0x6f')](_0xa0fa4e[_0x6a4a('0x6e')])){_0x3649e6[_0x6a4a('0x70')]+='\x20'+_0xa0fa4e[_0x6a4a('0x6e')];}}})[_0x6a4a('0x71')](function(){return db[_0x6a4a('0x72')][_0x6a4a('0x56')](_0x3649e6);});}})[_0x6a4a('0x21')](function(){return _0x29bb58[_0x6a4a('0x19')](0xcc)[_0x6a4a('0x73')]();})['catch'](handleError(_0x29bb58,null));};exports['getPreview']=function(_0x5ad76d,_0x3bf8de,_0x96019a){var _0x1fdfb7=[];return db[_0x6a4a('0x6c')][_0x6a4a('0x5a')]()[_0x6a4a('0x21')](function(_0x759795){_0x1fdfb7=_[_0x6a4a('0x51')](_0x759795);return _0x5ad76d[_0x6a4a('0x63')][_0x6a4a('0x74')]({'where':{'type':_0x6a4a('0x75'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x6a4a('0x76')],'raw':!![]});})['then'](function(_0x282c06){if(_0x282c06&&_0x282c06[_0x6a4a('0x52')]){return db[_0x6a4a('0x77')][_0x6a4a('0x78')](function(_0x50a2cb){var _0x33e62f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6a4a('0x66')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x282c06,'id')},'$or':[{'UserId':null},{'UserId':_0x5ad76d['user']['id']}]};var _0x53a9f4=[];if(_0x5ad76d[_0x6a4a('0x58')][_0x6a4a('0x79')]&&_0x5ad76d[_0x6a4a('0x58')][_0x6a4a('0x79')]===_0x6a4a('0x7a')){if(!_[_0x6a4a('0x7b')](_0x5ad76d[_0x6a4a('0x58')][_0x6a4a('0x7c')])){_0x33e62f['id']={'$in':_0x5ad76d[_0x6a4a('0x58')][_0x6a4a('0x7c')]};}_0x53a9f4=[['priority',_0x6a4a('0x7d')],['scheduledAt',_0x282c06[0x0][_0x6a4a('0x76')]===_0x6a4a('0x7d')?_0x6a4a('0x7e'):'ASC'],db[_0x6a4a('0x77')]['literal'](_0x6a4a('0x7f')),['id','DESC']];}else{if(!_[_0x6a4a('0x7b')](_0x5ad76d[_0x6a4a('0x58')][_0x6a4a('0x7c')])){_0x33e62f['id']={'$notIn':_0x5ad76d[_0x6a4a('0x58')][_0x6a4a('0x7c')]};}_0x53a9f4=[['priority',_0x6a4a('0x7e')],[_0x6a4a('0x80'),_0x282c06[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x6a4a('0x81')](_0x6a4a('0x82')),['id',_0x6a4a('0x7d')]];}return db[_0x6a4a('0x28')][_0x6a4a('0x83')]({'attributes':['id',_0x6a4a('0x84')],'where':_0x33e62f,'order':_0x53a9f4,'transaction':_0x50a2cb,'lock':_0x50a2cb['LOCK'][_0x6a4a('0x85')],'include':[{'model':db[_0x6a4a('0x6c')],'as':_0x6a4a('0x86'),'attributes':_0x1fdfb7,'include':[{'model':db[_0x6a4a('0x87')],'as':_0x6a4a('0x88'),'attributes':['id',_0x6a4a('0x24')]}]},{'model':db[_0x6a4a('0x89')],'as':_0x6a4a('0x8a'),'attributes':['id',_0x6a4a('0x24')]},{'model':db[_0x6a4a('0x8b')],'as':_0x6a4a('0x8c'),'attributes':['id',_0x6a4a('0x24'),_0x6a4a('0x8d')]}]})['then'](function(_0x371e42){if(_0x371e42){return _0x371e42[_0x6a4a('0x57')]({'UserId':_0x5ad76d[_0x6a4a('0x63')]['id']},{'transaction':_0x50a2cb});}});});}})['then'](handleEntityNotFound(_0x3bf8de,null))[_0x6a4a('0x21')](respondWithResult(_0x3bf8de,null))[_0x6a4a('0x55')](handleError(_0x3bf8de,null));};exports['getOpenContacts']=function(_0x1038fd,_0x4463df,_0x5afc6d){return _0x1038fd[_0x6a4a('0x63')][_0x6a4a('0x74')]({'where':{'type':_0x6a4a('0x75'),'dialActive':!![],'dialMethod':_0x6a4a('0x8e')},'attributes':['id'],'raw':!![]})[_0x6a4a('0x21')](function(_0x320a57){if(_0x320a57&&_0x320a57[_0x6a4a('0x52')]){return db[_0x6a4a('0x28')][_0x6a4a('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x6a4a('0x67'))},'VoiceQueueId':{'$in':_[_0x6a4a('0x27')](_0x320a57,'id')},'$or':[{'UserId':null},{'UserId':_0x1038fd[_0x6a4a('0x63')]['id']}]}});}return 0x0;})[_0x6a4a('0x21')](function(_0x20b976){if(!_[_0x6a4a('0x6f')](_0x20b976)&&_['isNumber'](_0x20b976)){return _0x4463df[_0x6a4a('0x19')](0xc8)[_0x6a4a('0x1a')]({'contacts':_0x20b976});}else{logger[_0x6a4a('0x22')](_0x6a4a('0x8f'),_0x6a4a('0x90'),0x194,_0x6a4a('0x91'));_0x4463df['sendStatus'](0x194);}})['catch'](handleError(_0x4463df,null));};exports['getTimezones']=function(_0x38d8a0,_0x5c3068,_0x586553){var _0x484053=shared[_0x6a4a('0x92')];var _0x572567=[];_[_0x6a4a('0x27')](_0x484053,function(_0x4d448e){_0x572567[_0x6a4a('0x93')]({'id':_0x4d448e['name'],'name':_0x4d448e[_0x6a4a('0x24')],'utcOffset':_0x4d448e[_0x6a4a('0x94')]});});return _0x5c3068['status'](0xc8)[_0x6a4a('0x1a')]({'tz':_0x572567});};exports['getTimezone']=function(_0x3ffdf8,_0x11d528,_0x47a94c){var _0x5b0574=shared[_0x6a4a('0x92')];var _0x9b71e4={};if(!_['isNil'](_0x5b0574[_0x3ffdf8[_0x6a4a('0x58')]['id']]))_0x9b71e4=_0x5b0574[_0x3ffdf8[_0x6a4a('0x58')]['id']];return _0x11d528[_0x6a4a('0x19')](0xc8)['json'](_0x9b71e4);}; \ No newline at end of file +var _0x3214=['catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','membername','user','UserId','deleted','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','utcOffset','getTimezone','rimraf','request-promise','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','end','json','count','offset','limit','update','destroy','error','name','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notILike','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopper','then','includeAll','include','findAll','rows','show','params','options','find'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x3214,0x1e2));var _0x4321=function(_0x3a1206,_0x12e57e){_0x3a1206=_0x3a1206-0x0;var _0x19f68b=_0x3214[_0x3a1206];return _0x19f68b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4321('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4321('0x1'));var moment=require('moment');var BPromise=require(_0x4321('0x2'));var Mustache=require(_0x4321('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4321('0x4'));var ejs=require(_0x4321('0x5'));var fs=require('fs');var _=require(_0x4321('0x6'));var squel=require(_0x4321('0x7'));var crypto=require(_0x4321('0x8'));var jsforce=require(_0x4321('0x9'));var deskjs=require(_0x4321('0xa'));var toCsv=require(_0x4321('0x4'));var querystring=require(_0x4321('0xb'));var Papa=require('papaparse');var Redis=require(_0x4321('0xc'));var shared=require('../../config/environment');var authService=require(_0x4321('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4321('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4321('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4321('0x10'))['db'];function respondWithStatusCode(_0x4be403,_0x1b8410){_0x1b8410=_0x1b8410||0xcc;return function(_0x5cd361){if(_0x5cd361){return _0x4be403[_0x4321('0x11')](_0x1b8410);}return _0x4be403[_0x4321('0x12')](_0x1b8410)[_0x4321('0x13')]();};}function respondWithResult(_0x544cda,_0xb8aa9){_0xb8aa9=_0xb8aa9||0xc8;return function(_0x141bbf){if(_0x141bbf){return _0x544cda[_0x4321('0x12')](_0xb8aa9)[_0x4321('0x14')](_0x141bbf);}};}function respondWithFilteredResult(_0x28c8b8,_0x1592a6){return function(_0x20719d){if(_0x20719d){var _0x35ff95=_0x20719d[_0x4321('0x15')],_0x1764b0=_0x1592a6['offset'],_0x86aa26=_0x1592a6[_0x4321('0x16')]+_0x1592a6[_0x4321('0x17')],_0x356c32;if(_0x86aa26>=_0x35ff95){_0x86aa26=_0x35ff95;_0x356c32=0xc8;}else{_0x356c32=0xce;}_0x28c8b8[_0x4321('0x12')](_0x356c32);return _0x28c8b8['set']('Content-Range',_0x1764b0+'-'+_0x86aa26+'/'+_0x35ff95)[_0x4321('0x14')](_0x20719d);}return null;};}function patchUpdates(_0x3528aa){return function(_0x59b61b){try{jsonpatch['apply'](_0x59b61b,_0x3528aa,!![]);}catch(_0x353f7b){return BPromise['reject'](_0x353f7b);}return _0x59b61b['save']();};}function saveUpdates(_0x4377bd,_0x34b2f5){return function(_0x2373bf){if(_0x2373bf){return _0x2373bf[_0x4321('0x18')](_0x4377bd)['then'](function(_0x1aaa33){return _0x1aaa33;});}return null;};}function removeEntity(_0x1498d4,_0x273343){return function(_0x4411ca){if(_0x4411ca){return _0x4411ca[_0x4321('0x19')]()['then'](function(){_0x1498d4['status'](0xcc)[_0x4321('0x13')]();});}};}function handleEntityNotFound(_0x411ccf,_0xaf3183){return function(_0x5cca6d){if(!_0x5cca6d){_0x411ccf[_0x4321('0x11')](0x194);}return _0x5cca6d;};}function handleError(_0x46c720,_0x3f1933){_0x3f1933=_0x3f1933||0x1f4;return function(_0x5448e5){logger[_0x4321('0x1a')](_0x5448e5['stack']);if(_0x5448e5[_0x4321('0x1b')]){delete _0x5448e5[_0x4321('0x1b')];}_0x46c720[_0x4321('0x12')](_0x3f1933)['send'](_0x5448e5);};}exports[_0x4321('0x1c')]=function(_0xcc1111,_0x10a37f){var _0xd2978d={},_0x19562a={},_0x1ecb1b={'count':0x0,'rows':[]};var _0x1ace90=_['map'](db['CmHopper'][_0x4321('0x1d')],function(_0x35b8dd){return{'name':_0x35b8dd['fieldName'],'type':_0x35b8dd[_0x4321('0x1e')][_0x4321('0x1f')]};});_0x19562a[_0x4321('0x20')]=_[_0x4321('0x21')](_0x1ace90,_0x4321('0x1b'));_0x19562a[_0x4321('0x22')]=_[_0x4321('0x23')](_0xcc1111[_0x4321('0x22')]);_0x19562a[_0x4321('0x24')]=_[_0x4321('0x25')](_0x19562a[_0x4321('0x20')],_0x19562a[_0x4321('0x22')]);_0x19562a[_0x4321('0x24')]=_[_0x4321('0x26')](_0x19562a['filters'],['$and',_0x4321('0x27'),_0x4321('0x28'),_0x4321('0x29'),_0x4321('0x2a'),_0x4321('0x2b'),_0x4321('0x2c'),_0x4321('0x2d'),_0x4321('0x2e'),_0x4321('0x2f'),_0x4321('0x30'),_0x4321('0x31'),_0x4321('0x32'),_0x4321('0x33'),'$notLike','$iLike',_0x4321('0x34'),'$like','$overlap',_0x4321('0x35'),_0x4321('0x36'),_0x4321('0x37')]);_0xd2978d['attributes']=_[_0x4321('0x25')](_0x19562a[_0x4321('0x20')],qs[_0x4321('0x38')](_0xcc1111[_0x4321('0x22')][_0x4321('0x38')]));_0xd2978d[_0x4321('0x39')]=_0xd2978d[_0x4321('0x39')][_0x4321('0x3a')]?_0xd2978d[_0x4321('0x39')]:_0x19562a['model'];if(!_0xcc1111['query'][_0x4321('0x3b')](_0x4321('0x3c'))){_0xd2978d[_0x4321('0x17')]=qs[_0x4321('0x17')](_0xcc1111['query'][_0x4321('0x17')]);_0xd2978d[_0x4321('0x16')]=qs['offset'](_0xcc1111[_0x4321('0x22')]['offset']);}_0xd2978d[_0x4321('0x3d')]=qs['sort'](_0xcc1111[_0x4321('0x22')][_0x4321('0x3e')]);_0xd2978d[_0x4321('0x3f')]=qs[_0x4321('0x24')](_[_0x4321('0x40')](_0xcc1111[_0x4321('0x22')],_0x19562a[_0x4321('0x24')]),_0x1ace90);if(_0xcc1111[_0x4321('0x22')][_0x4321('0x41')]){_0xd2978d[_0x4321('0x3f')]=_[_0x4321('0x42')](_0xd2978d[_0x4321('0x3f')],{'$or':_[_0x4321('0x21')](_0x1ace90,function(_0x3da998){if(_0x3da998[_0x4321('0x1e')]!==_0x4321('0x43')){var _0x4d570a={};_0x4d570a[_0x3da998['name']]={'$like':'%'+_0xcc1111[_0x4321('0x22')][_0x4321('0x41')]+'%'};return _0x4d570a;}})});}_0xd2978d=_['merge']({},_0xd2978d,_0xcc1111['options']);var _0x106f93={'where':_0xd2978d[_0x4321('0x3f')]};return db[_0x4321('0x44')][_0x4321('0x15')](_0x106f93)[_0x4321('0x45')](function(_0x2195ee){_0x1ecb1b[_0x4321('0x15')]=_0x2195ee;if(_0xcc1111['query'][_0x4321('0x46')]){_0xd2978d[_0x4321('0x47')]=[{'all':!![]}];}return db[_0x4321('0x44')][_0x4321('0x48')](_0xd2978d);})[_0x4321('0x45')](function(_0x5bcbeb){_0x1ecb1b[_0x4321('0x49')]=_0x5bcbeb;return _0x1ecb1b;})[_0x4321('0x45')](respondWithFilteredResult(_0x10a37f,_0xd2978d))['catch'](handleError(_0x10a37f,null));};exports[_0x4321('0x4a')]=function(_0x440212,_0xcf171c){var _0x484191={'raw':!![],'where':{'id':_0x440212[_0x4321('0x4b')]['id']}},_0x238107={};_0x238107['model']=_[_0x4321('0x23')](db[_0x4321('0x44')]['rawAttributes']);_0x238107[_0x4321('0x22')]=_['keys'](_0x440212[_0x4321('0x22')]);_0x238107[_0x4321('0x24')]=_['intersection'](_0x238107[_0x4321('0x20')],_0x238107['query']);_0x484191[_0x4321('0x39')]=_[_0x4321('0x25')](_0x238107[_0x4321('0x20')],qs['fields'](_0x440212[_0x4321('0x22')]['fields']));_0x484191[_0x4321('0x39')]=_0x484191[_0x4321('0x39')]['length']?_0x484191[_0x4321('0x39')]:_0x238107['model'];if(_0x440212[_0x4321('0x22')][_0x4321('0x46')]){_0x484191['include']=[{'all':!![]}];}_0x484191=_[_0x4321('0x42')]({},_0x484191,_0x440212[_0x4321('0x4c')]);return db['CmHopper'][_0x4321('0x4d')](_0x484191)[_0x4321('0x45')](handleEntityNotFound(_0xcf171c,null))[_0x4321('0x45')](respondWithResult(_0xcf171c,null))[_0x4321('0x4e')](handleError(_0xcf171c,null));};exports[_0x4321('0x4f')]=function(_0x178ff1,_0x4399f3){return db[_0x4321('0x44')][_0x4321('0x4f')](_0x178ff1[_0x4321('0x50')],{})['then'](respondWithResult(_0x4399f3,0xc9))[_0x4321('0x4e')](handleError(_0x4399f3,null));};exports[_0x4321('0x18')]=function(_0x40edc3,_0x3a90c2){if(_0x40edc3[_0x4321('0x50')]['id']){delete _0x40edc3[_0x4321('0x50')]['id'];}return db[_0x4321('0x44')][_0x4321('0x4d')]({'where':{'id':_0x40edc3['params']['id']}})['then'](handleEntityNotFound(_0x3a90c2,null))[_0x4321('0x45')](saveUpdates(_0x40edc3[_0x4321('0x50')],null))[_0x4321('0x45')](respondWithResult(_0x3a90c2,null))['catch'](handleError(_0x3a90c2,null));};exports[_0x4321('0x51')]=function(_0x603c97,_0x9d1bb0){return db[_0x4321('0x44')][_0x4321('0x51')]()[_0x4321('0x45')](respondWithResult(_0x9d1bb0,null))[_0x4321('0x4e')](handleError(_0x9d1bb0,null));};exports[_0x4321('0x19')]=function(_0x4f2b86,_0xa3cddc){var _0x43c0a8;return db[_0x4321('0x44')][_0x4321('0x4d')]({'where':{'id':_0x4f2b86[_0x4321('0x4b')]['id']}})[_0x4321('0x45')](handleEntityNotFound(_0xa3cddc,null))[_0x4321('0x45')](function(_0x236e08){if(_0x236e08){return _0x236e08[_0x4321('0x19')]()['then'](function(_0x14ccbf){return _0x14ccbf;});}})[_0x4321('0x45')](function(_0x344458){_0x43c0a8=_0x344458;if(_0x344458){if(_0x344458[_0x4321('0x52')]||_0x344458[_0x4321('0x53')]){return db[_0x344458[_0x4321('0x52')]?_0x4321('0x54'):_0x4321('0x55')][_0x4321('0x4d')]({'where':{'id':_0x344458[_0x4321('0x52')]?_0x344458[_0x4321('0x52')]:_0x344458[_0x4321('0x53')]},'attributes':['id',_0x4321('0x1b')],'raw':!![]});}}})[_0x4321('0x45')](function(_0x48f8a0){var _0x248eb6={};if(_0x48f8a0){_[_0x4321('0x42')](_0x248eb6,_[_0x4321('0x56')](_0x43c0a8['dataValues'],[_0x4321('0x57'),_0x4321('0x58'),'id']));_0x248eb6[_0x4321('0x59')]=0x15;_0x248eb6[_0x4321('0x5a')]='deleted';_0x248eb6['campaign']=_0x48f8a0[_0x4321('0x1b')];_0x248eb6[_0x4321('0x5b')]=_0x4f2b86[_0x4321('0x5c')]['name'];_0x248eb6[_0x4321('0x5d')]=_0x4f2b86[_0x4321('0x5c')]['id'];_0x248eb6[_0x4321('0x5e')]=!![];_0x248eb6['deletedat']=moment()[_0x4321('0x5f')](_0x4321('0x60'));_0x248eb6[_0x4321('0x61')]=_0x43c0a8['phone'];_0x248eb6[_0x4321('0x62')]=_0x43c0a8['VoiceQueueId']?_0x4321('0x63'):_0x4321('0x64');return db[_0x4321('0x65')][_0x4321('0x4d')]({'where':{'id':_0x248eb6[_0x4321('0x66')]},'attributes':['firstName','lastName']})[_0x4321('0x45')](function(_0x5c4b6e){if(!_['isNil'](_0xa3cddc)&&!_[_0x4321('0x67')](_0x5c4b6e[_0x4321('0x68')])){_0x248eb6[_0x4321('0x69')]=_0x5c4b6e[_0x4321('0x68')];if(!_[_0x4321('0x67')](_0x5c4b6e['lastName'])){_0x248eb6[_0x4321('0x69')]+='\x20'+_0x5c4b6e[_0x4321('0x6a')];}}})[_0x4321('0x6b')](function(){return db[_0x4321('0x6c')]['create'](_0x248eb6);});}})[_0x4321('0x45')](function(){return _0xa3cddc['status'](0xcc)[_0x4321('0x13')]();})[_0x4321('0x4e')](handleError(_0xa3cddc,null));};exports[_0x4321('0x6d')]=function(_0x4cbfd2,_0x42a31d,_0x29b5b8){var _0x3a6cf8=[];return db[_0x4321('0x65')]['describe']()[_0x4321('0x45')](function(_0x462bab){_0x3a6cf8=_['keys'](_0x462bab);return _0x4cbfd2[_0x4321('0x5c')][_0x4321('0x6e')]({'where':{'type':_0x4321('0x6f'),'dialActive':!![],'dialMethod':_0x4321('0x70')},'attributes':['id',_0x4321('0x71')],'raw':!![]});})[_0x4321('0x45')](function(_0x140f35){if(_0x140f35&&_0x140f35[_0x4321('0x3a')]){return db[_0x4321('0x72')][_0x4321('0x73')](function(_0x5384f0){var _0x5958a6={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4321('0x5f')](_0x4321('0x60'))},'VoiceQueueId':{'$in':_[_0x4321('0x21')](_0x140f35,'id')},'$or':[{'UserId':null},{'UserId':_0x4cbfd2['user']['id']}]};var _0x567665=[];if(_0x4cbfd2[_0x4321('0x50')]['direction']&&_0x4cbfd2['body'][_0x4321('0x74')]===_0x4321('0x75')){if(!_['isEmpty'](_0x4cbfd2[_0x4321('0x50')]['hopperIds'])){_0x5958a6['id']={'$in':_0x4cbfd2[_0x4321('0x50')][_0x4321('0x76')]};}_0x567665=[[_0x4321('0x77'),_0x4321('0x78')],['scheduledAt',_0x140f35[0x0][_0x4321('0x71')]===_0x4321('0x78')?_0x4321('0x79'):_0x4321('0x78')],db[_0x4321('0x72')][_0x4321('0x7a')](_0x4321('0x7b')),['id',_0x4321('0x79')]];}else{if(!_[_0x4321('0x7c')](_0x4cbfd2['body'][_0x4321('0x76')])){_0x5958a6['id']={'$notIn':_0x4cbfd2['body'][_0x4321('0x76')]};}_0x567665=[[_0x4321('0x77'),'DESC'],[_0x4321('0x7d'),_0x140f35[0x0][_0x4321('0x71')]],db['sequelize'][_0x4321('0x7a')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x4321('0x78')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x4321('0x7e')],'where':_0x5958a6,'order':_0x567665,'transaction':_0x5384f0,'lock':_0x5384f0[_0x4321('0x7f')][_0x4321('0x80')],'include':[{'model':db[_0x4321('0x65')],'as':_0x4321('0x81'),'attributes':_0x3a6cf8,'include':[{'model':db[_0x4321('0x82')],'as':_0x4321('0x83'),'attributes':['id',_0x4321('0x1b')]}]},{'model':db[_0x4321('0x84')],'as':'List','attributes':['id',_0x4321('0x1b')]},{'model':db[_0x4321('0x54')],'as':_0x4321('0x85'),'attributes':['id',_0x4321('0x1b'),'dialActive']}]})[_0x4321('0x45')](function(_0x4c1f6b){if(_0x4c1f6b){return _0x4c1f6b['update']({'UserId':_0x4cbfd2[_0x4321('0x5c')]['id']},{'transaction':_0x5384f0});}});});}})['then'](handleEntityNotFound(_0x42a31d,null))[_0x4321('0x45')](respondWithResult(_0x42a31d,null))[_0x4321('0x4e')](handleError(_0x42a31d,null));};exports[_0x4321('0x86')]=function(_0x53885c,_0x7f44d2,_0x1056cc){return _0x53885c['user'][_0x4321('0x6e')]({'where':{'type':_0x4321('0x6f'),'dialActive':!![],'dialMethod':_0x4321('0x70')},'attributes':['id'],'raw':!![]})[_0x4321('0x45')](function(_0x5ed3a1){if(_0x5ed3a1&&_0x5ed3a1[_0x4321('0x3a')]){return db[_0x4321('0x44')][_0x4321('0x15')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x4321('0x60'))},'VoiceQueueId':{'$in':_[_0x4321('0x21')](_0x5ed3a1,'id')},'$or':[{'UserId':null},{'UserId':_0x53885c[_0x4321('0x5c')]['id']}]}});}return 0x0;})[_0x4321('0x45')](function(_0x48bba7){if(!_[_0x4321('0x67')](_0x48bba7)&&_['isNumber'](_0x48bba7)){return _0x7f44d2['status'](0xc8)[_0x4321('0x14')]({'contacts':_0x48bba7});}else{logger['error'](_0x4321('0x87'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x7f44d2[_0x4321('0x11')](0x194);}})[_0x4321('0x4e')](handleError(_0x7f44d2,null));};exports[_0x4321('0x88')]=function(_0x10ac5a,_0x4c58da,_0xb2f23d){var _0x182bf9=shared[_0x4321('0x89')];var _0x286549=[];_[_0x4321('0x21')](_0x182bf9,function(_0x5ab9d0){_0x286549['push']({'id':_0x5ab9d0['name'],'name':_0x5ab9d0[_0x4321('0x1b')],'utcOffset':_0x5ab9d0[_0x4321('0x8a')]});});return _0x4c58da[_0x4321('0x12')](0xc8)['json']({'tz':_0x286549});};exports[_0x4321('0x8b')]=function(_0x4de785,_0x46a337,_0x3a03b7){var _0x5e8145=shared[_0x4321('0x89')];var _0xd9d720={};if(!_['isNil'](_0x5e8145[_0x4de785[_0x4321('0x50')]['id']]))_0xd9d720=_0x5e8145[_0x4de785[_0x4321('0x50')]['id']];return _0x46a337[_0x4321('0x12')](0xc8)['json'](_0xd9d720);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 0bafa9f..990ff56 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 _0x5ac3=['../../config/logger','api','request-promise','../../config/environment','exports','CmHopper','cm_hopper','scheduledat','phone','priority','util'];(function(_0x7fd6f3,_0x22d37b){var _0x42d07e=function(_0x4d3978){while(--_0x4d3978){_0x7fd6f3['push'](_0x7fd6f3['shift']());}};_0x42d07e(++_0x22d37b);}(_0x5ac3,0x112));var _0x35ac=function(_0x24af13,_0x360f78){_0x24af13=_0x24af13-0x0;var _0x38d2e7=_0x5ac3[_0x24af13];return _0x38d2e7;};'use strict';var _=require('lodash');var util=require(_0x35ac('0x0'));var logger=require(_0x35ac('0x1'))(_0x35ac('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x35ac('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x35ac('0x4'));var attributes=require('./cmHopper.attributes');module[_0x35ac('0x5')]=function(_0x3fb080,_0x31d11c){return _0x3fb080['define'](_0x35ac('0x6'),attributes,{'tableName':_0x35ac('0x7'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x35ac('0x8')]},{'name':'phone','fields':[_0x35ac('0x9')]},{'name':'priority','fields':[_0x35ac('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x23b4=['api','bluebird','request-promise','path','rimraf','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23b4,0xfa));var _0x423b=function(_0x29a7c5,_0x177ec8){_0x29a7c5=_0x29a7c5-0x0;var _0x23093f=_0x23b4[_0x29a7c5];return _0x23093f;};'use strict';var _=require('lodash');var util=require(_0x423b('0x0'));var logger=require(_0x423b('0x1'))(_0x423b('0x2'));var moment=require('moment');var BPromise=require(_0x423b('0x3'));var rp=require(_0x423b('0x4'));var fs=require('fs');var path=require(_0x423b('0x5'));var rimraf=require(_0x423b('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x423b('0x7')]=function(_0x12fcaa,_0x495ec7){return _0x12fcaa[_0x423b('0x8')](_0x423b('0x9'),attributes,{'tableName':_0x423b('0xa'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x423b('0xb')]},{'name':_0x423b('0xc'),'fields':[_0x423b('0xc')]},{'name':_0x423b('0xd'),'fields':[_0x423b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 0bdd8af..66ba75d 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 _0x7837=['format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','LOCK','GetCmHopperPreview','GetContactByPhone','log','req\x20value','phone\x20value','findOne','phone','getContactByPhone','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','attributes','limit','include','model','map','info','ShowCmHopper','find','where','create','CreateCmHopper','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','order','UPDATE','Contact','keys','User','Agent','name','voicePause','includes','UserId','push','body','all','MoveContactManagedDialer','transaction','CmHopperFinal','`scheduledat`\x20>=\x20'];(function(_0x581bdb,_0x2ed81b){var _0x250669=function(_0x36926e){while(--_0x36926e){_0x581bdb['push'](_0x581bdb['shift']());}};_0x250669(++_0x2ed81b);}(_0x7837,0xf3));var _0x7783=function(_0x44abd1,_0x5246b4){_0x44abd1=_0x44abd1-0x0;var _0x1f68e9=_0x7837[_0x44abd1];return _0x1f68e9;};'use strict';var _=require(_0x7783('0x0'));var util=require(_0x7783('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7783('0x2'));var fs=require('fs');var Redis=require(_0x7783('0x3'));var db=require(_0x7783('0x4'))['db'];var utils=require(_0x7783('0x5'));var logger=require(_0x7783('0x6'))(_0x7783('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7783('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b2e6,_0x277ae3,_0x2bec94){return new BPromise(function(_0x173374,_0x46c8e2){return client[_0x7783('0x9')](_0x59b2e6,_0x2bec94)[_0x7783('0xa')](function(_0x8f7900){logger['info'](_0x7783('0xb'),_0x277ae3,_0x7783('0xc'));logger[_0x7783('0xd')](_0x7783('0xe'),_0x277ae3,_0x7783('0xc'),JSON[_0x7783('0xf')](_0x8f7900));if(_0x8f7900[_0x7783('0x10')]){if(_0x8f7900[_0x7783('0x10')][_0x7783('0x11')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x277ae3,_0x8f7900[_0x7783('0x10')]['message']);return _0x46c8e2(_0x8f7900[_0x7783('0x10')]['message']);}logger[_0x7783('0x10')](_0x7783('0xb'),_0x277ae3,_0x8f7900[_0x7783('0x10')][_0x7783('0x12')]);return _0x173374(_0x8f7900['error'][_0x7783('0x12')]);}else{logger['info'](_0x7783('0xb'),_0x277ae3,'request\x20sent');_0x173374(_0x8f7900[_0x7783('0x13')][_0x7783('0x12')]);}})[_0x7783('0x14')](function(_0xef698){logger[_0x7783('0x10')](_0x7783('0xb'),_0x277ae3,_0xef698);_0x46c8e2(_0xef698);});});}exports[_0x7783('0x15')]=function(_0x9e4acf){var _0x2a95b9=this;return new Promise(function(_0x24f950,_0x111e5e){return db[_0x7783('0x16')][_0x7783('0x17')]({'raw':_0x9e4acf[_0x7783('0x18')]?_0x9e4acf[_0x7783('0x18')][_0x7783('0x19')]===undefined?!![]:![]:!![],'where':_0x9e4acf[_0x7783('0x18')]?_0x9e4acf[_0x7783('0x18')]['where']||null:null,'attributes':_0x9e4acf[_0x7783('0x18')]?_0x9e4acf[_0x7783('0x18')][_0x7783('0x1a')]||null:null,'limit':_0x9e4acf[_0x7783('0x18')]?_0x9e4acf['options'][_0x7783('0x1b')]||null:null,'include':_0x9e4acf['options']?_0x9e4acf[_0x7783('0x18')][_0x7783('0x1c')]?_['map'](_0x9e4acf[_0x7783('0x18')][_0x7783('0x1c')],function(_0x5ae057){return{'model':db[_0x5ae057[_0x7783('0x1d')]],'as':_0x5ae057['as'],'attributes':_0x5ae057[_0x7783('0x1a')],'include':_0x5ae057['include']?_['map'](_0x5ae057[_0x7783('0x1c')],function(_0x4066e4){return{'model':db[_0x4066e4['model']],'as':_0x4066e4['as'],'attributes':_0x4066e4[_0x7783('0x1a')],'include':_0x4066e4[_0x7783('0x1c')]?_[_0x7783('0x1e')](_0x4066e4[_0x7783('0x1c')],function(_0x3a6294){return{'model':db[_0x3a6294[_0x7783('0x1d')]],'as':_0x3a6294['as'],'attributes':_0x3a6294[_0x7783('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7783('0xa')](function(_0x5b3d0a){logger[_0x7783('0x1f')](_0x7783('0x15'),_0x9e4acf);logger[_0x7783('0xd')]('GetCmHopper',_0x9e4acf,JSON[_0x7783('0xf')](_0x5b3d0a));_0x24f950(_0x5b3d0a);})[_0x7783('0x14')](function(_0x401778){logger[_0x7783('0x10')](_0x7783('0x15'),_0x401778[_0x7783('0x12')],_0x9e4acf);_0x111e5e(_0x2a95b9[_0x7783('0x10')](0x1f4,_0x401778['message']));});});};exports[_0x7783('0x20')]=function(_0x3eaf8e){var _0x3cbe28=this;return new Promise(function(_0x35785a,_0x430b7b){return db[_0x7783('0x16')][_0x7783('0x21')]({'raw':_0x3eaf8e[_0x7783('0x18')]?_0x3eaf8e[_0x7783('0x18')][_0x7783('0x19')]===undefined?!![]:![]:!![],'where':_0x3eaf8e[_0x7783('0x18')]?_0x3eaf8e[_0x7783('0x18')][_0x7783('0x22')]||null:null,'attributes':_0x3eaf8e[_0x7783('0x18')]?_0x3eaf8e[_0x7783('0x18')][_0x7783('0x1a')]||null:null,'include':_0x3eaf8e[_0x7783('0x18')]?_0x3eaf8e['options'][_0x7783('0x1c')]?_['map'](_0x3eaf8e[_0x7783('0x18')][_0x7783('0x1c')],function(_0x270957){return{'model':db[_0x270957[_0x7783('0x1d')]],'as':_0x270957['as'],'attributes':_0x270957['attributes'],'include':_0x270957[_0x7783('0x1c')]?_[_0x7783('0x1e')](_0x270957[_0x7783('0x1c')],function(_0x355589){return{'model':db[_0x355589[_0x7783('0x1d')]],'as':_0x355589['as'],'attributes':_0x355589[_0x7783('0x1a')],'include':_0x355589[_0x7783('0x1c')]?_[_0x7783('0x1e')](_0x355589[_0x7783('0x1c')],function(_0x369f78){return{'model':db[_0x369f78['model']],'as':_0x369f78['as'],'attributes':_0x369f78[_0x7783('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bb28f){logger['info']('ShowCmHopper',_0x3eaf8e);logger[_0x7783('0xd')](_0x7783('0x20'),_0x3eaf8e,JSON[_0x7783('0xf')](_0x3bb28f));_0x35785a(_0x3bb28f);})['catch'](function(_0x5637d1){logger[_0x7783('0x10')](_0x7783('0x20'),_0x5637d1[_0x7783('0x12')],_0x3eaf8e);_0x430b7b(_0x3cbe28[_0x7783('0x10')](0x1f4,_0x5637d1['message']));});});};exports['CreateCmHopper']=function(_0xd4c25b){var _0x847b56=this;return new Promise(function(_0x2d0eb9,_0x35bc91){return db['CmHopper'][_0x7783('0x23')](_0xd4c25b['body'],{'raw':_0xd4c25b[_0x7783('0x18')]?_0xd4c25b[_0x7783('0x18')][_0x7783('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x26bd30){logger[_0x7783('0x1f')](_0x7783('0x24'),_0xd4c25b);logger[_0x7783('0xd')](_0x7783('0x24'),_0xd4c25b,JSON[_0x7783('0xf')](_0x26bd30));_0x2d0eb9(_0x26bd30);})[_0x7783('0x14')](function(_0xf8c67){logger['error'](_0x7783('0x24'),_0xf8c67[_0x7783('0x12')],_0xd4c25b);_0x35bc91(_0x847b56['error'](0x1f4,_0xf8c67['message']));});});};exports[_0x7783('0x25')]=function(_0x4fe220){var _0x45994b=this;return new Promise(function(_0x4d87a4,_0x14b951){return db[_0x7783('0x16')]['update'](_0x4fe220['body'],{'raw':_0x4fe220['options']?_0x4fe220[_0x7783('0x18')][_0x7783('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fe220[_0x7783('0x18')]?_0x4fe220[_0x7783('0x18')][_0x7783('0x22')]||null:null,'attributes':_0x4fe220[_0x7783('0x18')]?_0x4fe220[_0x7783('0x18')][_0x7783('0x1a')]||null:null,'limit':_0x4fe220[_0x7783('0x18')]?_0x4fe220[_0x7783('0x18')][_0x7783('0x1b')]||null:null})[_0x7783('0xa')](function(_0x26f8e7){logger['info']('UpdateCmHopper',_0x4fe220);logger[_0x7783('0xd')](_0x7783('0x25'),_0x4fe220,JSON[_0x7783('0xf')](_0x26f8e7));_0x4d87a4(_0x26f8e7);})[_0x7783('0x14')](function(_0x4daa43){logger['error'](_0x7783('0x25'),_0x4daa43['message'],_0x4fe220);_0x14b951(_0x45994b[_0x7783('0x10')](0x1f4,_0x4daa43[_0x7783('0x12')]));});});};exports['DestroyCmHopper']=function(_0x5e1d34){var _0x45df20=this;return new Promise(function(_0x86cf76,_0x3bbdad){return db[_0x7783('0x16')][_0x7783('0x26')]({'where':_0x5e1d34['options']?_0x5e1d34[_0x7783('0x18')]['where']||null:null})[_0x7783('0xa')](function(_0x17e079){logger[_0x7783('0x1f')](_0x7783('0x27'),_0x5e1d34);logger['debug'](_0x7783('0x27'),_0x5e1d34,JSON[_0x7783('0xf')](_0x17e079));_0x86cf76(_0x17e079);})[_0x7783('0x14')](function(_0x44a447){logger[_0x7783('0x10')](_0x7783('0x27'),_0x44a447[_0x7783('0x12')],_0x5e1d34);_0x3bbdad(_0x45df20[_0x7783('0x10')](0x1f4,_0x44a447[_0x7783('0x12')]));});});};exports[_0x7783('0x28')]=function(_0x1ac51f){var _0xe0a31e=this;return new Promise(function(_0x26ee52,_0x403b45){return db[_0x7783('0x29')][_0x7783('0x2a')]()[_0x7783('0xa')](function(_0x41badb){return db[_0x7783('0x2b')]['transaction'](function(_0x5b5a13){return db[_0x7783('0x16')]['findAll']({'where':_0x1ac51f[_0x7783('0x18')]?_0x1ac51f[_0x7783('0x18')][_0x7783('0x22')]||null:null,'attributes':_0x1ac51f[_0x7783('0x18')]?_0x1ac51f[_0x7783('0x18')][_0x7783('0x1a')]||null:null,'limit':_0x1ac51f[_0x7783('0x18')]?_0x1ac51f[_0x7783('0x18')][_0x7783('0x1b')]||null:null,'order':_0x1ac51f[_0x7783('0x18')]?_0x1ac51f['options'][_0x7783('0x2c')]||null:null,'transaction':_0x5b5a13,'lock':_0x5b5a13['LOCK'][_0x7783('0x2d')],'include':[{'model':db[_0x7783('0x29')],'as':_0x7783('0x2e'),'attributes':_[_0x7783('0x2f')](_0x41badb)},{'model':db[_0x7783('0x30')],'as':_0x7783('0x31'),'attributes':['id',_0x7783('0x32'),_0x7783('0x33')]}]})['then'](function(_0xcb8c04){var _0x4c6094=[];var _0x411086=[];for(var _0x25fd8f=0x0;_0x25fd8f<_0xcb8c04['length'];_0x25fd8f+=0x1){if(!_0x411086[_0x7783('0x34')](_0xcb8c04[_0x25fd8f][_0x7783('0x35')])){_0x411086[_0x7783('0x36')](_0xcb8c04[_0x25fd8f][_0x7783('0x35')]);_0x4c6094[_0x7783('0x36')](_0xcb8c04[_0x25fd8f]['update'](_0x1ac51f[_0x7783('0x37')],{'transaction':_0x5b5a13}));}}return BPromise[_0x7783('0x38')](_0x4c6094);});})[_0x7783('0xa')](function(_0x423499){logger[_0x7783('0x1f')](_0x7783('0x28'),_0x1ac51f);logger[_0x7783('0xd')](_0x7783('0x28'),_0x1ac51f,JSON[_0x7783('0xf')](_0x423499));_0x26ee52(_0x423499);})[_0x7783('0x14')](function(_0x25b63a){logger[_0x7783('0x10')](_0x7783('0x28'),_0x25b63a[_0x7783('0x12')],_0x1ac51f);_0x403b45(_0xe0a31e[_0x7783('0x10')](0x1f4,_0x25b63a[_0x7783('0x12')]));});});});};exports[_0x7783('0x39')]=function(_0x296648){var _0x79f722=this;return new Promise(function(_0x3c70be,_0x3bbd8b){return db[_0x7783('0x2b')][_0x7783('0x3a')](function(_0xcaca10){return db[_0x7783('0x3b')]['create'](_0x296648[_0x7783('0x37')],{'raw':_0x296648[_0x7783('0x18')]?_0x296648['options']['raw']===undefined?!![]:![]:!![],'transaction':_0xcaca10})[_0x7783('0xa')](function(){return db['CmHopper']['destroy']({'where':_0x296648[_0x7783('0x18')]?_0x296648[_0x7783('0x18')][_0x7783('0x22')]||null:null,'transaction':_0xcaca10});});})[_0x7783('0xa')](function(_0x3ebba9){logger[_0x7783('0x1f')](_0x7783('0x39'),_0x296648);logger[_0x7783('0xd')](_0x7783('0x39'),_0x296648,JSON[_0x7783('0xf')](_0x3ebba9));_0x3c70be(_0x3ebba9);})['catch'](function(_0x2a4962){logger[_0x7783('0x10')]('MoveContactManagedDialer',_0x2a4962['message'],_0x296648);_0x3bbd8b(_0x79f722[_0x7783('0x10')](0x1f4,_0x2a4962[_0x7783('0x12')]));});});};exports['CountReScheduled']=function(_0x5cda4e){var _0x31348e=this;return new Promise(function(_0x3b683d,_0x345fa3){return db[_0x7783('0x16')]['findAll']({'raw':_0x5cda4e['options']?_0x5cda4e['options'][_0x7783('0x19')]===undefined?!![]:![]:!![],'where':_0x5cda4e[_0x7783('0x18')]?_0x5cda4e[_0x7783('0x18')][_0x7783('0x22')]||null:null,'attributes':[[db[_0x7783('0x2b')]['fn']('COUNT',db[_0x7783('0x2b')]['fn']('IF',db[_0x7783('0x2b')]['literal'](_0x7783('0x3c')+util[_0x7783('0x3d')](_0x7783('0x3e'),moment()[_0x7783('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x7783('0x3f')))),_0x7783('0x40')]]})[_0x7783('0xa')](function(_0x2de591){logger['info'](_0x7783('0x41'),_0x5cda4e);logger['debug'](_0x7783('0x41'),_0x5cda4e,JSON['stringify'](_0x2de591));_0x3b683d(_0x2de591);})['catch'](function(_0x22d96d){logger['error']('CountReScheduled',_0x22d96d[_0x7783('0x12')],_0x5cda4e);_0x345fa3(_0x31348e[_0x7783('0x10')](0x1f4,_0x22d96d[_0x7783('0x12')]));});});};exports[_0x7783('0x42')]=function(_0x5a8279){var _0x5bec27=this;return new Promise(function(_0xd4e9eb,_0x4c7938){return db['CmContact'][_0x7783('0x2a')]()['then'](function(_0x4d1e39){return db[_0x7783('0x2b')][_0x7783('0x3a')](function(_0x44837b){return db[_0x7783('0x16')]['findAll']({'where':_0x5a8279['options']?_0x5a8279[_0x7783('0x18')][_0x7783('0x22')]||null:null,'attributes':_0x5a8279['options']?_0x5a8279['options'][_0x7783('0x1a')]||null:null,'limit':0x1,'order':_0x5a8279[_0x7783('0x18')]?_0x5a8279[_0x7783('0x18')][_0x7783('0x2c')]||null:null,'group':db[_0x7783('0x16')][_0x7783('0x35')],'transaction':_0x44837b,'lock':_0x44837b[_0x7783('0x43')][_0x7783('0x2d')],'include':_0x5a8279[_0x7783('0x18')]?_0x5a8279[_0x7783('0x18')][_0x7783('0x1c')]?_[_0x7783('0x1e')](_0x5a8279[_0x7783('0x18')]['include'],function(_0x476906){return{'model':db[_0x476906[_0x7783('0x1d')]],'as':_0x476906['as'],'attributes':_0x476906[_0x7783('0x1a')],'include':_0x476906['include']?_[_0x7783('0x1e')](_0x476906[_0x7783('0x1c')],function(_0x58ce24){return{'model':db[_0x58ce24[_0x7783('0x1d')]],'as':_0x58ce24['as'],'attributes':_0x58ce24[_0x7783('0x1a')],'include':_0x58ce24[_0x7783('0x1c')]?_[_0x7783('0x1e')](_0x58ce24[_0x7783('0x1c')],function(_0x275bf3){return{'model':db[_0x275bf3[_0x7783('0x1d')]],'as':_0x275bf3['as'],'attributes':_0x275bf3[_0x7783('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7783('0xa')](function(_0x5743c5){var _0x587f90=[];for(var _0x4bcf17=0x0;_0x4bcf17<_0x5743c5['length'];_0x4bcf17+=0x1){_0x587f90[_0x7783('0x36')](_0x5743c5[_0x4bcf17]['update'](_0x5a8279[_0x7783('0x37')],{'transaction':_0x44837b}));}return BPromise[_0x7783('0x38')](_0x587f90);});})[_0x7783('0xa')](function(_0xed68bc){logger[_0x7783('0x1f')](_0x7783('0x42'),_0x5a8279);logger['debug'](_0x7783('0x42'),_0x5a8279,JSON[_0x7783('0xf')](_0xed68bc));_0xd4e9eb(_0xed68bc);})[_0x7783('0x14')](function(_0x28a193){logger['error'](_0x7783('0x42'),_0x28a193[_0x7783('0x12')],_0x5a8279);_0x4c7938(_0x5bec27[_0x7783('0x10')](0x1f4,_0x28a193[_0x7783('0x12')]));});});});};exports[_0x7783('0x44')]=function(_0x278ed2){var _0xcd565f=this;return new Promise(function(_0x1dc6ee,_0x4cc5fa){db['CmContact'][_0x7783('0x2a')]()['then'](function(_0x2cf47b){return db['CmHopper'][_0x7783('0x17')]({'raw':_0x278ed2['options']?_0x278ed2[_0x7783('0x18')][_0x7783('0x19')]===undefined?!![]:![]:!![],'where':_0x278ed2['options']?_0x278ed2['options']['where']||null:null,'attributes':_0x278ed2['options']?_0x278ed2[_0x7783('0x18')][_0x7783('0x1a')]||null:null,'limit':_0x278ed2[_0x7783('0x18')]?_0x278ed2[_0x7783('0x18')][_0x7783('0x1b')]||null:null,'include':_0x278ed2[_0x7783('0x18')]?_0x278ed2[_0x7783('0x18')][_0x7783('0x1c')]?_[_0x7783('0x1e')](_0x278ed2[_0x7783('0x18')]['include'],function(_0x1d26ec){return{'model':db[_0x1d26ec[_0x7783('0x1d')]],'as':_0x1d26ec['as'],'attributes':_0x1d26ec['as']===_0x7783('0x2e')?_[_0x7783('0x2f')](_0x2cf47b):_0x1d26ec[_0x7783('0x1a')],'include':_0x1d26ec[_0x7783('0x1c')]?_[_0x7783('0x1e')](_0x1d26ec[_0x7783('0x1c')],function(_0x2471b){return{'model':db[_0x2471b['model']],'as':_0x2471b['as'],'attributes':_0x2471b[_0x7783('0x1a')],'include':_0x2471b[_0x7783('0x1c')]?_[_0x7783('0x1e')](_0x2471b['include'],function(_0x3edf59){return{'model':db[_0x3edf59[_0x7783('0x1d')]],'as':_0x3edf59['as'],'attributes':_0x3edf59[_0x7783('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7783('0xa')](function(_0x56a8b4){logger[_0x7783('0x1f')](_0x7783('0x15'),_0x278ed2);logger[_0x7783('0xd')](_0x7783('0x15'),_0x278ed2,JSON[_0x7783('0xf')](_0x56a8b4));_0x1dc6ee(_0x56a8b4);})[_0x7783('0x14')](function(_0x29da34){logger['error'](_0x7783('0x15'),_0x29da34[_0x7783('0x12')],_0x278ed2);_0x4cc5fa(_0xcd565f[_0x7783('0x10')](0x1f4,_0x29da34[_0x7783('0x12')]));});});});};exports[_0x7783('0x45')]=function(_0x4eae69){console[_0x7783('0x46')](_0x7783('0x47'),_0x4eae69);console[_0x7783('0x46')](_0x7783('0x48'),_0x4eae69['options'][_0x7783('0x22')]['phone']);_this=this;return new Promise(function(_0x1b581c,_0x3edfc9){return db[_0x7783('0x29')][_0x7783('0x49')]({'raw':!![],'where':{'phone':_0x4eae69[_0x7783('0x18')]['where'][_0x7783('0x4a')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0x7783('0xa')](function(_0x484ffb){console['log']('getcontactbyohone',_0x484ffb);logger[_0x7783('0x1f')](_0x7783('0x4b'),_0x4eae69);logger[_0x7783('0xd')](_0x7783('0x4b'),_0x4eae69,JSON[_0x7783('0xf')](_0x484ffb));_0x1b581c(_0x484ffb);})[_0x7783('0x14')](function(_0x4b9011){logger[_0x7783('0x10')](_0x7783('0x4b'),_0x4b9011['message'],_0x4eae69);_0x3edfc9(_this['error'](0x1f4,_0x4b9011[_0x7783('0x12')]));});});}; \ No newline at end of file +var _0xf442=['options','raw','where','attributes','limit','include','map','GetCmHopper','ShowCmHopper','find','model','catch','create','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','LOCK','UPDATE','Contact','keys','length','includes','UserId','push','MoveContactManagedDialer','transaction','CmHopperFinal','CountReScheduled','literal','format','\x22%s\x22','contactsRescheduled','GetContactRecallMe','order','all','GetCmHopperPreview','GetContactByPhone','log','req\x20value','phone\x20value','phone','findOne','dialTimezone','getcontactbyohone','getContactByPhone','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopper','findAll'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0xf442,0xd0));var _0x2f44=function(_0xa0ab36,_0x57c12e){_0xa0ab36=_0xa0ab36-0x0;var _0x2657db=_0xf442[_0xa0ab36];return _0x2657db;};'use strict';var _=require(_0x2f44('0x0'));var util=require(_0x2f44('0x1'));var moment=require(_0x2f44('0x2'));var BPromise=require(_0x2f44('0x3'));var rs=require(_0x2f44('0x4'));var fs=require('fs');var Redis=require(_0x2f44('0x5'));var db=require(_0x2f44('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f44('0x7'))(_0x2f44('0x8'));var config=require(_0x2f44('0x9'));var jayson=require(_0x2f44('0xa'));var client=jayson[_0x2f44('0xb')][_0x2f44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27015d,_0xe4df0b,_0x49ead8){return new BPromise(function(_0x16d64b,_0x4c42c3){return client[_0x2f44('0xd')](_0x27015d,_0x49ead8)[_0x2f44('0xe')](function(_0x1c7a1c){logger[_0x2f44('0xf')](_0x2f44('0x10'),_0xe4df0b,_0x2f44('0x11'));logger[_0x2f44('0x12')](_0x2f44('0x13'),_0xe4df0b,_0x2f44('0x11'),JSON[_0x2f44('0x14')](_0x1c7a1c));if(_0x1c7a1c[_0x2f44('0x15')]){if(_0x1c7a1c['error'][_0x2f44('0x16')]===0x1f4){logger[_0x2f44('0x15')](_0x2f44('0x10'),_0xe4df0b,_0x1c7a1c[_0x2f44('0x15')][_0x2f44('0x17')]);return _0x4c42c3(_0x1c7a1c[_0x2f44('0x15')][_0x2f44('0x17')]);}logger[_0x2f44('0x15')](_0x2f44('0x10'),_0xe4df0b,_0x1c7a1c[_0x2f44('0x15')][_0x2f44('0x17')]);return _0x16d64b(_0x1c7a1c[_0x2f44('0x15')][_0x2f44('0x17')]);}else{logger['info'](_0x2f44('0x10'),_0xe4df0b,'request\x20sent');_0x16d64b(_0x1c7a1c['result'][_0x2f44('0x17')]);}})['catch'](function(_0x42b421){logger[_0x2f44('0x15')]('CmHopper,\x20%s,\x20%s',_0xe4df0b,_0x42b421);_0x4c42c3(_0x42b421);});});}exports['GetCmHopper']=function(_0xa9d2f){var _0x2ae927=this;return new Promise(function(_0x4a28da,_0x19d512){return db[_0x2f44('0x18')][_0x2f44('0x19')]({'raw':_0xa9d2f['options']?_0xa9d2f[_0x2f44('0x1a')][_0x2f44('0x1b')]===undefined?!![]:![]:!![],'where':_0xa9d2f['options']?_0xa9d2f[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':_0xa9d2f[_0x2f44('0x1a')]?_0xa9d2f[_0x2f44('0x1a')][_0x2f44('0x1d')]||null:null,'limit':_0xa9d2f[_0x2f44('0x1a')]?_0xa9d2f[_0x2f44('0x1a')][_0x2f44('0x1e')]||null:null,'include':_0xa9d2f[_0x2f44('0x1a')]?_0xa9d2f[_0x2f44('0x1a')][_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0xa9d2f[_0x2f44('0x1a')]['include'],function(_0x166301){return{'model':db[_0x166301['model']],'as':_0x166301['as'],'attributes':_0x166301[_0x2f44('0x1d')],'include':_0x166301['include']?_['map'](_0x166301[_0x2f44('0x1f')],function(_0xeb1215){return{'model':db[_0xeb1215['model']],'as':_0xeb1215['as'],'attributes':_0xeb1215['attributes'],'include':_0xeb1215[_0x2f44('0x1f')]?_['map'](_0xeb1215[_0x2f44('0x1f')],function(_0x394e0a){return{'model':db[_0x394e0a['model']],'as':_0x394e0a['as'],'attributes':_0x394e0a[_0x2f44('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1460d9){logger[_0x2f44('0xf')]('GetCmHopper',_0xa9d2f);logger[_0x2f44('0x12')](_0x2f44('0x21'),_0xa9d2f,JSON[_0x2f44('0x14')](_0x1460d9));_0x4a28da(_0x1460d9);})['catch'](function(_0x9eb63c){logger[_0x2f44('0x15')](_0x2f44('0x21'),_0x9eb63c['message'],_0xa9d2f);_0x19d512(_0x2ae927[_0x2f44('0x15')](0x1f4,_0x9eb63c[_0x2f44('0x17')]));});});};exports[_0x2f44('0x22')]=function(_0x12c311){var _0x14ea09=this;return new Promise(function(_0x40f7b3,_0x1e8b66){return db[_0x2f44('0x18')][_0x2f44('0x23')]({'raw':_0x12c311[_0x2f44('0x1a')]?_0x12c311[_0x2f44('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x12c311['options']?_0x12c311[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':_0x12c311[_0x2f44('0x1a')]?_0x12c311[_0x2f44('0x1a')][_0x2f44('0x1d')]||null:null,'include':_0x12c311[_0x2f44('0x1a')]?_0x12c311[_0x2f44('0x1a')][_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x12c311['options'][_0x2f44('0x1f')],function(_0x373e2a){return{'model':db[_0x373e2a['model']],'as':_0x373e2a['as'],'attributes':_0x373e2a['attributes'],'include':_0x373e2a[_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x373e2a[_0x2f44('0x1f')],function(_0x5778c9){return{'model':db[_0x5778c9[_0x2f44('0x24')]],'as':_0x5778c9['as'],'attributes':_0x5778c9['attributes'],'include':_0x5778c9[_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x5778c9[_0x2f44('0x1f')],function(_0x9ff77e){return{'model':db[_0x9ff77e['model']],'as':_0x9ff77e['as'],'attributes':_0x9ff77e[_0x2f44('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2f44('0xe')](function(_0x1bf518){logger[_0x2f44('0xf')](_0x2f44('0x22'),_0x12c311);logger['debug'](_0x2f44('0x22'),_0x12c311,JSON['stringify'](_0x1bf518));_0x40f7b3(_0x1bf518);})[_0x2f44('0x25')](function(_0x2249f5){logger[_0x2f44('0x15')]('ShowCmHopper',_0x2249f5[_0x2f44('0x17')],_0x12c311);_0x1e8b66(_0x14ea09[_0x2f44('0x15')](0x1f4,_0x2249f5[_0x2f44('0x17')]));});});};exports['CreateCmHopper']=function(_0x4f486e){var _0x56477b=this;return new Promise(function(_0x182a11,_0x56eb4c){return db[_0x2f44('0x18')][_0x2f44('0x26')](_0x4f486e[_0x2f44('0x27')],{'raw':_0x4f486e['options']?_0x4f486e[_0x2f44('0x1a')][_0x2f44('0x1b')]===undefined?!![]:![]:!![]})[_0x2f44('0xe')](function(_0x35d9bb){logger[_0x2f44('0xf')](_0x2f44('0x28'),_0x4f486e);logger[_0x2f44('0x12')]('CreateCmHopper',_0x4f486e,JSON[_0x2f44('0x14')](_0x35d9bb));_0x182a11(_0x35d9bb);})[_0x2f44('0x25')](function(_0x4345a9){logger['error'](_0x2f44('0x28'),_0x4345a9[_0x2f44('0x17')],_0x4f486e);_0x56eb4c(_0x56477b[_0x2f44('0x15')](0x1f4,_0x4345a9[_0x2f44('0x17')]));});});};exports['UpdateCmHopper']=function(_0x567c58){var _0x9c4290=this;return new Promise(function(_0x52c8fc,_0x1b9922){return db[_0x2f44('0x18')][_0x2f44('0x29')](_0x567c58[_0x2f44('0x27')],{'raw':_0x567c58[_0x2f44('0x1a')]?_0x567c58[_0x2f44('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x567c58[_0x2f44('0x1a')]?_0x567c58[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':_0x567c58[_0x2f44('0x1a')]?_0x567c58['options'][_0x2f44('0x1d')]||null:null,'limit':_0x567c58[_0x2f44('0x1a')]?_0x567c58[_0x2f44('0x1a')][_0x2f44('0x1e')]||null:null})[_0x2f44('0xe')](function(_0x48f3e8){logger[_0x2f44('0xf')](_0x2f44('0x2a'),_0x567c58);logger[_0x2f44('0x12')](_0x2f44('0x2a'),_0x567c58,JSON[_0x2f44('0x14')](_0x48f3e8));_0x52c8fc(_0x48f3e8);})[_0x2f44('0x25')](function(_0x13a97f){logger[_0x2f44('0x15')](_0x2f44('0x2a'),_0x13a97f['message'],_0x567c58);_0x1b9922(_0x9c4290[_0x2f44('0x15')](0x1f4,_0x13a97f[_0x2f44('0x17')]));});});};exports[_0x2f44('0x2b')]=function(_0x10eb34){var _0x27a57c=this;return new Promise(function(_0x56ba74,_0x3db628){return db[_0x2f44('0x18')][_0x2f44('0x2c')]({'where':_0x10eb34[_0x2f44('0x1a')]?_0x10eb34[_0x2f44('0x1a')]['where']||null:null})[_0x2f44('0xe')](function(_0x4efed5){logger[_0x2f44('0xf')](_0x2f44('0x2b'),_0x10eb34);logger[_0x2f44('0x12')](_0x2f44('0x2b'),_0x10eb34,JSON[_0x2f44('0x14')](_0x4efed5));_0x56ba74(_0x4efed5);})['catch'](function(_0x51584b){logger[_0x2f44('0x15')](_0x2f44('0x2b'),_0x51584b[_0x2f44('0x17')],_0x10eb34);_0x3db628(_0x27a57c['error'](0x1f4,_0x51584b[_0x2f44('0x17')]));});});};exports[_0x2f44('0x2d')]=function(_0x211c80){var _0x51270a=this;return new Promise(function(_0x3d3c49,_0x4fe479){return db[_0x2f44('0x2e')][_0x2f44('0x2f')]()[_0x2f44('0xe')](function(_0xcde749){return db[_0x2f44('0x30')]['transaction'](function(_0x4d9cef){return db[_0x2f44('0x18')][_0x2f44('0x19')]({'where':_0x211c80[_0x2f44('0x1a')]?_0x211c80[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':_0x211c80[_0x2f44('0x1a')]?_0x211c80[_0x2f44('0x1a')][_0x2f44('0x1d')]||null:null,'limit':_0x211c80[_0x2f44('0x1a')]?_0x211c80[_0x2f44('0x1a')][_0x2f44('0x1e')]||null:null,'order':_0x211c80[_0x2f44('0x1a')]?_0x211c80[_0x2f44('0x1a')]['order']||null:null,'transaction':_0x4d9cef,'lock':_0x4d9cef[_0x2f44('0x31')][_0x2f44('0x32')],'include':[{'model':db[_0x2f44('0x2e')],'as':_0x2f44('0x33'),'attributes':_[_0x2f44('0x34')](_0xcde749)},{'model':db['User'],'as':'Agent','attributes':['id','name','voicePause']}]})[_0x2f44('0xe')](function(_0x381df4){var _0x23729c=[];var _0x442698=[];for(var _0x439656=0x0;_0x439656<_0x381df4[_0x2f44('0x35')];_0x439656+=0x1){if(!_0x442698[_0x2f44('0x36')](_0x381df4[_0x439656][_0x2f44('0x37')])){_0x442698[_0x2f44('0x38')](_0x381df4[_0x439656][_0x2f44('0x37')]);_0x23729c[_0x2f44('0x38')](_0x381df4[_0x439656][_0x2f44('0x29')](_0x211c80[_0x2f44('0x27')],{'transaction':_0x4d9cef}));}}return BPromise['all'](_0x23729c);});})[_0x2f44('0xe')](function(_0x18fa55){logger[_0x2f44('0xf')](_0x2f44('0x2d'),_0x211c80);logger[_0x2f44('0x12')](_0x2f44('0x2d'),_0x211c80,JSON[_0x2f44('0x14')](_0x18fa55));_0x3d3c49(_0x18fa55);})[_0x2f44('0x25')](function(_0x2ef9f7){logger[_0x2f44('0x15')]('GetContactDialer',_0x2ef9f7[_0x2f44('0x17')],_0x211c80);_0x4fe479(_0x51270a['error'](0x1f4,_0x2ef9f7[_0x2f44('0x17')]));});});});};exports[_0x2f44('0x39')]=function(_0x474240){var _0x593c1b=this;return new Promise(function(_0x4e50d5,_0x51e52e){return db[_0x2f44('0x30')][_0x2f44('0x3a')](function(_0x466e38){return db[_0x2f44('0x3b')][_0x2f44('0x26')](_0x474240[_0x2f44('0x27')],{'raw':_0x474240[_0x2f44('0x1a')]?_0x474240[_0x2f44('0x1a')]['raw']===undefined?!![]:![]:!![],'transaction':_0x466e38})[_0x2f44('0xe')](function(){return db[_0x2f44('0x18')][_0x2f44('0x2c')]({'where':_0x474240[_0x2f44('0x1a')]?_0x474240['options'][_0x2f44('0x1c')]||null:null,'transaction':_0x466e38});});})['then'](function(_0x9065dd){logger['info']('MoveContactManagedDialer',_0x474240);logger['debug']('MoveContactManagedDialer',_0x474240,JSON['stringify'](_0x9065dd));_0x4e50d5(_0x9065dd);})[_0x2f44('0x25')](function(_0x3a621b){logger[_0x2f44('0x15')]('MoveContactManagedDialer',_0x3a621b[_0x2f44('0x17')],_0x474240);_0x51e52e(_0x593c1b[_0x2f44('0x15')](0x1f4,_0x3a621b[_0x2f44('0x17')]));});});};exports[_0x2f44('0x3c')]=function(_0x1e41a6){var _0x3ac50f=this;return new Promise(function(_0x391dcc,_0x38e120){return db[_0x2f44('0x18')][_0x2f44('0x19')]({'raw':_0x1e41a6['options']?_0x1e41a6[_0x2f44('0x1a')][_0x2f44('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e41a6[_0x2f44('0x1a')]?_0x1e41a6[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':[[db[_0x2f44('0x30')]['fn']('COUNT',db[_0x2f44('0x30')]['fn']('IF',db[_0x2f44('0x30')][_0x2f44('0x3d')]('`scheduledat`\x20>=\x20'+util[_0x2f44('0x3e')](_0x2f44('0x3f'),moment()[_0x2f44('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0x2f44('0x40')]]})['then'](function(_0x412168){logger[_0x2f44('0xf')](_0x2f44('0x3c'),_0x1e41a6);logger[_0x2f44('0x12')]('CountReScheduled',_0x1e41a6,JSON['stringify'](_0x412168));_0x391dcc(_0x412168);})['catch'](function(_0x489de3){logger[_0x2f44('0x15')](_0x2f44('0x3c'),_0x489de3[_0x2f44('0x17')],_0x1e41a6);_0x38e120(_0x3ac50f[_0x2f44('0x15')](0x1f4,_0x489de3[_0x2f44('0x17')]));});});};exports[_0x2f44('0x41')]=function(_0x252bfb){var _0x290839=this;return new Promise(function(_0x220fb6,_0x417fcc){return db[_0x2f44('0x2e')][_0x2f44('0x2f')]()[_0x2f44('0xe')](function(_0x44d2a4){return db['sequelize'][_0x2f44('0x3a')](function(_0x5e213c){return db[_0x2f44('0x18')][_0x2f44('0x19')]({'where':_0x252bfb['options']?_0x252bfb[_0x2f44('0x1a')][_0x2f44('0x1c')]||null:null,'attributes':_0x252bfb['options']?_0x252bfb[_0x2f44('0x1a')][_0x2f44('0x1d')]||null:null,'limit':0x1,'order':_0x252bfb[_0x2f44('0x1a')]?_0x252bfb['options'][_0x2f44('0x42')]||null:null,'group':db[_0x2f44('0x18')][_0x2f44('0x37')],'transaction':_0x5e213c,'lock':_0x5e213c[_0x2f44('0x31')][_0x2f44('0x32')],'include':_0x252bfb['options']?_0x252bfb[_0x2f44('0x1a')][_0x2f44('0x1f')]?_['map'](_0x252bfb[_0x2f44('0x1a')][_0x2f44('0x1f')],function(_0x54673c){return{'model':db[_0x54673c[_0x2f44('0x24')]],'as':_0x54673c['as'],'attributes':_0x54673c[_0x2f44('0x1d')],'include':_0x54673c[_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x54673c[_0x2f44('0x1f')],function(_0x350fc7){return{'model':db[_0x350fc7[_0x2f44('0x24')]],'as':_0x350fc7['as'],'attributes':_0x350fc7[_0x2f44('0x1d')],'include':_0x350fc7[_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x350fc7[_0x2f44('0x1f')],function(_0x320b43){return{'model':db[_0x320b43[_0x2f44('0x24')]],'as':_0x320b43['as'],'attributes':_0x320b43[_0x2f44('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2f44('0xe')](function(_0xf0c4ca){var _0x1e9496=[];for(var _0x53c059=0x0;_0x53c059<_0xf0c4ca[_0x2f44('0x35')];_0x53c059+=0x1){_0x1e9496[_0x2f44('0x38')](_0xf0c4ca[_0x53c059][_0x2f44('0x29')](_0x252bfb[_0x2f44('0x27')],{'transaction':_0x5e213c}));}return BPromise[_0x2f44('0x43')](_0x1e9496);});})[_0x2f44('0xe')](function(_0x450f2a){logger[_0x2f44('0xf')]('GetContactRecallMe',_0x252bfb);logger[_0x2f44('0x12')]('GetContactRecallMe',_0x252bfb,JSON[_0x2f44('0x14')](_0x450f2a));_0x220fb6(_0x450f2a);})['catch'](function(_0x409860){logger[_0x2f44('0x15')]('GetContactRecallMe',_0x409860[_0x2f44('0x17')],_0x252bfb);_0x417fcc(_0x290839['error'](0x1f4,_0x409860['message']));});});});};exports[_0x2f44('0x44')]=function(_0x1c6f24){var _0x2a7a1e=this;return new Promise(function(_0xd883f7,_0x55ba84){db['CmContact'][_0x2f44('0x2f')]()['then'](function(_0x2b2b25){return db[_0x2f44('0x18')]['findAll']({'raw':_0x1c6f24['options']?_0x1c6f24['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c6f24[_0x2f44('0x1a')]?_0x1c6f24[_0x2f44('0x1a')]['where']||null:null,'attributes':_0x1c6f24['options']?_0x1c6f24['options']['attributes']||null:null,'limit':_0x1c6f24[_0x2f44('0x1a')]?_0x1c6f24[_0x2f44('0x1a')][_0x2f44('0x1e')]||null:null,'include':_0x1c6f24[_0x2f44('0x1a')]?_0x1c6f24[_0x2f44('0x1a')][_0x2f44('0x1f')]?_['map'](_0x1c6f24[_0x2f44('0x1a')][_0x2f44('0x1f')],function(_0x19cb69){return{'model':db[_0x19cb69[_0x2f44('0x24')]],'as':_0x19cb69['as'],'attributes':_0x19cb69['as']===_0x2f44('0x33')?_[_0x2f44('0x34')](_0x2b2b25):_0x19cb69[_0x2f44('0x1d')],'include':_0x19cb69[_0x2f44('0x1f')]?_[_0x2f44('0x20')](_0x19cb69[_0x2f44('0x1f')],function(_0x31b7b9){return{'model':db[_0x31b7b9[_0x2f44('0x24')]],'as':_0x31b7b9['as'],'attributes':_0x31b7b9[_0x2f44('0x1d')],'include':_0x31b7b9[_0x2f44('0x1f')]?_['map'](_0x31b7b9[_0x2f44('0x1f')],function(_0x26c267){return{'model':db[_0x26c267[_0x2f44('0x24')]],'as':_0x26c267['as'],'attributes':_0x26c267['attributes']};}):[]};}):[]};}):[]:[]})[_0x2f44('0xe')](function(_0x1f9dd2){logger[_0x2f44('0xf')](_0x2f44('0x21'),_0x1c6f24);logger[_0x2f44('0x12')](_0x2f44('0x21'),_0x1c6f24,JSON['stringify'](_0x1f9dd2));_0xd883f7(_0x1f9dd2);})[_0x2f44('0x25')](function(_0x2687dc){logger['error'](_0x2f44('0x21'),_0x2687dc['message'],_0x1c6f24);_0x55ba84(_0x2a7a1e['error'](0x1f4,_0x2687dc['message']));});});});};exports[_0x2f44('0x45')]=function(_0x92dc7c){console[_0x2f44('0x46')](_0x2f44('0x47'),_0x92dc7c);console['log'](_0x2f44('0x48'),_0x92dc7c[_0x2f44('0x1a')][_0x2f44('0x1c')][_0x2f44('0x49')]);_this=this;return new Promise(function(_0x315874,_0x12529e){return db[_0x2f44('0x2e')][_0x2f44('0x4a')]({'raw':!![],'where':{'phone':_0x92dc7c[_0x2f44('0x1a')][_0x2f44('0x1c')][_0x2f44('0x49')]},'attributes':['id',_0x2f44('0x4b')],'order':[['id','DESC']]})['then'](function(_0x321561){console[_0x2f44('0x46')](_0x2f44('0x4c'),_0x321561);logger[_0x2f44('0xf')](_0x2f44('0x4d'),_0x92dc7c);logger[_0x2f44('0x12')](_0x2f44('0x4d'),_0x92dc7c,JSON[_0x2f44('0x14')](_0x321561));_0x315874(_0x321561);})[_0x2f44('0x25')](function(_0x39aced){logger[_0x2f44('0x15')](_0x2f44('0x4d'),_0x39aced[_0x2f44('0x17')],_0x92dc7c);_0x12529e(_this['error'](0x1f4,_0x39aced[_0x2f44('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 7efe284..0447818 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 _0xb4c7=['post','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','/describe','describe','isAuthenticated','getOpenContacts','/timezones','getTimezones','/:id','show','create'];(function(_0x14984d,_0x545d1d){var _0x2fc18f=function(_0x3f69bd){while(--_0x3f69bd){_0x14984d['push'](_0x14984d['shift']());}};_0x2fc18f(++_0x545d1d);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1429ea,_0x3589ab){_0x1429ea=_0x1429ea-0x0;var _0x1ab858=_0xb4c7[_0x1429ea];return _0x1ab858;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var auth=require(_0x7b4c('0x5'));var interaction=require(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var controller=require(_0x7b4c('0x8'));router[_0x7b4c('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xa')]);router[_0x7b4c('0x9')](_0x7b4c('0xb'),auth['isAuthenticated'](),controller[_0x7b4c('0xc')]);router[_0x7b4c('0x9')]('/opencontacts',auth[_0x7b4c('0xd')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0x9')](_0x7b4c('0xf'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x10')]);router[_0x7b4c('0x9')](_0x7b4c('0x11'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b4c('0x13')]);router[_0x7b4c('0x14')](_0x7b4c('0x15'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x16')]);router[_0x7b4c('0x14')](_0x7b4c('0x17'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x18')]);router[_0x7b4c('0x19')]('/:id',auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x1a')]);router[_0x7b4c('0x1b')](_0x7b4c('0x11'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x1c')]);module[_0x7b4c('0x1d')]=router; \ No newline at end of file +var _0x81bd=['../../components/auth/service','../../config/environment','./cmHopper.controller','get','index','/describe','isAuthenticated','getOpenContacts','/timezones','getTimezones','/:id','show','post','create','/preview','getPreview','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x26c0a1,_0x300910){var _0x121382=function(_0x57cd56){while(--_0x57cd56){_0x26c0a1['push'](_0x26c0a1['shift']());}};_0x121382(++_0x300910);}(_0x81bd,0x7c));var _0xd81b=function(_0x2b5c60,_0xddad37){_0x2b5c60=_0x2b5c60-0x0;var _0x40ef50=_0x81bd[_0x2b5c60];return _0x40ef50;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var auth=require(_0xd81b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd81b('0x7'));var controller=require(_0xd81b('0x8'));router[_0xd81b('0x9')]('/',auth['isAuthenticated'](),controller[_0xd81b('0xa')]);router[_0xd81b('0x9')](_0xd81b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd81b('0x9')]('/opencontacts',auth[_0xd81b('0xc')](),controller[_0xd81b('0xd')]);router[_0xd81b('0x9')](_0xd81b('0xe'),auth[_0xd81b('0xc')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x9')](_0xd81b('0x10'),auth[_0xd81b('0xc')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x12')]('/',auth[_0xd81b('0xc')](),controller[_0xd81b('0x13')]);router['post'](_0xd81b('0x14'),auth['isAuthenticated'](),controller[_0xd81b('0x15')]);router[_0xd81b('0x12')]('/timezone',auth[_0xd81b('0xc')](),controller['getTimezone']);router[_0xd81b('0x16')](_0xd81b('0x10'),auth[_0xd81b('0xc')](),controller[_0xd81b('0x17')]);router[_0xd81b('0x18')]('/:id',auth[_0xd81b('0xc')](),controller[_0xd81b('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 244c417..ae820cc 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 _0x10b4=['DATE','YYYY-MM-DD\x20HH:mm:ss','exports','INTEGER','STRING'];(function(_0x41f239,_0x2141fe){var _0x3e6ce7=function(_0x2281d2){while(--_0x2281d2){_0x41f239['push'](_0x41f239['shift']());}};_0x3e6ce7(++_0x2141fe);}(_0x10b4,0x11a));var _0x410b=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x10b4[_0x1ddedd];return _0xa3e1ac;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x410b('0x0')]={'CmHopperId':{'type':Sequelize[_0x410b('0x1')]},'phone':{'type':Sequelize[_0x410b('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x410b('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x410b('0x3')],'defaultValue':moment()['format'](_0x410b('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x410b('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x410b('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x410b('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x410b('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x410b('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x410b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x19ea=['sequelize','exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x1bc1ad,_0x244f95){var _0x3fa4d3=function(_0x2a5cec){while(--_0x2a5cec){_0x1bc1ad['push'](_0x1bc1ad['shift']());}};_0x3fa4d3(++_0x244f95);}(_0x19ea,0x1db));var _0xa19e=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x19ea[_0x1e6e4e];return _0x3d746b;};'use strict';var moment=require(_0xa19e('0x0'));var Sequelize=require(_0xa19e('0x1'));module[_0xa19e('0x2')]={'CmHopperId':{'type':Sequelize[_0xa19e('0x3')]},'phone':{'type':Sequelize[_0xa19e('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xa19e('0x5')],'defaultValue':moment()['format'](_0xa19e('0x6'))},'countbusyretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa19e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa19e('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 8c090a0..08ea076 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 _0x22d1=['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','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','reject','save','update','then','UserProfileResource','destroy','end','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','catch','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmHopperAdditionalPhones','UserProfileSection','autoAssociation','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox'];(function(_0x3e229b,_0x346584){var _0x329ad6=function(_0xa2ef02){while(--_0xa2ef02){_0x3e229b['push'](_0x3e229b['shift']());}};_0x329ad6(++_0x346584);}(_0x22d1,0x93));var _0x122d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x22d1[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x122d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x122d('0x1'));var zipdir=require(_0x122d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x122d('0x3'));var moment=require('moment');var BPromise=require(_0x122d('0x4'));var Mustache=require(_0x122d('0x5'));var util=require(_0x122d('0x6'));var path=require(_0x122d('0x7'));var sox=require(_0x122d('0x8'));var csv=require(_0x122d('0x9'));var ejs=require(_0x122d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x122d('0xb'));var crypto=require(_0x122d('0xc'));var jsforce=require(_0x122d('0xd'));var deskjs=require(_0x122d('0xe'));var toCsv=require(_0x122d('0x9'));var querystring=require(_0x122d('0xf'));var Papa=require(_0x122d('0x10'));var Redis=require(_0x122d('0x11'));var authService=require(_0x122d('0x12'));var qs=require(_0x122d('0x13'));var as=require(_0x122d('0x14'));var hardwareService=require(_0x122d('0x15'));var logger=require(_0x122d('0x16'))('api');var utils=require(_0x122d('0x17'));var config=require('../../config/environment');var db=require(_0x122d('0x18'))['db'];function respondWithStatusCode(_0x4b57ca,_0x1c444e){_0x1c444e=_0x1c444e||0xcc;return function(_0x26bd89){if(_0x26bd89){return _0x4b57ca[_0x122d('0x19')](_0x1c444e);}return _0x4b57ca[_0x122d('0x1a')](_0x1c444e)['end']();};}function respondWithResult(_0x297065,_0x208765){_0x208765=_0x208765||0xc8;return function(_0x40a65c){if(_0x40a65c){return _0x297065['status'](_0x208765)['json'](_0x40a65c);}};}function respondWithFilteredResult(_0x1613fb,_0x5ecd45){return function(_0x3f4a54){if(_0x3f4a54){var _0x28cbde=_0x3f4a54[_0x122d('0x1b')],_0x19a52f=_0x5ecd45[_0x122d('0x1c')],_0x41e949=_0x5ecd45[_0x122d('0x1c')]+_0x5ecd45[_0x122d('0x1d')],_0x4c3638;if(_0x41e949>=_0x28cbde){_0x41e949=_0x28cbde;_0x4c3638=0xc8;}else{_0x4c3638=0xce;}_0x1613fb[_0x122d('0x1a')](_0x4c3638);return _0x1613fb['set'](_0x122d('0x1e'),_0x19a52f+'-'+_0x41e949+'/'+_0x28cbde)[_0x122d('0x1f')](_0x3f4a54);}return null;};}function patchUpdates(_0x283aa0){return function(_0x4e3dd4){try{jsonpatch['apply'](_0x4e3dd4,_0x283aa0,!![]);}catch(_0x300466){return BPromise[_0x122d('0x20')](_0x300466);}return _0x4e3dd4[_0x122d('0x21')]();};}function saveUpdates(_0x3a4081,_0x8c887e){return function(_0x7a7ea0){if(_0x7a7ea0){return _0x7a7ea0[_0x122d('0x22')](_0x3a4081)['then'](function(_0xbc84ee){return _0xbc84ee;});}return null;};}function removeEntity(_0x1c749e,_0x1818b8){return function(_0x5651e0){if(_0x5651e0){return _0x5651e0['destroy']()[_0x122d('0x23')](function(){var _0x42c7d3=_0x5651e0['get']({'plain':!![]});var _0x2949ab='CmHopperAdditionalPhones';return db[_0x122d('0x24')][_0x122d('0x25')]({'where':{'type':_0x2949ab,'resourceId':_0x42c7d3['id']}})['then'](function(){return _0x5651e0;});})[_0x122d('0x23')](function(){_0x1c749e[_0x122d('0x1a')](0xcc)[_0x122d('0x26')]();});}};}function handleEntityNotFound(_0x7c909d,_0x1403c9){return function(_0x1a3861){if(!_0x1a3861){_0x7c909d[_0x122d('0x19')](0x194);}return _0x1a3861;};}function handleError(_0x358e14,_0xbf86f){_0xbf86f=_0xbf86f||0x1f4;return function(_0x5bebc0){logger['error'](_0x5bebc0[_0x122d('0x27')]);if(_0x5bebc0[_0x122d('0x28')]){delete _0x5bebc0[_0x122d('0x28')];}_0x358e14[_0x122d('0x1a')](_0xbf86f)['send'](_0x5bebc0);};}exports[_0x122d('0x29')]=function(_0x2a48a6,_0x4bc096){var _0x44918d={},_0x36929d={},_0x26d801={'count':0x0,'rows':[]};var _0x258bcb=_[_0x122d('0x2a')](db[_0x122d('0x2b')][_0x122d('0x2c')],function(_0x177424){return{'name':_0x177424[_0x122d('0x2d')],'type':_0x177424['type'][_0x122d('0x2e')]};});_0x36929d[_0x122d('0x2f')]=_['map'](_0x258bcb,_0x122d('0x28'));_0x36929d['query']=_[_0x122d('0x30')](_0x2a48a6[_0x122d('0x31')]);_0x36929d[_0x122d('0x32')]=_[_0x122d('0x33')](_0x36929d[_0x122d('0x2f')],_0x36929d[_0x122d('0x31')]);_0x44918d[_0x122d('0x34')]=_[_0x122d('0x33')](_0x36929d['model'],qs[_0x122d('0x35')](_0x2a48a6[_0x122d('0x31')][_0x122d('0x35')]));_0x44918d[_0x122d('0x34')]=_0x44918d[_0x122d('0x34')][_0x122d('0x36')]?_0x44918d[_0x122d('0x34')]:_0x36929d[_0x122d('0x2f')];if(!_0x2a48a6[_0x122d('0x31')]['hasOwnProperty']('nolimit')){_0x44918d[_0x122d('0x1d')]=qs['limit'](_0x2a48a6[_0x122d('0x31')][_0x122d('0x1d')]);_0x44918d[_0x122d('0x1c')]=qs[_0x122d('0x1c')](_0x2a48a6['query'][_0x122d('0x1c')]);}_0x44918d[_0x122d('0x37')]=qs[_0x122d('0x38')](_0x2a48a6[_0x122d('0x31')][_0x122d('0x38')]);_0x44918d['where']=qs['filters'](_[_0x122d('0x39')](_0x2a48a6['query'],_0x36929d[_0x122d('0x32')]),_0x258bcb);if(_0x2a48a6[_0x122d('0x31')][_0x122d('0x3a')]){_0x44918d[_0x122d('0x3b')]=_['merge'](_0x44918d[_0x122d('0x3b')],{'$or':_[_0x122d('0x2a')](_0x258bcb,function(_0x16e70c){if(_0x16e70c[_0x122d('0x3c')]!==_0x122d('0x3d')){var _0x135e4f={};_0x135e4f[_0x16e70c['name']]={'$like':'%'+_0x2a48a6[_0x122d('0x31')][_0x122d('0x3a')]+'%'};return _0x135e4f;}})});}_0x44918d=_[_0x122d('0x3e')]({},_0x44918d,_0x2a48a6['options']);var _0x863a87={'where':_0x44918d[_0x122d('0x3b')]};return db[_0x122d('0x2b')]['count'](_0x863a87)[_0x122d('0x23')](function(_0x34bb81){_0x26d801[_0x122d('0x1b')]=_0x34bb81;if(_0x2a48a6[_0x122d('0x31')][_0x122d('0x3f')]){_0x44918d[_0x122d('0x40')]=[{'all':!![]}];}return db[_0x122d('0x2b')][_0x122d('0x41')](_0x44918d);})['then'](function(_0x42ae6d){_0x26d801['rows']=_0x42ae6d;return _0x26d801;})[_0x122d('0x23')](respondWithFilteredResult(_0x4bc096,_0x44918d))[_0x122d('0x42')](handleError(_0x4bc096,null));};exports['show']=function(_0x4a06db,_0x3afe9a){var _0x3bd3ff={'raw':!![],'where':{'id':_0x4a06db[_0x122d('0x43')]['id']}},_0x3bf3ce={};_0x3bf3ce[_0x122d('0x2f')]=_['keys'](db[_0x122d('0x2b')][_0x122d('0x2c')]);_0x3bf3ce[_0x122d('0x31')]=_[_0x122d('0x30')](_0x4a06db[_0x122d('0x31')]);_0x3bf3ce[_0x122d('0x32')]=_[_0x122d('0x33')](_0x3bf3ce[_0x122d('0x2f')],_0x3bf3ce[_0x122d('0x31')]);_0x3bd3ff['attributes']=_['intersection'](_0x3bf3ce[_0x122d('0x2f')],qs['fields'](_0x4a06db[_0x122d('0x31')][_0x122d('0x35')]));_0x3bd3ff['attributes']=_0x3bd3ff[_0x122d('0x34')][_0x122d('0x36')]?_0x3bd3ff[_0x122d('0x34')]:_0x3bf3ce[_0x122d('0x2f')];if(_0x4a06db[_0x122d('0x31')][_0x122d('0x3f')]){_0x3bd3ff[_0x122d('0x40')]=[{'all':!![]}];}_0x3bd3ff=_[_0x122d('0x3e')]({},_0x3bd3ff,_0x4a06db['options']);return db[_0x122d('0x2b')][_0x122d('0x44')](_0x3bd3ff)['then'](handleEntityNotFound(_0x3afe9a,null))[_0x122d('0x23')](respondWithResult(_0x3afe9a,null))[_0x122d('0x42')](handleError(_0x3afe9a,null));};exports[_0x122d('0x45')]=function(_0x4c861d,_0x8e9ea){return db[_0x122d('0x2b')][_0x122d('0x45')](_0x4c861d[_0x122d('0x46')],{})[_0x122d('0x23')](function(_0x4f52b3){var _0x43c264=_0x4c861d['user'][_0x122d('0x47')]({'plain':!![]});if(!_0x43c264)throw new Error(_0x122d('0x48'));if(_0x43c264[_0x122d('0x49')]===_0x122d('0x4a')){var _0x100eb8=_0x4f52b3[_0x122d('0x47')]({'plain':!![]});var _0x45404e=_0x122d('0x4b');return db[_0x122d('0x4c')][_0x122d('0x44')]({'where':{'name':_0x45404e,'userProfileId':_0x43c264['userProfileId']},'raw':!![]})[_0x122d('0x23')](function(_0x21ef3c){if(_0x21ef3c&&_0x21ef3c[_0x122d('0x4d')]===0x0){return db[_0x122d('0x24')][_0x122d('0x45')]({'name':_0x100eb8[_0x122d('0x28')],'resourceId':_0x100eb8['id'],'type':_0x21ef3c[_0x122d('0x28')],'sectionId':_0x21ef3c['id']},{})[_0x122d('0x23')](function(){return _0x4f52b3;});}else{return _0x4f52b3;}})[_0x122d('0x42')](function(_0x377cbe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x377cbe);throw _0x377cbe;});}return _0x4f52b3;})['then'](respondWithResult(_0x8e9ea,0xc9))[_0x122d('0x42')](handleError(_0x8e9ea,null));};exports[_0x122d('0x22')]=function(_0x56ea21,_0x9e42f6){if(_0x56ea21[_0x122d('0x46')]['id']){delete _0x56ea21['body']['id'];}return db['CmHopperAdditionalPhone'][_0x122d('0x44')]({'where':{'id':_0x56ea21[_0x122d('0x43')]['id']}})[_0x122d('0x23')](handleEntityNotFound(_0x9e42f6,null))[_0x122d('0x23')](saveUpdates(_0x56ea21[_0x122d('0x46')],null))['then'](respondWithResult(_0x9e42f6,null))[_0x122d('0x42')](handleError(_0x9e42f6,null));};exports[_0x122d('0x25')]=function(_0x33e5ff,_0x1b832f){return db[_0x122d('0x2b')][_0x122d('0x44')]({'where':{'id':_0x33e5ff[_0x122d('0x43')]['id']}})[_0x122d('0x23')](handleEntityNotFound(_0x1b832f,null))[_0x122d('0x23')](removeEntity(_0x1b832f,null))[_0x122d('0x42')](handleError(_0x1b832f,null));}; \ No newline at end of file +var _0x1126=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','json','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse'];(function(_0x5abc37,_0x45b4bf){var _0x151100=function(_0x2cb47a){while(--_0x2cb47a){_0x5abc37['push'](_0x5abc37['shift']());}};_0x151100(++_0x45b4bf);}(_0x1126,0xe0));var _0x6112=function(_0x44ca27,_0x81f0da){_0x44ca27=_0x44ca27-0x0;var _0x38bc17=_0x1126[_0x44ca27];return _0x38bc17;};'use strict';var pdf=require(_0x6112('0x0'));var emlformat=require(_0x6112('0x1'));var rimraf=require(_0x6112('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6112('0x3'));var rp=require(_0x6112('0x4'));var moment=require(_0x6112('0x5'));var BPromise=require(_0x6112('0x6'));var Mustache=require(_0x6112('0x7'));var util=require('util');var path=require('path');var sox=require(_0x6112('0x8'));var csv=require(_0x6112('0x9'));var ejs=require(_0x6112('0xa'));var fs=require('fs');var _=require(_0x6112('0xb'));var squel=require(_0x6112('0xc'));var crypto=require(_0x6112('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6112('0xe'));var toCsv=require(_0x6112('0x9'));var querystring=require('querystring');var Papa=require(_0x6112('0xf'));var Redis=require(_0x6112('0x10'));var authService=require(_0x6112('0x11'));var qs=require(_0x6112('0x12'));var as=require(_0x6112('0x13'));var hardwareService=require(_0x6112('0x14'));var logger=require(_0x6112('0x15'))('api');var utils=require(_0x6112('0x16'));var config=require(_0x6112('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38860d,_0x15b0e2){_0x15b0e2=_0x15b0e2||0xcc;return function(_0x52a0e9){if(_0x52a0e9){return _0x38860d[_0x6112('0x18')](_0x15b0e2);}return _0x38860d[_0x6112('0x19')](_0x15b0e2)[_0x6112('0x1a')]();};}function respondWithResult(_0x4bcf91,_0x1fb761){_0x1fb761=_0x1fb761||0xc8;return function(_0xcc4c59){if(_0xcc4c59){return _0x4bcf91['status'](_0x1fb761)['json'](_0xcc4c59);}};}function respondWithFilteredResult(_0x164cb6,_0x2683ce){return function(_0x2b82c3){if(_0x2b82c3){var _0x547304=_0x2b82c3[_0x6112('0x1b')],_0x52a297=_0x2683ce[_0x6112('0x1c')],_0x18ad54=_0x2683ce[_0x6112('0x1c')]+_0x2683ce['limit'],_0x3383c7;if(_0x18ad54>=_0x547304){_0x18ad54=_0x547304;_0x3383c7=0xc8;}else{_0x3383c7=0xce;}_0x164cb6[_0x6112('0x19')](_0x3383c7);return _0x164cb6[_0x6112('0x1d')]('Content-Range',_0x52a297+'-'+_0x18ad54+'/'+_0x547304)[_0x6112('0x1e')](_0x2b82c3);}return null;};}function patchUpdates(_0x3449d4){return function(_0x28ad90){try{jsonpatch['apply'](_0x28ad90,_0x3449d4,!![]);}catch(_0x146d72){return BPromise['reject'](_0x146d72);}return _0x28ad90[_0x6112('0x1f')]();};}function saveUpdates(_0x1db189,_0x172f34){return function(_0x47e6ba){if(_0x47e6ba){return _0x47e6ba[_0x6112('0x20')](_0x1db189)[_0x6112('0x21')](function(_0x2f0b50){return _0x2f0b50;});}return null;};}function removeEntity(_0x3479c6,_0x465762){return function(_0x199688){if(_0x199688){return _0x199688[_0x6112('0x22')]()[_0x6112('0x21')](function(){var _0x3346fc=_0x199688[_0x6112('0x23')]({'plain':!![]});var _0x31ed10=_0x6112('0x24');return db[_0x6112('0x25')][_0x6112('0x22')]({'where':{'type':_0x31ed10,'resourceId':_0x3346fc['id']}})[_0x6112('0x21')](function(){return _0x199688;});})[_0x6112('0x21')](function(){_0x3479c6[_0x6112('0x19')](0xcc)[_0x6112('0x1a')]();});}};}function handleEntityNotFound(_0x5b5741,_0x2e4f60){return function(_0x506b52){if(!_0x506b52){_0x5b5741[_0x6112('0x18')](0x194);}return _0x506b52;};}function handleError(_0x357115,_0x5098b6){_0x5098b6=_0x5098b6||0x1f4;return function(_0x1c4c14){logger[_0x6112('0x26')](_0x1c4c14[_0x6112('0x27')]);if(_0x1c4c14[_0x6112('0x28')]){delete _0x1c4c14['name'];}_0x357115[_0x6112('0x19')](_0x5098b6)['send'](_0x1c4c14);};}exports['index']=function(_0x4774f,_0x5e6b90){var _0x255002={},_0x21524d={},_0x3d7c0f={'count':0x0,'rows':[]};var _0xb51dd7=_['map'](db[_0x6112('0x29')][_0x6112('0x2a')],function(_0x3e5d32){return{'name':_0x3e5d32[_0x6112('0x2b')],'type':_0x3e5d32[_0x6112('0x2c')][_0x6112('0x2d')]};});_0x21524d[_0x6112('0x2e')]=_[_0x6112('0x2f')](_0xb51dd7,_0x6112('0x28'));_0x21524d[_0x6112('0x30')]=_[_0x6112('0x31')](_0x4774f['query']);_0x21524d['filters']=_[_0x6112('0x32')](_0x21524d[_0x6112('0x2e')],_0x21524d[_0x6112('0x30')]);_0x255002[_0x6112('0x33')]=_[_0x6112('0x32')](_0x21524d[_0x6112('0x2e')],qs[_0x6112('0x34')](_0x4774f['query']['fields']));_0x255002[_0x6112('0x33')]=_0x255002[_0x6112('0x33')][_0x6112('0x35')]?_0x255002['attributes']:_0x21524d[_0x6112('0x2e')];if(!_0x4774f[_0x6112('0x30')][_0x6112('0x36')]('nolimit')){_0x255002['limit']=qs[_0x6112('0x37')](_0x4774f[_0x6112('0x30')][_0x6112('0x37')]);_0x255002[_0x6112('0x1c')]=qs[_0x6112('0x1c')](_0x4774f[_0x6112('0x30')][_0x6112('0x1c')]);}_0x255002[_0x6112('0x38')]=qs['sort'](_0x4774f[_0x6112('0x30')][_0x6112('0x39')]);_0x255002[_0x6112('0x3a')]=qs[_0x6112('0x3b')](_[_0x6112('0x3c')](_0x4774f[_0x6112('0x30')],_0x21524d[_0x6112('0x3b')]),_0xb51dd7);if(_0x4774f[_0x6112('0x30')][_0x6112('0x3d')]){_0x255002[_0x6112('0x3a')]=_[_0x6112('0x3e')](_0x255002[_0x6112('0x3a')],{'$or':_[_0x6112('0x2f')](_0xb51dd7,function(_0xf0fa3c){if(_0xf0fa3c['type']!==_0x6112('0x3f')){var _0x4ba978={};_0x4ba978[_0xf0fa3c['name']]={'$like':'%'+_0x4774f[_0x6112('0x30')]['filter']+'%'};return _0x4ba978;}})});}_0x255002=_[_0x6112('0x3e')]({},_0x255002,_0x4774f[_0x6112('0x40')]);var _0x3781f2={'where':_0x255002[_0x6112('0x3a')]};return db[_0x6112('0x29')]['count'](_0x3781f2)[_0x6112('0x21')](function(_0x17a5d7){_0x3d7c0f[_0x6112('0x1b')]=_0x17a5d7;if(_0x4774f[_0x6112('0x30')][_0x6112('0x41')]){_0x255002[_0x6112('0x42')]=[{'all':!![]}];}return db[_0x6112('0x29')]['findAll'](_0x255002);})[_0x6112('0x21')](function(_0x3bbb52){_0x3d7c0f[_0x6112('0x43')]=_0x3bbb52;return _0x3d7c0f;})[_0x6112('0x21')](respondWithFilteredResult(_0x5e6b90,_0x255002))['catch'](handleError(_0x5e6b90,null));};exports[_0x6112('0x44')]=function(_0x1c0a7e,_0xcac6bb){var _0x1bbdb0={'raw':!![],'where':{'id':_0x1c0a7e['params']['id']}},_0x5e3abf={};_0x5e3abf['model']=_[_0x6112('0x31')](db[_0x6112('0x29')][_0x6112('0x2a')]);_0x5e3abf[_0x6112('0x30')]=_[_0x6112('0x31')](_0x1c0a7e[_0x6112('0x30')]);_0x5e3abf['filters']=_['intersection'](_0x5e3abf['model'],_0x5e3abf[_0x6112('0x30')]);_0x1bbdb0['attributes']=_['intersection'](_0x5e3abf[_0x6112('0x2e')],qs['fields'](_0x1c0a7e['query'][_0x6112('0x34')]));_0x1bbdb0[_0x6112('0x33')]=_0x1bbdb0[_0x6112('0x33')][_0x6112('0x35')]?_0x1bbdb0[_0x6112('0x33')]:_0x5e3abf[_0x6112('0x2e')];if(_0x1c0a7e[_0x6112('0x30')][_0x6112('0x41')]){_0x1bbdb0['include']=[{'all':!![]}];}_0x1bbdb0=_[_0x6112('0x3e')]({},_0x1bbdb0,_0x1c0a7e[_0x6112('0x40')]);return db[_0x6112('0x29')][_0x6112('0x45')](_0x1bbdb0)[_0x6112('0x21')](handleEntityNotFound(_0xcac6bb,null))[_0x6112('0x21')](respondWithResult(_0xcac6bb,null))[_0x6112('0x46')](handleError(_0xcac6bb,null));};exports[_0x6112('0x47')]=function(_0x5ef136,_0x1a8c1c){return db[_0x6112('0x29')][_0x6112('0x47')](_0x5ef136[_0x6112('0x48')],{})[_0x6112('0x21')](function(_0x57820d){var _0x22d9b9=_0x5ef136['user'][_0x6112('0x23')]({'plain':!![]});if(!_0x22d9b9)throw new Error(_0x6112('0x49'));if(_0x22d9b9['role']===_0x6112('0x4a')){var _0x41c61f=_0x57820d[_0x6112('0x23')]({'plain':!![]});var _0x3f42bc=_0x6112('0x24');return db[_0x6112('0x4b')][_0x6112('0x45')]({'where':{'name':_0x3f42bc,'userProfileId':_0x22d9b9[_0x6112('0x4c')]},'raw':!![]})[_0x6112('0x21')](function(_0x3ce4ab){if(_0x3ce4ab&&_0x3ce4ab[_0x6112('0x4d')]===0x0){return db[_0x6112('0x25')][_0x6112('0x47')]({'name':_0x41c61f[_0x6112('0x28')],'resourceId':_0x41c61f['id'],'type':_0x3ce4ab[_0x6112('0x28')],'sectionId':_0x3ce4ab['id']},{})[_0x6112('0x21')](function(){return _0x57820d;});}else{return _0x57820d;}})[_0x6112('0x46')](function(_0x2686f4){logger[_0x6112('0x26')](_0x6112('0x4e'),_0x2686f4);throw _0x2686f4;});}return _0x57820d;})['then'](respondWithResult(_0x1a8c1c,0xc9))['catch'](handleError(_0x1a8c1c,null));};exports['update']=function(_0x485038,_0x2a9ef7){if(_0x485038[_0x6112('0x48')]['id']){delete _0x485038[_0x6112('0x48')]['id'];}return db[_0x6112('0x29')][_0x6112('0x45')]({'where':{'id':_0x485038[_0x6112('0x4f')]['id']}})[_0x6112('0x21')](handleEntityNotFound(_0x2a9ef7,null))['then'](saveUpdates(_0x485038[_0x6112('0x48')],null))[_0x6112('0x21')](respondWithResult(_0x2a9ef7,null))[_0x6112('0x46')](handleError(_0x2a9ef7,null));};exports[_0x6112('0x22')]=function(_0x1a50ea,_0x5234b0){return db[_0x6112('0x29')][_0x6112('0x45')]({'where':{'id':_0x1a50ea['params']['id']}})[_0x6112('0x21')](handleEntityNotFound(_0x5234b0,null))['then'](removeEntity(_0x5234b0,null))[_0x6112('0x46')](handleError(_0x5234b0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 2ac8d34..1a1023f 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 _0xd5d0=['cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','define','CmHopperAdditionalPhone'];(function(_0x20ce8d,_0x5427f1){var _0x453e98=function(_0x89d4d7){while(--_0x89d4d7){_0x20ce8d['push'](_0x20ce8d['shift']());}};_0x453e98(++_0x5427f1);}(_0xd5d0,0xfe));var _0x0d5d=function(_0x1fef47,_0x53f19e){_0x1fef47=_0x1fef47-0x0;var _0x3e30a1=_0xd5d0[_0x1fef47];return _0x3e30a1;};'use strict';var _=require(_0x0d5d('0x0'));var util=require(_0x0d5d('0x1'));var logger=require(_0x0d5d('0x2'))(_0x0d5d('0x3'));var moment=require(_0x0d5d('0x4'));var BPromise=require(_0x0d5d('0x5'));var rp=require(_0x0d5d('0x6'));var fs=require('fs');var path=require(_0x0d5d('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x23635f,_0x23ac47){return _0x23635f[_0x0d5d('0x8')](_0x0d5d('0x9'),attributes,{'tableName':_0x0d5d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60a7=['path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x60a7,0x127));var _0x760a=function(_0x16b5a0,_0xadeb6c){_0x16b5a0=_0x16b5a0-0x0;var _0x2dc72b=_0x60a7[_0x16b5a0];return _0x2dc72b;};'use strict';var _=require(_0x760a('0x0'));var util=require(_0x760a('0x1'));var logger=require(_0x760a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x760a('0x3'));var rp=require(_0x760a('0x4'));var fs=require('fs');var path=require(_0x760a('0x5'));var rimraf=require(_0x760a('0x6'));var config=require('../../config/environment');var attributes=require(_0x760a('0x7'));module[_0x760a('0x8')]=function(_0x1a63b2,_0x51af60){return _0x1a63b2[_0x760a('0x9')](_0x760a('0xa'),attributes,{'tableName':_0x760a('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 e3de914..f9b1da3 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 _0xa72e=['catch','CmHopper','ContactId','body','VoiceQueueId','CampaignId','findOne','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countcongestionretry','countabandonedretry','countagentrejectretry','VerifyAdditionalPhones','ListId','duration','scheduledat','add','minutes','phone','createdAt','updatedAt','isNil','additionalToHop','sequelize','update','IncrementPreviewCounters','field','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa72e,0x8f));var _0xea72=function(_0x564d1a,_0x4e86a9){_0x564d1a=_0x564d1a-0x0;var _0x2aa072=_0xa72e[_0x564d1a];return _0x2aa072;};'use strict';var _=require('lodash');var util=require(_0xea72('0x0'));var moment=require(_0xea72('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(_0xea72('0x2'));var logger=require(_0xea72('0x3'))('rpc');var config=require(_0xea72('0x4'));var jayson=require(_0xea72('0x5'));var client=jayson[_0xea72('0x6')][_0xea72('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x52b594,_0x5eedf3,_0x3dbf3b){return new BPromise(function(_0x27bc23,_0x584fbf){return client[_0xea72('0x8')](_0x52b594,_0x3dbf3b)[_0xea72('0x9')](function(_0x172eb6){logger[_0xea72('0xa')](_0xea72('0xb'),_0x5eedf3,_0xea72('0xc'));logger[_0xea72('0xd')](_0xea72('0xe'),_0x5eedf3,'request\x20sent',JSON[_0xea72('0xf')](_0x172eb6));if(_0x172eb6[_0xea72('0x10')]){if(_0x172eb6[_0xea72('0x10')][_0xea72('0x11')]===0x1f4){logger[_0xea72('0x10')](_0xea72('0xb'),_0x5eedf3,_0x172eb6['error']['message']);return _0x584fbf(_0x172eb6['error'][_0xea72('0x12')]);}logger[_0xea72('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5eedf3,_0x172eb6['error'][_0xea72('0x12')]);return _0x27bc23(_0x172eb6[_0xea72('0x10')][_0xea72('0x12')]);}else{logger[_0xea72('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5eedf3,'request\x20sent');_0x27bc23(_0x172eb6['result'][_0xea72('0x12')]);}})[_0xea72('0x13')](function(_0x49da44){logger[_0xea72('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5eedf3,_0x49da44);_0x584fbf(_0x49da44);});});}exports['VerifyAdditionalPhones']=function(_0x10d24f){var _0x1de92e=this;return new Promise(function(_0x36f5e1,_0x38f5c3){return db[_0xea72('0x14')]['findOne']({'raw':!![],'where':{'ContactId':_0x10d24f['body'][_0xea72('0x15')],'ListId':_0x10d24f[_0xea72('0x16')]['ListId'],'VoiceQueueId':_0x10d24f[_0xea72('0x16')][_0xea72('0x17')]===undefined?null:_0x10d24f['body']['VoiceQueueId'],'CampaignId':_0x10d24f[_0xea72('0x16')][_0xea72('0x18')]===undefined?null:_0x10d24f[_0xea72('0x16')][_0xea72('0x18')]}})[_0xea72('0x9')](function(_0xf1b29e){if(_0xf1b29e!=null){return db['CmHopperAdditionalPhone'][_0xea72('0x19')]({'raw':!![],'where':{'CmHopperId':_0xf1b29e['id'],'OrderBy':{'$gt':_0xf1b29e[_0xea72('0x1a')]}},'order':[['OrderBy',_0xea72('0x1b')]]})[_0xea72('0x9')](function(_0x58892d){var _0x47300f=0x0;if(_0x58892d){if(_0x58892d[_0xea72('0x1c')]+_0x58892d['countcongestionretry']+_0x58892d[_0xea72('0x1d')]+_0x58892d[_0xea72('0x1e')]+_0x58892d[_0xea72('0x1f')]+_0x58892d['countabandonedretry']+_0x58892d[_0xea72('0x20')]+_0x58892d['countagentrejectretry']<_0x10d24f[_0xea72('0x21')][_0xea72('0x22')])_0x47300f=0x1;_0x36f5e1({'additional':_0x47300f});}else{return db[_0xea72('0x23')][_0xea72('0x19')]({'raw':!![],'where':{'CmHopperId':_0xf1b29e['id']},'order':[[_0xea72('0x1a'),_0xea72('0x1b')]]})[_0xea72('0x9')](function(_0x349eb0){var _0x2c4dd5=0x0;if(_0x349eb0){if(_0x349eb0['countbusyretry']+_0x349eb0[_0xea72('0x24')]+_0x349eb0[_0xea72('0x1d')]+_0x349eb0[_0xea72('0x1e')]+_0x349eb0[_0xea72('0x1f')]+_0x349eb0[_0xea72('0x25')]+_0x349eb0[_0xea72('0x20')]+_0x349eb0[_0xea72('0x26')]<_0x10d24f['entity'][_0xea72('0x22')])_0x2c4dd5=0x1;_0x36f5e1({'additional':_0x2c4dd5});}else{_0x36f5e1({'additional':0x0});}})[_0xea72('0x13')](function(_0x254ebc){logger[_0xea72('0x10')]('VerifyAdditionalPhones',_0x254ebc['message'],_0x10d24f);_0x38f5c3(_0x1de92e[_0xea72('0x10')](0x1f4,_0x254ebc[_0xea72('0x12')]));});}})[_0xea72('0x13')](function(_0x5913fd){logger[_0xea72('0x10')](_0xea72('0x27'),_0x5913fd[_0xea72('0x12')],_0x10d24f);_0x38f5c3(_0x1de92e[_0xea72('0x10')](0x1f4,_0x5913fd[_0xea72('0x12')]));});}else _0x36f5e1({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x54b304){var _0x372b74=this;return new Promise(function(_0x15ac87,_0x2bab49){return db['CmHopper'][_0xea72('0x19')]({'raw':!![],'where':{'ContactId':_0x54b304[_0xea72('0x16')][_0xea72('0x15')],'ListId':_0x54b304[_0xea72('0x16')][_0xea72('0x28')],'VoiceQueueId':_0x54b304[_0xea72('0x16')][_0xea72('0x17')]===undefined?null:_0x54b304[_0xea72('0x16')][_0xea72('0x17')],'CampaignId':_0x54b304['body']['CampaignId']===undefined?null:_0x54b304[_0xea72('0x16')][_0xea72('0x18')]}})['then'](function(_0x56d807){if(_0x56d807!=null){return db[_0xea72('0x23')][_0xea72('0x19')]({'raw':!![],'where':{'CmHopperId':_0x56d807['id'],'OrderBy':{'$gt':_0x56d807[_0xea72('0x1a')]}},'order':[['OrderBy',_0xea72('0x1b')]]})['then'](function(_0x27c1be){if(_0x27c1be)return activateAdditionalPhone(_0x56d807,_0x54b304[_0xea72('0x16')],_0x27c1be,_0x54b304[_0xea72('0x29')],_0x54b304['waitTime'])['then'](function(_0x3b7c8f){_0x15ac87(_0x3b7c8f);});else{return db[_0xea72('0x23')][_0xea72('0x19')]({'raw':!![],'where':{'CmHopperId':_0x56d807['id']},'order':[[_0xea72('0x1a'),_0xea72('0x1b')]]})[_0xea72('0x9')](function(_0x41974f){if(_0x41974f)return activateAdditionalPhone(_0x56d807,_0x54b304[_0xea72('0x16')],_0x41974f,_0x54b304[_0xea72('0x29')],_0x54b304['waitTime'])[_0xea72('0x9')](function(_0x2b55f1){_0x15ac87(_0x2b55f1);});else{_0x15ac87({'id':_0x56d807['id'],'phone':''});}})[_0xea72('0x13')](function(_0x4c4882){logger[_0xea72('0x10')](_0xea72('0x27'),_0x4c4882[_0xea72('0x12')],_0x54b304);_0x2bab49(_0x372b74[_0xea72('0x10')](0x1f4,_0x4c4882[_0xea72('0x12')]));});}})[_0xea72('0x13')](function(_0x40d52c){logger[_0xea72('0x10')](_0xea72('0x27'),_0x40d52c[_0xea72('0x12')],_0x54b304);_0x2bab49(_0x372b74[_0xea72('0x10')](0x1f4,_0x40d52c[_0xea72('0x12')]));});}else _0x15ac87(0x1);});});};function activateAdditionalPhone(_0x2d1d75,_0x338973,_0x28167c,_0xdd2d20,_0x54886f){return new Promise(function(_0x5c2e41,_0x325a00){logger[_0xea72('0xa')](_0xea72('0x27'),_0x28167c);var _0x52e84a;if(moment()>moment(_0x28167c[_0xea72('0x2a')])){_0x52e84a=moment()[_0xea72('0x2b')](_0x54886f||0x3,_0xea72('0x2c'));}else{if(_0x28167c[_0xea72('0x1a')]==0x0){_0x52e84a=moment(_0x28167c[_0xea72('0x2a')]);}else{_0x52e84a=moment()[_0xea72('0x2b')](_0x54886f||0x3,'minutes');}}var _0x9bf7c9={'phone':_0x2d1d75[_0xea72('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0x2d1d75[_0xea72('0x1a')])?0x0:_0x2d1d75[_0xea72('0x1a')],'scheduledat':moment()[_0xea72('0x2b')](_0xdd2d20||0x1,_0xea72('0x2c')),'countbusyretry':_0x338973['countbusyretry'],'countcongestionretry':_0x338973[_0xea72('0x24')],'countnoanswerretry':_0x338973[_0xea72('0x1d')],'countnosuchnumberretry':_0x338973[_0xea72('0x1e')],'countdropretry':_0x338973[_0xea72('0x1f')],'countabandonedretry':_0x338973[_0xea72('0x25')],'countmachineretry':_0x338973[_0xea72('0x20')],'countagentrejectretry':_0x338973[_0xea72('0x26')],'createdAt':_0x338973[_0xea72('0x2e')],'updatedAt':_0x338973[_0xea72('0x2f')]};var _0xdf24c6={'CmHopperId':_0x2d1d75['id'],'phone':_0x28167c['phone'],'active':0x0,'OrderBy':_[_0xea72('0x30')](_0x28167c[_0xea72('0x1a')])?0x0:_0x28167c[_0xea72('0x1a')],'scheduledat':_0x52e84a,'countbusyretry':_0x28167c[_0xea72('0x1c')],'countcongestionretry':_0x28167c[_0xea72('0x24')],'countnoanswerretry':_0x28167c[_0xea72('0x1d')],'countnosuchnumberretry':_0x338973['countnosuchnumberretry'],'countdropretry':_0x338973[_0xea72('0x1f')],'countabandonedretry':_0x338973[_0xea72('0x25')],'countmachineretry':_0x338973['countmachineretry'],'countagentrejectretry':_0x338973['countagentrejectretry'],'createdAt':_0x28167c[_0xea72('0x2e')],'updatedAt':_0x28167c[_0xea72('0x2f')]};logger[_0xea72('0xa')]('hopperToAdd',_0x9bf7c9);logger[_0xea72('0xa')](_0xea72('0x31'),_0xdf24c6);return db[_0xea72('0x32')]['transaction'](function(_0x3a7533){return db[_0xea72('0x23')][_0xea72('0x33')](_0x9bf7c9,{'where':{'id':_0x28167c['id']}},{'transaction':_0x3a7533})[_0xea72('0x9')](function(){return db[_0xea72('0x14')][_0xea72('0x33')](_0xdf24c6,{'where':{'id':_0x2d1d75['id']}},{'transaction':_0x3a7533});});})[_0xea72('0x9')](function(_0x537d47){_0x5c2e41({'id':_0x2d1d75['id'],'phone':_0x28167c[_0xea72('0x2d')]});})['catch'](function(_0x4d60fe){logger[_0xea72('0x10')](_0xea72('0x27'),_0x4d60fe[_0xea72('0x12')],req);_0x325a00(_this[_0xea72('0x10')](0x1f4,_0x4d60fe[_0xea72('0x12')]));});});}exports[_0xea72('0x34')]=function(_0x39b320){var _0x125f6b=this;return new Promise(function(_0x516c41,_0xf16b0a){return db[_0xea72('0x14')][_0xea72('0x33')](_0x39b320[_0xea72('0x16')][_0xea72('0x35')],{'where':{'id':_0x39b320[_0xea72('0x16')]['id']}})['then'](function(_0x4819af){_0x516c41(_0x4819af);})[_0xea72('0x13')](function(_0xdbbde8){logger[_0xea72('0x10')](_0xea72('0x34'),_0xdbbde8['message'],_0x39b320);_0xf16b0a(_0x125f6b[_0xea72('0x10')](0x1f4,_0xdbbde8['message']));});});}; \ No newline at end of file +var _0x093b=['createdAt','updatedAt','phone','hopperToAdd','sequelize','transaction','update','field','IncrementPreviewCounters','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','countbusyretry','countmachineretry','entity','SwapAdditionalPhones','VoiceQueueId','CampaignId','duration','waitTime','scheduledat','add','minutes','isNil'];(function(_0x47cb6b,_0x32b8f5){var _0x3fcba4=function(_0x506f70){while(--_0x506f70){_0x47cb6b['push'](_0x47cb6b['shift']());}};_0x3fcba4(++_0x32b8f5);}(_0x093b,0x1b4));var _0xb093=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x093b[_0x2cc594];return _0x4abff7;};'use strict';var _=require(_0xb093('0x0'));var util=require(_0xb093('0x1'));var moment=require(_0xb093('0x2'));var BPromise=require(_0xb093('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb093('0x4'));var db=require(_0xb093('0x5'))['db'];var utils=require(_0xb093('0x6'));var logger=require(_0xb093('0x7'))(_0xb093('0x8'));var config=require('../../config/environment');var jayson=require(_0xb093('0x9'));var client=jayson[_0xb093('0xa')][_0xb093('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33d247,_0x12e716,_0xca23d5){return new BPromise(function(_0x1bb133,_0x7bbab7){return client[_0xb093('0xc')](_0x33d247,_0xca23d5)[_0xb093('0xd')](function(_0x54e3aa){logger['info'](_0xb093('0xe'),_0x12e716,_0xb093('0xf'));logger[_0xb093('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x12e716,_0xb093('0xf'),JSON[_0xb093('0x11')](_0x54e3aa));if(_0x54e3aa['error']){if(_0x54e3aa[_0xb093('0x12')][_0xb093('0x13')]===0x1f4){logger[_0xb093('0x12')](_0xb093('0xe'),_0x12e716,_0x54e3aa['error'][_0xb093('0x14')]);return _0x7bbab7(_0x54e3aa['error'][_0xb093('0x14')]);}logger[_0xb093('0x12')](_0xb093('0xe'),_0x12e716,_0x54e3aa[_0xb093('0x12')]['message']);return _0x1bb133(_0x54e3aa[_0xb093('0x12')]['message']);}else{logger[_0xb093('0x15')](_0xb093('0xe'),_0x12e716,_0xb093('0xf'));_0x1bb133(_0x54e3aa[_0xb093('0x16')][_0xb093('0x14')]);}})[_0xb093('0x17')](function(_0x509554){logger[_0xb093('0x12')](_0xb093('0xe'),_0x12e716,_0x509554);_0x7bbab7(_0x509554);});});}exports[_0xb093('0x18')]=function(_0x29b81c){var _0x279548=this;return new Promise(function(_0x4e2dd1,_0x47dc59){return db[_0xb093('0x19')][_0xb093('0x1a')]({'raw':!![],'where':{'ContactId':_0x29b81c[_0xb093('0x1b')][_0xb093('0x1c')],'ListId':_0x29b81c['body'][_0xb093('0x1d')],'VoiceQueueId':_0x29b81c[_0xb093('0x1b')]['VoiceQueueId']===undefined?null:_0x29b81c[_0xb093('0x1b')]['VoiceQueueId'],'CampaignId':_0x29b81c[_0xb093('0x1b')]['CampaignId']===undefined?null:_0x29b81c[_0xb093('0x1b')]['CampaignId']}})[_0xb093('0xd')](function(_0x5ed3eb){if(_0x5ed3eb!=null){return db[_0xb093('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5ed3eb['id'],'OrderBy':{'$gt':_0x5ed3eb[_0xb093('0x1f')]}},'order':[['OrderBy',_0xb093('0x20')]]})[_0xb093('0xd')](function(_0x317d7a){var _0x548c03=0x0;if(_0x317d7a){if(_0x317d7a['countbusyretry']+_0x317d7a[_0xb093('0x21')]+_0x317d7a[_0xb093('0x22')]+_0x317d7a[_0xb093('0x23')]+_0x317d7a[_0xb093('0x24')]+_0x317d7a[_0xb093('0x25')]+_0x317d7a['countmachineretry']+_0x317d7a[_0xb093('0x26')]<_0x29b81c['entity'][_0xb093('0x27')])_0x548c03=0x1;_0x4e2dd1({'additional':_0x548c03});}else{return db[_0xb093('0x1e')][_0xb093('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x5ed3eb['id']},'order':[[_0xb093('0x1f'),_0xb093('0x20')]]})['then'](function(_0x3f3c7e){var _0x3d7f0a=0x0;if(_0x3f3c7e){if(_0x3f3c7e[_0xb093('0x28')]+_0x3f3c7e[_0xb093('0x21')]+_0x3f3c7e[_0xb093('0x22')]+_0x3f3c7e[_0xb093('0x23')]+_0x3f3c7e[_0xb093('0x24')]+_0x3f3c7e[_0xb093('0x25')]+_0x3f3c7e[_0xb093('0x29')]+_0x3f3c7e['countagentrejectretry']<_0x29b81c[_0xb093('0x2a')][_0xb093('0x27')])_0x3d7f0a=0x1;_0x4e2dd1({'additional':_0x3d7f0a});}else{_0x4e2dd1({'additional':0x0});}})[_0xb093('0x17')](function(_0x56bca3){logger[_0xb093('0x12')]('VerifyAdditionalPhones',_0x56bca3['message'],_0x29b81c);_0x47dc59(_0x279548[_0xb093('0x12')](0x1f4,_0x56bca3['message']));});}})[_0xb093('0x17')](function(_0x211d57){logger[_0xb093('0x12')](_0xb093('0x18'),_0x211d57[_0xb093('0x14')],_0x29b81c);_0x47dc59(_0x279548[_0xb093('0x12')](0x1f4,_0x211d57[_0xb093('0x14')]));});}else _0x4e2dd1({'additional':0x0});});});};exports[_0xb093('0x2b')]=function(_0x6f1549){var _0x31e8ed=this;return new Promise(function(_0x106543,_0x163b02){return db[_0xb093('0x19')][_0xb093('0x1a')]({'raw':!![],'where':{'ContactId':_0x6f1549['body'][_0xb093('0x1c')],'ListId':_0x6f1549['body'][_0xb093('0x1d')],'VoiceQueueId':_0x6f1549[_0xb093('0x1b')][_0xb093('0x2c')]===undefined?null:_0x6f1549['body']['VoiceQueueId'],'CampaignId':_0x6f1549[_0xb093('0x1b')][_0xb093('0x2d')]===undefined?null:_0x6f1549['body'][_0xb093('0x2d')]}})[_0xb093('0xd')](function(_0x308321){if(_0x308321!=null){return db[_0xb093('0x1e')][_0xb093('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x308321['id'],'OrderBy':{'$gt':_0x308321[_0xb093('0x1f')]}},'order':[['OrderBy',_0xb093('0x20')]]})[_0xb093('0xd')](function(_0xd33dc4){if(_0xd33dc4)return activateAdditionalPhone(_0x308321,_0x6f1549[_0xb093('0x1b')],_0xd33dc4,_0x6f1549[_0xb093('0x2e')],_0x6f1549[_0xb093('0x2f')])[_0xb093('0xd')](function(_0x42058a){_0x106543(_0x42058a);});else{return db['CmHopperAdditionalPhone'][_0xb093('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x308321['id']},'order':[[_0xb093('0x1f'),_0xb093('0x20')]]})[_0xb093('0xd')](function(_0x15be91){if(_0x15be91)return activateAdditionalPhone(_0x308321,_0x6f1549[_0xb093('0x1b')],_0x15be91,_0x6f1549[_0xb093('0x2e')],_0x6f1549[_0xb093('0x2f')])[_0xb093('0xd')](function(_0x147e2b){_0x106543(_0x147e2b);});else{_0x106543({'id':_0x308321['id'],'phone':''});}})[_0xb093('0x17')](function(_0x33c2d0){logger[_0xb093('0x12')](_0xb093('0x18'),_0x33c2d0[_0xb093('0x14')],_0x6f1549);_0x163b02(_0x31e8ed[_0xb093('0x12')](0x1f4,_0x33c2d0[_0xb093('0x14')]));});}})[_0xb093('0x17')](function(_0x1c717c){logger[_0xb093('0x12')](_0xb093('0x18'),_0x1c717c['message'],_0x6f1549);_0x163b02(_0x31e8ed['error'](0x1f4,_0x1c717c[_0xb093('0x14')]));});}else _0x106543(0x1);});});};function activateAdditionalPhone(_0x440622,_0x2ac026,_0x56f78b,_0x36ced2,_0x468e6d){return new Promise(function(_0x9387bf,_0x2d9907){logger[_0xb093('0x15')]('VerifyAdditionalPhones',_0x56f78b);var _0x3be0b3;if(moment()>moment(_0x56f78b[_0xb093('0x30')])){_0x3be0b3=moment()[_0xb093('0x31')](_0x468e6d||0x3,_0xb093('0x32'));}else{if(_0x56f78b[_0xb093('0x1f')]==0x0){_0x3be0b3=moment(_0x56f78b[_0xb093('0x30')]);}else{_0x3be0b3=moment()[_0xb093('0x31')](_0x468e6d||0x3,_0xb093('0x32'));}}var _0x3a307c={'phone':_0x440622['phone'],'active':0x0,'OrderBy':_[_0xb093('0x33')](_0x440622[_0xb093('0x1f')])?0x0:_0x440622[_0xb093('0x1f')],'scheduledat':moment()['add'](_0x36ced2||0x1,_0xb093('0x32')),'countbusyretry':_0x2ac026[_0xb093('0x28')],'countcongestionretry':_0x2ac026[_0xb093('0x21')],'countnoanswerretry':_0x2ac026[_0xb093('0x22')],'countnosuchnumberretry':_0x2ac026[_0xb093('0x23')],'countdropretry':_0x2ac026[_0xb093('0x24')],'countabandonedretry':_0x2ac026[_0xb093('0x25')],'countmachineretry':_0x2ac026['countmachineretry'],'countagentrejectretry':_0x2ac026[_0xb093('0x26')],'createdAt':_0x2ac026[_0xb093('0x34')],'updatedAt':_0x2ac026[_0xb093('0x35')]};var _0x20c781={'CmHopperId':_0x440622['id'],'phone':_0x56f78b[_0xb093('0x36')],'active':0x0,'OrderBy':_[_0xb093('0x33')](_0x56f78b[_0xb093('0x1f')])?0x0:_0x56f78b[_0xb093('0x1f')],'scheduledat':_0x3be0b3,'countbusyretry':_0x56f78b[_0xb093('0x28')],'countcongestionretry':_0x56f78b[_0xb093('0x21')],'countnoanswerretry':_0x56f78b[_0xb093('0x22')],'countnosuchnumberretry':_0x2ac026[_0xb093('0x23')],'countdropretry':_0x2ac026['countdropretry'],'countabandonedretry':_0x2ac026['countabandonedretry'],'countmachineretry':_0x2ac026[_0xb093('0x29')],'countagentrejectretry':_0x2ac026['countagentrejectretry'],'createdAt':_0x56f78b[_0xb093('0x34')],'updatedAt':_0x56f78b[_0xb093('0x35')]};logger[_0xb093('0x15')](_0xb093('0x37'),_0x3a307c);logger[_0xb093('0x15')]('additionalToHop',_0x20c781);return db[_0xb093('0x38')][_0xb093('0x39')](function(_0x27806d){return db[_0xb093('0x1e')]['update'](_0x3a307c,{'where':{'id':_0x56f78b['id']}},{'transaction':_0x27806d})[_0xb093('0xd')](function(){return db[_0xb093('0x19')][_0xb093('0x3a')](_0x20c781,{'where':{'id':_0x440622['id']}},{'transaction':_0x27806d});});})[_0xb093('0xd')](function(_0x15de1d){_0x9387bf({'id':_0x440622['id'],'phone':_0x56f78b['phone']});})[_0xb093('0x17')](function(_0x3560e1){logger[_0xb093('0x12')]('VerifyAdditionalPhones',_0x3560e1[_0xb093('0x14')],req);_0x2d9907(_this[_0xb093('0x12')](0x1f4,_0x3560e1[_0xb093('0x14')]));});});}exports['IncrementPreviewCounters']=function(_0x4cf0cb){var _0x19e0ba=this;return new Promise(function(_0xd8188f,_0x2212f5){return db[_0xb093('0x19')][_0xb093('0x3a')](_0x4cf0cb['body'][_0xb093('0x3b')],{'where':{'id':_0x4cf0cb[_0xb093('0x1b')]['id']}})[_0xb093('0xd')](function(_0x5b4cde){_0xd8188f(_0x5b4cde);})[_0xb093('0x17')](function(_0x37eebd){logger['error'](_0xb093('0x3c'),_0x37eebd[_0xb093('0x14')],_0x4cf0cb);_0x2212f5(_0x19e0ba['error'](0x1f4,_0x37eebd[_0xb093('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index ef0f9c4..e62d488 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 _0x142a=['put','/:id','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create'];(function(_0x369ce9,_0x151dcb){var _0x359c69=function(_0x43ab6a){while(--_0x43ab6a){_0x369ce9['push'](_0x369ce9['shift']());}};_0x359c69(++_0x151dcb);}(_0x142a,0x18b));var _0xa142=function(_0x578f55,_0x4a3b8a){_0x578f55=_0x578f55-0x0;var _0x1acacd=_0x142a[_0x578f55];return _0x1acacd;};'use strict';var multer=require(_0xa142('0x0'));var util=require(_0xa142('0x1'));var path=require(_0xa142('0x2'));var timeout=require(_0xa142('0x3'));var express=require(_0xa142('0x4'));var router=express['Router']();var auth=require(_0xa142('0x5'));var interaction=require(_0xa142('0x6'));var config=require(_0xa142('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0xa142('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa142('0x8')]('/:id',auth[_0xa142('0x9')](),controller[_0xa142('0xa')]);router[_0xa142('0xb')]('/',auth[_0xa142('0x9')](),controller[_0xa142('0xc')]);router[_0xa142('0xd')](_0xa142('0xe'),auth['isAuthenticated'](),controller[_0xa142('0xf')]);router['delete'](_0xa142('0xe'),auth[_0xa142('0x9')](),controller['destroy']);module[_0xa142('0x10')]=router; \ No newline at end of file +var _0x7784=['destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','post','create','update','delete'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x7784,0xd4));var _0x4778=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7784[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x4778('0x0'));var path=require('path');var timeout=require(_0x4778('0x1'));var express=require(_0x4778('0x2'));var router=express[_0x4778('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4778('0x4'));var config=require(_0x4778('0x5'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4778('0x6'),auth[_0x4778('0x7')](),controller[_0x4778('0x8')]);router[_0x4778('0x9')]('/',auth[_0x4778('0x7')](),controller[_0x4778('0xa')]);router['put'](_0x4778('0x6'),auth[_0x4778('0x7')](),controller[_0x4778('0xb')]);router[_0x4778('0xc')](_0x4778('0x6'),auth[_0x4778('0x7')](),controller[_0x4778('0xd')]);module[_0x4778('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 9279c13..410a2b1 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 _0xbbf7=['exports','INTEGER','contactListQueue','moment'];(function(_0x53b156,_0x3f16c1){var _0x4086f8=function(_0x11d683){while(--_0x11d683){_0x53b156['push'](_0x53b156['shift']());}};_0x4086f8(++_0x3f16c1);}(_0xbbf7,0xf7));var _0x7bbf=function(_0x36271f,_0x3a5737){_0x36271f=_0x36271f-0x0;var _0x54638=_0xbbf7[_0x36271f];return _0x54638;};'use strict';var moment=require(_0x7bbf('0x0'));var Sequelize=require('sequelize');module[_0x7bbf('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7bbf('0x2')],'unique':_0x7bbf('0x3')},'ListId':{'type':Sequelize[_0x7bbf('0x2')],'unique':_0x7bbf('0x3')},'VoiceQueueId':{'type':Sequelize[_0x7bbf('0x2')],'unique':_0x7bbf('0x3')}}; \ No newline at end of file +var _0xb955=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xb955,0x1db));var _0x5b95=function(_0x58c2df,_0x312f93){_0x58c2df=_0x58c2df-0x0;var _0x3599f7=_0xb955[_0x58c2df];return _0x3599f7;};'use strict';var moment=require(_0x5b95('0x0'));var Sequelize=require('sequelize');module[_0x5b95('0x1')]={'phone':{'type':Sequelize[_0x5b95('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5b95('0x3')],'unique':_0x5b95('0x4')},'ListId':{'type':Sequelize[_0x5b95('0x3')],'unique':_0x5b95('0x4')},'VoiceQueueId':{'type':Sequelize[_0x5b95('0x3')],'unique':_0x5b95('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index fc100f9..7d49b6d 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(_0x10362e,_0x5e1fb7){var _0x182418=function(_0x3a511e){while(--_0x3a511e){_0x10362e['push'](_0x10362e['shift']());}};_0x182418(++_0x5e1fb7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0xc4c5fc,_0x2a7271){var _0x19a06c=function(_0x48d388){while(--_0x48d388){_0xc4c5fc['push'](_0xc4c5fc['shift']());}};_0x19a06c(++_0x2a7271);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 2eace64..6ba7c16 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','../../config/logger','api'];(function(_0x2dcd00,_0x4ad495){var _0x761ae9=function(_0x1e191e){while(--_0x1e191e){_0x2dcd00['push'](_0x2dcd00['shift']());}};_0x761ae9(++_0x4ad495);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','../../config/logger','api'];(function(_0x332cdd,_0x362367){var _0x421b2a=function(_0x58aa30){while(--_0x58aa30){_0x332cdd['push'](_0x332cdd['shift']());}};_0x421b2a(++_0x362367);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 6dc24db..63f858b 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 _0x7927=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','debug','UpdateCmHopperBlack','update','body','where','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis'];(function(_0x258dd0,_0x3c68c0){var _0x2b0aa9=function(_0x5bb709){while(--_0x5bb709){_0x258dd0['push'](_0x258dd0['shift']());}};_0x2b0aa9(++_0x3c68c0);}(_0x7927,0x76));var _0x7792=function(_0x7a7f74,_0x461e76){_0x7a7f74=_0x7a7f74-0x0;var _0x58dc13=_0x7927[_0x7a7f74];return _0x58dc13;};'use strict';var _=require(_0x7792('0x0'));var util=require(_0x7792('0x1'));var moment=require(_0x7792('0x2'));var BPromise=require('bluebird');var rs=require(_0x7792('0x3'));var fs=require('fs');var Redis=require(_0x7792('0x4'));var db=require(_0x7792('0x5'))['db'];var utils=require(_0x7792('0x6'));var logger=require(_0x7792('0x7'))(_0x7792('0x8'));var config=require(_0x7792('0x9'));var jayson=require(_0x7792('0xa'));var client=jayson[_0x7792('0xb')][_0x7792('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4db17c,_0x1fe3f5,_0x3e71d1){return new BPromise(function(_0x12467d,_0x47ac04){return client[_0x7792('0xd')](_0x4db17c,_0x3e71d1)[_0x7792('0xe')](function(_0x2b663e){logger[_0x7792('0xf')](_0x7792('0x10'),_0x1fe3f5,_0x7792('0x11'));logger['debug'](_0x7792('0x12'),_0x1fe3f5,_0x7792('0x11'),JSON[_0x7792('0x13')](_0x2b663e));if(_0x2b663e[_0x7792('0x14')]){if(_0x2b663e[_0x7792('0x14')][_0x7792('0x15')]===0x1f4){logger[_0x7792('0x14')](_0x7792('0x10'),_0x1fe3f5,_0x2b663e[_0x7792('0x14')][_0x7792('0x16')]);return _0x47ac04(_0x2b663e['error'][_0x7792('0x16')]);}logger[_0x7792('0x14')](_0x7792('0x10'),_0x1fe3f5,_0x2b663e[_0x7792('0x14')]['message']);return _0x12467d(_0x2b663e[_0x7792('0x14')][_0x7792('0x16')]);}else{logger[_0x7792('0xf')](_0x7792('0x10'),_0x1fe3f5,_0x7792('0x11'));_0x12467d(_0x2b663e[_0x7792('0x17')][_0x7792('0x16')]);}})[_0x7792('0x18')](function(_0x89ebd0){logger[_0x7792('0x14')](_0x7792('0x10'),_0x1fe3f5,_0x89ebd0);_0x47ac04(_0x89ebd0);});});}exports['GetCmHopperBlack']=function(_0x5f5b97){var _0x409b0e=this;return new Promise(function(_0x4fdecf,_0x32c093){return db[_0x7792('0x19')][_0x7792('0x1a')]({'raw':_0x5f5b97[_0x7792('0x1b')]?_0x5f5b97[_0x7792('0x1b')][_0x7792('0x1c')]===undefined?!![]:![]:!![],'where':_0x5f5b97[_0x7792('0x1b')]?_0x5f5b97[_0x7792('0x1b')]['where']||null:null,'attributes':_0x5f5b97[_0x7792('0x1b')]?_0x5f5b97[_0x7792('0x1b')][_0x7792('0x1d')]||null:null,'limit':_0x5f5b97[_0x7792('0x1b')]?_0x5f5b97[_0x7792('0x1b')][_0x7792('0x1e')]||null:null,'include':_0x5f5b97[_0x7792('0x1b')]?_0x5f5b97[_0x7792('0x1b')][_0x7792('0x1f')]?_[_0x7792('0x20')](_0x5f5b97[_0x7792('0x1b')][_0x7792('0x1f')],function(_0x537003){return{'model':db[_0x537003[_0x7792('0x21')]],'as':_0x537003['as'],'attributes':_0x537003[_0x7792('0x1d')],'include':_0x537003['include']?_[_0x7792('0x20')](_0x537003[_0x7792('0x1f')],function(_0x5be645){return{'model':db[_0x5be645[_0x7792('0x21')]],'as':_0x5be645['as'],'attributes':_0x5be645[_0x7792('0x1d')],'include':_0x5be645['include']?_[_0x7792('0x20')](_0x5be645[_0x7792('0x1f')],function(_0x35eab2){return{'model':db[_0x35eab2[_0x7792('0x21')]],'as':_0x35eab2['as'],'attributes':_0x35eab2[_0x7792('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7792('0xe')](function(_0x1acf79){logger[_0x7792('0xf')]('GetCmHopperBlack',_0x5f5b97);logger[_0x7792('0x22')]('GetCmHopperBlack',_0x5f5b97,JSON[_0x7792('0x13')](_0x1acf79));_0x4fdecf(_0x1acf79);})[_0x7792('0x18')](function(_0x365c68){logger['error']('GetCmHopperBlack',_0x365c68[_0x7792('0x16')],_0x5f5b97);_0x32c093(_0x409b0e['error'](0x1f4,_0x365c68[_0x7792('0x16')]));});});};exports[_0x7792('0x23')]=function(_0x4488d7){var _0x3a73ba=this;return new Promise(function(_0x13aaeb,_0x273014){return db[_0x7792('0x19')][_0x7792('0x24')](_0x4488d7[_0x7792('0x25')],{'raw':_0x4488d7[_0x7792('0x1b')]?_0x4488d7[_0x7792('0x1b')][_0x7792('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4488d7['options']?_0x4488d7[_0x7792('0x1b')][_0x7792('0x26')]||null:null,'attributes':_0x4488d7['options']?_0x4488d7[_0x7792('0x1b')][_0x7792('0x1d')]||null:null,'limit':_0x4488d7['options']?_0x4488d7[_0x7792('0x1b')][_0x7792('0x1e')]||null:null})[_0x7792('0xe')](function(_0x187bb5){logger[_0x7792('0xf')]('UpdateCmHopperBlack',_0x4488d7);logger[_0x7792('0x22')]('UpdateCmHopperBlack',_0x4488d7,JSON[_0x7792('0x13')](_0x187bb5));_0x13aaeb(_0x187bb5);})[_0x7792('0x18')](function(_0x41c20e){logger[_0x7792('0x14')](_0x7792('0x23'),_0x41c20e[_0x7792('0x16')],_0x4488d7);_0x273014(_0x3a73ba['error'](0x1f4,_0x41c20e[_0x7792('0x16')]));});});};exports[_0x7792('0x27')]=function(_0x2459d3){var _0x950501=this;return new Promise(function(_0x241301,_0x4f875d){return db[_0x7792('0x19')][_0x7792('0x28')]({'where':_0x2459d3[_0x7792('0x1b')]?_0x2459d3[_0x7792('0x1b')][_0x7792('0x26')]||null:null})['then'](function(_0x59c889){logger[_0x7792('0xf')](_0x7792('0x27'),_0x2459d3);logger['debug']('DestroyCmHopperBlack',_0x2459d3,JSON[_0x7792('0x13')](_0x59c889));_0x241301(_0x59c889);})[_0x7792('0x18')](function(_0x5bf4e0){logger[_0x7792('0x14')](_0x7792('0x27'),_0x5bf4e0[_0x7792('0x16')],_0x2459d3);_0x4f875d(_0x950501[_0x7792('0x14')](0x1f4,_0x5bf4e0[_0x7792('0x16')]));});});}; \ No newline at end of file +var _0xa14a=['http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetCmHopperBlack','findAll','options','raw','where','include','map','model','attributes','UpdateCmHopperBlack','CmHopperBlack','update','body','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client'];(function(_0x3be7ff,_0x12e714){var _0x186721=function(_0x2bc9e1){while(--_0x2bc9e1){_0x3be7ff['push'](_0x3be7ff['shift']());}};_0x186721(++_0x12e714);}(_0xa14a,0x156));var _0xaa14=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xa14a[_0xefd519];return _0x4bb882;};'use strict';var _=require('lodash');var util=require(_0xaa14('0x0'));var moment=require(_0xaa14('0x1'));var BPromise=require(_0xaa14('0x2'));var rs=require(_0xaa14('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa14('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa14('0x5'))(_0xaa14('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaa14('0x7')][_0xaa14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49403c,_0x10ae54,_0x31ac24){return new BPromise(function(_0x82ca95,_0x1de341){return client[_0xaa14('0x9')](_0x49403c,_0x31ac24)[_0xaa14('0xa')](function(_0x37ecae){logger[_0xaa14('0xb')](_0xaa14('0xc'),_0x10ae54,_0xaa14('0xd'));logger[_0xaa14('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x10ae54,_0xaa14('0xd'),JSON[_0xaa14('0xf')](_0x37ecae));if(_0x37ecae[_0xaa14('0x10')]){if(_0x37ecae[_0xaa14('0x10')][_0xaa14('0x11')]===0x1f4){logger[_0xaa14('0x10')](_0xaa14('0xc'),_0x10ae54,_0x37ecae[_0xaa14('0x10')][_0xaa14('0x12')]);return _0x1de341(_0x37ecae[_0xaa14('0x10')][_0xaa14('0x12')]);}logger[_0xaa14('0x10')](_0xaa14('0xc'),_0x10ae54,_0x37ecae[_0xaa14('0x10')][_0xaa14('0x12')]);return _0x82ca95(_0x37ecae[_0xaa14('0x10')][_0xaa14('0x12')]);}else{logger[_0xaa14('0xb')](_0xaa14('0xc'),_0x10ae54,_0xaa14('0xd'));_0x82ca95(_0x37ecae['result'][_0xaa14('0x12')]);}})[_0xaa14('0x13')](function(_0xe90b6){logger[_0xaa14('0x10')](_0xaa14('0xc'),_0x10ae54,_0xe90b6);_0x1de341(_0xe90b6);});});}exports[_0xaa14('0x14')]=function(_0x256a26){var _0x5174ed=this;return new Promise(function(_0x5ea696,_0x458376){return db['CmHopperBlack'][_0xaa14('0x15')]({'raw':_0x256a26['options']?_0x256a26[_0xaa14('0x16')][_0xaa14('0x17')]===undefined?!![]:![]:!![],'where':_0x256a26[_0xaa14('0x16')]?_0x256a26[_0xaa14('0x16')][_0xaa14('0x18')]||null:null,'attributes':_0x256a26[_0xaa14('0x16')]?_0x256a26['options']['attributes']||null:null,'limit':_0x256a26['options']?_0x256a26[_0xaa14('0x16')]['limit']||null:null,'include':_0x256a26[_0xaa14('0x16')]?_0x256a26[_0xaa14('0x16')][_0xaa14('0x19')]?_[_0xaa14('0x1a')](_0x256a26[_0xaa14('0x16')][_0xaa14('0x19')],function(_0x71cd83){return{'model':db[_0x71cd83[_0xaa14('0x1b')]],'as':_0x71cd83['as'],'attributes':_0x71cd83['attributes'],'include':_0x71cd83[_0xaa14('0x19')]?_['map'](_0x71cd83[_0xaa14('0x19')],function(_0x30e4c3){return{'model':db[_0x30e4c3['model']],'as':_0x30e4c3['as'],'attributes':_0x30e4c3[_0xaa14('0x1c')],'include':_0x30e4c3[_0xaa14('0x19')]?_[_0xaa14('0x1a')](_0x30e4c3['include'],function(_0x35f411){return{'model':db[_0x35f411['model']],'as':_0x35f411['as'],'attributes':_0x35f411[_0xaa14('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa14('0xa')](function(_0x409941){logger[_0xaa14('0xb')](_0xaa14('0x14'),_0x256a26);logger[_0xaa14('0xe')](_0xaa14('0x14'),_0x256a26,JSON[_0xaa14('0xf')](_0x409941));_0x5ea696(_0x409941);})['catch'](function(_0x45d34b){logger['error'](_0xaa14('0x14'),_0x45d34b['message'],_0x256a26);_0x458376(_0x5174ed[_0xaa14('0x10')](0x1f4,_0x45d34b[_0xaa14('0x12')]));});});};exports[_0xaa14('0x1d')]=function(_0x63bade){var _0x229674=this;return new Promise(function(_0x374094,_0x1787cb){return db[_0xaa14('0x1e')][_0xaa14('0x1f')](_0x63bade[_0xaa14('0x20')],{'raw':_0x63bade[_0xaa14('0x16')]?_0x63bade[_0xaa14('0x16')][_0xaa14('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63bade[_0xaa14('0x16')]?_0x63bade[_0xaa14('0x16')][_0xaa14('0x18')]||null:null,'attributes':_0x63bade[_0xaa14('0x16')]?_0x63bade['options'][_0xaa14('0x1c')]||null:null,'limit':_0x63bade[_0xaa14('0x16')]?_0x63bade['options']['limit']||null:null})[_0xaa14('0xa')](function(_0xfbff3e){logger[_0xaa14('0xb')](_0xaa14('0x1d'),_0x63bade);logger[_0xaa14('0xe')](_0xaa14('0x1d'),_0x63bade,JSON['stringify'](_0xfbff3e));_0x374094(_0xfbff3e);})[_0xaa14('0x13')](function(_0x552b25){logger[_0xaa14('0x10')](_0xaa14('0x1d'),_0x552b25[_0xaa14('0x12')],_0x63bade);_0x1787cb(_0x229674['error'](0x1f4,_0x552b25['message']));});});};exports[_0xaa14('0x21')]=function(_0x3d687e){var _0x248041=this;return new Promise(function(_0x2bae3b,_0xe7845b){return db[_0xaa14('0x1e')][_0xaa14('0x22')]({'where':_0x3d687e[_0xaa14('0x16')]?_0x3d687e[_0xaa14('0x16')][_0xaa14('0x18')]||null:null})[_0xaa14('0xa')](function(_0x365bb6){logger[_0xaa14('0xb')](_0xaa14('0x21'),_0x3d687e);logger['debug'](_0xaa14('0x21'),_0x3d687e,JSON[_0xaa14('0xf')](_0x365bb6));_0x2bae3b(_0x365bb6);})[_0xaa14('0x13')](function(_0x148c2a){logger[_0xaa14('0x10')](_0xaa14('0x21'),_0x148c2a['message'],_0x3d687e);_0xe7845b(_0x248041[_0xaa14('0x10')](0x1f4,_0x148c2a[_0xaa14('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index bd64011..a779a0a 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 _0x425d=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x2e9c6d,_0xbecdb4){var _0x139a4f=function(_0x58566b){while(--_0x58566b){_0x2e9c6d['push'](_0x2e9c6d['shift']());}};_0x139a4f(++_0xbecdb4);}(_0x425d,0x1e0));var _0xd425=function(_0x5cf5fd,_0x4bca34){_0x5cf5fd=_0x5cf5fd-0x0;var _0x4a53ec=_0x425d[_0x5cf5fd];return _0x4a53ec;};'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('./cmHopperBlack.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('0xe')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x11')]);module[_0xd425('0x12')]=router; \ No newline at end of file +var _0x5fd1=['/:id','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe'];(function(_0x11f6b4,_0x552754){var _0x5e0b4f=function(_0x31f8da){while(--_0x31f8da){_0x11f6b4['push'](_0x11f6b4['shift']());}};_0x5e0b4f(++_0x552754);}(_0x5fd1,0x155));var _0x15fd=function(_0x984b4a,_0x35a7b4){_0x984b4a=_0x984b4a-0x0;var _0x46b745=_0x5fd1[_0x984b4a];return _0x46b745;};'use strict';var multer=require(_0x15fd('0x0'));var util=require('util');var path=require(_0x15fd('0x1'));var timeout=require(_0x15fd('0x2'));var express=require(_0x15fd('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x15fd('0x4'));var config=require(_0x15fd('0x5'));var controller=require(_0x15fd('0x6'));router['get']('/',auth[_0x15fd('0x7')](),controller[_0x15fd('0x8')]);router[_0x15fd('0x9')](_0x15fd('0xa'),auth[_0x15fd('0x7')](),controller['describe']);router[_0x15fd('0x9')](_0x15fd('0xb'),auth[_0x15fd('0x7')](),controller['show']);router[_0x15fd('0xc')]('/:id',auth[_0x15fd('0x7')](),controller[_0x15fd('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x15fd('0xe')]);module[_0x15fd('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index da354ce..20d3655 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 _0x5137=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment','INTEGER'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0x5137,0xf9));var _0x7513=function(_0x1ab758,_0x3dbede){_0x1ab758=_0x1ab758-0x0;var _0x5788a0=_0x5137[_0x1ab758];return _0x5788a0;};'use strict';var Sequelize=require(_0x7513('0x0'));var moment=require(_0x7513('0x1'));module['exports']={'state':{'type':Sequelize[_0x7513('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7513('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7513('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7513('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x7513('0x3')]},'originatecalleridname':{'type':Sequelize[_0x7513('0x3')]},'calleridnum':{'type':Sequelize[_0x7513('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7513('0x4')]},'responsetime':{'type':Sequelize[_0x7513('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x7513('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7513('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x7513('0x3')]},'campaigntype':{'type':Sequelize[_0x7513('0x3')]},'membername':{'type':Sequelize[_0x7513('0x3')]},'reason':{'type':Sequelize[_0x7513('0x3')]},'disposition':{'type':Sequelize[_0x7513('0x3')]},'dispositionat':{'type':Sequelize[_0x7513('0x4')],'set':function(_0x31c7a4){var _0x3faa8f=this[_0x7513('0x5')](_0x7513('0x6'));if(_0x3faa8f&&_0x31c7a4){this[_0x7513('0x7')](_0x7513('0x8'),moment(_0x31c7a4)[_0x7513('0x9')](moment(_0x3faa8f),'seconds'));}return this[_0x7513('0x7')](_0x7513('0xa'),_0x31c7a4);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7513('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7513('0x4')]},'callback':{'type':Sequelize[_0x7513('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7513('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x7513('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x7513('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x7513('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7513('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7513('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7513('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7513('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fee=['DATE','getDataValue','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x576d5e,_0x20407a){var _0x45f248=function(_0x119d7e){while(--_0x119d7e){_0x576d5e['push'](_0x576d5e['shift']());}};_0x45f248(++_0x20407a);}(_0x5fee,0x150));var _0xe5fe=function(_0xd7e949,_0x71406b){_0xd7e949=_0xd7e949-0x0;var _0x165597=_0x5fee[_0xd7e949];return _0x165597;};'use strict';var Sequelize=require(_0xe5fe('0x0'));var moment=require(_0xe5fe('0x1'));module['exports']={'state':{'type':Sequelize[_0xe5fe('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe5fe('0x3')]},'scheduledat':{'type':Sequelize[_0xe5fe('0x4')]},'countbusyretry':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe5fe('0x3')]},'calleridname':{'type':Sequelize[_0xe5fe('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe5fe('0x4')]},'droptime':{'type':Sequelize[_0xe5fe('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe5fe('0x3')]},'membername':{'type':Sequelize[_0xe5fe('0x3')]},'reason':{'type':Sequelize[_0xe5fe('0x3')]},'disposition':{'type':Sequelize[_0xe5fe('0x3')]},'dispositionat':{'type':Sequelize[_0xe5fe('0x4')],'set':function(_0x368e0d){var _0x38e5ac=this[_0xe5fe('0x5')]('endtime');if(_0x38e5ac&&_0x368e0d){this[_0xe5fe('0x6')](_0xe5fe('0x7'),moment(_0x368e0d)[_0xe5fe('0x8')](moment(_0x38e5ac),'seconds'));}return this['setDataValue']('dispositionat',_0x368e0d);}},'amd':{'type':Sequelize[_0xe5fe('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe5fe('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe5fe('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe5fe('0x4')]},'callback':{'type':Sequelize[_0xe5fe('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe5fe('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe5fe('0x4')]},'deleted':{'type':Sequelize[_0xe5fe('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe5fe('0x4')]},'recallme':{'type':Sequelize[_0xe5fe('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe5fe('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe5fe('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe5fe('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 9c997d7..c14cab0 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 _0x323f=['json','apply','save','then','destroy','sendStatus','error','stack','name','send','map','CmHopperFinal','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','toString','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','updatedAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','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','../../config/logger','api','../../config/utils','../../config/environment','status','end','count','offset','limit','set','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x323f,0x1ee));var _0xf323=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x323f[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf323('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf323('0x1'));var jsonpatch=require(_0xf323('0x2'));var rp=require(_0xf323('0x3'));var moment=require(_0xf323('0x4'));var BPromise=require(_0xf323('0x5'));var Mustache=require(_0xf323('0x6'));var util=require(_0xf323('0x7'));var path=require(_0xf323('0x8'));var sox=require(_0xf323('0x9'));var csv=require(_0xf323('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf323('0xb'));var squel=require(_0xf323('0xc'));var crypto=require(_0xf323('0xd'));var jsforce=require(_0xf323('0xe'));var deskjs=require(_0xf323('0xf'));var toCsv=require(_0xf323('0xa'));var querystring=require(_0xf323('0x10'));var Papa=require(_0xf323('0x11'));var Redis=require(_0xf323('0x12'));var authService=require(_0xf323('0x13'));var qs=require(_0xf323('0x14'));var as=require(_0xf323('0x15'));var hardwareService=require(_0xf323('0x16'));var logger=require(_0xf323('0x17'))(_0xf323('0x18'));var utils=require(_0xf323('0x19'));var config=require(_0xf323('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b6a09,_0x7dbd26){_0x7dbd26=_0x7dbd26||0xcc;return function(_0x26eddb){if(_0x26eddb){return _0x1b6a09['sendStatus'](_0x7dbd26);}return _0x1b6a09[_0xf323('0x1b')](_0x7dbd26)[_0xf323('0x1c')]();};}function respondWithResult(_0x367db4,_0x3a829f){_0x3a829f=_0x3a829f||0xc8;return function(_0x22672e){if(_0x22672e){return _0x367db4[_0xf323('0x1b')](_0x3a829f)['json'](_0x22672e);}};}function respondWithFilteredResult(_0x4cc3ce,_0x874219){return function(_0x447517){if(_0x447517){var _0x38fd4c=_0x447517[_0xf323('0x1d')],_0x3858ee=_0x874219[_0xf323('0x1e')],_0x3db58a=_0x874219[_0xf323('0x1e')]+_0x874219[_0xf323('0x1f')],_0x55d87d;if(_0x3db58a>=_0x38fd4c){_0x3db58a=_0x38fd4c;_0x55d87d=0xc8;}else{_0x55d87d=0xce;}_0x4cc3ce['status'](_0x55d87d);return _0x4cc3ce[_0xf323('0x20')](_0xf323('0x21'),_0x3858ee+'-'+_0x3db58a+'/'+_0x38fd4c)[_0xf323('0x22')](_0x447517);}return null;};}function patchUpdates(_0x41b2cb){return function(_0x5955ea){try{jsonpatch[_0xf323('0x23')](_0x5955ea,_0x41b2cb,!![]);}catch(_0x9ce1ba){return BPromise['reject'](_0x9ce1ba);}return _0x5955ea[_0xf323('0x24')]();};}function saveUpdates(_0x44378e,_0x32a942){return function(_0x183ce0){if(_0x183ce0){return _0x183ce0['update'](_0x44378e)[_0xf323('0x25')](function(_0x1831bd){return _0x1831bd;});}return null;};}function removeEntity(_0x1c29d9,_0x52305d){return function(_0x43e467){if(_0x43e467){return _0x43e467[_0xf323('0x26')]()[_0xf323('0x25')](function(){_0x1c29d9[_0xf323('0x1b')](0xcc)[_0xf323('0x1c')]();});}};}function handleEntityNotFound(_0xa3362c,_0x189b23){return function(_0x43bc05){if(!_0x43bc05){_0xa3362c[_0xf323('0x27')](0x194);}return _0x43bc05;};}function handleError(_0x47fb15,_0xf85efe){_0xf85efe=_0xf85efe||0x1f4;return function(_0x308073){logger[_0xf323('0x28')](_0x308073[_0xf323('0x29')]);if(_0x308073[_0xf323('0x2a')]){delete _0x308073[_0xf323('0x2a')];}_0x47fb15['status'](_0xf85efe)[_0xf323('0x2b')](_0x308073);};}exports['index']=function(_0x1570d4,_0x3902eb){var _0x56be0c={},_0x46663b={},_0x3c95ce={'count':0x0,'rows':[]};var _0x2b6254=_[_0xf323('0x2c')](db[_0xf323('0x2d')]['rawAttributes'],function(_0x44c944){return{'name':_0x44c944[_0xf323('0x2e')],'type':_0x44c944[_0xf323('0x2f')][_0xf323('0x30')]};});_0x46663b[_0xf323('0x31')]=_[_0xf323('0x2c')](_0x2b6254,_0xf323('0x2a'));_0x46663b[_0xf323('0x32')]=_[_0xf323('0x33')](_0x1570d4['query']);_0x46663b[_0xf323('0x34')]=_[_0xf323('0x35')](_0x46663b[_0xf323('0x31')],_0x46663b[_0xf323('0x32')]);_0x56be0c[_0xf323('0x36')]=_['intersection'](_0x46663b[_0xf323('0x31')],qs[_0xf323('0x37')](_0x1570d4[_0xf323('0x32')][_0xf323('0x37')]));_0x56be0c[_0xf323('0x36')]=_0x56be0c['attributes'][_0xf323('0x38')]?_0x56be0c[_0xf323('0x36')]:_0x46663b[_0xf323('0x31')];if(!_0x1570d4[_0xf323('0x32')]['hasOwnProperty'](_0xf323('0x39'))){_0x56be0c['limit']=qs[_0xf323('0x1f')](_0x1570d4[_0xf323('0x32')]['limit']);_0x56be0c[_0xf323('0x1e')]=qs['offset'](_0x1570d4[_0xf323('0x32')]['offset']);}_0x56be0c[_0xf323('0x3a')]=qs['sort'](_0x1570d4[_0xf323('0x32')][_0xf323('0x3b')]);_0x56be0c['where']=qs['filters'](_['pick'](_0x1570d4[_0xf323('0x32')],_0x46663b[_0xf323('0x34')]),_0x2b6254);if(_0x1570d4[_0xf323('0x32')][_0xf323('0x3c')]){_0x56be0c[_0xf323('0x3d')]=_['merge'](_0x56be0c['where'],{'$or':_['map'](_0x2b6254,function(_0x365297){if(_0x365297['type']!==_0xf323('0x3e')){var _0x47e7a2={};_0x47e7a2[_0x365297[_0xf323('0x2a')]]={'$like':'%'+_0x1570d4[_0xf323('0x32')][_0xf323('0x3c')]+'%'};return _0x47e7a2;}})});}_0x56be0c=_[_0xf323('0x3f')]({},_0x56be0c,_0x1570d4[_0xf323('0x40')]);var _0x48a6c4={'where':_0x56be0c[_0xf323('0x3d')]};return db[_0xf323('0x2d')][_0xf323('0x1d')](_0x48a6c4)[_0xf323('0x25')](function(_0x455f75){_0x3c95ce[_0xf323('0x1d')]=_0x455f75;if(_0x1570d4[_0xf323('0x32')][_0xf323('0x41')]){_0x56be0c[_0xf323('0x42')]=[{'all':!![]}];}return db[_0xf323('0x2d')][_0xf323('0x43')](_0x56be0c);})[_0xf323('0x25')](function(_0xc48a6e){_0x3c95ce[_0xf323('0x44')]=_0xc48a6e;return _0x3c95ce;})[_0xf323('0x25')](respondWithFilteredResult(_0x3902eb,_0x56be0c))[_0xf323('0x45')](handleError(_0x3902eb,null));};exports['show']=function(_0x502114,_0x1818c4){var _0x16ac6d={'raw':!![],'where':{'id':_0x502114[_0xf323('0x46')]['id']}},_0x2864f7={};_0x2864f7[_0xf323('0x31')]=_[_0xf323('0x33')](db[_0xf323('0x2d')][_0xf323('0x47')]);_0x2864f7[_0xf323('0x32')]=_[_0xf323('0x33')](_0x502114[_0xf323('0x32')]);_0x2864f7[_0xf323('0x34')]=_[_0xf323('0x35')](_0x2864f7['model'],_0x2864f7[_0xf323('0x32')]);_0x16ac6d['attributes']=_['intersection'](_0x2864f7[_0xf323('0x31')],qs['fields'](_0x502114['query'][_0xf323('0x37')]));_0x16ac6d[_0xf323('0x36')]=_0x16ac6d[_0xf323('0x36')][_0xf323('0x38')]?_0x16ac6d[_0xf323('0x36')]:_0x2864f7[_0xf323('0x31')];if(_0x502114[_0xf323('0x32')][_0xf323('0x41')]){_0x16ac6d[_0xf323('0x42')]=[{'all':!![]}];}_0x16ac6d=_[_0xf323('0x3f')]({},_0x16ac6d,_0x502114[_0xf323('0x40')]);return db['CmHopperFinal'][_0xf323('0x48')](_0x16ac6d)['then'](handleEntityNotFound(_0x1818c4,null))[_0xf323('0x25')](respondWithResult(_0x1818c4,null))[_0xf323('0x45')](handleError(_0x1818c4,null));};exports[_0xf323('0x49')]=function(_0x9c525e,_0x542205){return db['CmHopperFinal'][_0xf323('0x49')]()['then'](respondWithResult(_0x542205,null))[_0xf323('0x45')](handleError(_0x542205,null));};exports['update']=function(_0x2204f5,_0x8980f){if(_0x2204f5['body'][_0xf323('0x4a')]){delete _0x2204f5[_0xf323('0x4b')][_0xf323('0x4a')];}return db[_0xf323('0x2d')][_0xf323('0x48')]({'where':{'uniqueid':_0x2204f5[_0xf323('0x46')]['id']}})[_0xf323('0x25')](handleEntityNotFound(_0x8980f,null))[_0xf323('0x25')](saveUpdates(_0x2204f5[_0xf323('0x4b')],null))[_0xf323('0x25')](respondWithResult(_0x8980f,null))[_0xf323('0x45')](handleError(_0x8980f,null));};exports[_0xf323('0x4c')]=function(_0x1b07dc,_0x4e2dbc,_0x108ec1){return db[_0xf323('0x2d')][_0xf323('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x1b07dc[_0xf323('0x46')]['id']},'attributes':[[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db['sequelize']['fn']('IF',db[_0xf323('0x4d')][_0xf323('0x4f')]('`state`\x20=\x200,\x201,\x20null'))),_0xf323('0x50')],[db[_0xf323('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xf323('0x4d')][_0xf323('0x4f')](_0xf323('0x51')))),_0xf323('0x52')],[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')]['literal'](_0xf323('0x53')))),_0xf323('0x54')],[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')][_0xf323('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0xf323('0x55')],[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')][_0xf323('0x4f')](_0xf323('0x56')))),_0xf323('0x57')],[db[_0xf323('0x4d')]['fn']('COUNT',db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')][_0xf323('0x4f')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xf323('0x58')],[db[_0xf323('0x4d')]['fn']('COUNT',db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')]['literal'](_0xf323('0x59')))),_0xf323('0x5a')],[db['sequelize']['fn'](_0xf323('0x4e'),db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')][_0xf323('0x4f')](_0xf323('0x5b')))),_0xf323('0x5c')]]})[_0xf323('0x25')](handleEntityNotFound(_0x4e2dbc,null))[_0xf323('0x25')](respondWithResult(_0x4e2dbc,null))[_0xf323('0x45')](handleError(_0x4e2dbc,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xd1902b,_0x31942f,_0x4c8e6f){return db[_0xf323('0x2d')][_0xf323('0x43')]({'raw':![],'where':{'CampaignId':_0xd1902b['params']['id']},'attributes':[[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')]['literal'](_0xf323('0x5d')))),_0xf323('0x50')],[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db['sequelize']['fn']('IF',db[_0xf323('0x4d')][_0xf323('0x4f')](_0xf323('0x51')))),_0xf323('0x52')],[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')][_0xf323('0x4f')](_0xf323('0x53')))),_0xf323('0x54')],[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xf323('0x55')],[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')][_0xf323('0x4f')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xf323('0x57')],[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db[_0xf323('0x4d')]['fn']('IF',db['sequelize']['literal'](_0xf323('0x5e')))),_0xf323('0x58')],[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')][_0xf323('0x4f')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0xf323('0x4d')]['fn'](_0xf323('0x4e'),db[_0xf323('0x4d')]['fn']('IF',db[_0xf323('0x4d')][_0xf323('0x4f')](_0xf323('0x5b')))),'answeringMachine']]})[_0xf323('0x25')](handleEntityNotFound(_0x31942f,null))[_0xf323('0x25')](respondWithResult(_0x31942f,null))['catch'](handleError(_0x31942f,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x12853b,_0x2833b1,_0x58c80e){return db[_0xf323('0x5f')][_0xf323('0x48')]({'where':{'id':_0x12853b[_0xf323('0x46')]['id']}})['then'](handleEntityNotFound(_0x2833b1,null))[_0xf323('0x25')](function(_0x5bcdad){var _0x51780e;if(_0x5bcdad){_0x51780e=squel[_0xf323('0x60')]()[_0xf323('0x61')](_0xf323('0x62'))[_0xf323('0x63')]([_0xf323('0x64'),'scheduledAt',_0xf323('0x65'),_0xf323('0x66'),_0xf323('0x67'),_0xf323('0x68'),'updatedAt'],squel[_0xf323('0x69')]()[_0xf323('0x6a')](_0xf323('0x6b'),_0xf323('0x64'))[_0xf323('0x6a')](_0xf323('0x6c'),_0xf323('0x6d'))[_0xf323('0x6a')](_0xf323('0x6e'),'ContactId')[_0xf323('0x6a')](_0xf323('0x6f'),_0xf323('0x66'))['field']('ANY_VALUE(VoiceQueueId)',_0xf323('0x67'))['field'](_0xf323('0x6c'),_0xf323('0x68'))[_0xf323('0x6a')](_0xf323('0x6c'),'updatedAt')[_0xf323('0x70')](_0xf323('0x71'))[_0xf323('0x3d')](_0xf323('0x72'),_0x12853b[_0xf323('0x46')]['id']['toString']())[_0xf323('0x3d')](_0xf323('0x73'),_0x12853b[_0xf323('0x4b')][_0xf323('0x74')]['toString']())['where'](_0xf323('0x75'))[_0xf323('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf323('0x69')]()['field'](_0xf323('0x64'))[_0xf323('0x70')](_0xf323('0x62'))['where'](_0xf323('0x72'),_0x12853b[_0xf323('0x46')]['id']['toString']()))[_0xf323('0x3d')](_0xf323('0x76'),squel[_0xf323('0x69')]()[_0xf323('0x6a')](_0xf323('0x77'))['from'](_0xf323('0x71'))[_0xf323('0x3d')](_0xf323('0x72'),_0x12853b[_0xf323('0x46')]['id'][_0xf323('0x78')]())['where'](_0xf323('0x79')))['group']('ContactId'))['toString']();return db[_0xf323('0x4d')][_0xf323('0x32')](_0x51780e);}return[];})[_0xf323('0x25')](respondWithResult(_0x2833b1,null))['catch'](handleError(_0x2833b1,null));};exports[_0xf323('0x7a')]=function(_0x25de8a,_0x4d3478,_0x20425f){return db[_0xf323('0x7b')][_0xf323('0x48')]({'where':{'id':_0x25de8a[_0xf323('0x46')]['id']}})[_0xf323('0x25')](handleEntityNotFound(_0x4d3478,null))[_0xf323('0x25')](function(_0x1ecd12){var _0xc3f4d7;if(_0x1ecd12){_0xc3f4d7=squel['insert']()[_0xf323('0x61')](_0xf323('0x62'))[_0xf323('0x63')](['phone','scheduledAt',_0xf323('0x65'),_0xf323('0x66'),_0xf323('0x7c'),_0xf323('0x68'),_0xf323('0x7d')],squel['select']()['field'](_0xf323('0x6b'),_0xf323('0x64'))['field'](_0xf323('0x6c'),_0xf323('0x6d'))['field'](_0xf323('0x6e'),_0xf323('0x65'))[_0xf323('0x6a')](_0xf323('0x6f'),'ListId')[_0xf323('0x6a')](_0xf323('0x7e'),_0xf323('0x7c'))[_0xf323('0x6a')](_0xf323('0x6c'),_0xf323('0x68'))[_0xf323('0x6a')](_0xf323('0x6c'),_0xf323('0x7d'))['from'](_0xf323('0x71'))[_0xf323('0x3d')](_0xf323('0x7f'),_0x25de8a['params']['id'][_0xf323('0x78')]())[_0xf323('0x3d')]('state\x20=\x20?',_0x25de8a['body'][_0xf323('0x74')][_0xf323('0x78')]())[_0xf323('0x3d')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xf323('0x76'),squel['select']()[_0xf323('0x6a')](_0xf323('0x64'))[_0xf323('0x70')](_0xf323('0x62'))['where'](_0xf323('0x7f'),_0x25de8a['params']['id'][_0xf323('0x78')]()))[_0xf323('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf323('0x69')]()[_0xf323('0x6a')]('calleridnum')[_0xf323('0x70')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x25de8a[_0xf323('0x46')]['id'][_0xf323('0x78')]())[_0xf323('0x3d')](_0xf323('0x79')))[_0xf323('0x80')]('ContactId'))[_0xf323('0x78')]();return db[_0xf323('0x4d')][_0xf323('0x32')](_0xc3f4d7);}return[];})[_0xf323('0x25')](respondWithResult(_0x4d3478,null))[_0xf323('0x45')](handleError(_0x4d3478,null));};exports[_0xf323('0x81')]=function(_0x2a83b3,_0xaaebcc,_0x479124){return db[_0xf323('0x82')][_0xf323('0x83')]({'where':{'VoiceQueueId':_0x2a83b3[_0xf323('0x4b')]['VoiceQueueId'],'CampaignId':_0x2a83b3['body']['CampaignId'],'ContactId':_0x2a83b3[_0xf323('0x4b')][_0xf323('0x65')]}})[_0xf323('0x25')](handleEntityNotFound(_0xaaebcc,null))[_0xf323('0x25')](function(_0xa2b759){if(_0xa2b759){return _0xa2b759;}return null;})[_0xf323('0x25')](respondWithResult(_0xaaebcc,null))[_0xf323('0x45')](handleError(_0xaaebcc,null));}; \ No newline at end of file +var _0x0650=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','save','then','sendStatus','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','include','findAll','rows','catch','show','params','length','includeAll','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','Campaign','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x2b9896,_0x414ed2){var _0x545895=function(_0x507c60){while(--_0x507c60){_0x2b9896['push'](_0x2b9896['shift']());}};_0x545895(++_0x414ed2);}(_0x0650,0xed));var _0x0065=function(_0x111b29,_0x57139e){_0x111b29=_0x111b29-0x0;var _0x56fe78=_0x0650[_0x111b29];return _0x56fe78;};'use strict';var pdf=require(_0x0065('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0065('0x1'));var zipdir=require(_0x0065('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0065('0x3'));var moment=require('moment');var BPromise=require(_0x0065('0x4'));var Mustache=require(_0x0065('0x5'));var util=require(_0x0065('0x6'));var path=require('path');var sox=require(_0x0065('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0065('0x8'));var crypto=require(_0x0065('0x9'));var jsforce=require(_0x0065('0xa'));var deskjs=require(_0x0065('0xb'));var toCsv=require(_0x0065('0xc'));var querystring=require(_0x0065('0xd'));var Papa=require(_0x0065('0xe'));var Redis=require(_0x0065('0xf'));var authService=require(_0x0065('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0065('0x11'));var hardwareService=require(_0x0065('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0065('0x13'));var db=require(_0x0065('0x14'))['db'];function respondWithStatusCode(_0x5a2cb8,_0x45c7d1){_0x45c7d1=_0x45c7d1||0xcc;return function(_0x4255f6){if(_0x4255f6){return _0x5a2cb8['sendStatus'](_0x45c7d1);}return _0x5a2cb8[_0x0065('0x15')](_0x45c7d1)[_0x0065('0x16')]();};}function respondWithResult(_0x587bb2,_0x5ae653){_0x5ae653=_0x5ae653||0xc8;return function(_0x1b9b1e){if(_0x1b9b1e){return _0x587bb2['status'](_0x5ae653)['json'](_0x1b9b1e);}};}function respondWithFilteredResult(_0x2d29c5,_0x5773d6){return function(_0x38a870){if(_0x38a870){var _0x48d817=_0x38a870[_0x0065('0x17')],_0x391fc1=_0x5773d6[_0x0065('0x18')],_0x262d63=_0x5773d6[_0x0065('0x18')]+_0x5773d6[_0x0065('0x19')],_0x342d6b;if(_0x262d63>=_0x48d817){_0x262d63=_0x48d817;_0x342d6b=0xc8;}else{_0x342d6b=0xce;}_0x2d29c5[_0x0065('0x15')](_0x342d6b);return _0x2d29c5['set'](_0x0065('0x1a'),_0x391fc1+'-'+_0x262d63+'/'+_0x48d817)[_0x0065('0x1b')](_0x38a870);}return null;};}function patchUpdates(_0x49de99){return function(_0x967398){try{jsonpatch[_0x0065('0x1c')](_0x967398,_0x49de99,!![]);}catch(_0x278dff){return BPromise[_0x0065('0x1d')](_0x278dff);}return _0x967398[_0x0065('0x1e')]();};}function saveUpdates(_0x3eee18,_0x319e7a){return function(_0x529e30){if(_0x529e30){return _0x529e30['update'](_0x3eee18)['then'](function(_0x3f7af1){return _0x3f7af1;});}return null;};}function removeEntity(_0x657b,_0x5b60c3){return function(_0x2de3ae){if(_0x2de3ae){return _0x2de3ae['destroy']()[_0x0065('0x1f')](function(){_0x657b[_0x0065('0x15')](0xcc)[_0x0065('0x16')]();});}};}function handleEntityNotFound(_0x376452,_0x161b4c){return function(_0x1efa70){if(!_0x1efa70){_0x376452[_0x0065('0x20')](0x194);}return _0x1efa70;};}function handleError(_0x5d9911,_0x7057d1){_0x7057d1=_0x7057d1||0x1f4;return function(_0x5cb4b0){logger['error'](_0x5cb4b0[_0x0065('0x21')]);if(_0x5cb4b0['name']){delete _0x5cb4b0[_0x0065('0x22')];}_0x5d9911[_0x0065('0x15')](_0x7057d1)['send'](_0x5cb4b0);};}exports[_0x0065('0x23')]=function(_0x5e1829,_0x5542e0){var _0xb1378f={},_0x221be2={},_0x47eede={'count':0x0,'rows':[]};var _0x549fe1=_['map'](db[_0x0065('0x24')][_0x0065('0x25')],function(_0x1a977a){return{'name':_0x1a977a[_0x0065('0x26')],'type':_0x1a977a[_0x0065('0x27')]['key']};});_0x221be2['model']=_['map'](_0x549fe1,_0x0065('0x22'));_0x221be2[_0x0065('0x28')]=_[_0x0065('0x29')](_0x5e1829['query']);_0x221be2[_0x0065('0x2a')]=_[_0x0065('0x2b')](_0x221be2['model'],_0x221be2[_0x0065('0x28')]);_0xb1378f[_0x0065('0x2c')]=_[_0x0065('0x2b')](_0x221be2[_0x0065('0x2d')],qs[_0x0065('0x2e')](_0x5e1829[_0x0065('0x28')][_0x0065('0x2e')]));_0xb1378f[_0x0065('0x2c')]=_0xb1378f['attributes']['length']?_0xb1378f['attributes']:_0x221be2[_0x0065('0x2d')];if(!_0x5e1829[_0x0065('0x28')][_0x0065('0x2f')](_0x0065('0x30'))){_0xb1378f[_0x0065('0x19')]=qs[_0x0065('0x19')](_0x5e1829[_0x0065('0x28')]['limit']);_0xb1378f[_0x0065('0x18')]=qs[_0x0065('0x18')](_0x5e1829[_0x0065('0x28')][_0x0065('0x18')]);}_0xb1378f[_0x0065('0x31')]=qs['sort'](_0x5e1829[_0x0065('0x28')][_0x0065('0x32')]);_0xb1378f[_0x0065('0x33')]=qs[_0x0065('0x2a')](_[_0x0065('0x34')](_0x5e1829[_0x0065('0x28')],_0x221be2[_0x0065('0x2a')]),_0x549fe1);if(_0x5e1829[_0x0065('0x28')][_0x0065('0x35')]){_0xb1378f[_0x0065('0x33')]=_['merge'](_0xb1378f[_0x0065('0x33')],{'$or':_[_0x0065('0x36')](_0x549fe1,function(_0x3e174b){if(_0x3e174b['type']!==_0x0065('0x37')){var _0x9255df={};_0x9255df[_0x3e174b[_0x0065('0x22')]]={'$like':'%'+_0x5e1829[_0x0065('0x28')][_0x0065('0x35')]+'%'};return _0x9255df;}})});}_0xb1378f=_[_0x0065('0x38')]({},_0xb1378f,_0x5e1829['options']);var _0x32e6f={'where':_0xb1378f[_0x0065('0x33')]};return db[_0x0065('0x24')]['count'](_0x32e6f)[_0x0065('0x1f')](function(_0x59409c){_0x47eede[_0x0065('0x17')]=_0x59409c;if(_0x5e1829[_0x0065('0x28')]['includeAll']){_0xb1378f[_0x0065('0x39')]=[{'all':!![]}];}return db[_0x0065('0x24')][_0x0065('0x3a')](_0xb1378f);})[_0x0065('0x1f')](function(_0x44556f){_0x47eede[_0x0065('0x3b')]=_0x44556f;return _0x47eede;})['then'](respondWithFilteredResult(_0x5542e0,_0xb1378f))[_0x0065('0x3c')](handleError(_0x5542e0,null));};exports[_0x0065('0x3d')]=function(_0x145336,_0x1b8f52){var _0x1d251d={'raw':!![],'where':{'id':_0x145336[_0x0065('0x3e')]['id']}},_0x1b516c={};_0x1b516c[_0x0065('0x2d')]=_[_0x0065('0x29')](db[_0x0065('0x24')][_0x0065('0x25')]);_0x1b516c[_0x0065('0x28')]=_[_0x0065('0x29')](_0x145336[_0x0065('0x28')]);_0x1b516c[_0x0065('0x2a')]=_[_0x0065('0x2b')](_0x1b516c[_0x0065('0x2d')],_0x1b516c[_0x0065('0x28')]);_0x1d251d[_0x0065('0x2c')]=_[_0x0065('0x2b')](_0x1b516c[_0x0065('0x2d')],qs[_0x0065('0x2e')](_0x145336[_0x0065('0x28')]['fields']));_0x1d251d[_0x0065('0x2c')]=_0x1d251d['attributes'][_0x0065('0x3f')]?_0x1d251d['attributes']:_0x1b516c[_0x0065('0x2d')];if(_0x145336['query'][_0x0065('0x40')]){_0x1d251d[_0x0065('0x39')]=[{'all':!![]}];}_0x1d251d=_[_0x0065('0x38')]({},_0x1d251d,_0x145336['options']);return db['CmHopperFinal'][_0x0065('0x41')](_0x1d251d)[_0x0065('0x1f')](handleEntityNotFound(_0x1b8f52,null))[_0x0065('0x1f')](respondWithResult(_0x1b8f52,null))[_0x0065('0x3c')](handleError(_0x1b8f52,null));};exports['describe']=function(_0x1d9807,_0x132af6){return db[_0x0065('0x24')][_0x0065('0x42')]()[_0x0065('0x1f')](respondWithResult(_0x132af6,null))['catch'](handleError(_0x132af6,null));};exports[_0x0065('0x43')]=function(_0x5ef382,_0x339730){if(_0x5ef382[_0x0065('0x44')][_0x0065('0x45')]){delete _0x5ef382[_0x0065('0x44')]['uniqueid'];}return db[_0x0065('0x24')]['find']({'where':{'uniqueid':_0x5ef382[_0x0065('0x3e')]['id']}})[_0x0065('0x1f')](handleEntityNotFound(_0x339730,null))[_0x0065('0x1f')](saveUpdates(_0x5ef382[_0x0065('0x44')],null))[_0x0065('0x1f')](respondWithResult(_0x339730,null))[_0x0065('0x3c')](handleError(_0x339730,null));};exports[_0x0065('0x46')]=function(_0x1ca888,_0x3fd610,_0x42d53f){return db[_0x0065('0x24')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x1ca888[_0x0065('0x3e')]['id']},'attributes':[[db[_0x0065('0x47')]['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')](_0x0065('0x4a')))),'noSuchContacts'],[db['sequelize']['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')](_0x0065('0x4b')))),_0x0065('0x4c')],[db[_0x0065('0x47')]['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')](_0x0065('0x4d')))),_0x0065('0x4e')],[db['sequelize']['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db['sequelize'][_0x0065('0x49')](_0x0065('0x4f')))),_0x0065('0x50')],[db['sequelize']['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0065('0x51')],[db[_0x0065('0x47')]['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0065('0x52')],[db['sequelize']['fn'](_0x0065('0x48'),db['sequelize']['fn']('IF',db[_0x0065('0x47')]['literal'](_0x0065('0x53')))),_0x0065('0x54')],[db['sequelize']['fn']('COUNT',db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')]('`state`\x20=\x2019,\x201,\x20null'))),_0x0065('0x55')]]})[_0x0065('0x1f')](handleEntityNotFound(_0x3fd610,null))['then'](respondWithResult(_0x3fd610,null))['catch'](handleError(_0x3fd610,null));};exports[_0x0065('0x56')]=function(_0x2a6f28,_0x1ac140,_0x55ded6){return db[_0x0065('0x24')]['findAll']({'raw':![],'where':{'CampaignId':_0x2a6f28[_0x0065('0x3e')]['id']},'attributes':[[db[_0x0065('0x47')]['fn']('COUNT',db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')](_0x0065('0x4a')))),'noSuchContacts'],[db[_0x0065('0x47')]['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db['sequelize']['literal'](_0x0065('0x4b')))),_0x0065('0x4c')],[db['sequelize']['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')]('`state`\x20=\x205,\x201,\x20null'))),_0x0065('0x4e')],[db[_0x0065('0x47')]['fn']('COUNT',db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')]['literal'](_0x0065('0x4f')))),_0x0065('0x50')],[db[_0x0065('0x47')]['fn']('COUNT',db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')][_0x0065('0x49')](_0x0065('0x57')))),_0x0065('0x51')],[db[_0x0065('0x47')]['fn'](_0x0065('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x0065('0x49')](_0x0065('0x58')))),_0x0065('0x52')],[db[_0x0065('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x0065('0x49')](_0x0065('0x53')))),_0x0065('0x54')],[db['sequelize']['fn'](_0x0065('0x48'),db[_0x0065('0x47')]['fn']('IF',db[_0x0065('0x47')]['literal'](_0x0065('0x59')))),_0x0065('0x55')]]})[_0x0065('0x1f')](handleEntityNotFound(_0x1ac140,null))['then'](respondWithResult(_0x1ac140,null))[_0x0065('0x3c')](handleError(_0x1ac140,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x10c177,_0x3af42f,_0xdf4d8e){return db[_0x0065('0x5a')][_0x0065('0x41')]({'where':{'id':_0x10c177[_0x0065('0x3e')]['id']}})[_0x0065('0x1f')](handleEntityNotFound(_0x3af42f,null))[_0x0065('0x1f')](function(_0x93842){var _0x23de06;if(_0x93842){_0x23de06=squel['insert']()[_0x0065('0x5b')](_0x0065('0x5c'))[_0x0065('0x5d')]([_0x0065('0x5e'),_0x0065('0x5f'),'ContactId',_0x0065('0x60'),_0x0065('0x61'),_0x0065('0x62'),_0x0065('0x63')],squel[_0x0065('0x64')]()['field'](_0x0065('0x65'),'phone')[_0x0065('0x66')](_0x0065('0x67'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x0065('0x68'))[_0x0065('0x66')](_0x0065('0x69'),'ListId')[_0x0065('0x66')](_0x0065('0x6a'),'VoiceQueueId')[_0x0065('0x66')](_0x0065('0x67'),_0x0065('0x62'))['field']('NOW()',_0x0065('0x63'))['from'](_0x0065('0x6b'))[_0x0065('0x33')](_0x0065('0x6c'),_0x10c177[_0x0065('0x3e')]['id'][_0x0065('0x6d')]())['where'](_0x0065('0x6e'),_0x10c177['body'][_0x0065('0x6f')][_0x0065('0x6d')]())[_0x0065('0x33')](_0x0065('0x70'))[_0x0065('0x33')](_0x0065('0x71'),squel[_0x0065('0x64')]()['field'](_0x0065('0x5e'))[_0x0065('0x72')](_0x0065('0x5c'))[_0x0065('0x33')](_0x0065('0x6c'),_0x10c177[_0x0065('0x3e')]['id'][_0x0065('0x6d')]()))[_0x0065('0x33')](_0x0065('0x71'),squel[_0x0065('0x64')]()['field'](_0x0065('0x73'))[_0x0065('0x72')](_0x0065('0x6b'))[_0x0065('0x33')](_0x0065('0x6c'),_0x10c177[_0x0065('0x3e')]['id']['toString']())['where'](_0x0065('0x74')))['group'](_0x0065('0x68')))[_0x0065('0x6d')]();return db[_0x0065('0x47')][_0x0065('0x28')](_0x23de06);}return[];})[_0x0065('0x1f')](respondWithResult(_0x3af42f,null))[_0x0065('0x3c')](handleError(_0x3af42f,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1f4cf5,_0x28b02e,_0x15dc88){return db[_0x0065('0x75')][_0x0065('0x41')]({'where':{'id':_0x1f4cf5['params']['id']}})[_0x0065('0x1f')](handleEntityNotFound(_0x28b02e,null))[_0x0065('0x1f')](function(_0x5c43b9){var _0x1f8848;if(_0x5c43b9){_0x1f8848=squel['insert']()[_0x0065('0x5b')](_0x0065('0x5c'))[_0x0065('0x5d')](['phone',_0x0065('0x5f'),_0x0065('0x68'),'ListId',_0x0065('0x76'),_0x0065('0x62'),'updatedAt'],squel[_0x0065('0x64')]()['field'](_0x0065('0x65'),'phone')[_0x0065('0x66')](_0x0065('0x67'),_0x0065('0x5f'))['field'](_0x0065('0x77'),_0x0065('0x68'))[_0x0065('0x66')](_0x0065('0x69'),_0x0065('0x60'))[_0x0065('0x66')](_0x0065('0x78'),_0x0065('0x76'))[_0x0065('0x66')](_0x0065('0x67'),_0x0065('0x62'))[_0x0065('0x66')](_0x0065('0x67'),'updatedAt')[_0x0065('0x72')](_0x0065('0x6b'))[_0x0065('0x33')]('CampaignId\x20=\x20?',_0x1f4cf5[_0x0065('0x3e')]['id'][_0x0065('0x6d')]())[_0x0065('0x33')](_0x0065('0x6e'),_0x1f4cf5[_0x0065('0x44')][_0x0065('0x6f')][_0x0065('0x6d')]())[_0x0065('0x33')](_0x0065('0x70'))[_0x0065('0x33')](_0x0065('0x71'),squel[_0x0065('0x64')]()[_0x0065('0x66')](_0x0065('0x5e'))[_0x0065('0x72')](_0x0065('0x5c'))[_0x0065('0x33')](_0x0065('0x79'),_0x1f4cf5['params']['id'][_0x0065('0x6d')]()))[_0x0065('0x33')](_0x0065('0x71'),squel[_0x0065('0x64')]()[_0x0065('0x66')](_0x0065('0x73'))[_0x0065('0x72')](_0x0065('0x6b'))['where'](_0x0065('0x79'),_0x1f4cf5['params']['id'][_0x0065('0x6d')]())['where'](_0x0065('0x74')))[_0x0065('0x7a')](_0x0065('0x68')))['toString']();return db[_0x0065('0x47')][_0x0065('0x28')](_0x1f8848);}return[];})[_0x0065('0x1f')](respondWithResult(_0x28b02e,null))[_0x0065('0x3c')](handleError(_0x28b02e,null));};exports[_0x0065('0x7b')]=function(_0x11fa10,_0x34c727,_0x325a5){return db[_0x0065('0x7c')]['findOne']({'where':{'VoiceQueueId':_0x11fa10[_0x0065('0x44')][_0x0065('0x61')],'CampaignId':_0x11fa10[_0x0065('0x44')][_0x0065('0x76')],'ContactId':_0x11fa10['body']['ContactId']}})[_0x0065('0x1f')](handleEntityNotFound(_0x34c727,null))[_0x0065('0x1f')](function(_0x1e23fe){if(_0x1e23fe){return _0x1e23fe;}return null;})[_0x0065('0x1f')](respondWithResult(_0x34c727,null))['catch'](handleError(_0x34c727,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 448479f..adca11d 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 _0xc73e=['exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment','rimraf','../../config/environment'];(function(_0x20364d,_0x2aeeff){var _0x376937=function(_0x463934){while(--_0x463934){_0x20364d['push'](_0x20364d['shift']());}};_0x376937(++_0x2aeeff);}(_0xc73e,0x1e9));var _0xec73=function(_0x5d2918,_0x3876fc){_0x5d2918=_0x5d2918-0x0;var _0x4671be=_0xc73e[_0x5d2918];return _0x4671be;};'use strict';var _=require(_0xec73('0x0'));var util=require(_0xec73('0x1'));var logger=require('../../config/logger')(_0xec73('0x2'));var moment=require(_0xec73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xec73('0x4'));var config=require(_0xec73('0x5'));var attributes=require('./cmHopperFinal.attributes');module[_0xec73('0x6')]=function(_0x26598a,_0x3bd154){return _0x26598a[_0xec73('0x7')]('CmHopperFinal',attributes,{'tableName':_0xec73('0x8'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xec73('0x9')]},{'name':_0xec73('0xa'),'fields':[_0xec73('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3140=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','request-promise'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0x3140,0xaf));var _0x0314=function(_0x27472b,_0x1e5ca1){_0x27472b=_0x27472b-0x0;var _0x249243=_0x3140[_0x27472b];return _0x249243;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var logger=require(_0x0314('0x2'))(_0x0314('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0314('0x4'));var fs=require('fs');var path=require(_0x0314('0x5'));var rimraf=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var attributes=require(_0x0314('0x8'));module[_0x0314('0x9')]=function(_0x9e308d,_0xf87d26){return _0x9e308d[_0x0314('0xa')](_0x0314('0xb'),attributes,{'tableName':_0x0314('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x0314('0xd')]},{'name':_0x0314('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index b08db3b..e893b57 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 _0xf84c=['debug','stringify','error','code','CmHopperFinal,\x20%s,\x20%s','message','result','catch','CmHopperFinal','body','options','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent'];(function(_0x3c9a54,_0x13cede){var _0x4b4b40=function(_0x130dce){while(--_0x130dce){_0x3c9a54['push'](_0x3c9a54['shift']());}};_0x4b4b40(++_0x13cede);}(_0xf84c,0x1b5));var _0xcf84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf84c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf84('0x0'));var util=require(_0xcf84('0x1'));var moment=require(_0xcf84('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf84('0x3'));var fs=require('fs');var Redis=require(_0xcf84('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf84('0x5'));var logger=require(_0xcf84('0x6'))(_0xcf84('0x7'));var config=require(_0xcf84('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcf84('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x38c445,_0xd2fc54,_0x27a21d){return new BPromise(function(_0x4299b3,_0x21bb43){return client[_0xcf84('0xa')](_0x38c445,_0x27a21d)['then'](function(_0xf369b5){logger[_0xcf84('0xb')]('CmHopperFinal,\x20%s,\x20%s',_0xd2fc54,_0xcf84('0xc'));logger[_0xcf84('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0xd2fc54,_0xcf84('0xc'),JSON[_0xcf84('0xe')](_0xf369b5));if(_0xf369b5[_0xcf84('0xf')]){if(_0xf369b5[_0xcf84('0xf')][_0xcf84('0x10')]===0x1f4){logger[_0xcf84('0xf')](_0xcf84('0x11'),_0xd2fc54,_0xf369b5[_0xcf84('0xf')][_0xcf84('0x12')]);return _0x21bb43(_0xf369b5[_0xcf84('0xf')][_0xcf84('0x12')]);}logger[_0xcf84('0xf')](_0xcf84('0x11'),_0xd2fc54,_0xf369b5['error'][_0xcf84('0x12')]);return _0x4299b3(_0xf369b5['error'][_0xcf84('0x12')]);}else{logger['info']('CmHopperFinal,\x20%s,\x20%s',_0xd2fc54,'request\x20sent');_0x4299b3(_0xf369b5[_0xcf84('0x13')][_0xcf84('0x12')]);}})[_0xcf84('0x14')](function(_0x12323f){logger[_0xcf84('0xf')](_0xcf84('0x11'),_0xd2fc54,_0x12323f);_0x21bb43(_0x12323f);});});}exports['CreateCmHopperFinal']=function(_0xc83f16){var _0x44bd5a=this;return new Promise(function(_0xb4fdd5,_0x13bf83){return db[_0xcf84('0x15')]['create'](_0xc83f16[_0xcf84('0x16')],{'raw':_0xc83f16[_0xcf84('0x17')]?_0xc83f16[_0xcf84('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5ad02c){logger[_0xcf84('0xb')](_0xcf84('0x18'),_0xc83f16);logger[_0xcf84('0xd')](_0xcf84('0x18'),_0xc83f16,JSON[_0xcf84('0xe')](_0x5ad02c));_0xb4fdd5(_0x5ad02c);})[_0xcf84('0x14')](function(_0x34e560){logger['error']('CreateCmHopperFinal',_0x34e560[_0xcf84('0x12')],_0xc83f16);_0x13bf83(_0x44bd5a[_0xcf84('0xf')](0x1f4,_0x34e560[_0xcf84('0x12')]));});});}; \ No newline at end of file +var _0xabfc=['CmHopperFinal,\x20%s,\x20%s','request\x20sent','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','body','options','then','debug','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0xabfc,0x194));var _0xcabf=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xabfc[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0xcabf('0x0'));var util=require(_0xcabf('0x1'));var moment=require(_0xcabf('0x2'));var BPromise=require(_0xcabf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcabf('0x4'));var logger=require('../../config/logger')(_0xcabf('0x5'));var config=require(_0xcabf('0x6'));var jayson=require(_0xcabf('0x7'));var client=jayson[_0xcabf('0x8')][_0xcabf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa50cf2,_0x1e07de,_0x3c8b61){return new BPromise(function(_0x2fcca9,_0x4b39d9){return client[_0xcabf('0xa')](_0xa50cf2,_0x3c8b61)['then'](function(_0x3551d4){logger[_0xcabf('0xb')](_0xcabf('0xc'),_0x1e07de,_0xcabf('0xd'));logger['debug'](_0xcabf('0xe'),_0x1e07de,'request\x20sent',JSON[_0xcabf('0xf')](_0x3551d4));if(_0x3551d4['error']){if(_0x3551d4[_0xcabf('0x10')]['code']===0x1f4){logger[_0xcabf('0x10')]('CmHopperFinal,\x20%s,\x20%s',_0x1e07de,_0x3551d4[_0xcabf('0x10')][_0xcabf('0x11')]);return _0x4b39d9(_0x3551d4[_0xcabf('0x10')][_0xcabf('0x11')]);}logger[_0xcabf('0x10')](_0xcabf('0xc'),_0x1e07de,_0x3551d4[_0xcabf('0x10')]['message']);return _0x2fcca9(_0x3551d4[_0xcabf('0x10')]['message']);}else{logger['info'](_0xcabf('0xc'),_0x1e07de,_0xcabf('0xd'));_0x2fcca9(_0x3551d4[_0xcabf('0x12')][_0xcabf('0x11')]);}})['catch'](function(_0x3d0dc9){logger[_0xcabf('0x10')](_0xcabf('0xc'),_0x1e07de,_0x3d0dc9);_0x4b39d9(_0x3d0dc9);});});}exports[_0xcabf('0x13')]=function(_0x52b50d){var _0x4b4b36=this;return new Promise(function(_0x21934a,_0x1f2b61){return db[_0xcabf('0x14')][_0xcabf('0x15')](_0x52b50d[_0xcabf('0x16')],{'raw':_0x52b50d[_0xcabf('0x17')]?_0x52b50d[_0xcabf('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xcabf('0x18')](function(_0x325c0e){logger['info'](_0xcabf('0x13'),_0x52b50d);logger[_0xcabf('0x19')](_0xcabf('0x13'),_0x52b50d,JSON[_0xcabf('0xf')](_0x325c0e));_0x21934a(_0x325c0e);})['catch'](function(_0x15eaff){logger[_0xcabf('0x10')](_0xcabf('0x13'),_0x15eaff[_0xcabf('0x11')],_0x52b50d);_0x1f2b61(_0x4b4b36[_0xcabf('0x10')](0x1f4,_0x15eaff['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index c752bde..4f02e01 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 _0x5291=['countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','/:id','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','show','/voice/queue/countAttributes/:id'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x5291,0xa6));var _0x1529=function(_0x4a5455,_0x5ca77c){_0x4a5455=_0x4a5455-0x0;var _0x1b6bdd=_0x5291[_0x4a5455];return _0x1b6bdd;};'use strict';var multer=require(_0x1529('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1529('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x1529('0x2'));var interaction=require(_0x1529('0x3'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x1529('0x4')]('/',auth[_0x1529('0x5')](),controller[_0x1529('0x6')]);router['get']('/describe',auth[_0x1529('0x5')](),controller[_0x1529('0x7')]);router[_0x1529('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x1529('0x8')]);router[_0x1529('0x4')](_0x1529('0x9'),auth[_0x1529('0x5')](),controller[_0x1529('0xa')]);router[_0x1529('0x4')](_0x1529('0xb'),auth['isAuthenticated'](),controller[_0x1529('0xc')]);router[_0x1529('0xd')](_0x1529('0xe'),auth['isAuthenticated'](),controller[_0x1529('0xf')]);router[_0x1529('0xd')](_0x1529('0x10'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x1529('0x11'),auth['isAuthenticated'](),controller[_0x1529('0x12')]);router[_0x1529('0x13')](_0x1529('0x14'),auth[_0x1529('0x5')](),controller['update']);module[_0x1529('0x15')]=router; \ No newline at end of file +var _0xd0a8=['/checkContactHopper','put','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','get','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal'];(function(_0x405a1f,_0x446aa3){var _0x4fd010=function(_0xc2ed83){while(--_0xc2ed83){_0x405a1f['push'](_0x405a1f['shift']());}};_0x4fd010(++_0x446aa3);}(_0xd0a8,0xe9));var _0x8d0a=function(_0x3d7a72,_0x576fcd){_0x3d7a72=_0x3d7a72-0x0;var _0x47aa1d=_0xd0a8[_0x3d7a72];return _0x47aa1d;};'use strict';var multer=require(_0x8d0a('0x0'));var util=require('util');var path=require(_0x8d0a('0x1'));var timeout=require(_0x8d0a('0x2'));var express=require(_0x8d0a('0x3'));var router=express[_0x8d0a('0x4')]();var auth=require(_0x8d0a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d0a('0x6'));var controller=require(_0x8d0a('0x7'));router['get']('/',auth[_0x8d0a('0x8')](),controller['index']);router[_0x8d0a('0x9')](_0x8d0a('0xa'),auth[_0x8d0a('0x8')](),controller['describe']);router[_0x8d0a('0x9')](_0x8d0a('0xb'),auth[_0x8d0a('0x8')](),controller[_0x8d0a('0xc')]);router['get'](_0x8d0a('0xd'),auth[_0x8d0a('0x8')](),controller[_0x8d0a('0xe')]);router[_0x8d0a('0x9')](_0x8d0a('0xf'),auth[_0x8d0a('0x8')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x8d0a('0x10')]('/voice/queue/moveContacts/:id',auth[_0x8d0a('0x8')](),controller[_0x8d0a('0x11')]);router[_0x8d0a('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x8d0a('0x8')](),controller[_0x8d0a('0x12')]);router[_0x8d0a('0x10')](_0x8d0a('0x13'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x8d0a('0x14')](_0x8d0a('0xb'),auth[_0x8d0a('0x8')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index e64d8b0..6b31fc6 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 _0x35db=['exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x35db,0xf5));var _0xb35d=function(_0x3a6135,_0x6db00e){_0x3a6135=_0x3a6135-0x0;var _0x418f7e=_0x35db[_0x3a6135];return _0x418f7e;};'use strict';var Sequelize=require('sequelize');module[_0xb35d('0x0')]={'state':{'type':Sequelize[_0xb35d('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xb35d('0x2')]},'countbusyretry':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb35d('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb35d('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb35d('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb35d('0x3')]},'starttime':{'type':Sequelize[_0xb35d('0x2')]},'responsetime':{'type':Sequelize[_0xb35d('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xb35d('0x2')]},'endtime':{'type':Sequelize[_0xb35d('0x2')]},'ringtime':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb35d('0x3')]},'campaign':{'type':Sequelize[_0xb35d('0x3')]},'campaigntype':{'type':Sequelize[_0xb35d('0x3')]},'membername':{'type':Sequelize[_0xb35d('0x3')]},'reason':{'type':Sequelize[_0xb35d('0x3')]},'amd':{'type':Sequelize[_0xb35d('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb35d('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb35d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xb35d('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xb35d('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb35d('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb35d('0x3')]}}; \ No newline at end of file +var _0xa9ef=['sequelize','exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0xa9ef,0x150));var _0xfa9e=function(_0x34745f,_0x5f2952){_0x34745f=_0x34745f-0x0;var _0x851c1d=_0xa9ef[_0x34745f];return _0x851c1d;};'use strict';var Sequelize=require(_0xfa9e('0x0'));module[_0xfa9e('0x1')]={'state':{'type':Sequelize[_0xfa9e('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xfa9e('0x3')]},'countbusyretry':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfa9e('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xfa9e('0x4')]},'originatecalleridname':{'type':Sequelize[_0xfa9e('0x4')]},'calleridnum':{'type':Sequelize[_0xfa9e('0x4')]},'calleridname':{'type':Sequelize[_0xfa9e('0x4')]},'starttime':{'type':Sequelize[_0xfa9e('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xfa9e('0x3')]},'droptime':{'type':Sequelize[_0xfa9e('0x3')]},'endtime':{'type':Sequelize[_0xfa9e('0x3')]},'ringtime':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xfa9e('0x4')]},'campaigntype':{'type':Sequelize[_0xfa9e('0x4')]},'membername':{'type':Sequelize[_0xfa9e('0x4')]},'reason':{'type':Sequelize[_0xfa9e('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xfa9e('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xfa9e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfa9e('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfa9e('0x3')]},'recallme':{'type':Sequelize[_0xfa9e('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfa9e('0x3')]},'edited':{'type':Sequelize[_0xfa9e('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfa9e('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfa9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index e54b02c..740c657 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 _0x84e4=['reject','update','then','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','describe','uniqueid','params','html-pdf','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set'];(function(_0x4a1ce4,_0x3ad7a9){var _0x5c3a90=function(_0x529043){while(--_0x529043){_0x4a1ce4['push'](_0x4a1ce4['shift']());}};_0x5c3a90(++_0x3ad7a9);}(_0x84e4,0x1d3));var _0x484e=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x84e4[_0x1e4a8e];return _0x5408f9;};'use strict';var pdf=require(_0x484e('0x0'));var emlformat=require(_0x484e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x484e('0x2'));var BPromise=require(_0x484e('0x3'));var Mustache=require(_0x484e('0x4'));var util=require(_0x484e('0x5'));var path=require(_0x484e('0x6'));var sox=require(_0x484e('0x7'));var csv=require(_0x484e('0x8'));var ejs=require(_0x484e('0x9'));var fs=require('fs');var _=require(_0x484e('0xa'));var squel=require('squel');var crypto=require(_0x484e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x484e('0xc'));var toCsv=require(_0x484e('0x8'));var querystring=require(_0x484e('0xd'));var Papa=require(_0x484e('0xe'));var Redis=require('ioredis');var authService=require(_0x484e('0xf'));var qs=require(_0x484e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x484e('0x11'));var logger=require(_0x484e('0x12'))(_0x484e('0x13'));var utils=require(_0x484e('0x14'));var config=require(_0x484e('0x15'));var db=require(_0x484e('0x16'))['db'];function respondWithStatusCode(_0x21d4ec,_0x3821af){_0x3821af=_0x3821af||0xcc;return function(_0x30ccf5){if(_0x30ccf5){return _0x21d4ec[_0x484e('0x17')](_0x3821af);}return _0x21d4ec[_0x484e('0x18')](_0x3821af)[_0x484e('0x19')]();};}function respondWithResult(_0xc85d97,_0x47cc95){_0x47cc95=_0x47cc95||0xc8;return function(_0x2ee62f){if(_0x2ee62f){return _0xc85d97[_0x484e('0x18')](_0x47cc95)[_0x484e('0x1a')](_0x2ee62f);}};}function respondWithFilteredResult(_0x4c8e28,_0x4ec4f5){return function(_0x2a030c){if(_0x2a030c){var _0xd92952=_0x2a030c['count'],_0x4f83ce=_0x4ec4f5[_0x484e('0x1b')],_0x5e15b2=_0x4ec4f5['offset']+_0x4ec4f5[_0x484e('0x1c')],_0x3408c1;if(_0x5e15b2>=_0xd92952){_0x5e15b2=_0xd92952;_0x3408c1=0xc8;}else{_0x3408c1=0xce;}_0x4c8e28[_0x484e('0x18')](_0x3408c1);return _0x4c8e28[_0x484e('0x1d')]('Content-Range',_0x4f83ce+'-'+_0x5e15b2+'/'+_0xd92952)[_0x484e('0x1a')](_0x2a030c);}return null;};}function patchUpdates(_0x54803c){return function(_0x3a82cb){try{jsonpatch['apply'](_0x3a82cb,_0x54803c,!![]);}catch(_0x2535dd){return BPromise[_0x484e('0x1e')](_0x2535dd);}return _0x3a82cb['save']();};}function saveUpdates(_0x2b1d6a,_0xf8e766){return function(_0x165b92){if(_0x165b92){return _0x165b92[_0x484e('0x1f')](_0x2b1d6a)[_0x484e('0x20')](function(_0x4f375e){return _0x4f375e;});}return null;};}function removeEntity(_0x301153,_0xfc335d){return function(_0xed48e1){if(_0xed48e1){return _0xed48e1['destroy']()[_0x484e('0x20')](function(){_0x301153[_0x484e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1c17,_0x3c08dd){return function(_0x35b4ba){if(!_0x35b4ba){_0x4b1c17[_0x484e('0x17')](0x194);}return _0x35b4ba;};}function handleError(_0xe27043,_0x7efce0){_0x7efce0=_0x7efce0||0x1f4;return function(_0x5a3b70){logger[_0x484e('0x21')](_0x5a3b70[_0x484e('0x22')]);if(_0x5a3b70[_0x484e('0x23')]){delete _0x5a3b70['name'];}_0xe27043[_0x484e('0x18')](_0x7efce0)['send'](_0x5a3b70);};}exports[_0x484e('0x24')]=function(_0x528b72,_0x1634ff){var _0x23f70c={},_0x210748={},_0x3cd371={'count':0x0,'rows':[]};var _0x189dbb=_[_0x484e('0x25')](db[_0x484e('0x26')][_0x484e('0x27')],function(_0x26a9bc){return{'name':_0x26a9bc[_0x484e('0x28')],'type':_0x26a9bc[_0x484e('0x29')][_0x484e('0x2a')]};});_0x210748[_0x484e('0x2b')]=_['map'](_0x189dbb,_0x484e('0x23'));_0x210748[_0x484e('0x2c')]=_['keys'](_0x528b72[_0x484e('0x2c')]);_0x210748[_0x484e('0x2d')]=_[_0x484e('0x2e')](_0x210748[_0x484e('0x2b')],_0x210748[_0x484e('0x2c')]);_0x23f70c['attributes']=_['intersection'](_0x210748[_0x484e('0x2b')],qs[_0x484e('0x2f')](_0x528b72[_0x484e('0x2c')][_0x484e('0x2f')]));_0x23f70c['attributes']=_0x23f70c[_0x484e('0x30')][_0x484e('0x31')]?_0x23f70c[_0x484e('0x30')]:_0x210748[_0x484e('0x2b')];if(!_0x528b72[_0x484e('0x2c')][_0x484e('0x32')]('nolimit')){_0x23f70c[_0x484e('0x1c')]=qs[_0x484e('0x1c')](_0x528b72[_0x484e('0x2c')][_0x484e('0x1c')]);_0x23f70c[_0x484e('0x1b')]=qs[_0x484e('0x1b')](_0x528b72[_0x484e('0x2c')][_0x484e('0x1b')]);}_0x23f70c[_0x484e('0x33')]=qs['sort'](_0x528b72[_0x484e('0x2c')]['sort']);_0x23f70c['where']=qs[_0x484e('0x2d')](_[_0x484e('0x34')](_0x528b72[_0x484e('0x2c')],_0x210748['filters']),_0x189dbb);if(_0x528b72['query'][_0x484e('0x35')]){_0x23f70c['where']=_[_0x484e('0x36')](_0x23f70c[_0x484e('0x37')],{'$or':_[_0x484e('0x25')](_0x189dbb,function(_0x5dd36b){if(_0x5dd36b[_0x484e('0x29')]!==_0x484e('0x38')){var _0xf17ada={};_0xf17ada[_0x5dd36b[_0x484e('0x23')]]={'$like':'%'+_0x528b72['query']['filter']+'%'};return _0xf17ada;}})});}_0x23f70c=_[_0x484e('0x36')]({},_0x23f70c,_0x528b72[_0x484e('0x39')]);var _0x533f56={'where':_0x23f70c[_0x484e('0x37')]};return db[_0x484e('0x26')]['count'](_0x533f56)['then'](function(_0x51452a){_0x3cd371[_0x484e('0x3a')]=_0x51452a;if(_0x528b72[_0x484e('0x2c')][_0x484e('0x3b')]){_0x23f70c['include']=[{'all':!![]}];}return db[_0x484e('0x26')][_0x484e('0x3c')](_0x23f70c);})[_0x484e('0x20')](function(_0x51123f){_0x3cd371[_0x484e('0x3d')]=_0x51123f;return _0x3cd371;})[_0x484e('0x20')](respondWithFilteredResult(_0x1634ff,_0x23f70c))[_0x484e('0x3e')](handleError(_0x1634ff,null));};exports[_0x484e('0x3f')]=function(_0x38be9a,_0x5cfe15){var _0x28479a={'raw':!![],'where':{'id':_0x38be9a['params']['id']}},_0x18d0de={};_0x18d0de['model']=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x18d0de[_0x484e('0x2c')]=_['keys'](_0x38be9a['query']);_0x18d0de[_0x484e('0x2d')]=_['intersection'](_0x18d0de[_0x484e('0x2b')],_0x18d0de['query']);_0x28479a['attributes']=_['intersection'](_0x18d0de[_0x484e('0x2b')],qs[_0x484e('0x2f')](_0x38be9a[_0x484e('0x2c')][_0x484e('0x2f')]));_0x28479a[_0x484e('0x30')]=_0x28479a[_0x484e('0x30')][_0x484e('0x31')]?_0x28479a['attributes']:_0x18d0de[_0x484e('0x2b')];if(_0x38be9a['query'][_0x484e('0x3b')]){_0x28479a[_0x484e('0x40')]=[{'all':!![]}];}_0x28479a=_[_0x484e('0x36')]({},_0x28479a,_0x38be9a['options']);return db[_0x484e('0x26')][_0x484e('0x41')](_0x28479a)[_0x484e('0x20')](handleEntityNotFound(_0x5cfe15,null))['then'](respondWithResult(_0x5cfe15,null))[_0x484e('0x3e')](handleError(_0x5cfe15,null));};exports['create']=function(_0x27342d,_0x41a13){return db[_0x484e('0x26')][_0x484e('0x42')](_0x27342d[_0x484e('0x43')],{})[_0x484e('0x20')](respondWithResult(_0x41a13,0xc9))[_0x484e('0x3e')](handleError(_0x41a13,null));};exports[_0x484e('0x44')]=function(_0x5bc9e3,_0x385097){return db[_0x484e('0x26')][_0x484e('0x44')]()[_0x484e('0x20')](respondWithResult(_0x385097,null))[_0x484e('0x3e')](handleError(_0x385097,null));};exports[_0x484e('0x1f')]=function(_0x1007a8,_0x481c39){if(_0x1007a8[_0x484e('0x43')][_0x484e('0x45')]){delete _0x1007a8[_0x484e('0x43')][_0x484e('0x45')];}return db['CmHopperHistory'][_0x484e('0x41')]({'where':{'uniqueid':_0x1007a8[_0x484e('0x46')]['id']}})[_0x484e('0x20')](handleEntityNotFound(_0x481c39,null))['then'](saveUpdates(_0x1007a8[_0x484e('0x43')],null))['then'](respondWithResult(_0x481c39,null))[_0x484e('0x3e')](handleError(_0x481c39,null));}; \ No newline at end of file +var _0x7dcf=['reject','save','update','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','then','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','uniqueid','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','limit','set','Content-Range'];(function(_0x2fd97d,_0xd43497){var _0x448a04=function(_0x22631d){while(--_0x22631d){_0x2fd97d['push'](_0x2fd97d['shift']());}};_0x448a04(++_0xd43497);}(_0x7dcf,0x1dd));var _0xf7dc=function(_0x2e1906,_0xa281e9){_0x2e1906=_0x2e1906-0x0;var _0x3ea10e=_0x7dcf[_0x2e1906];return _0x3ea10e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf7dc('0x0'));var rimraf=require(_0xf7dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7dc('0x2'));var moment=require(_0xf7dc('0x3'));var BPromise=require(_0xf7dc('0x4'));var Mustache=require(_0xf7dc('0x5'));var util=require(_0xf7dc('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf7dc('0x7'));var ejs=require(_0xf7dc('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf7dc('0x9'));var crypto=require('crypto');var jsforce=require(_0xf7dc('0xa'));var deskjs=require(_0xf7dc('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf7dc('0xc'));var authService=require(_0xf7dc('0xd'));var qs=require(_0xf7dc('0xe'));var as=require(_0xf7dc('0xf'));var hardwareService=require(_0xf7dc('0x10'));var logger=require(_0xf7dc('0x11'))(_0xf7dc('0x12'));var utils=require(_0xf7dc('0x13'));var config=require('../../config/environment');var db=require(_0xf7dc('0x14'))['db'];function respondWithStatusCode(_0x7c0285,_0x275455){_0x275455=_0x275455||0xcc;return function(_0x2fb589){if(_0x2fb589){return _0x7c0285['sendStatus'](_0x275455);}return _0x7c0285[_0xf7dc('0x15')](_0x275455)['end']();};}function respondWithResult(_0x2698d7,_0x235da8){_0x235da8=_0x235da8||0xc8;return function(_0xe3b124){if(_0xe3b124){return _0x2698d7[_0xf7dc('0x15')](_0x235da8)[_0xf7dc('0x16')](_0xe3b124);}};}function respondWithFilteredResult(_0xdd3a73,_0x451604){return function(_0x569006){if(_0x569006){var _0x2e95e1=_0x569006['count'],_0x4a5bc8=_0x451604[_0xf7dc('0x17')],_0x1033d8=_0x451604[_0xf7dc('0x17')]+_0x451604[_0xf7dc('0x18')],_0xc6e193;if(_0x1033d8>=_0x2e95e1){_0x1033d8=_0x2e95e1;_0xc6e193=0xc8;}else{_0xc6e193=0xce;}_0xdd3a73['status'](_0xc6e193);return _0xdd3a73[_0xf7dc('0x19')](_0xf7dc('0x1a'),_0x4a5bc8+'-'+_0x1033d8+'/'+_0x2e95e1)[_0xf7dc('0x16')](_0x569006);}return null;};}function patchUpdates(_0x3c7591){return function(_0x2a3856){try{jsonpatch['apply'](_0x2a3856,_0x3c7591,!![]);}catch(_0x5c58fc){return BPromise[_0xf7dc('0x1b')](_0x5c58fc);}return _0x2a3856[_0xf7dc('0x1c')]();};}function saveUpdates(_0x45a5bb,_0x37339f){return function(_0x3011f3){if(_0x3011f3){return _0x3011f3[_0xf7dc('0x1d')](_0x45a5bb)['then'](function(_0x2e0114){return _0x2e0114;});}return null;};}function removeEntity(_0x50b717,_0x2d22e2){return function(_0x40a324){if(_0x40a324){return _0x40a324[_0xf7dc('0x1e')]()['then'](function(){_0x50b717[_0xf7dc('0x15')](0xcc)[_0xf7dc('0x1f')]();});}};}function handleEntityNotFound(_0x58f536,_0x1733f2){return function(_0x16e7fe){if(!_0x16e7fe){_0x58f536['sendStatus'](0x194);}return _0x16e7fe;};}function handleError(_0x37c205,_0x23d2b1){_0x23d2b1=_0x23d2b1||0x1f4;return function(_0x3c5b83){logger[_0xf7dc('0x20')](_0x3c5b83[_0xf7dc('0x21')]);if(_0x3c5b83[_0xf7dc('0x22')]){delete _0x3c5b83['name'];}_0x37c205[_0xf7dc('0x15')](_0x23d2b1)[_0xf7dc('0x23')](_0x3c5b83);};}exports[_0xf7dc('0x24')]=function(_0x58c051,_0x5cd530){var _0x3efc8e={},_0xe68533={},_0x29a047={'count':0x0,'rows':[]};var _0x20dd61=_[_0xf7dc('0x25')](db[_0xf7dc('0x26')][_0xf7dc('0x27')],function(_0x2e9869){return{'name':_0x2e9869[_0xf7dc('0x28')],'type':_0x2e9869['type'][_0xf7dc('0x29')]};});_0xe68533['model']=_[_0xf7dc('0x25')](_0x20dd61,'name');_0xe68533[_0xf7dc('0x2a')]=_[_0xf7dc('0x2b')](_0x58c051[_0xf7dc('0x2a')]);_0xe68533['filters']=_['intersection'](_0xe68533[_0xf7dc('0x2c')],_0xe68533[_0xf7dc('0x2a')]);_0x3efc8e[_0xf7dc('0x2d')]=_[_0xf7dc('0x2e')](_0xe68533[_0xf7dc('0x2c')],qs[_0xf7dc('0x2f')](_0x58c051[_0xf7dc('0x2a')][_0xf7dc('0x2f')]));_0x3efc8e[_0xf7dc('0x2d')]=_0x3efc8e['attributes']['length']?_0x3efc8e[_0xf7dc('0x2d')]:_0xe68533[_0xf7dc('0x2c')];if(!_0x58c051['query']['hasOwnProperty'](_0xf7dc('0x30'))){_0x3efc8e['limit']=qs[_0xf7dc('0x18')](_0x58c051['query'][_0xf7dc('0x18')]);_0x3efc8e[_0xf7dc('0x17')]=qs['offset'](_0x58c051[_0xf7dc('0x2a')][_0xf7dc('0x17')]);}_0x3efc8e[_0xf7dc('0x31')]=qs[_0xf7dc('0x32')](_0x58c051[_0xf7dc('0x2a')]['sort']);_0x3efc8e[_0xf7dc('0x33')]=qs['filters'](_['pick'](_0x58c051['query'],_0xe68533[_0xf7dc('0x34')]),_0x20dd61);if(_0x58c051['query'][_0xf7dc('0x35')]){_0x3efc8e['where']=_[_0xf7dc('0x36')](_0x3efc8e[_0xf7dc('0x33')],{'$or':_[_0xf7dc('0x25')](_0x20dd61,function(_0x21f595){if(_0x21f595['type']!==_0xf7dc('0x37')){var _0xab14dc={};_0xab14dc[_0x21f595[_0xf7dc('0x22')]]={'$like':'%'+_0x58c051[_0xf7dc('0x2a')][_0xf7dc('0x35')]+'%'};return _0xab14dc;}})});}_0x3efc8e=_[_0xf7dc('0x36')]({},_0x3efc8e,_0x58c051[_0xf7dc('0x38')]);var _0x571d3c={'where':_0x3efc8e['where']};return db[_0xf7dc('0x26')][_0xf7dc('0x39')](_0x571d3c)[_0xf7dc('0x3a')](function(_0x368bdb){_0x29a047[_0xf7dc('0x39')]=_0x368bdb;if(_0x58c051['query'][_0xf7dc('0x3b')]){_0x3efc8e[_0xf7dc('0x3c')]=[{'all':!![]}];}return db[_0xf7dc('0x26')][_0xf7dc('0x3d')](_0x3efc8e);})[_0xf7dc('0x3a')](function(_0x207022){_0x29a047[_0xf7dc('0x3e')]=_0x207022;return _0x29a047;})[_0xf7dc('0x3a')](respondWithFilteredResult(_0x5cd530,_0x3efc8e))['catch'](handleError(_0x5cd530,null));};exports[_0xf7dc('0x3f')]=function(_0x2ed574,_0xa7360d){var _0x2d6b4b={'raw':!![],'where':{'id':_0x2ed574[_0xf7dc('0x40')]['id']}},_0x21bfc5={};_0x21bfc5[_0xf7dc('0x2c')]=_[_0xf7dc('0x2b')](db[_0xf7dc('0x26')]['rawAttributes']);_0x21bfc5[_0xf7dc('0x2a')]=_['keys'](_0x2ed574[_0xf7dc('0x2a')]);_0x21bfc5['filters']=_[_0xf7dc('0x2e')](_0x21bfc5[_0xf7dc('0x2c')],_0x21bfc5['query']);_0x2d6b4b[_0xf7dc('0x2d')]=_[_0xf7dc('0x2e')](_0x21bfc5[_0xf7dc('0x2c')],qs[_0xf7dc('0x2f')](_0x2ed574['query'][_0xf7dc('0x2f')]));_0x2d6b4b[_0xf7dc('0x2d')]=_0x2d6b4b[_0xf7dc('0x2d')][_0xf7dc('0x41')]?_0x2d6b4b['attributes']:_0x21bfc5[_0xf7dc('0x2c')];if(_0x2ed574['query']['includeAll']){_0x2d6b4b['include']=[{'all':!![]}];}_0x2d6b4b=_[_0xf7dc('0x36')]({},_0x2d6b4b,_0x2ed574[_0xf7dc('0x38')]);return db[_0xf7dc('0x26')][_0xf7dc('0x42')](_0x2d6b4b)['then'](handleEntityNotFound(_0xa7360d,null))['then'](respondWithResult(_0xa7360d,null))[_0xf7dc('0x43')](handleError(_0xa7360d,null));};exports['create']=function(_0x56ed1a,_0x1a0451){return db['CmHopperHistory'][_0xf7dc('0x44')](_0x56ed1a[_0xf7dc('0x45')],{})[_0xf7dc('0x3a')](respondWithResult(_0x1a0451,0xc9))[_0xf7dc('0x43')](handleError(_0x1a0451,null));};exports[_0xf7dc('0x46')]=function(_0x20b2e2,_0x222ec9){return db[_0xf7dc('0x26')][_0xf7dc('0x46')]()[_0xf7dc('0x3a')](respondWithResult(_0x222ec9,null))[_0xf7dc('0x43')](handleError(_0x222ec9,null));};exports['update']=function(_0x22b7e5,_0x496ce1){if(_0x22b7e5[_0xf7dc('0x45')][_0xf7dc('0x47')]){delete _0x22b7e5[_0xf7dc('0x45')][_0xf7dc('0x47')];}return db[_0xf7dc('0x26')]['find']({'where':{'uniqueid':_0x22b7e5[_0xf7dc('0x40')]['id']}})[_0xf7dc('0x3a')](handleEntityNotFound(_0x496ce1,null))[_0xf7dc('0x3a')](saveUpdates(_0x22b7e5['body'],null))[_0xf7dc('0x3a')](respondWithResult(_0x496ce1,null))[_0xf7dc('0x43')](handleError(_0x496ce1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 825cbaa..0a62bc0 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 _0x8ee2=['exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes'];(function(_0x568781,_0x38a18b){var _0x1f1d2f=function(_0x2b180c){while(--_0x2b180c){_0x568781['push'](_0x568781['shift']());}};_0x1f1d2f(++_0x38a18b);}(_0x8ee2,0x6c));var _0x28ee=function(_0x3ccbee,_0x4c20e8){_0x3ccbee=_0x3ccbee-0x0;var _0x31883f=_0x8ee2[_0x3ccbee];return _0x31883f;};'use strict';var _=require(_0x28ee('0x0'));var util=require(_0x28ee('0x1'));var logger=require(_0x28ee('0x2'))(_0x28ee('0x3'));var moment=require(_0x28ee('0x4'));var BPromise=require(_0x28ee('0x5'));var rp=require(_0x28ee('0x6'));var fs=require('fs');var path=require(_0x28ee('0x7'));var rimraf=require(_0x28ee('0x8'));var config=require(_0x28ee('0x9'));var attributes=require(_0x28ee('0xa'));module[_0x28ee('0xb')]=function(_0x126b84,_0x4bd4a2){return _0x126b84[_0x28ee('0xc')](_0x28ee('0xd'),attributes,{'tableName':_0x28ee('0xe'),'paranoid':![],'indexes':[{'name':_0x28ee('0xf'),'fields':[_0x28ee('0xf')]},{'name':_0x28ee('0x10'),'fields':[_0x28ee('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43b5=['cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x2a1fc0,_0x5d8d63){var _0x2b805c=function(_0x3d5d40){while(--_0x3d5d40){_0x2a1fc0['push'](_0x2a1fc0['shift']());}};_0x2b805c(++_0x5d8d63);}(_0x43b5,0x17a));var _0x543b=function(_0x205c95,_0x18a8d2){_0x205c95=_0x205c95-0x0;var _0x18db6b=_0x43b5[_0x205c95];return _0x18db6b;};'use strict';var _=require(_0x543b('0x0'));var util=require(_0x543b('0x1'));var logger=require(_0x543b('0x2'))(_0x543b('0x3'));var moment=require(_0x543b('0x4'));var BPromise=require(_0x543b('0x5'));var rp=require(_0x543b('0x6'));var fs=require('fs');var path=require(_0x543b('0x7'));var rimraf=require(_0x543b('0x8'));var config=require(_0x543b('0x9'));var attributes=require(_0x543b('0xa'));module[_0x543b('0xb')]=function(_0x2c0b7b,_0x4a63b1){return _0x2c0b7b['define']('CmHopperHistory',attributes,{'tableName':_0x543b('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x543b('0xd')]},{'name':_0x543b('0xe'),'fields':[_0x543b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 9c6554c..16d047f 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 _0x4cf8=['`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateCmHopperHistory','body','options','raw','AvgHandleTime','CmHopperHistory','findAll','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout'];(function(_0x5bd445,_0x5e846d){var _0x3ac5ab=function(_0x4b25da){while(--_0x4b25da){_0x5bd445['push'](_0x5bd445['shift']());}};_0x3ac5ab(++_0x5e846d);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x308c00,_0x3cbd67){_0x308c00=_0x308c00-0x0;var _0x2b21b2=_0x4cf8[_0x308c00];return _0x2b21b2;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455345,_0x56c5cc,_0x15ba85){return new BPromise(function(_0x2c11b0,_0x51b84c){return client[_0x84cf('0xc')](_0x455345,_0x15ba85)[_0x84cf('0xd')](function(_0x489063){logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));logger[_0x84cf('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x56c5cc,_0x84cf('0x10'),JSON[_0x84cf('0x12')](_0x489063));if(_0x489063['error']){if(_0x489063['error'][_0x84cf('0x13')]===0x1f4){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x51b84c(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x2c11b0(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}else{logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));_0x2c11b0(_0x489063[_0x84cf('0x16')][_0x84cf('0x15')]);}})[_0x84cf('0x17')](function(_0x5b8ac8){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x5b8ac8);_0x51b84c(_0x5b8ac8);});});}exports[_0x84cf('0x18')]=function(_0x1abe2d){var _0x1dad1a=this;return new Promise(function(_0x13ba16,_0xe6b5b6){return db['CmHopperHistory']['create'](_0x1abe2d[_0x84cf('0x19')],{'raw':_0x1abe2d[_0x84cf('0x1a')]?_0x1abe2d[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![]})[_0x84cf('0xd')](function(_0x5dda3f){logger[_0x84cf('0xe')](_0x84cf('0x18'),_0x1abe2d);logger[_0x84cf('0x11')](_0x84cf('0x18'),_0x1abe2d,JSON[_0x84cf('0x12')](_0x5dda3f));_0x13ba16(_0x5dda3f);})['catch'](function(_0x42fa45){logger[_0x84cf('0x14')](_0x84cf('0x18'),_0x42fa45[_0x84cf('0x15')],_0x1abe2d);_0xe6b5b6(_0x1dad1a[_0x84cf('0x14')](0x1f4,_0x42fa45[_0x84cf('0x15')]));});});};exports[_0x84cf('0x1c')]=function(_0x4c9d1c){var _0x2b2c90=this;return new Promise(function(_0x26db3f,_0x1c7747){return db[_0x84cf('0x1d')][_0x84cf('0x1e')]({'raw':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c9d1c[_0x84cf('0x1a')]?_0x4c9d1c[_0x84cf('0x1a')]['where']||null:null,'attributes':[[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')][_0x84cf('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x84cf('0x1f')]['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')](_0x84cf('0x23')))),_0x84cf('0x24')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')](_0x84cf('0x25')))),_0x84cf('0x26')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x84cf('0x22')](_0x84cf('0x27')))),_0x84cf('0x28')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x29'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x84cf('0x2a')],[db[_0x84cf('0x1f')]['fn']('AVG',db[_0x84cf('0x1f')]['fn']('IF',db['sequelize'][_0x84cf('0x22')](_0x84cf('0x2b')))),_0x84cf('0x2c')]]})[_0x84cf('0xd')](function(_0x172ce9){logger['info'](_0x84cf('0x1c'),_0x4c9d1c);logger['debug']('AvgHandleTime',_0x4c9d1c,JSON[_0x84cf('0x12')](_0x172ce9));_0x26db3f(_0x172ce9);})[_0x84cf('0x17')](function(_0x4c4676){logger[_0x84cf('0x14')](_0x84cf('0x1c'),_0x4c4676[_0x84cf('0x15')],_0x4c9d1c);_0x1c7747(_0x2b2c90[_0x84cf('0x14')](0x1f4,_0x4c4676[_0x84cf('0x15')]));});});};exports[_0x84cf('0x2d')]=function(_0x56f798){var _0x2d2d4b=this;return new Promise(function(_0xb6d12d,_0x275cac){return db[_0x84cf('0x1d')][_0x84cf('0x1e')]({'raw':_0x56f798[_0x84cf('0x1a')]?_0x56f798['options'][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'where':_0x56f798['options']?_0x56f798[_0x84cf('0x1a')][_0x84cf('0x2e')]||null:null,'attributes':[[_0x84cf('0x2f'),_0x84cf('0x30')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x200,\x201,\x20null'))),_0x84cf('0x31')],[db['sequelize']['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db['sequelize'][_0x84cf('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x84cf('0x32')],[db['sequelize']['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x84cf('0x33')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')]['literal'](_0x84cf('0x34')))),'outboundBusyCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')]['literal'](_0x84cf('0x35')))),'outboundCongestionCallsDay'],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')]['literal'](_0x84cf('0x36')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x84cf('0x37')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db['sequelize'][_0x84cf('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x84cf('0x38')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x84cf('0x39')],[db[_0x84cf('0x1f')]['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')](_0x84cf('0x3a')))),_0x84cf('0x3b')],[db['sequelize']['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x84cf('0x3c')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x84cf('0x22')](_0x84cf('0x3d')))),_0x84cf('0x3b')],[db[_0x84cf('0x1f')]['fn'](_0x84cf('0x20'),db['sequelize']['fn']('IF',db[_0x84cf('0x1f')][_0x84cf('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x84cf('0x3e')]],'group':['campaign']})['then'](function(_0x147194){logger[_0x84cf('0xe')]('GetVoiceQueueHopperHistory',_0x56f798);logger['debug'](_0x84cf('0x2d'),_0x56f798,JSON[_0x84cf('0x12')](_0x147194));_0xb6d12d(_0x147194);})[_0x84cf('0x17')](function(_0x1e2676){logger[_0x84cf('0x14')](_0x84cf('0x2d'),_0x1e2676[_0x84cf('0x15')],_0x56f798);_0x275cac(_0x2d2d4b[_0x84cf('0x14')](0x1f4,_0x1e2676['message']));});});};exports[_0x84cf('0x3f')]=function(_0x11f3cc){var _0x52991f=this;return new Promise(function(_0x5a4003,_0x1537f3){return db[_0x84cf('0x1d')][_0x84cf('0x1e')]({'raw':_0x11f3cc[_0x84cf('0x1a')]?_0x11f3cc[_0x84cf('0x1a')][_0x84cf('0x1b')]===undefined?!![]:![]:!![],'where':_0x11f3cc[_0x84cf('0x1a')]?_0x11f3cc['options'][_0x84cf('0x2e')]||null:null,'attributes':[['campaign',_0x84cf('0x30')],[db['sequelize']['fn'](_0x84cf('0x20'),db[_0x84cf('0x1f')]['col']('id')),_0x84cf('0x40')],[db[_0x84cf('0x1f')]['fn']('COUNT',db[_0x84cf('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x84cf('0x2f')]})[_0x84cf('0xd')](function(_0x10a229){logger[_0x84cf('0xe')]('GetCampaignHopperHistory',_0x11f3cc);logger[_0x84cf('0x11')](_0x84cf('0x3f'),_0x11f3cc,JSON['stringify'](_0x10a229));_0x5a4003(_0x10a229);})[_0x84cf('0x17')](function(_0x293fe9){logger[_0x84cf('0x14')](_0x84cf('0x3f'),_0x293fe9[_0x84cf('0x15')],_0x11f3cc);_0x1537f3(_0x52991f[_0x84cf('0x14')](0x1f4,_0x293fe9[_0x84cf('0x15')]));});});}; \ No newline at end of file +var _0x8603=['create','options','raw','debug','stringify','AvgHandleTime','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','`state`\x20=\x204,\x201,\x20null','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory'];(function(_0xd58173,_0x458c65){var _0x5dd3fd=function(_0x698f9f){while(--_0x698f9f){_0xd58173['push'](_0xd58173['shift']());}};_0x5dd3fd(++_0x458c65);}(_0x8603,0x190));var _0x3860=function(_0x3cc870,_0x60a6f9){_0x3cc870=_0x3cc870-0x0;var _0x3b729b=_0x8603[_0x3cc870];return _0x3b729b;};'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')](_0x45b799['body'],{'raw':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![]})[_0x3860('0x9')](function(_0x20a5b0){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger[_0x3860('0x17')](_0x3860('0x12'),_0x45b799,JSON[_0x3860('0x18')](_0x20a5b0));_0x4863bd(_0x20a5b0);})[_0x3860('0x11')](function(_0x2e0b6e){logger[_0x3860('0xd')](_0x3860('0x12'),_0x2e0b6e[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15['error'](0x1f4,_0x2e0b6e[_0x3860('0xe')]));});});};exports[_0x3860('0x19')]=function(_0x2b91f2){var _0x301e03=this;return new Promise(function(_0x20bb1e,_0x56a6d1){return db[_0x3860('0x13')]['findAll']({'raw':_0x2b91f2['options']?_0x2b91f2[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x2b91f2['options']?_0x2b91f2['options']['where']||null:null,'attributes':[[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')][_0x3860('0x1c')]('id')),_0x3860('0x1d')],[db[_0x3860('0x1a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0x3860('0x1f')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x20')))),_0x3860('0x21')],[db[_0x3860('0x1a')]['fn']('COUNT',db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')]('`state`\x20=\x2011,\x201,\x20null'))),_0x3860('0x22')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x23'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x3860('0x24')],[db['sequelize']['fn'](_0x3860('0x23'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x25')))),_0x3860('0x26')]]})[_0x3860('0x9')](function(_0x4d30bc){logger[_0x3860('0xf')](_0x3860('0x19'),_0x2b91f2);logger['debug'](_0x3860('0x19'),_0x2b91f2,JSON[_0x3860('0x18')](_0x4d30bc));_0x20bb1e(_0x4d30bc);})[_0x3860('0x11')](function(_0x5af661){logger['error'](_0x3860('0x19'),_0x5af661[_0x3860('0xe')],_0x2b91f2);_0x56a6d1(_0x301e03[_0x3860('0xd')](0x1f4,_0x5af661[_0x3860('0xe')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4d6b1c){var _0x3ad0aa=this;return new Promise(function(_0x40dae8,_0xc715a0){return db[_0x3860('0x13')][_0x3860('0x27')]({'raw':_0x4d6b1c['options']?_0x4d6b1c[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x4d6b1c['options']?_0x4d6b1c['options'][_0x3860('0x28')]||null:null,'attributes':[[_0x3860('0x29'),_0x3860('0x2a')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x2b')))),_0x3860('0x2c')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')](_0x3860('0x2d')))),_0x3860('0x2e')],[db[_0x3860('0x1a')]['fn']('COUNT',db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0x3860('0x2f')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x30')))),_0x3860('0x31')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x3860('0x32')))),_0x3860('0x33')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')](_0x3860('0x34')))),_0x3860('0x35')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x36')))),_0x3860('0x37')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize'][_0x3860('0x1e')]('`state`\x20=\x2012,\x201,\x20null'))),_0x3860('0x38')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x39')))),_0x3860('0x3a')],[db['sequelize']['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x3b')))),_0x3860('0x3c')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db['sequelize'][_0x3860('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),_0x3860('0x3d')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')]['literal'](_0x3860('0x3e')))),'outboundAnswerAgiCallsDay'],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db['sequelize']['literal'](_0x3860('0x3f')))),_0x3860('0x3d')],[db['sequelize']['fn'](_0x3860('0x1b'),db['sequelize']['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x40')))),_0x3860('0x41')]],'group':[_0x3860('0x29')]})[_0x3860('0x9')](function(_0x3fad85){logger['info'](_0x3860('0x42'),_0x4d6b1c);logger[_0x3860('0x17')](_0x3860('0x42'),_0x4d6b1c,JSON[_0x3860('0x18')](_0x3fad85));_0x40dae8(_0x3fad85);})[_0x3860('0x11')](function(_0x447163){logger['error'](_0x3860('0x42'),_0x447163[_0x3860('0xe')],_0x4d6b1c);_0xc715a0(_0x3ad0aa[_0x3860('0xd')](0x1f4,_0x447163[_0x3860('0xe')]));});});};exports[_0x3860('0x43')]=function(_0x1e2b5d){var _0xe2b761=this;return new Promise(function(_0x1874f2,_0x48b603){return db[_0x3860('0x13')][_0x3860('0x27')]({'raw':_0x1e2b5d['options']?_0x1e2b5d[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x1e2b5d[_0x3860('0x15')]?_0x1e2b5d['options'][_0x3860('0x28')]||null:null,'attributes':[['campaign',_0x3860('0x2a')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')][_0x3860('0x1c')]('id')),_0x3860('0x44')],[db[_0x3860('0x1a')]['fn'](_0x3860('0x1b'),db[_0x3860('0x1a')]['fn']('IF',db[_0x3860('0x1a')][_0x3860('0x1e')](_0x3860('0x45')))),'ivrAnswerCallsDay']],'group':['campaign']})['then'](function(_0x5fbea0){logger['info']('GetCampaignHopperHistory',_0x1e2b5d);logger[_0x3860('0x17')](_0x3860('0x43'),_0x1e2b5d,JSON[_0x3860('0x18')](_0x5fbea0));_0x1874f2(_0x5fbea0);})[_0x3860('0x11')](function(_0x3d6c17){logger[_0x3860('0xd')]('GetCampaignHopperHistory',_0x3d6c17['message'],_0x1e2b5d);_0x48b603(_0xe2b761['error'](0x1f4,_0x3d6c17[_0x3860('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e940b83..0746355 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 _0x3abc=['connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','exports','multer','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3abc,0x166));var _0xc3ab=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x3abc[_0x42f009];return _0x22a1e0;};'use strict';var multer=require(_0xc3ab('0x0'));var util=require(_0xc3ab('0x1'));var path=require('path');var timeout=require(_0xc3ab('0x2'));var express=require('express');var router=express[_0xc3ab('0x3')]();var auth=require(_0xc3ab('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc3ab('0x5'));var controller=require('./cmHopperHistory.controller');router[_0xc3ab('0x6')]('/',auth['isAuthenticated'](),controller[_0xc3ab('0x7')]);router['get'](_0xc3ab('0x8'),auth[_0xc3ab('0x9')](),controller[_0xc3ab('0xa')]);router[_0xc3ab('0x6')](_0xc3ab('0xb'),auth[_0xc3ab('0x9')](),controller['show']);router[_0xc3ab('0xc')]('/',auth[_0xc3ab('0x9')](),controller[_0xc3ab('0xd')]);router['put'](_0xc3ab('0xb'),auth[_0xc3ab('0x9')](),controller['update']);module[_0xc3ab('0xe')]=router; \ No newline at end of file +var _0xf076=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','describe','show','create','/:id','update','exports','multer','path'];(function(_0x198169,_0x1e0d40){var _0x7bea12=function(_0x2ebefa){while(--_0x2ebefa){_0x198169['push'](_0x198169['shift']());}};_0x7bea12(++_0x1e0d40);}(_0xf076,0x13e));var _0x6f07=function(_0x321b0a,_0x4c0518){_0x321b0a=_0x321b0a-0x0;var _0x34a8de=_0xf076[_0x321b0a];return _0x34a8de;};'use strict';var multer=require(_0x6f07('0x0'));var util=require('util');var path=require(_0x6f07('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f07('0x2'));var router=express[_0x6f07('0x3')]();var auth=require(_0x6f07('0x4'));var interaction=require(_0x6f07('0x5'));var config=require(_0x6f07('0x6'));var controller=require(_0x6f07('0x7'));router[_0x6f07('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6f07('0x8')]('/describe',auth[_0x6f07('0x9')](),controller[_0x6f07('0xa')]);router[_0x6f07('0x8')]('/:id',auth[_0x6f07('0x9')](),controller[_0x6f07('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6f07('0xc')]);router['put'](_0x6f07('0xd'),auth[_0x6f07('0x9')](),controller[_0x6f07('0xe')]);module[_0x6f07('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 13b0a77..90b8255 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 _0x4db9=['exports','STRING','sequelize'];(function(_0x4ee917,_0x3ed58){var _0x543b9d=function(_0x52ecdb){while(--_0x52ecdb){_0x4ee917['push'](_0x4ee917['shift']());}};_0x543b9d(++_0x3ed58);}(_0x4db9,0xe3));var _0x94db=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x4db9[_0x16337a];return _0x422365;};'use strict';var Sequelize=require(_0x94db('0x0'));module[_0x94db('0x1')]={'name':{'type':Sequelize[_0x94db('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x94db('0x2')]},'dialPrefix':{'type':Sequelize[_0x94db('0x2')]}}; \ No newline at end of file +var _0x0c4e=['STRING'];(function(_0x374a72,_0x5edd7d){var _0x48cdda=function(_0x46cb6a){while(--_0x46cb6a){_0x374a72['push'](_0x374a72['shift']());}};_0x48cdda(++_0x5edd7d);}(_0x0c4e,0x69));var _0xe0c4=function(_0x234fb3,_0xf5789c){_0x234fb3=_0x234fb3-0x0;var _0xca7d69=_0x0c4e[_0x234fb3];return _0xca7d69;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe0c4('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe0c4('0x0')]},'dialPrefix':{'type':Sequelize[_0xe0c4('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index a495e46..4382bbd 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 _0x5b27=['emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./cmList.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','Lists','UserProfileResource','error','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','fields','include','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','getDispositions','findOne','Disposition','hasOwnProperty','pick','includeAll','removeDispositions','addContacts','isArray','tags','push','each','CmContact','omit','ids','success','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','writeFileSync','setHeader','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','/tmp/list_%d_%s.csv','sequelize','transaction','addCustomFields','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread'];(function(_0x531a19,_0x43e019){var _0x4845d2=function(_0x4c9b62){while(--_0x4c9b62){_0x531a19['push'](_0x531a19['shift']());}};_0x4845d2(++_0x43e019);}(_0x5b27,0x1ad));var _0x75b2=function(_0x502498,_0x2208a){_0x502498=_0x502498-0x0;var _0x2a75d8=_0x5b27[_0x502498];return _0x2a75d8;};'use strict';var pdf=require(_0x75b2('0x0'));var emlformat=require(_0x75b2('0x1'));var rimraf=require(_0x75b2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75b2('0x3'));var moment=require(_0x75b2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x75b2('0x5'));var util=require(_0x75b2('0x6'));var path=require('path');var sox=require(_0x75b2('0x7'));var csv=require(_0x75b2('0x8'));var ejs=require(_0x75b2('0x9'));var fs=require('fs');var _=require(_0x75b2('0xa'));var squel=require(_0x75b2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x75b2('0xc'));var toCsv=require(_0x75b2('0x8'));var querystring=require(_0x75b2('0xd'));var Papa=require(_0x75b2('0xe'));var Redis=require(_0x75b2('0xf'));var authService=require(_0x75b2('0x10'));var qs=require(_0x75b2('0x11'));var as=require(_0x75b2('0x12'));var hardwareService=require(_0x75b2('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x75b2('0x14'));var db=require(_0x75b2('0x15'))['db'];config['redis']=_[_0x75b2('0x16')](config['redis'],{'host':_0x75b2('0x17'),'port':0x18eb});var socket=require(_0x75b2('0x18'))(new Redis(config[_0x75b2('0x19')]));require(_0x75b2('0x1a'))['register'](socket);function respondWithStatusCode(_0x9f11ef,_0x3bd468){_0x3bd468=_0x3bd468||0xcc;return function(_0x387e69){if(_0x387e69){return _0x9f11ef[_0x75b2('0x1b')](_0x3bd468);}return _0x9f11ef[_0x75b2('0x1c')](_0x3bd468)[_0x75b2('0x1d')]();};}function respondWithResult(_0x15a234,_0x51e1b9){_0x51e1b9=_0x51e1b9||0xc8;return function(_0x172ce1){if(_0x172ce1){return _0x15a234[_0x75b2('0x1c')](_0x51e1b9)[_0x75b2('0x1e')](_0x172ce1);}};}function respondWithFilteredResult(_0x13dacf,_0x2c7ad8){return function(_0x24667f){if(_0x24667f){var _0xdfa184=_0x24667f[_0x75b2('0x1f')],_0x5c34d9=_0x2c7ad8[_0x75b2('0x20')],_0x3c756c=_0x2c7ad8[_0x75b2('0x20')]+_0x2c7ad8[_0x75b2('0x21')],_0x1435a3;if(_0x3c756c>=_0xdfa184){_0x3c756c=_0xdfa184;_0x1435a3=0xc8;}else{_0x1435a3=0xce;}_0x13dacf[_0x75b2('0x1c')](_0x1435a3);return _0x13dacf[_0x75b2('0x22')](_0x75b2('0x23'),_0x5c34d9+'-'+_0x3c756c+'/'+_0xdfa184)[_0x75b2('0x1e')](_0x24667f);}return null;};}function patchUpdates(_0x43ff74){return function(_0x1fb987){try{jsonpatch[_0x75b2('0x24')](_0x1fb987,_0x43ff74,!![]);}catch(_0x87dcde){return BPromise['reject'](_0x87dcde);}return _0x1fb987[_0x75b2('0x25')]();};}function saveUpdates(_0x22f1d7,_0x30dfcd){return function(_0x4d5ca7){if(_0x4d5ca7){return _0x4d5ca7[_0x75b2('0x26')](_0x22f1d7)[_0x75b2('0x27')](function(_0x278b0){return _0x278b0;});}return null;};}function removeEntity(_0x335ec2,_0x2b52f6){return function(_0x3f9cfa){if(_0x3f9cfa){return _0x3f9cfa[_0x75b2('0x28')]()[_0x75b2('0x27')](function(){var _0x8662a=_0x3f9cfa['get']({'plain':!![]});var _0x5dbb92=_0x75b2('0x29');return db[_0x75b2('0x2a')][_0x75b2('0x28')]({'where':{'type':_0x5dbb92,'resourceId':_0x8662a['id']}})['then'](function(){return _0x3f9cfa;});})[_0x75b2('0x27')](function(){_0x335ec2['status'](0xcc)[_0x75b2('0x1d')]();});}};}function handleEntityNotFound(_0x47bfa6,_0x3d1fbc){return function(_0x9e16c0){if(!_0x9e16c0){_0x47bfa6['sendStatus'](0x194);}return _0x9e16c0;};}function handleError(_0xa9f00b,_0x53894b){_0x53894b=_0x53894b||0x1f4;return function(_0x280102){logger[_0x75b2('0x2b')](_0x280102['stack']);if(_0x280102['name']){delete _0x280102[_0x75b2('0x2c')];}_0xa9f00b['status'](_0x53894b)[_0x75b2('0x2d')](_0x280102);};}exports[_0x75b2('0x2e')]=function(_0xfd15da,_0x16f18f){var _0x3ffc40={},_0x40a99c={},_0x2272df={'count':0x0,'rows':[]};var _0x5bf4d4=_[_0x75b2('0x2f')](db[_0x75b2('0x30')][_0x75b2('0x31')],function(_0x4923c9){return{'name':_0x4923c9[_0x75b2('0x32')],'type':_0x4923c9['type'][_0x75b2('0x33')]};});_0x40a99c[_0x75b2('0x34')]=_['map'](_0x5bf4d4,'name');_0x40a99c[_0x75b2('0x35')]=_['keys'](_0xfd15da[_0x75b2('0x35')]);_0x40a99c[_0x75b2('0x36')]=_[_0x75b2('0x37')](_0x40a99c['model'],_0x40a99c[_0x75b2('0x35')]);_0x3ffc40['attributes']=_[_0x75b2('0x37')](_0x40a99c[_0x75b2('0x34')],qs['fields'](_0xfd15da[_0x75b2('0x35')]['fields']));_0x3ffc40[_0x75b2('0x38')]=_0x3ffc40[_0x75b2('0x38')][_0x75b2('0x39')]?_0x3ffc40['attributes']:_0x40a99c[_0x75b2('0x34')];if(!_0xfd15da[_0x75b2('0x35')]['hasOwnProperty'](_0x75b2('0x3a'))){_0x3ffc40[_0x75b2('0x21')]=qs[_0x75b2('0x21')](_0xfd15da[_0x75b2('0x35')][_0x75b2('0x21')]);_0x3ffc40[_0x75b2('0x20')]=qs['offset'](_0xfd15da[_0x75b2('0x35')][_0x75b2('0x20')]);}_0x3ffc40[_0x75b2('0x3b')]=qs[_0x75b2('0x3c')](_0xfd15da[_0x75b2('0x35')][_0x75b2('0x3c')]);_0x3ffc40[_0x75b2('0x3d')]=qs[_0x75b2('0x36')](_['pick'](_0xfd15da[_0x75b2('0x35')],_0x40a99c[_0x75b2('0x36')]),_0x5bf4d4);if(_0xfd15da['query'][_0x75b2('0x3e')]){_0x3ffc40[_0x75b2('0x3d')]=_[_0x75b2('0x3f')](_0x3ffc40[_0x75b2('0x3d')],{'$or':_[_0x75b2('0x2f')](_0x5bf4d4,function(_0x3427c4){if(_0x3427c4['type']!==_0x75b2('0x40')){var _0x2083f0={};_0x2083f0[_0x3427c4['name']]={'$like':'%'+_0xfd15da['query'][_0x75b2('0x3e')]+'%'};return _0x2083f0;}})});}_0x3ffc40=_[_0x75b2('0x3f')]({},_0x3ffc40,_0xfd15da[_0x75b2('0x41')]);var _0x2f37c2={'where':_0x3ffc40[_0x75b2('0x3d')]};return db['CmList'][_0x75b2('0x1f')](_0x2f37c2)[_0x75b2('0x27')](function(_0xa300ad){_0x2272df[_0x75b2('0x1f')]=_0xa300ad;if(_0xfd15da['query']['includeAll']){_0x3ffc40['include']=[{'all':!![]}];}return db['CmList'][_0x75b2('0x42')](_0x3ffc40);})[_0x75b2('0x27')](function(_0x361dc3){_0x2272df[_0x75b2('0x43')]=_0x361dc3;return _0x2272df;})[_0x75b2('0x27')](respondWithFilteredResult(_0x16f18f,_0x3ffc40))['catch'](handleError(_0x16f18f,null));};exports[_0x75b2('0x44')]=function(_0x30739f,_0x1e56c9){var _0x15779f={'raw':![],'where':{'id':_0x30739f[_0x75b2('0x45')]['id']}},_0x1a3353={};_0x1a3353[_0x75b2('0x34')]=_[_0x75b2('0x46')](db[_0x75b2('0x30')][_0x75b2('0x31')]);_0x1a3353[_0x75b2('0x35')]=_[_0x75b2('0x46')](_0x30739f[_0x75b2('0x35')]);_0x1a3353[_0x75b2('0x36')]=_[_0x75b2('0x37')](_0x1a3353[_0x75b2('0x34')],_0x1a3353[_0x75b2('0x35')]);_0x15779f[_0x75b2('0x38')]=_[_0x75b2('0x37')](_0x1a3353[_0x75b2('0x34')],qs[_0x75b2('0x47')](_0x30739f[_0x75b2('0x35')][_0x75b2('0x47')]));_0x15779f[_0x75b2('0x38')]=_0x15779f[_0x75b2('0x38')][_0x75b2('0x39')]?_0x15779f[_0x75b2('0x38')]:_0x1a3353[_0x75b2('0x34')];if(_0x30739f[_0x75b2('0x35')]['includeAll']){_0x15779f[_0x75b2('0x48')]=[{'all':!![]}];}_0x15779f=_[_0x75b2('0x3f')]({},_0x15779f,_0x30739f[_0x75b2('0x41')]);return db[_0x75b2('0x30')][_0x75b2('0x49')](_0x15779f)[_0x75b2('0x27')](handleEntityNotFound(_0x1e56c9,null))[_0x75b2('0x27')](respondWithResult(_0x1e56c9,null))['catch'](handleError(_0x1e56c9,null));};exports[_0x75b2('0x4a')]=function(_0xdb29b1,_0x46be48){return db[_0x75b2('0x30')]['create'](_0xdb29b1[_0x75b2('0x4b')],{})[_0x75b2('0x27')](function(_0x42f7e9){var _0x2885f7=_0xdb29b1['user']['get']({'plain':!![]});if(!_0x2885f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2885f7['role']===_0x75b2('0x4c')){var _0x3bd736=_0x42f7e9[_0x75b2('0x4d')]({'plain':!![]});var _0x50520b=_0x75b2('0x29');return db[_0x75b2('0x4e')][_0x75b2('0x49')]({'where':{'name':_0x50520b,'userProfileId':_0x2885f7[_0x75b2('0x4f')]},'raw':!![]})[_0x75b2('0x27')](function(_0x26147c){if(_0x26147c&&_0x26147c[_0x75b2('0x50')]===0x0){return db[_0x75b2('0x2a')][_0x75b2('0x4a')]({'name':_0x3bd736[_0x75b2('0x2c')],'resourceId':_0x3bd736['id'],'type':_0x26147c[_0x75b2('0x2c')],'sectionId':_0x26147c['id']},{})[_0x75b2('0x27')](function(){return _0x42f7e9;});}else{return _0x42f7e9;}})[_0x75b2('0x51')](function(_0x449295){logger[_0x75b2('0x2b')](_0x75b2('0x52'),_0x449295);throw _0x449295;});}return _0x42f7e9;})[_0x75b2('0x27')](respondWithResult(_0x46be48,0xc9))['catch'](handleError(_0x46be48,null));};exports[_0x75b2('0x26')]=function(_0x1ad134,_0x5ddda3){if(_0x1ad134['body']['id']){delete _0x1ad134[_0x75b2('0x4b')]['id'];}return db[_0x75b2('0x30')][_0x75b2('0x49')]({'where':{'id':_0x1ad134[_0x75b2('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ddda3,null))[_0x75b2('0x27')](saveUpdates(_0x1ad134['body'],null))[_0x75b2('0x27')](respondWithResult(_0x5ddda3,null))['catch'](handleError(_0x5ddda3,null));};exports[_0x75b2('0x28')]=function(_0x23a7fc,_0x263a03){return db[_0x75b2('0x30')][_0x75b2('0x49')]({'where':{'id':_0x23a7fc[_0x75b2('0x45')]['id']}})['then'](handleEntityNotFound(_0x263a03,null))[_0x75b2('0x27')](removeEntity(_0x263a03,null))[_0x75b2('0x51')](handleError(_0x263a03,null));};exports['describe']=function(_0x3f86ce,_0x287a5f){return db['CmList'][_0x75b2('0x53')]()[_0x75b2('0x27')](respondWithResult(_0x287a5f,null))[_0x75b2('0x51')](handleError(_0x287a5f,null));};exports['addDisposition']=function(_0x5357c3,_0x185e19,_0x32f1c8){if(_0x5357c3[_0x75b2('0x4b')]['id']){delete _0x5357c3[_0x75b2('0x4b')]['id'];}return db[_0x75b2('0x30')][_0x75b2('0x49')]({'where':{'id':_0x5357c3['params']['id']}})[_0x75b2('0x27')](handleEntityNotFound(_0x185e19,null))[_0x75b2('0x27')](function(_0x21e27){if(_0x21e27){_0x5357c3[_0x75b2('0x4b')][_0x75b2('0x54')]=_0x21e27['id'];return db['Disposition'][_0x75b2('0x4a')](_0x5357c3[_0x75b2('0x4b')]);}})['then'](respondWithResult(_0x185e19,null))[_0x75b2('0x51')](handleError(_0x185e19,null));};exports[_0x75b2('0x55')]=function(_0x224639,_0x9c7b10,_0x7009da){var _0x350916={'raw':![],'where':{}};var _0x2c5186={};var _0x211747={'count':0x0,'rows':[]};return db[_0x75b2('0x30')][_0x75b2('0x56')]({'where':{'id':_0x224639['params']['id']}})['then'](handleEntityNotFound(_0x9c7b10,null))[_0x75b2('0x27')](function(_0x33de89){if(_0x33de89){_0x2c5186[_0x75b2('0x34')]=_[_0x75b2('0x46')](db[_0x75b2('0x57')][_0x75b2('0x31')]);_0x2c5186[_0x75b2('0x35')]=_[_0x75b2('0x46')](_0x224639[_0x75b2('0x35')]);_0x2c5186[_0x75b2('0x36')]=_[_0x75b2('0x37')](_0x2c5186['model'],_0x2c5186[_0x75b2('0x35')]);_0x350916[_0x75b2('0x38')]=_[_0x75b2('0x37')](_0x2c5186['model'],qs[_0x75b2('0x47')](_0x224639[_0x75b2('0x35')][_0x75b2('0x47')]));_0x350916[_0x75b2('0x38')]=_0x350916[_0x75b2('0x38')][_0x75b2('0x39')]?_0x350916[_0x75b2('0x38')]:_0x2c5186[_0x75b2('0x34')];if(!_0x224639[_0x75b2('0x35')][_0x75b2('0x58')]('nolimit')){_0x350916[_0x75b2('0x21')]=qs[_0x75b2('0x21')](_0x224639[_0x75b2('0x35')][_0x75b2('0x21')]);_0x350916[_0x75b2('0x20')]=qs[_0x75b2('0x20')](_0x224639[_0x75b2('0x35')][_0x75b2('0x20')]);}_0x350916[_0x75b2('0x3b')]=qs[_0x75b2('0x3c')](_0x224639[_0x75b2('0x35')][_0x75b2('0x3c')]);_0x350916[_0x75b2('0x3d')]=qs[_0x75b2('0x36')](_[_0x75b2('0x59')](_0x224639['query'],_0x2c5186[_0x75b2('0x36')]));_0x350916[_0x75b2('0x3d')]['ListId']=_0x33de89['id'];if(_0x224639[_0x75b2('0x35')][_0x75b2('0x3e')]){_0x350916[_0x75b2('0x3d')]=_['merge'](_0x350916['where'],{'$or':_['map'](_0x350916[_0x75b2('0x38')],function(_0x3ee4ec){var _0x1cb36e={};_0x1cb36e[_0x3ee4ec]={'$like':'%'+_0x224639[_0x75b2('0x35')][_0x75b2('0x3e')]+'%'};return _0x1cb36e;})});}_0x350916=_[_0x75b2('0x3f')]({},_0x350916,_0x224639[_0x75b2('0x41')]);return db[_0x75b2('0x57')]['count']({'where':_0x350916[_0x75b2('0x3d')]})[_0x75b2('0x27')](function(_0x3fd462){_0x211747[_0x75b2('0x1f')]=_0x3fd462;if(_0x224639[_0x75b2('0x35')][_0x75b2('0x5a')]){_0x350916[_0x75b2('0x48')]=[{'all':!![]}];}return db[_0x75b2('0x57')]['findAll'](_0x350916);})[_0x75b2('0x27')](function(_0x14b824){_0x211747[_0x75b2('0x43')]=_0x14b824;return _0x211747;});}})[_0x75b2('0x27')](respondWithFilteredResult(_0x9c7b10,_0x350916))[_0x75b2('0x51')](handleError(_0x9c7b10,null));};exports['removeDispositions']=function(_0x1ebb32,_0x849210,_0x57473d){return db[_0x75b2('0x30')][_0x75b2('0x49')]({'where':{'id':_0x1ebb32[_0x75b2('0x45')]['id']}})[_0x75b2('0x27')](handleEntityNotFound(_0x849210,null))[_0x75b2('0x27')](function(_0x5d7374){if(_0x5d7374){return _0x5d7374[_0x75b2('0x5b')](_0x1ebb32[_0x75b2('0x35')]['ids']);}})[_0x75b2('0x27')](respondWithStatusCode(_0x849210,null))[_0x75b2('0x51')](handleError(_0x849210,null));};exports[_0x75b2('0x5c')]=function(_0x5a8099,_0x541572,_0x3a9cf7){return db[_0x75b2('0x30')][_0x75b2('0x49')]({'where':{'id':_0x5a8099[_0x75b2('0x45')]['id']}})[_0x75b2('0x27')](handleEntityNotFound(_0x541572,null))[_0x75b2('0x27')](function(_0x333cd7){if(_0x333cd7){var _0x54db0a=[];var _0x1bf6e1={'success':[],'errors':[]};return db['CmContact'][_0x75b2('0x53')]()[_0x75b2('0x27')](function(_0x181682){if(_0x5a8099['body']['tags']&&_[_0x75b2('0x5d')](_0x5a8099[_0x75b2('0x4b')][_0x75b2('0x5e')])){if(_0x5a8099[_0x75b2('0x4b')][_0x75b2('0x5e')]['length']){_0x5a8099[_0x75b2('0x4b')]['tags']=_0x5a8099[_0x75b2('0x4b')][_0x75b2('0x5e')]['join'](';')+';';}else{_0x5a8099[_0x75b2('0x4b')][_0x75b2('0x5e')]=null;}}else{_0x5a8099['body'][_0x75b2('0x5e')]=null;}if(_0x5a8099[_0x75b2('0x4b')]&&_[_0x75b2('0x5d')](_0x5a8099[_0x75b2('0x4b')])){for(var _0x463818=0x0;_0x463818<_0x5a8099[_0x75b2('0x4b')][_0x75b2('0x39')];_0x463818+=0x1){_0x5a8099['body'][_0x463818][_0x75b2('0x54')]=_0x5a8099[_0x75b2('0x45')]['id'];_0x54db0a[_0x75b2('0x5f')](_0x5a8099['body'][_0x463818]);}return BPromise[_0x75b2('0x60')](_0x54db0a,function(_0x358555){return db[_0x75b2('0x61')][_0x75b2('0x4a')](_[_0x75b2('0x62')](_0x358555,[_0x75b2('0x63'),'id'])||{},{'fields':_['keys'](_0x181682),'raw':!![]})[_0x75b2('0x27')](function(_0x552041){_0x1bf6e1[_0x75b2('0x64')][_0x75b2('0x5f')](_0x552041['dataValues']);})[_0x75b2('0x51')](function(_0x296e26){_0x1bf6e1['errors'][_0x75b2('0x5f')]({'data':_0x358555,'error':_0x296e26['message']});});})['then'](function(_0x25d1b6){return _0x1bf6e1;})[_0x75b2('0x51')](function(_0x4ff831){return _0x4ff831;});}else{_0x541572[_0x75b2('0x1c')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x75b2('0x27')](respondWithResult(_0x541572,null))[_0x75b2('0x51')](handleError(_0x541572,null));};exports[_0x75b2('0x65')]=function(_0x1bde63,_0x3185cc,_0x4a9dfb){var _0x277ca2;return db[_0x75b2('0x30')][_0x75b2('0x49')]({'where':{'id':_0x1bde63[_0x75b2('0x45')]['id']},'include':[{'model':db[_0x75b2('0x66')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x3185cc,null))[_0x75b2('0x27')](function(_0x2b297e){if(_0x2b297e){_0x277ca2=_0x2b297e;return db['CmContact'][_0x75b2('0x31')];}})['then'](function(_0xa2e848){if(_0xa2e848){var _0xf3d7af={};var _0x142c7a={};_0x142c7a[_0x75b2('0x34')]=_[_0x75b2('0x67')](_[_0x75b2('0x46')](_0xa2e848),_[_0x75b2('0x2f')](_0x277ca2[_0x75b2('0x68')],function(_0x7b6ffa){return util[_0x75b2('0x69')](_0x75b2('0x6a'),_0x7b6ffa['id']);}));_0x142c7a[_0x75b2('0x35')]=_[_0x75b2('0x46')](_0x1bde63['query']);_0x142c7a[_0x75b2('0x36')]=_[_0x75b2('0x37')](_0x142c7a['model'],_0x142c7a[_0x75b2('0x35')]);_0xf3d7af[_0x75b2('0x38')]=_['intersection'](_0x142c7a[_0x75b2('0x34')],qs['fields'](_0x1bde63['query']['fields']));_0xf3d7af[_0x75b2('0x38')]=_0xf3d7af[_0x75b2('0x38')][_0x75b2('0x39')]?_0xf3d7af[_0x75b2('0x38')]:_0x142c7a['model'];if(!_0x1bde63[_0x75b2('0x35')][_0x75b2('0x58')](_0x75b2('0x3a'))){_0xf3d7af['limit']=qs[_0x75b2('0x21')](_0x1bde63[_0x75b2('0x35')][_0x75b2('0x21')]);_0xf3d7af[_0x75b2('0x20')]=qs[_0x75b2('0x20')](_0x1bde63[_0x75b2('0x35')][_0x75b2('0x20')]);}_0xf3d7af[_0x75b2('0x3b')]=qs[_0x75b2('0x3c')](_0x1bde63[_0x75b2('0x35')]['sort']);_0xf3d7af[_0x75b2('0x3d')]=qs[_0x75b2('0x36')](_['pick'](_0x1bde63[_0x75b2('0x35')],_0x142c7a[_0x75b2('0x36')]));_0xf3d7af[_0x75b2('0x6b')]=!![];if(_0x1bde63[_0x75b2('0x35')][_0x75b2('0x3e')]){_0xf3d7af[_0x75b2('0x3d')]=_['merge'](_0xf3d7af[_0x75b2('0x3d')],{'$or':_['map'](_0xf3d7af[_0x75b2('0x38')],function(_0x9ee053){var _0x31202c={};_0x31202c[_0x9ee053]={'$like':'%'+_0x1bde63[_0x75b2('0x35')][_0x75b2('0x3e')]+'%'};return _0x31202c;})});}_0xf3d7af=_[_0x75b2('0x3f')]({},_0xf3d7af,_0x1bde63[_0x75b2('0x41')]);return _0x277ca2[_0x75b2('0x65')](_0xf3d7af);}})['then'](respondWithResult(_0x3185cc,null))[_0x75b2('0x51')](handleError(_0x3185cc,null));};exports[_0x75b2('0x6c')]=function(_0x4304e1,_0x3cd40c,_0x3f3390){var _0x167d5e;return db[_0x75b2('0x30')][_0x75b2('0x49')]({'where':{'id':_0x4304e1[_0x75b2('0x45')]['id']},'include':[{'model':db[_0x75b2('0x66')],'as':'CustomFields'}]})[_0x75b2('0x27')](handleEntityNotFound(_0x3cd40c,null))['then'](function(_0x1fb8cf){if(_0x1fb8cf){_0x167d5e=_0x1fb8cf;return db['CmContact'][_0x75b2('0x31')];}})[_0x75b2('0x27')](function(_0x381a29){if(_0x381a29){var _0x3c169a={};var _0x31b4bf={};_0x31b4bf[_0x75b2('0x34')]=_[_0x75b2('0x67')](_['keys'](_0x381a29),_['map'](_0x167d5e['CustomFields'],function(_0x473246){return util[_0x75b2('0x69')](_0x75b2('0x6a'),_0x473246['id']);}));_0x31b4bf[_0x75b2('0x35')]=_['keys'](_0x4304e1[_0x75b2('0x35')]);_0x31b4bf[_0x75b2('0x36')]=_['intersection'](_0x31b4bf[_0x75b2('0x34')],_0x31b4bf[_0x75b2('0x35')]);_0x3c169a['attributes']=_['intersection'](_0x31b4bf[_0x75b2('0x34')],qs[_0x75b2('0x47')](_0x4304e1['query']['fields']));_0x3c169a[_0x75b2('0x38')]=_0x3c169a[_0x75b2('0x38')]['length']?_0x3c169a[_0x75b2('0x38')]:_0x31b4bf[_0x75b2('0x34')];if(!_0x4304e1[_0x75b2('0x35')][_0x75b2('0x58')](_0x75b2('0x3a'))){_0x3c169a[_0x75b2('0x21')]=qs['limit'](_0x4304e1['query'][_0x75b2('0x21')]);_0x3c169a[_0x75b2('0x20')]=qs[_0x75b2('0x20')](_0x4304e1[_0x75b2('0x35')][_0x75b2('0x20')]);}_0x3c169a[_0x75b2('0x3b')]=qs[_0x75b2('0x3c')](_0x4304e1[_0x75b2('0x35')][_0x75b2('0x3c')]);_0x3c169a[_0x75b2('0x3d')]=qs[_0x75b2('0x36')](_['pick'](_0x4304e1[_0x75b2('0x35')],_0x31b4bf[_0x75b2('0x36')]));_0x3c169a[_0x75b2('0x6b')]=!![];if(_0x4304e1[_0x75b2('0x35')][_0x75b2('0x3e')]){_0x3c169a[_0x75b2('0x3d')]=_[_0x75b2('0x3f')](_0x3c169a[_0x75b2('0x3d')],{'$or':_[_0x75b2('0x2f')](_0x3c169a[_0x75b2('0x38')],function(_0x3122e9){var _0x351b8c={};_0x351b8c[_0x3122e9]={'$like':'%'+_0x4304e1[_0x75b2('0x35')][_0x75b2('0x3e')]+'%'};return _0x351b8c;})});}_0x3c169a=_[_0x75b2('0x3f')]({},_0x3c169a,_0x4304e1[_0x75b2('0x41')]);return _0x167d5e[_0x75b2('0x65')](_0x3c169a);}})[_0x75b2('0x27')](function(_0x92b512){if(!_['isEmpty'](_0x92b512)){var _0x2db169=toCsv(_0x92b512);var _0x134597=Date['now']();fs[_0x75b2('0x6d')](util['format']('/tmp/list_%d_%s.csv',_0x167d5e['id'],_0x134597),_0x2db169);_0x3cd40c[_0x75b2('0x6e')]('Content-disposition',_0x75b2('0x6f')+util[_0x75b2('0x69')](_0x75b2('0x70'),_0x167d5e['id'],_0x134597));_0x3cd40c['setHeader']('Content-type',_0x75b2('0x71'));return _0x3cd40c[_0x75b2('0x72')](util[_0x75b2('0x69')](_0x75b2('0x73'),_0x167d5e['id'],_0x134597));}else{return _0x3cd40c[_0x75b2('0x1b')](0xcc);}})[_0x75b2('0x51')](handleError(_0x3cd40c,null));};exports['addCustomField']=function(_0x837a60,_0x3a2c73,_0x2cf757){var _0x32ea11;delete _0x837a60[_0x75b2('0x4b')]['id'];return db[_0x75b2('0x30')]['findOne']({'where':{'id':_0x837a60[_0x75b2('0x45')]['id']}})[_0x75b2('0x27')](handleEntityNotFound(_0x3a2c73,null))[_0x75b2('0x27')](function(_0x1e7a55){if(_0x1e7a55){return db[_0x75b2('0x74')][_0x75b2('0x75')](function(_0x48fd87){return db[_0x75b2('0x66')][_0x75b2('0x4a')](_0x837a60[_0x75b2('0x4b')],{'transaction':_0x48fd87})[_0x75b2('0x27')](function(_0x3c7779){_0x32ea11=_0x3c7779;return _0x1e7a55[_0x75b2('0x76')](_0x3c7779,{'transaction':_0x48fd87});})[_0x75b2('0x27')](function(){var _0x31bfef={'type':db[_0x75b2('0x77')][_0x75b2('0x78')],'transaction':_0x48fd87};switch(_0x837a60[_0x75b2('0x4b')][_0x75b2('0x79')]){case _0x75b2('0x7a'):_0x31bfef[_0x75b2('0x79')]=db['Sequelize']['TEXT'];break;case _0x75b2('0x7b'):_0x31bfef[_0x75b2('0x79')]=db[_0x75b2('0x77')][_0x75b2('0x7c')];break;case _0x75b2('0x7d'):_0x31bfef[_0x75b2('0x79')]=db[_0x75b2('0x77')][_0x75b2('0x7e')];_0x31bfef[_0x75b2('0x7f')]=![];break;default:}return db[_0x75b2('0x74')]['queryInterface'][_0x75b2('0x80')](_0x75b2('0x81'),util['format'](_0x75b2('0x82'),_0x32ea11['id']),_0x31bfef);})[_0x75b2('0x27')](function(){return _0x32ea11;});});}})[_0x75b2('0x27')](respondWithResult(_0x3a2c73,null))[_0x75b2('0x51')](handleError(_0x3a2c73,null));};exports[_0x75b2('0x83')]=function(_0xc7d549,_0x4cf16e,_0x2d63ec){var _0x331459={};var _0x550809={};var _0x285972;var _0x58f3c9;return db[_0x75b2('0x30')][_0x75b2('0x56')]({'where':{'id':_0xc7d549[_0x75b2('0x45')]['id']}})['then'](handleEntityNotFound(_0x4cf16e,null))[_0x75b2('0x27')](function(_0x1db75f){if(_0x1db75f){_0x285972=_0x1db75f;_0x550809[_0x75b2('0x34')]=_['keys'](db[_0x75b2('0x66')]['rawAttributes']);_0x550809[_0x75b2('0x35')]=_[_0x75b2('0x46')](_0xc7d549[_0x75b2('0x35')]);_0x550809[_0x75b2('0x36')]=_['intersection'](_0x550809[_0x75b2('0x34')],_0x550809['query']);_0x331459[_0x75b2('0x38')]=_['intersection'](_0x550809[_0x75b2('0x34')],qs['fields'](_0xc7d549[_0x75b2('0x35')]['fields']));_0x331459[_0x75b2('0x38')]=_0x331459['attributes']['length']?_0x331459[_0x75b2('0x38')]:_0x550809[_0x75b2('0x34')];_0x331459[_0x75b2('0x3b')]=qs[_0x75b2('0x3c')](_0xc7d549['query']['sort']);_0x331459['where']=qs[_0x75b2('0x36')](_[_0x75b2('0x59')](_0xc7d549['query'],_0x550809['filters']));_0x331459[_0x75b2('0x3d')]=_['merge'](_0x331459[_0x75b2('0x3d')],{'$or':[{'ListId':_0x1db75f['id']},{'ListId':null}]});if(_0xc7d549['query']['filter']){_0x331459[_0x75b2('0x3d')]=_['merge'](_0x331459[_0x75b2('0x3d')],{'$or':_[_0x75b2('0x2f')](_0x331459[_0x75b2('0x38')],function(_0x45122f){var _0x4e33ee={};_0x4e33ee[_0x45122f]={'$like':'%'+_0xc7d549[_0x75b2('0x35')][_0x75b2('0x3e')]+'%'};return _0x4e33ee;})});}_0x331459=_['merge']({},_0x331459,_0xc7d549['options']);return db['CmCustomField'][_0x75b2('0x84')](_0x331459);}})[_0x75b2('0x27')](respondWithResult(_0x4cf16e,null))[_0x75b2('0x51')](handleError(_0x4cf16e,null));};exports[_0x75b2('0x85')]=function(_0xbca901,_0x26270f,_0xf9a53a){return db[_0x75b2('0x30')]['find']({'where':{'id':_0xbca901['params']['id']}})[_0x75b2('0x27')](handleEntityNotFound(_0x26270f,null))[_0x75b2('0x27')](function(_0x21263e){if(_0x21263e){return _0x21263e['addAgents'](_0xbca901[_0x75b2('0x4b')][_0x75b2('0x63')],_['omit'](_0xbca901[_0x75b2('0x4b')],[_0x75b2('0x63'),'id'])||{})[_0x75b2('0x86')](function(_0x199799){for(var _0xed6db7=0x0;_0xed6db7<_0xbca901[_0x75b2('0x4b')][_0x75b2('0x63')][_0x75b2('0x39')];_0xed6db7+=0x1){socket[_0x75b2('0x87')](_0x75b2('0x88'),{'UserId':_0xbca901['body'][_0x75b2('0x63')][_0xed6db7],'CmListId':_0xbca901[_0x75b2('0x45')]['id']});}return _0x199799;});}})[_0x75b2('0x27')](respondWithResult(_0x26270f,null))[_0x75b2('0x51')](handleError(_0x26270f,null));};exports['removeAgents']=function(_0x3af114,_0x44918a,_0xfbb643){return db[_0x75b2('0x30')]['find']({'where':{'id':_0x3af114[_0x75b2('0x45')]['id']}})[_0x75b2('0x27')](handleEntityNotFound(_0x44918a,null))[_0x75b2('0x27')](function(_0x3e0410){if(_0x3e0410){return _0x3e0410[_0x75b2('0x89')](_0x3af114[_0x75b2('0x35')][_0x75b2('0x63')])['then'](function(){if(_[_0x75b2('0x5d')](_0x3af114[_0x75b2('0x35')][_0x75b2('0x63')])){for(var _0x5e87ad=0x0;_0x5e87ad<_0x3af114[_0x75b2('0x35')][_0x75b2('0x63')][_0x75b2('0x39')];_0x5e87ad+=0x1){socket[_0x75b2('0x87')](_0x75b2('0x8a'),{'UserId':Number(_0x3af114[_0x75b2('0x35')][_0x75b2('0x63')][_0x5e87ad]),'CmListId':Number(_0x3af114[_0x75b2('0x45')]['id'])});}}else{socket['emit'](_0x75b2('0x8a'),{'UserId':Number(_0x3af114[_0x75b2('0x35')][_0x75b2('0x63')]),'CmListId':Number(_0x3af114[_0x75b2('0x45')]['id'])});}});}})[_0x75b2('0x27')](respondWithStatusCode(_0x44918a,null))[_0x75b2('0x51')](handleError(_0x44918a,null));};exports['getAgents']=function(_0x29bf68,_0x1b6607,_0x159ced){var _0xe4bd61={};var _0x1555be={};var _0x5e4ff1;var _0x57bd2d;return db['CmList']['findOne']({'where':{'id':_0x29bf68[_0x75b2('0x45')]['id']}})[_0x75b2('0x27')](handleEntityNotFound(_0x1b6607,null))['then'](function(_0x412ed3){if(_0x412ed3){_0x5e4ff1=_0x412ed3;_0x1555be[_0x75b2('0x34')]=_['keys'](db[_0x75b2('0x8b')][_0x75b2('0x31')]);_0x1555be[_0x75b2('0x35')]=_[_0x75b2('0x46')](_0x29bf68[_0x75b2('0x35')]);_0x1555be[_0x75b2('0x36')]=_[_0x75b2('0x37')](_0x1555be[_0x75b2('0x34')],_0x1555be[_0x75b2('0x35')]);_0xe4bd61[_0x75b2('0x38')]=_['intersection'](_0x1555be[_0x75b2('0x34')],qs[_0x75b2('0x47')](_0x29bf68[_0x75b2('0x35')][_0x75b2('0x47')]));_0xe4bd61[_0x75b2('0x38')]=_0xe4bd61['attributes'][_0x75b2('0x39')]?_0xe4bd61[_0x75b2('0x38')]:_0x1555be['model'];_0xe4bd61['order']=qs[_0x75b2('0x3c')](_0x29bf68[_0x75b2('0x35')][_0x75b2('0x3c')]);_0xe4bd61[_0x75b2('0x3d')]=qs[_0x75b2('0x36')](_[_0x75b2('0x59')](_0x29bf68[_0x75b2('0x35')],_0x1555be[_0x75b2('0x36')]));if(_0x29bf68[_0x75b2('0x35')][_0x75b2('0x3e')]){_0xe4bd61[_0x75b2('0x3d')]=_[_0x75b2('0x3f')](_0xe4bd61[_0x75b2('0x3d')],{'$or':_[_0x75b2('0x2f')](_0xe4bd61[_0x75b2('0x38')],function(_0x18963a){var _0x4b6dcb={};_0x4b6dcb[_0x18963a]={'$like':'%'+_0x29bf68[_0x75b2('0x35')][_0x75b2('0x3e')]+'%'};return _0x4b6dcb;})});}_0xe4bd61=_['merge']({},_0xe4bd61,_0x29bf68[_0x75b2('0x41')]);return _0x5e4ff1[_0x75b2('0x8c')](_0xe4bd61);}})['then'](function(_0x1bd59f){if(_0x1bd59f){_0x57bd2d=_0x1bd59f[_0x75b2('0x39')];if(!_0x29bf68['query'][_0x75b2('0x58')](_0x75b2('0x3a'))){_0xe4bd61[_0x75b2('0x21')]=qs[_0x75b2('0x21')](_0x29bf68[_0x75b2('0x35')][_0x75b2('0x21')]);_0xe4bd61[_0x75b2('0x20')]=qs[_0x75b2('0x20')](_0x29bf68['query'][_0x75b2('0x20')]);}return _0x5e4ff1['getAgents'](_0xe4bd61);}})[_0x75b2('0x27')](function(_0x45c318){if(_0x45c318){return _0x45c318?{'count':_0x57bd2d,'rows':_0x45c318}:null;}})[_0x75b2('0x27')](respondWithResult(_0x1b6607,null))['catch'](handleError(_0x1b6607,null));}; \ No newline at end of file +var _0x6ab8=['sox','to-csv','ejs','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','CmList','fieldName','type','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','include','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','ListId','getDispositions','findOne','includeAll','rows','removeDispositions','addContacts','CmContact','describe','tags','isArray','join','push','each','omit','ids','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x6ab8,0x19b));var _0x86ab=function(_0x387b6b,_0x4e170d){_0x387b6b=_0x387b6b-0x0;var _0x5909e3=_0x6ab8[_0x387b6b];return _0x5909e3;};'use strict';var pdf=require(_0x86ab('0x0'));var emlformat=require(_0x86ab('0x1'));var rimraf=require(_0x86ab('0x2'));var zipdir=require(_0x86ab('0x3'));var jsonpatch=require(_0x86ab('0x4'));var rp=require(_0x86ab('0x5'));var moment=require(_0x86ab('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x86ab('0x7'));var util=require(_0x86ab('0x8'));var path=require('path');var sox=require(_0x86ab('0x9'));var csv=require(_0x86ab('0xa'));var ejs=require(_0x86ab('0xb'));var fs=require('fs');var _=require(_0x86ab('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86ab('0xd'));var toCsv=require(_0x86ab('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x86ab('0xe'));var authService=require(_0x86ab('0xf'));var qs=require(_0x86ab('0x10'));var as=require(_0x86ab('0x11'));var hardwareService=require(_0x86ab('0x12'));var logger=require(_0x86ab('0x13'))('api');var utils=require(_0x86ab('0x14'));var config=require('../../config/environment');var db=require(_0x86ab('0x15'))['db'];config['redis']=_[_0x86ab('0x16')](config[_0x86ab('0x17')],{'host':_0x86ab('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x86ab('0x19')](socket);function respondWithStatusCode(_0x41ec59,_0x53f853){_0x53f853=_0x53f853||0xcc;return function(_0x2e0cca){if(_0x2e0cca){return _0x41ec59[_0x86ab('0x1a')](_0x53f853);}return _0x41ec59[_0x86ab('0x1b')](_0x53f853)[_0x86ab('0x1c')]();};}function respondWithResult(_0x21a42e,_0x1dd0f0){_0x1dd0f0=_0x1dd0f0||0xc8;return function(_0x4c8775){if(_0x4c8775){return _0x21a42e[_0x86ab('0x1b')](_0x1dd0f0)[_0x86ab('0x1d')](_0x4c8775);}};}function respondWithFilteredResult(_0x256956,_0x2f9ed3){return function(_0x2cd8dd){if(_0x2cd8dd){var _0xc081d6=_0x2cd8dd['count'],_0x2df1c8=_0x2f9ed3[_0x86ab('0x1e')],_0x239481=_0x2f9ed3[_0x86ab('0x1e')]+_0x2f9ed3['limit'],_0x113ed4;if(_0x239481>=_0xc081d6){_0x239481=_0xc081d6;_0x113ed4=0xc8;}else{_0x113ed4=0xce;}_0x256956[_0x86ab('0x1b')](_0x113ed4);return _0x256956[_0x86ab('0x1f')](_0x86ab('0x20'),_0x2df1c8+'-'+_0x239481+'/'+_0xc081d6)[_0x86ab('0x1d')](_0x2cd8dd);}return null;};}function patchUpdates(_0x3e2951){return function(_0x3ae0c4){try{jsonpatch[_0x86ab('0x21')](_0x3ae0c4,_0x3e2951,!![]);}catch(_0x162858){return BPromise[_0x86ab('0x22')](_0x162858);}return _0x3ae0c4[_0x86ab('0x23')]();};}function saveUpdates(_0x497041,_0x2dae32){return function(_0xdf9ac3){if(_0xdf9ac3){return _0xdf9ac3['update'](_0x497041)[_0x86ab('0x24')](function(_0x4897c2){return _0x4897c2;});}return null;};}function removeEntity(_0x3d228a,_0x448dbb){return function(_0xc8f541){if(_0xc8f541){return _0xc8f541[_0x86ab('0x25')]()[_0x86ab('0x24')](function(){var _0x10726b=_0xc8f541['get']({'plain':!![]});var _0x588d15='Lists';return db[_0x86ab('0x26')][_0x86ab('0x25')]({'where':{'type':_0x588d15,'resourceId':_0x10726b['id']}})[_0x86ab('0x24')](function(){return _0xc8f541;});})[_0x86ab('0x24')](function(){_0x3d228a[_0x86ab('0x1b')](0xcc)[_0x86ab('0x1c')]();});}};}function handleEntityNotFound(_0x335980,_0x3821f2){return function(_0x7779d5){if(!_0x7779d5){_0x335980[_0x86ab('0x1a')](0x194);}return _0x7779d5;};}function handleError(_0x3a1cf5,_0x49704c){_0x49704c=_0x49704c||0x1f4;return function(_0x4c1111){logger[_0x86ab('0x27')](_0x4c1111[_0x86ab('0x28')]);if(_0x4c1111['name']){delete _0x4c1111[_0x86ab('0x29')];}_0x3a1cf5['status'](_0x49704c)[_0x86ab('0x2a')](_0x4c1111);};}exports[_0x86ab('0x2b')]=function(_0x3026f9,_0x1e2820){var _0x4eb5cf={},_0x1d8c20={},_0x4381ea={'count':0x0,'rows':[]};var _0xbbbe56=_[_0x86ab('0x2c')](db[_0x86ab('0x2d')]['rawAttributes'],function(_0x1e4ede){return{'name':_0x1e4ede[_0x86ab('0x2e')],'type':_0x1e4ede[_0x86ab('0x2f')]['key']};});_0x1d8c20[_0x86ab('0x30')]=_[_0x86ab('0x2c')](_0xbbbe56,_0x86ab('0x29'));_0x1d8c20['query']=_[_0x86ab('0x31')](_0x3026f9[_0x86ab('0x32')]);_0x1d8c20['filters']=_[_0x86ab('0x33')](_0x1d8c20['model'],_0x1d8c20[_0x86ab('0x32')]);_0x4eb5cf[_0x86ab('0x34')]=_[_0x86ab('0x33')](_0x1d8c20['model'],qs['fields'](_0x3026f9[_0x86ab('0x32')]['fields']));_0x4eb5cf['attributes']=_0x4eb5cf[_0x86ab('0x34')][_0x86ab('0x35')]?_0x4eb5cf['attributes']:_0x1d8c20[_0x86ab('0x30')];if(!_0x3026f9[_0x86ab('0x32')][_0x86ab('0x36')](_0x86ab('0x37'))){_0x4eb5cf[_0x86ab('0x38')]=qs[_0x86ab('0x38')](_0x3026f9[_0x86ab('0x32')][_0x86ab('0x38')]);_0x4eb5cf['offset']=qs[_0x86ab('0x1e')](_0x3026f9[_0x86ab('0x32')][_0x86ab('0x1e')]);}_0x4eb5cf[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x3026f9[_0x86ab('0x32')][_0x86ab('0x3a')]);_0x4eb5cf['where']=qs['filters'](_[_0x86ab('0x3b')](_0x3026f9[_0x86ab('0x32')],_0x1d8c20[_0x86ab('0x3c')]),_0xbbbe56);if(_0x3026f9[_0x86ab('0x32')][_0x86ab('0x3d')]){_0x4eb5cf[_0x86ab('0x3e')]=_[_0x86ab('0x3f')](_0x4eb5cf[_0x86ab('0x3e')],{'$or':_[_0x86ab('0x2c')](_0xbbbe56,function(_0x999abe){if(_0x999abe[_0x86ab('0x2f')]!==_0x86ab('0x40')){var _0x2f55b2={};_0x2f55b2[_0x999abe[_0x86ab('0x29')]]={'$like':'%'+_0x3026f9['query'][_0x86ab('0x3d')]+'%'};return _0x2f55b2;}})});}_0x4eb5cf=_[_0x86ab('0x3f')]({},_0x4eb5cf,_0x3026f9[_0x86ab('0x41')]);var _0x183a14={'where':_0x4eb5cf[_0x86ab('0x3e')]};return db[_0x86ab('0x2d')][_0x86ab('0x42')](_0x183a14)[_0x86ab('0x24')](function(_0x57efcb){_0x4381ea[_0x86ab('0x42')]=_0x57efcb;if(_0x3026f9['query']['includeAll']){_0x4eb5cf[_0x86ab('0x43')]=[{'all':!![]}];}return db[_0x86ab('0x2d')][_0x86ab('0x44')](_0x4eb5cf);})[_0x86ab('0x24')](function(_0x27ce58){_0x4381ea['rows']=_0x27ce58;return _0x4381ea;})[_0x86ab('0x24')](respondWithFilteredResult(_0x1e2820,_0x4eb5cf))[_0x86ab('0x45')](handleError(_0x1e2820,null));};exports[_0x86ab('0x46')]=function(_0x3afd5c,_0x230cce){var _0x31123d={'raw':![],'where':{'id':_0x3afd5c[_0x86ab('0x47')]['id']}},_0x454135={};_0x454135[_0x86ab('0x30')]=_[_0x86ab('0x31')](db['CmList'][_0x86ab('0x48')]);_0x454135[_0x86ab('0x32')]=_['keys'](_0x3afd5c['query']);_0x454135[_0x86ab('0x3c')]=_[_0x86ab('0x33')](_0x454135['model'],_0x454135[_0x86ab('0x32')]);_0x31123d['attributes']=_[_0x86ab('0x33')](_0x454135[_0x86ab('0x30')],qs[_0x86ab('0x49')](_0x3afd5c['query'][_0x86ab('0x49')]));_0x31123d[_0x86ab('0x34')]=_0x31123d[_0x86ab('0x34')][_0x86ab('0x35')]?_0x31123d[_0x86ab('0x34')]:_0x454135['model'];if(_0x3afd5c['query']['includeAll']){_0x31123d[_0x86ab('0x43')]=[{'all':!![]}];}_0x31123d=_[_0x86ab('0x3f')]({},_0x31123d,_0x3afd5c[_0x86ab('0x41')]);return db[_0x86ab('0x2d')][_0x86ab('0x4a')](_0x31123d)[_0x86ab('0x24')](handleEntityNotFound(_0x230cce,null))[_0x86ab('0x24')](respondWithResult(_0x230cce,null))['catch'](handleError(_0x230cce,null));};exports[_0x86ab('0x4b')]=function(_0x3379e3,_0x5c4a92){return db['CmList'][_0x86ab('0x4b')](_0x3379e3[_0x86ab('0x4c')],{})['then'](function(_0x5b2e82){var _0x295a41=_0x3379e3[_0x86ab('0x4d')][_0x86ab('0x4e')]({'plain':!![]});if(!_0x295a41)throw new Error(_0x86ab('0x4f'));if(_0x295a41[_0x86ab('0x50')]===_0x86ab('0x4d')){var _0x583133=_0x5b2e82[_0x86ab('0x4e')]({'plain':!![]});var _0x11b6d0=_0x86ab('0x51');return db[_0x86ab('0x52')][_0x86ab('0x4a')]({'where':{'name':_0x11b6d0,'userProfileId':_0x295a41['userProfileId']},'raw':!![]})['then'](function(_0x412887){if(_0x412887&&_0x412887['autoAssociation']===0x0){return db[_0x86ab('0x26')][_0x86ab('0x4b')]({'name':_0x583133[_0x86ab('0x29')],'resourceId':_0x583133['id'],'type':_0x412887[_0x86ab('0x29')],'sectionId':_0x412887['id']},{})['then'](function(){return _0x5b2e82;});}else{return _0x5b2e82;}})[_0x86ab('0x45')](function(_0x16a9ca){logger[_0x86ab('0x27')](_0x86ab('0x53'),_0x16a9ca);throw _0x16a9ca;});}return _0x5b2e82;})[_0x86ab('0x24')](respondWithResult(_0x5c4a92,0xc9))[_0x86ab('0x45')](handleError(_0x5c4a92,null));};exports[_0x86ab('0x54')]=function(_0xa933f5,_0x122d9b){if(_0xa933f5['body']['id']){delete _0xa933f5[_0x86ab('0x4c')]['id'];}return db['CmList'][_0x86ab('0x4a')]({'where':{'id':_0xa933f5['params']['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x122d9b,null))[_0x86ab('0x24')](saveUpdates(_0xa933f5[_0x86ab('0x4c')],null))['then'](respondWithResult(_0x122d9b,null))[_0x86ab('0x45')](handleError(_0x122d9b,null));};exports[_0x86ab('0x25')]=function(_0x4c40b5,_0x54cd9e){return db[_0x86ab('0x2d')]['find']({'where':{'id':_0x4c40b5[_0x86ab('0x47')]['id']}})['then'](handleEntityNotFound(_0x54cd9e,null))[_0x86ab('0x24')](removeEntity(_0x54cd9e,null))[_0x86ab('0x45')](handleError(_0x54cd9e,null));};exports['describe']=function(_0x15e1ad,_0x157505){return db[_0x86ab('0x2d')]['describe']()[_0x86ab('0x24')](respondWithResult(_0x157505,null))[_0x86ab('0x45')](handleError(_0x157505,null));};exports['addDisposition']=function(_0x54f920,_0x1002dc,_0x343320){if(_0x54f920[_0x86ab('0x4c')]['id']){delete _0x54f920['body']['id'];}return db['CmList'][_0x86ab('0x4a')]({'where':{'id':_0x54f920[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x1002dc,null))[_0x86ab('0x24')](function(_0x65950f){if(_0x65950f){_0x54f920['body'][_0x86ab('0x55')]=_0x65950f['id'];return db['Disposition'][_0x86ab('0x4b')](_0x54f920['body']);}})['then'](respondWithResult(_0x1002dc,null))[_0x86ab('0x45')](handleError(_0x1002dc,null));};exports[_0x86ab('0x56')]=function(_0x20bb33,_0x186eae,_0x154cd0){var _0x21017e={'raw':![],'where':{}};var _0x2d8c15={};var _0x3479b9={'count':0x0,'rows':[]};return db[_0x86ab('0x2d')][_0x86ab('0x57')]({'where':{'id':_0x20bb33[_0x86ab('0x47')]['id']}})['then'](handleEntityNotFound(_0x186eae,null))[_0x86ab('0x24')](function(_0x39f174){if(_0x39f174){_0x2d8c15['model']=_[_0x86ab('0x31')](db['Disposition'][_0x86ab('0x48')]);_0x2d8c15[_0x86ab('0x32')]=_[_0x86ab('0x31')](_0x20bb33[_0x86ab('0x32')]);_0x2d8c15[_0x86ab('0x3c')]=_[_0x86ab('0x33')](_0x2d8c15['model'],_0x2d8c15[_0x86ab('0x32')]);_0x21017e[_0x86ab('0x34')]=_[_0x86ab('0x33')](_0x2d8c15[_0x86ab('0x30')],qs[_0x86ab('0x49')](_0x20bb33['query'][_0x86ab('0x49')]));_0x21017e[_0x86ab('0x34')]=_0x21017e[_0x86ab('0x34')][_0x86ab('0x35')]?_0x21017e[_0x86ab('0x34')]:_0x2d8c15['model'];if(!_0x20bb33[_0x86ab('0x32')][_0x86ab('0x36')](_0x86ab('0x37'))){_0x21017e[_0x86ab('0x38')]=qs['limit'](_0x20bb33[_0x86ab('0x32')][_0x86ab('0x38')]);_0x21017e['offset']=qs[_0x86ab('0x1e')](_0x20bb33[_0x86ab('0x32')][_0x86ab('0x1e')]);}_0x21017e[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x20bb33[_0x86ab('0x32')]['sort']);_0x21017e['where']=qs[_0x86ab('0x3c')](_[_0x86ab('0x3b')](_0x20bb33['query'],_0x2d8c15[_0x86ab('0x3c')]));_0x21017e['where'][_0x86ab('0x55')]=_0x39f174['id'];if(_0x20bb33[_0x86ab('0x32')][_0x86ab('0x3d')]){_0x21017e[_0x86ab('0x3e')]=_[_0x86ab('0x3f')](_0x21017e['where'],{'$or':_['map'](_0x21017e['attributes'],function(_0x491032){var _0x5690c0={};_0x5690c0[_0x491032]={'$like':'%'+_0x20bb33['query'][_0x86ab('0x3d')]+'%'};return _0x5690c0;})});}_0x21017e=_[_0x86ab('0x3f')]({},_0x21017e,_0x20bb33[_0x86ab('0x41')]);return db['Disposition'][_0x86ab('0x42')]({'where':_0x21017e[_0x86ab('0x3e')]})[_0x86ab('0x24')](function(_0x33037f){_0x3479b9[_0x86ab('0x42')]=_0x33037f;if(_0x20bb33[_0x86ab('0x32')][_0x86ab('0x58')]){_0x21017e[_0x86ab('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x86ab('0x44')](_0x21017e);})['then'](function(_0x5760ba){_0x3479b9[_0x86ab('0x59')]=_0x5760ba;return _0x3479b9;});}})[_0x86ab('0x24')](respondWithFilteredResult(_0x186eae,_0x21017e))[_0x86ab('0x45')](handleError(_0x186eae,null));};exports[_0x86ab('0x5a')]=function(_0x515fcb,_0x147907,_0x5aa12c){return db[_0x86ab('0x2d')][_0x86ab('0x4a')]({'where':{'id':_0x515fcb[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x147907,null))['then'](function(_0x30b4f6){if(_0x30b4f6){return _0x30b4f6[_0x86ab('0x5a')](_0x515fcb[_0x86ab('0x32')]['ids']);}})[_0x86ab('0x24')](respondWithStatusCode(_0x147907,null))[_0x86ab('0x45')](handleError(_0x147907,null));};exports[_0x86ab('0x5b')]=function(_0x6277dd,_0x1dac30,_0x33269e){return db[_0x86ab('0x2d')][_0x86ab('0x4a')]({'where':{'id':_0x6277dd['params']['id']}})['then'](handleEntityNotFound(_0x1dac30,null))['then'](function(_0x2e31bf){if(_0x2e31bf){var _0x2704fa=[];var _0x58b04d={'success':[],'errors':[]};return db[_0x86ab('0x5c')][_0x86ab('0x5d')]()[_0x86ab('0x24')](function(_0x14614f){if(_0x6277dd[_0x86ab('0x4c')][_0x86ab('0x5e')]&&_[_0x86ab('0x5f')](_0x6277dd['body'][_0x86ab('0x5e')])){if(_0x6277dd[_0x86ab('0x4c')]['tags'][_0x86ab('0x35')]){_0x6277dd[_0x86ab('0x4c')][_0x86ab('0x5e')]=_0x6277dd[_0x86ab('0x4c')][_0x86ab('0x5e')][_0x86ab('0x60')](';')+';';}else{_0x6277dd[_0x86ab('0x4c')]['tags']=null;}}else{_0x6277dd[_0x86ab('0x4c')]['tags']=null;}if(_0x6277dd[_0x86ab('0x4c')]&&_['isArray'](_0x6277dd['body'])){for(var _0xeffebe=0x0;_0xeffebe<_0x6277dd['body'][_0x86ab('0x35')];_0xeffebe+=0x1){_0x6277dd[_0x86ab('0x4c')][_0xeffebe][_0x86ab('0x55')]=_0x6277dd['params']['id'];_0x2704fa[_0x86ab('0x61')](_0x6277dd[_0x86ab('0x4c')][_0xeffebe]);}return BPromise[_0x86ab('0x62')](_0x2704fa,function(_0x2c6b19){return db[_0x86ab('0x5c')][_0x86ab('0x4b')](_[_0x86ab('0x63')](_0x2c6b19,[_0x86ab('0x64'),'id'])||{},{'fields':_[_0x86ab('0x31')](_0x14614f),'raw':!![]})[_0x86ab('0x24')](function(_0xb4dda8){_0x58b04d[_0x86ab('0x65')][_0x86ab('0x61')](_0xb4dda8[_0x86ab('0x66')]);})[_0x86ab('0x45')](function(_0x2b78f8){_0x58b04d[_0x86ab('0x67')][_0x86ab('0x61')]({'data':_0x2c6b19,'error':_0x2b78f8['message']});});})[_0x86ab('0x24')](function(_0x2b2140){return _0x58b04d;})['catch'](function(_0xbab1f9){return _0xbab1f9;});}else{_0x1dac30[_0x86ab('0x1b')](0x190)['json']({'message':_0x86ab('0x68')});}});}})['then'](respondWithResult(_0x1dac30,null))[_0x86ab('0x45')](handleError(_0x1dac30,null));};exports[_0x86ab('0x69')]=function(_0x4f3eb3,_0x310134,_0x11fafb){var _0x11e251;return db[_0x86ab('0x2d')][_0x86ab('0x4a')]({'where':{'id':_0x4f3eb3['params']['id']},'include':[{'model':db[_0x86ab('0x6a')],'as':_0x86ab('0x6b')}]})[_0x86ab('0x24')](handleEntityNotFound(_0x310134,null))[_0x86ab('0x24')](function(_0x514273){if(_0x514273){_0x11e251=_0x514273;return db[_0x86ab('0x5c')][_0x86ab('0x48')];}})['then'](function(_0x56a6ba){if(_0x56a6ba){var _0x23ca9a={};var _0x11842e={};_0x11842e[_0x86ab('0x30')]=_[_0x86ab('0x6c')](_[_0x86ab('0x31')](_0x56a6ba),_[_0x86ab('0x2c')](_0x11e251['CustomFields'],function(_0x432de1){return util[_0x86ab('0x6d')](_0x86ab('0x6e'),_0x432de1['id']);}));_0x11842e[_0x86ab('0x32')]=_[_0x86ab('0x31')](_0x4f3eb3[_0x86ab('0x32')]);_0x11842e[_0x86ab('0x3c')]=_['intersection'](_0x11842e['model'],_0x11842e[_0x86ab('0x32')]);_0x23ca9a['attributes']=_[_0x86ab('0x33')](_0x11842e['model'],qs[_0x86ab('0x49')](_0x4f3eb3[_0x86ab('0x32')][_0x86ab('0x49')]));_0x23ca9a[_0x86ab('0x34')]=_0x23ca9a['attributes'][_0x86ab('0x35')]?_0x23ca9a[_0x86ab('0x34')]:_0x11842e['model'];if(!_0x4f3eb3[_0x86ab('0x32')]['hasOwnProperty']('nolimit')){_0x23ca9a[_0x86ab('0x38')]=qs[_0x86ab('0x38')](_0x4f3eb3['query'][_0x86ab('0x38')]);_0x23ca9a[_0x86ab('0x1e')]=qs[_0x86ab('0x1e')](_0x4f3eb3[_0x86ab('0x32')][_0x86ab('0x1e')]);}_0x23ca9a[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x4f3eb3[_0x86ab('0x32')][_0x86ab('0x3a')]);_0x23ca9a['where']=qs[_0x86ab('0x3c')](_[_0x86ab('0x3b')](_0x4f3eb3[_0x86ab('0x32')],_0x11842e[_0x86ab('0x3c')]));_0x23ca9a[_0x86ab('0x6f')]=!![];if(_0x4f3eb3[_0x86ab('0x32')]['filter']){_0x23ca9a[_0x86ab('0x3e')]=_[_0x86ab('0x3f')](_0x23ca9a[_0x86ab('0x3e')],{'$or':_[_0x86ab('0x2c')](_0x23ca9a[_0x86ab('0x34')],function(_0x41f53f){var _0x463a06={};_0x463a06[_0x41f53f]={'$like':'%'+_0x4f3eb3[_0x86ab('0x32')]['filter']+'%'};return _0x463a06;})});}_0x23ca9a=_[_0x86ab('0x3f')]({},_0x23ca9a,_0x4f3eb3[_0x86ab('0x41')]);return _0x11e251[_0x86ab('0x69')](_0x23ca9a);}})[_0x86ab('0x24')](respondWithResult(_0x310134,null))[_0x86ab('0x45')](handleError(_0x310134,null));};exports[_0x86ab('0x70')]=function(_0x495273,_0x11529c,_0x715afb){var _0x57f9f8;return db['CmList']['find']({'where':{'id':_0x495273[_0x86ab('0x47')]['id']},'include':[{'model':db[_0x86ab('0x6a')],'as':_0x86ab('0x6b')}]})[_0x86ab('0x24')](handleEntityNotFound(_0x11529c,null))[_0x86ab('0x24')](function(_0x585987){if(_0x585987){_0x57f9f8=_0x585987;return db[_0x86ab('0x5c')][_0x86ab('0x48')];}})[_0x86ab('0x24')](function(_0x3fc161){if(_0x3fc161){var _0x1521dc={};var _0x2a2729={};_0x2a2729[_0x86ab('0x30')]=_[_0x86ab('0x6c')](_[_0x86ab('0x31')](_0x3fc161),_[_0x86ab('0x2c')](_0x57f9f8[_0x86ab('0x6b')],function(_0x4fde3d){return util[_0x86ab('0x6d')](_0x86ab('0x6e'),_0x4fde3d['id']);}));_0x2a2729['query']=_['keys'](_0x495273[_0x86ab('0x32')]);_0x2a2729[_0x86ab('0x3c')]=_[_0x86ab('0x33')](_0x2a2729[_0x86ab('0x30')],_0x2a2729['query']);_0x1521dc[_0x86ab('0x34')]=_[_0x86ab('0x33')](_0x2a2729[_0x86ab('0x30')],qs['fields'](_0x495273['query']['fields']));_0x1521dc[_0x86ab('0x34')]=_0x1521dc[_0x86ab('0x34')]['length']?_0x1521dc[_0x86ab('0x34')]:_0x2a2729[_0x86ab('0x30')];if(!_0x495273['query']['hasOwnProperty'](_0x86ab('0x37'))){_0x1521dc['limit']=qs[_0x86ab('0x38')](_0x495273[_0x86ab('0x32')][_0x86ab('0x38')]);_0x1521dc[_0x86ab('0x1e')]=qs[_0x86ab('0x1e')](_0x495273[_0x86ab('0x32')]['offset']);}_0x1521dc[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x495273[_0x86ab('0x32')][_0x86ab('0x3a')]);_0x1521dc[_0x86ab('0x3e')]=qs[_0x86ab('0x3c')](_[_0x86ab('0x3b')](_0x495273[_0x86ab('0x32')],_0x2a2729[_0x86ab('0x3c')]));_0x1521dc['raw']=!![];if(_0x495273[_0x86ab('0x32')]['filter']){_0x1521dc['where']=_[_0x86ab('0x3f')](_0x1521dc[_0x86ab('0x3e')],{'$or':_[_0x86ab('0x2c')](_0x1521dc[_0x86ab('0x34')],function(_0x19ef0d){var _0x5bcae6={};_0x5bcae6[_0x19ef0d]={'$like':'%'+_0x495273[_0x86ab('0x32')][_0x86ab('0x3d')]+'%'};return _0x5bcae6;})});}_0x1521dc=_[_0x86ab('0x3f')]({},_0x1521dc,_0x495273[_0x86ab('0x41')]);return _0x57f9f8[_0x86ab('0x69')](_0x1521dc);}})['then'](function(_0x42e96e){if(!_[_0x86ab('0x71')](_0x42e96e)){var _0x2e4583=toCsv(_0x42e96e);var _0x30b727=Date[_0x86ab('0x72')]();fs['writeFileSync'](util[_0x86ab('0x6d')](_0x86ab('0x73'),_0x57f9f8['id'],_0x30b727),_0x2e4583);_0x11529c[_0x86ab('0x74')]('Content-disposition','attachment;\x20filename='+util['format'](_0x86ab('0x75'),_0x57f9f8['id'],_0x30b727));_0x11529c[_0x86ab('0x74')](_0x86ab('0x76'),_0x86ab('0x77'));return _0x11529c[_0x86ab('0x78')](util['format']('/tmp/list_%d_%s.csv',_0x57f9f8['id'],_0x30b727));}else{return _0x11529c[_0x86ab('0x1a')](0xcc);}})[_0x86ab('0x45')](handleError(_0x11529c,null));};exports[_0x86ab('0x79')]=function(_0xee07fb,_0x35d2c7,_0x266e99){var _0x142afd;delete _0xee07fb['body']['id'];return db[_0x86ab('0x2d')]['findOne']({'where':{'id':_0xee07fb[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x35d2c7,null))['then'](function(_0xa3df47){if(_0xa3df47){return db[_0x86ab('0x7a')]['transaction'](function(_0x199934){return db[_0x86ab('0x6a')][_0x86ab('0x4b')](_0xee07fb[_0x86ab('0x4c')],{'transaction':_0x199934})[_0x86ab('0x24')](function(_0x4cd970){_0x142afd=_0x4cd970;return _0xa3df47[_0x86ab('0x7b')](_0x4cd970,{'transaction':_0x199934});})[_0x86ab('0x24')](function(){var _0x5e1d93={'type':db[_0x86ab('0x7c')][_0x86ab('0x7d')],'transaction':_0x199934};switch(_0xee07fb[_0x86ab('0x4c')][_0x86ab('0x2f')]){case _0x86ab('0x7e'):_0x5e1d93[_0x86ab('0x2f')]=db[_0x86ab('0x7c')][_0x86ab('0x7d')];break;case _0x86ab('0x7f'):_0x5e1d93[_0x86ab('0x2f')]=db['Sequelize']['INTEGER'];break;case _0x86ab('0x80'):_0x5e1d93[_0x86ab('0x2f')]=db[_0x86ab('0x7c')][_0x86ab('0x81')];_0x5e1d93[_0x86ab('0x82')]=![];break;default:}return db[_0x86ab('0x7a')][_0x86ab('0x83')]['addColumn'](_0x86ab('0x84'),util['format']('cf_%s',_0x142afd['id']),_0x5e1d93);})[_0x86ab('0x24')](function(){return _0x142afd;});});}})['then'](respondWithResult(_0x35d2c7,null))[_0x86ab('0x45')](handleError(_0x35d2c7,null));};exports['getCustomFields']=function(_0x293b77,_0x59b664,_0x25eac7){var _0x4640e7={};var _0x2ee4e1={};var _0x4f0071;var _0x49f2f8;return db['CmList'][_0x86ab('0x57')]({'where':{'id':_0x293b77[_0x86ab('0x47')]['id']}})['then'](handleEntityNotFound(_0x59b664,null))[_0x86ab('0x24')](function(_0x31dbf0){if(_0x31dbf0){_0x4f0071=_0x31dbf0;_0x2ee4e1[_0x86ab('0x30')]=_[_0x86ab('0x31')](db[_0x86ab('0x6a')]['rawAttributes']);_0x2ee4e1['query']=_['keys'](_0x293b77[_0x86ab('0x32')]);_0x2ee4e1[_0x86ab('0x3c')]=_[_0x86ab('0x33')](_0x2ee4e1[_0x86ab('0x30')],_0x2ee4e1[_0x86ab('0x32')]);_0x4640e7['attributes']=_['intersection'](_0x2ee4e1[_0x86ab('0x30')],qs[_0x86ab('0x49')](_0x293b77[_0x86ab('0x32')][_0x86ab('0x49')]));_0x4640e7['attributes']=_0x4640e7['attributes'][_0x86ab('0x35')]?_0x4640e7[_0x86ab('0x34')]:_0x2ee4e1[_0x86ab('0x30')];_0x4640e7[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x293b77[_0x86ab('0x32')][_0x86ab('0x3a')]);_0x4640e7['where']=qs[_0x86ab('0x3c')](_[_0x86ab('0x3b')](_0x293b77[_0x86ab('0x32')],_0x2ee4e1[_0x86ab('0x3c')]));_0x4640e7['where']=_[_0x86ab('0x3f')](_0x4640e7[_0x86ab('0x3e')],{'$or':[{'ListId':_0x31dbf0['id']},{'ListId':null}]});if(_0x293b77[_0x86ab('0x32')][_0x86ab('0x3d')]){_0x4640e7[_0x86ab('0x3e')]=_[_0x86ab('0x3f')](_0x4640e7[_0x86ab('0x3e')],{'$or':_[_0x86ab('0x2c')](_0x4640e7['attributes'],function(_0x58e6b9){var _0x4570ab={};_0x4570ab[_0x58e6b9]={'$like':'%'+_0x293b77[_0x86ab('0x32')][_0x86ab('0x3d')]+'%'};return _0x4570ab;})});}_0x4640e7=_[_0x86ab('0x3f')]({},_0x4640e7,_0x293b77[_0x86ab('0x41')]);return db[_0x86ab('0x6a')]['findAndCountAll'](_0x4640e7);}})[_0x86ab('0x24')](respondWithResult(_0x59b664,null))[_0x86ab('0x45')](handleError(_0x59b664,null));};exports[_0x86ab('0x85')]=function(_0x772232,_0x58174a,_0x4b53cb){return db['CmList'][_0x86ab('0x4a')]({'where':{'id':_0x772232[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x58174a,null))['then'](function(_0x1fbf87){if(_0x1fbf87){return _0x1fbf87['addAgents'](_0x772232[_0x86ab('0x4c')][_0x86ab('0x64')],_[_0x86ab('0x63')](_0x772232['body'],[_0x86ab('0x64'),'id'])||{})['spread'](function(_0x1c7930){for(var _0xa8c4ca=0x0;_0xa8c4ca<_0x772232['body'][_0x86ab('0x64')][_0x86ab('0x35')];_0xa8c4ca+=0x1){socket[_0x86ab('0x86')](_0x86ab('0x87'),{'UserId':_0x772232[_0x86ab('0x4c')][_0x86ab('0x64')][_0xa8c4ca],'CmListId':_0x772232[_0x86ab('0x47')]['id']});}return _0x1c7930;});}})[_0x86ab('0x24')](respondWithResult(_0x58174a,null))[_0x86ab('0x45')](handleError(_0x58174a,null));};exports[_0x86ab('0x88')]=function(_0x5a508c,_0xdf0bb5,_0x356e94){return db['CmList'][_0x86ab('0x4a')]({'where':{'id':_0x5a508c[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0xdf0bb5,null))[_0x86ab('0x24')](function(_0x2f14b4){if(_0x2f14b4){return _0x2f14b4['removeAgents'](_0x5a508c['query'][_0x86ab('0x64')])[_0x86ab('0x24')](function(){if(_[_0x86ab('0x5f')](_0x5a508c[_0x86ab('0x32')][_0x86ab('0x64')])){for(var _0x25ceef=0x0;_0x25ceef<_0x5a508c[_0x86ab('0x32')]['ids'][_0x86ab('0x35')];_0x25ceef+=0x1){socket[_0x86ab('0x86')](_0x86ab('0x89'),{'UserId':Number(_0x5a508c[_0x86ab('0x32')][_0x86ab('0x64')][_0x25ceef]),'CmListId':Number(_0x5a508c['params']['id'])});}}else{socket[_0x86ab('0x86')](_0x86ab('0x89'),{'UserId':Number(_0x5a508c['query']['ids']),'CmListId':Number(_0x5a508c['params']['id'])});}});}})[_0x86ab('0x24')](respondWithStatusCode(_0xdf0bb5,null))['catch'](handleError(_0xdf0bb5,null));};exports['getAgents']=function(_0x5e514c,_0x74b551,_0x1e4886){var _0x39e965={};var _0x51cf2e={};var _0x5f1b98;var _0x24d300;return db[_0x86ab('0x2d')][_0x86ab('0x57')]({'where':{'id':_0x5e514c[_0x86ab('0x47')]['id']}})[_0x86ab('0x24')](handleEntityNotFound(_0x74b551,null))[_0x86ab('0x24')](function(_0x1339aa){if(_0x1339aa){_0x5f1b98=_0x1339aa;_0x51cf2e[_0x86ab('0x30')]=_[_0x86ab('0x31')](db[_0x86ab('0x8a')]['rawAttributes']);_0x51cf2e[_0x86ab('0x32')]=_[_0x86ab('0x31')](_0x5e514c[_0x86ab('0x32')]);_0x51cf2e[_0x86ab('0x3c')]=_['intersection'](_0x51cf2e['model'],_0x51cf2e[_0x86ab('0x32')]);_0x39e965[_0x86ab('0x34')]=_['intersection'](_0x51cf2e[_0x86ab('0x30')],qs['fields'](_0x5e514c[_0x86ab('0x32')][_0x86ab('0x49')]));_0x39e965['attributes']=_0x39e965[_0x86ab('0x34')][_0x86ab('0x35')]?_0x39e965[_0x86ab('0x34')]:_0x51cf2e[_0x86ab('0x30')];_0x39e965[_0x86ab('0x39')]=qs[_0x86ab('0x3a')](_0x5e514c[_0x86ab('0x32')][_0x86ab('0x3a')]);_0x39e965['where']=qs[_0x86ab('0x3c')](_['pick'](_0x5e514c[_0x86ab('0x32')],_0x51cf2e['filters']));if(_0x5e514c[_0x86ab('0x32')][_0x86ab('0x3d')]){_0x39e965[_0x86ab('0x3e')]=_[_0x86ab('0x3f')](_0x39e965[_0x86ab('0x3e')],{'$or':_['map'](_0x39e965[_0x86ab('0x34')],function(_0x10880f){var _0x120f89={};_0x120f89[_0x10880f]={'$like':'%'+_0x5e514c[_0x86ab('0x32')]['filter']+'%'};return _0x120f89;})});}_0x39e965=_['merge']({},_0x39e965,_0x5e514c['options']);return _0x5f1b98[_0x86ab('0x8b')](_0x39e965);}})[_0x86ab('0x24')](function(_0x10ac2b){if(_0x10ac2b){_0x24d300=_0x10ac2b[_0x86ab('0x35')];if(!_0x5e514c['query']['hasOwnProperty'](_0x86ab('0x37'))){_0x39e965[_0x86ab('0x38')]=qs[_0x86ab('0x38')](_0x5e514c['query'][_0x86ab('0x38')]);_0x39e965[_0x86ab('0x1e')]=qs[_0x86ab('0x1e')](_0x5e514c[_0x86ab('0x32')][_0x86ab('0x1e')]);}return _0x5f1b98[_0x86ab('0x8b')](_0x39e965);}})[_0x86ab('0x24')](function(_0x380c55){if(_0x380c55){return _0x380c55?{'count':_0x24d300,'rows':_0x380c55}:null;}})['then'](respondWithResult(_0x74b551,null))[_0x86ab('0x45')](handleError(_0x74b551,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 800e80c..bad3722 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 _0x6d5e=['update','remove','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x220a4b,_0x6c372b){var _0x3169d6=function(_0x1bdb0c){while(--_0x1bdb0c){_0x220a4b['push'](_0x220a4b['shift']());}};_0x3169d6(++_0x6c372b);}(_0x6d5e,0x181));var _0xe6d5=function(_0x2b06bd,_0x113bf8){_0x2b06bd=_0x2b06bd-0x0;var _0x17c946=_0x6d5e[_0x2b06bd];return _0x17c946;};'use strict';var EventEmitter=require(_0xe6d5('0x0'));var CmList=require(_0xe6d5('0x1'))['db'][_0xe6d5('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xe6d5('0x3')](0x0);var events={'afterCreate':_0xe6d5('0x4'),'afterUpdate':_0xe6d5('0x5'),'afterDestroy':_0xe6d5('0x6')};function emitEvent(_0xec0450){return function(_0x168bc4,_0x382508,_0x2e1520){CmListEvents['emit'](_0xec0450+':'+_0x168bc4['id'],_0x168bc4);CmListEvents[_0xe6d5('0x7')](_0xec0450,_0x168bc4);_0x2e1520(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xe6d5('0x8')](e,emitEvent(event));}}module[_0xe6d5('0x9')]=CmListEvents; \ No newline at end of file +var _0x5909=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x471412,_0x47a60e){var _0x7df308=function(_0x97f4e5){while(--_0x97f4e5){_0x471412['push'](_0x471412['shift']());}};_0x7df308(++_0x47a60e);}(_0x5909,0x120));var _0x9590=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x5909[_0x53abe5];return _0xc1c37e;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x9590('0x0')](0x0);var events={'afterCreate':_0x9590('0x1'),'afterUpdate':_0x9590('0x2'),'afterDestroy':_0x9590('0x3')};function emitEvent(_0x1c88d8){return function(_0x60895,_0x48f6c9,_0x279e85){CmListEvents[_0x9590('0x4')](_0x1c88d8+':'+_0x60895['id'],_0x60895);CmListEvents[_0x9590('0x4')](_0x1c88d8,_0x60895);_0x279e85(null);};}for(var e in events){if(events[_0x9590('0x5')](e)){var event=events[e];CmList[_0x9590('0x6')](e,emitEvent(event));}}module[_0x9590('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 8b442e0..7c44da3 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 _0x9115=['path','rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1fa2e3,_0x2b920c){var _0x5d1d52=function(_0x545d14){while(--_0x545d14){_0x1fa2e3['push'](_0x1fa2e3['shift']());}};_0x5d1d52(++_0x2b920c);}(_0x9115,0x13e));var _0x5911=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9115[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x5911('0x0'));var util=require(_0x5911('0x1'));var logger=require(_0x5911('0x2'))(_0x5911('0x3'));var moment=require(_0x5911('0x4'));var BPromise=require(_0x5911('0x5'));var rp=require(_0x5911('0x6'));var fs=require('fs');var path=require(_0x5911('0x7'));var rimraf=require(_0x5911('0x8'));var config=require(_0x5911('0x9'));var attributes=require(_0x5911('0xa'));module['exports']=function(_0x2e9298,_0x3eb108){return _0x2e9298['define'](_0x5911('0xb'),attributes,{'tableName':_0x5911('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf30a=['path','rimraf','./cmList.attributes','exports','CmList','cm_lists','lodash','../../config/logger','moment','bluebird'];(function(_0x466d24,_0x3a3d6c){var _0x535da6=function(_0x241c41){while(--_0x241c41){_0x466d24['push'](_0x466d24['shift']());}};_0x535da6(++_0x3a3d6c);}(_0xf30a,0x1e6));var _0xaf30=function(_0x54202e,_0x37575c){_0x54202e=_0x54202e-0x0;var _0x36a01=_0xf30a[_0x54202e];return _0x36a01;};'use strict';var _=require(_0xaf30('0x0'));var util=require('util');var logger=require(_0xaf30('0x1'))('api');var moment=require(_0xaf30('0x2'));var BPromise=require(_0xaf30('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf30('0x4'));var rimraf=require(_0xaf30('0x5'));var config=require('../../config/environment');var attributes=require(_0xaf30('0x6'));module[_0xaf30('0x7')]=function(_0x1aed6a,_0x2e8c49){return _0x1aed6a['define'](_0xaf30('0x8'),attributes,{'tableName':_0xaf30('0x9'),'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 c046b2c..118cff8 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 _0xc6ea=['lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x32deca,_0x212591){var _0x5af2a7=function(_0x1ca58b){while(--_0x1ca58b){_0x32deca['push'](_0x32deca['shift']());}};_0x5af2a7(++_0x212591);}(_0xc6ea,0xc0));var _0xac6e=function(_0x312f73,_0x4e49e7){_0x312f73=_0x312f73-0x0;var _0x43d00d=_0xc6ea[_0x312f73];return _0x43d00d;};'use strict';var _=require(_0xac6e('0x0'));var util=require(_0xac6e('0x1'));var moment=require(_0xac6e('0x2'));var BPromise=require('bluebird');var rs=require(_0xac6e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xac6e('0x4'))(_0xac6e('0x5'));var config=require(_0xac6e('0x6'));var jayson=require(_0xac6e('0x7'));var client=jayson['client'][_0xac6e('0x8')]({'port':0x232a});config[_0xac6e('0x9')]=_[_0xac6e('0xa')](config[_0xac6e('0x9')],{'host':_0xac6e('0xb'),'port':0x18eb});var socket=require(_0xac6e('0xc'))(new Redis(config[_0xac6e('0x9')]));require('./cmList.socket')[_0xac6e('0xd')](socket);function respondWithRpcPromise(_0x10bbc1,_0xb9b8d,_0x4c97e9){return new BPromise(function(_0x371011,_0x5e9099){return client[_0xac6e('0xe')](_0x10bbc1,_0x4c97e9)['then'](function(_0x24eeef){logger[_0xac6e('0xf')](_0xac6e('0x10'),_0xb9b8d,_0xac6e('0x11'));logger['debug'](_0xac6e('0x12'),_0xb9b8d,'request\x20sent',JSON[_0xac6e('0x13')](_0x24eeef));if(_0x24eeef[_0xac6e('0x14')]){if(_0x24eeef['error']['code']===0x1f4){logger[_0xac6e('0x14')]('CmList,\x20%s,\x20%s',_0xb9b8d,_0x24eeef['error'][_0xac6e('0x15')]);return _0x5e9099(_0x24eeef[_0xac6e('0x14')][_0xac6e('0x15')]);}logger[_0xac6e('0x14')]('CmList,\x20%s,\x20%s',_0xb9b8d,_0x24eeef[_0xac6e('0x14')][_0xac6e('0x15')]);return _0x371011(_0x24eeef['error']['message']);}else{logger[_0xac6e('0xf')](_0xac6e('0x10'),_0xb9b8d,'request\x20sent');_0x371011(_0x24eeef[_0xac6e('0x16')][_0xac6e('0x15')]);}})[_0xac6e('0x17')](function(_0x170026){logger['error']('CmList,\x20%s,\x20%s',_0xb9b8d,_0x170026);_0x5e9099(_0x170026);});});} \ No newline at end of file +var _0x4649=['redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x2343b2,_0x375387){var _0x4d843d=function(_0x105638){while(--_0x105638){_0x2343b2['push'](_0x2343b2['shift']());}};_0x4d843d(++_0x375387);}(_0x4649,0x199));var _0x9464=function(_0x8ba045,_0x17cc0f){_0x8ba045=_0x8ba045-0x0;var _0xd9efc3=_0x4649[_0x8ba045];return _0xd9efc3;};'use strict';var _=require(_0x9464('0x0'));var util=require('util');var moment=require(_0x9464('0x1'));var BPromise=require(_0x9464('0x2'));var rs=require(_0x9464('0x3'));var fs=require('fs');var Redis=require(_0x9464('0x4'));var db=require(_0x9464('0x5'))['db'];var utils=require(_0x9464('0x6'));var logger=require(_0x9464('0x7'))('rpc');var config=require(_0x9464('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9464('0x9')][_0x9464('0xa')]({'port':0x232a});config[_0x9464('0xb')]=_[_0x9464('0xc')](config['redis'],{'host':_0x9464('0xd'),'port':0x18eb});var socket=require(_0x9464('0xe'))(new Redis(config[_0x9464('0xb')]));require(_0x9464('0xf'))[_0x9464('0x10')](socket);function respondWithRpcPromise(_0x5d850a,_0x2480cb,_0x5a4436){return new BPromise(function(_0x1dc525,_0x13bef3){return client[_0x9464('0x11')](_0x5d850a,_0x5a4436)[_0x9464('0x12')](function(_0x7c211d){logger[_0x9464('0x13')]('CmList,\x20%s,\x20%s',_0x2480cb,_0x9464('0x14'));logger[_0x9464('0x15')](_0x9464('0x16'),_0x2480cb,_0x9464('0x14'),JSON[_0x9464('0x17')](_0x7c211d));if(_0x7c211d['error']){if(_0x7c211d[_0x9464('0x18')][_0x9464('0x19')]===0x1f4){logger[_0x9464('0x18')](_0x9464('0x1a'),_0x2480cb,_0x7c211d[_0x9464('0x18')][_0x9464('0x1b')]);return _0x13bef3(_0x7c211d['error']['message']);}logger['error'](_0x9464('0x1a'),_0x2480cb,_0x7c211d['error']['message']);return _0x1dc525(_0x7c211d['error'][_0x9464('0x1b')]);}else{logger[_0x9464('0x13')](_0x9464('0x1a'),_0x2480cb,_0x9464('0x14'));_0x1dc525(_0x7c211d[_0x9464('0x1c')][_0x9464('0x1b')]);}})[_0x9464('0x1d')](function(_0x588430){logger[_0x9464('0x18')](_0x9464('0x1a'),_0x2480cb,_0x588430);_0x13bef3(_0x588430);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index fc967f5..f630d06 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 _0x2dc3=['cmList:','save','remove','update','emit','register','length'];(function(_0x44be59,_0x1aa72f){var _0x4c9f02=function(_0x2f0462){while(--_0x2f0462){_0x44be59['push'](_0x44be59['shift']());}};_0x4c9f02(++_0x1aa72f);}(_0x2dc3,0x127));var _0x32dc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2dc3[_0x14add3];return _0x4a174f;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x32dc('0x0'),_0x32dc('0x1'),_0x32dc('0x2')];function createListener(_0x25b524,_0x2f8a4c){return function(_0x597050){_0x2f8a4c[_0x32dc('0x3')](_0x25b524,_0x597050);};}function removeListener(_0x15c3f6,_0x53b74c){return function(){CmListEvents['removeListener'](_0x15c3f6,_0x53b74c);};}exports[_0x32dc('0x4')]=function(_0x58b6ba){for(var _0x1f59d3=0x0,_0x52336b=events[_0x32dc('0x5')];_0x1f59d3<_0x52336b;_0x1f59d3++){var _0x491a56=events[_0x1f59d3];var _0x49c416=createListener(_0x32dc('0x6')+_0x491a56,_0x58b6ba);CmListEvents['on'](_0x491a56,_0x49c416);}}; \ No newline at end of file +var _0x36c3=['length','cmList:','./cmList.events','save','update','emit','register'];(function(_0x3e2733,_0x26b858){var _0x49c845=function(_0xe1fc00){while(--_0xe1fc00){_0x3e2733['push'](_0x3e2733['shift']());}};_0x49c845(++_0x26b858);}(_0x36c3,0x1a6));var _0x336c=function(_0x17d76b,_0x54345b){_0x17d76b=_0x17d76b-0x0;var _0x16f3ac=_0x36c3[_0x17d76b];return _0x16f3ac;};'use strict';var CmListEvents=require(_0x336c('0x0'));var events=[_0x336c('0x1'),'remove',_0x336c('0x2')];function createListener(_0x34b4b2,_0x3368c2){return function(_0x194993){_0x3368c2[_0x336c('0x3')](_0x34b4b2,_0x194993);};}function removeListener(_0x2b1194,_0x39ed12){return function(){CmListEvents['removeListener'](_0x2b1194,_0x39ed12);};}exports[_0x336c('0x4')]=function(_0x2e0016){for(var _0x2097a8=0x0,_0x29a202=events[_0x336c('0x5')];_0x2097a8<_0x29a202;_0x2097a8++){var _0x4d1e4f=events[_0x2097a8];var _0x108bb0=createListener(_0x336c('0x6')+_0x4d1e4f,_0x2e0016);CmListEvents['on'](_0x4d1e4f,_0x108bb0);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 7478153..498330b 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 _0xfd16=['removeDispositions','removeAgents','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getCustomFields','getAgents','post','create','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','update','destroy','delete'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0xfd16,0x113));var _0x6fd1=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xfd16[_0x46d0c9];return _0x174506;};'use strict';var multer=require(_0x6fd1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6fd1('0x1'));var router=express[_0x6fd1('0x2')]();var auth=require(_0x6fd1('0x3'));var interaction=require(_0x6fd1('0x4'));var config=require(_0x6fd1('0x5'));var controller=require(_0x6fd1('0x6'));router[_0x6fd1('0x7')]('/',auth[_0x6fd1('0x8')](),controller[_0x6fd1('0x9')]);router[_0x6fd1('0x7')](_0x6fd1('0xa'),auth[_0x6fd1('0x8')](),controller[_0x6fd1('0xb')]);router[_0x6fd1('0x7')](_0x6fd1('0xc'),auth[_0x6fd1('0x8')](),controller[_0x6fd1('0xd')]);router[_0x6fd1('0x7')](_0x6fd1('0xe'),auth[_0x6fd1('0x8')](),controller[_0x6fd1('0xf')]);router[_0x6fd1('0x7')](_0x6fd1('0x10'),auth[_0x6fd1('0x8')](),controller[_0x6fd1('0x11')]);router['get'](_0x6fd1('0x12'),auth[_0x6fd1('0x8')](),controller['getContactsCsv']);router[_0x6fd1('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6fd1('0x13')]);router[_0x6fd1('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x6fd1('0x14')]);router[_0x6fd1('0x15')]('/',auth['isAuthenticated'](),controller[_0x6fd1('0x16')]);router['post'](_0x6fd1('0xe'),auth['isAuthenticated'](),controller[_0x6fd1('0x17')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0x6fd1('0x18')]);router[_0x6fd1('0x15')](_0x6fd1('0x19'),auth[_0x6fd1('0x8')](),controller[_0x6fd1('0x1a')]);router[_0x6fd1('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x6fd1('0x1b')]);router['put'](_0x6fd1('0xc'),auth[_0x6fd1('0x8')](),controller[_0x6fd1('0x1c')]);router['delete']('/:id',auth[_0x6fd1('0x8')](),controller[_0x6fd1('0x1d')]);router[_0x6fd1('0x1e')]('/:id/dispositions',auth[_0x6fd1('0x8')](),controller[_0x6fd1('0x1f')]);router[_0x6fd1('0x1e')]('/:id/users',auth[_0x6fd1('0x8')](),controller[_0x6fd1('0x20')]);module[_0x6fd1('0x21')]=router; \ No newline at end of file +var _0x787c=['getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','create','addDisposition','post','addContacts','addCustomField','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions'];(function(_0x435eff,_0x1138e3){var _0x509d7b=function(_0x3c75ec){while(--_0x3c75ec){_0x435eff['push'](_0x435eff['shift']());}};_0x509d7b(++_0x1138e3);}(_0x787c,0xbe));var _0xc787=function(_0x4c35d1,_0x3e2464){_0x4c35d1=_0x4c35d1-0x0;var _0x2cdd4f=_0x787c[_0x4c35d1];return _0x2cdd4f;};'use strict';var multer=require(_0xc787('0x0'));var util=require(_0xc787('0x1'));var path=require('path');var timeout=require(_0xc787('0x2'));var express=require(_0xc787('0x3'));var router=express[_0xc787('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc787('0x5'));var config=require(_0xc787('0x6'));var controller=require(_0xc787('0x7'));router[_0xc787('0x8')]('/',auth[_0xc787('0x9')](),controller[_0xc787('0xa')]);router[_0xc787('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc787('0x8')](_0xc787('0xb'),auth['isAuthenticated'](),controller[_0xc787('0xc')]);router[_0xc787('0x8')](_0xc787('0xd'),auth[_0xc787('0x9')](),controller[_0xc787('0xe')]);router[_0xc787('0x8')](_0xc787('0xf'),auth[_0xc787('0x9')](),controller[_0xc787('0x10')]);router[_0xc787('0x8')](_0xc787('0x11'),auth['isAuthenticated'](),controller['getContactsCsv']);router['get'](_0xc787('0x12'),auth[_0xc787('0x9')](),controller[_0xc787('0x13')]);router['get'](_0xc787('0x14'),auth[_0xc787('0x9')](),controller[_0xc787('0x15')]);router['post']('/',auth[_0xc787('0x9')](),controller[_0xc787('0x16')]);router['post'](_0xc787('0xd'),auth[_0xc787('0x9')](),controller[_0xc787('0x17')]);router[_0xc787('0x18')](_0xc787('0xf'),auth['isAuthenticated'](),controller[_0xc787('0x19')]);router[_0xc787('0x18')]('/:id/fields',auth[_0xc787('0x9')](),controller[_0xc787('0x1a')]);router[_0xc787('0x18')](_0xc787('0x14'),auth['isAuthenticated'](),controller[_0xc787('0x1b')]);router['put'](_0xc787('0xb'),auth[_0xc787('0x9')](),controller[_0xc787('0x1c')]);router[_0xc787('0x1d')](_0xc787('0xb'),auth[_0xc787('0x9')](),controller[_0xc787('0x1e')]);router[_0xc787('0x1d')](_0xc787('0xd'),auth['isAuthenticated'](),controller[_0xc787('0x1f')]);router[_0xc787('0x1d')](_0xc787('0x14'),auth[_0xc787('0x9')](),controller[_0xc787('0x20')]);module[_0xc787('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index e027299..f4ca619 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(_0x40b6d0,_0x2d4025){var _0x12cd16=function(_0x3eeabb){while(--_0x3eeabb){_0x40b6d0['push'](_0x40b6d0['shift']());}};_0x12cd16(++_0x2d4025);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x1a46f6,_0x114c10){var _0x1043a5=function(_0x515686){while(--_0x515686){_0x1a46f6['push'](_0x1a46f6['shift']());}};_0x1043a5(++_0x114c10);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 46bd55f..82c9214 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 _0xc542=['../../config/utils','../../config/environment','sendStatus','status','end','json','offset','set','apply','reject','update','then','destroy','stack','name','send','body','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x2a6fd5,_0x3d6deb){var _0x43c6a4=function(_0x3aecb3){while(--_0x3aecb3){_0x2a6fd5['push'](_0x2a6fd5['shift']());}};_0x43c6a4(++_0x3d6deb);}(_0xc542,0xd1));var _0x2c54=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xc542[_0xefd519];return _0x4bb882;};'use strict';var pdf=require(_0x2c54('0x0'));var emlformat=require(_0x2c54('0x1'));var rimraf=require(_0x2c54('0x2'));var zipdir=require(_0x2c54('0x3'));var jsonpatch=require(_0x2c54('0x4'));var rp=require(_0x2c54('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2c54('0x6'));var path=require(_0x2c54('0x7'));var sox=require('sox');var csv=require(_0x2c54('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2c54('0x9'));var squel=require(_0x2c54('0xa'));var crypto=require(_0x2c54('0xb'));var jsforce=require(_0x2c54('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2c54('0x8'));var querystring=require(_0x2c54('0xd'));var Papa=require(_0x2c54('0xe'));var Redis=require(_0x2c54('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2c54('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c54('0x11'));var logger=require('../../config/logger')(_0x2c54('0x12'));var utils=require(_0x2c54('0x13'));var config=require(_0x2c54('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xabf2e2,_0x3a2280){_0x3a2280=_0x3a2280||0xcc;return function(_0x4463a4){if(_0x4463a4){return _0xabf2e2[_0x2c54('0x15')](_0x3a2280);}return _0xabf2e2[_0x2c54('0x16')](_0x3a2280)[_0x2c54('0x17')]();};}function respondWithResult(_0x3c0373,_0x2992c8){_0x2992c8=_0x2992c8||0xc8;return function(_0x1fa486){if(_0x1fa486){return _0x3c0373[_0x2c54('0x16')](_0x2992c8)[_0x2c54('0x18')](_0x1fa486);}};}function respondWithFilteredResult(_0x355d7c,_0x40b1bb){return function(_0x47b944){if(_0x47b944){var _0xa1b9a4=_0x47b944['count'],_0x97e79e=_0x40b1bb[_0x2c54('0x19')],_0x12f666=_0x40b1bb[_0x2c54('0x19')]+_0x40b1bb['limit'],_0x392fdf;if(_0x12f666>=_0xa1b9a4){_0x12f666=_0xa1b9a4;_0x392fdf=0xc8;}else{_0x392fdf=0xce;}_0x355d7c[_0x2c54('0x16')](_0x392fdf);return _0x355d7c[_0x2c54('0x1a')]('Content-Range',_0x97e79e+'-'+_0x12f666+'/'+_0xa1b9a4)[_0x2c54('0x18')](_0x47b944);}return null;};}function patchUpdates(_0xf831c4){return function(_0x47383c){try{jsonpatch[_0x2c54('0x1b')](_0x47383c,_0xf831c4,!![]);}catch(_0x3c3129){return BPromise[_0x2c54('0x1c')](_0x3c3129);}return _0x47383c['save']();};}function saveUpdates(_0x1deba6,_0x2e172f){return function(_0x5c034e){if(_0x5c034e){return _0x5c034e[_0x2c54('0x1d')](_0x1deba6)[_0x2c54('0x1e')](function(_0x18fadc){return _0x18fadc;});}return null;};}function removeEntity(_0x109ef1,_0x757622){return function(_0x5677da){if(_0x5677da){return _0x5677da[_0x2c54('0x1f')]()[_0x2c54('0x1e')](function(){_0x109ef1[_0x2c54('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea8f0,_0x1da46a){return function(_0x38b6e0){if(!_0x38b6e0){_0x3ea8f0['sendStatus'](0x194);}return _0x38b6e0;};}function handleError(_0x3a62c5,_0x44d7ee){_0x44d7ee=_0x44d7ee||0x1f4;return function(_0x4d651e){logger['error'](_0x4d651e[_0x2c54('0x20')]);if(_0x4d651e[_0x2c54('0x21')]){delete _0x4d651e[_0x2c54('0x21')];}_0x3a62c5[_0x2c54('0x16')](_0x44d7ee)[_0x2c54('0x22')](_0x4d651e);};}exports[_0x2c54('0x1d')]=function(_0x5a7f80,_0x27ea34){if(_0x5a7f80[_0x2c54('0x23')]['id']){delete _0x5a7f80[_0x2c54('0x23')]['id'];}return db['Condition']['find']({'where':{'id':_0x5a7f80[_0x2c54('0x24')]['id']}})[_0x2c54('0x1e')](handleEntityNotFound(_0x27ea34,null))[_0x2c54('0x1e')](saveUpdates(_0x5a7f80[_0x2c54('0x23')],null))[_0x2c54('0x1e')](respondWithResult(_0x27ea34,null))[_0x2c54('0x25')](handleError(_0x27ea34,null));};exports[_0x2c54('0x1f')]=function(_0x5b4132,_0x3fadc2){return db['Condition']['find']({'where':{'id':_0x5b4132[_0x2c54('0x24')]['id']}})[_0x2c54('0x1e')](handleEntityNotFound(_0x3fadc2,null))[_0x2c54('0x1e')](removeEntity(_0x3fadc2,null))[_0x2c54('0x25')](handleError(_0x3fadc2,null));}; \ No newline at end of file +var _0xbb80=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','params','catch','html-pdf','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbb80,0x8c));var _0x0bb8=function(_0x3a54c1,_0x1b19a7){_0x3a54c1=_0x3a54c1-0x0;var _0x532e71=_0xbb80[_0x3a54c1];return _0x532e71;};'use strict';var pdf=require(_0x0bb8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0bb8('0x1'));var zipdir=require(_0x0bb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bb8('0x3'));var moment=require(_0x0bb8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0bb8('0x5'));var path=require('path');var sox=require(_0x0bb8('0x6'));var csv=require(_0x0bb8('0x7'));var ejs=require(_0x0bb8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0bb8('0x9'));var crypto=require('crypto');var jsforce=require(_0x0bb8('0xa'));var deskjs=require(_0x0bb8('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0bb8('0xc'));var Redis=require(_0x0bb8('0xd'));var authService=require(_0x0bb8('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bb8('0xf'));var logger=require(_0x0bb8('0x10'))('api');var utils=require(_0x0bb8('0x11'));var config=require('../../config/environment');var db=require(_0x0bb8('0x12'))['db'];function respondWithStatusCode(_0x1942a2,_0x514d5c){_0x514d5c=_0x514d5c||0xcc;return function(_0x32fae8){if(_0x32fae8){return _0x1942a2[_0x0bb8('0x13')](_0x514d5c);}return _0x1942a2['status'](_0x514d5c)[_0x0bb8('0x14')]();};}function respondWithResult(_0x26f728,_0x5d3e02){_0x5d3e02=_0x5d3e02||0xc8;return function(_0xbeedab){if(_0xbeedab){return _0x26f728[_0x0bb8('0x15')](_0x5d3e02)[_0x0bb8('0x16')](_0xbeedab);}};}function respondWithFilteredResult(_0x5e2ed8,_0x52480c){return function(_0x37887d){if(_0x37887d){var _0x5b6df9=_0x37887d['count'],_0x3e01b9=_0x52480c[_0x0bb8('0x17')],_0x43c322=_0x52480c[_0x0bb8('0x17')]+_0x52480c['limit'],_0x5c4cac;if(_0x43c322>=_0x5b6df9){_0x43c322=_0x5b6df9;_0x5c4cac=0xc8;}else{_0x5c4cac=0xce;}_0x5e2ed8[_0x0bb8('0x15')](_0x5c4cac);return _0x5e2ed8[_0x0bb8('0x18')](_0x0bb8('0x19'),_0x3e01b9+'-'+_0x43c322+'/'+_0x5b6df9)[_0x0bb8('0x16')](_0x37887d);}return null;};}function patchUpdates(_0x3b3115){return function(_0x66c7ac){try{jsonpatch[_0x0bb8('0x1a')](_0x66c7ac,_0x3b3115,!![]);}catch(_0x3f1027){return BPromise[_0x0bb8('0x1b')](_0x3f1027);}return _0x66c7ac[_0x0bb8('0x1c')]();};}function saveUpdates(_0xbb5a81,_0x3ab387){return function(_0x1fc673){if(_0x1fc673){return _0x1fc673[_0x0bb8('0x1d')](_0xbb5a81)[_0x0bb8('0x1e')](function(_0xbc6065){return _0xbc6065;});}return null;};}function removeEntity(_0x3b7554,_0x5753af){return function(_0x19ce1d){if(_0x19ce1d){return _0x19ce1d[_0x0bb8('0x1f')]()['then'](function(){_0x3b7554['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x578c43,_0x270c71){return function(_0x1676cc){if(!_0x1676cc){_0x578c43['sendStatus'](0x194);}return _0x1676cc;};}function handleError(_0x3cc9d3,_0x247ebb){_0x247ebb=_0x247ebb||0x1f4;return function(_0x41a60f){logger[_0x0bb8('0x20')](_0x41a60f[_0x0bb8('0x21')]);if(_0x41a60f[_0x0bb8('0x22')]){delete _0x41a60f[_0x0bb8('0x22')];}_0x3cc9d3[_0x0bb8('0x15')](_0x247ebb)[_0x0bb8('0x23')](_0x41a60f);};}exports['update']=function(_0x58082d,_0x13311a){if(_0x58082d[_0x0bb8('0x24')]['id']){delete _0x58082d[_0x0bb8('0x24')]['id'];}return db[_0x0bb8('0x25')][_0x0bb8('0x26')]({'where':{'id':_0x58082d[_0x0bb8('0x27')]['id']}})[_0x0bb8('0x1e')](handleEntityNotFound(_0x13311a,null))[_0x0bb8('0x1e')](saveUpdates(_0x58082d[_0x0bb8('0x24')],null))[_0x0bb8('0x1e')](respondWithResult(_0x13311a,null))[_0x0bb8('0x28')](handleError(_0x13311a,null));};exports[_0x0bb8('0x1f')]=function(_0x563a1b,_0x51ba17){return db['Condition'][_0x0bb8('0x26')]({'where':{'id':_0x563a1b[_0x0bb8('0x27')]['id']}})[_0x0bb8('0x1e')](handleEntityNotFound(_0x51ba17,null))[_0x0bb8('0x1e')](removeEntity(_0x51ba17,null))[_0x0bb8('0x28')](handleError(_0x51ba17,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index d518546..0bcf526 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 _0xdd1d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./condition.attributes','exports','define','Condition','tools_conditions','lodash'];(function(_0x5a8422,_0x1aad1d){var _0x5d659c=function(_0x242811){while(--_0x242811){_0x5a8422['push'](_0x5a8422['shift']());}};_0x5d659c(++_0x1aad1d);}(_0xdd1d,0xb5));var _0xddd1=function(_0x46c30c,_0x1ac896){_0x46c30c=_0x46c30c-0x0;var _0x45c5c1=_0xdd1d[_0x46c30c];return _0x45c5c1;};'use strict';var _=require(_0xddd1('0x0'));var util=require(_0xddd1('0x1'));var logger=require(_0xddd1('0x2'))(_0xddd1('0x3'));var moment=require(_0xddd1('0x4'));var BPromise=require(_0xddd1('0x5'));var rp=require(_0xddd1('0x6'));var fs=require('fs');var path=require(_0xddd1('0x7'));var rimraf=require(_0xddd1('0x8'));var config=require('../../config/environment');var attributes=require(_0xddd1('0x9'));module[_0xddd1('0xa')]=function(_0x395558,_0x223916){return _0x395558[_0xddd1('0xb')](_0xddd1('0xc'),attributes,{'tableName':_0xddd1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44ea=['path','rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger','api','bluebird'];(function(_0x2bd1aa,_0x2077aa){var _0x4bf239=function(_0x51f621){while(--_0x51f621){_0x2bd1aa['push'](_0x2bd1aa['shift']());}};_0x4bf239(++_0x2077aa);}(_0x44ea,0x1f3));var _0xa44e=function(_0x41832e,_0x58eeab){_0x41832e=_0x41832e-0x0;var _0x12889e=_0x44ea[_0x41832e];return _0x12889e;};'use strict';var _=require(_0xa44e('0x0'));var util=require(_0xa44e('0x1'));var logger=require(_0xa44e('0x2'))(_0xa44e('0x3'));var moment=require('moment');var BPromise=require(_0xa44e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa44e('0x5'));var rimraf=require(_0xa44e('0x6'));var config=require(_0xa44e('0x7'));var attributes=require(_0xa44e('0x8'));module[_0xa44e('0x9')]=function(_0x18f8f5,_0x4423c3){return _0x18f8f5[_0xa44e('0xa')]('Condition',attributes,{'tableName':_0xa44e('0xb'),'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 c10073b..e9da5a1 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 _0x4214=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4e70cf,_0x5665d5){var _0x55c9e4=function(_0x29ed52){while(--_0x29ed52){_0x4e70cf['push'](_0x4e70cf['shift']());}};_0x55c9e4(++_0x5665d5);}(_0x4214,0x1ec));var _0x4421=function(_0x2ea99f,_0x3b2f2d){_0x2ea99f=_0x2ea99f-0x0;var _0x5b6635=_0x4214[_0x2ea99f];return _0x5b6635;};'use strict';var _=require(_0x4421('0x0'));var util=require('util');var moment=require(_0x4421('0x1'));var BPromise=require(_0x4421('0x2'));var rs=require(_0x4421('0x3'));var fs=require('fs');var Redis=require(_0x4421('0x4'));var db=require(_0x4421('0x5'))['db'];var utils=require(_0x4421('0x6'));var logger=require(_0x4421('0x7'))(_0x4421('0x8'));var config=require(_0x4421('0x9'));var jayson=require(_0x4421('0xa'));var client=jayson[_0x4421('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a09d2,_0x2eb05f,_0x1f3e4b){return new BPromise(function(_0x2a2698,_0x2f3d6b){return client[_0x4421('0xc')](_0x4a09d2,_0x1f3e4b)[_0x4421('0xd')](function(_0x158868){logger[_0x4421('0xe')](_0x4421('0xf'),_0x2eb05f,_0x4421('0x10'));logger[_0x4421('0x11')](_0x4421('0x12'),_0x2eb05f,_0x4421('0x10'),JSON[_0x4421('0x13')](_0x158868));if(_0x158868[_0x4421('0x14')]){if(_0x158868[_0x4421('0x14')]['code']===0x1f4){logger[_0x4421('0x14')](_0x4421('0xf'),_0x2eb05f,_0x158868[_0x4421('0x14')][_0x4421('0x15')]);return _0x2f3d6b(_0x158868['error'][_0x4421('0x15')]);}logger[_0x4421('0x14')](_0x4421('0xf'),_0x2eb05f,_0x158868[_0x4421('0x14')][_0x4421('0x15')]);return _0x2a2698(_0x158868[_0x4421('0x14')]['message']);}else{logger[_0x4421('0xe')](_0x4421('0xf'),_0x2eb05f,_0x4421('0x10'));_0x2a2698(_0x158868[_0x4421('0x16')][_0x4421('0x15')]);}})[_0x4421('0x17')](function(_0xeceaaf){logger['error'](_0x4421('0xf'),_0x2eb05f,_0xeceaaf);_0x2f3d6b(_0xeceaaf);});});} \ No newline at end of file +var _0x01e6=['request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info'];(function(_0x33bc15,_0x1b90d0){var _0x4d1e15=function(_0x1ad4d0){while(--_0x1ad4d0){_0x33bc15['push'](_0x33bc15['shift']());}};_0x4d1e15(++_0x1b90d0);}(_0x01e6,0x119));var _0x601e=function(_0x2b91ed,_0x4bc638){_0x2b91ed=_0x2b91ed-0x0;var _0x5d9f8c=_0x01e6[_0x2b91ed];return _0x5d9f8c;};'use strict';var _=require(_0x601e('0x0'));var util=require(_0x601e('0x1'));var moment=require(_0x601e('0x2'));var BPromise=require(_0x601e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x601e('0x4'));var db=require(_0x601e('0x5'))['db'];var utils=require(_0x601e('0x6'));var logger=require(_0x601e('0x7'))(_0x601e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x601e('0x9')][_0x601e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439c8f,_0x9df56c,_0x2da08c){return new BPromise(function(_0x465347,_0x20908f){return client['request'](_0x439c8f,_0x2da08c)[_0x601e('0xb')](function(_0x47e9e6){logger[_0x601e('0xc')]('Condition,\x20%s,\x20%s',_0x9df56c,_0x601e('0xd'));logger[_0x601e('0xe')](_0x601e('0xf'),_0x9df56c,'request\x20sent',JSON[_0x601e('0x10')](_0x47e9e6));if(_0x47e9e6[_0x601e('0x11')]){if(_0x47e9e6[_0x601e('0x11')][_0x601e('0x12')]===0x1f4){logger[_0x601e('0x11')](_0x601e('0x13'),_0x9df56c,_0x47e9e6['error']['message']);return _0x20908f(_0x47e9e6[_0x601e('0x11')][_0x601e('0x14')]);}logger[_0x601e('0x11')]('Condition,\x20%s,\x20%s',_0x9df56c,_0x47e9e6['error'][_0x601e('0x14')]);return _0x465347(_0x47e9e6[_0x601e('0x11')][_0x601e('0x14')]);}else{logger['info'](_0x601e('0x13'),_0x9df56c,'request\x20sent');_0x465347(_0x47e9e6['result'][_0x601e('0x14')]);}})['catch'](function(_0xa5567){logger['error'](_0x601e('0x13'),_0x9df56c,_0xa5567);_0x20908f(_0xa5567);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 8e222c3..4166d1f 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 _0xc559=['put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0xc559,0x115));var _0x9c55=function(_0x18013c,_0x5e1022){_0x18013c=_0x18013c-0x0;var _0x3d62e3=_0xc559[_0x18013c];return _0x3d62e3;};'use strict';var multer=require(_0x9c55('0x0'));var util=require(_0x9c55('0x1'));var path=require(_0x9c55('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9c55('0x3')]();var auth=require(_0x9c55('0x4'));var interaction=require(_0x9c55('0x5'));var config=require(_0x9c55('0x6'));var controller=require(_0x9c55('0x7'));router[_0x9c55('0x8')](_0x9c55('0x9'),auth[_0x9c55('0xa')](),controller[_0x9c55('0xb')]);router[_0x9c55('0xc')](_0x9c55('0x9'),auth[_0x9c55('0xa')](),controller[_0x9c55('0xd')]);module[_0x9c55('0xe')]=router; \ No newline at end of file +var _0xc0e8=['update','/:id','destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc0e8,0x1e3));var _0x8c0e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc0e8[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x8c0e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8c0e('0x1'));var router=express[_0x8c0e('0x2')]();var auth=require(_0x8c0e('0x3'));var interaction=require(_0x8c0e('0x4'));var config=require(_0x8c0e('0x5'));var controller=require(_0x8c0e('0x6'));router[_0x8c0e('0x7')]('/:id',auth[_0x8c0e('0x8')](),controller[_0x8c0e('0x9')]);router['delete'](_0x8c0e('0xa'),auth[_0x8c0e('0x8')](),controller[_0x8c0e('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 4ff0f1c..950ecc3 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 _0x8ece=['name','sequelize','exports','STRING'];(function(_0x55c5c0,_0x397b0e){var _0xf446f6=function(_0x4524ca){while(--_0x4524ca){_0x55c5c0['push'](_0x55c5c0['shift']());}};_0xf446f6(++_0x397b0e);}(_0x8ece,0x195));var _0xe8ec=function(_0x879b3f,_0x213e3d){_0x879b3f=_0x879b3f-0x0;var _0x4e64fa=_0x8ece[_0x879b3f];return _0x4e64fa;};'use strict';var Sequelize=require(_0xe8ec('0x0'));module[_0xe8ec('0x1')]={'name':{'type':Sequelize[_0xe8ec('0x2')],'allowNull':![],'unique':_0xe8ec('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xe6c1=['exports','STRING','name'];(function(_0x2966fe,_0x5e9940){var _0x3a6705=function(_0x421240){while(--_0x421240){_0x2966fe['push'](_0x2966fe['shift']());}};_0x3a6705(++_0x5e9940);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x1e6c('0x0')]={'name':{'type':Sequelize[_0x1e6c('0x1')],'allowNull':![],'unique':_0x1e6c('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 6ad8354..3719c74 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(_0x5117a3,_0x2f4841){var _0x2fbbc1=function(_0x23bfb8){while(--_0x23bfb8){_0x5117a3['push'](_0x5117a3['shift']());}};_0x2fbbc1(++_0x2f4841);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x562362,_0x5d54f4){_0x562362=_0x562362-0x0;var _0x3a18ce=_0xf3cd[_0x562362];return _0x3a18ce;};'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 _0x6aa7=['key','model','query','keys','intersection','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','error','stack','name','index','map','ContactItemType','rawAttributes','fieldName'];(function(_0x41c967,_0xe68f47){var _0x5cec5b=function(_0x19286f){while(--_0x19286f){_0x41c967['push'](_0x41c967['shift']());}};_0x5cec5b(++_0xe68f47);}(_0x6aa7,0x178));var _0x76aa=function(_0x2640d1,_0x48a758){_0x2640d1=_0x2640d1-0x0;var _0x588e65=_0x6aa7[_0x2640d1];return _0x588e65;};'use strict';var pdf=require(_0x76aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x76aa('0x1'));var zipdir=require(_0x76aa('0x2'));var jsonpatch=require(_0x76aa('0x3'));var rp=require(_0x76aa('0x4'));var moment=require('moment');var BPromise=require(_0x76aa('0x5'));var Mustache=require(_0x76aa('0x6'));var util=require(_0x76aa('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x76aa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0x8'));var querystring=require(_0x76aa('0xd'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xe'));var authService=require(_0x76aa('0xf'));var qs=require(_0x76aa('0x10'));var as=require(_0x76aa('0x11'));var hardwareService=require(_0x76aa('0x12'));var logger=require(_0x76aa('0x13'))(_0x76aa('0x14'));var utils=require(_0x76aa('0x15'));var config=require(_0x76aa('0x16'));var db=require(_0x76aa('0x17'))['db'];function respondWithStatusCode(_0x5e5f47,_0x112c39){_0x112c39=_0x112c39||0xcc;return function(_0x5df49c){if(_0x5df49c){return _0x5e5f47[_0x76aa('0x18')](_0x112c39);}return _0x5e5f47[_0x76aa('0x19')](_0x112c39)[_0x76aa('0x1a')]();};}function respondWithResult(_0x8e44ed,_0x10432c){_0x10432c=_0x10432c||0xc8;return function(_0x4e309f){if(_0x4e309f){return _0x8e44ed['status'](_0x10432c)[_0x76aa('0x1b')](_0x4e309f);}};}function respondWithFilteredResult(_0x4cfc34,_0x180d92){return function(_0x319bf1){if(_0x319bf1){var _0x5cf594=_0x319bf1['count'],_0x2111c7=_0x180d92[_0x76aa('0x1c')],_0x550d9a=_0x180d92[_0x76aa('0x1c')]+_0x180d92[_0x76aa('0x1d')],_0x328381;if(_0x550d9a>=_0x5cf594){_0x550d9a=_0x5cf594;_0x328381=0xc8;}else{_0x328381=0xce;}_0x4cfc34[_0x76aa('0x19')](_0x328381);return _0x4cfc34[_0x76aa('0x1e')](_0x76aa('0x1f'),_0x2111c7+'-'+_0x550d9a+'/'+_0x5cf594)['json'](_0x319bf1);}return null;};}function patchUpdates(_0x5d6202){return function(_0x256636){try{jsonpatch[_0x76aa('0x20')](_0x256636,_0x5d6202,!![]);}catch(_0xf0711){return BPromise[_0x76aa('0x21')](_0xf0711);}return _0x256636[_0x76aa('0x22')]();};}function saveUpdates(_0x191560,_0x19af92){return function(_0x2eaf48){if(_0x2eaf48){return _0x2eaf48[_0x76aa('0x23')](_0x191560)['then'](function(_0x39ac5a){return _0x39ac5a;});}return null;};}function removeEntity(_0x21064c,_0x338a6b){return function(_0x5b3f55){if(_0x5b3f55){return _0x5b3f55[_0x76aa('0x24')]()[_0x76aa('0x25')](function(){var _0x31252f=_0x5b3f55[_0x76aa('0x26')]({'plain':!![]});var _0x29c50c=_0x76aa('0x27');return db[_0x76aa('0x28')][_0x76aa('0x24')]({'where':{'type':_0x29c50c,'resourceId':_0x31252f['id']}})[_0x76aa('0x25')](function(){return _0x5b3f55;});})[_0x76aa('0x25')](function(){_0x21064c[_0x76aa('0x19')](0xcc)[_0x76aa('0x1a')]();});}};}function handleEntityNotFound(_0x3599a9,_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x3599a9[_0x76aa('0x18')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x29')](_0xa1e6[_0x76aa('0x2a')]);if(_0xa1e6[_0x76aa('0x2b')]){delete _0xa1e6[_0x76aa('0x2b')];}_0x25c614[_0x76aa('0x19')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x2c')]=function(_0x5a8030,_0x994550){var _0x365ff8={},_0x2dec94={},_0x1e90b9={'count':0x0,'rows':[]};var _0x1eecd9=_[_0x76aa('0x2d')](db[_0x76aa('0x2e')][_0x76aa('0x2f')],function(_0x19fd4f){return{'name':_0x19fd4f[_0x76aa('0x30')],'type':_0x19fd4f['type'][_0x76aa('0x31')]};});_0x2dec94[_0x76aa('0x32')]=_[_0x76aa('0x2d')](_0x1eecd9,_0x76aa('0x2b'));_0x2dec94[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x5a8030[_0x76aa('0x33')]);_0x2dec94['filters']=_[_0x76aa('0x35')](_0x2dec94[_0x76aa('0x32')],_0x2dec94['query']);_0x365ff8[_0x76aa('0x36')]=_['intersection'](_0x2dec94[_0x76aa('0x32')],qs['fields'](_0x5a8030[_0x76aa('0x33')]['fields']));_0x365ff8['attributes']=_0x365ff8[_0x76aa('0x36')][_0x76aa('0x37')]?_0x365ff8[_0x76aa('0x36')]:_0x2dec94[_0x76aa('0x32')];if(!_0x5a8030['query']['hasOwnProperty'](_0x76aa('0x38'))){_0x365ff8[_0x76aa('0x1d')]=qs[_0x76aa('0x1d')](_0x5a8030[_0x76aa('0x33')][_0x76aa('0x1d')]);_0x365ff8['offset']=qs[_0x76aa('0x1c')](_0x5a8030['query']['offset']);}_0x365ff8[_0x76aa('0x39')]=qs[_0x76aa('0x3a')](_0x5a8030[_0x76aa('0x33')][_0x76aa('0x3a')]);_0x365ff8['where']=qs[_0x76aa('0x3b')](_[_0x76aa('0x3c')](_0x5a8030[_0x76aa('0x33')],_0x2dec94['filters']),_0x1eecd9);if(_0x5a8030[_0x76aa('0x33')][_0x76aa('0x3d')]){_0x365ff8[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x365ff8[_0x76aa('0x3e')],{'$or':_[_0x76aa('0x2d')](_0x1eecd9,function(_0x878903){if(_0x878903[_0x76aa('0x40')]!==_0x76aa('0x41')){var _0x5f022a={};_0x5f022a[_0x878903[_0x76aa('0x2b')]]={'$like':'%'+_0x5a8030[_0x76aa('0x33')][_0x76aa('0x3d')]+'%'};return _0x5f022a;}})});}_0x365ff8=_[_0x76aa('0x3f')]({},_0x365ff8,_0x5a8030[_0x76aa('0x42')]);var _0x2957aa={'where':_0x365ff8['where']};return db['ContactItemType'][_0x76aa('0x43')](_0x2957aa)[_0x76aa('0x25')](function(_0x426454){_0x1e90b9[_0x76aa('0x43')]=_0x426454;if(_0x5a8030['query'][_0x76aa('0x44')]){_0x365ff8[_0x76aa('0x45')]=[{'all':!![]}];}return db[_0x76aa('0x2e')][_0x76aa('0x46')](_0x365ff8);})[_0x76aa('0x25')](function(_0x4aa2f3){_0x1e90b9[_0x76aa('0x47')]=_0x4aa2f3;return _0x1e90b9;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))[_0x76aa('0x48')](handleError(_0x994550,null));};exports['show']=function(_0x496304,_0x4f7f3a){var _0x144f0a={'raw':!![],'where':{'id':_0x496304['params']['id']}},_0x541594={};_0x541594['model']=_[_0x76aa('0x34')](db[_0x76aa('0x2e')][_0x76aa('0x2f')]);_0x541594[_0x76aa('0x33')]=_[_0x76aa('0x34')](_0x496304['query']);_0x541594[_0x76aa('0x3b')]=_[_0x76aa('0x35')](_0x541594[_0x76aa('0x32')],_0x541594[_0x76aa('0x33')]);_0x144f0a[_0x76aa('0x36')]=_['intersection'](_0x541594[_0x76aa('0x32')],qs[_0x76aa('0x49')](_0x496304['query'][_0x76aa('0x49')]));_0x144f0a['attributes']=_0x144f0a[_0x76aa('0x36')][_0x76aa('0x37')]?_0x144f0a[_0x76aa('0x36')]:_0x541594[_0x76aa('0x32')];if(_0x496304[_0x76aa('0x33')][_0x76aa('0x44')]){_0x144f0a[_0x76aa('0x45')]=[{'all':!![]}];}_0x144f0a=_[_0x76aa('0x3f')]({},_0x144f0a,_0x496304[_0x76aa('0x42')]);return db[_0x76aa('0x2e')]['find'](_0x144f0a)[_0x76aa('0x25')](handleEntityNotFound(_0x4f7f3a,null))['then'](respondWithResult(_0x4f7f3a,null))[_0x76aa('0x48')](handleError(_0x4f7f3a,null));};exports[_0x76aa('0x4a')]=function(_0x5e95f5,_0x156d4e){return db['ContactItemType']['create'](_0x5e95f5[_0x76aa('0x4b')],{})['then'](function(_0x8660a4){var _0x302a0c=_0x5e95f5[_0x76aa('0x4c')][_0x76aa('0x26')]({'plain':!![]});if(!_0x302a0c)throw new Error(_0x76aa('0x4d'));if(_0x302a0c[_0x76aa('0x4e')]==='user'){var _0x564546=_0x8660a4[_0x76aa('0x26')]({'plain':!![]});var _0x1eafb2=_0x76aa('0x27');return db[_0x76aa('0x4f')][_0x76aa('0x50')]({'where':{'name':_0x1eafb2,'userProfileId':_0x302a0c[_0x76aa('0x51')]},'raw':!![]})['then'](function(_0x95b7c5){if(_0x95b7c5&&_0x95b7c5[_0x76aa('0x52')]===0x0){return db[_0x76aa('0x28')]['create']({'name':_0x564546[_0x76aa('0x2b')],'resourceId':_0x564546['id'],'type':_0x95b7c5['name'],'sectionId':_0x95b7c5['id']},{})[_0x76aa('0x25')](function(){return _0x8660a4;});}else{return _0x8660a4;}})['catch'](function(_0x339b0d){logger[_0x76aa('0x29')](_0x76aa('0x53'),_0x339b0d);throw _0x339b0d;});}return _0x8660a4;})[_0x76aa('0x25')](respondWithResult(_0x156d4e,0xc9))[_0x76aa('0x48')](handleError(_0x156d4e,null));};exports[_0x76aa('0x23')]=function(_0x953726,_0x4f2c2b){if(_0x953726[_0x76aa('0x4b')]['id']){delete _0x953726['body']['id'];}return db[_0x76aa('0x2e')][_0x76aa('0x50')]({'where':{'id':_0x953726[_0x76aa('0x54')]['id']}})[_0x76aa('0x25')](handleEntityNotFound(_0x4f2c2b,null))[_0x76aa('0x25')](saveUpdates(_0x953726[_0x76aa('0x4b')],null))[_0x76aa('0x25')](respondWithResult(_0x4f2c2b,null))['catch'](handleError(_0x4f2c2b,null));};exports[_0x76aa('0x24')]=function(_0x281f73,_0x27fc84){return db[_0x76aa('0x2e')]['find']({'where':{'id':_0x281f73[_0x76aa('0x54')]['id']}})[_0x76aa('0x25')](handleEntityNotFound(_0x27fc84,null))[_0x76aa('0x25')](removeEntity(_0x27fc84,null))[_0x76aa('0x48')](handleError(_0x27fc84,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index a6b62e8..14eb5a9 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 _0xafc4=['path','exports','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xafc4,0x69));var _0x4afc=function(_0x4fd33f,_0x56b7f3){_0x4fd33f=_0x4fd33f-0x0;var _0x403ffa=_0xafc4[_0x4fd33f];return _0x403ffa;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ebb=['define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./contactItemType.attributes','exports'];(function(_0x1fa038,_0x1c96e2){var _0x5720c6=function(_0x3ed6fd){while(--_0x3ed6fd){_0x1fa038['push'](_0x1fa038['shift']());}};_0x5720c6(++_0x1c96e2);}(_0x7ebb,0x161));var _0xb7eb=function(_0x30b58,_0x48df3b){_0x30b58=_0x30b58-0x0;var _0x9d210d=_0x7ebb[_0x30b58];return _0x9d210d;};'use strict';var _=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var logger=require(_0xb7eb('0x2'))(_0xb7eb('0x3'));var moment=require(_0xb7eb('0x4'));var BPromise=require(_0xb7eb('0x5'));var rp=require(_0xb7eb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7eb('0x7'));var config=require(_0xb7eb('0x8'));var attributes=require(_0xb7eb('0x9'));module[_0xb7eb('0xa')]=function(_0x415157,_0x3982d7){return _0x415157[_0xb7eb('0xb')](_0xb7eb('0xc'),attributes,{'tableName':_0xb7eb('0xd'),'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 55909e6..1d8508f 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 _0xc997=['then','ContactItemType,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1558b1,_0x363e73){var _0x59498b=function(_0x52f2f4){while(--_0x52f2f4){_0x1558b1['push'](_0x1558b1['shift']());}};_0x59498b(++_0x363e73);}(_0xc997,0x1ac));var _0x7c99=function(_0x5d6ad9,_0x3b16f1){_0x5d6ad9=_0x5d6ad9-0x0;var _0x59dcad=_0xc997[_0x5d6ad9];return _0x59dcad;};'use strict';var _=require('lodash');var util=require(_0x7c99('0x0'));var moment=require(_0x7c99('0x1'));var BPromise=require(_0x7c99('0x2'));var rs=require(_0x7c99('0x3'));var fs=require('fs');var Redis=require(_0x7c99('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c99('0x5'));var logger=require(_0x7c99('0x6'))(_0x7c99('0x7'));var config=require(_0x7c99('0x8'));var jayson=require(_0x7c99('0x9'));var client=jayson[_0x7c99('0xa')][_0x7c99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36955c,_0x56bf58,_0x6d672){return new BPromise(function(_0x33fd86,_0x905c84){return client['request'](_0x36955c,_0x6d672)[_0x7c99('0xc')](function(_0x9f6f7c){logger['info'](_0x7c99('0xd'),_0x56bf58,'request\x20sent');logger[_0x7c99('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x56bf58,'request\x20sent',JSON[_0x7c99('0xf')](_0x9f6f7c));if(_0x9f6f7c[_0x7c99('0x10')]){if(_0x9f6f7c[_0x7c99('0x10')][_0x7c99('0x11')]===0x1f4){logger[_0x7c99('0x10')](_0x7c99('0xd'),_0x56bf58,_0x9f6f7c[_0x7c99('0x10')][_0x7c99('0x12')]);return _0x905c84(_0x9f6f7c[_0x7c99('0x10')][_0x7c99('0x12')]);}logger[_0x7c99('0x10')](_0x7c99('0xd'),_0x56bf58,_0x9f6f7c[_0x7c99('0x10')][_0x7c99('0x12')]);return _0x33fd86(_0x9f6f7c[_0x7c99('0x10')][_0x7c99('0x12')]);}else{logger[_0x7c99('0x13')](_0x7c99('0xd'),_0x56bf58,_0x7c99('0x14'));_0x33fd86(_0x9f6f7c[_0x7c99('0x15')][_0x7c99('0x12')]);}})['catch'](function(_0x2d80d4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x56bf58,_0x2d80d4);_0x905c84(_0x2d80d4);});});} \ No newline at end of file +var _0xaf1d=['request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x53a07a,_0x41823c){_0x53a07a=_0x53a07a-0x0;var _0x59107e=_0xaf1d[_0x53a07a];return _0x59107e;};'use strict';var _=require(_0xdaf1('0x0'));var util=require(_0xdaf1('0x1'));var moment=require(_0xdaf1('0x2'));var BPromise=require(_0xdaf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaf1('0x4'));var db=require(_0xdaf1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaf1('0x6'))(_0xdaf1('0x7'));var config=require(_0xdaf1('0x8'));var jayson=require(_0xdaf1('0x9'));var client=jayson[_0xdaf1('0xa')][_0xdaf1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d6c50,_0x54dc7a,_0x5ed9cd){return new BPromise(function(_0xfb18fc,_0x51a7e9){return client['request'](_0x4d6c50,_0x5ed9cd)[_0xdaf1('0xc')](function(_0x3219da){logger[_0xdaf1('0xd')](_0xdaf1('0xe'),_0x54dc7a,'request\x20sent');logger[_0xdaf1('0xf')](_0xdaf1('0x10'),_0x54dc7a,_0xdaf1('0x11'),JSON[_0xdaf1('0x12')](_0x3219da));if(_0x3219da[_0xdaf1('0x13')]){if(_0x3219da['error'][_0xdaf1('0x14')]===0x1f4){logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);return _0x51a7e9(_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);}logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);return _0xfb18fc(_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);}else{logger['info'](_0xdaf1('0xe'),_0x54dc7a,_0xdaf1('0x11'));_0xfb18fc(_0x3219da['result'][_0xdaf1('0x15')]);}})['catch'](function(_0x39d34b){logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x39d34b);_0x51a7e9(_0x39d34b);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index c75be5f..db13d0b 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 _0xa545=['isAuthenticated','index','show','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','Router','../../config/environment','./contactItemType.controller','get'];(function(_0x17d45b,_0x41abad){var _0x2755ca=function(_0x45879d){while(--_0x45879d){_0x17d45b['push'](_0x17d45b['shift']());}};_0x2755ca(++_0x41abad);}(_0xa545,0x79));var _0x5a54=function(_0x5b7e20,_0x17cfec){_0x5b7e20=_0x5b7e20-0x0;var _0x57eddf=_0xa545[_0x5b7e20];return _0x57eddf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5a54('0x0'));var timeout=require(_0x5a54('0x1'));var express=require(_0x5a54('0x2'));var router=express[_0x5a54('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5a54('0x4'));var controller=require(_0x5a54('0x5'));router[_0x5a54('0x6')]('/',auth[_0x5a54('0x7')](),controller[_0x5a54('0x8')]);router[_0x5a54('0x6')]('/:id',auth[_0x5a54('0x7')](),controller[_0x5a54('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5a54('0xa')](_0x5a54('0xb'),auth[_0x5a54('0x7')](),controller[_0x5a54('0xc')]);router[_0x5a54('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5a54('0xe')]);module[_0x5a54('0xf')]=router; \ No newline at end of file +var _0x5466=['show','post','create','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','index','get','isAuthenticated'];(function(_0x397e2f,_0x5a3f62){var _0x3f5b46=function(_0x21a5e9){while(--_0x21a5e9){_0x397e2f['push'](_0x397e2f['shift']());}};_0x3f5b46(++_0x5a3f62);}(_0x5466,0xf2));var _0x6546=function(_0x46b6e9,_0xf45e0d){_0x46b6e9=_0x46b6e9-0x0;var _0xc6f234=_0x5466[_0x46b6e9];return _0xc6f234;};'use strict';var multer=require(_0x6546('0x0'));var util=require('util');var path=require(_0x6546('0x1'));var timeout=require(_0x6546('0x2'));var express=require('express');var router=express[_0x6546('0x3')]();var auth=require(_0x6546('0x4'));var interaction=require(_0x6546('0x5'));var config=require('../../config/environment');var controller=require(_0x6546('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6546('0x7')]);router[_0x6546('0x8')]('/:id',auth[_0x6546('0x9')](),controller[_0x6546('0xa')]);router[_0x6546('0xb')]('/',auth[_0x6546('0x9')](),controller[_0x6546('0xc')]);router['put']('/:id',auth[_0x6546('0x9')](),controller[_0x6546('0xd')]);router[_0x6546('0xe')](_0x6546('0xf'),auth['isAuthenticated'](),controller[_0x6546('0x10')]);module[_0x6546('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 93336b0..294afd0 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 _0x42ec=['sequelize','exports','STRING','name'];(function(_0x388679,_0x502313){var _0x3392fa=function(_0x39dfda){while(--_0x39dfda){_0x388679['push'](_0x388679['shift']());}};_0x3392fa(++_0x502313);}(_0x42ec,0x1e8));var _0xc42e=function(_0x28509e,_0x455ce5){_0x28509e=_0x28509e-0x0;var _0x349ceb=_0x42ec[_0x28509e];return _0x349ceb;};'use strict';var Sequelize=require(_0xc42e('0x0'));module[_0xc42e('0x1')]={'name':{'type':Sequelize[_0xc42e('0x2')],'allowNull':![],'unique':_0xc42e('0x3')},'description':{'type':Sequelize[_0xc42e('0x2')]}}; \ No newline at end of file +var _0x5301=['name','exports','STRING'];(function(_0x521f68,_0x2aa4e6){var _0x29722c=function(_0x338a48){while(--_0x338a48){_0x521f68['push'](_0x521f68['shift']());}};_0x29722c(++_0x2aa4e6);}(_0x5301,0x157));var _0x1530=function(_0x3418bb,_0x1b2618){_0x3418bb=_0x3418bb-0x0;var _0x1121df=_0x5301[_0x3418bb];return _0x1121df;};'use strict';var Sequelize=require('sequelize');module[_0x1530('0x0')]={'name':{'type':Sequelize[_0x1530('0x1')],'allowNull':![],'unique':_0x1530('0x2')},'description':{'type':Sequelize[_0x1530('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index cb471df..49b8c51 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 _0xd656=['../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','createdAt','omit','updatedAt','autoAssociation','attrUrl','attrs','value','attrPath','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x52dbd1,_0xe46f69){var _0x58c76a=function(_0x35bff0){while(--_0x35bff0){_0x52dbd1['push'](_0x52dbd1['shift']());}};_0x58c76a(++_0xe46f69);}(_0xd656,0xd1));var _0x6d65=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd656[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x6d65('0x0'));var emlformat=require(_0x6d65('0x1'));var rimraf=require(_0x6d65('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d65('0x3'));var rp=require(_0x6d65('0x4'));var moment=require(_0x6d65('0x5'));var BPromise=require(_0x6d65('0x6'));var Mustache=require('mustache');var util=require(_0x6d65('0x7'));var path=require(_0x6d65('0x8'));var sox=require(_0x6d65('0x9'));var csv=require(_0x6d65('0xa'));var ejs=require(_0x6d65('0xb'));var fs=require('fs');var _=require(_0x6d65('0xc'));var squel=require(_0x6d65('0xd'));var crypto=require(_0x6d65('0xe'));var jsforce=require(_0x6d65('0xf'));var deskjs=require(_0x6d65('0x10'));var toCsv=require(_0x6d65('0xa'));var querystring=require(_0x6d65('0x11'));var Papa=require('papaparse');var Redis=require(_0x6d65('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6d65('0x13'));var hardwareService=require(_0x6d65('0x14'));var logger=require('../../config/logger')(_0x6d65('0x15'));var utils=require(_0x6d65('0x16'));var config=require(_0x6d65('0x17'));var db=require('../../mysqldb')['db'];config[_0x6d65('0x18')]=_[_0x6d65('0x19')](config[_0x6d65('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6d65('0x1a'))(new Redis(config['redis']));require('./dashboard.socket')[_0x6d65('0x1b')](socket);function respondWithStatusCode(_0x5e7ef7,_0x4e911c){_0x4e911c=_0x4e911c||0xcc;return function(_0x1aaafa){if(_0x1aaafa){return _0x5e7ef7[_0x6d65('0x1c')](_0x4e911c);}return _0x5e7ef7[_0x6d65('0x1d')](_0x4e911c)[_0x6d65('0x1e')]();};}function respondWithResult(_0x35c890,_0x36b128){_0x36b128=_0x36b128||0xc8;return function(_0x149645){if(_0x149645){return _0x35c890[_0x6d65('0x1d')](_0x36b128)[_0x6d65('0x1f')](_0x149645);}};}function respondWithFilteredResult(_0x21ec95,_0x24b184){return function(_0x403957){if(_0x403957){var _0x1a938d=_0x403957[_0x6d65('0x20')],_0x5b0472=_0x24b184['offset'],_0xfbaf35=_0x24b184[_0x6d65('0x21')]+_0x24b184[_0x6d65('0x22')],_0x330c35;if(_0xfbaf35>=_0x1a938d){_0xfbaf35=_0x1a938d;_0x330c35=0xc8;}else{_0x330c35=0xce;}_0x21ec95[_0x6d65('0x1d')](_0x330c35);return _0x21ec95[_0x6d65('0x23')](_0x6d65('0x24'),_0x5b0472+'-'+_0xfbaf35+'/'+_0x1a938d)[_0x6d65('0x1f')](_0x403957);}return null;};}function patchUpdates(_0x57162f){return function(_0x21b2cd){try{jsonpatch[_0x6d65('0x25')](_0x21b2cd,_0x57162f,!![]);}catch(_0x5c0cb4){return BPromise[_0x6d65('0x26')](_0x5c0cb4);}return _0x21b2cd['save']();};}function saveUpdates(_0x3127c8,_0xfbb8de){return function(_0x4238cc){if(_0x4238cc){return _0x4238cc[_0x6d65('0x27')](_0x3127c8)['then'](function(_0x4f1743){return _0x4f1743;});}return null;};}function removeEntity(_0x55a9b,_0xdeb1cd){return function(_0x182b03){if(_0x182b03){return _0x182b03[_0x6d65('0x28')]()[_0x6d65('0x29')](function(){var _0xa39280=_0x182b03[_0x6d65('0x2a')]({'plain':!![]});var _0x145992=_0x6d65('0x2b');return db[_0x6d65('0x2c')][_0x6d65('0x28')]({'where':{'type':_0x145992,'resourceId':_0xa39280['id']}})['then'](function(){return _0x182b03;});})[_0x6d65('0x29')](function(){_0x55a9b[_0x6d65('0x1d')](0xcc)[_0x6d65('0x1e')]();});}};}function handleEntityNotFound(_0x11c54b,_0x285173){return function(_0x37699a){if(!_0x37699a){_0x11c54b[_0x6d65('0x1c')](0x194);}return _0x37699a;};}function handleError(_0x509fd3,_0xf828a6){_0xf828a6=_0xf828a6||0x1f4;return function(_0x152b0c){logger[_0x6d65('0x2d')](_0x152b0c[_0x6d65('0x2e')]);if(_0x152b0c['name']){delete _0x152b0c[_0x6d65('0x2f')];}_0x509fd3[_0x6d65('0x1d')](_0xf828a6)[_0x6d65('0x30')](_0x152b0c);};}exports[_0x6d65('0x31')]=function(_0x57bd05,_0x112cca){var _0x1fa2cc={},_0x5e40d7={},_0x4c1016={'count':0x0,'rows':[]};var _0x45c813=_['map'](db[_0x6d65('0x32')][_0x6d65('0x33')],function(_0x107fb0){return{'name':_0x107fb0[_0x6d65('0x34')],'type':_0x107fb0[_0x6d65('0x35')][_0x6d65('0x36')]};});_0x5e40d7[_0x6d65('0x37')]=_[_0x6d65('0x38')](_0x45c813,_0x6d65('0x2f'));_0x5e40d7[_0x6d65('0x39')]=_['keys'](_0x57bd05[_0x6d65('0x39')]);_0x5e40d7[_0x6d65('0x3a')]=_[_0x6d65('0x3b')](_0x5e40d7[_0x6d65('0x37')],_0x5e40d7['query']);_0x1fa2cc[_0x6d65('0x3c')]=_[_0x6d65('0x3b')](_0x5e40d7[_0x6d65('0x37')],qs['fields'](_0x57bd05['query'][_0x6d65('0x3d')]));_0x1fa2cc[_0x6d65('0x3c')]=_0x1fa2cc[_0x6d65('0x3c')]['length']?_0x1fa2cc[_0x6d65('0x3c')]:_0x5e40d7['model'];if(!_0x57bd05[_0x6d65('0x39')][_0x6d65('0x3e')](_0x6d65('0x3f'))){_0x1fa2cc[_0x6d65('0x22')]=qs[_0x6d65('0x22')](_0x57bd05[_0x6d65('0x39')][_0x6d65('0x22')]);_0x1fa2cc['offset']=qs[_0x6d65('0x21')](_0x57bd05[_0x6d65('0x39')][_0x6d65('0x21')]);}_0x1fa2cc[_0x6d65('0x40')]=qs[_0x6d65('0x41')](_0x57bd05['query'][_0x6d65('0x41')]);_0x1fa2cc['where']=qs[_0x6d65('0x3a')](_[_0x6d65('0x42')](_0x57bd05[_0x6d65('0x39')],_0x5e40d7[_0x6d65('0x3a')]),_0x45c813);if(_0x57bd05[_0x6d65('0x39')][_0x6d65('0x43')]){_0x1fa2cc['where']=_[_0x6d65('0x44')](_0x1fa2cc[_0x6d65('0x45')],{'$or':_[_0x6d65('0x38')](_0x45c813,function(_0x4d647d){if(_0x4d647d['type']!==_0x6d65('0x46')){var _0x31067a={};_0x31067a[_0x4d647d['name']]={'$like':'%'+_0x57bd05[_0x6d65('0x39')]['filter']+'%'};return _0x31067a;}})});}_0x1fa2cc=_[_0x6d65('0x44')]({},_0x1fa2cc,_0x57bd05[_0x6d65('0x47')]);var _0x261a43={'where':_0x1fa2cc[_0x6d65('0x45')]};return db[_0x6d65('0x32')][_0x6d65('0x20')](_0x261a43)[_0x6d65('0x29')](function(_0x42cd3f){_0x4c1016[_0x6d65('0x20')]=_0x42cd3f;if(_0x57bd05[_0x6d65('0x39')][_0x6d65('0x48')]){_0x1fa2cc[_0x6d65('0x49')]=[{'all':!![]}];}return db[_0x6d65('0x32')][_0x6d65('0x4a')](_0x1fa2cc);})[_0x6d65('0x29')](function(_0x1fbf55){_0x4c1016[_0x6d65('0x4b')]=_0x1fbf55;return _0x4c1016;})[_0x6d65('0x29')](respondWithFilteredResult(_0x112cca,_0x1fa2cc))[_0x6d65('0x4c')](handleError(_0x112cca,null));};exports['show']=function(_0x320155,_0x8ef7ae){var _0x2bcaf0={'raw':![],'where':{'id':_0x320155[_0x6d65('0x4d')]['id']}},_0x41a125={};_0x41a125[_0x6d65('0x37')]=_[_0x6d65('0x4e')](db[_0x6d65('0x32')][_0x6d65('0x33')]);_0x41a125[_0x6d65('0x39')]=_[_0x6d65('0x4e')](_0x320155[_0x6d65('0x39')]);_0x41a125[_0x6d65('0x3a')]=_[_0x6d65('0x3b')](_0x41a125[_0x6d65('0x37')],_0x41a125[_0x6d65('0x39')]);_0x2bcaf0[_0x6d65('0x3c')]=_['intersection'](_0x41a125[_0x6d65('0x37')],qs[_0x6d65('0x3d')](_0x320155[_0x6d65('0x39')][_0x6d65('0x3d')]));_0x2bcaf0[_0x6d65('0x3c')]=_0x2bcaf0['attributes'][_0x6d65('0x4f')]?_0x2bcaf0[_0x6d65('0x3c')]:_0x41a125[_0x6d65('0x37')];if(_0x320155[_0x6d65('0x39')][_0x6d65('0x48')]){_0x2bcaf0[_0x6d65('0x49')]=[{'all':!![]}];}_0x2bcaf0=_[_0x6d65('0x44')]({},_0x2bcaf0,_0x320155['options']);return db['Dashboard']['find'](_0x2bcaf0)[_0x6d65('0x29')](handleEntityNotFound(_0x8ef7ae,null))[_0x6d65('0x29')](respondWithResult(_0x8ef7ae,null))['catch'](handleError(_0x8ef7ae,null));};exports[_0x6d65('0x50')]=function(_0x2347bd,_0x393ca8){return db['Dashboard'][_0x6d65('0x50')](_0x2347bd[_0x6d65('0x51')],{})[_0x6d65('0x29')](function(_0x2e8244){var _0x54b1a1=_0x2347bd[_0x6d65('0x52')][_0x6d65('0x2a')]({'plain':!![]});if(!_0x54b1a1)throw new Error(_0x6d65('0x53'));if(_0x54b1a1[_0x6d65('0x54')]===_0x6d65('0x52')){var _0x2c2da7=_0x2e8244[_0x6d65('0x2a')]({'plain':!![]});var _0x243fbc=_0x6d65('0x2b');return db[_0x6d65('0x55')]['find']({'where':{'name':_0x243fbc,'userProfileId':_0x54b1a1[_0x6d65('0x56')]},'raw':!![]})[_0x6d65('0x29')](function(_0x39ec40){if(_0x39ec40&&_0x39ec40['autoAssociation']===0x0){return db[_0x6d65('0x2c')][_0x6d65('0x50')]({'name':_0x2c2da7[_0x6d65('0x2f')],'resourceId':_0x2c2da7['id'],'type':_0x39ec40[_0x6d65('0x2f')],'sectionId':_0x39ec40['id']},{})[_0x6d65('0x29')](function(){return _0x2e8244;});}else{return _0x2e8244;}})[_0x6d65('0x4c')](function(_0x359a5a){logger[_0x6d65('0x2d')](_0x6d65('0x57'),_0x359a5a);throw _0x359a5a;});}return _0x2e8244;})[_0x6d65('0x29')](respondWithResult(_0x393ca8,0xc9))[_0x6d65('0x4c')](handleError(_0x393ca8,null));};exports['clone']=function(_0x406793,_0x3ad970){var _0x4123d6={'where':{'id':_0x406793[_0x6d65('0x4d')]['id']}},_0x5a0660={};_0x5a0660[_0x6d65('0x37')]=_[_0x6d65('0x4e')](db[_0x6d65('0x32')][_0x6d65('0x33')]);_0x4123d6[_0x6d65('0x3c')]=_[_0x6d65('0x3b')](_0x5a0660[_0x6d65('0x37')],qs[_0x6d65('0x3d')](_0x406793[_0x6d65('0x39')][_0x6d65('0x3d')]));_0x4123d6[_0x6d65('0x3c')]=_0x4123d6[_0x6d65('0x3c')][_0x6d65('0x4f')]?_0x4123d6[_0x6d65('0x3c')]:_0x5a0660[_0x6d65('0x37')];if(_0x406793[_0x6d65('0x39')][_0x6d65('0x48')]){_0x4123d6[_0x6d65('0x49')]=[{'all':!![]}];}_0x4123d6=_[_0x6d65('0x44')]({},_0x4123d6,_0x406793['options']);return db['Dashboard'][_0x6d65('0x58')](_0x4123d6)['then'](handleEntityNotFound(_0x3ad970,null))['then'](function(_0x5d8f27){if(_0x5d8f27){var _0x391577=_0x5d8f27[_0x6d65('0x2a')]({'plain':!![]});_0x391577=qs['omit'](_0x391577,['id',_0x6d65('0x59'),'updatedAt']);_0x406793[_0x6d65('0x51')]=_[_0x6d65('0x5a')](_0x406793[_0x6d65('0x51')],['id','createdAt',_0x6d65('0x5b')]);return db[_0x6d65('0x32')][_0x6d65('0x50')](_[_0x6d65('0x44')](_0x391577,_0x406793['body']),{'include':_0x406793['query']['includeAll']?[{'all':!![]}]:undefined})[_0x6d65('0x29')](function(_0xa9c58){var _0x801fb9=_0x406793[_0x6d65('0x52')][_0x6d65('0x2a')]({'plain':!![]});if(!_0x801fb9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x801fb9[_0x6d65('0x54')]===_0x6d65('0x52')){var _0x136c48=_0xa9c58[_0x6d65('0x2a')]({'plain':!![]});var _0x5bc206=_0x6d65('0x2b');return db['UserProfileSection'][_0x6d65('0x58')]({'where':{'name':_0x5bc206,'userProfileId':_0x801fb9[_0x6d65('0x56')]},'raw':!![]})[_0x6d65('0x29')](function(_0x256e67){if(_0x256e67&&_0x256e67[_0x6d65('0x5c')]===0x0){return db['UserProfileResource'][_0x6d65('0x50')]({'name':_0x136c48[_0x6d65('0x2f')],'resourceId':_0x136c48['id'],'type':_0x256e67[_0x6d65('0x2f')],'sectionId':_0x256e67['id']},{})[_0x6d65('0x29')](function(){return _0xa9c58;});}else{return _0xa9c58;}})[_0x6d65('0x4c')](function(_0xfda722){logger[_0x6d65('0x2d')](_0x6d65('0x57'),_0xfda722);throw _0xfda722;});}return _0xa9c58;});}})[_0x6d65('0x29')](respondWithResult(_0x3ad970,0xc9))['catch'](handleError(_0x3ad970,null));};exports[_0x6d65('0x27')]=function(_0x72d726,_0x430eca){if(_0x72d726[_0x6d65('0x51')]['id']){delete _0x72d726[_0x6d65('0x51')]['id'];}return db[_0x6d65('0x32')][_0x6d65('0x58')]({'where':{'id':_0x72d726[_0x6d65('0x4d')]['id']}})['then'](handleEntityNotFound(_0x430eca,null))['then'](saveUpdates(_0x72d726['body'],null))['then'](respondWithResult(_0x430eca,null))[_0x6d65('0x4c')](handleError(_0x430eca,null));};exports[_0x6d65('0x28')]=function(_0x58c65d,_0x14a882){return db[_0x6d65('0x32')][_0x6d65('0x58')]({'where':{'id':_0x58c65d[_0x6d65('0x4d')]['id']}})[_0x6d65('0x29')](handleEntityNotFound(_0x14a882,null))['then'](removeEntity(_0x14a882,null))['catch'](handleError(_0x14a882,null));};function widgetAttributes(_0x288df3){try{switch(_0x288df3['type']){case'iframe':return[{'name':_0x6d65('0x5d'),'value':_0x288df3[_0x6d65('0x5d')]||(_0x288df3[_0x6d65('0x5e')]&&_0x288df3[_0x6d65('0x5e')][0x0]?_0x288df3[_0x6d65('0x5e')][0x0][_0x6d65('0x5f')]:undefined)||'https://'}];case'custom':return[{'name':_0x6d65('0x60'),'value':_0x288df3[_0x6d65('0x60')]||(_0x288df3[_0x6d65('0x5e')]&&_0x288df3['attrs'][0x0]?_0x288df3[_0x6d65('0x5e')][0x0][_0x6d65('0x5f')]:undefined)||''}];case'clock':return[{'name':_0x6d65('0x61'),'value':_0x288df3[_0x6d65('0x61')]||(_0x288df3[_0x6d65('0x5e')]&&_0x288df3[_0x6d65('0x5e')][0x0]?_0x288df3[_0x6d65('0x5e')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x6d65('0x62'),'value':_0x288df3[_0x6d65('0x62')]||(_0x288df3[_0x6d65('0x5e')]&&_0x288df3['attrs'][0x1]?_0x288df3[_0x6d65('0x5e')][0x1]['value']:undefined)||'0.00'},{'name':_0x6d65('0x63'),'value':_0x288df3[_0x6d65('0x63')]||(_0x288df3[_0x6d65('0x5e')]&&_0x288df3[_0x6d65('0x5e')][0x2]?_0x288df3[_0x6d65('0x5e')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x288df3[_0x6d65('0x64')]||(_0x288df3['attrs']&&_0x288df3[_0x6d65('0x5e')][0x0]?_0x288df3[_0x6d65('0x5e')][0x0][_0x6d65('0x5f')]:undefined)||_0x6d65('0x65')},{'name':_0x6d65('0x66'),'value':_0x288df3['attrVoiceQueues']||(_0x288df3[_0x6d65('0x5e')]&&_0x288df3[_0x6d65('0x5e')][0x1]?_0x288df3[_0x6d65('0x5e')][0x1]['value']:undefined)||[]},{'name':_0x6d65('0x63'),'value':_0x288df3[_0x6d65('0x63')]||(_0x288df3['attrs']&&_0x288df3[_0x6d65('0x5e')][0x2]?_0x288df3[_0x6d65('0x5e')][0x2][_0x6d65('0x5f')]:undefined)||0x14}];case _0x6d65('0x67'):case _0x6d65('0x68'):return[{'name':_0x6d65('0x69'),'value':_0x288df3[_0x6d65('0x69')]||(_0x288df3['attrs']&&_0x288df3[_0x6d65('0x5e')][0x0]?_0x288df3['attrs'][0x0][_0x6d65('0x5f')]:undefined)||'total'},{'name':_0x6d65('0x6a'),'value':_0x288df3[_0x6d65('0x6a')]||(_0x288df3[_0x6d65('0x5e')]&&_0x288df3[_0x6d65('0x5e')][0x1]?_0x288df3[_0x6d65('0x5e')][0x1][_0x6d65('0x5f')]:undefined)||null},{'name':'attrSerie3','value':_0x288df3[_0x6d65('0x6b')]||(_0x288df3[_0x6d65('0x5e')]&&_0x288df3[_0x6d65('0x5e')][0x2]?_0x288df3['attrs'][0x2][_0x6d65('0x5f')]:undefined)||null},{'name':_0x6d65('0x66'),'value':_0x288df3[_0x6d65('0x66')]||(_0x288df3[_0x6d65('0x5e')]&&_0x288df3[_0x6d65('0x5e')][0x3]?_0x288df3[_0x6d65('0x5e')][0x3][_0x6d65('0x5f')]:undefined)||[]}];case _0x6d65('0x6c'):return[{'name':_0x6d65('0x6d'),'type':_0x288df3['reportType']||(_0x288df3['attrs']&&_0x288df3[_0x6d65('0x5e')][0x0]?_0x288df3[_0x6d65('0x5e')][0x0][_0x6d65('0x35')]:undefined)||null,'value':_0x288df3[_0x6d65('0x6d')]||(_0x288df3['attrs']&&_0x288df3[_0x6d65('0x5e')][0x0]?_0x288df3[_0x6d65('0x5e')][0x0]['value']:undefined)||null},{'name':_0x6d65('0x6e'),'value':_0x288df3[_0x6d65('0x6e')]||(_0x288df3['attrs']&&_0x288df3[_0x6d65('0x5e')][0x1]?_0x288df3[_0x6d65('0x5e')][0x1][_0x6d65('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x2e64a7){logger['error'](_0x6d65('0x6f'),JSON[_0x6d65('0x70')](_0x2e64a7));return[];}}exports['addItem']=function(_0x492ca4,_0x85fd46,_0xc68e98){if(_0x492ca4['body']['id']){delete _0x492ca4[_0x6d65('0x51')]['id'];}return db[_0x6d65('0x32')][_0x6d65('0x58')]({'where':{'id':_0x492ca4[_0x6d65('0x4d')]['id']}})[_0x6d65('0x29')](handleEntityNotFound(_0x85fd46,null))[_0x6d65('0x29')](function(_0xa7bdc8){if(_0xa7bdc8){_0x492ca4['body'][_0x6d65('0x71')]=_0xa7bdc8['id'];_0x492ca4[_0x6d65('0x51')]['attrs']=widgetAttributes(_0x492ca4[_0x6d65('0x51')]);return db[_0x6d65('0x72')][_0x6d65('0x50')](_0x492ca4[_0x6d65('0x51')]);}})['then'](respondWithResult(_0x85fd46,null))[_0x6d65('0x4c')](handleError(_0x85fd46,null));};exports['getItems']=function(_0x1c35ca,_0x54cca7,_0x314cab){var _0x21b944={};var _0x987fb1={};var _0x52d69f;var _0x31ec8e;return db[_0x6d65('0x32')]['findOne']({'where':{'id':_0x1c35ca[_0x6d65('0x4d')]['id']}})[_0x6d65('0x29')](handleEntityNotFound(_0x54cca7,null))[_0x6d65('0x29')](function(_0x28a761){if(_0x28a761){_0x52d69f=_0x28a761;_0x987fb1[_0x6d65('0x37')]=_['keys'](db[_0x6d65('0x72')]['rawAttributes']);_0x987fb1[_0x6d65('0x39')]=_[_0x6d65('0x4e')](_0x1c35ca['query']);_0x987fb1[_0x6d65('0x3a')]=_['intersection'](_0x987fb1[_0x6d65('0x37')],_0x987fb1[_0x6d65('0x39')]);_0x21b944['attributes']=_[_0x6d65('0x3b')](_0x987fb1[_0x6d65('0x37')],qs[_0x6d65('0x3d')](_0x1c35ca['query']['fields']));_0x21b944[_0x6d65('0x3c')]=_0x21b944[_0x6d65('0x3c')]['length']?_0x21b944[_0x6d65('0x3c')]:_0x987fb1[_0x6d65('0x37')];_0x21b944[_0x6d65('0x40')]=qs[_0x6d65('0x41')](_0x1c35ca['query'][_0x6d65('0x41')]);_0x21b944['where']=qs[_0x6d65('0x3a')](_['pick'](_0x1c35ca['query'],_0x987fb1[_0x6d65('0x3a')]));if(_0x1c35ca[_0x6d65('0x39')][_0x6d65('0x43')]){_0x21b944[_0x6d65('0x45')]=_[_0x6d65('0x44')](_0x21b944[_0x6d65('0x45')],{'$or':_[_0x6d65('0x38')](_0x21b944[_0x6d65('0x3c')],function(_0x4fe2c9){var _0x348c70={};_0x348c70[_0x4fe2c9]={'$like':'%'+_0x1c35ca[_0x6d65('0x39')][_0x6d65('0x43')]+'%'};return _0x348c70;})});}_0x21b944=_[_0x6d65('0x44')]({},_0x21b944,_0x1c35ca[_0x6d65('0x47')]);return _0x52d69f['getItems'](_0x21b944);}})[_0x6d65('0x29')](function(_0x20e83e){if(_0x20e83e){_0x31ec8e=_0x20e83e['length'];if(!_0x1c35ca[_0x6d65('0x39')]['hasOwnProperty'](_0x6d65('0x3f'))){_0x21b944[_0x6d65('0x22')]=qs[_0x6d65('0x22')](_0x1c35ca[_0x6d65('0x39')][_0x6d65('0x22')]);_0x21b944[_0x6d65('0x21')]=qs[_0x6d65('0x21')](_0x1c35ca[_0x6d65('0x39')][_0x6d65('0x21')]);}return _0x52d69f[_0x6d65('0x73')](_0x21b944);}})[_0x6d65('0x29')](function(_0x21f01d){if(_0x21f01d){return _0x21f01d?{'count':_0x31ec8e,'rows':_0x21f01d}:null;}})[_0x6d65('0x29')](respondWithResult(_0x54cca7,null))[_0x6d65('0x4c')](handleError(_0x54cca7,null));}; \ No newline at end of file +var _0x0f56=['includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','userProfileId','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','getItems','DashboardItem','eml-format','moment','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/license/hardware','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','show','params'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x0f56,0xa0));var _0x60f5=function(_0x3a44bd,_0x4da623){_0x3a44bd=_0x3a44bd-0x0;var _0x2977b1=_0x0f56[_0x3a44bd];return _0x2977b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x60f5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x60f5('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x60f5('0x2'));var util=require(_0x60f5('0x3'));var path=require(_0x60f5('0x4'));var sox=require(_0x60f5('0x5'));var csv=require('to-csv');var ejs=require(_0x60f5('0x6'));var fs=require('fs');var _=require(_0x60f5('0x7'));var squel=require(_0x60f5('0x8'));var crypto=require(_0x60f5('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x60f5('0xa'));var toCsv=require(_0x60f5('0xb'));var querystring=require(_0x60f5('0xc'));var Papa=require(_0x60f5('0xd'));var Redis=require(_0x60f5('0xe'));var authService=require(_0x60f5('0xf'));var qs=require(_0x60f5('0x10'));var as=require(_0x60f5('0x11'));var hardwareService=require(_0x60f5('0x12'));var logger=require('../../config/logger')(_0x60f5('0x13'));var utils=require(_0x60f5('0x14'));var config=require('../../config/environment');var db=require(_0x60f5('0x15'))['db'];config['redis']=_[_0x60f5('0x16')](config['redis'],{'host':_0x60f5('0x17'),'port':0x18eb});var socket=require(_0x60f5('0x18'))(new Redis(config[_0x60f5('0x19')]));require('./dashboard.socket')[_0x60f5('0x1a')](socket);function respondWithStatusCode(_0x270b1b,_0x2eabbf){_0x2eabbf=_0x2eabbf||0xcc;return function(_0x438b29){if(_0x438b29){return _0x270b1b[_0x60f5('0x1b')](_0x2eabbf);}return _0x270b1b['status'](_0x2eabbf)[_0x60f5('0x1c')]();};}function respondWithResult(_0x4fbcbb,_0x38f488){_0x38f488=_0x38f488||0xc8;return function(_0x411c20){if(_0x411c20){return _0x4fbcbb[_0x60f5('0x1d')](_0x38f488)['json'](_0x411c20);}};}function respondWithFilteredResult(_0x2e487c,_0x537173){return function(_0x30749a){if(_0x30749a){var _0x3056d8=_0x30749a[_0x60f5('0x1e')],_0x6e50b5=_0x537173[_0x60f5('0x1f')],_0x840fed=_0x537173['offset']+_0x537173[_0x60f5('0x20')],_0xbf11ad;if(_0x840fed>=_0x3056d8){_0x840fed=_0x3056d8;_0xbf11ad=0xc8;}else{_0xbf11ad=0xce;}_0x2e487c[_0x60f5('0x1d')](_0xbf11ad);return _0x2e487c[_0x60f5('0x21')](_0x60f5('0x22'),_0x6e50b5+'-'+_0x840fed+'/'+_0x3056d8)[_0x60f5('0x23')](_0x30749a);}return null;};}function patchUpdates(_0x2c4559){return function(_0x8329d){try{jsonpatch[_0x60f5('0x24')](_0x8329d,_0x2c4559,!![]);}catch(_0x3bb177){return BPromise[_0x60f5('0x25')](_0x3bb177);}return _0x8329d[_0x60f5('0x26')]();};}function saveUpdates(_0x8ed17,_0x1852b2){return function(_0x3f8524){if(_0x3f8524){return _0x3f8524[_0x60f5('0x27')](_0x8ed17)[_0x60f5('0x28')](function(_0x2246c4){return _0x2246c4;});}return null;};}function removeEntity(_0x22d0a3,_0x417520){return function(_0x430b81){if(_0x430b81){return _0x430b81['destroy']()[_0x60f5('0x28')](function(){var _0x18be99=_0x430b81[_0x60f5('0x29')]({'plain':!![]});var _0xcf15de='CustomDashboards';return db[_0x60f5('0x2a')][_0x60f5('0x2b')]({'where':{'type':_0xcf15de,'resourceId':_0x18be99['id']}})[_0x60f5('0x28')](function(){return _0x430b81;});})[_0x60f5('0x28')](function(){_0x22d0a3[_0x60f5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aefc9,_0x256f2a){return function(_0x1e3336){if(!_0x1e3336){_0x4aefc9['sendStatus'](0x194);}return _0x1e3336;};}function handleError(_0x535432,_0x3b0462){_0x3b0462=_0x3b0462||0x1f4;return function(_0x3e0b1e){logger[_0x60f5('0x2c')](_0x3e0b1e[_0x60f5('0x2d')]);if(_0x3e0b1e[_0x60f5('0x2e')]){delete _0x3e0b1e['name'];}_0x535432[_0x60f5('0x1d')](_0x3b0462)[_0x60f5('0x2f')](_0x3e0b1e);};}exports[_0x60f5('0x30')]=function(_0x41900e,_0x14e02d){var _0x165771={},_0x1b5c17={},_0x476fa8={'count':0x0,'rows':[]};var _0x3f9ebc=_[_0x60f5('0x31')](db[_0x60f5('0x32')][_0x60f5('0x33')],function(_0x3aa94c){return{'name':_0x3aa94c[_0x60f5('0x34')],'type':_0x3aa94c[_0x60f5('0x35')][_0x60f5('0x36')]};});_0x1b5c17[_0x60f5('0x37')]=_['map'](_0x3f9ebc,_0x60f5('0x2e'));_0x1b5c17['query']=_[_0x60f5('0x38')](_0x41900e['query']);_0x1b5c17[_0x60f5('0x39')]=_[_0x60f5('0x3a')](_0x1b5c17[_0x60f5('0x37')],_0x1b5c17['query']);_0x165771[_0x60f5('0x3b')]=_[_0x60f5('0x3a')](_0x1b5c17[_0x60f5('0x37')],qs[_0x60f5('0x3c')](_0x41900e[_0x60f5('0x3d')][_0x60f5('0x3c')]));_0x165771[_0x60f5('0x3b')]=_0x165771[_0x60f5('0x3b')][_0x60f5('0x3e')]?_0x165771[_0x60f5('0x3b')]:_0x1b5c17[_0x60f5('0x37')];if(!_0x41900e[_0x60f5('0x3d')][_0x60f5('0x3f')](_0x60f5('0x40'))){_0x165771[_0x60f5('0x20')]=qs[_0x60f5('0x20')](_0x41900e[_0x60f5('0x3d')][_0x60f5('0x20')]);_0x165771[_0x60f5('0x1f')]=qs[_0x60f5('0x1f')](_0x41900e[_0x60f5('0x3d')][_0x60f5('0x1f')]);}_0x165771[_0x60f5('0x41')]=qs[_0x60f5('0x42')](_0x41900e['query'][_0x60f5('0x42')]);_0x165771[_0x60f5('0x43')]=qs[_0x60f5('0x39')](_[_0x60f5('0x44')](_0x41900e[_0x60f5('0x3d')],_0x1b5c17[_0x60f5('0x39')]),_0x3f9ebc);if(_0x41900e[_0x60f5('0x3d')][_0x60f5('0x45')]){_0x165771[_0x60f5('0x43')]=_[_0x60f5('0x46')](_0x165771[_0x60f5('0x43')],{'$or':_[_0x60f5('0x31')](_0x3f9ebc,function(_0x5f02cf){if(_0x5f02cf[_0x60f5('0x35')]!=='VIRTUAL'){var _0x1ce6af={};_0x1ce6af[_0x5f02cf['name']]={'$like':'%'+_0x41900e[_0x60f5('0x3d')][_0x60f5('0x45')]+'%'};return _0x1ce6af;}})});}_0x165771=_[_0x60f5('0x46')]({},_0x165771,_0x41900e[_0x60f5('0x47')]);var _0x5e3971={'where':_0x165771[_0x60f5('0x43')]};return db['Dashboard'][_0x60f5('0x1e')](_0x5e3971)['then'](function(_0x31e829){_0x476fa8[_0x60f5('0x1e')]=_0x31e829;if(_0x41900e[_0x60f5('0x3d')]['includeAll']){_0x165771[_0x60f5('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0x60f5('0x49')](_0x165771);})['then'](function(_0x4c0e83){_0x476fa8['rows']=_0x4c0e83;return _0x476fa8;})[_0x60f5('0x28')](respondWithFilteredResult(_0x14e02d,_0x165771))['catch'](handleError(_0x14e02d,null));};exports[_0x60f5('0x4a')]=function(_0x260478,_0x140a85){var _0x8a433b={'raw':![],'where':{'id':_0x260478[_0x60f5('0x4b')]['id']}},_0x55f6f6={};_0x55f6f6['model']=_[_0x60f5('0x38')](db[_0x60f5('0x32')][_0x60f5('0x33')]);_0x55f6f6['query']=_[_0x60f5('0x38')](_0x260478[_0x60f5('0x3d')]);_0x55f6f6[_0x60f5('0x39')]=_[_0x60f5('0x3a')](_0x55f6f6['model'],_0x55f6f6['query']);_0x8a433b['attributes']=_[_0x60f5('0x3a')](_0x55f6f6[_0x60f5('0x37')],qs['fields'](_0x260478[_0x60f5('0x3d')][_0x60f5('0x3c')]));_0x8a433b[_0x60f5('0x3b')]=_0x8a433b[_0x60f5('0x3b')][_0x60f5('0x3e')]?_0x8a433b[_0x60f5('0x3b')]:_0x55f6f6[_0x60f5('0x37')];if(_0x260478['query'][_0x60f5('0x4c')]){_0x8a433b[_0x60f5('0x48')]=[{'all':!![]}];}_0x8a433b=_[_0x60f5('0x46')]({},_0x8a433b,_0x260478['options']);return db['Dashboard']['find'](_0x8a433b)[_0x60f5('0x28')](handleEntityNotFound(_0x140a85,null))[_0x60f5('0x28')](respondWithResult(_0x140a85,null))[_0x60f5('0x4d')](handleError(_0x140a85,null));};exports[_0x60f5('0x4e')]=function(_0x5b5b9d,_0x3b3596){return db[_0x60f5('0x32')]['create'](_0x5b5b9d[_0x60f5('0x4f')],{})[_0x60f5('0x28')](function(_0x13afe6){var _0x36cb37=_0x5b5b9d[_0x60f5('0x50')][_0x60f5('0x29')]({'plain':!![]});if(!_0x36cb37)throw new Error(_0x60f5('0x51'));if(_0x36cb37[_0x60f5('0x52')]==='user'){var _0x3f4fa9=_0x13afe6[_0x60f5('0x29')]({'plain':!![]});var _0x4a83c8=_0x60f5('0x53');return db[_0x60f5('0x54')][_0x60f5('0x55')]({'where':{'name':_0x4a83c8,'userProfileId':_0x36cb37['userProfileId']},'raw':!![]})[_0x60f5('0x28')](function(_0x4f2645){if(_0x4f2645&&_0x4f2645[_0x60f5('0x56')]===0x0){return db['UserProfileResource'][_0x60f5('0x4e')]({'name':_0x3f4fa9[_0x60f5('0x2e')],'resourceId':_0x3f4fa9['id'],'type':_0x4f2645['name'],'sectionId':_0x4f2645['id']},{})[_0x60f5('0x28')](function(){return _0x13afe6;});}else{return _0x13afe6;}})[_0x60f5('0x4d')](function(_0xc152ac){logger['error'](_0x60f5('0x57'),_0xc152ac);throw _0xc152ac;});}return _0x13afe6;})[_0x60f5('0x28')](respondWithResult(_0x3b3596,0xc9))[_0x60f5('0x4d')](handleError(_0x3b3596,null));};exports['clone']=function(_0x2e53cb,_0x254d5a){var _0x43814b={'where':{'id':_0x2e53cb[_0x60f5('0x4b')]['id']}},_0x3196cd={};_0x3196cd[_0x60f5('0x37')]=_['keys'](db[_0x60f5('0x32')][_0x60f5('0x33')]);_0x43814b[_0x60f5('0x3b')]=_[_0x60f5('0x3a')](_0x3196cd[_0x60f5('0x37')],qs[_0x60f5('0x3c')](_0x2e53cb[_0x60f5('0x3d')][_0x60f5('0x3c')]));_0x43814b['attributes']=_0x43814b['attributes']['length']?_0x43814b[_0x60f5('0x3b')]:_0x3196cd[_0x60f5('0x37')];if(_0x2e53cb[_0x60f5('0x3d')][_0x60f5('0x4c')]){_0x43814b[_0x60f5('0x48')]=[{'all':!![]}];}_0x43814b=_[_0x60f5('0x46')]({},_0x43814b,_0x2e53cb['options']);return db[_0x60f5('0x32')][_0x60f5('0x55')](_0x43814b)[_0x60f5('0x28')](handleEntityNotFound(_0x254d5a,null))[_0x60f5('0x28')](function(_0x4d3720){if(_0x4d3720){var _0x477ba3=_0x4d3720[_0x60f5('0x29')]({'plain':!![]});_0x477ba3=qs[_0x60f5('0x58')](_0x477ba3,['id','createdAt',_0x60f5('0x59')]);_0x2e53cb[_0x60f5('0x4f')]=_[_0x60f5('0x58')](_0x2e53cb['body'],['id','createdAt',_0x60f5('0x59')]);return db[_0x60f5('0x32')][_0x60f5('0x4e')](_[_0x60f5('0x46')](_0x477ba3,_0x2e53cb[_0x60f5('0x4f')]),{'include':_0x2e53cb['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x52648d){var _0xbc01a4=_0x2e53cb[_0x60f5('0x50')][_0x60f5('0x29')]({'plain':!![]});if(!_0xbc01a4)throw new Error(_0x60f5('0x51'));if(_0xbc01a4[_0x60f5('0x52')]===_0x60f5('0x50')){var _0x525490=_0x52648d[_0x60f5('0x29')]({'plain':!![]});var _0x57a6d6=_0x60f5('0x53');return db['UserProfileSection'][_0x60f5('0x55')]({'where':{'name':_0x57a6d6,'userProfileId':_0xbc01a4[_0x60f5('0x5a')]},'raw':!![]})[_0x60f5('0x28')](function(_0x130ba4){if(_0x130ba4&&_0x130ba4['autoAssociation']===0x0){return db[_0x60f5('0x2a')][_0x60f5('0x4e')]({'name':_0x525490[_0x60f5('0x2e')],'resourceId':_0x525490['id'],'type':_0x130ba4[_0x60f5('0x2e')],'sectionId':_0x130ba4['id']},{})[_0x60f5('0x28')](function(){return _0x52648d;});}else{return _0x52648d;}})[_0x60f5('0x4d')](function(_0x1feb0d){logger[_0x60f5('0x2c')](_0x60f5('0x57'),_0x1feb0d);throw _0x1feb0d;});}return _0x52648d;});}})[_0x60f5('0x28')](respondWithResult(_0x254d5a,0xc9))['catch'](handleError(_0x254d5a,null));};exports[_0x60f5('0x27')]=function(_0x5d09e1,_0x4a24dd){if(_0x5d09e1[_0x60f5('0x4f')]['id']){delete _0x5d09e1[_0x60f5('0x4f')]['id'];}return db[_0x60f5('0x32')][_0x60f5('0x55')]({'where':{'id':_0x5d09e1['params']['id']}})[_0x60f5('0x28')](handleEntityNotFound(_0x4a24dd,null))[_0x60f5('0x28')](saveUpdates(_0x5d09e1['body'],null))['then'](respondWithResult(_0x4a24dd,null))[_0x60f5('0x4d')](handleError(_0x4a24dd,null));};exports['destroy']=function(_0x3a27b7,_0x4f9a25){return db['Dashboard'][_0x60f5('0x55')]({'where':{'id':_0x3a27b7[_0x60f5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f9a25,null))[_0x60f5('0x28')](removeEntity(_0x4f9a25,null))['catch'](handleError(_0x4f9a25,null));};function widgetAttributes(_0x2b8cb0){try{switch(_0x2b8cb0[_0x60f5('0x35')]){case'iframe':return[{'name':_0x60f5('0x5b'),'value':_0x2b8cb0[_0x60f5('0x5b')]||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x0]?_0x2b8cb0['attrs'][0x0][_0x60f5('0x5d')]:undefined)||_0x60f5('0x5e')}];case _0x60f5('0x5f'):return[{'name':_0x60f5('0x60'),'value':_0x2b8cb0[_0x60f5('0x60')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0[_0x60f5('0x5c')][0x0]?_0x2b8cb0[_0x60f5('0x5c')][0x0][_0x60f5('0x5d')]:undefined)||''}];case _0x60f5('0x61'):return[{'name':_0x60f5('0x62'),'value':_0x2b8cb0['attrHourFormat']||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0['attrs'][0x0]?_0x2b8cb0[_0x60f5('0x5c')][0x0][_0x60f5('0x5d')]:undefined)||'HH:mm:ss'},{'name':_0x60f5('0x63'),'value':_0x2b8cb0[_0x60f5('0x63')]||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x1]?_0x2b8cb0[_0x60f5('0x5c')][0x1][_0x60f5('0x5d')]:undefined)||_0x60f5('0x64')},{'name':_0x60f5('0x65'),'value':_0x2b8cb0['attrFontSize']||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x2]?_0x2b8cb0[_0x60f5('0x5c')][0x2][_0x60f5('0x5d')]:undefined)||0xc}];case _0x60f5('0x66'):return[{'name':'attrMetric','value':_0x2b8cb0[_0x60f5('0x67')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0['attrs'][0x0]?_0x2b8cb0[_0x60f5('0x5c')][0x0][_0x60f5('0x5d')]:undefined)||_0x60f5('0x68')},{'name':_0x60f5('0x69'),'value':_0x2b8cb0['attrVoiceQueues']||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0[_0x60f5('0x5c')][0x1]?_0x2b8cb0['attrs'][0x1][_0x60f5('0x5d')]:undefined)||[]},{'name':'attrFontSize','value':_0x2b8cb0[_0x60f5('0x65')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0['attrs'][0x2]?_0x2b8cb0[_0x60f5('0x5c')][0x2][_0x60f5('0x5d')]:undefined)||0x14}];case _0x60f5('0x6a'):case _0x60f5('0x6b'):return[{'name':_0x60f5('0x6c'),'value':_0x2b8cb0[_0x60f5('0x6c')]||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x0]?_0x2b8cb0[_0x60f5('0x5c')][0x0][_0x60f5('0x5d')]:undefined)||_0x60f5('0x68')},{'name':_0x60f5('0x6d'),'value':_0x2b8cb0[_0x60f5('0x6d')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0[_0x60f5('0x5c')][0x1]?_0x2b8cb0[_0x60f5('0x5c')][0x1]['value']:undefined)||null},{'name':_0x60f5('0x6e'),'value':_0x2b8cb0[_0x60f5('0x6e')]||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x2]?_0x2b8cb0['attrs'][0x2][_0x60f5('0x5d')]:undefined)||null},{'name':_0x60f5('0x69'),'value':_0x2b8cb0[_0x60f5('0x69')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0['attrs'][0x3]?_0x2b8cb0[_0x60f5('0x5c')][0x3][_0x60f5('0x5d')]:undefined)||[]}];case'web-report':return[{'name':_0x60f5('0x6f'),'type':_0x2b8cb0['reportType']||(_0x2b8cb0['attrs']&&_0x2b8cb0[_0x60f5('0x5c')][0x0]?_0x2b8cb0[_0x60f5('0x5c')][0x0][_0x60f5('0x35')]:undefined)||null,'value':_0x2b8cb0[_0x60f5('0x6f')]||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0[_0x60f5('0x5c')][0x0]?_0x2b8cb0['attrs'][0x0][_0x60f5('0x5d')]:undefined)||null},{'name':_0x60f5('0x70'),'value':_0x2b8cb0['attrRefresh']||(_0x2b8cb0[_0x60f5('0x5c')]&&_0x2b8cb0['attrs'][0x1]?_0x2b8cb0['attrs'][0x1][_0x60f5('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x59a4b9){logger[_0x60f5('0x2c')](_0x60f5('0x71'),JSON[_0x60f5('0x72')](_0x59a4b9));return[];}}exports['addItem']=function(_0x2b3d31,_0x14b27d,_0x2c5744){if(_0x2b3d31[_0x60f5('0x4f')]['id']){delete _0x2b3d31[_0x60f5('0x4f')]['id'];}return db[_0x60f5('0x32')][_0x60f5('0x55')]({'where':{'id':_0x2b3d31['params']['id']}})[_0x60f5('0x28')](handleEntityNotFound(_0x14b27d,null))[_0x60f5('0x28')](function(_0x566c68){if(_0x566c68){_0x2b3d31[_0x60f5('0x4f')][_0x60f5('0x73')]=_0x566c68['id'];_0x2b3d31[_0x60f5('0x4f')][_0x60f5('0x5c')]=widgetAttributes(_0x2b3d31['body']);return db['DashboardItem'][_0x60f5('0x4e')](_0x2b3d31[_0x60f5('0x4f')]);}})[_0x60f5('0x28')](respondWithResult(_0x14b27d,null))[_0x60f5('0x4d')](handleError(_0x14b27d,null));};exports[_0x60f5('0x74')]=function(_0x3a6c2c,_0x54f067,_0x1eaa97){var _0x8e8356={};var _0x5b2765={};var _0x5ca030;var _0x243cfa;return db['Dashboard']['findOne']({'where':{'id':_0x3a6c2c[_0x60f5('0x4b')]['id']}})[_0x60f5('0x28')](handleEntityNotFound(_0x54f067,null))[_0x60f5('0x28')](function(_0x45595e){if(_0x45595e){_0x5ca030=_0x45595e;_0x5b2765[_0x60f5('0x37')]=_[_0x60f5('0x38')](db[_0x60f5('0x75')][_0x60f5('0x33')]);_0x5b2765[_0x60f5('0x3d')]=_[_0x60f5('0x38')](_0x3a6c2c[_0x60f5('0x3d')]);_0x5b2765[_0x60f5('0x39')]=_[_0x60f5('0x3a')](_0x5b2765[_0x60f5('0x37')],_0x5b2765[_0x60f5('0x3d')]);_0x8e8356[_0x60f5('0x3b')]=_[_0x60f5('0x3a')](_0x5b2765[_0x60f5('0x37')],qs['fields'](_0x3a6c2c[_0x60f5('0x3d')]['fields']));_0x8e8356[_0x60f5('0x3b')]=_0x8e8356['attributes'][_0x60f5('0x3e')]?_0x8e8356[_0x60f5('0x3b')]:_0x5b2765[_0x60f5('0x37')];_0x8e8356['order']=qs['sort'](_0x3a6c2c[_0x60f5('0x3d')][_0x60f5('0x42')]);_0x8e8356[_0x60f5('0x43')]=qs[_0x60f5('0x39')](_[_0x60f5('0x44')](_0x3a6c2c[_0x60f5('0x3d')],_0x5b2765[_0x60f5('0x39')]));if(_0x3a6c2c[_0x60f5('0x3d')][_0x60f5('0x45')]){_0x8e8356[_0x60f5('0x43')]=_['merge'](_0x8e8356['where'],{'$or':_[_0x60f5('0x31')](_0x8e8356['attributes'],function(_0x129282){var _0x1eb5da={};_0x1eb5da[_0x129282]={'$like':'%'+_0x3a6c2c[_0x60f5('0x3d')][_0x60f5('0x45')]+'%'};return _0x1eb5da;})});}_0x8e8356=_[_0x60f5('0x46')]({},_0x8e8356,_0x3a6c2c[_0x60f5('0x47')]);return _0x5ca030[_0x60f5('0x74')](_0x8e8356);}})['then'](function(_0x39e163){if(_0x39e163){_0x243cfa=_0x39e163['length'];if(!_0x3a6c2c[_0x60f5('0x3d')]['hasOwnProperty']('nolimit')){_0x8e8356[_0x60f5('0x20')]=qs[_0x60f5('0x20')](_0x3a6c2c[_0x60f5('0x3d')][_0x60f5('0x20')]);_0x8e8356[_0x60f5('0x1f')]=qs[_0x60f5('0x1f')](_0x3a6c2c[_0x60f5('0x3d')]['offset']);}return _0x5ca030[_0x60f5('0x74')](_0x8e8356);}})[_0x60f5('0x28')](function(_0x16cc26){if(_0x16cc26){return _0x16cc26?{'count':_0x243cfa,'rows':_0x16cc26}:null;}})[_0x60f5('0x28')](respondWithResult(_0x54f067,null))['catch'](handleError(_0x54f067,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 5e19748..b569c0d 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 _0x1b36=['remove','hasOwnProperty','hook','events','Dashboard','setMaxListeners','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1b36,0x163));var _0x61b3=function(_0x204e4f,_0x267345){_0x204e4f=_0x204e4f-0x0;var _0x204189=_0x1b36[_0x204e4f];return _0x204189;};'use strict';var EventEmitter=require(_0x61b3('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x61b3('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x61b3('0x2')](0x0);var events={'afterCreate':_0x61b3('0x3'),'afterUpdate':_0x61b3('0x4'),'afterDestroy':_0x61b3('0x5')};function emitEvent(_0x1ff221){return function(_0xcf1736,_0x53ebb0,_0x16a467){DashboardEvents['emit'](_0x1ff221+':'+_0xcf1736['id'],_0xcf1736);DashboardEvents['emit'](_0x1ff221,_0xcf1736);_0x16a467(null);};}for(var e in events){if(events[_0x61b3('0x6')](e)){var event=events[e];Dashboard[_0x61b3('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xb550=['hook','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb550,0x19f));var _0x0b55=function(_0x2aa3bc,_0x2b10a3){_0x2aa3bc=_0x2aa3bc-0x0;var _0x1e3039=_0xb550[_0x2aa3bc];return _0x1e3039;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x0b55('0x0'))['db'][_0x0b55('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0b55('0x2')](0x0);var events={'afterCreate':_0x0b55('0x3'),'afterUpdate':_0x0b55('0x4'),'afterDestroy':_0x0b55('0x5')};function emitEvent(_0x471714){return function(_0x492c82,_0x271ef6,_0x2e341c){DashboardEvents[_0x0b55('0x6')](_0x471714+':'+_0x492c82['id'],_0x492c82);DashboardEvents['emit'](_0x471714,_0x492c82);_0x2e341c(null);};}for(var e in events){if(events[_0x0b55('0x7')](e)){var event=events[e];Dashboard[_0x0b55('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a65b95b..331309b 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 _0x18d1=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./dashboard.attributes','exports','Dashboard'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x18d1,0xbe));var _0x118d=function(_0x191794,_0x312278){_0x191794=_0x191794-0x0;var _0x26ae9a=_0x18d1[_0x191794];return _0x26ae9a;};'use strict';var _=require(_0x118d('0x0'));var util=require('util');var logger=require(_0x118d('0x1'))(_0x118d('0x2'));var moment=require(_0x118d('0x3'));var BPromise=require(_0x118d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x118d('0x5'));var rimraf=require('rimraf');var config=require(_0x118d('0x6'));var attributes=require(_0x118d('0x7'));module[_0x118d('0x8')]=function(_0x5adf98,_0x2b59e5){return _0x5adf98['define'](_0x118d('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5521=['request-promise','path','../../config/environment','./dashboard.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x5521,0x119));var _0x1552=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5521[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x1552('0x0'));var util=require(_0x1552('0x1'));var logger=require(_0x1552('0x2'))(_0x1552('0x3'));var moment=require(_0x1552('0x4'));var BPromise=require('bluebird');var rp=require(_0x1552('0x5'));var fs=require('fs');var path=require(_0x1552('0x6'));var rimraf=require('rimraf');var config=require(_0x1552('0x7'));var attributes=require(_0x1552('0x8'));module[_0x1552('0x9')]=function(_0x467a2c,_0x19ca18){return _0x467a2c[_0x1552('0xa')]('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 c46741c..ee88d7f 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 _0xe5b1=['info','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','request','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s'];(function(_0x372fe0,_0x17716b){var _0x4eebd2=function(_0xee7acb){while(--_0xee7acb){_0x372fe0['push'](_0x372fe0['shift']());}};_0x4eebd2(++_0x17716b);}(_0xe5b1,0x1ab));var _0x1e5b=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0xe5b1[_0x36d203];return _0x2f9e62;};'use strict';var _=require(_0x1e5b('0x0'));var util=require(_0x1e5b('0x1'));var moment=require(_0x1e5b('0x2'));var BPromise=require(_0x1e5b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1e5b('0x5'))(_0x1e5b('0x6'));var config=require('../../config/environment');var jayson=require(_0x1e5b('0x7'));var client=jayson[_0x1e5b('0x8')]['http']({'port':0x232a});config[_0x1e5b('0x9')]=_[_0x1e5b('0xa')](config[_0x1e5b('0x9')],{'host':_0x1e5b('0xb'),'port':0x18eb});var socket=require(_0x1e5b('0xc'))(new Redis(config[_0x1e5b('0x9')]));require(_0x1e5b('0xd'))['register'](socket);function respondWithRpcPromise(_0x22dddd,_0x38e414,_0x34efe1){return new BPromise(function(_0x5cbc53,_0x1873b5){return client[_0x1e5b('0xe')](_0x22dddd,_0x34efe1)[_0x1e5b('0xf')](function(_0x1df7e0){logger['info']('Dashboard,\x20%s,\x20%s',_0x38e414,_0x1e5b('0x10'));logger[_0x1e5b('0x11')](_0x1e5b('0x12'),_0x38e414,_0x1e5b('0x10'),JSON['stringify'](_0x1df7e0));if(_0x1df7e0[_0x1e5b('0x13')]){if(_0x1df7e0[_0x1e5b('0x13')][_0x1e5b('0x14')]===0x1f4){logger[_0x1e5b('0x13')]('Dashboard,\x20%s,\x20%s',_0x38e414,_0x1df7e0[_0x1e5b('0x13')][_0x1e5b('0x15')]);return _0x1873b5(_0x1df7e0[_0x1e5b('0x13')][_0x1e5b('0x15')]);}logger[_0x1e5b('0x13')](_0x1e5b('0x16'),_0x38e414,_0x1df7e0[_0x1e5b('0x13')][_0x1e5b('0x15')]);return _0x5cbc53(_0x1df7e0[_0x1e5b('0x13')][_0x1e5b('0x15')]);}else{logger[_0x1e5b('0x17')](_0x1e5b('0x16'),_0x38e414,_0x1e5b('0x10'));_0x5cbc53(_0x1df7e0['result']['message']);}})[_0x1e5b('0x18')](function(_0x8d4581){logger[_0x1e5b('0x13')](_0x1e5b('0x16'),_0x38e414,_0x8d4581);_0x1873b5(_0x8d4581);});});} \ No newline at end of file +var _0xdd73=['stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x39b92f,_0x55efae){var _0x2779b0=function(_0x160b9b){while(--_0x160b9b){_0x39b92f['push'](_0x39b92f['shift']());}};_0x2779b0(++_0x55efae);}(_0xdd73,0x14a));var _0x3dd7=function(_0x5aef12,_0x1edd9d){_0x5aef12=_0x5aef12-0x0;var _0x245089=_0xdd73[_0x5aef12];return _0x245089;};'use strict';var _=require(_0x3dd7('0x0'));var util=require(_0x3dd7('0x1'));var moment=require(_0x3dd7('0x2'));var BPromise=require('bluebird');var rs=require(_0x3dd7('0x3'));var fs=require('fs');var Redis=require(_0x3dd7('0x4'));var db=require(_0x3dd7('0x5'))['db'];var utils=require(_0x3dd7('0x6'));var logger=require('../../config/logger')(_0x3dd7('0x7'));var config=require(_0x3dd7('0x8'));var jayson=require(_0x3dd7('0x9'));var client=jayson[_0x3dd7('0xa')][_0x3dd7('0xb')]({'port':0x232a});config[_0x3dd7('0xc')]=_[_0x3dd7('0xd')](config[_0x3dd7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3dd7('0xe'))(new Redis(config[_0x3dd7('0xc')]));require(_0x3dd7('0xf'))[_0x3dd7('0x10')](socket);function respondWithRpcPromise(_0x416f50,_0xe3c5f7,_0xeae21){return new BPromise(function(_0xa4c1e1,_0x288461){return client[_0x3dd7('0x11')](_0x416f50,_0xeae21)[_0x3dd7('0x12')](function(_0x4de9cb){logger['info'](_0x3dd7('0x13'),_0xe3c5f7,_0x3dd7('0x14'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0xe3c5f7,_0x3dd7('0x14'),JSON[_0x3dd7('0x15')](_0x4de9cb));if(_0x4de9cb[_0x3dd7('0x16')]){if(_0x4de9cb[_0x3dd7('0x16')]['code']===0x1f4){logger[_0x3dd7('0x16')](_0x3dd7('0x13'),_0xe3c5f7,_0x4de9cb[_0x3dd7('0x16')][_0x3dd7('0x17')]);return _0x288461(_0x4de9cb[_0x3dd7('0x16')][_0x3dd7('0x17')]);}logger[_0x3dd7('0x16')](_0x3dd7('0x13'),_0xe3c5f7,_0x4de9cb[_0x3dd7('0x16')][_0x3dd7('0x17')]);return _0xa4c1e1(_0x4de9cb[_0x3dd7('0x16')][_0x3dd7('0x17')]);}else{logger[_0x3dd7('0x18')](_0x3dd7('0x13'),_0xe3c5f7,'request\x20sent');_0xa4c1e1(_0x4de9cb[_0x3dd7('0x19')][_0x3dd7('0x17')]);}})[_0x3dd7('0x1a')](function(_0x17c3db){logger[_0x3dd7('0x16')]('Dashboard,\x20%s,\x20%s',_0xe3c5f7,_0x17c3db);_0x288461(_0x17c3db);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a7cf433..ed2c102 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 _0xb32d=['emit','removeListener','length','save','remove','update'];(function(_0x2616cf,_0x5262d6){var _0x15f198=function(_0xa830f9){while(--_0xa830f9){_0x2616cf['push'](_0x2616cf['shift']());}};_0x15f198(++_0x5262d6);}(_0xb32d,0x10b));var _0xdb32=function(_0x2fc960,_0x5219db){_0x2fc960=_0x2fc960-0x0;var _0x3072a7=_0xb32d[_0x2fc960];return _0x3072a7;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xdb32('0x0'),_0xdb32('0x1'),_0xdb32('0x2')];function createListener(_0x2fdccb,_0x17d6b8){return function(_0x37c075){_0x17d6b8[_0xdb32('0x3')](_0x2fdccb,_0x37c075);};}function removeListener(_0x5baf8e,_0x2a8b2a){return function(){DashboardEvents[_0xdb32('0x4')](_0x5baf8e,_0x2a8b2a);};}exports['register']=function(_0xe774d8){for(var _0x4f7c5e=0x0,_0x54ca55=events[_0xdb32('0x5')];_0x4f7c5e<_0x54ca55;_0x4f7c5e++){var _0x25b3cd=events[_0x4f7c5e];var _0x450a81=createListener('dashboard:'+_0x25b3cd,_0xe774d8);DashboardEvents['on'](_0x25b3cd,_0x450a81);}}; \ No newline at end of file +var _0x8ab0=['length','./dashboard.events','save','remove','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8ab0,0x199));var _0x08ab=function(_0x234590,_0x36fd2a){_0x234590=_0x234590-0x0;var _0x49b3ef=_0x8ab0[_0x234590];return _0x49b3ef;};'use strict';var DashboardEvents=require(_0x08ab('0x0'));var events=[_0x08ab('0x1'),_0x08ab('0x2'),_0x08ab('0x3')];function createListener(_0x3e3721,_0x57cd4a){return function(_0x20908c){_0x57cd4a[_0x08ab('0x4')](_0x3e3721,_0x20908c);};}function removeListener(_0x21d3ca,_0x568be9){return function(){DashboardEvents['removeListener'](_0x21d3ca,_0x568be9);};}exports['register']=function(_0x1f1b88){for(var _0x4294a0=0x0,_0x143b63=events[_0x08ab('0x5')];_0x4294a0<_0x143b63;_0x4294a0++){var _0x37653d=events[_0x4294a0];var _0x34e784=createListener('dashboard:'+_0x37653d,_0x1f1b88);DashboardEvents['on'](_0x37653d,_0x34e784);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 8e87f29..86889a6 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x26c5e0,_0x4b9506){var _0x2c9cd4=function(_0x53ac57){while(--_0x53ac57){_0x26c5e0['push'](_0x26c5e0['shift']());}};_0x2c9cd4(++_0x4b9506);}(_0x70e0,0x17b));var _0x070e=function(_0x2f1a0b,_0x392b73){_0x2f1a0b=_0x2f1a0b-0x0;var _0x5de58d=_0x70e0[_0x2f1a0b];return _0x5de58d;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb7e7[_0x1a36a5];return _0x746243;};'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['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 7f49d71..54367b2 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 _0xa7fa=['stringify','INTEGER','#2196f3','sequelize','squel','lodash','STRING','TEXT','long','parse','attrs','setDataValue'];(function(_0x107da6,_0x489d04){var _0x46a74c=function(_0xd1b620){while(--_0xd1b620){_0x107da6['push'](_0x107da6['shift']());}};_0x46a74c(++_0x489d04);}(_0xa7fa,0x117));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaa7f('0x0'));var squel=require(_0xaa7f('0x1'));var _=require(_0xaa7f('0x2'));module['exports']={'title':{'type':Sequelize[_0xaa7f('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xaa7f('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xaa7f('0x4')](_0xaa7f('0x5')),'get':function(){try{return JSON[_0xaa7f('0x6')](this['getDataValue'](_0xaa7f('0x7')));}catch(_0x500f73){return[];}},'set':function(_0x3104f0){try{this[_0xaa7f('0x8')]('attrs',JSON[_0xaa7f('0x9')](_0x3104f0));}catch(_0x1618b5){this['setDataValue'](_0xaa7f('0x7'),JSON[_0xaa7f('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xaa7f('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xaa7f('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xaa7f('0xa')]},'background':{'type':Sequelize[_0xaa7f('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xaa7f('0x3')],'allowNull':![],'defaultValue':_0xaa7f('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xaa7f('0x3')]}}; \ No newline at end of file +var _0x7ad1=['STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7ad1,0x129));var _0x17ad=function(_0x3137f2,_0x3ab52d){_0x3137f2=_0x3137f2-0x0;var _0x4221a8=_0x7ad1[_0x3137f2];return _0x4221a8;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x17ad('0x0'));var _=require('lodash');module[_0x17ad('0x1')]={'title':{'type':Sequelize[_0x17ad('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x17ad('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x17ad('0x3')](_0x17ad('0x4')),'get':function(){try{return JSON[_0x17ad('0x5')](this[_0x17ad('0x6')](_0x17ad('0x7')));}catch(_0x3ab42f){return[];}},'set':function(_0x30f202){try{this[_0x17ad('0x8')](_0x17ad('0x7'),JSON[_0x17ad('0x9')](_0x30f202));}catch(_0x152092){this[_0x17ad('0x8')](_0x17ad('0x7'),JSON[_0x17ad('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x17ad('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x17ad('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x17ad('0xa')]},'col':{'type':Sequelize[_0x17ad('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x17ad('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x17ad('0x2')],'allowNull':![],'defaultValue':_0x17ad('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index dc23a7c..7e86321 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 _0x3a90=['DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','include','options','find','catch','type','iframe','attrs','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','value','counter','total','attrVoiceQueues','attrFontSize','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','show','params','model','keys'];(function(_0x1541ad,_0x3f3311){var _0x330800=function(_0x4d874f){while(--_0x4d874f){_0x1541ad['push'](_0x1541ad['shift']());}};_0x330800(++_0x3f3311);}(_0x3a90,0x133));var _0x03a9=function(_0x2dc1ca,_0xbcf14b){_0x2dc1ca=_0x2dc1ca-0x0;var _0x18b53f=_0x3a90[_0x2dc1ca];return _0x18b53f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x03a9('0x0'));var rimraf=require(_0x03a9('0x1'));var zipdir=require(_0x03a9('0x2'));var jsonpatch=require(_0x03a9('0x3'));var rp=require(_0x03a9('0x4'));var moment=require(_0x03a9('0x5'));var BPromise=require(_0x03a9('0x6'));var Mustache=require(_0x03a9('0x7'));var util=require(_0x03a9('0x8'));var path=require(_0x03a9('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x03a9('0xa'));var fs=require('fs');var _=require(_0x03a9('0xb'));var squel=require(_0x03a9('0xc'));var crypto=require(_0x03a9('0xd'));var jsforce=require(_0x03a9('0xe'));var deskjs=require(_0x03a9('0xf'));var toCsv=require(_0x03a9('0x10'));var querystring=require(_0x03a9('0x11'));var Papa=require(_0x03a9('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x03a9('0x13'));var as=require(_0x03a9('0x14'));var hardwareService=require(_0x03a9('0x15'));var logger=require(_0x03a9('0x16'))(_0x03a9('0x17'));var utils=require(_0x03a9('0x18'));var config=require(_0x03a9('0x19'));var db=require(_0x03a9('0x1a'))['db'];config[_0x03a9('0x1b')]=_[_0x03a9('0x1c')](config[_0x03a9('0x1b')],{'host':_0x03a9('0x1d'),'port':0x18eb});var socket=require(_0x03a9('0x1e'))(new Redis(config[_0x03a9('0x1b')]));require(_0x03a9('0x1f'))[_0x03a9('0x20')](socket);function respondWithStatusCode(_0x250838,_0xdd705c){_0xdd705c=_0xdd705c||0xcc;return function(_0x117b5c){if(_0x117b5c){return _0x250838['sendStatus'](_0xdd705c);}return _0x250838['status'](_0xdd705c)['end']();};}function respondWithResult(_0x27395a,_0x330a14){_0x330a14=_0x330a14||0xc8;return function(_0xf5c721){if(_0xf5c721){return _0x27395a[_0x03a9('0x21')](_0x330a14)[_0x03a9('0x22')](_0xf5c721);}};}function respondWithFilteredResult(_0x5b8173,_0x3f9c3a){return function(_0x278d38){if(_0x278d38){var _0x17bbf0=_0x278d38[_0x03a9('0x23')],_0x23a831=_0x3f9c3a[_0x03a9('0x24')],_0x59b999=_0x3f9c3a[_0x03a9('0x24')]+_0x3f9c3a[_0x03a9('0x25')],_0x46b0e5;if(_0x59b999>=_0x17bbf0){_0x59b999=_0x17bbf0;_0x46b0e5=0xc8;}else{_0x46b0e5=0xce;}_0x5b8173['status'](_0x46b0e5);return _0x5b8173[_0x03a9('0x26')](_0x03a9('0x27'),_0x23a831+'-'+_0x59b999+'/'+_0x17bbf0)[_0x03a9('0x22')](_0x278d38);}return null;};}function patchUpdates(_0x23206c){return function(_0x2d03f0){try{jsonpatch['apply'](_0x2d03f0,_0x23206c,!![]);}catch(_0x12de91){return BPromise[_0x03a9('0x28')](_0x12de91);}return _0x2d03f0['save']();};}function saveUpdates(_0x14dd1e,_0x369744){return function(_0x14daaf){if(_0x14daaf){return _0x14daaf[_0x03a9('0x29')](_0x14dd1e)[_0x03a9('0x2a')](function(_0x1dca28){return _0x1dca28;});}return null;};}function removeEntity(_0x3f0d04,_0x4c1610){return function(_0x342576){if(_0x342576){return _0x342576[_0x03a9('0x2b')]()[_0x03a9('0x2a')](function(){_0x3f0d04[_0x03a9('0x21')](0xcc)[_0x03a9('0x2c')]();});}};}function handleEntityNotFound(_0x34c093,_0x5cb342){return function(_0x3f0186){if(!_0x3f0186){_0x34c093['sendStatus'](0x194);}return _0x3f0186;};}function handleError(_0x393698,_0xbb081b){_0xbb081b=_0xbb081b||0x1f4;return function(_0x487b7f){logger[_0x03a9('0x2d')](_0x487b7f[_0x03a9('0x2e')]);if(_0x487b7f[_0x03a9('0x2f')]){delete _0x487b7f[_0x03a9('0x2f')];}_0x393698['status'](_0xbb081b)[_0x03a9('0x30')](_0x487b7f);};}exports[_0x03a9('0x31')]=function(_0x1db68f,_0x111656){var _0x26a5ff={'raw':![],'where':{'id':_0x1db68f[_0x03a9('0x32')]['id']}},_0x345e0c={};_0x345e0c[_0x03a9('0x33')]=_[_0x03a9('0x34')](db[_0x03a9('0x35')][_0x03a9('0x36')]);_0x345e0c[_0x03a9('0x37')]=_[_0x03a9('0x34')](_0x1db68f[_0x03a9('0x37')]);_0x345e0c[_0x03a9('0x38')]=_[_0x03a9('0x39')](_0x345e0c['model'],_0x345e0c[_0x03a9('0x37')]);_0x26a5ff['attributes']=_[_0x03a9('0x39')](_0x345e0c[_0x03a9('0x33')],qs[_0x03a9('0x3a')](_0x1db68f[_0x03a9('0x37')][_0x03a9('0x3a')]));_0x26a5ff[_0x03a9('0x3b')]=_0x26a5ff[_0x03a9('0x3b')][_0x03a9('0x3c')]?_0x26a5ff['attributes']:_0x345e0c['model'];if(_0x1db68f[_0x03a9('0x37')]['includeAll']){_0x26a5ff[_0x03a9('0x3d')]=[{'all':!![]}];}_0x26a5ff=_['merge']({},_0x26a5ff,_0x1db68f[_0x03a9('0x3e')]);return db[_0x03a9('0x35')][_0x03a9('0x3f')](_0x26a5ff)['then'](handleEntityNotFound(_0x111656,null))[_0x03a9('0x2a')](respondWithResult(_0x111656,null))[_0x03a9('0x40')](handleError(_0x111656,null));};exports[_0x03a9('0x2b')]=function(_0x4ada12,_0x3e607b){return db[_0x03a9('0x35')]['find']({'where':{'id':_0x4ada12[_0x03a9('0x32')]['id']}})['then'](handleEntityNotFound(_0x3e607b,null))[_0x03a9('0x2a')](removeEntity(_0x3e607b,null))[_0x03a9('0x40')](handleError(_0x3e607b,null));};function widgetAttributes(_0x160824){try{switch(_0x160824[_0x03a9('0x41')]){case _0x03a9('0x42'):return[{'name':'attrUrl','value':_0x160824['attrUrl']||(_0x160824[_0x03a9('0x43')]&&_0x160824[_0x03a9('0x43')][0x0]?_0x160824[_0x03a9('0x43')][0x0]['value']:undefined)||'https://'}];case _0x03a9('0x44'):return[{'name':_0x03a9('0x45'),'value':_0x160824[_0x03a9('0x45')]||(_0x160824[_0x03a9('0x43')]&&_0x160824[_0x03a9('0x43')][0x0]?_0x160824[_0x03a9('0x43')][0x0]['value']:undefined)||''}];case _0x03a9('0x46'):return[{'name':_0x03a9('0x47'),'value':_0x160824[_0x03a9('0x47')]||(_0x160824[_0x03a9('0x43')]&&_0x160824[_0x03a9('0x43')][0x0]?_0x160824[_0x03a9('0x43')][0x0]['value']:undefined)||_0x03a9('0x48')},{'name':_0x03a9('0x49'),'value':_0x160824['attrTimezone']||(_0x160824[_0x03a9('0x43')]&&_0x160824['attrs'][0x1]?_0x160824['attrs'][0x1][_0x03a9('0x4a')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x160824['attrFontSize']||(_0x160824[_0x03a9('0x43')]&&_0x160824['attrs'][0x2]?_0x160824[_0x03a9('0x43')][0x2][_0x03a9('0x4a')]:undefined)||0xc}];case _0x03a9('0x4b'):return[{'name':'attrMetric','value':_0x160824['attrMetric']||(_0x160824[_0x03a9('0x43')]&&_0x160824[_0x03a9('0x43')][0x0]?_0x160824['attrs'][0x0][_0x03a9('0x4a')]:undefined)||_0x03a9('0x4c')},{'name':'attrVoiceQueues','value':_0x160824[_0x03a9('0x4d')]||(_0x160824[_0x03a9('0x43')]&&_0x160824[_0x03a9('0x43')][0x1]?_0x160824[_0x03a9('0x43')][0x1]['value']:undefined)||[]},{'name':_0x03a9('0x4e'),'value':_0x160824['attrFontSize']||(_0x160824['attrs']&&_0x160824['attrs'][0x2]?_0x160824[_0x03a9('0x43')][0x2][_0x03a9('0x4a')]:undefined)||0x14}];case'multibar-chart':case _0x03a9('0x4f'):return[{'name':_0x03a9('0x50'),'value':_0x160824['attrSerie1']||(_0x160824[_0x03a9('0x43')]&&_0x160824[_0x03a9('0x43')][0x0]?_0x160824[_0x03a9('0x43')][0x0][_0x03a9('0x4a')]:undefined)||_0x03a9('0x4c')},{'name':_0x03a9('0x51'),'value':_0x160824['attrSerie2']||(_0x160824[_0x03a9('0x43')]&&_0x160824[_0x03a9('0x43')][0x1]?_0x160824['attrs'][0x1]['value']:undefined)||null},{'name':_0x03a9('0x52'),'value':_0x160824[_0x03a9('0x52')]||(_0x160824[_0x03a9('0x43')]&&_0x160824['attrs'][0x2]?_0x160824['attrs'][0x2]['value']:undefined)||null},{'name':_0x03a9('0x4d'),'value':_0x160824[_0x03a9('0x4d')]||(_0x160824[_0x03a9('0x43')]&&_0x160824[_0x03a9('0x43')][0x3]?_0x160824['attrs'][0x3][_0x03a9('0x4a')]:undefined)||[]}];case'web-report':return[{'name':_0x03a9('0x53'),'type':_0x160824[_0x03a9('0x54')]||(_0x160824[_0x03a9('0x43')]&&_0x160824[_0x03a9('0x43')][0x0]?_0x160824[_0x03a9('0x43')][0x0]['type']:undefined)||null,'value':_0x160824[_0x03a9('0x53')]||(_0x160824[_0x03a9('0x43')]&&_0x160824[_0x03a9('0x43')][0x0]?_0x160824['attrs'][0x0][_0x03a9('0x4a')]:undefined)||null},{'name':_0x03a9('0x55'),'value':_0x160824[_0x03a9('0x55')]||(_0x160824[_0x03a9('0x43')]&&_0x160824[_0x03a9('0x43')][0x1]?_0x160824['attrs'][0x1][_0x03a9('0x4a')]:undefined)||0x0}];default:return[];}}catch(_0x338af6){logger['error'](_0x03a9('0x56'),JSON[_0x03a9('0x57')](_0x338af6));return[];}}exports[_0x03a9('0x58')]=function(_0x14c0d6,_0x485f69){if(_0x14c0d6[_0x03a9('0x59')]){_0x14c0d6['body'][_0x03a9('0x43')]=widgetAttributes(_0x14c0d6['body']);}return db['DashboardItem'][_0x03a9('0x58')](_0x14c0d6[_0x03a9('0x59')],{})[_0x03a9('0x2a')](respondWithResult(_0x485f69,0xc9))['catch'](handleError(_0x485f69,null));};exports['update']=function(_0x1e8353,_0x211c7a){if(_0x1e8353[_0x03a9('0x59')]['id']){delete _0x1e8353[_0x03a9('0x59')]['id'];}_0x1e8353[_0x03a9('0x59')][_0x03a9('0x43')]=widgetAttributes(_0x1e8353[_0x03a9('0x59')]);return db[_0x03a9('0x35')][_0x03a9('0x3f')]({'where':{'id':_0x1e8353[_0x03a9('0x32')]['id']}})[_0x03a9('0x2a')](handleEntityNotFound(_0x211c7a,null))['then'](saveUpdates(_0x1e8353[_0x03a9('0x59')],null))[_0x03a9('0x2a')](respondWithResult(_0x211c7a,null))['catch'](handleError(_0x211c7a,null));}; \ No newline at end of file +var _0xa1ee=['socket.io-emitter','./dashboardItem.socket','register','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','show','model','keys','DashboardItem','query','filters','intersection','attributes','fields','length','includeAll','options','find','catch','params','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','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','localhost'];(function(_0x4fd82a,_0x29d9d5){var _0x21d2a8=function(_0x11f85f){while(--_0x11f85f){_0x4fd82a['push'](_0x4fd82a['shift']());}};_0x21d2a8(++_0x29d9d5);}(_0xa1ee,0xf2));var _0xea1e=function(_0x46d87a,_0x5183db){_0x46d87a=_0x46d87a-0x0;var _0x115296=_0xa1ee[_0x46d87a];return _0x115296;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xea1e('0x0'));var rimraf=require(_0xea1e('0x1'));var zipdir=require(_0xea1e('0x2'));var jsonpatch=require(_0xea1e('0x3'));var rp=require(_0xea1e('0x4'));var moment=require(_0xea1e('0x5'));var BPromise=require(_0xea1e('0x6'));var Mustache=require(_0xea1e('0x7'));var util=require(_0xea1e('0x8'));var path=require(_0xea1e('0x9'));var sox=require('sox');var csv=require(_0xea1e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xea1e('0xb'));var squel=require('squel');var crypto=require(_0xea1e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xea1e('0xd'));var toCsv=require(_0xea1e('0xa'));var querystring=require(_0xea1e('0xe'));var Papa=require(_0xea1e('0xf'));var Redis=require(_0xea1e('0x10'));var authService=require(_0xea1e('0x11'));var qs=require(_0xea1e('0x12'));var as=require(_0xea1e('0x13'));var hardwareService=require(_0xea1e('0x14'));var logger=require(_0xea1e('0x15'))(_0xea1e('0x16'));var utils=require(_0xea1e('0x17'));var config=require(_0xea1e('0x18'));var db=require(_0xea1e('0x19'))['db'];config[_0xea1e('0x1a')]=_['defaults'](config['redis'],{'host':_0xea1e('0x1b'),'port':0x18eb});var socket=require(_0xea1e('0x1c'))(new Redis(config['redis']));require(_0xea1e('0x1d'))[_0xea1e('0x1e')](socket);function respondWithStatusCode(_0x98bfe8,_0x4b8641){_0x4b8641=_0x4b8641||0xcc;return function(_0x5c705f){if(_0x5c705f){return _0x98bfe8['sendStatus'](_0x4b8641);}return _0x98bfe8[_0xea1e('0x1f')](_0x4b8641)[_0xea1e('0x20')]();};}function respondWithResult(_0xf12c69,_0xb9d9ea){_0xb9d9ea=_0xb9d9ea||0xc8;return function(_0x50aba3){if(_0x50aba3){return _0xf12c69[_0xea1e('0x1f')](_0xb9d9ea)['json'](_0x50aba3);}};}function respondWithFilteredResult(_0x493e44,_0x41fda9){return function(_0x54cda1){if(_0x54cda1){var _0x5d6891=_0x54cda1[_0xea1e('0x21')],_0x1cc5dc=_0x41fda9[_0xea1e('0x22')],_0x4d8d63=_0x41fda9[_0xea1e('0x22')]+_0x41fda9['limit'],_0x213646;if(_0x4d8d63>=_0x5d6891){_0x4d8d63=_0x5d6891;_0x213646=0xc8;}else{_0x213646=0xce;}_0x493e44[_0xea1e('0x1f')](_0x213646);return _0x493e44[_0xea1e('0x23')](_0xea1e('0x24'),_0x1cc5dc+'-'+_0x4d8d63+'/'+_0x5d6891)[_0xea1e('0x25')](_0x54cda1);}return null;};}function patchUpdates(_0x368c2a){return function(_0x1b0f8d){try{jsonpatch[_0xea1e('0x26')](_0x1b0f8d,_0x368c2a,!![]);}catch(_0x367ee){return BPromise['reject'](_0x367ee);}return _0x1b0f8d[_0xea1e('0x27')]();};}function saveUpdates(_0x4b42f0,_0x365ccb){return function(_0x36dbc9){if(_0x36dbc9){return _0x36dbc9[_0xea1e('0x28')](_0x4b42f0)[_0xea1e('0x29')](function(_0x3beb9c){return _0x3beb9c;});}return null;};}function removeEntity(_0x155f63,_0x594ad7){return function(_0x2b03f8){if(_0x2b03f8){return _0x2b03f8[_0xea1e('0x2a')]()['then'](function(){_0x155f63[_0xea1e('0x1f')](0xcc)[_0xea1e('0x20')]();});}};}function handleEntityNotFound(_0x4e9056,_0x159cb5){return function(_0x564a03){if(!_0x564a03){_0x4e9056['sendStatus'](0x194);}return _0x564a03;};}function handleError(_0x40f72e,_0x3f174c){_0x3f174c=_0x3f174c||0x1f4;return function(_0x39f915){logger[_0xea1e('0x2b')](_0x39f915[_0xea1e('0x2c')]);if(_0x39f915[_0xea1e('0x2d')]){delete _0x39f915['name'];}_0x40f72e[_0xea1e('0x1f')](_0x3f174c)[_0xea1e('0x2e')](_0x39f915);};}exports[_0xea1e('0x2f')]=function(_0x2b81e3,_0x4e0dba){var _0x14fe13={'raw':![],'where':{'id':_0x2b81e3['params']['id']}},_0x5c97c2={};_0x5c97c2[_0xea1e('0x30')]=_[_0xea1e('0x31')](db[_0xea1e('0x32')]['rawAttributes']);_0x5c97c2[_0xea1e('0x33')]=_[_0xea1e('0x31')](_0x2b81e3[_0xea1e('0x33')]);_0x5c97c2[_0xea1e('0x34')]=_[_0xea1e('0x35')](_0x5c97c2[_0xea1e('0x30')],_0x5c97c2[_0xea1e('0x33')]);_0x14fe13[_0xea1e('0x36')]=_[_0xea1e('0x35')](_0x5c97c2[_0xea1e('0x30')],qs[_0xea1e('0x37')](_0x2b81e3[_0xea1e('0x33')][_0xea1e('0x37')]));_0x14fe13[_0xea1e('0x36')]=_0x14fe13[_0xea1e('0x36')][_0xea1e('0x38')]?_0x14fe13[_0xea1e('0x36')]:_0x5c97c2[_0xea1e('0x30')];if(_0x2b81e3[_0xea1e('0x33')][_0xea1e('0x39')]){_0x14fe13['include']=[{'all':!![]}];}_0x14fe13=_['merge']({},_0x14fe13,_0x2b81e3[_0xea1e('0x3a')]);return db[_0xea1e('0x32')][_0xea1e('0x3b')](_0x14fe13)[_0xea1e('0x29')](handleEntityNotFound(_0x4e0dba,null))[_0xea1e('0x29')](respondWithResult(_0x4e0dba,null))[_0xea1e('0x3c')](handleError(_0x4e0dba,null));};exports[_0xea1e('0x2a')]=function(_0x5d2198,_0xbbe716){return db[_0xea1e('0x32')]['find']({'where':{'id':_0x5d2198[_0xea1e('0x3d')]['id']}})['then'](handleEntityNotFound(_0xbbe716,null))[_0xea1e('0x29')](removeEntity(_0xbbe716,null))[_0xea1e('0x3c')](handleError(_0xbbe716,null));};function widgetAttributes(_0x48fe4b){try{switch(_0x48fe4b[_0xea1e('0x3e')]){case _0xea1e('0x3f'):return[{'name':'attrUrl','value':_0x48fe4b[_0xea1e('0x40')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b['attrs'][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0][_0xea1e('0x42')]:undefined)||_0xea1e('0x43')}];case _0xea1e('0x44'):return[{'name':_0xea1e('0x45'),'value':_0x48fe4b[_0xea1e('0x45')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0]['value']:undefined)||''}];case _0xea1e('0x46'):return[{'name':'attrHourFormat','value':_0x48fe4b[_0xea1e('0x47')]||(_0x48fe4b['attrs']&&_0x48fe4b['attrs'][0x0]?_0x48fe4b['attrs'][0x0][_0xea1e('0x42')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x48fe4b[_0xea1e('0x48')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b['attrs'][0x1]?_0x48fe4b[_0xea1e('0x41')][0x1][_0xea1e('0x42')]:undefined)||_0xea1e('0x49')},{'name':_0xea1e('0x4a'),'value':_0x48fe4b[_0xea1e('0x4a')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b['attrs'][0x2]?_0x48fe4b[_0xea1e('0x41')][0x2][_0xea1e('0x42')]:undefined)||0xc}];case _0xea1e('0x4b'):return[{'name':_0xea1e('0x4c'),'value':_0x48fe4b[_0xea1e('0x4c')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0][_0xea1e('0x42')]:undefined)||_0xea1e('0x4d')},{'name':_0xea1e('0x4e'),'value':_0x48fe4b[_0xea1e('0x4e')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x1]?_0x48fe4b[_0xea1e('0x41')][0x1]['value']:undefined)||[]},{'name':_0xea1e('0x4a'),'value':_0x48fe4b[_0xea1e('0x4a')]||(_0x48fe4b['attrs']&&_0x48fe4b[_0xea1e('0x41')][0x2]?_0x48fe4b[_0xea1e('0x41')][0x2][_0xea1e('0x42')]:undefined)||0x14}];case'multibar-chart':case _0xea1e('0x4f'):return[{'name':_0xea1e('0x50'),'value':_0x48fe4b[_0xea1e('0x50')]||(_0x48fe4b['attrs']&&_0x48fe4b[_0xea1e('0x41')][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0][_0xea1e('0x42')]:undefined)||'total'},{'name':'attrSerie2','value':_0x48fe4b[_0xea1e('0x51')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x1]?_0x48fe4b[_0xea1e('0x41')][0x1][_0xea1e('0x42')]:undefined)||null},{'name':'attrSerie3','value':_0x48fe4b[_0xea1e('0x52')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x2]?_0x48fe4b[_0xea1e('0x41')][0x2]['value']:undefined)||null},{'name':_0xea1e('0x4e'),'value':_0x48fe4b[_0xea1e('0x4e')]||(_0x48fe4b['attrs']&&_0x48fe4b[_0xea1e('0x41')][0x3]?_0x48fe4b[_0xea1e('0x41')][0x3][_0xea1e('0x42')]:undefined)||[]}];case _0xea1e('0x53'):return[{'name':_0xea1e('0x54'),'type':_0x48fe4b[_0xea1e('0x55')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0][_0xea1e('0x3e')]:undefined)||null,'value':_0x48fe4b[_0xea1e('0x54')]||(_0x48fe4b[_0xea1e('0x41')]&&_0x48fe4b[_0xea1e('0x41')][0x0]?_0x48fe4b[_0xea1e('0x41')][0x0][_0xea1e('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x48fe4b['attrRefresh']||(_0x48fe4b['attrs']&&_0x48fe4b[_0xea1e('0x41')][0x1]?_0x48fe4b[_0xea1e('0x41')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x24d88e){logger[_0xea1e('0x2b')](_0xea1e('0x56'),JSON[_0xea1e('0x57')](_0x24d88e));return[];}}exports[_0xea1e('0x58')]=function(_0x151465,_0x257943){if(_0x151465[_0xea1e('0x59')]){_0x151465[_0xea1e('0x59')]['attrs']=widgetAttributes(_0x151465[_0xea1e('0x59')]);}return db[_0xea1e('0x32')][_0xea1e('0x58')](_0x151465[_0xea1e('0x59')],{})[_0xea1e('0x29')](respondWithResult(_0x257943,0xc9))[_0xea1e('0x3c')](handleError(_0x257943,null));};exports[_0xea1e('0x28')]=function(_0x5d0470,_0x663349){if(_0x5d0470[_0xea1e('0x59')]['id']){delete _0x5d0470[_0xea1e('0x59')]['id'];}_0x5d0470[_0xea1e('0x59')][_0xea1e('0x41')]=widgetAttributes(_0x5d0470[_0xea1e('0x59')]);return db[_0xea1e('0x32')][_0xea1e('0x3b')]({'where':{'id':_0x5d0470['params']['id']}})[_0xea1e('0x29')](handleEntityNotFound(_0x663349,null))[_0xea1e('0x29')](saveUpdates(_0x5d0470[_0xea1e('0x59')],null))['then'](respondWithResult(_0x663349,null))[_0xea1e('0x3c')](handleError(_0x663349,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 9186237..70ce921 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 _0xcca7=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0xd4a790,_0xa9ce1e){var _0x33fbc4=function(_0xf71451){while(--_0xf71451){_0xd4a790['push'](_0xd4a790['shift']());}};_0x33fbc4(++_0xa9ce1e);}(_0xcca7,0x15b));var _0x7cca=function(_0x4e6fa8,_0x3dde63){_0x4e6fa8=_0x4e6fa8-0x0;var _0x31bf97=_0xcca7[_0x4e6fa8];return _0x31bf97;};'use strict';var EventEmitter=require(_0x7cca('0x0'));var DashboardItem=require(_0x7cca('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7cca('0x2')](0x0);var events={'afterCreate':_0x7cca('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xd94cbc){return function(_0x44e370,_0x309b1c,_0x4a19f4){DashboardItemEvents[_0x7cca('0x4')](_0xd94cbc+':'+_0x44e370['id'],_0x44e370);DashboardItemEvents[_0x7cca('0x4')](_0xd94cbc,_0x44e370);_0x4a19f4(null);};}for(var e in events){if(events[_0x7cca('0x5')](e)){var event=events[e];DashboardItem[_0x7cca('0x6')](e,emitEvent(event));}}module[_0x7cca('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xa3cf=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x118a66,_0x370d30){var _0x5edc9c=function(_0xb3b7f9){while(--_0xb3b7f9){_0x118a66['push'](_0x118a66['shift']());}};_0x5edc9c(++_0x370d30);}(_0xa3cf,0xfa));var _0xfa3c=function(_0x37a36e,_0x4fb349){_0x37a36e=_0x37a36e-0x0;var _0x1bc896=_0xa3cf[_0x37a36e];return _0x1bc896;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xfa3c('0x0'))['db'][_0xfa3c('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xfa3c('0x2')](0x0);var events={'afterCreate':_0xfa3c('0x3'),'afterUpdate':_0xfa3c('0x4'),'afterDestroy':_0xfa3c('0x5')};function emitEvent(_0x556e1d){return function(_0x19d014,_0x2d1aab,_0x1917f8){DashboardItemEvents[_0xfa3c('0x6')](_0x556e1d+':'+_0x19d014['id'],_0x19d014);DashboardItemEvents[_0xfa3c('0x6')](_0x556e1d,_0x19d014);_0x1917f8(null);};}for(var e in events){if(events[_0xfa3c('0x7')](e)){var event=events[e];DashboardItem[_0xfa3c('0x8')](e,emitEvent(event));}}module[_0xfa3c('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 30481cb..a73df94 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 _0x18fb=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash'];(function(_0x15c8ac,_0x26811b){var _0xf96485=function(_0x1c97d8){while(--_0x1c97d8){_0x15c8ac['push'](_0x15c8ac['shift']());}};_0xf96485(++_0x26811b);}(_0x18fb,0x144));var _0xb18f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x18fb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb18f('0x0'));var util=require(_0xb18f('0x1'));var logger=require(_0xb18f('0x2'))(_0xb18f('0x3'));var moment=require(_0xb18f('0x4'));var BPromise=require(_0xb18f('0x5'));var rp=require(_0xb18f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb18f('0x7'));var config=require(_0xb18f('0x8'));var attributes=require(_0xb18f('0x9'));module[_0xb18f('0xa')]=function(_0x478f79,_0x274022){return _0x478f79[_0xb18f('0xb')]('DashboardItem',attributes,{'tableName':_0xb18f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d4d=['rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x11309c,_0xe18a74){var _0x3fea9c=function(_0xeb11c3){while(--_0xeb11c3){_0x11309c['push'](_0x11309c['shift']());}};_0x3fea9c(++_0xe18a74);}(_0x8d4d,0x187));var _0xd8d4=function(_0x29f8d2,_0x83c4c1){_0x29f8d2=_0x29f8d2-0x0;var _0x349d73=_0x8d4d[_0x29f8d2];return _0x349d73;};'use strict';var _=require(_0xd8d4('0x0'));var util=require(_0xd8d4('0x1'));var logger=require(_0xd8d4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd8d4('0x3'));var rp=require(_0xd8d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8d4('0x5'));var config=require(_0xd8d4('0x6'));var attributes=require('./dashboardItem.attributes');module[_0xd8d4('0x7')]=function(_0x3878aa,_0xa7947c){return _0x3878aa[_0xd8d4('0x8')](_0xd8d4('0x9'),attributes,{'tableName':_0xd8d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 3cd6ddf..91ec4de 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 _0x7de9=['DashboardItem,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info'];(function(_0x4c2655,_0x1e64ea){var _0xdff5fc=function(_0x4b713f){while(--_0x4b713f){_0x4c2655['push'](_0x4c2655['shift']());}};_0xdff5fc(++_0x1e64ea);}(_0x7de9,0x1b7));var _0x97de=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x7de9[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x97de('0x0'));var util=require(_0x97de('0x1'));var moment=require(_0x97de('0x2'));var BPromise=require(_0x97de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97de('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x97de('0x5'));var config=require(_0x97de('0x6'));var jayson=require(_0x97de('0x7'));var client=jayson[_0x97de('0x8')][_0x97de('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x97de('0xa')],{'host':_0x97de('0xb'),'port':0x18eb});var socket=require(_0x97de('0xc'))(new Redis(config[_0x97de('0xa')]));require(_0x97de('0xd'))[_0x97de('0xe')](socket);function respondWithRpcPromise(_0x1f76a0,_0x5843a0,_0x348525){return new BPromise(function(_0x4b5a78,_0x44b5df){return client[_0x97de('0xf')](_0x1f76a0,_0x348525)['then'](function(_0x426bbe){logger[_0x97de('0x10')](_0x97de('0x11'),_0x5843a0,_0x97de('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x5843a0,_0x97de('0x12'),JSON['stringify'](_0x426bbe));if(_0x426bbe[_0x97de('0x13')]){if(_0x426bbe[_0x97de('0x13')][_0x97de('0x14')]===0x1f4){logger[_0x97de('0x13')](_0x97de('0x11'),_0x5843a0,_0x426bbe[_0x97de('0x13')][_0x97de('0x15')]);return _0x44b5df(_0x426bbe[_0x97de('0x13')][_0x97de('0x15')]);}logger['error'](_0x97de('0x11'),_0x5843a0,_0x426bbe[_0x97de('0x13')][_0x97de('0x15')]);return _0x4b5a78(_0x426bbe['error']['message']);}else{logger[_0x97de('0x10')](_0x97de('0x11'),_0x5843a0,_0x97de('0x12'));_0x4b5a78(_0x426bbe[_0x97de('0x16')]['message']);}})[_0x97de('0x17')](function(_0x4866b6){logger[_0x97de('0x13')](_0x97de('0x11'),_0x5843a0,_0x4866b6);_0x44b5df(_0x4866b6);});});} \ No newline at end of file +var _0x0905=['rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0905,0xf5));var _0x5090=function(_0x49ba8a,_0x4fa4c0){_0x49ba8a=_0x49ba8a-0x0;var _0x29fec4=_0x0905[_0x49ba8a];return _0x29fec4;};'use strict';var _=require('lodash');var util=require(_0x5090('0x0'));var moment=require('moment');var BPromise=require(_0x5090('0x1'));var rs=require(_0x5090('0x2'));var fs=require('fs');var Redis=require(_0x5090('0x3'));var db=require(_0x5090('0x4'))['db'];var utils=require(_0x5090('0x5'));var logger=require(_0x5090('0x6'))(_0x5090('0x7'));var config=require(_0x5090('0x8'));var jayson=require(_0x5090('0x9'));var client=jayson['client'][_0x5090('0xa')]({'port':0x232a});config['redis']=_[_0x5090('0xb')](config[_0x5090('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5090('0xd'))(new Redis(config[_0x5090('0xc')]));require(_0x5090('0xe'))[_0x5090('0xf')](socket);function respondWithRpcPromise(_0x4d6b49,_0x3b1b69,_0x35da14){return new BPromise(function(_0x3c68c8,_0x2b128e){return client['request'](_0x4d6b49,_0x35da14)[_0x5090('0x10')](function(_0x3fb873){logger[_0x5090('0x11')](_0x5090('0x12'),_0x3b1b69,_0x5090('0x13'));logger[_0x5090('0x14')](_0x5090('0x15'),_0x3b1b69,_0x5090('0x13'),JSON[_0x5090('0x16')](_0x3fb873));if(_0x3fb873[_0x5090('0x17')]){if(_0x3fb873[_0x5090('0x17')][_0x5090('0x18')]===0x1f4){logger[_0x5090('0x17')]('DashboardItem,\x20%s,\x20%s',_0x3b1b69,_0x3fb873[_0x5090('0x17')][_0x5090('0x19')]);return _0x2b128e(_0x3fb873['error'][_0x5090('0x19')]);}logger[_0x5090('0x17')](_0x5090('0x12'),_0x3b1b69,_0x3fb873[_0x5090('0x17')][_0x5090('0x19')]);return _0x3c68c8(_0x3fb873[_0x5090('0x17')][_0x5090('0x19')]);}else{logger[_0x5090('0x11')](_0x5090('0x12'),_0x3b1b69,'request\x20sent');_0x3c68c8(_0x3fb873[_0x5090('0x1a')][_0x5090('0x19')]);}})[_0x5090('0x1b')](function(_0xf893ca){logger[_0x5090('0x17')]('DashboardItem,\x20%s,\x20%s',_0x3b1b69,_0xf893ca);_0x2b128e(_0xf893ca);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 27b1d44..df49386 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 _0x2672=['length','./dashboardItem.events','remove','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2672,0x1a5));var _0x2267=function(_0xc7dc65,_0x5c2ed5){_0xc7dc65=_0xc7dc65-0x0;var _0x4dfc4a=_0x2672[_0xc7dc65];return _0x4dfc4a;};'use strict';var DashboardItemEvents=require(_0x2267('0x0'));var events=['save',_0x2267('0x1'),_0x2267('0x2')];function createListener(_0x125b20,_0xf9c7c8){return function(_0x26bad8){_0xf9c7c8[_0x2267('0x3')](_0x125b20,_0x26bad8);};}function removeListener(_0x539f0b,_0x4603f7){return function(){DashboardItemEvents[_0x2267('0x4')](_0x539f0b,_0x4603f7);};}exports[_0x2267('0x5')]=function(_0x4e4795){for(var _0x3b10d7=0x0,_0x3c078c=events[_0x2267('0x6')];_0x3b10d7<_0x3c078c;_0x3b10d7++){var _0x4540e8=events[_0x3b10d7];var _0x119ab3=createListener('dashboardItem:'+_0x4540e8,_0x4e4795);DashboardItemEvents['on'](_0x4540e8,_0x119ab3);}}; \ No newline at end of file +var _0xa99d=['length','./dashboardItem.events','save','removeListener','register'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0xa99d,0x1dc));var _0xda99=function(_0x388b47,_0x5cdac5){_0x388b47=_0x388b47-0x0;var _0x4859df=_0xa99d[_0x388b47];return _0x4859df;};'use strict';var DashboardItemEvents=require(_0xda99('0x0'));var events=[_0xda99('0x1'),'remove','update'];function createListener(_0x5a43ab,_0x8a7338){return function(_0x556ab0){_0x8a7338['emit'](_0x5a43ab,_0x556ab0);};}function removeListener(_0x2b1d23,_0x27c5d3){return function(){DashboardItemEvents[_0xda99('0x2')](_0x2b1d23,_0x27c5d3);};}exports[_0xda99('0x3')]=function(_0x3b7021){for(var _0x2bbe66=0x0,_0x39bc21=events[_0xda99('0x4')];_0x2bbe66<_0x39bc21;_0x2bbe66++){var _0x279ad9=events[_0x2bbe66];var _0x47846d=createListener('dashboardItem:'+_0x279ad9,_0x3b7021);DashboardItemEvents['on'](_0x279ad9,_0x47846d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 8b6c5c8..1d1cdc3 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 _0x3f8a=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x266f37,_0x59fa36){_0x266f37=_0x266f37-0x0;var _0x4942ff=_0x3f8a[_0x266f37];return _0x4942ff;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xd')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xf')](_0xa3f8('0xa'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router[_0xa3f8('0x11')]('/:id',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file +var _0x7da7=['put','update','destroy','multer','util','path','Router','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post','create'];(function(_0x1544c7,_0x52670b){var _0x1a350d=function(_0x97f4e9){while(--_0x97f4e9){_0x1544c7['push'](_0x1544c7['shift']());}};_0x1a350d(++_0x52670b);}(_0x7da7,0x10d));var _0x77da=function(_0x39780c,_0x5782c9){_0x39780c=_0x39780c-0x0;var _0x53c19b=_0x7da7[_0x39780c];return _0x53c19b;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get'](_0x77da('0x7'),auth[_0x77da('0x8')](),controller['show']);router[_0x77da('0x9')]('/',auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0x7'),auth[_0x77da('0x8')](),controller[_0x77da('0xc')]);router['delete'](_0x77da('0x7'),auth[_0x77da('0x8')](),controller[_0x77da('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 51357e6..6e69574 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 _0x492e=['sequelize','exports','STRING'];(function(_0x74fd11,_0x59eb8b){var _0x45fd91=function(_0x442c0f){while(--_0x442c0f){_0x74fd11['push'](_0x74fd11['shift']());}};_0x45fd91(++_0x59eb8b);}(_0x492e,0x1e3));var _0xe492=function(_0x587922,_0x2974b){_0x587922=_0x587922-0x0;var _0x1be3ff=_0x492e[_0x587922];return _0x1be3ff;};'use strict';var Sequelize=require(_0xe492('0x0'));module[_0xe492('0x1')]={'name':{'type':Sequelize[_0xe492('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x516d=['exports','STRING'];(function(_0x4068e6,_0x209435){var _0x1c8395=function(_0x2ec4ff){while(--_0x2ec4ff){_0x4068e6['push'](_0x4068e6['shift']());}};_0x1c8395(++_0x209435);}(_0x516d,0xc0));var _0xd516=function(_0x319ab9,_0xad6320){_0x319ab9=_0x319ab9-0x0;var _0x4308eb=_0x516d[_0x319ab9];return _0x4308eb;};'use strict';var Sequelize=require('sequelize');module[_0xd516('0x0')]={'name':{'type':Sequelize[_0xd516('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index dc949be..36c3a25 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 _0x73ad=['key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','merge','options','Disposition','includeAll','include','rows','catch','keys','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','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','Content-Range','json','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73ad,0x192));var _0xd73a=function(_0x5ab95c,_0x15e598){_0x5ab95c=_0x5ab95c-0x0;var _0x435c64=_0x73ad[_0x5ab95c];return _0x435c64;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd73a('0x0'));var jsonpatch=require(_0xd73a('0x1'));var rp=require('request-promise');var moment=require(_0xd73a('0x2'));var BPromise=require(_0xd73a('0x3'));var Mustache=require(_0xd73a('0x4'));var util=require('util');var path=require(_0xd73a('0x5'));var sox=require(_0xd73a('0x6'));var csv=require(_0xd73a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd73a('0x8'));var crypto=require(_0xd73a('0x9'));var jsforce=require(_0xd73a('0xa'));var deskjs=require(_0xd73a('0xb'));var toCsv=require(_0xd73a('0x7'));var querystring=require(_0xd73a('0xc'));var Papa=require(_0xd73a('0xd'));var Redis=require(_0xd73a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd73a('0xf'));var as=require(_0xd73a('0x10'));var hardwareService=require(_0xd73a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xd73a('0x12'));var config=require(_0xd73a('0x13'));var db=require(_0xd73a('0x14'))['db'];function respondWithStatusCode(_0x4c9adf,_0x55de70){_0x55de70=_0x55de70||0xcc;return function(_0x561bfb){if(_0x561bfb){return _0x4c9adf['sendStatus'](_0x55de70);}return _0x4c9adf[_0xd73a('0x15')](_0x55de70)[_0xd73a('0x16')]();};}function respondWithResult(_0x1f1253,_0x1666bb){_0x1666bb=_0x1666bb||0xc8;return function(_0x2c8b2e){if(_0x2c8b2e){return _0x1f1253['status'](_0x1666bb)['json'](_0x2c8b2e);}};}function respondWithFilteredResult(_0x20f148,_0x3256f6){return function(_0x27dd2d){if(_0x27dd2d){var _0x5ea214=_0x27dd2d[_0xd73a('0x17')],_0x490df9=_0x3256f6[_0xd73a('0x18')],_0x224576=_0x3256f6[_0xd73a('0x18')]+_0x3256f6['limit'],_0x1817d0;if(_0x224576>=_0x5ea214){_0x224576=_0x5ea214;_0x1817d0=0xc8;}else{_0x1817d0=0xce;}_0x20f148[_0xd73a('0x15')](_0x1817d0);return _0x20f148['set'](_0xd73a('0x19'),_0x490df9+'-'+_0x224576+'/'+_0x5ea214)[_0xd73a('0x1a')](_0x27dd2d);}return null;};}function patchUpdates(_0x338032){return function(_0x3e9eee){try{jsonpatch['apply'](_0x3e9eee,_0x338032,!![]);}catch(_0x409bb5){return BPromise[_0xd73a('0x1b')](_0x409bb5);}return _0x3e9eee[_0xd73a('0x1c')]();};}function saveUpdates(_0xd10ac9,_0x4adf8c){return function(_0x2d4c88){if(_0x2d4c88){return _0x2d4c88[_0xd73a('0x1d')](_0xd10ac9)['then'](function(_0x516bf6){return _0x516bf6;});}return null;};}function removeEntity(_0x496d13,_0x5e4fc5){return function(_0x129d4d){if(_0x129d4d){return _0x129d4d['destroy']()[_0xd73a('0x1e')](function(){var _0xd9a753=_0x129d4d[_0xd73a('0x1f')]({'plain':!![]});var _0x29df50=_0xd73a('0x20');return db[_0xd73a('0x21')][_0xd73a('0x22')]({'where':{'type':_0x29df50,'resourceId':_0xd9a753['id']}})[_0xd73a('0x1e')](function(){return _0x129d4d;});})[_0xd73a('0x1e')](function(){_0x496d13[_0xd73a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16e9cc,_0x589dc0){return function(_0xd267c5){if(!_0xd267c5){_0x16e9cc['sendStatus'](0x194);}return _0xd267c5;};}function handleError(_0x5dd369,_0x48bd1a){_0x48bd1a=_0x48bd1a||0x1f4;return function(_0x1e42f0){logger[_0xd73a('0x23')](_0x1e42f0[_0xd73a('0x24')]);if(_0x1e42f0[_0xd73a('0x25')]){delete _0x1e42f0[_0xd73a('0x25')];}_0x5dd369[_0xd73a('0x15')](_0x48bd1a)[_0xd73a('0x26')](_0x1e42f0);};}exports['index']=function(_0x164672,_0x81186a){var _0x2156d7={},_0x28d570={},_0x40e485={'count':0x0,'rows':[]};var _0x100e4f=_[_0xd73a('0x27')](db['Disposition'][_0xd73a('0x28')],function(_0x454b1d){return{'name':_0x454b1d['fieldName'],'type':_0x454b1d[_0xd73a('0x29')][_0xd73a('0x2a')]};});_0x28d570[_0xd73a('0x2b')]=_[_0xd73a('0x27')](_0x100e4f,'name');_0x28d570['query']=_['keys'](_0x164672[_0xd73a('0x2c')]);_0x28d570[_0xd73a('0x2d')]=_[_0xd73a('0x2e')](_0x28d570[_0xd73a('0x2b')],_0x28d570['query']);_0x2156d7['attributes']=_['intersection'](_0x28d570[_0xd73a('0x2b')],qs[_0xd73a('0x2f')](_0x164672[_0xd73a('0x2c')][_0xd73a('0x2f')]));_0x2156d7[_0xd73a('0x30')]=_0x2156d7[_0xd73a('0x30')][_0xd73a('0x31')]?_0x2156d7[_0xd73a('0x30')]:_0x28d570['model'];if(!_0x164672['query']['hasOwnProperty'](_0xd73a('0x32'))){_0x2156d7[_0xd73a('0x33')]=qs[_0xd73a('0x33')](_0x164672[_0xd73a('0x2c')]['limit']);_0x2156d7[_0xd73a('0x18')]=qs['offset'](_0x164672[_0xd73a('0x2c')][_0xd73a('0x18')]);}_0x2156d7[_0xd73a('0x34')]=qs[_0xd73a('0x35')](_0x164672['query']['sort']);_0x2156d7[_0xd73a('0x36')]=qs[_0xd73a('0x2d')](_[_0xd73a('0x37')](_0x164672[_0xd73a('0x2c')],_0x28d570['filters']),_0x100e4f);if(_0x164672[_0xd73a('0x2c')]['filter']){_0x2156d7[_0xd73a('0x36')]=_[_0xd73a('0x38')](_0x2156d7['where'],{'$or':_[_0xd73a('0x27')](_0x100e4f,function(_0x42300c){if(_0x42300c[_0xd73a('0x29')]!=='VIRTUAL'){var _0x509b12={};_0x509b12[_0x42300c['name']]={'$like':'%'+_0x164672[_0xd73a('0x2c')]['filter']+'%'};return _0x509b12;}})});}_0x2156d7=_[_0xd73a('0x38')]({},_0x2156d7,_0x164672[_0xd73a('0x39')]);var _0xba0417={'where':_0x2156d7[_0xd73a('0x36')]};return db[_0xd73a('0x3a')][_0xd73a('0x17')](_0xba0417)[_0xd73a('0x1e')](function(_0x19a2f0){_0x40e485[_0xd73a('0x17')]=_0x19a2f0;if(_0x164672[_0xd73a('0x2c')][_0xd73a('0x3b')]){_0x2156d7[_0xd73a('0x3c')]=[{'all':!![]}];}return db[_0xd73a('0x3a')]['findAll'](_0x2156d7);})[_0xd73a('0x1e')](function(_0xc01d7f){_0x40e485[_0xd73a('0x3d')]=_0xc01d7f;return _0x40e485;})['then'](respondWithFilteredResult(_0x81186a,_0x2156d7))[_0xd73a('0x3e')](handleError(_0x81186a,null));};exports['show']=function(_0x4c6715,_0x413e73){var _0x4936cf={'raw':!![],'where':{'id':_0x4c6715['params']['id']}},_0x4bf84a={};_0x4bf84a[_0xd73a('0x2b')]=_[_0xd73a('0x3f')](db[_0xd73a('0x3a')][_0xd73a('0x28')]);_0x4bf84a[_0xd73a('0x2c')]=_[_0xd73a('0x3f')](_0x4c6715[_0xd73a('0x2c')]);_0x4bf84a[_0xd73a('0x2d')]=_['intersection'](_0x4bf84a[_0xd73a('0x2b')],_0x4bf84a['query']);_0x4936cf[_0xd73a('0x30')]=_[_0xd73a('0x2e')](_0x4bf84a[_0xd73a('0x2b')],qs[_0xd73a('0x2f')](_0x4c6715['query'][_0xd73a('0x2f')]));_0x4936cf['attributes']=_0x4936cf['attributes'][_0xd73a('0x31')]?_0x4936cf['attributes']:_0x4bf84a[_0xd73a('0x2b')];if(_0x4c6715[_0xd73a('0x2c')]['includeAll']){_0x4936cf[_0xd73a('0x3c')]=[{'all':!![]}];}_0x4936cf=_[_0xd73a('0x38')]({},_0x4936cf,_0x4c6715[_0xd73a('0x39')]);return db[_0xd73a('0x3a')][_0xd73a('0x40')](_0x4936cf)[_0xd73a('0x1e')](handleEntityNotFound(_0x413e73,null))[_0xd73a('0x1e')](respondWithResult(_0x413e73,null))[_0xd73a('0x3e')](handleError(_0x413e73,null));};exports[_0xd73a('0x41')]=function(_0x197c14,_0x103c8b){return db['Disposition'][_0xd73a('0x41')](_0x197c14[_0xd73a('0x42')],{})['then'](function(_0xb5e7e){var _0x4b0f98=_0x197c14[_0xd73a('0x43')][_0xd73a('0x1f')]({'plain':!![]});if(!_0x4b0f98)throw new Error(_0xd73a('0x44'));if(_0x4b0f98[_0xd73a('0x45')]===_0xd73a('0x43')){var _0x531eef=_0xb5e7e[_0xd73a('0x1f')]({'plain':!![]});var _0x1d320f='Dispositions';return db['UserProfileSection']['find']({'where':{'name':_0x1d320f,'userProfileId':_0x4b0f98[_0xd73a('0x46')]},'raw':!![]})[_0xd73a('0x1e')](function(_0x4cfc35){if(_0x4cfc35&&_0x4cfc35[_0xd73a('0x47')]===0x0){return db[_0xd73a('0x21')][_0xd73a('0x41')]({'name':_0x531eef[_0xd73a('0x25')],'resourceId':_0x531eef['id'],'type':_0x4cfc35[_0xd73a('0x25')],'sectionId':_0x4cfc35['id']},{})['then'](function(){return _0xb5e7e;});}else{return _0xb5e7e;}})['catch'](function(_0x246711){logger[_0xd73a('0x23')](_0xd73a('0x48'),_0x246711);throw _0x246711;});}return _0xb5e7e;})[_0xd73a('0x1e')](respondWithResult(_0x103c8b,0xc9))['catch'](handleError(_0x103c8b,null));};exports[_0xd73a('0x1d')]=function(_0x376d0a,_0x3002f8){if(_0x376d0a[_0xd73a('0x42')]['id']){delete _0x376d0a[_0xd73a('0x42')]['id'];}return db[_0xd73a('0x3a')]['find']({'where':{'id':_0x376d0a[_0xd73a('0x49')]['id']}})['then'](handleEntityNotFound(_0x3002f8,null))[_0xd73a('0x1e')](saveUpdates(_0x376d0a[_0xd73a('0x42')],null))[_0xd73a('0x1e')](respondWithResult(_0x3002f8,null))['catch'](handleError(_0x3002f8,null));};exports[_0xd73a('0x22')]=function(_0x12e1df,_0x5941e6){return db[_0xd73a('0x3a')][_0xd73a('0x40')]({'where':{'id':_0x12e1df[_0xd73a('0x49')]['id']}})[_0xd73a('0x1e')](handleEntityNotFound(_0x5941e6,null))[_0xd73a('0x1e')](removeEntity(_0x5941e6,null))[_0xd73a('0x3e')](handleError(_0x5941e6,null));}; \ No newline at end of file +var _0xf8e4=['rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','show','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','set','apply','save','update','destroy','UserProfileResource','then','error','name','send','map'];(function(_0x4c35a0,_0x99114b){var _0x2ef0e9=function(_0x7c207){while(--_0x7c207){_0x4c35a0['push'](_0x4c35a0['shift']());}};_0x2ef0e9(++_0x99114b);}(_0xf8e4,0x118));var _0x4f8e=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0xf8e4[_0x30a31e];return _0x170879;};'use strict';var pdf=require(_0x4f8e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f8e('0x1'));var jsonpatch=require(_0x4f8e('0x2'));var rp=require(_0x4f8e('0x3'));var moment=require('moment');var BPromise=require(_0x4f8e('0x4'));var Mustache=require(_0x4f8e('0x5'));var util=require(_0x4f8e('0x6'));var path=require(_0x4f8e('0x7'));var sox=require(_0x4f8e('0x8'));var csv=require(_0x4f8e('0x9'));var ejs=require(_0x4f8e('0xa'));var fs=require('fs');var _=require(_0x4f8e('0xb'));var squel=require('squel');var crypto=require(_0x4f8e('0xc'));var jsforce=require(_0x4f8e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4f8e('0x9'));var querystring=require(_0x4f8e('0xe'));var Papa=require(_0x4f8e('0xf'));var Redis=require(_0x4f8e('0x10'));var authService=require(_0x4f8e('0x11'));var qs=require(_0x4f8e('0x12'));var as=require(_0x4f8e('0x13'));var hardwareService=require(_0x4f8e('0x14'));var logger=require(_0x4f8e('0x15'))(_0x4f8e('0x16'));var utils=require(_0x4f8e('0x17'));var config=require(_0x4f8e('0x18'));var db=require(_0x4f8e('0x19'))['db'];function respondWithStatusCode(_0x2bf804,_0x4d3af2){_0x4d3af2=_0x4d3af2||0xcc;return function(_0xfb0d1f){if(_0xfb0d1f){return _0x2bf804[_0x4f8e('0x1a')](_0x4d3af2);}return _0x2bf804[_0x4f8e('0x1b')](_0x4d3af2)[_0x4f8e('0x1c')]();};}function respondWithResult(_0x540621,_0x2ad667){_0x2ad667=_0x2ad667||0xc8;return function(_0x43886f){if(_0x43886f){return _0x540621[_0x4f8e('0x1b')](_0x2ad667)[_0x4f8e('0x1d')](_0x43886f);}};}function respondWithFilteredResult(_0xc3c70a,_0x1723eb){return function(_0x570cd0){if(_0x570cd0){var _0x2de19d=_0x570cd0[_0x4f8e('0x1e')],_0x4d27af=_0x1723eb[_0x4f8e('0x1f')],_0x427870=_0x1723eb[_0x4f8e('0x1f')]+_0x1723eb[_0x4f8e('0x20')],_0x2bf358;if(_0x427870>=_0x2de19d){_0x427870=_0x2de19d;_0x2bf358=0xc8;}else{_0x2bf358=0xce;}_0xc3c70a['status'](_0x2bf358);return _0xc3c70a[_0x4f8e('0x21')]('Content-Range',_0x4d27af+'-'+_0x427870+'/'+_0x2de19d)['json'](_0x570cd0);}return null;};}function patchUpdates(_0x395f70){return function(_0x2a2314){try{jsonpatch[_0x4f8e('0x22')](_0x2a2314,_0x395f70,!![]);}catch(_0x466f2d){return BPromise['reject'](_0x466f2d);}return _0x2a2314[_0x4f8e('0x23')]();};}function saveUpdates(_0x376c60,_0xce04c8){return function(_0x535ceb){if(_0x535ceb){return _0x535ceb[_0x4f8e('0x24')](_0x376c60)['then'](function(_0x5205aa){return _0x5205aa;});}return null;};}function removeEntity(_0x5e652b,_0x36a59f){return function(_0x102c7f){if(_0x102c7f){return _0x102c7f[_0x4f8e('0x25')]()['then'](function(){var _0x3c00c2=_0x102c7f['get']({'plain':!![]});var _0x4e7798='Dispositions';return db[_0x4f8e('0x26')][_0x4f8e('0x25')]({'where':{'type':_0x4e7798,'resourceId':_0x3c00c2['id']}})[_0x4f8e('0x27')](function(){return _0x102c7f;});})[_0x4f8e('0x27')](function(){_0x5e652b[_0x4f8e('0x1b')](0xcc)[_0x4f8e('0x1c')]();});}};}function handleEntityNotFound(_0x1b6166,_0x8c30bf){return function(_0x4f72c8){if(!_0x4f72c8){_0x1b6166[_0x4f8e('0x1a')](0x194);}return _0x4f72c8;};}function handleError(_0x1dd7fd,_0x54a84a){_0x54a84a=_0x54a84a||0x1f4;return function(_0x4e39c6){logger[_0x4f8e('0x28')](_0x4e39c6['stack']);if(_0x4e39c6[_0x4f8e('0x29')]){delete _0x4e39c6[_0x4f8e('0x29')];}_0x1dd7fd[_0x4f8e('0x1b')](_0x54a84a)[_0x4f8e('0x2a')](_0x4e39c6);};}exports['index']=function(_0x888551,_0x207ab4){var _0x1677db={},_0x175f4a={},_0x2ab77e={'count':0x0,'rows':[]};var _0x4edffa=_[_0x4f8e('0x2b')](db['Disposition'][_0x4f8e('0x2c')],function(_0x2280ef){return{'name':_0x2280ef['fieldName'],'type':_0x2280ef[_0x4f8e('0x2d')][_0x4f8e('0x2e')]};});_0x175f4a[_0x4f8e('0x2f')]=_[_0x4f8e('0x2b')](_0x4edffa,_0x4f8e('0x29'));_0x175f4a[_0x4f8e('0x30')]=_[_0x4f8e('0x31')](_0x888551['query']);_0x175f4a[_0x4f8e('0x32')]=_['intersection'](_0x175f4a['model'],_0x175f4a[_0x4f8e('0x30')]);_0x1677db['attributes']=_[_0x4f8e('0x33')](_0x175f4a['model'],qs['fields'](_0x888551[_0x4f8e('0x30')][_0x4f8e('0x34')]));_0x1677db[_0x4f8e('0x35')]=_0x1677db[_0x4f8e('0x35')][_0x4f8e('0x36')]?_0x1677db['attributes']:_0x175f4a[_0x4f8e('0x2f')];if(!_0x888551[_0x4f8e('0x30')]['hasOwnProperty']('nolimit')){_0x1677db['limit']=qs[_0x4f8e('0x20')](_0x888551[_0x4f8e('0x30')]['limit']);_0x1677db['offset']=qs[_0x4f8e('0x1f')](_0x888551[_0x4f8e('0x30')][_0x4f8e('0x1f')]);}_0x1677db[_0x4f8e('0x37')]=qs[_0x4f8e('0x38')](_0x888551[_0x4f8e('0x30')][_0x4f8e('0x38')]);_0x1677db[_0x4f8e('0x39')]=qs[_0x4f8e('0x32')](_[_0x4f8e('0x3a')](_0x888551['query'],_0x175f4a[_0x4f8e('0x32')]),_0x4edffa);if(_0x888551[_0x4f8e('0x30')][_0x4f8e('0x3b')]){_0x1677db[_0x4f8e('0x39')]=_[_0x4f8e('0x3c')](_0x1677db[_0x4f8e('0x39')],{'$or':_[_0x4f8e('0x2b')](_0x4edffa,function(_0x231d2d){if(_0x231d2d['type']!==_0x4f8e('0x3d')){var _0x159802={};_0x159802[_0x231d2d['name']]={'$like':'%'+_0x888551[_0x4f8e('0x30')][_0x4f8e('0x3b')]+'%'};return _0x159802;}})});}_0x1677db=_[_0x4f8e('0x3c')]({},_0x1677db,_0x888551[_0x4f8e('0x3e')]);var _0x117b12={'where':_0x1677db[_0x4f8e('0x39')]};return db[_0x4f8e('0x3f')][_0x4f8e('0x1e')](_0x117b12)['then'](function(_0x3e76f6){_0x2ab77e['count']=_0x3e76f6;if(_0x888551[_0x4f8e('0x30')][_0x4f8e('0x40')]){_0x1677db[_0x4f8e('0x41')]=[{'all':!![]}];}return db['Disposition'][_0x4f8e('0x42')](_0x1677db);})[_0x4f8e('0x27')](function(_0x43a1ec){_0x2ab77e[_0x4f8e('0x43')]=_0x43a1ec;return _0x2ab77e;})[_0x4f8e('0x27')](respondWithFilteredResult(_0x207ab4,_0x1677db))['catch'](handleError(_0x207ab4,null));};exports[_0x4f8e('0x44')]=function(_0x5b826e,_0x247c1d){var _0x3d6b0f={'raw':!![],'where':{'id':_0x5b826e[_0x4f8e('0x45')]['id']}},_0x2e4b65={};_0x2e4b65['model']=_['keys'](db['Disposition'][_0x4f8e('0x2c')]);_0x2e4b65['query']=_[_0x4f8e('0x31')](_0x5b826e[_0x4f8e('0x30')]);_0x2e4b65['filters']=_[_0x4f8e('0x33')](_0x2e4b65['model'],_0x2e4b65[_0x4f8e('0x30')]);_0x3d6b0f[_0x4f8e('0x35')]=_[_0x4f8e('0x33')](_0x2e4b65[_0x4f8e('0x2f')],qs['fields'](_0x5b826e['query']['fields']));_0x3d6b0f[_0x4f8e('0x35')]=_0x3d6b0f['attributes'][_0x4f8e('0x36')]?_0x3d6b0f['attributes']:_0x2e4b65[_0x4f8e('0x2f')];if(_0x5b826e[_0x4f8e('0x30')]['includeAll']){_0x3d6b0f[_0x4f8e('0x41')]=[{'all':!![]}];}_0x3d6b0f=_[_0x4f8e('0x3c')]({},_0x3d6b0f,_0x5b826e['options']);return db[_0x4f8e('0x3f')][_0x4f8e('0x46')](_0x3d6b0f)[_0x4f8e('0x27')](handleEntityNotFound(_0x247c1d,null))[_0x4f8e('0x27')](respondWithResult(_0x247c1d,null))[_0x4f8e('0x47')](handleError(_0x247c1d,null));};exports[_0x4f8e('0x48')]=function(_0x20a513,_0x1258e7){return db[_0x4f8e('0x3f')][_0x4f8e('0x48')](_0x20a513['body'],{})[_0x4f8e('0x27')](function(_0x566e0c){var _0x3b5b8c=_0x20a513[_0x4f8e('0x49')][_0x4f8e('0x4a')]({'plain':!![]});if(!_0x3b5b8c)throw new Error(_0x4f8e('0x4b'));if(_0x3b5b8c[_0x4f8e('0x4c')]===_0x4f8e('0x49')){var _0x16804f=_0x566e0c[_0x4f8e('0x4a')]({'plain':!![]});var _0x9e0625=_0x4f8e('0x4d');return db['UserProfileSection'][_0x4f8e('0x46')]({'where':{'name':_0x9e0625,'userProfileId':_0x3b5b8c['userProfileId']},'raw':!![]})[_0x4f8e('0x27')](function(_0x1d0cc0){if(_0x1d0cc0&&_0x1d0cc0[_0x4f8e('0x4e')]===0x0){return db[_0x4f8e('0x26')][_0x4f8e('0x48')]({'name':_0x16804f[_0x4f8e('0x29')],'resourceId':_0x16804f['id'],'type':_0x1d0cc0[_0x4f8e('0x29')],'sectionId':_0x1d0cc0['id']},{})[_0x4f8e('0x27')](function(){return _0x566e0c;});}else{return _0x566e0c;}})[_0x4f8e('0x47')](function(_0x28c9a1){logger[_0x4f8e('0x28')](_0x4f8e('0x4f'),_0x28c9a1);throw _0x28c9a1;});}return _0x566e0c;})[_0x4f8e('0x27')](respondWithResult(_0x1258e7,0xc9))[_0x4f8e('0x47')](handleError(_0x1258e7,null));};exports[_0x4f8e('0x24')]=function(_0x490412,_0x183bb0){if(_0x490412[_0x4f8e('0x50')]['id']){delete _0x490412[_0x4f8e('0x50')]['id'];}return db['Disposition'][_0x4f8e('0x46')]({'where':{'id':_0x490412[_0x4f8e('0x45')]['id']}})[_0x4f8e('0x27')](handleEntityNotFound(_0x183bb0,null))['then'](saveUpdates(_0x490412[_0x4f8e('0x50')],null))[_0x4f8e('0x27')](respondWithResult(_0x183bb0,null))['catch'](handleError(_0x183bb0,null));};exports['destroy']=function(_0x5bf085,_0x27bcca){return db['Disposition'][_0x4f8e('0x46')]({'where':{'id':_0x5bf085[_0x4f8e('0x45')]['id']}})['then'](handleEntityNotFound(_0x27bcca,null))[_0x4f8e('0x27')](removeEntity(_0x27bcca,null))[_0x4f8e('0x47')](handleError(_0x27bcca,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 573d4bb..8f62725 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 _0x9f97=['name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Disposition','name_voice','name','ListId'];(function(_0x4285b7,_0x11f7fb){var _0x8cb0=function(_0x497eb4){while(--_0x497eb4){_0x4285b7['push'](_0x4285b7['shift']());}};_0x8cb0(++_0x11f7fb);}(_0x9f97,0x152));var _0x79f9=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x9f97[_0x510c60];return _0x49c4aa;};'use strict';var _=require(_0x79f9('0x0'));var util=require(_0x79f9('0x1'));var logger=require(_0x79f9('0x2'))('api');var moment=require(_0x79f9('0x3'));var BPromise=require(_0x79f9('0x4'));var rp=require(_0x79f9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79f9('0x6'));var config=require(_0x79f9('0x7'));var attributes=require('./disposition.attributes');module[_0x79f9('0x8')]=function(_0x3909cb,_0x2bead8){return _0x3909cb[_0x79f9('0x9')](_0x79f9('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x79f9('0xb'),'fields':[_0x79f9('0xc'),_0x79f9('0xd')]},{'unique':!![],'name':_0x79f9('0xe'),'fields':['name',_0x79f9('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0x79f9('0xc'),_0x79f9('0x10')]},{'unique':!![],'name':_0x79f9('0x11'),'fields':['name',_0x79f9('0x12')]},{'unique':!![],'name':_0x79f9('0x13'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x79f9('0x14'),'fields':['name',_0x79f9('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x79f9('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xaabc=['name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaabc,0x19a));var _0xcaab=function(_0x5c9f56,_0x42c9ad){_0x5c9f56=_0x5c9f56-0x0;var _0x2a726b=_0xaabc[_0x5c9f56];return _0x2a726b;};'use strict';var _=require(_0xcaab('0x0'));var util=require(_0xcaab('0x1'));var logger=require(_0xcaab('0x2'))(_0xcaab('0x3'));var moment=require(_0xcaab('0x4'));var BPromise=require(_0xcaab('0x5'));var rp=require(_0xcaab('0x6'));var fs=require('fs');var path=require(_0xcaab('0x7'));var rimraf=require(_0xcaab('0x8'));var config=require(_0xcaab('0x9'));var attributes=require(_0xcaab('0xa'));module[_0xcaab('0xb')]=function(_0x38a5aa,_0x201c50){return _0x38a5aa[_0xcaab('0xc')]('Disposition',attributes,{'tableName':_0xcaab('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xcaab('0xe'),'fields':[_0xcaab('0xf'),'ListId']},{'unique':!![],'name':_0xcaab('0x10'),'fields':[_0xcaab('0xf'),_0xcaab('0x11')]},{'unique':!![],'name':_0xcaab('0x12'),'fields':[_0xcaab('0xf'),_0xcaab('0x13')]},{'unique':!![],'name':_0xcaab('0x14'),'fields':['name',_0xcaab('0x15')]},{'unique':!![],'name':_0xcaab('0x16'),'fields':[_0xcaab('0xf'),_0xcaab('0x17')]},{'unique':!![],'name':_0xcaab('0x18'),'fields':[_0xcaab('0xf'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0xcaab('0xf'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index d1516b1..c59f9fc 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 _0x6aa5=['then','request\x20sent','debug','error','message','Disposition,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x501843,_0x96ded9){var _0xee8882=function(_0x49470a){while(--_0x49470a){_0x501843['push'](_0x501843['shift']());}};_0xee8882(++_0x96ded9);}(_0x6aa5,0x190));var _0x56aa=function(_0x57bca5,_0x1fc3a4){_0x57bca5=_0x57bca5-0x0;var _0x58029d=_0x6aa5[_0x57bca5];return _0x58029d;};'use strict';var _=require(_0x56aa('0x0'));var util=require(_0x56aa('0x1'));var moment=require(_0x56aa('0x2'));var BPromise=require(_0x56aa('0x3'));var rs=require(_0x56aa('0x4'));var fs=require('fs');var Redis=require(_0x56aa('0x5'));var db=require(_0x56aa('0x6'))['db'];var utils=require(_0x56aa('0x7'));var logger=require(_0x56aa('0x8'))(_0x56aa('0x9'));var config=require(_0x56aa('0xa'));var jayson=require(_0x56aa('0xb'));var client=jayson[_0x56aa('0xc')][_0x56aa('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xfa2884,_0xc6002,_0x16a95f){return new BPromise(function(_0x92d00b,_0x27329f){return client['request'](_0xfa2884,_0x16a95f)[_0x56aa('0xe')](function(_0x4e159d){logger['info']('Disposition,\x20%s,\x20%s',_0xc6002,_0x56aa('0xf'));logger[_0x56aa('0x10')]('Disposition,\x20%s,\x20%s,\x20%s',_0xc6002,_0x56aa('0xf'),JSON['stringify'](_0x4e159d));if(_0x4e159d[_0x56aa('0x11')]){if(_0x4e159d[_0x56aa('0x11')]['code']===0x1f4){logger[_0x56aa('0x11')]('Disposition,\x20%s,\x20%s',_0xc6002,_0x4e159d['error'][_0x56aa('0x12')]);return _0x27329f(_0x4e159d[_0x56aa('0x11')][_0x56aa('0x12')]);}logger[_0x56aa('0x11')](_0x56aa('0x13'),_0xc6002,_0x4e159d['error'][_0x56aa('0x12')]);return _0x92d00b(_0x4e159d[_0x56aa('0x11')][_0x56aa('0x12')]);}else{logger[_0x56aa('0x14')](_0x56aa('0x13'),_0xc6002,_0x56aa('0xf'));_0x92d00b(_0x4e159d[_0x56aa('0x15')][_0x56aa('0x12')]);}})[_0x56aa('0x16')](function(_0x1f0df3){logger[_0x56aa('0x11')](_0x56aa('0x13'),_0xc6002,_0x1f0df3);_0x27329f(_0x1f0df3);});});} \ No newline at end of file +var _0x704a=['error','code','message','info','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x46389a,_0x825f69){var _0x5d4cd0=function(_0x378bf3){while(--_0x378bf3){_0x46389a['push'](_0x46389a['shift']());}};_0x5d4cd0(++_0x825f69);}(_0x704a,0xe1));var _0xa704=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x704a[_0x2fc012];return _0x2891f9;};'use strict';var _=require('lodash');var util=require(_0xa704('0x0'));var moment=require('moment');var BPromise=require(_0xa704('0x1'));var rs=require(_0xa704('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa704('0x3'))['db'];var utils=require(_0xa704('0x4'));var logger=require('../../config/logger')(_0xa704('0x5'));var config=require('../../config/environment');var jayson=require(_0xa704('0x6'));var client=jayson[_0xa704('0x7')][_0xa704('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e7c1c,_0xc2e4cd,_0x20908e){return new BPromise(function(_0x5cddb0,_0xfb82ff){return client['request'](_0x3e7c1c,_0x20908e)[_0xa704('0x9')](function(_0x54ef7e){logger['info'](_0xa704('0xa'),_0xc2e4cd,_0xa704('0xb'));logger[_0xa704('0xc')](_0xa704('0xd'),_0xc2e4cd,_0xa704('0xb'),JSON[_0xa704('0xe')](_0x54ef7e));if(_0x54ef7e[_0xa704('0xf')]){if(_0x54ef7e[_0xa704('0xf')][_0xa704('0x10')]===0x1f4){logger[_0xa704('0xf')](_0xa704('0xa'),_0xc2e4cd,_0x54ef7e[_0xa704('0xf')]['message']);return _0xfb82ff(_0x54ef7e['error'][_0xa704('0x11')]);}logger['error']('Disposition,\x20%s,\x20%s',_0xc2e4cd,_0x54ef7e[_0xa704('0xf')][_0xa704('0x11')]);return _0x5cddb0(_0x54ef7e['error'][_0xa704('0x11')]);}else{logger[_0xa704('0x12')](_0xa704('0xa'),_0xc2e4cd,_0xa704('0xb'));_0x5cddb0(_0x54ef7e['result']['message']);}})[_0xa704('0x13')](function(_0x12e974){logger[_0xa704('0xf')]('Disposition,\x20%s,\x20%s',_0xc2e4cd,_0x12e974);_0xfb82ff(_0x12e974);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 4f113f5..85e6835 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 _0xba37=['../../config/environment','./disposition.controller','get','index','isAuthenticated','show','create','put','/:id','update','delete','exports','multer','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0xba37,0xb6));var _0x7ba3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xba37[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x7ba3('0x0'));var util=require('util');var path=require(_0x7ba3('0x1'));var timeout=require('connect-timeout');var express=require(_0x7ba3('0x2'));var router=express['Router']();var auth=require(_0x7ba3('0x3'));var interaction=require(_0x7ba3('0x4'));var config=require(_0x7ba3('0x5'));var controller=require(_0x7ba3('0x6'));router[_0x7ba3('0x7')]('/',auth['isAuthenticated'](),controller[_0x7ba3('0x8')]);router['get']('/:id',auth[_0x7ba3('0x9')](),controller[_0x7ba3('0xa')]);router['post']('/',auth[_0x7ba3('0x9')](),controller[_0x7ba3('0xb')]);router[_0x7ba3('0xc')](_0x7ba3('0xd'),auth[_0x7ba3('0x9')](),controller[_0x7ba3('0xe')]);router[_0x7ba3('0xf')](_0x7ba3('0xd'),auth[_0x7ba3('0x9')](),controller['destroy']);module[_0x7ba3('0x10')]=router; \ No newline at end of file +var _0x8212=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer'];(function(_0x54db8c,_0x6d1ff1){var _0x10ea0c=function(_0x5808c0){while(--_0x5808c0){_0x54db8c['push'](_0x54db8c['shift']());}};_0x10ea0c(++_0x6d1ff1);}(_0x8212,0xb3));var _0x2821=function(_0x22cea4,_0x54f16a){_0x22cea4=_0x22cea4-0x0;var _0x59d75b=_0x8212[_0x22cea4];return _0x59d75b;};'use strict';var multer=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var path=require('path');var timeout=require(_0x2821('0x2'));var express=require(_0x2821('0x3'));var router=express[_0x2821('0x4')]();var auth=require(_0x2821('0x5'));var interaction=require(_0x2821('0x6'));var config=require(_0x2821('0x7'));var controller=require(_0x2821('0x8'));router[_0x2821('0x9')]('/',auth['isAuthenticated'](),controller[_0x2821('0xa')]);router['get'](_0x2821('0xb'),auth[_0x2821('0xc')](),controller['show']);router[_0x2821('0xd')]('/',auth[_0x2821('0xc')](),controller[_0x2821('0xe')]);router[_0x2821('0xf')](_0x2821('0xb'),auth[_0x2821('0xc')](),controller[_0x2821('0x10')]);router[_0x2821('0x11')](_0x2821('0xb'),auth['isAuthenticated'](),controller[_0x2821('0x12')]);module[_0x2821('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index aa50340..765f20f 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 _0xac7b=['BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac7b,0x123));var _0xbac7=function(_0x27cd67,_0x38bc73){_0x27cd67=_0x27cd67-0x0;var _0x3bb7ed=_0xac7b[_0x27cd67];return _0x3bb7ed;};'use strict';var Sequelize=require(_0xbac7('0x0'));module['exports']={'name':{'type':Sequelize[_0xbac7('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0xbac7('0x2'),'no'),'defaultValue':_0xbac7('0x2')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xbac7('0x3')},'localstationid':{'type':Sequelize[_0xbac7('0x1')],'unique':_0xbac7('0x4')},'minrate':{'type':Sequelize[_0xbac7('0x5')](_0xbac7('0x6'),_0xbac7('0x7'),_0xbac7('0x8'),_0xbac7('0x9'),_0xbac7('0xa'),'14400'),'defaultValue':_0xbac7('0x7')},'maxrate':{'type':Sequelize[_0xbac7('0x5')](_0xbac7('0x6'),_0xbac7('0x7'),_0xbac7('0x8'),_0xbac7('0x9'),_0xbac7('0xa'),'14400'),'defaultValue':_0xbac7('0xb')},'modem':{'type':Sequelize[_0xbac7('0x1')],'defaultValue':_0xbac7('0xc')},'gateway':{'type':Sequelize[_0xbac7('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xbac7('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xbac7('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xbac7('0x5')](_0xbac7('0xe'),_0xbac7('0xf'),'DADHI','KHOMP'),'defaultValue':_0xbac7('0xe')},'key':{'type':Sequelize[_0xbac7('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbac7('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbac7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbac7('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbac7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbac7('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xbac7('0x11')],'defaultValue':![],'comment':_0xbac7('0x12'),'set':function(_0x58d8f5){if(!_0x58d8f5)this[_0xbac7('0x13')](_0xbac7('0x14'),null);this[_0xbac7('0x13')](_0xbac7('0x15'),_0x58d8f5);}}}; \ No newline at end of file +var _0x7944=['STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','9600','12000','4800','7200','14400','v17,v27,v29','SIP','IAX','DADHI','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','exports'];(function(_0x4678fd,_0x431892){var _0xfef9c0=function(_0x43afe){while(--_0x43afe){_0x4678fd['push'](_0x4678fd['shift']());}};_0xfef9c0(++_0x431892);}(_0x7944,0x9a));var _0x4794=function(_0x50663b,_0x33bbf6){_0x50663b=_0x50663b-0x0;var _0x59b77b=_0x7944[_0x50663b];return _0x59b77b;};'use strict';var Sequelize=require(_0x4794('0x0'));module[_0x4794('0x1')]={'name':{'type':Sequelize[_0x4794('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4794('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x4794('0x3'),'no'),'defaultValue':_0x4794('0x3')},'headerinfo':{'type':Sequelize[_0x4794('0x2')],'defaultValue':_0x4794('0x4')},'localstationid':{'type':Sequelize[_0x4794('0x2')],'unique':_0x4794('0x5')},'minrate':{'type':Sequelize[_0x4794('0x6')](_0x4794('0x7'),'4800','7200',_0x4794('0x8'),_0x4794('0x9'),'14400'),'defaultValue':_0x4794('0xa')},'maxrate':{'type':Sequelize[_0x4794('0x6')](_0x4794('0x7'),'4800',_0x4794('0xb'),_0x4794('0x8'),_0x4794('0x9'),_0x4794('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x4794('0x2')],'defaultValue':_0x4794('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4794('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4794('0x6')](_0x4794('0xe'),_0x4794('0xf'),_0x4794('0x10'),'KHOMP'),'defaultValue':_0x4794('0xe')},'key':{'type':Sequelize[_0x4794('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4794('0x11')],'defaultValue':function(){return _0x4794('0x12');}},'notificationSound':{'type':Sequelize[_0x4794('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4794('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4794('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4794('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4794('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4794('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4794('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4794('0x14')],'allowNull':!![],'defaultValue':null,'comment':_0x4794('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x4794('0x13')],'defaultValue':![],'comment':_0x4794('0x16'),'set':function(_0x57f31d){if(!_0x57f31d)this[_0x4794('0x17')](_0x4794('0x18'),null);this[_0x4794('0x17')](_0x4794('0x19'),_0x57f31d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index a9ddeb3..c06398e 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 _0xf186=['priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','sequelize','tech','createdAt','updatedAt','TrunkId','ListId','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','client','http','ValidationError','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','end','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','role','user','UserProfileSection','userProfileId','body','addDisposition','FaxAccountId','hasOwnProperty','sort','pick','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','tag','addApplications','transaction','FaxApplication','findAndCountAll','getApplications','from-voip-provider','system','description'];(function(_0x52f536,_0x452e8b){var _0x2ab576=function(_0x5e2b38){while(--_0x5e2b38){_0x52f536['push'](_0x52f536['shift']());}};_0x2ab576(++_0x452e8b);}(_0xf186,0x1a9));var _0x6f18=function(_0x2fca31,_0x2a89ee){_0x2fca31=_0x2fca31-0x0;var _0x25b65f=_0xf186[_0x2fca31];return _0x25b65f;};'use strict';var pdf=require(_0x6f18('0x0'));var emlformat=require(_0x6f18('0x1'));var rimraf=require(_0x6f18('0x2'));var zipdir=require(_0x6f18('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f18('0x4'));var moment=require(_0x6f18('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6f18('0x6'));var util=require(_0x6f18('0x7'));var path=require(_0x6f18('0x8'));var sox=require(_0x6f18('0x9'));var csv=require('to-csv');var ejs=require(_0x6f18('0xa'));var fs=require('fs');var _=require(_0x6f18('0xb'));var squel=require(_0x6f18('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6f18('0xd'));var querystring=require(_0x6f18('0xe'));var Papa=require(_0x6f18('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6f18('0x10'));var as=require(_0x6f18('0x11'));var hardwareService=require(_0x6f18('0x12'));var logger=require(_0x6f18('0x13'))(_0x6f18('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6f18('0x15'))['db'];config[_0x6f18('0x16')]=_[_0x6f18('0x17')](config[_0x6f18('0x16')],{'host':_0x6f18('0x18'),'port':0x18eb});var socket=require(_0x6f18('0x19'))(new Redis(config['redis']));require(_0x6f18('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6f18('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x6f18('0x1b')][_0x6f18('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x11c316,_0xc07ba0,_0x1a40b3){if(_0x1a40b3){var _0x40c6ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x40c6ee['test'](_0xc07ba0)){return _0x11c316;}else{throw new db['Sequelize'][(_0x6f18('0x1d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x11c316;}}function respondWithRpcPromise(_0x25336f,_0x420443,_0x217692,_0x28c588){return new BPromise(function(_0x1a745e,_0x2dd989){var _0x14b0b4=_0x28c588||client;return _0x14b0b4['request'](_0x25336f,_0x217692)[_0x6f18('0x1e')](function(_0x8535d5){logger[_0x6f18('0x1f')](_0x6f18('0x20'),_0x420443,'request\x20sent');logger[_0x6f18('0x21')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x420443,_0x6f18('0x22'),JSON[_0x6f18('0x23')](_0x8535d5));if(_0x8535d5['error']){if(_0x8535d5['error']['code']===0x1f4){logger[_0x6f18('0x24')](_0x6f18('0x20'),_0x420443,_0x8535d5['error'][_0x6f18('0x25')]);return _0x2dd989(_0x8535d5[_0x6f18('0x24')][_0x6f18('0x25')]);}logger[_0x6f18('0x24')](_0x6f18('0x20'),_0x420443,_0x8535d5[_0x6f18('0x24')][_0x6f18('0x25')]);return _0x1a745e(_0x8535d5[_0x6f18('0x24')][_0x6f18('0x25')]);}else{logger['info'](_0x6f18('0x20'),_0x420443,_0x6f18('0x22'));_0x1a745e(_0x8535d5['result'][_0x6f18('0x25')]);}})['catch'](function(_0x58bb27){logger['error']('FaxAccount,\x20%s,\x20%s',_0x420443,_0x58bb27);_0x2dd989(_0x58bb27);});});}function respondWithStatusCode(_0x123af4,_0x37f670){_0x37f670=_0x37f670||0xcc;return function(_0x176f47){if(_0x176f47){return _0x123af4['sendStatus'](_0x37f670);}return _0x123af4['status'](_0x37f670)[_0x6f18('0x26')]();};}function respondWithResult(_0x181c14,_0x273515){_0x273515=_0x273515||0xc8;return function(_0x688bdc){if(_0x688bdc){return _0x181c14[_0x6f18('0x27')](_0x273515)[_0x6f18('0x28')](_0x688bdc);}};}function respondWithFilteredResult(_0x4baf0b,_0x249f3d){return function(_0x553925){if(_0x553925){var _0x216588=_0x553925[_0x6f18('0x29')],_0x16cf88=_0x249f3d[_0x6f18('0x2a')],_0x4635eb=_0x249f3d[_0x6f18('0x2a')]+_0x249f3d[_0x6f18('0x2b')],_0x55bc0b;if(_0x4635eb>=_0x216588){_0x4635eb=_0x216588;_0x55bc0b=0xc8;}else{_0x55bc0b=0xce;}_0x4baf0b['status'](_0x55bc0b);return _0x4baf0b['set'](_0x6f18('0x2c'),_0x16cf88+'-'+_0x4635eb+'/'+_0x216588)[_0x6f18('0x28')](_0x553925);}return null;};}function patchUpdates(_0x171f71){return function(_0x18dcea){try{jsonpatch[_0x6f18('0x2d')](_0x18dcea,_0x171f71,!![]);}catch(_0xcdc6f0){return BPromise[_0x6f18('0x2e')](_0xcdc6f0);}return _0x18dcea[_0x6f18('0x2f')]();};}function saveUpdates(_0x1a6161,_0x272202){return function(_0x2ef951){if(_0x2ef951){return _0x2ef951['update'](_0x1a6161)['then'](function(_0x1a72aa){return _0x1a72aa;});}return null;};}function removeEntity(_0x50f690,_0x413e49){return function(_0x379464){if(_0x379464){return _0x379464[_0x6f18('0x30')]()['then'](function(){var _0x5c3fb6=_0x379464[_0x6f18('0x31')]({'plain':!![]});var _0x38e019=_0x6f18('0x32');return db[_0x6f18('0x33')]['destroy']({'where':{'type':_0x38e019,'resourceId':_0x5c3fb6['id']}})[_0x6f18('0x1e')](function(){return _0x379464;});})[_0x6f18('0x1e')](function(){_0x50f690['status'](0xcc)[_0x6f18('0x26')]();});}};}function handleEntityNotFound(_0x614dd7,_0x5b6fc0){return function(_0x329cdc){if(!_0x329cdc){_0x614dd7[_0x6f18('0x34')](0x194);}return _0x329cdc;};}function handleError(_0x51e851,_0x21f413){_0x21f413=_0x21f413||0x1f4;return function(_0x4a8e9b){logger['error'](_0x4a8e9b['stack']);if(_0x4a8e9b[_0x6f18('0x35')]){delete _0x4a8e9b['name'];}_0x51e851[_0x6f18('0x27')](_0x21f413)[_0x6f18('0x36')](_0x4a8e9b);};}exports['index']=function(_0x260629,_0x314c9b){var _0x5dffe2={'include':[{'model':db[_0x6f18('0x37')],'as':_0x6f18('0x38')}]},_0x438498={},_0x3c9243={'count':0x0,'rows':[]};var _0x1a690c=_[_0x6f18('0x39')](db[_0x6f18('0x3a')][_0x6f18('0x3b')],function(_0x5b28d6){return{'name':_0x5b28d6['fieldName'],'type':_0x5b28d6[_0x6f18('0x3c')][_0x6f18('0x3d')]};});_0x438498[_0x6f18('0x3e')]=_[_0x6f18('0x39')](_0x1a690c,_0x6f18('0x35'));_0x438498[_0x6f18('0x3f')]=_[_0x6f18('0x40')](_0x260629[_0x6f18('0x3f')]);_0x438498[_0x6f18('0x41')]=_[_0x6f18('0x42')](_0x438498[_0x6f18('0x3e')],_0x438498[_0x6f18('0x3f')]);_0x5dffe2['attributes']=_[_0x6f18('0x42')](_0x438498[_0x6f18('0x3e')],qs['fields'](_0x260629[_0x6f18('0x3f')][_0x6f18('0x43')]));_0x5dffe2[_0x6f18('0x44')]=_0x5dffe2[_0x6f18('0x44')][_0x6f18('0x45')]?_0x5dffe2['attributes']:_0x438498[_0x6f18('0x3e')];if(!_0x260629[_0x6f18('0x3f')]['hasOwnProperty'](_0x6f18('0x46'))){_0x5dffe2[_0x6f18('0x2b')]=qs['limit'](_0x260629['query']['limit']);_0x5dffe2[_0x6f18('0x2a')]=qs[_0x6f18('0x2a')](_0x260629[_0x6f18('0x3f')]['offset']);}_0x5dffe2[_0x6f18('0x47')]=qs['sort'](_0x260629[_0x6f18('0x3f')]['sort']);_0x5dffe2[_0x6f18('0x48')]=qs[_0x6f18('0x41')](_['pick'](_0x260629['query'],_0x438498['filters']),_0x1a690c);if(_0x260629[_0x6f18('0x3f')][_0x6f18('0x49')]){_0x5dffe2['where']=_['merge'](_0x5dffe2[_0x6f18('0x48')],{'$or':_[_0x6f18('0x39')](_0x1a690c,function(_0x5bc990){if(_0x5bc990['type']!==_0x6f18('0x4a')){var _0x5e3a34={};_0x5e3a34[_0x5bc990[_0x6f18('0x35')]]={'$like':'%'+_0x260629['query'][_0x6f18('0x49')]+'%'};return _0x5e3a34;}})});}_0x5dffe2=_['merge']({},_0x5dffe2,_0x260629[_0x6f18('0x4b')]);var _0x58094b={'where':_0x5dffe2[_0x6f18('0x48')]};return db['FaxAccount'][_0x6f18('0x29')](_0x58094b)['then'](function(_0x4804be){_0x3c9243[_0x6f18('0x29')]=_0x4804be;if(_0x260629[_0x6f18('0x3f')][_0x6f18('0x4c')]){_0x5dffe2[_0x6f18('0x4d')]=[{'all':!![]}];}return db[_0x6f18('0x3a')][_0x6f18('0x4e')](_0x5dffe2);})[_0x6f18('0x1e')](function(_0x52c09b){_0x3c9243[_0x6f18('0x4f')]=_0x52c09b;return _0x3c9243;})[_0x6f18('0x1e')](respondWithFilteredResult(_0x314c9b,_0x5dffe2))[_0x6f18('0x50')](handleError(_0x314c9b,null));};exports[_0x6f18('0x51')]=function(_0x100cbd,_0x22403e){var _0x2714a0={'raw':![],'where':{'id':_0x100cbd[_0x6f18('0x52')]['id']},'include':[{'model':db[_0x6f18('0x37')],'as':_0x6f18('0x38')}]},_0x30d5d0={};_0x30d5d0[_0x6f18('0x3e')]=_['keys'](db['FaxAccount'][_0x6f18('0x3b')]);_0x30d5d0[_0x6f18('0x3f')]=_[_0x6f18('0x40')](_0x100cbd[_0x6f18('0x3f')]);_0x30d5d0[_0x6f18('0x41')]=_[_0x6f18('0x42')](_0x30d5d0[_0x6f18('0x3e')],_0x30d5d0[_0x6f18('0x3f')]);_0x2714a0[_0x6f18('0x44')]=_[_0x6f18('0x42')](_0x30d5d0[_0x6f18('0x3e')],qs[_0x6f18('0x43')](_0x100cbd[_0x6f18('0x3f')][_0x6f18('0x43')]));_0x2714a0[_0x6f18('0x44')]=_0x2714a0[_0x6f18('0x44')][_0x6f18('0x45')]?_0x2714a0[_0x6f18('0x44')]:_0x30d5d0[_0x6f18('0x3e')];if(_0x100cbd[_0x6f18('0x3f')][_0x6f18('0x4c')]){_0x2714a0[_0x6f18('0x4d')]=[{'all':!![]}];}_0x2714a0=_[_0x6f18('0x53')]({},_0x2714a0,_0x100cbd[_0x6f18('0x4b')]);return db['FaxAccount'][_0x6f18('0x54')](_0x2714a0)[_0x6f18('0x1e')](handleEntityNotFound(_0x22403e,null))[_0x6f18('0x1e')](respondWithResult(_0x22403e,null))[_0x6f18('0x50')](handleError(_0x22403e,null));};exports[_0x6f18('0x55')]=function(_0x27b6be,_0xcf7c0b){return db[_0x6f18('0x3a')]['create'](_0x27b6be['body'],{})['then'](function(_0xccd20e){var _0x499277=_0x27b6be['user']['get']({'plain':!![]});if(!_0x499277)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x499277[_0x6f18('0x56')]===_0x6f18('0x57')){var _0x6664fa=_0xccd20e[_0x6f18('0x31')]({'plain':!![]});var _0x144417=_0x6f18('0x32');return db[_0x6f18('0x58')][_0x6f18('0x54')]({'where':{'name':_0x144417,'userProfileId':_0x499277[_0x6f18('0x59')]},'raw':!![]})[_0x6f18('0x1e')](function(_0x5938a4){if(_0x5938a4&&_0x5938a4['autoAssociation']===0x0){return db['UserProfileResource'][_0x6f18('0x55')]({'name':_0x6664fa[_0x6f18('0x35')],'resourceId':_0x6664fa['id'],'type':_0x5938a4[_0x6f18('0x35')],'sectionId':_0x5938a4['id']},{})[_0x6f18('0x1e')](function(){return _0xccd20e;});}else{return _0xccd20e;}})['catch'](function(_0x177cff){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x177cff);throw _0x177cff;});}return _0xccd20e;})[_0x6f18('0x1e')](respondWithResult(_0xcf7c0b,0xc9))['catch'](handleError(_0xcf7c0b,null));};exports['update']=function(_0x327a7a,_0x2c7047){if(_0x327a7a[_0x6f18('0x5a')]['id']){delete _0x327a7a[_0x6f18('0x5a')]['id'];}return db[_0x6f18('0x3a')][_0x6f18('0x54')]({'where':{'id':_0x327a7a['params']['id']},'include':[{'model':db['Pause'],'as':_0x6f18('0x38')}]})[_0x6f18('0x1e')](handleEntityNotFound(_0x2c7047,null))['then'](saveUpdates(_0x327a7a[_0x6f18('0x5a')],null))[_0x6f18('0x1e')](respondWithResult(_0x2c7047,null))[_0x6f18('0x50')](handleError(_0x2c7047,null));};exports[_0x6f18('0x30')]=function(_0x30d588,_0x5c425e){return db[_0x6f18('0x3a')][_0x6f18('0x54')]({'where':{'id':_0x30d588[_0x6f18('0x52')]['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x5c425e,null))[_0x6f18('0x1e')](removeEntity(_0x5c425e,null))['catch'](handleError(_0x5c425e,null));};exports['describe']=function(_0x302e08,_0x232071){return db['FaxAccount']['describe']()[_0x6f18('0x1e')](respondWithResult(_0x232071,null))[_0x6f18('0x50')](handleError(_0x232071,null));};exports[_0x6f18('0x5b')]=function(_0xda4b97,_0x1f2c80,_0xce9d21){if(_0xda4b97['body']['id']){delete _0xda4b97[_0x6f18('0x5a')]['id'];}return db['FaxAccount'][_0x6f18('0x54')]({'where':{'id':_0xda4b97[_0x6f18('0x52')]['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x1f2c80,null))['then'](function(_0x362c34){if(_0x362c34){_0xda4b97[_0x6f18('0x5a')][_0x6f18('0x5c')]=_0x362c34['id'];return db['Disposition'][_0x6f18('0x55')](_0xda4b97[_0x6f18('0x5a')]);}})['then'](respondWithResult(_0x1f2c80,null))[_0x6f18('0x50')](handleError(_0x1f2c80,null));};exports['getDispositions']=function(_0x904fc2,_0x1481be,_0x573526){var _0x5dfedb={'raw':![],'where':{}};var _0x4954f5={};var _0x42ef2d={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x904fc2['params']['id']}})['then'](handleEntityNotFound(_0x1481be,null))[_0x6f18('0x1e')](function(_0x5000ab){if(_0x5000ab){_0x4954f5[_0x6f18('0x3e')]=_[_0x6f18('0x40')](db['Disposition']['rawAttributes']);_0x4954f5[_0x6f18('0x3f')]=_[_0x6f18('0x40')](_0x904fc2[_0x6f18('0x3f')]);_0x4954f5[_0x6f18('0x41')]=_['intersection'](_0x4954f5[_0x6f18('0x3e')],_0x4954f5[_0x6f18('0x3f')]);_0x5dfedb[_0x6f18('0x44')]=_[_0x6f18('0x42')](_0x4954f5['model'],qs[_0x6f18('0x43')](_0x904fc2['query'][_0x6f18('0x43')]));_0x5dfedb[_0x6f18('0x44')]=_0x5dfedb[_0x6f18('0x44')][_0x6f18('0x45')]?_0x5dfedb['attributes']:_0x4954f5[_0x6f18('0x3e')];if(!_0x904fc2[_0x6f18('0x3f')][_0x6f18('0x5d')](_0x6f18('0x46'))){_0x5dfedb[_0x6f18('0x2b')]=qs[_0x6f18('0x2b')](_0x904fc2['query'][_0x6f18('0x2b')]);_0x5dfedb[_0x6f18('0x2a')]=qs[_0x6f18('0x2a')](_0x904fc2['query'][_0x6f18('0x2a')]);}_0x5dfedb[_0x6f18('0x47')]=qs[_0x6f18('0x5e')](_0x904fc2['query'][_0x6f18('0x5e')]);_0x5dfedb[_0x6f18('0x48')]=qs[_0x6f18('0x41')](_[_0x6f18('0x5f')](_0x904fc2[_0x6f18('0x3f')],_0x4954f5[_0x6f18('0x41')]));_0x5dfedb[_0x6f18('0x48')][_0x6f18('0x5c')]=_0x5000ab['id'];if(_0x904fc2[_0x6f18('0x3f')]['filter']){_0x5dfedb[_0x6f18('0x48')]=_[_0x6f18('0x53')](_0x5dfedb[_0x6f18('0x48')],{'$or':_[_0x6f18('0x39')](_0x5dfedb['attributes'],function(_0x4ce2a3){var _0x26b5cd={};_0x26b5cd[_0x4ce2a3]={'$like':'%'+_0x904fc2[_0x6f18('0x3f')]['filter']+'%'};return _0x26b5cd;})});}_0x5dfedb=_[_0x6f18('0x53')]({},_0x5dfedb,_0x904fc2[_0x6f18('0x4b')]);return db[_0x6f18('0x60')]['count']({'where':_0x5dfedb[_0x6f18('0x48')]})['then'](function(_0x585837){_0x42ef2d[_0x6f18('0x29')]=_0x585837;if(_0x904fc2['query']['includeAll']){_0x5dfedb[_0x6f18('0x4d')]=[{'all':!![]}];}return db[_0x6f18('0x60')][_0x6f18('0x4e')](_0x5dfedb);})['then'](function(_0x35f866){_0x42ef2d['rows']=_0x35f866;return _0x42ef2d;});}})[_0x6f18('0x1e')](respondWithFilteredResult(_0x1481be,_0x5dfedb))[_0x6f18('0x50')](handleError(_0x1481be,null));};exports['removeDispositions']=function(_0x4216c5,_0x488416,_0x536b0e){return db[_0x6f18('0x3a')][_0x6f18('0x54')]({'where':{'id':_0x4216c5[_0x6f18('0x52')]['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x488416,null))[_0x6f18('0x1e')](function(_0x3ed180){if(_0x3ed180){return _0x3ed180[_0x6f18('0x61')](_0x4216c5['query'][_0x6f18('0x62')]);}})['then'](respondWithStatusCode(_0x488416,null))[_0x6f18('0x50')](handleError(_0x488416,null));};exports[_0x6f18('0x63')]=function(_0x58827f,_0x2e6bc3,_0x282a06){if(_0x58827f[_0x6f18('0x5a')]['id']){delete _0x58827f[_0x6f18('0x5a')]['id'];}return db[_0x6f18('0x3a')][_0x6f18('0x54')]({'where':{'id':_0x58827f['params']['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x2e6bc3,null))[_0x6f18('0x1e')](function(_0x4b2502){if(_0x4b2502){_0x58827f[_0x6f18('0x5a')][_0x6f18('0x5c')]=_0x4b2502['id'];return db[_0x6f18('0x64')][_0x6f18('0x55')](_0x58827f[_0x6f18('0x5a')]);}})[_0x6f18('0x1e')](respondWithResult(_0x2e6bc3,null))['catch'](handleError(_0x2e6bc3,null));};exports[_0x6f18('0x65')]=function(_0x5c01e6,_0x2c91cd,_0x29b98f){var _0x157fe8={'raw':![],'where':{}};var _0x1c1f35={};var _0x436dc5={'count':0x0,'rows':[]};return db[_0x6f18('0x3a')][_0x6f18('0x66')]({'where':{'id':_0x5c01e6[_0x6f18('0x52')]['id']}})['then'](handleEntityNotFound(_0x2c91cd,null))['then'](function(_0x2d590a){if(_0x2d590a){_0x1c1f35[_0x6f18('0x3e')]=_[_0x6f18('0x40')](db[_0x6f18('0x64')][_0x6f18('0x3b')]);_0x1c1f35[_0x6f18('0x3f')]=_[_0x6f18('0x40')](_0x5c01e6['query']);_0x1c1f35[_0x6f18('0x41')]=_[_0x6f18('0x42')](_0x1c1f35['model'],_0x1c1f35[_0x6f18('0x3f')]);_0x157fe8[_0x6f18('0x44')]=_[_0x6f18('0x42')](_0x1c1f35[_0x6f18('0x3e')],qs[_0x6f18('0x43')](_0x5c01e6[_0x6f18('0x3f')]['fields']));_0x157fe8['attributes']=_0x157fe8[_0x6f18('0x44')][_0x6f18('0x45')]?_0x157fe8[_0x6f18('0x44')]:_0x1c1f35['model'];if(!_0x5c01e6[_0x6f18('0x3f')][_0x6f18('0x5d')](_0x6f18('0x46'))){_0x157fe8['limit']=qs[_0x6f18('0x2b')](_0x5c01e6[_0x6f18('0x3f')][_0x6f18('0x2b')]);_0x157fe8['offset']=qs[_0x6f18('0x2a')](_0x5c01e6[_0x6f18('0x3f')]['offset']);}_0x157fe8[_0x6f18('0x47')]=qs[_0x6f18('0x5e')](_0x5c01e6[_0x6f18('0x3f')]['sort']);_0x157fe8[_0x6f18('0x48')]=qs[_0x6f18('0x41')](_[_0x6f18('0x5f')](_0x5c01e6[_0x6f18('0x3f')],_0x1c1f35[_0x6f18('0x41')]));_0x157fe8['where'][_0x6f18('0x5c')]=_0x2d590a['id'];if(_0x5c01e6[_0x6f18('0x3f')]['filter']){_0x157fe8[_0x6f18('0x48')]=_[_0x6f18('0x53')](_0x157fe8[_0x6f18('0x48')],{'$or':_[_0x6f18('0x39')](_0x157fe8['attributes'],function(_0xe2b862){var _0x37e554={};_0x37e554[_0xe2b862]={'$like':'%'+_0x5c01e6[_0x6f18('0x3f')]['filter']+'%'};return _0x37e554;})});}_0x157fe8=_[_0x6f18('0x53')]({},_0x157fe8,_0x5c01e6[_0x6f18('0x4b')]);return db[_0x6f18('0x64')]['count']({'where':_0x157fe8[_0x6f18('0x48')]})[_0x6f18('0x1e')](function(_0x599f91){_0x436dc5['count']=_0x599f91;if(_0x5c01e6[_0x6f18('0x3f')][_0x6f18('0x4c')]){_0x157fe8[_0x6f18('0x4d')]=[{'all':!![]}];}return db[_0x6f18('0x64')][_0x6f18('0x4e')](_0x157fe8);})['then'](function(_0x191198){_0x436dc5['rows']=_0x191198;return _0x436dc5;});}})[_0x6f18('0x1e')](respondWithFilteredResult(_0x2c91cd,_0x157fe8))[_0x6f18('0x50')](handleError(_0x2c91cd,null));};exports[_0x6f18('0x67')]=function(_0x5f2107,_0x4c8461,_0x59b907){return db['FaxAccount'][_0x6f18('0x54')]({'where':{'id':_0x5f2107['params']['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x4c8461,null))['then'](function(_0x2b7c01){if(_0x2b7c01){return _0x2b7c01[_0x6f18('0x67')](_0x5f2107[_0x6f18('0x3f')][_0x6f18('0x62')]);}})[_0x6f18('0x1e')](respondWithStatusCode(_0x4c8461,null))[_0x6f18('0x50')](handleError(_0x4c8461,null));};exports[_0x6f18('0x68')]=function(_0x5b038b,_0x151704,_0x1a293c){return db[_0x6f18('0x69')]['find']({'where':{'id':_0x5b038b[_0x6f18('0x52')]['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x151704,null))['then'](function(_0x15fbd1){if(_0x15fbd1){return _0x15fbd1[_0x6f18('0x68')](_0x5b038b[_0x6f18('0x5a')][_0x6f18('0x62')],_[_0x6f18('0x6a')](_0x5b038b[_0x6f18('0x5a')],['ids','id'])||{});}})[_0x6f18('0x1e')](respondWithResult(_0x151704,null))[_0x6f18('0x50')](handleError(_0x151704,null));};exports[_0x6f18('0x6b')]=function(_0x1e25b5,_0x494baf,_0x585c31){var _0x379a5e={'raw':![],'where':{}};var _0x41b033={};var _0x315c91={'count':0x0,'rows':[]};return db[_0x6f18('0x3a')][_0x6f18('0x66')]({'where':{'id':_0x1e25b5[_0x6f18('0x52')]['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x494baf,null))['then'](function(_0x1046cb){if(_0x1046cb){_0x41b033[_0x6f18('0x3e')]=_[_0x6f18('0x40')](db[_0x6f18('0x69')][_0x6f18('0x3b')]);_0x41b033[_0x6f18('0x3f')]=_[_0x6f18('0x40')](_0x1e25b5['query']);_0x41b033['filters']=_['intersection'](_0x41b033[_0x6f18('0x3e')],_0x41b033[_0x6f18('0x3f')]);_0x379a5e[_0x6f18('0x44')]=_[_0x6f18('0x42')](_0x41b033[_0x6f18('0x3e')],qs[_0x6f18('0x43')](_0x1e25b5[_0x6f18('0x3f')][_0x6f18('0x43')]));_0x379a5e[_0x6f18('0x44')]=_0x379a5e['attributes'][_0x6f18('0x45')]?_0x379a5e[_0x6f18('0x44')]:_0x41b033[_0x6f18('0x3e')];if(!_0x1e25b5[_0x6f18('0x3f')][_0x6f18('0x5d')](_0x6f18('0x46'))){_0x379a5e[_0x6f18('0x2b')]=qs[_0x6f18('0x2b')](_0x1e25b5[_0x6f18('0x3f')][_0x6f18('0x2b')]);_0x379a5e[_0x6f18('0x2a')]=qs[_0x6f18('0x2a')](_0x1e25b5[_0x6f18('0x3f')][_0x6f18('0x2a')]);}_0x379a5e[_0x6f18('0x47')]=qs[_0x6f18('0x5e')](_0x1e25b5[_0x6f18('0x3f')][_0x6f18('0x5e')]);_0x379a5e[_0x6f18('0x48')]=qs[_0x6f18('0x41')](_[_0x6f18('0x5f')](_0x1e25b5['query'],_0x41b033[_0x6f18('0x41')]));_0x379a5e[_0x6f18('0x48')]['FaxAccountId']=_0x1046cb['id'];if(_0x1e25b5[_0x6f18('0x3f')][_0x6f18('0x49')]){_0x379a5e[_0x6f18('0x48')]=_[_0x6f18('0x53')](_0x379a5e[_0x6f18('0x48')],{'$or':_[_0x6f18('0x39')](_0x379a5e[_0x6f18('0x44')],function(_0x1e444a){var _0x35e31d={};_0x35e31d[_0x1e444a]={'$like':'%'+_0x1e25b5[_0x6f18('0x3f')][_0x6f18('0x49')]+'%'};return _0x35e31d;})});}_0x379a5e=_[_0x6f18('0x53')]({},_0x379a5e,_0x1e25b5[_0x6f18('0x4b')]);return db[_0x6f18('0x69')]['count']({'where':_0x379a5e[_0x6f18('0x48')]})['then'](function(_0x33ac52){_0x315c91[_0x6f18('0x29')]=_0x33ac52;if(_0x1e25b5[_0x6f18('0x3f')][_0x6f18('0x4c')]){_0x379a5e[_0x6f18('0x4d')]=[{'model':db[_0x6f18('0x6c')],'as':_0x6f18('0x6d'),'required':![]},{'model':db[_0x6f18('0x6e')],'as':_0x6f18('0x6f'),'attributes':[_0x6f18('0x35'),_0x6f18('0x70'),_0x6f18('0x71')],'required':![]},{'model':db['Tag'],'as':_0x6f18('0x72'),'attributes':['id','name','color'],'where':_0x1e25b5[_0x6f18('0x3f')][_0x6f18('0x73')]?{'id':_0x1e25b5[_0x6f18('0x3f')][_0x6f18('0x73')]}:undefined,'required':_0x1e25b5[_0x6f18('0x3f')][_0x6f18('0x73')]?!![]:![]}];}return db[_0x6f18('0x69')][_0x6f18('0x4e')](_0x379a5e);})['then'](function(_0x3017f6){_0x315c91[_0x6f18('0x4f')]=_0x3017f6;return _0x315c91;});}})['then'](respondWithFilteredResult(_0x494baf,_0x379a5e))[_0x6f18('0x50')](handleError(_0x494baf,null));};exports[_0x6f18('0x74')]=function(_0x32a933,_0x2a67d8,_0x3e8ceb){return db[_0x6f18('0x3a')][_0x6f18('0x66')]({'where':{'id':_0x32a933['params']['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x2a67d8,null))[_0x6f18('0x1e')](function(_0x2a2e17){if(_0x2a2e17){return db['sequelize'][_0x6f18('0x75')](function(_0x128f4d){return db[_0x6f18('0x76')]['destroy']({'where':{'FaxAccountId':_0x32a933[_0x6f18('0x52')]['id']},'transaction':_0x128f4d})['then'](function(_0x5d47f5){var _0x24c7ac=_[_0x6f18('0x39')](_0x32a933[_0x6f18('0x5a')],function(_0x39c8cc){_0x39c8cc[_0x6f18('0x5c')]=_0x32a933[_0x6f18('0x52')]['id'];return _0x39c8cc;});return db[_0x6f18('0x76')]['bulkCreate'](_0x24c7ac,{'transaction':_0x128f4d});});})[_0x6f18('0x1e')](function(){return db[_0x6f18('0x76')][_0x6f18('0x77')]({'where':{'FaxAccountId':_0x32a933[_0x6f18('0x52')]['id']},'order':'priority'});});}})[_0x6f18('0x1e')](respondWithResult(_0x2a67d8,null))[_0x6f18('0x50')](handleError(_0x2a67d8,null));};exports[_0x6f18('0x78')]=function(_0x381eee,_0x1637f1,_0x568336){var _0x78b309={};var _0x6fe0e8={};var _0xe4f412;var _0x159f02;return db[_0x6f18('0x3a')][_0x6f18('0x66')]({'where':{'id':_0x381eee[_0x6f18('0x52')]['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x1637f1,null))[_0x6f18('0x1e')](function(_0x34ca4e){if(_0x34ca4e){_0xe4f412=_0x34ca4e;_0x6fe0e8[_0x6f18('0x3e')]=_[_0x6f18('0x40')](db['FaxApplication'][_0x6f18('0x3b')]);_0x6fe0e8['query']=_['keys'](_0x381eee[_0x6f18('0x3f')]);_0x6fe0e8[_0x6f18('0x41')]=_[_0x6f18('0x42')](_0x6fe0e8[_0x6f18('0x3e')],_0x6fe0e8[_0x6f18('0x3f')]);_0x78b309[_0x6f18('0x44')]=_[_0x6f18('0x42')](_0x6fe0e8[_0x6f18('0x3e')],qs[_0x6f18('0x43')](_0x381eee['query'][_0x6f18('0x43')]));_0x78b309['attributes']=_0x78b309['attributes'][_0x6f18('0x45')]?_0x78b309[_0x6f18('0x44')]:_0x6fe0e8['model'];_0x78b309['order']=qs['sort'](_0x381eee[_0x6f18('0x3f')]['sort']);_0x78b309[_0x6f18('0x48')]=qs[_0x6f18('0x41')](_[_0x6f18('0x5f')](_0x381eee[_0x6f18('0x3f')],_0x6fe0e8[_0x6f18('0x41')]));if(_0x381eee[_0x6f18('0x3f')]['filter']){_0x78b309[_0x6f18('0x48')]=_['merge'](_0x78b309[_0x6f18('0x48')],{'$or':_[_0x6f18('0x39')](_0x78b309[_0x6f18('0x44')],function(_0x5428a3){var _0x404246={};_0x404246[_0x5428a3]={'$like':'%'+_0x381eee[_0x6f18('0x3f')]['filter']+'%'};return _0x404246;})});}_0x78b309=_[_0x6f18('0x53')]({},_0x78b309,_0x381eee[_0x6f18('0x4b')]);return _0xe4f412['getApplications'](_0x78b309);}})[_0x6f18('0x1e')](function(_0xbff092){if(_0xbff092){_0x159f02=_0xbff092[_0x6f18('0x45')];if(!_0x381eee[_0x6f18('0x3f')][_0x6f18('0x5d')](_0x6f18('0x46'))){_0x78b309[_0x6f18('0x2b')]=qs[_0x6f18('0x2b')](_0x381eee[_0x6f18('0x3f')][_0x6f18('0x2b')]);_0x78b309[_0x6f18('0x2a')]=qs[_0x6f18('0x2a')](_0x381eee[_0x6f18('0x3f')][_0x6f18('0x2a')]);}return _0xe4f412[_0x6f18('0x78')](_0x78b309);}})[_0x6f18('0x1e')](function(_0x26b05d){if(_0x26b05d){return _0x26b05d?{'count':_0x159f02,'rows':_0x26b05d}:null;}})[_0x6f18('0x1e')](respondWithResult(_0x1637f1,null))[_0x6f18('0x50')](handleError(_0x1637f1,null));};function Extension(_0x1fe9dd,_0x560fdb,_0x379910,_0x456710){this['context']=_0x6f18('0x79');this['exten']=_0x1fe9dd['localstationid'];this['app']=_0x456710;this['type']=_0x6f18('0x7a');this[_0x6f18('0x7b')]='Fax\x20Extension';this[_0x6f18('0x5c')]=_0x1fe9dd['id'];this[_0x6f18('0x7c')]=_0x560fdb;this[_0x6f18('0x7d')]=_0x379910;}function createExtensionsReciveFax(_0x5cb557){var _0x34406e=0x1;var _0x43477a=[];_0x43477a[_0x6f18('0x7e')](new Extension(_0x5cb557,_0x34406e,'',_0x6f18('0x7f')));_0x34406e+=0x1;_0x43477a[_0x6f18('0x7e')](new Extension(_0x5cb557,_0x34406e,_0x6f18('0x80'),_0x6f18('0x81')));_0x34406e+=0x1;for(var _0x2b1d6b in _0x5cb557){if(_0x5cb557[_0x6f18('0x5d')](_0x2b1d6b)&&(_0x2b1d6b===_0x6f18('0x82')||_0x2b1d6b===_0x6f18('0x83')||_0x2b1d6b==='gateway'||_0x2b1d6b==='faxdetect'||_0x2b1d6b===_0x6f18('0x84')||_0x2b1d6b===_0x6f18('0x85')||_0x2b1d6b==='minrate'||_0x2b1d6b===_0x6f18('0x86')||_0x2b1d6b===_0x6f18('0x87'))){_0x43477a[_0x6f18('0x7e')](new Extension(_0x5cb557,_0x34406e,_0x6f18('0x88')+_0x2b1d6b+')='+_0x5cb557[_0x2b1d6b],_0x6f18('0x81')));_0x34406e+=0x1;}}_0x43477a['push'](new Extension(_0x5cb557,_0x34406e,'6',_0x6f18('0x89')));_0x34406e+=0x1;_0x43477a[_0x6f18('0x7e')](new Extension(_0x5cb557,_0x34406e,_0x6f18('0x8a'),_0x6f18('0x8b')));_0x34406e=0x0;return _0x43477a;}exports[_0x6f18('0x8c')]=function(_0x1842e8,_0x4e4f0a,_0x50d33f){var _0x295d0c;return db['sequelize'][_0x6f18('0x75')](function(_0x583e9e){return db[_0x6f18('0x3a')][_0x6f18('0x55')](_0x1842e8['body'],{'transaction':_0x583e9e})['then'](function(_0x4f7988){_0x295d0c=_0x4f7988[_0x6f18('0x31')]({'plain':!![]});return db[_0x6f18('0x8d')][_0x6f18('0x8e')](createExtensionsReciveFax(_0x295d0c),{'transaction':_0x583e9e});});})[_0x6f18('0x1e')](function(){return _0x295d0c;})['then'](respondWithResult(_0x4e4f0a,null))['catch'](handleError(_0x4e4f0a,null));};exports[_0x6f18('0x8f')]=function(_0x2cfe62,_0x478c62,_0x216525){var _0x5ea257;return db[_0x6f18('0x90')]['transaction'](function(_0x2a2c1e){return db[_0x6f18('0x3a')]['update'](_0x2cfe62[_0x6f18('0x5a')],{'where':{'id':_0x2cfe62[_0x6f18('0x5a')]['id']},'transaction':_0x2a2c1e})[_0x6f18('0x1e')](function(_0x327915){return db[_0x6f18('0x8d')][_0x6f18('0x30')]({'where':{'FaxAccountId':_0x2cfe62[_0x6f18('0x5a')]['id']},'transaction':_0x2a2c1e})['then'](function(_0x1fd457){return db['VoiceExtension'][_0x6f18('0x8e')](createExtensionsReciveFax(_[_0x6f18('0x6a')](_0x2cfe62['body'],[_0x6f18('0x91'),_0x6f18('0x3d'),_0x6f18('0x92'),_0x6f18('0x93'),_0x6f18('0x94'),_0x6f18('0x95')])),{'transaction':_0x2a2c1e});});});})[_0x6f18('0x1e')](function(){return db['FaxAccount']['findById'](_0x2cfe62['body']['id']);})[_0x6f18('0x1e')](respondWithResult(_0x478c62,null))[_0x6f18('0x50')](handleError(_0x478c62,null));};exports['getMessages']=function(_0x39a255,_0x430740,_0x5d9525){var _0x4f2495={'raw':!![],'where':{}};var _0x2c7060={};var _0x2f983d={'count':0x0,'rows':[]};return db[_0x6f18('0x3a')][_0x6f18('0x66')]({'where':{'id':_0x39a255[_0x6f18('0x52')]['id']}})['then'](handleEntityNotFound(_0x430740,null))[_0x6f18('0x1e')](function(_0x1478a2){if(_0x1478a2){_0x2c7060[_0x6f18('0x3e')]=_['keys'](db[_0x6f18('0x96')][_0x6f18('0x3b')]);_0x2c7060['query']=_['keys'](_0x39a255[_0x6f18('0x3f')]);_0x2c7060[_0x6f18('0x41')]=_[_0x6f18('0x42')](_0x2c7060[_0x6f18('0x3e')],_0x2c7060[_0x6f18('0x3f')]);_0x4f2495[_0x6f18('0x44')]=_[_0x6f18('0x42')](_0x2c7060[_0x6f18('0x3e')],qs[_0x6f18('0x43')](_0x39a255['query'][_0x6f18('0x43')]));_0x4f2495['attributes']=_0x4f2495[_0x6f18('0x44')][_0x6f18('0x45')]?_0x4f2495[_0x6f18('0x44')]:_0x2c7060[_0x6f18('0x3e')];if(!_0x39a255[_0x6f18('0x3f')][_0x6f18('0x5d')](_0x6f18('0x46'))){_0x4f2495[_0x6f18('0x2b')]=qs[_0x6f18('0x2b')](_0x39a255['query']['limit']);_0x4f2495[_0x6f18('0x2a')]=qs[_0x6f18('0x2a')](_0x39a255['query'][_0x6f18('0x2a')]);}_0x4f2495[_0x6f18('0x47')]=qs['sort'](_0x39a255[_0x6f18('0x3f')][_0x6f18('0x5e')]);_0x4f2495[_0x6f18('0x48')]=qs[_0x6f18('0x41')](_[_0x6f18('0x5f')](_0x39a255['query'],_0x2c7060['filters']));_0x4f2495[_0x6f18('0x48')][_0x6f18('0x5c')]=_0x1478a2['id'];if(_0x39a255[_0x6f18('0x3f')][_0x6f18('0x49')]){_0x4f2495['where']=_['merge'](_0x4f2495[_0x6f18('0x48')],{'$or':_[_0x6f18('0x39')](_0x4f2495['attributes'],function(_0x2be1d3){var _0x2a782c={};_0x2a782c[_0x2be1d3]={'$like':'%'+_0x39a255[_0x6f18('0x3f')][_0x6f18('0x49')]+'%'};return _0x2a782c;})});}if(_0x39a255[_0x6f18('0x3f')][_0x6f18('0x97')]){var _0x17bff2=_0x39a255[_0x6f18('0x3f')]['$gte']['split'](',');var _0xcf1d8d={};_0xcf1d8d[_0x17bff2[0x0]]={'$gte':moment(_0x17bff2[0x1])[_0x6f18('0x98')](_0x6f18('0x99'))};_0x4f2495[_0x6f18('0x48')]=_[_0x6f18('0x53')](_0x4f2495[_0x6f18('0x48')],_0xcf1d8d);}_0x4f2495=_['merge']({},_0x4f2495,_0x39a255[_0x6f18('0x4b')]);return db[_0x6f18('0x96')]['count']({'where':_0x4f2495[_0x6f18('0x48')]})[_0x6f18('0x1e')](function(_0xf4aab7){_0x2f983d[_0x6f18('0x29')]=_0xf4aab7;if(_0x39a255['query']['includeAll']){_0x4f2495[_0x6f18('0x4d')]=[{'all':!![]}];}return db[_0x6f18('0x96')][_0x6f18('0x4e')](_0x4f2495);})[_0x6f18('0x1e')](function(_0x181665){_0x2f983d[_0x6f18('0x4f')]=_0x181665;return _0x2f983d;});}})[_0x6f18('0x1e')](respondWithFilteredResult(_0x430740,_0x4f2495))[_0x6f18('0x50')](handleError(_0x430740,null));};exports['send']=function(_0x5f0b98,_0x96f5ac,_0xe37ed9){var _0x58c250,_0x342c88={},_0x3838c7;if(_0x5f0b98[_0x6f18('0x5a')]['to']){_0x3838c7=_0x5f0b98[_0x6f18('0x5a')]['to'][0x0];}return db[_0x6f18('0x3a')]['find']({'where':{'id':_0x5f0b98[_0x6f18('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0x6f18('0x9a'),'include':[{'model':db[_0x6f18('0x6c')],'as':_0x6f18('0x9b'),'where':{'fax':_0x3838c7},'limit':0x1,'order':[[_0x6f18('0x93'),_0x6f18('0x9c')]]}]}]})[_0x6f18('0x1e')](handleEntityNotFound(_0x96f5ac,null))[_0x6f18('0x1e')](function(_0x32a5cd){_0x58c250=_0x32a5cd;if(_0x5f0b98['body'][_0x6f18('0x9d')]&&_0x5f0b98['body']['attachments'][_0x6f18('0x45')]){for(var _0x2aebce=0x0;_0x2aebce<_0x5f0b98['body'][_0x6f18('0x9d')][_0x6f18('0x45')];_0x2aebce+=0x1){_0x5f0b98[_0x6f18('0x5a')][_0x6f18('0x9d')][_0x2aebce]={'filename':_0x5f0b98[_0x6f18('0x5a')][_0x6f18('0x9d')][_0x2aebce][_0x6f18('0x35')],'id':_0x5f0b98[_0x6f18('0x5a')][_0x6f18('0x9d')][_0x2aebce]['id'],'path':path[_0x6f18('0x9e')](config[_0x6f18('0x9f')],_0x6f18('0xa0'),_0x5f0b98[_0x6f18('0x5a')][_0x6f18('0x9d')][_0x2aebce][_0x6f18('0xa1')])};}}return respondWithRpcPromise(_0x6f18('0xa2'),_0x6f18('0xa2'),{'FaxAccountId':_[_0x6f18('0xa3')](_0x5f0b98[_0x6f18('0x52')]['id'])?undefined:_0x5f0b98['params']['id'],'path':_[_0x6f18('0xa3')](_0x5f0b98['body']['attachments'][0x0]['path'])?undefined:_0x5f0b98[_0x6f18('0x5a')][_0x6f18('0x9d')][0x0]['path'],'fax':_[_0x6f18('0xa3')](_0x5f0b98[_0x6f18('0x5a')]['to'][0x0])?undefined:_0x5f0b98['body']['to'][0x0]},client9002);})[_0x6f18('0x1e')](function(){if(_0x58c250){if(_[_0x6f18('0xa3')](_0x5f0b98['body']['from'])){_0x5f0b98['body'][_0x6f18('0xa4')]=util[_0x6f18('0x98')](_0x6f18('0xa5'),_0x58c250[_0x6f18('0x35')],_0x58c250[_0x6f18('0xa6')]);}if(_0x58c250[_0x6f18('0x9a')]){if(_0x58c250[_0x6f18('0x9a')][_0x6f18('0x9b')][_0x6f18('0x45')]){return _0x58c250[_0x6f18('0x9a')][_0x6f18('0x9b')][0x0];}else{return db[_0x6f18('0x6c')][_0x6f18('0x55')](_[_0x6f18('0x17')](_0x5f0b98[_0x6f18('0x5a')],{'firstName':_0x5f0b98[_0x6f18('0x5a')]['to'][0x0],'phone':_0x5f0b98[_0x6f18('0x5a')]['to'][0x0],'fax':_0x5f0b98[_0x6f18('0x5a')]['to'][0x0],'ListId':_0x58c250['ListId']}));}}else{throw new Error(_0x6f18('0xa7'));}}else{throw new Error(_0x6f18('0xa8'));}})[_0x6f18('0x1e')](function(_0xe06988){if(_0xe06988){return db[_0x6f18('0x69')][_0x6f18('0x54')]({'where':{'ContactId':_0xe06988['id'],'closed':![],'FaxAccountId':_0x58c250['id']}})[_0x6f18('0x1e')](function(_0x17a328){if(_0x17a328){return[_0x17a328,![]];}return db[_0x6f18('0x69')][_0x6f18('0x55')]({'UserId':_0x5f0b98['user']['id'],'ContactId':_0xe06988['id'],'FaxAccountId':_0x58c250['id'],'fax':_0x5f0b98[_0x6f18('0x5a')]['to'][0x0],'firstMsgDirection':_0x6f18('0xa9'),'Messages':[_['merge'](_0x5f0b98['body'],{'read':![],'body':_0x5f0b98[_0x6f18('0x5a')]['attachments'][0x0][_0x6f18('0xaa')],'FaxAccountId':_0x58c250['id'],'UserId':_0x5f0b98[_0x6f18('0x57')]['id'],'ContactId':_0xe06988['id'],'AttachmentId':_0x5f0b98['body'][_0x6f18('0x9d')][0x0]['id']})]},{'include':[{'model':db[_0x6f18('0x96')],'as':_0x6f18('0xab')}]})['then'](function(_0x5a410e){return[_0x5a410e,!![]];});});}else{throw new Error(_0x6f18('0xac'));}})[_0x6f18('0xad')](function(_0x5753e1,_0x5f1353){if(_0x5f1353){return _0x5753e1;}return db[_0x6f18('0x96')][_0x6f18('0x55')]({'direction':_0x6f18('0xa9'),'read':![],'body':_0x5f0b98[_0x6f18('0x5a')][_0x6f18('0x9d')][0x0][_0x6f18('0xaa')],'FaxAccountId':_0x58c250['id'],'FaxInteractionId':_0x5753e1['id'],'UserId':_0x5f0b98[_0x6f18('0x57')]['id'],'ContactId':_0x5753e1[_0x6f18('0xae')],'AttachmentId':_0x5f0b98[_0x6f18('0x5a')][_0x6f18('0x9d')][0x0]['id']})[_0x6f18('0x1e')](function(_0x519dfc){_0x5753e1['dataValues']['Messages']=[];_0x5753e1[_0x6f18('0xaf')][_0x6f18('0xab')][_0x6f18('0x7e')](_0x519dfc['dataValues']);return _0x5753e1;});})[_0x6f18('0x1e')](function(_0x10fcce){respondWithRpcPromise(_0x6f18('0xb0'),_0x6f18('0xb0'),{'FaxAccountId':_['isNil'](_0x5f0b98[_0x6f18('0x52')]['id'])?undefined:_0x5f0b98[_0x6f18('0x52')]['id'],'path':_[_0x6f18('0xa3')](_0x5f0b98[_0x6f18('0x5a')][_0x6f18('0x9d')][0x0]['path'])?undefined:_0x5f0b98[_0x6f18('0x5a')]['attachments'][0x0][_0x6f18('0x8')],'fax':_[_0x6f18('0xa3')](_0x5f0b98[_0x6f18('0x5a')]['to'][0x0])?undefined:_0x5f0b98['body']['to'][0x0],'AttachmentId':_0x5f0b98['body'][_0x6f18('0x9d')][0x0]['id']},client9002)['then'](function(_0x33bdb8){logger['info'](_0x6f18('0xb1'),_0x33bdb8);})[_0x6f18('0x50')](function(_0x257d17){logger['info'](_0x6f18('0xb1'),_0x257d17);});return _0x10fcce;})['then'](respondWithResult(_0x96f5ac,null))[_0x6f18('0x50')](handleError(_0x96f5ac,null));};exports['addAgents']=function(_0x685e95,_0x43bb23,_0x1ba666){return db[_0x6f18('0x3a')][_0x6f18('0x54')]({'where':{'id':_0x685e95[_0x6f18('0x52')]['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x43bb23,null))[_0x6f18('0x1e')](function(_0x3cc484){if(_0x3cc484){return _0x3cc484[_0x6f18('0xb2')](_0x685e95[_0x6f18('0x5a')][_0x6f18('0x62')],_[_0x6f18('0x6a')](_0x685e95[_0x6f18('0x5a')],[_0x6f18('0x62'),'id'])||{})[_0x6f18('0xad')](function(_0x25a754){for(var _0x2935f2=0x0;_0x2935f2<_0x685e95[_0x6f18('0x5a')][_0x6f18('0x62')][_0x6f18('0x45')];_0x2935f2+=0x1){socket[_0x6f18('0xb3')](_0x6f18('0xb4'),{'UserId':_0x685e95[_0x6f18('0x5a')]['ids'][_0x2935f2],'FaxAccountId':_0x685e95[_0x6f18('0x52')]['id']});}return _0x25a754;});}})[_0x6f18('0x1e')](respondWithResult(_0x43bb23,null))['catch'](handleError(_0x43bb23,null));};exports['removeAgents']=function(_0x4c5bd6,_0x30a7e3,_0x48a5b5){return db['FaxAccount'][_0x6f18('0x54')]({'where':{'id':_0x4c5bd6[_0x6f18('0x52')]['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x30a7e3,null))[_0x6f18('0x1e')](function(_0x22ab81){if(_0x22ab81){return _0x22ab81['removeAgents'](_0x4c5bd6[_0x6f18('0x3f')][_0x6f18('0x62')])['then'](function(){if(_['isArray'](_0x4c5bd6[_0x6f18('0x3f')][_0x6f18('0x62')])){for(var _0x19b799=0x0;_0x19b799<_0x4c5bd6['query'][_0x6f18('0x62')][_0x6f18('0x45')];_0x19b799+=0x1){socket['emit'](_0x6f18('0xb5'),{'UserId':Number(_0x4c5bd6[_0x6f18('0x3f')]['ids'][_0x19b799]),'FaxAccountId':Number(_0x4c5bd6[_0x6f18('0x52')]['id'])});}}else{socket[_0x6f18('0xb3')]('userFaxAccount:remove',{'UserId':Number(_0x4c5bd6[_0x6f18('0x3f')]['ids']),'FaxAccountId':Number(_0x4c5bd6[_0x6f18('0x52')]['id'])});}});}})[_0x6f18('0x1e')](respondWithStatusCode(_0x30a7e3,null))['catch'](handleError(_0x30a7e3,null));};exports[_0x6f18('0xb6')]=function(_0x3eba7c,_0x43fd1d,_0x4d1b95){var _0x590eed={};var _0x4904de={};var _0x4eff67;var _0x135725;return db[_0x6f18('0x3a')][_0x6f18('0x66')]({'where':{'id':_0x3eba7c[_0x6f18('0x52')]['id']}})[_0x6f18('0x1e')](handleEntityNotFound(_0x43fd1d,null))[_0x6f18('0x1e')](function(_0x26b020){if(_0x26b020){_0x4eff67=_0x26b020;_0x4904de[_0x6f18('0x3e')]=_['keys'](db[_0x6f18('0x6e')][_0x6f18('0x3b')]);_0x4904de[_0x6f18('0x3f')]=_[_0x6f18('0x40')](_0x3eba7c[_0x6f18('0x3f')]);_0x4904de[_0x6f18('0x41')]=_['intersection'](_0x4904de[_0x6f18('0x3e')],_0x4904de['query']);_0x590eed[_0x6f18('0x44')]=_['intersection'](_0x4904de['model'],qs[_0x6f18('0x43')](_0x3eba7c[_0x6f18('0x3f')]['fields']));_0x590eed[_0x6f18('0x44')]=_0x590eed[_0x6f18('0x44')][_0x6f18('0x45')]?_0x590eed[_0x6f18('0x44')]:_0x4904de[_0x6f18('0x3e')];_0x590eed[_0x6f18('0x47')]=qs[_0x6f18('0x5e')](_0x3eba7c['query'][_0x6f18('0x5e')]);_0x590eed[_0x6f18('0x48')]=qs[_0x6f18('0x41')](_[_0x6f18('0x5f')](_0x3eba7c[_0x6f18('0x3f')],_0x4904de[_0x6f18('0x41')]));if(_0x3eba7c[_0x6f18('0x3f')]['filter']){_0x590eed[_0x6f18('0x48')]=_[_0x6f18('0x53')](_0x590eed[_0x6f18('0x48')],{'$or':_[_0x6f18('0x39')](_0x590eed[_0x6f18('0x44')],function(_0x29c085){var _0x2a6704={};_0x2a6704[_0x29c085]={'$like':'%'+_0x3eba7c[_0x6f18('0x3f')][_0x6f18('0x49')]+'%'};return _0x2a6704;})});}_0x590eed=_['merge']({},_0x590eed,_0x3eba7c['options']);return _0x4eff67['getAgents'](_0x590eed);}})['then'](function(_0xdc9f62){if(_0xdc9f62){_0x135725=_0xdc9f62['length'];if(!_0x3eba7c[_0x6f18('0x3f')]['hasOwnProperty'](_0x6f18('0x46'))){_0x590eed[_0x6f18('0x2b')]=qs[_0x6f18('0x2b')](_0x3eba7c[_0x6f18('0x3f')][_0x6f18('0x2b')]);_0x590eed[_0x6f18('0x2a')]=qs[_0x6f18('0x2a')](_0x3eba7c[_0x6f18('0x3f')][_0x6f18('0x2a')]);}return _0x4eff67[_0x6f18('0xb6')](_0x590eed);}})[_0x6f18('0x1e')](function(_0x6e0bdd){if(_0x6e0bdd){return _0x6e0bdd?{'count':_0x135725,'rows':_0x6e0bdd}:null;}})[_0x6f18('0x1e')](respondWithResult(_0x43fd1d,null))[_0x6f18('0x50')](handleError(_0x43fd1d,null));}; \ No newline at end of file +var _0x8903=['attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','omit','nolimit','CmContact','Contact','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','ecm','gateway','faxdetect','headerinfo','modem','FAXOPT(','Set','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','root','basename','isNil','from','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.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','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','mandatoryDispositionPause','FaxAccount','rawAttributes','key','model','map','query','keys','filters','intersection','fields'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0x8903,0x74));var _0x3890=function(_0x558222,_0x105cdb){_0x558222=_0x558222-0x0;var _0x4e1044=_0x8903[_0x558222];return _0x4e1044;};'use strict';var pdf=require(_0x3890('0x0'));var emlformat=require(_0x3890('0x1'));var rimraf=require(_0x3890('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3890('0x3'));var moment=require(_0x3890('0x4'));var BPromise=require(_0x3890('0x5'));var Mustache=require(_0x3890('0x6'));var util=require('util');var path=require(_0x3890('0x7'));var sox=require(_0x3890('0x8'));var csv=require('to-csv');var ejs=require(_0x3890('0x9'));var fs=require('fs');var _=require(_0x3890('0xa'));var squel=require('squel');var crypto=require(_0x3890('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3890('0xc'));var toCsv=require(_0x3890('0xd'));var querystring=require('querystring');var Papa=require(_0x3890('0xe'));var Redis=require(_0x3890('0xf'));var authService=require(_0x3890('0x10'));var qs=require(_0x3890('0x11'));var as=require(_0x3890('0x12'));var hardwareService=require(_0x3890('0x13'));var logger=require(_0x3890('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3890('0x15'));var db=require(_0x3890('0x16'))['db'];config['redis']=_[_0x3890('0x17')](config[_0x3890('0x18')],{'host':_0x3890('0x19'),'port':0x18eb});var socket=require(_0x3890('0x1a'))(new Redis(config[_0x3890('0x18')]));require(_0x3890('0x1b'))['register'](socket);var jayson=require(_0x3890('0x1c'));var client=jayson[_0x3890('0x1d')][_0x3890('0x1e')]({'port':0x232c});var client9002=jayson[_0x3890('0x1d')][_0x3890('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x17710c,_0x531368,_0x141bcd){if(_0x141bcd){var _0x2cd159=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2cd159[_0x3890('0x1f')](_0x531368)){return _0x17710c;}else{throw new db[(_0x3890('0x20'))][(_0x3890('0x21'))](_0x3890('0x22'));}}else{return _0x17710c;}}function respondWithRpcPromise(_0x1563a5,_0x32100d,_0x3a0ae1,_0x1c00c6){return new BPromise(function(_0x2468f9,_0x3014ef){var _0x3450b0=_0x1c00c6||client;return _0x3450b0[_0x3890('0x23')](_0x1563a5,_0x3a0ae1)[_0x3890('0x24')](function(_0x3c2114){logger[_0x3890('0x25')](_0x3890('0x26'),_0x32100d,'request\x20sent');logger['debug'](_0x3890('0x27'),_0x32100d,'request\x20sent',JSON[_0x3890('0x28')](_0x3c2114));if(_0x3c2114['error']){if(_0x3c2114[_0x3890('0x29')][_0x3890('0x2a')]===0x1f4){logger[_0x3890('0x29')](_0x3890('0x26'),_0x32100d,_0x3c2114['error'][_0x3890('0x2b')]);return _0x3014ef(_0x3c2114[_0x3890('0x29')][_0x3890('0x2b')]);}logger[_0x3890('0x29')](_0x3890('0x26'),_0x32100d,_0x3c2114[_0x3890('0x29')][_0x3890('0x2b')]);return _0x2468f9(_0x3c2114[_0x3890('0x29')][_0x3890('0x2b')]);}else{logger[_0x3890('0x25')](_0x3890('0x26'),_0x32100d,_0x3890('0x2c'));_0x2468f9(_0x3c2114[_0x3890('0x2d')]['message']);}})[_0x3890('0x2e')](function(_0xe43f29){logger[_0x3890('0x29')](_0x3890('0x26'),_0x32100d,_0xe43f29);_0x3014ef(_0xe43f29);});});}function respondWithStatusCode(_0x14957a,_0x45d093){_0x45d093=_0x45d093||0xcc;return function(_0x4a7a1a){if(_0x4a7a1a){return _0x14957a['sendStatus'](_0x45d093);}return _0x14957a[_0x3890('0x2f')](_0x45d093)[_0x3890('0x30')]();};}function respondWithResult(_0x49ecd5,_0x4995a4){_0x4995a4=_0x4995a4||0xc8;return function(_0xfaeb0c){if(_0xfaeb0c){return _0x49ecd5['status'](_0x4995a4)[_0x3890('0x31')](_0xfaeb0c);}};}function respondWithFilteredResult(_0x31fe39,_0x3209a2){return function(_0x521bdf){if(_0x521bdf){var _0x4b5097=_0x521bdf[_0x3890('0x32')],_0x64eeac=_0x3209a2[_0x3890('0x33')],_0x500bc5=_0x3209a2['offset']+_0x3209a2[_0x3890('0x34')],_0x5834a8;if(_0x500bc5>=_0x4b5097){_0x500bc5=_0x4b5097;_0x5834a8=0xc8;}else{_0x5834a8=0xce;}_0x31fe39[_0x3890('0x2f')](_0x5834a8);return _0x31fe39[_0x3890('0x35')](_0x3890('0x36'),_0x64eeac+'-'+_0x500bc5+'/'+_0x4b5097)[_0x3890('0x31')](_0x521bdf);}return null;};}function patchUpdates(_0x2f4237){return function(_0x411c66){try{jsonpatch['apply'](_0x411c66,_0x2f4237,!![]);}catch(_0x2e0d7e){return BPromise[_0x3890('0x37')](_0x2e0d7e);}return _0x411c66[_0x3890('0x38')]();};}function saveUpdates(_0x3bdd35,_0x30d9ba){return function(_0xfb042c){if(_0xfb042c){return _0xfb042c['update'](_0x3bdd35)[_0x3890('0x24')](function(_0x7fb926){return _0x7fb926;});}return null;};}function removeEntity(_0x26a7a3,_0x4d4344){return function(_0x445681){if(_0x445681){return _0x445681[_0x3890('0x39')]()[_0x3890('0x24')](function(){var _0x2c95e3=_0x445681[_0x3890('0x3a')]({'plain':!![]});var _0x28b7de=_0x3890('0x3b');return db[_0x3890('0x3c')]['destroy']({'where':{'type':_0x28b7de,'resourceId':_0x2c95e3['id']}})[_0x3890('0x24')](function(){return _0x445681;});})['then'](function(){_0x26a7a3['status'](0xcc)[_0x3890('0x30')]();});}};}function handleEntityNotFound(_0x4dcd6d,_0x218b0b){return function(_0xd00bd1){if(!_0xd00bd1){_0x4dcd6d[_0x3890('0x3d')](0x194);}return _0xd00bd1;};}function handleError(_0x55759c,_0x2fed57){_0x2fed57=_0x2fed57||0x1f4;return function(_0x167794){logger[_0x3890('0x29')](_0x167794[_0x3890('0x3e')]);if(_0x167794['name']){delete _0x167794[_0x3890('0x3f')];}_0x55759c[_0x3890('0x2f')](_0x2fed57)[_0x3890('0x40')](_0x167794);};}exports['index']=function(_0x392d64,_0x534d74){var _0xac391c={'include':[{'model':db['Pause'],'as':_0x3890('0x41')}]},_0x945c5b={},_0x3f5077={'count':0x0,'rows':[]};var _0x280e39=_['map'](db[_0x3890('0x42')][_0x3890('0x43')],function(_0x3875c3){return{'name':_0x3875c3['fieldName'],'type':_0x3875c3['type'][_0x3890('0x44')]};});_0x945c5b[_0x3890('0x45')]=_[_0x3890('0x46')](_0x280e39,_0x3890('0x3f'));_0x945c5b[_0x3890('0x47')]=_[_0x3890('0x48')](_0x392d64[_0x3890('0x47')]);_0x945c5b[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x945c5b[_0x3890('0x45')],_0x945c5b[_0x3890('0x47')]);_0xac391c['attributes']=_['intersection'](_0x945c5b[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x392d64[_0x3890('0x47')][_0x3890('0x4b')]));_0xac391c[_0x3890('0x4c')]=_0xac391c[_0x3890('0x4c')][_0x3890('0x4d')]?_0xac391c['attributes']:_0x945c5b[_0x3890('0x45')];if(!_0x392d64[_0x3890('0x47')][_0x3890('0x4e')]('nolimit')){_0xac391c[_0x3890('0x34')]=qs[_0x3890('0x34')](_0x392d64[_0x3890('0x47')][_0x3890('0x34')]);_0xac391c[_0x3890('0x33')]=qs[_0x3890('0x33')](_0x392d64['query']['offset']);}_0xac391c[_0x3890('0x4f')]=qs['sort'](_0x392d64[_0x3890('0x47')][_0x3890('0x50')]);_0xac391c[_0x3890('0x51')]=qs[_0x3890('0x49')](_[_0x3890('0x52')](_0x392d64['query'],_0x945c5b[_0x3890('0x49')]),_0x280e39);if(_0x392d64[_0x3890('0x47')][_0x3890('0x53')]){_0xac391c[_0x3890('0x51')]=_[_0x3890('0x54')](_0xac391c[_0x3890('0x51')],{'$or':_[_0x3890('0x46')](_0x280e39,function(_0x1c2249){if(_0x1c2249[_0x3890('0x55')]!==_0x3890('0x56')){var _0x4c25d3={};_0x4c25d3[_0x1c2249[_0x3890('0x3f')]]={'$like':'%'+_0x392d64[_0x3890('0x47')][_0x3890('0x53')]+'%'};return _0x4c25d3;}})});}_0xac391c=_[_0x3890('0x54')]({},_0xac391c,_0x392d64[_0x3890('0x57')]);var _0x44112a={'where':_0xac391c[_0x3890('0x51')]};return db[_0x3890('0x42')][_0x3890('0x32')](_0x44112a)[_0x3890('0x24')](function(_0x559ab6){_0x3f5077[_0x3890('0x32')]=_0x559ab6;if(_0x392d64[_0x3890('0x47')][_0x3890('0x58')]){_0xac391c[_0x3890('0x59')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0xac391c);})[_0x3890('0x24')](function(_0x38daee){_0x3f5077[_0x3890('0x5a')]=_0x38daee;return _0x3f5077;})[_0x3890('0x24')](respondWithFilteredResult(_0x534d74,_0xac391c))[_0x3890('0x2e')](handleError(_0x534d74,null));};exports[_0x3890('0x5b')]=function(_0x1b5e13,_0x3730d2){var _0x285d8e={'raw':![],'where':{'id':_0x1b5e13[_0x3890('0x5c')]['id']},'include':[{'model':db[_0x3890('0x5d')],'as':'mandatoryDispositionPause'}]},_0x46583b={};_0x46583b[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0x42')]['rawAttributes']);_0x46583b['query']=_['keys'](_0x1b5e13['query']);_0x46583b[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x46583b['model'],_0x46583b[_0x3890('0x47')]);_0x285d8e[_0x3890('0x4c')]=_[_0x3890('0x4a')](_0x46583b[_0x3890('0x45')],qs['fields'](_0x1b5e13[_0x3890('0x47')][_0x3890('0x4b')]));_0x285d8e[_0x3890('0x4c')]=_0x285d8e['attributes'][_0x3890('0x4d')]?_0x285d8e['attributes']:_0x46583b[_0x3890('0x45')];if(_0x1b5e13[_0x3890('0x47')][_0x3890('0x58')]){_0x285d8e[_0x3890('0x59')]=[{'all':!![]}];}_0x285d8e=_['merge']({},_0x285d8e,_0x1b5e13['options']);return db['FaxAccount'][_0x3890('0x5e')](_0x285d8e)[_0x3890('0x24')](handleEntityNotFound(_0x3730d2,null))[_0x3890('0x24')](respondWithResult(_0x3730d2,null))[_0x3890('0x2e')](handleError(_0x3730d2,null));};exports[_0x3890('0x5f')]=function(_0x30eec6,_0x466897){return db[_0x3890('0x42')][_0x3890('0x5f')](_0x30eec6[_0x3890('0x60')],{})['then'](function(_0x16df7a){var _0x2cf63a=_0x30eec6[_0x3890('0x61')][_0x3890('0x3a')]({'plain':!![]});if(!_0x2cf63a)throw new Error(_0x3890('0x62'));if(_0x2cf63a[_0x3890('0x63')]===_0x3890('0x61')){var _0x5afa6f=_0x16df7a[_0x3890('0x3a')]({'plain':!![]});var _0x4a0a18=_0x3890('0x3b');return db[_0x3890('0x64')][_0x3890('0x5e')]({'where':{'name':_0x4a0a18,'userProfileId':_0x2cf63a[_0x3890('0x65')]},'raw':!![]})[_0x3890('0x24')](function(_0x283a76){if(_0x283a76&&_0x283a76['autoAssociation']===0x0){return db[_0x3890('0x3c')][_0x3890('0x5f')]({'name':_0x5afa6f[_0x3890('0x3f')],'resourceId':_0x5afa6f['id'],'type':_0x283a76[_0x3890('0x3f')],'sectionId':_0x283a76['id']},{})['then'](function(){return _0x16df7a;});}else{return _0x16df7a;}})['catch'](function(_0x2cb621){logger[_0x3890('0x29')](_0x3890('0x66'),_0x2cb621);throw _0x2cb621;});}return _0x16df7a;})[_0x3890('0x24')](respondWithResult(_0x466897,0xc9))[_0x3890('0x2e')](handleError(_0x466897,null));};exports[_0x3890('0x67')]=function(_0x4e0dd0,_0x3990fd){if(_0x4e0dd0['body']['id']){delete _0x4e0dd0[_0x3890('0x60')]['id'];}return db[_0x3890('0x42')][_0x3890('0x5e')]({'where':{'id':_0x4e0dd0[_0x3890('0x5c')]['id']},'include':[{'model':db[_0x3890('0x5d')],'as':_0x3890('0x41')}]})[_0x3890('0x24')](handleEntityNotFound(_0x3990fd,null))[_0x3890('0x24')](saveUpdates(_0x4e0dd0[_0x3890('0x60')],null))[_0x3890('0x24')](respondWithResult(_0x3990fd,null))[_0x3890('0x2e')](handleError(_0x3990fd,null));};exports['destroy']=function(_0x33ddcd,_0x539b7c){return db[_0x3890('0x42')][_0x3890('0x5e')]({'where':{'id':_0x33ddcd['params']['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x539b7c,null))[_0x3890('0x24')](removeEntity(_0x539b7c,null))[_0x3890('0x2e')](handleError(_0x539b7c,null));};exports[_0x3890('0x68')]=function(_0x2bda50,_0x2a38ec){return db[_0x3890('0x42')][_0x3890('0x68')]()[_0x3890('0x24')](respondWithResult(_0x2a38ec,null))['catch'](handleError(_0x2a38ec,null));};exports[_0x3890('0x69')]=function(_0x4a2950,_0x4737e9,_0x3cd938){if(_0x4a2950['body']['id']){delete _0x4a2950[_0x3890('0x60')]['id'];}return db[_0x3890('0x42')][_0x3890('0x5e')]({'where':{'id':_0x4a2950[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x4737e9,null))[_0x3890('0x24')](function(_0x4b60ee){if(_0x4b60ee){_0x4a2950[_0x3890('0x60')][_0x3890('0x6a')]=_0x4b60ee['id'];return db['Disposition'][_0x3890('0x5f')](_0x4a2950[_0x3890('0x60')]);}})[_0x3890('0x24')](respondWithResult(_0x4737e9,null))[_0x3890('0x2e')](handleError(_0x4737e9,null));};exports[_0x3890('0x6b')]=function(_0x1dc034,_0x3be1ae,_0x29d465){var _0x55773b={'raw':![],'where':{}};var _0x5c486e={};var _0x22ce9d={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3890('0x6c')]({'where':{'id':_0x1dc034[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x3be1ae,null))['then'](function(_0x22cfc9){if(_0x22cfc9){_0x5c486e[_0x3890('0x45')]=_['keys'](db['Disposition'][_0x3890('0x43')]);_0x5c486e[_0x3890('0x47')]=_[_0x3890('0x48')](_0x1dc034[_0x3890('0x47')]);_0x5c486e[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x5c486e['model'],_0x5c486e[_0x3890('0x47')]);_0x55773b[_0x3890('0x4c')]=_[_0x3890('0x4a')](_0x5c486e[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x1dc034[_0x3890('0x47')]['fields']));_0x55773b[_0x3890('0x4c')]=_0x55773b['attributes'][_0x3890('0x4d')]?_0x55773b['attributes']:_0x5c486e[_0x3890('0x45')];if(!_0x1dc034[_0x3890('0x47')][_0x3890('0x4e')]('nolimit')){_0x55773b[_0x3890('0x34')]=qs[_0x3890('0x34')](_0x1dc034[_0x3890('0x47')][_0x3890('0x34')]);_0x55773b['offset']=qs[_0x3890('0x33')](_0x1dc034['query']['offset']);}_0x55773b['order']=qs[_0x3890('0x50')](_0x1dc034[_0x3890('0x47')][_0x3890('0x50')]);_0x55773b[_0x3890('0x51')]=qs['filters'](_['pick'](_0x1dc034[_0x3890('0x47')],_0x5c486e[_0x3890('0x49')]));_0x55773b[_0x3890('0x51')][_0x3890('0x6a')]=_0x22cfc9['id'];if(_0x1dc034[_0x3890('0x47')][_0x3890('0x53')]){_0x55773b[_0x3890('0x51')]=_['merge'](_0x55773b['where'],{'$or':_[_0x3890('0x46')](_0x55773b[_0x3890('0x4c')],function(_0xe541c){var _0x50cee0={};_0x50cee0[_0xe541c]={'$like':'%'+_0x1dc034[_0x3890('0x47')][_0x3890('0x53')]+'%'};return _0x50cee0;})});}_0x55773b=_['merge']({},_0x55773b,_0x1dc034[_0x3890('0x57')]);return db['Disposition'][_0x3890('0x32')]({'where':_0x55773b[_0x3890('0x51')]})[_0x3890('0x24')](function(_0x28d342){_0x22ce9d[_0x3890('0x32')]=_0x28d342;if(_0x1dc034[_0x3890('0x47')][_0x3890('0x58')]){_0x55773b['include']=[{'all':!![]}];}return db['Disposition'][_0x3890('0x6d')](_0x55773b);})[_0x3890('0x24')](function(_0x3e1248){_0x22ce9d['rows']=_0x3e1248;return _0x22ce9d;});}})[_0x3890('0x24')](respondWithFilteredResult(_0x3be1ae,_0x55773b))[_0x3890('0x2e')](handleError(_0x3be1ae,null));};exports[_0x3890('0x6e')]=function(_0x53c817,_0xc0236f,_0x78f48d){return db[_0x3890('0x42')]['find']({'where':{'id':_0x53c817[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0xc0236f,null))[_0x3890('0x24')](function(_0x290bbf){if(_0x290bbf){return _0x290bbf['removeDispositions'](_0x53c817[_0x3890('0x47')][_0x3890('0x6f')]);}})[_0x3890('0x24')](respondWithStatusCode(_0xc0236f,null))['catch'](handleError(_0xc0236f,null));};exports[_0x3890('0x70')]=function(_0x39989d,_0x2a300c,_0x584ed7){if(_0x39989d[_0x3890('0x60')]['id']){delete _0x39989d['body']['id'];}return db[_0x3890('0x42')][_0x3890('0x5e')]({'where':{'id':_0x39989d[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x2a300c,null))[_0x3890('0x24')](function(_0x3dacf9){if(_0x3dacf9){_0x39989d['body'][_0x3890('0x6a')]=_0x3dacf9['id'];return db['CannedAnswer'][_0x3890('0x5f')](_0x39989d['body']);}})[_0x3890('0x24')](respondWithResult(_0x2a300c,null))['catch'](handleError(_0x2a300c,null));};exports['getAnswers']=function(_0x3def0a,_0x1af419,_0x355dda){var _0x55565e={'raw':![],'where':{}};var _0x57db45={};var _0x4c518c={'count':0x0,'rows':[]};return db[_0x3890('0x42')][_0x3890('0x6c')]({'where':{'id':_0x3def0a[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x1af419,null))[_0x3890('0x24')](function(_0x553920){if(_0x553920){_0x57db45[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0x71')]['rawAttributes']);_0x57db45[_0x3890('0x47')]=_['keys'](_0x3def0a[_0x3890('0x47')]);_0x57db45[_0x3890('0x49')]=_['intersection'](_0x57db45[_0x3890('0x45')],_0x57db45[_0x3890('0x47')]);_0x55565e[_0x3890('0x4c')]=_['intersection'](_0x57db45['model'],qs[_0x3890('0x4b')](_0x3def0a[_0x3890('0x47')][_0x3890('0x4b')]));_0x55565e[_0x3890('0x4c')]=_0x55565e[_0x3890('0x4c')][_0x3890('0x4d')]?_0x55565e[_0x3890('0x4c')]:_0x57db45['model'];if(!_0x3def0a[_0x3890('0x47')][_0x3890('0x4e')]('nolimit')){_0x55565e[_0x3890('0x34')]=qs[_0x3890('0x34')](_0x3def0a['query'][_0x3890('0x34')]);_0x55565e['offset']=qs[_0x3890('0x33')](_0x3def0a[_0x3890('0x47')][_0x3890('0x33')]);}_0x55565e['order']=qs[_0x3890('0x50')](_0x3def0a[_0x3890('0x47')][_0x3890('0x50')]);_0x55565e['where']=qs[_0x3890('0x49')](_[_0x3890('0x52')](_0x3def0a[_0x3890('0x47')],_0x57db45[_0x3890('0x49')]));_0x55565e['where'][_0x3890('0x6a')]=_0x553920['id'];if(_0x3def0a['query'][_0x3890('0x53')]){_0x55565e[_0x3890('0x51')]=_['merge'](_0x55565e[_0x3890('0x51')],{'$or':_[_0x3890('0x46')](_0x55565e[_0x3890('0x4c')],function(_0x41bbf4){var _0x524801={};_0x524801[_0x41bbf4]={'$like':'%'+_0x3def0a[_0x3890('0x47')][_0x3890('0x53')]+'%'};return _0x524801;})});}_0x55565e=_[_0x3890('0x54')]({},_0x55565e,_0x3def0a[_0x3890('0x57')]);return db[_0x3890('0x71')][_0x3890('0x32')]({'where':_0x55565e['where']})[_0x3890('0x24')](function(_0x5739d2){_0x4c518c[_0x3890('0x32')]=_0x5739d2;if(_0x3def0a[_0x3890('0x47')][_0x3890('0x58')]){_0x55565e[_0x3890('0x59')]=[{'all':!![]}];}return db[_0x3890('0x71')]['findAll'](_0x55565e);})['then'](function(_0x2fcf56){_0x4c518c['rows']=_0x2fcf56;return _0x4c518c;});}})[_0x3890('0x24')](respondWithFilteredResult(_0x1af419,_0x55565e))[_0x3890('0x2e')](handleError(_0x1af419,null));};exports[_0x3890('0x72')]=function(_0x3616e8,_0x47a760,_0x228dc1){return db[_0x3890('0x42')]['find']({'where':{'id':_0x3616e8[_0x3890('0x5c')]['id']}})['then'](handleEntityNotFound(_0x47a760,null))['then'](function(_0x4563c1){if(_0x4563c1){return _0x4563c1[_0x3890('0x72')](_0x3616e8[_0x3890('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x47a760,null))[_0x3890('0x2e')](handleError(_0x47a760,null));};exports['addInteraction']=function(_0x214ebd,_0x2dcbb8,_0x2348fd){return db[_0x3890('0x73')][_0x3890('0x5e')]({'where':{'id':_0x214ebd[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x2dcbb8,null))[_0x3890('0x24')](function(_0x40714d){if(_0x40714d){return _0x40714d[_0x3890('0x74')](_0x214ebd[_0x3890('0x60')][_0x3890('0x6f')],_[_0x3890('0x75')](_0x214ebd['body'],[_0x3890('0x6f'),'id'])||{});}})[_0x3890('0x24')](respondWithResult(_0x2dcbb8,null))['catch'](handleError(_0x2dcbb8,null));};exports['getInteractions']=function(_0x87431,_0xe3e833,_0x42228f){var _0x4ad98f={'raw':![],'where':{}};var _0x2086a1={};var _0x559315={'count':0x0,'rows':[]};return db['FaxAccount'][_0x3890('0x6c')]({'where':{'id':_0x87431[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0xe3e833,null))[_0x3890('0x24')](function(_0x161c64){if(_0x161c64){_0x2086a1[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0x73')]['rawAttributes']);_0x2086a1[_0x3890('0x47')]=_[_0x3890('0x48')](_0x87431[_0x3890('0x47')]);_0x2086a1[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x2086a1['model'],_0x2086a1['query']);_0x4ad98f[_0x3890('0x4c')]=_[_0x3890('0x4a')](_0x2086a1[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x87431[_0x3890('0x47')]['fields']));_0x4ad98f[_0x3890('0x4c')]=_0x4ad98f[_0x3890('0x4c')][_0x3890('0x4d')]?_0x4ad98f[_0x3890('0x4c')]:_0x2086a1['model'];if(!_0x87431[_0x3890('0x47')][_0x3890('0x4e')](_0x3890('0x76'))){_0x4ad98f['limit']=qs[_0x3890('0x34')](_0x87431['query']['limit']);_0x4ad98f[_0x3890('0x33')]=qs[_0x3890('0x33')](_0x87431[_0x3890('0x47')][_0x3890('0x33')]);}_0x4ad98f[_0x3890('0x4f')]=qs[_0x3890('0x50')](_0x87431[_0x3890('0x47')][_0x3890('0x50')]);_0x4ad98f[_0x3890('0x51')]=qs[_0x3890('0x49')](_[_0x3890('0x52')](_0x87431[_0x3890('0x47')],_0x2086a1[_0x3890('0x49')]));_0x4ad98f['where'][_0x3890('0x6a')]=_0x161c64['id'];if(_0x87431[_0x3890('0x47')][_0x3890('0x53')]){_0x4ad98f[_0x3890('0x51')]=_[_0x3890('0x54')](_0x4ad98f[_0x3890('0x51')],{'$or':_['map'](_0x4ad98f[_0x3890('0x4c')],function(_0x28ec39){var _0x5d73be={};_0x5d73be[_0x28ec39]={'$like':'%'+_0x87431[_0x3890('0x47')][_0x3890('0x53')]+'%'};return _0x5d73be;})});}_0x4ad98f=_[_0x3890('0x54')]({},_0x4ad98f,_0x87431[_0x3890('0x57')]);return db[_0x3890('0x73')][_0x3890('0x32')]({'where':_0x4ad98f[_0x3890('0x51')]})[_0x3890('0x24')](function(_0x3c4a99){_0x559315[_0x3890('0x32')]=_0x3c4a99;if(_0x87431[_0x3890('0x47')][_0x3890('0x58')]){_0x4ad98f[_0x3890('0x59')]=[{'model':db[_0x3890('0x77')],'as':_0x3890('0x78'),'required':![]},{'model':db['User'],'as':_0x3890('0x79'),'attributes':[_0x3890('0x3f'),_0x3890('0x7a'),'internal'],'required':![]},{'model':db[_0x3890('0x7b')],'as':_0x3890('0x7c'),'attributes':['id','name',_0x3890('0x7d')],'where':_0x87431[_0x3890('0x47')][_0x3890('0x7e')]?{'id':_0x87431[_0x3890('0x47')][_0x3890('0x7e')]}:undefined,'required':_0x87431['query'][_0x3890('0x7e')]?!![]:![]}];}return db[_0x3890('0x73')][_0x3890('0x6d')](_0x4ad98f);})['then'](function(_0x49070a){_0x559315[_0x3890('0x5a')]=_0x49070a;return _0x559315;});}})[_0x3890('0x24')](respondWithFilteredResult(_0xe3e833,_0x4ad98f))[_0x3890('0x2e')](handleError(_0xe3e833,null));};exports[_0x3890('0x7f')]=function(_0x3e5fdb,_0x346fab,_0x14032d){return db['FaxAccount']['findOne']({'where':{'id':_0x3e5fdb[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x346fab,null))[_0x3890('0x24')](function(_0x339976){if(_0x339976){return db[_0x3890('0x80')][_0x3890('0x81')](function(_0x105cd3){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x3e5fdb[_0x3890('0x5c')]['id']},'transaction':_0x105cd3})[_0x3890('0x24')](function(_0x1e6660){var _0x5c812b=_['map'](_0x3e5fdb[_0x3890('0x60')],function(_0x39cabb){_0x39cabb[_0x3890('0x6a')]=_0x3e5fdb['params']['id'];return _0x39cabb;});return db[_0x3890('0x82')][_0x3890('0x83')](_0x5c812b,{'transaction':_0x105cd3});});})['then'](function(){return db[_0x3890('0x82')][_0x3890('0x84')]({'where':{'FaxAccountId':_0x3e5fdb[_0x3890('0x5c')]['id']},'order':_0x3890('0x85')});});}})[_0x3890('0x24')](respondWithResult(_0x346fab,null))[_0x3890('0x2e')](handleError(_0x346fab,null));};exports[_0x3890('0x86')]=function(_0x12c62c,_0x328032,_0x2067df){var _0x2596f9={};var _0x3e7c05={};var _0x345261;var _0x551aef;return db[_0x3890('0x42')][_0x3890('0x6c')]({'where':{'id':_0x12c62c[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x328032,null))['then'](function(_0x3749a6){if(_0x3749a6){_0x345261=_0x3749a6;_0x3e7c05[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0x82')][_0x3890('0x43')]);_0x3e7c05[_0x3890('0x47')]=_[_0x3890('0x48')](_0x12c62c[_0x3890('0x47')]);_0x3e7c05[_0x3890('0x49')]=_['intersection'](_0x3e7c05[_0x3890('0x45')],_0x3e7c05['query']);_0x2596f9['attributes']=_[_0x3890('0x4a')](_0x3e7c05[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x12c62c[_0x3890('0x47')][_0x3890('0x4b')]));_0x2596f9['attributes']=_0x2596f9[_0x3890('0x4c')][_0x3890('0x4d')]?_0x2596f9[_0x3890('0x4c')]:_0x3e7c05['model'];_0x2596f9['order']=qs[_0x3890('0x50')](_0x12c62c[_0x3890('0x47')][_0x3890('0x50')]);_0x2596f9[_0x3890('0x51')]=qs[_0x3890('0x49')](_[_0x3890('0x52')](_0x12c62c[_0x3890('0x47')],_0x3e7c05[_0x3890('0x49')]));if(_0x12c62c[_0x3890('0x47')]['filter']){_0x2596f9[_0x3890('0x51')]=_['merge'](_0x2596f9[_0x3890('0x51')],{'$or':_[_0x3890('0x46')](_0x2596f9['attributes'],function(_0x329f38){var _0x2d9217={};_0x2d9217[_0x329f38]={'$like':'%'+_0x12c62c['query']['filter']+'%'};return _0x2d9217;})});}_0x2596f9=_[_0x3890('0x54')]({},_0x2596f9,_0x12c62c[_0x3890('0x57')]);return _0x345261[_0x3890('0x86')](_0x2596f9);}})[_0x3890('0x24')](function(_0x1a48b6){if(_0x1a48b6){_0x551aef=_0x1a48b6[_0x3890('0x4d')];if(!_0x12c62c[_0x3890('0x47')][_0x3890('0x4e')](_0x3890('0x76'))){_0x2596f9[_0x3890('0x34')]=qs['limit'](_0x12c62c['query'][_0x3890('0x34')]);_0x2596f9[_0x3890('0x33')]=qs['offset'](_0x12c62c[_0x3890('0x47')]['offset']);}return _0x345261['getApplications'](_0x2596f9);}})[_0x3890('0x24')](function(_0x1e7065){if(_0x1e7065){return _0x1e7065?{'count':_0x551aef,'rows':_0x1e7065}:null;}})[_0x3890('0x24')](respondWithResult(_0x328032,null))[_0x3890('0x2e')](handleError(_0x328032,null));};function Extension(_0x325cbd,_0x579078,_0x588cc4,_0x906e81){this[_0x3890('0x87')]=_0x3890('0x88');this[_0x3890('0x89')]=_0x325cbd['localstationid'];this[_0x3890('0x8a')]=_0x906e81;this[_0x3890('0x55')]=_0x3890('0x8b');this[_0x3890('0x8c')]=_0x3890('0x8d');this['FaxAccountId']=_0x325cbd['id'];this[_0x3890('0x85')]=_0x579078;this[_0x3890('0x8e')]=_0x588cc4;}function createExtensionsReciveFax(_0x2b6d56){var _0x1274da=0x1;var _0x1f2862=[];_0x1f2862[_0x3890('0x8f')](new Extension(_0x2b6d56,_0x1274da,'','Answer'));_0x1274da+=0x1;_0x1f2862[_0x3890('0x8f')](new Extension(_0x2b6d56,_0x1274da,'CDR(type)=inbound-fax','Set'));_0x1274da+=0x1;for(var _0x12a015 in _0x2b6d56){if(_0x2b6d56[_0x3890('0x4e')](_0x12a015)&&(_0x12a015===_0x3890('0x90')||_0x12a015==='localstationid'||_0x12a015===_0x3890('0x91')||_0x12a015===_0x3890('0x92')||_0x12a015===_0x3890('0x93')||_0x12a015==='maxrate'||_0x12a015==='minrate'||_0x12a015===_0x3890('0x94')||_0x12a015==='t38timeout')){_0x1f2862[_0x3890('0x8f')](new Extension(_0x2b6d56,_0x1274da,_0x3890('0x95')+_0x12a015+')='+_0x2b6d56[_0x12a015],_0x3890('0x96')));_0x1274da+=0x1;}}_0x1f2862[_0x3890('0x8f')](new Extension(_0x2b6d56,_0x1274da,'6','Wait'));_0x1274da+=0x1;_0x1f2862[_0x3890('0x8f')](new Extension(_0x2b6d56,_0x1274da,_0x3890('0x97'),_0x3890('0x98')));_0x1274da=0x0;return _0x1f2862;}exports[_0x3890('0x99')]=function(_0x15a1fa,_0xab9c4d,_0x2b703a){var _0x869785;return db[_0x3890('0x80')][_0x3890('0x81')](function(_0x11884a){return db[_0x3890('0x42')][_0x3890('0x5f')](_0x15a1fa[_0x3890('0x60')],{'transaction':_0x11884a})['then'](function(_0x5562c2){_0x869785=_0x5562c2[_0x3890('0x3a')]({'plain':!![]});return db[_0x3890('0x9a')][_0x3890('0x83')](createExtensionsReciveFax(_0x869785),{'transaction':_0x11884a});});})[_0x3890('0x24')](function(){return _0x869785;})[_0x3890('0x24')](respondWithResult(_0xab9c4d,null))[_0x3890('0x2e')](handleError(_0xab9c4d,null));};exports['updateAccountApplications']=function(_0x4b6d7c,_0x4b3a0f,_0x4098f9){var _0x4334b;return db[_0x3890('0x80')][_0x3890('0x81')](function(_0x417a73){return db[_0x3890('0x42')][_0x3890('0x67')](_0x4b6d7c['body'],{'where':{'id':_0x4b6d7c[_0x3890('0x60')]['id']},'transaction':_0x417a73})[_0x3890('0x24')](function(_0x23dee4){return db[_0x3890('0x9a')][_0x3890('0x39')]({'where':{'FaxAccountId':_0x4b6d7c[_0x3890('0x60')]['id']},'transaction':_0x417a73})[_0x3890('0x24')](function(_0xaac93e){return db[_0x3890('0x9a')][_0x3890('0x83')](createExtensionsReciveFax(_['omit'](_0x4b6d7c[_0x3890('0x60')],[_0x3890('0x9b'),_0x3890('0x44'),_0x3890('0x9c'),'updatedAt',_0x3890('0x9d'),_0x3890('0x9e')])),{'transaction':_0x417a73});});});})[_0x3890('0x24')](function(){return db[_0x3890('0x42')]['findById'](_0x4b6d7c[_0x3890('0x60')]['id']);})[_0x3890('0x24')](respondWithResult(_0x4b3a0f,null))[_0x3890('0x2e')](handleError(_0x4b3a0f,null));};exports[_0x3890('0x9f')]=function(_0x1f6440,_0x29c9c8,_0x428124){var _0x4b325a={'raw':!![],'where':{}};var _0x5070f0={};var _0x4decc7={'count':0x0,'rows':[]};return db[_0x3890('0x42')][_0x3890('0x6c')]({'where':{'id':_0x1f6440[_0x3890('0x5c')]['id']}})['then'](handleEntityNotFound(_0x29c9c8,null))[_0x3890('0x24')](function(_0x439f19){if(_0x439f19){_0x5070f0[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0xa0')][_0x3890('0x43')]);_0x5070f0[_0x3890('0x47')]=_[_0x3890('0x48')](_0x1f6440[_0x3890('0x47')]);_0x5070f0[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x5070f0[_0x3890('0x45')],_0x5070f0[_0x3890('0x47')]);_0x4b325a[_0x3890('0x4c')]=_[_0x3890('0x4a')](_0x5070f0[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x1f6440['query'][_0x3890('0x4b')]));_0x4b325a[_0x3890('0x4c')]=_0x4b325a[_0x3890('0x4c')][_0x3890('0x4d')]?_0x4b325a[_0x3890('0x4c')]:_0x5070f0[_0x3890('0x45')];if(!_0x1f6440[_0x3890('0x47')]['hasOwnProperty'](_0x3890('0x76'))){_0x4b325a[_0x3890('0x34')]=qs[_0x3890('0x34')](_0x1f6440['query']['limit']);_0x4b325a[_0x3890('0x33')]=qs[_0x3890('0x33')](_0x1f6440[_0x3890('0x47')][_0x3890('0x33')]);}_0x4b325a[_0x3890('0x4f')]=qs[_0x3890('0x50')](_0x1f6440['query'][_0x3890('0x50')]);_0x4b325a['where']=qs[_0x3890('0x49')](_['pick'](_0x1f6440[_0x3890('0x47')],_0x5070f0[_0x3890('0x49')]));_0x4b325a[_0x3890('0x51')][_0x3890('0x6a')]=_0x439f19['id'];if(_0x1f6440[_0x3890('0x47')]['filter']){_0x4b325a['where']=_[_0x3890('0x54')](_0x4b325a[_0x3890('0x51')],{'$or':_['map'](_0x4b325a[_0x3890('0x4c')],function(_0x5e99fb){var _0x297959={};_0x297959[_0x5e99fb]={'$like':'%'+_0x1f6440[_0x3890('0x47')][_0x3890('0x53')]+'%'};return _0x297959;})});}if(_0x1f6440[_0x3890('0x47')][_0x3890('0xa1')]){var _0x6726ef=_0x1f6440[_0x3890('0x47')][_0x3890('0xa1')][_0x3890('0xa2')](',');var _0x4f220b={};_0x4f220b[_0x6726ef[0x0]]={'$gte':moment(_0x6726ef[0x1])[_0x3890('0xa3')](_0x3890('0xa4'))};_0x4b325a['where']=_[_0x3890('0x54')](_0x4b325a[_0x3890('0x51')],_0x4f220b);}_0x4b325a=_[_0x3890('0x54')]({},_0x4b325a,_0x1f6440[_0x3890('0x57')]);return db[_0x3890('0xa0')]['count']({'where':_0x4b325a[_0x3890('0x51')]})[_0x3890('0x24')](function(_0x3fa4e3){_0x4decc7[_0x3890('0x32')]=_0x3fa4e3;if(_0x1f6440[_0x3890('0x47')]['includeAll']){_0x4b325a[_0x3890('0x59')]=[{'all':!![]}];}return db['FaxMessage'][_0x3890('0x6d')](_0x4b325a);})[_0x3890('0x24')](function(_0x4f484e){_0x4decc7[_0x3890('0x5a')]=_0x4f484e;return _0x4decc7;});}})[_0x3890('0x24')](respondWithFilteredResult(_0x29c9c8,_0x4b325a))['catch'](handleError(_0x29c9c8,null));};exports[_0x3890('0x40')]=function(_0x3f5961,_0x2e28dc,_0x397d00){var _0x403058,_0x2d73a7={},_0x3b0336;if(_0x3f5961[_0x3890('0x60')]['to']){_0x3b0336=_0x3f5961[_0x3890('0x60')]['to'][0x0];}return db[_0x3890('0x42')][_0x3890('0x5e')]({'where':{'id':_0x3f5961[_0x3890('0x5c')]['id']},'include':[{'model':db[_0x3890('0xa5')],'as':_0x3890('0xa6'),'include':[{'model':db[_0x3890('0x77')],'as':_0x3890('0xa7'),'where':{'fax':_0x3b0336},'limit':0x1,'order':[[_0x3890('0xa8'),_0x3890('0xa9')]]}]}]})[_0x3890('0x24')](handleEntityNotFound(_0x2e28dc,null))[_0x3890('0x24')](function(_0x5b718a){_0x403058=_0x5b718a;if(_0x3f5961[_0x3890('0x60')]['attachments']&&_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][_0x3890('0x4d')]){for(var _0x49dc90=0x0;_0x49dc90<_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')]['length'];_0x49dc90+=0x1){_0x3f5961['body'][_0x3890('0xaa')][_0x49dc90]={'filename':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][_0x49dc90]['name'],'id':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][_0x49dc90]['id'],'path':path['join'](config[_0x3890('0xab')],'server/files/attachments',_0x3f5961[_0x3890('0x60')]['attachments'][_0x49dc90][_0x3890('0xac')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x3890('0xad')](_0x3f5961['params']['id'])?undefined:_0x3f5961[_0x3890('0x5c')]['id'],'path':_['isNil'](_0x3f5961[_0x3890('0x60')]['attachments'][0x0][_0x3890('0x7')])?undefined:_0x3f5961[_0x3890('0x60')]['attachments'][0x0][_0x3890('0x7')],'fax':_[_0x3890('0xad')](_0x3f5961[_0x3890('0x60')]['to'][0x0])?undefined:_0x3f5961[_0x3890('0x60')]['to'][0x0]},client9002);})[_0x3890('0x24')](function(){if(_0x403058){if(_[_0x3890('0xad')](_0x3f5961['body'][_0x3890('0xae')])){_0x3f5961[_0x3890('0x60')][_0x3890('0xae')]=util[_0x3890('0xa3')]('\x22%s\x22\x20<%s>',_0x403058['name'],_0x403058['fax']);}if(_0x403058[_0x3890('0xa6')]){if(_0x403058[_0x3890('0xa6')][_0x3890('0xa7')][_0x3890('0x4d')]){return _0x403058['List'][_0x3890('0xa7')][0x0];}else{return db[_0x3890('0x77')][_0x3890('0x5f')](_[_0x3890('0x17')](_0x3f5961['body'],{'firstName':_0x3f5961[_0x3890('0x60')]['to'][0x0],'phone':_0x3f5961['body']['to'][0x0],'fax':_0x3f5961[_0x3890('0x60')]['to'][0x0],'ListId':_0x403058[_0x3890('0x9e')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x3890('0xaf'));}})[_0x3890('0x24')](function(_0x34a270){if(_0x34a270){return db[_0x3890('0x73')][_0x3890('0x5e')]({'where':{'ContactId':_0x34a270['id'],'closed':![],'FaxAccountId':_0x403058['id']}})[_0x3890('0x24')](function(_0x261a09){if(_0x261a09){return[_0x261a09,![]];}return db[_0x3890('0x73')][_0x3890('0x5f')]({'UserId':_0x3f5961['user']['id'],'ContactId':_0x34a270['id'],'FaxAccountId':_0x403058['id'],'fax':_0x3f5961[_0x3890('0x60')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x3890('0x54')](_0x3f5961[_0x3890('0x60')],{'read':![],'body':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0][_0x3890('0xb0')],'FaxAccountId':_0x403058['id'],'UserId':_0x3f5961['user']['id'],'ContactId':_0x34a270['id'],'AttachmentId':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x3890('0xb1')}]})[_0x3890('0x24')](function(_0x133ca6){return[_0x133ca6,!![]];});});}else{throw new Error(_0x3890('0xb2'));}})[_0x3890('0xb3')](function(_0x146a1f,_0x58dedb){if(_0x58dedb){return _0x146a1f;}return db[_0x3890('0xa0')]['create']({'direction':_0x3890('0xb4'),'read':![],'body':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0][_0x3890('0xb0')],'FaxAccountId':_0x403058['id'],'FaxInteractionId':_0x146a1f['id'],'UserId':_0x3f5961['user']['id'],'ContactId':_0x146a1f[_0x3890('0xb5')],'AttachmentId':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0]['id']})[_0x3890('0x24')](function(_0x2f98d7){_0x146a1f[_0x3890('0xb6')][_0x3890('0xb1')]=[];_0x146a1f[_0x3890('0xb6')][_0x3890('0xb1')][_0x3890('0x8f')](_0x2f98d7[_0x3890('0xb6')]);return _0x146a1f;});})[_0x3890('0x24')](function(_0x1c1963){respondWithRpcPromise(_0x3890('0xb7'),_0x3890('0xb7'),{'FaxAccountId':_[_0x3890('0xad')](_0x3f5961[_0x3890('0x5c')]['id'])?undefined:_0x3f5961[_0x3890('0x5c')]['id'],'path':_[_0x3890('0xad')](_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0]['path'])?undefined:_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0][_0x3890('0x7')],'fax':_[_0x3890('0xad')](_0x3f5961['body']['to'][0x0])?undefined:_0x3f5961[_0x3890('0x60')]['to'][0x0],'AttachmentId':_0x3f5961[_0x3890('0x60')][_0x3890('0xaa')][0x0]['id']},client9002)['then'](function(_0x5ab0d7){logger[_0x3890('0x25')]('SendFaxRpc,\x20%s',_0x5ab0d7);})[_0x3890('0x2e')](function(_0x302a44){logger[_0x3890('0x25')]('SendFaxRpc,\x20%s',_0x302a44);});return _0x1c1963;})[_0x3890('0x24')](respondWithResult(_0x2e28dc,null))[_0x3890('0x2e')](handleError(_0x2e28dc,null));};exports[_0x3890('0xb8')]=function(_0x31722c,_0x4dddd3,_0x5d3c3b){return db['FaxAccount'][_0x3890('0x5e')]({'where':{'id':_0x31722c[_0x3890('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4dddd3,null))['then'](function(_0x49c71f){if(_0x49c71f){return _0x49c71f['addAgents'](_0x31722c['body'][_0x3890('0x6f')],_[_0x3890('0x75')](_0x31722c[_0x3890('0x60')],[_0x3890('0x6f'),'id'])||{})[_0x3890('0xb3')](function(_0xed0280){for(var _0x387c5c=0x0;_0x387c5c<_0x31722c[_0x3890('0x60')]['ids'][_0x3890('0x4d')];_0x387c5c+=0x1){socket[_0x3890('0xb9')](_0x3890('0xba'),{'UserId':_0x31722c[_0x3890('0x60')][_0x3890('0x6f')][_0x387c5c],'FaxAccountId':_0x31722c['params']['id']});}return _0xed0280;});}})[_0x3890('0x24')](respondWithResult(_0x4dddd3,null))['catch'](handleError(_0x4dddd3,null));};exports[_0x3890('0xbb')]=function(_0x5c6190,_0x27bbbc,_0x18ac03){return db[_0x3890('0x42')]['find']({'where':{'id':_0x5c6190[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x27bbbc,null))[_0x3890('0x24')](function(_0x2c39a4){if(_0x2c39a4){return _0x2c39a4[_0x3890('0xbb')](_0x5c6190[_0x3890('0x47')][_0x3890('0x6f')])[_0x3890('0x24')](function(){if(_[_0x3890('0xbc')](_0x5c6190[_0x3890('0x47')]['ids'])){for(var _0x269521=0x0;_0x269521<_0x5c6190[_0x3890('0x47')][_0x3890('0x6f')]['length'];_0x269521+=0x1){socket['emit'](_0x3890('0xbd'),{'UserId':Number(_0x5c6190[_0x3890('0x47')][_0x3890('0x6f')][_0x269521]),'FaxAccountId':Number(_0x5c6190[_0x3890('0x5c')]['id'])});}}else{socket[_0x3890('0xb9')](_0x3890('0xbd'),{'UserId':Number(_0x5c6190[_0x3890('0x47')][_0x3890('0x6f')]),'FaxAccountId':Number(_0x5c6190[_0x3890('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x27bbbc,null))[_0x3890('0x2e')](handleError(_0x27bbbc,null));};exports[_0x3890('0xbe')]=function(_0x18158a,_0x39d057,_0x4e5c85){var _0x3a725e={};var _0x2d7e46={};var _0x3d687f;var _0x1af18a;return db['FaxAccount'][_0x3890('0x6c')]({'where':{'id':_0x18158a[_0x3890('0x5c')]['id']}})[_0x3890('0x24')](handleEntityNotFound(_0x39d057,null))[_0x3890('0x24')](function(_0x238acf){if(_0x238acf){_0x3d687f=_0x238acf;_0x2d7e46[_0x3890('0x45')]=_[_0x3890('0x48')](db[_0x3890('0xbf')]['rawAttributes']);_0x2d7e46[_0x3890('0x47')]=_[_0x3890('0x48')](_0x18158a[_0x3890('0x47')]);_0x2d7e46[_0x3890('0x49')]=_[_0x3890('0x4a')](_0x2d7e46[_0x3890('0x45')],_0x2d7e46[_0x3890('0x47')]);_0x3a725e[_0x3890('0x4c')]=_[_0x3890('0x4a')](_0x2d7e46[_0x3890('0x45')],qs[_0x3890('0x4b')](_0x18158a['query'][_0x3890('0x4b')]));_0x3a725e['attributes']=_0x3a725e[_0x3890('0x4c')][_0x3890('0x4d')]?_0x3a725e[_0x3890('0x4c')]:_0x2d7e46[_0x3890('0x45')];_0x3a725e[_0x3890('0x4f')]=qs[_0x3890('0x50')](_0x18158a[_0x3890('0x47')]['sort']);_0x3a725e[_0x3890('0x51')]=qs[_0x3890('0x49')](_[_0x3890('0x52')](_0x18158a['query'],_0x2d7e46[_0x3890('0x49')]));if(_0x18158a[_0x3890('0x47')][_0x3890('0x53')]){_0x3a725e[_0x3890('0x51')]=_[_0x3890('0x54')](_0x3a725e[_0x3890('0x51')],{'$or':_[_0x3890('0x46')](_0x3a725e[_0x3890('0x4c')],function(_0x1ef76a){var _0x363506={};_0x363506[_0x1ef76a]={'$like':'%'+_0x18158a[_0x3890('0x47')]['filter']+'%'};return _0x363506;})});}_0x3a725e=_[_0x3890('0x54')]({},_0x3a725e,_0x18158a[_0x3890('0x57')]);return _0x3d687f[_0x3890('0xbe')](_0x3a725e);}})['then'](function(_0x3f22b3){if(_0x3f22b3){_0x1af18a=_0x3f22b3[_0x3890('0x4d')];if(!_0x18158a['query'][_0x3890('0x4e')](_0x3890('0x76'))){_0x3a725e[_0x3890('0x34')]=qs[_0x3890('0x34')](_0x18158a[_0x3890('0x47')][_0x3890('0x34')]);_0x3a725e[_0x3890('0x33')]=qs['offset'](_0x18158a[_0x3890('0x47')][_0x3890('0x33')]);}return _0x3d687f[_0x3890('0xbe')](_0x3a725e);}})[_0x3890('0x24')](function(_0x21d585){if(_0x21d585){return _0x21d585?{'count':_0x1af18a,'rows':_0x21d585}:null;}})[_0x3890('0x24')](respondWithResult(_0x39d057,null))[_0x3890('0x2e')](handleError(_0x39d057,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f1d6b24..19fe094 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 _0x5836=['emit','hook','exports','events','../../mysqldb','FaxAccount','save','update','remove'];(function(_0x574de7,_0x24ce60){var _0x568f46=function(_0x516004){while(--_0x516004){_0x574de7['push'](_0x574de7['shift']());}};_0x568f46(++_0x24ce60);}(_0x5836,0x1bc));var _0x6583=function(_0xe22435,_0x27157f){_0xe22435=_0xe22435-0x0;var _0x4fa237=_0x5836[_0xe22435];return _0x4fa237;};'use strict';var EventEmitter=require(_0x6583('0x0'));var FaxAccount=require(_0x6583('0x1'))['db'][_0x6583('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6583('0x3'),'afterUpdate':_0x6583('0x4'),'afterDestroy':_0x6583('0x5')};function emitEvent(_0x1cb512){return function(_0x298343,_0x565d77,_0x326eec){FaxAccountEvents[_0x6583('0x6')](_0x1cb512+':'+_0x298343['id'],_0x298343);FaxAccountEvents['emit'](_0x1cb512,_0x298343);_0x326eec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x6583('0x7')](e,emitEvent(event));}}module[_0x6583('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x4052=['../../mysqldb','FaxAccount','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x4a5814,_0x19ad4f){var _0x35e486=function(_0x378c56){while(--_0x378c56){_0x4a5814['push'](_0x4a5814['shift']());}};_0x35e486(++_0x19ad4f);}(_0x4052,0x155));var _0x2405=function(_0x24af33,_0x478fc6){_0x24af33=_0x24af33-0x0;var _0x17df0d=_0x4052[_0x24af33];return _0x17df0d;};'use strict';var EventEmitter=require(_0x2405('0x0'));var FaxAccount=require(_0x2405('0x1'))['db'][_0x2405('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2405('0x3')](0x0);var events={'afterCreate':_0x2405('0x4'),'afterUpdate':'update','afterDestroy':_0x2405('0x5')};function emitEvent(_0x37b44c){return function(_0x59d542,_0x4c64b5,_0x20b11a){FaxAccountEvents['emit'](_0x37b44c+':'+_0x59d542['id'],_0x59d542);FaxAccountEvents[_0x2405('0x6')](_0x37b44c,_0x59d542);_0x20b11a(null);};}for(var e in events){if(events[_0x2405('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x2405('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index fae7cc1..6ffa71a 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 _0x8e0f=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b658,_0x344b6a){var _0x1d17e5=function(_0x1fae07){while(--_0x1fae07){_0x1b658['push'](_0x1b658['shift']());}};_0x1d17e5(++_0x344b6a);}(_0x8e0f,0xdd));var _0xf8e0=function(_0x3df02c,_0x27166c){_0x3df02c=_0x3df02c-0x0;var _0x5cb500=_0x8e0f[_0x3df02c];return _0x5cb500;};'use strict';var _=require(_0xf8e0('0x0'));var util=require(_0xf8e0('0x1'));var logger=require(_0xf8e0('0x2'))(_0xf8e0('0x3'));var moment=require(_0xf8e0('0x4'));var BPromise=require(_0xf8e0('0x5'));var rp=require(_0xf8e0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf8e0('0x7'));var attributes=require(_0xf8e0('0x8'));module[_0xf8e0('0x9')]=function(_0x45b5ae,_0x20cb35){return _0x45b5ae[_0xf8e0('0xa')](_0xf8e0('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f70=['path','rimraf','../../config/environment','FaxAccount','fax_accounts','util','api','moment','bluebird','request-promise'];(function(_0x1ec01b,_0x5b9ade){var _0x39c013=function(_0xd740a0){while(--_0xd740a0){_0x1ec01b['push'](_0x1ec01b['shift']());}};_0x39c013(++_0x5b9ade);}(_0x7f70,0xd7));var _0x07f7=function(_0x14ede1,_0x4e04c0){_0x14ede1=_0x14ede1-0x0;var _0x4a88af=_0x7f70[_0x14ede1];return _0x4a88af;};'use strict';var _=require('lodash');var util=require(_0x07f7('0x0'));var logger=require('../../config/logger')(_0x07f7('0x1'));var moment=require(_0x07f7('0x2'));var BPromise=require(_0x07f7('0x3'));var rp=require(_0x07f7('0x4'));var fs=require('fs');var path=require(_0x07f7('0x5'));var rimraf=require(_0x07f7('0x6'));var config=require(_0x07f7('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x3a9543,_0x2c6838){return _0x3a9543['define'](_0x07f7('0x8'),attributes,{'tableName':_0x07f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index ffc6ea7..a308c7f 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 _0x5c75=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','applications','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','User','name','UserId','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','raw','attributes','limit','map','include','model','stringify','NotifyFaxAccount','body','fax','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','keys','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x4bc098,_0x308db8){var _0x3136c0=function(_0x42aa3c){while(--_0x42aa3c){_0x4bc098['push'](_0x4bc098['shift']());}};_0x3136c0(++_0x308db8);}(_0x5c75,0x1ea));var _0x55c7=function(_0x51b8e7,_0x5c70fb){_0x51b8e7=_0x51b8e7-0x0;var _0x81fd25=_0x5c75[_0x51b8e7];return _0x81fd25;};'use strict';var _=require(_0x55c7('0x0'));var util=require(_0x55c7('0x1'));var moment=require(_0x55c7('0x2'));var BPromise=require(_0x55c7('0x3'));var rs=require(_0x55c7('0x4'));var fs=require('fs');var Redis=require(_0x55c7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x55c7('0x6'));var logger=require(_0x55c7('0x7'))(_0x55c7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x55c7('0x9')]({'port':0x232c});config['redis']=_[_0x55c7('0xa')](config[_0x55c7('0xb')],{'host':_0x55c7('0xc'),'port':0x18eb});var socket=require(_0x55c7('0xd'))(new Redis(config[_0x55c7('0xb')]));require(_0x55c7('0xe'))[_0x55c7('0xf')](socket);function respondWithRpcPromise(_0x3782b3,_0x4a8609,_0x5d6eda){return new BPromise(function(_0x2e6f7f,_0x15c457){return client[_0x55c7('0x10')](_0x3782b3,_0x5d6eda)[_0x55c7('0x11')](function(_0x205581){logger[_0x55c7('0x12')](_0x55c7('0x13'),_0x4a8609,'request\x20sent');logger[_0x55c7('0x14')](_0x55c7('0x15'),_0x4a8609,'request\x20sent',JSON['stringify'](_0x205581));if(_0x205581[_0x55c7('0x16')]){if(_0x205581[_0x55c7('0x16')][_0x55c7('0x17')]===0x1f4){logger[_0x55c7('0x16')]('FaxAccount,\x20%s,\x20%s',_0x4a8609,_0x205581[_0x55c7('0x16')][_0x55c7('0x18')]);return _0x15c457(_0x205581[_0x55c7('0x16')]['message']);}logger[_0x55c7('0x16')]('FaxAccount,\x20%s,\x20%s',_0x4a8609,_0x205581[_0x55c7('0x16')]['message']);return _0x2e6f7f(_0x205581[_0x55c7('0x16')]['message']);}else{logger[_0x55c7('0x12')](_0x55c7('0x13'),_0x4a8609,'request\x20sent');_0x2e6f7f(_0x205581[_0x55c7('0x19')][_0x55c7('0x18')]);}})[_0x55c7('0x1a')](function(_0x423a83){logger[_0x55c7('0x16')](_0x55c7('0x13'),_0x4a8609,_0x423a83);_0x15c457(_0x423a83);});});}exports[_0x55c7('0x1b')]=function(_0x2ead03){var _0x2ef21d=this;return new Promise(function(_0x46da1f,_0x133b0c){return db[_0x55c7('0x1c')]['findAll']({'raw':_0x2ead03[_0x55c7('0x1d')]?_0x2ead03[_0x55c7('0x1d')][_0x55c7('0x1e')]===undefined?!![]:![]:!![],'where':_0x2ead03[_0x55c7('0x1d')]?_0x2ead03[_0x55c7('0x1d')]['where']||null:null,'attributes':_0x2ead03[_0x55c7('0x1d')]?_0x2ead03['options'][_0x55c7('0x1f')]||null:null,'limit':_0x2ead03[_0x55c7('0x1d')]?_0x2ead03[_0x55c7('0x1d')][_0x55c7('0x20')]||null:null,'include':_0x2ead03[_0x55c7('0x1d')]?_0x2ead03[_0x55c7('0x1d')]['include']?_[_0x55c7('0x21')](_0x2ead03['options'][_0x55c7('0x22')],function(_0x180ad4){return{'model':db[_0x180ad4['model']],'as':_0x180ad4['as'],'attributes':_0x180ad4[_0x55c7('0x1f')],'include':_0x180ad4[_0x55c7('0x22')]?_['map'](_0x180ad4[_0x55c7('0x22')],function(_0x3f4444){return{'model':db[_0x3f4444[_0x55c7('0x23')]],'as':_0x3f4444['as'],'attributes':_0x3f4444['attributes'],'include':_0x3f4444['include']?_[_0x55c7('0x21')](_0x3f4444['include'],function(_0xb5c422){return{'model':db[_0xb5c422[_0x55c7('0x23')]],'as':_0xb5c422['as'],'attributes':_0xb5c422[_0x55c7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x55c7('0x11')](function(_0x176ab4){logger[_0x55c7('0x12')](_0x55c7('0x1b'),_0x2ead03);logger[_0x55c7('0x14')](_0x55c7('0x1b'),_0x2ead03,JSON[_0x55c7('0x24')](_0x176ab4));_0x46da1f(_0x176ab4);})[_0x55c7('0x1a')](function(_0xf58dac){logger[_0x55c7('0x16')](_0x55c7('0x1b'),_0xf58dac['message'],_0x2ead03);_0x133b0c(_0x2ef21d[_0x55c7('0x16')](0x1f4,_0xf58dac[_0x55c7('0x18')]));});});};exports[_0x55c7('0x25')]=function(_0x528606,_0x90b1cf,_0x426033){var _0xe44f23=this;return new Promise(function(_0x1cebfb,_0x206272){var _0x32f56d={'body':_0x528606[_0x55c7('0x26')],'channel':_0x55c7('0x27')};var _0xcf3392=[];var _0x27a77f=[];var _0x3c0dea={};return db[_0x55c7('0x28')]['describe']()[_0x55c7('0x11')](function(_0x6d4dab){if(!_0x6d4dab){throw new db[(_0x55c7('0x29'))]['ValidationError'](_0x55c7('0x2a'));}_0xcf3392=_[_0x55c7('0x2b')](_['keys'](_0x6d4dab),[_0x55c7('0x2c'),'updatedAt']);_0x27a77f=_[_0x55c7('0x2b')](_[_0x55c7('0x2d')](_0x6d4dab),[_0x55c7('0x2c'),_0x55c7('0x2e'),_0x55c7('0x2f'),_0x55c7('0x30')]);if(_0x528606[_0x55c7('0x26')]['id']){delete _0x528606[_0x55c7('0x26')]['id'];}if(_[_0x55c7('0x31')](_0x528606['body']['from'])){throw new db[(_0x55c7('0x29'))]['ValidationError'](_0x55c7('0x32'));}if(_[_0x55c7('0x31')](_0x528606['body'][_0x55c7('0x26')])||_0x528606[_0x55c7('0x26')][_0x55c7('0x26')]===''){throw new db[(_0x55c7('0x29'))][(_0x55c7('0x33'))](_0x55c7('0x34'));}if(_[_0x55c7('0x31')](_0x528606[_0x55c7('0x26')][_0x55c7('0x35')])){throw new db[(_0x55c7('0x29'))][(_0x55c7('0x33'))](_0x55c7('0x36')+_0x27a77f);}if(!_[_0x55c7('0x37')](_0x27a77f,_0x528606[_0x55c7('0x26')][_0x55c7('0x35')])){throw new db['Sequelize'][(_0x55c7('0x33'))](_0x55c7('0x38')+_0x27a77f);}_0x3c0dea[_0x528606['body'][_0x55c7('0x35')]]=_0x528606['body'][_0x55c7('0x39')];})['then'](function(){return db[_0x55c7('0x1c')][_0x55c7('0x3a')]({'where':{'id':_0x528606[_0x55c7('0x3b')]['id']},'include':[{'model':db[_0x55c7('0x3c')],'as':_0x55c7('0x3d'),'include':[{'model':db[_0x55c7('0x28')],'as':_0x55c7('0x3e'),'where':_0x3c0dea,'limit':0x1,'order':[[_0x55c7('0x2e'),_0x55c7('0x3f')]]}]},{'model':db[_0x55c7('0x40')],'as':_0x55c7('0x41')}]});})['then'](function(_0x538da6){if(_0x538da6&&_0x538da6[_0x55c7('0x3d')]){var _0x272d47=_0x538da6[_0x55c7('0x42')]({'plain':!![]});_0x32f56d[_0x55c7('0x3b')]=_0x272d47;_0x32f56d['applications']=_0x272d47[_0x55c7('0x41')];_0x32f56d[_0x55c7('0x43')]=_0x272d47[_0x55c7('0x3d')];_0x32f56d['applications']=_['orderBy'](_0x32f56d[_0x55c7('0x44')],[_0x55c7('0x45')],[_0x55c7('0x46')]);if(_0x32f56d[_0x55c7('0x3b')][_0x55c7('0x41')]){delete _0x32f56d[_0x55c7('0x3b')][_0x55c7('0x41')];}if(_0x32f56d[_0x55c7('0x3b')][_0x55c7('0x3d')]&&_0x32f56d[_0x55c7('0x3b')][_0x55c7('0x3d')]['Contacts'][_0x55c7('0x47')]){return _0x32f56d[_0x55c7('0x3b')][_0x55c7('0x3d')]['Contacts'][0x0];}var _0x10f266=_['defaults'](_0x528606[_0x55c7('0x26')],{'firstName':_0x528606['body'][_0x55c7('0x39')],'ListId':_0x272d47[_0x55c7('0x30')]});_0x10f266[_0x528606[_0x55c7('0x26')]['mapKey']]=_0x528606[_0x55c7('0x26')]['from'];return db[_0x55c7('0x28')][_0x55c7('0x48')](_0x10f266,{'fields':_0xcf3392,'raw':!![]});}})[_0x55c7('0x11')](function(_0x3789c8){_0x32f56d[_0x55c7('0x49')]=_0x3789c8;if(_0x3789c8){var _0x2dd365={'ContactId':_0x3789c8['id'],'FaxAccountId':_0x528606['account']['id'],'fax':_0x3789c8['fax']};return db[_0x55c7('0x4a')][_0x55c7('0x3a')]({'where':{'ContactId':_0x3789c8['id'],'closed':![],'FaxAccountId':_0x528606[_0x55c7('0x3b')]['id']}})[_0x55c7('0x11')](function(_0x4bfa54){if(_0x4bfa54){return[_0x4bfa54,![]];}return db[_0x55c7('0x4a')][_0x55c7('0x48')](_0x2dd365)[_0x55c7('0x11')](function(_0xce5d93){return[_0xce5d93,!![]];});});}else{throw new Error(_0x55c7('0x4b'));}})[_0x55c7('0x4c')](function(_0x5c1e65,_0x105d7e){var _0x52825a=_0x5c1e65[_0x55c7('0x42')]({'plain':!![]});if(_0x105d7e){if(_0x32f56d[_0x55c7('0x3b')]['autoclose']){_0x32f56d[_0x55c7('0x44')][_0x55c7('0x4d')]({'id':0x0,'priority':_0x32f56d[_0x55c7('0x44')][_0x55c7('0x47')]+0x1,'app':_0x55c7('0x4e'),'appdata':_0x55c7('0x4f'),'interval':_0x55c7('0x50')});}_0x52825a[_0x55c7('0x51')]=!![];}else{_0x52825a[_0x55c7('0x51')]=![];}_0x32f56d[_0x55c7('0x52')]=_0x52825a;return db['FaxMessage'][_0x55c7('0x48')]({'body':_0x528606[_0x55c7('0x26')][_0x55c7('0x26')],'FaxAccountId':_0x528606[_0x55c7('0x3b')]['id'],'FaxInteractionId':_0x5c1e65['id'],'direction':'in','ContactId':_0x5c1e65[_0x55c7('0x53')],'AttachmentId':_0x528606[_0x55c7('0x26')]['AttachmentId']});})[_0x55c7('0x11')](function(_0x5676fc){_0x32f56d[_0x55c7('0x18')]=_0x5676fc;if(_0x32f56d[_0x55c7('0x52')]['UserId']){return db[_0x55c7('0x54')][_0x55c7('0x3a')]({'attributes':['id',_0x55c7('0x55')],'where':{'id':_0x32f56d[_0x55c7('0x52')][_0x55c7('0x56')]}})[_0x55c7('0x11')](function(_0x5abd24){if(_0x5abd24){_0x32f56d[_0x55c7('0x44')]['unshift']({'id':0x0,'priority':0x0,'app':_0x55c7('0x57'),'appdata':_0x5abd24[_0x55c7('0x55')]+','+(_0x32f56d[_0x55c7('0x3b')][_0x55c7('0x58')]||0xa),'interval':_0x55c7('0x50')});}return respondWithRpcPromise(_0x55c7('0x59'),_0x55c7('0x5a'),_0x32f56d);});}return respondWithRpcPromise(_0x55c7('0x59'),_0x55c7('0x5a'),_0x32f56d);})['then'](function(_0x1ff893){_0x1cebfb(_0x1ff893);})[_0x55c7('0x1a')](function(_0x925b2c){_0x206272(_0xe44f23['error'](0x1f4,_0x925b2c[_0x55c7('0x18')]));});});}; \ No newline at end of file +var _0x6e73=['length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetFaxAccount','findAll','options','raw','where','limit','include','map','attributes','model','debug','stringify','body','fax','CmContact','describe','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','ValidationError','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','List','DESC','FaxApplication','get','applications','Applications','list','orderBy','priority','asc','account','Contacts'];(function(_0x1dffa3,_0x3c967a){var _0x49e93e=function(_0x1b2c0c){while(--_0x1b2c0c){_0x1dffa3['push'](_0x1dffa3['shift']());}};_0x49e93e(++_0x3c967a);}(_0x6e73,0xdb));var _0x36e7=function(_0x4b2531,_0x1b39e3){_0x4b2531=_0x4b2531-0x0;var _0x3ec524=_0x6e73[_0x4b2531];return _0x3ec524;};'use strict';var _=require(_0x36e7('0x0'));var util=require(_0x36e7('0x1'));var moment=require(_0x36e7('0x2'));var BPromise=require(_0x36e7('0x3'));var rs=require(_0x36e7('0x4'));var fs=require('fs');var Redis=require(_0x36e7('0x5'));var db=require(_0x36e7('0x6'))['db'];var utils=require(_0x36e7('0x7'));var logger=require(_0x36e7('0x8'))(_0x36e7('0x9'));var config=require(_0x36e7('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x36e7('0xb')][_0x36e7('0xc')]({'port':0x232c});config[_0x36e7('0xd')]=_['defaults'](config[_0x36e7('0xd')],{'host':_0x36e7('0xe'),'port':0x18eb});var socket=require(_0x36e7('0xf'))(new Redis(config['redis']));require(_0x36e7('0x10'))[_0x36e7('0x11')](socket);function respondWithRpcPromise(_0xfb8752,_0x375e7a,_0x51abdb){return new BPromise(function(_0x4b2a62,_0x1f76b8){return client[_0x36e7('0x12')](_0xfb8752,_0x51abdb)[_0x36e7('0x13')](function(_0x167854){logger[_0x36e7('0x14')](_0x36e7('0x15'),_0x375e7a,_0x36e7('0x16'));logger['debug'](_0x36e7('0x17'),_0x375e7a,_0x36e7('0x16'),JSON['stringify'](_0x167854));if(_0x167854['error']){if(_0x167854['error'][_0x36e7('0x18')]===0x1f4){logger[_0x36e7('0x19')]('FaxAccount,\x20%s,\x20%s',_0x375e7a,_0x167854['error'][_0x36e7('0x1a')]);return _0x1f76b8(_0x167854[_0x36e7('0x19')][_0x36e7('0x1a')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x375e7a,_0x167854[_0x36e7('0x19')][_0x36e7('0x1a')]);return _0x4b2a62(_0x167854['error'][_0x36e7('0x1a')]);}else{logger[_0x36e7('0x14')](_0x36e7('0x15'),_0x375e7a,_0x36e7('0x16'));_0x4b2a62(_0x167854[_0x36e7('0x1b')][_0x36e7('0x1a')]);}})[_0x36e7('0x1c')](function(_0x52a3aa){logger[_0x36e7('0x19')](_0x36e7('0x15'),_0x375e7a,_0x52a3aa);_0x1f76b8(_0x52a3aa);});});}exports[_0x36e7('0x1d')]=function(_0x4a49c4){var _0x28d012=this;return new Promise(function(_0x449f8,_0x797790){return db['FaxAccount'][_0x36e7('0x1e')]({'raw':_0x4a49c4[_0x36e7('0x1f')]?_0x4a49c4[_0x36e7('0x1f')][_0x36e7('0x20')]===undefined?!![]:![]:!![],'where':_0x4a49c4[_0x36e7('0x1f')]?_0x4a49c4[_0x36e7('0x1f')][_0x36e7('0x21')]||null:null,'attributes':_0x4a49c4[_0x36e7('0x1f')]?_0x4a49c4[_0x36e7('0x1f')]['attributes']||null:null,'limit':_0x4a49c4[_0x36e7('0x1f')]?_0x4a49c4[_0x36e7('0x1f')][_0x36e7('0x22')]||null:null,'include':_0x4a49c4[_0x36e7('0x1f')]?_0x4a49c4[_0x36e7('0x1f')][_0x36e7('0x23')]?_[_0x36e7('0x24')](_0x4a49c4[_0x36e7('0x1f')]['include'],function(_0x34a3c1){return{'model':db[_0x34a3c1['model']],'as':_0x34a3c1['as'],'attributes':_0x34a3c1[_0x36e7('0x25')],'include':_0x34a3c1[_0x36e7('0x23')]?_[_0x36e7('0x24')](_0x34a3c1['include'],function(_0x16487e){return{'model':db[_0x16487e[_0x36e7('0x26')]],'as':_0x16487e['as'],'attributes':_0x16487e[_0x36e7('0x25')],'include':_0x16487e[_0x36e7('0x23')]?_[_0x36e7('0x24')](_0x16487e[_0x36e7('0x23')],function(_0x592b8d){return{'model':db[_0x592b8d['model']],'as':_0x592b8d['as'],'attributes':_0x592b8d[_0x36e7('0x25')]};}):[]};}):[]};}):[]:[]})[_0x36e7('0x13')](function(_0x39e5cd){logger[_0x36e7('0x14')]('GetFaxAccount',_0x4a49c4);logger[_0x36e7('0x27')](_0x36e7('0x1d'),_0x4a49c4,JSON[_0x36e7('0x28')](_0x39e5cd));_0x449f8(_0x39e5cd);})[_0x36e7('0x1c')](function(_0x210e6b){logger[_0x36e7('0x19')](_0x36e7('0x1d'),_0x210e6b['message'],_0x4a49c4);_0x797790(_0x28d012[_0x36e7('0x19')](0x1f4,_0x210e6b[_0x36e7('0x1a')]));});});};exports['NotifyFaxAccount']=function(_0x969ba4,_0x412e7f,_0x4a1296){var _0x47393d=this;return new Promise(function(_0x4acc18,_0x4de2f1){var _0x5b962e={'body':_0x969ba4[_0x36e7('0x29')],'channel':_0x36e7('0x2a')};var _0x18c25b=[];var _0x11a3a1=[];var _0x52e12e={};return db[_0x36e7('0x2b')][_0x36e7('0x2c')]()['then'](function(_0x4bcc1e){if(!_0x4bcc1e){throw new db['Sequelize']['ValidationError'](_0x36e7('0x2d'));}_0x18c25b=_[_0x36e7('0x2e')](_[_0x36e7('0x2f')](_0x4bcc1e),[_0x36e7('0x30'),_0x36e7('0x31')]);_0x11a3a1=_[_0x36e7('0x2e')](_['keys'](_0x4bcc1e),['createdAt','updatedAt',_0x36e7('0x32'),_0x36e7('0x33')]);if(_0x969ba4[_0x36e7('0x29')]['id']){delete _0x969ba4[_0x36e7('0x29')]['id'];}if(_['isNil'](_0x969ba4[_0x36e7('0x29')][_0x36e7('0x34')])){throw new db[(_0x36e7('0x35'))][(_0x36e7('0x36'))](_0x36e7('0x37'));}if(_[_0x36e7('0x38')](_0x969ba4[_0x36e7('0x29')]['body'])||_0x969ba4['body'][_0x36e7('0x29')]===''){throw new db[(_0x36e7('0x35'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x36e7('0x38')](_0x969ba4[_0x36e7('0x29')][_0x36e7('0x39')])){throw new db[(_0x36e7('0x35'))][(_0x36e7('0x36'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11a3a1);}if(!_[_0x36e7('0x3a')](_0x11a3a1,_0x969ba4[_0x36e7('0x29')][_0x36e7('0x39')])){throw new db[(_0x36e7('0x35'))][(_0x36e7('0x36'))](_0x36e7('0x3b')+_0x11a3a1);}_0x52e12e[_0x969ba4[_0x36e7('0x29')][_0x36e7('0x39')]]=_0x969ba4[_0x36e7('0x29')][_0x36e7('0x34')];})[_0x36e7('0x13')](function(){return db[_0x36e7('0x3c')][_0x36e7('0x3d')]({'where':{'id':_0x969ba4['account']['id']},'include':[{'model':db[_0x36e7('0x3e')],'as':_0x36e7('0x3f'),'include':[{'model':db[_0x36e7('0x2b')],'as':'Contacts','where':_0x52e12e,'limit':0x1,'order':[[_0x36e7('0x31'),_0x36e7('0x40')]]}]},{'model':db[_0x36e7('0x41')],'as':'Applications'}]});})[_0x36e7('0x13')](function(_0x4af24a){if(_0x4af24a&&_0x4af24a['List']){var _0x607fcf=_0x4af24a[_0x36e7('0x42')]({'plain':!![]});_0x5b962e['account']=_0x607fcf;_0x5b962e[_0x36e7('0x43')]=_0x607fcf[_0x36e7('0x44')];_0x5b962e[_0x36e7('0x45')]=_0x607fcf[_0x36e7('0x3f')];_0x5b962e[_0x36e7('0x43')]=_[_0x36e7('0x46')](_0x5b962e[_0x36e7('0x43')],[_0x36e7('0x47')],[_0x36e7('0x48')]);if(_0x5b962e['account'][_0x36e7('0x44')]){delete _0x5b962e[_0x36e7('0x49')][_0x36e7('0x44')];}if(_0x5b962e[_0x36e7('0x49')]['List']&&_0x5b962e[_0x36e7('0x49')][_0x36e7('0x3f')][_0x36e7('0x4a')][_0x36e7('0x4b')]){return _0x5b962e['account']['List'][_0x36e7('0x4a')][0x0];}var _0x2dbfdd=_[_0x36e7('0x4c')](_0x969ba4['body'],{'firstName':_0x969ba4[_0x36e7('0x29')][_0x36e7('0x34')],'ListId':_0x607fcf[_0x36e7('0x33')]});_0x2dbfdd[_0x969ba4[_0x36e7('0x29')]['mapKey']]=_0x969ba4[_0x36e7('0x29')]['from'];return db[_0x36e7('0x2b')][_0x36e7('0x4d')](_0x2dbfdd,{'fields':_0x18c25b,'raw':!![]});}})['then'](function(_0x2f5010){_0x5b962e[_0x36e7('0x4e')]=_0x2f5010;if(_0x2f5010){var _0x5f35d3={'ContactId':_0x2f5010['id'],'FaxAccountId':_0x969ba4[_0x36e7('0x49')]['id'],'fax':_0x2f5010[_0x36e7('0x2a')]};return db[_0x36e7('0x4f')]['find']({'where':{'ContactId':_0x2f5010['id'],'closed':![],'FaxAccountId':_0x969ba4['account']['id']}})[_0x36e7('0x13')](function(_0x3fe7a8){if(_0x3fe7a8){return[_0x3fe7a8,![]];}return db[_0x36e7('0x4f')][_0x36e7('0x4d')](_0x5f35d3)[_0x36e7('0x13')](function(_0x2bc871){return[_0x2bc871,!![]];});});}else{throw new Error(_0x36e7('0x50'));}})['spread'](function(_0x29c7dd,_0x24fa93){var _0x32d215=_0x29c7dd['get']({'plain':!![]});if(_0x24fa93){if(_0x5b962e[_0x36e7('0x49')][_0x36e7('0x51')]){_0x5b962e['applications'][_0x36e7('0x52')]({'id':0x0,'priority':_0x5b962e[_0x36e7('0x43')][_0x36e7('0x4b')]+0x1,'app':'close','appdata':_0x36e7('0x53'),'interval':'*,*,*,*'});}_0x32d215[_0x36e7('0x54')]=!![];}else{_0x32d215[_0x36e7('0x54')]=![];}_0x5b962e[_0x36e7('0x55')]=_0x32d215;return db[_0x36e7('0x56')][_0x36e7('0x4d')]({'body':_0x969ba4[_0x36e7('0x29')]['body'],'FaxAccountId':_0x969ba4['account']['id'],'FaxInteractionId':_0x29c7dd['id'],'direction':'in','ContactId':_0x29c7dd[_0x36e7('0x57')],'AttachmentId':_0x969ba4[_0x36e7('0x29')][_0x36e7('0x58')]});})[_0x36e7('0x13')](function(_0x52a95e){_0x5b962e[_0x36e7('0x1a')]=_0x52a95e;if(_0x5b962e[_0x36e7('0x55')][_0x36e7('0x59')]){return db[_0x36e7('0x5a')][_0x36e7('0x3d')]({'attributes':['id',_0x36e7('0x5b')],'where':{'id':_0x5b962e[_0x36e7('0x55')][_0x36e7('0x59')]}})[_0x36e7('0x13')](function(_0x3f5461){if(_0x3f5461){_0x5b962e[_0x36e7('0x43')][_0x36e7('0x5c')]({'id':0x0,'priority':0x0,'app':_0x36e7('0x5d'),'appdata':_0x3f5461[_0x36e7('0x5b')]+','+(_0x5b962e[_0x36e7('0x49')][_0x36e7('0x5e')]||0xa),'interval':_0x36e7('0x5f')});}return respondWithRpcPromise(_0x36e7('0x60'),_0x36e7('0x61'),_0x5b962e);});}return respondWithRpcPromise(_0x36e7('0x60'),_0x36e7('0x61'),_0x5b962e);})[_0x36e7('0x13')](function(_0x5b4433){_0x4acc18(_0x5b4433);})[_0x36e7('0x1c')](function(_0x1d382f){_0x4de2f1(_0x47393d[_0x36e7('0x19')](0x1f4,_0x1d382f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index b1bc4fe..be396f5 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 _0x27a0=['length','faxAccount:','save','remove','update','removeListener','register'];(function(_0x584948,_0x196f5b){var _0x28fdb6=function(_0x428bdf){while(--_0x428bdf){_0x584948['push'](_0x584948['shift']());}};_0x28fdb6(++_0x196f5b);}(_0x27a0,0xbf));var _0x027a=function(_0x6789aa,_0xcd8ced){_0x6789aa=_0x6789aa-0x0;var _0xce7265=_0x27a0[_0x6789aa];return _0xce7265;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x027a('0x0'),_0x027a('0x1'),_0x027a('0x2')];function createListener(_0x352dd7,_0x32e5e0){return function(_0x59cd58){_0x32e5e0['emit'](_0x352dd7,_0x59cd58);};}function removeListener(_0x4e8d6b,_0x47cd65){return function(){FaxAccountEvents[_0x027a('0x3')](_0x4e8d6b,_0x47cd65);};}exports[_0x027a('0x4')]=function(_0x137b09){for(var _0x639bec=0x0,_0xe233ed=events[_0x027a('0x5')];_0x639bec<_0xe233ed;_0x639bec++){var _0x550fbb=events[_0x639bec];var _0x3d1429=createListener(_0x027a('0x6')+_0x550fbb,_0x137b09);FaxAccountEvents['on'](_0x550fbb,_0x3d1429);}}; \ No newline at end of file +var _0xffd6=['save','remove','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x1d2520,_0x105606){var _0x22fd54=function(_0x2c3123){while(--_0x2c3123){_0x1d2520['push'](_0x1d2520['shift']());}};_0x22fd54(++_0x105606);}(_0xffd6,0x97));var _0x6ffd=function(_0x3877c1,_0x238c29){_0x3877c1=_0x3877c1-0x0;var _0x59056a=_0xffd6[_0x3877c1];return _0x59056a;};'use strict';var FaxAccountEvents=require(_0x6ffd('0x0'));var events=[_0x6ffd('0x1'),_0x6ffd('0x2'),'update'];function createListener(_0x589640,_0x305b6b){return function(_0x400c43){_0x305b6b[_0x6ffd('0x3')](_0x589640,_0x400c43);};}function removeListener(_0x560afa,_0x1d12e3){return function(){FaxAccountEvents[_0x6ffd('0x4')](_0x560afa,_0x1d12e3);};}exports[_0x6ffd('0x5')]=function(_0x2949a4){for(var _0x561055=0x0,_0x122b71=events[_0x6ffd('0x6')];_0x561055<_0x122b71;_0x561055++){var _0x2445a0=events[_0x561055];var _0x1fbbe6=createListener(_0x6ffd('0x7')+_0x2445a0,_0x2949a4);FaxAccountEvents['on'](_0x2445a0,_0x1fbbe6);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index be5587b..b621224 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 _0x190e=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/interactions','/addaccountapplications','addAccountApplications','/:id/send','addAgents','update','delete','destroy','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x46fc1a,_0x2a398b){var _0x50b5d9=function(_0xad2f43){while(--_0xad2f43){_0x46fc1a['push'](_0x46fc1a['shift']());}};_0x50b5d9(++_0x2a398b);}(_0x190e,0x67));var _0xe190=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x190e[_0x51fe5f];return _0x4abce9;};'use strict';var multer=require(_0xe190('0x0'));var util=require('util');var path=require(_0xe190('0x1'));var timeout=require(_0xe190('0x2'));var express=require(_0xe190('0x3'));var router=express[_0xe190('0x4')]();var auth=require(_0xe190('0x5'));var interaction=require(_0xe190('0x6'));var config=require(_0xe190('0x7'));var controller=require('./faxAccount.controller');router[_0xe190('0x8')]('/',auth[_0xe190('0x9')](),controller[_0xe190('0xa')]);router[_0xe190('0x8')](_0xe190('0xb'),auth[_0xe190('0x9')](),controller[_0xe190('0xc')]);router['get'](_0xe190('0xd'),auth[_0xe190('0x9')](),controller[_0xe190('0xe')]);router[_0xe190('0x8')](_0xe190('0xf'),auth[_0xe190('0x9')](),controller[_0xe190('0x10')]);router[_0xe190('0x8')](_0xe190('0x11'),auth['isAuthenticated'](),controller[_0xe190('0x12')]);router[_0xe190('0x8')]('/:id/interactions',auth[_0xe190('0x9')](),controller[_0xe190('0x13')]);router[_0xe190('0x8')](_0xe190('0x14'),auth[_0xe190('0x9')](),controller['getApplications']);router[_0xe190('0x8')](_0xe190('0x15'),auth[_0xe190('0x9')](),controller[_0xe190('0x16')]);router[_0xe190('0x8')](_0xe190('0x17'),auth['isAuthenticated'](),controller[_0xe190('0x18')]);router[_0xe190('0x19')]('/',auth[_0xe190('0x9')](),controller['create']);router[_0xe190('0x19')](_0xe190('0xf'),auth[_0xe190('0x9')](),controller[_0xe190('0x1a')]);router['post'](_0xe190('0x11'),auth[_0xe190('0x9')](),controller[_0xe190('0x1b')]);router['post'](_0xe190('0x1c'),auth[_0xe190('0x9')](),controller['addInteraction']);router[_0xe190('0x19')](_0xe190('0x14'),auth[_0xe190('0x9')](),controller['addApplications']);router['post'](_0xe190('0x1d'),auth['isAuthenticated'](),controller[_0xe190('0x1e')]);router[_0xe190('0x19')]('/updateaccountapplications',auth[_0xe190('0x9')](),controller['updateAccountApplications']);router[_0xe190('0x19')](_0xe190('0x1f'),auth[_0xe190('0x9')](),controller['send']);router[_0xe190('0x19')](_0xe190('0x17'),auth[_0xe190('0x9')](),controller[_0xe190('0x20')]);router['put'](_0xe190('0xd'),auth['isAuthenticated'](),controller[_0xe190('0x21')]);router[_0xe190('0x22')](_0xe190('0xd'),auth[_0xe190('0x9')](),controller[_0xe190('0x23')]);router[_0xe190('0x22')](_0xe190('0xf'),auth[_0xe190('0x9')](),controller[_0xe190('0x24')]);router[_0xe190('0x22')](_0xe190('0x11'),auth[_0xe190('0x9')](),controller[_0xe190('0x25')]);router[_0xe190('0x22')](_0xe190('0x17'),auth[_0xe190('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x9d24=['addDisposition','/:id/interactions','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','getAgents','post'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x9d24,0xb5));var _0x49d2=function(_0x3e91fb,_0x5945bc){_0x3e91fb=_0x3e91fb-0x0;var _0x4cbafc=_0x9d24[_0x3e91fb];return _0x4cbafc;};'use strict';var multer=require(_0x49d2('0x0'));var util=require(_0x49d2('0x1'));var path=require('path');var timeout=require(_0x49d2('0x2'));var express=require(_0x49d2('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x49d2('0x4'));var config=require(_0x49d2('0x5'));var controller=require(_0x49d2('0x6'));router['get']('/',auth[_0x49d2('0x7')](),controller['index']);router[_0x49d2('0x8')](_0x49d2('0x9'),auth[_0x49d2('0x7')](),controller[_0x49d2('0xa')]);router['get'](_0x49d2('0xb'),auth[_0x49d2('0x7')](),controller[_0x49d2('0xc')]);router[_0x49d2('0x8')](_0x49d2('0xd'),auth[_0x49d2('0x7')](),controller[_0x49d2('0xe')]);router['get'](_0x49d2('0xf'),auth['isAuthenticated'](),controller[_0x49d2('0x10')]);router[_0x49d2('0x8')]('/:id/interactions',auth[_0x49d2('0x7')](),controller[_0x49d2('0x11')]);router['get'](_0x49d2('0x12'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x13')]);router[_0x49d2('0x8')](_0x49d2('0x14'),auth[_0x49d2('0x7')](),controller['getMessages']);router[_0x49d2('0x8')](_0x49d2('0x15'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x16')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x49d2('0x17')](_0x49d2('0xd'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x18')]);router[_0x49d2('0x17')](_0x49d2('0xf'),auth[_0x49d2('0x7')](),controller['addAnswer']);router[_0x49d2('0x17')](_0x49d2('0x19'),auth['isAuthenticated'](),controller[_0x49d2('0x1a')]);router[_0x49d2('0x17')](_0x49d2('0x12'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x1b')]);router[_0x49d2('0x17')]('/addaccountapplications',auth[_0x49d2('0x7')](),controller[_0x49d2('0x1c')]);router[_0x49d2('0x17')](_0x49d2('0x1d'),auth['isAuthenticated'](),controller[_0x49d2('0x1e')]);router[_0x49d2('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0x49d2('0x1f')]);router[_0x49d2('0x17')](_0x49d2('0x15'),auth['isAuthenticated'](),controller[_0x49d2('0x20')]);router[_0x49d2('0x21')]('/:id',auth[_0x49d2('0x7')](),controller[_0x49d2('0x22')]);router[_0x49d2('0x23')](_0x49d2('0xb'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x24')]);router[_0x49d2('0x23')](_0x49d2('0xd'),auth['isAuthenticated'](),controller[_0x49d2('0x25')]);router[_0x49d2('0x23')](_0x49d2('0xf'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x26')]);router[_0x49d2('0x23')](_0x49d2('0x15'),auth[_0x49d2('0x7')](),controller[_0x49d2('0x27')]);module[_0x49d2('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index f65c72a..abfd7e7 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 _0x08d3=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x52e9d8,_0x35484e){var _0x1d4f72=function(_0x5a7c3b){while(--_0x5a7c3b){_0x52e9d8['push'](_0x52e9d8['shift']());}};_0x1d4f72(++_0x35484e);}(_0x08d3,0x119));var _0x308d=function(_0x5088ad,_0x2aa849){_0x5088ad=_0x5088ad-0x0;var _0x16ec9e=_0x08d3[_0x5088ad];return _0x16ec9e;};'use strict';var Sequelize=require(_0x308d('0x0'));module[_0x308d('0x1')]={'priority':{'type':Sequelize[_0x308d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x308d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x308d('0x3')]},'interval':{'type':Sequelize[_0x308d('0x3')],'defaultValue':_0x308d('0x4')}}; \ No newline at end of file +var _0x9e38=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1b6feb,_0x3f2115){var _0x25b42b=function(_0x37427a){while(--_0x37427a){_0x1b6feb['push'](_0x1b6feb['shift']());}};_0x25b42b(++_0x3f2115);}(_0x9e38,0x155));var _0x89e3=function(_0x5d23be,_0x3b4f3c){_0x5d23be=_0x5d23be-0x0;var _0x4d60a9=_0x9e38[_0x5d23be];return _0x4d60a9;};'use strict';var Sequelize=require(_0x89e3('0x0'));module[_0x89e3('0x1')]={'priority':{'type':Sequelize[_0x89e3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x89e3('0x3')],'allowNull':![],'defaultValue':_0x89e3('0x4')},'appdata':{'type':Sequelize[_0x89e3('0x5')]()},'description':{'type':Sequelize[_0x89e3('0x3')]},'interval':{'type':Sequelize[_0x89e3('0x3')],'defaultValue':_0x89e3('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 49c737a..e324b24 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 _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(_0x1b0900,_0x17d4cc){var _0x25a9af=function(_0x5506b4){while(--_0x5506b4){_0x1b0900['push'](_0x1b0900['shift']());}};_0x25a9af(++_0x17d4cc);}(_0x1261,0x144));var _0x1126=function(_0x2be240,_0x1e119d){_0x2be240=_0x2be240-0x0;var _0x123543=_0x1261[_0x2be240];return _0x123543;};'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 +var _0x8ef6=['sort','filters','filter','where','merge','options','count','then','includeAll','include','rows','catch','show','params','keys','length','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','set','apply','reject','save','update','end','error','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','limit','order'];(function(_0x54ec37,_0x4c2b1c){var _0x397ebf=function(_0x7b596f){while(--_0x7b596f){_0x54ec37['push'](_0x54ec37['shift']());}};_0x397ebf(++_0x4c2b1c);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3e5d29,_0x43c598){_0x3e5d29=_0x3e5d29-0x0;var _0x482c43=_0x8ef6[_0x3e5d29];return _0x482c43;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x46356f,_0x1e117a){_0x1e117a=_0x1e117a||0xcc;return function(_0x454ef4){if(_0x454ef4){return _0x46356f[_0x68ef('0x1b')](_0x1e117a);}return _0x46356f[_0x68ef('0x1c')](_0x1e117a)['end']();};}function respondWithResult(_0x3b48dd,_0xc50cce){_0xc50cce=_0xc50cce||0xc8;return function(_0x2657c5){if(_0x2657c5){return _0x3b48dd['status'](_0xc50cce)[_0x68ef('0x1d')](_0x2657c5);}};}function respondWithFilteredResult(_0x1764de,_0x24682d){return function(_0x5005ba){if(_0x5005ba){var _0x35493d=_0x5005ba['count'],_0x37c4cc=_0x24682d[_0x68ef('0x1e')],_0x3d1e90=_0x24682d['offset']+_0x24682d['limit'],_0x3780a4;if(_0x3d1e90>=_0x35493d){_0x3d1e90=_0x35493d;_0x3780a4=0xc8;}else{_0x3780a4=0xce;}_0x1764de[_0x68ef('0x1c')](_0x3780a4);return _0x1764de[_0x68ef('0x1f')]('Content-Range',_0x37c4cc+'-'+_0x3d1e90+'/'+_0x35493d)['json'](_0x5005ba);}return null;};}function patchUpdates(_0x3c4c1f){return function(_0x2cd92c){try{jsonpatch[_0x68ef('0x20')](_0x2cd92c,_0x3c4c1f,!![]);}catch(_0x4fad1c){return BPromise[_0x68ef('0x21')](_0x4fad1c);}return _0x2cd92c[_0x68ef('0x22')]();};}function saveUpdates(_0x183f5f,_0x5b246b){return function(_0x3c46d4){if(_0x3c46d4){return _0x3c46d4[_0x68ef('0x23')](_0x183f5f)['then'](function(_0x399da4){return _0x399da4;});}return null;};}function removeEntity(_0xf4760f,_0x19aa3d){return function(_0x5ddec7){if(_0x5ddec7){return _0x5ddec7['destroy']()['then'](function(){_0xf4760f[_0x68ef('0x1c')](0xcc)[_0x68ef('0x24')]();});}};}function handleEntityNotFound(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(!_0x438b4c){_0x312cc9[_0x68ef('0x1b')](0x194);}return _0x438b4c;};}function handleError(_0x258cd5,_0x49374f){_0x49374f=_0x49374f||0x1f4;return function(_0x65fd09){logger[_0x68ef('0x25')](_0x65fd09['stack']);if(_0x65fd09[_0x68ef('0x26')]){delete _0x65fd09['name'];}_0x258cd5['status'](_0x49374f)['send'](_0x65fd09);};}exports[_0x68ef('0x27')]=function(_0x268f32,_0x123041){var _0x29518e={},_0x52e67e={},_0x4a0550={'count':0x0,'rows':[]};var _0x1cbe4f=_[_0x68ef('0x28')](db[_0x68ef('0x29')][_0x68ef('0x2a')],function(_0x22ef25){return{'name':_0x22ef25[_0x68ef('0x2b')],'type':_0x22ef25[_0x68ef('0x2c')][_0x68ef('0x2d')]};});_0x52e67e['model']=_[_0x68ef('0x28')](_0x1cbe4f,_0x68ef('0x26'));_0x52e67e[_0x68ef('0x2e')]=_['keys'](_0x268f32[_0x68ef('0x2e')]);_0x52e67e['filters']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],_0x52e67e['query']);_0x29518e['attributes']=_[_0x68ef('0x2f')](_0x52e67e[_0x68ef('0x30')],qs['fields'](_0x268f32[_0x68ef('0x2e')][_0x68ef('0x31')]));_0x29518e[_0x68ef('0x32')]=_0x29518e[_0x68ef('0x32')]['length']?_0x29518e[_0x68ef('0x32')]:_0x52e67e[_0x68ef('0x30')];if(!_0x268f32['query'][_0x68ef('0x33')]('nolimit')){_0x29518e[_0x68ef('0x34')]=qs[_0x68ef('0x34')](_0x268f32['query'][_0x68ef('0x34')]);_0x29518e['offset']=qs[_0x68ef('0x1e')](_0x268f32['query'][_0x68ef('0x1e')]);}_0x29518e[_0x68ef('0x35')]=qs[_0x68ef('0x36')](_0x268f32['query'][_0x68ef('0x36')]);_0x29518e['where']=qs[_0x68ef('0x37')](_['pick'](_0x268f32[_0x68ef('0x2e')],_0x52e67e[_0x68ef('0x37')]),_0x1cbe4f);if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x38')]){_0x29518e[_0x68ef('0x39')]=_[_0x68ef('0x3a')](_0x29518e['where'],{'$or':_[_0x68ef('0x28')](_0x1cbe4f,function(_0x15a6ab){if(_0x15a6ab[_0x68ef('0x2c')]!=='VIRTUAL'){var _0x32eddd={};_0x32eddd[_0x15a6ab[_0x68ef('0x26')]]={'$like':'%'+_0x268f32[_0x68ef('0x2e')]['filter']+'%'};return _0x32eddd;}})});}_0x29518e=_['merge']({},_0x29518e,_0x268f32[_0x68ef('0x3b')]);var _0xec7de3={'where':_0x29518e[_0x68ef('0x39')]};return db[_0x68ef('0x29')][_0x68ef('0x3c')](_0xec7de3)[_0x68ef('0x3d')](function(_0x41ffe0){_0x4a0550['count']=_0x41ffe0;if(_0x268f32[_0x68ef('0x2e')][_0x68ef('0x3e')]){_0x29518e[_0x68ef('0x3f')]=[{'all':!![]}];}return db[_0x68ef('0x29')]['findAll'](_0x29518e);})[_0x68ef('0x3d')](function(_0x3a2f53){_0x4a0550[_0x68ef('0x40')]=_0x3a2f53;return _0x4a0550;})[_0x68ef('0x3d')](respondWithFilteredResult(_0x123041,_0x29518e))[_0x68ef('0x41')](handleError(_0x123041,null));};exports[_0x68ef('0x42')]=function(_0x558efb,_0x3f000f){var _0x3f7699={'raw':!![],'where':{'id':_0x558efb[_0x68ef('0x43')]['id']}},_0xf5010c={};_0xf5010c[_0x68ef('0x30')]=_[_0x68ef('0x44')](db[_0x68ef('0x29')][_0x68ef('0x2a')]);_0xf5010c[_0x68ef('0x2e')]=_['keys'](_0x558efb[_0x68ef('0x2e')]);_0xf5010c[_0x68ef('0x37')]=_[_0x68ef('0x2f')](_0xf5010c[_0x68ef('0x30')],_0xf5010c[_0x68ef('0x2e')]);_0x3f7699[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0xf5010c['model'],qs[_0x68ef('0x31')](_0x558efb['query'][_0x68ef('0x31')]));_0x3f7699[_0x68ef('0x32')]=_0x3f7699[_0x68ef('0x32')][_0x68ef('0x45')]?_0x3f7699['attributes']:_0xf5010c[_0x68ef('0x30')];if(_0x558efb['query'][_0x68ef('0x3e')]){_0x3f7699['include']=[{'all':!![]}];}_0x3f7699=_[_0x68ef('0x3a')]({},_0x3f7699,_0x558efb[_0x68ef('0x3b')]);return db[_0x68ef('0x29')]['find'](_0x3f7699)['then'](handleEntityNotFound(_0x3f000f,null))[_0x68ef('0x3d')](respondWithResult(_0x3f000f,null))[_0x68ef('0x41')](handleError(_0x3f000f,null));};exports['create']=function(_0x589688,_0x4b4d6b){return db[_0x68ef('0x29')][_0x68ef('0x46')](_0x589688[_0x68ef('0x47')],{})[_0x68ef('0x3d')](respondWithResult(_0x4b4d6b,0xc9))[_0x68ef('0x41')](handleError(_0x4b4d6b,null));};exports['update']=function(_0x55f385,_0xc39f5b){if(_0x55f385[_0x68ef('0x47')]['id']){delete _0x55f385[_0x68ef('0x47')]['id'];}return db[_0x68ef('0x29')]['find']({'where':{'id':_0x55f385[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0xc39f5b,null))[_0x68ef('0x3d')](saveUpdates(_0x55f385[_0x68ef('0x47')],null))['then'](respondWithResult(_0xc39f5b,null))['catch'](handleError(_0xc39f5b,null));};exports[_0x68ef('0x48')]=function(_0x3c3074,_0x566e7c){return db[_0x68ef('0x29')][_0x68ef('0x49')]({'where':{'id':_0x3c3074[_0x68ef('0x43')]['id']}})[_0x68ef('0x3d')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x3d')](removeEntity(_0x566e7c,null))['catch'](handleError(_0x566e7c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 04de4aa..4b6a475 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 _0x061e=['./faxApplication.attributes','define','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x589353,_0x1baf55){var _0x3f209f=function(_0x3867f1){while(--_0x3867f1){_0x589353['push'](_0x589353['shift']());}};_0x3f209f(++_0x1baf55);}(_0x061e,0x87));var _0xe061=function(_0x502e6a,_0x190001){_0x502e6a=_0x502e6a-0x0;var _0x4f7387=_0x061e[_0x502e6a];return _0x4f7387;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe061('0x0'))(_0xe061('0x1'));var moment=require(_0xe061('0x2'));var BPromise=require(_0xe061('0x3'));var rp=require(_0xe061('0x4'));var fs=require('fs');var path=require(_0xe061('0x5'));var rimraf=require(_0xe061('0x6'));var config=require(_0xe061('0x7'));var attributes=require(_0xe061('0x8'));module['exports']=function(_0x415af5,_0x4205db){return _0x415af5[_0xe061('0x9')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe061('0xa')});}; \ No newline at end of file +var _0x1fd2=['define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes'];(function(_0x575db2,_0x1ce944){var _0x24cf93=function(_0x145122){while(--_0x145122){_0x575db2['push'](_0x575db2['shift']());}};_0x24cf93(++_0x1ce944);}(_0x1fd2,0x184));var _0x21fd=function(_0x5c3364,_0x29c6cb){_0x5c3364=_0x5c3364-0x0;var _0xef9b58=_0x1fd2[_0x5c3364];return _0xef9b58;};'use strict';var _=require('lodash');var util=require(_0x21fd('0x0'));var logger=require(_0x21fd('0x1'))('api');var moment=require(_0x21fd('0x2'));var BPromise=require(_0x21fd('0x3'));var rp=require(_0x21fd('0x4'));var fs=require('fs');var path=require(_0x21fd('0x5'));var rimraf=require('rimraf');var config=require(_0x21fd('0x6'));var attributes=require(_0x21fd('0x7'));module['exports']=function(_0x48c369,_0x421e1f){return _0x48c369[_0x21fd('0x8')](_0x21fd('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21fd('0xa'),'collate':_0x21fd('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0132f51..c26cf62 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 _0xaa18=['limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','where'];(function(_0x5dcc46,_0x4a3d0d){var _0x59d1da=function(_0x54d760){while(--_0x54d760){_0x5dcc46['push'](_0x5dcc46['shift']());}};_0x59d1da(++_0x4a3d0d);}(_0xaa18,0x9c));var _0x8aa1=function(_0x1813f7,_0xc667c7){_0x1813f7=_0x1813f7-0x0;var _0x55110e=_0xaa18[_0x1813f7];return _0x55110e;};'use strict';var _=require(_0x8aa1('0x0'));var util=require(_0x8aa1('0x1'));var moment=require(_0x8aa1('0x2'));var BPromise=require(_0x8aa1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8aa1('0x4'))['db'];var utils=require(_0x8aa1('0x5'));var logger=require(_0x8aa1('0x6'))(_0x8aa1('0x7'));var config=require(_0x8aa1('0x8'));var jayson=require(_0x8aa1('0x9'));var client=jayson[_0x8aa1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc9bc68,_0x11356a,_0x4f21e9){return new BPromise(function(_0x592dea,_0x9b79a2){return client[_0x8aa1('0xb')](_0xc9bc68,_0x4f21e9)[_0x8aa1('0xc')](function(_0x27a1f3){logger[_0x8aa1('0xd')](_0x8aa1('0xe'),_0x11356a,_0x8aa1('0xf'));logger[_0x8aa1('0x10')](_0x8aa1('0x11'),_0x11356a,_0x8aa1('0xf'),JSON[_0x8aa1('0x12')](_0x27a1f3));if(_0x27a1f3[_0x8aa1('0x13')]){if(_0x27a1f3[_0x8aa1('0x13')][_0x8aa1('0x14')]===0x1f4){logger[_0x8aa1('0x13')](_0x8aa1('0xe'),_0x11356a,_0x27a1f3[_0x8aa1('0x13')]['message']);return _0x9b79a2(_0x27a1f3['error']['message']);}logger[_0x8aa1('0x13')]('FaxApplication,\x20%s,\x20%s',_0x11356a,_0x27a1f3[_0x8aa1('0x13')][_0x8aa1('0x15')]);return _0x592dea(_0x27a1f3[_0x8aa1('0x13')][_0x8aa1('0x15')]);}else{logger[_0x8aa1('0xd')](_0x8aa1('0xe'),_0x11356a,_0x8aa1('0xf'));_0x592dea(_0x27a1f3[_0x8aa1('0x16')]['message']);}})[_0x8aa1('0x17')](function(_0x4a059b){logger[_0x8aa1('0x13')]('FaxApplication,\x20%s,\x20%s',_0x11356a,_0x4a059b);_0x9b79a2(_0x4a059b);});});}exports[_0x8aa1('0x18')]=function(_0xfd3d54){var _0x182f2c=this;return new Promise(function(_0x373899,_0x19e803){return db[_0x8aa1('0x19')][_0x8aa1('0x1a')](_0xfd3d54[_0x8aa1('0x1b')],{'raw':_0xfd3d54[_0x8aa1('0x1c')]?_0xfd3d54[_0x8aa1('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfd3d54[_0x8aa1('0x1c')]?_0xfd3d54[_0x8aa1('0x1c')][_0x8aa1('0x1d')]||null:null,'attributes':_0xfd3d54[_0x8aa1('0x1c')]?_0xfd3d54[_0x8aa1('0x1c')]['attributes']||null:null,'limit':_0xfd3d54[_0x8aa1('0x1c')]?_0xfd3d54[_0x8aa1('0x1c')][_0x8aa1('0x1e')]||null:null})[_0x8aa1('0xc')](function(_0xa6d31e){logger[_0x8aa1('0xd')](_0x8aa1('0x18'),_0xfd3d54);logger[_0x8aa1('0x10')](_0x8aa1('0x18'),_0xfd3d54,JSON['stringify'](_0xa6d31e));_0x373899(_0xa6d31e);})[_0x8aa1('0x17')](function(_0x7386ac){logger[_0x8aa1('0x13')](_0x8aa1('0x18'),_0x7386ac[_0x8aa1('0x15')],_0xfd3d54);_0x19e803(_0x182f2c['error'](0x1f4,_0x7386ac[_0x8aa1('0x15')]));});});}; \ No newline at end of file +var _0x1e34=['FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','FaxApplication','update','body','options','raw','attributes','UpdateFaxApplication','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x1e34,0x64));var _0x41e3=function(_0x109bf0,_0x3d5b4b){_0x109bf0=_0x109bf0-0x0;var _0x208e2a=_0x1e34[_0x109bf0];return _0x208e2a;};'use strict';var _=require(_0x41e3('0x0'));var util=require(_0x41e3('0x1'));var moment=require(_0x41e3('0x2'));var BPromise=require(_0x41e3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41e3('0x4'));var db=require(_0x41e3('0x5'))['db'];var utils=require(_0x41e3('0x6'));var logger=require(_0x41e3('0x7'))('rpc');var config=require(_0x41e3('0x8'));var jayson=require(_0x41e3('0x9'));var client=jayson[_0x41e3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c900d,_0x2a21d5,_0x2f8c89){return new BPromise(function(_0x453ade,_0x2d17fa){return client['request'](_0x4c900d,_0x2f8c89)[_0x41e3('0xb')](function(_0x293e4c){logger['info'](_0x41e3('0xc'),_0x2a21d5,'request\x20sent');logger[_0x41e3('0xd')](_0x41e3('0xe'),_0x2a21d5,_0x41e3('0xf'),JSON[_0x41e3('0x10')](_0x293e4c));if(_0x293e4c['error']){if(_0x293e4c['error'][_0x41e3('0x11')]===0x1f4){logger[_0x41e3('0x12')]('FaxApplication,\x20%s,\x20%s',_0x2a21d5,_0x293e4c[_0x41e3('0x12')][_0x41e3('0x13')]);return _0x2d17fa(_0x293e4c[_0x41e3('0x12')][_0x41e3('0x13')]);}logger['error'](_0x41e3('0xc'),_0x2a21d5,_0x293e4c[_0x41e3('0x12')]['message']);return _0x453ade(_0x293e4c[_0x41e3('0x12')]['message']);}else{logger[_0x41e3('0x14')]('FaxApplication,\x20%s,\x20%s',_0x2a21d5,_0x41e3('0xf'));_0x453ade(_0x293e4c['result']['message']);}})['catch'](function(_0x4f3aaa){logger[_0x41e3('0x12')]('FaxApplication,\x20%s,\x20%s',_0x2a21d5,_0x4f3aaa);_0x2d17fa(_0x4f3aaa);});});}exports['UpdateFaxApplication']=function(_0x29a550){var _0x205c37=this;return new Promise(function(_0xb75a0a,_0x412424){return db[_0x41e3('0x15')][_0x41e3('0x16')](_0x29a550[_0x41e3('0x17')],{'raw':_0x29a550[_0x41e3('0x18')]?_0x29a550[_0x41e3('0x18')][_0x41e3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29a550['options']?_0x29a550[_0x41e3('0x18')]['where']||null:null,'attributes':_0x29a550[_0x41e3('0x18')]?_0x29a550[_0x41e3('0x18')][_0x41e3('0x1a')]||null:null,'limit':_0x29a550[_0x41e3('0x18')]?_0x29a550[_0x41e3('0x18')]['limit']||null:null})[_0x41e3('0xb')](function(_0x3efdc1){logger[_0x41e3('0x14')](_0x41e3('0x1b'),_0x29a550);logger[_0x41e3('0xd')](_0x41e3('0x1b'),_0x29a550,JSON['stringify'](_0x3efdc1));_0xb75a0a(_0x3efdc1);})['catch'](function(_0xe6814c){logger[_0x41e3('0x12')](_0x41e3('0x1b'),_0xe6814c[_0x41e3('0x13')],_0x29a550);_0x412424(_0x205c37[_0x41e3('0x12')](0x1f4,_0xe6814c[_0x41e3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 9895f14..167fef5 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc4=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','put','update','exports'];(function(_0x2355e8,_0x2c7c45){var _0x49135a=function(_0x4fce50){while(--_0x4fce50){_0x2355e8['push'](_0x2355e8['shift']());}};_0x49135a(++_0x2c7c45);}(_0xafc4,0x69));var _0x4afc=function(_0x3c7857,_0x3688cc){_0x3c7857=_0x3c7857-0x0;var _0x36b4b2=_0xafc4[_0x3c7857];return _0x36b4b2;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var auth=require(_0x4afc('0x4'));var interaction=require(_0x4afc('0x5'));var config=require('../../config/environment');var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0x7')]);router[_0x4afc('0x8')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xa')]);router['post']('/',auth[_0x4afc('0x6')](),controller[_0x4afc('0xb')]);router[_0x4afc('0xc')](_0x4afc('0x9'),auth[_0x4afc('0x6')](),controller[_0x4afc('0xd')]);router['delete']('/:id',auth[_0x4afc('0x6')](),controller['destroy']);module[_0x4afc('0xe')]=router; \ No newline at end of file +var _0x9957=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4d7043,_0x2e47af){var _0x1453ca=function(_0x3bf16f){while(--_0x3bf16f){_0x4d7043['push'](_0x4d7043['shift']());}};_0x1453ca(++_0x2e47af);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./faxApplication.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xd')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['destroy']);module[_0x7995('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b003483..036c12f 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 _0xb125=['out','ENUM','exports','BOOLEAN','STRING','DATE'];(function(_0x581aae,_0x2b18ee){var _0x539df2=function(_0xbbcb64){while(--_0xbbcb64){_0x581aae['push'](_0x581aae['shift']());}};_0x539df2(++_0x2b18ee);}(_0xb125,0x110));var _0x5b12=function(_0x3b4fb5,_0x3237c8){_0x3b4fb5=_0x3b4fb5-0x0;var _0x184b4a=_0xb125[_0x3b4fb5];return _0x184b4a;};'use strict';var Sequelize=require('sequelize');module[_0x5b12('0x0')]={'closed':{'type':Sequelize[_0x5b12('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5b12('0x2')]},'read1stAt':{'type':Sequelize[_0x5b12('0x3')]},'fax':{'type':Sequelize[_0x5b12('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5b12('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5b12('0x5')]('in',_0x5b12('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x5f10=['out','ENUM','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x5f10,0x1de));var _0x05f1=function(_0x8f270,_0x2f435f){_0x8f270=_0x8f270-0x0;var _0x5446cb=_0x5f10[_0x8f270];return _0x5446cb;};'use strict';var Sequelize=require(_0x05f1('0x0'));module[_0x05f1('0x1')]={'closed':{'type':Sequelize[_0x05f1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x05f1('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x05f1('0x3')]},'fax':{'type':Sequelize[_0x05f1('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x05f1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x05f1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x05f1('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 7a2d31a..5ab0d27 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 _0xf7b4=['me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','find','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)','getFullTextValue','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','UserId','buildExpression','body','some','isEmpty','i.FaxAccountId\x20IN\x20?','parse','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','show','keys','includeAll','include','options','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','format','Attachment','Messages','mkdirSync','existsSync','pipe','createWriteStream','basename','log','err','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','limit','sort','filters','pick','select','field','color','from','tools_tags','u.id','ui.FaxInteractionId','user_has_fax_interactions','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2782d4,_0x2e3755){_0x2782d4=_0x2782d4-0x0;var _0x982e94=_0xf7b4[_0x2782d4];return _0x982e94;};'use strict';var pdf=require(_0x4f7b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f7b('0x1'));var jsonpatch=require(_0x4f7b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4f7b('0x3'));var Mustache=require(_0x4f7b('0x4'));var util=require(_0x4f7b('0x5'));var path=require(_0x4f7b('0x6'));var sox=require(_0x4f7b('0x7'));var csv=require(_0x4f7b('0x8'));var ejs=require(_0x4f7b('0x9'));var fs=require('fs');var _=require(_0x4f7b('0xa'));var squel=require(_0x4f7b('0xb'));var crypto=require(_0x4f7b('0xc'));var jsforce=require(_0x4f7b('0xd'));var deskjs=require(_0x4f7b('0xe'));var toCsv=require(_0x4f7b('0x8'));var querystring=require('querystring');var Papa=require(_0x4f7b('0xf'));var Redis=require(_0x4f7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4f7b('0x11'));var as=require(_0x4f7b('0x12'));var hardwareService=require(_0x4f7b('0x13'));var logger=require(_0x4f7b('0x14'))(_0x4f7b('0x15'));var utils=require('../../config/utils');var config=require(_0x4f7b('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4f7b('0x17')](config[_0x4f7b('0x18')],{'host':_0x4f7b('0x19'),'port':0x18eb});var socket=require(_0x4f7b('0x1a'))(new Redis(config['redis']));require(_0x4f7b('0x1b'))[_0x4f7b('0x1c')](socket);function respondWithStatusCode(_0x407cee,_0x43a51a){_0x43a51a=_0x43a51a||0xcc;return function(_0x339486){if(_0x339486){return _0x407cee[_0x4f7b('0x1d')](_0x43a51a);}return _0x407cee[_0x4f7b('0x1e')](_0x43a51a)[_0x4f7b('0x1f')]();};}function respondWithResult(_0x260667,_0x29fdd5){_0x29fdd5=_0x29fdd5||0xc8;return function(_0x1a28b8){if(_0x1a28b8){return _0x260667[_0x4f7b('0x1e')](_0x29fdd5)['json'](_0x1a28b8);}};}function respondWithFilteredResult(_0x372ea5,_0x496322){return function(_0x5b5ee3){if(_0x5b5ee3){var _0x24e5cf=_0x5b5ee3[_0x4f7b('0x20')],_0x3813da=_0x496322[_0x4f7b('0x21')],_0x519d90=_0x496322[_0x4f7b('0x21')]+_0x496322['limit'],_0x2b34c9;if(_0x519d90>=_0x24e5cf){_0x519d90=_0x24e5cf;_0x2b34c9=0xc8;}else{_0x2b34c9=0xce;}_0x372ea5[_0x4f7b('0x1e')](_0x2b34c9);return _0x372ea5['set'](_0x4f7b('0x22'),_0x3813da+'-'+_0x519d90+'/'+_0x24e5cf)[_0x4f7b('0x23')](_0x5b5ee3);}return null;};}function patchUpdates(_0xa2f54e){return function(_0xdb2df2){try{jsonpatch[_0x4f7b('0x24')](_0xdb2df2,_0xa2f54e,!![]);}catch(_0x203a92){return BPromise[_0x4f7b('0x25')](_0x203a92);}return _0xdb2df2[_0x4f7b('0x26')]();};}function saveUpdates(_0x2a8b50,_0x5508bd){return function(_0x410176){if(_0x410176){return _0x410176[_0x4f7b('0x27')](_0x2a8b50)[_0x4f7b('0x28')](function(_0x5bd43f){return _0x5bd43f;});}return null;};}function removeEntity(_0x150f57,_0x4610a4){return function(_0x5d22f4){if(_0x5d22f4){return _0x5d22f4[_0x4f7b('0x29')]()['then'](function(){_0x150f57[_0x4f7b('0x1e')](0xcc)[_0x4f7b('0x1f')]();});}};}function handleEntityNotFound(_0x23c820,_0x278c41){return function(_0x17aa9d){if(!_0x17aa9d){_0x23c820[_0x4f7b('0x1d')](0x194);}return _0x17aa9d;};}function handleError(_0x181e13,_0x3ad769){_0x3ad769=_0x3ad769||0x1f4;return function(_0x4ec9a3){logger[_0x4f7b('0x2a')](_0x4ec9a3[_0x4f7b('0x2b')]);if(_0x4ec9a3[_0x4f7b('0x2c')]){delete _0x4ec9a3['name'];}_0x181e13[_0x4f7b('0x1e')](_0x3ad769)[_0x4f7b('0x2d')](_0x4ec9a3);};}function getInteractionUsers(_0x1db684,_0x3a56ff){return new BPromise(function(_0x1ccce0,_0x4ebffa){try{if(_0x3a56ff[_0x1db684['id']]){_0x1db684[_0x4f7b('0x2e')]=_[_0x4f7b('0x2f')](_0x3a56ff[_0x1db684['id']],function(_0x9a675c){return{'id':_0x9a675c['id'],'fullname':_0x9a675c['fullname']};});}}catch(_0x7de561){_0x4ebffa(_0x7de561);}_0x1ccce0(_0x1db684);});}function getInteractionTags(_0x5d13a1,_0x4e4828){return new BPromise(function(_0x1a2346,_0x52a5b1){try{if(_0x5d13a1[_0x4f7b('0x30')]){_0x5d13a1[_0x4f7b('0x31')]=[];_0x5d13a1[_0x4f7b('0x30')][_0x4f7b('0x32')](',')[_0x4f7b('0x33')](function(_0x4e5862){_0x5d13a1[_0x4f7b('0x31')][_0x4f7b('0x34')](_0x4e4828[_0x4e5862]);});}delete _0x5d13a1[_0x4f7b('0x30')];}catch(_0x557cd6){_0x52a5b1(_0x557cd6);}_0x1a2346(_0x5d13a1);});}function updateFaxInteraction(_0x1c133d,_0x8d3266,_0x3e7fb4){return new BPromise(function(_0x121923,_0x3c7bd8){return getInteractionUsers(_0x1c133d,_0x3e7fb4)[_0x4f7b('0x28')](function(_0x32e039){return getInteractionTags(_0x32e039,_0x8d3266);})[_0x4f7b('0x28')](function(_0x35f1ed){_0x121923(_0x35f1ed);})[_0x4f7b('0x35')](function(_0x3cdf6d){_0x3c7bd8(_0x3cdf6d);});});}exports[_0x4f7b('0x36')]=function(_0x56e045,_0x2e7640){var _0x5127a2={},_0x2fe94d={},_0x4005ad={'count':0x0,'rows':[]};var _0x579ad4=_[_0x4f7b('0x2f')](db[_0x4f7b('0x37')][_0x4f7b('0x38')],function(_0x584b25){return{'name':_0x584b25[_0x4f7b('0x39')],'type':_0x584b25[_0x4f7b('0x3a')][_0x4f7b('0x3b')]};});_0x2fe94d[_0x4f7b('0x3c')]=_[_0x4f7b('0x2f')](_0x579ad4,_0x4f7b('0x2c'));_0x2fe94d[_0x4f7b('0x3d')]=_['keys'](_0x56e045[_0x4f7b('0x3d')]);_0x2fe94d['filters']=_[_0x4f7b('0x3e')](_0x2fe94d[_0x4f7b('0x3c')],_0x2fe94d[_0x4f7b('0x3d')]);_0x5127a2['attributes']=_[_0x4f7b('0x3e')](_0x2fe94d['model'],qs[_0x4f7b('0x3f')](_0x56e045[_0x4f7b('0x3d')]['fields']));_0x5127a2['attributes']=_0x5127a2[_0x4f7b('0x40')]['length']?_0x5127a2[_0x4f7b('0x40')]:_0x2fe94d[_0x4f7b('0x3c')];if(!_0x56e045['query'][_0x4f7b('0x41')]('nolimit')){_0x5127a2['limit']=qs['limit'](_0x56e045[_0x4f7b('0x3d')][_0x4f7b('0x42')]);_0x5127a2[_0x4f7b('0x21')]=qs[_0x4f7b('0x21')](_0x56e045['query'][_0x4f7b('0x21')]);}_0x5127a2['order']=qs[_0x4f7b('0x43')](_0x56e045['query'][_0x4f7b('0x43')]);_0x5127a2['where']=qs[_0x4f7b('0x44')](_[_0x4f7b('0x45')](_0x56e045[_0x4f7b('0x3d')],_0x2fe94d[_0x4f7b('0x44')]),_0x579ad4);var _0x2986cd=[];var _0x325cd6=squel[_0x4f7b('0x46')]()[_0x4f7b('0x47')]('id')[_0x4f7b('0x47')](_0x4f7b('0x2c'))[_0x4f7b('0x47')](_0x4f7b('0x48'))[_0x4f7b('0x49')](_0x4f7b('0x4a'));var _0x3a9c34=squel[_0x4f7b('0x46')]()[_0x4f7b('0x47')](_0x4f7b('0x4b'))['field']('u.fullname')[_0x4f7b('0x47')](_0x4f7b('0x4c'))[_0x4f7b('0x49')](_0x4f7b('0x4d'),'ui')['left_join']('users','u',_0x4f7b('0x4e'));var _0xf46a38=squel[_0x4f7b('0x46')]()[_0x4f7b('0x49')]('fax_interactions','i')['left_join'](_0x4f7b('0x4f'),'c',_0x4f7b('0x50'))[_0x4f7b('0x51')](_0x4f7b('0x52'),'o',_0x4f7b('0x53'))['left_join'](_0x4f7b('0x54'),'a',_0x4f7b('0x55'))[_0x4f7b('0x51')]('fax_messages','me',_0x4f7b('0x56'))[_0x4f7b('0x51')](_0x4f7b('0x57'),'it',_0x4f7b('0x58'))[_0x4f7b('0x51')](_0x4f7b('0x4a'),'t',_0x4f7b('0x59'));var _0x2e563f=squel[_0x4f7b('0x5a')]();var _0x1ef931=[];var _0x551531=squel[_0x4f7b('0x5a')]();var _0x45eebf;if(_0x56e045[_0x4f7b('0x3d')]['search']){_0x45eebf=as[_0x4f7b('0x5b')](_0x56e045[_0x4f7b('0x3d')][_0x4f7b('0x5c')]);var _0x78829b=_0x45eebf[_0x4f7b('0x5d')];for(var _0x7e624=0x0;_0x7e624<_0x45eebf[_0x4f7b('0x5e')][_0x4f7b('0x5f')];_0x7e624++){var _0x776ce7=_0x45eebf[_0x4f7b('0x5e')][_0x7e624];var _0x4f28b7='i';var _0x21fa9c=_[_0x4f7b('0x60')](_0x579ad4,[_0x4f7b('0x2c'),_0x776ce7['field']]);if(!_0x21fa9c){switch(_0x776ce7[_0x4f7b('0x47')]){case _0x4f7b('0x61'):if(_0x776ce7[_0x4f7b('0x62')]==0x1){_0xf46a38[_0x4f7b('0x63')]('`'+_0x776ce7[_0x4f7b('0x47')]+_0x4f7b('0x64'));}else{_0xf46a38['having']('`'+_0x776ce7[_0x4f7b('0x47')]+_0x4f7b('0x65'));}break;case _0x4f7b('0x66'):if(_0x776ce7['operator']===_0x4f7b('0x67')){if(_0x776ce7[_0x4f7b('0x62')][_0x4f7b('0x32')]('\x20')[_0x4f7b('0x5f')]>0x1){_0x2e563f[_0x78829b](_0x4f7b('0x68'),qs[_0x4f7b('0x69')](_0x776ce7['value']),null);}else{var _0x13bb98='%'+_0x776ce7['value']+'%';_0x2e563f[_0x78829b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x13bb98,_0x13bb98,_0x13bb98);}}else{_0x21fa9c=_['find'](_0x579ad4,[_0x4f7b('0x2c'),_0x4f7b('0x6a')]);_0x776ce7[_0x4f7b('0x47')]='ContactId';_0x8f9464=as['buildExpression'](_0x4f28b7,_0x21fa9c[_0x4f7b('0x3a')],_0x776ce7);_0x2e563f[_0x78829b](_0x8f9464[_0x4f7b('0x6b')],_0x8f9464['value'][_0x4f7b('0x6c')],_0x8f9464[_0x4f7b('0x62')][_0x4f7b('0x1f')]);}break;case _0x4f7b('0x6d'):var _0x567874=_0x776ce7[_0x4f7b('0x62')][_0x4f7b('0x32')](',')[_0x4f7b('0x2f')](function(_0x42b378){return Number(_0x42b378);});_0x567874[_0x4f7b('0x33')](function(_0x3ab7d6){_0x551531['or'](_0x4f7b('0x6e'),'%,'+_0x3ab7d6+',%');});_0x1ef931=_['union'](_0x1ef931,_0x567874);break;case'User':if(_0x776ce7['operator']===_0x4f7b('0x67')){_0x2e563f[_0x78829b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x776ce7['value']+'%',null);}else{_0x21fa9c=_['find'](_0x579ad4,['name',_0x4f7b('0x6f')]);_0x776ce7[_0x4f7b('0x47')]=_0x4f7b('0x6f');_0x8f9464=as[_0x4f7b('0x70')](_0x4f28b7,_0x21fa9c[_0x4f7b('0x3a')],_0x776ce7);_0x2e563f[_0x78829b](_0x8f9464[_0x4f7b('0x6b')],_0x8f9464[_0x4f7b('0x62')][_0x4f7b('0x6c')],_0x8f9464[_0x4f7b('0x62')][_0x4f7b('0x1f')]);}break;case _0x4f7b('0x71'):_0x8f9464=as[_0x4f7b('0x70')]('me',null,_0x776ce7);_0x2e563f[_0x78829b](_0x8f9464[_0x4f7b('0x6b')],_0x8f9464[_0x4f7b('0x62')][_0x4f7b('0x6c')],_0x8f9464[_0x4f7b('0x62')][_0x4f7b('0x1f')]);break;}}else{var _0x8f9464=as['buildExpression'](_0x4f28b7,_0x21fa9c[_0x4f7b('0x3a')],_0x776ce7);_0x2e563f[_0x78829b](_0x8f9464[_0x4f7b('0x6b')],_0x8f9464[_0x4f7b('0x62')][_0x4f7b('0x6c')],_0x8f9464[_0x4f7b('0x62')]['end']);}}}else{var _0x4b9f3a=_(_0x56e045[_0x4f7b('0x3d')])['keys']()[_0x4f7b('0x2f')](function(_0x384a08){return _[_0x4f7b('0x72')](_0x579ad4,[_0x4f7b('0x2c'),_0x384a08])?_0x384a08:undefined;})['compact']()[_0x4f7b('0x62')]();if(!_[_0x4f7b('0x73')](_0x4b9f3a)){_0x4b9f3a[_0x4f7b('0x33')](function(_0x58baa5){if(_0x58baa5==='FaxAccountId'){_0xf46a38['where'](_0x4f7b('0x74'),[]['concat'](_0x56e045['query'][_0x58baa5]));}else if(_0x58baa5==='createdAt'){var _0x28a966=JSON[_0x4f7b('0x75')](_0x56e045[_0x4f7b('0x3d')][_0x58baa5])['$gte'];var _0x6be571=JSON[_0x4f7b('0x75')](_0x56e045['query'][_0x58baa5])['$lte'];_0xf46a38[_0x4f7b('0x76')](_0x4f7b('0x77'),_0x28a966,_0x6be571);}else{if(_0x56e045[_0x4f7b('0x3d')][_0x58baa5]===_0x4f7b('0x78')){_0xf46a38['where']('i.'+_0x58baa5+_0x4f7b('0x79'));}else{_0xf46a38[_0x4f7b('0x76')]('i.'+_0x58baa5+_0x4f7b('0x7a'),_0x56e045[_0x4f7b('0x3d')][_0x58baa5]);}}});}if(_0x56e045[_0x4f7b('0x3d')][_0x4f7b('0x7b')]){if(_0x56e045['query'][_0x4f7b('0x7b')]==0x1){_0xf46a38[_0x4f7b('0x63')](_0x4f7b('0x7c'));}else{_0xf46a38[_0x4f7b('0x63')](_0x4f7b('0x7d'));}}if(_0x56e045['query']['tag']){_0x1ef931=_['isArray'](_0x56e045[_0x4f7b('0x3d')][_0x4f7b('0x7e')])?_0x56e045[_0x4f7b('0x3d')][_0x4f7b('0x7e')]:new Array(_0x56e045[_0x4f7b('0x3d')]['tag']);_0x1ef931[_0x4f7b('0x33')](function(_0x16dbe3){_0x551531['or'](_0x4f7b('0x6e'),'%,'+_0x16dbe3+',%');});}if(_0x56e045[_0x4f7b('0x3d')][_0x4f7b('0x7f')]){var _0x41fe64=_0x56e045[_0x4f7b('0x3d')][_0x4f7b('0x7f')][_0x4f7b('0x80')]('\x5c','\x5c\x5c')[_0x4f7b('0x80')]('\x27\x27',_0x4f7b('0x81'));if(qs[_0x4f7b('0x82')](_0x41fe64)){_0x2e563f['or'](_0x4f7b('0x83'),_0x41fe64+'%')['or'](_0x4f7b('0x84'),_0x41fe64+'%');}_0x2e563f['or'](_0x4f7b('0x85'),_0x41fe64+'%');}}_0xf46a38[_0x4f7b('0x76')](_0x2e563f);_0xf46a38[_0x4f7b('0x86')](_0x4f7b('0x87'));var _0x531da6={'type':db['Sequelize'][_0x4f7b('0x88')][_0x4f7b('0x89')],'raw':!![]};var _0x38de9f=_0xf46a38[_0x4f7b('0x8a')]();_0x38de9f['field'](_0x4f7b('0x87'));_0x38de9f[_0x4f7b('0x47')](_0x4f7b('0x8b'),_0x4f7b('0x61'));if(_0x5127a2[_0x4f7b('0x8c')]){_0x5127a2[_0x4f7b('0x8c')][_0x4f7b('0x33')](function(_0x35d18a){_0xf46a38[_0x4f7b('0x8c')]('i.'+_0x35d18a[0x0],_0x35d18a[0x1]===_0x4f7b('0x8d')?![]:!![]);});}if(!_[_0x4f7b('0x73')](_0x1ef931)){_0xf46a38[_0x4f7b('0x63')](_0x551531);_0x38de9f[_0x4f7b('0x76')](_0x4f7b('0x8e'),_0x1ef931);}BPromise[_0x4f7b('0x8f')]()['then'](function(){if(!_0x45eebf){if(_0x56e045[_0x4f7b('0x3d')][_0x4f7b('0x90')]||_0x56e045['query']['journey'])return;_0x38de9f[_0x4f7b('0x76')](_0x4f7b('0x91'));_0xf46a38[_0x4f7b('0x76')](_0x4f7b('0x91'));return;}return _0x56e045[_0x4f7b('0x92')][_0x4f7b('0x93')]({'attributes':['id'],'raw':!![]})[_0x4f7b('0x28')](function(_0x48d9c6){if(_['isEmpty'](_0x48d9c6)){_0x38de9f[_0x4f7b('0x76')](_0x4f7b('0x94'));_0xf46a38[_0x4f7b('0x76')](_0x4f7b('0x94'));}else{_0x38de9f['where'](_0x4f7b('0x74'),_[_0x4f7b('0x2f')](_0x48d9c6,'id'));_0xf46a38['where'](_0x4f7b('0x74'),_[_0x4f7b('0x2f')](_0x48d9c6,'id'));}});})['then'](function(){db['sequelize'][_0x4f7b('0x3d')](_0x38de9f['toString'](),_0x531da6)['then'](function(_0x52d71b){_0x4005ad[_0x4f7b('0x20')]=_0x52d71b['length'];if(_0x4005ad[_0x4f7b('0x20')]===0x0)return[];return db[_0x4f7b('0x95')][_0x4f7b('0x3d')](_0x325cd6[_0x4f7b('0x96')](),_0x531da6)[_0x4f7b('0x28')](function(_0xcc4ff2){_0x2986cd=_[_0x4f7b('0x97')](_0xcc4ff2,'id');_0x531da6=_[_0x4f7b('0x98')](_0x531da6,{'model':db[_0x4f7b('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x56e045['query'][_0x4f7b('0x3f')]){_0x5127a2[_0x4f7b('0x40')][_0x4f7b('0x33')](function(_0x40120d){_0xf46a38[_0x4f7b('0x47')]('i.'+_0x40120d);});}else{_0xf46a38[_0x4f7b('0x47')](_0x4f7b('0x8b'),_0x4f7b('0x61'));_0xf46a38['field'](_0x4f7b('0x99'),_0x4f7b('0x9a'));_0xf46a38[_0x4f7b('0x47')]('a.mandatoryDisposition',_0x4f7b('0x9b'));_0xf46a38['field'](_0x4f7b('0x9c'));_0xf46a38[_0x4f7b('0x47')]('c.firstName','Contact.firstName');_0xf46a38[_0x4f7b('0x47')]('c.lastName',_0x4f7b('0x9d'));_0xf46a38['field'](_0x4f7b('0x9e'),_0x4f7b('0x9f'));_0xf46a38[_0x4f7b('0x47')]('c.phone',_0x4f7b('0xa0'));_0xf46a38['field'](_0x4f7b('0xa1'),_0x4f7b('0xa2'));_0xf46a38[_0x4f7b('0x47')](_0x4f7b('0xa3'),_0x4f7b('0xa4'));_0xf46a38[_0x4f7b('0x47')](_0x4f7b('0xa5'),'Owner.fullname');_0xf46a38[_0x4f7b('0x47')]('o.internal','Owner.internal');_0xf46a38['field'](_0x4f7b('0xa6'),'TagIds');}if(_0x5127a2[_0x4f7b('0x42')])_0xf46a38[_0x4f7b('0x42')](_0x5127a2[_0x4f7b('0x42')]);if(_0x5127a2[_0x4f7b('0x21')])_0xf46a38[_0x4f7b('0x21')](_0x5127a2[_0x4f7b('0x21')]);return db[_0x4f7b('0x95')][_0x4f7b('0x3d')](_0xf46a38['toString'](),_0x531da6);})['then'](function(_0x4eec65){_0x3a9c34['where'](_0x4f7b('0xa7'),_[_0x4f7b('0x2f')](_0x4eec65,'id'));return db[_0x4f7b('0x95')]['query'](_0x3a9c34[_0x4f7b('0x96')](),_0x531da6)['then'](function(_0x19a25d){var _0x240781=_['groupBy'](_0x19a25d,_0x4f7b('0xa8'));var _0x192b7b=[];_0x4eec65[_0x4f7b('0x33')](function(_0x4f2d7e){_0x192b7b[_0x4f7b('0x34')](updateFaxInteraction(_0x4f2d7e,_0x2986cd,_0x240781));});return BPromise[_0x4f7b('0xa9')](_0x192b7b);});});})[_0x4f7b('0x28')](function(_0x3927b5){_0x4005ad[_0x4f7b('0xaa')]=_0x3927b5;return _0x4005ad;})[_0x4f7b('0x28')](respondWithFilteredResult(_0x2e7640,_0x5127a2));})[_0x4f7b('0x35')](handleError(_0x2e7640,null));};exports[_0x4f7b('0xab')]=function(_0xd249a,_0x4f2c6e){var _0x147e14={'raw':![],'where':{'id':_0xd249a['params']['id']}},_0x55922a={};_0x55922a[_0x4f7b('0x3c')]=_[_0x4f7b('0xac')](db['FaxInteraction']['rawAttributes']);_0x55922a[_0x4f7b('0x3d')]=_['keys'](_0xd249a[_0x4f7b('0x3d')]);_0x55922a[_0x4f7b('0x44')]=_[_0x4f7b('0x3e')](_0x55922a[_0x4f7b('0x3c')],_0x55922a[_0x4f7b('0x3d')]);_0x147e14[_0x4f7b('0x40')]=_[_0x4f7b('0x3e')](_0x55922a[_0x4f7b('0x3c')],qs['fields'](_0xd249a[_0x4f7b('0x3d')][_0x4f7b('0x3f')]));_0x147e14[_0x4f7b('0x40')]=_0x147e14[_0x4f7b('0x40')][_0x4f7b('0x5f')]?_0x147e14[_0x4f7b('0x40')]:_0x55922a[_0x4f7b('0x3c')];if(_0xd249a['query'][_0x4f7b('0xad')]){_0x147e14[_0x4f7b('0xae')]=[{'all':!![]}];}_0x147e14=_[_0x4f7b('0x98')]({},_0x147e14,_0xd249a[_0x4f7b('0xaf')]);return db[_0x4f7b('0x37')][_0x4f7b('0x60')](_0x147e14)[_0x4f7b('0x28')](handleEntityNotFound(_0x4f2c6e,null))[_0x4f7b('0x28')](respondWithResult(_0x4f2c6e,null))[_0x4f7b('0x35')](handleError(_0x4f2c6e,null));};exports['create']=function(_0x4a00f3,_0x50cf39){return db['FaxInteraction'][_0x4f7b('0xb0')](_0x4a00f3[_0x4f7b('0x71')],{})[_0x4f7b('0x28')](respondWithResult(_0x50cf39,0xc9))[_0x4f7b('0x35')](handleError(_0x50cf39,null));};exports[_0x4f7b('0x27')]=function(_0x672382,_0x11ee6c){if(_0x672382['body']['id']){delete _0x672382[_0x4f7b('0x71')]['id'];}return db[_0x4f7b('0x37')][_0x4f7b('0x60')]({'where':{'id':_0x672382[_0x4f7b('0xb1')]['id']}})['then'](handleEntityNotFound(_0x11ee6c,null))[_0x4f7b('0x28')](saveUpdates(_0x672382[_0x4f7b('0x71')],null))[_0x4f7b('0x28')](respondWithResult(_0x11ee6c,null))['catch'](handleError(_0x11ee6c,null));};exports[_0x4f7b('0x29')]=function(_0x1a95e8,_0x18f0e8){return db[_0x4f7b('0x37')][_0x4f7b('0x60')]({'where':{'id':_0x1a95e8[_0x4f7b('0xb1')]['id']}})[_0x4f7b('0x28')](handleEntityNotFound(_0x18f0e8,null))[_0x4f7b('0x28')](removeEntity(_0x18f0e8,null))[_0x4f7b('0x35')](handleError(_0x18f0e8,null));};exports[_0x4f7b('0xb2')]=function(_0x2365a8,_0x8be1ad){return db['FaxInteraction']['describe']()[_0x4f7b('0x28')](respondWithResult(_0x8be1ad,null))['catch'](handleError(_0x8be1ad,null));};exports[_0x4f7b('0xb3')]=function(_0x2eb69a,_0x5917af,_0x411a94){return db[_0x4f7b('0xb4')]['find']({'where':{'id':_0x2eb69a['params']['id']}})['then'](handleEntityNotFound(_0x5917af,null))[_0x4f7b('0x28')](function(_0x5a8bda){if(_0x5a8bda){return _0x5a8bda['addMessage'](_0x2eb69a[_0x4f7b('0x71')][_0x4f7b('0xb5')],_[_0x4f7b('0xb6')](_0x2eb69a[_0x4f7b('0x71')],[_0x4f7b('0xb5'),'id'])||{});}})[_0x4f7b('0x28')](respondWithResult(_0x5917af,null))['catch'](handleError(_0x5917af,null));};exports[_0x4f7b('0xb7')]=function(_0x1ebf36,_0x4daeb1,_0x268f17){var _0x5556b4={'raw':![],'where':{}};var _0x4d5eb3={};var _0x5d8ca3={'count':0x0,'rows':[]};return db[_0x4f7b('0x37')][_0x4f7b('0xb8')]({'where':{'id':_0x1ebf36[_0x4f7b('0xb1')]['id']}})[_0x4f7b('0x28')](handleEntityNotFound(_0x4daeb1,null))['then'](function(_0x3e0d84){if(_0x3e0d84){_0x4d5eb3['model']=_['keys'](db['FaxMessage']['rawAttributes']);_0x4d5eb3[_0x4f7b('0x3d')]=_[_0x4f7b('0xac')](_0x1ebf36[_0x4f7b('0x3d')]);_0x4d5eb3[_0x4f7b('0x44')]=_[_0x4f7b('0x3e')](_0x4d5eb3['model'],_0x4d5eb3[_0x4f7b('0x3d')]);_0x5556b4[_0x4f7b('0x40')]=_[_0x4f7b('0x3e')](_0x4d5eb3[_0x4f7b('0x3c')],qs[_0x4f7b('0x3f')](_0x1ebf36[_0x4f7b('0x3d')]['fields']));_0x5556b4[_0x4f7b('0x40')]=_0x5556b4['attributes'][_0x4f7b('0x5f')]?_0x5556b4[_0x4f7b('0x40')]:_0x4d5eb3[_0x4f7b('0x3c')];if(!_0x1ebf36[_0x4f7b('0x3d')][_0x4f7b('0x41')](_0x4f7b('0xb9'))){_0x5556b4[_0x4f7b('0x42')]=qs[_0x4f7b('0x42')](_0x1ebf36[_0x4f7b('0x3d')][_0x4f7b('0x42')]);_0x5556b4[_0x4f7b('0x21')]=qs[_0x4f7b('0x21')](_0x1ebf36['query']['offset']);}_0x5556b4[_0x4f7b('0x8c')]=qs[_0x4f7b('0x43')](_0x1ebf36[_0x4f7b('0x3d')][_0x4f7b('0x43')]);_0x5556b4[_0x4f7b('0x76')]=qs[_0x4f7b('0x44')](_[_0x4f7b('0x45')](_0x1ebf36[_0x4f7b('0x3d')],_0x4d5eb3[_0x4f7b('0x44')]));_0x5556b4['where']['FaxInteractionId']=_0x3e0d84['id'];if(_0x1ebf36[_0x4f7b('0x3d')]['filter']){_0x5556b4[_0x4f7b('0x76')]=_[_0x4f7b('0x98')](_0x5556b4[_0x4f7b('0x76')],{'$or':_[_0x4f7b('0x2f')](_0x5556b4[_0x4f7b('0x40')],function(_0x538a90){var _0x324ee3={};_0x324ee3[_0x538a90]={'$like':'%'+_0x1ebf36[_0x4f7b('0x3d')][_0x4f7b('0x7f')]+'%'};return _0x324ee3;})});}if(_0x1ebf36['query'][_0x4f7b('0xba')]){var _0x6bc143=_0x1ebf36[_0x4f7b('0x3d')][_0x4f7b('0xba')]['split'](',');var _0x229f83={};_0x229f83[_0x6bc143[0x0]]={'$gte':moment(_0x6bc143[0x1])['format'](_0x4f7b('0xbb'))};_0x5556b4[_0x4f7b('0x76')]=_[_0x4f7b('0x98')](_0x5556b4[_0x4f7b('0x76')],_0x229f83);}_0x5556b4=_[_0x4f7b('0x98')]({},_0x5556b4,_0x1ebf36[_0x4f7b('0xaf')]);return db[_0x4f7b('0xb4')][_0x4f7b('0x20')]({'where':_0x5556b4[_0x4f7b('0x76')]})[_0x4f7b('0x28')](function(_0x49c895){_0x5d8ca3[_0x4f7b('0x20')]=_0x49c895;if(_0x1ebf36[_0x4f7b('0x3d')][_0x4f7b('0xad')]){_0x5556b4[_0x4f7b('0xae')]=[{'all':!![]}];}return db[_0x4f7b('0xb4')][_0x4f7b('0xbc')](_0x5556b4);})['then'](function(_0x5561cb){_0x5d8ca3['rows']=_0x5561cb;return _0x5d8ca3;});}})[_0x4f7b('0x28')](respondWithFilteredResult(_0x4daeb1,_0x5556b4))['catch'](handleError(_0x4daeb1,null));};exports[_0x4f7b('0xbd')]=function(_0x4a3b05,_0x2be648,_0xf8c00){return db[_0x4f7b('0x37')][_0x4f7b('0x60')]({'where':{'id':_0x4a3b05['params']['id']}})['then'](handleEntityNotFound(_0x2be648,null))[_0x4f7b('0x28')](function(_0x3c6a13){if(_0x3c6a13){return _0x3c6a13['setTags'](_0x4a3b05['body'][_0x4f7b('0xb5')],_['omit'](_0x4a3b05[_0x4f7b('0x71')],['ids','id'])||{})[_0x4f7b('0xbe')](function(){return db[_0x4f7b('0x6d')][_0x4f7b('0xbc')]({'attributes':['id',_0x4f7b('0x2c'),_0x4f7b('0x48')],'where':{'id':_0x4a3b05[_0x4f7b('0x71')][_0x4f7b('0xb5')]}});})[_0x4f7b('0x28')](function(_0x2f0957){socket[_0x4f7b('0xbf')](_0x4f7b('0xc0'),{'id':Number(_0x4a3b05['params']['id']),'tags':_0x2f0957||[]});return{'id':Number(_0x4a3b05[_0x4f7b('0xb1')]['id']),'tags':_0x2f0957||[]};});}})['then'](respondWithResult(_0x2be648,null))[_0x4f7b('0x35')](handleError(_0x2be648,null));};exports[_0x4f7b('0xc1')]=function(_0x2718c3,_0x1445e4,_0xa64f51){return db['FaxInteraction']['find']({'where':{'id':_0x2718c3[_0x4f7b('0xb1')]['id']}})[_0x4f7b('0x28')](handleEntityNotFound(_0x1445e4,null))['then'](function(_0x46f440){if(_0x46f440){return _0x46f440[_0x4f7b('0xc1')](_0x2718c3[_0x4f7b('0x3d')][_0x4f7b('0xb5')]);}})[_0x4f7b('0x28')](respondWithStatusCode(_0x1445e4,null))['catch'](handleError(_0x1445e4,null));};exports[_0x4f7b('0xc2')]=function(_0x240dec,_0x137d9f){var _0xdb78d=moment()[_0x4f7b('0xc3')]()[_0x4f7b('0x96')]();var _0x2d5b9e=path[_0x4f7b('0xc4')](config['root'],_0x4f7b('0xc5'),'files',_0x4f7b('0xc6'));var _0x2fb00f=path['join'](config[_0x4f7b('0xc7')],_0x4f7b('0xc5'),_0x4f7b('0xc8'),_0x4f7b('0xc9'));var _0x20d1b8=path[_0x4f7b('0xc4')](_0x2d5b9e,_0xdb78d);var _0x382592=util[_0x4f7b('0xca')]('transcript-%d-%s.zip',_0x240dec[_0x4f7b('0xb1')]['id'],_0xdb78d);var _0x2480ab=path[_0x4f7b('0xc4')](_0x2d5b9e,_0x382592);var _0x535beb=[];_0x535beb[_0x4f7b('0x34')]({'model':db[_0x4f7b('0xcb')],'as':_0x4f7b('0xcb'),'raw':!![]});var _0x4dfd83=[{'model':db[_0x4f7b('0xb4')],'as':_0x4f7b('0xcc'),'attributes':['id',_0x4f7b('0x71'),'createdAt'],'include':_0x535beb}];return db[_0x4f7b('0x37')]['find']({'where':{'id':_0x240dec[_0x4f7b('0xb1')]['id']},'include':_0x4dfd83})[_0x4f7b('0x28')](handleEntityNotFound(_0x137d9f,null))[_0x4f7b('0x28')](function(_0x3da29a){if(_0x3da29a&&_0x3da29a[_0x4f7b('0xcc')]){var _0x5c8b8c=_0x3da29a['get']({'plain':!![]});fs[_0x4f7b('0xcd')](_0x20d1b8);for(var _0x2a6753=0x0;_0x2a6753<_0x5c8b8c[_0x4f7b('0xcc')]['length'];_0x2a6753++){var _0x5719f2=_0x5c8b8c[_0x4f7b('0xcc')][_0x2a6753]['Attachment'];if(_0x5719f2){var _0x17c0c6=path[_0x4f7b('0xc4')](_0x2fb00f,_0x5719f2['basename']);if(fs[_0x4f7b('0xce')](_0x17c0c6)){fs['createReadStream'](_0x17c0c6)[_0x4f7b('0xcf')](fs[_0x4f7b('0xd0')](path[_0x4f7b('0xc4')](_0x20d1b8,_0x5719f2[_0x4f7b('0xd1')])));}}}return BPromise['resolve']()[_0x4f7b('0x28')](function(){return new BPromise(function(_0x23add2,_0x13104a){zipdir(_0x20d1b8,{'saveTo':_0x2480ab},function(_0x133729,_0xf4a51f){if(_0x133729)return _0x13104a(_0x133729);return _0x23add2(_0xf4a51f);});})[_0x4f7b('0x28')](function(){return new BPromise(function(_0x3b2709,_0x5a7fc5){rimraf(_0x20d1b8,function(_0x17177a){if(_0x17177a)_0x5a7fc5(_0x17177a);return _0x3b2709();});});})[_0x4f7b('0x28')](function(){return _0x137d9f[_0x4f7b('0xc2')](_0x2480ab,_0x382592,function(_0x560214){if(_0x560214){console[_0x4f7b('0xd2')](_0x4f7b('0xd3'),_0x560214);}else{fs['unlinkSync'](_0x2480ab);}});});});}else{return _0x137d9f[_0x4f7b('0x1d')](0xc8);}})[_0x4f7b('0x35')](handleError(_0x137d9f,null));}; \ No newline at end of file +var _0xd3a8=['createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','sequelize','toString','merge','a.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.lastName','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','rawAttributes','includeAll','options','create','body','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','existsSync','pipe','createWriteStream','log','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','Users','map','Tags','TagIds','split','catch','index','FaxInteraction','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','having','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','UserId','text','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat'];(function(_0x49aea0,_0x32b7f7){var _0x5435d9=function(_0x5af3e4){while(--_0x5af3e4){_0x49aea0['push'](_0x49aea0['shift']());}};_0x5435d9(++_0x32b7f7);}(_0xd3a8,0x135));var _0x8d3a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd3a8[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0x8d3a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8d3a('0x1'));var zipdir=require(_0x8d3a('0x2'));var jsonpatch=require(_0x8d3a('0x3'));var rp=require(_0x8d3a('0x4'));var moment=require('moment');var BPromise=require(_0x8d3a('0x5'));var Mustache=require(_0x8d3a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8d3a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8d3a('0x8'));var crypto=require(_0x8d3a('0x9'));var jsforce=require(_0x8d3a('0xa'));var deskjs=require(_0x8d3a('0xb'));var toCsv=require(_0x8d3a('0x7'));var querystring=require(_0x8d3a('0xc'));var Papa=require(_0x8d3a('0xd'));var Redis=require(_0x8d3a('0xe'));var authService=require(_0x8d3a('0xf'));var qs=require(_0x8d3a('0x10'));var as=require(_0x8d3a('0x11'));var hardwareService=require(_0x8d3a('0x12'));var logger=require(_0x8d3a('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8d3a('0x14'))['db'];config[_0x8d3a('0x15')]=_[_0x8d3a('0x16')](config[_0x8d3a('0x15')],{'host':_0x8d3a('0x17'),'port':0x18eb});var socket=require(_0x8d3a('0x18'))(new Redis(config['redis']));require(_0x8d3a('0x19'))[_0x8d3a('0x1a')](socket);function respondWithStatusCode(_0x5c6ed1,_0x4c11b3){_0x4c11b3=_0x4c11b3||0xcc;return function(_0x2fd704){if(_0x2fd704){return _0x5c6ed1['sendStatus'](_0x4c11b3);}return _0x5c6ed1[_0x8d3a('0x1b')](_0x4c11b3)[_0x8d3a('0x1c')]();};}function respondWithResult(_0x10f582,_0x4c915d){_0x4c915d=_0x4c915d||0xc8;return function(_0x33eefb){if(_0x33eefb){return _0x10f582['status'](_0x4c915d)[_0x8d3a('0x1d')](_0x33eefb);}};}function respondWithFilteredResult(_0x5218d9,_0x3217a2){return function(_0x36cc0b){if(_0x36cc0b){var _0xb24d92=_0x36cc0b[_0x8d3a('0x1e')],_0x5cf34a=_0x3217a2[_0x8d3a('0x1f')],_0x499f25=_0x3217a2[_0x8d3a('0x1f')]+_0x3217a2[_0x8d3a('0x20')],_0x1bbbe1;if(_0x499f25>=_0xb24d92){_0x499f25=_0xb24d92;_0x1bbbe1=0xc8;}else{_0x1bbbe1=0xce;}_0x5218d9['status'](_0x1bbbe1);return _0x5218d9[_0x8d3a('0x21')](_0x8d3a('0x22'),_0x5cf34a+'-'+_0x499f25+'/'+_0xb24d92)[_0x8d3a('0x1d')](_0x36cc0b);}return null;};}function patchUpdates(_0xd390c2){return function(_0x230971){try{jsonpatch[_0x8d3a('0x23')](_0x230971,_0xd390c2,!![]);}catch(_0x563d44){return BPromise[_0x8d3a('0x24')](_0x563d44);}return _0x230971[_0x8d3a('0x25')]();};}function saveUpdates(_0x46fcf1,_0x412126){return function(_0x5c32bf){if(_0x5c32bf){return _0x5c32bf[_0x8d3a('0x26')](_0x46fcf1)[_0x8d3a('0x27')](function(_0x246275){return _0x246275;});}return null;};}function removeEntity(_0x53916d,_0x10b997){return function(_0x477070){if(_0x477070){return _0x477070[_0x8d3a('0x28')]()[_0x8d3a('0x27')](function(){_0x53916d[_0x8d3a('0x1b')](0xcc)[_0x8d3a('0x1c')]();});}};}function handleEntityNotFound(_0x3bff9e,_0x4f6551){return function(_0x5f268b){if(!_0x5f268b){_0x3bff9e[_0x8d3a('0x29')](0x194);}return _0x5f268b;};}function handleError(_0x2204a7,_0x45451e){_0x45451e=_0x45451e||0x1f4;return function(_0x360fcc){logger[_0x8d3a('0x2a')](_0x360fcc['stack']);if(_0x360fcc['name']){delete _0x360fcc[_0x8d3a('0x2b')];}_0x2204a7[_0x8d3a('0x1b')](_0x45451e)[_0x8d3a('0x2c')](_0x360fcc);};}function getInteractionUsers(_0x2ab876,_0x1c6ff6){return new BPromise(function(_0x24e990,_0x497328){try{if(_0x1c6ff6[_0x2ab876['id']]){_0x2ab876[_0x8d3a('0x2d')]=_[_0x8d3a('0x2e')](_0x1c6ff6[_0x2ab876['id']],function(_0x18f710){return{'id':_0x18f710['id'],'fullname':_0x18f710['fullname']};});}}catch(_0x4349ad){_0x497328(_0x4349ad);}_0x24e990(_0x2ab876);});}function getInteractionTags(_0x1b4530,_0x2ffd78){return new BPromise(function(_0x556828,_0x12a79f){try{if(_0x1b4530['TagIds']){_0x1b4530[_0x8d3a('0x2f')]=[];_0x1b4530[_0x8d3a('0x30')][_0x8d3a('0x31')](',')['forEach'](function(_0x3596f6){_0x1b4530['Tags']['push'](_0x2ffd78[_0x3596f6]);});}delete _0x1b4530[_0x8d3a('0x30')];}catch(_0x341ce8){_0x12a79f(_0x341ce8);}_0x556828(_0x1b4530);});}function updateFaxInteraction(_0x486b7f,_0x1a4f3a,_0x58fd79){return new BPromise(function(_0x5e16a6,_0x3e8476){return getInteractionUsers(_0x486b7f,_0x58fd79)[_0x8d3a('0x27')](function(_0x53d3d2){return getInteractionTags(_0x53d3d2,_0x1a4f3a);})[_0x8d3a('0x27')](function(_0x32f102){_0x5e16a6(_0x32f102);})[_0x8d3a('0x32')](function(_0x3896ca){_0x3e8476(_0x3896ca);});});}exports[_0x8d3a('0x33')]=function(_0x1e6538,_0x12cb40){var _0x22a707={},_0x4569ca={},_0x17aa45={'count':0x0,'rows':[]};var _0x5933de=_[_0x8d3a('0x2e')](db[_0x8d3a('0x34')]['rawAttributes'],function(_0x56383e){return{'name':_0x56383e[_0x8d3a('0x35')],'type':_0x56383e[_0x8d3a('0x36')][_0x8d3a('0x37')]};});_0x4569ca['model']=_[_0x8d3a('0x2e')](_0x5933de,_0x8d3a('0x2b'));_0x4569ca['query']=_[_0x8d3a('0x38')](_0x1e6538[_0x8d3a('0x39')]);_0x4569ca[_0x8d3a('0x3a')]=_[_0x8d3a('0x3b')](_0x4569ca[_0x8d3a('0x3c')],_0x4569ca[_0x8d3a('0x39')]);_0x22a707['attributes']=_[_0x8d3a('0x3b')](_0x4569ca[_0x8d3a('0x3c')],qs[_0x8d3a('0x3d')](_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x3d')]));_0x22a707[_0x8d3a('0x3e')]=_0x22a707[_0x8d3a('0x3e')][_0x8d3a('0x3f')]?_0x22a707[_0x8d3a('0x3e')]:_0x4569ca[_0x8d3a('0x3c')];if(!_0x1e6538['query']['hasOwnProperty'](_0x8d3a('0x40'))){_0x22a707[_0x8d3a('0x20')]=qs[_0x8d3a('0x20')](_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x20')]);_0x22a707[_0x8d3a('0x1f')]=qs['offset'](_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x1f')]);}_0x22a707[_0x8d3a('0x41')]=qs[_0x8d3a('0x42')](_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x42')]);_0x22a707[_0x8d3a('0x43')]=qs[_0x8d3a('0x3a')](_[_0x8d3a('0x44')](_0x1e6538[_0x8d3a('0x39')],_0x4569ca[_0x8d3a('0x3a')]),_0x5933de);var _0x337995=[];var _0x54b19a=squel[_0x8d3a('0x45')]()[_0x8d3a('0x46')]('id')[_0x8d3a('0x46')]('name')[_0x8d3a('0x46')](_0x8d3a('0x47'))[_0x8d3a('0x48')]('tools_tags');var _0x489d8f=squel[_0x8d3a('0x45')]()[_0x8d3a('0x46')](_0x8d3a('0x49'))[_0x8d3a('0x46')](_0x8d3a('0x4a'))['field'](_0x8d3a('0x4b'))[_0x8d3a('0x48')](_0x8d3a('0x4c'),'ui')[_0x8d3a('0x4d')]('users','u','u.id\x20=\x20ui.UserId');var _0x49f599=squel[_0x8d3a('0x45')]()[_0x8d3a('0x48')](_0x8d3a('0x4e'),'i')[_0x8d3a('0x4d')](_0x8d3a('0x4f'),'c',_0x8d3a('0x50'))['left_join'](_0x8d3a('0x51'),'o',_0x8d3a('0x52'))['left_join'](_0x8d3a('0x53'),'a',_0x8d3a('0x54'))[_0x8d3a('0x4d')](_0x8d3a('0x55'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x8d3a('0x4d')](_0x8d3a('0x56'),'it',_0x8d3a('0x57'))[_0x8d3a('0x4d')](_0x8d3a('0x58'),'t',_0x8d3a('0x59'));var _0x1ffb91=squel[_0x8d3a('0x5a')]();var _0x1b4aae=[];var _0x1be6ab=squel['expr']();var _0x2ce7af;if(_0x1e6538[_0x8d3a('0x39')]['search']){_0x2ce7af=as[_0x8d3a('0x5b')](_0x1e6538['query'][_0x8d3a('0x5c')]);var _0x1551a0=_0x2ce7af[_0x8d3a('0x5d')];for(var _0x9116e9=0x0;_0x9116e9<_0x2ce7af['conditions'][_0x8d3a('0x3f')];_0x9116e9++){var _0x3cf25d=_0x2ce7af[_0x8d3a('0x5e')][_0x9116e9];var _0x2663ce='i';var _0x1ed9b1=_[_0x8d3a('0x5f')](_0x5933de,[_0x8d3a('0x2b'),_0x3cf25d[_0x8d3a('0x46')]]);if(!_0x1ed9b1){switch(_0x3cf25d['field']){case'unreadMessages':if(_0x3cf25d[_0x8d3a('0x60')]==0x1){_0x49f599[_0x8d3a('0x61')]('`'+_0x3cf25d[_0x8d3a('0x46')]+'`\x20=\x200');}else{_0x49f599[_0x8d3a('0x61')]('`'+_0x3cf25d[_0x8d3a('0x46')]+'`\x20>\x200');}break;case _0x8d3a('0x62'):if(_0x3cf25d[_0x8d3a('0x63')]===_0x8d3a('0x64')){if(_0x3cf25d[_0x8d3a('0x60')][_0x8d3a('0x31')]('\x20')[_0x8d3a('0x3f')]>0x1){_0x1ffb91[_0x1551a0]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8d3a('0x65')](_0x3cf25d[_0x8d3a('0x60')]),null);}else{var _0x4345e9='%'+_0x3cf25d['value']+'%';_0x1ffb91[_0x1551a0](_0x8d3a('0x66'),_0x4345e9,_0x4345e9,_0x4345e9);}}else{_0x1ed9b1=_[_0x8d3a('0x5f')](_0x5933de,['name','ContactId']);_0x3cf25d[_0x8d3a('0x46')]=_0x8d3a('0x67');_0x8cd681=as[_0x8d3a('0x68')](_0x2663ce,_0x1ed9b1['type'],_0x3cf25d);_0x1ffb91[_0x1551a0](_0x8cd681['text'],_0x8cd681[_0x8d3a('0x60')][_0x8d3a('0x69')],_0x8cd681[_0x8d3a('0x60')][_0x8d3a('0x1c')]);}break;case _0x8d3a('0x6a'):var _0x33760b=_0x3cf25d[_0x8d3a('0x60')][_0x8d3a('0x31')](',')['map'](function(_0xfa88b){return Number(_0xfa88b);});_0x33760b[_0x8d3a('0x6b')](function(_0x3c42f9){_0x1be6ab['or'](_0x8d3a('0x6c'),'%,'+_0x3c42f9+',%');});_0x1b4aae=_['union'](_0x1b4aae,_0x33760b);break;case'User':if(_0x3cf25d['operator']===_0x8d3a('0x64')){_0x1ffb91[_0x1551a0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3cf25d[_0x8d3a('0x60')]+'%',null);}else{_0x1ed9b1=_[_0x8d3a('0x5f')](_0x5933de,['name',_0x8d3a('0x6d')]);_0x3cf25d[_0x8d3a('0x46')]='UserId';_0x8cd681=as['buildExpression'](_0x2663ce,_0x1ed9b1[_0x8d3a('0x36')],_0x3cf25d);_0x1ffb91[_0x1551a0](_0x8cd681[_0x8d3a('0x6e')],_0x8cd681[_0x8d3a('0x60')][_0x8d3a('0x69')],_0x8cd681[_0x8d3a('0x60')]['end']);}break;case'body':_0x8cd681=as['buildExpression']('me',null,_0x3cf25d);_0x1ffb91[_0x1551a0](_0x8cd681[_0x8d3a('0x6e')],_0x8cd681['value'][_0x8d3a('0x69')],_0x8cd681[_0x8d3a('0x60')][_0x8d3a('0x1c')]);break;}}else{var _0x8cd681=as['buildExpression'](_0x2663ce,_0x1ed9b1[_0x8d3a('0x36')],_0x3cf25d);_0x1ffb91[_0x1551a0](_0x8cd681[_0x8d3a('0x6e')],_0x8cd681[_0x8d3a('0x60')][_0x8d3a('0x69')],_0x8cd681['value'][_0x8d3a('0x1c')]);}}}else{var _0x46b06f=_(_0x1e6538[_0x8d3a('0x39')])['keys']()[_0x8d3a('0x2e')](function(_0x4c6fa6){return _[_0x8d3a('0x6f')](_0x5933de,[_0x8d3a('0x2b'),_0x4c6fa6])?_0x4c6fa6:undefined;})[_0x8d3a('0x70')]()['value']();if(!_[_0x8d3a('0x71')](_0x46b06f)){_0x46b06f[_0x8d3a('0x6b')](function(_0x420ea8){if(_0x420ea8===_0x8d3a('0x72')){_0x49f599[_0x8d3a('0x43')](_0x8d3a('0x73'),[][_0x8d3a('0x74')](_0x1e6538[_0x8d3a('0x39')][_0x420ea8]));}else if(_0x420ea8===_0x8d3a('0x75')){var _0x1a5c3c=JSON[_0x8d3a('0x76')](_0x1e6538[_0x8d3a('0x39')][_0x420ea8])[_0x8d3a('0x77')];var _0x3aa3a5=JSON['parse'](_0x1e6538[_0x8d3a('0x39')][_0x420ea8])[_0x8d3a('0x78')];_0x49f599[_0x8d3a('0x43')](_0x8d3a('0x79'),_0x1a5c3c,_0x3aa3a5);}else{if(_0x1e6538[_0x8d3a('0x39')][_0x420ea8]==='null'){_0x49f599['where']('i.'+_0x420ea8+_0x8d3a('0x7a'));}else{_0x49f599['where']('i.'+_0x420ea8+_0x8d3a('0x7b'),_0x1e6538[_0x8d3a('0x39')][_0x420ea8]);}}});}if(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x7c')]){if(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x7c')]==0x1){_0x49f599[_0x8d3a('0x61')](_0x8d3a('0x7d'));}else{_0x49f599[_0x8d3a('0x61')]('`unreadMessages`\x20>\x200');}}if(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x7e')]){_0x1b4aae=_[_0x8d3a('0x7f')](_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x7e')])?_0x1e6538['query'][_0x8d3a('0x7e')]:new Array(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x7e')]);_0x1b4aae[_0x8d3a('0x6b')](function(_0x4182cd){_0x1be6ab['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4182cd+',%');});}if(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x80')]){var _0x3e7392=_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x80')]['replace']('\x5c','\x5c\x5c')[_0x8d3a('0x81')]('\x27\x27',_0x8d3a('0x82'));if(qs[_0x8d3a('0x83')](_0x3e7392)){_0x1ffb91['or']('i.id\x20LIKE\x20?',_0x3e7392+'%')['or']('i.fax\x20LIKE\x20?',_0x3e7392+'%');}_0x1ffb91['or'](_0x8d3a('0x84'),_0x3e7392+'%');}}_0x49f599['where'](_0x1ffb91);_0x49f599[_0x8d3a('0x85')](_0x8d3a('0x86'));var _0x2e451e={'type':db[_0x8d3a('0x87')]['QueryTypes'][_0x8d3a('0x88')],'raw':!![]};var _0x5814a9=_0x49f599[_0x8d3a('0x89')]();_0x5814a9['field']('i.id');_0x5814a9[_0x8d3a('0x46')](_0x8d3a('0x8a'),_0x8d3a('0x8b'));if(_0x22a707[_0x8d3a('0x41')]){_0x22a707[_0x8d3a('0x41')][_0x8d3a('0x6b')](function(_0x3fb695){_0x49f599[_0x8d3a('0x41')]('i.'+_0x3fb695[0x0],_0x3fb695[0x1]===_0x8d3a('0x8c')?![]:!![]);});}if(!_[_0x8d3a('0x71')](_0x1b4aae)){_0x49f599[_0x8d3a('0x61')](_0x1be6ab);_0x5814a9[_0x8d3a('0x43')](_0x8d3a('0x8d'),_0x1b4aae);}BPromise[_0x8d3a('0x8e')]()[_0x8d3a('0x27')](function(){if(!_0x2ce7af){if(_0x1e6538['query']['FaxAccountId']||_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x8f')])return;_0x5814a9['where'](_0x8d3a('0x90'));_0x49f599[_0x8d3a('0x43')](_0x8d3a('0x90'));return;}return _0x1e6538[_0x8d3a('0x91')][_0x8d3a('0x92')]({'attributes':['id'],'raw':!![]})[_0x8d3a('0x27')](function(_0x3a6e2f){if(_[_0x8d3a('0x71')](_0x3a6e2f)){_0x5814a9['where']('i.FaxAccountId\x20IS\x20NULL');_0x49f599[_0x8d3a('0x43')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x5814a9[_0x8d3a('0x43')](_0x8d3a('0x73'),_['map'](_0x3a6e2f,'id'));_0x49f599[_0x8d3a('0x43')](_0x8d3a('0x73'),_['map'](_0x3a6e2f,'id'));}});})[_0x8d3a('0x27')](function(){db[_0x8d3a('0x93')]['query'](_0x5814a9[_0x8d3a('0x94')](),_0x2e451e)[_0x8d3a('0x27')](function(_0x50cb3f){_0x17aa45[_0x8d3a('0x1e')]=_0x50cb3f['length'];if(_0x17aa45['count']===0x0)return[];return db['sequelize'][_0x8d3a('0x39')](_0x54b19a[_0x8d3a('0x94')](),_0x2e451e)['then'](function(_0xa0260c){_0x337995=_['keyBy'](_0xa0260c,'id');_0x2e451e=_[_0x8d3a('0x95')](_0x2e451e,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e6538[_0x8d3a('0x39')][_0x8d3a('0x3d')]){_0x22a707[_0x8d3a('0x3e')][_0x8d3a('0x6b')](function(_0x350bfd){_0x49f599[_0x8d3a('0x46')]('i.'+_0x350bfd);});}else{_0x49f599['field'](_0x8d3a('0x8a'),_0x8d3a('0x8b'));_0x49f599['field'](_0x8d3a('0x96'),'Account.key');_0x49f599[_0x8d3a('0x46')]('a.mandatoryDisposition',_0x8d3a('0x97'));_0x49f599[_0x8d3a('0x46')](_0x8d3a('0x98'));_0x49f599[_0x8d3a('0x46')](_0x8d3a('0x99'),'Contact.firstName');_0x49f599[_0x8d3a('0x46')]('c.lastName',_0x8d3a('0x9a'));_0x49f599[_0x8d3a('0x46')]('c.email',_0x8d3a('0x9b'));_0x49f599['field'](_0x8d3a('0x9c'),'Contact.phone');_0x49f599[_0x8d3a('0x46')](_0x8d3a('0x9d'),'Contact.mobile');_0x49f599[_0x8d3a('0x46')](_0x8d3a('0x9e'),_0x8d3a('0x9f'));_0x49f599[_0x8d3a('0x46')](_0x8d3a('0xa0'),_0x8d3a('0xa1'));_0x49f599['field'](_0x8d3a('0xa2'),_0x8d3a('0xa3'));_0x49f599[_0x8d3a('0x46')](_0x8d3a('0xa4'),_0x8d3a('0x30'));}if(_0x22a707['limit'])_0x49f599['limit'](_0x22a707[_0x8d3a('0x20')]);if(_0x22a707['offset'])_0x49f599['offset'](_0x22a707[_0x8d3a('0x1f')]);return db[_0x8d3a('0x93')]['query'](_0x49f599[_0x8d3a('0x94')](),_0x2e451e);})[_0x8d3a('0x27')](function(_0x18bede){_0x489d8f[_0x8d3a('0x43')]('ui.FaxInteractionId\x20IN\x20?',_[_0x8d3a('0x2e')](_0x18bede,'id'));return db[_0x8d3a('0x93')][_0x8d3a('0x39')](_0x489d8f[_0x8d3a('0x94')](),_0x2e451e)['then'](function(_0xd930e4){var _0x5608e6=_[_0x8d3a('0xa5')](_0xd930e4,'FaxInteractionId');var _0x1eb7e7=[];_0x18bede[_0x8d3a('0x6b')](function(_0x31aac5){_0x1eb7e7['push'](updateFaxInteraction(_0x31aac5,_0x337995,_0x5608e6));});return BPromise[_0x8d3a('0xa6')](_0x1eb7e7);});});})[_0x8d3a('0x27')](function(_0x18af3b){_0x17aa45[_0x8d3a('0xa7')]=_0x18af3b;return _0x17aa45;})[_0x8d3a('0x27')](respondWithFilteredResult(_0x12cb40,_0x22a707));})[_0x8d3a('0x32')](handleError(_0x12cb40,null));};exports[_0x8d3a('0xa8')]=function(_0x2e747b,_0x281cbb){var _0x39163f={'raw':![],'where':{'id':_0x2e747b['params']['id']}},_0x50744c={};_0x50744c[_0x8d3a('0x3c')]=_[_0x8d3a('0x38')](db['FaxInteraction'][_0x8d3a('0xa9')]);_0x50744c[_0x8d3a('0x39')]=_[_0x8d3a('0x38')](_0x2e747b['query']);_0x50744c[_0x8d3a('0x3a')]=_[_0x8d3a('0x3b')](_0x50744c[_0x8d3a('0x3c')],_0x50744c[_0x8d3a('0x39')]);_0x39163f[_0x8d3a('0x3e')]=_[_0x8d3a('0x3b')](_0x50744c[_0x8d3a('0x3c')],qs['fields'](_0x2e747b[_0x8d3a('0x39')]['fields']));_0x39163f[_0x8d3a('0x3e')]=_0x39163f[_0x8d3a('0x3e')]['length']?_0x39163f[_0x8d3a('0x3e')]:_0x50744c[_0x8d3a('0x3c')];if(_0x2e747b[_0x8d3a('0x39')][_0x8d3a('0xaa')]){_0x39163f['include']=[{'all':!![]}];}_0x39163f=_[_0x8d3a('0x95')]({},_0x39163f,_0x2e747b[_0x8d3a('0xab')]);return db[_0x8d3a('0x34')][_0x8d3a('0x5f')](_0x39163f)['then'](handleEntityNotFound(_0x281cbb,null))[_0x8d3a('0x27')](respondWithResult(_0x281cbb,null))['catch'](handleError(_0x281cbb,null));};exports[_0x8d3a('0xac')]=function(_0x5d3910,_0x583ebc){return db[_0x8d3a('0x34')][_0x8d3a('0xac')](_0x5d3910[_0x8d3a('0xad')],{})[_0x8d3a('0x27')](respondWithResult(_0x583ebc,0xc9))[_0x8d3a('0x32')](handleError(_0x583ebc,null));};exports[_0x8d3a('0x26')]=function(_0x4ee4f9,_0x504bdd){if(_0x4ee4f9[_0x8d3a('0xad')]['id']){delete _0x4ee4f9['body']['id'];}return db[_0x8d3a('0x34')]['find']({'where':{'id':_0x4ee4f9[_0x8d3a('0xae')]['id']}})['then'](handleEntityNotFound(_0x504bdd,null))[_0x8d3a('0x27')](saveUpdates(_0x4ee4f9[_0x8d3a('0xad')],null))['then'](respondWithResult(_0x504bdd,null))[_0x8d3a('0x32')](handleError(_0x504bdd,null));};exports[_0x8d3a('0x28')]=function(_0x8ddb67,_0x5dde97){return db[_0x8d3a('0x34')][_0x8d3a('0x5f')]({'where':{'id':_0x8ddb67[_0x8d3a('0xae')]['id']}})[_0x8d3a('0x27')](handleEntityNotFound(_0x5dde97,null))[_0x8d3a('0x27')](removeEntity(_0x5dde97,null))['catch'](handleError(_0x5dde97,null));};exports[_0x8d3a('0xaf')]=function(_0x3c8226,_0x111922){return db[_0x8d3a('0x34')][_0x8d3a('0xaf')]()[_0x8d3a('0x27')](respondWithResult(_0x111922,null))[_0x8d3a('0x32')](handleError(_0x111922,null));};exports[_0x8d3a('0xb0')]=function(_0x276a0b,_0x44d018,_0x24fc01){return db[_0x8d3a('0xb1')][_0x8d3a('0x5f')]({'where':{'id':_0x276a0b[_0x8d3a('0xae')]['id']}})['then'](handleEntityNotFound(_0x44d018,null))[_0x8d3a('0x27')](function(_0x5247a1){if(_0x5247a1){return _0x5247a1[_0x8d3a('0xb0')](_0x276a0b[_0x8d3a('0xad')][_0x8d3a('0xb2')],_[_0x8d3a('0xb3')](_0x276a0b[_0x8d3a('0xad')],[_0x8d3a('0xb2'),'id'])||{});}})[_0x8d3a('0x27')](respondWithResult(_0x44d018,null))[_0x8d3a('0x32')](handleError(_0x44d018,null));};exports[_0x8d3a('0xb4')]=function(_0x2918ca,_0x4e6290,_0x59a557){var _0x46e5bf={'raw':![],'where':{}};var _0x55becc={};var _0x345167={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x8d3a('0xb5')]({'where':{'id':_0x2918ca[_0x8d3a('0xae')]['id']}})[_0x8d3a('0x27')](handleEntityNotFound(_0x4e6290,null))['then'](function(_0x432c56){if(_0x432c56){_0x55becc['model']=_[_0x8d3a('0x38')](db[_0x8d3a('0xb1')][_0x8d3a('0xa9')]);_0x55becc[_0x8d3a('0x39')]=_['keys'](_0x2918ca[_0x8d3a('0x39')]);_0x55becc[_0x8d3a('0x3a')]=_[_0x8d3a('0x3b')](_0x55becc['model'],_0x55becc[_0x8d3a('0x39')]);_0x46e5bf[_0x8d3a('0x3e')]=_[_0x8d3a('0x3b')](_0x55becc[_0x8d3a('0x3c')],qs['fields'](_0x2918ca[_0x8d3a('0x39')][_0x8d3a('0x3d')]));_0x46e5bf[_0x8d3a('0x3e')]=_0x46e5bf[_0x8d3a('0x3e')][_0x8d3a('0x3f')]?_0x46e5bf[_0x8d3a('0x3e')]:_0x55becc['model'];if(!_0x2918ca['query'][_0x8d3a('0xb6')]('nolimit')){_0x46e5bf['limit']=qs[_0x8d3a('0x20')](_0x2918ca[_0x8d3a('0x39')][_0x8d3a('0x20')]);_0x46e5bf[_0x8d3a('0x1f')]=qs[_0x8d3a('0x1f')](_0x2918ca['query'][_0x8d3a('0x1f')]);}_0x46e5bf[_0x8d3a('0x41')]=qs['sort'](_0x2918ca['query'][_0x8d3a('0x42')]);_0x46e5bf[_0x8d3a('0x43')]=qs['filters'](_[_0x8d3a('0x44')](_0x2918ca[_0x8d3a('0x39')],_0x55becc['filters']));_0x46e5bf[_0x8d3a('0x43')][_0x8d3a('0xb7')]=_0x432c56['id'];if(_0x2918ca[_0x8d3a('0x39')]['filter']){_0x46e5bf[_0x8d3a('0x43')]=_['merge'](_0x46e5bf[_0x8d3a('0x43')],{'$or':_[_0x8d3a('0x2e')](_0x46e5bf[_0x8d3a('0x3e')],function(_0x529aa7){var _0x1e519d={};_0x1e519d[_0x529aa7]={'$like':'%'+_0x2918ca[_0x8d3a('0x39')]['filter']+'%'};return _0x1e519d;})});}if(_0x2918ca[_0x8d3a('0x39')]['$gte']){var _0x561071=_0x2918ca[_0x8d3a('0x39')][_0x8d3a('0x77')][_0x8d3a('0x31')](',');var _0x130dfa={};_0x130dfa[_0x561071[0x0]]={'$gte':moment(_0x561071[0x1])[_0x8d3a('0xb8')](_0x8d3a('0xb9'))};_0x46e5bf[_0x8d3a('0x43')]=_[_0x8d3a('0x95')](_0x46e5bf[_0x8d3a('0x43')],_0x130dfa);}_0x46e5bf=_[_0x8d3a('0x95')]({},_0x46e5bf,_0x2918ca['options']);return db['FaxMessage'][_0x8d3a('0x1e')]({'where':_0x46e5bf[_0x8d3a('0x43')]})[_0x8d3a('0x27')](function(_0x542ba7){_0x345167[_0x8d3a('0x1e')]=_0x542ba7;if(_0x2918ca[_0x8d3a('0x39')][_0x8d3a('0xaa')]){_0x46e5bf[_0x8d3a('0xba')]=[{'all':!![]}];}return db['FaxMessage'][_0x8d3a('0xbb')](_0x46e5bf);})['then'](function(_0x5430f0){_0x345167[_0x8d3a('0xa7')]=_0x5430f0;return _0x345167;});}})['then'](respondWithFilteredResult(_0x4e6290,_0x46e5bf))[_0x8d3a('0x32')](handleError(_0x4e6290,null));};exports[_0x8d3a('0xbc')]=function(_0x222dc7,_0x1e4d36,_0x370f6d){return db[_0x8d3a('0x34')][_0x8d3a('0x5f')]({'where':{'id':_0x222dc7['params']['id']}})[_0x8d3a('0x27')](handleEntityNotFound(_0x1e4d36,null))[_0x8d3a('0x27')](function(_0x468f39){if(_0x468f39){return _0x468f39[_0x8d3a('0xbd')](_0x222dc7[_0x8d3a('0xad')][_0x8d3a('0xb2')],_[_0x8d3a('0xb3')](_0x222dc7[_0x8d3a('0xad')],[_0x8d3a('0xb2'),'id'])||{})[_0x8d3a('0xbe')](function(){return db[_0x8d3a('0x6a')][_0x8d3a('0xbb')]({'attributes':['id',_0x8d3a('0x2b'),_0x8d3a('0x47')],'where':{'id':_0x222dc7[_0x8d3a('0xad')][_0x8d3a('0xb2')]}});})['then'](function(_0x2f6920){socket[_0x8d3a('0xbf')](_0x8d3a('0xc0'),{'id':Number(_0x222dc7[_0x8d3a('0xae')]['id']),'tags':_0x2f6920||[]});return{'id':Number(_0x222dc7[_0x8d3a('0xae')]['id']),'tags':_0x2f6920||[]};});}})[_0x8d3a('0x27')](respondWithResult(_0x1e4d36,null))[_0x8d3a('0x32')](handleError(_0x1e4d36,null));};exports['removeTags']=function(_0x2c2cc7,_0xe193f8,_0x1ba6ab){return db['FaxInteraction'][_0x8d3a('0x5f')]({'where':{'id':_0x2c2cc7[_0x8d3a('0xae')]['id']}})[_0x8d3a('0x27')](handleEntityNotFound(_0xe193f8,null))[_0x8d3a('0x27')](function(_0x24e92d){if(_0x24e92d){return _0x24e92d[_0x8d3a('0xc1')](_0x2c2cc7[_0x8d3a('0x39')][_0x8d3a('0xb2')]);}})[_0x8d3a('0x27')](respondWithStatusCode(_0xe193f8,null))[_0x8d3a('0x32')](handleError(_0xe193f8,null));};exports['download']=function(_0x290b8d,_0x3fccd7){var _0x1d67e4=moment()[_0x8d3a('0xc2')]()[_0x8d3a('0x94')]();var _0x1d9c13=path[_0x8d3a('0xc3')](config[_0x8d3a('0xc4')],_0x8d3a('0xc5'),_0x8d3a('0xc6'),_0x8d3a('0xc7'));var _0xb83ebe=path[_0x8d3a('0xc3')](config['root'],_0x8d3a('0xc5'),_0x8d3a('0xc6'),_0x8d3a('0xc8'));var _0x19dd8b=path[_0x8d3a('0xc3')](_0x1d9c13,_0x1d67e4);var _0x522f23=util['format'](_0x8d3a('0xc9'),_0x290b8d['params']['id'],_0x1d67e4);var _0x57a09f=path['join'](_0x1d9c13,_0x522f23);var _0x200bd1=[];_0x200bd1[_0x8d3a('0xca')]({'model':db[_0x8d3a('0xcb')],'as':_0x8d3a('0xcb'),'raw':!![]});var _0xad9c46=[{'model':db[_0x8d3a('0xb1')],'as':'Messages','attributes':['id',_0x8d3a('0xad'),'createdAt'],'include':_0x200bd1}];return db[_0x8d3a('0x34')][_0x8d3a('0x5f')]({'where':{'id':_0x290b8d[_0x8d3a('0xae')]['id']},'include':_0xad9c46})[_0x8d3a('0x27')](handleEntityNotFound(_0x3fccd7,null))[_0x8d3a('0x27')](function(_0x2cf890){if(_0x2cf890&&_0x2cf890[_0x8d3a('0xcc')]){var _0x46b36a=_0x2cf890[_0x8d3a('0xcd')]({'plain':!![]});fs[_0x8d3a('0xce')](_0x19dd8b);for(var _0x356e09=0x0;_0x356e09<_0x46b36a[_0x8d3a('0xcc')]['length'];_0x356e09++){var _0x5910c9=_0x46b36a[_0x8d3a('0xcc')][_0x356e09]['Attachment'];if(_0x5910c9){var _0x554c80=path[_0x8d3a('0xc3')](_0xb83ebe,_0x5910c9['basename']);if(fs[_0x8d3a('0xcf')](_0x554c80)){fs['createReadStream'](_0x554c80)[_0x8d3a('0xd0')](fs[_0x8d3a('0xd1')](path[_0x8d3a('0xc3')](_0x19dd8b,_0x5910c9['basename'])));}}}return BPromise['resolve']()[_0x8d3a('0x27')](function(){return new BPromise(function(_0x4c624f,_0xd0fddb){zipdir(_0x19dd8b,{'saveTo':_0x57a09f},function(_0x27c184,_0x1a806f){if(_0x27c184)return _0xd0fddb(_0x27c184);return _0x4c624f(_0x1a806f);});})['then'](function(){return new BPromise(function(_0x418553,_0x3cbe16){rimraf(_0x19dd8b,function(_0x1a32f7){if(_0x1a32f7)_0x3cbe16(_0x1a32f7);return _0x418553();});});})[_0x8d3a('0x27')](function(){return _0x3fccd7['download'](_0x57a09f,_0x522f23,function(_0x135d78){if(_0x135d78){console[_0x8d3a('0xd2')](_0x8d3a('0xd3'),_0x135d78);}else{fs[_0x8d3a('0xd4')](_0x57a09f);}});});});}else{return _0x3fccd7['sendStatus'](0xc8);}})['catch'](handleError(_0x3fccd7,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 1e41f74..2a9e555 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x110763,_0x2f808e){var _0x2420ff=function(_0x5839ca){while(--_0x5839ca){_0x110763['push'](_0x110763['shift']());}};_0x2420ff(++_0x2f808e);}(_0x7a54,0x106));var _0x47a5=function(_0x4e30ba,_0x4e0409){_0x4e30ba=_0x4e30ba-0x0;var _0xcda3f3=_0x7a54[_0x4e30ba];return _0xcda3f3;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x218b21,_0x123331){var _0x5a1239=function(_0x1cafcb){while(--_0x1cafcb){_0x218b21['push'](_0x218b21['shift']());}};_0x5a1239(++_0x123331);}(_0x326f,0xd1));var _0xf326=function(_0x1a3b3d,_0x38dc32){_0x1a3b3d=_0x1a3b3d-0x0;var _0x2ea095=_0x326f[_0x1a3b3d];return _0x2ea095;};'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 e895491..60e2308 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 _0xb903=['rimraf','../../config/environment','./faxInteraction.attributes','exports','fax_interactions','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x554b0e,_0x4d1fa3){var _0x3bdaa9=function(_0x1a7183){while(--_0x1a7183){_0x554b0e['push'](_0x554b0e['shift']());}};_0x3bdaa9(++_0x4d1fa3);}(_0xb903,0x185));var _0x3b90=function(_0x255e17,_0x51b9ab){_0x255e17=_0x255e17-0x0;var _0x1d12e7=_0xb903[_0x255e17];return _0x1d12e7;};'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']('FaxInteraction',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e4c06,_0x42efe8,_0x1b1fbf){if(_0x2e4c06['changed']('closed')){_0x2e4c06['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1b1fbf(null,_0x2e4c06);}}});}; \ 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(_0x862be0,_0x263d9a){var _0xf5ec21=function(_0x30d027){while(--_0x30d027){_0x862be0['push'](_0x862be0['shift']());}};_0xf5ec21(++_0x263d9a);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x234971,_0x4327a1){_0x234971=_0x234971-0x0;var _0x2b72f6=_0x6f0d[_0x234971];return _0x2b72f6;};'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 4d4b513..788dce4 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 _0xa5d5=['raw','attributes','UpdateFaxInteraction','AddTagsToFaxInteraction','find','where','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxInteraction','update','options'];(function(_0x1653b1,_0x35b7d1){var _0x3e0b17=function(_0x5f21fc){while(--_0x5f21fc){_0x1653b1['push'](_0x1653b1['shift']());}};_0x3e0b17(++_0x35b7d1);}(_0xa5d5,0xb3));var _0x5a5d=function(_0x312de7,_0x44f7c7){_0x312de7=_0x312de7-0x0;var _0x5889a2=_0xa5d5[_0x312de7];return _0x5889a2;};'use strict';var _=require(_0x5a5d('0x0'));var util=require(_0x5a5d('0x1'));var moment=require(_0x5a5d('0x2'));var BPromise=require(_0x5a5d('0x3'));var rs=require(_0x5a5d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a5d('0x5'))['db'];var utils=require(_0x5a5d('0x6'));var logger=require(_0x5a5d('0x7'))(_0x5a5d('0x8'));var config=require('../../config/environment');var jayson=require(_0x5a5d('0x9'));var client=jayson['client'][_0x5a5d('0xa')]({'port':0x232a});config[_0x5a5d('0xb')]=_[_0x5a5d('0xc')](config[_0x5a5d('0xb')],{'host':_0x5a5d('0xd'),'port':0x18eb});var socket=require(_0x5a5d('0xe'))(new Redis(config[_0x5a5d('0xb')]));require('./faxInteraction.socket')[_0x5a5d('0xf')](socket);function respondWithRpcPromise(_0x5ac8e4,_0x281a66,_0xbb11f0){return new BPromise(function(_0x417719,_0xf6256a){return client[_0x5a5d('0x10')](_0x5ac8e4,_0xbb11f0)[_0x5a5d('0x11')](function(_0x4416f1){logger[_0x5a5d('0x12')](_0x5a5d('0x13'),_0x281a66,_0x5a5d('0x14'));logger['debug'](_0x5a5d('0x15'),_0x281a66,_0x5a5d('0x14'),JSON[_0x5a5d('0x16')](_0x4416f1));if(_0x4416f1[_0x5a5d('0x17')]){if(_0x4416f1[_0x5a5d('0x17')][_0x5a5d('0x18')]===0x1f4){logger['error'](_0x5a5d('0x13'),_0x281a66,_0x4416f1[_0x5a5d('0x17')][_0x5a5d('0x19')]);return _0xf6256a(_0x4416f1[_0x5a5d('0x17')][_0x5a5d('0x19')]);}logger[_0x5a5d('0x17')](_0x5a5d('0x13'),_0x281a66,_0x4416f1[_0x5a5d('0x17')][_0x5a5d('0x19')]);return _0x417719(_0x4416f1[_0x5a5d('0x17')][_0x5a5d('0x19')]);}else{logger[_0x5a5d('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x281a66,'request\x20sent');_0x417719(_0x4416f1[_0x5a5d('0x1a')]['message']);}})[_0x5a5d('0x1b')](function(_0x541bf8){logger[_0x5a5d('0x17')](_0x5a5d('0x13'),_0x281a66,_0x541bf8);_0xf6256a(_0x541bf8);});});}exports['UpdateFaxInteraction']=function(_0x2fb912){var _0x62052f=this;return new Promise(function(_0x22cc96,_0x2966e1){return db[_0x5a5d('0x1c')][_0x5a5d('0x1d')](_0x2fb912['body'],{'raw':_0x2fb912[_0x5a5d('0x1e')]?_0x2fb912[_0x5a5d('0x1e')][_0x5a5d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fb912[_0x5a5d('0x1e')]?_0x2fb912[_0x5a5d('0x1e')]['where']||null:null,'attributes':_0x2fb912[_0x5a5d('0x1e')]?_0x2fb912[_0x5a5d('0x1e')][_0x5a5d('0x20')]||null:null,'limit':_0x2fb912[_0x5a5d('0x1e')]?_0x2fb912[_0x5a5d('0x1e')]['limit']||null:null})['then'](function(_0x15f914){logger[_0x5a5d('0x12')]('UpdateFaxInteraction',_0x2fb912);logger['debug']('UpdateFaxInteraction',_0x2fb912,JSON['stringify'](_0x15f914));_0x22cc96(_0x15f914);})['catch'](function(_0x118d46){logger[_0x5a5d('0x17')](_0x5a5d('0x21'),_0x118d46[_0x5a5d('0x19')],_0x2fb912);_0x2966e1(_0x62052f['error'](0x1f4,_0x118d46[_0x5a5d('0x19')]));});});};exports[_0x5a5d('0x22')]=function(_0x27e419){return new Promise(function(_0x3b6dda,_0x329ddb){return db['FaxInteraction'][_0x5a5d('0x23')]({'where':_0x27e419[_0x5a5d('0x1e')]?_0x27e419[_0x5a5d('0x1e')][_0x5a5d('0x24')]||null:null})[_0x5a5d('0x11')](function(_0x389269){if(_0x389269){return _0x389269[_0x5a5d('0x25')](_0x27e419[_0x5a5d('0x26')][_0x5a5d('0x27')],_['omit'](_0x27e419[_0x5a5d('0x26')],[_0x5a5d('0x27'),'id'])||{});}})[_0x5a5d('0x28')](function(_0x4d034b){logger[_0x5a5d('0x12')](_0x5a5d('0x29'),_0x27e419);logger['debug'](_0x5a5d('0x29'),_0x27e419,JSON[_0x5a5d('0x16')](_0x4d034b));_0x3b6dda(_0x4d034b);})[_0x5a5d('0x1b')](function(_0x37045a){logger[_0x5a5d('0x17')](_0x5a5d('0x29'),_0x37045a[_0x5a5d('0x19')],_0x27e419);_0x329ddb(_this['error'](0x1f4,_0x37045a[_0x5a5d('0x19')]));});});}; \ No newline at end of file +var _0x06a9=['options','raw','attributes','limit','AddTagsToFaxInteraction','find','where','addTags','ids','omit','AddTags','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body'];(function(_0x5314a3,_0x485f48){var _0x50a0de=function(_0x4de78a){while(--_0x4de78a){_0x5314a3['push'](_0x5314a3['shift']());}};_0x50a0de(++_0x485f48);}(_0x06a9,0x101));var _0x906a=function(_0x4045f3,_0x555e1d){_0x4045f3=_0x4045f3-0x0;var _0x588eb2=_0x06a9[_0x4045f3];return _0x588eb2;};'use strict';var _=require(_0x906a('0x0'));var util=require('util');var moment=require(_0x906a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x906a('0x2'));var db=require(_0x906a('0x3'))['db'];var utils=require(_0x906a('0x4'));var logger=require(_0x906a('0x5'))(_0x906a('0x6'));var config=require('../../config/environment');var jayson=require(_0x906a('0x7'));var client=jayson[_0x906a('0x8')][_0x906a('0x9')]({'port':0x232a});config[_0x906a('0xa')]=_[_0x906a('0xb')](config[_0x906a('0xa')],{'host':_0x906a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxInteraction.socket')[_0x906a('0xd')](socket);function respondWithRpcPromise(_0x531d4b,_0x3185b3,_0x41cd87){return new BPromise(function(_0x36a410,_0xf12ec8){return client[_0x906a('0xe')](_0x531d4b,_0x41cd87)[_0x906a('0xf')](function(_0x2ddc1a){logger[_0x906a('0x10')](_0x906a('0x11'),_0x3185b3,_0x906a('0x12'));logger[_0x906a('0x13')](_0x906a('0x14'),_0x3185b3,_0x906a('0x12'),JSON[_0x906a('0x15')](_0x2ddc1a));if(_0x2ddc1a[_0x906a('0x16')]){if(_0x2ddc1a[_0x906a('0x16')][_0x906a('0x17')]===0x1f4){logger['error'](_0x906a('0x11'),_0x3185b3,_0x2ddc1a[_0x906a('0x16')][_0x906a('0x18')]);return _0xf12ec8(_0x2ddc1a[_0x906a('0x16')][_0x906a('0x18')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x3185b3,_0x2ddc1a[_0x906a('0x16')][_0x906a('0x18')]);return _0x36a410(_0x2ddc1a['error']['message']);}else{logger[_0x906a('0x10')](_0x906a('0x11'),_0x3185b3,_0x906a('0x12'));_0x36a410(_0x2ddc1a['result'][_0x906a('0x18')]);}})[_0x906a('0x19')](function(_0x44f85d){logger[_0x906a('0x16')](_0x906a('0x11'),_0x3185b3,_0x44f85d);_0xf12ec8(_0x44f85d);});});}exports[_0x906a('0x1a')]=function(_0x2e1960){var _0x53ae34=this;return new Promise(function(_0x3f32bb,_0x2edf13){return db[_0x906a('0x1b')][_0x906a('0x1c')](_0x2e1960[_0x906a('0x1d')],{'raw':_0x2e1960[_0x906a('0x1e')]?_0x2e1960[_0x906a('0x1e')][_0x906a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e1960[_0x906a('0x1e')]?_0x2e1960[_0x906a('0x1e')]['where']||null:null,'attributes':_0x2e1960[_0x906a('0x1e')]?_0x2e1960[_0x906a('0x1e')][_0x906a('0x20')]||null:null,'limit':_0x2e1960[_0x906a('0x1e')]?_0x2e1960[_0x906a('0x1e')][_0x906a('0x21')]||null:null})[_0x906a('0xf')](function(_0x1ca4e2){logger['info'](_0x906a('0x1a'),_0x2e1960);logger[_0x906a('0x13')](_0x906a('0x1a'),_0x2e1960,JSON[_0x906a('0x15')](_0x1ca4e2));_0x3f32bb(_0x1ca4e2);})['catch'](function(_0x4177ce){logger[_0x906a('0x16')]('UpdateFaxInteraction',_0x4177ce[_0x906a('0x18')],_0x2e1960);_0x2edf13(_0x53ae34[_0x906a('0x16')](0x1f4,_0x4177ce['message']));});});};exports[_0x906a('0x22')]=function(_0x1f4bff){return new Promise(function(_0x30ad99,_0x4a8d1e){return db[_0x906a('0x1b')][_0x906a('0x23')]({'where':_0x1f4bff['options']?_0x1f4bff[_0x906a('0x1e')][_0x906a('0x24')]||null:null})['then'](function(_0x4294be){if(_0x4294be){return _0x4294be[_0x906a('0x25')](_0x1f4bff[_0x906a('0x1d')][_0x906a('0x26')],_[_0x906a('0x27')](_0x1f4bff[_0x906a('0x1d')],['ids','id'])||{});}})['spread'](function(_0x361353){logger[_0x906a('0x10')](_0x906a('0x28'),_0x1f4bff);logger['debug'](_0x906a('0x28'),_0x1f4bff,JSON[_0x906a('0x15')](_0x361353));_0x30ad99(_0x361353);})[_0x906a('0x19')](function(_0x891f93){logger[_0x906a('0x16')]('AddTags',_0x891f93[_0x906a('0x18')],_0x1f4bff);_0x4a8d1e(_this['error'](0x1f4,_0x891f93[_0x906a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 02b969a..bec91f1 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 _0x5090=['emit','removeListener','register','length','faxInteraction:','save','remove'];(function(_0x125106,_0x1a5f5d){var _0xc1ffd5=function(_0x338ca5){while(--_0x338ca5){_0x125106['push'](_0x125106['shift']());}};_0xc1ffd5(++_0x1a5f5d);}(_0x5090,0x140));var _0x0509=function(_0xb777a5,_0xb478e9){_0xb777a5=_0xb777a5-0x0;var _0x38593f=_0x5090[_0xb777a5];return _0x38593f;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x0509('0x0'),_0x0509('0x1'),'update'];function createListener(_0x2b4d9e,_0x235f21){return function(_0x5940f6){_0x235f21[_0x0509('0x2')](_0x2b4d9e,_0x5940f6);};}function removeListener(_0x2ba8bc,_0x470118){return function(){FaxInteractionEvents[_0x0509('0x3')](_0x2ba8bc,_0x470118);};}exports[_0x0509('0x4')]=function(_0x4fb0d8){for(var _0x354fed=0x0,_0x5ca66b=events[_0x0509('0x5')];_0x354fed<_0x5ca66b;_0x354fed++){var _0x156c91=events[_0x354fed];var _0x1fcc82=createListener(_0x0509('0x6')+_0x156c91,_0x4fb0d8);FaxInteractionEvents['on'](_0x156c91,_0x1fcc82);}}; \ No newline at end of file +var _0x93ab=['update','emit','removeListener','register','faxInteraction:','./faxInteraction.events','remove'];(function(_0x5bd0cb,_0x175893){var _0x35a125=function(_0x3365c7){while(--_0x3365c7){_0x5bd0cb['push'](_0x5bd0cb['shift']());}};_0x35a125(++_0x175893);}(_0x93ab,0x17f));var _0xb93a=function(_0x2442b9,_0x3d87e9){_0x2442b9=_0x2442b9-0x0;var _0x31b571=_0x93ab[_0x2442b9];return _0x31b571;};'use strict';var FaxInteractionEvents=require(_0xb93a('0x0'));var events=['save',_0xb93a('0x1'),_0xb93a('0x2')];function createListener(_0xee2555,_0x185664){return function(_0x3db4b7){_0x185664[_0xb93a('0x3')](_0xee2555,_0x3db4b7);};}function removeListener(_0x4e1b2e,_0x310446){return function(){FaxInteractionEvents[_0xb93a('0x4')](_0x4e1b2e,_0x310446);};}exports[_0xb93a('0x5')]=function(_0x28bda1){for(var _0x4fa642=0x0,_0x1ce07=events['length'];_0x4fa642<_0x1ce07;_0x4fa642++){var _0x40cbbc=events[_0x4fa642];var _0x372253=createListener(_0xb93a('0x6')+_0x40cbbc,_0x28bda1);FaxInteractionEvents['on'](_0x40cbbc,_0x372253);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 58d9606..231fd16 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 _0xdecb=['faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','fax'];(function(_0x1dcd54,_0x1406f7){var _0x1bff50=function(_0x3eb8e3){while(--_0x3eb8e3){_0x1dcd54['push'](_0x1dcd54['shift']());}};_0x1bff50(++_0x1406f7);}(_0xdecb,0xe2));var _0xbdec=function(_0x10338e,_0x2ca58e){_0x10338e=_0x10338e-0x0;var _0x3c1b5c=_0xdecb[_0x10338e];return _0x3c1b5c;};'use strict';var multer=require('multer');var util=require(_0xbdec('0x0'));var path=require(_0xbdec('0x1'));var timeout=require(_0xbdec('0x2'));var express=require('express');var router=express[_0xbdec('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbdec('0x4'));var config=require(_0xbdec('0x5'));var controller=require(_0xbdec('0x6'));router[_0xbdec('0x7')]('/',auth[_0xbdec('0x8')](),controller[_0xbdec('0x9')]);router[_0xbdec('0x7')]('/describe',auth[_0xbdec('0x8')](),controller[_0xbdec('0xa')]);router[_0xbdec('0x7')](_0xbdec('0xb'),auth[_0xbdec('0x8')](),controller[_0xbdec('0xc')]);router[_0xbdec('0x7')](_0xbdec('0xd'),auth['isAuthenticated'](),controller[_0xbdec('0xe')]);router[_0xbdec('0x7')](_0xbdec('0xf'),auth[_0xbdec('0x8')](),controller['download']);router[_0xbdec('0x10')]('/',auth[_0xbdec('0x8')](),controller[_0xbdec('0x11')]);router['post'](_0xbdec('0xd'),auth[_0xbdec('0x8')](),controller[_0xbdec('0x12')]);router[_0xbdec('0x10')](_0xbdec('0x13'),auth[_0xbdec('0x8')](),interaction[_0xbdec('0x14')](_0xbdec('0x15'),_0xbdec('0x16')),controller[_0xbdec('0x17')]);router[_0xbdec('0x18')](_0xbdec('0xb'),auth['isAuthenticated'](),interaction[_0xbdec('0x14')](_0xbdec('0x15'),_0xbdec('0x19')),controller[_0xbdec('0x1a')]);router[_0xbdec('0x1b')](_0xbdec('0xb'),auth[_0xbdec('0x8')](),interaction[_0xbdec('0x14')](_0xbdec('0x15'),'faxinteraction:destroy'),controller[_0xbdec('0x1c')]);router['delete']('/:id/tags',auth[_0xbdec('0x8')](),controller[_0xbdec('0x1d')]);module[_0xbdec('0x1e')]=router; \ No newline at end of file +var _0xc995=['get','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','delete','faxinteraction:destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','isAuthenticated'];(function(_0x485cac,_0x3186fc){var _0x3790e8=function(_0x4df115){while(--_0x4df115){_0x485cac['push'](_0x485cac['shift']());}};_0x3790e8(++_0x3186fc);}(_0xc995,0x8c));var _0x5c99=function(_0x503f63,_0xe5c883){_0x503f63=_0x503f63-0x0;var _0x12a3f9=_0xc995[_0x503f63];return _0x12a3f9;};'use strict';var multer=require(_0x5c99('0x0'));var util=require(_0x5c99('0x1'));var path=require(_0x5c99('0x2'));var timeout=require(_0x5c99('0x3'));var express=require(_0x5c99('0x4'));var router=express[_0x5c99('0x5')]();var auth=require(_0x5c99('0x6'));var interaction=require(_0x5c99('0x7'));var config=require('../../config/environment');var controller=require(_0x5c99('0x8'));router['get']('/',auth[_0x5c99('0x9')](),controller['index']);router[_0x5c99('0xa')](_0x5c99('0xb'),auth[_0x5c99('0x9')](),controller[_0x5c99('0xc')]);router['get'](_0x5c99('0xd'),auth[_0x5c99('0x9')](),controller[_0x5c99('0xe')]);router[_0x5c99('0xa')](_0x5c99('0xf'),auth['isAuthenticated'](),controller[_0x5c99('0x10')]);router[_0x5c99('0xa')]('/:id/download',auth[_0x5c99('0x9')](),controller[_0x5c99('0x11')]);router[_0x5c99('0x12')]('/',auth[_0x5c99('0x9')](),controller[_0x5c99('0x13')]);router[_0x5c99('0x12')](_0x5c99('0xf'),auth[_0x5c99('0x9')](),controller['addMessage']);router[_0x5c99('0x12')](_0x5c99('0x14'),auth[_0x5c99('0x9')](),interaction[_0x5c99('0x15')](_0x5c99('0x16'),_0x5c99('0x17')),controller['addTags']);router[_0x5c99('0x18')]('/:id',auth[_0x5c99('0x9')](),interaction['tracked']('fax',_0x5c99('0x19')),controller[_0x5c99('0x1a')]);router[_0x5c99('0x1b')]('/:id',auth[_0x5c99('0x9')](),interaction[_0x5c99('0x15')](_0x5c99('0x16'),_0x5c99('0x1c')),controller['destroy']);router[_0x5c99('0x1b')](_0x5c99('0x14'),auth[_0x5c99('0x9')](),controller['removeTags']);module[_0x5c99('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 9894f7f..f13ff85 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 _0x02a4=['DATE','BOOLEAN','ENUM','out'];(function(_0x336f2b,_0x3dedb5){var _0x77f69e=function(_0x33acd0){while(--_0x33acd0){_0x336f2b['push'](_0x336f2b['shift']());}};_0x77f69e(++_0x3dedb5);}(_0x02a4,0xd9));var _0x402a=function(_0x21a387,_0x2fcb26){_0x21a387=_0x21a387-0x0;var _0xb2e63c=_0x02a4[_0x21a387];return _0xb2e63c;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x402a('0x0')],'defaultValue':![]},'direction':{'type':Sequelize[_0x402a('0x1')]('in',_0x402a('0x2')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x402a('0x3')]}}; \ No newline at end of file +var _0xc38e=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc38e,0x9b));var _0xec38=function(_0x13c458,_0x138ec5){_0x13c458=_0x13c458-0x0;var _0x2cac34=_0xc38e[_0x13c458];return _0x2cac34;};'use strict';var Sequelize=require(_0xec38('0x0'));module[_0xec38('0x1')]={'body':{'type':Sequelize[_0xec38('0x2')](_0xec38('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xec38('0x4')]('in','out'),'defaultValue':_0xec38('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xec38('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index f3e94ad..2f4879d 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 _0xfacf=['redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','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','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','end','stack','name','send','index','FaxMessage','rawAttributes','type','model','map','query','attributes','intersection','length','nolimit','order','sort','filters','pick','filter','where','merge','options','include','findAll','rows','params','keys','fields','includeAll','find','body','destroy','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','rejectmessage','create','ContactId','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','basename','join','server','files','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x1ccffc,_0xd63d4c){var _0x109f78=function(_0x28bfbe){while(--_0x28bfbe){_0x1ccffc['push'](_0x1ccffc['shift']());}};_0x109f78(++_0xd63d4c);}(_0xfacf,0x6a));var _0xffac=function(_0x9d1de4,_0xb02c28){_0x9d1de4=_0x9d1de4-0x0;var _0x5efe45=_0xfacf[_0x9d1de4];return _0x5efe45;};'use strict';var pdf=require(_0xffac('0x0'));var emlformat=require(_0xffac('0x1'));var rimraf=require(_0xffac('0x2'));var zipdir=require(_0xffac('0x3'));var jsonpatch=require(_0xffac('0x4'));var rp=require(_0xffac('0x5'));var moment=require('moment');var BPromise=require(_0xffac('0x6'));var Mustache=require(_0xffac('0x7'));var util=require(_0xffac('0x8'));var path=require('path');var sox=require(_0xffac('0x9'));var csv=require(_0xffac('0xa'));var ejs=require(_0xffac('0xb'));var fs=require('fs');var _=require(_0xffac('0xc'));var squel=require(_0xffac('0xd'));var crypto=require(_0xffac('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xffac('0xf'));var toCsv=require(_0xffac('0xa'));var querystring=require(_0xffac('0x10'));var Papa=require(_0xffac('0x11'));var Redis=require(_0xffac('0x12'));var authService=require(_0xffac('0x13'));var qs=require(_0xffac('0x14'));var as=require(_0xffac('0x15'));var hardwareService=require(_0xffac('0x16'));var logger=require(_0xffac('0x17'))('api');var utils=require(_0xffac('0x18'));var config=require(_0xffac('0x19'));var db=require(_0xffac('0x1a'))['db'];config[_0xffac('0x1b')]=_[_0xffac('0x1c')](config[_0xffac('0x1b')],{'host':_0xffac('0x1d'),'port':0x18eb});var socket=require(_0xffac('0x1e'))(new Redis(config['redis']));require(_0xffac('0x1f'))['register'](socket);var jayson=require(_0xffac('0x20'));var client=jayson[_0xffac('0x21')][_0xffac('0x22')]({'port':0x232c});var client9002=jayson[_0xffac('0x21')][_0xffac('0x22')]({'port':0x232a});function checkPasswordPattern(_0x3ae08d,_0x79c49a,_0xa2e3a7){if(_0xa2e3a7){var _0x1199dc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1199dc['test'](_0x79c49a)){return _0x3ae08d;}else{throw new db[(_0xffac('0x23'))]['ValidationError'](_0xffac('0x24'));}}else{return _0x3ae08d;}}function respondWithRpcPromise(_0x1f28af,_0x742c7c,_0x53a691,_0x3b4192){return new BPromise(function(_0x51de82,_0x4e034a){var _0x1fabeb=_0x3b4192||client;return _0x1fabeb[_0xffac('0x25')](_0x1f28af,_0x53a691)['then'](function(_0x4d6ea7){logger[_0xffac('0x26')](_0xffac('0x27'),_0x742c7c,_0xffac('0x28'));logger[_0xffac('0x29')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x742c7c,_0xffac('0x28'),JSON[_0xffac('0x2a')](_0x4d6ea7));if(_0x4d6ea7[_0xffac('0x2b')]){if(_0x4d6ea7[_0xffac('0x2b')][_0xffac('0x2c')]===0x1f4){logger[_0xffac('0x2b')](_0xffac('0x27'),_0x742c7c,_0x4d6ea7[_0xffac('0x2b')][_0xffac('0x2d')]);return _0x4e034a(_0x4d6ea7[_0xffac('0x2b')][_0xffac('0x2d')]);}logger['error'](_0xffac('0x27'),_0x742c7c,_0x4d6ea7[_0xffac('0x2b')]['message']);return _0x51de82(_0x4d6ea7[_0xffac('0x2b')][_0xffac('0x2d')]);}else{logger[_0xffac('0x26')](_0xffac('0x27'),_0x742c7c,_0xffac('0x28'));_0x51de82(_0x4d6ea7['result'][_0xffac('0x2d')]);}})[_0xffac('0x2e')](function(_0x134c87){logger['error'](_0xffac('0x27'),_0x742c7c,_0x134c87);_0x4e034a(_0x134c87);});});}function respondWithStatusCode(_0x3d312c,_0x18b355){_0x18b355=_0x18b355||0xcc;return function(_0x349b72){if(_0x349b72){return _0x3d312c[_0xffac('0x2f')](_0x18b355);}return _0x3d312c[_0xffac('0x30')](_0x18b355)['end']();};}function respondWithResult(_0x5121e6,_0x2b1ef3){_0x2b1ef3=_0x2b1ef3||0xc8;return function(_0x4b520b){if(_0x4b520b){return _0x5121e6[_0xffac('0x30')](_0x2b1ef3)[_0xffac('0x31')](_0x4b520b);}};}function respondWithFilteredResult(_0x19c7f0,_0x5ed449){return function(_0x3d3bf9){if(_0x3d3bf9){var _0x67d3dd=_0x3d3bf9[_0xffac('0x32')],_0x46f4a8=_0x5ed449[_0xffac('0x33')],_0x5034df=_0x5ed449['offset']+_0x5ed449[_0xffac('0x34')],_0x13d4d9;if(_0x5034df>=_0x67d3dd){_0x5034df=_0x67d3dd;_0x13d4d9=0xc8;}else{_0x13d4d9=0xce;}_0x19c7f0[_0xffac('0x30')](_0x13d4d9);return _0x19c7f0[_0xffac('0x35')]('Content-Range',_0x46f4a8+'-'+_0x5034df+'/'+_0x67d3dd)[_0xffac('0x31')](_0x3d3bf9);}return null;};}function patchUpdates(_0x17706c){return function(_0x2afb25){try{jsonpatch[_0xffac('0x36')](_0x2afb25,_0x17706c,!![]);}catch(_0x196d81){return BPromise[_0xffac('0x37')](_0x196d81);}return _0x2afb25[_0xffac('0x38')]();};}function saveUpdates(_0x2f2040,_0x1c786b){return function(_0x318a5e){if(_0x318a5e){return _0x318a5e[_0xffac('0x39')](_0x2f2040)[_0xffac('0x3a')](function(_0x2e02ba){return _0x2e02ba;});}return null;};}function removeEntity(_0x4b845a,_0x69a994){return function(_0x3daeba){if(_0x3daeba){return _0x3daeba['destroy']()[_0xffac('0x3a')](function(){_0x4b845a[_0xffac('0x30')](0xcc)[_0xffac('0x3b')]();});}};}function handleEntityNotFound(_0x3eb8cc,_0x48b940){return function(_0x241018){if(!_0x241018){_0x3eb8cc['sendStatus'](0x194);}return _0x241018;};}function handleError(_0x17deca,_0x1794aa){_0x1794aa=_0x1794aa||0x1f4;return function(_0x21cf1e){logger['error'](_0x21cf1e[_0xffac('0x3c')]);if(_0x21cf1e[_0xffac('0x3d')]){delete _0x21cf1e[_0xffac('0x3d')];}_0x17deca['status'](_0x1794aa)[_0xffac('0x3e')](_0x21cf1e);};}exports[_0xffac('0x3f')]=function(_0x16ed6e,_0x3d802d){var _0x5ceb8f={},_0x550116={},_0x2ea828={'count':0x0,'rows':[]};var _0x13e276=_['map'](db[_0xffac('0x40')][_0xffac('0x41')],function(_0x21c96c){return{'name':_0x21c96c['fieldName'],'type':_0x21c96c[_0xffac('0x42')]['key']};});_0x550116[_0xffac('0x43')]=_[_0xffac('0x44')](_0x13e276,_0xffac('0x3d'));_0x550116[_0xffac('0x45')]=_['keys'](_0x16ed6e[_0xffac('0x45')]);_0x550116['filters']=_['intersection'](_0x550116['model'],_0x550116[_0xffac('0x45')]);_0x5ceb8f[_0xffac('0x46')]=_[_0xffac('0x47')](_0x550116[_0xffac('0x43')],qs['fields'](_0x16ed6e[_0xffac('0x45')]['fields']));_0x5ceb8f[_0xffac('0x46')]=_0x5ceb8f[_0xffac('0x46')][_0xffac('0x48')]?_0x5ceb8f['attributes']:_0x550116['model'];if(!_0x16ed6e[_0xffac('0x45')]['hasOwnProperty'](_0xffac('0x49'))){_0x5ceb8f['limit']=qs[_0xffac('0x34')](_0x16ed6e[_0xffac('0x45')][_0xffac('0x34')]);_0x5ceb8f[_0xffac('0x33')]=qs['offset'](_0x16ed6e[_0xffac('0x45')]['offset']);}_0x5ceb8f[_0xffac('0x4a')]=qs[_0xffac('0x4b')](_0x16ed6e[_0xffac('0x45')][_0xffac('0x4b')]);_0x5ceb8f['where']=qs[_0xffac('0x4c')](_[_0xffac('0x4d')](_0x16ed6e[_0xffac('0x45')],_0x550116[_0xffac('0x4c')]),_0x13e276);if(_0x16ed6e[_0xffac('0x45')][_0xffac('0x4e')]){_0x5ceb8f[_0xffac('0x4f')]=_[_0xffac('0x50')](_0x5ceb8f['where'],{'$or':_[_0xffac('0x44')](_0x13e276,function(_0x456044){if(_0x456044[_0xffac('0x42')]!=='VIRTUAL'){var _0x3bd5c6={};_0x3bd5c6[_0x456044[_0xffac('0x3d')]]={'$like':'%'+_0x16ed6e[_0xffac('0x45')][_0xffac('0x4e')]+'%'};return _0x3bd5c6;}})});}_0x5ceb8f=_[_0xffac('0x50')]({},_0x5ceb8f,_0x16ed6e[_0xffac('0x51')]);var _0x2fa91b={'where':_0x5ceb8f[_0xffac('0x4f')]};return db[_0xffac('0x40')][_0xffac('0x32')](_0x2fa91b)[_0xffac('0x3a')](function(_0x5d9adc){_0x2ea828[_0xffac('0x32')]=_0x5d9adc;if(_0x16ed6e[_0xffac('0x45')]['includeAll']){_0x5ceb8f[_0xffac('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0xffac('0x53')](_0x5ceb8f);})[_0xffac('0x3a')](function(_0x1dab47){_0x2ea828[_0xffac('0x54')]=_0x1dab47;return _0x2ea828;})[_0xffac('0x3a')](respondWithFilteredResult(_0x3d802d,_0x5ceb8f))[_0xffac('0x2e')](handleError(_0x3d802d,null));};exports['show']=function(_0x2ab61b,_0x3d36c3){var _0x4efdf4={'raw':!![],'where':{'id':_0x2ab61b[_0xffac('0x55')]['id']}},_0x1cd15f={};_0x1cd15f['model']=_['keys'](db['FaxMessage']['rawAttributes']);_0x1cd15f[_0xffac('0x45')]=_[_0xffac('0x56')](_0x2ab61b['query']);_0x1cd15f[_0xffac('0x4c')]=_[_0xffac('0x47')](_0x1cd15f[_0xffac('0x43')],_0x1cd15f[_0xffac('0x45')]);_0x4efdf4[_0xffac('0x46')]=_['intersection'](_0x1cd15f[_0xffac('0x43')],qs[_0xffac('0x57')](_0x2ab61b[_0xffac('0x45')]['fields']));_0x4efdf4[_0xffac('0x46')]=_0x4efdf4[_0xffac('0x46')][_0xffac('0x48')]?_0x4efdf4[_0xffac('0x46')]:_0x1cd15f['model'];if(_0x2ab61b[_0xffac('0x45')][_0xffac('0x58')]){_0x4efdf4[_0xffac('0x52')]=[{'all':!![]}];}_0x4efdf4=_[_0xffac('0x50')]({},_0x4efdf4,_0x2ab61b[_0xffac('0x51')]);return db[_0xffac('0x40')][_0xffac('0x59')](_0x4efdf4)[_0xffac('0x3a')](handleEntityNotFound(_0x3d36c3,null))['then'](respondWithResult(_0x3d36c3,null))[_0xffac('0x2e')](handleError(_0x3d36c3,null));};exports[_0xffac('0x39')]=function(_0x5b3891,_0x545215){if(_0x5b3891[_0xffac('0x5a')]['id']){delete _0x5b3891[_0xffac('0x5a')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x5b3891['params']['id']}})['then'](handleEntityNotFound(_0x545215,null))[_0xffac('0x3a')](saveUpdates(_0x5b3891[_0xffac('0x5a')],null))[_0xffac('0x3a')](respondWithResult(_0x545215,null))[_0xffac('0x2e')](handleError(_0x545215,null));};exports[_0xffac('0x5b')]=function(_0x200e61,_0x2497b1){return db['FaxMessage'][_0xffac('0x59')]({'where':{'id':_0x200e61[_0xffac('0x55')]['id']}})[_0xffac('0x3a')](handleEntityNotFound(_0x2497b1,null))['then'](removeEntity(_0x2497b1,null))['catch'](handleError(_0x2497b1,null));};exports[_0xffac('0x5c')]=function(_0x46114c,_0x368f57){return db[_0xffac('0x40')]['describe']()[_0xffac('0x3a')](respondWithResult(_0x368f57,null))[_0xffac('0x2e')](handleError(_0x368f57,null));};var interaction_log=require('../../config/logger')(_0xffac('0x5d'));exports[_0xffac('0x5e')]=function(_0x28ef22,_0x1c203e,_0x3992a4){var _0x40aebb={'channel':_0xffac('0x5f')};if(_0x28ef22['body']['id']){delete _0x28ef22[_0xffac('0x5a')]['id'];}_0x28ef22[_0xffac('0x5a')][_0xffac('0x60')]=!![];_0x28ef22[_0xffac('0x5a')]['readAt']=moment()[_0xffac('0x61')](_0xffac('0x62'));_0x28ef22[_0xffac('0x5a')][_0xffac('0x63')]=_0x28ef22['body'][_0xffac('0x63')]||_0x28ef22[_0xffac('0x64')]['id'];return db[_0xffac('0x40')][_0xffac('0x59')]({'where':{'id':_0x28ef22[_0xffac('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xffac('0x65')],'as':_0xffac('0x66')}]})[_0xffac('0x3a')](handleEntityNotFound(_0x1c203e,null))[_0xffac('0x3a')](saveUpdates(_0x28ef22['body'],null))[_0xffac('0x3a')](function(_0x2a29b7){if(_0x2a29b7){_0x40aebb[_0xffac('0x2d')]=_0x2a29b7['get']({'plain':!![]});return db[_0xffac('0x67')][_0xffac('0x59')]({'where':{'id':_0x2a29b7[_0xffac('0x68')]}});}return null;})[_0xffac('0x3a')](handleEntityNotFound(_0x1c203e,null))[_0xffac('0x3a')](function(_0xece8ad){if(_0xece8ad){return _0xece8ad[_0xffac('0x39')]({'UserId':_0x28ef22[_0xffac('0x5a')]['UserId'],'read1stAt':_[_0xffac('0x69')](_0xece8ad[_0xffac('0x6a')])?moment()[_0xffac('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xffac('0x3a')](function(_0x1ea365){if(_0x1ea365){_0x40aebb[_0xffac('0x6b')]=_0x1ea365['get']({'plain':!![]});interaction_log['info'](_0xffac('0x6c'),_0x28ef22[_0xffac('0x64')]['id'],_0x28ef22[_0xffac('0x64')][_0xffac('0x3d')],_0x28ef22['user'][_0xffac('0x6d')],_0x40aebb[_0xffac('0x6b')]['id'],_0x28ef22[_0xffac('0x5a')]?JSON['stringify'](_0x28ef22[_0xffac('0x5a')]):'null');return respondWithRpcPromise(_0xffac('0x6e'),'acceptMessage',_0x40aebb);}return null;})[_0xffac('0x3a')](function(_0x20b84b){if(_0x20b84b){if(_0x28ef22[_0xffac('0x5a')]['manual']){_0x40aebb[_0xffac('0x2d')][_0xffac('0x6f')]=util[_0xffac('0x61')](_0xffac('0x70'),_0x28ef22[_0xffac('0x64')][_0xffac('0x3d')]);_0x40aebb[_0xffac('0x2d')]['channel']=_0x40aebb[_0xffac('0x71')];_0x40aebb[_0xffac('0x2d')][_0xffac('0x72')]=_0xffac('0x5e');return respondWithRpcPromise('EventManager',_0xffac('0x73'),{'event':_0xffac('0x74'),'message':_0x40aebb[_0xffac('0x2d')]},client9002)[_0xffac('0x3a')](function(){return _0x40aebb;});}return _0x40aebb;}return null;})[_0xffac('0x3a')](respondWithResult(_0x1c203e,null))[_0xffac('0x2e')](handleError(_0x1c203e,null));};var interaction_log=require(_0xffac('0x17'))(_0xffac('0x5d'));exports['reject']=function(_0x53beff,_0x4be71c,_0x23899f){var _0x466be1={'agent':{},'channel':_0xffac('0x5f')};if(_0x53beff[_0xffac('0x5a')]['id']){delete _0x53beff[_0xffac('0x5a')]['id'];}_0x53beff[_0xffac('0x5a')][_0xffac('0x63')]=_0x53beff['body'][_0xffac('0x63')]||_0x53beff[_0xffac('0x64')]['id'];_0x466be1['agent']['id']=_0x53beff['body'][_0xffac('0x63')];return db['FaxMessage'][_0xffac('0x59')]({'where':{'id':_0x53beff[_0xffac('0x55')]['id'],'UserId':null}})[_0xffac('0x3a')](handleEntityNotFound(_0x4be71c,null))[_0xffac('0x3a')](function(_0x387f82){if(_0x387f82){_0x466be1['message']=_0x387f82[_0xffac('0x75')]({'plain':!![]});return db[_0xffac('0x67')][_0xffac('0x59')]({'where':{'id':_0x387f82[_0xffac('0x68')]}});}return null;})[_0xffac('0x3a')](handleEntityNotFound(_0x4be71c,null))[_0xffac('0x3a')](function(_0x33e18f){if(_0x33e18f){_0x466be1[_0xffac('0x6b')]=_0x33e18f[_0xffac('0x75')]({'plain':!![]});interaction_log['info'](_0xffac('0x76'),_0x53beff[_0xffac('0x64')]['id'],_0x53beff[_0xffac('0x64')][_0xffac('0x3d')],_0x53beff[_0xffac('0x64')][_0xffac('0x6d')],_0x466be1['interaction']['id'],_0x53beff[_0xffac('0x5a')]?JSON['stringify'](_0x53beff[_0xffac('0x5a')]):_0xffac('0x77'));return respondWithRpcPromise('RejectMessage',_0xffac('0x78'),_0x466be1);}return null;})[_0xffac('0x3a')](function(_0xc216e1){if(_0xc216e1){_0xc216e1['message'][_0xffac('0x6f')]=util[_0xffac('0x61')](_0xffac('0x70'),_0x53beff['user'][_0xffac('0x3d')]);_0xc216e1[_0xffac('0x2d')]['channel']=_0x466be1[_0xffac('0x71')];_0xc216e1['message'][_0xffac('0x72')]='reject';respondWithRpcPromise('EventManager',_0xffac('0x73'),{'event':_0xffac('0x79'),'message':_0xc216e1[_0xffac('0x2d')]},client9002);return _0x466be1;}return null;})[_0xffac('0x3a')](respondWithResult(_0x4be71c,null))[_0xffac('0x2e')](handleError(_0x4be71c,null));};exports[_0xffac('0x7a')]=function(_0x4f972f,_0x3b7d04){var _0x4a497e;return db[_0xffac('0x40')][_0xffac('0x7a')](_0x4f972f[_0xffac('0x5a')],{})[_0xffac('0x3a')](function(_0x13fdb4){_0x4a497e=_0x13fdb4;return db[_0xffac('0x65')]['findOne']({'where':{'id':_0x4a497e[_0xffac('0x7b')]}});})[_0xffac('0x3a')](function(_0x53956d){if(_[_0xffac('0x69')](_0x53956d)){return;}else{_0x4a497e[_0xffac('0x5f')]=_0x53956d[_0xffac('0x5f')];return db[_0xffac('0x7c')][_0xffac('0x7d')]({'where':{'id':_0x4a497e[_0xffac('0x7e')]}});}})[_0xffac('0x3a')](function(_0x2970b0){return respondWithRpcPromise('SendFax',_0xffac('0x7f'),{'FaxAccountId':_[_0xffac('0x69')](_0x4f972f[_0xffac('0x5a')])?undefined:_0x4f972f['body'][_0xffac('0x80')],'path':_[_0xffac('0x69')](_0x2970b0)?undefined:util[_0xffac('0x61')]('/var/opt/motion2/server/files/attachments/%s',_0x2970b0[_0xffac('0x81')]),'fax':_[_0xffac('0x69')](_0x4a497e[_0xffac('0x5f')])?undefined:_0x4a497e[_0xffac('0x5f')],'AttachmentId':_0x4a497e['AttachmentId']},client9002);})[_0xffac('0x3a')](respondWithResult(_0x3b7d04,0xc9))['catch'](handleError(_0x3b7d04,null));};exports['download']=function(_0x3d0336,_0x11b278){var _0x432109=path[_0xffac('0x82')](config['root'],_0xffac('0x83'),_0xffac('0x84'),'attachments');return db['FaxMessage'][_0xffac('0x59')]({'where':{'id':_0x3d0336[_0xffac('0x55')]['id']},'include':[{'model':db[_0xffac('0x7c')],'as':_0xffac('0x7c')}]})['then'](handleEntityNotFound(_0x11b278,null))[_0xffac('0x3a')](function(_0x163a78){if(_0x163a78){return _0x11b278['download'](path[_0xffac('0x82')](_0x432109,_0x163a78[_0xffac('0x7c')]['basename']));}})[_0xffac('0x2e')](handleError(_0x11b278,null));}; \ No newline at end of file +var _0x5f09=['interface','SIP/%s','event','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','download','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','FaxMessage','includeAll','include','findAll','rows','show','params','rawAttributes','options','body','find','describe','fax-interactions','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','AcceptMessage','acceptMessage','manual','channel','accept','EventManager','acceptmessage','agent','info','null','rejectMessage'];(function(_0x4d639e,_0x3751bd){var _0xc52993=function(_0x2f6de2){while(--_0x2f6de2){_0x4d639e['push'](_0x4d639e['shift']());}};_0xc52993(++_0x3751bd);}(_0x5f09,0x124));var _0x95f0=function(_0x4ac1ed,_0x4e89a5){_0x4ac1ed=_0x4ac1ed-0x0;var _0x1a2eea=_0x5f09[_0x4ac1ed];return _0x1a2eea;};'use strict';var pdf=require(_0x95f0('0x0'));var emlformat=require(_0x95f0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x95f0('0x2'));var jsonpatch=require(_0x95f0('0x3'));var rp=require(_0x95f0('0x4'));var moment=require(_0x95f0('0x5'));var BPromise=require(_0x95f0('0x6'));var Mustache=require(_0x95f0('0x7'));var util=require('util');var path=require(_0x95f0('0x8'));var sox=require(_0x95f0('0x9'));var csv=require('to-csv');var ejs=require(_0x95f0('0xa'));var fs=require('fs');var _=require(_0x95f0('0xb'));var squel=require('squel');var crypto=require(_0x95f0('0xc'));var jsforce=require(_0x95f0('0xd'));var deskjs=require(_0x95f0('0xe'));var toCsv=require(_0x95f0('0xf'));var querystring=require(_0x95f0('0x10'));var Papa=require(_0x95f0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x95f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95f0('0x13'));var logger=require(_0x95f0('0x14'))(_0x95f0('0x15'));var utils=require('../../config/utils');var config=require(_0x95f0('0x16'));var db=require(_0x95f0('0x17'))['db'];config[_0x95f0('0x18')]=_[_0x95f0('0x19')](config[_0x95f0('0x18')],{'host':_0x95f0('0x1a'),'port':0x18eb});var socket=require(_0x95f0('0x1b'))(new Redis(config[_0x95f0('0x18')]));require(_0x95f0('0x1c'))[_0x95f0('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x95f0('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0x95f0('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x4b9935,_0x407e2a,_0x2979ae){if(_0x2979ae){var _0x4397ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4397ad[_0x95f0('0x20')](_0x407e2a)){return _0x4b9935;}else{throw new db[(_0x95f0('0x21'))]['ValidationError'](_0x95f0('0x22'));}}else{return _0x4b9935;}}function respondWithRpcPromise(_0x1f0cc4,_0x3ff0e6,_0x276035,_0x3845c7){return new BPromise(function(_0x166999,_0x3b9c90){var _0x267700=_0x3845c7||client;return _0x267700[_0x95f0('0x23')](_0x1f0cc4,_0x276035)[_0x95f0('0x24')](function(_0x3a71bf){logger['info'](_0x95f0('0x25'),_0x3ff0e6,_0x95f0('0x26'));logger['debug'](_0x95f0('0x27'),_0x3ff0e6,'request\x20sent',JSON['stringify'](_0x3a71bf));if(_0x3a71bf[_0x95f0('0x28')]){if(_0x3a71bf['error']['code']===0x1f4){logger[_0x95f0('0x28')](_0x95f0('0x25'),_0x3ff0e6,_0x3a71bf['error']['message']);return _0x3b9c90(_0x3a71bf[_0x95f0('0x28')][_0x95f0('0x29')]);}logger[_0x95f0('0x28')](_0x95f0('0x25'),_0x3ff0e6,_0x3a71bf[_0x95f0('0x28')]['message']);return _0x166999(_0x3a71bf['error'][_0x95f0('0x29')]);}else{logger['info'](_0x95f0('0x25'),_0x3ff0e6,_0x95f0('0x26'));_0x166999(_0x3a71bf[_0x95f0('0x2a')][_0x95f0('0x29')]);}})[_0x95f0('0x2b')](function(_0x3dbae2){logger[_0x95f0('0x28')](_0x95f0('0x25'),_0x3ff0e6,_0x3dbae2);_0x3b9c90(_0x3dbae2);});});}function respondWithStatusCode(_0x3188bc,_0x1a4d89){_0x1a4d89=_0x1a4d89||0xcc;return function(_0x165275){if(_0x165275){return _0x3188bc['sendStatus'](_0x1a4d89);}return _0x3188bc[_0x95f0('0x2c')](_0x1a4d89)[_0x95f0('0x2d')]();};}function respondWithResult(_0x27e368,_0x1f712c){_0x1f712c=_0x1f712c||0xc8;return function(_0x2d913e){if(_0x2d913e){return _0x27e368[_0x95f0('0x2c')](_0x1f712c)[_0x95f0('0x2e')](_0x2d913e);}};}function respondWithFilteredResult(_0x22046a,_0x140dbb){return function(_0x2d94c0){if(_0x2d94c0){var _0x3114ae=_0x2d94c0[_0x95f0('0x2f')],_0x53ac90=_0x140dbb[_0x95f0('0x30')],_0x2b35ac=_0x140dbb[_0x95f0('0x30')]+_0x140dbb['limit'],_0x430f17;if(_0x2b35ac>=_0x3114ae){_0x2b35ac=_0x3114ae;_0x430f17=0xc8;}else{_0x430f17=0xce;}_0x22046a[_0x95f0('0x2c')](_0x430f17);return _0x22046a[_0x95f0('0x31')](_0x95f0('0x32'),_0x53ac90+'-'+_0x2b35ac+'/'+_0x3114ae)[_0x95f0('0x2e')](_0x2d94c0);}return null;};}function patchUpdates(_0x1a16a4){return function(_0x5cc10a){try{jsonpatch[_0x95f0('0x33')](_0x5cc10a,_0x1a16a4,!![]);}catch(_0x2a30cb){return BPromise[_0x95f0('0x34')](_0x2a30cb);}return _0x5cc10a[_0x95f0('0x35')]();};}function saveUpdates(_0x21a453,_0x12e398){return function(_0x3eafc6){if(_0x3eafc6){return _0x3eafc6[_0x95f0('0x36')](_0x21a453)[_0x95f0('0x24')](function(_0x1d04e5){return _0x1d04e5;});}return null;};}function removeEntity(_0x522747,_0x3c31ce){return function(_0x5dc0a3){if(_0x5dc0a3){return _0x5dc0a3[_0x95f0('0x37')]()['then'](function(){_0x522747[_0x95f0('0x2c')](0xcc)[_0x95f0('0x2d')]();});}};}function handleEntityNotFound(_0x448c09,_0x4d0216){return function(_0x1ec675){if(!_0x1ec675){_0x448c09[_0x95f0('0x38')](0x194);}return _0x1ec675;};}function handleError(_0x104f04,_0x2e2832){_0x2e2832=_0x2e2832||0x1f4;return function(_0x33dccd){logger['error'](_0x33dccd[_0x95f0('0x39')]);if(_0x33dccd[_0x95f0('0x3a')]){delete _0x33dccd[_0x95f0('0x3a')];}_0x104f04[_0x95f0('0x2c')](_0x2e2832)[_0x95f0('0x3b')](_0x33dccd);};}exports[_0x95f0('0x3c')]=function(_0x5a2b4e,_0x311f46){var _0x1aebf2={},_0x9c62a4={},_0x378f81={'count':0x0,'rows':[]};var _0x2548f8=_[_0x95f0('0x3d')](db['FaxMessage']['rawAttributes'],function(_0x1fb34e){return{'name':_0x1fb34e[_0x95f0('0x3e')],'type':_0x1fb34e[_0x95f0('0x3f')][_0x95f0('0x40')]};});_0x9c62a4['model']=_[_0x95f0('0x3d')](_0x2548f8,_0x95f0('0x3a'));_0x9c62a4[_0x95f0('0x41')]=_[_0x95f0('0x42')](_0x5a2b4e[_0x95f0('0x41')]);_0x9c62a4['filters']=_[_0x95f0('0x43')](_0x9c62a4['model'],_0x9c62a4['query']);_0x1aebf2[_0x95f0('0x44')]=_[_0x95f0('0x43')](_0x9c62a4[_0x95f0('0x45')],qs[_0x95f0('0x46')](_0x5a2b4e['query']['fields']));_0x1aebf2[_0x95f0('0x44')]=_0x1aebf2[_0x95f0('0x44')][_0x95f0('0x47')]?_0x1aebf2[_0x95f0('0x44')]:_0x9c62a4[_0x95f0('0x45')];if(!_0x5a2b4e[_0x95f0('0x41')]['hasOwnProperty'](_0x95f0('0x48'))){_0x1aebf2[_0x95f0('0x49')]=qs[_0x95f0('0x49')](_0x5a2b4e[_0x95f0('0x41')][_0x95f0('0x49')]);_0x1aebf2[_0x95f0('0x30')]=qs[_0x95f0('0x30')](_0x5a2b4e['query'][_0x95f0('0x30')]);}_0x1aebf2[_0x95f0('0x4a')]=qs[_0x95f0('0x4b')](_0x5a2b4e['query'][_0x95f0('0x4b')]);_0x1aebf2[_0x95f0('0x4c')]=qs[_0x95f0('0x4d')](_['pick'](_0x5a2b4e[_0x95f0('0x41')],_0x9c62a4[_0x95f0('0x4d')]),_0x2548f8);if(_0x5a2b4e['query'][_0x95f0('0x4e')]){_0x1aebf2['where']=_[_0x95f0('0x4f')](_0x1aebf2[_0x95f0('0x4c')],{'$or':_[_0x95f0('0x3d')](_0x2548f8,function(_0x5accca){if(_0x5accca[_0x95f0('0x3f')]!==_0x95f0('0x50')){var _0x388233={};_0x388233[_0x5accca[_0x95f0('0x3a')]]={'$like':'%'+_0x5a2b4e[_0x95f0('0x41')][_0x95f0('0x4e')]+'%'};return _0x388233;}})});}_0x1aebf2=_[_0x95f0('0x4f')]({},_0x1aebf2,_0x5a2b4e['options']);var _0x2a7fbb={'where':_0x1aebf2[_0x95f0('0x4c')]};return db[_0x95f0('0x51')][_0x95f0('0x2f')](_0x2a7fbb)[_0x95f0('0x24')](function(_0x1c7dd3){_0x378f81[_0x95f0('0x2f')]=_0x1c7dd3;if(_0x5a2b4e[_0x95f0('0x41')][_0x95f0('0x52')]){_0x1aebf2[_0x95f0('0x53')]=[{'all':!![]}];}return db[_0x95f0('0x51')][_0x95f0('0x54')](_0x1aebf2);})[_0x95f0('0x24')](function(_0x4b3de3){_0x378f81[_0x95f0('0x55')]=_0x4b3de3;return _0x378f81;})[_0x95f0('0x24')](respondWithFilteredResult(_0x311f46,_0x1aebf2))[_0x95f0('0x2b')](handleError(_0x311f46,null));};exports[_0x95f0('0x56')]=function(_0x21dc3f,_0xd1027){var _0x12daa5={'raw':!![],'where':{'id':_0x21dc3f[_0x95f0('0x57')]['id']}},_0xe97fd3={};_0xe97fd3[_0x95f0('0x45')]=_[_0x95f0('0x42')](db[_0x95f0('0x51')][_0x95f0('0x58')]);_0xe97fd3[_0x95f0('0x41')]=_[_0x95f0('0x42')](_0x21dc3f['query']);_0xe97fd3['filters']=_['intersection'](_0xe97fd3['model'],_0xe97fd3['query']);_0x12daa5[_0x95f0('0x44')]=_[_0x95f0('0x43')](_0xe97fd3[_0x95f0('0x45')],qs[_0x95f0('0x46')](_0x21dc3f[_0x95f0('0x41')][_0x95f0('0x46')]));_0x12daa5[_0x95f0('0x44')]=_0x12daa5[_0x95f0('0x44')][_0x95f0('0x47')]?_0x12daa5['attributes']:_0xe97fd3[_0x95f0('0x45')];if(_0x21dc3f[_0x95f0('0x41')]['includeAll']){_0x12daa5[_0x95f0('0x53')]=[{'all':!![]}];}_0x12daa5=_[_0x95f0('0x4f')]({},_0x12daa5,_0x21dc3f[_0x95f0('0x59')]);return db['FaxMessage']['find'](_0x12daa5)[_0x95f0('0x24')](handleEntityNotFound(_0xd1027,null))[_0x95f0('0x24')](respondWithResult(_0xd1027,null))[_0x95f0('0x2b')](handleError(_0xd1027,null));};exports[_0x95f0('0x36')]=function(_0x454b08,_0xaeaa52){if(_0x454b08[_0x95f0('0x5a')]['id']){delete _0x454b08['body']['id'];}return db['FaxMessage'][_0x95f0('0x5b')]({'where':{'id':_0x454b08[_0x95f0('0x57')]['id']}})[_0x95f0('0x24')](handleEntityNotFound(_0xaeaa52,null))[_0x95f0('0x24')](saveUpdates(_0x454b08[_0x95f0('0x5a')],null))[_0x95f0('0x24')](respondWithResult(_0xaeaa52,null))['catch'](handleError(_0xaeaa52,null));};exports['destroy']=function(_0x468c6d,_0x2ff901){return db[_0x95f0('0x51')][_0x95f0('0x5b')]({'where':{'id':_0x468c6d['params']['id']}})[_0x95f0('0x24')](handleEntityNotFound(_0x2ff901,null))['then'](removeEntity(_0x2ff901,null))[_0x95f0('0x2b')](handleError(_0x2ff901,null));};exports[_0x95f0('0x5c')]=function(_0x5e5602,_0x248ba6){return db['FaxMessage'][_0x95f0('0x5c')]()[_0x95f0('0x24')](respondWithResult(_0x248ba6,null))[_0x95f0('0x2b')](handleError(_0x248ba6,null));};var interaction_log=require(_0x95f0('0x14'))(_0x95f0('0x5d'));exports['accept']=function(_0x58fc2c,_0x4c2c10,_0x564402){var _0x60ed94={'channel':_0x95f0('0x5e')};if(_0x58fc2c[_0x95f0('0x5a')]['id']){delete _0x58fc2c[_0x95f0('0x5a')]['id'];}_0x58fc2c['body']['read']=!![];_0x58fc2c['body'][_0x95f0('0x5f')]=moment()['format'](_0x95f0('0x60'));_0x58fc2c[_0x95f0('0x5a')][_0x95f0('0x61')]=_0x58fc2c['body'][_0x95f0('0x61')]||_0x58fc2c['user']['id'];return db[_0x95f0('0x51')][_0x95f0('0x5b')]({'where':{'id':_0x58fc2c[_0x95f0('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x95f0('0x62')],'as':_0x95f0('0x63')}]})[_0x95f0('0x24')](handleEntityNotFound(_0x4c2c10,null))['then'](saveUpdates(_0x58fc2c[_0x95f0('0x5a')],null))[_0x95f0('0x24')](function(_0x177b22){if(_0x177b22){_0x60ed94[_0x95f0('0x29')]=_0x177b22[_0x95f0('0x64')]({'plain':!![]});return db[_0x95f0('0x65')][_0x95f0('0x5b')]({'where':{'id':_0x177b22[_0x95f0('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x4c2c10,null))[_0x95f0('0x24')](function(_0x20651d){if(_0x20651d){return _0x20651d[_0x95f0('0x36')]({'UserId':_0x58fc2c[_0x95f0('0x5a')][_0x95f0('0x61')],'read1stAt':_[_0x95f0('0x67')](_0x20651d[_0x95f0('0x68')])?moment()[_0x95f0('0x69')](_0x95f0('0x60')):undefined});}return null;})['then'](function(_0x1fde43){if(_0x1fde43){_0x60ed94['interaction']=_0x1fde43[_0x95f0('0x64')]({'plain':!![]});interaction_log['info'](_0x95f0('0x6a'),_0x58fc2c[_0x95f0('0x6b')]['id'],_0x58fc2c[_0x95f0('0x6b')][_0x95f0('0x3a')],_0x58fc2c[_0x95f0('0x6b')][_0x95f0('0x6c')],_0x60ed94[_0x95f0('0x6d')]['id'],_0x58fc2c[_0x95f0('0x5a')]?JSON[_0x95f0('0x6e')](_0x58fc2c['body']):'null');return respondWithRpcPromise(_0x95f0('0x6f'),_0x95f0('0x70'),_0x60ed94);}return null;})[_0x95f0('0x24')](function(_0x22348e){if(_0x22348e){if(_0x58fc2c['body'][_0x95f0('0x71')]){_0x60ed94[_0x95f0('0x29')]['interface']=util[_0x95f0('0x69')]('SIP/%s',_0x58fc2c['user']['name']);_0x60ed94['message']['channel']=_0x60ed94[_0x95f0('0x72')];_0x60ed94[_0x95f0('0x29')]['event']=_0x95f0('0x73');return respondWithRpcPromise(_0x95f0('0x74'),'EventManager',{'event':_0x95f0('0x75'),'message':_0x60ed94[_0x95f0('0x29')]},client9002)['then'](function(){return _0x60ed94;});}return _0x60ed94;}return null;})[_0x95f0('0x24')](respondWithResult(_0x4c2c10,null))[_0x95f0('0x2b')](handleError(_0x4c2c10,null));};var interaction_log=require('../../config/logger')(_0x95f0('0x5d'));exports[_0x95f0('0x34')]=function(_0x59af14,_0x12bd8d,_0x3e8a7d){var _0x56d51b={'agent':{},'channel':_0x95f0('0x5e')};if(_0x59af14[_0x95f0('0x5a')]['id']){delete _0x59af14[_0x95f0('0x5a')]['id'];}_0x59af14[_0x95f0('0x5a')]['UserId']=_0x59af14[_0x95f0('0x5a')][_0x95f0('0x61')]||_0x59af14[_0x95f0('0x6b')]['id'];_0x56d51b[_0x95f0('0x76')]['id']=_0x59af14[_0x95f0('0x5a')][_0x95f0('0x61')];return db[_0x95f0('0x51')][_0x95f0('0x5b')]({'where':{'id':_0x59af14[_0x95f0('0x57')]['id'],'UserId':null}})[_0x95f0('0x24')](handleEntityNotFound(_0x12bd8d,null))['then'](function(_0x27a4a7){if(_0x27a4a7){_0x56d51b[_0x95f0('0x29')]=_0x27a4a7[_0x95f0('0x64')]({'plain':!![]});return db[_0x95f0('0x65')][_0x95f0('0x5b')]({'where':{'id':_0x27a4a7[_0x95f0('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x12bd8d,null))['then'](function(_0x592f78){if(_0x592f78){_0x56d51b['interaction']=_0x592f78['get']({'plain':!![]});interaction_log[_0x95f0('0x77')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x59af14[_0x95f0('0x6b')]['id'],_0x59af14[_0x95f0('0x6b')][_0x95f0('0x3a')],_0x59af14[_0x95f0('0x6b')][_0x95f0('0x6c')],_0x56d51b['interaction']['id'],_0x59af14['body']?JSON[_0x95f0('0x6e')](_0x59af14[_0x95f0('0x5a')]):_0x95f0('0x78'));return respondWithRpcPromise('RejectMessage',_0x95f0('0x79'),_0x56d51b);}return null;})[_0x95f0('0x24')](function(_0x42d704){if(_0x42d704){_0x42d704[_0x95f0('0x29')][_0x95f0('0x7a')]=util[_0x95f0('0x69')](_0x95f0('0x7b'),_0x59af14[_0x95f0('0x6b')]['name']);_0x42d704['message'][_0x95f0('0x72')]=_0x56d51b[_0x95f0('0x72')];_0x42d704[_0x95f0('0x29')][_0x95f0('0x7c')]=_0x95f0('0x34');respondWithRpcPromise('EventManager',_0x95f0('0x74'),{'event':'rejectmessage','message':_0x42d704[_0x95f0('0x29')]},client9002);return _0x56d51b;}return null;})[_0x95f0('0x24')](respondWithResult(_0x12bd8d,null))['catch'](handleError(_0x12bd8d,null));};exports['create']=function(_0x4829fe,_0x37a12b){var _0x84feff;return db[_0x95f0('0x51')][_0x95f0('0x7d')](_0x4829fe[_0x95f0('0x5a')],{})['then'](function(_0x50cc54){_0x84feff=_0x50cc54;return db['CmContact'][_0x95f0('0x7e')]({'where':{'id':_0x84feff['ContactId']}});})[_0x95f0('0x24')](function(_0xe9ce94){if(_[_0x95f0('0x67')](_0xe9ce94)){return;}else{_0x84feff['fax']=_0xe9ce94['fax'];return db[_0x95f0('0x7f')]['findOne']({'where':{'id':_0x84feff[_0x95f0('0x80')]}});}})[_0x95f0('0x24')](function(_0x56f56c){return respondWithRpcPromise(_0x95f0('0x81'),'SendFax',{'FaxAccountId':_[_0x95f0('0x67')](_0x4829fe['body'])?undefined:_0x4829fe['body'][_0x95f0('0x82')],'path':_[_0x95f0('0x67')](_0x56f56c)?undefined:util[_0x95f0('0x69')](_0x95f0('0x83'),_0x56f56c[_0x95f0('0x84')]),'fax':_[_0x95f0('0x67')](_0x84feff[_0x95f0('0x5e')])?undefined:_0x84feff['fax'],'AttachmentId':_0x84feff[_0x95f0('0x80')]},client9002);})[_0x95f0('0x24')](respondWithResult(_0x37a12b,0xc9))[_0x95f0('0x2b')](handleError(_0x37a12b,null));};exports['download']=function(_0x3ede7f,_0x8f1b45){var _0x1f3253=path[_0x95f0('0x85')](config[_0x95f0('0x86')],_0x95f0('0x87'),'files',_0x95f0('0x88'));return db[_0x95f0('0x51')][_0x95f0('0x5b')]({'where':{'id':_0x3ede7f[_0x95f0('0x57')]['id']},'include':[{'model':db[_0x95f0('0x7f')],'as':'Attachment'}]})[_0x95f0('0x24')](handleEntityNotFound(_0x8f1b45,null))[_0x95f0('0x24')](function(_0x40de2b){if(_0x40de2b){return _0x8f1b45[_0x95f0('0x89')](path[_0x95f0('0x85')](_0x1f3253,_0x40de2b[_0x95f0('0x7f')]['basename']));}})[_0x95f0('0x2b')](handleError(_0x8f1b45,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 24e6dba..5667d78 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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x34e8,0x12c));var _0x834e=function(_0x3b8050,_0x4b2df4){_0x3b8050=_0x3b8050-0x0;var _0x5567d3=_0x34e8[_0x3b8050];return _0x5567d3;};'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 +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x5fc3[_0x4c1ec2];return _0x3f6f1c;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var FaxMessage=require(_0x35fc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){FaxMessageEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);FaxMessageEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 0d55bc2..083361c 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 _0x66bc=['out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','FaxMessage','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x66bc,0x113));var _0xc66b=function(_0x2c2baa,_0x10eca2){_0x2c2baa=_0x2c2baa-0x0;var _0x386019=_0x66bc[_0x2c2baa];return _0x386019;};'use strict';var _=require(_0xc66b('0x0'));var util=require('util');var logger=require(_0xc66b('0x1'))(_0xc66b('0x2'));var moment=require('moment');var BPromise=require(_0xc66b('0x3'));var rp=require(_0xc66b('0x4'));var fs=require('fs');var path=require(_0xc66b('0x5'));var rimraf=require(_0xc66b('0x6'));var config=require(_0xc66b('0x7'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x26f22a,_0x253f95){return _0x26f22a['define'](_0xc66b('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xc66b('0x9'),'fields':[_0xc66b('0xa')],'type':_0xc66b('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x29156a,_0x290ab2,_0x12f99c){var _0x2b8a4a=_0x26f22a['models'];var _0x260557=_0x29156a[_0xc66b('0xc')]({'plain':!![]});if(_0x260557[_0xc66b('0xd')]['toLowerCase']()==='in'||_0x260557['direction'][_0xc66b('0xe')]()===_0xc66b('0xf')&&!_0x260557[_0xc66b('0x10')]&&!_[_0xc66b('0x11')](_0x260557[_0xc66b('0x12')])){_0x2b8a4a[_0xc66b('0x13')][_0xc66b('0x14')]({'where':{'id':_0x260557[_0xc66b('0x15')]}})[_0xc66b('0x16')](function(_0x52e722){if(_0x52e722){_0x52e722[_0xc66b('0x17')]({'lastMsgAt':_0x260557[_0xc66b('0x18')],'lastMsgDirection':_0x260557[_0xc66b('0xd')][_0xc66b('0xe')]()});}})[_0xc66b('0x19')](function(_0x1063ea){console[_0xc66b('0x1a')](_0x1063ea);});}_0x12f99c();}},'charset':_0xc66b('0x1b'),'collate':_0xc66b('0x1c')});}; \ No newline at end of file +var _0x64bb=['direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','../../config/environment','exports','FaxMessage','fti_fax_messages','body','models','get'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x64bb,0x1ec));var _0xb64b=function(_0x327b1d,_0x400faf){_0x327b1d=_0x327b1d-0x0;var _0x1c0325=_0x64bb[_0x327b1d];return _0x1c0325;};'use strict';var _=require(_0xb64b('0x0'));var util=require('util');var logger=require(_0xb64b('0x1'))('api');var moment=require(_0xb64b('0x2'));var BPromise=require('bluebird');var rp=require(_0xb64b('0x3'));var fs=require('fs');var path=require(_0xb64b('0x4'));var rimraf=require('rimraf');var config=require(_0xb64b('0x5'));var attributes=require('./faxMessage.attributes');module[_0xb64b('0x6')]=function(_0x5e3390,_0x364f5c){return _0x5e3390['define'](_0xb64b('0x7'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xb64b('0x8'),'fields':[_0xb64b('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x553f0b,_0x36e057,_0x517370){var _0x281d7f=_0x5e3390[_0xb64b('0xa')];var _0x2ff17d=_0x553f0b[_0xb64b('0xb')]({'plain':!![]});if(_0x2ff17d[_0xb64b('0xc')][_0xb64b('0xd')]()==='in'||_0x2ff17d[_0xb64b('0xc')][_0xb64b('0xd')]()===_0xb64b('0xe')&&!_0x2ff17d[_0xb64b('0xf')]&&!_[_0xb64b('0x10')](_0x2ff17d[_0xb64b('0x11')])){_0x281d7f[_0xb64b('0x12')][_0xb64b('0x13')]({'where':{'id':_0x2ff17d[_0xb64b('0x14')]}})[_0xb64b('0x15')](function(_0x6e6040){if(_0x6e6040){_0x6e6040[_0xb64b('0x16')]({'lastMsgAt':_0x2ff17d[_0xb64b('0x17')],'lastMsgDirection':_0x2ff17d[_0xb64b('0xc')][_0xb64b('0xd')]()});}})[_0xb64b('0x18')](function(_0x30df13){console[_0xb64b('0x19')](_0x30df13);});}_0x517370();}},'charset':_0xb64b('0x1a'),'collate':_0xb64b('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 5791d4f..ff7eaf0 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 _0x4c33=['FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxMessage','create','body','options','raw','then','CreateFaxMessage','UpdateFaxMessage','update','where','attributes','limit','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x19b4bc,_0x19ff41){var _0x2f596c=function(_0x554cd0){while(--_0x554cd0){_0x19b4bc['push'](_0x19b4bc['shift']());}};_0x2f596c(++_0x19ff41);}(_0x4c33,0x1d9));var _0x34c3=function(_0x4f2523,_0x5c4a82){_0x4f2523=_0x4f2523-0x0;var _0x1b7191=_0x4c33[_0x4f2523];return _0x1b7191;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x34c3('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34c3('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x34c3('0x2'))(_0x34c3('0x3'));var config=require(_0x34c3('0x4'));var jayson=require(_0x34c3('0x5'));var client=jayson[_0x34c3('0x6')]['http']({'port':0x232a});config[_0x34c3('0x7')]=_[_0x34c3('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x34c3('0x9'))(new Redis(config['redis']));require(_0x34c3('0xa'))[_0x34c3('0xb')](socket);function respondWithRpcPromise(_0x2c6834,_0xecb2b8,_0x5b5bb9){return new BPromise(function(_0x3abe71,_0x5ae19e){return client[_0x34c3('0xc')](_0x2c6834,_0x5b5bb9)['then'](function(_0x3217f4){logger[_0x34c3('0xd')](_0x34c3('0xe'),_0xecb2b8,_0x34c3('0xf'));logger[_0x34c3('0x10')](_0x34c3('0x11'),_0xecb2b8,_0x34c3('0xf'),JSON[_0x34c3('0x12')](_0x3217f4));if(_0x3217f4[_0x34c3('0x13')]){if(_0x3217f4['error'][_0x34c3('0x14')]===0x1f4){logger[_0x34c3('0x13')]('FaxMessage,\x20%s,\x20%s',_0xecb2b8,_0x3217f4[_0x34c3('0x13')][_0x34c3('0x15')]);return _0x5ae19e(_0x3217f4[_0x34c3('0x13')][_0x34c3('0x15')]);}logger[_0x34c3('0x13')](_0x34c3('0xe'),_0xecb2b8,_0x3217f4['error'][_0x34c3('0x15')]);return _0x3abe71(_0x3217f4['error']['message']);}else{logger['info'](_0x34c3('0xe'),_0xecb2b8,'request\x20sent');_0x3abe71(_0x3217f4['result']['message']);}})[_0x34c3('0x16')](function(_0x368fb3){logger[_0x34c3('0x13')]('FaxMessage,\x20%s,\x20%s',_0xecb2b8,_0x368fb3);_0x5ae19e(_0x368fb3);});});}exports['CreateFaxMessage']=function(_0x217f7e){var _0x350998=this;return new Promise(function(_0x15dbe7,_0x1cc7f0){return db[_0x34c3('0x17')][_0x34c3('0x18')](_0x217f7e[_0x34c3('0x19')],{'raw':_0x217f7e[_0x34c3('0x1a')]?_0x217f7e[_0x34c3('0x1a')][_0x34c3('0x1b')]===undefined?!![]:![]:!![]})[_0x34c3('0x1c')](function(_0x140743){logger[_0x34c3('0xd')](_0x34c3('0x1d'),_0x217f7e);logger[_0x34c3('0x10')](_0x34c3('0x1d'),_0x217f7e,JSON[_0x34c3('0x12')](_0x140743));_0x15dbe7(_0x140743);})[_0x34c3('0x16')](function(_0x4f8468){logger[_0x34c3('0x13')]('CreateFaxMessage',_0x4f8468[_0x34c3('0x15')],_0x217f7e);_0x1cc7f0(_0x350998[_0x34c3('0x13')](0x1f4,_0x4f8468[_0x34c3('0x15')]));});});};exports[_0x34c3('0x1e')]=function(_0x25d5e2){var _0x5ece6b=this;return new Promise(function(_0x99b64c,_0x627d7c){return db[_0x34c3('0x17')][_0x34c3('0x1f')](_0x25d5e2[_0x34c3('0x19')],{'raw':_0x25d5e2['options']?_0x25d5e2[_0x34c3('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25d5e2[_0x34c3('0x1a')]?_0x25d5e2[_0x34c3('0x1a')][_0x34c3('0x20')]||null:null,'attributes':_0x25d5e2['options']?_0x25d5e2[_0x34c3('0x1a')][_0x34c3('0x21')]||null:null,'limit':_0x25d5e2[_0x34c3('0x1a')]?_0x25d5e2[_0x34c3('0x1a')][_0x34c3('0x22')]||null:null})[_0x34c3('0x1c')](function(_0x3b6711){logger['info']('UpdateFaxMessage',_0x25d5e2);logger['debug'](_0x34c3('0x1e'),_0x25d5e2,JSON[_0x34c3('0x12')](_0x3b6711));_0x99b64c(_0x3b6711);})[_0x34c3('0x16')](function(_0x22db01){logger['error'](_0x34c3('0x1e'),_0x22db01['message'],_0x25d5e2);_0x627d7c(_0x5ece6b[_0x34c3('0x13')](0x1f4,_0x22db01[_0x34c3('0x15')]));});});}; \ No newline at end of file +var _0x8ea4=['http','redis','defaults','localhost','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateFaxMessage','create','options','raw','stringify','update','where','attributes','limit','UpdateFaxMessage','lodash','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x8ea4,0x1b2));var _0x48ea=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x8ea4[_0x47e549];return _0x251374;};'use strict';var _=require(_0x48ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x48ea('0x1'));var rs=require(_0x48ea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x48ea('0x3'))(_0x48ea('0x4'));var config=require(_0x48ea('0x5'));var jayson=require(_0x48ea('0x6'));var client=jayson[_0x48ea('0x7')][_0x48ea('0x8')]({'port':0x232a});config[_0x48ea('0x9')]=_[_0x48ea('0xa')](config[_0x48ea('0x9')],{'host':_0x48ea('0xb'),'port':0x18eb});var socket=require(_0x48ea('0xc'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x48ea('0xd')](socket);function respondWithRpcPromise(_0x3f6f1f,_0xa209db,_0x55d55f){return new BPromise(function(_0x5e424c,_0x403a2a){return client['request'](_0x3f6f1f,_0x55d55f)[_0x48ea('0xe')](function(_0x47d370){logger[_0x48ea('0xf')](_0x48ea('0x10'),_0xa209db,_0x48ea('0x11'));logger[_0x48ea('0x12')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0xa209db,_0x48ea('0x11'),JSON['stringify'](_0x47d370));if(_0x47d370['error']){if(_0x47d370[_0x48ea('0x13')][_0x48ea('0x14')]===0x1f4){logger[_0x48ea('0x13')]('FaxMessage,\x20%s,\x20%s',_0xa209db,_0x47d370['error'][_0x48ea('0x15')]);return _0x403a2a(_0x47d370[_0x48ea('0x13')][_0x48ea('0x15')]);}logger[_0x48ea('0x13')]('FaxMessage,\x20%s,\x20%s',_0xa209db,_0x47d370['error']['message']);return _0x5e424c(_0x47d370[_0x48ea('0x13')][_0x48ea('0x15')]);}else{logger[_0x48ea('0xf')](_0x48ea('0x10'),_0xa209db,_0x48ea('0x11'));_0x5e424c(_0x47d370[_0x48ea('0x16')]['message']);}})[_0x48ea('0x17')](function(_0x1de16d){logger[_0x48ea('0x13')]('FaxMessage,\x20%s,\x20%s',_0xa209db,_0x1de16d);_0x403a2a(_0x1de16d);});});}exports[_0x48ea('0x18')]=function(_0x5eb8fb){var _0x362023=this;return new Promise(function(_0x192340,_0x4777e9){return db['FaxMessage'][_0x48ea('0x19')](_0x5eb8fb['body'],{'raw':_0x5eb8fb['options']?_0x5eb8fb[_0x48ea('0x1a')][_0x48ea('0x1b')]===undefined?!![]:![]:!![]})[_0x48ea('0xe')](function(_0x423ff0){logger['info'](_0x48ea('0x18'),_0x5eb8fb);logger[_0x48ea('0x12')](_0x48ea('0x18'),_0x5eb8fb,JSON[_0x48ea('0x1c')](_0x423ff0));_0x192340(_0x423ff0);})[_0x48ea('0x17')](function(_0x4d953e){logger[_0x48ea('0x13')](_0x48ea('0x18'),_0x4d953e[_0x48ea('0x15')],_0x5eb8fb);_0x4777e9(_0x362023[_0x48ea('0x13')](0x1f4,_0x4d953e[_0x48ea('0x15')]));});});};exports['UpdateFaxMessage']=function(_0xc0db9f){var _0x144fda=this;return new Promise(function(_0xcd26fc,_0x53a7a1){return db['FaxMessage'][_0x48ea('0x1d')](_0xc0db9f['body'],{'raw':_0xc0db9f[_0x48ea('0x1a')]?_0xc0db9f[_0x48ea('0x1a')][_0x48ea('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0db9f[_0x48ea('0x1a')]?_0xc0db9f[_0x48ea('0x1a')][_0x48ea('0x1e')]||null:null,'attributes':_0xc0db9f['options']?_0xc0db9f[_0x48ea('0x1a')][_0x48ea('0x1f')]||null:null,'limit':_0xc0db9f['options']?_0xc0db9f[_0x48ea('0x1a')][_0x48ea('0x20')]||null:null})[_0x48ea('0xe')](function(_0x5dfe68){logger[_0x48ea('0xf')]('UpdateFaxMessage',_0xc0db9f);logger[_0x48ea('0x12')]('UpdateFaxMessage',_0xc0db9f,JSON['stringify'](_0x5dfe68));_0xcd26fc(_0x5dfe68);})[_0x48ea('0x17')](function(_0x3da33b){logger[_0x48ea('0x13')](_0x48ea('0x21'),_0x3da33b['message'],_0xc0db9f);_0x53a7a1(_0x144fda['error'](0x1f4,_0x3da33b[_0x48ea('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index d79afe6..ab5d7b8 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3bf8752..f190ddc 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 _0x2fb2=['/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','download','tracked','create','update','/:id/accept','accept','put'];(function(_0x58efa6,_0x2c00bd){var _0x5d643c=function(_0x1d1ef2){while(--_0x1d1ef2){_0x58efa6['push'](_0x58efa6['shift']());}};_0x5d643c(++_0x2c00bd);}(_0x2fb2,0xc5));var _0x22fb=function(_0x184270,_0x30b091){_0x184270=_0x184270-0x0;var _0x16e988=_0x2fb2[_0x184270];return _0x16e988;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x22fb('0x0'));var timeout=require(_0x22fb('0x1'));var express=require(_0x22fb('0x2'));var router=express['Router']();var auth=require(_0x22fb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x22fb('0x4'));var controller=require('./faxMessage.controller');router[_0x22fb('0x5')]('/',auth[_0x22fb('0x6')](),controller[_0x22fb('0x7')]);router[_0x22fb('0x5')](_0x22fb('0x8'),auth[_0x22fb('0x6')](),controller[_0x22fb('0x9')]);router[_0x22fb('0x5')](_0x22fb('0xa'),auth[_0x22fb('0x6')](),controller[_0x22fb('0xb')]);router[_0x22fb('0x5')]('/:id/download',auth[_0x22fb('0x6')](),controller[_0x22fb('0xc')]);router['post']('/',auth[_0x22fb('0x6')](),interaction[_0x22fb('0xd')]('fax','faxmessage:create'),controller[_0x22fb('0xe')]);router['put'](_0x22fb('0xa'),auth[_0x22fb('0x6')](),controller[_0x22fb('0xf')]);router['put'](_0x22fb('0x10'),auth[_0x22fb('0x6')](),controller[_0x22fb('0x11')]);router[_0x22fb('0x12')](_0x22fb('0x13'),auth[_0x22fb('0x6')](),controller[_0x22fb('0x14')]);router[_0x22fb('0x15')](_0x22fb('0xa'),auth[_0x22fb('0x6')](),controller[_0x22fb('0x16')]);module[_0x22fb('0x17')]=router; \ No newline at end of file +var _0x0647=['isAuthenticated','index','/describe','/:id','/:id/download','download','post','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','./faxMessage.controller','get'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x0647,0xd0));var _0x7064=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x0647[_0x489b87];return _0x1823b6;};'use strict';var multer=require(_0x7064('0x0'));var util=require('util');var path=require(_0x7064('0x1'));var timeout=require(_0x7064('0x2'));var express=require(_0x7064('0x3'));var router=express[_0x7064('0x4')]();var auth=require(_0x7064('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7064('0x6'));router[_0x7064('0x7')]('/',auth[_0x7064('0x8')](),controller[_0x7064('0x9')]);router[_0x7064('0x7')](_0x7064('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7064('0x7')](_0x7064('0xb'),auth[_0x7064('0x8')](),controller['show']);router[_0x7064('0x7')](_0x7064('0xc'),auth['isAuthenticated'](),controller[_0x7064('0xd')]);router[_0x7064('0xe')]('/',auth[_0x7064('0x8')](),interaction['tracked'](_0x7064('0xf'),_0x7064('0x10')),controller[_0x7064('0x11')]);router[_0x7064('0x12')]('/:id',auth[_0x7064('0x8')](),controller[_0x7064('0x13')]);router[_0x7064('0x12')](_0x7064('0x14'),auth[_0x7064('0x8')](),controller[_0x7064('0x15')]);router[_0x7064('0x12')](_0x7064('0x16'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x7064('0xb'),auth[_0x7064('0x8')](),controller[_0x7064('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index cec7ecc..067debb 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 _0x2507=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x16fd18,_0x2ba7e1){var _0x35589d=function(_0x53be3f){while(--_0x53be3f){_0x16fd18['push'](_0x16fd18['shift']());}};_0x35589d(++_0x2ba7e1);}(_0x2507,0x6f));var _0x7250=function(_0x2f0414,_0x4cda2c){_0x2f0414=_0x2f0414-0x0;var _0xc72736=_0x2507[_0x2f0414];return _0xc72736;};'use strict';var Sequelize=require(_0x7250('0x0'));module[_0x7250('0x1')]={'name':{'type':Sequelize[_0x7250('0x2')],'unique':_0x7250('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7250('0x2')]},'timeout':{'type':Sequelize[_0x7250('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7250('0x5')](_0x7250('0x6'),_0x7250('0x7'),_0x7250('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x7250('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe999=['beepall','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0xe999,0x119));var _0x9e99=function(_0x5dd7f2,_0x5ab01d){_0x5dd7f2=_0x5dd7f2-0x0;var _0x454df3=_0xe999[_0x5dd7f2];return _0x454df3;};'use strict';var Sequelize=require(_0x9e99('0x0'));module[_0x9e99('0x1')]={'name':{'type':Sequelize[_0x9e99('0x2')],'unique':_0x9e99('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9e99('0x2')]},'timeout':{'type':Sequelize[_0x9e99('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9e99('0x5'),_0x9e99('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9e99('0x4')],'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 d301724..439fc58 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 _0x8307=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','FaxQueueId','findAndCountAll','UserId','agent','faxPause','createdAt','format','SIP','updatedAt','getTeams','findOne','Team','addTeams','User','online','voicePause','flatMap','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','Agents','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','getAgents','options','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','FaxQueues','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId'];(function(_0x313b44,_0x435e01){var _0xdc1699=function(_0x3cdd9d){while(--_0x3cdd9d){_0x313b44['push'](_0x313b44['shift']());}};_0xdc1699(++_0x435e01);}(_0x8307,0xc4));var _0x7830=function(_0x22a33a,_0x4a7487){_0x22a33a=_0x22a33a-0x0;var _0x2d0a92=_0x8307[_0x22a33a];return _0x2d0a92;};'use strict';var pdf=require(_0x7830('0x0'));var emlformat=require(_0x7830('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7830('0x2'));var jsonpatch=require(_0x7830('0x3'));var rp=require(_0x7830('0x4'));var moment=require('moment');var BPromise=require(_0x7830('0x5'));var Mustache=require(_0x7830('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7830('0x7'));var csv=require('to-csv');var ejs=require(_0x7830('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7830('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7830('0xa'));var toCsv=require(_0x7830('0xb'));var querystring=require('querystring');var Papa=require(_0x7830('0xc'));var Redis=require(_0x7830('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7830('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7830('0xf'))(_0x7830('0x10'));var utils=require(_0x7830('0x11'));var config=require(_0x7830('0x12'));var db=require(_0x7830('0x13'))['db'];config[_0x7830('0x14')]=_[_0x7830('0x15')](config[_0x7830('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x7830('0x16'))(new Redis(config[_0x7830('0x14')]));require(_0x7830('0x17'))['register'](socket);function respondWithStatusCode(_0x4dd3e0,_0x5818f6){_0x5818f6=_0x5818f6||0xcc;return function(_0x405533){if(_0x405533){return _0x4dd3e0['sendStatus'](_0x5818f6);}return _0x4dd3e0[_0x7830('0x18')](_0x5818f6)[_0x7830('0x19')]();};}function respondWithResult(_0x29a4bd,_0x38906b){_0x38906b=_0x38906b||0xc8;return function(_0x12f0c8){if(_0x12f0c8){return _0x29a4bd[_0x7830('0x18')](_0x38906b)[_0x7830('0x1a')](_0x12f0c8);}};}function respondWithFilteredResult(_0x316fbe,_0x355c4e){return function(_0x39748e){if(_0x39748e){var _0x3bc49a=_0x39748e[_0x7830('0x1b')],_0x1b4e2a=_0x355c4e['offset'],_0xf5cda=_0x355c4e[_0x7830('0x1c')]+_0x355c4e[_0x7830('0x1d')],_0x12dca0;if(_0xf5cda>=_0x3bc49a){_0xf5cda=_0x3bc49a;_0x12dca0=0xc8;}else{_0x12dca0=0xce;}_0x316fbe[_0x7830('0x18')](_0x12dca0);return _0x316fbe[_0x7830('0x1e')](_0x7830('0x1f'),_0x1b4e2a+'-'+_0xf5cda+'/'+_0x3bc49a)[_0x7830('0x1a')](_0x39748e);}return null;};}function patchUpdates(_0x1eaf27){return function(_0x42ea90){try{jsonpatch['apply'](_0x42ea90,_0x1eaf27,!![]);}catch(_0xbfca57){return BPromise[_0x7830('0x20')](_0xbfca57);}return _0x42ea90[_0x7830('0x21')]();};}function saveUpdates(_0x152213,_0x3ab7d6){return function(_0x549151){if(_0x549151){return _0x549151[_0x7830('0x22')](_0x152213)[_0x7830('0x23')](function(_0x3da993){return _0x3da993;});}return null;};}function removeEntity(_0x56efc3,_0x2f69d3){return function(_0x4ef5ac){if(_0x4ef5ac){return _0x4ef5ac['destroy']()[_0x7830('0x23')](function(){var _0x2b7091=_0x4ef5ac[_0x7830('0x24')]({'plain':!![]});var _0x1fa035=_0x7830('0x25');return db[_0x7830('0x26')][_0x7830('0x27')]({'where':{'type':_0x1fa035,'resourceId':_0x2b7091['id']}})[_0x7830('0x23')](function(){return _0x4ef5ac;});})[_0x7830('0x23')](function(){_0x56efc3[_0x7830('0x18')](0xcc)[_0x7830('0x19')]();});}};}function handleEntityNotFound(_0x17b1c6,_0x5cbfc2){return function(_0x2cc55e){if(!_0x2cc55e){_0x17b1c6[_0x7830('0x28')](0x194);}return _0x2cc55e;};}function handleError(_0x555eab,_0x2a6018){_0x2a6018=_0x2a6018||0x1f4;return function(_0x3b6410){logger['error'](_0x3b6410[_0x7830('0x29')]);if(_0x3b6410[_0x7830('0x2a')]){delete _0x3b6410['name'];}_0x555eab[_0x7830('0x18')](_0x2a6018)[_0x7830('0x2b')](_0x3b6410);};}exports[_0x7830('0x2c')]=function(_0x12debf,_0x461fe){var _0x172bb7={},_0x4f798d={},_0x116fdd={'count':0x0,'rows':[]};var _0x3a5c9c=_[_0x7830('0x2d')](db[_0x7830('0x2e')][_0x7830('0x2f')],function(_0x1f3b8f){return{'name':_0x1f3b8f[_0x7830('0x30')],'type':_0x1f3b8f[_0x7830('0x31')][_0x7830('0x32')]};});_0x4f798d[_0x7830('0x33')]=_[_0x7830('0x2d')](_0x3a5c9c,_0x7830('0x2a'));_0x4f798d[_0x7830('0x34')]=_[_0x7830('0x35')](_0x12debf[_0x7830('0x34')]);_0x4f798d['filters']=_[_0x7830('0x36')](_0x4f798d[_0x7830('0x33')],_0x4f798d['query']);_0x172bb7[_0x7830('0x37')]=_['intersection'](_0x4f798d['model'],qs[_0x7830('0x38')](_0x12debf[_0x7830('0x34')][_0x7830('0x38')]));_0x172bb7[_0x7830('0x37')]=_0x172bb7[_0x7830('0x37')][_0x7830('0x39')]?_0x172bb7[_0x7830('0x37')]:_0x4f798d['model'];if(!_0x12debf[_0x7830('0x34')][_0x7830('0x3a')](_0x7830('0x3b'))){_0x172bb7[_0x7830('0x1d')]=qs[_0x7830('0x1d')](_0x12debf[_0x7830('0x34')]['limit']);_0x172bb7['offset']=qs[_0x7830('0x1c')](_0x12debf[_0x7830('0x34')][_0x7830('0x1c')]);}_0x172bb7[_0x7830('0x3c')]=qs[_0x7830('0x3d')](_0x12debf[_0x7830('0x34')][_0x7830('0x3d')]);_0x172bb7[_0x7830('0x3e')]=qs[_0x7830('0x3f')](_[_0x7830('0x40')](_0x12debf[_0x7830('0x34')],_0x4f798d[_0x7830('0x3f')]),_0x3a5c9c);if(_0x12debf[_0x7830('0x34')][_0x7830('0x41')]){_0x172bb7[_0x7830('0x3e')]=_[_0x7830('0x42')](_0x172bb7['where'],{'$or':_['map'](_0x3a5c9c,function(_0xf5170e){if(_0xf5170e[_0x7830('0x31')]!=='VIRTUAL'){var _0x266a27={};_0x266a27[_0xf5170e[_0x7830('0x2a')]]={'$like':'%'+_0x12debf['query'][_0x7830('0x41')]+'%'};return _0x266a27;}})});}_0x172bb7=_['merge']({},_0x172bb7,_0x12debf['options']);var _0x167411={'where':_0x172bb7['where']};return db['FaxQueue'][_0x7830('0x1b')](_0x167411)[_0x7830('0x23')](function(_0x65bcf2){_0x116fdd['count']=_0x65bcf2;if(_0x12debf[_0x7830('0x34')][_0x7830('0x43')]){_0x172bb7['include']=[{'all':!![]}];}return db[_0x7830('0x2e')][_0x7830('0x44')](_0x172bb7);})[_0x7830('0x23')](function(_0x5cce10){_0x116fdd[_0x7830('0x45')]=_0x5cce10;return _0x116fdd;})[_0x7830('0x23')](respondWithFilteredResult(_0x461fe,_0x172bb7))[_0x7830('0x46')](handleError(_0x461fe,null));};exports[_0x7830('0x47')]=function(_0x3bfaab,_0x525fcc){var _0x3f2a4a={'raw':!![],'where':{'id':_0x3bfaab[_0x7830('0x48')]['id']}},_0x2bcaf1={};_0x2bcaf1[_0x7830('0x33')]=_['keys'](db['FaxQueue'][_0x7830('0x2f')]);_0x2bcaf1[_0x7830('0x34')]=_[_0x7830('0x35')](_0x3bfaab[_0x7830('0x34')]);_0x2bcaf1[_0x7830('0x3f')]=_[_0x7830('0x36')](_0x2bcaf1[_0x7830('0x33')],_0x2bcaf1['query']);_0x3f2a4a[_0x7830('0x37')]=_[_0x7830('0x36')](_0x2bcaf1[_0x7830('0x33')],qs[_0x7830('0x38')](_0x3bfaab[_0x7830('0x34')][_0x7830('0x38')]));_0x3f2a4a[_0x7830('0x37')]=_0x3f2a4a['attributes'][_0x7830('0x39')]?_0x3f2a4a[_0x7830('0x37')]:_0x2bcaf1[_0x7830('0x33')];if(_0x3bfaab[_0x7830('0x34')][_0x7830('0x43')]){_0x3f2a4a[_0x7830('0x49')]=[{'all':!![]}];}_0x3f2a4a=_[_0x7830('0x42')]({},_0x3f2a4a,_0x3bfaab['options']);return db[_0x7830('0x2e')][_0x7830('0x4a')](_0x3f2a4a)['then'](handleEntityNotFound(_0x525fcc,null))[_0x7830('0x23')](respondWithResult(_0x525fcc,null))[_0x7830('0x46')](handleError(_0x525fcc,null));};exports[_0x7830('0x4b')]=function(_0x1e74e0,_0x269854){return db[_0x7830('0x2e')][_0x7830('0x4b')](_0x1e74e0[_0x7830('0x4c')],{})[_0x7830('0x23')](function(_0x357300){var _0x33076e=_0x1e74e0['user'][_0x7830('0x24')]({'plain':!![]});if(!_0x33076e)throw new Error(_0x7830('0x4d'));if(_0x33076e[_0x7830('0x4e')]===_0x7830('0x4f')){var _0x4d2ea4=_0x357300[_0x7830('0x24')]({'plain':!![]});var _0xe8c68d=_0x7830('0x25');return db[_0x7830('0x50')][_0x7830('0x4a')]({'where':{'name':_0xe8c68d,'userProfileId':_0x33076e[_0x7830('0x51')]},'raw':!![]})[_0x7830('0x23')](function(_0x4159be){if(_0x4159be&&_0x4159be['autoAssociation']===0x0){return db[_0x7830('0x26')][_0x7830('0x4b')]({'name':_0x4d2ea4[_0x7830('0x2a')],'resourceId':_0x4d2ea4['id'],'type':_0x4159be[_0x7830('0x2a')],'sectionId':_0x4159be['id']},{})[_0x7830('0x23')](function(){return _0x357300;});}else{return _0x357300;}})[_0x7830('0x46')](function(_0x334e7f){logger[_0x7830('0x52')](_0x7830('0x53'),_0x334e7f);throw _0x334e7f;});}return _0x357300;})[_0x7830('0x23')](respondWithResult(_0x269854,0xc9))[_0x7830('0x46')](handleError(_0x269854,null));};exports[_0x7830('0x22')]=function(_0x35f188,_0x7985bb){if(_0x35f188['body']['id']){delete _0x35f188[_0x7830('0x4c')]['id'];}return db[_0x7830('0x2e')]['find']({'where':{'id':_0x35f188[_0x7830('0x48')]['id']}})['then'](handleEntityNotFound(_0x7985bb,null))[_0x7830('0x23')](saveUpdates(_0x35f188[_0x7830('0x4c')],null))['then'](respondWithResult(_0x7985bb,null))[_0x7830('0x46')](handleError(_0x7985bb,null));};exports['destroy']=function(_0x56f554,_0x2e909c){return db[_0x7830('0x2e')][_0x7830('0x4a')]({'where':{'id':_0x56f554[_0x7830('0x48')]['id']}})[_0x7830('0x23')](handleEntityNotFound(_0x2e909c,null))[_0x7830('0x23')](removeEntity(_0x2e909c,null))[_0x7830('0x46')](handleError(_0x2e909c,null));};exports['describe']=function(_0x23162a,_0x3106fe){return db[_0x7830('0x2e')][_0x7830('0x54')]()[_0x7830('0x23')](respondWithResult(_0x3106fe,null))[_0x7830('0x46')](handleError(_0x3106fe,null));};exports[_0x7830('0x55')]=function(_0x139608,_0x42fef9,_0x19bb5c){var _0x2d20d6={'raw':!![],'where':{}},_0x15a633={},_0x9d9de4;return db[_0x7830('0x2e')]['findOne']({'where':{'id':_0x139608[_0x7830('0x48')]['id']}})[_0x7830('0x23')](handleEntityNotFound(_0x42fef9,null))['then'](function(_0x505238){if(_0x505238){_0x9d9de4=_0x505238['get']({'plain':!![]});_0x15a633[_0x7830('0x33')]=_[_0x7830('0x35')](db[_0x7830('0x56')]['rawAttributes']);_0x15a633[_0x7830('0x34')]=_['keys'](_0x139608[_0x7830('0x34')]);_0x15a633[_0x7830('0x3f')]=_[_0x7830('0x36')](_0x15a633[_0x7830('0x33')],_0x15a633[_0x7830('0x34')]);_0x2d20d6['attributes']=_[_0x7830('0x36')](_0x15a633[_0x7830('0x33')],qs[_0x7830('0x38')](_0x139608[_0x7830('0x34')][_0x7830('0x38')]));_0x2d20d6[_0x7830('0x37')]=_0x2d20d6['attributes'][_0x7830('0x39')]?_0x2d20d6['attributes']:_0x15a633[_0x7830('0x33')];if(!_0x139608[_0x7830('0x34')]['hasOwnProperty'](_0x7830('0x3b'))){_0x2d20d6['limit']=qs[_0x7830('0x1d')](_0x139608[_0x7830('0x34')][_0x7830('0x1d')]);_0x2d20d6[_0x7830('0x1c')]=qs[_0x7830('0x1c')](_0x139608[_0x7830('0x34')]['offset']);}_0x2d20d6[_0x7830('0x3c')]=qs[_0x7830('0x3d')](_0x139608[_0x7830('0x34')]['sort']);_0x2d20d6[_0x7830('0x3e')]=qs[_0x7830('0x3f')](_[_0x7830('0x40')](_0x139608[_0x7830('0x34')],_0x15a633[_0x7830('0x3f')]));_0x2d20d6[_0x7830('0x3e')][_0x7830('0x57')]=_0x505238['id'];if(_0x139608[_0x7830('0x34')][_0x7830('0x41')]){_0x2d20d6[_0x7830('0x3e')]=_['merge'](_0x2d20d6[_0x7830('0x3e')],{'$or':_[_0x7830('0x2d')](_0x2d20d6[_0x7830('0x37')],function(_0x43b768){var _0x51af6a={};_0x51af6a[_0x43b768]={'$like':'%'+_0x139608[_0x7830('0x34')][_0x7830('0x41')]+'%'};return _0x51af6a;})});}_0x2d20d6=_[_0x7830('0x42')]({},_0x2d20d6,_0x139608['options']);return db[_0x7830('0x56')][_0x7830('0x44')](_0x2d20d6);}})[_0x7830('0x23')](function(_0x3a0b0b){if(_0x3a0b0b){return db['User'][_0x7830('0x58')]({'where':{'id':_[_0x7830('0x2d')](_0x3a0b0b,_0x7830('0x59')),'role':_0x7830('0x5a')},'attributes':['id',_0x7830('0x2a'),_0x7830('0x5b'),'updatedAt',_0x7830('0x5c')]});}})[_0x7830('0x23')](function(_0x22c49e){if(_0x22c49e){return{'count':_0x22c49e[_0x7830('0x1b')],'rows':_[_0x7830('0x2d')](_0x22c49e['rows'],function(_0x4f231f){return{'membername':_0x4f231f[_0x7830('0x2a')],'UserId':_0x4f231f['id'],'queue_name':_0x9d9de4[_0x7830('0x2a')],'FaxQueueId':_0x9d9de4['id'],'interface':util[_0x7830('0x5d')]('%s/%s',_0x7830('0x5e'),_0x4f231f['name']),'penalty':0x0,'paused':_0x4f231f[_0x7830('0x5b')],'createdAt':_0x4f231f[_0x7830('0x5c')],'updatedAt':_0x4f231f[_0x7830('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7830('0x23')](respondWithFilteredResult(_0x42fef9,_0x2d20d6))['catch'](handleError(_0x42fef9,null));};exports[_0x7830('0x60')]=function(_0x4ff961,_0x88883f,_0x5415af){var _0x10ac8a={};var _0x4ec3c8={};var _0x276d9c;var _0x71b8a1;return db['FaxQueue'][_0x7830('0x61')]({'where':{'id':_0x4ff961['params']['id']}})[_0x7830('0x23')](handleEntityNotFound(_0x88883f,null))[_0x7830('0x23')](function(_0x263f33){if(_0x263f33){_0x276d9c=_0x263f33;_0x4ec3c8[_0x7830('0x33')]=_[_0x7830('0x35')](db[_0x7830('0x62')][_0x7830('0x2f')]);_0x4ec3c8[_0x7830('0x34')]=_[_0x7830('0x35')](_0x4ff961['query']);_0x4ec3c8[_0x7830('0x3f')]=_[_0x7830('0x36')](_0x4ec3c8['model'],_0x4ec3c8['query']);_0x10ac8a['attributes']=_[_0x7830('0x36')](_0x4ec3c8[_0x7830('0x33')],qs[_0x7830('0x38')](_0x4ff961[_0x7830('0x34')][_0x7830('0x38')]));_0x10ac8a[_0x7830('0x37')]=_0x10ac8a[_0x7830('0x37')]['length']?_0x10ac8a[_0x7830('0x37')]:_0x4ec3c8['model'];_0x10ac8a[_0x7830('0x3c')]=qs['sort'](_0x4ff961[_0x7830('0x34')][_0x7830('0x3d')]);_0x10ac8a[_0x7830('0x3e')]=qs[_0x7830('0x3f')](_['pick'](_0x4ff961[_0x7830('0x34')],_0x4ec3c8[_0x7830('0x3f')]));if(_0x4ff961[_0x7830('0x34')][_0x7830('0x41')]){_0x10ac8a[_0x7830('0x3e')]=_['merge'](_0x10ac8a['where'],{'$or':_[_0x7830('0x2d')](_0x10ac8a['attributes'],function(_0x580c18){var _0xe0f380={};_0xe0f380[_0x580c18]={'$like':'%'+_0x4ff961['query'][_0x7830('0x41')]+'%'};return _0xe0f380;})});}_0x10ac8a=_[_0x7830('0x42')]({},_0x10ac8a,_0x4ff961['options']);return _0x276d9c[_0x7830('0x60')](_0x10ac8a);}})['then'](function(_0x241a5f){if(_0x241a5f){_0x71b8a1=_0x241a5f['length'];if(!_0x4ff961[_0x7830('0x34')][_0x7830('0x3a')](_0x7830('0x3b'))){_0x10ac8a['limit']=qs[_0x7830('0x1d')](_0x4ff961[_0x7830('0x34')]['limit']);_0x10ac8a[_0x7830('0x1c')]=qs['offset'](_0x4ff961[_0x7830('0x34')][_0x7830('0x1c')]);}return _0x276d9c[_0x7830('0x60')](_0x10ac8a);}})['then'](function(_0x27afae){if(_0x27afae){return _0x27afae?{'count':_0x71b8a1,'rows':_0x27afae}:null;}})[_0x7830('0x23')](respondWithResult(_0x88883f,null))[_0x7830('0x46')](handleError(_0x88883f,null));};exports[_0x7830('0x63')]=function(_0x491d44,_0x57b9cb,_0x34aedd){var _0x246977=_0x491d44[_0x7830('0x4c')]['ids'];return db[_0x7830('0x62')][_0x7830('0x44')]({'where':{'id':_0x246977},'attributes':['id'],'include':[{'model':db[_0x7830('0x64')],'as':'Agents','attributes':['id','name',_0x7830('0x65'),_0x7830('0x66'),'interface'],'raw':!![]}]})[_0x7830('0x23')](function(_0x50fcd1){if(_0x50fcd1){var _0x48666d=_[_0x7830('0x67')](_0x50fcd1,function(_0x4dcfe6){var _0x3e16f8=_0x4dcfe6['get']({'plain':!![]});return _0x3e16f8['Agents'];});return db[_0x7830('0x2e')][_0x7830('0x4a')]({'where':{'id':_0x491d44['params']['id']}})['then'](function(_0x4c610b){return db['sequelize'][_0x7830('0x68')](function(_0x37a233){return _0x4c610b[_0x7830('0x63')](_0x246977,{'transaction':_0x37a233})[_0x7830('0x23')](function(){return BPromise['each'](_0x48666d,function(_0x361e9b){return db[_0x7830('0x56')][_0x7830('0x69')]({'where':{'UserId':_0x361e9b['id'],'FaxQueueId':_0x491d44[_0x7830('0x48')]['id']},'transaction':_0x37a233});});})[_0x7830('0x23')](function(){_0x48666d[_0x7830('0x6a')](function(_0xecdac8){socket[_0x7830('0x6b')](_0x7830('0x6c'),{'UserId':_0xecdac8['id'],'FaxQueueId':_0x4c610b['id']});});});});});}})['then'](respondWithStatusCode(_0x57b9cb,null))[_0x7830('0x46')](handleError(_0x57b9cb,null));};exports[_0x7830('0x6d')]=function(_0x68052,_0x3742fd,_0x130b01){return db[_0x7830('0x62')][_0x7830('0x44')]({'where':{'id':_0x68052[_0x7830('0x34')][_0x7830('0x6e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7830('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x7830('0x23')](handleEntityNotFound(_0x3742fd,null))[_0x7830('0x23')](function(_0x2ec5d7){var _0xcc7e=_['map'](_0x2ec5d7,'id');var _0x24c1c7=[];var _0x4dfd7c=[];var _0x2751ee=squel[_0x7830('0x70')]();_0x2751ee['field'](_0x7830('0x71'))[_0x7830('0x72')](_0x7830('0x73'),'tq')[_0x7830('0x74')](_0x7830('0x75'),'ut',_0x7830('0x76'))['where'](_0x7830('0x77'),_0x68052[_0x7830('0x48')]['id']);for(var _0x383020=0x0;_0x383020<_0x2ec5d7[_0x7830('0x39')];_0x383020+=0x1){let _0x266004=_0x2ec5d7[_0x383020];for(var _0x48d9e4=0x0;_0x48d9e4<_0x266004[_0x7830('0x6f')]['length'];_0x48d9e4+=0x1){let _0x46299f=_0x266004[_0x7830('0x6f')][_0x48d9e4];var _0x53b342=_0x2751ee['clone']();_0x53b342[_0x7830('0x3e')](_0x7830('0x78'),_0x46299f['id']);_0x4dfd7c[_0x7830('0x79')](db[_0x7830('0x7a')][_0x7830('0x34')](_0x53b342[_0x7830('0x7b')](),{'type':db[_0x7830('0x7a')][_0x7830('0x7c')][_0x7830('0x7d')]})[_0x7830('0x23')](function(_0x4525e6){if(_0x4525e6[_0x7830('0x39')]===0x1){return _0x46299f['id'];}else{var _0x14b8b1=_[_0x7830('0x7e')](_[_0x7830('0x2d')](_0x4525e6,'TeamId'),function(_0x2885ce){return _[_0x7830('0x7f')](_0xcc7e,_0x2885ce);});if(_0x14b8b1){return _0x46299f['id'];}}}));}}return BPromise[_0x7830('0x80')](_0x4dfd7c)[_0x7830('0x23')](function(_0x1010ba){_0x24c1c7=_(_0x24c1c7)[_0x7830('0x81')](_0x1010ba)[_0x7830('0x82')]()[_0x7830('0x83')]();return db[_0x7830('0x2e')]['find']({'where':{'id':_0x68052[_0x7830('0x48')]['id']}})['then'](function(_0x18950c){return db['sequelize'][_0x7830('0x68')](function(_0x558b19){return _0x18950c[_0x7830('0x6d')](_0x68052[_0x7830('0x34')][_0x7830('0x6e')],{'transaction':_0x558b19})['then'](function(){if(!_[_0x7830('0x84')](_0x24c1c7)){return _0x18950c[_0x7830('0x85')](_0x24c1c7,{'transaction':_0x558b19});}})[_0x7830('0x23')](function(){_0x24c1c7[_0x7830('0x6a')](function(_0x17b000){socket[_0x7830('0x6b')](_0x7830('0x86'),{'UserId':_0x17b000,'FaxQueueId':_0x18950c['id']});});});});});});})[_0x7830('0x23')](respondWithStatusCode(_0x3742fd,null))[_0x7830('0x46')](handleError(_0x3742fd,null));};exports[_0x7830('0x87')]=function(_0xa2c6c2,_0x270005,_0x2f83a3){return db[_0x7830('0x2e')][_0x7830('0x4a')]({'where':{'id':_0xa2c6c2[_0x7830('0x48')]['id']}})[_0x7830('0x23')](handleEntityNotFound(_0x270005,null))[_0x7830('0x23')](function(_0x5b0770){if(_0x5b0770){return _0x5b0770[_0x7830('0x87')](_0xa2c6c2['body']['ids'],_[_0x7830('0x88')](_0xa2c6c2[_0x7830('0x4c')],[_0x7830('0x6e'),'id'])||{})['spread'](function(_0x1772ca){for(var _0xdde9b0=0x0;_0xdde9b0<_0xa2c6c2[_0x7830('0x4c')][_0x7830('0x6e')]['length'];_0xdde9b0+=0x1){socket[_0x7830('0x6b')]('userFaxQueue:save',{'UserId':_0xa2c6c2[_0x7830('0x4c')][_0x7830('0x6e')][_0xdde9b0],'FaxQueueId':_0xa2c6c2[_0x7830('0x48')]['id']});}return _0x1772ca;});}})[_0x7830('0x23')](respondWithResult(_0x270005,null))[_0x7830('0x46')](handleError(_0x270005,null));};exports[_0x7830('0x85')]=function(_0xb1473b,_0x415953,_0x38d3a7){return db[_0x7830('0x2e')][_0x7830('0x4a')]({'where':{'id':_0xb1473b[_0x7830('0x48')]['id']}})['then'](handleEntityNotFound(_0x415953,null))[_0x7830('0x23')](function(_0x28742c){if(_0x28742c){return _0x28742c[_0x7830('0x85')](_0xb1473b[_0x7830('0x34')][_0x7830('0x6e')])[_0x7830('0x23')](function(){if(_['isArray'](_0xb1473b[_0x7830('0x34')][_0x7830('0x6e')])){for(var _0xac5aac=0x0;_0xac5aac<_0xb1473b[_0x7830('0x34')]['ids'][_0x7830('0x39')];_0xac5aac+=0x1){socket[_0x7830('0x6b')](_0x7830('0x86'),{'UserId':Number(_0xb1473b[_0x7830('0x34')][_0x7830('0x6e')][_0xac5aac]),'FaxQueueId':Number(_0xb1473b[_0x7830('0x48')]['id'])});}}else{socket[_0x7830('0x6b')](_0x7830('0x86'),{'UserId':Number(_0xb1473b[_0x7830('0x34')][_0x7830('0x6e')]),'FaxQueueId':Number(_0xb1473b[_0x7830('0x48')]['id'])});}});}})[_0x7830('0x23')](respondWithStatusCode(_0x415953,null))['catch'](handleError(_0x415953,null));};exports[_0x7830('0x89')]=function(_0x91a7f,_0x27ab1f,_0x2f11b9){var _0x2182e4={};var _0x9b3af2={};var _0xeec62b;var _0xc219c3;return db[_0x7830('0x2e')][_0x7830('0x61')]({'where':{'id':_0x91a7f[_0x7830('0x48')]['id']}})[_0x7830('0x23')](handleEntityNotFound(_0x27ab1f,null))['then'](function(_0x1a1806){if(_0x1a1806){_0xeec62b=_0x1a1806;_0x9b3af2[_0x7830('0x33')]=_[_0x7830('0x35')](db[_0x7830('0x64')][_0x7830('0x2f')]);_0x9b3af2[_0x7830('0x34')]=_[_0x7830('0x35')](_0x91a7f[_0x7830('0x34')]);_0x9b3af2[_0x7830('0x3f')]=_[_0x7830('0x36')](_0x9b3af2[_0x7830('0x33')],_0x9b3af2['query']);_0x2182e4[_0x7830('0x37')]=_['intersection'](_0x9b3af2['model'],qs['fields'](_0x91a7f[_0x7830('0x34')]['fields']));_0x2182e4[_0x7830('0x37')]=_0x2182e4[_0x7830('0x37')][_0x7830('0x39')]?_0x2182e4['attributes']:_0x9b3af2[_0x7830('0x33')];_0x2182e4['order']=qs[_0x7830('0x3d')](_0x91a7f['query'][_0x7830('0x3d')]);_0x2182e4['where']=qs['filters'](_['pick'](_0x91a7f[_0x7830('0x34')],_0x9b3af2['filters']));if(_0x91a7f[_0x7830('0x34')][_0x7830('0x41')]){_0x2182e4[_0x7830('0x3e')]=_[_0x7830('0x42')](_0x2182e4['where'],{'$or':_['map'](_0x2182e4['attributes'],function(_0x54ed5a){var _0x20eec5={};_0x20eec5[_0x54ed5a]={'$like':'%'+_0x91a7f[_0x7830('0x34')][_0x7830('0x41')]+'%'};return _0x20eec5;})});}_0x2182e4=_[_0x7830('0x42')]({},_0x2182e4,_0x91a7f[_0x7830('0x8a')]);return _0xeec62b[_0x7830('0x89')](_0x2182e4);}})[_0x7830('0x23')](function(_0x2c2268){if(_0x2c2268){_0xc219c3=_0x2c2268[_0x7830('0x39')];if(!_0x91a7f['query'][_0x7830('0x3a')](_0x7830('0x3b'))){_0x2182e4[_0x7830('0x1d')]=qs[_0x7830('0x1d')](_0x91a7f['query'][_0x7830('0x1d')]);_0x2182e4[_0x7830('0x1c')]=qs[_0x7830('0x1c')](_0x91a7f[_0x7830('0x34')][_0x7830('0x1c')]);}return _0xeec62b[_0x7830('0x89')](_0x2182e4);}})[_0x7830('0x23')](function(_0xde240a){if(_0xde240a){return _0xde240a?{'count':_0xc219c3,'rows':_0xde240a}:null;}})[_0x7830('0x23')](respondWithResult(_0x27ab1f,null))[_0x7830('0x46')](handleError(_0x27ab1f,null));}; \ No newline at end of file +var _0xdca4=['online','voicePause','interface','flatMap','transaction','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','SELECT','TeamId','all','union','value','ids','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','getAgents','pick','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','status','end','json','count','offset','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','order','sort','FaxQueueId','options','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','Team','Agents'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xdca4,0x138));var _0x4dca=function(_0x1b467c,_0x3cd118){_0x1b467c=_0x1b467c-0x0;var _0x27e5df=_0xdca4[_0x1b467c];return _0x27e5df;};'use strict';var pdf=require(_0x4dca('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4dca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4dca('0x2'));var rp=require(_0x4dca('0x3'));var moment=require(_0x4dca('0x4'));var BPromise=require(_0x4dca('0x5'));var Mustache=require(_0x4dca('0x6'));var util=require(_0x4dca('0x7'));var path=require(_0x4dca('0x8'));var sox=require('sox');var csv=require(_0x4dca('0x9'));var ejs=require(_0x4dca('0xa'));var fs=require('fs');var _=require(_0x4dca('0xb'));var squel=require(_0x4dca('0xc'));var crypto=require('crypto');var jsforce=require(_0x4dca('0xd'));var deskjs=require(_0x4dca('0xe'));var toCsv=require(_0x4dca('0x9'));var querystring=require(_0x4dca('0xf'));var Papa=require(_0x4dca('0x10'));var Redis=require(_0x4dca('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4dca('0x12'));var as=require(_0x4dca('0x13'));var hardwareService=require(_0x4dca('0x14'));var logger=require('../../config/logger')(_0x4dca('0x15'));var utils=require(_0x4dca('0x16'));var config=require(_0x4dca('0x17'));var db=require(_0x4dca('0x18'))['db'];config[_0x4dca('0x19')]=_[_0x4dca('0x1a')](config[_0x4dca('0x19')],{'host':_0x4dca('0x1b'),'port':0x18eb});var socket=require(_0x4dca('0x1c'))(new Redis(config[_0x4dca('0x19')]));require(_0x4dca('0x1d'))['register'](socket);function respondWithStatusCode(_0x33633f,_0x263c44){_0x263c44=_0x263c44||0xcc;return function(_0x43211e){if(_0x43211e){return _0x33633f['sendStatus'](_0x263c44);}return _0x33633f[_0x4dca('0x1e')](_0x263c44)[_0x4dca('0x1f')]();};}function respondWithResult(_0x4da393,_0x3216e9){_0x3216e9=_0x3216e9||0xc8;return function(_0x3635cd){if(_0x3635cd){return _0x4da393['status'](_0x3216e9)[_0x4dca('0x20')](_0x3635cd);}};}function respondWithFilteredResult(_0x2b2d22,_0x2fea94){return function(_0x2fa48d){if(_0x2fa48d){var _0x41e56f=_0x2fa48d[_0x4dca('0x21')],_0xef705=_0x2fea94[_0x4dca('0x22')],_0x536606=_0x2fea94[_0x4dca('0x22')]+_0x2fea94['limit'],_0x1aa6a5;if(_0x536606>=_0x41e56f){_0x536606=_0x41e56f;_0x1aa6a5=0xc8;}else{_0x1aa6a5=0xce;}_0x2b2d22[_0x4dca('0x1e')](_0x1aa6a5);return _0x2b2d22['set']('Content-Range',_0xef705+'-'+_0x536606+'/'+_0x41e56f)[_0x4dca('0x20')](_0x2fa48d);}return null;};}function patchUpdates(_0x3d956e){return function(_0x576ed4){try{jsonpatch[_0x4dca('0x23')](_0x576ed4,_0x3d956e,!![]);}catch(_0xcbf101){return BPromise['reject'](_0xcbf101);}return _0x576ed4[_0x4dca('0x24')]();};}function saveUpdates(_0x12203e,_0x404788){return function(_0x33d10a){if(_0x33d10a){return _0x33d10a[_0x4dca('0x25')](_0x12203e)[_0x4dca('0x26')](function(_0x5dcf31){return _0x5dcf31;});}return null;};}function removeEntity(_0x4ec5c6,_0x4eb255){return function(_0x1142a5){if(_0x1142a5){return _0x1142a5[_0x4dca('0x27')]()[_0x4dca('0x26')](function(){var _0x1ccc29=_0x1142a5['get']({'plain':!![]});var _0x141227='FaxQueues';return db[_0x4dca('0x28')][_0x4dca('0x27')]({'where':{'type':_0x141227,'resourceId':_0x1ccc29['id']}})[_0x4dca('0x26')](function(){return _0x1142a5;});})['then'](function(){_0x4ec5c6['status'](0xcc)[_0x4dca('0x1f')]();});}};}function handleEntityNotFound(_0x1e0cf,_0x34d70e){return function(_0xc833f4){if(!_0xc833f4){_0x1e0cf['sendStatus'](0x194);}return _0xc833f4;};}function handleError(_0x3483c8,_0x5c02aa){_0x5c02aa=_0x5c02aa||0x1f4;return function(_0x35be18){logger[_0x4dca('0x29')](_0x35be18[_0x4dca('0x2a')]);if(_0x35be18[_0x4dca('0x2b')]){delete _0x35be18[_0x4dca('0x2b')];}_0x3483c8[_0x4dca('0x1e')](_0x5c02aa)[_0x4dca('0x2c')](_0x35be18);};}exports[_0x4dca('0x2d')]=function(_0xad04c,_0x3f9171){var _0x50640b={},_0x500f2b={},_0x4d1f28={'count':0x0,'rows':[]};var _0x2fa8f6=_[_0x4dca('0x2e')](db[_0x4dca('0x2f')][_0x4dca('0x30')],function(_0x57ad65){return{'name':_0x57ad65[_0x4dca('0x31')],'type':_0x57ad65[_0x4dca('0x32')][_0x4dca('0x33')]};});_0x500f2b['model']=_[_0x4dca('0x2e')](_0x2fa8f6,'name');_0x500f2b[_0x4dca('0x34')]=_[_0x4dca('0x35')](_0xad04c['query']);_0x500f2b[_0x4dca('0x36')]=_[_0x4dca('0x37')](_0x500f2b[_0x4dca('0x38')],_0x500f2b[_0x4dca('0x34')]);_0x50640b['attributes']=_[_0x4dca('0x37')](_0x500f2b[_0x4dca('0x38')],qs['fields'](_0xad04c[_0x4dca('0x34')][_0x4dca('0x39')]));_0x50640b[_0x4dca('0x3a')]=_0x50640b[_0x4dca('0x3a')][_0x4dca('0x3b')]?_0x50640b[_0x4dca('0x3a')]:_0x500f2b[_0x4dca('0x38')];if(!_0xad04c[_0x4dca('0x34')]['hasOwnProperty'](_0x4dca('0x3c'))){_0x50640b[_0x4dca('0x3d')]=qs['limit'](_0xad04c['query']['limit']);_0x50640b[_0x4dca('0x22')]=qs[_0x4dca('0x22')](_0xad04c[_0x4dca('0x34')][_0x4dca('0x22')]);}_0x50640b['order']=qs['sort'](_0xad04c[_0x4dca('0x34')]['sort']);_0x50640b[_0x4dca('0x3e')]=qs[_0x4dca('0x36')](_['pick'](_0xad04c[_0x4dca('0x34')],_0x500f2b[_0x4dca('0x36')]),_0x2fa8f6);if(_0xad04c[_0x4dca('0x34')][_0x4dca('0x3f')]){_0x50640b[_0x4dca('0x3e')]=_['merge'](_0x50640b[_0x4dca('0x3e')],{'$or':_[_0x4dca('0x2e')](_0x2fa8f6,function(_0x4f4939){if(_0x4f4939[_0x4dca('0x32')]!==_0x4dca('0x40')){var _0x4b1e58={};_0x4b1e58[_0x4f4939[_0x4dca('0x2b')]]={'$like':'%'+_0xad04c['query'][_0x4dca('0x3f')]+'%'};return _0x4b1e58;}})});}_0x50640b=_[_0x4dca('0x41')]({},_0x50640b,_0xad04c['options']);var _0x15cf45={'where':_0x50640b[_0x4dca('0x3e')]};return db[_0x4dca('0x2f')][_0x4dca('0x21')](_0x15cf45)[_0x4dca('0x26')](function(_0x193c62){_0x4d1f28[_0x4dca('0x21')]=_0x193c62;if(_0xad04c['query'][_0x4dca('0x42')]){_0x50640b[_0x4dca('0x43')]=[{'all':!![]}];}return db[_0x4dca('0x2f')][_0x4dca('0x44')](_0x50640b);})['then'](function(_0x12de15){_0x4d1f28[_0x4dca('0x45')]=_0x12de15;return _0x4d1f28;})[_0x4dca('0x26')](respondWithFilteredResult(_0x3f9171,_0x50640b))['catch'](handleError(_0x3f9171,null));};exports[_0x4dca('0x46')]=function(_0x3759cc,_0x1a3599){var _0x35549e={'raw':!![],'where':{'id':_0x3759cc[_0x4dca('0x47')]['id']}},_0x44d54f={};_0x44d54f[_0x4dca('0x38')]=_[_0x4dca('0x35')](db['FaxQueue'][_0x4dca('0x30')]);_0x44d54f['query']=_[_0x4dca('0x35')](_0x3759cc[_0x4dca('0x34')]);_0x44d54f['filters']=_['intersection'](_0x44d54f[_0x4dca('0x38')],_0x44d54f[_0x4dca('0x34')]);_0x35549e[_0x4dca('0x3a')]=_['intersection'](_0x44d54f[_0x4dca('0x38')],qs[_0x4dca('0x39')](_0x3759cc[_0x4dca('0x34')][_0x4dca('0x39')]));_0x35549e[_0x4dca('0x3a')]=_0x35549e['attributes'][_0x4dca('0x3b')]?_0x35549e['attributes']:_0x44d54f[_0x4dca('0x38')];if(_0x3759cc[_0x4dca('0x34')][_0x4dca('0x42')]){_0x35549e[_0x4dca('0x43')]=[{'all':!![]}];}_0x35549e=_['merge']({},_0x35549e,_0x3759cc['options']);return db[_0x4dca('0x2f')]['find'](_0x35549e)[_0x4dca('0x26')](handleEntityNotFound(_0x1a3599,null))[_0x4dca('0x26')](respondWithResult(_0x1a3599,null))[_0x4dca('0x48')](handleError(_0x1a3599,null));};exports[_0x4dca('0x49')]=function(_0x229c42,_0x146d2a){return db[_0x4dca('0x2f')][_0x4dca('0x49')](_0x229c42['body'],{})[_0x4dca('0x26')](function(_0x296038){var _0x34f806=_0x229c42['user'][_0x4dca('0x4a')]({'plain':!![]});if(!_0x34f806)throw new Error(_0x4dca('0x4b'));if(_0x34f806[_0x4dca('0x4c')]===_0x4dca('0x4d')){var _0x3d6291=_0x296038[_0x4dca('0x4a')]({'plain':!![]});var _0x501209='FaxQueues';return db['UserProfileSection'][_0x4dca('0x4e')]({'where':{'name':_0x501209,'userProfileId':_0x34f806[_0x4dca('0x4f')]},'raw':!![]})['then'](function(_0x3e2e29){if(_0x3e2e29&&_0x3e2e29[_0x4dca('0x50')]===0x0){return db[_0x4dca('0x28')][_0x4dca('0x49')]({'name':_0x3d6291[_0x4dca('0x2b')],'resourceId':_0x3d6291['id'],'type':_0x3e2e29[_0x4dca('0x2b')],'sectionId':_0x3e2e29['id']},{})[_0x4dca('0x26')](function(){return _0x296038;});}else{return _0x296038;}})['catch'](function(_0x2fab3c){logger[_0x4dca('0x29')](_0x4dca('0x51'),_0x2fab3c);throw _0x2fab3c;});}return _0x296038;})[_0x4dca('0x26')](respondWithResult(_0x146d2a,0xc9))[_0x4dca('0x48')](handleError(_0x146d2a,null));};exports['update']=function(_0x35824c,_0x124977){if(_0x35824c[_0x4dca('0x52')]['id']){delete _0x35824c[_0x4dca('0x52')]['id'];}return db[_0x4dca('0x2f')]['find']({'where':{'id':_0x35824c[_0x4dca('0x47')]['id']}})[_0x4dca('0x26')](handleEntityNotFound(_0x124977,null))['then'](saveUpdates(_0x35824c['body'],null))[_0x4dca('0x26')](respondWithResult(_0x124977,null))[_0x4dca('0x48')](handleError(_0x124977,null));};exports[_0x4dca('0x27')]=function(_0x16eb54,_0x2d3d77){return db[_0x4dca('0x2f')]['find']({'where':{'id':_0x16eb54[_0x4dca('0x47')]['id']}})[_0x4dca('0x26')](handleEntityNotFound(_0x2d3d77,null))['then'](removeEntity(_0x2d3d77,null))['catch'](handleError(_0x2d3d77,null));};exports['describe']=function(_0x6417f6,_0x478c92){return db[_0x4dca('0x2f')][_0x4dca('0x53')]()[_0x4dca('0x26')](respondWithResult(_0x478c92,null))[_0x4dca('0x48')](handleError(_0x478c92,null));};exports[_0x4dca('0x54')]=function(_0x368954,_0x5737c4,_0x425474){var _0x1a7df1={'raw':!![],'where':{}},_0x567719={},_0x428758;return db[_0x4dca('0x2f')][_0x4dca('0x55')]({'where':{'id':_0x368954[_0x4dca('0x47')]['id']}})[_0x4dca('0x26')](handleEntityNotFound(_0x5737c4,null))['then'](function(_0x3d86c1){if(_0x3d86c1){_0x428758=_0x3d86c1[_0x4dca('0x4a')]({'plain':!![]});_0x567719['model']=_[_0x4dca('0x35')](db[_0x4dca('0x56')]['rawAttributes']);_0x567719[_0x4dca('0x34')]=_['keys'](_0x368954[_0x4dca('0x34')]);_0x567719[_0x4dca('0x36')]=_[_0x4dca('0x37')](_0x567719[_0x4dca('0x38')],_0x567719[_0x4dca('0x34')]);_0x1a7df1[_0x4dca('0x3a')]=_[_0x4dca('0x37')](_0x567719[_0x4dca('0x38')],qs[_0x4dca('0x39')](_0x368954[_0x4dca('0x34')][_0x4dca('0x39')]));_0x1a7df1[_0x4dca('0x3a')]=_0x1a7df1[_0x4dca('0x3a')][_0x4dca('0x3b')]?_0x1a7df1[_0x4dca('0x3a')]:_0x567719[_0x4dca('0x38')];if(!_0x368954['query'][_0x4dca('0x57')](_0x4dca('0x3c'))){_0x1a7df1[_0x4dca('0x3d')]=qs[_0x4dca('0x3d')](_0x368954[_0x4dca('0x34')][_0x4dca('0x3d')]);_0x1a7df1[_0x4dca('0x22')]=qs['offset'](_0x368954[_0x4dca('0x34')][_0x4dca('0x22')]);}_0x1a7df1[_0x4dca('0x58')]=qs['sort'](_0x368954[_0x4dca('0x34')][_0x4dca('0x59')]);_0x1a7df1[_0x4dca('0x3e')]=qs['filters'](_['pick'](_0x368954['query'],_0x567719[_0x4dca('0x36')]));_0x1a7df1[_0x4dca('0x3e')][_0x4dca('0x5a')]=_0x3d86c1['id'];if(_0x368954[_0x4dca('0x34')][_0x4dca('0x3f')]){_0x1a7df1[_0x4dca('0x3e')]=_[_0x4dca('0x41')](_0x1a7df1[_0x4dca('0x3e')],{'$or':_[_0x4dca('0x2e')](_0x1a7df1['attributes'],function(_0x215695){var _0x4a1613={};_0x4a1613[_0x215695]={'$like':'%'+_0x368954[_0x4dca('0x34')][_0x4dca('0x3f')]+'%'};return _0x4a1613;})});}_0x1a7df1=_[_0x4dca('0x41')]({},_0x1a7df1,_0x368954[_0x4dca('0x5b')]);return db[_0x4dca('0x56')][_0x4dca('0x44')](_0x1a7df1);}})['then'](function(_0x2fcf53){if(_0x2fcf53){return db[_0x4dca('0x5c')][_0x4dca('0x5d')]({'where':{'id':_['map'](_0x2fcf53,_0x4dca('0x5e')),'role':_0x4dca('0x5f')},'attributes':['id',_0x4dca('0x2b'),_0x4dca('0x60'),_0x4dca('0x61'),_0x4dca('0x62')]});}})[_0x4dca('0x26')](function(_0x4a294c){if(_0x4a294c){return{'count':_0x4a294c['count'],'rows':_[_0x4dca('0x2e')](_0x4a294c[_0x4dca('0x45')],function(_0x3ad0a3){return{'membername':_0x3ad0a3['name'],'UserId':_0x3ad0a3['id'],'queue_name':_0x428758[_0x4dca('0x2b')],'FaxQueueId':_0x428758['id'],'interface':util[_0x4dca('0x63')](_0x4dca('0x64'),'SIP',_0x3ad0a3['name']),'penalty':0x0,'paused':_0x3ad0a3[_0x4dca('0x60')],'createdAt':_0x3ad0a3[_0x4dca('0x62')],'updatedAt':_0x3ad0a3[_0x4dca('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4dca('0x26')](respondWithFilteredResult(_0x5737c4,_0x1a7df1))[_0x4dca('0x48')](handleError(_0x5737c4,null));};exports[_0x4dca('0x65')]=function(_0x6d1028,_0x23a1ec,_0x3ec4ff){var _0x3e5c3e={};var _0x56e481={};var _0x36c7c0;var _0x143564;return db[_0x4dca('0x2f')][_0x4dca('0x55')]({'where':{'id':_0x6d1028['params']['id']}})['then'](handleEntityNotFound(_0x23a1ec,null))['then'](function(_0x2eb016){if(_0x2eb016){_0x36c7c0=_0x2eb016;_0x56e481[_0x4dca('0x38')]=_[_0x4dca('0x35')](db['Team']['rawAttributes']);_0x56e481['query']=_[_0x4dca('0x35')](_0x6d1028[_0x4dca('0x34')]);_0x56e481[_0x4dca('0x36')]=_[_0x4dca('0x37')](_0x56e481[_0x4dca('0x38')],_0x56e481[_0x4dca('0x34')]);_0x3e5c3e[_0x4dca('0x3a')]=_['intersection'](_0x56e481[_0x4dca('0x38')],qs[_0x4dca('0x39')](_0x6d1028['query'][_0x4dca('0x39')]));_0x3e5c3e[_0x4dca('0x3a')]=_0x3e5c3e[_0x4dca('0x3a')][_0x4dca('0x3b')]?_0x3e5c3e['attributes']:_0x56e481['model'];_0x3e5c3e['order']=qs['sort'](_0x6d1028[_0x4dca('0x34')]['sort']);_0x3e5c3e[_0x4dca('0x3e')]=qs['filters'](_['pick'](_0x6d1028['query'],_0x56e481[_0x4dca('0x36')]));if(_0x6d1028[_0x4dca('0x34')]['filter']){_0x3e5c3e[_0x4dca('0x3e')]=_[_0x4dca('0x41')](_0x3e5c3e['where'],{'$or':_[_0x4dca('0x2e')](_0x3e5c3e[_0x4dca('0x3a')],function(_0x28a0a3){var _0x110911={};_0x110911[_0x28a0a3]={'$like':'%'+_0x6d1028[_0x4dca('0x34')][_0x4dca('0x3f')]+'%'};return _0x110911;})});}_0x3e5c3e=_[_0x4dca('0x41')]({},_0x3e5c3e,_0x6d1028['options']);return _0x36c7c0['getTeams'](_0x3e5c3e);}})[_0x4dca('0x26')](function(_0x3f236b){if(_0x3f236b){_0x143564=_0x3f236b['length'];if(!_0x6d1028['query'][_0x4dca('0x57')](_0x4dca('0x3c'))){_0x3e5c3e[_0x4dca('0x3d')]=qs[_0x4dca('0x3d')](_0x6d1028[_0x4dca('0x34')][_0x4dca('0x3d')]);_0x3e5c3e[_0x4dca('0x22')]=qs[_0x4dca('0x22')](_0x6d1028[_0x4dca('0x34')][_0x4dca('0x22')]);}return _0x36c7c0[_0x4dca('0x65')](_0x3e5c3e);}})[_0x4dca('0x26')](function(_0x2de606){if(_0x2de606){return _0x2de606?{'count':_0x143564,'rows':_0x2de606}:null;}})[_0x4dca('0x26')](respondWithResult(_0x23a1ec,null))['catch'](handleError(_0x23a1ec,null));};exports[_0x4dca('0x66')]=function(_0x1d4045,_0x721035,_0xf7ef94){var _0x38d449=_0x1d4045[_0x4dca('0x52')]['ids'];return db[_0x4dca('0x67')]['findAll']({'where':{'id':_0x38d449},'attributes':['id'],'include':[{'model':db[_0x4dca('0x5c')],'as':_0x4dca('0x68'),'attributes':['id',_0x4dca('0x2b'),_0x4dca('0x69'),_0x4dca('0x6a'),_0x4dca('0x6b')],'raw':!![]}]})[_0x4dca('0x26')](function(_0x3e6f13){if(_0x3e6f13){var _0x57b921=_[_0x4dca('0x6c')](_0x3e6f13,function(_0x1aece1){var _0x35c58b=_0x1aece1[_0x4dca('0x4a')]({'plain':!![]});return _0x35c58b['Agents'];});return db[_0x4dca('0x2f')][_0x4dca('0x4e')]({'where':{'id':_0x1d4045[_0x4dca('0x47')]['id']}})['then'](function(_0x3c12c7){return db['sequelize'][_0x4dca('0x6d')](function(_0x56c41b){return _0x3c12c7[_0x4dca('0x66')](_0x38d449,{'transaction':_0x56c41b})['then'](function(){return BPromise['each'](_0x57b921,function(_0x1ddde1){return db[_0x4dca('0x56')]['findOrCreate']({'where':{'UserId':_0x1ddde1['id'],'FaxQueueId':_0x1d4045[_0x4dca('0x47')]['id']},'transaction':_0x56c41b});});})[_0x4dca('0x26')](function(){_0x57b921[_0x4dca('0x6e')](function(_0x17e0fb){socket[_0x4dca('0x6f')](_0x4dca('0x70'),{'UserId':_0x17e0fb['id'],'FaxQueueId':_0x3c12c7['id']});});});});});}})['then'](respondWithStatusCode(_0x721035,null))[_0x4dca('0x48')](handleError(_0x721035,null));};exports[_0x4dca('0x71')]=function(_0x1c0fa1,_0x1362e6,_0x40065f){return db[_0x4dca('0x67')]['findAll']({'where':{'id':_0x1c0fa1[_0x4dca('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4dca('0x5c')],'as':_0x4dca('0x68'),'attributes':['id'],'raw':!![]}]})[_0x4dca('0x26')](handleEntityNotFound(_0x1362e6,null))[_0x4dca('0x26')](function(_0x10e72c){var _0x50e915=_[_0x4dca('0x2e')](_0x10e72c,'id');var _0x43691d=[];var _0x5606f9=[];var _0x593a95=squel[_0x4dca('0x72')]();_0x593a95[_0x4dca('0x73')](_0x4dca('0x74'))[_0x4dca('0x75')](_0x4dca('0x76'),'tq')[_0x4dca('0x77')]('user_has_teams','ut',_0x4dca('0x78'))[_0x4dca('0x3e')]('FaxQueueId\x20=\x20?',_0x1c0fa1['params']['id']);for(var _0x5b9f43=0x0;_0x5b9f43<_0x10e72c[_0x4dca('0x3b')];_0x5b9f43+=0x1){let _0x562c43=_0x10e72c[_0x5b9f43];for(var _0x4a03d8=0x0;_0x4a03d8<_0x562c43[_0x4dca('0x68')][_0x4dca('0x3b')];_0x4a03d8+=0x1){let _0x22064f=_0x562c43[_0x4dca('0x68')][_0x4a03d8];var _0x5614d2=_0x593a95[_0x4dca('0x79')]();_0x5614d2[_0x4dca('0x3e')]('ut.UserId\x20=\x20?',_0x22064f['id']);_0x5606f9[_0x4dca('0x7a')](db[_0x4dca('0x7b')][_0x4dca('0x34')](_0x5614d2[_0x4dca('0x7c')](),{'type':db['sequelize'][_0x4dca('0x7d')][_0x4dca('0x7e')]})['then'](function(_0x3ca4c3){if(_0x3ca4c3['length']===0x1){return _0x22064f['id'];}else{var _0xf61dbe=_['every'](_['map'](_0x3ca4c3,_0x4dca('0x7f')),function(_0x5bb843){return _['includes'](_0x50e915,_0x5bb843);});if(_0xf61dbe){return _0x22064f['id'];}}}));}}return BPromise[_0x4dca('0x80')](_0x5606f9)['then'](function(_0x183bb8){_0x43691d=_(_0x43691d)[_0x4dca('0x81')](_0x183bb8)['compact']()[_0x4dca('0x82')]();return db[_0x4dca('0x2f')][_0x4dca('0x4e')]({'where':{'id':_0x1c0fa1[_0x4dca('0x47')]['id']}})[_0x4dca('0x26')](function(_0x35d2f4){return db['sequelize'][_0x4dca('0x6d')](function(_0x4fd704){return _0x35d2f4[_0x4dca('0x71')](_0x1c0fa1['query'][_0x4dca('0x83')],{'transaction':_0x4fd704})[_0x4dca('0x26')](function(){if(!_[_0x4dca('0x84')](_0x43691d)){return _0x35d2f4[_0x4dca('0x85')](_0x43691d,{'transaction':_0x4fd704});}})[_0x4dca('0x26')](function(){_0x43691d[_0x4dca('0x6e')](function(_0x4a1a23){socket[_0x4dca('0x6f')](_0x4dca('0x86'),{'UserId':_0x4a1a23,'FaxQueueId':_0x35d2f4['id']});});});});});});})['then'](respondWithStatusCode(_0x1362e6,null))[_0x4dca('0x48')](handleError(_0x1362e6,null));};exports[_0x4dca('0x87')]=function(_0x29c0c5,_0x33d347,_0x296772){return db[_0x4dca('0x2f')][_0x4dca('0x4e')]({'where':{'id':_0x29c0c5[_0x4dca('0x47')]['id']}})['then'](handleEntityNotFound(_0x33d347,null))[_0x4dca('0x26')](function(_0x4965ac){if(_0x4965ac){return _0x4965ac[_0x4dca('0x87')](_0x29c0c5[_0x4dca('0x52')][_0x4dca('0x83')],_['omit'](_0x29c0c5[_0x4dca('0x52')],['ids','id'])||{})[_0x4dca('0x88')](function(_0x178e85){for(var _0x54f51d=0x0;_0x54f51d<_0x29c0c5[_0x4dca('0x52')][_0x4dca('0x83')][_0x4dca('0x3b')];_0x54f51d+=0x1){socket['emit'](_0x4dca('0x70'),{'UserId':_0x29c0c5[_0x4dca('0x52')][_0x4dca('0x83')][_0x54f51d],'FaxQueueId':_0x29c0c5[_0x4dca('0x47')]['id']});}return _0x178e85;});}})['then'](respondWithResult(_0x33d347,null))['catch'](handleError(_0x33d347,null));};exports[_0x4dca('0x85')]=function(_0x3c656e,_0x2f8f36,_0x5ac6c1){return db[_0x4dca('0x2f')][_0x4dca('0x4e')]({'where':{'id':_0x3c656e[_0x4dca('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f8f36,null))[_0x4dca('0x26')](function(_0xe3e72a){if(_0xe3e72a){return _0xe3e72a['removeAgents'](_0x3c656e['query'][_0x4dca('0x83')])[_0x4dca('0x26')](function(){if(_['isArray'](_0x3c656e[_0x4dca('0x34')][_0x4dca('0x83')])){for(var _0x1eb1b2=0x0;_0x1eb1b2<_0x3c656e['query'][_0x4dca('0x83')][_0x4dca('0x3b')];_0x1eb1b2+=0x1){socket[_0x4dca('0x6f')](_0x4dca('0x86'),{'UserId':Number(_0x3c656e[_0x4dca('0x34')]['ids'][_0x1eb1b2]),'FaxQueueId':Number(_0x3c656e[_0x4dca('0x47')]['id'])});}}else{socket[_0x4dca('0x6f')](_0x4dca('0x86'),{'UserId':Number(_0x3c656e['query'][_0x4dca('0x83')]),'FaxQueueId':Number(_0x3c656e[_0x4dca('0x47')]['id'])});}});}})[_0x4dca('0x26')](respondWithStatusCode(_0x2f8f36,null))['catch'](handleError(_0x2f8f36,null));};exports[_0x4dca('0x89')]=function(_0x26bb78,_0x3b598f,_0x4793d5){var _0x40aab3={};var _0x474e98={};var _0x44647c;var _0x74485e;return db[_0x4dca('0x2f')][_0x4dca('0x55')]({'where':{'id':_0x26bb78[_0x4dca('0x47')]['id']}})[_0x4dca('0x26')](handleEntityNotFound(_0x3b598f,null))[_0x4dca('0x26')](function(_0x3e4de4){if(_0x3e4de4){_0x44647c=_0x3e4de4;_0x474e98[_0x4dca('0x38')]=_['keys'](db[_0x4dca('0x5c')]['rawAttributes']);_0x474e98['query']=_[_0x4dca('0x35')](_0x26bb78[_0x4dca('0x34')]);_0x474e98[_0x4dca('0x36')]=_[_0x4dca('0x37')](_0x474e98[_0x4dca('0x38')],_0x474e98[_0x4dca('0x34')]);_0x40aab3['attributes']=_[_0x4dca('0x37')](_0x474e98[_0x4dca('0x38')],qs[_0x4dca('0x39')](_0x26bb78['query'][_0x4dca('0x39')]));_0x40aab3['attributes']=_0x40aab3['attributes'][_0x4dca('0x3b')]?_0x40aab3[_0x4dca('0x3a')]:_0x474e98[_0x4dca('0x38')];_0x40aab3[_0x4dca('0x58')]=qs['sort'](_0x26bb78[_0x4dca('0x34')][_0x4dca('0x59')]);_0x40aab3['where']=qs[_0x4dca('0x36')](_[_0x4dca('0x8a')](_0x26bb78['query'],_0x474e98[_0x4dca('0x36')]));if(_0x26bb78[_0x4dca('0x34')]['filter']){_0x40aab3[_0x4dca('0x3e')]=_[_0x4dca('0x41')](_0x40aab3['where'],{'$or':_[_0x4dca('0x2e')](_0x40aab3[_0x4dca('0x3a')],function(_0x4bc88b){var _0x5d1915={};_0x5d1915[_0x4bc88b]={'$like':'%'+_0x26bb78['query'][_0x4dca('0x3f')]+'%'};return _0x5d1915;})});}_0x40aab3=_['merge']({},_0x40aab3,_0x26bb78['options']);return _0x44647c['getAgents'](_0x40aab3);}})[_0x4dca('0x26')](function(_0x58ab2a){if(_0x58ab2a){_0x74485e=_0x58ab2a[_0x4dca('0x3b')];if(!_0x26bb78[_0x4dca('0x34')][_0x4dca('0x57')](_0x4dca('0x3c'))){_0x40aab3[_0x4dca('0x3d')]=qs['limit'](_0x26bb78[_0x4dca('0x34')][_0x4dca('0x3d')]);_0x40aab3['offset']=qs[_0x4dca('0x22')](_0x26bb78[_0x4dca('0x34')]['offset']);}return _0x44647c[_0x4dca('0x89')](_0x40aab3);}})['then'](function(_0x4a3867){if(_0x4a3867){return _0x4a3867?{'count':_0x74485e,'rows':_0x4a3867}:null;}})[_0x4dca('0x26')](respondWithResult(_0x3b598f,null))[_0x4dca('0x48')](handleError(_0x3b598f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index cd2b501..68e046f 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 _0x0f60=['FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x31460a,_0x25a195){var _0x249161=function(_0x28c617){while(--_0x28c617){_0x31460a['push'](_0x31460a['shift']());}};_0x249161(++_0x25a195);}(_0x0f60,0x107));var _0x00f6=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x0f60[_0x1cd47d];return _0x29d52f;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x00f6('0x0'))['db'][_0x00f6('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x00f6('0x2')](0x0);var events={'afterCreate':_0x00f6('0x3'),'afterUpdate':_0x00f6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5859a8){return function(_0x366bae,_0x521cd4,_0x3bbe99){FaxQueueEvents[_0x00f6('0x5')](_0x5859a8+':'+_0x366bae['id'],_0x366bae);FaxQueueEvents[_0x00f6('0x5')](_0x5859a8,_0x366bae);_0x3bbe99(null);};}for(var e in events){if(events[_0x00f6('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x00f6('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x02e5=['events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x460c38,_0x257274){var _0x1486b8=function(_0x40d2c1){while(--_0x40d2c1){_0x460c38['push'](_0x460c38['shift']());}};_0x1486b8(++_0x257274);}(_0x02e5,0xc6));var _0x502e=function(_0x219ca0,_0x3708be){_0x219ca0=_0x219ca0-0x0;var _0x2056aa=_0x02e5[_0x219ca0];return _0x2056aa;};'use strict';var EventEmitter=require(_0x502e('0x0'));var FaxQueue=require(_0x502e('0x1'))['db'][_0x502e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x502e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x502e('0x4'),'afterDestroy':_0x502e('0x5')};function emitEvent(_0x4dd5a4){return function(_0x570d96,_0x7988bd,_0xd424e8){FaxQueueEvents[_0x502e('0x6')](_0x4dd5a4+':'+_0x570d96['id'],_0x570d96);FaxQueueEvents[_0x502e('0x6')](_0x4dd5a4,_0x570d96);_0xd424e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x502e('0x7')](e,emitEvent(event));}}module[_0x502e('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 0497d94..17c1251 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 _0x9527=['api','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x798fb3,_0x569a97){var _0x525e46=function(_0x1fb114){while(--_0x1fb114){_0x798fb3['push'](_0x798fb3['shift']());}};_0x525e46(++_0x569a97);}(_0x9527,0xa2));var _0x7952=function(_0x133800,_0x5e6e51){_0x133800=_0x133800-0x0;var _0x47dd37=_0x9527[_0x133800];return _0x47dd37;};'use strict';var _=require(_0x7952('0x0'));var util=require(_0x7952('0x1'));var logger=require(_0x7952('0x2'))(_0x7952('0x3'));var moment=require('moment');var BPromise=require(_0x7952('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7952('0x5'));var rimraf=require(_0x7952('0x6'));var config=require(_0x7952('0x7'));var attributes=require(_0x7952('0x8'));module[_0x7952('0x9')]=function(_0x4ed3c7,_0x284043){return _0x4ed3c7[_0x7952('0xa')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d89=['exports','define','FaxQueue','fax_queues','lodash','util','bluebird','path','rimraf','../../config/environment'];(function(_0x187783,_0x523c06){var _0x20cfcd=function(_0x53a715){while(--_0x53a715){_0x187783['push'](_0x187783['shift']());}};_0x20cfcd(++_0x523c06);}(_0x7d89,0x68));var _0x97d8=function(_0x5373d4,_0x3e257e){_0x5373d4=_0x5373d4-0x0;var _0x21050d=_0x7d89[_0x5373d4];return _0x21050d;};'use strict';var _=require(_0x97d8('0x0'));var util=require(_0x97d8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x97d8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x97d8('0x3'));var rimraf=require(_0x97d8('0x4'));var config=require(_0x97d8('0x5'));var attributes=require('./faxQueue.attributes');module[_0x97d8('0x6')]=function(_0x7bf0f6,_0x28be3c){return _0x7bf0f6[_0x97d8('0x7')](_0x97d8('0x8'),attributes,{'tableName':_0x97d8('0x9'),'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 96372ad..dfbad7a 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 _0x3e39=['find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','include','map','attributes','model','ShowFaxQueue'];(function(_0x4f9fdf,_0x141230){var _0x2ed6bb=function(_0x5ea43a){while(--_0x5ea43a){_0x4f9fdf['push'](_0x4f9fdf['shift']());}};_0x2ed6bb(++_0x141230);}(_0x3e39,0x1cf));var _0x93e3=function(_0x30c76c,_0x1ea650){_0x30c76c=_0x30c76c-0x0;var _0x4119d3=_0x3e39[_0x30c76c];return _0x4119d3;};'use strict';var _=require(_0x93e3('0x0'));var util=require(_0x93e3('0x1'));var moment=require('moment');var BPromise=require(_0x93e3('0x2'));var rs=require(_0x93e3('0x3'));var fs=require('fs');var Redis=require(_0x93e3('0x4'));var db=require(_0x93e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93e3('0x6'))(_0x93e3('0x7'));var config=require(_0x93e3('0x8'));var jayson=require(_0x93e3('0x9'));var client=jayson[_0x93e3('0xa')][_0x93e3('0xb')]({'port':0x232a});config['redis']=_[_0x93e3('0xc')](config['redis'],{'host':_0x93e3('0xd'),'port':0x18eb});var socket=require(_0x93e3('0xe'))(new Redis(config[_0x93e3('0xf')]));require('./faxQueue.socket')[_0x93e3('0x10')](socket);function respondWithRpcPromise(_0xddaa5,_0x2490e0,_0x32c76d){return new BPromise(function(_0x53355a,_0x58a471){return client[_0x93e3('0x11')](_0xddaa5,_0x32c76d)[_0x93e3('0x12')](function(_0x35a8bf){logger[_0x93e3('0x13')](_0x93e3('0x14'),_0x2490e0,_0x93e3('0x15'));logger[_0x93e3('0x16')](_0x93e3('0x17'),_0x2490e0,_0x93e3('0x15'),JSON[_0x93e3('0x18')](_0x35a8bf));if(_0x35a8bf['error']){if(_0x35a8bf[_0x93e3('0x19')][_0x93e3('0x1a')]===0x1f4){logger['error'](_0x93e3('0x14'),_0x2490e0,_0x35a8bf[_0x93e3('0x19')][_0x93e3('0x1b')]);return _0x58a471(_0x35a8bf[_0x93e3('0x19')][_0x93e3('0x1b')]);}logger[_0x93e3('0x19')](_0x93e3('0x14'),_0x2490e0,_0x35a8bf[_0x93e3('0x19')][_0x93e3('0x1b')]);return _0x53355a(_0x35a8bf[_0x93e3('0x19')][_0x93e3('0x1b')]);}else{logger['info'](_0x93e3('0x14'),_0x2490e0,_0x93e3('0x15'));_0x53355a(_0x35a8bf[_0x93e3('0x1c')][_0x93e3('0x1b')]);}})[_0x93e3('0x1d')](function(_0x1a7de4){logger[_0x93e3('0x19')](_0x93e3('0x14'),_0x2490e0,_0x1a7de4);_0x58a471(_0x1a7de4);});});}exports[_0x93e3('0x1e')]=function(_0x29b4ab){var _0x442dcf=this;return new Promise(function(_0x109acb,_0x4fbbe9){return db[_0x93e3('0x1f')][_0x93e3('0x20')]({'raw':_0x29b4ab[_0x93e3('0x21')]?_0x29b4ab[_0x93e3('0x21')][_0x93e3('0x22')]===undefined?!![]:![]:!![],'where':_0x29b4ab[_0x93e3('0x21')]?_0x29b4ab[_0x93e3('0x21')][_0x93e3('0x23')]||null:null,'attributes':_0x29b4ab[_0x93e3('0x21')]?_0x29b4ab[_0x93e3('0x21')]['attributes']||null:null,'limit':_0x29b4ab[_0x93e3('0x21')]?_0x29b4ab[_0x93e3('0x21')]['limit']||null:null,'include':_0x29b4ab[_0x93e3('0x21')]?_0x29b4ab[_0x93e3('0x21')][_0x93e3('0x24')]?_[_0x93e3('0x25')](_0x29b4ab[_0x93e3('0x21')][_0x93e3('0x24')],function(_0xa88dc2){return{'model':db[_0xa88dc2['model']],'as':_0xa88dc2['as'],'attributes':_0xa88dc2[_0x93e3('0x26')],'include':_0xa88dc2['include']?_[_0x93e3('0x25')](_0xa88dc2['include'],function(_0x361f31){return{'model':db[_0x361f31['model']],'as':_0x361f31['as'],'attributes':_0x361f31[_0x93e3('0x26')],'include':_0x361f31[_0x93e3('0x24')]?_[_0x93e3('0x25')](_0x361f31[_0x93e3('0x24')],function(_0x5e0061){return{'model':db[_0x5e0061[_0x93e3('0x27')]],'as':_0x5e0061['as'],'attributes':_0x5e0061[_0x93e3('0x26')]};}):[]};}):[]};}):[]:[]})[_0x93e3('0x12')](function(_0x444790){logger[_0x93e3('0x13')](_0x93e3('0x1e'),_0x29b4ab);logger[_0x93e3('0x16')]('GetFaxQueue',_0x29b4ab,JSON[_0x93e3('0x18')](_0x444790));_0x109acb(_0x444790);})[_0x93e3('0x1d')](function(_0x2dcbea){logger[_0x93e3('0x19')](_0x93e3('0x1e'),_0x2dcbea['message'],_0x29b4ab);_0x4fbbe9(_0x442dcf[_0x93e3('0x19')](0x1f4,_0x2dcbea[_0x93e3('0x1b')]));});});};exports[_0x93e3('0x28')]=function(_0x1e65b2){var _0x365581=this;return new Promise(function(_0x4b71d7,_0x46b00a){return db[_0x93e3('0x1f')][_0x93e3('0x29')]({'raw':_0x1e65b2[_0x93e3('0x21')]?_0x1e65b2[_0x93e3('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x1e65b2[_0x93e3('0x21')]?_0x1e65b2[_0x93e3('0x21')]['where']||null:null,'attributes':_0x1e65b2['options']?_0x1e65b2[_0x93e3('0x21')]['attributes']||null:null,'include':_0x1e65b2[_0x93e3('0x21')]?_0x1e65b2['options'][_0x93e3('0x24')]?_[_0x93e3('0x25')](_0x1e65b2[_0x93e3('0x21')][_0x93e3('0x24')],function(_0x3a089f){return{'model':db[_0x3a089f['model']],'as':_0x3a089f['as'],'attributes':_0x3a089f[_0x93e3('0x26')],'include':_0x3a089f[_0x93e3('0x24')]?_['map'](_0x3a089f[_0x93e3('0x24')],function(_0x1818c8){return{'model':db[_0x1818c8[_0x93e3('0x27')]],'as':_0x1818c8['as'],'attributes':_0x1818c8['attributes'],'include':_0x1818c8[_0x93e3('0x24')]?_[_0x93e3('0x25')](_0x1818c8[_0x93e3('0x24')],function(_0x9ccdbc){return{'model':db[_0x9ccdbc[_0x93e3('0x27')]],'as':_0x9ccdbc['as'],'attributes':_0x9ccdbc[_0x93e3('0x26')]};}):[]};}):[]};}):[]:[]})[_0x93e3('0x12')](function(_0x580816){logger['info'](_0x93e3('0x28'),_0x1e65b2);logger[_0x93e3('0x16')](_0x93e3('0x28'),_0x1e65b2,JSON[_0x93e3('0x18')](_0x580816));_0x4b71d7(_0x580816);})[_0x93e3('0x1d')](function(_0x48beb2){logger['error'](_0x93e3('0x28'),_0x48beb2[_0x93e3('0x1b')],_0x1e65b2);_0x46b00a(_0x365581[_0x93e3('0x19')](0x1f4,_0x48beb2[_0x93e3('0x1b')]));});});}; \ No newline at end of file +var _0x58a7=['model','ShowFaxQueue','find','where','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map'];(function(_0x195e4a,_0x2e769a){var _0x650a3a=function(_0x24197e){while(--_0x24197e){_0x195e4a['push'](_0x195e4a['shift']());}};_0x650a3a(++_0x2e769a);}(_0x58a7,0x19f));var _0x758a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x58a7[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x758a('0x0'));var util=require('util');var moment=require(_0x758a('0x1'));var BPromise=require(_0x758a('0x2'));var rs=require(_0x758a('0x3'));var fs=require('fs');var Redis=require(_0x758a('0x4'));var db=require(_0x758a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x758a('0x6'))(_0x758a('0x7'));var config=require(_0x758a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x758a('0x9')][_0x758a('0xa')]({'port':0x232a});config['redis']=_[_0x758a('0xb')](config[_0x758a('0xc')],{'host':_0x758a('0xd'),'port':0x18eb});var socket=require(_0x758a('0xe'))(new Redis(config[_0x758a('0xc')]));require(_0x758a('0xf'))[_0x758a('0x10')](socket);function respondWithRpcPromise(_0x532896,_0x55872f,_0x5d1890){return new BPromise(function(_0x28ce27,_0x42208e){return client['request'](_0x532896,_0x5d1890)[_0x758a('0x11')](function(_0x2baa3c){logger[_0x758a('0x12')]('FaxQueue,\x20%s,\x20%s',_0x55872f,_0x758a('0x13'));logger['debug'](_0x758a('0x14'),_0x55872f,_0x758a('0x13'),JSON[_0x758a('0x15')](_0x2baa3c));if(_0x2baa3c[_0x758a('0x16')]){if(_0x2baa3c['error'][_0x758a('0x17')]===0x1f4){logger[_0x758a('0x16')](_0x758a('0x18'),_0x55872f,_0x2baa3c['error'][_0x758a('0x19')]);return _0x42208e(_0x2baa3c[_0x758a('0x16')]['message']);}logger[_0x758a('0x16')](_0x758a('0x18'),_0x55872f,_0x2baa3c[_0x758a('0x16')][_0x758a('0x19')]);return _0x28ce27(_0x2baa3c['error'][_0x758a('0x19')]);}else{logger[_0x758a('0x12')](_0x758a('0x18'),_0x55872f,_0x758a('0x13'));_0x28ce27(_0x2baa3c['result'][_0x758a('0x19')]);}})[_0x758a('0x1a')](function(_0x297298){logger[_0x758a('0x16')]('FaxQueue,\x20%s,\x20%s',_0x55872f,_0x297298);_0x42208e(_0x297298);});});}exports[_0x758a('0x1b')]=function(_0x4d0ab3){var _0x50ce12=this;return new Promise(function(_0x5b5248,_0x1d1497){return db[_0x758a('0x1c')][_0x758a('0x1d')]({'raw':_0x4d0ab3[_0x758a('0x1e')]?_0x4d0ab3[_0x758a('0x1e')][_0x758a('0x1f')]===undefined?!![]:![]:!![],'where':_0x4d0ab3[_0x758a('0x1e')]?_0x4d0ab3['options']['where']||null:null,'attributes':_0x4d0ab3[_0x758a('0x1e')]?_0x4d0ab3[_0x758a('0x1e')][_0x758a('0x20')]||null:null,'limit':_0x4d0ab3[_0x758a('0x1e')]?_0x4d0ab3['options'][_0x758a('0x21')]||null:null,'include':_0x4d0ab3[_0x758a('0x1e')]?_0x4d0ab3[_0x758a('0x1e')][_0x758a('0x22')]?_[_0x758a('0x23')](_0x4d0ab3['options'][_0x758a('0x22')],function(_0x324690){return{'model':db[_0x324690['model']],'as':_0x324690['as'],'attributes':_0x324690[_0x758a('0x20')],'include':_0x324690[_0x758a('0x22')]?_[_0x758a('0x23')](_0x324690['include'],function(_0x23f8bb){return{'model':db[_0x23f8bb[_0x758a('0x24')]],'as':_0x23f8bb['as'],'attributes':_0x23f8bb[_0x758a('0x20')],'include':_0x23f8bb['include']?_[_0x758a('0x23')](_0x23f8bb[_0x758a('0x22')],function(_0x4ba4c3){return{'model':db[_0x4ba4c3[_0x758a('0x24')]],'as':_0x4ba4c3['as'],'attributes':_0x4ba4c3[_0x758a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8a994a){logger['info'](_0x758a('0x1b'),_0x4d0ab3);logger['debug'](_0x758a('0x1b'),_0x4d0ab3,JSON[_0x758a('0x15')](_0x8a994a));_0x5b5248(_0x8a994a);})[_0x758a('0x1a')](function(_0x1e0311){logger[_0x758a('0x16')](_0x758a('0x1b'),_0x1e0311[_0x758a('0x19')],_0x4d0ab3);_0x1d1497(_0x50ce12['error'](0x1f4,_0x1e0311[_0x758a('0x19')]));});});};exports[_0x758a('0x25')]=function(_0x3ab435){var _0x4625cf=this;return new Promise(function(_0x5337b9,_0x25d5b1){return db[_0x758a('0x1c')][_0x758a('0x26')]({'raw':_0x3ab435['options']?_0x3ab435[_0x758a('0x1e')][_0x758a('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ab435['options']?_0x3ab435['options'][_0x758a('0x27')]||null:null,'attributes':_0x3ab435[_0x758a('0x1e')]?_0x3ab435[_0x758a('0x1e')][_0x758a('0x20')]||null:null,'include':_0x3ab435['options']?_0x3ab435[_0x758a('0x1e')]['include']?_[_0x758a('0x23')](_0x3ab435['options']['include'],function(_0x42cd30){return{'model':db[_0x42cd30['model']],'as':_0x42cd30['as'],'attributes':_0x42cd30[_0x758a('0x20')],'include':_0x42cd30[_0x758a('0x22')]?_[_0x758a('0x23')](_0x42cd30[_0x758a('0x22')],function(_0xcf09c){return{'model':db[_0xcf09c[_0x758a('0x24')]],'as':_0xcf09c['as'],'attributes':_0xcf09c[_0x758a('0x20')],'include':_0xcf09c['include']?_['map'](_0xcf09c[_0x758a('0x22')],function(_0x28fa06){return{'model':db[_0x28fa06[_0x758a('0x24')]],'as':_0x28fa06['as'],'attributes':_0x28fa06['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11e5ce){logger[_0x758a('0x12')]('ShowFaxQueue',_0x3ab435);logger[_0x758a('0x28')](_0x758a('0x25'),_0x3ab435,JSON[_0x758a('0x15')](_0x11e5ce));_0x5337b9(_0x11e5ce);})[_0x758a('0x1a')](function(_0x94d956){logger[_0x758a('0x16')](_0x758a('0x25'),_0x94d956[_0x758a('0x19')],_0x3ab435);_0x25d5b1(_0x4625cf[_0x758a('0x16')](0x1f4,_0x94d956[_0x758a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index d0c84af..9f572d1 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 _0xce59=['save','remove','emit','removeListener','length','faxQueue:','./faxQueue.events'];(function(_0x33cb35,_0x6240ef){var _0x50a2ac=function(_0x94b55d){while(--_0x94b55d){_0x33cb35['push'](_0x33cb35['shift']());}};_0x50a2ac(++_0x6240ef);}(_0xce59,0x1d4));var _0x9ce5=function(_0x57b4ad,_0x1f4603){_0x57b4ad=_0x57b4ad-0x0;var _0x5063e6=_0xce59[_0x57b4ad];return _0x5063e6;};'use strict';var FaxQueueEvents=require(_0x9ce5('0x0'));var events=[_0x9ce5('0x1'),_0x9ce5('0x2'),'update'];function createListener(_0x14b971,_0xecf9cc){return function(_0x5b6461){_0xecf9cc[_0x9ce5('0x3')](_0x14b971,_0x5b6461);};}function removeListener(_0x3d9588,_0x474413){return function(){FaxQueueEvents[_0x9ce5('0x4')](_0x3d9588,_0x474413);};}exports['register']=function(_0x140c81){for(var _0x15336b=0x0,_0x2693eb=events[_0x9ce5('0x5')];_0x15336b<_0x2693eb;_0x15336b++){var _0x2560e3=events[_0x15336b];var _0x56360b=createListener(_0x9ce5('0x6')+_0x2560e3,_0x140c81);FaxQueueEvents['on'](_0x2560e3,_0x56360b);}}; \ No newline at end of file +var _0x0b8b=['length','faxQueue:','remove','emit','register'];(function(_0x20976a,_0x48233f){var _0x314b35=function(_0x363c26){while(--_0x363c26){_0x20976a['push'](_0x20976a['shift']());}};_0x314b35(++_0x48233f);}(_0x0b8b,0x174));var _0xb0b8=function(_0x20befa,_0x1d57da){_0x20befa=_0x20befa-0x0;var _0x1da8c6=_0x0b8b[_0x20befa];return _0x1da8c6;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0xb0b8('0x0'),'update'];function createListener(_0x5b1769,_0x520bfb){return function(_0x1b619a){_0x520bfb[_0xb0b8('0x1')](_0x5b1769,_0x1b619a);};}function removeListener(_0x449513,_0x1113ef){return function(){FaxQueueEvents['removeListener'](_0x449513,_0x1113ef);};}exports[_0xb0b8('0x2')]=function(_0x2b680e){for(var _0x29ab3b=0x0,_0x58353d=events[_0xb0b8('0x3')];_0x29ab3b<_0x58353d;_0x29ab3b++){var _0x5bf738=events[_0x29ab3b];var _0x3680e4=createListener(_0xb0b8('0x4')+_0x5bf738,_0x2b680e);FaxQueueEvents['on'](_0x5bf738,_0x3680e4);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 822cc49..acb762d 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(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a66b7,_0x517636){_0x5a66b7=_0x5a66b7-0x0;var _0x5f56e3=_0xb10b[_0x5a66b7];return _0x5f56e3;};'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 _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0xf34b0a,_0x11e116){var _0x5021e1=function(_0x4eff67){while(--_0x4eff67){_0xf34b0a['push'](_0xf34b0a['shift']());}};_0x5021e1(++_0x11e116);}(_0x0b0e,0x187));var _0xe0b0=function(_0x52b91f,_0x499757){_0x52b91f=_0x52b91f-0x0;var _0x15f8f5=_0x0b0e[_0x52b91f];return _0x15f8f5;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index deb81ac..5012ddd 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 _0xbf32=['STRING','DATE','moment','exports'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0xbf32,0x19a));var _0x2bf3=function(_0x14f2e3,_0x3dcb33){_0x14f2e3=_0x14f2e3-0x0;var _0x13140d=_0xbf32[_0x14f2e3];return _0x13140d;};'use strict';var moment=require(_0x2bf3('0x0'));var Sequelize=require('sequelize');module[_0x2bf3('0x1')]={'uniqueid':{'type':Sequelize[_0x2bf3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2bf3('0x2')]},'joinAt':{'type':Sequelize[_0x2bf3('0x3')]},'leaveAt':{'type':Sequelize[_0x2bf3('0x3')]},'acceptAt':{'type':Sequelize[_0x2bf3('0x3')]},'exitAt':{'type':Sequelize[_0x2bf3('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x869b=['STRING','DATE','moment','exports'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x869b,0x186));var _0xb869=function(_0x336953,_0x41b7f0){_0x336953=_0x336953-0x0;var _0x1177db=_0x869b[_0x336953];return _0x1177db;};'use strict';var moment=require(_0xb869('0x0'));var Sequelize=require('sequelize');module[_0xb869('0x1')]={'uniqueid':{'type':Sequelize[_0xb869('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb869('0x2')]},'joinAt':{'type':Sequelize[_0xb869('0x3')]},'leaveAt':{'type':Sequelize[_0xb869('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb869('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index e15b0e8..28cfe79 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 _0x95d2=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','offset','limit','json','apply','save','destroy','end','sendStatus','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','VIRTUAL','merge','options','count','then','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4c3900,_0x93767c){var _0x5e3339=function(_0x272435){while(--_0x272435){_0x4c3900['push'](_0x4c3900['shift']());}};_0x5e3339(++_0x93767c);}(_0x95d2,0xcd));var _0x295d=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x95d2[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0x295d('0x0'));var emlformat=require(_0x295d('0x1'));var rimraf=require(_0x295d('0x2'));var zipdir=require(_0x295d('0x3'));var jsonpatch=require(_0x295d('0x4'));var rp=require(_0x295d('0x5'));var moment=require(_0x295d('0x6'));var BPromise=require(_0x295d('0x7'));var Mustache=require(_0x295d('0x8'));var util=require(_0x295d('0x9'));var path=require(_0x295d('0xa'));var sox=require(_0x295d('0xb'));var csv=require(_0x295d('0xc'));var ejs=require(_0x295d('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x295d('0xe'));var crypto=require('crypto');var jsforce=require(_0x295d('0xf'));var deskjs=require(_0x295d('0x10'));var toCsv=require(_0x295d('0xc'));var querystring=require(_0x295d('0x11'));var Papa=require(_0x295d('0x12'));var Redis=require(_0x295d('0x13'));var authService=require(_0x295d('0x14'));var qs=require(_0x295d('0x15'));var as=require(_0x295d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x295d('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x295d('0x18'));var db=require(_0x295d('0x19'))['db'];function respondWithStatusCode(_0x1546e7,_0x32c4d3){_0x32c4d3=_0x32c4d3||0xcc;return function(_0x5b58c6){if(_0x5b58c6){return _0x1546e7['sendStatus'](_0x32c4d3);}return _0x1546e7[_0x295d('0x1a')](_0x32c4d3)['end']();};}function respondWithResult(_0x4508ea,_0x4d370e){_0x4d370e=_0x4d370e||0xc8;return function(_0x5f5099){if(_0x5f5099){return _0x4508ea[_0x295d('0x1a')](_0x4d370e)['json'](_0x5f5099);}};}function respondWithFilteredResult(_0x164be5,_0x2a0e11){return function(_0x5901a7){if(_0x5901a7){var _0x254b59=_0x5901a7['count'],_0x19e1eb=_0x2a0e11[_0x295d('0x1b')],_0x3b744b=_0x2a0e11[_0x295d('0x1b')]+_0x2a0e11[_0x295d('0x1c')],_0x678237;if(_0x3b744b>=_0x254b59){_0x3b744b=_0x254b59;_0x678237=0xc8;}else{_0x678237=0xce;}_0x164be5[_0x295d('0x1a')](_0x678237);return _0x164be5['set']('Content-Range',_0x19e1eb+'-'+_0x3b744b+'/'+_0x254b59)[_0x295d('0x1d')](_0x5901a7);}return null;};}function patchUpdates(_0x568e44){return function(_0x4ef610){try{jsonpatch[_0x295d('0x1e')](_0x4ef610,_0x568e44,!![]);}catch(_0x18d4a6){return BPromise['reject'](_0x18d4a6);}return _0x4ef610[_0x295d('0x1f')]();};}function saveUpdates(_0x514a71,_0x5740aa){return function(_0x3ddd0a){if(_0x3ddd0a){return _0x3ddd0a['update'](_0x514a71)['then'](function(_0x4c7f91){return _0x4c7f91;});}return null;};}function removeEntity(_0x286f36,_0x40cfd5){return function(_0x5112f4){if(_0x5112f4){return _0x5112f4[_0x295d('0x20')]()['then'](function(){_0x286f36[_0x295d('0x1a')](0xcc)[_0x295d('0x21')]();});}};}function handleEntityNotFound(_0xb05573,_0x2063ba){return function(_0xf99773){if(!_0xf99773){_0xb05573[_0x295d('0x22')](0x194);}return _0xf99773;};}function handleError(_0x5b995b,_0x497d27){_0x497d27=_0x497d27||0x1f4;return function(_0x5767cb){logger[_0x295d('0x23')](_0x5767cb[_0x295d('0x24')]);if(_0x5767cb[_0x295d('0x25')]){delete _0x5767cb[_0x295d('0x25')];}_0x5b995b[_0x295d('0x1a')](_0x497d27)[_0x295d('0x26')](_0x5767cb);};}exports[_0x295d('0x27')]=function(_0xb4c9f9,_0x4f1102){var _0x567ecd={},_0x15a78d={},_0xdd1ac0={'count':0x0,'rows':[]};var _0x1e1f2f=_[_0x295d('0x28')](db[_0x295d('0x29')][_0x295d('0x2a')],function(_0x312584){return{'name':_0x312584[_0x295d('0x2b')],'type':_0x312584[_0x295d('0x2c')][_0x295d('0x2d')]};});_0x15a78d[_0x295d('0x2e')]=_[_0x295d('0x28')](_0x1e1f2f,_0x295d('0x25'));_0x15a78d[_0x295d('0x2f')]=_[_0x295d('0x30')](_0xb4c9f9[_0x295d('0x2f')]);_0x15a78d[_0x295d('0x31')]=_[_0x295d('0x32')](_0x15a78d[_0x295d('0x2e')],_0x15a78d[_0x295d('0x2f')]);_0x567ecd[_0x295d('0x33')]=_['intersection'](_0x15a78d['model'],qs[_0x295d('0x34')](_0xb4c9f9[_0x295d('0x2f')][_0x295d('0x34')]));_0x567ecd['attributes']=_0x567ecd[_0x295d('0x33')][_0x295d('0x35')]?_0x567ecd['attributes']:_0x15a78d[_0x295d('0x2e')];if(!_0xb4c9f9['query']['hasOwnProperty']('nolimit')){_0x567ecd[_0x295d('0x1c')]=qs['limit'](_0xb4c9f9[_0x295d('0x2f')][_0x295d('0x1c')]);_0x567ecd[_0x295d('0x1b')]=qs[_0x295d('0x1b')](_0xb4c9f9['query'][_0x295d('0x1b')]);}_0x567ecd[_0x295d('0x36')]=qs[_0x295d('0x37')](_0xb4c9f9[_0x295d('0x2f')][_0x295d('0x37')]);_0x567ecd[_0x295d('0x38')]=qs[_0x295d('0x31')](_['pick'](_0xb4c9f9['query'],_0x15a78d['filters']),_0x1e1f2f);if(_0xb4c9f9[_0x295d('0x2f')][_0x295d('0x39')]){_0x567ecd[_0x295d('0x38')]=_['merge'](_0x567ecd[_0x295d('0x38')],{'$or':_[_0x295d('0x28')](_0x1e1f2f,function(_0xa643b2){if(_0xa643b2[_0x295d('0x2c')]!==_0x295d('0x3a')){var _0x4f122d={};_0x4f122d[_0xa643b2['name']]={'$like':'%'+_0xb4c9f9['query'][_0x295d('0x39')]+'%'};return _0x4f122d;}})});}_0x567ecd=_[_0x295d('0x3b')]({},_0x567ecd,_0xb4c9f9[_0x295d('0x3c')]);var _0x3fcbbb={'where':_0x567ecd[_0x295d('0x38')]};return db['FaxQueueReport'][_0x295d('0x3d')](_0x3fcbbb)[_0x295d('0x3e')](function(_0xeab74c){_0xdd1ac0[_0x295d('0x3d')]=_0xeab74c;if(_0xb4c9f9[_0x295d('0x2f')][_0x295d('0x3f')]){_0x567ecd[_0x295d('0x40')]=[{'all':!![]}];}return db[_0x295d('0x29')][_0x295d('0x41')](_0x567ecd);})[_0x295d('0x3e')](function(_0x2f4961){_0xdd1ac0[_0x295d('0x42')]=_0x2f4961;return _0xdd1ac0;})[_0x295d('0x3e')](respondWithFilteredResult(_0x4f1102,_0x567ecd))[_0x295d('0x43')](handleError(_0x4f1102,null));};exports[_0x295d('0x44')]=function(_0x261635,_0x300135){var _0x539294={'raw':!![],'where':{'id':_0x261635[_0x295d('0x45')]['id']}},_0x60f991={};_0x60f991[_0x295d('0x2e')]=_[_0x295d('0x30')](db[_0x295d('0x29')][_0x295d('0x2a')]);_0x60f991[_0x295d('0x2f')]=_[_0x295d('0x30')](_0x261635[_0x295d('0x2f')]);_0x60f991['filters']=_['intersection'](_0x60f991[_0x295d('0x2e')],_0x60f991['query']);_0x539294[_0x295d('0x33')]=_['intersection'](_0x60f991[_0x295d('0x2e')],qs['fields'](_0x261635['query'][_0x295d('0x34')]));_0x539294['attributes']=_0x539294[_0x295d('0x33')][_0x295d('0x35')]?_0x539294[_0x295d('0x33')]:_0x60f991['model'];if(_0x261635['query'][_0x295d('0x3f')]){_0x539294[_0x295d('0x40')]=[{'all':!![]}];}_0x539294=_[_0x295d('0x3b')]({},_0x539294,_0x261635[_0x295d('0x3c')]);return db[_0x295d('0x29')]['find'](_0x539294)[_0x295d('0x3e')](handleEntityNotFound(_0x300135,null))[_0x295d('0x3e')](respondWithResult(_0x300135,null))[_0x295d('0x43')](handleError(_0x300135,null));};exports[_0x295d('0x46')]=function(_0x2ec5f6,_0x54c47a){return db['FaxQueueReport'][_0x295d('0x46')](_0x2ec5f6[_0x295d('0x47')],{})[_0x295d('0x3e')](respondWithResult(_0x54c47a,0xc9))[_0x295d('0x43')](handleError(_0x54c47a,null));};exports[_0x295d('0x48')]=function(_0x699a8,_0x414781){if(_0x699a8[_0x295d('0x47')]['id']){delete _0x699a8[_0x295d('0x47')]['id'];}return db[_0x295d('0x29')]['find']({'where':{'id':_0x699a8[_0x295d('0x45')]['id']}})['then'](handleEntityNotFound(_0x414781,null))['then'](saveUpdates(_0x699a8['body'],null))[_0x295d('0x3e')](respondWithResult(_0x414781,null))[_0x295d('0x43')](handleError(_0x414781,null));};exports['destroy']=function(_0x5a3570,_0xd8e628){return db[_0x295d('0x29')][_0x295d('0x49')]({'where':{'id':_0x5a3570[_0x295d('0x45')]['id']}})[_0x295d('0x3e')](handleEntityNotFound(_0xd8e628,null))['then'](removeEntity(_0xd8e628,null))[_0x295d('0x43')](handleError(_0xd8e628,null));};exports[_0x295d('0x4a')]=function(_0x565fe8,_0x362647){return db['FaxQueueReport']['describe']()[_0x295d('0x3e')](respondWithResult(_0x362647,null))[_0x295d('0x43')](handleError(_0x362647,null));}; \ No newline at end of file +var _0x9d42=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','show','params','keys','includeAll','options','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','apply','reject','save','update','destroy','then','sendStatus','name','send','index','FaxQueueReport'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x9d42,0x1c5));var _0x29d4=function(_0x7e2e2e,_0x4ce3b3){_0x7e2e2e=_0x7e2e2e-0x0;var _0x4e69c9=_0x9d42[_0x7e2e2e];return _0x4e69c9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x29d4('0x0'));var zipdir=require(_0x29d4('0x1'));var jsonpatch=require(_0x29d4('0x2'));var rp=require(_0x29d4('0x3'));var moment=require(_0x29d4('0x4'));var BPromise=require(_0x29d4('0x5'));var Mustache=require('mustache');var util=require(_0x29d4('0x6'));var path=require(_0x29d4('0x7'));var sox=require(_0x29d4('0x8'));var csv=require(_0x29d4('0x9'));var ejs=require(_0x29d4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x29d4('0xb'));var crypto=require(_0x29d4('0xc'));var jsforce=require(_0x29d4('0xd'));var deskjs=require(_0x29d4('0xe'));var toCsv=require(_0x29d4('0x9'));var querystring=require(_0x29d4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29d4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29d4('0x11'))(_0x29d4('0x12'));var utils=require('../../config/utils');var config=require(_0x29d4('0x13'));var db=require(_0x29d4('0x14'))['db'];function respondWithStatusCode(_0x25b68d,_0x4b922b){_0x4b922b=_0x4b922b||0xcc;return function(_0x4eb90a){if(_0x4eb90a){return _0x25b68d['sendStatus'](_0x4b922b);}return _0x25b68d[_0x29d4('0x15')](_0x4b922b)[_0x29d4('0x16')]();};}function respondWithResult(_0x111257,_0x3d67ac){_0x3d67ac=_0x3d67ac||0xc8;return function(_0x54c1f7){if(_0x54c1f7){return _0x111257['status'](_0x3d67ac)[_0x29d4('0x17')](_0x54c1f7);}};}function respondWithFilteredResult(_0x476775,_0x2a1450){return function(_0x588489){if(_0x588489){var _0x44f90a=_0x588489[_0x29d4('0x18')],_0x518e4e=_0x2a1450[_0x29d4('0x19')],_0x2aaa4c=_0x2a1450['offset']+_0x2a1450['limit'],_0x4bcf93;if(_0x2aaa4c>=_0x44f90a){_0x2aaa4c=_0x44f90a;_0x4bcf93=0xc8;}else{_0x4bcf93=0xce;}_0x476775['status'](_0x4bcf93);return _0x476775['set']('Content-Range',_0x518e4e+'-'+_0x2aaa4c+'/'+_0x44f90a)['json'](_0x588489);}return null;};}function patchUpdates(_0x4bdb7e){return function(_0xdbc79b){try{jsonpatch[_0x29d4('0x1a')](_0xdbc79b,_0x4bdb7e,!![]);}catch(_0x3d59fb){return BPromise[_0x29d4('0x1b')](_0x3d59fb);}return _0xdbc79b[_0x29d4('0x1c')]();};}function saveUpdates(_0x277dbe,_0x44c293){return function(_0x4e0b12){if(_0x4e0b12){return _0x4e0b12[_0x29d4('0x1d')](_0x277dbe)['then'](function(_0x2be952){return _0x2be952;});}return null;};}function removeEntity(_0x5aa765,_0xd15df7){return function(_0x51339c){if(_0x51339c){return _0x51339c[_0x29d4('0x1e')]()[_0x29d4('0x1f')](function(){_0x5aa765[_0x29d4('0x15')](0xcc)[_0x29d4('0x16')]();});}};}function handleEntityNotFound(_0x2e6697,_0x368006){return function(_0x5a5a35){if(!_0x5a5a35){_0x2e6697[_0x29d4('0x20')](0x194);}return _0x5a5a35;};}function handleError(_0x35d859,_0x42afcd){_0x42afcd=_0x42afcd||0x1f4;return function(_0x31e9a9){logger['error'](_0x31e9a9['stack']);if(_0x31e9a9[_0x29d4('0x21')]){delete _0x31e9a9['name'];}_0x35d859[_0x29d4('0x15')](_0x42afcd)[_0x29d4('0x22')](_0x31e9a9);};}exports[_0x29d4('0x23')]=function(_0x591a4b,_0x562498){var _0x49131a={},_0x489045={},_0x4b8702={'count':0x0,'rows':[]};var _0x5b8f28=_['map'](db[_0x29d4('0x24')][_0x29d4('0x25')],function(_0x5d3efb){return{'name':_0x5d3efb[_0x29d4('0x26')],'type':_0x5d3efb[_0x29d4('0x27')][_0x29d4('0x28')]};});_0x489045[_0x29d4('0x29')]=_['map'](_0x5b8f28,_0x29d4('0x21'));_0x489045[_0x29d4('0x2a')]=_['keys'](_0x591a4b['query']);_0x489045[_0x29d4('0x2b')]=_[_0x29d4('0x2c')](_0x489045['model'],_0x489045['query']);_0x49131a[_0x29d4('0x2d')]=_[_0x29d4('0x2c')](_0x489045[_0x29d4('0x29')],qs['fields'](_0x591a4b[_0x29d4('0x2a')][_0x29d4('0x2e')]));_0x49131a[_0x29d4('0x2d')]=_0x49131a['attributes']['length']?_0x49131a[_0x29d4('0x2d')]:_0x489045['model'];if(!_0x591a4b[_0x29d4('0x2a')][_0x29d4('0x2f')](_0x29d4('0x30'))){_0x49131a[_0x29d4('0x31')]=qs[_0x29d4('0x31')](_0x591a4b[_0x29d4('0x2a')][_0x29d4('0x31')]);_0x49131a['offset']=qs['offset'](_0x591a4b[_0x29d4('0x2a')]['offset']);}_0x49131a['order']=qs[_0x29d4('0x32')](_0x591a4b['query'][_0x29d4('0x32')]);_0x49131a[_0x29d4('0x33')]=qs[_0x29d4('0x2b')](_[_0x29d4('0x34')](_0x591a4b[_0x29d4('0x2a')],_0x489045['filters']),_0x5b8f28);if(_0x591a4b['query'][_0x29d4('0x35')]){_0x49131a[_0x29d4('0x33')]=_[_0x29d4('0x36')](_0x49131a[_0x29d4('0x33')],{'$or':_[_0x29d4('0x37')](_0x5b8f28,function(_0x5bc702){if(_0x5bc702[_0x29d4('0x27')]!==_0x29d4('0x38')){var _0xe1155f={};_0xe1155f[_0x5bc702[_0x29d4('0x21')]]={'$like':'%'+_0x591a4b[_0x29d4('0x2a')][_0x29d4('0x35')]+'%'};return _0xe1155f;}})});}_0x49131a=_[_0x29d4('0x36')]({},_0x49131a,_0x591a4b['options']);var _0x1d4901={'where':_0x49131a[_0x29d4('0x33')]};return db[_0x29d4('0x24')]['count'](_0x1d4901)[_0x29d4('0x1f')](function(_0x1d61ac){_0x4b8702[_0x29d4('0x18')]=_0x1d61ac;if(_0x591a4b[_0x29d4('0x2a')]['includeAll']){_0x49131a[_0x29d4('0x39')]=[{'all':!![]}];}return db[_0x29d4('0x24')][_0x29d4('0x3a')](_0x49131a);})[_0x29d4('0x1f')](function(_0x3c86d4){_0x4b8702[_0x29d4('0x3b')]=_0x3c86d4;return _0x4b8702;})[_0x29d4('0x1f')](respondWithFilteredResult(_0x562498,_0x49131a))['catch'](handleError(_0x562498,null));};exports[_0x29d4('0x3c')]=function(_0x874b48,_0x33da4d){var _0x12d44a={'raw':!![],'where':{'id':_0x874b48[_0x29d4('0x3d')]['id']}},_0x44d3f3={};_0x44d3f3[_0x29d4('0x29')]=_[_0x29d4('0x3e')](db[_0x29d4('0x24')][_0x29d4('0x25')]);_0x44d3f3[_0x29d4('0x2a')]=_[_0x29d4('0x3e')](_0x874b48[_0x29d4('0x2a')]);_0x44d3f3[_0x29d4('0x2b')]=_[_0x29d4('0x2c')](_0x44d3f3[_0x29d4('0x29')],_0x44d3f3[_0x29d4('0x2a')]);_0x12d44a['attributes']=_[_0x29d4('0x2c')](_0x44d3f3[_0x29d4('0x29')],qs[_0x29d4('0x2e')](_0x874b48['query'][_0x29d4('0x2e')]));_0x12d44a[_0x29d4('0x2d')]=_0x12d44a[_0x29d4('0x2d')]['length']?_0x12d44a[_0x29d4('0x2d')]:_0x44d3f3[_0x29d4('0x29')];if(_0x874b48[_0x29d4('0x2a')][_0x29d4('0x3f')]){_0x12d44a[_0x29d4('0x39')]=[{'all':!![]}];}_0x12d44a=_['merge']({},_0x12d44a,_0x874b48[_0x29d4('0x40')]);return db[_0x29d4('0x24')][_0x29d4('0x41')](_0x12d44a)[_0x29d4('0x1f')](handleEntityNotFound(_0x33da4d,null))['then'](respondWithResult(_0x33da4d,null))['catch'](handleError(_0x33da4d,null));};exports['create']=function(_0x252120,_0x2c1ada){return db[_0x29d4('0x24')][_0x29d4('0x42')](_0x252120['body'],{})[_0x29d4('0x1f')](respondWithResult(_0x2c1ada,0xc9))['catch'](handleError(_0x2c1ada,null));};exports[_0x29d4('0x1d')]=function(_0xd38b50,_0x3d947f){if(_0xd38b50[_0x29d4('0x43')]['id']){delete _0xd38b50['body']['id'];}return db[_0x29d4('0x24')][_0x29d4('0x41')]({'where':{'id':_0xd38b50[_0x29d4('0x3d')]['id']}})[_0x29d4('0x1f')](handleEntityNotFound(_0x3d947f,null))[_0x29d4('0x1f')](saveUpdates(_0xd38b50[_0x29d4('0x43')],null))[_0x29d4('0x1f')](respondWithResult(_0x3d947f,null))[_0x29d4('0x44')](handleError(_0x3d947f,null));};exports['destroy']=function(_0x4c8462,_0x3fbd82){return db[_0x29d4('0x24')][_0x29d4('0x41')]({'where':{'id':_0x4c8462[_0x29d4('0x3d')]['id']}})[_0x29d4('0x1f')](handleEntityNotFound(_0x3fbd82,null))[_0x29d4('0x1f')](removeEntity(_0x3fbd82,null))[_0x29d4('0x44')](handleError(_0x3fbd82,null));};exports[_0x29d4('0x45')]=function(_0x50e3fb,_0x3f8d54){return db['FaxQueueReport'][_0x29d4('0x45')]()[_0x29d4('0x1f')](respondWithResult(_0x3f8d54,null))[_0x29d4('0x44')](handleError(_0x3f8d54,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f7a9b89..e1a12fd 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 _0x15ef=['request-promise','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15ef,0x80));var _0xf15e=function(_0x1b02a6,_0x2d7378){_0x1b02a6=_0x1b02a6-0x0;var _0x5bea08=_0x15ef[_0x1b02a6];return _0x5bea08;};'use strict';var _=require('lodash');var util=require(_0xf15e('0x0'));var logger=require(_0xf15e('0x1'))('api');var moment=require(_0xf15e('0x2'));var BPromise=require(_0xf15e('0x3'));var rp=require(_0xf15e('0x4'));var fs=require('fs');var path=require(_0xf15e('0x5'));var rimraf=require(_0xf15e('0x6'));var config=require('../../config/environment');var attributes=require(_0xf15e('0x7'));module[_0xf15e('0x8')]=function(_0x5e96b4,_0x5ba863){return _0x5e96b4[_0xf15e('0x9')](_0xf15e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xf15e('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f44=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid'];(function(_0x472dde,_0x447587){var _0x44cb2a=function(_0x1b8200){while(--_0x1b8200){_0x472dde['push'](_0x472dde['shift']());}};_0x44cb2a(++_0x447587);}(_0x6f44,0x1ea));var _0x46f4=function(_0x4e9e13,_0x5310af){_0x4e9e13=_0x4e9e13-0x0;var _0x3aad47=_0x6f44[_0x4e9e13];return _0x3aad47;};'use strict';var _=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var logger=require('../../config/logger')(_0x46f4('0x2'));var moment=require(_0x46f4('0x3'));var BPromise=require(_0x46f4('0x4'));var rp=require(_0x46f4('0x5'));var fs=require('fs');var path=require(_0x46f4('0x6'));var rimraf=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var attributes=require(_0x46f4('0x9'));module[_0x46f4('0xa')]=function(_0x57f1a9,_0x169a5a){return _0x57f1a9[_0x46f4('0xb')](_0x46f4('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x46f4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 6179562..9537b8f 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 _0xd265=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','debug','UpdateFaxQueueReport','update','where','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x185d8f,_0x16b7f1){var _0x39072b=function(_0x188220){while(--_0x188220){_0x185d8f['push'](_0x185d8f['shift']());}};_0x39072b(++_0x16b7f1);}(_0xd265,0x17d));var _0x5d26=function(_0x4a072e,_0x13f572){_0x4a072e=_0x4a072e-0x0;var _0x25f5f0=_0xd265[_0x4a072e];return _0x25f5f0;};'use strict';var _=require(_0x5d26('0x0'));var util=require('util');var moment=require(_0x5d26('0x1'));var BPromise=require(_0x5d26('0x2'));var rs=require(_0x5d26('0x3'));var fs=require('fs');var Redis=require(_0x5d26('0x4'));var db=require(_0x5d26('0x5'))['db'];var utils=require(_0x5d26('0x6'));var logger=require('../../config/logger')(_0x5d26('0x7'));var config=require(_0x5d26('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5d26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5121e2,_0x11167,_0x3d7f48){return new BPromise(function(_0x59c489,_0x983e85){return client[_0x5d26('0xa')](_0x5121e2,_0x3d7f48)[_0x5d26('0xb')](function(_0x2ac28b){logger[_0x5d26('0xc')](_0x5d26('0xd'),_0x11167,_0x5d26('0xe'));logger['debug'](_0x5d26('0xf'),_0x11167,_0x5d26('0xe'),JSON[_0x5d26('0x10')](_0x2ac28b));if(_0x2ac28b[_0x5d26('0x11')]){if(_0x2ac28b[_0x5d26('0x11')][_0x5d26('0x12')]===0x1f4){logger[_0x5d26('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x11167,_0x2ac28b['error'][_0x5d26('0x13')]);return _0x983e85(_0x2ac28b['error'][_0x5d26('0x13')]);}logger[_0x5d26('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x11167,_0x2ac28b[_0x5d26('0x11')][_0x5d26('0x13')]);return _0x59c489(_0x2ac28b[_0x5d26('0x11')][_0x5d26('0x13')]);}else{logger[_0x5d26('0xc')](_0x5d26('0xd'),_0x11167,_0x5d26('0xe'));_0x59c489(_0x2ac28b[_0x5d26('0x14')][_0x5d26('0x13')]);}})[_0x5d26('0x15')](function(_0x3fdb49){logger[_0x5d26('0x11')](_0x5d26('0xd'),_0x11167,_0x3fdb49);_0x983e85(_0x3fdb49);});});}exports[_0x5d26('0x16')]=function(_0x4425be){var _0x2ba0e7=this;return new Promise(function(_0x5b9975,_0x4b7b52){return db[_0x5d26('0x17')][_0x5d26('0x18')](_0x4425be[_0x5d26('0x19')],{'raw':_0x4425be[_0x5d26('0x1a')]?_0x4425be['options'][_0x5d26('0x1b')]===undefined?!![]:![]:!![]})[_0x5d26('0xb')](function(_0x12ab97){logger['info'](_0x5d26('0x16'),_0x4425be);logger[_0x5d26('0x1c')](_0x5d26('0x16'),_0x4425be,JSON[_0x5d26('0x10')](_0x12ab97));_0x5b9975(_0x12ab97);})[_0x5d26('0x15')](function(_0x133c40){logger[_0x5d26('0x11')](_0x5d26('0x16'),_0x133c40[_0x5d26('0x13')],_0x4425be);_0x4b7b52(_0x2ba0e7[_0x5d26('0x11')](0x1f4,_0x133c40[_0x5d26('0x13')]));});});};exports[_0x5d26('0x1d')]=function(_0x1e7da9){var _0xc179b8=this;return new Promise(function(_0x486fa5,_0x4028fa){return db[_0x5d26('0x17')][_0x5d26('0x1e')](_0x1e7da9[_0x5d26('0x19')],{'raw':_0x1e7da9[_0x5d26('0x1a')]?_0x1e7da9['options'][_0x5d26('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e7da9['options']?_0x1e7da9[_0x5d26('0x1a')][_0x5d26('0x1f')]||null:null,'attributes':_0x1e7da9[_0x5d26('0x1a')]?_0x1e7da9['options'][_0x5d26('0x20')]||null:null,'limit':_0x1e7da9[_0x5d26('0x1a')]?_0x1e7da9[_0x5d26('0x1a')]['limit']||null:null})['then'](function(_0x4f0c28){logger['info'](_0x5d26('0x1d'),_0x1e7da9);logger[_0x5d26('0x1c')]('UpdateFaxQueueReport',_0x1e7da9,JSON[_0x5d26('0x10')](_0x4f0c28));_0x486fa5(_0x4f0c28);})[_0x5d26('0x15')](function(_0x5310e0){logger[_0x5d26('0x11')](_0x5d26('0x1d'),_0x5310e0[_0x5d26('0x13')],_0x1e7da9);_0x4028fa(_0xc179b8[_0x5d26('0x11')](0x1f4,_0x5310e0[_0x5d26('0x13')]));});});}; \ No newline at end of file +var _0x968d=['util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','update','body','where','limit','lodash'];(function(_0x18d06a,_0x8ef0fe){var _0x2d8675=function(_0x1680c8){while(--_0x1680c8){_0x18d06a['push'](_0x18d06a['shift']());}};_0x2d8675(++_0x8ef0fe);}(_0x968d,0x18b));var _0xd968=function(_0x111164,_0x48487f){_0x111164=_0x111164-0x0;var _0x532f6e=_0x968d[_0x111164];return _0x532f6e;};'use strict';var _=require(_0xd968('0x0'));var util=require(_0xd968('0x1'));var moment=require(_0xd968('0x2'));var BPromise=require(_0xd968('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd968('0x4'));var logger=require(_0xd968('0x5'))(_0xd968('0x6'));var config=require(_0xd968('0x7'));var jayson=require(_0xd968('0x8'));var client=jayson['client'][_0xd968('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a219e,_0x4c4460,_0x5b5431){return new BPromise(function(_0x4944c8,_0x230f11){return client[_0xd968('0xa')](_0x3a219e,_0x5b5431)[_0xd968('0xb')](function(_0x107a73){logger['info'](_0xd968('0xc'),_0x4c4460,_0xd968('0xd'));logger[_0xd968('0xe')](_0xd968('0xf'),_0x4c4460,'request\x20sent',JSON[_0xd968('0x10')](_0x107a73));if(_0x107a73[_0xd968('0x11')]){if(_0x107a73['error'][_0xd968('0x12')]===0x1f4){logger[_0xd968('0x11')](_0xd968('0xc'),_0x4c4460,_0x107a73[_0xd968('0x11')][_0xd968('0x13')]);return _0x230f11(_0x107a73['error'][_0xd968('0x13')]);}logger[_0xd968('0x11')](_0xd968('0xc'),_0x4c4460,_0x107a73[_0xd968('0x11')]['message']);return _0x4944c8(_0x107a73['error'][_0xd968('0x13')]);}else{logger[_0xd968('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x4c4460,_0xd968('0xd'));_0x4944c8(_0x107a73[_0xd968('0x15')][_0xd968('0x13')]);}})[_0xd968('0x16')](function(_0x58e2c8){logger[_0xd968('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x4c4460,_0x58e2c8);_0x230f11(_0x58e2c8);});});}exports[_0xd968('0x17')]=function(_0x3fb9a8){var _0x407909=this;return new Promise(function(_0x326b14,_0xaa0388){return db[_0xd968('0x18')][_0xd968('0x19')](_0x3fb9a8['body'],{'raw':_0x3fb9a8[_0xd968('0x1a')]?_0x3fb9a8[_0xd968('0x1a')][_0xd968('0x1b')]===undefined?!![]:![]:!![]})[_0xd968('0xb')](function(_0x170646){logger[_0xd968('0x14')]('CreateFaxQueueReport',_0x3fb9a8);logger[_0xd968('0xe')](_0xd968('0x17'),_0x3fb9a8,JSON[_0xd968('0x10')](_0x170646));_0x326b14(_0x170646);})[_0xd968('0x16')](function(_0x540a90){logger[_0xd968('0x11')](_0xd968('0x17'),_0x540a90['message'],_0x3fb9a8);_0xaa0388(_0x407909[_0xd968('0x11')](0x1f4,_0x540a90[_0xd968('0x13')]));});});};exports[_0xd968('0x1c')]=function(_0x1b5411){var _0x51cab8=this;return new Promise(function(_0x514a5e,_0x3fc02a){return db[_0xd968('0x18')][_0xd968('0x1d')](_0x1b5411[_0xd968('0x1e')],{'raw':_0x1b5411[_0xd968('0x1a')]?_0x1b5411[_0xd968('0x1a')][_0xd968('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b5411['options']?_0x1b5411[_0xd968('0x1a')][_0xd968('0x1f')]||null:null,'attributes':_0x1b5411[_0xd968('0x1a')]?_0x1b5411[_0xd968('0x1a')]['attributes']||null:null,'limit':_0x1b5411['options']?_0x1b5411['options'][_0xd968('0x20')]||null:null})['then'](function(_0x2e41e1){logger[_0xd968('0x14')](_0xd968('0x1c'),_0x1b5411);logger['debug'](_0xd968('0x1c'),_0x1b5411,JSON['stringify'](_0x2e41e1));_0x514a5e(_0x2e41e1);})[_0xd968('0x16')](function(_0x1a0f90){logger[_0xd968('0x11')](_0xd968('0x1c'),_0x1a0f90['message'],_0x1b5411);_0x3fc02a(_0x51cab8['error'](0x1f4,_0x1a0f90[_0xd968('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 44bfc1f..bec9f90 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 _0xa5e4=['/:id','show','put','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0xa5e4,0xd7));var _0x4a5e=function(_0x28ed2e,_0x48be94){_0x28ed2e=_0x28ed2e-0x0;var _0x160019=_0xa5e4[_0x28ed2e];return _0x160019;};'use strict';var multer=require(_0x4a5e('0x0'));var util=require('util');var path=require(_0x4a5e('0x1'));var timeout=require(_0x4a5e('0x2'));var express=require(_0x4a5e('0x3'));var router=express['Router']();var auth=require(_0x4a5e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4a5e('0x5'));var controller=require('./faxQueueReport.controller');router[_0x4a5e('0x6')]('/',auth[_0x4a5e('0x7')](),controller[_0x4a5e('0x8')]);router[_0x4a5e('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x4a5e('0x9')]);router[_0x4a5e('0x6')](_0x4a5e('0xa'),auth[_0x4a5e('0x7')](),controller[_0x4a5e('0xb')]);router['post']('/',auth[_0x4a5e('0x7')](),controller['create']);router[_0x4a5e('0xc')](_0x4a5e('0xa'),auth[_0x4a5e('0x7')](),controller['update']);router['delete'](_0x4a5e('0xa'),auth[_0x4a5e('0x7')](),controller[_0x4a5e('0xd')]);module[_0x4a5e('0xe')]=router; \ No newline at end of file +var _0xb311=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete'];(function(_0x3e704c,_0x4db64e){var _0x835691=function(_0x1a2182){while(--_0x1a2182){_0x3e704c['push'](_0x3e704c['shift']());}};_0x835691(++_0x4db64e);}(_0xb311,0x18e));var _0x1b31=function(_0x4e77e5,_0x702cd3){_0x4e77e5=_0x4e77e5-0x0;var _0x46e60d=_0xb311[_0x4e77e5];return _0x46e60d;};'use strict';var multer=require(_0x1b31('0x0'));var util=require('util');var path=require(_0x1b31('0x1'));var timeout=require(_0x1b31('0x2'));var express=require(_0x1b31('0x3'));var router=express[_0x1b31('0x4')]();var auth=require(_0x1b31('0x5'));var interaction=require(_0x1b31('0x6'));var config=require(_0x1b31('0x7'));var controller=require(_0x1b31('0x8'));router[_0x1b31('0x9')]('/',auth['isAuthenticated'](),controller[_0x1b31('0xa')]);router[_0x1b31('0x9')](_0x1b31('0xb'),auth[_0x1b31('0xc')](),controller[_0x1b31('0xd')]);router[_0x1b31('0x9')](_0x1b31('0xe'),auth['isAuthenticated'](),controller[_0x1b31('0xf')]);router[_0x1b31('0x10')]('/',auth[_0x1b31('0xc')](),controller[_0x1b31('0x11')]);router['put']('/:id',auth[_0x1b31('0xc')](),controller[_0x1b31('0x12')]);router[_0x1b31('0x13')](_0x1b31('0xe'),auth[_0x1b31('0xc')](),controller[_0x1b31('0x14')]);module[_0x1b31('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 9a2ec8a..8602f75 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 _0x774f=['moment','sequelize','exports','STRING','ENUM','account','queue','NOW'];(function(_0xd623c4,_0x5c9bb6){var _0x1899a5=function(_0x25186d){while(--_0x25186d){_0xd623c4['push'](_0xd623c4['shift']());}};_0x1899a5(++_0x5c9bb6);}(_0x774f,0xf0));var _0xf774=function(_0x68fdfa,_0x3223c7){_0x68fdfa=_0x68fdfa-0x0;var _0x5281a2=_0x774f[_0x68fdfa];return _0x5281a2;};'use strict';var moment=require(_0xf774('0x0'));var Sequelize=require(_0xf774('0x1'));module[_0xf774('0x2')]={'uniqueid':{'type':Sequelize[_0xf774('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf774('0x4')](_0xf774('0x5'),'agent',_0xf774('0x6')),'allowNull':![],'defaultValue':_0xf774('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf774('0x7')]}}; \ No newline at end of file +var _0x97a7=['NOW','moment','sequelize','exports','ENUM','account','agent','queue'];(function(_0x3d1cce,_0x4bc6df){var _0x4d2146=function(_0x5a5282){while(--_0x5a5282){_0x3d1cce['push'](_0x3d1cce['shift']());}};_0x4d2146(++_0x4bc6df);}(_0x97a7,0x151));var _0x797a=function(_0x1b83c0,_0x452121){_0x1b83c0=_0x1b83c0-0x0;var _0x4b7bf0=_0x97a7[_0x1b83c0];return _0x4b7bf0;};'use strict';var moment=require(_0x797a('0x0'));var Sequelize=require(_0x797a('0x1'));module[_0x797a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x797a('0x3')](_0x797a('0x4'),_0x797a('0x5'),'queue'),'allowNull':![],'defaultValue':_0x797a('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x797a('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 326efc6..c9681c9 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 _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(_0x202d0f,_0x9ec743){var _0xfc464c=function(_0x49446b){while(--_0x49446b){_0x202d0f['push'](_0x202d0f['shift']());}};_0xfc464c(++_0x9ec743);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'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 +var _0xdb28=['Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','merge','VIRTUAL','options','where','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','limit','set'];(function(_0x21b48b,_0x1290a4){var _0x2e35a8=function(_0x4f47b9){while(--_0x4f47b9){_0x21b48b['push'](_0x21b48b['shift']());}};_0x2e35a8(++_0x1290a4);}(_0xdb28,0x106));var _0x8db2=function(_0x547261,_0x233065){_0x547261=_0x547261-0x0;var _0x5d8ac4=_0xdb28[_0x547261];return _0x5d8ac4;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var db=require(_0x8db2('0x17'))['db'];function respondWithStatusCode(_0x1349f6,_0x204f49){_0x204f49=_0x204f49||0xcc;return function(_0x37d017){if(_0x37d017){return _0x1349f6['sendStatus'](_0x204f49);}return _0x1349f6['status'](_0x204f49)[_0x8db2('0x18')]();};}function respondWithResult(_0x15e87c,_0x350d61){_0x350d61=_0x350d61||0xc8;return function(_0x1d6a15){if(_0x1d6a15){return _0x15e87c[_0x8db2('0x19')](_0x350d61)[_0x8db2('0x1a')](_0x1d6a15);}};}function respondWithFilteredResult(_0x2f177a,_0x3c96a7){return function(_0x131252){if(_0x131252){var _0x16c8c2=_0x131252['count'],_0x5489a9=_0x3c96a7[_0x8db2('0x1b')],_0x13b0f5=_0x3c96a7[_0x8db2('0x1b')]+_0x3c96a7[_0x8db2('0x1c')],_0x24da1b;if(_0x13b0f5>=_0x16c8c2){_0x13b0f5=_0x16c8c2;_0x24da1b=0xc8;}else{_0x24da1b=0xce;}_0x2f177a[_0x8db2('0x19')](_0x24da1b);return _0x2f177a[_0x8db2('0x1d')](_0x8db2('0x1e'),_0x5489a9+'-'+_0x13b0f5+'/'+_0x16c8c2)['json'](_0x131252);}return null;};}function patchUpdates(_0x5df464){return function(_0x77789){try{jsonpatch[_0x8db2('0x1f')](_0x77789,_0x5df464,!![]);}catch(_0x1310d3){return BPromise[_0x8db2('0x20')](_0x1310d3);}return _0x77789['save']();};}function saveUpdates(_0x431d60,_0x36a9ff){return function(_0x260940){if(_0x260940){return _0x260940[_0x8db2('0x21')](_0x431d60)[_0x8db2('0x22')](function(_0x597260){return _0x597260;});}return null;};}function removeEntity(_0x124467,_0x3e30e6){return function(_0x18f69c){if(_0x18f69c){return _0x18f69c[_0x8db2('0x23')]()[_0x8db2('0x22')](function(){_0x124467[_0x8db2('0x19')](0xcc)[_0x8db2('0x18')]();});}};}function handleEntityNotFound(_0x5c6614,_0x256202){return function(_0x4f6516){if(!_0x4f6516){_0x5c6614['sendStatus'](0x194);}return _0x4f6516;};}function handleError(_0x52a9ca,_0x4d923c){_0x4d923c=_0x4d923c||0x1f4;return function(_0xec8cd2){logger[_0x8db2('0x24')](_0xec8cd2[_0x8db2('0x25')]);if(_0xec8cd2[_0x8db2('0x26')]){delete _0xec8cd2[_0x8db2('0x26')];}_0x52a9ca[_0x8db2('0x19')](_0x4d923c)['send'](_0xec8cd2);};}exports[_0x8db2('0x27')]=function(_0x372311,_0x430dd5){var _0x8b7cec={},_0x483aee={},_0x2e0691={'count':0x0,'rows':[]};var _0x11f398=_[_0x8db2('0x28')](db[_0x8db2('0x29')][_0x8db2('0x2a')],function(_0x21bae5){return{'name':_0x21bae5[_0x8db2('0x2b')],'type':_0x21bae5[_0x8db2('0x2c')][_0x8db2('0x2d')]};});_0x483aee['model']=_[_0x8db2('0x28')](_0x11f398,'name');_0x483aee['query']=_[_0x8db2('0x2e')](_0x372311[_0x8db2('0x2f')]);_0x483aee[_0x8db2('0x30')]=_['intersection'](_0x483aee[_0x8db2('0x31')],_0x483aee['query']);_0x8b7cec[_0x8db2('0x32')]=_[_0x8db2('0x33')](_0x483aee[_0x8db2('0x31')],qs['fields'](_0x372311['query'][_0x8db2('0x34')]));_0x8b7cec[_0x8db2('0x32')]=_0x8b7cec['attributes']['length']?_0x8b7cec[_0x8db2('0x32')]:_0x483aee[_0x8db2('0x31')];if(!_0x372311[_0x8db2('0x2f')][_0x8db2('0x35')](_0x8db2('0x36'))){_0x8b7cec[_0x8db2('0x1c')]=qs[_0x8db2('0x1c')](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1c')]);_0x8b7cec[_0x8db2('0x1b')]=qs['offset'](_0x372311[_0x8db2('0x2f')][_0x8db2('0x1b')]);}_0x8b7cec['order']=qs[_0x8db2('0x37')](_0x372311[_0x8db2('0x2f')]['sort']);_0x8b7cec['where']=qs[_0x8db2('0x30')](_['pick'](_0x372311[_0x8db2('0x2f')],_0x483aee[_0x8db2('0x30')]),_0x11f398);if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]){_0x8b7cec['where']=_[_0x8db2('0x39')](_0x8b7cec['where'],{'$or':_[_0x8db2('0x28')](_0x11f398,function(_0xd550ae){if(_0xd550ae[_0x8db2('0x2c')]!==_0x8db2('0x3a')){var _0x50e88a={};_0x50e88a[_0xd550ae['name']]={'$like':'%'+_0x372311[_0x8db2('0x2f')][_0x8db2('0x38')]+'%'};return _0x50e88a;}})});}_0x8b7cec=_['merge']({},_0x8b7cec,_0x372311[_0x8db2('0x3b')]);var _0x24bcfe={'where':_0x8b7cec[_0x8db2('0x3c')]};return db['FaxTransferReport'][_0x8db2('0x3d')](_0x24bcfe)[_0x8db2('0x22')](function(_0x953349){_0x2e0691[_0x8db2('0x3d')]=_0x953349;if(_0x372311[_0x8db2('0x2f')][_0x8db2('0x3e')]){_0x8b7cec[_0x8db2('0x3f')]=[{'all':!![]}];}return db[_0x8db2('0x29')][_0x8db2('0x40')](_0x8b7cec);})[_0x8db2('0x22')](function(_0x21cf7c){_0x2e0691[_0x8db2('0x41')]=_0x21cf7c;return _0x2e0691;})[_0x8db2('0x22')](respondWithFilteredResult(_0x430dd5,_0x8b7cec))['catch'](handleError(_0x430dd5,null));};exports[_0x8db2('0x42')]=function(_0x2b2472,_0x5e0382){var _0x49a7ae={'raw':!![],'where':{'id':_0x2b2472['params']['id']}},_0x249c73={};_0x249c73[_0x8db2('0x31')]=_[_0x8db2('0x2e')](db[_0x8db2('0x29')][_0x8db2('0x2a')]);_0x249c73[_0x8db2('0x2f')]=_[_0x8db2('0x2e')](_0x2b2472[_0x8db2('0x2f')]);_0x249c73['filters']=_[_0x8db2('0x33')](_0x249c73[_0x8db2('0x31')],_0x249c73[_0x8db2('0x2f')]);_0x49a7ae[_0x8db2('0x32')]=_['intersection'](_0x249c73[_0x8db2('0x31')],qs[_0x8db2('0x34')](_0x2b2472[_0x8db2('0x2f')][_0x8db2('0x34')]));_0x49a7ae['attributes']=_0x49a7ae[_0x8db2('0x32')]['length']?_0x49a7ae[_0x8db2('0x32')]:_0x249c73[_0x8db2('0x31')];if(_0x2b2472[_0x8db2('0x2f')]['includeAll']){_0x49a7ae['include']=[{'all':!![]}];}_0x49a7ae=_[_0x8db2('0x39')]({},_0x49a7ae,_0x2b2472['options']);return db[_0x8db2('0x29')][_0x8db2('0x43')](_0x49a7ae)[_0x8db2('0x22')](handleEntityNotFound(_0x5e0382,null))[_0x8db2('0x22')](respondWithResult(_0x5e0382,null))[_0x8db2('0x44')](handleError(_0x5e0382,null));};exports[_0x8db2('0x45')]=function(_0x4355e2,_0xab6bdd){return db[_0x8db2('0x29')][_0x8db2('0x45')](_0x4355e2[_0x8db2('0x46')],{})[_0x8db2('0x22')](respondWithResult(_0xab6bdd,0xc9))['catch'](handleError(_0xab6bdd,null));};exports[_0x8db2('0x21')]=function(_0x2ada52,_0xdbba64){if(_0x2ada52[_0x8db2('0x46')]['id']){delete _0x2ada52['body']['id'];}return db['FaxTransferReport'][_0x8db2('0x43')]({'where':{'id':_0x2ada52[_0x8db2('0x47')]['id']}})[_0x8db2('0x22')](handleEntityNotFound(_0xdbba64,null))['then'](saveUpdates(_0x2ada52['body'],null))['then'](respondWithResult(_0xdbba64,null))[_0x8db2('0x44')](handleError(_0xdbba64,null));};exports[_0x8db2('0x23')]=function(_0x55c7dd,_0x383fa1){return db[_0x8db2('0x29')][_0x8db2('0x43')]({'where':{'id':_0x55c7dd[_0x8db2('0x47')]['id']}})['then'](handleEntityNotFound(_0x383fa1,null))['then'](removeEntity(_0x383fa1,null))[_0x8db2('0x44')](handleError(_0x383fa1,null));};exports[_0x8db2('0x48')]=function(_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x29')][_0x8db2('0x48')]()[_0x8db2('0x22')](respondWithResult(_0x2f0bd0,null))[_0x8db2('0x44')](handleError(_0x2f0bd0,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 8443e7a..08c86ec 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 _0x0419=['moment','bluebird','request-promise','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','../../config/logger','api'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x0419,0x153));var _0x9041=function(_0x4b1cd7,_0x27b641){_0x4b1cd7=_0x4b1cd7-0x0;var _0x400e61=_0x0419[_0x4b1cd7];return _0x400e61;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9041('0x0'))(_0x9041('0x1'));var moment=require(_0x9041('0x2'));var BPromise=require(_0x9041('0x3'));var rp=require(_0x9041('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9041('0x5'));var attributes=require(_0x9041('0x6'));module[_0x9041('0x7')]=function(_0x1be327,_0x570cdf){return _0x1be327[_0x9041('0x8')](_0x9041('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9041('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa244=['request-promise','path','rimraf','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2827eb,_0x54f4d0){var _0x495ae1=function(_0x310057){while(--_0x310057){_0x2827eb['push'](_0x2827eb['shift']());}};_0x495ae1(++_0x54f4d0);}(_0xa244,0xf1));var _0x4a24=function(_0x22fc70,_0x2a7484){_0x22fc70=_0x22fc70-0x0;var _0xb37f8=_0xa244[_0x22fc70];return _0xb37f8;};'use strict';var _=require(_0x4a24('0x0'));var util=require(_0x4a24('0x1'));var logger=require(_0x4a24('0x2'))(_0x4a24('0x3'));var moment=require(_0x4a24('0x4'));var BPromise=require(_0x4a24('0x5'));var rp=require(_0x4a24('0x6'));var fs=require('fs');var path=require(_0x4a24('0x7'));var rimraf=require(_0x4a24('0x8'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x4a24('0x9')]=function(_0x52ce20,_0x29f3f9){return _0x52ce20[_0x4a24('0xa')]('FaxTransferReport',attributes,{'tableName':_0x4a24('0xb'),'paranoid':![],'indexes':[{'name':_0x4a24('0xc'),'fields':[_0x4a24('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 1708082..e9efd3e 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 _0x0cbb=['info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3bc7b7,_0x15f4e7){var _0x40c574=function(_0x3202c9){while(--_0x3202c9){_0x3bc7b7['push'](_0x3bc7b7['shift']());}};_0x40c574(++_0x15f4e7);}(_0x0cbb,0x136));var _0xb0cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cbb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb0cb('0x0'));var moment=require(_0xb0cb('0x1'));var BPromise=require('bluebird');var rs=require(_0xb0cb('0x2'));var fs=require('fs');var Redis=require(_0xb0cb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb0cb('0x4'));var logger=require(_0xb0cb('0x5'))(_0xb0cb('0x6'));var config=require(_0xb0cb('0x7'));var jayson=require(_0xb0cb('0x8'));var client=jayson[_0xb0cb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x983e78,_0x5444e6,_0x48c400){return new BPromise(function(_0x312c23,_0x37843c){return client[_0xb0cb('0xa')](_0x983e78,_0x48c400)[_0xb0cb('0xb')](function(_0x380ffd){logger[_0xb0cb('0xc')](_0xb0cb('0xd'),_0x5444e6,_0xb0cb('0xe'));logger[_0xb0cb('0xf')](_0xb0cb('0x10'),_0x5444e6,_0xb0cb('0xe'),JSON[_0xb0cb('0x11')](_0x380ffd));if(_0x380ffd[_0xb0cb('0x12')]){if(_0x380ffd[_0xb0cb('0x12')][_0xb0cb('0x13')]===0x1f4){logger['error'](_0xb0cb('0xd'),_0x5444e6,_0x380ffd[_0xb0cb('0x12')]['message']);return _0x37843c(_0x380ffd['error'][_0xb0cb('0x14')]);}logger[_0xb0cb('0x12')](_0xb0cb('0xd'),_0x5444e6,_0x380ffd[_0xb0cb('0x12')]['message']);return _0x312c23(_0x380ffd[_0xb0cb('0x12')][_0xb0cb('0x14')]);}else{logger[_0xb0cb('0xc')](_0xb0cb('0xd'),_0x5444e6,_0xb0cb('0xe'));_0x312c23(_0x380ffd[_0xb0cb('0x15')]['message']);}})[_0xb0cb('0x16')](function(_0x163cbb){logger[_0xb0cb('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5444e6,_0x163cbb);_0x37843c(_0x163cbb);});});} \ No newline at end of file +var _0xf03b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3d3d7b,_0x5c0937){var _0x33e7c8=function(_0xe0ee81){while(--_0xe0ee81){_0x3d3d7b['push'](_0x3d3d7b['shift']());}};_0x33e7c8(++_0x5c0937);}(_0xf03b,0x73));var _0xbf03=function(_0xde8e3e,_0x542c5c){_0xde8e3e=_0xde8e3e-0x0;var _0x228940=_0xf03b[_0xde8e3e];return _0x228940;};'use strict';var _=require(_0xbf03('0x0'));var util=require(_0xbf03('0x1'));var moment=require(_0xbf03('0x2'));var BPromise=require(_0xbf03('0x3'));var rs=require(_0xbf03('0x4'));var fs=require('fs');var Redis=require(_0xbf03('0x5'));var db=require(_0xbf03('0x6'))['db'];var utils=require(_0xbf03('0x7'));var logger=require(_0xbf03('0x8'))(_0xbf03('0x9'));var config=require(_0xbf03('0xa'));var jayson=require(_0xbf03('0xb'));var client=jayson[_0xbf03('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x84e900,_0x43b502,_0x448dd2){return new BPromise(function(_0x18c322,_0x33d5e0){return client[_0xbf03('0xd')](_0x84e900,_0x448dd2)['then'](function(_0x407b72){logger[_0xbf03('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x43b502,_0xbf03('0xf'));logger[_0xbf03('0x10')](_0xbf03('0x11'),_0x43b502,_0xbf03('0xf'),JSON[_0xbf03('0x12')](_0x407b72));if(_0x407b72['error']){if(_0x407b72['error'][_0xbf03('0x13')]===0x1f4){logger[_0xbf03('0x14')](_0xbf03('0x15'),_0x43b502,_0x407b72['error'][_0xbf03('0x16')]);return _0x33d5e0(_0x407b72['error'][_0xbf03('0x16')]);}logger[_0xbf03('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x43b502,_0x407b72[_0xbf03('0x14')]['message']);return _0x18c322(_0x407b72[_0xbf03('0x14')][_0xbf03('0x16')]);}else{logger[_0xbf03('0xe')](_0xbf03('0x15'),_0x43b502,_0xbf03('0xf'));_0x18c322(_0x407b72[_0xbf03('0x17')][_0xbf03('0x16')]);}})['catch'](function(_0x2d765b){logger['error'](_0xbf03('0x15'),_0x43b502,_0x2d765b);_0x33d5e0(_0x2d765b);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index f957c8f..8b47ed1 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 _0xa612=['/describe','describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x16d8fc,_0x24c1dc){var _0x1fe4d3=function(_0x423986){while(--_0x423986){_0x16d8fc['push'](_0x16d8fc['shift']());}};_0x1fe4d3(++_0x24c1dc);}(_0xa612,0x135));var _0x2a61=function(_0x2053de,_0x537549){_0x2053de=_0x2053de-0x0;var _0x78b0a8=_0xa612[_0x2053de];return _0x78b0a8;};'use strict';var multer=require(_0x2a61('0x0'));var util=require(_0x2a61('0x1'));var path=require(_0x2a61('0x2'));var timeout=require(_0x2a61('0x3'));var express=require(_0x2a61('0x4'));var router=express['Router']();var auth=require(_0x2a61('0x5'));var interaction=require(_0x2a61('0x6'));var config=require(_0x2a61('0x7'));var controller=require('./faxTransferReport.controller');router[_0x2a61('0x8')]('/',auth[_0x2a61('0x9')](),controller[_0x2a61('0xa')]);router[_0x2a61('0x8')](_0x2a61('0xb'),auth[_0x2a61('0x9')](),controller[_0x2a61('0xc')]);router[_0x2a61('0x8')](_0x2a61('0xd'),auth[_0x2a61('0x9')](),controller[_0x2a61('0xe')]);router[_0x2a61('0xf')]('/',auth[_0x2a61('0x9')](),controller['create']);router[_0x2a61('0x10')](_0x2a61('0xd'),auth[_0x2a61('0x9')](),controller[_0x2a61('0x11')]);router['delete'](_0x2a61('0xd'),auth[_0x2a61('0x9')](),controller[_0x2a61('0x12')]);module[_0x2a61('0x13')]=router; \ No newline at end of file +var _0x4a06=['create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x4a06,0xfb));var _0x64a0=function(_0x1933a8,_0x50f4e3){_0x1933a8=_0x1933a8-0x0;var _0xcd0d85=_0x4a06[_0x1933a8];return _0xcd0d85;};'use strict';var multer=require(_0x64a0('0x0'));var util=require('util');var path=require(_0x64a0('0x1'));var timeout=require(_0x64a0('0x2'));var express=require(_0x64a0('0x3'));var router=express[_0x64a0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x64a0('0x5'));var config=require(_0x64a0('0x6'));var controller=require(_0x64a0('0x7'));router[_0x64a0('0x8')]('/',auth[_0x64a0('0x9')](),controller[_0x64a0('0xa')]);router[_0x64a0('0x8')](_0x64a0('0xb'),auth[_0x64a0('0x9')](),controller['describe']);router[_0x64a0('0x8')](_0x64a0('0xc'),auth['isAuthenticated'](),controller[_0x64a0('0xd')]);router[_0x64a0('0xe')]('/',auth[_0x64a0('0x9')](),controller[_0x64a0('0xf')]);router[_0x64a0('0x10')](_0x64a0('0xc'),auth[_0x64a0('0x9')](),controller[_0x64a0('0x11')]);router[_0x64a0('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 85213fe..e2f2ee6 100644 --- a/server/api/intDeskAccount/index.js +++ b/server/api/intDeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7118=['get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7118,0x159));var _0x8711=function(_0x22be03,_0x18e77a){_0x22be03=_0x22be03-0x0;var _0x19c887=_0x7118[_0x22be03];return _0x19c887;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8711('0x0'));var timeout=require(_0x8711('0x1'));var express=require('express');var router=express[_0x8711('0x2')]();var auth=require(_0x8711('0x3'));var interaction=require(_0x8711('0x4'));var config=require(_0x8711('0x5'));var controller=require(_0x8711('0x6'));router[_0x8711('0x7')]('/',auth[_0x8711('0x8')](),controller['index']);router[_0x8711('0x7')](_0x8711('0x9'),auth[_0x8711('0x8')](),controller[_0x8711('0xa')]);router[_0x8711('0x7')](_0x8711('0xb'),auth[_0x8711('0x8')](),controller[_0x8711('0xc')]);router[_0x8711('0x7')](_0x8711('0xd'),auth[_0x8711('0x8')](),controller['getFields']);router['post']('/',auth[_0x8711('0x8')](),controller[_0x8711('0xe')]);router[_0x8711('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8711('0x10')]);router[_0x8711('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8711('0x12')]);router[_0x8711('0x13')](_0x8711('0x9'),auth[_0x8711('0x8')](),controller[_0x8711('0x14')]);module[_0x8711('0x15')]=router; \ No newline at end of file +var _0x0e85=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','delete','destroy','multer','util','connect-timeout','express','../../config/environment','get','isAuthenticated','index','show'];(function(_0x5cb3a9,_0x19602b){var _0x343dce=function(_0x4e6aff){while(--_0x4e6aff){_0x5cb3a9['push'](_0x5cb3a9['shift']());}};_0x343dce(++_0x19602b);}(_0x0e85,0x7c));var _0x50e8=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x0e85[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var path=require('path');var timeout=require(_0x50e8('0x2'));var express=require(_0x50e8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x50e8('0x4'));var controller=require('./intDeskAccount.controller');router[_0x50e8('0x5')]('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0x7')]);router[_0x50e8('0x5')]('/:id',auth[_0x50e8('0x6')](),controller[_0x50e8('0x8')]);router[_0x50e8('0x5')](_0x50e8('0x9'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xa')]);router['get'](_0x50e8('0xb'),auth[_0x50e8('0x6')](),controller[_0x50e8('0xc')]);router[_0x50e8('0xd')]('/',auth[_0x50e8('0x6')](),controller[_0x50e8('0xe')]);router[_0x50e8('0xd')](_0x50e8('0x9'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x50e8('0xf')](_0x50e8('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x50e8('0x11')](_0x50e8('0x10'),auth[_0x50e8('0x6')](),controller[_0x50e8('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 27fe8bf..00b0157 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 _0x314f=['ENUM','basic','newTab','exports','STRING'];(function(_0x54463c,_0x1a651b){var _0xd2ccbb=function(_0x1aa5d4){while(--_0x1aa5d4){_0x54463c['push'](_0x54463c['shift']());}};_0xd2ccbb(++_0x1a651b);}(_0x314f,0x1cf));var _0xf314=function(_0x4ba7cb,_0x4c1436){_0x4ba7cb=_0x4ba7cb-0x0;var _0xf8c222=_0x314f[_0x4ba7cb];return _0xf8c222;};'use strict';var Sequelize=require('sequelize');module[_0xf314('0x0')]={'name':{'type':Sequelize[_0xf314('0x1')]},'description':{'type':Sequelize[_0xf314('0x1')]},'username':{'type':Sequelize[_0xf314('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xf314('0x2')](_0xf314('0x3')),'defaultValue':_0xf314('0x3')},'password':{'type':Sequelize[_0xf314('0x1')]},'consumerKey':{'type':Sequelize[_0xf314('0x1')]},'consumerSecret':{'type':Sequelize[_0xf314('0x1')]},'token':{'type':Sequelize[_0xf314('0x1')]},'tokenSecret':{'type':Sequelize[_0xf314('0x1')]},'serverUrl':{'type':Sequelize[_0xf314('0x1')]},'type':{'type':Sequelize[_0xf314('0x2')]('integrationTab',_0xf314('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xc62b=['ENUM','basic','integrationTab','newTab','sequelize','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc62b,0x136));var _0xbc62=function(_0xc4f80a,_0x14cfa1){_0xc4f80a=_0xc4f80a-0x0;var _0x4bcef1=_0xc62b[_0xc4f80a];return _0x4bcef1;};'use strict';var Sequelize=require(_0xbc62('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc62('0x1')]},'description':{'type':Sequelize[_0xbc62('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbc62('0x1')]},'authType':{'type':Sequelize[_0xbc62('0x2')](_0xbc62('0x3')),'defaultValue':_0xbc62('0x3')},'password':{'type':Sequelize[_0xbc62('0x1')]},'consumerKey':{'type':Sequelize[_0xbc62('0x1')]},'consumerSecret':{'type':Sequelize[_0xbc62('0x1')]},'token':{'type':Sequelize[_0xbc62('0x1')]},'tokenSecret':{'type':Sequelize[_0xbc62('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbc62('0x2')](_0xbc62('0x4'),_0xbc62('0x5')),'defaultValue':_0xbc62('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 371de39..d1621e5 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 _0xbfc0=['params','find','create','body','getConfigurations','findOne','DeskConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','authType','username','password','consumerKey','consumerSecret','remoteUri','slice','substring','lastIndexOf','GET','format','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','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~!@#$%^&-_=+[{]}.','then','request\x20sent','debug','stringify','error','DeskAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','show'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xbfc0,0x9e));var _0x0bfc=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0xbfc0[_0x450bf9];return _0x268350;};'use strict';var pdf=require(_0x0bfc('0x0'));var emlformat=require(_0x0bfc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0bfc('0x2'));var rp=require(_0x0bfc('0x3'));var moment=require(_0x0bfc('0x4'));var BPromise=require(_0x0bfc('0x5'));var Mustache=require(_0x0bfc('0x6'));var util=require(_0x0bfc('0x7'));var path=require('path');var sox=require(_0x0bfc('0x8'));var csv=require(_0x0bfc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0bfc('0xa'));var crypto=require(_0x0bfc('0xb'));var jsforce=require(_0x0bfc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0bfc('0x9'));var querystring=require(_0x0bfc('0xd'));var Papa=require(_0x0bfc('0xe'));var Redis=require('ioredis');var authService=require(_0x0bfc('0xf'));var qs=require(_0x0bfc('0x10'));var as=require(_0x0bfc('0x11'));var hardwareService=require(_0x0bfc('0x12'));var logger=require(_0x0bfc('0x13'))(_0x0bfc('0x14'));var utils=require(_0x0bfc('0x15'));var config=require('../../config/environment');var db=require(_0x0bfc('0x16'))['db'];var integrations=require(_0x0bfc('0x17'));var jayson=require(_0x0bfc('0x18'));var client=jayson[_0x0bfc('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x58afab,_0x167a5d,_0xe8c6a4){if(_0xe8c6a4){var _0x4c7a34=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c7a34['test'](_0x167a5d)){return _0x58afab;}else{throw new db['Sequelize'][(_0x0bfc('0x1a'))](_0x0bfc('0x1b'));}}else{return _0x58afab;}}function respondWithRpcPromise(_0xa805ce,_0x10cf7b,_0x418992,_0x47355b){return new BPromise(function(_0x36621c,_0x349efa){var _0x2d1e7a=_0x47355b||client;return _0x2d1e7a['request'](_0xa805ce,_0x418992)[_0x0bfc('0x1c')](function(_0xe1754c){logger['info']('DeskAccount,\x20%s,\x20%s',_0x10cf7b,_0x0bfc('0x1d'));logger[_0x0bfc('0x1e')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x10cf7b,_0x0bfc('0x1d'),JSON[_0x0bfc('0x1f')](_0xe1754c));if(_0xe1754c['error']){if(_0xe1754c[_0x0bfc('0x20')]['code']===0x1f4){logger['error'](_0x0bfc('0x21'),_0x10cf7b,_0xe1754c[_0x0bfc('0x20')][_0x0bfc('0x22')]);return _0x349efa(_0xe1754c['error'][_0x0bfc('0x22')]);}logger['error'](_0x0bfc('0x21'),_0x10cf7b,_0xe1754c[_0x0bfc('0x20')]['message']);return _0x36621c(_0xe1754c['error'][_0x0bfc('0x22')]);}else{logger['info'](_0x0bfc('0x21'),_0x10cf7b,_0x0bfc('0x1d'));_0x36621c(_0xe1754c[_0x0bfc('0x23')][_0x0bfc('0x22')]);}})[_0x0bfc('0x24')](function(_0x53e9fa){logger[_0x0bfc('0x20')]('DeskAccount,\x20%s,\x20%s',_0x10cf7b,_0x53e9fa);_0x349efa(_0x53e9fa);});});}function respondWithStatusCode(_0x29cd96,_0x1bfe02){_0x1bfe02=_0x1bfe02||0xcc;return function(_0x47ba0e){if(_0x47ba0e){return _0x29cd96['sendStatus'](_0x1bfe02);}return _0x29cd96[_0x0bfc('0x25')](_0x1bfe02)[_0x0bfc('0x26')]();};}function respondWithResult(_0x55837d,_0x2b0948){_0x2b0948=_0x2b0948||0xc8;return function(_0x5c9999){if(_0x5c9999){return _0x55837d['status'](_0x2b0948)[_0x0bfc('0x27')](_0x5c9999);}};}function respondWithFilteredResult(_0x395109,_0xcaa60e){return function(_0x4c760b){if(_0x4c760b){var _0x497e18=_0x4c760b['count'],_0x4a500b=_0xcaa60e[_0x0bfc('0x28')],_0x1b4a73=_0xcaa60e[_0x0bfc('0x28')]+_0xcaa60e['limit'],_0x5a7e70;if(_0x1b4a73>=_0x497e18){_0x1b4a73=_0x497e18;_0x5a7e70=0xc8;}else{_0x5a7e70=0xce;}_0x395109['status'](_0x5a7e70);return _0x395109[_0x0bfc('0x29')](_0x0bfc('0x2a'),_0x4a500b+'-'+_0x1b4a73+'/'+_0x497e18)['json'](_0x4c760b);}return null;};}function patchUpdates(_0x4ae125){return function(_0x591db5){try{jsonpatch[_0x0bfc('0x2b')](_0x591db5,_0x4ae125,!![]);}catch(_0x1e1b4d){return BPromise[_0x0bfc('0x2c')](_0x1e1b4d);}return _0x591db5['save']();};}function saveUpdates(_0x178cbb,_0x13b43a){return function(_0xcfdefe){if(_0xcfdefe){return _0xcfdefe['update'](_0x178cbb)[_0x0bfc('0x1c')](function(_0x1a7092){return _0x1a7092;});}return null;};}function removeEntity(_0x3ca707,_0x384e1d){return function(_0x4ab248){if(_0x4ab248){return _0x4ab248[_0x0bfc('0x2d')]()[_0x0bfc('0x1c')](function(){_0x3ca707[_0x0bfc('0x25')](0xcc)[_0x0bfc('0x26')]();});}};}function handleEntityNotFound(_0x2c31d4,_0x45b51f){return function(_0x49a3c5){if(!_0x49a3c5){_0x2c31d4['sendStatus'](0x194);}return _0x49a3c5;};}function handleError(_0x370653,_0xbbf520){_0xbbf520=_0xbbf520||0x1f4;return function(_0x19d578){logger[_0x0bfc('0x20')](_0x19d578[_0x0bfc('0x2e')]);if(_0x19d578[_0x0bfc('0x2f')]){delete _0x19d578[_0x0bfc('0x2f')];}_0x370653[_0x0bfc('0x25')](_0xbbf520)[_0x0bfc('0x30')](_0x19d578);};}exports[_0x0bfc('0x31')]=function(_0xce12b1,_0x27b01c){var _0x5e4d70={},_0x347e8c={},_0x2fed89={'count':0x0,'rows':[]};var _0x1dee6a=_[_0x0bfc('0x32')](db[_0x0bfc('0x33')][_0x0bfc('0x34')],function(_0x51abee){return{'name':_0x51abee['fieldName'],'type':_0x51abee[_0x0bfc('0x35')][_0x0bfc('0x36')]};});_0x347e8c['model']=_['map'](_0x1dee6a,_0x0bfc('0x2f'));_0x347e8c[_0x0bfc('0x37')]=_[_0x0bfc('0x38')](_0xce12b1[_0x0bfc('0x37')]);_0x347e8c[_0x0bfc('0x39')]=_[_0x0bfc('0x3a')](_0x347e8c[_0x0bfc('0x3b')],_0x347e8c[_0x0bfc('0x37')]);_0x5e4d70['attributes']=_[_0x0bfc('0x3a')](_0x347e8c[_0x0bfc('0x3b')],qs['fields'](_0xce12b1[_0x0bfc('0x37')][_0x0bfc('0x3c')]));_0x5e4d70[_0x0bfc('0x3d')]=_0x5e4d70[_0x0bfc('0x3d')][_0x0bfc('0x3e')]?_0x5e4d70[_0x0bfc('0x3d')]:_0x347e8c[_0x0bfc('0x3b')];if(!_0xce12b1[_0x0bfc('0x37')]['hasOwnProperty'](_0x0bfc('0x3f'))){_0x5e4d70['limit']=qs[_0x0bfc('0x40')](_0xce12b1[_0x0bfc('0x37')][_0x0bfc('0x40')]);_0x5e4d70[_0x0bfc('0x28')]=qs[_0x0bfc('0x28')](_0xce12b1[_0x0bfc('0x37')][_0x0bfc('0x28')]);}_0x5e4d70[_0x0bfc('0x41')]=qs[_0x0bfc('0x42')](_0xce12b1[_0x0bfc('0x37')][_0x0bfc('0x42')]);_0x5e4d70['where']=qs[_0x0bfc('0x39')](_[_0x0bfc('0x43')](_0xce12b1[_0x0bfc('0x37')],_0x347e8c[_0x0bfc('0x39')]),_0x1dee6a);if(_0xce12b1['query'][_0x0bfc('0x44')]){_0x5e4d70[_0x0bfc('0x45')]=_[_0x0bfc('0x46')](_0x5e4d70[_0x0bfc('0x45')],{'$or':_[_0x0bfc('0x32')](_0x1dee6a,function(_0x39d1e3){if(_0x39d1e3['type']!==_0x0bfc('0x47')){var _0xa322f6={};_0xa322f6[_0x39d1e3['name']]={'$like':'%'+_0xce12b1['query'][_0x0bfc('0x44')]+'%'};return _0xa322f6;}})});}_0x5e4d70=_[_0x0bfc('0x46')]({},_0x5e4d70,_0xce12b1[_0x0bfc('0x48')]);var _0xc64742={'where':_0x5e4d70[_0x0bfc('0x45')]};return db['DeskAccount'][_0x0bfc('0x49')](_0xc64742)['then'](function(_0x430135){_0x2fed89[_0x0bfc('0x49')]=_0x430135;if(_0xce12b1[_0x0bfc('0x37')][_0x0bfc('0x4a')]){_0x5e4d70[_0x0bfc('0x4b')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x5e4d70);})['then'](function(_0x422f99){_0x2fed89[_0x0bfc('0x4c')]=_0x422f99;return _0x2fed89;})[_0x0bfc('0x1c')](respondWithFilteredResult(_0x27b01c,_0x5e4d70))['catch'](handleError(_0x27b01c,null));};exports[_0x0bfc('0x4d')]=function(_0x2036cb,_0x4d0bb6){var _0x270cc3={'raw':![],'where':{'id':_0x2036cb[_0x0bfc('0x4e')]['id']}},_0x1e4452={};_0x1e4452[_0x0bfc('0x3b')]=_['keys'](db[_0x0bfc('0x33')][_0x0bfc('0x34')]);_0x1e4452[_0x0bfc('0x37')]=_[_0x0bfc('0x38')](_0x2036cb[_0x0bfc('0x37')]);_0x1e4452['filters']=_[_0x0bfc('0x3a')](_0x1e4452[_0x0bfc('0x3b')],_0x1e4452['query']);_0x270cc3['attributes']=_['intersection'](_0x1e4452[_0x0bfc('0x3b')],qs[_0x0bfc('0x3c')](_0x2036cb[_0x0bfc('0x37')][_0x0bfc('0x3c')]));_0x270cc3['attributes']=_0x270cc3[_0x0bfc('0x3d')][_0x0bfc('0x3e')]?_0x270cc3[_0x0bfc('0x3d')]:_0x1e4452[_0x0bfc('0x3b')];if(_0x2036cb[_0x0bfc('0x37')][_0x0bfc('0x4a')]){_0x270cc3[_0x0bfc('0x4b')]=[{'all':!![]}];}_0x270cc3=_['merge']({},_0x270cc3,_0x2036cb[_0x0bfc('0x48')]);return db[_0x0bfc('0x33')][_0x0bfc('0x4f')](_0x270cc3)['then'](handleEntityNotFound(_0x4d0bb6,null))[_0x0bfc('0x1c')](respondWithResult(_0x4d0bb6,null))[_0x0bfc('0x24')](handleError(_0x4d0bb6,null));};exports[_0x0bfc('0x50')]=function(_0x4adda9,_0x4e9d34){return db[_0x0bfc('0x33')][_0x0bfc('0x50')](_0x4adda9[_0x0bfc('0x51')],{})[_0x0bfc('0x1c')](respondWithResult(_0x4e9d34,0xc9))[_0x0bfc('0x24')](handleError(_0x4e9d34,null));};exports['update']=function(_0x37e13c,_0x14f36c){if(_0x37e13c[_0x0bfc('0x51')]['id']){delete _0x37e13c['body']['id'];}return db[_0x0bfc('0x33')]['find']({'where':{'id':_0x37e13c[_0x0bfc('0x4e')]['id']}})[_0x0bfc('0x1c')](handleEntityNotFound(_0x14f36c,null))['then'](saveUpdates(_0x37e13c[_0x0bfc('0x51')],null))[_0x0bfc('0x1c')](respondWithResult(_0x14f36c,null))[_0x0bfc('0x24')](handleError(_0x14f36c,null));};exports[_0x0bfc('0x2d')]=function(_0x1b409a,_0x26d4c2){return db[_0x0bfc('0x33')][_0x0bfc('0x4f')]({'where':{'id':_0x1b409a['params']['id']}})[_0x0bfc('0x1c')](handleEntityNotFound(_0x26d4c2,null))[_0x0bfc('0x1c')](removeEntity(_0x26d4c2,null))['catch'](handleError(_0x26d4c2,null));};exports[_0x0bfc('0x52')]=function(_0x5d2908,_0x50d22f,_0x36331e){var _0x5108a0={};var _0x24fd43={};var _0x10b544;var _0x537672;return db[_0x0bfc('0x33')][_0x0bfc('0x53')]({'where':{'id':_0x5d2908[_0x0bfc('0x4e')]['id']}})[_0x0bfc('0x1c')](handleEntityNotFound(_0x50d22f,null))[_0x0bfc('0x1c')](function(_0x13f4e3){if(_0x13f4e3){_0x10b544=_0x13f4e3;_0x24fd43[_0x0bfc('0x3b')]=_[_0x0bfc('0x38')](db[_0x0bfc('0x54')]['rawAttributes']);_0x24fd43['query']=_[_0x0bfc('0x38')](_0x5d2908[_0x0bfc('0x37')]);_0x24fd43[_0x0bfc('0x39')]=_['intersection'](_0x24fd43[_0x0bfc('0x3b')],_0x24fd43[_0x0bfc('0x37')]);_0x5108a0[_0x0bfc('0x3d')]=_[_0x0bfc('0x3a')](_0x24fd43[_0x0bfc('0x3b')],qs['fields'](_0x5d2908[_0x0bfc('0x37')][_0x0bfc('0x3c')]));_0x5108a0[_0x0bfc('0x3d')]=_0x5108a0[_0x0bfc('0x3d')][_0x0bfc('0x3e')]?_0x5108a0[_0x0bfc('0x3d')]:_0x24fd43[_0x0bfc('0x3b')];_0x5108a0[_0x0bfc('0x41')]=qs[_0x0bfc('0x42')](_0x5d2908[_0x0bfc('0x37')][_0x0bfc('0x42')]);_0x5108a0['where']=qs[_0x0bfc('0x39')](_['pick'](_0x5d2908['query'],_0x24fd43['filters']));if(_0x5d2908[_0x0bfc('0x37')][_0x0bfc('0x44')]){_0x5108a0['where']=_[_0x0bfc('0x46')](_0x5108a0[_0x0bfc('0x45')],{'$or':_[_0x0bfc('0x32')](_0x5108a0[_0x0bfc('0x3d')],function(_0x5408e5){var _0x306ed4={};_0x306ed4[_0x5408e5]={'$like':'%'+_0x5d2908[_0x0bfc('0x37')][_0x0bfc('0x44')]+'%'};return _0x306ed4;})});}_0x5108a0=_['merge']({},_0x5108a0,_0x5d2908[_0x0bfc('0x48')]);return _0x10b544['getConfigurations'](_0x5108a0);}})[_0x0bfc('0x1c')](function(_0x34b02c){if(_0x34b02c){_0x537672=_0x34b02c[_0x0bfc('0x3e')];if(!_0x5d2908['query']['hasOwnProperty'](_0x0bfc('0x3f'))){_0x5108a0['limit']=qs[_0x0bfc('0x40')](_0x5d2908[_0x0bfc('0x37')][_0x0bfc('0x40')]);_0x5108a0[_0x0bfc('0x28')]=qs[_0x0bfc('0x28')](_0x5d2908[_0x0bfc('0x37')]['offset']);}return _0x10b544[_0x0bfc('0x52')](_0x5108a0);}})[_0x0bfc('0x1c')](function(_0x3d0304){if(_0x3d0304){return _0x3d0304?{'count':_0x537672,'rows':_0x3d0304}:null;}})[_0x0bfc('0x1c')](respondWithResult(_0x50d22f,null))[_0x0bfc('0x24')](handleError(_0x50d22f,null));};exports['addConfiguration']=function(_0x3b72de,_0x14a631,_0x39184b){if(_0x3b72de['body']['id']){delete _0x3b72de[_0x0bfc('0x51')]['id'];}return db[_0x0bfc('0x33')][_0x0bfc('0x53')]({'where':{'id':_0x3b72de['params']['id']}})['then'](handleEntityNotFound(_0x14a631,null))['then'](function(_0x351203){if(_0x351203){_0x3b72de['body'][_0x0bfc('0x55')]=_0x351203['id'];_0x3b72de[_0x0bfc('0x51')][_0x0bfc('0x56')]=integrations['getSubjects'](_0x3b72de['body']['channel'],_0x3b72de['body'][_0x0bfc('0x35')]);_0x3b72de[_0x0bfc('0x51')][_0x0bfc('0x57')]=integrations[_0x0bfc('0x58')](_0x3b72de[_0x0bfc('0x51')][_0x0bfc('0x59')],_0x3b72de[_0x0bfc('0x51')][_0x0bfc('0x35')]);return db[_0x0bfc('0x54')][_0x0bfc('0x50')](_0x3b72de['body'],{'include':[{'model':db[_0x0bfc('0x5a')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x0bfc('0x57')}]});}return null;})[_0x0bfc('0x1c')](respondWithResult(_0x14a631,null))[_0x0bfc('0x24')](handleError(_0x14a631,null));};exports[_0x0bfc('0x5b')]=function(_0x2df263,_0x153eec,_0x591892){var _0x24a375=[{'name':'priority','label':_0x0bfc('0x5c'),'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 _0xafd863='';return db[_0x0bfc('0x33')]['findOne']({'where':{'id':_0x2df263['params']['id']},'attributes':['id','remoteUri',_0x0bfc('0x5d'),_0x0bfc('0x5e'),_0x0bfc('0x5f'),_0x0bfc('0x60'),_0x0bfc('0x61'),'token','tokenSecret']})['then'](handleEntityNotFound(_0x153eec,null))[_0x0bfc('0x1c')](function(_0x3a6bf7){if(_0x3a6bf7){_0xafd863=_0x3a6bf7[_0x0bfc('0x62')];var _0x46506e=_0xafd863[_0x0bfc('0x63')](-0x1);if(_0x46506e==='/'){_0xafd863=_0xafd863[_0x0bfc('0x64')](0x0,_0xafd863[_0x0bfc('0x65')](_0x46506e));}var _0x1c5bb7={'method':_0x0bfc('0x66'),'uri':util[_0x0bfc('0x67')]('%s/custom_fields',_0xafd863),'headers':{'Content-Type':'application/json','Accept':_0x0bfc('0x68')},'json':!![]};if(_0x3a6bf7[_0x0bfc('0x5d')]===_0x0bfc('0x69')){_0x1c5bb7['headers'][_0x0bfc('0x6a')]=util['format'](_0x0bfc('0x6b'),new Buffer(util[_0x0bfc('0x67')](_0x0bfc('0x6c'),_0x3a6bf7[_0x0bfc('0x5e')],_0x3a6bf7[_0x0bfc('0x5f')]))[_0x0bfc('0x6d')]('base64'));}return rp(_0x1c5bb7)[_0x0bfc('0x1c')](function(_0xd0218d){return _0x24a375[_0x0bfc('0x6e')](_[_0x0bfc('0x32')](_0xd0218d[_0x0bfc('0x6f')][_0x0bfc('0x70')],function(_0x36531b){return{'id':_0x36531b[_0x0bfc('0x2f')],'name':_0x36531b['name'],'type':_0x36531b['type'],'active':_0x36531b[_0x0bfc('0x71')],'label':_0x36531b[_0x0bfc('0x72')],'custom':!![]};}));});}})[_0x0bfc('0x1c')](function(_0x112530){return{'count':_0x112530['length'],'rows':_0x112530};})[_0x0bfc('0x1c')](respondWithResult(_0x153eec,null))['catch'](function(_0x20f478){var _0x5d7d86=_0x2df263[_0x0bfc('0x37')][_0x0bfc('0x73')]?0x1f4:_0x20f478[_0x0bfc('0x74')]||0x1f4;logger[_0x0bfc('0x20')](_0x0bfc('0x75'),_0x0bfc('0x5b'),_0x5d7d86,JSON[_0x0bfc('0x1f')](_0x20f478));delete _0x20f478['name'];if(_0x5d7d86===0x191){_0x5d7d86=0x190;}_0x153eec[_0x0bfc('0x25')](_0x5d7d86)[_0x0bfc('0x30')](_0x2df263[_0x0bfc('0x37')][_0x0bfc('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x20f478[_0x0bfc('0x74')]}:_0x20f478);});}; \ No newline at end of file +var _0xc5d5=['addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','password','consumerSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','base64','concat','_embedded','entries','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','apply','save','update','destroy','end','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','options','count','include','show','includeAll','find','create','body','params','getConfigurations','DeskConfiguration','length'];(function(_0x33f994,_0x563f5a){var _0x5e1900=function(_0x448cd3){while(--_0x448cd3){_0x33f994['push'](_0x33f994['shift']());}};_0x5e1900(++_0x563f5a);}(_0xc5d5,0x178));var _0x5c5d=function(_0x195c6b,_0x558639){_0x195c6b=_0x195c6b-0x0;var _0x239123=_0xc5d5[_0x195c6b];return _0x239123;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5c5d('0x0'));var rimraf=require(_0x5c5d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c5d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5c5d('0x3'));var Mustache=require('mustache');var util=require(_0x5c5d('0x4'));var path=require(_0x5c5d('0x5'));var sox=require(_0x5c5d('0x6'));var csv=require(_0x5c5d('0x7'));var ejs=require(_0x5c5d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5c5d('0x9'));var crypto=require('crypto');var jsforce=require(_0x5c5d('0xa'));var deskjs=require(_0x5c5d('0xb'));var toCsv=require(_0x5c5d('0x7'));var querystring=require(_0x5c5d('0xc'));var Papa=require(_0x5c5d('0xd'));var Redis=require(_0x5c5d('0xe'));var authService=require(_0x5c5d('0xf'));var qs=require(_0x5c5d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c5d('0x11'));var logger=require(_0x5c5d('0x12'))('api');var utils=require(_0x5c5d('0x13'));var config=require(_0x5c5d('0x14'));var db=require(_0x5c5d('0x15'))['db'];var integrations=require(_0x5c5d('0x16'));var jayson=require(_0x5c5d('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0xc4ef7a,_0x266bd2,_0x51986d){if(_0x51986d){var _0x2b97e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b97e8['test'](_0x266bd2)){return _0xc4ef7a;}else{throw new db[(_0x5c5d('0x18'))]['ValidationError'](_0x5c5d('0x19'));}}else{return _0xc4ef7a;}}function respondWithRpcPromise(_0x463df6,_0x4c5d0c,_0x559dc9,_0x41239d){return new BPromise(function(_0x3f796c,_0x317ec){var _0xeaa118=_0x41239d||client;return _0xeaa118[_0x5c5d('0x1a')](_0x463df6,_0x559dc9)[_0x5c5d('0x1b')](function(_0x133d92){logger[_0x5c5d('0x1c')](_0x5c5d('0x1d'),_0x4c5d0c,'request\x20sent');logger[_0x5c5d('0x1e')](_0x5c5d('0x1f'),_0x4c5d0c,_0x5c5d('0x20'),JSON['stringify'](_0x133d92));if(_0x133d92[_0x5c5d('0x21')]){if(_0x133d92[_0x5c5d('0x21')][_0x5c5d('0x22')]===0x1f4){logger[_0x5c5d('0x21')](_0x5c5d('0x1d'),_0x4c5d0c,_0x133d92['error'][_0x5c5d('0x23')]);return _0x317ec(_0x133d92[_0x5c5d('0x21')][_0x5c5d('0x23')]);}logger['error'](_0x5c5d('0x1d'),_0x4c5d0c,_0x133d92[_0x5c5d('0x21')][_0x5c5d('0x23')]);return _0x3f796c(_0x133d92[_0x5c5d('0x21')][_0x5c5d('0x23')]);}else{logger[_0x5c5d('0x1c')](_0x5c5d('0x1d'),_0x4c5d0c,_0x5c5d('0x20'));_0x3f796c(_0x133d92[_0x5c5d('0x24')][_0x5c5d('0x23')]);}})[_0x5c5d('0x25')](function(_0x5f252a){logger[_0x5c5d('0x21')](_0x5c5d('0x1d'),_0x4c5d0c,_0x5f252a);_0x317ec(_0x5f252a);});});}function respondWithStatusCode(_0x4cfc84,_0x537607){_0x537607=_0x537607||0xcc;return function(_0xb271b1){if(_0xb271b1){return _0x4cfc84[_0x5c5d('0x26')](_0x537607);}return _0x4cfc84[_0x5c5d('0x27')](_0x537607)['end']();};}function respondWithResult(_0x28bd27,_0x5961d0){_0x5961d0=_0x5961d0||0xc8;return function(_0x296764){if(_0x296764){return _0x28bd27[_0x5c5d('0x27')](_0x5961d0)[_0x5c5d('0x28')](_0x296764);}};}function respondWithFilteredResult(_0x559886,_0x4887e3){return function(_0x23b8aa){if(_0x23b8aa){var _0x59fa18=_0x23b8aa['count'],_0x5990f9=_0x4887e3[_0x5c5d('0x29')],_0x45811a=_0x4887e3[_0x5c5d('0x29')]+_0x4887e3[_0x5c5d('0x2a')],_0x10220a;if(_0x45811a>=_0x59fa18){_0x45811a=_0x59fa18;_0x10220a=0xc8;}else{_0x10220a=0xce;}_0x559886[_0x5c5d('0x27')](_0x10220a);return _0x559886[_0x5c5d('0x2b')]('Content-Range',_0x5990f9+'-'+_0x45811a+'/'+_0x59fa18)['json'](_0x23b8aa);}return null;};}function patchUpdates(_0x51f0a5){return function(_0x457009){try{jsonpatch[_0x5c5d('0x2c')](_0x457009,_0x51f0a5,!![]);}catch(_0x15e7ab){return BPromise['reject'](_0x15e7ab);}return _0x457009[_0x5c5d('0x2d')]();};}function saveUpdates(_0x3e1ef9,_0x306784){return function(_0x3b5211){if(_0x3b5211){return _0x3b5211[_0x5c5d('0x2e')](_0x3e1ef9)[_0x5c5d('0x1b')](function(_0x26b3a2){return _0x26b3a2;});}return null;};}function removeEntity(_0x2fc5f8,_0x2fb8cc){return function(_0x20da60){if(_0x20da60){return _0x20da60[_0x5c5d('0x2f')]()[_0x5c5d('0x1b')](function(){_0x2fc5f8[_0x5c5d('0x27')](0xcc)[_0x5c5d('0x30')]();});}};}function handleEntityNotFound(_0x258dc6,_0xdd946f){return function(_0x2adf8c){if(!_0x2adf8c){_0x258dc6[_0x5c5d('0x26')](0x194);}return _0x2adf8c;};}function handleError(_0x5cdfcc,_0x11cfde){_0x11cfde=_0x11cfde||0x1f4;return function(_0x41a942){logger['error'](_0x41a942['stack']);if(_0x41a942[_0x5c5d('0x31')]){delete _0x41a942[_0x5c5d('0x31')];}_0x5cdfcc['status'](_0x11cfde)[_0x5c5d('0x32')](_0x41a942);};}exports[_0x5c5d('0x33')]=function(_0x10b4b8,_0x4d8f56){var _0x44e751={},_0x41680b={},_0x158d1b={'count':0x0,'rows':[]};var _0x194059=_[_0x5c5d('0x34')](db[_0x5c5d('0x35')][_0x5c5d('0x36')],function(_0x8dfb6c){return{'name':_0x8dfb6c[_0x5c5d('0x37')],'type':_0x8dfb6c['type'][_0x5c5d('0x38')]};});_0x41680b['model']=_[_0x5c5d('0x34')](_0x194059,_0x5c5d('0x31'));_0x41680b[_0x5c5d('0x39')]=_[_0x5c5d('0x3a')](_0x10b4b8['query']);_0x41680b[_0x5c5d('0x3b')]=_[_0x5c5d('0x3c')](_0x41680b[_0x5c5d('0x3d')],_0x41680b[_0x5c5d('0x39')]);_0x44e751[_0x5c5d('0x3e')]=_[_0x5c5d('0x3c')](_0x41680b[_0x5c5d('0x3d')],qs[_0x5c5d('0x3f')](_0x10b4b8[_0x5c5d('0x39')][_0x5c5d('0x3f')]));_0x44e751[_0x5c5d('0x3e')]=_0x44e751[_0x5c5d('0x3e')]['length']?_0x44e751['attributes']:_0x41680b[_0x5c5d('0x3d')];if(!_0x10b4b8['query'][_0x5c5d('0x40')](_0x5c5d('0x41'))){_0x44e751['limit']=qs['limit'](_0x10b4b8[_0x5c5d('0x39')][_0x5c5d('0x2a')]);_0x44e751['offset']=qs[_0x5c5d('0x29')](_0x10b4b8[_0x5c5d('0x39')][_0x5c5d('0x29')]);}_0x44e751[_0x5c5d('0x42')]=qs[_0x5c5d('0x43')](_0x10b4b8[_0x5c5d('0x39')][_0x5c5d('0x43')]);_0x44e751[_0x5c5d('0x44')]=qs[_0x5c5d('0x3b')](_['pick'](_0x10b4b8[_0x5c5d('0x39')],_0x41680b[_0x5c5d('0x3b')]),_0x194059);if(_0x10b4b8[_0x5c5d('0x39')]['filter']){_0x44e751['where']=_['merge'](_0x44e751['where'],{'$or':_[_0x5c5d('0x34')](_0x194059,function(_0x254b7b){if(_0x254b7b[_0x5c5d('0x45')]!==_0x5c5d('0x46')){var _0x1d49a2={};_0x1d49a2[_0x254b7b[_0x5c5d('0x31')]]={'$like':'%'+_0x10b4b8[_0x5c5d('0x39')]['filter']+'%'};return _0x1d49a2;}})});}_0x44e751=_[_0x5c5d('0x47')]({},_0x44e751,_0x10b4b8[_0x5c5d('0x48')]);var _0x5857f1={'where':_0x44e751[_0x5c5d('0x44')]};return db['DeskAccount'][_0x5c5d('0x49')](_0x5857f1)[_0x5c5d('0x1b')](function(_0x2143fd){_0x158d1b[_0x5c5d('0x49')]=_0x2143fd;if(_0x10b4b8[_0x5c5d('0x39')]['includeAll']){_0x44e751[_0x5c5d('0x4a')]=[{'all':!![]}];}return db[_0x5c5d('0x35')]['findAll'](_0x44e751);})[_0x5c5d('0x1b')](function(_0x3c5efc){_0x158d1b['rows']=_0x3c5efc;return _0x158d1b;})[_0x5c5d('0x1b')](respondWithFilteredResult(_0x4d8f56,_0x44e751))['catch'](handleError(_0x4d8f56,null));};exports[_0x5c5d('0x4b')]=function(_0x4e05e7,_0x13d983){var _0x41a85c={'raw':![],'where':{'id':_0x4e05e7['params']['id']}},_0x398401={};_0x398401[_0x5c5d('0x3d')]=_[_0x5c5d('0x3a')](db[_0x5c5d('0x35')]['rawAttributes']);_0x398401[_0x5c5d('0x39')]=_[_0x5c5d('0x3a')](_0x4e05e7[_0x5c5d('0x39')]);_0x398401[_0x5c5d('0x3b')]=_[_0x5c5d('0x3c')](_0x398401[_0x5c5d('0x3d')],_0x398401[_0x5c5d('0x39')]);_0x41a85c[_0x5c5d('0x3e')]=_['intersection'](_0x398401[_0x5c5d('0x3d')],qs['fields'](_0x4e05e7[_0x5c5d('0x39')][_0x5c5d('0x3f')]));_0x41a85c[_0x5c5d('0x3e')]=_0x41a85c[_0x5c5d('0x3e')]['length']?_0x41a85c[_0x5c5d('0x3e')]:_0x398401[_0x5c5d('0x3d')];if(_0x4e05e7[_0x5c5d('0x39')][_0x5c5d('0x4c')]){_0x41a85c[_0x5c5d('0x4a')]=[{'all':!![]}];}_0x41a85c=_[_0x5c5d('0x47')]({},_0x41a85c,_0x4e05e7['options']);return db[_0x5c5d('0x35')][_0x5c5d('0x4d')](_0x41a85c)[_0x5c5d('0x1b')](handleEntityNotFound(_0x13d983,null))[_0x5c5d('0x1b')](respondWithResult(_0x13d983,null))[_0x5c5d('0x25')](handleError(_0x13d983,null));};exports['create']=function(_0x16f921,_0x2cecdf){return db[_0x5c5d('0x35')][_0x5c5d('0x4e')](_0x16f921[_0x5c5d('0x4f')],{})[_0x5c5d('0x1b')](respondWithResult(_0x2cecdf,0xc9))[_0x5c5d('0x25')](handleError(_0x2cecdf,null));};exports[_0x5c5d('0x2e')]=function(_0x155c75,_0x2825fd){if(_0x155c75[_0x5c5d('0x4f')]['id']){delete _0x155c75[_0x5c5d('0x4f')]['id'];}return db[_0x5c5d('0x35')][_0x5c5d('0x4d')]({'where':{'id':_0x155c75[_0x5c5d('0x50')]['id']}})['then'](handleEntityNotFound(_0x2825fd,null))['then'](saveUpdates(_0x155c75[_0x5c5d('0x4f')],null))[_0x5c5d('0x1b')](respondWithResult(_0x2825fd,null))[_0x5c5d('0x25')](handleError(_0x2825fd,null));};exports[_0x5c5d('0x2f')]=function(_0x5410d3,_0x1382f4){return db['DeskAccount']['find']({'where':{'id':_0x5410d3[_0x5c5d('0x50')]['id']}})[_0x5c5d('0x1b')](handleEntityNotFound(_0x1382f4,null))['then'](removeEntity(_0x1382f4,null))['catch'](handleError(_0x1382f4,null));};exports[_0x5c5d('0x51')]=function(_0x19aece,_0x4502d9,_0x14c643){var _0x52c518={};var _0x823467={};var _0xdda075;var _0x24de14;return db[_0x5c5d('0x35')]['findOne']({'where':{'id':_0x19aece['params']['id']}})[_0x5c5d('0x1b')](handleEntityNotFound(_0x4502d9,null))[_0x5c5d('0x1b')](function(_0x1c7149){if(_0x1c7149){_0xdda075=_0x1c7149;_0x823467[_0x5c5d('0x3d')]=_[_0x5c5d('0x3a')](db[_0x5c5d('0x52')][_0x5c5d('0x36')]);_0x823467['query']=_['keys'](_0x19aece[_0x5c5d('0x39')]);_0x823467[_0x5c5d('0x3b')]=_[_0x5c5d('0x3c')](_0x823467['model'],_0x823467[_0x5c5d('0x39')]);_0x52c518[_0x5c5d('0x3e')]=_[_0x5c5d('0x3c')](_0x823467[_0x5c5d('0x3d')],qs['fields'](_0x19aece[_0x5c5d('0x39')][_0x5c5d('0x3f')]));_0x52c518[_0x5c5d('0x3e')]=_0x52c518[_0x5c5d('0x3e')][_0x5c5d('0x53')]?_0x52c518[_0x5c5d('0x3e')]:_0x823467[_0x5c5d('0x3d')];_0x52c518[_0x5c5d('0x42')]=qs['sort'](_0x19aece[_0x5c5d('0x39')]['sort']);_0x52c518[_0x5c5d('0x44')]=qs['filters'](_['pick'](_0x19aece[_0x5c5d('0x39')],_0x823467[_0x5c5d('0x3b')]));if(_0x19aece[_0x5c5d('0x39')]['filter']){_0x52c518['where']=_[_0x5c5d('0x47')](_0x52c518[_0x5c5d('0x44')],{'$or':_[_0x5c5d('0x34')](_0x52c518[_0x5c5d('0x3e')],function(_0x41fff2){var _0x489dda={};_0x489dda[_0x41fff2]={'$like':'%'+_0x19aece['query']['filter']+'%'};return _0x489dda;})});}_0x52c518=_['merge']({},_0x52c518,_0x19aece['options']);return _0xdda075[_0x5c5d('0x51')](_0x52c518);}})[_0x5c5d('0x1b')](function(_0x30015a){if(_0x30015a){_0x24de14=_0x30015a['length'];if(!_0x19aece['query']['hasOwnProperty']('nolimit')){_0x52c518[_0x5c5d('0x2a')]=qs['limit'](_0x19aece[_0x5c5d('0x39')]['limit']);_0x52c518[_0x5c5d('0x29')]=qs['offset'](_0x19aece[_0x5c5d('0x39')][_0x5c5d('0x29')]);}return _0xdda075[_0x5c5d('0x51')](_0x52c518);}})[_0x5c5d('0x1b')](function(_0x140a2e){if(_0x140a2e){return _0x140a2e?{'count':_0x24de14,'rows':_0x140a2e}:null;}})[_0x5c5d('0x1b')](respondWithResult(_0x4502d9,null))[_0x5c5d('0x25')](handleError(_0x4502d9,null));};exports[_0x5c5d('0x54')]=function(_0x4f6687,_0x6d24f6,_0x237198){if(_0x4f6687[_0x5c5d('0x4f')]['id']){delete _0x4f6687[_0x5c5d('0x4f')]['id'];}return db[_0x5c5d('0x35')][_0x5c5d('0x55')]({'where':{'id':_0x4f6687['params']['id']}})[_0x5c5d('0x1b')](handleEntityNotFound(_0x6d24f6,null))[_0x5c5d('0x1b')](function(_0x1e0468){if(_0x1e0468){_0x4f6687['body'][_0x5c5d('0x56')]=_0x1e0468['id'];_0x4f6687['body']['Subjects']=integrations[_0x5c5d('0x57')](_0x4f6687[_0x5c5d('0x4f')]['channel'],_0x4f6687[_0x5c5d('0x4f')][_0x5c5d('0x45')]);_0x4f6687[_0x5c5d('0x4f')][_0x5c5d('0x58')]=integrations[_0x5c5d('0x59')](_0x4f6687[_0x5c5d('0x4f')]['channel'],_0x4f6687['body'][_0x5c5d('0x45')]);return db['DeskConfiguration'][_0x5c5d('0x4e')](_0x4f6687[_0x5c5d('0x4f')],{'include':[{'model':db[_0x5c5d('0x5a')],'as':_0x5c5d('0x5b')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x6d24f6,null))[_0x5c5d('0x25')](handleError(_0x6d24f6,null));};exports[_0x5c5d('0x5c')]=function(_0x5edb82,_0x21aef6,_0x2f3098){var _0x26676e=[{'name':'priority','label':_0x5c5d('0x5d'),'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 _0x52b7f8='';return db[_0x5c5d('0x35')][_0x5c5d('0x55')]({'where':{'id':_0x5edb82[_0x5c5d('0x50')]['id']},'attributes':['id',_0x5c5d('0x5e'),_0x5c5d('0x5f'),'username',_0x5c5d('0x60'),'consumerKey',_0x5c5d('0x61'),'token','tokenSecret']})[_0x5c5d('0x1b')](handleEntityNotFound(_0x21aef6,null))['then'](function(_0x404c18){if(_0x404c18){_0x52b7f8=_0x404c18[_0x5c5d('0x5e')];var _0x2cfff9=_0x52b7f8[_0x5c5d('0x62')](-0x1);if(_0x2cfff9==='/'){_0x52b7f8=_0x52b7f8[_0x5c5d('0x63')](0x0,_0x52b7f8[_0x5c5d('0x64')](_0x2cfff9));}var _0x3c78a8={'method':_0x5c5d('0x65'),'uri':util[_0x5c5d('0x66')](_0x5c5d('0x67'),_0x52b7f8),'headers':{'Content-Type':_0x5c5d('0x68'),'Accept':_0x5c5d('0x68')},'json':!![]};if(_0x404c18[_0x5c5d('0x5f')]===_0x5c5d('0x69')){_0x3c78a8[_0x5c5d('0x6a')]['Authorization']=util[_0x5c5d('0x66')](_0x5c5d('0x6b'),new Buffer(util[_0x5c5d('0x66')]('%s:%s',_0x404c18['username'],_0x404c18[_0x5c5d('0x60')]))['toString'](_0x5c5d('0x6c')));}return rp(_0x3c78a8)[_0x5c5d('0x1b')](function(_0x3fb292){return _0x26676e[_0x5c5d('0x6d')](_[_0x5c5d('0x34')](_0x3fb292[_0x5c5d('0x6e')][_0x5c5d('0x6f')],function(_0x37f8bb){return{'id':_0x37f8bb[_0x5c5d('0x31')],'name':_0x37f8bb['name'],'type':_0x37f8bb[_0x5c5d('0x45')],'active':_0x37f8bb['active'],'label':_0x37f8bb['label'],'custom':!![]};}));});}})[_0x5c5d('0x1b')](function(_0x3adc9d){return{'count':_0x3adc9d['length'],'rows':_0x3adc9d};})['then'](respondWithResult(_0x21aef6,null))[_0x5c5d('0x25')](function(_0x2425cd){var _0x3b8fa2=_0x5edb82['query'][_0x5c5d('0x70')]?0x1f4:_0x2425cd[_0x5c5d('0x71')]||0x1f4;logger[_0x5c5d('0x21')](_0x5c5d('0x72'),_0x5c5d('0x5c'),_0x3b8fa2,JSON['stringify'](_0x2425cd));delete _0x2425cd[_0x5c5d('0x31')];if(_0x3b8fa2===0x191){_0x3b8fa2=0x190;}_0x21aef6['status'](_0x3b8fa2)['send'](_0x5edb82[_0x5c5d('0x39')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2425cd[_0x5c5d('0x71')]}:_0x2425cd);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index b2d3445..5cb198a 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 _0x567f=['../../components/integrations/configuration','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x567f,0x123));var _0xf567=function(_0x2cd944,_0x8ba004){_0x2cd944=_0x2cd944-0x0;var _0x39e44e=_0x567f[_0x2cd944];return _0x39e44e;};'use strict';var _=require(_0xf567('0x0'));var util=require(_0xf567('0x1'));var logger=require(_0xf567('0x2'))('api');var moment=require(_0xf567('0x3'));var BPromise=require(_0xf567('0x4'));var rp=require(_0xf567('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf567('0x6'));var config=require(_0xf567('0x7'));var attributes=require(_0xf567('0x8'));var integrations=require(_0xf567('0x9'));module['exports']=function(_0x28c81f,_0x55b774){return _0x28c81f['define'](_0xf567('0xa'),attributes,{'tableName':_0xf567('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf6c=['define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x4145a8,_0x55e817){var _0x155db0=function(_0x30ad81){while(--_0x30ad81){_0x4145a8['push'](_0x4145a8['shift']());}};_0x155db0(++_0x55e817);}(_0xcf6c,0x133));var _0xccf6=function(_0x115cdc,_0x2533b9){_0x115cdc=_0x115cdc-0x0;var _0x43259f=_0xcf6c[_0x115cdc];return _0x43259f;};'use strict';var _=require(_0xccf6('0x0'));var util=require(_0xccf6('0x1'));var logger=require(_0xccf6('0x2'))(_0xccf6('0x3'));var moment=require(_0xccf6('0x4'));var BPromise=require(_0xccf6('0x5'));var rp=require(_0xccf6('0x6'));var fs=require('fs');var path=require(_0xccf6('0x7'));var rimraf=require(_0xccf6('0x8'));var config=require(_0xccf6('0x9'));var attributes=require(_0xccf6('0xa'));var integrations=require(_0xccf6('0xb'));module[_0xccf6('0xc')]=function(_0x55757c,_0x5e5959){return _0x55757c[_0xccf6('0xd')](_0xccf6('0xe'),attributes,{'tableName':_0xccf6('0xf'),'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 d33ce76..08fd3b7 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 _0x19a7=['error','DeskAccount,\x20%s,\x20%s','message','result','catch','DeskAccount','findAll','options','where','attributes','limit','include','map','model','GetDeskAccount','ShowDeskAccount','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x19a7,0x15b));var _0x719a=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x19a7[_0x1cfa0d];return _0xe33279;};'use strict';var _=require('lodash');var util=require(_0x719a('0x0'));var moment=require('moment');var BPromise=require(_0x719a('0x1'));var rs=require(_0x719a('0x2'));var fs=require('fs');var Redis=require(_0x719a('0x3'));var db=require(_0x719a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x719a('0x5'))('rpc');var config=require(_0x719a('0x6'));var jayson=require(_0x719a('0x7'));var client=jayson[_0x719a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x463131,_0x520db5,_0x344525){return new BPromise(function(_0xd24ae4,_0xdfd8d6){return client[_0x719a('0x9')](_0x463131,_0x344525)[_0x719a('0xa')](function(_0x10494e){logger[_0x719a('0xb')]('DeskAccount,\x20%s,\x20%s',_0x520db5,_0x719a('0xc'));logger[_0x719a('0xd')](_0x719a('0xe'),_0x520db5,_0x719a('0xc'),JSON[_0x719a('0xf')](_0x10494e));if(_0x10494e['error']){if(_0x10494e[_0x719a('0x10')]['code']===0x1f4){logger[_0x719a('0x10')](_0x719a('0x11'),_0x520db5,_0x10494e[_0x719a('0x10')]['message']);return _0xdfd8d6(_0x10494e[_0x719a('0x10')][_0x719a('0x12')]);}logger[_0x719a('0x10')](_0x719a('0x11'),_0x520db5,_0x10494e['error'][_0x719a('0x12')]);return _0xd24ae4(_0x10494e[_0x719a('0x10')][_0x719a('0x12')]);}else{logger[_0x719a('0xb')](_0x719a('0x11'),_0x520db5,_0x719a('0xc'));_0xd24ae4(_0x10494e[_0x719a('0x13')][_0x719a('0x12')]);}})[_0x719a('0x14')](function(_0x23bc0e){logger[_0x719a('0x10')](_0x719a('0x11'),_0x520db5,_0x23bc0e);_0xdfd8d6(_0x23bc0e);});});}exports['GetDeskAccount']=function(_0x1957a9){var _0x27201=this;return new Promise(function(_0x51364f,_0x445dc7){return db[_0x719a('0x15')][_0x719a('0x16')]({'raw':_0x1957a9[_0x719a('0x17')]?_0x1957a9['options']['raw']===undefined?!![]:![]:!![],'where':_0x1957a9['options']?_0x1957a9[_0x719a('0x17')][_0x719a('0x18')]||null:null,'attributes':_0x1957a9[_0x719a('0x17')]?_0x1957a9[_0x719a('0x17')][_0x719a('0x19')]||null:null,'limit':_0x1957a9[_0x719a('0x17')]?_0x1957a9[_0x719a('0x17')][_0x719a('0x1a')]||null:null,'include':_0x1957a9['options']?_0x1957a9[_0x719a('0x17')][_0x719a('0x1b')]?_[_0x719a('0x1c')](_0x1957a9[_0x719a('0x17')]['include'],function(_0x519a18){return{'model':db[_0x519a18['model']],'as':_0x519a18['as'],'attributes':_0x519a18[_0x719a('0x19')],'include':_0x519a18['include']?_[_0x719a('0x1c')](_0x519a18[_0x719a('0x1b')],function(_0x56ccf0){return{'model':db[_0x56ccf0[_0x719a('0x1d')]],'as':_0x56ccf0['as'],'attributes':_0x56ccf0[_0x719a('0x19')],'include':_0x56ccf0[_0x719a('0x1b')]?_[_0x719a('0x1c')](_0x56ccf0[_0x719a('0x1b')],function(_0x18e967){return{'model':db[_0x18e967[_0x719a('0x1d')]],'as':_0x18e967['as'],'attributes':_0x18e967[_0x719a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x719a('0xa')](function(_0x3e3b3f){logger[_0x719a('0xb')]('GetDeskAccount',_0x1957a9);logger[_0x719a('0xd')](_0x719a('0x1e'),_0x1957a9,JSON[_0x719a('0xf')](_0x3e3b3f));_0x51364f(_0x3e3b3f);})[_0x719a('0x14')](function(_0x53aa6d){logger[_0x719a('0x10')](_0x719a('0x1e'),_0x53aa6d['message'],_0x1957a9);_0x445dc7(_0x27201[_0x719a('0x10')](0x1f4,_0x53aa6d[_0x719a('0x12')]));});});};exports[_0x719a('0x1f')]=function(_0x408ae4){var _0x54567f=this;return new Promise(function(_0x3101f2,_0xf3c498){return db['DeskAccount']['find']({'raw':_0x408ae4[_0x719a('0x17')]?_0x408ae4['options'][_0x719a('0x20')]===undefined?!![]:![]:!![],'where':_0x408ae4[_0x719a('0x17')]?_0x408ae4[_0x719a('0x17')]['where']||null:null,'attributes':_0x408ae4['options']?_0x408ae4[_0x719a('0x17')][_0x719a('0x19')]||null:null,'include':_0x408ae4['options']?_0x408ae4[_0x719a('0x17')][_0x719a('0x1b')]?_[_0x719a('0x1c')](_0x408ae4[_0x719a('0x17')][_0x719a('0x1b')],function(_0x246667){return{'model':db[_0x246667[_0x719a('0x1d')]],'as':_0x246667['as'],'attributes':_0x246667[_0x719a('0x19')],'include':_0x246667[_0x719a('0x1b')]?_[_0x719a('0x1c')](_0x246667[_0x719a('0x1b')],function(_0x3af4fd){return{'model':db[_0x3af4fd[_0x719a('0x1d')]],'as':_0x3af4fd['as'],'attributes':_0x3af4fd['attributes'],'include':_0x3af4fd[_0x719a('0x1b')]?_[_0x719a('0x1c')](_0x3af4fd[_0x719a('0x1b')],function(_0x5831fd){return{'model':db[_0x5831fd['model']],'as':_0x5831fd['as'],'attributes':_0x5831fd[_0x719a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x719a('0xa')](function(_0x472d06){logger['info'](_0x719a('0x1f'),_0x408ae4);logger['debug'](_0x719a('0x1f'),_0x408ae4,JSON[_0x719a('0xf')](_0x472d06));_0x3101f2(_0x472d06);})[_0x719a('0x14')](function(_0x1de724){logger['error']('ShowDeskAccount',_0x1de724[_0x719a('0x12')],_0x408ae4);_0xf3c498(_0x54567f[_0x719a('0x10')](0x1f4,_0x1de724['message']));});});}; \ No newline at end of file +var _0x4a42=['result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','include','model','attributes','map','debug','where','ShowDeskAccount','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a42,0xee));var _0x24a4=function(_0x474c14,_0x19bd72){_0x474c14=_0x474c14-0x0;var _0x154332=_0x4a42[_0x474c14];return _0x154332;};'use strict';var _=require(_0x24a4('0x0'));var util=require('util');var moment=require(_0x24a4('0x1'));var BPromise=require(_0x24a4('0x2'));var rs=require(_0x24a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x24a4('0x4'));var logger=require('../../config/logger')(_0x24a4('0x5'));var config=require(_0x24a4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x24a4('0x7')][_0x24a4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28373d,_0x4728f1,_0x956c8a){return new BPromise(function(_0x43c0da,_0x5208cf){return client['request'](_0x28373d,_0x956c8a)[_0x24a4('0x9')](function(_0x187fa5){logger[_0x24a4('0xa')](_0x24a4('0xb'),_0x4728f1,_0x24a4('0xc'));logger['debug'](_0x24a4('0xd'),_0x4728f1,'request\x20sent',JSON[_0x24a4('0xe')](_0x187fa5));if(_0x187fa5[_0x24a4('0xf')]){if(_0x187fa5['error'][_0x24a4('0x10')]===0x1f4){logger[_0x24a4('0xf')](_0x24a4('0xb'),_0x4728f1,_0x187fa5[_0x24a4('0xf')][_0x24a4('0x11')]);return _0x5208cf(_0x187fa5[_0x24a4('0xf')][_0x24a4('0x11')]);}logger[_0x24a4('0xf')](_0x24a4('0xb'),_0x4728f1,_0x187fa5['error']['message']);return _0x43c0da(_0x187fa5[_0x24a4('0xf')][_0x24a4('0x11')]);}else{logger[_0x24a4('0xa')]('DeskAccount,\x20%s,\x20%s',_0x4728f1,_0x24a4('0xc'));_0x43c0da(_0x187fa5[_0x24a4('0x12')][_0x24a4('0x11')]);}})[_0x24a4('0x13')](function(_0x233233){logger['error'](_0x24a4('0xb'),_0x4728f1,_0x233233);_0x5208cf(_0x233233);});});}exports[_0x24a4('0x14')]=function(_0x2b938a){var _0x1a7905=this;return new Promise(function(_0x43ab9e,_0x3b4d8d){return db[_0x24a4('0x15')][_0x24a4('0x16')]({'raw':_0x2b938a[_0x24a4('0x17')]?_0x2b938a[_0x24a4('0x17')][_0x24a4('0x18')]===undefined?!![]:![]:!![],'where':_0x2b938a[_0x24a4('0x17')]?_0x2b938a[_0x24a4('0x17')]['where']||null:null,'attributes':_0x2b938a[_0x24a4('0x17')]?_0x2b938a['options']['attributes']||null:null,'limit':_0x2b938a[_0x24a4('0x17')]?_0x2b938a[_0x24a4('0x17')]['limit']||null:null,'include':_0x2b938a['options']?_0x2b938a[_0x24a4('0x17')][_0x24a4('0x19')]?_['map'](_0x2b938a['options'][_0x24a4('0x19')],function(_0x17fda6){return{'model':db[_0x17fda6[_0x24a4('0x1a')]],'as':_0x17fda6['as'],'attributes':_0x17fda6[_0x24a4('0x1b')],'include':_0x17fda6['include']?_['map'](_0x17fda6['include'],function(_0x4bd7be){return{'model':db[_0x4bd7be[_0x24a4('0x1a')]],'as':_0x4bd7be['as'],'attributes':_0x4bd7be[_0x24a4('0x1b')],'include':_0x4bd7be[_0x24a4('0x19')]?_[_0x24a4('0x1c')](_0x4bd7be[_0x24a4('0x19')],function(_0x3ea287){return{'model':db[_0x3ea287[_0x24a4('0x1a')]],'as':_0x3ea287['as'],'attributes':_0x3ea287[_0x24a4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x24a4('0x9')](function(_0xac876c){logger[_0x24a4('0xa')](_0x24a4('0x14'),_0x2b938a);logger[_0x24a4('0x1d')](_0x24a4('0x14'),_0x2b938a,JSON[_0x24a4('0xe')](_0xac876c));_0x43ab9e(_0xac876c);})[_0x24a4('0x13')](function(_0x16b0fd){logger[_0x24a4('0xf')](_0x24a4('0x14'),_0x16b0fd['message'],_0x2b938a);_0x3b4d8d(_0x1a7905['error'](0x1f4,_0x16b0fd['message']));});});};exports['ShowDeskAccount']=function(_0x33e29b){var _0x5390be=this;return new Promise(function(_0x36f99c,_0xce0364){return db[_0x24a4('0x15')]['find']({'raw':_0x33e29b[_0x24a4('0x17')]?_0x33e29b['options'][_0x24a4('0x18')]===undefined?!![]:![]:!![],'where':_0x33e29b[_0x24a4('0x17')]?_0x33e29b['options'][_0x24a4('0x1e')]||null:null,'attributes':_0x33e29b[_0x24a4('0x17')]?_0x33e29b[_0x24a4('0x17')][_0x24a4('0x1b')]||null:null,'include':_0x33e29b['options']?_0x33e29b['options'][_0x24a4('0x19')]?_['map'](_0x33e29b[_0x24a4('0x17')][_0x24a4('0x19')],function(_0x102a3b){return{'model':db[_0x102a3b[_0x24a4('0x1a')]],'as':_0x102a3b['as'],'attributes':_0x102a3b[_0x24a4('0x1b')],'include':_0x102a3b[_0x24a4('0x19')]?_[_0x24a4('0x1c')](_0x102a3b[_0x24a4('0x19')],function(_0x34abe0){return{'model':db[_0x34abe0[_0x24a4('0x1a')]],'as':_0x34abe0['as'],'attributes':_0x34abe0[_0x24a4('0x1b')],'include':_0x34abe0['include']?_[_0x24a4('0x1c')](_0x34abe0[_0x24a4('0x19')],function(_0x3ef830){return{'model':db[_0x3ef830[_0x24a4('0x1a')]],'as':_0x3ef830['as'],'attributes':_0x3ef830['attributes']};}):[]};}):[]};}):[]:[]})[_0x24a4('0x9')](function(_0x36223c){logger[_0x24a4('0xa')](_0x24a4('0x1f'),_0x33e29b);logger[_0x24a4('0x1d')](_0x24a4('0x1f'),_0x33e29b,JSON[_0x24a4('0xe')](_0x36223c));_0x36f99c(_0x36223c);})[_0x24a4('0x13')](function(_0x4d23d0){logger[_0x24a4('0xf')](_0x24a4('0x1f'),_0x4d23d0['message'],_0x33e29b);_0xce0364(_0x5390be[_0x24a4('0xf')](0x1f4,_0x4d23d0['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 5895fe6..7c7394a 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 _0x022a=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3f0ac1,_0x33d10a){var _0x1a2a55=function(_0x3a3db3){while(--_0x3a3db3){_0x3f0ac1['push'](_0x3f0ac1['shift']());}};_0x1a2a55(++_0x33d10a);}(_0x022a,0x1f0));var _0xa022=function(_0x33de79,_0x51888f){_0x33de79=_0x33de79-0x0;var _0x1932fa=_0x022a[_0x33de79];return _0x1932fa;};'use strict';var multer=require(_0xa022('0x0'));var util=require(_0xa022('0x1'));var path=require(_0xa022('0x2'));var timeout=require(_0xa022('0x3'));var express=require(_0xa022('0x4'));var router=express[_0xa022('0x5')]();var auth=require(_0xa022('0x6'));var interaction=require(_0xa022('0x7'));var config=require(_0xa022('0x8'));var controller=require(_0xa022('0x9'));router[_0xa022('0xa')]('/',auth[_0xa022('0xb')](),controller['index']);router[_0xa022('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa022('0xc')]);router[_0xa022('0xa')](_0xa022('0xd'),auth[_0xa022('0xb')](),controller[_0xa022('0xe')]);router[_0xa022('0xa')](_0xa022('0xf'),auth['isAuthenticated'](),controller[_0xa022('0x10')]);router[_0xa022('0xa')](_0xa022('0x11'),auth['isAuthenticated'](),controller[_0xa022('0x12')]);router['get'](_0xa022('0x13'),auth[_0xa022('0xb')](),controller['getTags']);router['post']('/',auth[_0xa022('0xb')](),controller[_0xa022('0x14')]);router[_0xa022('0x15')](_0xa022('0x13'),auth['isAuthenticated'](),controller['setTags']);router[_0xa022('0x16')]('/:id',auth[_0xa022('0xb')](),controller[_0xa022('0x17')]);router[_0xa022('0x18')](_0xa022('0x19'),auth[_0xa022('0xb')](),controller[_0xa022('0x1a')]);module[_0xa022('0x1b')]=router; \ No newline at end of file +var _0x0650=['post','put','update','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags'];(function(_0x1b38bd,_0x12713c){var _0x4d95b2=function(_0x2650f7){while(--_0x2650f7){_0x1b38bd['push'](_0x1b38bd['shift']());}};_0x4d95b2(++_0x12713c);}(_0x0650,0xed));var _0x0065=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0x0650[_0x16db8b];return _0x5ba017;};'use strict';var multer=require(_0x0065('0x0'));var util=require('util');var path=require(_0x0065('0x1'));var timeout=require(_0x0065('0x2'));var express=require('express');var router=express[_0x0065('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0065('0x4'));var config=require(_0x0065('0x5'));var controller=require(_0x0065('0x6'));router['get']('/',auth[_0x0065('0x7')](),controller['index']);router['get']('/:id',auth[_0x0065('0x7')](),controller[_0x0065('0x8')]);router[_0x0065('0x9')](_0x0065('0xa'),auth[_0x0065('0x7')](),controller[_0x0065('0xb')]);router[_0x0065('0x9')](_0x0065('0xc'),auth[_0x0065('0x7')](),controller['getSubjects']);router[_0x0065('0x9')](_0x0065('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x0065('0xe'),auth[_0x0065('0x7')](),controller['getTags']);router[_0x0065('0xf')]('/',auth[_0x0065('0x7')](),controller['create']);router[_0x0065('0xf')](_0x0065('0xe'),auth['isAuthenticated'](),controller['setTags']);router[_0x0065('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0065('0x11')]);router['delete'](_0x0065('0x12'),auth['isAuthenticated'](),controller[_0x0065('0x13')]);module[_0x0065('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 6db8423..a84c7a6 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 _0xb804=['exports','STRING','sequelize'];(function(_0x35faff,_0x59cd77){var _0xaa4d94=function(_0x495901){while(--_0x495901){_0x35faff['push'](_0x35faff['shift']());}};_0xaa4d94(++_0x59cd77);}(_0xb804,0xb3));var _0x4b80=function(_0x1c898b,_0x559ff6){_0x1c898b=_0x1c898b-0x0;var _0x54ed0e=_0xb804[_0x1c898b];return _0x54ed0e;};'use strict';var Sequelize=require(_0x4b80('0x0'));module[_0x4b80('0x1')]={'name':{'type':Sequelize[_0x4b80('0x2')]},'description':{'type':Sequelize[_0x4b80('0x2')]}}; \ No newline at end of file +var _0x8f45=['exports','STRING'];(function(_0x451967,_0x12ed31){var _0x3f23de=function(_0x12e0e8){while(--_0x12e0e8){_0x451967['push'](_0x451967['shift']());}};_0x3f23de(++_0x12ed31);}(_0x8f45,0xf4));var _0x58f4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8f45[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x58f4('0x0')]={'name':{'type':Sequelize[_0x58f4('0x1')]},'description':{'type':Sequelize[_0x58f4('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index fb67f7d..3bef9c9 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 _0xf120=['path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../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~!@#$%^&-_=+[{]}.','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','update','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','model','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','keys','find','create','body','params','destroy','findOne','DeskField','getFields','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x244e82,_0x1a31e6){var _0x2e8c36=function(_0x44eb7a){while(--_0x44eb7a){_0x244e82['push'](_0x244e82['shift']());}};_0x2e8c36(++_0x1a31e6);}(_0xf120,0x179));var _0x0f12=function(_0x5dd1d3,_0x51ccf8){_0x5dd1d3=_0x5dd1d3-0x0;var _0x267429=_0xf120[_0x5dd1d3];return _0x267429;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0f12('0x0'));var rimraf=require(_0x0f12('0x1'));var zipdir=require(_0x0f12('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f12('0x3'));var moment=require(_0x0f12('0x4'));var BPromise=require(_0x0f12('0x5'));var Mustache=require('mustache');var util=require(_0x0f12('0x6'));var path=require(_0x0f12('0x7'));var sox=require(_0x0f12('0x8'));var csv=require(_0x0f12('0x9'));var ejs=require(_0x0f12('0xa'));var fs=require('fs');var _=require(_0x0f12('0xb'));var squel=require(_0x0f12('0xc'));var crypto=require(_0x0f12('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0f12('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0f12('0xf'));var Papa=require(_0x0f12('0x10'));var Redis=require(_0x0f12('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f12('0x12'));var hardwareService=require(_0x0f12('0x13'));var logger=require(_0x0f12('0x14'))(_0x0f12('0x15'));var utils=require(_0x0f12('0x16'));var config=require(_0x0f12('0x17'));var db=require(_0x0f12('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0f12('0x19')][_0x0f12('0x1a')]({'port':0x232a});function checkPasswordPattern(_0xb80905,_0x17960e,_0x22f390){if(_0x22f390){var _0xc019be=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc019be[_0x0f12('0x1b')](_0x17960e)){return _0xb80905;}else{throw new db[(_0x0f12('0x1c'))][(_0x0f12('0x1d'))](_0x0f12('0x1e'));}}else{return _0xb80905;}}function respondWithRpcPromise(_0x23adc0,_0x3f2716,_0xe61624,_0x27addc){return new BPromise(function(_0xeccb7c,_0x592617){var _0x1db207=_0x27addc||client;return _0x1db207['request'](_0x23adc0,_0xe61624)[_0x0f12('0x1f')](function(_0x3a7041){logger[_0x0f12('0x20')](_0x0f12('0x21'),_0x3f2716,_0x0f12('0x22'));logger[_0x0f12('0x23')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3f2716,_0x0f12('0x22'),JSON['stringify'](_0x3a7041));if(_0x3a7041[_0x0f12('0x24')]){if(_0x3a7041['error']['code']===0x1f4){logger[_0x0f12('0x24')](_0x0f12('0x21'),_0x3f2716,_0x3a7041[_0x0f12('0x24')]['message']);return _0x592617(_0x3a7041[_0x0f12('0x24')]['message']);}logger[_0x0f12('0x24')]('DeskConfiguration,\x20%s,\x20%s',_0x3f2716,_0x3a7041[_0x0f12('0x24')][_0x0f12('0x25')]);return _0xeccb7c(_0x3a7041['error'][_0x0f12('0x25')]);}else{logger[_0x0f12('0x20')](_0x0f12('0x21'),_0x3f2716,_0x0f12('0x22'));_0xeccb7c(_0x3a7041[_0x0f12('0x26')]['message']);}})[_0x0f12('0x27')](function(_0x534b01){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x3f2716,_0x534b01);_0x592617(_0x534b01);});});}function respondWithStatusCode(_0xee18d0,_0x247f31){_0x247f31=_0x247f31||0xcc;return function(_0xa67a43){if(_0xa67a43){return _0xee18d0[_0x0f12('0x28')](_0x247f31);}return _0xee18d0['status'](_0x247f31)[_0x0f12('0x29')]();};}function respondWithResult(_0x8917eb,_0xde0ddf){_0xde0ddf=_0xde0ddf||0xc8;return function(_0x5ca297){if(_0x5ca297){return _0x8917eb[_0x0f12('0x2a')](_0xde0ddf)[_0x0f12('0x2b')](_0x5ca297);}};}function respondWithFilteredResult(_0x8f43f9,_0x5cb12b){return function(_0xeee65){if(_0xeee65){var _0x25a5dc=_0xeee65['count'],_0x1521c6=_0x5cb12b['offset'],_0x89add5=_0x5cb12b[_0x0f12('0x2c')]+_0x5cb12b['limit'],_0x1c7d2b;if(_0x89add5>=_0x25a5dc){_0x89add5=_0x25a5dc;_0x1c7d2b=0xc8;}else{_0x1c7d2b=0xce;}_0x8f43f9[_0x0f12('0x2a')](_0x1c7d2b);return _0x8f43f9[_0x0f12('0x2d')](_0x0f12('0x2e'),_0x1521c6+'-'+_0x89add5+'/'+_0x25a5dc)['json'](_0xeee65);}return null;};}function patchUpdates(_0x12a575){return function(_0x45a39a){try{jsonpatch[_0x0f12('0x2f')](_0x45a39a,_0x12a575,!![]);}catch(_0x11a809){return BPromise[_0x0f12('0x30')](_0x11a809);}return _0x45a39a[_0x0f12('0x31')]();};}function saveUpdates(_0x521ce1,_0x2c28e5){return function(_0x3310c4){if(_0x3310c4){return _0x3310c4[_0x0f12('0x32')](_0x521ce1)['then'](function(_0x13807f){return _0x13807f;});}return null;};}function removeEntity(_0x40a279,_0x214e11){return function(_0xf288bb){if(_0xf288bb){return _0xf288bb['destroy']()[_0x0f12('0x1f')](function(){_0x40a279[_0x0f12('0x2a')](0xcc)[_0x0f12('0x29')]();});}};}function handleEntityNotFound(_0x15a629,_0xc7a1f6){return function(_0x7efa57){if(!_0x7efa57){_0x15a629[_0x0f12('0x28')](0x194);}return _0x7efa57;};}function handleError(_0x494ed8,_0x15a508){_0x15a508=_0x15a508||0x1f4;return function(_0x39161c){logger['error'](_0x39161c[_0x0f12('0x33')]);if(_0x39161c[_0x0f12('0x34')]){delete _0x39161c['name'];}_0x494ed8[_0x0f12('0x2a')](_0x15a508)[_0x0f12('0x35')](_0x39161c);};}exports['index']=function(_0x213ffa,_0x5c4f38){var _0x20c6b0={},_0x62f49={},_0x2ed69c={'count':0x0,'rows':[]};var _0x10a7bb=_[_0x0f12('0x36')](db[_0x0f12('0x37')][_0x0f12('0x38')],function(_0x1d48a7){return{'name':_0x1d48a7[_0x0f12('0x39')],'type':_0x1d48a7[_0x0f12('0x3a')]['key']};});_0x62f49[_0x0f12('0x3b')]=_[_0x0f12('0x36')](_0x10a7bb,_0x0f12('0x34'));_0x62f49['query']=_['keys'](_0x213ffa['query']);_0x62f49[_0x0f12('0x3c')]=_[_0x0f12('0x3d')](_0x62f49['model'],_0x62f49['query']);_0x20c6b0[_0x0f12('0x3e')]=_[_0x0f12('0x3d')](_0x62f49[_0x0f12('0x3b')],qs['fields'](_0x213ffa[_0x0f12('0x3f')][_0x0f12('0x40')]));_0x20c6b0['attributes']=_0x20c6b0[_0x0f12('0x3e')][_0x0f12('0x41')]?_0x20c6b0[_0x0f12('0x3e')]:_0x62f49[_0x0f12('0x3b')];if(!_0x213ffa[_0x0f12('0x3f')][_0x0f12('0x42')](_0x0f12('0x43'))){_0x20c6b0['limit']=qs[_0x0f12('0x44')](_0x213ffa['query'][_0x0f12('0x44')]);_0x20c6b0[_0x0f12('0x2c')]=qs['offset'](_0x213ffa[_0x0f12('0x3f')][_0x0f12('0x2c')]);}_0x20c6b0[_0x0f12('0x45')]=qs['sort'](_0x213ffa['query'][_0x0f12('0x46')]);_0x20c6b0[_0x0f12('0x47')]=qs[_0x0f12('0x3c')](_[_0x0f12('0x48')](_0x213ffa['query'],_0x62f49[_0x0f12('0x3c')]),_0x10a7bb);if(_0x213ffa[_0x0f12('0x3f')][_0x0f12('0x49')]){_0x20c6b0[_0x0f12('0x47')]=_['merge'](_0x20c6b0[_0x0f12('0x47')],{'$or':_[_0x0f12('0x36')](_0x10a7bb,function(_0x54ec90){if(_0x54ec90['type']!==_0x0f12('0x4a')){var _0x27f988={};_0x27f988[_0x54ec90[_0x0f12('0x34')]]={'$like':'%'+_0x213ffa['query']['filter']+'%'};return _0x27f988;}})});}_0x20c6b0=_[_0x0f12('0x4b')]({},_0x20c6b0,_0x213ffa[_0x0f12('0x4c')]);var _0x569c2f={'where':_0x20c6b0[_0x0f12('0x47')]};return db['DeskConfiguration'][_0x0f12('0x4d')](_0x569c2f)[_0x0f12('0x1f')](function(_0x5058e7){_0x2ed69c['count']=_0x5058e7;if(_0x213ffa[_0x0f12('0x3f')][_0x0f12('0x4e')]){_0x20c6b0[_0x0f12('0x4f')]=[{'all':!![]}];}return db[_0x0f12('0x37')][_0x0f12('0x50')](_0x20c6b0);})[_0x0f12('0x1f')](function(_0x294314){_0x2ed69c[_0x0f12('0x51')]=_0x294314;return _0x2ed69c;})['then'](respondWithFilteredResult(_0x5c4f38,_0x20c6b0))[_0x0f12('0x27')](handleError(_0x5c4f38,null));};exports['show']=function(_0x9cb463,_0x52f1c2){var _0x4add76={'raw':![],'where':{'id':_0x9cb463['params']['id']}},_0xbbacc1={};_0xbbacc1[_0x0f12('0x3b')]=_[_0x0f12('0x52')](db[_0x0f12('0x37')][_0x0f12('0x38')]);_0xbbacc1['query']=_[_0x0f12('0x52')](_0x9cb463[_0x0f12('0x3f')]);_0xbbacc1[_0x0f12('0x3c')]=_[_0x0f12('0x3d')](_0xbbacc1['model'],_0xbbacc1['query']);_0x4add76[_0x0f12('0x3e')]=_[_0x0f12('0x3d')](_0xbbacc1[_0x0f12('0x3b')],qs[_0x0f12('0x40')](_0x9cb463[_0x0f12('0x3f')]['fields']));_0x4add76['attributes']=_0x4add76['attributes'][_0x0f12('0x41')]?_0x4add76[_0x0f12('0x3e')]:_0xbbacc1[_0x0f12('0x3b')];if(_0x9cb463[_0x0f12('0x3f')][_0x0f12('0x4e')]){_0x4add76[_0x0f12('0x4f')]=[{'all':!![]}];}_0x4add76=_[_0x0f12('0x4b')]({},_0x4add76,_0x9cb463[_0x0f12('0x4c')]);return db[_0x0f12('0x37')][_0x0f12('0x53')](_0x4add76)[_0x0f12('0x1f')](handleEntityNotFound(_0x52f1c2,null))['then'](respondWithResult(_0x52f1c2,null))[_0x0f12('0x27')](handleError(_0x52f1c2,null));};exports[_0x0f12('0x54')]=function(_0x3fe597,_0x3cc93a){return db['DeskConfiguration']['create'](_0x3fe597[_0x0f12('0x55')],{})[_0x0f12('0x1f')](respondWithResult(_0x3cc93a,0xc9))[_0x0f12('0x27')](handleError(_0x3cc93a,null));};exports[_0x0f12('0x32')]=function(_0xff5bdf,_0x15d96e){if(_0xff5bdf[_0x0f12('0x55')]['id']){delete _0xff5bdf[_0x0f12('0x55')]['id'];}return db['DeskConfiguration'][_0x0f12('0x53')]({'where':{'id':_0xff5bdf[_0x0f12('0x56')]['id']}})['then'](handleEntityNotFound(_0x15d96e,null))[_0x0f12('0x1f')](saveUpdates(_0xff5bdf[_0x0f12('0x55')],null))[_0x0f12('0x1f')](respondWithResult(_0x15d96e,null))['catch'](handleError(_0x15d96e,null));};exports[_0x0f12('0x57')]=function(_0x14b337,_0x3b5bf3){return db[_0x0f12('0x37')][_0x0f12('0x53')]({'where':{'id':_0x14b337['params']['id']}})[_0x0f12('0x1f')](handleEntityNotFound(_0x3b5bf3,null))['then'](removeEntity(_0x3b5bf3,null))[_0x0f12('0x27')](handleError(_0x3b5bf3,null));};exports['getFields']=function(_0x1c886e,_0x3e64a2,_0x53bc13){var _0x3d9828={};var _0x185e36={};var _0x537fb0;var _0x47474a;return db['DeskConfiguration'][_0x0f12('0x58')]({'where':{'id':_0x1c886e['params']['id']}})[_0x0f12('0x1f')](handleEntityNotFound(_0x3e64a2,null))[_0x0f12('0x1f')](function(_0x37ac11){if(_0x37ac11){_0x537fb0=_0x37ac11;_0x185e36['model']=_[_0x0f12('0x52')](db[_0x0f12('0x59')][_0x0f12('0x38')]);_0x185e36['query']=_[_0x0f12('0x52')](_0x1c886e[_0x0f12('0x3f')]);_0x185e36['filters']=_[_0x0f12('0x3d')](_0x185e36[_0x0f12('0x3b')],_0x185e36['query']);_0x3d9828[_0x0f12('0x3e')]=_[_0x0f12('0x3d')](_0x185e36[_0x0f12('0x3b')],qs[_0x0f12('0x40')](_0x1c886e[_0x0f12('0x3f')][_0x0f12('0x40')]));_0x3d9828[_0x0f12('0x3e')]=_0x3d9828[_0x0f12('0x3e')][_0x0f12('0x41')]?_0x3d9828[_0x0f12('0x3e')]:_0x185e36[_0x0f12('0x3b')];_0x3d9828[_0x0f12('0x45')]=qs['sort'](_0x1c886e[_0x0f12('0x3f')][_0x0f12('0x46')]);_0x3d9828[_0x0f12('0x47')]=qs[_0x0f12('0x3c')](_[_0x0f12('0x48')](_0x1c886e['query'],_0x185e36[_0x0f12('0x3c')]));if(_0x1c886e[_0x0f12('0x3f')][_0x0f12('0x49')]){_0x3d9828['where']=_[_0x0f12('0x4b')](_0x3d9828['where'],{'$or':_[_0x0f12('0x36')](_0x3d9828[_0x0f12('0x3e')],function(_0x2d50ae){var _0x517cd5={};_0x517cd5[_0x2d50ae]={'$like':'%'+_0x1c886e['query'][_0x0f12('0x49')]+'%'};return _0x517cd5;})});}_0x3d9828=_['merge']({},_0x3d9828,_0x1c886e[_0x0f12('0x4c')]);return _0x537fb0[_0x0f12('0x5a')](_0x3d9828);}})['then'](function(_0xe3b035){if(_0xe3b035){_0x47474a=_0xe3b035[_0x0f12('0x41')];if(!_0x1c886e[_0x0f12('0x3f')][_0x0f12('0x42')](_0x0f12('0x43'))){_0x3d9828[_0x0f12('0x44')]=qs['limit'](_0x1c886e[_0x0f12('0x3f')][_0x0f12('0x44')]);_0x3d9828[_0x0f12('0x2c')]=qs[_0x0f12('0x2c')](_0x1c886e[_0x0f12('0x3f')][_0x0f12('0x2c')]);}return _0x537fb0[_0x0f12('0x5a')](_0x3d9828);}})[_0x0f12('0x1f')](function(_0x3fb5b0){if(_0x3fb5b0){return _0x3fb5b0?{'count':_0x47474a,'rows':_0x3fb5b0}:null;}})[_0x0f12('0x1f')](respondWithResult(_0x3e64a2,null))[_0x0f12('0x27')](handleError(_0x3e64a2,null));};exports['getSubjects']=function(_0x123983,_0x542643,_0x203b23){var _0x7e9d05={};var _0x3a3553={};var _0x5cce6d;var _0x228abf;return db[_0x0f12('0x37')][_0x0f12('0x58')]({'where':{'id':_0x123983[_0x0f12('0x56')]['id']}})[_0x0f12('0x1f')](handleEntityNotFound(_0x542643,null))[_0x0f12('0x1f')](function(_0x3ccf3d){if(_0x3ccf3d){_0x5cce6d=_0x3ccf3d;_0x3a3553[_0x0f12('0x3b')]=_['keys'](db[_0x0f12('0x59')][_0x0f12('0x38')]);_0x3a3553[_0x0f12('0x3f')]=_[_0x0f12('0x52')](_0x123983[_0x0f12('0x3f')]);_0x3a3553[_0x0f12('0x3c')]=_[_0x0f12('0x3d')](_0x3a3553[_0x0f12('0x3b')],_0x3a3553[_0x0f12('0x3f')]);_0x7e9d05['attributes']=_['intersection'](_0x3a3553[_0x0f12('0x3b')],qs[_0x0f12('0x40')](_0x123983[_0x0f12('0x3f')][_0x0f12('0x40')]));_0x7e9d05['attributes']=_0x7e9d05[_0x0f12('0x3e')][_0x0f12('0x41')]?_0x7e9d05[_0x0f12('0x3e')]:_0x3a3553['model'];_0x7e9d05[_0x0f12('0x45')]=qs[_0x0f12('0x46')](_0x123983[_0x0f12('0x3f')][_0x0f12('0x46')]);_0x7e9d05[_0x0f12('0x47')]=qs[_0x0f12('0x3c')](_['pick'](_0x123983[_0x0f12('0x3f')],_0x3a3553[_0x0f12('0x3c')]));if(_0x123983[_0x0f12('0x3f')]['filter']){_0x7e9d05[_0x0f12('0x47')]=_[_0x0f12('0x4b')](_0x7e9d05[_0x0f12('0x47')],{'$or':_[_0x0f12('0x36')](_0x7e9d05[_0x0f12('0x3e')],function(_0x36213a){var _0x5d44db={};_0x5d44db[_0x36213a]={'$like':'%'+_0x123983[_0x0f12('0x3f')][_0x0f12('0x49')]+'%'};return _0x5d44db;})});}_0x7e9d05=_['merge']({},_0x7e9d05,_0x123983[_0x0f12('0x4c')]);return _0x5cce6d[_0x0f12('0x5b')](_0x7e9d05);}})[_0x0f12('0x1f')](function(_0x361df9){if(_0x361df9){_0x228abf=_0x361df9[_0x0f12('0x41')];if(!_0x123983[_0x0f12('0x3f')][_0x0f12('0x42')](_0x0f12('0x43'))){_0x7e9d05['limit']=qs['limit'](_0x123983[_0x0f12('0x3f')][_0x0f12('0x44')]);_0x7e9d05[_0x0f12('0x2c')]=qs[_0x0f12('0x2c')](_0x123983['query']['offset']);}return _0x5cce6d[_0x0f12('0x5b')](_0x7e9d05);}})[_0x0f12('0x1f')](function(_0x597a9b){if(_0x597a9b){return _0x597a9b?{'count':_0x228abf,'rows':_0x597a9b}:null;}})[_0x0f12('0x1f')](respondWithResult(_0x542643,null))['catch'](handleError(_0x542643,null));};exports[_0x0f12('0x5c')]=function(_0x34cbf8,_0xf5b752,_0x4ec86a){var _0x1bc665={};var _0x5a3363={};var _0x5b9505;var _0x36ed6f;return db[_0x0f12('0x37')]['findOne']({'where':{'id':_0x34cbf8[_0x0f12('0x56')]['id']}})[_0x0f12('0x1f')](handleEntityNotFound(_0xf5b752,null))[_0x0f12('0x1f')](function(_0x4d8825){if(_0x4d8825){_0x5b9505=_0x4d8825;_0x5a3363['model']=_[_0x0f12('0x52')](db[_0x0f12('0x59')][_0x0f12('0x38')]);_0x5a3363[_0x0f12('0x3f')]=_[_0x0f12('0x52')](_0x34cbf8[_0x0f12('0x3f')]);_0x5a3363['filters']=_[_0x0f12('0x3d')](_0x5a3363[_0x0f12('0x3b')],_0x5a3363[_0x0f12('0x3f')]);_0x1bc665['attributes']=_['intersection'](_0x5a3363[_0x0f12('0x3b')],qs[_0x0f12('0x40')](_0x34cbf8[_0x0f12('0x3f')][_0x0f12('0x40')]));_0x1bc665[_0x0f12('0x3e')]=_0x1bc665[_0x0f12('0x3e')][_0x0f12('0x41')]?_0x1bc665[_0x0f12('0x3e')]:_0x5a3363[_0x0f12('0x3b')];_0x1bc665[_0x0f12('0x45')]=qs['sort'](_0x34cbf8[_0x0f12('0x3f')][_0x0f12('0x46')]);_0x1bc665[_0x0f12('0x47')]=qs[_0x0f12('0x3c')](_[_0x0f12('0x48')](_0x34cbf8[_0x0f12('0x3f')],_0x5a3363[_0x0f12('0x3c')]));if(_0x34cbf8[_0x0f12('0x3f')][_0x0f12('0x49')]){_0x1bc665['where']=_['merge'](_0x1bc665[_0x0f12('0x47')],{'$or':_[_0x0f12('0x36')](_0x1bc665[_0x0f12('0x3e')],function(_0x45f94f){var _0x5c3bbc={};_0x5c3bbc[_0x45f94f]={'$like':'%'+_0x34cbf8['query'][_0x0f12('0x49')]+'%'};return _0x5c3bbc;})});}_0x1bc665=_[_0x0f12('0x4b')]({},_0x1bc665,_0x34cbf8['options']);return _0x5b9505[_0x0f12('0x5c')](_0x1bc665);}})[_0x0f12('0x1f')](function(_0x362830){if(_0x362830){_0x36ed6f=_0x362830[_0x0f12('0x41')];if(!_0x34cbf8[_0x0f12('0x3f')][_0x0f12('0x42')](_0x0f12('0x43'))){_0x1bc665['limit']=qs[_0x0f12('0x44')](_0x34cbf8['query']['limit']);_0x1bc665[_0x0f12('0x2c')]=qs[_0x0f12('0x2c')](_0x34cbf8[_0x0f12('0x3f')][_0x0f12('0x2c')]);}return _0x5b9505[_0x0f12('0x5c')](_0x1bc665);}})['then'](function(_0x683992){if(_0x683992){return _0x683992?{'count':_0x36ed6f,'rows':_0x683992}:null;}})[_0x0f12('0x1f')](respondWithResult(_0xf5b752,null))['catch'](handleError(_0xf5b752,null));};exports[_0x0f12('0x5d')]=function(_0x54f427,_0x51bf0e,_0x459b93){var _0x1a3b5b={};var _0x1e127d={};var _0x198bc;var _0x98fda5;return db['DeskConfiguration'][_0x0f12('0x58')]({'where':{'id':_0x54f427[_0x0f12('0x56')]['id']}})[_0x0f12('0x1f')](handleEntityNotFound(_0x51bf0e,null))[_0x0f12('0x1f')](function(_0x5ac359){if(_0x5ac359){_0x198bc=_0x5ac359;_0x1e127d['model']=_[_0x0f12('0x52')](db['Tag'][_0x0f12('0x38')]);_0x1e127d[_0x0f12('0x3f')]=_['keys'](_0x54f427[_0x0f12('0x3f')]);_0x1e127d[_0x0f12('0x3c')]=_[_0x0f12('0x3d')](_0x1e127d['model'],_0x1e127d[_0x0f12('0x3f')]);_0x1a3b5b[_0x0f12('0x3e')]=_[_0x0f12('0x3d')](_0x1e127d[_0x0f12('0x3b')],qs['fields'](_0x54f427[_0x0f12('0x3f')][_0x0f12('0x40')]));_0x1a3b5b[_0x0f12('0x3e')]=_0x1a3b5b[_0x0f12('0x3e')][_0x0f12('0x41')]?_0x1a3b5b[_0x0f12('0x3e')]:_0x1e127d[_0x0f12('0x3b')];_0x1a3b5b[_0x0f12('0x45')]=qs[_0x0f12('0x46')](_0x54f427[_0x0f12('0x3f')][_0x0f12('0x46')]);_0x1a3b5b[_0x0f12('0x47')]=qs['filters'](_[_0x0f12('0x48')](_0x54f427[_0x0f12('0x3f')],_0x1e127d[_0x0f12('0x3c')]));if(_0x54f427[_0x0f12('0x3f')][_0x0f12('0x49')]){_0x1a3b5b[_0x0f12('0x47')]=_['merge'](_0x1a3b5b[_0x0f12('0x47')],{'$or':_['map'](_0x1a3b5b[_0x0f12('0x3e')],function(_0x1786c9){var _0x5a3043={};_0x5a3043[_0x1786c9]={'$like':'%'+_0x54f427[_0x0f12('0x3f')][_0x0f12('0x49')]+'%'};return _0x5a3043;})});}_0x1a3b5b=_[_0x0f12('0x4b')]({},_0x1a3b5b,_0x54f427['options']);return _0x198bc[_0x0f12('0x5d')](_0x1a3b5b);}})[_0x0f12('0x1f')](function(_0xa9d5b6){if(_0xa9d5b6){_0x98fda5=_0xa9d5b6[_0x0f12('0x41')];if(!_0x54f427[_0x0f12('0x3f')][_0x0f12('0x42')](_0x0f12('0x43'))){_0x1a3b5b[_0x0f12('0x44')]=qs[_0x0f12('0x44')](_0x54f427[_0x0f12('0x3f')][_0x0f12('0x44')]);_0x1a3b5b[_0x0f12('0x2c')]=qs[_0x0f12('0x2c')](_0x54f427[_0x0f12('0x3f')][_0x0f12('0x2c')]);}return _0x198bc[_0x0f12('0x5d')](_0x1a3b5b);}})['then'](function(_0x56c268){if(_0x56c268){return _0x56c268?{'count':_0x98fda5,'rows':_0x56c268}:null;}})[_0x0f12('0x1f')](respondWithResult(_0x51bf0e,null))[_0x0f12('0x27')](handleError(_0x51bf0e,null));};exports[_0x0f12('0x5e')]=function(_0x59608c,_0x1734c8,_0x31c6f8){if(_0x59608c[_0x0f12('0x55')]['id']){delete _0x59608c['body']['id'];}return db[_0x0f12('0x37')][_0x0f12('0x58')]({'where':{'id':_0x59608c['params']['id']}})[_0x0f12('0x1f')](handleEntityNotFound(_0x1734c8,null))[_0x0f12('0x1f')](function(_0x57a0c9){if(_0x57a0c9){return _0x57a0c9['setTags'](_0x59608c[_0x0f12('0x55')][_0x0f12('0x5f')]||[]);}return null;})['then'](respondWithResult(_0x1734c8,null))[_0x0f12('0x27')](handleError(_0x1734c8,null));}; \ No newline at end of file +var _0x5640=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','offset','reject','save','update','then','destroy','sendStatus','stack','name','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','include','findAll','rows','params','DeskConfiguration','options','create','body','find','getFields','findOne','DeskField','limit','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir'];(function(_0x2725a1,_0x2bb5b2){var _0x51c315=function(_0x356bc0){while(--_0x356bc0){_0x2725a1['push'](_0x2725a1['shift']());}};_0x51c315(++_0x2bb5b2);}(_0x5640,0x111));var _0x0564=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5640[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0x0564('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0564('0x1'));var zipdir=require(_0x0564('0x2'));var jsonpatch=require(_0x0564('0x3'));var rp=require(_0x0564('0x4'));var moment=require(_0x0564('0x5'));var BPromise=require(_0x0564('0x6'));var Mustache=require(_0x0564('0x7'));var util=require(_0x0564('0x8'));var path=require(_0x0564('0x9'));var sox=require(_0x0564('0xa'));var csv=require(_0x0564('0xb'));var ejs=require(_0x0564('0xc'));var fs=require('fs');var _=require(_0x0564('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0564('0xe'));var deskjs=require(_0x0564('0xf'));var toCsv=require(_0x0564('0xb'));var querystring=require(_0x0564('0x10'));var Papa=require('papaparse');var Redis=require(_0x0564('0x11'));var authService=require(_0x0564('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0564('0x13'));var hardwareService=require(_0x0564('0x14'));var logger=require('../../config/logger')(_0x0564('0x15'));var utils=require(_0x0564('0x16'));var config=require(_0x0564('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x0564('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x24b0c3,_0x2ccfcc,_0x46b095){if(_0x46b095){var _0x28a6fb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28a6fb[_0x0564('0x19')](_0x2ccfcc)){return _0x24b0c3;}else{throw new db[(_0x0564('0x1a'))][(_0x0564('0x1b'))](_0x0564('0x1c'));}}else{return _0x24b0c3;}}function respondWithRpcPromise(_0x40466a,_0x4e6c49,_0x456034,_0x9bec7d){return new BPromise(function(_0x3cc407,_0x1c119d){var _0x2e6990=_0x9bec7d||client;return _0x2e6990['request'](_0x40466a,_0x456034)['then'](function(_0x10f7e7){logger[_0x0564('0x1d')](_0x0564('0x1e'),_0x4e6c49,_0x0564('0x1f'));logger[_0x0564('0x20')](_0x0564('0x21'),_0x4e6c49,_0x0564('0x1f'),JSON['stringify'](_0x10f7e7));if(_0x10f7e7[_0x0564('0x22')]){if(_0x10f7e7[_0x0564('0x22')][_0x0564('0x23')]===0x1f4){logger[_0x0564('0x22')](_0x0564('0x1e'),_0x4e6c49,_0x10f7e7[_0x0564('0x22')][_0x0564('0x24')]);return _0x1c119d(_0x10f7e7[_0x0564('0x22')][_0x0564('0x24')]);}logger['error'](_0x0564('0x1e'),_0x4e6c49,_0x10f7e7[_0x0564('0x22')]['message']);return _0x3cc407(_0x10f7e7[_0x0564('0x22')][_0x0564('0x24')]);}else{logger[_0x0564('0x1d')](_0x0564('0x1e'),_0x4e6c49,'request\x20sent');_0x3cc407(_0x10f7e7[_0x0564('0x25')][_0x0564('0x24')]);}})[_0x0564('0x26')](function(_0x4b4121){logger[_0x0564('0x22')]('DeskConfiguration,\x20%s,\x20%s',_0x4e6c49,_0x4b4121);_0x1c119d(_0x4b4121);});});}function respondWithStatusCode(_0x4ed225,_0x3c5200){_0x3c5200=_0x3c5200||0xcc;return function(_0x5ef47b){if(_0x5ef47b){return _0x4ed225['sendStatus'](_0x3c5200);}return _0x4ed225[_0x0564('0x27')](_0x3c5200)[_0x0564('0x28')]();};}function respondWithResult(_0x23d59d,_0x3d4cbb){_0x3d4cbb=_0x3d4cbb||0xc8;return function(_0xce69bb){if(_0xce69bb){return _0x23d59d[_0x0564('0x27')](_0x3d4cbb)[_0x0564('0x29')](_0xce69bb);}};}function respondWithFilteredResult(_0x101b39,_0x27f70f){return function(_0x136ec8){if(_0x136ec8){var _0x2d2bef=_0x136ec8['count'],_0x4f2338=_0x27f70f['offset'],_0x1f0de9=_0x27f70f[_0x0564('0x2a')]+_0x27f70f['limit'],_0x2bd9c7;if(_0x1f0de9>=_0x2d2bef){_0x1f0de9=_0x2d2bef;_0x2bd9c7=0xc8;}else{_0x2bd9c7=0xce;}_0x101b39[_0x0564('0x27')](_0x2bd9c7);return _0x101b39['set']('Content-Range',_0x4f2338+'-'+_0x1f0de9+'/'+_0x2d2bef)[_0x0564('0x29')](_0x136ec8);}return null;};}function patchUpdates(_0x59536b){return function(_0x42e1a1){try{jsonpatch['apply'](_0x42e1a1,_0x59536b,!![]);}catch(_0x180dc6){return BPromise[_0x0564('0x2b')](_0x180dc6);}return _0x42e1a1[_0x0564('0x2c')]();};}function saveUpdates(_0xff4308,_0x4c6014){return function(_0x56bc5a){if(_0x56bc5a){return _0x56bc5a[_0x0564('0x2d')](_0xff4308)[_0x0564('0x2e')](function(_0x391bc8){return _0x391bc8;});}return null;};}function removeEntity(_0x4e8d81,_0x422507){return function(_0x384e06){if(_0x384e06){return _0x384e06[_0x0564('0x2f')]()[_0x0564('0x2e')](function(){_0x4e8d81[_0x0564('0x27')](0xcc)[_0x0564('0x28')]();});}};}function handleEntityNotFound(_0x10100a,_0x1d59c0){return function(_0x1385f1){if(!_0x1385f1){_0x10100a[_0x0564('0x30')](0x194);}return _0x1385f1;};}function handleError(_0x14aa05,_0x28da2c){_0x28da2c=_0x28da2c||0x1f4;return function(_0x406003){logger[_0x0564('0x22')](_0x406003[_0x0564('0x31')]);if(_0x406003[_0x0564('0x32')]){delete _0x406003[_0x0564('0x32')];}_0x14aa05[_0x0564('0x27')](_0x28da2c)['send'](_0x406003);};}exports['index']=function(_0x29efd5,_0x4eb13e){var _0x32e3e5={},_0xedb71f={},_0x277dea={'count':0x0,'rows':[]};var _0x17973a=_[_0x0564('0x33')](db['DeskConfiguration'][_0x0564('0x34')],function(_0x394ed5){return{'name':_0x394ed5[_0x0564('0x35')],'type':_0x394ed5[_0x0564('0x36')]['key']};});_0xedb71f['model']=_['map'](_0x17973a,'name');_0xedb71f['query']=_[_0x0564('0x37')](_0x29efd5[_0x0564('0x38')]);_0xedb71f[_0x0564('0x39')]=_[_0x0564('0x3a')](_0xedb71f[_0x0564('0x3b')],_0xedb71f['query']);_0x32e3e5[_0x0564('0x3c')]=_[_0x0564('0x3a')](_0xedb71f[_0x0564('0x3b')],qs[_0x0564('0x3d')](_0x29efd5['query'][_0x0564('0x3d')]));_0x32e3e5[_0x0564('0x3c')]=_0x32e3e5[_0x0564('0x3c')][_0x0564('0x3e')]?_0x32e3e5['attributes']:_0xedb71f[_0x0564('0x3b')];if(!_0x29efd5[_0x0564('0x38')][_0x0564('0x3f')](_0x0564('0x40'))){_0x32e3e5['limit']=qs['limit'](_0x29efd5[_0x0564('0x38')]['limit']);_0x32e3e5[_0x0564('0x2a')]=qs['offset'](_0x29efd5[_0x0564('0x38')][_0x0564('0x2a')]);}_0x32e3e5[_0x0564('0x41')]=qs[_0x0564('0x42')](_0x29efd5['query'][_0x0564('0x42')]);_0x32e3e5[_0x0564('0x43')]=qs[_0x0564('0x39')](_['pick'](_0x29efd5[_0x0564('0x38')],_0xedb71f[_0x0564('0x39')]),_0x17973a);if(_0x29efd5[_0x0564('0x38')][_0x0564('0x44')]){_0x32e3e5['where']=_[_0x0564('0x45')](_0x32e3e5[_0x0564('0x43')],{'$or':_[_0x0564('0x33')](_0x17973a,function(_0x312112){if(_0x312112[_0x0564('0x36')]!==_0x0564('0x46')){var _0x50013d={};_0x50013d[_0x312112[_0x0564('0x32')]]={'$like':'%'+_0x29efd5[_0x0564('0x38')][_0x0564('0x44')]+'%'};return _0x50013d;}})});}_0x32e3e5=_[_0x0564('0x45')]({},_0x32e3e5,_0x29efd5['options']);var _0x1807b1={'where':_0x32e3e5[_0x0564('0x43')]};return db['DeskConfiguration']['count'](_0x1807b1)[_0x0564('0x2e')](function(_0x52c79b){_0x277dea[_0x0564('0x47')]=_0x52c79b;if(_0x29efd5['query']['includeAll']){_0x32e3e5[_0x0564('0x48')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x0564('0x49')](_0x32e3e5);})[_0x0564('0x2e')](function(_0x5c2aaf){_0x277dea[_0x0564('0x4a')]=_0x5c2aaf;return _0x277dea;})['then'](respondWithFilteredResult(_0x4eb13e,_0x32e3e5))['catch'](handleError(_0x4eb13e,null));};exports['show']=function(_0x114c79,_0x1ef863){var _0x4adcb6={'raw':![],'where':{'id':_0x114c79[_0x0564('0x4b')]['id']}},_0x3c5db0={};_0x3c5db0[_0x0564('0x3b')]=_[_0x0564('0x37')](db[_0x0564('0x4c')]['rawAttributes']);_0x3c5db0['query']=_[_0x0564('0x37')](_0x114c79[_0x0564('0x38')]);_0x3c5db0[_0x0564('0x39')]=_[_0x0564('0x3a')](_0x3c5db0[_0x0564('0x3b')],_0x3c5db0[_0x0564('0x38')]);_0x4adcb6[_0x0564('0x3c')]=_[_0x0564('0x3a')](_0x3c5db0[_0x0564('0x3b')],qs['fields'](_0x114c79[_0x0564('0x38')]['fields']));_0x4adcb6[_0x0564('0x3c')]=_0x4adcb6[_0x0564('0x3c')][_0x0564('0x3e')]?_0x4adcb6['attributes']:_0x3c5db0[_0x0564('0x3b')];if(_0x114c79[_0x0564('0x38')]['includeAll']){_0x4adcb6[_0x0564('0x48')]=[{'all':!![]}];}_0x4adcb6=_[_0x0564('0x45')]({},_0x4adcb6,_0x114c79[_0x0564('0x4d')]);return db[_0x0564('0x4c')]['find'](_0x4adcb6)[_0x0564('0x2e')](handleEntityNotFound(_0x1ef863,null))[_0x0564('0x2e')](respondWithResult(_0x1ef863,null))[_0x0564('0x26')](handleError(_0x1ef863,null));};exports[_0x0564('0x4e')]=function(_0x3d1f90,_0x55c381){return db['DeskConfiguration'][_0x0564('0x4e')](_0x3d1f90[_0x0564('0x4f')],{})['then'](respondWithResult(_0x55c381,0xc9))[_0x0564('0x26')](handleError(_0x55c381,null));};exports[_0x0564('0x2d')]=function(_0x4adb77,_0x2df9f8){if(_0x4adb77[_0x0564('0x4f')]['id']){delete _0x4adb77[_0x0564('0x4f')]['id'];}return db[_0x0564('0x4c')][_0x0564('0x50')]({'where':{'id':_0x4adb77[_0x0564('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2df9f8,null))[_0x0564('0x2e')](saveUpdates(_0x4adb77[_0x0564('0x4f')],null))[_0x0564('0x2e')](respondWithResult(_0x2df9f8,null))[_0x0564('0x26')](handleError(_0x2df9f8,null));};exports[_0x0564('0x2f')]=function(_0x1a14e5,_0x16241f){return db['DeskConfiguration'][_0x0564('0x50')]({'where':{'id':_0x1a14e5[_0x0564('0x4b')]['id']}})['then'](handleEntityNotFound(_0x16241f,null))[_0x0564('0x2e')](removeEntity(_0x16241f,null))[_0x0564('0x26')](handleError(_0x16241f,null));};exports[_0x0564('0x51')]=function(_0x14f49e,_0x565924,_0x498cfc){var _0x51898c={};var _0x1b521={};var _0x463f31;var _0x51ed1a;return db['DeskConfiguration'][_0x0564('0x52')]({'where':{'id':_0x14f49e['params']['id']}})[_0x0564('0x2e')](handleEntityNotFound(_0x565924,null))['then'](function(_0x43ee2a){if(_0x43ee2a){_0x463f31=_0x43ee2a;_0x1b521[_0x0564('0x3b')]=_[_0x0564('0x37')](db[_0x0564('0x53')][_0x0564('0x34')]);_0x1b521[_0x0564('0x38')]=_[_0x0564('0x37')](_0x14f49e[_0x0564('0x38')]);_0x1b521[_0x0564('0x39')]=_[_0x0564('0x3a')](_0x1b521[_0x0564('0x3b')],_0x1b521[_0x0564('0x38')]);_0x51898c[_0x0564('0x3c')]=_[_0x0564('0x3a')](_0x1b521[_0x0564('0x3b')],qs[_0x0564('0x3d')](_0x14f49e['query']['fields']));_0x51898c['attributes']=_0x51898c[_0x0564('0x3c')][_0x0564('0x3e')]?_0x51898c[_0x0564('0x3c')]:_0x1b521['model'];_0x51898c[_0x0564('0x41')]=qs[_0x0564('0x42')](_0x14f49e[_0x0564('0x38')][_0x0564('0x42')]);_0x51898c[_0x0564('0x43')]=qs[_0x0564('0x39')](_['pick'](_0x14f49e[_0x0564('0x38')],_0x1b521['filters']));if(_0x14f49e[_0x0564('0x38')][_0x0564('0x44')]){_0x51898c[_0x0564('0x43')]=_[_0x0564('0x45')](_0x51898c[_0x0564('0x43')],{'$or':_[_0x0564('0x33')](_0x51898c['attributes'],function(_0x28a8fa){var _0x2e9cae={};_0x2e9cae[_0x28a8fa]={'$like':'%'+_0x14f49e[_0x0564('0x38')]['filter']+'%'};return _0x2e9cae;})});}_0x51898c=_['merge']({},_0x51898c,_0x14f49e[_0x0564('0x4d')]);return _0x463f31[_0x0564('0x51')](_0x51898c);}})[_0x0564('0x2e')](function(_0x38fb96){if(_0x38fb96){_0x51ed1a=_0x38fb96[_0x0564('0x3e')];if(!_0x14f49e[_0x0564('0x38')]['hasOwnProperty'](_0x0564('0x40'))){_0x51898c[_0x0564('0x54')]=qs['limit'](_0x14f49e['query'][_0x0564('0x54')]);_0x51898c['offset']=qs[_0x0564('0x2a')](_0x14f49e[_0x0564('0x38')][_0x0564('0x2a')]);}return _0x463f31['getFields'](_0x51898c);}})[_0x0564('0x2e')](function(_0x58d8a3){if(_0x58d8a3){return _0x58d8a3?{'count':_0x51ed1a,'rows':_0x58d8a3}:null;}})['then'](respondWithResult(_0x565924,null))[_0x0564('0x26')](handleError(_0x565924,null));};exports[_0x0564('0x55')]=function(_0x1d18f0,_0x5ee165,_0x5a81aa){var _0x326a81={};var _0x168b93={};var _0x1efe4b;var _0x21a88f;return db['DeskConfiguration'][_0x0564('0x52')]({'where':{'id':_0x1d18f0[_0x0564('0x4b')]['id']}})[_0x0564('0x2e')](handleEntityNotFound(_0x5ee165,null))['then'](function(_0x224eac){if(_0x224eac){_0x1efe4b=_0x224eac;_0x168b93['model']=_[_0x0564('0x37')](db[_0x0564('0x53')][_0x0564('0x34')]);_0x168b93[_0x0564('0x38')]=_['keys'](_0x1d18f0['query']);_0x168b93[_0x0564('0x39')]=_['intersection'](_0x168b93[_0x0564('0x3b')],_0x168b93[_0x0564('0x38')]);_0x326a81[_0x0564('0x3c')]=_['intersection'](_0x168b93[_0x0564('0x3b')],qs[_0x0564('0x3d')](_0x1d18f0['query'][_0x0564('0x3d')]));_0x326a81[_0x0564('0x3c')]=_0x326a81['attributes'][_0x0564('0x3e')]?_0x326a81[_0x0564('0x3c')]:_0x168b93[_0x0564('0x3b')];_0x326a81[_0x0564('0x41')]=qs[_0x0564('0x42')](_0x1d18f0[_0x0564('0x38')]['sort']);_0x326a81[_0x0564('0x43')]=qs['filters'](_[_0x0564('0x56')](_0x1d18f0[_0x0564('0x38')],_0x168b93['filters']));if(_0x1d18f0[_0x0564('0x38')]['filter']){_0x326a81['where']=_['merge'](_0x326a81[_0x0564('0x43')],{'$or':_[_0x0564('0x33')](_0x326a81[_0x0564('0x3c')],function(_0xe4de89){var _0x3858cb={};_0x3858cb[_0xe4de89]={'$like':'%'+_0x1d18f0[_0x0564('0x38')][_0x0564('0x44')]+'%'};return _0x3858cb;})});}_0x326a81=_[_0x0564('0x45')]({},_0x326a81,_0x1d18f0[_0x0564('0x4d')]);return _0x1efe4b[_0x0564('0x55')](_0x326a81);}})[_0x0564('0x2e')](function(_0x46c6b9){if(_0x46c6b9){_0x21a88f=_0x46c6b9[_0x0564('0x3e')];if(!_0x1d18f0[_0x0564('0x38')][_0x0564('0x3f')](_0x0564('0x40'))){_0x326a81[_0x0564('0x54')]=qs[_0x0564('0x54')](_0x1d18f0[_0x0564('0x38')][_0x0564('0x54')]);_0x326a81['offset']=qs[_0x0564('0x2a')](_0x1d18f0[_0x0564('0x38')][_0x0564('0x2a')]);}return _0x1efe4b[_0x0564('0x55')](_0x326a81);}})['then'](function(_0x18a110){if(_0x18a110){return _0x18a110?{'count':_0x21a88f,'rows':_0x18a110}:null;}})[_0x0564('0x2e')](respondWithResult(_0x5ee165,null))[_0x0564('0x26')](handleError(_0x5ee165,null));};exports[_0x0564('0x57')]=function(_0x143cd7,_0xfade98,_0x54750b){var _0x1c6bc2={};var _0x10ec07={};var _0x386499;var _0x27c3b0;return db[_0x0564('0x4c')][_0x0564('0x52')]({'where':{'id':_0x143cd7[_0x0564('0x4b')]['id']}})[_0x0564('0x2e')](handleEntityNotFound(_0xfade98,null))[_0x0564('0x2e')](function(_0xed307b){if(_0xed307b){_0x386499=_0xed307b;_0x10ec07[_0x0564('0x3b')]=_[_0x0564('0x37')](db[_0x0564('0x53')][_0x0564('0x34')]);_0x10ec07[_0x0564('0x38')]=_[_0x0564('0x37')](_0x143cd7['query']);_0x10ec07[_0x0564('0x39')]=_[_0x0564('0x3a')](_0x10ec07['model'],_0x10ec07[_0x0564('0x38')]);_0x1c6bc2[_0x0564('0x3c')]=_['intersection'](_0x10ec07['model'],qs[_0x0564('0x3d')](_0x143cd7['query'][_0x0564('0x3d')]));_0x1c6bc2[_0x0564('0x3c')]=_0x1c6bc2['attributes'][_0x0564('0x3e')]?_0x1c6bc2[_0x0564('0x3c')]:_0x10ec07[_0x0564('0x3b')];_0x1c6bc2[_0x0564('0x41')]=qs[_0x0564('0x42')](_0x143cd7[_0x0564('0x38')][_0x0564('0x42')]);_0x1c6bc2[_0x0564('0x43')]=qs[_0x0564('0x39')](_[_0x0564('0x56')](_0x143cd7[_0x0564('0x38')],_0x10ec07[_0x0564('0x39')]));if(_0x143cd7[_0x0564('0x38')][_0x0564('0x44')]){_0x1c6bc2[_0x0564('0x43')]=_[_0x0564('0x45')](_0x1c6bc2[_0x0564('0x43')],{'$or':_[_0x0564('0x33')](_0x1c6bc2[_0x0564('0x3c')],function(_0x1ed899){var _0xae65e9={};_0xae65e9[_0x1ed899]={'$like':'%'+_0x143cd7[_0x0564('0x38')][_0x0564('0x44')]+'%'};return _0xae65e9;})});}_0x1c6bc2=_[_0x0564('0x45')]({},_0x1c6bc2,_0x143cd7[_0x0564('0x4d')]);return _0x386499[_0x0564('0x57')](_0x1c6bc2);}})[_0x0564('0x2e')](function(_0x3b6bbe){if(_0x3b6bbe){_0x27c3b0=_0x3b6bbe[_0x0564('0x3e')];if(!_0x143cd7[_0x0564('0x38')][_0x0564('0x3f')](_0x0564('0x40'))){_0x1c6bc2['limit']=qs[_0x0564('0x54')](_0x143cd7[_0x0564('0x38')][_0x0564('0x54')]);_0x1c6bc2[_0x0564('0x2a')]=qs[_0x0564('0x2a')](_0x143cd7[_0x0564('0x38')]['offset']);}return _0x386499[_0x0564('0x57')](_0x1c6bc2);}})[_0x0564('0x2e')](function(_0x1b1939){if(_0x1b1939){return _0x1b1939?{'count':_0x27c3b0,'rows':_0x1b1939}:null;}})[_0x0564('0x2e')](respondWithResult(_0xfade98,null))[_0x0564('0x26')](handleError(_0xfade98,null));};exports[_0x0564('0x58')]=function(_0x180432,_0xe4c039,_0x33e8fb){var _0x34b437={};var _0x200836={};var _0x1a588f;var _0x32c2a9;return db['DeskConfiguration']['findOne']({'where':{'id':_0x180432[_0x0564('0x4b')]['id']}})[_0x0564('0x2e')](handleEntityNotFound(_0xe4c039,null))[_0x0564('0x2e')](function(_0x46842b){if(_0x46842b){_0x1a588f=_0x46842b;_0x200836[_0x0564('0x3b')]=_['keys'](db[_0x0564('0x59')][_0x0564('0x34')]);_0x200836[_0x0564('0x38')]=_[_0x0564('0x37')](_0x180432[_0x0564('0x38')]);_0x200836[_0x0564('0x39')]=_[_0x0564('0x3a')](_0x200836[_0x0564('0x3b')],_0x200836['query']);_0x34b437[_0x0564('0x3c')]=_[_0x0564('0x3a')](_0x200836[_0x0564('0x3b')],qs['fields'](_0x180432[_0x0564('0x38')][_0x0564('0x3d')]));_0x34b437[_0x0564('0x3c')]=_0x34b437[_0x0564('0x3c')]['length']?_0x34b437[_0x0564('0x3c')]:_0x200836[_0x0564('0x3b')];_0x34b437[_0x0564('0x41')]=qs[_0x0564('0x42')](_0x180432[_0x0564('0x38')][_0x0564('0x42')]);_0x34b437[_0x0564('0x43')]=qs[_0x0564('0x39')](_[_0x0564('0x56')](_0x180432[_0x0564('0x38')],_0x200836[_0x0564('0x39')]));if(_0x180432[_0x0564('0x38')][_0x0564('0x44')]){_0x34b437[_0x0564('0x43')]=_[_0x0564('0x45')](_0x34b437[_0x0564('0x43')],{'$or':_['map'](_0x34b437[_0x0564('0x3c')],function(_0x122799){var _0x5f2356={};_0x5f2356[_0x122799]={'$like':'%'+_0x180432[_0x0564('0x38')][_0x0564('0x44')]+'%'};return _0x5f2356;})});}_0x34b437=_[_0x0564('0x45')]({},_0x34b437,_0x180432['options']);return _0x1a588f[_0x0564('0x58')](_0x34b437);}})[_0x0564('0x2e')](function(_0x3d2b15){if(_0x3d2b15){_0x32c2a9=_0x3d2b15[_0x0564('0x3e')];if(!_0x180432[_0x0564('0x38')][_0x0564('0x3f')]('nolimit')){_0x34b437['limit']=qs[_0x0564('0x54')](_0x180432[_0x0564('0x38')][_0x0564('0x54')]);_0x34b437[_0x0564('0x2a')]=qs[_0x0564('0x2a')](_0x180432[_0x0564('0x38')][_0x0564('0x2a')]);}return _0x1a588f['getTags'](_0x34b437);}})['then'](function(_0x4b22e9){if(_0x4b22e9){return _0x4b22e9?{'count':_0x32c2a9,'rows':_0x4b22e9}:null;}})['then'](respondWithResult(_0xe4c039,null))[_0x0564('0x26')](handleError(_0xe4c039,null));};exports[_0x0564('0x5a')]=function(_0x5c0def,_0x5c436b,_0x2c316a){if(_0x5c0def[_0x0564('0x4f')]['id']){delete _0x5c0def[_0x0564('0x4f')]['id'];}return db[_0x0564('0x4c')]['findOne']({'where':{'id':_0x5c0def[_0x0564('0x4b')]['id']}})[_0x0564('0x2e')](handleEntityNotFound(_0x5c436b,null))[_0x0564('0x2e')](function(_0x15d436){if(_0x15d436){return _0x15d436[_0x0564('0x5a')](_0x5c0def[_0x0564('0x4f')][_0x0564('0x5b')]||[]);}return null;})[_0x0564('0x2e')](respondWithResult(_0x5c436b,null))[_0x0564('0x26')](handleError(_0x5c436b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index eef7d82..b0c596d 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 _0x1221=['./intDeskConfiguration.attributes','exports','define','int_desk_configurations','util','api','moment','bluebird','path','rimraf'];(function(_0x3e3012,_0x46fe06){var _0x5dfc61=function(_0x4737b8){while(--_0x4737b8){_0x3e3012['push'](_0x3e3012['shift']());}};_0x5dfc61(++_0x46fe06);}(_0x1221,0xf4));var _0x1122=function(_0x1e68c8,_0x263eae){_0x1e68c8=_0x1e68c8-0x0;var _0x54f36f=_0x1221[_0x1e68c8];return _0x54f36f;};'use strict';var _=require('lodash');var util=require(_0x1122('0x0'));var logger=require('../../config/logger')(_0x1122('0x1'));var moment=require(_0x1122('0x2'));var BPromise=require(_0x1122('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1122('0x4'));var rimraf=require(_0x1122('0x5'));var config=require('../../config/environment');var attributes=require(_0x1122('0x6'));module[_0x1122('0x7')]=function(_0x58e21c,_0x46fe2b){return _0x58e21c[_0x1122('0x8')]('DeskConfiguration',attributes,{'tableName':_0x1122('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a75=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x15b2d3,_0x243ad9){var _0x425a1f=function(_0x6530b0){while(--_0x6530b0){_0x15b2d3['push'](_0x15b2d3['shift']());}};_0x425a1f(++_0x243ad9);}(_0x8a75,0xf6));var _0x58a7=function(_0x2bdf81,_0x4033ab){_0x2bdf81=_0x2bdf81-0x0;var _0x49d1c1=_0x8a75[_0x2bdf81];return _0x49d1c1;};'use strict';var _=require(_0x58a7('0x0'));var util=require(_0x58a7('0x1'));var logger=require(_0x58a7('0x2'))(_0x58a7('0x3'));var moment=require(_0x58a7('0x4'));var BPromise=require(_0x58a7('0x5'));var rp=require(_0x58a7('0x6'));var fs=require('fs');var path=require(_0x58a7('0x7'));var rimraf=require(_0x58a7('0x8'));var config=require(_0x58a7('0x9'));var attributes=require(_0x58a7('0xa'));module[_0x58a7('0xb')]=function(_0x1d8460,_0x296cae){return _0x1d8460[_0x58a7('0xc')](_0x58a7('0xd'),attributes,{'tableName':_0x58a7('0xe'),'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 e7e906b..be615fc 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 _0x0328=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message'];(function(_0x5f37fe,_0x27c283){var _0x1c4ca7=function(_0x46f75b){while(--_0x46f75b){_0x5f37fe['push'](_0x5f37fe['shift']());}};_0x1c4ca7(++_0x27c283);}(_0x0328,0x172));var _0x8032=function(_0x489136,_0x4d1aaa){_0x489136=_0x489136-0x0;var _0x155a42=_0x0328[_0x489136];return _0x155a42;};'use strict';var _=require(_0x8032('0x0'));var util=require(_0x8032('0x1'));var moment=require(_0x8032('0x2'));var BPromise=require(_0x8032('0x3'));var rs=require(_0x8032('0x4'));var fs=require('fs');var Redis=require(_0x8032('0x5'));var db=require(_0x8032('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8032('0x7'))(_0x8032('0x8'));var config=require(_0x8032('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8032('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2641,_0x37c3b6,_0x1e7e46){return new BPromise(function(_0x5951b1,_0x389071){return client['request'](_0x4e2641,_0x1e7e46)[_0x8032('0xb')](function(_0x484b9e){logger[_0x8032('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x37c3b6,_0x8032('0xd'));logger[_0x8032('0xe')](_0x8032('0xf'),_0x37c3b6,'request\x20sent',JSON[_0x8032('0x10')](_0x484b9e));if(_0x484b9e['error']){if(_0x484b9e[_0x8032('0x11')][_0x8032('0x12')]===0x1f4){logger[_0x8032('0x11')](_0x8032('0x13'),_0x37c3b6,_0x484b9e[_0x8032('0x11')][_0x8032('0x14')]);return _0x389071(_0x484b9e[_0x8032('0x11')][_0x8032('0x14')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x37c3b6,_0x484b9e[_0x8032('0x11')][_0x8032('0x14')]);return _0x5951b1(_0x484b9e[_0x8032('0x11')]['message']);}else{logger[_0x8032('0xc')](_0x8032('0x13'),_0x37c3b6,_0x8032('0xd'));_0x5951b1(_0x484b9e[_0x8032('0x15')][_0x8032('0x14')]);}})[_0x8032('0x16')](function(_0x1aebc4){logger[_0x8032('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x37c3b6,_0x1aebc4);_0x389071(_0x1aebc4);});});} \ No newline at end of file +var _0x2bc6=['../../config/environment','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','../../config/utils','rpc'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x2bc6,0x163));var _0x62bc=function(_0x4ce0b0,_0x572278){_0x4ce0b0=_0x4ce0b0-0x0;var _0x58115a=_0x2bc6[_0x4ce0b0];return _0x58115a;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var moment=require(_0x62bc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x62bc('0x3'));var logger=require('../../config/logger')(_0x62bc('0x4'));var config=require(_0x62bc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x62bc('0x6')][_0x62bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x40af10,_0x3f3dc9,_0x3ed6ad){return new BPromise(function(_0x3f625c,_0x5bedeb){return client[_0x62bc('0x8')](_0x40af10,_0x3ed6ad)[_0x62bc('0x9')](function(_0x1917e1){logger[_0x62bc('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x3f3dc9,_0x62bc('0xb'));logger[_0x62bc('0xc')](_0x62bc('0xd'),_0x3f3dc9,'request\x20sent',JSON[_0x62bc('0xe')](_0x1917e1));if(_0x1917e1[_0x62bc('0xf')]){if(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x10')]===0x1f4){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')]['message']);return _0x5bedeb(_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);}logger['error'](_0x62bc('0x11'),_0x3f3dc9,_0x1917e1[_0x62bc('0xf')][_0x62bc('0x12')]);return _0x3f625c(_0x1917e1['error'][_0x62bc('0x12')]);}else{logger[_0x62bc('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x3f3dc9,'request\x20sent');_0x3f625c(_0x1917e1[_0x62bc('0x13')][_0x62bc('0x12')]);}})['catch'](function(_0x278893){logger[_0x62bc('0xf')](_0x62bc('0x11'),_0x3f3dc9,_0x278893);_0x5bedeb(_0x278893);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 4c39730..6f6c0d7 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 _0xb325=['show','post','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x209521,_0x4837f9){var _0x40ba45=function(_0x555d85){while(--_0x555d85){_0x209521['push'](_0x209521['shift']());}};_0x40ba45(++_0x4837f9);}(_0xb325,0x123));var _0x5b32=function(_0x5500fe,_0x3141de){_0x5500fe=_0x5500fe-0x0;var _0x564dae=_0xb325[_0x5500fe];return _0x564dae;};'use strict';var multer=require('multer');var util=require(_0x5b32('0x0'));var path=require(_0x5b32('0x1'));var timeout=require(_0x5b32('0x2'));var express=require(_0x5b32('0x3'));var router=express[_0x5b32('0x4')]();var auth=require(_0x5b32('0x5'));var interaction=require(_0x5b32('0x6'));var config=require(_0x5b32('0x7'));var controller=require(_0x5b32('0x8'));router[_0x5b32('0x9')]('/',auth[_0x5b32('0xa')](),controller[_0x5b32('0xb')]);router['get'](_0x5b32('0xc'),auth[_0x5b32('0xa')](),controller[_0x5b32('0xd')]);router[_0x5b32('0xe')]('/',auth[_0x5b32('0xa')](),controller['create']);router[_0x5b32('0xf')](_0x5b32('0xc'),auth[_0x5b32('0xa')](),controller[_0x5b32('0x10')]);router[_0x5b32('0x11')](_0x5b32('0xc'),auth[_0x5b32('0xa')](),controller['destroy']);module[_0x5b32('0x12')]=router; \ No newline at end of file +var _0x57d7=['./intDeskField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','path','Router','../../components/interaction/service'];(function(_0x105075,_0x250a49){var _0x3e88b1=function(_0x254e83){while(--_0x254e83){_0x105075['push'](_0x105075['shift']());}};_0x3e88b1(++_0x250a49);}(_0x57d7,0xac));var _0x757d=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x57d7[_0x55abd9];return _0x3e5669;};'use strict';var multer=require(_0x757d('0x0'));var util=require('util');var path=require(_0x757d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x757d('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x757d('0x3'));var config=require('../../config/environment');var controller=require(_0x757d('0x4'));router[_0x757d('0x5')]('/',auth[_0x757d('0x6')](),controller[_0x757d('0x7')]);router[_0x757d('0x5')]('/:id',auth[_0x757d('0x6')](),controller['show']);router[_0x757d('0x8')]('/',auth[_0x757d('0x6')](),controller[_0x757d('0x9')]);router[_0x757d('0xa')](_0x757d('0xb'),auth[_0x757d('0x6')](),controller[_0x757d('0xc')]);router[_0x757d('0xd')]('/:id',auth[_0x757d('0x6')](),controller[_0x757d('0xe')]);module[_0x757d('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 8bb840c..8dbcb4c 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 _0x387d=['string','variable','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x169d2f,_0x3d0697){var _0x1c7868=function(_0x1a9389){while(--_0x1a9389){_0x169d2f['push'](_0x169d2f['shift']());}};_0x1c7868(++_0x3d0697);}(_0x387d,0x100));var _0xd387=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x387d[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0xd387('0x0'));module['exports']={'type':{'type':Sequelize[_0xd387('0x1')](_0xd387('0x2'),_0xd387('0x3'),'customVariable','keyValue'),'defaultValue':_0xd387('0x2')},'content':{'type':Sequelize[_0xd387('0x4')]},'key':{'type':Sequelize[_0xd387('0x4')]},'keyType':{'type':Sequelize[_0xd387('0x1')]('string',_0xd387('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd387('0x4')]},'idField':{'type':Sequelize[_0xd387('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd387('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd387('0x4')]}}; \ No newline at end of file +var _0xce6c=['BOOLEAN','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x3c0016,_0xcff79){var _0x3ddf38=function(_0x41b3dc){while(--_0x41b3dc){_0x3c0016['push'](_0x3c0016['shift']());}};_0x3ddf38(++_0xcff79);}(_0xce6c,0x143));var _0xcce6=function(_0x330bc2,_0x563776){_0x330bc2=_0x330bc2-0x0;var _0x4a9049=_0xce6c[_0x330bc2];return _0x4a9049;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xcce6('0x0')](_0xcce6('0x1'),'variable',_0xcce6('0x2'),_0xcce6('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xcce6('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xcce6('0x5'),_0xcce6('0x2'))},'keyContent':{'type':Sequelize[_0xcce6('0x4')]},'idField':{'type':Sequelize[_0xcce6('0x4')]},'nameField':{'type':Sequelize[_0xcce6('0x4')]},'customField':{'type':Sequelize[_0xcce6('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index c0af5a9..32d1541 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 _0x195b=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','save','then','destroy','error','stack','name','send','map','DeskField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','catch','show','params','length','includeAll','include','options','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x37bfec,_0x28e8c8){var _0x214043=function(_0x3bca65){while(--_0x3bca65){_0x37bfec['push'](_0x37bfec['shift']());}};_0x214043(++_0x28e8c8);}(_0x195b,0xbf));var _0xb195=function(_0x5d431e,_0x1f8730){_0x5d431e=_0x5d431e-0x0;var _0x18fa88=_0x195b[_0x5d431e];return _0x18fa88;};'use strict';var pdf=require(_0xb195('0x0'));var emlformat=require(_0xb195('0x1'));var rimraf=require(_0xb195('0x2'));var zipdir=require(_0xb195('0x3'));var jsonpatch=require(_0xb195('0x4'));var rp=require(_0xb195('0x5'));var moment=require(_0xb195('0x6'));var BPromise=require(_0xb195('0x7'));var Mustache=require(_0xb195('0x8'));var util=require('util');var path=require('path');var sox=require(_0xb195('0x9'));var csv=require(_0xb195('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb195('0xb'));var crypto=require(_0xb195('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb195('0xd'));var toCsv=require(_0xb195('0xa'));var querystring=require(_0xb195('0xe'));var Papa=require('papaparse');var Redis=require(_0xb195('0xf'));var authService=require(_0xb195('0x10'));var qs=require(_0xb195('0x11'));var as=require(_0xb195('0x12'));var hardwareService=require(_0xb195('0x13'));var logger=require('../../config/logger')(_0xb195('0x14'));var utils=require(_0xb195('0x15'));var config=require(_0xb195('0x16'));var db=require(_0xb195('0x17'))['db'];function respondWithStatusCode(_0x179805,_0x2f856c){_0x2f856c=_0x2f856c||0xcc;return function(_0x2235a5){if(_0x2235a5){return _0x179805[_0xb195('0x18')](_0x2f856c);}return _0x179805['status'](_0x2f856c)[_0xb195('0x19')]();};}function respondWithResult(_0x39b438,_0x28eccd){_0x28eccd=_0x28eccd||0xc8;return function(_0x2e16c2){if(_0x2e16c2){return _0x39b438[_0xb195('0x1a')](_0x28eccd)[_0xb195('0x1b')](_0x2e16c2);}};}function respondWithFilteredResult(_0x14f62e,_0x11db72){return function(_0x290a14){if(_0x290a14){var _0x54a412=_0x290a14[_0xb195('0x1c')],_0x55a3a2=_0x11db72['offset'],_0x47d4b2=_0x11db72[_0xb195('0x1d')]+_0x11db72[_0xb195('0x1e')],_0x2bdf2f;if(_0x47d4b2>=_0x54a412){_0x47d4b2=_0x54a412;_0x2bdf2f=0xc8;}else{_0x2bdf2f=0xce;}_0x14f62e[_0xb195('0x1a')](_0x2bdf2f);return _0x14f62e['set']('Content-Range',_0x55a3a2+'-'+_0x47d4b2+'/'+_0x54a412)[_0xb195('0x1b')](_0x290a14);}return null;};}function patchUpdates(_0x42ad4a){return function(_0x3f0fe7){try{jsonpatch[_0xb195('0x1f')](_0x3f0fe7,_0x42ad4a,!![]);}catch(_0x542cea){return BPromise[_0xb195('0x20')](_0x542cea);}return _0x3f0fe7[_0xb195('0x21')]();};}function saveUpdates(_0x5803bd,_0x1838ba){return function(_0x2dca44){if(_0x2dca44){return _0x2dca44['update'](_0x5803bd)[_0xb195('0x22')](function(_0x3af12d){return _0x3af12d;});}return null;};}function removeEntity(_0x36900b,_0x5e6bea){return function(_0x1e0718){if(_0x1e0718){return _0x1e0718[_0xb195('0x23')]()[_0xb195('0x22')](function(){_0x36900b[_0xb195('0x1a')](0xcc)[_0xb195('0x19')]();});}};}function handleEntityNotFound(_0xae73d5,_0x218fb2){return function(_0xf400d2){if(!_0xf400d2){_0xae73d5[_0xb195('0x18')](0x194);}return _0xf400d2;};}function handleError(_0x4bf9bb,_0x4d5e19){_0x4d5e19=_0x4d5e19||0x1f4;return function(_0x46dfc9){logger[_0xb195('0x24')](_0x46dfc9[_0xb195('0x25')]);if(_0x46dfc9[_0xb195('0x26')]){delete _0x46dfc9[_0xb195('0x26')];}_0x4bf9bb['status'](_0x4d5e19)[_0xb195('0x27')](_0x46dfc9);};}exports['index']=function(_0x3f5aed,_0x142753){var _0x297207={},_0x264a9a={},_0x37a80a={'count':0x0,'rows':[]};var _0x52bf69=_[_0xb195('0x28')](db[_0xb195('0x29')][_0xb195('0x2a')],function(_0x1151e1){return{'name':_0x1151e1['fieldName'],'type':_0x1151e1[_0xb195('0x2b')][_0xb195('0x2c')]};});_0x264a9a[_0xb195('0x2d')]=_[_0xb195('0x28')](_0x52bf69,'name');_0x264a9a['query']=_[_0xb195('0x2e')](_0x3f5aed[_0xb195('0x2f')]);_0x264a9a[_0xb195('0x30')]=_[_0xb195('0x31')](_0x264a9a['model'],_0x264a9a[_0xb195('0x2f')]);_0x297207[_0xb195('0x32')]=_['intersection'](_0x264a9a[_0xb195('0x2d')],qs[_0xb195('0x33')](_0x3f5aed[_0xb195('0x2f')][_0xb195('0x33')]));_0x297207[_0xb195('0x32')]=_0x297207[_0xb195('0x32')]['length']?_0x297207[_0xb195('0x32')]:_0x264a9a[_0xb195('0x2d')];if(!_0x3f5aed[_0xb195('0x2f')]['hasOwnProperty'](_0xb195('0x34'))){_0x297207['limit']=qs[_0xb195('0x1e')](_0x3f5aed[_0xb195('0x2f')]['limit']);_0x297207['offset']=qs[_0xb195('0x1d')](_0x3f5aed[_0xb195('0x2f')][_0xb195('0x1d')]);}_0x297207[_0xb195('0x35')]=qs[_0xb195('0x36')](_0x3f5aed['query'][_0xb195('0x36')]);_0x297207[_0xb195('0x37')]=qs['filters'](_['pick'](_0x3f5aed[_0xb195('0x2f')],_0x264a9a[_0xb195('0x30')]),_0x52bf69);if(_0x3f5aed[_0xb195('0x2f')][_0xb195('0x38')]){_0x297207[_0xb195('0x37')]=_[_0xb195('0x39')](_0x297207['where'],{'$or':_[_0xb195('0x28')](_0x52bf69,function(_0x4705c1){if(_0x4705c1[_0xb195('0x2b')]!==_0xb195('0x3a')){var _0x48f5f0={};_0x48f5f0[_0x4705c1[_0xb195('0x26')]]={'$like':'%'+_0x3f5aed[_0xb195('0x2f')]['filter']+'%'};return _0x48f5f0;}})});}_0x297207=_[_0xb195('0x39')]({},_0x297207,_0x3f5aed['options']);var _0x8c482e={'where':_0x297207[_0xb195('0x37')]};return db['DeskField'][_0xb195('0x1c')](_0x8c482e)[_0xb195('0x22')](function(_0x1beab6){_0x37a80a[_0xb195('0x1c')]=_0x1beab6;if(_0x3f5aed[_0xb195('0x2f')]['includeAll']){_0x297207['include']=[{'all':!![]}];}return db['DeskField']['findAll'](_0x297207);})[_0xb195('0x22')](function(_0x390cb0){_0x37a80a['rows']=_0x390cb0;return _0x37a80a;})[_0xb195('0x22')](respondWithFilteredResult(_0x142753,_0x297207))[_0xb195('0x3b')](handleError(_0x142753,null));};exports[_0xb195('0x3c')]=function(_0x1a2ea1,_0x464c27){var _0x1a2888={'raw':!![],'where':{'id':_0x1a2ea1[_0xb195('0x3d')]['id']}},_0x2cfbfd={};_0x2cfbfd[_0xb195('0x2d')]=_['keys'](db[_0xb195('0x29')][_0xb195('0x2a')]);_0x2cfbfd['query']=_[_0xb195('0x2e')](_0x1a2ea1[_0xb195('0x2f')]);_0x2cfbfd['filters']=_[_0xb195('0x31')](_0x2cfbfd[_0xb195('0x2d')],_0x2cfbfd[_0xb195('0x2f')]);_0x1a2888['attributes']=_[_0xb195('0x31')](_0x2cfbfd['model'],qs['fields'](_0x1a2ea1[_0xb195('0x2f')][_0xb195('0x33')]));_0x1a2888['attributes']=_0x1a2888[_0xb195('0x32')][_0xb195('0x3e')]?_0x1a2888[_0xb195('0x32')]:_0x2cfbfd[_0xb195('0x2d')];if(_0x1a2ea1[_0xb195('0x2f')][_0xb195('0x3f')]){_0x1a2888[_0xb195('0x40')]=[{'all':!![]}];}_0x1a2888=_[_0xb195('0x39')]({},_0x1a2888,_0x1a2ea1[_0xb195('0x41')]);return db['DeskField'][_0xb195('0x42')](_0x1a2888)[_0xb195('0x22')](handleEntityNotFound(_0x464c27,null))[_0xb195('0x22')](respondWithResult(_0x464c27,null))[_0xb195('0x3b')](handleError(_0x464c27,null));};exports[_0xb195('0x43')]=function(_0x3a6b63,_0x9ed4d9){return db[_0xb195('0x29')][_0xb195('0x43')](_0x3a6b63['body'],{})['then'](respondWithResult(_0x9ed4d9,0xc9))[_0xb195('0x3b')](handleError(_0x9ed4d9,null));};exports[_0xb195('0x44')]=function(_0x53cc3e,_0x49327b){if(_0x53cc3e[_0xb195('0x45')]['id']){delete _0x53cc3e[_0xb195('0x45')]['id'];}return db[_0xb195('0x29')][_0xb195('0x42')]({'where':{'id':_0x53cc3e[_0xb195('0x3d')]['id']}})[_0xb195('0x22')](handleEntityNotFound(_0x49327b,null))[_0xb195('0x22')](saveUpdates(_0x53cc3e[_0xb195('0x45')],null))['then'](respondWithResult(_0x49327b,null))[_0xb195('0x3b')](handleError(_0x49327b,null));};exports[_0xb195('0x23')]=function(_0x31c36a,_0x170b92){return db[_0xb195('0x29')]['find']({'where':{'id':_0x31c36a[_0xb195('0x3d')]['id']}})['then'](handleEntityNotFound(_0x170b92,null))[_0xb195('0x22')](removeEntity(_0x170b92,null))['catch'](handleError(_0x170b92,null));}; \ No newline at end of file +var _0x48b0=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','update','then','destroy','error','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x48b0,0x115));var _0x048b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x48b0[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0x048b('0x0'));var emlformat=require(_0x048b('0x1'));var rimraf=require(_0x048b('0x2'));var zipdir=require(_0x048b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x048b('0x4'));var moment=require(_0x048b('0x5'));var BPromise=require(_0x048b('0x6'));var Mustache=require('mustache');var util=require(_0x048b('0x7'));var path=require(_0x048b('0x8'));var sox=require(_0x048b('0x9'));var csv=require(_0x048b('0xa'));var ejs=require(_0x048b('0xb'));var fs=require('fs');var _=require(_0x048b('0xc'));var squel=require('squel');var crypto=require(_0x048b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x048b('0xe'));var Papa=require(_0x048b('0xf'));var Redis=require(_0x048b('0x10'));var authService=require(_0x048b('0x11'));var qs=require(_0x048b('0x12'));var as=require(_0x048b('0x13'));var hardwareService=require(_0x048b('0x14'));var logger=require(_0x048b('0x15'))(_0x048b('0x16'));var utils=require(_0x048b('0x17'));var config=require('../../config/environment');var db=require(_0x048b('0x18'))['db'];function respondWithStatusCode(_0x1cb038,_0x4dde78){_0x4dde78=_0x4dde78||0xcc;return function(_0x3b22f9){if(_0x3b22f9){return _0x1cb038[_0x048b('0x19')](_0x4dde78);}return _0x1cb038[_0x048b('0x1a')](_0x4dde78)[_0x048b('0x1b')]();};}function respondWithResult(_0x5a55aa,_0x3ce94c){_0x3ce94c=_0x3ce94c||0xc8;return function(_0x4f8fa2){if(_0x4f8fa2){return _0x5a55aa['status'](_0x3ce94c)[_0x048b('0x1c')](_0x4f8fa2);}};}function respondWithFilteredResult(_0x4a88d6,_0x326432){return function(_0x3d7e66){if(_0x3d7e66){var _0x3f46a6=_0x3d7e66[_0x048b('0x1d')],_0x513b2d=_0x326432['offset'],_0x2f4088=_0x326432['offset']+_0x326432[_0x048b('0x1e')],_0x44ef1e;if(_0x2f4088>=_0x3f46a6){_0x2f4088=_0x3f46a6;_0x44ef1e=0xc8;}else{_0x44ef1e=0xce;}_0x4a88d6[_0x048b('0x1a')](_0x44ef1e);return _0x4a88d6[_0x048b('0x1f')](_0x048b('0x20'),_0x513b2d+'-'+_0x2f4088+'/'+_0x3f46a6)[_0x048b('0x1c')](_0x3d7e66);}return null;};}function patchUpdates(_0x210938){return function(_0x4d3bd7){try{jsonpatch[_0x048b('0x21')](_0x4d3bd7,_0x210938,!![]);}catch(_0x585068){return BPromise['reject'](_0x585068);}return _0x4d3bd7['save']();};}function saveUpdates(_0x1456de,_0x413031){return function(_0x5c3398){if(_0x5c3398){return _0x5c3398[_0x048b('0x22')](_0x1456de)[_0x048b('0x23')](function(_0x486f40){return _0x486f40;});}return null;};}function removeEntity(_0x12f7e5,_0xe1e3ed){return function(_0xe151f6){if(_0xe151f6){return _0xe151f6[_0x048b('0x24')]()['then'](function(){_0x12f7e5['status'](0xcc)[_0x048b('0x1b')]();});}};}function handleEntityNotFound(_0x8b5d6f,_0x3d9171){return function(_0x5c68d0){if(!_0x5c68d0){_0x8b5d6f[_0x048b('0x19')](0x194);}return _0x5c68d0;};}function handleError(_0x5c84d2,_0xb3a8fe){_0xb3a8fe=_0xb3a8fe||0x1f4;return function(_0x48ea1b){logger[_0x048b('0x25')](_0x48ea1b['stack']);if(_0x48ea1b[_0x048b('0x26')]){delete _0x48ea1b[_0x048b('0x26')];}_0x5c84d2['status'](_0xb3a8fe)[_0x048b('0x27')](_0x48ea1b);};}exports['index']=function(_0x576845,_0x448497){var _0x2139a3={},_0x2d3fed={},_0x4dfaae={'count':0x0,'rows':[]};var _0x216a15=_[_0x048b('0x28')](db[_0x048b('0x29')][_0x048b('0x2a')],function(_0x2de066){return{'name':_0x2de066[_0x048b('0x2b')],'type':_0x2de066[_0x048b('0x2c')][_0x048b('0x2d')]};});_0x2d3fed[_0x048b('0x2e')]=_[_0x048b('0x28')](_0x216a15,_0x048b('0x26'));_0x2d3fed['query']=_[_0x048b('0x2f')](_0x576845[_0x048b('0x30')]);_0x2d3fed[_0x048b('0x31')]=_['intersection'](_0x2d3fed[_0x048b('0x2e')],_0x2d3fed[_0x048b('0x30')]);_0x2139a3[_0x048b('0x32')]=_[_0x048b('0x33')](_0x2d3fed['model'],qs[_0x048b('0x34')](_0x576845[_0x048b('0x30')]['fields']));_0x2139a3['attributes']=_0x2139a3[_0x048b('0x32')][_0x048b('0x35')]?_0x2139a3[_0x048b('0x32')]:_0x2d3fed['model'];if(!_0x576845['query'][_0x048b('0x36')](_0x048b('0x37'))){_0x2139a3[_0x048b('0x1e')]=qs[_0x048b('0x1e')](_0x576845['query']['limit']);_0x2139a3['offset']=qs[_0x048b('0x38')](_0x576845[_0x048b('0x30')]['offset']);}_0x2139a3[_0x048b('0x39')]=qs[_0x048b('0x3a')](_0x576845[_0x048b('0x30')]['sort']);_0x2139a3[_0x048b('0x3b')]=qs['filters'](_[_0x048b('0x3c')](_0x576845[_0x048b('0x30')],_0x2d3fed[_0x048b('0x31')]),_0x216a15);if(_0x576845[_0x048b('0x30')][_0x048b('0x3d')]){_0x2139a3[_0x048b('0x3b')]=_[_0x048b('0x3e')](_0x2139a3[_0x048b('0x3b')],{'$or':_[_0x048b('0x28')](_0x216a15,function(_0x1c93c){if(_0x1c93c['type']!==_0x048b('0x3f')){var _0x26fcab={};_0x26fcab[_0x1c93c[_0x048b('0x26')]]={'$like':'%'+_0x576845[_0x048b('0x30')][_0x048b('0x3d')]+'%'};return _0x26fcab;}})});}_0x2139a3=_[_0x048b('0x3e')]({},_0x2139a3,_0x576845[_0x048b('0x40')]);var _0x5ed33d={'where':_0x2139a3[_0x048b('0x3b')]};return db[_0x048b('0x29')]['count'](_0x5ed33d)[_0x048b('0x23')](function(_0x3caa0b){_0x4dfaae[_0x048b('0x1d')]=_0x3caa0b;if(_0x576845[_0x048b('0x30')]['includeAll']){_0x2139a3['include']=[{'all':!![]}];}return db[_0x048b('0x29')][_0x048b('0x41')](_0x2139a3);})[_0x048b('0x23')](function(_0xba384e){_0x4dfaae[_0x048b('0x42')]=_0xba384e;return _0x4dfaae;})[_0x048b('0x23')](respondWithFilteredResult(_0x448497,_0x2139a3))[_0x048b('0x43')](handleError(_0x448497,null));};exports[_0x048b('0x44')]=function(_0x4eb217,_0x1d2d7b){var _0x39b756={'raw':!![],'where':{'id':_0x4eb217[_0x048b('0x45')]['id']}},_0x2b8dbe={};_0x2b8dbe['model']=_[_0x048b('0x2f')](db[_0x048b('0x29')][_0x048b('0x2a')]);_0x2b8dbe[_0x048b('0x30')]=_[_0x048b('0x2f')](_0x4eb217[_0x048b('0x30')]);_0x2b8dbe[_0x048b('0x31')]=_['intersection'](_0x2b8dbe['model'],_0x2b8dbe[_0x048b('0x30')]);_0x39b756[_0x048b('0x32')]=_[_0x048b('0x33')](_0x2b8dbe['model'],qs[_0x048b('0x34')](_0x4eb217['query'][_0x048b('0x34')]));_0x39b756['attributes']=_0x39b756['attributes'][_0x048b('0x35')]?_0x39b756[_0x048b('0x32')]:_0x2b8dbe[_0x048b('0x2e')];if(_0x4eb217[_0x048b('0x30')][_0x048b('0x46')]){_0x39b756['include']=[{'all':!![]}];}_0x39b756=_['merge']({},_0x39b756,_0x4eb217['options']);return db['DeskField'][_0x048b('0x47')](_0x39b756)['then'](handleEntityNotFound(_0x1d2d7b,null))[_0x048b('0x23')](respondWithResult(_0x1d2d7b,null))['catch'](handleError(_0x1d2d7b,null));};exports[_0x048b('0x48')]=function(_0x3c5e72,_0x28e94d){return db['DeskField'][_0x048b('0x48')](_0x3c5e72[_0x048b('0x49')],{})[_0x048b('0x23')](respondWithResult(_0x28e94d,0xc9))[_0x048b('0x43')](handleError(_0x28e94d,null));};exports['update']=function(_0x5b6f3d,_0x556850){if(_0x5b6f3d['body']['id']){delete _0x5b6f3d[_0x048b('0x49')]['id'];}return db['DeskField'][_0x048b('0x47')]({'where':{'id':_0x5b6f3d[_0x048b('0x45')]['id']}})[_0x048b('0x23')](handleEntityNotFound(_0x556850,null))[_0x048b('0x23')](saveUpdates(_0x5b6f3d[_0x048b('0x49')],null))[_0x048b('0x23')](respondWithResult(_0x556850,null))['catch'](handleError(_0x556850,null));};exports[_0x048b('0x24')]=function(_0x30549b,_0x2e9791){return db['DeskField'][_0x048b('0x47')]({'where':{'id':_0x30549b[_0x048b('0x45')]['id']}})[_0x048b('0x23')](handleEntityNotFound(_0x2e9791,null))[_0x048b('0x23')](removeEntity(_0x2e9791,null))[_0x048b('0x43')](handleError(_0x2e9791,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 7fcf6f7..66e9603 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 _0x9ecb=['lodash','util','moment','rimraf','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0x23416b,_0xd2dbf9){var _0x518984=function(_0x47457a){while(--_0x47457a){_0x23416b['push'](_0x23416b['shift']());}};_0x518984(++_0xd2dbf9);}(_0x9ecb,0x113));var _0xb9ec=function(_0x23e051,_0x2b404f){_0x23e051=_0x23e051-0x0;var _0x44bd79=_0x9ecb[_0x23e051];return _0x44bd79;};'use strict';var _=require(_0xb9ec('0x0'));var util=require(_0xb9ec('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb9ec('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb9ec('0x3'));var config=require('../../config/environment');var attributes=require(_0xb9ec('0x4'));module['exports']=function(_0x556602,_0x4031ac){return _0x556602[_0xb9ec('0x5')](_0xb9ec('0x6'),attributes,{'tableName':_0xb9ec('0x7'),'paranoid':![],'indexes':[{'name':_0xb9ec('0x8'),'fields':[_0xb9ec('0x9'),_0xb9ec('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd080=['define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports'];(function(_0x564b0e,_0x5b328b){var _0x3c4576=function(_0x3dbf48){while(--_0x3dbf48){_0x564b0e['push'](_0x564b0e['shift']());}};_0x3c4576(++_0x5b328b);}(_0xd080,0xc9));var _0x0d08=function(_0x3d6d31,_0x59c570){_0x3d6d31=_0x3d6d31-0x0;var _0x585b4f=_0xd080[_0x3d6d31];return _0x585b4f;};'use strict';var _=require('lodash');var util=require(_0x0d08('0x0'));var logger=require('../../config/logger')(_0x0d08('0x1'));var moment=require(_0x0d08('0x2'));var BPromise=require(_0x0d08('0x3'));var rp=require(_0x0d08('0x4'));var fs=require('fs');var path=require(_0x0d08('0x5'));var rimraf=require(_0x0d08('0x6'));var config=require('../../config/environment');var attributes=require(_0x0d08('0x7'));module[_0x0d08('0x8')]=function(_0x4c1a9d,_0x240e87){return _0x4c1a9d[_0x0d08('0x9')](_0x0d08('0xa'),attributes,{'tableName':_0x0d08('0xb'),'paranoid':![],'indexes':[{'name':_0x0d08('0xc'),'fields':[_0x0d08('0xd'),_0x0d08('0xe')],'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 016afb1..e133846 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 _0x6e42=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e42,0x187));var _0x26e4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e42[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x26e4('0x0'));var moment=require(_0x26e4('0x1'));var BPromise=require(_0x26e4('0x2'));var rs=require(_0x26e4('0x3'));var fs=require('fs');var Redis=require(_0x26e4('0x4'));var db=require(_0x26e4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x26e4('0x6'));var config=require(_0x26e4('0x7'));var jayson=require(_0x26e4('0x8'));var client=jayson[_0x26e4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c19c4,_0x5e7fb0,_0x189e2a){return new BPromise(function(_0x5f5da9,_0x4056c4){return client[_0x26e4('0xa')](_0x5c19c4,_0x189e2a)[_0x26e4('0xb')](function(_0x3fa2e5){logger['info'](_0x26e4('0xc'),_0x5e7fb0,_0x26e4('0xd'));logger[_0x26e4('0xe')](_0x26e4('0xf'),_0x5e7fb0,_0x26e4('0xd'),JSON[_0x26e4('0x10')](_0x3fa2e5));if(_0x3fa2e5[_0x26e4('0x11')]){if(_0x3fa2e5['error'][_0x26e4('0x12')]===0x1f4){logger[_0x26e4('0x11')](_0x26e4('0xc'),_0x5e7fb0,_0x3fa2e5[_0x26e4('0x11')][_0x26e4('0x13')]);return _0x4056c4(_0x3fa2e5[_0x26e4('0x11')][_0x26e4('0x13')]);}logger['error'](_0x26e4('0xc'),_0x5e7fb0,_0x3fa2e5[_0x26e4('0x11')][_0x26e4('0x13')]);return _0x5f5da9(_0x3fa2e5[_0x26e4('0x11')][_0x26e4('0x13')]);}else{logger[_0x26e4('0x14')](_0x26e4('0xc'),_0x5e7fb0,_0x26e4('0xd'));_0x5f5da9(_0x3fa2e5[_0x26e4('0x15')][_0x26e4('0x13')]);}})[_0x26e4('0x16')](function(_0x55896a){logger[_0x26e4('0x11')]('DeskField,\x20%s,\x20%s',_0x5e7fb0,_0x55896a);_0x4056c4(_0x55896a);});});} \ No newline at end of file +var _0xabdd=['rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xc3300f,_0x1b957d){var _0x5007df=function(_0x5f583c){while(--_0x5f583c){_0xc3300f['push'](_0xc3300f['shift']());}};_0x5007df(++_0x1b957d);}(_0xabdd,0x1b1));var _0xdabd=function(_0x3890ea,_0x108efb){_0x3890ea=_0x3890ea-0x0;var _0x28f70f=_0xabdd[_0x3890ea];return _0x28f70f;};'use strict';var _=require(_0xdabd('0x0'));var util=require(_0xdabd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdabd('0x2'));var fs=require('fs');var Redis=require(_0xdabd('0x3'));var db=require(_0xdabd('0x4'))['db'];var utils=require(_0xdabd('0x5'));var logger=require(_0xdabd('0x6'))(_0xdabd('0x7'));var config=require(_0xdabd('0x8'));var jayson=require(_0xdabd('0x9'));var client=jayson['client'][_0xdabd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fcb50,_0x13edf5,_0x47a26){return new BPromise(function(_0x8c091,_0x6307b0){return client[_0xdabd('0xb')](_0x1fcb50,_0x47a26)[_0xdabd('0xc')](function(_0x2102a5){logger[_0xdabd('0xd')](_0xdabd('0xe'),_0x13edf5,_0xdabd('0xf'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x13edf5,_0xdabd('0xf'),JSON[_0xdabd('0x10')](_0x2102a5));if(_0x2102a5['error']){if(_0x2102a5[_0xdabd('0x11')][_0xdabd('0x12')]===0x1f4){logger[_0xdabd('0x11')](_0xdabd('0xe'),_0x13edf5,_0x2102a5[_0xdabd('0x11')][_0xdabd('0x13')]);return _0x6307b0(_0x2102a5[_0xdabd('0x11')][_0xdabd('0x13')]);}logger['error'](_0xdabd('0xe'),_0x13edf5,_0x2102a5['error']['message']);return _0x8c091(_0x2102a5[_0xdabd('0x11')][_0xdabd('0x13')]);}else{logger[_0xdabd('0xd')](_0xdabd('0xe'),_0x13edf5,_0xdabd('0xf'));_0x8c091(_0x2102a5[_0xdabd('0x14')][_0xdabd('0x13')]);}})[_0xdabd('0x15')](function(_0x24064f){logger['error'](_0xdabd('0xe'),_0x13edf5,_0x24064f);_0x6307b0(_0x24064f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 8857dce..9fd20d1 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 _0x59ca=['addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x59ca,0xc6));var _0xa59c=function(_0x43da46,_0x4373c3){_0x43da46=_0x43da46-0x0;var _0xd7aeb7=_0x59ca[_0x43da46];return _0xd7aeb7;};'use strict';var multer=require(_0xa59c('0x0'));var util=require(_0xa59c('0x1'));var path=require(_0xa59c('0x2'));var timeout=require(_0xa59c('0x3'));var express=require('express');var router=express[_0xa59c('0x4')]();var auth=require(_0xa59c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa59c('0x6'));var controller=require(_0xa59c('0x7'));router['get']('/',auth[_0xa59c('0x8')](),controller[_0xa59c('0x9')]);router['get'](_0xa59c('0xa'),auth['isAuthenticated'](),controller[_0xa59c('0xb')]);router[_0xa59c('0xc')](_0xa59c('0xd'),auth[_0xa59c('0x8')](),controller[_0xa59c('0xe')]);router[_0xa59c('0xc')](_0xa59c('0xf'),auth[_0xa59c('0x8')](),controller[_0xa59c('0x10')]);router['post']('/',auth[_0xa59c('0x8')](),controller[_0xa59c('0x11')]);router['post'](_0xa59c('0xd'),auth['isAuthenticated'](),controller[_0xa59c('0x12')]);router[_0xa59c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xa59c('0x14')]);router[_0xa59c('0x15')](_0xa59c('0xa'),auth[_0xa59c('0x8')](),controller[_0xa59c('0x16')]);module[_0xa59c('0x17')]=router; \ No newline at end of file +var _0x6fe9=['/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x512661,_0x4b4012){var _0x1debde=function(_0x1ed401){while(--_0x1ed401){_0x512661['push'](_0x512661['shift']());}};_0x1debde(++_0x4b4012);}(_0x6fe9,0xb1));var _0x96fe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fe9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x96fe('0x0'));var path=require(_0x96fe('0x1'));var timeout=require(_0x96fe('0x2'));var express=require(_0x96fe('0x3'));var router=express[_0x96fe('0x4')]();var auth=require(_0x96fe('0x5'));var interaction=require(_0x96fe('0x6'));var config=require('../../config/environment');var controller=require(_0x96fe('0x7'));router[_0x96fe('0x8')]('/',auth[_0x96fe('0x9')](),controller[_0x96fe('0xa')]);router[_0x96fe('0x8')](_0x96fe('0xb'),auth['isAuthenticated'](),controller[_0x96fe('0xc')]);router[_0x96fe('0x8')](_0x96fe('0xd'),auth[_0x96fe('0x9')](),controller[_0x96fe('0xe')]);router['get'](_0x96fe('0xf'),auth[_0x96fe('0x9')](),controller[_0x96fe('0x10')]);router[_0x96fe('0x11')]('/',auth['isAuthenticated'](),controller[_0x96fe('0x12')]);router['post'](_0x96fe('0xd'),auth['isAuthenticated'](),controller[_0x96fe('0x13')]);router[_0x96fe('0x14')](_0x96fe('0xb'),auth[_0x96fe('0x9')](),controller['update']);router[_0x96fe('0x15')](_0x96fe('0xb'),auth[_0x96fe('0x9')](),controller[_0x96fe('0x16')]);module[_0x96fe('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index efa0e0d..b2e97ba 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 _0xb2ac=['exports','STRING','sequelize'];(function(_0x138195,_0x435f33){var _0x3eb89f=function(_0xfa356c){while(--_0xfa356c){_0x138195['push'](_0x138195['shift']());}};_0x3eb89f(++_0x435f33);}(_0xb2ac,0x1c4));var _0xcb2a=function(_0x3004de,_0x45941a){_0x3004de=_0x3004de-0x0;var _0x3c13d3=_0xb2ac[_0x3004de];return _0x3c13d3;};'use strict';var Sequelize=require(_0xcb2a('0x0'));module[_0xcb2a('0x1')]={'name':{'type':Sequelize[_0xcb2a('0x2')]},'username':{'type':Sequelize[_0xcb2a('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xcb2a('0x2')]},'tenantId':{'type':Sequelize[_0xcb2a('0x2')]},'clientId':{'type':Sequelize[_0xcb2a('0x2')]},'clientSecret':{'type':Sequelize[_0xcb2a('0x2')]},'serverUrl':{'type':Sequelize[_0xcb2a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe1c1=['sequelize','exports','STRING'];(function(_0x43e771,_0x1f525c){var _0x2edd61=function(_0x79893c){while(--_0x79893c){_0x43e771['push'](_0x43e771['shift']());}};_0x2edd61(++_0x1f525c);}(_0xe1c1,0x126));var _0x1e1c=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0xe1c1[_0x5c3ae9];return _0x3f5950;};'use strict';var Sequelize=require(_0x1e1c('0x0'));module[_0x1e1c('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1e1c('0x2')]},'password':{'type':Sequelize[_0x1e1c('0x2')]},'remoteUri':{'type':Sequelize[_0x1e1c('0x2')]},'tenantId':{'type':Sequelize[_0x1e1c('0x2')]},'clientId':{'type':Sequelize[_0x1e1c('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1e1c('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 2f96448..470f512 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 _0xbc6b=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','findAll','rows','show','create','body','find','params','getConfigurations','findOne','AccountId','channel','Descriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','Incident','PhoneCall','title','description','customerid','caseorigincode','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','password','remoteUri','tenantId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','clientId','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','MetadataId','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','save','update','destroy','sendStatus','stack','name','send','index','map','Dynamics365Account','rawAttributes','key','model','query','keys','filters','intersection'];(function(_0x2f0583,_0x1c9be2){var _0x41628e=function(_0x71816){while(--_0x71816){_0x2f0583['push'](_0x2f0583['shift']());}};_0x41628e(++_0x1c9be2);}(_0xbc6b,0x97));var _0xbbc6=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xbc6b[_0x49ca18];return _0x145d54;};'use strict';var pdf=require(_0xbbc6('0x0'));var emlformat=require(_0xbbc6('0x1'));var rimraf=require(_0xbbc6('0x2'));var zipdir=require(_0xbbc6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbbc6('0x4'));var moment=require('moment');var BPromise=require(_0xbbc6('0x5'));var Mustache=require(_0xbbc6('0x6'));var util=require(_0xbbc6('0x7'));var path=require(_0xbbc6('0x8'));var sox=require(_0xbbc6('0x9'));var csv=require('to-csv');var ejs=require(_0xbbc6('0xa'));var fs=require('fs');var _=require(_0xbbc6('0xb'));var squel=require(_0xbbc6('0xc'));var crypto=require(_0xbbc6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbbc6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbbc6('0xf'));var Papa=require(_0xbbc6('0x10'));var Redis=require(_0xbbc6('0x11'));var authService=require(_0xbbc6('0x12'));var qs=require(_0xbbc6('0x13'));var as=require(_0xbbc6('0x14'));var hardwareService=require(_0xbbc6('0x15'));var logger=require('../../config/logger')(_0xbbc6('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xbbc6('0x17'))['db'];var integrations=require(_0xbbc6('0x18'));var jayson=require(_0xbbc6('0x19'));var client=jayson[_0xbbc6('0x1a')][_0xbbc6('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5093bb,_0x5c6a60,_0x429ea6){if(_0x429ea6){var _0x55bdd6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55bdd6[_0xbbc6('0x1c')](_0x5c6a60)){return _0x5093bb;}else{throw new db[(_0xbbc6('0x1d'))][(_0xbbc6('0x1e'))](_0xbbc6('0x1f'));}}else{return _0x5093bb;}}function respondWithRpcPromise(_0x1b715f,_0x116fac,_0xd4daa8,_0x3fe2bc){return new BPromise(function(_0x12bbc4,_0x327648){var _0x32ebf4=_0x3fe2bc||client;return _0x32ebf4['request'](_0x1b715f,_0xd4daa8)[_0xbbc6('0x20')](function(_0x28867c){logger['info'](_0xbbc6('0x21'),_0x116fac,_0xbbc6('0x22'));logger[_0xbbc6('0x23')](_0xbbc6('0x24'),_0x116fac,_0xbbc6('0x22'),JSON[_0xbbc6('0x25')](_0x28867c));if(_0x28867c[_0xbbc6('0x26')]){if(_0x28867c[_0xbbc6('0x26')][_0xbbc6('0x27')]===0x1f4){logger['error'](_0xbbc6('0x21'),_0x116fac,_0x28867c[_0xbbc6('0x26')][_0xbbc6('0x28')]);return _0x327648(_0x28867c[_0xbbc6('0x26')][_0xbbc6('0x28')]);}logger['error'](_0xbbc6('0x21'),_0x116fac,_0x28867c['error']['message']);return _0x12bbc4(_0x28867c['error'][_0xbbc6('0x28')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x116fac,_0xbbc6('0x22'));_0x12bbc4(_0x28867c[_0xbbc6('0x29')][_0xbbc6('0x28')]);}})[_0xbbc6('0x2a')](function(_0x46fa5c){logger[_0xbbc6('0x26')]('Dynamics365Account,\x20%s,\x20%s',_0x116fac,_0x46fa5c);_0x327648(_0x46fa5c);});});}function respondWithStatusCode(_0x8eca7d,_0x274318){_0x274318=_0x274318||0xcc;return function(_0x350003){if(_0x350003){return _0x8eca7d['sendStatus'](_0x274318);}return _0x8eca7d[_0xbbc6('0x2b')](_0x274318)[_0xbbc6('0x2c')]();};}function respondWithResult(_0x2b748e,_0x306f8d){_0x306f8d=_0x306f8d||0xc8;return function(_0x2c16b2){if(_0x2c16b2){return _0x2b748e[_0xbbc6('0x2b')](_0x306f8d)[_0xbbc6('0x2d')](_0x2c16b2);}};}function respondWithFilteredResult(_0x18c50f,_0x11d27d){return function(_0x4dc5d0){if(_0x4dc5d0){var _0x16014e=_0x4dc5d0[_0xbbc6('0x2e')],_0xfb23fa=_0x11d27d['offset'],_0x2b6abf=_0x11d27d[_0xbbc6('0x2f')]+_0x11d27d[_0xbbc6('0x30')],_0x3c98c7;if(_0x2b6abf>=_0x16014e){_0x2b6abf=_0x16014e;_0x3c98c7=0xc8;}else{_0x3c98c7=0xce;}_0x18c50f[_0xbbc6('0x2b')](_0x3c98c7);return _0x18c50f['set'](_0xbbc6('0x31'),_0xfb23fa+'-'+_0x2b6abf+'/'+_0x16014e)[_0xbbc6('0x2d')](_0x4dc5d0);}return null;};}function patchUpdates(_0x17c74b){return function(_0x907413){try{jsonpatch['apply'](_0x907413,_0x17c74b,!![]);}catch(_0x2fbb95){return BPromise['reject'](_0x2fbb95);}return _0x907413[_0xbbc6('0x32')]();};}function saveUpdates(_0x509264,_0x3dd3d4){return function(_0x926c49){if(_0x926c49){return _0x926c49[_0xbbc6('0x33')](_0x509264)['then'](function(_0x3a7df1){return _0x3a7df1;});}return null;};}function removeEntity(_0x147b99,_0x4ae715){return function(_0x95e124){if(_0x95e124){return _0x95e124[_0xbbc6('0x34')]()[_0xbbc6('0x20')](function(){_0x147b99[_0xbbc6('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fc977,_0x2755ba){return function(_0x2b47db){if(!_0x2b47db){_0x2fc977[_0xbbc6('0x35')](0x194);}return _0x2b47db;};}function handleError(_0x7ca117,_0x1a2905){_0x1a2905=_0x1a2905||0x1f4;return function(_0x59fff9){logger[_0xbbc6('0x26')](_0x59fff9[_0xbbc6('0x36')]);if(_0x59fff9[_0xbbc6('0x37')]){delete _0x59fff9['name'];}_0x7ca117[_0xbbc6('0x2b')](_0x1a2905)[_0xbbc6('0x38')](_0x59fff9);};}exports[_0xbbc6('0x39')]=function(_0x35352f,_0x148013){var _0x18c589={},_0x3d44b3={},_0x497448={'count':0x0,'rows':[]};var _0x42aa6d=_[_0xbbc6('0x3a')](db[_0xbbc6('0x3b')][_0xbbc6('0x3c')],function(_0x31a027){return{'name':_0x31a027['fieldName'],'type':_0x31a027['type'][_0xbbc6('0x3d')]};});_0x3d44b3[_0xbbc6('0x3e')]=_[_0xbbc6('0x3a')](_0x42aa6d,_0xbbc6('0x37'));_0x3d44b3[_0xbbc6('0x3f')]=_[_0xbbc6('0x40')](_0x35352f['query']);_0x3d44b3[_0xbbc6('0x41')]=_[_0xbbc6('0x42')](_0x3d44b3[_0xbbc6('0x3e')],_0x3d44b3[_0xbbc6('0x3f')]);_0x18c589[_0xbbc6('0x43')]=_['intersection'](_0x3d44b3['model'],qs[_0xbbc6('0x44')](_0x35352f[_0xbbc6('0x3f')][_0xbbc6('0x44')]));_0x18c589[_0xbbc6('0x43')]=_0x18c589[_0xbbc6('0x43')][_0xbbc6('0x45')]?_0x18c589[_0xbbc6('0x43')]:_0x3d44b3[_0xbbc6('0x3e')];if(!_0x35352f['query'][_0xbbc6('0x46')](_0xbbc6('0x47'))){_0x18c589['limit']=qs[_0xbbc6('0x30')](_0x35352f[_0xbbc6('0x3f')][_0xbbc6('0x30')]);_0x18c589['offset']=qs[_0xbbc6('0x2f')](_0x35352f[_0xbbc6('0x3f')][_0xbbc6('0x2f')]);}_0x18c589[_0xbbc6('0x48')]=qs['sort'](_0x35352f['query'][_0xbbc6('0x49')]);_0x18c589[_0xbbc6('0x4a')]=qs[_0xbbc6('0x41')](_[_0xbbc6('0x4b')](_0x35352f[_0xbbc6('0x3f')],_0x3d44b3[_0xbbc6('0x41')]),_0x42aa6d);if(_0x35352f[_0xbbc6('0x3f')]['filter']){_0x18c589[_0xbbc6('0x4a')]=_[_0xbbc6('0x4c')](_0x18c589['where'],{'$or':_[_0xbbc6('0x3a')](_0x42aa6d,function(_0x4875c9){if(_0x4875c9[_0xbbc6('0x4d')]!=='VIRTUAL'){var _0x58e9a4={};_0x58e9a4[_0x4875c9['name']]={'$like':'%'+_0x35352f['query'][_0xbbc6('0x4e')]+'%'};return _0x58e9a4;}})});}_0x18c589=_[_0xbbc6('0x4c')]({},_0x18c589,_0x35352f[_0xbbc6('0x4f')]);var _0x53f70e={'where':_0x18c589['where']};return db[_0xbbc6('0x3b')][_0xbbc6('0x2e')](_0x53f70e)[_0xbbc6('0x20')](function(_0x5bcb1d){_0x497448['count']=_0x5bcb1d;if(_0x35352f[_0xbbc6('0x3f')][_0xbbc6('0x50')]){_0x18c589['include']=[{'all':!![]}];}return db[_0xbbc6('0x3b')][_0xbbc6('0x51')](_0x18c589);})['then'](function(_0x334a84){_0x497448[_0xbbc6('0x52')]=_0x334a84;return _0x497448;})['then'](respondWithFilteredResult(_0x148013,_0x18c589))[_0xbbc6('0x2a')](handleError(_0x148013,null));};exports[_0xbbc6('0x53')]=function(_0x5dace8,_0x2a37e9){var _0x4f3586={'raw':![],'where':{'id':_0x5dace8['params']['id']}},_0x433158={};_0x433158[_0xbbc6('0x3e')]=_['keys'](db['Dynamics365Account'][_0xbbc6('0x3c')]);_0x433158[_0xbbc6('0x3f')]=_[_0xbbc6('0x40')](_0x5dace8['query']);_0x433158['filters']=_[_0xbbc6('0x42')](_0x433158[_0xbbc6('0x3e')],_0x433158['query']);_0x4f3586[_0xbbc6('0x43')]=_[_0xbbc6('0x42')](_0x433158[_0xbbc6('0x3e')],qs['fields'](_0x5dace8[_0xbbc6('0x3f')][_0xbbc6('0x44')]));_0x4f3586[_0xbbc6('0x43')]=_0x4f3586['attributes'][_0xbbc6('0x45')]?_0x4f3586[_0xbbc6('0x43')]:_0x433158[_0xbbc6('0x3e')];if(_0x5dace8[_0xbbc6('0x3f')][_0xbbc6('0x50')]){_0x4f3586['include']=[{'all':!![]}];}_0x4f3586=_[_0xbbc6('0x4c')]({},_0x4f3586,_0x5dace8[_0xbbc6('0x4f')]);return db[_0xbbc6('0x3b')]['find'](_0x4f3586)['then'](handleEntityNotFound(_0x2a37e9,null))['then'](respondWithResult(_0x2a37e9,null))[_0xbbc6('0x2a')](handleError(_0x2a37e9,null));};exports[_0xbbc6('0x54')]=function(_0x422b26,_0xafa9c){return db[_0xbbc6('0x3b')][_0xbbc6('0x54')](_0x422b26['body'],{})['then'](respondWithResult(_0xafa9c,0xc9))[_0xbbc6('0x2a')](handleError(_0xafa9c,null));};exports[_0xbbc6('0x33')]=function(_0x571995,_0x182bf3){if(_0x571995[_0xbbc6('0x55')]['id']){delete _0x571995[_0xbbc6('0x55')]['id'];}return db[_0xbbc6('0x3b')][_0xbbc6('0x56')]({'where':{'id':_0x571995[_0xbbc6('0x57')]['id']}})[_0xbbc6('0x20')](handleEntityNotFound(_0x182bf3,null))['then'](saveUpdates(_0x571995[_0xbbc6('0x55')],null))[_0xbbc6('0x20')](respondWithResult(_0x182bf3,null))['catch'](handleError(_0x182bf3,null));};exports['destroy']=function(_0x18371e,_0x23ad08){return db[_0xbbc6('0x3b')][_0xbbc6('0x56')]({'where':{'id':_0x18371e[_0xbbc6('0x57')]['id']}})[_0xbbc6('0x20')](handleEntityNotFound(_0x23ad08,null))['then'](removeEntity(_0x23ad08,null))[_0xbbc6('0x2a')](handleError(_0x23ad08,null));};exports[_0xbbc6('0x58')]=function(_0x55fad2,_0x3dc7dc,_0x5a722e){var _0x2b1229={};var _0x56a8a2={};var _0x2181de;var _0x1ffb52;return db[_0xbbc6('0x3b')][_0xbbc6('0x59')]({'where':{'id':_0x55fad2[_0xbbc6('0x57')]['id']}})[_0xbbc6('0x20')](handleEntityNotFound(_0x3dc7dc,null))['then'](function(_0xb7f2bd){if(_0xb7f2bd){_0x2181de=_0xb7f2bd;_0x56a8a2[_0xbbc6('0x3e')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x56a8a2[_0xbbc6('0x3f')]=_[_0xbbc6('0x40')](_0x55fad2[_0xbbc6('0x3f')]);_0x56a8a2['filters']=_[_0xbbc6('0x42')](_0x56a8a2[_0xbbc6('0x3e')],_0x56a8a2[_0xbbc6('0x3f')]);_0x2b1229['attributes']=_['intersection'](_0x56a8a2[_0xbbc6('0x3e')],qs['fields'](_0x55fad2[_0xbbc6('0x3f')][_0xbbc6('0x44')]));_0x2b1229[_0xbbc6('0x43')]=_0x2b1229[_0xbbc6('0x43')]['length']?_0x2b1229[_0xbbc6('0x43')]:_0x56a8a2[_0xbbc6('0x3e')];_0x2b1229[_0xbbc6('0x48')]=qs[_0xbbc6('0x49')](_0x55fad2['query'][_0xbbc6('0x49')]);_0x2b1229[_0xbbc6('0x4a')]=qs[_0xbbc6('0x41')](_[_0xbbc6('0x4b')](_0x55fad2['query'],_0x56a8a2[_0xbbc6('0x41')]));if(_0x55fad2['query'][_0xbbc6('0x4e')]){_0x2b1229[_0xbbc6('0x4a')]=_[_0xbbc6('0x4c')](_0x2b1229[_0xbbc6('0x4a')],{'$or':_[_0xbbc6('0x3a')](_0x2b1229[_0xbbc6('0x43')],function(_0x1b9f0a){var _0x1a2f1e={};_0x1a2f1e[_0x1b9f0a]={'$like':'%'+_0x55fad2[_0xbbc6('0x3f')]['filter']+'%'};return _0x1a2f1e;})});}_0x2b1229=_[_0xbbc6('0x4c')]({},_0x2b1229,_0x55fad2['options']);return _0x2181de[_0xbbc6('0x58')](_0x2b1229);}})[_0xbbc6('0x20')](function(_0x54c113){if(_0x54c113){_0x1ffb52=_0x54c113[_0xbbc6('0x45')];if(!_0x55fad2[_0xbbc6('0x3f')][_0xbbc6('0x46')]('nolimit')){_0x2b1229[_0xbbc6('0x30')]=qs[_0xbbc6('0x30')](_0x55fad2[_0xbbc6('0x3f')][_0xbbc6('0x30')]);_0x2b1229[_0xbbc6('0x2f')]=qs[_0xbbc6('0x2f')](_0x55fad2[_0xbbc6('0x3f')]['offset']);}return _0x2181de[_0xbbc6('0x58')](_0x2b1229);}})[_0xbbc6('0x20')](function(_0x1456a4){if(_0x1456a4){return _0x1456a4?{'count':_0x1ffb52,'rows':_0x1456a4}:null;}})[_0xbbc6('0x20')](respondWithResult(_0x3dc7dc,null))[_0xbbc6('0x2a')](handleError(_0x3dc7dc,null));};exports['addConfiguration']=function(_0x5bd085,_0x415777,_0x2efef9){if(_0x5bd085[_0xbbc6('0x55')]['id']){delete _0x5bd085[_0xbbc6('0x55')]['id'];}return db[_0xbbc6('0x3b')][_0xbbc6('0x59')]({'where':{'id':_0x5bd085['params']['id']}})['then'](handleEntityNotFound(_0x415777,null))[_0xbbc6('0x20')](function(_0x5ee217){if(_0x5ee217){_0x5bd085[_0xbbc6('0x55')][_0xbbc6('0x5a')]=_0x5ee217['id'];_0x5bd085['body']['Subjects']=integrations['getSubjects'](_0x5bd085[_0xbbc6('0x55')][_0xbbc6('0x5b')],_0x5bd085[_0xbbc6('0x55')][_0xbbc6('0x4d')]);_0x5bd085[_0xbbc6('0x55')][_0xbbc6('0x5c')]=integrations['getDescriptions'](_0x5bd085[_0xbbc6('0x55')][_0xbbc6('0x5b')],_0x5bd085[_0xbbc6('0x55')]['type']);return db[_0xbbc6('0x5d')][_0xbbc6('0x54')](_0x5bd085['body'],{'include':[{'model':db[_0xbbc6('0x5e')],'as':'Subjects'},{'model':db[_0xbbc6('0x5e')],'as':_0xbbc6('0x5c')}]});}return null;})['then'](respondWithResult(_0x415777,null))[_0xbbc6('0x2a')](handleError(_0x415777,null));};exports[_0xbbc6('0x5f')]=function(_0x18aa8b,_0x10bb43,_0x35354a){var _0x415527=_0x18aa8b['query'][_0xbbc6('0x60')];var _0x431031=_0x415527==='incident'?_0xbbc6('0x61'):_0xbbc6('0x62');var _0x3a2957='';var _0x3b9189='';var _0x407ed6='';var _0x491721='';var _0x59f5ed='';var _0x1363d4='';var _0x4c038b='';var _0x42d147='';var _0x36e122=[_0xbbc6('0x63'),_0xbbc6('0x64'),_0xbbc6('0x65'),'ownerid',_0xbbc6('0x66'),'subject','phonenumber',_0xbbc6('0x67'),_0xbbc6('0x68'),_0xbbc6('0x69')];var _0x5c344c=[_0xbbc6('0x6a'),_0xbbc6('0x6b'),_0xbbc6('0x6c'),_0xbbc6('0x6d'),_0xbbc6('0x6e'),_0xbbc6('0x6f'),_0xbbc6('0x70'),_0xbbc6('0x71'),_0xbbc6('0x72'),_0xbbc6('0x73'),_0xbbc6('0x74'),_0xbbc6('0x75'),_0xbbc6('0x76'),_0xbbc6('0x77'),_0xbbc6('0x78'),_0xbbc6('0x79'),_0xbbc6('0x7a'),_0xbbc6('0x7b'),'emailaddress',_0xbbc6('0x7c'),_0xbbc6('0x7d'),_0xbbc6('0x7e'),'escalatedon',_0xbbc6('0x7f'),'firstresponsebykpiidname',_0xbbc6('0x80'),_0xbbc6('0x81'),_0xbbc6('0x82'),_0xbbc6('0x83'),_0xbbc6('0x84'),_0xbbc6('0x85'),_0xbbc6('0x86'),'modifiedbyexternalpartyyominame',_0xbbc6('0x87'),_0xbbc6('0x88'),_0xbbc6('0x89'),_0xbbc6('0x8a'),_0xbbc6('0x8b'),_0xbbc6('0x8c'),_0xbbc6('0x8d'),_0xbbc6('0x8e'),'onholdtime',_0xbbc6('0x8f'),_0xbbc6('0x90'),'owneridtype',_0xbbc6('0x91'),'parentcaseidname','primarycontactidname',_0xbbc6('0x92'),'prioritycodename',_0xbbc6('0x93'),_0xbbc6('0x94'),_0xbbc6('0x95'),_0xbbc6('0x96'),_0xbbc6('0x97'),_0xbbc6('0x98'),'responsiblecontactidyominame',_0xbbc6('0x99'),_0xbbc6('0x9a'),_0xbbc6('0x9b'),_0xbbc6('0x9c'),'statecode',_0xbbc6('0x9d'),_0xbbc6('0x9e'),'ticketnumber',_0xbbc6('0x9f'),_0xbbc6('0xa0'),_0xbbc6('0xa1'),_0xbbc6('0xa2'),'versionnumber'];var _0x4133dd=_0x36e122[_0xbbc6('0xa3')](_0x5c344c);return db[_0xbbc6('0x3b')][_0xbbc6('0x59')]({'where':{'id':_0x18aa8b[_0xbbc6('0x57')]['id']},'attributes':['id','username',_0xbbc6('0xa4'),_0xbbc6('0xa5'),_0xbbc6('0xa6'),'clientId','clientSecret']})[_0xbbc6('0x20')](handleEntityNotFound(_0x10bb43,null))[_0xbbc6('0x20')](function(_0x4a3c8a){if(_0x4a3c8a){_0x42d147=_0x4a3c8a['remoteUri'];var _0x510931=_0x42d147[_0xbbc6('0xa7')](-0x1);if(_0x510931==='/'){_0x42d147=_0x42d147[_0xbbc6('0xa8')](0x0,_0x42d147[_0xbbc6('0xa9')](_0x510931));}_0x4c038b=util[_0xbbc6('0xaa')](_0xbbc6('0xab'),_0x42d147);var _0x317b5f={'method':_0xbbc6('0xac'),'uri':'https://login.microsoftonline.com/'+_0x4a3c8a[_0xbbc6('0xa6')]+_0xbbc6('0xad'),'form':{'client_id':_0x4a3c8a[_0xbbc6('0xae')],'resource':_0x42d147,'username':_0x4a3c8a['username'],'password':_0x4a3c8a['password'],'grant_type':_0xbbc6('0xa4'),'client_secret':_0x4a3c8a[_0xbbc6('0xaf')]},'json':!![]};return rp(_0x317b5f);}})['then'](function(_0x572b56){_0x1363d4=_0x572b56[_0xbbc6('0xb0')];var _0x3586ea={'method':_0xbbc6('0xb1'),'uri':encodeURI(_0x4c038b+_0xbbc6('0xb2')+_0x431031+'\x27'),'headers':{'Authorization':_0xbbc6('0xb3')+_0x1363d4,'If-None-Match':null,'OData-Version':_0xbbc6('0xb4')},'json':!![]};return rp(_0x3586ea);})[_0xbbc6('0x20')](function(_0x43dd4d){var _0x42a20c=_0x43dd4d[_0xbbc6('0xb5')][0x0];var _0x1ff76c=_0x42a20c['MetadataId'];var _0x2a57cf={'method':_0xbbc6('0xb1'),'uri':_0x4c038b+'EntityDefinitions('+_0x1ff76c+_0xbbc6('0xb6'),'headers':{'Authorization':_0xbbc6('0xb3')+_0x1363d4,'If-None-Match':null,'OData-Version':_0xbbc6('0xb4')},'json':!![]};return rp(_0x2a57cf);})[_0xbbc6('0x20')](function(_0x28093b){_0x3a2957=_0x28093b;_0x3b9189=_0x3a2957[_0xbbc6('0xb7')];_0x3b9189=_[_0xbbc6('0xb8')](_0x3b9189,function(_0x24a850){return!_0x4133dd[_0xbbc6('0xb9')](_0x24a850[_0xbbc6('0xba')]);});var _0x5dc2f7=[];var _0x38387f=[];_0x3b9189[_0xbbc6('0xbb')](function(_0x4bf2e4){if(_0x4bf2e4['@odata.type']){var _0x1d9817=_0x4bf2e4['@odata.type'][_0xbbc6('0xa8')](_0x4bf2e4[_0xbbc6('0xbc')][_0xbbc6('0xa9')]('.')+0x1);if(_0x1d9817===_0xbbc6('0xbd')){_0x5dc2f7['push'](getSelectList(_0x4c038b,_0x415527,_0x38387f,_0x3a2957['MetadataId'],_0x4bf2e4['MetadataId'],_0x1363d4));}}});return Promise[_0xbbc6('0xbe')](_0x5dc2f7);})[_0xbbc6('0x20')](function(_0x4d8e6e){_0x407ed6=_0x4d8e6e[0x0];var _0x8c2d66=[];var _0x4c4b63=[];_0x3b9189[_0xbbc6('0xbb')](function(_0x1f8889){if(!_[_0xbbc6('0xbf')](_0x1f8889[_0xbbc6('0xbc')])){var _0x4b4131=_0x1f8889[_0xbbc6('0xbc')]['substring'](_0x1f8889[_0xbbc6('0xbc')][_0xbbc6('0xa9')]('.')+0x1);if(_0x4b4131==='BooleanAttributeMetadata'){_0x8c2d66['push'](getBooleanList(_0x4c038b,_0x415527,_0x4c4b63,_0x3a2957['MetadataId'],_0x1f8889['MetadataId'],_0x1363d4));}}});return Promise[_0xbbc6('0xbe')](_0x8c2d66);})[_0xbbc6('0x20')](function(_0x27e9d4){_0x491721=_0x27e9d4[0x0];var _0x2d9494=[];var _0x11eef0=[];_0x3b9189[_0xbbc6('0xbb')](function(_0x5d854b){if(_0x5d854b[_0xbbc6('0xbc')]){var _0x4d2f54=_0x5d854b[_0xbbc6('0xbc')][_0xbbc6('0xa8')](_0x5d854b[_0xbbc6('0xbc')][_0xbbc6('0xa9')]('.')+0x1);if(_0x4d2f54==='StringAttributeMetadata'||_0x4d2f54===_0xbbc6('0xc0')||_0x4d2f54===_0xbbc6('0xc1')||_0x4d2f54===_0xbbc6('0xc2')||_0x4d2f54==='MemoAttributeMetadata'||_0x4d2f54===_0xbbc6('0xc3')||_0x4d2f54===_0xbbc6('0xc4')||_0x4d2f54===_0xbbc6('0xc5')||_0x4d2f54===_0xbbc6('0xc6')||_0x4d2f54===_0xbbc6('0xc7')){_0x2d9494[_0xbbc6('0xc8')](getInputList(_0x4c038b,_0x415527,_0x4d2f54,_0x11eef0,_0x3a2957['MetadataId'],_0x5d854b[_0xbbc6('0xc9')],_0x1363d4));}}});return Promise[_0xbbc6('0xbe')](_0x2d9494);})['then'](function(_0x1f3d19){_0x59f5ed=_0x1f3d19[0x0];var _0x45e46a=_0x407ed6[_0xbbc6('0xa3')](_0x491721)[_0xbbc6('0xa3')](_0x59f5ed);var _0xe913f2={'count':_0x45e46a[_0xbbc6('0x45')],'rows':_0x45e46a};return _0xe913f2;})[_0xbbc6('0x20')](respondWithResult(_0x10bb43,null))['catch'](function(_0x35f015){var _0x4b8045=_0x18aa8b[_0xbbc6('0x3f')]['test']?0x1f4:_0x35f015['statusCode']||0x1f4;logger[_0xbbc6('0x26')](_0x35f015[_0xbbc6('0x36')]);delete _0x35f015['name'];if(_0x4b8045===0x191){_0x4b8045=0x190;}_0x10bb43[_0xbbc6('0x2b')](_0x4b8045)[_0xbbc6('0x38')](_0x18aa8b[_0xbbc6('0x3f')][_0xbbc6('0x1c')]?{'message':_0xbbc6('0xca'),'statusCode':_0x35f015[_0xbbc6('0xcb')]}:_0x35f015);});};function getSelectList(_0x1e75f9,_0x51cfb9,_0x9407d8,_0x4d00e0,_0x1d5f44,_0x522258){var _0x42c3eb={'method':_0xbbc6('0xb1'),'uri':_0x1e75f9+_0xbbc6('0xcc')+_0x4d00e0+_0xbbc6('0xcd')+_0x1d5f44+_0xbbc6('0xce')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xbbc6('0xb3')+_0x522258,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x42c3eb)['then'](function(_0x3b84a3){var _0x4d5893=[];var _0x550ec5=_0x3b84a3[_0xbbc6('0xcf')][_0xbbc6('0xd0')];_0x550ec5[_0xbbc6('0xbb')](function(_0x592b64){_0x4d5893[_0xbbc6('0xc8')]({'name':_0x592b64[_0xbbc6('0xd1')][_0xbbc6('0xd2')][_0xbbc6('0xd1')],'value':String(_0x592b64[_0xbbc6('0xd3')])});});var _0x52bfd1={'id':_0x51cfb9+'_'+_0x3b84a3[_0xbbc6('0xba')],'name':_0x3b84a3[_0xbbc6('0xd4')][_0xbbc6('0xd2')][_0xbbc6('0xd1')],'custom':![],'options':_0x4d5893};_0x9407d8[_0xbbc6('0xc8')](_0x52bfd1);return _0x9407d8;});}function getBooleanList(_0x18d67c,_0x1f5ec2,_0x133cfc,_0x1abf7f,_0x18ed73,_0xb6359e){var _0x427ac0={'method':_0xbbc6('0xb1'),'uri':_0x18d67c+_0xbbc6('0xcc')+_0x1abf7f+_0xbbc6('0xcd')+_0x18ed73+_0xbbc6('0xd5'),'headers':{'Authorization':_0xbbc6('0xb3')+_0xb6359e,'If-None-Match':null,'OData-Version':_0xbbc6('0xb4')},'json':!![]};return rp(_0x427ac0)[_0xbbc6('0x20')](function(_0x279c34){var _0xf8d05=[];_0xf8d05[_0xbbc6('0xc8')]({'name':_0x279c34[_0xbbc6('0xcf')][_0xbbc6('0xd6')][_0xbbc6('0xd1')][_0xbbc6('0xd2')][_0xbbc6('0xd1')],'value':'true'},{'name':_0x279c34['OptionSet'][_0xbbc6('0xd7')][_0xbbc6('0xd1')][_0xbbc6('0xd2')]['Label'],'value':_0xbbc6('0xd8')});var _0x101325={'id':_0x1f5ec2+'_'+_0x279c34['LogicalName'],'name':_0x279c34[_0xbbc6('0xd4')][_0xbbc6('0xd2')][_0xbbc6('0xd1')],'custom':![],'options':_0xf8d05};_0x133cfc['push'](_0x101325);return _0x133cfc;});}function getInputList(_0x5d81a9,_0x49ba6d,_0x1b7ac5,_0x4446a5,_0x30a0ff,_0xf8577d,_0x5908cd){var _0x587026={'method':_0xbbc6('0xb1'),'uri':_0x5d81a9+'EntityDefinitions('+_0x30a0ff+_0xbbc6('0xcd')+_0xf8577d+')/Microsoft.Dynamics.CRM.'+_0x1b7ac5+_0xbbc6('0xd9'),'headers':{'Authorization':_0xbbc6('0xb3')+_0x5908cd,'If-None-Match':null,'OData-Version':_0xbbc6('0xb4')},'json':!![]};return rp(_0x587026)[_0xbbc6('0x20')](function(_0x1e48b3){var _0x4b7425={'id':_0x49ba6d+'_'+_0x1e48b3['LogicalName'],'name':_0x1e48b3[_0xbbc6('0xd4')][_0xbbc6('0xd2')]?_0x1e48b3[_0xbbc6('0xd4')]['UserLocalizedLabel']['Label']:_0x1e48b3[_0xbbc6('0xba')],'custom':![],'options':[]};_0x4446a5[_0xbbc6('0xc8')](_0x4b7425);return _0x4446a5;});} \ No newline at end of file +var _0x3f8f=['options','includeAll','show','params','fields','length','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','username','tenantId','clientSecret','remoteUri','substring','lastIndexOf','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','clientId','password','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','false','?$select=DisplayName,LogicalName','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x1fff4a,_0x230917){var _0x55bdfa=function(_0x369269){while(--_0x369269){_0x1fff4a['push'](_0x1fff4a['shift']());}};_0x55bdfa(++_0x230917);}(_0x3f8f,0x15c));var _0xf3f8=function(_0x255446,_0x44e635){_0x255446=_0x255446-0x0;var _0x27747e=_0x3f8f[_0x255446];return _0x27747e;};'use strict';var pdf=require(_0xf3f8('0x0'));var emlformat=require(_0xf3f8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf3f8('0x2'));var jsonpatch=require(_0xf3f8('0x3'));var rp=require(_0xf3f8('0x4'));var moment=require(_0xf3f8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf3f8('0x6'));var sox=require('sox');var csv=require(_0xf3f8('0x7'));var ejs=require(_0xf3f8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf3f8('0x9'));var deskjs=require(_0xf3f8('0xa'));var toCsv=require(_0xf3f8('0x7'));var querystring=require('querystring');var Papa=require(_0xf3f8('0xb'));var Redis=require(_0xf3f8('0xc'));var authService=require(_0xf3f8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf3f8('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3f8('0xf'))(_0xf3f8('0x10'));var utils=require(_0xf3f8('0x11'));var config=require(_0xf3f8('0x12'));var db=require(_0xf3f8('0x13'))['db'];var integrations=require(_0xf3f8('0x14'));var jayson=require(_0xf3f8('0x15'));var client=jayson['client'][_0xf3f8('0x16')]({'port':0x232a});function checkPasswordPattern(_0x21ba4c,_0x3bb193,_0x59d89e){if(_0x59d89e){var _0x393efb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x393efb[_0xf3f8('0x17')](_0x3bb193)){return _0x21ba4c;}else{throw new db[(_0xf3f8('0x18'))][(_0xf3f8('0x19'))](_0xf3f8('0x1a'));}}else{return _0x21ba4c;}}function respondWithRpcPromise(_0x2de2f,_0x26bde2,_0xf62b41,_0x3afebc){return new BPromise(function(_0x13ee4e,_0x514dd0){var _0x4efb8b=_0x3afebc||client;return _0x4efb8b[_0xf3f8('0x1b')](_0x2de2f,_0xf62b41)[_0xf3f8('0x1c')](function(_0x14dfa5){logger[_0xf3f8('0x1d')](_0xf3f8('0x1e'),_0x26bde2,_0xf3f8('0x1f'));logger[_0xf3f8('0x20')](_0xf3f8('0x21'),_0x26bde2,_0xf3f8('0x1f'),JSON[_0xf3f8('0x22')](_0x14dfa5));if(_0x14dfa5['error']){if(_0x14dfa5[_0xf3f8('0x23')][_0xf3f8('0x24')]===0x1f4){logger[_0xf3f8('0x23')]('Dynamics365Account,\x20%s,\x20%s',_0x26bde2,_0x14dfa5['error'][_0xf3f8('0x25')]);return _0x514dd0(_0x14dfa5[_0xf3f8('0x23')][_0xf3f8('0x25')]);}logger[_0xf3f8('0x23')](_0xf3f8('0x1e'),_0x26bde2,_0x14dfa5[_0xf3f8('0x23')][_0xf3f8('0x25')]);return _0x13ee4e(_0x14dfa5[_0xf3f8('0x23')][_0xf3f8('0x25')]);}else{logger[_0xf3f8('0x1d')](_0xf3f8('0x1e'),_0x26bde2,'request\x20sent');_0x13ee4e(_0x14dfa5['result'][_0xf3f8('0x25')]);}})[_0xf3f8('0x26')](function(_0x49f765){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x26bde2,_0x49f765);_0x514dd0(_0x49f765);});});}function respondWithStatusCode(_0x297158,_0xaffb10){_0xaffb10=_0xaffb10||0xcc;return function(_0x1f7f53){if(_0x1f7f53){return _0x297158[_0xf3f8('0x27')](_0xaffb10);}return _0x297158[_0xf3f8('0x28')](_0xaffb10)[_0xf3f8('0x29')]();};}function respondWithResult(_0x40896b,_0x258618){_0x258618=_0x258618||0xc8;return function(_0x4478a6){if(_0x4478a6){return _0x40896b[_0xf3f8('0x28')](_0x258618)[_0xf3f8('0x2a')](_0x4478a6);}};}function respondWithFilteredResult(_0x409dfe,_0x316966){return function(_0x2207a4){if(_0x2207a4){var _0x294d0b=_0x2207a4[_0xf3f8('0x2b')],_0x56313f=_0x316966['offset'],_0x176cab=_0x316966[_0xf3f8('0x2c')]+_0x316966[_0xf3f8('0x2d')],_0x19ba5c;if(_0x176cab>=_0x294d0b){_0x176cab=_0x294d0b;_0x19ba5c=0xc8;}else{_0x19ba5c=0xce;}_0x409dfe[_0xf3f8('0x28')](_0x19ba5c);return _0x409dfe['set'](_0xf3f8('0x2e'),_0x56313f+'-'+_0x176cab+'/'+_0x294d0b)[_0xf3f8('0x2a')](_0x2207a4);}return null;};}function patchUpdates(_0x23cef2){return function(_0x3bfb92){try{jsonpatch[_0xf3f8('0x2f')](_0x3bfb92,_0x23cef2,!![]);}catch(_0x43ff0a){return BPromise['reject'](_0x43ff0a);}return _0x3bfb92[_0xf3f8('0x30')]();};}function saveUpdates(_0x38350c,_0x41f0ab){return function(_0x5e801b){if(_0x5e801b){return _0x5e801b[_0xf3f8('0x31')](_0x38350c)[_0xf3f8('0x1c')](function(_0xe84150){return _0xe84150;});}return null;};}function removeEntity(_0x3e5121,_0x1ab2bc){return function(_0x35a995){if(_0x35a995){return _0x35a995[_0xf3f8('0x32')]()['then'](function(){_0x3e5121[_0xf3f8('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x212cca,_0x24cc62){return function(_0x35eb7f){if(!_0x35eb7f){_0x212cca[_0xf3f8('0x27')](0x194);}return _0x35eb7f;};}function handleError(_0xc8f652,_0x48828b){_0x48828b=_0x48828b||0x1f4;return function(_0x171b39){logger[_0xf3f8('0x23')](_0x171b39[_0xf3f8('0x33')]);if(_0x171b39[_0xf3f8('0x34')]){delete _0x171b39[_0xf3f8('0x34')];}_0xc8f652[_0xf3f8('0x28')](_0x48828b)[_0xf3f8('0x35')](_0x171b39);};}exports[_0xf3f8('0x36')]=function(_0x3c4e8e,_0xea90b5){var _0x448b7c={},_0xa2d16={},_0x5cebc7={'count':0x0,'rows':[]};var _0x3c7535=_['map'](db[_0xf3f8('0x37')][_0xf3f8('0x38')],function(_0x36d814){return{'name':_0x36d814[_0xf3f8('0x39')],'type':_0x36d814[_0xf3f8('0x3a')][_0xf3f8('0x3b')]};});_0xa2d16[_0xf3f8('0x3c')]=_[_0xf3f8('0x3d')](_0x3c7535,_0xf3f8('0x34'));_0xa2d16[_0xf3f8('0x3e')]=_[_0xf3f8('0x3f')](_0x3c4e8e[_0xf3f8('0x3e')]);_0xa2d16[_0xf3f8('0x40')]=_[_0xf3f8('0x41')](_0xa2d16[_0xf3f8('0x3c')],_0xa2d16[_0xf3f8('0x3e')]);_0x448b7c[_0xf3f8('0x42')]=_[_0xf3f8('0x41')](_0xa2d16[_0xf3f8('0x3c')],qs['fields'](_0x3c4e8e[_0xf3f8('0x3e')]['fields']));_0x448b7c[_0xf3f8('0x42')]=_0x448b7c[_0xf3f8('0x42')]['length']?_0x448b7c[_0xf3f8('0x42')]:_0xa2d16[_0xf3f8('0x3c')];if(!_0x3c4e8e['query'][_0xf3f8('0x43')]('nolimit')){_0x448b7c[_0xf3f8('0x2d')]=qs['limit'](_0x3c4e8e[_0xf3f8('0x3e')][_0xf3f8('0x2d')]);_0x448b7c[_0xf3f8('0x2c')]=qs['offset'](_0x3c4e8e['query']['offset']);}_0x448b7c[_0xf3f8('0x44')]=qs[_0xf3f8('0x45')](_0x3c4e8e['query'][_0xf3f8('0x45')]);_0x448b7c[_0xf3f8('0x46')]=qs[_0xf3f8('0x40')](_[_0xf3f8('0x47')](_0x3c4e8e[_0xf3f8('0x3e')],_0xa2d16[_0xf3f8('0x40')]),_0x3c7535);if(_0x3c4e8e[_0xf3f8('0x3e')][_0xf3f8('0x48')]){_0x448b7c[_0xf3f8('0x46')]=_[_0xf3f8('0x49')](_0x448b7c[_0xf3f8('0x46')],{'$or':_[_0xf3f8('0x3d')](_0x3c7535,function(_0x1291a2){if(_0x1291a2['type']!=='VIRTUAL'){var _0x355c46={};_0x355c46[_0x1291a2[_0xf3f8('0x34')]]={'$like':'%'+_0x3c4e8e[_0xf3f8('0x3e')][_0xf3f8('0x48')]+'%'};return _0x355c46;}})});}_0x448b7c=_['merge']({},_0x448b7c,_0x3c4e8e[_0xf3f8('0x4a')]);var _0x4924a5={'where':_0x448b7c[_0xf3f8('0x46')]};return db[_0xf3f8('0x37')][_0xf3f8('0x2b')](_0x4924a5)[_0xf3f8('0x1c')](function(_0x3c447a){_0x5cebc7[_0xf3f8('0x2b')]=_0x3c447a;if(_0x3c4e8e['query'][_0xf3f8('0x4b')]){_0x448b7c['include']=[{'all':!![]}];}return db[_0xf3f8('0x37')]['findAll'](_0x448b7c);})[_0xf3f8('0x1c')](function(_0x13e6a2){_0x5cebc7['rows']=_0x13e6a2;return _0x5cebc7;})[_0xf3f8('0x1c')](respondWithFilteredResult(_0xea90b5,_0x448b7c))[_0xf3f8('0x26')](handleError(_0xea90b5,null));};exports[_0xf3f8('0x4c')]=function(_0x5c1dac,_0x26b03b){var _0x350ed8={'raw':![],'where':{'id':_0x5c1dac[_0xf3f8('0x4d')]['id']}},_0x2db076={};_0x2db076[_0xf3f8('0x3c')]=_[_0xf3f8('0x3f')](db[_0xf3f8('0x37')][_0xf3f8('0x38')]);_0x2db076[_0xf3f8('0x3e')]=_[_0xf3f8('0x3f')](_0x5c1dac[_0xf3f8('0x3e')]);_0x2db076[_0xf3f8('0x40')]=_[_0xf3f8('0x41')](_0x2db076[_0xf3f8('0x3c')],_0x2db076[_0xf3f8('0x3e')]);_0x350ed8[_0xf3f8('0x42')]=_[_0xf3f8('0x41')](_0x2db076['model'],qs['fields'](_0x5c1dac['query'][_0xf3f8('0x4e')]));_0x350ed8[_0xf3f8('0x42')]=_0x350ed8[_0xf3f8('0x42')][_0xf3f8('0x4f')]?_0x350ed8[_0xf3f8('0x42')]:_0x2db076[_0xf3f8('0x3c')];if(_0x5c1dac[_0xf3f8('0x3e')][_0xf3f8('0x4b')]){_0x350ed8[_0xf3f8('0x50')]=[{'all':!![]}];}_0x350ed8=_[_0xf3f8('0x49')]({},_0x350ed8,_0x5c1dac[_0xf3f8('0x4a')]);return db[_0xf3f8('0x37')][_0xf3f8('0x51')](_0x350ed8)[_0xf3f8('0x1c')](handleEntityNotFound(_0x26b03b,null))['then'](respondWithResult(_0x26b03b,null))[_0xf3f8('0x26')](handleError(_0x26b03b,null));};exports['create']=function(_0x863761,_0x15516e){return db[_0xf3f8('0x37')][_0xf3f8('0x52')](_0x863761['body'],{})['then'](respondWithResult(_0x15516e,0xc9))[_0xf3f8('0x26')](handleError(_0x15516e,null));};exports[_0xf3f8('0x31')]=function(_0x4cad96,_0x1e9aa8){if(_0x4cad96['body']['id']){delete _0x4cad96[_0xf3f8('0x53')]['id'];}return db[_0xf3f8('0x37')][_0xf3f8('0x51')]({'where':{'id':_0x4cad96['params']['id']}})[_0xf3f8('0x1c')](handleEntityNotFound(_0x1e9aa8,null))['then'](saveUpdates(_0x4cad96[_0xf3f8('0x53')],null))[_0xf3f8('0x1c')](respondWithResult(_0x1e9aa8,null))['catch'](handleError(_0x1e9aa8,null));};exports[_0xf3f8('0x32')]=function(_0x3d2334,_0x59c683){return db[_0xf3f8('0x37')]['find']({'where':{'id':_0x3d2334[_0xf3f8('0x4d')]['id']}})[_0xf3f8('0x1c')](handleEntityNotFound(_0x59c683,null))['then'](removeEntity(_0x59c683,null))['catch'](handleError(_0x59c683,null));};exports[_0xf3f8('0x54')]=function(_0x485f80,_0x45176b,_0x258aed){var _0x3ffe49={};var _0x29c7ca={};var _0x27ee23;var _0x427566;return db[_0xf3f8('0x37')][_0xf3f8('0x55')]({'where':{'id':_0x485f80[_0xf3f8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45176b,null))[_0xf3f8('0x1c')](function(_0x9f8dd5){if(_0x9f8dd5){_0x27ee23=_0x9f8dd5;_0x29c7ca[_0xf3f8('0x3c')]=_[_0xf3f8('0x3f')](db[_0xf3f8('0x56')][_0xf3f8('0x38')]);_0x29c7ca['query']=_[_0xf3f8('0x3f')](_0x485f80[_0xf3f8('0x3e')]);_0x29c7ca[_0xf3f8('0x40')]=_['intersection'](_0x29c7ca[_0xf3f8('0x3c')],_0x29c7ca[_0xf3f8('0x3e')]);_0x3ffe49[_0xf3f8('0x42')]=_['intersection'](_0x29c7ca[_0xf3f8('0x3c')],qs[_0xf3f8('0x4e')](_0x485f80['query'][_0xf3f8('0x4e')]));_0x3ffe49['attributes']=_0x3ffe49[_0xf3f8('0x42')][_0xf3f8('0x4f')]?_0x3ffe49['attributes']:_0x29c7ca['model'];_0x3ffe49['order']=qs[_0xf3f8('0x45')](_0x485f80[_0xf3f8('0x3e')][_0xf3f8('0x45')]);_0x3ffe49[_0xf3f8('0x46')]=qs['filters'](_['pick'](_0x485f80[_0xf3f8('0x3e')],_0x29c7ca['filters']));if(_0x485f80['query'][_0xf3f8('0x48')]){_0x3ffe49[_0xf3f8('0x46')]=_[_0xf3f8('0x49')](_0x3ffe49[_0xf3f8('0x46')],{'$or':_[_0xf3f8('0x3d')](_0x3ffe49[_0xf3f8('0x42')],function(_0x27cbbb){var _0x259b99={};_0x259b99[_0x27cbbb]={'$like':'%'+_0x485f80[_0xf3f8('0x3e')][_0xf3f8('0x48')]+'%'};return _0x259b99;})});}_0x3ffe49=_[_0xf3f8('0x49')]({},_0x3ffe49,_0x485f80[_0xf3f8('0x4a')]);return _0x27ee23['getConfigurations'](_0x3ffe49);}})[_0xf3f8('0x1c')](function(_0x35bf33){if(_0x35bf33){_0x427566=_0x35bf33[_0xf3f8('0x4f')];if(!_0x485f80[_0xf3f8('0x3e')][_0xf3f8('0x43')](_0xf3f8('0x57'))){_0x3ffe49[_0xf3f8('0x2d')]=qs[_0xf3f8('0x2d')](_0x485f80[_0xf3f8('0x3e')][_0xf3f8('0x2d')]);_0x3ffe49['offset']=qs[_0xf3f8('0x2c')](_0x485f80[_0xf3f8('0x3e')]['offset']);}return _0x27ee23[_0xf3f8('0x54')](_0x3ffe49);}})[_0xf3f8('0x1c')](function(_0x1ca68a){if(_0x1ca68a){return _0x1ca68a?{'count':_0x427566,'rows':_0x1ca68a}:null;}})[_0xf3f8('0x1c')](respondWithResult(_0x45176b,null))[_0xf3f8('0x26')](handleError(_0x45176b,null));};exports[_0xf3f8('0x58')]=function(_0x225145,_0x17303a,_0x3c7f27){if(_0x225145[_0xf3f8('0x53')]['id']){delete _0x225145[_0xf3f8('0x53')]['id'];}return db[_0xf3f8('0x37')]['findOne']({'where':{'id':_0x225145[_0xf3f8('0x4d')]['id']}})[_0xf3f8('0x1c')](handleEntityNotFound(_0x17303a,null))[_0xf3f8('0x1c')](function(_0x530dd6){if(_0x530dd6){_0x225145[_0xf3f8('0x53')][_0xf3f8('0x59')]=_0x530dd6['id'];_0x225145[_0xf3f8('0x53')][_0xf3f8('0x5a')]=integrations[_0xf3f8('0x5b')](_0x225145[_0xf3f8('0x53')]['channel'],_0x225145[_0xf3f8('0x53')][_0xf3f8('0x3a')]);_0x225145[_0xf3f8('0x53')][_0xf3f8('0x5c')]=integrations[_0xf3f8('0x5d')](_0x225145['body'][_0xf3f8('0x5e')],_0x225145[_0xf3f8('0x53')][_0xf3f8('0x3a')]);return db[_0xf3f8('0x56')][_0xf3f8('0x52')](_0x225145[_0xf3f8('0x53')],{'include':[{'model':db[_0xf3f8('0x5f')],'as':_0xf3f8('0x5a')},{'model':db[_0xf3f8('0x5f')],'as':_0xf3f8('0x5c')}]});}return null;})[_0xf3f8('0x1c')](respondWithResult(_0x17303a,null))[_0xf3f8('0x26')](handleError(_0x17303a,null));};exports[_0xf3f8('0x60')]=function(_0x4471c1,_0x11898d,_0x3b51b2){var _0xa4e51f=_0x4471c1[_0xf3f8('0x3e')]['ticketType'];var _0x55da47=_0xa4e51f==='incident'?_0xf3f8('0x61'):_0xf3f8('0x62');var _0x6aaf83='';var _0x443380='';var _0x17029c='';var _0x89eaee='';var _0x328438='';var _0x26fde0='';var _0x45516e='';var _0x182bdc='';var _0x157813=[_0xf3f8('0x63'),_0xf3f8('0x64'),_0xf3f8('0x65'),_0xf3f8('0x66'),'caseorigincode',_0xf3f8('0x67'),_0xf3f8('0x68'),_0xf3f8('0x69'),_0xf3f8('0x6a'),'phonecall_activity_parties'];var _0x24cf41=[_0xf3f8('0x6b'),'accountidyominame',_0xf3f8('0x6c'),_0xf3f8('0x6d'),_0xf3f8('0x6e'),'contactidyominame',_0xf3f8('0x6f'),_0xf3f8('0x70'),_0xf3f8('0x71'),_0xf3f8('0x72'),_0xf3f8('0x73'),_0xf3f8('0x74'),'createdon',_0xf3f8('0x75'),'createdonbehalfbyyominame',_0xf3f8('0x76'),_0xf3f8('0x77'),_0xf3f8('0x78'),_0xf3f8('0x79'),_0xf3f8('0x7a'),_0xf3f8('0x7b'),_0xf3f8('0x7c'),_0xf3f8('0x7d'),_0xf3f8('0x7e'),_0xf3f8('0x7f'),_0xf3f8('0x80'),_0xf3f8('0x81'),_0xf3f8('0x82'),_0xf3f8('0x83'),'lastonholdtime',_0xf3f8('0x84'),_0xf3f8('0x85'),_0xf3f8('0x86'),_0xf3f8('0x87'),_0xf3f8('0x88'),_0xf3f8('0x89'),'modifiedonbehalfbyname',_0xf3f8('0x8a'),_0xf3f8('0x8b'),_0xf3f8('0x8c'),'numberofchildincidents',_0xf3f8('0x8d'),_0xf3f8('0x8e'),_0xf3f8('0x8f'),_0xf3f8('0x90'),_0xf3f8('0x91'),_0xf3f8('0x92'),'primarycontactidname',_0xf3f8('0x93'),_0xf3f8('0x94'),_0xf3f8('0x95'),'productserialnumber',_0xf3f8('0x96'),_0xf3f8('0x97'),_0xf3f8('0x98'),'responsiblecontactidname',_0xf3f8('0x99'),_0xf3f8('0x9a'),_0xf3f8('0x9b'),_0xf3f8('0x9c'),'socialprofileidname',_0xf3f8('0x9d'),'statuscode',_0xf3f8('0x9e'),_0xf3f8('0x9f'),_0xf3f8('0xa0'),_0xf3f8('0xa1'),_0xf3f8('0xa2'),_0xf3f8('0xa3'),'versionnumber'];var _0x38277f=_0x157813['concat'](_0x24cf41);return db[_0xf3f8('0x37')][_0xf3f8('0x55')]({'where':{'id':_0x4471c1[_0xf3f8('0x4d')]['id']},'attributes':['id',_0xf3f8('0xa4'),'password','remoteUri',_0xf3f8('0xa5'),'clientId',_0xf3f8('0xa6')]})['then'](handleEntityNotFound(_0x11898d,null))[_0xf3f8('0x1c')](function(_0x1a42e7){if(_0x1a42e7){_0x182bdc=_0x1a42e7[_0xf3f8('0xa7')];var _0x530850=_0x182bdc['slice'](-0x1);if(_0x530850==='/'){_0x182bdc=_0x182bdc[_0xf3f8('0xa8')](0x0,_0x182bdc[_0xf3f8('0xa9')](_0x530850));}_0x45516e=util['format'](_0xf3f8('0xaa'),_0x182bdc);var _0x19ad05={'method':'POST','uri':_0xf3f8('0xab')+_0x1a42e7[_0xf3f8('0xa5')]+_0xf3f8('0xac'),'form':{'client_id':_0x1a42e7[_0xf3f8('0xad')],'resource':_0x182bdc,'username':_0x1a42e7[_0xf3f8('0xa4')],'password':_0x1a42e7[_0xf3f8('0xae')],'grant_type':_0xf3f8('0xae'),'client_secret':_0x1a42e7[_0xf3f8('0xa6')]},'json':!![]};return rp(_0x19ad05);}})[_0xf3f8('0x1c')](function(_0x32ee6a){_0x26fde0=_0x32ee6a['access_token'];var _0xf5c286={'method':'GET','uri':encodeURI(_0x45516e+_0xf3f8('0xaf')+_0x55da47+'\x27'),'headers':{'Authorization':_0xf3f8('0xb0')+_0x26fde0,'If-None-Match':null,'OData-Version':_0xf3f8('0xb1')},'json':!![]};return rp(_0xf5c286);})[_0xf3f8('0x1c')](function(_0x5b01b2){var _0x5d77b7=_0x5b01b2[_0xf3f8('0xb2')][0x0];var _0x482e10=_0x5d77b7[_0xf3f8('0xb3')];var _0xc5b5e1={'method':_0xf3f8('0xb4'),'uri':_0x45516e+_0xf3f8('0xb5')+_0x482e10+_0xf3f8('0xb6'),'headers':{'Authorization':'Bearer\x20'+_0x26fde0,'If-None-Match':null,'OData-Version':_0xf3f8('0xb1')},'json':!![]};return rp(_0xc5b5e1);})[_0xf3f8('0x1c')](function(_0x39ef1f){_0x6aaf83=_0x39ef1f;_0x443380=_0x6aaf83['Attributes'];_0x443380=_['remove'](_0x443380,function(_0x13624b){return!_0x38277f[_0xf3f8('0xb7')](_0x13624b[_0xf3f8('0xb8')]);});var _0x559f4d=[];var _0x5b27bd=[];_0x443380[_0xf3f8('0xb9')](function(_0x28623c){if(_0x28623c['@odata.type']){var _0xbfdd28=_0x28623c[_0xf3f8('0xba')][_0xf3f8('0xa8')](_0x28623c[_0xf3f8('0xba')][_0xf3f8('0xa9')]('.')+0x1);if(_0xbfdd28===_0xf3f8('0xbb')){_0x559f4d[_0xf3f8('0xbc')](getSelectList(_0x45516e,_0xa4e51f,_0x5b27bd,_0x6aaf83['MetadataId'],_0x28623c[_0xf3f8('0xb3')],_0x26fde0));}}});return Promise[_0xf3f8('0xbd')](_0x559f4d);})[_0xf3f8('0x1c')](function(_0x597219){_0x17029c=_0x597219[0x0];var _0x128826=[];var _0x27b2b6=[];_0x443380[_0xf3f8('0xb9')](function(_0x28d53a){if(!_['isNil'](_0x28d53a['@odata.type'])){var _0x38aecf=_0x28d53a[_0xf3f8('0xba')][_0xf3f8('0xa8')](_0x28d53a[_0xf3f8('0xba')][_0xf3f8('0xa9')]('.')+0x1);if(_0x38aecf==='BooleanAttributeMetadata'){_0x128826[_0xf3f8('0xbc')](getBooleanList(_0x45516e,_0xa4e51f,_0x27b2b6,_0x6aaf83[_0xf3f8('0xb3')],_0x28d53a[_0xf3f8('0xb3')],_0x26fde0));}}});return Promise[_0xf3f8('0xbd')](_0x128826);})[_0xf3f8('0x1c')](function(_0x130750){_0x89eaee=_0x130750[0x0];var _0xa2f4db=[];var _0x11706c=[];_0x443380[_0xf3f8('0xb9')](function(_0x1065db){if(_0x1065db[_0xf3f8('0xba')]){var _0x29af84=_0x1065db['@odata.type']['substring'](_0x1065db[_0xf3f8('0xba')][_0xf3f8('0xa9')]('.')+0x1);if(_0x29af84===_0xf3f8('0xbe')||_0x29af84==='DoubleAttributeMetadata'||_0x29af84==='BigIntAttributeMetadata'||_0x29af84===_0xf3f8('0xbf')||_0x29af84===_0xf3f8('0xc0')||_0x29af84===_0xf3f8('0xc1')||_0x29af84==='StatusAttributeMetadata'||_0x29af84===_0xf3f8('0xc2')||_0x29af84===_0xf3f8('0xc3')||_0x29af84===_0xf3f8('0xc4')){_0xa2f4db[_0xf3f8('0xbc')](getInputList(_0x45516e,_0xa4e51f,_0x29af84,_0x11706c,_0x6aaf83[_0xf3f8('0xb3')],_0x1065db['MetadataId'],_0x26fde0));}}});return Promise['all'](_0xa2f4db);})[_0xf3f8('0x1c')](function(_0x18c6b0){_0x328438=_0x18c6b0[0x0];var _0x4d1e26=_0x17029c[_0xf3f8('0xc5')](_0x89eaee)[_0xf3f8('0xc5')](_0x328438);var _0x486250={'count':_0x4d1e26['length'],'rows':_0x4d1e26};return _0x486250;})[_0xf3f8('0x1c')](respondWithResult(_0x11898d,null))[_0xf3f8('0x26')](function(_0x131992){var _0x1b32a5=_0x4471c1[_0xf3f8('0x3e')]['test']?0x1f4:_0x131992[_0xf3f8('0xc6')]||0x1f4;logger[_0xf3f8('0x23')](_0x131992[_0xf3f8('0x33')]);delete _0x131992[_0xf3f8('0x34')];if(_0x1b32a5===0x191){_0x1b32a5=0x190;}_0x11898d[_0xf3f8('0x28')](_0x1b32a5)[_0xf3f8('0x35')](_0x4471c1[_0xf3f8('0x3e')]['test']?{'message':_0xf3f8('0xc7'),'statusCode':_0x131992[_0xf3f8('0xc6')]}:_0x131992);});};function getSelectList(_0x1c15c6,_0x24ec45,_0x5695e3,_0x132f87,_0x196fcb,_0x1c430e){var _0x1bb2a1={'method':_0xf3f8('0xb4'),'uri':_0x1c15c6+_0xf3f8('0xb5')+_0x132f87+')/Attributes('+_0x196fcb+_0xf3f8('0xc8')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x1c430e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1bb2a1)[_0xf3f8('0x1c')](function(_0x4d498c){var _0x1132b1=[];var _0x4389e4=_0x4d498c[_0xf3f8('0xc9')][_0xf3f8('0xca')];_0x4389e4[_0xf3f8('0xb9')](function(_0x1f88e3){_0x1132b1[_0xf3f8('0xbc')]({'name':_0x1f88e3[_0xf3f8('0xcb')]['UserLocalizedLabel']['Label'],'value':String(_0x1f88e3['Value'])});});var _0x4326b6={'id':_0x24ec45+'_'+_0x4d498c[_0xf3f8('0xb8')],'name':_0x4d498c[_0xf3f8('0xcc')][_0xf3f8('0xcd')]['Label'],'custom':![],'options':_0x1132b1};_0x5695e3['push'](_0x4326b6);return _0x5695e3;});}function getBooleanList(_0x3f2d67,_0x2c3702,_0x39702d,_0x22788b,_0x1f8049,_0xe69a86){var _0x50b5e2={'method':_0xf3f8('0xb4'),'uri':_0x3f2d67+_0xf3f8('0xb5')+_0x22788b+_0xf3f8('0xce')+_0x1f8049+_0xf3f8('0xcf'),'headers':{'Authorization':_0xf3f8('0xb0')+_0xe69a86,'If-None-Match':null,'OData-Version':_0xf3f8('0xb1')},'json':!![]};return rp(_0x50b5e2)[_0xf3f8('0x1c')](function(_0x2d1fd7){var _0x261466=[];_0x261466[_0xf3f8('0xbc')]({'name':_0x2d1fd7[_0xf3f8('0xc9')][_0xf3f8('0xd0')][_0xf3f8('0xcb')][_0xf3f8('0xcd')][_0xf3f8('0xcb')],'value':'true'},{'name':_0x2d1fd7['OptionSet']['FalseOption'][_0xf3f8('0xcb')][_0xf3f8('0xcd')][_0xf3f8('0xcb')],'value':_0xf3f8('0xd1')});var _0x330cf2={'id':_0x2c3702+'_'+_0x2d1fd7[_0xf3f8('0xb8')],'name':_0x2d1fd7[_0xf3f8('0xcc')]['UserLocalizedLabel'][_0xf3f8('0xcb')],'custom':![],'options':_0x261466};_0x39702d[_0xf3f8('0xbc')](_0x330cf2);return _0x39702d;});}function getInputList(_0x164032,_0x4bc9b5,_0x52ac74,_0x11f2a3,_0x4b981b,_0x3f91b9,_0x37ee3a){var _0x4de8df={'method':_0xf3f8('0xb4'),'uri':_0x164032+_0xf3f8('0xb5')+_0x4b981b+_0xf3f8('0xce')+_0x3f91b9+')/Microsoft.Dynamics.CRM.'+_0x52ac74+_0xf3f8('0xd2'),'headers':{'Authorization':_0xf3f8('0xb0')+_0x37ee3a,'If-None-Match':null,'OData-Version':_0xf3f8('0xb1')},'json':!![]};return rp(_0x4de8df)[_0xf3f8('0x1c')](function(_0x57f082){var _0x47f0b1={'id':_0x4bc9b5+'_'+_0x57f082['LogicalName'],'name':_0x57f082[_0xf3f8('0xcc')]['UserLocalizedLabel']?_0x57f082['DisplayName'][_0xf3f8('0xcd')][_0xf3f8('0xcb')]:_0x57f082[_0xf3f8('0xb8')],'custom':![],'options':[]};_0x11f2a3[_0xf3f8('0xbc')](_0x47f0b1);return _0x11f2a3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f20834f..f1ac13f 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 _0x51c5=['../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes'];(function(_0x1bff6f,_0x2e6453){var _0x43a11c=function(_0x50310a){while(--_0x50310a){_0x1bff6f['push'](_0x1bff6f['shift']());}};_0x43a11c(++_0x2e6453);}(_0x51c5,0xc8));var _0x551c=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x51c5[_0x20ef64];return _0x3707d8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x551c('0x0'))(_0x551c('0x1'));var moment=require(_0x551c('0x2'));var BPromise=require(_0x551c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x551c('0x4'));var rimraf=require(_0x551c('0x5'));var config=require(_0x551c('0x6'));var attributes=require(_0x551c('0x7'));var integrations=require(_0x551c('0x8'));module[_0x551c('0x9')]=function(_0x532235,_0x1c5309){return _0x532235[_0x551c('0xa')](_0x551c('0xb'),attributes,{'tableName':_0x551c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29e9=['../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1883ad,_0x290bef){var _0x3b1e5c=function(_0x4c0bdf){while(--_0x4c0bdf){_0x1883ad['push'](_0x1883ad['shift']());}};_0x3b1e5c(++_0x290bef);}(_0x29e9,0xaf));var _0x929e=function(_0x9a05f3,_0x1341b7){_0x9a05f3=_0x9a05f3-0x0;var _0x3e205b=_0x29e9[_0x9a05f3];return _0x3e205b;};'use strict';var _=require(_0x929e('0x0'));var util=require(_0x929e('0x1'));var logger=require('../../config/logger')(_0x929e('0x2'));var moment=require(_0x929e('0x3'));var BPromise=require(_0x929e('0x4'));var rp=require(_0x929e('0x5'));var fs=require('fs');var path=require(_0x929e('0x6'));var rimraf=require('rimraf');var config=require(_0x929e('0x7'));var attributes=require(_0x929e('0x8'));var integrations=require(_0x929e('0x9'));module[_0x929e('0xa')]=function(_0x55fa97,_0x57ed90){return _0x55fa97[_0x929e('0xb')](_0x929e('0xc'),attributes,{'tableName':_0x929e('0xd'),'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 bad77de..8c02375 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 _0x4351=['include','map','model','stringify','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetDynamics365Account','Dynamics365Account','options','where','attributes'];(function(_0x5dafc5,_0xddc028){var _0x243905=function(_0x185444){while(--_0x185444){_0x5dafc5['push'](_0x5dafc5['shift']());}};_0x243905(++_0xddc028);}(_0x4351,0x1b5));var _0x1435=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4351[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var moment=require(_0x1435('0x2'));var BPromise=require(_0x1435('0x3'));var rs=require(_0x1435('0x4'));var fs=require('fs');var Redis=require(_0x1435('0x5'));var db=require(_0x1435('0x6'))['db'];var utils=require(_0x1435('0x7'));var logger=require(_0x1435('0x8'))(_0x1435('0x9'));var config=require(_0x1435('0xa'));var jayson=require(_0x1435('0xb'));var client=jayson[_0x1435('0xc')][_0x1435('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x337fd6,_0x56ce86,_0x10760d){return new BPromise(function(_0x5de4b0,_0x4d04c7){return client[_0x1435('0xe')](_0x337fd6,_0x10760d)[_0x1435('0xf')](function(_0x14a9e1){logger[_0x1435('0x10')](_0x1435('0x11'),_0x56ce86,'request\x20sent');logger[_0x1435('0x12')](_0x1435('0x13'),_0x56ce86,'request\x20sent',JSON['stringify'](_0x14a9e1));if(_0x14a9e1[_0x1435('0x14')]){if(_0x14a9e1['error'][_0x1435('0x15')]===0x1f4){logger['error'](_0x1435('0x11'),_0x56ce86,_0x14a9e1['error']['message']);return _0x4d04c7(_0x14a9e1['error'][_0x1435('0x16')]);}logger[_0x1435('0x14')](_0x1435('0x11'),_0x56ce86,_0x14a9e1['error']['message']);return _0x5de4b0(_0x14a9e1[_0x1435('0x14')]['message']);}else{logger[_0x1435('0x10')](_0x1435('0x11'),_0x56ce86,_0x1435('0x17'));_0x5de4b0(_0x14a9e1[_0x1435('0x18')][_0x1435('0x16')]);}})[_0x1435('0x19')](function(_0x5ecd){logger[_0x1435('0x14')](_0x1435('0x11'),_0x56ce86,_0x5ecd);_0x4d04c7(_0x5ecd);});});}exports[_0x1435('0x1a')]=function(_0x430367){var _0x19c9fe=this;return new Promise(function(_0x68f503,_0xb6995b){return db[_0x1435('0x1b')]['findAll']({'raw':_0x430367[_0x1435('0x1c')]?_0x430367[_0x1435('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x430367[_0x1435('0x1c')]?_0x430367['options'][_0x1435('0x1d')]||null:null,'attributes':_0x430367[_0x1435('0x1c')]?_0x430367[_0x1435('0x1c')][_0x1435('0x1e')]||null:null,'limit':_0x430367[_0x1435('0x1c')]?_0x430367[_0x1435('0x1c')]['limit']||null:null,'include':_0x430367[_0x1435('0x1c')]?_0x430367[_0x1435('0x1c')][_0x1435('0x1f')]?_[_0x1435('0x20')](_0x430367[_0x1435('0x1c')][_0x1435('0x1f')],function(_0x302831){return{'model':db[_0x302831[_0x1435('0x21')]],'as':_0x302831['as'],'attributes':_0x302831[_0x1435('0x1e')],'include':_0x302831[_0x1435('0x1f')]?_[_0x1435('0x20')](_0x302831['include'],function(_0x523792){return{'model':db[_0x523792[_0x1435('0x21')]],'as':_0x523792['as'],'attributes':_0x523792[_0x1435('0x1e')],'include':_0x523792[_0x1435('0x1f')]?_['map'](_0x523792[_0x1435('0x1f')],function(_0x25cf29){return{'model':db[_0x25cf29[_0x1435('0x21')]],'as':_0x25cf29['as'],'attributes':_0x25cf29[_0x1435('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1435('0xf')](function(_0x5966ef){logger[_0x1435('0x10')](_0x1435('0x1a'),_0x430367);logger[_0x1435('0x12')](_0x1435('0x1a'),_0x430367,JSON[_0x1435('0x22')](_0x5966ef));_0x68f503(_0x5966ef);})[_0x1435('0x19')](function(_0x2e0e72){logger['error'](_0x1435('0x1a'),_0x2e0e72[_0x1435('0x16')],_0x430367);_0xb6995b(_0x19c9fe[_0x1435('0x14')](0x1f4,_0x2e0e72[_0x1435('0x16')]));});});};exports[_0x1435('0x23')]=function(_0x49649f){var _0x38606a=this;return new Promise(function(_0x2ed478,_0xab53ee){return db[_0x1435('0x1b')]['find']({'raw':_0x49649f[_0x1435('0x1c')]?_0x49649f[_0x1435('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x49649f[_0x1435('0x1c')]?_0x49649f['options'][_0x1435('0x1d')]||null:null,'attributes':_0x49649f[_0x1435('0x1c')]?_0x49649f['options'][_0x1435('0x1e')]||null:null,'include':_0x49649f[_0x1435('0x1c')]?_0x49649f['options']['include']?_['map'](_0x49649f[_0x1435('0x1c')]['include'],function(_0x9808e1){return{'model':db[_0x9808e1['model']],'as':_0x9808e1['as'],'attributes':_0x9808e1[_0x1435('0x1e')],'include':_0x9808e1['include']?_[_0x1435('0x20')](_0x9808e1[_0x1435('0x1f')],function(_0x249edc){return{'model':db[_0x249edc[_0x1435('0x21')]],'as':_0x249edc['as'],'attributes':_0x249edc[_0x1435('0x1e')],'include':_0x249edc[_0x1435('0x1f')]?_['map'](_0x249edc[_0x1435('0x1f')],function(_0x138597){return{'model':db[_0x138597[_0x1435('0x21')]],'as':_0x138597['as'],'attributes':_0x138597[_0x1435('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1435('0xf')](function(_0x592e22){logger[_0x1435('0x10')]('ShowDynamics365Account',_0x49649f);logger[_0x1435('0x12')](_0x1435('0x23'),_0x49649f,JSON['stringify'](_0x592e22));_0x2ed478(_0x592e22);})[_0x1435('0x19')](function(_0x2061b9){logger[_0x1435('0x14')](_0x1435('0x23'),_0x2061b9[_0x1435('0x16')],_0x49649f);_0xab53ee(_0x38606a[_0x1435('0x14')](0x1f4,_0x2061b9[_0x1435('0x16')]));});});}; \ No newline at end of file +var _0x933c=['where','attributes','limit','include','model','map','catch','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Dynamics365Account,\x20%s,\x20%s','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw'];(function(_0x430163,_0x480ce7){var _0x5867e4=function(_0x3e00c1){while(--_0x3e00c1){_0x430163['push'](_0x430163['shift']());}};_0x5867e4(++_0x480ce7);}(_0x933c,0x99));var _0xc933=function(_0x29b608,_0x883498){_0x29b608=_0x29b608-0x0;var _0x7fbece=_0x933c[_0x29b608];return _0x7fbece;};'use strict';var _=require(_0xc933('0x0'));var util=require(_0xc933('0x1'));var moment=require(_0xc933('0x2'));var BPromise=require(_0xc933('0x3'));var rs=require(_0xc933('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc933('0x5'));var logger=require(_0xc933('0x6'))(_0xc933('0x7'));var config=require(_0xc933('0x8'));var jayson=require(_0xc933('0x9'));var client=jayson[_0xc933('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xed6789,_0x505c18,_0x1f78e2){return new BPromise(function(_0xf924f4,_0x520373){return client['request'](_0xed6789,_0x1f78e2)[_0xc933('0xb')](function(_0x1ac472){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x505c18,_0xc933('0xc'));logger[_0xc933('0xd')](_0xc933('0xe'),_0x505c18,_0xc933('0xc'),JSON[_0xc933('0xf')](_0x1ac472));if(_0x1ac472[_0xc933('0x10')]){if(_0x1ac472[_0xc933('0x10')][_0xc933('0x11')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x505c18,_0x1ac472[_0xc933('0x10')][_0xc933('0x12')]);return _0x520373(_0x1ac472[_0xc933('0x10')][_0xc933('0x12')]);}logger[_0xc933('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x505c18,_0x1ac472[_0xc933('0x10')]['message']);return _0xf924f4(_0x1ac472[_0xc933('0x10')][_0xc933('0x12')]);}else{logger[_0xc933('0x13')](_0xc933('0x14'),_0x505c18,'request\x20sent');_0xf924f4(_0x1ac472[_0xc933('0x15')]['message']);}})['catch'](function(_0x776634){logger[_0xc933('0x10')](_0xc933('0x14'),_0x505c18,_0x776634);_0x520373(_0x776634);});});}exports[_0xc933('0x16')]=function(_0x1611a7){var _0x2ba124=this;return new Promise(function(_0x186b19,_0x21eca2){return db[_0xc933('0x17')][_0xc933('0x18')]({'raw':_0x1611a7['options']?_0x1611a7[_0xc933('0x19')][_0xc933('0x1a')]===undefined?!![]:![]:!![],'where':_0x1611a7[_0xc933('0x19')]?_0x1611a7[_0xc933('0x19')][_0xc933('0x1b')]||null:null,'attributes':_0x1611a7[_0xc933('0x19')]?_0x1611a7[_0xc933('0x19')][_0xc933('0x1c')]||null:null,'limit':_0x1611a7['options']?_0x1611a7[_0xc933('0x19')][_0xc933('0x1d')]||null:null,'include':_0x1611a7[_0xc933('0x19')]?_0x1611a7[_0xc933('0x19')][_0xc933('0x1e')]?_['map'](_0x1611a7[_0xc933('0x19')][_0xc933('0x1e')],function(_0x3411ce){return{'model':db[_0x3411ce[_0xc933('0x1f')]],'as':_0x3411ce['as'],'attributes':_0x3411ce[_0xc933('0x1c')],'include':_0x3411ce['include']?_[_0xc933('0x20')](_0x3411ce[_0xc933('0x1e')],function(_0x5ede22){return{'model':db[_0x5ede22['model']],'as':_0x5ede22['as'],'attributes':_0x5ede22[_0xc933('0x1c')],'include':_0x5ede22[_0xc933('0x1e')]?_[_0xc933('0x20')](_0x5ede22[_0xc933('0x1e')],function(_0x5a213c){return{'model':db[_0x5a213c[_0xc933('0x1f')]],'as':_0x5a213c['as'],'attributes':_0x5a213c[_0xc933('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a9004){logger[_0xc933('0x13')]('GetDynamics365Account',_0x1611a7);logger['debug'](_0xc933('0x16'),_0x1611a7,JSON['stringify'](_0x1a9004));_0x186b19(_0x1a9004);})[_0xc933('0x21')](function(_0xaad361){logger['error'](_0xc933('0x16'),_0xaad361[_0xc933('0x12')],_0x1611a7);_0x21eca2(_0x2ba124[_0xc933('0x10')](0x1f4,_0xaad361['message']));});});};exports[_0xc933('0x22')]=function(_0x39e652){var _0x457683=this;return new Promise(function(_0x5ab52a,_0x129af4){return db[_0xc933('0x17')][_0xc933('0x23')]({'raw':_0x39e652[_0xc933('0x19')]?_0x39e652[_0xc933('0x19')][_0xc933('0x1a')]===undefined?!![]:![]:!![],'where':_0x39e652[_0xc933('0x19')]?_0x39e652[_0xc933('0x19')][_0xc933('0x1b')]||null:null,'attributes':_0x39e652[_0xc933('0x19')]?_0x39e652['options'][_0xc933('0x1c')]||null:null,'include':_0x39e652[_0xc933('0x19')]?_0x39e652[_0xc933('0x19')][_0xc933('0x1e')]?_['map'](_0x39e652['options'][_0xc933('0x1e')],function(_0x1ff6ae){return{'model':db[_0x1ff6ae[_0xc933('0x1f')]],'as':_0x1ff6ae['as'],'attributes':_0x1ff6ae['attributes'],'include':_0x1ff6ae[_0xc933('0x1e')]?_[_0xc933('0x20')](_0x1ff6ae[_0xc933('0x1e')],function(_0x2d9dc0){return{'model':db[_0x2d9dc0[_0xc933('0x1f')]],'as':_0x2d9dc0['as'],'attributes':_0x2d9dc0[_0xc933('0x1c')],'include':_0x2d9dc0[_0xc933('0x1e')]?_[_0xc933('0x20')](_0x2d9dc0[_0xc933('0x1e')],function(_0x54dd16){return{'model':db[_0x54dd16[_0xc933('0x1f')]],'as':_0x54dd16['as'],'attributes':_0x54dd16[_0xc933('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc933('0xb')](function(_0x304ee7){logger['info'](_0xc933('0x22'),_0x39e652);logger[_0xc933('0xd')](_0xc933('0x22'),_0x39e652,JSON[_0xc933('0xf')](_0x304ee7));_0x5ab52a(_0x304ee7);})[_0xc933('0x21')](function(_0x4652fb){logger[_0xc933('0x10')](_0xc933('0x22'),_0x4652fb[_0xc933('0x12')],_0x39e652);_0x129af4(_0x457683[_0xc933('0x10')](0x1f4,_0x4652fb['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 343c5ce..256350b 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 _0x5560=['post','create','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x2baca1,_0x2f3557){var _0x9aa62a=function(_0x5c47d5){while(--_0x5c47d5){_0x2baca1['push'](_0x2baca1['shift']());}};_0x9aa62a(++_0x2f3557);}(_0x5560,0x89));var _0x0556=function(_0x4c6d86,_0x2db9e6){_0x4c6d86=_0x4c6d86-0x0;var _0x376d24=_0x5560[_0x4c6d86];return _0x376d24;};'use strict';var multer=require(_0x0556('0x0'));var util=require(_0x0556('0x1'));var path=require(_0x0556('0x2'));var timeout=require(_0x0556('0x3'));var express=require('express');var router=express[_0x0556('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0556('0x5'));var config=require('../../config/environment');var controller=require(_0x0556('0x6'));router['get']('/',auth[_0x0556('0x7')](),controller[_0x0556('0x8')]);router['get'](_0x0556('0x9'),auth[_0x0556('0x7')](),controller['show']);router[_0x0556('0xa')](_0x0556('0xb'),auth[_0x0556('0x7')](),controller[_0x0556('0xc')]);router[_0x0556('0xa')](_0x0556('0xd'),auth[_0x0556('0x7')](),controller[_0x0556('0xe')]);router['get'](_0x0556('0xf'),auth['isAuthenticated'](),controller[_0x0556('0x10')]);router[_0x0556('0x11')]('/',auth[_0x0556('0x7')](),controller[_0x0556('0x12')]);router[_0x0556('0x13')](_0x0556('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x0556('0x14')](_0x0556('0x9'),auth[_0x0556('0x7')](),controller['destroy']);module[_0x0556('0x15')]=router; \ No newline at end of file +var _0xf7dd=['/:id','getFields','/:id/subjects','/:id/descriptions','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf7dd,0x182));var _0xdf7d=function(_0x90ae4b,_0x40a3b6){_0x90ae4b=_0x90ae4b-0x0;var _0x23e212=_0xf7dd[_0x90ae4b];return _0x23e212;};'use strict';var multer=require(_0xdf7d('0x0'));var util=require(_0xdf7d('0x1'));var path=require('path');var timeout=require(_0xdf7d('0x2'));var express=require('express');var router=express[_0xdf7d('0x3')]();var auth=require(_0xdf7d('0x4'));var interaction=require(_0xdf7d('0x5'));var config=require(_0xdf7d('0x6'));var controller=require(_0xdf7d('0x7'));router[_0xdf7d('0x8')]('/',auth[_0xdf7d('0x9')](),controller['index']);router[_0xdf7d('0x8')](_0xdf7d('0xa'),auth[_0xdf7d('0x9')](),controller['show']);router[_0xdf7d('0x8')]('/:id/fields',auth[_0xdf7d('0x9')](),controller[_0xdf7d('0xb')]);router['get'](_0xdf7d('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xdf7d('0x8')](_0xdf7d('0xd'),auth[_0xdf7d('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0xdf7d('0x9')](),controller['create']);router[_0xdf7d('0xe')](_0xdf7d('0xa'),auth[_0xdf7d('0x9')](),controller[_0xdf7d('0xf')]);router['delete']('/:id',auth[_0xdf7d('0x9')](),controller[_0xdf7d('0x10')]);module[_0xdf7d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e283958..031ae63 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 _0x6c19=['phonecall','sequelize','exports','STRING','ENUM','incident'];(function(_0x32dc49,_0x112ae2){var _0x169742=function(_0x3c53d8){while(--_0x3c53d8){_0x32dc49['push'](_0x32dc49['shift']());}};_0x169742(++_0x112ae2);}(_0x6c19,0xaf));var _0x96c1=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x6c19[_0x4e9d3c];return _0x2d0825;};'use strict';var Sequelize=require(_0x96c1('0x0'));module[_0x96c1('0x1')]={'name':{'type':Sequelize[_0x96c1('0x2')]},'description':{'type':Sequelize[_0x96c1('0x2')]},'ticketType':{'type':Sequelize[_0x96c1('0x3')](_0x96c1('0x4'),_0x96c1('0x5')),'defaultValue':_0x96c1('0x4')}}; \ No newline at end of file +var _0xced4=['sequelize','STRING','ENUM','incident','phonecall'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0xced4,0xf0));var _0x4ced=function(_0x57fc2a,_0x14bbe5){_0x57fc2a=_0x57fc2a-0x0;var _0xa839b=_0xced4[_0x57fc2a];return _0xa839b;};'use strict';var Sequelize=require(_0x4ced('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4ced('0x1')]},'ticketType':{'type':Sequelize[_0x4ced('0x2')](_0x4ced('0x3'),_0x4ced('0x4')),'defaultValue':_0x4ced('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 30996f6..50c5a58 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 _0x32d4=['VIRTUAL','merge','options','includeAll','include','findAll','rows','params','create','body','find','getFields','findOne','Dynamics365Field','rawAttributes','filter','hasOwnProperty','nolimit','getSubjects','getDescriptions','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','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','save','update','destroy','stack','name','index','map','Dynamics365Configuration','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort','where','pick'];(function(_0xbf4b2f,_0x6a2f08){var _0x8a1a41=function(_0xc87def){while(--_0xc87def){_0xbf4b2f['push'](_0xbf4b2f['shift']());}};_0x8a1a41(++_0x6a2f08);}(_0x32d4,0x72));var _0x432d=function(_0x41c537,_0x146f80){_0x41c537=_0x41c537-0x0;var _0x30ad13=_0x32d4[_0x41c537];return _0x30ad13;};'use strict';var pdf=require(_0x432d('0x0'));var emlformat=require(_0x432d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x432d('0x2'));var jsonpatch=require(_0x432d('0x3'));var rp=require(_0x432d('0x4'));var moment=require(_0x432d('0x5'));var BPromise=require(_0x432d('0x6'));var Mustache=require(_0x432d('0x7'));var util=require(_0x432d('0x8'));var path=require(_0x432d('0x9'));var sox=require(_0x432d('0xa'));var csv=require(_0x432d('0xb'));var ejs=require(_0x432d('0xc'));var fs=require('fs');var _=require(_0x432d('0xd'));var squel=require(_0x432d('0xe'));var crypto=require(_0x432d('0xf'));var jsforce=require(_0x432d('0x10'));var deskjs=require(_0x432d('0x11'));var toCsv=require('to-csv');var querystring=require(_0x432d('0x12'));var Papa=require(_0x432d('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x432d('0x14'));var as=require(_0x432d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x432d('0x16'));var utils=require(_0x432d('0x17'));var config=require(_0x432d('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x432d('0x19')][_0x432d('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x59e6a6,_0x5d983b,_0x4c7cb7){if(_0x4c7cb7){var _0x118666=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x118666[_0x432d('0x1b')](_0x5d983b)){return _0x59e6a6;}else{throw new db[(_0x432d('0x1c'))][(_0x432d('0x1d'))](_0x432d('0x1e'));}}else{return _0x59e6a6;}}function respondWithRpcPromise(_0x1434a8,_0x399af4,_0xdd86e8,_0x799803){return new BPromise(function(_0x83c0a5,_0xe5c600){var _0x1c8ca2=_0x799803||client;return _0x1c8ca2[_0x432d('0x1f')](_0x1434a8,_0xdd86e8)[_0x432d('0x20')](function(_0x28c3d3){logger[_0x432d('0x21')](_0x432d('0x22'),_0x399af4,_0x432d('0x23'));logger[_0x432d('0x24')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x399af4,_0x432d('0x23'),JSON[_0x432d('0x25')](_0x28c3d3));if(_0x28c3d3[_0x432d('0x26')]){if(_0x28c3d3[_0x432d('0x26')][_0x432d('0x27')]===0x1f4){logger['error'](_0x432d('0x22'),_0x399af4,_0x28c3d3[_0x432d('0x26')][_0x432d('0x28')]);return _0xe5c600(_0x28c3d3[_0x432d('0x26')][_0x432d('0x28')]);}logger[_0x432d('0x26')](_0x432d('0x22'),_0x399af4,_0x28c3d3['error'][_0x432d('0x28')]);return _0x83c0a5(_0x28c3d3[_0x432d('0x26')][_0x432d('0x28')]);}else{logger[_0x432d('0x21')](_0x432d('0x22'),_0x399af4,_0x432d('0x23'));_0x83c0a5(_0x28c3d3[_0x432d('0x29')]['message']);}})[_0x432d('0x2a')](function(_0x17e8f3){logger[_0x432d('0x26')](_0x432d('0x22'),_0x399af4,_0x17e8f3);_0xe5c600(_0x17e8f3);});});}function respondWithStatusCode(_0x1a74da,_0x26094b){_0x26094b=_0x26094b||0xcc;return function(_0x35eda6){if(_0x35eda6){return _0x1a74da[_0x432d('0x2b')](_0x26094b);}return _0x1a74da[_0x432d('0x2c')](_0x26094b)[_0x432d('0x2d')]();};}function respondWithResult(_0x4c7692,_0x3803db){_0x3803db=_0x3803db||0xc8;return function(_0xb799ae){if(_0xb799ae){return _0x4c7692['status'](_0x3803db)['json'](_0xb799ae);}};}function respondWithFilteredResult(_0x147856,_0x5b84f6){return function(_0x5b809f){if(_0x5b809f){var _0x273f26=_0x5b809f[_0x432d('0x2e')],_0x3c6feb=_0x5b84f6[_0x432d('0x2f')],_0xc14dda=_0x5b84f6[_0x432d('0x2f')]+_0x5b84f6[_0x432d('0x30')],_0x5e57c1;if(_0xc14dda>=_0x273f26){_0xc14dda=_0x273f26;_0x5e57c1=0xc8;}else{_0x5e57c1=0xce;}_0x147856[_0x432d('0x2c')](_0x5e57c1);return _0x147856[_0x432d('0x31')](_0x432d('0x32'),_0x3c6feb+'-'+_0xc14dda+'/'+_0x273f26)['json'](_0x5b809f);}return null;};}function patchUpdates(_0x440ea9){return function(_0xa60e69){try{jsonpatch['apply'](_0xa60e69,_0x440ea9,!![]);}catch(_0x3a5881){return BPromise['reject'](_0x3a5881);}return _0xa60e69[_0x432d('0x33')]();};}function saveUpdates(_0x4fc4df,_0x4ba15f){return function(_0x489a2d){if(_0x489a2d){return _0x489a2d[_0x432d('0x34')](_0x4fc4df)[_0x432d('0x20')](function(_0xd7c8af){return _0xd7c8af;});}return null;};}function removeEntity(_0x457d6d,_0xae22d0){return function(_0x1a53e5){if(_0x1a53e5){return _0x1a53e5[_0x432d('0x35')]()['then'](function(){_0x457d6d['status'](0xcc)[_0x432d('0x2d')]();});}};}function handleEntityNotFound(_0x323e8a,_0x4fe4b7){return function(_0x157758){if(!_0x157758){_0x323e8a[_0x432d('0x2b')](0x194);}return _0x157758;};}function handleError(_0x33f1b2,_0x241aea){_0x241aea=_0x241aea||0x1f4;return function(_0x131a5f){logger[_0x432d('0x26')](_0x131a5f[_0x432d('0x36')]);if(_0x131a5f['name']){delete _0x131a5f[_0x432d('0x37')];}_0x33f1b2[_0x432d('0x2c')](_0x241aea)['send'](_0x131a5f);};}exports[_0x432d('0x38')]=function(_0x14122b,_0x16df8d){var _0x5ef636={},_0x5f3e44={},_0x2a9113={'count':0x0,'rows':[]};var _0x2acab9=_[_0x432d('0x39')](db[_0x432d('0x3a')]['rawAttributes'],function(_0x52544c){return{'name':_0x52544c[_0x432d('0x3b')],'type':_0x52544c[_0x432d('0x3c')][_0x432d('0x3d')]};});_0x5f3e44[_0x432d('0x3e')]=_[_0x432d('0x39')](_0x2acab9,_0x432d('0x37'));_0x5f3e44['query']=_[_0x432d('0x3f')](_0x14122b[_0x432d('0x40')]);_0x5f3e44[_0x432d('0x41')]=_['intersection'](_0x5f3e44[_0x432d('0x3e')],_0x5f3e44[_0x432d('0x40')]);_0x5ef636[_0x432d('0x42')]=_[_0x432d('0x43')](_0x5f3e44['model'],qs['fields'](_0x14122b[_0x432d('0x40')][_0x432d('0x44')]));_0x5ef636[_0x432d('0x42')]=_0x5ef636[_0x432d('0x42')][_0x432d('0x45')]?_0x5ef636['attributes']:_0x5f3e44[_0x432d('0x3e')];if(!_0x14122b[_0x432d('0x40')]['hasOwnProperty']('nolimit')){_0x5ef636[_0x432d('0x30')]=qs[_0x432d('0x30')](_0x14122b[_0x432d('0x40')][_0x432d('0x30')]);_0x5ef636[_0x432d('0x2f')]=qs[_0x432d('0x2f')](_0x14122b['query'][_0x432d('0x2f')]);}_0x5ef636[_0x432d('0x46')]=qs[_0x432d('0x47')](_0x14122b['query'][_0x432d('0x47')]);_0x5ef636[_0x432d('0x48')]=qs[_0x432d('0x41')](_[_0x432d('0x49')](_0x14122b[_0x432d('0x40')],_0x5f3e44[_0x432d('0x41')]),_0x2acab9);if(_0x14122b['query']['filter']){_0x5ef636[_0x432d('0x48')]=_['merge'](_0x5ef636[_0x432d('0x48')],{'$or':_['map'](_0x2acab9,function(_0xdaaf6f){if(_0xdaaf6f[_0x432d('0x3c')]!==_0x432d('0x4a')){var _0x5c8b75={};_0x5c8b75[_0xdaaf6f['name']]={'$like':'%'+_0x14122b[_0x432d('0x40')]['filter']+'%'};return _0x5c8b75;}})});}_0x5ef636=_[_0x432d('0x4b')]({},_0x5ef636,_0x14122b[_0x432d('0x4c')]);var _0x48a4df={'where':_0x5ef636[_0x432d('0x48')]};return db[_0x432d('0x3a')][_0x432d('0x2e')](_0x48a4df)[_0x432d('0x20')](function(_0xac7532){_0x2a9113[_0x432d('0x2e')]=_0xac7532;if(_0x14122b[_0x432d('0x40')][_0x432d('0x4d')]){_0x5ef636[_0x432d('0x4e')]=[{'all':!![]}];}return db[_0x432d('0x3a')][_0x432d('0x4f')](_0x5ef636);})['then'](function(_0x20b5d0){_0x2a9113[_0x432d('0x50')]=_0x20b5d0;return _0x2a9113;})[_0x432d('0x20')](respondWithFilteredResult(_0x16df8d,_0x5ef636))[_0x432d('0x2a')](handleError(_0x16df8d,null));};exports['show']=function(_0x15fe69,_0x4decd0){var _0x27716e={'raw':![],'where':{'id':_0x15fe69[_0x432d('0x51')]['id']}},_0xfcaff3={};_0xfcaff3[_0x432d('0x3e')]=_['keys'](db[_0x432d('0x3a')]['rawAttributes']);_0xfcaff3[_0x432d('0x40')]=_[_0x432d('0x3f')](_0x15fe69[_0x432d('0x40')]);_0xfcaff3[_0x432d('0x41')]=_['intersection'](_0xfcaff3['model'],_0xfcaff3[_0x432d('0x40')]);_0x27716e['attributes']=_[_0x432d('0x43')](_0xfcaff3['model'],qs[_0x432d('0x44')](_0x15fe69['query'][_0x432d('0x44')]));_0x27716e[_0x432d('0x42')]=_0x27716e[_0x432d('0x42')][_0x432d('0x45')]?_0x27716e[_0x432d('0x42')]:_0xfcaff3[_0x432d('0x3e')];if(_0x15fe69['query'][_0x432d('0x4d')]){_0x27716e['include']=[{'all':!![]}];}_0x27716e=_[_0x432d('0x4b')]({},_0x27716e,_0x15fe69[_0x432d('0x4c')]);return db[_0x432d('0x3a')]['find'](_0x27716e)[_0x432d('0x20')](handleEntityNotFound(_0x4decd0,null))[_0x432d('0x20')](respondWithResult(_0x4decd0,null))[_0x432d('0x2a')](handleError(_0x4decd0,null));};exports[_0x432d('0x52')]=function(_0x741ad,_0x13a36d){return db['Dynamics365Configuration'][_0x432d('0x52')](_0x741ad['body'],{})[_0x432d('0x20')](respondWithResult(_0x13a36d,0xc9))[_0x432d('0x2a')](handleError(_0x13a36d,null));};exports[_0x432d('0x34')]=function(_0x5f1f81,_0x344aaa){if(_0x5f1f81[_0x432d('0x53')]['id']){delete _0x5f1f81['body']['id'];}return db[_0x432d('0x3a')][_0x432d('0x54')]({'where':{'id':_0x5f1f81['params']['id']}})[_0x432d('0x20')](handleEntityNotFound(_0x344aaa,null))['then'](saveUpdates(_0x5f1f81['body'],null))[_0x432d('0x20')](respondWithResult(_0x344aaa,null))[_0x432d('0x2a')](handleError(_0x344aaa,null));};exports[_0x432d('0x35')]=function(_0x16ecfb,_0x2c40a6){return db['Dynamics365Configuration'][_0x432d('0x54')]({'where':{'id':_0x16ecfb[_0x432d('0x51')]['id']}})['then'](handleEntityNotFound(_0x2c40a6,null))[_0x432d('0x20')](removeEntity(_0x2c40a6,null))['catch'](handleError(_0x2c40a6,null));};exports[_0x432d('0x55')]=function(_0x2a3d5c,_0x47c906,_0x57da05){var _0x149ce4={};var _0x13e6a7={};var _0x2981ea;var _0x5ba5b1;return db[_0x432d('0x3a')][_0x432d('0x56')]({'where':{'id':_0x2a3d5c[_0x432d('0x51')]['id']}})[_0x432d('0x20')](handleEntityNotFound(_0x47c906,null))[_0x432d('0x20')](function(_0x4caf17){if(_0x4caf17){_0x2981ea=_0x4caf17;_0x13e6a7[_0x432d('0x3e')]=_[_0x432d('0x3f')](db[_0x432d('0x57')][_0x432d('0x58')]);_0x13e6a7[_0x432d('0x40')]=_['keys'](_0x2a3d5c[_0x432d('0x40')]);_0x13e6a7[_0x432d('0x41')]=_['intersection'](_0x13e6a7[_0x432d('0x3e')],_0x13e6a7[_0x432d('0x40')]);_0x149ce4[_0x432d('0x42')]=_['intersection'](_0x13e6a7[_0x432d('0x3e')],qs[_0x432d('0x44')](_0x2a3d5c[_0x432d('0x40')][_0x432d('0x44')]));_0x149ce4['attributes']=_0x149ce4['attributes'][_0x432d('0x45')]?_0x149ce4[_0x432d('0x42')]:_0x13e6a7['model'];_0x149ce4[_0x432d('0x46')]=qs[_0x432d('0x47')](_0x2a3d5c[_0x432d('0x40')][_0x432d('0x47')]);_0x149ce4['where']=qs[_0x432d('0x41')](_[_0x432d('0x49')](_0x2a3d5c[_0x432d('0x40')],_0x13e6a7[_0x432d('0x41')]));if(_0x2a3d5c[_0x432d('0x40')][_0x432d('0x59')]){_0x149ce4[_0x432d('0x48')]=_[_0x432d('0x4b')](_0x149ce4[_0x432d('0x48')],{'$or':_[_0x432d('0x39')](_0x149ce4[_0x432d('0x42')],function(_0x893d46){var _0x2cdadf={};_0x2cdadf[_0x893d46]={'$like':'%'+_0x2a3d5c[_0x432d('0x40')][_0x432d('0x59')]+'%'};return _0x2cdadf;})});}_0x149ce4=_[_0x432d('0x4b')]({},_0x149ce4,_0x2a3d5c['options']);return _0x2981ea[_0x432d('0x55')](_0x149ce4);}})[_0x432d('0x20')](function(_0x51835c){if(_0x51835c){_0x5ba5b1=_0x51835c[_0x432d('0x45')];if(!_0x2a3d5c[_0x432d('0x40')][_0x432d('0x5a')](_0x432d('0x5b'))){_0x149ce4[_0x432d('0x30')]=qs[_0x432d('0x30')](_0x2a3d5c['query'][_0x432d('0x30')]);_0x149ce4[_0x432d('0x2f')]=qs['offset'](_0x2a3d5c[_0x432d('0x40')][_0x432d('0x2f')]);}return _0x2981ea[_0x432d('0x55')](_0x149ce4);}})[_0x432d('0x20')](function(_0x41a89c){if(_0x41a89c){return _0x41a89c?{'count':_0x5ba5b1,'rows':_0x41a89c}:null;}})[_0x432d('0x20')](respondWithResult(_0x47c906,null))[_0x432d('0x2a')](handleError(_0x47c906,null));};exports[_0x432d('0x5c')]=function(_0x35e652,_0xe05886,_0x1e70d2){var _0x894b0a={};var _0x4588f4={};var _0x2d6a0c;var _0x12423e;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x35e652[_0x432d('0x51')]['id']}})[_0x432d('0x20')](handleEntityNotFound(_0xe05886,null))[_0x432d('0x20')](function(_0x455823){if(_0x455823){_0x2d6a0c=_0x455823;_0x4588f4[_0x432d('0x3e')]=_[_0x432d('0x3f')](db[_0x432d('0x57')][_0x432d('0x58')]);_0x4588f4[_0x432d('0x40')]=_['keys'](_0x35e652[_0x432d('0x40')]);_0x4588f4[_0x432d('0x41')]=_[_0x432d('0x43')](_0x4588f4[_0x432d('0x3e')],_0x4588f4[_0x432d('0x40')]);_0x894b0a[_0x432d('0x42')]=_[_0x432d('0x43')](_0x4588f4[_0x432d('0x3e')],qs[_0x432d('0x44')](_0x35e652[_0x432d('0x40')]['fields']));_0x894b0a['attributes']=_0x894b0a['attributes'][_0x432d('0x45')]?_0x894b0a[_0x432d('0x42')]:_0x4588f4[_0x432d('0x3e')];_0x894b0a[_0x432d('0x46')]=qs['sort'](_0x35e652[_0x432d('0x40')][_0x432d('0x47')]);_0x894b0a[_0x432d('0x48')]=qs[_0x432d('0x41')](_[_0x432d('0x49')](_0x35e652[_0x432d('0x40')],_0x4588f4[_0x432d('0x41')]));if(_0x35e652[_0x432d('0x40')][_0x432d('0x59')]){_0x894b0a['where']=_[_0x432d('0x4b')](_0x894b0a[_0x432d('0x48')],{'$or':_['map'](_0x894b0a[_0x432d('0x42')],function(_0x8502e){var _0xd56c1b={};_0xd56c1b[_0x8502e]={'$like':'%'+_0x35e652['query'][_0x432d('0x59')]+'%'};return _0xd56c1b;})});}_0x894b0a=_[_0x432d('0x4b')]({},_0x894b0a,_0x35e652[_0x432d('0x4c')]);return _0x2d6a0c[_0x432d('0x5c')](_0x894b0a);}})['then'](function(_0x51b465){if(_0x51b465){_0x12423e=_0x51b465[_0x432d('0x45')];if(!_0x35e652[_0x432d('0x40')]['hasOwnProperty'](_0x432d('0x5b'))){_0x894b0a[_0x432d('0x30')]=qs[_0x432d('0x30')](_0x35e652[_0x432d('0x40')][_0x432d('0x30')]);_0x894b0a[_0x432d('0x2f')]=qs['offset'](_0x35e652[_0x432d('0x40')]['offset']);}return _0x2d6a0c[_0x432d('0x5c')](_0x894b0a);}})[_0x432d('0x20')](function(_0x102905){if(_0x102905){return _0x102905?{'count':_0x12423e,'rows':_0x102905}:null;}})['then'](respondWithResult(_0xe05886,null))['catch'](handleError(_0xe05886,null));};exports[_0x432d('0x5d')]=function(_0x8c3c6c,_0x25bcab,_0x4ade98){var _0x4f4c56={};var _0x35ad9f={};var _0x74f228;var _0x5819a3;return db[_0x432d('0x3a')][_0x432d('0x56')]({'where':{'id':_0x8c3c6c['params']['id']}})[_0x432d('0x20')](handleEntityNotFound(_0x25bcab,null))[_0x432d('0x20')](function(_0x224f5c){if(_0x224f5c){_0x74f228=_0x224f5c;_0x35ad9f['model']=_[_0x432d('0x3f')](db[_0x432d('0x57')][_0x432d('0x58')]);_0x35ad9f[_0x432d('0x40')]=_[_0x432d('0x3f')](_0x8c3c6c[_0x432d('0x40')]);_0x35ad9f[_0x432d('0x41')]=_[_0x432d('0x43')](_0x35ad9f[_0x432d('0x3e')],_0x35ad9f[_0x432d('0x40')]);_0x4f4c56[_0x432d('0x42')]=_[_0x432d('0x43')](_0x35ad9f[_0x432d('0x3e')],qs[_0x432d('0x44')](_0x8c3c6c[_0x432d('0x40')][_0x432d('0x44')]));_0x4f4c56[_0x432d('0x42')]=_0x4f4c56[_0x432d('0x42')][_0x432d('0x45')]?_0x4f4c56['attributes']:_0x35ad9f[_0x432d('0x3e')];_0x4f4c56[_0x432d('0x46')]=qs['sort'](_0x8c3c6c[_0x432d('0x40')][_0x432d('0x47')]);_0x4f4c56[_0x432d('0x48')]=qs[_0x432d('0x41')](_[_0x432d('0x49')](_0x8c3c6c[_0x432d('0x40')],_0x35ad9f[_0x432d('0x41')]));if(_0x8c3c6c[_0x432d('0x40')][_0x432d('0x59')]){_0x4f4c56['where']=_['merge'](_0x4f4c56[_0x432d('0x48')],{'$or':_[_0x432d('0x39')](_0x4f4c56[_0x432d('0x42')],function(_0x71d057){var _0x4aec0c={};_0x4aec0c[_0x71d057]={'$like':'%'+_0x8c3c6c['query'][_0x432d('0x59')]+'%'};return _0x4aec0c;})});}_0x4f4c56=_[_0x432d('0x4b')]({},_0x4f4c56,_0x8c3c6c[_0x432d('0x4c')]);return _0x74f228[_0x432d('0x5d')](_0x4f4c56);}})[_0x432d('0x20')](function(_0x34fdca){if(_0x34fdca){_0x5819a3=_0x34fdca[_0x432d('0x45')];if(!_0x8c3c6c[_0x432d('0x40')][_0x432d('0x5a')](_0x432d('0x5b'))){_0x4f4c56[_0x432d('0x30')]=qs['limit'](_0x8c3c6c['query'][_0x432d('0x30')]);_0x4f4c56['offset']=qs['offset'](_0x8c3c6c['query'][_0x432d('0x2f')]);}return _0x74f228[_0x432d('0x5d')](_0x4f4c56);}})[_0x432d('0x20')](function(_0x531f3e){if(_0x531f3e){return _0x531f3e?{'count':_0x5819a3,'rows':_0x531f3e}:null;}})[_0x432d('0x20')](respondWithResult(_0x25bcab,null))[_0x432d('0x2a')](handleError(_0x25bcab,null));}; \ No newline at end of file +var _0x5870=['sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','getFields','findOne','Dynamics365Field','length','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x480689,_0x1c6e02){var _0x22905f=function(_0x7a2a61){while(--_0x7a2a61){_0x480689['push'](_0x480689['shift']());}};_0x22905f(++_0x1c6e02);}(_0x5870,0x14b));var _0x0587=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x5870[_0x45f951];return _0x24756c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0587('0x0'));var rimraf=require(_0x0587('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0587('0x2'));var rp=require(_0x0587('0x3'));var moment=require(_0x0587('0x4'));var BPromise=require(_0x0587('0x5'));var Mustache=require(_0x0587('0x6'));var util=require('util');var path=require(_0x0587('0x7'));var sox=require(_0x0587('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0587('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0587('0xa'));var toCsv=require(_0x0587('0xb'));var querystring=require(_0x0587('0xc'));var Papa=require(_0x0587('0xd'));var Redis=require(_0x0587('0xe'));var authService=require(_0x0587('0xf'));var qs=require(_0x0587('0x10'));var as=require(_0x0587('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0587('0x12'));var config=require(_0x0587('0x13'));var db=require(_0x0587('0x14'))['db'];var jayson=require(_0x0587('0x15'));var client=jayson[_0x0587('0x16')][_0x0587('0x17')]({'port':0x232a});function checkPasswordPattern(_0x482e6d,_0x28b80f,_0x25c6b3){if(_0x25c6b3){var _0xc21110=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc21110[_0x0587('0x18')](_0x28b80f)){return _0x482e6d;}else{throw new db['Sequelize'][(_0x0587('0x19'))](_0x0587('0x1a'));}}else{return _0x482e6d;}}function respondWithRpcPromise(_0x26f08b,_0x4c7f0b,_0x518ddc,_0x15d1cd){return new BPromise(function(_0x15582a,_0x95bf15){var _0x10b615=_0x15d1cd||client;return _0x10b615['request'](_0x26f08b,_0x518ddc)[_0x0587('0x1b')](function(_0x3eda91){logger[_0x0587('0x1c')](_0x0587('0x1d'),_0x4c7f0b,'request\x20sent');logger[_0x0587('0x1e')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4c7f0b,_0x0587('0x1f'),JSON[_0x0587('0x20')](_0x3eda91));if(_0x3eda91[_0x0587('0x21')]){if(_0x3eda91[_0x0587('0x21')][_0x0587('0x22')]===0x1f4){logger[_0x0587('0x21')](_0x0587('0x1d'),_0x4c7f0b,_0x3eda91[_0x0587('0x21')][_0x0587('0x23')]);return _0x95bf15(_0x3eda91[_0x0587('0x21')][_0x0587('0x23')]);}logger[_0x0587('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4c7f0b,_0x3eda91[_0x0587('0x21')]['message']);return _0x15582a(_0x3eda91[_0x0587('0x21')]['message']);}else{logger[_0x0587('0x1c')](_0x0587('0x1d'),_0x4c7f0b,_0x0587('0x1f'));_0x15582a(_0x3eda91[_0x0587('0x24')]['message']);}})['catch'](function(_0x4f4c46){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4c7f0b,_0x4f4c46);_0x95bf15(_0x4f4c46);});});}function respondWithStatusCode(_0x464659,_0x608c57){_0x608c57=_0x608c57||0xcc;return function(_0x569b36){if(_0x569b36){return _0x464659[_0x0587('0x25')](_0x608c57);}return _0x464659[_0x0587('0x26')](_0x608c57)['end']();};}function respondWithResult(_0x33fb47,_0x42b48a){_0x42b48a=_0x42b48a||0xc8;return function(_0x4fa879){if(_0x4fa879){return _0x33fb47['status'](_0x42b48a)[_0x0587('0x27')](_0x4fa879);}};}function respondWithFilteredResult(_0x3e1c0d,_0x297539){return function(_0x40044f){if(_0x40044f){var _0x488046=_0x40044f[_0x0587('0x28')],_0x19b2f0=_0x297539[_0x0587('0x29')],_0x547b36=_0x297539[_0x0587('0x29')]+_0x297539[_0x0587('0x2a')],_0x43d02d;if(_0x547b36>=_0x488046){_0x547b36=_0x488046;_0x43d02d=0xc8;}else{_0x43d02d=0xce;}_0x3e1c0d[_0x0587('0x26')](_0x43d02d);return _0x3e1c0d[_0x0587('0x2b')]('Content-Range',_0x19b2f0+'-'+_0x547b36+'/'+_0x488046)[_0x0587('0x27')](_0x40044f);}return null;};}function patchUpdates(_0x28b747){return function(_0x4cc21a){try{jsonpatch[_0x0587('0x2c')](_0x4cc21a,_0x28b747,!![]);}catch(_0x2e19d7){return BPromise[_0x0587('0x2d')](_0x2e19d7);}return _0x4cc21a[_0x0587('0x2e')]();};}function saveUpdates(_0x51f6bd,_0x5d8974){return function(_0x2b0b05){if(_0x2b0b05){return _0x2b0b05[_0x0587('0x2f')](_0x51f6bd)[_0x0587('0x1b')](function(_0xf5c933){return _0xf5c933;});}return null;};}function removeEntity(_0x13d0df,_0x35a790){return function(_0x4dd4b0){if(_0x4dd4b0){return _0x4dd4b0[_0x0587('0x30')]()[_0x0587('0x1b')](function(){_0x13d0df[_0x0587('0x26')](0xcc)[_0x0587('0x31')]();});}};}function handleEntityNotFound(_0x3dd6b7,_0x41e45c){return function(_0x4b0c60){if(!_0x4b0c60){_0x3dd6b7[_0x0587('0x25')](0x194);}return _0x4b0c60;};}function handleError(_0xa15e10,_0x3a7b52){_0x3a7b52=_0x3a7b52||0x1f4;return function(_0x4c74e9){logger['error'](_0x4c74e9[_0x0587('0x32')]);if(_0x4c74e9['name']){delete _0x4c74e9[_0x0587('0x33')];}_0xa15e10[_0x0587('0x26')](_0x3a7b52)[_0x0587('0x34')](_0x4c74e9);};}exports[_0x0587('0x35')]=function(_0x326e30,_0x42598e){var _0x51a426={},_0x56dfbc={},_0x2dc4e6={'count':0x0,'rows':[]};var _0x352e86=_[_0x0587('0x36')](db[_0x0587('0x37')][_0x0587('0x38')],function(_0x1b0025){return{'name':_0x1b0025[_0x0587('0x39')],'type':_0x1b0025[_0x0587('0x3a')][_0x0587('0x3b')]};});_0x56dfbc[_0x0587('0x3c')]=_[_0x0587('0x36')](_0x352e86,_0x0587('0x33'));_0x56dfbc[_0x0587('0x3d')]=_['keys'](_0x326e30[_0x0587('0x3d')]);_0x56dfbc[_0x0587('0x3e')]=_[_0x0587('0x3f')](_0x56dfbc['model'],_0x56dfbc[_0x0587('0x3d')]);_0x51a426[_0x0587('0x40')]=_[_0x0587('0x3f')](_0x56dfbc[_0x0587('0x3c')],qs['fields'](_0x326e30['query'][_0x0587('0x41')]));_0x51a426[_0x0587('0x40')]=_0x51a426[_0x0587('0x40')]['length']?_0x51a426[_0x0587('0x40')]:_0x56dfbc[_0x0587('0x3c')];if(!_0x326e30[_0x0587('0x3d')]['hasOwnProperty'](_0x0587('0x42'))){_0x51a426[_0x0587('0x2a')]=qs[_0x0587('0x2a')](_0x326e30[_0x0587('0x3d')][_0x0587('0x2a')]);_0x51a426[_0x0587('0x29')]=qs['offset'](_0x326e30[_0x0587('0x3d')][_0x0587('0x29')]);}_0x51a426['order']=qs[_0x0587('0x43')](_0x326e30[_0x0587('0x3d')][_0x0587('0x43')]);_0x51a426[_0x0587('0x44')]=qs[_0x0587('0x3e')](_[_0x0587('0x45')](_0x326e30[_0x0587('0x3d')],_0x56dfbc[_0x0587('0x3e')]),_0x352e86);if(_0x326e30[_0x0587('0x3d')][_0x0587('0x46')]){_0x51a426[_0x0587('0x44')]=_[_0x0587('0x47')](_0x51a426[_0x0587('0x44')],{'$or':_[_0x0587('0x36')](_0x352e86,function(_0x4b622d){if(_0x4b622d[_0x0587('0x3a')]!==_0x0587('0x48')){var _0x5d1368={};_0x5d1368[_0x4b622d[_0x0587('0x33')]]={'$like':'%'+_0x326e30[_0x0587('0x3d')][_0x0587('0x46')]+'%'};return _0x5d1368;}})});}_0x51a426=_[_0x0587('0x47')]({},_0x51a426,_0x326e30[_0x0587('0x49')]);var _0xe58bec={'where':_0x51a426[_0x0587('0x44')]};return db[_0x0587('0x37')][_0x0587('0x28')](_0xe58bec)['then'](function(_0x4bec7d){_0x2dc4e6[_0x0587('0x28')]=_0x4bec7d;if(_0x326e30[_0x0587('0x3d')][_0x0587('0x4a')]){_0x51a426[_0x0587('0x4b')]=[{'all':!![]}];}return db[_0x0587('0x37')]['findAll'](_0x51a426);})[_0x0587('0x1b')](function(_0x48167e){_0x2dc4e6[_0x0587('0x4c')]=_0x48167e;return _0x2dc4e6;})[_0x0587('0x1b')](respondWithFilteredResult(_0x42598e,_0x51a426))[_0x0587('0x4d')](handleError(_0x42598e,null));};exports[_0x0587('0x4e')]=function(_0x209bca,_0x15f999){var _0x2ae8cd={'raw':![],'where':{'id':_0x209bca[_0x0587('0x4f')]['id']}},_0x2c07f8={};_0x2c07f8[_0x0587('0x3c')]=_[_0x0587('0x50')](db[_0x0587('0x37')][_0x0587('0x38')]);_0x2c07f8[_0x0587('0x3d')]=_[_0x0587('0x50')](_0x209bca[_0x0587('0x3d')]);_0x2c07f8[_0x0587('0x3e')]=_['intersection'](_0x2c07f8[_0x0587('0x3c')],_0x2c07f8[_0x0587('0x3d')]);_0x2ae8cd[_0x0587('0x40')]=_['intersection'](_0x2c07f8[_0x0587('0x3c')],qs[_0x0587('0x41')](_0x209bca['query'][_0x0587('0x41')]));_0x2ae8cd[_0x0587('0x40')]=_0x2ae8cd['attributes']['length']?_0x2ae8cd[_0x0587('0x40')]:_0x2c07f8[_0x0587('0x3c')];if(_0x209bca[_0x0587('0x3d')]['includeAll']){_0x2ae8cd[_0x0587('0x4b')]=[{'all':!![]}];}_0x2ae8cd=_[_0x0587('0x47')]({},_0x2ae8cd,_0x209bca[_0x0587('0x49')]);return db[_0x0587('0x37')][_0x0587('0x51')](_0x2ae8cd)[_0x0587('0x1b')](handleEntityNotFound(_0x15f999,null))['then'](respondWithResult(_0x15f999,null))[_0x0587('0x4d')](handleError(_0x15f999,null));};exports[_0x0587('0x52')]=function(_0x49ccfb,_0x13bcd5){return db[_0x0587('0x37')][_0x0587('0x52')](_0x49ccfb['body'],{})['then'](respondWithResult(_0x13bcd5,0xc9))[_0x0587('0x4d')](handleError(_0x13bcd5,null));};exports['update']=function(_0x2dfc7c,_0x4ea5f6){if(_0x2dfc7c[_0x0587('0x53')]['id']){delete _0x2dfc7c[_0x0587('0x53')]['id'];}return db[_0x0587('0x37')][_0x0587('0x51')]({'where':{'id':_0x2dfc7c['params']['id']}})[_0x0587('0x1b')](handleEntityNotFound(_0x4ea5f6,null))[_0x0587('0x1b')](saveUpdates(_0x2dfc7c[_0x0587('0x53')],null))[_0x0587('0x1b')](respondWithResult(_0x4ea5f6,null))[_0x0587('0x4d')](handleError(_0x4ea5f6,null));};exports['destroy']=function(_0x402a05,_0x4873b8){return db['Dynamics365Configuration'][_0x0587('0x51')]({'where':{'id':_0x402a05['params']['id']}})['then'](handleEntityNotFound(_0x4873b8,null))['then'](removeEntity(_0x4873b8,null))[_0x0587('0x4d')](handleError(_0x4873b8,null));};exports[_0x0587('0x54')]=function(_0x1f5b6e,_0x1144d3,_0x52fdf7){var _0x35f3a6={};var _0x23627b={};var _0x45a08a;var _0x80a8a6;return db[_0x0587('0x37')][_0x0587('0x55')]({'where':{'id':_0x1f5b6e['params']['id']}})[_0x0587('0x1b')](handleEntityNotFound(_0x1144d3,null))[_0x0587('0x1b')](function(_0x5e3ecb){if(_0x5e3ecb){_0x45a08a=_0x5e3ecb;_0x23627b[_0x0587('0x3c')]=_[_0x0587('0x50')](db[_0x0587('0x56')]['rawAttributes']);_0x23627b[_0x0587('0x3d')]=_[_0x0587('0x50')](_0x1f5b6e['query']);_0x23627b['filters']=_['intersection'](_0x23627b[_0x0587('0x3c')],_0x23627b['query']);_0x35f3a6[_0x0587('0x40')]=_[_0x0587('0x3f')](_0x23627b[_0x0587('0x3c')],qs[_0x0587('0x41')](_0x1f5b6e[_0x0587('0x3d')][_0x0587('0x41')]));_0x35f3a6[_0x0587('0x40')]=_0x35f3a6[_0x0587('0x40')][_0x0587('0x57')]?_0x35f3a6[_0x0587('0x40')]:_0x23627b[_0x0587('0x3c')];_0x35f3a6[_0x0587('0x58')]=qs[_0x0587('0x43')](_0x1f5b6e[_0x0587('0x3d')][_0x0587('0x43')]);_0x35f3a6[_0x0587('0x44')]=qs[_0x0587('0x3e')](_['pick'](_0x1f5b6e[_0x0587('0x3d')],_0x23627b[_0x0587('0x3e')]));if(_0x1f5b6e[_0x0587('0x3d')][_0x0587('0x46')]){_0x35f3a6[_0x0587('0x44')]=_[_0x0587('0x47')](_0x35f3a6[_0x0587('0x44')],{'$or':_[_0x0587('0x36')](_0x35f3a6[_0x0587('0x40')],function(_0xe76db){var _0x388ab0={};_0x388ab0[_0xe76db]={'$like':'%'+_0x1f5b6e['query'][_0x0587('0x46')]+'%'};return _0x388ab0;})});}_0x35f3a6=_[_0x0587('0x47')]({},_0x35f3a6,_0x1f5b6e[_0x0587('0x49')]);return _0x45a08a['getFields'](_0x35f3a6);}})[_0x0587('0x1b')](function(_0x578dfd){if(_0x578dfd){_0x80a8a6=_0x578dfd[_0x0587('0x57')];if(!_0x1f5b6e[_0x0587('0x3d')][_0x0587('0x59')]('nolimit')){_0x35f3a6[_0x0587('0x2a')]=qs[_0x0587('0x2a')](_0x1f5b6e['query'][_0x0587('0x2a')]);_0x35f3a6[_0x0587('0x29')]=qs[_0x0587('0x29')](_0x1f5b6e[_0x0587('0x3d')]['offset']);}return _0x45a08a['getFields'](_0x35f3a6);}})[_0x0587('0x1b')](function(_0x3b6d32){if(_0x3b6d32){return _0x3b6d32?{'count':_0x80a8a6,'rows':_0x3b6d32}:null;}})[_0x0587('0x1b')](respondWithResult(_0x1144d3,null))['catch'](handleError(_0x1144d3,null));};exports['getSubjects']=function(_0x5cb7e6,_0x485e46,_0x2603f0){var _0x45a539={};var _0x491f5f={};var _0x1d5e89;var _0x461161;return db[_0x0587('0x37')][_0x0587('0x55')]({'where':{'id':_0x5cb7e6['params']['id']}})['then'](handleEntityNotFound(_0x485e46,null))['then'](function(_0x23f3a7){if(_0x23f3a7){_0x1d5e89=_0x23f3a7;_0x491f5f['model']=_[_0x0587('0x50')](db[_0x0587('0x56')][_0x0587('0x38')]);_0x491f5f[_0x0587('0x3d')]=_['keys'](_0x5cb7e6[_0x0587('0x3d')]);_0x491f5f['filters']=_['intersection'](_0x491f5f['model'],_0x491f5f[_0x0587('0x3d')]);_0x45a539[_0x0587('0x40')]=_[_0x0587('0x3f')](_0x491f5f[_0x0587('0x3c')],qs['fields'](_0x5cb7e6[_0x0587('0x3d')][_0x0587('0x41')]));_0x45a539['attributes']=_0x45a539[_0x0587('0x40')]['length']?_0x45a539['attributes']:_0x491f5f[_0x0587('0x3c')];_0x45a539[_0x0587('0x58')]=qs[_0x0587('0x43')](_0x5cb7e6['query'][_0x0587('0x43')]);_0x45a539[_0x0587('0x44')]=qs[_0x0587('0x3e')](_[_0x0587('0x45')](_0x5cb7e6[_0x0587('0x3d')],_0x491f5f['filters']));if(_0x5cb7e6[_0x0587('0x3d')][_0x0587('0x46')]){_0x45a539[_0x0587('0x44')]=_[_0x0587('0x47')](_0x45a539[_0x0587('0x44')],{'$or':_[_0x0587('0x36')](_0x45a539['attributes'],function(_0x22dcc6){var _0x449b82={};_0x449b82[_0x22dcc6]={'$like':'%'+_0x5cb7e6[_0x0587('0x3d')]['filter']+'%'};return _0x449b82;})});}_0x45a539=_[_0x0587('0x47')]({},_0x45a539,_0x5cb7e6[_0x0587('0x49')]);return _0x1d5e89[_0x0587('0x5a')](_0x45a539);}})[_0x0587('0x1b')](function(_0x283d82){if(_0x283d82){_0x461161=_0x283d82[_0x0587('0x57')];if(!_0x5cb7e6[_0x0587('0x3d')][_0x0587('0x59')](_0x0587('0x42'))){_0x45a539[_0x0587('0x2a')]=qs['limit'](_0x5cb7e6[_0x0587('0x3d')]['limit']);_0x45a539[_0x0587('0x29')]=qs[_0x0587('0x29')](_0x5cb7e6[_0x0587('0x3d')][_0x0587('0x29')]);}return _0x1d5e89[_0x0587('0x5a')](_0x45a539);}})[_0x0587('0x1b')](function(_0x2f77a3){if(_0x2f77a3){return _0x2f77a3?{'count':_0x461161,'rows':_0x2f77a3}:null;}})['then'](respondWithResult(_0x485e46,null))[_0x0587('0x4d')](handleError(_0x485e46,null));};exports[_0x0587('0x5b')]=function(_0x4b8272,_0x385a57,_0x38b3ed){var _0x137448={};var _0x18344b={};var _0x1af997;var _0x58b4f1;return db[_0x0587('0x37')][_0x0587('0x55')]({'where':{'id':_0x4b8272[_0x0587('0x4f')]['id']}})['then'](handleEntityNotFound(_0x385a57,null))['then'](function(_0x381633){if(_0x381633){_0x1af997=_0x381633;_0x18344b[_0x0587('0x3c')]=_[_0x0587('0x50')](db[_0x0587('0x56')][_0x0587('0x38')]);_0x18344b['query']=_[_0x0587('0x50')](_0x4b8272['query']);_0x18344b[_0x0587('0x3e')]=_['intersection'](_0x18344b['model'],_0x18344b[_0x0587('0x3d')]);_0x137448[_0x0587('0x40')]=_[_0x0587('0x3f')](_0x18344b['model'],qs['fields'](_0x4b8272[_0x0587('0x3d')]['fields']));_0x137448[_0x0587('0x40')]=_0x137448['attributes'][_0x0587('0x57')]?_0x137448[_0x0587('0x40')]:_0x18344b[_0x0587('0x3c')];_0x137448[_0x0587('0x58')]=qs[_0x0587('0x43')](_0x4b8272[_0x0587('0x3d')][_0x0587('0x43')]);_0x137448[_0x0587('0x44')]=qs[_0x0587('0x3e')](_[_0x0587('0x45')](_0x4b8272['query'],_0x18344b['filters']));if(_0x4b8272[_0x0587('0x3d')][_0x0587('0x46')]){_0x137448[_0x0587('0x44')]=_['merge'](_0x137448['where'],{'$or':_['map'](_0x137448[_0x0587('0x40')],function(_0x5e32fc){var _0x336ed2={};_0x336ed2[_0x5e32fc]={'$like':'%'+_0x4b8272['query'][_0x0587('0x46')]+'%'};return _0x336ed2;})});}_0x137448=_['merge']({},_0x137448,_0x4b8272['options']);return _0x1af997[_0x0587('0x5b')](_0x137448);}})['then'](function(_0x2af7d9){if(_0x2af7d9){_0x58b4f1=_0x2af7d9[_0x0587('0x57')];if(!_0x4b8272[_0x0587('0x3d')][_0x0587('0x59')](_0x0587('0x42'))){_0x137448[_0x0587('0x2a')]=qs[_0x0587('0x2a')](_0x4b8272[_0x0587('0x3d')][_0x0587('0x2a')]);_0x137448[_0x0587('0x29')]=qs['offset'](_0x4b8272[_0x0587('0x3d')][_0x0587('0x29')]);}return _0x1af997[_0x0587('0x5b')](_0x137448);}})[_0x0587('0x1b')](function(_0x497003){if(_0x497003){return _0x497003?{'count':_0x58b4f1,'rows':_0x497003}:null;}})[_0x0587('0x1b')](respondWithResult(_0x385a57,null))[_0x0587('0x4d')](handleError(_0x385a57,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e87f86c..12c3b95 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 _0xef7b=['../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','util'];(function(_0x4f0837,_0x2ef53b){var _0x30abc4=function(_0xbe1347){while(--_0xbe1347){_0x4f0837['push'](_0x4f0837['shift']());}};_0x30abc4(++_0x2ef53b);}(_0xef7b,0x169));var _0xbef7=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0xef7b[_0x673722];return _0x21249c;};'use strict';var _=require(_0xbef7('0x0'));var util=require(_0xbef7('0x1'));var logger=require(_0xbef7('0x2'))(_0xbef7('0x3'));var moment=require(_0xbef7('0x4'));var BPromise=require(_0xbef7('0x5'));var rp=require(_0xbef7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbef7('0x7'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module[_0xbef7('0x8')]=function(_0x49145f,_0x4636f1){return _0x49145f['define'](_0xbef7('0x9'),attributes,{'tableName':_0xbef7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe644=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe644,0xe3));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x3324aa,_0x31a4f3){return _0x3324aa[_0x4e64('0xb')](_0x4e64('0xc'),attributes,{'tableName':_0x4e64('0xd'),'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 1642921..77637d0 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 _0x74b6=['then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x3d7463,_0x56b9c1){var _0x1fb252=function(_0x2f859c){while(--_0x2f859c){_0x3d7463['push'](_0x3d7463['shift']());}};_0x1fb252(++_0x56b9c1);}(_0x74b6,0x198));var _0x674b=function(_0xcfbbe2,_0x41da32){_0xcfbbe2=_0xcfbbe2-0x0;var _0x318e4f=_0x74b6[_0xcfbbe2];return _0x318e4f;};'use strict';var _=require(_0x674b('0x0'));var util=require(_0x674b('0x1'));var moment=require(_0x674b('0x2'));var BPromise=require('bluebird');var rs=require(_0x674b('0x3'));var fs=require('fs');var Redis=require(_0x674b('0x4'));var db=require(_0x674b('0x5'))['db'];var utils=require(_0x674b('0x6'));var logger=require(_0x674b('0x7'))(_0x674b('0x8'));var config=require(_0x674b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x674b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c2f4d,_0x36d7c9,_0x5b6f7c){return new BPromise(function(_0x593fdd,_0x352be7){return client[_0x674b('0xb')](_0x1c2f4d,_0x5b6f7c)[_0x674b('0xc')](function(_0x309c1b){logger[_0x674b('0xd')](_0x674b('0xe'),_0x36d7c9,_0x674b('0xf'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x36d7c9,_0x674b('0xf'),JSON[_0x674b('0x10')](_0x309c1b));if(_0x309c1b[_0x674b('0x11')]){if(_0x309c1b['error'][_0x674b('0x12')]===0x1f4){logger['error'](_0x674b('0xe'),_0x36d7c9,_0x309c1b[_0x674b('0x11')][_0x674b('0x13')]);return _0x352be7(_0x309c1b['error'][_0x674b('0x13')]);}logger[_0x674b('0x11')](_0x674b('0xe'),_0x36d7c9,_0x309c1b[_0x674b('0x11')][_0x674b('0x13')]);return _0x593fdd(_0x309c1b[_0x674b('0x11')][_0x674b('0x13')]);}else{logger[_0x674b('0xd')](_0x674b('0xe'),_0x36d7c9,_0x674b('0xf'));_0x593fdd(_0x309c1b['result'][_0x674b('0x13')]);}})[_0x674b('0x14')](function(_0x7499af){logger['error'](_0x674b('0xe'),_0x36d7c9,_0x7499af);_0x352be7(_0x7499af);});});} \ No newline at end of file +var _0x1f20=['request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\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','http'];(function(_0x580b84,_0x54652f){var _0x4517ab=function(_0x4c5a9a){while(--_0x4c5a9a){_0x580b84['push'](_0x580b84['shift']());}};_0x4517ab(++_0x54652f);}(_0x1f20,0x6b));var _0x01f2=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x1f20[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x01f2('0x0'));var util=require(_0x01f2('0x1'));var moment=require(_0x01f2('0x2'));var BPromise=require(_0x01f2('0x3'));var rs=require(_0x01f2('0x4'));var fs=require('fs');var Redis=require(_0x01f2('0x5'));var db=require(_0x01f2('0x6'))['db'];var utils=require(_0x01f2('0x7'));var logger=require(_0x01f2('0x8'))(_0x01f2('0x9'));var config=require(_0x01f2('0xa'));var jayson=require(_0x01f2('0xb'));var client=jayson['client'][_0x01f2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ddfd5,_0x487498,_0x55ce84){return new BPromise(function(_0x2830c4,_0x509b18){return client[_0x01f2('0xd')](_0x1ddfd5,_0x55ce84)['then'](function(_0x30bae0){logger[_0x01f2('0xe')](_0x01f2('0xf'),_0x487498,_0x01f2('0x10'));logger[_0x01f2('0x11')](_0x01f2('0x12'),_0x487498,_0x01f2('0x10'),JSON['stringify'](_0x30bae0));if(_0x30bae0[_0x01f2('0x13')]){if(_0x30bae0[_0x01f2('0x13')][_0x01f2('0x14')]===0x1f4){logger[_0x01f2('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x487498,_0x30bae0['error'][_0x01f2('0x15')]);return _0x509b18(_0x30bae0[_0x01f2('0x13')][_0x01f2('0x15')]);}logger[_0x01f2('0x13')](_0x01f2('0xf'),_0x487498,_0x30bae0[_0x01f2('0x13')][_0x01f2('0x15')]);return _0x2830c4(_0x30bae0[_0x01f2('0x13')][_0x01f2('0x15')]);}else{logger[_0x01f2('0xe')](_0x01f2('0xf'),_0x487498,_0x01f2('0x10'));_0x2830c4(_0x30bae0[_0x01f2('0x16')]['message']);}})[_0x01f2('0x17')](function(_0x481ef9){logger[_0x01f2('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x487498,_0x481ef9);_0x509b18(_0x481ef9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ab40a7e..821af36 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 _0xac55=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x26b968,_0x1d02eb){var _0x418664=function(_0x390822){while(--_0x390822){_0x26b968['push'](_0x26b968['shift']());}};_0x418664(++_0x1d02eb);}(_0xac55,0x1c8));var _0x5ac5=function(_0x185517,_0x49941a){_0x185517=_0x185517-0x0;var _0x4834d8=_0xac55[_0x185517];return _0x4834d8;};'use strict';var multer=require(_0x5ac5('0x0'));var util=require(_0x5ac5('0x1'));var path=require(_0x5ac5('0x2'));var timeout=require(_0x5ac5('0x3'));var express=require('express');var router=express[_0x5ac5('0x4')]();var auth=require(_0x5ac5('0x5'));var interaction=require(_0x5ac5('0x6'));var config=require(_0x5ac5('0x7'));var controller=require(_0x5ac5('0x8'));router[_0x5ac5('0x9')]('/',auth[_0x5ac5('0xa')](),controller['index']);router['get'](_0x5ac5('0xb'),auth[_0x5ac5('0xa')](),controller[_0x5ac5('0xc')]);router[_0x5ac5('0xd')]('/',auth[_0x5ac5('0xa')](),controller[_0x5ac5('0xe')]);router[_0x5ac5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5ac5('0x10')]);router[_0x5ac5('0x11')]('/:id',auth[_0x5ac5('0xa')](),controller[_0x5ac5('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe205=['create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe205,0xa7));var _0x5e20=function(_0x5bb3f8,_0x5f3bcb){_0x5bb3f8=_0x5bb3f8-0x0;var _0x332911=_0xe205[_0x5bb3f8];return _0x332911;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var auth=require(_0x5e20('0x6'));var interaction=require(_0x5e20('0x7'));var config=require(_0x5e20('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x5e20('0x9')]('/',auth[_0x5e20('0xa')](),controller[_0x5e20('0xb')]);router[_0x5e20('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5e20('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e20('0xd')]);router[_0x5e20('0xe')]('/:id',auth[_0x5e20('0xa')](),controller[_0x5e20('0xf')]);router[_0x5e20('0x10')](_0x5e20('0x11'),auth['isAuthenticated'](),controller[_0x5e20('0x12')]);module[_0x5e20('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 9e9589e..1b3900a 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 _0x6b61=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x6b61,0x16a));var _0x16b6=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x6b61[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x16b6('0x0'));module['exports']={'type':{'type':Sequelize[_0x16b6('0x1')](_0x16b6('0x2'),_0x16b6('0x3'),_0x16b6('0x4'),_0x16b6('0x5')),'defaultValue':_0x16b6('0x2')},'content':{'type':Sequelize[_0x16b6('0x6')]},'key':{'type':Sequelize[_0x16b6('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x16b6('0x2'),_0x16b6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x16b6('0x6')]},'idField':{'type':Sequelize[_0x16b6('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x16b6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x16b6('0x6')]}}; \ No newline at end of file +var _0x3a38=['BOOLEAN','exports','ENUM','customVariable','keyValue','string','STRING','variable'];(function(_0xefe181,_0xcb4712){var _0x445cdb=function(_0x15d16f){while(--_0x15d16f){_0xefe181['push'](_0xefe181['shift']());}};_0x445cdb(++_0xcb4712);}(_0x3a38,0xd9));var _0x83a3=function(_0x5c0eda,_0x5842f0){_0x5c0eda=_0x5c0eda-0x0;var _0x43c9ac=_0x3a38[_0x5c0eda];return _0x43c9ac;};'use strict';var Sequelize=require('sequelize');module[_0x83a3('0x0')]={'type':{'type':Sequelize[_0x83a3('0x1')]('string','variable',_0x83a3('0x2'),_0x83a3('0x3')),'defaultValue':_0x83a3('0x4')},'content':{'type':Sequelize[_0x83a3('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x83a3('0x1')](_0x83a3('0x4'),_0x83a3('0x6'),_0x83a3('0x2'))},'keyContent':{'type':Sequelize[_0x83a3('0x5')]},'idField':{'type':Sequelize[_0x83a3('0x5')]},'nameField':{'type':Sequelize[_0x83a3('0x5')]},'customField':{'type':Sequelize[_0x83a3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x83a3('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 2430040..d263a82 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 _0x53d0=['index','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','Dynamics365Field','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','update','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','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','end','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send'];(function(_0x4d2a6e,_0x185f42){var _0x2fa8bf=function(_0x48f9d4){while(--_0x48f9d4){_0x4d2a6e['push'](_0x4d2a6e['shift']());}};_0x2fa8bf(++_0x185f42);}(_0x53d0,0x6c));var _0x053d=function(_0x396a8e,_0x354607){_0x396a8e=_0x396a8e-0x0;var _0xa0d55b=_0x53d0[_0x396a8e];return _0xa0d55b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x053d('0x0'));var rimraf=require(_0x053d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x053d('0x2'));var rp=require('request-promise');var moment=require(_0x053d('0x3'));var BPromise=require(_0x053d('0x4'));var Mustache=require(_0x053d('0x5'));var util=require(_0x053d('0x6'));var path=require(_0x053d('0x7'));var sox=require(_0x053d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x053d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x053d('0xa'));var deskjs=require(_0x053d('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x053d('0xc'));var Redis=require(_0x053d('0xd'));var authService=require(_0x053d('0xe'));var qs=require(_0x053d('0xf'));var as=require(_0x053d('0x10'));var hardwareService=require(_0x053d('0x11'));var logger=require(_0x053d('0x12'))(_0x053d('0x13'));var utils=require(_0x053d('0x14'));var config=require(_0x053d('0x15'));var db=require(_0x053d('0x16'))['db'];function respondWithStatusCode(_0x1f4612,_0x210ade){_0x210ade=_0x210ade||0xcc;return function(_0x9674ba){if(_0x9674ba){return _0x1f4612[_0x053d('0x17')](_0x210ade);}return _0x1f4612['status'](_0x210ade)[_0x053d('0x18')]();};}function respondWithResult(_0x25c6a0,_0x34bb8b){_0x34bb8b=_0x34bb8b||0xc8;return function(_0x4a8e7f){if(_0x4a8e7f){return _0x25c6a0[_0x053d('0x19')](_0x34bb8b)[_0x053d('0x1a')](_0x4a8e7f);}};}function respondWithFilteredResult(_0x2f1567,_0x19f02a){return function(_0x4944cc){if(_0x4944cc){var _0x435a3a=_0x4944cc['count'],_0x1f1087=_0x19f02a[_0x053d('0x1b')],_0x33d10b=_0x19f02a[_0x053d('0x1b')]+_0x19f02a[_0x053d('0x1c')],_0x1cb17f;if(_0x33d10b>=_0x435a3a){_0x33d10b=_0x435a3a;_0x1cb17f=0xc8;}else{_0x1cb17f=0xce;}_0x2f1567[_0x053d('0x19')](_0x1cb17f);return _0x2f1567[_0x053d('0x1d')](_0x053d('0x1e'),_0x1f1087+'-'+_0x33d10b+'/'+_0x435a3a)[_0x053d('0x1a')](_0x4944cc);}return null;};}function patchUpdates(_0xcc5069){return function(_0x3e20b5){try{jsonpatch['apply'](_0x3e20b5,_0xcc5069,!![]);}catch(_0x539d4d){return BPromise[_0x053d('0x1f')](_0x539d4d);}return _0x3e20b5[_0x053d('0x20')]();};}function saveUpdates(_0x503b48,_0x2c3d40){return function(_0x67bc8f){if(_0x67bc8f){return _0x67bc8f['update'](_0x503b48)[_0x053d('0x21')](function(_0x211877){return _0x211877;});}return null;};}function removeEntity(_0x4d4fa4,_0x5e4fba){return function(_0x4a7920){if(_0x4a7920){return _0x4a7920[_0x053d('0x22')]()[_0x053d('0x21')](function(){_0x4d4fa4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4252d5,_0x334908){return function(_0x1b94c0){if(!_0x1b94c0){_0x4252d5[_0x053d('0x17')](0x194);}return _0x1b94c0;};}function handleError(_0x196ea2,_0x5657e3){_0x5657e3=_0x5657e3||0x1f4;return function(_0x4f621e){logger[_0x053d('0x23')](_0x4f621e['stack']);if(_0x4f621e[_0x053d('0x24')]){delete _0x4f621e[_0x053d('0x24')];}_0x196ea2[_0x053d('0x19')](_0x5657e3)[_0x053d('0x25')](_0x4f621e);};}exports[_0x053d('0x26')]=function(_0x150f09,_0x51a8ae){var _0x5623cb={},_0x2a245d={},_0x625eae={'count':0x0,'rows':[]};var _0x4d71fb=_['map'](db['Dynamics365Field'][_0x053d('0x27')],function(_0x42b7be){return{'name':_0x42b7be[_0x053d('0x28')],'type':_0x42b7be[_0x053d('0x29')]['key']};});_0x2a245d[_0x053d('0x2a')]=_['map'](_0x4d71fb,_0x053d('0x24'));_0x2a245d[_0x053d('0x2b')]=_[_0x053d('0x2c')](_0x150f09[_0x053d('0x2b')]);_0x2a245d[_0x053d('0x2d')]=_['intersection'](_0x2a245d[_0x053d('0x2a')],_0x2a245d[_0x053d('0x2b')]);_0x5623cb[_0x053d('0x2e')]=_[_0x053d('0x2f')](_0x2a245d[_0x053d('0x2a')],qs[_0x053d('0x30')](_0x150f09[_0x053d('0x2b')][_0x053d('0x30')]));_0x5623cb[_0x053d('0x2e')]=_0x5623cb[_0x053d('0x2e')]['length']?_0x5623cb['attributes']:_0x2a245d[_0x053d('0x2a')];if(!_0x150f09[_0x053d('0x2b')][_0x053d('0x31')](_0x053d('0x32'))){_0x5623cb[_0x053d('0x1c')]=qs[_0x053d('0x1c')](_0x150f09[_0x053d('0x2b')][_0x053d('0x1c')]);_0x5623cb[_0x053d('0x1b')]=qs[_0x053d('0x1b')](_0x150f09[_0x053d('0x2b')][_0x053d('0x1b')]);}_0x5623cb[_0x053d('0x33')]=qs[_0x053d('0x34')](_0x150f09[_0x053d('0x2b')][_0x053d('0x34')]);_0x5623cb[_0x053d('0x35')]=qs[_0x053d('0x2d')](_[_0x053d('0x36')](_0x150f09[_0x053d('0x2b')],_0x2a245d[_0x053d('0x2d')]),_0x4d71fb);if(_0x150f09[_0x053d('0x2b')][_0x053d('0x37')]){_0x5623cb[_0x053d('0x35')]=_[_0x053d('0x38')](_0x5623cb[_0x053d('0x35')],{'$or':_[_0x053d('0x39')](_0x4d71fb,function(_0x5812c9){if(_0x5812c9[_0x053d('0x29')]!==_0x053d('0x3a')){var _0x14db67={};_0x14db67[_0x5812c9[_0x053d('0x24')]]={'$like':'%'+_0x150f09[_0x053d('0x2b')][_0x053d('0x37')]+'%'};return _0x14db67;}})});}_0x5623cb=_[_0x053d('0x38')]({},_0x5623cb,_0x150f09[_0x053d('0x3b')]);var _0x3c0cf5={'where':_0x5623cb[_0x053d('0x35')]};return db[_0x053d('0x3c')]['count'](_0x3c0cf5)[_0x053d('0x21')](function(_0xb54b73){_0x625eae['count']=_0xb54b73;if(_0x150f09[_0x053d('0x2b')]['includeAll']){_0x5623cb[_0x053d('0x3d')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x053d('0x3e')](_0x5623cb);})[_0x053d('0x21')](function(_0x17ff13){_0x625eae[_0x053d('0x3f')]=_0x17ff13;return _0x625eae;})[_0x053d('0x21')](respondWithFilteredResult(_0x51a8ae,_0x5623cb))[_0x053d('0x40')](handleError(_0x51a8ae,null));};exports[_0x053d('0x41')]=function(_0x8cc108,_0x250834){var _0xac65b8={'raw':!![],'where':{'id':_0x8cc108[_0x053d('0x42')]['id']}},_0x275605={};_0x275605['model']=_[_0x053d('0x2c')](db['Dynamics365Field'][_0x053d('0x27')]);_0x275605[_0x053d('0x2b')]=_['keys'](_0x8cc108[_0x053d('0x2b')]);_0x275605['filters']=_[_0x053d('0x2f')](_0x275605[_0x053d('0x2a')],_0x275605[_0x053d('0x2b')]);_0xac65b8[_0x053d('0x2e')]=_['intersection'](_0x275605[_0x053d('0x2a')],qs['fields'](_0x8cc108[_0x053d('0x2b')][_0x053d('0x30')]));_0xac65b8[_0x053d('0x2e')]=_0xac65b8[_0x053d('0x2e')][_0x053d('0x43')]?_0xac65b8[_0x053d('0x2e')]:_0x275605[_0x053d('0x2a')];if(_0x8cc108['query'][_0x053d('0x44')]){_0xac65b8['include']=[{'all':!![]}];}_0xac65b8=_[_0x053d('0x38')]({},_0xac65b8,_0x8cc108['options']);return db['Dynamics365Field'][_0x053d('0x45')](_0xac65b8)[_0x053d('0x21')](handleEntityNotFound(_0x250834,null))[_0x053d('0x21')](respondWithResult(_0x250834,null))[_0x053d('0x40')](handleError(_0x250834,null));};exports[_0x053d('0x46')]=function(_0x21dae8,_0x1f6b98){return db[_0x053d('0x3c')]['create'](_0x21dae8[_0x053d('0x47')],{})['then'](respondWithResult(_0x1f6b98,0xc9))[_0x053d('0x40')](handleError(_0x1f6b98,null));};exports[_0x053d('0x48')]=function(_0xee8ca1,_0x195d81){if(_0xee8ca1[_0x053d('0x47')]['id']){delete _0xee8ca1['body']['id'];}return db['Dynamics365Field'][_0x053d('0x45')]({'where':{'id':_0xee8ca1[_0x053d('0x42')]['id']}})[_0x053d('0x21')](handleEntityNotFound(_0x195d81,null))[_0x053d('0x21')](saveUpdates(_0xee8ca1[_0x053d('0x47')],null))[_0x053d('0x21')](respondWithResult(_0x195d81,null))['catch'](handleError(_0x195d81,null));};exports[_0x053d('0x22')]=function(_0xa8c17d,_0x37e59e){return db[_0x053d('0x3c')][_0x053d('0x45')]({'where':{'id':_0xa8c17d['params']['id']}})['then'](handleEntityNotFound(_0x37e59e,null))[_0x053d('0x21')](removeEntity(_0x37e59e,null))['catch'](handleError(_0x37e59e,null));}; \ No newline at end of file +var _0xdf64=['VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','merge','where','type'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdf64,0x1da));var _0x4df6=function(_0x3535c6,_0xe0076d){_0x3535c6=_0x3535c6-0x0;var _0x3049c9=_0xdf64[_0x3535c6];return _0x3049c9;};'use strict';var pdf=require(_0x4df6('0x0'));var emlformat=require(_0x4df6('0x1'));var rimraf=require(_0x4df6('0x2'));var zipdir=require(_0x4df6('0x3'));var jsonpatch=require(_0x4df6('0x4'));var rp=require(_0x4df6('0x5'));var moment=require(_0x4df6('0x6'));var BPromise=require(_0x4df6('0x7'));var Mustache=require(_0x4df6('0x8'));var util=require(_0x4df6('0x9'));var path=require('path');var sox=require(_0x4df6('0xa'));var csv=require(_0x4df6('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4df6('0xc'));var squel=require(_0x4df6('0xd'));var crypto=require(_0x4df6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4df6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4df6('0x10'));var Papa=require(_0x4df6('0x11'));var Redis=require(_0x4df6('0x12'));var authService=require(_0x4df6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4df6('0x14'));var hardwareService=require(_0x4df6('0x15'));var logger=require(_0x4df6('0x16'))(_0x4df6('0x17'));var utils=require(_0x4df6('0x18'));var config=require(_0x4df6('0x19'));var db=require(_0x4df6('0x1a'))['db'];function respondWithStatusCode(_0x395d27,_0x334b41){_0x334b41=_0x334b41||0xcc;return function(_0x419b9a){if(_0x419b9a){return _0x395d27[_0x4df6('0x1b')](_0x334b41);}return _0x395d27[_0x4df6('0x1c')](_0x334b41)[_0x4df6('0x1d')]();};}function respondWithResult(_0x4e55b0,_0x59347c){_0x59347c=_0x59347c||0xc8;return function(_0x38e8f9){if(_0x38e8f9){return _0x4e55b0[_0x4df6('0x1c')](_0x59347c)[_0x4df6('0x1e')](_0x38e8f9);}};}function respondWithFilteredResult(_0x4e49c6,_0x1a98ff){return function(_0x1b9463){if(_0x1b9463){var _0x11eef9=_0x1b9463[_0x4df6('0x1f')],_0x9b02d3=_0x1a98ff[_0x4df6('0x20')],_0x20de3e=_0x1a98ff['offset']+_0x1a98ff['limit'],_0x3443f1;if(_0x20de3e>=_0x11eef9){_0x20de3e=_0x11eef9;_0x3443f1=0xc8;}else{_0x3443f1=0xce;}_0x4e49c6[_0x4df6('0x1c')](_0x3443f1);return _0x4e49c6['set'](_0x4df6('0x21'),_0x9b02d3+'-'+_0x20de3e+'/'+_0x11eef9)['json'](_0x1b9463);}return null;};}function patchUpdates(_0x5cf0f7){return function(_0x5c9f86){try{jsonpatch['apply'](_0x5c9f86,_0x5cf0f7,!![]);}catch(_0x5d8f6b){return BPromise[_0x4df6('0x22')](_0x5d8f6b);}return _0x5c9f86[_0x4df6('0x23')]();};}function saveUpdates(_0x3f0744,_0x112a86){return function(_0x57f6e4){if(_0x57f6e4){return _0x57f6e4['update'](_0x3f0744)[_0x4df6('0x24')](function(_0x1a9798){return _0x1a9798;});}return null;};}function removeEntity(_0xd5317a,_0x50b5f7){return function(_0xcc0b0){if(_0xcc0b0){return _0xcc0b0[_0x4df6('0x25')]()[_0x4df6('0x24')](function(){_0xd5317a[_0x4df6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd6a9,_0x2dd570){return function(_0x3998e3){if(!_0x3998e3){_0x4fd6a9[_0x4df6('0x1b')](0x194);}return _0x3998e3;};}function handleError(_0x1b673f,_0x536e80){_0x536e80=_0x536e80||0x1f4;return function(_0x153095){logger[_0x4df6('0x26')](_0x153095[_0x4df6('0x27')]);if(_0x153095['name']){delete _0x153095[_0x4df6('0x28')];}_0x1b673f[_0x4df6('0x1c')](_0x536e80)[_0x4df6('0x29')](_0x153095);};}exports[_0x4df6('0x2a')]=function(_0x20d674,_0x351ad6){var _0xf148b9={},_0x2d76d5={},_0x2f7c55={'count':0x0,'rows':[]};var _0x113b1b=_[_0x4df6('0x2b')](db[_0x4df6('0x2c')][_0x4df6('0x2d')],function(_0x529d2d){return{'name':_0x529d2d[_0x4df6('0x2e')],'type':_0x529d2d['type'][_0x4df6('0x2f')]};});_0x2d76d5[_0x4df6('0x30')]=_['map'](_0x113b1b,_0x4df6('0x28'));_0x2d76d5['query']=_[_0x4df6('0x31')](_0x20d674[_0x4df6('0x32')]);_0x2d76d5[_0x4df6('0x33')]=_[_0x4df6('0x34')](_0x2d76d5[_0x4df6('0x30')],_0x2d76d5[_0x4df6('0x32')]);_0xf148b9[_0x4df6('0x35')]=_['intersection'](_0x2d76d5['model'],qs[_0x4df6('0x36')](_0x20d674[_0x4df6('0x32')][_0x4df6('0x36')]));_0xf148b9['attributes']=_0xf148b9['attributes'][_0x4df6('0x37')]?_0xf148b9['attributes']:_0x2d76d5['model'];if(!_0x20d674['query'][_0x4df6('0x38')]('nolimit')){_0xf148b9[_0x4df6('0x39')]=qs[_0x4df6('0x39')](_0x20d674[_0x4df6('0x32')][_0x4df6('0x39')]);_0xf148b9[_0x4df6('0x20')]=qs[_0x4df6('0x20')](_0x20d674[_0x4df6('0x32')][_0x4df6('0x20')]);}_0xf148b9[_0x4df6('0x3a')]=qs[_0x4df6('0x3b')](_0x20d674[_0x4df6('0x32')]['sort']);_0xf148b9['where']=qs[_0x4df6('0x33')](_[_0x4df6('0x3c')](_0x20d674[_0x4df6('0x32')],_0x2d76d5[_0x4df6('0x33')]),_0x113b1b);if(_0x20d674[_0x4df6('0x32')][_0x4df6('0x3d')]){_0xf148b9['where']=_[_0x4df6('0x3e')](_0xf148b9[_0x4df6('0x3f')],{'$or':_[_0x4df6('0x2b')](_0x113b1b,function(_0x34fbe2){if(_0x34fbe2[_0x4df6('0x40')]!==_0x4df6('0x41')){var _0x35ac36={};_0x35ac36[_0x34fbe2[_0x4df6('0x28')]]={'$like':'%'+_0x20d674[_0x4df6('0x32')]['filter']+'%'};return _0x35ac36;}})});}_0xf148b9=_['merge']({},_0xf148b9,_0x20d674[_0x4df6('0x42')]);var _0xb8a099={'where':_0xf148b9[_0x4df6('0x3f')]};return db[_0x4df6('0x2c')][_0x4df6('0x1f')](_0xb8a099)['then'](function(_0x56742e){_0x2f7c55[_0x4df6('0x1f')]=_0x56742e;if(_0x20d674[_0x4df6('0x32')]['includeAll']){_0xf148b9['include']=[{'all':!![]}];}return db[_0x4df6('0x2c')][_0x4df6('0x43')](_0xf148b9);})[_0x4df6('0x24')](function(_0x37c4b){_0x2f7c55[_0x4df6('0x44')]=_0x37c4b;return _0x2f7c55;})['then'](respondWithFilteredResult(_0x351ad6,_0xf148b9))[_0x4df6('0x45')](handleError(_0x351ad6,null));};exports[_0x4df6('0x46')]=function(_0x108ac1,_0x36a14e){var _0x48ff4f={'raw':!![],'where':{'id':_0x108ac1[_0x4df6('0x47')]['id']}},_0xc10360={};_0xc10360[_0x4df6('0x30')]=_[_0x4df6('0x31')](db[_0x4df6('0x2c')][_0x4df6('0x2d')]);_0xc10360[_0x4df6('0x32')]=_[_0x4df6('0x31')](_0x108ac1['query']);_0xc10360[_0x4df6('0x33')]=_[_0x4df6('0x34')](_0xc10360[_0x4df6('0x30')],_0xc10360['query']);_0x48ff4f[_0x4df6('0x35')]=_[_0x4df6('0x34')](_0xc10360[_0x4df6('0x30')],qs[_0x4df6('0x36')](_0x108ac1[_0x4df6('0x32')]['fields']));_0x48ff4f[_0x4df6('0x35')]=_0x48ff4f[_0x4df6('0x35')]['length']?_0x48ff4f[_0x4df6('0x35')]:_0xc10360[_0x4df6('0x30')];if(_0x108ac1['query'][_0x4df6('0x48')]){_0x48ff4f[_0x4df6('0x49')]=[{'all':!![]}];}_0x48ff4f=_[_0x4df6('0x3e')]({},_0x48ff4f,_0x108ac1[_0x4df6('0x42')]);return db['Dynamics365Field'][_0x4df6('0x4a')](_0x48ff4f)['then'](handleEntityNotFound(_0x36a14e,null))[_0x4df6('0x24')](respondWithResult(_0x36a14e,null))['catch'](handleError(_0x36a14e,null));};exports[_0x4df6('0x4b')]=function(_0x3847fb,_0x9fd6d0){return db['Dynamics365Field']['create'](_0x3847fb[_0x4df6('0x4c')],{})[_0x4df6('0x24')](respondWithResult(_0x9fd6d0,0xc9))[_0x4df6('0x45')](handleError(_0x9fd6d0,null));};exports['update']=function(_0x294e0d,_0x33180b){if(_0x294e0d[_0x4df6('0x4c')]['id']){delete _0x294e0d[_0x4df6('0x4c')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x294e0d['params']['id']}})['then'](handleEntityNotFound(_0x33180b,null))[_0x4df6('0x24')](saveUpdates(_0x294e0d[_0x4df6('0x4c')],null))[_0x4df6('0x24')](respondWithResult(_0x33180b,null))[_0x4df6('0x45')](handleError(_0x33180b,null));};exports[_0x4df6('0x25')]=function(_0x136510,_0x59c881){return db['Dynamics365Field'][_0x4df6('0x4a')]({'where':{'id':_0x136510['params']['id']}})[_0x4df6('0x24')](handleEntityNotFound(_0x59c881,null))[_0x4df6('0x24')](removeEntity(_0x59c881,null))[_0x4df6('0x45')](handleError(_0x59c881,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2f6efee..b21c732 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 _0x1ab4=['FieldId','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x2bae58,_0x3689a8){var _0x56d462=function(_0x3f230f){while(--_0x3f230f){_0x2bae58['push'](_0x2bae58['shift']());}};_0x56d462(++_0x3689a8);}(_0x1ab4,0x1b1));var _0x41ab=function(_0x383163,_0x4f97a4){_0x383163=_0x383163-0x0;var _0x100818=_0x1ab4[_0x383163];return _0x100818;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x41ab('0x0'))('api');var moment=require('moment');var BPromise=require(_0x41ab('0x1'));var rp=require(_0x41ab('0x2'));var fs=require('fs');var path=require(_0x41ab('0x3'));var rimraf=require(_0x41ab('0x4'));var config=require(_0x41ab('0x5'));var attributes=require('./intDynamics365Field.attributes');module[_0x41ab('0x6')]=function(_0x13ae88,_0x1eacfd){return _0x13ae88[_0x41ab('0x7')]('Dynamics365Field',attributes,{'tableName':_0x41ab('0x8'),'paranoid':![],'indexes':[{'name':_0x41ab('0x9'),'fields':[_0x41ab('0xa'),_0x41ab('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x349a=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define'];(function(_0x2ce9c1,_0x582960){var _0x7e27ce=function(_0x5a9c4d){while(--_0x5a9c4d){_0x2ce9c1['push'](_0x2ce9c1['shift']());}};_0x7e27ce(++_0x582960);}(_0x349a,0x16c));var _0xa349=function(_0x1f1283,_0x1bea3b){_0x1f1283=_0x1f1283-0x0;var _0x205041=_0x349a[_0x1f1283];return _0x205041;};'use strict';var _=require(_0xa349('0x0'));var util=require(_0xa349('0x1'));var logger=require('../../config/logger')(_0xa349('0x2'));var moment=require(_0xa349('0x3'));var BPromise=require(_0xa349('0x4'));var rp=require(_0xa349('0x5'));var fs=require('fs');var path=require(_0xa349('0x6'));var rimraf=require(_0xa349('0x7'));var config=require(_0xa349('0x8'));var attributes=require(_0xa349('0x9'));module['exports']=function(_0x4a2195,_0x4cfe30){return _0x4a2195[_0xa349('0xa')](_0xa349('0xb'),attributes,{'tableName':_0xa349('0xc'),'paranoid':![],'indexes':[{'name':_0xa349('0xd'),'fields':[_0xa349('0xe'),'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 1aab5cf..73322b3 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 _0x9536=['request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Dynamics365Field,\x20%s,\x20%s'];(function(_0x2fb907,_0x38d0fb){var _0x14027f=function(_0x3694a4){while(--_0x3694a4){_0x2fb907['push'](_0x2fb907['shift']());}};_0x14027f(++_0x38d0fb);}(_0x9536,0x179));var _0x6953=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0x9536[_0xbe40ad];return _0x50fac9;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file +var _0x6eec=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch'];(function(_0x2f08c1,_0x45a9bd){var _0x3bd057=function(_0xca272e){while(--_0xca272e){_0x2f08c1['push'](_0x2f08c1['shift']());}};_0x3bd057(++_0x45a9bd);}(_0x6eec,0x1e0));var _0xc6ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6eec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc6ee('0x0'));var util=require(_0xc6ee('0x1'));var moment=require(_0xc6ee('0x2'));var BPromise=require(_0xc6ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6ee('0x4'));var db=require(_0xc6ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc6ee('0x6'))(_0xc6ee('0x7'));var config=require(_0xc6ee('0x8'));var jayson=require(_0xc6ee('0x9'));var client=jayson[_0xc6ee('0xa')][_0xc6ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa820be,_0x3325b5,_0x476339){return new BPromise(function(_0x59bd32,_0x5d1421){return client[_0xc6ee('0xc')](_0xa820be,_0x476339)[_0xc6ee('0xd')](function(_0x4d6c8b){logger[_0xc6ee('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3325b5,_0xc6ee('0xf'));logger[_0xc6ee('0x10')](_0xc6ee('0x11'),_0x3325b5,_0xc6ee('0xf'),JSON['stringify'](_0x4d6c8b));if(_0x4d6c8b[_0xc6ee('0x12')]){if(_0x4d6c8b[_0xc6ee('0x12')][_0xc6ee('0x13')]===0x1f4){logger['error'](_0xc6ee('0x14'),_0x3325b5,_0x4d6c8b[_0xc6ee('0x12')][_0xc6ee('0x15')]);return _0x5d1421(_0x4d6c8b['error'][_0xc6ee('0x15')]);}logger[_0xc6ee('0x12')](_0xc6ee('0x14'),_0x3325b5,_0x4d6c8b['error'][_0xc6ee('0x15')]);return _0x59bd32(_0x4d6c8b[_0xc6ee('0x12')][_0xc6ee('0x15')]);}else{logger['info'](_0xc6ee('0x14'),_0x3325b5,_0xc6ee('0xf'));_0x59bd32(_0x4d6c8b[_0xc6ee('0x16')][_0xc6ee('0x15')]);}})[_0xc6ee('0x17')](function(_0x18fea5){logger[_0xc6ee('0x12')](_0xc6ee('0x14'),_0x3325b5,_0x18fea5);_0x5d1421(_0x18fea5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 667120b..56a2a80 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 _0xaa8b=['/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','../../config/environment','get'];(function(_0x1c3991,_0x41c24c){var _0x17a7e5=function(_0x1894c0){while(--_0x1894c0){_0x1c3991['push'](_0x1c3991['shift']());}};_0x17a7e5(++_0x41c24c);}(_0xaa8b,0xca));var _0xbaa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa8b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbaa8('0x0'));var util=require(_0xbaa8('0x1'));var path=require(_0xbaa8('0x2'));var timeout=require(_0xbaa8('0x3'));var express=require(_0xbaa8('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbaa8('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0xbaa8('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbaa8('0x6')](_0xbaa8('0x7'),auth[_0xbaa8('0x8')](),controller[_0xbaa8('0x9')]);router['get'](_0xbaa8('0xa'),auth[_0xbaa8('0x8')](),controller['getConfigurations']);router[_0xbaa8('0x6')](_0xbaa8('0xb'),auth[_0xbaa8('0x8')](),controller[_0xbaa8('0xc')]);router[_0xbaa8('0xd')]('/',auth[_0xbaa8('0x8')](),controller['create']);router[_0xbaa8('0xd')](_0xbaa8('0xa'),auth[_0xbaa8('0x8')](),controller[_0xbaa8('0xe')]);router[_0xbaa8('0xf')](_0xbaa8('0x7'),auth[_0xbaa8('0x8')](),controller[_0xbaa8('0x10')]);router[_0xbaa8('0x11')]('/:id',auth[_0xbaa8('0x8')](),controller['destroy']);module[_0xbaa8('0x12')]=router; \ No newline at end of file +var _0xadf8=['path','express','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','util'];(function(_0x381117,_0x36e787){var _0x47cac3=function(_0x139bad){while(--_0x139bad){_0x381117['push'](_0x381117['shift']());}};_0x47cac3(++_0x36e787);}(_0xadf8,0x18f));var _0x8adf=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0xadf8[_0x3b19ea];return _0x40ece9;};'use strict';var multer=require('multer');var util=require(_0x8adf('0x0'));var path=require(_0x8adf('0x1'));var timeout=require('connect-timeout');var express=require(_0x8adf('0x2'));var router=express['Router']();var auth=require(_0x8adf('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8adf('0x4'));var controller=require(_0x8adf('0x5'));router[_0x8adf('0x6')]('/',auth[_0x8adf('0x7')](),controller[_0x8adf('0x8')]);router[_0x8adf('0x6')]('/:id',auth[_0x8adf('0x7')](),controller[_0x8adf('0x9')]);router[_0x8adf('0x6')](_0x8adf('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x8adf('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8adf('0xb')]);router['post']('/',auth[_0x8adf('0x7')](),controller['create']);router[_0x8adf('0xc')](_0x8adf('0xa'),auth[_0x8adf('0x7')](),controller[_0x8adf('0xd')]);router[_0x8adf('0xe')](_0x8adf('0xf'),auth[_0x8adf('0x7')](),controller[_0x8adf('0x10')]);router[_0x8adf('0x11')](_0x8adf('0xf'),auth[_0x8adf('0x7')](),controller[_0x8adf('0x12')]);module[_0x8adf('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index c962047..ebf00ed 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 _0x38b2=['remoteUri','sequelize','exports','STRING','username'];(function(_0x53482e,_0xf69ff6){var _0xd2d619=function(_0x58e70e){while(--_0x58e70e){_0x53482e['push'](_0x53482e['shift']());}};_0xd2d619(++_0xf69ff6);}(_0x38b2,0xf6));var _0x238b=function(_0x3d23e1,_0x2f50f6){_0x3d23e1=_0x3d23e1-0x0;var _0x3cd3bc=_0x38b2[_0x3d23e1];return _0x3cd3bc;};'use strict';var Sequelize=require(_0x238b('0x0'));module[_0x238b('0x1')]={'name':{'type':Sequelize[_0x238b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x238b('0x3')},'apiKey':{'type':Sequelize[_0x238b('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x238b('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x160f=['sequelize','exports','STRING','username','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf160('0x0'));module[_0xf160('0x1')]={'name':{'type':Sequelize[_0xf160('0x2')]},'description':{'type':Sequelize[_0xf160('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xf160('0x3')},'apiKey':{'type':Sequelize[_0xf160('0x2')]},'remoteUri':{'type':Sequelize[_0xf160('0x2')],'unique':_0xf160('0x4')},'serverUrl':{'type':Sequelize[_0xf160('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 82ccb74..289ccce 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 _0xa41a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','end','status','json','count','offset','limit','Content-Range','apply','update','destroy','sendStatus','name','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','FreshdeskConfiguration','map','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','subject','description','priority','source','ticket_type','company','includes','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','send','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce'];(function(_0xc2db1,_0x3aaa66){var _0xd31e47=function(_0x5c10a7){while(--_0x5c10a7){_0xc2db1['push'](_0xc2db1['shift']());}};_0xd31e47(++_0x3aaa66);}(_0xa41a,0x6b));var _0xaa41=function(_0x40e242,_0x1d1a54){_0x40e242=_0x40e242-0x0;var _0x534572=_0xa41a[_0x40e242];return _0x534572;};'use strict';var pdf=require(_0xaa41('0x0'));var emlformat=require(_0xaa41('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xaa41('0x2'));var jsonpatch=require(_0xaa41('0x3'));var rp=require(_0xaa41('0x4'));var moment=require(_0xaa41('0x5'));var BPromise=require(_0xaa41('0x6'));var Mustache=require(_0xaa41('0x7'));var util=require(_0xaa41('0x8'));var path=require(_0xaa41('0x9'));var sox=require('sox');var csv=require(_0xaa41('0xa'));var ejs=require(_0xaa41('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xa'));var querystring=require(_0xaa41('0xe'));var Papa=require(_0xaa41('0xf'));var Redis=require(_0xaa41('0x10'));var authService=require(_0xaa41('0x11'));var qs=require(_0xaa41('0x12'));var as=require(_0xaa41('0x13'));var hardwareService=require(_0xaa41('0x14'));var logger=require(_0xaa41('0x15'))('api');var utils=require(_0xaa41('0x16'));var config=require(_0xaa41('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xaa41('0x18'));var client=jayson['client'][_0xaa41('0x19')]({'port':0x232a});function checkPasswordPattern(_0x12d9e6,_0x2f64bc,_0x889d44){if(_0x889d44){var _0x6f9ade=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6f9ade['test'](_0x2f64bc)){return _0x12d9e6;}else{throw new db[(_0xaa41('0x1a'))][(_0xaa41('0x1b'))](_0xaa41('0x1c'));}}else{return _0x12d9e6;}}function respondWithRpcPromise(_0x1ef7d9,_0x2a6988,_0x2005ae,_0x1e1e02){return new BPromise(function(_0x550ad5,_0x2d868a){var _0x16b930=_0x1e1e02||client;return _0x16b930[_0xaa41('0x1d')](_0x1ef7d9,_0x2005ae)[_0xaa41('0x1e')](function(_0x230a6a){logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2a6988,_0xaa41('0x21'));logger[_0xaa41('0x22')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2a6988,'request\x20sent',JSON[_0xaa41('0x23')](_0x230a6a));if(_0x230a6a[_0xaa41('0x24')]){if(_0x230a6a[_0xaa41('0x24')]['code']===0x1f4){logger[_0xaa41('0x24')](_0xaa41('0x20'),_0x2a6988,_0x230a6a['error']['message']);return _0x2d868a(_0x230a6a[_0xaa41('0x24')]['message']);}logger[_0xaa41('0x24')](_0xaa41('0x20'),_0x2a6988,_0x230a6a[_0xaa41('0x24')][_0xaa41('0x25')]);return _0x550ad5(_0x230a6a[_0xaa41('0x24')]['message']);}else{logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2a6988,_0xaa41('0x21'));_0x550ad5(_0x230a6a[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x5c3074){logger['error'](_0xaa41('0x20'),_0x2a6988,_0x5c3074);_0x2d868a(_0x5c3074);});});}function respondWithStatusCode(_0x527cac,_0x493a10){_0x493a10=_0x493a10||0xcc;return function(_0x12e362){if(_0x12e362){return _0x527cac['sendStatus'](_0x493a10);}return _0x527cac['status'](_0x493a10)[_0xaa41('0x28')]();};}function respondWithResult(_0x9c8c21,_0x392214){_0x392214=_0x392214||0xc8;return function(_0x632fd2){if(_0x632fd2){return _0x9c8c21[_0xaa41('0x29')](_0x392214)[_0xaa41('0x2a')](_0x632fd2);}};}function respondWithFilteredResult(_0x57ef96,_0x30a174){return function(_0x1f0275){if(_0x1f0275){var _0x63c18c=_0x1f0275[_0xaa41('0x2b')],_0x9a16e3=_0x30a174[_0xaa41('0x2c')],_0x1d8c2b=_0x30a174['offset']+_0x30a174[_0xaa41('0x2d')],_0x4466a3;if(_0x1d8c2b>=_0x63c18c){_0x1d8c2b=_0x63c18c;_0x4466a3=0xc8;}else{_0x4466a3=0xce;}_0x57ef96['status'](_0x4466a3);return _0x57ef96['set'](_0xaa41('0x2e'),_0x9a16e3+'-'+_0x1d8c2b+'/'+_0x63c18c)[_0xaa41('0x2a')](_0x1f0275);}return null;};}function patchUpdates(_0x534a85){return function(_0x392b5d){try{jsonpatch[_0xaa41('0x2f')](_0x392b5d,_0x534a85,!![]);}catch(_0x4e3b44){return BPromise['reject'](_0x4e3b44);}return _0x392b5d['save']();};}function saveUpdates(_0x1cf3da,_0x2f5cc0){return function(_0x2a186e){if(_0x2a186e){return _0x2a186e[_0xaa41('0x30')](_0x1cf3da)['then'](function(_0x289c4a){return _0x289c4a;});}return null;};}function removeEntity(_0x45c8fe,_0x3e0204){return function(_0x4de770){if(_0x4de770){return _0x4de770[_0xaa41('0x31')]()[_0xaa41('0x1e')](function(){_0x45c8fe[_0xaa41('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252c62,_0x374117){return function(_0x57fe1d){if(!_0x57fe1d){_0x252c62[_0xaa41('0x32')](0x194);}return _0x57fe1d;};}function handleError(_0x13b6d4,_0x2298ed){_0x2298ed=_0x2298ed||0x1f4;return function(_0x5cec87){logger[_0xaa41('0x24')](_0x5cec87['stack']);if(_0x5cec87[_0xaa41('0x33')]){delete _0x5cec87[_0xaa41('0x33')];}_0x13b6d4[_0xaa41('0x29')](_0x2298ed)['send'](_0x5cec87);};}exports['index']=function(_0x4cdd42,_0x2dc05a){var _0x2e785f={},_0x1334c8={},_0x224eb3={'count':0x0,'rows':[]};var _0x4fbb92=_['map'](db[_0xaa41('0x34')][_0xaa41('0x35')],function(_0x951e52){return{'name':_0x951e52[_0xaa41('0x36')],'type':_0x951e52[_0xaa41('0x37')][_0xaa41('0x38')]};});_0x1334c8[_0xaa41('0x39')]=_['map'](_0x4fbb92,_0xaa41('0x33'));_0x1334c8[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x4cdd42[_0xaa41('0x3a')]);_0x1334c8['filters']=_['intersection'](_0x1334c8[_0xaa41('0x39')],_0x1334c8[_0xaa41('0x3a')]);_0x2e785f['attributes']=_[_0xaa41('0x3c')](_0x1334c8['model'],qs[_0xaa41('0x3d')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x3d')]));_0x2e785f[_0xaa41('0x3e')]=_0x2e785f[_0xaa41('0x3e')][_0xaa41('0x3f')]?_0x2e785f[_0xaa41('0x3e')]:_0x1334c8[_0xaa41('0x39')];if(!_0x4cdd42['query'][_0xaa41('0x40')](_0xaa41('0x41'))){_0x2e785f[_0xaa41('0x2d')]=qs[_0xaa41('0x2d')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x2d')]);_0x2e785f['offset']=qs['offset'](_0x4cdd42[_0xaa41('0x3a')]['offset']);}_0x2e785f[_0xaa41('0x42')]=qs[_0xaa41('0x43')](_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x43')]);_0x2e785f[_0xaa41('0x44')]=qs[_0xaa41('0x45')](_[_0xaa41('0x46')](_0x4cdd42['query'],_0x1334c8[_0xaa41('0x45')]),_0x4fbb92);if(_0x4cdd42['query']['filter']){_0x2e785f[_0xaa41('0x44')]=_['merge'](_0x2e785f['where'],{'$or':_['map'](_0x4fbb92,function(_0x3bad48){if(_0x3bad48['type']!==_0xaa41('0x47')){var _0x198716={};_0x198716[_0x3bad48['name']]={'$like':'%'+_0x4cdd42['query'][_0xaa41('0x48')]+'%'};return _0x198716;}})});}_0x2e785f=_[_0xaa41('0x49')]({},_0x2e785f,_0x4cdd42[_0xaa41('0x4a')]);var _0x2af8ba={'where':_0x2e785f[_0xaa41('0x44')]};return db[_0xaa41('0x34')][_0xaa41('0x2b')](_0x2af8ba)[_0xaa41('0x1e')](function(_0x2fa6ec){_0x224eb3['count']=_0x2fa6ec;if(_0x4cdd42[_0xaa41('0x3a')][_0xaa41('0x4b')]){_0x2e785f[_0xaa41('0x4c')]=[{'all':!![]}];}return db[_0xaa41('0x34')][_0xaa41('0x4d')](_0x2e785f);})[_0xaa41('0x1e')](function(_0x538b12){_0x224eb3[_0xaa41('0x4e')]=_0x538b12;return _0x224eb3;})[_0xaa41('0x1e')](respondWithFilteredResult(_0x2dc05a,_0x2e785f))[_0xaa41('0x27')](handleError(_0x2dc05a,null));};exports[_0xaa41('0x4f')]=function(_0x57d1f6,_0x23bc61){var _0x5787f3={'raw':![],'where':{'id':_0x57d1f6[_0xaa41('0x50')]['id']}},_0x49fedd={};_0x49fedd[_0xaa41('0x39')]=_[_0xaa41('0x3b')](db['FreshdeskAccount'][_0xaa41('0x35')]);_0x49fedd[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x57d1f6['query']);_0x49fedd[_0xaa41('0x45')]=_[_0xaa41('0x3c')](_0x49fedd[_0xaa41('0x39')],_0x49fedd[_0xaa41('0x3a')]);_0x5787f3[_0xaa41('0x3e')]=_[_0xaa41('0x3c')](_0x49fedd[_0xaa41('0x39')],qs[_0xaa41('0x3d')](_0x57d1f6['query'][_0xaa41('0x3d')]));_0x5787f3['attributes']=_0x5787f3['attributes'][_0xaa41('0x3f')]?_0x5787f3[_0xaa41('0x3e')]:_0x49fedd[_0xaa41('0x39')];if(_0x57d1f6[_0xaa41('0x3a')][_0xaa41('0x4b')]){_0x5787f3[_0xaa41('0x4c')]=[{'all':!![]}];}_0x5787f3=_[_0xaa41('0x49')]({},_0x5787f3,_0x57d1f6[_0xaa41('0x4a')]);return db['FreshdeskAccount'][_0xaa41('0x51')](_0x5787f3)[_0xaa41('0x1e')](handleEntityNotFound(_0x23bc61,null))[_0xaa41('0x1e')](respondWithResult(_0x23bc61,null))['catch'](handleError(_0x23bc61,null));};exports[_0xaa41('0x52')]=function(_0x35f664,_0x4cf674){return db[_0xaa41('0x34')][_0xaa41('0x52')](_0x35f664[_0xaa41('0x53')],{})['then'](respondWithResult(_0x4cf674,0xc9))[_0xaa41('0x27')](handleError(_0x4cf674,null));};exports[_0xaa41('0x30')]=function(_0x4e3b13,_0x49789a){if(_0x4e3b13[_0xaa41('0x53')]['id']){delete _0x4e3b13[_0xaa41('0x53')]['id'];}return db[_0xaa41('0x34')]['find']({'where':{'id':_0x4e3b13[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x49789a,null))[_0xaa41('0x1e')](saveUpdates(_0x4e3b13[_0xaa41('0x53')],null))[_0xaa41('0x1e')](respondWithResult(_0x49789a,null))['catch'](handleError(_0x49789a,null));};exports[_0xaa41('0x31')]=function(_0x57cb70,_0x555186){return db[_0xaa41('0x34')]['find']({'where':{'id':_0x57cb70[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x555186,null))[_0xaa41('0x1e')](removeEntity(_0x555186,null))['catch'](handleError(_0x555186,null));};exports[_0xaa41('0x54')]=function(_0x41c7f4,_0x36154e,_0x857bbc){var _0xa1f9f9={};var _0x332a3c={};var _0xc56018;var _0x337059;return db[_0xaa41('0x34')]['findOne']({'where':{'id':_0x41c7f4[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x36154e,null))[_0xaa41('0x1e')](function(_0x5a5a55){if(_0x5a5a55){_0xc56018=_0x5a5a55;_0x332a3c[_0xaa41('0x39')]=_[_0xaa41('0x3b')](db[_0xaa41('0x55')][_0xaa41('0x35')]);_0x332a3c[_0xaa41('0x3a')]=_[_0xaa41('0x3b')](_0x41c7f4[_0xaa41('0x3a')]);_0x332a3c['filters']=_['intersection'](_0x332a3c['model'],_0x332a3c['query']);_0xa1f9f9['attributes']=_['intersection'](_0x332a3c[_0xaa41('0x39')],qs['fields'](_0x41c7f4['query'][_0xaa41('0x3d')]));_0xa1f9f9[_0xaa41('0x3e')]=_0xa1f9f9[_0xaa41('0x3e')][_0xaa41('0x3f')]?_0xa1f9f9['attributes']:_0x332a3c[_0xaa41('0x39')];_0xa1f9f9[_0xaa41('0x42')]=qs[_0xaa41('0x43')](_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x43')]);_0xa1f9f9[_0xaa41('0x44')]=qs[_0xaa41('0x45')](_[_0xaa41('0x46')](_0x41c7f4[_0xaa41('0x3a')],_0x332a3c['filters']));if(_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x48')]){_0xa1f9f9['where']=_['merge'](_0xa1f9f9['where'],{'$or':_[_0xaa41('0x56')](_0xa1f9f9['attributes'],function(_0x1eac4a){var _0x5c8028={};_0x5c8028[_0x1eac4a]={'$like':'%'+_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x48')]+'%'};return _0x5c8028;})});}_0xa1f9f9=_['merge']({},_0xa1f9f9,_0x41c7f4[_0xaa41('0x4a')]);return _0xc56018[_0xaa41('0x54')](_0xa1f9f9);}})[_0xaa41('0x1e')](function(_0x33f5c2){if(_0x33f5c2){_0x337059=_0x33f5c2['length'];if(!_0x41c7f4['query'][_0xaa41('0x40')](_0xaa41('0x41'))){_0xa1f9f9['limit']=qs['limit'](_0x41c7f4[_0xaa41('0x3a')][_0xaa41('0x2d')]);_0xa1f9f9[_0xaa41('0x2c')]=qs[_0xaa41('0x2c')](_0x41c7f4[_0xaa41('0x3a')]['offset']);}return _0xc56018[_0xaa41('0x54')](_0xa1f9f9);}})['then'](function(_0x5062db){if(_0x5062db){return _0x5062db?{'count':_0x337059,'rows':_0x5062db}:null;}})['then'](respondWithResult(_0x36154e,null))[_0xaa41('0x27')](handleError(_0x36154e,null));};exports[_0xaa41('0x57')]=function(_0x436362,_0x5bad74,_0x229297){if(_0x436362[_0xaa41('0x53')]['id']){delete _0x436362[_0xaa41('0x53')]['id'];}return db[_0xaa41('0x34')][_0xaa41('0x58')]({'where':{'id':_0x436362[_0xaa41('0x50')]['id']}})[_0xaa41('0x1e')](handleEntityNotFound(_0x5bad74,null))['then'](function(_0x1d2978){if(_0x1d2978){_0x436362[_0xaa41('0x53')][_0xaa41('0x59')]=_0x1d2978['id'];_0x436362[_0xaa41('0x53')]['Subjects']=integrations[_0xaa41('0x5a')](_0x436362['body'][_0xaa41('0x5b')],_0x436362[_0xaa41('0x53')][_0xaa41('0x37')]);_0x436362[_0xaa41('0x53')]['Descriptions']=integrations[_0xaa41('0x5c')](_0x436362[_0xaa41('0x53')][_0xaa41('0x5b')],_0x436362[_0xaa41('0x53')]['type']);return db[_0xaa41('0x55')]['create'](_0x436362[_0xaa41('0x53')],{'include':[{'model':db[_0xaa41('0x5d')],'as':'Subjects'},{'model':db[_0xaa41('0x5d')],'as':_0xaa41('0x5e')}]});}return null;})[_0xaa41('0x1e')](respondWithResult(_0x5bad74,null))[_0xaa41('0x27')](handleError(_0x5bad74,null));};exports[_0xaa41('0x5f')]=function(_0x1338d3,_0x384aba,_0x297ec6){var _0x33b5f4='';return db[_0xaa41('0x34')][_0xaa41('0x58')]({'where':{'id':_0x1338d3['params']['id']},'attributes':['id',_0xaa41('0x60'),_0xaa41('0x61')]})[_0xaa41('0x1e')](handleEntityNotFound(_0x384aba,null))['then'](function(_0x5ec19b){if(_0x5ec19b){_0x33b5f4=_0x5ec19b[_0xaa41('0x60')];var _0x39da69=_0x33b5f4['slice'](-0x1);if(_0x39da69==='/'){_0x33b5f4=_0x33b5f4[_0xaa41('0x62')](0x0,_0x33b5f4[_0xaa41('0x63')](_0x39da69));}return rp({'method':'GET','uri':util[_0xaa41('0x64')](_0xaa41('0x65'),_0x33b5f4,_0xaa41('0x66')),'headers':{'Authorization':util[_0xaa41('0x64')](_0xaa41('0x67'),new Buffer(util[_0xaa41('0x64')](_0xaa41('0x68'),_0x5ec19b[_0xaa41('0x61')]))['toString']('base64'))},'json':!![]});}})[_0xaa41('0x1e')](function(_0x481db9){if(_0x481db9){var _0x654594=[_0xaa41('0x69'),_0xaa41('0x6a'),'agent',_0xaa41('0x6b'),_0xaa41('0x29'),_0xaa41('0x6c'),'group',_0xaa41('0x6d'),_0xaa41('0x6e'),'group',_0xaa41('0x6f')];_['remove'](_0x481db9,function(_0x53faf4){return _0x654594[_0xaa41('0x70')](_0x53faf4[_0xaa41('0x33')])||!_0x53faf4['default']&&_0x53faf4['type']!==_0xaa41('0x71')&&_0x53faf4[_0xaa41('0x37')]!==_0xaa41('0x72');});return{'count':_0x481db9[_0xaa41('0x3f')],'rows':_['map'](_0x481db9,function(_0x9741a8){return{'id':_0x9741a8[_0xaa41('0x33')],'name':_0x9741a8[_0xaa41('0x73')],'custom':!_0x9741a8['default'],'options':_0x9741a8[_0xaa41('0x74')]?_[_0xaa41('0x56')](_0x9741a8[_0xaa41('0x74')],function(_0x5697b6){return{'name':_[_0xaa41('0x75')](_0x5697b6),'value':_0x5697b6};}):[]};})};}})['then'](respondWithResult(_0x384aba,null))['catch'](function(_0x364d24){var _0x25c4d0=_0x1338d3['query'][_0xaa41('0x76')]?0x1f4:_0x364d24[_0xaa41('0x77')]||0x1f4;logger[_0xaa41('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xaa41('0x5f'),_0x25c4d0,JSON[_0xaa41('0x23')](_0x364d24));delete _0x364d24[_0xaa41('0x33')];if(_0x25c4d0===0x191){_0x25c4d0=0x190;}_0x384aba[_0xaa41('0x29')](_0x25c4d0)[_0xaa41('0x78')](_0x1338d3['query'][_0xaa41('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x364d24[_0xaa41('0x77')]}:_0x364d24);});}; \ No newline at end of file +var _0x1cb9=['reject','save','update','destroy','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','keys','include','find','create','body','params','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Descriptions','channel','FreshdeskConfiguration','Subjects','FreshdeskField','getFields','remoteUri','slice','substring','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','Sequelize','ValidationError','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply'];(function(_0x479bb8,_0x7dd48e){var _0x2be2fd=function(_0x2544ac){while(--_0x2544ac){_0x479bb8['push'](_0x479bb8['shift']());}};_0x2be2fd(++_0x7dd48e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x511d3c,_0x2483e5){_0x511d3c=_0x511d3c-0x0;var _0x413d9e=_0x1cb9[_0x511d3c];return _0x413d9e;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x91cb('0x18'));var jayson=require(_0x91cb('0x19'));var client=jayson['client'][_0x91cb('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ea707,_0x44f2e9,_0x2c7d40){if(_0x2c7d40){var _0x4a7d45=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a7d45['test'](_0x44f2e9)){return _0x3ea707;}else{throw new db[(_0x91cb('0x1b'))][(_0x91cb('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3ea707;}}function respondWithRpcPromise(_0x528f73,_0x576369,_0xc3629e,_0x347980){return new BPromise(function(_0x5ea796,_0x238f11){var _0x135890=_0x347980||client;return _0x135890['request'](_0x528f73,_0xc3629e)[_0x91cb('0x1d')](function(_0x139f4b){logger[_0x91cb('0x1e')](_0x91cb('0x1f'),_0x576369,'request\x20sent');logger[_0x91cb('0x20')](_0x91cb('0x21'),_0x576369,'request\x20sent',JSON[_0x91cb('0x22')](_0x139f4b));if(_0x139f4b['error']){if(_0x139f4b['error'][_0x91cb('0x23')]===0x1f4){logger[_0x91cb('0x24')]('FreshdeskAccount,\x20%s,\x20%s',_0x576369,_0x139f4b['error']['message']);return _0x238f11(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x139f4b['error'][_0x91cb('0x25')]);return _0x5ea796(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}else{logger['info'](_0x91cb('0x1f'),_0x576369,_0x91cb('0x26'));_0x5ea796(_0x139f4b[_0x91cb('0x27')][_0x91cb('0x25')]);}})[_0x91cb('0x28')](function(_0x7ad361){logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x7ad361);_0x238f11(_0x7ad361);});});}function respondWithStatusCode(_0x264e9b,_0x4c8438){_0x4c8438=_0x4c8438||0xcc;return function(_0x59bf3a){if(_0x59bf3a){return _0x264e9b[_0x91cb('0x29')](_0x4c8438);}return _0x264e9b['status'](_0x4c8438)[_0x91cb('0x2a')]();};}function respondWithResult(_0x34d372,_0x318031){_0x318031=_0x318031||0xc8;return function(_0x5595c5){if(_0x5595c5){return _0x34d372[_0x91cb('0x2b')](_0x318031)['json'](_0x5595c5);}};}function respondWithFilteredResult(_0x4572f6,_0x308e8c){return function(_0x3b3ee6){if(_0x3b3ee6){var _0x2fb473=_0x3b3ee6['count'],_0x468908=_0x308e8c[_0x91cb('0x2c')],_0x504275=_0x308e8c[_0x91cb('0x2c')]+_0x308e8c[_0x91cb('0x2d')],_0x2f04a3;if(_0x504275>=_0x2fb473){_0x504275=_0x2fb473;_0x2f04a3=0xc8;}else{_0x2f04a3=0xce;}_0x4572f6['status'](_0x2f04a3);return _0x4572f6[_0x91cb('0x2e')](_0x91cb('0x2f'),_0x468908+'-'+_0x504275+'/'+_0x2fb473)[_0x91cb('0x30')](_0x3b3ee6);}return null;};}function patchUpdates(_0x361e4c){return function(_0xf296bc){try{jsonpatch[_0x91cb('0x31')](_0xf296bc,_0x361e4c,!![]);}catch(_0x1e5bf1){return BPromise[_0x91cb('0x32')](_0x1e5bf1);}return _0xf296bc[_0x91cb('0x33')]();};}function saveUpdates(_0x5e6ed3,_0x2ccf6e){return function(_0x474a15){if(_0x474a15){return _0x474a15[_0x91cb('0x34')](_0x5e6ed3)[_0x91cb('0x1d')](function(_0x440060){return _0x440060;});}return null;};}function removeEntity(_0x4e70cd,_0x2409d3){return function(_0x74b443){if(_0x74b443){return _0x74b443[_0x91cb('0x35')]()[_0x91cb('0x1d')](function(){_0x4e70cd[_0x91cb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121c37,_0x5927cb){return function(_0x47fc17){if(!_0x47fc17){_0x121c37['sendStatus'](0x194);}return _0x47fc17;};}function handleError(_0x2011fc,_0x4bba88){_0x4bba88=_0x4bba88||0x1f4;return function(_0x341ebe){logger['error'](_0x341ebe['stack']);if(_0x341ebe[_0x91cb('0x36')]){delete _0x341ebe[_0x91cb('0x36')];}_0x2011fc[_0x91cb('0x2b')](_0x4bba88)[_0x91cb('0x37')](_0x341ebe);};}exports[_0x91cb('0x38')]=function(_0x4b0ca6,_0x8beb3a){var _0x3ddc0b={},_0x13a5ea={},_0x8496a3={'count':0x0,'rows':[]};var _0x486a89=_['map'](db[_0x91cb('0x39')][_0x91cb('0x3a')],function(_0x56d614){return{'name':_0x56d614[_0x91cb('0x3b')],'type':_0x56d614[_0x91cb('0x3c')]['key']};});_0x13a5ea[_0x91cb('0x3d')]=_[_0x91cb('0x3e')](_0x486a89,'name');_0x13a5ea[_0x91cb('0x3f')]=_['keys'](_0x4b0ca6[_0x91cb('0x3f')]);_0x13a5ea[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x13a5ea[_0x91cb('0x3d')],_0x13a5ea[_0x91cb('0x3f')]);_0x3ddc0b[_0x91cb('0x42')]=_['intersection'](_0x13a5ea[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x4b0ca6['query'][_0x91cb('0x43')]));_0x3ddc0b['attributes']=_0x3ddc0b[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3ddc0b[_0x91cb('0x42')]:_0x13a5ea[_0x91cb('0x3d')];if(!_0x4b0ca6['query'][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3ddc0b[_0x91cb('0x2d')]=qs[_0x91cb('0x2d')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3ddc0b[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2c')]);}_0x3ddc0b['order']=qs[_0x91cb('0x47')](_0x4b0ca6['query'][_0x91cb('0x47')]);_0x3ddc0b['where']=qs[_0x91cb('0x40')](_['pick'](_0x4b0ca6[_0x91cb('0x3f')],_0x13a5ea[_0x91cb('0x40')]),_0x486a89);if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3ddc0b['where']=_[_0x91cb('0x49')](_0x3ddc0b[_0x91cb('0x4a')],{'$or':_['map'](_0x486a89,function(_0x461e1e){if(_0x461e1e[_0x91cb('0x3c')]!==_0x91cb('0x4b')){var _0x32517d={};_0x32517d[_0x461e1e[_0x91cb('0x36')]]={'$like':'%'+_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x32517d;}})});}_0x3ddc0b=_[_0x91cb('0x49')]({},_0x3ddc0b,_0x4b0ca6[_0x91cb('0x4c')]);var _0x4b26f6={'where':_0x3ddc0b[_0x91cb('0x4a')]};return db[_0x91cb('0x39')][_0x91cb('0x4d')](_0x4b26f6)[_0x91cb('0x1d')](function(_0x3314cc){_0x8496a3[_0x91cb('0x4d')]=_0x3314cc;if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x3ddc0b['include']=[{'all':!![]}];}return db[_0x91cb('0x39')][_0x91cb('0x4f')](_0x3ddc0b);})[_0x91cb('0x1d')](function(_0x3b8cfd){_0x8496a3['rows']=_0x3b8cfd;return _0x8496a3;})[_0x91cb('0x1d')](respondWithFilteredResult(_0x8beb3a,_0x3ddc0b))[_0x91cb('0x28')](handleError(_0x8beb3a,null));};exports['show']=function(_0x212473,_0x47cdb7){var _0x2c419b={'raw':![],'where':{'id':_0x212473['params']['id']}},_0x4c0acd={};_0x4c0acd['model']=_[_0x91cb('0x50')](db[_0x91cb('0x39')][_0x91cb('0x3a')]);_0x4c0acd[_0x91cb('0x3f')]=_[_0x91cb('0x50')](_0x212473['query']);_0x4c0acd['filters']=_[_0x91cb('0x41')](_0x4c0acd[_0x91cb('0x3d')],_0x4c0acd[_0x91cb('0x3f')]);_0x2c419b[_0x91cb('0x42')]=_['intersection'](_0x4c0acd['model'],qs['fields'](_0x212473[_0x91cb('0x3f')]['fields']));_0x2c419b[_0x91cb('0x42')]=_0x2c419b['attributes'][_0x91cb('0x44')]?_0x2c419b[_0x91cb('0x42')]:_0x4c0acd[_0x91cb('0x3d')];if(_0x212473[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x2c419b[_0x91cb('0x51')]=[{'all':!![]}];}_0x2c419b=_[_0x91cb('0x49')]({},_0x2c419b,_0x212473[_0x91cb('0x4c')]);return db[_0x91cb('0x39')][_0x91cb('0x52')](_0x2c419b)[_0x91cb('0x1d')](handleEntityNotFound(_0x47cdb7,null))['then'](respondWithResult(_0x47cdb7,null))[_0x91cb('0x28')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x53')]=function(_0x4d7a34,_0x3f719b){return db[_0x91cb('0x39')]['create'](_0x4d7a34[_0x91cb('0x54')],{})[_0x91cb('0x1d')](respondWithResult(_0x3f719b,0xc9))[_0x91cb('0x28')](handleError(_0x3f719b,null));};exports[_0x91cb('0x34')]=function(_0x43ddee,_0x42a9ef){if(_0x43ddee[_0x91cb('0x54')]['id']){delete _0x43ddee[_0x91cb('0x54')]['id'];}return db[_0x91cb('0x39')][_0x91cb('0x52')]({'where':{'id':_0x43ddee[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x42a9ef,null))[_0x91cb('0x1d')](saveUpdates(_0x43ddee['body'],null))[_0x91cb('0x1d')](respondWithResult(_0x42a9ef,null))['catch'](handleError(_0x42a9ef,null));};exports[_0x91cb('0x35')]=function(_0x1b2fec,_0x1986d7){return db['FreshdeskAccount'][_0x91cb('0x52')]({'where':{'id':_0x1b2fec[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x1986d7,null))[_0x91cb('0x1d')](removeEntity(_0x1986d7,null))[_0x91cb('0x28')](handleError(_0x1986d7,null));};exports[_0x91cb('0x56')]=function(_0x25548b,_0x48e825,_0x2f5658){var _0x3854e9={};var _0x4250c2={};var _0x373076;var _0x55a0e3;return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x25548b['params']['id']}})['then'](handleEntityNotFound(_0x48e825,null))[_0x91cb('0x1d')](function(_0x525021){if(_0x525021){_0x373076=_0x525021;_0x4250c2[_0x91cb('0x3d')]=_[_0x91cb('0x50')](db['FreshdeskConfiguration']['rawAttributes']);_0x4250c2[_0x91cb('0x3f')]=_['keys'](_0x25548b[_0x91cb('0x3f')]);_0x4250c2[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x4250c2['model'],_0x4250c2[_0x91cb('0x3f')]);_0x3854e9['attributes']=_[_0x91cb('0x41')](_0x4250c2[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x25548b[_0x91cb('0x3f')]['fields']));_0x3854e9[_0x91cb('0x42')]=_0x3854e9[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3854e9[_0x91cb('0x42')]:_0x4250c2[_0x91cb('0x3d')];_0x3854e9[_0x91cb('0x58')]=qs[_0x91cb('0x47')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x47')]);_0x3854e9[_0x91cb('0x4a')]=qs[_0x91cb('0x40')](_[_0x91cb('0x59')](_0x25548b['query'],_0x4250c2[_0x91cb('0x40')]));if(_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3854e9[_0x91cb('0x4a')]=_[_0x91cb('0x49')](_0x3854e9[_0x91cb('0x4a')],{'$or':_[_0x91cb('0x3e')](_0x3854e9['attributes'],function(_0x325b2d){var _0x5a3c7d={};_0x5a3c7d[_0x325b2d]={'$like':'%'+_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x5a3c7d;})});}_0x3854e9=_[_0x91cb('0x49')]({},_0x3854e9,_0x25548b[_0x91cb('0x4c')]);return _0x373076['getConfigurations'](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x22ab40){if(_0x22ab40){_0x55a0e3=_0x22ab40[_0x91cb('0x44')];if(!_0x25548b[_0x91cb('0x3f')][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3854e9['limit']=qs[_0x91cb('0x2d')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3854e9[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2c')]);}return _0x373076[_0x91cb('0x56')](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x457f81){if(_0x457f81){return _0x457f81?{'count':_0x55a0e3,'rows':_0x457f81}:null;}})[_0x91cb('0x1d')](respondWithResult(_0x48e825,null))[_0x91cb('0x28')](handleError(_0x48e825,null));};exports[_0x91cb('0x5a')]=function(_0x3eead5,_0x2d2613,_0x2605c3){if(_0x3eead5[_0x91cb('0x54')]['id']){delete _0x3eead5['body']['id'];}return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x3eead5['params']['id']}})[_0x91cb('0x1d')](handleEntityNotFound(_0x2d2613,null))[_0x91cb('0x1d')](function(_0x1c3e0a){if(_0x1c3e0a){_0x3eead5['body'][_0x91cb('0x5b')]=_0x1c3e0a['id'];_0x3eead5[_0x91cb('0x54')]['Subjects']=integrations['getSubjects'](_0x3eead5[_0x91cb('0x54')]['channel'],_0x3eead5[_0x91cb('0x54')][_0x91cb('0x3c')]);_0x3eead5['body'][_0x91cb('0x5c')]=integrations['getDescriptions'](_0x3eead5[_0x91cb('0x54')][_0x91cb('0x5d')],_0x3eead5['body']['type']);return db[_0x91cb('0x5e')][_0x91cb('0x53')](_0x3eead5[_0x91cb('0x54')],{'include':[{'model':db['FreshdeskField'],'as':_0x91cb('0x5f')},{'model':db[_0x91cb('0x60')],'as':_0x91cb('0x5c')}]});}return null;})[_0x91cb('0x1d')](respondWithResult(_0x2d2613,null))['catch'](handleError(_0x2d2613,null));};exports[_0x91cb('0x61')]=function(_0x4ee1e3,_0x342587,_0x4118eb){var _0x30c607='';return db[_0x91cb('0x39')]['findOne']({'where':{'id':_0x4ee1e3['params']['id']},'attributes':['id',_0x91cb('0x62'),'apiKey']})[_0x91cb('0x1d')](handleEntityNotFound(_0x342587,null))[_0x91cb('0x1d')](function(_0x2ede77){if(_0x2ede77){_0x30c607=_0x2ede77[_0x91cb('0x62')];var _0x33d4ab=_0x30c607[_0x91cb('0x63')](-0x1);if(_0x33d4ab==='/'){_0x30c607=_0x30c607[_0x91cb('0x64')](0x0,_0x30c607['lastIndexOf'](_0x33d4ab));}return rp({'method':_0x91cb('0x65'),'uri':util[_0x91cb('0x66')]('%s/%s',_0x30c607,_0x91cb('0x67')),'headers':{'Authorization':util['format'](_0x91cb('0x68'),new Buffer(util[_0x91cb('0x66')](_0x91cb('0x69'),_0x2ede77[_0x91cb('0x6a')]))[_0x91cb('0x6b')](_0x91cb('0x6c')))},'json':!![]});}})[_0x91cb('0x1d')](function(_0x30259d){if(_0x30259d){var _0x23380a=[_0x91cb('0x6d'),_0x91cb('0x6e'),_0x91cb('0x6f'),_0x91cb('0x70'),_0x91cb('0x2b'),_0x91cb('0x71'),_0x91cb('0x72'),'source',_0x91cb('0x73'),'group',_0x91cb('0x74')];_[_0x91cb('0x75')](_0x30259d,function(_0x13f358){return _0x23380a[_0x91cb('0x76')](_0x13f358[_0x91cb('0x36')])||!_0x13f358[_0x91cb('0x77')]&&_0x13f358[_0x91cb('0x3c')]!==_0x91cb('0x78')&&_0x13f358['type']!==_0x91cb('0x79');});return{'count':_0x30259d[_0x91cb('0x44')],'rows':_['map'](_0x30259d,function(_0x4fb3c0){return{'id':_0x4fb3c0[_0x91cb('0x36')],'name':_0x4fb3c0['label'],'custom':!_0x4fb3c0['default'],'options':_0x4fb3c0[_0x91cb('0x7a')]?_['map'](_0x4fb3c0[_0x91cb('0x7a')],function(_0x498382){return{'name':_[_0x91cb('0x7b')](_0x498382),'value':_0x498382};}):[]};})};}})[_0x91cb('0x1d')](respondWithResult(_0x342587,null))[_0x91cb('0x28')](function(_0x443c01){var _0x4e899c=_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?0x1f4:_0x443c01[_0x91cb('0x7d')]||0x1f4;logger[_0x91cb('0x24')](_0x91cb('0x7e'),_0x91cb('0x61'),_0x4e899c,JSON[_0x91cb('0x22')](_0x443c01));delete _0x443c01[_0x91cb('0x36')];if(_0x4e899c===0x191){_0x4e899c=0x190;}_0x342587[_0x91cb('0x2b')](_0x4e899c)[_0x91cb('0x37')](_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x7c')]?{'message':_0x91cb('0x7f'),'statusCode':_0x443c01[_0x91cb('0x7d')]}:_0x443c01);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e29ccd3..ab77e55 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 _0xdeeb=['bluebird','request-promise','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xdeeb,0x17c));var _0xbdee=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0xdeeb[_0x2ff238];return _0x204a56;};'use strict';var _=require(_0xbdee('0x0'));var util=require('util');var logger=require(_0xbdee('0x1'))(_0xbdee('0x2'));var moment=require(_0xbdee('0x3'));var BPromise=require(_0xbdee('0x4'));var rp=require(_0xbdee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdee('0x6'));var config=require('../../config/environment');var attributes=require(_0xbdee('0x7'));var integrations=require(_0xbdee('0x8'));module['exports']=function(_0x3fd2d6,_0x449369){return _0x3fd2d6[_0xbdee('0x9')](_0xbdee('0xa'),attributes,{'tableName':_0xbdee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe66f=['bluebird','request-promise','path','./intFreshdeskAccount.attributes','exports','define','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1345ca,_0x1613af){var _0x512713=function(_0x5d9974){while(--_0x5d9974){_0x1345ca['push'](_0x1345ca['shift']());}};_0x512713(++_0x1613af);}(_0xe66f,0xdf));var _0xfe66=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe66f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfe66('0x0'));var util=require(_0xfe66('0x1'));var logger=require(_0xfe66('0x2'))(_0xfe66('0x3'));var moment=require(_0xfe66('0x4'));var BPromise=require(_0xfe66('0x5'));var rp=require(_0xfe66('0x6'));var fs=require('fs');var path=require(_0xfe66('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfe66('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xfe66('0x9')]=function(_0x2b61c9,_0x1498fa){return _0x2b61c9[_0xfe66('0xa')]('FreshdeskAccount',attributes,{'tableName':_0xfe66('0xb'),'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 1680911..bfdd1f3 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 _0x7400=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowFreshdeskAccount','FreshdeskAccount','find','where','lodash','util','moment'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7400,0xcf));var _0x0740=function(_0x30bef2,_0x3d4186){_0x30bef2=_0x30bef2-0x0;var _0x567d67=_0x7400[_0x30bef2];return _0x567d67;};'use strict';var _=require(_0x0740('0x0'));var util=require(_0x0740('0x1'));var moment=require(_0x0740('0x2'));var BPromise=require('bluebird');var rs=require(_0x0740('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0740('0x4'))['db'];var utils=require(_0x0740('0x5'));var logger=require(_0x0740('0x6'))(_0x0740('0x7'));var config=require(_0x0740('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0740('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c9978,_0x54258e,_0x48d5f1){return new BPromise(function(_0x466ee2,_0x5e5fe5){return client['request'](_0x3c9978,_0x48d5f1)[_0x0740('0xa')](function(_0x6e501d){logger[_0x0740('0xb')](_0x0740('0xc'),_0x54258e,_0x0740('0xd'));logger[_0x0740('0xe')](_0x0740('0xf'),_0x54258e,_0x0740('0xd'),JSON[_0x0740('0x10')](_0x6e501d));if(_0x6e501d[_0x0740('0x11')]){if(_0x6e501d[_0x0740('0x11')][_0x0740('0x12')]===0x1f4){logger[_0x0740('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x54258e,_0x6e501d[_0x0740('0x11')][_0x0740('0x13')]);return _0x5e5fe5(_0x6e501d[_0x0740('0x11')][_0x0740('0x13')]);}logger[_0x0740('0x11')](_0x0740('0xc'),_0x54258e,_0x6e501d[_0x0740('0x11')][_0x0740('0x13')]);return _0x466ee2(_0x6e501d['error'][_0x0740('0x13')]);}else{logger[_0x0740('0xb')](_0x0740('0xc'),_0x54258e,_0x0740('0xd'));_0x466ee2(_0x6e501d[_0x0740('0x14')][_0x0740('0x13')]);}})[_0x0740('0x15')](function(_0x2472dc){logger[_0x0740('0x11')](_0x0740('0xc'),_0x54258e,_0x2472dc);_0x5e5fe5(_0x2472dc);});});}exports[_0x0740('0x16')]=function(_0x560360){var _0x148e3a=this;return new Promise(function(_0x62bb01,_0x38baef){return db['FreshdeskAccount'][_0x0740('0x17')]({'raw':_0x560360[_0x0740('0x18')]?_0x560360[_0x0740('0x18')][_0x0740('0x19')]===undefined?!![]:![]:!![],'where':_0x560360['options']?_0x560360[_0x0740('0x18')]['where']||null:null,'attributes':_0x560360['options']?_0x560360[_0x0740('0x18')][_0x0740('0x1a')]||null:null,'limit':_0x560360[_0x0740('0x18')]?_0x560360['options'][_0x0740('0x1b')]||null:null,'include':_0x560360['options']?_0x560360[_0x0740('0x18')][_0x0740('0x1c')]?_[_0x0740('0x1d')](_0x560360[_0x0740('0x18')][_0x0740('0x1c')],function(_0x301cda){return{'model':db[_0x301cda[_0x0740('0x1e')]],'as':_0x301cda['as'],'attributes':_0x301cda[_0x0740('0x1a')],'include':_0x301cda[_0x0740('0x1c')]?_[_0x0740('0x1d')](_0x301cda[_0x0740('0x1c')],function(_0x1ad1b0){return{'model':db[_0x1ad1b0[_0x0740('0x1e')]],'as':_0x1ad1b0['as'],'attributes':_0x1ad1b0['attributes'],'include':_0x1ad1b0[_0x0740('0x1c')]?_[_0x0740('0x1d')](_0x1ad1b0['include'],function(_0x239a28){return{'model':db[_0x239a28['model']],'as':_0x239a28['as'],'attributes':_0x239a28[_0x0740('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0740('0xa')](function(_0x56f046){logger[_0x0740('0xb')]('GetFreshdeskAccount',_0x560360);logger[_0x0740('0xe')](_0x0740('0x16'),_0x560360,JSON[_0x0740('0x10')](_0x56f046));_0x62bb01(_0x56f046);})['catch'](function(_0x4f23a3){logger[_0x0740('0x11')](_0x0740('0x16'),_0x4f23a3[_0x0740('0x13')],_0x560360);_0x38baef(_0x148e3a[_0x0740('0x11')](0x1f4,_0x4f23a3[_0x0740('0x13')]));});});};exports[_0x0740('0x1f')]=function(_0x21dba9){var _0x53cb8a=this;return new Promise(function(_0x299edc,_0x3b4e10){return db[_0x0740('0x20')][_0x0740('0x21')]({'raw':_0x21dba9[_0x0740('0x18')]?_0x21dba9['options'][_0x0740('0x19')]===undefined?!![]:![]:!![],'where':_0x21dba9[_0x0740('0x18')]?_0x21dba9['options'][_0x0740('0x22')]||null:null,'attributes':_0x21dba9[_0x0740('0x18')]?_0x21dba9['options']['attributes']||null:null,'include':_0x21dba9[_0x0740('0x18')]?_0x21dba9[_0x0740('0x18')]['include']?_[_0x0740('0x1d')](_0x21dba9['options'][_0x0740('0x1c')],function(_0x1ceff7){return{'model':db[_0x1ceff7[_0x0740('0x1e')]],'as':_0x1ceff7['as'],'attributes':_0x1ceff7['attributes'],'include':_0x1ceff7['include']?_['map'](_0x1ceff7[_0x0740('0x1c')],function(_0x91a2fb){return{'model':db[_0x91a2fb['model']],'as':_0x91a2fb['as'],'attributes':_0x91a2fb[_0x0740('0x1a')],'include':_0x91a2fb[_0x0740('0x1c')]?_[_0x0740('0x1d')](_0x91a2fb[_0x0740('0x1c')],function(_0x26402e){return{'model':db[_0x26402e[_0x0740('0x1e')]],'as':_0x26402e['as'],'attributes':_0x26402e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0740('0xa')](function(_0x1ae6fd){logger[_0x0740('0xb')](_0x0740('0x1f'),_0x21dba9);logger[_0x0740('0xe')](_0x0740('0x1f'),_0x21dba9,JSON[_0x0740('0x10')](_0x1ae6fd));_0x299edc(_0x1ae6fd);})['catch'](function(_0x3174d4){logger['error'](_0x0740('0x1f'),_0x3174d4[_0x0740('0x13')],_0x21dba9);_0x3b4e10(_0x53cb8a[_0x0740('0x11')](0x1f4,_0x3174d4[_0x0740('0x13')]));});});}; \ No newline at end of file +var _0x37fc=['message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x37fc,0x19d));var _0xc37f=function(_0x219892,_0x41b943){_0x219892=_0x219892-0x0;var _0x3b09f3=_0x37fc[_0x219892];return _0x3b09f3;};'use strict';var _=require(_0xc37f('0x0'));var util=require(_0xc37f('0x1'));var moment=require(_0xc37f('0x2'));var BPromise=require(_0xc37f('0x3'));var rs=require(_0xc37f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc37f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc37f('0x6'))(_0xc37f('0x7'));var config=require(_0xc37f('0x8'));var jayson=require(_0xc37f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51a7ef,_0x6e179c,_0x54a938){return new BPromise(function(_0x41b5ff,_0x448daa){return client[_0xc37f('0xa')](_0x51a7ef,_0x54a938)[_0xc37f('0xb')](function(_0x263744){logger[_0xc37f('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x6e179c,_0xc37f('0xd'));logger[_0xc37f('0xe')](_0xc37f('0xf'),_0x6e179c,'request\x20sent',JSON['stringify'](_0x263744));if(_0x263744[_0xc37f('0x10')]){if(_0x263744[_0xc37f('0x10')][_0xc37f('0x11')]===0x1f4){logger[_0xc37f('0x10')](_0xc37f('0x12'),_0x6e179c,_0x263744[_0xc37f('0x10')][_0xc37f('0x13')]);return _0x448daa(_0x263744['error'][_0xc37f('0x13')]);}logger[_0xc37f('0x10')](_0xc37f('0x12'),_0x6e179c,_0x263744[_0xc37f('0x10')][_0xc37f('0x13')]);return _0x41b5ff(_0x263744['error'][_0xc37f('0x13')]);}else{logger['info'](_0xc37f('0x12'),_0x6e179c,'request\x20sent');_0x41b5ff(_0x263744[_0xc37f('0x14')][_0xc37f('0x13')]);}})['catch'](function(_0x1ff606){logger[_0xc37f('0x10')](_0xc37f('0x12'),_0x6e179c,_0x1ff606);_0x448daa(_0x1ff606);});});}exports[_0xc37f('0x15')]=function(_0x161dd4){var _0x1fadf9=this;return new Promise(function(_0x546e04,_0x5b782d){return db[_0xc37f('0x16')][_0xc37f('0x17')]({'raw':_0x161dd4[_0xc37f('0x18')]?_0x161dd4[_0xc37f('0x18')][_0xc37f('0x19')]===undefined?!![]:![]:!![],'where':_0x161dd4[_0xc37f('0x18')]?_0x161dd4['options'][_0xc37f('0x1a')]||null:null,'attributes':_0x161dd4[_0xc37f('0x18')]?_0x161dd4['options'][_0xc37f('0x1b')]||null:null,'limit':_0x161dd4[_0xc37f('0x18')]?_0x161dd4[_0xc37f('0x18')][_0xc37f('0x1c')]||null:null,'include':_0x161dd4[_0xc37f('0x18')]?_0x161dd4['options']['include']?_[_0xc37f('0x1d')](_0x161dd4['options'][_0xc37f('0x1e')],function(_0x578361){return{'model':db[_0x578361[_0xc37f('0x1f')]],'as':_0x578361['as'],'attributes':_0x578361['attributes'],'include':_0x578361[_0xc37f('0x1e')]?_[_0xc37f('0x1d')](_0x578361[_0xc37f('0x1e')],function(_0x30ea8d){return{'model':db[_0x30ea8d[_0xc37f('0x1f')]],'as':_0x30ea8d['as'],'attributes':_0x30ea8d[_0xc37f('0x1b')],'include':_0x30ea8d[_0xc37f('0x1e')]?_['map'](_0x30ea8d['include'],function(_0x7d3bd3){return{'model':db[_0x7d3bd3[_0xc37f('0x1f')]],'as':_0x7d3bd3['as'],'attributes':_0x7d3bd3[_0xc37f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc37f('0xb')](function(_0x2160ea){logger[_0xc37f('0xc')](_0xc37f('0x15'),_0x161dd4);logger[_0xc37f('0xe')](_0xc37f('0x15'),_0x161dd4,JSON[_0xc37f('0x20')](_0x2160ea));_0x546e04(_0x2160ea);})[_0xc37f('0x21')](function(_0x5699c6){logger['error'](_0xc37f('0x15'),_0x5699c6[_0xc37f('0x13')],_0x161dd4);_0x5b782d(_0x1fadf9[_0xc37f('0x10')](0x1f4,_0x5699c6[_0xc37f('0x13')]));});});};exports[_0xc37f('0x22')]=function(_0x8c3f58){var _0x24ccd3=this;return new Promise(function(_0x38f468,_0x3c2b47){return db[_0xc37f('0x16')][_0xc37f('0x23')]({'raw':_0x8c3f58[_0xc37f('0x18')]?_0x8c3f58[_0xc37f('0x18')][_0xc37f('0x19')]===undefined?!![]:![]:!![],'where':_0x8c3f58[_0xc37f('0x18')]?_0x8c3f58[_0xc37f('0x18')][_0xc37f('0x1a')]||null:null,'attributes':_0x8c3f58[_0xc37f('0x18')]?_0x8c3f58['options'][_0xc37f('0x1b')]||null:null,'include':_0x8c3f58[_0xc37f('0x18')]?_0x8c3f58['options'][_0xc37f('0x1e')]?_[_0xc37f('0x1d')](_0x8c3f58['options'][_0xc37f('0x1e')],function(_0x3f6a75){return{'model':db[_0x3f6a75[_0xc37f('0x1f')]],'as':_0x3f6a75['as'],'attributes':_0x3f6a75[_0xc37f('0x1b')],'include':_0x3f6a75[_0xc37f('0x1e')]?_['map'](_0x3f6a75[_0xc37f('0x1e')],function(_0xe89261){return{'model':db[_0xe89261[_0xc37f('0x1f')]],'as':_0xe89261['as'],'attributes':_0xe89261[_0xc37f('0x1b')],'include':_0xe89261[_0xc37f('0x1e')]?_[_0xc37f('0x1d')](_0xe89261[_0xc37f('0x1e')],function(_0x224f0a){return{'model':db[_0x224f0a['model']],'as':_0x224f0a['as'],'attributes':_0x224f0a['attributes']};}):[]};}):[]};}):[]:[]})[_0xc37f('0xb')](function(_0x104d76){logger['info'](_0xc37f('0x22'),_0x8c3f58);logger[_0xc37f('0xe')](_0xc37f('0x22'),_0x8c3f58,JSON[_0xc37f('0x20')](_0x104d76));_0x38f468(_0x104d76);})[_0xc37f('0x21')](function(_0xa31f65){logger[_0xc37f('0x10')]('ShowFreshdeskAccount',_0xa31f65[_0xc37f('0x13')],_0x8c3f58);_0x3c2b47(_0x24ccd3[_0xc37f('0x10')](0x1f4,_0xa31f65['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ab3eecf..7906405 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 _0x6adb=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6adb,0x93));var _0xb6ad=function(_0x582246,_0xa45179){_0x582246=_0x582246-0x0;var _0x2bcbcd=_0x6adb[_0x582246];return _0x2bcbcd;};'use strict';var multer=require(_0xb6ad('0x0'));var util=require(_0xb6ad('0x1'));var path=require(_0xb6ad('0x2'));var timeout=require(_0xb6ad('0x3'));var express=require(_0xb6ad('0x4'));var router=express[_0xb6ad('0x5')]();var auth=require(_0xb6ad('0x6'));var interaction=require(_0xb6ad('0x7'));var config=require(_0xb6ad('0x8'));var controller=require('./intFreshdeskConfiguration.controller');router[_0xb6ad('0x9')]('/',auth[_0xb6ad('0xa')](),controller[_0xb6ad('0xb')]);router[_0xb6ad('0x9')]('/:id',auth[_0xb6ad('0xa')](),controller[_0xb6ad('0xc')]);router[_0xb6ad('0x9')]('/:id/fields',auth[_0xb6ad('0xa')](),controller[_0xb6ad('0xd')]);router[_0xb6ad('0x9')](_0xb6ad('0xe'),auth['isAuthenticated'](),controller[_0xb6ad('0xf')]);router['get'](_0xb6ad('0x10'),auth['isAuthenticated'](),controller[_0xb6ad('0x11')]);router['get'](_0xb6ad('0x12'),auth[_0xb6ad('0xa')](),controller[_0xb6ad('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb6ad('0x14')]);router['post'](_0xb6ad('0x12'),auth[_0xb6ad('0xa')](),controller['setTags']);router['put'](_0xb6ad('0x15'),auth[_0xb6ad('0xa')](),controller['update']);router['delete'](_0xb6ad('0x15'),auth['isAuthenticated'](),controller[_0xb6ad('0x16')]);module['exports']=router; \ No newline at end of file +var _0x6e19=['../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6e19,0x13a));var _0x96e1=function(_0x2b4c2b,_0x257224){_0x2b4c2b=_0x2b4c2b-0x0;var _0x48c347=_0x6e19[_0x2b4c2b];return _0x48c347;};'use strict';var multer=require(_0x96e1('0x0'));var util=require('util');var path=require(_0x96e1('0x1'));var timeout=require('connect-timeout');var express=require(_0x96e1('0x2'));var router=express[_0x96e1('0x3')]();var auth=require(_0x96e1('0x4'));var interaction=require(_0x96e1('0x5'));var config=require(_0x96e1('0x6'));var controller=require(_0x96e1('0x7'));router[_0x96e1('0x8')]('/',auth[_0x96e1('0x9')](),controller[_0x96e1('0xa')]);router[_0x96e1('0x8')]('/:id',auth[_0x96e1('0x9')](),controller[_0x96e1('0xb')]);router['get'](_0x96e1('0xc'),auth[_0x96e1('0x9')](),controller[_0x96e1('0xd')]);router[_0x96e1('0x8')](_0x96e1('0xe'),auth[_0x96e1('0x9')](),controller[_0x96e1('0xf')]);router['get'](_0x96e1('0x10'),auth[_0x96e1('0x9')](),controller[_0x96e1('0x11')]);router[_0x96e1('0x8')](_0x96e1('0x12'),auth[_0x96e1('0x9')](),controller[_0x96e1('0x13')]);router['post']('/',auth[_0x96e1('0x9')](),controller[_0x96e1('0x14')]);router[_0x96e1('0x15')]('/:id/tags',auth['isAuthenticated'](),controller[_0x96e1('0x16')]);router[_0x96e1('0x17')](_0x96e1('0x18'),auth['isAuthenticated'](),controller[_0x96e1('0x19')]);router[_0x96e1('0x1a')](_0x96e1('0x18'),auth[_0x96e1('0x9')](),controller[_0x96e1('0x1b')]);module[_0x96e1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index c9ce75b..2a5126f 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 _0x96c8=['sequelize','STRING'];(function(_0x54696d,_0x478646){var _0x35cf32=function(_0x5e6c7d){while(--_0x5e6c7d){_0x54696d['push'](_0x54696d['shift']());}};_0x35cf32(++_0x478646);}(_0x96c8,0xbe));var _0x896c=function(_0x1aa65b,_0x2c47c9){_0x1aa65b=_0x1aa65b-0x0;var _0x2b507e=_0x96c8[_0x1aa65b];return _0x2b507e;};'use strict';var Sequelize=require(_0x896c('0x0'));module['exports']={'name':{'type':Sequelize[_0x896c('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed1a=['exports','STRING','sequelize'];(function(_0x59d369,_0x56a533){var _0x58c3eb=function(_0x2acb03){while(--_0x2acb03){_0x59d369['push'](_0x59d369['shift']());}};_0x58c3eb(++_0x56a533);}(_0xed1a,0x8f));var _0xaed1=function(_0x471592,_0x24cbda){_0x471592=_0x471592-0x0;var _0x59fc24=_0xed1a[_0x471592];return _0x59fc24;};'use strict';var Sequelize=require(_0xaed1('0x0'));module[_0xaed1('0x1')]={'name':{'type':Sequelize[_0xaed1('0x2')]},'description':{'type':Sequelize[_0xaed1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 18238b5..7df9a9e 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 _0x3ca4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','request','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskConfiguration,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','save','then','destroy','stack','name','send','index','FreshdeskConfiguration','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','find','create','body','update','findOne','FreshdeskField','rawAttributes','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x3ca4,0x17d));var _0x43ca=function(_0x4d7f31,_0x37375e){_0x4d7f31=_0x4d7f31-0x0;var _0x291b17=_0x3ca4[_0x4d7f31];return _0x291b17;};'use strict';var pdf=require(_0x43ca('0x0'));var emlformat=require(_0x43ca('0x1'));var rimraf=require(_0x43ca('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x43ca('0x3'));var moment=require(_0x43ca('0x4'));var BPromise=require(_0x43ca('0x5'));var Mustache=require(_0x43ca('0x6'));var util=require(_0x43ca('0x7'));var path=require(_0x43ca('0x8'));var sox=require(_0x43ca('0x9'));var csv=require('to-csv');var ejs=require(_0x43ca('0xa'));var fs=require('fs');var _=require(_0x43ca('0xb'));var squel=require(_0x43ca('0xc'));var crypto=require(_0x43ca('0xd'));var jsforce=require(_0x43ca('0xe'));var deskjs=require(_0x43ca('0xf'));var toCsv=require(_0x43ca('0x10'));var querystring=require(_0x43ca('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x43ca('0x12'));var qs=require(_0x43ca('0x13'));var as=require(_0x43ca('0x14'));var hardwareService=require(_0x43ca('0x15'));var logger=require('../../config/logger')(_0x43ca('0x16'));var utils=require(_0x43ca('0x17'));var config=require(_0x43ca('0x18'));var db=require(_0x43ca('0x19'))['db'];var jayson=require(_0x43ca('0x1a'));var client=jayson[_0x43ca('0x1b')][_0x43ca('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2ede07,_0x2150be,_0x55cbce){if(_0x55cbce){var _0x22988c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x22988c[_0x43ca('0x1d')](_0x2150be)){return _0x2ede07;}else{throw new db['Sequelize'][(_0x43ca('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 _0x2ede07;}}function respondWithRpcPromise(_0x316c74,_0x567579,_0xdccc62,_0x1a8bf6){return new BPromise(function(_0x51a517,_0xd306dc){var _0x366180=_0x1a8bf6||client;return _0x366180[_0x43ca('0x1f')](_0x316c74,_0xdccc62)['then'](function(_0x4fb5e4){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x567579,_0x43ca('0x20'));logger[_0x43ca('0x21')](_0x43ca('0x22'),_0x567579,'request\x20sent',JSON[_0x43ca('0x23')](_0x4fb5e4));if(_0x4fb5e4[_0x43ca('0x24')]){if(_0x4fb5e4[_0x43ca('0x24')]['code']===0x1f4){logger[_0x43ca('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x567579,_0x4fb5e4[_0x43ca('0x24')][_0x43ca('0x25')]);return _0xd306dc(_0x4fb5e4[_0x43ca('0x24')]['message']);}logger[_0x43ca('0x24')](_0x43ca('0x26'),_0x567579,_0x4fb5e4[_0x43ca('0x24')][_0x43ca('0x25')]);return _0x51a517(_0x4fb5e4[_0x43ca('0x24')]['message']);}else{logger[_0x43ca('0x27')](_0x43ca('0x26'),_0x567579,'request\x20sent');_0x51a517(_0x4fb5e4[_0x43ca('0x28')][_0x43ca('0x25')]);}})[_0x43ca('0x29')](function(_0x3bc9ae){logger[_0x43ca('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x567579,_0x3bc9ae);_0xd306dc(_0x3bc9ae);});});}function respondWithStatusCode(_0x2da1ec,_0xc07cde){_0xc07cde=_0xc07cde||0xcc;return function(_0x29f2ee){if(_0x29f2ee){return _0x2da1ec[_0x43ca('0x2a')](_0xc07cde);}return _0x2da1ec[_0x43ca('0x2b')](_0xc07cde)[_0x43ca('0x2c')]();};}function respondWithResult(_0x3b2078,_0x428fc0){_0x428fc0=_0x428fc0||0xc8;return function(_0x5aa57c){if(_0x5aa57c){return _0x3b2078['status'](_0x428fc0)['json'](_0x5aa57c);}};}function respondWithFilteredResult(_0x137877,_0x3a2e47){return function(_0x270393){if(_0x270393){var _0x9d09b9=_0x270393[_0x43ca('0x2d')],_0x34dc4f=_0x3a2e47['offset'],_0x36884b=_0x3a2e47[_0x43ca('0x2e')]+_0x3a2e47['limit'],_0xffad2d;if(_0x36884b>=_0x9d09b9){_0x36884b=_0x9d09b9;_0xffad2d=0xc8;}else{_0xffad2d=0xce;}_0x137877['status'](_0xffad2d);return _0x137877[_0x43ca('0x2f')](_0x43ca('0x30'),_0x34dc4f+'-'+_0x36884b+'/'+_0x9d09b9)[_0x43ca('0x31')](_0x270393);}return null;};}function patchUpdates(_0x359b7c){return function(_0x248ec3){try{jsonpatch['apply'](_0x248ec3,_0x359b7c,!![]);}catch(_0x1689cf){return BPromise['reject'](_0x1689cf);}return _0x248ec3[_0x43ca('0x32')]();};}function saveUpdates(_0x58e62f,_0x31fc55){return function(_0x194d00){if(_0x194d00){return _0x194d00['update'](_0x58e62f)[_0x43ca('0x33')](function(_0xce2d1a){return _0xce2d1a;});}return null;};}function removeEntity(_0x3ae919,_0x2a2f8a){return function(_0x46650d){if(_0x46650d){return _0x46650d[_0x43ca('0x34')]()[_0x43ca('0x33')](function(){_0x3ae919['status'](0xcc)[_0x43ca('0x2c')]();});}};}function handleEntityNotFound(_0x5976a3,_0x23e6ba){return function(_0x3ac086){if(!_0x3ac086){_0x5976a3['sendStatus'](0x194);}return _0x3ac086;};}function handleError(_0x33b0b6,_0x5ce3a0){_0x5ce3a0=_0x5ce3a0||0x1f4;return function(_0x49ef94){logger[_0x43ca('0x24')](_0x49ef94[_0x43ca('0x35')]);if(_0x49ef94[_0x43ca('0x36')]){delete _0x49ef94[_0x43ca('0x36')];}_0x33b0b6[_0x43ca('0x2b')](_0x5ce3a0)[_0x43ca('0x37')](_0x49ef94);};}exports[_0x43ca('0x38')]=function(_0x524e5f,_0x43b29b){var _0x67b8b0={},_0x5b8cca={},_0x35d5ff={'count':0x0,'rows':[]};var _0x2372c0=_['map'](db[_0x43ca('0x39')]['rawAttributes'],function(_0x5a4224){return{'name':_0x5a4224[_0x43ca('0x3a')],'type':_0x5a4224[_0x43ca('0x3b')][_0x43ca('0x3c')]};});_0x5b8cca[_0x43ca('0x3d')]=_[_0x43ca('0x3e')](_0x2372c0,_0x43ca('0x36'));_0x5b8cca[_0x43ca('0x3f')]=_[_0x43ca('0x40')](_0x524e5f[_0x43ca('0x3f')]);_0x5b8cca[_0x43ca('0x41')]=_[_0x43ca('0x42')](_0x5b8cca[_0x43ca('0x3d')],_0x5b8cca['query']);_0x67b8b0['attributes']=_[_0x43ca('0x42')](_0x5b8cca[_0x43ca('0x3d')],qs[_0x43ca('0x43')](_0x524e5f['query'][_0x43ca('0x43')]));_0x67b8b0['attributes']=_0x67b8b0[_0x43ca('0x44')]['length']?_0x67b8b0[_0x43ca('0x44')]:_0x5b8cca[_0x43ca('0x3d')];if(!_0x524e5f[_0x43ca('0x3f')][_0x43ca('0x45')](_0x43ca('0x46'))){_0x67b8b0[_0x43ca('0x47')]=qs['limit'](_0x524e5f['query'][_0x43ca('0x47')]);_0x67b8b0[_0x43ca('0x2e')]=qs[_0x43ca('0x2e')](_0x524e5f[_0x43ca('0x3f')][_0x43ca('0x2e')]);}_0x67b8b0[_0x43ca('0x48')]=qs[_0x43ca('0x49')](_0x524e5f[_0x43ca('0x3f')][_0x43ca('0x49')]);_0x67b8b0[_0x43ca('0x4a')]=qs[_0x43ca('0x41')](_[_0x43ca('0x4b')](_0x524e5f[_0x43ca('0x3f')],_0x5b8cca[_0x43ca('0x41')]),_0x2372c0);if(_0x524e5f[_0x43ca('0x3f')][_0x43ca('0x4c')]){_0x67b8b0[_0x43ca('0x4a')]=_[_0x43ca('0x4d')](_0x67b8b0[_0x43ca('0x4a')],{'$or':_[_0x43ca('0x3e')](_0x2372c0,function(_0x21bd31){if(_0x21bd31['type']!==_0x43ca('0x4e')){var _0x1b1e8f={};_0x1b1e8f[_0x21bd31[_0x43ca('0x36')]]={'$like':'%'+_0x524e5f['query'][_0x43ca('0x4c')]+'%'};return _0x1b1e8f;}})});}_0x67b8b0=_[_0x43ca('0x4d')]({},_0x67b8b0,_0x524e5f[_0x43ca('0x4f')]);var _0x3f5bda={'where':_0x67b8b0[_0x43ca('0x4a')]};return db[_0x43ca('0x39')][_0x43ca('0x2d')](_0x3f5bda)[_0x43ca('0x33')](function(_0x475c){_0x35d5ff[_0x43ca('0x2d')]=_0x475c;if(_0x524e5f[_0x43ca('0x3f')]['includeAll']){_0x67b8b0[_0x43ca('0x50')]=[{'all':!![]}];}return db[_0x43ca('0x39')][_0x43ca('0x51')](_0x67b8b0);})['then'](function(_0x4bbf51){_0x35d5ff[_0x43ca('0x52')]=_0x4bbf51;return _0x35d5ff;})['then'](respondWithFilteredResult(_0x43b29b,_0x67b8b0))[_0x43ca('0x29')](handleError(_0x43b29b,null));};exports['show']=function(_0x2ef30e,_0x25e0fd){var _0x45cafd={'raw':![],'where':{'id':_0x2ef30e[_0x43ca('0x53')]['id']}},_0x50b728={};_0x50b728[_0x43ca('0x3d')]=_['keys'](db[_0x43ca('0x39')]['rawAttributes']);_0x50b728['query']=_[_0x43ca('0x40')](_0x2ef30e[_0x43ca('0x3f')]);_0x50b728[_0x43ca('0x41')]=_[_0x43ca('0x42')](_0x50b728[_0x43ca('0x3d')],_0x50b728[_0x43ca('0x3f')]);_0x45cafd['attributes']=_['intersection'](_0x50b728[_0x43ca('0x3d')],qs[_0x43ca('0x43')](_0x2ef30e['query']['fields']));_0x45cafd[_0x43ca('0x44')]=_0x45cafd['attributes'][_0x43ca('0x54')]?_0x45cafd[_0x43ca('0x44')]:_0x50b728[_0x43ca('0x3d')];if(_0x2ef30e['query'][_0x43ca('0x55')]){_0x45cafd[_0x43ca('0x50')]=[{'all':!![]}];}_0x45cafd=_['merge']({},_0x45cafd,_0x2ef30e['options']);return db[_0x43ca('0x39')][_0x43ca('0x56')](_0x45cafd)[_0x43ca('0x33')](handleEntityNotFound(_0x25e0fd,null))[_0x43ca('0x33')](respondWithResult(_0x25e0fd,null))[_0x43ca('0x29')](handleError(_0x25e0fd,null));};exports[_0x43ca('0x57')]=function(_0x4c2c71,_0x591fdb){return db[_0x43ca('0x39')][_0x43ca('0x57')](_0x4c2c71[_0x43ca('0x58')],{})[_0x43ca('0x33')](respondWithResult(_0x591fdb,0xc9))[_0x43ca('0x29')](handleError(_0x591fdb,null));};exports[_0x43ca('0x59')]=function(_0x3aa110,_0xde56cd){if(_0x3aa110[_0x43ca('0x58')]['id']){delete _0x3aa110[_0x43ca('0x58')]['id'];}return db[_0x43ca('0x39')][_0x43ca('0x56')]({'where':{'id':_0x3aa110[_0x43ca('0x53')]['id']}})[_0x43ca('0x33')](handleEntityNotFound(_0xde56cd,null))['then'](saveUpdates(_0x3aa110[_0x43ca('0x58')],null))[_0x43ca('0x33')](respondWithResult(_0xde56cd,null))[_0x43ca('0x29')](handleError(_0xde56cd,null));};exports[_0x43ca('0x34')]=function(_0x40ec30,_0x55c277){return db[_0x43ca('0x39')][_0x43ca('0x56')]({'where':{'id':_0x40ec30['params']['id']}})[_0x43ca('0x33')](handleEntityNotFound(_0x55c277,null))[_0x43ca('0x33')](removeEntity(_0x55c277,null))['catch'](handleError(_0x55c277,null));};exports['getFields']=function(_0x1d6eae,_0x34dc19,_0x43918b){var _0x52f625={};var _0xc63e08={};var _0xd0e5e0;var _0x3f92e2;return db[_0x43ca('0x39')][_0x43ca('0x5a')]({'where':{'id':_0x1d6eae[_0x43ca('0x53')]['id']}})[_0x43ca('0x33')](handleEntityNotFound(_0x34dc19,null))[_0x43ca('0x33')](function(_0x28d2cb){if(_0x28d2cb){_0xd0e5e0=_0x28d2cb;_0xc63e08[_0x43ca('0x3d')]=_['keys'](db[_0x43ca('0x5b')][_0x43ca('0x5c')]);_0xc63e08[_0x43ca('0x3f')]=_[_0x43ca('0x40')](_0x1d6eae[_0x43ca('0x3f')]);_0xc63e08[_0x43ca('0x41')]=_['intersection'](_0xc63e08[_0x43ca('0x3d')],_0xc63e08[_0x43ca('0x3f')]);_0x52f625[_0x43ca('0x44')]=_[_0x43ca('0x42')](_0xc63e08[_0x43ca('0x3d')],qs[_0x43ca('0x43')](_0x1d6eae[_0x43ca('0x3f')][_0x43ca('0x43')]));_0x52f625['attributes']=_0x52f625[_0x43ca('0x44')][_0x43ca('0x54')]?_0x52f625[_0x43ca('0x44')]:_0xc63e08['model'];_0x52f625[_0x43ca('0x48')]=qs[_0x43ca('0x49')](_0x1d6eae['query'][_0x43ca('0x49')]);_0x52f625['where']=qs['filters'](_[_0x43ca('0x4b')](_0x1d6eae[_0x43ca('0x3f')],_0xc63e08[_0x43ca('0x41')]));if(_0x1d6eae[_0x43ca('0x3f')][_0x43ca('0x4c')]){_0x52f625['where']=_[_0x43ca('0x4d')](_0x52f625['where'],{'$or':_[_0x43ca('0x3e')](_0x52f625[_0x43ca('0x44')],function(_0x22623d){var _0x282813={};_0x282813[_0x22623d]={'$like':'%'+_0x1d6eae[_0x43ca('0x3f')][_0x43ca('0x4c')]+'%'};return _0x282813;})});}_0x52f625=_[_0x43ca('0x4d')]({},_0x52f625,_0x1d6eae['options']);return _0xd0e5e0[_0x43ca('0x5d')](_0x52f625);}})[_0x43ca('0x33')](function(_0x3c9844){if(_0x3c9844){_0x3f92e2=_0x3c9844[_0x43ca('0x54')];if(!_0x1d6eae[_0x43ca('0x3f')]['hasOwnProperty'](_0x43ca('0x46'))){_0x52f625[_0x43ca('0x47')]=qs['limit'](_0x1d6eae[_0x43ca('0x3f')][_0x43ca('0x47')]);_0x52f625[_0x43ca('0x2e')]=qs[_0x43ca('0x2e')](_0x1d6eae[_0x43ca('0x3f')][_0x43ca('0x2e')]);}return _0xd0e5e0[_0x43ca('0x5d')](_0x52f625);}})[_0x43ca('0x33')](function(_0x3bcb79){if(_0x3bcb79){return _0x3bcb79?{'count':_0x3f92e2,'rows':_0x3bcb79}:null;}})[_0x43ca('0x33')](respondWithResult(_0x34dc19,null))['catch'](handleError(_0x34dc19,null));};exports[_0x43ca('0x5e')]=function(_0xfdc74a,_0x5661c2,_0x138b31){var _0x304d00={};var _0x1394a2={};var _0x244784;var _0x2568f9;return db['FreshdeskConfiguration'][_0x43ca('0x5a')]({'where':{'id':_0xfdc74a[_0x43ca('0x53')]['id']}})['then'](handleEntityNotFound(_0x5661c2,null))[_0x43ca('0x33')](function(_0x11d403){if(_0x11d403){_0x244784=_0x11d403;_0x1394a2[_0x43ca('0x3d')]=_[_0x43ca('0x40')](db[_0x43ca('0x5b')][_0x43ca('0x5c')]);_0x1394a2[_0x43ca('0x3f')]=_[_0x43ca('0x40')](_0xfdc74a['query']);_0x1394a2['filters']=_[_0x43ca('0x42')](_0x1394a2['model'],_0x1394a2['query']);_0x304d00[_0x43ca('0x44')]=_[_0x43ca('0x42')](_0x1394a2[_0x43ca('0x3d')],qs[_0x43ca('0x43')](_0xfdc74a[_0x43ca('0x3f')][_0x43ca('0x43')]));_0x304d00[_0x43ca('0x44')]=_0x304d00[_0x43ca('0x44')]['length']?_0x304d00['attributes']:_0x1394a2[_0x43ca('0x3d')];_0x304d00[_0x43ca('0x48')]=qs[_0x43ca('0x49')](_0xfdc74a[_0x43ca('0x3f')][_0x43ca('0x49')]);_0x304d00[_0x43ca('0x4a')]=qs[_0x43ca('0x41')](_[_0x43ca('0x4b')](_0xfdc74a[_0x43ca('0x3f')],_0x1394a2[_0x43ca('0x41')]));if(_0xfdc74a[_0x43ca('0x3f')][_0x43ca('0x4c')]){_0x304d00[_0x43ca('0x4a')]=_['merge'](_0x304d00['where'],{'$or':_['map'](_0x304d00[_0x43ca('0x44')],function(_0x27d6c1){var _0x11dea1={};_0x11dea1[_0x27d6c1]={'$like':'%'+_0xfdc74a[_0x43ca('0x3f')][_0x43ca('0x4c')]+'%'};return _0x11dea1;})});}_0x304d00=_[_0x43ca('0x4d')]({},_0x304d00,_0xfdc74a[_0x43ca('0x4f')]);return _0x244784[_0x43ca('0x5e')](_0x304d00);}})[_0x43ca('0x33')](function(_0xf0abf0){if(_0xf0abf0){_0x2568f9=_0xf0abf0['length'];if(!_0xfdc74a['query'][_0x43ca('0x45')](_0x43ca('0x46'))){_0x304d00[_0x43ca('0x47')]=qs[_0x43ca('0x47')](_0xfdc74a['query'][_0x43ca('0x47')]);_0x304d00[_0x43ca('0x2e')]=qs[_0x43ca('0x2e')](_0xfdc74a[_0x43ca('0x3f')][_0x43ca('0x2e')]);}return _0x244784[_0x43ca('0x5e')](_0x304d00);}})[_0x43ca('0x33')](function(_0x2fd878){if(_0x2fd878){return _0x2fd878?{'count':_0x2568f9,'rows':_0x2fd878}:null;}})['then'](respondWithResult(_0x5661c2,null))[_0x43ca('0x29')](handleError(_0x5661c2,null));};exports[_0x43ca('0x5f')]=function(_0x9f61a,_0x2a482a,_0x43d9f9){var _0x29c93b={};var _0x236d95={};var _0x364ab7;var _0x229515;return db[_0x43ca('0x39')][_0x43ca('0x5a')]({'where':{'id':_0x9f61a['params']['id']}})['then'](handleEntityNotFound(_0x2a482a,null))[_0x43ca('0x33')](function(_0x345bff){if(_0x345bff){_0x364ab7=_0x345bff;_0x236d95['model']=_[_0x43ca('0x40')](db[_0x43ca('0x5b')][_0x43ca('0x5c')]);_0x236d95[_0x43ca('0x3f')]=_[_0x43ca('0x40')](_0x9f61a[_0x43ca('0x3f')]);_0x236d95['filters']=_[_0x43ca('0x42')](_0x236d95[_0x43ca('0x3d')],_0x236d95[_0x43ca('0x3f')]);_0x29c93b[_0x43ca('0x44')]=_['intersection'](_0x236d95[_0x43ca('0x3d')],qs[_0x43ca('0x43')](_0x9f61a['query']['fields']));_0x29c93b[_0x43ca('0x44')]=_0x29c93b[_0x43ca('0x44')][_0x43ca('0x54')]?_0x29c93b[_0x43ca('0x44')]:_0x236d95[_0x43ca('0x3d')];_0x29c93b[_0x43ca('0x48')]=qs['sort'](_0x9f61a[_0x43ca('0x3f')][_0x43ca('0x49')]);_0x29c93b[_0x43ca('0x4a')]=qs[_0x43ca('0x41')](_[_0x43ca('0x4b')](_0x9f61a['query'],_0x236d95[_0x43ca('0x41')]));if(_0x9f61a[_0x43ca('0x3f')]['filter']){_0x29c93b[_0x43ca('0x4a')]=_[_0x43ca('0x4d')](_0x29c93b[_0x43ca('0x4a')],{'$or':_[_0x43ca('0x3e')](_0x29c93b[_0x43ca('0x44')],function(_0x268274){var _0x3a88b4={};_0x3a88b4[_0x268274]={'$like':'%'+_0x9f61a['query'][_0x43ca('0x4c')]+'%'};return _0x3a88b4;})});}_0x29c93b=_['merge']({},_0x29c93b,_0x9f61a[_0x43ca('0x4f')]);return _0x364ab7[_0x43ca('0x5f')](_0x29c93b);}})[_0x43ca('0x33')](function(_0x140ce9){if(_0x140ce9){_0x229515=_0x140ce9[_0x43ca('0x54')];if(!_0x9f61a[_0x43ca('0x3f')]['hasOwnProperty'](_0x43ca('0x46'))){_0x29c93b[_0x43ca('0x47')]=qs[_0x43ca('0x47')](_0x9f61a[_0x43ca('0x3f')][_0x43ca('0x47')]);_0x29c93b[_0x43ca('0x2e')]=qs[_0x43ca('0x2e')](_0x9f61a[_0x43ca('0x3f')][_0x43ca('0x2e')]);}return _0x364ab7['getDescriptions'](_0x29c93b);}})[_0x43ca('0x33')](function(_0x19fceb){if(_0x19fceb){return _0x19fceb?{'count':_0x229515,'rows':_0x19fceb}:null;}})['then'](respondWithResult(_0x2a482a,null))[_0x43ca('0x29')](handleError(_0x2a482a,null));};exports['getTags']=function(_0x3c1761,_0x59c2d8,_0xa88d27){var _0x131ef6={};var _0x5b8529={};var _0x29b1d7;var _0x441df6;return db['FreshdeskConfiguration'][_0x43ca('0x5a')]({'where':{'id':_0x3c1761[_0x43ca('0x53')]['id']}})[_0x43ca('0x33')](handleEntityNotFound(_0x59c2d8,null))['then'](function(_0x196cb7){if(_0x196cb7){_0x29b1d7=_0x196cb7;_0x5b8529[_0x43ca('0x3d')]=_[_0x43ca('0x40')](db[_0x43ca('0x60')][_0x43ca('0x5c')]);_0x5b8529['query']=_[_0x43ca('0x40')](_0x3c1761[_0x43ca('0x3f')]);_0x5b8529[_0x43ca('0x41')]=_[_0x43ca('0x42')](_0x5b8529[_0x43ca('0x3d')],_0x5b8529[_0x43ca('0x3f')]);_0x131ef6[_0x43ca('0x44')]=_[_0x43ca('0x42')](_0x5b8529[_0x43ca('0x3d')],qs['fields'](_0x3c1761['query'][_0x43ca('0x43')]));_0x131ef6['attributes']=_0x131ef6[_0x43ca('0x44')][_0x43ca('0x54')]?_0x131ef6['attributes']:_0x5b8529['model'];_0x131ef6[_0x43ca('0x48')]=qs[_0x43ca('0x49')](_0x3c1761[_0x43ca('0x3f')][_0x43ca('0x49')]);_0x131ef6[_0x43ca('0x4a')]=qs[_0x43ca('0x41')](_[_0x43ca('0x4b')](_0x3c1761[_0x43ca('0x3f')],_0x5b8529['filters']));if(_0x3c1761[_0x43ca('0x3f')][_0x43ca('0x4c')]){_0x131ef6['where']=_[_0x43ca('0x4d')](_0x131ef6['where'],{'$or':_['map'](_0x131ef6[_0x43ca('0x44')],function(_0x48b2de){var _0x38516b={};_0x38516b[_0x48b2de]={'$like':'%'+_0x3c1761[_0x43ca('0x3f')][_0x43ca('0x4c')]+'%'};return _0x38516b;})});}_0x131ef6=_[_0x43ca('0x4d')]({},_0x131ef6,_0x3c1761[_0x43ca('0x4f')]);return _0x29b1d7[_0x43ca('0x61')](_0x131ef6);}})[_0x43ca('0x33')](function(_0x10b5c9){if(_0x10b5c9){_0x441df6=_0x10b5c9[_0x43ca('0x54')];if(!_0x3c1761[_0x43ca('0x3f')][_0x43ca('0x45')](_0x43ca('0x46'))){_0x131ef6[_0x43ca('0x47')]=qs['limit'](_0x3c1761['query'][_0x43ca('0x47')]);_0x131ef6['offset']=qs[_0x43ca('0x2e')](_0x3c1761[_0x43ca('0x3f')][_0x43ca('0x2e')]);}return _0x29b1d7[_0x43ca('0x61')](_0x131ef6);}})[_0x43ca('0x33')](function(_0x36376e){if(_0x36376e){return _0x36376e?{'count':_0x441df6,'rows':_0x36376e}:null;}})['then'](respondWithResult(_0x59c2d8,null))['catch'](handleError(_0x59c2d8,null));};exports['setTags']=function(_0x45bca5,_0x1f573b,_0x490642){if(_0x45bca5[_0x43ca('0x58')]['id']){delete _0x45bca5['body']['id'];}return db[_0x43ca('0x39')][_0x43ca('0x5a')]({'where':{'id':_0x45bca5[_0x43ca('0x53')]['id']}})[_0x43ca('0x33')](handleEntityNotFound(_0x1f573b,null))[_0x43ca('0x33')](function(_0x26e9e0){if(_0x26e9e0){return _0x26e9e0[_0x43ca('0x62')](_0x45bca5[_0x43ca('0x58')][_0x43ca('0x63')]||[]);}return null;})['then'](respondWithResult(_0x1f573b,null))[_0x43ca('0x29')](handleError(_0x1f573b,null));}; \ No newline at end of file +var _0xc688=['getSubjects','pick','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','sendStatus','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','includeAll','include','FreshdeskConfiguration','findAll','rows','show','params','intersection','create','body','find','getFields','findOne','FreshdeskField','sort','options'];(function(_0x1c65e4,_0x205372){var _0x469ce6=function(_0x2959b6){while(--_0x2959b6){_0x1c65e4['push'](_0x1c65e4['shift']());}};_0x469ce6(++_0x205372);}(_0xc688,0xc0));var _0x8c68=function(_0x3c7c53,_0x1ce289){_0x3c7c53=_0x3c7c53-0x0;var _0x57085f=_0xc688[_0x3c7c53];return _0x57085f;};'use strict';var pdf=require(_0x8c68('0x0'));var emlformat=require(_0x8c68('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8c68('0x2'));var jsonpatch=require(_0x8c68('0x3'));var rp=require('request-promise');var moment=require(_0x8c68('0x4'));var BPromise=require(_0x8c68('0x5'));var Mustache=require('mustache');var util=require(_0x8c68('0x6'));var path=require('path');var sox=require(_0x8c68('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8c68('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c68('0x9'));var toCsv=require(_0x8c68('0xa'));var querystring=require('querystring');var Papa=require(_0x8c68('0xb'));var Redis=require('ioredis');var authService=require(_0x8c68('0xc'));var qs=require(_0x8c68('0xd'));var as=require(_0x8c68('0xe'));var hardwareService=require(_0x8c68('0xf'));var logger=require('../../config/logger')(_0x8c68('0x10'));var utils=require(_0x8c68('0x11'));var config=require(_0x8c68('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8c68('0x13'));var client=jayson[_0x8c68('0x14')][_0x8c68('0x15')]({'port':0x232a});function checkPasswordPattern(_0x2530e5,_0xda1135,_0xc3b3c1){if(_0xc3b3c1){var _0xe5154=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe5154[_0x8c68('0x16')](_0xda1135)){return _0x2530e5;}else{throw new db[(_0x8c68('0x17'))]['ValidationError'](_0x8c68('0x18'));}}else{return _0x2530e5;}}function respondWithRpcPromise(_0x5da80f,_0x2fac16,_0x5cf64d,_0x513d82){return new BPromise(function(_0x1ae4b3,_0x5a51fd){var _0xbe1456=_0x513d82||client;return _0xbe1456[_0x8c68('0x19')](_0x5da80f,_0x5cf64d)[_0x8c68('0x1a')](function(_0x54b402){logger['info'](_0x8c68('0x1b'),_0x2fac16,'request\x20sent');logger[_0x8c68('0x1c')](_0x8c68('0x1d'),_0x2fac16,_0x8c68('0x1e'),JSON['stringify'](_0x54b402));if(_0x54b402[_0x8c68('0x1f')]){if(_0x54b402[_0x8c68('0x1f')][_0x8c68('0x20')]===0x1f4){logger[_0x8c68('0x1f')](_0x8c68('0x1b'),_0x2fac16,_0x54b402[_0x8c68('0x1f')]['message']);return _0x5a51fd(_0x54b402[_0x8c68('0x1f')][_0x8c68('0x21')]);}logger[_0x8c68('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2fac16,_0x54b402[_0x8c68('0x1f')][_0x8c68('0x21')]);return _0x1ae4b3(_0x54b402[_0x8c68('0x1f')][_0x8c68('0x21')]);}else{logger[_0x8c68('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2fac16,_0x8c68('0x1e'));_0x1ae4b3(_0x54b402[_0x8c68('0x23')]['message']);}})[_0x8c68('0x24')](function(_0x415676){logger['error'](_0x8c68('0x1b'),_0x2fac16,_0x415676);_0x5a51fd(_0x415676);});});}function respondWithStatusCode(_0x3639a6,_0x4e9b1c){_0x4e9b1c=_0x4e9b1c||0xcc;return function(_0x188918){if(_0x188918){return _0x3639a6['sendStatus'](_0x4e9b1c);}return _0x3639a6['status'](_0x4e9b1c)[_0x8c68('0x25')]();};}function respondWithResult(_0x775c40,_0x46a26c){_0x46a26c=_0x46a26c||0xc8;return function(_0x396ea1){if(_0x396ea1){return _0x775c40['status'](_0x46a26c)[_0x8c68('0x26')](_0x396ea1);}};}function respondWithFilteredResult(_0x23c0e6,_0x3b4b92){return function(_0x5e6d5d){if(_0x5e6d5d){var _0x2bbd59=_0x5e6d5d[_0x8c68('0x27')],_0x35613a=_0x3b4b92[_0x8c68('0x28')],_0x45899d=_0x3b4b92[_0x8c68('0x28')]+_0x3b4b92[_0x8c68('0x29')],_0x479429;if(_0x45899d>=_0x2bbd59){_0x45899d=_0x2bbd59;_0x479429=0xc8;}else{_0x479429=0xce;}_0x23c0e6[_0x8c68('0x2a')](_0x479429);return _0x23c0e6[_0x8c68('0x2b')](_0x8c68('0x2c'),_0x35613a+'-'+_0x45899d+'/'+_0x2bbd59)[_0x8c68('0x26')](_0x5e6d5d);}return null;};}function patchUpdates(_0x4983ea){return function(_0x541b17){try{jsonpatch[_0x8c68('0x2d')](_0x541b17,_0x4983ea,!![]);}catch(_0x2fc257){return BPromise[_0x8c68('0x2e')](_0x2fc257);}return _0x541b17[_0x8c68('0x2f')]();};}function saveUpdates(_0xcb1279,_0x5a4531){return function(_0x2cd56f){if(_0x2cd56f){return _0x2cd56f[_0x8c68('0x30')](_0xcb1279)[_0x8c68('0x1a')](function(_0x38eb65){return _0x38eb65;});}return null;};}function removeEntity(_0x41661e,_0x15b45a){return function(_0x2a2273){if(_0x2a2273){return _0x2a2273['destroy']()[_0x8c68('0x1a')](function(){_0x41661e[_0x8c68('0x2a')](0xcc)[_0x8c68('0x25')]();});}};}function handleEntityNotFound(_0x12fd68,_0x2b781f){return function(_0x549aaf){if(!_0x549aaf){_0x12fd68[_0x8c68('0x31')](0x194);}return _0x549aaf;};}function handleError(_0x41d181,_0x277536){_0x277536=_0x277536||0x1f4;return function(_0x21fa7c){logger[_0x8c68('0x1f')](_0x21fa7c['stack']);if(_0x21fa7c[_0x8c68('0x32')]){delete _0x21fa7c[_0x8c68('0x32')];}_0x41d181[_0x8c68('0x2a')](_0x277536)[_0x8c68('0x33')](_0x21fa7c);};}exports[_0x8c68('0x34')]=function(_0x3b4f0d,_0x385a91){var _0x194ff3={},_0x1edcf8={},_0x6c57c1={'count':0x0,'rows':[]};var _0x167274=_[_0x8c68('0x35')](db['FreshdeskConfiguration'][_0x8c68('0x36')],function(_0x29bfd3){return{'name':_0x29bfd3[_0x8c68('0x37')],'type':_0x29bfd3['type'][_0x8c68('0x38')]};});_0x1edcf8[_0x8c68('0x39')]=_[_0x8c68('0x35')](_0x167274,_0x8c68('0x32'));_0x1edcf8[_0x8c68('0x3a')]=_[_0x8c68('0x3b')](_0x3b4f0d['query']);_0x1edcf8[_0x8c68('0x3c')]=_['intersection'](_0x1edcf8[_0x8c68('0x39')],_0x1edcf8[_0x8c68('0x3a')]);_0x194ff3[_0x8c68('0x3d')]=_['intersection'](_0x1edcf8['model'],qs['fields'](_0x3b4f0d['query'][_0x8c68('0x3e')]));_0x194ff3[_0x8c68('0x3d')]=_0x194ff3['attributes'][_0x8c68('0x3f')]?_0x194ff3[_0x8c68('0x3d')]:_0x1edcf8[_0x8c68('0x39')];if(!_0x3b4f0d[_0x8c68('0x3a')][_0x8c68('0x40')](_0x8c68('0x41'))){_0x194ff3[_0x8c68('0x29')]=qs[_0x8c68('0x29')](_0x3b4f0d[_0x8c68('0x3a')]['limit']);_0x194ff3[_0x8c68('0x28')]=qs[_0x8c68('0x28')](_0x3b4f0d[_0x8c68('0x3a')][_0x8c68('0x28')]);}_0x194ff3[_0x8c68('0x42')]=qs['sort'](_0x3b4f0d['query']['sort']);_0x194ff3[_0x8c68('0x43')]=qs[_0x8c68('0x3c')](_['pick'](_0x3b4f0d[_0x8c68('0x3a')],_0x1edcf8[_0x8c68('0x3c')]),_0x167274);if(_0x3b4f0d[_0x8c68('0x3a')]['filter']){_0x194ff3[_0x8c68('0x43')]=_[_0x8c68('0x44')](_0x194ff3[_0x8c68('0x43')],{'$or':_[_0x8c68('0x35')](_0x167274,function(_0x4e871d){if(_0x4e871d['type']!==_0x8c68('0x45')){var _0x5c2dcb={};_0x5c2dcb[_0x4e871d[_0x8c68('0x32')]]={'$like':'%'+_0x3b4f0d['query'][_0x8c68('0x46')]+'%'};return _0x5c2dcb;}})});}_0x194ff3=_[_0x8c68('0x44')]({},_0x194ff3,_0x3b4f0d['options']);var _0x2ae584={'where':_0x194ff3['where']};return db['FreshdeskConfiguration'][_0x8c68('0x27')](_0x2ae584)[_0x8c68('0x1a')](function(_0x4a3a91){_0x6c57c1['count']=_0x4a3a91;if(_0x3b4f0d[_0x8c68('0x3a')][_0x8c68('0x47')]){_0x194ff3[_0x8c68('0x48')]=[{'all':!![]}];}return db[_0x8c68('0x49')][_0x8c68('0x4a')](_0x194ff3);})[_0x8c68('0x1a')](function(_0x4119e4){_0x6c57c1[_0x8c68('0x4b')]=_0x4119e4;return _0x6c57c1;})[_0x8c68('0x1a')](respondWithFilteredResult(_0x385a91,_0x194ff3))[_0x8c68('0x24')](handleError(_0x385a91,null));};exports[_0x8c68('0x4c')]=function(_0x3dd2a9,_0xce7c18){var _0x31483c={'raw':![],'where':{'id':_0x3dd2a9[_0x8c68('0x4d')]['id']}},_0xd1b914={};_0xd1b914[_0x8c68('0x39')]=_[_0x8c68('0x3b')](db[_0x8c68('0x49')][_0x8c68('0x36')]);_0xd1b914[_0x8c68('0x3a')]=_[_0x8c68('0x3b')](_0x3dd2a9[_0x8c68('0x3a')]);_0xd1b914[_0x8c68('0x3c')]=_[_0x8c68('0x4e')](_0xd1b914[_0x8c68('0x39')],_0xd1b914['query']);_0x31483c[_0x8c68('0x3d')]=_[_0x8c68('0x4e')](_0xd1b914[_0x8c68('0x39')],qs[_0x8c68('0x3e')](_0x3dd2a9['query'][_0x8c68('0x3e')]));_0x31483c[_0x8c68('0x3d')]=_0x31483c['attributes'][_0x8c68('0x3f')]?_0x31483c[_0x8c68('0x3d')]:_0xd1b914[_0x8c68('0x39')];if(_0x3dd2a9['query']['includeAll']){_0x31483c[_0x8c68('0x48')]=[{'all':!![]}];}_0x31483c=_['merge']({},_0x31483c,_0x3dd2a9['options']);return db[_0x8c68('0x49')]['find'](_0x31483c)[_0x8c68('0x1a')](handleEntityNotFound(_0xce7c18,null))[_0x8c68('0x1a')](respondWithResult(_0xce7c18,null))[_0x8c68('0x24')](handleError(_0xce7c18,null));};exports[_0x8c68('0x4f')]=function(_0x544136,_0x330d42){return db[_0x8c68('0x49')][_0x8c68('0x4f')](_0x544136[_0x8c68('0x50')],{})['then'](respondWithResult(_0x330d42,0xc9))[_0x8c68('0x24')](handleError(_0x330d42,null));};exports[_0x8c68('0x30')]=function(_0x1d6d2d,_0x1aec09){if(_0x1d6d2d[_0x8c68('0x50')]['id']){delete _0x1d6d2d[_0x8c68('0x50')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x1d6d2d[_0x8c68('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1aec09,null))[_0x8c68('0x1a')](saveUpdates(_0x1d6d2d[_0x8c68('0x50')],null))['then'](respondWithResult(_0x1aec09,null))['catch'](handleError(_0x1aec09,null));};exports['destroy']=function(_0x5b9428,_0x50c3ee){return db['FreshdeskConfiguration'][_0x8c68('0x51')]({'where':{'id':_0x5b9428[_0x8c68('0x4d')]['id']}})['then'](handleEntityNotFound(_0x50c3ee,null))[_0x8c68('0x1a')](removeEntity(_0x50c3ee,null))['catch'](handleError(_0x50c3ee,null));};exports[_0x8c68('0x52')]=function(_0x2b4316,_0x1d8720,_0x5138a5){var _0x4b3544={};var _0x5065e1={};var _0x104b50;var _0x181773;return db[_0x8c68('0x49')][_0x8c68('0x53')]({'where':{'id':_0x2b4316[_0x8c68('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d8720,null))[_0x8c68('0x1a')](function(_0x3a7e40){if(_0x3a7e40){_0x104b50=_0x3a7e40;_0x5065e1['model']=_[_0x8c68('0x3b')](db[_0x8c68('0x54')][_0x8c68('0x36')]);_0x5065e1['query']=_[_0x8c68('0x3b')](_0x2b4316[_0x8c68('0x3a')]);_0x5065e1['filters']=_['intersection'](_0x5065e1[_0x8c68('0x39')],_0x5065e1[_0x8c68('0x3a')]);_0x4b3544[_0x8c68('0x3d')]=_['intersection'](_0x5065e1[_0x8c68('0x39')],qs[_0x8c68('0x3e')](_0x2b4316[_0x8c68('0x3a')]['fields']));_0x4b3544['attributes']=_0x4b3544[_0x8c68('0x3d')][_0x8c68('0x3f')]?_0x4b3544['attributes']:_0x5065e1[_0x8c68('0x39')];_0x4b3544['order']=qs[_0x8c68('0x55')](_0x2b4316[_0x8c68('0x3a')][_0x8c68('0x55')]);_0x4b3544[_0x8c68('0x43')]=qs['filters'](_['pick'](_0x2b4316[_0x8c68('0x3a')],_0x5065e1[_0x8c68('0x3c')]));if(_0x2b4316[_0x8c68('0x3a')][_0x8c68('0x46')]){_0x4b3544[_0x8c68('0x43')]=_['merge'](_0x4b3544[_0x8c68('0x43')],{'$or':_['map'](_0x4b3544['attributes'],function(_0x58e233){var _0x545dc6={};_0x545dc6[_0x58e233]={'$like':'%'+_0x2b4316[_0x8c68('0x3a')][_0x8c68('0x46')]+'%'};return _0x545dc6;})});}_0x4b3544=_['merge']({},_0x4b3544,_0x2b4316[_0x8c68('0x56')]);return _0x104b50[_0x8c68('0x52')](_0x4b3544);}})[_0x8c68('0x1a')](function(_0x2149c5){if(_0x2149c5){_0x181773=_0x2149c5[_0x8c68('0x3f')];if(!_0x2b4316['query'][_0x8c68('0x40')](_0x8c68('0x41'))){_0x4b3544['limit']=qs[_0x8c68('0x29')](_0x2b4316[_0x8c68('0x3a')]['limit']);_0x4b3544[_0x8c68('0x28')]=qs[_0x8c68('0x28')](_0x2b4316['query'][_0x8c68('0x28')]);}return _0x104b50[_0x8c68('0x52')](_0x4b3544);}})[_0x8c68('0x1a')](function(_0x6c7a77){if(_0x6c7a77){return _0x6c7a77?{'count':_0x181773,'rows':_0x6c7a77}:null;}})[_0x8c68('0x1a')](respondWithResult(_0x1d8720,null))['catch'](handleError(_0x1d8720,null));};exports[_0x8c68('0x57')]=function(_0xa7819,_0x55255c,_0x4fc50a){var _0x2b2a1c={};var _0x302fa9={};var _0x1dbe7b;var _0x37d257;return db[_0x8c68('0x49')]['findOne']({'where':{'id':_0xa7819[_0x8c68('0x4d')]['id']}})[_0x8c68('0x1a')](handleEntityNotFound(_0x55255c,null))['then'](function(_0xbb7f9f){if(_0xbb7f9f){_0x1dbe7b=_0xbb7f9f;_0x302fa9['model']=_[_0x8c68('0x3b')](db[_0x8c68('0x54')][_0x8c68('0x36')]);_0x302fa9[_0x8c68('0x3a')]=_[_0x8c68('0x3b')](_0xa7819[_0x8c68('0x3a')]);_0x302fa9[_0x8c68('0x3c')]=_[_0x8c68('0x4e')](_0x302fa9[_0x8c68('0x39')],_0x302fa9[_0x8c68('0x3a')]);_0x2b2a1c[_0x8c68('0x3d')]=_[_0x8c68('0x4e')](_0x302fa9['model'],qs[_0x8c68('0x3e')](_0xa7819['query'][_0x8c68('0x3e')]));_0x2b2a1c[_0x8c68('0x3d')]=_0x2b2a1c['attributes'][_0x8c68('0x3f')]?_0x2b2a1c[_0x8c68('0x3d')]:_0x302fa9[_0x8c68('0x39')];_0x2b2a1c['order']=qs['sort'](_0xa7819['query']['sort']);_0x2b2a1c['where']=qs['filters'](_[_0x8c68('0x58')](_0xa7819[_0x8c68('0x3a')],_0x302fa9[_0x8c68('0x3c')]));if(_0xa7819[_0x8c68('0x3a')][_0x8c68('0x46')]){_0x2b2a1c['where']=_[_0x8c68('0x44')](_0x2b2a1c[_0x8c68('0x43')],{'$or':_['map'](_0x2b2a1c[_0x8c68('0x3d')],function(_0x21e9ad){var _0x40854a={};_0x40854a[_0x21e9ad]={'$like':'%'+_0xa7819[_0x8c68('0x3a')]['filter']+'%'};return _0x40854a;})});}_0x2b2a1c=_[_0x8c68('0x44')]({},_0x2b2a1c,_0xa7819[_0x8c68('0x56')]);return _0x1dbe7b[_0x8c68('0x57')](_0x2b2a1c);}})[_0x8c68('0x1a')](function(_0x28cd1d){if(_0x28cd1d){_0x37d257=_0x28cd1d[_0x8c68('0x3f')];if(!_0xa7819[_0x8c68('0x3a')][_0x8c68('0x40')](_0x8c68('0x41'))){_0x2b2a1c[_0x8c68('0x29')]=qs[_0x8c68('0x29')](_0xa7819[_0x8c68('0x3a')][_0x8c68('0x29')]);_0x2b2a1c[_0x8c68('0x28')]=qs[_0x8c68('0x28')](_0xa7819['query']['offset']);}return _0x1dbe7b[_0x8c68('0x57')](_0x2b2a1c);}})[_0x8c68('0x1a')](function(_0x4bb4fb){if(_0x4bb4fb){return _0x4bb4fb?{'count':_0x37d257,'rows':_0x4bb4fb}:null;}})[_0x8c68('0x1a')](respondWithResult(_0x55255c,null))[_0x8c68('0x24')](handleError(_0x55255c,null));};exports['getDescriptions']=function(_0x11f3f7,_0x994cb8,_0x2495c7){var _0xedff79={};var _0x3def49={};var _0xf4e477;var _0x5bf800;return db[_0x8c68('0x49')][_0x8c68('0x53')]({'where':{'id':_0x11f3f7['params']['id']}})[_0x8c68('0x1a')](handleEntityNotFound(_0x994cb8,null))[_0x8c68('0x1a')](function(_0x475496){if(_0x475496){_0xf4e477=_0x475496;_0x3def49['model']=_[_0x8c68('0x3b')](db[_0x8c68('0x54')][_0x8c68('0x36')]);_0x3def49[_0x8c68('0x3a')]=_[_0x8c68('0x3b')](_0x11f3f7[_0x8c68('0x3a')]);_0x3def49[_0x8c68('0x3c')]=_[_0x8c68('0x4e')](_0x3def49['model'],_0x3def49[_0x8c68('0x3a')]);_0xedff79[_0x8c68('0x3d')]=_[_0x8c68('0x4e')](_0x3def49[_0x8c68('0x39')],qs[_0x8c68('0x3e')](_0x11f3f7[_0x8c68('0x3a')][_0x8c68('0x3e')]));_0xedff79[_0x8c68('0x3d')]=_0xedff79[_0x8c68('0x3d')][_0x8c68('0x3f')]?_0xedff79['attributes']:_0x3def49[_0x8c68('0x39')];_0xedff79[_0x8c68('0x42')]=qs[_0x8c68('0x55')](_0x11f3f7[_0x8c68('0x3a')][_0x8c68('0x55')]);_0xedff79[_0x8c68('0x43')]=qs['filters'](_[_0x8c68('0x58')](_0x11f3f7[_0x8c68('0x3a')],_0x3def49[_0x8c68('0x3c')]));if(_0x11f3f7['query']['filter']){_0xedff79[_0x8c68('0x43')]=_[_0x8c68('0x44')](_0xedff79[_0x8c68('0x43')],{'$or':_[_0x8c68('0x35')](_0xedff79[_0x8c68('0x3d')],function(_0x5cd047){var _0x3af892={};_0x3af892[_0x5cd047]={'$like':'%'+_0x11f3f7[_0x8c68('0x3a')][_0x8c68('0x46')]+'%'};return _0x3af892;})});}_0xedff79=_[_0x8c68('0x44')]({},_0xedff79,_0x11f3f7[_0x8c68('0x56')]);return _0xf4e477[_0x8c68('0x59')](_0xedff79);}})[_0x8c68('0x1a')](function(_0x28d85f){if(_0x28d85f){_0x5bf800=_0x28d85f[_0x8c68('0x3f')];if(!_0x11f3f7[_0x8c68('0x3a')]['hasOwnProperty'](_0x8c68('0x41'))){_0xedff79[_0x8c68('0x29')]=qs[_0x8c68('0x29')](_0x11f3f7[_0x8c68('0x3a')][_0x8c68('0x29')]);_0xedff79['offset']=qs['offset'](_0x11f3f7['query'][_0x8c68('0x28')]);}return _0xf4e477[_0x8c68('0x59')](_0xedff79);}})[_0x8c68('0x1a')](function(_0x120702){if(_0x120702){return _0x120702?{'count':_0x5bf800,'rows':_0x120702}:null;}})[_0x8c68('0x1a')](respondWithResult(_0x994cb8,null))['catch'](handleError(_0x994cb8,null));};exports[_0x8c68('0x5a')]=function(_0x55e6b2,_0xd3b986,_0x50e2ac){var _0x578775={};var _0x4ee963={};var _0x466992;var _0x87adc1;return db['FreshdeskConfiguration'][_0x8c68('0x53')]({'where':{'id':_0x55e6b2[_0x8c68('0x4d')]['id']}})[_0x8c68('0x1a')](handleEntityNotFound(_0xd3b986,null))['then'](function(_0x3182bb){if(_0x3182bb){_0x466992=_0x3182bb;_0x4ee963[_0x8c68('0x39')]=_[_0x8c68('0x3b')](db[_0x8c68('0x5b')][_0x8c68('0x36')]);_0x4ee963[_0x8c68('0x3a')]=_[_0x8c68('0x3b')](_0x55e6b2[_0x8c68('0x3a')]);_0x4ee963[_0x8c68('0x3c')]=_[_0x8c68('0x4e')](_0x4ee963[_0x8c68('0x39')],_0x4ee963[_0x8c68('0x3a')]);_0x578775[_0x8c68('0x3d')]=_['intersection'](_0x4ee963['model'],qs[_0x8c68('0x3e')](_0x55e6b2[_0x8c68('0x3a')]['fields']));_0x578775[_0x8c68('0x3d')]=_0x578775[_0x8c68('0x3d')]['length']?_0x578775['attributes']:_0x4ee963[_0x8c68('0x39')];_0x578775[_0x8c68('0x42')]=qs[_0x8c68('0x55')](_0x55e6b2['query'][_0x8c68('0x55')]);_0x578775['where']=qs['filters'](_[_0x8c68('0x58')](_0x55e6b2[_0x8c68('0x3a')],_0x4ee963[_0x8c68('0x3c')]));if(_0x55e6b2[_0x8c68('0x3a')][_0x8c68('0x46')]){_0x578775[_0x8c68('0x43')]=_[_0x8c68('0x44')](_0x578775[_0x8c68('0x43')],{'$or':_[_0x8c68('0x35')](_0x578775[_0x8c68('0x3d')],function(_0x47ba6c){var _0x2b7a11={};_0x2b7a11[_0x47ba6c]={'$like':'%'+_0x55e6b2[_0x8c68('0x3a')][_0x8c68('0x46')]+'%'};return _0x2b7a11;})});}_0x578775=_[_0x8c68('0x44')]({},_0x578775,_0x55e6b2['options']);return _0x466992[_0x8c68('0x5a')](_0x578775);}})['then'](function(_0x481fa1){if(_0x481fa1){_0x87adc1=_0x481fa1[_0x8c68('0x3f')];if(!_0x55e6b2[_0x8c68('0x3a')][_0x8c68('0x40')](_0x8c68('0x41'))){_0x578775['limit']=qs['limit'](_0x55e6b2['query'][_0x8c68('0x29')]);_0x578775['offset']=qs[_0x8c68('0x28')](_0x55e6b2[_0x8c68('0x3a')][_0x8c68('0x28')]);}return _0x466992[_0x8c68('0x5a')](_0x578775);}})[_0x8c68('0x1a')](function(_0xc9c7f0){if(_0xc9c7f0){return _0xc9c7f0?{'count':_0x87adc1,'rows':_0xc9c7f0}:null;}})['then'](respondWithResult(_0xd3b986,null))[_0x8c68('0x24')](handleError(_0xd3b986,null));};exports[_0x8c68('0x5c')]=function(_0x44dea2,_0x52a5c3,_0x401355){if(_0x44dea2[_0x8c68('0x50')]['id']){delete _0x44dea2[_0x8c68('0x50')]['id'];}return db[_0x8c68('0x49')]['findOne']({'where':{'id':_0x44dea2[_0x8c68('0x4d')]['id']}})['then'](handleEntityNotFound(_0x52a5c3,null))[_0x8c68('0x1a')](function(_0x52a55d){if(_0x52a55d){return _0x52a55d[_0x8c68('0x5c')](_0x44dea2[_0x8c68('0x50')]['ids']||[]);}return null;})[_0x8c68('0x1a')](respondWithResult(_0x52a5c3,null))[_0x8c68('0x24')](handleError(_0x52a5c3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 42b44b2..5ede967 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','int_freshdesk_configurations','lodash'];(function(_0x5189c9,_0xd227b6){var _0x4643b1=function(_0x350b01){while(--_0x350b01){_0x5189c9['push'](_0x5189c9['shift']());}};_0x4643b1(++_0xd227b6);}(_0xabce,0x103));var _0xeabc=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xabce[_0x1e7b16];return _0x37fadc;};'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('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FreshdeskConfiguration',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x58f985,_0x46aa71){var _0x30750d=function(_0x5a6427){while(--_0x5a6427){_0x58f985['push'](_0x58f985['shift']());}};_0x30750d(++_0x46aa71);}(_0x814b,0x1a2));var _0xb814=function(_0x26cab7,_0x1ccfca){_0x26cab7=_0x26cab7-0x0;var _0x31ba06=_0x814b[_0x26cab7];return _0x31ba06;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'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 aba5f56..8d20f1e 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 _0x3e62=['error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2017c6,_0x513dc3){var _0x142c0b=function(_0x16d72b){while(--_0x16d72b){_0x2017c6['push'](_0x2017c6['shift']());}};_0x142c0b(++_0x513dc3);}(_0x3e62,0x11a));var _0x23e6=function(_0x4d148c,_0x46d271){_0x4d148c=_0x4d148c-0x0;var _0xf9aff2=_0x3e62[_0x4d148c];return _0xf9aff2;};'use strict';var _=require(_0x23e6('0x0'));var util=require(_0x23e6('0x1'));var moment=require(_0x23e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x23e6('0x3'));var fs=require('fs');var Redis=require(_0x23e6('0x4'));var db=require(_0x23e6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x23e6('0x6'))(_0x23e6('0x7'));var config=require(_0x23e6('0x8'));var jayson=require(_0x23e6('0x9'));var client=jayson[_0x23e6('0xa')][_0x23e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e7db7,_0x5b49f2,_0x30e24d){return new BPromise(function(_0x4b50db,_0x2b5338){return client[_0x23e6('0xc')](_0x2e7db7,_0x30e24d)['then'](function(_0x8e1a78){logger[_0x23e6('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5b49f2,_0x23e6('0xe'));logger['debug'](_0x23e6('0xf'),_0x5b49f2,_0x23e6('0xe'),JSON[_0x23e6('0x10')](_0x8e1a78));if(_0x8e1a78[_0x23e6('0x11')]){if(_0x8e1a78[_0x23e6('0x11')][_0x23e6('0x12')]===0x1f4){logger[_0x23e6('0x11')](_0x23e6('0x13'),_0x5b49f2,_0x8e1a78[_0x23e6('0x11')][_0x23e6('0x14')]);return _0x2b5338(_0x8e1a78[_0x23e6('0x11')]['message']);}logger['error'](_0x23e6('0x13'),_0x5b49f2,_0x8e1a78[_0x23e6('0x11')]['message']);return _0x4b50db(_0x8e1a78[_0x23e6('0x11')][_0x23e6('0x14')]);}else{logger[_0x23e6('0xd')](_0x23e6('0x13'),_0x5b49f2,_0x23e6('0xe'));_0x4b50db(_0x8e1a78[_0x23e6('0x15')][_0x23e6('0x14')]);}})[_0x23e6('0x16')](function(_0x2d74fb){logger[_0x23e6('0x11')](_0x23e6('0x13'),_0x5b49f2,_0x2d74fb);_0x2b5338(_0x2d74fb);});});} \ No newline at end of file +var _0x071f=['../../config/environment','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x47c10c,_0x24bd33){var _0x320de8=function(_0x16e0df){while(--_0x16e0df){_0x47c10c['push'](_0x47c10c['shift']());}};_0x320de8(++_0x24bd33);}(_0x071f,0x9a));var _0xf071=function(_0x4bbfe8,_0x4a2aed){_0x4bbfe8=_0x4bbfe8-0x0;var _0x359165=_0x071f[_0x4bbfe8];return _0x359165;};'use strict';var _=require(_0xf071('0x0'));var util=require(_0xf071('0x1'));var moment=require('moment');var BPromise=require(_0xf071('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf071('0x3'))['db'];var utils=require(_0xf071('0x4'));var logger=require('../../config/logger')(_0xf071('0x5'));var config=require(_0xf071('0x6'));var jayson=require(_0xf071('0x7'));var client=jayson['client'][_0xf071('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7876f4,_0xed4408,_0x475b73){return new BPromise(function(_0x1aef8a,_0x2e3385){return client[_0xf071('0x9')](_0x7876f4,_0x475b73)[_0xf071('0xa')](function(_0x48a0da){logger[_0xf071('0xb')](_0xf071('0xc'),_0xed4408,_0xf071('0xd'));logger[_0xf071('0xe')](_0xf071('0xf'),_0xed4408,_0xf071('0xd'),JSON[_0xf071('0x10')](_0x48a0da));if(_0x48a0da[_0xf071('0x11')]){if(_0x48a0da[_0xf071('0x11')]['code']===0x1f4){logger['error'](_0xf071('0xc'),_0xed4408,_0x48a0da[_0xf071('0x11')][_0xf071('0x12')]);return _0x2e3385(_0x48a0da['error'][_0xf071('0x12')]);}logger['error'](_0xf071('0xc'),_0xed4408,_0x48a0da['error'][_0xf071('0x12')]);return _0x1aef8a(_0x48a0da['error']['message']);}else{logger[_0xf071('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xed4408,'request\x20sent');_0x1aef8a(_0x48a0da[_0xf071('0x13')][_0xf071('0x12')]);}})['catch'](function(_0x35086c){logger[_0xf071('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xed4408,_0x35086c);_0x2e3385(_0x35086c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index c5cb920..1d724b9 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 _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xcb91[_0x3430aa];return _0x2ac5c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./intFreshdeskField.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x3a1cbb,_0x388d70){var _0x4d780c=function(_0x24ca43){while(--_0x24ca43){_0x3a1cbb['push'](_0x3a1cbb['shift']());}};_0x4d780c(++_0x388d70);}(_0x008c,0x188));var _0xc008=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x008c[_0x52085a];return _0x5afc1a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a793c1b..d573d48 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 _0x9917=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','ENUM'];(function(_0x23c241,_0xfd0316){var _0x545d36=function(_0x3f90a0){while(--_0x3f90a0){_0x23c241['push'](_0x23c241['shift']());}};_0x545d36(++_0xfd0316);}(_0x9917,0xe6));var _0x7991=function(_0x1beca6,_0x5b7024){_0x1beca6=_0x1beca6-0x0;var _0x9b013b=_0x9917[_0x1beca6];return _0x9b013b;};'use strict';var Sequelize=require(_0x7991('0x0'));module['exports']={'type':{'type':Sequelize[_0x7991('0x1')](_0x7991('0x2'),_0x7991('0x3'),'customVariable',_0x7991('0x4')),'defaultValue':_0x7991('0x2')},'content':{'type':Sequelize[_0x7991('0x5')]},'key':{'type':Sequelize[_0x7991('0x5')]},'keyType':{'type':Sequelize[_0x7991('0x1')](_0x7991('0x2'),_0x7991('0x3'),_0x7991('0x6'))},'keyContent':{'type':Sequelize[_0x7991('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7991('0x5')]},'customField':{'type':Sequelize[_0x7991('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4944=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x2a0b5,_0x4f3624){var _0x4f0821=function(_0x209089){while(--_0x209089){_0x2a0b5['push'](_0x2a0b5['shift']());}};_0x4f0821(++_0x4f3624);}(_0x4944,0x6d));var _0x4494=function(_0x55e27b,_0x3b0a08){_0x55e27b=_0x55e27b-0x0;var _0x3a2271=_0x4944[_0x55e27b];return _0x3a2271;};'use strict';var Sequelize=require(_0x4494('0x0'));module['exports']={'type':{'type':Sequelize[_0x4494('0x1')](_0x4494('0x2'),_0x4494('0x3'),_0x4494('0x4'),_0x4494('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4494('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4494('0x1')](_0x4494('0x2'),_0x4494('0x3'),_0x4494('0x4'))},'keyContent':{'type':Sequelize[_0x4494('0x6')]},'idField':{'type':Sequelize[_0x4494('0x6')]},'nameField':{'type':Sequelize[_0x4494('0x6')]},'customField':{'type':Sequelize[_0x4494('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4494('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 5dc8871..a003f01 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 _0xc3e0=['model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','FreshdeskField','include','findAll','catch','params','includeAll','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','set','Content-Range','json','apply','then','destroy','error','stack','name','map','rawAttributes','fieldName','key','query','keys','filters'];(function(_0x425351,_0x695083){var _0x213256=function(_0x1e9335){while(--_0x1e9335){_0x425351['push'](_0x425351['shift']());}};_0x213256(++_0x695083);}(_0xc3e0,0x1cb));var _0x0c3e=function(_0x4021b3,_0x3549e3){_0x4021b3=_0x4021b3-0x0;var _0x2196d8=_0xc3e0[_0x4021b3];return _0x2196d8;};'use strict';var pdf=require(_0x0c3e('0x0'));var emlformat=require(_0x0c3e('0x1'));var rimraf=require(_0x0c3e('0x2'));var zipdir=require(_0x0c3e('0x3'));var jsonpatch=require(_0x0c3e('0x4'));var rp=require('request-promise');var moment=require(_0x0c3e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0c3e('0x6'));var util=require(_0x0c3e('0x7'));var path=require(_0x0c3e('0x8'));var sox=require(_0x0c3e('0x9'));var csv=require(_0x0c3e('0xa'));var ejs=require(_0x0c3e('0xb'));var fs=require('fs');var _=require(_0x0c3e('0xc'));var squel=require(_0x0c3e('0xd'));var crypto=require(_0x0c3e('0xe'));var jsforce=require(_0x0c3e('0xf'));var deskjs=require(_0x0c3e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0c3e('0x11'));var Papa=require(_0x0c3e('0x12'));var Redis=require(_0x0c3e('0x13'));var authService=require(_0x0c3e('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c3e('0x15'))(_0x0c3e('0x16'));var utils=require(_0x0c3e('0x17'));var config=require(_0x0c3e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24dbe9,_0x2160c1){_0x2160c1=_0x2160c1||0xcc;return function(_0x322f68){if(_0x322f68){return _0x24dbe9[_0x0c3e('0x19')](_0x2160c1);}return _0x24dbe9[_0x0c3e('0x1a')](_0x2160c1)['end']();};}function respondWithResult(_0x16b012,_0x5a6b40){_0x5a6b40=_0x5a6b40||0xc8;return function(_0x48c3ae){if(_0x48c3ae){return _0x16b012[_0x0c3e('0x1a')](_0x5a6b40)['json'](_0x48c3ae);}};}function respondWithFilteredResult(_0x19a1ef,_0x2742e7){return function(_0x1cea4e){if(_0x1cea4e){var _0x264d9c=_0x1cea4e[_0x0c3e('0x1b')],_0x49169f=_0x2742e7[_0x0c3e('0x1c')],_0x2019f8=_0x2742e7['offset']+_0x2742e7['limit'],_0x18a071;if(_0x2019f8>=_0x264d9c){_0x2019f8=_0x264d9c;_0x18a071=0xc8;}else{_0x18a071=0xce;}_0x19a1ef['status'](_0x18a071);return _0x19a1ef[_0x0c3e('0x1d')](_0x0c3e('0x1e'),_0x49169f+'-'+_0x2019f8+'/'+_0x264d9c)[_0x0c3e('0x1f')](_0x1cea4e);}return null;};}function patchUpdates(_0x32c8fe){return function(_0x42b955){try{jsonpatch[_0x0c3e('0x20')](_0x42b955,_0x32c8fe,!![]);}catch(_0x10ec4d){return BPromise['reject'](_0x10ec4d);}return _0x42b955['save']();};}function saveUpdates(_0x1a194d,_0x39df40){return function(_0x481b95){if(_0x481b95){return _0x481b95['update'](_0x1a194d)[_0x0c3e('0x21')](function(_0x1eb358){return _0x1eb358;});}return null;};}function removeEntity(_0x5eeb67,_0x1fcb0b){return function(_0x4333dd){if(_0x4333dd){return _0x4333dd[_0x0c3e('0x22')]()[_0x0c3e('0x21')](function(){_0x5eeb67['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20067e,_0xfc5404){return function(_0x1a6041){if(!_0x1a6041){_0x20067e[_0x0c3e('0x19')](0x194);}return _0x1a6041;};}function handleError(_0x3df4e1,_0x54e13d){_0x54e13d=_0x54e13d||0x1f4;return function(_0xff2c56){logger[_0x0c3e('0x23')](_0xff2c56[_0x0c3e('0x24')]);if(_0xff2c56[_0x0c3e('0x25')]){delete _0xff2c56[_0x0c3e('0x25')];}_0x3df4e1['status'](_0x54e13d)['send'](_0xff2c56);};}exports['index']=function(_0x157aa8,_0x47e9f5){var _0x47e5de={},_0x450e38={},_0x34b5c8={'count':0x0,'rows':[]};var _0x5b3af2=_[_0x0c3e('0x26')](db['FreshdeskField'][_0x0c3e('0x27')],function(_0x412e9f){return{'name':_0x412e9f[_0x0c3e('0x28')],'type':_0x412e9f['type'][_0x0c3e('0x29')]};});_0x450e38['model']=_[_0x0c3e('0x26')](_0x5b3af2,_0x0c3e('0x25'));_0x450e38[_0x0c3e('0x2a')]=_[_0x0c3e('0x2b')](_0x157aa8[_0x0c3e('0x2a')]);_0x450e38[_0x0c3e('0x2c')]=_['intersection'](_0x450e38[_0x0c3e('0x2d')],_0x450e38[_0x0c3e('0x2a')]);_0x47e5de[_0x0c3e('0x2e')]=_[_0x0c3e('0x2f')](_0x450e38[_0x0c3e('0x2d')],qs[_0x0c3e('0x30')](_0x157aa8[_0x0c3e('0x2a')][_0x0c3e('0x30')]));_0x47e5de['attributes']=_0x47e5de[_0x0c3e('0x2e')][_0x0c3e('0x31')]?_0x47e5de['attributes']:_0x450e38['model'];if(!_0x157aa8[_0x0c3e('0x2a')][_0x0c3e('0x32')](_0x0c3e('0x33'))){_0x47e5de[_0x0c3e('0x34')]=qs[_0x0c3e('0x34')](_0x157aa8[_0x0c3e('0x2a')]['limit']);_0x47e5de['offset']=qs['offset'](_0x157aa8['query'][_0x0c3e('0x1c')]);}_0x47e5de[_0x0c3e('0x35')]=qs[_0x0c3e('0x36')](_0x157aa8['query'][_0x0c3e('0x36')]);_0x47e5de[_0x0c3e('0x37')]=qs[_0x0c3e('0x2c')](_[_0x0c3e('0x38')](_0x157aa8[_0x0c3e('0x2a')],_0x450e38[_0x0c3e('0x2c')]),_0x5b3af2);if(_0x157aa8[_0x0c3e('0x2a')]['filter']){_0x47e5de['where']=_[_0x0c3e('0x39')](_0x47e5de[_0x0c3e('0x37')],{'$or':_[_0x0c3e('0x26')](_0x5b3af2,function(_0x2af41f){if(_0x2af41f[_0x0c3e('0x3a')]!==_0x0c3e('0x3b')){var _0x5f54f1={};_0x5f54f1[_0x2af41f[_0x0c3e('0x25')]]={'$like':'%'+_0x157aa8[_0x0c3e('0x2a')][_0x0c3e('0x3c')]+'%'};return _0x5f54f1;}})});}_0x47e5de=_[_0x0c3e('0x39')]({},_0x47e5de,_0x157aa8[_0x0c3e('0x3d')]);var _0x121a65={'where':_0x47e5de[_0x0c3e('0x37')]};return db[_0x0c3e('0x3e')][_0x0c3e('0x1b')](_0x121a65)[_0x0c3e('0x21')](function(_0x5a7a1b){_0x34b5c8['count']=_0x5a7a1b;if(_0x157aa8[_0x0c3e('0x2a')]['includeAll']){_0x47e5de[_0x0c3e('0x3f')]=[{'all':!![]}];}return db[_0x0c3e('0x3e')][_0x0c3e('0x40')](_0x47e5de);})['then'](function(_0x45fb8e){_0x34b5c8['rows']=_0x45fb8e;return _0x34b5c8;})[_0x0c3e('0x21')](respondWithFilteredResult(_0x47e9f5,_0x47e5de))[_0x0c3e('0x41')](handleError(_0x47e9f5,null));};exports['show']=function(_0x1e9606,_0x448334){var _0x53792b={'raw':!![],'where':{'id':_0x1e9606[_0x0c3e('0x42')]['id']}},_0x1ccc7e={};_0x1ccc7e[_0x0c3e('0x2d')]=_[_0x0c3e('0x2b')](db[_0x0c3e('0x3e')][_0x0c3e('0x27')]);_0x1ccc7e[_0x0c3e('0x2a')]=_[_0x0c3e('0x2b')](_0x1e9606[_0x0c3e('0x2a')]);_0x1ccc7e[_0x0c3e('0x2c')]=_['intersection'](_0x1ccc7e[_0x0c3e('0x2d')],_0x1ccc7e[_0x0c3e('0x2a')]);_0x53792b[_0x0c3e('0x2e')]=_[_0x0c3e('0x2f')](_0x1ccc7e[_0x0c3e('0x2d')],qs[_0x0c3e('0x30')](_0x1e9606[_0x0c3e('0x2a')]['fields']));_0x53792b[_0x0c3e('0x2e')]=_0x53792b['attributes'][_0x0c3e('0x31')]?_0x53792b[_0x0c3e('0x2e')]:_0x1ccc7e[_0x0c3e('0x2d')];if(_0x1e9606[_0x0c3e('0x2a')][_0x0c3e('0x43')]){_0x53792b['include']=[{'all':!![]}];}_0x53792b=_[_0x0c3e('0x39')]({},_0x53792b,_0x1e9606[_0x0c3e('0x3d')]);return db[_0x0c3e('0x3e')][_0x0c3e('0x44')](_0x53792b)[_0x0c3e('0x21')](handleEntityNotFound(_0x448334,null))[_0x0c3e('0x21')](respondWithResult(_0x448334,null))[_0x0c3e('0x41')](handleError(_0x448334,null));};exports[_0x0c3e('0x45')]=function(_0x49fbf5,_0x6031c0){return db[_0x0c3e('0x3e')]['create'](_0x49fbf5[_0x0c3e('0x46')],{})[_0x0c3e('0x21')](respondWithResult(_0x6031c0,0xc9))[_0x0c3e('0x41')](handleError(_0x6031c0,null));};exports[_0x0c3e('0x47')]=function(_0x2682d7,_0x25218e){if(_0x2682d7[_0x0c3e('0x46')]['id']){delete _0x2682d7[_0x0c3e('0x46')]['id'];}return db[_0x0c3e('0x3e')][_0x0c3e('0x44')]({'where':{'id':_0x2682d7[_0x0c3e('0x42')]['id']}})[_0x0c3e('0x21')](handleEntityNotFound(_0x25218e,null))['then'](saveUpdates(_0x2682d7[_0x0c3e('0x46')],null))[_0x0c3e('0x21')](respondWithResult(_0x25218e,null))[_0x0c3e('0x41')](handleError(_0x25218e,null));};exports['destroy']=function(_0x15cd9b,_0x26a7a9){return db[_0x0c3e('0x3e')][_0x0c3e('0x44')]({'where':{'id':_0x15cd9b[_0x0c3e('0x42')]['id']}})[_0x0c3e('0x21')](handleEntityNotFound(_0x26a7a9,null))['then'](removeEntity(_0x26a7a9,null))[_0x0c3e('0x41')](handleError(_0x26a7a9,null));}; \ No newline at end of file +var _0x74b0=['json','count','offset','limit','status','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','rawAttributes','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','FreshdeskField','includeAll','include','findAll','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x52f733,_0xa08011){var _0x38af5f=function(_0x675770){while(--_0x675770){_0x52f733['push'](_0x52f733['shift']());}};_0x38af5f(++_0xa08011);}(_0x74b0,0x6f));var _0x074b=function(_0x27e357,_0x596b3c){_0x27e357=_0x27e357-0x0;var _0x1451bf=_0x74b0[_0x27e357];return _0x1451bf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x074b('0x0'));var rimraf=require(_0x074b('0x1'));var zipdir=require(_0x074b('0x2'));var jsonpatch=require(_0x074b('0x3'));var rp=require(_0x074b('0x4'));var moment=require(_0x074b('0x5'));var BPromise=require(_0x074b('0x6'));var Mustache=require('mustache');var util=require(_0x074b('0x7'));var path=require(_0x074b('0x8'));var sox=require('sox');var csv=require(_0x074b('0x9'));var ejs=require(_0x074b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x074b('0xb'));var crypto=require(_0x074b('0xc'));var jsforce=require(_0x074b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x074b('0x9'));var querystring=require(_0x074b('0xe'));var Papa=require(_0x074b('0xf'));var Redis=require(_0x074b('0x10'));var authService=require(_0x074b('0x11'));var qs=require(_0x074b('0x12'));var as=require(_0x074b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x074b('0x14'));var utils=require(_0x074b('0x15'));var config=require(_0x074b('0x16'));var db=require(_0x074b('0x17'))['db'];function respondWithStatusCode(_0x5b5348,_0x306f58){_0x306f58=_0x306f58||0xcc;return function(_0x490069){if(_0x490069){return _0x5b5348[_0x074b('0x18')](_0x306f58);}return _0x5b5348['status'](_0x306f58)['end']();};}function respondWithResult(_0x58b7ec,_0x1ff693){_0x1ff693=_0x1ff693||0xc8;return function(_0x595824){if(_0x595824){return _0x58b7ec['status'](_0x1ff693)[_0x074b('0x19')](_0x595824);}};}function respondWithFilteredResult(_0x4984bc,_0x1e6f87){return function(_0x317cd3){if(_0x317cd3){var _0x34ca94=_0x317cd3[_0x074b('0x1a')],_0x42e407=_0x1e6f87['offset'],_0x5462aa=_0x1e6f87[_0x074b('0x1b')]+_0x1e6f87[_0x074b('0x1c')],_0x5e13ab;if(_0x5462aa>=_0x34ca94){_0x5462aa=_0x34ca94;_0x5e13ab=0xc8;}else{_0x5e13ab=0xce;}_0x4984bc[_0x074b('0x1d')](_0x5e13ab);return _0x4984bc['set'](_0x074b('0x1e'),_0x42e407+'-'+_0x5462aa+'/'+_0x34ca94)[_0x074b('0x19')](_0x317cd3);}return null;};}function patchUpdates(_0x3ef87d){return function(_0x481e87){try{jsonpatch['apply'](_0x481e87,_0x3ef87d,!![]);}catch(_0x4633f2){return BPromise[_0x074b('0x1f')](_0x4633f2);}return _0x481e87['save']();};}function saveUpdates(_0x209da1,_0x2b58ea){return function(_0x280c70){if(_0x280c70){return _0x280c70[_0x074b('0x20')](_0x209da1)[_0x074b('0x21')](function(_0x4b3b27){return _0x4b3b27;});}return null;};}function removeEntity(_0x265bc6,_0xd00d8d){return function(_0x1c959){if(_0x1c959){return _0x1c959[_0x074b('0x22')]()[_0x074b('0x21')](function(){_0x265bc6[_0x074b('0x1d')](0xcc)[_0x074b('0x23')]();});}};}function handleEntityNotFound(_0x14ae1a,_0x426874){return function(_0x19e643){if(!_0x19e643){_0x14ae1a[_0x074b('0x18')](0x194);}return _0x19e643;};}function handleError(_0x3f2170,_0x1a0399){_0x1a0399=_0x1a0399||0x1f4;return function(_0xf05cfe){logger['error'](_0xf05cfe[_0x074b('0x24')]);if(_0xf05cfe['name']){delete _0xf05cfe[_0x074b('0x25')];}_0x3f2170[_0x074b('0x1d')](_0x1a0399)[_0x074b('0x26')](_0xf05cfe);};}exports[_0x074b('0x27')]=function(_0x3218fd,_0x2e35c5){var _0x38ffce={},_0x5fbee0={},_0x2b6a16={'count':0x0,'rows':[]};var _0x54096b=_[_0x074b('0x28')](db['FreshdeskField'][_0x074b('0x29')],function(_0x366ee8){return{'name':_0x366ee8['fieldName'],'type':_0x366ee8['type'][_0x074b('0x2a')]};});_0x5fbee0[_0x074b('0x2b')]=_[_0x074b('0x28')](_0x54096b,_0x074b('0x25'));_0x5fbee0[_0x074b('0x2c')]=_['keys'](_0x3218fd[_0x074b('0x2c')]);_0x5fbee0['filters']=_[_0x074b('0x2d')](_0x5fbee0['model'],_0x5fbee0[_0x074b('0x2c')]);_0x38ffce[_0x074b('0x2e')]=_[_0x074b('0x2d')](_0x5fbee0[_0x074b('0x2b')],qs[_0x074b('0x2f')](_0x3218fd[_0x074b('0x2c')][_0x074b('0x2f')]));_0x38ffce[_0x074b('0x2e')]=_0x38ffce[_0x074b('0x2e')][_0x074b('0x30')]?_0x38ffce[_0x074b('0x2e')]:_0x5fbee0[_0x074b('0x2b')];if(!_0x3218fd[_0x074b('0x2c')]['hasOwnProperty'](_0x074b('0x31'))){_0x38ffce[_0x074b('0x1c')]=qs[_0x074b('0x1c')](_0x3218fd[_0x074b('0x2c')][_0x074b('0x1c')]);_0x38ffce[_0x074b('0x1b')]=qs[_0x074b('0x1b')](_0x3218fd[_0x074b('0x2c')][_0x074b('0x1b')]);}_0x38ffce[_0x074b('0x32')]=qs[_0x074b('0x33')](_0x3218fd[_0x074b('0x2c')][_0x074b('0x33')]);_0x38ffce[_0x074b('0x34')]=qs[_0x074b('0x35')](_['pick'](_0x3218fd[_0x074b('0x2c')],_0x5fbee0[_0x074b('0x35')]),_0x54096b);if(_0x3218fd[_0x074b('0x2c')][_0x074b('0x36')]){_0x38ffce[_0x074b('0x34')]=_[_0x074b('0x37')](_0x38ffce[_0x074b('0x34')],{'$or':_[_0x074b('0x28')](_0x54096b,function(_0x6a4600){if(_0x6a4600[_0x074b('0x38')]!==_0x074b('0x39')){var _0x28266a={};_0x28266a[_0x6a4600[_0x074b('0x25')]]={'$like':'%'+_0x3218fd['query']['filter']+'%'};return _0x28266a;}})});}_0x38ffce=_[_0x074b('0x37')]({},_0x38ffce,_0x3218fd['options']);var _0x9a9713={'where':_0x38ffce[_0x074b('0x34')]};return db[_0x074b('0x3a')][_0x074b('0x1a')](_0x9a9713)[_0x074b('0x21')](function(_0xc7cca9){_0x2b6a16[_0x074b('0x1a')]=_0xc7cca9;if(_0x3218fd[_0x074b('0x2c')][_0x074b('0x3b')]){_0x38ffce[_0x074b('0x3c')]=[{'all':!![]}];}return db[_0x074b('0x3a')][_0x074b('0x3d')](_0x38ffce);})[_0x074b('0x21')](function(_0x43343a){_0x2b6a16['rows']=_0x43343a;return _0x2b6a16;})[_0x074b('0x21')](respondWithFilteredResult(_0x2e35c5,_0x38ffce))['catch'](handleError(_0x2e35c5,null));};exports['show']=function(_0x2ddd85,_0x1c9365){var _0x504713={'raw':!![],'where':{'id':_0x2ddd85[_0x074b('0x3e')]['id']}},_0x526472={};_0x526472[_0x074b('0x2b')]=_['keys'](db[_0x074b('0x3a')][_0x074b('0x29')]);_0x526472[_0x074b('0x2c')]=_['keys'](_0x2ddd85[_0x074b('0x2c')]);_0x526472[_0x074b('0x35')]=_['intersection'](_0x526472[_0x074b('0x2b')],_0x526472[_0x074b('0x2c')]);_0x504713[_0x074b('0x2e')]=_[_0x074b('0x2d')](_0x526472[_0x074b('0x2b')],qs['fields'](_0x2ddd85[_0x074b('0x2c')][_0x074b('0x2f')]));_0x504713[_0x074b('0x2e')]=_0x504713['attributes']['length']?_0x504713['attributes']:_0x526472[_0x074b('0x2b')];if(_0x2ddd85[_0x074b('0x2c')][_0x074b('0x3b')]){_0x504713[_0x074b('0x3c')]=[{'all':!![]}];}_0x504713=_[_0x074b('0x37')]({},_0x504713,_0x2ddd85[_0x074b('0x3f')]);return db[_0x074b('0x3a')][_0x074b('0x40')](_0x504713)[_0x074b('0x21')](handleEntityNotFound(_0x1c9365,null))[_0x074b('0x21')](respondWithResult(_0x1c9365,null))[_0x074b('0x41')](handleError(_0x1c9365,null));};exports[_0x074b('0x42')]=function(_0x3d3538,_0x288f6d){return db['FreshdeskField'][_0x074b('0x42')](_0x3d3538[_0x074b('0x43')],{})[_0x074b('0x21')](respondWithResult(_0x288f6d,0xc9))[_0x074b('0x41')](handleError(_0x288f6d,null));};exports['update']=function(_0x26243c,_0x371e1a){if(_0x26243c[_0x074b('0x43')]['id']){delete _0x26243c['body']['id'];}return db[_0x074b('0x3a')][_0x074b('0x40')]({'where':{'id':_0x26243c[_0x074b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x371e1a,null))[_0x074b('0x21')](saveUpdates(_0x26243c['body'],null))[_0x074b('0x21')](respondWithResult(_0x371e1a,null))[_0x074b('0x41')](handleError(_0x371e1a,null));};exports[_0x074b('0x22')]=function(_0x4965a6,_0x4e2d8c){return db[_0x074b('0x3a')]['find']({'where':{'id':_0x4965a6[_0x074b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4e2d8c,null))[_0x074b('0x21')](removeEntity(_0x4e2d8c,null))[_0x074b('0x41')](handleError(_0x4e2d8c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index d38ad7d..63e5004 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 _0xccdc=['exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x36a460,_0x5ae72f){var _0x1b0f1a=function(_0x32d15c){while(--_0x32d15c){_0x36a460['push'](_0x36a460['shift']());}};_0x1b0f1a(++_0x5ae72f);}(_0xccdc,0x17d));var _0xcccd=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xccdc[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xcccd('0x0'));var util=require(_0xcccd('0x1'));var logger=require(_0xcccd('0x2'))(_0xcccd('0x3'));var moment=require(_0xcccd('0x4'));var BPromise=require(_0xcccd('0x5'));var rp=require(_0xcccd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcccd('0x7'));var config=require(_0xcccd('0x8'));var attributes=require(_0xcccd('0x9'));module[_0xcccd('0xa')]=function(_0x30f9b7,_0x23be42){return _0x30f9b7[_0xcccd('0xb')](_0xcccd('0xc'),attributes,{'tableName':_0xcccd('0xd'),'paranoid':![],'indexes':[{'name':_0xcccd('0xe'),'fields':[_0xcccd('0xf'),_0xcccd('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62d6=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField'];(function(_0x523fff,_0x24649c){var _0x3c7a34=function(_0x3c5621){while(--_0x3c5621){_0x523fff['push'](_0x523fff['shift']());}};_0x3c7a34(++_0x24649c);}(_0x62d6,0x164));var _0x662d=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0x62d6[_0x1e6e4e];return _0x3d746b;};'use strict';var _=require(_0x662d('0x0'));var util=require(_0x662d('0x1'));var logger=require(_0x662d('0x2'))(_0x662d('0x3'));var moment=require(_0x662d('0x4'));var BPromise=require('bluebird');var rp=require(_0x662d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x662d('0x6'));var config=require(_0x662d('0x7'));var attributes=require(_0x662d('0x8'));module[_0x662d('0x9')]=function(_0x237e92,_0x8344ac){return _0x237e92[_0x662d('0xa')](_0x662d('0xb'),attributes,{'tableName':_0x662d('0xc'),'paranoid':![],'indexes':[{'name':_0x662d('0xd'),'fields':[_0x662d('0xe'),_0x662d('0xf')],'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 e9e2689..98060ca 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x3c2328,_0x182624){_0x3c2328=_0x3c2328-0x0;var _0x2ef250=_0x7a54[_0x3c2328];return _0x2ef250;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x397a42,_0x3c3688){_0x397a42=_0x397a42-0x0;var _0x388d45=_0x7a54[_0x397a42];return _0x388d45;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 0991fbd..5b70012 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 _0xc7b5=['path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xc7b5,0x178));var _0x5c7b=function(_0x33cf90,_0x6b486a){_0x33cf90=_0x33cf90-0x0;var _0x378145=_0xc7b5[_0x33cf90];return _0x378145;};'use strict';var multer=require(_0x5c7b('0x0'));var util=require(_0x5c7b('0x1'));var path=require(_0x5c7b('0x2'));var timeout=require(_0x5c7b('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5c7b('0x4'));var config=require(_0x5c7b('0x5'));var controller=require('./intFreshsalesAccount.controller');router[_0x5c7b('0x6')]('/',auth[_0x5c7b('0x7')](),controller['index']);router[_0x5c7b('0x6')](_0x5c7b('0x8'),auth[_0x5c7b('0x7')](),controller[_0x5c7b('0x9')]);router[_0x5c7b('0x6')](_0x5c7b('0xa'),auth['isAuthenticated'](),controller[_0x5c7b('0xb')]);router[_0x5c7b('0x6')](_0x5c7b('0xc'),auth[_0x5c7b('0x7')](),controller[_0x5c7b('0xd')]);router[_0x5c7b('0xe')]('/',auth[_0x5c7b('0x7')](),controller[_0x5c7b('0xf')]);router[_0x5c7b('0xe')](_0x5c7b('0xa'),auth[_0x5c7b('0x7')](),controller[_0x5c7b('0x10')]);router[_0x5c7b('0x11')]('/:id',auth[_0x5c7b('0x7')](),controller[_0x5c7b('0x12')]);router[_0x5c7b('0x13')](_0x5c7b('0x8'),auth[_0x5c7b('0x7')](),controller[_0x5c7b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9a81=['./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1780e2,_0x362a36){var _0x3345d9=function(_0xccdcd5){while(--_0xccdcd5){_0x1780e2['push'](_0x1780e2['shift']());}};_0x3345d9(++_0x362a36);}(_0x9a81,0xf6));var _0x19a8=function(_0x63b8a3,_0x205576){_0x63b8a3=_0x63b8a3-0x0;var _0x4982f8=_0x9a81[_0x63b8a3];return _0x4982f8;};'use strict';var multer=require(_0x19a8('0x0'));var util=require(_0x19a8('0x1'));var path=require(_0x19a8('0x2'));var timeout=require('connect-timeout');var express=require(_0x19a8('0x3'));var router=express['Router']();var auth=require(_0x19a8('0x4'));var interaction=require(_0x19a8('0x5'));var config=require(_0x19a8('0x6'));var controller=require(_0x19a8('0x7'));router[_0x19a8('0x8')]('/',auth[_0x19a8('0x9')](),controller[_0x19a8('0xa')]);router['get']('/:id',auth[_0x19a8('0x9')](),controller[_0x19a8('0xb')]);router[_0x19a8('0x8')](_0x19a8('0xc'),auth[_0x19a8('0x9')](),controller[_0x19a8('0xd')]);router[_0x19a8('0x8')](_0x19a8('0xe'),auth[_0x19a8('0x9')](),controller[_0x19a8('0xf')]);router[_0x19a8('0x10')]('/',auth[_0x19a8('0x9')](),controller[_0x19a8('0x11')]);router[_0x19a8('0x10')](_0x19a8('0xc'),auth[_0x19a8('0x9')](),controller[_0x19a8('0x12')]);router[_0x19a8('0x13')](_0x19a8('0x14'),auth[_0x19a8('0x9')](),controller['update']);router['delete'](_0x19a8('0x14'),auth[_0x19a8('0x9')](),controller[_0x19a8('0x15')]);module[_0x19a8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 3ebebf0..344c18f 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 _0x1c3d=['exports','STRING','username','remoteUri'];(function(_0x13e4ae,_0x549bdd){var _0x4bee51=function(_0x5eaa19){while(--_0x5eaa19){_0x13e4ae['push'](_0x13e4ae['shift']());}};_0x4bee51(++_0x549bdd);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x5d92e8,_0xf7614c){_0x5d92e8=_0x5d92e8-0x0;var _0x313a9f=_0x1c3d[_0x5d92e8];return _0x313a9f;};'use strict';var Sequelize=require('sequelize');module[_0xd1c3('0x0')]={'name':{'type':Sequelize[_0xd1c3('0x1')]},'description':{'type':Sequelize[_0xd1c3('0x1')]},'username':{'type':Sequelize[_0xd1c3('0x1')],'unique':_0xd1c3('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd1c3('0x3')},'serverUrl':{'type':Sequelize[_0xd1c3('0x1')]}}; \ No newline at end of file +var _0x11c8=['username','remoteUri','exports','STRING'];(function(_0x3a435d,_0xbcc898){var _0x4fcd12=function(_0x50ea20){while(--_0x50ea20){_0x3a435d['push'](_0x3a435d['shift']());}};_0x4fcd12(++_0xbcc898);}(_0x11c8,0x19a));var _0x811c=function(_0x44c844,_0x1e3d7d){_0x44c844=_0x44c844-0x0;var _0x1d51b7=_0x11c8[_0x44c844];return _0x1d51b7;};'use strict';var Sequelize=require('sequelize');module[_0x811c('0x0')]={'name':{'type':Sequelize[_0x811c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x811c('0x1')],'unique':_0x811c('0x2')},'apiKey':{'type':Sequelize[_0x811c('0x1')]},'remoteUri':{'type':Sequelize[_0x811c('0x1')],'unique':_0x811c('0x3')},'serverUrl':{'type':Sequelize[_0x811c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 923e7ae..fd1b1ab 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 _0xf296=['Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','destroy','stack','name','index','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','FreshsalesAccount','count','include','findAll','rows','find','create','body','params','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','email'];(function(_0x4a5091,_0x1e61be){var _0x10cbd8=function(_0x3caee7){while(--_0x3caee7){_0x4a5091['push'](_0x4a5091['shift']());}};_0x10cbd8(++_0x1e61be);}(_0xf296,0xec));var _0x6f29=function(_0x23fd1b,_0x469cab){_0x23fd1b=_0x23fd1b-0x0;var _0x304e83=_0xf296[_0x23fd1b];return _0x304e83;};'use strict';var pdf=require(_0x6f29('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6f29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f29('0x2'));var rp=require(_0x6f29('0x3'));var moment=require(_0x6f29('0x4'));var BPromise=require(_0x6f29('0x5'));var Mustache=require(_0x6f29('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6f29('0x7'));var csv=require('to-csv');var ejs=require(_0x6f29('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6f29('0x9'));var crypto=require('crypto');var jsforce=require(_0x6f29('0xa'));var deskjs=require(_0x6f29('0xb'));var toCsv=require(_0x6f29('0xc'));var querystring=require(_0x6f29('0xd'));var Papa=require(_0x6f29('0xe'));var Redis=require(_0x6f29('0xf'));var authService=require(_0x6f29('0x10'));var qs=require(_0x6f29('0x11'));var as=require(_0x6f29('0x12'));var hardwareService=require(_0x6f29('0x13'));var logger=require(_0x6f29('0x14'))(_0x6f29('0x15'));var utils=require('../../config/utils');var config=require(_0x6f29('0x16'));var db=require(_0x6f29('0x17'))['db'];var integrations=require(_0x6f29('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x6f29('0x19')][_0x6f29('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x896669,_0x4d1571,_0x2db2e7){if(_0x2db2e7){var _0x451e96=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x451e96['test'](_0x4d1571)){return _0x896669;}else{throw new db['Sequelize'][(_0x6f29('0x1b'))](_0x6f29('0x1c'));}}else{return _0x896669;}}function respondWithRpcPromise(_0x5b083d,_0x2b4c32,_0xfcf013,_0x4a127b){return new BPromise(function(_0xff9c84,_0x4e7fa6){var _0x52509f=_0x4a127b||client;return _0x52509f['request'](_0x5b083d,_0xfcf013)[_0x6f29('0x1d')](function(_0x906d67){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x2b4c32,_0x6f29('0x1e'));logger[_0x6f29('0x1f')](_0x6f29('0x20'),_0x2b4c32,_0x6f29('0x1e'),JSON[_0x6f29('0x21')](_0x906d67));if(_0x906d67['error']){if(_0x906d67[_0x6f29('0x22')][_0x6f29('0x23')]===0x1f4){logger[_0x6f29('0x22')](_0x6f29('0x24'),_0x2b4c32,_0x906d67[_0x6f29('0x22')][_0x6f29('0x25')]);return _0x4e7fa6(_0x906d67[_0x6f29('0x22')][_0x6f29('0x25')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x2b4c32,_0x906d67[_0x6f29('0x22')][_0x6f29('0x25')]);return _0xff9c84(_0x906d67[_0x6f29('0x22')][_0x6f29('0x25')]);}else{logger[_0x6f29('0x26')](_0x6f29('0x24'),_0x2b4c32,_0x6f29('0x1e'));_0xff9c84(_0x906d67[_0x6f29('0x27')][_0x6f29('0x25')]);}})[_0x6f29('0x28')](function(_0x36f503){logger['error'](_0x6f29('0x24'),_0x2b4c32,_0x36f503);_0x4e7fa6(_0x36f503);});});}function respondWithStatusCode(_0x371148,_0x10ff85){_0x10ff85=_0x10ff85||0xcc;return function(_0x536440){if(_0x536440){return _0x371148[_0x6f29('0x29')](_0x10ff85);}return _0x371148[_0x6f29('0x2a')](_0x10ff85)[_0x6f29('0x2b')]();};}function respondWithResult(_0x374ddc,_0x3758d7){_0x3758d7=_0x3758d7||0xc8;return function(_0x46b460){if(_0x46b460){return _0x374ddc[_0x6f29('0x2a')](_0x3758d7)[_0x6f29('0x2c')](_0x46b460);}};}function respondWithFilteredResult(_0xa45934,_0x1021d6){return function(_0x543f8e){if(_0x543f8e){var _0x5ca295=_0x543f8e['count'],_0x3fe35d=_0x1021d6[_0x6f29('0x2d')],_0xf4e989=_0x1021d6[_0x6f29('0x2d')]+_0x1021d6['limit'],_0x448877;if(_0xf4e989>=_0x5ca295){_0xf4e989=_0x5ca295;_0x448877=0xc8;}else{_0x448877=0xce;}_0xa45934[_0x6f29('0x2a')](_0x448877);return _0xa45934[_0x6f29('0x2e')](_0x6f29('0x2f'),_0x3fe35d+'-'+_0xf4e989+'/'+_0x5ca295)[_0x6f29('0x2c')](_0x543f8e);}return null;};}function patchUpdates(_0x1e18c4){return function(_0x13517e){try{jsonpatch[_0x6f29('0x30')](_0x13517e,_0x1e18c4,!![]);}catch(_0x2f7c60){return BPromise[_0x6f29('0x31')](_0x2f7c60);}return _0x13517e['save']();};}function saveUpdates(_0x2cda12,_0xb7bca2){return function(_0x357ff1){if(_0x357ff1){return _0x357ff1[_0x6f29('0x32')](_0x2cda12)['then'](function(_0xaa243){return _0xaa243;});}return null;};}function removeEntity(_0x250d41,_0x19123d){return function(_0x21a57b){if(_0x21a57b){return _0x21a57b[_0x6f29('0x33')]()[_0x6f29('0x1d')](function(){_0x250d41[_0x6f29('0x2a')](0xcc)[_0x6f29('0x2b')]();});}};}function handleEntityNotFound(_0x16ec57,_0x1f1b7a){return function(_0x2e4b93){if(!_0x2e4b93){_0x16ec57['sendStatus'](0x194);}return _0x2e4b93;};}function handleError(_0x3fb822,_0x1bbe38){_0x1bbe38=_0x1bbe38||0x1f4;return function(_0x217b7f){logger[_0x6f29('0x22')](_0x217b7f[_0x6f29('0x34')]);if(_0x217b7f['name']){delete _0x217b7f[_0x6f29('0x35')];}_0x3fb822[_0x6f29('0x2a')](_0x1bbe38)['send'](_0x217b7f);};}exports[_0x6f29('0x36')]=function(_0x3e7eda,_0x1c809d){var _0x28fcdc={},_0x28d392={},_0x3bd55c={'count':0x0,'rows':[]};var _0x3834b6=_['map'](db['FreshsalesAccount'][_0x6f29('0x37')],function(_0x293d00){return{'name':_0x293d00[_0x6f29('0x38')],'type':_0x293d00['type'][_0x6f29('0x39')]};});_0x28d392['model']=_[_0x6f29('0x3a')](_0x3834b6,'name');_0x28d392[_0x6f29('0x3b')]=_[_0x6f29('0x3c')](_0x3e7eda['query']);_0x28d392['filters']=_[_0x6f29('0x3d')](_0x28d392[_0x6f29('0x3e')],_0x28d392['query']);_0x28fcdc[_0x6f29('0x3f')]=_[_0x6f29('0x3d')](_0x28d392[_0x6f29('0x3e')],qs[_0x6f29('0x40')](_0x3e7eda['query']['fields']));_0x28fcdc[_0x6f29('0x3f')]=_0x28fcdc[_0x6f29('0x3f')][_0x6f29('0x41')]?_0x28fcdc['attributes']:_0x28d392[_0x6f29('0x3e')];if(!_0x3e7eda[_0x6f29('0x3b')]['hasOwnProperty'](_0x6f29('0x42'))){_0x28fcdc['limit']=qs[_0x6f29('0x43')](_0x3e7eda[_0x6f29('0x3b')][_0x6f29('0x43')]);_0x28fcdc[_0x6f29('0x2d')]=qs[_0x6f29('0x2d')](_0x3e7eda[_0x6f29('0x3b')][_0x6f29('0x2d')]);}_0x28fcdc[_0x6f29('0x44')]=qs[_0x6f29('0x45')](_0x3e7eda['query']['sort']);_0x28fcdc[_0x6f29('0x46')]=qs['filters'](_[_0x6f29('0x47')](_0x3e7eda[_0x6f29('0x3b')],_0x28d392[_0x6f29('0x48')]),_0x3834b6);if(_0x3e7eda[_0x6f29('0x3b')][_0x6f29('0x49')]){_0x28fcdc[_0x6f29('0x46')]=_[_0x6f29('0x4a')](_0x28fcdc[_0x6f29('0x46')],{'$or':_[_0x6f29('0x3a')](_0x3834b6,function(_0x39c26e){if(_0x39c26e[_0x6f29('0x4b')]!==_0x6f29('0x4c')){var _0xe2e936={};_0xe2e936[_0x39c26e[_0x6f29('0x35')]]={'$like':'%'+_0x3e7eda[_0x6f29('0x3b')][_0x6f29('0x49')]+'%'};return _0xe2e936;}})});}_0x28fcdc=_[_0x6f29('0x4a')]({},_0x28fcdc,_0x3e7eda[_0x6f29('0x4d')]);var _0x126392={'where':_0x28fcdc[_0x6f29('0x46')]};return db[_0x6f29('0x4e')][_0x6f29('0x4f')](_0x126392)['then'](function(_0x13b922){_0x3bd55c['count']=_0x13b922;if(_0x3e7eda[_0x6f29('0x3b')]['includeAll']){_0x28fcdc[_0x6f29('0x50')]=[{'all':!![]}];}return db[_0x6f29('0x4e')][_0x6f29('0x51')](_0x28fcdc);})[_0x6f29('0x1d')](function(_0x4af545){_0x3bd55c[_0x6f29('0x52')]=_0x4af545;return _0x3bd55c;})[_0x6f29('0x1d')](respondWithFilteredResult(_0x1c809d,_0x28fcdc))[_0x6f29('0x28')](handleError(_0x1c809d,null));};exports['show']=function(_0x25c1d2,_0x5d2a02){var _0x364d83={'raw':![],'where':{'id':_0x25c1d2['params']['id']}},_0x45352a={};_0x45352a[_0x6f29('0x3e')]=_[_0x6f29('0x3c')](db['FreshsalesAccount'][_0x6f29('0x37')]);_0x45352a['query']=_[_0x6f29('0x3c')](_0x25c1d2[_0x6f29('0x3b')]);_0x45352a['filters']=_[_0x6f29('0x3d')](_0x45352a[_0x6f29('0x3e')],_0x45352a[_0x6f29('0x3b')]);_0x364d83[_0x6f29('0x3f')]=_[_0x6f29('0x3d')](_0x45352a['model'],qs[_0x6f29('0x40')](_0x25c1d2[_0x6f29('0x3b')][_0x6f29('0x40')]));_0x364d83['attributes']=_0x364d83[_0x6f29('0x3f')][_0x6f29('0x41')]?_0x364d83[_0x6f29('0x3f')]:_0x45352a['model'];if(_0x25c1d2['query']['includeAll']){_0x364d83[_0x6f29('0x50')]=[{'all':!![]}];}_0x364d83=_[_0x6f29('0x4a')]({},_0x364d83,_0x25c1d2[_0x6f29('0x4d')]);return db['FreshsalesAccount'][_0x6f29('0x53')](_0x364d83)[_0x6f29('0x1d')](handleEntityNotFound(_0x5d2a02,null))['then'](respondWithResult(_0x5d2a02,null))[_0x6f29('0x28')](handleError(_0x5d2a02,null));};exports[_0x6f29('0x54')]=function(_0x4728ea,_0x39b5ae){return db[_0x6f29('0x4e')][_0x6f29('0x54')](_0x4728ea['body'],{})['then'](respondWithResult(_0x39b5ae,0xc9))[_0x6f29('0x28')](handleError(_0x39b5ae,null));};exports[_0x6f29('0x32')]=function(_0x2e9c97,_0x3101e2){if(_0x2e9c97['body']['id']){delete _0x2e9c97[_0x6f29('0x55')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x2e9c97[_0x6f29('0x56')]['id']}})['then'](handleEntityNotFound(_0x3101e2,null))['then'](saveUpdates(_0x2e9c97[_0x6f29('0x55')],null))[_0x6f29('0x1d')](respondWithResult(_0x3101e2,null))[_0x6f29('0x28')](handleError(_0x3101e2,null));};exports[_0x6f29('0x33')]=function(_0x3b35fa,_0x1b6fac){return db[_0x6f29('0x4e')][_0x6f29('0x53')]({'where':{'id':_0x3b35fa['params']['id']}})[_0x6f29('0x1d')](handleEntityNotFound(_0x1b6fac,null))[_0x6f29('0x1d')](removeEntity(_0x1b6fac,null))[_0x6f29('0x28')](handleError(_0x1b6fac,null));};exports[_0x6f29('0x57')]=function(_0x311f33,_0x400b52,_0x241250){var _0x3ecda0={};var _0x5dc744={};var _0x144953;var _0x2e2c35;return db['FreshsalesAccount'][_0x6f29('0x58')]({'where':{'id':_0x311f33[_0x6f29('0x56')]['id']}})[_0x6f29('0x1d')](handleEntityNotFound(_0x400b52,null))['then'](function(_0xcbea09){if(_0xcbea09){_0x144953=_0xcbea09;_0x5dc744['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x5dc744['query']=_['keys'](_0x311f33['query']);_0x5dc744[_0x6f29('0x48')]=_[_0x6f29('0x3d')](_0x5dc744['model'],_0x5dc744[_0x6f29('0x3b')]);_0x3ecda0['attributes']=_[_0x6f29('0x3d')](_0x5dc744['model'],qs[_0x6f29('0x40')](_0x311f33[_0x6f29('0x3b')]['fields']));_0x3ecda0[_0x6f29('0x3f')]=_0x3ecda0[_0x6f29('0x3f')]['length']?_0x3ecda0['attributes']:_0x5dc744['model'];_0x3ecda0['order']=qs[_0x6f29('0x45')](_0x311f33[_0x6f29('0x3b')]['sort']);_0x3ecda0[_0x6f29('0x46')]=qs[_0x6f29('0x48')](_[_0x6f29('0x47')](_0x311f33['query'],_0x5dc744[_0x6f29('0x48')]));if(_0x311f33[_0x6f29('0x3b')][_0x6f29('0x49')]){_0x3ecda0['where']=_['merge'](_0x3ecda0[_0x6f29('0x46')],{'$or':_[_0x6f29('0x3a')](_0x3ecda0[_0x6f29('0x3f')],function(_0x559294){var _0x2d2096={};_0x2d2096[_0x559294]={'$like':'%'+_0x311f33[_0x6f29('0x3b')][_0x6f29('0x49')]+'%'};return _0x2d2096;})});}_0x3ecda0=_['merge']({},_0x3ecda0,_0x311f33['options']);return _0x144953[_0x6f29('0x57')](_0x3ecda0);}})[_0x6f29('0x1d')](function(_0x19dfb3){if(_0x19dfb3){_0x2e2c35=_0x19dfb3['length'];if(!_0x311f33[_0x6f29('0x3b')]['hasOwnProperty'](_0x6f29('0x42'))){_0x3ecda0[_0x6f29('0x43')]=qs['limit'](_0x311f33['query']['limit']);_0x3ecda0[_0x6f29('0x2d')]=qs['offset'](_0x311f33['query'][_0x6f29('0x2d')]);}return _0x144953[_0x6f29('0x57')](_0x3ecda0);}})[_0x6f29('0x1d')](function(_0x2e8b9b){if(_0x2e8b9b){return _0x2e8b9b?{'count':_0x2e2c35,'rows':_0x2e8b9b}:null;}})[_0x6f29('0x1d')](respondWithResult(_0x400b52,null))[_0x6f29('0x28')](handleError(_0x400b52,null));};exports[_0x6f29('0x59')]=function(_0x4b2dc2,_0x249174,_0x171caf){if(_0x4b2dc2[_0x6f29('0x55')]['id']){delete _0x4b2dc2['body']['id'];}return db[_0x6f29('0x4e')]['findOne']({'where':{'id':_0x4b2dc2[_0x6f29('0x56')]['id']}})['then'](handleEntityNotFound(_0x249174,null))[_0x6f29('0x1d')](function(_0x452cbe){if(_0x452cbe){_0x4b2dc2[_0x6f29('0x55')][_0x6f29('0x5a')]=_0x452cbe['id'];_0x4b2dc2[_0x6f29('0x55')][_0x6f29('0x5b')]=integrations[_0x6f29('0x5c')](_0x4b2dc2['body']['channel'],_0x4b2dc2[_0x6f29('0x55')]['type']);_0x4b2dc2[_0x6f29('0x55')][_0x6f29('0x5d')]=integrations[_0x6f29('0x5e')](_0x4b2dc2[_0x6f29('0x55')][_0x6f29('0x5f')],_0x4b2dc2[_0x6f29('0x55')][_0x6f29('0x4b')]);return db['FreshsalesConfiguration']['create'](_0x4b2dc2['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x6f29('0x5b')},{'model':db[_0x6f29('0x60')],'as':_0x6f29('0x5d')}]});}return null;})[_0x6f29('0x1d')](respondWithResult(_0x249174,null))[_0x6f29('0x28')](handleError(_0x249174,null));};exports[_0x6f29('0x61')]=function(_0x444e06,_0x522d83,_0x2d83dc){var _0x345d72='';var _0x2f77eb='';return db[_0x6f29('0x4e')][_0x6f29('0x58')]({'where':{'id':_0x444e06['params']['id']},'attributes':['id',_0x6f29('0x62'),'remoteUri','apiKey']})[_0x6f29('0x1d')](handleEntityNotFound(_0x522d83,null))['then'](function(_0xd9dbd9){if(_0xd9dbd9){_0x2f77eb=_0xd9dbd9[_0x6f29('0x62')];_0x345d72=_0xd9dbd9['remoteUri'];var _0x1da14c=_0xd9dbd9[_0x6f29('0x63')][_0x6f29('0x64')](-0x1);if(_0x1da14c==='/'){_0x345d72=_0x345d72['substring'](0x0,_0x345d72[_0x6f29('0x65')](_0x1da14c));}return rp({'method':_0x6f29('0x66'),'uri':util[_0x6f29('0x67')](_0x6f29('0x68'),_0x345d72,_0x6f29('0x69')),'headers':{'Authorization':_0x6f29('0x6a')+_0xd9dbd9[_0x6f29('0x6b')]},'json':!![]});}})['then'](function(_0x71303f){if(_0x71303f){var _0x21a2ee=_0x71303f['users'];var _0x3210cb=![];var _0x294ccc=null;for(_0x294ccc=0x0;_0x294ccc<_0x21a2ee[_0x6f29('0x41')];_0x294ccc++){if(_0x21a2ee[_0x294ccc][_0x6f29('0x6c')]===_0x2f77eb){_0x3210cb=!![];}}if(_0x3210cb){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6f29('0x6d')});}}})['then'](respondWithResult(_0x522d83,null))[_0x6f29('0x28')](function(_0x52a697){var _0x204d6d=_0x444e06['query'][_0x6f29('0x6e')]?0x1f4:_0x52a697[_0x6f29('0x6f')]||0x1f4;logger[_0x6f29('0x22')](_0x6f29('0x70'),_0x6f29('0x61'),_0x204d6d,JSON[_0x6f29('0x21')](_0x52a697));delete _0x52a697[_0x6f29('0x35')];if(_0x204d6d===0x191){_0x204d6d=0x190;}_0x522d83['status'](_0x204d6d)[_0x6f29('0x71')](_0x444e06[_0x6f29('0x3b')][_0x6f29('0x6e')]?{'message':_0x6f29('0x72'),'statusCode':_0x52a697[_0x6f29('0x6f')]}:_0x52a697);});}; \ No newline at end of file +var _0xdd49=['apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','client','http','test','Sequelize','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','destroy','stack','name','send','index','map','FreshsalesAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','options','find','create','body','findOne','order','getConfigurations','addConfiguration','AccountId','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','Subjects','username','remoteUri'];(function(_0x16cf52,_0x44157c){var _0x31db1c=function(_0x239301){while(--_0x239301){_0x16cf52['push'](_0x16cf52['shift']());}};_0x31db1c(++_0x44157c);}(_0xdd49,0x1d8));var _0x9dd4=function(_0x4fbaf9,_0x3b8190){_0x4fbaf9=_0x4fbaf9-0x0;var _0x1d89a0=_0xdd49[_0x4fbaf9];return _0x1d89a0;};'use strict';var pdf=require(_0x9dd4('0x0'));var emlformat=require(_0x9dd4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9dd4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9dd4('0x3'));var BPromise=require(_0x9dd4('0x4'));var Mustache=require(_0x9dd4('0x5'));var util=require(_0x9dd4('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9dd4('0x7'));var ejs=require(_0x9dd4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9dd4('0x9'));var crypto=require(_0x9dd4('0xa'));var jsforce=require(_0x9dd4('0xb'));var deskjs=require(_0x9dd4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9dd4('0xd'));var Papa=require(_0x9dd4('0xe'));var Redis=require('ioredis');var authService=require(_0x9dd4('0xf'));var qs=require(_0x9dd4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dd4('0x11'));var logger=require(_0x9dd4('0x12'))(_0x9dd4('0x13'));var utils=require(_0x9dd4('0x14'));var config=require('../../config/environment');var db=require(_0x9dd4('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x9dd4('0x16')][_0x9dd4('0x17')]({'port':0x232a});function checkPasswordPattern(_0x568789,_0x18159e,_0x45fb64){if(_0x45fb64){var _0x44712b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x44712b[_0x9dd4('0x18')](_0x18159e)){return _0x568789;}else{throw new db[(_0x9dd4('0x19'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x568789;}}function respondWithRpcPromise(_0x40c4af,_0x2febc6,_0x422b03,_0xa7217c){return new BPromise(function(_0x1dc0f6,_0x40983a){var _0x5185f1=_0xa7217c||client;return _0x5185f1[_0x9dd4('0x1a')](_0x40c4af,_0x422b03)[_0x9dd4('0x1b')](function(_0x25d129){logger['info'](_0x9dd4('0x1c'),_0x2febc6,_0x9dd4('0x1d'));logger[_0x9dd4('0x1e')](_0x9dd4('0x1f'),_0x2febc6,_0x9dd4('0x1d'),JSON[_0x9dd4('0x20')](_0x25d129));if(_0x25d129[_0x9dd4('0x21')]){if(_0x25d129[_0x9dd4('0x21')][_0x9dd4('0x22')]===0x1f4){logger[_0x9dd4('0x21')](_0x9dd4('0x1c'),_0x2febc6,_0x25d129[_0x9dd4('0x21')][_0x9dd4('0x23')]);return _0x40983a(_0x25d129[_0x9dd4('0x21')][_0x9dd4('0x23')]);}logger[_0x9dd4('0x21')](_0x9dd4('0x1c'),_0x2febc6,_0x25d129[_0x9dd4('0x21')][_0x9dd4('0x23')]);return _0x1dc0f6(_0x25d129[_0x9dd4('0x21')][_0x9dd4('0x23')]);}else{logger[_0x9dd4('0x24')](_0x9dd4('0x1c'),_0x2febc6,'request\x20sent');_0x1dc0f6(_0x25d129[_0x9dd4('0x25')][_0x9dd4('0x23')]);}})[_0x9dd4('0x26')](function(_0x1f8eee){logger[_0x9dd4('0x21')](_0x9dd4('0x1c'),_0x2febc6,_0x1f8eee);_0x40983a(_0x1f8eee);});});}function respondWithStatusCode(_0x3bd396,_0x49c473){_0x49c473=_0x49c473||0xcc;return function(_0x3aa2c2){if(_0x3aa2c2){return _0x3bd396[_0x9dd4('0x27')](_0x49c473);}return _0x3bd396[_0x9dd4('0x28')](_0x49c473)[_0x9dd4('0x29')]();};}function respondWithResult(_0x54c466,_0x7dc636){_0x7dc636=_0x7dc636||0xc8;return function(_0x2a3ac5){if(_0x2a3ac5){return _0x54c466['status'](_0x7dc636)['json'](_0x2a3ac5);}};}function respondWithFilteredResult(_0xbc700f,_0x54063b){return function(_0xc23f1e){if(_0xc23f1e){var _0x2b1c3d=_0xc23f1e[_0x9dd4('0x2a')],_0x4c0096=_0x54063b[_0x9dd4('0x2b')],_0xd2f4e9=_0x54063b[_0x9dd4('0x2b')]+_0x54063b['limit'],_0x2b7015;if(_0xd2f4e9>=_0x2b1c3d){_0xd2f4e9=_0x2b1c3d;_0x2b7015=0xc8;}else{_0x2b7015=0xce;}_0xbc700f['status'](_0x2b7015);return _0xbc700f[_0x9dd4('0x2c')]('Content-Range',_0x4c0096+'-'+_0xd2f4e9+'/'+_0x2b1c3d)[_0x9dd4('0x2d')](_0xc23f1e);}return null;};}function patchUpdates(_0x2cb042){return function(_0x4ff19d){try{jsonpatch[_0x9dd4('0x2e')](_0x4ff19d,_0x2cb042,!![]);}catch(_0x551199){return BPromise[_0x9dd4('0x2f')](_0x551199);}return _0x4ff19d[_0x9dd4('0x30')]();};}function saveUpdates(_0x40283f,_0x4c5073){return function(_0x3c970d){if(_0x3c970d){return _0x3c970d[_0x9dd4('0x31')](_0x40283f)['then'](function(_0x3dc34f){return _0x3dc34f;});}return null;};}function removeEntity(_0x4debfa,_0xe54ee7){return function(_0x128a47){if(_0x128a47){return _0x128a47[_0x9dd4('0x32')]()[_0x9dd4('0x1b')](function(){_0x4debfa[_0x9dd4('0x28')](0xcc)[_0x9dd4('0x29')]();});}};}function handleEntityNotFound(_0x42a0ee,_0x53bb08){return function(_0x5db3bb){if(!_0x5db3bb){_0x42a0ee[_0x9dd4('0x27')](0x194);}return _0x5db3bb;};}function handleError(_0x9c811d,_0x15f801){_0x15f801=_0x15f801||0x1f4;return function(_0x464737){logger[_0x9dd4('0x21')](_0x464737[_0x9dd4('0x33')]);if(_0x464737[_0x9dd4('0x34')]){delete _0x464737['name'];}_0x9c811d[_0x9dd4('0x28')](_0x15f801)[_0x9dd4('0x35')](_0x464737);};}exports[_0x9dd4('0x36')]=function(_0x3089a6,_0x1cb081){var _0x2c1ceb={},_0x3ac51f={},_0x156409={'count':0x0,'rows':[]};var _0x2f1123=_[_0x9dd4('0x37')](db[_0x9dd4('0x38')]['rawAttributes'],function(_0x8d3f22){return{'name':_0x8d3f22[_0x9dd4('0x39')],'type':_0x8d3f22[_0x9dd4('0x3a')]['key']};});_0x3ac51f[_0x9dd4('0x3b')]=_[_0x9dd4('0x37')](_0x2f1123,'name');_0x3ac51f[_0x9dd4('0x3c')]=_[_0x9dd4('0x3d')](_0x3089a6[_0x9dd4('0x3c')]);_0x3ac51f[_0x9dd4('0x3e')]=_[_0x9dd4('0x3f')](_0x3ac51f[_0x9dd4('0x3b')],_0x3ac51f[_0x9dd4('0x3c')]);_0x2c1ceb['attributes']=_[_0x9dd4('0x3f')](_0x3ac51f[_0x9dd4('0x3b')],qs[_0x9dd4('0x40')](_0x3089a6['query'][_0x9dd4('0x40')]));_0x2c1ceb[_0x9dd4('0x41')]=_0x2c1ceb[_0x9dd4('0x41')][_0x9dd4('0x42')]?_0x2c1ceb[_0x9dd4('0x41')]:_0x3ac51f[_0x9dd4('0x3b')];if(!_0x3089a6['query'][_0x9dd4('0x43')](_0x9dd4('0x44'))){_0x2c1ceb[_0x9dd4('0x45')]=qs[_0x9dd4('0x45')](_0x3089a6['query']['limit']);_0x2c1ceb[_0x9dd4('0x2b')]=qs[_0x9dd4('0x2b')](_0x3089a6[_0x9dd4('0x3c')][_0x9dd4('0x2b')]);}_0x2c1ceb['order']=qs[_0x9dd4('0x46')](_0x3089a6[_0x9dd4('0x3c')][_0x9dd4('0x46')]);_0x2c1ceb[_0x9dd4('0x47')]=qs['filters'](_[_0x9dd4('0x48')](_0x3089a6[_0x9dd4('0x3c')],_0x3ac51f[_0x9dd4('0x3e')]),_0x2f1123);if(_0x3089a6[_0x9dd4('0x3c')]['filter']){_0x2c1ceb['where']=_[_0x9dd4('0x49')](_0x2c1ceb[_0x9dd4('0x47')],{'$or':_[_0x9dd4('0x37')](_0x2f1123,function(_0x44d79a){if(_0x44d79a[_0x9dd4('0x3a')]!==_0x9dd4('0x4a')){var _0x2aa6ed={};_0x2aa6ed[_0x44d79a[_0x9dd4('0x34')]]={'$like':'%'+_0x3089a6[_0x9dd4('0x3c')][_0x9dd4('0x4b')]+'%'};return _0x2aa6ed;}})});}_0x2c1ceb=_[_0x9dd4('0x49')]({},_0x2c1ceb,_0x3089a6['options']);var _0x437405={'where':_0x2c1ceb[_0x9dd4('0x47')]};return db[_0x9dd4('0x38')][_0x9dd4('0x2a')](_0x437405)[_0x9dd4('0x1b')](function(_0x4ff2c7){_0x156409[_0x9dd4('0x2a')]=_0x4ff2c7;if(_0x3089a6[_0x9dd4('0x3c')][_0x9dd4('0x4c')]){_0x2c1ceb[_0x9dd4('0x4d')]=[{'all':!![]}];}return db[_0x9dd4('0x38')]['findAll'](_0x2c1ceb);})[_0x9dd4('0x1b')](function(_0x1bb2b0){_0x156409[_0x9dd4('0x4e')]=_0x1bb2b0;return _0x156409;})[_0x9dd4('0x1b')](respondWithFilteredResult(_0x1cb081,_0x2c1ceb))[_0x9dd4('0x26')](handleError(_0x1cb081,null));};exports[_0x9dd4('0x4f')]=function(_0xf90da0,_0x3a75d9){var _0x284090={'raw':![],'where':{'id':_0xf90da0[_0x9dd4('0x50')]['id']}},_0x4f90bc={};_0x4f90bc[_0x9dd4('0x3b')]=_[_0x9dd4('0x3d')](db['FreshsalesAccount']['rawAttributes']);_0x4f90bc['query']=_[_0x9dd4('0x3d')](_0xf90da0[_0x9dd4('0x3c')]);_0x4f90bc[_0x9dd4('0x3e')]=_[_0x9dd4('0x3f')](_0x4f90bc[_0x9dd4('0x3b')],_0x4f90bc['query']);_0x284090[_0x9dd4('0x41')]=_[_0x9dd4('0x3f')](_0x4f90bc[_0x9dd4('0x3b')],qs['fields'](_0xf90da0['query'][_0x9dd4('0x40')]));_0x284090[_0x9dd4('0x41')]=_0x284090[_0x9dd4('0x41')][_0x9dd4('0x42')]?_0x284090[_0x9dd4('0x41')]:_0x4f90bc[_0x9dd4('0x3b')];if(_0xf90da0[_0x9dd4('0x3c')][_0x9dd4('0x4c')]){_0x284090[_0x9dd4('0x4d')]=[{'all':!![]}];}_0x284090=_[_0x9dd4('0x49')]({},_0x284090,_0xf90da0[_0x9dd4('0x51')]);return db[_0x9dd4('0x38')][_0x9dd4('0x52')](_0x284090)[_0x9dd4('0x1b')](handleEntityNotFound(_0x3a75d9,null))[_0x9dd4('0x1b')](respondWithResult(_0x3a75d9,null))[_0x9dd4('0x26')](handleError(_0x3a75d9,null));};exports[_0x9dd4('0x53')]=function(_0x14e819,_0x4b9d15){return db[_0x9dd4('0x38')][_0x9dd4('0x53')](_0x14e819['body'],{})['then'](respondWithResult(_0x4b9d15,0xc9))[_0x9dd4('0x26')](handleError(_0x4b9d15,null));};exports[_0x9dd4('0x31')]=function(_0x1e471c,_0x33038f){if(_0x1e471c[_0x9dd4('0x54')]['id']){delete _0x1e471c[_0x9dd4('0x54')]['id'];}return db[_0x9dd4('0x38')][_0x9dd4('0x52')]({'where':{'id':_0x1e471c[_0x9dd4('0x50')]['id']}})[_0x9dd4('0x1b')](handleEntityNotFound(_0x33038f,null))[_0x9dd4('0x1b')](saveUpdates(_0x1e471c['body'],null))[_0x9dd4('0x1b')](respondWithResult(_0x33038f,null))[_0x9dd4('0x26')](handleError(_0x33038f,null));};exports[_0x9dd4('0x32')]=function(_0x348e27,_0x13d06e){return db[_0x9dd4('0x38')][_0x9dd4('0x52')]({'where':{'id':_0x348e27[_0x9dd4('0x50')]['id']}})[_0x9dd4('0x1b')](handleEntityNotFound(_0x13d06e,null))[_0x9dd4('0x1b')](removeEntity(_0x13d06e,null))['catch'](handleError(_0x13d06e,null));};exports['getConfigurations']=function(_0x3d83bb,_0x4330ed,_0xcb86d3){var _0x121912={};var _0xea82ad={};var _0x276586;var _0x1703a3;return db[_0x9dd4('0x38')][_0x9dd4('0x55')]({'where':{'id':_0x3d83bb[_0x9dd4('0x50')]['id']}})[_0x9dd4('0x1b')](handleEntityNotFound(_0x4330ed,null))[_0x9dd4('0x1b')](function(_0x4d301b){if(_0x4d301b){_0x276586=_0x4d301b;_0xea82ad['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0xea82ad[_0x9dd4('0x3c')]=_[_0x9dd4('0x3d')](_0x3d83bb['query']);_0xea82ad['filters']=_['intersection'](_0xea82ad['model'],_0xea82ad['query']);_0x121912['attributes']=_[_0x9dd4('0x3f')](_0xea82ad[_0x9dd4('0x3b')],qs['fields'](_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x40')]));_0x121912['attributes']=_0x121912[_0x9dd4('0x41')][_0x9dd4('0x42')]?_0x121912[_0x9dd4('0x41')]:_0xea82ad['model'];_0x121912[_0x9dd4('0x56')]=qs['sort'](_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x46')]);_0x121912[_0x9dd4('0x47')]=qs['filters'](_[_0x9dd4('0x48')](_0x3d83bb[_0x9dd4('0x3c')],_0xea82ad[_0x9dd4('0x3e')]));if(_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x4b')]){_0x121912[_0x9dd4('0x47')]=_[_0x9dd4('0x49')](_0x121912['where'],{'$or':_[_0x9dd4('0x37')](_0x121912[_0x9dd4('0x41')],function(_0xc91c4d){var _0x4ba099={};_0x4ba099[_0xc91c4d]={'$like':'%'+_0x3d83bb['query'][_0x9dd4('0x4b')]+'%'};return _0x4ba099;})});}_0x121912=_['merge']({},_0x121912,_0x3d83bb['options']);return _0x276586[_0x9dd4('0x57')](_0x121912);}})[_0x9dd4('0x1b')](function(_0x25d8c3){if(_0x25d8c3){_0x1703a3=_0x25d8c3['length'];if(!_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x43')](_0x9dd4('0x44'))){_0x121912[_0x9dd4('0x45')]=qs['limit'](_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x45')]);_0x121912[_0x9dd4('0x2b')]=qs['offset'](_0x3d83bb[_0x9dd4('0x3c')][_0x9dd4('0x2b')]);}return _0x276586[_0x9dd4('0x57')](_0x121912);}})[_0x9dd4('0x1b')](function(_0x31c817){if(_0x31c817){return _0x31c817?{'count':_0x1703a3,'rows':_0x31c817}:null;}})[_0x9dd4('0x1b')](respondWithResult(_0x4330ed,null))['catch'](handleError(_0x4330ed,null));};exports[_0x9dd4('0x58')]=function(_0x3f2c4c,_0x15baf9,_0x5bbe88){if(_0x3f2c4c[_0x9dd4('0x54')]['id']){delete _0x3f2c4c[_0x9dd4('0x54')]['id'];}return db['FreshsalesAccount'][_0x9dd4('0x55')]({'where':{'id':_0x3f2c4c['params']['id']}})['then'](handleEntityNotFound(_0x15baf9,null))[_0x9dd4('0x1b')](function(_0x30f10f){if(_0x30f10f){_0x3f2c4c[_0x9dd4('0x54')][_0x9dd4('0x59')]=_0x30f10f['id'];_0x3f2c4c[_0x9dd4('0x54')]['Subjects']=integrations['getSubjects'](_0x3f2c4c[_0x9dd4('0x54')][_0x9dd4('0x5a')],_0x3f2c4c['body']['type']);_0x3f2c4c[_0x9dd4('0x54')][_0x9dd4('0x5b')]=integrations[_0x9dd4('0x5c')](_0x3f2c4c[_0x9dd4('0x54')][_0x9dd4('0x5a')],_0x3f2c4c[_0x9dd4('0x54')]['type']);return db[_0x9dd4('0x5d')][_0x9dd4('0x53')](_0x3f2c4c[_0x9dd4('0x54')],{'include':[{'model':db[_0x9dd4('0x5e')],'as':_0x9dd4('0x5f')},{'model':db[_0x9dd4('0x5e')],'as':_0x9dd4('0x5b')}]});}return null;})[_0x9dd4('0x1b')](respondWithResult(_0x15baf9,null))[_0x9dd4('0x26')](handleError(_0x15baf9,null));};exports['getFields']=function(_0x1fd69f,_0x324f55,_0x30daee){var _0x26e548='';var _0x5a2545='';return db[_0x9dd4('0x38')][_0x9dd4('0x55')]({'where':{'id':_0x1fd69f[_0x9dd4('0x50')]['id']},'attributes':['id',_0x9dd4('0x60'),_0x9dd4('0x61'),_0x9dd4('0x62')]})[_0x9dd4('0x1b')](handleEntityNotFound(_0x324f55,null))[_0x9dd4('0x1b')](function(_0x73e49e){if(_0x73e49e){_0x5a2545=_0x73e49e[_0x9dd4('0x60')];_0x26e548=_0x73e49e[_0x9dd4('0x61')];var _0x491636=_0x73e49e[_0x9dd4('0x61')][_0x9dd4('0x63')](-0x1);if(_0x491636==='/'){_0x26e548=_0x26e548[_0x9dd4('0x64')](0x0,_0x26e548[_0x9dd4('0x65')](_0x491636));}return rp({'method':_0x9dd4('0x66'),'uri':util[_0x9dd4('0x67')](_0x9dd4('0x68'),_0x26e548,_0x9dd4('0x69')),'headers':{'Authorization':_0x9dd4('0x6a')+_0x73e49e[_0x9dd4('0x62')]},'json':!![]});}})[_0x9dd4('0x1b')](function(_0xd06e){if(_0xd06e){var _0x54f3df=_0xd06e[_0x9dd4('0x6b')];var _0x4d0d99=![];var _0x2f98e8=null;for(_0x2f98e8=0x0;_0x2f98e8<_0x54f3df[_0x9dd4('0x42')];_0x2f98e8++){if(_0x54f3df[_0x2f98e8][_0x9dd4('0x6c')]===_0x5a2545){_0x4d0d99=!![];}}if(_0x4d0d99){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9dd4('0x6d')});}}})[_0x9dd4('0x1b')](respondWithResult(_0x324f55,null))[_0x9dd4('0x26')](function(_0xc7a132){var _0x5b88b4=_0x1fd69f['query'][_0x9dd4('0x18')]?0x1f4:_0xc7a132[_0x9dd4('0x6e')]||0x1f4;logger['error'](_0x9dd4('0x6f'),_0x9dd4('0x70'),_0x5b88b4,JSON[_0x9dd4('0x20')](_0xc7a132));delete _0xc7a132['name'];if(_0x5b88b4===0x191){_0x5b88b4=0x190;}_0x324f55['status'](_0x5b88b4)[_0x9dd4('0x35')](_0x1fd69f[_0x9dd4('0x3c')][_0x9dd4('0x18')]?{'message':_0x9dd4('0x71'),'statusCode':_0xc7a132[_0x9dd4('0x6e')]}:_0xc7a132);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 1cfeb23..0bc11b8 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 _0x98a8=['FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1f2e26,_0x3d985b){var _0x37a06f=function(_0x5968b1){while(--_0x5968b1){_0x1f2e26['push'](_0x1f2e26['shift']());}};_0x37a06f(++_0x3d985b);}(_0x98a8,0x12c));var _0x898a=function(_0x44a694,_0x2e73f6){_0x44a694=_0x44a694-0x0;var _0x2d18f8=_0x98a8[_0x44a694];return _0x2d18f8;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var moment=require(_0x898a('0x4'));var BPromise=require(_0x898a('0x5'));var rp=require(_0x898a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var attributes=require(_0x898a('0x9'));var integrations=require(_0x898a('0xa'));module[_0x898a('0xb')]=function(_0x5d7e59,_0x3aadc2){return _0x5d7e59['define'](_0x898a('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd67b=['api','moment','bluebird','path','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util'];(function(_0x416865,_0x47124f){var _0x6373e5=function(_0x14f99c){while(--_0x14f99c){_0x416865['push'](_0x416865['shift']());}};_0x6373e5(++_0x47124f);}(_0xd67b,0x133));var _0xbd67=function(_0x9bb64f,_0x41f52c){_0x9bb64f=_0x9bb64f-0x0;var _0x1bd88c=_0xd67b[_0x9bb64f];return _0x1bd88c;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var logger=require('../../config/logger')(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var BPromise=require(_0xbd67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd67('0x4'));var rimraf=require('rimraf');var config=require(_0xbd67('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xbd67('0x6'));module[_0xbd67('0x7')]=function(_0x2ad142,_0x27b016){return _0x2ad142[_0xbd67('0x8')](_0xbd67('0x9'),attributes,{'tableName':_0xbd67('0xa'),'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 ecb5c97..f33b85d 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 _0x1c52=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','GetFreshsalesAccount','FreshsalesAccount','options','where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','find','raw','stringify','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x9abfb7,_0xf308ae){var _0x35e484=function(_0x247c73){while(--_0x247c73){_0x9abfb7['push'](_0x9abfb7['shift']());}};_0x35e484(++_0xf308ae);}(_0x1c52,0x7c));var _0x21c5=function(_0x18bde,_0x2c4d46){_0x18bde=_0x18bde-0x0;var _0x5f42d7=_0x1c52[_0x18bde];return _0x5f42d7;};'use strict';var _=require(_0x21c5('0x0'));var util=require(_0x21c5('0x1'));var moment=require(_0x21c5('0x2'));var BPromise=require(_0x21c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x21c5('0x4'));var logger=require(_0x21c5('0x5'))('rpc');var config=require(_0x21c5('0x6'));var jayson=require(_0x21c5('0x7'));var client=jayson[_0x21c5('0x8')][_0x21c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b12d5,_0xed0195,_0xb4b1e4){return new BPromise(function(_0x4c5a4f,_0xd34da2){return client[_0x21c5('0xa')](_0x5b12d5,_0xb4b1e4)[_0x21c5('0xb')](function(_0x27389f){logger['info'](_0x21c5('0xc'),_0xed0195,_0x21c5('0xd'));logger[_0x21c5('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0xed0195,_0x21c5('0xd'),JSON['stringify'](_0x27389f));if(_0x27389f[_0x21c5('0xf')]){if(_0x27389f[_0x21c5('0xf')][_0x21c5('0x10')]===0x1f4){logger[_0x21c5('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0xed0195,_0x27389f[_0x21c5('0xf')]['message']);return _0xd34da2(_0x27389f[_0x21c5('0xf')][_0x21c5('0x11')]);}logger['error'](_0x21c5('0xc'),_0xed0195,_0x27389f['error']['message']);return _0x4c5a4f(_0x27389f[_0x21c5('0xf')][_0x21c5('0x11')]);}else{logger[_0x21c5('0x12')](_0x21c5('0xc'),_0xed0195,_0x21c5('0xd'));_0x4c5a4f(_0x27389f[_0x21c5('0x13')][_0x21c5('0x11')]);}})['catch'](function(_0x331080){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0xed0195,_0x331080);_0xd34da2(_0x331080);});});}exports[_0x21c5('0x14')]=function(_0x56696e){var _0x4daf4d=this;return new Promise(function(_0x1bc8a4,_0x4e630f){return db[_0x21c5('0x15')]['findAll']({'raw':_0x56696e[_0x21c5('0x16')]?_0x56696e['options']['raw']===undefined?!![]:![]:!![],'where':_0x56696e[_0x21c5('0x16')]?_0x56696e[_0x21c5('0x16')][_0x21c5('0x17')]||null:null,'attributes':_0x56696e[_0x21c5('0x16')]?_0x56696e[_0x21c5('0x16')][_0x21c5('0x18')]||null:null,'limit':_0x56696e[_0x21c5('0x16')]?_0x56696e[_0x21c5('0x16')][_0x21c5('0x19')]||null:null,'include':_0x56696e['options']?_0x56696e[_0x21c5('0x16')][_0x21c5('0x1a')]?_[_0x21c5('0x1b')](_0x56696e[_0x21c5('0x16')][_0x21c5('0x1a')],function(_0x4bf186){return{'model':db[_0x4bf186[_0x21c5('0x1c')]],'as':_0x4bf186['as'],'attributes':_0x4bf186[_0x21c5('0x18')],'include':_0x4bf186[_0x21c5('0x1a')]?_[_0x21c5('0x1b')](_0x4bf186[_0x21c5('0x1a')],function(_0x4d3215){return{'model':db[_0x4d3215['model']],'as':_0x4d3215['as'],'attributes':_0x4d3215[_0x21c5('0x18')],'include':_0x4d3215[_0x21c5('0x1a')]?_[_0x21c5('0x1b')](_0x4d3215[_0x21c5('0x1a')],function(_0x2ae029){return{'model':db[_0x2ae029[_0x21c5('0x1c')]],'as':_0x2ae029['as'],'attributes':_0x2ae029['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5918df){logger[_0x21c5('0x12')](_0x21c5('0x14'),_0x56696e);logger[_0x21c5('0xe')](_0x21c5('0x14'),_0x56696e,JSON['stringify'](_0x5918df));_0x1bc8a4(_0x5918df);})[_0x21c5('0x1d')](function(_0x428b60){logger[_0x21c5('0xf')](_0x21c5('0x14'),_0x428b60[_0x21c5('0x11')],_0x56696e);_0x4e630f(_0x4daf4d['error'](0x1f4,_0x428b60['message']));});});};exports[_0x21c5('0x1e')]=function(_0x29a15b){var _0x3353b3=this;return new Promise(function(_0x177ca1,_0x39662b){return db[_0x21c5('0x15')][_0x21c5('0x1f')]({'raw':_0x29a15b[_0x21c5('0x16')]?_0x29a15b[_0x21c5('0x16')][_0x21c5('0x20')]===undefined?!![]:![]:!![],'where':_0x29a15b['options']?_0x29a15b['options'][_0x21c5('0x17')]||null:null,'attributes':_0x29a15b['options']?_0x29a15b[_0x21c5('0x16')][_0x21c5('0x18')]||null:null,'include':_0x29a15b[_0x21c5('0x16')]?_0x29a15b[_0x21c5('0x16')]['include']?_[_0x21c5('0x1b')](_0x29a15b['options'][_0x21c5('0x1a')],function(_0x5a3308){return{'model':db[_0x5a3308[_0x21c5('0x1c')]],'as':_0x5a3308['as'],'attributes':_0x5a3308[_0x21c5('0x18')],'include':_0x5a3308[_0x21c5('0x1a')]?_['map'](_0x5a3308[_0x21c5('0x1a')],function(_0x4d52ca){return{'model':db[_0x4d52ca[_0x21c5('0x1c')]],'as':_0x4d52ca['as'],'attributes':_0x4d52ca[_0x21c5('0x18')],'include':_0x4d52ca[_0x21c5('0x1a')]?_['map'](_0x4d52ca[_0x21c5('0x1a')],function(_0x535498){return{'model':db[_0x535498['model']],'as':_0x535498['as'],'attributes':_0x535498[_0x21c5('0x18')]};}):[]};}):[]};}):[]:[]})[_0x21c5('0xb')](function(_0x1a25b7){logger[_0x21c5('0x12')]('ShowFreshsalesAccount',_0x29a15b);logger[_0x21c5('0xe')](_0x21c5('0x1e'),_0x29a15b,JSON[_0x21c5('0x21')](_0x1a25b7));_0x177ca1(_0x1a25b7);})[_0x21c5('0x1d')](function(_0x20ec3a){logger[_0x21c5('0xf')](_0x21c5('0x1e'),_0x20ec3a[_0x21c5('0x11')],_0x29a15b);_0x39662b(_0x3353b3['error'](0x1f4,_0x20ec3a[_0x21c5('0x11')]));});});}; \ No newline at end of file +var _0x6da9=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','findAll','options','raw','where','attributes','include','model','map','then','GetFreshsalesAccount','debug','ShowFreshsalesAccount','FreshsalesAccount'];(function(_0x14b16f,_0x4b2b3a){var _0x2d8ddc=function(_0x2e54c2){while(--_0x2e54c2){_0x14b16f['push'](_0x14b16f['shift']());}};_0x2d8ddc(++_0x4b2b3a);}(_0x6da9,0x161));var _0x96da=function(_0x37b9a2,_0x56294c){_0x37b9a2=_0x37b9a2-0x0;var _0x21a8aa=_0x6da9[_0x37b9a2];return _0x21a8aa;};'use strict';var _=require(_0x96da('0x0'));var util=require(_0x96da('0x1'));var moment=require(_0x96da('0x2'));var BPromise=require(_0x96da('0x3'));var rs=require(_0x96da('0x4'));var fs=require('fs');var Redis=require(_0x96da('0x5'));var db=require(_0x96da('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x96da('0x7'));var jayson=require(_0x96da('0x8'));var client=jayson[_0x96da('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bc4b0,_0x5d7737,_0x161249){return new BPromise(function(_0x45ee2f,_0x3b0883){return client['request'](_0x1bc4b0,_0x161249)['then'](function(_0x4ed0c1){logger[_0x96da('0xa')](_0x96da('0xb'),_0x5d7737,_0x96da('0xc'));logger['debug'](_0x96da('0xd'),_0x5d7737,_0x96da('0xc'),JSON['stringify'](_0x4ed0c1));if(_0x4ed0c1[_0x96da('0xe')]){if(_0x4ed0c1[_0x96da('0xe')][_0x96da('0xf')]===0x1f4){logger[_0x96da('0xe')](_0x96da('0xb'),_0x5d7737,_0x4ed0c1[_0x96da('0xe')][_0x96da('0x10')]);return _0x3b0883(_0x4ed0c1[_0x96da('0xe')][_0x96da('0x10')]);}logger['error'](_0x96da('0xb'),_0x5d7737,_0x4ed0c1[_0x96da('0xe')]['message']);return _0x45ee2f(_0x4ed0c1['error'][_0x96da('0x10')]);}else{logger[_0x96da('0xa')]('FreshsalesAccount,\x20%s,\x20%s',_0x5d7737,_0x96da('0xc'));_0x45ee2f(_0x4ed0c1['result'][_0x96da('0x10')]);}})[_0x96da('0x11')](function(_0x2d6d15){logger[_0x96da('0xe')](_0x96da('0xb'),_0x5d7737,_0x2d6d15);_0x3b0883(_0x2d6d15);});});}exports['GetFreshsalesAccount']=function(_0x2bfd0c){var _0xd1fef8=this;return new Promise(function(_0x7ac4a5,_0x30834c){return db['FreshsalesAccount'][_0x96da('0x12')]({'raw':_0x2bfd0c['options']?_0x2bfd0c[_0x96da('0x13')][_0x96da('0x14')]===undefined?!![]:![]:!![],'where':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c['options'][_0x96da('0x15')]||null:null,'attributes':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c[_0x96da('0x13')][_0x96da('0x16')]||null:null,'limit':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c[_0x96da('0x13')]['limit']||null:null,'include':_0x2bfd0c[_0x96da('0x13')]?_0x2bfd0c[_0x96da('0x13')][_0x96da('0x17')]?_['map'](_0x2bfd0c[_0x96da('0x13')][_0x96da('0x17')],function(_0x4a9232){return{'model':db[_0x4a9232[_0x96da('0x18')]],'as':_0x4a9232['as'],'attributes':_0x4a9232['attributes'],'include':_0x4a9232[_0x96da('0x17')]?_[_0x96da('0x19')](_0x4a9232[_0x96da('0x17')],function(_0x1b29ae){return{'model':db[_0x1b29ae[_0x96da('0x18')]],'as':_0x1b29ae['as'],'attributes':_0x1b29ae[_0x96da('0x16')],'include':_0x1b29ae[_0x96da('0x17')]?_[_0x96da('0x19')](_0x1b29ae[_0x96da('0x17')],function(_0x2d197f){return{'model':db[_0x2d197f['model']],'as':_0x2d197f['as'],'attributes':_0x2d197f[_0x96da('0x16')]};}):[]};}):[]};}):[]:[]})[_0x96da('0x1a')](function(_0x2e7a34){logger[_0x96da('0xa')](_0x96da('0x1b'),_0x2bfd0c);logger[_0x96da('0x1c')](_0x96da('0x1b'),_0x2bfd0c,JSON['stringify'](_0x2e7a34));_0x7ac4a5(_0x2e7a34);})[_0x96da('0x11')](function(_0x4241ba){logger[_0x96da('0xe')]('GetFreshsalesAccount',_0x4241ba['message'],_0x2bfd0c);_0x30834c(_0xd1fef8['error'](0x1f4,_0x4241ba['message']));});});};exports[_0x96da('0x1d')]=function(_0x480169){var _0x31110d=this;return new Promise(function(_0x156469,_0x2ddc62){return db[_0x96da('0x1e')][_0x96da('0x1f')]({'raw':_0x480169[_0x96da('0x13')]?_0x480169[_0x96da('0x13')][_0x96da('0x14')]===undefined?!![]:![]:!![],'where':_0x480169[_0x96da('0x13')]?_0x480169['options']['where']||null:null,'attributes':_0x480169[_0x96da('0x13')]?_0x480169[_0x96da('0x13')]['attributes']||null:null,'include':_0x480169[_0x96da('0x13')]?_0x480169[_0x96da('0x13')][_0x96da('0x17')]?_[_0x96da('0x19')](_0x480169[_0x96da('0x13')][_0x96da('0x17')],function(_0x3a6f6a){return{'model':db[_0x3a6f6a[_0x96da('0x18')]],'as':_0x3a6f6a['as'],'attributes':_0x3a6f6a[_0x96da('0x16')],'include':_0x3a6f6a['include']?_[_0x96da('0x19')](_0x3a6f6a['include'],function(_0x4daf81){return{'model':db[_0x4daf81[_0x96da('0x18')]],'as':_0x4daf81['as'],'attributes':_0x4daf81[_0x96da('0x16')],'include':_0x4daf81[_0x96da('0x17')]?_[_0x96da('0x19')](_0x4daf81[_0x96da('0x17')],function(_0x1147e4){return{'model':db[_0x1147e4[_0x96da('0x18')]],'as':_0x1147e4['as'],'attributes':_0x1147e4[_0x96da('0x16')]};}):[]};}):[]};}):[]:[]})[_0x96da('0x1a')](function(_0x35db80){logger[_0x96da('0xa')]('ShowFreshsalesAccount',_0x480169);logger[_0x96da('0x1c')](_0x96da('0x1d'),_0x480169,JSON['stringify'](_0x35db80));_0x156469(_0x35db80);})['catch'](function(_0x41e123){logger[_0x96da('0xe')](_0x96da('0x1d'),_0x41e123[_0x96da('0x10')],_0x480169);_0x2ddc62(_0x31110d[_0x96da('0xe')](0x1f4,_0x41e123['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index f66041b..cca1a19 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 _0x7cfa=['../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/descriptions','getDescriptions','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0x7cfa,0x1f1));var _0xa7cf=function(_0x6655a6,_0x25f26f){_0x6655a6=_0x6655a6-0x0;var _0x5ee5a4=_0x7cfa[_0x6655a6];return _0x5ee5a4;};'use strict';var multer=require(_0xa7cf('0x0'));var util=require(_0xa7cf('0x1'));var path=require(_0xa7cf('0x2'));var timeout=require(_0xa7cf('0x3'));var express=require('express');var router=express[_0xa7cf('0x4')]();var auth=require(_0xa7cf('0x5'));var interaction=require(_0xa7cf('0x6'));var config=require(_0xa7cf('0x7'));var controller=require(_0xa7cf('0x8'));router[_0xa7cf('0x9')]('/',auth[_0xa7cf('0xa')](),controller[_0xa7cf('0xb')]);router[_0xa7cf('0x9')](_0xa7cf('0xc'),auth['isAuthenticated'](),controller[_0xa7cf('0xd')]);router[_0xa7cf('0x9')]('/:id/subjects',auth[_0xa7cf('0xa')](),controller['getSubjects']);router['get'](_0xa7cf('0xe'),auth[_0xa7cf('0xa')](),controller[_0xa7cf('0xf')]);router['get']('/:id/fields',auth[_0xa7cf('0xa')](),controller[_0xa7cf('0x10')]);router[_0xa7cf('0x11')]('/',auth[_0xa7cf('0xa')](),controller[_0xa7cf('0x12')]);router[_0xa7cf('0x13')](_0xa7cf('0xc'),auth[_0xa7cf('0xa')](),controller[_0xa7cf('0x14')]);router[_0xa7cf('0x15')](_0xa7cf('0xc'),auth[_0xa7cf('0xa')](),controller[_0xa7cf('0x16')]);module[_0xa7cf('0x17')]=router; \ No newline at end of file +var _0xfebc=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports'];(function(_0x573010,_0x2923c4){var _0x84c43d=function(_0x22c44d){while(--_0x22c44d){_0x573010['push'](_0x573010['shift']());}};_0x84c43d(++_0x2923c4);}(_0xfebc,0x1a0));var _0xcfeb=function(_0x52fa1e,_0x39a40f){_0x52fa1e=_0x52fa1e-0x0;var _0x26849d=_0xfebc[_0x52fa1e];return _0x26849d;};'use strict';var multer=require(_0xcfeb('0x0'));var util=require(_0xcfeb('0x1'));var path=require(_0xcfeb('0x2'));var timeout=require(_0xcfeb('0x3'));var express=require(_0xcfeb('0x4'));var router=express[_0xcfeb('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xcfeb('0x6'));var config=require('../../config/environment');var controller=require(_0xcfeb('0x7'));router[_0xcfeb('0x8')]('/',auth[_0xcfeb('0x9')](),controller[_0xcfeb('0xa')]);router['get'](_0xcfeb('0xb'),auth[_0xcfeb('0x9')](),controller[_0xcfeb('0xc')]);router['get'](_0xcfeb('0xd'),auth[_0xcfeb('0x9')](),controller[_0xcfeb('0xe')]);router[_0xcfeb('0x8')](_0xcfeb('0xf'),auth[_0xcfeb('0x9')](),controller[_0xcfeb('0x10')]);router[_0xcfeb('0x8')](_0xcfeb('0x11'),auth[_0xcfeb('0x9')](),controller[_0xcfeb('0x12')]);router[_0xcfeb('0x13')]('/',auth[_0xcfeb('0x9')](),controller[_0xcfeb('0x14')]);router[_0xcfeb('0x15')]('/:id',auth[_0xcfeb('0x9')](),controller[_0xcfeb('0x16')]);router[_0xcfeb('0x17')](_0xcfeb('0xb'),auth['isAuthenticated'](),controller[_0xcfeb('0x18')]);module[_0xcfeb('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 8f41102..07c6e9a 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 _0x85e1=['exports','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x85e1,0x167));var _0x185e=function(_0xfd8e7c,_0x5a4de9){_0xfd8e7c=_0xfd8e7c-0x0;var _0x1c1af1=_0x85e1[_0xfd8e7c];return _0x1c1af1;};'use strict';var Sequelize=require(_0x185e('0x0'));module[_0x185e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6188=['STRING','sequelize','exports'];(function(_0x27d910,_0x464aa7){var _0x3dded3=function(_0x250080){while(--_0x250080){_0x27d910['push'](_0x27d910['shift']());}};_0x3dded3(++_0x464aa7);}(_0x6188,0x136));var _0x8618=function(_0x233716,_0x346676){_0x233716=_0x233716-0x0;var _0x302298=_0x6188[_0x233716];return _0x302298;};'use strict';var Sequelize=require(_0x8618('0x0'));module[_0x8618('0x1')]={'name':{'type':Sequelize[_0x8618('0x2')]},'description':{'type':Sequelize[_0x8618('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 1883b0d..b63c019 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 _0x74b7=['ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','save','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','find','create','body','update','destroy','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','test','Sequelize'];(function(_0x13a725,_0x22f71c){var _0xc282be=function(_0x386c3f){while(--_0x386c3f){_0x13a725['push'](_0x13a725['shift']());}};_0xc282be(++_0x22f71c);}(_0x74b7,0xfe));var _0x774b=function(_0xf6c3f4,_0x43db11){_0xf6c3f4=_0xf6c3f4-0x0;var _0x107519=_0x74b7[_0xf6c3f4];return _0x107519;};'use strict';var pdf=require(_0x774b('0x0'));var emlformat=require(_0x774b('0x1'));var rimraf=require(_0x774b('0x2'));var zipdir=require(_0x774b('0x3'));var jsonpatch=require(_0x774b('0x4'));var rp=require(_0x774b('0x5'));var moment=require(_0x774b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x774b('0x7'));var util=require(_0x774b('0x8'));var path=require(_0x774b('0x9'));var sox=require(_0x774b('0xa'));var csv=require('to-csv');var ejs=require(_0x774b('0xb'));var fs=require('fs');var _=require(_0x774b('0xc'));var squel=require(_0x774b('0xd'));var crypto=require(_0x774b('0xe'));var jsforce=require(_0x774b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x774b('0x10'));var Redis=require('ioredis');var authService=require(_0x774b('0x11'));var qs=require(_0x774b('0x12'));var as=require(_0x774b('0x13'));var hardwareService=require(_0x774b('0x14'));var logger=require(_0x774b('0x15'))(_0x774b('0x16'));var utils=require('../../config/utils');var config=require(_0x774b('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x774b('0x18'));var client=jayson['client'][_0x774b('0x19')]({'port':0x232a});function checkPasswordPattern(_0x55d02a,_0x4818ed,_0x238e15){if(_0x238e15){var _0x191993=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x191993[_0x774b('0x1a')](_0x4818ed)){return _0x55d02a;}else{throw new db[(_0x774b('0x1b'))][(_0x774b('0x1c'))](_0x774b('0x1d'));}}else{return _0x55d02a;}}function respondWithRpcPromise(_0x285806,_0x329f07,_0x172802,_0x551c13){return new BPromise(function(_0xa850fa,_0xfe793d){var _0x3c8db7=_0x551c13||client;return _0x3c8db7[_0x774b('0x1e')](_0x285806,_0x172802)[_0x774b('0x1f')](function(_0x1d3e50){logger[_0x774b('0x20')](_0x774b('0x21'),_0x329f07,_0x774b('0x22'));logger[_0x774b('0x23')](_0x774b('0x24'),_0x329f07,_0x774b('0x22'),JSON['stringify'](_0x1d3e50));if(_0x1d3e50['error']){if(_0x1d3e50[_0x774b('0x25')][_0x774b('0x26')]===0x1f4){logger[_0x774b('0x25')](_0x774b('0x21'),_0x329f07,_0x1d3e50[_0x774b('0x25')][_0x774b('0x27')]);return _0xfe793d(_0x1d3e50['error'][_0x774b('0x27')]);}logger['error'](_0x774b('0x21'),_0x329f07,_0x1d3e50[_0x774b('0x25')][_0x774b('0x27')]);return _0xa850fa(_0x1d3e50['error'][_0x774b('0x27')]);}else{logger['info'](_0x774b('0x21'),_0x329f07,_0x774b('0x22'));_0xa850fa(_0x1d3e50[_0x774b('0x28')][_0x774b('0x27')]);}})[_0x774b('0x29')](function(_0x2e68c6){logger[_0x774b('0x25')](_0x774b('0x21'),_0x329f07,_0x2e68c6);_0xfe793d(_0x2e68c6);});});}function respondWithStatusCode(_0x2cb2ae,_0xfd0603){_0xfd0603=_0xfd0603||0xcc;return function(_0x288d4e){if(_0x288d4e){return _0x2cb2ae[_0x774b('0x2a')](_0xfd0603);}return _0x2cb2ae['status'](_0xfd0603)[_0x774b('0x2b')]();};}function respondWithResult(_0x3fc157,_0x3ffc4f){_0x3ffc4f=_0x3ffc4f||0xc8;return function(_0x528f6b){if(_0x528f6b){return _0x3fc157[_0x774b('0x2c')](_0x3ffc4f)[_0x774b('0x2d')](_0x528f6b);}};}function respondWithFilteredResult(_0x133839,_0xa4c425){return function(_0x598754){if(_0x598754){var _0x32bf7a=_0x598754[_0x774b('0x2e')],_0x185d05=_0xa4c425['offset'],_0x5b8122=_0xa4c425['offset']+_0xa4c425[_0x774b('0x2f')],_0x19844e;if(_0x5b8122>=_0x32bf7a){_0x5b8122=_0x32bf7a;_0x19844e=0xc8;}else{_0x19844e=0xce;}_0x133839['status'](_0x19844e);return _0x133839['set'](_0x774b('0x30'),_0x185d05+'-'+_0x5b8122+'/'+_0x32bf7a)[_0x774b('0x2d')](_0x598754);}return null;};}function patchUpdates(_0x51cdf3){return function(_0x3c80dd){try{jsonpatch[_0x774b('0x31')](_0x3c80dd,_0x51cdf3,!![]);}catch(_0x1718c3){return BPromise[_0x774b('0x32')](_0x1718c3);}return _0x3c80dd[_0x774b('0x33')]();};}function saveUpdates(_0x67dd0d,_0x1cd845){return function(_0x19574a){if(_0x19574a){return _0x19574a['update'](_0x67dd0d)[_0x774b('0x1f')](function(_0x3eb6e1){return _0x3eb6e1;});}return null;};}function removeEntity(_0x1d2eb5,_0x103a0d){return function(_0x359108){if(_0x359108){return _0x359108['destroy']()[_0x774b('0x1f')](function(){_0x1d2eb5['status'](0xcc)[_0x774b('0x2b')]();});}};}function handleEntityNotFound(_0x194fa7,_0x4f922e){return function(_0x52ffcd){if(!_0x52ffcd){_0x194fa7[_0x774b('0x2a')](0x194);}return _0x52ffcd;};}function handleError(_0x5ccf2f,_0x897f03){_0x897f03=_0x897f03||0x1f4;return function(_0x42c3da){logger['error'](_0x42c3da[_0x774b('0x34')]);if(_0x42c3da['name']){delete _0x42c3da[_0x774b('0x35')];}_0x5ccf2f[_0x774b('0x2c')](_0x897f03)[_0x774b('0x36')](_0x42c3da);};}exports['index']=function(_0x3cad6a,_0x2a4783){var _0x4c3d3d={},_0x58684={},_0x3687c8={'count':0x0,'rows':[]};var _0x457d69=_[_0x774b('0x37')](db[_0x774b('0x38')][_0x774b('0x39')],function(_0x58c056){return{'name':_0x58c056[_0x774b('0x3a')],'type':_0x58c056[_0x774b('0x3b')][_0x774b('0x3c')]};});_0x58684['model']=_[_0x774b('0x37')](_0x457d69,_0x774b('0x35'));_0x58684['query']=_['keys'](_0x3cad6a[_0x774b('0x3d')]);_0x58684[_0x774b('0x3e')]=_[_0x774b('0x3f')](_0x58684[_0x774b('0x40')],_0x58684[_0x774b('0x3d')]);_0x4c3d3d[_0x774b('0x41')]=_[_0x774b('0x3f')](_0x58684[_0x774b('0x40')],qs[_0x774b('0x42')](_0x3cad6a[_0x774b('0x3d')][_0x774b('0x42')]));_0x4c3d3d[_0x774b('0x41')]=_0x4c3d3d[_0x774b('0x41')][_0x774b('0x43')]?_0x4c3d3d['attributes']:_0x58684['model'];if(!_0x3cad6a[_0x774b('0x3d')][_0x774b('0x44')](_0x774b('0x45'))){_0x4c3d3d[_0x774b('0x2f')]=qs[_0x774b('0x2f')](_0x3cad6a[_0x774b('0x3d')][_0x774b('0x2f')]);_0x4c3d3d[_0x774b('0x46')]=qs[_0x774b('0x46')](_0x3cad6a[_0x774b('0x3d')][_0x774b('0x46')]);}_0x4c3d3d[_0x774b('0x47')]=qs[_0x774b('0x48')](_0x3cad6a[_0x774b('0x3d')][_0x774b('0x48')]);_0x4c3d3d[_0x774b('0x49')]=qs[_0x774b('0x3e')](_[_0x774b('0x4a')](_0x3cad6a['query'],_0x58684[_0x774b('0x3e')]),_0x457d69);if(_0x3cad6a[_0x774b('0x3d')][_0x774b('0x4b')]){_0x4c3d3d[_0x774b('0x49')]=_[_0x774b('0x4c')](_0x4c3d3d[_0x774b('0x49')],{'$or':_[_0x774b('0x37')](_0x457d69,function(_0xbcca87){if(_0xbcca87[_0x774b('0x3b')]!==_0x774b('0x4d')){var _0x1d83b4={};_0x1d83b4[_0xbcca87[_0x774b('0x35')]]={'$like':'%'+_0x3cad6a[_0x774b('0x3d')][_0x774b('0x4b')]+'%'};return _0x1d83b4;}})});}_0x4c3d3d=_[_0x774b('0x4c')]({},_0x4c3d3d,_0x3cad6a[_0x774b('0x4e')]);var _0x2f2ccb={'where':_0x4c3d3d[_0x774b('0x49')]};return db[_0x774b('0x38')][_0x774b('0x2e')](_0x2f2ccb)['then'](function(_0x2b61e6){_0x3687c8['count']=_0x2b61e6;if(_0x3cad6a[_0x774b('0x3d')][_0x774b('0x4f')]){_0x4c3d3d['include']=[{'all':!![]}];}return db[_0x774b('0x38')][_0x774b('0x50')](_0x4c3d3d);})['then'](function(_0x296b29){_0x3687c8['rows']=_0x296b29;return _0x3687c8;})['then'](respondWithFilteredResult(_0x2a4783,_0x4c3d3d))[_0x774b('0x29')](handleError(_0x2a4783,null));};exports[_0x774b('0x51')]=function(_0x23a575,_0x214d56){var _0x4dcaff={'raw':![],'where':{'id':_0x23a575[_0x774b('0x52')]['id']}},_0x4b393c={};_0x4b393c[_0x774b('0x40')]=_['keys'](db[_0x774b('0x38')][_0x774b('0x39')]);_0x4b393c[_0x774b('0x3d')]=_[_0x774b('0x53')](_0x23a575[_0x774b('0x3d')]);_0x4b393c[_0x774b('0x3e')]=_['intersection'](_0x4b393c[_0x774b('0x40')],_0x4b393c[_0x774b('0x3d')]);_0x4dcaff['attributes']=_[_0x774b('0x3f')](_0x4b393c[_0x774b('0x40')],qs['fields'](_0x23a575[_0x774b('0x3d')][_0x774b('0x42')]));_0x4dcaff[_0x774b('0x41')]=_0x4dcaff[_0x774b('0x41')][_0x774b('0x43')]?_0x4dcaff[_0x774b('0x41')]:_0x4b393c[_0x774b('0x40')];if(_0x23a575[_0x774b('0x3d')]['includeAll']){_0x4dcaff['include']=[{'all':!![]}];}_0x4dcaff=_[_0x774b('0x4c')]({},_0x4dcaff,_0x23a575[_0x774b('0x4e')]);return db[_0x774b('0x38')][_0x774b('0x54')](_0x4dcaff)['then'](handleEntityNotFound(_0x214d56,null))[_0x774b('0x1f')](respondWithResult(_0x214d56,null))[_0x774b('0x29')](handleError(_0x214d56,null));};exports[_0x774b('0x55')]=function(_0x1a96fb,_0x91b723){return db[_0x774b('0x38')][_0x774b('0x55')](_0x1a96fb[_0x774b('0x56')],{})['then'](respondWithResult(_0x91b723,0xc9))['catch'](handleError(_0x91b723,null));};exports[_0x774b('0x57')]=function(_0x1a8355,_0x49f040){if(_0x1a8355['body']['id']){delete _0x1a8355[_0x774b('0x56')]['id'];}return db[_0x774b('0x38')][_0x774b('0x54')]({'where':{'id':_0x1a8355[_0x774b('0x52')]['id']}})[_0x774b('0x1f')](handleEntityNotFound(_0x49f040,null))[_0x774b('0x1f')](saveUpdates(_0x1a8355['body'],null))[_0x774b('0x1f')](respondWithResult(_0x49f040,null))[_0x774b('0x29')](handleError(_0x49f040,null));};exports[_0x774b('0x58')]=function(_0xbaa269,_0x3346a6){return db[_0x774b('0x38')][_0x774b('0x54')]({'where':{'id':_0xbaa269['params']['id']}})[_0x774b('0x1f')](handleEntityNotFound(_0x3346a6,null))[_0x774b('0x1f')](removeEntity(_0x3346a6,null))[_0x774b('0x29')](handleError(_0x3346a6,null));};exports[_0x774b('0x59')]=function(_0x55f577,_0x22699b,_0x44fd31){var _0xc32a29={};var _0xfcd341={};var _0x42f769;var _0x559cbf;return db[_0x774b('0x38')]['findOne']({'where':{'id':_0x55f577[_0x774b('0x52')]['id']}})[_0x774b('0x1f')](handleEntityNotFound(_0x22699b,null))[_0x774b('0x1f')](function(_0x19733b){if(_0x19733b){_0x42f769=_0x19733b;_0xfcd341[_0x774b('0x40')]=_[_0x774b('0x53')](db[_0x774b('0x5a')][_0x774b('0x39')]);_0xfcd341[_0x774b('0x3d')]=_[_0x774b('0x53')](_0x55f577['query']);_0xfcd341[_0x774b('0x3e')]=_[_0x774b('0x3f')](_0xfcd341[_0x774b('0x40')],_0xfcd341[_0x774b('0x3d')]);_0xc32a29[_0x774b('0x41')]=_[_0x774b('0x3f')](_0xfcd341[_0x774b('0x40')],qs['fields'](_0x55f577[_0x774b('0x3d')][_0x774b('0x42')]));_0xc32a29['attributes']=_0xc32a29[_0x774b('0x41')][_0x774b('0x43')]?_0xc32a29[_0x774b('0x41')]:_0xfcd341['model'];_0xc32a29['order']=qs[_0x774b('0x48')](_0x55f577[_0x774b('0x3d')][_0x774b('0x48')]);_0xc32a29[_0x774b('0x49')]=qs[_0x774b('0x3e')](_[_0x774b('0x4a')](_0x55f577[_0x774b('0x3d')],_0xfcd341[_0x774b('0x3e')]));if(_0x55f577['query']['filter']){_0xc32a29[_0x774b('0x49')]=_[_0x774b('0x4c')](_0xc32a29['where'],{'$or':_[_0x774b('0x37')](_0xc32a29['attributes'],function(_0x56e2ec){var _0x2c1498={};_0x2c1498[_0x56e2ec]={'$like':'%'+_0x55f577[_0x774b('0x3d')][_0x774b('0x4b')]+'%'};return _0x2c1498;})});}_0xc32a29=_[_0x774b('0x4c')]({},_0xc32a29,_0x55f577[_0x774b('0x4e')]);return _0x42f769[_0x774b('0x59')](_0xc32a29);}})['then'](function(_0x13682e){if(_0x13682e){_0x559cbf=_0x13682e[_0x774b('0x43')];if(!_0x55f577[_0x774b('0x3d')]['hasOwnProperty']('nolimit')){_0xc32a29['limit']=qs['limit'](_0x55f577['query']['limit']);_0xc32a29[_0x774b('0x46')]=qs[_0x774b('0x46')](_0x55f577[_0x774b('0x3d')][_0x774b('0x46')]);}return _0x42f769[_0x774b('0x59')](_0xc32a29);}})[_0x774b('0x1f')](function(_0x502cf9){if(_0x502cf9){return _0x502cf9?{'count':_0x559cbf,'rows':_0x502cf9}:null;}})[_0x774b('0x1f')](respondWithResult(_0x22699b,null))[_0x774b('0x29')](handleError(_0x22699b,null));};exports[_0x774b('0x5b')]=function(_0x4ad339,_0x228e5b,_0x186308){var _0x1172af={};var _0xb0bb5={};var _0x442c32;var _0x9cc903;return db[_0x774b('0x38')]['findOne']({'where':{'id':_0x4ad339[_0x774b('0x52')]['id']}})[_0x774b('0x1f')](handleEntityNotFound(_0x228e5b,null))[_0x774b('0x1f')](function(_0x156328){if(_0x156328){_0x442c32=_0x156328;_0xb0bb5[_0x774b('0x40')]=_['keys'](db[_0x774b('0x5a')][_0x774b('0x39')]);_0xb0bb5['query']=_['keys'](_0x4ad339[_0x774b('0x3d')]);_0xb0bb5[_0x774b('0x3e')]=_[_0x774b('0x3f')](_0xb0bb5[_0x774b('0x40')],_0xb0bb5[_0x774b('0x3d')]);_0x1172af[_0x774b('0x41')]=_[_0x774b('0x3f')](_0xb0bb5[_0x774b('0x40')],qs[_0x774b('0x42')](_0x4ad339[_0x774b('0x3d')][_0x774b('0x42')]));_0x1172af[_0x774b('0x41')]=_0x1172af[_0x774b('0x41')][_0x774b('0x43')]?_0x1172af[_0x774b('0x41')]:_0xb0bb5[_0x774b('0x40')];_0x1172af[_0x774b('0x47')]=qs[_0x774b('0x48')](_0x4ad339[_0x774b('0x3d')][_0x774b('0x48')]);_0x1172af[_0x774b('0x49')]=qs['filters'](_['pick'](_0x4ad339[_0x774b('0x3d')],_0xb0bb5[_0x774b('0x3e')]));if(_0x4ad339[_0x774b('0x3d')][_0x774b('0x4b')]){_0x1172af[_0x774b('0x49')]=_[_0x774b('0x4c')](_0x1172af[_0x774b('0x49')],{'$or':_['map'](_0x1172af[_0x774b('0x41')],function(_0x1e1062){var _0x13f4c2={};_0x13f4c2[_0x1e1062]={'$like':'%'+_0x4ad339[_0x774b('0x3d')]['filter']+'%'};return _0x13f4c2;})});}_0x1172af=_['merge']({},_0x1172af,_0x4ad339[_0x774b('0x4e')]);return _0x442c32[_0x774b('0x5b')](_0x1172af);}})['then'](function(_0x283b6e){if(_0x283b6e){_0x9cc903=_0x283b6e['length'];if(!_0x4ad339[_0x774b('0x3d')][_0x774b('0x44')]('nolimit')){_0x1172af[_0x774b('0x2f')]=qs[_0x774b('0x2f')](_0x4ad339['query'][_0x774b('0x2f')]);_0x1172af['offset']=qs[_0x774b('0x46')](_0x4ad339[_0x774b('0x3d')][_0x774b('0x46')]);}return _0x442c32[_0x774b('0x5b')](_0x1172af);}})[_0x774b('0x1f')](function(_0x2304fe){if(_0x2304fe){return _0x2304fe?{'count':_0x9cc903,'rows':_0x2304fe}:null;}})[_0x774b('0x1f')](respondWithResult(_0x228e5b,null))[_0x774b('0x29')](handleError(_0x228e5b,null));};exports['getFields']=function(_0x17c7dc,_0x2be889,_0x386805){var _0x17b5ba={};var _0x3d24a8={};var _0x7b0b9;var _0x73563a;return db['FreshsalesConfiguration'][_0x774b('0x5c')]({'where':{'id':_0x17c7dc[_0x774b('0x52')]['id']}})[_0x774b('0x1f')](handleEntityNotFound(_0x2be889,null))[_0x774b('0x1f')](function(_0xe82c61){if(_0xe82c61){_0x7b0b9=_0xe82c61;_0x3d24a8[_0x774b('0x40')]=_[_0x774b('0x53')](db[_0x774b('0x5a')][_0x774b('0x39')]);_0x3d24a8['query']=_[_0x774b('0x53')](_0x17c7dc[_0x774b('0x3d')]);_0x3d24a8[_0x774b('0x3e')]=_[_0x774b('0x3f')](_0x3d24a8[_0x774b('0x40')],_0x3d24a8['query']);_0x17b5ba[_0x774b('0x41')]=_[_0x774b('0x3f')](_0x3d24a8[_0x774b('0x40')],qs[_0x774b('0x42')](_0x17c7dc['query'][_0x774b('0x42')]));_0x17b5ba[_0x774b('0x41')]=_0x17b5ba[_0x774b('0x41')][_0x774b('0x43')]?_0x17b5ba[_0x774b('0x41')]:_0x3d24a8['model'];_0x17b5ba[_0x774b('0x47')]=qs[_0x774b('0x48')](_0x17c7dc[_0x774b('0x3d')][_0x774b('0x48')]);_0x17b5ba[_0x774b('0x49')]=qs[_0x774b('0x3e')](_[_0x774b('0x4a')](_0x17c7dc[_0x774b('0x3d')],_0x3d24a8[_0x774b('0x3e')]));if(_0x17c7dc['query']['filter']){_0x17b5ba[_0x774b('0x49')]=_[_0x774b('0x4c')](_0x17b5ba[_0x774b('0x49')],{'$or':_[_0x774b('0x37')](_0x17b5ba[_0x774b('0x41')],function(_0x317ea4){var _0x1091f5={};_0x1091f5[_0x317ea4]={'$like':'%'+_0x17c7dc[_0x774b('0x3d')][_0x774b('0x4b')]+'%'};return _0x1091f5;})});}_0x17b5ba=_[_0x774b('0x4c')]({},_0x17b5ba,_0x17c7dc['options']);return _0x7b0b9[_0x774b('0x5d')](_0x17b5ba);}})[_0x774b('0x1f')](function(_0xfb6725){if(_0xfb6725){_0x73563a=_0xfb6725[_0x774b('0x43')];if(!_0x17c7dc[_0x774b('0x3d')][_0x774b('0x44')](_0x774b('0x45'))){_0x17b5ba['limit']=qs[_0x774b('0x2f')](_0x17c7dc[_0x774b('0x3d')][_0x774b('0x2f')]);_0x17b5ba[_0x774b('0x46')]=qs['offset'](_0x17c7dc['query'][_0x774b('0x46')]);}return _0x7b0b9['getFields'](_0x17b5ba);}})[_0x774b('0x1f')](function(_0x31cc6b){if(_0x31cc6b){return _0x31cc6b?{'count':_0x73563a,'rows':_0x31cc6b}:null;}})[_0x774b('0x1f')](respondWithResult(_0x2be889,null))[_0x774b('0x29')](handleError(_0x2be889,null));}; \ No newline at end of file +var _0xadc1=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\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','stack','send','index','map','rawAttributes','fieldName','key','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','FreshsalesConfiguration','includeAll','include','rows','show','params','find','body','destroy','getSubjects','FreshsalesField','pick','options','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse'];(function(_0x5c23bc,_0x16e4dd){var _0x3b4262=function(_0x37c4fb){while(--_0x37c4fb){_0x5c23bc['push'](_0x5c23bc['shift']());}};_0x3b4262(++_0x16e4dd);}(_0xadc1,0x1d3));var _0x1adc=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xadc1[_0x118653];return _0xc11fa6;};'use strict';var pdf=require(_0x1adc('0x0'));var emlformat=require(_0x1adc('0x1'));var rimraf=require(_0x1adc('0x2'));var zipdir=require(_0x1adc('0x3'));var jsonpatch=require(_0x1adc('0x4'));var rp=require(_0x1adc('0x5'));var moment=require(_0x1adc('0x6'));var BPromise=require(_0x1adc('0x7'));var Mustache=require(_0x1adc('0x8'));var util=require(_0x1adc('0x9'));var path=require('path');var sox=require(_0x1adc('0xa'));var csv=require(_0x1adc('0xb'));var ejs=require(_0x1adc('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1adc('0xd'));var crypto=require(_0x1adc('0xe'));var jsforce=require(_0x1adc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1adc('0xb'));var querystring=require(_0x1adc('0x10'));var Papa=require(_0x1adc('0x11'));var Redis=require(_0x1adc('0x12'));var authService=require(_0x1adc('0x13'));var qs=require(_0x1adc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1adc('0x15'));var logger=require('../../config/logger')(_0x1adc('0x16'));var utils=require('../../config/utils');var config=require(_0x1adc('0x17'));var db=require(_0x1adc('0x18'))['db'];var jayson=require(_0x1adc('0x19'));var client=jayson['client'][_0x1adc('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1b9f37,_0x3dcc89,_0x3e75f7){if(_0x3e75f7){var _0x2e9e8d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e9e8d[_0x1adc('0x1b')](_0x3dcc89)){return _0x1b9f37;}else{throw new db[(_0x1adc('0x1c'))][(_0x1adc('0x1d'))](_0x1adc('0x1e'));}}else{return _0x1b9f37;}}function respondWithRpcPromise(_0x570be8,_0x104654,_0x1ad783,_0x4de970){return new BPromise(function(_0x3838f8,_0x447138){var _0x5ba9f4=_0x4de970||client;return _0x5ba9f4[_0x1adc('0x1f')](_0x570be8,_0x1ad783)[_0x1adc('0x20')](function(_0x4b8143){logger[_0x1adc('0x21')](_0x1adc('0x22'),_0x104654,_0x1adc('0x23'));logger[_0x1adc('0x24')](_0x1adc('0x25'),_0x104654,'request\x20sent',JSON['stringify'](_0x4b8143));if(_0x4b8143[_0x1adc('0x26')]){if(_0x4b8143['error'][_0x1adc('0x27')]===0x1f4){logger['error'](_0x1adc('0x22'),_0x104654,_0x4b8143[_0x1adc('0x26')][_0x1adc('0x28')]);return _0x447138(_0x4b8143[_0x1adc('0x26')]['message']);}logger[_0x1adc('0x26')](_0x1adc('0x22'),_0x104654,_0x4b8143[_0x1adc('0x26')][_0x1adc('0x28')]);return _0x3838f8(_0x4b8143[_0x1adc('0x26')]['message']);}else{logger[_0x1adc('0x21')](_0x1adc('0x22'),_0x104654,'request\x20sent');_0x3838f8(_0x4b8143[_0x1adc('0x29')][_0x1adc('0x28')]);}})[_0x1adc('0x2a')](function(_0x59749c){logger[_0x1adc('0x26')](_0x1adc('0x22'),_0x104654,_0x59749c);_0x447138(_0x59749c);});});}function respondWithStatusCode(_0x5b7bd8,_0x58b644){_0x58b644=_0x58b644||0xcc;return function(_0x10a124){if(_0x10a124){return _0x5b7bd8[_0x1adc('0x2b')](_0x58b644);}return _0x5b7bd8[_0x1adc('0x2c')](_0x58b644)[_0x1adc('0x2d')]();};}function respondWithResult(_0x284044,_0x456743){_0x456743=_0x456743||0xc8;return function(_0x9398e5){if(_0x9398e5){return _0x284044['status'](_0x456743)[_0x1adc('0x2e')](_0x9398e5);}};}function respondWithFilteredResult(_0x1eb507,_0x3592af){return function(_0x2760b9){if(_0x2760b9){var _0x25d578=_0x2760b9[_0x1adc('0x2f')],_0x4440d0=_0x3592af[_0x1adc('0x30')],_0x109faf=_0x3592af['offset']+_0x3592af[_0x1adc('0x31')],_0x262467;if(_0x109faf>=_0x25d578){_0x109faf=_0x25d578;_0x262467=0xc8;}else{_0x262467=0xce;}_0x1eb507[_0x1adc('0x2c')](_0x262467);return _0x1eb507[_0x1adc('0x32')](_0x1adc('0x33'),_0x4440d0+'-'+_0x109faf+'/'+_0x25d578)[_0x1adc('0x2e')](_0x2760b9);}return null;};}function patchUpdates(_0x86730e){return function(_0x43a8d1){try{jsonpatch[_0x1adc('0x34')](_0x43a8d1,_0x86730e,!![]);}catch(_0x16d351){return BPromise[_0x1adc('0x35')](_0x16d351);}return _0x43a8d1[_0x1adc('0x36')]();};}function saveUpdates(_0x25d800,_0x41e4be){return function(_0x1545c7){if(_0x1545c7){return _0x1545c7[_0x1adc('0x37')](_0x25d800)[_0x1adc('0x20')](function(_0x29eed6){return _0x29eed6;});}return null;};}function removeEntity(_0x55a7d5,_0x457e27){return function(_0x5cdcf9){if(_0x5cdcf9){return _0x5cdcf9['destroy']()['then'](function(){_0x55a7d5[_0x1adc('0x2c')](0xcc)[_0x1adc('0x2d')]();});}};}function handleEntityNotFound(_0x1dcfe5,_0x563046){return function(_0x37eea9){if(!_0x37eea9){_0x1dcfe5['sendStatus'](0x194);}return _0x37eea9;};}function handleError(_0x3cc092,_0x2573c5){_0x2573c5=_0x2573c5||0x1f4;return function(_0xe465ef){logger[_0x1adc('0x26')](_0xe465ef[_0x1adc('0x38')]);if(_0xe465ef['name']){delete _0xe465ef['name'];}_0x3cc092[_0x1adc('0x2c')](_0x2573c5)[_0x1adc('0x39')](_0xe465ef);};}exports[_0x1adc('0x3a')]=function(_0x511207,_0x4adce2){var _0x37e13d={},_0x292977={},_0x545769={'count':0x0,'rows':[]};var _0x506736=_[_0x1adc('0x3b')](db['FreshsalesConfiguration'][_0x1adc('0x3c')],function(_0x4a06d7){return{'name':_0x4a06d7[_0x1adc('0x3d')],'type':_0x4a06d7['type'][_0x1adc('0x3e')]};});_0x292977[_0x1adc('0x3f')]=_[_0x1adc('0x3b')](_0x506736,_0x1adc('0x40'));_0x292977['query']=_[_0x1adc('0x41')](_0x511207[_0x1adc('0x42')]);_0x292977[_0x1adc('0x43')]=_['intersection'](_0x292977[_0x1adc('0x3f')],_0x292977[_0x1adc('0x42')]);_0x37e13d[_0x1adc('0x44')]=_[_0x1adc('0x45')](_0x292977[_0x1adc('0x3f')],qs[_0x1adc('0x46')](_0x511207[_0x1adc('0x42')][_0x1adc('0x46')]));_0x37e13d[_0x1adc('0x44')]=_0x37e13d[_0x1adc('0x44')][_0x1adc('0x47')]?_0x37e13d['attributes']:_0x292977['model'];if(!_0x511207[_0x1adc('0x42')][_0x1adc('0x48')](_0x1adc('0x49'))){_0x37e13d[_0x1adc('0x31')]=qs[_0x1adc('0x31')](_0x511207[_0x1adc('0x42')][_0x1adc('0x31')]);_0x37e13d[_0x1adc('0x30')]=qs[_0x1adc('0x30')](_0x511207[_0x1adc('0x42')][_0x1adc('0x30')]);}_0x37e13d[_0x1adc('0x4a')]=qs[_0x1adc('0x4b')](_0x511207[_0x1adc('0x42')][_0x1adc('0x4b')]);_0x37e13d['where']=qs[_0x1adc('0x43')](_['pick'](_0x511207[_0x1adc('0x42')],_0x292977['filters']),_0x506736);if(_0x511207['query'][_0x1adc('0x4c')]){_0x37e13d[_0x1adc('0x4d')]=_[_0x1adc('0x4e')](_0x37e13d[_0x1adc('0x4d')],{'$or':_[_0x1adc('0x3b')](_0x506736,function(_0x2b761f){if(_0x2b761f[_0x1adc('0x4f')]!==_0x1adc('0x50')){var _0x3a85d6={};_0x3a85d6[_0x2b761f['name']]={'$like':'%'+_0x511207[_0x1adc('0x42')]['filter']+'%'};return _0x3a85d6;}})});}_0x37e13d=_['merge']({},_0x37e13d,_0x511207['options']);var _0x17d449={'where':_0x37e13d[_0x1adc('0x4d')]};return db[_0x1adc('0x51')][_0x1adc('0x2f')](_0x17d449)[_0x1adc('0x20')](function(_0x2ef50c){_0x545769[_0x1adc('0x2f')]=_0x2ef50c;if(_0x511207[_0x1adc('0x42')][_0x1adc('0x52')]){_0x37e13d[_0x1adc('0x53')]=[{'all':!![]}];}return db[_0x1adc('0x51')]['findAll'](_0x37e13d);})['then'](function(_0x1d1fd2){_0x545769[_0x1adc('0x54')]=_0x1d1fd2;return _0x545769;})[_0x1adc('0x20')](respondWithFilteredResult(_0x4adce2,_0x37e13d))['catch'](handleError(_0x4adce2,null));};exports[_0x1adc('0x55')]=function(_0x2ce67b,_0x24f6b6){var _0x240d77={'raw':![],'where':{'id':_0x2ce67b[_0x1adc('0x56')]['id']}},_0x55c2a1={};_0x55c2a1['model']=_[_0x1adc('0x41')](db[_0x1adc('0x51')][_0x1adc('0x3c')]);_0x55c2a1['query']=_[_0x1adc('0x41')](_0x2ce67b[_0x1adc('0x42')]);_0x55c2a1[_0x1adc('0x43')]=_[_0x1adc('0x45')](_0x55c2a1[_0x1adc('0x3f')],_0x55c2a1[_0x1adc('0x42')]);_0x240d77['attributes']=_[_0x1adc('0x45')](_0x55c2a1[_0x1adc('0x3f')],qs['fields'](_0x2ce67b[_0x1adc('0x42')][_0x1adc('0x46')]));_0x240d77[_0x1adc('0x44')]=_0x240d77[_0x1adc('0x44')][_0x1adc('0x47')]?_0x240d77[_0x1adc('0x44')]:_0x55c2a1[_0x1adc('0x3f')];if(_0x2ce67b[_0x1adc('0x42')][_0x1adc('0x52')]){_0x240d77[_0x1adc('0x53')]=[{'all':!![]}];}_0x240d77=_[_0x1adc('0x4e')]({},_0x240d77,_0x2ce67b['options']);return db['FreshsalesConfiguration'][_0x1adc('0x57')](_0x240d77)[_0x1adc('0x20')](handleEntityNotFound(_0x24f6b6,null))[_0x1adc('0x20')](respondWithResult(_0x24f6b6,null))[_0x1adc('0x2a')](handleError(_0x24f6b6,null));};exports['create']=function(_0x4eabc5,_0x439cfd){return db[_0x1adc('0x51')]['create'](_0x4eabc5[_0x1adc('0x58')],{})[_0x1adc('0x20')](respondWithResult(_0x439cfd,0xc9))[_0x1adc('0x2a')](handleError(_0x439cfd,null));};exports[_0x1adc('0x37')]=function(_0x46470f,_0x45e465){if(_0x46470f[_0x1adc('0x58')]['id']){delete _0x46470f[_0x1adc('0x58')]['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x46470f['params']['id']}})[_0x1adc('0x20')](handleEntityNotFound(_0x45e465,null))[_0x1adc('0x20')](saveUpdates(_0x46470f[_0x1adc('0x58')],null))[_0x1adc('0x20')](respondWithResult(_0x45e465,null))[_0x1adc('0x2a')](handleError(_0x45e465,null));};exports[_0x1adc('0x59')]=function(_0x7afe13,_0x2be434){return db[_0x1adc('0x51')]['find']({'where':{'id':_0x7afe13[_0x1adc('0x56')]['id']}})['then'](handleEntityNotFound(_0x2be434,null))['then'](removeEntity(_0x2be434,null))[_0x1adc('0x2a')](handleError(_0x2be434,null));};exports[_0x1adc('0x5a')]=function(_0x5cb187,_0x1f198f,_0x29bbee){var _0x598ff5={};var _0x4336a2={};var _0x4d205b;var _0x5f361a;return db[_0x1adc('0x51')]['findOne']({'where':{'id':_0x5cb187[_0x1adc('0x56')]['id']}})[_0x1adc('0x20')](handleEntityNotFound(_0x1f198f,null))[_0x1adc('0x20')](function(_0x334b6b){if(_0x334b6b){_0x4d205b=_0x334b6b;_0x4336a2[_0x1adc('0x3f')]=_[_0x1adc('0x41')](db[_0x1adc('0x5b')][_0x1adc('0x3c')]);_0x4336a2[_0x1adc('0x42')]=_[_0x1adc('0x41')](_0x5cb187[_0x1adc('0x42')]);_0x4336a2['filters']=_['intersection'](_0x4336a2[_0x1adc('0x3f')],_0x4336a2[_0x1adc('0x42')]);_0x598ff5[_0x1adc('0x44')]=_[_0x1adc('0x45')](_0x4336a2['model'],qs['fields'](_0x5cb187['query'][_0x1adc('0x46')]));_0x598ff5[_0x1adc('0x44')]=_0x598ff5[_0x1adc('0x44')]['length']?_0x598ff5[_0x1adc('0x44')]:_0x4336a2[_0x1adc('0x3f')];_0x598ff5[_0x1adc('0x4a')]=qs[_0x1adc('0x4b')](_0x5cb187[_0x1adc('0x42')][_0x1adc('0x4b')]);_0x598ff5[_0x1adc('0x4d')]=qs[_0x1adc('0x43')](_[_0x1adc('0x5c')](_0x5cb187[_0x1adc('0x42')],_0x4336a2[_0x1adc('0x43')]));if(_0x5cb187[_0x1adc('0x42')]['filter']){_0x598ff5[_0x1adc('0x4d')]=_[_0x1adc('0x4e')](_0x598ff5[_0x1adc('0x4d')],{'$or':_[_0x1adc('0x3b')](_0x598ff5[_0x1adc('0x44')],function(_0x75c9be){var _0x1939cf={};_0x1939cf[_0x75c9be]={'$like':'%'+_0x5cb187[_0x1adc('0x42')][_0x1adc('0x4c')]+'%'};return _0x1939cf;})});}_0x598ff5=_[_0x1adc('0x4e')]({},_0x598ff5,_0x5cb187[_0x1adc('0x5d')]);return _0x4d205b[_0x1adc('0x5a')](_0x598ff5);}})[_0x1adc('0x20')](function(_0x3d5dd7){if(_0x3d5dd7){_0x5f361a=_0x3d5dd7['length'];if(!_0x5cb187[_0x1adc('0x42')][_0x1adc('0x48')]('nolimit')){_0x598ff5['limit']=qs['limit'](_0x5cb187[_0x1adc('0x42')][_0x1adc('0x31')]);_0x598ff5[_0x1adc('0x30')]=qs[_0x1adc('0x30')](_0x5cb187[_0x1adc('0x42')][_0x1adc('0x30')]);}return _0x4d205b[_0x1adc('0x5a')](_0x598ff5);}})['then'](function(_0x4562b8){if(_0x4562b8){return _0x4562b8?{'count':_0x5f361a,'rows':_0x4562b8}:null;}})[_0x1adc('0x20')](respondWithResult(_0x1f198f,null))[_0x1adc('0x2a')](handleError(_0x1f198f,null));};exports[_0x1adc('0x5e')]=function(_0x39f03c,_0x2735fa,_0x5a88be){var _0x1aec00={};var _0x128a3a={};var _0x3fce61;var _0x564729;return db[_0x1adc('0x51')][_0x1adc('0x5f')]({'where':{'id':_0x39f03c[_0x1adc('0x56')]['id']}})[_0x1adc('0x20')](handleEntityNotFound(_0x2735fa,null))[_0x1adc('0x20')](function(_0x299c9d){if(_0x299c9d){_0x3fce61=_0x299c9d;_0x128a3a[_0x1adc('0x3f')]=_[_0x1adc('0x41')](db[_0x1adc('0x5b')][_0x1adc('0x3c')]);_0x128a3a[_0x1adc('0x42')]=_['keys'](_0x39f03c[_0x1adc('0x42')]);_0x128a3a[_0x1adc('0x43')]=_[_0x1adc('0x45')](_0x128a3a['model'],_0x128a3a[_0x1adc('0x42')]);_0x1aec00['attributes']=_[_0x1adc('0x45')](_0x128a3a[_0x1adc('0x3f')],qs[_0x1adc('0x46')](_0x39f03c['query'][_0x1adc('0x46')]));_0x1aec00[_0x1adc('0x44')]=_0x1aec00[_0x1adc('0x44')][_0x1adc('0x47')]?_0x1aec00[_0x1adc('0x44')]:_0x128a3a[_0x1adc('0x3f')];_0x1aec00[_0x1adc('0x4a')]=qs[_0x1adc('0x4b')](_0x39f03c[_0x1adc('0x42')]['sort']);_0x1aec00[_0x1adc('0x4d')]=qs[_0x1adc('0x43')](_[_0x1adc('0x5c')](_0x39f03c[_0x1adc('0x42')],_0x128a3a[_0x1adc('0x43')]));if(_0x39f03c['query'][_0x1adc('0x4c')]){_0x1aec00[_0x1adc('0x4d')]=_[_0x1adc('0x4e')](_0x1aec00[_0x1adc('0x4d')],{'$or':_[_0x1adc('0x3b')](_0x1aec00[_0x1adc('0x44')],function(_0x20339f){var _0x17afaa={};_0x17afaa[_0x20339f]={'$like':'%'+_0x39f03c[_0x1adc('0x42')]['filter']+'%'};return _0x17afaa;})});}_0x1aec00=_[_0x1adc('0x4e')]({},_0x1aec00,_0x39f03c['options']);return _0x3fce61[_0x1adc('0x5e')](_0x1aec00);}})['then'](function(_0x356c3c){if(_0x356c3c){_0x564729=_0x356c3c['length'];if(!_0x39f03c['query'][_0x1adc('0x48')](_0x1adc('0x49'))){_0x1aec00[_0x1adc('0x31')]=qs[_0x1adc('0x31')](_0x39f03c[_0x1adc('0x42')]['limit']);_0x1aec00[_0x1adc('0x30')]=qs[_0x1adc('0x30')](_0x39f03c[_0x1adc('0x42')][_0x1adc('0x30')]);}return _0x3fce61[_0x1adc('0x5e')](_0x1aec00);}})[_0x1adc('0x20')](function(_0x5be301){if(_0x5be301){return _0x5be301?{'count':_0x564729,'rows':_0x5be301}:null;}})[_0x1adc('0x20')](respondWithResult(_0x2735fa,null))['catch'](handleError(_0x2735fa,null));};exports[_0x1adc('0x60')]=function(_0x370c02,_0x573e97,_0x30ae45){var _0x4b41c7={};var _0x5d7a01={};var _0x629801;var _0x17ebc0;return db['FreshsalesConfiguration'][_0x1adc('0x5f')]({'where':{'id':_0x370c02[_0x1adc('0x56')]['id']}})[_0x1adc('0x20')](handleEntityNotFound(_0x573e97,null))[_0x1adc('0x20')](function(_0x5917c1){if(_0x5917c1){_0x629801=_0x5917c1;_0x5d7a01[_0x1adc('0x3f')]=_['keys'](db[_0x1adc('0x5b')][_0x1adc('0x3c')]);_0x5d7a01[_0x1adc('0x42')]=_[_0x1adc('0x41')](_0x370c02['query']);_0x5d7a01[_0x1adc('0x43')]=_[_0x1adc('0x45')](_0x5d7a01[_0x1adc('0x3f')],_0x5d7a01[_0x1adc('0x42')]);_0x4b41c7[_0x1adc('0x44')]=_['intersection'](_0x5d7a01[_0x1adc('0x3f')],qs['fields'](_0x370c02['query'][_0x1adc('0x46')]));_0x4b41c7[_0x1adc('0x44')]=_0x4b41c7[_0x1adc('0x44')][_0x1adc('0x47')]?_0x4b41c7['attributes']:_0x5d7a01[_0x1adc('0x3f')];_0x4b41c7[_0x1adc('0x4a')]=qs[_0x1adc('0x4b')](_0x370c02[_0x1adc('0x42')]['sort']);_0x4b41c7['where']=qs['filters'](_['pick'](_0x370c02['query'],_0x5d7a01[_0x1adc('0x43')]));if(_0x370c02[_0x1adc('0x42')][_0x1adc('0x4c')]){_0x4b41c7['where']=_[_0x1adc('0x4e')](_0x4b41c7['where'],{'$or':_['map'](_0x4b41c7[_0x1adc('0x44')],function(_0x2af9f0){var _0x14324d={};_0x14324d[_0x2af9f0]={'$like':'%'+_0x370c02[_0x1adc('0x42')][_0x1adc('0x4c')]+'%'};return _0x14324d;})});}_0x4b41c7=_[_0x1adc('0x4e')]({},_0x4b41c7,_0x370c02['options']);return _0x629801['getFields'](_0x4b41c7);}})[_0x1adc('0x20')](function(_0xf0e11b){if(_0xf0e11b){_0x17ebc0=_0xf0e11b[_0x1adc('0x47')];if(!_0x370c02[_0x1adc('0x42')][_0x1adc('0x48')](_0x1adc('0x49'))){_0x4b41c7[_0x1adc('0x31')]=qs[_0x1adc('0x31')](_0x370c02[_0x1adc('0x42')][_0x1adc('0x31')]);_0x4b41c7[_0x1adc('0x30')]=qs[_0x1adc('0x30')](_0x370c02[_0x1adc('0x42')]['offset']);}return _0x629801[_0x1adc('0x60')](_0x4b41c7);}})['then'](function(_0x184752){if(_0x184752){return _0x184752?{'count':_0x17ebc0,'rows':_0x184752}:null;}})[_0x1adc('0x20')](respondWithResult(_0x573e97,null))[_0x1adc('0x2a')](handleError(_0x573e97,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 4513feb..dabe7f4 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 _0xdcf7=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','moment','bluebird','request-promise','path'];(function(_0x1e8461,_0x5e1500){var _0x528f4d=function(_0x217227){while(--_0x217227){_0x1e8461['push'](_0x1e8461['shift']());}};_0x528f4d(++_0x5e1500);}(_0xdcf7,0x132));var _0x7dcf=function(_0x1d2950,_0x596539){_0x1d2950=_0x1d2950-0x0;var _0x11df30=_0xdcf7[_0x1d2950];return _0x11df30;};'use strict';var _=require(_0x7dcf('0x0'));var util=require(_0x7dcf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7dcf('0x2'));var BPromise=require(_0x7dcf('0x3'));var rp=require(_0x7dcf('0x4'));var fs=require('fs');var path=require(_0x7dcf('0x5'));var rimraf=require(_0x7dcf('0x6'));var config=require(_0x7dcf('0x7'));var attributes=require(_0x7dcf('0x8'));module[_0x7dcf('0x9')]=function(_0x1a062d,_0x278777){return _0x1a062d['define'](_0x7dcf('0xa'),attributes,{'tableName':_0x7dcf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28b1=['rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x305bbf,_0x5647b3){var _0x4ed772=function(_0x3315ed){while(--_0x3315ed){_0x305bbf['push'](_0x305bbf['shift']());}};_0x4ed772(++_0x5647b3);}(_0x28b1,0x1aa));var _0x128b=function(_0xcfeef8,_0x23ab04){_0xcfeef8=_0xcfeef8-0x0;var _0x336590=_0x28b1[_0xcfeef8];return _0x336590;};'use strict';var _=require('lodash');var util=require(_0x128b('0x0'));var logger=require(_0x128b('0x1'))(_0x128b('0x2'));var moment=require(_0x128b('0x3'));var BPromise=require(_0x128b('0x4'));var rp=require(_0x128b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x128b('0x6'));var config=require('../../config/environment');var attributes=require(_0x128b('0x7'));module[_0x128b('0x8')]=function(_0x445591,_0x5c0310){return _0x445591[_0x128b('0x9')](_0x128b('0xa'),attributes,{'tableName':_0x128b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 1661c60..f961e5c 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 _0x44a3=['http','request','then','info','request\x20sent','debug','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1df47c,_0xb33879){var _0x17ffba=function(_0xb036e0){while(--_0xb036e0){_0x1df47c['push'](_0x1df47c['shift']());}};_0x17ffba(++_0xb33879);}(_0x44a3,0x1a9));var _0x344a=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x44a3[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});} \ No newline at end of file +var _0xf958=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x25358e,_0x5dbb99){var _0x4f1f32=function(_0xd209a3){while(--_0xd209a3){_0x25358e['push'](_0x25358e['shift']());}};_0x4f1f32(++_0x5dbb99);}(_0xf958,0xe6));var _0x8f95=function(_0xbb62f,_0x319198){_0xbb62f=_0xbb62f-0x0;var _0x230d12=_0xf958[_0xbb62f];return _0x230d12;};'use strict';var _=require(_0x8f95('0x0'));var util=require('util');var moment=require(_0x8f95('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f95('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f95('0x3'))['db'];var utils=require(_0x8f95('0x4'));var logger=require(_0x8f95('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f95('0x6'));var client=jayson[_0x8f95('0x7')][_0x8f95('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c2af8,_0x5cfc04,_0x1ae9c4){return new BPromise(function(_0x109bed,_0x435b5b){return client[_0x8f95('0x9')](_0x5c2af8,_0x1ae9c4)[_0x8f95('0xa')](function(_0x585025){logger[_0x8f95('0xb')](_0x8f95('0xc'),_0x5cfc04,'request\x20sent');logger[_0x8f95('0xd')](_0x8f95('0xe'),_0x5cfc04,_0x8f95('0xf'),JSON['stringify'](_0x585025));if(_0x585025[_0x8f95('0x10')]){if(_0x585025[_0x8f95('0x10')][_0x8f95('0x11')]===0x1f4){logger['error'](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x435b5b(_0x585025['error'][_0x8f95('0x12')]);}logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);return _0x109bed(_0x585025[_0x8f95('0x10')][_0x8f95('0x12')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5cfc04,'request\x20sent');_0x109bed(_0x585025['result']['message']);}})[_0x8f95('0x13')](function(_0x2f01cd){logger[_0x8f95('0x10')](_0x8f95('0xc'),_0x5cfc04,_0x2f01cd);_0x435b5b(_0x2f01cd);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 5a72f72..07390bb 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 _0xaa90=['Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','get','/:id','create','put','update','destroy','exports','multer','util','path','express'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xaa90,0x1dc));var _0x0aa9=function(_0x16f6c5,_0x4880c2){_0x16f6c5=_0x16f6c5-0x0;var _0x1a8756=_0xaa90[_0x16f6c5];return _0x1a8756;};'use strict';var multer=require(_0x0aa9('0x0'));var util=require(_0x0aa9('0x1'));var path=require(_0x0aa9('0x2'));var timeout=require('connect-timeout');var express=require(_0x0aa9('0x3'));var router=express[_0x0aa9('0x4')]();var auth=require(_0x0aa9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0aa9('0x6'));var controller=require(_0x0aa9('0x7'));router['get']('/',auth[_0x0aa9('0x8')](),controller['index']);router[_0x0aa9('0x9')](_0x0aa9('0xa'),auth[_0x0aa9('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x0aa9('0xb')]);router[_0x0aa9('0xc')](_0x0aa9('0xa'),auth[_0x0aa9('0x8')](),controller[_0x0aa9('0xd')]);router['delete'](_0x0aa9('0xa'),auth[_0x0aa9('0x8')](),controller[_0x0aa9('0xe')]);module[_0x0aa9('0xf')]=router; \ No newline at end of file +var _0x935f=['update','destroy','util','path','Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3fe520,_0x4e4f2c){var _0x4ab8c0=function(_0x1962cc){while(--_0x1962cc){_0x3fe520['push'](_0x3fe520['shift']());}};_0x4ab8c0(++_0x4e4f2c);}(_0x935f,0x84));var _0xf935=function(_0x247029,_0xb92a74){_0x247029=_0x247029-0x0;var _0x21297d=_0x935f[_0x247029];return _0x21297d;};'use strict';var multer=require('multer');var util=require(_0xf935('0x0'));var path=require(_0xf935('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf935('0x2')]();var auth=require(_0xf935('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf935('0x4'));var controller=require(_0xf935('0x5'));router[_0xf935('0x6')]('/',auth[_0xf935('0x7')](),controller[_0xf935('0x8')]);router[_0xf935('0x6')](_0xf935('0x9'),auth[_0xf935('0x7')](),controller[_0xf935('0xa')]);router['post']('/',auth[_0xf935('0x7')](),controller['create']);router['put'](_0xf935('0x9'),auth[_0xf935('0x7')](),controller[_0xf935('0xb')]);router['delete'](_0xf935('0x9'),auth[_0xf935('0x7')](),controller[_0xf935('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5d4125b..764a620 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 _0x2632=['variable','keyValue','string','STRING','ENUM','customVariable','exports'];(function(_0xe2c5d0,_0x1b522e){var _0x63bca0=function(_0x4c15d2){while(--_0x4c15d2){_0xe2c5d0['push'](_0xe2c5d0['shift']());}};_0x63bca0(++_0x1b522e);}(_0x2632,0xae));var _0x2263=function(_0x36a52b,_0x4ebaf3){_0x36a52b=_0x36a52b-0x0;var _0x11cc45=_0x2632[_0x36a52b];return _0x11cc45;};'use strict';var Sequelize=require('sequelize');module[_0x2263('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0x2263('0x1'),'customVariable',_0x2263('0x2')),'defaultValue':_0x2263('0x3')},'content':{'type':Sequelize[_0x2263('0x4')]},'key':{'type':Sequelize[_0x2263('0x4')]},'keyType':{'type':Sequelize[_0x2263('0x5')]('string',_0x2263('0x1'),_0x2263('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2263('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x56ff=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x3b3a81,_0x45f077){var _0xf6d3fd=function(_0x46428c){while(--_0x46428c){_0x3b3a81['push'](_0x3b3a81['shift']());}};_0xf6d3fd(++_0x45f077);}(_0x56ff,0xb9));var _0xf56f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x56ff[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf56f('0x0'));module[_0xf56f('0x1')]={'type':{'type':Sequelize[_0xf56f('0x2')](_0xf56f('0x3'),_0xf56f('0x4'),_0xf56f('0x5'),_0xf56f('0x6')),'defaultValue':_0xf56f('0x3')},'content':{'type':Sequelize[_0xf56f('0x7')]},'key':{'type':Sequelize[_0xf56f('0x7')]},'keyType':{'type':Sequelize[_0xf56f('0x2')](_0xf56f('0x3'),'variable',_0xf56f('0x5'))},'keyContent':{'type':Sequelize[_0xf56f('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf56f('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf56f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d6bd13a..f4717be 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 _0x7cb9=['show','params','includeAll','find','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','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','json','reject','save','then','destroy','error','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x7cb9,0x123));var _0x97cb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7cb9[_0xa464c9];return _0x3d73c4;};'use strict';var pdf=require(_0x97cb('0x0'));var emlformat=require(_0x97cb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x97cb('0x2'));var jsonpatch=require(_0x97cb('0x3'));var rp=require(_0x97cb('0x4'));var moment=require(_0x97cb('0x5'));var BPromise=require(_0x97cb('0x6'));var Mustache=require(_0x97cb('0x7'));var util=require('util');var path=require('path');var sox=require(_0x97cb('0x8'));var csv=require('to-csv');var ejs=require(_0x97cb('0x9'));var fs=require('fs');var _=require(_0x97cb('0xa'));var squel=require('squel');var crypto=require(_0x97cb('0xb'));var jsforce=require(_0x97cb('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x97cb('0xd'));var Papa=require(_0x97cb('0xe'));var Redis=require(_0x97cb('0xf'));var authService=require(_0x97cb('0x10'));var qs=require(_0x97cb('0x11'));var as=require(_0x97cb('0x12'));var hardwareService=require(_0x97cb('0x13'));var logger=require(_0x97cb('0x14'))(_0x97cb('0x15'));var utils=require('../../config/utils');var config=require(_0x97cb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15cdf5,_0x27bd90){_0x27bd90=_0x27bd90||0xcc;return function(_0x460631){if(_0x460631){return _0x15cdf5[_0x97cb('0x17')](_0x27bd90);}return _0x15cdf5[_0x97cb('0x18')](_0x27bd90)[_0x97cb('0x19')]();};}function respondWithResult(_0x1c18cc,_0x3796cd){_0x3796cd=_0x3796cd||0xc8;return function(_0x2b8f22){if(_0x2b8f22){return _0x1c18cc[_0x97cb('0x18')](_0x3796cd)['json'](_0x2b8f22);}};}function respondWithFilteredResult(_0x5d0c4a,_0xd8ac33){return function(_0x14936e){if(_0x14936e){var _0xcdf650=_0x14936e[_0x97cb('0x1a')],_0x54da4c=_0xd8ac33[_0x97cb('0x1b')],_0x30db89=_0xd8ac33[_0x97cb('0x1b')]+_0xd8ac33[_0x97cb('0x1c')],_0x3042c8;if(_0x30db89>=_0xcdf650){_0x30db89=_0xcdf650;_0x3042c8=0xc8;}else{_0x3042c8=0xce;}_0x5d0c4a[_0x97cb('0x18')](_0x3042c8);return _0x5d0c4a[_0x97cb('0x1d')]('Content-Range',_0x54da4c+'-'+_0x30db89+'/'+_0xcdf650)[_0x97cb('0x1e')](_0x14936e);}return null;};}function patchUpdates(_0x3a80af){return function(_0x14a3c3){try{jsonpatch['apply'](_0x14a3c3,_0x3a80af,!![]);}catch(_0xf21ccc){return BPromise[_0x97cb('0x1f')](_0xf21ccc);}return _0x14a3c3[_0x97cb('0x20')]();};}function saveUpdates(_0x50bfdf,_0x2d8ccd){return function(_0x2f0e1f){if(_0x2f0e1f){return _0x2f0e1f['update'](_0x50bfdf)[_0x97cb('0x21')](function(_0x3dfcd9){return _0x3dfcd9;});}return null;};}function removeEntity(_0x385253,_0x73d59a){return function(_0x490eb7){if(_0x490eb7){return _0x490eb7[_0x97cb('0x22')]()[_0x97cb('0x21')](function(){_0x385253[_0x97cb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x194bf6,_0x190541){return function(_0x6bde06){if(!_0x6bde06){_0x194bf6[_0x97cb('0x17')](0x194);}return _0x6bde06;};}function handleError(_0x5ba53e,_0x104523){_0x104523=_0x104523||0x1f4;return function(_0x34d748){logger[_0x97cb('0x23')](_0x34d748[_0x97cb('0x24')]);if(_0x34d748[_0x97cb('0x25')]){delete _0x34d748['name'];}_0x5ba53e['status'](_0x104523)[_0x97cb('0x26')](_0x34d748);};}exports['index']=function(_0x57cf01,_0xac05dd){var _0x1e6f18={},_0x5afcac={},_0x56d923={'count':0x0,'rows':[]};var _0x1c672c=_[_0x97cb('0x27')](db[_0x97cb('0x28')][_0x97cb('0x29')],function(_0x198c55){return{'name':_0x198c55[_0x97cb('0x2a')],'type':_0x198c55[_0x97cb('0x2b')]['key']};});_0x5afcac[_0x97cb('0x2c')]=_[_0x97cb('0x27')](_0x1c672c,'name');_0x5afcac[_0x97cb('0x2d')]=_[_0x97cb('0x2e')](_0x57cf01[_0x97cb('0x2d')]);_0x5afcac[_0x97cb('0x2f')]=_[_0x97cb('0x30')](_0x5afcac['model'],_0x5afcac[_0x97cb('0x2d')]);_0x1e6f18[_0x97cb('0x31')]=_[_0x97cb('0x30')](_0x5afcac[_0x97cb('0x2c')],qs[_0x97cb('0x32')](_0x57cf01[_0x97cb('0x2d')][_0x97cb('0x32')]));_0x1e6f18['attributes']=_0x1e6f18['attributes'][_0x97cb('0x33')]?_0x1e6f18[_0x97cb('0x31')]:_0x5afcac[_0x97cb('0x2c')];if(!_0x57cf01[_0x97cb('0x2d')][_0x97cb('0x34')](_0x97cb('0x35'))){_0x1e6f18['limit']=qs['limit'](_0x57cf01['query'][_0x97cb('0x1c')]);_0x1e6f18[_0x97cb('0x1b')]=qs[_0x97cb('0x1b')](_0x57cf01[_0x97cb('0x2d')][_0x97cb('0x1b')]);}_0x1e6f18[_0x97cb('0x36')]=qs['sort'](_0x57cf01[_0x97cb('0x2d')][_0x97cb('0x37')]);_0x1e6f18[_0x97cb('0x38')]=qs[_0x97cb('0x2f')](_[_0x97cb('0x39')](_0x57cf01[_0x97cb('0x2d')],_0x5afcac[_0x97cb('0x2f')]),_0x1c672c);if(_0x57cf01[_0x97cb('0x2d')][_0x97cb('0x3a')]){_0x1e6f18[_0x97cb('0x38')]=_[_0x97cb('0x3b')](_0x1e6f18[_0x97cb('0x38')],{'$or':_[_0x97cb('0x27')](_0x1c672c,function(_0x4802d3){if(_0x4802d3[_0x97cb('0x2b')]!==_0x97cb('0x3c')){var _0x398c73={};_0x398c73[_0x4802d3['name']]={'$like':'%'+_0x57cf01[_0x97cb('0x2d')][_0x97cb('0x3a')]+'%'};return _0x398c73;}})});}_0x1e6f18=_[_0x97cb('0x3b')]({},_0x1e6f18,_0x57cf01[_0x97cb('0x3d')]);var _0x28e267={'where':_0x1e6f18[_0x97cb('0x38')]};return db[_0x97cb('0x28')][_0x97cb('0x1a')](_0x28e267)['then'](function(_0x386c85){_0x56d923[_0x97cb('0x1a')]=_0x386c85;if(_0x57cf01[_0x97cb('0x2d')]['includeAll']){_0x1e6f18['include']=[{'all':!![]}];}return db[_0x97cb('0x28')][_0x97cb('0x3e')](_0x1e6f18);})['then'](function(_0x249aa0){_0x56d923['rows']=_0x249aa0;return _0x56d923;})['then'](respondWithFilteredResult(_0xac05dd,_0x1e6f18))[_0x97cb('0x3f')](handleError(_0xac05dd,null));};exports[_0x97cb('0x40')]=function(_0x22e62b,_0x318013){var _0x9dab61={'raw':!![],'where':{'id':_0x22e62b[_0x97cb('0x41')]['id']}},_0x2c31ba={};_0x2c31ba[_0x97cb('0x2c')]=_['keys'](db[_0x97cb('0x28')]['rawAttributes']);_0x2c31ba[_0x97cb('0x2d')]=_[_0x97cb('0x2e')](_0x22e62b[_0x97cb('0x2d')]);_0x2c31ba[_0x97cb('0x2f')]=_[_0x97cb('0x30')](_0x2c31ba[_0x97cb('0x2c')],_0x2c31ba[_0x97cb('0x2d')]);_0x9dab61[_0x97cb('0x31')]=_[_0x97cb('0x30')](_0x2c31ba[_0x97cb('0x2c')],qs[_0x97cb('0x32')](_0x22e62b[_0x97cb('0x2d')][_0x97cb('0x32')]));_0x9dab61[_0x97cb('0x31')]=_0x9dab61['attributes'][_0x97cb('0x33')]?_0x9dab61[_0x97cb('0x31')]:_0x2c31ba[_0x97cb('0x2c')];if(_0x22e62b[_0x97cb('0x2d')][_0x97cb('0x42')]){_0x9dab61['include']=[{'all':!![]}];}_0x9dab61=_[_0x97cb('0x3b')]({},_0x9dab61,_0x22e62b['options']);return db[_0x97cb('0x28')][_0x97cb('0x43')](_0x9dab61)[_0x97cb('0x21')](handleEntityNotFound(_0x318013,null))[_0x97cb('0x21')](respondWithResult(_0x318013,null))[_0x97cb('0x3f')](handleError(_0x318013,null));};exports[_0x97cb('0x44')]=function(_0x551630,_0x1f2fd0){return db[_0x97cb('0x28')]['create'](_0x551630[_0x97cb('0x45')],{})[_0x97cb('0x21')](respondWithResult(_0x1f2fd0,0xc9))['catch'](handleError(_0x1f2fd0,null));};exports[_0x97cb('0x46')]=function(_0x27d52b,_0x2b44e3){if(_0x27d52b[_0x97cb('0x45')]['id']){delete _0x27d52b['body']['id'];}return db[_0x97cb('0x28')][_0x97cb('0x43')]({'where':{'id':_0x27d52b[_0x97cb('0x41')]['id']}})[_0x97cb('0x21')](handleEntityNotFound(_0x2b44e3,null))[_0x97cb('0x21')](saveUpdates(_0x27d52b[_0x97cb('0x45')],null))[_0x97cb('0x21')](respondWithResult(_0x2b44e3,null))[_0x97cb('0x3f')](handleError(_0x2b44e3,null));};exports[_0x97cb('0x22')]=function(_0x1e1e07,_0x15aef0){return db[_0x97cb('0x28')][_0x97cb('0x43')]({'where':{'id':_0x1e1e07[_0x97cb('0x41')]['id']}})[_0x97cb('0x21')](handleEntityNotFound(_0x15aef0,null))[_0x97cb('0x21')](removeEntity(_0x15aef0,null))[_0x97cb('0x3f')](handleError(_0x15aef0,null));}; \ No newline at end of file +var _0xc8e8=['fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','intersection','find','catch','create','body','destroy','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','map','FreshsalesField','rawAttributes'];(function(_0xd1368e,_0x3f9d19){var _0x1ce149=function(_0x46d1cb){while(--_0x46d1cb){_0xd1368e['push'](_0xd1368e['shift']());}};_0x1ce149(++_0x3f9d19);}(_0xc8e8,0xac));var _0x8c8e=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0xc8e8[_0x50a004];return _0x5e9992;};'use strict';var pdf=require(_0x8c8e('0x0'));var emlformat=require(_0x8c8e('0x1'));var rimraf=require(_0x8c8e('0x2'));var zipdir=require(_0x8c8e('0x3'));var jsonpatch=require(_0x8c8e('0x4'));var rp=require('request-promise');var moment=require(_0x8c8e('0x5'));var BPromise=require(_0x8c8e('0x6'));var Mustache=require(_0x8c8e('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8c8e('0x8'));var csv=require(_0x8c8e('0x9'));var ejs=require(_0x8c8e('0xa'));var fs=require('fs');var _=require(_0x8c8e('0xb'));var squel=require('squel');var crypto=require(_0x8c8e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8c8e('0xd'));var toCsv=require(_0x8c8e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8c8e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8c8e('0xf'));var as=require(_0x8c8e('0x10'));var hardwareService=require(_0x8c8e('0x11'));var logger=require(_0x8c8e('0x12'))(_0x8c8e('0x13'));var utils=require('../../config/utils');var config=require(_0x8c8e('0x14'));var db=require(_0x8c8e('0x15'))['db'];function respondWithStatusCode(_0x35c1b6,_0x491ee6){_0x491ee6=_0x491ee6||0xcc;return function(_0x46b8df){if(_0x46b8df){return _0x35c1b6['sendStatus'](_0x491ee6);}return _0x35c1b6[_0x8c8e('0x16')](_0x491ee6)[_0x8c8e('0x17')]();};}function respondWithResult(_0x1bbc5f,_0x22b957){_0x22b957=_0x22b957||0xc8;return function(_0x485098){if(_0x485098){return _0x1bbc5f[_0x8c8e('0x16')](_0x22b957)['json'](_0x485098);}};}function respondWithFilteredResult(_0x2f6e8d,_0x4cc28f){return function(_0x15059c){if(_0x15059c){var _0x26aeba=_0x15059c[_0x8c8e('0x18')],_0x404da5=_0x4cc28f[_0x8c8e('0x19')],_0x4d35ad=_0x4cc28f[_0x8c8e('0x19')]+_0x4cc28f[_0x8c8e('0x1a')],_0x2eec09;if(_0x4d35ad>=_0x26aeba){_0x4d35ad=_0x26aeba;_0x2eec09=0xc8;}else{_0x2eec09=0xce;}_0x2f6e8d['status'](_0x2eec09);return _0x2f6e8d['set'](_0x8c8e('0x1b'),_0x404da5+'-'+_0x4d35ad+'/'+_0x26aeba)[_0x8c8e('0x1c')](_0x15059c);}return null;};}function patchUpdates(_0x18696f){return function(_0x26b4ca){try{jsonpatch[_0x8c8e('0x1d')](_0x26b4ca,_0x18696f,!![]);}catch(_0x260c4f){return BPromise[_0x8c8e('0x1e')](_0x260c4f);}return _0x26b4ca[_0x8c8e('0x1f')]();};}function saveUpdates(_0x13d842,_0x5b9b38){return function(_0x3a9c13){if(_0x3a9c13){return _0x3a9c13[_0x8c8e('0x20')](_0x13d842)[_0x8c8e('0x21')](function(_0x327dbb){return _0x327dbb;});}return null;};}function removeEntity(_0x4ef5c0,_0xf28894){return function(_0x42b615){if(_0x42b615){return _0x42b615['destroy']()[_0x8c8e('0x21')](function(){_0x4ef5c0[_0x8c8e('0x16')](0xcc)[_0x8c8e('0x17')]();});}};}function handleEntityNotFound(_0x11b122,_0x23e4cb){return function(_0x5e7b5e){if(!_0x5e7b5e){_0x11b122[_0x8c8e('0x22')](0x194);}return _0x5e7b5e;};}function handleError(_0x2147e2,_0x24ee2d){_0x24ee2d=_0x24ee2d||0x1f4;return function(_0x1cc759){logger[_0x8c8e('0x23')](_0x1cc759[_0x8c8e('0x24')]);if(_0x1cc759[_0x8c8e('0x25')]){delete _0x1cc759[_0x8c8e('0x25')];}_0x2147e2[_0x8c8e('0x16')](_0x24ee2d)['send'](_0x1cc759);};}exports['index']=function(_0x18135f,_0xb63f03){var _0x216749={},_0x1f97a7={},_0x410d26={'count':0x0,'rows':[]};var _0x1bfb39=_[_0x8c8e('0x26')](db[_0x8c8e('0x27')][_0x8c8e('0x28')],function(_0x294dc4){return{'name':_0x294dc4[_0x8c8e('0x29')],'type':_0x294dc4[_0x8c8e('0x2a')][_0x8c8e('0x2b')]};});_0x1f97a7[_0x8c8e('0x2c')]=_[_0x8c8e('0x26')](_0x1bfb39,'name');_0x1f97a7[_0x8c8e('0x2d')]=_[_0x8c8e('0x2e')](_0x18135f['query']);_0x1f97a7['filters']=_['intersection'](_0x1f97a7['model'],_0x1f97a7['query']);_0x216749['attributes']=_['intersection'](_0x1f97a7[_0x8c8e('0x2c')],qs[_0x8c8e('0x2f')](_0x18135f[_0x8c8e('0x2d')]['fields']));_0x216749[_0x8c8e('0x30')]=_0x216749[_0x8c8e('0x30')][_0x8c8e('0x31')]?_0x216749[_0x8c8e('0x30')]:_0x1f97a7['model'];if(!_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x32')]('nolimit')){_0x216749[_0x8c8e('0x1a')]=qs[_0x8c8e('0x1a')](_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x1a')]);_0x216749[_0x8c8e('0x19')]=qs[_0x8c8e('0x19')](_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x19')]);}_0x216749[_0x8c8e('0x33')]=qs[_0x8c8e('0x34')](_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x34')]);_0x216749[_0x8c8e('0x35')]=qs[_0x8c8e('0x36')](_[_0x8c8e('0x37')](_0x18135f[_0x8c8e('0x2d')],_0x1f97a7[_0x8c8e('0x36')]),_0x1bfb39);if(_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x38')]){_0x216749['where']=_[_0x8c8e('0x39')](_0x216749[_0x8c8e('0x35')],{'$or':_[_0x8c8e('0x26')](_0x1bfb39,function(_0x5c94bb){if(_0x5c94bb['type']!=='VIRTUAL'){var _0x3d6d3f={};_0x3d6d3f[_0x5c94bb[_0x8c8e('0x25')]]={'$like':'%'+_0x18135f[_0x8c8e('0x2d')][_0x8c8e('0x38')]+'%'};return _0x3d6d3f;}})});}_0x216749=_[_0x8c8e('0x39')]({},_0x216749,_0x18135f[_0x8c8e('0x3a')]);var _0x83deaf={'where':_0x216749[_0x8c8e('0x35')]};return db['FreshsalesField'][_0x8c8e('0x18')](_0x83deaf)[_0x8c8e('0x21')](function(_0x30bb67){_0x410d26[_0x8c8e('0x18')]=_0x30bb67;if(_0x18135f['query'][_0x8c8e('0x3b')]){_0x216749[_0x8c8e('0x3c')]=[{'all':!![]}];}return db[_0x8c8e('0x27')][_0x8c8e('0x3d')](_0x216749);})['then'](function(_0x147651){_0x410d26[_0x8c8e('0x3e')]=_0x147651;return _0x410d26;})['then'](respondWithFilteredResult(_0xb63f03,_0x216749))['catch'](handleError(_0xb63f03,null));};exports[_0x8c8e('0x3f')]=function(_0xea4444,_0x4a232e){var _0x3c4599={'raw':!![],'where':{'id':_0xea4444['params']['id']}},_0x40f788={};_0x40f788[_0x8c8e('0x2c')]=_[_0x8c8e('0x2e')](db[_0x8c8e('0x27')][_0x8c8e('0x28')]);_0x40f788[_0x8c8e('0x2d')]=_[_0x8c8e('0x2e')](_0xea4444['query']);_0x40f788['filters']=_[_0x8c8e('0x40')](_0x40f788[_0x8c8e('0x2c')],_0x40f788['query']);_0x3c4599[_0x8c8e('0x30')]=_[_0x8c8e('0x40')](_0x40f788['model'],qs[_0x8c8e('0x2f')](_0xea4444[_0x8c8e('0x2d')][_0x8c8e('0x2f')]));_0x3c4599[_0x8c8e('0x30')]=_0x3c4599[_0x8c8e('0x30')][_0x8c8e('0x31')]?_0x3c4599['attributes']:_0x40f788['model'];if(_0xea4444[_0x8c8e('0x2d')]['includeAll']){_0x3c4599[_0x8c8e('0x3c')]=[{'all':!![]}];}_0x3c4599=_['merge']({},_0x3c4599,_0xea4444['options']);return db[_0x8c8e('0x27')][_0x8c8e('0x41')](_0x3c4599)[_0x8c8e('0x21')](handleEntityNotFound(_0x4a232e,null))[_0x8c8e('0x21')](respondWithResult(_0x4a232e,null))[_0x8c8e('0x42')](handleError(_0x4a232e,null));};exports['create']=function(_0x31542a,_0xd5246){return db[_0x8c8e('0x27')][_0x8c8e('0x43')](_0x31542a[_0x8c8e('0x44')],{})[_0x8c8e('0x21')](respondWithResult(_0xd5246,0xc9))[_0x8c8e('0x42')](handleError(_0xd5246,null));};exports[_0x8c8e('0x20')]=function(_0x11a6cf,_0x5cfa57){if(_0x11a6cf[_0x8c8e('0x44')]['id']){delete _0x11a6cf[_0x8c8e('0x44')]['id'];}return db['FreshsalesField'][_0x8c8e('0x41')]({'where':{'id':_0x11a6cf['params']['id']}})[_0x8c8e('0x21')](handleEntityNotFound(_0x5cfa57,null))['then'](saveUpdates(_0x11a6cf[_0x8c8e('0x44')],null))[_0x8c8e('0x21')](respondWithResult(_0x5cfa57,null))[_0x8c8e('0x42')](handleError(_0x5cfa57,null));};exports[_0x8c8e('0x45')]=function(_0x4cf2d3,_0xce6ac3){return db[_0x8c8e('0x27')]['find']({'where':{'id':_0x4cf2d3[_0x8c8e('0x46')]['id']}})['then'](handleEntityNotFound(_0xce6ac3,null))[_0x8c8e('0x21')](removeEntity(_0xce6ac3,null))[_0x8c8e('0x42')](handleError(_0xce6ac3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index fee8005..29c5fea 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 _0xe109=['FieldId','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','idField'];(function(_0x2064b6,_0x49272f){var _0x1ad489=function(_0x4182c1){while(--_0x4182c1){_0x2064b6['push'](_0x2064b6['shift']());}};_0x1ad489(++_0x49272f);}(_0xe109,0x14b));var _0x9e10=function(_0x110cb6,_0x1f6a43){_0x110cb6=_0x110cb6-0x0;var _0x57c099=_0xe109[_0x110cb6];return _0x57c099;};'use strict';var _=require(_0x9e10('0x0'));var util=require('util');var logger=require(_0x9e10('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9e10('0x2'));var rp=require(_0x9e10('0x3'));var fs=require('fs');var path=require(_0x9e10('0x4'));var rimraf=require('rimraf');var config=require(_0x9e10('0x5'));var attributes=require(_0x9e10('0x6'));module[_0x9e10('0x7')]=function(_0x10c633,_0x31250c){return _0x10c633['define'](_0x9e10('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x9e10('0x9'),_0x9e10('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdac5=['freshsales_unique_index','../../config/logger','api','moment','rimraf','exports','define','FreshsalesField','int_freshsales_fields'];(function(_0x36734a,_0xdd12e1){var _0x565da1=function(_0x4e27d3){while(--_0x4e27d3){_0x36734a['push'](_0x36734a['shift']());}};_0x565da1(++_0xdd12e1);}(_0xdac5,0x7f));var _0x5dac=function(_0x2dcd33,_0x3769d8){_0x2dcd33=_0x2dcd33-0x0;var _0x2f0b3a=_0xdac5[_0x2dcd33];return _0x2f0b3a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5dac('0x0'))(_0x5dac('0x1'));var moment=require(_0x5dac('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5dac('0x3'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x5dac('0x4')]=function(_0x1961bf,_0x188f1a){return _0x1961bf[_0x5dac('0x5')](_0x5dac('0x6'),attributes,{'tableName':_0x5dac('0x7'),'paranoid':![],'indexes':[{'name':_0x5dac('0x8'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index aeca388..f9ed5d3 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 _0x3f75=['lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','FreshsalesField,\x20%s,\x20%s','message','result'];(function(_0x1c5037,_0x52e4d0){var _0x1e6ead=function(_0x24ed26){while(--_0x24ed26){_0x1c5037['push'](_0x1c5037['shift']());}};_0x1e6ead(++_0x52e4d0);}(_0x3f75,0xc8));var _0x53f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f75[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x53f7('0x0'));var util=require('util');var moment=require(_0x53f7('0x1'));var BPromise=require(_0x53f7('0x2'));var rs=require(_0x53f7('0x3'));var fs=require('fs');var Redis=require(_0x53f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x53f7('0x5'))(_0x53f7('0x6'));var config=require('../../config/environment');var jayson=require(_0x53f7('0x7'));var client=jayson[_0x53f7('0x8')][_0x53f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x197120,_0x5af833,_0x108b7e){return new BPromise(function(_0x4f6384,_0x21a2a7){return client[_0x53f7('0xa')](_0x197120,_0x108b7e)[_0x53f7('0xb')](function(_0x1f1d64){logger[_0x53f7('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x5af833,_0x53f7('0xd'));logger['debug'](_0x53f7('0xe'),_0x5af833,'request\x20sent',JSON['stringify'](_0x1f1d64));if(_0x1f1d64[_0x53f7('0xf')]){if(_0x1f1d64[_0x53f7('0xf')][_0x53f7('0x10')]===0x1f4){logger[_0x53f7('0xf')](_0x53f7('0x11'),_0x5af833,_0x1f1d64[_0x53f7('0xf')][_0x53f7('0x12')]);return _0x21a2a7(_0x1f1d64['error'][_0x53f7('0x12')]);}logger['error'](_0x53f7('0x11'),_0x5af833,_0x1f1d64['error'][_0x53f7('0x12')]);return _0x4f6384(_0x1f1d64[_0x53f7('0xf')][_0x53f7('0x12')]);}else{logger[_0x53f7('0xc')](_0x53f7('0x11'),_0x5af833,_0x53f7('0xd'));_0x4f6384(_0x1f1d64[_0x53f7('0x13')][_0x53f7('0x12')]);}})['catch'](function(_0x120af2){logger[_0x53f7('0xf')](_0x53f7('0x11'),_0x5af833,_0x120af2);_0x21a2a7(_0x120af2);});});} \ No newline at end of file +var _0x8f1a=['message','result','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2f9b03,_0x8d12b0){var _0x437f9a=function(_0x3447c5){while(--_0x3447c5){_0x2f9b03['push'](_0x2f9b03['shift']());}};_0x437f9a(++_0x8d12b0);}(_0x8f1a,0xba));var _0xa8f1=function(_0x35e1e3,_0x2ee3a9){_0x35e1e3=_0x35e1e3-0x0;var _0x12cb1d=_0x8f1a[_0x35e1e3];return _0x12cb1d;};'use strict';var _=require('lodash');var util=require(_0xa8f1('0x0'));var moment=require(_0xa8f1('0x1'));var BPromise=require(_0xa8f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8f1('0x3'))['db'];var utils=require(_0xa8f1('0x4'));var logger=require(_0xa8f1('0x5'))(_0xa8f1('0x6'));var config=require(_0xa8f1('0x7'));var jayson=require(_0xa8f1('0x8'));var client=jayson[_0xa8f1('0x9')][_0xa8f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xccce44,_0x5de898,_0x1a04f){return new BPromise(function(_0x530267,_0xbedf91){return client[_0xa8f1('0xb')](_0xccce44,_0x1a04f)[_0xa8f1('0xc')](function(_0x5575e5){logger[_0xa8f1('0xd')](_0xa8f1('0xe'),_0x5de898,'request\x20sent');logger[_0xa8f1('0xf')](_0xa8f1('0x10'),_0x5de898,_0xa8f1('0x11'),JSON[_0xa8f1('0x12')](_0x5575e5));if(_0x5575e5[_0xa8f1('0x13')]){if(_0x5575e5[_0xa8f1('0x13')][_0xa8f1('0x14')]===0x1f4){logger['error'](_0xa8f1('0xe'),_0x5de898,_0x5575e5['error'][_0xa8f1('0x15')]);return _0xbedf91(_0x5575e5[_0xa8f1('0x13')][_0xa8f1('0x15')]);}logger['error'](_0xa8f1('0xe'),_0x5de898,_0x5575e5[_0xa8f1('0x13')][_0xa8f1('0x15')]);return _0x530267(_0x5575e5[_0xa8f1('0x13')][_0xa8f1('0x15')]);}else{logger[_0xa8f1('0xd')](_0xa8f1('0xe'),_0x5de898,_0xa8f1('0x11'));_0x530267(_0x5575e5[_0xa8f1('0x16')][_0xa8f1('0x15')]);}})['catch'](function(_0x52d1d3){logger[_0xa8f1('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x5de898,_0x52d1d3);_0xbedf91(_0x52d1d3);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 932e1ad..1cdcdb8 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 _0x0ab2=['multer','util','path','connect-timeout','express','Router','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','destroy','exports'];(function(_0x59c9ba,_0x23db7c){var _0x5db0dc=function(_0x376e80){while(--_0x376e80){_0x59c9ba['push'](_0x59c9ba['shift']());}};_0x5db0dc(++_0x23db7c);}(_0x0ab2,0x9a));var _0x20ab=function(_0x4b75a9,_0x42d2f4){_0x4b75a9=_0x4b75a9-0x0;var _0x2f90b1=_0x0ab2[_0x4b75a9];return _0x2f90b1;};'use strict';var multer=require(_0x20ab('0x0'));var util=require(_0x20ab('0x1'));var path=require(_0x20ab('0x2'));var timeout=require(_0x20ab('0x3'));var express=require(_0x20ab('0x4'));var router=express[_0x20ab('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x20ab('0x6'));var controller=require(_0x20ab('0x7'));router[_0x20ab('0x8')]('/',auth[_0x20ab('0x9')](),controller[_0x20ab('0xa')]);router[_0x20ab('0x8')](_0x20ab('0xb'),auth[_0x20ab('0x9')](),controller[_0x20ab('0xc')]);router['get'](_0x20ab('0xd'),auth[_0x20ab('0x9')](),controller[_0x20ab('0xe')]);router['get'](_0x20ab('0xf'),auth[_0x20ab('0x9')](),controller[_0x20ab('0x10')]);router[_0x20ab('0x11')]('/',auth[_0x20ab('0x9')](),controller[_0x20ab('0x12')]);router[_0x20ab('0x11')]('/:id/configurations',auth[_0x20ab('0x9')](),controller[_0x20ab('0x13')]);router['put']('/:id',auth[_0x20ab('0x9')](),controller['update']);router['delete'](_0x20ab('0xb'),auth[_0x20ab('0x9')](),controller[_0x20ab('0x14')]);module[_0x20ab('0x15')]=router; \ No newline at end of file +var _0x9c2b=['destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','put','update','delete','/:id'];(function(_0x20a48e,_0x19c088){var _0x4b0c22=function(_0x55910b){while(--_0x55910b){_0x20a48e['push'](_0x20a48e['shift']());}};_0x4b0c22(++_0x19c088);}(_0x9c2b,0x1a5));var _0xb9c2=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x9c2b[_0x599f41];return _0x2e4d58;};'use strict';var multer=require('multer');var util=require(_0xb9c2('0x0'));var path=require('path');var timeout=require(_0xb9c2('0x1'));var express=require(_0xb9c2('0x2'));var router=express[_0xb9c2('0x3')]();var auth=require(_0xb9c2('0x4'));var interaction=require(_0xb9c2('0x5'));var config=require(_0xb9c2('0x6'));var controller=require('./intSalesforceAccount.controller');router[_0xb9c2('0x7')]('/',auth['isAuthenticated'](),controller[_0xb9c2('0x8')]);router[_0xb9c2('0x7')]('/:id',auth[_0xb9c2('0x9')](),controller[_0xb9c2('0xa')]);router[_0xb9c2('0x7')](_0xb9c2('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb9c2('0x7')](_0xb9c2('0xc'),auth[_0xb9c2('0x9')](),controller['getFields']);router[_0xb9c2('0xd')]('/',auth['isAuthenticated'](),controller[_0xb9c2('0xe')]);router[_0xb9c2('0xd')]('/:id/configurations',auth[_0xb9c2('0x9')](),controller['addConfiguration']);router[_0xb9c2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb9c2('0x10')]);router[_0xb9c2('0x11')](_0xb9c2('0x12'),auth[_0xb9c2('0x9')](),controller[_0xb9c2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index f110cf1..be5536b 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 _0xf494=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x7941ec,_0x4098eb){var _0x3e11d3=function(_0x494437){while(--_0x494437){_0x7941ec['push'](_0x7941ec['shift']());}};_0x3e11d3(++_0x4098eb);}(_0xf494,0x1c6));var _0x4f49=function(_0xeb9477,_0x3b4e0d){_0xeb9477=_0xeb9477-0x0;var _0x5baea4=_0xf494[_0xeb9477];return _0x5baea4;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4f49('0x2')],'unique':_0x4f49('0x3')},'remoteUri':{'type':Sequelize[_0x4f49('0x2')]},'password':{'type':Sequelize[_0x4f49('0x2')]},'clientId':{'type':Sequelize[_0x4f49('0x2')]},'clientSecret':{'type':Sequelize[_0x4f49('0x2')]},'securityToken':{'type':Sequelize[_0x4f49('0x2')]},'serverUrl':{'type':Sequelize[_0x4f49('0x2')]},'type':{'type':Sequelize[_0x4f49('0x4')](_0x4f49('0x5'),_0x4f49('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x326f=['STRING','username','ENUM','newTab','integrationTab','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x326f,0xd1));var _0xf326=function(_0x323888,_0x465293){_0x323888=_0x323888-0x0;var _0x5e8958=_0x326f[_0x323888];return _0x5e8958;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf326('0x1')]},'username':{'type':Sequelize[_0xf326('0x1')],'unique':_0xf326('0x2')},'remoteUri':{'type':Sequelize[_0xf326('0x1')]},'password':{'type':Sequelize[_0xf326('0x1')]},'clientId':{'type':Sequelize[_0xf326('0x1')]},'clientSecret':{'type':Sequelize[_0xf326('0x1')]},'securityToken':{'type':Sequelize[_0xf326('0x1')]},'serverUrl':{'type':Sequelize[_0xf326('0x1')]},'type':{'type':Sequelize[_0xf326('0x3')]('integrationTab',_0xf326('0x4')),'defaultValue':_0xf326('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index f14d558..5e0a36e 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 _0x3fb7=['value','boolean','True','true','false','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','end','json','offset','limit','status','reject','save','destroy','stack','name','send','index','map','SalesforceAccount','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','rawAttributes','create','body','find','getConfigurations','SalesforceConfiguration','filter','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','password','securityToken','slice','lastIndexOf','clientSecret','login','username','concat','isNil','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','Origin','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues'];(function(_0x27d513,_0x5c3c57){var _0x25e897=function(_0x66303c){while(--_0x66303c){_0x27d513['push'](_0x27d513['shift']());}};_0x25e897(++_0x5c3c57);}(_0x3fb7,0x8d));var _0x73fb=function(_0x3b18d6,_0x430bc6){_0x3b18d6=_0x3b18d6-0x0;var _0x4e6f22=_0x3fb7[_0x3b18d6];return _0x4e6f22;};'use strict';var pdf=require(_0x73fb('0x0'));var emlformat=require(_0x73fb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x73fb('0x2'));var jsonpatch=require(_0x73fb('0x3'));var rp=require(_0x73fb('0x4'));var moment=require(_0x73fb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x73fb('0x6'));var util=require(_0x73fb('0x7'));var path=require(_0x73fb('0x8'));var sox=require('sox');var csv=require(_0x73fb('0x9'));var ejs=require(_0x73fb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x73fb('0xb'));var jsforce=require(_0x73fb('0xc'));var deskjs=require(_0x73fb('0xd'));var toCsv=require(_0x73fb('0x9'));var querystring=require(_0x73fb('0xe'));var Papa=require(_0x73fb('0xf'));var Redis=require(_0x73fb('0x10'));var authService=require(_0x73fb('0x11'));var qs=require(_0x73fb('0x12'));var as=require(_0x73fb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x73fb('0x14'));var utils=require(_0x73fb('0x15'));var config=require(_0x73fb('0x16'));var db=require(_0x73fb('0x17'))['db'];var integrations=require(_0x73fb('0x18'));var jayson=require(_0x73fb('0x19'));var client=jayson[_0x73fb('0x1a')][_0x73fb('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x164149,_0x4d2d78,_0x252851){if(_0x252851){var _0x281e86=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x281e86[_0x73fb('0x1c')](_0x4d2d78)){return _0x164149;}else{throw new db[(_0x73fb('0x1d'))][(_0x73fb('0x1e'))](_0x73fb('0x1f'));}}else{return _0x164149;}}function respondWithRpcPromise(_0x585bf1,_0x5281ee,_0x5a2096,_0x436acb){return new BPromise(function(_0x5b1da9,_0xc22d79){var _0x3d39b5=_0x436acb||client;return _0x3d39b5[_0x73fb('0x20')](_0x585bf1,_0x5a2096)[_0x73fb('0x21')](function(_0x1abaf2){logger['info'](_0x73fb('0x22'),_0x5281ee,_0x73fb('0x23'));logger['debug'](_0x73fb('0x24'),_0x5281ee,_0x73fb('0x23'),JSON[_0x73fb('0x25')](_0x1abaf2));if(_0x1abaf2[_0x73fb('0x26')]){if(_0x1abaf2[_0x73fb('0x26')]['code']===0x1f4){logger[_0x73fb('0x26')]('SalesforceAccount,\x20%s,\x20%s',_0x5281ee,_0x1abaf2['error'][_0x73fb('0x27')]);return _0xc22d79(_0x1abaf2[_0x73fb('0x26')][_0x73fb('0x27')]);}logger[_0x73fb('0x26')](_0x73fb('0x22'),_0x5281ee,_0x1abaf2['error'][_0x73fb('0x27')]);return _0x5b1da9(_0x1abaf2[_0x73fb('0x26')][_0x73fb('0x27')]);}else{logger[_0x73fb('0x28')](_0x73fb('0x22'),_0x5281ee,_0x73fb('0x23'));_0x5b1da9(_0x1abaf2[_0x73fb('0x29')][_0x73fb('0x27')]);}})[_0x73fb('0x2a')](function(_0x4c775c){logger[_0x73fb('0x26')](_0x73fb('0x22'),_0x5281ee,_0x4c775c);_0xc22d79(_0x4c775c);});});}function respondWithStatusCode(_0x2b3f77,_0xeffcc1){_0xeffcc1=_0xeffcc1||0xcc;return function(_0x32f246){if(_0x32f246){return _0x2b3f77[_0x73fb('0x2b')](_0xeffcc1);}return _0x2b3f77['status'](_0xeffcc1)[_0x73fb('0x2c')]();};}function respondWithResult(_0x5a0c26,_0x165f7d){_0x165f7d=_0x165f7d||0xc8;return function(_0x186103){if(_0x186103){return _0x5a0c26['status'](_0x165f7d)[_0x73fb('0x2d')](_0x186103);}};}function respondWithFilteredResult(_0x3fede6,_0x42298f){return function(_0x2b76ce){if(_0x2b76ce){var _0x4c6a78=_0x2b76ce['count'],_0x399ba4=_0x42298f[_0x73fb('0x2e')],_0x174651=_0x42298f[_0x73fb('0x2e')]+_0x42298f[_0x73fb('0x2f')],_0x4a67a8;if(_0x174651>=_0x4c6a78){_0x174651=_0x4c6a78;_0x4a67a8=0xc8;}else{_0x4a67a8=0xce;}_0x3fede6[_0x73fb('0x30')](_0x4a67a8);return _0x3fede6['set']('Content-Range',_0x399ba4+'-'+_0x174651+'/'+_0x4c6a78)[_0x73fb('0x2d')](_0x2b76ce);}return null;};}function patchUpdates(_0x5a59e8){return function(_0x1ccfdc){try{jsonpatch['apply'](_0x1ccfdc,_0x5a59e8,!![]);}catch(_0x8d01e3){return BPromise[_0x73fb('0x31')](_0x8d01e3);}return _0x1ccfdc[_0x73fb('0x32')]();};}function saveUpdates(_0x5a2e06,_0x2fa0f6){return function(_0x36404f){if(_0x36404f){return _0x36404f['update'](_0x5a2e06)[_0x73fb('0x21')](function(_0x1da4a9){return _0x1da4a9;});}return null;};}function removeEntity(_0x37ba53,_0x4c81ba){return function(_0x4c60c0){if(_0x4c60c0){return _0x4c60c0[_0x73fb('0x33')]()['then'](function(){_0x37ba53[_0x73fb('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x257b9d,_0x3924c6){return function(_0x46c0ee){if(!_0x46c0ee){_0x257b9d[_0x73fb('0x2b')](0x194);}return _0x46c0ee;};}function handleError(_0x45d95b,_0x28a4e0){_0x28a4e0=_0x28a4e0||0x1f4;return function(_0x38b5d0){logger[_0x73fb('0x26')](_0x38b5d0[_0x73fb('0x34')]);if(_0x38b5d0['name']){delete _0x38b5d0[_0x73fb('0x35')];}_0x45d95b[_0x73fb('0x30')](_0x28a4e0)[_0x73fb('0x36')](_0x38b5d0);};}exports[_0x73fb('0x37')]=function(_0x15f4bc,_0x122ffe){var _0x8589fd={},_0x4713e7={},_0x231d23={'count':0x0,'rows':[]};var _0x2c0b84=_[_0x73fb('0x38')](db[_0x73fb('0x39')]['rawAttributes'],function(_0xcb1759){return{'name':_0xcb1759[_0x73fb('0x3a')],'type':_0xcb1759[_0x73fb('0x3b')]['key']};});_0x4713e7['model']=_['map'](_0x2c0b84,_0x73fb('0x35'));_0x4713e7[_0x73fb('0x3c')]=_[_0x73fb('0x3d')](_0x15f4bc[_0x73fb('0x3c')]);_0x4713e7[_0x73fb('0x3e')]=_['intersection'](_0x4713e7[_0x73fb('0x3f')],_0x4713e7[_0x73fb('0x3c')]);_0x8589fd[_0x73fb('0x40')]=_[_0x73fb('0x41')](_0x4713e7[_0x73fb('0x3f')],qs[_0x73fb('0x42')](_0x15f4bc[_0x73fb('0x3c')]['fields']));_0x8589fd['attributes']=_0x8589fd[_0x73fb('0x40')][_0x73fb('0x43')]?_0x8589fd[_0x73fb('0x40')]:_0x4713e7[_0x73fb('0x3f')];if(!_0x15f4bc[_0x73fb('0x3c')][_0x73fb('0x44')](_0x73fb('0x45'))){_0x8589fd[_0x73fb('0x2f')]=qs['limit'](_0x15f4bc[_0x73fb('0x3c')]['limit']);_0x8589fd[_0x73fb('0x2e')]=qs[_0x73fb('0x2e')](_0x15f4bc[_0x73fb('0x3c')]['offset']);}_0x8589fd[_0x73fb('0x46')]=qs['sort'](_0x15f4bc[_0x73fb('0x3c')][_0x73fb('0x47')]);_0x8589fd[_0x73fb('0x48')]=qs['filters'](_[_0x73fb('0x49')](_0x15f4bc['query'],_0x4713e7[_0x73fb('0x3e')]),_0x2c0b84);if(_0x15f4bc[_0x73fb('0x3c')]['filter']){_0x8589fd[_0x73fb('0x48')]=_[_0x73fb('0x4a')](_0x8589fd['where'],{'$or':_[_0x73fb('0x38')](_0x2c0b84,function(_0x55a0a8){if(_0x55a0a8[_0x73fb('0x3b')]!==_0x73fb('0x4b')){var _0x5c82de={};_0x5c82de[_0x55a0a8[_0x73fb('0x35')]]={'$like':'%'+_0x15f4bc['query']['filter']+'%'};return _0x5c82de;}})});}_0x8589fd=_[_0x73fb('0x4a')]({},_0x8589fd,_0x15f4bc[_0x73fb('0x4c')]);var _0x9ec960={'where':_0x8589fd[_0x73fb('0x48')]};return db[_0x73fb('0x39')][_0x73fb('0x4d')](_0x9ec960)[_0x73fb('0x21')](function(_0x895eae){_0x231d23[_0x73fb('0x4d')]=_0x895eae;if(_0x15f4bc[_0x73fb('0x3c')][_0x73fb('0x4e')]){_0x8589fd[_0x73fb('0x4f')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x73fb('0x50')](_0x8589fd);})[_0x73fb('0x21')](function(_0x55da4e){_0x231d23['rows']=_0x55da4e;return _0x231d23;})[_0x73fb('0x21')](respondWithFilteredResult(_0x122ffe,_0x8589fd))[_0x73fb('0x2a')](handleError(_0x122ffe,null));};exports[_0x73fb('0x51')]=function(_0xcaf0a6,_0x277e46){var _0x117430={'raw':![],'where':{'id':_0xcaf0a6[_0x73fb('0x52')]['id']}},_0x98f51a={};_0x98f51a[_0x73fb('0x3f')]=_['keys'](db['SalesforceAccount'][_0x73fb('0x53')]);_0x98f51a[_0x73fb('0x3c')]=_['keys'](_0xcaf0a6[_0x73fb('0x3c')]);_0x98f51a[_0x73fb('0x3e')]=_[_0x73fb('0x41')](_0x98f51a[_0x73fb('0x3f')],_0x98f51a['query']);_0x117430['attributes']=_[_0x73fb('0x41')](_0x98f51a[_0x73fb('0x3f')],qs[_0x73fb('0x42')](_0xcaf0a6[_0x73fb('0x3c')]['fields']));_0x117430[_0x73fb('0x40')]=_0x117430[_0x73fb('0x40')]['length']?_0x117430[_0x73fb('0x40')]:_0x98f51a[_0x73fb('0x3f')];if(_0xcaf0a6[_0x73fb('0x3c')][_0x73fb('0x4e')]){_0x117430[_0x73fb('0x4f')]=[{'all':!![]}];}_0x117430=_[_0x73fb('0x4a')]({},_0x117430,_0xcaf0a6[_0x73fb('0x4c')]);return db[_0x73fb('0x39')]['find'](_0x117430)[_0x73fb('0x21')](handleEntityNotFound(_0x277e46,null))[_0x73fb('0x21')](respondWithResult(_0x277e46,null))[_0x73fb('0x2a')](handleError(_0x277e46,null));};exports[_0x73fb('0x54')]=function(_0xb6f3bc,_0x5c80e8){return db[_0x73fb('0x39')][_0x73fb('0x54')](_0xb6f3bc['body'],{})['then'](respondWithResult(_0x5c80e8,0xc9))[_0x73fb('0x2a')](handleError(_0x5c80e8,null));};exports['update']=function(_0x51f07b,_0xd0c22e){if(_0x51f07b[_0x73fb('0x55')]['id']){delete _0x51f07b[_0x73fb('0x55')]['id'];}return db[_0x73fb('0x39')]['find']({'where':{'id':_0x51f07b['params']['id']}})[_0x73fb('0x21')](handleEntityNotFound(_0xd0c22e,null))[_0x73fb('0x21')](saveUpdates(_0x51f07b[_0x73fb('0x55')],null))[_0x73fb('0x21')](respondWithResult(_0xd0c22e,null))[_0x73fb('0x2a')](handleError(_0xd0c22e,null));};exports[_0x73fb('0x33')]=function(_0x585052,_0x51a8c3){return db[_0x73fb('0x39')][_0x73fb('0x56')]({'where':{'id':_0x585052['params']['id']}})['then'](handleEntityNotFound(_0x51a8c3,null))[_0x73fb('0x21')](removeEntity(_0x51a8c3,null))[_0x73fb('0x2a')](handleError(_0x51a8c3,null));};exports[_0x73fb('0x57')]=function(_0x5d2620,_0x10b248,_0x9efca3){var _0x9b3d84={};var _0x722eff={};var _0x3efe6b;var _0x5be624;return db[_0x73fb('0x39')]['findOne']({'where':{'id':_0x5d2620['params']['id']}})[_0x73fb('0x21')](handleEntityNotFound(_0x10b248,null))[_0x73fb('0x21')](function(_0x4eca41){if(_0x4eca41){_0x3efe6b=_0x4eca41;_0x722eff[_0x73fb('0x3f')]=_[_0x73fb('0x3d')](db[_0x73fb('0x58')]['rawAttributes']);_0x722eff[_0x73fb('0x3c')]=_['keys'](_0x5d2620[_0x73fb('0x3c')]);_0x722eff[_0x73fb('0x3e')]=_['intersection'](_0x722eff['model'],_0x722eff[_0x73fb('0x3c')]);_0x9b3d84[_0x73fb('0x40')]=_[_0x73fb('0x41')](_0x722eff[_0x73fb('0x3f')],qs[_0x73fb('0x42')](_0x5d2620[_0x73fb('0x3c')][_0x73fb('0x42')]));_0x9b3d84[_0x73fb('0x40')]=_0x9b3d84[_0x73fb('0x40')][_0x73fb('0x43')]?_0x9b3d84[_0x73fb('0x40')]:_0x722eff['model'];_0x9b3d84[_0x73fb('0x46')]=qs[_0x73fb('0x47')](_0x5d2620['query']['sort']);_0x9b3d84['where']=qs['filters'](_[_0x73fb('0x49')](_0x5d2620['query'],_0x722eff[_0x73fb('0x3e')]));if(_0x5d2620['query'][_0x73fb('0x59')]){_0x9b3d84[_0x73fb('0x48')]=_['merge'](_0x9b3d84[_0x73fb('0x48')],{'$or':_[_0x73fb('0x38')](_0x9b3d84[_0x73fb('0x40')],function(_0x509e42){var _0x3a8b96={};_0x3a8b96[_0x509e42]={'$like':'%'+_0x5d2620['query'][_0x73fb('0x59')]+'%'};return _0x3a8b96;})});}_0x9b3d84=_[_0x73fb('0x4a')]({},_0x9b3d84,_0x5d2620['options']);return _0x3efe6b[_0x73fb('0x57')](_0x9b3d84);}})[_0x73fb('0x21')](function(_0x1e1fbb){if(_0x1e1fbb){_0x5be624=_0x1e1fbb[_0x73fb('0x43')];if(!_0x5d2620[_0x73fb('0x3c')][_0x73fb('0x44')](_0x73fb('0x45'))){_0x9b3d84[_0x73fb('0x2f')]=qs['limit'](_0x5d2620[_0x73fb('0x3c')][_0x73fb('0x2f')]);_0x9b3d84[_0x73fb('0x2e')]=qs['offset'](_0x5d2620['query'][_0x73fb('0x2e')]);}return _0x3efe6b[_0x73fb('0x57')](_0x9b3d84);}})['then'](function(_0x14dd4e){if(_0x14dd4e){return _0x14dd4e?{'count':_0x5be624,'rows':_0x14dd4e}:null;}})['then'](respondWithResult(_0x10b248,null))['catch'](handleError(_0x10b248,null));};exports[_0x73fb('0x5a')]=function(_0x3e5706,_0x4634bb,_0x17ed51){if(_0x3e5706[_0x73fb('0x55')]['id']){delete _0x3e5706[_0x73fb('0x55')]['id'];}return db[_0x73fb('0x39')][_0x73fb('0x5b')]({'where':{'id':_0x3e5706[_0x73fb('0x52')]['id']}})[_0x73fb('0x21')](handleEntityNotFound(_0x4634bb,null))['then'](function(_0x22d150){if(_0x22d150){_0x3e5706['body'][_0x73fb('0x5c')]=_0x22d150['id'];_0x3e5706[_0x73fb('0x55')]['Subjects']=integrations[_0x73fb('0x5d')](_0x3e5706['body'][_0x73fb('0x5e')],_0x3e5706[_0x73fb('0x55')][_0x73fb('0x3b')]);_0x3e5706[_0x73fb('0x55')][_0x73fb('0x5f')]=integrations[_0x73fb('0x60')](_0x3e5706[_0x73fb('0x55')][_0x73fb('0x5e')],_0x3e5706[_0x73fb('0x55')]['type']);return db[_0x73fb('0x58')][_0x73fb('0x54')](_0x3e5706['body'],{'include':[{'model':db[_0x73fb('0x61')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x73fb('0x5f')}]});}return null;})[_0x73fb('0x21')](respondWithResult(_0x4634bb,null))[_0x73fb('0x2a')](handleError(_0x4634bb,null));};exports[_0x73fb('0x62')]=function(_0x2d046b,_0x3ba0ec,_0x283655){var _0x589d2b;var _0x53e272='';var _0x1dbfba=_0x73fb('0x63');return db[_0x73fb('0x39')][_0x73fb('0x5b')]({'where':{'id':_0x2d046b[_0x73fb('0x52')]['id']},'attributes':['id',_0x73fb('0x64'),_0x73fb('0x65'),'clientSecret','username',_0x73fb('0x66'),_0x73fb('0x67')]})['then'](handleEntityNotFound(_0x3ba0ec,null))['then'](function(_0x440a53){if(_0x440a53){_0x53e272=_0x440a53[_0x73fb('0x64')];var _0x25accd=_0x53e272[_0x73fb('0x68')](-0x1);if(_0x25accd==='/'){_0x53e272=_0x53e272['substring'](0x0,_0x53e272[_0x73fb('0x69')](_0x25accd));}_0x589d2b=new jsforce['Connection']({'oauth2':{'loginUrl':_0x53e272,'clientId':_0x440a53['clientId'],'clientSecret':_0x440a53[_0x73fb('0x6a')]}});return _0x589d2b[_0x73fb('0x6b')](_0x440a53[_0x73fb('0x6c')],_0x440a53['password'][_0x73fb('0x6d')](_0x440a53[_0x73fb('0x67')]));}})['then'](function(_0x1299f6){if(_0x1299f6){if(!_[_0x73fb('0x6e')](_0x2d046b['query']['ticketType'])){_0x1dbfba=_0x2d046b[_0x73fb('0x3c')][_0x73fb('0x6f')];}return _0x589d2b[_0x73fb('0x70')](_0x1dbfba)[_0x73fb('0x71')]();}})[_0x73fb('0x21')](function(_0x36b251){var _0x210859=['CallDisposition',_0x73fb('0x72'),_0x73fb('0x73'),_0x73fb('0x74'),_0x73fb('0x75'),_0x73fb('0x76'),_0x73fb('0x77'),_0x73fb('0x78')];if(!_[_0x73fb('0x6e')](_0x2d046b[_0x73fb('0x3c')][_0x73fb('0x6f')])&&_0x2d046b[_0x73fb('0x3c')][_0x73fb('0x6f')]==='Case'){_0x210859=[_0x73fb('0x78'),_0x73fb('0x79'),'Reason',_0x73fb('0x77'),_0x73fb('0x76'),'IsEscalated',_0x73fb('0x7a'),_0x73fb('0x7b')];}if(_0x36b251){_[_0x73fb('0x7c')](_0x36b251['fields'],function(_0x445b98){return _0x445b98[_0x73fb('0x7d')]===![]&&!_0x210859[_0x73fb('0x7e')](_0x445b98['name']);});return{'count':_0x36b251[_0x73fb('0x42')][_0x73fb('0x43')],'rows':_[_0x73fb('0x38')](_0x36b251['fields'],function(_0x143655){return{'id':_0x143655[_0x73fb('0x35')],'name':_0x143655[_0x73fb('0x7f')],'custom':_0x143655[_0x73fb('0x7d')],'options':_0x143655[_0x73fb('0x80')][_0x73fb('0x43')]>0x0?_[_0x73fb('0x38')](_0x143655[_0x73fb('0x80')],function(_0x3e1bd4){return{'name':_0x3e1bd4[_0x73fb('0x7f')],'value':_0x3e1bd4[_0x73fb('0x81')]};}):_0x143655['type']==_0x73fb('0x82')?[{'name':_0x73fb('0x83'),'value':_0x73fb('0x84')},{'name':'False','value':_0x73fb('0x85')}]:[]};})};}})[_0x73fb('0x21')](respondWithResult(_0x3ba0ec,null))[_0x73fb('0x2a')](function(_0x550867){var _0x2dc1e2=_0x2d046b[_0x73fb('0x3c')][_0x73fb('0x1c')]?0x1f4:_0x550867['statusCode']||0x1f4;logger[_0x73fb('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2dc1e2,JSON['stringify'](_0x550867));delete _0x550867[_0x73fb('0x35')];if(_0x2dc1e2===0x191){_0x2dc1e2=0x190;}_0x3ba0ec['status'](_0x2dc1e2)[_0x73fb('0x36')](_0x2d046b[_0x73fb('0x3c')]['test']?{'message':_0x73fb('0x86'),'statusCode':_0x550867['statusCode']}:_0x550867);});}; \ No newline at end of file +var _0xb04f=['querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','json','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','findOne','SalesforceConfiguration','options','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','lastIndexOf','Connection','login','concat','securityToken','ticketType','sobject','describe','CallDisposition','CallObject','CallType','IsArchived','Priority','Status','Type','Case','Reason','IsEscalated','SuppliedName','custom','includes','picklistValues','label','value','boolean','true','false','statusCode','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x26c153,_0x137fa6){var _0x502158=function(_0x1791d8){while(--_0x1791d8){_0x26c153['push'](_0x26c153['shift']());}};_0x502158(++_0x137fa6);}(_0xb04f,0x17a));var _0xfb04=function(_0x490807,_0x499506){_0x490807=_0x490807-0x0;var _0xc4f0c1=_0xb04f[_0x490807];return _0xc4f0c1;};'use strict';var pdf=require(_0xfb04('0x0'));var emlformat=require(_0xfb04('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfb04('0x2'));var jsonpatch=require(_0xfb04('0x3'));var rp=require('request-promise');var moment=require(_0xfb04('0x4'));var BPromise=require(_0xfb04('0x5'));var Mustache=require(_0xfb04('0x6'));var util=require(_0xfb04('0x7'));var path=require(_0xfb04('0x8'));var sox=require(_0xfb04('0x9'));var csv=require(_0xfb04('0xa'));var ejs=require(_0xfb04('0xb'));var fs=require('fs');var _=require(_0xfb04('0xc'));var squel=require(_0xfb04('0xd'));var crypto=require('crypto');var jsforce=require(_0xfb04('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfb04('0xf'));var Papa=require(_0xfb04('0x10'));var Redis=require('ioredis');var authService=require(_0xfb04('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb04('0x12'));var logger=require(_0xfb04('0x13'))('api');var utils=require(_0xfb04('0x14'));var config=require(_0xfb04('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfb04('0x16'));var jayson=require(_0xfb04('0x17'));var client=jayson[_0xfb04('0x18')][_0xfb04('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5dbfdb,_0x4f98fd,_0x420b3){if(_0x420b3){var _0x215080=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x215080[_0xfb04('0x1a')](_0x4f98fd)){return _0x5dbfdb;}else{throw new db['Sequelize'][(_0xfb04('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 _0x5dbfdb;}}function respondWithRpcPromise(_0x306a8f,_0x3c3919,_0x1fbe8f,_0x2180bb){return new BPromise(function(_0xe941d9,_0x235a46){var _0xbe6b98=_0x2180bb||client;return _0xbe6b98[_0xfb04('0x1c')](_0x306a8f,_0x1fbe8f)[_0xfb04('0x1d')](function(_0x4c0768){logger[_0xfb04('0x1e')](_0xfb04('0x1f'),_0x3c3919,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x3c3919,_0xfb04('0x20'),JSON[_0xfb04('0x21')](_0x4c0768));if(_0x4c0768['error']){if(_0x4c0768[_0xfb04('0x22')]['code']===0x1f4){logger['error'](_0xfb04('0x1f'),_0x3c3919,_0x4c0768[_0xfb04('0x22')][_0xfb04('0x23')]);return _0x235a46(_0x4c0768['error']['message']);}logger['error'](_0xfb04('0x1f'),_0x3c3919,_0x4c0768['error'][_0xfb04('0x23')]);return _0xe941d9(_0x4c0768[_0xfb04('0x22')][_0xfb04('0x23')]);}else{logger[_0xfb04('0x1e')](_0xfb04('0x1f'),_0x3c3919,'request\x20sent');_0xe941d9(_0x4c0768[_0xfb04('0x24')]['message']);}})['catch'](function(_0x4cf0d5){logger[_0xfb04('0x22')](_0xfb04('0x1f'),_0x3c3919,_0x4cf0d5);_0x235a46(_0x4cf0d5);});});}function respondWithStatusCode(_0x48caec,_0x1259d1){_0x1259d1=_0x1259d1||0xcc;return function(_0x6dee86){if(_0x6dee86){return _0x48caec[_0xfb04('0x25')](_0x1259d1);}return _0x48caec['status'](_0x1259d1)['end']();};}function respondWithResult(_0x1b117b,_0x3b837b){_0x3b837b=_0x3b837b||0xc8;return function(_0xad9c00){if(_0xad9c00){return _0x1b117b['status'](_0x3b837b)[_0xfb04('0x26')](_0xad9c00);}};}function respondWithFilteredResult(_0x2d4a4d,_0x265720){return function(_0x599898){if(_0x599898){var _0x14c9d0=_0x599898[_0xfb04('0x27')],_0x398ad8=_0x265720['offset'],_0x415cd6=_0x265720[_0xfb04('0x28')]+_0x265720['limit'],_0x4f1507;if(_0x415cd6>=_0x14c9d0){_0x415cd6=_0x14c9d0;_0x4f1507=0xc8;}else{_0x4f1507=0xce;}_0x2d4a4d[_0xfb04('0x29')](_0x4f1507);return _0x2d4a4d[_0xfb04('0x2a')](_0xfb04('0x2b'),_0x398ad8+'-'+_0x415cd6+'/'+_0x14c9d0)[_0xfb04('0x26')](_0x599898);}return null;};}function patchUpdates(_0x30a29c){return function(_0x1c5dcf){try{jsonpatch[_0xfb04('0x2c')](_0x1c5dcf,_0x30a29c,!![]);}catch(_0x2393ae){return BPromise[_0xfb04('0x2d')](_0x2393ae);}return _0x1c5dcf[_0xfb04('0x2e')]();};}function saveUpdates(_0x2648d7,_0x51cec0){return function(_0x31a5ba){if(_0x31a5ba){return _0x31a5ba[_0xfb04('0x2f')](_0x2648d7)[_0xfb04('0x1d')](function(_0x1211dd){return _0x1211dd;});}return null;};}function removeEntity(_0x6c5dc7,_0x4ea350){return function(_0x4b58f8){if(_0x4b58f8){return _0x4b58f8[_0xfb04('0x30')]()[_0xfb04('0x1d')](function(){_0x6c5dc7[_0xfb04('0x29')](0xcc)[_0xfb04('0x31')]();});}};}function handleEntityNotFound(_0x5a889,_0x173f18){return function(_0x527f15){if(!_0x527f15){_0x5a889[_0xfb04('0x25')](0x194);}return _0x527f15;};}function handleError(_0x1a6c36,_0x423ae1){_0x423ae1=_0x423ae1||0x1f4;return function(_0x46ac86){logger[_0xfb04('0x22')](_0x46ac86[_0xfb04('0x32')]);if(_0x46ac86[_0xfb04('0x33')]){delete _0x46ac86[_0xfb04('0x33')];}_0x1a6c36[_0xfb04('0x29')](_0x423ae1)[_0xfb04('0x34')](_0x46ac86);};}exports[_0xfb04('0x35')]=function(_0x4ed888,_0x2f078d){var _0x3f4950={},_0x493ed2={},_0x2173e3={'count':0x0,'rows':[]};var _0x5f53b8=_[_0xfb04('0x36')](db[_0xfb04('0x37')]['rawAttributes'],function(_0xe6cf66){return{'name':_0xe6cf66[_0xfb04('0x38')],'type':_0xe6cf66[_0xfb04('0x39')][_0xfb04('0x3a')]};});_0x493ed2[_0xfb04('0x3b')]=_['map'](_0x5f53b8,_0xfb04('0x33'));_0x493ed2[_0xfb04('0x3c')]=_[_0xfb04('0x3d')](_0x4ed888[_0xfb04('0x3c')]);_0x493ed2[_0xfb04('0x3e')]=_['intersection'](_0x493ed2[_0xfb04('0x3b')],_0x493ed2[_0xfb04('0x3c')]);_0x3f4950[_0xfb04('0x3f')]=_[_0xfb04('0x40')](_0x493ed2[_0xfb04('0x3b')],qs[_0xfb04('0x41')](_0x4ed888[_0xfb04('0x3c')][_0xfb04('0x41')]));_0x3f4950[_0xfb04('0x3f')]=_0x3f4950[_0xfb04('0x3f')][_0xfb04('0x42')]?_0x3f4950[_0xfb04('0x3f')]:_0x493ed2[_0xfb04('0x3b')];if(!_0x4ed888[_0xfb04('0x3c')]['hasOwnProperty']('nolimit')){_0x3f4950['limit']=qs[_0xfb04('0x43')](_0x4ed888[_0xfb04('0x3c')]['limit']);_0x3f4950[_0xfb04('0x28')]=qs[_0xfb04('0x28')](_0x4ed888[_0xfb04('0x3c')]['offset']);}_0x3f4950[_0xfb04('0x44')]=qs[_0xfb04('0x45')](_0x4ed888[_0xfb04('0x3c')][_0xfb04('0x45')]);_0x3f4950[_0xfb04('0x46')]=qs[_0xfb04('0x3e')](_[_0xfb04('0x47')](_0x4ed888[_0xfb04('0x3c')],_0x493ed2[_0xfb04('0x3e')]),_0x5f53b8);if(_0x4ed888[_0xfb04('0x3c')][_0xfb04('0x48')]){_0x3f4950[_0xfb04('0x46')]=_[_0xfb04('0x49')](_0x3f4950[_0xfb04('0x46')],{'$or':_[_0xfb04('0x36')](_0x5f53b8,function(_0xd9e0d3){if(_0xd9e0d3[_0xfb04('0x39')]!=='VIRTUAL'){var _0xf8ba50={};_0xf8ba50[_0xd9e0d3[_0xfb04('0x33')]]={'$like':'%'+_0x4ed888[_0xfb04('0x3c')][_0xfb04('0x48')]+'%'};return _0xf8ba50;}})});}_0x3f4950=_['merge']({},_0x3f4950,_0x4ed888['options']);var _0x5d64b6={'where':_0x3f4950[_0xfb04('0x46')]};return db[_0xfb04('0x37')]['count'](_0x5d64b6)['then'](function(_0x535e9e){_0x2173e3[_0xfb04('0x27')]=_0x535e9e;if(_0x4ed888[_0xfb04('0x3c')][_0xfb04('0x4a')]){_0x3f4950[_0xfb04('0x4b')]=[{'all':!![]}];}return db[_0xfb04('0x37')][_0xfb04('0x4c')](_0x3f4950);})[_0xfb04('0x1d')](function(_0x541cce){_0x2173e3['rows']=_0x541cce;return _0x2173e3;})[_0xfb04('0x1d')](respondWithFilteredResult(_0x2f078d,_0x3f4950))[_0xfb04('0x4d')](handleError(_0x2f078d,null));};exports[_0xfb04('0x4e')]=function(_0x1e7ca8,_0x70947c){var _0x424ee0={'raw':![],'where':{'id':_0x1e7ca8[_0xfb04('0x4f')]['id']}},_0x1cd336={};_0x1cd336['model']=_[_0xfb04('0x3d')](db[_0xfb04('0x37')][_0xfb04('0x50')]);_0x1cd336['query']=_[_0xfb04('0x3d')](_0x1e7ca8[_0xfb04('0x3c')]);_0x1cd336['filters']=_[_0xfb04('0x40')](_0x1cd336['model'],_0x1cd336[_0xfb04('0x3c')]);_0x424ee0[_0xfb04('0x3f')]=_[_0xfb04('0x40')](_0x1cd336[_0xfb04('0x3b')],qs[_0xfb04('0x41')](_0x1e7ca8['query'][_0xfb04('0x41')]));_0x424ee0[_0xfb04('0x3f')]=_0x424ee0[_0xfb04('0x3f')]['length']?_0x424ee0[_0xfb04('0x3f')]:_0x1cd336[_0xfb04('0x3b')];if(_0x1e7ca8[_0xfb04('0x3c')]['includeAll']){_0x424ee0[_0xfb04('0x4b')]=[{'all':!![]}];}_0x424ee0=_[_0xfb04('0x49')]({},_0x424ee0,_0x1e7ca8['options']);return db['SalesforceAccount'][_0xfb04('0x51')](_0x424ee0)['then'](handleEntityNotFound(_0x70947c,null))[_0xfb04('0x1d')](respondWithResult(_0x70947c,null))['catch'](handleError(_0x70947c,null));};exports[_0xfb04('0x52')]=function(_0x3eb837,_0x124d13){return db['SalesforceAccount'][_0xfb04('0x52')](_0x3eb837[_0xfb04('0x53')],{})[_0xfb04('0x1d')](respondWithResult(_0x124d13,0xc9))[_0xfb04('0x4d')](handleError(_0x124d13,null));};exports['update']=function(_0x432ef6,_0x232eba){if(_0x432ef6[_0xfb04('0x53')]['id']){delete _0x432ef6['body']['id'];}return db['SalesforceAccount'][_0xfb04('0x51')]({'where':{'id':_0x432ef6[_0xfb04('0x4f')]['id']}})[_0xfb04('0x1d')](handleEntityNotFound(_0x232eba,null))[_0xfb04('0x1d')](saveUpdates(_0x432ef6['body'],null))[_0xfb04('0x1d')](respondWithResult(_0x232eba,null))['catch'](handleError(_0x232eba,null));};exports[_0xfb04('0x30')]=function(_0x22f896,_0x1eeed3){return db[_0xfb04('0x37')][_0xfb04('0x51')]({'where':{'id':_0x22f896[_0xfb04('0x4f')]['id']}})[_0xfb04('0x1d')](handleEntityNotFound(_0x1eeed3,null))['then'](removeEntity(_0x1eeed3,null))[_0xfb04('0x4d')](handleError(_0x1eeed3,null));};exports['getConfigurations']=function(_0x36df98,_0x215d85,_0x449e4b){var _0x4a9869={};var _0x1bf84a={};var _0x47a075;var _0x2bf3f4;return db[_0xfb04('0x37')][_0xfb04('0x54')]({'where':{'id':_0x36df98['params']['id']}})[_0xfb04('0x1d')](handleEntityNotFound(_0x215d85,null))[_0xfb04('0x1d')](function(_0x3b5cb4){if(_0x3b5cb4){_0x47a075=_0x3b5cb4;_0x1bf84a[_0xfb04('0x3b')]=_['keys'](db[_0xfb04('0x55')][_0xfb04('0x50')]);_0x1bf84a[_0xfb04('0x3c')]=_[_0xfb04('0x3d')](_0x36df98[_0xfb04('0x3c')]);_0x1bf84a['filters']=_[_0xfb04('0x40')](_0x1bf84a['model'],_0x1bf84a[_0xfb04('0x3c')]);_0x4a9869[_0xfb04('0x3f')]=_[_0xfb04('0x40')](_0x1bf84a['model'],qs[_0xfb04('0x41')](_0x36df98[_0xfb04('0x3c')][_0xfb04('0x41')]));_0x4a9869[_0xfb04('0x3f')]=_0x4a9869[_0xfb04('0x3f')][_0xfb04('0x42')]?_0x4a9869[_0xfb04('0x3f')]:_0x1bf84a['model'];_0x4a9869[_0xfb04('0x44')]=qs[_0xfb04('0x45')](_0x36df98[_0xfb04('0x3c')][_0xfb04('0x45')]);_0x4a9869['where']=qs[_0xfb04('0x3e')](_[_0xfb04('0x47')](_0x36df98['query'],_0x1bf84a[_0xfb04('0x3e')]));if(_0x36df98[_0xfb04('0x3c')][_0xfb04('0x48')]){_0x4a9869[_0xfb04('0x46')]=_['merge'](_0x4a9869[_0xfb04('0x46')],{'$or':_['map'](_0x4a9869[_0xfb04('0x3f')],function(_0x134133){var _0x483634={};_0x483634[_0x134133]={'$like':'%'+_0x36df98[_0xfb04('0x3c')][_0xfb04('0x48')]+'%'};return _0x483634;})});}_0x4a9869=_['merge']({},_0x4a9869,_0x36df98[_0xfb04('0x56')]);return _0x47a075[_0xfb04('0x57')](_0x4a9869);}})['then'](function(_0x1e2fb2){if(_0x1e2fb2){_0x2bf3f4=_0x1e2fb2[_0xfb04('0x42')];if(!_0x36df98[_0xfb04('0x3c')]['hasOwnProperty'](_0xfb04('0x58'))){_0x4a9869['limit']=qs[_0xfb04('0x43')](_0x36df98[_0xfb04('0x3c')][_0xfb04('0x43')]);_0x4a9869[_0xfb04('0x28')]=qs[_0xfb04('0x28')](_0x36df98[_0xfb04('0x3c')]['offset']);}return _0x47a075[_0xfb04('0x57')](_0x4a9869);}})['then'](function(_0x45f1bf){if(_0x45f1bf){return _0x45f1bf?{'count':_0x2bf3f4,'rows':_0x45f1bf}:null;}})['then'](respondWithResult(_0x215d85,null))[_0xfb04('0x4d')](handleError(_0x215d85,null));};exports[_0xfb04('0x59')]=function(_0x54e92f,_0x276192,_0x3d28b6){if(_0x54e92f[_0xfb04('0x53')]['id']){delete _0x54e92f[_0xfb04('0x53')]['id'];}return db[_0xfb04('0x37')][_0xfb04('0x54')]({'where':{'id':_0x54e92f['params']['id']}})[_0xfb04('0x1d')](handleEntityNotFound(_0x276192,null))['then'](function(_0xd860a){if(_0xd860a){_0x54e92f[_0xfb04('0x53')][_0xfb04('0x5a')]=_0xd860a['id'];_0x54e92f[_0xfb04('0x53')][_0xfb04('0x5b')]=integrations[_0xfb04('0x5c')](_0x54e92f[_0xfb04('0x53')]['channel'],_0x54e92f[_0xfb04('0x53')]['type']);_0x54e92f[_0xfb04('0x53')]['Descriptions']=integrations['getDescriptions'](_0x54e92f[_0xfb04('0x53')][_0xfb04('0x5d')],_0x54e92f['body'][_0xfb04('0x39')]);return db['SalesforceConfiguration'][_0xfb04('0x52')](_0x54e92f['body'],{'include':[{'model':db[_0xfb04('0x5e')],'as':_0xfb04('0x5b')},{'model':db[_0xfb04('0x5e')],'as':'Descriptions'}]});}return null;})[_0xfb04('0x1d')](respondWithResult(_0x276192,null))['catch'](handleError(_0x276192,null));};exports[_0xfb04('0x5f')]=function(_0x2f00a4,_0x28bc4b,_0x427dc2){var _0x459d53;var _0x252cb1='';var _0x6d93da=_0xfb04('0x60');return db[_0xfb04('0x37')][_0xfb04('0x54')]({'where':{'id':_0x2f00a4[_0xfb04('0x4f')]['id']},'attributes':['id',_0xfb04('0x61'),_0xfb04('0x62'),_0xfb04('0x63'),_0xfb04('0x64'),_0xfb04('0x65'),'securityToken']})[_0xfb04('0x1d')](handleEntityNotFound(_0x28bc4b,null))[_0xfb04('0x1d')](function(_0x449fe2){if(_0x449fe2){_0x252cb1=_0x449fe2[_0xfb04('0x61')];var _0x41f4b6=_0x252cb1[_0xfb04('0x66')](-0x1);if(_0x41f4b6==='/'){_0x252cb1=_0x252cb1['substring'](0x0,_0x252cb1[_0xfb04('0x67')](_0x41f4b6));}_0x459d53=new jsforce[(_0xfb04('0x68'))]({'oauth2':{'loginUrl':_0x252cb1,'clientId':_0x449fe2[_0xfb04('0x62')],'clientSecret':_0x449fe2[_0xfb04('0x63')]}});return _0x459d53[_0xfb04('0x69')](_0x449fe2[_0xfb04('0x64')],_0x449fe2[_0xfb04('0x65')][_0xfb04('0x6a')](_0x449fe2[_0xfb04('0x6b')]));}})['then'](function(_0x25f3d6){if(_0x25f3d6){if(!_['isNil'](_0x2f00a4[_0xfb04('0x3c')]['ticketType'])){_0x6d93da=_0x2f00a4[_0xfb04('0x3c')][_0xfb04('0x6c')];}return _0x459d53[_0xfb04('0x6d')](_0x6d93da)[_0xfb04('0x6e')]();}})[_0xfb04('0x1d')](function(_0x3d5687){var _0x4138a8=[_0xfb04('0x6f'),'CallDurationInSeconds',_0xfb04('0x70'),_0xfb04('0x71'),_0xfb04('0x72'),_0xfb04('0x73'),_0xfb04('0x74'),_0xfb04('0x75')];if(!_['isNil'](_0x2f00a4[_0xfb04('0x3c')][_0xfb04('0x6c')])&&_0x2f00a4[_0xfb04('0x3c')][_0xfb04('0x6c')]===_0xfb04('0x76')){_0x4138a8=[_0xfb04('0x75'),'Origin',_0xfb04('0x77'),_0xfb04('0x74'),_0xfb04('0x73'),_0xfb04('0x78'),_0xfb04('0x79'),'SuppliedCompany'];}if(_0x3d5687){_['remove'](_0x3d5687[_0xfb04('0x41')],function(_0xc8da1b){return _0xc8da1b[_0xfb04('0x7a')]===![]&&!_0x4138a8[_0xfb04('0x7b')](_0xc8da1b[_0xfb04('0x33')]);});return{'count':_0x3d5687['fields'][_0xfb04('0x42')],'rows':_[_0xfb04('0x36')](_0x3d5687[_0xfb04('0x41')],function(_0x180599){return{'id':_0x180599[_0xfb04('0x33')],'name':_0x180599['label'],'custom':_0x180599['custom'],'options':_0x180599[_0xfb04('0x7c')][_0xfb04('0x42')]>0x0?_['map'](_0x180599[_0xfb04('0x7c')],function(_0x368bd6){return{'name':_0x368bd6[_0xfb04('0x7d')],'value':_0x368bd6[_0xfb04('0x7e')]};}):_0x180599['type']==_0xfb04('0x7f')?[{'name':'True','value':_0xfb04('0x80')},{'name':'False','value':_0xfb04('0x81')}]:[]};})};}})[_0xfb04('0x1d')](respondWithResult(_0x28bc4b,null))[_0xfb04('0x4d')](function(_0x145fde){var _0x22299b=_0x2f00a4[_0xfb04('0x3c')][_0xfb04('0x1a')]?0x1f4:_0x145fde[_0xfb04('0x82')]||0x1f4;logger[_0xfb04('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0xfb04('0x5f'),_0x22299b,JSON[_0xfb04('0x21')](_0x145fde));delete _0x145fde[_0xfb04('0x33')];if(_0x22299b===0x191){_0x22299b=0x190;}_0x28bc4b[_0xfb04('0x29')](_0x22299b)[_0xfb04('0x34')](_0x2f00a4[_0xfb04('0x3c')][_0xfb04('0x1a')]?{'message':'Wrong\x20credentials','statusCode':_0x145fde[_0xfb04('0x82')]}:_0x145fde);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 9c2b54b..b346d32 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 _0xe34a=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x13ccf2,_0x52fbde){var _0x3346b7=function(_0x2b4431){while(--_0x2b4431){_0x13ccf2['push'](_0x13ccf2['shift']());}};_0x3346b7(++_0x52fbde);}(_0xe34a,0x1ee));var _0xae34=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0xe34a[_0x43b584];return _0x48f27b;};'use strict';var _=require(_0xae34('0x0'));var util=require('util');var logger=require(_0xae34('0x1'))('api');var moment=require(_0xae34('0x2'));var BPromise=require(_0xae34('0x3'));var rp=require(_0xae34('0x4'));var fs=require('fs');var path=require(_0xae34('0x5'));var rimraf=require(_0xae34('0x6'));var config=require('../../config/environment');var attributes=require(_0xae34('0x7'));var integrations=require(_0xae34('0x8'));module[_0xae34('0x9')]=function(_0x56b7e5,_0x8c41bb){return _0x56b7e5[_0xae34('0xa')](_0xae34('0xb'),attributes,{'tableName':_0xae34('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1b8=['../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x53d35c,_0xeb12a9){var _0xcafe36=function(_0x4968e4){while(--_0x4968e4){_0x53d35c['push'](_0x53d35c['shift']());}};_0xcafe36(++_0xeb12a9);}(_0xd1b8,0x108));var _0x8d1b=function(_0x9b3efc,_0x577a0d){_0x9b3efc=_0x9b3efc-0x0;var _0x200f05=_0xd1b8[_0x9b3efc];return _0x200f05;};'use strict';var _=require(_0x8d1b('0x0'));var util=require(_0x8d1b('0x1'));var logger=require(_0x8d1b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8d1b('0x3'));var rp=require(_0x8d1b('0x4'));var fs=require('fs');var path=require(_0x8d1b('0x5'));var rimraf=require(_0x8d1b('0x6'));var config=require(_0x8d1b('0x7'));var attributes=require(_0x8d1b('0x8'));var integrations=require(_0x8d1b('0x9'));module[_0x8d1b('0xa')]=function(_0x56e517,_0x1b3fa3){return _0x56e517['define'](_0x8d1b('0xb'),attributes,{'tableName':_0x8d1b('0xc'),'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 3214287..fd13158 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 _0x9c44=['http','request','then','request\x20sent','debug','stringify','code','error','message','SalesforceAccount,\x20%s,\x20%s','info','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','include','model','map','ShowSalesforceAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0xfdffef,_0x202973){var _0x4ad048=function(_0x227cac){while(--_0x227cac){_0xfdffef['push'](_0xfdffef['shift']());}};_0x4ad048(++_0x202973);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});}exports[_0x49c4('0x15')]=function(_0x4c3253){var _0x512650=this;return new Promise(function(_0x3c782d,_0x2f82d5){return db[_0x49c4('0x16')]['findAll']({'raw':_0x4c3253[_0x49c4('0x17')]?_0x4c3253['options'][_0x49c4('0x18')]===undefined?!![]:![]:!![],'where':_0x4c3253[_0x49c4('0x17')]?_0x4c3253[_0x49c4('0x17')][_0x49c4('0x19')]||null:null,'attributes':_0x4c3253[_0x49c4('0x17')]?_0x4c3253[_0x49c4('0x17')][_0x49c4('0x1a')]||null:null,'limit':_0x4c3253[_0x49c4('0x17')]?_0x4c3253[_0x49c4('0x17')]['limit']||null:null,'include':_0x4c3253['options']?_0x4c3253['options'][_0x49c4('0x1b')]?_['map'](_0x4c3253['options'][_0x49c4('0x1b')],function(_0x15581b){return{'model':db[_0x15581b[_0x49c4('0x1c')]],'as':_0x15581b['as'],'attributes':_0x15581b[_0x49c4('0x1a')],'include':_0x15581b['include']?_['map'](_0x15581b[_0x49c4('0x1b')],function(_0x9cb797){return{'model':db[_0x9cb797['model']],'as':_0x9cb797['as'],'attributes':_0x9cb797[_0x49c4('0x1a')],'include':_0x9cb797[_0x49c4('0x1b')]?_[_0x49c4('0x1d')](_0x9cb797[_0x49c4('0x1b')],function(_0x531d92){return{'model':db[_0x531d92['model']],'as':_0x531d92['as'],'attributes':_0x531d92[_0x49c4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3800b7){logger[_0x49c4('0x12')](_0x49c4('0x15'),_0x4c3253);logger[_0x49c4('0xc')]('GetSalesforceAccount',_0x4c3253,JSON[_0x49c4('0xd')](_0x3800b7));_0x3c782d(_0x3800b7);})[_0x49c4('0x14')](function(_0x46e04d){logger[_0x49c4('0xf')](_0x49c4('0x15'),_0x46e04d[_0x49c4('0x10')],_0x4c3253);_0x2f82d5(_0x512650[_0x49c4('0xf')](0x1f4,_0x46e04d[_0x49c4('0x10')]));});});};exports[_0x49c4('0x1e')]=function(_0x2cbd88){var _0x46f7ea=this;return new Promise(function(_0x4ea6ea,_0x4f4495){return db['SalesforceAccount'][_0x49c4('0x1f')]({'raw':_0x2cbd88[_0x49c4('0x17')]?_0x2cbd88[_0x49c4('0x17')][_0x49c4('0x18')]===undefined?!![]:![]:!![],'where':_0x2cbd88[_0x49c4('0x17')]?_0x2cbd88['options'][_0x49c4('0x19')]||null:null,'attributes':_0x2cbd88[_0x49c4('0x17')]?_0x2cbd88[_0x49c4('0x17')][_0x49c4('0x1a')]||null:null,'include':_0x2cbd88['options']?_0x2cbd88['options'][_0x49c4('0x1b')]?_[_0x49c4('0x1d')](_0x2cbd88[_0x49c4('0x17')][_0x49c4('0x1b')],function(_0xd38540){return{'model':db[_0xd38540['model']],'as':_0xd38540['as'],'attributes':_0xd38540[_0x49c4('0x1a')],'include':_0xd38540[_0x49c4('0x1b')]?_[_0x49c4('0x1d')](_0xd38540['include'],function(_0x5ba924){return{'model':db[_0x5ba924[_0x49c4('0x1c')]],'as':_0x5ba924['as'],'attributes':_0x5ba924[_0x49c4('0x1a')],'include':_0x5ba924[_0x49c4('0x1b')]?_[_0x49c4('0x1d')](_0x5ba924[_0x49c4('0x1b')],function(_0x2cf897){return{'model':db[_0x2cf897[_0x49c4('0x1c')]],'as':_0x2cf897['as'],'attributes':_0x2cf897[_0x49c4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x49c4('0xa')](function(_0x4e0209){logger[_0x49c4('0x12')]('ShowSalesforceAccount',_0x2cbd88);logger[_0x49c4('0xc')](_0x49c4('0x1e'),_0x2cbd88,JSON[_0x49c4('0xd')](_0x4e0209));_0x4ea6ea(_0x4e0209);})[_0x49c4('0x14')](function(_0x4ed4f8){logger[_0x49c4('0xf')](_0x49c4('0x1e'),_0x4ed4f8[_0x49c4('0x10')],_0x2cbd88);_0x4f4495(_0x46f7ea['error'](0x1f4,_0x4ed4f8[_0x49c4('0x10')]));});});}; \ No newline at end of file +var _0x1cc7=['map','model','debug','find','ShowSalesforceAccount','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','client','then','info','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','raw','options','where','attributes','limit','include'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0x1cc7,0x15a));var _0x71cc=function(_0x15b07c,_0x1be214){_0x15b07c=_0x15b07c-0x0;var _0x43ac28=_0x1cc7[_0x15b07c];return _0x43ac28;};'use strict';var _=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var moment=require(_0x71cc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71cc('0x3'))['db'];var utils=require(_0x71cc('0x4'));var logger=require(_0x71cc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71cc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc0444e,_0x41a004,_0x4039ce){return new BPromise(function(_0x2e70f0,_0x2b788c){return client['request'](_0xc0444e,_0x4039ce)[_0x71cc('0x7')](function(_0x322df2){logger[_0x71cc('0x8')]('SalesforceAccount,\x20%s,\x20%s',_0x41a004,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x41a004,_0x71cc('0x9'),JSON[_0x71cc('0xa')](_0x322df2));if(_0x322df2[_0x71cc('0xb')]){if(_0x322df2['error'][_0x71cc('0xc')]===0x1f4){logger['error'](_0x71cc('0xd'),_0x41a004,_0x322df2['error'][_0x71cc('0xe')]);return _0x2b788c(_0x322df2['error'][_0x71cc('0xe')]);}logger[_0x71cc('0xb')](_0x71cc('0xd'),_0x41a004,_0x322df2[_0x71cc('0xb')][_0x71cc('0xe')]);return _0x2e70f0(_0x322df2['error'][_0x71cc('0xe')]);}else{logger[_0x71cc('0x8')](_0x71cc('0xd'),_0x41a004,_0x71cc('0x9'));_0x2e70f0(_0x322df2[_0x71cc('0xf')][_0x71cc('0xe')]);}})[_0x71cc('0x10')](function(_0x5eae5b){logger[_0x71cc('0xb')](_0x71cc('0xd'),_0x41a004,_0x5eae5b);_0x2b788c(_0x5eae5b);});});}exports[_0x71cc('0x11')]=function(_0x1d1da8){var _0x1067be=this;return new Promise(function(_0x10da0a,_0x4c5c6d){return db[_0x71cc('0x12')][_0x71cc('0x13')]({'raw':_0x1d1da8['options']?_0x1d1da8['options'][_0x71cc('0x14')]===undefined?!![]:![]:!![],'where':_0x1d1da8[_0x71cc('0x15')]?_0x1d1da8[_0x71cc('0x15')][_0x71cc('0x16')]||null:null,'attributes':_0x1d1da8[_0x71cc('0x15')]?_0x1d1da8[_0x71cc('0x15')][_0x71cc('0x17')]||null:null,'limit':_0x1d1da8[_0x71cc('0x15')]?_0x1d1da8['options'][_0x71cc('0x18')]||null:null,'include':_0x1d1da8[_0x71cc('0x15')]?_0x1d1da8['options'][_0x71cc('0x19')]?_[_0x71cc('0x1a')](_0x1d1da8[_0x71cc('0x15')][_0x71cc('0x19')],function(_0x1bc67c){return{'model':db[_0x1bc67c[_0x71cc('0x1b')]],'as':_0x1bc67c['as'],'attributes':_0x1bc67c['attributes'],'include':_0x1bc67c[_0x71cc('0x19')]?_[_0x71cc('0x1a')](_0x1bc67c[_0x71cc('0x19')],function(_0x180cd2){return{'model':db[_0x180cd2[_0x71cc('0x1b')]],'as':_0x180cd2['as'],'attributes':_0x180cd2[_0x71cc('0x17')],'include':_0x180cd2[_0x71cc('0x19')]?_[_0x71cc('0x1a')](_0x180cd2[_0x71cc('0x19')],function(_0x4d4529){return{'model':db[_0x4d4529[_0x71cc('0x1b')]],'as':_0x4d4529['as'],'attributes':_0x4d4529[_0x71cc('0x17')]};}):[]};}):[]};}):[]:[]})[_0x71cc('0x7')](function(_0x26becf){logger[_0x71cc('0x8')](_0x71cc('0x11'),_0x1d1da8);logger[_0x71cc('0x1c')](_0x71cc('0x11'),_0x1d1da8,JSON[_0x71cc('0xa')](_0x26becf));_0x10da0a(_0x26becf);})[_0x71cc('0x10')](function(_0x30f94d){logger[_0x71cc('0xb')](_0x71cc('0x11'),_0x30f94d[_0x71cc('0xe')],_0x1d1da8);_0x4c5c6d(_0x1067be[_0x71cc('0xb')](0x1f4,_0x30f94d[_0x71cc('0xe')]));});});};exports['ShowSalesforceAccount']=function(_0x3054ff){var _0x3b7451=this;return new Promise(function(_0x34c6bc,_0x184a51){return db[_0x71cc('0x12')][_0x71cc('0x1d')]({'raw':_0x3054ff['options']?_0x3054ff[_0x71cc('0x15')][_0x71cc('0x14')]===undefined?!![]:![]:!![],'where':_0x3054ff[_0x71cc('0x15')]?_0x3054ff[_0x71cc('0x15')][_0x71cc('0x16')]||null:null,'attributes':_0x3054ff[_0x71cc('0x15')]?_0x3054ff[_0x71cc('0x15')]['attributes']||null:null,'include':_0x3054ff[_0x71cc('0x15')]?_0x3054ff['options']['include']?_[_0x71cc('0x1a')](_0x3054ff['options']['include'],function(_0x1ca012){return{'model':db[_0x1ca012['model']],'as':_0x1ca012['as'],'attributes':_0x1ca012[_0x71cc('0x17')],'include':_0x1ca012['include']?_[_0x71cc('0x1a')](_0x1ca012[_0x71cc('0x19')],function(_0x569380){return{'model':db[_0x569380[_0x71cc('0x1b')]],'as':_0x569380['as'],'attributes':_0x569380[_0x71cc('0x17')],'include':_0x569380[_0x71cc('0x19')]?_[_0x71cc('0x1a')](_0x569380[_0x71cc('0x19')],function(_0x2c2211){return{'model':db[_0x2c2211[_0x71cc('0x1b')]],'as':_0x2c2211['as'],'attributes':_0x2c2211[_0x71cc('0x17')]};}):[]};}):[]};}):[]:[]})[_0x71cc('0x7')](function(_0x2f8a72){logger['info'](_0x71cc('0x1e'),_0x3054ff);logger['debug'](_0x71cc('0x1e'),_0x3054ff,JSON[_0x71cc('0xa')](_0x2f8a72));_0x34c6bc(_0x2f8a72);})[_0x71cc('0x10')](function(_0x9328e2){logger[_0x71cc('0xb')](_0x71cc('0x1e'),_0x9328e2['message'],_0x3054ff);_0x184a51(_0x3b7451[_0x71cc('0xb')](0x1f4,_0x9328e2['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 2ce2a1f..c389dfe 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 _0xbddc=['get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller'];(function(_0x40b577,_0x5153c9){var _0xb3b57b=function(_0x191363){while(--_0x191363){_0x40b577['push'](_0x40b577['shift']());}};_0xb3b57b(++_0x5153c9);}(_0xbddc,0x9f));var _0xcbdd=function(_0x4f31a0,_0x381b9d){_0x4f31a0=_0x4f31a0-0x0;var _0x49d869=_0xbddc[_0x4f31a0];return _0x49d869;};'use strict';var multer=require(_0xcbdd('0x0'));var util=require(_0xcbdd('0x1'));var path=require(_0xcbdd('0x2'));var timeout=require(_0xcbdd('0x3'));var express=require(_0xcbdd('0x4'));var router=express['Router']();var auth=require(_0xcbdd('0x5'));var interaction=require(_0xcbdd('0x6'));var config=require(_0xcbdd('0x7'));var controller=require(_0xcbdd('0x8'));router[_0xcbdd('0x9')]('/',auth[_0xcbdd('0xa')](),controller['index']);router['get'](_0xcbdd('0xb'),auth[_0xcbdd('0xa')](),controller[_0xcbdd('0xc')]);router['get'](_0xcbdd('0xd'),auth['isAuthenticated'](),controller[_0xcbdd('0xe')]);router[_0xcbdd('0x9')](_0xcbdd('0xf'),auth[_0xcbdd('0xa')](),controller[_0xcbdd('0x10')]);router[_0xcbdd('0x9')](_0xcbdd('0x11'),auth['isAuthenticated'](),controller[_0xcbdd('0x12')]);router[_0xcbdd('0x13')]('/',auth['isAuthenticated'](),controller[_0xcbdd('0x14')]);router['put'](_0xcbdd('0xb'),auth['isAuthenticated'](),controller[_0xcbdd('0x15')]);router[_0xcbdd('0x16')](_0xcbdd('0xb'),auth[_0xcbdd('0xa')](),controller[_0xcbdd('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe22c=['/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','index','show','get','/:id/fields','isAuthenticated','getFields'];(function(_0x1a97f0,_0x295731){var _0x2f5cc1=function(_0x525acb){while(--_0x525acb){_0x1a97f0['push'](_0x1a97f0['shift']());}};_0x2f5cc1(++_0x295731);}(_0xe22c,0xee));var _0xce22=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe22c[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xce22('0x0'));var util=require(_0xce22('0x1'));var path=require(_0xce22('0x2'));var timeout=require(_0xce22('0x3'));var express=require(_0xce22('0x4'));var router=express[_0xce22('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xce22('0x6'));var config=require(_0xce22('0x7'));var controller=require(_0xce22('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xce22('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xce22('0xa')]);router[_0xce22('0xb')](_0xce22('0xc'),auth[_0xce22('0xd')](),controller[_0xce22('0xe')]);router[_0xce22('0xb')](_0xce22('0xf'),auth[_0xce22('0xd')](),controller[_0xce22('0x10')]);router[_0xce22('0xb')]('/:id/descriptions',auth[_0xce22('0xd')](),controller[_0xce22('0x11')]);router[_0xce22('0x12')]('/',auth[_0xce22('0xd')](),controller[_0xce22('0x13')]);router[_0xce22('0x14')]('/:id',auth[_0xce22('0xd')](),controller['update']);router[_0xce22('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xce22('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f56f237..10f1d38 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 _0x8106=['lead','sequelize','STRING','ENUM','Case','Task','contact_lead','contact'];(function(_0x3f48c8,_0x299d53){var _0x4c7512=function(_0x526393){while(--_0x526393){_0x3f48c8['push'](_0x3f48c8['shift']());}};_0x4c7512(++_0x299d53);}(_0x8106,0x109));var _0x6810=function(_0x42e3d2,_0x456864){_0x42e3d2=_0x42e3d2-0x0;var _0x40cf31=_0x8106[_0x42e3d2];return _0x40cf31;};'use strict';var Sequelize=require(_0x6810('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6810('0x1')]},'ticketType':{'type':Sequelize[_0x6810('0x2')]('Task',_0x6810('0x3')),'defaultValue':_0x6810('0x4')},'moduleSearch':{'type':Sequelize[_0x6810('0x2')](_0x6810('0x5'),_0x6810('0x6'),'lead'),'defaultValue':_0x6810('0x5')},'moduleCreate':{'type':Sequelize[_0x6810('0x2')]('nothing','contact',_0x6810('0x7')),'defaultValue':_0x6810('0x7')}}; \ No newline at end of file +var _0xfd42=['Task','ENUM','contact_lead','contact','lead','nothing','exports','STRING'];(function(_0x33c44a,_0x3045a8){var _0x27f590=function(_0x3e706f){while(--_0x3e706f){_0x33c44a['push'](_0x33c44a['shift']());}};_0x27f590(++_0x3045a8);}(_0xfd42,0x186));var _0x2fd4=function(_0x3d187b,_0xe946ef){_0x3d187b=_0x3d187b-0x0;var _0x40ae0e=_0xfd42[_0x3d187b];return _0x40ae0e;};'use strict';var Sequelize=require('sequelize');module[_0x2fd4('0x0')]={'name':{'type':Sequelize[_0x2fd4('0x1')]},'description':{'type':Sequelize[_0x2fd4('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x2fd4('0x2'),'Case'),'defaultValue':_0x2fd4('0x2')},'moduleSearch':{'type':Sequelize[_0x2fd4('0x3')](_0x2fd4('0x4'),_0x2fd4('0x5'),_0x2fd4('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x2fd4('0x3')](_0x2fd4('0x7'),_0x2fd4('0x5'),'lead'),'defaultValue':_0x2fd4('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index fa844dd..4b42157 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 _0x4036=['then','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','end','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','catch','show','length','include','merge','find','body','params','findOne','SalesforceField','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','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','jayson/promise','client','http','test','Sequelize','ValidationError','request'];(function(_0x391c68,_0x293aeb){var _0x4ca007=function(_0x31af41){while(--_0x31af41){_0x391c68['push'](_0x391c68['shift']());}};_0x4ca007(++_0x293aeb);}(_0x4036,0x160));var _0x6403=function(_0xa9f272,_0x25ddd3){_0xa9f272=_0xa9f272-0x0;var _0x56494f=_0x4036[_0xa9f272];return _0x56494f;};'use strict';var pdf=require(_0x6403('0x0'));var emlformat=require(_0x6403('0x1'));var rimraf=require(_0x6403('0x2'));var zipdir=require(_0x6403('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6403('0x4'));var moment=require(_0x6403('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6403('0x6'));var util=require(_0x6403('0x7'));var path=require(_0x6403('0x8'));var sox=require(_0x6403('0x9'));var csv=require(_0x6403('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6403('0xb'));var crypto=require(_0x6403('0xc'));var jsforce=require(_0x6403('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6403('0xa'));var querystring=require('querystring');var Papa=require(_0x6403('0xe'));var Redis=require(_0x6403('0xf'));var authService=require(_0x6403('0x10'));var qs=require(_0x6403('0x11'));var as=require(_0x6403('0x12'));var hardwareService=require(_0x6403('0x13'));var logger=require(_0x6403('0x14'))(_0x6403('0x15'));var utils=require(_0x6403('0x16'));var config=require(_0x6403('0x17'));var db=require(_0x6403('0x18'))['db'];var jayson=require(_0x6403('0x19'));var client=jayson[_0x6403('0x1a')][_0x6403('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x51f85c,_0x980201,_0x494fe2){if(_0x494fe2){var _0x5e8800=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e8800[_0x6403('0x1c')](_0x980201)){return _0x51f85c;}else{throw new db[(_0x6403('0x1d'))][(_0x6403('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 _0x51f85c;}}function respondWithRpcPromise(_0x15a3ec,_0x3de973,_0x497b03,_0x42a72c){return new BPromise(function(_0x62b69b,_0x4b6bcc){var _0x415c0b=_0x42a72c||client;return _0x415c0b[_0x6403('0x1f')](_0x15a3ec,_0x497b03)[_0x6403('0x20')](function(_0x12e0c1){logger['info'](_0x6403('0x21'),_0x3de973,'request\x20sent');logger[_0x6403('0x22')](_0x6403('0x23'),_0x3de973,_0x6403('0x24'),JSON[_0x6403('0x25')](_0x12e0c1));if(_0x12e0c1[_0x6403('0x26')]){if(_0x12e0c1[_0x6403('0x26')][_0x6403('0x27')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x3de973,_0x12e0c1[_0x6403('0x26')][_0x6403('0x28')]);return _0x4b6bcc(_0x12e0c1[_0x6403('0x26')][_0x6403('0x28')]);}logger[_0x6403('0x26')](_0x6403('0x21'),_0x3de973,_0x12e0c1[_0x6403('0x26')][_0x6403('0x28')]);return _0x62b69b(_0x12e0c1[_0x6403('0x26')][_0x6403('0x28')]);}else{logger[_0x6403('0x29')](_0x6403('0x21'),_0x3de973,'request\x20sent');_0x62b69b(_0x12e0c1[_0x6403('0x2a')][_0x6403('0x28')]);}})['catch'](function(_0xf7a308){logger[_0x6403('0x26')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3de973,_0xf7a308);_0x4b6bcc(_0xf7a308);});});}function respondWithStatusCode(_0x7fcda1,_0x486a1f){_0x486a1f=_0x486a1f||0xcc;return function(_0x954237){if(_0x954237){return _0x7fcda1[_0x6403('0x2b')](_0x486a1f);}return _0x7fcda1[_0x6403('0x2c')](_0x486a1f)['end']();};}function respondWithResult(_0x3c65b7,_0x5b1b9b){_0x5b1b9b=_0x5b1b9b||0xc8;return function(_0x4a983c){if(_0x4a983c){return _0x3c65b7[_0x6403('0x2c')](_0x5b1b9b)[_0x6403('0x2d')](_0x4a983c);}};}function respondWithFilteredResult(_0x15261e,_0x5066f9){return function(_0x5de2ee){if(_0x5de2ee){var _0x59fa08=_0x5de2ee[_0x6403('0x2e')],_0x42ab42=_0x5066f9['offset'],_0x4388e2=_0x5066f9[_0x6403('0x2f')]+_0x5066f9['limit'],_0x5f184c;if(_0x4388e2>=_0x59fa08){_0x4388e2=_0x59fa08;_0x5f184c=0xc8;}else{_0x5f184c=0xce;}_0x15261e[_0x6403('0x2c')](_0x5f184c);return _0x15261e[_0x6403('0x30')](_0x6403('0x31'),_0x42ab42+'-'+_0x4388e2+'/'+_0x59fa08)[_0x6403('0x2d')](_0x5de2ee);}return null;};}function patchUpdates(_0x417c19){return function(_0x209ef1){try{jsonpatch[_0x6403('0x32')](_0x209ef1,_0x417c19,!![]);}catch(_0x5e8145){return BPromise[_0x6403('0x33')](_0x5e8145);}return _0x209ef1['save']();};}function saveUpdates(_0x11cdde,_0x19d54e){return function(_0x5bdbc1){if(_0x5bdbc1){return _0x5bdbc1[_0x6403('0x34')](_0x11cdde)[_0x6403('0x20')](function(_0x4d472f){return _0x4d472f;});}return null;};}function removeEntity(_0x5e038e,_0x42a21b){return function(_0x19723e){if(_0x19723e){return _0x19723e[_0x6403('0x35')]()[_0x6403('0x20')](function(){_0x5e038e[_0x6403('0x2c')](0xcc)[_0x6403('0x36')]();});}};}function handleEntityNotFound(_0x3359f1,_0x319809){return function(_0x4de001){if(!_0x4de001){_0x3359f1['sendStatus'](0x194);}return _0x4de001;};}function handleError(_0x1c4c23,_0x32556e){_0x32556e=_0x32556e||0x1f4;return function(_0x5089a2){logger[_0x6403('0x26')](_0x5089a2[_0x6403('0x37')]);if(_0x5089a2['name']){delete _0x5089a2[_0x6403('0x38')];}_0x1c4c23['status'](_0x32556e)['send'](_0x5089a2);};}exports[_0x6403('0x39')]=function(_0x2a258b,_0x407884){var _0x46e56b={},_0x1fdca3={},_0x269642={'count':0x0,'rows':[]};var _0x4403ad=_[_0x6403('0x3a')](db[_0x6403('0x3b')][_0x6403('0x3c')],function(_0x459e10){return{'name':_0x459e10[_0x6403('0x3d')],'type':_0x459e10['type'][_0x6403('0x3e')]};});_0x1fdca3[_0x6403('0x3f')]=_[_0x6403('0x3a')](_0x4403ad,_0x6403('0x38'));_0x1fdca3[_0x6403('0x40')]=_[_0x6403('0x41')](_0x2a258b[_0x6403('0x40')]);_0x1fdca3[_0x6403('0x42')]=_[_0x6403('0x43')](_0x1fdca3['model'],_0x1fdca3[_0x6403('0x40')]);_0x46e56b['attributes']=_[_0x6403('0x43')](_0x1fdca3[_0x6403('0x3f')],qs[_0x6403('0x44')](_0x2a258b['query'][_0x6403('0x44')]));_0x46e56b[_0x6403('0x45')]=_0x46e56b[_0x6403('0x45')]['length']?_0x46e56b['attributes']:_0x1fdca3['model'];if(!_0x2a258b[_0x6403('0x40')][_0x6403('0x46')](_0x6403('0x47'))){_0x46e56b[_0x6403('0x48')]=qs[_0x6403('0x48')](_0x2a258b[_0x6403('0x40')]['limit']);_0x46e56b[_0x6403('0x2f')]=qs[_0x6403('0x2f')](_0x2a258b[_0x6403('0x40')][_0x6403('0x2f')]);}_0x46e56b[_0x6403('0x49')]=qs[_0x6403('0x4a')](_0x2a258b[_0x6403('0x40')][_0x6403('0x4a')]);_0x46e56b[_0x6403('0x4b')]=qs['filters'](_[_0x6403('0x4c')](_0x2a258b[_0x6403('0x40')],_0x1fdca3[_0x6403('0x42')]),_0x4403ad);if(_0x2a258b[_0x6403('0x40')][_0x6403('0x4d')]){_0x46e56b[_0x6403('0x4b')]=_['merge'](_0x46e56b['where'],{'$or':_['map'](_0x4403ad,function(_0x34e7c0){if(_0x34e7c0[_0x6403('0x4e')]!==_0x6403('0x4f')){var _0x4cfe97={};_0x4cfe97[_0x34e7c0['name']]={'$like':'%'+_0x2a258b['query']['filter']+'%'};return _0x4cfe97;}})});}_0x46e56b=_['merge']({},_0x46e56b,_0x2a258b[_0x6403('0x50')]);var _0x265317={'where':_0x46e56b[_0x6403('0x4b')]};return db[_0x6403('0x3b')]['count'](_0x265317)[_0x6403('0x20')](function(_0x75e5b6){_0x269642[_0x6403('0x2e')]=_0x75e5b6;if(_0x2a258b[_0x6403('0x40')][_0x6403('0x51')]){_0x46e56b['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x6403('0x52')](_0x46e56b);})[_0x6403('0x20')](function(_0x6f7be2){_0x269642['rows']=_0x6f7be2;return _0x269642;})['then'](respondWithFilteredResult(_0x407884,_0x46e56b))[_0x6403('0x53')](handleError(_0x407884,null));};exports[_0x6403('0x54')]=function(_0x550791,_0x285093){var _0x1399b7={'raw':![],'where':{'id':_0x550791['params']['id']}},_0x5133fb={};_0x5133fb['model']=_['keys'](db['SalesforceConfiguration'][_0x6403('0x3c')]);_0x5133fb[_0x6403('0x40')]=_[_0x6403('0x41')](_0x550791[_0x6403('0x40')]);_0x5133fb[_0x6403('0x42')]=_[_0x6403('0x43')](_0x5133fb[_0x6403('0x3f')],_0x5133fb['query']);_0x1399b7[_0x6403('0x45')]=_[_0x6403('0x43')](_0x5133fb['model'],qs['fields'](_0x550791['query'][_0x6403('0x44')]));_0x1399b7['attributes']=_0x1399b7[_0x6403('0x45')][_0x6403('0x55')]?_0x1399b7[_0x6403('0x45')]:_0x5133fb[_0x6403('0x3f')];if(_0x550791[_0x6403('0x40')][_0x6403('0x51')]){_0x1399b7[_0x6403('0x56')]=[{'all':!![]}];}_0x1399b7=_[_0x6403('0x57')]({},_0x1399b7,_0x550791['options']);return db['SalesforceConfiguration'][_0x6403('0x58')](_0x1399b7)[_0x6403('0x20')](handleEntityNotFound(_0x285093,null))[_0x6403('0x20')](respondWithResult(_0x285093,null))['catch'](handleError(_0x285093,null));};exports['create']=function(_0x1f88c1,_0x163a81){return db[_0x6403('0x3b')]['create'](_0x1f88c1[_0x6403('0x59')],{})[_0x6403('0x20')](respondWithResult(_0x163a81,0xc9))['catch'](handleError(_0x163a81,null));};exports[_0x6403('0x34')]=function(_0x18a221,_0x3d6e11){if(_0x18a221[_0x6403('0x59')]['id']){delete _0x18a221['body']['id'];}return db[_0x6403('0x3b')][_0x6403('0x58')]({'where':{'id':_0x18a221[_0x6403('0x5a')]['id']}})[_0x6403('0x20')](handleEntityNotFound(_0x3d6e11,null))[_0x6403('0x20')](saveUpdates(_0x18a221[_0x6403('0x59')],null))['then'](respondWithResult(_0x3d6e11,null))[_0x6403('0x53')](handleError(_0x3d6e11,null));};exports[_0x6403('0x35')]=function(_0x1d62cb,_0x2b7727){return db[_0x6403('0x3b')][_0x6403('0x58')]({'where':{'id':_0x1d62cb[_0x6403('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2b7727,null))[_0x6403('0x20')](removeEntity(_0x2b7727,null))['catch'](handleError(_0x2b7727,null));};exports['getFields']=function(_0x32682c,_0x2aa1c3,_0x1b68d3){var _0x57c1d0={};var _0x2aa6f7={};var _0x929b98;var _0x9898ed;return db['SalesforceConfiguration'][_0x6403('0x5b')]({'where':{'id':_0x32682c[_0x6403('0x5a')]['id']}})[_0x6403('0x20')](handleEntityNotFound(_0x2aa1c3,null))[_0x6403('0x20')](function(_0x8376ae){if(_0x8376ae){_0x929b98=_0x8376ae;_0x2aa6f7[_0x6403('0x3f')]=_['keys'](db[_0x6403('0x5c')][_0x6403('0x3c')]);_0x2aa6f7[_0x6403('0x40')]=_[_0x6403('0x41')](_0x32682c[_0x6403('0x40')]);_0x2aa6f7['filters']=_[_0x6403('0x43')](_0x2aa6f7[_0x6403('0x3f')],_0x2aa6f7[_0x6403('0x40')]);_0x57c1d0[_0x6403('0x45')]=_[_0x6403('0x43')](_0x2aa6f7[_0x6403('0x3f')],qs[_0x6403('0x44')](_0x32682c[_0x6403('0x40')][_0x6403('0x44')]));_0x57c1d0['attributes']=_0x57c1d0[_0x6403('0x45')][_0x6403('0x55')]?_0x57c1d0[_0x6403('0x45')]:_0x2aa6f7['model'];_0x57c1d0[_0x6403('0x49')]=qs[_0x6403('0x4a')](_0x32682c[_0x6403('0x40')][_0x6403('0x4a')]);_0x57c1d0[_0x6403('0x4b')]=qs[_0x6403('0x42')](_[_0x6403('0x4c')](_0x32682c[_0x6403('0x40')],_0x2aa6f7[_0x6403('0x42')]));if(_0x32682c['query'][_0x6403('0x4d')]){_0x57c1d0[_0x6403('0x4b')]=_[_0x6403('0x57')](_0x57c1d0[_0x6403('0x4b')],{'$or':_[_0x6403('0x3a')](_0x57c1d0[_0x6403('0x45')],function(_0x503b0f){var _0x3658e6={};_0x3658e6[_0x503b0f]={'$like':'%'+_0x32682c[_0x6403('0x40')][_0x6403('0x4d')]+'%'};return _0x3658e6;})});}_0x57c1d0=_[_0x6403('0x57')]({},_0x57c1d0,_0x32682c[_0x6403('0x50')]);return _0x929b98[_0x6403('0x5d')](_0x57c1d0);}})['then'](function(_0xb2f28b){if(_0xb2f28b){_0x9898ed=_0xb2f28b[_0x6403('0x55')];if(!_0x32682c[_0x6403('0x40')][_0x6403('0x46')](_0x6403('0x47'))){_0x57c1d0[_0x6403('0x48')]=qs[_0x6403('0x48')](_0x32682c[_0x6403('0x40')][_0x6403('0x48')]);_0x57c1d0['offset']=qs['offset'](_0x32682c[_0x6403('0x40')][_0x6403('0x2f')]);}return _0x929b98[_0x6403('0x5d')](_0x57c1d0);}})[_0x6403('0x20')](function(_0x28343a){if(_0x28343a){return _0x28343a?{'count':_0x9898ed,'rows':_0x28343a}:null;}})['then'](respondWithResult(_0x2aa1c3,null))[_0x6403('0x53')](handleError(_0x2aa1c3,null));};exports[_0x6403('0x5e')]=function(_0x4e1005,_0x5d99c2,_0x24b565){var _0x2cf878={};var _0x2452b6={};var _0x2feeb9;var _0x5487d3;return db[_0x6403('0x3b')][_0x6403('0x5b')]({'where':{'id':_0x4e1005[_0x6403('0x5a')]['id']}})[_0x6403('0x20')](handleEntityNotFound(_0x5d99c2,null))[_0x6403('0x20')](function(_0x303909){if(_0x303909){_0x2feeb9=_0x303909;_0x2452b6[_0x6403('0x3f')]=_[_0x6403('0x41')](db[_0x6403('0x5c')][_0x6403('0x3c')]);_0x2452b6[_0x6403('0x40')]=_[_0x6403('0x41')](_0x4e1005['query']);_0x2452b6[_0x6403('0x42')]=_[_0x6403('0x43')](_0x2452b6['model'],_0x2452b6[_0x6403('0x40')]);_0x2cf878[_0x6403('0x45')]=_['intersection'](_0x2452b6['model'],qs['fields'](_0x4e1005[_0x6403('0x40')][_0x6403('0x44')]));_0x2cf878[_0x6403('0x45')]=_0x2cf878['attributes'][_0x6403('0x55')]?_0x2cf878[_0x6403('0x45')]:_0x2452b6[_0x6403('0x3f')];_0x2cf878[_0x6403('0x49')]=qs[_0x6403('0x4a')](_0x4e1005['query'][_0x6403('0x4a')]);_0x2cf878['where']=qs[_0x6403('0x42')](_['pick'](_0x4e1005[_0x6403('0x40')],_0x2452b6[_0x6403('0x42')]));if(_0x4e1005[_0x6403('0x40')][_0x6403('0x4d')]){_0x2cf878[_0x6403('0x4b')]=_['merge'](_0x2cf878['where'],{'$or':_[_0x6403('0x3a')](_0x2cf878[_0x6403('0x45')],function(_0x383b21){var _0x18e37b={};_0x18e37b[_0x383b21]={'$like':'%'+_0x4e1005[_0x6403('0x40')][_0x6403('0x4d')]+'%'};return _0x18e37b;})});}_0x2cf878=_['merge']({},_0x2cf878,_0x4e1005['options']);return _0x2feeb9['getSubjects'](_0x2cf878);}})['then'](function(_0x4c437d){if(_0x4c437d){_0x5487d3=_0x4c437d['length'];if(!_0x4e1005[_0x6403('0x40')][_0x6403('0x46')](_0x6403('0x47'))){_0x2cf878[_0x6403('0x48')]=qs[_0x6403('0x48')](_0x4e1005[_0x6403('0x40')]['limit']);_0x2cf878[_0x6403('0x2f')]=qs[_0x6403('0x2f')](_0x4e1005[_0x6403('0x40')][_0x6403('0x2f')]);}return _0x2feeb9['getSubjects'](_0x2cf878);}})[_0x6403('0x20')](function(_0x39d684){if(_0x39d684){return _0x39d684?{'count':_0x5487d3,'rows':_0x39d684}:null;}})[_0x6403('0x20')](respondWithResult(_0x5d99c2,null))[_0x6403('0x53')](handleError(_0x5d99c2,null));};exports[_0x6403('0x5f')]=function(_0x1bd278,_0x3063f4,_0x5c81e7){var _0x3f8acd={};var _0x394c91={};var _0x3dd8bc;var _0x52d8e7;return db[_0x6403('0x3b')][_0x6403('0x5b')]({'where':{'id':_0x1bd278[_0x6403('0x5a')]['id']}})[_0x6403('0x20')](handleEntityNotFound(_0x3063f4,null))['then'](function(_0x6a25db){if(_0x6a25db){_0x3dd8bc=_0x6a25db;_0x394c91[_0x6403('0x3f')]=_[_0x6403('0x41')](db[_0x6403('0x5c')][_0x6403('0x3c')]);_0x394c91['query']=_[_0x6403('0x41')](_0x1bd278['query']);_0x394c91['filters']=_['intersection'](_0x394c91[_0x6403('0x3f')],_0x394c91[_0x6403('0x40')]);_0x3f8acd[_0x6403('0x45')]=_[_0x6403('0x43')](_0x394c91[_0x6403('0x3f')],qs[_0x6403('0x44')](_0x1bd278[_0x6403('0x40')]['fields']));_0x3f8acd[_0x6403('0x45')]=_0x3f8acd[_0x6403('0x45')][_0x6403('0x55')]?_0x3f8acd[_0x6403('0x45')]:_0x394c91[_0x6403('0x3f')];_0x3f8acd[_0x6403('0x49')]=qs['sort'](_0x1bd278['query'][_0x6403('0x4a')]);_0x3f8acd[_0x6403('0x4b')]=qs[_0x6403('0x42')](_[_0x6403('0x4c')](_0x1bd278['query'],_0x394c91['filters']));if(_0x1bd278[_0x6403('0x40')][_0x6403('0x4d')]){_0x3f8acd[_0x6403('0x4b')]=_[_0x6403('0x57')](_0x3f8acd[_0x6403('0x4b')],{'$or':_[_0x6403('0x3a')](_0x3f8acd[_0x6403('0x45')],function(_0x11a506){var _0x1de6bf={};_0x1de6bf[_0x11a506]={'$like':'%'+_0x1bd278[_0x6403('0x40')][_0x6403('0x4d')]+'%'};return _0x1de6bf;})});}_0x3f8acd=_[_0x6403('0x57')]({},_0x3f8acd,_0x1bd278['options']);return _0x3dd8bc[_0x6403('0x5f')](_0x3f8acd);}})[_0x6403('0x20')](function(_0x1149ee){if(_0x1149ee){_0x52d8e7=_0x1149ee['length'];if(!_0x1bd278['query'][_0x6403('0x46')](_0x6403('0x47'))){_0x3f8acd[_0x6403('0x48')]=qs['limit'](_0x1bd278['query']['limit']);_0x3f8acd[_0x6403('0x2f')]=qs[_0x6403('0x2f')](_0x1bd278[_0x6403('0x40')]['offset']);}return _0x3dd8bc[_0x6403('0x5f')](_0x3f8acd);}})['then'](function(_0x57ba93){if(_0x57ba93){return _0x57ba93?{'count':_0x52d8e7,'rows':_0x57ba93}:null;}})['then'](respondWithResult(_0x3063f4,null))[_0x6403('0x53')](handleError(_0x3063f4,null));}; \ No newline at end of file +var _0x397b=['include','rows','show','params','keys','rawAttributes','length','find','create','body','getFields','findOne','getSubjects','SalesforceField','nolimit','getDescriptions','html-pdf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../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~!@#$%^&-_=+[{]}.','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','count','offset','set','Content-Range','json','save','update','end','name','send','index','SalesforceConfiguration','type','key','map','filters','query','intersection','fields','attributes','model','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll'];(function(_0xec1289,_0x4fa82b){var _0x3e223c=function(_0x9752ec){while(--_0x9752ec){_0xec1289['push'](_0xec1289['shift']());}};_0x3e223c(++_0x4fa82b);}(_0x397b,0x168));var _0xb397=function(_0x18464a,_0x233a5c){_0x18464a=_0x18464a-0x0;var _0x338952=_0x397b[_0x18464a];return _0x338952;};'use strict';var pdf=require(_0xb397('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb397('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb397('0x2'));var BPromise=require(_0xb397('0x3'));var Mustache=require(_0xb397('0x4'));var util=require(_0xb397('0x5'));var path=require('path');var sox=require(_0xb397('0x6'));var csv=require(_0xb397('0x7'));var ejs=require(_0xb397('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb397('0x9'));var crypto=require(_0xb397('0xa'));var jsforce=require(_0xb397('0xb'));var deskjs=require(_0xb397('0xc'));var toCsv=require(_0xb397('0x7'));var querystring=require(_0xb397('0xd'));var Papa=require(_0xb397('0xe'));var Redis=require(_0xb397('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb397('0x10'));var as=require(_0xb397('0x11'));var hardwareService=require(_0xb397('0x12'));var logger=require('../../config/logger')(_0xb397('0x13'));var utils=require('../../config/utils');var config=require(_0xb397('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb397('0x15'));var client=jayson['client'][_0xb397('0x16')]({'port':0x232a});function checkPasswordPattern(_0x2453a8,_0x1a4eae,_0x2a6f09){if(_0x2a6f09){var _0x3a68db=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a68db[_0xb397('0x17')](_0x1a4eae)){return _0x2453a8;}else{throw new db[(_0xb397('0x18'))][(_0xb397('0x19'))](_0xb397('0x1a'));}}else{return _0x2453a8;}}function respondWithRpcPromise(_0x374b24,_0x5083a0,_0x5dbfe0,_0x2f8b7f){return new BPromise(function(_0x5bf4e2,_0x45c432){var _0x59e823=_0x2f8b7f||client;return _0x59e823['request'](_0x374b24,_0x5dbfe0)[_0xb397('0x1b')](function(_0x24e61b){logger[_0xb397('0x1c')](_0xb397('0x1d'),_0x5083a0,_0xb397('0x1e'));logger[_0xb397('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x5083a0,_0xb397('0x1e'),JSON[_0xb397('0x20')](_0x24e61b));if(_0x24e61b[_0xb397('0x21')]){if(_0x24e61b[_0xb397('0x21')]['code']===0x1f4){logger[_0xb397('0x21')](_0xb397('0x1d'),_0x5083a0,_0x24e61b['error'][_0xb397('0x22')]);return _0x45c432(_0x24e61b[_0xb397('0x21')][_0xb397('0x22')]);}logger[_0xb397('0x21')](_0xb397('0x1d'),_0x5083a0,_0x24e61b[_0xb397('0x21')]['message']);return _0x5bf4e2(_0x24e61b[_0xb397('0x21')][_0xb397('0x22')]);}else{logger['info'](_0xb397('0x1d'),_0x5083a0,_0xb397('0x1e'));_0x5bf4e2(_0x24e61b[_0xb397('0x23')][_0xb397('0x22')]);}})[_0xb397('0x24')](function(_0x46d368){logger[_0xb397('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5083a0,_0x46d368);_0x45c432(_0x46d368);});});}function respondWithStatusCode(_0x2ebc95,_0x5ce82d){_0x5ce82d=_0x5ce82d||0xcc;return function(_0x5ca3dd){if(_0x5ca3dd){return _0x2ebc95[_0xb397('0x25')](_0x5ce82d);}return _0x2ebc95[_0xb397('0x26')](_0x5ce82d)['end']();};}function respondWithResult(_0x163c3b,_0x11735d){_0x11735d=_0x11735d||0xc8;return function(_0x5f4e36){if(_0x5f4e36){return _0x163c3b[_0xb397('0x26')](_0x11735d)['json'](_0x5f4e36);}};}function respondWithFilteredResult(_0x4670b9,_0x5c9029){return function(_0x57ef6d){if(_0x57ef6d){var _0x2c4f35=_0x57ef6d[_0xb397('0x27')],_0x4ad1bc=_0x5c9029[_0xb397('0x28')],_0x176f7d=_0x5c9029['offset']+_0x5c9029['limit'],_0x2a1be0;if(_0x176f7d>=_0x2c4f35){_0x176f7d=_0x2c4f35;_0x2a1be0=0xc8;}else{_0x2a1be0=0xce;}_0x4670b9[_0xb397('0x26')](_0x2a1be0);return _0x4670b9[_0xb397('0x29')](_0xb397('0x2a'),_0x4ad1bc+'-'+_0x176f7d+'/'+_0x2c4f35)[_0xb397('0x2b')](_0x57ef6d);}return null;};}function patchUpdates(_0x234bf0){return function(_0x4210cd){try{jsonpatch['apply'](_0x4210cd,_0x234bf0,!![]);}catch(_0x1b2d2f){return BPromise['reject'](_0x1b2d2f);}return _0x4210cd[_0xb397('0x2c')]();};}function saveUpdates(_0x2d4313,_0x5adda6){return function(_0x214a09){if(_0x214a09){return _0x214a09[_0xb397('0x2d')](_0x2d4313)[_0xb397('0x1b')](function(_0x4ddacf){return _0x4ddacf;});}return null;};}function removeEntity(_0x3bea4f,_0x43d494){return function(_0x356089){if(_0x356089){return _0x356089['destroy']()[_0xb397('0x1b')](function(){_0x3bea4f['status'](0xcc)[_0xb397('0x2e')]();});}};}function handleEntityNotFound(_0x5d24ed,_0x4e8940){return function(_0x4aeed6){if(!_0x4aeed6){_0x5d24ed['sendStatus'](0x194);}return _0x4aeed6;};}function handleError(_0x45f1a8,_0x10081f){_0x10081f=_0x10081f||0x1f4;return function(_0x12fd09){logger[_0xb397('0x21')](_0x12fd09['stack']);if(_0x12fd09[_0xb397('0x2f')]){delete _0x12fd09[_0xb397('0x2f')];}_0x45f1a8[_0xb397('0x26')](_0x10081f)[_0xb397('0x30')](_0x12fd09);};}exports[_0xb397('0x31')]=function(_0x11285c,_0x4d66ba){var _0x3a9199={},_0x594cad={},_0x1b8a8a={'count':0x0,'rows':[]};var _0x1b9447=_['map'](db[_0xb397('0x32')]['rawAttributes'],function(_0x50f762){return{'name':_0x50f762['fieldName'],'type':_0x50f762[_0xb397('0x33')][_0xb397('0x34')]};});_0x594cad['model']=_[_0xb397('0x35')](_0x1b9447,_0xb397('0x2f'));_0x594cad['query']=_['keys'](_0x11285c['query']);_0x594cad[_0xb397('0x36')]=_['intersection'](_0x594cad['model'],_0x594cad[_0xb397('0x37')]);_0x3a9199['attributes']=_[_0xb397('0x38')](_0x594cad['model'],qs[_0xb397('0x39')](_0x11285c[_0xb397('0x37')][_0xb397('0x39')]));_0x3a9199[_0xb397('0x3a')]=_0x3a9199[_0xb397('0x3a')]['length']?_0x3a9199[_0xb397('0x3a')]:_0x594cad[_0xb397('0x3b')];if(!_0x11285c[_0xb397('0x37')][_0xb397('0x3c')]('nolimit')){_0x3a9199['limit']=qs['limit'](_0x11285c[_0xb397('0x37')][_0xb397('0x3d')]);_0x3a9199[_0xb397('0x28')]=qs[_0xb397('0x28')](_0x11285c[_0xb397('0x37')][_0xb397('0x28')]);}_0x3a9199[_0xb397('0x3e')]=qs['sort'](_0x11285c[_0xb397('0x37')][_0xb397('0x3f')]);_0x3a9199[_0xb397('0x40')]=qs[_0xb397('0x36')](_[_0xb397('0x41')](_0x11285c[_0xb397('0x37')],_0x594cad[_0xb397('0x36')]),_0x1b9447);if(_0x11285c[_0xb397('0x37')][_0xb397('0x42')]){_0x3a9199[_0xb397('0x40')]=_[_0xb397('0x43')](_0x3a9199[_0xb397('0x40')],{'$or':_[_0xb397('0x35')](_0x1b9447,function(_0xd3b481){if(_0xd3b481[_0xb397('0x33')]!=='VIRTUAL'){var _0x587d7e={};_0x587d7e[_0xd3b481[_0xb397('0x2f')]]={'$like':'%'+_0x11285c[_0xb397('0x37')]['filter']+'%'};return _0x587d7e;}})});}_0x3a9199=_[_0xb397('0x43')]({},_0x3a9199,_0x11285c[_0xb397('0x44')]);var _0x3becc5={'where':_0x3a9199['where']};return db[_0xb397('0x32')]['count'](_0x3becc5)[_0xb397('0x1b')](function(_0x1f1653){_0x1b8a8a[_0xb397('0x27')]=_0x1f1653;if(_0x11285c[_0xb397('0x37')][_0xb397('0x45')]){_0x3a9199[_0xb397('0x46')]=[{'all':!![]}];}return db[_0xb397('0x32')]['findAll'](_0x3a9199);})['then'](function(_0x55ed67){_0x1b8a8a[_0xb397('0x47')]=_0x55ed67;return _0x1b8a8a;})[_0xb397('0x1b')](respondWithFilteredResult(_0x4d66ba,_0x3a9199))[_0xb397('0x24')](handleError(_0x4d66ba,null));};exports[_0xb397('0x48')]=function(_0x4316ea,_0x1985c8){var _0xbc262={'raw':![],'where':{'id':_0x4316ea[_0xb397('0x49')]['id']}},_0x3542e3={};_0x3542e3['model']=_[_0xb397('0x4a')](db[_0xb397('0x32')][_0xb397('0x4b')]);_0x3542e3[_0xb397('0x37')]=_[_0xb397('0x4a')](_0x4316ea[_0xb397('0x37')]);_0x3542e3[_0xb397('0x36')]=_[_0xb397('0x38')](_0x3542e3[_0xb397('0x3b')],_0x3542e3[_0xb397('0x37')]);_0xbc262[_0xb397('0x3a')]=_['intersection'](_0x3542e3[_0xb397('0x3b')],qs[_0xb397('0x39')](_0x4316ea[_0xb397('0x37')][_0xb397('0x39')]));_0xbc262[_0xb397('0x3a')]=_0xbc262[_0xb397('0x3a')][_0xb397('0x4c')]?_0xbc262[_0xb397('0x3a')]:_0x3542e3[_0xb397('0x3b')];if(_0x4316ea[_0xb397('0x37')][_0xb397('0x45')]){_0xbc262[_0xb397('0x46')]=[{'all':!![]}];}_0xbc262=_[_0xb397('0x43')]({},_0xbc262,_0x4316ea[_0xb397('0x44')]);return db['SalesforceConfiguration'][_0xb397('0x4d')](_0xbc262)['then'](handleEntityNotFound(_0x1985c8,null))[_0xb397('0x1b')](respondWithResult(_0x1985c8,null))[_0xb397('0x24')](handleError(_0x1985c8,null));};exports[_0xb397('0x4e')]=function(_0x2b89ee,_0x28ebb1){return db['SalesforceConfiguration'][_0xb397('0x4e')](_0x2b89ee[_0xb397('0x4f')],{})[_0xb397('0x1b')](respondWithResult(_0x28ebb1,0xc9))[_0xb397('0x24')](handleError(_0x28ebb1,null));};exports['update']=function(_0x481862,_0xdf69fb){if(_0x481862[_0xb397('0x4f')]['id']){delete _0x481862[_0xb397('0x4f')]['id'];}return db[_0xb397('0x32')][_0xb397('0x4d')]({'where':{'id':_0x481862[_0xb397('0x49')]['id']}})[_0xb397('0x1b')](handleEntityNotFound(_0xdf69fb,null))[_0xb397('0x1b')](saveUpdates(_0x481862[_0xb397('0x4f')],null))[_0xb397('0x1b')](respondWithResult(_0xdf69fb,null))['catch'](handleError(_0xdf69fb,null));};exports['destroy']=function(_0x5c93c9,_0x12c589){return db[_0xb397('0x32')][_0xb397('0x4d')]({'where':{'id':_0x5c93c9[_0xb397('0x49')]['id']}})[_0xb397('0x1b')](handleEntityNotFound(_0x12c589,null))[_0xb397('0x1b')](removeEntity(_0x12c589,null))[_0xb397('0x24')](handleError(_0x12c589,null));};exports[_0xb397('0x50')]=function(_0x502dcb,_0x1b3af8,_0x4cc78c){var _0xcdd38={};var _0x7bcd1e={};var _0x1deb78;var _0x14ea40;return db[_0xb397('0x32')][_0xb397('0x51')]({'where':{'id':_0x502dcb[_0xb397('0x49')]['id']}})[_0xb397('0x1b')](handleEntityNotFound(_0x1b3af8,null))['then'](function(_0x241caa){if(_0x241caa){_0x1deb78=_0x241caa;_0x7bcd1e[_0xb397('0x3b')]=_[_0xb397('0x4a')](db['SalesforceField'][_0xb397('0x4b')]);_0x7bcd1e[_0xb397('0x37')]=_['keys'](_0x502dcb[_0xb397('0x37')]);_0x7bcd1e[_0xb397('0x36')]=_[_0xb397('0x38')](_0x7bcd1e[_0xb397('0x3b')],_0x7bcd1e[_0xb397('0x37')]);_0xcdd38['attributes']=_['intersection'](_0x7bcd1e[_0xb397('0x3b')],qs[_0xb397('0x39')](_0x502dcb[_0xb397('0x37')][_0xb397('0x39')]));_0xcdd38['attributes']=_0xcdd38[_0xb397('0x3a')]['length']?_0xcdd38[_0xb397('0x3a')]:_0x7bcd1e[_0xb397('0x3b')];_0xcdd38[_0xb397('0x3e')]=qs[_0xb397('0x3f')](_0x502dcb['query'][_0xb397('0x3f')]);_0xcdd38[_0xb397('0x40')]=qs['filters'](_[_0xb397('0x41')](_0x502dcb[_0xb397('0x37')],_0x7bcd1e[_0xb397('0x36')]));if(_0x502dcb[_0xb397('0x37')][_0xb397('0x42')]){_0xcdd38[_0xb397('0x40')]=_['merge'](_0xcdd38[_0xb397('0x40')],{'$or':_[_0xb397('0x35')](_0xcdd38['attributes'],function(_0x5507d4){var _0xdb7381={};_0xdb7381[_0x5507d4]={'$like':'%'+_0x502dcb[_0xb397('0x37')]['filter']+'%'};return _0xdb7381;})});}_0xcdd38=_[_0xb397('0x43')]({},_0xcdd38,_0x502dcb[_0xb397('0x44')]);return _0x1deb78[_0xb397('0x50')](_0xcdd38);}})[_0xb397('0x1b')](function(_0x3ff864){if(_0x3ff864){_0x14ea40=_0x3ff864['length'];if(!_0x502dcb[_0xb397('0x37')][_0xb397('0x3c')]('nolimit')){_0xcdd38[_0xb397('0x3d')]=qs[_0xb397('0x3d')](_0x502dcb[_0xb397('0x37')][_0xb397('0x3d')]);_0xcdd38[_0xb397('0x28')]=qs[_0xb397('0x28')](_0x502dcb[_0xb397('0x37')][_0xb397('0x28')]);}return _0x1deb78[_0xb397('0x50')](_0xcdd38);}})[_0xb397('0x1b')](function(_0x3e2823){if(_0x3e2823){return _0x3e2823?{'count':_0x14ea40,'rows':_0x3e2823}:null;}})[_0xb397('0x1b')](respondWithResult(_0x1b3af8,null))['catch'](handleError(_0x1b3af8,null));};exports[_0xb397('0x52')]=function(_0x67e021,_0x126bb1,_0x9b3fe){var _0x3692aa={};var _0x36ec0d={};var _0x301a57;var _0xe47c03;return db[_0xb397('0x32')][_0xb397('0x51')]({'where':{'id':_0x67e021[_0xb397('0x49')]['id']}})['then'](handleEntityNotFound(_0x126bb1,null))[_0xb397('0x1b')](function(_0x835c0){if(_0x835c0){_0x301a57=_0x835c0;_0x36ec0d['model']=_['keys'](db[_0xb397('0x53')][_0xb397('0x4b')]);_0x36ec0d[_0xb397('0x37')]=_['keys'](_0x67e021[_0xb397('0x37')]);_0x36ec0d[_0xb397('0x36')]=_[_0xb397('0x38')](_0x36ec0d[_0xb397('0x3b')],_0x36ec0d[_0xb397('0x37')]);_0x3692aa[_0xb397('0x3a')]=_['intersection'](_0x36ec0d[_0xb397('0x3b')],qs[_0xb397('0x39')](_0x67e021['query'][_0xb397('0x39')]));_0x3692aa[_0xb397('0x3a')]=_0x3692aa[_0xb397('0x3a')][_0xb397('0x4c')]?_0x3692aa['attributes']:_0x36ec0d['model'];_0x3692aa[_0xb397('0x3e')]=qs[_0xb397('0x3f')](_0x67e021[_0xb397('0x37')]['sort']);_0x3692aa['where']=qs[_0xb397('0x36')](_['pick'](_0x67e021[_0xb397('0x37')],_0x36ec0d[_0xb397('0x36')]));if(_0x67e021[_0xb397('0x37')][_0xb397('0x42')]){_0x3692aa[_0xb397('0x40')]=_['merge'](_0x3692aa[_0xb397('0x40')],{'$or':_[_0xb397('0x35')](_0x3692aa[_0xb397('0x3a')],function(_0x19976c){var _0x38ab3b={};_0x38ab3b[_0x19976c]={'$like':'%'+_0x67e021[_0xb397('0x37')]['filter']+'%'};return _0x38ab3b;})});}_0x3692aa=_[_0xb397('0x43')]({},_0x3692aa,_0x67e021[_0xb397('0x44')]);return _0x301a57[_0xb397('0x52')](_0x3692aa);}})[_0xb397('0x1b')](function(_0x254a79){if(_0x254a79){_0xe47c03=_0x254a79['length'];if(!_0x67e021[_0xb397('0x37')][_0xb397('0x3c')](_0xb397('0x54'))){_0x3692aa[_0xb397('0x3d')]=qs[_0xb397('0x3d')](_0x67e021['query'][_0xb397('0x3d')]);_0x3692aa[_0xb397('0x28')]=qs[_0xb397('0x28')](_0x67e021['query'][_0xb397('0x28')]);}return _0x301a57[_0xb397('0x52')](_0x3692aa);}})[_0xb397('0x1b')](function(_0x356478){if(_0x356478){return _0x356478?{'count':_0xe47c03,'rows':_0x356478}:null;}})[_0xb397('0x1b')](respondWithResult(_0x126bb1,null))[_0xb397('0x24')](handleError(_0x126bb1,null));};exports[_0xb397('0x55')]=function(_0x267666,_0xd61a0c,_0x4c5a8b){var _0x21078f={};var _0x461319={};var _0x544791;var _0x34761a;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x267666[_0xb397('0x49')]['id']}})['then'](handleEntityNotFound(_0xd61a0c,null))[_0xb397('0x1b')](function(_0x769395){if(_0x769395){_0x544791=_0x769395;_0x461319[_0xb397('0x3b')]=_[_0xb397('0x4a')](db[_0xb397('0x53')][_0xb397('0x4b')]);_0x461319['query']=_[_0xb397('0x4a')](_0x267666[_0xb397('0x37')]);_0x461319[_0xb397('0x36')]=_[_0xb397('0x38')](_0x461319[_0xb397('0x3b')],_0x461319[_0xb397('0x37')]);_0x21078f[_0xb397('0x3a')]=_['intersection'](_0x461319[_0xb397('0x3b')],qs[_0xb397('0x39')](_0x267666['query'][_0xb397('0x39')]));_0x21078f[_0xb397('0x3a')]=_0x21078f[_0xb397('0x3a')][_0xb397('0x4c')]?_0x21078f[_0xb397('0x3a')]:_0x461319['model'];_0x21078f['order']=qs['sort'](_0x267666[_0xb397('0x37')][_0xb397('0x3f')]);_0x21078f[_0xb397('0x40')]=qs['filters'](_[_0xb397('0x41')](_0x267666['query'],_0x461319[_0xb397('0x36')]));if(_0x267666['query'][_0xb397('0x42')]){_0x21078f[_0xb397('0x40')]=_[_0xb397('0x43')](_0x21078f[_0xb397('0x40')],{'$or':_['map'](_0x21078f[_0xb397('0x3a')],function(_0xc3c499){var _0xb0aad5={};_0xb0aad5[_0xc3c499]={'$like':'%'+_0x267666[_0xb397('0x37')][_0xb397('0x42')]+'%'};return _0xb0aad5;})});}_0x21078f=_['merge']({},_0x21078f,_0x267666['options']);return _0x544791[_0xb397('0x55')](_0x21078f);}})[_0xb397('0x1b')](function(_0x3e9099){if(_0x3e9099){_0x34761a=_0x3e9099[_0xb397('0x4c')];if(!_0x267666[_0xb397('0x37')][_0xb397('0x3c')](_0xb397('0x54'))){_0x21078f['limit']=qs['limit'](_0x267666[_0xb397('0x37')]['limit']);_0x21078f[_0xb397('0x28')]=qs[_0xb397('0x28')](_0x267666[_0xb397('0x37')]['offset']);}return _0x544791[_0xb397('0x55')](_0x21078f);}})[_0xb397('0x1b')](function(_0x5860a7){if(_0x5860a7){return _0x5860a7?{'count':_0x34761a,'rows':_0x5860a7}:null;}})[_0xb397('0x1b')](respondWithResult(_0xd61a0c,null))[_0xb397('0x24')](handleError(_0xd61a0c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2cb2990..93ede55 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 _0xee5d=['request-promise','rimraf','../../config/environment','exports','define','SalesforceConfiguration','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee5d,0x17c));var _0xdee5=function(_0x135815,_0x1ebe87){_0x135815=_0x135815-0x0;var _0x4ce0b1=_0xee5d[_0x135815];return _0x4ce0b1;};'use strict';var _=require(_0xdee5('0x0'));var util=require(_0xdee5('0x1'));var logger=require(_0xdee5('0x2'))('api');var moment=require(_0xdee5('0x3'));var BPromise=require(_0xdee5('0x4'));var rp=require(_0xdee5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdee5('0x6'));var config=require(_0xdee5('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xdee5('0x8')]=function(_0x2ddd40,_0x3eec95){return _0x2ddd40[_0xdee5('0x9')](_0xdee5('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3011=['path','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','lodash','util','moment','request-promise'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x3011,0x1ec));var _0x1301=function(_0x5c1255,_0xe7aeff){_0x5c1255=_0x5c1255-0x0;var _0x1824d8=_0x3011[_0x5c1255];return _0x1824d8;};'use strict';var _=require(_0x1301('0x0'));var util=require(_0x1301('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1301('0x2'));var BPromise=require('bluebird');var rp=require(_0x1301('0x3'));var fs=require('fs');var path=require(_0x1301('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1301('0x5'));module[_0x1301('0x6')]=function(_0x5b5fac,_0x2f7b22){return _0x5b5fac['define'](_0x1301('0x7'),attributes,{'tableName':'int_salesforce_configurations','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 604570b..9ba9d68 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 _0xa9fd=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9fd,0x98));var _0xda9f=function(_0x5ab426,_0x385346){_0x5ab426=_0x5ab426-0x0;var _0x2f3592=_0xa9fd[_0x5ab426];return _0x2f3592;};'use strict';var _=require(_0xda9f('0x0'));var util=require(_0xda9f('0x1'));var moment=require('moment');var BPromise=require(_0xda9f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda9f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xda9f('0x4'));var logger=require(_0xda9f('0x5'))(_0xda9f('0x6'));var config=require(_0xda9f('0x7'));var jayson=require(_0xda9f('0x8'));var client=jayson['client'][_0xda9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c4423,_0x11e7de,_0x132f8d){return new BPromise(function(_0x25be63,_0x36d6b9){return client[_0xda9f('0xa')](_0x2c4423,_0x132f8d)[_0xda9f('0xb')](function(_0x2382e6){logger[_0xda9f('0xc')](_0xda9f('0xd'),_0x11e7de,_0xda9f('0xe'));logger[_0xda9f('0xf')](_0xda9f('0x10'),_0x11e7de,'request\x20sent',JSON[_0xda9f('0x11')](_0x2382e6));if(_0x2382e6['error']){if(_0x2382e6['error'][_0xda9f('0x12')]===0x1f4){logger[_0xda9f('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x11e7de,_0x2382e6[_0xda9f('0x13')]['message']);return _0x36d6b9(_0x2382e6['error']['message']);}logger[_0xda9f('0x13')](_0xda9f('0xd'),_0x11e7de,_0x2382e6[_0xda9f('0x13')][_0xda9f('0x14')]);return _0x25be63(_0x2382e6[_0xda9f('0x13')]['message']);}else{logger[_0xda9f('0xc')](_0xda9f('0xd'),_0x11e7de,_0xda9f('0xe'));_0x25be63(_0x2382e6[_0xda9f('0x15')][_0xda9f('0x14')]);}})['catch'](function(_0x3de675){logger[_0xda9f('0x13')](_0xda9f('0xd'),_0x11e7de,_0x3de675);_0x36d6b9(_0x3de675);});});} \ No newline at end of file +var _0xe41c=['rpc','../../config/environment','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4cd134,_0x55c52b){var _0xe27752=function(_0xb9222c){while(--_0xb9222c){_0x4cd134['push'](_0x4cd134['shift']());}};_0xe27752(++_0x55c52b);}(_0xe41c,0x168));var _0xce41=function(_0x200e69,_0x25ee56){_0x200e69=_0x200e69-0x0;var _0x105241=_0xe41c[_0x200e69];return _0x105241;};'use strict';var _=require(_0xce41('0x0'));var util=require('util');var moment=require(_0xce41('0x1'));var BPromise=require(_0xce41('0x2'));var rs=require(_0xce41('0x3'));var fs=require('fs');var Redis=require(_0xce41('0x4'));var db=require(_0xce41('0x5'))['db'];var utils=require(_0xce41('0x6'));var logger=require(_0xce41('0x7'))(_0xce41('0x8'));var config=require(_0xce41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xce41('0xa')][_0xce41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f3b05,_0x17cd57,_0x154341){return new BPromise(function(_0x4e9074,_0x339ff5){return client[_0xce41('0xc')](_0x5f3b05,_0x154341)[_0xce41('0xd')](function(_0x4bd9b7){logger['info'](_0xce41('0xe'),_0x17cd57,_0xce41('0xf'));logger['debug'](_0xce41('0x10'),_0x17cd57,_0xce41('0xf'),JSON['stringify'](_0x4bd9b7));if(_0x4bd9b7[_0xce41('0x11')]){if(_0x4bd9b7[_0xce41('0x11')][_0xce41('0x12')]===0x1f4){logger[_0xce41('0x11')](_0xce41('0xe'),_0x17cd57,_0x4bd9b7['error'][_0xce41('0x13')]);return _0x339ff5(_0x4bd9b7[_0xce41('0x11')][_0xce41('0x13')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x17cd57,_0x4bd9b7['error'][_0xce41('0x13')]);return _0x4e9074(_0x4bd9b7[_0xce41('0x11')][_0xce41('0x13')]);}else{logger[_0xce41('0x14')]('SalesforceConfiguration,\x20%s,\x20%s',_0x17cd57,_0xce41('0xf'));_0x4e9074(_0x4bd9b7[_0xce41('0x15')][_0xce41('0x13')]);}})[_0xce41('0x16')](function(_0x225154){logger[_0xce41('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x17cd57,_0x225154);_0x339ff5(_0x225154);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 7657c1c..1757c2e 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 _0x038b=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put'];(function(_0x39748d,_0x575a79){var _0x234575=function(_0x481904){while(--_0x481904){_0x39748d['push'](_0x39748d['shift']());}};_0x234575(++_0x575a79);}(_0x038b,0x114));var _0xb038=function(_0x3ec9a2,_0x5a34e9){_0x3ec9a2=_0x3ec9a2-0x0;var _0x29ded8=_0x038b[_0x3ec9a2];return _0x29ded8;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb038('0x4'));var config=require(_0xb038('0x5'));var controller=require('./intSalesforceField.controller');router[_0xb038('0x6')]('/',auth[_0xb038('0x7')](),controller['index']);router['get'](_0xb038('0x8'),auth[_0xb038('0x7')](),controller[_0xb038('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb038('0xa')]);router[_0xb038('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0xc')]);router[_0xb038('0xd')]('/:id',auth[_0xb038('0x7')](),controller[_0xb038('0xe')]);module[_0xb038('0xf')]=router; \ No newline at end of file +var _0x0adf=['post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x54cfaf,_0x59f305){var _0x4e80e3=function(_0x4ee6b7){while(--_0x4ee6b7){_0x54cfaf['push'](_0x54cfaf['shift']());}};_0x4e80e3(++_0x59f305);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x246971,_0x1670a2){_0x246971=_0x246971-0x0;var _0x580306=_0x0adf[_0x246971];return _0x580306;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var auth=require(_0xf0ad('0x5'));var interaction=require(_0xf0ad('0x6'));var config=require(_0xf0ad('0x7'));var controller=require(_0xf0ad('0x8'));router[_0xf0ad('0x9')]('/',auth['isAuthenticated'](),controller[_0xf0ad('0xa')]);router['get'](_0xf0ad('0xb'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xe')]('/',auth[_0xf0ad('0xc')](),controller[_0xf0ad('0xf')]);router[_0xf0ad('0x10')]('/:id',auth[_0xf0ad('0xc')](),controller['update']);router[_0xf0ad('0x11')](_0xf0ad('0xb'),auth[_0xf0ad('0xc')](),controller[_0xf0ad('0x12')]);module[_0xf0ad('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b5cf210..be902a3 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 _0xb26c=['STRING','customVariable','sequelize','ENUM','variable','keyValue','string'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0xb26c,0x11a));var _0xcb26=function(_0x206ce2,_0x2d674a){_0x206ce2=_0x206ce2-0x0;var _0x30801f=_0xb26c[_0x206ce2];return _0x30801f;};'use strict';var Sequelize=require(_0xcb26('0x0'));module['exports']={'type':{'type':Sequelize[_0xcb26('0x1')]('string',_0xcb26('0x2'),'customVariable',_0xcb26('0x3')),'defaultValue':_0xcb26('0x4')},'content':{'type':Sequelize[_0xcb26('0x5')]},'key':{'type':Sequelize[_0xcb26('0x5')]},'keyType':{'type':Sequelize[_0xcb26('0x1')](_0xcb26('0x4'),_0xcb26('0x2'),_0xcb26('0x6'))},'keyContent':{'type':Sequelize[_0xcb26('0x5')]},'idField':{'type':Sequelize[_0xcb26('0x5')]},'variableName':{'type':Sequelize[_0xcb26('0x5')]}}; \ No newline at end of file +var _0xf404=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xf404,0xfc));var _0x4f40=function(_0x3a022c,_0x415080){_0x3a022c=_0x3a022c-0x0;var _0x31518e=_0xf404[_0x3a022c];return _0x31518e;};'use strict';var Sequelize=require(_0x4f40('0x0'));module[_0x4f40('0x1')]={'type':{'type':Sequelize[_0x4f40('0x2')](_0x4f40('0x3'),_0x4f40('0x4'),_0x4f40('0x5'),_0x4f40('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4f40('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4f40('0x2')](_0x4f40('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4f40('0x7')]},'variableName':{'type':Sequelize[_0x4f40('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6b2fa41..e1a0ed6 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 _0xdd34=['end','json','count','offset','limit','set','Content-Range','reject','then','error','stack','name','send','index','map','SalesforceField','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','status'];(function(_0x380aa0,_0x421a5f){var _0x4fd55d=function(_0xfcde39){while(--_0xfcde39){_0x380aa0['push'](_0x380aa0['shift']());}};_0x4fd55d(++_0x421a5f);}(_0xdd34,0x1e5));var _0x4dd3=function(_0x34f13f,_0x379558){_0x34f13f=_0x34f13f-0x0;var _0x260789=_0xdd34[_0x34f13f];return _0x260789;};'use strict';var pdf=require(_0x4dd3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4dd3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4dd3('0x2'));var rp=require('request-promise');var moment=require(_0x4dd3('0x3'));var BPromise=require(_0x4dd3('0x4'));var Mustache=require(_0x4dd3('0x5'));var util=require('util');var path=require(_0x4dd3('0x6'));var sox=require('sox');var csv=require(_0x4dd3('0x7'));var ejs=require(_0x4dd3('0x8'));var fs=require('fs');var _=require(_0x4dd3('0x9'));var squel=require(_0x4dd3('0xa'));var crypto=require('crypto');var jsforce=require(_0x4dd3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4dd3('0x7'));var querystring=require(_0x4dd3('0xc'));var Papa=require(_0x4dd3('0xd'));var Redis=require('ioredis');var authService=require(_0x4dd3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4dd3('0xf'));var hardwareService=require(_0x4dd3('0x10'));var logger=require(_0x4dd3('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a308e,_0x1e34b9){_0x1e34b9=_0x1e34b9||0xcc;return function(_0x105a52){if(_0x105a52){return _0x2a308e['sendStatus'](_0x1e34b9);}return _0x2a308e[_0x4dd3('0x12')](_0x1e34b9)[_0x4dd3('0x13')]();};}function respondWithResult(_0x2c979f,_0x12511c){_0x12511c=_0x12511c||0xc8;return function(_0x30b944){if(_0x30b944){return _0x2c979f[_0x4dd3('0x12')](_0x12511c)[_0x4dd3('0x14')](_0x30b944);}};}function respondWithFilteredResult(_0x1958e6,_0x510c40){return function(_0x30fb78){if(_0x30fb78){var _0x17bd32=_0x30fb78[_0x4dd3('0x15')],_0x3a718b=_0x510c40['offset'],_0x16b376=_0x510c40[_0x4dd3('0x16')]+_0x510c40[_0x4dd3('0x17')],_0x5f59cb;if(_0x16b376>=_0x17bd32){_0x16b376=_0x17bd32;_0x5f59cb=0xc8;}else{_0x5f59cb=0xce;}_0x1958e6[_0x4dd3('0x12')](_0x5f59cb);return _0x1958e6[_0x4dd3('0x18')](_0x4dd3('0x19'),_0x3a718b+'-'+_0x16b376+'/'+_0x17bd32)[_0x4dd3('0x14')](_0x30fb78);}return null;};}function patchUpdates(_0x288eb2){return function(_0x34ca59){try{jsonpatch['apply'](_0x34ca59,_0x288eb2,!![]);}catch(_0x3c036c){return BPromise[_0x4dd3('0x1a')](_0x3c036c);}return _0x34ca59['save']();};}function saveUpdates(_0x20bebc,_0x3182cb){return function(_0x1fe538){if(_0x1fe538){return _0x1fe538['update'](_0x20bebc)[_0x4dd3('0x1b')](function(_0x222bdb){return _0x222bdb;});}return null;};}function removeEntity(_0x508ff4,_0x7acfda){return function(_0x2f7e23){if(_0x2f7e23){return _0x2f7e23['destroy']()[_0x4dd3('0x1b')](function(){_0x508ff4['status'](0xcc)[_0x4dd3('0x13')]();});}};}function handleEntityNotFound(_0x37da68,_0xf2a628){return function(_0x3fa045){if(!_0x3fa045){_0x37da68['sendStatus'](0x194);}return _0x3fa045;};}function handleError(_0x53ccb0,_0x12c111){_0x12c111=_0x12c111||0x1f4;return function(_0x1cc327){logger[_0x4dd3('0x1c')](_0x1cc327[_0x4dd3('0x1d')]);if(_0x1cc327['name']){delete _0x1cc327[_0x4dd3('0x1e')];}_0x53ccb0[_0x4dd3('0x12')](_0x12c111)[_0x4dd3('0x1f')](_0x1cc327);};}exports[_0x4dd3('0x20')]=function(_0x139f3b,_0x3eb392){var _0x175c86={},_0x40537c={},_0x21fac8={'count':0x0,'rows':[]};var _0x48e81b=_[_0x4dd3('0x21')](db[_0x4dd3('0x22')]['rawAttributes'],function(_0x36f29e){return{'name':_0x36f29e[_0x4dd3('0x23')],'type':_0x36f29e[_0x4dd3('0x24')][_0x4dd3('0x25')]};});_0x40537c[_0x4dd3('0x26')]=_['map'](_0x48e81b,_0x4dd3('0x1e'));_0x40537c['query']=_[_0x4dd3('0x27')](_0x139f3b[_0x4dd3('0x28')]);_0x40537c[_0x4dd3('0x29')]=_[_0x4dd3('0x2a')](_0x40537c['model'],_0x40537c[_0x4dd3('0x28')]);_0x175c86[_0x4dd3('0x2b')]=_[_0x4dd3('0x2a')](_0x40537c['model'],qs[_0x4dd3('0x2c')](_0x139f3b[_0x4dd3('0x28')][_0x4dd3('0x2c')]));_0x175c86[_0x4dd3('0x2b')]=_0x175c86[_0x4dd3('0x2b')][_0x4dd3('0x2d')]?_0x175c86[_0x4dd3('0x2b')]:_0x40537c[_0x4dd3('0x26')];if(!_0x139f3b[_0x4dd3('0x28')]['hasOwnProperty'](_0x4dd3('0x2e'))){_0x175c86[_0x4dd3('0x17')]=qs[_0x4dd3('0x17')](_0x139f3b[_0x4dd3('0x28')][_0x4dd3('0x17')]);_0x175c86[_0x4dd3('0x16')]=qs['offset'](_0x139f3b[_0x4dd3('0x28')]['offset']);}_0x175c86['order']=qs['sort'](_0x139f3b['query'][_0x4dd3('0x2f')]);_0x175c86[_0x4dd3('0x30')]=qs[_0x4dd3('0x29')](_[_0x4dd3('0x31')](_0x139f3b['query'],_0x40537c['filters']),_0x48e81b);if(_0x139f3b[_0x4dd3('0x28')][_0x4dd3('0x32')]){_0x175c86[_0x4dd3('0x30')]=_[_0x4dd3('0x33')](_0x175c86[_0x4dd3('0x30')],{'$or':_['map'](_0x48e81b,function(_0x5e532f){if(_0x5e532f['type']!==_0x4dd3('0x34')){var _0x12437f={};_0x12437f[_0x5e532f[_0x4dd3('0x1e')]]={'$like':'%'+_0x139f3b[_0x4dd3('0x28')][_0x4dd3('0x32')]+'%'};return _0x12437f;}})});}_0x175c86=_[_0x4dd3('0x33')]({},_0x175c86,_0x139f3b[_0x4dd3('0x35')]);var _0x4cb487={'where':_0x175c86['where']};return db[_0x4dd3('0x22')][_0x4dd3('0x15')](_0x4cb487)[_0x4dd3('0x1b')](function(_0x12a3f){_0x21fac8[_0x4dd3('0x15')]=_0x12a3f;if(_0x139f3b[_0x4dd3('0x28')][_0x4dd3('0x36')]){_0x175c86[_0x4dd3('0x37')]=[{'all':!![]}];}return db[_0x4dd3('0x22')]['findAll'](_0x175c86);})['then'](function(_0x418b0b){_0x21fac8[_0x4dd3('0x38')]=_0x418b0b;return _0x21fac8;})['then'](respondWithFilteredResult(_0x3eb392,_0x175c86))[_0x4dd3('0x39')](handleError(_0x3eb392,null));};exports['show']=function(_0x331ffd,_0x326c09){var _0xd1d7a1={'raw':!![],'where':{'id':_0x331ffd[_0x4dd3('0x3a')]['id']}},_0x28d4a7={};_0x28d4a7[_0x4dd3('0x26')]=_[_0x4dd3('0x27')](db[_0x4dd3('0x22')][_0x4dd3('0x3b')]);_0x28d4a7[_0x4dd3('0x28')]=_[_0x4dd3('0x27')](_0x331ffd[_0x4dd3('0x28')]);_0x28d4a7[_0x4dd3('0x29')]=_['intersection'](_0x28d4a7['model'],_0x28d4a7[_0x4dd3('0x28')]);_0xd1d7a1[_0x4dd3('0x2b')]=_[_0x4dd3('0x2a')](_0x28d4a7[_0x4dd3('0x26')],qs[_0x4dd3('0x2c')](_0x331ffd[_0x4dd3('0x28')][_0x4dd3('0x2c')]));_0xd1d7a1['attributes']=_0xd1d7a1[_0x4dd3('0x2b')][_0x4dd3('0x2d')]?_0xd1d7a1[_0x4dd3('0x2b')]:_0x28d4a7['model'];if(_0x331ffd[_0x4dd3('0x28')][_0x4dd3('0x36')]){_0xd1d7a1['include']=[{'all':!![]}];}_0xd1d7a1=_[_0x4dd3('0x33')]({},_0xd1d7a1,_0x331ffd[_0x4dd3('0x35')]);return db['SalesforceField'][_0x4dd3('0x3c')](_0xd1d7a1)[_0x4dd3('0x1b')](handleEntityNotFound(_0x326c09,null))[_0x4dd3('0x1b')](respondWithResult(_0x326c09,null))['catch'](handleError(_0x326c09,null));};exports[_0x4dd3('0x3d')]=function(_0x1ab1db,_0x2e3a60){return db[_0x4dd3('0x22')][_0x4dd3('0x3d')](_0x1ab1db[_0x4dd3('0x3e')],{})['then'](respondWithResult(_0x2e3a60,0xc9))['catch'](handleError(_0x2e3a60,null));};exports['update']=function(_0xf99a7a,_0x38184f){if(_0xf99a7a[_0x4dd3('0x3e')]['id']){delete _0xf99a7a[_0x4dd3('0x3e')]['id'];}return db[_0x4dd3('0x22')][_0x4dd3('0x3c')]({'where':{'id':_0xf99a7a['params']['id']}})[_0x4dd3('0x1b')](handleEntityNotFound(_0x38184f,null))['then'](saveUpdates(_0xf99a7a[_0x4dd3('0x3e')],null))[_0x4dd3('0x1b')](respondWithResult(_0x38184f,null))[_0x4dd3('0x39')](handleError(_0x38184f,null));};exports['destroy']=function(_0x4c3e4d,_0x4e6cd0){return db['SalesforceField'][_0x4dd3('0x3c')]({'where':{'id':_0x4c3e4d[_0x4dd3('0x3a')]['id']}})[_0x4dd3('0x1b')](handleEntityNotFound(_0x4e6cd0,null))['then'](removeEntity(_0x4e6cd0,null))['catch'](handleError(_0x4e6cd0,null));}; \ No newline at end of file +var _0x6748=['fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','SalesforceField','rawAttributes'];(function(_0x4b5a92,_0x2cf3d6){var _0x439fab=function(_0x122ae4){while(--_0x122ae4){_0x4b5a92['push'](_0x4b5a92['shift']());}};_0x439fab(++_0x2cf3d6);}(_0x6748,0xae));var _0x8674=function(_0x2d7371,_0x4f0afe){_0x2d7371=_0x2d7371-0x0;var _0x22e511=_0x6748[_0x2d7371];return _0x22e511;};'use strict';var pdf=require(_0x8674('0x0'));var emlformat=require(_0x8674('0x1'));var rimraf=require(_0x8674('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8674('0x3'));var rp=require(_0x8674('0x4'));var moment=require(_0x8674('0x5'));var BPromise=require(_0x8674('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8674('0x7'));var sox=require(_0x8674('0x8'));var csv=require('to-csv');var ejs=require(_0x8674('0x9'));var fs=require('fs');var _=require(_0x8674('0xa'));var squel=require('squel');var crypto=require(_0x8674('0xb'));var jsforce=require(_0x8674('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8674('0xd'));var querystring=require(_0x8674('0xe'));var Papa=require('papaparse');var Redis=require(_0x8674('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8674('0x10'));var hardwareService=require(_0x8674('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x8674('0x12'));var config=require(_0x8674('0x13'));var db=require(_0x8674('0x14'))['db'];function respondWithStatusCode(_0x760a18,_0x40ffd3){_0x40ffd3=_0x40ffd3||0xcc;return function(_0x46eadc){if(_0x46eadc){return _0x760a18['sendStatus'](_0x40ffd3);}return _0x760a18[_0x8674('0x15')](_0x40ffd3)[_0x8674('0x16')]();};}function respondWithResult(_0x4f3532,_0xa63bad){_0xa63bad=_0xa63bad||0xc8;return function(_0x21225c){if(_0x21225c){return _0x4f3532[_0x8674('0x15')](_0xa63bad)['json'](_0x21225c);}};}function respondWithFilteredResult(_0x2fe59a,_0x2de02d){return function(_0x28c950){if(_0x28c950){var _0x25f1de=_0x28c950['count'],_0x43effb=_0x2de02d[_0x8674('0x17')],_0x2e1654=_0x2de02d['offset']+_0x2de02d[_0x8674('0x18')],_0x432c3e;if(_0x2e1654>=_0x25f1de){_0x2e1654=_0x25f1de;_0x432c3e=0xc8;}else{_0x432c3e=0xce;}_0x2fe59a[_0x8674('0x15')](_0x432c3e);return _0x2fe59a[_0x8674('0x19')](_0x8674('0x1a'),_0x43effb+'-'+_0x2e1654+'/'+_0x25f1de)['json'](_0x28c950);}return null;};}function patchUpdates(_0x12a496){return function(_0x31234b){try{jsonpatch[_0x8674('0x1b')](_0x31234b,_0x12a496,!![]);}catch(_0xa97f91){return BPromise[_0x8674('0x1c')](_0xa97f91);}return _0x31234b[_0x8674('0x1d')]();};}function saveUpdates(_0x34c2af,_0x37d76a){return function(_0x57fae3){if(_0x57fae3){return _0x57fae3['update'](_0x34c2af)['then'](function(_0x42e878){return _0x42e878;});}return null;};}function removeEntity(_0x3c70db,_0xe1fdd2){return function(_0x18fbb7){if(_0x18fbb7){return _0x18fbb7[_0x8674('0x1e')]()[_0x8674('0x1f')](function(){_0x3c70db[_0x8674('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x341b8f,_0x18131b){return function(_0x9f6a6){if(!_0x9f6a6){_0x341b8f['sendStatus'](0x194);}return _0x9f6a6;};}function handleError(_0x4560c7,_0x334039){_0x334039=_0x334039||0x1f4;return function(_0x2415e7){logger[_0x8674('0x20')](_0x2415e7[_0x8674('0x21')]);if(_0x2415e7['name']){delete _0x2415e7[_0x8674('0x22')];}_0x4560c7[_0x8674('0x15')](_0x334039)['send'](_0x2415e7);};}exports[_0x8674('0x23')]=function(_0x1f51a9,_0x4282a9){var _0x46634a={},_0x4779a0={},_0x2f9840={'count':0x0,'rows':[]};var _0x21b8e1=_[_0x8674('0x24')](db[_0x8674('0x25')][_0x8674('0x26')],function(_0x2908c6){return{'name':_0x2908c6[_0x8674('0x27')],'type':_0x2908c6[_0x8674('0x28')][_0x8674('0x29')]};});_0x4779a0['model']=_[_0x8674('0x24')](_0x21b8e1,_0x8674('0x22'));_0x4779a0[_0x8674('0x2a')]=_['keys'](_0x1f51a9[_0x8674('0x2a')]);_0x4779a0['filters']=_[_0x8674('0x2b')](_0x4779a0[_0x8674('0x2c')],_0x4779a0['query']);_0x46634a[_0x8674('0x2d')]=_[_0x8674('0x2b')](_0x4779a0['model'],qs[_0x8674('0x2e')](_0x1f51a9[_0x8674('0x2a')]['fields']));_0x46634a['attributes']=_0x46634a[_0x8674('0x2d')]['length']?_0x46634a['attributes']:_0x4779a0['model'];if(!_0x1f51a9[_0x8674('0x2a')][_0x8674('0x2f')](_0x8674('0x30'))){_0x46634a[_0x8674('0x18')]=qs[_0x8674('0x18')](_0x1f51a9[_0x8674('0x2a')][_0x8674('0x18')]);_0x46634a[_0x8674('0x17')]=qs[_0x8674('0x17')](_0x1f51a9[_0x8674('0x2a')][_0x8674('0x17')]);}_0x46634a[_0x8674('0x31')]=qs[_0x8674('0x32')](_0x1f51a9[_0x8674('0x2a')][_0x8674('0x32')]);_0x46634a['where']=qs[_0x8674('0x33')](_[_0x8674('0x34')](_0x1f51a9[_0x8674('0x2a')],_0x4779a0[_0x8674('0x33')]),_0x21b8e1);if(_0x1f51a9[_0x8674('0x2a')][_0x8674('0x35')]){_0x46634a[_0x8674('0x36')]=_[_0x8674('0x37')](_0x46634a[_0x8674('0x36')],{'$or':_[_0x8674('0x24')](_0x21b8e1,function(_0x1a6920){if(_0x1a6920[_0x8674('0x28')]!=='VIRTUAL'){var _0x3d2e9e={};_0x3d2e9e[_0x1a6920[_0x8674('0x22')]]={'$like':'%'+_0x1f51a9[_0x8674('0x2a')][_0x8674('0x35')]+'%'};return _0x3d2e9e;}})});}_0x46634a=_[_0x8674('0x37')]({},_0x46634a,_0x1f51a9['options']);var _0x2db4e1={'where':_0x46634a[_0x8674('0x36')]};return db[_0x8674('0x25')][_0x8674('0x38')](_0x2db4e1)['then'](function(_0x4da151){_0x2f9840[_0x8674('0x38')]=_0x4da151;if(_0x1f51a9['query'][_0x8674('0x39')]){_0x46634a[_0x8674('0x3a')]=[{'all':!![]}];}return db[_0x8674('0x25')][_0x8674('0x3b')](_0x46634a);})[_0x8674('0x1f')](function(_0x18cbd2){_0x2f9840[_0x8674('0x3c')]=_0x18cbd2;return _0x2f9840;})[_0x8674('0x1f')](respondWithFilteredResult(_0x4282a9,_0x46634a))[_0x8674('0x3d')](handleError(_0x4282a9,null));};exports[_0x8674('0x3e')]=function(_0xf59e4,_0x5514de){var _0x2edd10={'raw':!![],'where':{'id':_0xf59e4[_0x8674('0x3f')]['id']}},_0x591231={};_0x591231['model']=_[_0x8674('0x40')](db[_0x8674('0x25')][_0x8674('0x26')]);_0x591231[_0x8674('0x2a')]=_[_0x8674('0x40')](_0xf59e4[_0x8674('0x2a')]);_0x591231[_0x8674('0x33')]=_['intersection'](_0x591231[_0x8674('0x2c')],_0x591231['query']);_0x2edd10['attributes']=_[_0x8674('0x2b')](_0x591231[_0x8674('0x2c')],qs['fields'](_0xf59e4['query'][_0x8674('0x2e')]));_0x2edd10['attributes']=_0x2edd10['attributes'][_0x8674('0x41')]?_0x2edd10[_0x8674('0x2d')]:_0x591231[_0x8674('0x2c')];if(_0xf59e4['query'][_0x8674('0x39')]){_0x2edd10['include']=[{'all':!![]}];}_0x2edd10=_['merge']({},_0x2edd10,_0xf59e4[_0x8674('0x42')]);return db['SalesforceField'][_0x8674('0x43')](_0x2edd10)[_0x8674('0x1f')](handleEntityNotFound(_0x5514de,null))[_0x8674('0x1f')](respondWithResult(_0x5514de,null))[_0x8674('0x3d')](handleError(_0x5514de,null));};exports['create']=function(_0x4bb9e2,_0x5b0c60){return db[_0x8674('0x25')][_0x8674('0x44')](_0x4bb9e2[_0x8674('0x45')],{})[_0x8674('0x1f')](respondWithResult(_0x5b0c60,0xc9))[_0x8674('0x3d')](handleError(_0x5b0c60,null));};exports[_0x8674('0x46')]=function(_0x51f237,_0xebb5ee){if(_0x51f237[_0x8674('0x45')]['id']){delete _0x51f237[_0x8674('0x45')]['id'];}return db[_0x8674('0x25')]['find']({'where':{'id':_0x51f237['params']['id']}})[_0x8674('0x1f')](handleEntityNotFound(_0xebb5ee,null))['then'](saveUpdates(_0x51f237[_0x8674('0x45')],null))[_0x8674('0x1f')](respondWithResult(_0xebb5ee,null))[_0x8674('0x3d')](handleError(_0xebb5ee,null));};exports[_0x8674('0x1e')]=function(_0x168347,_0x1ca30c){return db[_0x8674('0x25')][_0x8674('0x43')]({'where':{'id':_0x168347[_0x8674('0x3f')]['id']}})[_0x8674('0x1f')](handleEntityNotFound(_0x1ca30c,null))[_0x8674('0x1f')](removeEntity(_0x1ca30c,null))['catch'](handleError(_0x1ca30c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 56d2f23..56dd22e 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 _0x8716=['./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','FieldId','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x8ae98b,_0x155f88){var _0xc30bd4=function(_0x5ca462){while(--_0x5ca462){_0x8ae98b['push'](_0x8ae98b['shift']());}};_0xc30bd4(++_0x155f88);}(_0x8716,0x165));var _0x6871=function(_0x1be834,_0x3665dc){_0x1be834=_0x1be834-0x0;var _0x2383af=_0x8716[_0x1be834];return _0x2383af;};'use strict';var _=require('lodash');var util=require(_0x6871('0x0'));var logger=require(_0x6871('0x1'))(_0x6871('0x2'));var moment=require(_0x6871('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6871('0x4'));var rimraf=require(_0x6871('0x5'));var config=require(_0x6871('0x6'));var attributes=require(_0x6871('0x7'));module[_0x6871('0x8')]=function(_0x5c4054,_0x2f89bf){return _0x5c4054[_0x6871('0x9')]('SalesforceField',attributes,{'tableName':_0x6871('0xa'),'paranoid':![],'indexes':[{'name':_0x6871('0xb'),'fields':['idField',_0x6871('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa14d=['./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','idField','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xa14d,0x95));var _0xda14=function(_0x1d5531,_0x4e9bbb){_0x1d5531=_0x1d5531-0x0;var _0x105e17=_0xa14d[_0x1d5531];return _0x105e17;};'use strict';var _=require(_0xda14('0x0'));var util=require(_0xda14('0x1'));var logger=require('../../config/logger')(_0xda14('0x2'));var moment=require('moment');var BPromise=require(_0xda14('0x3'));var rp=require(_0xda14('0x4'));var fs=require('fs');var path=require(_0xda14('0x5'));var rimraf=require(_0xda14('0x6'));var config=require('../../config/environment');var attributes=require(_0xda14('0x7'));module[_0xda14('0x8')]=function(_0x27a4a8,_0x4db5ed){return _0x27a4a8['define'](_0xda14('0x9'),attributes,{'tableName':_0xda14('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xda14('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 8b81a48..6c3b1db 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 _0x0713=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2d7439,_0x39e962){var _0x549357=function(_0x5454f7){while(--_0x5454f7){_0x2d7439['push'](_0x2d7439['shift']());}};_0x549357(++_0x39e962);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('SalesforceField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('SalesforceField,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('SalesforceField,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x233d67,_0x24f881){var _0x5616e5=function(_0x1ae3bb){while(--_0x1ae3bb){_0x233d67['push'](_0x233d67['shift']());}};_0x5616e5(++_0x24f881);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0xcb91[_0x54eab6];return _0x1e7435;};'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')]('SalesforceField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 2a2d9a1..f4742bd 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 _0xff98=['destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xff98,0x9c));var _0x8ff9=function(_0x37a710,_0x1f94bc){_0x37a710=_0x37a710-0x0;var _0x400e5f=_0xff98[_0x37a710];return _0x400e5f;};'use strict';var multer=require('multer');var util=require(_0x8ff9('0x0'));var path=require(_0x8ff9('0x1'));var timeout=require(_0x8ff9('0x2'));var express=require(_0x8ff9('0x3'));var router=express['Router']();var auth=require(_0x8ff9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8ff9('0x5'));var controller=require('./intServicenowAccount.controller');router[_0x8ff9('0x6')]('/',auth['isAuthenticated'](),controller[_0x8ff9('0x7')]);router[_0x8ff9('0x6')](_0x8ff9('0x8'),auth[_0x8ff9('0x9')](),controller[_0x8ff9('0xa')]);router[_0x8ff9('0x6')](_0x8ff9('0xb'),auth[_0x8ff9('0x9')](),controller['getConfigurations']);router[_0x8ff9('0x6')](_0x8ff9('0xc'),auth[_0x8ff9('0x9')](),controller[_0x8ff9('0xd')]);router[_0x8ff9('0xe')]('/',auth[_0x8ff9('0x9')](),controller[_0x8ff9('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x8ff9('0x10')]);router[_0x8ff9('0x11')](_0x8ff9('0x8'),auth['isAuthenticated'](),controller[_0x8ff9('0x12')]);router[_0x8ff9('0x13')](_0x8ff9('0x8'),auth[_0x8ff9('0x9')](),controller[_0x8ff9('0x14')]);module[_0x8ff9('0x15')]=router; \ No newline at end of file +var _0x2a56=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated'];(function(_0x3b3e87,_0x8c001b){var _0x42513f=function(_0x1989cf){while(--_0x1989cf){_0x3b3e87['push'](_0x3b3e87['shift']());}};_0x42513f(++_0x8c001b);}(_0x2a56,0xaf));var _0x62a5=function(_0x578b25,_0x5be828){_0x578b25=_0x578b25-0x0;var _0x5c533d=_0x2a56[_0x578b25];return _0x5c533d;};'use strict';var multer=require('multer');var util=require(_0x62a5('0x0'));var path=require('path');var timeout=require(_0x62a5('0x1'));var express=require(_0x62a5('0x2'));var router=express[_0x62a5('0x3')]();var auth=require(_0x62a5('0x4'));var interaction=require(_0x62a5('0x5'));var config=require('../../config/environment');var controller=require(_0x62a5('0x6'));router[_0x62a5('0x7')]('/',auth[_0x62a5('0x8')](),controller[_0x62a5('0x9')]);router[_0x62a5('0x7')](_0x62a5('0xa'),auth[_0x62a5('0x8')](),controller[_0x62a5('0xb')]);router['get'](_0x62a5('0xc'),auth[_0x62a5('0x8')](),controller[_0x62a5('0xd')]);router[_0x62a5('0x7')](_0x62a5('0xe'),auth['isAuthenticated'](),controller[_0x62a5('0xf')]);router[_0x62a5('0x10')]('/',auth[_0x62a5('0x8')](),controller[_0x62a5('0x11')]);router[_0x62a5('0x10')](_0x62a5('0xc'),auth[_0x62a5('0x8')](),controller[_0x62a5('0x12')]);router[_0x62a5('0x13')]('/:id',auth[_0x62a5('0x8')](),controller[_0x62a5('0x14')]);router[_0x62a5('0x15')](_0x62a5('0xa'),auth['isAuthenticated'](),controller[_0x62a5('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 295ccf2..77e52da 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 _0x639e=['STRING','username'];(function(_0x110499,_0x235bcd){var _0x1bbca6=function(_0x5686ab){while(--_0x5686ab){_0x110499['push'](_0x110499['shift']());}};_0x1bbca6(++_0x235bcd);}(_0x639e,0x1ca));var _0xe639=function(_0x1286d5,_0x5c2870){_0x1286d5=_0x1286d5-0x0;var _0x1e06b0=_0x639e[_0x1286d5];return _0x1e06b0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe639('0x0')]},'description':{'type':Sequelize[_0xe639('0x0')]},'username':{'type':Sequelize[_0xe639('0x0')],'unique':_0xe639('0x1')},'password':{'type':Sequelize[_0xe639('0x0')]},'email':{'type':Sequelize[_0xe639('0x0')]},'remoteUri':{'type':Sequelize[_0xe639('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe639('0x0')]}}; \ No newline at end of file +var _0x9314=['remoteUri','exports','STRING','username'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x9314,0x181));var _0x4931=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9314[_0x50a0c2];return _0x5ebadd;};'use strict';var Sequelize=require('sequelize');module[_0x4931('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4931('0x1')]},'username':{'type':Sequelize[_0x4931('0x1')],'unique':_0x4931('0x2')},'password':{'type':Sequelize[_0x4931('0x1')]},'email':{'type':Sequelize[_0x4931('0x1')]},'remoteUri':{'type':Sequelize[_0x4931('0x1')],'unique':_0x4931('0x3')},'serverUrl':{'type':Sequelize[_0x4931('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 8fc4f18..d213180 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 _0xeb9e=['map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','count','include','findAll','rows','show','params','includeAll','find','create','update','body','findOne','ServicenowConfiguration','pick','options','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','made_sla','hold_reason','subcategory','close_code','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','additional_assignee_list','description','calendar_duration','closed_by','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','severity','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','all','assign','TCL:\x20_object','push','concat','statusCode','Wrong\x20credentials','boolean','False','false','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','status','json','limit','set','reject','save','destroy','then','end','sendStatus','name','send'];(function(_0x4f4a9b,_0x129af9){var _0x15d63b=function(_0x460666){while(--_0x460666){_0x4f4a9b['push'](_0x4f4a9b['shift']());}};_0x15d63b(++_0x129af9);}(_0xeb9e,0x143));var _0xeeb9=function(_0x11c1ff,_0x47da8b){_0x11c1ff=_0x11c1ff-0x0;var _0x17ca4f=_0xeb9e[_0x11c1ff];return _0x17ca4f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeeb9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeeb9('0x1'));var jsonpatch=require(_0xeeb9('0x2'));var rp=require(_0xeeb9('0x3'));var moment=require(_0xeeb9('0x4'));var BPromise=require(_0xeeb9('0x5'));var Mustache=require(_0xeeb9('0x6'));var util=require(_0xeeb9('0x7'));var path=require(_0xeeb9('0x8'));var sox=require(_0xeeb9('0x9'));var csv=require(_0xeeb9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xeeb9('0xb'));var crypto=require(_0xeeb9('0xc'));var jsforce=require(_0xeeb9('0xd'));var deskjs=require(_0xeeb9('0xe'));var toCsv=require(_0xeeb9('0xa'));var querystring=require('querystring');var Papa=require(_0xeeb9('0xf'));var Redis=require(_0xeeb9('0x10'));var authService=require(_0xeeb9('0x11'));var qs=require(_0xeeb9('0x12'));var as=require(_0xeeb9('0x13'));var hardwareService=require(_0xeeb9('0x14'));var logger=require(_0xeeb9('0x15'))(_0xeeb9('0x16'));var utils=require(_0xeeb9('0x17'));var config=require('../../config/environment');var db=require(_0xeeb9('0x18'))['db'];var integrations=require(_0xeeb9('0x19'));var jayson=require(_0xeeb9('0x1a'));var client=jayson[_0xeeb9('0x1b')][_0xeeb9('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3b1dbc,_0x5f2819,_0x5e6e62){if(_0x5e6e62){var _0x16bb16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16bb16[_0xeeb9('0x1d')](_0x5f2819)){return _0x3b1dbc;}else{throw new db[(_0xeeb9('0x1e'))]['ValidationError'](_0xeeb9('0x1f'));}}else{return _0x3b1dbc;}}function respondWithRpcPromise(_0x414db5,_0xc08e2,_0x489f22,_0x58dd50){return new BPromise(function(_0x2dee52,_0x5f156f){var _0x31bd47=_0x58dd50||client;return _0x31bd47[_0xeeb9('0x20')](_0x414db5,_0x489f22)['then'](function(_0x437bd4){logger[_0xeeb9('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0xc08e2,_0xeeb9('0x22'));logger['debug'](_0xeeb9('0x23'),_0xc08e2,_0xeeb9('0x22'),JSON[_0xeeb9('0x24')](_0x437bd4));if(_0x437bd4[_0xeeb9('0x25')]){if(_0x437bd4[_0xeeb9('0x25')][_0xeeb9('0x26')]===0x1f4){logger['error'](_0xeeb9('0x27'),_0xc08e2,_0x437bd4[_0xeeb9('0x25')][_0xeeb9('0x28')]);return _0x5f156f(_0x437bd4[_0xeeb9('0x25')]['message']);}logger[_0xeeb9('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0xc08e2,_0x437bd4[_0xeeb9('0x25')][_0xeeb9('0x28')]);return _0x2dee52(_0x437bd4[_0xeeb9('0x25')]['message']);}else{logger[_0xeeb9('0x21')]('ServicenowAccount,\x20%s,\x20%s',_0xc08e2,_0xeeb9('0x22'));_0x2dee52(_0x437bd4[_0xeeb9('0x29')][_0xeeb9('0x28')]);}})[_0xeeb9('0x2a')](function(_0x5d4c6a){logger[_0xeeb9('0x25')](_0xeeb9('0x27'),_0xc08e2,_0x5d4c6a);_0x5f156f(_0x5d4c6a);});});}function respondWithStatusCode(_0x55bc86,_0xd56705){_0xd56705=_0xd56705||0xcc;return function(_0x3cb470){if(_0x3cb470){return _0x55bc86['sendStatus'](_0xd56705);}return _0x55bc86[_0xeeb9('0x2b')](_0xd56705)['end']();};}function respondWithResult(_0x13fc81,_0x193da){_0x193da=_0x193da||0xc8;return function(_0x35dfb2){if(_0x35dfb2){return _0x13fc81[_0xeeb9('0x2b')](_0x193da)[_0xeeb9('0x2c')](_0x35dfb2);}};}function respondWithFilteredResult(_0x40027f,_0x3f6379){return function(_0x5d7d08){if(_0x5d7d08){var _0xe1da9=_0x5d7d08['count'],_0x21a627=_0x3f6379['offset'],_0x48f227=_0x3f6379['offset']+_0x3f6379[_0xeeb9('0x2d')],_0x1f1ec1;if(_0x48f227>=_0xe1da9){_0x48f227=_0xe1da9;_0x1f1ec1=0xc8;}else{_0x1f1ec1=0xce;}_0x40027f[_0xeeb9('0x2b')](_0x1f1ec1);return _0x40027f[_0xeeb9('0x2e')]('Content-Range',_0x21a627+'-'+_0x48f227+'/'+_0xe1da9)[_0xeeb9('0x2c')](_0x5d7d08);}return null;};}function patchUpdates(_0x82517b){return function(_0x20e3df){try{jsonpatch['apply'](_0x20e3df,_0x82517b,!![]);}catch(_0x5d6e7d){return BPromise[_0xeeb9('0x2f')](_0x5d6e7d);}return _0x20e3df[_0xeeb9('0x30')]();};}function saveUpdates(_0x3c692b,_0x4cbb58){return function(_0x5b3bc7){if(_0x5b3bc7){return _0x5b3bc7['update'](_0x3c692b)['then'](function(_0x27894e){return _0x27894e;});}return null;};}function removeEntity(_0x94ba1b,_0x204b21){return function(_0x549d93){if(_0x549d93){return _0x549d93[_0xeeb9('0x31')]()[_0xeeb9('0x32')](function(){_0x94ba1b['status'](0xcc)[_0xeeb9('0x33')]();});}};}function handleEntityNotFound(_0x307d95,_0x411996){return function(_0x15e0b8){if(!_0x15e0b8){_0x307d95[_0xeeb9('0x34')](0x194);}return _0x15e0b8;};}function handleError(_0x56258a,_0x2a708a){_0x2a708a=_0x2a708a||0x1f4;return function(_0x5530ba){logger[_0xeeb9('0x25')](_0x5530ba['stack']);if(_0x5530ba[_0xeeb9('0x35')]){delete _0x5530ba['name'];}_0x56258a['status'](_0x2a708a)[_0xeeb9('0x36')](_0x5530ba);};}exports['index']=function(_0x4f6ff1,_0x493569){var _0x30caba={},_0x1bb120={},_0x3f6d57={'count':0x0,'rows':[]};var _0x3584d3=_[_0xeeb9('0x37')](db[_0xeeb9('0x38')][_0xeeb9('0x39')],function(_0x1c3a6d){return{'name':_0x1c3a6d[_0xeeb9('0x3a')],'type':_0x1c3a6d[_0xeeb9('0x3b')]['key']};});_0x1bb120[_0xeeb9('0x3c')]=_[_0xeeb9('0x37')](_0x3584d3,_0xeeb9('0x35'));_0x1bb120[_0xeeb9('0x3d')]=_[_0xeeb9('0x3e')](_0x4f6ff1[_0xeeb9('0x3d')]);_0x1bb120[_0xeeb9('0x3f')]=_[_0xeeb9('0x40')](_0x1bb120[_0xeeb9('0x3c')],_0x1bb120[_0xeeb9('0x3d')]);_0x30caba[_0xeeb9('0x41')]=_['intersection'](_0x1bb120[_0xeeb9('0x3c')],qs[_0xeeb9('0x42')](_0x4f6ff1['query']['fields']));_0x30caba[_0xeeb9('0x41')]=_0x30caba[_0xeeb9('0x41')][_0xeeb9('0x43')]?_0x30caba[_0xeeb9('0x41')]:_0x1bb120[_0xeeb9('0x3c')];if(!_0x4f6ff1[_0xeeb9('0x3d')][_0xeeb9('0x44')](_0xeeb9('0x45'))){_0x30caba[_0xeeb9('0x2d')]=qs[_0xeeb9('0x2d')](_0x4f6ff1['query'][_0xeeb9('0x2d')]);_0x30caba[_0xeeb9('0x46')]=qs[_0xeeb9('0x46')](_0x4f6ff1[_0xeeb9('0x3d')][_0xeeb9('0x46')]);}_0x30caba[_0xeeb9('0x47')]=qs[_0xeeb9('0x48')](_0x4f6ff1[_0xeeb9('0x3d')][_0xeeb9('0x48')]);_0x30caba[_0xeeb9('0x49')]=qs[_0xeeb9('0x3f')](_['pick'](_0x4f6ff1[_0xeeb9('0x3d')],_0x1bb120[_0xeeb9('0x3f')]),_0x3584d3);if(_0x4f6ff1[_0xeeb9('0x3d')][_0xeeb9('0x4a')]){_0x30caba[_0xeeb9('0x49')]=_[_0xeeb9('0x4b')](_0x30caba[_0xeeb9('0x49')],{'$or':_[_0xeeb9('0x37')](_0x3584d3,function(_0x579273){if(_0x579273[_0xeeb9('0x3b')]!=='VIRTUAL'){var _0x3e8c86={};_0x3e8c86[_0x579273[_0xeeb9('0x35')]]={'$like':'%'+_0x4f6ff1[_0xeeb9('0x3d')][_0xeeb9('0x4a')]+'%'};return _0x3e8c86;}})});}_0x30caba=_['merge']({},_0x30caba,_0x4f6ff1['options']);var _0x2ef659={'where':_0x30caba[_0xeeb9('0x49')]};return db[_0xeeb9('0x38')][_0xeeb9('0x4c')](_0x2ef659)[_0xeeb9('0x32')](function(_0x3b8162){_0x3f6d57[_0xeeb9('0x4c')]=_0x3b8162;if(_0x4f6ff1[_0xeeb9('0x3d')]['includeAll']){_0x30caba[_0xeeb9('0x4d')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xeeb9('0x4e')](_0x30caba);})[_0xeeb9('0x32')](function(_0x322b1f){_0x3f6d57[_0xeeb9('0x4f')]=_0x322b1f;return _0x3f6d57;})[_0xeeb9('0x32')](respondWithFilteredResult(_0x493569,_0x30caba))[_0xeeb9('0x2a')](handleError(_0x493569,null));};exports[_0xeeb9('0x50')]=function(_0x17a75d,_0x5cb6e9){var _0x560071={'raw':![],'where':{'id':_0x17a75d[_0xeeb9('0x51')]['id']}},_0x1848e3={};_0x1848e3[_0xeeb9('0x3c')]=_[_0xeeb9('0x3e')](db[_0xeeb9('0x38')][_0xeeb9('0x39')]);_0x1848e3['query']=_[_0xeeb9('0x3e')](_0x17a75d['query']);_0x1848e3[_0xeeb9('0x3f')]=_[_0xeeb9('0x40')](_0x1848e3['model'],_0x1848e3['query']);_0x560071[_0xeeb9('0x41')]=_[_0xeeb9('0x40')](_0x1848e3[_0xeeb9('0x3c')],qs[_0xeeb9('0x42')](_0x17a75d[_0xeeb9('0x3d')]['fields']));_0x560071[_0xeeb9('0x41')]=_0x560071['attributes'][_0xeeb9('0x43')]?_0x560071[_0xeeb9('0x41')]:_0x1848e3[_0xeeb9('0x3c')];if(_0x17a75d[_0xeeb9('0x3d')][_0xeeb9('0x52')]){_0x560071[_0xeeb9('0x4d')]=[{'all':!![]}];}_0x560071=_[_0xeeb9('0x4b')]({},_0x560071,_0x17a75d['options']);return db[_0xeeb9('0x38')][_0xeeb9('0x53')](_0x560071)[_0xeeb9('0x32')](handleEntityNotFound(_0x5cb6e9,null))[_0xeeb9('0x32')](respondWithResult(_0x5cb6e9,null))['catch'](handleError(_0x5cb6e9,null));};exports[_0xeeb9('0x54')]=function(_0x238751,_0x583683){return db['ServicenowAccount'][_0xeeb9('0x54')](_0x238751['body'],{})['then'](respondWithResult(_0x583683,0xc9))[_0xeeb9('0x2a')](handleError(_0x583683,null));};exports[_0xeeb9('0x55')]=function(_0x2e66ed,_0x519d12){if(_0x2e66ed['body']['id']){delete _0x2e66ed['body']['id'];}return db[_0xeeb9('0x38')][_0xeeb9('0x53')]({'where':{'id':_0x2e66ed[_0xeeb9('0x51')]['id']}})['then'](handleEntityNotFound(_0x519d12,null))[_0xeeb9('0x32')](saveUpdates(_0x2e66ed[_0xeeb9('0x56')],null))[_0xeeb9('0x32')](respondWithResult(_0x519d12,null))[_0xeeb9('0x2a')](handleError(_0x519d12,null));};exports['destroy']=function(_0x5064ca,_0x1c8f59){return db['ServicenowAccount']['find']({'where':{'id':_0x5064ca[_0xeeb9('0x51')]['id']}})[_0xeeb9('0x32')](handleEntityNotFound(_0x1c8f59,null))[_0xeeb9('0x32')](removeEntity(_0x1c8f59,null))['catch'](handleError(_0x1c8f59,null));};exports['getConfigurations']=function(_0x1329df,_0x293d1a,_0x49fd7a){var _0x47e388={};var _0x3e4e9e={};var _0x27bd59;var _0x470721;return db[_0xeeb9('0x38')][_0xeeb9('0x57')]({'where':{'id':_0x1329df[_0xeeb9('0x51')]['id']}})[_0xeeb9('0x32')](handleEntityNotFound(_0x293d1a,null))[_0xeeb9('0x32')](function(_0x45601a){if(_0x45601a){_0x27bd59=_0x45601a;_0x3e4e9e['model']=_[_0xeeb9('0x3e')](db[_0xeeb9('0x58')]['rawAttributes']);_0x3e4e9e[_0xeeb9('0x3d')]=_['keys'](_0x1329df[_0xeeb9('0x3d')]);_0x3e4e9e[_0xeeb9('0x3f')]=_['intersection'](_0x3e4e9e[_0xeeb9('0x3c')],_0x3e4e9e[_0xeeb9('0x3d')]);_0x47e388[_0xeeb9('0x41')]=_[_0xeeb9('0x40')](_0x3e4e9e[_0xeeb9('0x3c')],qs['fields'](_0x1329df[_0xeeb9('0x3d')][_0xeeb9('0x42')]));_0x47e388[_0xeeb9('0x41')]=_0x47e388[_0xeeb9('0x41')][_0xeeb9('0x43')]?_0x47e388[_0xeeb9('0x41')]:_0x3e4e9e['model'];_0x47e388[_0xeeb9('0x47')]=qs[_0xeeb9('0x48')](_0x1329df[_0xeeb9('0x3d')]['sort']);_0x47e388['where']=qs[_0xeeb9('0x3f')](_[_0xeeb9('0x59')](_0x1329df['query'],_0x3e4e9e[_0xeeb9('0x3f')]));if(_0x1329df[_0xeeb9('0x3d')][_0xeeb9('0x4a')]){_0x47e388[_0xeeb9('0x49')]=_[_0xeeb9('0x4b')](_0x47e388[_0xeeb9('0x49')],{'$or':_[_0xeeb9('0x37')](_0x47e388[_0xeeb9('0x41')],function(_0x510da9){var _0x597b45={};_0x597b45[_0x510da9]={'$like':'%'+_0x1329df['query'][_0xeeb9('0x4a')]+'%'};return _0x597b45;})});}_0x47e388=_[_0xeeb9('0x4b')]({},_0x47e388,_0x1329df[_0xeeb9('0x5a')]);return _0x27bd59[_0xeeb9('0x5b')](_0x47e388);}})[_0xeeb9('0x32')](function(_0x531c8a){if(_0x531c8a){_0x470721=_0x531c8a[_0xeeb9('0x43')];if(!_0x1329df['query'][_0xeeb9('0x44')]('nolimit')){_0x47e388[_0xeeb9('0x2d')]=qs[_0xeeb9('0x2d')](_0x1329df['query'][_0xeeb9('0x2d')]);_0x47e388[_0xeeb9('0x46')]=qs[_0xeeb9('0x46')](_0x1329df[_0xeeb9('0x3d')]['offset']);}return _0x27bd59[_0xeeb9('0x5b')](_0x47e388);}})[_0xeeb9('0x32')](function(_0x4dcd97){if(_0x4dcd97){return _0x4dcd97?{'count':_0x470721,'rows':_0x4dcd97}:null;}})[_0xeeb9('0x32')](respondWithResult(_0x293d1a,null))[_0xeeb9('0x2a')](handleError(_0x293d1a,null));};exports[_0xeeb9('0x5c')]=function(_0x57273c,_0x1b1575,_0x37b30a){if(_0x57273c[_0xeeb9('0x56')]['id']){delete _0x57273c['body']['id'];}return db['ServicenowAccount'][_0xeeb9('0x57')]({'where':{'id':_0x57273c[_0xeeb9('0x51')]['id']}})[_0xeeb9('0x32')](handleEntityNotFound(_0x1b1575,null))[_0xeeb9('0x32')](function(_0x4a2605){if(_0x4a2605){_0x57273c['body']['AccountId']=_0x4a2605['id'];_0x57273c[_0xeeb9('0x56')][_0xeeb9('0x5d')]=integrations[_0xeeb9('0x5e')](_0x57273c[_0xeeb9('0x56')][_0xeeb9('0x5f')],_0x57273c[_0xeeb9('0x56')][_0xeeb9('0x3b')]);_0x57273c['body'][_0xeeb9('0x60')]=integrations[_0xeeb9('0x61')](_0x57273c[_0xeeb9('0x56')][_0xeeb9('0x5f')],_0x57273c[_0xeeb9('0x56')][_0xeeb9('0x3b')]);return db[_0xeeb9('0x58')][_0xeeb9('0x54')](_0x57273c[_0xeeb9('0x56')],{'include':[{'model':db['ServicenowField'],'as':_0xeeb9('0x5d')},{'model':db['ServicenowField'],'as':_0xeeb9('0x60')}]});}return null;})[_0xeeb9('0x32')](respondWithResult(_0x1b1575,null))[_0xeeb9('0x2a')](handleError(_0x1b1575,null));};exports['getFields']=function(_0x3f2d26,_0x527a29,_0x1af974){var _0x22c268=[_0xeeb9('0x62'),_0xeeb9('0x63'),'knowledge',_0xeeb9('0x64'),_0xeeb9('0x65'),'notify',_0xeeb9('0x66'),'severity',_0xeeb9('0x67')];var _0xeb77ce=[_0xeeb9('0x68'),_0xeeb9('0x62'),_0xeeb9('0x69'),_0xeeb9('0x6a'),_0xeeb9('0x6b'),_0xeeb9('0x6c'),'child_incidents',_0xeeb9('0x63'),_0xeeb9('0x6d'),_0xeeb9('0x6e'),_0xeeb9('0x6f'),_0xeeb9('0x70'),_0xeeb9('0x71'),'user_input',_0xeeb9('0x72'),_0xeeb9('0x73'),'state',_0xeeb9('0x74'),_0xeeb9('0x75'),_0xeeb9('0x47'),_0xeeb9('0x76'),_0xeeb9('0x77'),_0xeeb9('0x78'),_0xeeb9('0x79'),'impact',_0xeeb9('0x7a'),'work_notes_list','business_service',_0xeeb9('0x7b'),_0xeeb9('0x7c'),_0xeeb9('0x7d'),_0xeeb9('0x7e'),_0xeeb9('0x7f'),'opened_at',_0xeeb9('0x80'),_0xeeb9('0x81'),_0xeeb9('0x82'),_0xeeb9('0x83'),'resolved_at',_0xeeb9('0x84'),_0xeeb9('0x85'),_0xeeb9('0x64'),'work_notes',_0xeeb9('0x86'),_0xeeb9('0x65'),_0xeeb9('0x87'),_0xeeb9('0x88'),_0xeeb9('0x89'),'assignment_group','business_stc',_0xeeb9('0x8a'),_0xeeb9('0x8b'),_0xeeb9('0x8c'),'notify','sys_class_name','close_notes',_0xeeb9('0x8d'),'follow_up',_0xeeb9('0x8e'),_0xeeb9('0x8f'),_0xeeb9('0x90'),_0xeeb9('0x91'),_0xeeb9('0x66'),_0xeeb9('0x92'),_0xeeb9('0x93'),_0xeeb9('0x94'),'reassignment_count',_0xeeb9('0x95'),'assigned_to',_0xeeb9('0x96'),_0xeeb9('0x97'),'sla_due',_0xeeb9('0x98'),_0xeeb9('0x99'),_0xeeb9('0x9a'),_0xeeb9('0x9b'),_0xeeb9('0x9c'),_0xeeb9('0x9d'),_0xeeb9('0x9e'),_0xeeb9('0x9f'),_0xeeb9('0xa0'),_0xeeb9('0xa1'),'category'];var _0x1013e1='';var _0x59312d='';var _0x116db3=[];var _0x4b774e='';var _0x512432='';var _0x52d28e=[];var _0x1e37e2='';var _0x28dd16='';var _0x2e1ca1={};var _0x3fad0a='';return db['ServicenowAccount'][_0xeeb9('0x57')]({'where':{'id':_0x3f2d26[_0xeeb9('0x51')]['id']},'attributes':['id',_0xeeb9('0xa2'),_0xeeb9('0xa3'),_0xeeb9('0xa4'),_0xeeb9('0xa5'),'serverUrl']})['then'](handleEntityNotFound(_0x527a29,null))[_0xeeb9('0x32')](function(_0x1e2294){if(_0x1e2294){_0x3fad0a=_0x1e2294['remoteUri'];var _0x3cf848=_0x3fad0a[_0xeeb9('0xa6')](-0x1);if(_0x3cf848==='/'){_0x3fad0a=_0x3fad0a['substring'](0x0,_0x3fad0a['lastIndexOf'](_0x3cf848));}_0x28dd16=util[_0xeeb9('0xa7')](_0xeeb9('0xa8'),_0x3fad0a);_0x1e37e2=util[_0xeeb9('0xa7')](_0xeeb9('0xa9'),_0x3fad0a);_0x2e1ca1={'user':_0x1e2294[_0xeeb9('0xa2')],'pass':_0x1e2294[_0xeeb9('0xa3')]};var _0x111eb2={'method':_0xeeb9('0xaa'),'uri':_0x28dd16+_0xeeb9('0xab'),'auth':_0x2e1ca1,'json':!![]};return rp(_0x111eb2);}})[_0xeeb9('0x32')](function(_0x54614e){if(_0x54614e['result']['length']>0x0){_0x1013e1=_0x54614e[_0xeeb9('0x29')];}console[_0xeeb9('0xac')](_0xeeb9('0xad'),_0x1013e1);_0x52d28e=[];_0x59312d=Object['assign']([],_0x1013e1);_[_0xeeb9('0xae')](_0x59312d,function(_0x585597){return!_0x22c268[_0xeeb9('0xaf')](_0x585597[_0xeeb9('0x35')]);});_0x59312d[_0xeeb9('0xb0')](function(_0x55f88a){var _0x4c8fc=createFieldObject(_0x1e37e2,_0x2e1ca1,_0x55f88a[_0xeeb9('0xb1')],_0x55f88a[_0xeeb9('0x35')],_0x55f88a[_0xeeb9('0xb2')],![]);_0x52d28e['push'](_0x4c8fc);});return Promise[_0xeeb9('0xb3')](_0x52d28e);})[_0xeeb9('0x32')](function(_0x128223){_0x116db3=_0x128223;_0x4b774e=Object[_0xeeb9('0xb4')]([],_0x1013e1);console['log'](_0xeeb9('0xb5'),_0x1013e1);_[_0xeeb9('0xae')](_0x4b774e,function(_0x9662c3){return _0xeb77ce['includes'](_0x9662c3[_0xeeb9('0x35')]);});console[_0xeeb9('0xac')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4b774e);_0x52d28e=[];_0x4b774e['forEach'](function(_0x5ac51d){var _0x35f1dd=createFieldObject(_0x1e37e2,_0x2e1ca1,_0x5ac51d[_0xeeb9('0xb1')],_0x5ac51d[_0xeeb9('0x35')],_0x5ac51d[_0xeeb9('0xb2')],!![]);_0x52d28e[_0xeeb9('0xb6')](_0x35f1dd);});return Promise[_0xeeb9('0xb3')](_0x52d28e);})['then'](function(_0x1d230f){_0x512432=_0x1d230f;var _0xc66da=_0x116db3[_0xeeb9('0xb7')](_0x512432);return{'count':_0xc66da[_0xeeb9('0x43')],'rows':_0xc66da};})[_0xeeb9('0x32')](respondWithResult(_0x527a29,null))[_0xeeb9('0x2a')](function(_0x98dc9e){console[_0xeeb9('0xac')]('ServiceNow\x20error:\x20'+_0x98dc9e);var _0x514b43=_0x3f2d26[_0xeeb9('0x3d')][_0xeeb9('0x1d')]?0x1f4:_0x98dc9e[_0xeeb9('0xb8')]||0x1f4;logger[_0xeeb9('0x25')](_0x98dc9e['stack']);delete _0x98dc9e[_0xeeb9('0x35')];if(_0x514b43===0x191){_0x514b43=0x190;}_0x527a29['status'](_0x514b43)[_0xeeb9('0x36')](_0x3f2d26[_0xeeb9('0x3d')][_0xeeb9('0x1d')]?{'message':_0xeeb9('0xb9'),'statusCode':_0x98dc9e[_0xeeb9('0xb8')]}:_0x98dc9e);});};function createFieldObject(_0x1f3087,_0xcbcfb6,_0x58e3b5,_0x127d2a,_0xf972a7,_0x14f1c2){return new Promise(function(_0x5647fb,_0x5620e5){var _0x3d7131={'id':_0x127d2a,'name':_0xf972a7,'custom':_0x14f1c2};if(_0x58e3b5===_0xeeb9('0xba')){_0x3d7131[_0xeeb9('0x5a')]=[{'name':'True','value':'true'},{'name':_0xeeb9('0xbb'),'value':'false'}];_0x5647fb(_0x3d7131);}else{var _0x3e8d39={'method':'GET','uri':_0x1f3087+'sys_choice?sysparm_query=name=incident^element='+_0x127d2a,'auth':_0xcbcfb6,'json':!![]};return rp(_0x3e8d39)[_0xeeb9('0x32')](function(_0x26f18d){var _0x9e5f79=[];if(_0x26f18d['result'][_0xeeb9('0x43')]>0x0){_0x26f18d[_0xeeb9('0x29')][_0xeeb9('0xb0')](function(_0x3a1d0d){if(_0x3a1d0d['inactive']===_0xeeb9('0xbc')){var _0x5dcf10={'name':_0x3a1d0d['label'],'value':_0x3a1d0d['value']};_0x9e5f79[_0xeeb9('0xb6')](_0x5dcf10);}});}_0x3d7131[_0xeeb9('0x5a')]=_0x9e5f79;if(_0x3d7131['options'][_0xeeb9('0x43')]>0x0){_0x5647fb(_0x3d7131);}else{if(_0x14f1c2==![]){_0x5647fb();}else{_0x5647fb(_0x3d7131);}}});}});} \ No newline at end of file +var _0xf7ed=['email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','boolean','True','true','False','false','value','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ServicenowAccount,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','ServicenowAccount','count','findAll','rows','params','keys','includeAll','include','options','create','body','find','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','upon_reject','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','rfc','time_worked','business_duration','reopened_time','resolved_at','caller_id','work_notes','short_description','work_start','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','location','username','password'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf7ed,0x1a1));var _0xdf7e=function(_0x4de0aa,_0x22628e){_0x4de0aa=_0x4de0aa-0x0;var _0x2214bb=_0xf7ed[_0x4de0aa];return _0x2214bb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdf7e('0x0'));var rimraf=require(_0xdf7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf7e('0x2'));var rp=require(_0xdf7e('0x3'));var moment=require('moment');var BPromise=require(_0xdf7e('0x4'));var Mustache=require(_0xdf7e('0x5'));var util=require('util');var path=require(_0xdf7e('0x6'));var sox=require(_0xdf7e('0x7'));var csv=require(_0xdf7e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdf7e('0x9'));var squel=require(_0xdf7e('0xa'));var crypto=require(_0xdf7e('0xb'));var jsforce=require(_0xdf7e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdf7e('0x8'));var querystring=require(_0xdf7e('0xd'));var Papa=require(_0xdf7e('0xe'));var Redis=require(_0xdf7e('0xf'));var authService=require(_0xdf7e('0x10'));var qs=require(_0xdf7e('0x11'));var as=require(_0xdf7e('0x12'));var hardwareService=require(_0xdf7e('0x13'));var logger=require(_0xdf7e('0x14'))(_0xdf7e('0x15'));var utils=require(_0xdf7e('0x16'));var config=require(_0xdf7e('0x17'));var db=require(_0xdf7e('0x18'))['db'];var integrations=require(_0xdf7e('0x19'));var jayson=require(_0xdf7e('0x1a'));var client=jayson['client'][_0xdf7e('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x536927,_0x22e411,_0xe0068a){if(_0xe0068a){var _0x500475=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x500475[_0xdf7e('0x1c')](_0x22e411)){return _0x536927;}else{throw new db[(_0xdf7e('0x1d'))][(_0xdf7e('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 _0x536927;}}function respondWithRpcPromise(_0x280380,_0x3b483d,_0x1ea911,_0x39212f){return new BPromise(function(_0x19134c,_0xb1c752){var _0x5dd057=_0x39212f||client;return _0x5dd057['request'](_0x280380,_0x1ea911)[_0xdf7e('0x1f')](function(_0x3dfef7){logger[_0xdf7e('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x3b483d,_0xdf7e('0x21'));logger[_0xdf7e('0x22')](_0xdf7e('0x23'),_0x3b483d,_0xdf7e('0x21'),JSON[_0xdf7e('0x24')](_0x3dfef7));if(_0x3dfef7[_0xdf7e('0x25')]){if(_0x3dfef7['error']['code']===0x1f4){logger[_0xdf7e('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x3b483d,_0x3dfef7[_0xdf7e('0x25')][_0xdf7e('0x26')]);return _0xb1c752(_0x3dfef7[_0xdf7e('0x25')][_0xdf7e('0x26')]);}logger[_0xdf7e('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x3b483d,_0x3dfef7[_0xdf7e('0x25')][_0xdf7e('0x26')]);return _0x19134c(_0x3dfef7[_0xdf7e('0x25')][_0xdf7e('0x26')]);}else{logger[_0xdf7e('0x20')](_0xdf7e('0x27'),_0x3b483d,'request\x20sent');_0x19134c(_0x3dfef7['result'][_0xdf7e('0x26')]);}})[_0xdf7e('0x28')](function(_0x2ffc55){logger[_0xdf7e('0x25')]('ServicenowAccount,\x20%s,\x20%s',_0x3b483d,_0x2ffc55);_0xb1c752(_0x2ffc55);});});}function respondWithStatusCode(_0x485fef,_0x129dfd){_0x129dfd=_0x129dfd||0xcc;return function(_0xd5431b){if(_0xd5431b){return _0x485fef[_0xdf7e('0x29')](_0x129dfd);}return _0x485fef[_0xdf7e('0x2a')](_0x129dfd)[_0xdf7e('0x2b')]();};}function respondWithResult(_0x580560,_0x36c081){_0x36c081=_0x36c081||0xc8;return function(_0x10c597){if(_0x10c597){return _0x580560['status'](_0x36c081)[_0xdf7e('0x2c')](_0x10c597);}};}function respondWithFilteredResult(_0x4273aa,_0x29155b){return function(_0x16a61e){if(_0x16a61e){var _0x516d69=_0x16a61e['count'],_0x4d127b=_0x29155b[_0xdf7e('0x2d')],_0x4b9664=_0x29155b[_0xdf7e('0x2d')]+_0x29155b[_0xdf7e('0x2e')],_0x5ed006;if(_0x4b9664>=_0x516d69){_0x4b9664=_0x516d69;_0x5ed006=0xc8;}else{_0x5ed006=0xce;}_0x4273aa[_0xdf7e('0x2a')](_0x5ed006);return _0x4273aa[_0xdf7e('0x2f')](_0xdf7e('0x30'),_0x4d127b+'-'+_0x4b9664+'/'+_0x516d69)[_0xdf7e('0x2c')](_0x16a61e);}return null;};}function patchUpdates(_0x2d5b8f){return function(_0x3b9aae){try{jsonpatch['apply'](_0x3b9aae,_0x2d5b8f,!![]);}catch(_0x138e92){return BPromise[_0xdf7e('0x31')](_0x138e92);}return _0x3b9aae['save']();};}function saveUpdates(_0x2ae01d,_0x4ea96c){return function(_0x3347c1){if(_0x3347c1){return _0x3347c1[_0xdf7e('0x32')](_0x2ae01d)['then'](function(_0x1a7a13){return _0x1a7a13;});}return null;};}function removeEntity(_0x7784fe,_0x7525aa){return function(_0x66cc99){if(_0x66cc99){return _0x66cc99['destroy']()[_0xdf7e('0x1f')](function(){_0x7784fe[_0xdf7e('0x2a')](0xcc)[_0xdf7e('0x2b')]();});}};}function handleEntityNotFound(_0x376daf,_0x1e87d8){return function(_0x4c9f61){if(!_0x4c9f61){_0x376daf[_0xdf7e('0x29')](0x194);}return _0x4c9f61;};}function handleError(_0xf920e3,_0x3c4e6a){_0x3c4e6a=_0x3c4e6a||0x1f4;return function(_0x5ac0bc){logger[_0xdf7e('0x25')](_0x5ac0bc[_0xdf7e('0x33')]);if(_0x5ac0bc[_0xdf7e('0x34')]){delete _0x5ac0bc['name'];}_0xf920e3['status'](_0x3c4e6a)[_0xdf7e('0x35')](_0x5ac0bc);};}exports[_0xdf7e('0x36')]=function(_0x4eaa04,_0x2d49dd){var _0x5d68d0={},_0x37ed27={},_0x1a1929={'count':0x0,'rows':[]};var _0x478d42=_[_0xdf7e('0x37')](db['ServicenowAccount'][_0xdf7e('0x38')],function(_0x574b73){return{'name':_0x574b73[_0xdf7e('0x39')],'type':_0x574b73[_0xdf7e('0x3a')]['key']};});_0x37ed27[_0xdf7e('0x3b')]=_[_0xdf7e('0x37')](_0x478d42,'name');_0x37ed27[_0xdf7e('0x3c')]=_['keys'](_0x4eaa04['query']);_0x37ed27['filters']=_[_0xdf7e('0x3d')](_0x37ed27[_0xdf7e('0x3b')],_0x37ed27[_0xdf7e('0x3c')]);_0x5d68d0[_0xdf7e('0x3e')]=_[_0xdf7e('0x3d')](_0x37ed27[_0xdf7e('0x3b')],qs[_0xdf7e('0x3f')](_0x4eaa04['query']['fields']));_0x5d68d0[_0xdf7e('0x3e')]=_0x5d68d0[_0xdf7e('0x3e')][_0xdf7e('0x40')]?_0x5d68d0[_0xdf7e('0x3e')]:_0x37ed27['model'];if(!_0x4eaa04['query']['hasOwnProperty'](_0xdf7e('0x41'))){_0x5d68d0['limit']=qs[_0xdf7e('0x2e')](_0x4eaa04[_0xdf7e('0x3c')][_0xdf7e('0x2e')]);_0x5d68d0['offset']=qs['offset'](_0x4eaa04[_0xdf7e('0x3c')][_0xdf7e('0x2d')]);}_0x5d68d0[_0xdf7e('0x42')]=qs[_0xdf7e('0x43')](_0x4eaa04[_0xdf7e('0x3c')][_0xdf7e('0x43')]);_0x5d68d0[_0xdf7e('0x44')]=qs[_0xdf7e('0x45')](_['pick'](_0x4eaa04[_0xdf7e('0x3c')],_0x37ed27[_0xdf7e('0x45')]),_0x478d42);if(_0x4eaa04[_0xdf7e('0x3c')][_0xdf7e('0x46')]){_0x5d68d0[_0xdf7e('0x44')]=_[_0xdf7e('0x47')](_0x5d68d0[_0xdf7e('0x44')],{'$or':_[_0xdf7e('0x37')](_0x478d42,function(_0x1874bb){if(_0x1874bb['type']!==_0xdf7e('0x48')){var _0x29111b={};_0x29111b[_0x1874bb[_0xdf7e('0x34')]]={'$like':'%'+_0x4eaa04[_0xdf7e('0x3c')][_0xdf7e('0x46')]+'%'};return _0x29111b;}})});}_0x5d68d0=_['merge']({},_0x5d68d0,_0x4eaa04['options']);var _0xeefd7a={'where':_0x5d68d0[_0xdf7e('0x44')]};return db[_0xdf7e('0x49')][_0xdf7e('0x4a')](_0xeefd7a)['then'](function(_0x3db221){_0x1a1929[_0xdf7e('0x4a')]=_0x3db221;if(_0x4eaa04[_0xdf7e('0x3c')]['includeAll']){_0x5d68d0['include']=[{'all':!![]}];}return db[_0xdf7e('0x49')][_0xdf7e('0x4b')](_0x5d68d0);})[_0xdf7e('0x1f')](function(_0x2a3b73){_0x1a1929[_0xdf7e('0x4c')]=_0x2a3b73;return _0x1a1929;})[_0xdf7e('0x1f')](respondWithFilteredResult(_0x2d49dd,_0x5d68d0))['catch'](handleError(_0x2d49dd,null));};exports['show']=function(_0xda8310,_0x3e1289){var _0x3be5c6={'raw':![],'where':{'id':_0xda8310[_0xdf7e('0x4d')]['id']}},_0xdbfe63={};_0xdbfe63['model']=_['keys'](db[_0xdf7e('0x49')][_0xdf7e('0x38')]);_0xdbfe63['query']=_[_0xdf7e('0x4e')](_0xda8310['query']);_0xdbfe63[_0xdf7e('0x45')]=_[_0xdf7e('0x3d')](_0xdbfe63[_0xdf7e('0x3b')],_0xdbfe63[_0xdf7e('0x3c')]);_0x3be5c6[_0xdf7e('0x3e')]=_[_0xdf7e('0x3d')](_0xdbfe63[_0xdf7e('0x3b')],qs[_0xdf7e('0x3f')](_0xda8310[_0xdf7e('0x3c')]['fields']));_0x3be5c6[_0xdf7e('0x3e')]=_0x3be5c6['attributes']['length']?_0x3be5c6[_0xdf7e('0x3e')]:_0xdbfe63[_0xdf7e('0x3b')];if(_0xda8310[_0xdf7e('0x3c')][_0xdf7e('0x4f')]){_0x3be5c6[_0xdf7e('0x50')]=[{'all':!![]}];}_0x3be5c6=_[_0xdf7e('0x47')]({},_0x3be5c6,_0xda8310[_0xdf7e('0x51')]);return db['ServicenowAccount']['find'](_0x3be5c6)[_0xdf7e('0x1f')](handleEntityNotFound(_0x3e1289,null))['then'](respondWithResult(_0x3e1289,null))[_0xdf7e('0x28')](handleError(_0x3e1289,null));};exports['create']=function(_0x304292,_0x1f98f4){return db[_0xdf7e('0x49')][_0xdf7e('0x52')](_0x304292[_0xdf7e('0x53')],{})[_0xdf7e('0x1f')](respondWithResult(_0x1f98f4,0xc9))[_0xdf7e('0x28')](handleError(_0x1f98f4,null));};exports['update']=function(_0x2a6e8b,_0x22573a){if(_0x2a6e8b[_0xdf7e('0x53')]['id']){delete _0x2a6e8b[_0xdf7e('0x53')]['id'];}return db[_0xdf7e('0x49')][_0xdf7e('0x54')]({'where':{'id':_0x2a6e8b['params']['id']}})[_0xdf7e('0x1f')](handleEntityNotFound(_0x22573a,null))[_0xdf7e('0x1f')](saveUpdates(_0x2a6e8b[_0xdf7e('0x53')],null))['then'](respondWithResult(_0x22573a,null))[_0xdf7e('0x28')](handleError(_0x22573a,null));};exports[_0xdf7e('0x55')]=function(_0x1170b8,_0x17fdd4){return db['ServicenowAccount'][_0xdf7e('0x54')]({'where':{'id':_0x1170b8['params']['id']}})['then'](handleEntityNotFound(_0x17fdd4,null))[_0xdf7e('0x1f')](removeEntity(_0x17fdd4,null))['catch'](handleError(_0x17fdd4,null));};exports[_0xdf7e('0x56')]=function(_0x5642b5,_0x2ddcfc,_0x295d32){var _0xd3ebcd={};var _0x48fcf1={};var _0x41f153;var _0x3d4b5e;return db[_0xdf7e('0x49')][_0xdf7e('0x57')]({'where':{'id':_0x5642b5[_0xdf7e('0x4d')]['id']}})[_0xdf7e('0x1f')](handleEntityNotFound(_0x2ddcfc,null))[_0xdf7e('0x1f')](function(_0x3689e1){if(_0x3689e1){_0x41f153=_0x3689e1;_0x48fcf1['model']=_[_0xdf7e('0x4e')](db[_0xdf7e('0x58')]['rawAttributes']);_0x48fcf1[_0xdf7e('0x3c')]=_[_0xdf7e('0x4e')](_0x5642b5[_0xdf7e('0x3c')]);_0x48fcf1[_0xdf7e('0x45')]=_['intersection'](_0x48fcf1[_0xdf7e('0x3b')],_0x48fcf1['query']);_0xd3ebcd[_0xdf7e('0x3e')]=_['intersection'](_0x48fcf1['model'],qs[_0xdf7e('0x3f')](_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x3f')]));_0xd3ebcd[_0xdf7e('0x3e')]=_0xd3ebcd[_0xdf7e('0x3e')]['length']?_0xd3ebcd[_0xdf7e('0x3e')]:_0x48fcf1[_0xdf7e('0x3b')];_0xd3ebcd[_0xdf7e('0x42')]=qs[_0xdf7e('0x43')](_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x43')]);_0xd3ebcd[_0xdf7e('0x44')]=qs[_0xdf7e('0x45')](_[_0xdf7e('0x59')](_0x5642b5['query'],_0x48fcf1[_0xdf7e('0x45')]));if(_0x5642b5[_0xdf7e('0x3c')]['filter']){_0xd3ebcd[_0xdf7e('0x44')]=_[_0xdf7e('0x47')](_0xd3ebcd[_0xdf7e('0x44')],{'$or':_[_0xdf7e('0x37')](_0xd3ebcd[_0xdf7e('0x3e')],function(_0x2d4db9){var _0x102758={};_0x102758[_0x2d4db9]={'$like':'%'+_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x46')]+'%'};return _0x102758;})});}_0xd3ebcd=_['merge']({},_0xd3ebcd,_0x5642b5[_0xdf7e('0x51')]);return _0x41f153[_0xdf7e('0x56')](_0xd3ebcd);}})[_0xdf7e('0x1f')](function(_0x1166fd){if(_0x1166fd){_0x3d4b5e=_0x1166fd[_0xdf7e('0x40')];if(!_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x5a')]('nolimit')){_0xd3ebcd[_0xdf7e('0x2e')]=qs[_0xdf7e('0x2e')](_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x2e')]);_0xd3ebcd[_0xdf7e('0x2d')]=qs['offset'](_0x5642b5[_0xdf7e('0x3c')][_0xdf7e('0x2d')]);}return _0x41f153[_0xdf7e('0x56')](_0xd3ebcd);}})[_0xdf7e('0x1f')](function(_0x26a261){if(_0x26a261){return _0x26a261?{'count':_0x3d4b5e,'rows':_0x26a261}:null;}})[_0xdf7e('0x1f')](respondWithResult(_0x2ddcfc,null))['catch'](handleError(_0x2ddcfc,null));};exports[_0xdf7e('0x5b')]=function(_0x9bfd41,_0x5f516c,_0x19ce95){if(_0x9bfd41['body']['id']){delete _0x9bfd41['body']['id'];}return db[_0xdf7e('0x49')][_0xdf7e('0x57')]({'where':{'id':_0x9bfd41[_0xdf7e('0x4d')]['id']}})[_0xdf7e('0x1f')](handleEntityNotFound(_0x5f516c,null))[_0xdf7e('0x1f')](function(_0x326e5e){if(_0x326e5e){_0x9bfd41['body'][_0xdf7e('0x5c')]=_0x326e5e['id'];_0x9bfd41[_0xdf7e('0x53')][_0xdf7e('0x5d')]=integrations['getSubjects'](_0x9bfd41[_0xdf7e('0x53')][_0xdf7e('0x5e')],_0x9bfd41[_0xdf7e('0x53')][_0xdf7e('0x3a')]);_0x9bfd41[_0xdf7e('0x53')]['Descriptions']=integrations[_0xdf7e('0x5f')](_0x9bfd41[_0xdf7e('0x53')][_0xdf7e('0x5e')],_0x9bfd41[_0xdf7e('0x53')][_0xdf7e('0x3a')]);return db[_0xdf7e('0x58')]['create'](_0x9bfd41[_0xdf7e('0x53')],{'include':[{'model':db[_0xdf7e('0x60')],'as':'Subjects'},{'model':db[_0xdf7e('0x60')],'as':_0xdf7e('0x61')}]});}return null;})[_0xdf7e('0x1f')](respondWithResult(_0x5f516c,null))[_0xdf7e('0x28')](handleError(_0x5f516c,null));};exports[_0xdf7e('0x62')]=function(_0x229bc6,_0x3a4c9d,_0x2bd53d){var _0x30584f=['made_sla',_0xdf7e('0x63'),_0xdf7e('0x64'),_0xdf7e('0x65'),_0xdf7e('0x66'),_0xdf7e('0x67'),_0xdf7e('0x68'),_0xdf7e('0x69'),_0xdf7e('0x6a')];var _0x12b466=[_0xdf7e('0x6b'),'made_sla','caused_by','watch_list',_0xdf7e('0x6c'),'sys_updated_on',_0xdf7e('0x6d'),_0xdf7e('0x63'),_0xdf7e('0x6e'),_0xdf7e('0x6f'),_0xdf7e('0x70'),_0xdf7e('0x71'),_0xdf7e('0x72'),_0xdf7e('0x73'),_0xdf7e('0x74'),'sys_domain',_0xdf7e('0x75'),_0xdf7e('0x76'),_0xdf7e('0x64'),_0xdf7e('0x42'),_0xdf7e('0x77'),_0xdf7e('0x78'),_0xdf7e('0x79'),_0xdf7e('0x7a'),_0xdf7e('0x7b'),'active',_0xdf7e('0x7c'),_0xdf7e('0x7d'),_0xdf7e('0x7e'),'sys_domain_path',_0xdf7e('0x7f'),_0xdf7e('0x80'),'expected_start','opened_at',_0xdf7e('0x81'),'group_list','work_end',_0xdf7e('0x82'),_0xdf7e('0x83'),_0xdf7e('0x84'),'approval_set',_0xdf7e('0x65'),_0xdf7e('0x85'),_0xdf7e('0x86'),_0xdf7e('0x66'),'correlation_display','delivery_task',_0xdf7e('0x87'),'assignment_group',_0xdf7e('0x88'),_0xdf7e('0x89'),_0xdf7e('0x8a'),'calendar_duration',_0xdf7e('0x67'),_0xdf7e('0x8b'),_0xdf7e('0x8c'),_0xdf7e('0x8d'),_0xdf7e('0x8e'),_0xdf7e('0x8f'),'sys_id','contact_type',_0xdf7e('0x90'),_0xdf7e('0x68'),_0xdf7e('0x91'),_0xdf7e('0x92'),_0xdf7e('0x93'),_0xdf7e('0x94'),_0xdf7e('0x95'),_0xdf7e('0x96'),_0xdf7e('0x69'),'comments',_0xdf7e('0x97'),_0xdf7e('0x98'),_0xdf7e('0x99'),_0xdf7e('0x9a'),_0xdf7e('0x9b'),'reopen_count',_0xdf7e('0x9c'),'escalation',_0xdf7e('0x9d'),_0xdf7e('0x9e'),_0xdf7e('0x9f'),_0xdf7e('0x6a')];var _0x114aca='';var _0x56a5d5='';var _0x50c120=[];var _0x555ea3='';var _0x46862a='';var _0x2c3cfe=[];var _0x5c4cb0='';var _0x5bf5c0='';var _0xd7dab5={};var _0x41d3c4='';return db[_0xdf7e('0x49')][_0xdf7e('0x57')]({'where':{'id':_0x229bc6[_0xdf7e('0x4d')]['id']},'attributes':['id',_0xdf7e('0xa0'),_0xdf7e('0xa1'),_0xdf7e('0xa2'),_0xdf7e('0xa3'),_0xdf7e('0xa4')]})[_0xdf7e('0x1f')](handleEntityNotFound(_0x3a4c9d,null))[_0xdf7e('0x1f')](function(_0x49b0af){if(_0x49b0af){_0x41d3c4=_0x49b0af[_0xdf7e('0xa3')];var _0x2b38e8=_0x41d3c4[_0xdf7e('0xa5')](-0x1);if(_0x2b38e8==='/'){_0x41d3c4=_0x41d3c4[_0xdf7e('0xa6')](0x0,_0x41d3c4[_0xdf7e('0xa7')](_0x2b38e8));}_0x5bf5c0=util[_0xdf7e('0xa8')](_0xdf7e('0xa9'),_0x41d3c4);_0x5c4cb0=util[_0xdf7e('0xa8')]('%s/api/now/table/',_0x41d3c4);_0xd7dab5={'user':_0x49b0af[_0xdf7e('0xa0')],'pass':_0x49b0af[_0xdf7e('0xa1')]};var _0x5de686={'method':_0xdf7e('0xaa'),'uri':_0x5bf5c0+_0xdf7e('0xab'),'auth':_0xd7dab5,'json':!![]};return rp(_0x5de686);}})[_0xdf7e('0x1f')](function(_0x41fa35){if(_0x41fa35[_0xdf7e('0xac')]['length']>0x0){_0x114aca=_0x41fa35[_0xdf7e('0xac')];}console[_0xdf7e('0xad')](_0xdf7e('0xae'),_0x114aca);_0x2c3cfe=[];_0x56a5d5=Object['assign']([],_0x114aca);_[_0xdf7e('0xaf')](_0x56a5d5,function(_0x2161d1){return!_0x30584f[_0xdf7e('0xb0')](_0x2161d1[_0xdf7e('0x34')]);});_0x56a5d5[_0xdf7e('0xb1')](function(_0x31a83b){var _0xbd2774=createFieldObject(_0x5c4cb0,_0xd7dab5,_0x31a83b[_0xdf7e('0xb2')],_0x31a83b[_0xdf7e('0x34')],_0x31a83b[_0xdf7e('0xb3')],![]);_0x2c3cfe[_0xdf7e('0xb4')](_0xbd2774);});return Promise[_0xdf7e('0xb5')](_0x2c3cfe);})[_0xdf7e('0x1f')](function(_0x4bf4f9){_0x50c120=_0x4bf4f9;_0x555ea3=Object['assign']([],_0x114aca);console[_0xdf7e('0xad')]('TCL:\x20_object',_0x114aca);_['remove'](_0x555ea3,function(_0x232390){return _0x12b466[_0xdf7e('0xb0')](_0x232390[_0xdf7e('0x34')]);});console[_0xdf7e('0xad')](_0xdf7e('0xb6'),_0x555ea3);_0x2c3cfe=[];_0x555ea3[_0xdf7e('0xb1')](function(_0x379c4e){var _0xf3802a=createFieldObject(_0x5c4cb0,_0xd7dab5,_0x379c4e['internalType'],_0x379c4e['name'],_0x379c4e['label'],!![]);_0x2c3cfe[_0xdf7e('0xb4')](_0xf3802a);});return Promise[_0xdf7e('0xb5')](_0x2c3cfe);})[_0xdf7e('0x1f')](function(_0x13f45e){_0x46862a=_0x13f45e;var _0x214a70=_0x50c120[_0xdf7e('0xb7')](_0x46862a);return{'count':_0x214a70[_0xdf7e('0x40')],'rows':_0x214a70};})[_0xdf7e('0x1f')](respondWithResult(_0x3a4c9d,null))[_0xdf7e('0x28')](function(_0x15b64e){console[_0xdf7e('0xad')](_0xdf7e('0xb8')+_0x15b64e);var _0x112ec9=_0x229bc6['query']['test']?0x1f4:_0x15b64e[_0xdf7e('0xb9')]||0x1f4;logger[_0xdf7e('0x25')](_0x15b64e[_0xdf7e('0x33')]);delete _0x15b64e[_0xdf7e('0x34')];if(_0x112ec9===0x191){_0x112ec9=0x190;}_0x3a4c9d[_0xdf7e('0x2a')](_0x112ec9)[_0xdf7e('0x35')](_0x229bc6[_0xdf7e('0x3c')]['test']?{'message':_0xdf7e('0xba'),'statusCode':_0x15b64e['statusCode']}:_0x15b64e);});};function createFieldObject(_0x293527,_0x42a637,_0x332d85,_0xf678c0,_0x446cd7,_0x127697){return new Promise(function(_0x37f388,_0x46277a){var _0x4df035={'id':_0xf678c0,'name':_0x446cd7,'custom':_0x127697};if(_0x332d85===_0xdf7e('0xbb')){_0x4df035[_0xdf7e('0x51')]=[{'name':_0xdf7e('0xbc'),'value':_0xdf7e('0xbd')},{'name':_0xdf7e('0xbe'),'value':_0xdf7e('0xbf')}];_0x37f388(_0x4df035);}else{var _0x1c7060={'method':'GET','uri':_0x293527+'sys_choice?sysparm_query=name=incident^element='+_0xf678c0,'auth':_0x42a637,'json':!![]};return rp(_0x1c7060)[_0xdf7e('0x1f')](function(_0xde1948){var _0x1b1e28=[];if(_0xde1948['result'][_0xdf7e('0x40')]>0x0){_0xde1948[_0xdf7e('0xac')][_0xdf7e('0xb1')](function(_0x41acc4){if(_0x41acc4['inactive']===_0xdf7e('0xbf')){var _0x556b2e={'name':_0x41acc4['label'],'value':_0x41acc4[_0xdf7e('0xc0')]};_0x1b1e28[_0xdf7e('0xb4')](_0x556b2e);}});}_0x4df035['options']=_0x1b1e28;if(_0x4df035[_0xdf7e('0x51')][_0xdf7e('0x40')]>0x0){_0x37f388(_0x4df035);}else{if(_0x127697==![]){_0x37f388();}else{_0x37f388(_0x4df035);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 758afbf..6ca93bc 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 _0xc46e=['rimraf','exports','ServicenowAccount','util','../../config/logger','moment','request-promise'];(function(_0x1f332b,_0x1f28c6){var _0x517bcd=function(_0x55959f){while(--_0x55959f){_0x1f332b['push'](_0x1f332b['shift']());}};_0x517bcd(++_0x1f28c6);}(_0xc46e,0x1c3));var _0xec46=function(_0x1df473,_0x1a6931){_0x1df473=_0x1df473-0x0;var _0x1bdd49=_0xc46e[_0x1df473];return _0x1bdd49;};'use strict';var _=require('lodash');var util=require(_0xec46('0x0'));var logger=require(_0xec46('0x1'))('api');var moment=require(_0xec46('0x2'));var BPromise=require('bluebird');var rp=require(_0xec46('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec46('0x4'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xec46('0x5')]=function(_0x29eb8d,_0x4a5a01){return _0x29eb8d['define'](_0xec46('0x6'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeca9=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3ced95,_0x3d653a){var _0x1301ab=function(_0x550e24){while(--_0x550e24){_0x3ced95['push'](_0x3ced95['shift']());}};_0x1301ab(++_0x3d653a);}(_0xeca9,0x13c));var _0x9eca=function(_0x473803,_0xb2748f){_0x473803=_0x473803-0x0;var _0x3a431b=_0xeca9[_0x473803];return _0x3a431b;};'use strict';var _=require(_0x9eca('0x0'));var util=require(_0x9eca('0x1'));var logger=require(_0x9eca('0x2'))('api');var moment=require(_0x9eca('0x3'));var BPromise=require(_0x9eca('0x4'));var rp=require(_0x9eca('0x5'));var fs=require('fs');var path=require(_0x9eca('0x6'));var rimraf=require(_0x9eca('0x7'));var config=require(_0x9eca('0x8'));var attributes=require(_0x9eca('0x9'));var integrations=require(_0x9eca('0xa'));module['exports']=function(_0x3823c6,_0x4716df){return _0x3823c6[_0x9eca('0xb')](_0x9eca('0xc'),attributes,{'tableName':_0x9eca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 4692fd8..6a375e1 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 _0xb1b5=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','attributes','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount','find','raw','lodash','util'];(function(_0x589b86,_0x413d8f){var _0x5dfe75=function(_0x3f8cc4){while(--_0x3f8cc4){_0x589b86['push'](_0x589b86['shift']());}};_0x5dfe75(++_0x413d8f);}(_0xb1b5,0x1c6));var _0x5b1b=function(_0x1d2d50,_0x49050a){_0x1d2d50=_0x1d2d50-0x0;var _0x2f7f56=_0xb1b5[_0x1d2d50];return _0x2f7f56;};'use strict';var _=require(_0x5b1b('0x0'));var util=require(_0x5b1b('0x1'));var moment=require(_0x5b1b('0x2'));var BPromise=require(_0x5b1b('0x3'));var rs=require(_0x5b1b('0x4'));var fs=require('fs');var Redis=require(_0x5b1b('0x5'));var db=require(_0x5b1b('0x6'))['db'];var utils=require(_0x5b1b('0x7'));var logger=require('../../config/logger')(_0x5b1b('0x8'));var config=require(_0x5b1b('0x9'));var jayson=require(_0x5b1b('0xa'));var client=jayson[_0x5b1b('0xb')][_0x5b1b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28fddb,_0x51f1ed,_0x33a8a5){return new BPromise(function(_0x2d0359,_0x1ddc38){return client[_0x5b1b('0xd')](_0x28fddb,_0x33a8a5)[_0x5b1b('0xe')](function(_0x1d9661){logger[_0x5b1b('0xf')](_0x5b1b('0x10'),_0x51f1ed,_0x5b1b('0x11'));logger[_0x5b1b('0x12')](_0x5b1b('0x13'),_0x51f1ed,_0x5b1b('0x11'),JSON[_0x5b1b('0x14')](_0x1d9661));if(_0x1d9661[_0x5b1b('0x15')]){if(_0x1d9661['error'][_0x5b1b('0x16')]===0x1f4){logger[_0x5b1b('0x15')]('ServicenowAccount,\x20%s,\x20%s',_0x51f1ed,_0x1d9661['error'][_0x5b1b('0x17')]);return _0x1ddc38(_0x1d9661['error'][_0x5b1b('0x17')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x51f1ed,_0x1d9661[_0x5b1b('0x15')][_0x5b1b('0x17')]);return _0x2d0359(_0x1d9661[_0x5b1b('0x15')]['message']);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x51f1ed,_0x5b1b('0x11'));_0x2d0359(_0x1d9661[_0x5b1b('0x18')][_0x5b1b('0x17')]);}})[_0x5b1b('0x19')](function(_0x2c51ab){logger['error'](_0x5b1b('0x10'),_0x51f1ed,_0x2c51ab);_0x1ddc38(_0x2c51ab);});});}exports['GetServicenowAccount']=function(_0x5e38da){var _0x180130=this;return new Promise(function(_0x100abb,_0x10693a){return db[_0x5b1b('0x1a')][_0x5b1b('0x1b')]({'raw':_0x5e38da[_0x5b1b('0x1c')]?_0x5e38da[_0x5b1b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5e38da[_0x5b1b('0x1c')]?_0x5e38da['options']['where']||null:null,'attributes':_0x5e38da[_0x5b1b('0x1c')]?_0x5e38da['options'][_0x5b1b('0x1d')]||null:null,'limit':_0x5e38da[_0x5b1b('0x1c')]?_0x5e38da[_0x5b1b('0x1c')][_0x5b1b('0x1e')]||null:null,'include':_0x5e38da[_0x5b1b('0x1c')]?_0x5e38da[_0x5b1b('0x1c')][_0x5b1b('0x1f')]?_[_0x5b1b('0x20')](_0x5e38da[_0x5b1b('0x1c')][_0x5b1b('0x1f')],function(_0x2d41bd){return{'model':db[_0x2d41bd[_0x5b1b('0x21')]],'as':_0x2d41bd['as'],'attributes':_0x2d41bd['attributes'],'include':_0x2d41bd[_0x5b1b('0x1f')]?_[_0x5b1b('0x20')](_0x2d41bd[_0x5b1b('0x1f')],function(_0x50a261){return{'model':db[_0x50a261[_0x5b1b('0x21')]],'as':_0x50a261['as'],'attributes':_0x50a261[_0x5b1b('0x1d')],'include':_0x50a261[_0x5b1b('0x1f')]?_[_0x5b1b('0x20')](_0x50a261['include'],function(_0x48727e){return{'model':db[_0x48727e[_0x5b1b('0x21')]],'as':_0x48727e['as'],'attributes':_0x48727e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5b1b('0xe')](function(_0x8561a1){logger[_0x5b1b('0xf')](_0x5b1b('0x22'),_0x5e38da);logger[_0x5b1b('0x12')](_0x5b1b('0x22'),_0x5e38da,JSON[_0x5b1b('0x14')](_0x8561a1));_0x100abb(_0x8561a1);})[_0x5b1b('0x19')](function(_0x16917f){logger[_0x5b1b('0x15')]('GetServicenowAccount',_0x16917f[_0x5b1b('0x17')],_0x5e38da);_0x10693a(_0x180130['error'](0x1f4,_0x16917f[_0x5b1b('0x17')]));});});};exports[_0x5b1b('0x23')]=function(_0x5cccaf){var _0x4df75f=this;return new Promise(function(_0x30523a,_0x1a2bf4){return db[_0x5b1b('0x1a')][_0x5b1b('0x24')]({'raw':_0x5cccaf[_0x5b1b('0x1c')]?_0x5cccaf[_0x5b1b('0x1c')][_0x5b1b('0x25')]===undefined?!![]:![]:!![],'where':_0x5cccaf[_0x5b1b('0x1c')]?_0x5cccaf[_0x5b1b('0x1c')]['where']||null:null,'attributes':_0x5cccaf[_0x5b1b('0x1c')]?_0x5cccaf['options'][_0x5b1b('0x1d')]||null:null,'include':_0x5cccaf[_0x5b1b('0x1c')]?_0x5cccaf[_0x5b1b('0x1c')]['include']?_[_0x5b1b('0x20')](_0x5cccaf[_0x5b1b('0x1c')]['include'],function(_0x31759c){return{'model':db[_0x31759c[_0x5b1b('0x21')]],'as':_0x31759c['as'],'attributes':_0x31759c[_0x5b1b('0x1d')],'include':_0x31759c[_0x5b1b('0x1f')]?_[_0x5b1b('0x20')](_0x31759c[_0x5b1b('0x1f')],function(_0x58becf){return{'model':db[_0x58becf[_0x5b1b('0x21')]],'as':_0x58becf['as'],'attributes':_0x58becf[_0x5b1b('0x1d')],'include':_0x58becf[_0x5b1b('0x1f')]?_[_0x5b1b('0x20')](_0x58becf[_0x5b1b('0x1f')],function(_0x3fd740){return{'model':db[_0x3fd740[_0x5b1b('0x21')]],'as':_0x3fd740['as'],'attributes':_0x3fd740['attributes']};}):[]};}):[]};}):[]:[]})[_0x5b1b('0xe')](function(_0x5ac4e0){logger['info'](_0x5b1b('0x23'),_0x5cccaf);logger['debug'](_0x5b1b('0x23'),_0x5cccaf,JSON['stringify'](_0x5ac4e0));_0x30523a(_0x5ac4e0);})[_0x5b1b('0x19')](function(_0x1c8cf7){logger[_0x5b1b('0x15')](_0x5b1b('0x23'),_0x1c8cf7[_0x5b1b('0x17')],_0x5cccaf);_0x1a2bf4(_0x4df75f['error'](0x1f4,_0x1c8cf7['message']));});});}; \ No newline at end of file +var _0x88ea=['ServicenowAccount','findAll','options','raw','where','attributes','map','include','model','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','request\x20sent','result','GetServicenowAccount'];(function(_0x37cd8c,_0x425de5){var _0x213168=function(_0x4aed59){while(--_0x4aed59){_0x37cd8c['push'](_0x37cd8c['shift']());}};_0x213168(++_0x425de5);}(_0x88ea,0x1a3));var _0xa88e=function(_0xacc499,_0x163ba7){_0xacc499=_0xacc499-0x0;var _0x51a45e=_0x88ea[_0xacc499];return _0x51a45e;};'use strict';var _=require(_0xa88e('0x0'));var util=require(_0xa88e('0x1'));var moment=require('moment');var BPromise=require(_0xa88e('0x2'));var rs=require(_0xa88e('0x3'));var fs=require('fs');var Redis=require(_0xa88e('0x4'));var db=require(_0xa88e('0x5'))['db'];var utils=require(_0xa88e('0x6'));var logger=require('../../config/logger')(_0xa88e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa88e('0x8')][_0xa88e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cc823,_0x4f77db,_0x5129fa){return new BPromise(function(_0x48a0e4,_0x4d5504){return client[_0xa88e('0xa')](_0x5cc823,_0x5129fa)[_0xa88e('0xb')](function(_0x26e5e2){logger[_0xa88e('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x4f77db,'request\x20sent');logger[_0xa88e('0xd')](_0xa88e('0xe'),_0x4f77db,'request\x20sent',JSON[_0xa88e('0xf')](_0x26e5e2));if(_0x26e5e2[_0xa88e('0x10')]){if(_0x26e5e2[_0xa88e('0x10')][_0xa88e('0x11')]===0x1f4){logger[_0xa88e('0x10')](_0xa88e('0x12'),_0x4f77db,_0x26e5e2[_0xa88e('0x10')]['message']);return _0x4d5504(_0x26e5e2['error'][_0xa88e('0x13')]);}logger[_0xa88e('0x10')](_0xa88e('0x12'),_0x4f77db,_0x26e5e2[_0xa88e('0x10')][_0xa88e('0x13')]);return _0x48a0e4(_0x26e5e2[_0xa88e('0x10')]['message']);}else{logger['info'](_0xa88e('0x12'),_0x4f77db,_0xa88e('0x14'));_0x48a0e4(_0x26e5e2[_0xa88e('0x15')][_0xa88e('0x13')]);}})['catch'](function(_0x51656c){logger[_0xa88e('0x10')](_0xa88e('0x12'),_0x4f77db,_0x51656c);_0x4d5504(_0x51656c);});});}exports[_0xa88e('0x16')]=function(_0xd7e9a0){var _0x2fa195=this;return new Promise(function(_0xbcbb5,_0x24df1f){return db[_0xa88e('0x17')][_0xa88e('0x18')]({'raw':_0xd7e9a0[_0xa88e('0x19')]?_0xd7e9a0[_0xa88e('0x19')][_0xa88e('0x1a')]===undefined?!![]:![]:!![],'where':_0xd7e9a0[_0xa88e('0x19')]?_0xd7e9a0[_0xa88e('0x19')][_0xa88e('0x1b')]||null:null,'attributes':_0xd7e9a0[_0xa88e('0x19')]?_0xd7e9a0[_0xa88e('0x19')][_0xa88e('0x1c')]||null:null,'limit':_0xd7e9a0[_0xa88e('0x19')]?_0xd7e9a0[_0xa88e('0x19')]['limit']||null:null,'include':_0xd7e9a0['options']?_0xd7e9a0[_0xa88e('0x19')]['include']?_[_0xa88e('0x1d')](_0xd7e9a0[_0xa88e('0x19')][_0xa88e('0x1e')],function(_0x10aa2d){return{'model':db[_0x10aa2d[_0xa88e('0x1f')]],'as':_0x10aa2d['as'],'attributes':_0x10aa2d[_0xa88e('0x1c')],'include':_0x10aa2d[_0xa88e('0x1e')]?_[_0xa88e('0x1d')](_0x10aa2d['include'],function(_0x7df1df){return{'model':db[_0x7df1df[_0xa88e('0x1f')]],'as':_0x7df1df['as'],'attributes':_0x7df1df[_0xa88e('0x1c')],'include':_0x7df1df[_0xa88e('0x1e')]?_[_0xa88e('0x1d')](_0x7df1df[_0xa88e('0x1e')],function(_0x14b01a){return{'model':db[_0x14b01a[_0xa88e('0x1f')]],'as':_0x14b01a['as'],'attributes':_0x14b01a[_0xa88e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21a2cf){logger['info'](_0xa88e('0x16'),_0xd7e9a0);logger[_0xa88e('0xd')]('GetServicenowAccount',_0xd7e9a0,JSON[_0xa88e('0xf')](_0x21a2cf));_0xbcbb5(_0x21a2cf);})['catch'](function(_0x501b45){logger['error'](_0xa88e('0x16'),_0x501b45[_0xa88e('0x13')],_0xd7e9a0);_0x24df1f(_0x2fa195[_0xa88e('0x10')](0x1f4,_0x501b45[_0xa88e('0x13')]));});});};exports[_0xa88e('0x20')]=function(_0x571b4f){var _0x4c75cb=this;return new Promise(function(_0x3bbdb7,_0x5b4c4f){return db['ServicenowAccount'][_0xa88e('0x21')]({'raw':_0x571b4f[_0xa88e('0x19')]?_0x571b4f['options'][_0xa88e('0x1a')]===undefined?!![]:![]:!![],'where':_0x571b4f[_0xa88e('0x19')]?_0x571b4f[_0xa88e('0x19')][_0xa88e('0x1b')]||null:null,'attributes':_0x571b4f[_0xa88e('0x19')]?_0x571b4f['options'][_0xa88e('0x1c')]||null:null,'include':_0x571b4f[_0xa88e('0x19')]?_0x571b4f[_0xa88e('0x19')]['include']?_[_0xa88e('0x1d')](_0x571b4f[_0xa88e('0x19')][_0xa88e('0x1e')],function(_0x35c874){return{'model':db[_0x35c874[_0xa88e('0x1f')]],'as':_0x35c874['as'],'attributes':_0x35c874['attributes'],'include':_0x35c874[_0xa88e('0x1e')]?_[_0xa88e('0x1d')](_0x35c874[_0xa88e('0x1e')],function(_0x4da96c){return{'model':db[_0x4da96c[_0xa88e('0x1f')]],'as':_0x4da96c['as'],'attributes':_0x4da96c[_0xa88e('0x1c')],'include':_0x4da96c['include']?_['map'](_0x4da96c[_0xa88e('0x1e')],function(_0x1407dd){return{'model':db[_0x1407dd[_0xa88e('0x1f')]],'as':_0x1407dd['as'],'attributes':_0x1407dd[_0xa88e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa88e('0xb')](function(_0xeb6f17){logger[_0xa88e('0xc')](_0xa88e('0x20'),_0x571b4f);logger[_0xa88e('0xd')](_0xa88e('0x20'),_0x571b4f,JSON[_0xa88e('0xf')](_0xeb6f17));_0x3bbdb7(_0xeb6f17);})['catch'](function(_0x41a155){logger[_0xa88e('0x10')](_0xa88e('0x20'),_0x41a155[_0xa88e('0x13')],_0x571b4f);_0x5b4c4f(_0x4c75cb[_0xa88e('0x10')](0x1f4,_0x41a155[_0xa88e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 86d8548..cb75575 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 _0x85b7=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x85b7,0x1a2));var _0x785b=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x85b7[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x785b('0x0'));var util=require(_0x785b('0x1'));var path=require('path');var timeout=require(_0x785b('0x2'));var express=require('express');var router=express[_0x785b('0x3')]();var auth=require(_0x785b('0x4'));var interaction=require(_0x785b('0x5'));var config=require('../../config/environment');var controller=require(_0x785b('0x6'));router[_0x785b('0x7')]('/',auth[_0x785b('0x8')](),controller[_0x785b('0x9')]);router['get'](_0x785b('0xa'),auth[_0x785b('0x8')](),controller['show']);router[_0x785b('0x7')](_0x785b('0xb'),auth[_0x785b('0x8')](),controller[_0x785b('0xc')]);router[_0x785b('0x7')](_0x785b('0xd'),auth['isAuthenticated'](),controller[_0x785b('0xe')]);router['get'](_0x785b('0xf'),auth[_0x785b('0x8')](),controller['getDescriptions']);router[_0x785b('0x10')]('/',auth['isAuthenticated'](),controller[_0x785b('0x11')]);router[_0x785b('0x12')]('/:id',auth[_0x785b('0x8')](),controller[_0x785b('0x13')]);router[_0x785b('0x14')](_0x785b('0xa'),auth[_0x785b('0x8')](),controller[_0x785b('0x15')]);module['exports']=router; \ No newline at end of file +var _0x3868=['create','update','/:id','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/descriptions','getDescriptions','post'];(function(_0x25a9af,_0x3c6d24){var _0x310d7c=function(_0xf2ead8){while(--_0xf2ead8){_0x25a9af['push'](_0x25a9af['shift']());}};_0x310d7c(++_0x3c6d24);}(_0x3868,0x82));var _0x8386=function(_0x54ed2d,_0x2c36f3){_0x54ed2d=_0x54ed2d-0x0;var _0x1b082b=_0x3868[_0x54ed2d];return _0x1b082b;};'use strict';var multer=require(_0x8386('0x0'));var util=require(_0x8386('0x1'));var path=require(_0x8386('0x2'));var timeout=require(_0x8386('0x3'));var express=require(_0x8386('0x4'));var router=express['Router']();var auth=require(_0x8386('0x5'));var interaction=require(_0x8386('0x6'));var config=require(_0x8386('0x7'));var controller=require(_0x8386('0x8'));router[_0x8386('0x9')]('/',auth[_0x8386('0xa')](),controller[_0x8386('0xb')]);router['get']('/:id',auth[_0x8386('0xa')](),controller[_0x8386('0xc')]);router[_0x8386('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8386('0xd')]);router[_0x8386('0x9')]('/:id/subjects',auth[_0x8386('0xa')](),controller['getSubjects']);router[_0x8386('0x9')](_0x8386('0xe'),auth[_0x8386('0xa')](),controller[_0x8386('0xf')]);router[_0x8386('0x10')]('/',auth[_0x8386('0xa')](),controller[_0x8386('0x11')]);router['put']('/:id',auth[_0x8386('0xa')](),controller[_0x8386('0x12')]);router['delete'](_0x8386('0x13'),auth[_0x8386('0xa')](),controller[_0x8386('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 40882cc..43bf64f 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 _0x824a=['exports','STRING'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x824a,0x1e4));var _0xa824=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x824a[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0xa824('0x0')]={'name':{'type':Sequelize[_0xa824('0x1')]},'description':{'type':Sequelize[_0xa824('0x1')]}}; \ No newline at end of file +var _0x18b3=['STRING','sequelize','exports'];(function(_0x563eaa,_0x5b1ee6){var _0x1825cc=function(_0x1e5a94){while(--_0x1e5a94){_0x563eaa['push'](_0x563eaa['shift']());}};_0x1825cc(++_0x5b1ee6);}(_0x18b3,0x142));var _0x318b=function(_0x5e0112,_0x1a0f16){_0x5e0112=_0x5e0112-0x0;var _0x186ff5=_0x18b3[_0x5e0112];return _0x186ff5;};'use strict';var Sequelize=require(_0x318b('0x0'));module[_0x318b('0x1')]={'name':{'type':Sequelize[_0x318b('0x2')]},'description':{'type':Sequelize[_0x318b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 42ef8e5..c9f320c 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 _0x1775=['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','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','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','save','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','ServicenowConfiguration','include','rows','show','length','includeAll','find','create','update','body','params','getFields','findOne','ServicenowField','getSubjects','sort','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x12e4b9,_0xe39e09){var _0x3b0438=function(_0x21413c){while(--_0x21413c){_0x12e4b9['push'](_0x12e4b9['shift']());}};_0x3b0438(++_0xe39e09);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'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'];var jayson=require(_0x5177('0x1b'));var client=jayson[_0x5177('0x1c')][_0x5177('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x111e99,_0x299eba,_0x1ab4f1){if(_0x1ab4f1){var _0x2ec90f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ec90f[_0x5177('0x1e')](_0x299eba)){return _0x111e99;}else{throw new db[(_0x5177('0x1f'))][(_0x5177('0x20'))](_0x5177('0x21'));}}else{return _0x111e99;}}function respondWithRpcPromise(_0x29cd2c,_0x31aff8,_0x1b32e6,_0x175ca6){return new BPromise(function(_0x2ab5e5,_0x7dba6f){var _0xe6dcf6=_0x175ca6||client;return _0xe6dcf6['request'](_0x29cd2c,_0x1b32e6)[_0x5177('0x22')](function(_0x41e687){logger[_0x5177('0x23')](_0x5177('0x24'),_0x31aff8,'request\x20sent');logger[_0x5177('0x25')](_0x5177('0x26'),_0x31aff8,_0x5177('0x27'),JSON['stringify'](_0x41e687));if(_0x41e687[_0x5177('0x28')]){if(_0x41e687['error'][_0x5177('0x29')]===0x1f4){logger[_0x5177('0x28')](_0x5177('0x24'),_0x31aff8,_0x41e687[_0x5177('0x28')][_0x5177('0x2a')]);return _0x7dba6f(_0x41e687[_0x5177('0x28')][_0x5177('0x2a')]);}logger[_0x5177('0x28')](_0x5177('0x24'),_0x31aff8,_0x41e687[_0x5177('0x28')][_0x5177('0x2a')]);return _0x2ab5e5(_0x41e687[_0x5177('0x28')]['message']);}else{logger[_0x5177('0x23')]('ServicenowConfiguration,\x20%s,\x20%s',_0x31aff8,_0x5177('0x27'));_0x2ab5e5(_0x41e687[_0x5177('0x2b')][_0x5177('0x2a')]);}})[_0x5177('0x2c')](function(_0x4bc8e2){logger[_0x5177('0x28')]('ServicenowConfiguration,\x20%s,\x20%s',_0x31aff8,_0x4bc8e2);_0x7dba6f(_0x4bc8e2);});});}function respondWithStatusCode(_0x564139,_0x19a0c2){_0x19a0c2=_0x19a0c2||0xcc;return function(_0x15cb93){if(_0x15cb93){return _0x564139['sendStatus'](_0x19a0c2);}return _0x564139[_0x5177('0x2d')](_0x19a0c2)['end']();};}function respondWithResult(_0x231d35,_0x1cbd29){_0x1cbd29=_0x1cbd29||0xc8;return function(_0x58846c){if(_0x58846c){return _0x231d35[_0x5177('0x2d')](_0x1cbd29)[_0x5177('0x2e')](_0x58846c);}};}function respondWithFilteredResult(_0x3c4248,_0x7f86e){return function(_0xe98ff1){if(_0xe98ff1){var _0x1cef5d=_0xe98ff1[_0x5177('0x2f')],_0x5577bb=_0x7f86e[_0x5177('0x30')],_0x498fcd=_0x7f86e[_0x5177('0x30')]+_0x7f86e[_0x5177('0x31')],_0x45cf20;if(_0x498fcd>=_0x1cef5d){_0x498fcd=_0x1cef5d;_0x45cf20=0xc8;}else{_0x45cf20=0xce;}_0x3c4248[_0x5177('0x2d')](_0x45cf20);return _0x3c4248[_0x5177('0x32')](_0x5177('0x33'),_0x5577bb+'-'+_0x498fcd+'/'+_0x1cef5d)['json'](_0xe98ff1);}return null;};}function patchUpdates(_0x42e1db){return function(_0x2233a2){try{jsonpatch['apply'](_0x2233a2,_0x42e1db,!![]);}catch(_0x32bea9){return BPromise['reject'](_0x32bea9);}return _0x2233a2[_0x5177('0x34')]();};}function saveUpdates(_0x1a2c46,_0x1ba51c){return function(_0x5e2e5a){if(_0x5e2e5a){return _0x5e2e5a['update'](_0x1a2c46)[_0x5177('0x22')](function(_0x45ae80){return _0x45ae80;});}return null;};}function removeEntity(_0x6bcb80,_0x3735e9){return function(_0x3f41ad){if(_0x3f41ad){return _0x3f41ad[_0x5177('0x35')]()[_0x5177('0x22')](function(){_0x6bcb80[_0x5177('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459ac6,_0x1d9afe){return function(_0x570522){if(!_0x570522){_0x459ac6[_0x5177('0x36')](0x194);}return _0x570522;};}function handleError(_0x2a26fc,_0x172196){_0x172196=_0x172196||0x1f4;return function(_0x8727c6){logger[_0x5177('0x28')](_0x8727c6[_0x5177('0x37')]);if(_0x8727c6['name']){delete _0x8727c6[_0x5177('0x38')];}_0x2a26fc[_0x5177('0x2d')](_0x172196)[_0x5177('0x39')](_0x8727c6);};}exports[_0x5177('0x3a')]=function(_0x154296,_0xacaa96){var _0x1bb1e3={},_0x5a5a33={},_0x257350={'count':0x0,'rows':[]};var _0x2ff13b=_['map'](db['ServicenowConfiguration'][_0x5177('0x3b')],function(_0x188cec){return{'name':_0x188cec[_0x5177('0x3c')],'type':_0x188cec[_0x5177('0x3d')][_0x5177('0x3e')]};});_0x5a5a33[_0x5177('0x3f')]=_[_0x5177('0x40')](_0x2ff13b,_0x5177('0x38'));_0x5a5a33[_0x5177('0x41')]=_[_0x5177('0x42')](_0x154296[_0x5177('0x41')]);_0x5a5a33[_0x5177('0x43')]=_[_0x5177('0x44')](_0x5a5a33['model'],_0x5a5a33[_0x5177('0x41')]);_0x1bb1e3[_0x5177('0x45')]=_['intersection'](_0x5a5a33[_0x5177('0x3f')],qs['fields'](_0x154296[_0x5177('0x41')][_0x5177('0x46')]));_0x1bb1e3[_0x5177('0x45')]=_0x1bb1e3['attributes']['length']?_0x1bb1e3[_0x5177('0x45')]:_0x5a5a33[_0x5177('0x3f')];if(!_0x154296[_0x5177('0x41')][_0x5177('0x47')](_0x5177('0x48'))){_0x1bb1e3[_0x5177('0x31')]=qs[_0x5177('0x31')](_0x154296[_0x5177('0x41')]['limit']);_0x1bb1e3[_0x5177('0x30')]=qs['offset'](_0x154296['query'][_0x5177('0x30')]);}_0x1bb1e3[_0x5177('0x49')]=qs['sort'](_0x154296[_0x5177('0x41')]['sort']);_0x1bb1e3['where']=qs[_0x5177('0x43')](_[_0x5177('0x4a')](_0x154296[_0x5177('0x41')],_0x5a5a33[_0x5177('0x43')]),_0x2ff13b);if(_0x154296[_0x5177('0x41')][_0x5177('0x4b')]){_0x1bb1e3[_0x5177('0x4c')]=_['merge'](_0x1bb1e3['where'],{'$or':_[_0x5177('0x40')](_0x2ff13b,function(_0x511dc0){if(_0x511dc0[_0x5177('0x3d')]!==_0x5177('0x4d')){var _0x11b846={};_0x11b846[_0x511dc0[_0x5177('0x38')]]={'$like':'%'+_0x154296['query'][_0x5177('0x4b')]+'%'};return _0x11b846;}})});}_0x1bb1e3=_[_0x5177('0x4e')]({},_0x1bb1e3,_0x154296[_0x5177('0x4f')]);var _0x18b045={'where':_0x1bb1e3[_0x5177('0x4c')]};return db[_0x5177('0x50')][_0x5177('0x2f')](_0x18b045)[_0x5177('0x22')](function(_0x1ada68){_0x257350[_0x5177('0x2f')]=_0x1ada68;if(_0x154296[_0x5177('0x41')]['includeAll']){_0x1bb1e3[_0x5177('0x51')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x1bb1e3);})['then'](function(_0x2f9ff9){_0x257350[_0x5177('0x52')]=_0x2f9ff9;return _0x257350;})['then'](respondWithFilteredResult(_0xacaa96,_0x1bb1e3))[_0x5177('0x2c')](handleError(_0xacaa96,null));};exports[_0x5177('0x53')]=function(_0x208483,_0x4891fe){var _0x1d4ae4={'raw':![],'where':{'id':_0x208483['params']['id']}},_0x5981dc={};_0x5981dc['model']=_[_0x5177('0x42')](db[_0x5177('0x50')][_0x5177('0x3b')]);_0x5981dc['query']=_['keys'](_0x208483[_0x5177('0x41')]);_0x5981dc['filters']=_[_0x5177('0x44')](_0x5981dc[_0x5177('0x3f')],_0x5981dc[_0x5177('0x41')]);_0x1d4ae4[_0x5177('0x45')]=_[_0x5177('0x44')](_0x5981dc[_0x5177('0x3f')],qs[_0x5177('0x46')](_0x208483[_0x5177('0x41')][_0x5177('0x46')]));_0x1d4ae4[_0x5177('0x45')]=_0x1d4ae4[_0x5177('0x45')][_0x5177('0x54')]?_0x1d4ae4[_0x5177('0x45')]:_0x5981dc['model'];if(_0x208483['query'][_0x5177('0x55')]){_0x1d4ae4['include']=[{'all':!![]}];}_0x1d4ae4=_[_0x5177('0x4e')]({},_0x1d4ae4,_0x208483['options']);return db[_0x5177('0x50')][_0x5177('0x56')](_0x1d4ae4)[_0x5177('0x22')](handleEntityNotFound(_0x4891fe,null))['then'](respondWithResult(_0x4891fe,null))['catch'](handleError(_0x4891fe,null));};exports[_0x5177('0x57')]=function(_0x43b5b9,_0x2eb560){return db[_0x5177('0x50')]['create'](_0x43b5b9['body'],{})[_0x5177('0x22')](respondWithResult(_0x2eb560,0xc9))[_0x5177('0x2c')](handleError(_0x2eb560,null));};exports[_0x5177('0x58')]=function(_0x736b13,_0x4ad742){if(_0x736b13[_0x5177('0x59')]['id']){delete _0x736b13[_0x5177('0x59')]['id'];}return db[_0x5177('0x50')]['find']({'where':{'id':_0x736b13[_0x5177('0x5a')]['id']}})[_0x5177('0x22')](handleEntityNotFound(_0x4ad742,null))[_0x5177('0x22')](saveUpdates(_0x736b13['body'],null))[_0x5177('0x22')](respondWithResult(_0x4ad742,null))['catch'](handleError(_0x4ad742,null));};exports[_0x5177('0x35')]=function(_0x39fb92,_0x3268bd){return db['ServicenowConfiguration'][_0x5177('0x56')]({'where':{'id':_0x39fb92[_0x5177('0x5a')]['id']}})[_0x5177('0x22')](handleEntityNotFound(_0x3268bd,null))[_0x5177('0x22')](removeEntity(_0x3268bd,null))[_0x5177('0x2c')](handleError(_0x3268bd,null));};exports[_0x5177('0x5b')]=function(_0x37380c,_0x267599,_0x5ceed2){var _0x5d96ce={};var _0x4b5b6b={};var _0x3bc60b;var _0x18222f;return db[_0x5177('0x50')][_0x5177('0x5c')]({'where':{'id':_0x37380c[_0x5177('0x5a')]['id']}})[_0x5177('0x22')](handleEntityNotFound(_0x267599,null))['then'](function(_0x523531){if(_0x523531){_0x3bc60b=_0x523531;_0x4b5b6b[_0x5177('0x3f')]=_[_0x5177('0x42')](db[_0x5177('0x5d')][_0x5177('0x3b')]);_0x4b5b6b[_0x5177('0x41')]=_[_0x5177('0x42')](_0x37380c[_0x5177('0x41')]);_0x4b5b6b[_0x5177('0x43')]=_[_0x5177('0x44')](_0x4b5b6b['model'],_0x4b5b6b[_0x5177('0x41')]);_0x5d96ce[_0x5177('0x45')]=_['intersection'](_0x4b5b6b[_0x5177('0x3f')],qs[_0x5177('0x46')](_0x37380c['query'][_0x5177('0x46')]));_0x5d96ce[_0x5177('0x45')]=_0x5d96ce[_0x5177('0x45')]['length']?_0x5d96ce[_0x5177('0x45')]:_0x4b5b6b[_0x5177('0x3f')];_0x5d96ce['order']=qs['sort'](_0x37380c[_0x5177('0x41')]['sort']);_0x5d96ce[_0x5177('0x4c')]=qs['filters'](_[_0x5177('0x4a')](_0x37380c[_0x5177('0x41')],_0x4b5b6b['filters']));if(_0x37380c[_0x5177('0x41')][_0x5177('0x4b')]){_0x5d96ce[_0x5177('0x4c')]=_[_0x5177('0x4e')](_0x5d96ce[_0x5177('0x4c')],{'$or':_[_0x5177('0x40')](_0x5d96ce[_0x5177('0x45')],function(_0x58ebdd){var _0x26b733={};_0x26b733[_0x58ebdd]={'$like':'%'+_0x37380c['query']['filter']+'%'};return _0x26b733;})});}_0x5d96ce=_[_0x5177('0x4e')]({},_0x5d96ce,_0x37380c[_0x5177('0x4f')]);return _0x3bc60b['getFields'](_0x5d96ce);}})[_0x5177('0x22')](function(_0xa889bd){if(_0xa889bd){_0x18222f=_0xa889bd[_0x5177('0x54')];if(!_0x37380c[_0x5177('0x41')][_0x5177('0x47')](_0x5177('0x48'))){_0x5d96ce[_0x5177('0x31')]=qs[_0x5177('0x31')](_0x37380c['query']['limit']);_0x5d96ce[_0x5177('0x30')]=qs[_0x5177('0x30')](_0x37380c[_0x5177('0x41')][_0x5177('0x30')]);}return _0x3bc60b[_0x5177('0x5b')](_0x5d96ce);}})[_0x5177('0x22')](function(_0x4fc289){if(_0x4fc289){return _0x4fc289?{'count':_0x18222f,'rows':_0x4fc289}:null;}})[_0x5177('0x22')](respondWithResult(_0x267599,null))[_0x5177('0x2c')](handleError(_0x267599,null));};exports[_0x5177('0x5e')]=function(_0x46d72e,_0x4aa151,_0x2e26c6){var _0x95f83a={};var _0x124935={};var _0x22da9d;var _0x282cbc;return db['ServicenowConfiguration'][_0x5177('0x5c')]({'where':{'id':_0x46d72e['params']['id']}})[_0x5177('0x22')](handleEntityNotFound(_0x4aa151,null))[_0x5177('0x22')](function(_0x5e3554){if(_0x5e3554){_0x22da9d=_0x5e3554;_0x124935[_0x5177('0x3f')]=_[_0x5177('0x42')](db[_0x5177('0x5d')][_0x5177('0x3b')]);_0x124935['query']=_[_0x5177('0x42')](_0x46d72e[_0x5177('0x41')]);_0x124935[_0x5177('0x43')]=_[_0x5177('0x44')](_0x124935['model'],_0x124935[_0x5177('0x41')]);_0x95f83a[_0x5177('0x45')]=_[_0x5177('0x44')](_0x124935['model'],qs['fields'](_0x46d72e[_0x5177('0x41')][_0x5177('0x46')]));_0x95f83a[_0x5177('0x45')]=_0x95f83a[_0x5177('0x45')][_0x5177('0x54')]?_0x95f83a[_0x5177('0x45')]:_0x124935[_0x5177('0x3f')];_0x95f83a[_0x5177('0x49')]=qs[_0x5177('0x5f')](_0x46d72e['query']['sort']);_0x95f83a['where']=qs[_0x5177('0x43')](_['pick'](_0x46d72e[_0x5177('0x41')],_0x124935[_0x5177('0x43')]));if(_0x46d72e[_0x5177('0x41')][_0x5177('0x4b')]){_0x95f83a[_0x5177('0x4c')]=_['merge'](_0x95f83a[_0x5177('0x4c')],{'$or':_[_0x5177('0x40')](_0x95f83a[_0x5177('0x45')],function(_0x4fce32){var _0x3d845e={};_0x3d845e[_0x4fce32]={'$like':'%'+_0x46d72e['query'][_0x5177('0x4b')]+'%'};return _0x3d845e;})});}_0x95f83a=_[_0x5177('0x4e')]({},_0x95f83a,_0x46d72e['options']);return _0x22da9d[_0x5177('0x5e')](_0x95f83a);}})[_0x5177('0x22')](function(_0x53ccd8){if(_0x53ccd8){_0x282cbc=_0x53ccd8['length'];if(!_0x46d72e[_0x5177('0x41')]['hasOwnProperty'](_0x5177('0x48'))){_0x95f83a[_0x5177('0x31')]=qs['limit'](_0x46d72e[_0x5177('0x41')][_0x5177('0x31')]);_0x95f83a[_0x5177('0x30')]=qs[_0x5177('0x30')](_0x46d72e[_0x5177('0x41')][_0x5177('0x30')]);}return _0x22da9d[_0x5177('0x5e')](_0x95f83a);}})[_0x5177('0x22')](function(_0x488c62){if(_0x488c62){return _0x488c62?{'count':_0x282cbc,'rows':_0x488c62}:null;}})[_0x5177('0x22')](respondWithResult(_0x4aa151,null))['catch'](handleError(_0x4aa151,null));};exports[_0x5177('0x60')]=function(_0x339d5d,_0x46d726,_0x2f9728){var _0x4ea67b={};var _0x154290={};var _0x14f272;var _0x52f8ca;return db[_0x5177('0x50')][_0x5177('0x5c')]({'where':{'id':_0x339d5d['params']['id']}})[_0x5177('0x22')](handleEntityNotFound(_0x46d726,null))['then'](function(_0x3f1aad){if(_0x3f1aad){_0x14f272=_0x3f1aad;_0x154290['model']=_['keys'](db['ServicenowField'][_0x5177('0x3b')]);_0x154290[_0x5177('0x41')]=_[_0x5177('0x42')](_0x339d5d['query']);_0x154290[_0x5177('0x43')]=_[_0x5177('0x44')](_0x154290[_0x5177('0x3f')],_0x154290[_0x5177('0x41')]);_0x4ea67b[_0x5177('0x45')]=_['intersection'](_0x154290[_0x5177('0x3f')],qs[_0x5177('0x46')](_0x339d5d['query'][_0x5177('0x46')]));_0x4ea67b['attributes']=_0x4ea67b[_0x5177('0x45')]['length']?_0x4ea67b[_0x5177('0x45')]:_0x154290[_0x5177('0x3f')];_0x4ea67b[_0x5177('0x49')]=qs[_0x5177('0x5f')](_0x339d5d[_0x5177('0x41')][_0x5177('0x5f')]);_0x4ea67b['where']=qs['filters'](_[_0x5177('0x4a')](_0x339d5d[_0x5177('0x41')],_0x154290[_0x5177('0x43')]));if(_0x339d5d['query'][_0x5177('0x4b')]){_0x4ea67b[_0x5177('0x4c')]=_['merge'](_0x4ea67b[_0x5177('0x4c')],{'$or':_['map'](_0x4ea67b[_0x5177('0x45')],function(_0x134b2f){var _0x451c23={};_0x451c23[_0x134b2f]={'$like':'%'+_0x339d5d['query'][_0x5177('0x4b')]+'%'};return _0x451c23;})});}_0x4ea67b=_['merge']({},_0x4ea67b,_0x339d5d[_0x5177('0x4f')]);return _0x14f272[_0x5177('0x60')](_0x4ea67b);}})['then'](function(_0x5a8146){if(_0x5a8146){_0x52f8ca=_0x5a8146['length'];if(!_0x339d5d[_0x5177('0x41')]['hasOwnProperty'](_0x5177('0x48'))){_0x4ea67b[_0x5177('0x31')]=qs[_0x5177('0x31')](_0x339d5d['query']['limit']);_0x4ea67b['offset']=qs[_0x5177('0x30')](_0x339d5d[_0x5177('0x41')][_0x5177('0x30')]);}return _0x14f272['getDescriptions'](_0x4ea67b);}})[_0x5177('0x22')](function(_0x358c97){if(_0x358c97){return _0x358c97?{'count':_0x52f8ca,'rows':_0x358c97}:null;}})['then'](respondWithResult(_0x46d726,null))[_0x5177('0x2c')](handleError(_0x46d726,null));}; \ No newline at end of file +var _0xea28=['model','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','fields','body','destroy','ServicenowField','order','options','getFields','findOne','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','count','offset','limit','set','Content-Range','apply','update','end','sendStatus','stack','name','send','index','map','ServicenowConfiguration','key','query','keys','intersection','attributes'];(function(_0x346d3e,_0x30abd9){var _0x56824f=function(_0x3324b4){while(--_0x3324b4){_0x346d3e['push'](_0x346d3e['shift']());}};_0x56824f(++_0x30abd9);}(_0xea28,0x13a));var _0x8ea2=function(_0x1632fb,_0x82c3e4){_0x1632fb=_0x1632fb-0x0;var _0x3af79c=_0xea28[_0x1632fb];return _0x3af79c;};'use strict';var pdf=require(_0x8ea2('0x0'));var emlformat=require(_0x8ea2('0x1'));var rimraf=require(_0x8ea2('0x2'));var zipdir=require(_0x8ea2('0x3'));var jsonpatch=require(_0x8ea2('0x4'));var rp=require(_0x8ea2('0x5'));var moment=require(_0x8ea2('0x6'));var BPromise=require(_0x8ea2('0x7'));var Mustache=require('mustache');var util=require(_0x8ea2('0x8'));var path=require(_0x8ea2('0x9'));var sox=require(_0x8ea2('0xa'));var csv=require('to-csv');var ejs=require(_0x8ea2('0xb'));var fs=require('fs');var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0x11'));var querystring=require(_0x8ea2('0x12'));var Papa=require(_0x8ea2('0x13'));var Redis=require(_0x8ea2('0x14'));var authService=require(_0x8ea2('0x15'));var qs=require(_0x8ea2('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x17'))(_0x8ea2('0x18'));var utils=require(_0x8ea2('0x19'));var config=require('../../config/environment');var db=require(_0x8ea2('0x1a'))['db'];var jayson=require(_0x8ea2('0x1b'));var client=jayson[_0x8ea2('0x1c')][_0x8ea2('0x1d')]({'port':0x232a});function checkPasswordPattern(_0xe47c0e,_0x5e662e,_0x2879d6){if(_0x2879d6){var _0x553154=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x553154['test'](_0x5e662e)){return _0xe47c0e;}else{throw new db[(_0x8ea2('0x1e'))][(_0x8ea2('0x1f'))](_0x8ea2('0x20'));}}else{return _0xe47c0e;}}function respondWithRpcPromise(_0x78669a,_0x393faf,_0xbb9bd1,_0x3cff96){return new BPromise(function(_0x11f5e8,_0x474873){var _0x396aab=_0x3cff96||client;return _0x396aab[_0x8ea2('0x21')](_0x78669a,_0xbb9bd1)[_0x8ea2('0x22')](function(_0x3bc774){logger[_0x8ea2('0x23')](_0x8ea2('0x24'),_0x393faf,_0x8ea2('0x25'));logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x393faf,_0x8ea2('0x25'),JSON[_0x8ea2('0x28')](_0x3bc774));if(_0x3bc774[_0x8ea2('0x29')]){if(_0x3bc774[_0x8ea2('0x29')]['code']===0x1f4){logger['error'](_0x8ea2('0x24'),_0x393faf,_0x3bc774[_0x8ea2('0x29')][_0x8ea2('0x2a')]);return _0x474873(_0x3bc774['error'][_0x8ea2('0x2a')]);}logger[_0x8ea2('0x29')]('ServicenowConfiguration,\x20%s,\x20%s',_0x393faf,_0x3bc774[_0x8ea2('0x29')][_0x8ea2('0x2a')]);return _0x11f5e8(_0x3bc774[_0x8ea2('0x29')][_0x8ea2('0x2a')]);}else{logger[_0x8ea2('0x23')](_0x8ea2('0x24'),_0x393faf,_0x8ea2('0x25'));_0x11f5e8(_0x3bc774[_0x8ea2('0x2b')][_0x8ea2('0x2a')]);}})['catch'](function(_0x433bc5){logger['error'](_0x8ea2('0x24'),_0x393faf,_0x433bc5);_0x474873(_0x433bc5);});});}function respondWithStatusCode(_0x42bec8,_0x29b38f){_0x29b38f=_0x29b38f||0xcc;return function(_0x4e2106){if(_0x4e2106){return _0x42bec8['sendStatus'](_0x29b38f);}return _0x42bec8[_0x8ea2('0x2c')](_0x29b38f)['end']();};}function respondWithResult(_0x200a49,_0x4e786d){_0x4e786d=_0x4e786d||0xc8;return function(_0x3be291){if(_0x3be291){return _0x200a49[_0x8ea2('0x2c')](_0x4e786d)[_0x8ea2('0x2d')](_0x3be291);}};}function respondWithFilteredResult(_0x266db8,_0x4e1b90){return function(_0x5ce1d4){if(_0x5ce1d4){var _0xacaa6c=_0x5ce1d4[_0x8ea2('0x2e')],_0x4da5b3=_0x4e1b90[_0x8ea2('0x2f')],_0x4a9875=_0x4e1b90[_0x8ea2('0x2f')]+_0x4e1b90[_0x8ea2('0x30')],_0x287078;if(_0x4a9875>=_0xacaa6c){_0x4a9875=_0xacaa6c;_0x287078=0xc8;}else{_0x287078=0xce;}_0x266db8[_0x8ea2('0x2c')](_0x287078);return _0x266db8[_0x8ea2('0x31')](_0x8ea2('0x32'),_0x4da5b3+'-'+_0x4a9875+'/'+_0xacaa6c)[_0x8ea2('0x2d')](_0x5ce1d4);}return null;};}function patchUpdates(_0x56d914){return function(_0x5b7ff9){try{jsonpatch[_0x8ea2('0x33')](_0x5b7ff9,_0x56d914,!![]);}catch(_0x188553){return BPromise['reject'](_0x188553);}return _0x5b7ff9['save']();};}function saveUpdates(_0x1ee7b2,_0x4e273e){return function(_0x64475b){if(_0x64475b){return _0x64475b[_0x8ea2('0x34')](_0x1ee7b2)['then'](function(_0x17b21c){return _0x17b21c;});}return null;};}function removeEntity(_0x38f3d5,_0x33abc8){return function(_0x4cfdc6){if(_0x4cfdc6){return _0x4cfdc6['destroy']()['then'](function(){_0x38f3d5[_0x8ea2('0x2c')](0xcc)[_0x8ea2('0x35')]();});}};}function handleEntityNotFound(_0x3fc785,_0x5ef924){return function(_0x456487){if(!_0x456487){_0x3fc785[_0x8ea2('0x36')](0x194);}return _0x456487;};}function handleError(_0x3d5bf0,_0x278e5d){_0x278e5d=_0x278e5d||0x1f4;return function(_0x253031){logger[_0x8ea2('0x29')](_0x253031[_0x8ea2('0x37')]);if(_0x253031[_0x8ea2('0x38')]){delete _0x253031['name'];}_0x3d5bf0[_0x8ea2('0x2c')](_0x278e5d)[_0x8ea2('0x39')](_0x253031);};}exports[_0x8ea2('0x3a')]=function(_0x467d97,_0x4eebc1){var _0x2a1f14={},_0x5355aa={},_0x1e03f2={'count':0x0,'rows':[]};var _0x103d5a=_[_0x8ea2('0x3b')](db[_0x8ea2('0x3c')]['rawAttributes'],function(_0x2bed24){return{'name':_0x2bed24['fieldName'],'type':_0x2bed24['type'][_0x8ea2('0x3d')]};});_0x5355aa['model']=_[_0x8ea2('0x3b')](_0x103d5a,_0x8ea2('0x38'));_0x5355aa[_0x8ea2('0x3e')]=_[_0x8ea2('0x3f')](_0x467d97[_0x8ea2('0x3e')]);_0x5355aa['filters']=_[_0x8ea2('0x40')](_0x5355aa['model'],_0x5355aa[_0x8ea2('0x3e')]);_0x2a1f14[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x5355aa[_0x8ea2('0x42')],qs['fields'](_0x467d97[_0x8ea2('0x3e')]['fields']));_0x2a1f14[_0x8ea2('0x41')]=_0x2a1f14['attributes'][_0x8ea2('0x43')]?_0x2a1f14[_0x8ea2('0x41')]:_0x5355aa[_0x8ea2('0x42')];if(!_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x44')](_0x8ea2('0x45'))){_0x2a1f14[_0x8ea2('0x30')]=qs['limit'](_0x467d97['query'][_0x8ea2('0x30')]);_0x2a1f14['offset']=qs['offset'](_0x467d97['query'][_0x8ea2('0x2f')]);}_0x2a1f14['order']=qs[_0x8ea2('0x46')](_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x46')]);_0x2a1f14[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_[_0x8ea2('0x49')](_0x467d97[_0x8ea2('0x3e')],_0x5355aa[_0x8ea2('0x48')]),_0x103d5a);if(_0x467d97['query'][_0x8ea2('0x4a')]){_0x2a1f14[_0x8ea2('0x47')]=_[_0x8ea2('0x4b')](_0x2a1f14['where'],{'$or':_[_0x8ea2('0x3b')](_0x103d5a,function(_0x17df7b){if(_0x17df7b[_0x8ea2('0x4c')]!==_0x8ea2('0x4d')){var _0x20992d={};_0x20992d[_0x17df7b['name']]={'$like':'%'+_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x4a')]+'%'};return _0x20992d;}})});}_0x2a1f14=_[_0x8ea2('0x4b')]({},_0x2a1f14,_0x467d97['options']);var _0x99fe91={'where':_0x2a1f14[_0x8ea2('0x47')]};return db[_0x8ea2('0x3c')][_0x8ea2('0x2e')](_0x99fe91)[_0x8ea2('0x22')](function(_0x3ca1c8){_0x1e03f2[_0x8ea2('0x2e')]=_0x3ca1c8;if(_0x467d97[_0x8ea2('0x3e')][_0x8ea2('0x4e')]){_0x2a1f14[_0x8ea2('0x4f')]=[{'all':!![]}];}return db[_0x8ea2('0x3c')][_0x8ea2('0x50')](_0x2a1f14);})[_0x8ea2('0x22')](function(_0x12e81f){_0x1e03f2['rows']=_0x12e81f;return _0x1e03f2;})[_0x8ea2('0x22')](respondWithFilteredResult(_0x4eebc1,_0x2a1f14))[_0x8ea2('0x51')](handleError(_0x4eebc1,null));};exports[_0x8ea2('0x52')]=function(_0x6ed85a,_0x182a46){var _0x1daa25={'raw':![],'where':{'id':_0x6ed85a[_0x8ea2('0x53')]['id']}},_0x11b3ef={};_0x11b3ef['model']=_[_0x8ea2('0x3f')](db[_0x8ea2('0x3c')][_0x8ea2('0x54')]);_0x11b3ef['query']=_['keys'](_0x6ed85a[_0x8ea2('0x3e')]);_0x11b3ef[_0x8ea2('0x48')]=_[_0x8ea2('0x40')](_0x11b3ef['model'],_0x11b3ef[_0x8ea2('0x3e')]);_0x1daa25[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x11b3ef[_0x8ea2('0x42')],qs[_0x8ea2('0x55')](_0x6ed85a['query']['fields']));_0x1daa25[_0x8ea2('0x41')]=_0x1daa25[_0x8ea2('0x41')][_0x8ea2('0x43')]?_0x1daa25['attributes']:_0x11b3ef[_0x8ea2('0x42')];if(_0x6ed85a[_0x8ea2('0x3e')][_0x8ea2('0x4e')]){_0x1daa25['include']=[{'all':!![]}];}_0x1daa25=_['merge']({},_0x1daa25,_0x6ed85a['options']);return db['ServicenowConfiguration']['find'](_0x1daa25)[_0x8ea2('0x22')](handleEntityNotFound(_0x182a46,null))[_0x8ea2('0x22')](respondWithResult(_0x182a46,null))['catch'](handleError(_0x182a46,null));};exports['create']=function(_0x1a7a75,_0x12c0db){return db[_0x8ea2('0x3c')]['create'](_0x1a7a75[_0x8ea2('0x56')],{})[_0x8ea2('0x22')](respondWithResult(_0x12c0db,0xc9))['catch'](handleError(_0x12c0db,null));};exports[_0x8ea2('0x34')]=function(_0x28e56a,_0x293dd8){if(_0x28e56a[_0x8ea2('0x56')]['id']){delete _0x28e56a[_0x8ea2('0x56')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x28e56a['params']['id']}})[_0x8ea2('0x22')](handleEntityNotFound(_0x293dd8,null))[_0x8ea2('0x22')](saveUpdates(_0x28e56a[_0x8ea2('0x56')],null))[_0x8ea2('0x22')](respondWithResult(_0x293dd8,null))[_0x8ea2('0x51')](handleError(_0x293dd8,null));};exports[_0x8ea2('0x57')]=function(_0x36fda3,_0x5265e7){return db['ServicenowConfiguration']['find']({'where':{'id':_0x36fda3[_0x8ea2('0x53')]['id']}})[_0x8ea2('0x22')](handleEntityNotFound(_0x5265e7,null))[_0x8ea2('0x22')](removeEntity(_0x5265e7,null))[_0x8ea2('0x51')](handleError(_0x5265e7,null));};exports['getFields']=function(_0x11824e,_0x2b8662,_0x4ec833){var _0x21485a={};var _0x193c32={};var _0x142ede;var _0xf78d1d;return db[_0x8ea2('0x3c')]['findOne']({'where':{'id':_0x11824e['params']['id']}})['then'](handleEntityNotFound(_0x2b8662,null))[_0x8ea2('0x22')](function(_0x1e2066){if(_0x1e2066){_0x142ede=_0x1e2066;_0x193c32[_0x8ea2('0x42')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x58')]['rawAttributes']);_0x193c32[_0x8ea2('0x3e')]=_[_0x8ea2('0x3f')](_0x11824e[_0x8ea2('0x3e')]);_0x193c32[_0x8ea2('0x48')]=_['intersection'](_0x193c32[_0x8ea2('0x42')],_0x193c32['query']);_0x21485a[_0x8ea2('0x41')]=_['intersection'](_0x193c32[_0x8ea2('0x42')],qs[_0x8ea2('0x55')](_0x11824e['query']['fields']));_0x21485a[_0x8ea2('0x41')]=_0x21485a['attributes'][_0x8ea2('0x43')]?_0x21485a[_0x8ea2('0x41')]:_0x193c32[_0x8ea2('0x42')];_0x21485a[_0x8ea2('0x59')]=qs['sort'](_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x46')]);_0x21485a[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_[_0x8ea2('0x49')](_0x11824e[_0x8ea2('0x3e')],_0x193c32[_0x8ea2('0x48')]));if(_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]){_0x21485a[_0x8ea2('0x47')]=_[_0x8ea2('0x4b')](_0x21485a[_0x8ea2('0x47')],{'$or':_['map'](_0x21485a[_0x8ea2('0x41')],function(_0x2d130a){var _0x4de6ba={};_0x4de6ba[_0x2d130a]={'$like':'%'+_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]+'%'};return _0x4de6ba;})});}_0x21485a=_[_0x8ea2('0x4b')]({},_0x21485a,_0x11824e[_0x8ea2('0x5a')]);return _0x142ede[_0x8ea2('0x5b')](_0x21485a);}})[_0x8ea2('0x22')](function(_0xefb7b){if(_0xefb7b){_0xf78d1d=_0xefb7b[_0x8ea2('0x43')];if(!_0x11824e[_0x8ea2('0x3e')]['hasOwnProperty'](_0x8ea2('0x45'))){_0x21485a[_0x8ea2('0x30')]=qs[_0x8ea2('0x30')](_0x11824e[_0x8ea2('0x3e')][_0x8ea2('0x30')]);_0x21485a['offset']=qs['offset'](_0x11824e['query'][_0x8ea2('0x2f')]);}return _0x142ede[_0x8ea2('0x5b')](_0x21485a);}})[_0x8ea2('0x22')](function(_0x31bda0){if(_0x31bda0){return _0x31bda0?{'count':_0xf78d1d,'rows':_0x31bda0}:null;}})[_0x8ea2('0x22')](respondWithResult(_0x2b8662,null))[_0x8ea2('0x51')](handleError(_0x2b8662,null));};exports['getSubjects']=function(_0x428106,_0x14dd7d,_0x5712a3){var _0x55f929={};var _0x2a7ccc={};var _0x145a88;var _0x1bf4cb;return db[_0x8ea2('0x3c')][_0x8ea2('0x5c')]({'where':{'id':_0x428106[_0x8ea2('0x53')]['id']}})[_0x8ea2('0x22')](handleEntityNotFound(_0x14dd7d,null))['then'](function(_0x435233){if(_0x435233){_0x145a88=_0x435233;_0x2a7ccc[_0x8ea2('0x42')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x58')]['rawAttributes']);_0x2a7ccc[_0x8ea2('0x3e')]=_[_0x8ea2('0x3f')](_0x428106[_0x8ea2('0x3e')]);_0x2a7ccc['filters']=_[_0x8ea2('0x40')](_0x2a7ccc['model'],_0x2a7ccc['query']);_0x55f929[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x2a7ccc['model'],qs['fields'](_0x428106['query'][_0x8ea2('0x55')]));_0x55f929['attributes']=_0x55f929['attributes'][_0x8ea2('0x43')]?_0x55f929[_0x8ea2('0x41')]:_0x2a7ccc[_0x8ea2('0x42')];_0x55f929[_0x8ea2('0x59')]=qs[_0x8ea2('0x46')](_0x428106[_0x8ea2('0x3e')][_0x8ea2('0x46')]);_0x55f929[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_[_0x8ea2('0x49')](_0x428106[_0x8ea2('0x3e')],_0x2a7ccc[_0x8ea2('0x48')]));if(_0x428106[_0x8ea2('0x3e')][_0x8ea2('0x4a')]){_0x55f929['where']=_[_0x8ea2('0x4b')](_0x55f929[_0x8ea2('0x47')],{'$or':_[_0x8ea2('0x3b')](_0x55f929['attributes'],function(_0x1807bb){var _0x486ae8={};_0x486ae8[_0x1807bb]={'$like':'%'+_0x428106[_0x8ea2('0x3e')]['filter']+'%'};return _0x486ae8;})});}_0x55f929=_[_0x8ea2('0x4b')]({},_0x55f929,_0x428106['options']);return _0x145a88[_0x8ea2('0x5d')](_0x55f929);}})[_0x8ea2('0x22')](function(_0x4cdc8d){if(_0x4cdc8d){_0x1bf4cb=_0x4cdc8d[_0x8ea2('0x43')];if(!_0x428106['query'][_0x8ea2('0x44')](_0x8ea2('0x45'))){_0x55f929[_0x8ea2('0x30')]=qs[_0x8ea2('0x30')](_0x428106[_0x8ea2('0x3e')]['limit']);_0x55f929['offset']=qs[_0x8ea2('0x2f')](_0x428106['query'][_0x8ea2('0x2f')]);}return _0x145a88[_0x8ea2('0x5d')](_0x55f929);}})[_0x8ea2('0x22')](function(_0x1c365e){if(_0x1c365e){return _0x1c365e?{'count':_0x1bf4cb,'rows':_0x1c365e}:null;}})[_0x8ea2('0x22')](respondWithResult(_0x14dd7d,null))[_0x8ea2('0x51')](handleError(_0x14dd7d,null));};exports['getDescriptions']=function(_0x4aa32e,_0x53d9f3,_0x1f50dc){var _0x576075={};var _0x27b7c6={};var _0x36a913;var _0x3d9242;return db[_0x8ea2('0x3c')][_0x8ea2('0x5c')]({'where':{'id':_0x4aa32e[_0x8ea2('0x53')]['id']}})['then'](handleEntityNotFound(_0x53d9f3,null))[_0x8ea2('0x22')](function(_0x1a6426){if(_0x1a6426){_0x36a913=_0x1a6426;_0x27b7c6[_0x8ea2('0x42')]=_[_0x8ea2('0x3f')](db[_0x8ea2('0x58')]['rawAttributes']);_0x27b7c6['query']=_[_0x8ea2('0x3f')](_0x4aa32e[_0x8ea2('0x3e')]);_0x27b7c6[_0x8ea2('0x48')]=_[_0x8ea2('0x40')](_0x27b7c6[_0x8ea2('0x42')],_0x27b7c6[_0x8ea2('0x3e')]);_0x576075[_0x8ea2('0x41')]=_[_0x8ea2('0x40')](_0x27b7c6[_0x8ea2('0x42')],qs[_0x8ea2('0x55')](_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x55')]));_0x576075[_0x8ea2('0x41')]=_0x576075[_0x8ea2('0x41')][_0x8ea2('0x43')]?_0x576075[_0x8ea2('0x41')]:_0x27b7c6[_0x8ea2('0x42')];_0x576075['order']=qs['sort'](_0x4aa32e[_0x8ea2('0x3e')]['sort']);_0x576075[_0x8ea2('0x47')]=qs[_0x8ea2('0x48')](_['pick'](_0x4aa32e[_0x8ea2('0x3e')],_0x27b7c6['filters']));if(_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]){_0x576075['where']=_[_0x8ea2('0x4b')](_0x576075[_0x8ea2('0x47')],{'$or':_[_0x8ea2('0x3b')](_0x576075[_0x8ea2('0x41')],function(_0x14dac9){var _0x28e80a={};_0x28e80a[_0x14dac9]={'$like':'%'+_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x4a')]+'%'};return _0x28e80a;})});}_0x576075=_[_0x8ea2('0x4b')]({},_0x576075,_0x4aa32e[_0x8ea2('0x5a')]);return _0x36a913['getDescriptions'](_0x576075);}})[_0x8ea2('0x22')](function(_0x1051ac){if(_0x1051ac){_0x3d9242=_0x1051ac['length'];if(!_0x4aa32e[_0x8ea2('0x3e')]['hasOwnProperty']('nolimit')){_0x576075['limit']=qs[_0x8ea2('0x30')](_0x4aa32e['query'][_0x8ea2('0x30')]);_0x576075[_0x8ea2('0x2f')]=qs[_0x8ea2('0x2f')](_0x4aa32e[_0x8ea2('0x3e')][_0x8ea2('0x2f')]);}return _0x36a913[_0x8ea2('0x5e')](_0x576075);}})['then'](function(_0x2f4f45){if(_0x2f4f45){return _0x2f4f45?{'count':_0x3d9242,'rows':_0x2f4f45}:null;}})['then'](respondWithResult(_0x53d9f3,null))[_0x8ea2('0x51')](handleError(_0x53d9f3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index fb2f63c..8d57549 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 _0xc5df=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','../../config/logger','api'];(function(_0x94ef9f,_0x413203){var _0x1c34ab=function(_0x3af182){while(--_0x3af182){_0x94ef9f['push'](_0x94ef9f['shift']());}};_0x1c34ab(++_0x413203);}(_0xc5df,0x80));var _0xfc5d=function(_0x5c1876,_0x1536a0){_0x5c1876=_0x5c1876-0x0;var _0x117949=_0xc5df[_0x5c1876];return _0x117949;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfc5d('0x0'))(_0xfc5d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfc5d('0x2'));var fs=require('fs');var path=require(_0xfc5d('0x3'));var rimraf=require(_0xfc5d('0x4'));var config=require(_0xfc5d('0x5'));var attributes=require(_0xfc5d('0x6'));module['exports']=function(_0x1c8057,_0x2df24e){return _0x1c8057[_0xfc5d('0x7')](_0xfc5d('0x8'),attributes,{'tableName':_0xfc5d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca03=['rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x5ed354,_0x3e2edc){var _0x5d3688=function(_0x4abc56){while(--_0x4abc56){_0x5ed354['push'](_0x5ed354['shift']());}};_0x5d3688(++_0x3e2edc);}(_0xca03,0x1f2));var _0x3ca0=function(_0x32dff2,_0x9320b3){_0x32dff2=_0x32dff2-0x0;var _0x12108e=_0xca03[_0x32dff2];return _0x12108e;};'use strict';var _=require(_0x3ca0('0x0'));var util=require(_0x3ca0('0x1'));var logger=require(_0x3ca0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3ca0('0x3'));var rp=require(_0x3ca0('0x4'));var fs=require('fs');var path=require(_0x3ca0('0x5'));var rimraf=require(_0x3ca0('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ca0('0x7'));module[_0x3ca0('0x8')]=function(_0xe959b9,_0x3a1f79){return _0xe959b9[_0x3ca0('0x9')](_0x3ca0('0xa'),attributes,{'tableName':_0x3ca0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index cd63d28..b73f0db 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 _0x9a82=['ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info'];(function(_0x4acc51,_0xb1a7c3){var _0x18cf37=function(_0x1f4023){while(--_0x1f4023){_0x4acc51['push'](_0x4acc51['shift']());}};_0x18cf37(++_0xb1a7c3);}(_0x9a82,0x17a));var _0x29a8=function(_0x4cbb4a,_0x532f48){_0x4cbb4a=_0x4cbb4a-0x0;var _0x6f6285=_0x9a82[_0x4cbb4a];return _0x6f6285;};'use strict';var _=require(_0x29a8('0x0'));var util=require('util');var moment=require(_0x29a8('0x1'));var BPromise=require(_0x29a8('0x2'));var rs=require(_0x29a8('0x3'));var fs=require('fs');var Redis=require(_0x29a8('0x4'));var db=require(_0x29a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x29a8('0x6'))(_0x29a8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x29a8('0x8')][_0x29a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12c7f1,_0x1e1f12,_0x3d4066){return new BPromise(function(_0x42f1c2,_0x14aaee){return client[_0x29a8('0xa')](_0x12c7f1,_0x3d4066)[_0x29a8('0xb')](function(_0x9565b8){logger[_0x29a8('0xc')](_0x29a8('0xd'),_0x1e1f12,'request\x20sent');logger[_0x29a8('0xe')](_0x29a8('0xf'),_0x1e1f12,'request\x20sent',JSON[_0x29a8('0x10')](_0x9565b8));if(_0x9565b8[_0x29a8('0x11')]){if(_0x9565b8[_0x29a8('0x11')][_0x29a8('0x12')]===0x1f4){logger[_0x29a8('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1e1f12,_0x9565b8[_0x29a8('0x11')]['message']);return _0x14aaee(_0x9565b8['error'][_0x29a8('0x13')]);}logger[_0x29a8('0x11')](_0x29a8('0xd'),_0x1e1f12,_0x9565b8[_0x29a8('0x11')]['message']);return _0x42f1c2(_0x9565b8[_0x29a8('0x11')]['message']);}else{logger[_0x29a8('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1e1f12,_0x29a8('0x14'));_0x42f1c2(_0x9565b8[_0x29a8('0x15')][_0x29a8('0x13')]);}})[_0x29a8('0x16')](function(_0x342b8e){logger['error'](_0x29a8('0xd'),_0x1e1f12,_0x342b8e);_0x14aaee(_0x342b8e);});});} \ No newline at end of file +var _0xcc0c=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2b13f6,_0x25e44c){var _0x14ea98=function(_0x55ac59){while(--_0x55ac59){_0x2b13f6['push'](_0x2b13f6['shift']());}};_0x14ea98(++_0x25e44c);}(_0xcc0c,0x88));var _0xccc0=function(_0x100827,_0x49215d){_0x100827=_0x100827-0x0;var _0x1e6245=_0xcc0c[_0x100827];return _0x1e6245;};'use strict';var _=require(_0xccc0('0x0'));var util=require(_0xccc0('0x1'));var moment=require(_0xccc0('0x2'));var BPromise=require('bluebird');var rs=require(_0xccc0('0x3'));var fs=require('fs');var Redis=require(_0xccc0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xccc0('0x5'));var logger=require(_0xccc0('0x6'))(_0xccc0('0x7'));var config=require(_0xccc0('0x8'));var jayson=require(_0xccc0('0x9'));var client=jayson[_0xccc0('0xa')][_0xccc0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3af557,_0x2128e2,_0x4d540c){return new BPromise(function(_0x468513,_0x64ecf7){return client['request'](_0x3af557,_0x4d540c)['then'](function(_0x138153){logger[_0xccc0('0xc')](_0xccc0('0xd'),_0x2128e2,_0xccc0('0xe'));logger[_0xccc0('0xf')](_0xccc0('0x10'),_0x2128e2,_0xccc0('0xe'),JSON[_0xccc0('0x11')](_0x138153));if(_0x138153[_0xccc0('0x12')]){if(_0x138153[_0xccc0('0x12')][_0xccc0('0x13')]===0x1f4){logger[_0xccc0('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2128e2,_0x138153['error'][_0xccc0('0x14')]);return _0x64ecf7(_0x138153[_0xccc0('0x12')][_0xccc0('0x14')]);}logger[_0xccc0('0x12')](_0xccc0('0xd'),_0x2128e2,_0x138153[_0xccc0('0x12')][_0xccc0('0x14')]);return _0x468513(_0x138153[_0xccc0('0x12')]['message']);}else{logger[_0xccc0('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2128e2,'request\x20sent');_0x468513(_0x138153[_0xccc0('0x15')][_0xccc0('0x14')]);}})[_0xccc0('0x16')](function(_0x1c2b4e){logger[_0xccc0('0x12')](_0xccc0('0xd'),_0x2128e2,_0x1c2b4e);_0x64ecf7(_0x1c2b4e);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index bbc26db..da2000b 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 _0x25bf=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','/:id','show','post','create','put','destroy','exports'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x25bf,0x11d));var _0xf25b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x25bf[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xf25b('0x0'));var util=require('util');var path=require(_0xf25b('0x1'));var timeout=require(_0xf25b('0x2'));var express=require(_0xf25b('0x3'));var router=express[_0xf25b('0x4')]();var auth=require(_0xf25b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf25b('0x6'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xf25b('0x7')](),controller['index']);router['get'](_0xf25b('0x8'),auth[_0xf25b('0x7')](),controller[_0xf25b('0x9')]);router[_0xf25b('0xa')]('/',auth[_0xf25b('0x7')](),controller[_0xf25b('0xb')]);router[_0xf25b('0xc')](_0xf25b('0x8'),auth[_0xf25b('0x7')](),controller['update']);router['delete'](_0xf25b('0x8'),auth[_0xf25b('0x7')](),controller[_0xf25b('0xd')]);module[_0xf25b('0xe')]=router; \ No newline at end of file +var _0xa770=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated'];(function(_0x293a23,_0xab710f){var _0x4b1ba8=function(_0x53bf50){while(--_0x53bf50){_0x293a23['push'](_0x293a23['shift']());}};_0x4b1ba8(++_0xab710f);}(_0xa770,0x10d));var _0x0a77=function(_0x2c6504,_0x3ade63){_0x2c6504=_0x2c6504-0x0;var _0x18d226=_0xa770[_0x2c6504];return _0x18d226;};'use strict';var multer=require(_0x0a77('0x0'));var util=require(_0x0a77('0x1'));var path=require(_0x0a77('0x2'));var timeout=require(_0x0a77('0x3'));var express=require('express');var router=express[_0x0a77('0x4')]();var auth=require(_0x0a77('0x5'));var interaction=require(_0x0a77('0x6'));var config=require(_0x0a77('0x7'));var controller=require(_0x0a77('0x8'));router[_0x0a77('0x9')]('/',auth[_0x0a77('0xa')](),controller[_0x0a77('0xb')]);router['get'](_0x0a77('0xc'),auth[_0x0a77('0xa')](),controller[_0x0a77('0xd')]);router[_0x0a77('0xe')]('/',auth[_0x0a77('0xa')](),controller[_0x0a77('0xf')]);router[_0x0a77('0x10')](_0x0a77('0xc'),auth[_0x0a77('0xa')](),controller[_0x0a77('0x11')]);router[_0x0a77('0x12')](_0x0a77('0xc'),auth[_0x0a77('0xa')](),controller['destroy']);module[_0x0a77('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 5da4ecb..aae66b9 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 _0x84e1=['variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x42e75c,_0x136223){var _0x42b0b8=function(_0x4bbc58){while(--_0x4bbc58){_0x42e75c['push'](_0x42e75c['shift']());}};_0x42b0b8(++_0x136223);}(_0x84e1,0x1dc));var _0x184e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x84e1[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x184e('0x0'));module[_0x184e('0x1')]={'type':{'type':Sequelize[_0x184e('0x2')](_0x184e('0x3'),_0x184e('0x4'),_0x184e('0x5'),'keyValue'),'defaultValue':_0x184e('0x3')},'content':{'type':Sequelize[_0x184e('0x6')]},'key':{'type':Sequelize[_0x184e('0x6')]},'keyType':{'type':Sequelize[_0x184e('0x2')](_0x184e('0x3'),_0x184e('0x4'),_0x184e('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x184e('0x6')]},'nameField':{'type':Sequelize[_0x184e('0x6')]},'customField':{'type':Sequelize[_0x184e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1105=['string','variable','customVariable','keyValue','STRING','sequelize','ENUM'];(function(_0x46a214,_0x1da7ec){var _0x9f6d43=function(_0x58ab16){while(--_0x58ab16){_0x46a214['push'](_0x46a214['shift']());}};_0x9f6d43(++_0x1da7ec);}(_0x1105,0x124));var _0x5110=function(_0x536a51,_0x2bf510){_0x536a51=_0x536a51-0x0;var _0x4a4d9e=_0x1105[_0x536a51];return _0x4a4d9e;};'use strict';var Sequelize=require(_0x5110('0x0'));module['exports']={'type':{'type':Sequelize[_0x5110('0x1')](_0x5110('0x2'),_0x5110('0x3'),_0x5110('0x4'),_0x5110('0x5')),'defaultValue':_0x5110('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5110('0x6')]},'keyType':{'type':Sequelize[_0x5110('0x1')](_0x5110('0x2'),_0x5110('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x5110('0x6')]},'idField':{'type':Sequelize[_0x5110('0x6')]},'nameField':{'type':Sequelize[_0x5110('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 53dd1c6..8caf362 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(_0x285fff,_0x4fb54f){var _0x44e78f=function(_0x1b64c8){while(--_0x1b64c8){_0x285fff['push'](_0x285fff['shift']());}};_0x44e78f(++_0x4fb54f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x549aea,_0x1875f4){var _0x325453=function(_0x132fd4){while(--_0x132fd4){_0x549aea['push'](_0x549aea['shift']());}};_0x325453(++_0x1875f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index a2b84c9..22e2b64 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 _0x2bd5=['path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0xaf0996,_0x3ee642){var _0x8fde5a=function(_0x130dc7){while(--_0x130dc7){_0xaf0996['push'](_0xaf0996['shift']());}};_0x8fde5a(++_0x3ee642);}(_0x2bd5,0x14b));var _0x52bd=function(_0x2867a6,_0x10d905){_0x2867a6=_0x2867a6-0x0;var _0x4afc2b=_0x2bd5[_0x2867a6];return _0x4afc2b;};'use strict';var _=require(_0x52bd('0x0'));var util=require(_0x52bd('0x1'));var logger=require(_0x52bd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x52bd('0x3'));var rp=require(_0x52bd('0x4'));var fs=require('fs');var path=require(_0x52bd('0x5'));var rimraf=require('rimraf');var config=require(_0x52bd('0x6'));var attributes=require(_0x52bd('0x7'));module[_0x52bd('0x8')]=function(_0x28b914,_0x34f666){return _0x28b914[_0x52bd('0x9')](_0x52bd('0xa'),attributes,{'tableName':_0x52bd('0xb'),'paranoid':![],'indexes':[{'name':_0x52bd('0xc'),'fields':[_0x52bd('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62a1=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x62a1,0x1b4));var _0x162a=function(_0x4868d8,_0x261b95){_0x4868d8=_0x4868d8-0x0;var _0x22efc3=_0x62a1[_0x4868d8];return _0x22efc3;};'use strict';var _=require(_0x162a('0x0'));var util=require(_0x162a('0x1'));var logger=require('../../config/logger')(_0x162a('0x2'));var moment=require(_0x162a('0x3'));var BPromise=require(_0x162a('0x4'));var rp=require(_0x162a('0x5'));var fs=require('fs');var path=require(_0x162a('0x6'));var rimraf=require(_0x162a('0x7'));var config=require(_0x162a('0x8'));var attributes=require(_0x162a('0x9'));module[_0x162a('0xa')]=function(_0x20f5d1,_0xc1e62){return _0x20f5d1[_0x162a('0xb')]('ServicenowField',attributes,{'tableName':_0x162a('0xc'),'paranoid':![],'indexes':[{'name':_0x162a('0xd'),'fields':[_0x162a('0xe'),_0x162a('0xf')],'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 ebc2269..2e7d889 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 _0x4391=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x3701e6,_0x8b8714){var _0x119cde=function(_0x25621d){while(--_0x25621d){_0x3701e6['push'](_0x3701e6['shift']());}};_0x119cde(++_0x8b8714);}(_0x4391,0x1e1));var _0x1439=function(_0x41ef68,_0x55fd5a){_0x41ef68=_0x41ef68-0x0;var _0x56e13b=_0x4391[_0x41ef68];return _0x56e13b;};'use strict';var _=require(_0x1439('0x0'));var util=require(_0x1439('0x1'));var moment=require(_0x1439('0x2'));var BPromise=require('bluebird');var rs=require(_0x1439('0x3'));var fs=require('fs');var Redis=require(_0x1439('0x4'));var db=require(_0x1439('0x5'))['db'];var utils=require(_0x1439('0x6'));var logger=require(_0x1439('0x7'))(_0x1439('0x8'));var config=require(_0x1439('0x9'));var jayson=require(_0x1439('0xa'));var client=jayson[_0x1439('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x217883,_0x5053d2,_0x299b86){return new BPromise(function(_0x86e418,_0x40684d){return client[_0x1439('0xc')](_0x217883,_0x299b86)[_0x1439('0xd')](function(_0x150d42){logger[_0x1439('0xe')](_0x1439('0xf'),_0x5053d2,_0x1439('0x10'));logger[_0x1439('0x11')](_0x1439('0x12'),_0x5053d2,_0x1439('0x10'),JSON[_0x1439('0x13')](_0x150d42));if(_0x150d42[_0x1439('0x14')]){if(_0x150d42[_0x1439('0x14')][_0x1439('0x15')]===0x1f4){logger[_0x1439('0x14')](_0x1439('0xf'),_0x5053d2,_0x150d42['error'][_0x1439('0x16')]);return _0x40684d(_0x150d42[_0x1439('0x14')][_0x1439('0x16')]);}logger[_0x1439('0x14')]('ServicenowField,\x20%s,\x20%s',_0x5053d2,_0x150d42[_0x1439('0x14')][_0x1439('0x16')]);return _0x86e418(_0x150d42[_0x1439('0x14')]['message']);}else{logger[_0x1439('0xe')]('ServicenowField,\x20%s,\x20%s',_0x5053d2,_0x1439('0x10'));_0x86e418(_0x150d42[_0x1439('0x17')][_0x1439('0x16')]);}})[_0x1439('0x18')](function(_0x1c9cdd){logger[_0x1439('0x14')](_0x1439('0xf'),_0x5053d2,_0x1c9cdd);_0x40684d(_0x1c9cdd);});});} \ No newline at end of file +var _0x63ed=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3e5021,_0x540817){var _0x3db478=function(_0x15b94a){while(--_0x15b94a){_0x3e5021['push'](_0x3e5021['shift']());}};_0x3db478(++_0x540817);}(_0x63ed,0xff));var _0xd63e=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x63ed[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xd63e('0x0'));var util=require(_0xd63e('0x1'));var moment=require(_0xd63e('0x2'));var BPromise=require(_0xd63e('0x3'));var rs=require(_0xd63e('0x4'));var fs=require('fs');var Redis=require(_0xd63e('0x5'));var db=require(_0xd63e('0x6'))['db'];var utils=require(_0xd63e('0x7'));var logger=require(_0xd63e('0x8'))(_0xd63e('0x9'));var config=require('../../config/environment');var jayson=require(_0xd63e('0xa'));var client=jayson[_0xd63e('0xb')][_0xd63e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54330c,_0x31cf56,_0x198322){return new BPromise(function(_0x24c099,_0x44e8b0){return client[_0xd63e('0xd')](_0x54330c,_0x198322)[_0xd63e('0xe')](function(_0x18da68){logger[_0xd63e('0xf')](_0xd63e('0x10'),_0x31cf56,'request\x20sent');logger[_0xd63e('0x11')](_0xd63e('0x12'),_0x31cf56,_0xd63e('0x13'),JSON[_0xd63e('0x14')](_0x18da68));if(_0x18da68[_0xd63e('0x15')]){if(_0x18da68[_0xd63e('0x15')]['code']===0x1f4){logger[_0xd63e('0x15')]('ServicenowField,\x20%s,\x20%s',_0x31cf56,_0x18da68[_0xd63e('0x15')][_0xd63e('0x16')]);return _0x44e8b0(_0x18da68[_0xd63e('0x15')]['message']);}logger[_0xd63e('0x15')](_0xd63e('0x10'),_0x31cf56,_0x18da68['error'][_0xd63e('0x16')]);return _0x24c099(_0x18da68[_0xd63e('0x15')]['message']);}else{logger[_0xd63e('0xf')](_0xd63e('0x10'),_0x31cf56,_0xd63e('0x13'));_0x24c099(_0x18da68[_0xd63e('0x17')][_0xd63e('0x16')]);}})[_0xd63e('0x18')](function(_0x4e31ae){logger[_0xd63e('0x15')](_0xd63e('0x10'),_0x31cf56,_0x4e31ae);_0x44e8b0(_0x4e31ae);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index a01e77d..9df841f 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 _0x76af=['create','post','/:id/configurations','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields'];(function(_0x49cf27,_0x58ebe3){var _0x4ba57d=function(_0x5952ee){while(--_0x5952ee){_0x49cf27['push'](_0x49cf27['shift']());}};_0x4ba57d(++_0x58ebe3);}(_0x76af,0x1ec));var _0xf76a=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0x76af[_0x4d8dc3];return _0x9b03d9;};'use strict';var multer=require(_0xf76a('0x0'));var util=require(_0xf76a('0x1'));var path=require(_0xf76a('0x2'));var timeout=require('connect-timeout');var express=require(_0xf76a('0x3'));var router=express['Router']();var auth=require(_0xf76a('0x4'));var interaction=require(_0xf76a('0x5'));var config=require(_0xf76a('0x6'));var controller=require(_0xf76a('0x7'));router['get']('/',auth[_0xf76a('0x8')](),controller[_0xf76a('0x9')]);router[_0xf76a('0xa')](_0xf76a('0xb'),auth[_0xf76a('0x8')](),controller['show']);router[_0xf76a('0xa')]('/:id/configurations',auth[_0xf76a('0x8')](),controller['getConfigurations']);router['get'](_0xf76a('0xc'),auth[_0xf76a('0x8')](),controller[_0xf76a('0xd')]);router['post']('/',auth[_0xf76a('0x8')](),controller[_0xf76a('0xe')]);router[_0xf76a('0xf')](_0xf76a('0x10'),auth[_0xf76a('0x8')](),controller['addConfiguration']);router[_0xf76a('0x11')](_0xf76a('0xb'),auth['isAuthenticated'](),controller[_0xf76a('0x12')]);router[_0xf76a('0x13')]('/:id',auth[_0xf76a('0x8')](),controller[_0xf76a('0x14')]);module[_0xf76a('0x15')]=router; \ No newline at end of file +var _0x8a76=['/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x8a76,0x1ec));var _0x68a7=function(_0x50b382,_0x19ed75){_0x50b382=_0x50b382-0x0;var _0xf55325=_0x8a76[_0x50b382];return _0xf55325;};'use strict';var multer=require(_0x68a7('0x0'));var util=require(_0x68a7('0x1'));var path=require(_0x68a7('0x2'));var timeout=require(_0x68a7('0x3'));var express=require('express');var router=express[_0x68a7('0x4')]();var auth=require(_0x68a7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x68a7('0x6'));var controller=require('./intSugarcrmAccount.controller');router[_0x68a7('0x7')]('/',auth['isAuthenticated'](),controller[_0x68a7('0x8')]);router[_0x68a7('0x7')](_0x68a7('0x9'),auth[_0x68a7('0xa')](),controller[_0x68a7('0xb')]);router[_0x68a7('0x7')](_0x68a7('0xc'),auth['isAuthenticated'](),controller[_0x68a7('0xd')]);router[_0x68a7('0x7')](_0x68a7('0xe'),auth[_0x68a7('0xa')](),controller[_0x68a7('0xf')]);router['post']('/',auth[_0x68a7('0xa')](),controller[_0x68a7('0x10')]);router[_0x68a7('0x11')](_0x68a7('0xc'),auth['isAuthenticated'](),controller[_0x68a7('0x12')]);router[_0x68a7('0x13')](_0x68a7('0x9'),auth[_0x68a7('0xa')](),controller[_0x68a7('0x14')]);router[_0x68a7('0x15')](_0x68a7('0x9'),auth['isAuthenticated'](),controller[_0x68a7('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 9beb6bc..19fcbcc 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 _0x7485=['remoteUri','sequelize','exports','STRING'];(function(_0x562462,_0x2e11c6){var _0x93b448=function(_0x58bfb1){while(--_0x58bfb1){_0x562462['push'](_0x562462['shift']());}};_0x93b448(++_0x2e11c6);}(_0x7485,0x135));var _0x5748=function(_0x34ca56,_0x5c5557){_0x34ca56=_0x34ca56-0x0;var _0x32edc2=_0x7485[_0x34ca56];return _0x32edc2;};'use strict';var Sequelize=require(_0x5748('0x0'));module[_0x5748('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5748('0x2')]},'username':{'type':Sequelize[_0x5748('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x5748('0x2')]},'remoteUri':{'type':Sequelize[_0x5748('0x2')],'unique':_0x5748('0x3')},'serverUrl':{'type':Sequelize[_0x5748('0x2')]}}; \ No newline at end of file +var _0x714a=['exports','STRING','username'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x714a,0xd8));var _0xa714=function(_0x33ca42,_0x581d78){_0x33ca42=_0x33ca42-0x0;var _0x134268=_0x714a[_0x33ca42];return _0x134268;};'use strict';var Sequelize=require('sequelize');module[_0xa714('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa714('0x1')]},'username':{'type':Sequelize[_0xa714('0x1')],'unique':_0xa714('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa714('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa714('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 1a85aa0..e58149a 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 _0x6a0d=['Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','Calls','module_fields','remove','includes','label','values','value','statusCode','getFields','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','send','index','map','SugarcrmAccount','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','show','keys','length','options','find','create','body','getConfigurations','findOne','params','addConfiguration'];(function(_0x4bedc5,_0x592e4e){var _0x51c9e0=function(_0x34f5d0){while(--_0x34f5d0){_0x4bedc5['push'](_0x4bedc5['shift']());}};_0x51c9e0(++_0x592e4e);}(_0x6a0d,0x1af));var _0xd6a0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6a0d[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xd6a0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd6a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6a0('0x2'));var rp=require('request-promise');var moment=require(_0xd6a0('0x3'));var BPromise=require(_0xd6a0('0x4'));var Mustache=require(_0xd6a0('0x5'));var util=require(_0xd6a0('0x6'));var path=require(_0xd6a0('0x7'));var sox=require(_0xd6a0('0x8'));var csv=require(_0xd6a0('0x9'));var ejs=require(_0xd6a0('0xa'));var fs=require('fs');var _=require(_0xd6a0('0xb'));var squel=require(_0xd6a0('0xc'));var crypto=require(_0xd6a0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd6a0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6a0('0xf'));var Redis=require('ioredis');var authService=require(_0xd6a0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd6a0('0x11'));var hardwareService=require(_0xd6a0('0x12'));var logger=require('../../config/logger')(_0xd6a0('0x13'));var utils=require(_0xd6a0('0x14'));var config=require(_0xd6a0('0x15'));var db=require(_0xd6a0('0x16'))['db'];var integrations=require(_0xd6a0('0x17'));var jayson=require(_0xd6a0('0x18'));var client=jayson[_0xd6a0('0x19')][_0xd6a0('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5ceb87,_0x83c58a,_0x576cd3){if(_0x576cd3){var _0x5113cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5113cb[_0xd6a0('0x1b')](_0x83c58a)){return _0x5ceb87;}else{throw new db[(_0xd6a0('0x1c'))]['ValidationError'](_0xd6a0('0x1d'));}}else{return _0x5ceb87;}}function respondWithRpcPromise(_0x1ba462,_0x16f957,_0x99ab4e,_0x57496a){return new BPromise(function(_0x501603,_0x3d3475){var _0x15c308=_0x57496a||client;return _0x15c308[_0xd6a0('0x1e')](_0x1ba462,_0x99ab4e)[_0xd6a0('0x1f')](function(_0x5c9fee){logger[_0xd6a0('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0x16f957,_0xd6a0('0x21'));logger['debug'](_0xd6a0('0x22'),_0x16f957,_0xd6a0('0x21'),JSON['stringify'](_0x5c9fee));if(_0x5c9fee['error']){if(_0x5c9fee[_0xd6a0('0x23')][_0xd6a0('0x24')]===0x1f4){logger[_0xd6a0('0x23')](_0xd6a0('0x25'),_0x16f957,_0x5c9fee['error'][_0xd6a0('0x26')]);return _0x3d3475(_0x5c9fee[_0xd6a0('0x23')][_0xd6a0('0x26')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x16f957,_0x5c9fee[_0xd6a0('0x23')][_0xd6a0('0x26')]);return _0x501603(_0x5c9fee['error'][_0xd6a0('0x26')]);}else{logger['info'](_0xd6a0('0x25'),_0x16f957,_0xd6a0('0x21'));_0x501603(_0x5c9fee[_0xd6a0('0x27')][_0xd6a0('0x26')]);}})[_0xd6a0('0x28')](function(_0x15dc5b){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x16f957,_0x15dc5b);_0x3d3475(_0x15dc5b);});});}function respondWithStatusCode(_0x1621b6,_0x3d1fbe){_0x3d1fbe=_0x3d1fbe||0xcc;return function(_0xf9a745){if(_0xf9a745){return _0x1621b6[_0xd6a0('0x29')](_0x3d1fbe);}return _0x1621b6[_0xd6a0('0x2a')](_0x3d1fbe)[_0xd6a0('0x2b')]();};}function respondWithResult(_0x4c6776,_0x5b7046){_0x5b7046=_0x5b7046||0xc8;return function(_0x9ff4c7){if(_0x9ff4c7){return _0x4c6776[_0xd6a0('0x2a')](_0x5b7046)[_0xd6a0('0x2c')](_0x9ff4c7);}};}function respondWithFilteredResult(_0x3d5ad8,_0x436e27){return function(_0x5af6d0){if(_0x5af6d0){var _0x4db54f=_0x5af6d0[_0xd6a0('0x2d')],_0x548ef5=_0x436e27['offset'],_0x54af6d=_0x436e27[_0xd6a0('0x2e')]+_0x436e27['limit'],_0x341525;if(_0x54af6d>=_0x4db54f){_0x54af6d=_0x4db54f;_0x341525=0xc8;}else{_0x341525=0xce;}_0x3d5ad8[_0xd6a0('0x2a')](_0x341525);return _0x3d5ad8['set'](_0xd6a0('0x2f'),_0x548ef5+'-'+_0x54af6d+'/'+_0x4db54f)[_0xd6a0('0x2c')](_0x5af6d0);}return null;};}function patchUpdates(_0x39ee47){return function(_0x4fe77b){try{jsonpatch[_0xd6a0('0x30')](_0x4fe77b,_0x39ee47,!![]);}catch(_0x573f6e){return BPromise[_0xd6a0('0x31')](_0x573f6e);}return _0x4fe77b[_0xd6a0('0x32')]();};}function saveUpdates(_0x401ea6,_0x1b05ac){return function(_0x438960){if(_0x438960){return _0x438960[_0xd6a0('0x33')](_0x401ea6)[_0xd6a0('0x1f')](function(_0x97778a){return _0x97778a;});}return null;};}function removeEntity(_0x198800,_0x357544){return function(_0x5de607){if(_0x5de607){return _0x5de607[_0xd6a0('0x34')]()[_0xd6a0('0x1f')](function(){_0x198800['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x171827,_0x5461ab){return function(_0x38b99c){if(!_0x38b99c){_0x171827[_0xd6a0('0x29')](0x194);}return _0x38b99c;};}function handleError(_0x25a9fa,_0x484895){_0x484895=_0x484895||0x1f4;return function(_0x22299d){logger[_0xd6a0('0x23')](_0x22299d['stack']);if(_0x22299d['name']){delete _0x22299d['name'];}_0x25a9fa[_0xd6a0('0x2a')](_0x484895)[_0xd6a0('0x35')](_0x22299d);};}exports[_0xd6a0('0x36')]=function(_0x27b691,_0x12fc0a){var _0x5650de={},_0x3a9fa6={},_0x44a0b4={'count':0x0,'rows':[]};var _0x1f4ab2=_[_0xd6a0('0x37')](db[_0xd6a0('0x38')]['rawAttributes'],function(_0x593536){return{'name':_0x593536['fieldName'],'type':_0x593536['type'][_0xd6a0('0x39')]};});_0x3a9fa6[_0xd6a0('0x3a')]=_[_0xd6a0('0x37')](_0x1f4ab2,_0xd6a0('0x3b'));_0x3a9fa6[_0xd6a0('0x3c')]=_['keys'](_0x27b691['query']);_0x3a9fa6[_0xd6a0('0x3d')]=_[_0xd6a0('0x3e')](_0x3a9fa6['model'],_0x3a9fa6[_0xd6a0('0x3c')]);_0x5650de[_0xd6a0('0x3f')]=_[_0xd6a0('0x3e')](_0x3a9fa6['model'],qs[_0xd6a0('0x40')](_0x27b691['query'][_0xd6a0('0x40')]));_0x5650de['attributes']=_0x5650de['attributes']['length']?_0x5650de[_0xd6a0('0x3f')]:_0x3a9fa6[_0xd6a0('0x3a')];if(!_0x27b691[_0xd6a0('0x3c')][_0xd6a0('0x41')](_0xd6a0('0x42'))){_0x5650de[_0xd6a0('0x43')]=qs[_0xd6a0('0x43')](_0x27b691[_0xd6a0('0x3c')][_0xd6a0('0x43')]);_0x5650de['offset']=qs[_0xd6a0('0x2e')](_0x27b691[_0xd6a0('0x3c')][_0xd6a0('0x2e')]);}_0x5650de[_0xd6a0('0x44')]=qs[_0xd6a0('0x45')](_0x27b691[_0xd6a0('0x3c')][_0xd6a0('0x45')]);_0x5650de['where']=qs[_0xd6a0('0x3d')](_[_0xd6a0('0x46')](_0x27b691[_0xd6a0('0x3c')],_0x3a9fa6[_0xd6a0('0x3d')]),_0x1f4ab2);if(_0x27b691['query'][_0xd6a0('0x47')]){_0x5650de[_0xd6a0('0x48')]=_[_0xd6a0('0x49')](_0x5650de['where'],{'$or':_['map'](_0x1f4ab2,function(_0x49728e){if(_0x49728e[_0xd6a0('0x4a')]!==_0xd6a0('0x4b')){var _0x38062d={};_0x38062d[_0x49728e['name']]={'$like':'%'+_0x27b691[_0xd6a0('0x3c')][_0xd6a0('0x47')]+'%'};return _0x38062d;}})});}_0x5650de=_[_0xd6a0('0x49')]({},_0x5650de,_0x27b691['options']);var _0x10bdb3={'where':_0x5650de[_0xd6a0('0x48')]};return db[_0xd6a0('0x38')]['count'](_0x10bdb3)[_0xd6a0('0x1f')](function(_0x2ecaeb){_0x44a0b4[_0xd6a0('0x2d')]=_0x2ecaeb;if(_0x27b691['query'][_0xd6a0('0x4c')]){_0x5650de[_0xd6a0('0x4d')]=[{'all':!![]}];}return db[_0xd6a0('0x38')]['findAll'](_0x5650de);})[_0xd6a0('0x1f')](function(_0x47eefc){_0x44a0b4['rows']=_0x47eefc;return _0x44a0b4;})[_0xd6a0('0x1f')](respondWithFilteredResult(_0x12fc0a,_0x5650de))[_0xd6a0('0x28')](handleError(_0x12fc0a,null));};exports[_0xd6a0('0x4e')]=function(_0x332080,_0xf0c448){var _0x51f687={'raw':![],'where':{'id':_0x332080['params']['id']}},_0x32fbc1={};_0x32fbc1[_0xd6a0('0x3a')]=_[_0xd6a0('0x4f')](db['SugarcrmAccount']['rawAttributes']);_0x32fbc1[_0xd6a0('0x3c')]=_['keys'](_0x332080['query']);_0x32fbc1[_0xd6a0('0x3d')]=_[_0xd6a0('0x3e')](_0x32fbc1[_0xd6a0('0x3a')],_0x32fbc1['query']);_0x51f687['attributes']=_[_0xd6a0('0x3e')](_0x32fbc1[_0xd6a0('0x3a')],qs[_0xd6a0('0x40')](_0x332080['query'][_0xd6a0('0x40')]));_0x51f687[_0xd6a0('0x3f')]=_0x51f687[_0xd6a0('0x3f')][_0xd6a0('0x50')]?_0x51f687[_0xd6a0('0x3f')]:_0x32fbc1['model'];if(_0x332080['query'][_0xd6a0('0x4c')]){_0x51f687['include']=[{'all':!![]}];}_0x51f687=_[_0xd6a0('0x49')]({},_0x51f687,_0x332080[_0xd6a0('0x51')]);return db[_0xd6a0('0x38')][_0xd6a0('0x52')](_0x51f687)[_0xd6a0('0x1f')](handleEntityNotFound(_0xf0c448,null))[_0xd6a0('0x1f')](respondWithResult(_0xf0c448,null))[_0xd6a0('0x28')](handleError(_0xf0c448,null));};exports[_0xd6a0('0x53')]=function(_0x29a306,_0x12ab27){return db[_0xd6a0('0x38')][_0xd6a0('0x53')](_0x29a306[_0xd6a0('0x54')],{})[_0xd6a0('0x1f')](respondWithResult(_0x12ab27,0xc9))['catch'](handleError(_0x12ab27,null));};exports['update']=function(_0xdf7025,_0x31e759){if(_0xdf7025[_0xd6a0('0x54')]['id']){delete _0xdf7025['body']['id'];}return db[_0xd6a0('0x38')][_0xd6a0('0x52')]({'where':{'id':_0xdf7025['params']['id']}})[_0xd6a0('0x1f')](handleEntityNotFound(_0x31e759,null))[_0xd6a0('0x1f')](saveUpdates(_0xdf7025[_0xd6a0('0x54')],null))[_0xd6a0('0x1f')](respondWithResult(_0x31e759,null))[_0xd6a0('0x28')](handleError(_0x31e759,null));};exports[_0xd6a0('0x34')]=function(_0x5ea71e,_0x4c325c){return db[_0xd6a0('0x38')]['find']({'where':{'id':_0x5ea71e['params']['id']}})[_0xd6a0('0x1f')](handleEntityNotFound(_0x4c325c,null))[_0xd6a0('0x1f')](removeEntity(_0x4c325c,null))[_0xd6a0('0x28')](handleError(_0x4c325c,null));};exports[_0xd6a0('0x55')]=function(_0x3685e4,_0x47a1c5,_0x40ebb6){var _0x517318={};var _0x384d5b={};var _0x2c0cdc;var _0x6ff6b9;return db[_0xd6a0('0x38')][_0xd6a0('0x56')]({'where':{'id':_0x3685e4[_0xd6a0('0x57')]['id']}})[_0xd6a0('0x1f')](handleEntityNotFound(_0x47a1c5,null))[_0xd6a0('0x1f')](function(_0x123ddf){if(_0x123ddf){_0x2c0cdc=_0x123ddf;_0x384d5b['model']=_[_0xd6a0('0x4f')](db['SugarcrmConfiguration']['rawAttributes']);_0x384d5b[_0xd6a0('0x3c')]=_[_0xd6a0('0x4f')](_0x3685e4[_0xd6a0('0x3c')]);_0x384d5b[_0xd6a0('0x3d')]=_[_0xd6a0('0x3e')](_0x384d5b[_0xd6a0('0x3a')],_0x384d5b[_0xd6a0('0x3c')]);_0x517318[_0xd6a0('0x3f')]=_[_0xd6a0('0x3e')](_0x384d5b['model'],qs[_0xd6a0('0x40')](_0x3685e4[_0xd6a0('0x3c')][_0xd6a0('0x40')]));_0x517318[_0xd6a0('0x3f')]=_0x517318[_0xd6a0('0x3f')][_0xd6a0('0x50')]?_0x517318[_0xd6a0('0x3f')]:_0x384d5b[_0xd6a0('0x3a')];_0x517318['order']=qs[_0xd6a0('0x45')](_0x3685e4['query']['sort']);_0x517318[_0xd6a0('0x48')]=qs[_0xd6a0('0x3d')](_['pick'](_0x3685e4[_0xd6a0('0x3c')],_0x384d5b[_0xd6a0('0x3d')]));if(_0x3685e4[_0xd6a0('0x3c')]['filter']){_0x517318[_0xd6a0('0x48')]=_['merge'](_0x517318['where'],{'$or':_['map'](_0x517318['attributes'],function(_0x47c689){var _0x2a7a06={};_0x2a7a06[_0x47c689]={'$like':'%'+_0x3685e4['query'][_0xd6a0('0x47')]+'%'};return _0x2a7a06;})});}_0x517318=_[_0xd6a0('0x49')]({},_0x517318,_0x3685e4['options']);return _0x2c0cdc[_0xd6a0('0x55')](_0x517318);}})[_0xd6a0('0x1f')](function(_0x89cc33){if(_0x89cc33){_0x6ff6b9=_0x89cc33[_0xd6a0('0x50')];if(!_0x3685e4[_0xd6a0('0x3c')]['hasOwnProperty']('nolimit')){_0x517318['limit']=qs[_0xd6a0('0x43')](_0x3685e4[_0xd6a0('0x3c')][_0xd6a0('0x43')]);_0x517318[_0xd6a0('0x2e')]=qs[_0xd6a0('0x2e')](_0x3685e4['query']['offset']);}return _0x2c0cdc[_0xd6a0('0x55')](_0x517318);}})[_0xd6a0('0x1f')](function(_0x4ecb2a){if(_0x4ecb2a){return _0x4ecb2a?{'count':_0x6ff6b9,'rows':_0x4ecb2a}:null;}})[_0xd6a0('0x1f')](respondWithResult(_0x47a1c5,null))[_0xd6a0('0x28')](handleError(_0x47a1c5,null));};exports[_0xd6a0('0x58')]=function(_0x4ff7aa,_0x2cff97,_0x3d071a){if(_0x4ff7aa[_0xd6a0('0x54')]['id']){delete _0x4ff7aa[_0xd6a0('0x54')]['id'];}return db[_0xd6a0('0x38')][_0xd6a0('0x56')]({'where':{'id':_0x4ff7aa[_0xd6a0('0x57')]['id']}})[_0xd6a0('0x1f')](handleEntityNotFound(_0x2cff97,null))[_0xd6a0('0x1f')](function(_0x7e2c1b){if(_0x7e2c1b){_0x4ff7aa['body']['AccountId']=_0x7e2c1b['id'];_0x4ff7aa[_0xd6a0('0x54')][_0xd6a0('0x59')]=integrations[_0xd6a0('0x5a')](_0x4ff7aa[_0xd6a0('0x54')]['channel'],_0x4ff7aa[_0xd6a0('0x54')][_0xd6a0('0x4a')]);_0x4ff7aa[_0xd6a0('0x54')][_0xd6a0('0x5b')]=integrations[_0xd6a0('0x5c')](_0x4ff7aa['body'][_0xd6a0('0x5d')],_0x4ff7aa['body'][_0xd6a0('0x4a')]);return db[_0xd6a0('0x5e')][_0xd6a0('0x53')](_0x4ff7aa[_0xd6a0('0x54')],{'include':[{'model':db[_0xd6a0('0x5f')],'as':_0xd6a0('0x59')},{'model':db['SugarcrmField'],'as':_0xd6a0('0x5b')}]});}return null;})['then'](respondWithResult(_0x2cff97,null))[_0xd6a0('0x28')](handleError(_0x2cff97,null));};exports['getFields']=function(_0x3a08ee,_0x557e98,_0x4c1559){var _0x30b0f9='';var _0x565f75=['id','name',_0xd6a0('0x60'),_0xd6a0('0x61'),'description',_0xd6a0('0x62'),_0xd6a0('0x63'),_0xd6a0('0x64'),'parent_id',_0xd6a0('0x65'),_0xd6a0('0x66'),_0xd6a0('0x67')];return db[_0xd6a0('0x38')]['findOne']({'where':{'id':_0x3a08ee['params']['id']},'attributes':['id',_0xd6a0('0x68'),_0xd6a0('0x69'),_0xd6a0('0x6a')]})[_0xd6a0('0x1f')](handleEntityNotFound(_0x557e98,null))[_0xd6a0('0x1f')](function(_0x510650){if(_0x510650){_0x30b0f9=_0x510650['remoteUri'];var _0x34298d=_0x30b0f9[_0xd6a0('0x6b')](-0x1);if(_0x34298d==='/'){_0x30b0f9=_0x30b0f9[_0xd6a0('0x6c')](0x0,_0x30b0f9[_0xd6a0('0x6d')](_0x34298d));}return rp({'method':_0xd6a0('0x6e'),'uri':util[_0xd6a0('0x6f')](_0xd6a0('0x70'),_0x30b0f9,_0xd6a0('0x71')),'json':!![],'form':{'method':_0xd6a0('0x72'),'input_type':'JSON','response_type':_0xd6a0('0x73'),'rest_data':JSON[_0xd6a0('0x74')]({'user_auth':{'user_name':_0x510650[_0xd6a0('0x68')],'password':_0x510650['password'],'encryption':_0xd6a0('0x75')},'application':_0xd6a0('0x76')})}});}})[_0xd6a0('0x1f')](function(_0x4db791){if(_0x4db791&&_0x4db791[_0xd6a0('0x3b')]!=='Invalid\x20Login'&&_0x4db791[_0xd6a0('0x3b')]!==_0xd6a0('0x77')){return rp({'method':_0xd6a0('0x6e'),'uri':util[_0xd6a0('0x6f')](_0xd6a0('0x70'),_0x30b0f9,_0xd6a0('0x71')),'json':!![],'form':{'method':_0xd6a0('0x78'),'input_type':_0xd6a0('0x73'),'response_type':_0xd6a0('0x73'),'rest_data':JSON[_0xd6a0('0x74')]({'session':_0x4db791['id'],'module_name':_0xd6a0('0x79')})}})['then'](function(_0x228e73){if(_0x228e73){var _0x1ea0d3=_['values'](_0x228e73[_0xd6a0('0x7a')]);_[_0xd6a0('0x7b')](_0x1ea0d3,function(_0x57715a){return _0x565f75[_0xd6a0('0x7c')](_0x57715a[_0xd6a0('0x3b')]);});return{'count':_0x1ea0d3[_0xd6a0('0x50')],'rows':_[_0xd6a0('0x37')](_0x1ea0d3,function(_0x1c387d){return{'id':_0x1c387d['name'],'name':_0x1c387d[_0xd6a0('0x7d')],'custom':_['endsWith'](_0x1c387d['name'],'_c')?!![]:![],'options':_0x1c387d[_0xd6a0('0x51')]?_[_0xd6a0('0x37')](_[_0xd6a0('0x7e')](_0x1c387d[_0xd6a0('0x51')]),function(_0x100dae){return{'name':_0x100dae[_0xd6a0('0x7f')],'value':_0x100dae[_0xd6a0('0x3b')]};}):[]};})};}})[_0xd6a0('0x1f')](respondWithResult(_0x557e98,null))[_0xd6a0('0x28')](function(_0x4815a0){var _0x26045b=_0x3a08ee['query'][_0xd6a0('0x1b')]?0x1f4:_0x4815a0[_0xd6a0('0x80')]||0x1f4;logger[_0xd6a0('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xd6a0('0x81'),_0x26045b,JSON['stringify'](_0x4815a0));delete _0x4815a0[_0xd6a0('0x3b')];if(_0x26045b===0x191){_0x26045b=0x190;}_0x557e98['status'](_0x26045b)[_0xd6a0('0x35')](_0x3a08ee[_0xd6a0('0x3c')][_0xd6a0('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x4815a0[_0xd6a0('0x80')]}:_0x4815a0);});}else{var _0x899623=0x1f4;_0x557e98[_0xd6a0('0x2a')](_0x899623)[_0xd6a0('0x35')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xacb1=['Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','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','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','reject','save','update','name','send','index','rawAttributes','fieldName','key','map','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','SugarcrmAccount','count','includeAll','include','show','params','keys','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','xCALLY\x20Motion\x20Integration'];(function(_0x225466,_0x879a37){var _0x496110=function(_0x5cf1e1){while(--_0x5cf1e1){_0x225466['push'](_0x225466['shift']());}};_0x496110(++_0x879a37);}(_0xacb1,0x8c));var _0x1acb=function(_0x57a7dc,_0x1802ac){_0x57a7dc=_0x57a7dc-0x0;var _0x55772d=_0xacb1[_0x57a7dc];return _0x55772d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1acb('0x0'));var rimraf=require(_0x1acb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1acb('0x2'));var moment=require(_0x1acb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1acb('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1acb('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1acb('0x6'));var jsforce=require('jsforce');var deskjs=require(_0x1acb('0x7'));var toCsv=require(_0x1acb('0x8'));var querystring=require(_0x1acb('0x9'));var Papa=require(_0x1acb('0xa'));var Redis=require(_0x1acb('0xb'));var authService=require(_0x1acb('0xc'));var qs=require(_0x1acb('0xd'));var as=require(_0x1acb('0xe'));var hardwareService=require(_0x1acb('0xf'));var logger=require(_0x1acb('0x10'))(_0x1acb('0x11'));var utils=require(_0x1acb('0x12'));var config=require('../../config/environment');var db=require(_0x1acb('0x13'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x1acb('0x14')][_0x1acb('0x15')]({'port':0x232a});function checkPasswordPattern(_0x18994f,_0xd58115,_0x364740){if(_0x364740){var _0x85be15=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x85be15[_0x1acb('0x16')](_0xd58115)){return _0x18994f;}else{throw new db[(_0x1acb('0x17'))][(_0x1acb('0x18'))](_0x1acb('0x19'));}}else{return _0x18994f;}}function respondWithRpcPromise(_0xc8b793,_0x114e5e,_0x131c0f,_0x1402a1){return new BPromise(function(_0x1addae,_0x1c59d0){var _0x448176=_0x1402a1||client;return _0x448176[_0x1acb('0x1a')](_0xc8b793,_0x131c0f)[_0x1acb('0x1b')](function(_0x2653fa){logger[_0x1acb('0x1c')](_0x1acb('0x1d'),_0x114e5e,_0x1acb('0x1e'));logger[_0x1acb('0x1f')](_0x1acb('0x20'),_0x114e5e,_0x1acb('0x1e'),JSON[_0x1acb('0x21')](_0x2653fa));if(_0x2653fa[_0x1acb('0x22')]){if(_0x2653fa[_0x1acb('0x22')]['code']===0x1f4){logger[_0x1acb('0x22')](_0x1acb('0x1d'),_0x114e5e,_0x2653fa['error'][_0x1acb('0x23')]);return _0x1c59d0(_0x2653fa[_0x1acb('0x22')][_0x1acb('0x23')]);}logger[_0x1acb('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x114e5e,_0x2653fa[_0x1acb('0x22')]['message']);return _0x1addae(_0x2653fa[_0x1acb('0x22')]['message']);}else{logger['info'](_0x1acb('0x1d'),_0x114e5e,_0x1acb('0x1e'));_0x1addae(_0x2653fa[_0x1acb('0x24')]['message']);}})[_0x1acb('0x25')](function(_0x32cb07){logger[_0x1acb('0x22')](_0x1acb('0x1d'),_0x114e5e,_0x32cb07);_0x1c59d0(_0x32cb07);});});}function respondWithStatusCode(_0x26a728,_0xd09a0b){_0xd09a0b=_0xd09a0b||0xcc;return function(_0x4caa94){if(_0x4caa94){return _0x26a728[_0x1acb('0x26')](_0xd09a0b);}return _0x26a728[_0x1acb('0x27')](_0xd09a0b)[_0x1acb('0x28')]();};}function respondWithResult(_0xb47887,_0x5c85a1){_0x5c85a1=_0x5c85a1||0xc8;return function(_0x1b84bd){if(_0x1b84bd){return _0xb47887['status'](_0x5c85a1)[_0x1acb('0x29')](_0x1b84bd);}};}function respondWithFilteredResult(_0x2006e3,_0x313077){return function(_0x406b09){if(_0x406b09){var _0x524687=_0x406b09['count'],_0x2aea76=_0x313077[_0x1acb('0x2a')],_0x298335=_0x313077[_0x1acb('0x2a')]+_0x313077[_0x1acb('0x2b')],_0x2ded33;if(_0x298335>=_0x524687){_0x298335=_0x524687;_0x2ded33=0xc8;}else{_0x2ded33=0xce;}_0x2006e3[_0x1acb('0x27')](_0x2ded33);return _0x2006e3[_0x1acb('0x2c')]('Content-Range',_0x2aea76+'-'+_0x298335+'/'+_0x524687)[_0x1acb('0x29')](_0x406b09);}return null;};}function patchUpdates(_0x5d72ea){return function(_0x59e609){try{jsonpatch['apply'](_0x59e609,_0x5d72ea,!![]);}catch(_0x27ed56){return BPromise[_0x1acb('0x2d')](_0x27ed56);}return _0x59e609[_0x1acb('0x2e')]();};}function saveUpdates(_0x51210e,_0x1cbf04){return function(_0x452108){if(_0x452108){return _0x452108[_0x1acb('0x2f')](_0x51210e)['then'](function(_0x4c41e8){return _0x4c41e8;});}return null;};}function removeEntity(_0x492209,_0x4b55e2){return function(_0x33c5e5){if(_0x33c5e5){return _0x33c5e5['destroy']()[_0x1acb('0x1b')](function(){_0x492209['status'](0xcc)[_0x1acb('0x28')]();});}};}function handleEntityNotFound(_0x362189,_0x299379){return function(_0x45d24e){if(!_0x45d24e){_0x362189[_0x1acb('0x26')](0x194);}return _0x45d24e;};}function handleError(_0x3d67cb,_0xd459d8){_0xd459d8=_0xd459d8||0x1f4;return function(_0x388f54){logger[_0x1acb('0x22')](_0x388f54['stack']);if(_0x388f54[_0x1acb('0x30')]){delete _0x388f54[_0x1acb('0x30')];}_0x3d67cb['status'](_0xd459d8)[_0x1acb('0x31')](_0x388f54);};}exports[_0x1acb('0x32')]=function(_0x74d6f5,_0x278b6e){var _0x16f62b={},_0x5f43d5={},_0x55d86d={'count':0x0,'rows':[]};var _0x18901e=_['map'](db['SugarcrmAccount'][_0x1acb('0x33')],function(_0x39512f){return{'name':_0x39512f[_0x1acb('0x34')],'type':_0x39512f['type'][_0x1acb('0x35')]};});_0x5f43d5['model']=_[_0x1acb('0x36')](_0x18901e,_0x1acb('0x30'));_0x5f43d5[_0x1acb('0x37')]=_['keys'](_0x74d6f5[_0x1acb('0x37')]);_0x5f43d5[_0x1acb('0x38')]=_[_0x1acb('0x39')](_0x5f43d5['model'],_0x5f43d5[_0x1acb('0x37')]);_0x16f62b[_0x1acb('0x3a')]=_[_0x1acb('0x39')](_0x5f43d5['model'],qs[_0x1acb('0x3b')](_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x3b')]));_0x16f62b[_0x1acb('0x3a')]=_0x16f62b[_0x1acb('0x3a')][_0x1acb('0x3c')]?_0x16f62b[_0x1acb('0x3a')]:_0x5f43d5[_0x1acb('0x3d')];if(!_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x3e')](_0x1acb('0x3f'))){_0x16f62b[_0x1acb('0x2b')]=qs[_0x1acb('0x2b')](_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x2b')]);_0x16f62b[_0x1acb('0x2a')]=qs[_0x1acb('0x2a')](_0x74d6f5['query']['offset']);}_0x16f62b[_0x1acb('0x40')]=qs[_0x1acb('0x41')](_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x41')]);_0x16f62b[_0x1acb('0x42')]=qs[_0x1acb('0x38')](_[_0x1acb('0x43')](_0x74d6f5['query'],_0x5f43d5[_0x1acb('0x38')]),_0x18901e);if(_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x44')]){_0x16f62b[_0x1acb('0x42')]=_[_0x1acb('0x45')](_0x16f62b['where'],{'$or':_[_0x1acb('0x36')](_0x18901e,function(_0x151ceb){if(_0x151ceb[_0x1acb('0x46')]!=='VIRTUAL'){var _0x2049de={};_0x2049de[_0x151ceb[_0x1acb('0x30')]]={'$like':'%'+_0x74d6f5['query'][_0x1acb('0x44')]+'%'};return _0x2049de;}})});}_0x16f62b=_[_0x1acb('0x45')]({},_0x16f62b,_0x74d6f5[_0x1acb('0x47')]);var _0x285d3d={'where':_0x16f62b[_0x1acb('0x42')]};return db[_0x1acb('0x48')][_0x1acb('0x49')](_0x285d3d)['then'](function(_0x29a719){_0x55d86d[_0x1acb('0x49')]=_0x29a719;if(_0x74d6f5[_0x1acb('0x37')][_0x1acb('0x4a')]){_0x16f62b[_0x1acb('0x4b')]=[{'all':!![]}];}return db[_0x1acb('0x48')]['findAll'](_0x16f62b);})['then'](function(_0x450fbd){_0x55d86d['rows']=_0x450fbd;return _0x55d86d;})['then'](respondWithFilteredResult(_0x278b6e,_0x16f62b))[_0x1acb('0x25')](handleError(_0x278b6e,null));};exports[_0x1acb('0x4c')]=function(_0x3927d4,_0x39424a){var _0x4ef92e={'raw':![],'where':{'id':_0x3927d4[_0x1acb('0x4d')]['id']}},_0x998ad5={};_0x998ad5[_0x1acb('0x3d')]=_['keys'](db[_0x1acb('0x48')][_0x1acb('0x33')]);_0x998ad5['query']=_[_0x1acb('0x4e')](_0x3927d4[_0x1acb('0x37')]);_0x998ad5[_0x1acb('0x38')]=_[_0x1acb('0x39')](_0x998ad5[_0x1acb('0x3d')],_0x998ad5[_0x1acb('0x37')]);_0x4ef92e[_0x1acb('0x3a')]=_[_0x1acb('0x39')](_0x998ad5['model'],qs[_0x1acb('0x3b')](_0x3927d4[_0x1acb('0x37')][_0x1acb('0x3b')]));_0x4ef92e[_0x1acb('0x3a')]=_0x4ef92e[_0x1acb('0x3a')][_0x1acb('0x3c')]?_0x4ef92e[_0x1acb('0x3a')]:_0x998ad5[_0x1acb('0x3d')];if(_0x3927d4['query']['includeAll']){_0x4ef92e[_0x1acb('0x4b')]=[{'all':!![]}];}_0x4ef92e=_['merge']({},_0x4ef92e,_0x3927d4[_0x1acb('0x47')]);return db[_0x1acb('0x48')][_0x1acb('0x4f')](_0x4ef92e)[_0x1acb('0x1b')](handleEntityNotFound(_0x39424a,null))['then'](respondWithResult(_0x39424a,null))['catch'](handleError(_0x39424a,null));};exports[_0x1acb('0x50')]=function(_0x5351a4,_0x4dd75e){return db['SugarcrmAccount'][_0x1acb('0x50')](_0x5351a4[_0x1acb('0x51')],{})[_0x1acb('0x1b')](respondWithResult(_0x4dd75e,0xc9))[_0x1acb('0x25')](handleError(_0x4dd75e,null));};exports[_0x1acb('0x2f')]=function(_0x3007ae,_0x112d8d){if(_0x3007ae[_0x1acb('0x51')]['id']){delete _0x3007ae[_0x1acb('0x51')]['id'];}return db['SugarcrmAccount'][_0x1acb('0x4f')]({'where':{'id':_0x3007ae[_0x1acb('0x4d')]['id']}})[_0x1acb('0x1b')](handleEntityNotFound(_0x112d8d,null))[_0x1acb('0x1b')](saveUpdates(_0x3007ae[_0x1acb('0x51')],null))[_0x1acb('0x1b')](respondWithResult(_0x112d8d,null))[_0x1acb('0x25')](handleError(_0x112d8d,null));};exports[_0x1acb('0x52')]=function(_0x54b89b,_0x14357c){return db[_0x1acb('0x48')]['find']({'where':{'id':_0x54b89b[_0x1acb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x14357c,null))['then'](removeEntity(_0x14357c,null))[_0x1acb('0x25')](handleError(_0x14357c,null));};exports[_0x1acb('0x53')]=function(_0x521152,_0x745c58,_0x598b0c){var _0x1ea310={};var _0x525db4={};var _0x5e04d6;var _0x262f0c;return db['SugarcrmAccount'][_0x1acb('0x54')]({'where':{'id':_0x521152[_0x1acb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x745c58,null))[_0x1acb('0x1b')](function(_0x3641b4){if(_0x3641b4){_0x5e04d6=_0x3641b4;_0x525db4[_0x1acb('0x3d')]=_[_0x1acb('0x4e')](db[_0x1acb('0x55')][_0x1acb('0x33')]);_0x525db4[_0x1acb('0x37')]=_[_0x1acb('0x4e')](_0x521152['query']);_0x525db4[_0x1acb('0x38')]=_[_0x1acb('0x39')](_0x525db4['model'],_0x525db4[_0x1acb('0x37')]);_0x1ea310[_0x1acb('0x3a')]=_[_0x1acb('0x39')](_0x525db4[_0x1acb('0x3d')],qs[_0x1acb('0x3b')](_0x521152['query'][_0x1acb('0x3b')]));_0x1ea310[_0x1acb('0x3a')]=_0x1ea310['attributes'][_0x1acb('0x3c')]?_0x1ea310[_0x1acb('0x3a')]:_0x525db4[_0x1acb('0x3d')];_0x1ea310[_0x1acb('0x40')]=qs[_0x1acb('0x41')](_0x521152[_0x1acb('0x37')]['sort']);_0x1ea310[_0x1acb('0x42')]=qs['filters'](_[_0x1acb('0x43')](_0x521152[_0x1acb('0x37')],_0x525db4[_0x1acb('0x38')]));if(_0x521152[_0x1acb('0x37')][_0x1acb('0x44')]){_0x1ea310[_0x1acb('0x42')]=_[_0x1acb('0x45')](_0x1ea310['where'],{'$or':_[_0x1acb('0x36')](_0x1ea310[_0x1acb('0x3a')],function(_0x183649){var _0xf353d3={};_0xf353d3[_0x183649]={'$like':'%'+_0x521152[_0x1acb('0x37')][_0x1acb('0x44')]+'%'};return _0xf353d3;})});}_0x1ea310=_[_0x1acb('0x45')]({},_0x1ea310,_0x521152[_0x1acb('0x47')]);return _0x5e04d6[_0x1acb('0x53')](_0x1ea310);}})[_0x1acb('0x1b')](function(_0x59c1b2){if(_0x59c1b2){_0x262f0c=_0x59c1b2['length'];if(!_0x521152[_0x1acb('0x37')][_0x1acb('0x3e')](_0x1acb('0x3f'))){_0x1ea310[_0x1acb('0x2b')]=qs['limit'](_0x521152[_0x1acb('0x37')][_0x1acb('0x2b')]);_0x1ea310[_0x1acb('0x2a')]=qs[_0x1acb('0x2a')](_0x521152[_0x1acb('0x37')][_0x1acb('0x2a')]);}return _0x5e04d6[_0x1acb('0x53')](_0x1ea310);}})[_0x1acb('0x1b')](function(_0x58c377){if(_0x58c377){return _0x58c377?{'count':_0x262f0c,'rows':_0x58c377}:null;}})[_0x1acb('0x1b')](respondWithResult(_0x745c58,null))['catch'](handleError(_0x745c58,null));};exports[_0x1acb('0x56')]=function(_0xdecfd7,_0x4021be,_0x2c478b){if(_0xdecfd7['body']['id']){delete _0xdecfd7[_0x1acb('0x51')]['id'];}return db['SugarcrmAccount'][_0x1acb('0x54')]({'where':{'id':_0xdecfd7[_0x1acb('0x4d')]['id']}})[_0x1acb('0x1b')](handleEntityNotFound(_0x4021be,null))[_0x1acb('0x1b')](function(_0x49cfca){if(_0x49cfca){_0xdecfd7[_0x1acb('0x51')]['AccountId']=_0x49cfca['id'];_0xdecfd7[_0x1acb('0x51')][_0x1acb('0x57')]=integrations[_0x1acb('0x58')](_0xdecfd7[_0x1acb('0x51')][_0x1acb('0x59')],_0xdecfd7[_0x1acb('0x51')]['type']);_0xdecfd7[_0x1acb('0x51')][_0x1acb('0x5a')]=integrations['getDescriptions'](_0xdecfd7[_0x1acb('0x51')][_0x1acb('0x59')],_0xdecfd7[_0x1acb('0x51')]['type']);return db[_0x1acb('0x55')]['create'](_0xdecfd7[_0x1acb('0x51')],{'include':[{'model':db[_0x1acb('0x5b')],'as':_0x1acb('0x57')},{'model':db[_0x1acb('0x5b')],'as':_0x1acb('0x5a')}]});}return null;})[_0x1acb('0x1b')](respondWithResult(_0x4021be,null))[_0x1acb('0x25')](handleError(_0x4021be,null));};exports[_0x1acb('0x5c')]=function(_0x362ac2,_0x38dbad,_0x430ed5){var _0x409263='';var _0x2e1ef9=['id','name',_0x1acb('0x5d'),_0x1acb('0x5e'),_0x1acb('0x5f'),_0x1acb('0x60'),_0x1acb('0x61'),_0x1acb('0x62'),_0x1acb('0x63'),_0x1acb('0x64'),'parent_name','direction'];return db[_0x1acb('0x48')][_0x1acb('0x54')]({'where':{'id':_0x362ac2[_0x1acb('0x4d')]['id']},'attributes':['id',_0x1acb('0x65'),_0x1acb('0x66'),_0x1acb('0x67')]})[_0x1acb('0x1b')](handleEntityNotFound(_0x38dbad,null))[_0x1acb('0x1b')](function(_0x4915f7){if(_0x4915f7){_0x409263=_0x4915f7[_0x1acb('0x67')];var _0x4704c1=_0x409263[_0x1acb('0x68')](-0x1);if(_0x4704c1==='/'){_0x409263=_0x409263[_0x1acb('0x69')](0x0,_0x409263[_0x1acb('0x6a')](_0x4704c1));}return rp({'method':_0x1acb('0x6b'),'uri':util[_0x1acb('0x6c')](_0x1acb('0x6d'),_0x409263,_0x1acb('0x6e')),'json':!![],'form':{'method':_0x1acb('0x6f'),'input_type':'JSON','response_type':_0x1acb('0x70'),'rest_data':JSON[_0x1acb('0x21')]({'user_auth':{'user_name':_0x4915f7[_0x1acb('0x65')],'password':_0x4915f7['password'],'encryption':'PLAIN'},'application':_0x1acb('0x71')})}});}})[_0x1acb('0x1b')](function(_0x4a3012){if(_0x4a3012&&_0x4a3012[_0x1acb('0x30')]!==_0x1acb('0x72')&&_0x4a3012[_0x1acb('0x30')]!==_0x1acb('0x73')){return rp({'method':_0x1acb('0x6b'),'uri':util[_0x1acb('0x6c')](_0x1acb('0x6d'),_0x409263,_0x1acb('0x6e')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x1acb('0x70'),'rest_data':JSON[_0x1acb('0x21')]({'session':_0x4a3012['id'],'module_name':_0x1acb('0x74')})}})['then'](function(_0xa787){if(_0xa787){var _0x325679=_[_0x1acb('0x75')](_0xa787[_0x1acb('0x76')]);_[_0x1acb('0x77')](_0x325679,function(_0x1e191d){return _0x2e1ef9[_0x1acb('0x78')](_0x1e191d[_0x1acb('0x30')]);});return{'count':_0x325679[_0x1acb('0x3c')],'rows':_[_0x1acb('0x36')](_0x325679,function(_0x20daf0){return{'id':_0x20daf0[_0x1acb('0x30')],'name':_0x20daf0[_0x1acb('0x79')],'custom':_[_0x1acb('0x7a')](_0x20daf0[_0x1acb('0x30')],'_c')?!![]:![],'options':_0x20daf0[_0x1acb('0x47')]?_[_0x1acb('0x36')](_[_0x1acb('0x75')](_0x20daf0['options']),function(_0x1051cb){return{'name':_0x1051cb[_0x1acb('0x7b')],'value':_0x1051cb[_0x1acb('0x30')]};}):[]};})};}})[_0x1acb('0x1b')](respondWithResult(_0x38dbad,null))[_0x1acb('0x25')](function(_0x2dc19e){var _0x1e3e92=_0x362ac2[_0x1acb('0x37')][_0x1acb('0x16')]?0x1f4:_0x2dc19e[_0x1acb('0x7c')]||0x1f4;logger[_0x1acb('0x22')](_0x1acb('0x7d'),_0x1acb('0x5c'),_0x1e3e92,JSON[_0x1acb('0x21')](_0x2dc19e));delete _0x2dc19e[_0x1acb('0x30')];if(_0x1e3e92===0x191){_0x1e3e92=0x190;}_0x38dbad[_0x1acb('0x27')](_0x1e3e92)[_0x1acb('0x31')](_0x362ac2[_0x1acb('0x37')][_0x1acb('0x16')]?{'message':_0x1acb('0x7e'),'statusCode':_0x2dc19e[_0x1acb('0x7c')]}:_0x2dc19e);});}else{var _0x5b45bf=0x1f4;_0x38dbad['status'](_0x5b45bf)[_0x1acb('0x31')]({'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 5bc5fcd..2558d19 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 _0x457d=['lodash','util','api','moment','bluebird','path','./intSugarcrmAccount.attributes','exports','SugarcrmAccount'];(function(_0x24cab6,_0x1269d6){var _0x199d3a=function(_0x1ffb93){while(--_0x1ffb93){_0x24cab6['push'](_0x24cab6['shift']());}};_0x199d3a(++_0x1269d6);}(_0x457d,0x18c));var _0xd457=function(_0x2c8df0,_0x32e64b){_0x2c8df0=_0x2c8df0-0x0;var _0x5753b1=_0x457d[_0x2c8df0];return _0x5753b1;};'use strict';var _=require(_0xd457('0x0'));var util=require(_0xd457('0x1'));var logger=require('../../config/logger')(_0xd457('0x2'));var moment=require(_0xd457('0x3'));var BPromise=require(_0xd457('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd457('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd457('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xd457('0x7')]=function(_0x11188a,_0xba7aa6){return _0x11188a['define'](_0xd457('0x8'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x009b=['../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x009b,0xd0));var _0xb009=function(_0x25cd75,_0x54fcaa){_0x25cd75=_0x25cd75-0x0;var _0x428cc6=_0x009b[_0x25cd75];return _0x428cc6;};'use strict';var _=require(_0xb009('0x0'));var util=require(_0xb009('0x1'));var logger=require('../../config/logger')(_0xb009('0x2'));var moment=require(_0xb009('0x3'));var BPromise=require(_0xb009('0x4'));var rp=require(_0xb009('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb009('0x6'));var attributes=require(_0xb009('0x7'));var integrations=require(_0xb009('0x8'));module[_0xb009('0x9')]=function(_0x779dc1,_0xe297d9){return _0x779dc1[_0xb009('0xa')]('SugarcrmAccount',attributes,{'tableName':_0xb009('0xb'),'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 05a0b2d..400b987 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 _0x19f2=['SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','stringify','SugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','info'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0x19f2,0x105));var _0x219f=function(_0x43371b,_0x1cb4cf){_0x43371b=_0x43371b-0x0;var _0x19cd26=_0x19f2[_0x43371b];return _0x19cd26;};'use strict';var _=require(_0x219f('0x0'));var util=require(_0x219f('0x1'));var moment=require(_0x219f('0x2'));var BPromise=require(_0x219f('0x3'));var rs=require(_0x219f('0x4'));var fs=require('fs');var Redis=require(_0x219f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x219f('0x6'));var logger=require(_0x219f('0x7'))('rpc');var config=require(_0x219f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x219f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e96a8,_0x52f5f2,_0x15de8a){return new BPromise(function(_0x222d04,_0xcceb4f){return client['request'](_0x1e96a8,_0x15de8a)['then'](function(_0x5e1c9a){logger[_0x219f('0xa')](_0x219f('0xb'),_0x52f5f2,'request\x20sent');logger[_0x219f('0xc')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x52f5f2,_0x219f('0xd'),JSON['stringify'](_0x5e1c9a));if(_0x5e1c9a[_0x219f('0xe')]){if(_0x5e1c9a[_0x219f('0xe')][_0x219f('0xf')]===0x1f4){logger[_0x219f('0xe')](_0x219f('0xb'),_0x52f5f2,_0x5e1c9a['error'][_0x219f('0x10')]);return _0xcceb4f(_0x5e1c9a[_0x219f('0xe')]['message']);}logger[_0x219f('0xe')](_0x219f('0xb'),_0x52f5f2,_0x5e1c9a[_0x219f('0xe')][_0x219f('0x10')]);return _0x222d04(_0x5e1c9a[_0x219f('0xe')][_0x219f('0x10')]);}else{logger[_0x219f('0xa')](_0x219f('0xb'),_0x52f5f2,_0x219f('0xd'));_0x222d04(_0x5e1c9a[_0x219f('0x11')][_0x219f('0x10')]);}})[_0x219f('0x12')](function(_0xe75b42){logger[_0x219f('0xe')](_0x219f('0xb'),_0x52f5f2,_0xe75b42);_0xcceb4f(_0xe75b42);});});}exports[_0x219f('0x13')]=function(_0x442835){var _0x4537ba=this;return new Promise(function(_0x363efa,_0x55118f){return db['SugarcrmAccount'][_0x219f('0x14')]({'raw':_0x442835[_0x219f('0x15')]?_0x442835[_0x219f('0x15')][_0x219f('0x16')]===undefined?!![]:![]:!![],'where':_0x442835[_0x219f('0x15')]?_0x442835[_0x219f('0x15')][_0x219f('0x17')]||null:null,'attributes':_0x442835[_0x219f('0x15')]?_0x442835[_0x219f('0x15')][_0x219f('0x18')]||null:null,'limit':_0x442835[_0x219f('0x15')]?_0x442835[_0x219f('0x15')][_0x219f('0x19')]||null:null,'include':_0x442835[_0x219f('0x15')]?_0x442835[_0x219f('0x15')]['include']?_[_0x219f('0x1a')](_0x442835[_0x219f('0x15')][_0x219f('0x1b')],function(_0x4f00d7){return{'model':db[_0x4f00d7['model']],'as':_0x4f00d7['as'],'attributes':_0x4f00d7['attributes'],'include':_0x4f00d7[_0x219f('0x1b')]?_[_0x219f('0x1a')](_0x4f00d7[_0x219f('0x1b')],function(_0x1f0ca0){return{'model':db[_0x1f0ca0[_0x219f('0x1c')]],'as':_0x1f0ca0['as'],'attributes':_0x1f0ca0[_0x219f('0x18')],'include':_0x1f0ca0[_0x219f('0x1b')]?_[_0x219f('0x1a')](_0x1f0ca0['include'],function(_0x35ab6b){return{'model':db[_0x35ab6b[_0x219f('0x1c')]],'as':_0x35ab6b['as'],'attributes':_0x35ab6b[_0x219f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x219f('0x1d')](function(_0x368fd7){logger[_0x219f('0xa')](_0x219f('0x13'),_0x442835);logger[_0x219f('0xc')](_0x219f('0x13'),_0x442835,JSON[_0x219f('0x1e')](_0x368fd7));_0x363efa(_0x368fd7);})[_0x219f('0x12')](function(_0x515722){logger[_0x219f('0xe')](_0x219f('0x13'),_0x515722[_0x219f('0x10')],_0x442835);_0x55118f(_0x4537ba[_0x219f('0xe')](0x1f4,_0x515722[_0x219f('0x10')]));});});};exports['ShowSugarcrmAccount']=function(_0x15f4c0){var _0x564dd7=this;return new Promise(function(_0x210018,_0x56efca){return db[_0x219f('0x1f')][_0x219f('0x20')]({'raw':_0x15f4c0[_0x219f('0x15')]?_0x15f4c0[_0x219f('0x15')][_0x219f('0x16')]===undefined?!![]:![]:!![],'where':_0x15f4c0[_0x219f('0x15')]?_0x15f4c0[_0x219f('0x15')][_0x219f('0x17')]||null:null,'attributes':_0x15f4c0[_0x219f('0x15')]?_0x15f4c0['options'][_0x219f('0x18')]||null:null,'include':_0x15f4c0[_0x219f('0x15')]?_0x15f4c0['options'][_0x219f('0x1b')]?_['map'](_0x15f4c0[_0x219f('0x15')][_0x219f('0x1b')],function(_0x1d278a){return{'model':db[_0x1d278a[_0x219f('0x1c')]],'as':_0x1d278a['as'],'attributes':_0x1d278a['attributes'],'include':_0x1d278a['include']?_[_0x219f('0x1a')](_0x1d278a['include'],function(_0x1949ee){return{'model':db[_0x1949ee[_0x219f('0x1c')]],'as':_0x1949ee['as'],'attributes':_0x1949ee['attributes'],'include':_0x1949ee[_0x219f('0x1b')]?_[_0x219f('0x1a')](_0x1949ee['include'],function(_0x37bc1f){return{'model':db[_0x37bc1f[_0x219f('0x1c')]],'as':_0x37bc1f['as'],'attributes':_0x37bc1f['attributes']};}):[]};}):[]};}):[]:[]})[_0x219f('0x1d')](function(_0xd95196){logger[_0x219f('0xa')]('ShowSugarcrmAccount',_0x15f4c0);logger[_0x219f('0xc')](_0x219f('0x21'),_0x15f4c0,JSON['stringify'](_0xd95196));_0x210018(_0xd95196);})[_0x219f('0x12')](function(_0x12e08c){logger[_0x219f('0xe')](_0x219f('0x21'),_0x12e08c[_0x219f('0x10')],_0x15f4c0);_0x56efca(_0x564dd7[_0x219f('0xe')](0x1f4,_0x12e08c[_0x219f('0x10')]));});});}; \ No newline at end of file +var _0xb191=['then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','find','ShowSugarcrmAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x5c8ae6,_0x1ff2ff){var _0x474544=function(_0x26d20b){while(--_0x26d20b){_0x5c8ae6['push'](_0x5c8ae6['shift']());}};_0x474544(++_0x1ff2ff);}(_0xb191,0x1c4));var _0x1b19=function(_0x7804f4,_0x367352){_0x7804f4=_0x7804f4-0x0;var _0x293c7d=_0xb191[_0x7804f4];return _0x293c7d;};'use strict';var _=require(_0x1b19('0x0'));var util=require('util');var moment=require(_0x1b19('0x1'));var BPromise=require(_0x1b19('0x2'));var rs=require(_0x1b19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b19('0x4'))['db'];var utils=require(_0x1b19('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1b19('0x6'));var jayson=require(_0x1b19('0x7'));var client=jayson[_0x1b19('0x8')][_0x1b19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x873436,_0x5e937c,_0x5a6bf4){return new BPromise(function(_0x53d2fb,_0x3eca80){return client['request'](_0x873436,_0x5a6bf4)[_0x1b19('0xa')](function(_0xa3a101){logger[_0x1b19('0xb')](_0x1b19('0xc'),_0x5e937c,_0x1b19('0xd'));logger[_0x1b19('0xe')](_0x1b19('0xf'),_0x5e937c,_0x1b19('0xd'),JSON[_0x1b19('0x10')](_0xa3a101));if(_0xa3a101[_0x1b19('0x11')]){if(_0xa3a101[_0x1b19('0x11')]['code']===0x1f4){logger['error'](_0x1b19('0xc'),_0x5e937c,_0xa3a101[_0x1b19('0x11')][_0x1b19('0x12')]);return _0x3eca80(_0xa3a101[_0x1b19('0x11')]['message']);}logger['error'](_0x1b19('0xc'),_0x5e937c,_0xa3a101[_0x1b19('0x11')][_0x1b19('0x12')]);return _0x53d2fb(_0xa3a101['error']['message']);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x5e937c,_0x1b19('0xd'));_0x53d2fb(_0xa3a101[_0x1b19('0x13')][_0x1b19('0x12')]);}})['catch'](function(_0x118fb0){logger['error'](_0x1b19('0xc'),_0x5e937c,_0x118fb0);_0x3eca80(_0x118fb0);});});}exports['GetSugarcrmAccount']=function(_0x242f01){var _0x2f9c80=this;return new Promise(function(_0x14c68b,_0x40eb17){return db[_0x1b19('0x14')][_0x1b19('0x15')]({'raw':_0x242f01[_0x1b19('0x16')]?_0x242f01[_0x1b19('0x16')][_0x1b19('0x17')]===undefined?!![]:![]:!![],'where':_0x242f01['options']?_0x242f01['options'][_0x1b19('0x18')]||null:null,'attributes':_0x242f01[_0x1b19('0x16')]?_0x242f01[_0x1b19('0x16')][_0x1b19('0x19')]||null:null,'limit':_0x242f01[_0x1b19('0x16')]?_0x242f01[_0x1b19('0x16')][_0x1b19('0x1a')]||null:null,'include':_0x242f01[_0x1b19('0x16')]?_0x242f01[_0x1b19('0x16')][_0x1b19('0x1b')]?_[_0x1b19('0x1c')](_0x242f01['options'][_0x1b19('0x1b')],function(_0x527f25){return{'model':db[_0x527f25['model']],'as':_0x527f25['as'],'attributes':_0x527f25[_0x1b19('0x19')],'include':_0x527f25['include']?_['map'](_0x527f25[_0x1b19('0x1b')],function(_0x508559){return{'model':db[_0x508559[_0x1b19('0x1d')]],'as':_0x508559['as'],'attributes':_0x508559[_0x1b19('0x19')],'include':_0x508559[_0x1b19('0x1b')]?_[_0x1b19('0x1c')](_0x508559[_0x1b19('0x1b')],function(_0x31c156){return{'model':db[_0x31c156[_0x1b19('0x1d')]],'as':_0x31c156['as'],'attributes':_0x31c156[_0x1b19('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1b19('0xa')](function(_0x5e8442){logger[_0x1b19('0xb')]('GetSugarcrmAccount',_0x242f01);logger[_0x1b19('0xe')](_0x1b19('0x1e'),_0x242f01,JSON[_0x1b19('0x10')](_0x5e8442));_0x14c68b(_0x5e8442);})['catch'](function(_0x29a7c2){logger['error'](_0x1b19('0x1e'),_0x29a7c2[_0x1b19('0x12')],_0x242f01);_0x40eb17(_0x2f9c80[_0x1b19('0x11')](0x1f4,_0x29a7c2['message']));});});};exports['ShowSugarcrmAccount']=function(_0x1c3f31){var _0x3ed869=this;return new Promise(function(_0xdc0073,_0x5e709c){return db[_0x1b19('0x14')][_0x1b19('0x1f')]({'raw':_0x1c3f31[_0x1b19('0x16')]?_0x1c3f31[_0x1b19('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1c3f31[_0x1b19('0x16')]?_0x1c3f31['options']['where']||null:null,'attributes':_0x1c3f31['options']?_0x1c3f31[_0x1b19('0x16')][_0x1b19('0x19')]||null:null,'include':_0x1c3f31[_0x1b19('0x16')]?_0x1c3f31[_0x1b19('0x16')][_0x1b19('0x1b')]?_[_0x1b19('0x1c')](_0x1c3f31['options'][_0x1b19('0x1b')],function(_0x5296d9){return{'model':db[_0x5296d9[_0x1b19('0x1d')]],'as':_0x5296d9['as'],'attributes':_0x5296d9['attributes'],'include':_0x5296d9[_0x1b19('0x1b')]?_[_0x1b19('0x1c')](_0x5296d9[_0x1b19('0x1b')],function(_0x3a1153){return{'model':db[_0x3a1153[_0x1b19('0x1d')]],'as':_0x3a1153['as'],'attributes':_0x3a1153[_0x1b19('0x19')],'include':_0x3a1153[_0x1b19('0x1b')]?_[_0x1b19('0x1c')](_0x3a1153[_0x1b19('0x1b')],function(_0x5bef95){return{'model':db[_0x5bef95[_0x1b19('0x1d')]],'as':_0x5bef95['as'],'attributes':_0x5bef95[_0x1b19('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1b19('0xa')](function(_0x41d637){logger[_0x1b19('0xb')](_0x1b19('0x20'),_0x1c3f31);logger['debug'](_0x1b19('0x20'),_0x1c3f31,JSON[_0x1b19('0x10')](_0x41d637));_0xdc0073(_0x41d637);})['catch'](function(_0x4357dc){logger[_0x1b19('0x11')](_0x1b19('0x20'),_0x4357dc[_0x1b19('0x12')],_0x1c3f31);_0x5e709c(_0x3ed869[_0x1b19('0x11')](0x1f4,_0x4357dc[_0x1b19('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 45ac6f4..d49e0ed 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 _0x8270=['show','getFields','/:id/subjects','getDescriptions','post','create','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x2cb976,_0x12c013){var _0x3d8412=function(_0x5b3549){while(--_0x5b3549){_0x2cb976['push'](_0x2cb976['shift']());}};_0x3d8412(++_0x12c013);}(_0x8270,0x145));var _0x0827=function(_0x5c5df2,_0x367d02){_0x5c5df2=_0x5c5df2-0x0;var _0x3d6e09=_0x8270[_0x5c5df2];return _0x3d6e09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0827('0x0'));var timeout=require(_0x0827('0x1'));var express=require(_0x0827('0x2'));var router=express[_0x0827('0x3')]();var auth=require(_0x0827('0x4'));var interaction=require(_0x0827('0x5'));var config=require(_0x0827('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x0827('0x7')]('/',auth[_0x0827('0x8')](),controller[_0x0827('0x9')]);router[_0x0827('0x7')](_0x0827('0xa'),auth[_0x0827('0x8')](),controller[_0x0827('0xb')]);router['get']('/:id/fields',auth[_0x0827('0x8')](),controller[_0x0827('0xc')]);router[_0x0827('0x7')](_0x0827('0xd'),auth[_0x0827('0x8')](),controller['getSubjects']);router[_0x0827('0x7')]('/:id/descriptions',auth[_0x0827('0x8')](),controller[_0x0827('0xe')]);router[_0x0827('0xf')]('/',auth[_0x0827('0x8')](),controller[_0x0827('0x10')]);router[_0x0827('0x11')](_0x0827('0xa'),auth[_0x0827('0x8')](),controller[_0x0827('0x12')]);router[_0x0827('0x13')](_0x0827('0xa'),auth[_0x0827('0x8')](),controller['destroy']);module[_0x0827('0x14')]=router; \ No newline at end of file +var _0xb398=['index','get','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','path','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated'];(function(_0x2a3031,_0x4842c3){var _0x4e7a20=function(_0x264102){while(--_0x264102){_0x2a3031['push'](_0x2a3031['shift']());}};_0x4e7a20(++_0x4842c3);}(_0xb398,0x18a));var _0x8b39=function(_0x3ffc22,_0x384c16){_0x3ffc22=_0x3ffc22-0x0;var _0x8f243c=_0xb398[_0x3ffc22];return _0x8f243c;};'use strict';var multer=require(_0x8b39('0x0'));var util=require('util');var path=require(_0x8b39('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x8b39('0x2'));var interaction=require(_0x8b39('0x3'));var config=require('../../config/environment');var controller=require(_0x8b39('0x4'));router['get']('/',auth[_0x8b39('0x5')](),controller[_0x8b39('0x6')]);router[_0x8b39('0x7')](_0x8b39('0x8'),auth[_0x8b39('0x5')](),controller['show']);router[_0x8b39('0x7')]('/:id/fields',auth[_0x8b39('0x5')](),controller[_0x8b39('0x9')]);router[_0x8b39('0x7')](_0x8b39('0xa'),auth[_0x8b39('0x5')](),controller[_0x8b39('0xb')]);router[_0x8b39('0x7')](_0x8b39('0xc'),auth[_0x8b39('0x5')](),controller[_0x8b39('0xd')]);router[_0x8b39('0xe')]('/',auth[_0x8b39('0x5')](),controller[_0x8b39('0xf')]);router['put'](_0x8b39('0x8'),auth[_0x8b39('0x5')](),controller[_0x8b39('0x10')]);router[_0x8b39('0x11')](_0x8b39('0x8'),auth['isAuthenticated'](),controller[_0x8b39('0x12')]);module[_0x8b39('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index fd852a6..4abbc4f 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 _0xbe9a=['STRING','sequelize'];(function(_0x587c18,_0x77ffeb){var _0x49f312=function(_0x4646cc){while(--_0x4646cc){_0x587c18['push'](_0x587c18['shift']());}};_0x49f312(++_0x77ffeb);}(_0xbe9a,0x15f));var _0xabe9=function(_0x2d67c1,_0x4d7aa8){_0x2d67c1=_0x2d67c1-0x0;var _0x5be8fd=_0xbe9a[_0x2d67c1];return _0x5be8fd;};'use strict';var Sequelize=require(_0xabe9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xabe9('0x1')]}}; \ No newline at end of file +var _0x6beb=['exports','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6beb,0x164));var _0xb6be=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6beb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xb6be('0x0'));module[_0xb6be('0x1')]={'name':{'type':Sequelize[_0xb6be('0x2')]},'description':{'type':Sequelize[_0xb6be('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 8243e9d..72cfa8c 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 _0x0429=['count','includeAll','include','findAll','show','params','options','create','body','find','getFields','findOne','order','sort','getSubjects','SugarcrmField','getDescriptions','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','offset','limit','set','Content-Range','apply','save','update','sendStatus','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL'];(function(_0x19653d,_0x3c99da){var _0x45708f=function(_0x29ed17){while(--_0x29ed17){_0x19653d['push'](_0x19653d['shift']());}};_0x45708f(++_0x3c99da);}(_0x0429,0x17d));var _0x9042=function(_0x3d813b,_0x1efd93){_0x3d813b=_0x3d813b-0x0;var _0x3bdaab=_0x0429[_0x3d813b];return _0x3bdaab;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9042('0x0'));var zipdir=require(_0x9042('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9042('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9042('0x3'));var util=require(_0x9042('0x4'));var path=require(_0x9042('0x5'));var sox=require(_0x9042('0x6'));var csv=require('to-csv');var ejs=require(_0x9042('0x7'));var fs=require('fs');var _=require(_0x9042('0x8'));var squel=require(_0x9042('0x9'));var crypto=require('crypto');var jsforce=require(_0x9042('0xa'));var deskjs=require(_0x9042('0xb'));var toCsv=require(_0x9042('0xc'));var querystring=require(_0x9042('0xd'));var Papa=require('papaparse');var Redis=require(_0x9042('0xe'));var authService=require(_0x9042('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9042('0x10'));var hardwareService=require(_0x9042('0x11'));var logger=require(_0x9042('0x12'))(_0x9042('0x13'));var utils=require(_0x9042('0x14'));var config=require(_0x9042('0x15'));var db=require(_0x9042('0x16'))['db'];var jayson=require(_0x9042('0x17'));var client=jayson[_0x9042('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x2a15ce,_0xbb8e95,_0x4bf0b5){if(_0x4bf0b5){var _0x5a503c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a503c['test'](_0xbb8e95)){return _0x2a15ce;}else{throw new db['Sequelize'][(_0x9042('0x19'))](_0x9042('0x1a'));}}else{return _0x2a15ce;}}function respondWithRpcPromise(_0x1da588,_0x482c58,_0x5ebf71,_0x2de9c6){return new BPromise(function(_0x39f12b,_0x253192){var _0x4b1fea=_0x2de9c6||client;return _0x4b1fea[_0x9042('0x1b')](_0x1da588,_0x5ebf71)[_0x9042('0x1c')](function(_0x558a6c){logger[_0x9042('0x1d')](_0x9042('0x1e'),_0x482c58,_0x9042('0x1f'));logger[_0x9042('0x20')](_0x9042('0x21'),_0x482c58,_0x9042('0x1f'),JSON['stringify'](_0x558a6c));if(_0x558a6c[_0x9042('0x22')]){if(_0x558a6c[_0x9042('0x22')][_0x9042('0x23')]===0x1f4){logger[_0x9042('0x22')](_0x9042('0x1e'),_0x482c58,_0x558a6c[_0x9042('0x22')]['message']);return _0x253192(_0x558a6c['error'][_0x9042('0x24')]);}logger['error'](_0x9042('0x1e'),_0x482c58,_0x558a6c['error'][_0x9042('0x24')]);return _0x39f12b(_0x558a6c[_0x9042('0x22')]['message']);}else{logger[_0x9042('0x1d')](_0x9042('0x1e'),_0x482c58,'request\x20sent');_0x39f12b(_0x558a6c[_0x9042('0x25')][_0x9042('0x24')]);}})[_0x9042('0x26')](function(_0x17862d){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x482c58,_0x17862d);_0x253192(_0x17862d);});});}function respondWithStatusCode(_0x55a311,_0x15ec63){_0x15ec63=_0x15ec63||0xcc;return function(_0x5e46b3){if(_0x5e46b3){return _0x55a311['sendStatus'](_0x15ec63);}return _0x55a311['status'](_0x15ec63)[_0x9042('0x27')]();};}function respondWithResult(_0x12144e,_0x41a67c){_0x41a67c=_0x41a67c||0xc8;return function(_0x178c2c){if(_0x178c2c){return _0x12144e[_0x9042('0x28')](_0x41a67c)[_0x9042('0x29')](_0x178c2c);}};}function respondWithFilteredResult(_0x45d3ce,_0x1a5caf){return function(_0x2aa4bb){if(_0x2aa4bb){var _0x153df4=_0x2aa4bb['count'],_0x16c90f=_0x1a5caf[_0x9042('0x2a')],_0x1b46f7=_0x1a5caf['offset']+_0x1a5caf[_0x9042('0x2b')],_0x313392;if(_0x1b46f7>=_0x153df4){_0x1b46f7=_0x153df4;_0x313392=0xc8;}else{_0x313392=0xce;}_0x45d3ce[_0x9042('0x28')](_0x313392);return _0x45d3ce[_0x9042('0x2c')](_0x9042('0x2d'),_0x16c90f+'-'+_0x1b46f7+'/'+_0x153df4)[_0x9042('0x29')](_0x2aa4bb);}return null;};}function patchUpdates(_0x175c42){return function(_0x12d858){try{jsonpatch[_0x9042('0x2e')](_0x12d858,_0x175c42,!![]);}catch(_0x142333){return BPromise['reject'](_0x142333);}return _0x12d858[_0x9042('0x2f')]();};}function saveUpdates(_0x4a78d4,_0x57be88){return function(_0x2c1921){if(_0x2c1921){return _0x2c1921[_0x9042('0x30')](_0x4a78d4)[_0x9042('0x1c')](function(_0x4e3d28){return _0x4e3d28;});}return null;};}function removeEntity(_0xc6368,_0x496383){return function(_0x26438e){if(_0x26438e){return _0x26438e['destroy']()[_0x9042('0x1c')](function(){_0xc6368['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35ea19,_0x49a835){return function(_0x329de1){if(!_0x329de1){_0x35ea19[_0x9042('0x31')](0x194);}return _0x329de1;};}function handleError(_0x5bd7d4,_0x376a7c){_0x376a7c=_0x376a7c||0x1f4;return function(_0x399832){logger[_0x9042('0x22')](_0x399832[_0x9042('0x32')]);if(_0x399832[_0x9042('0x33')]){delete _0x399832[_0x9042('0x33')];}_0x5bd7d4[_0x9042('0x28')](_0x376a7c)[_0x9042('0x34')](_0x399832);};}exports[_0x9042('0x35')]=function(_0x15ab5f,_0x2858c9){var _0x11d99e={},_0x442bbf={},_0x6cbd5d={'count':0x0,'rows':[]};var _0x4cf857=_[_0x9042('0x36')](db[_0x9042('0x37')][_0x9042('0x38')],function(_0x49ce06){return{'name':_0x49ce06[_0x9042('0x39')],'type':_0x49ce06['type']['key']};});_0x442bbf[_0x9042('0x3a')]=_[_0x9042('0x36')](_0x4cf857,_0x9042('0x33'));_0x442bbf['query']=_[_0x9042('0x3b')](_0x15ab5f[_0x9042('0x3c')]);_0x442bbf[_0x9042('0x3d')]=_['intersection'](_0x442bbf[_0x9042('0x3a')],_0x442bbf[_0x9042('0x3c')]);_0x11d99e['attributes']=_[_0x9042('0x3e')](_0x442bbf[_0x9042('0x3a')],qs['fields'](_0x15ab5f[_0x9042('0x3c')][_0x9042('0x3f')]));_0x11d99e[_0x9042('0x40')]=_0x11d99e[_0x9042('0x40')][_0x9042('0x41')]?_0x11d99e[_0x9042('0x40')]:_0x442bbf[_0x9042('0x3a')];if(!_0x15ab5f[_0x9042('0x3c')][_0x9042('0x42')](_0x9042('0x43'))){_0x11d99e['limit']=qs[_0x9042('0x2b')](_0x15ab5f[_0x9042('0x3c')]['limit']);_0x11d99e[_0x9042('0x2a')]=qs[_0x9042('0x2a')](_0x15ab5f[_0x9042('0x3c')]['offset']);}_0x11d99e['order']=qs['sort'](_0x15ab5f[_0x9042('0x3c')]['sort']);_0x11d99e[_0x9042('0x44')]=qs[_0x9042('0x3d')](_[_0x9042('0x45')](_0x15ab5f[_0x9042('0x3c')],_0x442bbf[_0x9042('0x3d')]),_0x4cf857);if(_0x15ab5f[_0x9042('0x3c')][_0x9042('0x46')]){_0x11d99e[_0x9042('0x44')]=_[_0x9042('0x47')](_0x11d99e[_0x9042('0x44')],{'$or':_[_0x9042('0x36')](_0x4cf857,function(_0x2dfaa4){if(_0x2dfaa4[_0x9042('0x48')]!==_0x9042('0x49')){var _0x2dc4c5={};_0x2dc4c5[_0x2dfaa4[_0x9042('0x33')]]={'$like':'%'+_0x15ab5f[_0x9042('0x3c')][_0x9042('0x46')]+'%'};return _0x2dc4c5;}})});}_0x11d99e=_[_0x9042('0x47')]({},_0x11d99e,_0x15ab5f['options']);var _0x79dc48={'where':_0x11d99e[_0x9042('0x44')]};return db[_0x9042('0x37')]['count'](_0x79dc48)[_0x9042('0x1c')](function(_0xdd8188){_0x6cbd5d[_0x9042('0x4a')]=_0xdd8188;if(_0x15ab5f[_0x9042('0x3c')][_0x9042('0x4b')]){_0x11d99e[_0x9042('0x4c')]=[{'all':!![]}];}return db[_0x9042('0x37')][_0x9042('0x4d')](_0x11d99e);})[_0x9042('0x1c')](function(_0x74d70c){_0x6cbd5d['rows']=_0x74d70c;return _0x6cbd5d;})['then'](respondWithFilteredResult(_0x2858c9,_0x11d99e))[_0x9042('0x26')](handleError(_0x2858c9,null));};exports[_0x9042('0x4e')]=function(_0x394728,_0x5cdd8a){var _0x594a5e={'raw':![],'where':{'id':_0x394728[_0x9042('0x4f')]['id']}},_0x455654={};_0x455654[_0x9042('0x3a')]=_['keys'](db['SugarcrmConfiguration'][_0x9042('0x38')]);_0x455654[_0x9042('0x3c')]=_[_0x9042('0x3b')](_0x394728[_0x9042('0x3c')]);_0x455654[_0x9042('0x3d')]=_[_0x9042('0x3e')](_0x455654[_0x9042('0x3a')],_0x455654['query']);_0x594a5e[_0x9042('0x40')]=_[_0x9042('0x3e')](_0x455654['model'],qs['fields'](_0x394728[_0x9042('0x3c')]['fields']));_0x594a5e['attributes']=_0x594a5e[_0x9042('0x40')][_0x9042('0x41')]?_0x594a5e[_0x9042('0x40')]:_0x455654['model'];if(_0x394728[_0x9042('0x3c')][_0x9042('0x4b')]){_0x594a5e[_0x9042('0x4c')]=[{'all':!![]}];}_0x594a5e=_[_0x9042('0x47')]({},_0x594a5e,_0x394728[_0x9042('0x50')]);return db[_0x9042('0x37')]['find'](_0x594a5e)[_0x9042('0x1c')](handleEntityNotFound(_0x5cdd8a,null))['then'](respondWithResult(_0x5cdd8a,null))[_0x9042('0x26')](handleError(_0x5cdd8a,null));};exports[_0x9042('0x51')]=function(_0x3c093c,_0x1411b6){return db[_0x9042('0x37')][_0x9042('0x51')](_0x3c093c['body'],{})[_0x9042('0x1c')](respondWithResult(_0x1411b6,0xc9))[_0x9042('0x26')](handleError(_0x1411b6,null));};exports[_0x9042('0x30')]=function(_0x2595a8,_0x3c42fb){if(_0x2595a8[_0x9042('0x52')]['id']){delete _0x2595a8[_0x9042('0x52')]['id'];}return db[_0x9042('0x37')][_0x9042('0x53')]({'where':{'id':_0x2595a8[_0x9042('0x4f')]['id']}})[_0x9042('0x1c')](handleEntityNotFound(_0x3c42fb,null))[_0x9042('0x1c')](saveUpdates(_0x2595a8[_0x9042('0x52')],null))[_0x9042('0x1c')](respondWithResult(_0x3c42fb,null))[_0x9042('0x26')](handleError(_0x3c42fb,null));};exports['destroy']=function(_0x177bfa,_0x38efad){return db[_0x9042('0x37')][_0x9042('0x53')]({'where':{'id':_0x177bfa[_0x9042('0x4f')]['id']}})['then'](handleEntityNotFound(_0x38efad,null))['then'](removeEntity(_0x38efad,null))[_0x9042('0x26')](handleError(_0x38efad,null));};exports[_0x9042('0x54')]=function(_0x502679,_0xd72e2a,_0x55ee97){var _0x4b02b4={};var _0xeeb665={};var _0x17c4f9;var _0x25a175;return db[_0x9042('0x37')][_0x9042('0x55')]({'where':{'id':_0x502679['params']['id']}})[_0x9042('0x1c')](handleEntityNotFound(_0xd72e2a,null))[_0x9042('0x1c')](function(_0x3d95d7){if(_0x3d95d7){_0x17c4f9=_0x3d95d7;_0xeeb665['model']=_[_0x9042('0x3b')](db['SugarcrmField']['rawAttributes']);_0xeeb665['query']=_[_0x9042('0x3b')](_0x502679[_0x9042('0x3c')]);_0xeeb665[_0x9042('0x3d')]=_[_0x9042('0x3e')](_0xeeb665['model'],_0xeeb665[_0x9042('0x3c')]);_0x4b02b4[_0x9042('0x40')]=_[_0x9042('0x3e')](_0xeeb665['model'],qs[_0x9042('0x3f')](_0x502679['query'][_0x9042('0x3f')]));_0x4b02b4[_0x9042('0x40')]=_0x4b02b4['attributes'][_0x9042('0x41')]?_0x4b02b4[_0x9042('0x40')]:_0xeeb665[_0x9042('0x3a')];_0x4b02b4[_0x9042('0x56')]=qs['sort'](_0x502679[_0x9042('0x3c')][_0x9042('0x57')]);_0x4b02b4['where']=qs[_0x9042('0x3d')](_['pick'](_0x502679[_0x9042('0x3c')],_0xeeb665[_0x9042('0x3d')]));if(_0x502679[_0x9042('0x3c')][_0x9042('0x46')]){_0x4b02b4[_0x9042('0x44')]=_[_0x9042('0x47')](_0x4b02b4[_0x9042('0x44')],{'$or':_[_0x9042('0x36')](_0x4b02b4['attributes'],function(_0x2496e4){var _0x542334={};_0x542334[_0x2496e4]={'$like':'%'+_0x502679[_0x9042('0x3c')][_0x9042('0x46')]+'%'};return _0x542334;})});}_0x4b02b4=_[_0x9042('0x47')]({},_0x4b02b4,_0x502679['options']);return _0x17c4f9[_0x9042('0x54')](_0x4b02b4);}})[_0x9042('0x1c')](function(_0x321e0e){if(_0x321e0e){_0x25a175=_0x321e0e['length'];if(!_0x502679[_0x9042('0x3c')][_0x9042('0x42')](_0x9042('0x43'))){_0x4b02b4[_0x9042('0x2b')]=qs[_0x9042('0x2b')](_0x502679[_0x9042('0x3c')][_0x9042('0x2b')]);_0x4b02b4['offset']=qs[_0x9042('0x2a')](_0x502679['query']['offset']);}return _0x17c4f9['getFields'](_0x4b02b4);}})[_0x9042('0x1c')](function(_0x7f8390){if(_0x7f8390){return _0x7f8390?{'count':_0x25a175,'rows':_0x7f8390}:null;}})[_0x9042('0x1c')](respondWithResult(_0xd72e2a,null))['catch'](handleError(_0xd72e2a,null));};exports[_0x9042('0x58')]=function(_0x2a0b3e,_0x4d6792,_0x22591d){var _0xcd3672={};var _0x569b0c={};var _0x583a7e;var _0x52dd69;return db['SugarcrmConfiguration'][_0x9042('0x55')]({'where':{'id':_0x2a0b3e['params']['id']}})['then'](handleEntityNotFound(_0x4d6792,null))[_0x9042('0x1c')](function(_0xf43998){if(_0xf43998){_0x583a7e=_0xf43998;_0x569b0c['model']=_['keys'](db['SugarcrmField'][_0x9042('0x38')]);_0x569b0c[_0x9042('0x3c')]=_[_0x9042('0x3b')](_0x2a0b3e['query']);_0x569b0c[_0x9042('0x3d')]=_['intersection'](_0x569b0c['model'],_0x569b0c[_0x9042('0x3c')]);_0xcd3672[_0x9042('0x40')]=_[_0x9042('0x3e')](_0x569b0c[_0x9042('0x3a')],qs['fields'](_0x2a0b3e[_0x9042('0x3c')][_0x9042('0x3f')]));_0xcd3672[_0x9042('0x40')]=_0xcd3672['attributes'][_0x9042('0x41')]?_0xcd3672[_0x9042('0x40')]:_0x569b0c[_0x9042('0x3a')];_0xcd3672[_0x9042('0x56')]=qs[_0x9042('0x57')](_0x2a0b3e['query'][_0x9042('0x57')]);_0xcd3672[_0x9042('0x44')]=qs['filters'](_['pick'](_0x2a0b3e['query'],_0x569b0c[_0x9042('0x3d')]));if(_0x2a0b3e[_0x9042('0x3c')][_0x9042('0x46')]){_0xcd3672[_0x9042('0x44')]=_[_0x9042('0x47')](_0xcd3672[_0x9042('0x44')],{'$or':_['map'](_0xcd3672['attributes'],function(_0x377c15){var _0x30c420={};_0x30c420[_0x377c15]={'$like':'%'+_0x2a0b3e['query']['filter']+'%'};return _0x30c420;})});}_0xcd3672=_[_0x9042('0x47')]({},_0xcd3672,_0x2a0b3e[_0x9042('0x50')]);return _0x583a7e['getSubjects'](_0xcd3672);}})[_0x9042('0x1c')](function(_0x3ccb38){if(_0x3ccb38){_0x52dd69=_0x3ccb38[_0x9042('0x41')];if(!_0x2a0b3e[_0x9042('0x3c')][_0x9042('0x42')](_0x9042('0x43'))){_0xcd3672[_0x9042('0x2b')]=qs[_0x9042('0x2b')](_0x2a0b3e[_0x9042('0x3c')][_0x9042('0x2b')]);_0xcd3672[_0x9042('0x2a')]=qs['offset'](_0x2a0b3e[_0x9042('0x3c')][_0x9042('0x2a')]);}return _0x583a7e[_0x9042('0x58')](_0xcd3672);}})[_0x9042('0x1c')](function(_0x12b4f7){if(_0x12b4f7){return _0x12b4f7?{'count':_0x52dd69,'rows':_0x12b4f7}:null;}})[_0x9042('0x1c')](respondWithResult(_0x4d6792,null))[_0x9042('0x26')](handleError(_0x4d6792,null));};exports['getDescriptions']=function(_0x1bca34,_0x1b3cd5,_0x149c17){var _0x1582a2={};var _0x5b04ad={};var _0x1e092a;var _0x3790f4;return db[_0x9042('0x37')][_0x9042('0x55')]({'where':{'id':_0x1bca34[_0x9042('0x4f')]['id']}})[_0x9042('0x1c')](handleEntityNotFound(_0x1b3cd5,null))[_0x9042('0x1c')](function(_0x4d41ce){if(_0x4d41ce){_0x1e092a=_0x4d41ce;_0x5b04ad[_0x9042('0x3a')]=_[_0x9042('0x3b')](db[_0x9042('0x59')][_0x9042('0x38')]);_0x5b04ad[_0x9042('0x3c')]=_[_0x9042('0x3b')](_0x1bca34['query']);_0x5b04ad[_0x9042('0x3d')]=_[_0x9042('0x3e')](_0x5b04ad['model'],_0x5b04ad[_0x9042('0x3c')]);_0x1582a2[_0x9042('0x40')]=_[_0x9042('0x3e')](_0x5b04ad['model'],qs['fields'](_0x1bca34['query'][_0x9042('0x3f')]));_0x1582a2[_0x9042('0x40')]=_0x1582a2[_0x9042('0x40')][_0x9042('0x41')]?_0x1582a2['attributes']:_0x5b04ad[_0x9042('0x3a')];_0x1582a2['order']=qs['sort'](_0x1bca34[_0x9042('0x3c')][_0x9042('0x57')]);_0x1582a2[_0x9042('0x44')]=qs['filters'](_[_0x9042('0x45')](_0x1bca34[_0x9042('0x3c')],_0x5b04ad[_0x9042('0x3d')]));if(_0x1bca34[_0x9042('0x3c')][_0x9042('0x46')]){_0x1582a2['where']=_[_0x9042('0x47')](_0x1582a2['where'],{'$or':_[_0x9042('0x36')](_0x1582a2[_0x9042('0x40')],function(_0x50a29c){var _0x458a8a={};_0x458a8a[_0x50a29c]={'$like':'%'+_0x1bca34['query'][_0x9042('0x46')]+'%'};return _0x458a8a;})});}_0x1582a2=_[_0x9042('0x47')]({},_0x1582a2,_0x1bca34[_0x9042('0x50')]);return _0x1e092a[_0x9042('0x5a')](_0x1582a2);}})[_0x9042('0x1c')](function(_0x5ca218){if(_0x5ca218){_0x3790f4=_0x5ca218[_0x9042('0x41')];if(!_0x1bca34[_0x9042('0x3c')]['hasOwnProperty'](_0x9042('0x43'))){_0x1582a2[_0x9042('0x2b')]=qs[_0x9042('0x2b')](_0x1bca34[_0x9042('0x3c')]['limit']);_0x1582a2[_0x9042('0x2a')]=qs[_0x9042('0x2a')](_0x1bca34[_0x9042('0x3c')][_0x9042('0x2a')]);}return _0x1e092a[_0x9042('0x5a')](_0x1582a2);}})[_0x9042('0x1c')](function(_0x153571){if(_0x153571){return _0x153571?{'count':_0x3790f4,'rows':_0x153571}:null;}})[_0x9042('0x1c')](respondWithResult(_0x1b3cd5,null))[_0x9042('0x26')](handleError(_0x1b3cd5,null));}; \ No newline at end of file +var _0x6c61=['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','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','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','destroy','end','stack','name','map','SugarcrmConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','include','rows','show','params','rawAttributes','includeAll','options','find','create','update','body','getFields','findOne','order','SugarcrmField','getSubjects','nolimit','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x5af2a0,_0x1c92d9){var _0x72f843=function(_0x2fe83b){while(--_0x2fe83b){_0x5af2a0['push'](_0x5af2a0['shift']());}};_0x72f843(++_0x1c92d9);}(_0x6c61,0x178));var _0x16c6=function(_0x26b2f7,_0x113598){_0x26b2f7=_0x26b2f7-0x0;var _0x1c3507=_0x6c61[_0x26b2f7];return _0x1c3507;};'use strict';var pdf=require(_0x16c6('0x0'));var emlformat=require(_0x16c6('0x1'));var rimraf=require(_0x16c6('0x2'));var zipdir=require(_0x16c6('0x3'));var jsonpatch=require(_0x16c6('0x4'));var rp=require(_0x16c6('0x5'));var moment=require(_0x16c6('0x6'));var BPromise=require(_0x16c6('0x7'));var Mustache=require(_0x16c6('0x8'));var util=require(_0x16c6('0x9'));var path=require(_0x16c6('0xa'));var sox=require(_0x16c6('0xb'));var csv=require(_0x16c6('0xc'));var ejs=require(_0x16c6('0xd'));var fs=require('fs');var _=require(_0x16c6('0xe'));var squel=require(_0x16c6('0xf'));var crypto=require(_0x16c6('0x10'));var jsforce=require(_0x16c6('0x11'));var deskjs=require(_0x16c6('0x12'));var toCsv=require('to-csv');var querystring=require(_0x16c6('0x13'));var Papa=require(_0x16c6('0x14'));var Redis=require(_0x16c6('0x15'));var authService=require(_0x16c6('0x16'));var qs=require(_0x16c6('0x17'));var as=require(_0x16c6('0x18'));var hardwareService=require(_0x16c6('0x19'));var logger=require('../../config/logger')(_0x16c6('0x1a'));var utils=require(_0x16c6('0x1b'));var config=require(_0x16c6('0x1c'));var db=require(_0x16c6('0x1d'))['db'];var jayson=require(_0x16c6('0x1e'));var client=jayson[_0x16c6('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x271560,_0x4b445d,_0xae2b49){if(_0xae2b49){var _0x58ba61=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58ba61[_0x16c6('0x20')](_0x4b445d)){return _0x271560;}else{throw new db['Sequelize'][(_0x16c6('0x21'))](_0x16c6('0x22'));}}else{return _0x271560;}}function respondWithRpcPromise(_0x436faa,_0x1d2df3,_0x208e3e,_0x3fba28){return new BPromise(function(_0x4eec86,_0x1fa584){var _0x29c3a4=_0x3fba28||client;return _0x29c3a4[_0x16c6('0x23')](_0x436faa,_0x208e3e)[_0x16c6('0x24')](function(_0x3def6c){logger[_0x16c6('0x25')](_0x16c6('0x26'),_0x1d2df3,_0x16c6('0x27'));logger[_0x16c6('0x28')](_0x16c6('0x29'),_0x1d2df3,_0x16c6('0x27'),JSON[_0x16c6('0x2a')](_0x3def6c));if(_0x3def6c[_0x16c6('0x2b')]){if(_0x3def6c[_0x16c6('0x2b')]['code']===0x1f4){logger[_0x16c6('0x2b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1d2df3,_0x3def6c[_0x16c6('0x2b')][_0x16c6('0x2c')]);return _0x1fa584(_0x3def6c[_0x16c6('0x2b')][_0x16c6('0x2c')]);}logger[_0x16c6('0x2b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1d2df3,_0x3def6c[_0x16c6('0x2b')][_0x16c6('0x2c')]);return _0x4eec86(_0x3def6c['error']['message']);}else{logger[_0x16c6('0x25')](_0x16c6('0x26'),_0x1d2df3,_0x16c6('0x27'));_0x4eec86(_0x3def6c['result'][_0x16c6('0x2c')]);}})[_0x16c6('0x2d')](function(_0x453e68){logger[_0x16c6('0x2b')](_0x16c6('0x26'),_0x1d2df3,_0x453e68);_0x1fa584(_0x453e68);});});}function respondWithStatusCode(_0x55fd7a,_0x3770c3){_0x3770c3=_0x3770c3||0xcc;return function(_0xff2ac4){if(_0xff2ac4){return _0x55fd7a[_0x16c6('0x2e')](_0x3770c3);}return _0x55fd7a[_0x16c6('0x2f')](_0x3770c3)['end']();};}function respondWithResult(_0x3f5cfb,_0x1b5911){_0x1b5911=_0x1b5911||0xc8;return function(_0x18f563){if(_0x18f563){return _0x3f5cfb[_0x16c6('0x2f')](_0x1b5911)[_0x16c6('0x30')](_0x18f563);}};}function respondWithFilteredResult(_0x35105f,_0x545981){return function(_0x25675e){if(_0x25675e){var _0x8eecdc=_0x25675e[_0x16c6('0x31')],_0x2b7af0=_0x545981[_0x16c6('0x32')],_0x2a8f69=_0x545981[_0x16c6('0x32')]+_0x545981[_0x16c6('0x33')],_0x462b3c;if(_0x2a8f69>=_0x8eecdc){_0x2a8f69=_0x8eecdc;_0x462b3c=0xc8;}else{_0x462b3c=0xce;}_0x35105f[_0x16c6('0x2f')](_0x462b3c);return _0x35105f[_0x16c6('0x34')](_0x16c6('0x35'),_0x2b7af0+'-'+_0x2a8f69+'/'+_0x8eecdc)[_0x16c6('0x30')](_0x25675e);}return null;};}function patchUpdates(_0x491648){return function(_0x19506c){try{jsonpatch['apply'](_0x19506c,_0x491648,!![]);}catch(_0x6f45e9){return BPromise[_0x16c6('0x36')](_0x6f45e9);}return _0x19506c['save']();};}function saveUpdates(_0x10ea18,_0x468dc3){return function(_0x4ca32f){if(_0x4ca32f){return _0x4ca32f['update'](_0x10ea18)[_0x16c6('0x24')](function(_0x3418b1){return _0x3418b1;});}return null;};}function removeEntity(_0x8d916a,_0x4680a3){return function(_0x538452){if(_0x538452){return _0x538452[_0x16c6('0x37')]()[_0x16c6('0x24')](function(){_0x8d916a[_0x16c6('0x2f')](0xcc)[_0x16c6('0x38')]();});}};}function handleEntityNotFound(_0x360a78,_0x3965eb){return function(_0x1e24ed){if(!_0x1e24ed){_0x360a78[_0x16c6('0x2e')](0x194);}return _0x1e24ed;};}function handleError(_0x1a09e8,_0x170608){_0x170608=_0x170608||0x1f4;return function(_0x4c2662){logger[_0x16c6('0x2b')](_0x4c2662[_0x16c6('0x39')]);if(_0x4c2662[_0x16c6('0x3a')]){delete _0x4c2662[_0x16c6('0x3a')];}_0x1a09e8[_0x16c6('0x2f')](_0x170608)['send'](_0x4c2662);};}exports['index']=function(_0x2224fa,_0x3ca1ee){var _0x4b2b28={},_0x53299f={},_0x5d2b14={'count':0x0,'rows':[]};var _0x34eb39=_[_0x16c6('0x3b')](db[_0x16c6('0x3c')]['rawAttributes'],function(_0x16c328){return{'name':_0x16c328[_0x16c6('0x3d')],'type':_0x16c328[_0x16c6('0x3e')][_0x16c6('0x3f')]};});_0x53299f['model']=_[_0x16c6('0x3b')](_0x34eb39,_0x16c6('0x3a'));_0x53299f[_0x16c6('0x40')]=_[_0x16c6('0x41')](_0x2224fa[_0x16c6('0x40')]);_0x53299f[_0x16c6('0x42')]=_[_0x16c6('0x43')](_0x53299f[_0x16c6('0x44')],_0x53299f['query']);_0x4b2b28[_0x16c6('0x45')]=_['intersection'](_0x53299f[_0x16c6('0x44')],qs[_0x16c6('0x46')](_0x2224fa[_0x16c6('0x40')]['fields']));_0x4b2b28[_0x16c6('0x45')]=_0x4b2b28[_0x16c6('0x45')][_0x16c6('0x47')]?_0x4b2b28[_0x16c6('0x45')]:_0x53299f['model'];if(!_0x2224fa[_0x16c6('0x40')][_0x16c6('0x48')]('nolimit')){_0x4b2b28[_0x16c6('0x33')]=qs[_0x16c6('0x33')](_0x2224fa[_0x16c6('0x40')][_0x16c6('0x33')]);_0x4b2b28[_0x16c6('0x32')]=qs[_0x16c6('0x32')](_0x2224fa['query'][_0x16c6('0x32')]);}_0x4b2b28['order']=qs[_0x16c6('0x49')](_0x2224fa[_0x16c6('0x40')][_0x16c6('0x49')]);_0x4b2b28['where']=qs[_0x16c6('0x42')](_[_0x16c6('0x4a')](_0x2224fa['query'],_0x53299f[_0x16c6('0x42')]),_0x34eb39);if(_0x2224fa[_0x16c6('0x40')]['filter']){_0x4b2b28[_0x16c6('0x4b')]=_[_0x16c6('0x4c')](_0x4b2b28[_0x16c6('0x4b')],{'$or':_['map'](_0x34eb39,function(_0x558add){if(_0x558add[_0x16c6('0x3e')]!==_0x16c6('0x4d')){var _0x183901={};_0x183901[_0x558add[_0x16c6('0x3a')]]={'$like':'%'+_0x2224fa[_0x16c6('0x40')][_0x16c6('0x4e')]+'%'};return _0x183901;}})});}_0x4b2b28=_['merge']({},_0x4b2b28,_0x2224fa['options']);var _0x48dad6={'where':_0x4b2b28[_0x16c6('0x4b')]};return db[_0x16c6('0x3c')][_0x16c6('0x31')](_0x48dad6)[_0x16c6('0x24')](function(_0x3e841f){_0x5d2b14[_0x16c6('0x31')]=_0x3e841f;if(_0x2224fa[_0x16c6('0x40')]['includeAll']){_0x4b2b28[_0x16c6('0x4f')]=[{'all':!![]}];}return db[_0x16c6('0x3c')]['findAll'](_0x4b2b28);})[_0x16c6('0x24')](function(_0x50e4f5){_0x5d2b14[_0x16c6('0x50')]=_0x50e4f5;return _0x5d2b14;})[_0x16c6('0x24')](respondWithFilteredResult(_0x3ca1ee,_0x4b2b28))[_0x16c6('0x2d')](handleError(_0x3ca1ee,null));};exports[_0x16c6('0x51')]=function(_0x1688aa,_0x47547e){var _0x1dfb25={'raw':![],'where':{'id':_0x1688aa[_0x16c6('0x52')]['id']}},_0x13a2c6={};_0x13a2c6['model']=_['keys'](db['SugarcrmConfiguration'][_0x16c6('0x53')]);_0x13a2c6['query']=_[_0x16c6('0x41')](_0x1688aa['query']);_0x13a2c6[_0x16c6('0x42')]=_[_0x16c6('0x43')](_0x13a2c6[_0x16c6('0x44')],_0x13a2c6[_0x16c6('0x40')]);_0x1dfb25['attributes']=_['intersection'](_0x13a2c6['model'],qs[_0x16c6('0x46')](_0x1688aa[_0x16c6('0x40')]['fields']));_0x1dfb25[_0x16c6('0x45')]=_0x1dfb25[_0x16c6('0x45')][_0x16c6('0x47')]?_0x1dfb25[_0x16c6('0x45')]:_0x13a2c6['model'];if(_0x1688aa[_0x16c6('0x40')][_0x16c6('0x54')]){_0x1dfb25[_0x16c6('0x4f')]=[{'all':!![]}];}_0x1dfb25=_[_0x16c6('0x4c')]({},_0x1dfb25,_0x1688aa[_0x16c6('0x55')]);return db[_0x16c6('0x3c')][_0x16c6('0x56')](_0x1dfb25)[_0x16c6('0x24')](handleEntityNotFound(_0x47547e,null))[_0x16c6('0x24')](respondWithResult(_0x47547e,null))[_0x16c6('0x2d')](handleError(_0x47547e,null));};exports[_0x16c6('0x57')]=function(_0x732ce7,_0x2dbca3){return db[_0x16c6('0x3c')][_0x16c6('0x57')](_0x732ce7['body'],{})[_0x16c6('0x24')](respondWithResult(_0x2dbca3,0xc9))[_0x16c6('0x2d')](handleError(_0x2dbca3,null));};exports[_0x16c6('0x58')]=function(_0x359c1f,_0x5c42fc){if(_0x359c1f[_0x16c6('0x59')]['id']){delete _0x359c1f[_0x16c6('0x59')]['id'];}return db[_0x16c6('0x3c')]['find']({'where':{'id':_0x359c1f['params']['id']}})['then'](handleEntityNotFound(_0x5c42fc,null))[_0x16c6('0x24')](saveUpdates(_0x359c1f[_0x16c6('0x59')],null))[_0x16c6('0x24')](respondWithResult(_0x5c42fc,null))['catch'](handleError(_0x5c42fc,null));};exports['destroy']=function(_0x338d27,_0x120f33){return db['SugarcrmConfiguration'][_0x16c6('0x56')]({'where':{'id':_0x338d27[_0x16c6('0x52')]['id']}})[_0x16c6('0x24')](handleEntityNotFound(_0x120f33,null))[_0x16c6('0x24')](removeEntity(_0x120f33,null))['catch'](handleError(_0x120f33,null));};exports[_0x16c6('0x5a')]=function(_0x2dde89,_0x7c1950,_0x51e4cc){var _0x1a10cb={};var _0x35b226={};var _0x5b5404;var _0x523e03;return db[_0x16c6('0x3c')][_0x16c6('0x5b')]({'where':{'id':_0x2dde89[_0x16c6('0x52')]['id']}})[_0x16c6('0x24')](handleEntityNotFound(_0x7c1950,null))[_0x16c6('0x24')](function(_0x396e8e){if(_0x396e8e){_0x5b5404=_0x396e8e;_0x35b226[_0x16c6('0x44')]=_['keys'](db['SugarcrmField'][_0x16c6('0x53')]);_0x35b226[_0x16c6('0x40')]=_['keys'](_0x2dde89['query']);_0x35b226['filters']=_[_0x16c6('0x43')](_0x35b226['model'],_0x35b226['query']);_0x1a10cb[_0x16c6('0x45')]=_['intersection'](_0x35b226[_0x16c6('0x44')],qs[_0x16c6('0x46')](_0x2dde89[_0x16c6('0x40')][_0x16c6('0x46')]));_0x1a10cb[_0x16c6('0x45')]=_0x1a10cb['attributes'][_0x16c6('0x47')]?_0x1a10cb[_0x16c6('0x45')]:_0x35b226[_0x16c6('0x44')];_0x1a10cb[_0x16c6('0x5c')]=qs['sort'](_0x2dde89[_0x16c6('0x40')][_0x16c6('0x49')]);_0x1a10cb['where']=qs[_0x16c6('0x42')](_[_0x16c6('0x4a')](_0x2dde89[_0x16c6('0x40')],_0x35b226[_0x16c6('0x42')]));if(_0x2dde89[_0x16c6('0x40')][_0x16c6('0x4e')]){_0x1a10cb[_0x16c6('0x4b')]=_[_0x16c6('0x4c')](_0x1a10cb[_0x16c6('0x4b')],{'$or':_[_0x16c6('0x3b')](_0x1a10cb[_0x16c6('0x45')],function(_0x4bd487){var _0x5c9a8d={};_0x5c9a8d[_0x4bd487]={'$like':'%'+_0x2dde89[_0x16c6('0x40')][_0x16c6('0x4e')]+'%'};return _0x5c9a8d;})});}_0x1a10cb=_[_0x16c6('0x4c')]({},_0x1a10cb,_0x2dde89[_0x16c6('0x55')]);return _0x5b5404['getFields'](_0x1a10cb);}})[_0x16c6('0x24')](function(_0x2c0fd7){if(_0x2c0fd7){_0x523e03=_0x2c0fd7[_0x16c6('0x47')];if(!_0x2dde89['query'][_0x16c6('0x48')]('nolimit')){_0x1a10cb['limit']=qs['limit'](_0x2dde89[_0x16c6('0x40')][_0x16c6('0x33')]);_0x1a10cb['offset']=qs['offset'](_0x2dde89[_0x16c6('0x40')]['offset']);}return _0x5b5404[_0x16c6('0x5a')](_0x1a10cb);}})[_0x16c6('0x24')](function(_0x3f928b){if(_0x3f928b){return _0x3f928b?{'count':_0x523e03,'rows':_0x3f928b}:null;}})[_0x16c6('0x24')](respondWithResult(_0x7c1950,null))[_0x16c6('0x2d')](handleError(_0x7c1950,null));};exports['getSubjects']=function(_0x59c1e2,_0x52f521,_0x1670d0){var _0x119dd8={};var _0x28c436={};var _0x351055;var _0x4a4157;return db[_0x16c6('0x3c')][_0x16c6('0x5b')]({'where':{'id':_0x59c1e2[_0x16c6('0x52')]['id']}})[_0x16c6('0x24')](handleEntityNotFound(_0x52f521,null))[_0x16c6('0x24')](function(_0xc37f8d){if(_0xc37f8d){_0x351055=_0xc37f8d;_0x28c436[_0x16c6('0x44')]=_[_0x16c6('0x41')](db[_0x16c6('0x5d')][_0x16c6('0x53')]);_0x28c436[_0x16c6('0x40')]=_['keys'](_0x59c1e2[_0x16c6('0x40')]);_0x28c436['filters']=_[_0x16c6('0x43')](_0x28c436[_0x16c6('0x44')],_0x28c436['query']);_0x119dd8[_0x16c6('0x45')]=_[_0x16c6('0x43')](_0x28c436[_0x16c6('0x44')],qs[_0x16c6('0x46')](_0x59c1e2[_0x16c6('0x40')][_0x16c6('0x46')]));_0x119dd8[_0x16c6('0x45')]=_0x119dd8[_0x16c6('0x45')]['length']?_0x119dd8[_0x16c6('0x45')]:_0x28c436[_0x16c6('0x44')];_0x119dd8['order']=qs['sort'](_0x59c1e2['query'][_0x16c6('0x49')]);_0x119dd8[_0x16c6('0x4b')]=qs['filters'](_[_0x16c6('0x4a')](_0x59c1e2[_0x16c6('0x40')],_0x28c436[_0x16c6('0x42')]));if(_0x59c1e2[_0x16c6('0x40')][_0x16c6('0x4e')]){_0x119dd8['where']=_[_0x16c6('0x4c')](_0x119dd8['where'],{'$or':_[_0x16c6('0x3b')](_0x119dd8[_0x16c6('0x45')],function(_0x54ac78){var _0x587a81={};_0x587a81[_0x54ac78]={'$like':'%'+_0x59c1e2[_0x16c6('0x40')][_0x16c6('0x4e')]+'%'};return _0x587a81;})});}_0x119dd8=_[_0x16c6('0x4c')]({},_0x119dd8,_0x59c1e2['options']);return _0x351055[_0x16c6('0x5e')](_0x119dd8);}})[_0x16c6('0x24')](function(_0x36e817){if(_0x36e817){_0x4a4157=_0x36e817[_0x16c6('0x47')];if(!_0x59c1e2[_0x16c6('0x40')][_0x16c6('0x48')](_0x16c6('0x5f'))){_0x119dd8[_0x16c6('0x33')]=qs[_0x16c6('0x33')](_0x59c1e2['query']['limit']);_0x119dd8['offset']=qs[_0x16c6('0x32')](_0x59c1e2[_0x16c6('0x40')][_0x16c6('0x32')]);}return _0x351055[_0x16c6('0x5e')](_0x119dd8);}})['then'](function(_0x3f7644){if(_0x3f7644){return _0x3f7644?{'count':_0x4a4157,'rows':_0x3f7644}:null;}})[_0x16c6('0x24')](respondWithResult(_0x52f521,null))[_0x16c6('0x2d')](handleError(_0x52f521,null));};exports[_0x16c6('0x60')]=function(_0x541b6d,_0x519fdc,_0x5f48a8){var _0x359237={};var _0x528043={};var _0x501ccb;var _0x4966d1;return db[_0x16c6('0x3c')][_0x16c6('0x5b')]({'where':{'id':_0x541b6d[_0x16c6('0x52')]['id']}})[_0x16c6('0x24')](handleEntityNotFound(_0x519fdc,null))[_0x16c6('0x24')](function(_0x25e018){if(_0x25e018){_0x501ccb=_0x25e018;_0x528043['model']=_[_0x16c6('0x41')](db[_0x16c6('0x5d')][_0x16c6('0x53')]);_0x528043[_0x16c6('0x40')]=_[_0x16c6('0x41')](_0x541b6d['query']);_0x528043[_0x16c6('0x42')]=_[_0x16c6('0x43')](_0x528043[_0x16c6('0x44')],_0x528043[_0x16c6('0x40')]);_0x359237['attributes']=_[_0x16c6('0x43')](_0x528043[_0x16c6('0x44')],qs[_0x16c6('0x46')](_0x541b6d[_0x16c6('0x40')]['fields']));_0x359237[_0x16c6('0x45')]=_0x359237[_0x16c6('0x45')][_0x16c6('0x47')]?_0x359237['attributes']:_0x528043[_0x16c6('0x44')];_0x359237[_0x16c6('0x5c')]=qs[_0x16c6('0x49')](_0x541b6d[_0x16c6('0x40')][_0x16c6('0x49')]);_0x359237[_0x16c6('0x4b')]=qs['filters'](_[_0x16c6('0x4a')](_0x541b6d[_0x16c6('0x40')],_0x528043[_0x16c6('0x42')]));if(_0x541b6d['query'][_0x16c6('0x4e')]){_0x359237[_0x16c6('0x4b')]=_[_0x16c6('0x4c')](_0x359237['where'],{'$or':_[_0x16c6('0x3b')](_0x359237[_0x16c6('0x45')],function(_0x5df55d){var _0x244630={};_0x244630[_0x5df55d]={'$like':'%'+_0x541b6d[_0x16c6('0x40')][_0x16c6('0x4e')]+'%'};return _0x244630;})});}_0x359237=_[_0x16c6('0x4c')]({},_0x359237,_0x541b6d['options']);return _0x501ccb[_0x16c6('0x60')](_0x359237);}})[_0x16c6('0x24')](function(_0x1e2a88){if(_0x1e2a88){_0x4966d1=_0x1e2a88[_0x16c6('0x47')];if(!_0x541b6d[_0x16c6('0x40')][_0x16c6('0x48')]('nolimit')){_0x359237[_0x16c6('0x33')]=qs[_0x16c6('0x33')](_0x541b6d[_0x16c6('0x40')]['limit']);_0x359237['offset']=qs[_0x16c6('0x32')](_0x541b6d[_0x16c6('0x40')][_0x16c6('0x32')]);}return _0x501ccb[_0x16c6('0x60')](_0x359237);}})[_0x16c6('0x24')](function(_0x4655b7){if(_0x4655b7){return _0x4655b7?{'count':_0x4966d1,'rows':_0x4655b7}:null;}})['then'](respondWithResult(_0x519fdc,null))[_0x16c6('0x2d')](handleError(_0x519fdc,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index e70c464..35c0e35 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 _0xd459=['moment','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api'];(function(_0x59ee28,_0x175ae9){var _0x531440=function(_0x66b140){while(--_0x66b140){_0x59ee28['push'](_0x59ee28['shift']());}};_0x531440(++_0x175ae9);}(_0xd459,0x1d6));var _0x9d45=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xd459[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x9d45('0x0'));var util=require('util');var logger=require(_0x9d45('0x1'))(_0x9d45('0x2'));var moment=require(_0x9d45('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9d45('0x4'));var config=require(_0x9d45('0x5'));var attributes=require(_0x9d45('0x6'));module[_0x9d45('0x7')]=function(_0x47d0df,_0x412939){return _0x47d0df[_0x9d45('0x8')](_0x9d45('0x9'),attributes,{'tableName':_0x9d45('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2667=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','lodash','util','moment','request-promise','path','rimraf'];(function(_0x2f98dd,_0xce76a7){var _0x2c7df0=function(_0x2194e4){while(--_0x2194e4){_0x2f98dd['push'](_0x2f98dd['shift']());}};_0x2c7df0(++_0xce76a7);}(_0x2667,0x1c6));var _0x7266=function(_0x281744,_0x51ac61){_0x281744=_0x281744-0x0;var _0x566393=_0x2667[_0x281744];return _0x566393;};'use strict';var _=require(_0x7266('0x0'));var util=require(_0x7266('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7266('0x2'));var BPromise=require('bluebird');var rp=require(_0x7266('0x3'));var fs=require('fs');var path=require(_0x7266('0x4'));var rimraf=require(_0x7266('0x5'));var config=require(_0x7266('0x6'));var attributes=require(_0x7266('0x7'));module[_0x7266('0x8')]=function(_0xd5bc54,_0x18820f){return _0xd5bc54[_0x7266('0x9')]('SugarcrmConfiguration',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 275b22c..7231aba 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 _0xc248=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x14a862,_0x2b559d){var _0x245eb5=function(_0x6e014c){while(--_0x6e014c){_0x14a862['push'](_0x14a862['shift']());}};_0x245eb5(++_0x2b559d);}(_0xc248,0xaf));var _0x8c24=function(_0x29af67,_0x428ed5){_0x29af67=_0x29af67-0x0;var _0x42e723=_0xc248[_0x29af67];return _0x42e723;};'use strict';var _=require(_0x8c24('0x0'));var util=require(_0x8c24('0x1'));var moment=require(_0x8c24('0x2'));var BPromise=require(_0x8c24('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c24('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c24('0x5'))(_0x8c24('0x6'));var config=require(_0x8c24('0x7'));var jayson=require(_0x8c24('0x8'));var client=jayson[_0x8c24('0x9')][_0x8c24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x309c8a,_0x1d7b7f,_0x19479a){return new BPromise(function(_0x2924ce,_0x1663f7){return client[_0x8c24('0xb')](_0x309c8a,_0x19479a)['then'](function(_0x502b5d){logger[_0x8c24('0xc')](_0x8c24('0xd'),_0x1d7b7f,_0x8c24('0xe'));logger[_0x8c24('0xf')](_0x8c24('0x10'),_0x1d7b7f,_0x8c24('0xe'),JSON['stringify'](_0x502b5d));if(_0x502b5d[_0x8c24('0x11')]){if(_0x502b5d[_0x8c24('0x11')][_0x8c24('0x12')]===0x1f4){logger[_0x8c24('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1d7b7f,_0x502b5d[_0x8c24('0x11')][_0x8c24('0x13')]);return _0x1663f7(_0x502b5d['error'][_0x8c24('0x13')]);}logger[_0x8c24('0x11')](_0x8c24('0xd'),_0x1d7b7f,_0x502b5d[_0x8c24('0x11')]['message']);return _0x2924ce(_0x502b5d['error'][_0x8c24('0x13')]);}else{logger['info'](_0x8c24('0xd'),_0x1d7b7f,_0x8c24('0xe'));_0x2924ce(_0x502b5d[_0x8c24('0x14')][_0x8c24('0x13')]);}})['catch'](function(_0x52af87){logger[_0x8c24('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1d7b7f,_0x52af87);_0x1663f7(_0x52af87);});});} \ No newline at end of file +var _0xbdaf=['then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xbdaf,0xe6));var _0xfbda=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xbdaf[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xfbda('0x0'));var util=require('util');var moment=require(_0xfbda('0x1'));var BPromise=require('bluebird');var rs=require(_0xfbda('0x2'));var fs=require('fs');var Redis=require(_0xfbda('0x3'));var db=require(_0xfbda('0x4'))['db'];var utils=require(_0xfbda('0x5'));var logger=require('../../config/logger')(_0xfbda('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfbda('0x7')][_0xfbda('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53ac85,_0x474273,_0x5224f5){return new BPromise(function(_0x175563,_0x528656){return client[_0xfbda('0x9')](_0x53ac85,_0x5224f5)[_0xfbda('0xa')](function(_0x452d79){logger['info'](_0xfbda('0xb'),_0x474273,_0xfbda('0xc'));logger[_0xfbda('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x474273,'request\x20sent',JSON['stringify'](_0x452d79));if(_0x452d79[_0xfbda('0xe')]){if(_0x452d79[_0xfbda('0xe')][_0xfbda('0xf')]===0x1f4){logger['error'](_0xfbda('0xb'),_0x474273,_0x452d79[_0xfbda('0xe')][_0xfbda('0x10')]);return _0x528656(_0x452d79['error'][_0xfbda('0x10')]);}logger[_0xfbda('0xe')](_0xfbda('0xb'),_0x474273,_0x452d79[_0xfbda('0xe')]['message']);return _0x175563(_0x452d79[_0xfbda('0xe')][_0xfbda('0x10')]);}else{logger[_0xfbda('0x11')](_0xfbda('0xb'),_0x474273,'request\x20sent');_0x175563(_0x452d79[_0xfbda('0x12')][_0xfbda('0x10')]);}})[_0xfbda('0x13')](function(_0x58f22b){logger[_0xfbda('0xe')](_0xfbda('0xb'),_0x474273,_0x58f22b);_0x528656(_0x58f22b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 279fb6c..b819f3a 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 _0x536a=['put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x3dfb56,_0xfe844d){var _0x5e6e1b=function(_0x4e002f){while(--_0x4e002f){_0x3dfb56['push'](_0x3dfb56['shift']());}};_0x5e6e1b(++_0xfe844d);}(_0x536a,0x136));var _0xa536=function(_0x3a267e,_0x2111e5){_0x3a267e=_0x3a267e-0x0;var _0x5b2063=_0x536a[_0x3a267e];return _0x5b2063;};'use strict';var multer=require(_0xa536('0x0'));var util=require('util');var path=require(_0xa536('0x1'));var timeout=require(_0xa536('0x2'));var express=require(_0xa536('0x3'));var router=express['Router']();var auth=require(_0xa536('0x4'));var interaction=require(_0xa536('0x5'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0xa536('0x6')](),controller[_0xa536('0x7')]);router[_0xa536('0x8')](_0xa536('0x9'),auth[_0xa536('0x6')](),controller[_0xa536('0xa')]);router[_0xa536('0xb')]('/',auth[_0xa536('0x6')](),controller[_0xa536('0xc')]);router[_0xa536('0xd')](_0xa536('0x9'),auth[_0xa536('0x6')](),controller[_0xa536('0xe')]);router[_0xa536('0xf')](_0xa536('0x9'),auth[_0xa536('0x6')](),controller[_0xa536('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2bba=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x453369,_0x5079f6){var _0x518648=function(_0xc76b8d){while(--_0xc76b8d){_0x453369['push'](_0x453369['shift']());}};_0x518648(++_0x5079f6);}(_0x2bba,0x99));var _0xa2bb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2bba[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xa2bb('0x0'));var util=require(_0xa2bb('0x1'));var path=require(_0xa2bb('0x2'));var timeout=require(_0xa2bb('0x3'));var express=require(_0xa2bb('0x4'));var router=express[_0xa2bb('0x5')]();var auth=require(_0xa2bb('0x6'));var interaction=require(_0xa2bb('0x7'));var config=require(_0xa2bb('0x8'));var controller=require('./intSugarcrmField.controller');router[_0xa2bb('0x9')]('/',auth[_0xa2bb('0xa')](),controller[_0xa2bb('0xb')]);router[_0xa2bb('0x9')](_0xa2bb('0xc'),auth[_0xa2bb('0xa')](),controller[_0xa2bb('0xd')]);router[_0xa2bb('0xe')]('/',auth[_0xa2bb('0xa')](),controller[_0xa2bb('0xf')]);router['put'](_0xa2bb('0xc'),auth[_0xa2bb('0xa')](),controller[_0xa2bb('0x10')]);router[_0xa2bb('0x11')](_0xa2bb('0xc'),auth[_0xa2bb('0xa')](),controller[_0xa2bb('0x12')]);module[_0xa2bb('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ffd9594..6ddeec9 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 _0x2a76=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2a76,0xde));var _0x62a7=function(_0x1bcaf8,_0x5414c1){_0x1bcaf8=_0x1bcaf8-0x0;var _0x1c660c=_0x2a76[_0x1bcaf8];return _0x1c660c;};'use strict';var Sequelize=require(_0x62a7('0x0'));module[_0x62a7('0x1')]={'type':{'type':Sequelize[_0x62a7('0x2')](_0x62a7('0x3'),_0x62a7('0x4'),_0x62a7('0x5'),_0x62a7('0x6')),'defaultValue':_0x62a7('0x3')},'content':{'type':Sequelize[_0x62a7('0x7')]},'key':{'type':Sequelize[_0x62a7('0x7')]},'keyType':{'type':Sequelize[_0x62a7('0x2')]('string',_0x62a7('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x62a7('0x7')]},'idField':{'type':Sequelize[_0x62a7('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x62a7('0x7')]}}; \ No newline at end of file +var _0x9224=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x20ae3b,_0x23a21c){var _0x391475=function(_0x590776){while(--_0x590776){_0x20ae3b['push'](_0x20ae3b['shift']());}};_0x391475(++_0x23a21c);}(_0x9224,0xa3));var _0x4922=function(_0xb4387d,_0x567061){_0xb4387d=_0xb4387d-0x0;var _0x40c549=_0x9224[_0xb4387d];return _0x40c549;};'use strict';var Sequelize=require('sequelize');module[_0x4922('0x0')]={'type':{'type':Sequelize[_0x4922('0x1')](_0x4922('0x2'),_0x4922('0x3'),_0x4922('0x4'),_0x4922('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4922('0x1')]('string',_0x4922('0x3'),_0x4922('0x4'))},'keyContent':{'type':Sequelize[_0x4922('0x6')]},'idField':{'type':Sequelize[_0x4922('0x6')]},'nameField':{'type':Sequelize[_0x4922('0x6')]},'customField':{'type':Sequelize[_0x4922('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 5e8b93f..b6a1429 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 _0x988e=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','SugarcrmField','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x988e,0x11f));var _0xe988=function(_0x3ee7de,_0x14c627){_0x3ee7de=_0x3ee7de-0x0;var _0x4f6303=_0x988e[_0x3ee7de];return _0x4f6303;};'use strict';var pdf=require(_0xe988('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe988('0x1'));var zipdir=require(_0xe988('0x2'));var jsonpatch=require(_0xe988('0x3'));var rp=require(_0xe988('0x4'));var moment=require(_0xe988('0x5'));var BPromise=require(_0xe988('0x6'));var Mustache=require(_0xe988('0x7'));var util=require(_0xe988('0x8'));var path=require(_0xe988('0x9'));var sox=require(_0xe988('0xa'));var csv=require(_0xe988('0xb'));var ejs=require(_0xe988('0xc'));var fs=require('fs');var _=require(_0xe988('0xd'));var squel=require(_0xe988('0xe'));var crypto=require(_0xe988('0xf'));var jsforce=require(_0xe988('0x10'));var deskjs=require(_0xe988('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe988('0x12'));var Redis=require(_0xe988('0x13'));var authService=require(_0xe988('0x14'));var qs=require(_0xe988('0x15'));var as=require(_0xe988('0x16'));var hardwareService=require(_0xe988('0x17'));var logger=require('../../config/logger')(_0xe988('0x18'));var utils=require('../../config/utils');var config=require(_0xe988('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58f1b7,_0x81876){_0x81876=_0x81876||0xcc;return function(_0x1dbc02){if(_0x1dbc02){return _0x58f1b7[_0xe988('0x1a')](_0x81876);}return _0x58f1b7[_0xe988('0x1b')](_0x81876)[_0xe988('0x1c')]();};}function respondWithResult(_0x38e3d7,_0x3ef049){_0x3ef049=_0x3ef049||0xc8;return function(_0x560ddd){if(_0x560ddd){return _0x38e3d7[_0xe988('0x1b')](_0x3ef049)[_0xe988('0x1d')](_0x560ddd);}};}function respondWithFilteredResult(_0x460f14,_0x5ee682){return function(_0x3a319b){if(_0x3a319b){var _0xf6618e=_0x3a319b['count'],_0x122a21=_0x5ee682[_0xe988('0x1e')],_0x33b762=_0x5ee682[_0xe988('0x1e')]+_0x5ee682[_0xe988('0x1f')],_0x1d4fbe;if(_0x33b762>=_0xf6618e){_0x33b762=_0xf6618e;_0x1d4fbe=0xc8;}else{_0x1d4fbe=0xce;}_0x460f14[_0xe988('0x1b')](_0x1d4fbe);return _0x460f14[_0xe988('0x20')]('Content-Range',_0x122a21+'-'+_0x33b762+'/'+_0xf6618e)[_0xe988('0x1d')](_0x3a319b);}return null;};}function patchUpdates(_0x2c9d9a){return function(_0x3acf4c){try{jsonpatch[_0xe988('0x21')](_0x3acf4c,_0x2c9d9a,!![]);}catch(_0x1e047a){return BPromise[_0xe988('0x22')](_0x1e047a);}return _0x3acf4c['save']();};}function saveUpdates(_0x137e5,_0x1ae206){return function(_0x3fe5bf){if(_0x3fe5bf){return _0x3fe5bf[_0xe988('0x23')](_0x137e5)[_0xe988('0x24')](function(_0x230d01){return _0x230d01;});}return null;};}function removeEntity(_0x5b0842,_0x56271e){return function(_0x4a5846){if(_0x4a5846){return _0x4a5846['destroy']()[_0xe988('0x24')](function(){_0x5b0842[_0xe988('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x79e2bd,_0x16dcc8){return function(_0x19f1c7){if(!_0x19f1c7){_0x79e2bd['sendStatus'](0x194);}return _0x19f1c7;};}function handleError(_0x1bc384,_0x4dcc7d){_0x4dcc7d=_0x4dcc7d||0x1f4;return function(_0xf0a3c1){logger[_0xe988('0x25')](_0xf0a3c1[_0xe988('0x26')]);if(_0xf0a3c1[_0xe988('0x27')]){delete _0xf0a3c1[_0xe988('0x27')];}_0x1bc384[_0xe988('0x1b')](_0x4dcc7d)[_0xe988('0x28')](_0xf0a3c1);};}exports[_0xe988('0x29')]=function(_0x47b9a5,_0x4eacfb){var _0x17f6f4={},_0x3da5a4={},_0x1911d4={'count':0x0,'rows':[]};var _0x327a7d=_[_0xe988('0x2a')](db['SugarcrmField']['rawAttributes'],function(_0x1707b2){return{'name':_0x1707b2[_0xe988('0x2b')],'type':_0x1707b2[_0xe988('0x2c')][_0xe988('0x2d')]};});_0x3da5a4[_0xe988('0x2e')]=_[_0xe988('0x2a')](_0x327a7d,_0xe988('0x27'));_0x3da5a4[_0xe988('0x2f')]=_[_0xe988('0x30')](_0x47b9a5[_0xe988('0x2f')]);_0x3da5a4[_0xe988('0x31')]=_['intersection'](_0x3da5a4[_0xe988('0x2e')],_0x3da5a4['query']);_0x17f6f4['attributes']=_[_0xe988('0x32')](_0x3da5a4['model'],qs[_0xe988('0x33')](_0x47b9a5[_0xe988('0x2f')][_0xe988('0x33')]));_0x17f6f4[_0xe988('0x34')]=_0x17f6f4[_0xe988('0x34')]['length']?_0x17f6f4[_0xe988('0x34')]:_0x3da5a4[_0xe988('0x2e')];if(!_0x47b9a5[_0xe988('0x2f')][_0xe988('0x35')]('nolimit')){_0x17f6f4[_0xe988('0x1f')]=qs[_0xe988('0x1f')](_0x47b9a5['query'][_0xe988('0x1f')]);_0x17f6f4['offset']=qs[_0xe988('0x1e')](_0x47b9a5[_0xe988('0x2f')][_0xe988('0x1e')]);}_0x17f6f4['order']=qs[_0xe988('0x36')](_0x47b9a5['query'][_0xe988('0x36')]);_0x17f6f4['where']=qs[_0xe988('0x31')](_['pick'](_0x47b9a5[_0xe988('0x2f')],_0x3da5a4['filters']),_0x327a7d);if(_0x47b9a5[_0xe988('0x2f')][_0xe988('0x37')]){_0x17f6f4[_0xe988('0x38')]=_[_0xe988('0x39')](_0x17f6f4[_0xe988('0x38')],{'$or':_[_0xe988('0x2a')](_0x327a7d,function(_0x15089f){if(_0x15089f['type']!==_0xe988('0x3a')){var _0x50f087={};_0x50f087[_0x15089f['name']]={'$like':'%'+_0x47b9a5[_0xe988('0x2f')][_0xe988('0x37')]+'%'};return _0x50f087;}})});}_0x17f6f4=_['merge']({},_0x17f6f4,_0x47b9a5[_0xe988('0x3b')]);var _0x52c14e={'where':_0x17f6f4['where']};return db[_0xe988('0x3c')][_0xe988('0x3d')](_0x52c14e)[_0xe988('0x24')](function(_0x1074ce){_0x1911d4['count']=_0x1074ce;if(_0x47b9a5[_0xe988('0x2f')]['includeAll']){_0x17f6f4[_0xe988('0x3e')]=[{'all':!![]}];}return db['SugarcrmField'][_0xe988('0x3f')](_0x17f6f4);})[_0xe988('0x24')](function(_0x305076){_0x1911d4[_0xe988('0x40')]=_0x305076;return _0x1911d4;})[_0xe988('0x24')](respondWithFilteredResult(_0x4eacfb,_0x17f6f4))[_0xe988('0x41')](handleError(_0x4eacfb,null));};exports[_0xe988('0x42')]=function(_0x332c23,_0x484559){var _0x2a3916={'raw':!![],'where':{'id':_0x332c23[_0xe988('0x43')]['id']}},_0xea42be={};_0xea42be['model']=_['keys'](db[_0xe988('0x3c')][_0xe988('0x44')]);_0xea42be['query']=_[_0xe988('0x30')](_0x332c23[_0xe988('0x2f')]);_0xea42be[_0xe988('0x31')]=_['intersection'](_0xea42be[_0xe988('0x2e')],_0xea42be[_0xe988('0x2f')]);_0x2a3916[_0xe988('0x34')]=_[_0xe988('0x32')](_0xea42be[_0xe988('0x2e')],qs[_0xe988('0x33')](_0x332c23[_0xe988('0x2f')]['fields']));_0x2a3916[_0xe988('0x34')]=_0x2a3916['attributes'][_0xe988('0x45')]?_0x2a3916[_0xe988('0x34')]:_0xea42be[_0xe988('0x2e')];if(_0x332c23['query'][_0xe988('0x46')]){_0x2a3916[_0xe988('0x3e')]=[{'all':!![]}];}_0x2a3916=_[_0xe988('0x39')]({},_0x2a3916,_0x332c23[_0xe988('0x3b')]);return db[_0xe988('0x3c')][_0xe988('0x47')](_0x2a3916)[_0xe988('0x24')](handleEntityNotFound(_0x484559,null))['then'](respondWithResult(_0x484559,null))['catch'](handleError(_0x484559,null));};exports[_0xe988('0x48')]=function(_0x1774b4,_0x152ba1){return db[_0xe988('0x3c')][_0xe988('0x48')](_0x1774b4['body'],{})[_0xe988('0x24')](respondWithResult(_0x152ba1,0xc9))[_0xe988('0x41')](handleError(_0x152ba1,null));};exports[_0xe988('0x23')]=function(_0x57cebf,_0x5569fd){if(_0x57cebf[_0xe988('0x49')]['id']){delete _0x57cebf[_0xe988('0x49')]['id'];}return db[_0xe988('0x3c')][_0xe988('0x47')]({'where':{'id':_0x57cebf[_0xe988('0x43')]['id']}})['then'](handleEntityNotFound(_0x5569fd,null))[_0xe988('0x24')](saveUpdates(_0x57cebf['body'],null))['then'](respondWithResult(_0x5569fd,null))[_0xe988('0x41')](handleError(_0x5569fd,null));};exports['destroy']=function(_0x354f55,_0x3d2844){return db[_0xe988('0x3c')][_0xe988('0x47')]({'where':{'id':_0x354f55['params']['id']}})[_0xe988('0x24')](handleEntityNotFound(_0x3d2844,null))[_0xe988('0x24')](removeEntity(_0x3d2844,null))[_0xe988('0x41')](handleError(_0x3d2844,null));}; \ No newline at end of file +var _0x544d=['mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','stack','name','SugarcrmField','type','key','model','map','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','rawAttributes','options','find','create','body','update','params','destroy','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x544d,0x88));var _0xd544=function(_0x4755ae,_0x3fb2cb){_0x4755ae=_0x4755ae-0x0;var _0x48810d=_0x544d[_0x4755ae];return _0x48810d;};'use strict';var pdf=require(_0xd544('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd544('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd544('0x2'));var rp=require(_0xd544('0x3'));var moment=require(_0xd544('0x4'));var BPromise=require(_0xd544('0x5'));var Mustache=require(_0xd544('0x6'));var util=require('util');var path=require(_0xd544('0x7'));var sox=require('sox');var csv=require(_0xd544('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd544('0x9'));var squel=require(_0xd544('0xa'));var crypto=require(_0xd544('0xb'));var jsforce=require(_0xd544('0xc'));var deskjs=require(_0xd544('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd544('0xe'));var Papa=require(_0xd544('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd544('0x10'));var as=require(_0xd544('0x11'));var hardwareService=require(_0xd544('0x12'));var logger=require(_0xd544('0x13'))(_0xd544('0x14'));var utils=require(_0xd544('0x15'));var config=require('../../config/environment');var db=require(_0xd544('0x16'))['db'];function respondWithStatusCode(_0x41bba0,_0x46e150){_0x46e150=_0x46e150||0xcc;return function(_0x4ed914){if(_0x4ed914){return _0x41bba0[_0xd544('0x17')](_0x46e150);}return _0x41bba0['status'](_0x46e150)[_0xd544('0x18')]();};}function respondWithResult(_0x3c8745,_0x8d3b81){_0x8d3b81=_0x8d3b81||0xc8;return function(_0xd8f80e){if(_0xd8f80e){return _0x3c8745[_0xd544('0x19')](_0x8d3b81)[_0xd544('0x1a')](_0xd8f80e);}};}function respondWithFilteredResult(_0x3f2b84,_0x26343a){return function(_0x310b67){if(_0x310b67){var _0x21a499=_0x310b67[_0xd544('0x1b')],_0x1a8eb6=_0x26343a[_0xd544('0x1c')],_0x45bfed=_0x26343a['offset']+_0x26343a[_0xd544('0x1d')],_0x21a083;if(_0x45bfed>=_0x21a499){_0x45bfed=_0x21a499;_0x21a083=0xc8;}else{_0x21a083=0xce;}_0x3f2b84[_0xd544('0x19')](_0x21a083);return _0x3f2b84[_0xd544('0x1e')](_0xd544('0x1f'),_0x1a8eb6+'-'+_0x45bfed+'/'+_0x21a499)[_0xd544('0x1a')](_0x310b67);}return null;};}function patchUpdates(_0x3c7755){return function(_0x2017a6){try{jsonpatch[_0xd544('0x20')](_0x2017a6,_0x3c7755,!![]);}catch(_0x3d2340){return BPromise[_0xd544('0x21')](_0x3d2340);}return _0x2017a6[_0xd544('0x22')]();};}function saveUpdates(_0x1daead,_0x5edf10){return function(_0x242d15){if(_0x242d15){return _0x242d15['update'](_0x1daead)[_0xd544('0x23')](function(_0x262a9f){return _0x262a9f;});}return null;};}function removeEntity(_0x1dff8d,_0xad960e){return function(_0x138a84){if(_0x138a84){return _0x138a84['destroy']()[_0xd544('0x23')](function(){_0x1dff8d['status'](0xcc)[_0xd544('0x18')]();});}};}function handleEntityNotFound(_0x39b33a,_0x3d7625){return function(_0x1f93d7){if(!_0x1f93d7){_0x39b33a[_0xd544('0x17')](0x194);}return _0x1f93d7;};}function handleError(_0x302ecd,_0x4e8c39){_0x4e8c39=_0x4e8c39||0x1f4;return function(_0x2fa146){logger['error'](_0x2fa146[_0xd544('0x24')]);if(_0x2fa146[_0xd544('0x25')]){delete _0x2fa146[_0xd544('0x25')];}_0x302ecd[_0xd544('0x19')](_0x4e8c39)['send'](_0x2fa146);};}exports['index']=function(_0x3654c6,_0x4d17c1){var _0x19f328={},_0x517309={},_0x1fdca9={'count':0x0,'rows':[]};var _0x108ded=_['map'](db[_0xd544('0x26')]['rawAttributes'],function(_0x2275ee){return{'name':_0x2275ee['fieldName'],'type':_0x2275ee[_0xd544('0x27')][_0xd544('0x28')]};});_0x517309[_0xd544('0x29')]=_[_0xd544('0x2a')](_0x108ded,_0xd544('0x25'));_0x517309[_0xd544('0x2b')]=_['keys'](_0x3654c6[_0xd544('0x2b')]);_0x517309['filters']=_[_0xd544('0x2c')](_0x517309[_0xd544('0x29')],_0x517309[_0xd544('0x2b')]);_0x19f328[_0xd544('0x2d')]=_['intersection'](_0x517309[_0xd544('0x29')],qs[_0xd544('0x2e')](_0x3654c6[_0xd544('0x2b')]['fields']));_0x19f328[_0xd544('0x2d')]=_0x19f328[_0xd544('0x2d')][_0xd544('0x2f')]?_0x19f328[_0xd544('0x2d')]:_0x517309['model'];if(!_0x3654c6[_0xd544('0x2b')]['hasOwnProperty'](_0xd544('0x30'))){_0x19f328[_0xd544('0x1d')]=qs[_0xd544('0x1d')](_0x3654c6[_0xd544('0x2b')][_0xd544('0x1d')]);_0x19f328[_0xd544('0x1c')]=qs[_0xd544('0x1c')](_0x3654c6[_0xd544('0x2b')]['offset']);}_0x19f328[_0xd544('0x31')]=qs[_0xd544('0x32')](_0x3654c6[_0xd544('0x2b')]['sort']);_0x19f328[_0xd544('0x33')]=qs[_0xd544('0x34')](_[_0xd544('0x35')](_0x3654c6[_0xd544('0x2b')],_0x517309[_0xd544('0x34')]),_0x108ded);if(_0x3654c6[_0xd544('0x2b')][_0xd544('0x36')]){_0x19f328[_0xd544('0x33')]=_[_0xd544('0x37')](_0x19f328[_0xd544('0x33')],{'$or':_[_0xd544('0x2a')](_0x108ded,function(_0x361543){if(_0x361543[_0xd544('0x27')]!==_0xd544('0x38')){var _0x1ff60c={};_0x1ff60c[_0x361543['name']]={'$like':'%'+_0x3654c6[_0xd544('0x2b')][_0xd544('0x36')]+'%'};return _0x1ff60c;}})});}_0x19f328=_[_0xd544('0x37')]({},_0x19f328,_0x3654c6['options']);var _0x355ce8={'where':_0x19f328[_0xd544('0x33')]};return db['SugarcrmField'][_0xd544('0x1b')](_0x355ce8)[_0xd544('0x23')](function(_0x28401d){_0x1fdca9['count']=_0x28401d;if(_0x3654c6[_0xd544('0x2b')][_0xd544('0x39')]){_0x19f328[_0xd544('0x3a')]=[{'all':!![]}];}return db[_0xd544('0x26')][_0xd544('0x3b')](_0x19f328);})[_0xd544('0x23')](function(_0x1a949b){_0x1fdca9['rows']=_0x1a949b;return _0x1fdca9;})[_0xd544('0x23')](respondWithFilteredResult(_0x4d17c1,_0x19f328))[_0xd544('0x3c')](handleError(_0x4d17c1,null));};exports[_0xd544('0x3d')]=function(_0x4ba436,_0x199a0b){var _0x497b0d={'raw':!![],'where':{'id':_0x4ba436['params']['id']}},_0x4fcd0a={};_0x4fcd0a[_0xd544('0x29')]=_[_0xd544('0x3e')](db[_0xd544('0x26')][_0xd544('0x3f')]);_0x4fcd0a[_0xd544('0x2b')]=_[_0xd544('0x3e')](_0x4ba436[_0xd544('0x2b')]);_0x4fcd0a['filters']=_['intersection'](_0x4fcd0a[_0xd544('0x29')],_0x4fcd0a[_0xd544('0x2b')]);_0x497b0d['attributes']=_[_0xd544('0x2c')](_0x4fcd0a[_0xd544('0x29')],qs[_0xd544('0x2e')](_0x4ba436[_0xd544('0x2b')][_0xd544('0x2e')]));_0x497b0d['attributes']=_0x497b0d[_0xd544('0x2d')][_0xd544('0x2f')]?_0x497b0d[_0xd544('0x2d')]:_0x4fcd0a['model'];if(_0x4ba436[_0xd544('0x2b')][_0xd544('0x39')]){_0x497b0d[_0xd544('0x3a')]=[{'all':!![]}];}_0x497b0d=_[_0xd544('0x37')]({},_0x497b0d,_0x4ba436[_0xd544('0x40')]);return db[_0xd544('0x26')][_0xd544('0x41')](_0x497b0d)[_0xd544('0x23')](handleEntityNotFound(_0x199a0b,null))['then'](respondWithResult(_0x199a0b,null))[_0xd544('0x3c')](handleError(_0x199a0b,null));};exports[_0xd544('0x42')]=function(_0x3a72ce,_0x5bbb79){return db['SugarcrmField']['create'](_0x3a72ce[_0xd544('0x43')],{})['then'](respondWithResult(_0x5bbb79,0xc9))[_0xd544('0x3c')](handleError(_0x5bbb79,null));};exports[_0xd544('0x44')]=function(_0x420962,_0x45b5b1){if(_0x420962[_0xd544('0x43')]['id']){delete _0x420962[_0xd544('0x43')]['id'];}return db[_0xd544('0x26')][_0xd544('0x41')]({'where':{'id':_0x420962[_0xd544('0x45')]['id']}})['then'](handleEntityNotFound(_0x45b5b1,null))[_0xd544('0x23')](saveUpdates(_0x420962[_0xd544('0x43')],null))[_0xd544('0x23')](respondWithResult(_0x45b5b1,null))[_0xd544('0x3c')](handleError(_0x45b5b1,null));};exports[_0xd544('0x46')]=function(_0x233ceb,_0x284ab3){return db['SugarcrmField'][_0xd544('0x41')]({'where':{'id':_0x233ceb[_0xd544('0x45')]['id']}})[_0xd544('0x23')](handleEntityNotFound(_0x284ab3,null))['then'](removeEntity(_0x284ab3,null))[_0xd544('0x3c')](handleError(_0x284ab3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 606d89a..c56f962 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 _0x06d0=['idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','SugarcrmField','int_sugarcrm_fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x06d0,0x11a));var _0x006d=function(_0x1e7b2c,_0x2625aa){_0x1e7b2c=_0x1e7b2c-0x0;var _0x53838a=_0x06d0[_0x1e7b2c];return _0x53838a;};'use strict';var _=require(_0x006d('0x0'));var util=require(_0x006d('0x1'));var logger=require('../../config/logger')(_0x006d('0x2'));var moment=require(_0x006d('0x3'));var BPromise=require(_0x006d('0x4'));var rp=require(_0x006d('0x5'));var fs=require('fs');var path=require(_0x006d('0x6'));var rimraf=require(_0x006d('0x7'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0x006d('0x8')]=function(_0x57d8f5,_0x475153){return _0x57d8f5[_0x006d('0x9')](_0x006d('0xa'),attributes,{'tableName':_0x006d('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x006d('0xc'),_0x006d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7cc4=['exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x7cc4,0xd6));var _0x47cc=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x7cc4[_0x17406e];return _0x2bfc5a;};'use strict';var _=require(_0x47cc('0x0'));var util=require(_0x47cc('0x1'));var logger=require(_0x47cc('0x2'))(_0x47cc('0x3'));var moment=require('moment');var BPromise=require(_0x47cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47cc('0x5'));var rimraf=require('rimraf');var config=require(_0x47cc('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0x47cc('0x7')]=function(_0x494e06,_0x2b2497){return _0x494e06[_0x47cc('0x8')](_0x47cc('0x9'),attributes,{'tableName':_0x47cc('0xa'),'paranoid':![],'indexes':[{'name':_0x47cc('0xb'),'fields':['idField',_0x47cc('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 9566202..aca1ab4 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 _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(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x0b0e,0x187));var _0xe0b0=function(_0x413aac,_0x5e2430){_0x413aac=_0x413aac-0x0;var _0x569b11=_0x0b0e[_0x413aac];return _0x569b11;};'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 +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0xc377c1,_0x1063d1){var _0x45d950=function(_0x19b126){while(--_0x19b126){_0xc377c1['push'](_0xc377c1['shift']());}};_0x45d950(++_0x1063d1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29a6be,_0x28ad94){_0x29a6be=_0x29a6be-0x0;var _0x1d542d=_0x5f2f[_0x29a6be];return _0x1d542d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 39b08c1..a819245 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 _0x1293=['Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x3199bb,_0x579f3d){var _0x2efc56=function(_0xee0826){while(--_0xee0826){_0x3199bb['push'](_0x3199bb['shift']());}};_0x2efc56(++_0x579f3d);}(_0x1293,0x154));var _0x3129=function(_0x2a9bf5,_0x117cd7){_0x2a9bf5=_0x2a9bf5-0x0;var _0x55f308=_0x1293[_0x2a9bf5];return _0x55f308;};'use strict';var multer=require(_0x3129('0x0'));var util=require(_0x3129('0x1'));var path=require(_0x3129('0x2'));var timeout=require(_0x3129('0x3'));var express=require(_0x3129('0x4'));var router=express[_0x3129('0x5')]();var auth=require(_0x3129('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3129('0x7'));var controller=require(_0x3129('0x8'));router[_0x3129('0x9')]('/',auth[_0x3129('0xa')](),controller[_0x3129('0xb')]);router[_0x3129('0x9')](_0x3129('0xc'),auth[_0x3129('0xa')](),controller[_0x3129('0xd')]);router['get'](_0x3129('0xe'),auth[_0x3129('0xa')](),controller['getConfigurations']);router[_0x3129('0x9')](_0x3129('0xf'),auth[_0x3129('0xa')](),controller[_0x3129('0x10')]);router[_0x3129('0x11')]('/',auth['isAuthenticated'](),controller[_0x3129('0x12')]);router[_0x3129('0x11')](_0x3129('0xe'),auth[_0x3129('0xa')](),controller[_0x3129('0x13')]);router[_0x3129('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3129('0x15')]);router['delete'](_0x3129('0xc'),auth[_0x3129('0xa')](),controller['destroy']);module[_0x3129('0x16')]=router; \ No newline at end of file +var _0x5090=['multer','util','path','express','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','/:id','destroy'];(function(_0x3f1861,_0x7b4285){var _0x7ca70a=function(_0x119b09){while(--_0x119b09){_0x3f1861['push'](_0x3f1861['shift']());}};_0x7ca70a(++_0x7b4285);}(_0x5090,0x1ce));var _0x0509=function(_0x195f5e,_0x3dfac4){_0x195f5e=_0x195f5e-0x0;var _0x36267c=_0x5090[_0x195f5e];return _0x36267c;};'use strict';var multer=require(_0x0509('0x0'));var util=require(_0x0509('0x1'));var path=require(_0x0509('0x2'));var timeout=require('connect-timeout');var express=require(_0x0509('0x3'));var router=express['Router']();var auth=require(_0x0509('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0509('0x5'));var controller=require(_0x0509('0x6'));router[_0x0509('0x7')]('/',auth[_0x0509('0x8')](),controller[_0x0509('0x9')]);router[_0x0509('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0509('0xa')]);router[_0x0509('0x7')](_0x0509('0xb'),auth[_0x0509('0x8')](),controller[_0x0509('0xc')]);router[_0x0509('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0509('0xd')]);router['post']('/',auth[_0x0509('0x8')](),controller[_0x0509('0xe')]);router[_0x0509('0xf')](_0x0509('0xb'),auth[_0x0509('0x8')](),controller[_0x0509('0x10')]);router[_0x0509('0x11')]('/:id',auth[_0x0509('0x8')](),controller[_0x0509('0x12')]);router[_0x0509('0x13')](_0x0509('0x14'),auth['isAuthenticated'](),controller[_0x0509('0x15')]);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 025c1e8..1f2efc8 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 _0x4326=['STRING','HelpDesk','sequelize','exports'];(function(_0x15d98f,_0x97fcf6){var _0x2e7f60=function(_0x2f996e){while(--_0x2f996e){_0x15d98f['push'](_0x15d98f['shift']());}};_0x2e7f60(++_0x97fcf6);}(_0x4326,0x1b2));var _0x6432=function(_0x4aa261,_0x213b4b){_0x4aa261=_0x4aa261-0x0;var _0x40f8ad=_0x4326[_0x4aa261];return _0x40f8ad;};'use strict';var Sequelize=require(_0x6432('0x0'));module[_0x6432('0x1')]={'name':{'type':Sequelize[_0x6432('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6432('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6432('0x2')],'allowNull':![],'defaultValue':_0x6432('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6432('0x2')]},'accessKey':{'type':Sequelize[_0x6432('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdaa9=['sequelize','exports','STRING','HelpDesk'];(function(_0x3ab293,_0x2d162a){var _0x2744ec=function(_0x57d471){while(--_0x57d471){_0x3ab293['push'](_0x3ab293['shift']());}};_0x2744ec(++_0x2d162a);}(_0xdaa9,0x1c8));var _0x9daa=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xdaa9[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x9daa('0x0'));module[_0x9daa('0x1')]={'name':{'type':Sequelize[_0x9daa('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9daa('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9daa('0x2')],'allowNull':![],'defaultValue':_0x9daa('0x3')},'remoteUri':{'type':Sequelize[_0x9daa('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9daa('0x2')]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index cba5a2a..7322d02 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 _0x9ff5=['to-csv','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','offset','limit','set','json','apply','reject','save','destroy','send','VtigerAccount','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','count','include','findAll','rows','show','params','fields','length','includeAll','find','create','update','body','getConfigurations','VtigerConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','md5','username','description','moduleName','remoteUri','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','token','success','describe','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklistValues','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9ff5,0x74));var _0x59ff=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x9ff5[_0x30c649];return _0x3edfb9;};'use strict';var pdf=require(_0x59ff('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x59ff('0x1'));var zipdir=require(_0x59ff('0x2'));var jsonpatch=require(_0x59ff('0x3'));var rp=require(_0x59ff('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x59ff('0x5'));var util=require(_0x59ff('0x6'));var path=require('path');var sox=require(_0x59ff('0x7'));var csv=require(_0x59ff('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x59ff('0x9'));var crypto=require('crypto');var jsforce=require(_0x59ff('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x59ff('0xb'));var Redis=require(_0x59ff('0xc'));var authService=require(_0x59ff('0xd'));var qs=require(_0x59ff('0xe'));var as=require(_0x59ff('0xf'));var hardwareService=require(_0x59ff('0x10'));var logger=require('../../config/logger')(_0x59ff('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x59ff('0x12'))['db'];var integrations=require(_0x59ff('0x13'));var jayson=require(_0x59ff('0x14'));var client=jayson[_0x59ff('0x15')][_0x59ff('0x16')]({'port':0x232a});function checkPasswordPattern(_0x3734e0,_0xb179a5,_0xe1380e){if(_0xe1380e){var _0x4d8db4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d8db4[_0x59ff('0x17')](_0xb179a5)){return _0x3734e0;}else{throw new db[(_0x59ff('0x18'))][(_0x59ff('0x19'))](_0x59ff('0x1a'));}}else{return _0x3734e0;}}function respondWithRpcPromise(_0x53b847,_0x398263,_0x59e88a,_0x1afaf6){return new BPromise(function(_0x2288ac,_0x3f6d55){var _0x3fbf1e=_0x1afaf6||client;return _0x3fbf1e[_0x59ff('0x1b')](_0x53b847,_0x59e88a)[_0x59ff('0x1c')](function(_0xaa9d1c){logger['info'](_0x59ff('0x1d'),_0x398263,_0x59ff('0x1e'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x398263,_0x59ff('0x1e'),JSON[_0x59ff('0x1f')](_0xaa9d1c));if(_0xaa9d1c[_0x59ff('0x20')]){if(_0xaa9d1c[_0x59ff('0x20')][_0x59ff('0x21')]===0x1f4){logger[_0x59ff('0x20')]('VtigerAccount,\x20%s,\x20%s',_0x398263,_0xaa9d1c['error'][_0x59ff('0x22')]);return _0x3f6d55(_0xaa9d1c['error'][_0x59ff('0x22')]);}logger[_0x59ff('0x20')](_0x59ff('0x1d'),_0x398263,_0xaa9d1c[_0x59ff('0x20')][_0x59ff('0x22')]);return _0x2288ac(_0xaa9d1c[_0x59ff('0x20')][_0x59ff('0x22')]);}else{logger[_0x59ff('0x23')](_0x59ff('0x1d'),_0x398263,'request\x20sent');_0x2288ac(_0xaa9d1c[_0x59ff('0x24')][_0x59ff('0x22')]);}})[_0x59ff('0x25')](function(_0x4c7b37){logger[_0x59ff('0x20')](_0x59ff('0x1d'),_0x398263,_0x4c7b37);_0x3f6d55(_0x4c7b37);});});}function respondWithStatusCode(_0x2f8d1c,_0x55d09d){_0x55d09d=_0x55d09d||0xcc;return function(_0x2512dc){if(_0x2512dc){return _0x2f8d1c[_0x59ff('0x26')](_0x55d09d);}return _0x2f8d1c[_0x59ff('0x27')](_0x55d09d)['end']();};}function respondWithResult(_0x1e6fbb,_0x209c0d){_0x209c0d=_0x209c0d||0xc8;return function(_0x1fde06){if(_0x1fde06){return _0x1e6fbb[_0x59ff('0x27')](_0x209c0d)['json'](_0x1fde06);}};}function respondWithFilteredResult(_0x2050f5,_0x4202ae){return function(_0x3fdcc6){if(_0x3fdcc6){var _0x1ba1bd=_0x3fdcc6['count'],_0xa20713=_0x4202ae[_0x59ff('0x28')],_0x24c4c9=_0x4202ae[_0x59ff('0x28')]+_0x4202ae[_0x59ff('0x29')],_0x253ef3;if(_0x24c4c9>=_0x1ba1bd){_0x24c4c9=_0x1ba1bd;_0x253ef3=0xc8;}else{_0x253ef3=0xce;}_0x2050f5['status'](_0x253ef3);return _0x2050f5[_0x59ff('0x2a')]('Content-Range',_0xa20713+'-'+_0x24c4c9+'/'+_0x1ba1bd)[_0x59ff('0x2b')](_0x3fdcc6);}return null;};}function patchUpdates(_0x433561){return function(_0x205c83){try{jsonpatch[_0x59ff('0x2c')](_0x205c83,_0x433561,!![]);}catch(_0x464861){return BPromise[_0x59ff('0x2d')](_0x464861);}return _0x205c83[_0x59ff('0x2e')]();};}function saveUpdates(_0x9e9e30,_0x61417a){return function(_0x165508){if(_0x165508){return _0x165508['update'](_0x9e9e30)[_0x59ff('0x1c')](function(_0x51d978){return _0x51d978;});}return null;};}function removeEntity(_0x45220c,_0x594aeb){return function(_0x4b1b24){if(_0x4b1b24){return _0x4b1b24[_0x59ff('0x2f')]()[_0x59ff('0x1c')](function(){_0x45220c[_0x59ff('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8a1c89,_0x247efd){return function(_0x43d151){if(!_0x43d151){_0x8a1c89[_0x59ff('0x26')](0x194);}return _0x43d151;};}function handleError(_0x31b12f,_0x140278){_0x140278=_0x140278||0x1f4;return function(_0x427689){logger[_0x59ff('0x20')](_0x427689['stack']);if(_0x427689['name']){delete _0x427689['name'];}_0x31b12f[_0x59ff('0x27')](_0x140278)[_0x59ff('0x30')](_0x427689);};}exports['index']=function(_0x2ac165,_0x4b5c01){var _0x2241d6={},_0x3ecc1b={},_0x1a21ad={'count':0x0,'rows':[]};var _0x56f3cd=_['map'](db[_0x59ff('0x31')][_0x59ff('0x32')],function(_0x4ce1a7){return{'name':_0x4ce1a7[_0x59ff('0x33')],'type':_0x4ce1a7[_0x59ff('0x34')]['key']};});_0x3ecc1b[_0x59ff('0x35')]=_['map'](_0x56f3cd,_0x59ff('0x36'));_0x3ecc1b[_0x59ff('0x37')]=_[_0x59ff('0x38')](_0x2ac165['query']);_0x3ecc1b[_0x59ff('0x39')]=_[_0x59ff('0x3a')](_0x3ecc1b[_0x59ff('0x35')],_0x3ecc1b[_0x59ff('0x37')]);_0x2241d6[_0x59ff('0x3b')]=_['intersection'](_0x3ecc1b['model'],qs['fields'](_0x2ac165[_0x59ff('0x37')]['fields']));_0x2241d6[_0x59ff('0x3b')]=_0x2241d6[_0x59ff('0x3b')]['length']?_0x2241d6[_0x59ff('0x3b')]:_0x3ecc1b[_0x59ff('0x35')];if(!_0x2ac165[_0x59ff('0x37')]['hasOwnProperty'](_0x59ff('0x3c'))){_0x2241d6[_0x59ff('0x29')]=qs['limit'](_0x2ac165[_0x59ff('0x37')][_0x59ff('0x29')]);_0x2241d6[_0x59ff('0x28')]=qs[_0x59ff('0x28')](_0x2ac165[_0x59ff('0x37')][_0x59ff('0x28')]);}_0x2241d6[_0x59ff('0x3d')]=qs[_0x59ff('0x3e')](_0x2ac165['query']['sort']);_0x2241d6[_0x59ff('0x3f')]=qs[_0x59ff('0x39')](_[_0x59ff('0x40')](_0x2ac165[_0x59ff('0x37')],_0x3ecc1b[_0x59ff('0x39')]),_0x56f3cd);if(_0x2ac165[_0x59ff('0x37')][_0x59ff('0x41')]){_0x2241d6[_0x59ff('0x3f')]=_[_0x59ff('0x42')](_0x2241d6['where'],{'$or':_[_0x59ff('0x43')](_0x56f3cd,function(_0x119bed){if(_0x119bed['type']!==_0x59ff('0x44')){var _0x1362ab={};_0x1362ab[_0x119bed[_0x59ff('0x36')]]={'$like':'%'+_0x2ac165[_0x59ff('0x37')][_0x59ff('0x41')]+'%'};return _0x1362ab;}})});}_0x2241d6=_[_0x59ff('0x42')]({},_0x2241d6,_0x2ac165[_0x59ff('0x45')]);var _0x16305f={'where':_0x2241d6['where']};return db['VtigerAccount'][_0x59ff('0x46')](_0x16305f)[_0x59ff('0x1c')](function(_0x2bcbbd){_0x1a21ad[_0x59ff('0x46')]=_0x2bcbbd;if(_0x2ac165[_0x59ff('0x37')]['includeAll']){_0x2241d6[_0x59ff('0x47')]=[{'all':!![]}];}return db['VtigerAccount'][_0x59ff('0x48')](_0x2241d6);})[_0x59ff('0x1c')](function(_0x159f73){_0x1a21ad[_0x59ff('0x49')]=_0x159f73;return _0x1a21ad;})[_0x59ff('0x1c')](respondWithFilteredResult(_0x4b5c01,_0x2241d6))[_0x59ff('0x25')](handleError(_0x4b5c01,null));};exports[_0x59ff('0x4a')]=function(_0x13fcaf,_0x1eac6d){var _0x2df971={'raw':![],'where':{'id':_0x13fcaf[_0x59ff('0x4b')]['id']}},_0x2c1b3b={};_0x2c1b3b['model']=_[_0x59ff('0x38')](db[_0x59ff('0x31')][_0x59ff('0x32')]);_0x2c1b3b[_0x59ff('0x37')]=_[_0x59ff('0x38')](_0x13fcaf[_0x59ff('0x37')]);_0x2c1b3b[_0x59ff('0x39')]=_['intersection'](_0x2c1b3b[_0x59ff('0x35')],_0x2c1b3b['query']);_0x2df971[_0x59ff('0x3b')]=_['intersection'](_0x2c1b3b['model'],qs[_0x59ff('0x4c')](_0x13fcaf['query'][_0x59ff('0x4c')]));_0x2df971[_0x59ff('0x3b')]=_0x2df971['attributes'][_0x59ff('0x4d')]?_0x2df971['attributes']:_0x2c1b3b[_0x59ff('0x35')];if(_0x13fcaf[_0x59ff('0x37')][_0x59ff('0x4e')]){_0x2df971[_0x59ff('0x47')]=[{'all':!![]}];}_0x2df971=_[_0x59ff('0x42')]({},_0x2df971,_0x13fcaf[_0x59ff('0x45')]);return db[_0x59ff('0x31')][_0x59ff('0x4f')](_0x2df971)[_0x59ff('0x1c')](handleEntityNotFound(_0x1eac6d,null))[_0x59ff('0x1c')](respondWithResult(_0x1eac6d,null))['catch'](handleError(_0x1eac6d,null));};exports['create']=function(_0x2e415d,_0x386709){return db[_0x59ff('0x31')][_0x59ff('0x50')](_0x2e415d['body'],{})['then'](respondWithResult(_0x386709,0xc9))[_0x59ff('0x25')](handleError(_0x386709,null));};exports[_0x59ff('0x51')]=function(_0xb4def0,_0x29871e){if(_0xb4def0[_0x59ff('0x52')]['id']){delete _0xb4def0[_0x59ff('0x52')]['id'];}return db[_0x59ff('0x31')][_0x59ff('0x4f')]({'where':{'id':_0xb4def0[_0x59ff('0x4b')]['id']}})[_0x59ff('0x1c')](handleEntityNotFound(_0x29871e,null))[_0x59ff('0x1c')](saveUpdates(_0xb4def0[_0x59ff('0x52')],null))[_0x59ff('0x1c')](respondWithResult(_0x29871e,null))[_0x59ff('0x25')](handleError(_0x29871e,null));};exports[_0x59ff('0x2f')]=function(_0x4b6045,_0x1b1f0a){return db[_0x59ff('0x31')][_0x59ff('0x4f')]({'where':{'id':_0x4b6045['params']['id']}})[_0x59ff('0x1c')](handleEntityNotFound(_0x1b1f0a,null))[_0x59ff('0x1c')](removeEntity(_0x1b1f0a,null))[_0x59ff('0x25')](handleError(_0x1b1f0a,null));};exports[_0x59ff('0x53')]=function(_0x4df759,_0x3dfcd3,_0xb50d45){var _0x21f62b={};var _0x47a538={};var _0x2b64af;var _0x399a11;return db[_0x59ff('0x31')]['findOne']({'where':{'id':_0x4df759[_0x59ff('0x4b')]['id']}})[_0x59ff('0x1c')](handleEntityNotFound(_0x3dfcd3,null))[_0x59ff('0x1c')](function(_0x2d5969){if(_0x2d5969){_0x2b64af=_0x2d5969;_0x47a538['model']=_[_0x59ff('0x38')](db[_0x59ff('0x54')][_0x59ff('0x32')]);_0x47a538[_0x59ff('0x37')]=_['keys'](_0x4df759[_0x59ff('0x37')]);_0x47a538[_0x59ff('0x39')]=_[_0x59ff('0x3a')](_0x47a538[_0x59ff('0x35')],_0x47a538[_0x59ff('0x37')]);_0x21f62b[_0x59ff('0x3b')]=_[_0x59ff('0x3a')](_0x47a538[_0x59ff('0x35')],qs[_0x59ff('0x4c')](_0x4df759[_0x59ff('0x37')][_0x59ff('0x4c')]));_0x21f62b[_0x59ff('0x3b')]=_0x21f62b[_0x59ff('0x3b')][_0x59ff('0x4d')]?_0x21f62b[_0x59ff('0x3b')]:_0x47a538['model'];_0x21f62b[_0x59ff('0x3d')]=qs[_0x59ff('0x3e')](_0x4df759[_0x59ff('0x37')]['sort']);_0x21f62b['where']=qs[_0x59ff('0x39')](_[_0x59ff('0x40')](_0x4df759[_0x59ff('0x37')],_0x47a538[_0x59ff('0x39')]));if(_0x4df759[_0x59ff('0x37')][_0x59ff('0x41')]){_0x21f62b[_0x59ff('0x3f')]=_['merge'](_0x21f62b['where'],{'$or':_[_0x59ff('0x43')](_0x21f62b[_0x59ff('0x3b')],function(_0x1225d3){var _0x417aff={};_0x417aff[_0x1225d3]={'$like':'%'+_0x4df759[_0x59ff('0x37')]['filter']+'%'};return _0x417aff;})});}_0x21f62b=_[_0x59ff('0x42')]({},_0x21f62b,_0x4df759['options']);return _0x2b64af[_0x59ff('0x53')](_0x21f62b);}})['then'](function(_0xc36e17){if(_0xc36e17){_0x399a11=_0xc36e17[_0x59ff('0x4d')];if(!_0x4df759['query']['hasOwnProperty'](_0x59ff('0x3c'))){_0x21f62b[_0x59ff('0x29')]=qs['limit'](_0x4df759[_0x59ff('0x37')][_0x59ff('0x29')]);_0x21f62b[_0x59ff('0x28')]=qs[_0x59ff('0x28')](_0x4df759['query'][_0x59ff('0x28')]);}return _0x2b64af[_0x59ff('0x53')](_0x21f62b);}})[_0x59ff('0x1c')](function(_0x4d1153){if(_0x4d1153){return _0x4d1153?{'count':_0x399a11,'rows':_0x4d1153}:null;}})['then'](respondWithResult(_0x3dfcd3,null))[_0x59ff('0x25')](handleError(_0x3dfcd3,null));};exports[_0x59ff('0x55')]=function(_0x48f4a4,_0x37ad74,_0x3ad5e3){if(_0x48f4a4[_0x59ff('0x52')]['id']){delete _0x48f4a4[_0x59ff('0x52')]['id'];}return db[_0x59ff('0x31')][_0x59ff('0x56')]({'where':{'id':_0x48f4a4[_0x59ff('0x4b')]['id']}})[_0x59ff('0x1c')](handleEntityNotFound(_0x37ad74,null))[_0x59ff('0x1c')](function(_0x48e658){if(_0x48e658){_0x48f4a4[_0x59ff('0x52')][_0x59ff('0x57')]=_0x48e658['id'];_0x48f4a4['body'][_0x59ff('0x58')]=integrations[_0x59ff('0x59')](_0x48f4a4[_0x59ff('0x52')][_0x59ff('0x5a')],_0x48f4a4[_0x59ff('0x52')][_0x59ff('0x34')]);_0x48f4a4[_0x59ff('0x52')]['Descriptions']=integrations[_0x59ff('0x5b')](_0x48f4a4[_0x59ff('0x52')][_0x59ff('0x5a')],_0x48f4a4['body'][_0x59ff('0x34')]);return db[_0x59ff('0x54')][_0x59ff('0x50')](_0x48f4a4[_0x59ff('0x52')],{'include':[{'model':db[_0x59ff('0x5c')],'as':_0x59ff('0x58')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x37ad74,null))[_0x59ff('0x25')](handleError(_0x37ad74,null));};var md5=require(_0x59ff('0x5d'));exports['getFields']=function(_0x2529f2,_0x28d8b9,_0x46ad84){var _0x3af5ce=null;var _0x5f409b=null;var _0x5ba5e0=null;var _0x1d506e=null;var _0x50e4ca='';return db[_0x59ff('0x31')][_0x59ff('0x56')]({'where':{'id':_0x2529f2[_0x59ff('0x4b')]['id']},'attributes':['id',_0x59ff('0x36'),_0x59ff('0x5e'),_0x59ff('0x5f'),_0x59ff('0x60'),_0x59ff('0x61'),'serverUrl','accessKey']})[_0x59ff('0x1c')](handleEntityNotFound(_0x28d8b9,null))[_0x59ff('0x1c')](function(_0x4cc507){if(_0x4cc507){_0x3af5ce=_0x4cc507['username'];_0x5f409b=_0x4cc507['accessKey'];_0x5ba5e0=_0x4cc507['moduleName'];_0x50e4ca=_0x4cc507[_0x59ff('0x61')];var _0x25525b=_0x50e4ca['slice'](-0x1);if(_0x25525b==='/'){_0x50e4ca=_0x50e4ca[_0x59ff('0x62')](0x0,_0x50e4ca[_0x59ff('0x63')](_0x25525b));}_0x1d506e=util[_0x59ff('0x64')](_0x59ff('0x65'),_0x50e4ca);var _0xbde54e={'method':_0x59ff('0x66'),'uri':_0x1d506e,'qs':{'operation':_0x59ff('0x67'),'username':_0x4cc507['username']},'json':!![]};return rp(_0xbde54e);}})['then'](function(_0x36bcee){if(_0x36bcee['success']){var _0x149c57={'method':'POST','uri':_0x1d506e,'form':{'operation':'login','username':_0x3af5ce,'accessKey':md5(_0x36bcee[_0x59ff('0x24')][_0x59ff('0x68')]+_0x5f409b)},'json':!![]};return rp(_0x149c57);}})['then'](function(_0x343104){if(_0x343104[_0x59ff('0x69')]){var _0x63e06b={'method':_0x59ff('0x66'),'uri':_0x1d506e,'qs':{'operation':_0x59ff('0x6a'),'username':_0x3af5ce,'sessionName':_0x343104[_0x59ff('0x24')]['sessionName'],'elementType':_0x5ba5e0},'json':!![]};return rp(_0x63e06b);}})[_0x59ff('0x1c')](function(_0x1fe895){if(_0x1fe895[_0x59ff('0x69')]){var _0x424d55=[_0x59ff('0x6b'),_0x59ff('0x6c'),_0x59ff('0x6d')];_[_0x59ff('0x6e')](_0x1fe895['result'][_0x59ff('0x4c')],function(_0x30e1cf){return _0x424d55[_0x59ff('0x6f')](_0x30e1cf[_0x59ff('0x34')][_0x59ff('0x36')]);});_[_0x59ff('0x6e')](_0x1fe895['result'][_0x59ff('0x4c')],function(_0x56c39f){return _0x56c39f[_0x59ff('0x70')]===_0x59ff('0x71');});return{'count':_0x1fe895[_0x59ff('0x24')][_0x59ff('0x4c')][_0x59ff('0x4d')],'rows':_[_0x59ff('0x43')](_0x1fe895[_0x59ff('0x24')]['fields'],function(_0xfaaa1d){return{'id':_0xfaaa1d[_0x59ff('0x36')],'name':_0xfaaa1d[_0x59ff('0x72')],'custom':_[_0x59ff('0x73')](_0xfaaa1d[_0x59ff('0x36')],_0x59ff('0x74'))?!![]:![],'options':_0xfaaa1d[_0x59ff('0x34')][_0x59ff('0x36')]==='picklist'&&_0xfaaa1d[_0x59ff('0x34')][_0x59ff('0x75')][_0x59ff('0x4d')]>0x0?_[_0x59ff('0x43')](_0xfaaa1d[_0x59ff('0x34')][_0x59ff('0x75')],function(_0x10e3c4){return{'name':_0x10e3c4[_0x59ff('0x72')],'value':_0x10e3c4['value']};}):[]};})};}})[_0x59ff('0x1c')](respondWithResult(_0x28d8b9,null))[_0x59ff('0x25')](function(_0x22376b){console[_0x59ff('0x76')](_0x59ff('0x77')+_0x22376b);var _0x2d9ae3=_0x2529f2[_0x59ff('0x37')][_0x59ff('0x17')]?0x1f4:_0x22376b[_0x59ff('0x78')]||0x1f4;logger[_0x59ff('0x20')](_0x59ff('0x79'),_0x59ff('0x7a'),_0x2d9ae3,JSON[_0x59ff('0x1f')](_0x22376b));delete _0x22376b['name'];if(_0x2d9ae3===0x191){_0x2d9ae3=0x190;}_0x28d8b9[_0x59ff('0x27')](_0x2d9ae3)[_0x59ff('0x30')](_0x2529f2[_0x59ff('0x37')][_0x59ff('0x17')]?{'message':_0x59ff('0x7b'),'statusCode':_0x22376b['statusCode']}:_0x22376b);});}; \ No newline at end of file +var _0x50ae=['login','success','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','length','create','body','find','VtigerConfiguration','nolimit','getConfigurations','addConfiguration','getSubjects','channel','VtigerField','Subjects','Descriptions','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','lastIndexOf','format','GET','POST'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x50ae,0x11a));var _0xe50a=function(_0x67d65a,_0x29ccbe){_0x67d65a=_0x67d65a-0x0;var _0x3f1525=_0x50ae[_0x67d65a];return _0x3f1525;};'use strict';var pdf=require(_0xe50a('0x0'));var emlformat=require(_0xe50a('0x1'));var rimraf=require(_0xe50a('0x2'));var zipdir=require(_0xe50a('0x3'));var jsonpatch=require(_0xe50a('0x4'));var rp=require(_0xe50a('0x5'));var moment=require(_0xe50a('0x6'));var BPromise=require(_0xe50a('0x7'));var Mustache=require(_0xe50a('0x8'));var util=require(_0xe50a('0x9'));var path=require(_0xe50a('0xa'));var sox=require('sox');var csv=require(_0xe50a('0xb'));var ejs=require(_0xe50a('0xc'));var fs=require('fs');var _=require(_0xe50a('0xd'));var squel=require(_0xe50a('0xe'));var crypto=require(_0xe50a('0xf'));var jsforce=require(_0xe50a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe50a('0xb'));var querystring=require('querystring');var Papa=require(_0xe50a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe50a('0x12'));var as=require(_0xe50a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe50a('0x14'));var utils=require(_0xe50a('0x15'));var config=require(_0xe50a('0x16'));var db=require(_0xe50a('0x17'))['db'];var integrations=require(_0xe50a('0x18'));var jayson=require('jayson/promise');var client=jayson[_0xe50a('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x191619,_0x3a2256,_0x4c1eb4){if(_0x4c1eb4){var _0x24a666=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24a666[_0xe50a('0x1a')](_0x3a2256)){return _0x191619;}else{throw new db[(_0xe50a('0x1b'))][(_0xe50a('0x1c'))](_0xe50a('0x1d'));}}else{return _0x191619;}}function respondWithRpcPromise(_0x54c382,_0x2eff04,_0x33fe3e,_0x39f05f){return new BPromise(function(_0x4abd34,_0x304369){var _0x17bc85=_0x39f05f||client;return _0x17bc85[_0xe50a('0x1e')](_0x54c382,_0x33fe3e)['then'](function(_0x33e01d){logger[_0xe50a('0x1f')](_0xe50a('0x20'),_0x2eff04,_0xe50a('0x21'));logger[_0xe50a('0x22')](_0xe50a('0x23'),_0x2eff04,_0xe50a('0x21'),JSON[_0xe50a('0x24')](_0x33e01d));if(_0x33e01d[_0xe50a('0x25')]){if(_0x33e01d[_0xe50a('0x25')][_0xe50a('0x26')]===0x1f4){logger['error'](_0xe50a('0x20'),_0x2eff04,_0x33e01d[_0xe50a('0x25')][_0xe50a('0x27')]);return _0x304369(_0x33e01d[_0xe50a('0x25')][_0xe50a('0x27')]);}logger[_0xe50a('0x25')](_0xe50a('0x20'),_0x2eff04,_0x33e01d[_0xe50a('0x25')]['message']);return _0x4abd34(_0x33e01d[_0xe50a('0x25')]['message']);}else{logger[_0xe50a('0x1f')](_0xe50a('0x20'),_0x2eff04,_0xe50a('0x21'));_0x4abd34(_0x33e01d[_0xe50a('0x28')][_0xe50a('0x27')]);}})[_0xe50a('0x29')](function(_0x51313a){logger[_0xe50a('0x25')](_0xe50a('0x20'),_0x2eff04,_0x51313a);_0x304369(_0x51313a);});});}function respondWithStatusCode(_0x4e24e6,_0x809763){_0x809763=_0x809763||0xcc;return function(_0xc6098c){if(_0xc6098c){return _0x4e24e6['sendStatus'](_0x809763);}return _0x4e24e6[_0xe50a('0x2a')](_0x809763)[_0xe50a('0x2b')]();};}function respondWithResult(_0x26a30e,_0x262284){_0x262284=_0x262284||0xc8;return function(_0x288d26){if(_0x288d26){return _0x26a30e[_0xe50a('0x2a')](_0x262284)[_0xe50a('0x2c')](_0x288d26);}};}function respondWithFilteredResult(_0x2933e5,_0x1256ea){return function(_0x46909b){if(_0x46909b){var _0x267ee3=_0x46909b['count'],_0x93b2ae=_0x1256ea['offset'],_0x24e8f4=_0x1256ea[_0xe50a('0x2d')]+_0x1256ea[_0xe50a('0x2e')],_0x5a74b8;if(_0x24e8f4>=_0x267ee3){_0x24e8f4=_0x267ee3;_0x5a74b8=0xc8;}else{_0x5a74b8=0xce;}_0x2933e5['status'](_0x5a74b8);return _0x2933e5[_0xe50a('0x2f')](_0xe50a('0x30'),_0x93b2ae+'-'+_0x24e8f4+'/'+_0x267ee3)[_0xe50a('0x2c')](_0x46909b);}return null;};}function patchUpdates(_0x37f46f){return function(_0x3da649){try{jsonpatch[_0xe50a('0x31')](_0x3da649,_0x37f46f,!![]);}catch(_0x4c637a){return BPromise[_0xe50a('0x32')](_0x4c637a);}return _0x3da649[_0xe50a('0x33')]();};}function saveUpdates(_0x5e766a,_0x243e16){return function(_0x333fd3){if(_0x333fd3){return _0x333fd3[_0xe50a('0x34')](_0x5e766a)['then'](function(_0x5bc902){return _0x5bc902;});}return null;};}function removeEntity(_0x4f586d,_0x1c8fde){return function(_0x1f16b3){if(_0x1f16b3){return _0x1f16b3[_0xe50a('0x35')]()[_0xe50a('0x36')](function(){_0x4f586d['status'](0xcc)[_0xe50a('0x2b')]();});}};}function handleEntityNotFound(_0x179f95,_0x89b511){return function(_0x3c3bcd){if(!_0x3c3bcd){_0x179f95[_0xe50a('0x37')](0x194);}return _0x3c3bcd;};}function handleError(_0x4b3b7d,_0x3f14d9){_0x3f14d9=_0x3f14d9||0x1f4;return function(_0x3cc7c2){logger['error'](_0x3cc7c2[_0xe50a('0x38')]);if(_0x3cc7c2['name']){delete _0x3cc7c2[_0xe50a('0x39')];}_0x4b3b7d['status'](_0x3f14d9)[_0xe50a('0x3a')](_0x3cc7c2);};}exports['index']=function(_0x3dcd9a,_0x3d9d62){var _0x180b40={},_0x57fc00={},_0x5d2c5a={'count':0x0,'rows':[]};var _0x14adb0=_[_0xe50a('0x3b')](db[_0xe50a('0x3c')][_0xe50a('0x3d')],function(_0x125197){return{'name':_0x125197[_0xe50a('0x3e')],'type':_0x125197[_0xe50a('0x3f')]['key']};});_0x57fc00[_0xe50a('0x40')]=_[_0xe50a('0x3b')](_0x14adb0,_0xe50a('0x39'));_0x57fc00['query']=_[_0xe50a('0x41')](_0x3dcd9a[_0xe50a('0x42')]);_0x57fc00[_0xe50a('0x43')]=_['intersection'](_0x57fc00[_0xe50a('0x40')],_0x57fc00[_0xe50a('0x42')]);_0x180b40[_0xe50a('0x44')]=_[_0xe50a('0x45')](_0x57fc00[_0xe50a('0x40')],qs['fields'](_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x46')]));_0x180b40[_0xe50a('0x44')]=_0x180b40[_0xe50a('0x44')]['length']?_0x180b40[_0xe50a('0x44')]:_0x57fc00['model'];if(!_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x47')]('nolimit')){_0x180b40[_0xe50a('0x2e')]=qs[_0xe50a('0x2e')](_0x3dcd9a['query'][_0xe50a('0x2e')]);_0x180b40['offset']=qs[_0xe50a('0x2d')](_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x2d')]);}_0x180b40[_0xe50a('0x48')]=qs[_0xe50a('0x49')](_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x49')]);_0x180b40[_0xe50a('0x4a')]=qs[_0xe50a('0x43')](_[_0xe50a('0x4b')](_0x3dcd9a['query'],_0x57fc00['filters']),_0x14adb0);if(_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x4c')]){_0x180b40['where']=_[_0xe50a('0x4d')](_0x180b40[_0xe50a('0x4a')],{'$or':_[_0xe50a('0x3b')](_0x14adb0,function(_0x160a62){if(_0x160a62['type']!==_0xe50a('0x4e')){var _0x2f0317={};_0x2f0317[_0x160a62[_0xe50a('0x39')]]={'$like':'%'+_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x4c')]+'%'};return _0x2f0317;}})});}_0x180b40=_[_0xe50a('0x4d')]({},_0x180b40,_0x3dcd9a[_0xe50a('0x4f')]);var _0x3f1d47={'where':_0x180b40[_0xe50a('0x4a')]};return db[_0xe50a('0x3c')][_0xe50a('0x50')](_0x3f1d47)[_0xe50a('0x36')](function(_0x26e498){_0x5d2c5a[_0xe50a('0x50')]=_0x26e498;if(_0x3dcd9a[_0xe50a('0x42')][_0xe50a('0x51')]){_0x180b40['include']=[{'all':!![]}];}return db[_0xe50a('0x3c')][_0xe50a('0x52')](_0x180b40);})[_0xe50a('0x36')](function(_0x410747){_0x5d2c5a[_0xe50a('0x53')]=_0x410747;return _0x5d2c5a;})[_0xe50a('0x36')](respondWithFilteredResult(_0x3d9d62,_0x180b40))[_0xe50a('0x29')](handleError(_0x3d9d62,null));};exports[_0xe50a('0x54')]=function(_0x1fd64c,_0x399177){var _0x2eadc0={'raw':![],'where':{'id':_0x1fd64c[_0xe50a('0x55')]['id']}},_0x2158c1={};_0x2158c1['model']=_[_0xe50a('0x41')](db[_0xe50a('0x3c')]['rawAttributes']);_0x2158c1[_0xe50a('0x42')]=_[_0xe50a('0x41')](_0x1fd64c[_0xe50a('0x42')]);_0x2158c1[_0xe50a('0x43')]=_[_0xe50a('0x45')](_0x2158c1['model'],_0x2158c1[_0xe50a('0x42')]);_0x2eadc0[_0xe50a('0x44')]=_[_0xe50a('0x45')](_0x2158c1['model'],qs[_0xe50a('0x46')](_0x1fd64c[_0xe50a('0x42')]['fields']));_0x2eadc0[_0xe50a('0x44')]=_0x2eadc0[_0xe50a('0x44')][_0xe50a('0x56')]?_0x2eadc0[_0xe50a('0x44')]:_0x2158c1[_0xe50a('0x40')];if(_0x1fd64c[_0xe50a('0x42')][_0xe50a('0x51')]){_0x2eadc0['include']=[{'all':!![]}];}_0x2eadc0=_['merge']({},_0x2eadc0,_0x1fd64c[_0xe50a('0x4f')]);return db[_0xe50a('0x3c')]['find'](_0x2eadc0)[_0xe50a('0x36')](handleEntityNotFound(_0x399177,null))['then'](respondWithResult(_0x399177,null))['catch'](handleError(_0x399177,null));};exports['create']=function(_0x96cb48,_0x2ae5ec){return db[_0xe50a('0x3c')][_0xe50a('0x57')](_0x96cb48['body'],{})['then'](respondWithResult(_0x2ae5ec,0xc9))[_0xe50a('0x29')](handleError(_0x2ae5ec,null));};exports[_0xe50a('0x34')]=function(_0x55ccf6,_0x258134){if(_0x55ccf6[_0xe50a('0x58')]['id']){delete _0x55ccf6[_0xe50a('0x58')]['id'];}return db[_0xe50a('0x3c')]['find']({'where':{'id':_0x55ccf6[_0xe50a('0x55')]['id']}})[_0xe50a('0x36')](handleEntityNotFound(_0x258134,null))['then'](saveUpdates(_0x55ccf6[_0xe50a('0x58')],null))['then'](respondWithResult(_0x258134,null))[_0xe50a('0x29')](handleError(_0x258134,null));};exports[_0xe50a('0x35')]=function(_0x464f1b,_0x9dfb1d){return db[_0xe50a('0x3c')][_0xe50a('0x59')]({'where':{'id':_0x464f1b[_0xe50a('0x55')]['id']}})['then'](handleEntityNotFound(_0x9dfb1d,null))[_0xe50a('0x36')](removeEntity(_0x9dfb1d,null))[_0xe50a('0x29')](handleError(_0x9dfb1d,null));};exports['getConfigurations']=function(_0x1a2975,_0x173303,_0xcdbee5){var _0x396d73={};var _0x5c7618={};var _0x1312b8;var _0x22deb1;return db[_0xe50a('0x3c')]['findOne']({'where':{'id':_0x1a2975[_0xe50a('0x55')]['id']}})[_0xe50a('0x36')](handleEntityNotFound(_0x173303,null))[_0xe50a('0x36')](function(_0x172470){if(_0x172470){_0x1312b8=_0x172470;_0x5c7618[_0xe50a('0x40')]=_[_0xe50a('0x41')](db[_0xe50a('0x5a')][_0xe50a('0x3d')]);_0x5c7618['query']=_[_0xe50a('0x41')](_0x1a2975[_0xe50a('0x42')]);_0x5c7618['filters']=_[_0xe50a('0x45')](_0x5c7618[_0xe50a('0x40')],_0x5c7618['query']);_0x396d73[_0xe50a('0x44')]=_['intersection'](_0x5c7618[_0xe50a('0x40')],qs[_0xe50a('0x46')](_0x1a2975[_0xe50a('0x42')][_0xe50a('0x46')]));_0x396d73[_0xe50a('0x44')]=_0x396d73[_0xe50a('0x44')][_0xe50a('0x56')]?_0x396d73['attributes']:_0x5c7618[_0xe50a('0x40')];_0x396d73['order']=qs[_0xe50a('0x49')](_0x1a2975[_0xe50a('0x42')][_0xe50a('0x49')]);_0x396d73[_0xe50a('0x4a')]=qs['filters'](_[_0xe50a('0x4b')](_0x1a2975[_0xe50a('0x42')],_0x5c7618[_0xe50a('0x43')]));if(_0x1a2975[_0xe50a('0x42')][_0xe50a('0x4c')]){_0x396d73[_0xe50a('0x4a')]=_[_0xe50a('0x4d')](_0x396d73[_0xe50a('0x4a')],{'$or':_['map'](_0x396d73['attributes'],function(_0x595575){var _0xdb467a={};_0xdb467a[_0x595575]={'$like':'%'+_0x1a2975[_0xe50a('0x42')][_0xe50a('0x4c')]+'%'};return _0xdb467a;})});}_0x396d73=_['merge']({},_0x396d73,_0x1a2975[_0xe50a('0x4f')]);return _0x1312b8['getConfigurations'](_0x396d73);}})[_0xe50a('0x36')](function(_0x306766){if(_0x306766){_0x22deb1=_0x306766['length'];if(!_0x1a2975['query'][_0xe50a('0x47')](_0xe50a('0x5b'))){_0x396d73['limit']=qs[_0xe50a('0x2e')](_0x1a2975[_0xe50a('0x42')][_0xe50a('0x2e')]);_0x396d73[_0xe50a('0x2d')]=qs['offset'](_0x1a2975['query'][_0xe50a('0x2d')]);}return _0x1312b8[_0xe50a('0x5c')](_0x396d73);}})[_0xe50a('0x36')](function(_0x550bcc){if(_0x550bcc){return _0x550bcc?{'count':_0x22deb1,'rows':_0x550bcc}:null;}})[_0xe50a('0x36')](respondWithResult(_0x173303,null))[_0xe50a('0x29')](handleError(_0x173303,null));};exports[_0xe50a('0x5d')]=function(_0x210142,_0x20f75e,_0xd0886f){if(_0x210142['body']['id']){delete _0x210142[_0xe50a('0x58')]['id'];}return db[_0xe50a('0x3c')]['findOne']({'where':{'id':_0x210142[_0xe50a('0x55')]['id']}})[_0xe50a('0x36')](handleEntityNotFound(_0x20f75e,null))[_0xe50a('0x36')](function(_0x5d8533){if(_0x5d8533){_0x210142[_0xe50a('0x58')]['AccountId']=_0x5d8533['id'];_0x210142['body']['Subjects']=integrations[_0xe50a('0x5e')](_0x210142[_0xe50a('0x58')]['channel'],_0x210142[_0xe50a('0x58')]['type']);_0x210142['body']['Descriptions']=integrations['getDescriptions'](_0x210142[_0xe50a('0x58')][_0xe50a('0x5f')],_0x210142[_0xe50a('0x58')]['type']);return db[_0xe50a('0x5a')][_0xe50a('0x57')](_0x210142['body'],{'include':[{'model':db[_0xe50a('0x60')],'as':_0xe50a('0x61')},{'model':db[_0xe50a('0x60')],'as':_0xe50a('0x62')}]});}return null;})[_0xe50a('0x36')](respondWithResult(_0x20f75e,null))[_0xe50a('0x29')](handleError(_0x20f75e,null));};var md5=require('md5');exports[_0xe50a('0x63')]=function(_0x453974,_0x51c3c5,_0x55dd5c){var _0x1fb3f6=null;var _0x70b9f1=null;var _0x1af09e=null;var _0x3f1723=null;var _0xb2b98c='';return db[_0xe50a('0x3c')]['findOne']({'where':{'id':_0x453974[_0xe50a('0x55')]['id']},'attributes':['id',_0xe50a('0x39'),'username',_0xe50a('0x64'),_0xe50a('0x65'),_0xe50a('0x66'),_0xe50a('0x67'),_0xe50a('0x68')]})['then'](handleEntityNotFound(_0x51c3c5,null))[_0xe50a('0x36')](function(_0x300b9f){if(_0x300b9f){_0x1fb3f6=_0x300b9f[_0xe50a('0x69')];_0x70b9f1=_0x300b9f['accessKey'];_0x1af09e=_0x300b9f[_0xe50a('0x65')];_0xb2b98c=_0x300b9f['remoteUri'];var _0x3b8ea3=_0xb2b98c[_0xe50a('0x6a')](-0x1);if(_0x3b8ea3==='/'){_0xb2b98c=_0xb2b98c['substring'](0x0,_0xb2b98c[_0xe50a('0x6b')](_0x3b8ea3));}_0x3f1723=util[_0xe50a('0x6c')]('%s/webservice.php',_0xb2b98c);var _0x56b998={'method':_0xe50a('0x6d'),'uri':_0x3f1723,'qs':{'operation':'getchallenge','username':_0x300b9f['username']},'json':!![]};return rp(_0x56b998);}})['then'](function(_0x5d904b){if(_0x5d904b['success']){var _0x56befb={'method':_0xe50a('0x6e'),'uri':_0x3f1723,'form':{'operation':_0xe50a('0x6f'),'username':_0x1fb3f6,'accessKey':md5(_0x5d904b[_0xe50a('0x28')]['token']+_0x70b9f1)},'json':!![]};return rp(_0x56befb);}})['then'](function(_0x55f58f){if(_0x55f58f[_0xe50a('0x70')]){var _0x3a22f2={'method':_0xe50a('0x6d'),'uri':_0x3f1723,'qs':{'operation':_0xe50a('0x71'),'username':_0x1fb3f6,'sessionName':_0x55f58f[_0xe50a('0x28')][_0xe50a('0x72')],'elementType':_0x1af09e},'json':!![]};return rp(_0x3a22f2);}})[_0xe50a('0x36')](function(_0x59a36a){if(_0x59a36a[_0xe50a('0x70')]){var _0x5aa210=[_0xe50a('0x73'),_0xe50a('0x74'),_0xe50a('0x75')];_[_0xe50a('0x76')](_0x59a36a[_0xe50a('0x28')][_0xe50a('0x46')],function(_0x1098a5){return _0x5aa210[_0xe50a('0x77')](_0x1098a5[_0xe50a('0x3f')][_0xe50a('0x39')]);});_[_0xe50a('0x76')](_0x59a36a['result'][_0xe50a('0x46')],function(_0x4667a7){return _0x4667a7[_0xe50a('0x78')]===_0xe50a('0x79');});return{'count':_0x59a36a['result'][_0xe50a('0x46')][_0xe50a('0x56')],'rows':_[_0xe50a('0x3b')](_0x59a36a[_0xe50a('0x28')]['fields'],function(_0x548dce){return{'id':_0x548dce['name'],'name':_0x548dce[_0xe50a('0x7a')],'custom':_[_0xe50a('0x7b')](_0x548dce['name'],_0xe50a('0x7c'))?!![]:![],'options':_0x548dce[_0xe50a('0x3f')][_0xe50a('0x39')]===_0xe50a('0x7d')&&_0x548dce['type'][_0xe50a('0x7e')]['length']>0x0?_[_0xe50a('0x3b')](_0x548dce[_0xe50a('0x3f')]['picklistValues'],function(_0x36d198){return{'name':_0x36d198['label'],'value':_0x36d198['value']};}):[]};})};}})['then'](respondWithResult(_0x51c3c5,null))[_0xe50a('0x29')](function(_0x436261){console[_0xe50a('0x7f')](_0xe50a('0x80')+_0x436261);var _0x120e9a=_0x453974[_0xe50a('0x42')][_0xe50a('0x1a')]?0x1f4:_0x436261['statusCode']||0x1f4;logger[_0xe50a('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xe50a('0x63'),_0x120e9a,JSON[_0xe50a('0x24')](_0x436261));delete _0x436261['name'];if(_0x120e9a===0x191){_0x120e9a=0x190;}_0x51c3c5[_0xe50a('0x2a')](_0x120e9a)[_0xe50a('0x3a')](_0x453974['query']['test']?{'message':_0xe50a('0x81'),'statusCode':_0x436261[_0xe50a('0x82')]}:_0x436261);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 5f3d444..74a4e45 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 _0x8e0e=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0xec9553,_0x4a9a9e){var _0x4f395c=function(_0x3493a6){while(--_0x3493a6){_0xec9553['push'](_0xec9553['shift']());}};_0x4f395c(++_0x4a9a9e);}(_0x8e0e,0x176));var _0xe8e0=function(_0x4b77c1,_0x4c8fdc){_0x4b77c1=_0x4b77c1-0x0;var _0x2a54e6=_0x8e0e[_0x4b77c1];return _0x2a54e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe8e0('0x0'))('api');var moment=require(_0xe8e0('0x1'));var BPromise=require(_0xe8e0('0x2'));var rp=require(_0xe8e0('0x3'));var fs=require('fs');var path=require(_0xe8e0('0x4'));var rimraf=require(_0xe8e0('0x5'));var config=require(_0xe8e0('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xe8e0('0x7'));module[_0xe8e0('0x8')]=function(_0x5cb6ea,_0x184ff8){return _0x5cb6ea[_0xe8e0('0x9')](_0xe8e0('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a79=['int_vtiger_accounts','lodash','util','api','moment','request-promise','path','../../config/environment','./intVtigerAccount.attributes','VtigerAccount'];(function(_0x27a3c5,_0x3823de){var _0x52d7fc=function(_0x56f33e){while(--_0x56f33e){_0x27a3c5['push'](_0x27a3c5['shift']());}};_0x52d7fc(++_0x3823de);}(_0x7a79,0x187));var _0x97a7=function(_0xe24841,_0x2c0f66){_0xe24841=_0xe24841-0x0;var _0x2e41b3=_0x7a79[_0xe24841];return _0x2e41b3;};'use strict';var _=require(_0x97a7('0x0'));var util=require(_0x97a7('0x1'));var logger=require('../../config/logger')(_0x97a7('0x2'));var moment=require(_0x97a7('0x3'));var BPromise=require('bluebird');var rp=require(_0x97a7('0x4'));var fs=require('fs');var path=require(_0x97a7('0x5'));var rimraf=require('rimraf');var config=require(_0x97a7('0x6'));var attributes=require(_0x97a7('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x8ff1e6,_0xc319f3){return _0x8ff1e6['define'](_0x97a7('0x8'),attributes,{'tableName':_0x97a7('0x9'),'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 4032e84..8f6948f 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 _0x06d0=['../../config/environment','jayson/promise','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowVtigerAccount','find','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x37a766,_0x5dcc6a){var _0x54ac43=function(_0x4a56b0){while(--_0x4a56b0){_0x37a766['push'](_0x37a766['shift']());}};_0x54ac43(++_0x5dcc6a);}(_0x06d0,0x15b));var _0x006d=function(_0x44c35e,_0x25a75b){_0x44c35e=_0x44c35e-0x0;var _0x2f91eb=_0x06d0[_0x44c35e];return _0x2f91eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x006d('0x0'));var BPromise=require(_0x006d('0x1'));var rs=require(_0x006d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x006d('0x3'));var logger=require(_0x006d('0x4'))('rpc');var config=require(_0x006d('0x5'));var jayson=require(_0x006d('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5899cf,_0x3db873,_0x2c816c){return new BPromise(function(_0x33a1cd,_0x3da484){return client['request'](_0x5899cf,_0x2c816c)[_0x006d('0x7')](function(_0x38f0f4){logger[_0x006d('0x8')](_0x006d('0x9'),_0x3db873,'request\x20sent');logger[_0x006d('0xa')](_0x006d('0xb'),_0x3db873,_0x006d('0xc'),JSON[_0x006d('0xd')](_0x38f0f4));if(_0x38f0f4[_0x006d('0xe')]){if(_0x38f0f4[_0x006d('0xe')][_0x006d('0xf')]===0x1f4){logger[_0x006d('0xe')](_0x006d('0x9'),_0x3db873,_0x38f0f4[_0x006d('0xe')]['message']);return _0x3da484(_0x38f0f4[_0x006d('0xe')][_0x006d('0x10')]);}logger[_0x006d('0xe')](_0x006d('0x9'),_0x3db873,_0x38f0f4[_0x006d('0xe')][_0x006d('0x10')]);return _0x33a1cd(_0x38f0f4[_0x006d('0xe')][_0x006d('0x10')]);}else{logger[_0x006d('0x8')](_0x006d('0x9'),_0x3db873,_0x006d('0xc'));_0x33a1cd(_0x38f0f4[_0x006d('0x11')][_0x006d('0x10')]);}})[_0x006d('0x12')](function(_0x197928){logger[_0x006d('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x3db873,_0x197928);_0x3da484(_0x197928);});});}exports[_0x006d('0x13')]=function(_0x256a60){var _0x472959=this;return new Promise(function(_0x517bd5,_0x160bf2){return db[_0x006d('0x14')][_0x006d('0x15')]({'raw':_0x256a60[_0x006d('0x16')]?_0x256a60[_0x006d('0x16')][_0x006d('0x17')]===undefined?!![]:![]:!![],'where':_0x256a60['options']?_0x256a60[_0x006d('0x16')][_0x006d('0x18')]||null:null,'attributes':_0x256a60[_0x006d('0x16')]?_0x256a60[_0x006d('0x16')][_0x006d('0x19')]||null:null,'limit':_0x256a60['options']?_0x256a60[_0x006d('0x16')][_0x006d('0x1a')]||null:null,'include':_0x256a60['options']?_0x256a60[_0x006d('0x16')][_0x006d('0x1b')]?_['map'](_0x256a60[_0x006d('0x16')][_0x006d('0x1b')],function(_0x68f054){return{'model':db[_0x68f054['model']],'as':_0x68f054['as'],'attributes':_0x68f054['attributes'],'include':_0x68f054[_0x006d('0x1b')]?_[_0x006d('0x1c')](_0x68f054[_0x006d('0x1b')],function(_0x4d1cdb){return{'model':db[_0x4d1cdb[_0x006d('0x1d')]],'as':_0x4d1cdb['as'],'attributes':_0x4d1cdb[_0x006d('0x19')],'include':_0x4d1cdb[_0x006d('0x1b')]?_[_0x006d('0x1c')](_0x4d1cdb[_0x006d('0x1b')],function(_0x5698b1){return{'model':db[_0x5698b1[_0x006d('0x1d')]],'as':_0x5698b1['as'],'attributes':_0x5698b1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ec667){logger['info']('GetVtigerAccount',_0x256a60);logger[_0x006d('0xa')](_0x006d('0x13'),_0x256a60,JSON[_0x006d('0xd')](_0x4ec667));_0x517bd5(_0x4ec667);})[_0x006d('0x12')](function(_0x435678){logger[_0x006d('0xe')]('GetVtigerAccount',_0x435678['message'],_0x256a60);_0x160bf2(_0x472959[_0x006d('0xe')](0x1f4,_0x435678[_0x006d('0x10')]));});});};exports[_0x006d('0x1e')]=function(_0xf2a6ab){var _0x3491b9=this;return new Promise(function(_0x42036f,_0x26144e){return db['VtigerAccount'][_0x006d('0x1f')]({'raw':_0xf2a6ab[_0x006d('0x16')]?_0xf2a6ab[_0x006d('0x16')][_0x006d('0x17')]===undefined?!![]:![]:!![],'where':_0xf2a6ab[_0x006d('0x16')]?_0xf2a6ab[_0x006d('0x16')][_0x006d('0x18')]||null:null,'attributes':_0xf2a6ab[_0x006d('0x16')]?_0xf2a6ab['options'][_0x006d('0x19')]||null:null,'include':_0xf2a6ab[_0x006d('0x16')]?_0xf2a6ab['options'][_0x006d('0x1b')]?_[_0x006d('0x1c')](_0xf2a6ab[_0x006d('0x16')][_0x006d('0x1b')],function(_0x87fac6){return{'model':db[_0x87fac6[_0x006d('0x1d')]],'as':_0x87fac6['as'],'attributes':_0x87fac6[_0x006d('0x19')],'include':_0x87fac6[_0x006d('0x1b')]?_[_0x006d('0x1c')](_0x87fac6[_0x006d('0x1b')],function(_0xb78b8a){return{'model':db[_0xb78b8a[_0x006d('0x1d')]],'as':_0xb78b8a['as'],'attributes':_0xb78b8a[_0x006d('0x19')],'include':_0xb78b8a[_0x006d('0x1b')]?_[_0x006d('0x1c')](_0xb78b8a[_0x006d('0x1b')],function(_0x25dda5){return{'model':db[_0x25dda5[_0x006d('0x1d')]],'as':_0x25dda5['as'],'attributes':_0x25dda5[_0x006d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x006d('0x7')](function(_0x5ac382){logger['info'](_0x006d('0x1e'),_0xf2a6ab);logger['debug'](_0x006d('0x1e'),_0xf2a6ab,JSON[_0x006d('0xd')](_0x5ac382));_0x42036f(_0x5ac382);})[_0x006d('0x12')](function(_0x1750e8){logger[_0x006d('0xe')](_0x006d('0x1e'),_0x1750e8['message'],_0xf2a6ab);_0x26144e(_0x3491b9[_0x006d('0xe')](0x1f4,_0x1750e8[_0x006d('0x10')]));});});}; \ No newline at end of file +var _0x3c65=['request','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','include','map','model','attributes','then','debug','ShowVtigerAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x3c65,0x1a4));var _0x53c6=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x3c65[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0x53c6('0x0'));var util=require('util');var moment=require(_0x53c6('0x1'));var BPromise=require(_0x53c6('0x2'));var rs=require(_0x53c6('0x3'));var fs=require('fs');var Redis=require(_0x53c6('0x4'));var db=require(_0x53c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x53c6('0x6'))(_0x53c6('0x7'));var config=require(_0x53c6('0x8'));var jayson=require(_0x53c6('0x9'));var client=jayson[_0x53c6('0xa')][_0x53c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x577574,_0x5bf127,_0x57924b){return new BPromise(function(_0x45e719,_0x116b2a){return client[_0x53c6('0xc')](_0x577574,_0x57924b)['then'](function(_0x2a0c59){logger['info'](_0x53c6('0xd'),_0x5bf127,_0x53c6('0xe'));logger['debug'](_0x53c6('0xf'),_0x5bf127,_0x53c6('0xe'),JSON[_0x53c6('0x10')](_0x2a0c59));if(_0x2a0c59[_0x53c6('0x11')]){if(_0x2a0c59[_0x53c6('0x11')][_0x53c6('0x12')]===0x1f4){logger[_0x53c6('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5bf127,_0x2a0c59[_0x53c6('0x11')][_0x53c6('0x13')]);return _0x116b2a(_0x2a0c59[_0x53c6('0x11')][_0x53c6('0x13')]);}logger['error'](_0x53c6('0xd'),_0x5bf127,_0x2a0c59[_0x53c6('0x11')][_0x53c6('0x13')]);return _0x45e719(_0x2a0c59[_0x53c6('0x11')][_0x53c6('0x13')]);}else{logger[_0x53c6('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x5bf127,'request\x20sent');_0x45e719(_0x2a0c59[_0x53c6('0x15')]['message']);}})[_0x53c6('0x16')](function(_0x33859e){logger[_0x53c6('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x5bf127,_0x33859e);_0x116b2a(_0x33859e);});});}exports[_0x53c6('0x17')]=function(_0x59ffc3){var _0x1b6d66=this;return new Promise(function(_0xc0e3b4,_0x40e45a){return db[_0x53c6('0x18')][_0x53c6('0x19')]({'raw':_0x59ffc3[_0x53c6('0x1a')]?_0x59ffc3[_0x53c6('0x1a')][_0x53c6('0x1b')]===undefined?!![]:![]:!![],'where':_0x59ffc3[_0x53c6('0x1a')]?_0x59ffc3['options']['where']||null:null,'attributes':_0x59ffc3[_0x53c6('0x1a')]?_0x59ffc3[_0x53c6('0x1a')]['attributes']||null:null,'limit':_0x59ffc3[_0x53c6('0x1a')]?_0x59ffc3[_0x53c6('0x1a')]['limit']||null:null,'include':_0x59ffc3[_0x53c6('0x1a')]?_0x59ffc3[_0x53c6('0x1a')][_0x53c6('0x1c')]?_[_0x53c6('0x1d')](_0x59ffc3['options']['include'],function(_0x2882eb){return{'model':db[_0x2882eb[_0x53c6('0x1e')]],'as':_0x2882eb['as'],'attributes':_0x2882eb[_0x53c6('0x1f')],'include':_0x2882eb[_0x53c6('0x1c')]?_[_0x53c6('0x1d')](_0x2882eb[_0x53c6('0x1c')],function(_0x49f9ad){return{'model':db[_0x49f9ad[_0x53c6('0x1e')]],'as':_0x49f9ad['as'],'attributes':_0x49f9ad[_0x53c6('0x1f')],'include':_0x49f9ad[_0x53c6('0x1c')]?_['map'](_0x49f9ad[_0x53c6('0x1c')],function(_0xd45dfd){return{'model':db[_0xd45dfd[_0x53c6('0x1e')]],'as':_0xd45dfd['as'],'attributes':_0xd45dfd[_0x53c6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x53c6('0x20')](function(_0x5f36aa){logger[_0x53c6('0x14')](_0x53c6('0x17'),_0x59ffc3);logger[_0x53c6('0x21')]('GetVtigerAccount',_0x59ffc3,JSON[_0x53c6('0x10')](_0x5f36aa));_0xc0e3b4(_0x5f36aa);})[_0x53c6('0x16')](function(_0x49a652){logger['error']('GetVtigerAccount',_0x49a652[_0x53c6('0x13')],_0x59ffc3);_0x40e45a(_0x1b6d66[_0x53c6('0x11')](0x1f4,_0x49a652[_0x53c6('0x13')]));});});};exports[_0x53c6('0x22')]=function(_0x49896e){var _0x353e64=this;return new Promise(function(_0xd9e278,_0x4d4076){return db['VtigerAccount'][_0x53c6('0x23')]({'raw':_0x49896e[_0x53c6('0x1a')]?_0x49896e[_0x53c6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x49896e[_0x53c6('0x1a')]?_0x49896e[_0x53c6('0x1a')]['where']||null:null,'attributes':_0x49896e[_0x53c6('0x1a')]?_0x49896e['options'][_0x53c6('0x1f')]||null:null,'include':_0x49896e[_0x53c6('0x1a')]?_0x49896e[_0x53c6('0x1a')][_0x53c6('0x1c')]?_[_0x53c6('0x1d')](_0x49896e[_0x53c6('0x1a')][_0x53c6('0x1c')],function(_0x46e2fb){return{'model':db[_0x46e2fb[_0x53c6('0x1e')]],'as':_0x46e2fb['as'],'attributes':_0x46e2fb[_0x53c6('0x1f')],'include':_0x46e2fb[_0x53c6('0x1c')]?_[_0x53c6('0x1d')](_0x46e2fb[_0x53c6('0x1c')],function(_0x45b415){return{'model':db[_0x45b415['model']],'as':_0x45b415['as'],'attributes':_0x45b415['attributes'],'include':_0x45b415[_0x53c6('0x1c')]?_[_0x53c6('0x1d')](_0x45b415['include'],function(_0x481a26){return{'model':db[_0x481a26[_0x53c6('0x1e')]],'as':_0x481a26['as'],'attributes':_0x481a26[_0x53c6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3880b1){logger[_0x53c6('0x14')](_0x53c6('0x22'),_0x49896e);logger[_0x53c6('0x21')](_0x53c6('0x22'),_0x49896e,JSON[_0x53c6('0x10')](_0x3880b1));_0xd9e278(_0x3880b1);})[_0x53c6('0x16')](function(_0x470431){logger[_0x53c6('0x11')](_0x53c6('0x22'),_0x470431[_0x53c6('0x13')],_0x49896e);_0x4d4076(_0x353e64[_0x53c6('0x11')](0x1f4,_0x470431[_0x53c6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index d2f682c..14dacb5 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 _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x56fbaa,_0x3bc5a6){var _0x49fbc1=function(_0x19b08b){while(--_0x19b08b){_0x56fbaa['push'](_0x56fbaa['shift']());}};_0x49fbc1(++_0x3bc5a6);}(_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/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file +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(_0x59cea1,_0x187b71){var _0x3ec0a1=function(_0x2f9713){while(--_0x2f9713){_0x59cea1['push'](_0x59cea1['shift']());}};_0x3ec0a1(++_0x187b71);}(_0xb10b,0x12a));var _0xbb10=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xb10b[_0x36c5b0];return _0xf19333;};'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 87f58a9..fb4141b 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 _0xa2ed=['sequelize','exports','STRING'];(function(_0x8f5608,_0x189f1d){var _0x45931b=function(_0x539215){while(--_0x539215){_0x8f5608['push'](_0x8f5608['shift']());}};_0x45931b(++_0x189f1d);}(_0xa2ed,0x1a1));var _0xda2e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2ed[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xda2e('0x0'));module[_0xda2e('0x1')]={'name':{'type':Sequelize[_0xda2e('0x2')]},'description':{'type':Sequelize[_0xda2e('0x2')]}}; \ No newline at end of file +var _0x79db=['exports','STRING','sequelize'];(function(_0x416a85,_0x434ee3){var _0x38406b=function(_0x253ab1){while(--_0x253ab1){_0x416a85['push'](_0x416a85['shift']());}};_0x38406b(++_0x434ee3);}(_0x79db,0xfe));var _0xb79d=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0x79db[_0x1c6ef2];return _0x404b8c;};'use strict';var Sequelize=require(_0xb79d('0x0'));module[_0xb79d('0x1')]={'name':{'type':Sequelize[_0xb79d('0x2')]},'description':{'type':Sequelize[_0xb79d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 83a947f..c933097 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 _0x20ea=['lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','request','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','create','body','getFields','findOne','VtigerField','getSubjects','length','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x21e9bb,_0x1db195){var _0x5303f7=function(_0x30dd13){while(--_0x30dd13){_0x21e9bb['push'](_0x21e9bb['shift']());}};_0x5303f7(++_0x1db195);}(_0x20ea,0x1c5));var _0xa20e=function(_0x2df46e,_0x433fee){_0x2df46e=_0x2df46e-0x0;var _0x50a139=_0x20ea[_0x2df46e];return _0x50a139;};'use strict';var pdf=require(_0xa20e('0x0'));var emlformat=require(_0xa20e('0x1'));var rimraf=require(_0xa20e('0x2'));var zipdir=require(_0xa20e('0x3'));var jsonpatch=require(_0xa20e('0x4'));var rp=require(_0xa20e('0x5'));var moment=require(_0xa20e('0x6'));var BPromise=require(_0xa20e('0x7'));var Mustache=require(_0xa20e('0x8'));var util=require(_0xa20e('0x9'));var path=require(_0xa20e('0xa'));var sox=require('sox');var csv=require(_0xa20e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa20e('0xc'));var squel=require('squel');var crypto=require(_0xa20e('0xd'));var jsforce=require(_0xa20e('0xe'));var deskjs=require(_0xa20e('0xf'));var toCsv=require(_0xa20e('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa20e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa20e('0x11'));var as=require(_0xa20e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa20e('0x13'))(_0xa20e('0x14'));var utils=require(_0xa20e('0x15'));var config=require(_0xa20e('0x16'));var db=require(_0xa20e('0x17'))['db'];var jayson=require(_0xa20e('0x18'));var client=jayson[_0xa20e('0x19')][_0xa20e('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1c343d,_0x36395e,_0x10e9ab){if(_0x10e9ab){var _0x3ef9af=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ef9af['test'](_0x36395e)){return _0x1c343d;}else{throw new db[(_0xa20e('0x1b'))][(_0xa20e('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1c343d;}}function respondWithRpcPromise(_0x4a1153,_0x4c0e80,_0x3e4ae7,_0x44dcb4){return new BPromise(function(_0x728a92,_0x3e8a69){var _0x1faf59=_0x44dcb4||client;return _0x1faf59[_0xa20e('0x1d')](_0x4a1153,_0x3e4ae7)['then'](function(_0x33be4a){logger['info'](_0xa20e('0x1e'),_0x4c0e80,'request\x20sent');logger['debug'](_0xa20e('0x1f'),_0x4c0e80,_0xa20e('0x20'),JSON['stringify'](_0x33be4a));if(_0x33be4a['error']){if(_0x33be4a['error'][_0xa20e('0x21')]===0x1f4){logger[_0xa20e('0x22')](_0xa20e('0x1e'),_0x4c0e80,_0x33be4a[_0xa20e('0x22')][_0xa20e('0x23')]);return _0x3e8a69(_0x33be4a[_0xa20e('0x22')][_0xa20e('0x23')]);}logger[_0xa20e('0x22')](_0xa20e('0x1e'),_0x4c0e80,_0x33be4a[_0xa20e('0x22')][_0xa20e('0x23')]);return _0x728a92(_0x33be4a[_0xa20e('0x22')][_0xa20e('0x23')]);}else{logger[_0xa20e('0x24')]('VtigerConfiguration,\x20%s,\x20%s',_0x4c0e80,_0xa20e('0x20'));_0x728a92(_0x33be4a[_0xa20e('0x25')][_0xa20e('0x23')]);}})[_0xa20e('0x26')](function(_0x21c768){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4c0e80,_0x21c768);_0x3e8a69(_0x21c768);});});}function respondWithStatusCode(_0xddd8a7,_0x31857f){_0x31857f=_0x31857f||0xcc;return function(_0x4e5159){if(_0x4e5159){return _0xddd8a7[_0xa20e('0x27')](_0x31857f);}return _0xddd8a7[_0xa20e('0x28')](_0x31857f)[_0xa20e('0x29')]();};}function respondWithResult(_0x4c1c4a,_0x215a3a){_0x215a3a=_0x215a3a||0xc8;return function(_0x38894d){if(_0x38894d){return _0x4c1c4a[_0xa20e('0x28')](_0x215a3a)[_0xa20e('0x2a')](_0x38894d);}};}function respondWithFilteredResult(_0x2d3b5b,_0x1e8be6){return function(_0x14a18e){if(_0x14a18e){var _0xae9aee=_0x14a18e[_0xa20e('0x2b')],_0x1f4a6a=_0x1e8be6[_0xa20e('0x2c')],_0x5e603e=_0x1e8be6[_0xa20e('0x2c')]+_0x1e8be6[_0xa20e('0x2d')],_0x391ab5;if(_0x5e603e>=_0xae9aee){_0x5e603e=_0xae9aee;_0x391ab5=0xc8;}else{_0x391ab5=0xce;}_0x2d3b5b['status'](_0x391ab5);return _0x2d3b5b[_0xa20e('0x2e')](_0xa20e('0x2f'),_0x1f4a6a+'-'+_0x5e603e+'/'+_0xae9aee)['json'](_0x14a18e);}return null;};}function patchUpdates(_0x2ef680){return function(_0x22bd8a){try{jsonpatch[_0xa20e('0x30')](_0x22bd8a,_0x2ef680,!![]);}catch(_0x3f3a53){return BPromise['reject'](_0x3f3a53);}return _0x22bd8a[_0xa20e('0x31')]();};}function saveUpdates(_0x4fcd18,_0x366ffc){return function(_0x4927df){if(_0x4927df){return _0x4927df[_0xa20e('0x32')](_0x4fcd18)[_0xa20e('0x33')](function(_0xc1f286){return _0xc1f286;});}return null;};}function removeEntity(_0x528641,_0x1c51f6){return function(_0xa54554){if(_0xa54554){return _0xa54554[_0xa20e('0x34')]()['then'](function(){_0x528641['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53280f,_0x6904e5){return function(_0x25ea61){if(!_0x25ea61){_0x53280f['sendStatus'](0x194);}return _0x25ea61;};}function handleError(_0x5b127c,_0x152f35){_0x152f35=_0x152f35||0x1f4;return function(_0xe05ede){logger[_0xa20e('0x22')](_0xe05ede[_0xa20e('0x35')]);if(_0xe05ede['name']){delete _0xe05ede[_0xa20e('0x36')];}_0x5b127c[_0xa20e('0x28')](_0x152f35)[_0xa20e('0x37')](_0xe05ede);};}exports['index']=function(_0x6d880b,_0x4cd507){var _0x29ee1e={},_0x33dd95={},_0x20a114={'count':0x0,'rows':[]};var _0x4e6002=_[_0xa20e('0x38')](db[_0xa20e('0x39')][_0xa20e('0x3a')],function(_0x2c5628){return{'name':_0x2c5628[_0xa20e('0x3b')],'type':_0x2c5628[_0xa20e('0x3c')]['key']};});_0x33dd95[_0xa20e('0x3d')]=_[_0xa20e('0x38')](_0x4e6002,'name');_0x33dd95['query']=_[_0xa20e('0x3e')](_0x6d880b[_0xa20e('0x3f')]);_0x33dd95[_0xa20e('0x40')]=_[_0xa20e('0x41')](_0x33dd95[_0xa20e('0x3d')],_0x33dd95['query']);_0x29ee1e[_0xa20e('0x42')]=_[_0xa20e('0x41')](_0x33dd95['model'],qs['fields'](_0x6d880b[_0xa20e('0x3f')][_0xa20e('0x43')]));_0x29ee1e[_0xa20e('0x42')]=_0x29ee1e[_0xa20e('0x42')]['length']?_0x29ee1e[_0xa20e('0x42')]:_0x33dd95[_0xa20e('0x3d')];if(!_0x6d880b[_0xa20e('0x3f')][_0xa20e('0x44')](_0xa20e('0x45'))){_0x29ee1e['limit']=qs[_0xa20e('0x2d')](_0x6d880b['query']['limit']);_0x29ee1e[_0xa20e('0x2c')]=qs[_0xa20e('0x2c')](_0x6d880b[_0xa20e('0x3f')][_0xa20e('0x2c')]);}_0x29ee1e[_0xa20e('0x46')]=qs['sort'](_0x6d880b[_0xa20e('0x3f')][_0xa20e('0x47')]);_0x29ee1e['where']=qs[_0xa20e('0x40')](_[_0xa20e('0x48')](_0x6d880b[_0xa20e('0x3f')],_0x33dd95[_0xa20e('0x40')]),_0x4e6002);if(_0x6d880b[_0xa20e('0x3f')]['filter']){_0x29ee1e[_0xa20e('0x49')]=_[_0xa20e('0x4a')](_0x29ee1e[_0xa20e('0x49')],{'$or':_['map'](_0x4e6002,function(_0x378c3e){if(_0x378c3e[_0xa20e('0x3c')]!==_0xa20e('0x4b')){var _0x94acee={};_0x94acee[_0x378c3e['name']]={'$like':'%'+_0x6d880b[_0xa20e('0x3f')][_0xa20e('0x4c')]+'%'};return _0x94acee;}})});}_0x29ee1e=_[_0xa20e('0x4a')]({},_0x29ee1e,_0x6d880b[_0xa20e('0x4d')]);var _0x3e550d={'where':_0x29ee1e[_0xa20e('0x49')]};return db[_0xa20e('0x39')][_0xa20e('0x2b')](_0x3e550d)[_0xa20e('0x33')](function(_0x2934da){_0x20a114['count']=_0x2934da;if(_0x6d880b[_0xa20e('0x3f')]['includeAll']){_0x29ee1e[_0xa20e('0x4e')]=[{'all':!![]}];}return db[_0xa20e('0x39')][_0xa20e('0x4f')](_0x29ee1e);})[_0xa20e('0x33')](function(_0x34e7c8){_0x20a114[_0xa20e('0x50')]=_0x34e7c8;return _0x20a114;})[_0xa20e('0x33')](respondWithFilteredResult(_0x4cd507,_0x29ee1e))[_0xa20e('0x26')](handleError(_0x4cd507,null));};exports[_0xa20e('0x51')]=function(_0x20ee32,_0x26ab10){var _0x4af8e0={'raw':![],'where':{'id':_0x20ee32[_0xa20e('0x52')]['id']}},_0x3de36b={};_0x3de36b[_0xa20e('0x3d')]=_[_0xa20e('0x3e')](db[_0xa20e('0x39')][_0xa20e('0x3a')]);_0x3de36b['query']=_[_0xa20e('0x3e')](_0x20ee32[_0xa20e('0x3f')]);_0x3de36b[_0xa20e('0x40')]=_[_0xa20e('0x41')](_0x3de36b[_0xa20e('0x3d')],_0x3de36b['query']);_0x4af8e0[_0xa20e('0x42')]=_[_0xa20e('0x41')](_0x3de36b[_0xa20e('0x3d')],qs[_0xa20e('0x43')](_0x20ee32[_0xa20e('0x3f')][_0xa20e('0x43')]));_0x4af8e0[_0xa20e('0x42')]=_0x4af8e0[_0xa20e('0x42')]['length']?_0x4af8e0[_0xa20e('0x42')]:_0x3de36b[_0xa20e('0x3d')];if(_0x20ee32['query'][_0xa20e('0x53')]){_0x4af8e0[_0xa20e('0x4e')]=[{'all':!![]}];}_0x4af8e0=_[_0xa20e('0x4a')]({},_0x4af8e0,_0x20ee32[_0xa20e('0x4d')]);return db[_0xa20e('0x39')][_0xa20e('0x54')](_0x4af8e0)[_0xa20e('0x33')](handleEntityNotFound(_0x26ab10,null))[_0xa20e('0x33')](respondWithResult(_0x26ab10,null))[_0xa20e('0x26')](handleError(_0x26ab10,null));};exports['create']=function(_0x5c7cb5,_0x13a7ee){return db[_0xa20e('0x39')][_0xa20e('0x55')](_0x5c7cb5['body'],{})[_0xa20e('0x33')](respondWithResult(_0x13a7ee,0xc9))[_0xa20e('0x26')](handleError(_0x13a7ee,null));};exports[_0xa20e('0x32')]=function(_0xf72634,_0x49e666){if(_0xf72634[_0xa20e('0x56')]['id']){delete _0xf72634[_0xa20e('0x56')]['id'];}return db[_0xa20e('0x39')][_0xa20e('0x54')]({'where':{'id':_0xf72634['params']['id']}})[_0xa20e('0x33')](handleEntityNotFound(_0x49e666,null))[_0xa20e('0x33')](saveUpdates(_0xf72634[_0xa20e('0x56')],null))[_0xa20e('0x33')](respondWithResult(_0x49e666,null))[_0xa20e('0x26')](handleError(_0x49e666,null));};exports[_0xa20e('0x34')]=function(_0xb79f21,_0x48e9ab){return db[_0xa20e('0x39')][_0xa20e('0x54')]({'where':{'id':_0xb79f21[_0xa20e('0x52')]['id']}})[_0xa20e('0x33')](handleEntityNotFound(_0x48e9ab,null))[_0xa20e('0x33')](removeEntity(_0x48e9ab,null))[_0xa20e('0x26')](handleError(_0x48e9ab,null));};exports[_0xa20e('0x57')]=function(_0x5710c8,_0x27ef80,_0x16736b){var _0x5afc64={};var _0x43ba69={};var _0x12f8c;var _0x37edef;return db[_0xa20e('0x39')][_0xa20e('0x58')]({'where':{'id':_0x5710c8[_0xa20e('0x52')]['id']}})[_0xa20e('0x33')](handleEntityNotFound(_0x27ef80,null))['then'](function(_0x519167){if(_0x519167){_0x12f8c=_0x519167;_0x43ba69[_0xa20e('0x3d')]=_[_0xa20e('0x3e')](db[_0xa20e('0x59')]['rawAttributes']);_0x43ba69[_0xa20e('0x3f')]=_[_0xa20e('0x3e')](_0x5710c8[_0xa20e('0x3f')]);_0x43ba69[_0xa20e('0x40')]=_[_0xa20e('0x41')](_0x43ba69[_0xa20e('0x3d')],_0x43ba69[_0xa20e('0x3f')]);_0x5afc64[_0xa20e('0x42')]=_[_0xa20e('0x41')](_0x43ba69['model'],qs[_0xa20e('0x43')](_0x5710c8[_0xa20e('0x3f')][_0xa20e('0x43')]));_0x5afc64[_0xa20e('0x42')]=_0x5afc64[_0xa20e('0x42')]['length']?_0x5afc64[_0xa20e('0x42')]:_0x43ba69[_0xa20e('0x3d')];_0x5afc64[_0xa20e('0x46')]=qs['sort'](_0x5710c8[_0xa20e('0x3f')][_0xa20e('0x47')]);_0x5afc64['where']=qs[_0xa20e('0x40')](_[_0xa20e('0x48')](_0x5710c8[_0xa20e('0x3f')],_0x43ba69[_0xa20e('0x40')]));if(_0x5710c8[_0xa20e('0x3f')][_0xa20e('0x4c')]){_0x5afc64[_0xa20e('0x49')]=_[_0xa20e('0x4a')](_0x5afc64['where'],{'$or':_['map'](_0x5afc64[_0xa20e('0x42')],function(_0x3ca0e5){var _0x1b45de={};_0x1b45de[_0x3ca0e5]={'$like':'%'+_0x5710c8[_0xa20e('0x3f')]['filter']+'%'};return _0x1b45de;})});}_0x5afc64=_['merge']({},_0x5afc64,_0x5710c8[_0xa20e('0x4d')]);return _0x12f8c[_0xa20e('0x57')](_0x5afc64);}})['then'](function(_0x4974b5){if(_0x4974b5){_0x37edef=_0x4974b5['length'];if(!_0x5710c8[_0xa20e('0x3f')][_0xa20e('0x44')](_0xa20e('0x45'))){_0x5afc64[_0xa20e('0x2d')]=qs[_0xa20e('0x2d')](_0x5710c8[_0xa20e('0x3f')]['limit']);_0x5afc64[_0xa20e('0x2c')]=qs['offset'](_0x5710c8['query'][_0xa20e('0x2c')]);}return _0x12f8c[_0xa20e('0x57')](_0x5afc64);}})[_0xa20e('0x33')](function(_0x13fa0e){if(_0x13fa0e){return _0x13fa0e?{'count':_0x37edef,'rows':_0x13fa0e}:null;}})['then'](respondWithResult(_0x27ef80,null))[_0xa20e('0x26')](handleError(_0x27ef80,null));};exports[_0xa20e('0x5a')]=function(_0x1a459e,_0x30891b,_0x57d98e){var _0x4071c5={};var _0x5975fe={};var _0x4fcbe6;var _0x3a52bd;return db[_0xa20e('0x39')]['findOne']({'where':{'id':_0x1a459e['params']['id']}})[_0xa20e('0x33')](handleEntityNotFound(_0x30891b,null))[_0xa20e('0x33')](function(_0x52de8e){if(_0x52de8e){_0x4fcbe6=_0x52de8e;_0x5975fe['model']=_[_0xa20e('0x3e')](db[_0xa20e('0x59')][_0xa20e('0x3a')]);_0x5975fe[_0xa20e('0x3f')]=_['keys'](_0x1a459e[_0xa20e('0x3f')]);_0x5975fe['filters']=_['intersection'](_0x5975fe['model'],_0x5975fe[_0xa20e('0x3f')]);_0x4071c5[_0xa20e('0x42')]=_[_0xa20e('0x41')](_0x5975fe[_0xa20e('0x3d')],qs['fields'](_0x1a459e[_0xa20e('0x3f')][_0xa20e('0x43')]));_0x4071c5[_0xa20e('0x42')]=_0x4071c5[_0xa20e('0x42')][_0xa20e('0x5b')]?_0x4071c5[_0xa20e('0x42')]:_0x5975fe[_0xa20e('0x3d')];_0x4071c5[_0xa20e('0x46')]=qs[_0xa20e('0x47')](_0x1a459e[_0xa20e('0x3f')]['sort']);_0x4071c5[_0xa20e('0x49')]=qs[_0xa20e('0x40')](_[_0xa20e('0x48')](_0x1a459e['query'],_0x5975fe[_0xa20e('0x40')]));if(_0x1a459e['query'][_0xa20e('0x4c')]){_0x4071c5[_0xa20e('0x49')]=_['merge'](_0x4071c5[_0xa20e('0x49')],{'$or':_[_0xa20e('0x38')](_0x4071c5[_0xa20e('0x42')],function(_0x10c40d){var _0x14dafc={};_0x14dafc[_0x10c40d]={'$like':'%'+_0x1a459e[_0xa20e('0x3f')][_0xa20e('0x4c')]+'%'};return _0x14dafc;})});}_0x4071c5=_[_0xa20e('0x4a')]({},_0x4071c5,_0x1a459e[_0xa20e('0x4d')]);return _0x4fcbe6['getSubjects'](_0x4071c5);}})[_0xa20e('0x33')](function(_0xd2b121){if(_0xd2b121){_0x3a52bd=_0xd2b121[_0xa20e('0x5b')];if(!_0x1a459e['query'][_0xa20e('0x44')](_0xa20e('0x45'))){_0x4071c5['limit']=qs['limit'](_0x1a459e[_0xa20e('0x3f')][_0xa20e('0x2d')]);_0x4071c5[_0xa20e('0x2c')]=qs['offset'](_0x1a459e[_0xa20e('0x3f')][_0xa20e('0x2c')]);}return _0x4fcbe6[_0xa20e('0x5a')](_0x4071c5);}})['then'](function(_0x38f890){if(_0x38f890){return _0x38f890?{'count':_0x3a52bd,'rows':_0x38f890}:null;}})[_0xa20e('0x33')](respondWithResult(_0x30891b,null))[_0xa20e('0x26')](handleError(_0x30891b,null));};exports['getDescriptions']=function(_0x237659,_0xbb08f6,_0x1fd5a4){var _0x264934={};var _0x30396d={};var _0x2b76da;var _0x5f5719;return db[_0xa20e('0x39')][_0xa20e('0x58')]({'where':{'id':_0x237659['params']['id']}})[_0xa20e('0x33')](handleEntityNotFound(_0xbb08f6,null))[_0xa20e('0x33')](function(_0x154e92){if(_0x154e92){_0x2b76da=_0x154e92;_0x30396d[_0xa20e('0x3d')]=_[_0xa20e('0x3e')](db[_0xa20e('0x59')][_0xa20e('0x3a')]);_0x30396d['query']=_['keys'](_0x237659[_0xa20e('0x3f')]);_0x30396d[_0xa20e('0x40')]=_[_0xa20e('0x41')](_0x30396d[_0xa20e('0x3d')],_0x30396d[_0xa20e('0x3f')]);_0x264934[_0xa20e('0x42')]=_[_0xa20e('0x41')](_0x30396d[_0xa20e('0x3d')],qs[_0xa20e('0x43')](_0x237659[_0xa20e('0x3f')][_0xa20e('0x43')]));_0x264934[_0xa20e('0x42')]=_0x264934[_0xa20e('0x42')][_0xa20e('0x5b')]?_0x264934[_0xa20e('0x42')]:_0x30396d[_0xa20e('0x3d')];_0x264934['order']=qs['sort'](_0x237659[_0xa20e('0x3f')][_0xa20e('0x47')]);_0x264934[_0xa20e('0x49')]=qs[_0xa20e('0x40')](_[_0xa20e('0x48')](_0x237659[_0xa20e('0x3f')],_0x30396d[_0xa20e('0x40')]));if(_0x237659[_0xa20e('0x3f')][_0xa20e('0x4c')]){_0x264934['where']=_['merge'](_0x264934[_0xa20e('0x49')],{'$or':_[_0xa20e('0x38')](_0x264934['attributes'],function(_0x37a478){var _0x4db919={};_0x4db919[_0x37a478]={'$like':'%'+_0x237659['query'][_0xa20e('0x4c')]+'%'};return _0x4db919;})});}_0x264934=_[_0xa20e('0x4a')]({},_0x264934,_0x237659[_0xa20e('0x4d')]);return _0x2b76da['getDescriptions'](_0x264934);}})[_0xa20e('0x33')](function(_0x131a2b){if(_0x131a2b){_0x5f5719=_0x131a2b[_0xa20e('0x5b')];if(!_0x237659['query'][_0xa20e('0x44')](_0xa20e('0x45'))){_0x264934['limit']=qs[_0xa20e('0x2d')](_0x237659[_0xa20e('0x3f')][_0xa20e('0x2d')]);_0x264934[_0xa20e('0x2c')]=qs['offset'](_0x237659[_0xa20e('0x3f')][_0xa20e('0x2c')]);}return _0x2b76da[_0xa20e('0x5c')](_0x264934);}})[_0xa20e('0x33')](function(_0x4a263d){if(_0x4a263d){return _0x4a263d?{'count':_0x5f5719,'rows':_0x4a263d}:null;}})[_0xa20e('0x33')](respondWithResult(_0xbb08f6,null))['catch'](handleError(_0xbb08f6,null));}; \ No newline at end of file +var _0x9007=['getDescriptions','html-pdf','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','VtigerConfiguration','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','findAll','rows','show','params','rawAttributes','includeAll','include','find','create','body','getFields','keys','VtigerField','order','pick','getSubjects','findOne'];(function(_0x1b20a5,_0x4de662){var _0x16076c=function(_0x4ecfac){while(--_0x4ecfac){_0x1b20a5['push'](_0x1b20a5['shift']());}};_0x16076c(++_0x4de662);}(_0x9007,0xb3));var _0x7900=function(_0x36f284,_0x24cbd1){_0x36f284=_0x36f284-0x0;var _0x4ea099=_0x9007[_0x36f284];return _0x4ea099;};'use strict';var pdf=require(_0x7900('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7900('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7900('0x2'));var moment=require(_0x7900('0x3'));var BPromise=require(_0x7900('0x4'));var Mustache=require(_0x7900('0x5'));var util=require('util');var path=require(_0x7900('0x6'));var sox=require(_0x7900('0x7'));var csv=require('to-csv');var ejs=require(_0x7900('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7900('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7900('0xa'));var toCsv=require(_0x7900('0xb'));var querystring=require(_0x7900('0xc'));var Papa=require(_0x7900('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7900('0xe'));var as=require(_0x7900('0xf'));var hardwareService=require(_0x7900('0x10'));var logger=require(_0x7900('0x11'))('api');var utils=require(_0x7900('0x12'));var config=require(_0x7900('0x13'));var db=require(_0x7900('0x14'))['db'];var jayson=require(_0x7900('0x15'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2ebff6,_0x4711b8,_0x51fc04){if(_0x51fc04){var _0xd3b7ac=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xd3b7ac[_0x7900('0x16')](_0x4711b8)){return _0x2ebff6;}else{throw new db[(_0x7900('0x17'))][(_0x7900('0x18'))](_0x7900('0x19'));}}else{return _0x2ebff6;}}function respondWithRpcPromise(_0x368f51,_0x18a6f4,_0x53ec10,_0x18dcd8){return new BPromise(function(_0x52aa4e,_0x3ac4dd){var _0x153429=_0x18dcd8||client;return _0x153429[_0x7900('0x1a')](_0x368f51,_0x53ec10)['then'](function(_0xeb5448){logger[_0x7900('0x1b')](_0x7900('0x1c'),_0x18a6f4,_0x7900('0x1d'));logger[_0x7900('0x1e')](_0x7900('0x1f'),_0x18a6f4,_0x7900('0x1d'),JSON[_0x7900('0x20')](_0xeb5448));if(_0xeb5448['error']){if(_0xeb5448[_0x7900('0x21')]['code']===0x1f4){logger[_0x7900('0x21')](_0x7900('0x1c'),_0x18a6f4,_0xeb5448[_0x7900('0x21')]['message']);return _0x3ac4dd(_0xeb5448['error'][_0x7900('0x22')]);}logger['error'](_0x7900('0x1c'),_0x18a6f4,_0xeb5448[_0x7900('0x21')][_0x7900('0x22')]);return _0x52aa4e(_0xeb5448['error'][_0x7900('0x22')]);}else{logger[_0x7900('0x1b')]('VtigerConfiguration,\x20%s,\x20%s',_0x18a6f4,_0x7900('0x1d'));_0x52aa4e(_0xeb5448[_0x7900('0x23')]['message']);}})[_0x7900('0x24')](function(_0x1d3544){logger[_0x7900('0x21')](_0x7900('0x1c'),_0x18a6f4,_0x1d3544);_0x3ac4dd(_0x1d3544);});});}function respondWithStatusCode(_0x566153,_0x55e77a){_0x55e77a=_0x55e77a||0xcc;return function(_0x1c4a84){if(_0x1c4a84){return _0x566153[_0x7900('0x25')](_0x55e77a);}return _0x566153[_0x7900('0x26')](_0x55e77a)['end']();};}function respondWithResult(_0x9366cd,_0x1bfc0d){_0x1bfc0d=_0x1bfc0d||0xc8;return function(_0x4a385b){if(_0x4a385b){return _0x9366cd[_0x7900('0x26')](_0x1bfc0d)[_0x7900('0x27')](_0x4a385b);}};}function respondWithFilteredResult(_0x1d5cb1,_0x258c9f){return function(_0x5828ba){if(_0x5828ba){var _0x11c99e=_0x5828ba[_0x7900('0x28')],_0x498a5d=_0x258c9f[_0x7900('0x29')],_0x219071=_0x258c9f[_0x7900('0x29')]+_0x258c9f[_0x7900('0x2a')],_0xc332f7;if(_0x219071>=_0x11c99e){_0x219071=_0x11c99e;_0xc332f7=0xc8;}else{_0xc332f7=0xce;}_0x1d5cb1[_0x7900('0x26')](_0xc332f7);return _0x1d5cb1['set'](_0x7900('0x2b'),_0x498a5d+'-'+_0x219071+'/'+_0x11c99e)[_0x7900('0x27')](_0x5828ba);}return null;};}function patchUpdates(_0x484096){return function(_0x1214e4){try{jsonpatch[_0x7900('0x2c')](_0x1214e4,_0x484096,!![]);}catch(_0x32177f){return BPromise[_0x7900('0x2d')](_0x32177f);}return _0x1214e4[_0x7900('0x2e')]();};}function saveUpdates(_0x2b9cc7,_0x505378){return function(_0xe0dc1){if(_0xe0dc1){return _0xe0dc1['update'](_0x2b9cc7)[_0x7900('0x2f')](function(_0x490715){return _0x490715;});}return null;};}function removeEntity(_0x1c0063,_0x3c3ded){return function(_0x2a1238){if(_0x2a1238){return _0x2a1238[_0x7900('0x30')]()['then'](function(){_0x1c0063['status'](0xcc)[_0x7900('0x31')]();});}};}function handleEntityNotFound(_0x4f8c4a,_0x146361){return function(_0x227f8f){if(!_0x227f8f){_0x4f8c4a[_0x7900('0x25')](0x194);}return _0x227f8f;};}function handleError(_0xb429a9,_0x1e35d4){_0x1e35d4=_0x1e35d4||0x1f4;return function(_0x3a1c90){logger[_0x7900('0x21')](_0x3a1c90['stack']);if(_0x3a1c90[_0x7900('0x32')]){delete _0x3a1c90[_0x7900('0x32')];}_0xb429a9[_0x7900('0x26')](_0x1e35d4)[_0x7900('0x33')](_0x3a1c90);};}exports[_0x7900('0x34')]=function(_0x3098be,_0x45df9b){var _0x5618c1={},_0x5bf380={},_0x2fe2e9={'count':0x0,'rows':[]};var _0xae378c=_[_0x7900('0x35')](db[_0x7900('0x36')]['rawAttributes'],function(_0x421ee3){return{'name':_0x421ee3['fieldName'],'type':_0x421ee3[_0x7900('0x37')]['key']};});_0x5bf380[_0x7900('0x38')]=_['map'](_0xae378c,_0x7900('0x32'));_0x5bf380[_0x7900('0x39')]=_['keys'](_0x3098be['query']);_0x5bf380[_0x7900('0x3a')]=_[_0x7900('0x3b')](_0x5bf380[_0x7900('0x38')],_0x5bf380[_0x7900('0x39')]);_0x5618c1[_0x7900('0x3c')]=_[_0x7900('0x3b')](_0x5bf380['model'],qs[_0x7900('0x3d')](_0x3098be[_0x7900('0x39')]['fields']));_0x5618c1['attributes']=_0x5618c1[_0x7900('0x3c')][_0x7900('0x3e')]?_0x5618c1[_0x7900('0x3c')]:_0x5bf380[_0x7900('0x38')];if(!_0x3098be[_0x7900('0x39')][_0x7900('0x3f')](_0x7900('0x40'))){_0x5618c1[_0x7900('0x2a')]=qs[_0x7900('0x2a')](_0x3098be['query'][_0x7900('0x2a')]);_0x5618c1[_0x7900('0x29')]=qs[_0x7900('0x29')](_0x3098be[_0x7900('0x39')][_0x7900('0x29')]);}_0x5618c1['order']=qs[_0x7900('0x41')](_0x3098be['query'][_0x7900('0x41')]);_0x5618c1[_0x7900('0x42')]=qs['filters'](_['pick'](_0x3098be[_0x7900('0x39')],_0x5bf380[_0x7900('0x3a')]),_0xae378c);if(_0x3098be[_0x7900('0x39')][_0x7900('0x43')]){_0x5618c1[_0x7900('0x42')]=_['merge'](_0x5618c1[_0x7900('0x42')],{'$or':_[_0x7900('0x35')](_0xae378c,function(_0x596cad){if(_0x596cad[_0x7900('0x37')]!==_0x7900('0x44')){var _0x33d4c7={};_0x33d4c7[_0x596cad[_0x7900('0x32')]]={'$like':'%'+_0x3098be[_0x7900('0x39')][_0x7900('0x43')]+'%'};return _0x33d4c7;}})});}_0x5618c1=_[_0x7900('0x45')]({},_0x5618c1,_0x3098be[_0x7900('0x46')]);var _0x3db80d={'where':_0x5618c1['where']};return db[_0x7900('0x36')][_0x7900('0x28')](_0x3db80d)[_0x7900('0x2f')](function(_0x17d7c4){_0x2fe2e9[_0x7900('0x28')]=_0x17d7c4;if(_0x3098be['query']['includeAll']){_0x5618c1['include']=[{'all':!![]}];}return db[_0x7900('0x36')][_0x7900('0x47')](_0x5618c1);})[_0x7900('0x2f')](function(_0x4f7fe6){_0x2fe2e9[_0x7900('0x48')]=_0x4f7fe6;return _0x2fe2e9;})[_0x7900('0x2f')](respondWithFilteredResult(_0x45df9b,_0x5618c1))[_0x7900('0x24')](handleError(_0x45df9b,null));};exports[_0x7900('0x49')]=function(_0x4103ab,_0x217352){var _0x16ac68={'raw':![],'where':{'id':_0x4103ab[_0x7900('0x4a')]['id']}},_0xabc0f2={};_0xabc0f2['model']=_['keys'](db['VtigerConfiguration'][_0x7900('0x4b')]);_0xabc0f2['query']=_['keys'](_0x4103ab[_0x7900('0x39')]);_0xabc0f2[_0x7900('0x3a')]=_['intersection'](_0xabc0f2[_0x7900('0x38')],_0xabc0f2[_0x7900('0x39')]);_0x16ac68[_0x7900('0x3c')]=_[_0x7900('0x3b')](_0xabc0f2[_0x7900('0x38')],qs[_0x7900('0x3d')](_0x4103ab[_0x7900('0x39')][_0x7900('0x3d')]));_0x16ac68[_0x7900('0x3c')]=_0x16ac68['attributes'][_0x7900('0x3e')]?_0x16ac68['attributes']:_0xabc0f2[_0x7900('0x38')];if(_0x4103ab[_0x7900('0x39')][_0x7900('0x4c')]){_0x16ac68[_0x7900('0x4d')]=[{'all':!![]}];}_0x16ac68=_[_0x7900('0x45')]({},_0x16ac68,_0x4103ab['options']);return db[_0x7900('0x36')][_0x7900('0x4e')](_0x16ac68)[_0x7900('0x2f')](handleEntityNotFound(_0x217352,null))['then'](respondWithResult(_0x217352,null))['catch'](handleError(_0x217352,null));};exports[_0x7900('0x4f')]=function(_0x31635d,_0x150951){return db['VtigerConfiguration'][_0x7900('0x4f')](_0x31635d[_0x7900('0x50')],{})[_0x7900('0x2f')](respondWithResult(_0x150951,0xc9))[_0x7900('0x24')](handleError(_0x150951,null));};exports['update']=function(_0x214be4,_0x280cd9){if(_0x214be4[_0x7900('0x50')]['id']){delete _0x214be4[_0x7900('0x50')]['id'];}return db['VtigerConfiguration'][_0x7900('0x4e')]({'where':{'id':_0x214be4[_0x7900('0x4a')]['id']}})[_0x7900('0x2f')](handleEntityNotFound(_0x280cd9,null))[_0x7900('0x2f')](saveUpdates(_0x214be4[_0x7900('0x50')],null))['then'](respondWithResult(_0x280cd9,null))['catch'](handleError(_0x280cd9,null));};exports['destroy']=function(_0x390587,_0xe87b37){return db['VtigerConfiguration'][_0x7900('0x4e')]({'where':{'id':_0x390587['params']['id']}})[_0x7900('0x2f')](handleEntityNotFound(_0xe87b37,null))['then'](removeEntity(_0xe87b37,null))[_0x7900('0x24')](handleError(_0xe87b37,null));};exports[_0x7900('0x51')]=function(_0x26b404,_0x479a43,_0x43c708){var _0x3f3297={};var _0x155707={};var _0x381f8d;var _0x499091;return db[_0x7900('0x36')]['findOne']({'where':{'id':_0x26b404[_0x7900('0x4a')]['id']}})[_0x7900('0x2f')](handleEntityNotFound(_0x479a43,null))['then'](function(_0x4ea933){if(_0x4ea933){_0x381f8d=_0x4ea933;_0x155707[_0x7900('0x38')]=_[_0x7900('0x52')](db[_0x7900('0x53')][_0x7900('0x4b')]);_0x155707['query']=_[_0x7900('0x52')](_0x26b404[_0x7900('0x39')]);_0x155707[_0x7900('0x3a')]=_[_0x7900('0x3b')](_0x155707[_0x7900('0x38')],_0x155707[_0x7900('0x39')]);_0x3f3297[_0x7900('0x3c')]=_[_0x7900('0x3b')](_0x155707['model'],qs[_0x7900('0x3d')](_0x26b404[_0x7900('0x39')][_0x7900('0x3d')]));_0x3f3297['attributes']=_0x3f3297['attributes']['length']?_0x3f3297[_0x7900('0x3c')]:_0x155707[_0x7900('0x38')];_0x3f3297[_0x7900('0x54')]=qs[_0x7900('0x41')](_0x26b404['query']['sort']);_0x3f3297[_0x7900('0x42')]=qs[_0x7900('0x3a')](_[_0x7900('0x55')](_0x26b404['query'],_0x155707[_0x7900('0x3a')]));if(_0x26b404['query']['filter']){_0x3f3297[_0x7900('0x42')]=_[_0x7900('0x45')](_0x3f3297[_0x7900('0x42')],{'$or':_['map'](_0x3f3297[_0x7900('0x3c')],function(_0x11eebb){var _0x552d62={};_0x552d62[_0x11eebb]={'$like':'%'+_0x26b404[_0x7900('0x39')][_0x7900('0x43')]+'%'};return _0x552d62;})});}_0x3f3297=_[_0x7900('0x45')]({},_0x3f3297,_0x26b404[_0x7900('0x46')]);return _0x381f8d[_0x7900('0x51')](_0x3f3297);}})['then'](function(_0x5e365a){if(_0x5e365a){_0x499091=_0x5e365a[_0x7900('0x3e')];if(!_0x26b404['query'][_0x7900('0x3f')]('nolimit')){_0x3f3297[_0x7900('0x2a')]=qs[_0x7900('0x2a')](_0x26b404[_0x7900('0x39')][_0x7900('0x2a')]);_0x3f3297['offset']=qs[_0x7900('0x29')](_0x26b404[_0x7900('0x39')]['offset']);}return _0x381f8d[_0x7900('0x51')](_0x3f3297);}})[_0x7900('0x2f')](function(_0xccdae6){if(_0xccdae6){return _0xccdae6?{'count':_0x499091,'rows':_0xccdae6}:null;}})[_0x7900('0x2f')](respondWithResult(_0x479a43,null))[_0x7900('0x24')](handleError(_0x479a43,null));};exports[_0x7900('0x56')]=function(_0x4fd940,_0x4ac6d9,_0x2a1340){var _0x59fece={};var _0x5c0b7e={};var _0x51ddba;var _0x395c46;return db[_0x7900('0x36')][_0x7900('0x57')]({'where':{'id':_0x4fd940[_0x7900('0x4a')]['id']}})[_0x7900('0x2f')](handleEntityNotFound(_0x4ac6d9,null))[_0x7900('0x2f')](function(_0x23c32b){if(_0x23c32b){_0x51ddba=_0x23c32b;_0x5c0b7e[_0x7900('0x38')]=_[_0x7900('0x52')](db[_0x7900('0x53')]['rawAttributes']);_0x5c0b7e[_0x7900('0x39')]=_[_0x7900('0x52')](_0x4fd940[_0x7900('0x39')]);_0x5c0b7e['filters']=_[_0x7900('0x3b')](_0x5c0b7e['model'],_0x5c0b7e[_0x7900('0x39')]);_0x59fece['attributes']=_[_0x7900('0x3b')](_0x5c0b7e[_0x7900('0x38')],qs[_0x7900('0x3d')](_0x4fd940['query'][_0x7900('0x3d')]));_0x59fece['attributes']=_0x59fece[_0x7900('0x3c')][_0x7900('0x3e')]?_0x59fece[_0x7900('0x3c')]:_0x5c0b7e[_0x7900('0x38')];_0x59fece[_0x7900('0x54')]=qs[_0x7900('0x41')](_0x4fd940[_0x7900('0x39')]['sort']);_0x59fece[_0x7900('0x42')]=qs['filters'](_[_0x7900('0x55')](_0x4fd940[_0x7900('0x39')],_0x5c0b7e[_0x7900('0x3a')]));if(_0x4fd940[_0x7900('0x39')][_0x7900('0x43')]){_0x59fece[_0x7900('0x42')]=_['merge'](_0x59fece[_0x7900('0x42')],{'$or':_['map'](_0x59fece[_0x7900('0x3c')],function(_0x25c856){var _0x3c2dff={};_0x3c2dff[_0x25c856]={'$like':'%'+_0x4fd940['query'][_0x7900('0x43')]+'%'};return _0x3c2dff;})});}_0x59fece=_[_0x7900('0x45')]({},_0x59fece,_0x4fd940[_0x7900('0x46')]);return _0x51ddba[_0x7900('0x56')](_0x59fece);}})[_0x7900('0x2f')](function(_0x4f6fe1){if(_0x4f6fe1){_0x395c46=_0x4f6fe1[_0x7900('0x3e')];if(!_0x4fd940['query']['hasOwnProperty'](_0x7900('0x40'))){_0x59fece[_0x7900('0x2a')]=qs['limit'](_0x4fd940[_0x7900('0x39')][_0x7900('0x2a')]);_0x59fece[_0x7900('0x29')]=qs[_0x7900('0x29')](_0x4fd940['query'][_0x7900('0x29')]);}return _0x51ddba[_0x7900('0x56')](_0x59fece);}})[_0x7900('0x2f')](function(_0x27a15e){if(_0x27a15e){return _0x27a15e?{'count':_0x395c46,'rows':_0x27a15e}:null;}})['then'](respondWithResult(_0x4ac6d9,null))['catch'](handleError(_0x4ac6d9,null));};exports[_0x7900('0x58')]=function(_0xa67f1e,_0x3ffead,_0x43333b){var _0x4c05e0={};var _0x4583f0={};var _0x1a236f;var _0x445c07;return db[_0x7900('0x36')][_0x7900('0x57')]({'where':{'id':_0xa67f1e[_0x7900('0x4a')]['id']}})[_0x7900('0x2f')](handleEntityNotFound(_0x3ffead,null))['then'](function(_0x732bdf){if(_0x732bdf){_0x1a236f=_0x732bdf;_0x4583f0[_0x7900('0x38')]=_['keys'](db[_0x7900('0x53')][_0x7900('0x4b')]);_0x4583f0[_0x7900('0x39')]=_['keys'](_0xa67f1e[_0x7900('0x39')]);_0x4583f0[_0x7900('0x3a')]=_['intersection'](_0x4583f0[_0x7900('0x38')],_0x4583f0[_0x7900('0x39')]);_0x4c05e0['attributes']=_[_0x7900('0x3b')](_0x4583f0[_0x7900('0x38')],qs[_0x7900('0x3d')](_0xa67f1e[_0x7900('0x39')][_0x7900('0x3d')]));_0x4c05e0[_0x7900('0x3c')]=_0x4c05e0[_0x7900('0x3c')][_0x7900('0x3e')]?_0x4c05e0[_0x7900('0x3c')]:_0x4583f0[_0x7900('0x38')];_0x4c05e0[_0x7900('0x54')]=qs[_0x7900('0x41')](_0xa67f1e[_0x7900('0x39')]['sort']);_0x4c05e0[_0x7900('0x42')]=qs[_0x7900('0x3a')](_[_0x7900('0x55')](_0xa67f1e[_0x7900('0x39')],_0x4583f0[_0x7900('0x3a')]));if(_0xa67f1e[_0x7900('0x39')][_0x7900('0x43')]){_0x4c05e0[_0x7900('0x42')]=_[_0x7900('0x45')](_0x4c05e0[_0x7900('0x42')],{'$or':_['map'](_0x4c05e0[_0x7900('0x3c')],function(_0x4af23e){var _0x40289d={};_0x40289d[_0x4af23e]={'$like':'%'+_0xa67f1e[_0x7900('0x39')][_0x7900('0x43')]+'%'};return _0x40289d;})});}_0x4c05e0=_['merge']({},_0x4c05e0,_0xa67f1e[_0x7900('0x46')]);return _0x1a236f[_0x7900('0x58')](_0x4c05e0);}})[_0x7900('0x2f')](function(_0x7e6f6d){if(_0x7e6f6d){_0x445c07=_0x7e6f6d[_0x7900('0x3e')];if(!_0xa67f1e[_0x7900('0x39')]['hasOwnProperty'](_0x7900('0x40'))){_0x4c05e0[_0x7900('0x2a')]=qs[_0x7900('0x2a')](_0xa67f1e[_0x7900('0x39')][_0x7900('0x2a')]);_0x4c05e0['offset']=qs[_0x7900('0x29')](_0xa67f1e[_0x7900('0x39')][_0x7900('0x29')]);}return _0x1a236f[_0x7900('0x58')](_0x4c05e0);}})[_0x7900('0x2f')](function(_0x471e03){if(_0x471e03){return _0x471e03?{'count':_0x445c07,'rows':_0x471e03}:null;}})[_0x7900('0x2f')](respondWithResult(_0x3ffead,null))[_0x7900('0x24')](handleError(_0x3ffead,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 16b511f..807ea5b 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 _0xc9db=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0xc9db,0x79));var _0xbc9d=function(_0x4525ed,_0x4cda81){_0x4525ed=_0x4525ed-0x0;var _0x96aa84=_0xc9db[_0x4525ed];return _0x96aa84;};'use strict';var _=require('lodash');var util=require(_0xbc9d('0x0'));var logger=require(_0xbc9d('0x1'))(_0xbc9d('0x2'));var moment=require(_0xbc9d('0x3'));var BPromise=require(_0xbc9d('0x4'));var rp=require(_0xbc9d('0x5'));var fs=require('fs');var path=require(_0xbc9d('0x6'));var rimraf=require(_0xbc9d('0x7'));var config=require(_0xbc9d('0x8'));var attributes=require(_0xbc9d('0x9'));module['exports']=function(_0x25907a,_0x109626){return _0x25907a['define'](_0xbc9d('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe9a=['../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x74e8b5,_0x190ea8){var _0xa0f960=function(_0x37581d){while(--_0x37581d){_0x74e8b5['push'](_0x74e8b5['shift']());}};_0xa0f960(++_0x190ea8);}(_0xbe9a,0x1e6));var _0xabe9=function(_0xaf047d,_0x32dd83){_0xaf047d=_0xaf047d-0x0;var _0x45504f=_0xbe9a[_0xaf047d];return _0x45504f;};'use strict';var _=require(_0xabe9('0x0'));var util=require(_0xabe9('0x1'));var logger=require(_0xabe9('0x2'))(_0xabe9('0x3'));var moment=require(_0xabe9('0x4'));var BPromise=require('bluebird');var rp=require(_0xabe9('0x5'));var fs=require('fs');var path=require(_0xabe9('0x6'));var rimraf=require(_0xabe9('0x7'));var config=require(_0xabe9('0x8'));var attributes=require(_0xabe9('0x9'));module['exports']=function(_0x58fa85,_0x5832f5){return _0x58fa85[_0xabe9('0xa')](_0xabe9('0xb'),attributes,{'tableName':_0xabe9('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 27c95a7..2e09e60 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 _0x2655=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5c6272,_0xd82df5){var _0x19c236=function(_0x332352){while(--_0x332352){_0x5c6272['push'](_0x5c6272['shift']());}};_0x19c236(++_0xd82df5);}(_0x2655,0xb9));var _0x5265=function(_0x5cb32f,_0x1f8632){_0x5cb32f=_0x5cb32f-0x0;var _0x1bd969=_0x2655[_0x5cb32f];return _0x1bd969;};'use strict';var _=require(_0x5265('0x0'));var util=require(_0x5265('0x1'));var moment=require('moment');var BPromise=require(_0x5265('0x2'));var rs=require(_0x5265('0x3'));var fs=require('fs');var Redis=require(_0x5265('0x4'));var db=require(_0x5265('0x5'))['db'];var utils=require(_0x5265('0x6'));var logger=require(_0x5265('0x7'))(_0x5265('0x8'));var config=require(_0x5265('0x9'));var jayson=require(_0x5265('0xa'));var client=jayson[_0x5265('0xb')][_0x5265('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3aeb86,_0x2901d0,_0x3b7109){return new BPromise(function(_0x446f0d,_0x29ae5b){return client[_0x5265('0xd')](_0x3aeb86,_0x3b7109)[_0x5265('0xe')](function(_0x57ec3f){logger[_0x5265('0xf')](_0x5265('0x10'),_0x2901d0,_0x5265('0x11'));logger[_0x5265('0x12')](_0x5265('0x13'),_0x2901d0,_0x5265('0x11'),JSON[_0x5265('0x14')](_0x57ec3f));if(_0x57ec3f['error']){if(_0x57ec3f['error'][_0x5265('0x15')]===0x1f4){logger[_0x5265('0x16')](_0x5265('0x10'),_0x2901d0,_0x57ec3f['error']['message']);return _0x29ae5b(_0x57ec3f[_0x5265('0x16')]['message']);}logger['error'](_0x5265('0x10'),_0x2901d0,_0x57ec3f['error'][_0x5265('0x17')]);return _0x446f0d(_0x57ec3f[_0x5265('0x16')][_0x5265('0x17')]);}else{logger['info'](_0x5265('0x10'),_0x2901d0,'request\x20sent');_0x446f0d(_0x57ec3f['result'][_0x5265('0x17')]);}})[_0x5265('0x18')](function(_0x4b2b07){logger[_0x5265('0x16')]('VtigerConfiguration,\x20%s,\x20%s',_0x2901d0,_0x4b2b07);_0x29ae5b(_0x4b2b07);});});} \ No newline at end of file +var _0x0961=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','bluebird'];(function(_0x3b4922,_0x25b030){var _0xab3838=function(_0x2097f8){while(--_0x2097f8){_0x3b4922['push'](_0x3b4922['shift']());}};_0xab3838(++_0x25b030);}(_0x0961,0x1cc));var _0x1096=function(_0x589f71,_0x212326){_0x589f71=_0x589f71-0x0;var _0x5763bd=_0x0961[_0x589f71];return _0x5763bd;};'use strict';var _=require('lodash');var util=require(_0x1096('0x0'));var moment=require('moment');var BPromise=require(_0x1096('0x1'));var rs=require(_0x1096('0x2'));var fs=require('fs');var Redis=require(_0x1096('0x3'));var db=require(_0x1096('0x4'))['db'];var utils=require(_0x1096('0x5'));var logger=require(_0x1096('0x6'))('rpc');var config=require(_0x1096('0x7'));var jayson=require(_0x1096('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47f570,_0x4f120e,_0x15ac5d){return new BPromise(function(_0x3c0460,_0x2fea8f){return client[_0x1096('0x9')](_0x47f570,_0x15ac5d)[_0x1096('0xa')](function(_0x569146){logger[_0x1096('0xb')](_0x1096('0xc'),_0x4f120e,'request\x20sent');logger['debug'](_0x1096('0xd'),_0x4f120e,'request\x20sent',JSON[_0x1096('0xe')](_0x569146));if(_0x569146[_0x1096('0xf')]){if(_0x569146[_0x1096('0xf')][_0x1096('0x10')]===0x1f4){logger[_0x1096('0xf')](_0x1096('0xc'),_0x4f120e,_0x569146['error'][_0x1096('0x11')]);return _0x2fea8f(_0x569146[_0x1096('0xf')][_0x1096('0x11')]);}logger[_0x1096('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x4f120e,_0x569146[_0x1096('0xf')][_0x1096('0x11')]);return _0x3c0460(_0x569146['error'][_0x1096('0x11')]);}else{logger['info'](_0x1096('0xc'),_0x4f120e,_0x1096('0x12'));_0x3c0460(_0x569146[_0x1096('0x13')][_0x1096('0x11')]);}})[_0x1096('0x14')](function(_0x4a2902){logger[_0x1096('0xf')](_0x1096('0xc'),_0x4f120e,_0x4a2902);_0x2fea8f(_0x4a2902);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 51bec80..92b35e4 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 _0xdd32=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','create','put','/:id','update','destroy','exports','multer','path','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdd32,0xfc));var _0x2dd3=function(_0xb4bdb1,_0x25269c){_0xb4bdb1=_0xb4bdb1-0x0;var _0x259f46=_0xdd32[_0xb4bdb1];return _0x259f46;};'use strict';var multer=require(_0x2dd3('0x0'));var util=require('util');var path=require(_0x2dd3('0x1'));var timeout=require('connect-timeout');var express=require(_0x2dd3('0x2'));var router=express['Router']();var auth=require(_0x2dd3('0x3'));var interaction=require(_0x2dd3('0x4'));var config=require(_0x2dd3('0x5'));var controller=require(_0x2dd3('0x6'));router[_0x2dd3('0x7')]('/',auth[_0x2dd3('0x8')](),controller[_0x2dd3('0x9')]);router['get']('/:id',auth[_0x2dd3('0x8')](),controller[_0x2dd3('0xa')]);router['post']('/',auth[_0x2dd3('0x8')](),controller[_0x2dd3('0xb')]);router[_0x2dd3('0xc')](_0x2dd3('0xd'),auth['isAuthenticated'](),controller[_0x2dd3('0xe')]);router['delete'](_0x2dd3('0xd'),auth[_0x2dd3('0x8')](),controller[_0x2dd3('0xf')]);module[_0x2dd3('0x10')]=router; \ No newline at end of file +var _0x7ce6=['index','get','/:id','show','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x2b9111,_0xc60067){var _0x4bf35b=function(_0x2bbd4d){while(--_0x2bbd4d){_0x2b9111['push'](_0x2b9111['shift']());}};_0x4bf35b(++_0xc60067);}(_0x7ce6,0x184));var _0x67ce=function(_0x34b4df,_0xed778){_0x34b4df=_0x34b4df-0x0;var _0x3c0019=_0x7ce6[_0x34b4df];return _0x3c0019;};'use strict';var multer=require(_0x67ce('0x0'));var util=require('util');var path=require(_0x67ce('0x1'));var timeout=require('connect-timeout');var express=require(_0x67ce('0x2'));var router=express[_0x67ce('0x3')]();var auth=require(_0x67ce('0x4'));var interaction=require(_0x67ce('0x5'));var config=require(_0x67ce('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x67ce('0x7')](),controller[_0x67ce('0x8')]);router[_0x67ce('0x9')](_0x67ce('0xa'),auth[_0x67ce('0x7')](),controller[_0x67ce('0xb')]);router['post']('/',auth[_0x67ce('0x7')](),controller[_0x67ce('0xc')]);router[_0x67ce('0xd')](_0x67ce('0xa'),auth[_0x67ce('0x7')](),controller[_0x67ce('0xe')]);router[_0x67ce('0xf')](_0x67ce('0xa'),auth[_0x67ce('0x7')](),controller[_0x67ce('0x10')]);module[_0x67ce('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 1d6c694..7478586 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 _0x9865=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x1d908b,_0x4abdba){var _0x13559a=function(_0x4bb5f7){while(--_0x4bb5f7){_0x1d908b['push'](_0x1d908b['shift']());}};_0x13559a(++_0x4abdba);}(_0x9865,0x1ba));var _0x5986=function(_0x4f8780,_0x26afec){_0x4f8780=_0x4f8780-0x0;var _0x5a3dfd=_0x9865[_0x4f8780];return _0x5a3dfd;};'use strict';var Sequelize=require(_0x5986('0x0'));module[_0x5986('0x1')]={'type':{'type':Sequelize[_0x5986('0x2')](_0x5986('0x3'),_0x5986('0x4'),_0x5986('0x5'),_0x5986('0x6')),'defaultValue':_0x5986('0x3')},'content':{'type':Sequelize[_0x5986('0x7')]},'key':{'type':Sequelize[_0x5986('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x5986('0x3'),_0x5986('0x4'),_0x5986('0x5'))},'keyContent':{'type':Sequelize[_0x5986('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5986('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x938a=['customVariable','sequelize','exports','ENUM','string','keyValue','STRING'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x938a,0x1f2));var _0xa938=function(_0x279d58,_0x45446a){_0x279d58=_0x279d58-0x0;var _0x27d6e1=_0x938a[_0x279d58];return _0x27d6e1;};'use strict';var Sequelize=require(_0xa938('0x0'));module[_0xa938('0x1')]={'type':{'type':Sequelize[_0xa938('0x2')](_0xa938('0x3'),'variable','customVariable',_0xa938('0x4')),'defaultValue':_0xa938('0x3')},'content':{'type':Sequelize[_0xa938('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa938('0x2')](_0xa938('0x3'),'variable',_0xa938('0x6'))},'keyContent':{'type':Sequelize[_0xa938('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa938('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index a1b72aa..6567f6b 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 _0xf403=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','update','then','destroy','error','send','index','map','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','include','VtigerField','show','params','includeAll','find','catch','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse'];(function(_0x36b151,_0x3a9fe1){var _0x533440=function(_0x2b4113){while(--_0x2b4113){_0x36b151['push'](_0x36b151['shift']());}};_0x533440(++_0x3a9fe1);}(_0xf403,0x1d3));var _0x3f40=function(_0x485a97,_0x1b1bf5){_0x485a97=_0x485a97-0x0;var _0x4e930d=_0xf403[_0x485a97];return _0x4e930d;};'use strict';var pdf=require(_0x3f40('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3f40('0x1'));var zipdir=require(_0x3f40('0x2'));var jsonpatch=require(_0x3f40('0x3'));var rp=require(_0x3f40('0x4'));var moment=require(_0x3f40('0x5'));var BPromise=require(_0x3f40('0x6'));var Mustache=require(_0x3f40('0x7'));var util=require(_0x3f40('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x3f40('0x9'));var ejs=require(_0x3f40('0xa'));var fs=require('fs');var _=require(_0x3f40('0xb'));var squel=require(_0x3f40('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f40('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f40('0xe'));var Papa=require(_0x3f40('0xf'));var Redis=require(_0x3f40('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3f40('0x11'));var hardwareService=require(_0x3f40('0x12'));var logger=require(_0x3f40('0x13'))('api');var utils=require(_0x3f40('0x14'));var config=require(_0x3f40('0x15'));var db=require(_0x3f40('0x16'))['db'];function respondWithStatusCode(_0x5b54cf,_0x332635){_0x332635=_0x332635||0xcc;return function(_0x509c02){if(_0x509c02){return _0x5b54cf[_0x3f40('0x17')](_0x332635);}return _0x5b54cf[_0x3f40('0x18')](_0x332635)[_0x3f40('0x19')]();};}function respondWithResult(_0x316bdc,_0x569c6e){_0x569c6e=_0x569c6e||0xc8;return function(_0x2b2bfe){if(_0x2b2bfe){return _0x316bdc[_0x3f40('0x18')](_0x569c6e)[_0x3f40('0x1a')](_0x2b2bfe);}};}function respondWithFilteredResult(_0x1c9144,_0x232241){return function(_0x4e28b9){if(_0x4e28b9){var _0x2e51ed=_0x4e28b9['count'],_0x3d11c9=_0x232241[_0x3f40('0x1b')],_0x535f85=_0x232241[_0x3f40('0x1b')]+_0x232241[_0x3f40('0x1c')],_0x4ef80e;if(_0x535f85>=_0x2e51ed){_0x535f85=_0x2e51ed;_0x4ef80e=0xc8;}else{_0x4ef80e=0xce;}_0x1c9144[_0x3f40('0x18')](_0x4ef80e);return _0x1c9144[_0x3f40('0x1d')]('Content-Range',_0x3d11c9+'-'+_0x535f85+'/'+_0x2e51ed)[_0x3f40('0x1a')](_0x4e28b9);}return null;};}function patchUpdates(_0xaab367){return function(_0x464b26){try{jsonpatch[_0x3f40('0x1e')](_0x464b26,_0xaab367,!![]);}catch(_0x3129e2){return BPromise['reject'](_0x3129e2);}return _0x464b26[_0x3f40('0x1f')]();};}function saveUpdates(_0x5ae5d7,_0x12aabf){return function(_0x32b945){if(_0x32b945){return _0x32b945[_0x3f40('0x20')](_0x5ae5d7)[_0x3f40('0x21')](function(_0x628816){return _0x628816;});}return null;};}function removeEntity(_0x4aa559,_0x27f5a5){return function(_0x379b4e){if(_0x379b4e){return _0x379b4e[_0x3f40('0x22')]()[_0x3f40('0x21')](function(){_0x4aa559[_0x3f40('0x18')](0xcc)[_0x3f40('0x19')]();});}};}function handleEntityNotFound(_0x4e1f47,_0x31fc91){return function(_0x59eb32){if(!_0x59eb32){_0x4e1f47[_0x3f40('0x17')](0x194);}return _0x59eb32;};}function handleError(_0x4fed43,_0x2bc437){_0x2bc437=_0x2bc437||0x1f4;return function(_0x487b51){logger[_0x3f40('0x23')](_0x487b51['stack']);if(_0x487b51['name']){delete _0x487b51['name'];}_0x4fed43[_0x3f40('0x18')](_0x2bc437)[_0x3f40('0x24')](_0x487b51);};}exports[_0x3f40('0x25')]=function(_0x257833,_0x5b1079){var _0x300665={},_0x47ec1c={},_0x319997={'count':0x0,'rows':[]};var _0xbaf5d4=_[_0x3f40('0x26')](db['VtigerField'][_0x3f40('0x27')],function(_0x4b5ef7){return{'name':_0x4b5ef7[_0x3f40('0x28')],'type':_0x4b5ef7['type']['key']};});_0x47ec1c[_0x3f40('0x29')]=_[_0x3f40('0x26')](_0xbaf5d4,_0x3f40('0x2a'));_0x47ec1c[_0x3f40('0x2b')]=_[_0x3f40('0x2c')](_0x257833[_0x3f40('0x2b')]);_0x47ec1c[_0x3f40('0x2d')]=_[_0x3f40('0x2e')](_0x47ec1c['model'],_0x47ec1c[_0x3f40('0x2b')]);_0x300665[_0x3f40('0x2f')]=_[_0x3f40('0x2e')](_0x47ec1c[_0x3f40('0x29')],qs[_0x3f40('0x30')](_0x257833['query'][_0x3f40('0x30')]));_0x300665[_0x3f40('0x2f')]=_0x300665[_0x3f40('0x2f')]['length']?_0x300665[_0x3f40('0x2f')]:_0x47ec1c[_0x3f40('0x29')];if(!_0x257833[_0x3f40('0x2b')][_0x3f40('0x31')](_0x3f40('0x32'))){_0x300665[_0x3f40('0x1c')]=qs[_0x3f40('0x1c')](_0x257833[_0x3f40('0x2b')][_0x3f40('0x1c')]);_0x300665[_0x3f40('0x1b')]=qs[_0x3f40('0x1b')](_0x257833[_0x3f40('0x2b')][_0x3f40('0x1b')]);}_0x300665[_0x3f40('0x33')]=qs[_0x3f40('0x34')](_0x257833[_0x3f40('0x2b')][_0x3f40('0x34')]);_0x300665[_0x3f40('0x35')]=qs[_0x3f40('0x2d')](_[_0x3f40('0x36')](_0x257833[_0x3f40('0x2b')],_0x47ec1c[_0x3f40('0x2d')]),_0xbaf5d4);if(_0x257833[_0x3f40('0x2b')][_0x3f40('0x37')]){_0x300665[_0x3f40('0x35')]=_[_0x3f40('0x38')](_0x300665[_0x3f40('0x35')],{'$or':_[_0x3f40('0x26')](_0xbaf5d4,function(_0x411c98){if(_0x411c98[_0x3f40('0x39')]!=='VIRTUAL'){var _0x554a5c={};_0x554a5c[_0x411c98[_0x3f40('0x2a')]]={'$like':'%'+_0x257833[_0x3f40('0x2b')][_0x3f40('0x37')]+'%'};return _0x554a5c;}})});}_0x300665=_[_0x3f40('0x38')]({},_0x300665,_0x257833[_0x3f40('0x3a')]);var _0x215d00={'where':_0x300665[_0x3f40('0x35')]};return db['VtigerField'][_0x3f40('0x3b')](_0x215d00)['then'](function(_0x229bff){_0x319997[_0x3f40('0x3b')]=_0x229bff;if(_0x257833[_0x3f40('0x2b')]['includeAll']){_0x300665[_0x3f40('0x3c')]=[{'all':!![]}];}return db[_0x3f40('0x3d')]['findAll'](_0x300665);})[_0x3f40('0x21')](function(_0x180305){_0x319997['rows']=_0x180305;return _0x319997;})[_0x3f40('0x21')](respondWithFilteredResult(_0x5b1079,_0x300665))['catch'](handleError(_0x5b1079,null));};exports[_0x3f40('0x3e')]=function(_0x53ac15,_0x557f27){var _0x8e89a={'raw':!![],'where':{'id':_0x53ac15[_0x3f40('0x3f')]['id']}},_0x4bf783={};_0x4bf783[_0x3f40('0x29')]=_[_0x3f40('0x2c')](db[_0x3f40('0x3d')]['rawAttributes']);_0x4bf783[_0x3f40('0x2b')]=_['keys'](_0x53ac15[_0x3f40('0x2b')]);_0x4bf783[_0x3f40('0x2d')]=_[_0x3f40('0x2e')](_0x4bf783['model'],_0x4bf783['query']);_0x8e89a[_0x3f40('0x2f')]=_[_0x3f40('0x2e')](_0x4bf783[_0x3f40('0x29')],qs[_0x3f40('0x30')](_0x53ac15[_0x3f40('0x2b')][_0x3f40('0x30')]));_0x8e89a[_0x3f40('0x2f')]=_0x8e89a[_0x3f40('0x2f')]['length']?_0x8e89a[_0x3f40('0x2f')]:_0x4bf783['model'];if(_0x53ac15['query'][_0x3f40('0x40')]){_0x8e89a[_0x3f40('0x3c')]=[{'all':!![]}];}_0x8e89a=_[_0x3f40('0x38')]({},_0x8e89a,_0x53ac15[_0x3f40('0x3a')]);return db[_0x3f40('0x3d')][_0x3f40('0x41')](_0x8e89a)[_0x3f40('0x21')](handleEntityNotFound(_0x557f27,null))[_0x3f40('0x21')](respondWithResult(_0x557f27,null))[_0x3f40('0x42')](handleError(_0x557f27,null));};exports[_0x3f40('0x43')]=function(_0x3a504e,_0x10678b){return db[_0x3f40('0x3d')][_0x3f40('0x43')](_0x3a504e['body'],{})[_0x3f40('0x21')](respondWithResult(_0x10678b,0xc9))['catch'](handleError(_0x10678b,null));};exports[_0x3f40('0x20')]=function(_0x2f16d6,_0x50b268){if(_0x2f16d6[_0x3f40('0x44')]['id']){delete _0x2f16d6[_0x3f40('0x44')]['id'];}return db[_0x3f40('0x3d')][_0x3f40('0x41')]({'where':{'id':_0x2f16d6[_0x3f40('0x3f')]['id']}})[_0x3f40('0x21')](handleEntityNotFound(_0x50b268,null))[_0x3f40('0x21')](saveUpdates(_0x2f16d6[_0x3f40('0x44')],null))[_0x3f40('0x21')](respondWithResult(_0x50b268,null))[_0x3f40('0x42')](handleError(_0x50b268,null));};exports[_0x3f40('0x22')]=function(_0x364773,_0x1cfe4f){return db[_0x3f40('0x3d')][_0x3f40('0x41')]({'where':{'id':_0x364773[_0x3f40('0x3f')]['id']}})[_0x3f40('0x21')](handleEntityNotFound(_0x1cfe4f,null))[_0x3f40('0x21')](removeEntity(_0x1cfe4f,null))[_0x3f40('0x42')](handleError(_0x1cfe4f,null));}; \ No newline at end of file +var _0xc622=['offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','type','options','VtigerField','includeAll','findAll','rows','params','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','end','json','count'];(function(_0x290801,_0x3bf9b5){var _0x2271c3=function(_0x771660){while(--_0x771660){_0x290801['push'](_0x290801['shift']());}};_0x2271c3(++_0x3bf9b5);}(_0xc622,0xb5));var _0x2c62=function(_0x12b71a,_0x5a0f68){_0x12b71a=_0x12b71a-0x0;var _0xfa09c6=_0xc622[_0x12b71a];return _0xfa09c6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2c62('0x0'));var rimraf=require(_0x2c62('0x1'));var zipdir=require(_0x2c62('0x2'));var jsonpatch=require(_0x2c62('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2c62('0x4'));var Mustache=require('mustache');var util=require(_0x2c62('0x5'));var path=require('path');var sox=require(_0x2c62('0x6'));var csv=require(_0x2c62('0x7'));var ejs=require(_0x2c62('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2c62('0x9'));var crypto=require(_0x2c62('0xa'));var jsforce=require(_0x2c62('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2c62('0x7'));var querystring=require(_0x2c62('0xc'));var Papa=require(_0x2c62('0xd'));var Redis=require('ioredis');var authService=require(_0x2c62('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2c62('0xf'));var hardwareService=require(_0x2c62('0x10'));var logger=require(_0x2c62('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x2c62('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fb9f0,_0x559990){_0x559990=_0x559990||0xcc;return function(_0x23277b){if(_0x23277b){return _0x3fb9f0[_0x2c62('0x13')](_0x559990);}return _0x3fb9f0['status'](_0x559990)[_0x2c62('0x14')]();};}function respondWithResult(_0x1f5e70,_0x57865a){_0x57865a=_0x57865a||0xc8;return function(_0x4ec553){if(_0x4ec553){return _0x1f5e70['status'](_0x57865a)[_0x2c62('0x15')](_0x4ec553);}};}function respondWithFilteredResult(_0x61ac34,_0xe304a8){return function(_0x1e7cd0){if(_0x1e7cd0){var _0x3b244c=_0x1e7cd0[_0x2c62('0x16')],_0x3d7715=_0xe304a8[_0x2c62('0x17')],_0x5ea34a=_0xe304a8[_0x2c62('0x17')]+_0xe304a8[_0x2c62('0x18')],_0x55e816;if(_0x5ea34a>=_0x3b244c){_0x5ea34a=_0x3b244c;_0x55e816=0xc8;}else{_0x55e816=0xce;}_0x61ac34[_0x2c62('0x19')](_0x55e816);return _0x61ac34[_0x2c62('0x1a')](_0x2c62('0x1b'),_0x3d7715+'-'+_0x5ea34a+'/'+_0x3b244c)[_0x2c62('0x15')](_0x1e7cd0);}return null;};}function patchUpdates(_0x4e9486){return function(_0x4f6b19){try{jsonpatch[_0x2c62('0x1c')](_0x4f6b19,_0x4e9486,!![]);}catch(_0xc2eb68){return BPromise[_0x2c62('0x1d')](_0xc2eb68);}return _0x4f6b19[_0x2c62('0x1e')]();};}function saveUpdates(_0x4765a1,_0x16d56f){return function(_0x1ce946){if(_0x1ce946){return _0x1ce946['update'](_0x4765a1)[_0x2c62('0x1f')](function(_0xfcd90a){return _0xfcd90a;});}return null;};}function removeEntity(_0x47a871,_0x3ea126){return function(_0x58f194){if(_0x58f194){return _0x58f194[_0x2c62('0x20')]()[_0x2c62('0x1f')](function(){_0x47a871[_0x2c62('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x223377,_0x32aadb){return function(_0x24f709){if(!_0x24f709){_0x223377['sendStatus'](0x194);}return _0x24f709;};}function handleError(_0x4df2ab,_0x357b8b){_0x357b8b=_0x357b8b||0x1f4;return function(_0x13ad92){logger['error'](_0x13ad92[_0x2c62('0x21')]);if(_0x13ad92[_0x2c62('0x22')]){delete _0x13ad92[_0x2c62('0x22')];}_0x4df2ab['status'](_0x357b8b)['send'](_0x13ad92);};}exports[_0x2c62('0x23')]=function(_0x13de98,_0x3c7cb1){var _0x4b4d07={},_0x380d3c={},_0x4b65ac={'count':0x0,'rows':[]};var _0x33afc5=_[_0x2c62('0x24')](db['VtigerField'][_0x2c62('0x25')],function(_0x12e856){return{'name':_0x12e856[_0x2c62('0x26')],'type':_0x12e856['type'][_0x2c62('0x27')]};});_0x380d3c[_0x2c62('0x28')]=_[_0x2c62('0x24')](_0x33afc5,_0x2c62('0x22'));_0x380d3c[_0x2c62('0x29')]=_[_0x2c62('0x2a')](_0x13de98[_0x2c62('0x29')]);_0x380d3c[_0x2c62('0x2b')]=_[_0x2c62('0x2c')](_0x380d3c[_0x2c62('0x28')],_0x380d3c[_0x2c62('0x29')]);_0x4b4d07[_0x2c62('0x2d')]=_['intersection'](_0x380d3c[_0x2c62('0x28')],qs[_0x2c62('0x2e')](_0x13de98['query'][_0x2c62('0x2e')]));_0x4b4d07[_0x2c62('0x2d')]=_0x4b4d07['attributes'][_0x2c62('0x2f')]?_0x4b4d07['attributes']:_0x380d3c[_0x2c62('0x28')];if(!_0x13de98['query']['hasOwnProperty'](_0x2c62('0x30'))){_0x4b4d07['limit']=qs[_0x2c62('0x18')](_0x13de98[_0x2c62('0x29')][_0x2c62('0x18')]);_0x4b4d07[_0x2c62('0x17')]=qs[_0x2c62('0x17')](_0x13de98['query']['offset']);}_0x4b4d07[_0x2c62('0x31')]=qs[_0x2c62('0x32')](_0x13de98[_0x2c62('0x29')]['sort']);_0x4b4d07['where']=qs[_0x2c62('0x2b')](_[_0x2c62('0x33')](_0x13de98[_0x2c62('0x29')],_0x380d3c['filters']),_0x33afc5);if(_0x13de98[_0x2c62('0x29')][_0x2c62('0x34')]){_0x4b4d07[_0x2c62('0x35')]=_[_0x2c62('0x36')](_0x4b4d07[_0x2c62('0x35')],{'$or':_[_0x2c62('0x24')](_0x33afc5,function(_0x4aa8e5){if(_0x4aa8e5[_0x2c62('0x37')]!=='VIRTUAL'){var _0x332869={};_0x332869[_0x4aa8e5['name']]={'$like':'%'+_0x13de98['query']['filter']+'%'};return _0x332869;}})});}_0x4b4d07=_[_0x2c62('0x36')]({},_0x4b4d07,_0x13de98[_0x2c62('0x38')]);var _0x599cdb={'where':_0x4b4d07[_0x2c62('0x35')]};return db[_0x2c62('0x39')][_0x2c62('0x16')](_0x599cdb)[_0x2c62('0x1f')](function(_0x59b315){_0x4b65ac['count']=_0x59b315;if(_0x13de98[_0x2c62('0x29')][_0x2c62('0x3a')]){_0x4b4d07['include']=[{'all':!![]}];}return db['VtigerField'][_0x2c62('0x3b')](_0x4b4d07);})['then'](function(_0xfac5be){_0x4b65ac[_0x2c62('0x3c')]=_0xfac5be;return _0x4b65ac;})[_0x2c62('0x1f')](respondWithFilteredResult(_0x3c7cb1,_0x4b4d07))['catch'](handleError(_0x3c7cb1,null));};exports['show']=function(_0x66cf81,_0x4fd771){var _0x1bb1f9={'raw':!![],'where':{'id':_0x66cf81[_0x2c62('0x3d')]['id']}},_0x313364={};_0x313364[_0x2c62('0x28')]=_[_0x2c62('0x2a')](db['VtigerField']['rawAttributes']);_0x313364[_0x2c62('0x29')]=_[_0x2c62('0x2a')](_0x66cf81[_0x2c62('0x29')]);_0x313364['filters']=_[_0x2c62('0x2c')](_0x313364[_0x2c62('0x28')],_0x313364[_0x2c62('0x29')]);_0x1bb1f9[_0x2c62('0x2d')]=_[_0x2c62('0x2c')](_0x313364['model'],qs[_0x2c62('0x2e')](_0x66cf81['query']['fields']));_0x1bb1f9[_0x2c62('0x2d')]=_0x1bb1f9['attributes'][_0x2c62('0x2f')]?_0x1bb1f9[_0x2c62('0x2d')]:_0x313364[_0x2c62('0x28')];if(_0x66cf81[_0x2c62('0x29')][_0x2c62('0x3a')]){_0x1bb1f9[_0x2c62('0x3e')]=[{'all':!![]}];}_0x1bb1f9=_[_0x2c62('0x36')]({},_0x1bb1f9,_0x66cf81[_0x2c62('0x38')]);return db[_0x2c62('0x39')][_0x2c62('0x3f')](_0x1bb1f9)[_0x2c62('0x1f')](handleEntityNotFound(_0x4fd771,null))[_0x2c62('0x1f')](respondWithResult(_0x4fd771,null))[_0x2c62('0x40')](handleError(_0x4fd771,null));};exports[_0x2c62('0x41')]=function(_0x67789a,_0xeeb052){return db[_0x2c62('0x39')]['create'](_0x67789a[_0x2c62('0x42')],{})[_0x2c62('0x1f')](respondWithResult(_0xeeb052,0xc9))[_0x2c62('0x40')](handleError(_0xeeb052,null));};exports[_0x2c62('0x43')]=function(_0x288855,_0x4eb497){if(_0x288855[_0x2c62('0x42')]['id']){delete _0x288855[_0x2c62('0x42')]['id'];}return db[_0x2c62('0x39')][_0x2c62('0x3f')]({'where':{'id':_0x288855[_0x2c62('0x3d')]['id']}})[_0x2c62('0x1f')](handleEntityNotFound(_0x4eb497,null))['then'](saveUpdates(_0x288855[_0x2c62('0x42')],null))[_0x2c62('0x1f')](respondWithResult(_0x4eb497,null))[_0x2c62('0x40')](handleError(_0x4eb497,null));};exports[_0x2c62('0x20')]=function(_0x258301,_0x3443bb){return db[_0x2c62('0x39')][_0x2c62('0x3f')]({'where':{'id':_0x258301[_0x2c62('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3443bb,null))[_0x2c62('0x1f')](removeEntity(_0x3443bb,null))['catch'](handleError(_0x3443bb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c00fe28..91d9f37 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 _0x00bb=['request-promise','path','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','moment'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x00bb,0x1d8));var _0xb00b=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x00bb[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[{'name':_0xb00b('0xb'),'fields':[_0xb00b('0xc'),_0xb00b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbdb7=['define','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5024c7,_0xd560bd){_0x5024c7=_0x5024c7-0x0;var _0xf2f316=_0xbdb7[_0x5024c7];return _0xf2f316;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7bdb('0xb'),'fields':[_0x7bdb('0xc'),'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 7afd097..b47d572 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 _0x30fc=['VtigerField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x45b457,_0x576da6){var _0x4eb5f8=function(_0x27e4b7){while(--_0x27e4b7){_0x45b457['push'](_0x45b457['shift']());}};_0x4eb5f8(++_0x576da6);}(_0x30fc,0x64));var _0xc30f=function(_0x3412e0,_0x5c4e4f){_0x3412e0=_0x3412e0-0x0;var _0x479b68=_0x30fc[_0x3412e0];return _0x479b68;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var moment=require('moment');var BPromise=require(_0xc30f('0x2'));var rs=require(_0xc30f('0x3'));var fs=require('fs');var Redis=require(_0xc30f('0x4'));var db=require(_0xc30f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc30f('0x6'))(_0xc30f('0x7'));var config=require(_0xc30f('0x8'));var jayson=require(_0xc30f('0x9'));var client=jayson[_0xc30f('0xa')][_0xc30f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c174,_0x23528c,_0x325a64){return new BPromise(function(_0x33a769,_0x3d2167){return client[_0xc30f('0xc')](_0x54c174,_0x325a64)[_0xc30f('0xd')](function(_0x436059){logger[_0xc30f('0xe')](_0xc30f('0xf'),_0x23528c,'request\x20sent');logger[_0xc30f('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x23528c,_0xc30f('0x11'),JSON[_0xc30f('0x12')](_0x436059));if(_0x436059[_0xc30f('0x13')]){if(_0x436059[_0xc30f('0x13')][_0xc30f('0x14')]===0x1f4){logger[_0xc30f('0x13')]('VtigerField,\x20%s,\x20%s',_0x23528c,_0x436059['error'][_0xc30f('0x15')]);return _0x3d2167(_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);}logger[_0xc30f('0x13')]('VtigerField,\x20%s,\x20%s',_0x23528c,_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);return _0x33a769(_0x436059[_0xc30f('0x13')][_0xc30f('0x15')]);}else{logger[_0xc30f('0xe')](_0xc30f('0xf'),_0x23528c,_0xc30f('0x11'));_0x33a769(_0x436059['result']['message']);}})[_0xc30f('0x16')](function(_0x1b02c5){logger[_0xc30f('0x13')](_0xc30f('0xf'),_0x23528c,_0x1b02c5);_0x3d2167(_0x1b02c5);});});} \ No newline at end of file +var _0xbc9d=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x12d05f,_0x521393){_0x12d05f=_0x12d05f-0x0;var _0x5bf7a6=_0xbc9d[_0x12d05f];return _0x5bf7a6;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var moment=require(_0xdbc9('0x2'));var BPromise=require(_0xdbc9('0x3'));var rs=require(_0xdbc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbc9('0x5'))(_0xdbc9('0x6'));var config=require(_0xdbc9('0x7'));var jayson=require(_0xdbc9('0x8'));var client=jayson[_0xdbc9('0x9')][_0xdbc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x381a0e,_0x4a9246,_0x2dbd23){return new BPromise(function(_0x181f8a,_0x3d4918){return client['request'](_0x381a0e,_0x2dbd23)[_0xdbc9('0xb')](function(_0x53cff1){logger['info'](_0xdbc9('0xc'),_0x4a9246,_0xdbc9('0xd'));logger[_0xdbc9('0xe')](_0xdbc9('0xf'),_0x4a9246,'request\x20sent',JSON[_0xdbc9('0x10')](_0x53cff1));if(_0x53cff1[_0xdbc9('0x11')]){if(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x12')]===0x1f4){logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x53cff1['error']['message']);return _0x3d4918(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x13')]);}logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x53cff1[_0xdbc9('0x11')]['message']);return _0x181f8a(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x13')]);}else{logger[_0xdbc9('0x14')]('VtigerField,\x20%s,\x20%s',_0x4a9246,_0xdbc9('0xd'));_0x181f8a(_0x53cff1[_0xdbc9('0x15')]['message']);}})[_0xdbc9('0x16')](function(_0x37856d){logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x37856d);_0x3d4918(_0x37856d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 2ceb511..2ccb10b 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 _0xc5a3=['/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id'];(function(_0x542a5d,_0x27e6c8){var _0x251378=function(_0x295247){while(--_0x295247){_0x542a5d['push'](_0x542a5d['shift']());}};_0x251378(++_0x27e6c8);}(_0xc5a3,0x121));var _0x3c5a=function(_0x22d8b6,_0x368a0b){_0x22d8b6=_0x22d8b6-0x0;var _0x10315c=_0xc5a3[_0x22d8b6];return _0x10315c;};'use strict';var multer=require(_0x3c5a('0x0'));var util=require(_0x3c5a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3c5a('0x2'));var router=express[_0x3c5a('0x3')]();var auth=require(_0x3c5a('0x4'));var interaction=require(_0x3c5a('0x5'));var config=require(_0x3c5a('0x6'));var controller=require(_0x3c5a('0x7'));router[_0x3c5a('0x8')]('/',auth[_0x3c5a('0x9')](),controller['index']);router[_0x3c5a('0x8')](_0x3c5a('0xa'),auth[_0x3c5a('0x9')](),controller['show']);router['get'](_0x3c5a('0xb'),auth[_0x3c5a('0x9')](),controller['getConfigurations']);router[_0x3c5a('0x8')](_0x3c5a('0xc'),auth[_0x3c5a('0x9')](),controller['getFields']);router[_0x3c5a('0xd')]('/',auth['isAuthenticated'](),controller[_0x3c5a('0xe')]);router[_0x3c5a('0xd')](_0x3c5a('0xb'),auth[_0x3c5a('0x9')](),controller[_0x3c5a('0xf')]);router[_0x3c5a('0x10')](_0x3c5a('0xa'),auth['isAuthenticated'](),controller[_0x3c5a('0x11')]);router[_0x3c5a('0x12')]('/:id',auth[_0x3c5a('0x9')](),controller['destroy']);module[_0x3c5a('0x13')]=router; \ No newline at end of file +var _0xd98c=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','put','update','delete','destroy','exports','multer','util'];(function(_0x21fded,_0x203183){var _0x5927de=function(_0x1e5762){while(--_0x1e5762){_0x21fded['push'](_0x21fded['shift']());}};_0x5927de(++_0x203183);}(_0xd98c,0x129));var _0xcd98=function(_0x3619b2,_0xfb1234){_0x3619b2=_0x3619b2-0x0;var _0x1dc91e=_0xd98c[_0x3619b2];return _0x1dc91e;};'use strict';var multer=require(_0xcd98('0x0'));var util=require(_0xcd98('0x1'));var path=require('path');var timeout=require(_0xcd98('0x2'));var express=require(_0xcd98('0x3'));var router=express[_0xcd98('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcd98('0x5'));var config=require(_0xcd98('0x6'));var controller=require(_0xcd98('0x7'));router[_0xcd98('0x8')]('/',auth[_0xcd98('0x9')](),controller[_0xcd98('0xa')]);router[_0xcd98('0x8')](_0xcd98('0xb'),auth['isAuthenticated'](),controller[_0xcd98('0xc')]);router[_0xcd98('0x8')](_0xcd98('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xcd98('0xe'),auth[_0xcd98('0x9')](),controller[_0xcd98('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd98('0x10')]);router[_0xcd98('0x11')]('/:id/configurations',auth[_0xcd98('0x9')](),controller['addConfiguration']);router[_0xcd98('0x12')](_0xcd98('0xb'),auth[_0xcd98('0x9')](),controller[_0xcd98('0x13')]);router[_0xcd98('0x14')](_0xcd98('0xb'),auth['isAuthenticated'](),controller[_0xcd98('0x15')]);module[_0xcd98('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index f32fae3..17f4399 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 _0x98b7=['sequelize','exports','STRING','remoteUri','password','token','integrationTab','newTab'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x98b7,0xc0));var _0x798b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x98b7[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x798b('0x0'));module[_0x798b('0x1')]={'name':{'type':Sequelize[_0x798b('0x2')]},'description':{'type':Sequelize[_0x798b('0x2')]},'username':{'type':Sequelize[_0x798b('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x798b('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x798b('0x2')],'unique':_0x798b('0x3')},'authType':{'type':Sequelize['ENUM'](_0x798b('0x4'),_0x798b('0x5')),'defaultValue':_0x798b('0x4')},'serverUrl':{'type':Sequelize[_0x798b('0x2')]},'type':{'type':Sequelize['ENUM'](_0x798b('0x6'),_0x798b('0x7')),'defaultValue':_0x798b('0x6')}}; \ No newline at end of file +var _0xb833=['password','token','integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xb833,0x1e9));var _0x3b83=function(_0x1197aa,_0x13d14d){_0x1197aa=_0x1197aa-0x0;var _0x11eda7=_0xb833[_0x1197aa];return _0x11eda7;};'use strict';var Sequelize=require(_0x3b83('0x0'));module[_0x3b83('0x1')]={'name':{'type':Sequelize[_0x3b83('0x2')]},'description':{'type':Sequelize[_0x3b83('0x2')]},'username':{'type':Sequelize[_0x3b83('0x2')],'unique':_0x3b83('0x3')},'password':{'type':Sequelize[_0x3b83('0x2')]},'token':{'type':Sequelize[_0x3b83('0x2')]},'remoteUri':{'type':Sequelize[_0x3b83('0x2')],'unique':_0x3b83('0x4')},'authType':{'type':Sequelize[_0x3b83('0x5')](_0x3b83('0x6'),_0x3b83('0x7')),'defaultValue':_0x3b83('0x6')},'serverUrl':{'type':Sequelize[_0x3b83('0x2')]},'type':{'type':Sequelize[_0x3b83('0x5')](_0x3b83('0x8'),'newTab'),'defaultValue':_0x3b83('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2297afb..8691973 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 _0x31d3=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','../../components/integrations/configuration','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','set','reject','save','update','stack','name','send','map','ZendeskAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','options','find','create','body','params','destroy','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','token','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','position','title','system_field_options','custom_field_options','statusCode','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv'];(function(_0x17e006,_0x10b1b2){var _0x49453f=function(_0x55556c){while(--_0x55556c){_0x17e006['push'](_0x17e006['shift']());}};_0x49453f(++_0x10b1b2);}(_0x31d3,0x159));var _0x331d=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0x31d3[_0x44a3b0];return _0x39e6f6;};'use strict';var pdf=require(_0x331d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x331d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x331d('0x2'));var rp=require('request-promise');var moment=require(_0x331d('0x3'));var BPromise=require(_0x331d('0x4'));var Mustache=require(_0x331d('0x5'));var util=require(_0x331d('0x6'));var path=require(_0x331d('0x7'));var sox=require(_0x331d('0x8'));var csv=require('to-csv');var ejs=require(_0x331d('0x9'));var fs=require('fs');var _=require(_0x331d('0xa'));var squel=require(_0x331d('0xb'));var crypto=require(_0x331d('0xc'));var jsforce=require(_0x331d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x331d('0xe'));var querystring=require(_0x331d('0xf'));var Papa=require(_0x331d('0x10'));var Redis=require(_0x331d('0x11'));var authService=require(_0x331d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x331d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x331d('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x331d('0x15'))['db'];var integrations=require(_0x331d('0x16'));var jayson=require('jayson/promise');var client=jayson['client'][_0x331d('0x17')]({'port':0x232a});function checkPasswordPattern(_0x1a1877,_0x31f410,_0x50b8ee){if(_0x50b8ee){var _0x979b59=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x979b59[_0x331d('0x18')](_0x31f410)){return _0x1a1877;}else{throw new db[(_0x331d('0x19'))]['ValidationError'](_0x331d('0x1a'));}}else{return _0x1a1877;}}function respondWithRpcPromise(_0x2a4a0d,_0x3534f6,_0x27e7c5,_0x1f18b4){return new BPromise(function(_0x4ca3bf,_0x59cc9d){var _0x2879f7=_0x1f18b4||client;return _0x2879f7['request'](_0x2a4a0d,_0x27e7c5)[_0x331d('0x1b')](function(_0x480e88){logger['info'](_0x331d('0x1c'),_0x3534f6,_0x331d('0x1d'));logger[_0x331d('0x1e')](_0x331d('0x1f'),_0x3534f6,_0x331d('0x1d'),JSON['stringify'](_0x480e88));if(_0x480e88[_0x331d('0x20')]){if(_0x480e88[_0x331d('0x20')][_0x331d('0x21')]===0x1f4){logger['error'](_0x331d('0x1c'),_0x3534f6,_0x480e88['error'][_0x331d('0x22')]);return _0x59cc9d(_0x480e88[_0x331d('0x20')]['message']);}logger[_0x331d('0x20')](_0x331d('0x1c'),_0x3534f6,_0x480e88['error'][_0x331d('0x22')]);return _0x4ca3bf(_0x480e88[_0x331d('0x20')][_0x331d('0x22')]);}else{logger[_0x331d('0x23')](_0x331d('0x1c'),_0x3534f6,_0x331d('0x1d'));_0x4ca3bf(_0x480e88[_0x331d('0x24')]['message']);}})[_0x331d('0x25')](function(_0xbd0bdf){logger[_0x331d('0x20')](_0x331d('0x1c'),_0x3534f6,_0xbd0bdf);_0x59cc9d(_0xbd0bdf);});});}function respondWithStatusCode(_0x5ee113,_0x202035){_0x202035=_0x202035||0xcc;return function(_0xce1d78){if(_0xce1d78){return _0x5ee113[_0x331d('0x26')](_0x202035);}return _0x5ee113[_0x331d('0x27')](_0x202035)[_0x331d('0x28')]();};}function respondWithResult(_0xb783d3,_0x249874){_0x249874=_0x249874||0xc8;return function(_0x7c9a64){if(_0x7c9a64){return _0xb783d3['status'](_0x249874)[_0x331d('0x29')](_0x7c9a64);}};}function respondWithFilteredResult(_0x5acada,_0xd6ec8){return function(_0x1dba34){if(_0x1dba34){var _0x2b06b1=_0x1dba34[_0x331d('0x2a')],_0x506faf=_0xd6ec8[_0x331d('0x2b')],_0x528bf5=_0xd6ec8['offset']+_0xd6ec8['limit'],_0x5c1c87;if(_0x528bf5>=_0x2b06b1){_0x528bf5=_0x2b06b1;_0x5c1c87=0xc8;}else{_0x5c1c87=0xce;}_0x5acada['status'](_0x5c1c87);return _0x5acada[_0x331d('0x2c')]('Content-Range',_0x506faf+'-'+_0x528bf5+'/'+_0x2b06b1)['json'](_0x1dba34);}return null;};}function patchUpdates(_0x526d44){return function(_0x534f03){try{jsonpatch['apply'](_0x534f03,_0x526d44,!![]);}catch(_0x32529b){return BPromise[_0x331d('0x2d')](_0x32529b);}return _0x534f03[_0x331d('0x2e')]();};}function saveUpdates(_0x5b1061,_0x2222e2){return function(_0x481857){if(_0x481857){return _0x481857[_0x331d('0x2f')](_0x5b1061)['then'](function(_0x5b7e88){return _0x5b7e88;});}return null;};}function removeEntity(_0x5b3877,_0x250821){return function(_0x3e5e3f){if(_0x3e5e3f){return _0x3e5e3f['destroy']()['then'](function(){_0x5b3877['status'](0xcc)[_0x331d('0x28')]();});}};}function handleEntityNotFound(_0x50ea3f,_0x22e342){return function(_0x1e274c){if(!_0x1e274c){_0x50ea3f[_0x331d('0x26')](0x194);}return _0x1e274c;};}function handleError(_0x9d6b96,_0x3c1ed7){_0x3c1ed7=_0x3c1ed7||0x1f4;return function(_0x4cfe80){logger[_0x331d('0x20')](_0x4cfe80[_0x331d('0x30')]);if(_0x4cfe80[_0x331d('0x31')]){delete _0x4cfe80[_0x331d('0x31')];}_0x9d6b96[_0x331d('0x27')](_0x3c1ed7)[_0x331d('0x32')](_0x4cfe80);};}exports['index']=function(_0x165820,_0x1f0968){var _0xc1b3f2={},_0x3da6ff={},_0x2b20d6={'count':0x0,'rows':[]};var _0x469601=_[_0x331d('0x33')](db[_0x331d('0x34')][_0x331d('0x35')],function(_0x53c0b1){return{'name':_0x53c0b1[_0x331d('0x36')],'type':_0x53c0b1[_0x331d('0x37')]['key']};});_0x3da6ff[_0x331d('0x38')]=_[_0x331d('0x33')](_0x469601,'name');_0x3da6ff['query']=_[_0x331d('0x39')](_0x165820[_0x331d('0x3a')]);_0x3da6ff[_0x331d('0x3b')]=_[_0x331d('0x3c')](_0x3da6ff[_0x331d('0x38')],_0x3da6ff[_0x331d('0x3a')]);_0xc1b3f2[_0x331d('0x3d')]=_[_0x331d('0x3c')](_0x3da6ff[_0x331d('0x38')],qs[_0x331d('0x3e')](_0x165820['query'][_0x331d('0x3e')]));_0xc1b3f2[_0x331d('0x3d')]=_0xc1b3f2[_0x331d('0x3d')][_0x331d('0x3f')]?_0xc1b3f2[_0x331d('0x3d')]:_0x3da6ff[_0x331d('0x38')];if(!_0x165820[_0x331d('0x3a')][_0x331d('0x40')](_0x331d('0x41'))){_0xc1b3f2['limit']=qs[_0x331d('0x42')](_0x165820[_0x331d('0x3a')][_0x331d('0x42')]);_0xc1b3f2[_0x331d('0x2b')]=qs['offset'](_0x165820['query'][_0x331d('0x2b')]);}_0xc1b3f2[_0x331d('0x43')]=qs[_0x331d('0x44')](_0x165820['query']['sort']);_0xc1b3f2['where']=qs[_0x331d('0x3b')](_[_0x331d('0x45')](_0x165820[_0x331d('0x3a')],_0x3da6ff[_0x331d('0x3b')]),_0x469601);if(_0x165820['query'][_0x331d('0x46')]){_0xc1b3f2['where']=_[_0x331d('0x47')](_0xc1b3f2['where'],{'$or':_[_0x331d('0x33')](_0x469601,function(_0x3185ca){if(_0x3185ca[_0x331d('0x37')]!==_0x331d('0x48')){var _0x5d8be={};_0x5d8be[_0x3185ca[_0x331d('0x31')]]={'$like':'%'+_0x165820[_0x331d('0x3a')][_0x331d('0x46')]+'%'};return _0x5d8be;}})});}_0xc1b3f2=_[_0x331d('0x47')]({},_0xc1b3f2,_0x165820['options']);var _0x373aa6={'where':_0xc1b3f2[_0x331d('0x49')]};return db['ZendeskAccount'][_0x331d('0x2a')](_0x373aa6)[_0x331d('0x1b')](function(_0x5e3f6c){_0x2b20d6[_0x331d('0x2a')]=_0x5e3f6c;if(_0x165820[_0x331d('0x3a')][_0x331d('0x4a')]){_0xc1b3f2[_0x331d('0x4b')]=[{'all':!![]}];}return db[_0x331d('0x34')][_0x331d('0x4c')](_0xc1b3f2);})[_0x331d('0x1b')](function(_0x4d0527){_0x2b20d6['rows']=_0x4d0527;return _0x2b20d6;})[_0x331d('0x1b')](respondWithFilteredResult(_0x1f0968,_0xc1b3f2))[_0x331d('0x25')](handleError(_0x1f0968,null));};exports['show']=function(_0x2a5726,_0x44c989){var _0xa5aa29={'raw':![],'where':{'id':_0x2a5726['params']['id']}},_0x2ea35a={};_0x2ea35a[_0x331d('0x38')]=_['keys'](db[_0x331d('0x34')][_0x331d('0x35')]);_0x2ea35a[_0x331d('0x3a')]=_[_0x331d('0x39')](_0x2a5726[_0x331d('0x3a')]);_0x2ea35a[_0x331d('0x3b')]=_[_0x331d('0x3c')](_0x2ea35a['model'],_0x2ea35a[_0x331d('0x3a')]);_0xa5aa29[_0x331d('0x3d')]=_[_0x331d('0x3c')](_0x2ea35a[_0x331d('0x38')],qs[_0x331d('0x3e')](_0x2a5726[_0x331d('0x3a')][_0x331d('0x3e')]));_0xa5aa29['attributes']=_0xa5aa29[_0x331d('0x3d')]['length']?_0xa5aa29[_0x331d('0x3d')]:_0x2ea35a[_0x331d('0x38')];if(_0x2a5726[_0x331d('0x3a')][_0x331d('0x4a')]){_0xa5aa29[_0x331d('0x4b')]=[{'all':!![]}];}_0xa5aa29=_[_0x331d('0x47')]({},_0xa5aa29,_0x2a5726[_0x331d('0x4d')]);return db[_0x331d('0x34')][_0x331d('0x4e')](_0xa5aa29)[_0x331d('0x1b')](handleEntityNotFound(_0x44c989,null))['then'](respondWithResult(_0x44c989,null))['catch'](handleError(_0x44c989,null));};exports['create']=function(_0x37d45e,_0x5036e8){return db[_0x331d('0x34')][_0x331d('0x4f')](_0x37d45e['body'],{})[_0x331d('0x1b')](respondWithResult(_0x5036e8,0xc9))[_0x331d('0x25')](handleError(_0x5036e8,null));};exports[_0x331d('0x2f')]=function(_0x209d20,_0x2ee748){if(_0x209d20[_0x331d('0x50')]['id']){delete _0x209d20[_0x331d('0x50')]['id'];}return db['ZendeskAccount'][_0x331d('0x4e')]({'where':{'id':_0x209d20[_0x331d('0x51')]['id']}})[_0x331d('0x1b')](handleEntityNotFound(_0x2ee748,null))[_0x331d('0x1b')](saveUpdates(_0x209d20[_0x331d('0x50')],null))['then'](respondWithResult(_0x2ee748,null))[_0x331d('0x25')](handleError(_0x2ee748,null));};exports[_0x331d('0x52')]=function(_0x38c8ec,_0x290a5b){return db['ZendeskAccount']['find']({'where':{'id':_0x38c8ec['params']['id']}})['then'](handleEntityNotFound(_0x290a5b,null))[_0x331d('0x1b')](removeEntity(_0x290a5b,null))[_0x331d('0x25')](handleError(_0x290a5b,null));};exports[_0x331d('0x53')]=function(_0x120665,_0xff2370,_0x59e4c7){var _0x4cef51={};var _0x5128f1={};var _0x43a0f5;var _0x29841a;return db[_0x331d('0x34')]['findOne']({'where':{'id':_0x120665[_0x331d('0x51')]['id']}})['then'](handleEntityNotFound(_0xff2370,null))[_0x331d('0x1b')](function(_0x29d5b9){if(_0x29d5b9){_0x43a0f5=_0x29d5b9;_0x5128f1[_0x331d('0x38')]=_['keys'](db[_0x331d('0x54')][_0x331d('0x35')]);_0x5128f1['query']=_[_0x331d('0x39')](_0x120665['query']);_0x5128f1[_0x331d('0x3b')]=_['intersection'](_0x5128f1['model'],_0x5128f1[_0x331d('0x3a')]);_0x4cef51['attributes']=_[_0x331d('0x3c')](_0x5128f1['model'],qs[_0x331d('0x3e')](_0x120665[_0x331d('0x3a')][_0x331d('0x3e')]));_0x4cef51[_0x331d('0x3d')]=_0x4cef51['attributes'][_0x331d('0x3f')]?_0x4cef51['attributes']:_0x5128f1[_0x331d('0x38')];_0x4cef51['order']=qs[_0x331d('0x44')](_0x120665[_0x331d('0x3a')]['sort']);_0x4cef51['where']=qs[_0x331d('0x3b')](_[_0x331d('0x45')](_0x120665[_0x331d('0x3a')],_0x5128f1['filters']));if(_0x120665[_0x331d('0x3a')]['filter']){_0x4cef51[_0x331d('0x49')]=_[_0x331d('0x47')](_0x4cef51[_0x331d('0x49')],{'$or':_[_0x331d('0x33')](_0x4cef51['attributes'],function(_0x3953de){var _0x558fda={};_0x558fda[_0x3953de]={'$like':'%'+_0x120665['query'][_0x331d('0x46')]+'%'};return _0x558fda;})});}_0x4cef51=_['merge']({},_0x4cef51,_0x120665[_0x331d('0x4d')]);return _0x43a0f5['getConfigurations'](_0x4cef51);}})[_0x331d('0x1b')](function(_0x2068c5){if(_0x2068c5){_0x29841a=_0x2068c5['length'];if(!_0x120665[_0x331d('0x3a')][_0x331d('0x40')](_0x331d('0x41'))){_0x4cef51[_0x331d('0x42')]=qs[_0x331d('0x42')](_0x120665['query'][_0x331d('0x42')]);_0x4cef51[_0x331d('0x2b')]=qs[_0x331d('0x2b')](_0x120665[_0x331d('0x3a')][_0x331d('0x2b')]);}return _0x43a0f5['getConfigurations'](_0x4cef51);}})['then'](function(_0x534365){if(_0x534365){return _0x534365?{'count':_0x29841a,'rows':_0x534365}:null;}})[_0x331d('0x1b')](respondWithResult(_0xff2370,null))['catch'](handleError(_0xff2370,null));};exports[_0x331d('0x55')]=function(_0x1a3404,_0x422585,_0x5bab7c){if(_0x1a3404[_0x331d('0x50')]['id']){delete _0x1a3404['body']['id'];}return db['ZendeskAccount'][_0x331d('0x56')]({'where':{'id':_0x1a3404['params']['id']}})[_0x331d('0x1b')](handleEntityNotFound(_0x422585,null))[_0x331d('0x1b')](function(_0x455474){if(_0x455474){_0x1a3404['body'][_0x331d('0x57')]=_0x455474['id'];_0x1a3404[_0x331d('0x50')][_0x331d('0x58')]=integrations[_0x331d('0x59')](_0x1a3404['body'][_0x331d('0x5a')],_0x1a3404[_0x331d('0x50')][_0x331d('0x37')]);_0x1a3404[_0x331d('0x50')]['Descriptions']=integrations[_0x331d('0x5b')](_0x1a3404[_0x331d('0x50')][_0x331d('0x5a')],_0x1a3404[_0x331d('0x50')]['type']);return db[_0x331d('0x54')][_0x331d('0x4f')](_0x1a3404[_0x331d('0x50')],{'include':[{'model':db[_0x331d('0x5c')],'as':'Subjects'},{'model':db[_0x331d('0x5c')],'as':_0x331d('0x5d')}]});}return null;})[_0x331d('0x1b')](respondWithResult(_0x422585,null))[_0x331d('0x25')](handleError(_0x422585,null));};exports[_0x331d('0x5e')]=function(_0x43e4b4,_0xb8c9fa,_0xd6d7aa){var _0x571da4='';return db[_0x331d('0x34')][_0x331d('0x56')]({'where':{'id':_0x43e4b4['params']['id']},'attributes':['id',_0x331d('0x5f'),_0x331d('0x60'),'token',_0x331d('0x61'),_0x331d('0x62')]})[_0x331d('0x1b')](handleEntityNotFound(_0xb8c9fa,null))[_0x331d('0x1b')](function(_0x26cfcc){if(_0x26cfcc){_0x571da4=_0x26cfcc['remoteUri'];var _0x1908aa=_0x571da4[_0x331d('0x63')](-0x1);if(_0x1908aa==='/'){_0x571da4=_0x571da4[_0x331d('0x64')](0x0,_0x571da4[_0x331d('0x65')](_0x1908aa));}var _0x30dc4c={'method':'GET','uri':util[_0x331d('0x66')]('%s/%s',_0x571da4,_0x331d('0x67')),'json':!![]};switch(_0x26cfcc['authType']){case _0x331d('0x60'):_0x30dc4c[_0x331d('0x68')]={'Authorization':util[_0x331d('0x66')](_0x331d('0x69'),new Buffer(util['format'](_0x331d('0x6a'),_0x26cfcc[_0x331d('0x5f')],_0x26cfcc['password']))[_0x331d('0x6b')]('base64'))};break;case _0x331d('0x6c'):_0x30dc4c[_0x331d('0x68')]={'Authorization':util[_0x331d('0x66')](_0x331d('0x69'),new Buffer(util[_0x331d('0x66')](_0x331d('0x6d'),_0x26cfcc[_0x331d('0x5f')],_0x26cfcc['token']))[_0x331d('0x6b')]('base64'))};break;default:throw new db[(_0x331d('0x19'))][(_0x331d('0x6e'))](_0x331d('0x6f'));}return rp(_0x30dc4c);}})[_0x331d('0x1b')](function(_0x2effa4){if(_0x2effa4){var _0x3ebc5b=[_0x331d('0x70'),_0x331d('0x71'),'group','assignee'];_[_0x331d('0x72')](_0x2effa4['ticket_fields'],function(_0x17d6b9){return _0x3ebc5b['includes'](_0x17d6b9[_0x331d('0x37')]);});return{'count':_0x2effa4[_0x331d('0x67')][_0x331d('0x3f')],'rows':_[_0x331d('0x33')](_0x2effa4['ticket_fields'],function(_0x5908d2){return{'id':_0x5908d2['id'],'name':_0x5908d2[_0x331d('0x73')]>0x7?_0x5908d2[_0x331d('0x74')]:_0x5908d2[_0x331d('0x37')],'custom':_0x5908d2[_0x331d('0x73')]>0x7?!![]:![],'options':_0x5908d2[_0x331d('0x75')]?_0x5908d2[_0x331d('0x75')]:_0x5908d2[_0x331d('0x76')]?_0x5908d2[_0x331d('0x76')]:[]};})};}})[_0x331d('0x1b')](respondWithResult(_0xb8c9fa,null))['catch'](function(_0x15eaaa){var _0x143dd0=_0x43e4b4[_0x331d('0x3a')][_0x331d('0x18')]?0x1f4:_0x15eaaa[_0x331d('0x77')]||0x1f4;logger[_0x331d('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x331d('0x5e'),_0x143dd0,JSON['stringify'](_0x15eaaa));delete _0x15eaaa[_0x331d('0x31')];if(_0x143dd0===0x191){_0x143dd0=0x190;}_0xb8c9fa[_0x331d('0x27')](_0x143dd0)['send'](_0x43e4b4[_0x331d('0x3a')][_0x331d('0x18')]?{'message':'Wrong\x20credentials','statusCode':_0x15eaaa[_0x331d('0x77')]}:_0x15eaaa);});}; \ No newline at end of file +var _0x1e8c=['../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','count','include','ZendeskAccount','findAll','rows','show','includeAll','options','find','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','Unknown\x20authentication\x20type','description','group','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x1e8c,0x17d));var _0xc1e8=function(_0x4b332a,_0x5ec2db){_0x4b332a=_0x4b332a-0x0;var _0x115a04=_0x1e8c[_0x4b332a];return _0x115a04;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc1e8('0x0'));var zipdir=require(_0xc1e8('0x1'));var jsonpatch=require(_0xc1e8('0x2'));var rp=require(_0xc1e8('0x3'));var moment=require(_0xc1e8('0x4'));var BPromise=require(_0xc1e8('0x5'));var Mustache=require(_0xc1e8('0x6'));var util=require('util');var path=require(_0xc1e8('0x7'));var sox=require('sox');var csv=require(_0xc1e8('0x8'));var ejs=require(_0xc1e8('0x9'));var fs=require('fs');var _=require(_0xc1e8('0xa'));var squel=require(_0xc1e8('0xb'));var crypto=require(_0xc1e8('0xc'));var jsforce=require(_0xc1e8('0xd'));var deskjs=require(_0xc1e8('0xe'));var toCsv=require(_0xc1e8('0x8'));var querystring=require('querystring');var Papa=require(_0xc1e8('0xf'));var Redis=require(_0xc1e8('0x10'));var authService=require(_0xc1e8('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1e8('0x12'));var logger=require('../../config/logger')(_0xc1e8('0x13'));var utils=require(_0xc1e8('0x14'));var config=require(_0xc1e8('0x15'));var db=require(_0xc1e8('0x16'))['db'];var integrations=require(_0xc1e8('0x17'));var jayson=require(_0xc1e8('0x18'));var client=jayson[_0xc1e8('0x19')][_0xc1e8('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4066d0,_0x4d502e,_0x3ac5c0){if(_0x3ac5c0){var _0x8b48dd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8b48dd['test'](_0x4d502e)){return _0x4066d0;}else{throw new db[(_0xc1e8('0x1b'))][(_0xc1e8('0x1c'))](_0xc1e8('0x1d'));}}else{return _0x4066d0;}}function respondWithRpcPromise(_0x419c62,_0x3ca6dc,_0x536175,_0x227ca2){return new BPromise(function(_0x5a1ab1,_0x3aaf03){var _0x2ed92e=_0x227ca2||client;return _0x2ed92e[_0xc1e8('0x1e')](_0x419c62,_0x536175)[_0xc1e8('0x1f')](function(_0x37ab28){logger[_0xc1e8('0x20')](_0xc1e8('0x21'),_0x3ca6dc,_0xc1e8('0x22'));logger[_0xc1e8('0x23')](_0xc1e8('0x24'),_0x3ca6dc,_0xc1e8('0x22'),JSON[_0xc1e8('0x25')](_0x37ab28));if(_0x37ab28[_0xc1e8('0x26')]){if(_0x37ab28[_0xc1e8('0x26')][_0xc1e8('0x27')]===0x1f4){logger[_0xc1e8('0x26')](_0xc1e8('0x21'),_0x3ca6dc,_0x37ab28[_0xc1e8('0x26')]['message']);return _0x3aaf03(_0x37ab28[_0xc1e8('0x26')][_0xc1e8('0x28')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x3ca6dc,_0x37ab28[_0xc1e8('0x26')][_0xc1e8('0x28')]);return _0x5a1ab1(_0x37ab28[_0xc1e8('0x26')][_0xc1e8('0x28')]);}else{logger['info'](_0xc1e8('0x21'),_0x3ca6dc,_0xc1e8('0x22'));_0x5a1ab1(_0x37ab28[_0xc1e8('0x29')]['message']);}})[_0xc1e8('0x2a')](function(_0x572142){logger[_0xc1e8('0x26')](_0xc1e8('0x21'),_0x3ca6dc,_0x572142);_0x3aaf03(_0x572142);});});}function respondWithStatusCode(_0x21c229,_0x248c55){_0x248c55=_0x248c55||0xcc;return function(_0x36745f){if(_0x36745f){return _0x21c229[_0xc1e8('0x2b')](_0x248c55);}return _0x21c229[_0xc1e8('0x2c')](_0x248c55)[_0xc1e8('0x2d')]();};}function respondWithResult(_0x17f146,_0x329408){_0x329408=_0x329408||0xc8;return function(_0x340b7a){if(_0x340b7a){return _0x17f146['status'](_0x329408)[_0xc1e8('0x2e')](_0x340b7a);}};}function respondWithFilteredResult(_0x230ca1,_0x27a9c3){return function(_0x44615e){if(_0x44615e){var _0xe2f12b=_0x44615e['count'],_0x48b0de=_0x27a9c3[_0xc1e8('0x2f')],_0x2a4a6c=_0x27a9c3[_0xc1e8('0x2f')]+_0x27a9c3[_0xc1e8('0x30')],_0x5b9074;if(_0x2a4a6c>=_0xe2f12b){_0x2a4a6c=_0xe2f12b;_0x5b9074=0xc8;}else{_0x5b9074=0xce;}_0x230ca1[_0xc1e8('0x2c')](_0x5b9074);return _0x230ca1[_0xc1e8('0x31')]('Content-Range',_0x48b0de+'-'+_0x2a4a6c+'/'+_0xe2f12b)[_0xc1e8('0x2e')](_0x44615e);}return null;};}function patchUpdates(_0xae1018){return function(_0x2bec0e){try{jsonpatch[_0xc1e8('0x32')](_0x2bec0e,_0xae1018,!![]);}catch(_0x2e47af){return BPromise[_0xc1e8('0x33')](_0x2e47af);}return _0x2bec0e[_0xc1e8('0x34')]();};}function saveUpdates(_0x47b529,_0x3e7df9){return function(_0x422e95){if(_0x422e95){return _0x422e95[_0xc1e8('0x35')](_0x47b529)[_0xc1e8('0x1f')](function(_0x151e68){return _0x151e68;});}return null;};}function removeEntity(_0x73aa30,_0x23fbe7){return function(_0x3af1a4){if(_0x3af1a4){return _0x3af1a4[_0xc1e8('0x36')]()['then'](function(){_0x73aa30[_0xc1e8('0x2c')](0xcc)[_0xc1e8('0x2d')]();});}};}function handleEntityNotFound(_0x5497e2,_0x481095){return function(_0x459126){if(!_0x459126){_0x5497e2[_0xc1e8('0x2b')](0x194);}return _0x459126;};}function handleError(_0x24643b,_0xb8df02){_0xb8df02=_0xb8df02||0x1f4;return function(_0x3e9062){logger['error'](_0x3e9062[_0xc1e8('0x37')]);if(_0x3e9062[_0xc1e8('0x38')]){delete _0x3e9062['name'];}_0x24643b[_0xc1e8('0x2c')](_0xb8df02)[_0xc1e8('0x39')](_0x3e9062);};}exports[_0xc1e8('0x3a')]=function(_0x359261,_0x5a9518){var _0x5b78f1={},_0x1cd143={},_0x1d24cc={'count':0x0,'rows':[]};var _0x576bc3=_[_0xc1e8('0x3b')](db['ZendeskAccount'][_0xc1e8('0x3c')],function(_0x43d88c){return{'name':_0x43d88c[_0xc1e8('0x3d')],'type':_0x43d88c['type'][_0xc1e8('0x3e')]};});_0x1cd143[_0xc1e8('0x3f')]=_[_0xc1e8('0x3b')](_0x576bc3,_0xc1e8('0x38'));_0x1cd143[_0xc1e8('0x40')]=_[_0xc1e8('0x41')](_0x359261[_0xc1e8('0x40')]);_0x1cd143['filters']=_[_0xc1e8('0x42')](_0x1cd143[_0xc1e8('0x3f')],_0x1cd143[_0xc1e8('0x40')]);_0x5b78f1[_0xc1e8('0x43')]=_['intersection'](_0x1cd143['model'],qs[_0xc1e8('0x44')](_0x359261[_0xc1e8('0x40')][_0xc1e8('0x44')]));_0x5b78f1['attributes']=_0x5b78f1[_0xc1e8('0x43')][_0xc1e8('0x45')]?_0x5b78f1[_0xc1e8('0x43')]:_0x1cd143[_0xc1e8('0x3f')];if(!_0x359261['query'][_0xc1e8('0x46')](_0xc1e8('0x47'))){_0x5b78f1[_0xc1e8('0x30')]=qs[_0xc1e8('0x30')](_0x359261['query'][_0xc1e8('0x30')]);_0x5b78f1['offset']=qs[_0xc1e8('0x2f')](_0x359261[_0xc1e8('0x40')][_0xc1e8('0x2f')]);}_0x5b78f1[_0xc1e8('0x48')]=qs[_0xc1e8('0x49')](_0x359261[_0xc1e8('0x40')][_0xc1e8('0x49')]);_0x5b78f1[_0xc1e8('0x4a')]=qs[_0xc1e8('0x4b')](_['pick'](_0x359261[_0xc1e8('0x40')],_0x1cd143['filters']),_0x576bc3);if(_0x359261[_0xc1e8('0x40')][_0xc1e8('0x4c')]){_0x5b78f1['where']=_[_0xc1e8('0x4d')](_0x5b78f1[_0xc1e8('0x4a')],{'$or':_[_0xc1e8('0x3b')](_0x576bc3,function(_0x1a5a5e){if(_0x1a5a5e[_0xc1e8('0x4e')]!==_0xc1e8('0x4f')){var _0x4a9209={};_0x4a9209[_0x1a5a5e[_0xc1e8('0x38')]]={'$like':'%'+_0x359261[_0xc1e8('0x40')]['filter']+'%'};return _0x4a9209;}})});}_0x5b78f1=_['merge']({},_0x5b78f1,_0x359261['options']);var _0x265cb7={'where':_0x5b78f1[_0xc1e8('0x4a')]};return db['ZendeskAccount'][_0xc1e8('0x50')](_0x265cb7)[_0xc1e8('0x1f')](function(_0x2a1129){_0x1d24cc[_0xc1e8('0x50')]=_0x2a1129;if(_0x359261[_0xc1e8('0x40')]['includeAll']){_0x5b78f1[_0xc1e8('0x51')]=[{'all':!![]}];}return db[_0xc1e8('0x52')][_0xc1e8('0x53')](_0x5b78f1);})[_0xc1e8('0x1f')](function(_0x409ced){_0x1d24cc[_0xc1e8('0x54')]=_0x409ced;return _0x1d24cc;})['then'](respondWithFilteredResult(_0x5a9518,_0x5b78f1))['catch'](handleError(_0x5a9518,null));};exports[_0xc1e8('0x55')]=function(_0x5d0662,_0x59fcee){var _0x19c0fb={'raw':![],'where':{'id':_0x5d0662['params']['id']}},_0x1a8bde={};_0x1a8bde[_0xc1e8('0x3f')]=_[_0xc1e8('0x41')](db['ZendeskAccount'][_0xc1e8('0x3c')]);_0x1a8bde[_0xc1e8('0x40')]=_[_0xc1e8('0x41')](_0x5d0662[_0xc1e8('0x40')]);_0x1a8bde[_0xc1e8('0x4b')]=_[_0xc1e8('0x42')](_0x1a8bde[_0xc1e8('0x3f')],_0x1a8bde[_0xc1e8('0x40')]);_0x19c0fb['attributes']=_[_0xc1e8('0x42')](_0x1a8bde[_0xc1e8('0x3f')],qs[_0xc1e8('0x44')](_0x5d0662[_0xc1e8('0x40')][_0xc1e8('0x44')]));_0x19c0fb[_0xc1e8('0x43')]=_0x19c0fb[_0xc1e8('0x43')]['length']?_0x19c0fb[_0xc1e8('0x43')]:_0x1a8bde['model'];if(_0x5d0662['query'][_0xc1e8('0x56')]){_0x19c0fb['include']=[{'all':!![]}];}_0x19c0fb=_[_0xc1e8('0x4d')]({},_0x19c0fb,_0x5d0662[_0xc1e8('0x57')]);return db[_0xc1e8('0x52')][_0xc1e8('0x58')](_0x19c0fb)['then'](handleEntityNotFound(_0x59fcee,null))[_0xc1e8('0x1f')](respondWithResult(_0x59fcee,null))[_0xc1e8('0x2a')](handleError(_0x59fcee,null));};exports['create']=function(_0x585f64,_0x2d6197){return db[_0xc1e8('0x52')]['create'](_0x585f64[_0xc1e8('0x59')],{})[_0xc1e8('0x1f')](respondWithResult(_0x2d6197,0xc9))[_0xc1e8('0x2a')](handleError(_0x2d6197,null));};exports[_0xc1e8('0x35')]=function(_0x519df1,_0x2caed1){if(_0x519df1['body']['id']){delete _0x519df1['body']['id'];}return db[_0xc1e8('0x52')][_0xc1e8('0x58')]({'where':{'id':_0x519df1[_0xc1e8('0x5a')]['id']}})[_0xc1e8('0x1f')](handleEntityNotFound(_0x2caed1,null))['then'](saveUpdates(_0x519df1['body'],null))[_0xc1e8('0x1f')](respondWithResult(_0x2caed1,null))[_0xc1e8('0x2a')](handleError(_0x2caed1,null));};exports[_0xc1e8('0x36')]=function(_0x47ef16,_0x42026c){return db[_0xc1e8('0x52')]['find']({'where':{'id':_0x47ef16[_0xc1e8('0x5a')]['id']}})[_0xc1e8('0x1f')](handleEntityNotFound(_0x42026c,null))['then'](removeEntity(_0x42026c,null))[_0xc1e8('0x2a')](handleError(_0x42026c,null));};exports[_0xc1e8('0x5b')]=function(_0x2720fe,_0x2ebe9f,_0x2ed443){var _0x28ade2={};var _0x43c951={};var _0x507aa1;var _0x4fb6b0;return db[_0xc1e8('0x52')][_0xc1e8('0x5c')]({'where':{'id':_0x2720fe[_0xc1e8('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2ebe9f,null))['then'](function(_0x483f4f){if(_0x483f4f){_0x507aa1=_0x483f4f;_0x43c951[_0xc1e8('0x3f')]=_[_0xc1e8('0x41')](db[_0xc1e8('0x5d')][_0xc1e8('0x3c')]);_0x43c951[_0xc1e8('0x40')]=_['keys'](_0x2720fe[_0xc1e8('0x40')]);_0x43c951['filters']=_[_0xc1e8('0x42')](_0x43c951[_0xc1e8('0x3f')],_0x43c951[_0xc1e8('0x40')]);_0x28ade2[_0xc1e8('0x43')]=_[_0xc1e8('0x42')](_0x43c951[_0xc1e8('0x3f')],qs[_0xc1e8('0x44')](_0x2720fe['query'][_0xc1e8('0x44')]));_0x28ade2[_0xc1e8('0x43')]=_0x28ade2[_0xc1e8('0x43')]['length']?_0x28ade2[_0xc1e8('0x43')]:_0x43c951[_0xc1e8('0x3f')];_0x28ade2[_0xc1e8('0x48')]=qs[_0xc1e8('0x49')](_0x2720fe[_0xc1e8('0x40')]['sort']);_0x28ade2[_0xc1e8('0x4a')]=qs[_0xc1e8('0x4b')](_[_0xc1e8('0x5e')](_0x2720fe[_0xc1e8('0x40')],_0x43c951['filters']));if(_0x2720fe['query'][_0xc1e8('0x4c')]){_0x28ade2[_0xc1e8('0x4a')]=_[_0xc1e8('0x4d')](_0x28ade2[_0xc1e8('0x4a')],{'$or':_[_0xc1e8('0x3b')](_0x28ade2[_0xc1e8('0x43')],function(_0x486984){var _0x19d403={};_0x19d403[_0x486984]={'$like':'%'+_0x2720fe['query']['filter']+'%'};return _0x19d403;})});}_0x28ade2=_['merge']({},_0x28ade2,_0x2720fe[_0xc1e8('0x57')]);return _0x507aa1['getConfigurations'](_0x28ade2);}})['then'](function(_0x5929fe){if(_0x5929fe){_0x4fb6b0=_0x5929fe[_0xc1e8('0x45')];if(!_0x2720fe[_0xc1e8('0x40')]['hasOwnProperty'](_0xc1e8('0x47'))){_0x28ade2[_0xc1e8('0x30')]=qs['limit'](_0x2720fe[_0xc1e8('0x40')][_0xc1e8('0x30')]);_0x28ade2[_0xc1e8('0x2f')]=qs[_0xc1e8('0x2f')](_0x2720fe['query']['offset']);}return _0x507aa1['getConfigurations'](_0x28ade2);}})['then'](function(_0x2e8f44){if(_0x2e8f44){return _0x2e8f44?{'count':_0x4fb6b0,'rows':_0x2e8f44}:null;}})[_0xc1e8('0x1f')](respondWithResult(_0x2ebe9f,null))[_0xc1e8('0x2a')](handleError(_0x2ebe9f,null));};exports[_0xc1e8('0x5f')]=function(_0x2adb91,_0x1b9615,_0x2add69){if(_0x2adb91[_0xc1e8('0x59')]['id']){delete _0x2adb91[_0xc1e8('0x59')]['id'];}return db[_0xc1e8('0x52')]['findOne']({'where':{'id':_0x2adb91['params']['id']}})[_0xc1e8('0x1f')](handleEntityNotFound(_0x1b9615,null))[_0xc1e8('0x1f')](function(_0x233e87){if(_0x233e87){_0x2adb91[_0xc1e8('0x59')][_0xc1e8('0x60')]=_0x233e87['id'];_0x2adb91['body'][_0xc1e8('0x61')]=integrations[_0xc1e8('0x62')](_0x2adb91[_0xc1e8('0x59')][_0xc1e8('0x63')],_0x2adb91[_0xc1e8('0x59')][_0xc1e8('0x4e')]);_0x2adb91[_0xc1e8('0x59')][_0xc1e8('0x64')]=integrations[_0xc1e8('0x65')](_0x2adb91[_0xc1e8('0x59')]['channel'],_0x2adb91[_0xc1e8('0x59')][_0xc1e8('0x4e')]);return db[_0xc1e8('0x5d')][_0xc1e8('0x66')](_0x2adb91[_0xc1e8('0x59')],{'include':[{'model':db['ZendeskField'],'as':_0xc1e8('0x61')},{'model':db['ZendeskField'],'as':_0xc1e8('0x64')}]});}return null;})[_0xc1e8('0x1f')](respondWithResult(_0x1b9615,null))[_0xc1e8('0x2a')](handleError(_0x1b9615,null));};exports['getFields']=function(_0x52cbc5,_0x53fcbe,_0x4e7c70){var _0x441697='';return db['ZendeskAccount'][_0xc1e8('0x5c')]({'where':{'id':_0x52cbc5[_0xc1e8('0x5a')]['id']},'attributes':['id','username',_0xc1e8('0x67'),_0xc1e8('0x68'),'authType',_0xc1e8('0x69')]})[_0xc1e8('0x1f')](handleEntityNotFound(_0x53fcbe,null))['then'](function(_0x3b60b1){if(_0x3b60b1){_0x441697=_0x3b60b1[_0xc1e8('0x69')];var _0x1f77e0=_0x441697[_0xc1e8('0x6a')](-0x1);if(_0x1f77e0==='/'){_0x441697=_0x441697[_0xc1e8('0x6b')](0x0,_0x441697[_0xc1e8('0x6c')](_0x1f77e0));}var _0x54afba={'method':_0xc1e8('0x6d'),'uri':util[_0xc1e8('0x6e')](_0xc1e8('0x6f'),_0x441697,_0xc1e8('0x70')),'json':!![]};switch(_0x3b60b1[_0xc1e8('0x71')]){case _0xc1e8('0x67'):_0x54afba[_0xc1e8('0x72')]={'Authorization':util['format'](_0xc1e8('0x73'),new Buffer(util['format'](_0xc1e8('0x74'),_0x3b60b1[_0xc1e8('0x75')],_0x3b60b1['password']))[_0xc1e8('0x76')](_0xc1e8('0x77')))};break;case _0xc1e8('0x68'):_0x54afba[_0xc1e8('0x72')]={'Authorization':util[_0xc1e8('0x6e')]('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x3b60b1[_0xc1e8('0x75')],_0x3b60b1[_0xc1e8('0x68')]))['toString'](_0xc1e8('0x77')))};break;default:throw new db[(_0xc1e8('0x1b'))]['ValidationError'](_0xc1e8('0x78'));}return rp(_0x54afba);}})[_0xc1e8('0x1f')](function(_0x193429){if(_0x193429){var _0x326652=['subject',_0xc1e8('0x79'),_0xc1e8('0x7a'),'assignee'];_[_0xc1e8('0x7b')](_0x193429[_0xc1e8('0x70')],function(_0x4fe528){return _0x326652[_0xc1e8('0x7c')](_0x4fe528[_0xc1e8('0x4e')]);});return{'count':_0x193429[_0xc1e8('0x70')][_0xc1e8('0x45')],'rows':_[_0xc1e8('0x3b')](_0x193429[_0xc1e8('0x70')],function(_0x276de0){return{'id':_0x276de0['id'],'name':_0x276de0[_0xc1e8('0x7d')]>0x7?_0x276de0[_0xc1e8('0x7e')]:_0x276de0[_0xc1e8('0x4e')],'custom':_0x276de0[_0xc1e8('0x7d')]>0x7?!![]:![],'options':_0x276de0[_0xc1e8('0x7f')]?_0x276de0[_0xc1e8('0x7f')]:_0x276de0[_0xc1e8('0x80')]?_0x276de0[_0xc1e8('0x80')]:[]};})};}})[_0xc1e8('0x1f')](respondWithResult(_0x53fcbe,null))[_0xc1e8('0x2a')](function(_0xed774e){var _0x4dbd18=_0x52cbc5[_0xc1e8('0x40')][_0xc1e8('0x81')]?0x1f4:_0xed774e[_0xc1e8('0x82')]||0x1f4;logger['error'](_0xc1e8('0x83'),_0xc1e8('0x84'),_0x4dbd18,JSON['stringify'](_0xed774e));delete _0xed774e[_0xc1e8('0x38')];if(_0x4dbd18===0x191){_0x4dbd18=0x190;}_0x53fcbe['status'](_0x4dbd18)[_0xc1e8('0x39')](_0x52cbc5[_0xc1e8('0x40')][_0xc1e8('0x81')]?{'message':_0xc1e8('0x85'),'statusCode':_0xed774e[_0xc1e8('0x82')]}:_0xed774e);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5f6b899..5074afb 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 _0xf50d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','util'];(function(_0x39e6a2,_0x135e83){var _0x433bd1=function(_0x3b8ee6){while(--_0x3b8ee6){_0x39e6a2['push'](_0x39e6a2['shift']());}};_0x433bd1(++_0x135e83);}(_0xf50d,0x99));var _0xdf50=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xf50d[_0x307d86];return _0x361745;};'use strict';var _=require('lodash');var util=require(_0xdf50('0x0'));var logger=require(_0xdf50('0x1'))(_0xdf50('0x2'));var moment=require(_0xdf50('0x3'));var BPromise=require(_0xdf50('0x4'));var rp=require(_0xdf50('0x5'));var fs=require('fs');var path=require(_0xdf50('0x6'));var rimraf=require(_0xdf50('0x7'));var config=require(_0xdf50('0x8'));var attributes=require(_0xdf50('0x9'));var integrations=require(_0xdf50('0xa'));module['exports']=function(_0x3f1a6a,_0x30014d){return _0x3f1a6a[_0xdf50('0xb')](_0xdf50('0xc'),attributes,{'tableName':_0xdf50('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d6f=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount'];(function(_0x47242d,_0x13f993){var _0x30273a=function(_0x322cd2){while(--_0x322cd2){_0x47242d['push'](_0x47242d['shift']());}};_0x30273a(++_0x13f993);}(_0x4d6f,0x14a));var _0xf4d6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4d6f[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xf4d6('0x0'));var util=require('util');var logger=require(_0xf4d6('0x1'))('api');var moment=require(_0xf4d6('0x2'));var BPromise=require(_0xf4d6('0x3'));var rp=require(_0xf4d6('0x4'));var fs=require('fs');var path=require(_0xf4d6('0x5'));var rimraf=require('rimraf');var config=require(_0xf4d6('0x6'));var attributes=require(_0xf4d6('0x7'));var integrations=require(_0xf4d6('0x8'));module['exports']=function(_0x56e506,_0x148b40){return _0x56e506[_0xf4d6('0x9')](_0xf4d6('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index c77d22a..3b3c122 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 _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(_0x593354,_0x5cfd81){var _0x13996b=function(_0x306d51){while(--_0x306d51){_0x593354['push'](_0x593354['shift']());}};_0x13996b(++_0x5cfd81);}(_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 +var _0xd8b0=['raw','where','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','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','options'];(function(_0xfbe418,_0x2677f4){var _0x46e9b7=function(_0x5f2f62){while(--_0x5f2f62){_0xfbe418['push'](_0xfbe418['shift']());}};_0x46e9b7(++_0x2677f4);}(_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')]['findAll']({'raw':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x19')]===undefined?!![]:![]:!![],'where':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x18')]?_0x5fecbd[_0x0d8b('0x18')]['attributes']||null:null,'limit':_0x5fecbd['options']?_0x5fecbd[_0x0d8b('0x18')]['limit']||null:null,'include':_0x5fecbd['options']?_0x5fecbd['options'][_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x5fecbd[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x221071){return{'model':db[_0x221071[_0x0d8b('0x1d')]],'as':_0x221071['as'],'attributes':_0x221071[_0x0d8b('0x1e')],'include':_0x221071[_0x0d8b('0x1b')]?_[_0x0d8b('0x1c')](_0x221071['include'],function(_0xe8bbee){return{'model':db[_0xe8bbee[_0x0d8b('0x1d')]],'as':_0xe8bbee['as'],'attributes':_0xe8bbee['attributes'],'include':_0xe8bbee[_0x0d8b('0x1b')]?_['map'](_0xe8bbee[_0x0d8b('0x1b')],function(_0x234bdd){return{'model':db[_0x234bdd[_0x0d8b('0x1d')]],'as':_0x234bdd['as'],'attributes':_0x234bdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f639){logger[_0x0d8b('0xb')]('GetZendeskAccount',_0x5fecbd);logger[_0x0d8b('0xe')]('GetZendeskAccount',_0x5fecbd,JSON[_0x0d8b('0x10')](_0x28f639));_0x18dd2d(_0x28f639);})['catch'](function(_0x97050a){logger['error'](_0x0d8b('0x16'),_0x97050a['message'],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x97050a['message']));});});};exports[_0x0d8b('0x1f')]=function(_0x106e4c){var _0x2c058d=this;return new Promise(function(_0x56120a,_0x4c80a2){return db['ZendeskAccount'][_0x0d8b('0x20')]({'raw':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x106e4c['options']?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1a')]||null:null,'attributes':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1e')]||null:null,'include':_0x106e4c[_0x0d8b('0x18')]?_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')]?_['map'](_0x106e4c[_0x0d8b('0x18')][_0x0d8b('0x1b')],function(_0x4b3ea0){return{'model':db[_0x4b3ea0[_0x0d8b('0x1d')]],'as':_0x4b3ea0['as'],'attributes':_0x4b3ea0[_0x0d8b('0x1e')],'include':_0x4b3ea0[_0x0d8b('0x1b')]?_['map'](_0x4b3ea0[_0x0d8b('0x1b')],function(_0x2c507e){return{'model':db[_0x2c507e[_0x0d8b('0x1d')]],'as':_0x2c507e['as'],'attributes':_0x2c507e[_0x0d8b('0x1e')],'include':_0x2c507e[_0x0d8b('0x1b')]?_['map'](_0x2c507e[_0x0d8b('0x1b')],function(_0x1649fc){return{'model':db[_0x1649fc['model']],'as':_0x1649fc['as'],'attributes':_0x1649fc[_0x0d8b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d8b('0xa')](function(_0x188af2){logger[_0x0d8b('0xb')](_0x0d8b('0x1f'),_0x106e4c);logger['debug']('ShowZendeskAccount',_0x106e4c,JSON[_0x0d8b('0x10')](_0x188af2));_0x56120a(_0x188af2);})['catch'](function(_0x531c55){logger[_0x0d8b('0x11')](_0x0d8b('0x1f'),_0x531c55[_0x0d8b('0x13')],_0x106e4c);_0x4c80a2(_0x2c058d[_0x0d8b('0x11')](0x1f4,_0x531c55[_0x0d8b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index efcc4a5..7116290 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 _0x0476=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','create','post','/:id/tags','update','destroy','multer','util','path','../../components/interaction/service','../../config/environment','get','/:id','/:id/fields','isAuthenticated'];(function(_0x53cb08,_0x2e0c8a){var _0x5ebf25=function(_0x143456){while(--_0x143456){_0x53cb08['push'](_0x53cb08['shift']());}};_0x5ebf25(++_0x2e0c8a);}(_0x0476,0x69));var _0x6047=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0x0476[_0x9c3c56];return _0x2dd782;};'use strict';var multer=require(_0x6047('0x0'));var util=require(_0x6047('0x1'));var path=require(_0x6047('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6047('0x3'));var config=require(_0x6047('0x4'));var controller=require('./intZendeskConfiguration.controller');router[_0x6047('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6047('0x5')](_0x6047('0x6'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6047('0x7'),auth[_0x6047('0x8')](),controller['getFields']);router[_0x6047('0x5')](_0x6047('0x9'),auth[_0x6047('0x8')](),controller[_0x6047('0xa')]);router['get'](_0x6047('0xb'),auth[_0x6047('0x8')](),controller[_0x6047('0xc')]);router[_0x6047('0x5')]('/:id/tags',auth[_0x6047('0x8')](),controller[_0x6047('0xd')]);router['post']('/',auth[_0x6047('0x8')](),controller[_0x6047('0xe')]);router[_0x6047('0xf')](_0x6047('0x10'),auth[_0x6047('0x8')](),controller['setTags']);router['put']('/:id',auth[_0x6047('0x8')](),controller[_0x6047('0x11')]);router['delete']('/:id',auth[_0x6047('0x8')](),controller[_0x6047('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0226=['Router','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x42aeef,_0x528223){var _0x4365e6=function(_0x53ca84){while(--_0x53ca84){_0x42aeef['push'](_0x42aeef['shift']());}};_0x4365e6(++_0x528223);}(_0x0226,0x1ac));var _0x6022=function(_0x79c6de,_0x10de94){_0x79c6de=_0x79c6de-0x0;var _0x321a56=_0x0226[_0x79c6de];return _0x321a56;};'use strict';var multer=require(_0x6022('0x0'));var util=require(_0x6022('0x1'));var path=require(_0x6022('0x2'));var timeout=require(_0x6022('0x3'));var express=require('express');var router=express[_0x6022('0x4')]();var auth=require(_0x6022('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6022('0x6'));var controller=require(_0x6022('0x7'));router[_0x6022('0x8')]('/',auth['isAuthenticated'](),controller[_0x6022('0x9')]);router['get']('/:id',auth[_0x6022('0xa')](),controller[_0x6022('0xb')]);router[_0x6022('0x8')](_0x6022('0xc'),auth['isAuthenticated'](),controller[_0x6022('0xd')]);router[_0x6022('0x8')](_0x6022('0xe'),auth[_0x6022('0xa')](),controller[_0x6022('0xf')]);router['get'](_0x6022('0x10'),auth[_0x6022('0xa')](),controller['getDescriptions']);router['get'](_0x6022('0x11'),auth[_0x6022('0xa')](),controller[_0x6022('0x12')]);router[_0x6022('0x13')]('/',auth[_0x6022('0xa')](),controller['create']);router['post']('/:id/tags',auth[_0x6022('0xa')](),controller[_0x6022('0x14')]);router[_0x6022('0x15')](_0x6022('0x16'),auth[_0x6022('0xa')](),controller[_0x6022('0x17')]);router[_0x6022('0x18')](_0x6022('0x16'),auth[_0x6022('0xa')](),controller[_0x6022('0x19')]);module[_0x6022('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 1890e54..234bd09 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 _0xf6c2=['sequelize','STRING'];(function(_0x4bfbda,_0x332198){var _0x3811c8=function(_0x3233c7){while(--_0x3233c7){_0x4bfbda['push'](_0x4bfbda['shift']());}};_0x3811c8(++_0x332198);}(_0xf6c2,0x1ca));var _0x2f6c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xf6c2[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x2f6c('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f6c('0x1')]},'description':{'type':Sequelize[_0x2f6c('0x1')]}}; \ No newline at end of file +var _0x4925=['STRING','exports'];(function(_0x482b09,_0x38e844){var _0x1922de=function(_0x159878){while(--_0x159878){_0x482b09['push'](_0x482b09['shift']());}};_0x1922de(++_0x38e844);}(_0x4925,0x8d));var _0x5492=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x4925[_0x5ce3c8];return _0xa76867;};'use strict';var Sequelize=require('sequelize');module[_0x5492('0x0')]={'name':{'type':Sequelize[_0x5492('0x1')]},'description':{'type':Sequelize[_0x5492('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 5514f68..905d7ac 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 _0xf3f2=['json','apply','reject','destroy','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','model','map','filters','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','keys','intersection','include','find','create','update','body','params','getFields','findOne','ZendeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','fast-json-patch','request-promise','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','offset','limit','set'];(function(_0x3295fe,_0x3420ee){var _0x567b95=function(_0x322565){while(--_0x322565){_0x3295fe['push'](_0x3295fe['shift']());}};_0x567b95(++_0x3420ee);}(_0xf3f2,0x145));var _0x2f3f=function(_0x1b1ca4,_0x18d595){_0x1b1ca4=_0x1b1ca4-0x0;var _0x28040c=_0xf3f2[_0x1b1ca4];return _0x28040c;};'use strict';var pdf=require(_0x2f3f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f3f('0x1'));var rp=require(_0x2f3f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2f3f('0x3'));var util=require('util');var path=require(_0x2f3f('0x4'));var sox=require(_0x2f3f('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2f3f('0x6'));var squel=require(_0x2f3f('0x7'));var crypto=require(_0x2f3f('0x8'));var jsforce=require(_0x2f3f('0x9'));var deskjs=require(_0x2f3f('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2f3f('0xb'));var Redis=require(_0x2f3f('0xc'));var authService=require(_0x2f3f('0xd'));var qs=require(_0x2f3f('0xe'));var as=require(_0x2f3f('0xf'));var hardwareService=require(_0x2f3f('0x10'));var logger=require('../../config/logger')(_0x2f3f('0x11'));var utils=require(_0x2f3f('0x12'));var config=require(_0x2f3f('0x13'));var db=require(_0x2f3f('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2f3f('0x15')][_0x2f3f('0x16')]({'port':0x232a});function checkPasswordPattern(_0x17ad24,_0x36b0e0,_0x363106){if(_0x363106){var _0x200a7a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x200a7a[_0x2f3f('0x17')](_0x36b0e0)){return _0x17ad24;}else{throw new db['Sequelize'][(_0x2f3f('0x18'))](_0x2f3f('0x19'));}}else{return _0x17ad24;}}function respondWithRpcPromise(_0x384eb9,_0x83dfa8,_0x21dfe0,_0x784b00){return new BPromise(function(_0x5148d6,_0x4ba575){var _0x38bf01=_0x784b00||client;return _0x38bf01[_0x2f3f('0x1a')](_0x384eb9,_0x21dfe0)[_0x2f3f('0x1b')](function(_0x4708a5){logger[_0x2f3f('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x83dfa8,'request\x20sent');logger['debug'](_0x2f3f('0x1d'),_0x83dfa8,_0x2f3f('0x1e'),JSON[_0x2f3f('0x1f')](_0x4708a5));if(_0x4708a5[_0x2f3f('0x20')]){if(_0x4708a5[_0x2f3f('0x20')][_0x2f3f('0x21')]===0x1f4){logger[_0x2f3f('0x20')]('ZendeskConfiguration,\x20%s,\x20%s',_0x83dfa8,_0x4708a5['error'][_0x2f3f('0x22')]);return _0x4ba575(_0x4708a5[_0x2f3f('0x20')][_0x2f3f('0x22')]);}logger[_0x2f3f('0x20')](_0x2f3f('0x23'),_0x83dfa8,_0x4708a5['error']['message']);return _0x5148d6(_0x4708a5['error'][_0x2f3f('0x22')]);}else{logger[_0x2f3f('0x1c')](_0x2f3f('0x23'),_0x83dfa8,_0x2f3f('0x1e'));_0x5148d6(_0x4708a5[_0x2f3f('0x24')][_0x2f3f('0x22')]);}})[_0x2f3f('0x25')](function(_0x146bf7){logger[_0x2f3f('0x20')](_0x2f3f('0x23'),_0x83dfa8,_0x146bf7);_0x4ba575(_0x146bf7);});});}function respondWithStatusCode(_0x5e4bd7,_0x319d06){_0x319d06=_0x319d06||0xcc;return function(_0x4ad1e5){if(_0x4ad1e5){return _0x5e4bd7[_0x2f3f('0x26')](_0x319d06);}return _0x5e4bd7[_0x2f3f('0x27')](_0x319d06)['end']();};}function respondWithResult(_0x4832e6,_0xc7eada){_0xc7eada=_0xc7eada||0xc8;return function(_0x1d81cf){if(_0x1d81cf){return _0x4832e6['status'](_0xc7eada)['json'](_0x1d81cf);}};}function respondWithFilteredResult(_0xfa94e7,_0x110fd1){return function(_0x4f08af){if(_0x4f08af){var _0x444e63=_0x4f08af['count'],_0x5925de=_0x110fd1[_0x2f3f('0x28')],_0x53a046=_0x110fd1['offset']+_0x110fd1[_0x2f3f('0x29')],_0x14be6e;if(_0x53a046>=_0x444e63){_0x53a046=_0x444e63;_0x14be6e=0xc8;}else{_0x14be6e=0xce;}_0xfa94e7['status'](_0x14be6e);return _0xfa94e7[_0x2f3f('0x2a')]('Content-Range',_0x5925de+'-'+_0x53a046+'/'+_0x444e63)[_0x2f3f('0x2b')](_0x4f08af);}return null;};}function patchUpdates(_0x17e259){return function(_0xd8bcd9){try{jsonpatch[_0x2f3f('0x2c')](_0xd8bcd9,_0x17e259,!![]);}catch(_0x353d67){return BPromise[_0x2f3f('0x2d')](_0x353d67);}return _0xd8bcd9['save']();};}function saveUpdates(_0x2332aa,_0x281ca6){return function(_0x43cdce){if(_0x43cdce){return _0x43cdce['update'](_0x2332aa)[_0x2f3f('0x1b')](function(_0x4a9a3e){return _0x4a9a3e;});}return null;};}function removeEntity(_0x4e5acf,_0x5d6ce7){return function(_0x144ca9){if(_0x144ca9){return _0x144ca9[_0x2f3f('0x2e')]()[_0x2f3f('0x1b')](function(){_0x4e5acf[_0x2f3f('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5efe65,_0x1797d2){return function(_0x5a6b47){if(!_0x5a6b47){_0x5efe65['sendStatus'](0x194);}return _0x5a6b47;};}function handleError(_0x193d88,_0x334f8c){_0x334f8c=_0x334f8c||0x1f4;return function(_0x160bc4){logger[_0x2f3f('0x20')](_0x160bc4[_0x2f3f('0x2f')]);if(_0x160bc4[_0x2f3f('0x30')]){delete _0x160bc4[_0x2f3f('0x30')];}_0x193d88[_0x2f3f('0x27')](_0x334f8c)[_0x2f3f('0x31')](_0x160bc4);};}exports[_0x2f3f('0x32')]=function(_0xab738b,_0x5857f3){var _0x285ea0={},_0x50e7b8={},_0x55c9b9={'count':0x0,'rows':[]};var _0x3b3388=_['map'](db[_0x2f3f('0x33')][_0x2f3f('0x34')],function(_0x2e1273){return{'name':_0x2e1273[_0x2f3f('0x35')],'type':_0x2e1273[_0x2f3f('0x36')]['key']};});_0x50e7b8[_0x2f3f('0x37')]=_[_0x2f3f('0x38')](_0x3b3388,'name');_0x50e7b8['query']=_['keys'](_0xab738b['query']);_0x50e7b8[_0x2f3f('0x39')]=_['intersection'](_0x50e7b8[_0x2f3f('0x37')],_0x50e7b8[_0x2f3f('0x3a')]);_0x285ea0[_0x2f3f('0x3b')]=_['intersection'](_0x50e7b8[_0x2f3f('0x37')],qs[_0x2f3f('0x3c')](_0xab738b[_0x2f3f('0x3a')][_0x2f3f('0x3c')]));_0x285ea0[_0x2f3f('0x3b')]=_0x285ea0[_0x2f3f('0x3b')][_0x2f3f('0x3d')]?_0x285ea0['attributes']:_0x50e7b8['model'];if(!_0xab738b['query'][_0x2f3f('0x3e')](_0x2f3f('0x3f'))){_0x285ea0['limit']=qs[_0x2f3f('0x29')](_0xab738b[_0x2f3f('0x3a')]['limit']);_0x285ea0[_0x2f3f('0x28')]=qs[_0x2f3f('0x28')](_0xab738b['query'][_0x2f3f('0x28')]);}_0x285ea0['order']=qs[_0x2f3f('0x40')](_0xab738b[_0x2f3f('0x3a')][_0x2f3f('0x40')]);_0x285ea0['where']=qs[_0x2f3f('0x39')](_[_0x2f3f('0x41')](_0xab738b['query'],_0x50e7b8[_0x2f3f('0x39')]),_0x3b3388);if(_0xab738b[_0x2f3f('0x3a')]['filter']){_0x285ea0[_0x2f3f('0x42')]=_[_0x2f3f('0x43')](_0x285ea0[_0x2f3f('0x42')],{'$or':_[_0x2f3f('0x38')](_0x3b3388,function(_0x49ba17){if(_0x49ba17[_0x2f3f('0x36')]!==_0x2f3f('0x44')){var _0x549d32={};_0x549d32[_0x49ba17['name']]={'$like':'%'+_0xab738b[_0x2f3f('0x3a')][_0x2f3f('0x45')]+'%'};return _0x549d32;}})});}_0x285ea0=_[_0x2f3f('0x43')]({},_0x285ea0,_0xab738b[_0x2f3f('0x46')]);var _0x501f71={'where':_0x285ea0[_0x2f3f('0x42')]};return db[_0x2f3f('0x33')][_0x2f3f('0x47')](_0x501f71)[_0x2f3f('0x1b')](function(_0x20167f){_0x55c9b9['count']=_0x20167f;if(_0xab738b[_0x2f3f('0x3a')][_0x2f3f('0x48')]){_0x285ea0['include']=[{'all':!![]}];}return db[_0x2f3f('0x33')][_0x2f3f('0x49')](_0x285ea0);})[_0x2f3f('0x1b')](function(_0x10ca54){_0x55c9b9[_0x2f3f('0x4a')]=_0x10ca54;return _0x55c9b9;})[_0x2f3f('0x1b')](respondWithFilteredResult(_0x5857f3,_0x285ea0))['catch'](handleError(_0x5857f3,null));};exports['show']=function(_0xb5d73b,_0x24e35c){var _0x5517dd={'raw':![],'where':{'id':_0xb5d73b['params']['id']}},_0x274de3={};_0x274de3[_0x2f3f('0x37')]=_['keys'](db[_0x2f3f('0x33')]['rawAttributes']);_0x274de3[_0x2f3f('0x3a')]=_[_0x2f3f('0x4b')](_0xb5d73b[_0x2f3f('0x3a')]);_0x274de3[_0x2f3f('0x39')]=_[_0x2f3f('0x4c')](_0x274de3['model'],_0x274de3[_0x2f3f('0x3a')]);_0x5517dd[_0x2f3f('0x3b')]=_[_0x2f3f('0x4c')](_0x274de3[_0x2f3f('0x37')],qs[_0x2f3f('0x3c')](_0xb5d73b['query'][_0x2f3f('0x3c')]));_0x5517dd['attributes']=_0x5517dd[_0x2f3f('0x3b')][_0x2f3f('0x3d')]?_0x5517dd[_0x2f3f('0x3b')]:_0x274de3[_0x2f3f('0x37')];if(_0xb5d73b['query']['includeAll']){_0x5517dd[_0x2f3f('0x4d')]=[{'all':!![]}];}_0x5517dd=_['merge']({},_0x5517dd,_0xb5d73b[_0x2f3f('0x46')]);return db['ZendeskConfiguration'][_0x2f3f('0x4e')](_0x5517dd)[_0x2f3f('0x1b')](handleEntityNotFound(_0x24e35c,null))['then'](respondWithResult(_0x24e35c,null))[_0x2f3f('0x25')](handleError(_0x24e35c,null));};exports[_0x2f3f('0x4f')]=function(_0x12e156,_0x38669f){return db[_0x2f3f('0x33')][_0x2f3f('0x4f')](_0x12e156['body'],{})['then'](respondWithResult(_0x38669f,0xc9))[_0x2f3f('0x25')](handleError(_0x38669f,null));};exports[_0x2f3f('0x50')]=function(_0x425f20,_0x15d333){if(_0x425f20[_0x2f3f('0x51')]['id']){delete _0x425f20[_0x2f3f('0x51')]['id'];}return db[_0x2f3f('0x33')]['find']({'where':{'id':_0x425f20[_0x2f3f('0x52')]['id']}})[_0x2f3f('0x1b')](handleEntityNotFound(_0x15d333,null))[_0x2f3f('0x1b')](saveUpdates(_0x425f20[_0x2f3f('0x51')],null))[_0x2f3f('0x1b')](respondWithResult(_0x15d333,null))[_0x2f3f('0x25')](handleError(_0x15d333,null));};exports['destroy']=function(_0xcb11a2,_0x25bb01){return db['ZendeskConfiguration'][_0x2f3f('0x4e')]({'where':{'id':_0xcb11a2['params']['id']}})[_0x2f3f('0x1b')](handleEntityNotFound(_0x25bb01,null))[_0x2f3f('0x1b')](removeEntity(_0x25bb01,null))['catch'](handleError(_0x25bb01,null));};exports[_0x2f3f('0x53')]=function(_0xfe094d,_0x3b9f6c,_0x1d09ff){var _0x41953f={};var _0x4b61e2={};var _0x25696e;var _0x5b8453;return db[_0x2f3f('0x33')][_0x2f3f('0x54')]({'where':{'id':_0xfe094d[_0x2f3f('0x52')]['id']}})['then'](handleEntityNotFound(_0x3b9f6c,null))['then'](function(_0x16c205){if(_0x16c205){_0x25696e=_0x16c205;_0x4b61e2[_0x2f3f('0x37')]=_[_0x2f3f('0x4b')](db[_0x2f3f('0x55')][_0x2f3f('0x34')]);_0x4b61e2[_0x2f3f('0x3a')]=_[_0x2f3f('0x4b')](_0xfe094d['query']);_0x4b61e2['filters']=_[_0x2f3f('0x4c')](_0x4b61e2[_0x2f3f('0x37')],_0x4b61e2[_0x2f3f('0x3a')]);_0x41953f[_0x2f3f('0x3b')]=_[_0x2f3f('0x4c')](_0x4b61e2[_0x2f3f('0x37')],qs[_0x2f3f('0x3c')](_0xfe094d['query'][_0x2f3f('0x3c')]));_0x41953f[_0x2f3f('0x3b')]=_0x41953f['attributes']['length']?_0x41953f[_0x2f3f('0x3b')]:_0x4b61e2['model'];_0x41953f[_0x2f3f('0x56')]=qs['sort'](_0xfe094d[_0x2f3f('0x3a')][_0x2f3f('0x40')]);_0x41953f[_0x2f3f('0x42')]=qs[_0x2f3f('0x39')](_[_0x2f3f('0x41')](_0xfe094d[_0x2f3f('0x3a')],_0x4b61e2[_0x2f3f('0x39')]));if(_0xfe094d[_0x2f3f('0x3a')][_0x2f3f('0x45')]){_0x41953f[_0x2f3f('0x42')]=_[_0x2f3f('0x43')](_0x41953f[_0x2f3f('0x42')],{'$or':_[_0x2f3f('0x38')](_0x41953f[_0x2f3f('0x3b')],function(_0x2ffd3a){var _0x2939e1={};_0x2939e1[_0x2ffd3a]={'$like':'%'+_0xfe094d[_0x2f3f('0x3a')][_0x2f3f('0x45')]+'%'};return _0x2939e1;})});}_0x41953f=_[_0x2f3f('0x43')]({},_0x41953f,_0xfe094d[_0x2f3f('0x46')]);return _0x25696e[_0x2f3f('0x53')](_0x41953f);}})[_0x2f3f('0x1b')](function(_0x4c9dd8){if(_0x4c9dd8){_0x5b8453=_0x4c9dd8[_0x2f3f('0x3d')];if(!_0xfe094d[_0x2f3f('0x3a')][_0x2f3f('0x3e')](_0x2f3f('0x3f'))){_0x41953f[_0x2f3f('0x29')]=qs[_0x2f3f('0x29')](_0xfe094d[_0x2f3f('0x3a')][_0x2f3f('0x29')]);_0x41953f[_0x2f3f('0x28')]=qs[_0x2f3f('0x28')](_0xfe094d[_0x2f3f('0x3a')][_0x2f3f('0x28')]);}return _0x25696e[_0x2f3f('0x53')](_0x41953f);}})[_0x2f3f('0x1b')](function(_0x32f6a8){if(_0x32f6a8){return _0x32f6a8?{'count':_0x5b8453,'rows':_0x32f6a8}:null;}})[_0x2f3f('0x1b')](respondWithResult(_0x3b9f6c,null))[_0x2f3f('0x25')](handleError(_0x3b9f6c,null));};exports[_0x2f3f('0x57')]=function(_0xb26712,_0x3830b4,_0x45c1b5){var _0x19a0b6={};var _0x239354={};var _0x23ad00;var _0x3bc0b9;return db[_0x2f3f('0x33')][_0x2f3f('0x54')]({'where':{'id':_0xb26712[_0x2f3f('0x52')]['id']}})[_0x2f3f('0x1b')](handleEntityNotFound(_0x3830b4,null))[_0x2f3f('0x1b')](function(_0xa40e1){if(_0xa40e1){_0x23ad00=_0xa40e1;_0x239354['model']=_['keys'](db[_0x2f3f('0x55')][_0x2f3f('0x34')]);_0x239354[_0x2f3f('0x3a')]=_['keys'](_0xb26712[_0x2f3f('0x3a')]);_0x239354['filters']=_[_0x2f3f('0x4c')](_0x239354[_0x2f3f('0x37')],_0x239354[_0x2f3f('0x3a')]);_0x19a0b6[_0x2f3f('0x3b')]=_['intersection'](_0x239354[_0x2f3f('0x37')],qs[_0x2f3f('0x3c')](_0xb26712[_0x2f3f('0x3a')][_0x2f3f('0x3c')]));_0x19a0b6[_0x2f3f('0x3b')]=_0x19a0b6[_0x2f3f('0x3b')][_0x2f3f('0x3d')]?_0x19a0b6['attributes']:_0x239354['model'];_0x19a0b6[_0x2f3f('0x56')]=qs[_0x2f3f('0x40')](_0xb26712[_0x2f3f('0x3a')]['sort']);_0x19a0b6[_0x2f3f('0x42')]=qs[_0x2f3f('0x39')](_['pick'](_0xb26712[_0x2f3f('0x3a')],_0x239354[_0x2f3f('0x39')]));if(_0xb26712[_0x2f3f('0x3a')]['filter']){_0x19a0b6['where']=_[_0x2f3f('0x43')](_0x19a0b6['where'],{'$or':_[_0x2f3f('0x38')](_0x19a0b6[_0x2f3f('0x3b')],function(_0x5c81b0){var _0x53bb1a={};_0x53bb1a[_0x5c81b0]={'$like':'%'+_0xb26712[_0x2f3f('0x3a')][_0x2f3f('0x45')]+'%'};return _0x53bb1a;})});}_0x19a0b6=_[_0x2f3f('0x43')]({},_0x19a0b6,_0xb26712[_0x2f3f('0x46')]);return _0x23ad00[_0x2f3f('0x57')](_0x19a0b6);}})[_0x2f3f('0x1b')](function(_0x2040ab){if(_0x2040ab){_0x3bc0b9=_0x2040ab['length'];if(!_0xb26712[_0x2f3f('0x3a')]['hasOwnProperty'](_0x2f3f('0x3f'))){_0x19a0b6[_0x2f3f('0x29')]=qs[_0x2f3f('0x29')](_0xb26712['query'][_0x2f3f('0x29')]);_0x19a0b6['offset']=qs['offset'](_0xb26712[_0x2f3f('0x3a')][_0x2f3f('0x28')]);}return _0x23ad00[_0x2f3f('0x57')](_0x19a0b6);}})['then'](function(_0x21a68e){if(_0x21a68e){return _0x21a68e?{'count':_0x3bc0b9,'rows':_0x21a68e}:null;}})['then'](respondWithResult(_0x3830b4,null))[_0x2f3f('0x25')](handleError(_0x3830b4,null));};exports['getDescriptions']=function(_0x1b1105,_0x5c8648,_0x3cd710){var _0x390423={};var _0x1dc6ca={};var _0x2466a1;var _0x138eb9;return db[_0x2f3f('0x33')][_0x2f3f('0x54')]({'where':{'id':_0x1b1105[_0x2f3f('0x52')]['id']}})[_0x2f3f('0x1b')](handleEntityNotFound(_0x5c8648,null))[_0x2f3f('0x1b')](function(_0xb1a6fe){if(_0xb1a6fe){_0x2466a1=_0xb1a6fe;_0x1dc6ca['model']=_['keys'](db[_0x2f3f('0x55')][_0x2f3f('0x34')]);_0x1dc6ca[_0x2f3f('0x3a')]=_[_0x2f3f('0x4b')](_0x1b1105['query']);_0x1dc6ca[_0x2f3f('0x39')]=_[_0x2f3f('0x4c')](_0x1dc6ca['model'],_0x1dc6ca[_0x2f3f('0x3a')]);_0x390423[_0x2f3f('0x3b')]=_[_0x2f3f('0x4c')](_0x1dc6ca[_0x2f3f('0x37')],qs[_0x2f3f('0x3c')](_0x1b1105['query'][_0x2f3f('0x3c')]));_0x390423[_0x2f3f('0x3b')]=_0x390423['attributes']['length']?_0x390423[_0x2f3f('0x3b')]:_0x1dc6ca[_0x2f3f('0x37')];_0x390423[_0x2f3f('0x56')]=qs[_0x2f3f('0x40')](_0x1b1105['query']['sort']);_0x390423[_0x2f3f('0x42')]=qs[_0x2f3f('0x39')](_[_0x2f3f('0x41')](_0x1b1105[_0x2f3f('0x3a')],_0x1dc6ca[_0x2f3f('0x39')]));if(_0x1b1105[_0x2f3f('0x3a')]['filter']){_0x390423[_0x2f3f('0x42')]=_[_0x2f3f('0x43')](_0x390423['where'],{'$or':_[_0x2f3f('0x38')](_0x390423[_0x2f3f('0x3b')],function(_0x524803){var _0x1445ac={};_0x1445ac[_0x524803]={'$like':'%'+_0x1b1105['query'][_0x2f3f('0x45')]+'%'};return _0x1445ac;})});}_0x390423=_[_0x2f3f('0x43')]({},_0x390423,_0x1b1105[_0x2f3f('0x46')]);return _0x2466a1[_0x2f3f('0x58')](_0x390423);}})[_0x2f3f('0x1b')](function(_0x1a192e){if(_0x1a192e){_0x138eb9=_0x1a192e[_0x2f3f('0x3d')];if(!_0x1b1105['query']['hasOwnProperty'](_0x2f3f('0x3f'))){_0x390423[_0x2f3f('0x29')]=qs[_0x2f3f('0x29')](_0x1b1105[_0x2f3f('0x3a')][_0x2f3f('0x29')]);_0x390423[_0x2f3f('0x28')]=qs[_0x2f3f('0x28')](_0x1b1105['query'][_0x2f3f('0x28')]);}return _0x2466a1[_0x2f3f('0x58')](_0x390423);}})[_0x2f3f('0x1b')](function(_0x55fb6b){if(_0x55fb6b){return _0x55fb6b?{'count':_0x138eb9,'rows':_0x55fb6b}:null;}})[_0x2f3f('0x1b')](respondWithResult(_0x5c8648,null))['catch'](handleError(_0x5c8648,null));};exports[_0x2f3f('0x59')]=function(_0x3cd4a9,_0x2c8770,_0x371a0e){var _0x5de488={};var _0x3e3dbb={};var _0x14e6a9;var _0x314167;return db[_0x2f3f('0x33')][_0x2f3f('0x54')]({'where':{'id':_0x3cd4a9[_0x2f3f('0x52')]['id']}})['then'](handleEntityNotFound(_0x2c8770,null))[_0x2f3f('0x1b')](function(_0x3fd459){if(_0x3fd459){_0x14e6a9=_0x3fd459;_0x3e3dbb['model']=_[_0x2f3f('0x4b')](db[_0x2f3f('0x5a')][_0x2f3f('0x34')]);_0x3e3dbb[_0x2f3f('0x3a')]=_[_0x2f3f('0x4b')](_0x3cd4a9[_0x2f3f('0x3a')]);_0x3e3dbb[_0x2f3f('0x39')]=_[_0x2f3f('0x4c')](_0x3e3dbb[_0x2f3f('0x37')],_0x3e3dbb[_0x2f3f('0x3a')]);_0x5de488[_0x2f3f('0x3b')]=_[_0x2f3f('0x4c')](_0x3e3dbb[_0x2f3f('0x37')],qs['fields'](_0x3cd4a9[_0x2f3f('0x3a')]['fields']));_0x5de488[_0x2f3f('0x3b')]=_0x5de488['attributes']['length']?_0x5de488['attributes']:_0x3e3dbb[_0x2f3f('0x37')];_0x5de488[_0x2f3f('0x56')]=qs[_0x2f3f('0x40')](_0x3cd4a9[_0x2f3f('0x3a')][_0x2f3f('0x40')]);_0x5de488[_0x2f3f('0x42')]=qs[_0x2f3f('0x39')](_[_0x2f3f('0x41')](_0x3cd4a9[_0x2f3f('0x3a')],_0x3e3dbb[_0x2f3f('0x39')]));if(_0x3cd4a9[_0x2f3f('0x3a')]['filter']){_0x5de488[_0x2f3f('0x42')]=_[_0x2f3f('0x43')](_0x5de488[_0x2f3f('0x42')],{'$or':_[_0x2f3f('0x38')](_0x5de488['attributes'],function(_0x30d7c2){var _0x40792e={};_0x40792e[_0x30d7c2]={'$like':'%'+_0x3cd4a9['query'][_0x2f3f('0x45')]+'%'};return _0x40792e;})});}_0x5de488=_['merge']({},_0x5de488,_0x3cd4a9[_0x2f3f('0x46')]);return _0x14e6a9[_0x2f3f('0x59')](_0x5de488);}})[_0x2f3f('0x1b')](function(_0x384584){if(_0x384584){_0x314167=_0x384584['length'];if(!_0x3cd4a9['query']['hasOwnProperty'](_0x2f3f('0x3f'))){_0x5de488[_0x2f3f('0x29')]=qs[_0x2f3f('0x29')](_0x3cd4a9[_0x2f3f('0x3a')][_0x2f3f('0x29')]);_0x5de488[_0x2f3f('0x28')]=qs['offset'](_0x3cd4a9[_0x2f3f('0x3a')]['offset']);}return _0x14e6a9[_0x2f3f('0x59')](_0x5de488);}})['then'](function(_0x411874){if(_0x411874){return _0x411874?{'count':_0x314167,'rows':_0x411874}:null;}})[_0x2f3f('0x1b')](respondWithResult(_0x2c8770,null))['catch'](handleError(_0x2c8770,null));};exports[_0x2f3f('0x5b')]=function(_0x511f3a,_0x3ddcf1,_0x4d7ba4){if(_0x511f3a['body']['id']){delete _0x511f3a[_0x2f3f('0x51')]['id'];}return db[_0x2f3f('0x33')][_0x2f3f('0x54')]({'where':{'id':_0x511f3a[_0x2f3f('0x52')]['id']}})[_0x2f3f('0x1b')](handleEntityNotFound(_0x3ddcf1,null))['then'](function(_0x34e7c4){if(_0x34e7c4){return _0x34e7c4[_0x2f3f('0x5b')](_0x511f3a[_0x2f3f('0x51')]['ids']||[]);}return null;})[_0x2f3f('0x1b')](respondWithResult(_0x3ddcf1,null))['catch'](handleError(_0x3ddcf1,null));}; \ No newline at end of file +var _0x1beb=['ZendeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','destroy','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','params','find','create','body','update','getFields','findOne'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1beb,0x17f));var _0xb1be=function(_0x5edddd,_0x98a0a5){_0x5edddd=_0x5edddd-0x0;var _0x1cc8cb=_0x1beb[_0x5edddd];return _0x1cc8cb;};'use strict';var pdf=require(_0xb1be('0x0'));var emlformat=require(_0xb1be('0x1'));var rimraf=require(_0xb1be('0x2'));var zipdir=require(_0xb1be('0x3'));var jsonpatch=require(_0xb1be('0x4'));var rp=require(_0xb1be('0x5'));var moment=require('moment');var BPromise=require(_0xb1be('0x6'));var Mustache=require('mustache');var util=require(_0xb1be('0x7'));var path=require('path');var sox=require(_0xb1be('0x8'));var csv=require(_0xb1be('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb1be('0xa'));var squel=require(_0xb1be('0xb'));var crypto=require(_0xb1be('0xc'));var jsforce=require(_0xb1be('0xd'));var deskjs=require(_0xb1be('0xe'));var toCsv=require(_0xb1be('0x9'));var querystring=require(_0xb1be('0xf'));var Papa=require(_0xb1be('0x10'));var Redis=require('ioredis');var authService=require(_0xb1be('0x11'));var qs=require(_0xb1be('0x12'));var as=require(_0xb1be('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb1be('0x14'));var config=require('../../config/environment');var db=require(_0xb1be('0x15'))['db'];var jayson=require(_0xb1be('0x16'));var client=jayson[_0xb1be('0x17')][_0xb1be('0x18')]({'port':0x232a});function checkPasswordPattern(_0x46c23d,_0x824f32,_0x336219){if(_0x336219){var _0x44203d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x44203d['test'](_0x824f32)){return _0x46c23d;}else{throw new db[(_0xb1be('0x19'))][(_0xb1be('0x1a'))](_0xb1be('0x1b'));}}else{return _0x46c23d;}}function respondWithRpcPromise(_0x57da13,_0x5af865,_0x1c28ee,_0x293d9e){return new BPromise(function(_0x20b128,_0x332f8f){var _0x4ab865=_0x293d9e||client;return _0x4ab865[_0xb1be('0x1c')](_0x57da13,_0x1c28ee)[_0xb1be('0x1d')](function(_0x460829){logger[_0xb1be('0x1e')](_0xb1be('0x1f'),_0x5af865,_0xb1be('0x20'));logger[_0xb1be('0x21')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5af865,_0xb1be('0x20'),JSON[_0xb1be('0x22')](_0x460829));if(_0x460829[_0xb1be('0x23')]){if(_0x460829['error'][_0xb1be('0x24')]===0x1f4){logger['error'](_0xb1be('0x1f'),_0x5af865,_0x460829[_0xb1be('0x23')][_0xb1be('0x25')]);return _0x332f8f(_0x460829['error'][_0xb1be('0x25')]);}logger[_0xb1be('0x23')](_0xb1be('0x1f'),_0x5af865,_0x460829['error'][_0xb1be('0x25')]);return _0x20b128(_0x460829['error']['message']);}else{logger[_0xb1be('0x1e')](_0xb1be('0x1f'),_0x5af865,'request\x20sent');_0x20b128(_0x460829['result'][_0xb1be('0x25')]);}})[_0xb1be('0x26')](function(_0x4b79bc){logger[_0xb1be('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5af865,_0x4b79bc);_0x332f8f(_0x4b79bc);});});}function respondWithStatusCode(_0x2c3000,_0x376161){_0x376161=_0x376161||0xcc;return function(_0x3e5124){if(_0x3e5124){return _0x2c3000[_0xb1be('0x27')](_0x376161);}return _0x2c3000[_0xb1be('0x28')](_0x376161)[_0xb1be('0x29')]();};}function respondWithResult(_0xe28a54,_0x230b05){_0x230b05=_0x230b05||0xc8;return function(_0x5c2c85){if(_0x5c2c85){return _0xe28a54['status'](_0x230b05)['json'](_0x5c2c85);}};}function respondWithFilteredResult(_0x79538e,_0x2ac417){return function(_0xc0f20){if(_0xc0f20){var _0x35ed19=_0xc0f20[_0xb1be('0x2a')],_0x318989=_0x2ac417[_0xb1be('0x2b')],_0x45f473=_0x2ac417[_0xb1be('0x2b')]+_0x2ac417['limit'],_0x3e8673;if(_0x45f473>=_0x35ed19){_0x45f473=_0x35ed19;_0x3e8673=0xc8;}else{_0x3e8673=0xce;}_0x79538e[_0xb1be('0x28')](_0x3e8673);return _0x79538e['set'](_0xb1be('0x2c'),_0x318989+'-'+_0x45f473+'/'+_0x35ed19)[_0xb1be('0x2d')](_0xc0f20);}return null;};}function patchUpdates(_0x43a7a8){return function(_0x10d00f){try{jsonpatch[_0xb1be('0x2e')](_0x10d00f,_0x43a7a8,!![]);}catch(_0x274f06){return BPromise[_0xb1be('0x2f')](_0x274f06);}return _0x10d00f[_0xb1be('0x30')]();};}function saveUpdates(_0x5dc920,_0x3681a8){return function(_0x1acc58){if(_0x1acc58){return _0x1acc58['update'](_0x5dc920)[_0xb1be('0x1d')](function(_0x44cbc0){return _0x44cbc0;});}return null;};}function removeEntity(_0x1f746b,_0x33b249){return function(_0x485bbb){if(_0x485bbb){return _0x485bbb[_0xb1be('0x31')]()[_0xb1be('0x1d')](function(){_0x1f746b[_0xb1be('0x28')](0xcc)[_0xb1be('0x29')]();});}};}function handleEntityNotFound(_0x360e82,_0x4f7915){return function(_0x39106f){if(!_0x39106f){_0x360e82[_0xb1be('0x27')](0x194);}return _0x39106f;};}function handleError(_0x943638,_0x17e912){_0x17e912=_0x17e912||0x1f4;return function(_0x31b602){logger[_0xb1be('0x23')](_0x31b602['stack']);if(_0x31b602['name']){delete _0x31b602[_0xb1be('0x32')];}_0x943638['status'](_0x17e912)['send'](_0x31b602);};}exports[_0xb1be('0x33')]=function(_0x897343,_0x156e4d){var _0x4b9945={},_0x2a7412={},_0x37173a={'count':0x0,'rows':[]};var _0x53acdc=_[_0xb1be('0x34')](db[_0xb1be('0x35')][_0xb1be('0x36')],function(_0x27e44b){return{'name':_0x27e44b[_0xb1be('0x37')],'type':_0x27e44b[_0xb1be('0x38')][_0xb1be('0x39')]};});_0x2a7412[_0xb1be('0x3a')]=_[_0xb1be('0x34')](_0x53acdc,'name');_0x2a7412[_0xb1be('0x3b')]=_[_0xb1be('0x3c')](_0x897343['query']);_0x2a7412['filters']=_[_0xb1be('0x3d')](_0x2a7412[_0xb1be('0x3a')],_0x2a7412[_0xb1be('0x3b')]);_0x4b9945[_0xb1be('0x3e')]=_[_0xb1be('0x3d')](_0x2a7412['model'],qs[_0xb1be('0x3f')](_0x897343['query'][_0xb1be('0x3f')]));_0x4b9945[_0xb1be('0x3e')]=_0x4b9945[_0xb1be('0x3e')][_0xb1be('0x40')]?_0x4b9945[_0xb1be('0x3e')]:_0x2a7412['model'];if(!_0x897343[_0xb1be('0x3b')][_0xb1be('0x41')](_0xb1be('0x42'))){_0x4b9945[_0xb1be('0x43')]=qs['limit'](_0x897343[_0xb1be('0x3b')][_0xb1be('0x43')]);_0x4b9945[_0xb1be('0x2b')]=qs['offset'](_0x897343[_0xb1be('0x3b')][_0xb1be('0x2b')]);}_0x4b9945[_0xb1be('0x44')]=qs[_0xb1be('0x45')](_0x897343[_0xb1be('0x3b')][_0xb1be('0x45')]);_0x4b9945[_0xb1be('0x46')]=qs[_0xb1be('0x47')](_[_0xb1be('0x48')](_0x897343[_0xb1be('0x3b')],_0x2a7412[_0xb1be('0x47')]),_0x53acdc);if(_0x897343[_0xb1be('0x3b')][_0xb1be('0x49')]){_0x4b9945[_0xb1be('0x46')]=_[_0xb1be('0x4a')](_0x4b9945[_0xb1be('0x46')],{'$or':_[_0xb1be('0x34')](_0x53acdc,function(_0x44020c){if(_0x44020c[_0xb1be('0x38')]!=='VIRTUAL'){var _0x542747={};_0x542747[_0x44020c['name']]={'$like':'%'+_0x897343['query'][_0xb1be('0x49')]+'%'};return _0x542747;}})});}_0x4b9945=_['merge']({},_0x4b9945,_0x897343[_0xb1be('0x4b')]);var _0x4a558d={'where':_0x4b9945['where']};return db[_0xb1be('0x35')]['count'](_0x4a558d)[_0xb1be('0x1d')](function(_0x56fff9){_0x37173a[_0xb1be('0x2a')]=_0x56fff9;if(_0x897343[_0xb1be('0x3b')][_0xb1be('0x4c')]){_0x4b9945[_0xb1be('0x4d')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xb1be('0x4e')](_0x4b9945);})[_0xb1be('0x1d')](function(_0x58716f){_0x37173a['rows']=_0x58716f;return _0x37173a;})[_0xb1be('0x1d')](respondWithFilteredResult(_0x156e4d,_0x4b9945))[_0xb1be('0x26')](handleError(_0x156e4d,null));};exports[_0xb1be('0x4f')]=function(_0x20b648,_0x112238){var _0x2c1289={'raw':![],'where':{'id':_0x20b648[_0xb1be('0x50')]['id']}},_0x1fb24f={};_0x1fb24f[_0xb1be('0x3a')]=_['keys'](db['ZendeskConfiguration'][_0xb1be('0x36')]);_0x1fb24f[_0xb1be('0x3b')]=_[_0xb1be('0x3c')](_0x20b648['query']);_0x1fb24f['filters']=_[_0xb1be('0x3d')](_0x1fb24f[_0xb1be('0x3a')],_0x1fb24f[_0xb1be('0x3b')]);_0x2c1289['attributes']=_['intersection'](_0x1fb24f[_0xb1be('0x3a')],qs['fields'](_0x20b648[_0xb1be('0x3b')]['fields']));_0x2c1289[_0xb1be('0x3e')]=_0x2c1289['attributes']['length']?_0x2c1289[_0xb1be('0x3e')]:_0x1fb24f[_0xb1be('0x3a')];if(_0x20b648[_0xb1be('0x3b')]['includeAll']){_0x2c1289[_0xb1be('0x4d')]=[{'all':!![]}];}_0x2c1289=_[_0xb1be('0x4a')]({},_0x2c1289,_0x20b648[_0xb1be('0x4b')]);return db[_0xb1be('0x35')][_0xb1be('0x51')](_0x2c1289)[_0xb1be('0x1d')](handleEntityNotFound(_0x112238,null))[_0xb1be('0x1d')](respondWithResult(_0x112238,null))['catch'](handleError(_0x112238,null));};exports['create']=function(_0x56a1b0,_0x67933){return db['ZendeskConfiguration'][_0xb1be('0x52')](_0x56a1b0[_0xb1be('0x53')],{})['then'](respondWithResult(_0x67933,0xc9))['catch'](handleError(_0x67933,null));};exports[_0xb1be('0x54')]=function(_0x227539,_0xc5ecdd){if(_0x227539[_0xb1be('0x53')]['id']){delete _0x227539[_0xb1be('0x53')]['id'];}return db['ZendeskConfiguration'][_0xb1be('0x51')]({'where':{'id':_0x227539[_0xb1be('0x50')]['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0xc5ecdd,null))[_0xb1be('0x1d')](saveUpdates(_0x227539[_0xb1be('0x53')],null))[_0xb1be('0x1d')](respondWithResult(_0xc5ecdd,null))[_0xb1be('0x26')](handleError(_0xc5ecdd,null));};exports['destroy']=function(_0x23f4a5,_0xc71040){return db['ZendeskConfiguration'][_0xb1be('0x51')]({'where':{'id':_0x23f4a5['params']['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0xc71040,null))[_0xb1be('0x1d')](removeEntity(_0xc71040,null))['catch'](handleError(_0xc71040,null));};exports[_0xb1be('0x55')]=function(_0x49b739,_0x45de65,_0x27509d){var _0x28f2c8={};var _0x305384={};var _0x16940e;var _0x3883f8;return db[_0xb1be('0x35')][_0xb1be('0x56')]({'where':{'id':_0x49b739['params']['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0x45de65,null))['then'](function(_0x38778d){if(_0x38778d){_0x16940e=_0x38778d;_0x305384[_0xb1be('0x3a')]=_[_0xb1be('0x3c')](db[_0xb1be('0x57')]['rawAttributes']);_0x305384['query']=_[_0xb1be('0x3c')](_0x49b739[_0xb1be('0x3b')]);_0x305384['filters']=_[_0xb1be('0x3d')](_0x305384[_0xb1be('0x3a')],_0x305384[_0xb1be('0x3b')]);_0x28f2c8[_0xb1be('0x3e')]=_[_0xb1be('0x3d')](_0x305384[_0xb1be('0x3a')],qs[_0xb1be('0x3f')](_0x49b739[_0xb1be('0x3b')][_0xb1be('0x3f')]));_0x28f2c8[_0xb1be('0x3e')]=_0x28f2c8[_0xb1be('0x3e')]['length']?_0x28f2c8[_0xb1be('0x3e')]:_0x305384[_0xb1be('0x3a')];_0x28f2c8[_0xb1be('0x44')]=qs[_0xb1be('0x45')](_0x49b739['query'][_0xb1be('0x45')]);_0x28f2c8['where']=qs[_0xb1be('0x47')](_['pick'](_0x49b739['query'],_0x305384['filters']));if(_0x49b739['query'][_0xb1be('0x49')]){_0x28f2c8['where']=_['merge'](_0x28f2c8[_0xb1be('0x46')],{'$or':_[_0xb1be('0x34')](_0x28f2c8[_0xb1be('0x3e')],function(_0x5d623d){var _0x1ff243={};_0x1ff243[_0x5d623d]={'$like':'%'+_0x49b739['query'][_0xb1be('0x49')]+'%'};return _0x1ff243;})});}_0x28f2c8=_[_0xb1be('0x4a')]({},_0x28f2c8,_0x49b739[_0xb1be('0x4b')]);return _0x16940e['getFields'](_0x28f2c8);}})[_0xb1be('0x1d')](function(_0x3bcf25){if(_0x3bcf25){_0x3883f8=_0x3bcf25[_0xb1be('0x40')];if(!_0x49b739[_0xb1be('0x3b')][_0xb1be('0x41')]('nolimit')){_0x28f2c8[_0xb1be('0x43')]=qs[_0xb1be('0x43')](_0x49b739['query'][_0xb1be('0x43')]);_0x28f2c8[_0xb1be('0x2b')]=qs[_0xb1be('0x2b')](_0x49b739[_0xb1be('0x3b')][_0xb1be('0x2b')]);}return _0x16940e['getFields'](_0x28f2c8);}})[_0xb1be('0x1d')](function(_0x252635){if(_0x252635){return _0x252635?{'count':_0x3883f8,'rows':_0x252635}:null;}})['then'](respondWithResult(_0x45de65,null))['catch'](handleError(_0x45de65,null));};exports[_0xb1be('0x58')]=function(_0x57a3e6,_0x49e342,_0x18a7df){var _0x15e27b={};var _0x3f6428={};var _0x3f16b0;var _0x4fa168;return db[_0xb1be('0x35')][_0xb1be('0x56')]({'where':{'id':_0x57a3e6[_0xb1be('0x50')]['id']}})['then'](handleEntityNotFound(_0x49e342,null))[_0xb1be('0x1d')](function(_0x3b0e2e){if(_0x3b0e2e){_0x3f16b0=_0x3b0e2e;_0x3f6428[_0xb1be('0x3a')]=_[_0xb1be('0x3c')](db[_0xb1be('0x57')][_0xb1be('0x36')]);_0x3f6428[_0xb1be('0x3b')]=_[_0xb1be('0x3c')](_0x57a3e6['query']);_0x3f6428['filters']=_[_0xb1be('0x3d')](_0x3f6428['model'],_0x3f6428[_0xb1be('0x3b')]);_0x15e27b[_0xb1be('0x3e')]=_[_0xb1be('0x3d')](_0x3f6428[_0xb1be('0x3a')],qs['fields'](_0x57a3e6[_0xb1be('0x3b')][_0xb1be('0x3f')]));_0x15e27b[_0xb1be('0x3e')]=_0x15e27b[_0xb1be('0x3e')]['length']?_0x15e27b['attributes']:_0x3f6428[_0xb1be('0x3a')];_0x15e27b['order']=qs[_0xb1be('0x45')](_0x57a3e6[_0xb1be('0x3b')]['sort']);_0x15e27b['where']=qs[_0xb1be('0x47')](_[_0xb1be('0x48')](_0x57a3e6[_0xb1be('0x3b')],_0x3f6428[_0xb1be('0x47')]));if(_0x57a3e6[_0xb1be('0x3b')][_0xb1be('0x49')]){_0x15e27b[_0xb1be('0x46')]=_['merge'](_0x15e27b[_0xb1be('0x46')],{'$or':_[_0xb1be('0x34')](_0x15e27b[_0xb1be('0x3e')],function(_0x310d53){var _0x3c481b={};_0x3c481b[_0x310d53]={'$like':'%'+_0x57a3e6[_0xb1be('0x3b')][_0xb1be('0x49')]+'%'};return _0x3c481b;})});}_0x15e27b=_[_0xb1be('0x4a')]({},_0x15e27b,_0x57a3e6[_0xb1be('0x4b')]);return _0x3f16b0['getSubjects'](_0x15e27b);}})[_0xb1be('0x1d')](function(_0x5bf254){if(_0x5bf254){_0x4fa168=_0x5bf254[_0xb1be('0x40')];if(!_0x57a3e6[_0xb1be('0x3b')][_0xb1be('0x41')](_0xb1be('0x42'))){_0x15e27b[_0xb1be('0x43')]=qs[_0xb1be('0x43')](_0x57a3e6[_0xb1be('0x3b')][_0xb1be('0x43')]);_0x15e27b[_0xb1be('0x2b')]=qs[_0xb1be('0x2b')](_0x57a3e6['query'][_0xb1be('0x2b')]);}return _0x3f16b0[_0xb1be('0x58')](_0x15e27b);}})[_0xb1be('0x1d')](function(_0x13e7da){if(_0x13e7da){return _0x13e7da?{'count':_0x4fa168,'rows':_0x13e7da}:null;}})['then'](respondWithResult(_0x49e342,null))['catch'](handleError(_0x49e342,null));};exports[_0xb1be('0x59')]=function(_0x2562d3,_0x29854f,_0x55dc69){var _0x349822={};var _0x35e438={};var _0x134b0b;var _0x6a8bd4;return db[_0xb1be('0x35')][_0xb1be('0x56')]({'where':{'id':_0x2562d3[_0xb1be('0x50')]['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0x29854f,null))[_0xb1be('0x1d')](function(_0x253445){if(_0x253445){_0x134b0b=_0x253445;_0x35e438[_0xb1be('0x3a')]=_[_0xb1be('0x3c')](db[_0xb1be('0x57')]['rawAttributes']);_0x35e438[_0xb1be('0x3b')]=_[_0xb1be('0x3c')](_0x2562d3[_0xb1be('0x3b')]);_0x35e438[_0xb1be('0x47')]=_[_0xb1be('0x3d')](_0x35e438[_0xb1be('0x3a')],_0x35e438[_0xb1be('0x3b')]);_0x349822[_0xb1be('0x3e')]=_['intersection'](_0x35e438[_0xb1be('0x3a')],qs['fields'](_0x2562d3['query']['fields']));_0x349822[_0xb1be('0x3e')]=_0x349822[_0xb1be('0x3e')][_0xb1be('0x40')]?_0x349822[_0xb1be('0x3e')]:_0x35e438[_0xb1be('0x3a')];_0x349822[_0xb1be('0x44')]=qs[_0xb1be('0x45')](_0x2562d3[_0xb1be('0x3b')][_0xb1be('0x45')]);_0x349822[_0xb1be('0x46')]=qs[_0xb1be('0x47')](_['pick'](_0x2562d3[_0xb1be('0x3b')],_0x35e438[_0xb1be('0x47')]));if(_0x2562d3[_0xb1be('0x3b')]['filter']){_0x349822[_0xb1be('0x46')]=_[_0xb1be('0x4a')](_0x349822['where'],{'$or':_['map'](_0x349822[_0xb1be('0x3e')],function(_0x4ba7f6){var _0x12620f={};_0x12620f[_0x4ba7f6]={'$like':'%'+_0x2562d3[_0xb1be('0x3b')][_0xb1be('0x49')]+'%'};return _0x12620f;})});}_0x349822=_[_0xb1be('0x4a')]({},_0x349822,_0x2562d3[_0xb1be('0x4b')]);return _0x134b0b[_0xb1be('0x59')](_0x349822);}})[_0xb1be('0x1d')](function(_0x1a2249){if(_0x1a2249){_0x6a8bd4=_0x1a2249[_0xb1be('0x40')];if(!_0x2562d3['query']['hasOwnProperty']('nolimit')){_0x349822[_0xb1be('0x43')]=qs[_0xb1be('0x43')](_0x2562d3[_0xb1be('0x3b')][_0xb1be('0x43')]);_0x349822[_0xb1be('0x2b')]=qs[_0xb1be('0x2b')](_0x2562d3[_0xb1be('0x3b')]['offset']);}return _0x134b0b[_0xb1be('0x59')](_0x349822);}})[_0xb1be('0x1d')](function(_0x75f14b){if(_0x75f14b){return _0x75f14b?{'count':_0x6a8bd4,'rows':_0x75f14b}:null;}})[_0xb1be('0x1d')](respondWithResult(_0x29854f,null))['catch'](handleError(_0x29854f,null));};exports['getTags']=function(_0x1d0138,_0x142aa4,_0x2a68a9){var _0x34c74f={};var _0x5dd973={};var _0x5212f8;var _0x243338;return db['ZendeskConfiguration'][_0xb1be('0x56')]({'where':{'id':_0x1d0138[_0xb1be('0x50')]['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0x142aa4,null))[_0xb1be('0x1d')](function(_0x19d14b){if(_0x19d14b){_0x5212f8=_0x19d14b;_0x5dd973[_0xb1be('0x3a')]=_[_0xb1be('0x3c')](db[_0xb1be('0x5a')][_0xb1be('0x36')]);_0x5dd973[_0xb1be('0x3b')]=_[_0xb1be('0x3c')](_0x1d0138[_0xb1be('0x3b')]);_0x5dd973[_0xb1be('0x47')]=_[_0xb1be('0x3d')](_0x5dd973[_0xb1be('0x3a')],_0x5dd973[_0xb1be('0x3b')]);_0x34c74f[_0xb1be('0x3e')]=_[_0xb1be('0x3d')](_0x5dd973[_0xb1be('0x3a')],qs[_0xb1be('0x3f')](_0x1d0138[_0xb1be('0x3b')][_0xb1be('0x3f')]));_0x34c74f[_0xb1be('0x3e')]=_0x34c74f[_0xb1be('0x3e')][_0xb1be('0x40')]?_0x34c74f['attributes']:_0x5dd973[_0xb1be('0x3a')];_0x34c74f[_0xb1be('0x44')]=qs['sort'](_0x1d0138[_0xb1be('0x3b')]['sort']);_0x34c74f[_0xb1be('0x46')]=qs['filters'](_[_0xb1be('0x48')](_0x1d0138[_0xb1be('0x3b')],_0x5dd973[_0xb1be('0x47')]));if(_0x1d0138['query']['filter']){_0x34c74f[_0xb1be('0x46')]=_[_0xb1be('0x4a')](_0x34c74f[_0xb1be('0x46')],{'$or':_[_0xb1be('0x34')](_0x34c74f[_0xb1be('0x3e')],function(_0x51eb20){var _0x4db2de={};_0x4db2de[_0x51eb20]={'$like':'%'+_0x1d0138[_0xb1be('0x3b')][_0xb1be('0x49')]+'%'};return _0x4db2de;})});}_0x34c74f=_[_0xb1be('0x4a')]({},_0x34c74f,_0x1d0138[_0xb1be('0x4b')]);return _0x5212f8[_0xb1be('0x5b')](_0x34c74f);}})[_0xb1be('0x1d')](function(_0x16a83e){if(_0x16a83e){_0x243338=_0x16a83e[_0xb1be('0x40')];if(!_0x1d0138['query'][_0xb1be('0x41')](_0xb1be('0x42'))){_0x34c74f[_0xb1be('0x43')]=qs[_0xb1be('0x43')](_0x1d0138['query'][_0xb1be('0x43')]);_0x34c74f[_0xb1be('0x2b')]=qs['offset'](_0x1d0138[_0xb1be('0x3b')][_0xb1be('0x2b')]);}return _0x5212f8[_0xb1be('0x5b')](_0x34c74f);}})['then'](function(_0x38a70b){if(_0x38a70b){return _0x38a70b?{'count':_0x243338,'rows':_0x38a70b}:null;}})['then'](respondWithResult(_0x142aa4,null))[_0xb1be('0x26')](handleError(_0x142aa4,null));};exports['setTags']=function(_0x3e201c,_0x492834,_0x4574b3){if(_0x3e201c[_0xb1be('0x53')]['id']){delete _0x3e201c['body']['id'];}return db[_0xb1be('0x35')][_0xb1be('0x56')]({'where':{'id':_0x3e201c[_0xb1be('0x50')]['id']}})[_0xb1be('0x1d')](handleEntityNotFound(_0x492834,null))[_0xb1be('0x1d')](function(_0x5c30fc){if(_0x5c30fc){return _0x5c30fc[_0xb1be('0x5c')](_0x3e201c['body'][_0xb1be('0x5d')]||[]);}return null;})[_0xb1be('0x1d')](respondWithResult(_0x492834,null))[_0xb1be('0x26')](handleError(_0x492834,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 8e39748..0ca34cd 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 _0x610c=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x610c,0xd8));var _0xc610=function(_0x235e7e,_0x5079e9){_0x235e7e=_0x235e7e-0x0;var _0x30410e=_0x610c[_0x235e7e];return _0x30410e;};'use strict';var _=require(_0xc610('0x0'));var util=require(_0xc610('0x1'));var logger=require('../../config/logger')(_0xc610('0x2'));var moment=require(_0xc610('0x3'));var BPromise=require('bluebird');var rp=require(_0xc610('0x4'));var fs=require('fs');var path=require(_0xc610('0x5'));var rimraf=require(_0xc610('0x6'));var config=require(_0xc610('0x7'));var attributes=require(_0xc610('0x8'));module[_0xc610('0x9')]=function(_0x139d04,_0x1b7ff3){return _0x139d04[_0xc610('0xa')](_0xc610('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bc2=['rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4c0620,_0x59846d){var _0x11d3c2=function(_0x3c6cd3){while(--_0x3c6cd3){_0x4c0620['push'](_0x4c0620['shift']());}};_0x11d3c2(++_0x59846d);}(_0x0bc2,0x8a));var _0x20bc=function(_0x3e9db1,_0x34b2f6){_0x3e9db1=_0x3e9db1-0x0;var _0x990b8=_0x0bc2[_0x3e9db1];return _0x990b8;};'use strict';var _=require(_0x20bc('0x0'));var util=require(_0x20bc('0x1'));var logger=require(_0x20bc('0x2'))(_0x20bc('0x3'));var moment=require('moment');var BPromise=require(_0x20bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20bc('0x5'));var rimraf=require(_0x20bc('0x6'));var config=require(_0x20bc('0x7'));var attributes=require(_0x20bc('0x8'));module[_0x20bc('0x9')]=function(_0x140c08,_0x2cf268){return _0x140c08[_0x20bc('0xa')](_0x20bc('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 83bb671..0648b47 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 _0xd83e=['ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0xd83e,0x77));var _0xed83=function(_0x1a86d0,_0x568502){_0x1a86d0=_0x1a86d0-0x0;var _0x58a7ee=_0xd83e[_0x1a86d0];return _0x58a7ee;};'use strict';var _=require(_0xed83('0x0'));var util=require(_0xed83('0x1'));var moment=require(_0xed83('0x2'));var BPromise=require(_0xed83('0x3'));var rs=require(_0xed83('0x4'));var fs=require('fs');var Redis=require(_0xed83('0x5'));var db=require(_0xed83('0x6'))['db'];var utils=require(_0xed83('0x7'));var logger=require(_0xed83('0x8'))(_0xed83('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed83('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eb770,_0x23925a,_0xa57647){return new BPromise(function(_0x32e491,_0x5508d7){return client['request'](_0x3eb770,_0xa57647)[_0xed83('0xb')](function(_0x486c97){logger[_0xed83('0xc')](_0xed83('0xd'),_0x23925a,'request\x20sent');logger[_0xed83('0xe')](_0xed83('0xf'),_0x23925a,_0xed83('0x10'),JSON[_0xed83('0x11')](_0x486c97));if(_0x486c97[_0xed83('0x12')]){if(_0x486c97[_0xed83('0x12')][_0xed83('0x13')]===0x1f4){logger['error'](_0xed83('0xd'),_0x23925a,_0x486c97['error'][_0xed83('0x14')]);return _0x5508d7(_0x486c97[_0xed83('0x12')][_0xed83('0x14')]);}logger[_0xed83('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x23925a,_0x486c97[_0xed83('0x12')]['message']);return _0x32e491(_0x486c97['error']['message']);}else{logger[_0xed83('0xc')](_0xed83('0xd'),_0x23925a,_0xed83('0x10'));_0x32e491(_0x486c97['result'][_0xed83('0x14')]);}})[_0xed83('0x15')](function(_0x1defce){logger['error'](_0xed83('0xd'),_0x23925a,_0x1defce);_0x5508d7(_0x1defce);});});} \ No newline at end of file +var _0xebbf=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x2a9ec5,_0x443383){var _0x2a6113=function(_0x1ee453){while(--_0x1ee453){_0x2a9ec5['push'](_0x2a9ec5['shift']());}};_0x2a6113(++_0x443383);}(_0xebbf,0x108));var _0xfebb=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xebbf[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0xfebb('0x0'));var moment=require(_0xfebb('0x1'));var BPromise=require(_0xfebb('0x2'));var rs=require(_0xfebb('0x3'));var fs=require('fs');var Redis=require(_0xfebb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfebb('0x5'));var logger=require(_0xfebb('0x6'))(_0xfebb('0x7'));var config=require(_0xfebb('0x8'));var jayson=require(_0xfebb('0x9'));var client=jayson[_0xfebb('0xa')][_0xfebb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46c16d,_0xc0f277,_0x440f71){return new BPromise(function(_0x355212,_0x502ecf){return client[_0xfebb('0xc')](_0x46c16d,_0x440f71)['then'](function(_0x2972f5){logger[_0xfebb('0xd')](_0xfebb('0xe'),_0xc0f277,'request\x20sent');logger['debug'](_0xfebb('0xf'),_0xc0f277,_0xfebb('0x10'),JSON['stringify'](_0x2972f5));if(_0x2972f5[_0xfebb('0x11')]){if(_0x2972f5['error'][_0xfebb('0x12')]===0x1f4){logger[_0xfebb('0x11')](_0xfebb('0xe'),_0xc0f277,_0x2972f5[_0xfebb('0x11')][_0xfebb('0x13')]);return _0x502ecf(_0x2972f5[_0xfebb('0x11')][_0xfebb('0x13')]);}logger['error'](_0xfebb('0xe'),_0xc0f277,_0x2972f5[_0xfebb('0x11')][_0xfebb('0x13')]);return _0x355212(_0x2972f5['error'][_0xfebb('0x13')]);}else{logger[_0xfebb('0xd')](_0xfebb('0xe'),_0xc0f277,_0xfebb('0x10'));_0x355212(_0x2972f5[_0xfebb('0x14')][_0xfebb('0x13')]);}})[_0xfebb('0x15')](function(_0x4900e9){logger[_0xfebb('0x11')](_0xfebb('0xe'),_0xc0f277,_0x4900e9);_0x502ecf(_0x4900e9);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8f250f5..7c78e54 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 _0xb713=['get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller'];(function(_0x2c6b21,_0x530ac6){var _0x7b6022=function(_0x1da2d7){while(--_0x1da2d7){_0x2c6b21['push'](_0x2c6b21['shift']());}};_0x7b6022(++_0x530ac6);}(_0xb713,0x183));var _0x3b71=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0xb713[_0x1fc4e2];return _0x2ba184;};'use strict';var multer=require(_0x3b71('0x0'));var util=require(_0x3b71('0x1'));var path=require(_0x3b71('0x2'));var timeout=require(_0x3b71('0x3'));var express=require(_0x3b71('0x4'));var router=express[_0x3b71('0x5')]();var auth=require(_0x3b71('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3b71('0x7'));var controller=require(_0x3b71('0x8'));router[_0x3b71('0x9')]('/',auth[_0x3b71('0xa')](),controller[_0x3b71('0xb')]);router[_0x3b71('0x9')](_0x3b71('0xc'),auth[_0x3b71('0xa')](),controller[_0x3b71('0xd')]);router[_0x3b71('0xe')]('/',auth[_0x3b71('0xa')](),controller[_0x3b71('0xf')]);router['put'](_0x3b71('0xc'),auth[_0x3b71('0xa')](),controller['update']);router['delete']('/:id',auth[_0x3b71('0xa')](),controller[_0x3b71('0x10')]);module[_0x3b71('0x11')]=router; \ No newline at end of file +var _0x975f=['show','post','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x30436f,_0x27c7c6){var _0xfbbde0=function(_0x1a6db8){while(--_0x1a6db8){_0x30436f['push'](_0x30436f['shift']());}};_0xfbbde0(++_0x27c7c6);}(_0x975f,0x1e1));var _0xf975=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0x975f[_0x58965a];return _0x254efc;};'use strict';var multer=require('multer');var util=require(_0xf975('0x0'));var path=require(_0xf975('0x1'));var timeout=require(_0xf975('0x2'));var express=require(_0xf975('0x3'));var router=express[_0xf975('0x4')]();var auth=require(_0xf975('0x5'));var interaction=require(_0xf975('0x6'));var config=require('../../config/environment');var controller=require(_0xf975('0x7'));router[_0xf975('0x8')]('/',auth[_0xf975('0x9')](),controller[_0xf975('0xa')]);router[_0xf975('0x8')](_0xf975('0xb'),auth[_0xf975('0x9')](),controller[_0xf975('0xc')]);router[_0xf975('0xd')]('/',auth[_0xf975('0x9')](),controller['create']);router[_0xf975('0xe')](_0xf975('0xb'),auth[_0xf975('0x9')](),controller[_0xf975('0xf')]);router['delete'](_0xf975('0xb'),auth[_0xf975('0x9')](),controller[_0xf975('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 34c9cb4..ed61feb 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 _0x2367=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2367,0x7f));var _0x7236=function(_0x644000,_0x47a728){_0x644000=_0x644000-0x0;var _0x39a2b6=_0x2367[_0x644000];return _0x39a2b6;};'use strict';var Sequelize=require(_0x7236('0x0'));module[_0x7236('0x1')]={'type':{'type':Sequelize[_0x7236('0x2')]('string',_0x7236('0x3'),_0x7236('0x4'),_0x7236('0x5')),'defaultValue':_0x7236('0x6')},'content':{'type':Sequelize[_0x7236('0x7')]},'key':{'type':Sequelize[_0x7236('0x7')]},'keyType':{'type':Sequelize[_0x7236('0x2')](_0x7236('0x6'),_0x7236('0x3'),_0x7236('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7236('0x7')]},'nameField':{'type':Sequelize[_0x7236('0x7')]},'customField':{'type':Sequelize[_0x7236('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7236('0x7')]}}; \ No newline at end of file +var _0x7dc0=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x3330ae,_0x292fd5){var _0x304fcd=function(_0x11255b){while(--_0x11255b){_0x3330ae['push'](_0x3330ae['shift']());}};_0x304fcd(++_0x292fd5);}(_0x7dc0,0x18f));var _0x07dc=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x7dc0[_0x257495];return _0x3849aa;};'use strict';var Sequelize=require(_0x07dc('0x0'));module[_0x07dc('0x1')]={'type':{'type':Sequelize[_0x07dc('0x2')](_0x07dc('0x3'),_0x07dc('0x4'),_0x07dc('0x5'),_0x07dc('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x07dc('0x7')]},'key':{'type':Sequelize[_0x07dc('0x7')]},'keyType':{'type':Sequelize[_0x07dc('0x2')](_0x07dc('0x3'),_0x07dc('0x4'),_0x07dc('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x07dc('0x7')]},'nameField':{'type':Sequelize[_0x07dc('0x7')]},'customField':{'type':Sequelize[_0x07dc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x07dc('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 5e8b6dd..8f18440 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 _0x4a5a=['then','destroy','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','show','params','keys','include','find','catch','create','body','html-pdf','eml-format','request-promise','bluebird','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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'];(function(_0x2a2305,_0x3b637e){var _0x2c9567=function(_0x5b8476){while(--_0x5b8476){_0x2a2305['push'](_0x2a2305['shift']());}};_0x2c9567(++_0x3b637e);}(_0x4a5a,0x16e));var _0xa4a5=function(_0x2ed544,_0x268e05){_0x2ed544=_0x2ed544-0x0;var _0x370ffe=_0x4a5a[_0x2ed544];return _0x370ffe;};'use strict';var pdf=require(_0xa4a5('0x0'));var emlformat=require(_0xa4a5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa4a5('0x2'));var moment=require('moment');var BPromise=require(_0xa4a5('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa4a5('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa4a5('0x5'));var crypto=require(_0xa4a5('0x6'));var jsforce=require(_0xa4a5('0x7'));var deskjs=require(_0xa4a5('0x8'));var toCsv=require(_0xa4a5('0x4'));var querystring=require(_0xa4a5('0x9'));var Papa=require(_0xa4a5('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa4a5('0xb'));var hardwareService=require(_0xa4a5('0xc'));var logger=require(_0xa4a5('0xd'))(_0xa4a5('0xe'));var utils=require('../../config/utils');var config=require(_0xa4a5('0xf'));var db=require(_0xa4a5('0x10'))['db'];function respondWithStatusCode(_0x35e273,_0x11ab48){_0x11ab48=_0x11ab48||0xcc;return function(_0x384dfa){if(_0x384dfa){return _0x35e273[_0xa4a5('0x11')](_0x11ab48);}return _0x35e273[_0xa4a5('0x12')](_0x11ab48)[_0xa4a5('0x13')]();};}function respondWithResult(_0x1d7eb6,_0x33a67a){_0x33a67a=_0x33a67a||0xc8;return function(_0x3ee642){if(_0x3ee642){return _0x1d7eb6[_0xa4a5('0x12')](_0x33a67a)[_0xa4a5('0x14')](_0x3ee642);}};}function respondWithFilteredResult(_0x2804fe,_0xeef2b6){return function(_0x5d8838){if(_0x5d8838){var _0x2cf924=_0x5d8838[_0xa4a5('0x15')],_0x595a7a=_0xeef2b6[_0xa4a5('0x16')],_0x9ade16=_0xeef2b6[_0xa4a5('0x16')]+_0xeef2b6[_0xa4a5('0x17')],_0x2f81ad;if(_0x9ade16>=_0x2cf924){_0x9ade16=_0x2cf924;_0x2f81ad=0xc8;}else{_0x2f81ad=0xce;}_0x2804fe[_0xa4a5('0x12')](_0x2f81ad);return _0x2804fe[_0xa4a5('0x18')](_0xa4a5('0x19'),_0x595a7a+'-'+_0x9ade16+'/'+_0x2cf924)[_0xa4a5('0x14')](_0x5d8838);}return null;};}function patchUpdates(_0x2f042d){return function(_0x4d5bb8){try{jsonpatch[_0xa4a5('0x1a')](_0x4d5bb8,_0x2f042d,!![]);}catch(_0x2bd0ad){return BPromise[_0xa4a5('0x1b')](_0x2bd0ad);}return _0x4d5bb8[_0xa4a5('0x1c')]();};}function saveUpdates(_0x2aaead,_0x11fa7d){return function(_0x58daef){if(_0x58daef){return _0x58daef[_0xa4a5('0x1d')](_0x2aaead)[_0xa4a5('0x1e')](function(_0x174168){return _0x174168;});}return null;};}function removeEntity(_0x4560f1,_0x5d7a3b){return function(_0x4a8e8d){if(_0x4a8e8d){return _0x4a8e8d[_0xa4a5('0x1f')]()[_0xa4a5('0x1e')](function(){_0x4560f1[_0xa4a5('0x12')](0xcc)[_0xa4a5('0x13')]();});}};}function handleEntityNotFound(_0x134d95,_0x81d74d){return function(_0x203b13){if(!_0x203b13){_0x134d95[_0xa4a5('0x11')](0x194);}return _0x203b13;};}function handleError(_0x43488a,_0x4b480d){_0x4b480d=_0x4b480d||0x1f4;return function(_0x287d70){logger[_0xa4a5('0x20')](_0x287d70[_0xa4a5('0x21')]);if(_0x287d70[_0xa4a5('0x22')]){delete _0x287d70[_0xa4a5('0x22')];}_0x43488a[_0xa4a5('0x12')](_0x4b480d)['send'](_0x287d70);};}exports[_0xa4a5('0x23')]=function(_0x335ecf,_0x41b78e){var _0x694457={},_0x310f7={},_0x528d31={'count':0x0,'rows':[]};var _0x2c5cd1=_[_0xa4a5('0x24')](db[_0xa4a5('0x25')][_0xa4a5('0x26')],function(_0xa0ef26){return{'name':_0xa0ef26[_0xa4a5('0x27')],'type':_0xa0ef26[_0xa4a5('0x28')]['key']};});_0x310f7[_0xa4a5('0x29')]=_[_0xa4a5('0x24')](_0x2c5cd1,_0xa4a5('0x22'));_0x310f7[_0xa4a5('0x2a')]=_['keys'](_0x335ecf[_0xa4a5('0x2a')]);_0x310f7[_0xa4a5('0x2b')]=_[_0xa4a5('0x2c')](_0x310f7[_0xa4a5('0x29')],_0x310f7[_0xa4a5('0x2a')]);_0x694457[_0xa4a5('0x2d')]=_[_0xa4a5('0x2c')](_0x310f7[_0xa4a5('0x29')],qs[_0xa4a5('0x2e')](_0x335ecf[_0xa4a5('0x2a')]['fields']));_0x694457['attributes']=_0x694457[_0xa4a5('0x2d')][_0xa4a5('0x2f')]?_0x694457[_0xa4a5('0x2d')]:_0x310f7[_0xa4a5('0x29')];if(!_0x335ecf[_0xa4a5('0x2a')]['hasOwnProperty'](_0xa4a5('0x30'))){_0x694457[_0xa4a5('0x17')]=qs[_0xa4a5('0x17')](_0x335ecf[_0xa4a5('0x2a')]['limit']);_0x694457[_0xa4a5('0x16')]=qs[_0xa4a5('0x16')](_0x335ecf[_0xa4a5('0x2a')][_0xa4a5('0x16')]);}_0x694457[_0xa4a5('0x31')]=qs[_0xa4a5('0x32')](_0x335ecf[_0xa4a5('0x2a')]['sort']);_0x694457['where']=qs[_0xa4a5('0x2b')](_[_0xa4a5('0x33')](_0x335ecf[_0xa4a5('0x2a')],_0x310f7[_0xa4a5('0x2b')]),_0x2c5cd1);if(_0x335ecf[_0xa4a5('0x2a')][_0xa4a5('0x34')]){_0x694457[_0xa4a5('0x35')]=_[_0xa4a5('0x36')](_0x694457[_0xa4a5('0x35')],{'$or':_[_0xa4a5('0x24')](_0x2c5cd1,function(_0x3de6c9){if(_0x3de6c9[_0xa4a5('0x28')]!=='VIRTUAL'){var _0x1a7e92={};_0x1a7e92[_0x3de6c9[_0xa4a5('0x22')]]={'$like':'%'+_0x335ecf[_0xa4a5('0x2a')][_0xa4a5('0x34')]+'%'};return _0x1a7e92;}})});}_0x694457=_['merge']({},_0x694457,_0x335ecf[_0xa4a5('0x37')]);var _0x368025={'where':_0x694457[_0xa4a5('0x35')]};return db[_0xa4a5('0x25')][_0xa4a5('0x15')](_0x368025)[_0xa4a5('0x1e')](function(_0x404759){_0x528d31[_0xa4a5('0x15')]=_0x404759;if(_0x335ecf[_0xa4a5('0x2a')][_0xa4a5('0x38')]){_0x694457['include']=[{'all':!![]}];}return db[_0xa4a5('0x25')]['findAll'](_0x694457);})['then'](function(_0x4c61fd){_0x528d31[_0xa4a5('0x39')]=_0x4c61fd;return _0x528d31;})['then'](respondWithFilteredResult(_0x41b78e,_0x694457))['catch'](handleError(_0x41b78e,null));};exports[_0xa4a5('0x3a')]=function(_0x168530,_0x20e820){var _0x4bae48={'raw':!![],'where':{'id':_0x168530[_0xa4a5('0x3b')]['id']}},_0xd9c06b={};_0xd9c06b['model']=_['keys'](db[_0xa4a5('0x25')][_0xa4a5('0x26')]);_0xd9c06b[_0xa4a5('0x2a')]=_[_0xa4a5('0x3c')](_0x168530[_0xa4a5('0x2a')]);_0xd9c06b[_0xa4a5('0x2b')]=_[_0xa4a5('0x2c')](_0xd9c06b[_0xa4a5('0x29')],_0xd9c06b[_0xa4a5('0x2a')]);_0x4bae48['attributes']=_[_0xa4a5('0x2c')](_0xd9c06b['model'],qs['fields'](_0x168530[_0xa4a5('0x2a')]['fields']));_0x4bae48[_0xa4a5('0x2d')]=_0x4bae48[_0xa4a5('0x2d')]['length']?_0x4bae48[_0xa4a5('0x2d')]:_0xd9c06b[_0xa4a5('0x29')];if(_0x168530[_0xa4a5('0x2a')][_0xa4a5('0x38')]){_0x4bae48[_0xa4a5('0x3d')]=[{'all':!![]}];}_0x4bae48=_[_0xa4a5('0x36')]({},_0x4bae48,_0x168530[_0xa4a5('0x37')]);return db[_0xa4a5('0x25')][_0xa4a5('0x3e')](_0x4bae48)['then'](handleEntityNotFound(_0x20e820,null))[_0xa4a5('0x1e')](respondWithResult(_0x20e820,null))[_0xa4a5('0x3f')](handleError(_0x20e820,null));};exports['create']=function(_0x2dd062,_0x24c9d8){return db[_0xa4a5('0x25')][_0xa4a5('0x40')](_0x2dd062[_0xa4a5('0x41')],{})['then'](respondWithResult(_0x24c9d8,0xc9))[_0xa4a5('0x3f')](handleError(_0x24c9d8,null));};exports['update']=function(_0x588982,_0x2d0cc2){if(_0x588982['body']['id']){delete _0x588982['body']['id'];}return db[_0xa4a5('0x25')][_0xa4a5('0x3e')]({'where':{'id':_0x588982[_0xa4a5('0x3b')]['id']}})[_0xa4a5('0x1e')](handleEntityNotFound(_0x2d0cc2,null))[_0xa4a5('0x1e')](saveUpdates(_0x588982[_0xa4a5('0x41')],null))[_0xa4a5('0x1e')](respondWithResult(_0x2d0cc2,null))['catch'](handleError(_0x2d0cc2,null));};exports[_0xa4a5('0x1f')]=function(_0x181948,_0x40dc9c){return db[_0xa4a5('0x25')][_0xa4a5('0x3e')]({'where':{'id':_0x181948[_0xa4a5('0x3b')]['id']}})[_0xa4a5('0x1e')](handleEntityNotFound(_0x40dc9c,null))[_0xa4a5('0x1e')](removeEntity(_0x40dc9c,null))[_0xa4a5('0x3f')](handleError(_0x40dc9c,null));}; \ No newline at end of file +var _0xb253=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','keys','fields','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0xb253,0x14f));var _0x3b25=function(_0x3a65f6,_0x58863a){_0x3a65f6=_0x3a65f6-0x0;var _0x111bf6=_0xb253[_0x3a65f6];return _0x111bf6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3b25('0x0'));var rimraf=require(_0x3b25('0x1'));var zipdir=require(_0x3b25('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b25('0x3'));var moment=require(_0x3b25('0x4'));var BPromise=require(_0x3b25('0x5'));var Mustache=require(_0x3b25('0x6'));var util=require(_0x3b25('0x7'));var path=require(_0x3b25('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b25('0x9'));var fs=require('fs');var _=require(_0x3b25('0xa'));var squel=require(_0x3b25('0xb'));var crypto=require(_0x3b25('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3b25('0xd'));var toCsv=require(_0x3b25('0xe'));var querystring=require(_0x3b25('0xf'));var Papa=require(_0x3b25('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3b25('0x11'));var as=require(_0x3b25('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b25('0x13'))(_0x3b25('0x14'));var utils=require('../../config/utils');var config=require(_0x3b25('0x15'));var db=require(_0x3b25('0x16'))['db'];function respondWithStatusCode(_0x104b5c,_0x1947cf){_0x1947cf=_0x1947cf||0xcc;return function(_0x3630ed){if(_0x3630ed){return _0x104b5c[_0x3b25('0x17')](_0x1947cf);}return _0x104b5c['status'](_0x1947cf)[_0x3b25('0x18')]();};}function respondWithResult(_0x189175,_0x1f8449){_0x1f8449=_0x1f8449||0xc8;return function(_0x4fb029){if(_0x4fb029){return _0x189175['status'](_0x1f8449)[_0x3b25('0x19')](_0x4fb029);}};}function respondWithFilteredResult(_0x166a58,_0x4b90e0){return function(_0x5ed754){if(_0x5ed754){var _0xe3a91=_0x5ed754['count'],_0x476ec1=_0x4b90e0[_0x3b25('0x1a')],_0x1cffe1=_0x4b90e0[_0x3b25('0x1a')]+_0x4b90e0['limit'],_0xf4f771;if(_0x1cffe1>=_0xe3a91){_0x1cffe1=_0xe3a91;_0xf4f771=0xc8;}else{_0xf4f771=0xce;}_0x166a58[_0x3b25('0x1b')](_0xf4f771);return _0x166a58[_0x3b25('0x1c')](_0x3b25('0x1d'),_0x476ec1+'-'+_0x1cffe1+'/'+_0xe3a91)[_0x3b25('0x19')](_0x5ed754);}return null;};}function patchUpdates(_0x51b77d){return function(_0x2b870b){try{jsonpatch[_0x3b25('0x1e')](_0x2b870b,_0x51b77d,!![]);}catch(_0x54fa38){return BPromise[_0x3b25('0x1f')](_0x54fa38);}return _0x2b870b[_0x3b25('0x20')]();};}function saveUpdates(_0x13b895,_0x3b8c77){return function(_0x10465c){if(_0x10465c){return _0x10465c[_0x3b25('0x21')](_0x13b895)['then'](function(_0x2dabb5){return _0x2dabb5;});}return null;};}function removeEntity(_0x12db86,_0x38a18c){return function(_0x4d42bc){if(_0x4d42bc){return _0x4d42bc['destroy']()[_0x3b25('0x22')](function(){_0x12db86[_0x3b25('0x1b')](0xcc)[_0x3b25('0x18')]();});}};}function handleEntityNotFound(_0x1cc31f,_0x14cbac){return function(_0x4dc152){if(!_0x4dc152){_0x1cc31f[_0x3b25('0x17')](0x194);}return _0x4dc152;};}function handleError(_0xa19b97,_0x4728d7){_0x4728d7=_0x4728d7||0x1f4;return function(_0x447bec){logger['error'](_0x447bec[_0x3b25('0x23')]);if(_0x447bec[_0x3b25('0x24')]){delete _0x447bec[_0x3b25('0x24')];}_0xa19b97['status'](_0x4728d7)[_0x3b25('0x25')](_0x447bec);};}exports[_0x3b25('0x26')]=function(_0x377a23,_0x1bb128){var _0x576e95={},_0x4eabc1={},_0x15142f={'count':0x0,'rows':[]};var _0x2ede85=_[_0x3b25('0x27')](db[_0x3b25('0x28')][_0x3b25('0x29')],function(_0x28b2a2){return{'name':_0x28b2a2[_0x3b25('0x2a')],'type':_0x28b2a2[_0x3b25('0x2b')][_0x3b25('0x2c')]};});_0x4eabc1[_0x3b25('0x2d')]=_[_0x3b25('0x27')](_0x2ede85,_0x3b25('0x24'));_0x4eabc1['query']=_['keys'](_0x377a23['query']);_0x4eabc1[_0x3b25('0x2e')]=_[_0x3b25('0x2f')](_0x4eabc1[_0x3b25('0x2d')],_0x4eabc1[_0x3b25('0x30')]);_0x576e95[_0x3b25('0x31')]=_[_0x3b25('0x2f')](_0x4eabc1[_0x3b25('0x2d')],qs['fields'](_0x377a23[_0x3b25('0x30')]['fields']));_0x576e95[_0x3b25('0x31')]=_0x576e95[_0x3b25('0x31')]['length']?_0x576e95[_0x3b25('0x31')]:_0x4eabc1[_0x3b25('0x2d')];if(!_0x377a23[_0x3b25('0x30')]['hasOwnProperty'](_0x3b25('0x32'))){_0x576e95[_0x3b25('0x33')]=qs[_0x3b25('0x33')](_0x377a23[_0x3b25('0x30')][_0x3b25('0x33')]);_0x576e95['offset']=qs[_0x3b25('0x1a')](_0x377a23['query'][_0x3b25('0x1a')]);}_0x576e95['order']=qs[_0x3b25('0x34')](_0x377a23['query'][_0x3b25('0x34')]);_0x576e95[_0x3b25('0x35')]=qs[_0x3b25('0x2e')](_['pick'](_0x377a23[_0x3b25('0x30')],_0x4eabc1[_0x3b25('0x2e')]),_0x2ede85);if(_0x377a23[_0x3b25('0x30')][_0x3b25('0x36')]){_0x576e95[_0x3b25('0x35')]=_[_0x3b25('0x37')](_0x576e95[_0x3b25('0x35')],{'$or':_[_0x3b25('0x27')](_0x2ede85,function(_0x199fe6){if(_0x199fe6[_0x3b25('0x2b')]!==_0x3b25('0x38')){var _0x21063a={};_0x21063a[_0x199fe6[_0x3b25('0x24')]]={'$like':'%'+_0x377a23['query'][_0x3b25('0x36')]+'%'};return _0x21063a;}})});}_0x576e95=_[_0x3b25('0x37')]({},_0x576e95,_0x377a23[_0x3b25('0x39')]);var _0x4e41f7={'where':_0x576e95['where']};return db[_0x3b25('0x28')]['count'](_0x4e41f7)[_0x3b25('0x22')](function(_0x56c8f9){_0x15142f[_0x3b25('0x3a')]=_0x56c8f9;if(_0x377a23[_0x3b25('0x30')]['includeAll']){_0x576e95['include']=[{'all':!![]}];}return db[_0x3b25('0x28')][_0x3b25('0x3b')](_0x576e95);})[_0x3b25('0x22')](function(_0x27b478){_0x15142f[_0x3b25('0x3c')]=_0x27b478;return _0x15142f;})['then'](respondWithFilteredResult(_0x1bb128,_0x576e95))[_0x3b25('0x3d')](handleError(_0x1bb128,null));};exports[_0x3b25('0x3e')]=function(_0x2f83a6,_0x46efdc){var _0x4b4d9a={'raw':!![],'where':{'id':_0x2f83a6[_0x3b25('0x3f')]['id']}},_0x43f3de={};_0x43f3de[_0x3b25('0x2d')]=_[_0x3b25('0x40')](db['ZendeskField'][_0x3b25('0x29')]);_0x43f3de[_0x3b25('0x30')]=_[_0x3b25('0x40')](_0x2f83a6['query']);_0x43f3de[_0x3b25('0x2e')]=_[_0x3b25('0x2f')](_0x43f3de['model'],_0x43f3de[_0x3b25('0x30')]);_0x4b4d9a['attributes']=_[_0x3b25('0x2f')](_0x43f3de[_0x3b25('0x2d')],qs[_0x3b25('0x41')](_0x2f83a6[_0x3b25('0x30')][_0x3b25('0x41')]));_0x4b4d9a[_0x3b25('0x31')]=_0x4b4d9a['attributes'][_0x3b25('0x42')]?_0x4b4d9a[_0x3b25('0x31')]:_0x43f3de[_0x3b25('0x2d')];if(_0x2f83a6[_0x3b25('0x30')]['includeAll']){_0x4b4d9a['include']=[{'all':!![]}];}_0x4b4d9a=_[_0x3b25('0x37')]({},_0x4b4d9a,_0x2f83a6[_0x3b25('0x39')]);return db['ZendeskField'][_0x3b25('0x43')](_0x4b4d9a)[_0x3b25('0x22')](handleEntityNotFound(_0x46efdc,null))[_0x3b25('0x22')](respondWithResult(_0x46efdc,null))[_0x3b25('0x3d')](handleError(_0x46efdc,null));};exports[_0x3b25('0x44')]=function(_0x5b0c2e,_0x2a650e){return db[_0x3b25('0x28')][_0x3b25('0x44')](_0x5b0c2e[_0x3b25('0x45')],{})[_0x3b25('0x22')](respondWithResult(_0x2a650e,0xc9))[_0x3b25('0x3d')](handleError(_0x2a650e,null));};exports[_0x3b25('0x21')]=function(_0x3f7004,_0x595643){if(_0x3f7004[_0x3b25('0x45')]['id']){delete _0x3f7004['body']['id'];}return db[_0x3b25('0x28')][_0x3b25('0x43')]({'where':{'id':_0x3f7004[_0x3b25('0x3f')]['id']}})[_0x3b25('0x22')](handleEntityNotFound(_0x595643,null))[_0x3b25('0x22')](saveUpdates(_0x3f7004[_0x3b25('0x45')],null))['then'](respondWithResult(_0x595643,null))['catch'](handleError(_0x595643,null));};exports['destroy']=function(_0x2d4de7,_0x2beb63){return db[_0x3b25('0x28')]['find']({'where':{'id':_0x2d4de7[_0x3b25('0x3f')]['id']}})[_0x3b25('0x22')](handleEntityNotFound(_0x2beb63,null))['then'](removeEntity(_0x2beb63,null))[_0x3b25('0x3d')](handleError(_0x2beb63,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d5810ae..49e7af4 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 _0x878f=['rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x11d2e6,_0x48c9b3){var _0x3c81da=function(_0x565120){while(--_0x565120){_0x11d2e6['push'](_0x11d2e6['shift']());}};_0x3c81da(++_0x48c9b3);}(_0x878f,0x173));var _0xf878=function(_0x49b4a3,_0x447dd6){_0x49b4a3=_0x49b4a3-0x0;var _0x3cf3c7=_0x878f[_0x49b4a3];return _0x3cf3c7;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xf878('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xefda=['path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','api','moment','request-promise'];(function(_0x4eeecd,_0x1beb87){var _0x1c2f89=function(_0x2ff071){while(--_0x2ff071){_0x4eeecd['push'](_0x4eeecd['shift']());}};_0x1c2f89(++_0x1beb87);}(_0xefda,0x96));var _0xaefd=function(_0x1bd4ca,_0x342721){_0x1bd4ca=_0x1bd4ca-0x0;var _0x5c422b=_0xefda[_0x1bd4ca];return _0x5c422b;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xaefd('0xc'),_0xaefd('0xd')],'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 4ae1c86..c2d9e69 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 _0xc8e5=['../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','code','ZendeskField,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2bef0c,_0x4b30f1){var _0x16ccd3=function(_0x12ab66){while(--_0x12ab66){_0x2bef0c['push'](_0x2bef0c['shift']());}};_0x16ccd3(++_0x4b30f1);}(_0xc8e5,0x1db));var _0x5c8e=function(_0x2e82e1,_0x4b0601){_0x2e82e1=_0x2e82e1-0x0;var _0x5a51fb=_0xc8e5[_0x2e82e1];return _0x5a51fb;};'use strict';var _=require(_0x5c8e('0x0'));var util=require(_0x5c8e('0x1'));var moment=require(_0x5c8e('0x2'));var BPromise=require(_0x5c8e('0x3'));var rs=require(_0x5c8e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5c8e('0x5'))(_0x5c8e('0x6'));var config=require(_0x5c8e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5c8e('0x8')][_0x5c8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f4a70,_0x167864,_0x17dd74){return new BPromise(function(_0x1e9495,_0x5efedb){return client['request'](_0x2f4a70,_0x17dd74)[_0x5c8e('0xa')](function(_0x599e43){logger[_0x5c8e('0xb')]('ZendeskField,\x20%s,\x20%s',_0x167864,_0x5c8e('0xc'));logger[_0x5c8e('0xd')](_0x5c8e('0xe'),_0x167864,_0x5c8e('0xc'),JSON['stringify'](_0x599e43));if(_0x599e43['error']){if(_0x599e43['error'][_0x5c8e('0xf')]===0x1f4){logger['error'](_0x5c8e('0x10'),_0x167864,_0x599e43[_0x5c8e('0x11')][_0x5c8e('0x12')]);return _0x5efedb(_0x599e43[_0x5c8e('0x11')][_0x5c8e('0x12')]);}logger[_0x5c8e('0x11')](_0x5c8e('0x10'),_0x167864,_0x599e43['error'][_0x5c8e('0x12')]);return _0x1e9495(_0x599e43[_0x5c8e('0x11')][_0x5c8e('0x12')]);}else{logger[_0x5c8e('0xb')](_0x5c8e('0x10'),_0x167864,'request\x20sent');_0x1e9495(_0x599e43['result']['message']);}})[_0x5c8e('0x13')](function(_0x307e88){logger[_0x5c8e('0x11')]('ZendeskField,\x20%s,\x20%s',_0x167864,_0x307e88);_0x5efedb(_0x307e88);});});} \ No newline at end of file +var _0xc274=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x51fc49,_0x310e0a){var _0x92cfa8=function(_0x30d703){while(--_0x30d703){_0x51fc49['push'](_0x51fc49['shift']());}};_0x92cfa8(++_0x310e0a);}(_0xc274,0x19b));var _0x4c27=function(_0x5bccb4,_0x1df217){_0x5bccb4=_0x5bccb4-0x0;var _0x30a2b5=_0xc274[_0x5bccb4];return _0x30a2b5;};'use strict';var _=require(_0x4c27('0x0'));var util=require(_0x4c27('0x1'));var moment=require(_0x4c27('0x2'));var BPromise=require(_0x4c27('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c27('0x4'));var db=require(_0x4c27('0x5'))['db'];var utils=require(_0x4c27('0x6'));var logger=require(_0x4c27('0x7'))(_0x4c27('0x8'));var config=require(_0x4c27('0x9'));var jayson=require(_0x4c27('0xa'));var client=jayson[_0x4c27('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfcaffe,_0x5d47c6,_0x1e35a3){return new BPromise(function(_0x12b8f6,_0x472394){return client['request'](_0xfcaffe,_0x1e35a3)[_0x4c27('0xc')](function(_0x349319){logger[_0x4c27('0xd')](_0x4c27('0xe'),_0x5d47c6,'request\x20sent');logger[_0x4c27('0xf')](_0x4c27('0x10'),_0x5d47c6,_0x4c27('0x11'),JSON[_0x4c27('0x12')](_0x349319));if(_0x349319['error']){if(_0x349319['error'][_0x4c27('0x13')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x5d47c6,_0x349319[_0x4c27('0x14')][_0x4c27('0x15')]);return _0x472394(_0x349319[_0x4c27('0x14')][_0x4c27('0x15')]);}logger['error'](_0x4c27('0xe'),_0x5d47c6,_0x349319[_0x4c27('0x14')][_0x4c27('0x15')]);return _0x12b8f6(_0x349319[_0x4c27('0x14')]['message']);}else{logger[_0x4c27('0xd')](_0x4c27('0xe'),_0x5d47c6,'request\x20sent');_0x12b8f6(_0x349319['result'][_0x4c27('0x15')]);}})['catch'](function(_0x4728a6){logger['error'](_0x4c27('0xe'),_0x5d47c6,_0x4728a6);_0x472394(_0x4728a6);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 5a5c2b1..f83f208 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 _0xca46=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy'];(function(_0x1baf7e,_0x3d4ef8){var _0x19c0a9=function(_0x154652){while(--_0x154652){_0x1baf7e['push'](_0x1baf7e['shift']());}};_0x19c0a9(++_0x3d4ef8);}(_0xca46,0x1e4));var _0x6ca4=function(_0x5064ec,_0x34fe4d){_0x5064ec=_0x5064ec-0x0;var _0x2317f1=_0xca46[_0x5064ec];return _0x2317f1;};'use strict';var multer=require('multer');var util=require(_0x6ca4('0x0'));var path=require(_0x6ca4('0x1'));var timeout=require(_0x6ca4('0x2'));var express=require(_0x6ca4('0x3'));var router=express[_0x6ca4('0x4')]();var auth=require(_0x6ca4('0x5'));var interaction=require(_0x6ca4('0x6'));var config=require(_0x6ca4('0x7'));var controller=require(_0x6ca4('0x8'));router[_0x6ca4('0x9')]('/',auth[_0x6ca4('0xa')](),controller['index']);router['get'](_0x6ca4('0xb'),auth[_0x6ca4('0xa')](),controller['show']);router[_0x6ca4('0x9')]('/:id/configurations',auth[_0x6ca4('0xa')](),controller[_0x6ca4('0xc')]);router[_0x6ca4('0x9')](_0x6ca4('0xd'),auth['isAuthenticated'](),controller[_0x6ca4('0xe')]);router[_0x6ca4('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6ca4('0x10'),auth[_0x6ca4('0xa')](),controller[_0x6ca4('0x11')]);router[_0x6ca4('0x12')](_0x6ca4('0xb'),auth[_0x6ca4('0xa')](),controller[_0x6ca4('0x13')]);router[_0x6ca4('0x14')](_0x6ca4('0xb'),auth['isAuthenticated'](),controller[_0x6ca4('0x15')]);module[_0x6ca4('0x16')]=router; \ No newline at end of file +var _0x0aca=['../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x2ef4bb,_0x492567){var _0x5c9dd1=function(_0x5b8de2){while(--_0x5b8de2){_0x2ef4bb['push'](_0x2ef4bb['shift']());}};_0x5c9dd1(++_0x492567);}(_0x0aca,0x1de));var _0xa0ac=function(_0x9b1166,_0x384402){_0x9b1166=_0x9b1166-0x0;var _0x2ad057=_0x0aca[_0x9b1166];return _0x2ad057;};'use strict';var multer=require(_0xa0ac('0x0'));var util=require('util');var path=require(_0xa0ac('0x1'));var timeout=require(_0xa0ac('0x2'));var express=require(_0xa0ac('0x3'));var router=express[_0xa0ac('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa0ac('0x5'));var controller=require(_0xa0ac('0x6'));router[_0xa0ac('0x7')]('/',auth[_0xa0ac('0x8')](),controller[_0xa0ac('0x9')]);router[_0xa0ac('0x7')](_0xa0ac('0xa'),auth[_0xa0ac('0x8')](),controller['show']);router[_0xa0ac('0x7')]('/:id/configurations',auth[_0xa0ac('0x8')](),controller['getConfigurations']);router['get'](_0xa0ac('0xb'),auth['isAuthenticated'](),controller[_0xa0ac('0xc')]);router[_0xa0ac('0xd')]('/',auth[_0xa0ac('0x8')](),controller[_0xa0ac('0xe')]);router[_0xa0ac('0xd')](_0xa0ac('0xf'),auth[_0xa0ac('0x8')](),controller[_0xa0ac('0x10')]);router[_0xa0ac('0x11')](_0xa0ac('0xa'),auth[_0xa0ac('0x8')](),controller[_0xa0ac('0x12')]);router[_0xa0ac('0x13')](_0xa0ac('0xa'),auth[_0xa0ac('0x8')](),controller['destroy']);module[_0xa0ac('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ffcf40c..142d4bc 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 _0x70eb=['STRING'];(function(_0x117f29,_0x19912c){var _0x1e5177=function(_0x4519ea){while(--_0x4519ea){_0x117f29['push'](_0x117f29['shift']());}};_0x1e5177(++_0x19912c);}(_0x70eb,0x153));var _0xb70e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x70eb[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb70e('0x0')]},'description':{'type':Sequelize[_0xb70e('0x0')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xb70e('0x0')]},'clientId':{'type':Sequelize[_0xb70e('0x0')]},'clientSecret':{'type':Sequelize[_0xb70e('0x0')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0xb70e('0x0')]},'refreshToken':{'type':Sequelize[_0xb70e('0x0')]}}; \ No newline at end of file +var _0xa4e4=['STRING','exports'];(function(_0x277b1c,_0x51dff6){var _0x1b9fe1=function(_0xa38208){while(--_0xa38208){_0x277b1c['push'](_0x277b1c['shift']());}};_0x1b9fe1(++_0x51dff6);}(_0xa4e4,0x1af));var _0x4a4e=function(_0x3d0366,_0x50211a){_0x3d0366=_0x3d0366-0x0;var _0x5ce75e=_0xa4e4[_0x3d0366];return _0x5ce75e;};'use strict';var Sequelize=require('sequelize');module[_0x4a4e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4a4e('0x1')]},'host':{'type':Sequelize[_0x4a4e('0x1')]},'zone':{'type':Sequelize[_0x4a4e('0x1')]},'clientId':{'type':Sequelize[_0x4a4e('0x1')]},'clientSecret':{'type':Sequelize[_0x4a4e('0x1')]},'serverUrl':{'type':Sequelize[_0x4a4e('0x1')]},'code':{'type':Sequelize[_0x4a4e('0x1')]},'refreshToken':{'type':Sequelize[_0x4a4e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 1cfe1e8..341a7a1 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 _0x66fc=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','ZohoAccount','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','refreshToken','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','statusCode','send','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../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','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ZohoAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','stack','name','index','map','fieldName','type','key','query','keys'];(function(_0x107cda,_0x1c2918){var _0x157b81=function(_0x4b984a){while(--_0x4b984a){_0x107cda['push'](_0x107cda['shift']());}};_0x157b81(++_0x1c2918);}(_0x66fc,0xe0));var _0xc66f=function(_0x5073b4,_0x4ba5b0){_0x5073b4=_0x5073b4-0x0;var _0x283fd2=_0x66fc[_0x5073b4];return _0x283fd2;};'use strict';var pdf=require(_0xc66f('0x0'));var emlformat=require(_0xc66f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc66f('0x2'));var jsonpatch=require(_0xc66f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc66f('0x4'));var Mustache=require(_0xc66f('0x5'));var util=require(_0xc66f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc66f('0x7'));var ejs=require(_0xc66f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc66f('0x9'));var crypto=require('crypto');var jsforce=require(_0xc66f('0xa'));var deskjs=require(_0xc66f('0xb'));var toCsv=require(_0xc66f('0x7'));var querystring=require('querystring');var Papa=require(_0xc66f('0xc'));var Redis=require('ioredis');var authService=require(_0xc66f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc66f('0xe'));var hardwareService=require(_0xc66f('0xf'));var logger=require(_0xc66f('0x10'))(_0xc66f('0x11'));var utils=require(_0xc66f('0x12'));var config=require(_0xc66f('0x13'));var db=require(_0xc66f('0x14'))['db'];var integrations=require(_0xc66f('0x15'));var jayson=require(_0xc66f('0x16'));var client=jayson[_0xc66f('0x17')][_0xc66f('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2c88f3,_0x11bdab,_0x4a445a){if(_0x4a445a){var _0x3fe9fd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fe9fd[_0xc66f('0x19')](_0x11bdab)){return _0x2c88f3;}else{throw new db['Sequelize'][(_0xc66f('0x1a'))](_0xc66f('0x1b'));}}else{return _0x2c88f3;}}function respondWithRpcPromise(_0x415813,_0x4ac3a3,_0x33b9c4,_0x380d4d){return new BPromise(function(_0x2b7fdb,_0x5b0ef8){var _0x526d01=_0x380d4d||client;return _0x526d01[_0xc66f('0x1c')](_0x415813,_0x33b9c4)[_0xc66f('0x1d')](function(_0x18496f){logger[_0xc66f('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x4ac3a3,'request\x20sent');logger['debug'](_0xc66f('0x1f'),_0x4ac3a3,_0xc66f('0x20'),JSON[_0xc66f('0x21')](_0x18496f));if(_0x18496f[_0xc66f('0x22')]){if(_0x18496f[_0xc66f('0x22')]['code']===0x1f4){logger[_0xc66f('0x22')](_0xc66f('0x23'),_0x4ac3a3,_0x18496f[_0xc66f('0x22')][_0xc66f('0x24')]);return _0x5b0ef8(_0x18496f[_0xc66f('0x22')]['message']);}logger[_0xc66f('0x22')](_0xc66f('0x23'),_0x4ac3a3,_0x18496f[_0xc66f('0x22')]['message']);return _0x2b7fdb(_0x18496f['error'][_0xc66f('0x24')]);}else{logger[_0xc66f('0x1e')](_0xc66f('0x23'),_0x4ac3a3,_0xc66f('0x20'));_0x2b7fdb(_0x18496f['result'][_0xc66f('0x24')]);}})['catch'](function(_0x3b0926){logger['error'](_0xc66f('0x23'),_0x4ac3a3,_0x3b0926);_0x5b0ef8(_0x3b0926);});});}function respondWithStatusCode(_0x966f8c,_0x3c50e2){_0x3c50e2=_0x3c50e2||0xcc;return function(_0x1bf38d){if(_0x1bf38d){return _0x966f8c[_0xc66f('0x25')](_0x3c50e2);}return _0x966f8c[_0xc66f('0x26')](_0x3c50e2)[_0xc66f('0x27')]();};}function respondWithResult(_0x36ad13,_0x3fb112){_0x3fb112=_0x3fb112||0xc8;return function(_0x4bf2e6){if(_0x4bf2e6){return _0x36ad13[_0xc66f('0x26')](_0x3fb112)[_0xc66f('0x28')](_0x4bf2e6);}};}function respondWithFilteredResult(_0x28cdc8,_0x4c4c09){return function(_0x5c5df7){if(_0x5c5df7){var _0x50d022=_0x5c5df7[_0xc66f('0x29')],_0x149ea6=_0x4c4c09['offset'],_0x8e3484=_0x4c4c09[_0xc66f('0x2a')]+_0x4c4c09[_0xc66f('0x2b')],_0x3263ff;if(_0x8e3484>=_0x50d022){_0x8e3484=_0x50d022;_0x3263ff=0xc8;}else{_0x3263ff=0xce;}_0x28cdc8['status'](_0x3263ff);return _0x28cdc8[_0xc66f('0x2c')]('Content-Range',_0x149ea6+'-'+_0x8e3484+'/'+_0x50d022)[_0xc66f('0x28')](_0x5c5df7);}return null;};}function patchUpdates(_0x3e9175){return function(_0x2add14){try{jsonpatch[_0xc66f('0x2d')](_0x2add14,_0x3e9175,!![]);}catch(_0x28bb81){return BPromise['reject'](_0x28bb81);}return _0x2add14[_0xc66f('0x2e')]();};}function saveUpdates(_0x2dbb54,_0x226e93){return function(_0x21b5be){if(_0x21b5be){return _0x21b5be[_0xc66f('0x2f')](_0x2dbb54)[_0xc66f('0x1d')](function(_0x36ae5d){return _0x36ae5d;});}return null;};}function removeEntity(_0x2b4c23,_0xdc29ce){return function(_0x5ee3f9){if(_0x5ee3f9){return _0x5ee3f9[_0xc66f('0x30')]()['then'](function(){_0x2b4c23[_0xc66f('0x26')](0xcc)[_0xc66f('0x27')]();});}};}function handleEntityNotFound(_0x193960,_0x5a7ffb){return function(_0x26141c){if(!_0x26141c){_0x193960[_0xc66f('0x25')](0x194);}return _0x26141c;};}function handleError(_0x48c64b,_0x465ce5){_0x465ce5=_0x465ce5||0x1f4;return function(_0x29868f){logger[_0xc66f('0x22')](_0x29868f[_0xc66f('0x31')]);if(_0x29868f[_0xc66f('0x32')]){delete _0x29868f[_0xc66f('0x32')];}_0x48c64b[_0xc66f('0x26')](_0x465ce5)['send'](_0x29868f);};}exports[_0xc66f('0x33')]=function(_0x5f86db,_0x18fabd){var _0x203de6={},_0x313f51={},_0x48e486={'count':0x0,'rows':[]};var _0x591182=_[_0xc66f('0x34')](db['ZohoAccount']['rawAttributes'],function(_0x411e0e){return{'name':_0x411e0e[_0xc66f('0x35')],'type':_0x411e0e[_0xc66f('0x36')][_0xc66f('0x37')]};});_0x313f51['model']=_['map'](_0x591182,_0xc66f('0x32'));_0x313f51[_0xc66f('0x38')]=_[_0xc66f('0x39')](_0x5f86db[_0xc66f('0x38')]);_0x313f51['filters']=_[_0xc66f('0x3a')](_0x313f51[_0xc66f('0x3b')],_0x313f51['query']);_0x203de6[_0xc66f('0x3c')]=_[_0xc66f('0x3a')](_0x313f51[_0xc66f('0x3b')],qs[_0xc66f('0x3d')](_0x5f86db[_0xc66f('0x38')][_0xc66f('0x3d')]));_0x203de6[_0xc66f('0x3c')]=_0x203de6[_0xc66f('0x3c')][_0xc66f('0x3e')]?_0x203de6[_0xc66f('0x3c')]:_0x313f51[_0xc66f('0x3b')];if(!_0x5f86db['query'][_0xc66f('0x3f')](_0xc66f('0x40'))){_0x203de6[_0xc66f('0x2b')]=qs['limit'](_0x5f86db['query'][_0xc66f('0x2b')]);_0x203de6['offset']=qs[_0xc66f('0x2a')](_0x5f86db[_0xc66f('0x38')][_0xc66f('0x2a')]);}_0x203de6[_0xc66f('0x41')]=qs[_0xc66f('0x42')](_0x5f86db['query'][_0xc66f('0x42')]);_0x203de6[_0xc66f('0x43')]=qs[_0xc66f('0x44')](_['pick'](_0x5f86db[_0xc66f('0x38')],_0x313f51[_0xc66f('0x44')]),_0x591182);if(_0x5f86db[_0xc66f('0x38')][_0xc66f('0x45')]){_0x203de6['where']=_[_0xc66f('0x46')](_0x203de6[_0xc66f('0x43')],{'$or':_[_0xc66f('0x34')](_0x591182,function(_0x5b33aa){if(_0x5b33aa[_0xc66f('0x36')]!==_0xc66f('0x47')){var _0x178dd4={};_0x178dd4[_0x5b33aa[_0xc66f('0x32')]]={'$like':'%'+_0x5f86db[_0xc66f('0x38')][_0xc66f('0x45')]+'%'};return _0x178dd4;}})});}_0x203de6=_[_0xc66f('0x46')]({},_0x203de6,_0x5f86db[_0xc66f('0x48')]);var _0x44e8ad={'where':_0x203de6[_0xc66f('0x43')]};return db[_0xc66f('0x49')][_0xc66f('0x29')](_0x44e8ad)['then'](function(_0x2b9d9b){_0x48e486[_0xc66f('0x29')]=_0x2b9d9b;if(_0x5f86db[_0xc66f('0x38')]['includeAll']){_0x203de6['include']=[{'all':!![]}];}return db[_0xc66f('0x49')][_0xc66f('0x4a')](_0x203de6);})[_0xc66f('0x1d')](function(_0x148c6b){_0x48e486[_0xc66f('0x4b')]=_0x148c6b;return _0x48e486;})['then'](respondWithFilteredResult(_0x18fabd,_0x203de6))[_0xc66f('0x4c')](handleError(_0x18fabd,null));};exports[_0xc66f('0x4d')]=function(_0x54b852,_0x4c2e10){var _0x43e3f2={'raw':![],'where':{'id':_0x54b852[_0xc66f('0x4e')]['id']}},_0x5e8b25={};_0x5e8b25['model']=_[_0xc66f('0x39')](db[_0xc66f('0x49')][_0xc66f('0x4f')]);_0x5e8b25[_0xc66f('0x38')]=_[_0xc66f('0x39')](_0x54b852[_0xc66f('0x38')]);_0x5e8b25[_0xc66f('0x44')]=_[_0xc66f('0x3a')](_0x5e8b25[_0xc66f('0x3b')],_0x5e8b25[_0xc66f('0x38')]);_0x43e3f2[_0xc66f('0x3c')]=_[_0xc66f('0x3a')](_0x5e8b25[_0xc66f('0x3b')],qs[_0xc66f('0x3d')](_0x54b852[_0xc66f('0x38')]['fields']));_0x43e3f2['attributes']=_0x43e3f2['attributes'][_0xc66f('0x3e')]?_0x43e3f2['attributes']:_0x5e8b25[_0xc66f('0x3b')];if(_0x54b852[_0xc66f('0x38')][_0xc66f('0x50')]){_0x43e3f2[_0xc66f('0x51')]=[{'all':!![]}];}_0x43e3f2=_['merge']({},_0x43e3f2,_0x54b852[_0xc66f('0x48')]);return db[_0xc66f('0x49')][_0xc66f('0x52')](_0x43e3f2)['then'](handleEntityNotFound(_0x4c2e10,null))[_0xc66f('0x1d')](respondWithResult(_0x4c2e10,null))[_0xc66f('0x4c')](handleError(_0x4c2e10,null));};exports[_0xc66f('0x53')]=function(_0x2e9035,_0x26bc8b){return db[_0xc66f('0x49')][_0xc66f('0x53')](_0x2e9035[_0xc66f('0x54')],{})[_0xc66f('0x1d')](respondWithResult(_0x26bc8b,0xc9))[_0xc66f('0x4c')](handleError(_0x26bc8b,null));};exports[_0xc66f('0x2f')]=function(_0x4cf01a,_0x503b68){if(_0x4cf01a[_0xc66f('0x54')]['id']){delete _0x4cf01a[_0xc66f('0x54')]['id'];}return db[_0xc66f('0x49')][_0xc66f('0x52')]({'where':{'id':_0x4cf01a[_0xc66f('0x4e')]['id']}})[_0xc66f('0x1d')](handleEntityNotFound(_0x503b68,null))[_0xc66f('0x1d')](saveUpdates(_0x4cf01a['body'],null))[_0xc66f('0x1d')](respondWithResult(_0x503b68,null))[_0xc66f('0x4c')](handleError(_0x503b68,null));};exports[_0xc66f('0x30')]=function(_0x4f0330,_0x4aadec){return db[_0xc66f('0x49')]['find']({'where':{'id':_0x4f0330[_0xc66f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4aadec,null))[_0xc66f('0x1d')](removeEntity(_0x4aadec,null))['catch'](handleError(_0x4aadec,null));};exports['getConfigurations']=function(_0x3fcc5e,_0x56dfe9,_0x45f397){var _0xee61bd={};var _0x4da2da={};var _0x433a83;var _0x52ea9a;return db[_0xc66f('0x49')][_0xc66f('0x55')]({'where':{'id':_0x3fcc5e[_0xc66f('0x4e')]['id']}})[_0xc66f('0x1d')](handleEntityNotFound(_0x56dfe9,null))[_0xc66f('0x1d')](function(_0x5759a5){if(_0x5759a5){_0x433a83=_0x5759a5;_0x4da2da['model']=_[_0xc66f('0x39')](db['ZohoConfiguration'][_0xc66f('0x4f')]);_0x4da2da[_0xc66f('0x38')]=_[_0xc66f('0x39')](_0x3fcc5e[_0xc66f('0x38')]);_0x4da2da['filters']=_[_0xc66f('0x3a')](_0x4da2da[_0xc66f('0x3b')],_0x4da2da[_0xc66f('0x38')]);_0xee61bd[_0xc66f('0x3c')]=_['intersection'](_0x4da2da[_0xc66f('0x3b')],qs[_0xc66f('0x3d')](_0x3fcc5e[_0xc66f('0x38')][_0xc66f('0x3d')]));_0xee61bd['attributes']=_0xee61bd[_0xc66f('0x3c')][_0xc66f('0x3e')]?_0xee61bd['attributes']:_0x4da2da[_0xc66f('0x3b')];_0xee61bd[_0xc66f('0x41')]=qs[_0xc66f('0x42')](_0x3fcc5e['query'][_0xc66f('0x42')]);_0xee61bd[_0xc66f('0x43')]=qs[_0xc66f('0x44')](_[_0xc66f('0x56')](_0x3fcc5e['query'],_0x4da2da[_0xc66f('0x44')]));if(_0x3fcc5e[_0xc66f('0x38')]['filter']){_0xee61bd[_0xc66f('0x43')]=_['merge'](_0xee61bd[_0xc66f('0x43')],{'$or':_['map'](_0xee61bd['attributes'],function(_0x3558d6){var _0x58b325={};_0x58b325[_0x3558d6]={'$like':'%'+_0x3fcc5e['query'][_0xc66f('0x45')]+'%'};return _0x58b325;})});}_0xee61bd=_['merge']({},_0xee61bd,_0x3fcc5e['options']);return _0x433a83['getConfigurations'](_0xee61bd);}})[_0xc66f('0x1d')](function(_0x371f03){if(_0x371f03){_0x52ea9a=_0x371f03[_0xc66f('0x3e')];if(!_0x3fcc5e[_0xc66f('0x38')]['hasOwnProperty'](_0xc66f('0x40'))){_0xee61bd[_0xc66f('0x2b')]=qs[_0xc66f('0x2b')](_0x3fcc5e['query']['limit']);_0xee61bd[_0xc66f('0x2a')]=qs['offset'](_0x3fcc5e['query']['offset']);}return _0x433a83['getConfigurations'](_0xee61bd);}})['then'](function(_0x2c2fa0){if(_0x2c2fa0){return _0x2c2fa0?{'count':_0x52ea9a,'rows':_0x2c2fa0}:null;}})[_0xc66f('0x1d')](respondWithResult(_0x56dfe9,null))[_0xc66f('0x4c')](handleError(_0x56dfe9,null));};exports[_0xc66f('0x57')]=function(_0x456d23,_0x38e34e,_0x198b00){if(_0x456d23[_0xc66f('0x54')]['id']){delete _0x456d23[_0xc66f('0x54')]['id'];}return db[_0xc66f('0x49')]['findOne']({'where':{'id':_0x456d23[_0xc66f('0x4e')]['id']}})[_0xc66f('0x1d')](handleEntityNotFound(_0x38e34e,null))['then'](function(_0x176266){if(_0x176266){_0x456d23[_0xc66f('0x54')][_0xc66f('0x58')]=_0x176266['id'];_0x456d23[_0xc66f('0x54')][_0xc66f('0x59')]=integrations[_0xc66f('0x5a')](_0x456d23[_0xc66f('0x54')][_0xc66f('0x5b')],_0x456d23[_0xc66f('0x54')][_0xc66f('0x36')]);_0x456d23[_0xc66f('0x54')][_0xc66f('0x5c')]=integrations[_0xc66f('0x5d')](_0x456d23['body'][_0xc66f('0x5b')],_0x456d23[_0xc66f('0x54')][_0xc66f('0x36')]);return db['ZohoConfiguration'][_0xc66f('0x53')](_0x456d23['body'],{'include':[{'model':db[_0xc66f('0x5e')],'as':_0xc66f('0x59')},{'model':db[_0xc66f('0x5e')],'as':_0xc66f('0x5c')}]});}return null;})['then'](respondWithResult(_0x38e34e,null))[_0xc66f('0x4c')](handleError(_0x38e34e,null));};function getAccessToken(_0xa7ffd8){return new Promise(function(_0x3e89e9,_0xb66273){var _0x344c92;switch(_0xa7ffd8[_0xc66f('0x5f')]){case'US':_0x344c92=_0xc66f('0x60');break;case'AU':_0x344c92=_0xc66f('0x61');break;case'EU':_0x344c92=_0xc66f('0x62');break;case'IN':_0x344c92='https://accounts.zoho.in';break;case'CN':_0x344c92=_0xc66f('0x63');break;default:_0x344c92=_0xc66f('0x62');break;}var _0x121831={'method':_0xc66f('0x64'),'uri':_0x344c92+_0xc66f('0x65'),'qs':{'refresh_token':_0xa7ffd8['refreshToken'],'client_id':_0xa7ffd8[_0xc66f('0x66')],'client_secret':_0xa7ffd8[_0xc66f('0x67')],'grant_type':_0xc66f('0x68')},'json':!![]};return rp(_0x121831)[_0xc66f('0x1d')](function(_0x5e8fd1){if(_0x5e8fd1['access_token']){_0x3e89e9(_0x5e8fd1[_0xc66f('0x69')]);}else{_0xb66273(_0xc66f('0x6a'));}})['catch'](function(_0x136bfd){_0xb66273(_0x136bfd);});});}exports['getFields']=function(_0x165be9,_0x17aa55,_0x510b40){var _0x1764dc,_0x3fd91e,_0x59f66c,_0x22d92d,_0x5e74d7;return db[_0xc66f('0x49')][_0xc66f('0x55')]({'where':{'id':_0x165be9[_0xc66f('0x4e')]['id']},'attributes':['id',_0xc66f('0x6b'),_0xc66f('0x5f'),'clientId','clientSecret',_0xc66f('0x6c'),_0xc66f('0x6d'),_0xc66f('0x6e')]})[_0xc66f('0x1d')](handleEntityNotFound(_0x17aa55,null))[_0xc66f('0x1d')](function(_0x3d05ac){_0x5e74d7=_0x3d05ac;_0x1764dc=_0x5e74d7[_0xc66f('0x6b')];_0x3fd91e=_0x1764dc===_0xc66f('0x6f')?'eu':_0xc66f('0x70');_0x59f66c=_0x5e74d7[_0xc66f('0x6c')];var _0x1442d2=_0x59f66c[_0xc66f('0x71')](-0x1);if(_0x1442d2==='/'||_0x1442d2==='\x5c'||_0x1442d2===':'){_0x59f66c=_0x59f66c['substring'](0x0,_0x59f66c[_0xc66f('0x72')](_0x1442d2));}if(!_0x5e74d7[_0xc66f('0x6e')]){throw new Error(_0xc66f('0x73'));}return getAccessToken(_0x5e74d7);})['then'](function(_0x2b14d2){if(_0x2b14d2){return rp({'method':_0xc66f('0x74'),'uri':util[_0xc66f('0x75')](_0xc66f('0x76'),_0x3fd91e),'qs':{'module':_0xc66f('0x77')},'headers':{'Authorization':_0xc66f('0x78')+_0x2b14d2},'json':!![]});}})[_0xc66f('0x1d')](function(_0x50a26a){if(_0x50a26a){if(_0x50a26a[_0xc66f('0x79')]&&_0x50a26a[_0xc66f('0x79')][_0xc66f('0x22')]){throw new Error(_0x50a26a[_0xc66f('0x79')][_0xc66f('0x22')][_0xc66f('0x24')]);}var _0x2713d7=[];var _0x1f51ae=[];var _0x4ff50c=[_0xc66f('0x7a'),_0xc66f('0x7b'),_0xc66f('0x7c'),_0xc66f('0x7d'),_0xc66f('0x7e'),_0xc66f('0x7f'),_0xc66f('0x80'),_0xc66f('0x81')];_0x1f51ae=_['remove'](_0x50a26a[_0xc66f('0x3d')],function(_0x459b2b){return _0x4ff50c[_0xc66f('0x82')](_0x459b2b[_0xc66f('0x83')]);});for(var _0x4ce033=0x0;_0x4ce033<_0x1f51ae[_0xc66f('0x3e')];_0x4ce033++){if(_0x1f51ae[_0x4ce033][_0xc66f('0x84')]===![]){_0x2713d7[_0xc66f('0x85')]({'id':_0x1f51ae[_0x4ce033]['id'],'name':_0x1f51ae[_0x4ce033][_0xc66f('0x86')],'custom':_0x1f51ae[_0x4ce033][_0xc66f('0x87')],'options':_0x1f51ae[_0x4ce033]['data_type']===_0xc66f('0x88')&&_0x1f51ae[_0x4ce033][_0xc66f('0x89')][_0xc66f('0x3e')]>-0x1?_[_0xc66f('0x34')](_0x1f51ae[_0x4ce033][_0xc66f('0x89')],function(_0x30e5d2){return{'name':_0x30e5d2,'value':_0x30e5d2};}):[]});}}return{'count':_0x2713d7['length'],'rows':_0x2713d7};}else{return{'count':0x0,'rows':[]};}})[_0xc66f('0x1d')](respondWithResult(_0x17aa55,null))[_0xc66f('0x4c')](function(_0x596d18){var _0x1628fe=_0x165be9[_0xc66f('0x38')][_0xc66f('0x19')]?0x1f4:_0x596d18[_0xc66f('0x8a')]||0x1f4;logger[_0xc66f('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1628fe,JSON[_0xc66f('0x21')](_0x596d18));delete _0x596d18[_0xc66f('0x32')];if(_0x1628fe===0x191){_0x1628fe=0x190;}_0x17aa55['status'](_0x1628fe)[_0xc66f('0x8b')](_0x165be9['query'][_0xc66f('0x19')]?{'message':_0xc66f('0x8c'),'statusCode':_0x596d18[_0xc66f('0x8a')]}:_0x596d18);});}; \ No newline at end of file +var _0xccb8=['util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','status','end','json','count','offset','limit','set','Content-Range','apply','save','stack','name','send','index','map','ZohoAccount','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','rows','show','params','include','catch','create','body','find','destroy','getConfigurations','findOne','ZohoConfiguration','pick','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','com','slice','substring','lastIndexOf','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird'];(function(_0x315eea,_0x1b0d52){var _0x20a0a5=function(_0x207f3e){while(--_0x207f3e){_0x315eea['push'](_0x315eea['shift']());}};_0x20a0a5(++_0x1b0d52);}(_0xccb8,0x85));var _0x8ccb=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xccb8[_0x18ab2a];return _0x16dcee;};'use strict';var pdf=require(_0x8ccb('0x0'));var emlformat=require(_0x8ccb('0x1'));var rimraf=require(_0x8ccb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ccb('0x3'));var rp=require('request-promise');var moment=require(_0x8ccb('0x4'));var BPromise=require(_0x8ccb('0x5'));var Mustache=require('mustache');var util=require(_0x8ccb('0x6'));var path=require(_0x8ccb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ccb('0x8'));var fs=require('fs');var _=require(_0x8ccb('0x9'));var squel=require('squel');var crypto=require(_0x8ccb('0xa'));var jsforce=require(_0x8ccb('0xb'));var deskjs=require(_0x8ccb('0xc'));var toCsv=require(_0x8ccb('0xd'));var querystring=require(_0x8ccb('0xe'));var Papa=require(_0x8ccb('0xf'));var Redis=require(_0x8ccb('0x10'));var authService=require(_0x8ccb('0x11'));var qs=require(_0x8ccb('0x12'));var as=require(_0x8ccb('0x13'));var hardwareService=require(_0x8ccb('0x14'));var logger=require('../../config/logger')(_0x8ccb('0x15'));var utils=require(_0x8ccb('0x16'));var config=require(_0x8ccb('0x17'));var db=require(_0x8ccb('0x18'))['db'];var integrations=require(_0x8ccb('0x19'));var jayson=require(_0x8ccb('0x1a'));var client=jayson[_0x8ccb('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x590207,_0x21120d,_0x1db226){if(_0x1db226){var _0x182e46=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x182e46[_0x8ccb('0x1c')](_0x21120d)){return _0x590207;}else{throw new db[(_0x8ccb('0x1d'))][(_0x8ccb('0x1e'))](_0x8ccb('0x1f'));}}else{return _0x590207;}}function respondWithRpcPromise(_0x591191,_0x3465de,_0x24b54f,_0x10a823){return new BPromise(function(_0x1660c9,_0x39b61c){var _0x32877e=_0x10a823||client;return _0x32877e[_0x8ccb('0x20')](_0x591191,_0x24b54f)[_0x8ccb('0x21')](function(_0x30d85c){logger[_0x8ccb('0x22')]('ZohoAccount,\x20%s,\x20%s',_0x3465de,_0x8ccb('0x23'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3465de,_0x8ccb('0x23'),JSON[_0x8ccb('0x24')](_0x30d85c));if(_0x30d85c[_0x8ccb('0x25')]){if(_0x30d85c[_0x8ccb('0x25')][_0x8ccb('0x26')]===0x1f4){logger['error'](_0x8ccb('0x27'),_0x3465de,_0x30d85c['error'][_0x8ccb('0x28')]);return _0x39b61c(_0x30d85c[_0x8ccb('0x25')][_0x8ccb('0x28')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3465de,_0x30d85c[_0x8ccb('0x25')][_0x8ccb('0x28')]);return _0x1660c9(_0x30d85c[_0x8ccb('0x25')]['message']);}else{logger[_0x8ccb('0x22')](_0x8ccb('0x27'),_0x3465de,'request\x20sent');_0x1660c9(_0x30d85c[_0x8ccb('0x29')][_0x8ccb('0x28')]);}})['catch'](function(_0xb3df79){logger[_0x8ccb('0x25')](_0x8ccb('0x27'),_0x3465de,_0xb3df79);_0x39b61c(_0xb3df79);});});}function respondWithStatusCode(_0x34b199,_0x3ed770){_0x3ed770=_0x3ed770||0xcc;return function(_0x442fe1){if(_0x442fe1){return _0x34b199['sendStatus'](_0x3ed770);}return _0x34b199[_0x8ccb('0x2a')](_0x3ed770)[_0x8ccb('0x2b')]();};}function respondWithResult(_0x517cd2,_0x3e6aad){_0x3e6aad=_0x3e6aad||0xc8;return function(_0xa466f5){if(_0xa466f5){return _0x517cd2[_0x8ccb('0x2a')](_0x3e6aad)[_0x8ccb('0x2c')](_0xa466f5);}};}function respondWithFilteredResult(_0x40dcb7,_0x4ebdae){return function(_0x2cab99){if(_0x2cab99){var _0x128c2f=_0x2cab99[_0x8ccb('0x2d')],_0x531dbc=_0x4ebdae['offset'],_0x2ad40a=_0x4ebdae[_0x8ccb('0x2e')]+_0x4ebdae[_0x8ccb('0x2f')],_0x41f863;if(_0x2ad40a>=_0x128c2f){_0x2ad40a=_0x128c2f;_0x41f863=0xc8;}else{_0x41f863=0xce;}_0x40dcb7[_0x8ccb('0x2a')](_0x41f863);return _0x40dcb7[_0x8ccb('0x30')](_0x8ccb('0x31'),_0x531dbc+'-'+_0x2ad40a+'/'+_0x128c2f)[_0x8ccb('0x2c')](_0x2cab99);}return null;};}function patchUpdates(_0x2d0cba){return function(_0x1e536a){try{jsonpatch[_0x8ccb('0x32')](_0x1e536a,_0x2d0cba,!![]);}catch(_0x5cdddd){return BPromise['reject'](_0x5cdddd);}return _0x1e536a[_0x8ccb('0x33')]();};}function saveUpdates(_0x599915,_0x4c8af){return function(_0x43274a){if(_0x43274a){return _0x43274a['update'](_0x599915)['then'](function(_0xcbe706){return _0xcbe706;});}return null;};}function removeEntity(_0xdbad8f,_0x21bbe5){return function(_0x4bec57){if(_0x4bec57){return _0x4bec57['destroy']()['then'](function(){_0xdbad8f[_0x8ccb('0x2a')](0xcc)[_0x8ccb('0x2b')]();});}};}function handleEntityNotFound(_0x351b6a,_0xba34d8){return function(_0x33800f){if(!_0x33800f){_0x351b6a['sendStatus'](0x194);}return _0x33800f;};}function handleError(_0x360b07,_0x328867){_0x328867=_0x328867||0x1f4;return function(_0x3cb993){logger['error'](_0x3cb993[_0x8ccb('0x34')]);if(_0x3cb993[_0x8ccb('0x35')]){delete _0x3cb993[_0x8ccb('0x35')];}_0x360b07['status'](_0x328867)[_0x8ccb('0x36')](_0x3cb993);};}exports[_0x8ccb('0x37')]=function(_0x1896ba,_0x194722){var _0x3982df={},_0x5548a9={},_0x5dd611={'count':0x0,'rows':[]};var _0x1d17e1=_[_0x8ccb('0x38')](db[_0x8ccb('0x39')][_0x8ccb('0x3a')],function(_0x48855a){return{'name':_0x48855a['fieldName'],'type':_0x48855a[_0x8ccb('0x3b')]['key']};});_0x5548a9['model']=_[_0x8ccb('0x38')](_0x1d17e1,'name');_0x5548a9[_0x8ccb('0x3c')]=_[_0x8ccb('0x3d')](_0x1896ba[_0x8ccb('0x3c')]);_0x5548a9['filters']=_[_0x8ccb('0x3e')](_0x5548a9[_0x8ccb('0x3f')],_0x5548a9[_0x8ccb('0x3c')]);_0x3982df[_0x8ccb('0x40')]=_[_0x8ccb('0x3e')](_0x5548a9['model'],qs[_0x8ccb('0x41')](_0x1896ba[_0x8ccb('0x3c')][_0x8ccb('0x41')]));_0x3982df[_0x8ccb('0x40')]=_0x3982df['attributes'][_0x8ccb('0x42')]?_0x3982df[_0x8ccb('0x40')]:_0x5548a9[_0x8ccb('0x3f')];if(!_0x1896ba[_0x8ccb('0x3c')][_0x8ccb('0x43')](_0x8ccb('0x44'))){_0x3982df[_0x8ccb('0x2f')]=qs[_0x8ccb('0x2f')](_0x1896ba['query']['limit']);_0x3982df[_0x8ccb('0x2e')]=qs[_0x8ccb('0x2e')](_0x1896ba['query'][_0x8ccb('0x2e')]);}_0x3982df[_0x8ccb('0x45')]=qs[_0x8ccb('0x46')](_0x1896ba[_0x8ccb('0x3c')][_0x8ccb('0x46')]);_0x3982df[_0x8ccb('0x47')]=qs['filters'](_['pick'](_0x1896ba['query'],_0x5548a9[_0x8ccb('0x48')]),_0x1d17e1);if(_0x1896ba[_0x8ccb('0x3c')][_0x8ccb('0x49')]){_0x3982df[_0x8ccb('0x47')]=_['merge'](_0x3982df['where'],{'$or':_[_0x8ccb('0x38')](_0x1d17e1,function(_0x505e4b){if(_0x505e4b[_0x8ccb('0x3b')]!==_0x8ccb('0x4a')){var _0x2865ae={};_0x2865ae[_0x505e4b[_0x8ccb('0x35')]]={'$like':'%'+_0x1896ba[_0x8ccb('0x3c')]['filter']+'%'};return _0x2865ae;}})});}_0x3982df=_[_0x8ccb('0x4b')]({},_0x3982df,_0x1896ba[_0x8ccb('0x4c')]);var _0x39fd39={'where':_0x3982df[_0x8ccb('0x47')]};return db[_0x8ccb('0x39')][_0x8ccb('0x2d')](_0x39fd39)[_0x8ccb('0x21')](function(_0x3be3e2){_0x5dd611[_0x8ccb('0x2d')]=_0x3be3e2;if(_0x1896ba[_0x8ccb('0x3c')][_0x8ccb('0x4d')]){_0x3982df['include']=[{'all':!![]}];}return db[_0x8ccb('0x39')]['findAll'](_0x3982df);})[_0x8ccb('0x21')](function(_0x394f34){_0x5dd611[_0x8ccb('0x4e')]=_0x394f34;return _0x5dd611;})['then'](respondWithFilteredResult(_0x194722,_0x3982df))['catch'](handleError(_0x194722,null));};exports[_0x8ccb('0x4f')]=function(_0x57f60e,_0x288272){var _0xbdaee8={'raw':![],'where':{'id':_0x57f60e[_0x8ccb('0x50')]['id']}},_0x5667ab={};_0x5667ab['model']=_[_0x8ccb('0x3d')](db[_0x8ccb('0x39')][_0x8ccb('0x3a')]);_0x5667ab[_0x8ccb('0x3c')]=_[_0x8ccb('0x3d')](_0x57f60e[_0x8ccb('0x3c')]);_0x5667ab[_0x8ccb('0x48')]=_['intersection'](_0x5667ab[_0x8ccb('0x3f')],_0x5667ab[_0x8ccb('0x3c')]);_0xbdaee8[_0x8ccb('0x40')]=_[_0x8ccb('0x3e')](_0x5667ab[_0x8ccb('0x3f')],qs[_0x8ccb('0x41')](_0x57f60e[_0x8ccb('0x3c')][_0x8ccb('0x41')]));_0xbdaee8['attributes']=_0xbdaee8[_0x8ccb('0x40')][_0x8ccb('0x42')]?_0xbdaee8[_0x8ccb('0x40')]:_0x5667ab[_0x8ccb('0x3f')];if(_0x57f60e[_0x8ccb('0x3c')][_0x8ccb('0x4d')]){_0xbdaee8[_0x8ccb('0x51')]=[{'all':!![]}];}_0xbdaee8=_['merge']({},_0xbdaee8,_0x57f60e[_0x8ccb('0x4c')]);return db[_0x8ccb('0x39')]['find'](_0xbdaee8)[_0x8ccb('0x21')](handleEntityNotFound(_0x288272,null))[_0x8ccb('0x21')](respondWithResult(_0x288272,null))[_0x8ccb('0x52')](handleError(_0x288272,null));};exports[_0x8ccb('0x53')]=function(_0x38b6d7,_0x2e1919){return db[_0x8ccb('0x39')][_0x8ccb('0x53')](_0x38b6d7[_0x8ccb('0x54')],{})[_0x8ccb('0x21')](respondWithResult(_0x2e1919,0xc9))['catch'](handleError(_0x2e1919,null));};exports['update']=function(_0x21494,_0xd35ecc){if(_0x21494[_0x8ccb('0x54')]['id']){delete _0x21494['body']['id'];}return db[_0x8ccb('0x39')][_0x8ccb('0x55')]({'where':{'id':_0x21494['params']['id']}})[_0x8ccb('0x21')](handleEntityNotFound(_0xd35ecc,null))[_0x8ccb('0x21')](saveUpdates(_0x21494[_0x8ccb('0x54')],null))['then'](respondWithResult(_0xd35ecc,null))[_0x8ccb('0x52')](handleError(_0xd35ecc,null));};exports[_0x8ccb('0x56')]=function(_0x550ca4,_0x297bed){return db[_0x8ccb('0x39')][_0x8ccb('0x55')]({'where':{'id':_0x550ca4[_0x8ccb('0x50')]['id']}})[_0x8ccb('0x21')](handleEntityNotFound(_0x297bed,null))[_0x8ccb('0x21')](removeEntity(_0x297bed,null))[_0x8ccb('0x52')](handleError(_0x297bed,null));};exports[_0x8ccb('0x57')]=function(_0x5aa45d,_0x4d4a7d,_0x230402){var _0xc04595={};var _0x5c20d4={};var _0x48b01e;var _0x259848;return db[_0x8ccb('0x39')][_0x8ccb('0x58')]({'where':{'id':_0x5aa45d[_0x8ccb('0x50')]['id']}})['then'](handleEntityNotFound(_0x4d4a7d,null))[_0x8ccb('0x21')](function(_0x161396){if(_0x161396){_0x48b01e=_0x161396;_0x5c20d4[_0x8ccb('0x3f')]=_[_0x8ccb('0x3d')](db[_0x8ccb('0x59')][_0x8ccb('0x3a')]);_0x5c20d4[_0x8ccb('0x3c')]=_[_0x8ccb('0x3d')](_0x5aa45d['query']);_0x5c20d4['filters']=_[_0x8ccb('0x3e')](_0x5c20d4[_0x8ccb('0x3f')],_0x5c20d4[_0x8ccb('0x3c')]);_0xc04595[_0x8ccb('0x40')]=_[_0x8ccb('0x3e')](_0x5c20d4[_0x8ccb('0x3f')],qs[_0x8ccb('0x41')](_0x5aa45d[_0x8ccb('0x3c')]['fields']));_0xc04595[_0x8ccb('0x40')]=_0xc04595[_0x8ccb('0x40')][_0x8ccb('0x42')]?_0xc04595[_0x8ccb('0x40')]:_0x5c20d4['model'];_0xc04595[_0x8ccb('0x45')]=qs[_0x8ccb('0x46')](_0x5aa45d[_0x8ccb('0x3c')]['sort']);_0xc04595[_0x8ccb('0x47')]=qs[_0x8ccb('0x48')](_[_0x8ccb('0x5a')](_0x5aa45d['query'],_0x5c20d4[_0x8ccb('0x48')]));if(_0x5aa45d['query'][_0x8ccb('0x49')]){_0xc04595['where']=_[_0x8ccb('0x4b')](_0xc04595['where'],{'$or':_[_0x8ccb('0x38')](_0xc04595[_0x8ccb('0x40')],function(_0x2a0ab4){var _0x422a41={};_0x422a41[_0x2a0ab4]={'$like':'%'+_0x5aa45d[_0x8ccb('0x3c')][_0x8ccb('0x49')]+'%'};return _0x422a41;})});}_0xc04595=_[_0x8ccb('0x4b')]({},_0xc04595,_0x5aa45d[_0x8ccb('0x4c')]);return _0x48b01e['getConfigurations'](_0xc04595);}})['then'](function(_0x223dfc){if(_0x223dfc){_0x259848=_0x223dfc[_0x8ccb('0x42')];if(!_0x5aa45d[_0x8ccb('0x3c')]['hasOwnProperty']('nolimit')){_0xc04595[_0x8ccb('0x2f')]=qs[_0x8ccb('0x2f')](_0x5aa45d[_0x8ccb('0x3c')][_0x8ccb('0x2f')]);_0xc04595[_0x8ccb('0x2e')]=qs[_0x8ccb('0x2e')](_0x5aa45d[_0x8ccb('0x3c')]['offset']);}return _0x48b01e[_0x8ccb('0x57')](_0xc04595);}})[_0x8ccb('0x21')](function(_0x470536){if(_0x470536){return _0x470536?{'count':_0x259848,'rows':_0x470536}:null;}})[_0x8ccb('0x21')](respondWithResult(_0x4d4a7d,null))[_0x8ccb('0x52')](handleError(_0x4d4a7d,null));};exports['addConfiguration']=function(_0x194a9f,_0x24b4af,_0x6762e3){if(_0x194a9f[_0x8ccb('0x54')]['id']){delete _0x194a9f[_0x8ccb('0x54')]['id'];}return db['ZohoAccount'][_0x8ccb('0x58')]({'where':{'id':_0x194a9f[_0x8ccb('0x50')]['id']}})[_0x8ccb('0x21')](handleEntityNotFound(_0x24b4af,null))['then'](function(_0x3ed645){if(_0x3ed645){_0x194a9f['body'][_0x8ccb('0x5b')]=_0x3ed645['id'];_0x194a9f[_0x8ccb('0x54')][_0x8ccb('0x5c')]=integrations[_0x8ccb('0x5d')](_0x194a9f[_0x8ccb('0x54')][_0x8ccb('0x5e')],_0x194a9f[_0x8ccb('0x54')][_0x8ccb('0x3b')]);_0x194a9f[_0x8ccb('0x54')][_0x8ccb('0x5f')]=integrations['getDescriptions'](_0x194a9f[_0x8ccb('0x54')][_0x8ccb('0x5e')],_0x194a9f['body']['type']);return db[_0x8ccb('0x59')]['create'](_0x194a9f[_0x8ccb('0x54')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0x8ccb('0x60')],'as':_0x8ccb('0x5f')}]});}return null;})[_0x8ccb('0x21')](respondWithResult(_0x24b4af,null))[_0x8ccb('0x52')](handleError(_0x24b4af,null));};function getAccessToken(_0x4b9ea4){return new Promise(function(_0x20d430,_0x573472){var _0x9b4c72;switch(_0x4b9ea4[_0x8ccb('0x61')]){case'US':_0x9b4c72='https://accounts.zoho.com';break;case'AU':_0x9b4c72=_0x8ccb('0x62');break;case'EU':_0x9b4c72=_0x8ccb('0x63');break;case'IN':_0x9b4c72=_0x8ccb('0x64');break;case'CN':_0x9b4c72=_0x8ccb('0x65');break;default:_0x9b4c72=_0x8ccb('0x63');break;}var _0x48f505={'method':_0x8ccb('0x66'),'uri':_0x9b4c72+_0x8ccb('0x67'),'qs':{'refresh_token':_0x4b9ea4[_0x8ccb('0x68')],'client_id':_0x4b9ea4[_0x8ccb('0x69')],'client_secret':_0x4b9ea4['clientSecret'],'grant_type':_0x8ccb('0x6a')},'json':!![]};return rp(_0x48f505)['then'](function(_0x42d93c){if(_0x42d93c[_0x8ccb('0x6b')]){_0x20d430(_0x42d93c['access_token']);}else{_0x573472(_0x8ccb('0x6c'));}})[_0x8ccb('0x52')](function(_0x445801){_0x573472(_0x445801);});});}exports[_0x8ccb('0x6d')]=function(_0x23b379,_0xcad684,_0x215e2f){var _0x704e3e,_0x553414,_0x804c5c,_0x1ac4dd,_0x5b2981;return db['ZohoAccount']['findOne']({'where':{'id':_0x23b379[_0x8ccb('0x50')]['id']},'attributes':['id',_0x8ccb('0x6e'),'zone',_0x8ccb('0x69'),_0x8ccb('0x6f'),_0x8ccb('0x70'),_0x8ccb('0x26'),_0x8ccb('0x68')]})[_0x8ccb('0x21')](handleEntityNotFound(_0xcad684,null))[_0x8ccb('0x21')](function(_0x3fa854){_0x5b2981=_0x3fa854;_0x704e3e=_0x5b2981[_0x8ccb('0x6e')];_0x553414=_0x704e3e==='zoho.eu'?'eu':_0x8ccb('0x71');_0x804c5c=_0x5b2981[_0x8ccb('0x70')];var _0x2fb8f5=_0x804c5c[_0x8ccb('0x72')](-0x1);if(_0x2fb8f5==='/'||_0x2fb8f5==='\x5c'||_0x2fb8f5===':'){_0x804c5c=_0x804c5c[_0x8ccb('0x73')](0x0,_0x804c5c[_0x8ccb('0x74')](_0x2fb8f5));}if(!_0x5b2981[_0x8ccb('0x68')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5b2981);})[_0x8ccb('0x21')](function(_0x4c25e1){if(_0x4c25e1){return rp({'method':_0x8ccb('0x75'),'uri':util[_0x8ccb('0x76')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x553414),'qs':{'module':_0x8ccb('0x77')},'headers':{'Authorization':_0x8ccb('0x78')+_0x4c25e1},'json':!![]});}})[_0x8ccb('0x21')](function(_0x49fb47){if(_0x49fb47){if(_0x49fb47[_0x8ccb('0x79')]&&_0x49fb47[_0x8ccb('0x79')][_0x8ccb('0x25')]){throw new Error(_0x49fb47[_0x8ccb('0x79')][_0x8ccb('0x25')][_0x8ccb('0x28')]);}var _0x2eec86=[];var _0x400f98=[];var _0xf6624d=[_0x8ccb('0x7a'),_0x8ccb('0x7b'),_0x8ccb('0x7c'),_0x8ccb('0x7d'),_0x8ccb('0x7e'),_0x8ccb('0x7f'),_0x8ccb('0x80'),'Call_Type'];_0x400f98=_[_0x8ccb('0x81')](_0x49fb47[_0x8ccb('0x41')],function(_0xf9f5bc){return _0xf6624d[_0x8ccb('0x82')](_0xf9f5bc['api_name']);});for(var _0x5bd9ba=0x0;_0x5bd9ba<_0x400f98['length'];_0x5bd9ba++){if(_0x400f98[_0x5bd9ba][_0x8ccb('0x83')]===![]){_0x2eec86[_0x8ccb('0x84')]({'id':_0x400f98[_0x5bd9ba]['id'],'name':_0x400f98[_0x5bd9ba][_0x8ccb('0x85')],'custom':_0x400f98[_0x5bd9ba][_0x8ccb('0x86')],'options':_0x400f98[_0x5bd9ba]['data_type']===_0x8ccb('0x87')&&_0x400f98[_0x5bd9ba][_0x8ccb('0x88')]['length']>-0x1?_[_0x8ccb('0x38')](_0x400f98[_0x5bd9ba]['pick_list_values'],function(_0x53d48b){return{'name':_0x53d48b,'value':_0x53d48b};}):[]});}}return{'count':_0x2eec86[_0x8ccb('0x42')],'rows':_0x2eec86};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0xcad684,null))[_0x8ccb('0x52')](function(_0x120181){var _0x4ea0ef=_0x23b379[_0x8ccb('0x3c')][_0x8ccb('0x1c')]?0x1f4:_0x120181['statusCode']||0x1f4;logger[_0x8ccb('0x25')](_0x8ccb('0x89'),_0x8ccb('0x6d'),_0x4ea0ef,JSON['stringify'](_0x120181));delete _0x120181[_0x8ccb('0x35')];if(_0x4ea0ef===0x191){_0x4ea0ef=0x190;}_0xcad684['status'](_0x4ea0ef)[_0x8ccb('0x36')](_0x23b379[_0x8ccb('0x3c')][_0x8ccb('0x1c')]?{'message':'Wrong\x20credentials','statusCode':_0x120181[_0x8ccb('0x8a')]}:_0x120181);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 777ecf5..8970040 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 _0x2dab=['authorization_code','clientSecret','code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','inspect','https://accounts.zoho.eu','then','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','host','slice','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token'];(function(_0x448774,_0x45ddc7){var _0x46b2f6=function(_0x1dee94){while(--_0x1dee94){_0x448774['push'](_0x448774['shift']());}};_0x46b2f6(++_0x45ddc7);}(_0x2dab,0x1ab));var _0xb2da=function(_0xbd9f,_0x723914){_0xbd9f=_0xbd9f-0x0;var _0x47ce6f=_0x2dab[_0xbd9f];return _0x47ce6f;};'use strict';var _=require(_0xb2da('0x0'));var util=require(_0xb2da('0x1'));var logger=require('../../config/logger')(_0xb2da('0x2'));var moment=require(_0xb2da('0x3'));var BPromise=require(_0xb2da('0x4'));var rp=require(_0xb2da('0x5'));var fs=require('fs');var path=require(_0xb2da('0x6'));var rimraf=require('rimraf');var config=require(_0xb2da('0x7'));var attributes=require(_0xb2da('0x8'));var integrations=require(_0xb2da('0x9'));module['exports']=function(_0x41a220,_0x1a501a){return _0x41a220['define'](_0xb2da('0xa'),attributes,{'tableName':_0xb2da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x416b54,_0x5386a7,_0x45ff51){if(_0x416b54['changed'](_0xb2da('0xc'))||_0x416b54[_0xb2da('0xd')](_0xb2da('0xe'))||_0x416b54[_0xb2da('0xd')](_0xb2da('0xf'))||_0x416b54['changed']('clientSecret')||_0x416b54['changed']('code')||_0x416b54[_0xb2da('0xd')](_0xb2da('0x10'))){var _0x147b75,_0x3c3cc4;_0x147b75=_0x416b54[_0xb2da('0xe')];var _0x509128=_0x147b75[_0xb2da('0x11')](-0x1);if(_0x509128==='/'||_0x509128==='\x5c'||_0x509128===':'){_0x147b75=_0x147b75['substring'](0x0,_0x147b75['lastIndexOf'](_0x509128));}switch(_0x416b54[_0xb2da('0xc')]){case'US':_0x3c3cc4=_0xb2da('0x12');break;case'AU':_0x3c3cc4=_0xb2da('0x13');break;case'IN':_0x3c3cc4=_0xb2da('0x14');break;case'CN':_0x3c3cc4=_0xb2da('0x15');break;default:_0x3c3cc4='https://accounts.zoho.eu';break;}var _0x263a2f={'method':_0xb2da('0x16'),'uri':_0x3c3cc4+_0xb2da('0x17'),'form':{'grant_type':_0xb2da('0x18'),'client_id':_0x416b54[_0xb2da('0xf')],'client_secret':_0x416b54[_0xb2da('0x19')],'redirect_uri':_0x416b54[_0xb2da('0xe')],'code':_0x416b54[_0xb2da('0x1a')]},'headers':{'Content-Type':_0xb2da('0x1b')}};return rp(_0x263a2f)['then'](function(_0xa3ad20){var _0xbab83e=JSON[_0xb2da('0x1c')](_0xa3ad20);if(_0xbab83e[_0xb2da('0x1d')]){_0x416b54[_0xb2da('0x1e')]=_0xbab83e['refresh_token'];logger[_0xb2da('0x1f')](util[_0xb2da('0x20')](_0xb2da('0x21'),_0x416b54['name'],_0x416b54['id']));}else{logger[_0xb2da('0x22')](util[_0xb2da('0x20')](_0xb2da('0x23'),_0x416b54[_0xb2da('0x24')],_0x416b54['id']),util['inspect'](_0xbab83e,{'showHidden':![],'depth':null}));}return _0x45ff51(null,_0x5386a7);})[_0xb2da('0x25')](function(_0x3a01ca){logger[_0xb2da('0x22')](util[_0xb2da('0x20')](_0xb2da('0x23'),_0x416b54[_0xb2da('0x24')],_0x416b54['id']),util[_0xb2da('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x45ff51(_0x3a01ca);});}else{return _0x45ff51(null,_0x5386a7);}},'beforeUpdate':function(_0x21911c,_0x2f041f,_0x38cd34){if(_0x21911c['changed'](_0xb2da('0xc'))||_0x21911c[_0xb2da('0xd')](_0xb2da('0xe'))||_0x21911c[_0xb2da('0xd')](_0xb2da('0xf'))||_0x21911c[_0xb2da('0xd')](_0xb2da('0x19'))||_0x21911c[_0xb2da('0xd')](_0xb2da('0x1a'))||_0x21911c['changed'](_0xb2da('0x10'))){var _0x5d8715,_0x1fb47e;_0x5d8715=_0x21911c['serverUrl'];var _0x2c4a5a=_0x5d8715['slice'](-0x1);if(_0x2c4a5a==='/'||_0x2c4a5a==='\x5c'||_0x2c4a5a===':'){_0x5d8715=_0x5d8715['substring'](0x0,_0x5d8715['lastIndexOf'](_0x2c4a5a));}switch(_0x21911c['zone']){case'US':_0x1fb47e=_0xb2da('0x12');break;case'AU':_0x1fb47e=_0xb2da('0x13');break;case'IN':_0x1fb47e=_0xb2da('0x14');break;case'CN':_0x1fb47e=_0xb2da('0x15');break;default:_0x1fb47e=_0xb2da('0x27');break;}var _0x49fac4={'method':'POST','uri':_0x1fb47e+_0xb2da('0x17'),'form':{'grant_type':_0xb2da('0x18'),'client_id':_0x21911c['clientId'],'client_secret':_0x21911c['clientSecret'],'redirect_uri':_0x21911c['serverUrl'],'code':_0x21911c[_0xb2da('0x1a')]},'headers':{'Content-Type':_0xb2da('0x1b')}};return rp(_0x49fac4)[_0xb2da('0x28')](function(_0x4a931d){var _0x755969=JSON[_0xb2da('0x1c')](_0x4a931d);if(_0x755969[_0xb2da('0x1d')]){_0x21911c['refreshToken']=_0x755969[_0xb2da('0x1d')];logger['info'](util[_0xb2da('0x20')](_0xb2da('0x21'),_0x21911c[_0xb2da('0x24')],_0x21911c['id']));}else{logger['error'](util[_0xb2da('0x20')](_0xb2da('0x23'),_0x21911c[_0xb2da('0x24')],_0x21911c['id']),util[_0xb2da('0x26')](_0x755969,{'showHidden':![],'depth':null}));}return _0x38cd34(null,_0x2f041f);})[_0xb2da('0x25')](function(_0x1a561b){logger[_0xb2da('0x22')](util[_0xb2da('0x20')](_0xb2da('0x23'),_0x21911c[_0xb2da('0x24')],_0x21911c['id']),util[_0xb2da('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x38cd34(_0x1a561b);});}else{return _0x38cd34(null,_0x2f041f);}}}});}; \ No newline at end of file +var _0xf84a=['ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.com','then','parse','catch','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x4c1513,_0x5b0418){var _0x4f253f=function(_0x25cd66){while(--_0x25cd66){_0x4c1513['push'](_0x4c1513['shift']());}};_0x4f253f(++_0x5b0418);}(_0xf84a,0x1e2));var _0xaf84=function(_0x4bb235,_0x46a03d){_0x4bb235=_0x4bb235-0x0;var _0x64493f=_0xf84a[_0x4bb235];return _0x64493f;};'use strict';var _=require(_0xaf84('0x0'));var util=require(_0xaf84('0x1'));var logger=require(_0xaf84('0x2'))(_0xaf84('0x3'));var moment=require(_0xaf84('0x4'));var BPromise=require(_0xaf84('0x5'));var rp=require(_0xaf84('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf84('0x7'));var config=require(_0xaf84('0x8'));var attributes=require(_0xaf84('0x9'));var integrations=require(_0xaf84('0xa'));module[_0xaf84('0xb')]=function(_0xd1c5f8,_0x4688d8){return _0xd1c5f8[_0xaf84('0xc')](_0xaf84('0xd'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe46150,_0x4b0439,_0x54438a){if(_0xe46150[_0xaf84('0xe')](_0xaf84('0xf'))||_0xe46150['changed'](_0xaf84('0x10'))||_0xe46150[_0xaf84('0xe')](_0xaf84('0x11'))||_0xe46150[_0xaf84('0xe')](_0xaf84('0x12'))||_0xe46150[_0xaf84('0xe')](_0xaf84('0x13'))||_0xe46150[_0xaf84('0xe')](_0xaf84('0x14'))){var _0x25963d,_0x5598cb;_0x25963d=_0xe46150[_0xaf84('0x10')];var _0x5a5c95=_0x25963d[_0xaf84('0x15')](-0x1);if(_0x5a5c95==='/'||_0x5a5c95==='\x5c'||_0x5a5c95===':'){_0x25963d=_0x25963d[_0xaf84('0x16')](0x0,_0x25963d[_0xaf84('0x17')](_0x5a5c95));}switch(_0xe46150[_0xaf84('0xf')]){case'US':_0x5598cb='https://accounts.zoho.com';break;case'AU':_0x5598cb=_0xaf84('0x18');break;case'IN':_0x5598cb=_0xaf84('0x19');break;case'CN':_0x5598cb=_0xaf84('0x1a');break;default:_0x5598cb=_0xaf84('0x1b');break;}var _0x445e40={'method':_0xaf84('0x1c'),'uri':_0x5598cb+_0xaf84('0x1d'),'form':{'grant_type':_0xaf84('0x1e'),'client_id':_0xe46150['clientId'],'client_secret':_0xe46150[_0xaf84('0x12')],'redirect_uri':_0xe46150['serverUrl'],'code':_0xe46150[_0xaf84('0x13')]},'headers':{'Content-Type':_0xaf84('0x1f')}};return rp(_0x445e40)['then'](function(_0x5c9b4d){var _0x3d3b02=JSON['parse'](_0x5c9b4d);if(_0x3d3b02[_0xaf84('0x20')]){_0xe46150[_0xaf84('0x21')]=_0x3d3b02[_0xaf84('0x20')];logger[_0xaf84('0x22')](util[_0xaf84('0x23')](_0xaf84('0x24'),_0xe46150[_0xaf84('0x25')],_0xe46150['id']));}else{logger[_0xaf84('0x26')](util['format'](_0xaf84('0x27'),_0xe46150['name'],_0xe46150['id']),util[_0xaf84('0x28')](_0x3d3b02,{'showHidden':![],'depth':null}));}return _0x54438a(null,_0x4b0439);})['catch'](function(_0x1fa8e2){logger[_0xaf84('0x26')](util[_0xaf84('0x23')](_0xaf84('0x27'),_0xe46150[_0xaf84('0x25')],_0xe46150['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x54438a(_0x1fa8e2);});}else{return _0x54438a(null,_0x4b0439);}},'beforeUpdate':function(_0x28bf37,_0x55e7a5,_0x597c12){if(_0x28bf37[_0xaf84('0xe')](_0xaf84('0xf'))||_0x28bf37[_0xaf84('0xe')]('serverUrl')||_0x28bf37['changed'](_0xaf84('0x11'))||_0x28bf37['changed'](_0xaf84('0x12'))||_0x28bf37[_0xaf84('0xe')](_0xaf84('0x13'))||_0x28bf37['changed'](_0xaf84('0x14'))){var _0x1f9669,_0x3c3182;_0x1f9669=_0x28bf37[_0xaf84('0x10')];var _0x5a37ce=_0x1f9669['slice'](-0x1);if(_0x5a37ce==='/'||_0x5a37ce==='\x5c'||_0x5a37ce===':'){_0x1f9669=_0x1f9669['substring'](0x0,_0x1f9669['lastIndexOf'](_0x5a37ce));}switch(_0x28bf37[_0xaf84('0xf')]){case'US':_0x3c3182=_0xaf84('0x29');break;case'AU':_0x3c3182=_0xaf84('0x18');break;case'IN':_0x3c3182=_0xaf84('0x19');break;case'CN':_0x3c3182='https://accounts.zoho.com.cn';break;default:_0x3c3182='https://accounts.zoho.eu';break;}var _0x4ad1ec={'method':_0xaf84('0x1c'),'uri':_0x3c3182+_0xaf84('0x1d'),'form':{'grant_type':_0xaf84('0x1e'),'client_id':_0x28bf37[_0xaf84('0x11')],'client_secret':_0x28bf37[_0xaf84('0x12')],'redirect_uri':_0x28bf37[_0xaf84('0x10')],'code':_0x28bf37[_0xaf84('0x13')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4ad1ec)[_0xaf84('0x2a')](function(_0x177154){var _0x5f2ad9=JSON[_0xaf84('0x2b')](_0x177154);if(_0x5f2ad9[_0xaf84('0x20')]){_0x28bf37['refreshToken']=_0x5f2ad9[_0xaf84('0x20')];logger[_0xaf84('0x22')](util[_0xaf84('0x23')](_0xaf84('0x24'),_0x28bf37['name'],_0x28bf37['id']));}else{logger[_0xaf84('0x26')](util[_0xaf84('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x28bf37[_0xaf84('0x25')],_0x28bf37['id']),util[_0xaf84('0x28')](_0x5f2ad9,{'showHidden':![],'depth':null}));}return _0x597c12(null,_0x55e7a5);})[_0xaf84('0x2c')](function(_0x3780f4){logger[_0xaf84('0x26')](util[_0xaf84('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x28bf37[_0xaf84('0x25')],_0x28bf37['id']),util[_0xaf84('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x597c12(_0x3780f4);});}else{return _0x597c12(null,_0x55e7a5);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 918720b..908ab41 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 _0x7428=['debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','options','raw','where','attributes','limit','include','model','map','GetZohoAccount','ShowZohoAccount','ZohoAccount','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0x7428,0x1aa));var _0x8742=function(_0x5f0413,_0x32d5fe){_0x5f0413=_0x5f0413-0x0;var _0x297f26=_0x7428[_0x5f0413];return _0x297f26;};'use strict';var _=require(_0x8742('0x0'));var util=require(_0x8742('0x1'));var moment=require(_0x8742('0x2'));var BPromise=require(_0x8742('0x3'));var rs=require(_0x8742('0x4'));var fs=require('fs');var Redis=require(_0x8742('0x5'));var db=require(_0x8742('0x6'))['db'];var utils=require(_0x8742('0x7'));var logger=require(_0x8742('0x8'))(_0x8742('0x9'));var config=require(_0x8742('0xa'));var jayson=require(_0x8742('0xb'));var client=jayson[_0x8742('0xc')][_0x8742('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x20d128,_0x1a40bb,_0xd786c2){return new BPromise(function(_0x1e0c72,_0x3f26fa){return client[_0x8742('0xe')](_0x20d128,_0xd786c2)['then'](function(_0x13f581){logger[_0x8742('0xf')](_0x8742('0x10'),_0x1a40bb,_0x8742('0x11'));logger[_0x8742('0x12')](_0x8742('0x13'),_0x1a40bb,_0x8742('0x11'),JSON[_0x8742('0x14')](_0x13f581));if(_0x13f581[_0x8742('0x15')]){if(_0x13f581['error'][_0x8742('0x16')]===0x1f4){logger['error'](_0x8742('0x10'),_0x1a40bb,_0x13f581['error'][_0x8742('0x17')]);return _0x3f26fa(_0x13f581['error']['message']);}logger[_0x8742('0x15')](_0x8742('0x10'),_0x1a40bb,_0x13f581['error'][_0x8742('0x17')]);return _0x1e0c72(_0x13f581[_0x8742('0x15')][_0x8742('0x17')]);}else{logger[_0x8742('0xf')](_0x8742('0x10'),_0x1a40bb,_0x8742('0x11'));_0x1e0c72(_0x13f581['result'][_0x8742('0x17')]);}})[_0x8742('0x18')](function(_0x1e1be3){logger['error'](_0x8742('0x10'),_0x1a40bb,_0x1e1be3);_0x3f26fa(_0x1e1be3);});});}exports['GetZohoAccount']=function(_0x1fcf0b){var _0x42f02e=this;return new Promise(function(_0x500667,_0x5e22e8){return db['ZohoAccount']['findAll']({'raw':_0x1fcf0b[_0x8742('0x19')]?_0x1fcf0b[_0x8742('0x19')][_0x8742('0x1a')]===undefined?!![]:![]:!![],'where':_0x1fcf0b[_0x8742('0x19')]?_0x1fcf0b['options'][_0x8742('0x1b')]||null:null,'attributes':_0x1fcf0b['options']?_0x1fcf0b[_0x8742('0x19')][_0x8742('0x1c')]||null:null,'limit':_0x1fcf0b[_0x8742('0x19')]?_0x1fcf0b[_0x8742('0x19')][_0x8742('0x1d')]||null:null,'include':_0x1fcf0b[_0x8742('0x19')]?_0x1fcf0b[_0x8742('0x19')][_0x8742('0x1e')]?_['map'](_0x1fcf0b[_0x8742('0x19')][_0x8742('0x1e')],function(_0x1fa861){return{'model':db[_0x1fa861[_0x8742('0x1f')]],'as':_0x1fa861['as'],'attributes':_0x1fa861[_0x8742('0x1c')],'include':_0x1fa861['include']?_[_0x8742('0x20')](_0x1fa861[_0x8742('0x1e')],function(_0x14d781){return{'model':db[_0x14d781['model']],'as':_0x14d781['as'],'attributes':_0x14d781['attributes'],'include':_0x14d781[_0x8742('0x1e')]?_['map'](_0x14d781[_0x8742('0x1e')],function(_0x66d52f){return{'model':db[_0x66d52f[_0x8742('0x1f')]],'as':_0x66d52f['as'],'attributes':_0x66d52f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x40025f){logger['info'](_0x8742('0x21'),_0x1fcf0b);logger[_0x8742('0x12')](_0x8742('0x21'),_0x1fcf0b,JSON['stringify'](_0x40025f));_0x500667(_0x40025f);})['catch'](function(_0x3d9bc4){logger[_0x8742('0x15')]('GetZohoAccount',_0x3d9bc4[_0x8742('0x17')],_0x1fcf0b);_0x5e22e8(_0x42f02e[_0x8742('0x15')](0x1f4,_0x3d9bc4[_0x8742('0x17')]));});});};exports[_0x8742('0x22')]=function(_0x31a1e0){var _0x50055d=this;return new Promise(function(_0x52e784,_0x5aec15){return db[_0x8742('0x23')]['find']({'raw':_0x31a1e0[_0x8742('0x19')]?_0x31a1e0[_0x8742('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x31a1e0[_0x8742('0x19')]?_0x31a1e0[_0x8742('0x19')][_0x8742('0x1b')]||null:null,'attributes':_0x31a1e0[_0x8742('0x19')]?_0x31a1e0[_0x8742('0x19')][_0x8742('0x1c')]||null:null,'include':_0x31a1e0[_0x8742('0x19')]?_0x31a1e0[_0x8742('0x19')]['include']?_['map'](_0x31a1e0[_0x8742('0x19')][_0x8742('0x1e')],function(_0x32a9c6){return{'model':db[_0x32a9c6['model']],'as':_0x32a9c6['as'],'attributes':_0x32a9c6['attributes'],'include':_0x32a9c6['include']?_[_0x8742('0x20')](_0x32a9c6[_0x8742('0x1e')],function(_0xcf10){return{'model':db[_0xcf10[_0x8742('0x1f')]],'as':_0xcf10['as'],'attributes':_0xcf10[_0x8742('0x1c')],'include':_0xcf10[_0x8742('0x1e')]?_[_0x8742('0x20')](_0xcf10[_0x8742('0x1e')],function(_0x30fb20){return{'model':db[_0x30fb20[_0x8742('0x1f')]],'as':_0x30fb20['as'],'attributes':_0x30fb20[_0x8742('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8742('0x24')](function(_0x5ea6f3){logger['info'](_0x8742('0x22'),_0x31a1e0);logger['debug']('ShowZohoAccount',_0x31a1e0,JSON[_0x8742('0x14')](_0x5ea6f3));_0x52e784(_0x5ea6f3);})[_0x8742('0x18')](function(_0x4e98b3){logger['error'](_0x8742('0x22'),_0x4e98b3[_0x8742('0x17')],_0x31a1e0);_0x5aec15(_0x50055d[_0x8742('0x15')](0x1f4,_0x4e98b3['message']));});});}; \ No newline at end of file +var _0x745c=['message','request\x20sent','result','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes','include','map','model','ShowZohoAccount','find','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x475482,_0x5bf595){var _0x1445b8=function(_0x570dbc){while(--_0x570dbc){_0x475482['push'](_0x475482['shift']());}};_0x1445b8(++_0x5bf595);}(_0x745c,0x1e4));var _0xc745=function(_0x63c808,_0x581c80){_0x63c808=_0x63c808-0x0;var _0x190a3c=_0x745c[_0x63c808];return _0x190a3c;};'use strict';var _=require(_0xc745('0x0'));var util=require(_0xc745('0x1'));var moment=require('moment');var BPromise=require(_0xc745('0x2'));var rs=require(_0xc745('0x3'));var fs=require('fs');var Redis=require(_0xc745('0x4'));var db=require(_0xc745('0x5'))['db'];var utils=require(_0xc745('0x6'));var logger=require(_0xc745('0x7'))(_0xc745('0x8'));var config=require(_0xc745('0x9'));var jayson=require(_0xc745('0xa'));var client=jayson[_0xc745('0xb')][_0xc745('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x881cc7,_0x2a5fbe,_0x264074){return new BPromise(function(_0x4df180,_0x4a6889){return client['request'](_0x881cc7,_0x264074)['then'](function(_0x4e081c){logger[_0xc745('0xd')](_0xc745('0xe'),_0x2a5fbe,'request\x20sent');logger[_0xc745('0xf')](_0xc745('0x10'),_0x2a5fbe,'request\x20sent',JSON[_0xc745('0x11')](_0x4e081c));if(_0x4e081c['error']){if(_0x4e081c[_0xc745('0x12')][_0xc745('0x13')]===0x1f4){logger[_0xc745('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x2a5fbe,_0x4e081c[_0xc745('0x12')]['message']);return _0x4a6889(_0x4e081c[_0xc745('0x12')]['message']);}logger['error'](_0xc745('0xe'),_0x2a5fbe,_0x4e081c[_0xc745('0x12')][_0xc745('0x14')]);return _0x4df180(_0x4e081c['error'][_0xc745('0x14')]);}else{logger[_0xc745('0xd')](_0xc745('0xe'),_0x2a5fbe,_0xc745('0x15'));_0x4df180(_0x4e081c[_0xc745('0x16')]['message']);}})[_0xc745('0x17')](function(_0x4f3f2b){logger[_0xc745('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x2a5fbe,_0x4f3f2b);_0x4a6889(_0x4f3f2b);});});}exports[_0xc745('0x18')]=function(_0x33ac56){var _0x228063=this;return new Promise(function(_0x55d787,_0x8e1f86){return db[_0xc745('0x19')]['findAll']({'raw':_0x33ac56[_0xc745('0x1a')]?_0x33ac56[_0xc745('0x1a')][_0xc745('0x1b')]===undefined?!![]:![]:!![],'where':_0x33ac56[_0xc745('0x1a')]?_0x33ac56[_0xc745('0x1a')][_0xc745('0x1c')]||null:null,'attributes':_0x33ac56['options']?_0x33ac56[_0xc745('0x1a')][_0xc745('0x1d')]||null:null,'limit':_0x33ac56['options']?_0x33ac56[_0xc745('0x1a')]['limit']||null:null,'include':_0x33ac56['options']?_0x33ac56[_0xc745('0x1a')][_0xc745('0x1e')]?_[_0xc745('0x1f')](_0x33ac56['options'][_0xc745('0x1e')],function(_0x5b5bba){return{'model':db[_0x5b5bba['model']],'as':_0x5b5bba['as'],'attributes':_0x5b5bba[_0xc745('0x1d')],'include':_0x5b5bba[_0xc745('0x1e')]?_[_0xc745('0x1f')](_0x5b5bba[_0xc745('0x1e')],function(_0x572f71){return{'model':db[_0x572f71[_0xc745('0x20')]],'as':_0x572f71['as'],'attributes':_0x572f71['attributes'],'include':_0x572f71['include']?_['map'](_0x572f71[_0xc745('0x1e')],function(_0x4a4a31){return{'model':db[_0x4a4a31[_0xc745('0x20')]],'as':_0x4a4a31['as'],'attributes':_0x4a4a31[_0xc745('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3925f6){logger[_0xc745('0xd')](_0xc745('0x18'),_0x33ac56);logger[_0xc745('0xf')](_0xc745('0x18'),_0x33ac56,JSON[_0xc745('0x11')](_0x3925f6));_0x55d787(_0x3925f6);})[_0xc745('0x17')](function(_0x1ec03c){logger[_0xc745('0x12')](_0xc745('0x18'),_0x1ec03c['message'],_0x33ac56);_0x8e1f86(_0x228063['error'](0x1f4,_0x1ec03c['message']));});});};exports[_0xc745('0x21')]=function(_0x4c6120){var _0x315e9b=this;return new Promise(function(_0x43987d,_0x30b024){return db['ZohoAccount'][_0xc745('0x22')]({'raw':_0x4c6120[_0xc745('0x1a')]?_0x4c6120[_0xc745('0x1a')][_0xc745('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c6120['options']?_0x4c6120[_0xc745('0x1a')][_0xc745('0x1c')]||null:null,'attributes':_0x4c6120['options']?_0x4c6120[_0xc745('0x1a')][_0xc745('0x1d')]||null:null,'include':_0x4c6120[_0xc745('0x1a')]?_0x4c6120['options']['include']?_[_0xc745('0x1f')](_0x4c6120[_0xc745('0x1a')][_0xc745('0x1e')],function(_0x11b583){return{'model':db[_0x11b583['model']],'as':_0x11b583['as'],'attributes':_0x11b583['attributes'],'include':_0x11b583[_0xc745('0x1e')]?_[_0xc745('0x1f')](_0x11b583[_0xc745('0x1e')],function(_0x2e2367){return{'model':db[_0x2e2367[_0xc745('0x20')]],'as':_0x2e2367['as'],'attributes':_0x2e2367[_0xc745('0x1d')],'include':_0x2e2367[_0xc745('0x1e')]?_[_0xc745('0x1f')](_0x2e2367['include'],function(_0x13efe9){return{'model':db[_0x13efe9[_0xc745('0x20')]],'as':_0x13efe9['as'],'attributes':_0x13efe9[_0xc745('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc745('0x23')](function(_0xf9f34b){logger[_0xc745('0xd')](_0xc745('0x21'),_0x4c6120);logger[_0xc745('0xf')](_0xc745('0x21'),_0x4c6120,JSON[_0xc745('0x11')](_0xf9f34b));_0x43987d(_0xf9f34b);})[_0xc745('0x17')](function(_0x504418){logger[_0xc745('0x12')](_0xc745('0x21'),_0x504418['message'],_0x4c6120);_0x30b024(_0x315e9b[_0xc745('0x12')](0x1f4,_0x504418[_0xc745('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 06d45f7..53276f4 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 _0xf17f=['util','path','express','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','delete','destroy','exports','multer'];(function(_0x9a23df,_0x2edc93){var _0x44c94e=function(_0xb17494){while(--_0xb17494){_0x9a23df['push'](_0x9a23df['shift']());}};_0x44c94e(++_0x2edc93);}(_0xf17f,0x113));var _0xff17=function(_0x5cc5dc,_0x1af669){_0x5cc5dc=_0x5cc5dc-0x0;var _0x421a9c=_0xf17f[_0x5cc5dc];return _0x421a9c;};'use strict';var multer=require(_0xff17('0x0'));var util=require(_0xff17('0x1'));var path=require(_0xff17('0x2'));var timeout=require('connect-timeout');var express=require(_0xff17('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xff17('0x4'));var config=require(_0xff17('0x5'));var controller=require(_0xff17('0x6'));router[_0xff17('0x7')]('/',auth['isAuthenticated'](),controller[_0xff17('0x8')]);router[_0xff17('0x7')]('/:id',auth[_0xff17('0x9')](),controller[_0xff17('0xa')]);router['get'](_0xff17('0xb'),auth[_0xff17('0x9')](),controller[_0xff17('0xc')]);router['get'](_0xff17('0xd'),auth[_0xff17('0x9')](),controller[_0xff17('0xe')]);router['get'](_0xff17('0xf'),auth[_0xff17('0x9')](),controller[_0xff17('0x10')]);router[_0xff17('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xff17('0x12')](_0xff17('0x13'),auth[_0xff17('0x9')](),controller['update']);router[_0xff17('0x14')](_0xff17('0x13'),auth['isAuthenticated'](),controller[_0xff17('0x15')]);module[_0xff17('0x16')]=router; \ No newline at end of file +var _0x112a=['getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x24f7bb,_0x267dc2){var _0x2c5c5a=function(_0x9c1836){while(--_0x9c1836){_0x24f7bb['push'](_0x24f7bb['shift']());}};_0x2c5c5a(++_0x267dc2);}(_0x112a,0x115));var _0xa112=function(_0x3ea510,_0x3a1ba5){_0x3ea510=_0x3ea510-0x0;var _0x492199=_0x112a[_0x3ea510];return _0x492199;};'use strict';var multer=require(_0xa112('0x0'));var util=require(_0xa112('0x1'));var path=require(_0xa112('0x2'));var timeout=require(_0xa112('0x3'));var express=require(_0xa112('0x4'));var router=express[_0xa112('0x5')]();var auth=require(_0xa112('0x6'));var interaction=require(_0xa112('0x7'));var config=require(_0xa112('0x8'));var controller=require(_0xa112('0x9'));router[_0xa112('0xa')]('/',auth[_0xa112('0xb')](),controller[_0xa112('0xc')]);router[_0xa112('0xa')](_0xa112('0xd'),auth[_0xa112('0xb')](),controller[_0xa112('0xe')]);router[_0xa112('0xa')](_0xa112('0xf'),auth[_0xa112('0xb')](),controller[_0xa112('0x10')]);router[_0xa112('0xa')](_0xa112('0x11'),auth['isAuthenticated'](),controller[_0xa112('0x12')]);router['get'](_0xa112('0x13'),auth[_0xa112('0xb')](),controller[_0xa112('0x14')]);router[_0xa112('0x15')]('/',auth[_0xa112('0xb')](),controller[_0xa112('0x16')]);router[_0xa112('0x17')](_0xa112('0xd'),auth[_0xa112('0xb')](),controller[_0xa112('0x18')]);router[_0xa112('0x19')](_0xa112('0xd'),auth[_0xa112('0xb')](),controller[_0xa112('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 0b1d1ce..f0df877 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 _0xa0ea=['STRING','ENUM','lead','nothing','contact_lead','exports'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xa0ea,0x14f));var _0xaa0e=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xa0ea[_0x28669c];return _0x4a3af6;};'use strict';var Sequelize=require('sequelize');module[_0xaa0e('0x0')]={'name':{'type':Sequelize[_0xaa0e('0x1')]},'moduleCreate':{'type':Sequelize[_0xaa0e('0x2')](_0xaa0e('0x3'),'contact',_0xaa0e('0x4')),'defaultValue':_0xaa0e('0x3')},'moduleSearch':{'type':Sequelize[_0xaa0e('0x2')]('contact_lead','contact',_0xaa0e('0x3')),'defaultValue':_0xaa0e('0x5')},'description':{'type':Sequelize[_0xaa0e('0x1')]}}; \ No newline at end of file +var _0xb792=['contact_lead','exports','STRING','ENUM','lead','nothing'];(function(_0x2a31fa,_0x5d4755){var _0x581150=function(_0x2483a8){while(--_0x2483a8){_0x2a31fa['push'](_0x2a31fa['shift']());}};_0x581150(++_0x5d4755);}(_0xb792,0xf7));var _0x2b79=function(_0xd505e4,_0x4027a0){_0xd505e4=_0xd505e4-0x0;var _0x2c2a85=_0xb792[_0xd505e4];return _0x2c2a85;};'use strict';var Sequelize=require('sequelize');module[_0x2b79('0x0')]={'name':{'type':Sequelize[_0x2b79('0x1')]},'moduleCreate':{'type':Sequelize[_0x2b79('0x2')](_0x2b79('0x3'),'contact',_0x2b79('0x4')),'defaultValue':_0x2b79('0x3')},'moduleSearch':{'type':Sequelize[_0x2b79('0x2')](_0x2b79('0x5'),'contact',_0x2b79('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 837fa53..68441c8 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 _0x5019=['client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','index','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','map','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','include','merge','find','create','body','getFields','findOne','ZohoField','getSubjects','nolimit','getDescriptions','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise'];(function(_0x5124c2,_0xdaada5){var _0x14b401=function(_0x1a1fec){while(--_0x1a1fec){_0x5124c2['push'](_0x5124c2['shift']());}};_0x14b401(++_0xdaada5);}(_0x5019,0x1c5));var _0x9501=function(_0x2c39b1,_0x147749){_0x2c39b1=_0x2c39b1-0x0;var _0x183ebe=_0x5019[_0x2c39b1];return _0x183ebe;};'use strict';var pdf=require(_0x9501('0x0'));var emlformat=require(_0x9501('0x1'));var rimraf=require(_0x9501('0x2'));var zipdir=require(_0x9501('0x3'));var jsonpatch=require(_0x9501('0x4'));var rp=require(_0x9501('0x5'));var moment=require('moment');var BPromise=require(_0x9501('0x6'));var Mustache=require(_0x9501('0x7'));var util=require(_0x9501('0x8'));var path=require(_0x9501('0x9'));var sox=require(_0x9501('0xa'));var csv=require(_0x9501('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9501('0xc'));var squel=require(_0x9501('0xd'));var crypto=require('crypto');var jsforce=require(_0x9501('0xe'));var deskjs=require(_0x9501('0xf'));var toCsv=require(_0x9501('0xb'));var querystring=require(_0x9501('0x10'));var Papa=require('papaparse');var Redis=require(_0x9501('0x11'));var authService=require(_0x9501('0x12'));var qs=require(_0x9501('0x13'));var as=require(_0x9501('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9501('0x15'))(_0x9501('0x16'));var utils=require(_0x9501('0x17'));var config=require(_0x9501('0x18'));var db=require(_0x9501('0x19'))['db'];var jayson=require(_0x9501('0x1a'));var client=jayson[_0x9501('0x1b')][_0x9501('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x534740,_0x53edca,_0x1b242b){if(_0x1b242b){var _0x38caff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38caff['test'](_0x53edca)){return _0x534740;}else{throw new db[(_0x9501('0x1d'))][(_0x9501('0x1e'))](_0x9501('0x1f'));}}else{return _0x534740;}}function respondWithRpcPromise(_0xa1e3ec,_0x22c1a7,_0x142adc,_0x5700ed){return new BPromise(function(_0x3265a9,_0x230467){var _0x445b23=_0x5700ed||client;return _0x445b23[_0x9501('0x20')](_0xa1e3ec,_0x142adc)[_0x9501('0x21')](function(_0x325120){logger['info'](_0x9501('0x22'),_0x22c1a7,_0x9501('0x23'));logger['debug'](_0x9501('0x24'),_0x22c1a7,_0x9501('0x23'),JSON[_0x9501('0x25')](_0x325120));if(_0x325120[_0x9501('0x26')]){if(_0x325120['error'][_0x9501('0x27')]===0x1f4){logger[_0x9501('0x26')](_0x9501('0x22'),_0x22c1a7,_0x325120[_0x9501('0x26')][_0x9501('0x28')]);return _0x230467(_0x325120['error']['message']);}logger[_0x9501('0x26')](_0x9501('0x22'),_0x22c1a7,_0x325120[_0x9501('0x26')]['message']);return _0x3265a9(_0x325120[_0x9501('0x26')][_0x9501('0x28')]);}else{logger[_0x9501('0x29')](_0x9501('0x22'),_0x22c1a7,_0x9501('0x23'));_0x3265a9(_0x325120[_0x9501('0x2a')][_0x9501('0x28')]);}})['catch'](function(_0x5b5c3d){logger[_0x9501('0x26')]('ZohoConfiguration,\x20%s,\x20%s',_0x22c1a7,_0x5b5c3d);_0x230467(_0x5b5c3d);});});}function respondWithStatusCode(_0x29a258,_0x4632ad){_0x4632ad=_0x4632ad||0xcc;return function(_0x59f51e){if(_0x59f51e){return _0x29a258[_0x9501('0x2b')](_0x4632ad);}return _0x29a258['status'](_0x4632ad)[_0x9501('0x2c')]();};}function respondWithResult(_0x4992a0,_0x50823c){_0x50823c=_0x50823c||0xc8;return function(_0x345bb7){if(_0x345bb7){return _0x4992a0[_0x9501('0x2d')](_0x50823c)[_0x9501('0x2e')](_0x345bb7);}};}function respondWithFilteredResult(_0x1fc06a,_0x2f3026){return function(_0x1589a8){if(_0x1589a8){var _0x2afc49=_0x1589a8[_0x9501('0x2f')],_0x38a7b7=_0x2f3026[_0x9501('0x30')],_0x859178=_0x2f3026['offset']+_0x2f3026[_0x9501('0x31')],_0x4f91e4;if(_0x859178>=_0x2afc49){_0x859178=_0x2afc49;_0x4f91e4=0xc8;}else{_0x4f91e4=0xce;}_0x1fc06a[_0x9501('0x2d')](_0x4f91e4);return _0x1fc06a[_0x9501('0x32')](_0x9501('0x33'),_0x38a7b7+'-'+_0x859178+'/'+_0x2afc49)[_0x9501('0x2e')](_0x1589a8);}return null;};}function patchUpdates(_0x2de7e7){return function(_0x3d555f){try{jsonpatch['apply'](_0x3d555f,_0x2de7e7,!![]);}catch(_0x3f645c){return BPromise[_0x9501('0x34')](_0x3f645c);}return _0x3d555f[_0x9501('0x35')]();};}function saveUpdates(_0xade705,_0x1ac783){return function(_0x28e7ba){if(_0x28e7ba){return _0x28e7ba[_0x9501('0x36')](_0xade705)['then'](function(_0xa3421d){return _0xa3421d;});}return null;};}function removeEntity(_0x2db02e,_0x460606){return function(_0x494489){if(_0x494489){return _0x494489[_0x9501('0x37')]()[_0x9501('0x21')](function(){_0x2db02e[_0x9501('0x2d')](0xcc)[_0x9501('0x2c')]();});}};}function handleEntityNotFound(_0x23a660,_0x53618d){return function(_0x231a7c){if(!_0x231a7c){_0x23a660[_0x9501('0x2b')](0x194);}return _0x231a7c;};}function handleError(_0x131e39,_0x10205c){_0x10205c=_0x10205c||0x1f4;return function(_0x55903b){logger[_0x9501('0x26')](_0x55903b['stack']);if(_0x55903b['name']){delete _0x55903b[_0x9501('0x38')];}_0x131e39['status'](_0x10205c)[_0x9501('0x39')](_0x55903b);};}exports[_0x9501('0x3a')]=function(_0x4d5a57,_0x95b1ea){var _0x1c5420={},_0x53eaaa={},_0x15631c={'count':0x0,'rows':[]};var _0xef06ec=_['map'](db[_0x9501('0x3b')][_0x9501('0x3c')],function(_0x211cbf){return{'name':_0x211cbf['fieldName'],'type':_0x211cbf[_0x9501('0x3d')][_0x9501('0x3e')]};});_0x53eaaa[_0x9501('0x3f')]=_['map'](_0xef06ec,_0x9501('0x38'));_0x53eaaa[_0x9501('0x40')]=_[_0x9501('0x41')](_0x4d5a57[_0x9501('0x40')]);_0x53eaaa[_0x9501('0x42')]=_[_0x9501('0x43')](_0x53eaaa['model'],_0x53eaaa[_0x9501('0x40')]);_0x1c5420['attributes']=_[_0x9501('0x43')](_0x53eaaa[_0x9501('0x3f')],qs[_0x9501('0x44')](_0x4d5a57[_0x9501('0x40')][_0x9501('0x44')]));_0x1c5420[_0x9501('0x45')]=_0x1c5420[_0x9501('0x45')][_0x9501('0x46')]?_0x1c5420[_0x9501('0x45')]:_0x53eaaa[_0x9501('0x3f')];if(!_0x4d5a57['query'][_0x9501('0x47')]('nolimit')){_0x1c5420[_0x9501('0x31')]=qs['limit'](_0x4d5a57[_0x9501('0x40')][_0x9501('0x31')]);_0x1c5420[_0x9501('0x30')]=qs['offset'](_0x4d5a57['query'][_0x9501('0x30')]);}_0x1c5420[_0x9501('0x48')]=qs[_0x9501('0x49')](_0x4d5a57[_0x9501('0x40')][_0x9501('0x49')]);_0x1c5420[_0x9501('0x4a')]=qs[_0x9501('0x42')](_[_0x9501('0x4b')](_0x4d5a57[_0x9501('0x40')],_0x53eaaa['filters']),_0xef06ec);if(_0x4d5a57['query']['filter']){_0x1c5420[_0x9501('0x4a')]=_['merge'](_0x1c5420[_0x9501('0x4a')],{'$or':_[_0x9501('0x4c')](_0xef06ec,function(_0xb16480){if(_0xb16480['type']!==_0x9501('0x4d')){var _0x453680={};_0x453680[_0xb16480['name']]={'$like':'%'+_0x4d5a57[_0x9501('0x40')][_0x9501('0x4e')]+'%'};return _0x453680;}})});}_0x1c5420=_['merge']({},_0x1c5420,_0x4d5a57[_0x9501('0x4f')]);var _0x216388={'where':_0x1c5420['where']};return db[_0x9501('0x3b')][_0x9501('0x2f')](_0x216388)['then'](function(_0x5a072f){_0x15631c[_0x9501('0x2f')]=_0x5a072f;if(_0x4d5a57[_0x9501('0x40')]['includeAll']){_0x1c5420['include']=[{'all':!![]}];}return db[_0x9501('0x3b')][_0x9501('0x50')](_0x1c5420);})[_0x9501('0x21')](function(_0x792c3c){_0x15631c['rows']=_0x792c3c;return _0x15631c;})[_0x9501('0x21')](respondWithFilteredResult(_0x95b1ea,_0x1c5420))[_0x9501('0x51')](handleError(_0x95b1ea,null));};exports[_0x9501('0x52')]=function(_0x753099,_0x52f83a){var _0x28441a={'raw':![],'where':{'id':_0x753099[_0x9501('0x53')]['id']}},_0x584af2={};_0x584af2[_0x9501('0x3f')]=_[_0x9501('0x41')](db[_0x9501('0x3b')][_0x9501('0x3c')]);_0x584af2[_0x9501('0x40')]=_[_0x9501('0x41')](_0x753099[_0x9501('0x40')]);_0x584af2['filters']=_['intersection'](_0x584af2[_0x9501('0x3f')],_0x584af2['query']);_0x28441a['attributes']=_[_0x9501('0x43')](_0x584af2[_0x9501('0x3f')],qs[_0x9501('0x44')](_0x753099['query'][_0x9501('0x44')]));_0x28441a['attributes']=_0x28441a[_0x9501('0x45')][_0x9501('0x46')]?_0x28441a[_0x9501('0x45')]:_0x584af2[_0x9501('0x3f')];if(_0x753099['query'][_0x9501('0x54')]){_0x28441a[_0x9501('0x55')]=[{'all':!![]}];}_0x28441a=_[_0x9501('0x56')]({},_0x28441a,_0x753099['options']);return db[_0x9501('0x3b')][_0x9501('0x57')](_0x28441a)[_0x9501('0x21')](handleEntityNotFound(_0x52f83a,null))[_0x9501('0x21')](respondWithResult(_0x52f83a,null))['catch'](handleError(_0x52f83a,null));};exports[_0x9501('0x58')]=function(_0xf8191,_0xe5bd03){return db[_0x9501('0x3b')][_0x9501('0x58')](_0xf8191[_0x9501('0x59')],{})[_0x9501('0x21')](respondWithResult(_0xe5bd03,0xc9))[_0x9501('0x51')](handleError(_0xe5bd03,null));};exports[_0x9501('0x36')]=function(_0x495cdf,_0x34298d){if(_0x495cdf['body']['id']){delete _0x495cdf[_0x9501('0x59')]['id'];}return db[_0x9501('0x3b')][_0x9501('0x57')]({'where':{'id':_0x495cdf['params']['id']}})['then'](handleEntityNotFound(_0x34298d,null))['then'](saveUpdates(_0x495cdf[_0x9501('0x59')],null))[_0x9501('0x21')](respondWithResult(_0x34298d,null))[_0x9501('0x51')](handleError(_0x34298d,null));};exports[_0x9501('0x37')]=function(_0x1d516e,_0x45015d){return db[_0x9501('0x3b')]['find']({'where':{'id':_0x1d516e['params']['id']}})[_0x9501('0x21')](handleEntityNotFound(_0x45015d,null))['then'](removeEntity(_0x45015d,null))[_0x9501('0x51')](handleError(_0x45015d,null));};exports[_0x9501('0x5a')]=function(_0x5ce43f,_0x15c2ab,_0x552ac5){var _0x2d4f98={};var _0x26e2b2={};var _0x5e45d7;var _0x844f5c;return db['ZohoConfiguration'][_0x9501('0x5b')]({'where':{'id':_0x5ce43f[_0x9501('0x53')]['id']}})['then'](handleEntityNotFound(_0x15c2ab,null))[_0x9501('0x21')](function(_0x405121){if(_0x405121){_0x5e45d7=_0x405121;_0x26e2b2['model']=_['keys'](db[_0x9501('0x5c')][_0x9501('0x3c')]);_0x26e2b2[_0x9501('0x40')]=_[_0x9501('0x41')](_0x5ce43f[_0x9501('0x40')]);_0x26e2b2['filters']=_['intersection'](_0x26e2b2[_0x9501('0x3f')],_0x26e2b2[_0x9501('0x40')]);_0x2d4f98['attributes']=_[_0x9501('0x43')](_0x26e2b2[_0x9501('0x3f')],qs[_0x9501('0x44')](_0x5ce43f[_0x9501('0x40')]['fields']));_0x2d4f98[_0x9501('0x45')]=_0x2d4f98[_0x9501('0x45')][_0x9501('0x46')]?_0x2d4f98['attributes']:_0x26e2b2[_0x9501('0x3f')];_0x2d4f98['order']=qs[_0x9501('0x49')](_0x5ce43f[_0x9501('0x40')]['sort']);_0x2d4f98[_0x9501('0x4a')]=qs['filters'](_[_0x9501('0x4b')](_0x5ce43f[_0x9501('0x40')],_0x26e2b2[_0x9501('0x42')]));if(_0x5ce43f[_0x9501('0x40')]['filter']){_0x2d4f98[_0x9501('0x4a')]=_[_0x9501('0x56')](_0x2d4f98['where'],{'$or':_[_0x9501('0x4c')](_0x2d4f98[_0x9501('0x45')],function(_0x4acc94){var _0x4e53ae={};_0x4e53ae[_0x4acc94]={'$like':'%'+_0x5ce43f[_0x9501('0x40')][_0x9501('0x4e')]+'%'};return _0x4e53ae;})});}_0x2d4f98=_['merge']({},_0x2d4f98,_0x5ce43f['options']);return _0x5e45d7[_0x9501('0x5a')](_0x2d4f98);}})[_0x9501('0x21')](function(_0x5bbf8d){if(_0x5bbf8d){_0x844f5c=_0x5bbf8d[_0x9501('0x46')];if(!_0x5ce43f[_0x9501('0x40')][_0x9501('0x47')]('nolimit')){_0x2d4f98[_0x9501('0x31')]=qs[_0x9501('0x31')](_0x5ce43f[_0x9501('0x40')][_0x9501('0x31')]);_0x2d4f98[_0x9501('0x30')]=qs['offset'](_0x5ce43f[_0x9501('0x40')][_0x9501('0x30')]);}return _0x5e45d7[_0x9501('0x5a')](_0x2d4f98);}})[_0x9501('0x21')](function(_0x508d40){if(_0x508d40){return _0x508d40?{'count':_0x844f5c,'rows':_0x508d40}:null;}})['then'](respondWithResult(_0x15c2ab,null))['catch'](handleError(_0x15c2ab,null));};exports[_0x9501('0x5d')]=function(_0xecb1d1,_0x58e78b,_0x284e6c){var _0x3436f7={};var _0x29f092={};var _0x5612ba;var _0x2d827c;return db['ZohoConfiguration'][_0x9501('0x5b')]({'where':{'id':_0xecb1d1[_0x9501('0x53')]['id']}})['then'](handleEntityNotFound(_0x58e78b,null))[_0x9501('0x21')](function(_0x25dbd1){if(_0x25dbd1){_0x5612ba=_0x25dbd1;_0x29f092[_0x9501('0x3f')]=_[_0x9501('0x41')](db[_0x9501('0x5c')][_0x9501('0x3c')]);_0x29f092[_0x9501('0x40')]=_[_0x9501('0x41')](_0xecb1d1[_0x9501('0x40')]);_0x29f092[_0x9501('0x42')]=_['intersection'](_0x29f092['model'],_0x29f092[_0x9501('0x40')]);_0x3436f7['attributes']=_[_0x9501('0x43')](_0x29f092['model'],qs['fields'](_0xecb1d1[_0x9501('0x40')][_0x9501('0x44')]));_0x3436f7[_0x9501('0x45')]=_0x3436f7[_0x9501('0x45')][_0x9501('0x46')]?_0x3436f7['attributes']:_0x29f092[_0x9501('0x3f')];_0x3436f7[_0x9501('0x48')]=qs['sort'](_0xecb1d1[_0x9501('0x40')][_0x9501('0x49')]);_0x3436f7['where']=qs[_0x9501('0x42')](_['pick'](_0xecb1d1[_0x9501('0x40')],_0x29f092[_0x9501('0x42')]));if(_0xecb1d1[_0x9501('0x40')][_0x9501('0x4e')]){_0x3436f7[_0x9501('0x4a')]=_[_0x9501('0x56')](_0x3436f7[_0x9501('0x4a')],{'$or':_[_0x9501('0x4c')](_0x3436f7[_0x9501('0x45')],function(_0x2f9807){var _0x153d7c={};_0x153d7c[_0x2f9807]={'$like':'%'+_0xecb1d1['query'][_0x9501('0x4e')]+'%'};return _0x153d7c;})});}_0x3436f7=_[_0x9501('0x56')]({},_0x3436f7,_0xecb1d1[_0x9501('0x4f')]);return _0x5612ba[_0x9501('0x5d')](_0x3436f7);}})[_0x9501('0x21')](function(_0x59ad19){if(_0x59ad19){_0x2d827c=_0x59ad19['length'];if(!_0xecb1d1['query']['hasOwnProperty'](_0x9501('0x5e'))){_0x3436f7[_0x9501('0x31')]=qs[_0x9501('0x31')](_0xecb1d1[_0x9501('0x40')][_0x9501('0x31')]);_0x3436f7[_0x9501('0x30')]=qs[_0x9501('0x30')](_0xecb1d1[_0x9501('0x40')][_0x9501('0x30')]);}return _0x5612ba[_0x9501('0x5d')](_0x3436f7);}})['then'](function(_0x24e9f8){if(_0x24e9f8){return _0x24e9f8?{'count':_0x2d827c,'rows':_0x24e9f8}:null;}})['then'](respondWithResult(_0x58e78b,null))['catch'](handleError(_0x58e78b,null));};exports[_0x9501('0x5f')]=function(_0x39a69b,_0x3af0ed,_0x4a3e04){var _0x7f4620={};var _0x10baaf={};var _0x4911d9;var _0x4d3a75;return db[_0x9501('0x3b')][_0x9501('0x5b')]({'where':{'id':_0x39a69b['params']['id']}})[_0x9501('0x21')](handleEntityNotFound(_0x3af0ed,null))[_0x9501('0x21')](function(_0x369dfa){if(_0x369dfa){_0x4911d9=_0x369dfa;_0x10baaf[_0x9501('0x3f')]=_[_0x9501('0x41')](db[_0x9501('0x5c')][_0x9501('0x3c')]);_0x10baaf[_0x9501('0x40')]=_[_0x9501('0x41')](_0x39a69b['query']);_0x10baaf[_0x9501('0x42')]=_['intersection'](_0x10baaf[_0x9501('0x3f')],_0x10baaf[_0x9501('0x40')]);_0x7f4620[_0x9501('0x45')]=_[_0x9501('0x43')](_0x10baaf[_0x9501('0x3f')],qs[_0x9501('0x44')](_0x39a69b[_0x9501('0x40')][_0x9501('0x44')]));_0x7f4620[_0x9501('0x45')]=_0x7f4620['attributes']['length']?_0x7f4620[_0x9501('0x45')]:_0x10baaf['model'];_0x7f4620[_0x9501('0x48')]=qs[_0x9501('0x49')](_0x39a69b[_0x9501('0x40')]['sort']);_0x7f4620[_0x9501('0x4a')]=qs[_0x9501('0x42')](_[_0x9501('0x4b')](_0x39a69b[_0x9501('0x40')],_0x10baaf['filters']));if(_0x39a69b[_0x9501('0x40')]['filter']){_0x7f4620[_0x9501('0x4a')]=_[_0x9501('0x56')](_0x7f4620[_0x9501('0x4a')],{'$or':_['map'](_0x7f4620[_0x9501('0x45')],function(_0x433eaf){var _0x371944={};_0x371944[_0x433eaf]={'$like':'%'+_0x39a69b['query'][_0x9501('0x4e')]+'%'};return _0x371944;})});}_0x7f4620=_[_0x9501('0x56')]({},_0x7f4620,_0x39a69b[_0x9501('0x4f')]);return _0x4911d9['getDescriptions'](_0x7f4620);}})[_0x9501('0x21')](function(_0x45d0f7){if(_0x45d0f7){_0x4d3a75=_0x45d0f7[_0x9501('0x46')];if(!_0x39a69b['query'][_0x9501('0x47')](_0x9501('0x5e'))){_0x7f4620[_0x9501('0x31')]=qs[_0x9501('0x31')](_0x39a69b['query'][_0x9501('0x31')]);_0x7f4620[_0x9501('0x30')]=qs[_0x9501('0x30')](_0x39a69b['query'][_0x9501('0x30')]);}return _0x4911d9[_0x9501('0x5f')](_0x7f4620);}})[_0x9501('0x21')](function(_0x31e7a6){if(_0x31e7a6){return _0x31e7a6?{'count':_0x4d3a75,'rows':_0x31e7a6}:null;}})['then'](respondWithResult(_0x3af0ed,null))[_0x9501('0x51')](handleError(_0x3af0ed,null));}; \ No newline at end of file +var _0x4a71=['debug','stringify','error','code','message','catch','status','end','json','count','offset','apply','reject','save','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','order','pick','filter','where','merge','options','ZohoConfiguration','includeAll','include','findAll','rows','show','keys','find','create','body','update','params','getFields','findOne','ZohoField','sort','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','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','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0x4a71,0x95));var _0x14a7=function(_0xea897b,_0x269096){_0xea897b=_0xea897b-0x0;var _0x8a736e=_0x4a71[_0xea897b];return _0x8a736e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x14a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x14a7('0x1'));var jsonpatch=require(_0x14a7('0x2'));var rp=require('request-promise');var moment=require(_0x14a7('0x3'));var BPromise=require(_0x14a7('0x4'));var Mustache=require(_0x14a7('0x5'));var util=require(_0x14a7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x14a7('0x7'));var ejs=require(_0x14a7('0x8'));var fs=require('fs');var _=require(_0x14a7('0x9'));var squel=require(_0x14a7('0xa'));var crypto=require(_0x14a7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x14a7('0xc'));var Papa=require(_0x14a7('0xd'));var Redis=require(_0x14a7('0xe'));var authService=require(_0x14a7('0xf'));var qs=require(_0x14a7('0x10'));var as=require(_0x14a7('0x11'));var hardwareService=require(_0x14a7('0x12'));var logger=require('../../config/logger')(_0x14a7('0x13'));var utils=require(_0x14a7('0x14'));var config=require(_0x14a7('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x14a7('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x227b8f,_0x2943e4,_0x4e1fed){if(_0x4e1fed){var _0x75ae1d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x75ae1d[_0x14a7('0x17')](_0x2943e4)){return _0x227b8f;}else{throw new db[(_0x14a7('0x18'))]['ValidationError'](_0x14a7('0x19'));}}else{return _0x227b8f;}}function respondWithRpcPromise(_0x462b90,_0x333e17,_0x2bd585,_0x196312){return new BPromise(function(_0x46259f,_0x5ef093){var _0x4643d1=_0x196312||client;return _0x4643d1[_0x14a7('0x1a')](_0x462b90,_0x2bd585)[_0x14a7('0x1b')](function(_0x332b14){logger[_0x14a7('0x1c')](_0x14a7('0x1d'),_0x333e17,_0x14a7('0x1e'));logger[_0x14a7('0x1f')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x333e17,'request\x20sent',JSON[_0x14a7('0x20')](_0x332b14));if(_0x332b14[_0x14a7('0x21')]){if(_0x332b14['error'][_0x14a7('0x22')]===0x1f4){logger[_0x14a7('0x21')]('ZohoConfiguration,\x20%s,\x20%s',_0x333e17,_0x332b14[_0x14a7('0x21')]['message']);return _0x5ef093(_0x332b14['error'][_0x14a7('0x23')]);}logger[_0x14a7('0x21')](_0x14a7('0x1d'),_0x333e17,_0x332b14[_0x14a7('0x21')][_0x14a7('0x23')]);return _0x46259f(_0x332b14[_0x14a7('0x21')][_0x14a7('0x23')]);}else{logger['info'](_0x14a7('0x1d'),_0x333e17,_0x14a7('0x1e'));_0x46259f(_0x332b14['result'][_0x14a7('0x23')]);}})[_0x14a7('0x24')](function(_0x2b7a14){logger['error'](_0x14a7('0x1d'),_0x333e17,_0x2b7a14);_0x5ef093(_0x2b7a14);});});}function respondWithStatusCode(_0x1da118,_0x475217){_0x475217=_0x475217||0xcc;return function(_0x4640ce){if(_0x4640ce){return _0x1da118['sendStatus'](_0x475217);}return _0x1da118[_0x14a7('0x25')](_0x475217)[_0x14a7('0x26')]();};}function respondWithResult(_0x5dfaa0,_0x5e91cf){_0x5e91cf=_0x5e91cf||0xc8;return function(_0x4c7b62){if(_0x4c7b62){return _0x5dfaa0[_0x14a7('0x25')](_0x5e91cf)[_0x14a7('0x27')](_0x4c7b62);}};}function respondWithFilteredResult(_0x528880,_0x10b3ac){return function(_0x47dbd9){if(_0x47dbd9){var _0x1bf482=_0x47dbd9[_0x14a7('0x28')],_0x8a3d6d=_0x10b3ac['offset'],_0x53b39f=_0x10b3ac[_0x14a7('0x29')]+_0x10b3ac['limit'],_0x512938;if(_0x53b39f>=_0x1bf482){_0x53b39f=_0x1bf482;_0x512938=0xc8;}else{_0x512938=0xce;}_0x528880['status'](_0x512938);return _0x528880['set']('Content-Range',_0x8a3d6d+'-'+_0x53b39f+'/'+_0x1bf482)['json'](_0x47dbd9);}return null;};}function patchUpdates(_0x1653ec){return function(_0x3eeeaa){try{jsonpatch[_0x14a7('0x2a')](_0x3eeeaa,_0x1653ec,!![]);}catch(_0x6dd532){return BPromise[_0x14a7('0x2b')](_0x6dd532);}return _0x3eeeaa[_0x14a7('0x2c')]();};}function saveUpdates(_0x104061,_0x1e4414){return function(_0x168f2b){if(_0x168f2b){return _0x168f2b['update'](_0x104061)[_0x14a7('0x1b')](function(_0x1ff344){return _0x1ff344;});}return null;};}function removeEntity(_0x528ab3,_0x70f00d){return function(_0x26f8d4){if(_0x26f8d4){return _0x26f8d4[_0x14a7('0x2d')]()[_0x14a7('0x1b')](function(){_0x528ab3[_0x14a7('0x25')](0xcc)[_0x14a7('0x26')]();});}};}function handleEntityNotFound(_0x52d404,_0x10b4ed){return function(_0x4f9bd5){if(!_0x4f9bd5){_0x52d404[_0x14a7('0x2e')](0x194);}return _0x4f9bd5;};}function handleError(_0x19a664,_0x315d5d){_0x315d5d=_0x315d5d||0x1f4;return function(_0x3b413b){logger[_0x14a7('0x21')](_0x3b413b[_0x14a7('0x2f')]);if(_0x3b413b[_0x14a7('0x30')]){delete _0x3b413b[_0x14a7('0x30')];}_0x19a664['status'](_0x315d5d)[_0x14a7('0x31')](_0x3b413b);};}exports[_0x14a7('0x32')]=function(_0x52b339,_0x8a94e4){var _0x186123={},_0x3f72f0={},_0x8b636d={'count':0x0,'rows':[]};var _0x536ff4=_['map'](db['ZohoConfiguration'][_0x14a7('0x33')],function(_0x2b0521){return{'name':_0x2b0521[_0x14a7('0x34')],'type':_0x2b0521[_0x14a7('0x35')][_0x14a7('0x36')]};});_0x3f72f0[_0x14a7('0x37')]=_[_0x14a7('0x38')](_0x536ff4,_0x14a7('0x30'));_0x3f72f0['query']=_['keys'](_0x52b339[_0x14a7('0x39')]);_0x3f72f0[_0x14a7('0x3a')]=_[_0x14a7('0x3b')](_0x3f72f0[_0x14a7('0x37')],_0x3f72f0[_0x14a7('0x39')]);_0x186123[_0x14a7('0x3c')]=_[_0x14a7('0x3b')](_0x3f72f0['model'],qs[_0x14a7('0x3d')](_0x52b339['query'][_0x14a7('0x3d')]));_0x186123['attributes']=_0x186123['attributes'][_0x14a7('0x3e')]?_0x186123['attributes']:_0x3f72f0[_0x14a7('0x37')];if(!_0x52b339[_0x14a7('0x39')]['hasOwnProperty'](_0x14a7('0x3f'))){_0x186123['limit']=qs[_0x14a7('0x40')](_0x52b339['query']['limit']);_0x186123[_0x14a7('0x29')]=qs[_0x14a7('0x29')](_0x52b339[_0x14a7('0x39')][_0x14a7('0x29')]);}_0x186123[_0x14a7('0x41')]=qs['sort'](_0x52b339[_0x14a7('0x39')]['sort']);_0x186123['where']=qs[_0x14a7('0x3a')](_[_0x14a7('0x42')](_0x52b339[_0x14a7('0x39')],_0x3f72f0['filters']),_0x536ff4);if(_0x52b339[_0x14a7('0x39')][_0x14a7('0x43')]){_0x186123[_0x14a7('0x44')]=_[_0x14a7('0x45')](_0x186123['where'],{'$or':_[_0x14a7('0x38')](_0x536ff4,function(_0xcbf3fe){if(_0xcbf3fe[_0x14a7('0x35')]!=='VIRTUAL'){var _0x5f2acb={};_0x5f2acb[_0xcbf3fe['name']]={'$like':'%'+_0x52b339[_0x14a7('0x39')]['filter']+'%'};return _0x5f2acb;}})});}_0x186123=_[_0x14a7('0x45')]({},_0x186123,_0x52b339[_0x14a7('0x46')]);var _0x1f84f5={'where':_0x186123['where']};return db[_0x14a7('0x47')][_0x14a7('0x28')](_0x1f84f5)[_0x14a7('0x1b')](function(_0x5be449){_0x8b636d['count']=_0x5be449;if(_0x52b339['query'][_0x14a7('0x48')]){_0x186123[_0x14a7('0x49')]=[{'all':!![]}];}return db[_0x14a7('0x47')][_0x14a7('0x4a')](_0x186123);})[_0x14a7('0x1b')](function(_0xdda916){_0x8b636d[_0x14a7('0x4b')]=_0xdda916;return _0x8b636d;})[_0x14a7('0x1b')](respondWithFilteredResult(_0x8a94e4,_0x186123))[_0x14a7('0x24')](handleError(_0x8a94e4,null));};exports[_0x14a7('0x4c')]=function(_0x3b9585,_0x213d14){var _0x110f33={'raw':![],'where':{'id':_0x3b9585['params']['id']}},_0x75ee2f={};_0x75ee2f[_0x14a7('0x37')]=_[_0x14a7('0x4d')](db[_0x14a7('0x47')][_0x14a7('0x33')]);_0x75ee2f[_0x14a7('0x39')]=_[_0x14a7('0x4d')](_0x3b9585['query']);_0x75ee2f[_0x14a7('0x3a')]=_[_0x14a7('0x3b')](_0x75ee2f['model'],_0x75ee2f[_0x14a7('0x39')]);_0x110f33['attributes']=_[_0x14a7('0x3b')](_0x75ee2f[_0x14a7('0x37')],qs['fields'](_0x3b9585[_0x14a7('0x39')][_0x14a7('0x3d')]));_0x110f33[_0x14a7('0x3c')]=_0x110f33[_0x14a7('0x3c')]['length']?_0x110f33[_0x14a7('0x3c')]:_0x75ee2f['model'];if(_0x3b9585['query'][_0x14a7('0x48')]){_0x110f33['include']=[{'all':!![]}];}_0x110f33=_[_0x14a7('0x45')]({},_0x110f33,_0x3b9585[_0x14a7('0x46')]);return db[_0x14a7('0x47')][_0x14a7('0x4e')](_0x110f33)[_0x14a7('0x1b')](handleEntityNotFound(_0x213d14,null))[_0x14a7('0x1b')](respondWithResult(_0x213d14,null))[_0x14a7('0x24')](handleError(_0x213d14,null));};exports[_0x14a7('0x4f')]=function(_0x3750b2,_0x257702){return db[_0x14a7('0x47')]['create'](_0x3750b2[_0x14a7('0x50')],{})[_0x14a7('0x1b')](respondWithResult(_0x257702,0xc9))[_0x14a7('0x24')](handleError(_0x257702,null));};exports[_0x14a7('0x51')]=function(_0x553b8f,_0x329577){if(_0x553b8f[_0x14a7('0x50')]['id']){delete _0x553b8f[_0x14a7('0x50')]['id'];}return db[_0x14a7('0x47')][_0x14a7('0x4e')]({'where':{'id':_0x553b8f['params']['id']}})[_0x14a7('0x1b')](handleEntityNotFound(_0x329577,null))[_0x14a7('0x1b')](saveUpdates(_0x553b8f['body'],null))[_0x14a7('0x1b')](respondWithResult(_0x329577,null))[_0x14a7('0x24')](handleError(_0x329577,null));};exports[_0x14a7('0x2d')]=function(_0x441a03,_0x119ca9){return db[_0x14a7('0x47')][_0x14a7('0x4e')]({'where':{'id':_0x441a03[_0x14a7('0x52')]['id']}})['then'](handleEntityNotFound(_0x119ca9,null))[_0x14a7('0x1b')](removeEntity(_0x119ca9,null))[_0x14a7('0x24')](handleError(_0x119ca9,null));};exports[_0x14a7('0x53')]=function(_0xcb7029,_0x331e9c,_0x1763e1){var _0x35030d={};var _0xa45386={};var _0x2ca6af;var _0x55fa43;return db[_0x14a7('0x47')][_0x14a7('0x54')]({'where':{'id':_0xcb7029[_0x14a7('0x52')]['id']}})[_0x14a7('0x1b')](handleEntityNotFound(_0x331e9c,null))[_0x14a7('0x1b')](function(_0x2be912){if(_0x2be912){_0x2ca6af=_0x2be912;_0xa45386[_0x14a7('0x37')]=_[_0x14a7('0x4d')](db[_0x14a7('0x55')][_0x14a7('0x33')]);_0xa45386[_0x14a7('0x39')]=_['keys'](_0xcb7029[_0x14a7('0x39')]);_0xa45386[_0x14a7('0x3a')]=_['intersection'](_0xa45386[_0x14a7('0x37')],_0xa45386[_0x14a7('0x39')]);_0x35030d['attributes']=_[_0x14a7('0x3b')](_0xa45386[_0x14a7('0x37')],qs[_0x14a7('0x3d')](_0xcb7029[_0x14a7('0x39')][_0x14a7('0x3d')]));_0x35030d[_0x14a7('0x3c')]=_0x35030d['attributes'][_0x14a7('0x3e')]?_0x35030d[_0x14a7('0x3c')]:_0xa45386[_0x14a7('0x37')];_0x35030d['order']=qs['sort'](_0xcb7029[_0x14a7('0x39')][_0x14a7('0x56')]);_0x35030d['where']=qs[_0x14a7('0x3a')](_[_0x14a7('0x42')](_0xcb7029[_0x14a7('0x39')],_0xa45386[_0x14a7('0x3a')]));if(_0xcb7029['query'][_0x14a7('0x43')]){_0x35030d[_0x14a7('0x44')]=_['merge'](_0x35030d[_0x14a7('0x44')],{'$or':_[_0x14a7('0x38')](_0x35030d[_0x14a7('0x3c')],function(_0x3bc25e){var _0x5c30af={};_0x5c30af[_0x3bc25e]={'$like':'%'+_0xcb7029[_0x14a7('0x39')][_0x14a7('0x43')]+'%'};return _0x5c30af;})});}_0x35030d=_[_0x14a7('0x45')]({},_0x35030d,_0xcb7029['options']);return _0x2ca6af[_0x14a7('0x53')](_0x35030d);}})[_0x14a7('0x1b')](function(_0x46d31b){if(_0x46d31b){_0x55fa43=_0x46d31b[_0x14a7('0x3e')];if(!_0xcb7029[_0x14a7('0x39')][_0x14a7('0x57')](_0x14a7('0x3f'))){_0x35030d['limit']=qs['limit'](_0xcb7029[_0x14a7('0x39')]['limit']);_0x35030d['offset']=qs[_0x14a7('0x29')](_0xcb7029['query'][_0x14a7('0x29')]);}return _0x2ca6af['getFields'](_0x35030d);}})[_0x14a7('0x1b')](function(_0x1d54f7){if(_0x1d54f7){return _0x1d54f7?{'count':_0x55fa43,'rows':_0x1d54f7}:null;}})[_0x14a7('0x1b')](respondWithResult(_0x331e9c,null))[_0x14a7('0x24')](handleError(_0x331e9c,null));};exports[_0x14a7('0x58')]=function(_0x388c9c,_0x45db18,_0x16601b){var _0x488813={};var _0x5ecccf={};var _0x570f1d;var _0x28e53f;return db[_0x14a7('0x47')]['findOne']({'where':{'id':_0x388c9c['params']['id']}})[_0x14a7('0x1b')](handleEntityNotFound(_0x45db18,null))[_0x14a7('0x1b')](function(_0x794177){if(_0x794177){_0x570f1d=_0x794177;_0x5ecccf[_0x14a7('0x37')]=_[_0x14a7('0x4d')](db[_0x14a7('0x55')]['rawAttributes']);_0x5ecccf[_0x14a7('0x39')]=_[_0x14a7('0x4d')](_0x388c9c['query']);_0x5ecccf[_0x14a7('0x3a')]=_[_0x14a7('0x3b')](_0x5ecccf[_0x14a7('0x37')],_0x5ecccf[_0x14a7('0x39')]);_0x488813[_0x14a7('0x3c')]=_[_0x14a7('0x3b')](_0x5ecccf[_0x14a7('0x37')],qs[_0x14a7('0x3d')](_0x388c9c[_0x14a7('0x39')][_0x14a7('0x3d')]));_0x488813[_0x14a7('0x3c')]=_0x488813[_0x14a7('0x3c')][_0x14a7('0x3e')]?_0x488813[_0x14a7('0x3c')]:_0x5ecccf[_0x14a7('0x37')];_0x488813[_0x14a7('0x41')]=qs['sort'](_0x388c9c[_0x14a7('0x39')]['sort']);_0x488813[_0x14a7('0x44')]=qs[_0x14a7('0x3a')](_[_0x14a7('0x42')](_0x388c9c[_0x14a7('0x39')],_0x5ecccf[_0x14a7('0x3a')]));if(_0x388c9c['query'][_0x14a7('0x43')]){_0x488813[_0x14a7('0x44')]=_[_0x14a7('0x45')](_0x488813[_0x14a7('0x44')],{'$or':_[_0x14a7('0x38')](_0x488813[_0x14a7('0x3c')],function(_0x1182b1){var _0x61bcaf={};_0x61bcaf[_0x1182b1]={'$like':'%'+_0x388c9c[_0x14a7('0x39')][_0x14a7('0x43')]+'%'};return _0x61bcaf;})});}_0x488813=_[_0x14a7('0x45')]({},_0x488813,_0x388c9c[_0x14a7('0x46')]);return _0x570f1d[_0x14a7('0x58')](_0x488813);}})['then'](function(_0x1d3df2){if(_0x1d3df2){_0x28e53f=_0x1d3df2['length'];if(!_0x388c9c['query'][_0x14a7('0x57')](_0x14a7('0x3f'))){_0x488813[_0x14a7('0x40')]=qs['limit'](_0x388c9c['query'][_0x14a7('0x40')]);_0x488813[_0x14a7('0x29')]=qs[_0x14a7('0x29')](_0x388c9c['query']['offset']);}return _0x570f1d[_0x14a7('0x58')](_0x488813);}})[_0x14a7('0x1b')](function(_0x112b98){if(_0x112b98){return _0x112b98?{'count':_0x28e53f,'rows':_0x112b98}:null;}})[_0x14a7('0x1b')](respondWithResult(_0x45db18,null))[_0x14a7('0x24')](handleError(_0x45db18,null));};exports[_0x14a7('0x59')]=function(_0x2b5322,_0x4d8181,_0x1af343){var _0x2a7bfc={};var _0x5550f7={};var _0x124eb0;var _0x13f83b;return db['ZohoConfiguration'][_0x14a7('0x54')]({'where':{'id':_0x2b5322['params']['id']}})[_0x14a7('0x1b')](handleEntityNotFound(_0x4d8181,null))['then'](function(_0x3ce319){if(_0x3ce319){_0x124eb0=_0x3ce319;_0x5550f7[_0x14a7('0x37')]=_[_0x14a7('0x4d')](db['ZohoField'][_0x14a7('0x33')]);_0x5550f7[_0x14a7('0x39')]=_[_0x14a7('0x4d')](_0x2b5322[_0x14a7('0x39')]);_0x5550f7[_0x14a7('0x3a')]=_['intersection'](_0x5550f7[_0x14a7('0x37')],_0x5550f7[_0x14a7('0x39')]);_0x2a7bfc[_0x14a7('0x3c')]=_[_0x14a7('0x3b')](_0x5550f7['model'],qs[_0x14a7('0x3d')](_0x2b5322[_0x14a7('0x39')][_0x14a7('0x3d')]));_0x2a7bfc[_0x14a7('0x3c')]=_0x2a7bfc[_0x14a7('0x3c')][_0x14a7('0x3e')]?_0x2a7bfc[_0x14a7('0x3c')]:_0x5550f7[_0x14a7('0x37')];_0x2a7bfc['order']=qs[_0x14a7('0x56')](_0x2b5322[_0x14a7('0x39')][_0x14a7('0x56')]);_0x2a7bfc[_0x14a7('0x44')]=qs[_0x14a7('0x3a')](_[_0x14a7('0x42')](_0x2b5322[_0x14a7('0x39')],_0x5550f7[_0x14a7('0x3a')]));if(_0x2b5322[_0x14a7('0x39')][_0x14a7('0x43')]){_0x2a7bfc[_0x14a7('0x44')]=_[_0x14a7('0x45')](_0x2a7bfc[_0x14a7('0x44')],{'$or':_[_0x14a7('0x38')](_0x2a7bfc[_0x14a7('0x3c')],function(_0x494d8f){var _0x5d69a7={};_0x5d69a7[_0x494d8f]={'$like':'%'+_0x2b5322['query'][_0x14a7('0x43')]+'%'};return _0x5d69a7;})});}_0x2a7bfc=_[_0x14a7('0x45')]({},_0x2a7bfc,_0x2b5322[_0x14a7('0x46')]);return _0x124eb0[_0x14a7('0x59')](_0x2a7bfc);}})[_0x14a7('0x1b')](function(_0xbda780){if(_0xbda780){_0x13f83b=_0xbda780[_0x14a7('0x3e')];if(!_0x2b5322['query'][_0x14a7('0x57')](_0x14a7('0x3f'))){_0x2a7bfc[_0x14a7('0x40')]=qs[_0x14a7('0x40')](_0x2b5322[_0x14a7('0x39')][_0x14a7('0x40')]);_0x2a7bfc[_0x14a7('0x29')]=qs[_0x14a7('0x29')](_0x2b5322[_0x14a7('0x39')][_0x14a7('0x29')]);}return _0x124eb0['getDescriptions'](_0x2a7bfc);}})['then'](function(_0x4c7322){if(_0x4c7322){return _0x4c7322?{'count':_0x13f83b,'rows':_0x4c7322}:null;}})[_0x14a7('0x1b')](respondWithResult(_0x4d8181,null))[_0x14a7('0x24')](handleError(_0x4d8181,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 48e3c92..cbbc327 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 _0xe9ea=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','util','api','moment','bluebird','request-promise'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xe9ea,0xb0));var _0xae9e=function(_0x4c5543,_0x586124){_0x4c5543=_0x4c5543-0x0;var _0x10aed2=_0xe9ea[_0x4c5543];return _0x10aed2;};'use strict';var _=require(_0xae9e('0x0'));var util=require(_0xae9e('0x1'));var logger=require('../../config/logger')(_0xae9e('0x2'));var moment=require(_0xae9e('0x3'));var BPromise=require(_0xae9e('0x4'));var rp=require(_0xae9e('0x5'));var fs=require('fs');var path=require(_0xae9e('0x6'));var rimraf=require(_0xae9e('0x7'));var config=require(_0xae9e('0x8'));var attributes=require(_0xae9e('0x9'));module[_0xae9e('0xa')]=function(_0x13391f,_0x29e3be){return _0x13391f[_0xae9e('0xb')](_0xae9e('0xc'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e86=['define','ZohoConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports'];(function(_0x42e14a,_0x48f51c){var _0x40a489=function(_0x5997c4){while(--_0x5997c4){_0x42e14a['push'](_0x42e14a['shift']());}};_0x40a489(++_0x48f51c);}(_0x5e86,0x147));var _0x65e8=function(_0x41c4bc,_0x427bf8){_0x41c4bc=_0x41c4bc-0x0;var _0x5c5c3c=_0x5e86[_0x41c4bc];return _0x5c5c3c;};'use strict';var _=require(_0x65e8('0x0'));var util=require(_0x65e8('0x1'));var logger=require(_0x65e8('0x2'))(_0x65e8('0x3'));var moment=require(_0x65e8('0x4'));var BPromise=require(_0x65e8('0x5'));var rp=require(_0x65e8('0x6'));var fs=require('fs');var path=require(_0x65e8('0x7'));var rimraf=require(_0x65e8('0x8'));var config=require('../../config/environment');var attributes=require(_0x65e8('0x9'));module[_0x65e8('0xa')]=function(_0xb7a1bd,_0xc90036){return _0xb7a1bd[_0x65e8('0xb')](_0x65e8('0xc'),attributes,{'tableName':'int_zoho_configurations','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 41b2cc4..65b155f 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 _0xa198=['request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x25a9f9,_0x1c6c37){var _0x3d0d38=function(_0x2a64fc){while(--_0x2a64fc){_0x25a9f9['push'](_0x25a9f9['shift']());}};_0x3d0d38(++_0x1c6c37);}(_0xa198,0x108));var _0x8a19=function(_0x5f025e,_0x4553ef){_0x5f025e=_0x5f025e-0x0;var _0x3745ab=_0xa198[_0x5f025e];return _0x3745ab;};'use strict';var _=require(_0x8a19('0x0'));var util=require(_0x8a19('0x1'));var moment=require(_0x8a19('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a19('0x4'))['db'];var utils=require(_0x8a19('0x5'));var logger=require(_0x8a19('0x6'))(_0x8a19('0x7'));var config=require(_0x8a19('0x8'));var jayson=require(_0x8a19('0x9'));var client=jayson[_0x8a19('0xa')][_0x8a19('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d724d,_0x4bbae4,_0x37b73e){return new BPromise(function(_0x29432e,_0x19e8a5){return client[_0x8a19('0xc')](_0x1d724d,_0x37b73e)[_0x8a19('0xd')](function(_0x3737f1){logger[_0x8a19('0xe')](_0x8a19('0xf'),_0x4bbae4,'request\x20sent');logger[_0x8a19('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4bbae4,_0x8a19('0x11'),JSON[_0x8a19('0x12')](_0x3737f1));if(_0x3737f1['error']){if(_0x3737f1[_0x8a19('0x13')][_0x8a19('0x14')]===0x1f4){logger[_0x8a19('0x13')](_0x8a19('0xf'),_0x4bbae4,_0x3737f1[_0x8a19('0x13')][_0x8a19('0x15')]);return _0x19e8a5(_0x3737f1[_0x8a19('0x13')][_0x8a19('0x15')]);}logger[_0x8a19('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x4bbae4,_0x3737f1['error'][_0x8a19('0x15')]);return _0x29432e(_0x3737f1[_0x8a19('0x13')][_0x8a19('0x15')]);}else{logger[_0x8a19('0xe')](_0x8a19('0xf'),_0x4bbae4,'request\x20sent');_0x29432e(_0x3737f1['result'][_0x8a19('0x15')]);}})[_0x8a19('0x16')](function(_0x14db91){logger[_0x8a19('0x13')](_0x8a19('0xf'),_0x4bbae4,_0x14db91);_0x19e8a5(_0x14db91);});});} \ No newline at end of file +var _0x8217=['stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x208475,_0x397b0f){var _0x5432c8=function(_0xb561d){while(--_0xb561d){_0x208475['push'](_0x208475['shift']());}};_0x5432c8(++_0x397b0f);}(_0x8217,0x1e9));var _0x7821=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0x8217[_0x46b22a];return _0x44c2e8;};'use strict';var _=require(_0x7821('0x0'));var util=require(_0x7821('0x1'));var moment=require(_0x7821('0x2'));var BPromise=require(_0x7821('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7821('0x4'))['db'];var utils=require(_0x7821('0x5'));var logger=require(_0x7821('0x6'))('rpc');var config=require(_0x7821('0x7'));var jayson=require(_0x7821('0x8'));var client=jayson[_0x7821('0x9')][_0x7821('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51aa46,_0x4db8da,_0x379139){return new BPromise(function(_0x195217,_0x4696c7){return client[_0x7821('0xb')](_0x51aa46,_0x379139)['then'](function(_0x59aae6){logger[_0x7821('0xc')](_0x7821('0xd'),_0x4db8da,_0x7821('0xe'));logger[_0x7821('0xf')](_0x7821('0x10'),_0x4db8da,_0x7821('0xe'),JSON[_0x7821('0x11')](_0x59aae6));if(_0x59aae6['error']){if(_0x59aae6['error']['code']===0x1f4){logger[_0x7821('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4db8da,_0x59aae6[_0x7821('0x12')][_0x7821('0x13')]);return _0x4696c7(_0x59aae6[_0x7821('0x12')][_0x7821('0x13')]);}logger[_0x7821('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4db8da,_0x59aae6[_0x7821('0x12')][_0x7821('0x13')]);return _0x195217(_0x59aae6[_0x7821('0x12')][_0x7821('0x13')]);}else{logger[_0x7821('0xc')](_0x7821('0xd'),_0x4db8da,_0x7821('0xe'));_0x195217(_0x59aae6[_0x7821('0x14')]['message']);}})[_0x7821('0x15')](function(_0x51d3a6){logger[_0x7821('0x12')](_0x7821('0xd'),_0x4db8da,_0x51d3a6);_0x4696c7(_0x51d3a6);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index d18acde..00752f3 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 _0xa456=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','multer'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa456,0x142));var _0x6a45=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xa456[_0x1a72f3];return _0x57ef47;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var auth=require(_0x6a45('0x5'));var interaction=require(_0x6a45('0x6'));var config=require('../../config/environment');var controller=require(_0x6a45('0x7'));router[_0x6a45('0x8')]('/',auth[_0x6a45('0x9')](),controller[_0x6a45('0xa')]);router['get'](_0x6a45('0xb'),auth[_0x6a45('0x9')](),controller[_0x6a45('0xc')]);router[_0x6a45('0xd')]('/',auth[_0x6a45('0x9')](),controller['create']);router[_0x6a45('0xe')]('/:id',auth[_0x6a45('0x9')](),controller[_0x6a45('0xf')]);router[_0x6a45('0x10')](_0x6a45('0xb'),auth[_0x6a45('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1a37=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','get','/:id','show','update','delete','destroy','exports'];(function(_0x595dac,_0x57e06b){var _0x38bb67=function(_0x14bb7b){while(--_0x14bb7b){_0x595dac['push'](_0x595dac['shift']());}};_0x38bb67(++_0x57e06b);}(_0x1a37,0xb4));var _0x71a3=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x1a37[_0x231e16];return _0x570a7c;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var auth=require(_0x71a3('0x6'));var interaction=require(_0x71a3('0x7'));var config=require(_0x71a3('0x8'));var controller=require(_0x71a3('0x9'));router['get']('/',auth[_0x71a3('0xa')](),controller['index']);router[_0x71a3('0xb')](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0xe')]);router[_0x71a3('0xf')](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0x10')]);module[_0x71a3('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index cf89cb9..85c5e4f 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 _0x2367=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2367,0x7f));var _0x7236=function(_0x4b36f2,_0x47e2e0){_0x4b36f2=_0x4b36f2-0x0;var _0x1a2599=_0x2367[_0x4b36f2];return _0x1a2599;};'use strict';var Sequelize=require(_0x7236('0x0'));module[_0x7236('0x1')]={'type':{'type':Sequelize[_0x7236('0x2')]('string',_0x7236('0x3'),_0x7236('0x4'),_0x7236('0x5')),'defaultValue':_0x7236('0x6')},'content':{'type':Sequelize[_0x7236('0x7')]},'key':{'type':Sequelize[_0x7236('0x7')]},'keyType':{'type':Sequelize[_0x7236('0x2')](_0x7236('0x6'),_0x7236('0x3'),_0x7236('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7236('0x7')]},'nameField':{'type':Sequelize[_0x7236('0x7')]},'customField':{'type':Sequelize[_0x7236('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7236('0x7')]}}; \ No newline at end of file +var _0x3e74=['customVariable','BOOLEAN','sequelize','ENUM','string','variable','STRING'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x3e74,0x175));var _0x43e7=function(_0x58402b,_0x31824b){_0x58402b=_0x58402b-0x0;var _0x4d1664=_0x3e74[_0x58402b];return _0x4d1664;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'type':{'type':Sequelize[_0x43e7('0x1')](_0x43e7('0x2'),_0x43e7('0x3'),'customVariable','keyValue'),'defaultValue':_0x43e7('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x43e7('0x4')]},'keyType':{'type':Sequelize[_0x43e7('0x1')](_0x43e7('0x2'),_0x43e7('0x3'),_0x43e7('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x43e7('0x4')]},'nameField':{'type':Sequelize[_0x43e7('0x4')]},'customField':{'type':Sequelize[_0x43e7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x43e7('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 36f3aa7..50862b9 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(_0x348b08,_0x5d7a46){var _0x484999=function(_0x5ddbac){while(--_0x5ddbac){_0x348b08['push'](_0x348b08['shift']());}};_0x484999(++_0x5d7a46);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x25bc7b,_0x1584e1){var _0x3c8d72=function(_0x3b9c63){while(--_0x3b9c63){_0x25bc7b['push'](_0x25bc7b['shift']());}};_0x3c8d72(++_0x1584e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a939258..8e16182 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 _0xaaee=['zoho_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0xaaee,0x132));var _0xeaae=function(_0x15ea25,_0x432486){_0x15ea25=_0x15ea25-0x0;var _0x546969=_0xaaee[_0x15ea25];return _0x546969;};'use strict';var _=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var logger=require(_0xeaae('0x2'))(_0xeaae('0x3'));var moment=require(_0xeaae('0x4'));var BPromise=require('bluebird');var rp=require(_0xeaae('0x5'));var fs=require('fs');var path=require(_0xeaae('0x6'));var rimraf=require(_0xeaae('0x7'));var config=require(_0xeaae('0x8'));var attributes=require(_0xeaae('0x9'));module[_0xeaae('0xa')]=function(_0xb5ad89,_0x491e4){return _0xb5ad89[_0xeaae('0xb')](_0xeaae('0xc'),attributes,{'tableName':_0xeaae('0xd'),'paranoid':![],'indexes':[{'name':_0xeaae('0xe'),'fields':['idField',_0xeaae('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc39c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x2393c0,_0x5d5d61){var _0x188aa9=function(_0x330de9){while(--_0x330de9){_0x2393c0['push'](_0x2393c0['shift']());}};_0x188aa9(++_0x5d5d61);}(_0xc39c,0xfb));var _0xcc39=function(_0x18bbce,_0x176b3b){_0x18bbce=_0x18bbce-0x0;var _0x41e909=_0xc39c[_0x18bbce];return _0x41e909;};'use strict';var _=require(_0xcc39('0x0'));var util=require(_0xcc39('0x1'));var logger=require(_0xcc39('0x2'))(_0xcc39('0x3'));var moment=require(_0xcc39('0x4'));var BPromise=require(_0xcc39('0x5'));var rp=require(_0xcc39('0x6'));var fs=require('fs');var path=require(_0xcc39('0x7'));var rimraf=require(_0xcc39('0x8'));var config=require(_0xcc39('0x9'));var attributes=require(_0xcc39('0xa'));module[_0xcc39('0xb')]=function(_0x100dd3,_0x4ae3c4){return _0x100dd3[_0xcc39('0xc')](_0xcc39('0xd'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xcc39('0xe'),'fields':[_0xcc39('0xf'),_0xcc39('0x10')],'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 7a66295..3853c34 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 _0x9c5a=['http','then','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x404a5c,_0x5799d6){var _0x15d846=function(_0x14cfa6){while(--_0x14cfa6){_0x404a5c['push'](_0x404a5c['shift']());}};_0x15d846(++_0x5799d6);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x3c9d21,_0x541d98){_0x3c9d21=_0x3c9d21-0x0;var _0xa27de8=_0x9c5a[_0x3c9d21];return _0xa27de8;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('ZohoField,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3ff1cd,_0x163edf){var _0x10001d=function(_0x2a9dc9){while(--_0x2a9dc9){_0x3ff1cd['push'](_0x3ff1cd['shift']());}};_0x10001d(++_0x163edf);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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']('ZohoField,\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);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 7993640..381e6af 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 _0x3a00=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x4846f3,_0x5ed340){var _0x4586aa=function(_0x1f2839){while(--_0x1f2839){_0x4846f3['push'](_0x4846f3['shift']());}};_0x4586aa(++_0x5ed340);}(_0x3a00,0xfc));var _0x03a0=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0x3a00[_0x20fb02];return _0x24a33e;};'use strict';var multer=require(_0x03a0('0x0'));var util=require(_0x03a0('0x1'));var path=require(_0x03a0('0x2'));var timeout=require(_0x03a0('0x3'));var express=require(_0x03a0('0x4'));var router=express[_0x03a0('0x5')]();var auth=require(_0x03a0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x03a0('0x7'));module[_0x03a0('0x8')]=router; \ No newline at end of file +var _0xf75b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0xf75b,0x1f4));var _0xbf75=function(_0xc9ffba,_0x14f0ff){_0xc9ffba=_0xc9ffba-0x0;var _0x18e98e=_0xf75b[_0xc9ffba];return _0x18e98e;};'use strict';var multer=require(_0xbf75('0x0'));var util=require(_0xbf75('0x1'));var path=require(_0xbf75('0x2'));var timeout=require(_0xbf75('0x3'));var express=require('express');var router=express[_0xbf75('0x4')]();var auth=require(_0xbf75('0x5'));var interaction=require(_0xbf75('0x6'));var config=require(_0xbf75('0x7'));module[_0xbf75('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 7a995e6..ff538c5 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 _0xa5c7=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x3035df,_0x13d656){var _0x3c2852=function(_0x249371){while(--_0x249371){_0x3035df['push'](_0x3035df['shift']());}};_0x3c2852(++_0x13d656);}(_0xa5c7,0xfb));var _0x7a5c=function(_0x4df5a5,_0x5adcca){_0x4df5a5=_0x4df5a5-0x0;var _0x3e1167=_0xa5c7[_0x4df5a5];return _0x3e1167;};'use strict';var Sequelize=require(_0x7a5c('0x0'));module[_0x7a5c('0x1')]={'name':{'type':Sequelize[_0x7a5c('0x2')],'allowNull':![],'unique':_0x7a5c('0x3')},'version':{'type':Sequelize[_0x7a5c('0x2')],'allowNull':![],'unique':_0x7a5c('0x3')},'main':{'type':Sequelize[_0x7a5c('0x2')],'defaultValue':_0x7a5c('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x7a5c('0x2')]},'type':{'type':Sequelize[_0x7a5c('0x2')]},'size':{'type':Sequelize[_0x7a5c('0x5')]},'active':{'type':Sequelize[_0x7a5c('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x7a5c('0x2')]},'logo':{'type':Sequelize[_0x7a5c('0x2')]},'state':{'type':Sequelize[_0x7a5c('0x2')],'unique':_0x7a5c('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7a5c('0x2')]},'link':{'type':Sequelize[_0x7a5c('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x86e9=['state','sequelize','exports','STRING','unique_name_and_version','INTEGER','BOOLEAN'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x86e9,0x158));var _0x986e=function(_0x3d09e2,_0x58e784){_0x3d09e2=_0x3d09e2-0x0;var _0x5d03cd=_0x86e9[_0x3d09e2];return _0x5d03cd;};'use strict';var Sequelize=require(_0x986e('0x0'));module[_0x986e('0x1')]={'name':{'type':Sequelize[_0x986e('0x2')],'allowNull':![],'unique':_0x986e('0x3')},'version':{'type':Sequelize[_0x986e('0x2')],'allowNull':![],'unique':_0x986e('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x986e('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x986e('0x4')]},'active':{'type':Sequelize[_0x986e('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x986e('0x2')]},'logo':{'type':Sequelize[_0x986e('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x986e('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x986e('0x2')]},'link':{'type':Sequelize[_0x986e('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index bc58ff7..3ebb1c2 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 _0x91a2=['hasOwnProperty','nolimit','offset','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','update','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','limit','set','json','apply','reject','then','error','stack','name','send','index','map','Integration','fieldName','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x56f0bb,_0x5dd638){var _0x2c10f9=function(_0x385b6e){while(--_0x385b6e){_0x56f0bb['push'](_0x56f0bb['shift']());}};_0x2c10f9(++_0x5dd638);}(_0x91a2,0x14b));var _0x291a=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x91a2[_0x4f431d];return _0x4f31e1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x291a('0x0'));var rimraf=require(_0x291a('0x1'));var zipdir=require(_0x291a('0x2'));var jsonpatch=require(_0x291a('0x3'));var rp=require(_0x291a('0x4'));var moment=require(_0x291a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x291a('0x6'));var util=require(_0x291a('0x7'));var path=require(_0x291a('0x8'));var sox=require(_0x291a('0x9'));var csv=require(_0x291a('0xa'));var ejs=require(_0x291a('0xb'));var fs=require('fs');var _=require(_0x291a('0xc'));var squel=require(_0x291a('0xd'));var crypto=require(_0x291a('0xe'));var jsforce=require(_0x291a('0xf'));var deskjs=require(_0x291a('0x10'));var toCsv=require(_0x291a('0xa'));var querystring=require(_0x291a('0x11'));var Papa=require(_0x291a('0x12'));var Redis=require(_0x291a('0x13'));var authService=require(_0x291a('0x14'));var qs=require(_0x291a('0x15'));var as=require(_0x291a('0x16'));var hardwareService=require(_0x291a('0x17'));var logger=require(_0x291a('0x18'))('api');var utils=require(_0x291a('0x19'));var config=require('../../config/environment');var db=require(_0x291a('0x1a'))['db'];function respondWithStatusCode(_0x1da9d3,_0x3ce102){_0x3ce102=_0x3ce102||0xcc;return function(_0x6a8ce){if(_0x6a8ce){return _0x1da9d3[_0x291a('0x1b')](_0x3ce102);}return _0x1da9d3[_0x291a('0x1c')](_0x3ce102)[_0x291a('0x1d')]();};}function respondWithResult(_0x57b186,_0x594f9c){_0x594f9c=_0x594f9c||0xc8;return function(_0x637d71){if(_0x637d71){return _0x57b186[_0x291a('0x1c')](_0x594f9c)['json'](_0x637d71);}};}function respondWithFilteredResult(_0x1c4b30,_0xa05171){return function(_0x3c0266){if(_0x3c0266){var _0x19d5bf=_0x3c0266[_0x291a('0x1e')],_0x10c4f8=_0xa05171['offset'],_0x5675b0=_0xa05171['offset']+_0xa05171[_0x291a('0x1f')],_0x5a603d;if(_0x5675b0>=_0x19d5bf){_0x5675b0=_0x19d5bf;_0x5a603d=0xc8;}else{_0x5a603d=0xce;}_0x1c4b30[_0x291a('0x1c')](_0x5a603d);return _0x1c4b30[_0x291a('0x20')]('Content-Range',_0x10c4f8+'-'+_0x5675b0+'/'+_0x19d5bf)[_0x291a('0x21')](_0x3c0266);}return null;};}function patchUpdates(_0x40d54b){return function(_0x3383c2){try{jsonpatch[_0x291a('0x22')](_0x3383c2,_0x40d54b,!![]);}catch(_0x45582b){return BPromise[_0x291a('0x23')](_0x45582b);}return _0x3383c2['save']();};}function saveUpdates(_0x975d62,_0x1ad9fd){return function(_0x3094ff){if(_0x3094ff){return _0x3094ff['update'](_0x975d62)[_0x291a('0x24')](function(_0x2bbe12){return _0x2bbe12;});}return null;};}function removeEntity(_0x2c960f,_0x57adc7){return function(_0x5475fb){if(_0x5475fb){return _0x5475fb['destroy']()[_0x291a('0x24')](function(){_0x2c960f[_0x291a('0x1c')](0xcc)[_0x291a('0x1d')]();});}};}function handleEntityNotFound(_0x344631,_0x52d626){return function(_0x2ce388){if(!_0x2ce388){_0x344631['sendStatus'](0x194);}return _0x2ce388;};}function handleError(_0x3dfe4a,_0x2d9bfd){_0x2d9bfd=_0x2d9bfd||0x1f4;return function(_0x57b180){logger[_0x291a('0x25')](_0x57b180[_0x291a('0x26')]);if(_0x57b180['name']){delete _0x57b180[_0x291a('0x27')];}_0x3dfe4a[_0x291a('0x1c')](_0x2d9bfd)[_0x291a('0x28')](_0x57b180);};}exports[_0x291a('0x29')]=function(_0x19ecd1,_0x2fadb4){var _0x3b7359={},_0x1aabd3={},_0x42951e={'count':0x0,'rows':[]};var _0x1f2f05=_[_0x291a('0x2a')](db[_0x291a('0x2b')]['rawAttributes'],function(_0x461f87){return{'name':_0x461f87[_0x291a('0x2c')],'type':_0x461f87[_0x291a('0x2d')][_0x291a('0x2e')]};});_0x1aabd3[_0x291a('0x2f')]=_[_0x291a('0x2a')](_0x1f2f05,'name');_0x1aabd3[_0x291a('0x30')]=_[_0x291a('0x31')](_0x19ecd1['query']);_0x1aabd3['filters']=_[_0x291a('0x32')](_0x1aabd3['model'],_0x1aabd3['query']);_0x3b7359[_0x291a('0x33')]=_[_0x291a('0x32')](_0x1aabd3[_0x291a('0x2f')],qs['fields'](_0x19ecd1[_0x291a('0x30')][_0x291a('0x34')]));_0x3b7359[_0x291a('0x33')]=_0x3b7359[_0x291a('0x33')][_0x291a('0x35')]?_0x3b7359[_0x291a('0x33')]:_0x1aabd3['model'];if(!_0x19ecd1[_0x291a('0x30')][_0x291a('0x36')](_0x291a('0x37'))){_0x3b7359['limit']=qs[_0x291a('0x1f')](_0x19ecd1[_0x291a('0x30')][_0x291a('0x1f')]);_0x3b7359['offset']=qs[_0x291a('0x38')](_0x19ecd1['query'][_0x291a('0x38')]);}_0x3b7359['order']=qs[_0x291a('0x39')](_0x19ecd1[_0x291a('0x30')][_0x291a('0x39')]);_0x3b7359[_0x291a('0x3a')]=qs['filters'](_[_0x291a('0x3b')](_0x19ecd1['query'],_0x1aabd3[_0x291a('0x3c')]),_0x1f2f05);if(_0x19ecd1[_0x291a('0x30')][_0x291a('0x3d')]){_0x3b7359[_0x291a('0x3a')]=_['merge'](_0x3b7359[_0x291a('0x3a')],{'$or':_[_0x291a('0x2a')](_0x1f2f05,function(_0x2aff7e){if(_0x2aff7e[_0x291a('0x2d')]!==_0x291a('0x3e')){var _0x554cb1={};_0x554cb1[_0x2aff7e['name']]={'$like':'%'+_0x19ecd1[_0x291a('0x30')]['filter']+'%'};return _0x554cb1;}})});}_0x3b7359=_[_0x291a('0x3f')]({},_0x3b7359,_0x19ecd1[_0x291a('0x40')]);var _0x53ca38={'where':_0x3b7359['where']};return db['Integration'][_0x291a('0x1e')](_0x53ca38)['then'](function(_0x3b73ee){_0x42951e[_0x291a('0x1e')]=_0x3b73ee;if(_0x19ecd1[_0x291a('0x30')][_0x291a('0x41')]){_0x3b7359[_0x291a('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x3b7359);})[_0x291a('0x24')](function(_0x4dd0b0){_0x42951e[_0x291a('0x43')]=_0x4dd0b0;return _0x42951e;})[_0x291a('0x24')](respondWithFilteredResult(_0x2fadb4,_0x3b7359))[_0x291a('0x44')](handleError(_0x2fadb4,null));};exports[_0x291a('0x45')]=function(_0x25e9f1,_0x241d05){var _0x20be4a={'raw':![],'where':{'id':_0x25e9f1['params']['id']}},_0x4f57fc={};_0x4f57fc['model']=_[_0x291a('0x31')](db[_0x291a('0x2b')][_0x291a('0x46')]);_0x4f57fc[_0x291a('0x30')]=_[_0x291a('0x31')](_0x25e9f1[_0x291a('0x30')]);_0x4f57fc[_0x291a('0x3c')]=_['intersection'](_0x4f57fc[_0x291a('0x2f')],_0x4f57fc['query']);_0x20be4a[_0x291a('0x33')]=_[_0x291a('0x32')](_0x4f57fc[_0x291a('0x2f')],qs[_0x291a('0x34')](_0x25e9f1['query'][_0x291a('0x34')]));_0x20be4a[_0x291a('0x33')]=_0x20be4a[_0x291a('0x33')][_0x291a('0x35')]?_0x20be4a[_0x291a('0x33')]:_0x4f57fc[_0x291a('0x2f')];if(_0x25e9f1[_0x291a('0x30')]['includeAll']){_0x20be4a[_0x291a('0x42')]=[{'all':!![]}];}_0x20be4a=_[_0x291a('0x3f')]({},_0x20be4a,_0x25e9f1['options']);return db[_0x291a('0x2b')][_0x291a('0x47')](_0x20be4a)[_0x291a('0x24')](handleEntityNotFound(_0x241d05,null))[_0x291a('0x24')](respondWithResult(_0x241d05,null))[_0x291a('0x44')](handleError(_0x241d05,null));};exports[_0x291a('0x48')]=function(_0x13910c,_0x4ae175){return db[_0x291a('0x2b')]['create'](_0x13910c[_0x291a('0x49')],{})['then'](respondWithResult(_0x4ae175,0xc9))[_0x291a('0x44')](handleError(_0x4ae175,null));};exports[_0x291a('0x4a')]=function(_0x3bde8c,_0x164684){if(_0x3bde8c[_0x291a('0x49')]['id']){delete _0x3bde8c[_0x291a('0x49')]['id'];}return db['Integration']['find']({'where':{'id':_0x3bde8c['params']['id']}})[_0x291a('0x24')](handleEntityNotFound(_0x164684,null))[_0x291a('0x24')](saveUpdates(_0x3bde8c[_0x291a('0x49')],null))[_0x291a('0x24')](respondWithResult(_0x164684,null))[_0x291a('0x44')](handleError(_0x164684,null));};exports[_0x291a('0x4b')]=function(_0x43f5fb,_0x6aaf69){return db[_0x291a('0x2b')][_0x291a('0x47')]({'where':{'id':_0x43f5fb[_0x291a('0x4c')]['id']}})[_0x291a('0x24')](handleEntityNotFound(_0x6aaf69,null))[_0x291a('0x24')](removeEntity(_0x6aaf69,null))[_0x291a('0x44')](handleError(_0x6aaf69,null));}; \ No newline at end of file +var _0x0537=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','Integration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0537,0x8c));var _0x7053=function(_0x31080a,_0x55b5cd){_0x31080a=_0x31080a-0x0;var _0x58d2fc=_0x0537[_0x31080a];return _0x58d2fc;};'use strict';var pdf=require(_0x7053('0x0'));var emlformat=require(_0x7053('0x1'));var rimraf=require(_0x7053('0x2'));var zipdir=require(_0x7053('0x3'));var jsonpatch=require(_0x7053('0x4'));var rp=require(_0x7053('0x5'));var moment=require(_0x7053('0x6'));var BPromise=require(_0x7053('0x7'));var Mustache=require(_0x7053('0x8'));var util=require(_0x7053('0x9'));var path=require(_0x7053('0xa'));var sox=require(_0x7053('0xb'));var csv=require(_0x7053('0xc'));var ejs=require(_0x7053('0xd'));var fs=require('fs');var _=require(_0x7053('0xe'));var squel=require(_0x7053('0xf'));var crypto=require(_0x7053('0x10'));var jsforce=require(_0x7053('0x11'));var deskjs=require(_0x7053('0x12'));var toCsv=require(_0x7053('0xc'));var querystring=require(_0x7053('0x13'));var Papa=require(_0x7053('0x14'));var Redis=require(_0x7053('0x15'));var authService=require(_0x7053('0x16'));var qs=require(_0x7053('0x17'));var as=require(_0x7053('0x18'));var hardwareService=require(_0x7053('0x19'));var logger=require(_0x7053('0x1a'))('api');var utils=require(_0x7053('0x1b'));var config=require(_0x7053('0x1c'));var db=require(_0x7053('0x1d'))['db'];function respondWithStatusCode(_0x44dc5c,_0x4ec669){_0x4ec669=_0x4ec669||0xcc;return function(_0x410a4b){if(_0x410a4b){return _0x44dc5c['sendStatus'](_0x4ec669);}return _0x44dc5c[_0x7053('0x1e')](_0x4ec669)['end']();};}function respondWithResult(_0x1946fa,_0x150939){_0x150939=_0x150939||0xc8;return function(_0x39fa9d){if(_0x39fa9d){return _0x1946fa[_0x7053('0x1e')](_0x150939)[_0x7053('0x1f')](_0x39fa9d);}};}function respondWithFilteredResult(_0x170c0b,_0x99faa1){return function(_0x464051){if(_0x464051){var _0xa71fbb=_0x464051[_0x7053('0x20')],_0x305912=_0x99faa1[_0x7053('0x21')],_0x1c205a=_0x99faa1[_0x7053('0x21')]+_0x99faa1[_0x7053('0x22')],_0x4a529a;if(_0x1c205a>=_0xa71fbb){_0x1c205a=_0xa71fbb;_0x4a529a=0xc8;}else{_0x4a529a=0xce;}_0x170c0b[_0x7053('0x1e')](_0x4a529a);return _0x170c0b[_0x7053('0x23')](_0x7053('0x24'),_0x305912+'-'+_0x1c205a+'/'+_0xa71fbb)[_0x7053('0x1f')](_0x464051);}return null;};}function patchUpdates(_0x3397e9){return function(_0x129990){try{jsonpatch[_0x7053('0x25')](_0x129990,_0x3397e9,!![]);}catch(_0x50fa62){return BPromise[_0x7053('0x26')](_0x50fa62);}return _0x129990[_0x7053('0x27')]();};}function saveUpdates(_0x399aa9,_0x3a93a4){return function(_0x5a2df6){if(_0x5a2df6){return _0x5a2df6[_0x7053('0x28')](_0x399aa9)[_0x7053('0x29')](function(_0x2a5bc8){return _0x2a5bc8;});}return null;};}function removeEntity(_0x15217a,_0x49d285){return function(_0x13a8e1){if(_0x13a8e1){return _0x13a8e1[_0x7053('0x2a')]()[_0x7053('0x29')](function(){_0x15217a[_0x7053('0x1e')](0xcc)[_0x7053('0x2b')]();});}};}function handleEntityNotFound(_0x5d8d24,_0x5bcb9e){return function(_0xf64b48){if(!_0xf64b48){_0x5d8d24['sendStatus'](0x194);}return _0xf64b48;};}function handleError(_0x46deab,_0x2a42d4){_0x2a42d4=_0x2a42d4||0x1f4;return function(_0x1645b3){logger[_0x7053('0x2c')](_0x1645b3['stack']);if(_0x1645b3['name']){delete _0x1645b3[_0x7053('0x2d')];}_0x46deab[_0x7053('0x1e')](_0x2a42d4)['send'](_0x1645b3);};}exports[_0x7053('0x2e')]=function(_0x4ec9be,_0x9e3297){var _0x387a92={},_0xd78957={},_0x3172ab={'count':0x0,'rows':[]};var _0x228215=_[_0x7053('0x2f')](db[_0x7053('0x30')][_0x7053('0x31')],function(_0xdfcd2f){return{'name':_0xdfcd2f[_0x7053('0x32')],'type':_0xdfcd2f[_0x7053('0x33')][_0x7053('0x34')]};});_0xd78957[_0x7053('0x35')]=_[_0x7053('0x2f')](_0x228215,_0x7053('0x2d'));_0xd78957['query']=_[_0x7053('0x36')](_0x4ec9be[_0x7053('0x37')]);_0xd78957['filters']=_[_0x7053('0x38')](_0xd78957['model'],_0xd78957[_0x7053('0x37')]);_0x387a92[_0x7053('0x39')]=_['intersection'](_0xd78957[_0x7053('0x35')],qs[_0x7053('0x3a')](_0x4ec9be[_0x7053('0x37')][_0x7053('0x3a')]));_0x387a92[_0x7053('0x39')]=_0x387a92[_0x7053('0x39')]['length']?_0x387a92[_0x7053('0x39')]:_0xd78957['model'];if(!_0x4ec9be['query']['hasOwnProperty'](_0x7053('0x3b'))){_0x387a92[_0x7053('0x22')]=qs['limit'](_0x4ec9be[_0x7053('0x37')][_0x7053('0x22')]);_0x387a92['offset']=qs[_0x7053('0x21')](_0x4ec9be[_0x7053('0x37')][_0x7053('0x21')]);}_0x387a92[_0x7053('0x3c')]=qs[_0x7053('0x3d')](_0x4ec9be['query'][_0x7053('0x3d')]);_0x387a92[_0x7053('0x3e')]=qs['filters'](_[_0x7053('0x3f')](_0x4ec9be[_0x7053('0x37')],_0xd78957[_0x7053('0x40')]),_0x228215);if(_0x4ec9be['query'][_0x7053('0x41')]){_0x387a92[_0x7053('0x3e')]=_[_0x7053('0x42')](_0x387a92[_0x7053('0x3e')],{'$or':_[_0x7053('0x2f')](_0x228215,function(_0x4a3b0d){if(_0x4a3b0d[_0x7053('0x33')]!==_0x7053('0x43')){var _0x47bfa2={};_0x47bfa2[_0x4a3b0d[_0x7053('0x2d')]]={'$like':'%'+_0x4ec9be[_0x7053('0x37')][_0x7053('0x41')]+'%'};return _0x47bfa2;}})});}_0x387a92=_[_0x7053('0x42')]({},_0x387a92,_0x4ec9be[_0x7053('0x44')]);var _0x38d339={'where':_0x387a92[_0x7053('0x3e')]};return db['Integration'][_0x7053('0x20')](_0x38d339)['then'](function(_0xc8a05f){_0x3172ab['count']=_0xc8a05f;if(_0x4ec9be['query'][_0x7053('0x45')]){_0x387a92[_0x7053('0x46')]=[{'all':!![]}];}return db[_0x7053('0x30')][_0x7053('0x47')](_0x387a92);})[_0x7053('0x29')](function(_0x2be3e2){_0x3172ab[_0x7053('0x48')]=_0x2be3e2;return _0x3172ab;})[_0x7053('0x29')](respondWithFilteredResult(_0x9e3297,_0x387a92))['catch'](handleError(_0x9e3297,null));};exports[_0x7053('0x49')]=function(_0x575110,_0x163388){var _0x46ccfb={'raw':![],'where':{'id':_0x575110[_0x7053('0x4a')]['id']}},_0x2223bf={};_0x2223bf[_0x7053('0x35')]=_['keys'](db['Integration']['rawAttributes']);_0x2223bf[_0x7053('0x37')]=_[_0x7053('0x36')](_0x575110['query']);_0x2223bf['filters']=_[_0x7053('0x38')](_0x2223bf[_0x7053('0x35')],_0x2223bf['query']);_0x46ccfb[_0x7053('0x39')]=_[_0x7053('0x38')](_0x2223bf[_0x7053('0x35')],qs[_0x7053('0x3a')](_0x575110[_0x7053('0x37')]['fields']));_0x46ccfb[_0x7053('0x39')]=_0x46ccfb[_0x7053('0x39')][_0x7053('0x4b')]?_0x46ccfb[_0x7053('0x39')]:_0x2223bf[_0x7053('0x35')];if(_0x575110[_0x7053('0x37')][_0x7053('0x45')]){_0x46ccfb[_0x7053('0x46')]=[{'all':!![]}];}_0x46ccfb=_[_0x7053('0x42')]({},_0x46ccfb,_0x575110[_0x7053('0x44')]);return db[_0x7053('0x30')][_0x7053('0x4c')](_0x46ccfb)['then'](handleEntityNotFound(_0x163388,null))[_0x7053('0x29')](respondWithResult(_0x163388,null))[_0x7053('0x4d')](handleError(_0x163388,null));};exports[_0x7053('0x4e')]=function(_0x20af07,_0x5c59e7){return db[_0x7053('0x30')][_0x7053('0x4e')](_0x20af07['body'],{})[_0x7053('0x29')](respondWithResult(_0x5c59e7,0xc9))[_0x7053('0x4d')](handleError(_0x5c59e7,null));};exports[_0x7053('0x28')]=function(_0xfe5499,_0x52557c){if(_0xfe5499[_0x7053('0x4f')]['id']){delete _0xfe5499['body']['id'];}return db[_0x7053('0x30')][_0x7053('0x4c')]({'where':{'id':_0xfe5499[_0x7053('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52557c,null))[_0x7053('0x29')](saveUpdates(_0xfe5499['body'],null))[_0x7053('0x29')](respondWithResult(_0x52557c,null))['catch'](handleError(_0x52557c,null));};exports[_0x7053('0x2a')]=function(_0x30d4b2,_0x2190c0){return db[_0x7053('0x30')][_0x7053('0x4c')]({'where':{'id':_0x30d4b2[_0x7053('0x4a')]['id']}})[_0x7053('0x29')](handleEntityNotFound(_0x2190c0,null))[_0x7053('0x29')](removeEntity(_0x2190c0,null))[_0x7053('0x4d')](handleError(_0x2190c0,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0ac1415..62fab04 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 _0xa6af=['integrations','lodash','../../config/logger','api','moment','path','../../config/environment','./integration.attributes','Integration'];(function(_0x87e0dc,_0x577dce){var _0x2cd2d1=function(_0x2d8173){while(--_0x2d8173){_0x87e0dc['push'](_0x87e0dc['shift']());}};_0x2cd2d1(++_0x577dce);}(_0xa6af,0x121));var _0xfa6a=function(_0x5acff5,_0x452767){_0x5acff5=_0x5acff5-0x0;var _0x6952a4=_0xa6af[_0x5acff5];return _0x6952a4;};'use strict';var _=require(_0xfa6a('0x0'));var util=require('util');var logger=require(_0xfa6a('0x1'))(_0xfa6a('0x2'));var moment=require(_0xfa6a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa6a('0x4'));var rimraf=require('rimraf');var config=require(_0xfa6a('0x5'));var attributes=require(_0xfa6a('0x6'));module['exports']=function(_0x1b0288,_0x3a363e){return _0x1b0288['define'](_0xfa6a('0x7'),attributes,{'tableName':_0xfa6a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f26=['integrations','util','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x493a89,_0x2f5fac){var _0x5be45c=function(_0x1147ed){while(--_0x1147ed){_0x493a89['push'](_0x493a89['shift']());}};_0x5be45c(++_0x2f5fac);}(_0x4f26,0xb1));var _0x64f2=function(_0x5b7525,_0x45f2cf){_0x5b7525=_0x5b7525-0x0;var _0xc8d580=_0x4f26[_0x5b7525];return _0xc8d580;};'use strict';var _=require('lodash');var util=require(_0x64f2('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x64f2('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64f2('0x2'));var rimraf=require(_0x64f2('0x3'));var config=require(_0x64f2('0x4'));var attributes=require('./integration.attributes');module[_0x64f2('0x5')]=function(_0x1536ee,_0x3162b1){return _0x1536ee[_0x64f2('0x6')]('Integration',attributes,{'tableName':_0x64f2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 67d83f0..51c6021 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 _0x5a96=['debug','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','info','request\x20sent'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x5a96,0xbc));var _0x65a9=function(_0x205742,_0x4ad437){_0x205742=_0x205742-0x0;var _0x222ab9=_0x5a96[_0x205742];return _0x222ab9;};'use strict';var _=require(_0x65a9('0x0'));var util=require(_0x65a9('0x1'));var moment=require('moment');var BPromise=require(_0x65a9('0x2'));var rs=require(_0x65a9('0x3'));var fs=require('fs');var Redis=require(_0x65a9('0x4'));var db=require(_0x65a9('0x5'))['db'];var utils=require(_0x65a9('0x6'));var logger=require(_0x65a9('0x7'))('rpc');var config=require(_0x65a9('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x596d73,_0x94fce1,_0x107fea){return new BPromise(function(_0x5ae332,_0x3330b9){return client['request'](_0x596d73,_0x107fea)[_0x65a9('0x9')](function(_0x3d6166){logger[_0x65a9('0xa')]('Integration,\x20%s,\x20%s',_0x94fce1,_0x65a9('0xb'));logger[_0x65a9('0xc')](_0x65a9('0xd'),_0x94fce1,_0x65a9('0xb'),JSON['stringify'](_0x3d6166));if(_0x3d6166[_0x65a9('0xe')]){if(_0x3d6166['error'][_0x65a9('0xf')]===0x1f4){logger[_0x65a9('0xe')](_0x65a9('0x10'),_0x94fce1,_0x3d6166['error']['message']);return _0x3330b9(_0x3d6166[_0x65a9('0xe')][_0x65a9('0x11')]);}logger['error']('Integration,\x20%s,\x20%s',_0x94fce1,_0x3d6166[_0x65a9('0xe')][_0x65a9('0x11')]);return _0x5ae332(_0x3d6166[_0x65a9('0xe')][_0x65a9('0x11')]);}else{logger[_0x65a9('0xa')]('Integration,\x20%s,\x20%s',_0x94fce1,'request\x20sent');_0x5ae332(_0x3d6166[_0x65a9('0x12')][_0x65a9('0x11')]);}})[_0x65a9('0x13')](function(_0x131414){logger[_0x65a9('0xe')](_0x65a9('0x10'),_0x94fce1,_0x131414);_0x3330b9(_0x131414);});});} \ No newline at end of file +var _0xc92f=['request','then','info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0x4d830b,_0x27f78d){var _0x238c89=function(_0x3eead9){while(--_0x3eead9){_0x4d830b['push'](_0x4d830b['shift']());}};_0x238c89(++_0x27f78d);}(_0xc92f,0xf3));var _0xfc92=function(_0x13a986,_0x3dd901){_0x13a986=_0x13a986-0x0;var _0xb03d0a=_0xc92f[_0x13a986];return _0xb03d0a;};'use strict';var _=require(_0xfc92('0x0'));var util=require(_0xfc92('0x1'));var moment=require('moment');var BPromise=require(_0xfc92('0x2'));var rs=require(_0xfc92('0x3'));var fs=require('fs');var Redis=require(_0xfc92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc92('0x5'));var logger=require(_0xfc92('0x6'))(_0xfc92('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc92('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x394026,_0x4e578a,_0xd80968){return new BPromise(function(_0x49db29,_0x432982){return client[_0xfc92('0x9')](_0x394026,_0xd80968)[_0xfc92('0xa')](function(_0x4f37f2){logger[_0xfc92('0xb')](_0xfc92('0xc'),_0x4e578a,_0xfc92('0xd'));logger['debug'](_0xfc92('0xe'),_0x4e578a,_0xfc92('0xd'),JSON[_0xfc92('0xf')](_0x4f37f2));if(_0x4f37f2[_0xfc92('0x10')]){if(_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x11')]===0x1f4){logger[_0xfc92('0x10')](_0xfc92('0xc'),_0x4e578a,_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x12')]);return _0x432982(_0x4f37f2[_0xfc92('0x10')][_0xfc92('0x12')]);}logger['error']('Integration,\x20%s,\x20%s',_0x4e578a,_0x4f37f2['error'][_0xfc92('0x12')]);return _0x49db29(_0x4f37f2[_0xfc92('0x10')]['message']);}else{logger[_0xfc92('0xb')](_0xfc92('0xc'),_0x4e578a,_0xfc92('0xd'));_0x49db29(_0x4f37f2[_0xfc92('0x13')][_0xfc92('0x12')]);}})[_0xfc92('0x14')](function(_0x492d40){logger[_0xfc92('0x10')](_0xfc92('0xc'),_0x4e578a,_0x492d40);_0x432982(_0x492d40);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 6a6812f..74a3219 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 _0xceb0=['describe','/:id','show','post','update','delete','exports','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x5cafed,_0x35f48c){var _0x8affd6=function(_0x46ca7d){while(--_0x46ca7d){_0x5cafed['push'](_0x5cafed['shift']());}};_0x8affd6(++_0x35f48c);}(_0xceb0,0x173));var _0x0ceb=function(_0x3fcd19,_0x50e7a7){_0x3fcd19=_0x3fcd19-0x0;var _0xce0008=_0xceb0[_0x3fcd19];return _0xce0008;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ceb('0x0'));var router=express['Router']();var auth=require(_0x0ceb('0x1'));var interaction=require(_0x0ceb('0x2'));var config=require(_0x0ceb('0x3'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x0ceb('0x4')](),controller[_0x0ceb('0x5')]);router[_0x0ceb('0x6')]('/describe',auth[_0x0ceb('0x4')](),controller[_0x0ceb('0x7')]);router['get'](_0x0ceb('0x8'),auth['isAuthenticated'](),controller[_0x0ceb('0x9')]);router[_0x0ceb('0xa')]('/',auth[_0x0ceb('0x4')](),controller['create']);router['put'](_0x0ceb('0x8'),auth[_0x0ceb('0x4')](),controller[_0x0ceb('0xb')]);router[_0x0ceb('0xc')](_0x0ceb('0x8'),auth[_0x0ceb('0x4')](),controller['destroy']);module[_0x0ceb('0xd')]=router; \ No newline at end of file +var _0xab2d=['index','get','/:id','show','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated'];(function(_0x4be6a6,_0x184f2a){var _0x12100f=function(_0xc19615){while(--_0xc19615){_0x4be6a6['push'](_0x4be6a6['shift']());}};_0x12100f(++_0x184f2a);}(_0xab2d,0x85));var _0xdab2=function(_0x4420f6,_0x6db66c){_0x4420f6=_0x4420f6-0x0;var _0x24665d=_0xab2d[_0x4420f6];return _0x24665d;};'use strict';var multer=require(_0xdab2('0x0'));var util=require(_0xdab2('0x1'));var path=require(_0xdab2('0x2'));var timeout=require(_0xdab2('0x3'));var express=require(_0xdab2('0x4'));var router=express[_0xdab2('0x5')]();var auth=require(_0xdab2('0x6'));var interaction=require(_0xdab2('0x7'));var config=require(_0xdab2('0x8'));var controller=require(_0xdab2('0x9'));router['get']('/',auth[_0xdab2('0xa')](),controller[_0xdab2('0xb')]);router[_0xdab2('0xc')]('/describe',auth[_0xdab2('0xa')](),controller['describe']);router[_0xdab2('0xc')](_0xdab2('0xd'),auth['isAuthenticated'](),controller[_0xdab2('0xe')]);router['post']('/',auth[_0xdab2('0xa')](),controller['create']);router[_0xdab2('0xf')]('/:id',auth[_0xdab2('0xa')](),controller['update']);router['delete'](_0xdab2('0xd'),auth[_0xdab2('0xa')](),controller[_0xdab2('0x10')]);module[_0xdab2('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index bb8a258..41cb446 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 _0x45c1=['TEXT','ENUM','SENT','RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x22e05f,_0x755c98){var _0x29231d=function(_0x5b63b1){while(--_0x5b63b1){_0x22e05f['push'](_0x22e05f['shift']());}};_0x29231d(++_0x755c98);}(_0x45c1,0x1a8));var _0x145c=function(_0x300bf8,_0x36051b){_0x300bf8=_0x300bf8-0x0;var _0x3fdfa7=_0x45c1[_0x300bf8];return _0x3fdfa7;};'use strict';var Sequelize=require(_0x145c('0x0'));module[_0x145c('0x1')]={'integration':{'type':Sequelize[_0x145c('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x145c('0x2')]},'ticketId':{'type':Sequelize[_0x145c('0x2')]},'integrationId':{'type':Sequelize[_0x145c('0x3')]},'contacts':{'type':Sequelize[_0x145c('0x2')]},'uniqueid':{'type':Sequelize[_0x145c('0x2')]},'calleridnum':{'type':Sequelize[_0x145c('0x2')]},'calleridname':{'type':Sequelize[_0x145c('0x2')]},'queue':{'type':Sequelize[_0x145c('0x2')]},'interface':{'type':Sequelize[_0x145c('0x2')]},'membername':{'type':Sequelize[_0x145c('0x2')]},'agentcalledAt':{'type':Sequelize[_0x145c('0x4')]},'agentconnectAt':{'type':Sequelize[_0x145c('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x145c('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x145c('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x145c('0x3')]},'reason':{'type':Sequelize[_0x145c('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x145c('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x145c('0x4')]},'agentdump':{'type':Sequelize[_0x145c('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x145c('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x145c('0x3')]},'channelstatedesc':{'type':Sequelize[_0x145c('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x145c('0x2')]},'language':{'type':Sequelize[_0x145c('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x145c('0x2')]},'exten':{'type':Sequelize[_0x145c('0x2')]},'priority':{'type':Sequelize[_0x145c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x145c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x145c('0x2')]},'destcalleridname':{'type':Sequelize[_0x145c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x145c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x145c('0x2')]},'destlanguage':{'type':Sequelize[_0x145c('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x145c('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x145c('0x2')]},'messageId':{'type':Sequelize[_0x145c('0x2')]},'inReplyTo':{'type':Sequelize[_0x145c('0x2')]},'subject':{'type':Sequelize[_0x145c('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x145c('0x2')]},'cc':{'type':Sequelize[_0x145c('0x2')]},'attachment':{'type':Sequelize[_0x145c('0x6')]},'html':{'type':Sequelize[_0x145c('0x6')]},'text':{'type':Sequelize[_0x145c('0x6')]},'status':{'type':Sequelize[_0x145c('0x7')](_0x145c('0x8'),'SENDING',_0x145c('0x9'),'FAILED')},'url':{'type':Sequelize[_0x145c('0x2')]},'app':{'type':Sequelize[_0x145c('0x2')]},'appdata':{'type':Sequelize[_0x145c('0x2')]},'projectId':{'type':Sequelize[_0x145c('0x3')]}}; \ No newline at end of file +var _0x817c=['RECEIVED','FAILED','STRING','BOOLEAN','INTEGER','DATE','TEXT','ENUM','SENT'];(function(_0x5db242,_0x5bbcf6){var _0x59b7ce=function(_0x10f84a){while(--_0x10f84a){_0x5db242['push'](_0x5db242['shift']());}};_0x59b7ce(++_0x5bbcf6);}(_0x817c,0xad));var _0xc817=function(_0x59d438,_0x49e538){_0x59d438=_0x59d438-0x0;var _0x4cde6b=_0x817c[_0x59d438];return _0x4cde6b;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xc817('0x0')]},'exitStatus':{'type':Sequelize[_0xc817('0x0')]},'ticketId':{'type':Sequelize[_0xc817('0x0')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xc817('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc817('0x0')]},'calleridname':{'type':Sequelize[_0xc817('0x0')]},'queue':{'type':Sequelize[_0xc817('0x0')]},'interface':{'type':Sequelize[_0xc817('0x0')]},'membername':{'type':Sequelize[_0xc817('0x0')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xc817('0x1')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc817('0x2')]},'reason':{'type':Sequelize[_0xc817('0x0')]},'agentringnoanswer':{'type':Sequelize[_0xc817('0x1')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc817('0x3')]},'agentdump':{'type':Sequelize[_0xc817('0x1')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xc817('0x0')]},'channel':{'type':Sequelize[_0xc817('0x0')]},'channelstate':{'type':Sequelize[_0xc817('0x2')]},'channelstatedesc':{'type':Sequelize[_0xc817('0x0')]},'connectedlinenum':{'type':Sequelize[_0xc817('0x0')]},'connectedlinename':{'type':Sequelize[_0xc817('0x0')]},'language':{'type':Sequelize[_0xc817('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc817('0x0')]},'exten':{'type':Sequelize[_0xc817('0x0')]},'priority':{'type':Sequelize[_0xc817('0x0')]},'destchannel':{'type':Sequelize[_0xc817('0x0')]},'destchannelstate':{'type':Sequelize[_0xc817('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xc817('0x0')]},'destcalleridnum':{'type':Sequelize[_0xc817('0x0')]},'destcalleridname':{'type':Sequelize[_0xc817('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0xc817('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xc817('0x0')]},'destlanguage':{'type':Sequelize[_0xc817('0x0')]},'destaccountcode':{'type':Sequelize[_0xc817('0x0')]},'destcontext':{'type':Sequelize[_0xc817('0x0')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xc817('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xc817('0x0')]},'subject':{'type':Sequelize[_0xc817('0x0')]},'from':{'type':Sequelize[_0xc817('0x0')]},'to':{'type':Sequelize[_0xc817('0x0')]},'cc':{'type':Sequelize[_0xc817('0x0')]},'attachment':{'type':Sequelize[_0xc817('0x4')]},'html':{'type':Sequelize[_0xc817('0x4')]},'text':{'type':Sequelize[_0xc817('0x4')]},'status':{'type':Sequelize[_0xc817('0x5')](_0xc817('0x6'),'SENDING',_0xc817('0x7'),_0xc817('0x8'))},'url':{'type':Sequelize[_0xc817('0x0')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xc817('0x0')]},'projectId':{'type':Sequelize[_0xc817('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index a4bf38b..7ae0307 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 _0xb8fb=['rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','IntegrationReport','count','then','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','Content-Range','reject','save','update','error','stack','name','send','map'];(function(_0x1c2b50,_0x1601ac){var _0x4eff41=function(_0x10d80d){while(--_0x10d80d){_0x1c2b50['push'](_0x1c2b50['shift']());}};_0x4eff41(++_0x1601ac);}(_0xb8fb,0x6f));var _0xbb8f=function(_0x55a156,_0x536bc8){_0x55a156=_0x55a156-0x0;var _0x52339c=_0xb8fb[_0x55a156];return _0x52339c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb8f('0x0'));var rimraf=require(_0xbb8f('0x1'));var zipdir=require(_0xbb8f('0x2'));var jsonpatch=require(_0xbb8f('0x3'));var rp=require(_0xbb8f('0x4'));var moment=require(_0xbb8f('0x5'));var BPromise=require(_0xbb8f('0x6'));var Mustache=require('mustache');var util=require(_0xbb8f('0x7'));var path=require(_0xbb8f('0x8'));var sox=require(_0xbb8f('0x9'));var csv=require(_0xbb8f('0xa'));var ejs=require(_0xbb8f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbb8f('0xc'));var crypto=require('crypto');var jsforce=require(_0xbb8f('0xd'));var deskjs=require(_0xbb8f('0xe'));var toCsv=require(_0xbb8f('0xa'));var querystring=require(_0xbb8f('0xf'));var Papa=require(_0xbb8f('0x10'));var Redis=require(_0xbb8f('0x11'));var authService=require(_0xbb8f('0x12'));var qs=require(_0xbb8f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb8f('0x14'));var logger=require(_0xbb8f('0x15'))('api');var utils=require(_0xbb8f('0x16'));var config=require(_0xbb8f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x509cfd,_0x3c354e){_0x3c354e=_0x3c354e||0xcc;return function(_0x2c64ab){if(_0x2c64ab){return _0x509cfd[_0xbb8f('0x18')](_0x3c354e);}return _0x509cfd['status'](_0x3c354e)[_0xbb8f('0x19')]();};}function respondWithResult(_0x768b16,_0x442b6c){_0x442b6c=_0x442b6c||0xc8;return function(_0x17708a){if(_0x17708a){return _0x768b16[_0xbb8f('0x1a')](_0x442b6c)[_0xbb8f('0x1b')](_0x17708a);}};}function respondWithFilteredResult(_0x46e307,_0xc94719){return function(_0x395b84){if(_0x395b84){var _0x22042b=_0x395b84['count'],_0x389917=_0xc94719[_0xbb8f('0x1c')],_0x4e6b5b=_0xc94719[_0xbb8f('0x1c')]+_0xc94719[_0xbb8f('0x1d')],_0x2ee127;if(_0x4e6b5b>=_0x22042b){_0x4e6b5b=_0x22042b;_0x2ee127=0xc8;}else{_0x2ee127=0xce;}_0x46e307['status'](_0x2ee127);return _0x46e307['set'](_0xbb8f('0x1e'),_0x389917+'-'+_0x4e6b5b+'/'+_0x22042b)[_0xbb8f('0x1b')](_0x395b84);}return null;};}function patchUpdates(_0x35bad3){return function(_0x22be72){try{jsonpatch['apply'](_0x22be72,_0x35bad3,!![]);}catch(_0xacd5e9){return BPromise[_0xbb8f('0x1f')](_0xacd5e9);}return _0x22be72[_0xbb8f('0x20')]();};}function saveUpdates(_0x349955,_0x58f3cb){return function(_0x34270e){if(_0x34270e){return _0x34270e[_0xbb8f('0x21')](_0x349955)['then'](function(_0x3a0494){return _0x3a0494;});}return null;};}function removeEntity(_0x1db4cb,_0x36b01f){return function(_0x29d789){if(_0x29d789){return _0x29d789['destroy']()['then'](function(){_0x1db4cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x237f69,_0x48e18c){return function(_0x1c8b4a){if(!_0x1c8b4a){_0x237f69[_0xbb8f('0x18')](0x194);}return _0x1c8b4a;};}function handleError(_0x27f7ec,_0x1260db){_0x1260db=_0x1260db||0x1f4;return function(_0x3f0b71){logger[_0xbb8f('0x22')](_0x3f0b71[_0xbb8f('0x23')]);if(_0x3f0b71[_0xbb8f('0x24')]){delete _0x3f0b71[_0xbb8f('0x24')];}_0x27f7ec[_0xbb8f('0x1a')](_0x1260db)[_0xbb8f('0x25')](_0x3f0b71);};}exports['index']=function(_0x340c45,_0x241cdc){var _0x1077b2={},_0x466561={},_0x589d22={'count':0x0,'rows':[]};var _0x429a52=_[_0xbb8f('0x26')](db['IntegrationReport'][_0xbb8f('0x27')],function(_0x4a33d1){return{'name':_0x4a33d1[_0xbb8f('0x28')],'type':_0x4a33d1[_0xbb8f('0x29')][_0xbb8f('0x2a')]};});_0x466561[_0xbb8f('0x2b')]=_[_0xbb8f('0x26')](_0x429a52,_0xbb8f('0x24'));_0x466561['query']=_[_0xbb8f('0x2c')](_0x340c45[_0xbb8f('0x2d')]);_0x466561['filters']=_[_0xbb8f('0x2e')](_0x466561['model'],_0x466561['query']);_0x1077b2[_0xbb8f('0x2f')]=_[_0xbb8f('0x2e')](_0x466561['model'],qs[_0xbb8f('0x30')](_0x340c45[_0xbb8f('0x2d')][_0xbb8f('0x30')]));_0x1077b2['attributes']=_0x1077b2[_0xbb8f('0x2f')][_0xbb8f('0x31')]?_0x1077b2['attributes']:_0x466561[_0xbb8f('0x2b')];if(!_0x340c45[_0xbb8f('0x2d')][_0xbb8f('0x32')](_0xbb8f('0x33'))){_0x1077b2[_0xbb8f('0x1d')]=qs['limit'](_0x340c45[_0xbb8f('0x2d')]['limit']);_0x1077b2[_0xbb8f('0x1c')]=qs[_0xbb8f('0x1c')](_0x340c45[_0xbb8f('0x2d')]['offset']);}_0x1077b2[_0xbb8f('0x34')]=qs[_0xbb8f('0x35')](_0x340c45[_0xbb8f('0x2d')][_0xbb8f('0x35')]);_0x1077b2[_0xbb8f('0x36')]=qs[_0xbb8f('0x37')](_[_0xbb8f('0x38')](_0x340c45[_0xbb8f('0x2d')],_0x466561[_0xbb8f('0x37')]),_0x429a52);if(_0x340c45[_0xbb8f('0x2d')][_0xbb8f('0x39')]){_0x1077b2['where']=_[_0xbb8f('0x3a')](_0x1077b2[_0xbb8f('0x36')],{'$or':_[_0xbb8f('0x26')](_0x429a52,function(_0x56d624){if(_0x56d624[_0xbb8f('0x29')]!==_0xbb8f('0x3b')){var _0x5281f4={};_0x5281f4[_0x56d624[_0xbb8f('0x24')]]={'$like':'%'+_0x340c45[_0xbb8f('0x2d')][_0xbb8f('0x39')]+'%'};return _0x5281f4;}})});}_0x1077b2=_[_0xbb8f('0x3a')]({},_0x1077b2,_0x340c45['options']);var _0x2be2a1={'where':_0x1077b2[_0xbb8f('0x36')]};return db[_0xbb8f('0x3c')][_0xbb8f('0x3d')](_0x2be2a1)[_0xbb8f('0x3e')](function(_0x27a359){_0x589d22['count']=_0x27a359;if(_0x340c45[_0xbb8f('0x2d')][_0xbb8f('0x3f')]){_0x1077b2[_0xbb8f('0x40')]=[{'all':!![]}];}return db[_0xbb8f('0x3c')][_0xbb8f('0x41')](_0x1077b2);})[_0xbb8f('0x3e')](function(_0x21b673){_0x589d22[_0xbb8f('0x42')]=_0x21b673;return _0x589d22;})['then'](respondWithFilteredResult(_0x241cdc,_0x1077b2))[_0xbb8f('0x43')](handleError(_0x241cdc,null));};exports[_0xbb8f('0x44')]=function(_0x3e0191,_0x25df89){var _0x572a04={'raw':![],'where':{'id':_0x3e0191['params']['id']}},_0x10e9bf={};_0x10e9bf[_0xbb8f('0x2b')]=_[_0xbb8f('0x2c')](db[_0xbb8f('0x3c')][_0xbb8f('0x27')]);_0x10e9bf[_0xbb8f('0x2d')]=_['keys'](_0x3e0191[_0xbb8f('0x2d')]);_0x10e9bf[_0xbb8f('0x37')]=_[_0xbb8f('0x2e')](_0x10e9bf[_0xbb8f('0x2b')],_0x10e9bf['query']);_0x572a04[_0xbb8f('0x2f')]=_['intersection'](_0x10e9bf[_0xbb8f('0x2b')],qs[_0xbb8f('0x30')](_0x3e0191[_0xbb8f('0x2d')][_0xbb8f('0x30')]));_0x572a04[_0xbb8f('0x2f')]=_0x572a04['attributes'][_0xbb8f('0x31')]?_0x572a04['attributes']:_0x10e9bf['model'];if(_0x3e0191[_0xbb8f('0x2d')][_0xbb8f('0x3f')]){_0x572a04['include']=[{'all':!![]}];}_0x572a04=_[_0xbb8f('0x3a')]({},_0x572a04,_0x3e0191[_0xbb8f('0x45')]);return db[_0xbb8f('0x3c')][_0xbb8f('0x46')](_0x572a04)['then'](handleEntityNotFound(_0x25df89,null))[_0xbb8f('0x3e')](respondWithResult(_0x25df89,null))[_0xbb8f('0x43')](handleError(_0x25df89,null));};exports[_0xbb8f('0x47')]=function(_0x52b8cf,_0x1ef76c){return db[_0xbb8f('0x3c')][_0xbb8f('0x47')](_0x52b8cf[_0xbb8f('0x48')],{})[_0xbb8f('0x3e')](respondWithResult(_0x1ef76c,0xc9))[_0xbb8f('0x43')](handleError(_0x1ef76c,null));};exports[_0xbb8f('0x21')]=function(_0x2d63a7,_0xee6d15){if(_0x2d63a7['body']['id']){delete _0x2d63a7[_0xbb8f('0x48')]['id'];}return db[_0xbb8f('0x3c')]['find']({'where':{'id':_0x2d63a7['params']['id']}})['then'](handleEntityNotFound(_0xee6d15,null))[_0xbb8f('0x3e')](saveUpdates(_0x2d63a7[_0xbb8f('0x48')],null))[_0xbb8f('0x3e')](respondWithResult(_0xee6d15,null))[_0xbb8f('0x43')](handleError(_0xee6d15,null));};exports['destroy']=function(_0x59f73a,_0x594101){return db['IntegrationReport'][_0xbb8f('0x46')]({'where':{'id':_0x59f73a[_0xbb8f('0x49')]['id']}})[_0xbb8f('0x3e')](handleEntityNotFound(_0x594101,null))[_0xbb8f('0x3e')](removeEntity(_0x594101,null))[_0xbb8f('0x43')](handleError(_0x594101,null));};exports[_0xbb8f('0x4a')]=function(_0x1dfa60,_0x46a5aa){return db[_0xbb8f('0x3c')][_0xbb8f('0x4a')]()[_0xbb8f('0x3e')](respondWithResult(_0x46a5aa,null))[_0xbb8f('0x43')](handleError(_0x46a5aa,null));}; \ No newline at end of file +var _0xe787=['keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','findAll','rows','params','rawAttributes','fields','include','catch','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','json','count','offset','set','Content-Range','reject','update','then','destroy','end','sendStatus','error','stack','index','map','IntegrationReport','fieldName','type','key','model','name'];(function(_0x1c7185,_0x5be047){var _0x437c83=function(_0x3e0121){while(--_0x3e0121){_0x1c7185['push'](_0x1c7185['shift']());}};_0x437c83(++_0x5be047);}(_0xe787,0x1ca));var _0x7e78=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xe787[_0x16b1a5];return _0x475e25;};'use strict';var pdf=require(_0x7e78('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7e78('0x1'));var zipdir=require(_0x7e78('0x2'));var jsonpatch=require(_0x7e78('0x3'));var rp=require(_0x7e78('0x4'));var moment=require('moment');var BPromise=require(_0x7e78('0x5'));var Mustache=require(_0x7e78('0x6'));var util=require(_0x7e78('0x7'));var path=require(_0x7e78('0x8'));var sox=require(_0x7e78('0x9'));var csv=require(_0x7e78('0xa'));var ejs=require(_0x7e78('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7e78('0xc'));var crypto=require('crypto');var jsforce=require(_0x7e78('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7e78('0xe'));var Papa=require(_0x7e78('0xf'));var Redis=require(_0x7e78('0x10'));var authService=require(_0x7e78('0x11'));var qs=require(_0x7e78('0x12'));var as=require(_0x7e78('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e78('0x14'))(_0x7e78('0x15'));var utils=require(_0x7e78('0x16'));var config=require('../../config/environment');var db=require(_0x7e78('0x17'))['db'];function respondWithStatusCode(_0x3d58a0,_0x316f7a){_0x316f7a=_0x316f7a||0xcc;return function(_0x5c4d00){if(_0x5c4d00){return _0x3d58a0['sendStatus'](_0x316f7a);}return _0x3d58a0['status'](_0x316f7a)['end']();};}function respondWithResult(_0x1e753a,_0x30b1e2){_0x30b1e2=_0x30b1e2||0xc8;return function(_0x552ba6){if(_0x552ba6){return _0x1e753a[_0x7e78('0x18')](_0x30b1e2)[_0x7e78('0x19')](_0x552ba6);}};}function respondWithFilteredResult(_0x460c85,_0x441aaa){return function(_0x193dd5){if(_0x193dd5){var _0x543abd=_0x193dd5[_0x7e78('0x1a')],_0x4d20f3=_0x441aaa[_0x7e78('0x1b')],_0x4f25fd=_0x441aaa['offset']+_0x441aaa['limit'],_0x791e60;if(_0x4f25fd>=_0x543abd){_0x4f25fd=_0x543abd;_0x791e60=0xc8;}else{_0x791e60=0xce;}_0x460c85[_0x7e78('0x18')](_0x791e60);return _0x460c85[_0x7e78('0x1c')](_0x7e78('0x1d'),_0x4d20f3+'-'+_0x4f25fd+'/'+_0x543abd)['json'](_0x193dd5);}return null;};}function patchUpdates(_0x4cf77d){return function(_0x1700eb){try{jsonpatch['apply'](_0x1700eb,_0x4cf77d,!![]);}catch(_0x5f2e70){return BPromise[_0x7e78('0x1e')](_0x5f2e70);}return _0x1700eb['save']();};}function saveUpdates(_0x5d5f46,_0x360537){return function(_0x4c25e9){if(_0x4c25e9){return _0x4c25e9[_0x7e78('0x1f')](_0x5d5f46)[_0x7e78('0x20')](function(_0x512635){return _0x512635;});}return null;};}function removeEntity(_0x25d851,_0x38067a){return function(_0x479d00){if(_0x479d00){return _0x479d00[_0x7e78('0x21')]()[_0x7e78('0x20')](function(){_0x25d851['status'](0xcc)[_0x7e78('0x22')]();});}};}function handleEntityNotFound(_0x506b41,_0x1c2e95){return function(_0x29ed9d){if(!_0x29ed9d){_0x506b41[_0x7e78('0x23')](0x194);}return _0x29ed9d;};}function handleError(_0x1f3f7a,_0x4a721b){_0x4a721b=_0x4a721b||0x1f4;return function(_0xc09936){logger[_0x7e78('0x24')](_0xc09936[_0x7e78('0x25')]);if(_0xc09936['name']){delete _0xc09936['name'];}_0x1f3f7a[_0x7e78('0x18')](_0x4a721b)['send'](_0xc09936);};}exports[_0x7e78('0x26')]=function(_0x2096fe,_0x582ae0){var _0x345897={},_0x16b4a0={},_0x118f2e={'count':0x0,'rows':[]};var _0x435aad=_[_0x7e78('0x27')](db[_0x7e78('0x28')]['rawAttributes'],function(_0x1e8a47){return{'name':_0x1e8a47[_0x7e78('0x29')],'type':_0x1e8a47[_0x7e78('0x2a')][_0x7e78('0x2b')]};});_0x16b4a0[_0x7e78('0x2c')]=_['map'](_0x435aad,_0x7e78('0x2d'));_0x16b4a0['query']=_[_0x7e78('0x2e')](_0x2096fe[_0x7e78('0x2f')]);_0x16b4a0[_0x7e78('0x30')]=_[_0x7e78('0x31')](_0x16b4a0[_0x7e78('0x2c')],_0x16b4a0[_0x7e78('0x2f')]);_0x345897[_0x7e78('0x32')]=_[_0x7e78('0x31')](_0x16b4a0[_0x7e78('0x2c')],qs['fields'](_0x2096fe[_0x7e78('0x2f')]['fields']));_0x345897[_0x7e78('0x32')]=_0x345897[_0x7e78('0x32')][_0x7e78('0x33')]?_0x345897['attributes']:_0x16b4a0[_0x7e78('0x2c')];if(!_0x2096fe[_0x7e78('0x2f')][_0x7e78('0x34')](_0x7e78('0x35'))){_0x345897[_0x7e78('0x36')]=qs['limit'](_0x2096fe[_0x7e78('0x2f')][_0x7e78('0x36')]);_0x345897[_0x7e78('0x1b')]=qs['offset'](_0x2096fe['query']['offset']);}_0x345897[_0x7e78('0x37')]=qs[_0x7e78('0x38')](_0x2096fe[_0x7e78('0x2f')]['sort']);_0x345897[_0x7e78('0x39')]=qs[_0x7e78('0x30')](_['pick'](_0x2096fe[_0x7e78('0x2f')],_0x16b4a0[_0x7e78('0x30')]),_0x435aad);if(_0x2096fe[_0x7e78('0x2f')][_0x7e78('0x3a')]){_0x345897[_0x7e78('0x39')]=_[_0x7e78('0x3b')](_0x345897[_0x7e78('0x39')],{'$or':_['map'](_0x435aad,function(_0xbb0d1){if(_0xbb0d1[_0x7e78('0x2a')]!=='VIRTUAL'){var _0x31ff0a={};_0x31ff0a[_0xbb0d1[_0x7e78('0x2d')]]={'$like':'%'+_0x2096fe[_0x7e78('0x2f')][_0x7e78('0x3a')]+'%'};return _0x31ff0a;}})});}_0x345897=_[_0x7e78('0x3b')]({},_0x345897,_0x2096fe[_0x7e78('0x3c')]);var _0x2922ff={'where':_0x345897['where']};return db[_0x7e78('0x28')][_0x7e78('0x1a')](_0x2922ff)['then'](function(_0x1dfcc7){_0x118f2e[_0x7e78('0x1a')]=_0x1dfcc7;if(_0x2096fe[_0x7e78('0x2f')]['includeAll']){_0x345897['include']=[{'all':!![]}];}return db[_0x7e78('0x28')][_0x7e78('0x3d')](_0x345897);})[_0x7e78('0x20')](function(_0x9403d0){_0x118f2e[_0x7e78('0x3e')]=_0x9403d0;return _0x118f2e;})[_0x7e78('0x20')](respondWithFilteredResult(_0x582ae0,_0x345897))['catch'](handleError(_0x582ae0,null));};exports['show']=function(_0x2f912a,_0x38231e){var _0x20acdb={'raw':![],'where':{'id':_0x2f912a[_0x7e78('0x3f')]['id']}},_0x2176f0={};_0x2176f0[_0x7e78('0x2c')]=_[_0x7e78('0x2e')](db[_0x7e78('0x28')][_0x7e78('0x40')]);_0x2176f0[_0x7e78('0x2f')]=_[_0x7e78('0x2e')](_0x2f912a['query']);_0x2176f0[_0x7e78('0x30')]=_[_0x7e78('0x31')](_0x2176f0[_0x7e78('0x2c')],_0x2176f0[_0x7e78('0x2f')]);_0x20acdb[_0x7e78('0x32')]=_[_0x7e78('0x31')](_0x2176f0[_0x7e78('0x2c')],qs[_0x7e78('0x41')](_0x2f912a[_0x7e78('0x2f')]['fields']));_0x20acdb[_0x7e78('0x32')]=_0x20acdb[_0x7e78('0x32')]['length']?_0x20acdb['attributes']:_0x2176f0[_0x7e78('0x2c')];if(_0x2f912a[_0x7e78('0x2f')]['includeAll']){_0x20acdb[_0x7e78('0x42')]=[{'all':!![]}];}_0x20acdb=_[_0x7e78('0x3b')]({},_0x20acdb,_0x2f912a['options']);return db[_0x7e78('0x28')]['find'](_0x20acdb)['then'](handleEntityNotFound(_0x38231e,null))[_0x7e78('0x20')](respondWithResult(_0x38231e,null))[_0x7e78('0x43')](handleError(_0x38231e,null));};exports[_0x7e78('0x44')]=function(_0x1654d6,_0x49f3f1){return db[_0x7e78('0x28')]['create'](_0x1654d6[_0x7e78('0x45')],{})['then'](respondWithResult(_0x49f3f1,0xc9))[_0x7e78('0x43')](handleError(_0x49f3f1,null));};exports[_0x7e78('0x1f')]=function(_0x441085,_0x4e05a9){if(_0x441085['body']['id']){delete _0x441085[_0x7e78('0x45')]['id'];}return db[_0x7e78('0x28')]['find']({'where':{'id':_0x441085[_0x7e78('0x3f')]['id']}})[_0x7e78('0x20')](handleEntityNotFound(_0x4e05a9,null))['then'](saveUpdates(_0x441085[_0x7e78('0x45')],null))[_0x7e78('0x20')](respondWithResult(_0x4e05a9,null))[_0x7e78('0x43')](handleError(_0x4e05a9,null));};exports[_0x7e78('0x21')]=function(_0xa5d63c,_0x871c29){return db[_0x7e78('0x28')][_0x7e78('0x46')]({'where':{'id':_0xa5d63c[_0x7e78('0x3f')]['id']}})[_0x7e78('0x20')](handleEntityNotFound(_0x871c29,null))['then'](removeEntity(_0x871c29,null))[_0x7e78('0x43')](handleError(_0x871c29,null));};exports[_0x7e78('0x47')]=function(_0x5e84b5,_0x417bd9){return db[_0x7e78('0x28')][_0x7e78('0x47')]()[_0x7e78('0x20')](respondWithResult(_0x417bd9,null))[_0x7e78('0x43')](handleError(_0x417bd9,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 682bd8f..b56fa4e 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 _0x9614=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./integrationReport.attributes','define','IntegrationReport','report_integration'];(function(_0x27aa01,_0x28e0cc){var _0x50d6fa=function(_0x3bdd11){while(--_0x3bdd11){_0x27aa01['push'](_0x27aa01['shift']());}};_0x50d6fa(++_0x28e0cc);}(_0x9614,0x84));var _0x4961=function(_0x47a491,_0x45e171){_0x47a491=_0x47a491-0x0;var _0x3b176b=_0x9614[_0x47a491];return _0x3b176b;};'use strict';var _=require(_0x4961('0x0'));var util=require('util');var logger=require(_0x4961('0x1'))(_0x4961('0x2'));var moment=require(_0x4961('0x3'));var BPromise=require(_0x4961('0x4'));var rp=require(_0x4961('0x5'));var fs=require('fs');var path=require(_0x4961('0x6'));var rimraf=require(_0x4961('0x7'));var config=require('../../config/environment');var attributes=require(_0x4961('0x8'));module['exports']=function(_0x27f2a0,_0x2746c0){return _0x27f2a0[_0x4961('0x9')](_0x4961('0xa'),attributes,{'tableName':_0x4961('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e81=['exports','define','IntegrationReport','report_integration','util','api','moment','request-promise','path','rimraf','./integrationReport.attributes'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5e81,0x117));var _0x15e8=function(_0x51bd76,_0x25183c){_0x51bd76=_0x51bd76-0x0;var _0x5c1410=_0x5e81[_0x51bd76];return _0x5c1410;};'use strict';var _=require('lodash');var util=require(_0x15e8('0x0'));var logger=require('../../config/logger')(_0x15e8('0x1'));var moment=require(_0x15e8('0x2'));var BPromise=require('bluebird');var rp=require(_0x15e8('0x3'));var fs=require('fs');var path=require(_0x15e8('0x4'));var rimraf=require(_0x15e8('0x5'));var config=require('../../config/environment');var attributes=require(_0x15e8('0x6'));module[_0x15e8('0x7')]=function(_0x494771,_0x206f06){return _0x494771[_0x15e8('0x8')](_0x15e8('0x9'),attributes,{'tableName':_0x15e8('0xa'),'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 706f7e6..b9eb7b3 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 _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x588381,_0x2b030e){var _0x53e245=function(_0x368a8f){while(--_0x368a8f){_0x588381['push'](_0x588381['shift']());}};_0x53e245(++_0x2b030e);}(_0xb10b,0x12a));var _0xbb10=function(_0xc01d2,_0x29f146){_0xc01d2=_0xc01d2-0x0;var _0x17f297=_0xb10b[_0xc01d2];return _0x17f297;};'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 _0x5eb8=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x57aae3,_0x36d9c4){var _0x7ff01d=function(_0x14ed09){while(--_0x14ed09){_0x57aae3['push'](_0x57aae3['shift']());}};_0x7ff01d(++_0x36d9c4);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3011b7,_0x56b4b0){_0x3011b7=_0x3011b7-0x0;var _0x304ca2=_0x5eb8[_0x3011b7];return _0x304ca2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4678072..50a9c48 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x55ca,0x126));var _0xa55c=function(_0x5c1449,_0x2af4b4){_0x5c1449=_0x5c1449-0x0;var _0x270473=_0x55ca[_0x5c1449];return _0x270473;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0xa2485c,_0x12158b){var _0x313b49=function(_0x195618){while(--_0x195618){_0xa2485c['push'](_0xa2485c['shift']());}};_0x313b49(++_0x12158b);}(_0x3e74,0x175));var _0x43e7=function(_0x5cfee1,_0x2ac23c){_0x5cfee1=_0x5cfee1-0x0;var _0x34d945=_0x3e74[_0x5cfee1];return _0x34d945;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index fb830e0..57e3156 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 _0x71c6=['exports','STRING','sequelize'];(function(_0x1f9b5e,_0x25e84b){var _0x4b3295=function(_0x1b7d79){while(--_0x1b7d79){_0x1f9b5e['push'](_0x1f9b5e['shift']());}};_0x4b3295(++_0x25e84b);}(_0x71c6,0x1c4));var _0x671c=function(_0xcfc461,_0x5227e4){_0xcfc461=_0xcfc461-0x0;var _0x1f9038=_0x71c6[_0xcfc461];return _0x1f9038;};'use strict';var Sequelize=require(_0x671c('0x0'));module[_0x671c('0x1')]={'name':{'type':Sequelize[_0x671c('0x2')]},'description':{'type':Sequelize[_0x671c('0x2')]},'interval':{'type':Sequelize[_0x671c('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2c13=['exports','STRING','sequelize'];(function(_0x18b477,_0x555d04){var _0x240b92=function(_0x343b06){while(--_0x343b06){_0x18b477['push'](_0x18b477['shift']());}};_0x240b92(++_0x555d04);}(_0x2c13,0x125));var _0x32c1=function(_0x325448,_0x41fd75){_0x325448=_0x325448-0x0;var _0x3dd9df=_0x2c13[_0x325448];return _0x3dd9df;};'use strict';var Sequelize=require(_0x32c1('0x0'));module[_0x32c1('0x1')]={'name':{'type':Sequelize[_0x32c1('0x2')]},'description':{'type':Sequelize[_0x32c1('0x2')]},'interval':{'type':Sequelize[_0x32c1('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 5f9d0cf..298db59 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 _0x99b8=['findAll','rows','catch','show','params','keys','create','body','user','role','get','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','findOne','order','addIntervals','transaction','bulkCreate','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Intervals','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Interval','includeAll','include'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x99b8,0x17a));var _0x899b=function(_0x5f4b10,_0xc0167e){_0x5f4b10=_0x5f4b10-0x0;var _0x537828=_0x99b8[_0x5f4b10];return _0x537828;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x899b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x899b('0x1'));var rp=require('request-promise');var moment=require(_0x899b('0x2'));var BPromise=require(_0x899b('0x3'));var Mustache=require(_0x899b('0x4'));var util=require(_0x899b('0x5'));var path=require(_0x899b('0x6'));var sox=require('sox');var csv=require(_0x899b('0x7'));var ejs=require(_0x899b('0x8'));var fs=require('fs');var _=require(_0x899b('0x9'));var squel=require(_0x899b('0xa'));var crypto=require(_0x899b('0xb'));var jsforce=require(_0x899b('0xc'));var deskjs=require(_0x899b('0xd'));var toCsv=require(_0x899b('0x7'));var querystring=require(_0x899b('0xe'));var Papa=require(_0x899b('0xf'));var Redis=require(_0x899b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x899b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x899b('0x12'));var logger=require('../../config/logger')(_0x899b('0x13'));var utils=require(_0x899b('0x14'));var config=require(_0x899b('0x15'));var db=require(_0x899b('0x16'))['db'];var extensions=require(_0x899b('0x17'));function respondWithStatusCode(_0x28f5c9,_0xcef35a){_0xcef35a=_0xcef35a||0xcc;return function(_0x2f6bdb){if(_0x2f6bdb){return _0x28f5c9[_0x899b('0x18')](_0xcef35a);}return _0x28f5c9['status'](_0xcef35a)[_0x899b('0x19')]();};}function respondWithResult(_0x17a3b9,_0x1121da){_0x1121da=_0x1121da||0xc8;return function(_0x508878){if(_0x508878){return _0x17a3b9[_0x899b('0x1a')](_0x1121da)[_0x899b('0x1b')](_0x508878);}};}function respondWithFilteredResult(_0x52dac1,_0x28aa33){return function(_0x3559d5){if(_0x3559d5){var _0x4eebd9=_0x3559d5[_0x899b('0x1c')],_0x49bb76=_0x28aa33[_0x899b('0x1d')],_0x72e3aa=_0x28aa33[_0x899b('0x1d')]+_0x28aa33[_0x899b('0x1e')],_0x1ba5a4;if(_0x72e3aa>=_0x4eebd9){_0x72e3aa=_0x4eebd9;_0x1ba5a4=0xc8;}else{_0x1ba5a4=0xce;}_0x52dac1['status'](_0x1ba5a4);return _0x52dac1[_0x899b('0x1f')](_0x899b('0x20'),_0x49bb76+'-'+_0x72e3aa+'/'+_0x4eebd9)[_0x899b('0x1b')](_0x3559d5);}return null;};}function patchUpdates(_0x5bf1f8){return function(_0x174daa){try{jsonpatch[_0x899b('0x21')](_0x174daa,_0x5bf1f8,!![]);}catch(_0x54dfbd){return BPromise[_0x899b('0x22')](_0x54dfbd);}return _0x174daa[_0x899b('0x23')]();};}function saveUpdates(_0xbe16e8,_0x569180){return function(_0x449692){if(_0x449692){return _0x449692[_0x899b('0x24')](_0xbe16e8)[_0x899b('0x25')](function(_0x259320){return _0x259320;});}return null;};}function removeEntity(_0x181a38,_0x2dfbc4){return function(_0x451d27){if(_0x451d27){return _0x451d27[_0x899b('0x26')]()[_0x899b('0x25')](function(){var _0x248bcc=_0x451d27['get']({'plain':!![]});var _0x4bf0ce=_0x899b('0x27');return db['UserProfileResource'][_0x899b('0x26')]({'where':{'type':_0x4bf0ce,'resourceId':_0x248bcc['id']}})[_0x899b('0x25')](function(){return _0x451d27;});})[_0x899b('0x25')](function(){_0x181a38['status'](0xcc)[_0x899b('0x19')]();});}};}function handleEntityNotFound(_0x29b203,_0x1188d2){return function(_0x25b2b3){if(!_0x25b2b3){_0x29b203[_0x899b('0x18')](0x194);}return _0x25b2b3;};}function handleError(_0x3d064c,_0x26016c){_0x26016c=_0x26016c||0x1f4;return function(_0x2edda8){logger[_0x899b('0x28')](_0x2edda8[_0x899b('0x29')]);if(_0x2edda8[_0x899b('0x2a')]){delete _0x2edda8['name'];}_0x3d064c['status'](_0x26016c)['send'](_0x2edda8);};}exports['index']=function(_0x2ad619,_0x4e22e9){var _0x4a8961={},_0x3db035={},_0x3ea219={'count':0x0,'rows':[]};var _0x42706b=_[_0x899b('0x2b')](db['Interval'][_0x899b('0x2c')],function(_0x403f3e){return{'name':_0x403f3e[_0x899b('0x2d')],'type':_0x403f3e[_0x899b('0x2e')][_0x899b('0x2f')]};});_0x3db035[_0x899b('0x30')]=_[_0x899b('0x2b')](_0x42706b,_0x899b('0x2a'));_0x3db035[_0x899b('0x31')]=_['keys'](_0x2ad619[_0x899b('0x31')]);_0x3db035[_0x899b('0x32')]=_[_0x899b('0x33')](_0x3db035[_0x899b('0x30')],_0x3db035['query']);_0x4a8961[_0x899b('0x34')]=_[_0x899b('0x33')](_0x3db035[_0x899b('0x30')],qs[_0x899b('0x35')](_0x2ad619['query'][_0x899b('0x35')]));_0x4a8961[_0x899b('0x34')]=_0x4a8961[_0x899b('0x34')][_0x899b('0x36')]?_0x4a8961['attributes']:_0x3db035[_0x899b('0x30')];if(!_0x2ad619[_0x899b('0x31')][_0x899b('0x37')](_0x899b('0x38'))){_0x4a8961[_0x899b('0x1e')]=qs['limit'](_0x2ad619['query'][_0x899b('0x1e')]);_0x4a8961['offset']=qs['offset'](_0x2ad619['query']['offset']);}_0x4a8961['order']=qs[_0x899b('0x39')](_0x2ad619[_0x899b('0x31')]['sort']);_0x4a8961['where']=qs['filters'](_[_0x899b('0x3a')](_0x2ad619['query'],_0x3db035[_0x899b('0x32')]),_0x42706b);if(_0x2ad619[_0x899b('0x31')][_0x899b('0x3b')]){_0x4a8961[_0x899b('0x3c')]=_[_0x899b('0x3d')](_0x4a8961['where'],{'$or':_[_0x899b('0x2b')](_0x42706b,function(_0x579e9b){if(_0x579e9b[_0x899b('0x2e')]!==_0x899b('0x3e')){var _0x222669={};_0x222669[_0x579e9b[_0x899b('0x2a')]]={'$like':'%'+_0x2ad619['query']['filter']+'%'};return _0x222669;}})});}_0x4a8961=_['merge']({},_0x4a8961,_0x2ad619[_0x899b('0x3f')]);var _0x33e072={'where':_0x4a8961[_0x899b('0x3c')]};return db[_0x899b('0x40')]['count'](_0x33e072)[_0x899b('0x25')](function(_0x4f1e15){_0x3ea219[_0x899b('0x1c')]=_0x4f1e15;if(_0x2ad619[_0x899b('0x31')][_0x899b('0x41')]){_0x4a8961[_0x899b('0x42')]=[{'all':!![]}];}return db[_0x899b('0x40')][_0x899b('0x43')](_0x4a8961);})[_0x899b('0x25')](function(_0x177845){_0x3ea219[_0x899b('0x44')]=_0x177845;return _0x3ea219;})[_0x899b('0x25')](respondWithFilteredResult(_0x4e22e9,_0x4a8961))[_0x899b('0x45')](handleError(_0x4e22e9,null));};exports[_0x899b('0x46')]=function(_0x19b25a,_0x396255){var _0x55de39={'raw':!![],'where':{'id':_0x19b25a[_0x899b('0x47')]['id']}},_0x5ae5ba={};_0x5ae5ba['model']=_[_0x899b('0x48')](db[_0x899b('0x40')]['rawAttributes']);_0x5ae5ba[_0x899b('0x31')]=_[_0x899b('0x48')](_0x19b25a[_0x899b('0x31')]);_0x5ae5ba[_0x899b('0x32')]=_[_0x899b('0x33')](_0x5ae5ba[_0x899b('0x30')],_0x5ae5ba['query']);_0x55de39[_0x899b('0x34')]=_[_0x899b('0x33')](_0x5ae5ba['model'],qs['fields'](_0x19b25a[_0x899b('0x31')]['fields']));_0x55de39[_0x899b('0x34')]=_0x55de39[_0x899b('0x34')][_0x899b('0x36')]?_0x55de39[_0x899b('0x34')]:_0x5ae5ba[_0x899b('0x30')];if(_0x19b25a[_0x899b('0x31')][_0x899b('0x41')]){_0x55de39['include']=[{'all':!![]}];}_0x55de39=_[_0x899b('0x3d')]({},_0x55de39,_0x19b25a['options']);return db[_0x899b('0x40')]['find'](_0x55de39)[_0x899b('0x25')](handleEntityNotFound(_0x396255,null))[_0x899b('0x25')](respondWithResult(_0x396255,null))[_0x899b('0x45')](handleError(_0x396255,null));};exports[_0x899b('0x49')]=function(_0xa8077f,_0x22889b){return db['Interval']['create'](_0xa8077f[_0x899b('0x4a')],{})['then'](function(_0x352f6d){var _0x5ddbd8=_0xa8077f[_0x899b('0x4b')]['get']({'plain':!![]});if(!_0x5ddbd8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ddbd8[_0x899b('0x4c')]===_0x899b('0x4b')){var _0x4f5d26=_0x352f6d[_0x899b('0x4d')]({'plain':!![]});var _0x352eaa=_0x899b('0x27');return db['UserProfileSection'][_0x899b('0x4e')]({'where':{'name':_0x352eaa,'userProfileId':_0x5ddbd8['userProfileId']},'raw':!![]})[_0x899b('0x25')](function(_0x5544db){if(_0x5544db&&_0x5544db[_0x899b('0x4f')]===0x0){return db[_0x899b('0x50')]['create']({'name':_0x4f5d26[_0x899b('0x2a')],'resourceId':_0x4f5d26['id'],'type':_0x5544db[_0x899b('0x2a')],'sectionId':_0x5544db['id']},{})[_0x899b('0x25')](function(){return _0x352f6d;});}else{return _0x352f6d;}})[_0x899b('0x45')](function(_0x47b263){logger[_0x899b('0x28')](_0x899b('0x51'),_0x47b263);throw _0x47b263;});}return _0x352f6d;})['then'](respondWithResult(_0x22889b,0xc9))[_0x899b('0x45')](handleError(_0x22889b,null));};exports[_0x899b('0x24')]=function(_0x6e586a,_0x342fe0){if(_0x6e586a[_0x899b('0x4a')]['id']){delete _0x6e586a['body']['id'];}return db[_0x899b('0x40')][_0x899b('0x4e')]({'where':{'id':_0x6e586a['params']['id']}})[_0x899b('0x25')](handleEntityNotFound(_0x342fe0,null))[_0x899b('0x25')](saveUpdates(_0x6e586a['body'],null))[_0x899b('0x25')](respondWithResult(_0x342fe0,null))[_0x899b('0x45')](handleError(_0x342fe0,null));};exports[_0x899b('0x26')]=function(_0x2d1290,_0x52f8f9){return db[_0x899b('0x40')][_0x899b('0x4e')]({'where':{'id':_0x2d1290[_0x899b('0x47')]['id']}})['then'](handleEntityNotFound(_0x52f8f9,null))[_0x899b('0x25')](removeEntity(_0x52f8f9,null))[_0x899b('0x45')](handleError(_0x52f8f9,null));};exports['addInterval']=function(_0x464246,_0x2d4e07,_0x3ae986){if(_0x464246[_0x899b('0x4a')]['id']){delete _0x464246[_0x899b('0x4a')]['id'];}return db[_0x899b('0x40')][_0x899b('0x4e')]({'where':{'id':_0x464246[_0x899b('0x47')]['id']}})[_0x899b('0x25')](handleEntityNotFound(_0x2d4e07,null))[_0x899b('0x25')](function(_0x2861b6){if(_0x2861b6){_0x464246[_0x899b('0x4a')][_0x899b('0x52')]=_0x2861b6['id'];return db[_0x899b('0x40')][_0x899b('0x49')](_0x464246[_0x899b('0x4a')]);}})['then'](respondWithResult(_0x2d4e07,null))[_0x899b('0x45')](handleError(_0x2d4e07,null));};exports[_0x899b('0x53')]=function(_0x5c0dff,_0x5921e3,_0x9eb141){var _0x3630de={};var _0x33a6ab={};var _0x3971d5;var _0x1170dc;return db[_0x899b('0x40')][_0x899b('0x54')]({'where':{'id':_0x5c0dff[_0x899b('0x47')]['id']}})[_0x899b('0x25')](handleEntityNotFound(_0x5921e3,null))[_0x899b('0x25')](function(_0x188863){if(_0x188863){_0x3971d5=_0x188863;_0x33a6ab[_0x899b('0x30')]=_[_0x899b('0x48')](db[_0x899b('0x40')]['rawAttributes']);_0x33a6ab[_0x899b('0x31')]=_['keys'](_0x5c0dff[_0x899b('0x31')]);_0x33a6ab['filters']=_['intersection'](_0x33a6ab[_0x899b('0x30')],_0x33a6ab[_0x899b('0x31')]);_0x3630de[_0x899b('0x34')]=_[_0x899b('0x33')](_0x33a6ab[_0x899b('0x30')],qs[_0x899b('0x35')](_0x5c0dff['query'][_0x899b('0x35')]));_0x3630de[_0x899b('0x34')]=_0x3630de[_0x899b('0x34')][_0x899b('0x36')]?_0x3630de[_0x899b('0x34')]:_0x33a6ab[_0x899b('0x30')];_0x3630de[_0x899b('0x55')]=qs[_0x899b('0x39')](_0x5c0dff[_0x899b('0x31')][_0x899b('0x39')]);_0x3630de[_0x899b('0x3c')]=qs[_0x899b('0x32')](_[_0x899b('0x3a')](_0x5c0dff['query'],_0x33a6ab['filters']));if(_0x5c0dff[_0x899b('0x31')][_0x899b('0x3b')]){_0x3630de['where']=_[_0x899b('0x3d')](_0x3630de[_0x899b('0x3c')],{'$or':_[_0x899b('0x2b')](_0x3630de[_0x899b('0x34')],function(_0x469ec7){var _0x14346c={};_0x14346c[_0x469ec7]={'$like':'%'+_0x5c0dff[_0x899b('0x31')][_0x899b('0x3b')]+'%'};return _0x14346c;})});}_0x3630de=_['merge']({},_0x3630de,_0x5c0dff[_0x899b('0x3f')]);return _0x3971d5['getIntervals'](_0x3630de);}})[_0x899b('0x25')](function(_0x1c9a0b){if(_0x1c9a0b){_0x1170dc=_0x1c9a0b[_0x899b('0x36')];if(!_0x5c0dff['query']['hasOwnProperty'](_0x899b('0x38'))){_0x3630de[_0x899b('0x1e')]=qs[_0x899b('0x1e')](_0x5c0dff[_0x899b('0x31')]['limit']);_0x3630de[_0x899b('0x1d')]=qs[_0x899b('0x1d')](_0x5c0dff[_0x899b('0x31')][_0x899b('0x1d')]);}return _0x3971d5[_0x899b('0x53')](_0x3630de);}})[_0x899b('0x25')](function(_0x579eb7){if(_0x579eb7){return _0x579eb7?{'count':_0x1170dc,'rows':_0x579eb7}:null;}})[_0x899b('0x25')](respondWithResult(_0x5921e3,null))[_0x899b('0x45')](handleError(_0x5921e3,null));};exports[_0x899b('0x56')]=function(_0x15a48d,_0x369a42,_0x165ffc){return db[_0x899b('0x40')][_0x899b('0x54')]({'where':{'id':_0x15a48d[_0x899b('0x47')]['id']}})[_0x899b('0x25')](handleEntityNotFound(_0x369a42,null))[_0x899b('0x25')](function(_0x7cda0e){if(_0x7cda0e){return db['sequelize'][_0x899b('0x57')](function(_0x2e3512){return db[_0x899b('0x40')][_0x899b('0x26')]({'where':{'IntervalId':_0x15a48d[_0x899b('0x47')]['id']},'transaction':_0x2e3512})['then'](function(_0x19634e){var _0x174ccf=_['map'](_0x15a48d[_0x899b('0x4a')],function(_0x368146){delete _0x368146['id'];_0x368146[_0x899b('0x52')]=_0x15a48d[_0x899b('0x47')]['id'];return _0x368146;});return db[_0x899b('0x40')][_0x899b('0x58')](_0x174ccf,{'transaction':_0x2e3512});});})['then'](function(){return db[_0x899b('0x40')][_0x899b('0x43')]({'where':{'IntervalId':_0x15a48d['params']['id']}});});}})[_0x899b('0x25')](respondWithResult(_0x369a42,null))['catch'](handleError(_0x369a42,null));}; \ No newline at end of file +var _0x3d6c=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','role','Intervals','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addInterval','getIntervals','findOne','addIntervals','sequelize','IntervalId','bulkCreate','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','stack','name','send','index','map','Interval','rawAttributes','type','model','query','keys','filters','intersection','attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3d6c,0x1eb));var _0xc3d6=function(_0x467aea,_0x12b5fb){_0x467aea=_0x467aea-0x0;var _0x3d526c=_0x3d6c[_0x467aea];return _0x3d526c;};'use strict';var pdf=require(_0xc3d6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc3d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc3d6('0x2'));var moment=require(_0xc3d6('0x3'));var BPromise=require(_0xc3d6('0x4'));var Mustache=require(_0xc3d6('0x5'));var util=require(_0xc3d6('0x6'));var path=require('path');var sox=require(_0xc3d6('0x7'));var csv=require(_0xc3d6('0x8'));var ejs=require(_0xc3d6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc3d6('0xa'));var crypto=require(_0xc3d6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc3d6('0xc'));var toCsv=require(_0xc3d6('0x8'));var querystring=require(_0xc3d6('0xd'));var Papa=require(_0xc3d6('0xe'));var Redis=require(_0xc3d6('0xf'));var authService=require(_0xc3d6('0x10'));var qs=require(_0xc3d6('0x11'));var as=require(_0xc3d6('0x12'));var hardwareService=require(_0xc3d6('0x13'));var logger=require(_0xc3d6('0x14'))(_0xc3d6('0x15'));var utils=require(_0xc3d6('0x16'));var config=require(_0xc3d6('0x17'));var db=require(_0xc3d6('0x18'))['db'];var extensions=require(_0xc3d6('0x19'));function respondWithStatusCode(_0x46ff56,_0x27a706){_0x27a706=_0x27a706||0xcc;return function(_0xfa3a06){if(_0xfa3a06){return _0x46ff56[_0xc3d6('0x1a')](_0x27a706);}return _0x46ff56['status'](_0x27a706)[_0xc3d6('0x1b')]();};}function respondWithResult(_0x206779,_0x37d81c){_0x37d81c=_0x37d81c||0xc8;return function(_0x21bef9){if(_0x21bef9){return _0x206779['status'](_0x37d81c)['json'](_0x21bef9);}};}function respondWithFilteredResult(_0x34d5b1,_0x1024ea){return function(_0x5d5e74){if(_0x5d5e74){var _0x11ed21=_0x5d5e74[_0xc3d6('0x1c')],_0x339c17=_0x1024ea[_0xc3d6('0x1d')],_0x570779=_0x1024ea['offset']+_0x1024ea[_0xc3d6('0x1e')],_0x210b14;if(_0x570779>=_0x11ed21){_0x570779=_0x11ed21;_0x210b14=0xc8;}else{_0x210b14=0xce;}_0x34d5b1[_0xc3d6('0x1f')](_0x210b14);return _0x34d5b1['set'](_0xc3d6('0x20'),_0x339c17+'-'+_0x570779+'/'+_0x11ed21)[_0xc3d6('0x21')](_0x5d5e74);}return null;};}function patchUpdates(_0x5714cc){return function(_0x3af473){try{jsonpatch[_0xc3d6('0x22')](_0x3af473,_0x5714cc,!![]);}catch(_0x4c84c2){return BPromise[_0xc3d6('0x23')](_0x4c84c2);}return _0x3af473[_0xc3d6('0x24')]();};}function saveUpdates(_0x478c74,_0x50c836){return function(_0x5c2a8c){if(_0x5c2a8c){return _0x5c2a8c[_0xc3d6('0x25')](_0x478c74)[_0xc3d6('0x26')](function(_0x56e1fe){return _0x56e1fe;});}return null;};}function removeEntity(_0x211968,_0x24c061){return function(_0x402751){if(_0x402751){return _0x402751['destroy']()[_0xc3d6('0x26')](function(){var _0x2b211e=_0x402751[_0xc3d6('0x27')]({'plain':!![]});var _0x367ecb='Intervals';return db[_0xc3d6('0x28')]['destroy']({'where':{'type':_0x367ecb,'resourceId':_0x2b211e['id']}})[_0xc3d6('0x26')](function(){return _0x402751;});})['then'](function(){_0x211968[_0xc3d6('0x1f')](0xcc)[_0xc3d6('0x1b')]();});}};}function handleEntityNotFound(_0x3c2c69,_0x243dd0){return function(_0x5d60d8){if(!_0x5d60d8){_0x3c2c69[_0xc3d6('0x1a')](0x194);}return _0x5d60d8;};}function handleError(_0xcbdd0c,_0x2cdf3e){_0x2cdf3e=_0x2cdf3e||0x1f4;return function(_0x4d79a3){logger['error'](_0x4d79a3[_0xc3d6('0x29')]);if(_0x4d79a3[_0xc3d6('0x2a')]){delete _0x4d79a3['name'];}_0xcbdd0c[_0xc3d6('0x1f')](_0x2cdf3e)[_0xc3d6('0x2b')](_0x4d79a3);};}exports[_0xc3d6('0x2c')]=function(_0x1375ef,_0x2f817c){var _0x451a5a={},_0x1d8c06={},_0x2fd4d4={'count':0x0,'rows':[]};var _0x4bb64d=_[_0xc3d6('0x2d')](db[_0xc3d6('0x2e')][_0xc3d6('0x2f')],function(_0x419adf){return{'name':_0x419adf['fieldName'],'type':_0x419adf[_0xc3d6('0x30')]['key']};});_0x1d8c06[_0xc3d6('0x31')]=_[_0xc3d6('0x2d')](_0x4bb64d,_0xc3d6('0x2a'));_0x1d8c06[_0xc3d6('0x32')]=_[_0xc3d6('0x33')](_0x1375ef[_0xc3d6('0x32')]);_0x1d8c06[_0xc3d6('0x34')]=_[_0xc3d6('0x35')](_0x1d8c06[_0xc3d6('0x31')],_0x1d8c06[_0xc3d6('0x32')]);_0x451a5a[_0xc3d6('0x36')]=_[_0xc3d6('0x35')](_0x1d8c06['model'],qs[_0xc3d6('0x37')](_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x37')]));_0x451a5a['attributes']=_0x451a5a['attributes'][_0xc3d6('0x38')]?_0x451a5a[_0xc3d6('0x36')]:_0x1d8c06[_0xc3d6('0x31')];if(!_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x39')](_0xc3d6('0x3a'))){_0x451a5a['limit']=qs['limit'](_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x1e')]);_0x451a5a[_0xc3d6('0x1d')]=qs[_0xc3d6('0x1d')](_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x1d')]);}_0x451a5a[_0xc3d6('0x3b')]=qs[_0xc3d6('0x3c')](_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x3c')]);_0x451a5a[_0xc3d6('0x3d')]=qs['filters'](_[_0xc3d6('0x3e')](_0x1375ef[_0xc3d6('0x32')],_0x1d8c06[_0xc3d6('0x34')]),_0x4bb64d);if(_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x3f')]){_0x451a5a[_0xc3d6('0x3d')]=_[_0xc3d6('0x40')](_0x451a5a[_0xc3d6('0x3d')],{'$or':_[_0xc3d6('0x2d')](_0x4bb64d,function(_0x89d28b){if(_0x89d28b[_0xc3d6('0x30')]!==_0xc3d6('0x41')){var _0x16f6f0={};_0x16f6f0[_0x89d28b[_0xc3d6('0x2a')]]={'$like':'%'+_0x1375ef['query']['filter']+'%'};return _0x16f6f0;}})});}_0x451a5a=_[_0xc3d6('0x40')]({},_0x451a5a,_0x1375ef[_0xc3d6('0x42')]);var _0xc8620a={'where':_0x451a5a['where']};return db['Interval'][_0xc3d6('0x1c')](_0xc8620a)['then'](function(_0x4dda8a){_0x2fd4d4[_0xc3d6('0x1c')]=_0x4dda8a;if(_0x1375ef[_0xc3d6('0x32')][_0xc3d6('0x43')]){_0x451a5a[_0xc3d6('0x44')]=[{'all':!![]}];}return db[_0xc3d6('0x2e')][_0xc3d6('0x45')](_0x451a5a);})[_0xc3d6('0x26')](function(_0x239827){_0x2fd4d4['rows']=_0x239827;return _0x2fd4d4;})[_0xc3d6('0x26')](respondWithFilteredResult(_0x2f817c,_0x451a5a))[_0xc3d6('0x46')](handleError(_0x2f817c,null));};exports[_0xc3d6('0x47')]=function(_0x58bcdb,_0x1d0264){var _0x1ef259={'raw':!![],'where':{'id':_0x58bcdb[_0xc3d6('0x48')]['id']}},_0x215355={};_0x215355[_0xc3d6('0x31')]=_[_0xc3d6('0x33')](db[_0xc3d6('0x2e')][_0xc3d6('0x2f')]);_0x215355[_0xc3d6('0x32')]=_[_0xc3d6('0x33')](_0x58bcdb[_0xc3d6('0x32')]);_0x215355['filters']=_[_0xc3d6('0x35')](_0x215355[_0xc3d6('0x31')],_0x215355[_0xc3d6('0x32')]);_0x1ef259[_0xc3d6('0x36')]=_[_0xc3d6('0x35')](_0x215355[_0xc3d6('0x31')],qs['fields'](_0x58bcdb[_0xc3d6('0x32')][_0xc3d6('0x37')]));_0x1ef259[_0xc3d6('0x36')]=_0x1ef259[_0xc3d6('0x36')][_0xc3d6('0x38')]?_0x1ef259[_0xc3d6('0x36')]:_0x215355['model'];if(_0x58bcdb['query'][_0xc3d6('0x43')]){_0x1ef259[_0xc3d6('0x44')]=[{'all':!![]}];}_0x1ef259=_[_0xc3d6('0x40')]({},_0x1ef259,_0x58bcdb[_0xc3d6('0x42')]);return db[_0xc3d6('0x2e')][_0xc3d6('0x49')](_0x1ef259)[_0xc3d6('0x26')](handleEntityNotFound(_0x1d0264,null))['then'](respondWithResult(_0x1d0264,null))[_0xc3d6('0x46')](handleError(_0x1d0264,null));};exports[_0xc3d6('0x4a')]=function(_0x2d7465,_0x215079){return db['Interval'][_0xc3d6('0x4a')](_0x2d7465[_0xc3d6('0x4b')],{})[_0xc3d6('0x26')](function(_0x56a4db){var _0x111ed0=_0x2d7465[_0xc3d6('0x4c')][_0xc3d6('0x27')]({'plain':!![]});if(!_0x111ed0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x111ed0[_0xc3d6('0x4d')]===_0xc3d6('0x4c')){var _0x33d716=_0x56a4db['get']({'plain':!![]});var _0x440c0e=_0xc3d6('0x4e');return db['UserProfileSection'][_0xc3d6('0x49')]({'where':{'name':_0x440c0e,'userProfileId':_0x111ed0[_0xc3d6('0x4f')]},'raw':!![]})[_0xc3d6('0x26')](function(_0x24360b){if(_0x24360b&&_0x24360b[_0xc3d6('0x50')]===0x0){return db[_0xc3d6('0x28')][_0xc3d6('0x4a')]({'name':_0x33d716[_0xc3d6('0x2a')],'resourceId':_0x33d716['id'],'type':_0x24360b[_0xc3d6('0x2a')],'sectionId':_0x24360b['id']},{})[_0xc3d6('0x26')](function(){return _0x56a4db;});}else{return _0x56a4db;}})[_0xc3d6('0x46')](function(_0x2599cf){logger[_0xc3d6('0x51')](_0xc3d6('0x52'),_0x2599cf);throw _0x2599cf;});}return _0x56a4db;})[_0xc3d6('0x26')](respondWithResult(_0x215079,0xc9))[_0xc3d6('0x46')](handleError(_0x215079,null));};exports[_0xc3d6('0x25')]=function(_0x2f36a1,_0x238bf8){if(_0x2f36a1[_0xc3d6('0x4b')]['id']){delete _0x2f36a1[_0xc3d6('0x4b')]['id'];}return db[_0xc3d6('0x2e')]['find']({'where':{'id':_0x2f36a1['params']['id']}})[_0xc3d6('0x26')](handleEntityNotFound(_0x238bf8,null))[_0xc3d6('0x26')](saveUpdates(_0x2f36a1[_0xc3d6('0x4b')],null))[_0xc3d6('0x26')](respondWithResult(_0x238bf8,null))[_0xc3d6('0x46')](handleError(_0x238bf8,null));};exports[_0xc3d6('0x53')]=function(_0x750808,_0x2419ac){return db[_0xc3d6('0x2e')]['find']({'where':{'id':_0x750808[_0xc3d6('0x48')]['id']}})[_0xc3d6('0x26')](handleEntityNotFound(_0x2419ac,null))[_0xc3d6('0x26')](removeEntity(_0x2419ac,null))[_0xc3d6('0x46')](handleError(_0x2419ac,null));};exports[_0xc3d6('0x54')]=function(_0x3150af,_0x3fae61,_0x297100){if(_0x3150af[_0xc3d6('0x4b')]['id']){delete _0x3150af['body']['id'];}return db[_0xc3d6('0x2e')][_0xc3d6('0x49')]({'where':{'id':_0x3150af[_0xc3d6('0x48')]['id']}})[_0xc3d6('0x26')](handleEntityNotFound(_0x3fae61,null))[_0xc3d6('0x26')](function(_0x24a674){if(_0x24a674){_0x3150af['body']['IntervalId']=_0x24a674['id'];return db[_0xc3d6('0x2e')]['create'](_0x3150af[_0xc3d6('0x4b')]);}})['then'](respondWithResult(_0x3fae61,null))[_0xc3d6('0x46')](handleError(_0x3fae61,null));};exports[_0xc3d6('0x55')]=function(_0x341b29,_0x12ee48,_0x45c43d){var _0x485421={};var _0x390f4f={};var _0x518835;var _0x2299e0;return db['Interval'][_0xc3d6('0x56')]({'where':{'id':_0x341b29[_0xc3d6('0x48')]['id']}})[_0xc3d6('0x26')](handleEntityNotFound(_0x12ee48,null))['then'](function(_0x242d04){if(_0x242d04){_0x518835=_0x242d04;_0x390f4f[_0xc3d6('0x31')]=_[_0xc3d6('0x33')](db[_0xc3d6('0x2e')]['rawAttributes']);_0x390f4f['query']=_['keys'](_0x341b29[_0xc3d6('0x32')]);_0x390f4f['filters']=_[_0xc3d6('0x35')](_0x390f4f[_0xc3d6('0x31')],_0x390f4f['query']);_0x485421[_0xc3d6('0x36')]=_['intersection'](_0x390f4f['model'],qs[_0xc3d6('0x37')](_0x341b29[_0xc3d6('0x32')][_0xc3d6('0x37')]));_0x485421[_0xc3d6('0x36')]=_0x485421['attributes'][_0xc3d6('0x38')]?_0x485421[_0xc3d6('0x36')]:_0x390f4f[_0xc3d6('0x31')];_0x485421['order']=qs['sort'](_0x341b29['query'][_0xc3d6('0x3c')]);_0x485421[_0xc3d6('0x3d')]=qs[_0xc3d6('0x34')](_[_0xc3d6('0x3e')](_0x341b29[_0xc3d6('0x32')],_0x390f4f[_0xc3d6('0x34')]));if(_0x341b29['query'][_0xc3d6('0x3f')]){_0x485421[_0xc3d6('0x3d')]=_[_0xc3d6('0x40')](_0x485421[_0xc3d6('0x3d')],{'$or':_[_0xc3d6('0x2d')](_0x485421['attributes'],function(_0x26ea5e){var _0x3f2a84={};_0x3f2a84[_0x26ea5e]={'$like':'%'+_0x341b29[_0xc3d6('0x32')]['filter']+'%'};return _0x3f2a84;})});}_0x485421=_['merge']({},_0x485421,_0x341b29['options']);return _0x518835[_0xc3d6('0x55')](_0x485421);}})['then'](function(_0x3bdb51){if(_0x3bdb51){_0x2299e0=_0x3bdb51[_0xc3d6('0x38')];if(!_0x341b29[_0xc3d6('0x32')]['hasOwnProperty']('nolimit')){_0x485421[_0xc3d6('0x1e')]=qs[_0xc3d6('0x1e')](_0x341b29[_0xc3d6('0x32')][_0xc3d6('0x1e')]);_0x485421[_0xc3d6('0x1d')]=qs[_0xc3d6('0x1d')](_0x341b29['query'][_0xc3d6('0x1d')]);}return _0x518835[_0xc3d6('0x55')](_0x485421);}})['then'](function(_0x3b03ec){if(_0x3b03ec){return _0x3b03ec?{'count':_0x2299e0,'rows':_0x3b03ec}:null;}})[_0xc3d6('0x26')](respondWithResult(_0x12ee48,null))[_0xc3d6('0x46')](handleError(_0x12ee48,null));};exports[_0xc3d6('0x57')]=function(_0x28abd3,_0x6a6067,_0x4769f3){return db[_0xc3d6('0x2e')][_0xc3d6('0x56')]({'where':{'id':_0x28abd3[_0xc3d6('0x48')]['id']}})[_0xc3d6('0x26')](handleEntityNotFound(_0x6a6067,null))[_0xc3d6('0x26')](function(_0x2d9f6e){if(_0x2d9f6e){return db[_0xc3d6('0x58')]['transaction'](function(_0x2bc564){return db[_0xc3d6('0x2e')][_0xc3d6('0x53')]({'where':{'IntervalId':_0x28abd3[_0xc3d6('0x48')]['id']},'transaction':_0x2bc564})[_0xc3d6('0x26')](function(_0x1229d0){var _0x1a2f5d=_[_0xc3d6('0x2d')](_0x28abd3[_0xc3d6('0x4b')],function(_0x183e43){delete _0x183e43['id'];_0x183e43[_0xc3d6('0x59')]=_0x28abd3[_0xc3d6('0x48')]['id'];return _0x183e43;});return db[_0xc3d6('0x2e')][_0xc3d6('0x5a')](_0x1a2f5d,{'transaction':_0x2bc564});});})['then'](function(){return db[_0xc3d6('0x2e')]['findAll']({'where':{'IntervalId':_0x28abd3['params']['id']}});});}})[_0xc3d6('0x26')](respondWithResult(_0x6a6067,null))['catch'](handleError(_0x6a6067,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 4cbfb58..85a2227 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 _0x50c1=['path','rimraf','../../config/environment','./interval.attributes','exports','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','moment','bluebird'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0x50c1,0x1b6));var _0x150c=function(_0xf48e4f,_0xf3ad9a){_0xf48e4f=_0xf48e4f-0x0;var _0x551087=_0x50c1[_0xf48e4f];return _0x551087;};'use strict';var _=require(_0x150c('0x0'));var util=require('util');var logger=require(_0x150c('0x1'))('api');var moment=require(_0x150c('0x2'));var BPromise=require(_0x150c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x150c('0x4'));var rimraf=require(_0x150c('0x5'));var config=require(_0x150c('0x6'));var attributes=require(_0x150c('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x150c('0x8')]=function(_0x11317c,_0x4ae5a9){return _0x11317c[_0x150c('0x9')](_0x150c('0xa'),attributes,{'tableName':_0x150c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x337c30,_0x51f6fc){extensions[_0x150c('0xc')](_0x11317c,_0x337c30);},'afterBulkCreate':function(_0x155526,_0x10959d,_0x3bb377){_0x3bb377();extensions[_0x150c('0xc')](_0x11317c,_0x155526[0x0]);},'afterUpdate':function(_0x33781b,_0x176356){extensions['rewrite'](_0x11317c,_0x33781b);},'afterDestroy':function(_0x30c973,_0x4d96ed){extensions['rewrite'](_0x11317c,_0x30c973);}}});}; \ No newline at end of file +var _0x833b=['../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','util','api','bluebird','path','rimraf','../../config/environment','./interval.attributes'];(function(_0x2da995,_0x4d2210){var _0x216482=function(_0xfb8de2){while(--_0xfb8de2){_0x2da995['push'](_0x2da995['shift']());}};_0x216482(++_0x4d2210);}(_0x833b,0x131));var _0xb833=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x833b[_0x819464];return _0x49dcc0;};'use strict';var _=require('lodash');var util=require(_0xb833('0x0'));var logger=require('../../config/logger')(_0xb833('0x1'));var moment=require('moment');var BPromise=require(_0xb833('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb833('0x3'));var rimraf=require(_0xb833('0x4'));var config=require(_0xb833('0x5'));var attributes=require(_0xb833('0x6'));var extensions=require(_0xb833('0x7'));module[_0xb833('0x8')]=function(_0x4422a2,_0x4eaff4){return _0x4422a2[_0xb833('0x9')](_0xb833('0xa'),attributes,{'tableName':_0xb833('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2525aa,_0x3b74c4){extensions[_0xb833('0xc')](_0x4422a2,_0x2525aa);},'afterBulkCreate':function(_0x26cbf6,_0x50cb16,_0x1660db){_0x1660db();extensions['rewrite'](_0x4422a2,_0x26cbf6[0x0]);},'afterUpdate':function(_0x55ab06,_0x2dc315){extensions[_0xb833('0xc')](_0x4422a2,_0x55ab06);},'afterDestroy':function(_0x193b4d,_0x492017){extensions['rewrite'](_0x4422a2,_0x193b4d);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 75026c6..54cc4e3 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 _0xba98=['message','result','GetInterval','options','raw','where','attributes','include','map','model','catch','ShowInterval','Interval','find','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','Interval,\x20%s,\x20%s'];(function(_0x3e74d4,_0xfeb53){var _0x38adee=function(_0x563c28){while(--_0x563c28){_0x3e74d4['push'](_0x3e74d4['shift']());}};_0x38adee(++_0xfeb53);}(_0xba98,0xbe));var _0x8ba9=function(_0x86368e,_0xc560fe){_0x86368e=_0x86368e-0x0;var _0x213d24=_0xba98[_0x86368e];return _0x213d24;};'use strict';var _=require(_0x8ba9('0x0'));var util=require('util');var moment=require(_0x8ba9('0x1'));var BPromise=require(_0x8ba9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ba9('0x3'));var db=require(_0x8ba9('0x4'))['db'];var utils=require(_0x8ba9('0x5'));var logger=require(_0x8ba9('0x6'))(_0x8ba9('0x7'));var config=require(_0x8ba9('0x8'));var jayson=require(_0x8ba9('0x9'));var client=jayson[_0x8ba9('0xa')][_0x8ba9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ff204,_0x199cff,_0x5e8506){return new BPromise(function(_0x205101,_0x1cfea7){return client[_0x8ba9('0xc')](_0x3ff204,_0x5e8506)[_0x8ba9('0xd')](function(_0xf6b245){logger[_0x8ba9('0xe')]('Interval,\x20%s,\x20%s',_0x199cff,_0x8ba9('0xf'));logger['debug']('Interval,\x20%s,\x20%s,\x20%s',_0x199cff,_0x8ba9('0xf'),JSON[_0x8ba9('0x10')](_0xf6b245));if(_0xf6b245[_0x8ba9('0x11')]){if(_0xf6b245[_0x8ba9('0x11')][_0x8ba9('0x12')]===0x1f4){logger[_0x8ba9('0x11')](_0x8ba9('0x13'),_0x199cff,_0xf6b245[_0x8ba9('0x11')][_0x8ba9('0x14')]);return _0x1cfea7(_0xf6b245[_0x8ba9('0x11')]['message']);}logger['error'](_0x8ba9('0x13'),_0x199cff,_0xf6b245[_0x8ba9('0x11')]['message']);return _0x205101(_0xf6b245[_0x8ba9('0x11')][_0x8ba9('0x14')]);}else{logger[_0x8ba9('0xe')](_0x8ba9('0x13'),_0x199cff,'request\x20sent');_0x205101(_0xf6b245[_0x8ba9('0x15')][_0x8ba9('0x14')]);}})['catch'](function(_0x29926a){logger[_0x8ba9('0x11')]('Interval,\x20%s,\x20%s',_0x199cff,_0x29926a);_0x1cfea7(_0x29926a);});});}exports[_0x8ba9('0x16')]=function(_0x330de7){var _0x527464=this;return new Promise(function(_0xb42a64,_0x246288){return db['Interval']['findAll']({'raw':_0x330de7['options']?_0x330de7[_0x8ba9('0x17')][_0x8ba9('0x18')]===undefined?!![]:![]:!![],'where':_0x330de7[_0x8ba9('0x17')]?_0x330de7['options'][_0x8ba9('0x19')]||null:null,'attributes':_0x330de7['options']?_0x330de7[_0x8ba9('0x17')][_0x8ba9('0x1a')]||null:null,'limit':_0x330de7[_0x8ba9('0x17')]?_0x330de7[_0x8ba9('0x17')]['limit']||null:null,'include':_0x330de7[_0x8ba9('0x17')]?_0x330de7['options'][_0x8ba9('0x1b')]?_[_0x8ba9('0x1c')](_0x330de7[_0x8ba9('0x17')][_0x8ba9('0x1b')],function(_0x59a2e6){return{'model':db[_0x59a2e6[_0x8ba9('0x1d')]],'as':_0x59a2e6['as'],'attributes':_0x59a2e6[_0x8ba9('0x1a')],'include':_0x59a2e6[_0x8ba9('0x1b')]?_[_0x8ba9('0x1c')](_0x59a2e6['include'],function(_0x1f39bd){return{'model':db[_0x1f39bd[_0x8ba9('0x1d')]],'as':_0x1f39bd['as'],'attributes':_0x1f39bd['attributes'],'include':_0x1f39bd[_0x8ba9('0x1b')]?_['map'](_0x1f39bd['include'],function(_0x55dbc3){return{'model':db[_0x55dbc3[_0x8ba9('0x1d')]],'as':_0x55dbc3['as'],'attributes':_0x55dbc3['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ba9('0xd')](function(_0x38931d){logger['info']('GetInterval',_0x330de7);logger['debug'](_0x8ba9('0x16'),_0x330de7,JSON['stringify'](_0x38931d));_0xb42a64(_0x38931d);})[_0x8ba9('0x1e')](function(_0x1ffb6b){logger[_0x8ba9('0x11')]('GetInterval',_0x1ffb6b[_0x8ba9('0x14')],_0x330de7);_0x246288(_0x527464[_0x8ba9('0x11')](0x1f4,_0x1ffb6b[_0x8ba9('0x14')]));});});};exports[_0x8ba9('0x1f')]=function(_0x569393){var _0x5a8932=this;return new Promise(function(_0x2c9e05,_0x57030c){return db[_0x8ba9('0x20')][_0x8ba9('0x21')]({'raw':_0x569393['options']?_0x569393['options'][_0x8ba9('0x18')]===undefined?!![]:![]:!![],'where':_0x569393[_0x8ba9('0x17')]?_0x569393['options'][_0x8ba9('0x19')]||null:null,'attributes':_0x569393[_0x8ba9('0x17')]?_0x569393['options']['attributes']||null:null,'include':_0x569393[_0x8ba9('0x17')]?_0x569393[_0x8ba9('0x17')][_0x8ba9('0x1b')]?_['map'](_0x569393[_0x8ba9('0x17')][_0x8ba9('0x1b')],function(_0x4d9f18){return{'model':db[_0x4d9f18[_0x8ba9('0x1d')]],'as':_0x4d9f18['as'],'attributes':_0x4d9f18[_0x8ba9('0x1a')],'include':_0x4d9f18[_0x8ba9('0x1b')]?_['map'](_0x4d9f18[_0x8ba9('0x1b')],function(_0x132abc){return{'model':db[_0x132abc[_0x8ba9('0x1d')]],'as':_0x132abc['as'],'attributes':_0x132abc[_0x8ba9('0x1a')],'include':_0x132abc[_0x8ba9('0x1b')]?_[_0x8ba9('0x1c')](_0x132abc[_0x8ba9('0x1b')],function(_0x49d795){return{'model':db[_0x49d795['model']],'as':_0x49d795['as'],'attributes':_0x49d795[_0x8ba9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x184c3b){logger[_0x8ba9('0xe')](_0x8ba9('0x1f'),_0x569393);logger[_0x8ba9('0x22')](_0x8ba9('0x1f'),_0x569393,JSON[_0x8ba9('0x10')](_0x184c3b));_0x2c9e05(_0x184c3b);})[_0x8ba9('0x1e')](function(_0x2d7fc4){logger[_0x8ba9('0x11')]('ShowInterval',_0x2d7fc4[_0x8ba9('0x14')],_0x569393);_0x57030c(_0x5a8932['error'](0x1f4,_0x2d7fc4[_0x8ba9('0x14')]));});});}; \ No newline at end of file +var _0x9880=['http','request','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetInterval','Interval','findAll','options','where','attributes','limit','include','map','model','then','ShowInterval','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x15ff5c,_0x1f4efb){var _0x353f8f=function(_0x43a918){while(--_0x43a918){_0x15ff5c['push'](_0x15ff5c['shift']());}};_0x353f8f(++_0x1f4efb);}(_0x9880,0xcc));var _0x0988=function(_0x4d2263,_0x3fbf0d){_0x4d2263=_0x4d2263-0x0;var _0x24aba0=_0x9880[_0x4d2263];return _0x24aba0;};'use strict';var _=require(_0x0988('0x0'));var util=require(_0x0988('0x1'));var moment=require(_0x0988('0x2'));var BPromise=require(_0x0988('0x3'));var rs=require(_0x0988('0x4'));var fs=require('fs');var Redis=require(_0x0988('0x5'));var db=require(_0x0988('0x6'))['db'];var utils=require(_0x0988('0x7'));var logger=require(_0x0988('0x8'))(_0x0988('0x9'));var config=require('../../config/environment');var jayson=require(_0x0988('0xa'));var client=jayson[_0x0988('0xb')][_0x0988('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x35c5da,_0x7a111a,_0x281c92){return new BPromise(function(_0x41c12e,_0x3dcd31){return client[_0x0988('0xd')](_0x35c5da,_0x281c92)['then'](function(_0x35c793){logger[_0x0988('0xe')](_0x0988('0xf'),_0x7a111a,_0x0988('0x10'));logger[_0x0988('0x11')](_0x0988('0x12'),_0x7a111a,_0x0988('0x10'),JSON[_0x0988('0x13')](_0x35c793));if(_0x35c793[_0x0988('0x14')]){if(_0x35c793[_0x0988('0x14')][_0x0988('0x15')]===0x1f4){logger['error'](_0x0988('0xf'),_0x7a111a,_0x35c793[_0x0988('0x14')][_0x0988('0x16')]);return _0x3dcd31(_0x35c793['error'][_0x0988('0x16')]);}logger[_0x0988('0x14')](_0x0988('0xf'),_0x7a111a,_0x35c793['error']['message']);return _0x41c12e(_0x35c793[_0x0988('0x14')][_0x0988('0x16')]);}else{logger[_0x0988('0xe')](_0x0988('0xf'),_0x7a111a,_0x0988('0x10'));_0x41c12e(_0x35c793['result'][_0x0988('0x16')]);}})[_0x0988('0x17')](function(_0x11aa60){logger[_0x0988('0x14')]('Interval,\x20%s,\x20%s',_0x7a111a,_0x11aa60);_0x3dcd31(_0x11aa60);});});}exports[_0x0988('0x18')]=function(_0x2dabaa){var _0x6b56ba=this;return new Promise(function(_0x5cbd47,_0x27b7e4){return db[_0x0988('0x19')][_0x0988('0x1a')]({'raw':_0x2dabaa[_0x0988('0x1b')]?_0x2dabaa[_0x0988('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2dabaa['options']?_0x2dabaa[_0x0988('0x1b')][_0x0988('0x1c')]||null:null,'attributes':_0x2dabaa['options']?_0x2dabaa[_0x0988('0x1b')][_0x0988('0x1d')]||null:null,'limit':_0x2dabaa[_0x0988('0x1b')]?_0x2dabaa[_0x0988('0x1b')][_0x0988('0x1e')]||null:null,'include':_0x2dabaa['options']?_0x2dabaa[_0x0988('0x1b')][_0x0988('0x1f')]?_[_0x0988('0x20')](_0x2dabaa['options'][_0x0988('0x1f')],function(_0x29991f){return{'model':db[_0x29991f[_0x0988('0x21')]],'as':_0x29991f['as'],'attributes':_0x29991f[_0x0988('0x1d')],'include':_0x29991f[_0x0988('0x1f')]?_['map'](_0x29991f['include'],function(_0x1b41f8){return{'model':db[_0x1b41f8[_0x0988('0x21')]],'as':_0x1b41f8['as'],'attributes':_0x1b41f8[_0x0988('0x1d')],'include':_0x1b41f8[_0x0988('0x1f')]?_[_0x0988('0x20')](_0x1b41f8['include'],function(_0x2810fe){return{'model':db[_0x2810fe[_0x0988('0x21')]],'as':_0x2810fe['as'],'attributes':_0x2810fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x0988('0x22')](function(_0x59b6da){logger['info'](_0x0988('0x18'),_0x2dabaa);logger['debug']('GetInterval',_0x2dabaa,JSON['stringify'](_0x59b6da));_0x5cbd47(_0x59b6da);})[_0x0988('0x17')](function(_0x5e5297){logger[_0x0988('0x14')](_0x0988('0x18'),_0x5e5297[_0x0988('0x16')],_0x2dabaa);_0x27b7e4(_0x6b56ba[_0x0988('0x14')](0x1f4,_0x5e5297[_0x0988('0x16')]));});});};exports[_0x0988('0x23')]=function(_0x3312fa){var _0x42c124=this;return new Promise(function(_0x5a7aaa,_0x269116){return db[_0x0988('0x19')]['find']({'raw':_0x3312fa[_0x0988('0x1b')]?_0x3312fa[_0x0988('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3312fa[_0x0988('0x1b')]?_0x3312fa['options'][_0x0988('0x1c')]||null:null,'attributes':_0x3312fa[_0x0988('0x1b')]?_0x3312fa[_0x0988('0x1b')]['attributes']||null:null,'include':_0x3312fa[_0x0988('0x1b')]?_0x3312fa[_0x0988('0x1b')][_0x0988('0x1f')]?_[_0x0988('0x20')](_0x3312fa[_0x0988('0x1b')][_0x0988('0x1f')],function(_0xa46e7b){return{'model':db[_0xa46e7b[_0x0988('0x21')]],'as':_0xa46e7b['as'],'attributes':_0xa46e7b['attributes'],'include':_0xa46e7b[_0x0988('0x1f')]?_[_0x0988('0x20')](_0xa46e7b['include'],function(_0x1890ff){return{'model':db[_0x1890ff['model']],'as':_0x1890ff['as'],'attributes':_0x1890ff['attributes'],'include':_0x1890ff['include']?_['map'](_0x1890ff['include'],function(_0x3041b1){return{'model':db[_0x3041b1[_0x0988('0x21')]],'as':_0x3041b1['as'],'attributes':_0x3041b1[_0x0988('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e25ea){logger['info'](_0x0988('0x23'),_0x3312fa);logger[_0x0988('0x11')](_0x0988('0x23'),_0x3312fa,JSON[_0x0988('0x13')](_0x1e25ea));_0x5a7aaa(_0x1e25ea);})['catch'](function(_0x45872f){logger['error'](_0x0988('0x23'),_0x45872f[_0x0988('0x16')],_0x3312fa);_0x269116(_0x42c124[_0x0988('0x14')](0x1f4,_0x45872f[_0x0988('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 56fef7a..a31508a 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 _0x320f=['../../components/auth/service','./jira.controller','post','isAuthenticated','send','exports','express','Router'];(function(_0x487bd5,_0x15f486){var _0x3e32bf=function(_0x3a4d49){while(--_0x3a4d49){_0x487bd5['push'](_0x487bd5['shift']());}};_0x3e32bf(++_0x15f486);}(_0x320f,0x11e));var _0xf320=function(_0x458043,_0x23b1ea){_0x458043=_0x458043-0x0;var _0x1a1635=_0x320f[_0x458043];return _0x1a1635;};'use strict';var express=require(_0xf320('0x0'));var router=express[_0xf320('0x1')]();var auth=require(_0xf320('0x2'));var controller=require(_0xf320('0x3'));router[_0xf320('0x4')]('/',auth[_0xf320('0x5')](),controller[_0xf320('0x6')]);module[_0xf320('0x7')]=router; \ No newline at end of file +var _0x3124=['exports','../../components/auth/service','./jira.controller','post','isAuthenticated','send'];(function(_0x721fa5,_0x31fa55){var _0x30a1cd=function(_0x3b1c30){while(--_0x3b1c30){_0x721fa5['push'](_0x721fa5['shift']());}};_0x30a1cd(++_0x31fa55);}(_0x3124,0x15d));var _0x4312=function(_0x3954f6,_0xd9e0e6){_0x3954f6=_0x3954f6-0x0;var _0x679d08=_0x3124[_0x3954f6];return _0x679d08;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4312('0x0'));var controller=require(_0x4312('0x1'));router[_0x4312('0x2')]('/',auth[_0x4312('0x3')](),controller[_0x4312('0x4')]);module[_0x4312('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 3c074b1..f808123 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 _0x08b3=['fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','base64','request','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','x-forwarded-for','remoteAddress','connection','socket','https','api','key','MOTGUI','summary','Report','\x20from\x20','issuetype','Bug'];(function(_0xb8a668,_0x1868ce){var _0x52e5a6=function(_0x9f2b90){while(--_0x9f2b90){_0xb8a668['push'](_0xb8a668['shift']());}};_0x52e5a6(++_0x1868ce);}(_0x08b3,0x15f));var _0x308b=function(_0x46ad0c,_0x353776){_0x46ad0c=_0x46ad0c-0x0;var _0x4ceac2=_0x08b3[_0x46ad0c];return _0x4ceac2;};'use strict';var BPromise=require('bluebird');var https=require(_0x308b('0x0'));var logger=require('../../config/logger')(_0x308b('0x1'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x589e3f,_0xcb822a){var _0x724384={'fields':{'project':{'key':_0x589e3f[_0x308b('0x2')]||_0x308b('0x3')},'summary':(_0x589e3f[_0x308b('0x4')]||_0x308b('0x5'))+_0x308b('0x6')+_0x589e3f['ip'],'description':_0x589e3f['description']||JSON['stringify'](_0x589e3f),'issuetype':{'name':_0x589e3f[_0x308b('0x7')]||_0x308b('0x8')}}};_0x724384[_0x308b('0x9')][_0x308b('0xa')]=_0x589e3f['email'];_0x724384['fields'][_0x308b('0xb')]=_0x589e3f[_0x308b('0xc')];_0x724384[_0x308b('0x9')][_0x308b('0xd')]=_0x589e3f[_0x308b('0xe')];_0x724384[_0x308b('0x9')][_0x308b('0xf')]=_0x589e3f[_0x308b('0x10')];_0x724384[_0x308b('0x9')][_0x308b('0x11')]=_0x589e3f[_0x308b('0x12')];_0x724384['fields'][_0x308b('0x13')]=_0x589e3f['ip'];var _0x592884={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x308b('0x14'),'method':_0x308b('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x308b('0x16'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x308b('0x17'))}};var _0x5b3180=JSON['stringify'](_0x724384);var _0x2234cb=https[_0x308b('0x18')](_0x592884,function(_0x1c614b){_0x1c614b['setEncoding']('utf8');var _0x40ae8e='';_0x1c614b['on'](_0x308b('0x19'),function(_0x21dd36){_0x40ae8e+=_0x21dd36;});_0x1c614b['on'](_0x308b('0x1a'),function(){if(_0xcb822a){return _0xcb822a[_0x308b('0x1b')](_0x1c614b['statusCode'])[_0x308b('0x1c')](JSON[_0x308b('0x1d')](_0x40ae8e));}});});_0x2234cb['on'](_0x308b('0x1e'),function(_0x2ad5a2){if(_0xcb822a){return _0xcb822a[_0x308b('0x1b')](0x1f4)[_0x308b('0x1c')]({'errors':[{'message':_0x308b('0x1f'),'type':_0x308b('0x20')}]});}});_0x2234cb[_0x308b('0x21')](_0x5b3180);_0x2234cb[_0x308b('0x1a')]();}exports[_0x308b('0x22')]=openIssue;exports['send']=function(_0x7cbbd2,_0x1568bd){_0x7cbbd2[_0x308b('0x23')]['ip']=_0x7cbbd2['headers'][_0x308b('0x24')]||_0x7cbbd2['connection'][_0x308b('0x25')]||_0x7cbbd2['socket'][_0x308b('0x25')]||_0x7cbbd2[_0x308b('0x26')][_0x308b('0x27')][_0x308b('0x25')];return openIssue(_0x7cbbd2[_0x308b('0x23')],_0x1568bd);}; \ No newline at end of file +var _0x429e=['remoteAddress','socket','connection','../../config/logger','support','key','MOTGUI','summary','description','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11504','reason','customfield_10102','POST','application/json','Basic\x20','toString','base64','stringify','setEncoding','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x429e,0x1bb));var _0xe429=function(_0x2b2606,_0x1954d9){_0x2b2606=_0x2b2606-0x0;var _0x333503=_0x429e[_0x2b2606];return _0x333503;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xe429('0x0'))('api');var USERNAME=_0xe429('0x1');var PASSWORD='3eAmWpBVP0';function openIssue(_0x5d0ff4,_0x218bba){var _0x9c5d20={'fields':{'project':{'key':_0x5d0ff4[_0xe429('0x2')]||_0xe429('0x3')},'summary':(_0x5d0ff4[_0xe429('0x4')]||'Report')+'\x20from\x20'+_0x5d0ff4['ip'],'description':_0x5d0ff4[_0xe429('0x5')]||JSON['stringify'](_0x5d0ff4),'issuetype':{'name':_0x5d0ff4['issuetype']||_0xe429('0x6')}}};_0x9c5d20[_0xe429('0x7')][_0xe429('0x8')]=_0x5d0ff4[_0xe429('0x9')];_0x9c5d20['fields'][_0xe429('0xa')]=_0x5d0ff4['oldToken'];_0x9c5d20[_0xe429('0x7')][_0xe429('0xb')]=_0x5d0ff4[_0xe429('0xc')];_0x9c5d20[_0xe429('0x7')]['customfield_11503']=_0x5d0ff4['name'];_0x9c5d20[_0xe429('0x7')][_0xe429('0xd')]=_0x5d0ff4[_0xe429('0xe')];_0x9c5d20[_0xe429('0x7')][_0xe429('0xf')]=_0x5d0ff4['ip'];var _0x7c289f={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0xe429('0x10'),'timeout':0x4e20,'headers':{'Content-Type':_0xe429('0x11'),'Authorization':_0xe429('0x12')+new Buffer(USERNAME+':'+PASSWORD)[_0xe429('0x13')](_0xe429('0x14'))}};var _0x378929=JSON[_0xe429('0x15')](_0x9c5d20);var _0x71f211=https['request'](_0x7c289f,function(_0x25ed64){_0x25ed64[_0xe429('0x16')]('utf8');var _0x53286e='';_0x25ed64['on'](_0xe429('0x17'),function(_0x19a6a3){_0x53286e+=_0x19a6a3;});_0x25ed64['on'](_0xe429('0x18'),function(){if(_0x218bba){return _0x218bba[_0xe429('0x19')](_0x25ed64[_0xe429('0x1a')])[_0xe429('0x1b')](JSON[_0xe429('0x1c')](_0x53286e));}});});_0x71f211['on'](_0xe429('0x1d'),function(_0x38e5ca){if(_0x218bba){return _0x218bba[_0xe429('0x19')](0x1f4)['json']({'errors':[{'message':_0xe429('0x1e'),'type':_0xe429('0x1f')}]});}});_0x71f211[_0xe429('0x20')](_0x378929);_0x71f211[_0xe429('0x18')]();}exports[_0xe429('0x21')]=openIssue;exports['send']=function(_0x529e95,_0x46b79e){_0x529e95[_0xe429('0x22')]['ip']=_0x529e95[_0xe429('0x23')][_0xe429('0x24')]||_0x529e95['connection'][_0xe429('0x25')]||_0x529e95[_0xe429('0x26')][_0xe429('0x25')]||_0x529e95[_0xe429('0x27')]['socket']['remoteAddress'];return openIssue(_0x529e95[_0xe429('0x22')],_0x46b79e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index cab68d0..4ff5295 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 _0x52f6=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2e6871,_0x208763){var _0x2c5773=function(_0x3aebbe){while(--_0x3aebbe){_0x2e6871['push'](_0x2e6871['shift']());}};_0x2c5773(++_0x208763);}(_0x52f6,0xed));var _0x652f=function(_0x52eb49,_0xa84c7b){_0x52eb49=_0x52eb49-0x0;var _0x1b10ba=_0x52f6[_0x52eb49];return _0x1b10ba;};'use strict';var multer=require(_0x652f('0x0'));var util=require(_0x652f('0x1'));var path=require(_0x652f('0x2'));var timeout=require(_0x652f('0x3'));var express=require(_0x652f('0x4'));var router=express['Router']();var auth=require(_0x652f('0x5'));var interaction=require(_0x652f('0x6'));var config=require(_0x652f('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x652f('0x8')]('/',auth[_0x652f('0x9')](),controller[_0x652f('0xa')]);router[_0x652f('0x8')](_0x652f('0xb'),auth[_0x652f('0x9')](),controller[_0x652f('0xc')]);router[_0x652f('0x8')](_0x652f('0xd'),auth[_0x652f('0x9')](),controller[_0x652f('0xe')]);router[_0x652f('0xf')]('/',auth['isAuthenticated'](),controller[_0x652f('0x10')]);router[_0x652f('0x11')](_0x652f('0xd'),auth[_0x652f('0x9')](),controller[_0x652f('0x12')]);router[_0x652f('0x13')]('/:id',auth[_0x652f('0x9')](),controller[_0x652f('0x14')]);module[_0x652f('0x15')]=router; \ No newline at end of file +var _0x11ec=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','describe','/:id','show','post','isAuthenticated'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x11ec,0x1e9));var _0xc11e=function(_0x188d31,_0x576e87){_0x188d31=_0x188d31-0x0;var _0x30ed33=_0x11ec[_0x188d31];return _0x30ed33;};'use strict';var multer=require(_0xc11e('0x0'));var util=require(_0xc11e('0x1'));var path=require(_0xc11e('0x2'));var timeout=require(_0xc11e('0x3'));var express=require(_0xc11e('0x4'));var router=express['Router']();var auth=require(_0xc11e('0x5'));var interaction=require(_0xc11e('0x6'));var config=require(_0xc11e('0x7'));var controller=require(_0xc11e('0x8'));router[_0xc11e('0x9')]('/',auth['isAuthenticated'](),controller[_0xc11e('0xa')]);router[_0xc11e('0x9')](_0xc11e('0xb'),auth['isAuthenticated'](),controller[_0xc11e('0xc')]);router['get'](_0xc11e('0xd'),auth['isAuthenticated'](),controller[_0xc11e('0xe')]);router[_0xc11e('0xf')]('/',auth[_0xc11e('0x10')](),controller[_0xc11e('0x11')]);router[_0xc11e('0x12')]('/:id',auth[_0xc11e('0x10')](),controller[_0xc11e('0x13')]);router[_0xc11e('0x14')]('/:id',auth[_0xc11e('0x10')](),controller[_0xc11e('0x15')]);module[_0xc11e('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 490507e..2b4fd44 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 _0xa023=['long','sequelize','STRING','TEXT'];(function(_0xf9b858,_0x16c53e){var _0x3088ef=function(_0x3bc272){while(--_0x3bc272){_0xf9b858['push'](_0xf9b858['shift']());}};_0x3088ef(++_0x16c53e);}(_0xa023,0x1bd));var _0x3a02=function(_0x42a6b9,_0x164483){_0x42a6b9=_0x42a6b9-0x0;var _0x420139=_0xa023[_0x42a6b9];return _0x420139;};'use strict';var Sequelize=require(_0x3a02('0x0'));module['exports']={'question':{'type':Sequelize[_0x3a02('0x1')]},'answer':{'type':Sequelize[_0x3a02('0x2')](_0x3a02('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x3a02('0x1')]},'queue':{'type':Sequelize[_0x3a02('0x1')]},'uniqueid':{'type':Sequelize[_0x3a02('0x1')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3a02('0x1')]},'questionId':{'type':Sequelize[_0x3a02('0x1')]}}; \ No newline at end of file +var _0xf0f9=['sequelize','exports','STRING','TEXT','long'];(function(_0x14e00a,_0x50dcc0){var _0x3f57fb=function(_0x23a236){while(--_0x23a236){_0x14e00a['push'](_0x14e00a['shift']());}};_0x3f57fb(++_0x50dcc0);}(_0xf0f9,0x14a));var _0x9f0f=function(_0x1b273c,_0x38ce70){_0x1b273c=_0x1b273c-0x0;var _0x416da3=_0xf0f9[_0x1b273c];return _0x416da3;};'use strict';var Sequelize=require(_0x9f0f('0x0'));module[_0x9f0f('0x1')]={'question':{'type':Sequelize[_0x9f0f('0x2')]},'answer':{'type':Sequelize[_0x9f0f('0x3')](_0x9f0f('0x4'))},'membername':{'type':Sequelize[_0x9f0f('0x2')]},'projectname':{'type':Sequelize[_0x9f0f('0x2')]},'queue':{'type':Sequelize[_0x9f0f('0x2')]},'uniqueid':{'type':Sequelize[_0x9f0f('0x2')]},'calleridname':{'type':Sequelize[_0x9f0f('0x2')]},'calleridnum':{'type':Sequelize[_0x9f0f('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 75ef844..82a032d 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 _0x886d=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','reject','save','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','catch','show','intersection','length','options','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis'];(function(_0x28c4db,_0x2ccd05){var _0x5907ed=function(_0x1d83c2){while(--_0x1d83c2){_0x28c4db['push'](_0x28c4db['shift']());}};_0x5907ed(++_0x2ccd05);}(_0x886d,0xc4));var _0xd886=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0x886d[_0x3e182f];return _0x23edc9;};'use strict';var pdf=require(_0xd886('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd886('0x1'));var zipdir=require(_0xd886('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd886('0x3'));var moment=require(_0xd886('0x4'));var BPromise=require(_0xd886('0x5'));var Mustache=require(_0xd886('0x6'));var util=require(_0xd886('0x7'));var path=require('path');var sox=require(_0xd886('0x8'));var csv=require(_0xd886('0x9'));var ejs=require(_0xd886('0xa'));var fs=require('fs');var _=require(_0xd886('0xb'));var squel=require(_0xd886('0xc'));var crypto=require('crypto');var jsforce=require(_0xd886('0xd'));var deskjs=require(_0xd886('0xe'));var toCsv=require(_0xd886('0x9'));var querystring=require('querystring');var Papa=require(_0xd886('0xf'));var Redis=require(_0xd886('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd886('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd886('0x12'));var logger=require(_0xd886('0x13'))(_0xd886('0x14'));var utils=require(_0xd886('0x15'));var config=require(_0xd886('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12ed93,_0x1a7fc6){_0x1a7fc6=_0x1a7fc6||0xcc;return function(_0xbe36b2){if(_0xbe36b2){return _0x12ed93[_0xd886('0x17')](_0x1a7fc6);}return _0x12ed93[_0xd886('0x18')](_0x1a7fc6)[_0xd886('0x19')]();};}function respondWithResult(_0x32b934,_0x197d43){_0x197d43=_0x197d43||0xc8;return function(_0x1ccbff){if(_0x1ccbff){return _0x32b934['status'](_0x197d43)[_0xd886('0x1a')](_0x1ccbff);}};}function respondWithFilteredResult(_0x2fd11b,_0x40a14e){return function(_0x34ae71){if(_0x34ae71){var _0x13c322=_0x34ae71['count'],_0x7944=_0x40a14e[_0xd886('0x1b')],_0x36b59f=_0x40a14e[_0xd886('0x1b')]+_0x40a14e[_0xd886('0x1c')],_0x7930bf;if(_0x36b59f>=_0x13c322){_0x36b59f=_0x13c322;_0x7930bf=0xc8;}else{_0x7930bf=0xce;}_0x2fd11b[_0xd886('0x18')](_0x7930bf);return _0x2fd11b[_0xd886('0x1d')]('Content-Range',_0x7944+'-'+_0x36b59f+'/'+_0x13c322)[_0xd886('0x1a')](_0x34ae71);}return null;};}function patchUpdates(_0x39debe){return function(_0xb15f0b){try{jsonpatch['apply'](_0xb15f0b,_0x39debe,!![]);}catch(_0x3fcfca){return BPromise[_0xd886('0x1e')](_0x3fcfca);}return _0xb15f0b[_0xd886('0x1f')]();};}function saveUpdates(_0x34e58a,_0xb9f8b2){return function(_0x546d24){if(_0x546d24){return _0x546d24[_0xd886('0x20')](_0x34e58a)[_0xd886('0x21')](function(_0x48fb0b){return _0x48fb0b;});}return null;};}function removeEntity(_0x10ec9a,_0x294fc3){return function(_0x3b17e8){if(_0x3b17e8){return _0x3b17e8['destroy']()[_0xd886('0x21')](function(){_0x10ec9a[_0xd886('0x18')](0xcc)[_0xd886('0x19')]();});}};}function handleEntityNotFound(_0x4c8a81,_0x529d3f){return function(_0x5742d9){if(!_0x5742d9){_0x4c8a81[_0xd886('0x17')](0x194);}return _0x5742d9;};}function handleError(_0x5af013,_0x51908c){_0x51908c=_0x51908c||0x1f4;return function(_0x4f2eee){logger[_0xd886('0x22')](_0x4f2eee[_0xd886('0x23')]);if(_0x4f2eee['name']){delete _0x4f2eee[_0xd886('0x24')];}_0x5af013[_0xd886('0x18')](_0x51908c)[_0xd886('0x25')](_0x4f2eee);};}exports[_0xd886('0x26')]=function(_0x545376,_0xe125f7){var _0x354058={},_0x1e07c3={},_0x1ae743={'count':0x0,'rows':[]};var _0x579c88=_[_0xd886('0x27')](db[_0xd886('0x28')][_0xd886('0x29')],function(_0x28aa6a){return{'name':_0x28aa6a[_0xd886('0x2a')],'type':_0x28aa6a[_0xd886('0x2b')][_0xd886('0x2c')]};});_0x1e07c3[_0xd886('0x2d')]=_[_0xd886('0x27')](_0x579c88,_0xd886('0x24'));_0x1e07c3[_0xd886('0x2e')]=_[_0xd886('0x2f')](_0x545376[_0xd886('0x2e')]);_0x1e07c3[_0xd886('0x30')]=_['intersection'](_0x1e07c3['model'],_0x1e07c3[_0xd886('0x2e')]);_0x354058[_0xd886('0x31')]=_['intersection'](_0x1e07c3['model'],qs[_0xd886('0x32')](_0x545376['query'][_0xd886('0x32')]));_0x354058[_0xd886('0x31')]=_0x354058[_0xd886('0x31')]['length']?_0x354058[_0xd886('0x31')]:_0x1e07c3[_0xd886('0x2d')];if(!_0x545376[_0xd886('0x2e')][_0xd886('0x33')]('nolimit')){_0x354058[_0xd886('0x1c')]=qs[_0xd886('0x1c')](_0x545376[_0xd886('0x2e')][_0xd886('0x1c')]);_0x354058[_0xd886('0x1b')]=qs[_0xd886('0x1b')](_0x545376['query'][_0xd886('0x1b')]);}_0x354058[_0xd886('0x34')]=qs[_0xd886('0x35')](_0x545376[_0xd886('0x2e')][_0xd886('0x35')]);_0x354058[_0xd886('0x36')]=qs['filters'](_[_0xd886('0x37')](_0x545376['query'],_0x1e07c3[_0xd886('0x30')]),_0x579c88);if(_0x545376[_0xd886('0x2e')][_0xd886('0x38')]){_0x354058[_0xd886('0x36')]=_[_0xd886('0x39')](_0x354058['where'],{'$or':_[_0xd886('0x27')](_0x579c88,function(_0x4d88d6){if(_0x4d88d6['type']!=='VIRTUAL'){var _0x2724d0={};_0x2724d0[_0x4d88d6[_0xd886('0x24')]]={'$like':'%'+_0x545376[_0xd886('0x2e')][_0xd886('0x38')]+'%'};return _0x2724d0;}})});}_0x354058=_[_0xd886('0x39')]({},_0x354058,_0x545376['options']);var _0x3e5d65={'where':_0x354058[_0xd886('0x36')]};return db[_0xd886('0x28')][_0xd886('0x3a')](_0x3e5d65)[_0xd886('0x21')](function(_0x5c5196){_0x1ae743[_0xd886('0x3a')]=_0x5c5196;if(_0x545376['query'][_0xd886('0x3b')]){_0x354058[_0xd886('0x3c')]=[{'all':!![]}];}return db[_0xd886('0x28')][_0xd886('0x3d')](_0x354058);})[_0xd886('0x21')](function(_0x34cf68){_0x1ae743['rows']=_0x34cf68;return _0x1ae743;})[_0xd886('0x21')](respondWithFilteredResult(_0xe125f7,_0x354058))[_0xd886('0x3e')](handleError(_0xe125f7,null));};exports[_0xd886('0x3f')]=function(_0x1090ce,_0x1a8533){var _0x273157={'raw':!![],'where':{'id':_0x1090ce['params']['id']}},_0x3c6337={};_0x3c6337['model']=_[_0xd886('0x2f')](db[_0xd886('0x28')][_0xd886('0x29')]);_0x3c6337[_0xd886('0x2e')]=_[_0xd886('0x2f')](_0x1090ce[_0xd886('0x2e')]);_0x3c6337['filters']=_[_0xd886('0x40')](_0x3c6337['model'],_0x3c6337[_0xd886('0x2e')]);_0x273157['attributes']=_['intersection'](_0x3c6337['model'],qs['fields'](_0x1090ce[_0xd886('0x2e')][_0xd886('0x32')]));_0x273157[_0xd886('0x31')]=_0x273157['attributes'][_0xd886('0x41')]?_0x273157[_0xd886('0x31')]:_0x3c6337[_0xd886('0x2d')];if(_0x1090ce[_0xd886('0x2e')][_0xd886('0x3b')]){_0x273157['include']=[{'all':!![]}];}_0x273157=_[_0xd886('0x39')]({},_0x273157,_0x1090ce[_0xd886('0x42')]);return db['JscriptyAnswerReport'][_0xd886('0x43')](_0x273157)['then'](handleEntityNotFound(_0x1a8533,null))[_0xd886('0x21')](respondWithResult(_0x1a8533,null))[_0xd886('0x3e')](handleError(_0x1a8533,null));};exports[_0xd886('0x44')]=function(_0x722593,_0x35cd31){return db[_0xd886('0x28')][_0xd886('0x44')](_0x722593[_0xd886('0x45')],{})['then'](respondWithResult(_0x35cd31,0xc9))['catch'](handleError(_0x35cd31,null));};exports['update']=function(_0x521c98,_0x521fb3){if(_0x521c98[_0xd886('0x45')]['id']){delete _0x521c98[_0xd886('0x45')]['id'];}return db[_0xd886('0x28')]['find']({'where':{'id':_0x521c98['params']['id']}})[_0xd886('0x21')](handleEntityNotFound(_0x521fb3,null))[_0xd886('0x21')](saveUpdates(_0x521c98[_0xd886('0x45')],null))[_0xd886('0x21')](respondWithResult(_0x521fb3,null))[_0xd886('0x3e')](handleError(_0x521fb3,null));};exports['destroy']=function(_0x1a3e25,_0x4b4afb){return db[_0xd886('0x28')][_0xd886('0x43')]({'where':{'id':_0x1a3e25['params']['id']}})['then'](handleEntityNotFound(_0x4b4afb,null))[_0xd886('0x21')](removeEntity(_0x4b4afb,null))[_0xd886('0x3e')](handleError(_0x4b4afb,null));};exports[_0xd886('0x46')]=function(_0x510a2f,_0x25f192){return db[_0xd886('0x28')][_0xd886('0x46')]()[_0xd886('0x21')](respondWithResult(_0x25f192,null))[_0xd886('0x3e')](handleError(_0x25f192,null));}; \ No newline at end of file +var _0xe80d=['params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','send','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','show'];(function(_0x156a9f,_0x4161d1){var _0x43902d=function(_0x4a27bd){while(--_0x4a27bd){_0x156a9f['push'](_0x156a9f['shift']());}};_0x43902d(++_0x4161d1);}(_0xe80d,0x13a));var _0xde80=function(_0x384c01,_0x1e0dc5){_0x384c01=_0x384c01-0x0;var _0x300793=_0xe80d[_0x384c01];return _0x300793;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xde80('0x0'));var rimraf=require(_0xde80('0x1'));var zipdir=require(_0xde80('0x2'));var jsonpatch=require(_0xde80('0x3'));var rp=require(_0xde80('0x4'));var moment=require(_0xde80('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xde80('0x6'));var path=require(_0xde80('0x7'));var sox=require(_0xde80('0x8'));var csv=require(_0xde80('0x9'));var ejs=require(_0xde80('0xa'));var fs=require('fs');var _=require(_0xde80('0xb'));var squel=require(_0xde80('0xc'));var crypto=require('crypto');var jsforce=require(_0xde80('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xde80('0x9'));var querystring=require(_0xde80('0xe'));var Papa=require(_0xde80('0xf'));var Redis=require(_0xde80('0x10'));var authService=require(_0xde80('0x11'));var qs=require(_0xde80('0x12'));var as=require(_0xde80('0x13'));var hardwareService=require(_0xde80('0x14'));var logger=require(_0xde80('0x15'))(_0xde80('0x16'));var utils=require(_0xde80('0x17'));var config=require(_0xde80('0x18'));var db=require(_0xde80('0x19'))['db'];function respondWithStatusCode(_0x4b3ef9,_0x517793){_0x517793=_0x517793||0xcc;return function(_0x52f7d1){if(_0x52f7d1){return _0x4b3ef9['sendStatus'](_0x517793);}return _0x4b3ef9[_0xde80('0x1a')](_0x517793)[_0xde80('0x1b')]();};}function respondWithResult(_0x4e9d1d,_0x1eda18){_0x1eda18=_0x1eda18||0xc8;return function(_0x354e0f){if(_0x354e0f){return _0x4e9d1d[_0xde80('0x1a')](_0x1eda18)[_0xde80('0x1c')](_0x354e0f);}};}function respondWithFilteredResult(_0x278156,_0x2c2a7e){return function(_0x2476de){if(_0x2476de){var _0x48cbb1=_0x2476de[_0xde80('0x1d')],_0x11666a=_0x2c2a7e[_0xde80('0x1e')],_0x409cf5=_0x2c2a7e['offset']+_0x2c2a7e[_0xde80('0x1f')],_0x9222e7;if(_0x409cf5>=_0x48cbb1){_0x409cf5=_0x48cbb1;_0x9222e7=0xc8;}else{_0x9222e7=0xce;}_0x278156[_0xde80('0x1a')](_0x9222e7);return _0x278156[_0xde80('0x20')](_0xde80('0x21'),_0x11666a+'-'+_0x409cf5+'/'+_0x48cbb1)[_0xde80('0x1c')](_0x2476de);}return null;};}function patchUpdates(_0x2a9d8c){return function(_0x4d19e6){try{jsonpatch[_0xde80('0x22')](_0x4d19e6,_0x2a9d8c,!![]);}catch(_0x2a8aea){return BPromise['reject'](_0x2a8aea);}return _0x4d19e6[_0xde80('0x23')]();};}function saveUpdates(_0x18c29e,_0x5cc4bd){return function(_0x3d82d1){if(_0x3d82d1){return _0x3d82d1[_0xde80('0x24')](_0x18c29e)['then'](function(_0x1858e2){return _0x1858e2;});}return null;};}function removeEntity(_0x2fd875,_0x381b2e){return function(_0x14b590){if(_0x14b590){return _0x14b590[_0xde80('0x25')]()['then'](function(){_0x2fd875['status'](0xcc)[_0xde80('0x1b')]();});}};}function handleEntityNotFound(_0x10c319,_0x175dc5){return function(_0x3ac7b7){if(!_0x3ac7b7){_0x10c319[_0xde80('0x26')](0x194);}return _0x3ac7b7;};}function handleError(_0x366c96,_0xb19169){_0xb19169=_0xb19169||0x1f4;return function(_0x2caa51){logger[_0xde80('0x27')](_0x2caa51[_0xde80('0x28')]);if(_0x2caa51[_0xde80('0x29')]){delete _0x2caa51[_0xde80('0x29')];}_0x366c96[_0xde80('0x1a')](_0xb19169)[_0xde80('0x2a')](_0x2caa51);};}exports['index']=function(_0x40398b,_0x5a3e31){var _0x4aaef7={},_0x59495b={},_0x4db5db={'count':0x0,'rows':[]};var _0x15cc23=_['map'](db[_0xde80('0x2b')][_0xde80('0x2c')],function(_0x2e31dc){return{'name':_0x2e31dc[_0xde80('0x2d')],'type':_0x2e31dc[_0xde80('0x2e')]['key']};});_0x59495b[_0xde80('0x2f')]=_[_0xde80('0x30')](_0x15cc23,_0xde80('0x29'));_0x59495b[_0xde80('0x31')]=_[_0xde80('0x32')](_0x40398b[_0xde80('0x31')]);_0x59495b[_0xde80('0x33')]=_[_0xde80('0x34')](_0x59495b[_0xde80('0x2f')],_0x59495b['query']);_0x4aaef7['attributes']=_[_0xde80('0x34')](_0x59495b['model'],qs[_0xde80('0x35')](_0x40398b[_0xde80('0x31')][_0xde80('0x35')]));_0x4aaef7[_0xde80('0x36')]=_0x4aaef7['attributes'][_0xde80('0x37')]?_0x4aaef7[_0xde80('0x36')]:_0x59495b[_0xde80('0x2f')];if(!_0x40398b[_0xde80('0x31')][_0xde80('0x38')](_0xde80('0x39'))){_0x4aaef7[_0xde80('0x1f')]=qs[_0xde80('0x1f')](_0x40398b[_0xde80('0x31')][_0xde80('0x1f')]);_0x4aaef7[_0xde80('0x1e')]=qs['offset'](_0x40398b[_0xde80('0x31')][_0xde80('0x1e')]);}_0x4aaef7['order']=qs[_0xde80('0x3a')](_0x40398b['query'][_0xde80('0x3a')]);_0x4aaef7['where']=qs[_0xde80('0x33')](_[_0xde80('0x3b')](_0x40398b[_0xde80('0x31')],_0x59495b[_0xde80('0x33')]),_0x15cc23);if(_0x40398b[_0xde80('0x31')][_0xde80('0x3c')]){_0x4aaef7[_0xde80('0x3d')]=_[_0xde80('0x3e')](_0x4aaef7[_0xde80('0x3d')],{'$or':_[_0xde80('0x30')](_0x15cc23,function(_0x591023){if(_0x591023[_0xde80('0x2e')]!==_0xde80('0x3f')){var _0x2b7985={};_0x2b7985[_0x591023[_0xde80('0x29')]]={'$like':'%'+_0x40398b[_0xde80('0x31')][_0xde80('0x3c')]+'%'};return _0x2b7985;}})});}_0x4aaef7=_[_0xde80('0x3e')]({},_0x4aaef7,_0x40398b['options']);var _0x1a6b39={'where':_0x4aaef7[_0xde80('0x3d')]};return db['JscriptyAnswerReport']['count'](_0x1a6b39)[_0xde80('0x40')](function(_0x56ed5f){_0x4db5db[_0xde80('0x1d')]=_0x56ed5f;if(_0x40398b[_0xde80('0x31')][_0xde80('0x41')]){_0x4aaef7[_0xde80('0x42')]=[{'all':!![]}];}return db[_0xde80('0x2b')][_0xde80('0x43')](_0x4aaef7);})[_0xde80('0x40')](function(_0x18483e){_0x4db5db[_0xde80('0x44')]=_0x18483e;return _0x4db5db;})['then'](respondWithFilteredResult(_0x5a3e31,_0x4aaef7))[_0xde80('0x45')](handleError(_0x5a3e31,null));};exports[_0xde80('0x46')]=function(_0x1ad480,_0x53434b){var _0x2b8422={'raw':!![],'where':{'id':_0x1ad480[_0xde80('0x47')]['id']}},_0x32549b={};_0x32549b[_0xde80('0x2f')]=_[_0xde80('0x32')](db[_0xde80('0x2b')][_0xde80('0x2c')]);_0x32549b[_0xde80('0x31')]=_[_0xde80('0x32')](_0x1ad480[_0xde80('0x31')]);_0x32549b[_0xde80('0x33')]=_[_0xde80('0x34')](_0x32549b['model'],_0x32549b['query']);_0x2b8422[_0xde80('0x36')]=_[_0xde80('0x34')](_0x32549b[_0xde80('0x2f')],qs[_0xde80('0x35')](_0x1ad480[_0xde80('0x31')][_0xde80('0x35')]));_0x2b8422['attributes']=_0x2b8422['attributes'][_0xde80('0x37')]?_0x2b8422[_0xde80('0x36')]:_0x32549b[_0xde80('0x2f')];if(_0x1ad480[_0xde80('0x31')]['includeAll']){_0x2b8422[_0xde80('0x42')]=[{'all':!![]}];}_0x2b8422=_['merge']({},_0x2b8422,_0x1ad480[_0xde80('0x48')]);return db['JscriptyAnswerReport'][_0xde80('0x49')](_0x2b8422)[_0xde80('0x40')](handleEntityNotFound(_0x53434b,null))[_0xde80('0x40')](respondWithResult(_0x53434b,null))[_0xde80('0x45')](handleError(_0x53434b,null));};exports['create']=function(_0x2bef2b,_0x1bcce7){return db[_0xde80('0x2b')][_0xde80('0x4a')](_0x2bef2b[_0xde80('0x4b')],{})[_0xde80('0x40')](respondWithResult(_0x1bcce7,0xc9))[_0xde80('0x45')](handleError(_0x1bcce7,null));};exports[_0xde80('0x24')]=function(_0x1464c3,_0x331e3b){if(_0x1464c3[_0xde80('0x4b')]['id']){delete _0x1464c3[_0xde80('0x4b')]['id'];}return db['JscriptyAnswerReport'][_0xde80('0x49')]({'where':{'id':_0x1464c3[_0xde80('0x47')]['id']}})['then'](handleEntityNotFound(_0x331e3b,null))[_0xde80('0x40')](saveUpdates(_0x1464c3['body'],null))[_0xde80('0x40')](respondWithResult(_0x331e3b,null))[_0xde80('0x45')](handleError(_0x331e3b,null));};exports['destroy']=function(_0x4638c9,_0x49a9f0){return db[_0xde80('0x2b')][_0xde80('0x49')]({'where':{'id':_0x4638c9[_0xde80('0x47')]['id']}})[_0xde80('0x40')](handleEntityNotFound(_0x49a9f0,null))[_0xde80('0x40')](removeEntity(_0x49a9f0,null))['catch'](handleError(_0x49a9f0,null));};exports[_0xde80('0x4c')]=function(_0x2674fa,_0x1fd4e0){return db[_0xde80('0x2b')]['describe']()[_0xde80('0x40')](respondWithResult(_0x1fd4e0,null))['catch'](handleError(_0x1fd4e0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 01bf6e8..0a78ecf 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 _0x3eed=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x34596a,_0x4f5372){var _0x1695ec=function(_0x5d0080){while(--_0x5d0080){_0x34596a['push'](_0x34596a['shift']());}};_0x1695ec(++_0x4f5372);}(_0x3eed,0x162));var _0xd3ee=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3eed[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd3ee('0x0'));var util=require(_0xd3ee('0x1'));var logger=require('../../config/logger')(_0xd3ee('0x2'));var moment=require(_0xd3ee('0x3'));var BPromise=require('bluebird');var rp=require(_0xd3ee('0x4'));var fs=require('fs');var path=require(_0xd3ee('0x5'));var rimraf=require(_0xd3ee('0x6'));var config=require(_0xd3ee('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x1aeeb7,_0x525b7a){return _0x1aeeb7[_0xd3ee('0x8')](_0xd3ee('0x9'),attributes,{'tableName':_0xd3ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc47f=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0xc47f,0xb0));var _0xfc47=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc47f[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xfc47('0x0'));var util=require(_0xfc47('0x1'));var logger=require(_0xfc47('0x2'))(_0xfc47('0x3'));var moment=require(_0xfc47('0x4'));var BPromise=require('bluebird');var rp=require(_0xfc47('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc47('0x6'));var config=require(_0xfc47('0x7'));var attributes=require(_0xfc47('0x8'));module['exports']=function(_0x564d06,_0x32b6e8){return _0x564d06[_0xfc47('0x9')](_0xfc47('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index ebd7e5b..8eca3a9 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 _0x9348=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4539ca,_0x3a07cd){var _0x552d4a=function(_0x5413d1){while(--_0x5413d1){_0x4539ca['push'](_0x4539ca['shift']());}};_0x552d4a(++_0x3a07cd);}(_0x9348,0x10d));var _0x8934=function(_0x5cbe77,_0x47d45d){_0x5cbe77=_0x5cbe77-0x0;var _0x546a1e=_0x9348[_0x5cbe77];return _0x546a1e;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var moment=require(_0x8934('0x2'));var BPromise=require(_0x8934('0x3'));var rs=require(_0x8934('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require('../../config/logger')(_0x8934('0x7'));var config=require(_0x8934('0x8'));var jayson=require(_0x8934('0x9'));var client=jayson[_0x8934('0xa')][_0x8934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee9b9,_0x512f30,_0x284a62){return new BPromise(function(_0x3734c5,_0x1c7f03){return client['request'](_0x3ee9b9,_0x284a62)['then'](function(_0x5ec16d){logger['info'](_0x8934('0xc'),_0x512f30,'request\x20sent');logger[_0x8934('0xd')](_0x8934('0xe'),_0x512f30,_0x8934('0xf'),JSON[_0x8934('0x10')](_0x5ec16d));if(_0x5ec16d[_0x8934('0x11')]){if(_0x5ec16d[_0x8934('0x11')][_0x8934('0x12')]===0x1f4){logger[_0x8934('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x512f30,_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);return _0x1c7f03(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0x5ec16d['error'][_0x8934('0x13')]);return _0x3734c5(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}else{logger[_0x8934('0x14')](_0x8934('0xc'),_0x512f30,_0x8934('0xf'));_0x3734c5(_0x5ec16d[_0x8934('0x15')][_0x8934('0x13')]);}})['catch'](function(_0xb86bc9){logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0xb86bc9);_0x1c7f03(_0xb86bc9);});});} \ No newline at end of file +var _0x070b=['request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x384b3e,_0x5eded9){var _0x1caef0=function(_0x4ac765){while(--_0x4ac765){_0x384b3e['push'](_0x384b3e['shift']());}};_0x1caef0(++_0x5eded9);}(_0x070b,0xa6));var _0xb070=function(_0x3b96f0,_0x3eda43){_0x3b96f0=_0x3b96f0-0x0;var _0x1a65e9=_0x070b[_0x3b96f0];return _0x1a65e9;};'use strict';var _=require(_0xb070('0x0'));var util=require(_0xb070('0x1'));var moment=require(_0xb070('0x2'));var BPromise=require(_0xb070('0x3'));var rs=require(_0xb070('0x4'));var fs=require('fs');var Redis=require(_0xb070('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb070('0x6'));var logger=require(_0xb070('0x7'))(_0xb070('0x8'));var config=require(_0xb070('0x9'));var jayson=require(_0xb070('0xa'));var client=jayson[_0xb070('0xb')][_0xb070('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3afc44,_0x440ff6,_0x4cdeb2){return new BPromise(function(_0x12be6c,_0x3f5806){return client[_0xb070('0xd')](_0x3afc44,_0x4cdeb2)[_0xb070('0xe')](function(_0xfcd69){logger[_0xb070('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x440ff6,_0xb070('0x10'));logger[_0xb070('0x11')](_0xb070('0x12'),_0x440ff6,_0xb070('0x10'),JSON[_0xb070('0x13')](_0xfcd69));if(_0xfcd69[_0xb070('0x14')]){if(_0xfcd69[_0xb070('0x14')][_0xb070('0x15')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x440ff6,_0xfcd69['error'][_0xb070('0x16')]);return _0x3f5806(_0xfcd69[_0xb070('0x14')]['message']);}logger[_0xb070('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x440ff6,_0xfcd69['error'][_0xb070('0x16')]);return _0x12be6c(_0xfcd69[_0xb070('0x14')][_0xb070('0x16')]);}else{logger[_0xb070('0xf')](_0xb070('0x17'),_0x440ff6,_0xb070('0x10'));_0x12be6c(_0xfcd69[_0xb070('0x18')][_0xb070('0x16')]);}})[_0xb070('0x19')](function(_0xd3be36){logger['error'](_0xb070('0x17'),_0x440ff6,_0xd3be36);_0x3f5806(_0xd3be36);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1572943..83b1c92 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 _0x8ffd=['../../components/auth/service','./jscriptyProject.controller','isAuthenticated','index','/:id','show','get','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','clone','put','update','delete','exports','multer','path','express','Router'];(function(_0x370d20,_0x4d7c3c){var _0x35cf78=function(_0x33d5c9){while(--_0x33d5c9){_0x370d20['push'](_0x370d20['shift']());}};_0x35cf78(++_0x4d7c3c);}(_0x8ffd,0x18c));var _0xd8ff=function(_0xeb7786,_0x53a053){_0xeb7786=_0xeb7786-0x0;var _0x120bbc=_0x8ffd[_0xeb7786];return _0x120bbc;};'use strict';var multer=require(_0xd8ff('0x0'));var util=require('util');var path=require(_0xd8ff('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8ff('0x2'));var router=express[_0xd8ff('0x3')]();var auth=require(_0xd8ff('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd8ff('0x5'));router['get']('/',auth[_0xd8ff('0x6')](),controller[_0xd8ff('0x7')]);router['get'](_0xd8ff('0x8'),auth[_0xd8ff('0x6')](),controller[_0xd8ff('0x9')]);router[_0xd8ff('0xa')](_0xd8ff('0xb'),auth[_0xd8ff('0x6')](),controller[_0xd8ff('0xc')]);router['get'](_0xd8ff('0xd'),auth[_0xd8ff('0x6')](),controller[_0xd8ff('0xe')]);router[_0xd8ff('0xa')](_0xd8ff('0xf'),auth[_0xd8ff('0x6')](),timeout('30s'),controller[_0xd8ff('0x10')]);router[_0xd8ff('0x11')]('/',auth[_0xd8ff('0x6')](),controller[_0xd8ff('0x12')]);router[_0xd8ff('0x11')](_0xd8ff('0x13'),auth[_0xd8ff('0x6')](),controller[_0xd8ff('0x14')]);router[_0xd8ff('0x15')](_0xd8ff('0x8'),auth['isAuthenticated'](),controller[_0xd8ff('0x16')]);router[_0xd8ff('0x17')]('/:id',auth[_0xd8ff('0x6')](),controller['destroy']);module[_0xd8ff('0x18')]=router; \ No newline at end of file +var _0x61f6=['get','/:id','show','/:id/sessions','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x61f6,0x128));var _0x661f=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0x61f6[_0x40b493];return _0x548365;};'use strict';var multer=require(_0x661f('0x0'));var util=require(_0x661f('0x1'));var path=require(_0x661f('0x2'));var timeout=require(_0x661f('0x3'));var express=require(_0x661f('0x4'));var router=express[_0x661f('0x5')]();var auth=require(_0x661f('0x6'));var interaction=require(_0x661f('0x7'));var config=require(_0x661f('0x8'));var controller=require(_0x661f('0x9'));router['get']('/',auth[_0x661f('0xa')](),controller[_0x661f('0xb')]);router[_0x661f('0xc')](_0x661f('0xd'),auth[_0x661f('0xa')](),controller[_0x661f('0xe')]);router[_0x661f('0xc')](_0x661f('0xf'),auth[_0x661f('0xa')](),controller['getSessions']);router['get']('/:id/answers',auth['isAuthenticated'](),controller[_0x661f('0x10')]);router['get'](_0x661f('0x11'),auth[_0x661f('0xa')](),timeout(_0x661f('0x12')),controller['getSummary']);router[_0x661f('0x13')]('/',auth[_0x661f('0xa')](),controller[_0x661f('0x14')]);router[_0x661f('0x13')](_0x661f('0x15'),auth[_0x661f('0xa')](),controller[_0x661f('0x16')]);router[_0x661f('0x17')](_0x661f('0xd'),auth['isAuthenticated'](),controller[_0x661f('0x18')]);router[_0x661f('0x19')](_0x661f('0xd'),auth[_0x661f('0xa')](),controller[_0x661f('0x1a')]);module[_0x661f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 112364f..0a541ad 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 _0x6e52=['exports','STRING','TEXT','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN','sequelize','lodash'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x6e52,0x166));var _0x26e5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e52[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x26e5('0x0'));var _=require(_0x26e5('0x1'));var util=require('util');module[_0x26e5('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x26e5('0x3')]},'formData':{'type':Sequelize[_0x26e5('0x4')]('long'),'set':function(_0x5d0051){if(_[_0x26e5('0x5')](_0x5d0051)){this['setDataValue'](_0x26e5('0x6'),JSON[_0x26e5('0x7')](_0x5d0051));}else if(_[_0x26e5('0x8')](_0x5d0051)){this[_0x26e5('0x9')](_0x26e5('0x6'),_0x5d0051);}else{this[_0x26e5('0x9')]('formData',util[_0x26e5('0xa')](_0x26e5('0xb'),this[_0x26e5('0xc')](_0x26e5('0xd'))||'',this[_0x26e5('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x26e5('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x15b9=['description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue','format','getDataValue'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x15b9,0xdf));var _0x915b=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0x15b9[_0x36b037];return _0x409194;};'use strict';var Sequelize=require(_0x915b('0x0'));var _=require(_0x915b('0x1'));var util=require(_0x915b('0x2'));module[_0x915b('0x3')]={'name':{'type':Sequelize[_0x915b('0x4')],'unique':_0x915b('0x5')},'description':{'type':Sequelize[_0x915b('0x4')]},'formData':{'type':Sequelize[_0x915b('0x6')](_0x915b('0x7')),'set':function(_0x56aff2){if(_[_0x915b('0x8')](_0x56aff2)){this['setDataValue'](_0x915b('0x9'),JSON[_0x915b('0xa')](_0x56aff2));}else if(_[_0x915b('0xb')](_0x56aff2)){this[_0x915b('0xc')](_0x915b('0x9'),_0x56aff2);}else{this[_0x915b('0xc')](_0x915b('0x9'),util[_0x915b('0xd')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x915b('0x5'))||'',this[_0x915b('0xe')](_0x915b('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x915b('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x915b('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 5799aa7..be289dc 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 _0x3514=['attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','update','then','destroy','Projects','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','get','createdAt','updatedAt','omit','role','error','getSessions','findOne','JscriptySessionReport','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','starttime','-createdAt','questionId','question','format','SessionId','answer','push','writeFileSync','setHeader','Content-disposition'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3514,0xe5));var _0x4351=function(_0x507cdc,_0x42b97a){_0x507cdc=_0x507cdc-0x0;var _0x2c1828=_0x3514[_0x507cdc];return _0x2c1828;};'use strict';var pdf=require(_0x4351('0x0'));var emlformat=require(_0x4351('0x1'));var rimraf=require(_0x4351('0x2'));var zipdir=require(_0x4351('0x3'));var jsonpatch=require(_0x4351('0x4'));var rp=require('request-promise');var moment=require(_0x4351('0x5'));var BPromise=require(_0x4351('0x6'));var Mustache=require(_0x4351('0x7'));var util=require(_0x4351('0x8'));var path=require(_0x4351('0x9'));var sox=require('sox');var csv=require(_0x4351('0xa'));var ejs=require(_0x4351('0xb'));var fs=require('fs');var _=require(_0x4351('0xc'));var squel=require(_0x4351('0xd'));var crypto=require('crypto');var jsforce=require(_0x4351('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4351('0xa'));var querystring=require(_0x4351('0xf'));var Papa=require(_0x4351('0x10'));var Redis=require(_0x4351('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4351('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4351('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4351('0x14'))['db'];function respondWithStatusCode(_0x2f17f0,_0x482a32){_0x482a32=_0x482a32||0xcc;return function(_0x5aee4f){if(_0x5aee4f){return _0x2f17f0[_0x4351('0x15')](_0x482a32);}return _0x2f17f0[_0x4351('0x16')](_0x482a32)[_0x4351('0x17')]();};}function respondWithResult(_0x3827dc,_0x335d0f){_0x335d0f=_0x335d0f||0xc8;return function(_0xd0abec){if(_0xd0abec){return _0x3827dc['status'](_0x335d0f)['json'](_0xd0abec);}};}function respondWithFilteredResult(_0x543eb6,_0x259304){return function(_0x3dd9df){if(_0x3dd9df){var _0x3e51b5=_0x3dd9df[_0x4351('0x18')],_0x3063a6=_0x259304[_0x4351('0x19')],_0x50503e=_0x259304[_0x4351('0x19')]+_0x259304['limit'],_0x1a39f9;if(_0x50503e>=_0x3e51b5){_0x50503e=_0x3e51b5;_0x1a39f9=0xc8;}else{_0x1a39f9=0xce;}_0x543eb6[_0x4351('0x16')](_0x1a39f9);return _0x543eb6[_0x4351('0x1a')]('Content-Range',_0x3063a6+'-'+_0x50503e+'/'+_0x3e51b5)[_0x4351('0x1b')](_0x3dd9df);}return null;};}function patchUpdates(_0x310974){return function(_0x2db330){try{jsonpatch[_0x4351('0x1c')](_0x2db330,_0x310974,!![]);}catch(_0x4e696e){return BPromise[_0x4351('0x1d')](_0x4e696e);}return _0x2db330['save']();};}function saveUpdates(_0x3b65a2,_0x19aed7){return function(_0x56035b){if(_0x56035b){return _0x56035b[_0x4351('0x1e')](_0x3b65a2)[_0x4351('0x1f')](function(_0xce7580){return _0xce7580;});}return null;};}function removeEntity(_0x2d0ca2,_0xa5335f){return function(_0x534641){if(_0x534641){return _0x534641[_0x4351('0x20')]()[_0x4351('0x1f')](function(){var _0x259ba6=_0x534641['get']({'plain':!![]});var _0x24c673=_0x4351('0x21');return db[_0x4351('0x22')][_0x4351('0x20')]({'where':{'type':_0x24c673,'resourceId':_0x259ba6['id']}})[_0x4351('0x1f')](function(){return _0x534641;});})[_0x4351('0x1f')](function(){_0x2d0ca2[_0x4351('0x16')](0xcc)[_0x4351('0x17')]();});}};}function handleEntityNotFound(_0x40d182,_0xf75786){return function(_0xd66146){if(!_0xd66146){_0x40d182[_0x4351('0x15')](0x194);}return _0xd66146;};}function handleError(_0x444f81,_0x334cef){_0x334cef=_0x334cef||0x1f4;return function(_0x5e9e1f){logger['error'](_0x5e9e1f[_0x4351('0x23')]);if(_0x5e9e1f[_0x4351('0x24')]){delete _0x5e9e1f[_0x4351('0x24')];}_0x444f81[_0x4351('0x16')](_0x334cef)[_0x4351('0x25')](_0x5e9e1f);};}exports[_0x4351('0x26')]=function(_0x513a63,_0xa60246){var _0x553075={},_0x11a6c3={},_0x29276f={'count':0x0,'rows':[]};var _0x1516be=_['map'](db['JscriptyProject'][_0x4351('0x27')],function(_0x598bfc){return{'name':_0x598bfc[_0x4351('0x28')],'type':_0x598bfc[_0x4351('0x29')]['key']};});_0x11a6c3[_0x4351('0x2a')]=_['map'](_0x1516be,_0x4351('0x24'));_0x11a6c3[_0x4351('0x2b')]=_[_0x4351('0x2c')](_0x513a63[_0x4351('0x2b')]);_0x11a6c3['filters']=_[_0x4351('0x2d')](_0x11a6c3[_0x4351('0x2a')],_0x11a6c3[_0x4351('0x2b')]);_0x553075[_0x4351('0x2e')]=_['intersection'](_0x11a6c3[_0x4351('0x2a')],qs[_0x4351('0x2f')](_0x513a63[_0x4351('0x2b')][_0x4351('0x2f')]));_0x553075[_0x4351('0x2e')]=_0x553075['attributes'][_0x4351('0x30')]?_0x553075[_0x4351('0x2e')]:_0x11a6c3['model'];if(!_0x513a63[_0x4351('0x2b')][_0x4351('0x31')](_0x4351('0x32'))){_0x553075[_0x4351('0x33')]=qs[_0x4351('0x33')](_0x513a63[_0x4351('0x2b')][_0x4351('0x33')]);_0x553075[_0x4351('0x19')]=qs[_0x4351('0x19')](_0x513a63['query'][_0x4351('0x19')]);}_0x553075[_0x4351('0x34')]=qs['sort'](_0x513a63[_0x4351('0x2b')][_0x4351('0x35')]);_0x553075['where']=qs[_0x4351('0x36')](_[_0x4351('0x37')](_0x513a63['query'],_0x11a6c3[_0x4351('0x36')]),_0x1516be);if(_0x513a63['query'][_0x4351('0x38')]){_0x553075[_0x4351('0x39')]=_[_0x4351('0x3a')](_0x553075[_0x4351('0x39')],{'$or':_[_0x4351('0x3b')](_0x1516be,function(_0x5d52a4){if(_0x5d52a4[_0x4351('0x29')]!==_0x4351('0x3c')){var _0x3c7443={};_0x3c7443[_0x5d52a4[_0x4351('0x24')]]={'$like':'%'+_0x513a63['query']['filter']+'%'};return _0x3c7443;}})});}_0x553075=_['merge']({},_0x553075,_0x513a63[_0x4351('0x3d')]);var _0x4d3f87={'where':_0x553075['where']};return db[_0x4351('0x3e')][_0x4351('0x18')](_0x4d3f87)['then'](function(_0x550151){_0x29276f[_0x4351('0x18')]=_0x550151;if(_0x513a63[_0x4351('0x2b')][_0x4351('0x3f')]){_0x553075[_0x4351('0x40')]=[{'all':!![]}];}return db[_0x4351('0x3e')]['findAll'](_0x553075);})['then'](function(_0x300cb3){_0x29276f[_0x4351('0x41')]=_0x300cb3;return _0x29276f;})[_0x4351('0x1f')](respondWithFilteredResult(_0xa60246,_0x553075))[_0x4351('0x42')](handleError(_0xa60246,null));};exports[_0x4351('0x43')]=function(_0x501235,_0x21d9c8){var _0x518460={'raw':![],'where':{'id':_0x501235[_0x4351('0x44')]['id']}},_0x400a4d={};_0x400a4d[_0x4351('0x2a')]=_['keys'](db[_0x4351('0x3e')][_0x4351('0x27')]);_0x400a4d[_0x4351('0x2b')]=_[_0x4351('0x2c')](_0x501235[_0x4351('0x2b')]);_0x400a4d[_0x4351('0x36')]=_[_0x4351('0x2d')](_0x400a4d[_0x4351('0x2a')],_0x400a4d[_0x4351('0x2b')]);_0x518460[_0x4351('0x2e')]=_[_0x4351('0x2d')](_0x400a4d['model'],qs[_0x4351('0x2f')](_0x501235[_0x4351('0x2b')][_0x4351('0x2f')]));_0x518460[_0x4351('0x2e')]=_0x518460[_0x4351('0x2e')]['length']?_0x518460['attributes']:_0x400a4d[_0x4351('0x2a')];if(_0x501235[_0x4351('0x2b')][_0x4351('0x3f')]){_0x518460[_0x4351('0x40')]=[{'all':!![]}];}_0x518460=_[_0x4351('0x3a')]({},_0x518460,_0x501235['options']);return db[_0x4351('0x3e')]['find'](_0x518460)[_0x4351('0x1f')](handleEntityNotFound(_0x21d9c8,null))[_0x4351('0x1f')](respondWithResult(_0x21d9c8,null))[_0x4351('0x42')](handleError(_0x21d9c8,null));};exports[_0x4351('0x45')]=function(_0x5687cf,_0x58f5ad){return db['JscriptyProject']['create'](_0x5687cf[_0x4351('0x46')],{})['then'](function(_0x168316){var _0x51b565=_0x5687cf[_0x4351('0x47')]['get']({'plain':!![]});if(!_0x51b565)throw new Error(_0x4351('0x48'));if(_0x51b565['role']===_0x4351('0x47')){var _0x212a72=_0x168316['get']({'plain':!![]});var _0x3da02a='Projects';return db[_0x4351('0x49')][_0x4351('0x4a')]({'where':{'name':_0x3da02a,'userProfileId':_0x51b565['userProfileId']},'raw':!![]})[_0x4351('0x1f')](function(_0x415512){if(_0x415512&&_0x415512[_0x4351('0x4b')]===0x0){return db[_0x4351('0x22')][_0x4351('0x45')]({'name':_0x212a72['name'],'resourceId':_0x212a72['id'],'type':_0x415512[_0x4351('0x24')],'sectionId':_0x415512['id']},{})[_0x4351('0x1f')](function(){return _0x168316;});}else{return _0x168316;}})[_0x4351('0x42')](function(_0x38f260){logger['error'](_0x4351('0x4c'),_0x38f260);throw _0x38f260;});}return _0x168316;})[_0x4351('0x1f')](respondWithResult(_0x58f5ad,0xc9))[_0x4351('0x42')](handleError(_0x58f5ad,null));};exports[_0x4351('0x4d')]=function(_0x2a9318,_0x2ff167){var _0x3a1467={'where':{'id':_0x2a9318['params']['id']}},_0x1eb4b2={};_0x1eb4b2[_0x4351('0x2a')]=_[_0x4351('0x2c')](db['JscriptyProject']['rawAttributes']);_0x3a1467['attributes']=_['intersection'](_0x1eb4b2[_0x4351('0x2a')],qs[_0x4351('0x2f')](_0x2a9318[_0x4351('0x2b')][_0x4351('0x2f')]));_0x3a1467[_0x4351('0x2e')]=_0x3a1467[_0x4351('0x2e')][_0x4351('0x30')]?_0x3a1467[_0x4351('0x2e')]:_0x1eb4b2[_0x4351('0x2a')];if(_0x2a9318[_0x4351('0x2b')]['includeAll']){_0x3a1467[_0x4351('0x40')]=[{'all':!![]}];}_0x3a1467=_[_0x4351('0x3a')]({},_0x3a1467,_0x2a9318[_0x4351('0x3d')]);return db['JscriptyProject'][_0x4351('0x4a')](_0x3a1467)[_0x4351('0x1f')](handleEntityNotFound(_0x2ff167,null))[_0x4351('0x1f')](function(_0x4aa82a){if(_0x4aa82a){var _0x3a97ae=_0x4aa82a[_0x4351('0x4e')]({'plain':!![]});_0x3a97ae=qs['omit'](_0x3a97ae,['id',_0x4351('0x4f'),_0x4351('0x50')]);_0x2a9318[_0x4351('0x46')]=_[_0x4351('0x51')](_0x2a9318[_0x4351('0x46')],['id',_0x4351('0x4f'),_0x4351('0x50')]);return db[_0x4351('0x3e')][_0x4351('0x45')](_[_0x4351('0x3a')](_0x3a97ae,_0x2a9318[_0x4351('0x46')]),{'include':_0x2a9318[_0x4351('0x2b')][_0x4351('0x3f')]?[{'all':!![]}]:undefined})[_0x4351('0x1f')](function(_0x4bc045){var _0x4f437b=_0x2a9318[_0x4351('0x47')][_0x4351('0x4e')]({'plain':!![]});if(!_0x4f437b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f437b[_0x4351('0x52')]===_0x4351('0x47')){var _0x4b4885=_0x4bc045[_0x4351('0x4e')]({'plain':!![]});var _0x98968c=_0x4351('0x21');return db['UserProfileSection'][_0x4351('0x4a')]({'where':{'name':_0x98968c,'userProfileId':_0x4f437b['userProfileId']},'raw':!![]})[_0x4351('0x1f')](function(_0x17dd04){if(_0x17dd04&&_0x17dd04[_0x4351('0x4b')]===0x0){return db['UserProfileResource'][_0x4351('0x45')]({'name':_0x4b4885[_0x4351('0x24')],'resourceId':_0x4b4885['id'],'type':_0x17dd04[_0x4351('0x24')],'sectionId':_0x17dd04['id']},{})['then'](function(){return _0x4bc045;});}else{return _0x4bc045;}})['catch'](function(_0x7c7a8f){logger[_0x4351('0x53')](_0x4351('0x4c'),_0x7c7a8f);throw _0x7c7a8f;});}return _0x4bc045;});}})[_0x4351('0x1f')](respondWithResult(_0x2ff167,0xc9))[_0x4351('0x42')](handleError(_0x2ff167,null));};exports[_0x4351('0x1e')]=function(_0x37c768,_0xc93f6d){if(_0x37c768['body']['id']){delete _0x37c768[_0x4351('0x46')]['id'];}return db[_0x4351('0x3e')][_0x4351('0x4a')]({'where':{'id':_0x37c768[_0x4351('0x44')]['id']}})[_0x4351('0x1f')](handleEntityNotFound(_0xc93f6d,null))['then'](saveUpdates(_0x37c768[_0x4351('0x46')],null))[_0x4351('0x1f')](respondWithResult(_0xc93f6d,null))[_0x4351('0x42')](handleError(_0xc93f6d,null));};exports[_0x4351('0x20')]=function(_0x5923cb,_0x228223){return db['JscriptyProject'][_0x4351('0x4a')]({'where':{'id':_0x5923cb[_0x4351('0x44')]['id']}})[_0x4351('0x1f')](handleEntityNotFound(_0x228223,null))[_0x4351('0x1f')](removeEntity(_0x228223,null))[_0x4351('0x42')](handleError(_0x228223,null));};exports[_0x4351('0x54')]=function(_0x2fef46,_0x15ea9a,_0x193769){var _0x34a359={'raw':!![],'where':{}};var _0x439f65={};var _0x57aeb8={'count':0x0,'rows':[]};return db[_0x4351('0x3e')][_0x4351('0x55')]({'where':{'id':_0x2fef46['params']['id']}})[_0x4351('0x1f')](handleEntityNotFound(_0x15ea9a,null))['then'](function(_0x4621d3){if(_0x4621d3){_0x439f65[_0x4351('0x2a')]=_[_0x4351('0x2c')](db[_0x4351('0x56')][_0x4351('0x27')]);_0x439f65[_0x4351('0x2b')]=_['keys'](_0x2fef46[_0x4351('0x2b')]);_0x439f65[_0x4351('0x36')]=_[_0x4351('0x2d')](_0x439f65[_0x4351('0x2a')],_0x439f65[_0x4351('0x2b')]);_0x34a359['attributes']=_[_0x4351('0x2d')](_0x439f65['model'],qs['fields'](_0x2fef46[_0x4351('0x2b')][_0x4351('0x2f')]));_0x34a359[_0x4351('0x2e')]=_0x34a359['attributes'][_0x4351('0x30')]?_0x34a359[_0x4351('0x2e')]:_0x439f65[_0x4351('0x2a')];if(!_0x2fef46['query'][_0x4351('0x31')](_0x4351('0x32'))){_0x34a359['limit']=qs['limit'](_0x2fef46[_0x4351('0x2b')][_0x4351('0x33')]);_0x34a359[_0x4351('0x19')]=qs[_0x4351('0x19')](_0x2fef46['query'][_0x4351('0x19')]);}_0x34a359[_0x4351('0x34')]=qs[_0x4351('0x35')](_0x2fef46[_0x4351('0x2b')][_0x4351('0x35')]);_0x34a359[_0x4351('0x39')]=qs[_0x4351('0x36')](_['pick'](_0x2fef46['query'],_0x439f65[_0x4351('0x36')]));_0x34a359[_0x4351('0x39')][_0x4351('0x57')]=_0x4621d3['id'];if(_0x2fef46['query'][_0x4351('0x38')]){_0x34a359['where']=_[_0x4351('0x3a')](_0x34a359['where'],{'$or':_[_0x4351('0x3b')](_0x34a359['attributes'],function(_0x24eaa8){var _0x151ca6={};_0x151ca6[_0x24eaa8]={'$like':'%'+_0x2fef46[_0x4351('0x2b')][_0x4351('0x38')]+'%'};return _0x151ca6;})});}_0x34a359=_['merge']({},_0x34a359,_0x2fef46[_0x4351('0x3d')]);return db[_0x4351('0x56')][_0x4351('0x18')]({'where':_0x34a359[_0x4351('0x39')]})[_0x4351('0x1f')](function(_0x5cac55){_0x57aeb8[_0x4351('0x18')]=_0x5cac55;if(_0x2fef46[_0x4351('0x2b')][_0x4351('0x3f')]){_0x34a359[_0x4351('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x4351('0x58')](_0x34a359);})[_0x4351('0x1f')](function(_0x1c8979){_0x57aeb8[_0x4351('0x41')]=_0x1c8979;return _0x57aeb8;});}})['then'](respondWithFilteredResult(_0x15ea9a,_0x34a359))[_0x4351('0x42')](handleError(_0x15ea9a,null));};exports[_0x4351('0x59')]=function(_0x3fde54,_0x3e0551,_0x5bf397){var _0x2c3ac4={'raw':!![],'where':{}};var _0x27aa3a={};var _0x111752={'count':0x0,'rows':[]};return db[_0x4351('0x3e')][_0x4351('0x55')]({'where':{'id':_0x3fde54[_0x4351('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e0551,null))[_0x4351('0x1f')](function(_0xd68f3a){if(_0xd68f3a){_0x27aa3a['model']=_[_0x4351('0x2c')](db[_0x4351('0x5a')][_0x4351('0x27')]);_0x27aa3a[_0x4351('0x2b')]=_['keys'](_0x3fde54[_0x4351('0x2b')]);_0x27aa3a[_0x4351('0x36')]=_[_0x4351('0x2d')](_0x27aa3a['model'],_0x27aa3a[_0x4351('0x2b')]);_0x2c3ac4[_0x4351('0x2e')]=_[_0x4351('0x2d')](_0x27aa3a[_0x4351('0x2a')],qs[_0x4351('0x2f')](_0x3fde54[_0x4351('0x2b')][_0x4351('0x2f')]));_0x2c3ac4[_0x4351('0x2e')]=_0x2c3ac4[_0x4351('0x2e')][_0x4351('0x30')]?_0x2c3ac4['attributes']:_0x27aa3a['model'];if(!_0x3fde54[_0x4351('0x2b')][_0x4351('0x31')](_0x4351('0x32'))){_0x2c3ac4[_0x4351('0x33')]=qs[_0x4351('0x33')](_0x3fde54[_0x4351('0x2b')]['limit']);_0x2c3ac4[_0x4351('0x19')]=qs[_0x4351('0x19')](_0x3fde54['query']['offset']);}_0x2c3ac4[_0x4351('0x34')]=qs[_0x4351('0x35')](_0x3fde54[_0x4351('0x2b')][_0x4351('0x35')]);_0x2c3ac4[_0x4351('0x39')]=qs['filters'](_['pick'](_0x3fde54[_0x4351('0x2b')],_0x27aa3a[_0x4351('0x36')]));_0x2c3ac4[_0x4351('0x39')][_0x4351('0x57')]=_0xd68f3a['id'];if(_0x3fde54[_0x4351('0x2b')][_0x4351('0x38')]){_0x2c3ac4['where']=_[_0x4351('0x3a')](_0x2c3ac4[_0x4351('0x39')],{'$or':_[_0x4351('0x3b')](_0x2c3ac4[_0x4351('0x2e')],function(_0x11e918){var _0x116f94={};_0x116f94[_0x11e918]={'$like':'%'+_0x3fde54[_0x4351('0x2b')][_0x4351('0x38')]+'%'};return _0x116f94;})});}_0x2c3ac4=_['merge']({},_0x2c3ac4,_0x3fde54['options']);return db[_0x4351('0x5a')]['count']({'where':_0x2c3ac4[_0x4351('0x39')]})[_0x4351('0x1f')](function(_0x84a135){_0x111752['count']=_0x84a135;if(_0x3fde54[_0x4351('0x2b')][_0x4351('0x3f')]){_0x2c3ac4[_0x4351('0x40')]=[{'all':!![]}];}return db[_0x4351('0x5a')][_0x4351('0x58')](_0x2c3ac4);})[_0x4351('0x1f')](function(_0x182454){_0x111752[_0x4351('0x41')]=_0x182454;return _0x111752;});}})['then'](respondWithFilteredResult(_0x3e0551,_0x2c3ac4))['catch'](handleError(_0x3e0551,null));};function char(_0x2fd066){return _0x4351('0x5b')===typeof _0x2fd066?String[_0x4351('0x5c')][_0x4351('0x1c')](null,arguments):_0x2fd066;}function needsEncapsulation(_0x3a9d07){return!!_0x3a9d07&&(_0x3a9d07[_0x4351('0x5d')]()['indexOf'](char(0xd))>=0x0||_0x3a9d07[_0x4351('0x5d')]()[_0x4351('0x5e')](char(0xa))>=0x0||_0x3a9d07[_0x4351('0x5d')]()[_0x4351('0x5e')](char(0x2c))>=0x0||_0x3a9d07['toString']()[_0x4351('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x2e79dc){var _0x59647b=char(0x22),_0xcf0882='\x5c'+char(0x22),_0x242d15=_0x2e79dc[_0x4351('0x5d')]()[_0x4351('0x5f')](new RegExp(_0x59647b,'g'),_0xcf0882);return _0x59647b+_0x242d15+_0x59647b;}exports['getSummary']=function(_0x4fc09f,_0x1910ad,_0x15eedc){var _0x4dac9e,_0x2cefb8;var _0x5f325e={'where':{'ProjectId':_0x4fc09f[_0x4351('0x44')]['id']}};if(_0x4fc09f[_0x4351('0x2b')]['startTime']){_0x5f325e[_0x4351('0x39')][_0x4351('0x60')]=JSON['parse'](_0x4fc09f[_0x4351('0x2b')]['startTime']);}return db[_0x4351('0x56')]['findAll'](_0x5f325e)['then'](handleEntityNotFound(_0x1910ad,null))['then'](function(_0x3220ca){if(_0x3220ca){_0x4dac9e=_0x3220ca;return db['JscriptyQuestionReport'][_0x4351('0x58')]({'where':{'SessionId':{'$in':_[_0x4351('0x3b')](_0x4dac9e,'id')},'ProjectId':_0x4fc09f[_0x4351('0x44')]['id']},'order':_0x4351('0x61')});}})['then'](handleEntityNotFound(_0x1910ad,null))[_0x4351('0x1f')](function(_0x3cc840){if(_0x3cc840){_0x2cefb8=_0x3cc840;var _0xadc4ad={};for(var _0x286a01=0x0,_0x2332b5=_0x2cefb8[_0x4351('0x30')];_0x286a01<_0x2332b5;_0x286a01++){if(!_0xadc4ad[_0x4351('0x31')](_0x2cefb8[_0x286a01][_0x4351('0x62')])){_0xadc4ad[_0x2cefb8[_0x286a01][_0x4351('0x62')]]=needsEncapsulation(_0x2cefb8[_0x286a01][_0x4351('0x63')])?encapsulate(_0x2cefb8[_0x286a01]['question']):_0x2cefb8[_0x286a01]['question'];}}var _0x11df1d=[],_0x430d98={};for(var _0x35d0f1=0x0,_0x28431d=_0x4dac9e['length'];_0x35d0f1<_0x28431d;_0x35d0f1++){_0x430d98={'ProjectId':_0x4fc09f[_0x4351('0x44')]['id'],'SessionId':_0x4dac9e[_0x35d0f1]['id'],'StartTime':moment(_0x4dac9e[_0x35d0f1]['starttime'])[_0x4351('0x64')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x491fd7=0x0,_0x1233be=_0x2cefb8[_0x4351('0x30')];_0x491fd7<_0x1233be;_0x491fd7++){if(_0x2cefb8[_0x491fd7][_0x4351('0x65')]==_0x4dac9e[_0x35d0f1]['id']&&_0xadc4ad[_0x4351('0x31')](_0x2cefb8[_0x491fd7][_0x4351('0x62')])){_0x430d98[_0xadc4ad[_0x2cefb8[_0x491fd7][_0x4351('0x62')]]]=_0x2cefb8[_0x491fd7][_0x4351('0x66')];}}for(var _0x2e571a in _0xadc4ad){if(!_0x430d98['hasOwnProperty'](_0xadc4ad[_0x2e571a])){_0x430d98[_0xadc4ad[_0x2e571a]]=null;}}_0x11df1d[_0x4351('0x67')](_0x430d98);}return _0x11df1d;}})[_0x4351('0x1f')](function(_0x2ec366){if(!_['isEmpty'](_0x2ec366)){var _0x580f52=toCsv(_0x2ec366);var _0x560369=Date['now']();fs[_0x4351('0x68')](util[_0x4351('0x64')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4fc09f[_0x4351('0x44')]['id'],_0x560369),_0x580f52);_0x1910ad[_0x4351('0x69')](_0x4351('0x6a'),_0x4351('0x6b')+util[_0x4351('0x64')](_0x4351('0x6c'),_0x4fc09f[_0x4351('0x44')]['id'],_0x560369));_0x1910ad[_0x4351('0x69')](_0x4351('0x6d'),_0x4351('0x6e'));return _0x1910ad['download'](util[_0x4351('0x64')](_0x4351('0x6f'),_0x4fc09f[_0x4351('0x44')]['id'],_0x560369));}else{return _0x1910ad[_0x4351('0x15')](0xcc);}})[_0x4351('0x42')](handleError(_0x1910ad,null));}; \ No newline at end of file +var _0x07bb=['where','merge','VIRTUAL','options','JscriptyProject','count','includeAll','include','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','UserProfileSection','userProfileId','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','order','number','toString','indexOf','startTime','starttime','findAll','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Projects','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x07bb,0x182));var _0xb07b=function(_0x2c3e9e,_0xa87662){_0x2c3e9e=_0x2c3e9e-0x0;var _0x13058a=_0x07bb[_0x2c3e9e];return _0x13058a;};'use strict';var pdf=require(_0xb07b('0x0'));var emlformat=require(_0xb07b('0x1'));var rimraf=require(_0xb07b('0x2'));var zipdir=require(_0xb07b('0x3'));var jsonpatch=require(_0xb07b('0x4'));var rp=require('request-promise');var moment=require(_0xb07b('0x5'));var BPromise=require(_0xb07b('0x6'));var Mustache=require('mustache');var util=require(_0xb07b('0x7'));var path=require(_0xb07b('0x8'));var sox=require(_0xb07b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb07b('0xa'));var squel=require('squel');var crypto=require(_0xb07b('0xb'));var jsforce=require(_0xb07b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb07b('0xd'));var Redis=require(_0xb07b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb07b('0xf'));var as=require(_0xb07b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb07b('0x11'))(_0xb07b('0x12'));var utils=require('../../config/utils');var config=require(_0xb07b('0x13'));var db=require(_0xb07b('0x14'))['db'];function respondWithStatusCode(_0x322519,_0x543c78){_0x543c78=_0x543c78||0xcc;return function(_0xc8db7){if(_0xc8db7){return _0x322519['sendStatus'](_0x543c78);}return _0x322519['status'](_0x543c78)[_0xb07b('0x15')]();};}function respondWithResult(_0x1ec26b,_0x41ef02){_0x41ef02=_0x41ef02||0xc8;return function(_0x21fabd){if(_0x21fabd){return _0x1ec26b[_0xb07b('0x16')](_0x41ef02)[_0xb07b('0x17')](_0x21fabd);}};}function respondWithFilteredResult(_0x323610,_0x16440d){return function(_0x1b1716){if(_0x1b1716){var _0x3cfaa3=_0x1b1716['count'],_0x4f5698=_0x16440d[_0xb07b('0x18')],_0x3448df=_0x16440d[_0xb07b('0x18')]+_0x16440d[_0xb07b('0x19')],_0x1048c9;if(_0x3448df>=_0x3cfaa3){_0x3448df=_0x3cfaa3;_0x1048c9=0xc8;}else{_0x1048c9=0xce;}_0x323610['status'](_0x1048c9);return _0x323610[_0xb07b('0x1a')](_0xb07b('0x1b'),_0x4f5698+'-'+_0x3448df+'/'+_0x3cfaa3)['json'](_0x1b1716);}return null;};}function patchUpdates(_0x439903){return function(_0x718c25){try{jsonpatch[_0xb07b('0x1c')](_0x718c25,_0x439903,!![]);}catch(_0x1c10a3){return BPromise[_0xb07b('0x1d')](_0x1c10a3);}return _0x718c25['save']();};}function saveUpdates(_0x1b4b20,_0x5d52db){return function(_0x1e6020){if(_0x1e6020){return _0x1e6020[_0xb07b('0x1e')](_0x1b4b20)[_0xb07b('0x1f')](function(_0x823c54){return _0x823c54;});}return null;};}function removeEntity(_0x581393,_0x469ac){return function(_0x432435){if(_0x432435){return _0x432435[_0xb07b('0x20')]()[_0xb07b('0x1f')](function(){var _0x489c96=_0x432435[_0xb07b('0x21')]({'plain':!![]});var _0x24e84f=_0xb07b('0x22');return db[_0xb07b('0x23')][_0xb07b('0x20')]({'where':{'type':_0x24e84f,'resourceId':_0x489c96['id']}})[_0xb07b('0x1f')](function(){return _0x432435;});})[_0xb07b('0x1f')](function(){_0x581393['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14e5ff,_0x4a6638){return function(_0x192641){if(!_0x192641){_0x14e5ff[_0xb07b('0x24')](0x194);}return _0x192641;};}function handleError(_0x56ff28,_0x212ce1){_0x212ce1=_0x212ce1||0x1f4;return function(_0x4d7606){logger['error'](_0x4d7606[_0xb07b('0x25')]);if(_0x4d7606[_0xb07b('0x26')]){delete _0x4d7606[_0xb07b('0x26')];}_0x56ff28['status'](_0x212ce1)['send'](_0x4d7606);};}exports[_0xb07b('0x27')]=function(_0x2c4d60,_0x1c59e5){var _0x264b48={},_0x58ac03={},_0x349903={'count':0x0,'rows':[]};var _0x5856a0=_[_0xb07b('0x28')](db['JscriptyProject'][_0xb07b('0x29')],function(_0xa0a963){return{'name':_0xa0a963[_0xb07b('0x2a')],'type':_0xa0a963[_0xb07b('0x2b')][_0xb07b('0x2c')]};});_0x58ac03[_0xb07b('0x2d')]=_[_0xb07b('0x28')](_0x5856a0,_0xb07b('0x26'));_0x58ac03[_0xb07b('0x2e')]=_[_0xb07b('0x2f')](_0x2c4d60['query']);_0x58ac03[_0xb07b('0x30')]=_[_0xb07b('0x31')](_0x58ac03[_0xb07b('0x2d')],_0x58ac03['query']);_0x264b48[_0xb07b('0x32')]=_[_0xb07b('0x31')](_0x58ac03['model'],qs[_0xb07b('0x33')](_0x2c4d60['query'][_0xb07b('0x33')]));_0x264b48[_0xb07b('0x32')]=_0x264b48[_0xb07b('0x32')][_0xb07b('0x34')]?_0x264b48[_0xb07b('0x32')]:_0x58ac03[_0xb07b('0x2d')];if(!_0x2c4d60['query'][_0xb07b('0x35')](_0xb07b('0x36'))){_0x264b48[_0xb07b('0x19')]=qs['limit'](_0x2c4d60[_0xb07b('0x2e')][_0xb07b('0x19')]);_0x264b48[_0xb07b('0x18')]=qs[_0xb07b('0x18')](_0x2c4d60[_0xb07b('0x2e')]['offset']);}_0x264b48['order']=qs['sort'](_0x2c4d60[_0xb07b('0x2e')][_0xb07b('0x37')]);_0x264b48['where']=qs[_0xb07b('0x30')](_[_0xb07b('0x38')](_0x2c4d60[_0xb07b('0x2e')],_0x58ac03[_0xb07b('0x30')]),_0x5856a0);if(_0x2c4d60['query'][_0xb07b('0x39')]){_0x264b48[_0xb07b('0x3a')]=_[_0xb07b('0x3b')](_0x264b48[_0xb07b('0x3a')],{'$or':_[_0xb07b('0x28')](_0x5856a0,function(_0x12b295){if(_0x12b295[_0xb07b('0x2b')]!==_0xb07b('0x3c')){var _0x193b0a={};_0x193b0a[_0x12b295[_0xb07b('0x26')]]={'$like':'%'+_0x2c4d60['query'][_0xb07b('0x39')]+'%'};return _0x193b0a;}})});}_0x264b48=_[_0xb07b('0x3b')]({},_0x264b48,_0x2c4d60[_0xb07b('0x3d')]);var _0x162dfc={'where':_0x264b48['where']};return db[_0xb07b('0x3e')][_0xb07b('0x3f')](_0x162dfc)[_0xb07b('0x1f')](function(_0x298e1a){_0x349903[_0xb07b('0x3f')]=_0x298e1a;if(_0x2c4d60[_0xb07b('0x2e')][_0xb07b('0x40')]){_0x264b48[_0xb07b('0x41')]=[{'all':!![]}];}return db[_0xb07b('0x3e')]['findAll'](_0x264b48);})[_0xb07b('0x1f')](function(_0x41638c){_0x349903[_0xb07b('0x42')]=_0x41638c;return _0x349903;})[_0xb07b('0x1f')](respondWithFilteredResult(_0x1c59e5,_0x264b48))['catch'](handleError(_0x1c59e5,null));};exports['show']=function(_0x1660c2,_0x18017f){var _0x57e85f={'raw':![],'where':{'id':_0x1660c2[_0xb07b('0x43')]['id']}},_0x393014={};_0x393014['model']=_['keys'](db['JscriptyProject']['rawAttributes']);_0x393014[_0xb07b('0x2e')]=_[_0xb07b('0x2f')](_0x1660c2['query']);_0x393014['filters']=_[_0xb07b('0x31')](_0x393014[_0xb07b('0x2d')],_0x393014[_0xb07b('0x2e')]);_0x57e85f[_0xb07b('0x32')]=_['intersection'](_0x393014[_0xb07b('0x2d')],qs[_0xb07b('0x33')](_0x1660c2['query']['fields']));_0x57e85f[_0xb07b('0x32')]=_0x57e85f[_0xb07b('0x32')][_0xb07b('0x34')]?_0x57e85f[_0xb07b('0x32')]:_0x393014['model'];if(_0x1660c2[_0xb07b('0x2e')]['includeAll']){_0x57e85f[_0xb07b('0x41')]=[{'all':!![]}];}_0x57e85f=_[_0xb07b('0x3b')]({},_0x57e85f,_0x1660c2[_0xb07b('0x3d')]);return db[_0xb07b('0x3e')][_0xb07b('0x44')](_0x57e85f)[_0xb07b('0x1f')](handleEntityNotFound(_0x18017f,null))[_0xb07b('0x1f')](respondWithResult(_0x18017f,null))['catch'](handleError(_0x18017f,null));};exports['create']=function(_0x21d638,_0x28d039){return db[_0xb07b('0x3e')][_0xb07b('0x45')](_0x21d638[_0xb07b('0x46')],{})['then'](function(_0x2d9357){var _0x3e6b4e=_0x21d638[_0xb07b('0x47')]['get']({'plain':!![]});if(!_0x3e6b4e)throw new Error(_0xb07b('0x48'));if(_0x3e6b4e['role']===_0xb07b('0x47')){var _0x1458c7=_0x2d9357[_0xb07b('0x21')]({'plain':!![]});var _0x16c941='Projects';return db['UserProfileSection'][_0xb07b('0x44')]({'where':{'name':_0x16c941,'userProfileId':_0x3e6b4e['userProfileId']},'raw':!![]})[_0xb07b('0x1f')](function(_0x3a6988){if(_0x3a6988&&_0x3a6988[_0xb07b('0x49')]===0x0){return db[_0xb07b('0x23')][_0xb07b('0x45')]({'name':_0x1458c7[_0xb07b('0x26')],'resourceId':_0x1458c7['id'],'type':_0x3a6988[_0xb07b('0x26')],'sectionId':_0x3a6988['id']},{})['then'](function(){return _0x2d9357;});}else{return _0x2d9357;}})[_0xb07b('0x4a')](function(_0xbf3869){logger[_0xb07b('0x4b')](_0xb07b('0x4c'),_0xbf3869);throw _0xbf3869;});}return _0x2d9357;})[_0xb07b('0x1f')](respondWithResult(_0x28d039,0xc9))[_0xb07b('0x4a')](handleError(_0x28d039,null));};exports['clone']=function(_0x41c5fa,_0x4c2e88){var _0x54f6b9={'where':{'id':_0x41c5fa['params']['id']}},_0x502c13={};_0x502c13[_0xb07b('0x2d')]=_['keys'](db[_0xb07b('0x3e')]['rawAttributes']);_0x54f6b9[_0xb07b('0x32')]=_[_0xb07b('0x31')](_0x502c13[_0xb07b('0x2d')],qs[_0xb07b('0x33')](_0x41c5fa[_0xb07b('0x2e')][_0xb07b('0x33')]));_0x54f6b9[_0xb07b('0x32')]=_0x54f6b9[_0xb07b('0x32')][_0xb07b('0x34')]?_0x54f6b9[_0xb07b('0x32')]:_0x502c13[_0xb07b('0x2d')];if(_0x41c5fa['query'][_0xb07b('0x40')]){_0x54f6b9[_0xb07b('0x41')]=[{'all':!![]}];}_0x54f6b9=_['merge']({},_0x54f6b9,_0x41c5fa['options']);return db[_0xb07b('0x3e')][_0xb07b('0x44')](_0x54f6b9)[_0xb07b('0x1f')](handleEntityNotFound(_0x4c2e88,null))[_0xb07b('0x1f')](function(_0x4254a7){if(_0x4254a7){var _0x5631d6=_0x4254a7[_0xb07b('0x21')]({'plain':!![]});_0x5631d6=qs[_0xb07b('0x4d')](_0x5631d6,['id',_0xb07b('0x4e'),'updatedAt']);_0x41c5fa['body']=_[_0xb07b('0x4d')](_0x41c5fa[_0xb07b('0x46')],['id','createdAt',_0xb07b('0x4f')]);return db['JscriptyProject'][_0xb07b('0x45')](_[_0xb07b('0x3b')](_0x5631d6,_0x41c5fa[_0xb07b('0x46')]),{'include':_0x41c5fa[_0xb07b('0x2e')][_0xb07b('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x563aa5){var _0x1d95ee=_0x41c5fa[_0xb07b('0x47')][_0xb07b('0x21')]({'plain':!![]});if(!_0x1d95ee)throw new Error(_0xb07b('0x48'));if(_0x1d95ee['role']===_0xb07b('0x47')){var _0x34ba5b=_0x563aa5['get']({'plain':!![]});var _0x48c674=_0xb07b('0x22');return db[_0xb07b('0x50')]['find']({'where':{'name':_0x48c674,'userProfileId':_0x1d95ee[_0xb07b('0x51')]},'raw':!![]})[_0xb07b('0x1f')](function(_0x2bf686){if(_0x2bf686&&_0x2bf686[_0xb07b('0x49')]===0x0){return db[_0xb07b('0x23')][_0xb07b('0x45')]({'name':_0x34ba5b[_0xb07b('0x26')],'resourceId':_0x34ba5b['id'],'type':_0x2bf686[_0xb07b('0x26')],'sectionId':_0x2bf686['id']},{})['then'](function(){return _0x563aa5;});}else{return _0x563aa5;}})['catch'](function(_0x567f3a){logger[_0xb07b('0x4b')](_0xb07b('0x4c'),_0x567f3a);throw _0x567f3a;});}return _0x563aa5;});}})['then'](respondWithResult(_0x4c2e88,0xc9))[_0xb07b('0x4a')](handleError(_0x4c2e88,null));};exports['update']=function(_0x418107,_0x5d152d){if(_0x418107['body']['id']){delete _0x418107['body']['id'];}return db[_0xb07b('0x3e')]['find']({'where':{'id':_0x418107[_0xb07b('0x43')]['id']}})[_0xb07b('0x1f')](handleEntityNotFound(_0x5d152d,null))[_0xb07b('0x1f')](saveUpdates(_0x418107[_0xb07b('0x46')],null))['then'](respondWithResult(_0x5d152d,null))[_0xb07b('0x4a')](handleError(_0x5d152d,null));};exports[_0xb07b('0x20')]=function(_0x3756f9,_0x2ce273){return db[_0xb07b('0x3e')][_0xb07b('0x44')]({'where':{'id':_0x3756f9['params']['id']}})['then'](handleEntityNotFound(_0x2ce273,null))[_0xb07b('0x1f')](removeEntity(_0x2ce273,null))['catch'](handleError(_0x2ce273,null));};exports[_0xb07b('0x52')]=function(_0x5ec5af,_0x1347a1,_0x178d02){var _0x5636ea={'raw':!![],'where':{}};var _0xff080f={};var _0xbb651a={'count':0x0,'rows':[]};return db[_0xb07b('0x3e')][_0xb07b('0x53')]({'where':{'id':_0x5ec5af[_0xb07b('0x43')]['id']}})['then'](handleEntityNotFound(_0x1347a1,null))[_0xb07b('0x1f')](function(_0x57c6a6){if(_0x57c6a6){_0xff080f['model']=_[_0xb07b('0x2f')](db[_0xb07b('0x54')][_0xb07b('0x29')]);_0xff080f[_0xb07b('0x2e')]=_[_0xb07b('0x2f')](_0x5ec5af['query']);_0xff080f[_0xb07b('0x30')]=_[_0xb07b('0x31')](_0xff080f[_0xb07b('0x2d')],_0xff080f[_0xb07b('0x2e')]);_0x5636ea[_0xb07b('0x32')]=_['intersection'](_0xff080f[_0xb07b('0x2d')],qs[_0xb07b('0x33')](_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x33')]));_0x5636ea[_0xb07b('0x32')]=_0x5636ea[_0xb07b('0x32')][_0xb07b('0x34')]?_0x5636ea[_0xb07b('0x32')]:_0xff080f[_0xb07b('0x2d')];if(!_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x35')](_0xb07b('0x36'))){_0x5636ea['limit']=qs[_0xb07b('0x19')](_0x5ec5af['query']['limit']);_0x5636ea['offset']=qs['offset'](_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x18')]);}_0x5636ea['order']=qs[_0xb07b('0x37')](_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x37')]);_0x5636ea[_0xb07b('0x3a')]=qs[_0xb07b('0x30')](_[_0xb07b('0x38')](_0x5ec5af['query'],_0xff080f[_0xb07b('0x30')]));_0x5636ea[_0xb07b('0x3a')]['ProjectId']=_0x57c6a6['id'];if(_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x39')]){_0x5636ea[_0xb07b('0x3a')]=_[_0xb07b('0x3b')](_0x5636ea['where'],{'$or':_[_0xb07b('0x28')](_0x5636ea[_0xb07b('0x32')],function(_0x2c179b){var _0x314b2d={};_0x314b2d[_0x2c179b]={'$like':'%'+_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x39')]+'%'};return _0x314b2d;})});}_0x5636ea=_[_0xb07b('0x3b')]({},_0x5636ea,_0x5ec5af[_0xb07b('0x3d')]);return db['JscriptySessionReport'][_0xb07b('0x3f')]({'where':_0x5636ea['where']})[_0xb07b('0x1f')](function(_0x61fa38){_0xbb651a[_0xb07b('0x3f')]=_0x61fa38;if(_0x5ec5af[_0xb07b('0x2e')][_0xb07b('0x40')]){_0x5636ea[_0xb07b('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x5636ea);})[_0xb07b('0x1f')](function(_0x5bfd6c){_0xbb651a[_0xb07b('0x42')]=_0x5bfd6c;return _0xbb651a;});}})['then'](respondWithFilteredResult(_0x1347a1,_0x5636ea))[_0xb07b('0x4a')](handleError(_0x1347a1,null));};exports[_0xb07b('0x55')]=function(_0x73b40b,_0x7c4c3,_0x44e9d8){var _0x1d6984={'raw':!![],'where':{}};var _0x567675={};var _0x46e2bd={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xb07b('0x53')]({'where':{'id':_0x73b40b[_0xb07b('0x43')]['id']}})['then'](handleEntityNotFound(_0x7c4c3,null))['then'](function(_0x13f5ce){if(_0x13f5ce){_0x567675[_0xb07b('0x2d')]=_[_0xb07b('0x2f')](db[_0xb07b('0x56')][_0xb07b('0x29')]);_0x567675[_0xb07b('0x2e')]=_[_0xb07b('0x2f')](_0x73b40b[_0xb07b('0x2e')]);_0x567675['filters']=_[_0xb07b('0x31')](_0x567675[_0xb07b('0x2d')],_0x567675['query']);_0x1d6984[_0xb07b('0x32')]=_[_0xb07b('0x31')](_0x567675[_0xb07b('0x2d')],qs[_0xb07b('0x33')](_0x73b40b['query'][_0xb07b('0x33')]));_0x1d6984[_0xb07b('0x32')]=_0x1d6984[_0xb07b('0x32')][_0xb07b('0x34')]?_0x1d6984[_0xb07b('0x32')]:_0x567675[_0xb07b('0x2d')];if(!_0x73b40b['query'][_0xb07b('0x35')](_0xb07b('0x36'))){_0x1d6984[_0xb07b('0x19')]=qs[_0xb07b('0x19')](_0x73b40b['query']['limit']);_0x1d6984[_0xb07b('0x18')]=qs[_0xb07b('0x18')](_0x73b40b[_0xb07b('0x2e')][_0xb07b('0x18')]);}_0x1d6984[_0xb07b('0x57')]=qs['sort'](_0x73b40b['query'][_0xb07b('0x37')]);_0x1d6984[_0xb07b('0x3a')]=qs[_0xb07b('0x30')](_['pick'](_0x73b40b['query'],_0x567675[_0xb07b('0x30')]));_0x1d6984[_0xb07b('0x3a')]['ProjectId']=_0x13f5ce['id'];if(_0x73b40b[_0xb07b('0x2e')][_0xb07b('0x39')]){_0x1d6984[_0xb07b('0x3a')]=_[_0xb07b('0x3b')](_0x1d6984['where'],{'$or':_[_0xb07b('0x28')](_0x1d6984[_0xb07b('0x32')],function(_0x346c4d){var _0x22c8a3={};_0x22c8a3[_0x346c4d]={'$like':'%'+_0x73b40b['query'][_0xb07b('0x39')]+'%'};return _0x22c8a3;})});}_0x1d6984=_[_0xb07b('0x3b')]({},_0x1d6984,_0x73b40b[_0xb07b('0x3d')]);return db['JscriptyAnswerReport'][_0xb07b('0x3f')]({'where':_0x1d6984['where']})[_0xb07b('0x1f')](function(_0x4abcff){_0x46e2bd[_0xb07b('0x3f')]=_0x4abcff;if(_0x73b40b[_0xb07b('0x2e')]['includeAll']){_0x1d6984['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x1d6984);})[_0xb07b('0x1f')](function(_0x29e63e){_0x46e2bd[_0xb07b('0x42')]=_0x29e63e;return _0x46e2bd;});}})[_0xb07b('0x1f')](respondWithFilteredResult(_0x7c4c3,_0x1d6984))[_0xb07b('0x4a')](handleError(_0x7c4c3,null));};function char(_0x15caa5){return _0xb07b('0x58')===typeof _0x15caa5?String['fromCharCode']['apply'](null,arguments):_0x15caa5;}function needsEncapsulation(_0x27fe74){return!!_0x27fe74&&(_0x27fe74[_0xb07b('0x59')]()['indexOf'](char(0xd))>=0x0||_0x27fe74[_0xb07b('0x59')]()[_0xb07b('0x5a')](char(0xa))>=0x0||_0x27fe74['toString']()[_0xb07b('0x5a')](char(0x2c))>=0x0||_0x27fe74[_0xb07b('0x59')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x47e0aa){var _0x53c8d0=char(0x22),_0x13a428='\x5c'+char(0x22),_0x5584af=_0x47e0aa[_0xb07b('0x59')]()['replace'](new RegExp(_0x53c8d0,'g'),_0x13a428);return _0x53c8d0+_0x5584af+_0x53c8d0;}exports['getSummary']=function(_0x3dc823,_0x4c9d72,_0x262b76){var _0x14adfc,_0x40ded0;var _0xf5898a={'where':{'ProjectId':_0x3dc823[_0xb07b('0x43')]['id']}};if(_0x3dc823['query'][_0xb07b('0x5b')]){_0xf5898a[_0xb07b('0x3a')][_0xb07b('0x5c')]=JSON['parse'](_0x3dc823[_0xb07b('0x2e')][_0xb07b('0x5b')]);}return db[_0xb07b('0x54')][_0xb07b('0x5d')](_0xf5898a)[_0xb07b('0x1f')](handleEntityNotFound(_0x4c9d72,null))[_0xb07b('0x1f')](function(_0x4201fd){if(_0x4201fd){_0x14adfc=_0x4201fd;return db[_0xb07b('0x5e')][_0xb07b('0x5d')]({'where':{'SessionId':{'$in':_['map'](_0x14adfc,'id')},'ProjectId':_0x3dc823[_0xb07b('0x43')]['id']},'order':'-createdAt'});}})[_0xb07b('0x1f')](handleEntityNotFound(_0x4c9d72,null))[_0xb07b('0x1f')](function(_0x5d7f94){if(_0x5d7f94){_0x40ded0=_0x5d7f94;var _0xb5296d={};for(var _0x2bc8d4=0x0,_0x443eca=_0x40ded0['length'];_0x2bc8d4<_0x443eca;_0x2bc8d4++){if(!_0xb5296d['hasOwnProperty'](_0x40ded0[_0x2bc8d4][_0xb07b('0x5f')])){_0xb5296d[_0x40ded0[_0x2bc8d4][_0xb07b('0x5f')]]=needsEncapsulation(_0x40ded0[_0x2bc8d4][_0xb07b('0x60')])?encapsulate(_0x40ded0[_0x2bc8d4][_0xb07b('0x60')]):_0x40ded0[_0x2bc8d4][_0xb07b('0x60')];}}var _0x407fbe=[],_0x375f38={};for(var _0x512457=0x0,_0x2e4e1c=_0x14adfc['length'];_0x512457<_0x2e4e1c;_0x512457++){_0x375f38={'ProjectId':_0x3dc823[_0xb07b('0x43')]['id'],'SessionId':_0x14adfc[_0x512457]['id'],'StartTime':moment(_0x14adfc[_0x512457][_0xb07b('0x5c')])[_0xb07b('0x61')](_0xb07b('0x62'))};for(var _0x33333f=0x0,_0x1c7bf2=_0x40ded0[_0xb07b('0x34')];_0x33333f<_0x1c7bf2;_0x33333f++){if(_0x40ded0[_0x33333f][_0xb07b('0x63')]==_0x14adfc[_0x512457]['id']&&_0xb5296d['hasOwnProperty'](_0x40ded0[_0x33333f][_0xb07b('0x5f')])){_0x375f38[_0xb5296d[_0x40ded0[_0x33333f][_0xb07b('0x5f')]]]=_0x40ded0[_0x33333f][_0xb07b('0x64')];}}for(var _0x14f704 in _0xb5296d){if(!_0x375f38['hasOwnProperty'](_0xb5296d[_0x14f704])){_0x375f38[_0xb5296d[_0x14f704]]=null;}}_0x407fbe[_0xb07b('0x65')](_0x375f38);}return _0x407fbe;}})['then'](function(_0x3282c9){if(!_[_0xb07b('0x66')](_0x3282c9)){var _0x21e4fe=toCsv(_0x3282c9);var _0x19bc15=Date['now']();fs[_0xb07b('0x67')](util[_0xb07b('0x61')](_0xb07b('0x68'),_0x3dc823[_0xb07b('0x43')]['id'],_0x19bc15),_0x21e4fe);_0x4c9d72[_0xb07b('0x69')](_0xb07b('0x6a'),_0xb07b('0x6b')+util[_0xb07b('0x61')](_0xb07b('0x6c'),_0x3dc823[_0xb07b('0x43')]['id'],_0x19bc15));_0x4c9d72[_0xb07b('0x69')](_0xb07b('0x6d'),_0xb07b('0x6e'));return _0x4c9d72['download'](util[_0xb07b('0x61')](_0xb07b('0x68'),_0x3dc823[_0xb07b('0x43')]['id'],_0x19bc15));}else{return _0x4c9d72[_0xb07b('0x24')](0xcc);}})['catch'](handleError(_0x4c9d72,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ce7470d..3db6129 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 _0xdd57=['rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3397a4,_0x55b680){var _0x31183b=function(_0x3bf808){while(--_0x3bf808){_0x3397a4['push'](_0x3397a4['shift']());}};_0x31183b(++_0x55b680);}(_0xdd57,0x18c));var _0x7dd5=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0xdd57[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x7dd5('0x0'));var util=require(_0x7dd5('0x1'));var logger=require(_0x7dd5('0x2'))(_0x7dd5('0x3'));var moment=require(_0x7dd5('0x4'));var BPromise=require(_0x7dd5('0x5'));var rp=require(_0x7dd5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7dd5('0x7'));var config=require(_0x7dd5('0x8'));var attributes=require(_0x7dd5('0x9'));module['exports']=function(_0x18778f,_0x38a738){return _0x18778f[_0x7dd5('0xa')](_0x7dd5('0xb'),attributes,{'tableName':_0x7dd5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30d3=['lodash','util','moment','bluebird','request-promise','path','rimraf','exports','define','JscriptyProject','jscripty_projects'];(function(_0x3d4822,_0x14015d){var _0x568632=function(_0x50cd22){while(--_0x50cd22){_0x3d4822['push'](_0x3d4822['shift']());}};_0x568632(++_0x14015d);}(_0x30d3,0xc6));var _0x330d=function(_0x1f3767,_0x5e6c6d){_0x1f3767=_0x1f3767-0x0;var _0x108cee=_0x30d3[_0x1f3767];return _0x108cee;};'use strict';var _=require(_0x330d('0x0'));var util=require(_0x330d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x330d('0x2'));var BPromise=require(_0x330d('0x3'));var rp=require(_0x330d('0x4'));var fs=require('fs');var path=require(_0x330d('0x5'));var rimraf=require(_0x330d('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x330d('0x7')]=function(_0x430e4c,_0x253ec8){return _0x430e4c[_0x330d('0x8')](_0x330d('0x9'),attributes,{'tableName':_0x330d('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 1d31372..2cf1561 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 _0x890b=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','JscriptyProject,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x16fed8,_0x38177c){var _0x49ad66=function(_0xb36c1f){while(--_0xb36c1f){_0x16fed8['push'](_0x16fed8['shift']());}};_0x49ad66(++_0x38177c);}(_0x890b,0x12b));var _0xb890=function(_0x27b1a0,_0x4de944){_0x27b1a0=_0x27b1a0-0x0;var _0x4a9df9=_0x890b[_0x27b1a0];return _0x4a9df9;};'use strict';var _=require(_0xb890('0x0'));var util=require('util');var moment=require(_0xb890('0x1'));var BPromise=require(_0xb890('0x2'));var rs=require(_0xb890('0x3'));var fs=require('fs');var Redis=require(_0xb890('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb890('0x5'))('rpc');var config=require(_0xb890('0x6'));var jayson=require(_0xb890('0x7'));var client=jayson[_0xb890('0x8')][_0xb890('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41468b,_0x1bbcb2,_0x290824){return new BPromise(function(_0x47729d,_0x1f7159){return client[_0xb890('0xa')](_0x41468b,_0x290824)['then'](function(_0x4c3665){logger[_0xb890('0xb')](_0xb890('0xc'),_0x1bbcb2,'request\x20sent');logger[_0xb890('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x1bbcb2,_0xb890('0xe'),JSON[_0xb890('0xf')](_0x4c3665));if(_0x4c3665['error']){if(_0x4c3665[_0xb890('0x10')][_0xb890('0x11')]===0x1f4){logger['error'](_0xb890('0xc'),_0x1bbcb2,_0x4c3665[_0xb890('0x10')][_0xb890('0x12')]);return _0x1f7159(_0x4c3665[_0xb890('0x10')][_0xb890('0x12')]);}logger['error'](_0xb890('0xc'),_0x1bbcb2,_0x4c3665[_0xb890('0x10')]['message']);return _0x47729d(_0x4c3665['error'][_0xb890('0x12')]);}else{logger[_0xb890('0xb')](_0xb890('0xc'),_0x1bbcb2,_0xb890('0xe'));_0x47729d(_0x4c3665[_0xb890('0x13')][_0xb890('0x12')]);}})[_0xb890('0x14')](function(_0x590e5a){logger['error'](_0xb890('0xc'),_0x1bbcb2,_0x590e5a);_0x1f7159(_0x590e5a);});});} \ No newline at end of file +var _0x55d0=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','request\x20sent','util','randomstring','ioredis'];(function(_0x1a459a,_0x55f975){var _0x393589=function(_0x2ae101){while(--_0x2ae101){_0x1a459a['push'](_0x1a459a['shift']());}};_0x393589(++_0x55f975);}(_0x55d0,0x1ea));var _0x055d=function(_0x3c6c1b,_0x82a1e4){_0x3c6c1b=_0x3c6c1b-0x0;var _0x15170e=_0x55d0[_0x3c6c1b];return _0x15170e;};'use strict';var _=require('lodash');var util=require(_0x055d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x055d('0x1'));var fs=require('fs');var Redis=require(_0x055d('0x2'));var db=require(_0x055d('0x3'))['db'];var utils=require(_0x055d('0x4'));var logger=require(_0x055d('0x5'))('rpc');var config=require(_0x055d('0x6'));var jayson=require(_0x055d('0x7'));var client=jayson[_0x055d('0x8')][_0x055d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fdde2,_0x596c81,_0x296cc3){return new BPromise(function(_0x38d64d,_0x1aefde){return client[_0x055d('0xa')](_0x3fdde2,_0x296cc3)['then'](function(_0x1c6620){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x596c81,'request\x20sent');logger[_0x055d('0xb')](_0x055d('0xc'),_0x596c81,'request\x20sent',JSON['stringify'](_0x1c6620));if(_0x1c6620[_0x055d('0xd')]){if(_0x1c6620[_0x055d('0xd')]['code']===0x1f4){logger[_0x055d('0xd')](_0x055d('0xe'),_0x596c81,_0x1c6620['error'][_0x055d('0xf')]);return _0x1aefde(_0x1c6620['error'][_0x055d('0xf')]);}logger[_0x055d('0xd')](_0x055d('0xe'),_0x596c81,_0x1c6620['error'][_0x055d('0xf')]);return _0x38d64d(_0x1c6620[_0x055d('0xd')][_0x055d('0xf')]);}else{logger['info'](_0x055d('0xe'),_0x596c81,_0x055d('0x10'));_0x38d64d(_0x1c6620['result']['message']);}})['catch'](function(_0x5c6970){logger[_0x055d('0xd')](_0x055d('0xe'),_0x596c81,_0x5c6970);_0x1aefde(_0x5c6970);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d3da6ba..8cafb32 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 _0x585f=['/:id','show','post','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','get','/describe','describe'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x585f,0x184));var _0xf585=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x585f[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xf585('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf585('0x1'));var express=require(_0xf585('0x2'));var router=express[_0xf585('0x3')]();var auth=require(_0xf585('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf585('0x5'));var controller=require(_0xf585('0x6'));router['get']('/',auth[_0xf585('0x7')](),controller['index']);router[_0xf585('0x8')](_0xf585('0x9'),auth[_0xf585('0x7')](),controller[_0xf585('0xa')]);router['get'](_0xf585('0xb'),auth[_0xf585('0x7')](),controller[_0xf585('0xc')]);router[_0xf585('0xd')]('/',auth[_0xf585('0x7')](),controller[_0xf585('0xe')]);router[_0xf585('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf585('0x10')](_0xf585('0xb'),auth[_0xf585('0x7')](),controller[_0xf585('0x11')]);module[_0xf585('0x12')]=router; \ No newline at end of file +var _0xe6fe=['isAuthenticated','describe','/:id','show','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe6fe,0x1d4));var _0xee6f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6fe[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xee6f('0x0'));var util=require(_0xee6f('0x1'));var path=require(_0xee6f('0x2'));var timeout=require(_0xee6f('0x3'));var express=require(_0xee6f('0x4'));var router=express[_0xee6f('0x5')]();var auth=require(_0xee6f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xee6f('0x7'));var controller=require(_0xee6f('0x8'));router[_0xee6f('0x9')]('/',auth['isAuthenticated'](),controller[_0xee6f('0xa')]);router[_0xee6f('0x9')](_0xee6f('0xb'),auth[_0xee6f('0xc')](),controller[_0xee6f('0xd')]);router[_0xee6f('0x9')](_0xee6f('0xe'),auth[_0xee6f('0xc')](),controller[_0xee6f('0xf')]);router['post']('/',auth[_0xee6f('0xc')](),controller[_0xee6f('0x10')]);router['put'](_0xee6f('0xe'),auth[_0xee6f('0xc')](),controller[_0xee6f('0x11')]);router[_0xee6f('0x12')](_0xee6f('0xe'),auth[_0xee6f('0xc')](),controller[_0xee6f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index a7c999a..3ca7eb0 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 _0x7c98=['TEXT','long','STRING','sequelize','exports'];(function(_0x426807,_0xe15ced){var _0x5d83b5=function(_0x2c6d1c){while(--_0x2c6d1c){_0x426807['push'](_0x426807['shift']());}};_0x5d83b5(++_0xe15ced);}(_0x7c98,0x8a));var _0x87c9=function(_0x455fea,_0x51f808){_0x455fea=_0x455fea-0x0;var _0x32f39b=_0x7c98[_0x455fea];return _0x32f39b;};'use strict';var Sequelize=require(_0x87c9('0x0'));module[_0x87c9('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x87c9('0x2')](_0x87c9('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x87c9('0x4')]},'calleridname':{'type':Sequelize[_0x87c9('0x4')]},'calleridnum':{'type':Sequelize[_0x87c9('0x4')]},'questionId':{'type':Sequelize[_0x87c9('0x4')]}}; \ No newline at end of file +var _0x20c9=['exports','STRING','TEXT','long','sequelize'];(function(_0x2e7dcb,_0x5f0fe9){var _0xc28044=function(_0x46c3f2){while(--_0x46c3f2){_0x2e7dcb['push'](_0x2e7dcb['shift']());}};_0xc28044(++_0x5f0fe9);}(_0x20c9,0xd6));var _0x920c=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0x20c9[_0x53c256];return _0x25feb6;};'use strict';var Sequelize=require(_0x920c('0x0'));module[_0x920c('0x1')]={'question':{'type':Sequelize[_0x920c('0x2')]},'answer':{'type':Sequelize[_0x920c('0x3')](_0x920c('0x4'))},'membername':{'type':Sequelize[_0x920c('0x2')]},'projectname':{'type':Sequelize[_0x920c('0x2')]},'queue':{'type':Sequelize[_0x920c('0x2')]},'uniqueid':{'type':Sequelize[_0x920c('0x2')]},'calleridname':{'type':Sequelize[_0x920c('0x2')]},'calleridnum':{'type':Sequelize[_0x920c('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index f39752a..7b1bad0 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 _0x7486=['update','then','destroy','error','stack','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','name','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','filters','pick','filter','merge','options','include','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/environment','sendStatus','end','status','count','set','Content-Range','json','reject'];(function(_0x18588,_0x5e1235){var _0x5a21b2=function(_0x24fcf7){while(--_0x24fcf7){_0x18588['push'](_0x18588['shift']());}};_0x5a21b2(++_0x5e1235);}(_0x7486,0xf4));var _0x6748=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7486[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x6748('0x0'));var emlformat=require(_0x6748('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6748('0x2'));var jsonpatch=require(_0x6748('0x3'));var rp=require('request-promise');var moment=require(_0x6748('0x4'));var BPromise=require(_0x6748('0x5'));var Mustache=require('mustache');var util=require(_0x6748('0x6'));var path=require(_0x6748('0x7'));var sox=require('sox');var csv=require(_0x6748('0x8'));var ejs=require(_0x6748('0x9'));var fs=require('fs');var _=require(_0x6748('0xa'));var squel=require(_0x6748('0xb'));var crypto=require(_0x6748('0xc'));var jsforce=require(_0x6748('0xd'));var deskjs=require(_0x6748('0xe'));var toCsv=require(_0x6748('0x8'));var querystring=require(_0x6748('0xf'));var Papa=require(_0x6748('0x10'));var Redis=require(_0x6748('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6748('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6748('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x585403,_0x39fd00){_0x39fd00=_0x39fd00||0xcc;return function(_0x59aeda){if(_0x59aeda){return _0x585403[_0x6748('0x14')](_0x39fd00);}return _0x585403['status'](_0x39fd00)[_0x6748('0x15')]();};}function respondWithResult(_0x7865ed,_0x478563){_0x478563=_0x478563||0xc8;return function(_0x1fa626){if(_0x1fa626){return _0x7865ed[_0x6748('0x16')](_0x478563)['json'](_0x1fa626);}};}function respondWithFilteredResult(_0x57bcfd,_0xb40ad8){return function(_0x5b04b3){if(_0x5b04b3){var _0x482800=_0x5b04b3[_0x6748('0x17')],_0x51483a=_0xb40ad8['offset'],_0x5265a8=_0xb40ad8['offset']+_0xb40ad8['limit'],_0x3689d8;if(_0x5265a8>=_0x482800){_0x5265a8=_0x482800;_0x3689d8=0xc8;}else{_0x3689d8=0xce;}_0x57bcfd['status'](_0x3689d8);return _0x57bcfd[_0x6748('0x18')](_0x6748('0x19'),_0x51483a+'-'+_0x5265a8+'/'+_0x482800)[_0x6748('0x1a')](_0x5b04b3);}return null;};}function patchUpdates(_0x19d24d){return function(_0x1b63fe){try{jsonpatch['apply'](_0x1b63fe,_0x19d24d,!![]);}catch(_0x370913){return BPromise[_0x6748('0x1b')](_0x370913);}return _0x1b63fe['save']();};}function saveUpdates(_0x22eeaa,_0x54e87f){return function(_0x4b7bea){if(_0x4b7bea){return _0x4b7bea[_0x6748('0x1c')](_0x22eeaa)[_0x6748('0x1d')](function(_0x11320a){return _0x11320a;});}return null;};}function removeEntity(_0x533cda,_0x21b48e){return function(_0x492cc8){if(_0x492cc8){return _0x492cc8[_0x6748('0x1e')]()[_0x6748('0x1d')](function(){_0x533cda['status'](0xcc)[_0x6748('0x15')]();});}};}function handleEntityNotFound(_0x4ab7d1,_0x5c181f){return function(_0x8318c5){if(!_0x8318c5){_0x4ab7d1[_0x6748('0x14')](0x194);}return _0x8318c5;};}function handleError(_0x3d6c23,_0x3bdb9f){_0x3bdb9f=_0x3bdb9f||0x1f4;return function(_0x33e9c6){logger[_0x6748('0x1f')](_0x33e9c6[_0x6748('0x20')]);if(_0x33e9c6['name']){delete _0x33e9c6['name'];}_0x3d6c23[_0x6748('0x16')](_0x3bdb9f)[_0x6748('0x21')](_0x33e9c6);};}exports[_0x6748('0x22')]=function(_0x3f8ead,_0x5f448c){var _0x26ed1a={},_0xbbd255={},_0x286d82={'count':0x0,'rows':[]};var _0x424f1b=_[_0x6748('0x23')](db[_0x6748('0x24')][_0x6748('0x25')],function(_0x839d19){return{'name':_0x839d19['fieldName'],'type':_0x839d19[_0x6748('0x26')][_0x6748('0x27')]};});_0xbbd255[_0x6748('0x28')]=_['map'](_0x424f1b,_0x6748('0x29'));_0xbbd255['query']=_[_0x6748('0x2a')](_0x3f8ead[_0x6748('0x2b')]);_0xbbd255['filters']=_['intersection'](_0xbbd255[_0x6748('0x28')],_0xbbd255['query']);_0x26ed1a[_0x6748('0x2c')]=_[_0x6748('0x2d')](_0xbbd255['model'],qs[_0x6748('0x2e')](_0x3f8ead[_0x6748('0x2b')]['fields']));_0x26ed1a['attributes']=_0x26ed1a['attributes'][_0x6748('0x2f')]?_0x26ed1a[_0x6748('0x2c')]:_0xbbd255[_0x6748('0x28')];if(!_0x3f8ead[_0x6748('0x2b')][_0x6748('0x30')](_0x6748('0x31'))){_0x26ed1a[_0x6748('0x32')]=qs[_0x6748('0x32')](_0x3f8ead[_0x6748('0x2b')][_0x6748('0x32')]);_0x26ed1a[_0x6748('0x33')]=qs['offset'](_0x3f8ead[_0x6748('0x2b')][_0x6748('0x33')]);}_0x26ed1a['order']=qs[_0x6748('0x34')](_0x3f8ead[_0x6748('0x2b')][_0x6748('0x34')]);_0x26ed1a[_0x6748('0x35')]=qs[_0x6748('0x36')](_[_0x6748('0x37')](_0x3f8ead[_0x6748('0x2b')],_0xbbd255[_0x6748('0x36')]),_0x424f1b);if(_0x3f8ead[_0x6748('0x2b')][_0x6748('0x38')]){_0x26ed1a[_0x6748('0x35')]=_[_0x6748('0x39')](_0x26ed1a[_0x6748('0x35')],{'$or':_[_0x6748('0x23')](_0x424f1b,function(_0x1cae11){if(_0x1cae11['type']!=='VIRTUAL'){var _0x4e3e03={};_0x4e3e03[_0x1cae11[_0x6748('0x29')]]={'$like':'%'+_0x3f8ead[_0x6748('0x2b')][_0x6748('0x38')]+'%'};return _0x4e3e03;}})});}_0x26ed1a=_[_0x6748('0x39')]({},_0x26ed1a,_0x3f8ead[_0x6748('0x3a')]);var _0x201c48={'where':_0x26ed1a[_0x6748('0x35')]};return db[_0x6748('0x24')][_0x6748('0x17')](_0x201c48)[_0x6748('0x1d')](function(_0x429b97){_0x286d82[_0x6748('0x17')]=_0x429b97;if(_0x3f8ead[_0x6748('0x2b')]['includeAll']){_0x26ed1a[_0x6748('0x3b')]=[{'all':!![]}];}return db[_0x6748('0x24')]['findAll'](_0x26ed1a);})[_0x6748('0x1d')](function(_0x5eda3b){_0x286d82[_0x6748('0x3c')]=_0x5eda3b;return _0x286d82;})['then'](respondWithFilteredResult(_0x5f448c,_0x26ed1a))[_0x6748('0x3d')](handleError(_0x5f448c,null));};exports[_0x6748('0x3e')]=function(_0x5e675e,_0x158768){var _0x12e312={'raw':!![],'where':{'id':_0x5e675e[_0x6748('0x3f')]['id']}},_0x4444d1={};_0x4444d1[_0x6748('0x28')]=_['keys'](db[_0x6748('0x24')][_0x6748('0x25')]);_0x4444d1[_0x6748('0x2b')]=_[_0x6748('0x2a')](_0x5e675e['query']);_0x4444d1['filters']=_[_0x6748('0x2d')](_0x4444d1['model'],_0x4444d1[_0x6748('0x2b')]);_0x12e312[_0x6748('0x2c')]=_['intersection'](_0x4444d1[_0x6748('0x28')],qs[_0x6748('0x2e')](_0x5e675e[_0x6748('0x2b')][_0x6748('0x2e')]));_0x12e312[_0x6748('0x2c')]=_0x12e312[_0x6748('0x2c')][_0x6748('0x2f')]?_0x12e312[_0x6748('0x2c')]:_0x4444d1[_0x6748('0x28')];if(_0x5e675e[_0x6748('0x2b')]['includeAll']){_0x12e312[_0x6748('0x3b')]=[{'all':!![]}];}_0x12e312=_[_0x6748('0x39')]({},_0x12e312,_0x5e675e[_0x6748('0x3a')]);return db[_0x6748('0x24')]['find'](_0x12e312)[_0x6748('0x1d')](handleEntityNotFound(_0x158768,null))[_0x6748('0x1d')](respondWithResult(_0x158768,null))[_0x6748('0x3d')](handleError(_0x158768,null));};exports[_0x6748('0x40')]=function(_0x5841f5,_0x2895e4){return db['JscriptyQuestionReport'][_0x6748('0x40')](_0x5841f5[_0x6748('0x41')],{})[_0x6748('0x1d')](respondWithResult(_0x2895e4,0xc9))['catch'](handleError(_0x2895e4,null));};exports['update']=function(_0x403195,_0x5caec0){if(_0x403195[_0x6748('0x41')]['id']){delete _0x403195[_0x6748('0x41')]['id'];}return db[_0x6748('0x24')][_0x6748('0x42')]({'where':{'id':_0x403195['params']['id']}})[_0x6748('0x1d')](handleEntityNotFound(_0x5caec0,null))[_0x6748('0x1d')](saveUpdates(_0x403195['body'],null))[_0x6748('0x1d')](respondWithResult(_0x5caec0,null))[_0x6748('0x3d')](handleError(_0x5caec0,null));};exports[_0x6748('0x1e')]=function(_0x1fac0c,_0x1cf259){return db[_0x6748('0x24')]['find']({'where':{'id':_0x1fac0c[_0x6748('0x3f')]['id']}})[_0x6748('0x1d')](handleEntityNotFound(_0x1cf259,null))[_0x6748('0x1d')](removeEntity(_0x1cf259,null))['catch'](handleError(_0x1cf259,null));};exports['describe']=function(_0x5ac7ab,_0x2798bd){return db[_0x6748('0x24')][_0x6748('0x43')]()[_0x6748('0x1d')](respondWithResult(_0x2798bd,null))[_0x6748('0x3d')](handleError(_0x2798bd,null));}; \ No newline at end of file +var _0xa5dd=['squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','hasOwnProperty','order','sort','where','pick','merge','filter','options','then','findAll','rows','catch','show','params','fields','length','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash'];(function(_0x20d07f,_0x38a296){var _0x431b55=function(_0x3cd362){while(--_0x3cd362){_0x20d07f['push'](_0x20d07f['shift']());}};_0x431b55(++_0x38a296);}(_0xa5dd,0x1ed));var _0xda5d=function(_0x1d9e52,_0x166577){_0x1d9e52=_0x1d9e52-0x0;var _0x1f2421=_0xa5dd[_0x1d9e52];return _0x1f2421;};'use strict';var pdf=require(_0xda5d('0x0'));var emlformat=require(_0xda5d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xda5d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda5d('0x3'));var moment=require(_0xda5d('0x4'));var BPromise=require(_0xda5d('0x5'));var Mustache=require('mustache');var util=require(_0xda5d('0x6'));var path=require('path');var sox=require(_0xda5d('0x7'));var csv=require(_0xda5d('0x8'));var ejs=require(_0xda5d('0x9'));var fs=require('fs');var _=require(_0xda5d('0xa'));var squel=require(_0xda5d('0xb'));var crypto=require(_0xda5d('0xc'));var jsforce=require(_0xda5d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xda5d('0x8'));var querystring=require(_0xda5d('0xe'));var Papa=require('papaparse');var Redis=require(_0xda5d('0xf'));var authService=require(_0xda5d('0x10'));var qs=require(_0xda5d('0x11'));var as=require(_0xda5d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda5d('0x13'))(_0xda5d('0x14'));var utils=require(_0xda5d('0x15'));var config=require(_0xda5d('0x16'));var db=require(_0xda5d('0x17'))['db'];function respondWithStatusCode(_0x96091e,_0xa66f5b){_0xa66f5b=_0xa66f5b||0xcc;return function(_0x5d4f66){if(_0x5d4f66){return _0x96091e[_0xda5d('0x18')](_0xa66f5b);}return _0x96091e[_0xda5d('0x19')](_0xa66f5b)['end']();};}function respondWithResult(_0x8d969f,_0x490057){_0x490057=_0x490057||0xc8;return function(_0x15c9e6){if(_0x15c9e6){return _0x8d969f[_0xda5d('0x19')](_0x490057)[_0xda5d('0x1a')](_0x15c9e6);}};}function respondWithFilteredResult(_0x400766,_0x5ba880){return function(_0x60f9e3){if(_0x60f9e3){var _0x2e867d=_0x60f9e3[_0xda5d('0x1b')],_0x2f5a1f=_0x5ba880[_0xda5d('0x1c')],_0x3e3386=_0x5ba880['offset']+_0x5ba880[_0xda5d('0x1d')],_0x127eb6;if(_0x3e3386>=_0x2e867d){_0x3e3386=_0x2e867d;_0x127eb6=0xc8;}else{_0x127eb6=0xce;}_0x400766[_0xda5d('0x19')](_0x127eb6);return _0x400766[_0xda5d('0x1e')](_0xda5d('0x1f'),_0x2f5a1f+'-'+_0x3e3386+'/'+_0x2e867d)[_0xda5d('0x1a')](_0x60f9e3);}return null;};}function patchUpdates(_0x115ead){return function(_0x1d5b0a){try{jsonpatch[_0xda5d('0x20')](_0x1d5b0a,_0x115ead,!![]);}catch(_0x4d218e){return BPromise['reject'](_0x4d218e);}return _0x1d5b0a['save']();};}function saveUpdates(_0x42dcae,_0x3eac95){return function(_0x5a1ca4){if(_0x5a1ca4){return _0x5a1ca4[_0xda5d('0x21')](_0x42dcae)['then'](function(_0x4f23f2){return _0x4f23f2;});}return null;};}function removeEntity(_0x38f0ff,_0x29ffdf){return function(_0x4fb45b){if(_0x4fb45b){return _0x4fb45b[_0xda5d('0x22')]()['then'](function(){_0x38f0ff[_0xda5d('0x19')](0xcc)[_0xda5d('0x23')]();});}};}function handleEntityNotFound(_0x5a9fb4,_0x5d39e0){return function(_0x12f399){if(!_0x12f399){_0x5a9fb4['sendStatus'](0x194);}return _0x12f399;};}function handleError(_0x2793e2,_0x49c204){_0x49c204=_0x49c204||0x1f4;return function(_0x5638ad){logger[_0xda5d('0x24')](_0x5638ad[_0xda5d('0x25')]);if(_0x5638ad[_0xda5d('0x26')]){delete _0x5638ad[_0xda5d('0x26')];}_0x2793e2[_0xda5d('0x19')](_0x49c204)[_0xda5d('0x27')](_0x5638ad);};}exports[_0xda5d('0x28')]=function(_0x1ea6ef,_0x38a9ed){var _0x2778ec={},_0x258d0f={},_0xf7c05a={'count':0x0,'rows':[]};var _0x2e1335=_[_0xda5d('0x29')](db[_0xda5d('0x2a')][_0xda5d('0x2b')],function(_0xcba45b){return{'name':_0xcba45b[_0xda5d('0x2c')],'type':_0xcba45b[_0xda5d('0x2d')]['key']};});_0x258d0f[_0xda5d('0x2e')]=_[_0xda5d('0x29')](_0x2e1335,'name');_0x258d0f[_0xda5d('0x2f')]=_[_0xda5d('0x30')](_0x1ea6ef[_0xda5d('0x2f')]);_0x258d0f[_0xda5d('0x31')]=_['intersection'](_0x258d0f[_0xda5d('0x2e')],_0x258d0f['query']);_0x2778ec[_0xda5d('0x32')]=_[_0xda5d('0x33')](_0x258d0f[_0xda5d('0x2e')],qs['fields'](_0x1ea6ef[_0xda5d('0x2f')]['fields']));_0x2778ec[_0xda5d('0x32')]=_0x2778ec['attributes']['length']?_0x2778ec[_0xda5d('0x32')]:_0x258d0f[_0xda5d('0x2e')];if(!_0x1ea6ef[_0xda5d('0x2f')][_0xda5d('0x34')]('nolimit')){_0x2778ec['limit']=qs['limit'](_0x1ea6ef[_0xda5d('0x2f')][_0xda5d('0x1d')]);_0x2778ec[_0xda5d('0x1c')]=qs[_0xda5d('0x1c')](_0x1ea6ef[_0xda5d('0x2f')][_0xda5d('0x1c')]);}_0x2778ec[_0xda5d('0x35')]=qs['sort'](_0x1ea6ef[_0xda5d('0x2f')][_0xda5d('0x36')]);_0x2778ec[_0xda5d('0x37')]=qs[_0xda5d('0x31')](_[_0xda5d('0x38')](_0x1ea6ef[_0xda5d('0x2f')],_0x258d0f[_0xda5d('0x31')]),_0x2e1335);if(_0x1ea6ef[_0xda5d('0x2f')]['filter']){_0x2778ec['where']=_[_0xda5d('0x39')](_0x2778ec['where'],{'$or':_[_0xda5d('0x29')](_0x2e1335,function(_0x1944ae){if(_0x1944ae[_0xda5d('0x2d')]!=='VIRTUAL'){var _0x25eb11={};_0x25eb11[_0x1944ae['name']]={'$like':'%'+_0x1ea6ef[_0xda5d('0x2f')][_0xda5d('0x3a')]+'%'};return _0x25eb11;}})});}_0x2778ec=_['merge']({},_0x2778ec,_0x1ea6ef[_0xda5d('0x3b')]);var _0x20f9a3={'where':_0x2778ec[_0xda5d('0x37')]};return db[_0xda5d('0x2a')][_0xda5d('0x1b')](_0x20f9a3)[_0xda5d('0x3c')](function(_0x23868d){_0xf7c05a[_0xda5d('0x1b')]=_0x23868d;if(_0x1ea6ef[_0xda5d('0x2f')]['includeAll']){_0x2778ec['include']=[{'all':!![]}];}return db[_0xda5d('0x2a')][_0xda5d('0x3d')](_0x2778ec);})['then'](function(_0x51ad02){_0xf7c05a[_0xda5d('0x3e')]=_0x51ad02;return _0xf7c05a;})[_0xda5d('0x3c')](respondWithFilteredResult(_0x38a9ed,_0x2778ec))[_0xda5d('0x3f')](handleError(_0x38a9ed,null));};exports[_0xda5d('0x40')]=function(_0x19eeca,_0x306358){var _0x5b9a3a={'raw':!![],'where':{'id':_0x19eeca[_0xda5d('0x41')]['id']}},_0x24c5b4={};_0x24c5b4[_0xda5d('0x2e')]=_[_0xda5d('0x30')](db[_0xda5d('0x2a')][_0xda5d('0x2b')]);_0x24c5b4[_0xda5d('0x2f')]=_[_0xda5d('0x30')](_0x19eeca[_0xda5d('0x2f')]);_0x24c5b4[_0xda5d('0x31')]=_[_0xda5d('0x33')](_0x24c5b4[_0xda5d('0x2e')],_0x24c5b4['query']);_0x5b9a3a['attributes']=_['intersection'](_0x24c5b4[_0xda5d('0x2e')],qs[_0xda5d('0x42')](_0x19eeca['query'][_0xda5d('0x42')]));_0x5b9a3a['attributes']=_0x5b9a3a[_0xda5d('0x32')][_0xda5d('0x43')]?_0x5b9a3a[_0xda5d('0x32')]:_0x24c5b4[_0xda5d('0x2e')];if(_0x19eeca[_0xda5d('0x2f')]['includeAll']){_0x5b9a3a['include']=[{'all':!![]}];}_0x5b9a3a=_[_0xda5d('0x39')]({},_0x5b9a3a,_0x19eeca[_0xda5d('0x3b')]);return db[_0xda5d('0x2a')][_0xda5d('0x44')](_0x5b9a3a)[_0xda5d('0x3c')](handleEntityNotFound(_0x306358,null))[_0xda5d('0x3c')](respondWithResult(_0x306358,null))[_0xda5d('0x3f')](handleError(_0x306358,null));};exports[_0xda5d('0x45')]=function(_0x2c0419,_0x582396){return db[_0xda5d('0x2a')]['create'](_0x2c0419[_0xda5d('0x46')],{})[_0xda5d('0x3c')](respondWithResult(_0x582396,0xc9))[_0xda5d('0x3f')](handleError(_0x582396,null));};exports[_0xda5d('0x21')]=function(_0x299984,_0x2bdbdd){if(_0x299984[_0xda5d('0x46')]['id']){delete _0x299984['body']['id'];}return db[_0xda5d('0x2a')]['find']({'where':{'id':_0x299984['params']['id']}})[_0xda5d('0x3c')](handleEntityNotFound(_0x2bdbdd,null))[_0xda5d('0x3c')](saveUpdates(_0x299984[_0xda5d('0x46')],null))[_0xda5d('0x3c')](respondWithResult(_0x2bdbdd,null))[_0xda5d('0x3f')](handleError(_0x2bdbdd,null));};exports['destroy']=function(_0x29cccc,_0x500c85){return db[_0xda5d('0x2a')][_0xda5d('0x44')]({'where':{'id':_0x29cccc[_0xda5d('0x41')]['id']}})['then'](handleEntityNotFound(_0x500c85,null))[_0xda5d('0x3c')](removeEntity(_0x500c85,null))[_0xda5d('0x3f')](handleError(_0x500c85,null));};exports[_0xda5d('0x47')]=function(_0xf9f7b5,_0x537864){return db[_0xda5d('0x2a')][_0xda5d('0x47')]()[_0xda5d('0x3c')](respondWithResult(_0x537864,null))[_0xda5d('0x3f')](handleError(_0x537864,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 8523284..a215617 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 _0x47f2=['bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x47f2,0xec));var _0x247f=function(_0x15ba03,_0x18bcc6){_0x15ba03=_0x15ba03-0x0;var _0x51da14=_0x47f2[_0x15ba03];return _0x51da14;};'use strict';var _=require('lodash');var util=require(_0x247f('0x0'));var logger=require(_0x247f('0x1'))(_0x247f('0x2'));var moment=require(_0x247f('0x3'));var BPromise=require(_0x247f('0x4'));var rp=require(_0x247f('0x5'));var fs=require('fs');var path=require(_0x247f('0x6'));var rimraf=require(_0x247f('0x7'));var config=require(_0x247f('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x247f('0x9')]=function(_0x4b2a0e,_0x143c32){return _0x4b2a0e['define'](_0x247f('0xa'),attributes,{'tableName':_0x247f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dda=['../../config/logger','api','moment','bluebird','request-promise','path','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util'];(function(_0x31a09c,_0x22ee96){var _0x4b4ed0=function(_0x55d301){while(--_0x55d301){_0x31a09c['push'](_0x31a09c['shift']());}};_0x4b4ed0(++_0x22ee96);}(_0x9dda,0x1a3));var _0xa9dd=function(_0x8e9d70,_0x3059f6){_0x8e9d70=_0x8e9d70-0x0;var _0x58ecc1=_0x9dda[_0x8e9d70];return _0x58ecc1;};'use strict';var _=require('lodash');var util=require(_0xa9dd('0x0'));var logger=require(_0xa9dd('0x1'))(_0xa9dd('0x2'));var moment=require(_0xa9dd('0x3'));var BPromise=require(_0xa9dd('0x4'));var rp=require(_0xa9dd('0x5'));var fs=require('fs');var path=require(_0xa9dd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa9dd('0x7'));module[_0xa9dd('0x8')]=function(_0x239485,_0x1025bf){return _0x239485[_0xa9dd('0x9')](_0xa9dd('0xa'),attributes,{'tableName':_0xa9dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 96a777d..f758699 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 _0x9cbf=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9cbf,0x124));var _0xf9cb=function(_0x15f1ad,_0x452be1){_0x15f1ad=_0x15f1ad-0x0;var _0x2ad951=_0x9cbf[_0x15f1ad];return _0x2ad951;};'use strict';var _=require(_0xf9cb('0x0'));var util=require(_0xf9cb('0x1'));var moment=require(_0xf9cb('0x2'));var BPromise=require(_0xf9cb('0x3'));var rs=require(_0xf9cb('0x4'));var fs=require('fs');var Redis=require(_0xf9cb('0x5'));var db=require(_0xf9cb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf9cb('0x7'));var config=require(_0xf9cb('0x8'));var jayson=require(_0xf9cb('0x9'));var client=jayson[_0xf9cb('0xa')][_0xf9cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50089e,_0x25dccc,_0x54ed18){return new BPromise(function(_0x39ec71,_0x5ebd8f){return client[_0xf9cb('0xc')](_0x50089e,_0x54ed18)[_0xf9cb('0xd')](function(_0x1c0503){logger[_0xf9cb('0xe')](_0xf9cb('0xf'),_0x25dccc,_0xf9cb('0x10'));logger['debug'](_0xf9cb('0x11'),_0x25dccc,_0xf9cb('0x10'),JSON['stringify'](_0x1c0503));if(_0x1c0503[_0xf9cb('0x12')]){if(_0x1c0503[_0xf9cb('0x12')][_0xf9cb('0x13')]===0x1f4){logger[_0xf9cb('0x12')](_0xf9cb('0xf'),_0x25dccc,_0x1c0503['error'][_0xf9cb('0x14')]);return _0x5ebd8f(_0x1c0503['error'][_0xf9cb('0x14')]);}logger[_0xf9cb('0x12')](_0xf9cb('0xf'),_0x25dccc,_0x1c0503[_0xf9cb('0x12')]['message']);return _0x39ec71(_0x1c0503['error'][_0xf9cb('0x14')]);}else{logger[_0xf9cb('0xe')](_0xf9cb('0xf'),_0x25dccc,'request\x20sent');_0x39ec71(_0x1c0503[_0xf9cb('0x15')][_0xf9cb('0x14')]);}})[_0xf9cb('0x16')](function(_0x3f4144){logger[_0xf9cb('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x25dccc,_0x3f4144);_0x5ebd8f(_0x3f4144);});});} \ No newline at end of file +var _0x7871=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','moment'];(function(_0x403c23,_0x210794){var _0x23c48f=function(_0x55b54f){while(--_0x55b54f){_0x403c23['push'](_0x403c23['shift']());}};_0x23c48f(++_0x210794);}(_0x7871,0x1b7));var _0x1787=function(_0x440cc5,_0x43225a){_0x440cc5=_0x440cc5-0x0;var _0x1f207b=_0x7871[_0x440cc5];return _0x1f207b;};'use strict';var _=require(_0x1787('0x0'));var util=require('util');var moment=require(_0x1787('0x1'));var BPromise=require(_0x1787('0x2'));var rs=require(_0x1787('0x3'));var fs=require('fs');var Redis=require(_0x1787('0x4'));var db=require(_0x1787('0x5'))['db'];var utils=require(_0x1787('0x6'));var logger=require(_0x1787('0x7'))(_0x1787('0x8'));var config=require(_0x1787('0x9'));var jayson=require(_0x1787('0xa'));var client=jayson[_0x1787('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x558719,_0x3cbb70,_0x1230ed){return new BPromise(function(_0x2813e3,_0x630671){return client[_0x1787('0xc')](_0x558719,_0x1230ed)[_0x1787('0xd')](function(_0xd337fb){logger[_0x1787('0xe')](_0x1787('0xf'),_0x3cbb70,_0x1787('0x10'));logger[_0x1787('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3cbb70,_0x1787('0x10'),JSON['stringify'](_0xd337fb));if(_0xd337fb['error']){if(_0xd337fb[_0x1787('0x12')]['code']===0x1f4){logger[_0x1787('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3cbb70,_0xd337fb[_0x1787('0x12')]['message']);return _0x630671(_0xd337fb[_0x1787('0x12')][_0x1787('0x13')]);}logger[_0x1787('0x12')](_0x1787('0xf'),_0x3cbb70,_0xd337fb[_0x1787('0x12')][_0x1787('0x13')]);return _0x2813e3(_0xd337fb[_0x1787('0x12')][_0x1787('0x13')]);}else{logger[_0x1787('0xe')](_0x1787('0xf'),_0x3cbb70,_0x1787('0x10'));_0x2813e3(_0xd337fb['result'][_0x1787('0x13')]);}})[_0x1787('0x14')](function(_0x546df0){logger[_0x1787('0x12')](_0x1787('0xf'),_0x3cbb70,_0x546df0);_0x630671(_0x546df0);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index cdef273..2a5fb66 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 _0xb138=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','index','isAuthenticated','describe','show','getQuestions','post','create','/:id','update','delete','multer','util','path'];(function(_0x30fd47,_0x389d3a){var _0x517e73=function(_0x6169b0){while(--_0x6169b0){_0x30fd47['push'](_0x30fd47['shift']());}};_0x517e73(++_0x389d3a);}(_0xb138,0x1dd));var _0x8b13=function(_0x5edfa6,_0x3732c9){_0x5edfa6=_0x5edfa6-0x0;var _0x19379f=_0xb138[_0x5edfa6];return _0x19379f;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var auth=require(_0x8b13('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b13('0x7'));var controller=require(_0x8b13('0x8'));router[_0x8b13('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b13('0xa')]);router[_0x8b13('0x9')]('/describe',auth[_0x8b13('0xb')](),controller[_0x8b13('0xc')]);router[_0x8b13('0x9')]('/:id',auth[_0x8b13('0xb')](),controller[_0x8b13('0xd')]);router['get']('/:id/questions',auth[_0x8b13('0xb')](),controller[_0x8b13('0xe')]);router[_0x8b13('0xf')]('/',auth[_0x8b13('0xb')](),controller[_0x8b13('0x10')]);router['put'](_0x8b13('0x11'),auth[_0x8b13('0xb')](),controller[_0x8b13('0x12')]);router[_0x8b13('0x13')](_0x8b13('0x11'),auth[_0x8b13('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfd0f=['update','/:id','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','show','/:id/questions','post','create'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x2754ab,_0x38ce21){_0x2754ab=_0x2754ab-0x0;var _0x19fd0d=_0xfd0f[_0x2754ab];return _0x19fd0d;};'use strict';var multer=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var path=require('path');var timeout=require(_0xffd0('0x2'));var express=require(_0xffd0('0x3'));var router=express[_0xffd0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xffd0('0x5'));var config=require('../../config/environment');var controller=require(_0xffd0('0x6'));router[_0xffd0('0x7')]('/',auth[_0xffd0('0x8')](),controller[_0xffd0('0x9')]);router[_0xffd0('0x7')](_0xffd0('0xa'),auth[_0xffd0('0x8')](),controller[_0xffd0('0xb')]);router[_0xffd0('0x7')]('/:id',auth[_0xffd0('0x8')](),controller[_0xffd0('0xc')]);router[_0xffd0('0x7')](_0xffd0('0xd'),auth['isAuthenticated'](),controller['getQuestions']);router[_0xffd0('0xe')]('/',auth[_0xffd0('0x8')](),controller[_0xffd0('0xf')]);router['put']('/:id',auth[_0xffd0('0x8')](),controller[_0xffd0('0x10')]);router['delete'](_0xffd0('0x11'),auth[_0xffd0('0x8')](),controller[_0xffd0('0x12')]);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 0a67571..d7db202 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 _0x45e8=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','DATE','setDataValue','starttime','format'];(function(_0x2dfd0e,_0x13739e){var _0x343af6=function(_0x206e2f){while(--_0x206e2f){_0x2dfd0e['push'](_0x2dfd0e['shift']());}};_0x343af6(++_0x13739e);}(_0x45e8,0x1a3));var _0x845e=function(_0x16295e,_0x4a9b05){_0x16295e=_0x16295e-0x0;var _0x2d9e54=_0x45e8[_0x16295e];return _0x2d9e54;};'use strict';var moment=require(_0x845e('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x845e('0x1')],'set':function(_0x5c5343){this[_0x845e('0x2')](_0x845e('0x3'),_0x5c5343);this[_0x845e('0x2')]('endtime',moment()[_0x845e('0x4')](_0x845e('0x5')));}},'endtime':{'type':Sequelize[_0x845e('0x1')]},'membername':{'type':Sequelize[_0x845e('0x6')]},'projectname':{'type':Sequelize[_0x845e('0x6')]},'queue':{'type':Sequelize[_0x845e('0x6')]},'uniqueid':{'type':Sequelize[_0x845e('0x6')]},'calleridname':{'type':Sequelize[_0x845e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x845e('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x2b3f=['DATE','setDataValue','starttime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports'];(function(_0x281d51,_0x200860){var _0x1e272d=function(_0x275f59){while(--_0x275f59){_0x281d51['push'](_0x281d51['shift']());}};_0x1e272d(++_0x200860);}(_0x2b3f,0x1c6));var _0xf2b3=function(_0x165e8a,_0x170b15){_0x165e8a=_0x165e8a-0x0;var _0x20d955=_0x2b3f[_0x165e8a];return _0x20d955;};'use strict';var moment=require(_0xf2b3('0x0'));var Sequelize=require('sequelize');module[_0xf2b3('0x1')]={'starttime':{'type':Sequelize[_0xf2b3('0x2')],'set':function(_0x357497){this[_0xf2b3('0x3')](_0xf2b3('0x4'),_0x357497);this['setDataValue']('endtime',moment()['format'](_0xf2b3('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xf2b3('0x6')]},'projectname':{'type':Sequelize[_0xf2b3('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf2b3('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf2b3('0x6')]},'completed':{'type':Sequelize[_0xf2b3('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6a5b4f5..f3e108b 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 _0x416b=['pick','SessionId','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','count','includeAll','findAll','rows','catch','show','include','options','create','body','find','params','findOne','JscriptyQuestionReport'];(function(_0x59ae7b,_0x15f21b){var _0xd73afa=function(_0x4ce5d5){while(--_0x4ce5d5){_0x59ae7b['push'](_0x59ae7b['shift']());}};_0xd73afa(++_0x15f21b);}(_0x416b,0xa2));var _0xb416=function(_0x590f0c,_0x1f7002){_0x590f0c=_0x590f0c-0x0;var _0x2de6e0=_0x416b[_0x590f0c];return _0x2de6e0;};'use strict';var pdf=require(_0xb416('0x0'));var emlformat=require(_0xb416('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb416('0x2'));var jsonpatch=require(_0xb416('0x3'));var rp=require(_0xb416('0x4'));var moment=require(_0xb416('0x5'));var BPromise=require(_0xb416('0x6'));var Mustache=require(_0xb416('0x7'));var util=require(_0xb416('0x8'));var path=require(_0xb416('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb416('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb416('0xb'));var deskjs=require(_0xb416('0xc'));var toCsv=require(_0xb416('0xd'));var querystring=require(_0xb416('0xe'));var Papa=require(_0xb416('0xf'));var Redis=require('ioredis');var authService=require(_0xb416('0x10'));var qs=require(_0xb416('0x11'));var as=require(_0xb416('0x12'));var hardwareService=require(_0xb416('0x13'));var logger=require('../../config/logger')(_0xb416('0x14'));var utils=require(_0xb416('0x15'));var config=require(_0xb416('0x16'));var db=require(_0xb416('0x17'))['db'];function respondWithStatusCode(_0x4625d7,_0x13ef53){_0x13ef53=_0x13ef53||0xcc;return function(_0x5334cd){if(_0x5334cd){return _0x4625d7[_0xb416('0x18')](_0x13ef53);}return _0x4625d7[_0xb416('0x19')](_0x13ef53)[_0xb416('0x1a')]();};}function respondWithResult(_0x1ab26a,_0x4c602e){_0x4c602e=_0x4c602e||0xc8;return function(_0x3c8201){if(_0x3c8201){return _0x1ab26a[_0xb416('0x19')](_0x4c602e)['json'](_0x3c8201);}};}function respondWithFilteredResult(_0xb68a4c,_0xea74fb){return function(_0x115f9d){if(_0x115f9d){var _0x1bc366=_0x115f9d['count'],_0x21ec9e=_0xea74fb['offset'],_0x3e9c5b=_0xea74fb[_0xb416('0x1b')]+_0xea74fb[_0xb416('0x1c')],_0x131b35;if(_0x3e9c5b>=_0x1bc366){_0x3e9c5b=_0x1bc366;_0x131b35=0xc8;}else{_0x131b35=0xce;}_0xb68a4c[_0xb416('0x19')](_0x131b35);return _0xb68a4c[_0xb416('0x1d')](_0xb416('0x1e'),_0x21ec9e+'-'+_0x3e9c5b+'/'+_0x1bc366)[_0xb416('0x1f')](_0x115f9d);}return null;};}function patchUpdates(_0x17e08c){return function(_0x35fe62){try{jsonpatch[_0xb416('0x20')](_0x35fe62,_0x17e08c,!![]);}catch(_0x1892f1){return BPromise[_0xb416('0x21')](_0x1892f1);}return _0x35fe62[_0xb416('0x22')]();};}function saveUpdates(_0x39ff3e,_0x33a6e6){return function(_0x477923){if(_0x477923){return _0x477923[_0xb416('0x23')](_0x39ff3e)[_0xb416('0x24')](function(_0x7a749a){return _0x7a749a;});}return null;};}function removeEntity(_0x2b38cb,_0x21a024){return function(_0x2dbcdf){if(_0x2dbcdf){return _0x2dbcdf[_0xb416('0x25')]()['then'](function(){_0x2b38cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d80ff,_0x1174c2){return function(_0x1d94da){if(!_0x1d94da){_0x1d80ff[_0xb416('0x18')](0x194);}return _0x1d94da;};}function handleError(_0x120ebc,_0x4f1d07){_0x4f1d07=_0x4f1d07||0x1f4;return function(_0x1cd246){logger[_0xb416('0x26')](_0x1cd246['stack']);if(_0x1cd246[_0xb416('0x27')]){delete _0x1cd246[_0xb416('0x27')];}_0x120ebc[_0xb416('0x19')](_0x4f1d07)[_0xb416('0x28')](_0x1cd246);};}exports[_0xb416('0x29')]=function(_0x1c458b,_0x1840a8){var _0x52b1fc={},_0x31af27={},_0x2b433f={'count':0x0,'rows':[]};var _0x50dc0e=_[_0xb416('0x2a')](db[_0xb416('0x2b')][_0xb416('0x2c')],function(_0x12b51a){return{'name':_0x12b51a[_0xb416('0x2d')],'type':_0x12b51a[_0xb416('0x2e')][_0xb416('0x2f')]};});_0x31af27['model']=_[_0xb416('0x2a')](_0x50dc0e,_0xb416('0x27'));_0x31af27[_0xb416('0x30')]=_[_0xb416('0x31')](_0x1c458b[_0xb416('0x30')]);_0x31af27[_0xb416('0x32')]=_['intersection'](_0x31af27[_0xb416('0x33')],_0x31af27[_0xb416('0x30')]);_0x52b1fc[_0xb416('0x34')]=_[_0xb416('0x35')](_0x31af27[_0xb416('0x33')],qs[_0xb416('0x36')](_0x1c458b[_0xb416('0x30')][_0xb416('0x36')]));_0x52b1fc[_0xb416('0x34')]=_0x52b1fc[_0xb416('0x34')][_0xb416('0x37')]?_0x52b1fc[_0xb416('0x34')]:_0x31af27[_0xb416('0x33')];if(!_0x1c458b[_0xb416('0x30')][_0xb416('0x38')](_0xb416('0x39'))){_0x52b1fc['limit']=qs[_0xb416('0x1c')](_0x1c458b[_0xb416('0x30')][_0xb416('0x1c')]);_0x52b1fc[_0xb416('0x1b')]=qs[_0xb416('0x1b')](_0x1c458b[_0xb416('0x30')][_0xb416('0x1b')]);}_0x52b1fc[_0xb416('0x3a')]=qs[_0xb416('0x3b')](_0x1c458b[_0xb416('0x30')][_0xb416('0x3b')]);_0x52b1fc['where']=qs['filters'](_['pick'](_0x1c458b[_0xb416('0x30')],_0x31af27[_0xb416('0x32')]),_0x50dc0e);if(_0x1c458b[_0xb416('0x30')][_0xb416('0x3c')]){_0x52b1fc[_0xb416('0x3d')]=_['merge'](_0x52b1fc[_0xb416('0x3d')],{'$or':_[_0xb416('0x2a')](_0x50dc0e,function(_0x1e4803){if(_0x1e4803['type']!==_0xb416('0x3e')){var _0x20c99c={};_0x20c99c[_0x1e4803[_0xb416('0x27')]]={'$like':'%'+_0x1c458b[_0xb416('0x30')][_0xb416('0x3c')]+'%'};return _0x20c99c;}})});}_0x52b1fc=_[_0xb416('0x3f')]({},_0x52b1fc,_0x1c458b['options']);var _0x76ef27={'where':_0x52b1fc[_0xb416('0x3d')]};return db[_0xb416('0x2b')][_0xb416('0x40')](_0x76ef27)['then'](function(_0x4fe123){_0x2b433f[_0xb416('0x40')]=_0x4fe123;if(_0x1c458b['query'][_0xb416('0x41')]){_0x52b1fc['include']=[{'all':!![]}];}return db[_0xb416('0x2b')][_0xb416('0x42')](_0x52b1fc);})[_0xb416('0x24')](function(_0x75e116){_0x2b433f[_0xb416('0x43')]=_0x75e116;return _0x2b433f;})[_0xb416('0x24')](respondWithFilteredResult(_0x1840a8,_0x52b1fc))[_0xb416('0x44')](handleError(_0x1840a8,null));};exports[_0xb416('0x45')]=function(_0x38da78,_0x2f7461){var _0x3525b4={'raw':!![],'where':{'id':_0x38da78['params']['id']}},_0x5d38f6={};_0x5d38f6[_0xb416('0x33')]=_[_0xb416('0x31')](db[_0xb416('0x2b')][_0xb416('0x2c')]);_0x5d38f6[_0xb416('0x30')]=_['keys'](_0x38da78[_0xb416('0x30')]);_0x5d38f6[_0xb416('0x32')]=_['intersection'](_0x5d38f6['model'],_0x5d38f6['query']);_0x3525b4[_0xb416('0x34')]=_[_0xb416('0x35')](_0x5d38f6[_0xb416('0x33')],qs[_0xb416('0x36')](_0x38da78[_0xb416('0x30')][_0xb416('0x36')]));_0x3525b4['attributes']=_0x3525b4[_0xb416('0x34')][_0xb416('0x37')]?_0x3525b4[_0xb416('0x34')]:_0x5d38f6[_0xb416('0x33')];if(_0x38da78[_0xb416('0x30')]['includeAll']){_0x3525b4[_0xb416('0x46')]=[{'all':!![]}];}_0x3525b4=_[_0xb416('0x3f')]({},_0x3525b4,_0x38da78[_0xb416('0x47')]);return db['JscriptySessionReport']['find'](_0x3525b4)['then'](handleEntityNotFound(_0x2f7461,null))['then'](respondWithResult(_0x2f7461,null))[_0xb416('0x44')](handleError(_0x2f7461,null));};exports[_0xb416('0x48')]=function(_0x4e1c06,_0x42be0a){return db[_0xb416('0x2b')][_0xb416('0x48')](_0x4e1c06[_0xb416('0x49')],{})['then'](respondWithResult(_0x42be0a,0xc9))['catch'](handleError(_0x42be0a,null));};exports[_0xb416('0x23')]=function(_0x5568c7,_0x5aff2b){if(_0x5568c7['body']['id']){delete _0x5568c7['body']['id'];}return db[_0xb416('0x2b')][_0xb416('0x4a')]({'where':{'id':_0x5568c7[_0xb416('0x4b')]['id']}})[_0xb416('0x24')](handleEntityNotFound(_0x5aff2b,null))['then'](saveUpdates(_0x5568c7['body'],null))[_0xb416('0x24')](respondWithResult(_0x5aff2b,null))[_0xb416('0x44')](handleError(_0x5aff2b,null));};exports[_0xb416('0x25')]=function(_0x1c8f4a,_0x37612f){return db[_0xb416('0x2b')][_0xb416('0x4a')]({'where':{'id':_0x1c8f4a[_0xb416('0x4b')]['id']}})['then'](handleEntityNotFound(_0x37612f,null))[_0xb416('0x24')](removeEntity(_0x37612f,null))['catch'](handleError(_0x37612f,null));};exports['describe']=function(_0x28e179,_0x42d11c){return db[_0xb416('0x2b')]['describe']()[_0xb416('0x24')](respondWithResult(_0x42d11c,null))[_0xb416('0x44')](handleError(_0x42d11c,null));};exports['getQuestions']=function(_0x36b977,_0x4dade9,_0x4ba75d){var _0x42b9f0={'raw':!![],'where':{}};var _0x5ad0a7={};var _0x2f60ee={'count':0x0,'rows':[]};return db[_0xb416('0x2b')][_0xb416('0x4c')]({'where':{'id':_0x36b977[_0xb416('0x4b')]['id']}})[_0xb416('0x24')](handleEntityNotFound(_0x4dade9,null))[_0xb416('0x24')](function(_0x5a8bd7){if(_0x5a8bd7){_0x5ad0a7[_0xb416('0x33')]=_['keys'](db[_0xb416('0x4d')][_0xb416('0x2c')]);_0x5ad0a7[_0xb416('0x30')]=_[_0xb416('0x31')](_0x36b977['query']);_0x5ad0a7[_0xb416('0x32')]=_['intersection'](_0x5ad0a7[_0xb416('0x33')],_0x5ad0a7[_0xb416('0x30')]);_0x42b9f0[_0xb416('0x34')]=_[_0xb416('0x35')](_0x5ad0a7[_0xb416('0x33')],qs[_0xb416('0x36')](_0x36b977[_0xb416('0x30')][_0xb416('0x36')]));_0x42b9f0[_0xb416('0x34')]=_0x42b9f0[_0xb416('0x34')][_0xb416('0x37')]?_0x42b9f0['attributes']:_0x5ad0a7[_0xb416('0x33')];if(!_0x36b977[_0xb416('0x30')]['hasOwnProperty'](_0xb416('0x39'))){_0x42b9f0[_0xb416('0x1c')]=qs[_0xb416('0x1c')](_0x36b977['query'][_0xb416('0x1c')]);_0x42b9f0[_0xb416('0x1b')]=qs[_0xb416('0x1b')](_0x36b977[_0xb416('0x30')]['offset']);}_0x42b9f0[_0xb416('0x3a')]=qs[_0xb416('0x3b')](_0x36b977[_0xb416('0x30')][_0xb416('0x3b')]);_0x42b9f0[_0xb416('0x3d')]=qs[_0xb416('0x32')](_[_0xb416('0x4e')](_0x36b977[_0xb416('0x30')],_0x5ad0a7['filters']));_0x42b9f0['where'][_0xb416('0x4f')]=_0x5a8bd7['id'];if(_0x36b977[_0xb416('0x30')]['filter']){_0x42b9f0[_0xb416('0x3d')]=_['merge'](_0x42b9f0[_0xb416('0x3d')],{'$or':_[_0xb416('0x2a')](_0x42b9f0[_0xb416('0x34')],function(_0x441248){var _0x43ddca={};_0x43ddca[_0x441248]={'$like':'%'+_0x36b977['query']['filter']+'%'};return _0x43ddca;})});}_0x42b9f0=_[_0xb416('0x3f')]({},_0x42b9f0,_0x36b977[_0xb416('0x47')]);return db[_0xb416('0x4d')][_0xb416('0x40')]({'where':_0x42b9f0[_0xb416('0x3d')]})[_0xb416('0x24')](function(_0x575d1d){_0x2f60ee[_0xb416('0x40')]=_0x575d1d;if(_0x36b977[_0xb416('0x30')]['includeAll']){_0x42b9f0[_0xb416('0x46')]=[{'all':!![]}];}return db[_0xb416('0x4d')][_0xb416('0x42')](_0x42b9f0);})[_0xb416('0x24')](function(_0x400600){_0x2f60ee[_0xb416('0x43')]=_0x400600;return _0x2f60ee;});}})[_0xb416('0x24')](respondWithFilteredResult(_0x4dade9,_0x42b9f0))[_0xb416('0x44')](handleError(_0x4dade9,null));}; \ No newline at end of file +var _0xf2c9=['intersection','options','find','catch','create','body','update','params','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','nolimit','SessionId','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','end','error','stack','name','send','map','JscriptySessionReport','fieldName','type','key','model','query','keys','attributes','fields','length','order','sort','filters','pick','filter','merge','where','includeAll','include','rows','then','show','rawAttributes'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xf2c9,0xf7));var _0x9f2c=function(_0x5b82e9,_0x382fe1){_0x5b82e9=_0x5b82e9-0x0;var _0x204239=_0xf2c9[_0x5b82e9];return _0x204239;};'use strict';var pdf=require(_0x9f2c('0x0'));var emlformat=require(_0x9f2c('0x1'));var rimraf=require(_0x9f2c('0x2'));var zipdir=require(_0x9f2c('0x3'));var jsonpatch=require(_0x9f2c('0x4'));var rp=require('request-promise');var moment=require(_0x9f2c('0x5'));var BPromise=require(_0x9f2c('0x6'));var Mustache=require(_0x9f2c('0x7'));var util=require(_0x9f2c('0x8'));var path=require(_0x9f2c('0x9'));var sox=require(_0x9f2c('0xa'));var csv=require(_0x9f2c('0xb'));var ejs=require(_0x9f2c('0xc'));var fs=require('fs');var _=require(_0x9f2c('0xd'));var squel=require(_0x9f2c('0xe'));var crypto=require(_0x9f2c('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9f2c('0xb'));var querystring=require('querystring');var Papa=require(_0x9f2c('0x10'));var Redis=require(_0x9f2c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f2c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f2c('0x13'));var logger=require(_0x9f2c('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd933,_0x1e31e3){_0x1e31e3=_0x1e31e3||0xcc;return function(_0x46d723){if(_0x46d723){return _0x5dd933[_0x9f2c('0x15')](_0x1e31e3);}return _0x5dd933[_0x9f2c('0x16')](_0x1e31e3)['end']();};}function respondWithResult(_0x29a1d6,_0x1f0ed5){_0x1f0ed5=_0x1f0ed5||0xc8;return function(_0x27122e){if(_0x27122e){return _0x29a1d6[_0x9f2c('0x16')](_0x1f0ed5)[_0x9f2c('0x17')](_0x27122e);}};}function respondWithFilteredResult(_0x23c229,_0x5ec2cb){return function(_0x2de5d5){if(_0x2de5d5){var _0x2ccc73=_0x2de5d5[_0x9f2c('0x18')],_0x386b00=_0x5ec2cb['offset'],_0x265c7d=_0x5ec2cb[_0x9f2c('0x19')]+_0x5ec2cb[_0x9f2c('0x1a')],_0x326239;if(_0x265c7d>=_0x2ccc73){_0x265c7d=_0x2ccc73;_0x326239=0xc8;}else{_0x326239=0xce;}_0x23c229[_0x9f2c('0x16')](_0x326239);return _0x23c229[_0x9f2c('0x1b')](_0x9f2c('0x1c'),_0x386b00+'-'+_0x265c7d+'/'+_0x2ccc73)[_0x9f2c('0x17')](_0x2de5d5);}return null;};}function patchUpdates(_0x353bb2){return function(_0x1ff6dd){try{jsonpatch[_0x9f2c('0x1d')](_0x1ff6dd,_0x353bb2,!![]);}catch(_0x51e427){return BPromise[_0x9f2c('0x1e')](_0x51e427);}return _0x1ff6dd[_0x9f2c('0x1f')]();};}function saveUpdates(_0x2de552,_0x424adb){return function(_0x4ca8e4){if(_0x4ca8e4){return _0x4ca8e4['update'](_0x2de552)['then'](function(_0x5041e5){return _0x5041e5;});}return null;};}function removeEntity(_0x19a915,_0x598daa){return function(_0x4d741d){if(_0x4d741d){return _0x4d741d['destroy']()['then'](function(){_0x19a915[_0x9f2c('0x16')](0xcc)[_0x9f2c('0x20')]();});}};}function handleEntityNotFound(_0x5ca76b,_0x139604){return function(_0x2d956b){if(!_0x2d956b){_0x5ca76b[_0x9f2c('0x15')](0x194);}return _0x2d956b;};}function handleError(_0x1abec7,_0x5516be){_0x5516be=_0x5516be||0x1f4;return function(_0x28c12b){logger[_0x9f2c('0x21')](_0x28c12b[_0x9f2c('0x22')]);if(_0x28c12b['name']){delete _0x28c12b[_0x9f2c('0x23')];}_0x1abec7[_0x9f2c('0x16')](_0x5516be)[_0x9f2c('0x24')](_0x28c12b);};}exports['index']=function(_0x5b5763,_0x48b877){var _0x4275d7={},_0x2950ee={},_0x29740b={'count':0x0,'rows':[]};var _0x1facf1=_[_0x9f2c('0x25')](db[_0x9f2c('0x26')]['rawAttributes'],function(_0x444a65){return{'name':_0x444a65[_0x9f2c('0x27')],'type':_0x444a65[_0x9f2c('0x28')][_0x9f2c('0x29')]};});_0x2950ee[_0x9f2c('0x2a')]=_['map'](_0x1facf1,_0x9f2c('0x23'));_0x2950ee[_0x9f2c('0x2b')]=_[_0x9f2c('0x2c')](_0x5b5763[_0x9f2c('0x2b')]);_0x2950ee['filters']=_['intersection'](_0x2950ee[_0x9f2c('0x2a')],_0x2950ee[_0x9f2c('0x2b')]);_0x4275d7[_0x9f2c('0x2d')]=_['intersection'](_0x2950ee['model'],qs[_0x9f2c('0x2e')](_0x5b5763[_0x9f2c('0x2b')]['fields']));_0x4275d7[_0x9f2c('0x2d')]=_0x4275d7[_0x9f2c('0x2d')][_0x9f2c('0x2f')]?_0x4275d7['attributes']:_0x2950ee[_0x9f2c('0x2a')];if(!_0x5b5763[_0x9f2c('0x2b')]['hasOwnProperty']('nolimit')){_0x4275d7[_0x9f2c('0x1a')]=qs[_0x9f2c('0x1a')](_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x1a')]);_0x4275d7[_0x9f2c('0x19')]=qs[_0x9f2c('0x19')](_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x19')]);}_0x4275d7[_0x9f2c('0x30')]=qs[_0x9f2c('0x31')](_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x31')]);_0x4275d7['where']=qs[_0x9f2c('0x32')](_[_0x9f2c('0x33')](_0x5b5763[_0x9f2c('0x2b')],_0x2950ee[_0x9f2c('0x32')]),_0x1facf1);if(_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x34')]){_0x4275d7['where']=_['merge'](_0x4275d7['where'],{'$or':_[_0x9f2c('0x25')](_0x1facf1,function(_0x43b28a){if(_0x43b28a[_0x9f2c('0x28')]!=='VIRTUAL'){var _0x1882f9={};_0x1882f9[_0x43b28a['name']]={'$like':'%'+_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x34')]+'%'};return _0x1882f9;}})});}_0x4275d7=_[_0x9f2c('0x35')]({},_0x4275d7,_0x5b5763['options']);var _0x321ac3={'where':_0x4275d7[_0x9f2c('0x36')]};return db[_0x9f2c('0x26')][_0x9f2c('0x18')](_0x321ac3)['then'](function(_0x5055e5){_0x29740b[_0x9f2c('0x18')]=_0x5055e5;if(_0x5b5763[_0x9f2c('0x2b')][_0x9f2c('0x37')]){_0x4275d7[_0x9f2c('0x38')]=[{'all':!![]}];}return db[_0x9f2c('0x26')]['findAll'](_0x4275d7);})['then'](function(_0xd95ced){_0x29740b[_0x9f2c('0x39')]=_0xd95ced;return _0x29740b;})[_0x9f2c('0x3a')](respondWithFilteredResult(_0x48b877,_0x4275d7))['catch'](handleError(_0x48b877,null));};exports[_0x9f2c('0x3b')]=function(_0x2eaa4c,_0x3ade1d){var _0x14e698={'raw':!![],'where':{'id':_0x2eaa4c['params']['id']}},_0x530104={};_0x530104[_0x9f2c('0x2a')]=_['keys'](db[_0x9f2c('0x26')][_0x9f2c('0x3c')]);_0x530104['query']=_[_0x9f2c('0x2c')](_0x2eaa4c[_0x9f2c('0x2b')]);_0x530104[_0x9f2c('0x32')]=_[_0x9f2c('0x3d')](_0x530104[_0x9f2c('0x2a')],_0x530104[_0x9f2c('0x2b')]);_0x14e698[_0x9f2c('0x2d')]=_[_0x9f2c('0x3d')](_0x530104[_0x9f2c('0x2a')],qs[_0x9f2c('0x2e')](_0x2eaa4c['query'][_0x9f2c('0x2e')]));_0x14e698['attributes']=_0x14e698[_0x9f2c('0x2d')]['length']?_0x14e698[_0x9f2c('0x2d')]:_0x530104[_0x9f2c('0x2a')];if(_0x2eaa4c['query'][_0x9f2c('0x37')]){_0x14e698[_0x9f2c('0x38')]=[{'all':!![]}];}_0x14e698=_[_0x9f2c('0x35')]({},_0x14e698,_0x2eaa4c[_0x9f2c('0x3e')]);return db[_0x9f2c('0x26')][_0x9f2c('0x3f')](_0x14e698)['then'](handleEntityNotFound(_0x3ade1d,null))['then'](respondWithResult(_0x3ade1d,null))[_0x9f2c('0x40')](handleError(_0x3ade1d,null));};exports[_0x9f2c('0x41')]=function(_0x3e4bdc,_0x2d9fc2){return db[_0x9f2c('0x26')][_0x9f2c('0x41')](_0x3e4bdc[_0x9f2c('0x42')],{})[_0x9f2c('0x3a')](respondWithResult(_0x2d9fc2,0xc9))[_0x9f2c('0x40')](handleError(_0x2d9fc2,null));};exports[_0x9f2c('0x43')]=function(_0x133e6f,_0x5a7a37){if(_0x133e6f[_0x9f2c('0x42')]['id']){delete _0x133e6f[_0x9f2c('0x42')]['id'];}return db[_0x9f2c('0x26')]['find']({'where':{'id':_0x133e6f[_0x9f2c('0x44')]['id']}})[_0x9f2c('0x3a')](handleEntityNotFound(_0x5a7a37,null))[_0x9f2c('0x3a')](saveUpdates(_0x133e6f[_0x9f2c('0x42')],null))[_0x9f2c('0x3a')](respondWithResult(_0x5a7a37,null))[_0x9f2c('0x40')](handleError(_0x5a7a37,null));};exports['destroy']=function(_0x5e38cc,_0x355605){return db[_0x9f2c('0x26')][_0x9f2c('0x3f')]({'where':{'id':_0x5e38cc[_0x9f2c('0x44')]['id']}})['then'](handleEntityNotFound(_0x355605,null))[_0x9f2c('0x3a')](removeEntity(_0x355605,null))[_0x9f2c('0x40')](handleError(_0x355605,null));};exports[_0x9f2c('0x45')]=function(_0x5edba1,_0x16d001){return db['JscriptySessionReport'][_0x9f2c('0x45')]()[_0x9f2c('0x3a')](respondWithResult(_0x16d001,null))[_0x9f2c('0x40')](handleError(_0x16d001,null));};exports[_0x9f2c('0x46')]=function(_0x43f4b2,_0x1af779,_0x3da0f2){var _0x2d313f={'raw':!![],'where':{}};var _0x378612={};var _0x4bbd86={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x9f2c('0x47')]({'where':{'id':_0x43f4b2[_0x9f2c('0x44')]['id']}})[_0x9f2c('0x3a')](handleEntityNotFound(_0x1af779,null))[_0x9f2c('0x3a')](function(_0x2fe5b4){if(_0x2fe5b4){_0x378612[_0x9f2c('0x2a')]=_[_0x9f2c('0x2c')](db[_0x9f2c('0x48')][_0x9f2c('0x3c')]);_0x378612[_0x9f2c('0x2b')]=_[_0x9f2c('0x2c')](_0x43f4b2[_0x9f2c('0x2b')]);_0x378612[_0x9f2c('0x32')]=_[_0x9f2c('0x3d')](_0x378612[_0x9f2c('0x2a')],_0x378612['query']);_0x2d313f[_0x9f2c('0x2d')]=_[_0x9f2c('0x3d')](_0x378612[_0x9f2c('0x2a')],qs['fields'](_0x43f4b2[_0x9f2c('0x2b')][_0x9f2c('0x2e')]));_0x2d313f[_0x9f2c('0x2d')]=_0x2d313f[_0x9f2c('0x2d')][_0x9f2c('0x2f')]?_0x2d313f[_0x9f2c('0x2d')]:_0x378612[_0x9f2c('0x2a')];if(!_0x43f4b2['query'][_0x9f2c('0x49')](_0x9f2c('0x4a'))){_0x2d313f['limit']=qs['limit'](_0x43f4b2[_0x9f2c('0x2b')][_0x9f2c('0x1a')]);_0x2d313f[_0x9f2c('0x19')]=qs['offset'](_0x43f4b2[_0x9f2c('0x2b')][_0x9f2c('0x19')]);}_0x2d313f[_0x9f2c('0x30')]=qs[_0x9f2c('0x31')](_0x43f4b2[_0x9f2c('0x2b')]['sort']);_0x2d313f['where']=qs[_0x9f2c('0x32')](_[_0x9f2c('0x33')](_0x43f4b2['query'],_0x378612[_0x9f2c('0x32')]));_0x2d313f[_0x9f2c('0x36')][_0x9f2c('0x4b')]=_0x2fe5b4['id'];if(_0x43f4b2['query'][_0x9f2c('0x34')]){_0x2d313f[_0x9f2c('0x36')]=_['merge'](_0x2d313f[_0x9f2c('0x36')],{'$or':_[_0x9f2c('0x25')](_0x2d313f[_0x9f2c('0x2d')],function(_0x2acf50){var _0x524710={};_0x524710[_0x2acf50]={'$like':'%'+_0x43f4b2[_0x9f2c('0x2b')][_0x9f2c('0x34')]+'%'};return _0x524710;})});}_0x2d313f=_['merge']({},_0x2d313f,_0x43f4b2['options']);return db[_0x9f2c('0x48')]['count']({'where':_0x2d313f[_0x9f2c('0x36')]})[_0x9f2c('0x3a')](function(_0x3357c2){_0x4bbd86[_0x9f2c('0x18')]=_0x3357c2;if(_0x43f4b2['query'][_0x9f2c('0x37')]){_0x2d313f[_0x9f2c('0x38')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x9f2c('0x4c')](_0x2d313f);})['then'](function(_0xed90a4){_0x4bbd86[_0x9f2c('0x39')]=_0xed90a4;return _0x4bbd86;});}})['then'](respondWithFilteredResult(_0x1af779,_0x2d313f))[_0x9f2c('0x40')](handleError(_0x1af779,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0d7396e..1f2cae7 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 _0x4137=['path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa1e2fd,_0x1c9305){var _0x218880=function(_0x405167){while(--_0x405167){_0xa1e2fd['push'](_0xa1e2fd['shift']());}};_0x218880(++_0x1c9305);}(_0x4137,0xf8));var _0x7413=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4137[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));module[_0x7413('0xb')]=function(_0x4fbade,_0xc808cd){return _0x4fbade[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':_0x7413('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36c3=['define','JscriptySessionReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x162583,_0x4eb59c){var _0x1a44d3=function(_0xc37d11){while(--_0xc37d11){_0x162583['push'](_0x162583['shift']());}};_0x1a44d3(++_0x4eb59c);}(_0x36c3,0x1a6));var _0x336c=function(_0x2f0bf1,_0x183ef1){_0x2f0bf1=_0x2f0bf1-0x0;var _0xf1df38=_0x36c3[_0x2f0bf1];return _0xf1df38;};'use strict';var _=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var logger=require('../../config/logger')(_0x336c('0x2'));var moment=require(_0x336c('0x3'));var BPromise=require(_0x336c('0x4'));var rp=require(_0x336c('0x5'));var fs=require('fs');var path=require(_0x336c('0x6'));var rimraf=require(_0x336c('0x7'));var config=require(_0x336c('0x8'));var attributes=require('./jscriptySessionReport.attributes');module[_0x336c('0x9')]=function(_0x2e0016,_0x2097a8){return _0x2e0016[_0x336c('0xa')](_0x336c('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 8ba7b57..4e6e72f 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 _0xc632=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x1e7869,_0x2b8cb0){var _0x4ae90f=function(_0xb07099){while(--_0xb07099){_0x1e7869['push'](_0x1e7869['shift']());}};_0x4ae90f(++_0x2b8cb0);}(_0xc632,0xf0));var _0x2c63=function(_0x467f42,_0x1504ae){_0x467f42=_0x467f42-0x0;var _0x496d53=_0xc632[_0x467f42];return _0x496d53;};'use strict';var _=require(_0x2c63('0x0'));var util=require(_0x2c63('0x1'));var moment=require(_0x2c63('0x2'));var BPromise=require(_0x2c63('0x3'));var rs=require(_0x2c63('0x4'));var fs=require('fs');var Redis=require(_0x2c63('0x5'));var db=require(_0x2c63('0x6'))['db'];var utils=require(_0x2c63('0x7'));var logger=require(_0x2c63('0x8'))(_0x2c63('0x9'));var config=require(_0x2c63('0xa'));var jayson=require(_0x2c63('0xb'));var client=jayson[_0x2c63('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13b049,_0x16f1d3,_0xfe4e1c){return new BPromise(function(_0x3cb763,_0x387be9){return client['request'](_0x13b049,_0xfe4e1c)['then'](function(_0x1ae757){logger[_0x2c63('0xd')](_0x2c63('0xe'),_0x16f1d3,_0x2c63('0xf'));logger['debug'](_0x2c63('0x10'),_0x16f1d3,'request\x20sent',JSON[_0x2c63('0x11')](_0x1ae757));if(_0x1ae757[_0x2c63('0x12')]){if(_0x1ae757[_0x2c63('0x12')][_0x2c63('0x13')]===0x1f4){logger[_0x2c63('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x16f1d3,_0x1ae757[_0x2c63('0x12')][_0x2c63('0x14')]);return _0x387be9(_0x1ae757[_0x2c63('0x12')]['message']);}logger['error'](_0x2c63('0xe'),_0x16f1d3,_0x1ae757['error'][_0x2c63('0x14')]);return _0x3cb763(_0x1ae757[_0x2c63('0x12')]['message']);}else{logger[_0x2c63('0xd')](_0x2c63('0xe'),_0x16f1d3,_0x2c63('0xf'));_0x3cb763(_0x1ae757['result'][_0x2c63('0x14')]);}})[_0x2c63('0x15')](function(_0x4efdd4){logger[_0x2c63('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x16f1d3,_0x4efdd4);_0x387be9(_0x4efdd4);});});} \ No newline at end of file +var _0xc4ca=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x3f70e2,_0x57a580){var _0x371537=function(_0x453083){while(--_0x453083){_0x3f70e2['push'](_0x3f70e2['shift']());}};_0x371537(++_0x57a580);}(_0xc4ca,0x141));var _0xac4c=function(_0x4c0620,_0x59846d){_0x4c0620=_0x4c0620-0x0;var _0x11d3c2=_0xc4ca[_0x4c0620];return _0x11d3c2;};'use strict';var _=require(_0xac4c('0x0'));var util=require(_0xac4c('0x1'));var moment=require(_0xac4c('0x2'));var BPromise=require(_0xac4c('0x3'));var rs=require(_0xac4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac4c('0x5'));var logger=require(_0xac4c('0x6'))(_0xac4c('0x7'));var config=require(_0xac4c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xac4c('0x9')][_0xac4c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e2122,_0x54674a,_0x4180fd){return new BPromise(function(_0xe6171d,_0x5c1501){return client[_0xac4c('0xb')](_0x1e2122,_0x4180fd)[_0xac4c('0xc')](function(_0x65166e){logger[_0xac4c('0xd')](_0xac4c('0xe'),_0x54674a,_0xac4c('0xf'));logger[_0xac4c('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x54674a,'request\x20sent',JSON[_0xac4c('0x11')](_0x65166e));if(_0x65166e['error']){if(_0x65166e[_0xac4c('0x12')][_0xac4c('0x13')]===0x1f4){logger[_0xac4c('0x12')](_0xac4c('0xe'),_0x54674a,_0x65166e[_0xac4c('0x12')]['message']);return _0x5c1501(_0x65166e[_0xac4c('0x12')][_0xac4c('0x14')]);}logger[_0xac4c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x54674a,_0x65166e[_0xac4c('0x12')][_0xac4c('0x14')]);return _0xe6171d(_0x65166e['error']['message']);}else{logger[_0xac4c('0xd')](_0xac4c('0xe'),_0x54674a,_0xac4c('0xf'));_0xe6171d(_0x65166e[_0xac4c('0x15')]['message']);}})[_0xac4c('0x16')](function(_0x593909){logger[_0xac4c('0x12')](_0xac4c('0xe'),_0x54674a,_0x593909);_0x5c1501(_0x593909);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index c7bef09..82db7fb 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 _0x8763=['exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','isAuthenticated'];(function(_0xcb1441,_0x3f0b47){var _0x21ac18=function(_0x5ebd1a){while(--_0x5ebd1a){_0xcb1441['push'](_0xcb1441['shift']());}};_0x21ac18(++_0x3f0b47);}(_0x8763,0x1ae));var _0x3876=function(_0xee7e4c,_0x593dbb){_0xee7e4c=_0xee7e4c-0x0;var _0x3e3e0f=_0x8763[_0xee7e4c];return _0x3e3e0f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3876('0x0'));var timeout=require('connect-timeout');var express=require(_0x3876('0x1'));var router=express[_0x3876('0x2')]();var auth=require(_0x3876('0x3'));var interaction=require(_0x3876('0x4'));var config=require(_0x3876('0x5'));var controller=require(_0x3876('0x6'));router[_0x3876('0x7')]('/',controller[_0x3876('0x8')]);router['put']('/:id',auth[_0x3876('0x9')](),controller['update']);module[_0x3876('0xa')]=router; \ No newline at end of file +var _0x0b1b=['get','put','/:id','isAuthenticated','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x0b1b,0x160));var _0xb0b1=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x0b1b[_0x39e283];return _0x7de89f;};'use strict';var multer=require(_0xb0b1('0x0'));var util=require(_0xb0b1('0x1'));var path=require(_0xb0b1('0x2'));var timeout=require(_0xb0b1('0x3'));var express=require(_0xb0b1('0x4'));var router=express['Router']();var auth=require(_0xb0b1('0x5'));var interaction=require(_0xb0b1('0x6'));var config=require(_0xb0b1('0x7'));var controller=require('./license.controller');router[_0xb0b1('0x8')]('/',controller['index']);router[_0xb0b1('0x9')](_0xb0b1('0xa'),auth[_0xb0b1('0xb')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d082990..bf81c5e 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 _0x326f=['STRING','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x326f,0xd1));var _0xf326=function(_0x25ccea,_0x4f40a2){_0x25ccea=_0x25ccea-0x0;var _0x5e5b40=_0x326f[_0x25ccea];return _0x5e5b40;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xf326('0x1')]},'data2':{'type':Sequelize[_0xf326('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xf326('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xabce=['exports','TEXT','STRING','sequelize'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0xabce,0x103));var _0xeabc=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xabce[_0x2cf2e9];return _0xd3670d;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'license':{'type':Sequelize[_0xeabc('0x2')]},'data1':{'type':Sequelize[_0xeabc('0x3')]},'data2':{'type':Sequelize[_0xeabc('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 746cc6c..c15f11f 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 _0x1790=['key','demo','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','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','Content-Range','apply','reject','save','destroy','then','end','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','options','getLicense','catch','update','body','find','params','get','checkLicense'];(function(_0x48a8b1,_0x430af6){var _0x9d7125=function(_0x2b833e){while(--_0x2b833e){_0x48a8b1['push'](_0x48a8b1['shift']());}};_0x9d7125(++_0x430af6);}(_0x1790,0x142));var _0x0179=function(_0x1f1e1c,_0x32535d){_0x1f1e1c=_0x1f1e1c-0x0;var _0xe830e3=_0x1790[_0x1f1e1c];return _0xe830e3;};'use strict';var pdf=require(_0x0179('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0179('0x1'));var zipdir=require(_0x0179('0x2'));var jsonpatch=require(_0x0179('0x3'));var rp=require(_0x0179('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0179('0x5'));var util=require('util');var path=require(_0x0179('0x6'));var sox=require(_0x0179('0x7'));var csv=require(_0x0179('0x8'));var ejs=require(_0x0179('0x9'));var fs=require('fs');var _=require(_0x0179('0xa'));var squel=require('squel');var crypto=require(_0x0179('0xb'));var jsforce=require(_0x0179('0xc'));var deskjs=require(_0x0179('0xd'));var toCsv=require(_0x0179('0x8'));var querystring=require(_0x0179('0xe'));var Papa=require(_0x0179('0xf'));var Redis=require(_0x0179('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0179('0x11'));var hardwareService=require(_0x0179('0x12'));var logger=require(_0x0179('0x13'))(_0x0179('0x14'));var utils=require(_0x0179('0x15'));var config=require(_0x0179('0x16'));var db=require(_0x0179('0x17'))['db'];function respondWithStatusCode(_0x4ca098,_0x37bde5){_0x37bde5=_0x37bde5||0xcc;return function(_0x1e6875){if(_0x1e6875){return _0x4ca098[_0x0179('0x18')](_0x37bde5);}return _0x4ca098[_0x0179('0x19')](_0x37bde5)['end']();};}function respondWithResult(_0x77726a,_0x27b377){_0x27b377=_0x27b377||0xc8;return function(_0x16d230){if(_0x16d230){return _0x77726a[_0x0179('0x19')](_0x27b377)[_0x0179('0x1a')](_0x16d230);}};}function respondWithFilteredResult(_0x142d64,_0x1054ed){return function(_0x21b81e){if(_0x21b81e){var _0xa42a2e=_0x21b81e[_0x0179('0x1b')],_0x525f4a=_0x1054ed['offset'],_0x8c34fc=_0x1054ed[_0x0179('0x1c')]+_0x1054ed[_0x0179('0x1d')],_0x32567b;if(_0x8c34fc>=_0xa42a2e){_0x8c34fc=_0xa42a2e;_0x32567b=0xc8;}else{_0x32567b=0xce;}_0x142d64[_0x0179('0x19')](_0x32567b);return _0x142d64[_0x0179('0x1e')](_0x0179('0x1f'),_0x525f4a+'-'+_0x8c34fc+'/'+_0xa42a2e)['json'](_0x21b81e);}return null;};}function patchUpdates(_0x3dd5b6){return function(_0x350258){try{jsonpatch[_0x0179('0x20')](_0x350258,_0x3dd5b6,!![]);}catch(_0x15d013){return BPromise[_0x0179('0x21')](_0x15d013);}return _0x350258[_0x0179('0x22')]();};}function saveUpdates(_0x3dc4c0,_0x39fcee){return function(_0x386603){if(_0x386603){return _0x386603['update'](_0x3dc4c0)['then'](function(_0xb433ab){return _0xb433ab;});}return null;};}function removeEntity(_0x5c6c5f,_0x5d5280){return function(_0x152147){if(_0x152147){return _0x152147[_0x0179('0x23')]()[_0x0179('0x24')](function(){_0x5c6c5f[_0x0179('0x19')](0xcc)[_0x0179('0x25')]();});}};}function handleEntityNotFound(_0xea006d,_0x123c51){return function(_0x53d4ad){if(!_0x53d4ad){_0xea006d['sendStatus'](0x194);}return _0x53d4ad;};}function handleError(_0x5d8615,_0x40567a){_0x40567a=_0x40567a||0x1f4;return function(_0x328945){logger['error'](_0x328945[_0x0179('0x26')]);if(_0x328945[_0x0179('0x27')]){delete _0x328945[_0x0179('0x27')];}_0x5d8615[_0x0179('0x19')](_0x40567a)[_0x0179('0x28')](_0x328945);};}var utilLicense=require(_0x0179('0x29'));exports[_0x0179('0x2a')]=function(_0x8d5cb7,_0x285456){var _0x4c0a66={'raw':!![],'where':{'id':0x1}},_0x158da3={};_0x158da3[_0x0179('0x2b')]=_[_0x0179('0x2c')](db[_0x0179('0x2d')][_0x0179('0x2e')]);_0x158da3[_0x0179('0x2f')]=_['keys'](_0x8d5cb7[_0x0179('0x2f')]);_0x158da3[_0x0179('0x30')]=_[_0x0179('0x31')](_0x158da3[_0x0179('0x2b')],_0x158da3[_0x0179('0x2f')]);_0x4c0a66['attributes']=_['intersection'](_0x158da3['model'],qs[_0x0179('0x32')](_0x8d5cb7[_0x0179('0x2f')][_0x0179('0x32')]));_0x4c0a66[_0x0179('0x33')]=_0x4c0a66[_0x0179('0x33')][_0x0179('0x34')]?_0x4c0a66[_0x0179('0x33')]:_0x158da3[_0x0179('0x2b')];_0x4c0a66=_['merge']({},_0x4c0a66,_0x8d5cb7[_0x0179('0x35')]);return utilLicense[_0x0179('0x36')](_0x4c0a66)['then'](respondWithResult(_0x285456,null))[_0x0179('0x37')](handleError(_0x285456,null));};exports[_0x0179('0x38')]=function(_0x11844b,_0x2e8cea){if(_0x11844b['body']['id']){delete _0x11844b[_0x0179('0x39')]['id'];}return db[_0x0179('0x2d')][_0x0179('0x3a')]({'where':{'id':_0x11844b[_0x0179('0x3b')]['id']}})[_0x0179('0x24')](handleEntityNotFound(_0x2e8cea,null))[_0x0179('0x24')](function(_0x4a6949){var _0x58cf08=_0x4a6949[_0x0179('0x3c')]({'plain':!![]});return utilLicense[_0x0179('0x3d')](_0x58cf08,_0x11844b[_0x0179('0x39')][_0x0179('0x3e')]);})[_0x0179('0x24')](function(_0x556312){if(!_0x556312[_0x0179('0x3f')]){return saveUpdates(_0x11844b[_0x0179('0x39')],null);}return _0x556312;})['then'](respondWithResult(_0x2e8cea,null))[_0x0179('0x37')](handleError(_0x2e8cea,null));}; \ No newline at end of file +var _0xe74c=['sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','reject','update','then','name','send','../../config/license/util','index','model','keys','query','filters','intersection','fields','attributes','options','getLicense','catch','body','License','find','params','checkLicense','key','demo','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xe74c,0x69));var _0xce74=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe74c[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0xce74('0x0'));var emlformat=require(_0xce74('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xce74('0x2'));var jsonpatch=require(_0xce74('0x3'));var rp=require(_0xce74('0x4'));var moment=require(_0xce74('0x5'));var BPromise=require(_0xce74('0x6'));var Mustache=require('mustache');var util=require(_0xce74('0x7'));var path=require(_0xce74('0x8'));var sox=require(_0xce74('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xce74('0xa'));var squel=require(_0xce74('0xb'));var crypto=require(_0xce74('0xc'));var jsforce=require(_0xce74('0xd'));var deskjs=require(_0xce74('0xe'));var toCsv=require(_0xce74('0xf'));var querystring=require(_0xce74('0x10'));var Papa=require(_0xce74('0x11'));var Redis=require('ioredis');var authService=require(_0xce74('0x12'));var qs=require(_0xce74('0x13'));var as=require(_0xce74('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce74('0x15'))(_0xce74('0x16'));var utils=require(_0xce74('0x17'));var config=require('../../config/environment');var db=require(_0xce74('0x18'))['db'];function respondWithStatusCode(_0x3559a5,_0x1339c1){_0x1339c1=_0x1339c1||0xcc;return function(_0x507f8f){if(_0x507f8f){return _0x3559a5['sendStatus'](_0x1339c1);}return _0x3559a5[_0xce74('0x19')](_0x1339c1)[_0xce74('0x1a')]();};}function respondWithResult(_0x4ba8ec,_0x48a8e8){_0x48a8e8=_0x48a8e8||0xc8;return function(_0x2ec655){if(_0x2ec655){return _0x4ba8ec[_0xce74('0x19')](_0x48a8e8)['json'](_0x2ec655);}};}function respondWithFilteredResult(_0x4ddda8,_0x183534){return function(_0x4261b3){if(_0x4261b3){var _0x492ac6=_0x4261b3[_0xce74('0x1b')],_0x21c093=_0x183534[_0xce74('0x1c')],_0x5211b1=_0x183534[_0xce74('0x1c')]+_0x183534[_0xce74('0x1d')],_0x16e572;if(_0x5211b1>=_0x492ac6){_0x5211b1=_0x492ac6;_0x16e572=0xc8;}else{_0x16e572=0xce;}_0x4ddda8[_0xce74('0x19')](_0x16e572);return _0x4ddda8['set'](_0xce74('0x1e'),_0x21c093+'-'+_0x5211b1+'/'+_0x492ac6)[_0xce74('0x1f')](_0x4261b3);}return null;};}function patchUpdates(_0x2b65ab){return function(_0x2eb36c){try{jsonpatch[_0xce74('0x20')](_0x2eb36c,_0x2b65ab,!![]);}catch(_0x279310){return BPromise[_0xce74('0x21')](_0x279310);}return _0x2eb36c['save']();};}function saveUpdates(_0x877683,_0x22f983){return function(_0x18d162){if(_0x18d162){return _0x18d162[_0xce74('0x22')](_0x877683)[_0xce74('0x23')](function(_0x19ab0a){return _0x19ab0a;});}return null;};}function removeEntity(_0x42d2a2,_0x208949){return function(_0x2c07b5){if(_0x2c07b5){return _0x2c07b5['destroy']()['then'](function(){_0x42d2a2[_0xce74('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x560b34,_0x1b1a18){return function(_0x47f26b){if(!_0x47f26b){_0x560b34['sendStatus'](0x194);}return _0x47f26b;};}function handleError(_0x47d8ee,_0x5eb660){_0x5eb660=_0x5eb660||0x1f4;return function(_0x1a3cdd){logger['error'](_0x1a3cdd['stack']);if(_0x1a3cdd[_0xce74('0x24')]){delete _0x1a3cdd['name'];}_0x47d8ee[_0xce74('0x19')](_0x5eb660)[_0xce74('0x25')](_0x1a3cdd);};}var utilLicense=require(_0xce74('0x26'));exports[_0xce74('0x27')]=function(_0x1b0677,_0x45ef47){var _0x5243cf={'raw':!![],'where':{'id':0x1}},_0x43a4df={};_0x43a4df[_0xce74('0x28')]=_[_0xce74('0x29')](db['License']['rawAttributes']);_0x43a4df[_0xce74('0x2a')]=_[_0xce74('0x29')](_0x1b0677[_0xce74('0x2a')]);_0x43a4df[_0xce74('0x2b')]=_[_0xce74('0x2c')](_0x43a4df[_0xce74('0x28')],_0x43a4df[_0xce74('0x2a')]);_0x5243cf['attributes']=_[_0xce74('0x2c')](_0x43a4df['model'],qs[_0xce74('0x2d')](_0x1b0677[_0xce74('0x2a')]['fields']));_0x5243cf[_0xce74('0x2e')]=_0x5243cf[_0xce74('0x2e')]['length']?_0x5243cf[_0xce74('0x2e')]:_0x43a4df[_0xce74('0x28')];_0x5243cf=_['merge']({},_0x5243cf,_0x1b0677[_0xce74('0x2f')]);return utilLicense[_0xce74('0x30')](_0x5243cf)['then'](respondWithResult(_0x45ef47,null))[_0xce74('0x31')](handleError(_0x45ef47,null));};exports['update']=function(_0x138e5b,_0xa23c8a){if(_0x138e5b['body']['id']){delete _0x138e5b[_0xce74('0x32')]['id'];}return db[_0xce74('0x33')][_0xce74('0x34')]({'where':{'id':_0x138e5b[_0xce74('0x35')]['id']}})[_0xce74('0x23')](handleEntityNotFound(_0xa23c8a,null))[_0xce74('0x23')](function(_0x38483a){var _0x4720a6=_0x38483a['get']({'plain':!![]});return utilLicense[_0xce74('0x36')](_0x4720a6,_0x138e5b[_0xce74('0x32')][_0xce74('0x37')]);})[_0xce74('0x23')](function(_0x219f30){if(!_0x219f30[_0xce74('0x38')]){return saveUpdates(_0x138e5b[_0xce74('0x32')],null);}return _0x219f30;})['then'](respondWithResult(_0xa23c8a,null))['catch'](handleError(_0xa23c8a,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index aaeb2a7..4cde440 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(_0x1a3d47,_0x107544){var _0x454caa=function(_0x46b636){while(--_0x46b636){_0x1a3d47['push'](_0x1a3d47['shift']());}};_0x454caa(++_0x107544);}(_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 _0x5f2f=['bluebird','request-promise','path','./license.attributes','exports','define','License','lodash','util','../../config/logger','api','moment'];(function(_0x278289,_0x3ad345){var _0x5351cc=function(_0x27ba4d){while(--_0x27ba4d){_0x278289['push'](_0x278289['shift']());}};_0x5351cc(++_0x3ad345);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b22e6,_0x3f2337){_0x2b22e6=_0x2b22e6-0x0;var _0x225b25=_0x5f2f[_0x2b22e6];return _0x225b25;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 69a4e0f..09612b1 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 _0x7d80=['License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7d80,0x17a));var _0x07d8=function(_0x10019b,_0x453c47){_0x10019b=_0x10019b-0x0;var _0xeea1bb=_0x7d80[_0x10019b];return _0xeea1bb;};'use strict';var _=require('lodash');var util=require(_0x07d8('0x0'));var moment=require(_0x07d8('0x1'));var BPromise=require(_0x07d8('0x2'));var rs=require(_0x07d8('0x3'));var fs=require('fs');var Redis=require(_0x07d8('0x4'));var db=require(_0x07d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x07d8('0x6'))('rpc');var config=require(_0x07d8('0x7'));var jayson=require(_0x07d8('0x8'));var client=jayson[_0x07d8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e9c64,_0x1be62a,_0x4b1625){return new BPromise(function(_0x52c68d,_0x510267){return client[_0x07d8('0xa')](_0x5e9c64,_0x4b1625)[_0x07d8('0xb')](function(_0x52a662){logger[_0x07d8('0xc')](_0x07d8('0xd'),_0x1be62a,_0x07d8('0xe'));logger[_0x07d8('0xf')](_0x07d8('0x10'),_0x1be62a,_0x07d8('0xe'),JSON[_0x07d8('0x11')](_0x52a662));if(_0x52a662['error']){if(_0x52a662[_0x07d8('0x12')][_0x07d8('0x13')]===0x1f4){logger[_0x07d8('0x12')](_0x07d8('0xd'),_0x1be62a,_0x52a662[_0x07d8('0x12')][_0x07d8('0x14')]);return _0x510267(_0x52a662[_0x07d8('0x12')]['message']);}logger[_0x07d8('0x12')](_0x07d8('0xd'),_0x1be62a,_0x52a662[_0x07d8('0x12')][_0x07d8('0x14')]);return _0x52c68d(_0x52a662[_0x07d8('0x12')][_0x07d8('0x14')]);}else{logger['info'](_0x07d8('0xd'),_0x1be62a,_0x07d8('0xe'));_0x52c68d(_0x52a662[_0x07d8('0x15')][_0x07d8('0x14')]);}})[_0x07d8('0x16')](function(_0x4ea297){logger[_0x07d8('0x12')](_0x07d8('0xd'),_0x1be62a,_0x4ea297);_0x510267(_0x4ea297);});});} \ No newline at end of file +var _0xb12d=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','License,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5886e0,_0x211c32){var _0x2307a0=function(_0x247fec){while(--_0x247fec){_0x5886e0['push'](_0x5886e0['shift']());}};_0x2307a0(++_0x211c32);}(_0xb12d,0x124));var _0xdb12=function(_0x22f85a,_0x195ed5){_0x22f85a=_0x22f85a-0x0;var _0xaa717=_0xb12d[_0x22f85a];return _0xaa717;};'use strict';var _=require(_0xdb12('0x0'));var util=require(_0xdb12('0x1'));var moment=require(_0xdb12('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb12('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb12('0x4'))['db'];var utils=require(_0xdb12('0x5'));var logger=require(_0xdb12('0x6'))(_0xdb12('0x7'));var config=require(_0xdb12('0x8'));var jayson=require(_0xdb12('0x9'));var client=jayson['client'][_0xdb12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e73f,_0x27eb31,_0x3872c3){return new BPromise(function(_0x11385d,_0x11d97c){return client[_0xdb12('0xb')](_0x19e73f,_0x3872c3)[_0xdb12('0xc')](function(_0x54eb5b){logger[_0xdb12('0xd')]('License,\x20%s,\x20%s',_0x27eb31,_0xdb12('0xe'));logger[_0xdb12('0xf')](_0xdb12('0x10'),_0x27eb31,'request\x20sent',JSON[_0xdb12('0x11')](_0x54eb5b));if(_0x54eb5b[_0xdb12('0x12')]){if(_0x54eb5b[_0xdb12('0x12')]['code']===0x1f4){logger[_0xdb12('0x12')]('License,\x20%s,\x20%s',_0x27eb31,_0x54eb5b[_0xdb12('0x12')][_0xdb12('0x13')]);return _0x11d97c(_0x54eb5b[_0xdb12('0x12')]['message']);}logger[_0xdb12('0x12')](_0xdb12('0x14'),_0x27eb31,_0x54eb5b['error'][_0xdb12('0x13')]);return _0x11385d(_0x54eb5b['error'][_0xdb12('0x13')]);}else{logger[_0xdb12('0xd')]('License,\x20%s,\x20%s',_0x27eb31,_0xdb12('0xe'));_0x11385d(_0x54eb5b[_0xdb12('0x15')][_0xdb12('0x13')]);}})[_0xdb12('0x16')](function(_0x504cf5){logger['error'](_0xdb12('0x14'),_0x27eb31,_0x504cf5);_0x11d97c(_0x504cf5);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 7b7f672..6a933b7 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 _0x5b22=['addDisposition','post','/:id/canned_answers','addAnswer','/:id/in_servers','send','addAgents','put','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','/describe','describe','/:id','show','get','/:id/dispositions','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents'];(function(_0x230bd1,_0x5a2e9a){var _0x526919=function(_0x26b641){while(--_0x26b641){_0x230bd1['push'](_0x230bd1['shift']());}};_0x526919(++_0x5a2e9a);}(_0x5b22,0xb7));var _0x25b2=function(_0x17f9c4,_0x5328c1){_0x17f9c4=_0x17f9c4-0x0;var _0x447e90=_0x5b22[_0x17f9c4];return _0x447e90;};'use strict';var multer=require('multer');var util=require(_0x25b2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x25b2('0x1'));var router=express[_0x25b2('0x2')]();var auth=require(_0x25b2('0x3'));var interaction=require(_0x25b2('0x4'));var config=require(_0x25b2('0x5'));var controller=require(_0x25b2('0x6'));router['get']('/',auth[_0x25b2('0x7')](),controller['index']);router['get'](_0x25b2('0x8'),auth['isAuthenticated'](),controller[_0x25b2('0x9')]);router['get'](_0x25b2('0xa'),auth[_0x25b2('0x7')](),controller[_0x25b2('0xb')]);router[_0x25b2('0xc')](_0x25b2('0xd'),auth[_0x25b2('0x7')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x25b2('0x7')](),controller[_0x25b2('0xe')]);router['get']('/:id/in_servers',auth[_0x25b2('0x7')](),controller[_0x25b2('0xf')]);router[_0x25b2('0xc')](_0x25b2('0x10'),auth['isAuthenticated'](),controller[_0x25b2('0x11')]);router[_0x25b2('0xc')](_0x25b2('0x12'),auth[_0x25b2('0x7')](),controller['getInteractions']);router['get'](_0x25b2('0x13'),auth['isAuthenticated'](),controller[_0x25b2('0x14')]);router[_0x25b2('0xc')](_0x25b2('0x15'),auth[_0x25b2('0x7')](),controller[_0x25b2('0x16')]);router[_0x25b2('0xc')](_0x25b2('0x17'),auth[_0x25b2('0x7')](),controller[_0x25b2('0x18')]);router['get'](_0x25b2('0x19'),auth['isAuthenticated'](),controller[_0x25b2('0x1a')]);router['post'](_0x25b2('0xd'),auth[_0x25b2('0x7')](),controller[_0x25b2('0x1b')]);router[_0x25b2('0x1c')](_0x25b2('0x1d'),auth[_0x25b2('0x7')](),controller[_0x25b2('0x1e')]);router[_0x25b2('0x1c')]('/',auth['isAuthenticated'](),controller['create']);router[_0x25b2('0x1c')](_0x25b2('0x1f'),auth[_0x25b2('0x7')](),controller['addImap']);router[_0x25b2('0x1c')](_0x25b2('0x10'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x25b2('0x1c')]('/:id/interactions',auth[_0x25b2('0x7')](),controller['addInteraction']);router['post'](_0x25b2('0x13'),auth[_0x25b2('0x7')](),controller['addApplications']);router['post']('/:id/send',auth[_0x25b2('0x7')](),controller[_0x25b2('0x20')]);router[_0x25b2('0x1c')](_0x25b2('0x19'),auth['isAuthenticated'](),controller[_0x25b2('0x21')]);router[_0x25b2('0x22')](_0x25b2('0xa'),auth['isAuthenticated'](),controller[_0x25b2('0x23')]);router['delete'](_0x25b2('0xd'),auth[_0x25b2('0x7')](),controller[_0x25b2('0x24')]);router[_0x25b2('0x25')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x25b2('0x26')]);router[_0x25b2('0x25')](_0x25b2('0x1f'),auth['isAuthenticated'](),controller[_0x25b2('0x27')]);router['delete'](_0x25b2('0x10'),auth[_0x25b2('0x7')](),controller[_0x25b2('0x28')]);router['delete'](_0x25b2('0xa'),auth[_0x25b2('0x7')](),controller[_0x25b2('0x29')]);router['delete'](_0x25b2('0x19'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x8d67=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','send','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x8d67,0x1ea));var _0x78d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8d67[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x78d6('0x0'));var util=require(_0x78d6('0x1'));var path=require(_0x78d6('0x2'));var timeout=require(_0x78d6('0x3'));var express=require(_0x78d6('0x4'));var router=express[_0x78d6('0x5')]();var auth=require(_0x78d6('0x6'));var interaction=require(_0x78d6('0x7'));var config=require(_0x78d6('0x8'));var controller=require(_0x78d6('0x9'));router[_0x78d6('0xa')]('/',auth[_0x78d6('0xb')](),controller[_0x78d6('0xc')]);router['get']('/describe',auth[_0x78d6('0xb')](),controller['describe']);router[_0x78d6('0xa')](_0x78d6('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x78d6('0xe'),auth['isAuthenticated'](),controller[_0x78d6('0xf')]);router[_0x78d6('0xa')](_0x78d6('0x10'),auth[_0x78d6('0xb')](),controller['getAnswers']);router[_0x78d6('0xa')](_0x78d6('0x11'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x12')]);router['get'](_0x78d6('0x13'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x14')]);router[_0x78d6('0xa')](_0x78d6('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x78d6('0xa')]('/:id/applications',auth[_0x78d6('0xb')](),controller['getApplications']);router['get']('/:id/messages',auth[_0x78d6('0xb')](),controller[_0x78d6('0x16')]);router[_0x78d6('0xa')](_0x78d6('0x17'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x18')]);router['get'](_0x78d6('0x19'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x1a')]);router[_0x78d6('0x1b')](_0x78d6('0xe'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x1c')]);router[_0x78d6('0x1b')]('/:id/canned_answers',auth[_0x78d6('0xb')](),controller[_0x78d6('0x1d')]);router[_0x78d6('0x1b')]('/',auth[_0x78d6('0xb')](),controller['create']);router[_0x78d6('0x1b')](_0x78d6('0x11'),auth['isAuthenticated'](),controller['addImap']);router['post'](_0x78d6('0x13'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x1e')]);router['post'](_0x78d6('0x15'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x1f')]);router[_0x78d6('0x1b')](_0x78d6('0x20'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x21')]);router[_0x78d6('0x1b')](_0x78d6('0x22'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x23')]);router['post']('/:id/users',auth[_0x78d6('0xb')](),controller['addAgents']);router['put'](_0x78d6('0xd'),auth['isAuthenticated'](),controller[_0x78d6('0x24')]);router[_0x78d6('0x25')](_0x78d6('0xe'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x26')]);router[_0x78d6('0x25')](_0x78d6('0x10'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x27')]);router['delete']('/:id/in_servers',auth[_0x78d6('0xb')](),controller[_0x78d6('0x28')]);router[_0x78d6('0x25')](_0x78d6('0x13'),auth[_0x78d6('0xb')](),controller[_0x78d6('0x29')]);router[_0x78d6('0x25')]('/:id',auth[_0x78d6('0xb')](),controller[_0x78d6('0x2a')]);router[_0x78d6('0x25')]('/:id/users',auth[_0x78d6('0xb')](),controller[_0x78d6('0x2b')]);module[_0x78d6('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 2b22e27..15cdecd 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 _0x92b8=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','TEXT','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x1c0b89,_0x41617b){var _0x84ccd4=function(_0x15849e){while(--_0x15849e){_0x1c0b89['push'](_0x1c0b89['shift']());}};_0x84ccd4(++_0x41617b);}(_0x92b8,0x16a));var _0x892b=function(_0x57d469,_0x26d449){_0x57d469=_0x57d469-0x0;var _0x16371e=_0x92b8[_0x57d469];return _0x16371e;};'use strict';var Sequelize=require(_0x892b('0x0'));module[_0x892b('0x1')]={'description':{'type':Sequelize[_0x892b('0x2')]},'name':{'type':Sequelize[_0x892b('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x892b('0x3')]},'markAsUnread':{'type':Sequelize[_0x892b('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x892b('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x892b('0x3')],'defaultValue':function(){return _0x892b('0x5');}},'notificationSound':{'type':Sequelize[_0x892b('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x892b('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x892b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x892b('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x892b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x892b('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x892b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x892b('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x892b('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x892b('0x4')],'defaultValue':![],'comment':_0x892b('0x8'),'set':function(_0x5be4c6){if(!_0x5be4c6)this[_0x892b('0x9')](_0x892b('0xa'),null);this[_0x892b('0x9')](_0x892b('0xb'),_0x5be4c6);}}}; \ No newline at end of file +var _0x2197=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x59d798,_0x31ef7b){var _0x4dd1ab=function(_0xbb63f3){while(--_0xbb63f3){_0x59d798['push'](_0x59d798['shift']());}};_0x4dd1ab(++_0x31ef7b);}(_0x2197,0x11b));var _0x7219=function(_0x19e494,_0x3496a2){_0x19e494=_0x19e494-0x0;var _0xca04a3=_0x2197[_0x19e494];return _0xca04a3;};'use strict';var Sequelize=require(_0x7219('0x0'));module[_0x7219('0x1')]={'description':{'type':Sequelize[_0x7219('0x2')]},'name':{'type':Sequelize[_0x7219('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7219('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7219('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7219('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7219('0x4')]},'markAsUnread':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7219('0x2')],'allowNull':![],'defaultValue':_0x7219('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x7219('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7219('0x4')],'defaultValue':function(){return _0x7219('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7219('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7219('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7219('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7219('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x7219('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x7219('0x3')],'defaultValue':![],'comment':_0x7219('0xa'),'set':function(_0x2b62ad){if(!_0x2b62ad)this[_0x7219('0xb')](_0x7219('0xc'),null);this['setDataValue'](_0x7219('0xd'),_0x2b62ad);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index cdb4411..11033d2 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 _0x97d3=['params','find','body','Pause','describe','addDisposition','Disposition','create','findOne','rawAttributes','hasOwnProperty','nolimit','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','ListId','isNil','active','description','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','cservice','role','UserProfileSection','MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','Contact','User','fullname','internal','Tag','color','tag','addApplications','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','destroy','stack','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x3d2efb,_0x2da24c){var _0x2f3462=function(_0x5d1f8b){while(--_0x5d1f8b){_0x3d2efb['push'](_0x3d2efb['shift']());}};_0x2f3462(++_0x2da24c);}(_0x97d3,0x1dd));var _0x397d=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x97d3[_0x4b2436];return _0x4f5ab2;};'use strict';var pdf=require(_0x397d('0x0'));var emlformat=require(_0x397d('0x1'));var rimraf=require(_0x397d('0x2'));var zipdir=require(_0x397d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x397d('0x4'));var moment=require(_0x397d('0x5'));var BPromise=require(_0x397d('0x6'));var Mustache=require(_0x397d('0x7'));var util=require(_0x397d('0x8'));var path=require(_0x397d('0x9'));var sox=require(_0x397d('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x397d('0xb'));var squel=require('squel');var crypto=require(_0x397d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x397d('0xd'));var toCsv=require(_0x397d('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x397d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x397d('0x10'));var as=require(_0x397d('0x11'));var hardwareService=require(_0x397d('0x12'));var logger=require(_0x397d('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x397d('0x14'))['db'];config['redis']=_['defaults'](config[_0x397d('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x397d('0x16'))(new Redis(config[_0x397d('0x15')]));require(_0x397d('0x17'))[_0x397d('0x18')](socket);var jayson=require(_0x397d('0x19'));var client=jayson[_0x397d('0x1a')][_0x397d('0x1b')]({'port':0x232b});function checkPasswordPattern(_0x2d5bf9,_0x3a8140,_0x33d9b5){if(_0x33d9b5){var _0x31695a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31695a[_0x397d('0x1c')](_0x3a8140)){return _0x2d5bf9;}else{throw new db['Sequelize']['ValidationError'](_0x397d('0x1d'));}}else{return _0x2d5bf9;}}function respondWithRpcPromise(_0x12f684,_0x1672bb,_0x77b83c,_0x5669fb){return new BPromise(function(_0xed3ae7,_0x582367){var _0x2bb10c=_0x5669fb||client;return _0x2bb10c['request'](_0x12f684,_0x77b83c)['then'](function(_0x5c58e0){logger[_0x397d('0x1e')]('MailAccount,\x20%s,\x20%s',_0x1672bb,_0x397d('0x1f'));logger[_0x397d('0x20')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x1672bb,_0x397d('0x1f'),JSON[_0x397d('0x21')](_0x5c58e0));if(_0x5c58e0['error']){if(_0x5c58e0[_0x397d('0x22')]['code']===0x1f4){logger[_0x397d('0x22')](_0x397d('0x23'),_0x1672bb,_0x5c58e0[_0x397d('0x22')][_0x397d('0x24')]);return _0x582367(_0x5c58e0[_0x397d('0x22')][_0x397d('0x24')]);}logger[_0x397d('0x22')](_0x397d('0x23'),_0x1672bb,_0x5c58e0[_0x397d('0x22')][_0x397d('0x24')]);return _0xed3ae7(_0x5c58e0['error'][_0x397d('0x24')]);}else{logger[_0x397d('0x1e')]('MailAccount,\x20%s,\x20%s',_0x1672bb,'request\x20sent');_0xed3ae7(_0x5c58e0[_0x397d('0x25')][_0x397d('0x24')]);}})['catch'](function(_0x556a1d){logger[_0x397d('0x22')](_0x397d('0x23'),_0x1672bb,_0x556a1d);_0x582367(_0x556a1d);});});}function respondWithStatusCode(_0x23917a,_0xffc1d6){_0xffc1d6=_0xffc1d6||0xcc;return function(_0x57e6b0){if(_0x57e6b0){return _0x23917a[_0x397d('0x26')](_0xffc1d6);}return _0x23917a[_0x397d('0x27')](_0xffc1d6)[_0x397d('0x28')]();};}function respondWithResult(_0x302ac3,_0x3878df){_0x3878df=_0x3878df||0xc8;return function(_0x39caeb){if(_0x39caeb){return _0x302ac3[_0x397d('0x27')](_0x3878df)[_0x397d('0x29')](_0x39caeb);}};}function respondWithFilteredResult(_0x41ff76,_0xe14d63){return function(_0x50c9fa){if(_0x50c9fa){var _0x4ab0b3=_0x50c9fa[_0x397d('0x2a')],_0x23b902=_0xe14d63[_0x397d('0x2b')],_0x16f33c=_0xe14d63[_0x397d('0x2b')]+_0xe14d63[_0x397d('0x2c')],_0x155f14;if(_0x16f33c>=_0x4ab0b3){_0x16f33c=_0x4ab0b3;_0x155f14=0xc8;}else{_0x155f14=0xce;}_0x41ff76[_0x397d('0x27')](_0x155f14);return _0x41ff76[_0x397d('0x2d')](_0x397d('0x2e'),_0x23b902+'-'+_0x16f33c+'/'+_0x4ab0b3)[_0x397d('0x29')](_0x50c9fa);}return null;};}function patchUpdates(_0xa4ec2){return function(_0x33e349){try{jsonpatch[_0x397d('0x2f')](_0x33e349,_0xa4ec2,!![]);}catch(_0x58bcb5){return BPromise[_0x397d('0x30')](_0x58bcb5);}return _0x33e349[_0x397d('0x31')]();};}function saveUpdates(_0x4f09a0,_0x14091c){return function(_0x5e8a97){if(_0x5e8a97){return _0x5e8a97[_0x397d('0x32')](_0x4f09a0)[_0x397d('0x33')](function(_0x536623){return _0x536623;});}return null;};}function removeEntity(_0x40397f,_0x14a775){return function(_0x1e6e9c){if(_0x1e6e9c){return _0x1e6e9c['destroy']()[_0x397d('0x33')](function(){var _0xa3729e=_0x1e6e9c[_0x397d('0x34')]({'plain':!![]});var _0x2815cc='MailAccounts';return db['UserProfileResource'][_0x397d('0x35')]({'where':{'type':_0x2815cc,'resourceId':_0xa3729e['id']}})[_0x397d('0x33')](function(){return _0x1e6e9c;});})['then'](function(){_0x40397f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xaeb3a8,_0xab6673){return function(_0x20162a){if(!_0x20162a){_0xaeb3a8[_0x397d('0x26')](0x194);}return _0x20162a;};}function handleError(_0x132941,_0x1cf963){_0x1cf963=_0x1cf963||0x1f4;return function(_0x24d981){logger[_0x397d('0x22')](_0x24d981[_0x397d('0x36')]);if(_0x24d981[_0x397d('0x37')]){delete _0x24d981[_0x397d('0x37')];}_0x132941[_0x397d('0x27')](_0x1cf963)[_0x397d('0x38')](_0x24d981);};}exports[_0x397d('0x39')]=function(_0x261bc5,_0x189b92){var _0x52c1d8={'include':[{'model':db[_0x397d('0x3a')],'as':_0x397d('0x3b')},{'model':db[_0x397d('0x3c')],'as':_0x397d('0x3d')},{'model':db['Pause'],'as':_0x397d('0x3e')}]},_0x5b51fe={},_0x38a350={'count':0x0,'rows':[]};var _0x1cbbc5=_[_0x397d('0x3f')](db[_0x397d('0x40')]['rawAttributes'],function(_0x7b5085){return{'name':_0x7b5085[_0x397d('0x41')],'type':_0x7b5085[_0x397d('0x42')][_0x397d('0x43')]};});_0x5b51fe[_0x397d('0x44')]=_['map'](_0x1cbbc5,'name');_0x5b51fe[_0x397d('0x45')]=_[_0x397d('0x46')](_0x261bc5[_0x397d('0x45')]);_0x5b51fe['filters']=_[_0x397d('0x47')](_0x5b51fe['model'],_0x5b51fe['query']);_0x52c1d8['attributes']=_[_0x397d('0x47')](_0x5b51fe[_0x397d('0x44')],qs[_0x397d('0x48')](_0x261bc5[_0x397d('0x45')][_0x397d('0x48')]));_0x52c1d8[_0x397d('0x49')]=_0x52c1d8['attributes'][_0x397d('0x4a')]?_0x52c1d8['attributes']:_0x5b51fe[_0x397d('0x44')];if(!_0x261bc5[_0x397d('0x45')]['hasOwnProperty']('nolimit')){_0x52c1d8[_0x397d('0x2c')]=qs[_0x397d('0x2c')](_0x261bc5[_0x397d('0x45')][_0x397d('0x2c')]);_0x52c1d8[_0x397d('0x2b')]=qs[_0x397d('0x2b')](_0x261bc5['query'][_0x397d('0x2b')]);}_0x52c1d8[_0x397d('0x4b')]=qs[_0x397d('0x4c')](_0x261bc5[_0x397d('0x45')]['sort']);_0x52c1d8[_0x397d('0x4d')]=qs[_0x397d('0x4e')](_[_0x397d('0x4f')](_0x261bc5[_0x397d('0x45')],_0x5b51fe[_0x397d('0x4e')]),_0x1cbbc5);if(_0x261bc5[_0x397d('0x45')][_0x397d('0x50')]){_0x52c1d8[_0x397d('0x4d')]=_['merge'](_0x52c1d8[_0x397d('0x4d')],{'$or':_['map'](_0x1cbbc5,function(_0x4e59d3){if(_0x4e59d3[_0x397d('0x42')]!==_0x397d('0x51')){var _0x22e3e2={};_0x22e3e2[_0x4e59d3['name']]={'$like':'%'+_0x261bc5[_0x397d('0x45')]['filter']+'%'};return _0x22e3e2;}})});}_0x52c1d8=_[_0x397d('0x52')]({},_0x52c1d8,_0x261bc5[_0x397d('0x53')]);var _0x14337f={'where':_0x52c1d8[_0x397d('0x4d')]};return db[_0x397d('0x40')][_0x397d('0x2a')](_0x14337f)[_0x397d('0x33')](function(_0x37294c){_0x38a350[_0x397d('0x2a')]=_0x37294c;if(_0x261bc5[_0x397d('0x45')][_0x397d('0x54')]){_0x52c1d8[_0x397d('0x55')]=[{'all':!![]}];}return db[_0x397d('0x40')][_0x397d('0x56')](_0x52c1d8);})['then'](function(_0x3596d8){_0x38a350[_0x397d('0x57')]=_0x3596d8;return _0x38a350;})[_0x397d('0x33')](respondWithFilteredResult(_0x189b92,_0x52c1d8))[_0x397d('0x58')](handleError(_0x189b92,null));};exports[_0x397d('0x59')]=function(_0x7d7c7c,_0x33b9ed){var _0x358723={'raw':![],'where':{'id':_0x7d7c7c[_0x397d('0x5a')]['id']},'include':[{'model':db[_0x397d('0x3a')],'as':_0x397d('0x3b')},{'model':db[_0x397d('0x3c')],'as':_0x397d('0x3d')},{'model':db['Pause'],'as':_0x397d('0x3e')}]},_0x535b65={};_0x535b65['model']=_[_0x397d('0x46')](db[_0x397d('0x40')]['rawAttributes']);_0x535b65['query']=_[_0x397d('0x46')](_0x7d7c7c[_0x397d('0x45')]);_0x535b65[_0x397d('0x4e')]=_['intersection'](_0x535b65['model'],_0x535b65[_0x397d('0x45')]);_0x358723[_0x397d('0x49')]=_[_0x397d('0x47')](_0x535b65[_0x397d('0x44')],qs[_0x397d('0x48')](_0x7d7c7c[_0x397d('0x45')][_0x397d('0x48')]));_0x358723[_0x397d('0x49')]=_0x358723[_0x397d('0x49')]['length']?_0x358723[_0x397d('0x49')]:_0x535b65[_0x397d('0x44')];if(_0x7d7c7c[_0x397d('0x45')][_0x397d('0x54')]){_0x358723['include']=[{'all':!![]}];}_0x358723=_['merge']({},_0x358723,_0x7d7c7c[_0x397d('0x53')]);return db[_0x397d('0x40')][_0x397d('0x5b')](_0x358723)[_0x397d('0x33')](handleEntityNotFound(_0x33b9ed,null))[_0x397d('0x33')](respondWithResult(_0x33b9ed,null))[_0x397d('0x58')](handleError(_0x33b9ed,null));};exports[_0x397d('0x32')]=function(_0xa06fc6,_0x26f5a0){if(_0xa06fc6['body']['id']){delete _0xa06fc6[_0x397d('0x5c')]['id'];}return db['MailAccount'][_0x397d('0x5b')]({'where':{'id':_0xa06fc6['params']['id']},'include':[{'model':db[_0x397d('0x3a')],'as':_0x397d('0x3b')},{'model':db[_0x397d('0x3c')],'as':_0x397d('0x3d')},{'model':db[_0x397d('0x5d')],'as':_0x397d('0x3e')}]})[_0x397d('0x33')](handleEntityNotFound(_0x26f5a0,null))[_0x397d('0x33')](saveUpdates(_0xa06fc6[_0x397d('0x5c')],null))[_0x397d('0x33')](function(_0x217131){if(_0x217131&&_0xa06fc6['body'][_0x397d('0x3b')]){return db[_0x397d('0x3a')][_0x397d('0x32')](_0xa06fc6[_0x397d('0x5c')]['Imap'],{'where':{'MailAccountId':_0x217131['id']}})[_0x397d('0x33')](function(){return _0x217131;});}return _0x217131;})[_0x397d('0x33')](function(_0x1349b5){if(_0x1349b5&&_0xa06fc6[_0x397d('0x5c')][_0x397d('0x3d')]){return db[_0x397d('0x3c')][_0x397d('0x32')](_0xa06fc6['body']['Smtp'],{'where':{'MailAccountId':_0x1349b5['id']}})[_0x397d('0x33')](function(){return _0x1349b5;});}return _0x1349b5;})[_0x397d('0x33')](respondWithResult(_0x26f5a0,null))[_0x397d('0x58')](handleError(_0x26f5a0,null));};exports[_0x397d('0x5e')]=function(_0x51e116,_0x1361ff){return db[_0x397d('0x40')][_0x397d('0x5e')]()[_0x397d('0x33')](respondWithResult(_0x1361ff,null))[_0x397d('0x58')](handleError(_0x1361ff,null));};exports[_0x397d('0x5f')]=function(_0x10b485,_0x49e7ae,_0x180297){if(_0x10b485[_0x397d('0x5c')]['id']){delete _0x10b485[_0x397d('0x5c')]['id'];}return db[_0x397d('0x40')][_0x397d('0x5b')]({'where':{'id':_0x10b485[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x49e7ae,null))[_0x397d('0x33')](function(_0x3428b8){if(_0x3428b8){_0x10b485[_0x397d('0x5c')]['MailAccountId']=_0x3428b8['id'];return db[_0x397d('0x60')][_0x397d('0x61')](_0x10b485[_0x397d('0x5c')]);}})['then'](respondWithResult(_0x49e7ae,null))['catch'](handleError(_0x49e7ae,null));};exports['getDispositions']=function(_0xb4fcc5,_0x3da694,_0x18fe53){var _0x530eb7={'raw':![],'where':{}};var _0x236796={};var _0x3ccb6f={'count':0x0,'rows':[]};return db['MailAccount'][_0x397d('0x62')]({'where':{'id':_0xb4fcc5[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x3da694,null))[_0x397d('0x33')](function(_0x2a0cd2){if(_0x2a0cd2){_0x236796[_0x397d('0x44')]=_[_0x397d('0x46')](db['Disposition'][_0x397d('0x63')]);_0x236796['query']=_[_0x397d('0x46')](_0xb4fcc5[_0x397d('0x45')]);_0x236796[_0x397d('0x4e')]=_[_0x397d('0x47')](_0x236796[_0x397d('0x44')],_0x236796[_0x397d('0x45')]);_0x530eb7[_0x397d('0x49')]=_['intersection'](_0x236796[_0x397d('0x44')],qs[_0x397d('0x48')](_0xb4fcc5[_0x397d('0x45')][_0x397d('0x48')]));_0x530eb7['attributes']=_0x530eb7[_0x397d('0x49')][_0x397d('0x4a')]?_0x530eb7[_0x397d('0x49')]:_0x236796[_0x397d('0x44')];if(!_0xb4fcc5['query'][_0x397d('0x64')](_0x397d('0x65'))){_0x530eb7[_0x397d('0x2c')]=qs[_0x397d('0x2c')](_0xb4fcc5[_0x397d('0x45')]['limit']);_0x530eb7[_0x397d('0x2b')]=qs[_0x397d('0x2b')](_0xb4fcc5['query'][_0x397d('0x2b')]);}_0x530eb7['order']=qs[_0x397d('0x4c')](_0xb4fcc5[_0x397d('0x45')][_0x397d('0x4c')]);_0x530eb7[_0x397d('0x4d')]=qs[_0x397d('0x4e')](_[_0x397d('0x4f')](_0xb4fcc5[_0x397d('0x45')],_0x236796[_0x397d('0x4e')]));_0x530eb7[_0x397d('0x4d')][_0x397d('0x66')]=_0x2a0cd2['id'];if(_0xb4fcc5['query'][_0x397d('0x50')]){_0x530eb7[_0x397d('0x4d')]=_[_0x397d('0x52')](_0x530eb7[_0x397d('0x4d')],{'$or':_[_0x397d('0x3f')](_0x530eb7[_0x397d('0x49')],function(_0x367b50){var _0x5e9e12={};_0x5e9e12[_0x367b50]={'$like':'%'+_0xb4fcc5[_0x397d('0x45')][_0x397d('0x50')]+'%'};return _0x5e9e12;})});}_0x530eb7=_['merge']({},_0x530eb7,_0xb4fcc5['options']);return db[_0x397d('0x60')][_0x397d('0x2a')]({'where':_0x530eb7[_0x397d('0x4d')]})['then'](function(_0x50fd9a){_0x3ccb6f[_0x397d('0x2a')]=_0x50fd9a;if(_0xb4fcc5['query'][_0x397d('0x54')]){_0x530eb7[_0x397d('0x55')]=[{'all':!![]}];}return db[_0x397d('0x60')][_0x397d('0x56')](_0x530eb7);})['then'](function(_0x5df40a){_0x3ccb6f[_0x397d('0x57')]=_0x5df40a;return _0x3ccb6f;});}})[_0x397d('0x33')](respondWithFilteredResult(_0x3da694,_0x530eb7))['catch'](handleError(_0x3da694,null));};exports['removeDispositions']=function(_0x3bbd07,_0x41144c,_0x476038){return db[_0x397d('0x40')][_0x397d('0x5b')]({'where':{'id':_0x3bbd07[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x41144c,null))[_0x397d('0x33')](function(_0x4ffe1e){if(_0x4ffe1e){return _0x4ffe1e[_0x397d('0x67')](_0x3bbd07[_0x397d('0x45')][_0x397d('0x68')]);}})[_0x397d('0x33')](respondWithStatusCode(_0x41144c,null))['catch'](handleError(_0x41144c,null));};exports[_0x397d('0x69')]=function(_0x1d9290,_0x5234ec,_0x432aad){if(_0x1d9290['body']['id']){delete _0x1d9290[_0x397d('0x5c')]['id'];}return db[_0x397d('0x40')]['find']({'where':{'id':_0x1d9290[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x5234ec,null))[_0x397d('0x33')](function(_0x3673bf){if(_0x3673bf){_0x1d9290[_0x397d('0x5c')][_0x397d('0x66')]=_0x3673bf['id'];return db[_0x397d('0x6a')][_0x397d('0x61')](_0x1d9290[_0x397d('0x5c')]);}})[_0x397d('0x33')](respondWithResult(_0x5234ec,null))[_0x397d('0x58')](handleError(_0x5234ec,null));};exports[_0x397d('0x6b')]=function(_0xeb6a68,_0x3823b8,_0x4a6de4){var _0x552110={'raw':![],'where':{}};var _0x56d2dd={};var _0x5ad851={'count':0x0,'rows':[]};return db['MailAccount'][_0x397d('0x62')]({'where':{'id':_0xeb6a68['params']['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x3823b8,null))[_0x397d('0x33')](function(_0x80981d){if(_0x80981d){_0x56d2dd['model']=_[_0x397d('0x46')](db[_0x397d('0x6a')][_0x397d('0x63')]);_0x56d2dd['query']=_[_0x397d('0x46')](_0xeb6a68[_0x397d('0x45')]);_0x56d2dd['filters']=_[_0x397d('0x47')](_0x56d2dd[_0x397d('0x44')],_0x56d2dd[_0x397d('0x45')]);_0x552110[_0x397d('0x49')]=_['intersection'](_0x56d2dd['model'],qs['fields'](_0xeb6a68['query'][_0x397d('0x48')]));_0x552110[_0x397d('0x49')]=_0x552110[_0x397d('0x49')][_0x397d('0x4a')]?_0x552110[_0x397d('0x49')]:_0x56d2dd['model'];if(!_0xeb6a68['query'][_0x397d('0x64')]('nolimit')){_0x552110[_0x397d('0x2c')]=qs['limit'](_0xeb6a68[_0x397d('0x45')]['limit']);_0x552110[_0x397d('0x2b')]=qs[_0x397d('0x2b')](_0xeb6a68[_0x397d('0x45')][_0x397d('0x2b')]);}_0x552110[_0x397d('0x4b')]=qs[_0x397d('0x4c')](_0xeb6a68[_0x397d('0x45')][_0x397d('0x4c')]);_0x552110[_0x397d('0x4d')]=qs['filters'](_[_0x397d('0x4f')](_0xeb6a68[_0x397d('0x45')],_0x56d2dd[_0x397d('0x4e')]));_0x552110[_0x397d('0x4d')]['MailAccountId']=_0x80981d['id'];if(_0xeb6a68[_0x397d('0x45')]['filter']){_0x552110[_0x397d('0x4d')]=_[_0x397d('0x52')](_0x552110[_0x397d('0x4d')],{'$or':_[_0x397d('0x3f')](_0x552110[_0x397d('0x49')],function(_0x5ce6db){var _0x747816={};_0x747816[_0x5ce6db]={'$like':'%'+_0xeb6a68['query']['filter']+'%'};return _0x747816;})});}_0x552110=_[_0x397d('0x52')]({},_0x552110,_0xeb6a68[_0x397d('0x53')]);return db[_0x397d('0x6a')][_0x397d('0x2a')]({'where':_0x552110[_0x397d('0x4d')]})['then'](function(_0x19554c){_0x5ad851['count']=_0x19554c;if(_0xeb6a68['query'][_0x397d('0x54')]){_0x552110[_0x397d('0x55')]=[{'all':!![]}];}return db[_0x397d('0x6a')][_0x397d('0x56')](_0x552110);})[_0x397d('0x33')](function(_0xbbae3){_0x5ad851['rows']=_0xbbae3;return _0x5ad851;});}})[_0x397d('0x33')](respondWithFilteredResult(_0x3823b8,_0x552110))[_0x397d('0x58')](handleError(_0x3823b8,null));};exports[_0x397d('0x6c')]=function(_0x4e296a,_0x2a4a1c,_0x588336){return db[_0x397d('0x40')]['find']({'where':{'id':_0x4e296a[_0x397d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2a4a1c,null))[_0x397d('0x33')](function(_0x551b6e){if(_0x551b6e){return _0x551b6e[_0x397d('0x6c')](_0x4e296a[_0x397d('0x45')]['ids']);}})[_0x397d('0x33')](respondWithStatusCode(_0x2a4a1c,null))[_0x397d('0x58')](handleError(_0x2a4a1c,null));};exports[_0x397d('0x61')]=function(_0x264cb8,_0x8e29f5){var _0x592f98={'name':_0x264cb8[_0x397d('0x5c')][_0x397d('0x37')],'key':_0x264cb8['body'][_0x397d('0x43')],'email':_0x264cb8['body']['email'],'ListId':_0x264cb8['body'][_0x397d('0x6d')],'active':!_[_0x397d('0x6e')](_0x264cb8['body'][_0x397d('0x6f')])?_0x264cb8['body'][_0x397d('0x6f')]:!![],'description':_0x264cb8[_0x397d('0x5c')][_0x397d('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0x397d('0x6e')](_0x264cb8[_0x397d('0x5c')]['cservice'])){if(_0x264cb8[_0x397d('0x5c')][_0x397d('0x71')]){_0x592f98[_0x397d('0x3b')][_0x397d('0x72')]=_0x592f98[_0x397d('0x3d')][_0x397d('0x72')]=_0x264cb8[_0x397d('0x5c')][_0x397d('0x73')];_0x592f98[_0x397d('0x3b')]['password']=_0x592f98[_0x397d('0x3d')][_0x397d('0x74')]=_0x264cb8[_0x397d('0x5c')][_0x397d('0x75')];}else{_0x592f98[_0x397d('0x3b')][_0x397d('0x76')]=_0x592f98[_0x397d('0x3d')][_0x397d('0x76')]=![];}_0x592f98[_0x397d('0x3b')][_0x397d('0x77')]=_0x264cb8[_0x397d('0x5c')][_0x397d('0x3b')][_0x397d('0x77')];_0x592f98[_0x397d('0x3b')][_0x397d('0x78')]=_0x264cb8[_0x397d('0x5c')][_0x397d('0x3b')]['port'];_0x592f98[_0x397d('0x3d')]['host']=_0x264cb8[_0x397d('0x5c')]['Smtp'][_0x397d('0x77')];_0x592f98[_0x397d('0x3d')]['port']=_0x264cb8[_0x397d('0x5c')][_0x397d('0x3d')][_0x397d('0x78')];}else{_0x592f98['Imap'][_0x397d('0x79')]=_0x592f98['Smtp']['service']=_0x264cb8['body'][_0x397d('0x7a')];_0x592f98[_0x397d('0x3b')][_0x397d('0x72')]=_0x592f98[_0x397d('0x3d')][_0x397d('0x72')]=_0x264cb8[_0x397d('0x5c')][_0x397d('0x73')];_0x592f98['Imap']['password']=_0x592f98[_0x397d('0x3d')]['pass']=_0x264cb8['body'][_0x397d('0x75')];}return db[_0x397d('0x40')][_0x397d('0x61')](_0x592f98,{'include':[{'model':db[_0x397d('0x3c')],'as':_0x397d('0x3d')},{'model':db['MailServerIn'],'as':_0x397d('0x3b')}]})['then'](function(_0xc1196e){var _0x56fcf5=_0x264cb8[_0x397d('0x72')][_0x397d('0x34')]({'plain':!![]});if(!_0x56fcf5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56fcf5[_0x397d('0x7b')]===_0x397d('0x72')){var _0x4fd466=_0xc1196e['get']({'plain':!![]});return db[_0x397d('0x7c')]['find']({'where':{'name':_0x397d('0x7d'),'userProfileId':_0x56fcf5['userProfileId']},'raw':!![]})[_0x397d('0x33')](function(_0x56ffd0){if(_0x56ffd0&&_0x56ffd0[_0x397d('0x7e')]===0x0){return db['UserProfileResource'][_0x397d('0x61')]({'name':_0x4fd466[_0x397d('0x37')],'resourceId':_0x4fd466['id'],'type':_0x56ffd0[_0x397d('0x37')],'sectionId':_0x56ffd0['id']},{})['then'](function(){return _0xc1196e;});}else{return _0xc1196e;}})[_0x397d('0x58')](function(_0xc07dd5){logger[_0x397d('0x22')](_0x397d('0x7f'),_0xc07dd5);throw _0xc07dd5;});}return _0xc1196e;})['then'](respondWithResult(_0x8e29f5,0xc9))['catch'](handleError(_0x8e29f5,null));};exports[_0x397d('0x80')]=function(_0x2aff4d,_0x2aa5a7,_0x216e5d){return db['MailAccount'][_0x397d('0x62')]({'where':{'id':_0x2aff4d[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x2aa5a7,null))['then'](function(_0x1650bb){if(_0x1650bb){return _0x1650bb[_0x397d('0x80')]();}return null;})[_0x397d('0x33')](respondWithResult(_0x2aa5a7,null))[_0x397d('0x58')](handleError(_0x2aa5a7,null));};exports['addImap']=function(_0x5cb322,_0x50a3ee,_0xbf5168){if(_0x5cb322[_0x397d('0x5c')]['id']){delete _0x5cb322['body']['id'];}return db[_0x397d('0x40')][_0x397d('0x5b')]({'where':{'id':_0x5cb322[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x50a3ee,null))[_0x397d('0x33')](function(_0x5da399){if(_0x5da399){_0x5cb322['body'][_0x397d('0x66')]=_0x5da399['id'];return db['MailServerIn']['create'](_0x5cb322[_0x397d('0x5c')]);}})[_0x397d('0x33')](respondWithResult(_0x50a3ee,null))[_0x397d('0x58')](handleError(_0x50a3ee,null));};exports[_0x397d('0x81')]=function(_0x4add1b,_0x169ec6,_0x2d7685){return db[_0x397d('0x40')][_0x397d('0x62')]({'where':{'id':_0x4add1b[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x169ec6,null))[_0x397d('0x33')](function(_0x1e8a84){if(_0x1e8a84){return _0x1e8a84[_0x397d('0x82')](null);}return null;})[_0x397d('0x33')](respondWithStatusCode(_0x169ec6,null))[_0x397d('0x58')](handleError(_0x169ec6,null));};exports['getSmtp']=function(_0x522658,_0x2afd5a,_0x258d72){return db[_0x397d('0x40')]['findOne']({'where':{'id':_0x522658[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x2afd5a,null))[_0x397d('0x33')](function(_0x2eaa8b){if(_0x2eaa8b){return _0x2eaa8b[_0x397d('0x83')]();}return null;})[_0x397d('0x33')](respondWithResult(_0x2afd5a,null))['catch'](handleError(_0x2afd5a,null));};exports['addSmtp']=function(_0xc6e5a9,_0x16b82e,_0x21676d){if(_0xc6e5a9[_0x397d('0x5c')]['id']){delete _0xc6e5a9['body']['id'];}return db[_0x397d('0x40')][_0x397d('0x5b')]({'where':{'id':_0xc6e5a9[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x16b82e,null))['then'](function(_0x1511d7){if(_0x1511d7){_0xc6e5a9[_0x397d('0x5c')][_0x397d('0x66')]=_0x1511d7['id'];return db[_0x397d('0x3c')][_0x397d('0x61')](_0xc6e5a9[_0x397d('0x5c')]);}})[_0x397d('0x33')](respondWithResult(_0x16b82e,null))[_0x397d('0x58')](handleError(_0x16b82e,null));};exports['removeSmtp']=function(_0x3379a8,_0x464e30,_0x47396a){return db[_0x397d('0x40')]['findOne']({'where':{'id':_0x3379a8[_0x397d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x464e30,null))[_0x397d('0x33')](function(_0x17ffa2){if(_0x17ffa2){return _0x17ffa2[_0x397d('0x84')](null);}return null;})[_0x397d('0x33')](respondWithStatusCode(_0x464e30,null))[_0x397d('0x58')](handleError(_0x464e30,null));};exports[_0x397d('0x85')]=function(_0x3744b5,_0x2fbe54,_0x1136bb){return db[_0x397d('0x86')][_0x397d('0x5b')]({'where':{'id':_0x3744b5[_0x397d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2fbe54,null))[_0x397d('0x33')](function(_0x292dfb){if(_0x292dfb){return _0x292dfb[_0x397d('0x85')](_0x3744b5[_0x397d('0x5c')][_0x397d('0x68')],_[_0x397d('0x87')](_0x3744b5[_0x397d('0x5c')],[_0x397d('0x68'),'id'])||{});}})['then'](respondWithResult(_0x2fbe54,null))[_0x397d('0x58')](handleError(_0x2fbe54,null));};exports['getInteractions']=function(_0x4a4e7f,_0x46fbe1,_0x29a8c7){var _0x3dcef0={'raw':![],'where':{}};var _0x2c8ed7={};var _0x4fafa3={'count':0x0,'rows':[]};return db[_0x397d('0x40')][_0x397d('0x62')]({'where':{'id':_0x4a4e7f['params']['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x46fbe1,null))['then'](function(_0x218a9b){if(_0x218a9b){_0x2c8ed7[_0x397d('0x44')]=_[_0x397d('0x46')](db['MailInteraction'][_0x397d('0x63')]);_0x2c8ed7[_0x397d('0x45')]=_['keys'](_0x4a4e7f[_0x397d('0x45')]);_0x2c8ed7[_0x397d('0x4e')]=_[_0x397d('0x47')](_0x2c8ed7[_0x397d('0x44')],_0x2c8ed7[_0x397d('0x45')]);_0x3dcef0[_0x397d('0x49')]=_[_0x397d('0x47')](_0x2c8ed7[_0x397d('0x44')],qs[_0x397d('0x48')](_0x4a4e7f[_0x397d('0x45')]['fields']));_0x3dcef0[_0x397d('0x49')]=_0x3dcef0['attributes'][_0x397d('0x4a')]?_0x3dcef0['attributes']:_0x2c8ed7[_0x397d('0x44')];if(!_0x4a4e7f['query'][_0x397d('0x64')](_0x397d('0x65'))){_0x3dcef0[_0x397d('0x2c')]=qs['limit'](_0x4a4e7f['query'][_0x397d('0x2c')]);_0x3dcef0['offset']=qs[_0x397d('0x2b')](_0x4a4e7f[_0x397d('0x45')][_0x397d('0x2b')]);}_0x3dcef0[_0x397d('0x4b')]=qs[_0x397d('0x4c')](_0x4a4e7f[_0x397d('0x45')][_0x397d('0x4c')]);_0x3dcef0[_0x397d('0x4d')]=qs['filters'](_['pick'](_0x4a4e7f[_0x397d('0x45')],_0x2c8ed7[_0x397d('0x4e')]));_0x3dcef0[_0x397d('0x4d')][_0x397d('0x66')]=_0x218a9b['id'];if(_0x4a4e7f[_0x397d('0x45')][_0x397d('0x50')]){_0x3dcef0['where']=_[_0x397d('0x52')](_0x3dcef0['where'],{'$or':_[_0x397d('0x3f')](_0x3dcef0['attributes'],function(_0x147c6c){var _0x23a823={};_0x23a823[_0x147c6c]={'$like':'%'+_0x4a4e7f[_0x397d('0x45')][_0x397d('0x50')]+'%'};return _0x23a823;})});}_0x3dcef0=_[_0x397d('0x52')]({},_0x3dcef0,_0x4a4e7f[_0x397d('0x53')]);return db[_0x397d('0x86')][_0x397d('0x2a')]({'where':_0x3dcef0[_0x397d('0x4d')]})[_0x397d('0x33')](function(_0x48975c){_0x4fafa3['count']=_0x48975c;if(_0x4a4e7f[_0x397d('0x45')][_0x397d('0x54')]){_0x3dcef0[_0x397d('0x55')]=[{'model':db['CmContact'],'as':_0x397d('0x88'),'required':![]},{'model':db[_0x397d('0x89')],'as':'Owner','attributes':[_0x397d('0x37'),_0x397d('0x8a'),_0x397d('0x8b')],'required':![]},{'model':db[_0x397d('0x8c')],'as':'Tags','attributes':['id',_0x397d('0x37'),_0x397d('0x8d')],'where':_0x4a4e7f[_0x397d('0x45')][_0x397d('0x8e')]?{'id':_0x4a4e7f['query'][_0x397d('0x8e')]}:undefined,'required':_0x4a4e7f[_0x397d('0x45')][_0x397d('0x8e')]?!![]:![]}];}return db['MailInteraction'][_0x397d('0x56')](_0x3dcef0);})[_0x397d('0x33')](function(_0x50e50b){_0x4fafa3[_0x397d('0x57')]=_0x50e50b;return _0x4fafa3;});}})['then'](respondWithFilteredResult(_0x46fbe1,_0x3dcef0))[_0x397d('0x58')](handleError(_0x46fbe1,null));};exports[_0x397d('0x8f')]=function(_0x3488a8,_0x224e7f,_0x3790ef){return db[_0x397d('0x40')][_0x397d('0x62')]({'where':{'id':_0x3488a8['params']['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x224e7f,null))[_0x397d('0x33')](function(_0x1d46f8){if(_0x1d46f8){return db['sequelize'][_0x397d('0x90')](function(_0x555f21){return db[_0x397d('0x91')]['destroy']({'where':{'MailAccountId':_0x3488a8[_0x397d('0x5a')]['id']},'transaction':_0x555f21})[_0x397d('0x33')](function(_0x2094a6){var _0x5f3734=_['map'](_0x3488a8[_0x397d('0x5c')],function(_0x4c6ae1){_0x4c6ae1[_0x397d('0x66')]=_0x3488a8[_0x397d('0x5a')]['id'];return _0x4c6ae1;});return db[_0x397d('0x91')][_0x397d('0x92')](_0x5f3734,{'transaction':_0x555f21});});})[_0x397d('0x33')](function(){return db[_0x397d('0x91')][_0x397d('0x93')]({'where':{'MailAccountId':_0x3488a8[_0x397d('0x5a')]['id']},'order':_0x397d('0x94')});});}})[_0x397d('0x33')](respondWithResult(_0x224e7f,null))['catch'](handleError(_0x224e7f,null));};exports[_0x397d('0x95')]=function(_0x1356d4,_0x2f3db2,_0x27ba8b){var _0x2101a8={};var _0x524882={};var _0x5cfb51;var _0x46b5e4;return db[_0x397d('0x40')][_0x397d('0x62')]({'where':{'id':_0x1356d4[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x2f3db2,null))[_0x397d('0x33')](function(_0x44c8e0){if(_0x44c8e0){_0x5cfb51=_0x44c8e0;_0x524882['model']=_[_0x397d('0x46')](db[_0x397d('0x91')][_0x397d('0x63')]);_0x524882[_0x397d('0x45')]=_[_0x397d('0x46')](_0x1356d4['query']);_0x524882[_0x397d('0x4e')]=_[_0x397d('0x47')](_0x524882['model'],_0x524882[_0x397d('0x45')]);_0x2101a8['attributes']=_[_0x397d('0x47')](_0x524882[_0x397d('0x44')],qs['fields'](_0x1356d4[_0x397d('0x45')][_0x397d('0x48')]));_0x2101a8['attributes']=_0x2101a8[_0x397d('0x49')][_0x397d('0x4a')]?_0x2101a8['attributes']:_0x524882['model'];_0x2101a8['order']=qs[_0x397d('0x4c')](_0x1356d4[_0x397d('0x45')][_0x397d('0x4c')]);_0x2101a8[_0x397d('0x4d')]=qs[_0x397d('0x4e')](_['pick'](_0x1356d4[_0x397d('0x45')],_0x524882[_0x397d('0x4e')]));if(_0x1356d4[_0x397d('0x45')][_0x397d('0x50')]){_0x2101a8[_0x397d('0x4d')]=_[_0x397d('0x52')](_0x2101a8[_0x397d('0x4d')],{'$or':_[_0x397d('0x3f')](_0x2101a8[_0x397d('0x49')],function(_0x57f376){var _0x300b9c={};_0x300b9c[_0x57f376]={'$like':'%'+_0x1356d4['query'][_0x397d('0x50')]+'%'};return _0x300b9c;})});}_0x2101a8=_[_0x397d('0x52')]({},_0x2101a8,_0x1356d4['options']);return _0x5cfb51[_0x397d('0x95')](_0x2101a8);}})['then'](function(_0x373131){if(_0x373131){_0x46b5e4=_0x373131[_0x397d('0x4a')];if(!_0x1356d4['query'][_0x397d('0x64')]('nolimit')){_0x2101a8[_0x397d('0x2c')]=qs['limit'](_0x1356d4[_0x397d('0x45')][_0x397d('0x2c')]);_0x2101a8['offset']=qs['offset'](_0x1356d4['query'][_0x397d('0x2b')]);}return _0x5cfb51[_0x397d('0x95')](_0x2101a8);}})[_0x397d('0x33')](function(_0x5a6f6e){if(_0x5a6f6e){return _0x5a6f6e?{'count':_0x46b5e4,'rows':_0x5a6f6e}:null;}})[_0x397d('0x33')](respondWithResult(_0x2f3db2,null))[_0x397d('0x58')](handleError(_0x2f3db2,null));};exports['getMessages']=function(_0x1870c0,_0x5475a9,_0x25b3dc){var _0x2a2b1c={'raw':!![],'where':{}};var _0x40d0e4={};var _0x27f1e4={'count':0x0,'rows':[]};return db[_0x397d('0x40')][_0x397d('0x62')]({'where':{'id':_0x1870c0[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x5475a9,null))[_0x397d('0x33')](function(_0x2a0785){if(_0x2a0785){_0x40d0e4[_0x397d('0x44')]=_[_0x397d('0x46')](db[_0x397d('0x96')]['rawAttributes']);_0x40d0e4[_0x397d('0x45')]=_[_0x397d('0x46')](_0x1870c0[_0x397d('0x45')]);_0x40d0e4[_0x397d('0x4e')]=_[_0x397d('0x47')](_0x40d0e4[_0x397d('0x44')],_0x40d0e4[_0x397d('0x45')]);_0x2a2b1c[_0x397d('0x49')]=_[_0x397d('0x47')](_0x40d0e4[_0x397d('0x44')],qs[_0x397d('0x48')](_0x1870c0['query']['fields']));_0x2a2b1c['attributes']=_0x2a2b1c[_0x397d('0x49')][_0x397d('0x4a')]?_0x2a2b1c[_0x397d('0x49')]:_0x40d0e4[_0x397d('0x44')];if(!_0x1870c0[_0x397d('0x45')]['hasOwnProperty']('nolimit')){_0x2a2b1c[_0x397d('0x2c')]=qs[_0x397d('0x2c')](_0x1870c0[_0x397d('0x45')][_0x397d('0x2c')]);_0x2a2b1c['offset']=qs[_0x397d('0x2b')](_0x1870c0[_0x397d('0x45')][_0x397d('0x2b')]);}_0x2a2b1c[_0x397d('0x4b')]=qs[_0x397d('0x4c')](_0x1870c0[_0x397d('0x45')][_0x397d('0x4c')]);_0x2a2b1c[_0x397d('0x4d')]=qs['filters'](_[_0x397d('0x4f')](_0x1870c0[_0x397d('0x45')],_0x40d0e4[_0x397d('0x4e')]));_0x2a2b1c[_0x397d('0x4d')][_0x397d('0x66')]=_0x2a0785['id'];if(_0x1870c0[_0x397d('0x45')][_0x397d('0x50')]){_0x2a2b1c['where']=_['merge'](_0x2a2b1c[_0x397d('0x4d')],{'$or':_[_0x397d('0x3f')](_0x2a2b1c['attributes'],function(_0x1d9a8e){var _0x11d3be={};_0x11d3be[_0x1d9a8e]={'$like':'%'+_0x1870c0[_0x397d('0x45')][_0x397d('0x50')]+'%'};return _0x11d3be;})});}if(_0x1870c0[_0x397d('0x45')]['$gte']){var _0x1e3d79=_0x1870c0['query']['$gte'][_0x397d('0x97')](',');var _0x23c32e={};_0x23c32e[_0x1e3d79[0x0]]={'$gte':moment(_0x1e3d79[0x1])[_0x397d('0x98')](_0x397d('0x99'))};_0x2a2b1c[_0x397d('0x4d')]=_[_0x397d('0x52')](_0x2a2b1c[_0x397d('0x4d')],_0x23c32e);}_0x2a2b1c=_['merge']({},_0x2a2b1c,_0x1870c0[_0x397d('0x53')]);return db['MailMessage'][_0x397d('0x2a')]({'where':_0x2a2b1c['where']})[_0x397d('0x33')](function(_0x44d318){_0x27f1e4[_0x397d('0x2a')]=_0x44d318;if(_0x1870c0[_0x397d('0x45')]['includeAll']){_0x2a2b1c[_0x397d('0x55')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x2a2b1c);})[_0x397d('0x33')](function(_0x228f05){_0x27f1e4[_0x397d('0x57')]=_0x228f05;return _0x27f1e4;});}})['then'](respondWithFilteredResult(_0x5475a9,_0x2a2b1c))[_0x397d('0x58')](handleError(_0x5475a9,null));};exports[_0x397d('0x38')]=function(_0x58a1c6,_0x48aabd,_0x5549e9){var _0x329444,_0x2617ac={},_0x11c08c;if(_0x58a1c6[_0x397d('0x5c')]['to']){_0x11c08c=_0x58a1c6['body']['to']['split'](',')[0x0];}return db[_0x397d('0x40')]['find']({'where':{'id':_0x58a1c6[_0x397d('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0x397d('0x9a'),'include':[{'model':db[_0x397d('0x9b')],'as':_0x397d('0x9c'),'where':{'email':_0x11c08c},'limit':0x1,'order':[[_0x397d('0x9d'),_0x397d('0x9e')]]}]},{'model':db[_0x397d('0x3c')],'as':_0x397d('0x3d'),'raw':!![]}]})[_0x397d('0x33')](handleEntityNotFound(_0x48aabd,null))[_0x397d('0x33')](function(_0x2a1756){if(_0x2a1756){_0x329444=_0x2a1756;if(_0x2a1756[_0x397d('0x3d')]){if(_[_0x397d('0x6e')](_0x58a1c6[_0x397d('0x5c')][_0x397d('0x9f')])){_0x58a1c6[_0x397d('0x5c')][_0x397d('0x9f')]=util[_0x397d('0x98')](_0x397d('0xa0'),_0x2a1756[_0x397d('0x37')],_0x2a1756[_0x397d('0xa1')]||_0x2a1756['Smtp']['user']);}if(_0x58a1c6[_0x397d('0x5c')][_0x397d('0xa2')]&&_0x58a1c6[_0x397d('0x5c')][_0x397d('0xa2')][_0x397d('0x4a')]){for(var _0x421ff3=0x0;_0x421ff3<_0x58a1c6['body'][_0x397d('0xa2')][_0x397d('0x4a')];_0x421ff3+=0x1){_0x58a1c6['body'][_0x397d('0xa2')][_0x421ff3]={'filename':_0x58a1c6[_0x397d('0x5c')][_0x397d('0xa2')][_0x421ff3]['name'],'path':path['join'](config[_0x397d('0xa3')],_0x397d('0xa4'),_0x58a1c6[_0x397d('0x5c')][_0x397d('0xa2')][_0x421ff3][_0x397d('0xa5')])};}}var _0x473a6d={'tls':{'rejectUnauthorized':![]}};if(_[_0x397d('0x6e')](_0x2a1756[_0x397d('0x3d')][_0x397d('0x79')])){if(_0x2a1756['Smtp'][_0x397d('0x76')]){_0x473a6d[_0x397d('0xa6')]={'user':_0x2a1756['Smtp'][_0x397d('0x72')],'pass':_0x2a1756[_0x397d('0x3d')]['pass']};}_0x473a6d[_0x397d('0x77')]=_0x2a1756['Smtp'][_0x397d('0x77')];_0x473a6d[_0x397d('0x78')]=_0x2a1756[_0x397d('0x3d')][_0x397d('0x78')];_0x473a6d['secure']=_0x2a1756['Smtp'][_0x397d('0xa7')];}else{_0x473a6d['service']=_0x2a1756['Smtp']['service'];_0x473a6d[_0x397d('0xa6')]={'user':_0x2a1756[_0x397d('0x3d')]['user'],'pass':_0x2a1756[_0x397d('0x3d')][_0x397d('0x74')]};}return respondWithRpcPromise(_0x397d('0xa8'),_0x397d('0xa9'),{'account':_0x473a6d,'message':_0x58a1c6[_0x397d('0x5c')]});}else{throw new Error(_0x397d('0xaa'));}}})[_0x397d('0x33')](function(_0x3682ef){if(_0x3682ef){_0x2617ac=_0x3682ef;if(_0x329444[_0x397d('0x9a')]){if(_0x329444['List'][_0x397d('0x9c')][_0x397d('0x4a')]){return _0x329444[_0x397d('0x9a')][_0x397d('0x9c')][0x0];}else{return db[_0x397d('0x9b')][_0x397d('0x61')](_[_0x397d('0xab')](_0x58a1c6[_0x397d('0x5c')],{'firstName':_0x58a1c6['body']['to'],'email':_0x58a1c6[_0x397d('0x5c')]['to'],'phone':_0x58a1c6[_0x397d('0x5c')]['to'],'ListId':_0x329444['ListId']}));}}else{throw new Error(_0x397d('0xaa'));}}})[_0x397d('0x33')](function(_0x7ad1df){if(_0x7ad1df){var _0x383d2d={'UserId':_0x58a1c6['user']['id'],'ContactId':_0x7ad1df['id'],'MailAccountId':_0x329444['id'],'inReplyTo':_0x2617ac[_0x397d('0xac')],'to':_0x58a1c6[_0x397d('0x5c')]['from'],'cc':_0x58a1c6[_0x397d('0x5c')]['cc'],'subject':_0x58a1c6[_0x397d('0x5c')][_0x397d('0xad')],'attach':_0x58a1c6[_0x397d('0x5c')][_0x397d('0xae')],'firstMsgDirection':_0x397d('0xaf'),'lastMsgAt':moment()[_0x397d('0x98')](_0x397d('0x99')),'lastMsgDirection':'out','lastMsgBody':_0x58a1c6[_0x397d('0x5c')]['body'],'Messages':[_[_0x397d('0x52')](_0x58a1c6[_0x397d('0x5c')],{'messageId':_0x2617ac['messageId'],'sentAt':moment()[_0x397d('0x98')](_0x397d('0x99')),'read':!![],'MailAccountId':_0x329444['id'],'UserId':_0x58a1c6[_0x397d('0x72')]['id'],'ContactId':_0x7ad1df['id']})]};if(_0x58a1c6[_0x397d('0x5c')][_0x397d('0xb0')]){_0x383d2d=_[_0x397d('0x52')](_0x383d2d,_0x58a1c6[_0x397d('0x5c')][_0x397d('0xb0')]);}return db[_0x397d('0x86')][_0x397d('0x61')](_0x383d2d,{'include':[{'model':db['MailMessage'],'as':_0x397d('0xb1')}]});}})[_0x397d('0x33')](respondWithResult(_0x48aabd,null))[_0x397d('0x58')](handleError(_0x48aabd,null));};exports[_0x397d('0xb2')]=function(_0x8ad2ae,_0x4929cd,_0x5cbe8d){return db[_0x397d('0x40')]['find']({'where':{'id':_0x8ad2ae[_0x397d('0x5a')]['id']},'include':[{'model':db[_0x397d('0x3c')],'as':'Smtp','raw':!![]}]})[_0x397d('0x33')](handleEntityNotFound(_0x4929cd,null))[_0x397d('0x33')](function(_0x2e49d5){if(_0x2e49d5&&_0x2e49d5[_0x397d('0x3d')]){var _0x2480ee={'id':_0x2e49d5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2e49d5[_0x397d('0x3d')]['service']){_0x2480ee['service']=_0x2e49d5['Smtp'][_0x397d('0x79')];}else{_0x2480ee['host']=_0x2e49d5['Smtp']['host'];_0x2480ee[_0x397d('0x78')]=_0x2e49d5[_0x397d('0x3d')][_0x397d('0x78')];_0x2480ee[_0x397d('0xa7')]=_0x2e49d5[_0x397d('0x3d')][_0x397d('0xa7')];}if(_0x2e49d5[_0x397d('0x3d')]['authentication']){_0x2480ee['auth']={'user':_0x2e49d5[_0x397d('0x3d')][_0x397d('0x72')],'pass':_0x2e49d5[_0x397d('0x3d')][_0x397d('0x74')]};}return respondWithRpcPromise(_0x397d('0xb3'),_0x397d('0xb2'),{'account':_0x2480ee});}})[_0x397d('0x33')](respondWithResult(_0x4929cd,null))[_0x397d('0x58')](handleError(_0x4929cd,null));};exports['destroy']=function(_0x3df58e,_0x2aed1c){return db[_0x397d('0x40')][_0x397d('0x5b')]({'where':{'id':_0x3df58e['params']['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x2aed1c,null))[_0x397d('0x33')](function(_0x5a88b9){if(_0x5a88b9&&_0x5a88b9[_0x397d('0x79')]){throw new db[(_0x397d('0xb4'))][(_0x397d('0xb5'))](_0x397d('0xb6'));}return _0x5a88b9;})[_0x397d('0x33')](removeEntity(_0x2aed1c,null))[_0x397d('0x58')](handleError(_0x2aed1c,null));};exports[_0x397d('0xb7')]=function(_0x5b9d3f,_0x5c3bc9,_0x1a2ebd){return db[_0x397d('0x40')][_0x397d('0x5b')]({'where':{'id':_0x5b9d3f[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x5c3bc9,null))[_0x397d('0x33')](function(_0x30ff00){if(_0x30ff00){return _0x30ff00['addAgents'](_0x5b9d3f[_0x397d('0x5c')][_0x397d('0x68')],_['omit'](_0x5b9d3f[_0x397d('0x5c')],[_0x397d('0x68'),'id'])||{})['spread'](function(_0x1df5b2){for(var _0xf9867e=0x0;_0xf9867e<_0x5b9d3f[_0x397d('0x5c')][_0x397d('0x68')][_0x397d('0x4a')];_0xf9867e+=0x1){socket[_0x397d('0xb8')]('userMailAccount:save',{'UserId':_0x5b9d3f[_0x397d('0x5c')][_0x397d('0x68')][_0xf9867e],'MailAccountId':_0x5b9d3f['params']['id']});}return _0x1df5b2;});}})[_0x397d('0x33')](respondWithResult(_0x5c3bc9,null))[_0x397d('0x58')](handleError(_0x5c3bc9,null));};exports[_0x397d('0xb9')]=function(_0x1b3c43,_0x460ee5,_0x5db7af){return db[_0x397d('0x40')][_0x397d('0x5b')]({'where':{'id':_0x1b3c43[_0x397d('0x5a')]['id']}})[_0x397d('0x33')](handleEntityNotFound(_0x460ee5,null))[_0x397d('0x33')](function(_0x223519){if(_0x223519){return _0x223519['removeAgents'](_0x1b3c43[_0x397d('0x45')][_0x397d('0x68')])[_0x397d('0x33')](function(){if(_[_0x397d('0xba')](_0x1b3c43[_0x397d('0x45')]['ids'])){for(var _0x4f4362=0x0;_0x4f4362<_0x1b3c43['query'][_0x397d('0x68')][_0x397d('0x4a')];_0x4f4362+=0x1){socket[_0x397d('0xb8')](_0x397d('0xbb'),{'UserId':Number(_0x1b3c43[_0x397d('0x45')][_0x397d('0x68')][_0x4f4362]),'MailAccountId':Number(_0x1b3c43[_0x397d('0x5a')]['id'])});}}else{socket[_0x397d('0xb8')]('userMailAccount:remove',{'UserId':Number(_0x1b3c43['query'][_0x397d('0x68')]),'MailAccountId':Number(_0x1b3c43[_0x397d('0x5a')]['id'])});}});}})[_0x397d('0x33')](respondWithStatusCode(_0x460ee5,null))[_0x397d('0x58')](handleError(_0x460ee5,null));};exports['getAgents']=function(_0x4418b4,_0x909df1,_0x5d34df){var _0x2c5e95={};var _0x5af1f6={};var _0x1df08a;var _0x8b9036;return db[_0x397d('0x40')][_0x397d('0x62')]({'where':{'id':_0x4418b4[_0x397d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x909df1,null))[_0x397d('0x33')](function(_0x4c3958){if(_0x4c3958){_0x1df08a=_0x4c3958;_0x5af1f6[_0x397d('0x44')]=_[_0x397d('0x46')](db['User'][_0x397d('0x63')]);_0x5af1f6[_0x397d('0x45')]=_['keys'](_0x4418b4['query']);_0x5af1f6[_0x397d('0x4e')]=_[_0x397d('0x47')](_0x5af1f6['model'],_0x5af1f6[_0x397d('0x45')]);_0x2c5e95[_0x397d('0x49')]=_[_0x397d('0x47')](_0x5af1f6[_0x397d('0x44')],qs[_0x397d('0x48')](_0x4418b4[_0x397d('0x45')][_0x397d('0x48')]));_0x2c5e95[_0x397d('0x49')]=_0x2c5e95['attributes'][_0x397d('0x4a')]?_0x2c5e95[_0x397d('0x49')]:_0x5af1f6[_0x397d('0x44')];_0x2c5e95[_0x397d('0x4b')]=qs[_0x397d('0x4c')](_0x4418b4[_0x397d('0x45')][_0x397d('0x4c')]);_0x2c5e95['where']=qs['filters'](_['pick'](_0x4418b4[_0x397d('0x45')],_0x5af1f6[_0x397d('0x4e')]));if(_0x4418b4[_0x397d('0x45')]['filter']){_0x2c5e95['where']=_[_0x397d('0x52')](_0x2c5e95[_0x397d('0x4d')],{'$or':_[_0x397d('0x3f')](_0x2c5e95[_0x397d('0x49')],function(_0x12d0ba){var _0xe96de8={};_0xe96de8[_0x12d0ba]={'$like':'%'+_0x4418b4[_0x397d('0x45')][_0x397d('0x50')]+'%'};return _0xe96de8;})});}_0x2c5e95=_[_0x397d('0x52')]({},_0x2c5e95,_0x4418b4['options']);return _0x1df08a[_0x397d('0xbc')](_0x2c5e95);}})[_0x397d('0x33')](function(_0x15cfa0){if(_0x15cfa0){_0x8b9036=_0x15cfa0[_0x397d('0x4a')];if(!_0x4418b4[_0x397d('0x45')]['hasOwnProperty']('nolimit')){_0x2c5e95[_0x397d('0x2c')]=qs[_0x397d('0x2c')](_0x4418b4[_0x397d('0x45')][_0x397d('0x2c')]);_0x2c5e95['offset']=qs[_0x397d('0x2b')](_0x4418b4[_0x397d('0x45')]['offset']);}return _0x1df08a[_0x397d('0xbc')](_0x2c5e95);}})[_0x397d('0x33')](function(_0x4ddba5){if(_0x4ddba5){return _0x4ddba5?{'count':_0x8b9036,'rows':_0x4ddba5}:null;}})[_0x397d('0x33')](respondWithResult(_0x909df1,null))['catch'](handleError(_0x909df1,null));}; \ No newline at end of file +var _0xbab5=['nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','show','Smtp','Pause','mandatoryDispositionPause','fields','length','includeAll','find','body','describe','addDisposition','params','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','options','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','role','UserProfileSection','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tag','Tags','color','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','hasOwnProperty','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','root','basename','secure','sendMail','List\x20not\x20found','messageId','subject','out','Interaction','auth','VerifySmtp','verifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','isArray','emit','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','Sequelize','request','then','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','set','apply','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','MailServerOut','map','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x5e6226,_0x2a34b7){var _0x57f7dc=function(_0x72bb49){while(--_0x72bb49){_0x5e6226['push'](_0x5e6226['shift']());}};_0x57f7dc(++_0x2a34b7);}(_0xbab5,0x128));var _0x5bab=function(_0x161c44,_0x4a4750){_0x161c44=_0x161c44-0x0;var _0x573fcb=_0xbab5[_0x161c44];return _0x573fcb;};'use strict';var pdf=require(_0x5bab('0x0'));var emlformat=require(_0x5bab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5bab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5bab('0x3'));var moment=require(_0x5bab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5bab('0x5'));var util=require(_0x5bab('0x6'));var path=require(_0x5bab('0x7'));var sox=require(_0x5bab('0x8'));var csv=require(_0x5bab('0x9'));var ejs=require(_0x5bab('0xa'));var fs=require('fs');var _=require(_0x5bab('0xb'));var squel=require(_0x5bab('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5bab('0x9'));var querystring=require(_0x5bab('0xd'));var Papa=require(_0x5bab('0xe'));var Redis=require(_0x5bab('0xf'));var authService=require(_0x5bab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bab('0x11'));var logger=require(_0x5bab('0x12'))(_0x5bab('0x13'));var utils=require(_0x5bab('0x14'));var config=require(_0x5bab('0x15'));var db=require('../../mysqldb')['db'];config[_0x5bab('0x16')]=_[_0x5bab('0x17')](config[_0x5bab('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x5bab('0x18'))(new Redis(config[_0x5bab('0x16')]));require(_0x5bab('0x19'))[_0x5bab('0x1a')](socket);var jayson=require(_0x5bab('0x1b'));var client=jayson['client'][_0x5bab('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x5e1f05,_0x1cbf68,_0x2c1372){if(_0x2c1372){var _0xc52996=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc52996['test'](_0x1cbf68)){return _0x5e1f05;}else{throw new db[(_0x5bab('0x1d'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5e1f05;}}function respondWithRpcPromise(_0x4b781e,_0x1d8897,_0x5bc426,_0x99de54){return new BPromise(function(_0x4df881,_0xa762cb){var _0x75e129=_0x99de54||client;return _0x75e129[_0x5bab('0x1e')](_0x4b781e,_0x5bc426)[_0x5bab('0x1f')](function(_0x3dda28){logger[_0x5bab('0x20')]('MailAccount,\x20%s,\x20%s',_0x1d8897,'request\x20sent');logger[_0x5bab('0x21')](_0x5bab('0x22'),_0x1d8897,_0x5bab('0x23'),JSON['stringify'](_0x3dda28));if(_0x3dda28[_0x5bab('0x24')]){if(_0x3dda28[_0x5bab('0x24')]['code']===0x1f4){logger[_0x5bab('0x24')](_0x5bab('0x25'),_0x1d8897,_0x3dda28['error']['message']);return _0xa762cb(_0x3dda28[_0x5bab('0x24')][_0x5bab('0x26')]);}logger['error'](_0x5bab('0x25'),_0x1d8897,_0x3dda28['error']['message']);return _0x4df881(_0x3dda28['error'][_0x5bab('0x26')]);}else{logger['info'](_0x5bab('0x25'),_0x1d8897,'request\x20sent');_0x4df881(_0x3dda28[_0x5bab('0x27')]['message']);}})[_0x5bab('0x28')](function(_0x19bc7f){logger[_0x5bab('0x24')](_0x5bab('0x25'),_0x1d8897,_0x19bc7f);_0xa762cb(_0x19bc7f);});});}function respondWithStatusCode(_0x1e1534,_0x4de84d){_0x4de84d=_0x4de84d||0xcc;return function(_0x2e30ac){if(_0x2e30ac){return _0x1e1534[_0x5bab('0x29')](_0x4de84d);}return _0x1e1534[_0x5bab('0x2a')](_0x4de84d)[_0x5bab('0x2b')]();};}function respondWithResult(_0x54264a,_0x20f5cf){_0x20f5cf=_0x20f5cf||0xc8;return function(_0x52a9a7){if(_0x52a9a7){return _0x54264a[_0x5bab('0x2a')](_0x20f5cf)[_0x5bab('0x2c')](_0x52a9a7);}};}function respondWithFilteredResult(_0x2b78d8,_0x3a9033){return function(_0x5d1bdf){if(_0x5d1bdf){var _0x345ed3=_0x5d1bdf['count'],_0x5ae815=_0x3a9033[_0x5bab('0x2d')],_0x36b577=_0x3a9033[_0x5bab('0x2d')]+_0x3a9033['limit'],_0x189005;if(_0x36b577>=_0x345ed3){_0x36b577=_0x345ed3;_0x189005=0xc8;}else{_0x189005=0xce;}_0x2b78d8[_0x5bab('0x2a')](_0x189005);return _0x2b78d8[_0x5bab('0x2e')]('Content-Range',_0x5ae815+'-'+_0x36b577+'/'+_0x345ed3)[_0x5bab('0x2c')](_0x5d1bdf);}return null;};}function patchUpdates(_0x76e7b4){return function(_0x4be712){try{jsonpatch[_0x5bab('0x2f')](_0x4be712,_0x76e7b4,!![]);}catch(_0x2c4303){return BPromise['reject'](_0x2c4303);}return _0x4be712[_0x5bab('0x30')]();};}function saveUpdates(_0x4685e8,_0xc6c6d6){return function(_0x55bf54){if(_0x55bf54){return _0x55bf54[_0x5bab('0x31')](_0x4685e8)['then'](function(_0x293cb5){return _0x293cb5;});}return null;};}function removeEntity(_0x460971,_0x1595e2){return function(_0x2ca422){if(_0x2ca422){return _0x2ca422[_0x5bab('0x32')]()[_0x5bab('0x1f')](function(){var _0x3ceda2=_0x2ca422[_0x5bab('0x33')]({'plain':!![]});var _0x11c217=_0x5bab('0x34');return db[_0x5bab('0x35')][_0x5bab('0x32')]({'where':{'type':_0x11c217,'resourceId':_0x3ceda2['id']}})[_0x5bab('0x1f')](function(){return _0x2ca422;});})[_0x5bab('0x1f')](function(){_0x460971[_0x5bab('0x2a')](0xcc)[_0x5bab('0x2b')]();});}};}function handleEntityNotFound(_0x17f57d,_0x43b72a){return function(_0x405011){if(!_0x405011){_0x17f57d[_0x5bab('0x29')](0x194);}return _0x405011;};}function handleError(_0x45cd2b,_0x43ef36){_0x43ef36=_0x43ef36||0x1f4;return function(_0x6a5e56){logger[_0x5bab('0x24')](_0x6a5e56[_0x5bab('0x36')]);if(_0x6a5e56[_0x5bab('0x37')]){delete _0x6a5e56['name'];}_0x45cd2b[_0x5bab('0x2a')](_0x43ef36)[_0x5bab('0x38')](_0x6a5e56);};}exports[_0x5bab('0x39')]=function(_0x3dbfee,_0x23a169){var _0x4a9583={'include':[{'model':db[_0x5bab('0x3a')],'as':_0x5bab('0x3b')},{'model':db[_0x5bab('0x3c')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x506230={},_0x3dc691={'count':0x0,'rows':[]};var _0x3c16c0=_[_0x5bab('0x3d')](db[_0x5bab('0x3e')]['rawAttributes'],function(_0x7042df){return{'name':_0x7042df[_0x5bab('0x3f')],'type':_0x7042df[_0x5bab('0x40')][_0x5bab('0x41')]};});_0x506230[_0x5bab('0x42')]=_['map'](_0x3c16c0,_0x5bab('0x37'));_0x506230[_0x5bab('0x43')]=_[_0x5bab('0x44')](_0x3dbfee[_0x5bab('0x43')]);_0x506230[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x506230[_0x5bab('0x42')],_0x506230[_0x5bab('0x43')]);_0x4a9583[_0x5bab('0x47')]=_['intersection'](_0x506230[_0x5bab('0x42')],qs['fields'](_0x3dbfee['query']['fields']));_0x4a9583[_0x5bab('0x47')]=_0x4a9583[_0x5bab('0x47')]['length']?_0x4a9583[_0x5bab('0x47')]:_0x506230[_0x5bab('0x42')];if(!_0x3dbfee[_0x5bab('0x43')]['hasOwnProperty'](_0x5bab('0x48'))){_0x4a9583['limit']=qs[_0x5bab('0x49')](_0x3dbfee[_0x5bab('0x43')][_0x5bab('0x49')]);_0x4a9583[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x3dbfee['query']['offset']);}_0x4a9583[_0x5bab('0x4a')]=qs[_0x5bab('0x4b')](_0x3dbfee[_0x5bab('0x43')][_0x5bab('0x4b')]);_0x4a9583[_0x5bab('0x4c')]=qs[_0x5bab('0x45')](_[_0x5bab('0x4d')](_0x3dbfee['query'],_0x506230[_0x5bab('0x45')]),_0x3c16c0);if(_0x3dbfee['query'][_0x5bab('0x4e')]){_0x4a9583['where']=_[_0x5bab('0x4f')](_0x4a9583[_0x5bab('0x4c')],{'$or':_[_0x5bab('0x3d')](_0x3c16c0,function(_0x4d88f9){if(_0x4d88f9['type']!==_0x5bab('0x50')){var _0x19042b={};_0x19042b[_0x4d88f9[_0x5bab('0x37')]]={'$like':'%'+_0x3dbfee['query'][_0x5bab('0x4e')]+'%'};return _0x19042b;}})});}_0x4a9583=_['merge']({},_0x4a9583,_0x3dbfee['options']);var _0x3a007d={'where':_0x4a9583['where']};return db[_0x5bab('0x3e')][_0x5bab('0x51')](_0x3a007d)[_0x5bab('0x1f')](function(_0x5b9030){_0x3dc691['count']=_0x5b9030;if(_0x3dbfee['query']['includeAll']){_0x4a9583[_0x5bab('0x52')]=[{'all':!![]}];}return db[_0x5bab('0x3e')][_0x5bab('0x53')](_0x4a9583);})[_0x5bab('0x1f')](function(_0x993a1){_0x3dc691[_0x5bab('0x54')]=_0x993a1;return _0x3dc691;})[_0x5bab('0x1f')](respondWithFilteredResult(_0x23a169,_0x4a9583))[_0x5bab('0x28')](handleError(_0x23a169,null));};exports[_0x5bab('0x55')]=function(_0x47210d,_0x49dcae){var _0x1af4a8={'raw':![],'where':{'id':_0x47210d['params']['id']},'include':[{'model':db[_0x5bab('0x3a')],'as':_0x5bab('0x3b')},{'model':db[_0x5bab('0x3c')],'as':_0x5bab('0x56')},{'model':db[_0x5bab('0x57')],'as':_0x5bab('0x58')}]},_0x4f81ee={};_0x4f81ee[_0x5bab('0x42')]=_['keys'](db[_0x5bab('0x3e')]['rawAttributes']);_0x4f81ee['query']=_['keys'](_0x47210d[_0x5bab('0x43')]);_0x4f81ee[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x4f81ee[_0x5bab('0x42')],_0x4f81ee[_0x5bab('0x43')]);_0x1af4a8[_0x5bab('0x47')]=_[_0x5bab('0x46')](_0x4f81ee[_0x5bab('0x42')],qs['fields'](_0x47210d[_0x5bab('0x43')][_0x5bab('0x59')]));_0x1af4a8[_0x5bab('0x47')]=_0x1af4a8[_0x5bab('0x47')][_0x5bab('0x5a')]?_0x1af4a8[_0x5bab('0x47')]:_0x4f81ee[_0x5bab('0x42')];if(_0x47210d[_0x5bab('0x43')][_0x5bab('0x5b')]){_0x1af4a8[_0x5bab('0x52')]=[{'all':!![]}];}_0x1af4a8=_[_0x5bab('0x4f')]({},_0x1af4a8,_0x47210d['options']);return db[_0x5bab('0x3e')][_0x5bab('0x5c')](_0x1af4a8)['then'](handleEntityNotFound(_0x49dcae,null))['then'](respondWithResult(_0x49dcae,null))[_0x5bab('0x28')](handleError(_0x49dcae,null));};exports[_0x5bab('0x31')]=function(_0x5a6cdd,_0x54dd3f){if(_0x5a6cdd[_0x5bab('0x5d')]['id']){delete _0x5a6cdd[_0x5bab('0x5d')]['id'];}return db[_0x5bab('0x3e')]['find']({'where':{'id':_0x5a6cdd['params']['id']},'include':[{'model':db[_0x5bab('0x3a')],'as':_0x5bab('0x3b')},{'model':db[_0x5bab('0x3c')],'as':_0x5bab('0x56')},{'model':db['Pause'],'as':_0x5bab('0x58')}]})['then'](handleEntityNotFound(_0x54dd3f,null))[_0x5bab('0x1f')](saveUpdates(_0x5a6cdd[_0x5bab('0x5d')],null))[_0x5bab('0x1f')](function(_0x2c6e8e){if(_0x2c6e8e&&_0x5a6cdd['body'][_0x5bab('0x3b')]){return db['MailServerIn']['update'](_0x5a6cdd[_0x5bab('0x5d')]['Imap'],{'where':{'MailAccountId':_0x2c6e8e['id']}})[_0x5bab('0x1f')](function(){return _0x2c6e8e;});}return _0x2c6e8e;})['then'](function(_0x25173c){if(_0x25173c&&_0x5a6cdd[_0x5bab('0x5d')][_0x5bab('0x56')]){return db[_0x5bab('0x3c')][_0x5bab('0x31')](_0x5a6cdd[_0x5bab('0x5d')][_0x5bab('0x56')],{'where':{'MailAccountId':_0x25173c['id']}})[_0x5bab('0x1f')](function(){return _0x25173c;});}return _0x25173c;})['then'](respondWithResult(_0x54dd3f,null))[_0x5bab('0x28')](handleError(_0x54dd3f,null));};exports[_0x5bab('0x5e')]=function(_0x50bae9,_0x5b695c){return db[_0x5bab('0x3e')][_0x5bab('0x5e')]()['then'](respondWithResult(_0x5b695c,null))['catch'](handleError(_0x5b695c,null));};exports[_0x5bab('0x5f')]=function(_0x3e52e3,_0xf31b0b,_0x118927){if(_0x3e52e3['body']['id']){delete _0x3e52e3[_0x5bab('0x5d')]['id'];}return db[_0x5bab('0x3e')][_0x5bab('0x5c')]({'where':{'id':_0x3e52e3[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0xf31b0b,null))['then'](function(_0x201774){if(_0x201774){_0x3e52e3[_0x5bab('0x5d')][_0x5bab('0x61')]=_0x201774['id'];return db[_0x5bab('0x62')][_0x5bab('0x63')](_0x3e52e3[_0x5bab('0x5d')]);}})[_0x5bab('0x1f')](respondWithResult(_0xf31b0b,null))[_0x5bab('0x28')](handleError(_0xf31b0b,null));};exports[_0x5bab('0x64')]=function(_0x4301fb,_0x3cb942,_0x4fd197){var _0x477370={'raw':![],'where':{}};var _0x2f2e4c={};var _0x5e7beb={'count':0x0,'rows':[]};return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x4301fb['params']['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x3cb942,null))[_0x5bab('0x1f')](function(_0x51fd98){if(_0x51fd98){_0x2f2e4c['model']=_['keys'](db[_0x5bab('0x62')][_0x5bab('0x66')]);_0x2f2e4c['query']=_[_0x5bab('0x44')](_0x4301fb[_0x5bab('0x43')]);_0x2f2e4c[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x2f2e4c['model'],_0x2f2e4c[_0x5bab('0x43')]);_0x477370['attributes']=_[_0x5bab('0x46')](_0x2f2e4c[_0x5bab('0x42')],qs[_0x5bab('0x59')](_0x4301fb[_0x5bab('0x43')]['fields']));_0x477370[_0x5bab('0x47')]=_0x477370[_0x5bab('0x47')]['length']?_0x477370['attributes']:_0x2f2e4c['model'];if(!_0x4301fb[_0x5bab('0x43')]['hasOwnProperty'](_0x5bab('0x48'))){_0x477370[_0x5bab('0x49')]=qs['limit'](_0x4301fb[_0x5bab('0x43')][_0x5bab('0x49')]);_0x477370['offset']=qs[_0x5bab('0x2d')](_0x4301fb[_0x5bab('0x43')][_0x5bab('0x2d')]);}_0x477370[_0x5bab('0x4a')]=qs[_0x5bab('0x4b')](_0x4301fb['query'][_0x5bab('0x4b')]);_0x477370[_0x5bab('0x4c')]=qs['filters'](_[_0x5bab('0x4d')](_0x4301fb[_0x5bab('0x43')],_0x2f2e4c['filters']));_0x477370[_0x5bab('0x4c')][_0x5bab('0x61')]=_0x51fd98['id'];if(_0x4301fb['query'][_0x5bab('0x4e')]){_0x477370[_0x5bab('0x4c')]=_[_0x5bab('0x4f')](_0x477370[_0x5bab('0x4c')],{'$or':_[_0x5bab('0x3d')](_0x477370['attributes'],function(_0x49d65e){var _0x1ce59d={};_0x1ce59d[_0x49d65e]={'$like':'%'+_0x4301fb[_0x5bab('0x43')][_0x5bab('0x4e')]+'%'};return _0x1ce59d;})});}_0x477370=_[_0x5bab('0x4f')]({},_0x477370,_0x4301fb[_0x5bab('0x67')]);return db[_0x5bab('0x62')]['count']({'where':_0x477370['where']})['then'](function(_0x1b21cd){_0x5e7beb[_0x5bab('0x51')]=_0x1b21cd;if(_0x4301fb['query']['includeAll']){_0x477370[_0x5bab('0x52')]=[{'all':!![]}];}return db[_0x5bab('0x62')][_0x5bab('0x53')](_0x477370);})['then'](function(_0x229cee){_0x5e7beb[_0x5bab('0x54')]=_0x229cee;return _0x5e7beb;});}})[_0x5bab('0x1f')](respondWithFilteredResult(_0x3cb942,_0x477370))['catch'](handleError(_0x3cb942,null));};exports[_0x5bab('0x68')]=function(_0x4e466f,_0xefdbdb,_0x3a0893){return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x4e466f[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0xefdbdb,null))[_0x5bab('0x1f')](function(_0x4b69fe){if(_0x4b69fe){return _0x4b69fe[_0x5bab('0x68')](_0x4e466f[_0x5bab('0x43')][_0x5bab('0x69')]);}})[_0x5bab('0x1f')](respondWithStatusCode(_0xefdbdb,null))['catch'](handleError(_0xefdbdb,null));};exports['addAnswer']=function(_0x56e14b,_0x37568f,_0x4f2f28){if(_0x56e14b[_0x5bab('0x5d')]['id']){delete _0x56e14b['body']['id'];}return db[_0x5bab('0x3e')][_0x5bab('0x5c')]({'where':{'id':_0x56e14b[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x37568f,null))[_0x5bab('0x1f')](function(_0x47186c){if(_0x47186c){_0x56e14b[_0x5bab('0x5d')][_0x5bab('0x61')]=_0x47186c['id'];return db[_0x5bab('0x6a')][_0x5bab('0x63')](_0x56e14b['body']);}})[_0x5bab('0x1f')](respondWithResult(_0x37568f,null))[_0x5bab('0x28')](handleError(_0x37568f,null));};exports[_0x5bab('0x6b')]=function(_0x24d0bc,_0x4be19c,_0x4ad0c5){var _0x4e1f10={'raw':![],'where':{}};var _0x5d984c={};var _0x434b5b={'count':0x0,'rows':[]};return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x24d0bc[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x4be19c,null))[_0x5bab('0x1f')](function(_0x39bbce){if(_0x39bbce){_0x5d984c[_0x5bab('0x42')]=_[_0x5bab('0x44')](db['CannedAnswer'][_0x5bab('0x66')]);_0x5d984c[_0x5bab('0x43')]=_[_0x5bab('0x44')](_0x24d0bc['query']);_0x5d984c[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x5d984c['model'],_0x5d984c['query']);_0x4e1f10[_0x5bab('0x47')]=_[_0x5bab('0x46')](_0x5d984c[_0x5bab('0x42')],qs['fields'](_0x24d0bc[_0x5bab('0x43')][_0x5bab('0x59')]));_0x4e1f10['attributes']=_0x4e1f10[_0x5bab('0x47')][_0x5bab('0x5a')]?_0x4e1f10[_0x5bab('0x47')]:_0x5d984c[_0x5bab('0x42')];if(!_0x24d0bc[_0x5bab('0x43')]['hasOwnProperty'](_0x5bab('0x48'))){_0x4e1f10[_0x5bab('0x49')]=qs[_0x5bab('0x49')](_0x24d0bc[_0x5bab('0x43')][_0x5bab('0x49')]);_0x4e1f10[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x24d0bc[_0x5bab('0x43')][_0x5bab('0x2d')]);}_0x4e1f10[_0x5bab('0x4a')]=qs[_0x5bab('0x4b')](_0x24d0bc[_0x5bab('0x43')][_0x5bab('0x4b')]);_0x4e1f10[_0x5bab('0x4c')]=qs['filters'](_[_0x5bab('0x4d')](_0x24d0bc['query'],_0x5d984c[_0x5bab('0x45')]));_0x4e1f10[_0x5bab('0x4c')][_0x5bab('0x61')]=_0x39bbce['id'];if(_0x24d0bc['query'][_0x5bab('0x4e')]){_0x4e1f10[_0x5bab('0x4c')]=_['merge'](_0x4e1f10[_0x5bab('0x4c')],{'$or':_[_0x5bab('0x3d')](_0x4e1f10[_0x5bab('0x47')],function(_0xc06cea){var _0x1f5dcb={};_0x1f5dcb[_0xc06cea]={'$like':'%'+_0x24d0bc[_0x5bab('0x43')][_0x5bab('0x4e')]+'%'};return _0x1f5dcb;})});}_0x4e1f10=_[_0x5bab('0x4f')]({},_0x4e1f10,_0x24d0bc['options']);return db[_0x5bab('0x6a')][_0x5bab('0x51')]({'where':_0x4e1f10[_0x5bab('0x4c')]})[_0x5bab('0x1f')](function(_0x42ba52){_0x434b5b[_0x5bab('0x51')]=_0x42ba52;if(_0x24d0bc['query']['includeAll']){_0x4e1f10['include']=[{'all':!![]}];}return db[_0x5bab('0x6a')][_0x5bab('0x53')](_0x4e1f10);})[_0x5bab('0x1f')](function(_0x39ff7f){_0x434b5b['rows']=_0x39ff7f;return _0x434b5b;});}})[_0x5bab('0x1f')](respondWithFilteredResult(_0x4be19c,_0x4e1f10))['catch'](handleError(_0x4be19c,null));};exports[_0x5bab('0x6c')]=function(_0x33a13c,_0x538135,_0x3adc5e){return db[_0x5bab('0x3e')][_0x5bab('0x5c')]({'where':{'id':_0x33a13c[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x538135,null))['then'](function(_0xdd9e5b){if(_0xdd9e5b){return _0xdd9e5b[_0x5bab('0x6c')](_0x33a13c['query']['ids']);}})['then'](respondWithStatusCode(_0x538135,null))['catch'](handleError(_0x538135,null));};exports[_0x5bab('0x63')]=function(_0x33fff6,_0x2823da){var _0x264b87={'name':_0x33fff6['body'][_0x5bab('0x37')],'key':_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x41')],'email':_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x6d')],'ListId':_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x6e')],'active':!_[_0x5bab('0x6f')](_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x70')])?_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x70')]:!![],'description':_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x71')]||null,'Imap':{},'Smtp':{}};if(_[_0x5bab('0x6f')](_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x72')])){if(_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x73')]){_0x264b87['Imap'][_0x5bab('0x74')]=_0x264b87[_0x5bab('0x56')]['user']=_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x75')];_0x264b87[_0x5bab('0x3b')][_0x5bab('0x76')]=_0x264b87[_0x5bab('0x56')][_0x5bab('0x77')]=_0x33fff6['body'][_0x5bab('0x78')];}else{_0x264b87['Imap'][_0x5bab('0x79')]=_0x264b87[_0x5bab('0x56')][_0x5bab('0x79')]=![];}_0x264b87[_0x5bab('0x3b')][_0x5bab('0x7a')]=_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x3b')][_0x5bab('0x7a')];_0x264b87['Imap'][_0x5bab('0x7b')]=_0x33fff6['body']['Imap'][_0x5bab('0x7b')];_0x264b87[_0x5bab('0x56')][_0x5bab('0x7a')]=_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x56')][_0x5bab('0x7a')];_0x264b87[_0x5bab('0x56')][_0x5bab('0x7b')]=_0x33fff6['body'][_0x5bab('0x56')][_0x5bab('0x7b')];}else{_0x264b87[_0x5bab('0x3b')][_0x5bab('0x7c')]=_0x264b87[_0x5bab('0x56')][_0x5bab('0x7c')]=_0x33fff6[_0x5bab('0x5d')][_0x5bab('0x72')];_0x264b87[_0x5bab('0x3b')][_0x5bab('0x74')]=_0x264b87[_0x5bab('0x56')][_0x5bab('0x74')]=_0x33fff6[_0x5bab('0x5d')]['cuser'];_0x264b87['Imap'][_0x5bab('0x76')]=_0x264b87[_0x5bab('0x56')][_0x5bab('0x77')]=_0x33fff6[_0x5bab('0x5d')]['cpassword'];}return db['MailAccount'][_0x5bab('0x63')](_0x264b87,{'include':[{'model':db[_0x5bab('0x3c')],'as':_0x5bab('0x56')},{'model':db[_0x5bab('0x3a')],'as':_0x5bab('0x3b')}]})[_0x5bab('0x1f')](function(_0x17e2c1){var _0x2f4b92=_0x33fff6[_0x5bab('0x74')][_0x5bab('0x33')]({'plain':!![]});if(!_0x2f4b92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f4b92[_0x5bab('0x7d')]==='user'){var _0x109cf0=_0x17e2c1[_0x5bab('0x33')]({'plain':!![]});return db[_0x5bab('0x7e')][_0x5bab('0x5c')]({'where':{'name':_0x5bab('0x34'),'userProfileId':_0x2f4b92['userProfileId']},'raw':!![]})[_0x5bab('0x1f')](function(_0x3503b4){if(_0x3503b4&&_0x3503b4[_0x5bab('0x7f')]===0x0){return db['UserProfileResource'][_0x5bab('0x63')]({'name':_0x109cf0[_0x5bab('0x37')],'resourceId':_0x109cf0['id'],'type':_0x3503b4[_0x5bab('0x37')],'sectionId':_0x3503b4['id']},{})[_0x5bab('0x1f')](function(){return _0x17e2c1;});}else{return _0x17e2c1;}})[_0x5bab('0x28')](function(_0x2ef878){logger[_0x5bab('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ef878);throw _0x2ef878;});}return _0x17e2c1;})['then'](respondWithResult(_0x2823da,0xc9))[_0x5bab('0x28')](handleError(_0x2823da,null));};exports[_0x5bab('0x80')]=function(_0x2145b7,_0x345fb5,_0x1b208d){return db['MailAccount'][_0x5bab('0x65')]({'where':{'id':_0x2145b7['params']['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x345fb5,null))['then'](function(_0x2c60ad){if(_0x2c60ad){return _0x2c60ad[_0x5bab('0x80')]();}return null;})['then'](respondWithResult(_0x345fb5,null))[_0x5bab('0x28')](handleError(_0x345fb5,null));};exports[_0x5bab('0x81')]=function(_0x19e9b4,_0x545894,_0x12a40d){if(_0x19e9b4['body']['id']){delete _0x19e9b4[_0x5bab('0x5d')]['id'];}return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x19e9b4[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x545894,null))[_0x5bab('0x1f')](function(_0x2c540f){if(_0x2c540f){_0x19e9b4['body'][_0x5bab('0x61')]=_0x2c540f['id'];return db[_0x5bab('0x3a')][_0x5bab('0x63')](_0x19e9b4[_0x5bab('0x5d')]);}})['then'](respondWithResult(_0x545894,null))[_0x5bab('0x28')](handleError(_0x545894,null));};exports[_0x5bab('0x82')]=function(_0x58a661,_0x231eff,_0x579d86){return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x58a661[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x231eff,null))[_0x5bab('0x1f')](function(_0x1d9682){if(_0x1d9682){return _0x1d9682[_0x5bab('0x83')](null);}return null;})[_0x5bab('0x1f')](respondWithStatusCode(_0x231eff,null))[_0x5bab('0x28')](handleError(_0x231eff,null));};exports[_0x5bab('0x84')]=function(_0x1bc5d2,_0x1f730e,_0xc8d9){return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x1bc5d2[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x1f730e,null))['then'](function(_0x248f35){if(_0x248f35){return _0x248f35['getSmtp']();}return null;})['then'](respondWithResult(_0x1f730e,null))[_0x5bab('0x28')](handleError(_0x1f730e,null));};exports['addSmtp']=function(_0x1fcbc4,_0x27f9be,_0x100493){if(_0x1fcbc4[_0x5bab('0x5d')]['id']){delete _0x1fcbc4[_0x5bab('0x5d')]['id'];}return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x1fcbc4[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x27f9be,null))[_0x5bab('0x1f')](function(_0x49a868){if(_0x49a868){_0x1fcbc4[_0x5bab('0x5d')]['MailAccountId']=_0x49a868['id'];return db[_0x5bab('0x3c')][_0x5bab('0x63')](_0x1fcbc4[_0x5bab('0x5d')]);}})[_0x5bab('0x1f')](respondWithResult(_0x27f9be,null))[_0x5bab('0x28')](handleError(_0x27f9be,null));};exports['removeSmtp']=function(_0x349a4e,_0x240a17,_0x1242ca){return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x349a4e[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x240a17,null))['then'](function(_0x2ec7a3){if(_0x2ec7a3){return _0x2ec7a3[_0x5bab('0x85')](null);}return null;})[_0x5bab('0x1f')](respondWithStatusCode(_0x240a17,null))['catch'](handleError(_0x240a17,null));};exports['addInteraction']=function(_0x59c213,_0x3299ba,_0x5b97a9){return db[_0x5bab('0x86')][_0x5bab('0x5c')]({'where':{'id':_0x59c213[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x3299ba,null))[_0x5bab('0x1f')](function(_0x48e443){if(_0x48e443){return _0x48e443[_0x5bab('0x87')](_0x59c213[_0x5bab('0x5d')]['ids'],_[_0x5bab('0x88')](_0x59c213[_0x5bab('0x5d')],['ids','id'])||{});}})[_0x5bab('0x1f')](respondWithResult(_0x3299ba,null))['catch'](handleError(_0x3299ba,null));};exports[_0x5bab('0x89')]=function(_0x5066e9,_0x392076,_0x57e9c0){var _0x24d8a4={'raw':![],'where':{}};var _0x5e39a2={};var _0x94625f={'count':0x0,'rows':[]};return db[_0x5bab('0x3e')]['findOne']({'where':{'id':_0x5066e9[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x392076,null))[_0x5bab('0x1f')](function(_0x31d827){if(_0x31d827){_0x5e39a2[_0x5bab('0x42')]=_[_0x5bab('0x44')](db[_0x5bab('0x86')][_0x5bab('0x66')]);_0x5e39a2[_0x5bab('0x43')]=_[_0x5bab('0x44')](_0x5066e9['query']);_0x5e39a2[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x5e39a2[_0x5bab('0x42')],_0x5e39a2['query']);_0x24d8a4[_0x5bab('0x47')]=_['intersection'](_0x5e39a2[_0x5bab('0x42')],qs[_0x5bab('0x59')](_0x5066e9['query'][_0x5bab('0x59')]));_0x24d8a4['attributes']=_0x24d8a4[_0x5bab('0x47')][_0x5bab('0x5a')]?_0x24d8a4[_0x5bab('0x47')]:_0x5e39a2[_0x5bab('0x42')];if(!_0x5066e9['query']['hasOwnProperty']('nolimit')){_0x24d8a4['limit']=qs[_0x5bab('0x49')](_0x5066e9[_0x5bab('0x43')][_0x5bab('0x49')]);_0x24d8a4[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x5066e9[_0x5bab('0x43')][_0x5bab('0x2d')]);}_0x24d8a4[_0x5bab('0x4a')]=qs[_0x5bab('0x4b')](_0x5066e9['query'][_0x5bab('0x4b')]);_0x24d8a4[_0x5bab('0x4c')]=qs['filters'](_['pick'](_0x5066e9[_0x5bab('0x43')],_0x5e39a2[_0x5bab('0x45')]));_0x24d8a4[_0x5bab('0x4c')][_0x5bab('0x61')]=_0x31d827['id'];if(_0x5066e9[_0x5bab('0x43')][_0x5bab('0x4e')]){_0x24d8a4[_0x5bab('0x4c')]=_['merge'](_0x24d8a4[_0x5bab('0x4c')],{'$or':_['map'](_0x24d8a4[_0x5bab('0x47')],function(_0x21a1fe){var _0x19f4cb={};_0x19f4cb[_0x21a1fe]={'$like':'%'+_0x5066e9['query'][_0x5bab('0x4e')]+'%'};return _0x19f4cb;})});}_0x24d8a4=_['merge']({},_0x24d8a4,_0x5066e9[_0x5bab('0x67')]);return db[_0x5bab('0x86')][_0x5bab('0x51')]({'where':_0x24d8a4['where']})['then'](function(_0x538ed4){_0x94625f['count']=_0x538ed4;if(_0x5066e9[_0x5bab('0x43')][_0x5bab('0x5b')]){_0x24d8a4[_0x5bab('0x52')]=[{'model':db[_0x5bab('0x8a')],'as':_0x5bab('0x8b'),'required':![]},{'model':db[_0x5bab('0x8c')],'as':_0x5bab('0x8d'),'attributes':[_0x5bab('0x37'),'fullname',_0x5bab('0x8e')],'required':![]},{'model':db[_0x5bab('0x8f')],'as':_0x5bab('0x90'),'attributes':['id',_0x5bab('0x37'),_0x5bab('0x91')],'where':_0x5066e9[_0x5bab('0x43')]['tag']?{'id':_0x5066e9[_0x5bab('0x43')]['tag']}:undefined,'required':_0x5066e9[_0x5bab('0x43')]['tag']?!![]:![]}];}return db[_0x5bab('0x86')][_0x5bab('0x53')](_0x24d8a4);})[_0x5bab('0x1f')](function(_0x45aada){_0x94625f[_0x5bab('0x54')]=_0x45aada;return _0x94625f;});}})[_0x5bab('0x1f')](respondWithFilteredResult(_0x392076,_0x24d8a4))[_0x5bab('0x28')](handleError(_0x392076,null));};exports['addApplications']=function(_0x4ad8e0,_0x2252ae,_0x22b254){return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x4ad8e0[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x2252ae,null))['then'](function(_0x21b056){if(_0x21b056){return db[_0x5bab('0x92')][_0x5bab('0x93')](function(_0xa751e9){return db[_0x5bab('0x94')][_0x5bab('0x32')]({'where':{'MailAccountId':_0x4ad8e0[_0x5bab('0x60')]['id']},'transaction':_0xa751e9})[_0x5bab('0x1f')](function(_0x7d63d){var _0x81ce91=_['map'](_0x4ad8e0[_0x5bab('0x5d')],function(_0x492481){_0x492481[_0x5bab('0x61')]=_0x4ad8e0[_0x5bab('0x60')]['id'];return _0x492481;});return db[_0x5bab('0x94')][_0x5bab('0x95')](_0x81ce91,{'transaction':_0xa751e9});});})[_0x5bab('0x1f')](function(){return db[_0x5bab('0x94')][_0x5bab('0x96')]({'where':{'MailAccountId':_0x4ad8e0[_0x5bab('0x60')]['id']},'order':_0x5bab('0x97')});});}})[_0x5bab('0x1f')](respondWithResult(_0x2252ae,null))[_0x5bab('0x28')](handleError(_0x2252ae,null));};exports[_0x5bab('0x98')]=function(_0x3d5242,_0x123f88,_0x3418cb){var _0xa1fdd={};var _0x19180d={};var _0x338b4e;var _0x4fe877;return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x3d5242[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x123f88,null))[_0x5bab('0x1f')](function(_0x3cf205){if(_0x3cf205){_0x338b4e=_0x3cf205;_0x19180d[_0x5bab('0x42')]=_[_0x5bab('0x44')](db[_0x5bab('0x94')][_0x5bab('0x66')]);_0x19180d['query']=_[_0x5bab('0x44')](_0x3d5242['query']);_0x19180d[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x19180d[_0x5bab('0x42')],_0x19180d[_0x5bab('0x43')]);_0xa1fdd[_0x5bab('0x47')]=_[_0x5bab('0x46')](_0x19180d[_0x5bab('0x42')],qs[_0x5bab('0x59')](_0x3d5242[_0x5bab('0x43')][_0x5bab('0x59')]));_0xa1fdd[_0x5bab('0x47')]=_0xa1fdd[_0x5bab('0x47')][_0x5bab('0x5a')]?_0xa1fdd[_0x5bab('0x47')]:_0x19180d[_0x5bab('0x42')];_0xa1fdd['order']=qs[_0x5bab('0x4b')](_0x3d5242[_0x5bab('0x43')][_0x5bab('0x4b')]);_0xa1fdd[_0x5bab('0x4c')]=qs[_0x5bab('0x45')](_[_0x5bab('0x4d')](_0x3d5242[_0x5bab('0x43')],_0x19180d[_0x5bab('0x45')]));if(_0x3d5242['query'][_0x5bab('0x4e')]){_0xa1fdd[_0x5bab('0x4c')]=_[_0x5bab('0x4f')](_0xa1fdd[_0x5bab('0x4c')],{'$or':_['map'](_0xa1fdd['attributes'],function(_0x51c95d){var _0x16caea={};_0x16caea[_0x51c95d]={'$like':'%'+_0x3d5242[_0x5bab('0x43')]['filter']+'%'};return _0x16caea;})});}_0xa1fdd=_[_0x5bab('0x4f')]({},_0xa1fdd,_0x3d5242[_0x5bab('0x67')]);return _0x338b4e['getApplications'](_0xa1fdd);}})[_0x5bab('0x1f')](function(_0x244fb2){if(_0x244fb2){_0x4fe877=_0x244fb2[_0x5bab('0x5a')];if(!_0x3d5242[_0x5bab('0x43')]['hasOwnProperty']('nolimit')){_0xa1fdd[_0x5bab('0x49')]=qs[_0x5bab('0x49')](_0x3d5242[_0x5bab('0x43')][_0x5bab('0x49')]);_0xa1fdd[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x3d5242[_0x5bab('0x43')][_0x5bab('0x2d')]);}return _0x338b4e[_0x5bab('0x98')](_0xa1fdd);}})[_0x5bab('0x1f')](function(_0x4e7027){if(_0x4e7027){return _0x4e7027?{'count':_0x4fe877,'rows':_0x4e7027}:null;}})[_0x5bab('0x1f')](respondWithResult(_0x123f88,null))[_0x5bab('0x28')](handleError(_0x123f88,null));};exports[_0x5bab('0x99')]=function(_0x1e5d07,_0x12af0e,_0x29de1b){var _0x495bd1={'raw':!![],'where':{}};var _0x4a8ff2={};var _0x17d0d3={'count':0x0,'rows':[]};return db['MailAccount'][_0x5bab('0x65')]({'where':{'id':_0x1e5d07[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x12af0e,null))['then'](function(_0x1408e0){if(_0x1408e0){_0x4a8ff2[_0x5bab('0x42')]=_[_0x5bab('0x44')](db[_0x5bab('0x9a')][_0x5bab('0x66')]);_0x4a8ff2[_0x5bab('0x43')]=_[_0x5bab('0x44')](_0x1e5d07[_0x5bab('0x43')]);_0x4a8ff2['filters']=_[_0x5bab('0x46')](_0x4a8ff2[_0x5bab('0x42')],_0x4a8ff2[_0x5bab('0x43')]);_0x495bd1[_0x5bab('0x47')]=_[_0x5bab('0x46')](_0x4a8ff2['model'],qs[_0x5bab('0x59')](_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x59')]));_0x495bd1[_0x5bab('0x47')]=_0x495bd1[_0x5bab('0x47')][_0x5bab('0x5a')]?_0x495bd1[_0x5bab('0x47')]:_0x4a8ff2[_0x5bab('0x42')];if(!_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x9b')](_0x5bab('0x48'))){_0x495bd1['limit']=qs['limit'](_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x49')]);_0x495bd1[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x2d')]);}_0x495bd1[_0x5bab('0x4a')]=qs['sort'](_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x4b')]);_0x495bd1[_0x5bab('0x4c')]=qs[_0x5bab('0x45')](_[_0x5bab('0x4d')](_0x1e5d07[_0x5bab('0x43')],_0x4a8ff2['filters']));_0x495bd1[_0x5bab('0x4c')][_0x5bab('0x61')]=_0x1408e0['id'];if(_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x4e')]){_0x495bd1[_0x5bab('0x4c')]=_[_0x5bab('0x4f')](_0x495bd1[_0x5bab('0x4c')],{'$or':_[_0x5bab('0x3d')](_0x495bd1[_0x5bab('0x47')],function(_0xb1ee17){var _0x2968e1={};_0x2968e1[_0xb1ee17]={'$like':'%'+_0x1e5d07[_0x5bab('0x43')][_0x5bab('0x4e')]+'%'};return _0x2968e1;})});}if(_0x1e5d07[_0x5bab('0x43')]['$gte']){var _0x1c7943=_0x1e5d07['query']['$gte'][_0x5bab('0x9c')](',');var _0x31c828={};_0x31c828[_0x1c7943[0x0]]={'$gte':moment(_0x1c7943[0x1])[_0x5bab('0x9d')](_0x5bab('0x9e'))};_0x495bd1['where']=_['merge'](_0x495bd1[_0x5bab('0x4c')],_0x31c828);}_0x495bd1=_['merge']({},_0x495bd1,_0x1e5d07['options']);return db[_0x5bab('0x9a')][_0x5bab('0x51')]({'where':_0x495bd1[_0x5bab('0x4c')]})['then'](function(_0x44cfb8){_0x17d0d3[_0x5bab('0x51')]=_0x44cfb8;if(_0x1e5d07['query'][_0x5bab('0x5b')]){_0x495bd1[_0x5bab('0x52')]=[{'all':!![]}];}return db['MailMessage'][_0x5bab('0x53')](_0x495bd1);})['then'](function(_0x360b02){_0x17d0d3['rows']=_0x360b02;return _0x17d0d3;});}})['then'](respondWithFilteredResult(_0x12af0e,_0x495bd1))[_0x5bab('0x28')](handleError(_0x12af0e,null));};exports[_0x5bab('0x38')]=function(_0x727057,_0x3ef4ef,_0x2f13d8){var _0x133d43,_0x4d8d4f={},_0x550e78;if(_0x727057[_0x5bab('0x5d')]['to']){_0x550e78=_0x727057[_0x5bab('0x5d')]['to'][_0x5bab('0x9c')](',')[0x0];}return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x727057[_0x5bab('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x5bab('0x9f'),'include':[{'model':db[_0x5bab('0x8a')],'as':_0x5bab('0xa0'),'where':{'email':_0x550e78},'limit':0x1,'order':[[_0x5bab('0xa1'),'DESC']]}]},{'model':db[_0x5bab('0x3c')],'as':_0x5bab('0x56'),'raw':!![]}]})[_0x5bab('0x1f')](handleEntityNotFound(_0x3ef4ef,null))['then'](function(_0x5a9907){if(_0x5a9907){_0x133d43=_0x5a9907;if(_0x5a9907[_0x5bab('0x56')]){if(_[_0x5bab('0x6f')](_0x727057[_0x5bab('0x5d')][_0x5bab('0xa2')])){_0x727057['body']['from']=util[_0x5bab('0x9d')](_0x5bab('0xa3'),_0x5a9907[_0x5bab('0x37')],_0x5a9907['email']||_0x5a9907[_0x5bab('0x56')][_0x5bab('0x74')]);}if(_0x727057[_0x5bab('0x5d')][_0x5bab('0xa4')]&&_0x727057['body'][_0x5bab('0xa4')][_0x5bab('0x5a')]){for(var _0x3f1ad1=0x0;_0x3f1ad1<_0x727057['body']['attachments'][_0x5bab('0x5a')];_0x3f1ad1+=0x1){_0x727057[_0x5bab('0x5d')][_0x5bab('0xa4')][_0x3f1ad1]={'filename':_0x727057['body']['attachments'][_0x3f1ad1][_0x5bab('0x37')],'path':path[_0x5bab('0xa5')](config[_0x5bab('0xa6')],'server/files/attachments',_0x727057[_0x5bab('0x5d')][_0x5bab('0xa4')][_0x3f1ad1][_0x5bab('0xa7')])};}}var _0x474293={'tls':{'rejectUnauthorized':![]}};if(_[_0x5bab('0x6f')](_0x5a9907[_0x5bab('0x56')][_0x5bab('0x7c')])){if(_0x5a9907[_0x5bab('0x56')]['authentication']){_0x474293['auth']={'user':_0x5a9907[_0x5bab('0x56')][_0x5bab('0x74')],'pass':_0x5a9907[_0x5bab('0x56')]['pass']};}_0x474293['host']=_0x5a9907[_0x5bab('0x56')]['host'];_0x474293[_0x5bab('0x7b')]=_0x5a9907[_0x5bab('0x56')][_0x5bab('0x7b')];_0x474293['secure']=_0x5a9907['Smtp'][_0x5bab('0xa8')];}else{_0x474293[_0x5bab('0x7c')]=_0x5a9907[_0x5bab('0x56')]['service'];_0x474293['auth']={'user':_0x5a9907[_0x5bab('0x56')][_0x5bab('0x74')],'pass':_0x5a9907['Smtp'][_0x5bab('0x77')]};}return respondWithRpcPromise('SendMail',_0x5bab('0xa9'),{'account':_0x474293,'message':_0x727057[_0x5bab('0x5d')]});}else{throw new Error('List\x20not\x20found');}}})[_0x5bab('0x1f')](function(_0x4febc8){if(_0x4febc8){_0x4d8d4f=_0x4febc8;if(_0x133d43[_0x5bab('0x9f')]){if(_0x133d43[_0x5bab('0x9f')][_0x5bab('0xa0')][_0x5bab('0x5a')]){return _0x133d43['List']['Contacts'][0x0];}else{return db[_0x5bab('0x8a')][_0x5bab('0x63')](_['defaults'](_0x727057[_0x5bab('0x5d')],{'firstName':_0x727057[_0x5bab('0x5d')]['to'],'email':_0x727057[_0x5bab('0x5d')]['to'],'phone':_0x727057[_0x5bab('0x5d')]['to'],'ListId':_0x133d43['ListId']}));}}else{throw new Error(_0x5bab('0xaa'));}}})[_0x5bab('0x1f')](function(_0x3887b2){if(_0x3887b2){var _0x23e65d={'UserId':_0x727057[_0x5bab('0x74')]['id'],'ContactId':_0x3887b2['id'],'MailAccountId':_0x133d43['id'],'inReplyTo':_0x4d8d4f[_0x5bab('0xab')],'to':_0x727057[_0x5bab('0x5d')][_0x5bab('0xa2')],'cc':_0x727057[_0x5bab('0x5d')]['cc'],'subject':_0x727057[_0x5bab('0x5d')][_0x5bab('0xac')],'attach':_0x727057[_0x5bab('0x5d')]['attach'],'firstMsgDirection':_0x5bab('0xad'),'lastMsgAt':moment()[_0x5bab('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x5bab('0xad'),'lastMsgBody':_0x727057[_0x5bab('0x5d')][_0x5bab('0x5d')],'Messages':[_[_0x5bab('0x4f')](_0x727057[_0x5bab('0x5d')],{'messageId':_0x4d8d4f[_0x5bab('0xab')],'sentAt':moment()[_0x5bab('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x133d43['id'],'UserId':_0x727057[_0x5bab('0x74')]['id'],'ContactId':_0x3887b2['id']})]};if(_0x727057[_0x5bab('0x5d')][_0x5bab('0xae')]){_0x23e65d=_[_0x5bab('0x4f')](_0x23e65d,_0x727057[_0x5bab('0x5d')][_0x5bab('0xae')]);}return db['MailInteraction'][_0x5bab('0x63')](_0x23e65d,{'include':[{'model':db[_0x5bab('0x9a')],'as':'Messages'}]});}})['then'](respondWithResult(_0x3ef4ef,null))[_0x5bab('0x28')](handleError(_0x3ef4ef,null));};exports['verifySmtp']=function(_0x369be5,_0x104211,_0x5ca5fa){return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x369be5['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x5bab('0x56'),'raw':!![]}]})[_0x5bab('0x1f')](handleEntityNotFound(_0x104211,null))[_0x5bab('0x1f')](function(_0x4b0cf2){if(_0x4b0cf2&&_0x4b0cf2[_0x5bab('0x56')]){var _0x520ec5={'id':_0x4b0cf2['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4b0cf2['Smtp'][_0x5bab('0x7c')]){_0x520ec5[_0x5bab('0x7c')]=_0x4b0cf2['Smtp'][_0x5bab('0x7c')];}else{_0x520ec5[_0x5bab('0x7a')]=_0x4b0cf2[_0x5bab('0x56')][_0x5bab('0x7a')];_0x520ec5['port']=_0x4b0cf2['Smtp'][_0x5bab('0x7b')];_0x520ec5[_0x5bab('0xa8')]=_0x4b0cf2[_0x5bab('0x56')]['secure'];}if(_0x4b0cf2['Smtp'][_0x5bab('0x79')]){_0x520ec5[_0x5bab('0xaf')]={'user':_0x4b0cf2[_0x5bab('0x56')]['user'],'pass':_0x4b0cf2[_0x5bab('0x56')]['pass']};}return respondWithRpcPromise(_0x5bab('0xb0'),_0x5bab('0xb1'),{'account':_0x520ec5});}})[_0x5bab('0x1f')](respondWithResult(_0x104211,null))[_0x5bab('0x28')](handleError(_0x104211,null));};exports['destroy']=function(_0x148853,_0x1e045a){return db[_0x5bab('0x3e')][_0x5bab('0x5c')]({'where':{'id':_0x148853[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x1e045a,null))[_0x5bab('0x1f')](function(_0x58e467){if(_0x58e467&&_0x58e467['service']){throw new db[(_0x5bab('0x1d'))]['ValidationError'](_0x5bab('0xb2'));}return _0x58e467;})[_0x5bab('0x1f')](removeEntity(_0x1e045a,null))['catch'](handleError(_0x1e045a,null));};exports[_0x5bab('0xb3')]=function(_0x34e4ec,_0x1ae4d9,_0x2ebd6a){return db[_0x5bab('0x3e')][_0x5bab('0x5c')]({'where':{'id':_0x34e4ec['params']['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x1ae4d9,null))[_0x5bab('0x1f')](function(_0x685347){if(_0x685347){return _0x685347['addAgents'](_0x34e4ec[_0x5bab('0x5d')]['ids'],_['omit'](_0x34e4ec[_0x5bab('0x5d')],[_0x5bab('0x69'),'id'])||{})['spread'](function(_0x1d519a){for(var _0x58fc8a=0x0;_0x58fc8a<_0x34e4ec[_0x5bab('0x5d')][_0x5bab('0x69')][_0x5bab('0x5a')];_0x58fc8a+=0x1){socket['emit'](_0x5bab('0xb4'),{'UserId':_0x34e4ec[_0x5bab('0x5d')][_0x5bab('0x69')][_0x58fc8a],'MailAccountId':_0x34e4ec[_0x5bab('0x60')]['id']});}return _0x1d519a;});}})[_0x5bab('0x1f')](respondWithResult(_0x1ae4d9,null))[_0x5bab('0x28')](handleError(_0x1ae4d9,null));};exports['removeAgents']=function(_0x442500,_0xd97468,_0x463464){return db['MailAccount'][_0x5bab('0x5c')]({'where':{'id':_0x442500['params']['id']}})['then'](handleEntityNotFound(_0xd97468,null))[_0x5bab('0x1f')](function(_0x4cb315){if(_0x4cb315){return _0x4cb315['removeAgents'](_0x442500['query'][_0x5bab('0x69')])[_0x5bab('0x1f')](function(){if(_[_0x5bab('0xb5')](_0x442500[_0x5bab('0x43')]['ids'])){for(var _0x511193=0x0;_0x511193<_0x442500[_0x5bab('0x43')][_0x5bab('0x69')][_0x5bab('0x5a')];_0x511193+=0x1){socket[_0x5bab('0xb6')]('userMailAccount:remove',{'UserId':Number(_0x442500[_0x5bab('0x43')]['ids'][_0x511193]),'MailAccountId':Number(_0x442500[_0x5bab('0x60')]['id'])});}}else{socket[_0x5bab('0xb6')]('userMailAccount:remove',{'UserId':Number(_0x442500[_0x5bab('0x43')][_0x5bab('0x69')]),'MailAccountId':Number(_0x442500[_0x5bab('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0xd97468,null))[_0x5bab('0x28')](handleError(_0xd97468,null));};exports[_0x5bab('0xb7')]=function(_0x4f193c,_0x3dd0eb,_0x38c697){var _0x6d2e83={};var _0x48c2e2={};var _0x22daf8;var _0x169dc7;return db[_0x5bab('0x3e')][_0x5bab('0x65')]({'where':{'id':_0x4f193c[_0x5bab('0x60')]['id']}})[_0x5bab('0x1f')](handleEntityNotFound(_0x3dd0eb,null))['then'](function(_0x41c0bc){if(_0x41c0bc){_0x22daf8=_0x41c0bc;_0x48c2e2[_0x5bab('0x42')]=_[_0x5bab('0x44')](db[_0x5bab('0x8c')][_0x5bab('0x66')]);_0x48c2e2[_0x5bab('0x43')]=_['keys'](_0x4f193c['query']);_0x48c2e2[_0x5bab('0x45')]=_[_0x5bab('0x46')](_0x48c2e2[_0x5bab('0x42')],_0x48c2e2[_0x5bab('0x43')]);_0x6d2e83[_0x5bab('0x47')]=_[_0x5bab('0x46')](_0x48c2e2[_0x5bab('0x42')],qs['fields'](_0x4f193c[_0x5bab('0x43')]['fields']));_0x6d2e83['attributes']=_0x6d2e83['attributes'][_0x5bab('0x5a')]?_0x6d2e83[_0x5bab('0x47')]:_0x48c2e2[_0x5bab('0x42')];_0x6d2e83['order']=qs['sort'](_0x4f193c[_0x5bab('0x43')][_0x5bab('0x4b')]);_0x6d2e83[_0x5bab('0x4c')]=qs[_0x5bab('0x45')](_[_0x5bab('0x4d')](_0x4f193c['query'],_0x48c2e2[_0x5bab('0x45')]));if(_0x4f193c[_0x5bab('0x43')]['filter']){_0x6d2e83[_0x5bab('0x4c')]=_[_0x5bab('0x4f')](_0x6d2e83['where'],{'$or':_[_0x5bab('0x3d')](_0x6d2e83['attributes'],function(_0x5e85b2){var _0x4df4f1={};_0x4df4f1[_0x5e85b2]={'$like':'%'+_0x4f193c[_0x5bab('0x43')]['filter']+'%'};return _0x4df4f1;})});}_0x6d2e83=_[_0x5bab('0x4f')]({},_0x6d2e83,_0x4f193c[_0x5bab('0x67')]);return _0x22daf8[_0x5bab('0xb7')](_0x6d2e83);}})['then'](function(_0x40b348){if(_0x40b348){_0x169dc7=_0x40b348['length'];if(!_0x4f193c['query'][_0x5bab('0x9b')](_0x5bab('0x48'))){_0x6d2e83[_0x5bab('0x49')]=qs[_0x5bab('0x49')](_0x4f193c[_0x5bab('0x43')]['limit']);_0x6d2e83[_0x5bab('0x2d')]=qs[_0x5bab('0x2d')](_0x4f193c[_0x5bab('0x43')][_0x5bab('0x2d')]);}return _0x22daf8[_0x5bab('0xb7')](_0x6d2e83);}})[_0x5bab('0x1f')](function(_0x2b34f0){if(_0x2b34f0){return _0x2b34f0?{'count':_0x169dc7,'rows':_0x2b34f0}:null;}})['then'](respondWithResult(_0x3dd0eb,null))[_0x5bab('0x28')](handleError(_0x3dd0eb,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index da3bc9d..6519bed 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 _0x6ecc=['hook','exports','../../mysqldb','MailAccount','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x23ae45,_0xddbdcf){var _0x3c2d02=function(_0x395a3e){while(--_0x395a3e){_0x23ae45['push'](_0x23ae45['shift']());}};_0x3c2d02(++_0xddbdcf);}(_0x6ecc,0xca));var _0xc6ec=function(_0x4298b,_0xd55b53){_0x4298b=_0x4298b-0x0;var _0x4bb1ee=_0x6ecc[_0x4298b];return _0x4bb1ee;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xc6ec('0x0'))['db'][_0xc6ec('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc6ec('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc6ec('0x3')};function emitEvent(_0x268fb8){return function(_0x2ba914,_0x24b74a,_0x127734){MailAccountEvents[_0xc6ec('0x4')](_0x268fb8+':'+_0x2ba914['id'],_0x2ba914);MailAccountEvents[_0xc6ec('0x4')](_0x268fb8,_0x2ba914);_0x127734(null);};}for(var e in events){if(events[_0xc6ec('0x5')](e)){var event=events[e];MailAccount[_0xc6ec('0x6')](e,emitEvent(event));}}module[_0xc6ec('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x5468=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x304c5a,_0x132822){var _0x368208=function(_0x459839){while(--_0x459839){_0x304c5a['push'](_0x304c5a['shift']());}};_0x368208(++_0x132822);}(_0x5468,0x187));var _0x8546=function(_0x543651,_0x344197){_0x543651=_0x543651-0x0;var _0x54103d=_0x5468[_0x543651];return _0x54103d;};'use strict';var EventEmitter=require(_0x8546('0x0'));var MailAccount=require(_0x8546('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8546('0x2'),'afterUpdate':_0x8546('0x3'),'afterDestroy':_0x8546('0x4')};function emitEvent(_0x53e8b7){return function(_0x51658d,_0x20411b,_0x4cd7a5){MailAccountEvents['emit'](_0x53e8b7+':'+_0x51658d['id'],_0x51658d);MailAccountEvents[_0x8546('0x5')](_0x53e8b7,_0x51658d);_0x4cd7a5(null);};}for(var e in events){if(events[_0x8546('0x6')](e)){var event=events[e];MailAccount[_0x8546('0x7')](e,emitEvent(event));}}module[_0x8546('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 e151d66..1a73a1e 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 _0x3eed=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','define','MailAccount','util'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3eed,0x153));var _0xd3ee=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3eed[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xd3ee('0x0'));var logger=require('../../config/logger')(_0xd3ee('0x1'));var moment=require(_0xd3ee('0x2'));var BPromise=require(_0xd3ee('0x3'));var rp=require(_0xd3ee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3ee('0x5'));var config=require(_0xd3ee('0x6'));var attributes=require(_0xd3ee('0x7'));module['exports']=function(_0x4794dc,_0x131a2e){return _0x4794dc[_0xd3ee('0x8')](_0xd3ee('0x9'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaff3=['bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','define','MailAccount','mail_accounts','util','../../config/logger','api','moment'];(function(_0x49bcc7,_0x5ae274){var _0x221c36=function(_0x2358a0){while(--_0x2358a0){_0x49bcc7['push'](_0x49bcc7['shift']());}};_0x221c36(++_0x5ae274);}(_0xaff3,0x18f));var _0x3aff=function(_0x481aa3,_0x1a0a81){_0x481aa3=_0x481aa3-0x0;var _0x7f8374=_0xaff3[_0x481aa3];return _0x7f8374;};'use strict';var _=require('lodash');var util=require(_0x3aff('0x0'));var logger=require(_0x3aff('0x1'))(_0x3aff('0x2'));var moment=require(_0x3aff('0x3'));var BPromise=require(_0x3aff('0x4'));var rp=require(_0x3aff('0x5'));var fs=require('fs');var path=require(_0x3aff('0x6'));var rimraf=require(_0x3aff('0x7'));var config=require(_0x3aff('0x8'));var attributes=require(_0x3aff('0x9'));module['exports']=function(_0xc4cd47,_0x50efd5){return _0xc4cd47[_0x3aff('0xa')](_0x3aff('0xb'),attributes,{'tableName':_0x3aff('0xc'),'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 cecba32..b5d4b43 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 _0x45ea=['UserId','unshift','agent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','./mailAccount.socket','register','request','MailAccount,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','GetMailAccount','MailAccount','options','where','limit','map','include','model','attributes','stringify','ShowMailAccount','raw','then','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','MailApplication','Smtp','get','Applications','list','applications','orderBy','priority','asc','autoclose','push','close','defaults','create','List\x20not\x20found','messageId','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','contact','originTo','Attachments'];(function(_0x5b47cb,_0x21cfc4){var _0x1e615b=function(_0xd18fb){while(--_0xd18fb){_0x5b47cb['push'](_0x5b47cb['shift']());}};_0x1e615b(++_0x21cfc4);}(_0x45ea,0x1f0));var _0xa45e=function(_0x4223a,_0x234025){_0x4223a=_0x4223a-0x0;var _0x13ec8b=_0x45ea[_0x4223a];return _0x13ec8b;};'use strict';var _=require(_0xa45e('0x0'));var util=require(_0xa45e('0x1'));var moment=require(_0xa45e('0x2'));var BPromise=require(_0xa45e('0x3'));var rs=require(_0xa45e('0x4'));var fs=require('fs');var Redis=require(_0xa45e('0x5'));var db=require(_0xa45e('0x6'))['db'];var utils=require(_0xa45e('0x7'));var logger=require(_0xa45e('0x8'))(_0xa45e('0x9'));var config=require(_0xa45e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa45e('0xb')][_0xa45e('0xc')]({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':_0xa45e('0xd'),'port':0x18eb});var socket=require(_0xa45e('0xe'))(new Redis(config[_0xa45e('0xf')]));require(_0xa45e('0x10'))[_0xa45e('0x11')](socket);function respondWithRpcPromise(_0x5ea77f,_0x506435,_0x193fe6){return new BPromise(function(_0x28aa8e,_0x17788b){return client[_0xa45e('0x12')](_0x5ea77f,_0x193fe6)['then'](function(_0x14f158){logger['info'](_0xa45e('0x13'),_0x506435,_0xa45e('0x14'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x506435,_0xa45e('0x14'),JSON['stringify'](_0x14f158));if(_0x14f158[_0xa45e('0x15')]){if(_0x14f158['error']['code']===0x1f4){logger['error'](_0xa45e('0x13'),_0x506435,_0x14f158['error'][_0xa45e('0x16')]);return _0x17788b(_0x14f158[_0xa45e('0x15')][_0xa45e('0x16')]);}logger[_0xa45e('0x15')](_0xa45e('0x13'),_0x506435,_0x14f158['error'][_0xa45e('0x16')]);return _0x28aa8e(_0x14f158[_0xa45e('0x15')][_0xa45e('0x16')]);}else{logger[_0xa45e('0x17')](_0xa45e('0x13'),_0x506435,'request\x20sent');_0x28aa8e(_0x14f158[_0xa45e('0x18')][_0xa45e('0x16')]);}})[_0xa45e('0x19')](function(_0x2579ff){logger[_0xa45e('0x15')](_0xa45e('0x13'),_0x506435,_0x2579ff);_0x17788b(_0x2579ff);});});}exports[_0xa45e('0x1a')]=function(_0x2e8c81){var _0x49dae2=this;return new Promise(function(_0x14e2db,_0xcf43bd){return db[_0xa45e('0x1b')]['findAll']({'raw':_0x2e8c81['options']?_0x2e8c81[_0xa45e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2e8c81[_0xa45e('0x1c')]?_0x2e8c81[_0xa45e('0x1c')][_0xa45e('0x1d')]||null:null,'attributes':_0x2e8c81[_0xa45e('0x1c')]?_0x2e8c81[_0xa45e('0x1c')]['attributes']||null:null,'limit':_0x2e8c81[_0xa45e('0x1c')]?_0x2e8c81['options'][_0xa45e('0x1e')]||null:null,'include':_0x2e8c81[_0xa45e('0x1c')]?_0x2e8c81['options']['include']?_[_0xa45e('0x1f')](_0x2e8c81['options'][_0xa45e('0x20')],function(_0x252957){return{'model':db[_0x252957[_0xa45e('0x21')]],'as':_0x252957['as'],'attributes':_0x252957['attributes'],'include':_0x252957['include']?_[_0xa45e('0x1f')](_0x252957[_0xa45e('0x20')],function(_0x228ec8){return{'model':db[_0x228ec8[_0xa45e('0x21')]],'as':_0x228ec8['as'],'attributes':_0x228ec8[_0xa45e('0x22')],'include':_0x228ec8['include']?_[_0xa45e('0x1f')](_0x228ec8[_0xa45e('0x20')],function(_0x5e2a58){return{'model':db[_0x5e2a58[_0xa45e('0x21')]],'as':_0x5e2a58['as'],'attributes':_0x5e2a58['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d4527){logger[_0xa45e('0x17')]('GetMailAccount',_0x2e8c81);logger['debug'](_0xa45e('0x1a'),_0x2e8c81,JSON[_0xa45e('0x23')](_0x1d4527));_0x14e2db(_0x1d4527);})[_0xa45e('0x19')](function(_0x4867a4){logger[_0xa45e('0x15')](_0xa45e('0x1a'),_0x4867a4[_0xa45e('0x16')],_0x2e8c81);_0xcf43bd(_0x49dae2[_0xa45e('0x15')](0x1f4,_0x4867a4['message']));});});};exports[_0xa45e('0x24')]=function(_0xf92852){var _0x4f54d3=this;return new Promise(function(_0x59801d,_0x1d23a){return db[_0xa45e('0x1b')]['find']({'raw':_0xf92852[_0xa45e('0x1c')]?_0xf92852[_0xa45e('0x1c')][_0xa45e('0x25')]===undefined?!![]:![]:!![],'where':_0xf92852['options']?_0xf92852[_0xa45e('0x1c')][_0xa45e('0x1d')]||null:null,'attributes':_0xf92852[_0xa45e('0x1c')]?_0xf92852['options'][_0xa45e('0x22')]||null:null,'include':_0xf92852[_0xa45e('0x1c')]?_0xf92852[_0xa45e('0x1c')][_0xa45e('0x20')]?_[_0xa45e('0x1f')](_0xf92852[_0xa45e('0x1c')][_0xa45e('0x20')],function(_0x3d1d2a){return{'model':db[_0x3d1d2a[_0xa45e('0x21')]],'as':_0x3d1d2a['as'],'attributes':_0x3d1d2a[_0xa45e('0x22')],'include':_0x3d1d2a[_0xa45e('0x20')]?_[_0xa45e('0x1f')](_0x3d1d2a[_0xa45e('0x20')],function(_0x52bad1){return{'model':db[_0x52bad1['model']],'as':_0x52bad1['as'],'attributes':_0x52bad1[_0xa45e('0x22')],'include':_0x52bad1[_0xa45e('0x20')]?_[_0xa45e('0x1f')](_0x52bad1[_0xa45e('0x20')],function(_0x3c2957){return{'model':db[_0x3c2957[_0xa45e('0x21')]],'as':_0x3c2957['as'],'attributes':_0x3c2957['attributes']};}):[]};}):[]};}):[]:[]})[_0xa45e('0x26')](function(_0x38fe69){logger['info'](_0xa45e('0x24'),_0xf92852);logger['debug'](_0xa45e('0x24'),_0xf92852,JSON['stringify'](_0x38fe69));_0x59801d(_0x38fe69);})[_0xa45e('0x19')](function(_0x241a0c){logger[_0xa45e('0x15')](_0xa45e('0x24'),_0x241a0c[_0xa45e('0x16')],_0xf92852);_0x1d23a(_0x4f54d3[_0xa45e('0x15')](0x1f4,_0x241a0c[_0xa45e('0x16')]));});});};exports[_0xa45e('0x27')]=function(_0x416da0){var _0x3c4bf6=this;return new Promise(function(_0x424890,_0x32753b){var _0x107f28={'body':_0x416da0[_0xa45e('0x28')],'channel':_0xa45e('0x29')};var _0x1db5db=_[_0xa45e('0x2a')](_[_0xa45e('0x2b')](db[_0xa45e('0x2c')][_0xa45e('0x2d')]),[_0xa45e('0x2e'),_0xa45e('0x2f'),_0xa45e('0x30'),_0xa45e('0x31')]);var _0x4b2c3b=![];if(_0x416da0[_0xa45e('0x28')]['id']){delete _0x416da0[_0xa45e('0x28')]['id'];}if(_[_0xa45e('0x32')](_0x416da0['body'][_0xa45e('0x33')])){return _0x32753b(_0x3c4bf6['error'](0x1f4,_0xa45e('0x34')));}if(_['isNil'](_0x416da0[_0xa45e('0x28')][_0xa45e('0x28')])||_0x416da0[_0xa45e('0x28')]['body']===''){return _0x32753b(_0x3c4bf6['error'](0x1f4,_0xa45e('0x35')));}if(_[_0xa45e('0x32')](_0x416da0[_0xa45e('0x28')][_0xa45e('0x36')])){return _0x32753b(_0x3c4bf6[_0xa45e('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1db5db));}if(!_[_0xa45e('0x37')](_0x1db5db,_0x416da0[_0xa45e('0x28')][_0xa45e('0x36')])){return _0x32753b(_0x3c4bf6[_0xa45e('0x15')](0x1f4,_0xa45e('0x38')+_0x1db5db));}var _0x1be378={};_0x1be378[_0x416da0[_0xa45e('0x28')]['mapKey']]=_0x416da0[_0xa45e('0x28')][_0xa45e('0x33')];return db[_0xa45e('0x1b')][_0xa45e('0x39')]({'where':{'id':_0x416da0[_0xa45e('0x3a')]['id']},'include':[{'model':db['CmList'],'as':_0xa45e('0x3b'),'include':[{'model':db['CmContact'],'as':_0xa45e('0x3c'),'where':_0x1be378,'limit':0x1,'order':[[_0xa45e('0x2f'),'DESC']]}]},{'model':db[_0xa45e('0x3d')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0xa45e('0x3e')}]})[_0xa45e('0x26')](function(_0x42b714){if(_0x42b714&&_0x42b714[_0xa45e('0x3b')]){var _0x46d847=_0x42b714[_0xa45e('0x3f')]({'plain':!![]});_0x107f28[_0xa45e('0x3a')]=_['omit'](_0x46d847,[_0xa45e('0x40'),_0xa45e('0x3b')]);_0x107f28['applications']=_0x46d847['Applications'];_0x107f28[_0xa45e('0x41')]=_0x46d847[_0xa45e('0x3b')];_0x107f28[_0xa45e('0x42')]=_[_0xa45e('0x43')](_0x107f28[_0xa45e('0x42')],[_0xa45e('0x44')],[_0xa45e('0x45')]);if(_0x107f28[_0xa45e('0x3a')]&&_0x107f28[_0xa45e('0x3a')][_0xa45e('0x46')]){_0x107f28['applications'][_0xa45e('0x47')]({'id':0x0,'priority':_0x107f28[_0xa45e('0x42')]['length']+0x1,'app':_0xa45e('0x48'),'appdata':_0xa45e('0x46'),'interval':'*,*,*,*'});}if(_0x107f28[_0xa45e('0x3a')]['Applications']){delete _0x107f28[_0xa45e('0x3a')][_0xa45e('0x40')];}if(_0x107f28[_0xa45e('0x3a')][_0xa45e('0x3b')]){delete _0x107f28[_0xa45e('0x3a')][_0xa45e('0x3b')];}if(_0x46d847[_0xa45e('0x3b')][_0xa45e('0x3c')]['length']){return _0x46d847[_0xa45e('0x3b')][_0xa45e('0x3c')][0x0];}var _0x270c4d=_[_0xa45e('0x49')](_0x416da0[_0xa45e('0x28')],{'firstName':_0x416da0[_0xa45e('0x28')][_0xa45e('0x33')],'ListId':_0x46d847['ListId']});_0x270c4d[_0x416da0['body'][_0xa45e('0x36')]]=_0x416da0[_0xa45e('0x28')][_0xa45e('0x33')];return db[_0xa45e('0x2c')][_0xa45e('0x4a')](_0x270c4d);}else{throw new Error(_0xa45e('0x4b'));}})[_0xa45e('0x26')](function(_0x3cbc5f){_0x107f28['contact']=_0x3cbc5f;if(_0x3cbc5f){if(!_0x416da0['body'][_0xa45e('0x16')][_0xa45e('0x4c')]){_0x416da0['body'][_0xa45e('0x16')][_0xa45e('0x4c')]=rs['generate']()+'\x20'+_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')][_0xa45e('0x33')];}var _0x3bdf2e={'ContactId':_0x3cbc5f['id'],'MailAccountId':_0x416da0[_0xa45e('0x3a')]['id'],'inReplyTo':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')]['messageId'],'to':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')][_0xa45e('0x33')],'cc':_0x416da0[_0xa45e('0x28')]['message']['cc'],'subject':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')]['subject'],'attach':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')][_0xa45e('0x4d')],'lastMsgAt':moment()[_0xa45e('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x416da0['body']['body']};return db[_0xa45e('0x4f')][_0xa45e('0x39')]({'where':{'closed':![],'MailAccountId':_0x416da0[_0xa45e('0x3a')]['id']},'include':[{'model':db[_0xa45e('0x50')],'as':_0xa45e('0x51'),'attributes':[_0xa45e('0x4c')],'where':{'messageId':_0x416da0[_0xa45e('0x28')]['message'][_0xa45e('0x52')]}}]})[_0xa45e('0x26')](function(_0x1c6829){if(_0x1c6829){return[_0x1c6829,![]];}return db[_0xa45e('0x4f')]['create'](_0x3bdf2e)[_0xa45e('0x26')](function(_0x2662f3){return[_0x2662f3,!![]];});});}else{throw new Error(_0xa45e('0x53'));}})[_0xa45e('0x54')](function(_0x1658de,_0x5c9252){if(_0x1658de){_0x4b2c3b=_0x5c9252;if(!_0x5c9252){return _0x1658de[_0xa45e('0x55')]({'inReplyTo':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')]['messageId'],'to':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')][_0xa45e('0x33')],'cc':_0x416da0[_0xa45e('0x28')]['message']['cc'],'subject':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')][_0xa45e('0x56')],'attach':_0x1658de[_0xa45e('0x4d')]?_0x1658de[_0xa45e('0x4d')]:_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')][_0xa45e('0x4d')],'substatus':null,'substatusAt':moment()[_0xa45e('0x4e')](_0xa45e('0x57')),'lastMsgAt':moment()['format'](_0xa45e('0x57')),'lastMsgDirection':'in','lastMsgBody':_0x416da0['body'][_0xa45e('0x28')]});}else{return _0x1658de;}}})[_0xa45e('0x26')](function(_0x5775a4){_0x107f28[_0xa45e('0x58')]=_0x5775a4[_0xa45e('0x3f')]({'plain':!![]});_0x107f28[_0xa45e('0x58')]['created']=_0x4b2c3b;return db[_0xa45e('0x50')][_0xa45e('0x4a')]({'body':_0x416da0[_0xa45e('0x28')]['body'],'MailAccountId':_0x416da0[_0xa45e('0x3a')]['id'],'MailInteractionId':_0x5775a4['id'],'direction':'in','ContactId':_0x107f28[_0xa45e('0x59')]['id'],'messageId':_0x416da0['body'][_0xa45e('0x16')][_0xa45e('0x4c')],'from':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')][_0xa45e('0x33')],'to':_0x416da0[_0xa45e('0x28')]['message']['to'],'cc':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')]['cc'],'subject':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')][_0xa45e('0x56')],'attach':_0x416da0['body'][_0xa45e('0x16')][_0xa45e('0x4d')],'Attachments':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')]['attachments'],'originTo':_0x416da0['body'][_0xa45e('0x16')][_0xa45e('0x5a')],'originCc':_0x416da0[_0xa45e('0x28')][_0xa45e('0x16')]['originCc'],'bcc':_0x416da0[_0xa45e('0x28')]['message']['bcc']},{'include':[{'model':db['Attachment'],'as':_0xa45e('0x5b')}]});})['then'](function(_0x2913a0){_0x107f28['message']=_0x2913a0;if(_0x107f28[_0xa45e('0x58')][_0xa45e('0x5c')]){return db['User'][_0xa45e('0x39')]({'attributes':['id','name'],'where':{'id':_0x107f28[_0xa45e('0x58')][_0xa45e('0x5c')]}})[_0xa45e('0x26')](function(_0x47b7af){if(_0x47b7af){_0x107f28[_0xa45e('0x42')][_0xa45e('0x5d')]({'id':0x0,'priority':0x0,'app':_0xa45e('0x5e'),'appdata':_0x47b7af['name']+','+(_0x107f28[_0xa45e('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':_0xa45e('0x5f')});}return respondWithRpcPromise(_0xa45e('0x60'),_0xa45e('0x61'),_0x107f28);});}return respondWithRpcPromise(_0xa45e('0x60'),_0xa45e('0x61'),_0x107f28);})[_0xa45e('0x26')](function(_0x3aaf18){_0x424890(_0x3aaf18);})[_0xa45e('0x19')](function(_0x327cbc){_0x32753b(_0x3c4bf6[_0xa45e('0x15')](0x1f4,_0x327cbc['message']));});});}; \ No newline at end of file +var _0x22fb=['attachments','Attachment','Attachments','name','interaction','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','raw','options','where','attributes','map','model','include','debug','ShowMailAccount','find','then','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','account','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','omit','applications','list','priority','asc','autoclose','push','*,*,*,*','length','ListId','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','create','update','YYYY-MM-DD\x20HH:mm:ss','get','created'];(function(_0x393c55,_0x43b06c){var _0x4085fc=function(_0x541e20){while(--_0x541e20){_0x393c55['push'](_0x393c55['shift']());}};_0x4085fc(++_0x43b06c);}(_0x22fb,0x192));var _0xb22f=function(_0x9ad8c5,_0x33b44b){_0x9ad8c5=_0x9ad8c5-0x0;var _0x4a9cc8=_0x22fb[_0x9ad8c5];return _0x4a9cc8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232c});config[_0xb22f('0xa')]=_[_0xb22f('0xb')](config['redis'],{'host':_0xb22f('0xc'),'port':0x18eb});var socket=require(_0xb22f('0xd'))(new Redis(config[_0xb22f('0xa')]));require(_0xb22f('0xe'))[_0xb22f('0xf')](socket);function respondWithRpcPromise(_0x3593fb,_0x188cea,_0x2ca6dd){return new BPromise(function(_0x26cf79,_0x2676f3){return client[_0xb22f('0x10')](_0x3593fb,_0x2ca6dd)['then'](function(_0x4b9e56){logger['info'](_0xb22f('0x11'),_0x188cea,'request\x20sent');logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'),JSON[_0xb22f('0x13')](_0x4b9e56));if(_0x4b9e56[_0xb22f('0x14')]){if(_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x15')]===0x1f4){logger[_0xb22f('0x14')]('MailAccount,\x20%s,\x20%s',_0x188cea,_0x4b9e56[_0xb22f('0x14')]['message']);return _0x2676f3(_0x4b9e56[_0xb22f('0x14')]['message']);}logger[_0xb22f('0x14')](_0xb22f('0x11'),_0x188cea,_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x16')]);return _0x26cf79(_0x4b9e56[_0xb22f('0x14')]['message']);}else{logger[_0xb22f('0x17')]('MailAccount,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'));_0x26cf79(_0x4b9e56[_0xb22f('0x18')][_0xb22f('0x16')]);}})[_0xb22f('0x19')](function(_0x139bb6){logger[_0xb22f('0x14')]('MailAccount,\x20%s,\x20%s',_0x188cea,_0x139bb6);_0x2676f3(_0x139bb6);});});}exports[_0xb22f('0x1a')]=function(_0x4b4510){var _0x3e05ce=this;return new Promise(function(_0x3878d8,_0x316f11){return db[_0xb22f('0x1b')][_0xb22f('0x1c')]({'raw':_0x4b4510['options']?_0x4b4510['options'][_0xb22f('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b4510[_0xb22f('0x1e')]?_0x4b4510[_0xb22f('0x1e')][_0xb22f('0x1f')]||null:null,'attributes':_0x4b4510[_0xb22f('0x1e')]?_0x4b4510[_0xb22f('0x1e')][_0xb22f('0x20')]||null:null,'limit':_0x4b4510[_0xb22f('0x1e')]?_0x4b4510['options']['limit']||null:null,'include':_0x4b4510[_0xb22f('0x1e')]?_0x4b4510[_0xb22f('0x1e')]['include']?_[_0xb22f('0x21')](_0x4b4510[_0xb22f('0x1e')]['include'],function(_0x4687f2){return{'model':db[_0x4687f2[_0xb22f('0x22')]],'as':_0x4687f2['as'],'attributes':_0x4687f2['attributes'],'include':_0x4687f2[_0xb22f('0x23')]?_[_0xb22f('0x21')](_0x4687f2[_0xb22f('0x23')],function(_0xec047c){return{'model':db[_0xec047c[_0xb22f('0x22')]],'as':_0xec047c['as'],'attributes':_0xec047c[_0xb22f('0x20')],'include':_0xec047c[_0xb22f('0x23')]?_[_0xb22f('0x21')](_0xec047c['include'],function(_0x483cc3){return{'model':db[_0x483cc3['model']],'as':_0x483cc3['as'],'attributes':_0x483cc3[_0xb22f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x327200){logger[_0xb22f('0x17')](_0xb22f('0x1a'),_0x4b4510);logger[_0xb22f('0x24')](_0xb22f('0x1a'),_0x4b4510,JSON['stringify'](_0x327200));_0x3878d8(_0x327200);})['catch'](function(_0x435690){logger[_0xb22f('0x14')](_0xb22f('0x1a'),_0x435690[_0xb22f('0x16')],_0x4b4510);_0x316f11(_0x3e05ce['error'](0x1f4,_0x435690[_0xb22f('0x16')]));});});};exports[_0xb22f('0x25')]=function(_0x58f560){var _0x344c30=this;return new Promise(function(_0x218d55,_0x308ecd){return db[_0xb22f('0x1b')][_0xb22f('0x26')]({'raw':_0x58f560['options']?_0x58f560['options'][_0xb22f('0x1d')]===undefined?!![]:![]:!![],'where':_0x58f560[_0xb22f('0x1e')]?_0x58f560[_0xb22f('0x1e')][_0xb22f('0x1f')]||null:null,'attributes':_0x58f560[_0xb22f('0x1e')]?_0x58f560[_0xb22f('0x1e')][_0xb22f('0x20')]||null:null,'include':_0x58f560[_0xb22f('0x1e')]?_0x58f560[_0xb22f('0x1e')]['include']?_[_0xb22f('0x21')](_0x58f560['options']['include'],function(_0x3a74a7){return{'model':db[_0x3a74a7[_0xb22f('0x22')]],'as':_0x3a74a7['as'],'attributes':_0x3a74a7[_0xb22f('0x20')],'include':_0x3a74a7[_0xb22f('0x23')]?_[_0xb22f('0x21')](_0x3a74a7[_0xb22f('0x23')],function(_0x1ca6b8){return{'model':db[_0x1ca6b8[_0xb22f('0x22')]],'as':_0x1ca6b8['as'],'attributes':_0x1ca6b8[_0xb22f('0x20')],'include':_0x1ca6b8[_0xb22f('0x23')]?_[_0xb22f('0x21')](_0x1ca6b8[_0xb22f('0x23')],function(_0x2ab591){return{'model':db[_0x2ab591['model']],'as':_0x2ab591['as'],'attributes':_0x2ab591['attributes']};}):[]};}):[]};}):[]:[]})[_0xb22f('0x27')](function(_0x38a443){logger[_0xb22f('0x17')]('ShowMailAccount',_0x58f560);logger[_0xb22f('0x24')](_0xb22f('0x25'),_0x58f560,JSON['stringify'](_0x38a443));_0x218d55(_0x38a443);})['catch'](function(_0x2ddd64){logger['error'](_0xb22f('0x25'),_0x2ddd64['message'],_0x58f560);_0x308ecd(_0x344c30[_0xb22f('0x14')](0x1f4,_0x2ddd64[_0xb22f('0x16')]));});});};exports[_0xb22f('0x28')]=function(_0x52a3c7){var _0x2cf9f4=this;return new Promise(function(_0x2d265c,_0x2c2a72){var _0x5e2faa={'body':_0x52a3c7[_0xb22f('0x29')],'channel':_0xb22f('0x2a')};var _0x186a66=_[_0xb22f('0x2b')](_[_0xb22f('0x2c')](db[_0xb22f('0x2d')][_0xb22f('0x2e')]),[_0xb22f('0x2f'),_0xb22f('0x30'),_0xb22f('0x31'),'ListId']);var _0x37817a=![];if(_0x52a3c7[_0xb22f('0x29')]['id']){delete _0x52a3c7['body']['id'];}if(_[_0xb22f('0x32')](_0x52a3c7['body']['from'])){return _0x2c2a72(_0x2cf9f4[_0xb22f('0x14')](0x1f4,_0xb22f('0x33')));}if(_[_0xb22f('0x32')](_0x52a3c7[_0xb22f('0x29')]['body'])||_0x52a3c7[_0xb22f('0x29')]['body']===''){return _0x2c2a72(_0x2cf9f4[_0xb22f('0x14')](0x1f4,_0xb22f('0x34')));}if(_[_0xb22f('0x32')](_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x35')])){return _0x2c2a72(_0x2cf9f4[_0xb22f('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x186a66));}if(!_[_0xb22f('0x36')](_0x186a66,_0x52a3c7['body'][_0xb22f('0x35')])){return _0x2c2a72(_0x2cf9f4[_0xb22f('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x186a66));}var _0x2d78c1={};_0x2d78c1[_0x52a3c7[_0xb22f('0x29')]['mapKey']]=_0x52a3c7['body'][_0xb22f('0x37')];return db['MailAccount'][_0xb22f('0x26')]({'where':{'id':_0x52a3c7[_0xb22f('0x38')]['id']},'include':[{'model':db[_0xb22f('0x39')],'as':_0xb22f('0x3a'),'include':[{'model':db['CmContact'],'as':_0xb22f('0x3b'),'where':_0x2d78c1,'limit':0x1,'order':[[_0xb22f('0x30'),'DESC']]}]},{'model':db[_0xb22f('0x3c')],'as':_0xb22f('0x3d')},{'model':db[_0xb22f('0x3e')],'as':_0xb22f('0x3f')}]})[_0xb22f('0x27')](function(_0x589e82){if(_0x589e82&&_0x589e82[_0xb22f('0x3a')]){var _0x53ab34=_0x589e82['get']({'plain':!![]});_0x5e2faa[_0xb22f('0x38')]=_[_0xb22f('0x40')](_0x53ab34,[_0xb22f('0x3d'),_0xb22f('0x3a')]);_0x5e2faa[_0xb22f('0x41')]=_0x53ab34['Applications'];_0x5e2faa[_0xb22f('0x42')]=_0x53ab34['List'];_0x5e2faa[_0xb22f('0x41')]=_['orderBy'](_0x5e2faa[_0xb22f('0x41')],[_0xb22f('0x43')],[_0xb22f('0x44')]);if(_0x5e2faa['account']&&_0x5e2faa[_0xb22f('0x38')][_0xb22f('0x45')]){_0x5e2faa['applications'][_0xb22f('0x46')]({'id':0x0,'priority':_0x5e2faa[_0xb22f('0x41')]['length']+0x1,'app':'close','appdata':_0xb22f('0x45'),'interval':_0xb22f('0x47')});}if(_0x5e2faa['account'][_0xb22f('0x3d')]){delete _0x5e2faa[_0xb22f('0x38')]['Applications'];}if(_0x5e2faa['account'][_0xb22f('0x3a')]){delete _0x5e2faa[_0xb22f('0x38')]['List'];}if(_0x53ab34[_0xb22f('0x3a')][_0xb22f('0x3b')][_0xb22f('0x48')]){return _0x53ab34[_0xb22f('0x3a')]['Contacts'][0x0];}var _0x30039a=_[_0xb22f('0xb')](_0x52a3c7['body'],{'firstName':_0x52a3c7['body'][_0xb22f('0x37')],'ListId':_0x53ab34[_0xb22f('0x49')]});_0x30039a[_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x35')]]=_0x52a3c7['body'][_0xb22f('0x37')];return db[_0xb22f('0x2d')]['create'](_0x30039a);}else{throw new Error(_0xb22f('0x4a'));}})[_0xb22f('0x27')](function(_0xb5c779){_0x5e2faa[_0xb22f('0x4b')]=_0xb5c779;if(_0xb5c779){if(!_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4c')]){_0x52a3c7['body'][_0xb22f('0x16')][_0xb22f('0x4c')]=rs[_0xb22f('0x4d')]()+'\x20'+_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['from'];}var _0x49a6a2={'ContactId':_0xb5c779['id'],'MailAccountId':_0x52a3c7[_0xb22f('0x38')]['id'],'inReplyTo':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['messageId'],'to':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x37')],'cc':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['cc'],'subject':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4e')],'attach':_0x52a3c7['body']['message'][_0xb22f('0x4f')],'lastMsgAt':moment()[_0xb22f('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x52a3c7['body'][_0xb22f('0x29')]};return db[_0xb22f('0x51')]['find']({'where':{'closed':![],'MailAccountId':_0x52a3c7['account']['id']},'include':[{'model':db[_0xb22f('0x52')],'as':'Messages','attributes':[_0xb22f('0x4c')],'where':{'messageId':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['inReplyTo']}}]})['then'](function(_0x14db56){if(_0x14db56){return[_0x14db56,![]];}return db['MailInteraction'][_0xb22f('0x53')](_0x49a6a2)[_0xb22f('0x27')](function(_0x31485a){return[_0x31485a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2988a2,_0x58e5e6){if(_0x2988a2){_0x37817a=_0x58e5e6;if(!_0x58e5e6){return _0x2988a2[_0xb22f('0x54')]({'inReplyTo':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['messageId'],'to':_0x52a3c7[_0xb22f('0x29')]['message'][_0xb22f('0x37')],'cc':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['cc'],'subject':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4e')],'attach':_0x2988a2[_0xb22f('0x4f')]?_0x2988a2[_0xb22f('0x4f')]:_0x52a3c7[_0xb22f('0x29')]['message'][_0xb22f('0x4f')],'substatus':null,'substatusAt':moment()[_0xb22f('0x50')](_0xb22f('0x55')),'lastMsgAt':moment()['format'](_0xb22f('0x55')),'lastMsgDirection':'in','lastMsgBody':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x29')]});}else{return _0x2988a2;}}})[_0xb22f('0x27')](function(_0x492280){_0x5e2faa['interaction']=_0x492280[_0xb22f('0x56')]({'plain':!![]});_0x5e2faa['interaction'][_0xb22f('0x57')]=_0x37817a;return db[_0xb22f('0x52')][_0xb22f('0x53')]({'body':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x29')],'MailAccountId':_0x52a3c7[_0xb22f('0x38')]['id'],'MailInteractionId':_0x492280['id'],'direction':'in','ContactId':_0x5e2faa[_0xb22f('0x4b')]['id'],'messageId':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4c')],'from':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x37')],'to':_0x52a3c7['body'][_0xb22f('0x16')]['to'],'cc':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['cc'],'subject':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4e')],'attach':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x4f')],'Attachments':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')][_0xb22f('0x58')],'originTo':_0x52a3c7['body']['message']['originTo'],'originCc':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['originCc'],'bcc':_0x52a3c7[_0xb22f('0x29')][_0xb22f('0x16')]['bcc']},{'include':[{'model':db[_0xb22f('0x59')],'as':_0xb22f('0x5a')}]});})[_0xb22f('0x27')](function(_0x1e7f7a){_0x5e2faa[_0xb22f('0x16')]=_0x1e7f7a;if(_0x5e2faa['interaction']['UserId']){return db['User'][_0xb22f('0x26')]({'attributes':['id',_0xb22f('0x5b')],'where':{'id':_0x5e2faa[_0xb22f('0x5c')]['UserId']}})[_0xb22f('0x27')](function(_0x17a2d3){if(_0x17a2d3){_0x5e2faa['applications'][_0xb22f('0x5d')]({'id':0x0,'priority':0x0,'app':_0xb22f('0x5e'),'appdata':_0x17a2d3[_0xb22f('0x5b')]+','+(_0x5e2faa[_0xb22f('0x38')][_0xb22f('0x5f')]||0xa),'interval':_0xb22f('0x47')});}return respondWithRpcPromise(_0xb22f('0x60'),_0xb22f('0x61'),_0x5e2faa);});}return respondWithRpcPromise(_0xb22f('0x60'),_0xb22f('0x61'),_0x5e2faa);})['then'](function(_0x47055d){_0x2d265c(_0x47055d);})[_0xb22f('0x19')](function(_0x20df33){_0x2c2a72(_0x2cf9f4[_0xb22f('0x14')](0x1f4,_0x20df33[_0xb22f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index c2df503..ef0bbde 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 _0xaa3f=['register','length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x3464a7,_0x2a8a6b){var _0x275d1f=function(_0x547dae){while(--_0x547dae){_0x3464a7['push'](_0x3464a7['shift']());}};_0x275d1f(++_0x2a8a6b);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x4f7418,_0x423267){_0x4f7418=_0x4f7418-0x0;var _0x392e0b=_0xaa3f[_0x4f7418];return _0x392e0b;};'use strict';var MailAccountEvents=require(_0xfaa3('0x0'));var events=[_0xfaa3('0x1'),_0xfaa3('0x2'),_0xfaa3('0x3')];function createListener(_0x1ebbfb,_0x1da39b){return function(_0x408343){_0x1da39b[_0xfaa3('0x4')](_0x1ebbfb,_0x408343);};}function removeListener(_0x32f4e1,_0x5123a3){return function(){MailAccountEvents['removeListener'](_0x32f4e1,_0x5123a3);};}exports[_0xfaa3('0x5')]=function(_0x4bac92){for(var _0x3d09aa=0x0,_0xeecce5=events[_0xfaa3('0x6')];_0x3d09aa<_0xeecce5;_0x3d09aa++){var _0xbf270c=events[_0x3d09aa];var _0x328d5f=createListener(_0xfaa3('0x7')+_0xbf270c,_0x4bac92);MailAccountEvents['on'](_0xbf270c,_0x328d5f);}}; \ No newline at end of file +var _0x4677=['update','emit','removeListener','register','mailAccount:','./mailAccount.events','remove'];(function(_0x21cf80,_0x1fb0a1){var _0x5c6bed=function(_0x3492c3){while(--_0x3492c3){_0x21cf80['push'](_0x21cf80['shift']());}};_0x5c6bed(++_0x1fb0a1);}(_0x4677,0x155));var _0x7467=function(_0x109a29,_0x531d56){_0x109a29=_0x109a29-0x0;var _0x33364c=_0x4677[_0x109a29];return _0x33364c;};'use strict';var MailAccountEvents=require(_0x7467('0x0'));var events=['save',_0x7467('0x1'),_0x7467('0x2')];function createListener(_0x37705b,_0x5075bc){return function(_0x39e4c7){_0x5075bc[_0x7467('0x3')](_0x37705b,_0x39e4c7);};}function removeListener(_0x22a57e,_0xe227ce){return function(){MailAccountEvents[_0x7467('0x4')](_0x22a57e,_0xe227ce);};}exports[_0x7467('0x5')]=function(_0x36fc81){for(var _0x40a9c6=0x0,_0x198e6a=events['length'];_0x40a9c6<_0x198e6a;_0x40a9c6++){var _0x588489=events[_0x40a9c6];var _0x418ff9=createListener(_0x7467('0x6')+_0x588489,_0x36fc81);MailAccountEvents['on'](_0x588489,_0x418ff9);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index fa63c2e..3357b5b 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 _0x69d3=['express','Router','../../config/environment','/:id','isAuthenticated','show','put','update','delete','exports','multer','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x69d3,0xda));var _0x369d=function(_0x53a2ea,_0x25e22d){_0x53a2ea=_0x53a2ea-0x0;var _0x488038=_0x69d3[_0x53a2ea];return _0x488038;};'use strict';var multer=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var path=require(_0x369d('0x2'));var timeout=require('connect-timeout');var express=require(_0x369d('0x3'));var router=express[_0x369d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x369d('0x5'));var controller=require('./mailApplication.controller');router['get'](_0x369d('0x6'),auth[_0x369d('0x7')](),controller[_0x369d('0x8')]);router[_0x369d('0x9')](_0x369d('0x6'),auth[_0x369d('0x7')](),controller[_0x369d('0xa')]);router[_0x369d('0xb')](_0x369d('0x6'),auth['isAuthenticated'](),controller['destroy']);module[_0x369d('0xc')]=router; \ No newline at end of file +var _0xb7e7=['delete','isAuthenticated','destroy','exports','multer','path','express','../../components/auth/service','../../config/environment','./mailApplication.controller','get','show','put','/:id','update'];(function(_0x290201,_0x279632){var _0x3d5c08=function(_0x3d0f41){while(--_0x3d0f41){_0x290201['push'](_0x290201['shift']());}};_0x3d5c08(++_0x279632);}(_0xb7e7,0x121));var _0x7b7e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb7e7[_0x31e29a];return _0x32d892;};'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')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);module[_0x7b7e('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 72d13b1..0355e4f 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 _0xd755=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x502691,_0x21d839){var _0x2a5d07=function(_0x1f9775){while(--_0x1f9775){_0x502691['push'](_0x502691['shift']());}};_0x2a5d07(++_0x21d839);}(_0xd755,0x1e9));var _0x5d75=function(_0x529870,_0x975245){_0x529870=_0x529870-0x0;var _0x39435f=_0xd755[_0x529870];return _0x39435f;};'use strict';var Sequelize=require(_0x5d75('0x0'));module[_0x5d75('0x1')]={'priority':{'type':Sequelize[_0x5d75('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5d75('0x3')],'allowNull':![],'defaultValue':_0x5d75('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5d75('0x3')]},'interval':{'type':Sequelize[_0x5d75('0x3')],'defaultValue':_0x5d75('0x5')}}; \ No newline at end of file +var _0x8847=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x938b6a,_0x318dc1){var _0x376cfa=function(_0xaa4293){while(--_0xaa4293){_0x938b6a['push'](_0x938b6a['shift']());}};_0x376cfa(++_0x318dc1);}(_0x8847,0x1a9));var _0x7884=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x8847[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x7884('0x0'));module[_0x7884('0x1')]={'priority':{'type':Sequelize[_0x7884('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7884('0x3')],'allowNull':![],'defaultValue':_0x7884('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7884('0x3')]},'interval':{'type':Sequelize[_0x7884('0x3')],'defaultValue':_0x7884('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 0c145c0..fcd1c3b 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 _0x38d3=['ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','set','Content-Range','reject','save','update','then','destroy','status','end','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x7bd372,_0x3ca8e9){var _0x3df313=function(_0x44d6c0){while(--_0x44d6c0){_0x7bd372['push'](_0x7bd372['shift']());}};_0x3df313(++_0x3ca8e9);}(_0x38d3,0x1a7));var _0x338d=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x38d3[_0x4c7fb5];return _0x2e10ac;};'use strict';var pdf=require(_0x338d('0x0'));var emlformat=require(_0x338d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x338d('0x2'));var jsonpatch=require(_0x338d('0x3'));var rp=require(_0x338d('0x4'));var moment=require(_0x338d('0x5'));var BPromise=require(_0x338d('0x6'));var Mustache=require(_0x338d('0x7'));var util=require(_0x338d('0x8'));var path=require(_0x338d('0x9'));var sox=require(_0x338d('0xa'));var csv=require('to-csv');var ejs=require(_0x338d('0xb'));var fs=require('fs');var _=require(_0x338d('0xc'));var squel=require(_0x338d('0xd'));var crypto=require(_0x338d('0xe'));var jsforce=require(_0x338d('0xf'));var deskjs=require(_0x338d('0x10'));var toCsv=require(_0x338d('0x11'));var querystring=require('querystring');var Papa=require(_0x338d('0x12'));var Redis=require(_0x338d('0x13'));var authService=require(_0x338d('0x14'));var qs=require(_0x338d('0x15'));var as=require(_0x338d('0x16'));var hardwareService=require(_0x338d('0x17'));var logger=require('../../config/logger')(_0x338d('0x18'));var utils=require(_0x338d('0x19'));var config=require(_0x338d('0x1a'));var db=require(_0x338d('0x1b'))['db'];function respondWithStatusCode(_0x20a2f3,_0x6f23c2){_0x6f23c2=_0x6f23c2||0xcc;return function(_0x3a4b99){if(_0x3a4b99){return _0x20a2f3[_0x338d('0x1c')](_0x6f23c2);}return _0x20a2f3['status'](_0x6f23c2)['end']();};}function respondWithResult(_0x4c9397,_0x1259d4){_0x1259d4=_0x1259d4||0xc8;return function(_0x1e9895){if(_0x1e9895){return _0x4c9397['status'](_0x1259d4)[_0x338d('0x1d')](_0x1e9895);}};}function respondWithFilteredResult(_0x5d42a6,_0x33b0d7){return function(_0x36b054){if(_0x36b054){var _0x366514=_0x36b054[_0x338d('0x1e')],_0x4c5e67=_0x33b0d7['offset'],_0x4d79c6=_0x33b0d7[_0x338d('0x1f')]+_0x33b0d7['limit'],_0x4c90f5;if(_0x4d79c6>=_0x366514){_0x4d79c6=_0x366514;_0x4c90f5=0xc8;}else{_0x4c90f5=0xce;}_0x5d42a6['status'](_0x4c90f5);return _0x5d42a6[_0x338d('0x20')](_0x338d('0x21'),_0x4c5e67+'-'+_0x4d79c6+'/'+_0x366514)[_0x338d('0x1d')](_0x36b054);}return null;};}function patchUpdates(_0x2c1e24){return function(_0x1ca2a0){try{jsonpatch['apply'](_0x1ca2a0,_0x2c1e24,!![]);}catch(_0x34198e){return BPromise[_0x338d('0x22')](_0x34198e);}return _0x1ca2a0[_0x338d('0x23')]();};}function saveUpdates(_0x51d50f,_0x4213b0){return function(_0x4547d1){if(_0x4547d1){return _0x4547d1[_0x338d('0x24')](_0x51d50f)[_0x338d('0x25')](function(_0x37f7bf){return _0x37f7bf;});}return null;};}function removeEntity(_0xf54afd,_0xbd099e){return function(_0x3ff406){if(_0x3ff406){return _0x3ff406[_0x338d('0x26')]()[_0x338d('0x25')](function(){_0xf54afd[_0x338d('0x27')](0xcc)[_0x338d('0x28')]();});}};}function handleEntityNotFound(_0x4e859f,_0xef4cf7){return function(_0x2a2877){if(!_0x2a2877){_0x4e859f[_0x338d('0x1c')](0x194);}return _0x2a2877;};}function handleError(_0x5dddeb,_0x583c1d){_0x583c1d=_0x583c1d||0x1f4;return function(_0x5e67d7){logger['error'](_0x5e67d7[_0x338d('0x29')]);if(_0x5e67d7[_0x338d('0x2a')]){delete _0x5e67d7[_0x338d('0x2a')];}_0x5dddeb[_0x338d('0x27')](_0x583c1d)[_0x338d('0x2b')](_0x5e67d7);};}exports[_0x338d('0x2c')]=function(_0x2e3240,_0x2e50ec){var _0x3b8fd6={'raw':!![],'where':{'id':_0x2e3240['params']['id']}},_0x2696ed={};_0x2696ed[_0x338d('0x2d')]=_[_0x338d('0x2e')](db[_0x338d('0x2f')]['rawAttributes']);_0x2696ed[_0x338d('0x30')]=_[_0x338d('0x2e')](_0x2e3240['query']);_0x2696ed[_0x338d('0x31')]=_['intersection'](_0x2696ed[_0x338d('0x2d')],_0x2696ed[_0x338d('0x30')]);_0x3b8fd6[_0x338d('0x32')]=_[_0x338d('0x33')](_0x2696ed[_0x338d('0x2d')],qs[_0x338d('0x34')](_0x2e3240['query'][_0x338d('0x34')]));_0x3b8fd6[_0x338d('0x32')]=_0x3b8fd6['attributes'][_0x338d('0x35')]?_0x3b8fd6[_0x338d('0x32')]:_0x2696ed[_0x338d('0x2d')];if(_0x2e3240[_0x338d('0x30')][_0x338d('0x36')]){_0x3b8fd6[_0x338d('0x37')]=[{'all':!![]}];}_0x3b8fd6=_[_0x338d('0x38')]({},_0x3b8fd6,_0x2e3240[_0x338d('0x39')]);return db[_0x338d('0x2f')][_0x338d('0x3a')](_0x3b8fd6)[_0x338d('0x25')](handleEntityNotFound(_0x2e50ec,null))[_0x338d('0x25')](respondWithResult(_0x2e50ec,null))[_0x338d('0x3b')](handleError(_0x2e50ec,null));};exports['update']=function(_0x595557,_0xcfb62){if(_0x595557[_0x338d('0x3c')]['id']){delete _0x595557[_0x338d('0x3c')]['id'];}return db[_0x338d('0x2f')][_0x338d('0x3a')]({'where':{'id':_0x595557['params']['id']}})['then'](handleEntityNotFound(_0xcfb62,null))[_0x338d('0x25')](saveUpdates(_0x595557['body'],null))[_0x338d('0x25')](respondWithResult(_0xcfb62,null))[_0x338d('0x3b')](handleError(_0xcfb62,null));};exports[_0x338d('0x26')]=function(_0x3b004f,_0x22a5a9){return db[_0x338d('0x2f')][_0x338d('0x3a')]({'where':{'id':_0x3b004f[_0x338d('0x3d')]['id']}})[_0x338d('0x25')](handleEntityNotFound(_0x22a5a9,null))[_0x338d('0x25')](removeEntity(_0x22a5a9,null))[_0x338d('0x3b')](handleError(_0x22a5a9,null));}; \ No newline at end of file +var _0xbf0e=['send','params','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','model','fields','length','include','options','find','catch','update','body','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x4ed2c1,_0x8c9475){var _0x397295=function(_0x120012){while(--_0x120012){_0x4ed2c1['push'](_0x4ed2c1['shift']());}};_0x397295(++_0x8c9475);}(_0xbf0e,0x16e));var _0xebf0=function(_0x9331c2,_0x18050b){_0x9331c2=_0x9331c2-0x0;var _0x24ca58=_0xbf0e[_0x9331c2];return _0x24ca58;};'use strict';var pdf=require(_0xebf0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xebf0('0x1'));var zipdir=require(_0xebf0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebf0('0x3'));var moment=require(_0xebf0('0x4'));var BPromise=require(_0xebf0('0x5'));var Mustache=require(_0xebf0('0x6'));var util=require(_0xebf0('0x7'));var path=require(_0xebf0('0x8'));var sox=require('sox');var csv=require(_0xebf0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xebf0('0xa'));var crypto=require(_0xebf0('0xb'));var jsforce=require(_0xebf0('0xc'));var deskjs=require(_0xebf0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xebf0('0xe'));var Papa=require(_0xebf0('0xf'));var Redis=require(_0xebf0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xebf0('0x11'));var as=require(_0xebf0('0x12'));var hardwareService=require(_0xebf0('0x13'));var logger=require(_0xebf0('0x14'))(_0xebf0('0x15'));var utils=require(_0xebf0('0x16'));var config=require('../../config/environment');var db=require(_0xebf0('0x17'))['db'];function respondWithStatusCode(_0x584535,_0x183073){_0x183073=_0x183073||0xcc;return function(_0x5d4d92){if(_0x5d4d92){return _0x584535[_0xebf0('0x18')](_0x183073);}return _0x584535[_0xebf0('0x19')](_0x183073)[_0xebf0('0x1a')]();};}function respondWithResult(_0x791427,_0x26c10b){_0x26c10b=_0x26c10b||0xc8;return function(_0x1323d5){if(_0x1323d5){return _0x791427['status'](_0x26c10b)[_0xebf0('0x1b')](_0x1323d5);}};}function respondWithFilteredResult(_0x180ce2,_0xb2be3a){return function(_0x45b785){if(_0x45b785){var _0x19d772=_0x45b785['count'],_0x36387e=_0xb2be3a[_0xebf0('0x1c')],_0x2a4ee7=_0xb2be3a['offset']+_0xb2be3a[_0xebf0('0x1d')],_0x22a605;if(_0x2a4ee7>=_0x19d772){_0x2a4ee7=_0x19d772;_0x22a605=0xc8;}else{_0x22a605=0xce;}_0x180ce2[_0xebf0('0x19')](_0x22a605);return _0x180ce2[_0xebf0('0x1e')](_0xebf0('0x1f'),_0x36387e+'-'+_0x2a4ee7+'/'+_0x19d772)[_0xebf0('0x1b')](_0x45b785);}return null;};}function patchUpdates(_0x5dec11){return function(_0x49246b){try{jsonpatch[_0xebf0('0x20')](_0x49246b,_0x5dec11,!![]);}catch(_0x759ac5){return BPromise[_0xebf0('0x21')](_0x759ac5);}return _0x49246b[_0xebf0('0x22')]();};}function saveUpdates(_0x2e80e6,_0x3d3eba){return function(_0x239373){if(_0x239373){return _0x239373['update'](_0x2e80e6)[_0xebf0('0x23')](function(_0x5bd171){return _0x5bd171;});}return null;};}function removeEntity(_0x301898,_0x5da27f){return function(_0x317e9c){if(_0x317e9c){return _0x317e9c[_0xebf0('0x24')]()[_0xebf0('0x23')](function(){_0x301898['status'](0xcc)[_0xebf0('0x1a')]();});}};}function handleEntityNotFound(_0x4bafca,_0x35aeeb){return function(_0xf59924){if(!_0xf59924){_0x4bafca[_0xebf0('0x18')](0x194);}return _0xf59924;};}function handleError(_0x2e8e8d,_0x49425f){_0x49425f=_0x49425f||0x1f4;return function(_0x309149){logger[_0xebf0('0x25')](_0x309149[_0xebf0('0x26')]);if(_0x309149[_0xebf0('0x27')]){delete _0x309149[_0xebf0('0x27')];}_0x2e8e8d['status'](_0x49425f)[_0xebf0('0x28')](_0x309149);};}exports['show']=function(_0x40b575,_0x3feb18){var _0x411f41={'raw':!![],'where':{'id':_0x40b575[_0xebf0('0x29')]['id']}},_0x408462={};_0x408462['model']=_[_0xebf0('0x2a')](db[_0xebf0('0x2b')][_0xebf0('0x2c')]);_0x408462[_0xebf0('0x2d')]=_['keys'](_0x40b575[_0xebf0('0x2d')]);_0x408462[_0xebf0('0x2e')]=_[_0xebf0('0x2f')](_0x408462['model'],_0x408462[_0xebf0('0x2d')]);_0x411f41[_0xebf0('0x30')]=_[_0xebf0('0x2f')](_0x408462[_0xebf0('0x31')],qs[_0xebf0('0x32')](_0x40b575[_0xebf0('0x2d')]['fields']));_0x411f41[_0xebf0('0x30')]=_0x411f41[_0xebf0('0x30')][_0xebf0('0x33')]?_0x411f41['attributes']:_0x408462[_0xebf0('0x31')];if(_0x40b575['query']['includeAll']){_0x411f41[_0xebf0('0x34')]=[{'all':!![]}];}_0x411f41=_['merge']({},_0x411f41,_0x40b575[_0xebf0('0x35')]);return db['MailApplication'][_0xebf0('0x36')](_0x411f41)[_0xebf0('0x23')](handleEntityNotFound(_0x3feb18,null))[_0xebf0('0x23')](respondWithResult(_0x3feb18,null))[_0xebf0('0x37')](handleError(_0x3feb18,null));};exports[_0xebf0('0x38')]=function(_0x356436,_0x129192){if(_0x356436[_0xebf0('0x39')]['id']){delete _0x356436[_0xebf0('0x39')]['id'];}return db[_0xebf0('0x2b')]['find']({'where':{'id':_0x356436[_0xebf0('0x29')]['id']}})[_0xebf0('0x23')](handleEntityNotFound(_0x129192,null))['then'](saveUpdates(_0x356436[_0xebf0('0x39')],null))[_0xebf0('0x23')](respondWithResult(_0x129192,null))['catch'](handleError(_0x129192,null));};exports[_0xebf0('0x24')]=function(_0x5dc08f,_0x2b1e5b){return db[_0xebf0('0x2b')][_0xebf0('0x36')]({'where':{'id':_0x5dc08f[_0xebf0('0x29')]['id']}})[_0xebf0('0x23')](handleEntityNotFound(_0x2b1e5b,null))[_0xebf0('0x23')](removeEntity(_0x2b1e5b,null))[_0xebf0('0x37')](handleError(_0x2b1e5b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 7d289dc..8d6af18 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 _0xb799=['./mailApplication.attributes','exports','define','MailApplication','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5a8f95,_0x214d9f){var _0x2eedf9=function(_0x147a80){while(--_0x147a80){_0x5a8f95['push'](_0x5a8f95['shift']());}};_0x2eedf9(++_0x214d9f);}(_0xb799,0x18d));var _0x9b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb799[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9b79('0x0'));var util=require(_0x9b79('0x1'));var logger=require(_0x9b79('0x2'))('api');var moment=require(_0x9b79('0x3'));var BPromise=require(_0x9b79('0x4'));var rp=require(_0x9b79('0x5'));var fs=require('fs');var path=require(_0x9b79('0x6'));var rimraf=require(_0x9b79('0x7'));var config=require(_0x9b79('0x8'));var attributes=require(_0x9b79('0x9'));module[_0x9b79('0xa')]=function(_0x48fb0c,_0x35b5c2){return _0x48fb0c[_0x9b79('0xb')](_0x9b79('0xc'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9b79('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1000=['bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','../../config/logger','api','moment'];(function(_0x41476a,_0x559206){var _0x5983d3=function(_0xc24cf0){while(--_0xc24cf0){_0x41476a['push'](_0x41476a['shift']());}};_0x5983d3(++_0x559206);}(_0x1000,0x75));var _0x0100=function(_0x5bd0f9,_0x44b013){_0x5bd0f9=_0x5bd0f9-0x0;var _0x458916=_0x1000[_0x5bd0f9];return _0x458916;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0100('0x0'))(_0x0100('0x1'));var moment=require(_0x0100('0x2'));var BPromise=require(_0x0100('0x3'));var rp=require(_0x0100('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0100('0x5'));var config=require(_0x0100('0x6'));var attributes=require(_0x0100('0x7'));module[_0x0100('0x8')]=function(_0x4f55dd,_0x306714){return _0x4f55dd['define'](_0x0100('0x9'),attributes,{'tableName':_0x0100('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0100('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 70c9ae7..a598811 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 _0xf8da=['error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0xf6e75d,_0xc70967){var _0x27514d=function(_0xc2c6dd){while(--_0xc2c6dd){_0xf6e75d['push'](_0xf6e75d['shift']());}};_0x27514d(++_0xc70967);}(_0xf8da,0x123));var _0xaf8d=function(_0xf6d992,_0x376473){_0xf6d992=_0xf6d992-0x0;var _0x5605b9=_0xf8da[_0xf6d992];return _0x5605b9;};'use strict';var _=require(_0xaf8d('0x0'));var util=require(_0xaf8d('0x1'));var moment=require(_0xaf8d('0x2'));var BPromise=require(_0xaf8d('0x3'));var rs=require(_0xaf8d('0x4'));var fs=require('fs');var Redis=require(_0xaf8d('0x5'));var db=require(_0xaf8d('0x6'))['db'];var utils=require(_0xaf8d('0x7'));var logger=require(_0xaf8d('0x8'))('rpc');var config=require(_0xaf8d('0x9'));var jayson=require(_0xaf8d('0xa'));var client=jayson[_0xaf8d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdee126,_0x487c3d,_0x4b28a2){return new BPromise(function(_0x1ae9fc,_0x5db01a){return client[_0xaf8d('0xc')](_0xdee126,_0x4b28a2)[_0xaf8d('0xd')](function(_0x5bc497){logger[_0xaf8d('0xe')](_0xaf8d('0xf'),_0x487c3d,_0xaf8d('0x10'));logger[_0xaf8d('0x11')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x487c3d,_0xaf8d('0x10'),JSON[_0xaf8d('0x12')](_0x5bc497));if(_0x5bc497[_0xaf8d('0x13')]){if(_0x5bc497[_0xaf8d('0x13')][_0xaf8d('0x14')]===0x1f4){logger[_0xaf8d('0x13')]('MailApplication,\x20%s,\x20%s',_0x487c3d,_0x5bc497[_0xaf8d('0x13')][_0xaf8d('0x15')]);return _0x5db01a(_0x5bc497['error'][_0xaf8d('0x15')]);}logger[_0xaf8d('0x13')]('MailApplication,\x20%s,\x20%s',_0x487c3d,_0x5bc497['error'][_0xaf8d('0x15')]);return _0x1ae9fc(_0x5bc497['error'][_0xaf8d('0x15')]);}else{logger[_0xaf8d('0xe')](_0xaf8d('0xf'),_0x487c3d,_0xaf8d('0x10'));_0x1ae9fc(_0x5bc497[_0xaf8d('0x16')][_0xaf8d('0x15')]);}})[_0xaf8d('0x17')](function(_0x300060){logger[_0xaf8d('0x13')](_0xaf8d('0xf'),_0x487c3d,_0x300060);_0x5db01a(_0x300060);});});}exports[_0xaf8d('0x18')]=function(_0xdf0af7){var _0x2f22b=this;return new Promise(function(_0x2db9cd,_0x42d889){return db['MailApplication'][_0xaf8d('0x19')](_0xdf0af7[_0xaf8d('0x1a')],{'raw':_0xdf0af7[_0xaf8d('0x1b')]?_0xdf0af7['options'][_0xaf8d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdf0af7[_0xaf8d('0x1b')]?_0xdf0af7[_0xaf8d('0x1b')][_0xaf8d('0x1d')]||null:null,'attributes':_0xdf0af7['options']?_0xdf0af7[_0xaf8d('0x1b')]['attributes']||null:null,'limit':_0xdf0af7[_0xaf8d('0x1b')]?_0xdf0af7[_0xaf8d('0x1b')][_0xaf8d('0x1e')]||null:null})[_0xaf8d('0xd')](function(_0x227c1a){logger[_0xaf8d('0xe')](_0xaf8d('0x18'),_0xdf0af7);logger[_0xaf8d('0x11')]('UpdateMailApplication',_0xdf0af7,JSON[_0xaf8d('0x12')](_0x227c1a));_0x2db9cd(_0x227c1a);})[_0xaf8d('0x17')](function(_0x8441d4){logger[_0xaf8d('0x13')]('UpdateMailApplication',_0x8441d4[_0xaf8d('0x15')],_0xdf0af7);_0x42d889(_0x2f22b[_0xaf8d('0x13')](0x1f4,_0x8441d4[_0xaf8d('0x15')]));});});}; \ No newline at end of file +var _0xf1a7=['request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x412e27,_0x3150ac){var _0xcb2aa2=function(_0x99e199){while(--_0x99e199){_0x412e27['push'](_0x412e27['shift']());}};_0xcb2aa2(++_0x3150ac);}(_0xf1a7,0x9e));var _0x7f1a=function(_0x3e985d,_0x51fc46){_0x3e985d=_0x3e985d-0x0;var _0x5c4b8b=_0xf1a7[_0x3e985d];return _0x5c4b8b;};'use strict';var _=require(_0x7f1a('0x0'));var util=require('util');var moment=require(_0x7f1a('0x1'));var BPromise=require('bluebird');var rs=require(_0x7f1a('0x2'));var fs=require('fs');var Redis=require(_0x7f1a('0x3'));var db=require(_0x7f1a('0x4'))['db'];var utils=require(_0x7f1a('0x5'));var logger=require(_0x7f1a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7f1a('0x7'));var client=jayson[_0x7f1a('0x8')][_0x7f1a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d79d5,_0x3907f2,_0x503c1a){return new BPromise(function(_0x410f6d,_0x3741cf){return client[_0x7f1a('0xa')](_0x5d79d5,_0x503c1a)[_0x7f1a('0xb')](function(_0x2a4d9f){logger[_0x7f1a('0xc')](_0x7f1a('0xd'),_0x3907f2,_0x7f1a('0xe'));logger[_0x7f1a('0xf')](_0x7f1a('0x10'),_0x3907f2,_0x7f1a('0xe'),JSON[_0x7f1a('0x11')](_0x2a4d9f));if(_0x2a4d9f[_0x7f1a('0x12')]){if(_0x2a4d9f[_0x7f1a('0x12')]['code']===0x1f4){logger['error'](_0x7f1a('0xd'),_0x3907f2,_0x2a4d9f[_0x7f1a('0x12')][_0x7f1a('0x13')]);return _0x3741cf(_0x2a4d9f[_0x7f1a('0x12')][_0x7f1a('0x13')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x3907f2,_0x2a4d9f['error'][_0x7f1a('0x13')]);return _0x410f6d(_0x2a4d9f[_0x7f1a('0x12')][_0x7f1a('0x13')]);}else{logger[_0x7f1a('0xc')](_0x7f1a('0xd'),_0x3907f2,_0x7f1a('0xe'));_0x410f6d(_0x2a4d9f[_0x7f1a('0x14')][_0x7f1a('0x13')]);}})[_0x7f1a('0x15')](function(_0x36f719){logger[_0x7f1a('0x12')](_0x7f1a('0xd'),_0x3907f2,_0x36f719);_0x3741cf(_0x36f719);});});}exports[_0x7f1a('0x16')]=function(_0x3e0a73){var _0x89907d=this;return new Promise(function(_0x6a98e7,_0x44688b){return db[_0x7f1a('0x17')]['update'](_0x3e0a73[_0x7f1a('0x18')],{'raw':_0x3e0a73[_0x7f1a('0x19')]?_0x3e0a73['options'][_0x7f1a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0a73['options']?_0x3e0a73['options']['where']||null:null,'attributes':_0x3e0a73['options']?_0x3e0a73[_0x7f1a('0x19')][_0x7f1a('0x1b')]||null:null,'limit':_0x3e0a73[_0x7f1a('0x19')]?_0x3e0a73['options']['limit']||null:null})[_0x7f1a('0xb')](function(_0x460c53){logger[_0x7f1a('0xc')](_0x7f1a('0x16'),_0x3e0a73);logger['debug'](_0x7f1a('0x16'),_0x3e0a73,JSON[_0x7f1a('0x11')](_0x460c53));_0x6a98e7(_0x460c53);})[_0x7f1a('0x15')](function(_0x238a0c){logger[_0x7f1a('0x12')](_0x7f1a('0x16'),_0x238a0c[_0x7f1a('0x13')],_0x3e0a73);_0x44688b(_0x89907d[_0x7f1a('0x12')](0x1f4,_0x238a0c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 2a651e3..04e070d 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 _0x7c09=['removeTags','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','addTags','tracked','mailinteraction:update','update','mailinteraction:destroy','destroy','delete'];(function(_0x184ed,_0x542f8a){var _0x4746f2=function(_0x70dc01){while(--_0x70dc01){_0x184ed['push'](_0x184ed['shift']());}};_0x4746f2(++_0x542f8a);}(_0x7c09,0x102));var _0x97c0=function(_0x36ecbc,_0x15fee1){_0x36ecbc=_0x36ecbc-0x0;var _0x1c54a4=_0x7c09[_0x36ecbc];return _0x1c54a4;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var auth=require(_0x97c0('0x4'));var interaction=require(_0x97c0('0x5'));var config=require(_0x97c0('0x6'));var controller=require(_0x97c0('0x7'));router[_0x97c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x97c0('0x9'),auth[_0x97c0('0xa')](),controller[_0x97c0('0xb')]);router[_0x97c0('0x8')](_0x97c0('0xc'),auth['isAuthenticated'](),controller[_0x97c0('0xd')]);router['get'](_0x97c0('0xe'),auth[_0x97c0('0xa')](),controller['getMessages']);router['get'](_0x97c0('0xf'),auth[_0x97c0('0xa')](),controller[_0x97c0('0x10')]);router[_0x97c0('0x11')]('/',auth[_0x97c0('0xa')](),controller[_0x97c0('0x12')]);router[_0x97c0('0x11')](_0x97c0('0xe'),auth[_0x97c0('0xa')](),controller[_0x97c0('0x13')]);router[_0x97c0('0x11')](_0x97c0('0x14'),auth[_0x97c0('0xa')](),interaction['tracked'](_0x97c0('0x15'),_0x97c0('0x16')),controller[_0x97c0('0x17')]);router['put'](_0x97c0('0xc'),auth[_0x97c0('0xa')](),interaction[_0x97c0('0x18')](_0x97c0('0x15'),_0x97c0('0x19')),controller[_0x97c0('0x1a')]);router['delete'](_0x97c0('0xc'),auth[_0x97c0('0xa')](),interaction['tracked'](_0x97c0('0x15'),_0x97c0('0x1b')),controller[_0x97c0('0x1c')]);router[_0x97c0('0x1d')](_0x97c0('0x14'),auth[_0x97c0('0xa')](),controller[_0x97c0('0x1e')]);module[_0x97c0('0x1f')]=router; \ No newline at end of file +var _0x0eea=['destroy','removeTags','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x0eea,0xdc));var _0xa0ee=function(_0x2102c3,_0x53d4b8){_0x2102c3=_0x2102c3-0x0;var _0x3758c9=_0x0eea[_0x2102c3];return _0x3758c9;};'use strict';var multer=require('multer');var util=require(_0xa0ee('0x0'));var path=require(_0xa0ee('0x1'));var timeout=require(_0xa0ee('0x2'));var express=require(_0xa0ee('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa0ee('0x4'));var config=require(_0xa0ee('0x5'));var controller=require(_0xa0ee('0x6'));router[_0xa0ee('0x7')]('/',auth[_0xa0ee('0x8')](),controller[_0xa0ee('0x9')]);router[_0xa0ee('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xa0ee('0xa')]);router['get'](_0xa0ee('0xb'),auth[_0xa0ee('0x8')](),controller['show']);router[_0xa0ee('0x7')](_0xa0ee('0xc'),auth[_0xa0ee('0x8')](),controller[_0xa0ee('0xd')]);router[_0xa0ee('0x7')](_0xa0ee('0xe'),auth[_0xa0ee('0x8')](),controller[_0xa0ee('0xf')]);router['post']('/',auth[_0xa0ee('0x8')](),controller[_0xa0ee('0x10')]);router[_0xa0ee('0x11')]('/:id/messages',auth[_0xa0ee('0x8')](),controller[_0xa0ee('0x12')]);router[_0xa0ee('0x11')](_0xa0ee('0x13'),auth[_0xa0ee('0x8')](),interaction[_0xa0ee('0x14')](_0xa0ee('0x15'),_0xa0ee('0x16')),controller[_0xa0ee('0x17')]);router[_0xa0ee('0x18')](_0xa0ee('0xb'),auth[_0xa0ee('0x8')](),interaction[_0xa0ee('0x14')]('mail','mailinteraction:update'),controller[_0xa0ee('0x19')]);router[_0xa0ee('0x1a')](_0xa0ee('0xb'),auth[_0xa0ee('0x8')](),interaction[_0xa0ee('0x14')]('mail',_0xa0ee('0x1b')),controller[_0xa0ee('0x1c')]);router['delete']('/:id/tags',auth[_0xa0ee('0x8')](),controller[_0xa0ee('0x1d')]);module[_0xa0ee('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9412eb1..0e85249 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 _0xdd70=['BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','sequelize','iconv','exports'];(function(_0x50519e,_0x37a9f7){var _0x1dccbe=function(_0x349f28){while(--_0x349f28){_0x50519e['push'](_0x50519e['shift']());}};_0x1dccbe(++_0x37a9f7);}(_0xdd70,0x13d));var _0x0dd7=function(_0x502826,_0x1482d2){_0x502826=_0x502826-0x0;var _0x4357d9=_0xdd70[_0x502826];return _0x4357d9;};'use strict';var Sequelize=require(_0x0dd7('0x0'));var iconv=require(_0x0dd7('0x1'));module[_0x0dd7('0x2')]={'closed':{'type':Sequelize[_0x0dd7('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0dd7('0x4')]},'disposition':{'type':Sequelize[_0x0dd7('0x5')]},'note':{'type':Sequelize[_0x0dd7('0x5')]},'inReplyTo':{'type':Sequelize[_0x0dd7('0x5')](0x1fe)},'to':{'type':Sequelize[_0x0dd7('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x0dd7('0x6'))},'subject':{'type':Sequelize[_0x0dd7('0x7')]()},'attach':{'type':Sequelize[_0x0dd7('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0dd7('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x0dd7('0x8')]('in',_0x0dd7('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0dd7('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x0dd7('0x8')]('in',_0x0dd7('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x0dd7('0x6'))},'lastMsgText':{'type':Sequelize[_0x0dd7('0x7')](_0x0dd7('0x6'))}}; \ No newline at end of file +var _0x0a98=['out','ENUM','long','sequelize','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0xf354ba,_0x4b50e0){var _0x41486a=function(_0x1b03f0){while(--_0x1b03f0){_0xf354ba['push'](_0xf354ba['shift']());}};_0x41486a(++_0x4b50e0);}(_0x0a98,0xf6));var _0x80a9=function(_0x552580,_0x1116a8){_0x552580=_0x552580-0x0;var _0x26d419=_0x0a98[_0x552580];return _0x26d419;};'use strict';var Sequelize=require(_0x80a9('0x0'));var iconv=require('iconv');module[_0x80a9('0x1')]={'closed':{'type':Sequelize[_0x80a9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x80a9('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x80a9('0x4')]},'inReplyTo':{'type':Sequelize[_0x80a9('0x4')](0x1fe)},'to':{'type':Sequelize[_0x80a9('0x4')]},'cc':{'type':Sequelize[_0x80a9('0x5')]('long')},'subject':{'type':Sequelize[_0x80a9('0x5')]()},'attach':{'type':Sequelize[_0x80a9('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x80a9('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x80a9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x80a9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x80a9('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x80a9('0x8'))},'lastMsgText':{'type':Sequelize[_0x80a9('0x5')](_0x80a9('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index e03112d..79ab1fa 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(_0x1f5778,_0x59a676){var _0xe02b4e=function(_0x1ad744){while(--_0x1ad744){_0x1f5778['push'](_0x1f5778['shift']());}};_0xe02b4e(++_0x59a676);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x30bf9f,_0x3b93b7){var _0x4cca70=function(_0x6fdccd){while(--_0x6fdccd){_0x30bf9f['push'](_0x30bf9f['shift']());}};_0x4cca70(++_0x3b93b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 393abdd..cf13797 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 _0x6f31=['events','../../mysqldb','setMaxListeners','save','then','setDataValue','Users','unreadMessages','emit','catch','hasOwnProperty','exports'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x6f31,0x1c8));var _0x16f3=function(_0x56b7da,_0x3e46f4){_0x56b7da=_0x56b7da-0x0;var _0x1d22b5=_0x6f31[_0x56b7da];return _0x1d22b5;};'use strict';var EventEmitter=require(_0x16f3('0x0'));var MailInteraction=require(_0x16f3('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x16f3('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x16f3('0x2')](0x0);var events={'afterCreate':_0x16f3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x8b2af3){return function(_0x442c34,_0xbc7607,_0x1fc4ad){_0x442c34['getUsers']({'attributes':['id'],'raw':!![]})[_0x16f3('0x4')](function(_0xf33c2a){_0x442c34[_0x16f3('0x5')](_0x16f3('0x6'),_0xf33c2a['map'](function(_0x6d2376){return{'id':_0x6d2376['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x442c34['id'],'direction':'in','read':![]},'raw':!![]});})[_0x16f3('0x4')](function(_0x18c3f2){_0x442c34[_0x16f3('0x5')](_0x16f3('0x7'),_0x18c3f2['length']);MailInteractionEvents['emit'](_0x8b2af3+':'+_0x442c34['id'],_0x442c34);MailInteractionEvents[_0x16f3('0x8')](_0x8b2af3,_0x442c34);_0x1fc4ad(null);})[_0x16f3('0x9')](_0x1fc4ad(null));};}for(var e in events){if(events[_0x16f3('0xa')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x16f3('0xb')]=MailInteractionEvents; \ No newline at end of file +var _0x1515=['exports','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0x1515,0x121));var _0x5151=function(_0x57e70d,_0x3469c6){_0x57e70d=_0x57e70d-0x0;var _0x4dd4d3=_0x1515[_0x57e70d];return _0x4dd4d3;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x5151('0x0')];var MailMessage=require(_0x5151('0x1'))['db'][_0x5151('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5151('0x3')](0x0);var events={'afterCreate':_0x5151('0x4'),'afterUpdate':_0x5151('0x5'),'afterDestroy':_0x5151('0x6')};function emitEvent(_0x51bf80){return function(_0x32f331,_0x3d47be,_0x363fcd){_0x32f331[_0x5151('0x7')]({'attributes':['id'],'raw':!![]})[_0x5151('0x8')](function(_0x359ab3){_0x32f331['setDataValue']('Users',_0x359ab3['map'](function(_0x41cab3){return{'id':_0x41cab3['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x32f331['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5c6f01){_0x32f331[_0x5151('0x9')](_0x5151('0xa'),_0x5c6f01[_0x5151('0xb')]);MailInteractionEvents[_0x5151('0xc')](_0x51bf80+':'+_0x32f331['id'],_0x32f331);MailInteractionEvents[_0x5151('0xc')](_0x51bf80,_0x32f331);_0x363fcd(null);})['catch'](_0x363fcd(null));};}for(var e in events){if(events[_0x5151('0xd')](e)){var event=events[e];MailInteraction[_0x5151('0xe')](e,emitEvent(event));}}module[_0x5151('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 413c359..9b7db93 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 _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci'];(function(_0x1820c9,_0x2f7885){var _0x3598e9=function(_0xb43ddf){while(--_0xb43ddf){_0x1820c9['push'](_0x1820c9['shift']());}};_0x3598e9(++_0x2f7885);}(_0x34e8,0x12c));var _0x834e=function(_0x25518c,_0x10d617){_0x25518c=_0x25518c-0x0;var _0x294bda=_0x34e8[_0x25518c];return _0x294bda;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'name':_0x834e('0xd'),'fields':[_0x834e('0xe'),'to'],'type':_0x834e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23501c,_0x363786,_0x1af45a){if(_0x23501c[_0x834e('0x10')]){_0x23501c[_0x834e('0x11')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}if(_0x23501c[_0x834e('0x14')]){_0x23501c[_0x834e('0x15')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}_0x1af45a(null,_0x363786);},'beforeUpdate':function(_0x2fd95c,_0x538bb3,_0x5e5b6d){if(_0x2fd95c[_0x834e('0x16')]('substatus')){_0x2fd95c[_0x834e('0x11')]=_0x2fd95c[_0x834e('0x10')]?moment()[_0x834e('0x12')](_0x834e('0x13')):null;}if(_0x2fd95c['changed'](_0x834e('0x14'))){_0x2fd95c[_0x834e('0x15')]=moment()['format'](_0x834e('0x13'));_0x2fd95c['substatus']=null;_0x2fd95c[_0x834e('0x11')]=null;}_0x5e5b6d(null,_0x2fd95c);},'afterUpdate':function(_0x36d443,_0x478afe,_0x43ac41){var _0x22106e=_0x4a2018[_0x834e('0x17')];var _0x50b3f6=_0x36d443[_0x834e('0x18')]({'plain':!![]});if(_0x50b3f6[_0x834e('0x14')]){return _0x22106e[_0x834e('0x19')][_0x834e('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x50b3f6['id']}})[_0x834e('0x1b')](function(){_0x43ac41();})[_0x834e('0x1c')](function(_0x1dd214){_0x43ac41(_0x1dd214);});}else{_0x43ac41();}}},'charset':'utf8mb4','collate':_0x834e('0x1d')});}; \ No newline at end of file +var _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci'];(function(_0x5c2390,_0x866e07){var _0xa4f374=function(_0x3b314f){while(--_0x3b314f){_0x5c2390['push'](_0x5c2390['shift']());}};_0xa4f374(++_0x866e07);}(_0x34e8,0x12c));var _0x834e=function(_0x12d0d5,_0x36f842){_0x12d0d5=_0x12d0d5-0x0;var _0x244365=_0x34e8[_0x12d0d5];return _0x244365;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'name':_0x834e('0xd'),'fields':[_0x834e('0xe'),'to'],'type':_0x834e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23501c,_0x363786,_0x1af45a){if(_0x23501c[_0x834e('0x10')]){_0x23501c[_0x834e('0x11')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}if(_0x23501c[_0x834e('0x14')]){_0x23501c[_0x834e('0x15')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}_0x1af45a(null,_0x363786);},'beforeUpdate':function(_0x2fd95c,_0x538bb3,_0x5e5b6d){if(_0x2fd95c[_0x834e('0x16')]('substatus')){_0x2fd95c[_0x834e('0x11')]=_0x2fd95c[_0x834e('0x10')]?moment()[_0x834e('0x12')](_0x834e('0x13')):null;}if(_0x2fd95c['changed'](_0x834e('0x14'))){_0x2fd95c[_0x834e('0x15')]=moment()['format'](_0x834e('0x13'));_0x2fd95c['substatus']=null;_0x2fd95c[_0x834e('0x11')]=null;}_0x5e5b6d(null,_0x2fd95c);},'afterUpdate':function(_0x36d443,_0x478afe,_0x43ac41){var _0x22106e=_0x4a2018[_0x834e('0x17')];var _0x50b3f6=_0x36d443[_0x834e('0x18')]({'plain':!![]});if(_0x50b3f6[_0x834e('0x14')]){return _0x22106e[_0x834e('0x19')][_0x834e('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x50b3f6['id']}})[_0x834e('0x1b')](function(){_0x43ac41();})[_0x834e('0x1c')](function(_0x1dd214){_0x43ac41(_0x1dd214);});}else{_0x43ac41();}}},'charset':'utf8mb4','collate':_0x834e('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ea17ed2..ada02a3 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 _0xc99a=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','then','debug','request\x20sent','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','result','catch','MailInteraction','options','raw','where','attributes','limit','info','UpdateMailInteraction','AddTagsToMailInteraction','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring'];(function(_0x4b37ca,_0x1a9858){var _0x32f5b7=function(_0x127c38){while(--_0x127c38){_0x4b37ca['push'](_0x4b37ca['shift']());}};_0x32f5b7(++_0x1a9858);}(_0xc99a,0x7c));var _0xac99=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc99a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac99('0x0'));var util=require(_0xac99('0x1'));var moment=require(_0xac99('0x2'));var BPromise=require(_0xac99('0x3'));var rs=require(_0xac99('0x4'));var fs=require('fs');var Redis=require(_0xac99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xac99('0x6'));var logger=require(_0xac99('0x7'))(_0xac99('0x8'));var config=require(_0xac99('0x9'));var jayson=require(_0xac99('0xa'));var client=jayson[_0xac99('0xb')][_0xac99('0xc')]({'port':0x232a});config[_0xac99('0xd')]=_[_0xac99('0xe')](config[_0xac99('0xd')],{'host':_0xac99('0xf'),'port':0x18eb});var socket=require(_0xac99('0x10'))(new Redis(config['redis']));require(_0xac99('0x11'))[_0xac99('0x12')](socket);function respondWithRpcPromise(_0x4d60a9,_0x400b24,_0x8c503){return new BPromise(function(_0x140e6d,_0x34f665){return client['request'](_0x4d60a9,_0x8c503)[_0xac99('0x13')](function(_0x2b675d){logger['info']('MailInteraction,\x20%s,\x20%s',_0x400b24,'request\x20sent');logger[_0xac99('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x400b24,_0xac99('0x15'),JSON[_0xac99('0x16')](_0x2b675d));if(_0x2b675d[_0xac99('0x17')]){if(_0x2b675d[_0xac99('0x17')][_0xac99('0x18')]===0x1f4){logger[_0xac99('0x17')]('MailInteraction,\x20%s,\x20%s',_0x400b24,_0x2b675d[_0xac99('0x17')]['message']);return _0x34f665(_0x2b675d['error'][_0xac99('0x19')]);}logger[_0xac99('0x17')]('MailInteraction,\x20%s,\x20%s',_0x400b24,_0x2b675d[_0xac99('0x17')][_0xac99('0x19')]);return _0x140e6d(_0x2b675d[_0xac99('0x17')]['message']);}else{logger['info'](_0xac99('0x1a'),_0x400b24,_0xac99('0x15'));_0x140e6d(_0x2b675d[_0xac99('0x1b')][_0xac99('0x19')]);}})[_0xac99('0x1c')](function(_0xd5fb9e){logger[_0xac99('0x17')]('MailInteraction,\x20%s,\x20%s',_0x400b24,_0xd5fb9e);_0x34f665(_0xd5fb9e);});});}exports['UpdateMailInteraction']=function(_0x2e65cd){var _0xa28347=this;return new Promise(function(_0x4ecd83,_0x1cb8fc){return db[_0xac99('0x1d')]['update'](_0x2e65cd['body'],{'raw':_0x2e65cd[_0xac99('0x1e')]?_0x2e65cd[_0xac99('0x1e')][_0xac99('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e65cd[_0xac99('0x1e')]?_0x2e65cd[_0xac99('0x1e')][_0xac99('0x20')]||null:null,'attributes':_0x2e65cd[_0xac99('0x1e')]?_0x2e65cd[_0xac99('0x1e')][_0xac99('0x21')]||null:null,'limit':_0x2e65cd['options']?_0x2e65cd[_0xac99('0x1e')][_0xac99('0x22')]||null:null})[_0xac99('0x13')](function(_0x2791e0){logger[_0xac99('0x23')](_0xac99('0x24'),_0x2e65cd);logger['debug'](_0xac99('0x24'),_0x2e65cd,JSON[_0xac99('0x16')](_0x2791e0));_0x4ecd83(_0x2791e0);})[_0xac99('0x1c')](function(_0x33b0d9){logger['error'](_0xac99('0x24'),_0x33b0d9['message'],_0x2e65cd);_0x1cb8fc(_0xa28347[_0xac99('0x17')](0x1f4,_0x33b0d9[_0xac99('0x19')]));});});};exports[_0xac99('0x25')]=function(_0x597063){return new Promise(function(_0x4d2d79,_0x353630){return db['MailInteraction']['find']({'where':_0x597063[_0xac99('0x1e')]?_0x597063[_0xac99('0x1e')]['where']||null:null})['then'](function(_0x5e8923){if(_0x5e8923){return _0x5e8923['addTags'](_0x597063[_0xac99('0x26')][_0xac99('0x27')],_[_0xac99('0x28')](_0x597063['body'],['ids','id'])||{});}})[_0xac99('0x29')](function(_0x3b6cee){logger['info'](_0xac99('0x2a'),_0x597063);logger[_0xac99('0x14')](_0xac99('0x2a'),_0x597063,JSON[_0xac99('0x16')](_0x3b6cee));_0x4d2d79(_0x3b6cee);})[_0xac99('0x1c')](function(_0x68cbf7){logger[_0xac99('0x17')](_0xac99('0x2a'),_0x68cbf7['message'],_0x597063);_0x353630(_this[_0xac99('0x17')](0x1f4,_0x68cbf7['message']));});});}; \ No newline at end of file +var _0xdf0c=['message','result','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','stringify','catch','AddTagsToMailInteraction','find','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xb6d5cd,_0x100b73){var _0x11d4fa=function(_0x31979a){while(--_0x31979a){_0xb6d5cd['push'](_0xb6d5cd['shift']());}};_0x11d4fa(++_0x100b73);}(_0xdf0c,0x1ab));var _0xcdf0=function(_0x5ef296,_0x27c9d7){_0x5ef296=_0x5ef296-0x0;var _0x1bf8c0=_0xdf0c[_0x5ef296];return _0x1bf8c0;};'use strict';var _=require(_0xcdf0('0x0'));var util=require('util');var moment=require(_0xcdf0('0x1'));var BPromise=require(_0xcdf0('0x2'));var rs=require(_0xcdf0('0x3'));var fs=require('fs');var Redis=require(_0xcdf0('0x4'));var db=require(_0xcdf0('0x5'))['db'];var utils=require(_0xcdf0('0x6'));var logger=require(_0xcdf0('0x7'))('rpc');var config=require(_0xcdf0('0x8'));var jayson=require(_0xcdf0('0x9'));var client=jayson['client'][_0xcdf0('0xa')]({'port':0x232a});config[_0xcdf0('0xb')]=_[_0xcdf0('0xc')](config['redis'],{'host':_0xcdf0('0xd'),'port':0x18eb});var socket=require(_0xcdf0('0xe'))(new Redis(config[_0xcdf0('0xb')]));require(_0xcdf0('0xf'))['register'](socket);function respondWithRpcPromise(_0x3a25b3,_0x1a6e6d,_0x2104c7){return new BPromise(function(_0x197d96,_0x5ef0af){return client[_0xcdf0('0x10')](_0x3a25b3,_0x2104c7)[_0xcdf0('0x11')](function(_0x289a5b){logger[_0xcdf0('0x12')](_0xcdf0('0x13'),_0x1a6e6d,'request\x20sent');logger[_0xcdf0('0x14')](_0xcdf0('0x15'),_0x1a6e6d,_0xcdf0('0x16'),JSON['stringify'](_0x289a5b));if(_0x289a5b[_0xcdf0('0x17')]){if(_0x289a5b['error']['code']===0x1f4){logger[_0xcdf0('0x17')](_0xcdf0('0x13'),_0x1a6e6d,_0x289a5b['error'][_0xcdf0('0x18')]);return _0x5ef0af(_0x289a5b[_0xcdf0('0x17')][_0xcdf0('0x18')]);}logger[_0xcdf0('0x17')](_0xcdf0('0x13'),_0x1a6e6d,_0x289a5b[_0xcdf0('0x17')][_0xcdf0('0x18')]);return _0x197d96(_0x289a5b[_0xcdf0('0x17')][_0xcdf0('0x18')]);}else{logger[_0xcdf0('0x12')](_0xcdf0('0x13'),_0x1a6e6d,_0xcdf0('0x16'));_0x197d96(_0x289a5b[_0xcdf0('0x19')][_0xcdf0('0x18')]);}})['catch'](function(_0x38cd9d){logger[_0xcdf0('0x17')]('MailInteraction,\x20%s,\x20%s',_0x1a6e6d,_0x38cd9d);_0x5ef0af(_0x38cd9d);});});}exports[_0xcdf0('0x1a')]=function(_0x62de68){var _0x1251f4=this;return new Promise(function(_0x240216,_0xcf6826){return db[_0xcdf0('0x1b')][_0xcdf0('0x1c')](_0x62de68[_0xcdf0('0x1d')],{'raw':_0x62de68['options']?_0x62de68[_0xcdf0('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x62de68['options']?_0x62de68[_0xcdf0('0x1e')][_0xcdf0('0x1f')]||null:null,'attributes':_0x62de68[_0xcdf0('0x1e')]?_0x62de68['options'][_0xcdf0('0x20')]||null:null,'limit':_0x62de68[_0xcdf0('0x1e')]?_0x62de68[_0xcdf0('0x1e')][_0xcdf0('0x21')]||null:null})[_0xcdf0('0x11')](function(_0x2eb11a){logger[_0xcdf0('0x12')](_0xcdf0('0x1a'),_0x62de68);logger['debug'](_0xcdf0('0x1a'),_0x62de68,JSON[_0xcdf0('0x22')](_0x2eb11a));_0x240216(_0x2eb11a);})[_0xcdf0('0x23')](function(_0x479db5){logger[_0xcdf0('0x17')]('UpdateMailInteraction',_0x479db5[_0xcdf0('0x18')],_0x62de68);_0xcf6826(_0x1251f4[_0xcdf0('0x17')](0x1f4,_0x479db5['message']));});});};exports[_0xcdf0('0x24')]=function(_0x549ee3){return new Promise(function(_0x2f10f7,_0x466432){return db[_0xcdf0('0x1b')][_0xcdf0('0x25')]({'where':_0x549ee3[_0xcdf0('0x1e')]?_0x549ee3[_0xcdf0('0x1e')][_0xcdf0('0x1f')]||null:null})[_0xcdf0('0x11')](function(_0x79c63c){if(_0x79c63c){return _0x79c63c['addTags'](_0x549ee3['body'][_0xcdf0('0x26')],_['omit'](_0x549ee3[_0xcdf0('0x1d')],['ids','id'])||{});}})[_0xcdf0('0x27')](function(_0x527354){logger[_0xcdf0('0x12')](_0xcdf0('0x28'),_0x549ee3);logger[_0xcdf0('0x14')](_0xcdf0('0x28'),_0x549ee3,JSON[_0xcdf0('0x22')](_0x527354));_0x2f10f7(_0x527354);})[_0xcdf0('0x23')](function(_0x34d427){logger['error'](_0xcdf0('0x28'),_0x34d427[_0xcdf0('0x18')],_0x549ee3);_0x466432(_this[_0xcdf0('0x17')](0x1f4,_0x34d427[_0xcdf0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 07efedc..08ce37a 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 _0x667c=['register','length','mailInteraction:','remove','emit','removeListener'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x667c,0xc9));var _0xc667=function(_0xaceb00,_0x127f7b){_0xaceb00=_0xaceb00-0x0;var _0x104bfa=_0x667c[_0xaceb00];return _0x104bfa;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0xc667('0x0'),'update'];function createListener(_0x9c53fe,_0x4af4af){return function(_0xba0c5f){_0x4af4af[_0xc667('0x1')](_0x9c53fe,_0xba0c5f);};}function removeListener(_0x325168,_0x229ede){return function(){MailInteractionEvents[_0xc667('0x2')](_0x325168,_0x229ede);};}exports[_0xc667('0x3')]=function(_0x22b6d3){for(var _0x2689ee=0x0,_0x21b2ed=events[_0xc667('0x4')];_0x2689ee<_0x21b2ed;_0x2689ee++){var _0x208cfa=events[_0x2689ee];var _0x57e817=createListener(_0xc667('0x5')+_0x208cfa,_0x22b6d3);MailInteractionEvents['on'](_0x208cfa,_0x57e817);}}; \ No newline at end of file +var _0x3ebc=['save','remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x4a9ae5,_0x2490d2){var _0x1ae6fa=function(_0x5c6a4c){while(--_0x5c6a4c){_0x4a9ae5['push'](_0x4a9ae5['shift']());}};_0x1ae6fa(++_0x2490d2);}(_0x3ebc,0x10d));var _0xc3eb=function(_0x3d5140,_0x356e6a){_0x3d5140=_0x3d5140-0x0;var _0x2e2d9e=_0x3ebc[_0x3d5140];return _0x2e2d9e;};'use strict';var MailInteractionEvents=require(_0xc3eb('0x0'));var events=[_0xc3eb('0x1'),_0xc3eb('0x2'),_0xc3eb('0x3')];function createListener(_0x44cfb6,_0x42d420){return function(_0x2f6e1e){_0x42d420[_0xc3eb('0x4')](_0x44cfb6,_0x2f6e1e);};}function removeListener(_0x5d5cb7,_0x51f448){return function(){MailInteractionEvents[_0xc3eb('0x5')](_0x5d5cb7,_0x51f448);};}exports[_0xc3eb('0x6')]=function(_0x4a0907){for(var _0x2c6a2e=0x0,_0x4377cc=events[_0xc3eb('0x7')];_0x2c6a2e<_0x4377cc;_0x2c6a2e++){var _0x2925c1=events[_0x2c6a2e];var _0x3657af=createListener(_0xc3eb('0x8')+_0x2925c1,_0x4a0907);MailInteractionEvents['on'](_0x2925c1,_0x3657af);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index edd5743..0a58901 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 _0x7217=['mailmessage:create','create','put','update','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','tracked','mail'];(function(_0x8b7a70,_0x48b455){var _0x3aaebe=function(_0x5af519){while(--_0x5af519){_0x8b7a70['push'](_0x8b7a70['shift']());}};_0x3aaebe(++_0x48b455);}(_0x7217,0x19e));var _0x7721=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x7217[_0x5447fd];return _0x15b28a;};'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('0x7')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller['download']);router[_0x7721('0xf')]('/',auth[_0x7721('0x8')](),interaction[_0x7721('0x10')](_0x7721('0x11'),_0x7721('0x12')),controller[_0x7721('0x13')]);router[_0x7721('0x14')](_0x7721('0xc'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x14')]('/:id/accept',auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);router[_0x7721('0x14')](_0x7721('0x17'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router[_0x7721('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7721('0x1a')]=router; \ No newline at end of file +var _0x84ab=['reject','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x3b06f1,_0x48e9c0){var _0x329e2e=function(_0x17b243){while(--_0x17b243){_0x3b06f1['push'](_0x3b06f1['shift']());}};_0x329e2e(++_0x48e9c0);}(_0x84ab,0x12f));var _0xb84a=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x84ab[_0x23ec06];return _0x2831d4;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var auth=require(_0xb84a('0x5'));var interaction=require(_0xb84a('0x6'));var config=require('../../config/environment');var controller=require(_0xb84a('0x7'));router[_0xb84a('0x8')]('/',auth[_0xb84a('0x9')](),controller['index']);router['get']('/describe',auth[_0xb84a('0x9')](),controller['describe']);router[_0xb84a('0x8')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router['get'](_0xb84a('0xc'),auth[_0xb84a('0x9')](),controller[_0xb84a('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xb84a('0xe'),_0xb84a('0xf')),controller[_0xb84a('0x10')]);router[_0xb84a('0x11')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0x12')]);router[_0xb84a('0x11')](_0xb84a('0x13'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x14')]);router[_0xb84a('0x11')](_0xb84a('0x15'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x16')]);router[_0xb84a('0x17')](_0xb84a('0xa'),auth[_0xb84a('0x9')](),controller['destroy']);module[_0xb84a('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 180df6b..3fb6c4e 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 _0xf0f4=['long','TEXT','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','lodash'];(function(_0x12254f,_0x100cfe){var _0x3a4fa2=function(_0x1ce891){while(--_0x1ce891){_0x12254f['push'](_0x12254f['shift']());}};_0x3a4fa2(++_0x100cfe);}(_0xf0f4,0x182));var _0x4f0f=function(_0x497287,_0x11d321){_0x497287=_0x497287-0x0;var _0x6764a1=_0xf0f4[_0x497287];return _0x6764a1;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4f0f('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x4f0f('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4f0f('0x2')]('medium')},'read':{'type':Sequelize[_0x4f0f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4f0f('0x4')]('in',_0x4f0f('0x5')),'defaultValue':_0x4f0f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4f0f('0x6')](0x1fe)},'from':{'type':Sequelize[_0x4f0f('0x6')]},'to':{'type':Sequelize[_0x4f0f('0x2')]('long')},'cc':{'type':Sequelize[_0x4f0f('0x2')](_0x4f0f('0x1'))},'bcc':{'type':Sequelize[_0x4f0f('0x2')]('long')},'subject':{'type':Sequelize[_0x4f0f('0x2')]},'sentAt':{'type':Sequelize[_0x4f0f('0x7')]},'attach':{'type':Sequelize[_0x4f0f('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4f0f('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4f0f('0x7')]},'originTo':{'type':Sequelize[_0x4f0f('0x2')](_0x4f0f('0x1'))},'originCc':{'type':Sequelize[_0x4f0f('0x2')]('long')}}; \ No newline at end of file +var _0x39d2=['STRING','DATE','INTEGER','sequelize','exports','TEXT','long','medium','BOOLEAN','ENUM','out'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39d2,0xf5));var _0x239d=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x39d2[_0x1e4a8e];return _0x5408f9;};'use strict';var Sequelize=require(_0x239d('0x0'));var _=require('lodash');module[_0x239d('0x1')]={'body':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x4'))},'read':{'type':Sequelize[_0x239d('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x239d('0x6')]('in',_0x239d('0x7')),'defaultValue':_0x239d('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x239d('0x8')](0x1fe)},'from':{'type':Sequelize[_0x239d('0x8')]},'to':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x239d('0x3'))},'bcc':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x3'))},'subject':{'type':Sequelize[_0x239d('0x2')]},'sentAt':{'type':Sequelize[_0x239d('0x9')]},'attach':{'type':Sequelize[_0x239d('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x239d('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x239d('0x9')]},'originTo':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x3'))},'originCc':{'type':Sequelize[_0x239d('0x2')](_0x239d('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 696b7b3..099553f 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 _0xe181=['filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','body','find','describe','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','updatedAt','DESC','MailServerOut','Smtp','service','host','port','secure','user','pass','auth','attachments','root','server/files/attachments','basename','List','Contacts','create','List\x20not\x20found','SendMail','sendMail','update','messageId','format','mail-interactions','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','channel','event','accept','EventManager','acceptmessage','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SIP/%s','rejectmessage','download','unix','toString','join','server','files','tmp','message-%s.eml','bcc','createdAt','Attachment','from','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','save','destroy','name','MailMessage','rawAttributes','fieldName','key','map','keys','query','attributes','intersection','model','fields','length','nolimit','order','sort','where'];(function(_0x2335e6,_0x1bade8){var _0x370a50=function(_0x12d7cf){while(--_0x12d7cf){_0x2335e6['push'](_0x2335e6['shift']());}};_0x370a50(++_0x1bade8);}(_0xe181,0x68));var _0x1e18=function(_0x367577,_0x3c0484){_0x367577=_0x367577-0x0;var _0x1865c6=_0xe181[_0x367577];return _0x1865c6;};'use strict';var pdf=require(_0x1e18('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1e18('0x1'));var zipdir=require(_0x1e18('0x2'));var jsonpatch=require(_0x1e18('0x3'));var rp=require(_0x1e18('0x4'));var moment=require(_0x1e18('0x5'));var BPromise=require(_0x1e18('0x6'));var Mustache=require(_0x1e18('0x7'));var util=require('util');var path=require(_0x1e18('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1e18('0x9'));var fs=require('fs');var _=require(_0x1e18('0xa'));var squel=require(_0x1e18('0xb'));var crypto=require(_0x1e18('0xc'));var jsforce=require(_0x1e18('0xd'));var deskjs=require(_0x1e18('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1e18('0xf'));var Papa=require(_0x1e18('0x10'));var Redis=require(_0x1e18('0x11'));var authService=require(_0x1e18('0x12'));var qs=require(_0x1e18('0x13'));var as=require(_0x1e18('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e18('0x15'))(_0x1e18('0x16'));var utils=require(_0x1e18('0x17'));var config=require(_0x1e18('0x18'));var db=require(_0x1e18('0x19'))['db'];config[_0x1e18('0x1a')]=_[_0x1e18('0x1b')](config[_0x1e18('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e18('0x1c'))(new Redis(config['redis']));require(_0x1e18('0x1d'))['register'](socket);var jayson=require(_0x1e18('0x1e'));var client=jayson[_0x1e18('0x1f')][_0x1e18('0x20')]({'port':0x232c});var client9003=jayson[_0x1e18('0x1f')][_0x1e18('0x20')]({'port':0x232b});var client9002=jayson[_0x1e18('0x1f')][_0x1e18('0x20')]({'port':0x232a});function checkPasswordPattern(_0x33fea1,_0x134863,_0x3f5f61){if(_0x3f5f61){var _0x12ef98=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x12ef98[_0x1e18('0x21')](_0x134863)){return _0x33fea1;}else{throw new db[(_0x1e18('0x22'))][(_0x1e18('0x23'))](_0x1e18('0x24'));}}else{return _0x33fea1;}}function respondWithRpcPromise(_0x5b2888,_0x1c91d2,_0x17f558,_0xea095a){return new BPromise(function(_0x16fa70,_0x2834ee){var _0x25ee60=_0xea095a||client;return _0x25ee60[_0x1e18('0x25')](_0x5b2888,_0x17f558)[_0x1e18('0x26')](function(_0x2e849d){logger[_0x1e18('0x27')](_0x1e18('0x28'),_0x1c91d2,_0x1e18('0x29'));logger[_0x1e18('0x2a')](_0x1e18('0x2b'),_0x1c91d2,_0x1e18('0x29'),JSON[_0x1e18('0x2c')](_0x2e849d));if(_0x2e849d[_0x1e18('0x2d')]){if(_0x2e849d['error'][_0x1e18('0x2e')]===0x1f4){logger[_0x1e18('0x2d')](_0x1e18('0x28'),_0x1c91d2,_0x2e849d['error'][_0x1e18('0x2f')]);return _0x2834ee(_0x2e849d[_0x1e18('0x2d')][_0x1e18('0x2f')]);}logger[_0x1e18('0x2d')]('MailMessage,\x20%s,\x20%s',_0x1c91d2,_0x2e849d['error'][_0x1e18('0x2f')]);return _0x16fa70(_0x2e849d['error']['message']);}else{logger['info'](_0x1e18('0x28'),_0x1c91d2,_0x1e18('0x29'));_0x16fa70(_0x2e849d[_0x1e18('0x30')][_0x1e18('0x2f')]);}})[_0x1e18('0x31')](function(_0x38fca8){logger[_0x1e18('0x2d')](_0x1e18('0x28'),_0x1c91d2,_0x38fca8);_0x2834ee(_0x38fca8);});});}function respondWithStatusCode(_0xa0f951,_0x193e7b){_0x193e7b=_0x193e7b||0xcc;return function(_0x1015a3){if(_0x1015a3){return _0xa0f951[_0x1e18('0x32')](_0x193e7b);}return _0xa0f951[_0x1e18('0x33')](_0x193e7b)[_0x1e18('0x34')]();};}function respondWithResult(_0x558d01,_0x57000b){_0x57000b=_0x57000b||0xc8;return function(_0x562170){if(_0x562170){return _0x558d01[_0x1e18('0x33')](_0x57000b)[_0x1e18('0x35')](_0x562170);}};}function respondWithFilteredResult(_0x1f75cd,_0x230bb1){return function(_0x2828dc){if(_0x2828dc){var _0x93dd11=_0x2828dc[_0x1e18('0x36')],_0x2d47c8=_0x230bb1[_0x1e18('0x37')],_0x799f2=_0x230bb1['offset']+_0x230bb1[_0x1e18('0x38')],_0x541b5e;if(_0x799f2>=_0x93dd11){_0x799f2=_0x93dd11;_0x541b5e=0xc8;}else{_0x541b5e=0xce;}_0x1f75cd[_0x1e18('0x33')](_0x541b5e);return _0x1f75cd[_0x1e18('0x39')]('Content-Range',_0x2d47c8+'-'+_0x799f2+'/'+_0x93dd11)[_0x1e18('0x35')](_0x2828dc);}return null;};}function patchUpdates(_0x5597ab){return function(_0x53a239){try{jsonpatch['apply'](_0x53a239,_0x5597ab,!![]);}catch(_0xa4fe9e){return BPromise['reject'](_0xa4fe9e);}return _0x53a239[_0x1e18('0x3a')]();};}function saveUpdates(_0x3733d5,_0x3b7556){return function(_0x5c7d0f){if(_0x5c7d0f){return _0x5c7d0f['update'](_0x3733d5)[_0x1e18('0x26')](function(_0x3a7779){return _0x3a7779;});}return null;};}function removeEntity(_0x1dea56,_0x24eecf){return function(_0x28ef51){if(_0x28ef51){return _0x28ef51[_0x1e18('0x3b')]()[_0x1e18('0x26')](function(){_0x1dea56[_0x1e18('0x33')](0xcc)[_0x1e18('0x34')]();});}};}function handleEntityNotFound(_0xe1d2e2,_0x33e134){return function(_0x142a17){if(!_0x142a17){_0xe1d2e2['sendStatus'](0x194);}return _0x142a17;};}function handleError(_0x51d59f,_0x3a007e){_0x3a007e=_0x3a007e||0x1f4;return function(_0x267213){logger[_0x1e18('0x2d')](_0x267213['stack']);if(_0x267213[_0x1e18('0x3c')]){delete _0x267213['name'];}_0x51d59f[_0x1e18('0x33')](_0x3a007e)['send'](_0x267213);};}exports['index']=function(_0x3e8641,_0x11e13d){var _0x32db86={},_0x206b44={},_0x248485={'count':0x0,'rows':[]};var _0x39e504=_['map'](db[_0x1e18('0x3d')][_0x1e18('0x3e')],function(_0x395868){return{'name':_0x395868[_0x1e18('0x3f')],'type':_0x395868['type'][_0x1e18('0x40')]};});_0x206b44['model']=_[_0x1e18('0x41')](_0x39e504,_0x1e18('0x3c'));_0x206b44['query']=_[_0x1e18('0x42')](_0x3e8641[_0x1e18('0x43')]);_0x206b44['filters']=_['intersection'](_0x206b44['model'],_0x206b44[_0x1e18('0x43')]);_0x32db86[_0x1e18('0x44')]=_[_0x1e18('0x45')](_0x206b44[_0x1e18('0x46')],qs[_0x1e18('0x47')](_0x3e8641[_0x1e18('0x43')][_0x1e18('0x47')]));_0x32db86[_0x1e18('0x44')]=_0x32db86[_0x1e18('0x44')][_0x1e18('0x48')]?_0x32db86[_0x1e18('0x44')]:_0x206b44['model'];if(!_0x3e8641[_0x1e18('0x43')]['hasOwnProperty'](_0x1e18('0x49'))){_0x32db86[_0x1e18('0x38')]=qs['limit'](_0x3e8641['query']['limit']);_0x32db86[_0x1e18('0x37')]=qs[_0x1e18('0x37')](_0x3e8641['query'][_0x1e18('0x37')]);}_0x32db86[_0x1e18('0x4a')]=qs['sort'](_0x3e8641['query'][_0x1e18('0x4b')]);_0x32db86[_0x1e18('0x4c')]=qs[_0x1e18('0x4d')](_[_0x1e18('0x4e')](_0x3e8641[_0x1e18('0x43')],_0x206b44[_0x1e18('0x4d')]),_0x39e504);if(_0x3e8641[_0x1e18('0x43')][_0x1e18('0x4f')]){_0x32db86[_0x1e18('0x4c')]=_[_0x1e18('0x50')](_0x32db86['where'],{'$or':_['map'](_0x39e504,function(_0x3d1850){if(_0x3d1850[_0x1e18('0x51')]!==_0x1e18('0x52')){var _0x2a692c={};_0x2a692c[_0x3d1850[_0x1e18('0x3c')]]={'$like':'%'+_0x3e8641[_0x1e18('0x43')][_0x1e18('0x4f')]+'%'};return _0x2a692c;}})});}_0x32db86=_['merge']({},_0x32db86,_0x3e8641['options']);var _0x54cd71={'where':_0x32db86[_0x1e18('0x4c')]};return db[_0x1e18('0x3d')][_0x1e18('0x36')](_0x54cd71)[_0x1e18('0x26')](function(_0x3e5418){_0x248485[_0x1e18('0x36')]=_0x3e5418;if(_0x3e8641[_0x1e18('0x43')][_0x1e18('0x53')]){_0x32db86[_0x1e18('0x54')]=[{'all':!![]}];}return db[_0x1e18('0x3d')][_0x1e18('0x55')](_0x32db86);})[_0x1e18('0x26')](function(_0x46f264){_0x248485[_0x1e18('0x56')]=_0x46f264;return _0x248485;})[_0x1e18('0x26')](respondWithFilteredResult(_0x11e13d,_0x32db86))[_0x1e18('0x31')](handleError(_0x11e13d,null));};exports[_0x1e18('0x57')]=function(_0x1540f4,_0x56e30b){var _0x11d573={'raw':!![],'where':{'id':_0x1540f4[_0x1e18('0x58')]['id']}},_0x5d4cbb={};_0x5d4cbb[_0x1e18('0x46')]=_[_0x1e18('0x42')](db[_0x1e18('0x3d')][_0x1e18('0x3e')]);_0x5d4cbb['query']=_['keys'](_0x1540f4[_0x1e18('0x43')]);_0x5d4cbb[_0x1e18('0x4d')]=_['intersection'](_0x5d4cbb[_0x1e18('0x46')],_0x5d4cbb[_0x1e18('0x43')]);_0x11d573[_0x1e18('0x44')]=_['intersection'](_0x5d4cbb[_0x1e18('0x46')],qs[_0x1e18('0x47')](_0x1540f4[_0x1e18('0x43')][_0x1e18('0x47')]));_0x11d573[_0x1e18('0x44')]=_0x11d573['attributes'][_0x1e18('0x48')]?_0x11d573['attributes']:_0x5d4cbb['model'];if(_0x1540f4[_0x1e18('0x43')][_0x1e18('0x53')]){_0x11d573[_0x1e18('0x54')]=[{'all':!![]}];}_0x11d573=_[_0x1e18('0x50')]({},_0x11d573,_0x1540f4[_0x1e18('0x59')]);return db[_0x1e18('0x3d')]['find'](_0x11d573)[_0x1e18('0x26')](handleEntityNotFound(_0x56e30b,null))[_0x1e18('0x26')](respondWithResult(_0x56e30b,null))[_0x1e18('0x31')](handleError(_0x56e30b,null));};exports['update']=function(_0x2a8c69,_0x939d13){if(_0x2a8c69['body']['id']){delete _0x2a8c69[_0x1e18('0x5a')]['id'];}return db['MailMessage'][_0x1e18('0x5b')]({'where':{'id':_0x2a8c69[_0x1e18('0x58')]['id']}})[_0x1e18('0x26')](handleEntityNotFound(_0x939d13,null))[_0x1e18('0x26')](saveUpdates(_0x2a8c69[_0x1e18('0x5a')],null))[_0x1e18('0x26')](respondWithResult(_0x939d13,null))[_0x1e18('0x31')](handleError(_0x939d13,null));};exports[_0x1e18('0x3b')]=function(_0x567d8f,_0x3ab3b8){return db[_0x1e18('0x3d')]['find']({'where':{'id':_0x567d8f[_0x1e18('0x58')]['id']}})['then'](handleEntityNotFound(_0x3ab3b8,null))['then'](removeEntity(_0x3ab3b8,null))[_0x1e18('0x31')](handleError(_0x3ab3b8,null));};exports[_0x1e18('0x5c')]=function(_0x426a33,_0xf272cb){return db['MailMessage'][_0x1e18('0x5c')]()[_0x1e18('0x26')](respondWithResult(_0xf272cb,null))[_0x1e18('0x31')](handleError(_0xf272cb,null));};exports['create']=function(_0x48bcc3,_0x19590a){return db['MailMessage']['create'](_0x48bcc3[_0x1e18('0x5a')])[_0x1e18('0x26')](function(_0x16b888){if(_0x16b888){if(_0x16b888[_0x1e18('0x5d')]===_0x1e18('0x5e')&&!_0x16b888[_0x1e18('0x5f')]){var _0x164780,_0x154cb9,_0x25cc15;if(_0x48bcc3[_0x1e18('0x5a')]['to']){_0x154cb9=_0x48bcc3[_0x1e18('0x5a')]['to'][_0x1e18('0x60')](',')[0x0];}return db[_0x1e18('0x61')][_0x1e18('0x62')]({'where':{'id':_0x16b888[_0x1e18('0x63')]},'include':[{'model':db[_0x1e18('0x64')],'as':'List','include':[{'model':db[_0x1e18('0x65')],'as':'Contacts','where':{'email':_0x154cb9},'limit':0x1,'order':[[_0x1e18('0x66'),_0x1e18('0x67')]]}]},{'model':db[_0x1e18('0x68')],'as':_0x1e18('0x69'),'raw':!![]}]})['then'](function(_0x404ac4){_0x164780=_0x404ac4;if(_0x164780&&_0x164780['Smtp']){var _0x57a472={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x164780['Smtp'][_0x1e18('0x6a')])){_0x57a472[_0x1e18('0x6b')]=_0x164780[_0x1e18('0x69')][_0x1e18('0x6b')];_0x57a472[_0x1e18('0x6c')]=_0x164780[_0x1e18('0x69')][_0x1e18('0x6c')];_0x57a472['secure']=_0x164780[_0x1e18('0x69')][_0x1e18('0x6d')];if(_0x164780[_0x1e18('0x69')]['authentication']){_0x57a472['auth']={'user':_0x164780['Smtp'][_0x1e18('0x6e')],'pass':_0x164780[_0x1e18('0x69')][_0x1e18('0x6f')]};}}else{_0x57a472['service']=_0x164780[_0x1e18('0x69')][_0x1e18('0x6a')];_0x57a472[_0x1e18('0x70')]={'user':_0x164780[_0x1e18('0x69')]['user'],'pass':_0x164780[_0x1e18('0x69')]['pass']};_0x57a472[_0x1e18('0x6d')]=_0x164780[_0x1e18('0x69')]['secure'];}if(_0x48bcc3[_0x1e18('0x5a')][_0x1e18('0x71')]&&_0x48bcc3[_0x1e18('0x5a')][_0x1e18('0x71')][_0x1e18('0x48')]){for(var _0x22d89c=0x0;_0x22d89c<_0x48bcc3[_0x1e18('0x5a')][_0x1e18('0x71')][_0x1e18('0x48')];_0x22d89c+=0x1){_0x48bcc3[_0x1e18('0x5a')]['attachments'][_0x22d89c]={'filename':_0x48bcc3['body'][_0x1e18('0x71')][_0x22d89c]['name'],'path':path['join'](config[_0x1e18('0x72')],_0x1e18('0x73'),_0x48bcc3[_0x1e18('0x5a')][_0x1e18('0x71')][_0x22d89c][_0x1e18('0x74')])};}}_0x25cc15={'account':_0x57a472,'message':_0x48bcc3['body']};return;}})[_0x1e18('0x26')](function(){if(_0x164780[_0x1e18('0x75')]){if(_0x164780[_0x1e18('0x75')]['Contacts'][_0x1e18('0x48')]){return _0x164780[_0x1e18('0x75')][_0x1e18('0x76')][0x0];}else{return db[_0x1e18('0x65')][_0x1e18('0x77')](_['defaults'](_0x48bcc3[_0x1e18('0x5a')],{'firstName':_0x48bcc3[_0x1e18('0x5a')]['to'],'email':_0x48bcc3[_0x1e18('0x5a')]['to'],'phone':_0x48bcc3[_0x1e18('0x5a')]['to'],'ListId':_0x164780['ListId']}));}}else{throw new Error(_0x1e18('0x78'));}})[_0x1e18('0x26')](function(){if(_0x25cc15){return respondWithRpcPromise(_0x1e18('0x79'),_0x1e18('0x7a'),_0x25cc15,client9003)[_0x1e18('0x26')](function(_0x3b0870){return _0x16b888[_0x1e18('0x7b')]({'read':!![],'messageId':_0x3b0870[_0x1e18('0x7c')],'sentAt':moment()[_0x1e18('0x7d')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x1e18('0x31')](function(_0x261626){logger[_0x1e18('0x2d')]('%s',JSON['stringify'](_0x261626));return _0x16b888;});}return _0x16b888;});}return _0x16b888;}})[_0x1e18('0x26')](respondWithResult(_0x19590a,0xc9))[_0x1e18('0x31')](handleError(_0x19590a,null));};var interaction_log=require('../../config/logger')(_0x1e18('0x7e'));exports['accept']=function(_0x2866be,_0x509e67,_0x15e099){var _0xb3f2bd={'channel':_0x1e18('0x7f')};if(_0x2866be['body']['id']){delete _0x2866be[_0x1e18('0x5a')]['id'];}_0x2866be[_0x1e18('0x5a')][_0x1e18('0x80')]=!![];_0x2866be['body'][_0x1e18('0x81')]=moment()[_0x1e18('0x7d')](_0x1e18('0x82'));_0x2866be[_0x1e18('0x5a')][_0x1e18('0x83')]=_0x2866be[_0x1e18('0x5a')]['UserId']||_0x2866be[_0x1e18('0x6e')]['id'];return db[_0x1e18('0x3d')][_0x1e18('0x5b')]({'where':{'id':_0x2866be[_0x1e18('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x1e18('0x65')],'as':_0x1e18('0x84')}]})[_0x1e18('0x26')](handleEntityNotFound(_0x509e67,null))[_0x1e18('0x26')](saveUpdates(_0x2866be[_0x1e18('0x5a')],null))[_0x1e18('0x26')](function(_0x221683){if(_0x221683){_0xb3f2bd[_0x1e18('0x2f')]=_0x221683[_0x1e18('0x85')]({'plain':!![]});return db['MailInteraction'][_0x1e18('0x5b')]({'where':{'id':_0x221683[_0x1e18('0x86')]}});}return null;})[_0x1e18('0x26')](handleEntityNotFound(_0x509e67,null))[_0x1e18('0x26')](function(_0x3c4670){if(_0x3c4670){return _0x3c4670[_0x1e18('0x7b')]({'UserId':_0x2866be[_0x1e18('0x5a')][_0x1e18('0x83')],'read1stAt':_[_0x1e18('0x87')](_0x3c4670[_0x1e18('0x88')])?moment()[_0x1e18('0x7d')](_0x1e18('0x82')):undefined});}return null;})['then'](function(_0x29fc56){if(_0x29fc56){_0xb3f2bd[_0x1e18('0x89')]=_0x29fc56['get']({'plain':!![]});interaction_log[_0x1e18('0x27')](_0x1e18('0x8a'),_0x2866be['user']['id'],_0x2866be[_0x1e18('0x6e')][_0x1e18('0x3c')],_0x2866be[_0x1e18('0x6e')]['role'],_0xb3f2bd[_0x1e18('0x89')]['id'],_0x2866be[_0x1e18('0x5a')]?JSON[_0x1e18('0x2c')](_0x2866be[_0x1e18('0x5a')]):_0x1e18('0x8b'));return respondWithRpcPromise(_0x1e18('0x8c'),_0x1e18('0x8d'),_0xb3f2bd);}return null;})[_0x1e18('0x26')](function(_0x2c3d3b){if(_0x2c3d3b){if(_0x2866be[_0x1e18('0x5a')][_0x1e18('0x8e')]){_0xb3f2bd[_0x1e18('0x2f')][_0x1e18('0x8f')]=util[_0x1e18('0x7d')]('SIP/%s',_0x2866be[_0x1e18('0x6e')]['name']);_0xb3f2bd[_0x1e18('0x2f')][_0x1e18('0x90')]=_0xb3f2bd[_0x1e18('0x90')];_0xb3f2bd['message'][_0x1e18('0x91')]=_0x1e18('0x92');return respondWithRpcPromise(_0x1e18('0x93'),_0x1e18('0x93'),{'event':_0x1e18('0x94'),'message':_0xb3f2bd['message']},client9002)[_0x1e18('0x26')](function(){return _0xb3f2bd;});}return _0xb3f2bd;}return null;})[_0x1e18('0x26')](respondWithResult(_0x509e67,null))[_0x1e18('0x31')](handleError(_0x509e67,null));};var interaction_log=require(_0x1e18('0x15'))('mail-interactions');exports[_0x1e18('0x95')]=function(_0x4a7015,_0x44bd99,_0x278cae){var _0x379dcf={'agent':{},'channel':_0x1e18('0x7f')};if(_0x4a7015['body']['id']){delete _0x4a7015['body']['id'];}_0x4a7015['body']['UserId']=_0x4a7015[_0x1e18('0x5a')][_0x1e18('0x83')]||_0x4a7015[_0x1e18('0x6e')]['id'];_0x379dcf['agent']['id']=_0x4a7015[_0x1e18('0x5a')]['UserId'];return db['MailMessage']['find']({'where':{'id':_0x4a7015[_0x1e18('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x44bd99,null))['then'](function(_0x33c4bf){if(_0x33c4bf){_0x379dcf[_0x1e18('0x2f')]=_0x33c4bf[_0x1e18('0x85')]({'plain':!![]});return db[_0x1e18('0x96')][_0x1e18('0x5b')]({'where':{'id':_0x33c4bf[_0x1e18('0x86')]}});}return null;})[_0x1e18('0x26')](handleEntityNotFound(_0x44bd99,null))[_0x1e18('0x26')](function(_0x5a79e6){if(_0x5a79e6){_0x379dcf[_0x1e18('0x89')]=_0x5a79e6[_0x1e18('0x85')]({'plain':!![]});interaction_log[_0x1e18('0x27')](_0x1e18('0x97'),_0x4a7015[_0x1e18('0x6e')]['id'],_0x4a7015[_0x1e18('0x6e')]['name'],_0x4a7015[_0x1e18('0x6e')][_0x1e18('0x98')],_0x379dcf[_0x1e18('0x89')]['id'],_0x4a7015[_0x1e18('0x5a')]?JSON[_0x1e18('0x2c')](_0x4a7015[_0x1e18('0x5a')]):_0x1e18('0x8b'));return respondWithRpcPromise(_0x1e18('0x99'),_0x1e18('0x9a'),_0x379dcf);}return null;})[_0x1e18('0x26')](function(_0x31d491){if(_0x31d491){_0x31d491[_0x1e18('0x2f')]['interface']=util['format'](_0x1e18('0x9b'),_0x4a7015[_0x1e18('0x6e')][_0x1e18('0x3c')]);_0x31d491[_0x1e18('0x2f')][_0x1e18('0x90')]=_0x379dcf[_0x1e18('0x90')];_0x31d491[_0x1e18('0x2f')][_0x1e18('0x91')]=_0x1e18('0x95');respondWithRpcPromise(_0x1e18('0x93'),'EventManager',{'event':_0x1e18('0x9c'),'message':_0x31d491[_0x1e18('0x2f')]},client9002);return _0x379dcf;}return null;})[_0x1e18('0x26')](respondWithResult(_0x44bd99,null))[_0x1e18('0x31')](handleError(_0x44bd99,null));};exports[_0x1e18('0x9d')]=function(_0x10b4ad,_0x12fb2f){var _0x2fe625=moment()[_0x1e18('0x9e')]()[_0x1e18('0x9f')]();var _0x37e4f0=path[_0x1e18('0xa0')](config[_0x1e18('0x72')],_0x1e18('0xa1'),_0x1e18('0xa2'),_0x1e18('0xa3'));var _0x4659f1=path[_0x1e18('0xa0')](config[_0x1e18('0x72')],_0x1e18('0xa1'),'files',_0x1e18('0x71'));var _0x15bb32=util['format'](_0x1e18('0xa4'),_0x2fe625);return db[_0x1e18('0x3d')][_0x1e18('0x5b')]({'where':{'id':_0x10b4ad['params']['id']},'attributes':['id',_0x1e18('0x5a'),'from','to','cc',_0x1e18('0xa5'),'subject',_0x1e18('0xa6')],'include':_0x10b4ad['query'][_0x1e18('0x71')]?[{'model':db[_0x1e18('0xa7')],'as':'Attachments'}]:undefined})[_0x1e18('0x26')](handleEntityNotFound(_0x12fb2f,null))['then'](function(_0x5a877a){if(_0x5a877a){var _0x173bf1=_0x5a877a;var _0x57d3b9={'from':_0x173bf1[_0x1e18('0xa8')],'to':_0x173bf1['to'],'subject':_0x173bf1[_0x1e18('0xa9')],'html':_0x173bf1[_0x1e18('0x5a')],'headers':{'Date':moment(_0x173bf1[_0x1e18('0xa6')])[_0x1e18('0x7d')](_0x1e18('0xaa'))},'attachments':[]};if(_0x5a877a['cc']){_0x57d3b9[_0x1e18('0xab')]['Cc']=_0x5a877a['cc'];}if(_0x5a877a[_0x1e18('0xa5')]){_0x57d3b9[_0x1e18('0xab')][_0x1e18('0xac')]=_0x5a877a[_0x1e18('0xa5')];}return new BPromise(function(_0x12fcfe,_0x9d417e){if(_0x5a877a[_0x1e18('0xad')]){for(var _0x4f1e4=0x0;_0x4f1e4<_0x5a877a[_0x1e18('0xad')]['length'];_0x4f1e4++){var _0x4cf7d0=_0x5a877a[_0x1e18('0xad')][_0x4f1e4];var _0x311179=path[_0x1e18('0xa0')](_0x4659f1,_0x4cf7d0[_0x1e18('0x74')]);if(fs[_0x1e18('0xae')](_0x311179)){_0x57d3b9[_0x1e18('0x71')][_0x1e18('0xaf')]({'name':_0x4cf7d0[_0x1e18('0x3c')],'contentType':_0x4cf7d0[_0x1e18('0x51')],'data':fs[_0x1e18('0xb0')](_0x311179)});}}}emlformat[_0x1e18('0xb1')](_0x57d3b9,function(_0x2152df,_0x49d600){if(_0x2152df)return _0x9d417e(_0x2152df);fs[_0x1e18('0xb2')](path['join'](_0x37e4f0,_0x15bb32),_0x49d600);return _0x12fcfe(_0x49d600);});});}})[_0x1e18('0x26')](function(_0x3d8a1b){if(_0x3d8a1b){return _0x12fb2f['download'](path[_0x1e18('0xa0')](_0x37e4f0,_0x15bb32),_0x15bb32,function(_0x45074f){if(_0x45074f){console[_0x1e18('0xb3')]('err',_0x45074f);}else{fs[_0x1e18('0xb4')](path[_0x1e18('0xa0')](_0x37e4f0,_0x15bb32));}});}})[_0x1e18('0x31')](handleError(_0x12fb2f,null));}; \ No newline at end of file +var _0x8da5=['type','key','model','query','keys','intersection','fields','attributes','length','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','filters','MailMessage','find','body','describe','create','direction','secret','split','MailAccount','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','isNil','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail','read','readAt','UserId','Contact','get','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','manual','format','channel','accept','acceptmessage','reject','agent','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','interface','SIP/%s','event','EventManager','rejectmessage','download','unix','toString','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','log','err','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','set','json','save','update','destroy','end','stack','name','send','index','map','fieldName'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x8da5,0x71));var _0x58da=function(_0x1cd9a1,_0x5f3f7c){_0x1cd9a1=_0x1cd9a1-0x0;var _0x1709fd=_0x8da5[_0x1cd9a1];return _0x1709fd;};'use strict';var pdf=require(_0x58da('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x58da('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58da('0x2'));var rp=require(_0x58da('0x3'));var moment=require(_0x58da('0x4'));var BPromise=require(_0x58da('0x5'));var Mustache=require(_0x58da('0x6'));var util=require(_0x58da('0x7'));var path=require('path');var sox=require(_0x58da('0x8'));var csv=require(_0x58da('0x9'));var ejs=require(_0x58da('0xa'));var fs=require('fs');var _=require(_0x58da('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x58da('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x58da('0xd'));var authService=require(_0x58da('0xe'));var qs=require(_0x58da('0xf'));var as=require(_0x58da('0x10'));var hardwareService=require(_0x58da('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x58da('0x12'));var config=require(_0x58da('0x13'));var db=require(_0x58da('0x14'))['db'];config[_0x58da('0x15')]=_[_0x58da('0x16')](config[_0x58da('0x15')],{'host':_0x58da('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58da('0x15')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x58da('0x18'));var client=jayson[_0x58da('0x19')][_0x58da('0x1a')]({'port':0x232c});var client9003=jayson['client'][_0x58da('0x1a')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x320c08,_0x255e14,_0x193b15){if(_0x193b15){var _0x1bbb5d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1bbb5d[_0x58da('0x1b')](_0x255e14)){return _0x320c08;}else{throw new db['Sequelize']['ValidationError'](_0x58da('0x1c'));}}else{return _0x320c08;}}function respondWithRpcPromise(_0x467e4b,_0x37e59d,_0x52325c,_0x2113da){return new BPromise(function(_0x279942,_0x15fe05){var _0x1eccab=_0x2113da||client;return _0x1eccab[_0x58da('0x1d')](_0x467e4b,_0x52325c)[_0x58da('0x1e')](function(_0x2ff98c){logger[_0x58da('0x1f')](_0x58da('0x20'),_0x37e59d,_0x58da('0x21'));logger[_0x58da('0x22')](_0x58da('0x23'),_0x37e59d,'request\x20sent',JSON[_0x58da('0x24')](_0x2ff98c));if(_0x2ff98c['error']){if(_0x2ff98c[_0x58da('0x25')][_0x58da('0x26')]===0x1f4){logger[_0x58da('0x25')]('MailMessage,\x20%s,\x20%s',_0x37e59d,_0x2ff98c[_0x58da('0x25')][_0x58da('0x27')]);return _0x15fe05(_0x2ff98c[_0x58da('0x25')][_0x58da('0x27')]);}logger[_0x58da('0x25')](_0x58da('0x20'),_0x37e59d,_0x2ff98c[_0x58da('0x25')][_0x58da('0x27')]);return _0x279942(_0x2ff98c['error'][_0x58da('0x27')]);}else{logger[_0x58da('0x1f')](_0x58da('0x20'),_0x37e59d,_0x58da('0x21'));_0x279942(_0x2ff98c[_0x58da('0x28')][_0x58da('0x27')]);}})[_0x58da('0x29')](function(_0x1ce529){logger[_0x58da('0x25')](_0x58da('0x20'),_0x37e59d,_0x1ce529);_0x15fe05(_0x1ce529);});});}function respondWithStatusCode(_0x22d260,_0x1e5f9e){_0x1e5f9e=_0x1e5f9e||0xcc;return function(_0x579da5){if(_0x579da5){return _0x22d260[_0x58da('0x2a')](_0x1e5f9e);}return _0x22d260[_0x58da('0x2b')](_0x1e5f9e)['end']();};}function respondWithResult(_0x34860c,_0x4da555){_0x4da555=_0x4da555||0xc8;return function(_0x48108c){if(_0x48108c){return _0x34860c['status'](_0x4da555)['json'](_0x48108c);}};}function respondWithFilteredResult(_0xa07fc1,_0x39b2d4){return function(_0x314b09){if(_0x314b09){var _0x280c89=_0x314b09[_0x58da('0x2c')],_0x407300=_0x39b2d4[_0x58da('0x2d')],_0x1099ec=_0x39b2d4['offset']+_0x39b2d4['limit'],_0x4dbd0b;if(_0x1099ec>=_0x280c89){_0x1099ec=_0x280c89;_0x4dbd0b=0xc8;}else{_0x4dbd0b=0xce;}_0xa07fc1['status'](_0x4dbd0b);return _0xa07fc1[_0x58da('0x2e')]('Content-Range',_0x407300+'-'+_0x1099ec+'/'+_0x280c89)[_0x58da('0x2f')](_0x314b09);}return null;};}function patchUpdates(_0x71fabb){return function(_0x93cb53){try{jsonpatch['apply'](_0x93cb53,_0x71fabb,!![]);}catch(_0x2498b4){return BPromise['reject'](_0x2498b4);}return _0x93cb53[_0x58da('0x30')]();};}function saveUpdates(_0x384f64,_0x18a433){return function(_0x3c90a1){if(_0x3c90a1){return _0x3c90a1[_0x58da('0x31')](_0x384f64)[_0x58da('0x1e')](function(_0x2052df){return _0x2052df;});}return null;};}function removeEntity(_0xf9e4eb,_0x3b3486){return function(_0x727d62){if(_0x727d62){return _0x727d62[_0x58da('0x32')]()[_0x58da('0x1e')](function(){_0xf9e4eb['status'](0xcc)[_0x58da('0x33')]();});}};}function handleEntityNotFound(_0x19745e,_0x21b8d7){return function(_0xb0e37f){if(!_0xb0e37f){_0x19745e[_0x58da('0x2a')](0x194);}return _0xb0e37f;};}function handleError(_0x534096,_0x4e545a){_0x4e545a=_0x4e545a||0x1f4;return function(_0x42acd3){logger[_0x58da('0x25')](_0x42acd3[_0x58da('0x34')]);if(_0x42acd3[_0x58da('0x35')]){delete _0x42acd3['name'];}_0x534096[_0x58da('0x2b')](_0x4e545a)[_0x58da('0x36')](_0x42acd3);};}exports[_0x58da('0x37')]=function(_0x29d699,_0x1759fd){var _0x1a5289={},_0x1b4502={},_0x293ce9={'count':0x0,'rows':[]};var _0x443c12=_[_0x58da('0x38')](db['MailMessage']['rawAttributes'],function(_0x424efa){return{'name':_0x424efa[_0x58da('0x39')],'type':_0x424efa[_0x58da('0x3a')][_0x58da('0x3b')]};});_0x1b4502[_0x58da('0x3c')]=_[_0x58da('0x38')](_0x443c12,_0x58da('0x35'));_0x1b4502[_0x58da('0x3d')]=_[_0x58da('0x3e')](_0x29d699['query']);_0x1b4502['filters']=_[_0x58da('0x3f')](_0x1b4502[_0x58da('0x3c')],_0x1b4502[_0x58da('0x3d')]);_0x1a5289['attributes']=_['intersection'](_0x1b4502[_0x58da('0x3c')],qs['fields'](_0x29d699[_0x58da('0x3d')][_0x58da('0x40')]));_0x1a5289[_0x58da('0x41')]=_0x1a5289[_0x58da('0x41')][_0x58da('0x42')]?_0x1a5289[_0x58da('0x41')]:_0x1b4502[_0x58da('0x3c')];if(!_0x29d699[_0x58da('0x3d')]['hasOwnProperty'](_0x58da('0x43'))){_0x1a5289['limit']=qs[_0x58da('0x44')](_0x29d699[_0x58da('0x3d')]['limit']);_0x1a5289[_0x58da('0x2d')]=qs['offset'](_0x29d699[_0x58da('0x3d')]['offset']);}_0x1a5289['order']=qs[_0x58da('0x45')](_0x29d699['query'][_0x58da('0x45')]);_0x1a5289[_0x58da('0x46')]=qs['filters'](_[_0x58da('0x47')](_0x29d699['query'],_0x1b4502['filters']),_0x443c12);if(_0x29d699['query'][_0x58da('0x48')]){_0x1a5289[_0x58da('0x46')]=_['merge'](_0x1a5289[_0x58da('0x46')],{'$or':_[_0x58da('0x38')](_0x443c12,function(_0x153ebb){if(_0x153ebb[_0x58da('0x3a')]!==_0x58da('0x49')){var _0x36504b={};_0x36504b[_0x153ebb[_0x58da('0x35')]]={'$like':'%'+_0x29d699[_0x58da('0x3d')][_0x58da('0x48')]+'%'};return _0x36504b;}})});}_0x1a5289=_[_0x58da('0x4a')]({},_0x1a5289,_0x29d699[_0x58da('0x4b')]);var _0x3cfed5={'where':_0x1a5289[_0x58da('0x46')]};return db['MailMessage'][_0x58da('0x2c')](_0x3cfed5)['then'](function(_0x3fdfd7){_0x293ce9[_0x58da('0x2c')]=_0x3fdfd7;if(_0x29d699[_0x58da('0x3d')][_0x58da('0x4c')]){_0x1a5289[_0x58da('0x4d')]=[{'all':!![]}];}return db['MailMessage'][_0x58da('0x4e')](_0x1a5289);})['then'](function(_0x5cfd89){_0x293ce9[_0x58da('0x4f')]=_0x5cfd89;return _0x293ce9;})['then'](respondWithFilteredResult(_0x1759fd,_0x1a5289))[_0x58da('0x29')](handleError(_0x1759fd,null));};exports[_0x58da('0x50')]=function(_0x284330,_0x558498){var _0x332f1c={'raw':!![],'where':{'id':_0x284330[_0x58da('0x51')]['id']}},_0x139fbe={};_0x139fbe[_0x58da('0x3c')]=_[_0x58da('0x3e')](db['MailMessage'][_0x58da('0x52')]);_0x139fbe['query']=_[_0x58da('0x3e')](_0x284330[_0x58da('0x3d')]);_0x139fbe[_0x58da('0x53')]=_[_0x58da('0x3f')](_0x139fbe['model'],_0x139fbe[_0x58da('0x3d')]);_0x332f1c[_0x58da('0x41')]=_[_0x58da('0x3f')](_0x139fbe[_0x58da('0x3c')],qs[_0x58da('0x40')](_0x284330[_0x58da('0x3d')][_0x58da('0x40')]));_0x332f1c[_0x58da('0x41')]=_0x332f1c[_0x58da('0x41')][_0x58da('0x42')]?_0x332f1c[_0x58da('0x41')]:_0x139fbe[_0x58da('0x3c')];if(_0x284330[_0x58da('0x3d')][_0x58da('0x4c')]){_0x332f1c[_0x58da('0x4d')]=[{'all':!![]}];}_0x332f1c=_[_0x58da('0x4a')]({},_0x332f1c,_0x284330['options']);return db[_0x58da('0x54')][_0x58da('0x55')](_0x332f1c)['then'](handleEntityNotFound(_0x558498,null))[_0x58da('0x1e')](respondWithResult(_0x558498,null))[_0x58da('0x29')](handleError(_0x558498,null));};exports[_0x58da('0x31')]=function(_0x4c7ce4,_0x278150){if(_0x4c7ce4[_0x58da('0x56')]['id']){delete _0x4c7ce4[_0x58da('0x56')]['id'];}return db[_0x58da('0x54')][_0x58da('0x55')]({'where':{'id':_0x4c7ce4[_0x58da('0x51')]['id']}})[_0x58da('0x1e')](handleEntityNotFound(_0x278150,null))[_0x58da('0x1e')](saveUpdates(_0x4c7ce4['body'],null))['then'](respondWithResult(_0x278150,null))[_0x58da('0x29')](handleError(_0x278150,null));};exports[_0x58da('0x32')]=function(_0x4993d7,_0x206e23){return db[_0x58da('0x54')][_0x58da('0x55')]({'where':{'id':_0x4993d7['params']['id']}})[_0x58da('0x1e')](handleEntityNotFound(_0x206e23,null))[_0x58da('0x1e')](removeEntity(_0x206e23,null))[_0x58da('0x29')](handleError(_0x206e23,null));};exports[_0x58da('0x57')]=function(_0x2a3923,_0x17f983){return db[_0x58da('0x54')][_0x58da('0x57')]()[_0x58da('0x1e')](respondWithResult(_0x17f983,null))[_0x58da('0x29')](handleError(_0x17f983,null));};exports[_0x58da('0x58')]=function(_0x4e52b9,_0xa4b09d){return db[_0x58da('0x54')]['create'](_0x4e52b9['body'])[_0x58da('0x1e')](function(_0x53932d){if(_0x53932d){if(_0x53932d[_0x58da('0x59')]==='out'&&!_0x53932d[_0x58da('0x5a')]){var _0x497a30,_0x4da984,_0x21f1f1;if(_0x4e52b9['body']['to']){_0x4da984=_0x4e52b9[_0x58da('0x56')]['to'][_0x58da('0x5b')](',')[0x0];}return db[_0x58da('0x5c')]['findOne']({'where':{'id':_0x53932d['MailAccountId']},'include':[{'model':db[_0x58da('0x5d')],'as':_0x58da('0x5e'),'include':[{'model':db[_0x58da('0x5f')],'as':_0x58da('0x60'),'where':{'email':_0x4da984},'limit':0x1,'order':[[_0x58da('0x61'),'DESC']]}]},{'model':db[_0x58da('0x62')],'as':'Smtp','raw':!![]}]})[_0x58da('0x1e')](function(_0x2cc21f){_0x497a30=_0x2cc21f;if(_0x497a30&&_0x497a30['Smtp']){var _0x276f29={'tls':{'rejectUnauthorized':![]}};if(_[_0x58da('0x63')](_0x497a30[_0x58da('0x64')][_0x58da('0x65')])){_0x276f29['host']=_0x497a30['Smtp'][_0x58da('0x66')];_0x276f29[_0x58da('0x67')]=_0x497a30[_0x58da('0x64')][_0x58da('0x67')];_0x276f29[_0x58da('0x68')]=_0x497a30['Smtp']['secure'];if(_0x497a30[_0x58da('0x64')][_0x58da('0x69')]){_0x276f29[_0x58da('0x6a')]={'user':_0x497a30['Smtp'][_0x58da('0x6b')],'pass':_0x497a30[_0x58da('0x64')]['pass']};}}else{_0x276f29[_0x58da('0x65')]=_0x497a30['Smtp'][_0x58da('0x65')];_0x276f29[_0x58da('0x6a')]={'user':_0x497a30[_0x58da('0x64')]['user'],'pass':_0x497a30[_0x58da('0x64')][_0x58da('0x6c')]};_0x276f29[_0x58da('0x68')]=_0x497a30['Smtp'][_0x58da('0x68')];}if(_0x4e52b9[_0x58da('0x56')][_0x58da('0x6d')]&&_0x4e52b9[_0x58da('0x56')]['attachments'][_0x58da('0x42')]){for(var _0x591cb2=0x0;_0x591cb2<_0x4e52b9['body'][_0x58da('0x6d')][_0x58da('0x42')];_0x591cb2+=0x1){_0x4e52b9[_0x58da('0x56')][_0x58da('0x6d')][_0x591cb2]={'filename':_0x4e52b9['body'][_0x58da('0x6d')][_0x591cb2][_0x58da('0x35')],'path':path[_0x58da('0x6e')](config[_0x58da('0x6f')],_0x58da('0x70'),_0x4e52b9['body'][_0x58da('0x6d')][_0x591cb2][_0x58da('0x71')])};}}_0x21f1f1={'account':_0x276f29,'message':_0x4e52b9['body']};return;}})[_0x58da('0x1e')](function(){if(_0x497a30[_0x58da('0x5e')]){if(_0x497a30['List'][_0x58da('0x60')][_0x58da('0x42')]){return _0x497a30['List']['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0x58da('0x16')](_0x4e52b9['body'],{'firstName':_0x4e52b9[_0x58da('0x56')]['to'],'email':_0x4e52b9[_0x58da('0x56')]['to'],'phone':_0x4e52b9[_0x58da('0x56')]['to'],'ListId':_0x497a30[_0x58da('0x72')]}));}}else{throw new Error(_0x58da('0x73'));}})[_0x58da('0x1e')](function(){if(_0x21f1f1){return respondWithRpcPromise(_0x58da('0x74'),_0x58da('0x75'),_0x21f1f1,client9003)[_0x58da('0x1e')](function(_0xcf53f7){return _0x53932d[_0x58da('0x31')]({'read':!![],'messageId':_0xcf53f7[_0x58da('0x76')],'sentAt':moment()['format'](_0x58da('0x77'))});})[_0x58da('0x29')](function(_0x6c6f8){logger[_0x58da('0x25')]('%s',JSON['stringify'](_0x6c6f8));return _0x53932d;});}return _0x53932d;});}return _0x53932d;}})['then'](respondWithResult(_0xa4b09d,0xc9))['catch'](handleError(_0xa4b09d,null));};var interaction_log=require(_0x58da('0x78'))('mail-interactions');exports['accept']=function(_0x11a9bd,_0x4e9f68,_0x1d1942){var _0x42be11={'channel':_0x58da('0x79')};if(_0x11a9bd[_0x58da('0x56')]['id']){delete _0x11a9bd[_0x58da('0x56')]['id'];}_0x11a9bd[_0x58da('0x56')][_0x58da('0x7a')]=!![];_0x11a9bd[_0x58da('0x56')][_0x58da('0x7b')]=moment()['format'](_0x58da('0x77'));_0x11a9bd[_0x58da('0x56')]['UserId']=_0x11a9bd[_0x58da('0x56')][_0x58da('0x7c')]||_0x11a9bd[_0x58da('0x6b')]['id'];return db[_0x58da('0x54')][_0x58da('0x55')]({'where':{'id':_0x11a9bd['params']['id'],'UserId':null},'include':[{'model':db[_0x58da('0x5f')],'as':_0x58da('0x7d')}]})[_0x58da('0x1e')](handleEntityNotFound(_0x4e9f68,null))[_0x58da('0x1e')](saveUpdates(_0x11a9bd['body'],null))[_0x58da('0x1e')](function(_0x2d84f7){if(_0x2d84f7){_0x42be11[_0x58da('0x27')]=_0x2d84f7[_0x58da('0x7e')]({'plain':!![]});return db['MailInteraction'][_0x58da('0x55')]({'where':{'id':_0x2d84f7[_0x58da('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x4e9f68,null))[_0x58da('0x1e')](function(_0x5c8ca9){if(_0x5c8ca9){return _0x5c8ca9[_0x58da('0x31')]({'UserId':_0x11a9bd[_0x58da('0x56')]['UserId'],'read1stAt':_[_0x58da('0x63')](_0x5c8ca9[_0x58da('0x80')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x58da('0x1e')](function(_0x4a4ee4){if(_0x4a4ee4){_0x42be11[_0x58da('0x81')]=_0x4a4ee4['get']({'plain':!![]});interaction_log['info'](_0x58da('0x82'),_0x11a9bd[_0x58da('0x6b')]['id'],_0x11a9bd[_0x58da('0x6b')]['name'],_0x11a9bd[_0x58da('0x6b')][_0x58da('0x83')],_0x42be11[_0x58da('0x81')]['id'],_0x11a9bd['body']?JSON['stringify'](_0x11a9bd['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x58da('0x84'),_0x42be11);}return null;})[_0x58da('0x1e')](function(_0x5edcff){if(_0x5edcff){if(_0x11a9bd[_0x58da('0x56')][_0x58da('0x85')]){_0x42be11['message']['interface']=util[_0x58da('0x86')]('SIP/%s',_0x11a9bd['user']['name']);_0x42be11[_0x58da('0x27')][_0x58da('0x87')]=_0x42be11[_0x58da('0x87')];_0x42be11[_0x58da('0x27')]['event']=_0x58da('0x88');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x58da('0x89'),'message':_0x42be11[_0x58da('0x27')]},client9002)[_0x58da('0x1e')](function(){return _0x42be11;});}return _0x42be11;}return null;})[_0x58da('0x1e')](respondWithResult(_0x4e9f68,null))[_0x58da('0x29')](handleError(_0x4e9f68,null));};var interaction_log=require(_0x58da('0x78'))('mail-interactions');exports[_0x58da('0x8a')]=function(_0x321d9e,_0x6df6a1,_0x2a780c){var _0x3308e8={'agent':{},'channel':_0x58da('0x79')};if(_0x321d9e['body']['id']){delete _0x321d9e['body']['id'];}_0x321d9e[_0x58da('0x56')][_0x58da('0x7c')]=_0x321d9e[_0x58da('0x56')][_0x58da('0x7c')]||_0x321d9e[_0x58da('0x6b')]['id'];_0x3308e8[_0x58da('0x8b')]['id']=_0x321d9e[_0x58da('0x56')][_0x58da('0x7c')];return db['MailMessage'][_0x58da('0x55')]({'where':{'id':_0x321d9e['params']['id'],'UserId':null}})[_0x58da('0x1e')](handleEntityNotFound(_0x6df6a1,null))[_0x58da('0x1e')](function(_0x4be281){if(_0x4be281){_0x3308e8['message']=_0x4be281[_0x58da('0x7e')]({'plain':!![]});return db[_0x58da('0x8c')][_0x58da('0x55')]({'where':{'id':_0x4be281[_0x58da('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x6df6a1,null))[_0x58da('0x1e')](function(_0x1dc0f1){if(_0x1dc0f1){_0x3308e8['interaction']=_0x1dc0f1[_0x58da('0x7e')]({'plain':!![]});interaction_log[_0x58da('0x1f')](_0x58da('0x8d'),_0x321d9e[_0x58da('0x6b')]['id'],_0x321d9e[_0x58da('0x6b')][_0x58da('0x35')],_0x321d9e['user'][_0x58da('0x83')],_0x3308e8[_0x58da('0x81')]['id'],_0x321d9e[_0x58da('0x56')]?JSON[_0x58da('0x24')](_0x321d9e[_0x58da('0x56')]):_0x58da('0x8e'));return respondWithRpcPromise(_0x58da('0x8f'),_0x58da('0x90'),_0x3308e8);}return null;})['then'](function(_0x196f5a){if(_0x196f5a){_0x196f5a[_0x58da('0x27')][_0x58da('0x91')]=util['format'](_0x58da('0x92'),_0x321d9e['user'][_0x58da('0x35')]);_0x196f5a[_0x58da('0x27')][_0x58da('0x87')]=_0x3308e8[_0x58da('0x87')];_0x196f5a[_0x58da('0x27')][_0x58da('0x93')]=_0x58da('0x8a');respondWithRpcPromise(_0x58da('0x94'),_0x58da('0x94'),{'event':_0x58da('0x95'),'message':_0x196f5a[_0x58da('0x27')]},client9002);return _0x3308e8;}return null;})[_0x58da('0x1e')](respondWithResult(_0x6df6a1,null))[_0x58da('0x29')](handleError(_0x6df6a1,null));};exports[_0x58da('0x96')]=function(_0x587a66,_0x10e0c8){var _0x3c60f0=moment()[_0x58da('0x97')]()[_0x58da('0x98')]();var _0x1a1334=path['join'](config[_0x58da('0x6f')],'server','files','tmp');var _0xfcb480=path['join'](config[_0x58da('0x6f')],_0x58da('0x99'),_0x58da('0x9a'),_0x58da('0x6d'));var _0xab0e76=util['format'](_0x58da('0x9b'),_0x3c60f0);return db[_0x58da('0x54')][_0x58da('0x55')]({'where':{'id':_0x587a66['params']['id']},'attributes':['id','body',_0x58da('0x9c'),'to','cc',_0x58da('0x9d'),_0x58da('0x9e'),_0x58da('0x9f')],'include':_0x587a66[_0x58da('0x3d')]['attachments']?[{'model':db[_0x58da('0xa0')],'as':_0x58da('0xa1')}]:undefined})[_0x58da('0x1e')](handleEntityNotFound(_0x10e0c8,null))['then'](function(_0x5c66a0){if(_0x5c66a0){var _0x584b11=_0x5c66a0;var _0x262bbf={'from':_0x584b11['from'],'to':_0x584b11['to'],'subject':_0x584b11[_0x58da('0x9e')],'html':_0x584b11[_0x58da('0x56')],'headers':{'Date':moment(_0x584b11[_0x58da('0x9f')])['format'](_0x58da('0xa2'))},'attachments':[]};if(_0x5c66a0['cc']){_0x262bbf[_0x58da('0xa3')]['Cc']=_0x5c66a0['cc'];}if(_0x5c66a0[_0x58da('0x9d')]){_0x262bbf['headers'][_0x58da('0xa4')]=_0x5c66a0[_0x58da('0x9d')];}return new BPromise(function(_0x55fa56,_0x52dec7){if(_0x5c66a0[_0x58da('0xa1')]){for(var _0x28d2a5=0x0;_0x28d2a5<_0x5c66a0[_0x58da('0xa1')][_0x58da('0x42')];_0x28d2a5++){var _0x5820ea=_0x5c66a0[_0x58da('0xa1')][_0x28d2a5];var _0x2f4eab=path[_0x58da('0x6e')](_0xfcb480,_0x5820ea[_0x58da('0x71')]);if(fs[_0x58da('0xa5')](_0x2f4eab)){_0x262bbf['attachments'][_0x58da('0xa6')]({'name':_0x5820ea['name'],'contentType':_0x5820ea[_0x58da('0x3a')],'data':fs[_0x58da('0xa7')](_0x2f4eab)});}}}emlformat[_0x58da('0xa8')](_0x262bbf,function(_0x30a1b6,_0x1a2ac4){if(_0x30a1b6)return _0x52dec7(_0x30a1b6);fs['writeFileSync'](path[_0x58da('0x6e')](_0x1a1334,_0xab0e76),_0x1a2ac4);return _0x55fa56(_0x1a2ac4);});});}})[_0x58da('0x1e')](function(_0x1aa84d){if(_0x1aa84d){return _0x10e0c8[_0x58da('0x96')](path[_0x58da('0x6e')](_0x1a1334,_0xab0e76),_0xab0e76,function(_0x2ba802){if(_0x2ba802){console[_0x58da('0xa9')](_0x58da('0xaa'),_0x2ba802);}else{fs['unlinkSync'](path[_0x58da('0x6e')](_0x1a1334,_0xab0e76));}});}})[_0x58da('0x29')](handleError(_0x10e0c8,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6befefd..f5d776b 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 _0x65f2=['hook','exports','events','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x413602,_0x5da93b){var _0x30e02b=function(_0x52fc2f){while(--_0x52fc2f){_0x413602['push'](_0x413602['shift']());}};_0x30e02b(++_0x5da93b);}(_0x65f2,0xf2));var _0x265f=function(_0x479be4,_0x230761){_0x479be4=_0x479be4-0x0;var _0x495f72=_0x65f2[_0x479be4];return _0x495f72;};'use strict';var EventEmitter=require(_0x265f('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x265f('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x265f('0x2')](0x0);var events={'afterCreate':_0x265f('0x3'),'afterUpdate':_0x265f('0x4'),'afterDestroy':_0x265f('0x5')};function emitEvent(_0x363de5){return function(_0x3deadb,_0x21ece4,_0x187972){MailMessageEvents['emit'](_0x363de5+':'+_0x3deadb['id'],_0x3deadb);MailMessageEvents[_0x265f('0x6')](_0x363de5,_0x3deadb);_0x187972(null);};}for(var e in events){if(events[_0x265f('0x7')](e)){var event=events[e];MailMessage[_0x265f('0x8')](e,emitEvent(event));}}module[_0x265f('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x3131=['exports','events','MailMessage','save','update','remove','emit','hook'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x3131,0x1c1));var _0x1313=function(_0xe783d4,_0x38378f){_0xe783d4=_0xe783d4-0x0;var _0x911c4a=_0x3131[_0xe783d4];return _0x911c4a;};'use strict';var EventEmitter=require(_0x1313('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x1313('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1313('0x2'),'afterUpdate':_0x1313('0x3'),'afterDestroy':_0x1313('0x4')};function emitEvent(_0x2ba12b){return function(_0x367b66,_0xedd883,_0x460309){MailMessageEvents['emit'](_0x2ba12b+':'+_0x367b66['id'],_0x367b66);MailMessageEvents[_0x1313('0x5')](_0x2ba12b,_0x367b66);_0x460309(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x1313('0x6')](e,emitEvent(event));}}module[_0x1313('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 28470e1..fe17241 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 _0xae90=['FULLTEXT','body','fromString','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','define','mail_messages','messageId','fti_mail_messages','subject'];(function(_0x2553d8,_0x34ee11){var _0x565cf1=function(_0x2d3852){while(--_0x2d3852){_0x2553d8['push'](_0x2553d8['shift']());}};_0x565cf1(++_0x34ee11);}(_0xae90,0x170));var _0x0ae9=function(_0x3cd321,_0x3b2f29){_0x3cd321=_0x3cd321-0x0;var _0x95963=_0xae90[_0x3cd321];return _0x95963;};'use strict';var _=require(_0x0ae9('0x0'));var util=require(_0x0ae9('0x1'));var logger=require(_0x0ae9('0x2'))(_0x0ae9('0x3'));var moment=require(_0x0ae9('0x4'));var BPromise=require(_0x0ae9('0x5'));var rp=require(_0x0ae9('0x6'));var htmlToText=require(_0x0ae9('0x7'));var fs=require('fs');var path=require(_0x0ae9('0x8'));var rimraf=require(_0x0ae9('0x9'));var config=require(_0x0ae9('0xa'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0xd4eb0e,_0x4055bd){return _0xd4eb0e[_0x0ae9('0xb')]('MailMessage',attributes,{'tableName':_0x0ae9('0xc'),'paranoid':![],'indexes':[{'name':_0x0ae9('0xd'),'fields':['messageId']},{'name':_0x0ae9('0xe'),'fields':['plainBody',_0x0ae9('0xf')],'type':_0x0ae9('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x266c4d,_0x5208c6,_0x1d2e36){if(_0x266c4d[_0x0ae9('0x11')]){_0x266c4d['plainBody']=htmlToText[_0x0ae9('0x12')](_0x266c4d[_0x0ae9('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1d2e36(null,_0x5208c6);},'afterCreate':function(_0x2bba2d,_0x48d98a,_0x3868e6){var _0x28037d=_0xd4eb0e['models'];var _0x50cfa2=_0x2bba2d[_0x0ae9('0x13')]({'plain':!![]});if(_0x50cfa2[_0x0ae9('0x14')][_0x0ae9('0x15')]()==='in'||_0x50cfa2[_0x0ae9('0x14')][_0x0ae9('0x15')]()===_0x0ae9('0x16')&&!_0x50cfa2[_0x0ae9('0x17')]&&!_[_0x0ae9('0x18')](_0x50cfa2[_0x0ae9('0x19')])){_0x28037d[_0x0ae9('0x1a')]['findOne']({'where':{'id':_0x50cfa2['MailInteractionId']}})[_0x0ae9('0x1b')](function(_0x3e796d){if(_0x3e796d){_0x3e796d['update']({'lastMsgAt':_0x50cfa2[_0x0ae9('0x1c')],'lastMsgDirection':_0x50cfa2[_0x0ae9('0x14')]['toLowerCase'](),'lastMsgBody':_0x50cfa2[_0x0ae9('0x11')]});}})[_0x0ae9('0x1d')](function(_0x308d8b){console['error'](_0x308d8b);});}_0x3868e6();}},'charset':_0x0ae9('0x1e'),'collate':_0x0ae9('0x1f')});}; \ No newline at end of file +var _0x6fc1=['./mailMessage.attributes','exports','MailMessage','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','secret','UserId','MailInteraction','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f494f,_0x47997a){var _0x371d55=function(_0x5f2de5){while(--_0x5f2de5){_0x2f494f['push'](_0x2f494f['shift']());}};_0x371d55(++_0x47997a);}(_0x6fc1,0x9b));var _0x16fc=function(_0x4beaa0,_0x2e20b4){_0x4beaa0=_0x4beaa0-0x0;var _0x32d9e4=_0x6fc1[_0x4beaa0];return _0x32d9e4;};'use strict';var _=require(_0x16fc('0x0'));var util=require(_0x16fc('0x1'));var logger=require(_0x16fc('0x2'))(_0x16fc('0x3'));var moment=require(_0x16fc('0x4'));var BPromise=require(_0x16fc('0x5'));var rp=require(_0x16fc('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x16fc('0x7'));var rimraf=require(_0x16fc('0x8'));var config=require(_0x16fc('0x9'));var attributes=require(_0x16fc('0xa'));module[_0x16fc('0xb')]=function(_0x392fe1,_0x27b8f7){return _0x392fe1['define'](_0x16fc('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x16fc('0xd'),'fields':[_0x16fc('0xd')]},{'name':'fti_mail_messages','fields':[_0x16fc('0xe'),_0x16fc('0xf')],'type':_0x16fc('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32172b,_0xabfe89,_0x40b0e7){if(_0x32172b[_0x16fc('0x11')]){_0x32172b['plainBody']=htmlToText[_0x16fc('0x12')](_0x32172b[_0x16fc('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x40b0e7(null,_0xabfe89);},'afterCreate':function(_0x462a9d,_0x2d95f0,_0x59522c){var _0x1430da=_0x392fe1[_0x16fc('0x13')];var _0x1fce72=_0x462a9d[_0x16fc('0x14')]({'plain':!![]});if(_0x1fce72[_0x16fc('0x15')][_0x16fc('0x16')]()==='in'||_0x1fce72[_0x16fc('0x15')][_0x16fc('0x16')]()==='out'&&!_0x1fce72[_0x16fc('0x17')]&&!_['isNil'](_0x1fce72[_0x16fc('0x18')])){_0x1430da[_0x16fc('0x19')]['findOne']({'where':{'id':_0x1fce72[_0x16fc('0x1a')]}})[_0x16fc('0x1b')](function(_0x4bc99d){if(_0x4bc99d){_0x4bc99d[_0x16fc('0x1c')]({'lastMsgAt':_0x1fce72['createdAt'],'lastMsgDirection':_0x1fce72[_0x16fc('0x15')][_0x16fc('0x16')](),'lastMsgBody':_0x1fce72['body']});}})[_0x16fc('0x1d')](function(_0xa5cde8){console[_0x16fc('0x1e')](_0xa5cde8);});}_0x59522c();}},'charset':_0x16fc('0x1f'),'collate':_0x16fc('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 4c0e659..782f962 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 _0x9c48=['ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','debug','lodash','util','moment','randomstring'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9c48,0xa1));var _0x89c4=function(_0x196ee8,_0xdb9c49){_0x196ee8=_0x196ee8-0x0;var _0x24bba1=_0x9c48[_0x196ee8];return _0x24bba1;};'use strict';var _=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var moment=require(_0x89c4('0x2'));var BPromise=require('bluebird');var rs=require(_0x89c4('0x3'));var fs=require('fs');var Redis=require(_0x89c4('0x4'));var db=require(_0x89c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x89c4('0x6'));var config=require(_0x89c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x89c4('0x8')][_0x89c4('0x9')]({'port':0x232a});config[_0x89c4('0xa')]=_[_0x89c4('0xb')](config[_0x89c4('0xa')],{'host':_0x89c4('0xc'),'port':0x18eb});var socket=require(_0x89c4('0xd'))(new Redis(config[_0x89c4('0xa')]));require(_0x89c4('0xe'))[_0x89c4('0xf')](socket);function respondWithRpcPromise(_0x1b330a,_0x417d40,_0x2e8dc4){return new BPromise(function(_0xd445,_0x1a3823){return client[_0x89c4('0x10')](_0x1b330a,_0x2e8dc4)[_0x89c4('0x11')](function(_0x3b8322){logger[_0x89c4('0x12')](_0x89c4('0x13'),_0x417d40,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x417d40,_0x89c4('0x14'),JSON[_0x89c4('0x15')](_0x3b8322));if(_0x3b8322[_0x89c4('0x16')]){if(_0x3b8322[_0x89c4('0x16')][_0x89c4('0x17')]===0x1f4){logger[_0x89c4('0x16')](_0x89c4('0x13'),_0x417d40,_0x3b8322['error'][_0x89c4('0x18')]);return _0x1a3823(_0x3b8322[_0x89c4('0x16')][_0x89c4('0x18')]);}logger[_0x89c4('0x16')]('MailMessage,\x20%s,\x20%s',_0x417d40,_0x3b8322[_0x89c4('0x16')][_0x89c4('0x18')]);return _0xd445(_0x3b8322[_0x89c4('0x16')]['message']);}else{logger[_0x89c4('0x12')]('MailMessage,\x20%s,\x20%s',_0x417d40,_0x89c4('0x14'));_0xd445(_0x3b8322[_0x89c4('0x19')]['message']);}})[_0x89c4('0x1a')](function(_0x4ca31e){logger['error'](_0x89c4('0x13'),_0x417d40,_0x4ca31e);_0x1a3823(_0x4ca31e);});});}exports[_0x89c4('0x1b')]=function(_0x5cb1a9){var _0x4accf6=this;return new Promise(function(_0x1303ca,_0x5b8a37){return db[_0x89c4('0x1c')][_0x89c4('0x1d')](_0x5cb1a9['body'],{'raw':_0x5cb1a9[_0x89c4('0x1e')]?_0x5cb1a9[_0x89c4('0x1e')][_0x89c4('0x1f')]===undefined?!![]:![]:!![]})[_0x89c4('0x11')](function(_0x15ad38){logger[_0x89c4('0x12')]('CreateMailMessage',_0x5cb1a9);logger[_0x89c4('0x20')](_0x89c4('0x1b'),_0x5cb1a9,JSON['stringify'](_0x15ad38));_0x1303ca(_0x15ad38);})[_0x89c4('0x1a')](function(_0x222915){logger[_0x89c4('0x16')](_0x89c4('0x1b'),_0x222915[_0x89c4('0x18')],_0x5cb1a9);_0x5b8a37(_0x4accf6[_0x89c4('0x16')](0x1f4,_0x222915['message']));});});}; \ No newline at end of file +var _0x18b2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','MailMessage','create','body','options','then','CreateMailMessage','util','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x18b2,0x85));var _0x218b=function(_0x31eb64,_0x2598f7){_0x31eb64=_0x31eb64-0x0;var _0x37c10b=_0x18b2[_0x31eb64];return _0x37c10b;};'use strict';var _=require('lodash');var util=require(_0x218b('0x0'));var moment=require(_0x218b('0x1'));var BPromise=require(_0x218b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x218b('0x3'));var db=require(_0x218b('0x4'))['db'];var utils=require(_0x218b('0x5'));var logger=require(_0x218b('0x6'))(_0x218b('0x7'));var config=require(_0x218b('0x8'));var jayson=require(_0x218b('0x9'));var client=jayson[_0x218b('0xa')][_0x218b('0xb')]({'port':0x232a});config[_0x218b('0xc')]=_[_0x218b('0xd')](config[_0x218b('0xc')],{'host':_0x218b('0xe'),'port':0x18eb});var socket=require(_0x218b('0xf'))(new Redis(config[_0x218b('0xc')]));require('./mailMessage.socket')[_0x218b('0x10')](socket);function respondWithRpcPromise(_0xc5f1d7,_0x413da9,_0x161acf){return new BPromise(function(_0x421a0f,_0x4ee68f){return client[_0x218b('0x11')](_0xc5f1d7,_0x161acf)['then'](function(_0xfc01c1){logger[_0x218b('0x12')](_0x218b('0x13'),_0x413da9,'request\x20sent');logger[_0x218b('0x14')](_0x218b('0x15'),_0x413da9,'request\x20sent',JSON[_0x218b('0x16')](_0xfc01c1));if(_0xfc01c1[_0x218b('0x17')]){if(_0xfc01c1['error'][_0x218b('0x18')]===0x1f4){logger[_0x218b('0x17')](_0x218b('0x13'),_0x413da9,_0xfc01c1[_0x218b('0x17')][_0x218b('0x19')]);return _0x4ee68f(_0xfc01c1[_0x218b('0x17')][_0x218b('0x19')]);}logger[_0x218b('0x17')](_0x218b('0x13'),_0x413da9,_0xfc01c1[_0x218b('0x17')][_0x218b('0x19')]);return _0x421a0f(_0xfc01c1[_0x218b('0x17')][_0x218b('0x19')]);}else{logger[_0x218b('0x12')](_0x218b('0x13'),_0x413da9,_0x218b('0x1a'));_0x421a0f(_0xfc01c1['result'][_0x218b('0x19')]);}})[_0x218b('0x1b')](function(_0x139ade){logger['error']('MailMessage,\x20%s,\x20%s',_0x413da9,_0x139ade);_0x4ee68f(_0x139ade);});});}exports['CreateMailMessage']=function(_0x35bc29){var _0x3ac24d=this;return new Promise(function(_0x309af8,_0x157a8e){return db[_0x218b('0x1c')][_0x218b('0x1d')](_0x35bc29[_0x218b('0x1e')],{'raw':_0x35bc29[_0x218b('0x1f')]?_0x35bc29['options']['raw']===undefined?!![]:![]:!![]})[_0x218b('0x20')](function(_0x35716b){logger['info'](_0x218b('0x21'),_0x35bc29);logger[_0x218b('0x14')](_0x218b('0x21'),_0x35bc29,JSON['stringify'](_0x35716b));_0x309af8(_0x35716b);})['catch'](function(_0x63ad32){logger[_0x218b('0x17')]('CreateMailMessage',_0x63ad32[_0x218b('0x19')],_0x35bc29);_0x157a8e(_0x3ac24d[_0x218b('0x17')](0x1f4,_0x63ad32[_0x218b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a6b7328..f993437 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 _0x60a9=['emit','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x2ff52,_0x5634cb){var _0x517f75=function(_0x34b8ee){while(--_0x34b8ee){_0x2ff52['push'](_0x2ff52['shift']());}};_0x517f75(++_0x5634cb);}(_0x60a9,0x1b9));var _0x960a=function(_0x3578ec,_0x2a031c){_0x3578ec=_0x3578ec-0x0;var _0x214345=_0x60a9[_0x3578ec];return _0x214345;};'use strict';var MailMessageEvents=require(_0x960a('0x0'));var events=[_0x960a('0x1'),_0x960a('0x2'),'update'];function createListener(_0x477994,_0x2ecfec){return function(_0x57fd2f){_0x2ecfec[_0x960a('0x3')](_0x477994,_0x57fd2f);};}function removeListener(_0x240679,_0x485c90){return function(){MailMessageEvents['removeListener'](_0x240679,_0x485c90);};}exports['register']=function(_0x42e87f){for(var _0x490a75=0x0,_0x40ed56=events[_0x960a('0x4')];_0x490a75<_0x40ed56;_0x490a75++){var _0x4377ad=events[_0x490a75];var _0x4339f6=createListener(_0x960a('0x5')+_0x4377ad,_0x42e87f);MailMessageEvents['on'](_0x4377ad,_0x4339f6);}}; \ No newline at end of file +var _0xb7ce=['update','emit','removeListener','register','length','mailMessage:','save'];(function(_0x15291,_0x95ec05){var _0x2c0938=function(_0x17fc38){while(--_0x17fc38){_0x15291['push'](_0x15291['shift']());}};_0x2c0938(++_0x95ec05);}(_0xb7ce,0x1a3));var _0xeb7c=function(_0x3b8d61,_0x240a43){_0x3b8d61=_0x3b8d61-0x0;var _0x36a32b=_0xb7ce[_0x3b8d61];return _0x36a32b;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xeb7c('0x0'),'remove',_0xeb7c('0x1')];function createListener(_0x37f26d,_0xf1822a){return function(_0x45f9fb){_0xf1822a[_0xeb7c('0x2')](_0x37f26d,_0x45f9fb);};}function removeListener(_0x500312,_0x380be6){return function(){MailMessageEvents[_0xeb7c('0x3')](_0x500312,_0x380be6);};}exports[_0xeb7c('0x4')]=function(_0x3e874b){for(var _0x70f54a=0x0,_0x251589=events[_0xeb7c('0x5')];_0x70f54a<_0x251589;_0x70f54a++){var _0x4d0183=events[_0x70f54a];var _0x3dae0b=createListener(_0xeb7c('0x6')+_0x4d0183,_0x3e874b);MailMessageEvents['on'](_0x4d0183,_0x3dae0b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 6509053..bc9ff7c 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 _0x9d99=['get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','path','connect-timeout','Router','../../config/environment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x9d99,0xcc));var _0x99d9=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x9d99[_0x3b1b23];return _0x1efc85;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x99d9('0x0'));var timeout=require(_0x99d9('0x1'));var express=require('express');var router=express[_0x99d9('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x99d9('0x3'));var controller=require('./mailQueue.controller');router[_0x99d9('0x4')]('/',auth[_0x99d9('0x5')](),controller['index']);router[_0x99d9('0x4')](_0x99d9('0x6'),auth[_0x99d9('0x5')](),controller[_0x99d9('0x7')]);router[_0x99d9('0x4')](_0x99d9('0x8'),auth['isAuthenticated'](),controller[_0x99d9('0x9')]);router[_0x99d9('0x4')](_0x99d9('0xa'),auth[_0x99d9('0x5')](),controller[_0x99d9('0xb')]);router[_0x99d9('0x4')](_0x99d9('0xc'),auth[_0x99d9('0x5')](),controller[_0x99d9('0xd')]);router[_0x99d9('0x4')](_0x99d9('0xe'),auth[_0x99d9('0x5')](),controller[_0x99d9('0xf')]);router[_0x99d9('0x10')]('/',auth[_0x99d9('0x5')](),controller[_0x99d9('0x11')]);router[_0x99d9('0x10')](_0x99d9('0xc'),auth[_0x99d9('0x5')](),controller[_0x99d9('0x12')]);router[_0x99d9('0x10')](_0x99d9('0xe'),auth[_0x99d9('0x5')](),controller[_0x99d9('0x13')]);router[_0x99d9('0x14')](_0x99d9('0x8'),auth[_0x99d9('0x5')](),controller[_0x99d9('0x15')]);router[_0x99d9('0x16')](_0x99d9('0x8'),auth[_0x99d9('0x5')](),controller[_0x99d9('0x17')]);router[_0x99d9('0x16')]('/:id/teams',auth[_0x99d9('0x5')](),controller['removeTeams']);router[_0x99d9('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x99d9('0x18')]);module[_0x99d9('0x19')]=router; \ No newline at end of file +var _0xb471=['./mailQueue.controller','index','get','/describe','describe','/:id','show','/:id/members','isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1fd1be,_0x4490c2){var _0x3a7b03=function(_0x1e6a6a){while(--_0x1e6a6a){_0x1fd1be['push'](_0x1fd1be['shift']());}};_0x3a7b03(++_0x4490c2);}(_0xb471,0xbe));var _0x1b47=function(_0x2e416e,_0x4d955a){_0x2e416e=_0x2e416e-0x0;var _0x95bd0e=_0xb471[_0x2e416e];return _0x95bd0e;};'use strict';var multer=require(_0x1b47('0x0'));var util=require(_0x1b47('0x1'));var path=require(_0x1b47('0x2'));var timeout=require(_0x1b47('0x3'));var express=require(_0x1b47('0x4'));var router=express['Router']();var auth=require(_0x1b47('0x5'));var interaction=require(_0x1b47('0x6'));var config=require(_0x1b47('0x7'));var controller=require(_0x1b47('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1b47('0x9')]);router[_0x1b47('0xa')](_0x1b47('0xb'),auth['isAuthenticated'](),controller[_0x1b47('0xc')]);router['get'](_0x1b47('0xd'),auth['isAuthenticated'](),controller[_0x1b47('0xe')]);router[_0x1b47('0xa')](_0x1b47('0xf'),auth[_0x1b47('0x10')](),controller[_0x1b47('0x11')]);router[_0x1b47('0xa')](_0x1b47('0x12'),auth[_0x1b47('0x10')](),controller[_0x1b47('0x13')]);router['get'](_0x1b47('0x14'),auth[_0x1b47('0x10')](),controller[_0x1b47('0x15')]);router[_0x1b47('0x16')]('/',auth[_0x1b47('0x10')](),controller[_0x1b47('0x17')]);router['post'](_0x1b47('0x12'),auth['isAuthenticated'](),controller[_0x1b47('0x18')]);router[_0x1b47('0x16')](_0x1b47('0x14'),auth[_0x1b47('0x10')](),controller[_0x1b47('0x19')]);router[_0x1b47('0x1a')]('/:id',auth[_0x1b47('0x10')](),controller[_0x1b47('0x1b')]);router[_0x1b47('0x1c')](_0x1b47('0xd'),auth[_0x1b47('0x10')](),controller[_0x1b47('0x1d')]);router['delete'](_0x1b47('0x12'),auth['isAuthenticated'](),controller[_0x1b47('0x1e')]);router[_0x1b47('0x1c')](_0x1b47('0x14'),auth['isAuthenticated'](),controller[_0x1b47('0x1f')]);module[_0x1b47('0x20')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index e0a0c05..14cf731 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 _0x5c21=['ENUM','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x5d156b,_0xe2635d){var _0x1ef3fa=function(_0x5f1079){while(--_0x5f1079){_0x5d156b['push'](_0x5d156b['shift']());}};_0x1ef3fa(++_0xe2635d);}(_0x5c21,0x90));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x15c2('0x0')]={'name':{'type':Sequelize[_0x15c2('0x1')],'unique':_0x15c2('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x15c2('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x15c2('0x3')](_0x15c2('0x4'),_0x15c2('0x5'),_0x15c2('0x6'))}}; \ No newline at end of file +var _0xade9=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xade9,0x194));var _0x9ade=function(_0x156515,_0x760da4){_0x156515=_0x156515-0x0;var _0x3e1e8b=_0xade9[_0x156515];return _0x3e1e8b;};'use strict';var Sequelize=require(_0x9ade('0x0'));module[_0x9ade('0x1')]={'name':{'type':Sequelize[_0x9ade('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9ade('0x2')]},'timeout':{'type':Sequelize[_0x9ade('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9ade('0x4')](_0x9ade('0x5'),_0x9ade('0x6'),_0x9ade('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index c7b666f..348a196 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 _0xf2b5=['push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailQueue.socket','status','end','json','offset','limit','Content-Range','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','index','map','MailQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','name','count','rows','catch','show','include','options','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','params','describe','getMembers','findOne','UserMailQueue','nolimit','order','MailQueueId','findAll','User','findAndCountAll','agent','createdAt','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','select','tq.TeamId','team_has_mail_queues','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?'];(function(_0x1c6635,_0x151785){var _0x271fab=function(_0x3fb91d){while(--_0x3fb91d){_0x1c6635['push'](_0x1c6635['shift']());}};_0x271fab(++_0x151785);}(_0xf2b5,0x124));var _0x5f2b=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0xf2b5[_0x1526e1];return _0x249a1e;};'use strict';var pdf=require(_0x5f2b('0x0'));var emlformat=require(_0x5f2b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5f2b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5f2b('0x3'));var Mustache=require(_0x5f2b('0x4'));var util=require(_0x5f2b('0x5'));var path=require('path');var sox=require(_0x5f2b('0x6'));var csv=require(_0x5f2b('0x7'));var ejs=require(_0x5f2b('0x8'));var fs=require('fs');var _=require(_0x5f2b('0x9'));var squel=require('squel');var crypto=require(_0x5f2b('0xa'));var jsforce=require(_0x5f2b('0xb'));var deskjs=require(_0x5f2b('0xc'));var toCsv=require(_0x5f2b('0x7'));var querystring=require(_0x5f2b('0xd'));var Papa=require(_0x5f2b('0xe'));var Redis=require(_0x5f2b('0xf'));var authService=require(_0x5f2b('0x10'));var qs=require(_0x5f2b('0x11'));var as=require(_0x5f2b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f2b('0x13'));var utils=require(_0x5f2b('0x14'));var config=require(_0x5f2b('0x15'));var db=require(_0x5f2b('0x16'))['db'];config[_0x5f2b('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5f2b('0x18'))(new Redis(config[_0x5f2b('0x17')]));require(_0x5f2b('0x19'))['register'](socket);function respondWithStatusCode(_0x3e5bcc,_0x4f31ab){_0x4f31ab=_0x4f31ab||0xcc;return function(_0x1a583a){if(_0x1a583a){return _0x3e5bcc['sendStatus'](_0x4f31ab);}return _0x3e5bcc[_0x5f2b('0x1a')](_0x4f31ab)[_0x5f2b('0x1b')]();};}function respondWithResult(_0x55b75f,_0x554634){_0x554634=_0x554634||0xc8;return function(_0x1c2394){if(_0x1c2394){return _0x55b75f[_0x5f2b('0x1a')](_0x554634)[_0x5f2b('0x1c')](_0x1c2394);}};}function respondWithFilteredResult(_0x2862dd,_0x66c3){return function(_0x540cc5){if(_0x540cc5){var _0x39c221=_0x540cc5['count'],_0x2b1d5d=_0x66c3[_0x5f2b('0x1d')],_0x5765fb=_0x66c3[_0x5f2b('0x1d')]+_0x66c3[_0x5f2b('0x1e')],_0x39242e;if(_0x5765fb>=_0x39c221){_0x5765fb=_0x39c221;_0x39242e=0xc8;}else{_0x39242e=0xce;}_0x2862dd['status'](_0x39242e);return _0x2862dd['set'](_0x5f2b('0x1f'),_0x2b1d5d+'-'+_0x5765fb+'/'+_0x39c221)[_0x5f2b('0x1c')](_0x540cc5);}return null;};}function patchUpdates(_0x358974){return function(_0xbef87){try{jsonpatch['apply'](_0xbef87,_0x358974,!![]);}catch(_0x5967d9){return BPromise[_0x5f2b('0x20')](_0x5967d9);}return _0xbef87[_0x5f2b('0x21')]();};}function saveUpdates(_0x3cc564,_0x405d03){return function(_0x3fd59f){if(_0x3fd59f){return _0x3fd59f[_0x5f2b('0x22')](_0x3cc564)[_0x5f2b('0x23')](function(_0x3e2601){return _0x3e2601;});}return null;};}function removeEntity(_0x38ad8a,_0x6d9aa8){return function(_0x291372){if(_0x291372){return _0x291372[_0x5f2b('0x24')]()[_0x5f2b('0x23')](function(){var _0x281d4e=_0x291372[_0x5f2b('0x25')]({'plain':!![]});var _0x444301=_0x5f2b('0x26');return db[_0x5f2b('0x27')][_0x5f2b('0x24')]({'where':{'type':_0x444301,'resourceId':_0x281d4e['id']}})[_0x5f2b('0x23')](function(){return _0x291372;});})['then'](function(){_0x38ad8a['status'](0xcc)[_0x5f2b('0x1b')]();});}};}function handleEntityNotFound(_0x398021,_0x68806a){return function(_0x1ec83f){if(!_0x1ec83f){_0x398021[_0x5f2b('0x28')](0x194);}return _0x1ec83f;};}function handleError(_0xccb70d,_0x3d5cfa){_0x3d5cfa=_0x3d5cfa||0x1f4;return function(_0x37971d){logger[_0x5f2b('0x29')](_0x37971d[_0x5f2b('0x2a')]);if(_0x37971d['name']){delete _0x37971d['name'];}_0xccb70d[_0x5f2b('0x1a')](_0x3d5cfa)['send'](_0x37971d);};}exports[_0x5f2b('0x2b')]=function(_0x3eb996,_0x4f53cb){var _0x24d0a9={},_0x347832={},_0x4cbbd2={'count':0x0,'rows':[]};var _0x4f219f=_[_0x5f2b('0x2c')](db[_0x5f2b('0x2d')][_0x5f2b('0x2e')],function(_0x380a81){return{'name':_0x380a81[_0x5f2b('0x2f')],'type':_0x380a81['type'][_0x5f2b('0x30')]};});_0x347832[_0x5f2b('0x31')]=_[_0x5f2b('0x2c')](_0x4f219f,'name');_0x347832[_0x5f2b('0x32')]=_[_0x5f2b('0x33')](_0x3eb996['query']);_0x347832[_0x5f2b('0x34')]=_[_0x5f2b('0x35')](_0x347832['model'],_0x347832[_0x5f2b('0x32')]);_0x24d0a9[_0x5f2b('0x36')]=_[_0x5f2b('0x35')](_0x347832[_0x5f2b('0x31')],qs[_0x5f2b('0x37')](_0x3eb996[_0x5f2b('0x32')][_0x5f2b('0x37')]));_0x24d0a9['attributes']=_0x24d0a9[_0x5f2b('0x36')][_0x5f2b('0x38')]?_0x24d0a9[_0x5f2b('0x36')]:_0x347832[_0x5f2b('0x31')];if(!_0x3eb996[_0x5f2b('0x32')][_0x5f2b('0x39')]('nolimit')){_0x24d0a9[_0x5f2b('0x1e')]=qs[_0x5f2b('0x1e')](_0x3eb996[_0x5f2b('0x32')][_0x5f2b('0x1e')]);_0x24d0a9[_0x5f2b('0x1d')]=qs[_0x5f2b('0x1d')](_0x3eb996['query'][_0x5f2b('0x1d')]);}_0x24d0a9['order']=qs[_0x5f2b('0x3a')](_0x3eb996[_0x5f2b('0x32')][_0x5f2b('0x3a')]);_0x24d0a9[_0x5f2b('0x3b')]=qs[_0x5f2b('0x34')](_[_0x5f2b('0x3c')](_0x3eb996[_0x5f2b('0x32')],_0x347832['filters']),_0x4f219f);if(_0x3eb996[_0x5f2b('0x32')][_0x5f2b('0x3d')]){_0x24d0a9[_0x5f2b('0x3b')]=_[_0x5f2b('0x3e')](_0x24d0a9['where'],{'$or':_[_0x5f2b('0x2c')](_0x4f219f,function(_0x5b1f25){if(_0x5b1f25[_0x5f2b('0x3f')]!==_0x5f2b('0x40')){var _0x3d0efa={};_0x3d0efa[_0x5b1f25[_0x5f2b('0x41')]]={'$like':'%'+_0x3eb996[_0x5f2b('0x32')]['filter']+'%'};return _0x3d0efa;}})});}_0x24d0a9=_[_0x5f2b('0x3e')]({},_0x24d0a9,_0x3eb996['options']);var _0x35a94e={'where':_0x24d0a9['where']};return db[_0x5f2b('0x2d')][_0x5f2b('0x42')](_0x35a94e)[_0x5f2b('0x23')](function(_0x5ec603){_0x4cbbd2[_0x5f2b('0x42')]=_0x5ec603;if(_0x3eb996[_0x5f2b('0x32')]['includeAll']){_0x24d0a9['include']=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x24d0a9);})[_0x5f2b('0x23')](function(_0x315c9b){_0x4cbbd2[_0x5f2b('0x43')]=_0x315c9b;return _0x4cbbd2;})[_0x5f2b('0x23')](respondWithFilteredResult(_0x4f53cb,_0x24d0a9))[_0x5f2b('0x44')](handleError(_0x4f53cb,null));};exports[_0x5f2b('0x45')]=function(_0x29e264,_0xd2672a){var _0x497427={'raw':!![],'where':{'id':_0x29e264['params']['id']}},_0x15c54e={};_0x15c54e[_0x5f2b('0x31')]=_[_0x5f2b('0x33')](db[_0x5f2b('0x2d')][_0x5f2b('0x2e')]);_0x15c54e[_0x5f2b('0x32')]=_['keys'](_0x29e264[_0x5f2b('0x32')]);_0x15c54e[_0x5f2b('0x34')]=_['intersection'](_0x15c54e[_0x5f2b('0x31')],_0x15c54e[_0x5f2b('0x32')]);_0x497427[_0x5f2b('0x36')]=_[_0x5f2b('0x35')](_0x15c54e[_0x5f2b('0x31')],qs[_0x5f2b('0x37')](_0x29e264['query'][_0x5f2b('0x37')]));_0x497427[_0x5f2b('0x36')]=_0x497427['attributes'][_0x5f2b('0x38')]?_0x497427['attributes']:_0x15c54e[_0x5f2b('0x31')];if(_0x29e264[_0x5f2b('0x32')]['includeAll']){_0x497427[_0x5f2b('0x46')]=[{'all':!![]}];}_0x497427=_[_0x5f2b('0x3e')]({},_0x497427,_0x29e264[_0x5f2b('0x47')]);return db[_0x5f2b('0x2d')][_0x5f2b('0x48')](_0x497427)[_0x5f2b('0x23')](handleEntityNotFound(_0xd2672a,null))[_0x5f2b('0x23')](respondWithResult(_0xd2672a,null))[_0x5f2b('0x44')](handleError(_0xd2672a,null));};exports[_0x5f2b('0x49')]=function(_0x1cabf1,_0x107b13){return db[_0x5f2b('0x2d')]['create'](_0x1cabf1[_0x5f2b('0x4a')],{})['then'](function(_0xbb2fa9){var _0x1d6630=_0x1cabf1['user'][_0x5f2b('0x25')]({'plain':!![]});if(!_0x1d6630)throw new Error(_0x5f2b('0x4b'));if(_0x1d6630[_0x5f2b('0x4c')]===_0x5f2b('0x4d')){var _0x4910f6=_0xbb2fa9[_0x5f2b('0x25')]({'plain':!![]});var _0x4dab7f=_0x5f2b('0x26');return db[_0x5f2b('0x4e')][_0x5f2b('0x48')]({'where':{'name':_0x4dab7f,'userProfileId':_0x1d6630[_0x5f2b('0x4f')]},'raw':!![]})['then'](function(_0x21e6b4){if(_0x21e6b4&&_0x21e6b4[_0x5f2b('0x50')]===0x0){return db[_0x5f2b('0x27')][_0x5f2b('0x49')]({'name':_0x4910f6[_0x5f2b('0x41')],'resourceId':_0x4910f6['id'],'type':_0x21e6b4[_0x5f2b('0x41')],'sectionId':_0x21e6b4['id']},{})[_0x5f2b('0x23')](function(){return _0xbb2fa9;});}else{return _0xbb2fa9;}})[_0x5f2b('0x44')](function(_0x43a367){logger['error'](_0x5f2b('0x51'),_0x43a367);throw _0x43a367;});}return _0xbb2fa9;})[_0x5f2b('0x23')](respondWithResult(_0x107b13,0xc9))[_0x5f2b('0x44')](handleError(_0x107b13,null));};exports['update']=function(_0x211740,_0x4f8ae9){if(_0x211740[_0x5f2b('0x4a')]['id']){delete _0x211740[_0x5f2b('0x4a')]['id'];}return db[_0x5f2b('0x2d')][_0x5f2b('0x48')]({'where':{'id':_0x211740[_0x5f2b('0x52')]['id']}})[_0x5f2b('0x23')](handleEntityNotFound(_0x4f8ae9,null))['then'](saveUpdates(_0x211740[_0x5f2b('0x4a')],null))[_0x5f2b('0x23')](respondWithResult(_0x4f8ae9,null))[_0x5f2b('0x44')](handleError(_0x4f8ae9,null));};exports[_0x5f2b('0x24')]=function(_0xae754e,_0x3e44a6){return db['MailQueue'][_0x5f2b('0x48')]({'where':{'id':_0xae754e[_0x5f2b('0x52')]['id']}})[_0x5f2b('0x23')](handleEntityNotFound(_0x3e44a6,null))[_0x5f2b('0x23')](removeEntity(_0x3e44a6,null))[_0x5f2b('0x44')](handleError(_0x3e44a6,null));};exports[_0x5f2b('0x53')]=function(_0x2908ac,_0x9eb8d9){return db[_0x5f2b('0x2d')]['describe']()[_0x5f2b('0x23')](respondWithResult(_0x9eb8d9,null))[_0x5f2b('0x44')](handleError(_0x9eb8d9,null));};exports[_0x5f2b('0x54')]=function(_0x50367b,_0x59eb4a,_0x434592){var _0x446cec={'raw':!![],'where':{}},_0x4df257={},_0x41cd34;return db['MailQueue'][_0x5f2b('0x55')]({'where':{'id':_0x50367b[_0x5f2b('0x52')]['id']}})[_0x5f2b('0x23')](handleEntityNotFound(_0x59eb4a,null))[_0x5f2b('0x23')](function(_0x163c3a){if(_0x163c3a){_0x41cd34=_0x163c3a['get']({'plain':!![]});_0x4df257[_0x5f2b('0x31')]=_['keys'](db[_0x5f2b('0x56')]['rawAttributes']);_0x4df257[_0x5f2b('0x32')]=_[_0x5f2b('0x33')](_0x50367b[_0x5f2b('0x32')]);_0x4df257[_0x5f2b('0x34')]=_['intersection'](_0x4df257[_0x5f2b('0x31')],_0x4df257[_0x5f2b('0x32')]);_0x446cec[_0x5f2b('0x36')]=_[_0x5f2b('0x35')](_0x4df257['model'],qs[_0x5f2b('0x37')](_0x50367b[_0x5f2b('0x32')][_0x5f2b('0x37')]));_0x446cec[_0x5f2b('0x36')]=_0x446cec[_0x5f2b('0x36')][_0x5f2b('0x38')]?_0x446cec[_0x5f2b('0x36')]:_0x4df257[_0x5f2b('0x31')];if(!_0x50367b[_0x5f2b('0x32')][_0x5f2b('0x39')](_0x5f2b('0x57'))){_0x446cec[_0x5f2b('0x1e')]=qs['limit'](_0x50367b['query'][_0x5f2b('0x1e')]);_0x446cec[_0x5f2b('0x1d')]=qs[_0x5f2b('0x1d')](_0x50367b['query'][_0x5f2b('0x1d')]);}_0x446cec[_0x5f2b('0x58')]=qs[_0x5f2b('0x3a')](_0x50367b[_0x5f2b('0x32')]['sort']);_0x446cec['where']=qs[_0x5f2b('0x34')](_['pick'](_0x50367b[_0x5f2b('0x32')],_0x4df257[_0x5f2b('0x34')]));_0x446cec[_0x5f2b('0x3b')][_0x5f2b('0x59')]=_0x163c3a['id'];if(_0x50367b[_0x5f2b('0x32')]['filter']){_0x446cec[_0x5f2b('0x3b')]=_[_0x5f2b('0x3e')](_0x446cec['where'],{'$or':_[_0x5f2b('0x2c')](_0x446cec['attributes'],function(_0x400f16){var _0x2b9f68={};_0x2b9f68[_0x400f16]={'$like':'%'+_0x50367b[_0x5f2b('0x32')]['filter']+'%'};return _0x2b9f68;})});}_0x446cec=_[_0x5f2b('0x3e')]({},_0x446cec,_0x50367b[_0x5f2b('0x47')]);return db['UserMailQueue'][_0x5f2b('0x5a')](_0x446cec);}})['then'](function(_0xbe0bca){if(_0xbe0bca){return db[_0x5f2b('0x5b')][_0x5f2b('0x5c')]({'where':{'id':_[_0x5f2b('0x2c')](_0xbe0bca,'UserId'),'role':_0x5f2b('0x5d')},'attributes':['id','name','mailPause','updatedAt',_0x5f2b('0x5e')]});}})[_0x5f2b('0x23')](function(_0x5eb337){if(_0x5eb337){return{'count':_0x5eb337[_0x5f2b('0x42')],'rows':_[_0x5f2b('0x2c')](_0x5eb337[_0x5f2b('0x43')],function(_0x231424){return{'membername':_0x231424[_0x5f2b('0x41')],'UserId':_0x231424['id'],'queue_name':_0x41cd34[_0x5f2b('0x41')],'MailQueueId':_0x41cd34['id'],'interface':util['format'](_0x5f2b('0x5f'),_0x5f2b('0x60'),_0x231424['name']),'penalty':0x0,'paused':_0x231424['mailPause'],'createdAt':_0x231424[_0x5f2b('0x5e')],'updatedAt':_0x231424[_0x5f2b('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5f2b('0x23')](respondWithFilteredResult(_0x59eb4a,_0x446cec))[_0x5f2b('0x44')](handleError(_0x59eb4a,null));};exports['getTeams']=function(_0x592109,_0x350772,_0x216b4e){var _0x4da5d7={};var _0x5ece1d={};var _0x286263;var _0x123e86;return db[_0x5f2b('0x2d')][_0x5f2b('0x55')]({'where':{'id':_0x592109['params']['id']}})[_0x5f2b('0x23')](handleEntityNotFound(_0x350772,null))['then'](function(_0x3a7e44){if(_0x3a7e44){_0x286263=_0x3a7e44;_0x5ece1d[_0x5f2b('0x31')]=_['keys'](db[_0x5f2b('0x62')]['rawAttributes']);_0x5ece1d[_0x5f2b('0x32')]=_[_0x5f2b('0x33')](_0x592109['query']);_0x5ece1d['filters']=_['intersection'](_0x5ece1d['model'],_0x5ece1d[_0x5f2b('0x32')]);_0x4da5d7['attributes']=_['intersection'](_0x5ece1d[_0x5f2b('0x31')],qs[_0x5f2b('0x37')](_0x592109[_0x5f2b('0x32')]['fields']));_0x4da5d7[_0x5f2b('0x36')]=_0x4da5d7[_0x5f2b('0x36')][_0x5f2b('0x38')]?_0x4da5d7[_0x5f2b('0x36')]:_0x5ece1d[_0x5f2b('0x31')];_0x4da5d7[_0x5f2b('0x58')]=qs['sort'](_0x592109[_0x5f2b('0x32')][_0x5f2b('0x3a')]);_0x4da5d7[_0x5f2b('0x3b')]=qs['filters'](_[_0x5f2b('0x3c')](_0x592109[_0x5f2b('0x32')],_0x5ece1d[_0x5f2b('0x34')]));if(_0x592109[_0x5f2b('0x32')][_0x5f2b('0x3d')]){_0x4da5d7[_0x5f2b('0x3b')]=_[_0x5f2b('0x3e')](_0x4da5d7[_0x5f2b('0x3b')],{'$or':_[_0x5f2b('0x2c')](_0x4da5d7[_0x5f2b('0x36')],function(_0xa4ec54){var _0x3a616f={};_0x3a616f[_0xa4ec54]={'$like':'%'+_0x592109[_0x5f2b('0x32')]['filter']+'%'};return _0x3a616f;})});}_0x4da5d7=_[_0x5f2b('0x3e')]({},_0x4da5d7,_0x592109[_0x5f2b('0x47')]);return _0x286263['getTeams'](_0x4da5d7);}})[_0x5f2b('0x23')](function(_0x499436){if(_0x499436){_0x123e86=_0x499436[_0x5f2b('0x38')];if(!_0x592109['query'][_0x5f2b('0x39')](_0x5f2b('0x57'))){_0x4da5d7['limit']=qs[_0x5f2b('0x1e')](_0x592109[_0x5f2b('0x32')][_0x5f2b('0x1e')]);_0x4da5d7[_0x5f2b('0x1d')]=qs[_0x5f2b('0x1d')](_0x592109[_0x5f2b('0x32')][_0x5f2b('0x1d')]);}return _0x286263[_0x5f2b('0x63')](_0x4da5d7);}})[_0x5f2b('0x23')](function(_0x226449){if(_0x226449){return _0x226449?{'count':_0x123e86,'rows':_0x226449}:null;}})[_0x5f2b('0x23')](respondWithResult(_0x350772,null))['catch'](handleError(_0x350772,null));};exports[_0x5f2b('0x64')]=function(_0xb0385c,_0x210c38,_0x250435){var _0xff8cf=_0xb0385c[_0x5f2b('0x4a')][_0x5f2b('0x65')];return db[_0x5f2b('0x62')]['findAll']({'where':{'id':_0xff8cf},'attributes':['id'],'include':[{'model':db[_0x5f2b('0x5b')],'as':_0x5f2b('0x66'),'attributes':['id',_0x5f2b('0x41'),_0x5f2b('0x67'),_0x5f2b('0x68'),_0x5f2b('0x69')],'raw':!![]}]})[_0x5f2b('0x23')](function(_0x554b78){if(_0x554b78){var _0xc36298=_[_0x5f2b('0x6a')](_0x554b78,function(_0x2008af){var _0x33cc69=_0x2008af[_0x5f2b('0x25')]({'plain':!![]});return _0x33cc69[_0x5f2b('0x66')];});return db['MailQueue'][_0x5f2b('0x48')]({'where':{'id':_0xb0385c[_0x5f2b('0x52')]['id']}})[_0x5f2b('0x23')](function(_0x3173fa){return db['sequelize'][_0x5f2b('0x6b')](function(_0x3204c2){return _0x3173fa['addTeams'](_0xff8cf,{'transaction':_0x3204c2})[_0x5f2b('0x23')](function(){return BPromise[_0x5f2b('0x6c')](_0xc36298,function(_0x105c93){return db['UserMailQueue'][_0x5f2b('0x6d')]({'where':{'UserId':_0x105c93['id'],'MailQueueId':_0xb0385c[_0x5f2b('0x52')]['id']},'transaction':_0x3204c2});});})['then'](function(){_0xc36298[_0x5f2b('0x6e')](function(_0x16c7da){socket[_0x5f2b('0x6f')](_0x5f2b('0x70'),{'UserId':_0x16c7da['id'],'MailQueueId':_0x3173fa['id']});});});});});}})[_0x5f2b('0x23')](respondWithStatusCode(_0x210c38,null))[_0x5f2b('0x44')](handleError(_0x210c38,null));};exports['removeTeams']=function(_0x50e861,_0x510f96,_0x5d05d3){return db[_0x5f2b('0x62')][_0x5f2b('0x5a')]({'where':{'id':_0x50e861[_0x5f2b('0x32')][_0x5f2b('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5f2b('0x66'),'attributes':['id'],'raw':!![]}]})[_0x5f2b('0x23')](handleEntityNotFound(_0x510f96,null))[_0x5f2b('0x23')](function(_0x412d60){var _0x3577b4=_[_0x5f2b('0x2c')](_0x412d60,'id');var _0x34697e=[];var _0x55e684=[];var _0x39ed00=squel[_0x5f2b('0x71')]();_0x39ed00['field'](_0x5f2b('0x72'))['from'](_0x5f2b('0x73'),'tq')['join']('user_has_teams','ut',_0x5f2b('0x74'))['where'](_0x5f2b('0x75'),_0x50e861[_0x5f2b('0x52')]['id']);for(var _0x1bf189=0x0;_0x1bf189<_0x412d60[_0x5f2b('0x38')];_0x1bf189+=0x1){let _0x364f53=_0x412d60[_0x1bf189];for(var _0x45f7d8=0x0;_0x45f7d8<_0x364f53[_0x5f2b('0x66')][_0x5f2b('0x38')];_0x45f7d8+=0x1){let _0x524956=_0x364f53[_0x5f2b('0x66')][_0x45f7d8];var _0x36a63b=_0x39ed00['clone']();_0x36a63b[_0x5f2b('0x3b')](_0x5f2b('0x76'),_0x524956['id']);_0x55e684[_0x5f2b('0x77')](db[_0x5f2b('0x78')][_0x5f2b('0x32')](_0x36a63b[_0x5f2b('0x79')](),{'type':db[_0x5f2b('0x78')][_0x5f2b('0x7a')][_0x5f2b('0x7b')]})[_0x5f2b('0x23')](function(_0x1ee983){if(_0x1ee983[_0x5f2b('0x38')]===0x1){return _0x524956['id'];}else{var _0x46d341=_[_0x5f2b('0x7c')](_[_0x5f2b('0x2c')](_0x1ee983,'TeamId'),function(_0x4eff60){return _[_0x5f2b('0x7d')](_0x3577b4,_0x4eff60);});if(_0x46d341){return _0x524956['id'];}}}));}}return BPromise[_0x5f2b('0x7e')](_0x55e684)[_0x5f2b('0x23')](function(_0x352082){_0x34697e=_(_0x34697e)[_0x5f2b('0x7f')](_0x352082)['compact']()[_0x5f2b('0x80')]();return db['MailQueue'][_0x5f2b('0x48')]({'where':{'id':_0x50e861[_0x5f2b('0x52')]['id']}})[_0x5f2b('0x23')](function(_0x20a23d){return db[_0x5f2b('0x78')][_0x5f2b('0x6b')](function(_0x40ba62){return _0x20a23d['removeTeams'](_0x50e861[_0x5f2b('0x32')][_0x5f2b('0x65')],{'transaction':_0x40ba62})[_0x5f2b('0x23')](function(){if(!_[_0x5f2b('0x81')](_0x34697e)){return _0x20a23d[_0x5f2b('0x82')](_0x34697e,{'transaction':_0x40ba62});}})['then'](function(){_0x34697e['forEach'](function(_0x2dd0e0){socket[_0x5f2b('0x6f')](_0x5f2b('0x83'),{'UserId':_0x2dd0e0,'MailQueueId':_0x20a23d['id']});});});});});});})['then'](respondWithStatusCode(_0x510f96,null))[_0x5f2b('0x44')](handleError(_0x510f96,null));};exports['addAgents']=function(_0x98076b,_0x3357c4,_0x2e6028){return db[_0x5f2b('0x2d')][_0x5f2b('0x48')]({'where':{'id':_0x98076b[_0x5f2b('0x52')]['id']}})[_0x5f2b('0x23')](handleEntityNotFound(_0x3357c4,null))['then'](function(_0x77503d){if(_0x77503d){return _0x77503d[_0x5f2b('0x84')](_0x98076b[_0x5f2b('0x4a')][_0x5f2b('0x65')],_[_0x5f2b('0x85')](_0x98076b['body'],[_0x5f2b('0x65'),'id'])||{})[_0x5f2b('0x86')](function(_0x3b1373){for(var _0x3c7c08=0x0;_0x3c7c08<_0x98076b['body'][_0x5f2b('0x65')]['length'];_0x3c7c08+=0x1){socket['emit'](_0x5f2b('0x70'),{'UserId':_0x98076b[_0x5f2b('0x4a')][_0x5f2b('0x65')][_0x3c7c08],'MailQueueId':_0x98076b['params']['id']});}return _0x3b1373;});}})[_0x5f2b('0x23')](respondWithResult(_0x3357c4,null))[_0x5f2b('0x44')](handleError(_0x3357c4,null));};exports[_0x5f2b('0x82')]=function(_0x5ebe71,_0x54c4d9,_0x12a7bb){return db['MailQueue'][_0x5f2b('0x48')]({'where':{'id':_0x5ebe71[_0x5f2b('0x52')]['id']}})[_0x5f2b('0x23')](handleEntityNotFound(_0x54c4d9,null))['then'](function(_0x3f3d3f){if(_0x3f3d3f){return _0x3f3d3f[_0x5f2b('0x82')](_0x5ebe71[_0x5f2b('0x32')][_0x5f2b('0x65')])[_0x5f2b('0x23')](function(){if(_[_0x5f2b('0x87')](_0x5ebe71[_0x5f2b('0x32')][_0x5f2b('0x65')])){for(var _0xee15fd=0x0;_0xee15fd<_0x5ebe71[_0x5f2b('0x32')][_0x5f2b('0x65')]['length'];_0xee15fd+=0x1){socket[_0x5f2b('0x6f')](_0x5f2b('0x83'),{'UserId':Number(_0x5ebe71[_0x5f2b('0x32')]['ids'][_0xee15fd]),'MailQueueId':Number(_0x5ebe71['params']['id'])});}}else{socket[_0x5f2b('0x6f')](_0x5f2b('0x83'),{'UserId':Number(_0x5ebe71[_0x5f2b('0x32')][_0x5f2b('0x65')]),'MailQueueId':Number(_0x5ebe71['params']['id'])});}});}})[_0x5f2b('0x23')](respondWithStatusCode(_0x54c4d9,null))[_0x5f2b('0x44')](handleError(_0x54c4d9,null));};exports['getAgents']=function(_0x5c515a,_0x13b1b7,_0x321d2a){var _0x3caee5={};var _0x3ba8b6={};var _0x30e8fd;var _0x64c227;return db[_0x5f2b('0x2d')][_0x5f2b('0x55')]({'where':{'id':_0x5c515a[_0x5f2b('0x52')]['id']}})[_0x5f2b('0x23')](handleEntityNotFound(_0x13b1b7,null))['then'](function(_0x4d2088){if(_0x4d2088){_0x30e8fd=_0x4d2088;_0x3ba8b6[_0x5f2b('0x31')]=_[_0x5f2b('0x33')](db[_0x5f2b('0x5b')]['rawAttributes']);_0x3ba8b6[_0x5f2b('0x32')]=_[_0x5f2b('0x33')](_0x5c515a[_0x5f2b('0x32')]);_0x3ba8b6[_0x5f2b('0x34')]=_['intersection'](_0x3ba8b6[_0x5f2b('0x31')],_0x3ba8b6[_0x5f2b('0x32')]);_0x3caee5['attributes']=_['intersection'](_0x3ba8b6[_0x5f2b('0x31')],qs['fields'](_0x5c515a[_0x5f2b('0x32')][_0x5f2b('0x37')]));_0x3caee5[_0x5f2b('0x36')]=_0x3caee5['attributes']['length']?_0x3caee5[_0x5f2b('0x36')]:_0x3ba8b6['model'];_0x3caee5[_0x5f2b('0x58')]=qs['sort'](_0x5c515a['query'][_0x5f2b('0x3a')]);_0x3caee5[_0x5f2b('0x3b')]=qs['filters'](_[_0x5f2b('0x3c')](_0x5c515a[_0x5f2b('0x32')],_0x3ba8b6[_0x5f2b('0x34')]));if(_0x5c515a[_0x5f2b('0x32')][_0x5f2b('0x3d')]){_0x3caee5['where']=_[_0x5f2b('0x3e')](_0x3caee5[_0x5f2b('0x3b')],{'$or':_['map'](_0x3caee5[_0x5f2b('0x36')],function(_0x5ed588){var _0x2cb3f3={};_0x2cb3f3[_0x5ed588]={'$like':'%'+_0x5c515a[_0x5f2b('0x32')]['filter']+'%'};return _0x2cb3f3;})});}_0x3caee5=_[_0x5f2b('0x3e')]({},_0x3caee5,_0x5c515a[_0x5f2b('0x47')]);return _0x30e8fd[_0x5f2b('0x88')](_0x3caee5);}})['then'](function(_0x3cb8b6){if(_0x3cb8b6){_0x64c227=_0x3cb8b6['length'];if(!_0x5c515a[_0x5f2b('0x32')][_0x5f2b('0x39')](_0x5f2b('0x57'))){_0x3caee5[_0x5f2b('0x1e')]=qs['limit'](_0x5c515a[_0x5f2b('0x32')]['limit']);_0x3caee5[_0x5f2b('0x1d')]=qs[_0x5f2b('0x1d')](_0x5c515a['query']['offset']);}return _0x30e8fd['getAgents'](_0x3caee5);}})[_0x5f2b('0x23')](function(_0x2d5d06){if(_0x2d5d06){return _0x2d5d06?{'count':_0x64c227,'rows':_0x2d5d06}:null;}})[_0x5f2b('0x23')](respondWithResult(_0x13b1b7,null))[_0x5f2b('0x44')](handleError(_0x13b1b7,null));}; \ No newline at end of file +var _0x0be9=['create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','findAndCountAll','UserId','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','User','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','order','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','then','MailQueues','UserProfileResource','destroy','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','MailQueue','findAll','rows','params','length','find','catch'];(function(_0x43cba5,_0x4a2f83){var _0x359d1a=function(_0x888a02){while(--_0x888a02){_0x43cba5['push'](_0x43cba5['shift']());}};_0x359d1a(++_0x4a2f83);}(_0x0be9,0x1e3));var _0x90be=function(_0x4c6612,_0x8fe2c4){_0x4c6612=_0x4c6612-0x0;var _0x3db3f7=_0x0be9[_0x4c6612];return _0x3db3f7;};'use strict';var pdf=require(_0x90be('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x90be('0x1'));var zipdir=require(_0x90be('0x2'));var jsonpatch=require(_0x90be('0x3'));var rp=require(_0x90be('0x4'));var moment=require(_0x90be('0x5'));var BPromise=require(_0x90be('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x90be('0x7'));var sox=require(_0x90be('0x8'));var csv=require(_0x90be('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x90be('0xa'));var crypto=require(_0x90be('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x90be('0x9'));var querystring=require(_0x90be('0xc'));var Papa=require(_0x90be('0xd'));var Redis=require(_0x90be('0xe'));var authService=require(_0x90be('0xf'));var qs=require(_0x90be('0x10'));var as=require(_0x90be('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90be('0x12'))('api');var utils=require(_0x90be('0x13'));var config=require(_0x90be('0x14'));var db=require(_0x90be('0x15'))['db'];config['redis']=_['defaults'](config[_0x90be('0x16')],{'host':_0x90be('0x17'),'port':0x18eb});var socket=require(_0x90be('0x18'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x90be('0x19')](socket);function respondWithStatusCode(_0x11215a,_0x15efde){_0x15efde=_0x15efde||0xcc;return function(_0x14f62e){if(_0x14f62e){return _0x11215a[_0x90be('0x1a')](_0x15efde);}return _0x11215a[_0x90be('0x1b')](_0x15efde)[_0x90be('0x1c')]();};}function respondWithResult(_0x355569,_0xe4af29){_0xe4af29=_0xe4af29||0xc8;return function(_0x19f077){if(_0x19f077){return _0x355569[_0x90be('0x1b')](_0xe4af29)['json'](_0x19f077);}};}function respondWithFilteredResult(_0x16d61a,_0x2e6118){return function(_0x9c600f){if(_0x9c600f){var _0x167e52=_0x9c600f[_0x90be('0x1d')],_0x484055=_0x2e6118['offset'],_0x1f77e2=_0x2e6118[_0x90be('0x1e')]+_0x2e6118[_0x90be('0x1f')],_0x2bcc51;if(_0x1f77e2>=_0x167e52){_0x1f77e2=_0x167e52;_0x2bcc51=0xc8;}else{_0x2bcc51=0xce;}_0x16d61a[_0x90be('0x1b')](_0x2bcc51);return _0x16d61a['set'](_0x90be('0x20'),_0x484055+'-'+_0x1f77e2+'/'+_0x167e52)[_0x90be('0x21')](_0x9c600f);}return null;};}function patchUpdates(_0x418c6c){return function(_0x4523c1){try{jsonpatch[_0x90be('0x22')](_0x4523c1,_0x418c6c,!![]);}catch(_0x2afcda){return BPromise['reject'](_0x2afcda);}return _0x4523c1[_0x90be('0x23')]();};}function saveUpdates(_0x9b8d61,_0x307213){return function(_0x3c79e0){if(_0x3c79e0){return _0x3c79e0[_0x90be('0x24')](_0x9b8d61)[_0x90be('0x25')](function(_0x4b6271){return _0x4b6271;});}return null;};}function removeEntity(_0x4fbe1a,_0x588dd1){return function(_0x513915){if(_0x513915){return _0x513915['destroy']()['then'](function(){var _0x5b6a35=_0x513915['get']({'plain':!![]});var _0x22535a=_0x90be('0x26');return db[_0x90be('0x27')][_0x90be('0x28')]({'where':{'type':_0x22535a,'resourceId':_0x5b6a35['id']}})[_0x90be('0x25')](function(){return _0x513915;});})[_0x90be('0x25')](function(){_0x4fbe1a[_0x90be('0x1b')](0xcc)[_0x90be('0x1c')]();});}};}function handleEntityNotFound(_0x5342ad,_0x5c93f3){return function(_0x2c5d06){if(!_0x2c5d06){_0x5342ad['sendStatus'](0x194);}return _0x2c5d06;};}function handleError(_0x520cbf,_0x226e4f){_0x226e4f=_0x226e4f||0x1f4;return function(_0x3b6301){logger['error'](_0x3b6301['stack']);if(_0x3b6301[_0x90be('0x29')]){delete _0x3b6301['name'];}_0x520cbf['status'](_0x226e4f)[_0x90be('0x2a')](_0x3b6301);};}exports[_0x90be('0x2b')]=function(_0x1cea5c,_0x7383ce){var _0x4ffb21={},_0x1bf3ac={},_0x1395da={'count':0x0,'rows':[]};var _0x518bed=_[_0x90be('0x2c')](db['MailQueue'][_0x90be('0x2d')],function(_0x2cfb1a){return{'name':_0x2cfb1a[_0x90be('0x2e')],'type':_0x2cfb1a[_0x90be('0x2f')][_0x90be('0x30')]};});_0x1bf3ac['model']=_[_0x90be('0x2c')](_0x518bed,_0x90be('0x29'));_0x1bf3ac[_0x90be('0x31')]=_[_0x90be('0x32')](_0x1cea5c[_0x90be('0x31')]);_0x1bf3ac[_0x90be('0x33')]=_[_0x90be('0x34')](_0x1bf3ac[_0x90be('0x35')],_0x1bf3ac[_0x90be('0x31')]);_0x4ffb21[_0x90be('0x36')]=_['intersection'](_0x1bf3ac[_0x90be('0x35')],qs[_0x90be('0x37')](_0x1cea5c['query']['fields']));_0x4ffb21[_0x90be('0x36')]=_0x4ffb21[_0x90be('0x36')]['length']?_0x4ffb21['attributes']:_0x1bf3ac[_0x90be('0x35')];if(!_0x1cea5c[_0x90be('0x31')][_0x90be('0x38')](_0x90be('0x39'))){_0x4ffb21['limit']=qs[_0x90be('0x1f')](_0x1cea5c[_0x90be('0x31')][_0x90be('0x1f')]);_0x4ffb21[_0x90be('0x1e')]=qs[_0x90be('0x1e')](_0x1cea5c[_0x90be('0x31')]['offset']);}_0x4ffb21['order']=qs['sort'](_0x1cea5c[_0x90be('0x31')][_0x90be('0x3a')]);_0x4ffb21[_0x90be('0x3b')]=qs[_0x90be('0x33')](_['pick'](_0x1cea5c[_0x90be('0x31')],_0x1bf3ac['filters']),_0x518bed);if(_0x1cea5c[_0x90be('0x31')][_0x90be('0x3c')]){_0x4ffb21['where']=_['merge'](_0x4ffb21[_0x90be('0x3b')],{'$or':_[_0x90be('0x2c')](_0x518bed,function(_0x5e05e8){if(_0x5e05e8[_0x90be('0x2f')]!==_0x90be('0x3d')){var _0x1da07d={};_0x1da07d[_0x5e05e8[_0x90be('0x29')]]={'$like':'%'+_0x1cea5c[_0x90be('0x31')][_0x90be('0x3c')]+'%'};return _0x1da07d;}})});}_0x4ffb21=_[_0x90be('0x3e')]({},_0x4ffb21,_0x1cea5c[_0x90be('0x3f')]);var _0x5dc0a7={'where':_0x4ffb21['where']};return db['MailQueue']['count'](_0x5dc0a7)[_0x90be('0x25')](function(_0x27748e){_0x1395da[_0x90be('0x1d')]=_0x27748e;if(_0x1cea5c[_0x90be('0x31')][_0x90be('0x40')]){_0x4ffb21[_0x90be('0x41')]=[{'all':!![]}];}return db[_0x90be('0x42')][_0x90be('0x43')](_0x4ffb21);})[_0x90be('0x25')](function(_0x500e5e){_0x1395da[_0x90be('0x44')]=_0x500e5e;return _0x1395da;})['then'](respondWithFilteredResult(_0x7383ce,_0x4ffb21))['catch'](handleError(_0x7383ce,null));};exports['show']=function(_0x52f7d2,_0x39f0ca){var _0x4c6f60={'raw':!![],'where':{'id':_0x52f7d2[_0x90be('0x45')]['id']}},_0x132981={};_0x132981[_0x90be('0x35')]=_[_0x90be('0x32')](db[_0x90be('0x42')][_0x90be('0x2d')]);_0x132981[_0x90be('0x31')]=_[_0x90be('0x32')](_0x52f7d2['query']);_0x132981['filters']=_[_0x90be('0x34')](_0x132981[_0x90be('0x35')],_0x132981[_0x90be('0x31')]);_0x4c6f60['attributes']=_[_0x90be('0x34')](_0x132981['model'],qs[_0x90be('0x37')](_0x52f7d2['query'][_0x90be('0x37')]));_0x4c6f60[_0x90be('0x36')]=_0x4c6f60[_0x90be('0x36')][_0x90be('0x46')]?_0x4c6f60[_0x90be('0x36')]:_0x132981['model'];if(_0x52f7d2[_0x90be('0x31')][_0x90be('0x40')]){_0x4c6f60[_0x90be('0x41')]=[{'all':!![]}];}_0x4c6f60=_[_0x90be('0x3e')]({},_0x4c6f60,_0x52f7d2['options']);return db[_0x90be('0x42')][_0x90be('0x47')](_0x4c6f60)[_0x90be('0x25')](handleEntityNotFound(_0x39f0ca,null))[_0x90be('0x25')](respondWithResult(_0x39f0ca,null))[_0x90be('0x48')](handleError(_0x39f0ca,null));};exports[_0x90be('0x49')]=function(_0x36e41b,_0x513b72){return db[_0x90be('0x42')][_0x90be('0x49')](_0x36e41b[_0x90be('0x4a')],{})[_0x90be('0x25')](function(_0x51254d){var _0x20197d=_0x36e41b['user'][_0x90be('0x4b')]({'plain':!![]});if(!_0x20197d)throw new Error(_0x90be('0x4c'));if(_0x20197d[_0x90be('0x4d')]===_0x90be('0x4e')){var _0x20ab94=_0x51254d['get']({'plain':!![]});var _0x3e1465=_0x90be('0x26');return db['UserProfileSection'][_0x90be('0x47')]({'where':{'name':_0x3e1465,'userProfileId':_0x20197d[_0x90be('0x4f')]},'raw':!![]})[_0x90be('0x25')](function(_0xde9b27){if(_0xde9b27&&_0xde9b27[_0x90be('0x50')]===0x0){return db[_0x90be('0x27')][_0x90be('0x49')]({'name':_0x20ab94['name'],'resourceId':_0x20ab94['id'],'type':_0xde9b27[_0x90be('0x29')],'sectionId':_0xde9b27['id']},{})[_0x90be('0x25')](function(){return _0x51254d;});}else{return _0x51254d;}})['catch'](function(_0xf291dd){logger[_0x90be('0x51')](_0x90be('0x52'),_0xf291dd);throw _0xf291dd;});}return _0x51254d;})[_0x90be('0x25')](respondWithResult(_0x513b72,0xc9))[_0x90be('0x48')](handleError(_0x513b72,null));};exports['update']=function(_0x69f185,_0x17b05b){if(_0x69f185[_0x90be('0x4a')]['id']){delete _0x69f185['body']['id'];}return db['MailQueue']['find']({'where':{'id':_0x69f185['params']['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x17b05b,null))[_0x90be('0x25')](saveUpdates(_0x69f185['body'],null))['then'](respondWithResult(_0x17b05b,null))[_0x90be('0x48')](handleError(_0x17b05b,null));};exports[_0x90be('0x28')]=function(_0x4813f6,_0x440227){return db[_0x90be('0x42')][_0x90be('0x47')]({'where':{'id':_0x4813f6[_0x90be('0x45')]['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x440227,null))[_0x90be('0x25')](removeEntity(_0x440227,null))[_0x90be('0x48')](handleError(_0x440227,null));};exports['describe']=function(_0xdee6a1,_0x584a4a){return db[_0x90be('0x42')][_0x90be('0x53')]()[_0x90be('0x25')](respondWithResult(_0x584a4a,null))['catch'](handleError(_0x584a4a,null));};exports[_0x90be('0x54')]=function(_0x24dd4e,_0x110d01,_0x2e3d65){var _0xcac5e9={'raw':!![],'where':{}},_0x14f22b={},_0x32bbec;return db[_0x90be('0x42')][_0x90be('0x55')]({'where':{'id':_0x24dd4e[_0x90be('0x45')]['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x110d01,null))['then'](function(_0x489a9a){if(_0x489a9a){_0x32bbec=_0x489a9a[_0x90be('0x4b')]({'plain':!![]});_0x14f22b['model']=_[_0x90be('0x32')](db[_0x90be('0x56')]['rawAttributes']);_0x14f22b[_0x90be('0x31')]=_[_0x90be('0x32')](_0x24dd4e[_0x90be('0x31')]);_0x14f22b[_0x90be('0x33')]=_[_0x90be('0x34')](_0x14f22b[_0x90be('0x35')],_0x14f22b[_0x90be('0x31')]);_0xcac5e9[_0x90be('0x36')]=_[_0x90be('0x34')](_0x14f22b['model'],qs['fields'](_0x24dd4e[_0x90be('0x31')][_0x90be('0x37')]));_0xcac5e9[_0x90be('0x36')]=_0xcac5e9[_0x90be('0x36')][_0x90be('0x46')]?_0xcac5e9['attributes']:_0x14f22b[_0x90be('0x35')];if(!_0x24dd4e[_0x90be('0x31')][_0x90be('0x38')](_0x90be('0x39'))){_0xcac5e9[_0x90be('0x1f')]=qs[_0x90be('0x1f')](_0x24dd4e[_0x90be('0x31')][_0x90be('0x1f')]);_0xcac5e9[_0x90be('0x1e')]=qs['offset'](_0x24dd4e['query'][_0x90be('0x1e')]);}_0xcac5e9['order']=qs[_0x90be('0x3a')](_0x24dd4e['query'][_0x90be('0x3a')]);_0xcac5e9['where']=qs[_0x90be('0x33')](_['pick'](_0x24dd4e[_0x90be('0x31')],_0x14f22b[_0x90be('0x33')]));_0xcac5e9[_0x90be('0x3b')][_0x90be('0x57')]=_0x489a9a['id'];if(_0x24dd4e[_0x90be('0x31')][_0x90be('0x3c')]){_0xcac5e9[_0x90be('0x3b')]=_[_0x90be('0x3e')](_0xcac5e9[_0x90be('0x3b')],{'$or':_[_0x90be('0x2c')](_0xcac5e9[_0x90be('0x36')],function(_0x57581f){var _0x333a2a={};_0x333a2a[_0x57581f]={'$like':'%'+_0x24dd4e[_0x90be('0x31')][_0x90be('0x3c')]+'%'};return _0x333a2a;})});}_0xcac5e9=_['merge']({},_0xcac5e9,_0x24dd4e[_0x90be('0x3f')]);return db[_0x90be('0x56')]['findAll'](_0xcac5e9);}})['then'](function(_0x852095){if(_0x852095){return db['User'][_0x90be('0x58')]({'where':{'id':_[_0x90be('0x2c')](_0x852095,_0x90be('0x59')),'role':'agent'},'attributes':['id',_0x90be('0x29'),_0x90be('0x5a'),_0x90be('0x5b'),'createdAt']});}})[_0x90be('0x25')](function(_0x443a59){if(_0x443a59){return{'count':_0x443a59[_0x90be('0x1d')],'rows':_[_0x90be('0x2c')](_0x443a59[_0x90be('0x44')],function(_0x2c26c5){return{'membername':_0x2c26c5[_0x90be('0x29')],'UserId':_0x2c26c5['id'],'queue_name':_0x32bbec['name'],'MailQueueId':_0x32bbec['id'],'interface':util[_0x90be('0x5c')](_0x90be('0x5d'),_0x90be('0x5e'),_0x2c26c5[_0x90be('0x29')]),'penalty':0x0,'paused':_0x2c26c5[_0x90be('0x5a')],'createdAt':_0x2c26c5[_0x90be('0x5f')],'updatedAt':_0x2c26c5[_0x90be('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x90be('0x25')](respondWithFilteredResult(_0x110d01,_0xcac5e9))['catch'](handleError(_0x110d01,null));};exports[_0x90be('0x60')]=function(_0xbbc425,_0x166708,_0x4c6a00){var _0x1095a7={};var _0x3ca8b7={};var _0x5000ed;var _0x58fe5e;return db[_0x90be('0x42')][_0x90be('0x55')]({'where':{'id':_0xbbc425[_0x90be('0x45')]['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x166708,null))[_0x90be('0x25')](function(_0x20cf19){if(_0x20cf19){_0x5000ed=_0x20cf19;_0x3ca8b7[_0x90be('0x35')]=_[_0x90be('0x32')](db[_0x90be('0x61')][_0x90be('0x2d')]);_0x3ca8b7[_0x90be('0x31')]=_[_0x90be('0x32')](_0xbbc425['query']);_0x3ca8b7[_0x90be('0x33')]=_[_0x90be('0x34')](_0x3ca8b7[_0x90be('0x35')],_0x3ca8b7[_0x90be('0x31')]);_0x1095a7[_0x90be('0x36')]=_['intersection'](_0x3ca8b7[_0x90be('0x35')],qs['fields'](_0xbbc425['query'][_0x90be('0x37')]));_0x1095a7['attributes']=_0x1095a7[_0x90be('0x36')][_0x90be('0x46')]?_0x1095a7['attributes']:_0x3ca8b7[_0x90be('0x35')];_0x1095a7['order']=qs[_0x90be('0x3a')](_0xbbc425[_0x90be('0x31')][_0x90be('0x3a')]);_0x1095a7['where']=qs[_0x90be('0x33')](_[_0x90be('0x62')](_0xbbc425[_0x90be('0x31')],_0x3ca8b7[_0x90be('0x33')]));if(_0xbbc425[_0x90be('0x31')][_0x90be('0x3c')]){_0x1095a7[_0x90be('0x3b')]=_[_0x90be('0x3e')](_0x1095a7['where'],{'$or':_[_0x90be('0x2c')](_0x1095a7[_0x90be('0x36')],function(_0x39f1df){var _0x237029={};_0x237029[_0x39f1df]={'$like':'%'+_0xbbc425[_0x90be('0x31')][_0x90be('0x3c')]+'%'};return _0x237029;})});}_0x1095a7=_[_0x90be('0x3e')]({},_0x1095a7,_0xbbc425[_0x90be('0x3f')]);return _0x5000ed['getTeams'](_0x1095a7);}})[_0x90be('0x25')](function(_0x592597){if(_0x592597){_0x58fe5e=_0x592597[_0x90be('0x46')];if(!_0xbbc425[_0x90be('0x31')][_0x90be('0x38')](_0x90be('0x39'))){_0x1095a7[_0x90be('0x1f')]=qs[_0x90be('0x1f')](_0xbbc425[_0x90be('0x31')]['limit']);_0x1095a7[_0x90be('0x1e')]=qs[_0x90be('0x1e')](_0xbbc425[_0x90be('0x31')]['offset']);}return _0x5000ed[_0x90be('0x60')](_0x1095a7);}})[_0x90be('0x25')](function(_0x50db67){if(_0x50db67){return _0x50db67?{'count':_0x58fe5e,'rows':_0x50db67}:null;}})['then'](respondWithResult(_0x166708,null))[_0x90be('0x48')](handleError(_0x166708,null));};exports[_0x90be('0x63')]=function(_0x4db05c,_0x566ef5,_0x3df0da){var _0x50e8b0=_0x4db05c[_0x90be('0x4a')][_0x90be('0x64')];return db[_0x90be('0x61')]['findAll']({'where':{'id':_0x50e8b0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x90be('0x65'),'attributes':['id',_0x90be('0x29'),_0x90be('0x66'),_0x90be('0x67'),_0x90be('0x68')],'raw':!![]}]})[_0x90be('0x25')](function(_0x4d808e){if(_0x4d808e){var _0x540aec=_[_0x90be('0x69')](_0x4d808e,function(_0x15bb4b){var _0x503ec5=_0x15bb4b[_0x90be('0x4b')]({'plain':!![]});return _0x503ec5['Agents'];});return db[_0x90be('0x42')]['find']({'where':{'id':_0x4db05c[_0x90be('0x45')]['id']}})[_0x90be('0x25')](function(_0x236335){return db[_0x90be('0x6a')][_0x90be('0x6b')](function(_0x3827f7){return _0x236335['addTeams'](_0x50e8b0,{'transaction':_0x3827f7})[_0x90be('0x25')](function(){return BPromise[_0x90be('0x6c')](_0x540aec,function(_0xe6963a){return db[_0x90be('0x56')][_0x90be('0x6d')]({'where':{'UserId':_0xe6963a['id'],'MailQueueId':_0x4db05c[_0x90be('0x45')]['id']},'transaction':_0x3827f7});});})[_0x90be('0x25')](function(){_0x540aec[_0x90be('0x6e')](function(_0x175982){socket[_0x90be('0x6f')](_0x90be('0x70'),{'UserId':_0x175982['id'],'MailQueueId':_0x236335['id']});});});});});}})[_0x90be('0x25')](respondWithStatusCode(_0x566ef5,null))[_0x90be('0x48')](handleError(_0x566ef5,null));};exports[_0x90be('0x71')]=function(_0x557c96,_0x346fbc,_0x3f81a1){return db[_0x90be('0x61')][_0x90be('0x43')]({'where':{'id':_0x557c96['query'][_0x90be('0x64')]},'attributes':['id'],'include':[{'model':db[_0x90be('0x72')],'as':_0x90be('0x65'),'attributes':['id'],'raw':!![]}]})[_0x90be('0x25')](handleEntityNotFound(_0x346fbc,null))[_0x90be('0x25')](function(_0x197331){var _0x22e4fd=_[_0x90be('0x2c')](_0x197331,'id');var _0x5d6e6d=[];var _0x5319c6=[];var _0x1d399e=squel[_0x90be('0x73')]();_0x1d399e[_0x90be('0x74')]('tq.TeamId')[_0x90be('0x75')](_0x90be('0x76'),'tq')[_0x90be('0x77')](_0x90be('0x78'),'ut',_0x90be('0x79'))[_0x90be('0x3b')]('MailQueueId\x20=\x20?',_0x557c96['params']['id']);for(var _0xeab91e=0x0;_0xeab91e<_0x197331['length'];_0xeab91e+=0x1){let _0x13dc78=_0x197331[_0xeab91e];for(var _0x3998a0=0x0;_0x3998a0<_0x13dc78[_0x90be('0x65')][_0x90be('0x46')];_0x3998a0+=0x1){let _0x3dddf8=_0x13dc78[_0x90be('0x65')][_0x3998a0];var _0x5f5941=_0x1d399e['clone']();_0x5f5941[_0x90be('0x3b')]('ut.UserId\x20=\x20?',_0x3dddf8['id']);_0x5319c6[_0x90be('0x7a')](db[_0x90be('0x6a')]['query'](_0x5f5941[_0x90be('0x7b')](),{'type':db[_0x90be('0x6a')][_0x90be('0x7c')][_0x90be('0x7d')]})[_0x90be('0x25')](function(_0x11d1c8){if(_0x11d1c8[_0x90be('0x46')]===0x1){return _0x3dddf8['id'];}else{var _0x4fbf1b=_['every'](_['map'](_0x11d1c8,_0x90be('0x7e')),function(_0x280253){return _[_0x90be('0x7f')](_0x22e4fd,_0x280253);});if(_0x4fbf1b){return _0x3dddf8['id'];}}}));}}return BPromise[_0x90be('0x80')](_0x5319c6)['then'](function(_0x2ecbf3){_0x5d6e6d=_(_0x5d6e6d)[_0x90be('0x81')](_0x2ecbf3)[_0x90be('0x82')]()[_0x90be('0x83')]();return db[_0x90be('0x42')][_0x90be('0x47')]({'where':{'id':_0x557c96[_0x90be('0x45')]['id']}})['then'](function(_0x55818d){return db[_0x90be('0x6a')][_0x90be('0x6b')](function(_0x140419){return _0x55818d[_0x90be('0x71')](_0x557c96[_0x90be('0x31')][_0x90be('0x64')],{'transaction':_0x140419})[_0x90be('0x25')](function(){if(!_[_0x90be('0x84')](_0x5d6e6d)){return _0x55818d[_0x90be('0x85')](_0x5d6e6d,{'transaction':_0x140419});}})[_0x90be('0x25')](function(){_0x5d6e6d[_0x90be('0x6e')](function(_0x448da5){socket[_0x90be('0x6f')](_0x90be('0x86'),{'UserId':_0x448da5,'MailQueueId':_0x55818d['id']});});});});});});})[_0x90be('0x25')](respondWithStatusCode(_0x346fbc,null))['catch'](handleError(_0x346fbc,null));};exports[_0x90be('0x87')]=function(_0xd01921,_0x3be7b0,_0x3dbaf0){return db[_0x90be('0x42')][_0x90be('0x47')]({'where':{'id':_0xd01921['params']['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x3be7b0,null))[_0x90be('0x25')](function(_0x4646bc){if(_0x4646bc){return _0x4646bc[_0x90be('0x87')](_0xd01921[_0x90be('0x4a')][_0x90be('0x64')],_['omit'](_0xd01921[_0x90be('0x4a')],[_0x90be('0x64'),'id'])||{})['spread'](function(_0x1045ad){for(var _0x593e7a=0x0;_0x593e7a<_0xd01921[_0x90be('0x4a')][_0x90be('0x64')]['length'];_0x593e7a+=0x1){socket[_0x90be('0x6f')](_0x90be('0x70'),{'UserId':_0xd01921[_0x90be('0x4a')][_0x90be('0x64')][_0x593e7a],'MailQueueId':_0xd01921[_0x90be('0x45')]['id']});}return _0x1045ad;});}})['then'](respondWithResult(_0x3be7b0,null))[_0x90be('0x48')](handleError(_0x3be7b0,null));};exports[_0x90be('0x85')]=function(_0x1554b7,_0x42b8c3,_0x4bc2d3){return db['MailQueue']['find']({'where':{'id':_0x1554b7['params']['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x42b8c3,null))['then'](function(_0x1d8c81){if(_0x1d8c81){return _0x1d8c81['removeAgents'](_0x1554b7[_0x90be('0x31')]['ids'])[_0x90be('0x25')](function(){if(_[_0x90be('0x88')](_0x1554b7[_0x90be('0x31')][_0x90be('0x64')])){for(var _0x3e4787=0x0;_0x3e4787<_0x1554b7['query']['ids']['length'];_0x3e4787+=0x1){socket[_0x90be('0x6f')](_0x90be('0x86'),{'UserId':Number(_0x1554b7[_0x90be('0x31')][_0x90be('0x64')][_0x3e4787]),'MailQueueId':Number(_0x1554b7[_0x90be('0x45')]['id'])});}}else{socket['emit'](_0x90be('0x86'),{'UserId':Number(_0x1554b7[_0x90be('0x31')][_0x90be('0x64')]),'MailQueueId':Number(_0x1554b7[_0x90be('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x42b8c3,null))[_0x90be('0x48')](handleError(_0x42b8c3,null));};exports[_0x90be('0x89')]=function(_0x3e4172,_0x3b15aa,_0x1a3bc7){var _0x1a45dc={};var _0x17b020={};var _0x57fae6;var _0x46f044;return db[_0x90be('0x42')]['findOne']({'where':{'id':_0x3e4172[_0x90be('0x45')]['id']}})[_0x90be('0x25')](handleEntityNotFound(_0x3b15aa,null))['then'](function(_0x4b5310){if(_0x4b5310){_0x57fae6=_0x4b5310;_0x17b020[_0x90be('0x35')]=_[_0x90be('0x32')](db[_0x90be('0x72')][_0x90be('0x2d')]);_0x17b020[_0x90be('0x31')]=_[_0x90be('0x32')](_0x3e4172[_0x90be('0x31')]);_0x17b020[_0x90be('0x33')]=_[_0x90be('0x34')](_0x17b020[_0x90be('0x35')],_0x17b020[_0x90be('0x31')]);_0x1a45dc['attributes']=_[_0x90be('0x34')](_0x17b020[_0x90be('0x35')],qs[_0x90be('0x37')](_0x3e4172[_0x90be('0x31')][_0x90be('0x37')]));_0x1a45dc[_0x90be('0x36')]=_0x1a45dc[_0x90be('0x36')][_0x90be('0x46')]?_0x1a45dc[_0x90be('0x36')]:_0x17b020[_0x90be('0x35')];_0x1a45dc[_0x90be('0x8a')]=qs[_0x90be('0x3a')](_0x3e4172['query']['sort']);_0x1a45dc[_0x90be('0x3b')]=qs[_0x90be('0x33')](_['pick'](_0x3e4172[_0x90be('0x31')],_0x17b020[_0x90be('0x33')]));if(_0x3e4172[_0x90be('0x31')][_0x90be('0x3c')]){_0x1a45dc[_0x90be('0x3b')]=_[_0x90be('0x3e')](_0x1a45dc['where'],{'$or':_[_0x90be('0x2c')](_0x1a45dc[_0x90be('0x36')],function(_0x4cf068){var _0x11e32f={};_0x11e32f[_0x4cf068]={'$like':'%'+_0x3e4172['query']['filter']+'%'};return _0x11e32f;})});}_0x1a45dc=_[_0x90be('0x3e')]({},_0x1a45dc,_0x3e4172[_0x90be('0x3f')]);return _0x57fae6['getAgents'](_0x1a45dc);}})[_0x90be('0x25')](function(_0x1af768){if(_0x1af768){_0x46f044=_0x1af768['length'];if(!_0x3e4172[_0x90be('0x31')]['hasOwnProperty'](_0x90be('0x39'))){_0x1a45dc[_0x90be('0x1f')]=qs[_0x90be('0x1f')](_0x3e4172[_0x90be('0x31')][_0x90be('0x1f')]);_0x1a45dc[_0x90be('0x1e')]=qs[_0x90be('0x1e')](_0x3e4172[_0x90be('0x31')]['offset']);}return _0x57fae6[_0x90be('0x89')](_0x1a45dc);}})[_0x90be('0x25')](function(_0x393ab8){if(_0x393ab8){return _0x393ab8?{'count':_0x46f044,'rows':_0x393ab8}:null;}})[_0x90be('0x25')](respondWithResult(_0x3b15aa,null))[_0x90be('0x48')](handleError(_0x3b15aa,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 84009f3..9a617ef 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 _0x185d=['MailQueue','setMaxListeners','save','emit','hasOwnProperty','hook','events'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x185d,0xa0));var _0xd185=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x185d[_0x3c4737];return _0x2bb926;};'use strict';var EventEmitter=require(_0xd185('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xd185('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd185('0x2')](0x0);var events={'afterCreate':_0xd185('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1899c1){return function(_0x452f97,_0x3ed48e,_0x4e23db){MailQueueEvents[_0xd185('0x4')](_0x1899c1+':'+_0x452f97['id'],_0x452f97);MailQueueEvents['emit'](_0x1899c1,_0x452f97);_0x4e23db(null);};}for(var e in events){if(events[_0xd185('0x5')](e)){var event=events[e];MailQueue[_0xd185('0x6')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x6d6b=['hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','emit'];(function(_0x46e700,_0x56afb1){var _0x46ec64=function(_0xe97cc1){while(--_0xe97cc1){_0x46e700['push'](_0x46e700['shift']());}};_0x46ec64(++_0x56afb1);}(_0x6d6b,0xc8));var _0xb6d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d6b[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xb6d6('0x0'));var MailQueue=require(_0xb6d6('0x1'))['db'][_0xb6d6('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb6d6('0x3')](0x0);var events={'afterCreate':_0xb6d6('0x4'),'afterUpdate':_0xb6d6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x322433){return function(_0x554159,_0x4327ff,_0x39fb64){MailQueueEvents[_0xb6d6('0x6')](_0x322433+':'+_0x554159['id'],_0x554159);MailQueueEvents[_0xb6d6('0x6')](_0x322433,_0x554159);_0x39fb64(null);};}for(var e in events){if(events[_0xb6d6('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xb6d6('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 5e3b7ab..96983d4 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 _0x6f5d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailQueue.attributes','MailQueue','mail_queues'];(function(_0xabb8a1,_0x5ed479){var _0x9a4673=function(_0x44ed09){while(--_0x44ed09){_0xabb8a1['push'](_0xabb8a1['shift']());}};_0x9a4673(++_0x5ed479);}(_0x6f5d,0x174));var _0xd6f5=function(_0x3d3b9c,_0x4f87df){_0x3d3b9c=_0x3d3b9c-0x0;var _0x15d961=_0x6f5d[_0x3d3b9c];return _0x15d961;};'use strict';var _=require(_0xd6f5('0x0'));var util=require(_0xd6f5('0x1'));var logger=require(_0xd6f5('0x2'))(_0xd6f5('0x3'));var moment=require(_0xd6f5('0x4'));var BPromise=require(_0xd6f5('0x5'));var rp=require(_0xd6f5('0x6'));var fs=require('fs');var path=require(_0xd6f5('0x7'));var rimraf=require(_0xd6f5('0x8'));var config=require('../../config/environment');var attributes=require(_0xd6f5('0x9'));module['exports']=function(_0x41ba17,_0x6258ef){return _0x41ba17['define'](_0xd6f5('0xa'),attributes,{'tableName':_0xd6f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe4c=['./mailQueue.attributes','exports','define','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3f1aa9,_0x54983f){var _0x5d11b7=function(_0x5997b0){while(--_0x5997b0){_0x3f1aa9['push'](_0x3f1aa9['shift']());}};_0x5d11b7(++_0x54983f);}(_0xfe4c,0x1be));var _0xcfe4=function(_0x318d10,_0x5bf278){_0x318d10=_0x318d10-0x0;var _0x203b8b=_0xfe4c[_0x318d10];return _0x203b8b;};'use strict';var _=require(_0xcfe4('0x0'));var util=require(_0xcfe4('0x1'));var logger=require(_0xcfe4('0x2'))(_0xcfe4('0x3'));var moment=require(_0xcfe4('0x4'));var BPromise=require(_0xcfe4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfe4('0x6'));var rimraf=require(_0xcfe4('0x7'));var config=require(_0xcfe4('0x8'));var attributes=require(_0xcfe4('0x9'));module[_0xcfe4('0xa')]=function(_0x3c37b9,_0xd87909){return _0x3c37b9[_0xcfe4('0xb')]('MailQueue',attributes,{'tableName':_0xcfe4('0xc'),'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 48635cd..7968d62 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 _0x2450=['GetMailQueue','MailQueue','findAll','options','raw','where','limit','include','map','model','attributes','info','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','socket.io-emitter','./mailQueue.socket','register','then','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','MailQueue,\x20%s,\x20%s','message','request\x20sent','catch'];(function(_0x9d8eef,_0x3e044e){var _0x410abc=function(_0x3b979a){while(--_0x3b979a){_0x9d8eef['push'](_0x9d8eef['shift']());}};_0x410abc(++_0x3e044e);}(_0x2450,0x117));var _0x0245=function(_0x2d6d7b,_0x183ff8){_0x2d6d7b=_0x2d6d7b-0x0;var _0x4372c5=_0x2450[_0x2d6d7b];return _0x4372c5;};'use strict';var _=require(_0x0245('0x0'));var util=require(_0x0245('0x1'));var moment=require(_0x0245('0x2'));var BPromise=require(_0x0245('0x3'));var rs=require(_0x0245('0x4'));var fs=require('fs');var Redis=require(_0x0245('0x5'));var db=require(_0x0245('0x6'))['db'];var utils=require(_0x0245('0x7'));var logger=require(_0x0245('0x8'))(_0x0245('0x9'));var config=require('../../config/environment');var jayson=require(_0x0245('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x0245('0xb')]=_[_0x0245('0xc')](config[_0x0245('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0245('0xd'))(new Redis(config[_0x0245('0xb')]));require(_0x0245('0xe'))[_0x0245('0xf')](socket);function respondWithRpcPromise(_0x370bda,_0x36244c,_0x315a20){return new BPromise(function(_0x4a68c4,_0x44aecc){return client['request'](_0x370bda,_0x315a20)[_0x0245('0x10')](function(_0x3ab98f){logger['info']('MailQueue,\x20%s,\x20%s',_0x36244c,'request\x20sent');logger[_0x0245('0x11')](_0x0245('0x12'),_0x36244c,'request\x20sent',JSON[_0x0245('0x13')](_0x3ab98f));if(_0x3ab98f[_0x0245('0x14')]){if(_0x3ab98f[_0x0245('0x14')]['code']===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x36244c,_0x3ab98f[_0x0245('0x14')]['message']);return _0x44aecc(_0x3ab98f[_0x0245('0x14')]['message']);}logger[_0x0245('0x14')](_0x0245('0x15'),_0x36244c,_0x3ab98f['error']['message']);return _0x4a68c4(_0x3ab98f[_0x0245('0x14')][_0x0245('0x16')]);}else{logger['info'](_0x0245('0x15'),_0x36244c,_0x0245('0x17'));_0x4a68c4(_0x3ab98f['result'][_0x0245('0x16')]);}})[_0x0245('0x18')](function(_0x4f2e2f){logger[_0x0245('0x14')](_0x0245('0x15'),_0x36244c,_0x4f2e2f);_0x44aecc(_0x4f2e2f);});});}exports[_0x0245('0x19')]=function(_0x300ff4){var _0x542d07=this;return new Promise(function(_0x4c1940,_0x5c0768){return db[_0x0245('0x1a')][_0x0245('0x1b')]({'raw':_0x300ff4[_0x0245('0x1c')]?_0x300ff4[_0x0245('0x1c')][_0x0245('0x1d')]===undefined?!![]:![]:!![],'where':_0x300ff4['options']?_0x300ff4[_0x0245('0x1c')][_0x0245('0x1e')]||null:null,'attributes':_0x300ff4[_0x0245('0x1c')]?_0x300ff4[_0x0245('0x1c')]['attributes']||null:null,'limit':_0x300ff4[_0x0245('0x1c')]?_0x300ff4[_0x0245('0x1c')][_0x0245('0x1f')]||null:null,'include':_0x300ff4['options']?_0x300ff4[_0x0245('0x1c')][_0x0245('0x20')]?_[_0x0245('0x21')](_0x300ff4[_0x0245('0x1c')]['include'],function(_0x2aa36e){return{'model':db[_0x2aa36e[_0x0245('0x22')]],'as':_0x2aa36e['as'],'attributes':_0x2aa36e['attributes'],'include':_0x2aa36e[_0x0245('0x20')]?_[_0x0245('0x21')](_0x2aa36e[_0x0245('0x20')],function(_0x4ca51b){return{'model':db[_0x4ca51b['model']],'as':_0x4ca51b['as'],'attributes':_0x4ca51b[_0x0245('0x23')],'include':_0x4ca51b['include']?_['map'](_0x4ca51b[_0x0245('0x20')],function(_0x4479a2){return{'model':db[_0x4479a2[_0x0245('0x22')]],'as':_0x4479a2['as'],'attributes':_0x4479a2[_0x0245('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0245('0x10')](function(_0x264adf){logger[_0x0245('0x24')](_0x0245('0x19'),_0x300ff4);logger[_0x0245('0x11')]('GetMailQueue',_0x300ff4,JSON[_0x0245('0x13')](_0x264adf));_0x4c1940(_0x264adf);})[_0x0245('0x18')](function(_0x58d88b){logger[_0x0245('0x14')]('GetMailQueue',_0x58d88b[_0x0245('0x16')],_0x300ff4);_0x5c0768(_0x542d07[_0x0245('0x14')](0x1f4,_0x58d88b[_0x0245('0x16')]));});});};exports[_0x0245('0x25')]=function(_0x28fe9f){var _0x2cd6ad=this;return new Promise(function(_0x5174ad,_0x113176){return db[_0x0245('0x1a')]['find']({'raw':_0x28fe9f[_0x0245('0x1c')]?_0x28fe9f[_0x0245('0x1c')][_0x0245('0x1d')]===undefined?!![]:![]:!![],'where':_0x28fe9f[_0x0245('0x1c')]?_0x28fe9f[_0x0245('0x1c')][_0x0245('0x1e')]||null:null,'attributes':_0x28fe9f[_0x0245('0x1c')]?_0x28fe9f[_0x0245('0x1c')][_0x0245('0x23')]||null:null,'include':_0x28fe9f[_0x0245('0x1c')]?_0x28fe9f['options'][_0x0245('0x20')]?_['map'](_0x28fe9f[_0x0245('0x1c')]['include'],function(_0x429053){return{'model':db[_0x429053[_0x0245('0x22')]],'as':_0x429053['as'],'attributes':_0x429053[_0x0245('0x23')],'include':_0x429053[_0x0245('0x20')]?_[_0x0245('0x21')](_0x429053[_0x0245('0x20')],function(_0x2a697d){return{'model':db[_0x2a697d[_0x0245('0x22')]],'as':_0x2a697d['as'],'attributes':_0x2a697d[_0x0245('0x23')],'include':_0x2a697d[_0x0245('0x20')]?_[_0x0245('0x21')](_0x2a697d['include'],function(_0x3a0d31){return{'model':db[_0x3a0d31[_0x0245('0x22')]],'as':_0x3a0d31['as'],'attributes':_0x3a0d31[_0x0245('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0245('0x10')](function(_0x5e4e6d){logger['info']('ShowMailQueue',_0x28fe9f);logger['debug']('ShowMailQueue',_0x28fe9f,JSON['stringify'](_0x5e4e6d));_0x5174ad(_0x5e4e6d);})['catch'](function(_0x4f6dbb){logger[_0x0245('0x14')](_0x0245('0x25'),_0x4f6dbb[_0x0245('0x16')],_0x28fe9f);_0x113176(_0x2cd6ad[_0x0245('0x14')](0x1f4,_0x4f6dbb['message']));});});}; \ No newline at end of file +var _0x535f=['../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailQueue.socket','then','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','model','map','info','debug','find','raw','ShowMailQueue','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x535f,0xb9));var _0xf535=function(_0x57c432,_0xea04b5){_0x57c432=_0x57c432-0x0;var _0x34f0bd=_0x535f[_0x57c432];return _0x34f0bd;};'use strict';var _=require('lodash');var util=require(_0xf535('0x0'));var moment=require('moment');var BPromise=require(_0xf535('0x1'));var rs=require(_0xf535('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf535('0x3'))['db'];var utils=require(_0xf535('0x4'));var logger=require(_0xf535('0x5'))(_0xf535('0x6'));var config=require(_0xf535('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf535('0x8')]({'port':0x232a});config[_0xf535('0x9')]=_[_0xf535('0xa')](config[_0xf535('0x9')],{'host':_0xf535('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf535('0x9')]));require(_0xf535('0xc'))['register'](socket);function respondWithRpcPromise(_0xb9f445,_0x4603d5,_0x1b0ceb){return new BPromise(function(_0x56c64b,_0x70d47b){return client['request'](_0xb9f445,_0x1b0ceb)[_0xf535('0xd')](function(_0x3c4c2c){logger['info'](_0xf535('0xe'),_0x4603d5,'request\x20sent');logger['debug'](_0xf535('0xf'),_0x4603d5,'request\x20sent',JSON[_0xf535('0x10')](_0x3c4c2c));if(_0x3c4c2c[_0xf535('0x11')]){if(_0x3c4c2c[_0xf535('0x11')][_0xf535('0x12')]===0x1f4){logger[_0xf535('0x11')](_0xf535('0xe'),_0x4603d5,_0x3c4c2c['error'][_0xf535('0x13')]);return _0x70d47b(_0x3c4c2c[_0xf535('0x11')][_0xf535('0x13')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x4603d5,_0x3c4c2c[_0xf535('0x11')][_0xf535('0x13')]);return _0x56c64b(_0x3c4c2c[_0xf535('0x11')]['message']);}else{logger['info'](_0xf535('0xe'),_0x4603d5,_0xf535('0x14'));_0x56c64b(_0x3c4c2c[_0xf535('0x15')][_0xf535('0x13')]);}})[_0xf535('0x16')](function(_0x5e24e1){logger['error'](_0xf535('0xe'),_0x4603d5,_0x5e24e1);_0x70d47b(_0x5e24e1);});});}exports[_0xf535('0x17')]=function(_0x1ec605){var _0x4e3a66=this;return new Promise(function(_0x3ca920,_0x3ea52f){return db[_0xf535('0x18')][_0xf535('0x19')]({'raw':_0x1ec605[_0xf535('0x1a')]?_0x1ec605[_0xf535('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1ec605['options']?_0x1ec605[_0xf535('0x1a')][_0xf535('0x1b')]||null:null,'attributes':_0x1ec605[_0xf535('0x1a')]?_0x1ec605[_0xf535('0x1a')][_0xf535('0x1c')]||null:null,'limit':_0x1ec605[_0xf535('0x1a')]?_0x1ec605[_0xf535('0x1a')][_0xf535('0x1d')]||null:null,'include':_0x1ec605[_0xf535('0x1a')]?_0x1ec605[_0xf535('0x1a')][_0xf535('0x1e')]?_['map'](_0x1ec605[_0xf535('0x1a')]['include'],function(_0x36e975){return{'model':db[_0x36e975[_0xf535('0x1f')]],'as':_0x36e975['as'],'attributes':_0x36e975[_0xf535('0x1c')],'include':_0x36e975[_0xf535('0x1e')]?_[_0xf535('0x20')](_0x36e975['include'],function(_0x1c0439){return{'model':db[_0x1c0439[_0xf535('0x1f')]],'as':_0x1c0439['as'],'attributes':_0x1c0439[_0xf535('0x1c')],'include':_0x1c0439[_0xf535('0x1e')]?_[_0xf535('0x20')](_0x1c0439[_0xf535('0x1e')],function(_0x2b4dda){return{'model':db[_0x2b4dda[_0xf535('0x1f')]],'as':_0x2b4dda['as'],'attributes':_0x2b4dda[_0xf535('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf535('0xd')](function(_0x4b78f7){logger[_0xf535('0x21')]('GetMailQueue',_0x1ec605);logger[_0xf535('0x22')](_0xf535('0x17'),_0x1ec605,JSON['stringify'](_0x4b78f7));_0x3ca920(_0x4b78f7);})[_0xf535('0x16')](function(_0x2a702f){logger[_0xf535('0x11')](_0xf535('0x17'),_0x2a702f['message'],_0x1ec605);_0x3ea52f(_0x4e3a66['error'](0x1f4,_0x2a702f[_0xf535('0x13')]));});});};exports['ShowMailQueue']=function(_0x5b6d2b){var _0x12e6f5=this;return new Promise(function(_0x3ee939,_0x5c4c07){return db['MailQueue'][_0xf535('0x23')]({'raw':_0x5b6d2b[_0xf535('0x1a')]?_0x5b6d2b[_0xf535('0x1a')][_0xf535('0x24')]===undefined?!![]:![]:!![],'where':_0x5b6d2b['options']?_0x5b6d2b[_0xf535('0x1a')][_0xf535('0x1b')]||null:null,'attributes':_0x5b6d2b[_0xf535('0x1a')]?_0x5b6d2b[_0xf535('0x1a')]['attributes']||null:null,'include':_0x5b6d2b[_0xf535('0x1a')]?_0x5b6d2b['options'][_0xf535('0x1e')]?_[_0xf535('0x20')](_0x5b6d2b[_0xf535('0x1a')][_0xf535('0x1e')],function(_0x4914cc){return{'model':db[_0x4914cc[_0xf535('0x1f')]],'as':_0x4914cc['as'],'attributes':_0x4914cc[_0xf535('0x1c')],'include':_0x4914cc[_0xf535('0x1e')]?_[_0xf535('0x20')](_0x4914cc[_0xf535('0x1e')],function(_0x30b7c1){return{'model':db[_0x30b7c1[_0xf535('0x1f')]],'as':_0x30b7c1['as'],'attributes':_0x30b7c1[_0xf535('0x1c')],'include':_0x30b7c1[_0xf535('0x1e')]?_[_0xf535('0x20')](_0x30b7c1[_0xf535('0x1e')],function(_0x229e9f){return{'model':db[_0x229e9f[_0xf535('0x1f')]],'as':_0x229e9f['as'],'attributes':_0x229e9f[_0xf535('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf535('0xd')](function(_0x4af4a0){logger[_0xf535('0x21')]('ShowMailQueue',_0x5b6d2b);logger['debug'](_0xf535('0x25'),_0x5b6d2b,JSON[_0xf535('0x10')](_0x4af4a0));_0x3ee939(_0x4af4a0);})[_0xf535('0x16')](function(_0x3cfea1){logger[_0xf535('0x11')](_0xf535('0x25'),_0x3cfea1[_0xf535('0x13')],_0x5b6d2b);_0x5c4c07(_0x12e6f5['error'](0x1f4,_0x3cfea1['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7d4a0a3..bed3fd7 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 _0x6fb8=['remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x6fb8,0x1e4));var _0x86fb=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0x6fb8[_0xf04c6d];return _0x4a804e;};'use strict';var MailQueueEvents=require(_0x86fb('0x0'));var events=[_0x86fb('0x1'),_0x86fb('0x2'),_0x86fb('0x3')];function createListener(_0x5385ec,_0x201fed){return function(_0x47863c){_0x201fed[_0x86fb('0x4')](_0x5385ec,_0x47863c);};}function removeListener(_0x4356a3,_0x37ede3){return function(){MailQueueEvents[_0x86fb('0x5')](_0x4356a3,_0x37ede3);};}exports[_0x86fb('0x6')]=function(_0x76516b){for(var _0x46ed3d=0x0,_0x10f795=events[_0x86fb('0x7')];_0x46ed3d<_0x10f795;_0x46ed3d++){var _0x876206=events[_0x46ed3d];var _0x1b3854=createListener(_0x86fb('0x8')+_0x876206,_0x76516b);MailQueueEvents['on'](_0x876206,_0x1b3854);}}; \ No newline at end of file +var _0x4961=['./mailQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x245d40,_0x455ece){var _0x245534=function(_0x257f5d){while(--_0x257f5d){_0x245d40['push'](_0x245d40['shift']());}};_0x245534(++_0x455ece);}(_0x4961,0xe0));var _0x1496=function(_0x1de539,_0x334090){_0x1de539=_0x1de539-0x0;var _0x14582f=_0x4961[_0x1de539];return _0x14582f;};'use strict';var MailQueueEvents=require(_0x1496('0x0'));var events=[_0x1496('0x1'),_0x1496('0x2'),_0x1496('0x3')];function createListener(_0x482f58,_0x5ef43e){return function(_0x199a52){_0x5ef43e[_0x1496('0x4')](_0x482f58,_0x199a52);};}function removeListener(_0x2b49c2,_0x32acc5){return function(){MailQueueEvents[_0x1496('0x5')](_0x2b49c2,_0x32acc5);};}exports[_0x1496('0x6')]=function(_0xb7eb17){for(var _0x42000f=0x0,_0x242543=events[_0x1496('0x7')];_0x42000f<_0x242543;_0x42000f++){var _0x2f8d00=events[_0x42000f];var _0x3447aa=createListener('mailQueue:'+_0x2f8d00,_0xb7eb17);MailQueueEvents['on'](_0x2f8d00,_0x3447aa);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index ecd7585..91a20db 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 _0xa330=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create'];(function(_0x5b84e6,_0x3e15f1){var _0x1d6d12=function(_0x11b80c){while(--_0x11b80c){_0x5b84e6['push'](_0x5b84e6['shift']());}};_0x1d6d12(++_0x3e15f1);}(_0xa330,0x1be));var _0x0a33=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xa330[_0x725b8e];return _0x43ac45;};'use strict';var multer=require(_0x0a33('0x0'));var util=require('util');var path=require(_0x0a33('0x1'));var timeout=require(_0x0a33('0x2'));var express=require(_0x0a33('0x3'));var router=express[_0x0a33('0x4')]();var auth=require(_0x0a33('0x5'));var interaction=require(_0x0a33('0x6'));var config=require('../../config/environment');var controller=require(_0x0a33('0x7'));router['get']('/',auth[_0x0a33('0x8')](),controller[_0x0a33('0x9')]);router[_0x0a33('0xa')](_0x0a33('0xb'),auth[_0x0a33('0x8')](),controller[_0x0a33('0xc')]);router[_0x0a33('0xa')](_0x0a33('0xd'),auth[_0x0a33('0x8')](),controller['show']);router[_0x0a33('0xe')]('/',auth['isAuthenticated'](),controller[_0x0a33('0xf')]);router[_0x0a33('0x10')](_0x0a33('0xd'),auth[_0x0a33('0x8')](),controller[_0x0a33('0x11')]);router[_0x0a33('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0a33('0x13')]);module[_0x0a33('0x14')]=router; \ No newline at end of file +var _0x7c99=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./mailQueueReport.controller','get'];(function(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0x7c99,0x1b0));var _0x97c9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7c99[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x97c9('0x0'));var util=require(_0x97c9('0x1'));var path=require(_0x97c9('0x2'));var timeout=require('connect-timeout');var express=require(_0x97c9('0x3'));var router=express[_0x97c9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x97c9('0x5'));var config=require('../../config/environment');var controller=require(_0x97c9('0x6'));router[_0x97c9('0x7')]('/',auth[_0x97c9('0x8')](),controller['index']);router[_0x97c9('0x7')](_0x97c9('0x9'),auth[_0x97c9('0x8')](),controller[_0x97c9('0xa')]);router[_0x97c9('0x7')](_0x97c9('0xb'),auth[_0x97c9('0x8')](),controller[_0x97c9('0xc')]);router[_0x97c9('0xd')]('/',auth['isAuthenticated'](),controller[_0x97c9('0xe')]);router[_0x97c9('0xf')]('/:id',auth[_0x97c9('0x8')](),controller[_0x97c9('0x10')]);router[_0x97c9('0x11')]('/:id',auth[_0x97c9('0x8')](),controller[_0x97c9('0x12')]);module[_0x97c9('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 cfa3abf..95d670b 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 _0x8324=['STRING','DATE','moment','sequelize','exports'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0x8324,0xed));var _0x4832=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x8324[_0x40822a];return _0x357420;};'use strict';var moment=require(_0x4832('0x0'));var Sequelize=require(_0x4832('0x1'));module[_0x4832('0x2')]={'uniqueid':{'type':Sequelize[_0x4832('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4832('0x3')]},'joinAt':{'type':Sequelize[_0x4832('0x4')]},'leaveAt':{'type':Sequelize[_0x4832('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1e9b=['moment','exports','STRING','DATE'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x1e9b,0xe4));var _0xb1e9=function(_0xfb9d2d,_0x4067c9){_0xfb9d2d=_0xfb9d2d-0x0;var _0xd2eac7=_0x1e9b[_0xfb9d2d];return _0xd2eac7;};'use strict';var moment=require(_0xb1e9('0x0'));var Sequelize=require('sequelize');module[_0xb1e9('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb1e9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb1e9('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb1e9('0x3')]},'reason':{'type':Sequelize[_0xb1e9('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 4c5ce56..614b717 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 _0x374f=['moment','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','length','MailQueueReport','find','catch','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x7e6bb2,_0x559c4b){var _0x3b7a3c=function(_0x33c1d6){while(--_0x33c1d6){_0x7e6bb2['push'](_0x7e6bb2['shift']());}};_0x3b7a3c(++_0x559c4b);}(_0x374f,0x13f));var _0xf374=function(_0x552694,_0x310ead){_0x552694=_0x552694-0x0;var _0x741c5e=_0x374f[_0x552694];return _0x741c5e;};'use strict';var pdf=require(_0xf374('0x0'));var emlformat=require(_0xf374('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf374('0x2'));var jsonpatch=require(_0xf374('0x3'));var rp=require(_0xf374('0x4'));var moment=require(_0xf374('0x5'));var BPromise=require(_0xf374('0x6'));var Mustache=require(_0xf374('0x7'));var util=require(_0xf374('0x8'));var path=require(_0xf374('0x9'));var sox=require(_0xf374('0xa'));var csv=require(_0xf374('0xb'));var ejs=require(_0xf374('0xc'));var fs=require('fs');var _=require(_0xf374('0xd'));var squel=require(_0xf374('0xe'));var crypto=require(_0xf374('0xf'));var jsforce=require(_0xf374('0x10'));var deskjs=require(_0xf374('0x11'));var toCsv=require('to-csv');var querystring=require(_0xf374('0x12'));var Papa=require(_0xf374('0x13'));var Redis=require(_0xf374('0x14'));var authService=require(_0xf374('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xf374('0x16'));var hardwareService=require(_0xf374('0x17'));var logger=require(_0xf374('0x18'))(_0xf374('0x19'));var utils=require(_0xf374('0x1a'));var config=require(_0xf374('0x1b'));var db=require(_0xf374('0x1c'))['db'];function respondWithStatusCode(_0x1576eb,_0x2fe28e){_0x2fe28e=_0x2fe28e||0xcc;return function(_0x25f4c0){if(_0x25f4c0){return _0x1576eb[_0xf374('0x1d')](_0x2fe28e);}return _0x1576eb[_0xf374('0x1e')](_0x2fe28e)['end']();};}function respondWithResult(_0xf13324,_0x12983f){_0x12983f=_0x12983f||0xc8;return function(_0x1d580e){if(_0x1d580e){return _0xf13324[_0xf374('0x1e')](_0x12983f)[_0xf374('0x1f')](_0x1d580e);}};}function respondWithFilteredResult(_0x5e301e,_0x36e19e){return function(_0x106c95){if(_0x106c95){var _0x4f3f78=_0x106c95[_0xf374('0x20')],_0x3fe252=_0x36e19e[_0xf374('0x21')],_0x2ea529=_0x36e19e['offset']+_0x36e19e[_0xf374('0x22')],_0x2779f1;if(_0x2ea529>=_0x4f3f78){_0x2ea529=_0x4f3f78;_0x2779f1=0xc8;}else{_0x2779f1=0xce;}_0x5e301e[_0xf374('0x1e')](_0x2779f1);return _0x5e301e[_0xf374('0x23')]('Content-Range',_0x3fe252+'-'+_0x2ea529+'/'+_0x4f3f78)['json'](_0x106c95);}return null;};}function patchUpdates(_0xe2081){return function(_0x5d316f){try{jsonpatch[_0xf374('0x24')](_0x5d316f,_0xe2081,!![]);}catch(_0x1d68d0){return BPromise[_0xf374('0x25')](_0x1d68d0);}return _0x5d316f[_0xf374('0x26')]();};}function saveUpdates(_0x2c4632,_0x4a45c1){return function(_0xc99a43){if(_0xc99a43){return _0xc99a43[_0xf374('0x27')](_0x2c4632)['then'](function(_0xb8e9ad){return _0xb8e9ad;});}return null;};}function removeEntity(_0x2545c7,_0x34f811){return function(_0x39b3e0){if(_0x39b3e0){return _0x39b3e0[_0xf374('0x28')]()[_0xf374('0x29')](function(){_0x2545c7[_0xf374('0x1e')](0xcc)[_0xf374('0x2a')]();});}};}function handleEntityNotFound(_0x48e06a,_0xeb9fc6){return function(_0x5d611e){if(!_0x5d611e){_0x48e06a[_0xf374('0x1d')](0x194);}return _0x5d611e;};}function handleError(_0x4253f0,_0x12ed7f){_0x12ed7f=_0x12ed7f||0x1f4;return function(_0x19d2f9){logger[_0xf374('0x2b')](_0x19d2f9[_0xf374('0x2c')]);if(_0x19d2f9[_0xf374('0x2d')]){delete _0x19d2f9[_0xf374('0x2d')];}_0x4253f0[_0xf374('0x1e')](_0x12ed7f)[_0xf374('0x2e')](_0x19d2f9);};}exports[_0xf374('0x2f')]=function(_0x5ebf3a,_0x2fa124){var _0x2f6aa1={},_0x596a07={},_0x51bd30={'count':0x0,'rows':[]};var _0x2e78bb=_[_0xf374('0x30')](db['MailQueueReport'][_0xf374('0x31')],function(_0x428154){return{'name':_0x428154[_0xf374('0x32')],'type':_0x428154['type']['key']};});_0x596a07[_0xf374('0x33')]=_[_0xf374('0x30')](_0x2e78bb,_0xf374('0x2d'));_0x596a07[_0xf374('0x34')]=_[_0xf374('0x35')](_0x5ebf3a[_0xf374('0x34')]);_0x596a07[_0xf374('0x36')]=_[_0xf374('0x37')](_0x596a07['model'],_0x596a07[_0xf374('0x34')]);_0x2f6aa1[_0xf374('0x38')]=_[_0xf374('0x37')](_0x596a07[_0xf374('0x33')],qs['fields'](_0x5ebf3a[_0xf374('0x34')][_0xf374('0x39')]));_0x2f6aa1[_0xf374('0x38')]=_0x2f6aa1[_0xf374('0x38')]['length']?_0x2f6aa1[_0xf374('0x38')]:_0x596a07[_0xf374('0x33')];if(!_0x5ebf3a['query'][_0xf374('0x3a')]('nolimit')){_0x2f6aa1[_0xf374('0x22')]=qs[_0xf374('0x22')](_0x5ebf3a[_0xf374('0x34')][_0xf374('0x22')]);_0x2f6aa1[_0xf374('0x21')]=qs[_0xf374('0x21')](_0x5ebf3a[_0xf374('0x34')][_0xf374('0x21')]);}_0x2f6aa1[_0xf374('0x3b')]=qs[_0xf374('0x3c')](_0x5ebf3a['query'][_0xf374('0x3c')]);_0x2f6aa1[_0xf374('0x3d')]=qs['filters'](_[_0xf374('0x3e')](_0x5ebf3a[_0xf374('0x34')],_0x596a07[_0xf374('0x36')]),_0x2e78bb);if(_0x5ebf3a['query'][_0xf374('0x3f')]){_0x2f6aa1[_0xf374('0x3d')]=_[_0xf374('0x40')](_0x2f6aa1[_0xf374('0x3d')],{'$or':_[_0xf374('0x30')](_0x2e78bb,function(_0x36f96b){if(_0x36f96b[_0xf374('0x41')]!==_0xf374('0x42')){var _0x1f7731={};_0x1f7731[_0x36f96b[_0xf374('0x2d')]]={'$like':'%'+_0x5ebf3a['query']['filter']+'%'};return _0x1f7731;}})});}_0x2f6aa1=_[_0xf374('0x40')]({},_0x2f6aa1,_0x5ebf3a[_0xf374('0x43')]);var _0x35eff6={'where':_0x2f6aa1['where']};return db['MailQueueReport'][_0xf374('0x20')](_0x35eff6)[_0xf374('0x29')](function(_0xe17db){_0x51bd30[_0xf374('0x20')]=_0xe17db;if(_0x5ebf3a[_0xf374('0x34')][_0xf374('0x44')]){_0x2f6aa1[_0xf374('0x45')]=[{'all':!![]}];}return db['MailQueueReport'][_0xf374('0x46')](_0x2f6aa1);})['then'](function(_0x5b9596){_0x51bd30[_0xf374('0x47')]=_0x5b9596;return _0x51bd30;})[_0xf374('0x29')](respondWithFilteredResult(_0x2fa124,_0x2f6aa1))['catch'](handleError(_0x2fa124,null));};exports[_0xf374('0x48')]=function(_0x216637,_0x4bcf7d){var _0x5bde7c={'raw':!![],'where':{'id':_0x216637['params']['id']}},_0xe5b4dc={};_0xe5b4dc[_0xf374('0x33')]=_['keys'](db['MailQueueReport'][_0xf374('0x31')]);_0xe5b4dc[_0xf374('0x34')]=_[_0xf374('0x35')](_0x216637[_0xf374('0x34')]);_0xe5b4dc[_0xf374('0x36')]=_[_0xf374('0x37')](_0xe5b4dc['model'],_0xe5b4dc['query']);_0x5bde7c['attributes']=_[_0xf374('0x37')](_0xe5b4dc[_0xf374('0x33')],qs[_0xf374('0x39')](_0x216637[_0xf374('0x34')][_0xf374('0x39')]));_0x5bde7c[_0xf374('0x38')]=_0x5bde7c[_0xf374('0x38')][_0xf374('0x49')]?_0x5bde7c[_0xf374('0x38')]:_0xe5b4dc[_0xf374('0x33')];if(_0x216637[_0xf374('0x34')]['includeAll']){_0x5bde7c[_0xf374('0x45')]=[{'all':!![]}];}_0x5bde7c=_[_0xf374('0x40')]({},_0x5bde7c,_0x216637[_0xf374('0x43')]);return db[_0xf374('0x4a')][_0xf374('0x4b')](_0x5bde7c)[_0xf374('0x29')](handleEntityNotFound(_0x4bcf7d,null))['then'](respondWithResult(_0x4bcf7d,null))[_0xf374('0x4c')](handleError(_0x4bcf7d,null));};exports[_0xf374('0x4d')]=function(_0x4f93cd,_0x36f828){return db['MailQueueReport'][_0xf374('0x4d')](_0x4f93cd[_0xf374('0x4e')],{})[_0xf374('0x29')](respondWithResult(_0x36f828,0xc9))['catch'](handleError(_0x36f828,null));};exports['update']=function(_0xfb9de2,_0x10adfb){if(_0xfb9de2[_0xf374('0x4e')]['id']){delete _0xfb9de2['body']['id'];}return db['MailQueueReport']['find']({'where':{'id':_0xfb9de2[_0xf374('0x4f')]['id']}})[_0xf374('0x29')](handleEntityNotFound(_0x10adfb,null))[_0xf374('0x29')](saveUpdates(_0xfb9de2[_0xf374('0x4e')],null))[_0xf374('0x29')](respondWithResult(_0x10adfb,null))['catch'](handleError(_0x10adfb,null));};exports['destroy']=function(_0x4402c0,_0x529aac){return db[_0xf374('0x4a')][_0xf374('0x4b')]({'where':{'id':_0x4402c0[_0xf374('0x4f')]['id']}})[_0xf374('0x29')](handleEntityNotFound(_0x529aac,null))[_0xf374('0x29')](removeEntity(_0x529aac,null))[_0xf374('0x4c')](handleError(_0x529aac,null));};exports['describe']=function(_0x5048a1,_0x474351){return db[_0xf374('0x4a')][_0xf374('0x50')]()[_0xf374('0x29')](respondWithResult(_0x474351,null))[_0xf374('0x4c')](handleError(_0x474351,null));}; \ No newline at end of file +var _0xf006=['api','../../config/environment','../../mysqldb','status','json','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','options','includeAll','include','catch','params','find','body','update','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x19e859,_0x333efb){var _0x481f06=function(_0x5736ee){while(--_0x5736ee){_0x19e859['push'](_0x19e859['shift']());}};_0x481f06(++_0x333efb);}(_0xf006,0x146));var _0x6f00=function(_0xa50ed7,_0x4a3a3d){_0xa50ed7=_0xa50ed7-0x0;var _0x3c6344=_0xf006[_0xa50ed7];return _0x3c6344;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6f00('0x0'));var zipdir=require(_0x6f00('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f00('0x2'));var moment=require('moment');var BPromise=require(_0x6f00('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f00('0x4'));var sox=require(_0x6f00('0x5'));var csv=require(_0x6f00('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f00('0x7'));var squel=require('squel');var crypto=require(_0x6f00('0x8'));var jsforce=require(_0x6f00('0x9'));var deskjs=require(_0x6f00('0xa'));var toCsv=require(_0x6f00('0x6'));var querystring=require(_0x6f00('0xb'));var Papa=require(_0x6f00('0xc'));var Redis=require(_0x6f00('0xd'));var authService=require(_0x6f00('0xe'));var qs=require(_0x6f00('0xf'));var as=require(_0x6f00('0x10'));var hardwareService=require(_0x6f00('0x11'));var logger=require(_0x6f00('0x12'))(_0x6f00('0x13'));var utils=require('../../config/utils');var config=require(_0x6f00('0x14'));var db=require(_0x6f00('0x15'))['db'];function respondWithStatusCode(_0x158817,_0x36a2ec){_0x36a2ec=_0x36a2ec||0xcc;return function(_0x289fe9){if(_0x289fe9){return _0x158817['sendStatus'](_0x36a2ec);}return _0x158817[_0x6f00('0x16')](_0x36a2ec)['end']();};}function respondWithResult(_0x30b10e,_0x5047f5){_0x5047f5=_0x5047f5||0xc8;return function(_0x324e67){if(_0x324e67){return _0x30b10e[_0x6f00('0x16')](_0x5047f5)[_0x6f00('0x17')](_0x324e67);}};}function respondWithFilteredResult(_0x33f3a2,_0xa6e7a1){return function(_0x411203){if(_0x411203){var _0x46bc2c=_0x411203[_0x6f00('0x18')],_0x4d8aee=_0xa6e7a1['offset'],_0x342c7f=_0xa6e7a1['offset']+_0xa6e7a1[_0x6f00('0x19')],_0x4bfac3;if(_0x342c7f>=_0x46bc2c){_0x342c7f=_0x46bc2c;_0x4bfac3=0xc8;}else{_0x4bfac3=0xce;}_0x33f3a2[_0x6f00('0x16')](_0x4bfac3);return _0x33f3a2[_0x6f00('0x1a')](_0x6f00('0x1b'),_0x4d8aee+'-'+_0x342c7f+'/'+_0x46bc2c)[_0x6f00('0x17')](_0x411203);}return null;};}function patchUpdates(_0x27e466){return function(_0x23fe10){try{jsonpatch[_0x6f00('0x1c')](_0x23fe10,_0x27e466,!![]);}catch(_0x9844bf){return BPromise[_0x6f00('0x1d')](_0x9844bf);}return _0x23fe10[_0x6f00('0x1e')]();};}function saveUpdates(_0x23f27a,_0x4e11de){return function(_0x4f3031){if(_0x4f3031){return _0x4f3031['update'](_0x23f27a)[_0x6f00('0x1f')](function(_0x1fd3d4){return _0x1fd3d4;});}return null;};}function removeEntity(_0x43bfb8,_0x57340f){return function(_0xe301e5){if(_0xe301e5){return _0xe301e5[_0x6f00('0x20')]()[_0x6f00('0x1f')](function(){_0x43bfb8[_0x6f00('0x16')](0xcc)[_0x6f00('0x21')]();});}};}function handleEntityNotFound(_0x1cbf1c,_0x90d74c){return function(_0x1ea061){if(!_0x1ea061){_0x1cbf1c['sendStatus'](0x194);}return _0x1ea061;};}function handleError(_0x3c05ef,_0x45945e){_0x45945e=_0x45945e||0x1f4;return function(_0x1fd40b){logger['error'](_0x1fd40b[_0x6f00('0x22')]);if(_0x1fd40b['name']){delete _0x1fd40b[_0x6f00('0x23')];}_0x3c05ef['status'](_0x45945e)[_0x6f00('0x24')](_0x1fd40b);};}exports[_0x6f00('0x25')]=function(_0x7c6bcb,_0x1f84a6){var _0x375d76={},_0x49eb87={},_0x23a346={'count':0x0,'rows':[]};var _0x25cc71=_[_0x6f00('0x26')](db[_0x6f00('0x27')][_0x6f00('0x28')],function(_0x235a86){return{'name':_0x235a86[_0x6f00('0x29')],'type':_0x235a86[_0x6f00('0x2a')][_0x6f00('0x2b')]};});_0x49eb87[_0x6f00('0x2c')]=_[_0x6f00('0x26')](_0x25cc71,_0x6f00('0x23'));_0x49eb87[_0x6f00('0x2d')]=_[_0x6f00('0x2e')](_0x7c6bcb['query']);_0x49eb87['filters']=_['intersection'](_0x49eb87['model'],_0x49eb87['query']);_0x375d76['attributes']=_[_0x6f00('0x2f')](_0x49eb87['model'],qs[_0x6f00('0x30')](_0x7c6bcb[_0x6f00('0x2d')][_0x6f00('0x30')]));_0x375d76[_0x6f00('0x31')]=_0x375d76[_0x6f00('0x31')][_0x6f00('0x32')]?_0x375d76['attributes']:_0x49eb87[_0x6f00('0x2c')];if(!_0x7c6bcb[_0x6f00('0x2d')][_0x6f00('0x33')](_0x6f00('0x34'))){_0x375d76[_0x6f00('0x19')]=qs['limit'](_0x7c6bcb['query']['limit']);_0x375d76[_0x6f00('0x35')]=qs[_0x6f00('0x35')](_0x7c6bcb[_0x6f00('0x2d')][_0x6f00('0x35')]);}_0x375d76[_0x6f00('0x36')]=qs['sort'](_0x7c6bcb[_0x6f00('0x2d')][_0x6f00('0x37')]);_0x375d76[_0x6f00('0x38')]=qs[_0x6f00('0x39')](_[_0x6f00('0x3a')](_0x7c6bcb[_0x6f00('0x2d')],_0x49eb87[_0x6f00('0x39')]),_0x25cc71);if(_0x7c6bcb['query'][_0x6f00('0x3b')]){_0x375d76[_0x6f00('0x38')]=_[_0x6f00('0x3c')](_0x375d76['where'],{'$or':_[_0x6f00('0x26')](_0x25cc71,function(_0x389ff9){if(_0x389ff9[_0x6f00('0x2a')]!=='VIRTUAL'){var _0x4163fd={};_0x4163fd[_0x389ff9['name']]={'$like':'%'+_0x7c6bcb[_0x6f00('0x2d')]['filter']+'%'};return _0x4163fd;}})});}_0x375d76=_[_0x6f00('0x3c')]({},_0x375d76,_0x7c6bcb[_0x6f00('0x3d')]);var _0x37c791={'where':_0x375d76[_0x6f00('0x38')]};return db['MailQueueReport'][_0x6f00('0x18')](_0x37c791)['then'](function(_0x231bd6){_0x23a346['count']=_0x231bd6;if(_0x7c6bcb[_0x6f00('0x2d')][_0x6f00('0x3e')]){_0x375d76[_0x6f00('0x3f')]=[{'all':!![]}];}return db[_0x6f00('0x27')]['findAll'](_0x375d76);})['then'](function(_0x2e745c){_0x23a346['rows']=_0x2e745c;return _0x23a346;})[_0x6f00('0x1f')](respondWithFilteredResult(_0x1f84a6,_0x375d76))[_0x6f00('0x40')](handleError(_0x1f84a6,null));};exports['show']=function(_0x2699af,_0x5dce37){var _0x4cac2c={'raw':!![],'where':{'id':_0x2699af[_0x6f00('0x41')]['id']}},_0x38da7f={};_0x38da7f[_0x6f00('0x2c')]=_[_0x6f00('0x2e')](db['MailQueueReport'][_0x6f00('0x28')]);_0x38da7f[_0x6f00('0x2d')]=_[_0x6f00('0x2e')](_0x2699af[_0x6f00('0x2d')]);_0x38da7f[_0x6f00('0x39')]=_[_0x6f00('0x2f')](_0x38da7f['model'],_0x38da7f[_0x6f00('0x2d')]);_0x4cac2c[_0x6f00('0x31')]=_[_0x6f00('0x2f')](_0x38da7f[_0x6f00('0x2c')],qs[_0x6f00('0x30')](_0x2699af[_0x6f00('0x2d')]['fields']));_0x4cac2c[_0x6f00('0x31')]=_0x4cac2c[_0x6f00('0x31')][_0x6f00('0x32')]?_0x4cac2c['attributes']:_0x38da7f[_0x6f00('0x2c')];if(_0x2699af['query'][_0x6f00('0x3e')]){_0x4cac2c[_0x6f00('0x3f')]=[{'all':!![]}];}_0x4cac2c=_['merge']({},_0x4cac2c,_0x2699af[_0x6f00('0x3d')]);return db['MailQueueReport'][_0x6f00('0x42')](_0x4cac2c)[_0x6f00('0x1f')](handleEntityNotFound(_0x5dce37,null))[_0x6f00('0x1f')](respondWithResult(_0x5dce37,null))[_0x6f00('0x40')](handleError(_0x5dce37,null));};exports['create']=function(_0x30272e,_0x59085a){return db[_0x6f00('0x27')]['create'](_0x30272e[_0x6f00('0x43')],{})[_0x6f00('0x1f')](respondWithResult(_0x59085a,0xc9))[_0x6f00('0x40')](handleError(_0x59085a,null));};exports[_0x6f00('0x44')]=function(_0x470ff3,_0x3472f0){if(_0x470ff3[_0x6f00('0x43')]['id']){delete _0x470ff3[_0x6f00('0x43')]['id'];}return db['MailQueueReport'][_0x6f00('0x42')]({'where':{'id':_0x470ff3['params']['id']}})[_0x6f00('0x1f')](handleEntityNotFound(_0x3472f0,null))[_0x6f00('0x1f')](saveUpdates(_0x470ff3[_0x6f00('0x43')],null))['then'](respondWithResult(_0x3472f0,null))['catch'](handleError(_0x3472f0,null));};exports[_0x6f00('0x20')]=function(_0x324c31,_0x494ba5){return db[_0x6f00('0x27')]['find']({'where':{'id':_0x324c31[_0x6f00('0x41')]['id']}})['then'](handleEntityNotFound(_0x494ba5,null))[_0x6f00('0x1f')](removeEntity(_0x494ba5,null))[_0x6f00('0x40')](handleError(_0x494ba5,null));};exports['describe']=function(_0x52ee5a,_0x418543){return db[_0x6f00('0x27')]['describe']()[_0x6f00('0x1f')](respondWithResult(_0x418543,null))['catch'](handleError(_0x418543,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 66d58b2..22d0c77 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 _0x04d5=['exports','define','MailQueueReport','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x04d5,0xe1));var _0x504d=function(_0x21dcbd,_0xb9e194){_0x21dcbd=_0x21dcbd-0x0;var _0xee924b=_0x04d5[_0x21dcbd];return _0xee924b;};'use strict';var _=require(_0x504d('0x0'));var util=require(_0x504d('0x1'));var logger=require('../../config/logger')(_0x504d('0x2'));var moment=require(_0x504d('0x3'));var BPromise=require(_0x504d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x504d('0x5'));var rimraf=require(_0x504d('0x6'));var config=require(_0x504d('0x7'));var attributes=require(_0x504d('0x8'));module[_0x504d('0x9')]=function(_0x535671,_0x289d44){return _0x535671[_0x504d('0xa')](_0x504d('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x504d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1189=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2c8129,_0x27ded6){var _0x30e4a4=function(_0xd42d0f){while(--_0xd42d0f){_0x2c8129['push'](_0x2c8129['shift']());}};_0x30e4a4(++_0x27ded6);}(_0x1189,0x17f));var _0x9118=function(_0xc11942,_0x55416b){_0xc11942=_0xc11942-0x0;var _0x4c5b44=_0x1189[_0xc11942];return _0x4c5b44;};'use strict';var _=require(_0x9118('0x0'));var util=require(_0x9118('0x1'));var logger=require(_0x9118('0x2'))(_0x9118('0x3'));var moment=require('moment');var BPromise=require(_0x9118('0x4'));var rp=require(_0x9118('0x5'));var fs=require('fs');var path=require(_0x9118('0x6'));var rimraf=require(_0x9118('0x7'));var config=require(_0x9118('0x8'));var attributes=require(_0x9118('0x9'));module[_0x9118('0xa')]=function(_0x499ee5,_0x124b4a){return _0x499ee5[_0x9118('0xb')](_0x9118('0xc'),attributes,{'tableName':_0x9118('0xd'),'paranoid':![],'indexes':[{'name':_0x9118('0xe'),'fields':[_0x9118('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index ceb0cc4..d18a345 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 _0x814b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailQueueReport','body','raw','stringify','MailQueueReport','update','options','where','attributes','limit','UpdateMailQueueReport','lodash','util'];(function(_0x4553e8,_0x480e3c){var _0x99e41=function(_0x4cf964){while(--_0x4cf964){_0x4553e8['push'](_0x4553e8['shift']());}};_0x99e41(++_0x480e3c);}(_0x814b,0x1a2));var _0xb814=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0x814b[_0x48b810];return _0x23c17d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['MailQueueReport']['create'](_0x55ba16[_0xb814('0x19')],{'raw':_0x55ba16['options']?_0x55ba16['options'][_0xb814('0x1a')]===undefined?!![]:![]:!![]})[_0xb814('0xd')](function(_0x25b6b6){logger['info'](_0xb814('0x18'),_0x55ba16);logger['debug'](_0xb814('0x18'),_0x55ba16,JSON[_0xb814('0x1b')](_0x25b6b6));_0xfac75b(_0x25b6b6);})[_0xb814('0x17')](function(_0x470e81){logger[_0xb814('0x13')](_0xb814('0x18'),_0x470e81[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x470e81[_0xb814('0x15')]));});});};exports['UpdateMailQueueReport']=function(_0x3f81d0){var _0x457dac=this;return new Promise(function(_0x31c7ec,_0x208927){return db[_0xb814('0x1c')][_0xb814('0x1d')](_0x3f81d0[_0xb814('0x19')],{'raw':_0x3f81d0['options']?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f81d0[_0xb814('0x1e')]?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x1f')]||null:null,'attributes':_0x3f81d0[_0xb814('0x1e')]?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x20')]||null:null,'limit':_0x3f81d0['options']?_0x3f81d0[_0xb814('0x1e')][_0xb814('0x21')]||null:null})['then'](function(_0x9008b2){logger[_0xb814('0xe')](_0xb814('0x22'),_0x3f81d0);logger['debug'](_0xb814('0x22'),_0x3f81d0,JSON[_0xb814('0x1b')](_0x9008b2));_0x31c7ec(_0x9008b2);})['catch'](function(_0x338a28){logger['error'](_0xb814('0x22'),_0x338a28['message'],_0x3f81d0);_0x208927(_0x457dac['error'](0x1f4,_0x338a28[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0xe3da=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailQueueReport','create','body','options','then','CreateMailQueueReport','catch','UpdateMailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x476579,_0x33c089,_0x583b98){return new BPromise(function(_0x2a5c45,_0x3d6650){return client['request'](_0x476579,_0x583b98)['then'](function(_0x459592){logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));logger[_0xae3d('0x11')](_0xae3d('0x12'),_0x33c089,'request\x20sent',JSON[_0xae3d('0x13')](_0x459592));if(_0x459592['error']){if(_0x459592[_0xae3d('0x14')][_0xae3d('0x15')]===0x1f4){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592['error'][_0xae3d('0x16')]);return _0x3d6650(_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);}logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0x459592[_0xae3d('0x14')][_0xae3d('0x16')]);return _0x2a5c45(_0x459592['error'][_0xae3d('0x16')]);}else{logger[_0xae3d('0xe')](_0xae3d('0xf'),_0x33c089,_0xae3d('0x10'));_0x2a5c45(_0x459592[_0xae3d('0x17')][_0xae3d('0x16')]);}})['catch'](function(_0xe925fd){logger[_0xae3d('0x14')](_0xae3d('0xf'),_0x33c089,_0xe925fd);_0x3d6650(_0xe925fd);});});}exports['CreateMailQueueReport']=function(_0x3f8cf9){var _0x4cbe4e=this;return new Promise(function(_0x558e42,_0x4d931d){return db[_0xae3d('0x18')][_0xae3d('0x19')](_0x3f8cf9[_0xae3d('0x1a')],{'raw':_0x3f8cf9[_0xae3d('0x1b')]?_0x3f8cf9[_0xae3d('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xae3d('0x1c')](function(_0x48f00e){logger[_0xae3d('0xe')](_0xae3d('0x1d'),_0x3f8cf9);logger[_0xae3d('0x11')](_0xae3d('0x1d'),_0x3f8cf9,JSON[_0xae3d('0x13')](_0x48f00e));_0x558e42(_0x48f00e);})[_0xae3d('0x1e')](function(_0x26c419){logger[_0xae3d('0x14')](_0xae3d('0x1d'),_0x26c419[_0xae3d('0x16')],_0x3f8cf9);_0x4d931d(_0x4cbe4e[_0xae3d('0x14')](0x1f4,_0x26c419[_0xae3d('0x16')]));});});};exports[_0xae3d('0x1f')]=function(_0x1b2acb){var _0x44a4e0=this;return new Promise(function(_0x1fe90f,_0xfb54f6){return db[_0xae3d('0x18')][_0xae3d('0x20')](_0x1b2acb[_0xae3d('0x1a')],{'raw':_0x1b2acb['options']?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b2acb[_0xae3d('0x1b')]?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x22')]||null:null,'attributes':_0x1b2acb[_0xae3d('0x1b')]?_0x1b2acb[_0xae3d('0x1b')]['attributes']||null:null,'limit':_0x1b2acb['options']?_0x1b2acb[_0xae3d('0x1b')][_0xae3d('0x23')]||null:null})[_0xae3d('0x1c')](function(_0x3114f9){logger[_0xae3d('0xe')]('UpdateMailQueueReport',_0x1b2acb);logger[_0xae3d('0x11')](_0xae3d('0x1f'),_0x1b2acb,JSON['stringify'](_0x3114f9));_0x1fe90f(_0x3114f9);})[_0xae3d('0x1e')](function(_0x323715){logger[_0xae3d('0x14')](_0xae3d('0x1f'),_0x323715[_0xae3d('0x16')],_0x1b2acb);_0xfb54f6(_0x44a4e0[_0xae3d('0x14')](0x1f4,_0x323715['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 30f82a0..8d98832 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 _0x20a3=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','express','Router'];(function(_0x1f9398,_0x136e5c){var _0x4cc1d8=function(_0x35f681){while(--_0x35f681){_0x1f9398['push'](_0x1f9398['shift']());}};_0x4cc1d8(++_0x136e5c);}(_0x20a3,0x1c4));var _0x320a=function(_0xdaca47,_0x2e098a){_0xdaca47=_0xdaca47-0x0;var _0xa08d8a=_0x20a3[_0xdaca47];return _0xa08d8a;};'use strict';var multer=require('multer');var util=require(_0x320a('0x0'));var path=require(_0x320a('0x1'));var timeout=require('connect-timeout');var express=require(_0x320a('0x2'));var router=express[_0x320a('0x3')]();var auth=require(_0x320a('0x4'));var interaction=require(_0x320a('0x5'));var config=require(_0x320a('0x6'));module[_0x320a('0x7')]=router; \ No newline at end of file +var _0xac26=['util','connect-timeout','Router','../../components/auth/service','../../config/environment','multer'];(function(_0x692690,_0x872b1f){var _0x3e5594=function(_0xe46ba4){while(--_0xe46ba4){_0x692690['push'](_0x692690['shift']());}};_0x3e5594(++_0x872b1f);}(_0xac26,0xbf));var _0x6ac2=function(_0x5081d4,_0x174b3f){_0x5081d4=_0x5081d4-0x0;var _0x547f56=_0xac26[_0x5081d4];return _0x547f56;};'use strict';var multer=require(_0x6ac2('0x0'));var util=require(_0x6ac2('0x1'));var path=require('path');var timeout=require(_0x6ac2('0x2'));var express=require('express');var router=express[_0x6ac2('0x3')]();var auth=require(_0x6ac2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ac2('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index c2a67db..1f7b26b 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 _0x994c=['INBOX','exports','STRING','INTEGER','BOOLEAN'];(function(_0x431fac,_0x3fcd5d){var _0x5af77e=function(_0x471598){while(--_0x471598){_0x431fac['push'](_0x431fac['shift']());}};_0x5af77e(++_0x3fcd5d);}(_0x994c,0x97));var _0xc994=function(_0x2e0fed,_0xe54484){_0x2e0fed=_0x2e0fed-0x0;var _0x476227=_0x994c[_0x2e0fed];return _0x476227;};'use strict';var Sequelize=require('sequelize');module[_0xc994('0x0')]={'description':{'type':Sequelize[_0xc994('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xc994('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc994('0x2')]},'tls':{'type':Sequelize[_0xc994('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc994('0x1')],'defaultValue':_0xc994('0x4')},'connTimeout':{'type':Sequelize[_0xc994('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc994('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5d0d=['BOOLEAN','INBOX','exports','STRING','INTEGER'];(function(_0x40e389,_0x250e9d){var _0x213741=function(_0x32b3a6){while(--_0x32b3a6){_0x40e389['push'](_0x40e389['shift']());}};_0x213741(++_0x250e9d);}(_0x5d0d,0x1ec));var _0xd5d0=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x5d0d[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require('sequelize');module[_0xd5d0('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xd5d0('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xd5d0('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xd5d0('0x1')]},'port':{'type':Sequelize[_0xd5d0('0x2')]},'tls':{'type':Sequelize[_0xd5d0('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd5d0('0x1')],'defaultValue':_0xd5d0('0x4')},'connTimeout':{'type':Sequelize[_0xd5d0('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd5d0('0x2')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index bcbae2d..f31d6b5 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 _0xf3ff=['path','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xf3ff,0xae));var _0xff3f=function(_0x3ec988,_0x1d95f3){_0x3ec988=_0x3ec988-0x0;var _0x2fc0b9=_0xf3ff[_0x3ec988];return _0x2fc0b9;};'use strict';var _=require(_0xff3f('0x0'));var util=require('util');var logger=require(_0xff3f('0x1'))(_0xff3f('0x2'));var moment=require(_0xff3f('0x3'));var BPromise=require(_0xff3f('0x4'));var rp=require(_0xff3f('0x5'));var fs=require('fs');var path=require(_0xff3f('0x6'));var rimraf=require('rimraf');var config=require(_0xff3f('0x7'));var attributes=require(_0xff3f('0x8'));module[_0xff3f('0x9')]=function(_0x56208b,_0x3591f9){return _0x56208b[_0xff3f('0xa')]('MailServerIn',attributes,{'tableName':_0xff3f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f47=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','util'];(function(_0x59f369,_0x3efb01){var _0x555462=function(_0x1c20ed){while(--_0x1c20ed){_0x59f369['push'](_0x59f369['shift']());}};_0x555462(++_0x3efb01);}(_0x6f47,0xc7));var _0x76f4=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6f47[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var logger=require(_0x76f4('0x1'))('api');var moment=require(_0x76f4('0x2'));var BPromise=require('bluebird');var rp=require(_0x76f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var attributes=require(_0x76f4('0x6'));module[_0x76f4('0x7')]=function(_0x5754ca,_0x35602f){return _0x5754ca[_0x76f4('0x8')](_0x76f4('0x9'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index ddafb5c..9c96a6d 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 _0x2810=['include','map','model','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit'];(function(_0x155c9d,_0x3dd022){var _0xacabfa=function(_0x3ebc16){while(--_0x3ebc16){_0x155c9d['push'](_0x155c9d['shift']());}};_0xacabfa(++_0x3dd022);}(_0x2810,0xb8));var _0x0281=function(_0x1cfc70,_0x183723){_0x1cfc70=_0x1cfc70-0x0;var _0xe6955d=_0x2810[_0x1cfc70];return _0xe6955d;};'use strict';var _=require(_0x0281('0x0'));var util=require(_0x0281('0x1'));var moment=require(_0x0281('0x2'));var BPromise=require('bluebird');var rs=require(_0x0281('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0281('0x4'))['db'];var utils=require(_0x0281('0x5'));var logger=require(_0x0281('0x6'))(_0x0281('0x7'));var config=require(_0x0281('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0281('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1010b4,_0x4178ef,_0x4a6d4c){return new BPromise(function(_0x489d5b,_0x3f5899){return client['request'](_0x1010b4,_0x4a6d4c)[_0x0281('0xa')](function(_0x4bd422){logger[_0x0281('0xb')](_0x0281('0xc'),_0x4178ef,_0x0281('0xd'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x4178ef,_0x0281('0xd'),JSON[_0x0281('0xe')](_0x4bd422));if(_0x4bd422[_0x0281('0xf')]){if(_0x4bd422[_0x0281('0xf')][_0x0281('0x10')]===0x1f4){logger['error'](_0x0281('0xc'),_0x4178ef,_0x4bd422[_0x0281('0xf')][_0x0281('0x11')]);return _0x3f5899(_0x4bd422['error'][_0x0281('0x11')]);}logger[_0x0281('0xf')](_0x0281('0xc'),_0x4178ef,_0x4bd422[_0x0281('0xf')][_0x0281('0x11')]);return _0x489d5b(_0x4bd422['error'][_0x0281('0x11')]);}else{logger[_0x0281('0xb')]('MailServerIn,\x20%s,\x20%s',_0x4178ef,_0x0281('0xd'));_0x489d5b(_0x4bd422[_0x0281('0x12')][_0x0281('0x11')]);}})['catch'](function(_0x4f28b7){logger['error'](_0x0281('0xc'),_0x4178ef,_0x4f28b7);_0x3f5899(_0x4f28b7);});});}exports[_0x0281('0x13')]=function(_0x143944){var _0x86790e=this;return new Promise(function(_0x2f39d7,_0x3df8ab){return db[_0x0281('0x14')][_0x0281('0x15')]({'raw':_0x143944[_0x0281('0x16')]?_0x143944['options'][_0x0281('0x17')]===undefined?!![]:![]:!![],'where':_0x143944['options']?_0x143944[_0x0281('0x16')]['where']||null:null,'attributes':_0x143944[_0x0281('0x16')]?_0x143944['options'][_0x0281('0x18')]||null:null,'limit':_0x143944[_0x0281('0x16')]?_0x143944['options'][_0x0281('0x19')]||null:null,'include':_0x143944['options']?_0x143944[_0x0281('0x16')][_0x0281('0x1a')]?_[_0x0281('0x1b')](_0x143944[_0x0281('0x16')][_0x0281('0x1a')],function(_0x2fb3e5){return{'model':db[_0x2fb3e5[_0x0281('0x1c')]],'as':_0x2fb3e5['as'],'attributes':_0x2fb3e5['attributes'],'include':_0x2fb3e5[_0x0281('0x1a')]?_[_0x0281('0x1b')](_0x2fb3e5[_0x0281('0x1a')],function(_0x167631){return{'model':db[_0x167631[_0x0281('0x1c')]],'as':_0x167631['as'],'attributes':_0x167631['attributes'],'include':_0x167631['include']?_[_0x0281('0x1b')](_0x167631['include'],function(_0x19a628){return{'model':db[_0x19a628[_0x0281('0x1c')]],'as':_0x19a628['as'],'attributes':_0x19a628[_0x0281('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0281('0xa')](function(_0x2b00e6){logger[_0x0281('0xb')](_0x0281('0x13'),_0x143944);logger[_0x0281('0x1d')](_0x0281('0x13'),_0x143944,JSON[_0x0281('0xe')](_0x2b00e6));_0x2f39d7(_0x2b00e6);})['catch'](function(_0x220563){logger[_0x0281('0xf')](_0x0281('0x13'),_0x220563['message'],_0x143944);_0x3df8ab(_0x86790e[_0x0281('0xf')](0x1f4,_0x220563['message']));});});}; \ No newline at end of file +var _0x706d=['map','include','model','info','stringify','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','MailServerIn','findAll','options','where','attributes','limit'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x706d,0x1b7));var _0xd706=function(_0x5e9a73,_0x403f5d){_0x5e9a73=_0x5e9a73-0x0;var _0x419bb4=_0x706d[_0x5e9a73];return _0x419bb4;};'use strict';var _=require(_0xd706('0x0'));var util=require(_0xd706('0x1'));var moment=require(_0xd706('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd706('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd706('0x4'));var logger=require('../../config/logger')(_0xd706('0x5'));var config=require(_0xd706('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd706('0x7')][_0xd706('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4380ec,_0x33a114,_0x3175df){return new BPromise(function(_0x21f0af,_0x4a58c1){return client[_0xd706('0x9')](_0x4380ec,_0x3175df)[_0xd706('0xa')](function(_0x12db98){logger['info'](_0xd706('0xb'),_0x33a114,'request\x20sent');logger[_0xd706('0xc')](_0xd706('0xd'),_0x33a114,_0xd706('0xe'),JSON['stringify'](_0x12db98));if(_0x12db98[_0xd706('0xf')]){if(_0x12db98[_0xd706('0xf')][_0xd706('0x10')]===0x1f4){logger[_0xd706('0xf')]('MailServerIn,\x20%s,\x20%s',_0x33a114,_0x12db98[_0xd706('0xf')][_0xd706('0x11')]);return _0x4a58c1(_0x12db98[_0xd706('0xf')][_0xd706('0x11')]);}logger[_0xd706('0xf')](_0xd706('0xb'),_0x33a114,_0x12db98[_0xd706('0xf')][_0xd706('0x11')]);return _0x21f0af(_0x12db98[_0xd706('0xf')]['message']);}else{logger['info'](_0xd706('0xb'),_0x33a114,_0xd706('0xe'));_0x21f0af(_0x12db98[_0xd706('0x12')][_0xd706('0x11')]);}})[_0xd706('0x13')](function(_0x271489){logger[_0xd706('0xf')](_0xd706('0xb'),_0x33a114,_0x271489);_0x4a58c1(_0x271489);});});}exports['GetMailServerIn']=function(_0x5bba6e){var _0x1e37a9=this;return new Promise(function(_0x2d634c,_0x2b38e2){return db[_0xd706('0x14')][_0xd706('0x15')]({'raw':_0x5bba6e['options']?_0x5bba6e[_0xd706('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5bba6e[_0xd706('0x16')]?_0x5bba6e[_0xd706('0x16')][_0xd706('0x17')]||null:null,'attributes':_0x5bba6e['options']?_0x5bba6e['options'][_0xd706('0x18')]||null:null,'limit':_0x5bba6e[_0xd706('0x16')]?_0x5bba6e[_0xd706('0x16')][_0xd706('0x19')]||null:null,'include':_0x5bba6e[_0xd706('0x16')]?_0x5bba6e[_0xd706('0x16')]['include']?_[_0xd706('0x1a')](_0x5bba6e[_0xd706('0x16')][_0xd706('0x1b')],function(_0x5b1c5f){return{'model':db[_0x5b1c5f[_0xd706('0x1c')]],'as':_0x5b1c5f['as'],'attributes':_0x5b1c5f[_0xd706('0x18')],'include':_0x5b1c5f[_0xd706('0x1b')]?_[_0xd706('0x1a')](_0x5b1c5f['include'],function(_0x37f291){return{'model':db[_0x37f291['model']],'as':_0x37f291['as'],'attributes':_0x37f291[_0xd706('0x18')],'include':_0x37f291[_0xd706('0x1b')]?_[_0xd706('0x1a')](_0x37f291[_0xd706('0x1b')],function(_0x3e0f7e){return{'model':db[_0x3e0f7e[_0xd706('0x1c')]],'as':_0x3e0f7e['as'],'attributes':_0x3e0f7e[_0xd706('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44ea3c){logger[_0xd706('0x1d')]('GetMailServerIn',_0x5bba6e);logger[_0xd706('0xc')]('GetMailServerIn',_0x5bba6e,JSON[_0xd706('0x1e')](_0x44ea3c));_0x2d634c(_0x44ea3c);})['catch'](function(_0x3dbe49){logger['error']('GetMailServerIn',_0x3dbe49['message'],_0x5bba6e);_0x2b38e2(_0x1e37a9[_0xd706('0xf')](0x1f4,_0x3dbe49[_0xd706('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3b5cd6c..56248b7 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 _0xb544=['index','/:id','show','post','create','put','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated'];(function(_0x77e934,_0x5372c3){var _0x1779a9=function(_0x471ca5){while(--_0x471ca5){_0x77e934['push'](_0x77e934['shift']());}};_0x1779a9(++_0x5372c3);}(_0xb544,0x1b1));var _0x4b54=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb544[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x4b54('0x0'));var util=require(_0x4b54('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4b54('0x2'));var router=express[_0x4b54('0x3')]();var auth=require(_0x4b54('0x4'));var interaction=require(_0x4b54('0x5'));var config=require('../../config/environment');var controller=require(_0x4b54('0x6'));router[_0x4b54('0x7')]('/',auth[_0x4b54('0x8')](),controller[_0x4b54('0x9')]);router[_0x4b54('0x7')](_0x4b54('0xa'),auth[_0x4b54('0x8')](),controller[_0x4b54('0xb')]);router[_0x4b54('0xc')]('/',auth['isAuthenticated'](),controller[_0x4b54('0xd')]);router[_0x4b54('0xe')](_0x4b54('0xa'),auth[_0x4b54('0x8')](),controller['update']);router['delete']('/:id',auth[_0x4b54('0x8')](),controller[_0x4b54('0xf')]);module[_0x4b54('0x10')]=router; \ No newline at end of file +var _0xb338=['/:id','show','post','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x120c43,_0x2e62f6){var _0x441d41=function(_0x3fe080){while(--_0x3fe080){_0x120c43['push'](_0x120c43['shift']());}};_0x441d41(++_0x2e62f6);}(_0xb338,0x76));var _0x8b33=function(_0x5f44c3,_0x460f76){_0x5f44c3=_0x5f44c3-0x0;var _0x577bf7=_0xb338[_0x5f44c3];return _0x577bf7;};'use strict';var multer=require(_0x8b33('0x0'));var util=require('util');var path=require(_0x8b33('0x1'));var timeout=require(_0x8b33('0x2'));var express=require(_0x8b33('0x3'));var router=express['Router']();var auth=require(_0x8b33('0x4'));var interaction=require(_0x8b33('0x5'));var config=require(_0x8b33('0x6'));var controller=require('./mailServerOut.controller');router['get']('/',auth[_0x8b33('0x7')](),controller[_0x8b33('0x8')]);router[_0x8b33('0x9')](_0x8b33('0xa'),auth[_0x8b33('0x7')](),controller[_0x8b33('0xb')]);router[_0x8b33('0xc')]('/',auth[_0x8b33('0x7')](),controller['create']);router['put'](_0x8b33('0xa'),auth[_0x8b33('0x7')](),controller['update']);router[_0x8b33('0xd')]('/:id',auth[_0x8b33('0x7')](),controller[_0x8b33('0xe')]);module[_0x8b33('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 1cf2cfd..8685d5f 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 _0xc21c=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x27633f,_0x483597){var _0x27bea4=function(_0x2f56f4){while(--_0x2f56f4){_0x27633f['push'](_0x27633f['shift']());}};_0x27bea4(++_0x483597);}(_0xc21c,0x166));var _0xcc21=function(_0x4e4d13,_0x54a039){_0x4e4d13=_0x4e4d13-0x0;var _0x589b9b=_0xc21c[_0x4e4d13];return _0x589b9b;};'use strict';var Sequelize=require(_0xcc21('0x0'));module[_0xcc21('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcc21('0x2')]},'user':{'type':Sequelize[_0xcc21('0x2')]},'pass':{'type':Sequelize[_0xcc21('0x2')]},'port':{'type':Sequelize[_0xcc21('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xcc21('0x2')]},'authentication':{'type':Sequelize[_0xcc21('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf3fe=['STRING','BOOLEAN','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x378e4f,_0x304ac5){_0x378e4f=_0x378e4f-0x0;var _0xa279bd=_0xf3fe[_0x378e4f];return _0xa279bd;};'use strict';var Sequelize=require('sequelize');module[_0xef3f('0x0')]={'description':{'type':Sequelize[_0xef3f('0x1')]},'host':{'type':Sequelize[_0xef3f('0x1')]},'user':{'type':Sequelize[_0xef3f('0x1')]},'pass':{'type':Sequelize[_0xef3f('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xef3f('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xef3f('0x1')]},'authentication':{'type':Sequelize[_0xef3f('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index fc2e9f3..a313f0e 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 _0x6fb6=['rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','name','findAll','rows','catch','show','params','includeAll','include','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','MailServerOut'];(function(_0x2d21c8,_0x2d354b){var _0x3c05c7=function(_0x50b5dc){while(--_0x50b5dc){_0x2d21c8['push'](_0x2d21c8['shift']());}};_0x3c05c7(++_0x2d354b);}(_0x6fb6,0x139));var _0x66fb=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x6fb6[_0x5783f4];return _0x28e380;};'use strict';var pdf=require(_0x66fb('0x0'));var emlformat=require(_0x66fb('0x1'));var rimraf=require(_0x66fb('0x2'));var zipdir=require(_0x66fb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66fb('0x4'));var moment=require(_0x66fb('0x5'));var BPromise=require(_0x66fb('0x6'));var Mustache=require(_0x66fb('0x7'));var util=require(_0x66fb('0x8'));var path=require(_0x66fb('0x9'));var sox=require(_0x66fb('0xa'));var csv=require(_0x66fb('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x66fb('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66fb('0xd'));var deskjs=require(_0x66fb('0xe'));var toCsv=require(_0x66fb('0xb'));var querystring=require(_0x66fb('0xf'));var Papa=require(_0x66fb('0x10'));var Redis=require(_0x66fb('0x11'));var authService=require(_0x66fb('0x12'));var qs=require(_0x66fb('0x13'));var as=require(_0x66fb('0x14'));var hardwareService=require(_0x66fb('0x15'));var logger=require('../../config/logger')(_0x66fb('0x16'));var utils=require(_0x66fb('0x17'));var config=require('../../config/environment');var db=require(_0x66fb('0x18'))['db'];function respondWithStatusCode(_0x1dc4ee,_0xc852b6){_0xc852b6=_0xc852b6||0xcc;return function(_0x530294){if(_0x530294){return _0x1dc4ee['sendStatus'](_0xc852b6);}return _0x1dc4ee['status'](_0xc852b6)[_0x66fb('0x19')]();};}function respondWithResult(_0x328b05,_0x4b128a){_0x4b128a=_0x4b128a||0xc8;return function(_0x6bd215){if(_0x6bd215){return _0x328b05[_0x66fb('0x1a')](_0x4b128a)['json'](_0x6bd215);}};}function respondWithFilteredResult(_0x1b4f07,_0x20eae3){return function(_0x3a11c9){if(_0x3a11c9){var _0x1ab7cf=_0x3a11c9[_0x66fb('0x1b')],_0xc9e61f=_0x20eae3[_0x66fb('0x1c')],_0x11ab94=_0x20eae3[_0x66fb('0x1c')]+_0x20eae3[_0x66fb('0x1d')],_0x3b48f4;if(_0x11ab94>=_0x1ab7cf){_0x11ab94=_0x1ab7cf;_0x3b48f4=0xc8;}else{_0x3b48f4=0xce;}_0x1b4f07[_0x66fb('0x1a')](_0x3b48f4);return _0x1b4f07['set'](_0x66fb('0x1e'),_0xc9e61f+'-'+_0x11ab94+'/'+_0x1ab7cf)['json'](_0x3a11c9);}return null;};}function patchUpdates(_0x4d3072){return function(_0x3fc973){try{jsonpatch[_0x66fb('0x1f')](_0x3fc973,_0x4d3072,!![]);}catch(_0x5729c6){return BPromise[_0x66fb('0x20')](_0x5729c6);}return _0x3fc973[_0x66fb('0x21')]();};}function saveUpdates(_0x30f115,_0x233ea4){return function(_0x13cbb4){if(_0x13cbb4){return _0x13cbb4[_0x66fb('0x22')](_0x30f115)[_0x66fb('0x23')](function(_0x4ae284){return _0x4ae284;});}return null;};}function removeEntity(_0x198ce0,_0x3d1caa){return function(_0x22a2c1){if(_0x22a2c1){return _0x22a2c1[_0x66fb('0x24')]()[_0x66fb('0x23')](function(){_0x198ce0[_0x66fb('0x1a')](0xcc)[_0x66fb('0x19')]();});}};}function handleEntityNotFound(_0x4ab791,_0x102caa){return function(_0x373ac1){if(!_0x373ac1){_0x4ab791[_0x66fb('0x25')](0x194);}return _0x373ac1;};}function handleError(_0x549bef,_0x155486){_0x155486=_0x155486||0x1f4;return function(_0x364f19){logger['error'](_0x364f19[_0x66fb('0x26')]);if(_0x364f19['name']){delete _0x364f19['name'];}_0x549bef[_0x66fb('0x1a')](_0x155486)[_0x66fb('0x27')](_0x364f19);};}exports[_0x66fb('0x28')]=function(_0x191417,_0x4b5181){var _0x4aa476={},_0x3cc564={},_0x5c501e={'count':0x0,'rows':[]};var _0x544ed7=_['map'](db[_0x66fb('0x29')][_0x66fb('0x2a')],function(_0x2aceb9){return{'name':_0x2aceb9[_0x66fb('0x2b')],'type':_0x2aceb9[_0x66fb('0x2c')][_0x66fb('0x2d')]};});_0x3cc564[_0x66fb('0x2e')]=_['map'](_0x544ed7,'name');_0x3cc564[_0x66fb('0x2f')]=_[_0x66fb('0x30')](_0x191417[_0x66fb('0x2f')]);_0x3cc564[_0x66fb('0x31')]=_['intersection'](_0x3cc564[_0x66fb('0x2e')],_0x3cc564[_0x66fb('0x2f')]);_0x4aa476[_0x66fb('0x32')]=_[_0x66fb('0x33')](_0x3cc564[_0x66fb('0x2e')],qs[_0x66fb('0x34')](_0x191417[_0x66fb('0x2f')]['fields']));_0x4aa476[_0x66fb('0x32')]=_0x4aa476['attributes'][_0x66fb('0x35')]?_0x4aa476[_0x66fb('0x32')]:_0x3cc564[_0x66fb('0x2e')];if(!_0x191417[_0x66fb('0x2f')]['hasOwnProperty'](_0x66fb('0x36'))){_0x4aa476[_0x66fb('0x1d')]=qs[_0x66fb('0x1d')](_0x191417['query'][_0x66fb('0x1d')]);_0x4aa476['offset']=qs[_0x66fb('0x1c')](_0x191417['query'][_0x66fb('0x1c')]);}_0x4aa476['order']=qs['sort'](_0x191417[_0x66fb('0x2f')][_0x66fb('0x37')]);_0x4aa476[_0x66fb('0x38')]=qs[_0x66fb('0x31')](_[_0x66fb('0x39')](_0x191417[_0x66fb('0x2f')],_0x3cc564[_0x66fb('0x31')]),_0x544ed7);if(_0x191417[_0x66fb('0x2f')][_0x66fb('0x3a')]){_0x4aa476[_0x66fb('0x38')]=_['merge'](_0x4aa476[_0x66fb('0x38')],{'$or':_['map'](_0x544ed7,function(_0x38440e){if(_0x38440e['type']!==_0x66fb('0x3b')){var _0x513873={};_0x513873[_0x38440e[_0x66fb('0x3c')]]={'$like':'%'+_0x191417[_0x66fb('0x2f')][_0x66fb('0x3a')]+'%'};return _0x513873;}})});}_0x4aa476=_['merge']({},_0x4aa476,_0x191417['options']);var _0x6318d1={'where':_0x4aa476['where']};return db[_0x66fb('0x29')][_0x66fb('0x1b')](_0x6318d1)[_0x66fb('0x23')](function(_0x127aaf){_0x5c501e[_0x66fb('0x1b')]=_0x127aaf;if(_0x191417[_0x66fb('0x2f')]['includeAll']){_0x4aa476['include']=[{'all':!![]}];}return db['MailServerOut'][_0x66fb('0x3d')](_0x4aa476);})[_0x66fb('0x23')](function(_0x4e8da2){_0x5c501e[_0x66fb('0x3e')]=_0x4e8da2;return _0x5c501e;})[_0x66fb('0x23')](respondWithFilteredResult(_0x4b5181,_0x4aa476))[_0x66fb('0x3f')](handleError(_0x4b5181,null));};exports[_0x66fb('0x40')]=function(_0x1b3ad8,_0x36a96d){var _0x6d242c={'raw':!![],'where':{'id':_0x1b3ad8[_0x66fb('0x41')]['id']}},_0xcb84cd={};_0xcb84cd[_0x66fb('0x2e')]=_[_0x66fb('0x30')](db[_0x66fb('0x29')][_0x66fb('0x2a')]);_0xcb84cd[_0x66fb('0x2f')]=_[_0x66fb('0x30')](_0x1b3ad8[_0x66fb('0x2f')]);_0xcb84cd[_0x66fb('0x31')]=_[_0x66fb('0x33')](_0xcb84cd[_0x66fb('0x2e')],_0xcb84cd[_0x66fb('0x2f')]);_0x6d242c['attributes']=_['intersection'](_0xcb84cd[_0x66fb('0x2e')],qs['fields'](_0x1b3ad8[_0x66fb('0x2f')][_0x66fb('0x34')]));_0x6d242c[_0x66fb('0x32')]=_0x6d242c[_0x66fb('0x32')][_0x66fb('0x35')]?_0x6d242c[_0x66fb('0x32')]:_0xcb84cd[_0x66fb('0x2e')];if(_0x1b3ad8[_0x66fb('0x2f')][_0x66fb('0x42')]){_0x6d242c[_0x66fb('0x43')]=[{'all':!![]}];}_0x6d242c=_['merge']({},_0x6d242c,_0x1b3ad8['options']);return db[_0x66fb('0x29')]['find'](_0x6d242c)[_0x66fb('0x23')](handleEntityNotFound(_0x36a96d,null))[_0x66fb('0x23')](respondWithResult(_0x36a96d,null))[_0x66fb('0x3f')](handleError(_0x36a96d,null));};exports[_0x66fb('0x44')]=function(_0x41bb74,_0x4c7422){return db[_0x66fb('0x29')]['create'](_0x41bb74[_0x66fb('0x45')],{})[_0x66fb('0x23')](respondWithResult(_0x4c7422,0xc9))[_0x66fb('0x3f')](handleError(_0x4c7422,null));};exports[_0x66fb('0x22')]=function(_0x435b9c,_0x428605){if(_0x435b9c[_0x66fb('0x45')]['id']){delete _0x435b9c['body']['id'];}return db['MailServerOut'][_0x66fb('0x46')]({'where':{'id':_0x435b9c[_0x66fb('0x41')]['id']}})[_0x66fb('0x23')](handleEntityNotFound(_0x428605,null))[_0x66fb('0x23')](saveUpdates(_0x435b9c[_0x66fb('0x45')],null))['then'](respondWithResult(_0x428605,null))['catch'](handleError(_0x428605,null));};exports[_0x66fb('0x24')]=function(_0x55cab9,_0x4525b4){return db['MailServerOut'][_0x66fb('0x46')]({'where':{'id':_0x55cab9[_0x66fb('0x41')]['id']}})[_0x66fb('0x23')](handleEntityNotFound(_0x4525b4,null))[_0x66fb('0x23')](removeEntity(_0x4525b4,null))[_0x66fb('0x3f')](handleError(_0x4525b4,null));}; \ No newline at end of file +var _0xa3f8=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','rows','show','params','includeAll','options','catch','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x3f3e96,_0x2a283d){var _0x5d8c7a=function(_0x626334){while(--_0x626334){_0x3f3e96['push'](_0x3f3e96['shift']());}};_0x5d8c7a(++_0x2a283d);}(_0xa3f8,0x1f4));var _0x8a3f=function(_0x16e5d1,_0x9cf085){_0x16e5d1=_0x16e5d1-0x0;var _0x3f72e6=_0xa3f8[_0x16e5d1];return _0x3f72e6;};'use strict';var pdf=require(_0x8a3f('0x0'));var emlformat=require(_0x8a3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8a3f('0x2'));var jsonpatch=require(_0x8a3f('0x3'));var rp=require(_0x8a3f('0x4'));var moment=require(_0x8a3f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8a3f('0x6'));var util=require(_0x8a3f('0x7'));var path=require(_0x8a3f('0x8'));var sox=require(_0x8a3f('0x9'));var csv=require(_0x8a3f('0xa'));var ejs=require(_0x8a3f('0xb'));var fs=require('fs');var _=require(_0x8a3f('0xc'));var squel=require(_0x8a3f('0xd'));var crypto=require(_0x8a3f('0xe'));var jsforce=require(_0x8a3f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8a3f('0xa'));var querystring=require(_0x8a3f('0x10'));var Papa=require(_0x8a3f('0x11'));var Redis=require(_0x8a3f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8a3f('0x13'));var as=require(_0x8a3f('0x14'));var hardwareService=require(_0x8a3f('0x15'));var logger=require(_0x8a3f('0x16'))(_0x8a3f('0x17'));var utils=require('../../config/utils');var config=require(_0x8a3f('0x18'));var db=require(_0x8a3f('0x19'))['db'];function respondWithStatusCode(_0x199bf4,_0x202eb3){_0x202eb3=_0x202eb3||0xcc;return function(_0x9b343){if(_0x9b343){return _0x199bf4[_0x8a3f('0x1a')](_0x202eb3);}return _0x199bf4[_0x8a3f('0x1b')](_0x202eb3)[_0x8a3f('0x1c')]();};}function respondWithResult(_0x26cedc,_0x54224a){_0x54224a=_0x54224a||0xc8;return function(_0x594475){if(_0x594475){return _0x26cedc[_0x8a3f('0x1b')](_0x54224a)[_0x8a3f('0x1d')](_0x594475);}};}function respondWithFilteredResult(_0x15b634,_0x48b17a){return function(_0x3110bc){if(_0x3110bc){var _0x422af8=_0x3110bc[_0x8a3f('0x1e')],_0x4e7c73=_0x48b17a[_0x8a3f('0x1f')],_0x568821=_0x48b17a[_0x8a3f('0x1f')]+_0x48b17a[_0x8a3f('0x20')],_0x24515d;if(_0x568821>=_0x422af8){_0x568821=_0x422af8;_0x24515d=0xc8;}else{_0x24515d=0xce;}_0x15b634[_0x8a3f('0x1b')](_0x24515d);return _0x15b634[_0x8a3f('0x21')](_0x8a3f('0x22'),_0x4e7c73+'-'+_0x568821+'/'+_0x422af8)[_0x8a3f('0x1d')](_0x3110bc);}return null;};}function patchUpdates(_0x14906b){return function(_0x9249f5){try{jsonpatch['apply'](_0x9249f5,_0x14906b,!![]);}catch(_0x506136){return BPromise[_0x8a3f('0x23')](_0x506136);}return _0x9249f5[_0x8a3f('0x24')]();};}function saveUpdates(_0x433bfd,_0x3101c0){return function(_0x39da3d){if(_0x39da3d){return _0x39da3d['update'](_0x433bfd)[_0x8a3f('0x25')](function(_0x4a8461){return _0x4a8461;});}return null;};}function removeEntity(_0x117287,_0x529b38){return function(_0x5b04f2){if(_0x5b04f2){return _0x5b04f2[_0x8a3f('0x26')]()[_0x8a3f('0x25')](function(){_0x117287[_0x8a3f('0x1b')](0xcc)[_0x8a3f('0x1c')]();});}};}function handleEntityNotFound(_0x46fdc6,_0x4d96e3){return function(_0xa9a557){if(!_0xa9a557){_0x46fdc6[_0x8a3f('0x1a')](0x194);}return _0xa9a557;};}function handleError(_0x927214,_0x268885){_0x268885=_0x268885||0x1f4;return function(_0x363f89){logger[_0x8a3f('0x27')](_0x363f89[_0x8a3f('0x28')]);if(_0x363f89[_0x8a3f('0x29')]){delete _0x363f89[_0x8a3f('0x29')];}_0x927214[_0x8a3f('0x1b')](_0x268885)[_0x8a3f('0x2a')](_0x363f89);};}exports[_0x8a3f('0x2b')]=function(_0x1f381d,_0x50b8bd){var _0x3e8b8a={},_0x2c8a72={},_0x96b172={'count':0x0,'rows':[]};var _0x1b5034=_[_0x8a3f('0x2c')](db[_0x8a3f('0x2d')][_0x8a3f('0x2e')],function(_0x43dc77){return{'name':_0x43dc77[_0x8a3f('0x2f')],'type':_0x43dc77[_0x8a3f('0x30')][_0x8a3f('0x31')]};});_0x2c8a72[_0x8a3f('0x32')]=_[_0x8a3f('0x2c')](_0x1b5034,_0x8a3f('0x29'));_0x2c8a72['query']=_[_0x8a3f('0x33')](_0x1f381d[_0x8a3f('0x34')]);_0x2c8a72[_0x8a3f('0x35')]=_['intersection'](_0x2c8a72[_0x8a3f('0x32')],_0x2c8a72[_0x8a3f('0x34')]);_0x3e8b8a[_0x8a3f('0x36')]=_[_0x8a3f('0x37')](_0x2c8a72[_0x8a3f('0x32')],qs[_0x8a3f('0x38')](_0x1f381d[_0x8a3f('0x34')]['fields']));_0x3e8b8a[_0x8a3f('0x36')]=_0x3e8b8a[_0x8a3f('0x36')]['length']?_0x3e8b8a['attributes']:_0x2c8a72['model'];if(!_0x1f381d[_0x8a3f('0x34')][_0x8a3f('0x39')](_0x8a3f('0x3a'))){_0x3e8b8a[_0x8a3f('0x20')]=qs[_0x8a3f('0x20')](_0x1f381d['query'][_0x8a3f('0x20')]);_0x3e8b8a['offset']=qs[_0x8a3f('0x1f')](_0x1f381d[_0x8a3f('0x34')][_0x8a3f('0x1f')]);}_0x3e8b8a['order']=qs[_0x8a3f('0x3b')](_0x1f381d[_0x8a3f('0x34')][_0x8a3f('0x3b')]);_0x3e8b8a[_0x8a3f('0x3c')]=qs[_0x8a3f('0x35')](_[_0x8a3f('0x3d')](_0x1f381d['query'],_0x2c8a72[_0x8a3f('0x35')]),_0x1b5034);if(_0x1f381d[_0x8a3f('0x34')][_0x8a3f('0x3e')]){_0x3e8b8a[_0x8a3f('0x3c')]=_['merge'](_0x3e8b8a[_0x8a3f('0x3c')],{'$or':_[_0x8a3f('0x2c')](_0x1b5034,function(_0x355e52){if(_0x355e52['type']!==_0x8a3f('0x3f')){var _0x6f90a3={};_0x6f90a3[_0x355e52[_0x8a3f('0x29')]]={'$like':'%'+_0x1f381d['query']['filter']+'%'};return _0x6f90a3;}})});}_0x3e8b8a=_[_0x8a3f('0x40')]({},_0x3e8b8a,_0x1f381d['options']);var _0x1bdbd2={'where':_0x3e8b8a[_0x8a3f('0x3c')]};return db['MailServerOut'][_0x8a3f('0x1e')](_0x1bdbd2)[_0x8a3f('0x25')](function(_0x53cce9){_0x96b172[_0x8a3f('0x1e')]=_0x53cce9;if(_0x1f381d[_0x8a3f('0x34')]['includeAll']){_0x3e8b8a[_0x8a3f('0x41')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x3e8b8a);})[_0x8a3f('0x25')](function(_0x4eedbe){_0x96b172[_0x8a3f('0x42')]=_0x4eedbe;return _0x96b172;})['then'](respondWithFilteredResult(_0x50b8bd,_0x3e8b8a))['catch'](handleError(_0x50b8bd,null));};exports[_0x8a3f('0x43')]=function(_0x2bb7b3,_0x415a52){var _0x3e2111={'raw':!![],'where':{'id':_0x2bb7b3[_0x8a3f('0x44')]['id']}},_0x2a66fc={};_0x2a66fc['model']=_[_0x8a3f('0x33')](db['MailServerOut'][_0x8a3f('0x2e')]);_0x2a66fc[_0x8a3f('0x34')]=_[_0x8a3f('0x33')](_0x2bb7b3['query']);_0x2a66fc[_0x8a3f('0x35')]=_[_0x8a3f('0x37')](_0x2a66fc[_0x8a3f('0x32')],_0x2a66fc['query']);_0x3e2111[_0x8a3f('0x36')]=_['intersection'](_0x2a66fc[_0x8a3f('0x32')],qs[_0x8a3f('0x38')](_0x2bb7b3[_0x8a3f('0x34')][_0x8a3f('0x38')]));_0x3e2111['attributes']=_0x3e2111[_0x8a3f('0x36')]['length']?_0x3e2111['attributes']:_0x2a66fc[_0x8a3f('0x32')];if(_0x2bb7b3['query'][_0x8a3f('0x45')]){_0x3e2111[_0x8a3f('0x41')]=[{'all':!![]}];}_0x3e2111=_[_0x8a3f('0x40')]({},_0x3e2111,_0x2bb7b3[_0x8a3f('0x46')]);return db[_0x8a3f('0x2d')]['find'](_0x3e2111)[_0x8a3f('0x25')](handleEntityNotFound(_0x415a52,null))[_0x8a3f('0x25')](respondWithResult(_0x415a52,null))[_0x8a3f('0x47')](handleError(_0x415a52,null));};exports[_0x8a3f('0x48')]=function(_0x1a9cc2,_0x5c6b16){return db[_0x8a3f('0x2d')][_0x8a3f('0x48')](_0x1a9cc2[_0x8a3f('0x49')],{})[_0x8a3f('0x25')](respondWithResult(_0x5c6b16,0xc9))[_0x8a3f('0x47')](handleError(_0x5c6b16,null));};exports[_0x8a3f('0x4a')]=function(_0x3b4e59,_0x3d2c1e){if(_0x3b4e59['body']['id']){delete _0x3b4e59[_0x8a3f('0x49')]['id'];}return db[_0x8a3f('0x2d')]['find']({'where':{'id':_0x3b4e59['params']['id']}})['then'](handleEntityNotFound(_0x3d2c1e,null))[_0x8a3f('0x25')](saveUpdates(_0x3b4e59[_0x8a3f('0x49')],null))[_0x8a3f('0x25')](respondWithResult(_0x3d2c1e,null))[_0x8a3f('0x47')](handleError(_0x3d2c1e,null));};exports[_0x8a3f('0x26')]=function(_0x9a22e6,_0x4a7d70){return db['MailServerOut']['find']({'where':{'id':_0x9a22e6['params']['id']}})[_0x8a3f('0x25')](handleEntityNotFound(_0x4a7d70,null))['then'](removeEntity(_0x4a7d70,null))[_0x8a3f('0x47')](handleError(_0x4a7d70,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 37ded02..9af607d 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 _0xd782=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash'];(function(_0x444e8b,_0x3524cc){var _0x35eb37=function(_0x17e1a3){while(--_0x17e1a3){_0x444e8b['push'](_0x444e8b['shift']());}};_0x35eb37(++_0x3524cc);}(_0xd782,0xe9));var _0x2d78=function(_0x29aac6,_0x4047bc){_0x29aac6=_0x29aac6-0x0;var _0x1a0bfb=_0xd782[_0x29aac6];return _0x1a0bfb;};'use strict';var _=require(_0x2d78('0x0'));var util=require(_0x2d78('0x1'));var logger=require(_0x2d78('0x2'))(_0x2d78('0x3'));var moment=require('moment');var BPromise=require(_0x2d78('0x4'));var rp=require(_0x2d78('0x5'));var fs=require('fs');var path=require(_0x2d78('0x6'));var rimraf=require(_0x2d78('0x7'));var config=require(_0x2d78('0x8'));var attributes=require(_0x2d78('0x9'));module['exports']=function(_0x95694,_0x3b372f){return _0x95694[_0x2d78('0xa')](_0x2d78('0xb'),attributes,{'tableName':_0x2d78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd897=['path','../../config/environment','exports','define','MailServerOut','lodash','util','../../config/logger','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd897,0xb9));var _0x7d89=function(_0x508252,_0x4cdd28){_0x508252=_0x508252-0x0;var _0x23147d=_0xd897[_0x508252];return _0x23147d;};'use strict';var _=require(_0x7d89('0x0'));var util=require(_0x7d89('0x1'));var logger=require(_0x7d89('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7d89('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d89('0x4'));var rimraf=require('rimraf');var config=require(_0x7d89('0x5'));var attributes=require('./mailServerOut.attributes');module[_0x7d89('0x6')]=function(_0x25cf6c,_0x44473e){return _0x25cf6c[_0x7d89('0x7')](_0x7d89('0x8'),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 41b66aa..eb0d625 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 _0x271a=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s'];(function(_0x1f9629,_0x1635ff){var _0x2ef98a=function(_0x21eca7){while(--_0x21eca7){_0x1f9629['push'](_0x1f9629['shift']());}};_0x2ef98a(++_0x1635ff);}(_0x271a,0x13a));var _0xa271=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x271a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa271('0x0'));var moment=require(_0xa271('0x1'));var BPromise=require(_0xa271('0x2'));var rs=require(_0xa271('0x3'));var fs=require('fs');var Redis=require(_0xa271('0x4'));var db=require(_0xa271('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa271('0x6'))(_0xa271('0x7'));var config=require(_0xa271('0x8'));var jayson=require(_0xa271('0x9'));var client=jayson[_0xa271('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b6c36,_0x2afc44,_0x8db2ee){return new BPromise(function(_0x411e53,_0x6b6d7d){return client[_0xa271('0xb')](_0x3b6c36,_0x8db2ee)['then'](function(_0x42c2c9){logger[_0xa271('0xc')](_0xa271('0xd'),_0x2afc44,'request\x20sent');logger[_0xa271('0xe')](_0xa271('0xf'),_0x2afc44,'request\x20sent',JSON[_0xa271('0x10')](_0x42c2c9));if(_0x42c2c9[_0xa271('0x11')]){if(_0x42c2c9[_0xa271('0x11')][_0xa271('0x12')]===0x1f4){logger[_0xa271('0x11')]('MailServerOut,\x20%s,\x20%s',_0x2afc44,_0x42c2c9[_0xa271('0x11')][_0xa271('0x13')]);return _0x6b6d7d(_0x42c2c9[_0xa271('0x11')][_0xa271('0x13')]);}logger[_0xa271('0x11')](_0xa271('0xd'),_0x2afc44,_0x42c2c9[_0xa271('0x11')]['message']);return _0x411e53(_0x42c2c9[_0xa271('0x11')][_0xa271('0x13')]);}else{logger[_0xa271('0xc')]('MailServerOut,\x20%s,\x20%s',_0x2afc44,'request\x20sent');_0x411e53(_0x42c2c9[_0xa271('0x14')]['message']);}})[_0xa271('0x15')](function(_0x515442){logger[_0xa271('0x11')]('MailServerOut,\x20%s,\x20%s',_0x2afc44,_0x515442);_0x6b6d7d(_0x515442);});});} \ No newline at end of file +var _0x9057=['client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x375f59,_0x3277c8){var _0x1d946a=function(_0x2b060d){while(--_0x2b060d){_0x375f59['push'](_0x375f59['shift']());}};_0x1d946a(++_0x3277c8);}(_0x9057,0x115));var _0x7905=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x9057[_0x506d83];return _0x335e8b;};'use strict';var _=require('lodash');var util=require(_0x7905('0x0'));var moment=require(_0x7905('0x1'));var BPromise=require('bluebird');var rs=require(_0x7905('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7905('0x3'))['db'];var utils=require(_0x7905('0x4'));var logger=require(_0x7905('0x5'))(_0x7905('0x6'));var config=require(_0x7905('0x7'));var jayson=require(_0x7905('0x8'));var client=jayson[_0x7905('0x9')][_0x7905('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dc468,_0x22d56f,_0x39acec){return new BPromise(function(_0x8ef517,_0x268992){return client[_0x7905('0xb')](_0x3dc468,_0x39acec)[_0x7905('0xc')](function(_0x69ce00){logger[_0x7905('0xd')](_0x7905('0xe'),_0x22d56f,_0x7905('0xf'));logger['debug'](_0x7905('0x10'),_0x22d56f,'request\x20sent',JSON[_0x7905('0x11')](_0x69ce00));if(_0x69ce00[_0x7905('0x12')]){if(_0x69ce00[_0x7905('0x12')]['code']===0x1f4){logger[_0x7905('0x12')](_0x7905('0xe'),_0x22d56f,_0x69ce00[_0x7905('0x12')][_0x7905('0x13')]);return _0x268992(_0x69ce00[_0x7905('0x12')][_0x7905('0x13')]);}logger['error'](_0x7905('0xe'),_0x22d56f,_0x69ce00[_0x7905('0x12')][_0x7905('0x13')]);return _0x8ef517(_0x69ce00[_0x7905('0x12')]['message']);}else{logger[_0x7905('0xd')]('MailServerOut,\x20%s,\x20%s',_0x22d56f,_0x7905('0xf'));_0x8ef517(_0x69ce00[_0x7905('0x14')][_0x7905('0x13')]);}})[_0x7905('0x15')](function(_0x3adddd){logger['error'](_0x7905('0xe'),_0x22d56f,_0x3adddd);_0x268992(_0x3adddd);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index fff31a9..ecc2444 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 _0xf99c=['show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x153faa,_0x75f2a){var _0x43c32a=function(_0x1c5721){while(--_0x1c5721){_0x153faa['push'](_0x153faa['shift']());}};_0x43c32a(++_0x75f2a);}(_0xf99c,0x67));var _0xcf99=function(_0x1c544c,_0x56f6e2){_0x1c544c=_0x1c544c-0x0;var _0x2c1ff9=_0xf99c[_0x1c544c];return _0x2c1ff9;};'use strict';var multer=require(_0xcf99('0x0'));var util=require(_0xcf99('0x1'));var path=require(_0xcf99('0x2'));var timeout=require(_0xcf99('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcf99('0x4'));var config=require(_0xcf99('0x5'));var controller=require('./mailSubstatus.controller');router[_0xcf99('0x6')]('/',auth[_0xcf99('0x7')](),controller[_0xcf99('0x8')]);router[_0xcf99('0x6')](_0xcf99('0x9'),auth[_0xcf99('0x7')](),controller[_0xcf99('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xcf99('0xb')]);router['post']('/',auth[_0xcf99('0x7')](),controller[_0xcf99('0xc')]);router[_0xcf99('0xd')](_0xcf99('0xe'),auth[_0xcf99('0x7')](),controller[_0xcf99('0xf')]);router[_0xcf99('0x10')]('/:id',auth[_0xcf99('0x7')](),controller[_0xcf99('0x11')]);module[_0xcf99('0x12')]=router; \ No newline at end of file +var _0xd663=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','describe','/:id','post','create'];(function(_0x10355a,_0x5ab3b9){var _0x3481ba=function(_0x271719){while(--_0x271719){_0x10355a['push'](_0x10355a['shift']());}};_0x3481ba(++_0x5ab3b9);}(_0xd663,0x68));var _0x3d66=function(_0x8af965,_0x7f0d57){_0x8af965=_0x8af965-0x0;var _0x4da3f1=_0xd663[_0x8af965];return _0x4da3f1;};'use strict';var multer=require('multer');var util=require(_0x3d66('0x0'));var path=require(_0x3d66('0x1'));var timeout=require(_0x3d66('0x2'));var express=require(_0x3d66('0x3'));var router=express[_0x3d66('0x4')]();var auth=require(_0x3d66('0x5'));var interaction=require(_0x3d66('0x6'));var config=require(_0x3d66('0x7'));var controller=require(_0x3d66('0x8'));router[_0x3d66('0x9')]('/',auth['isAuthenticated'](),controller[_0x3d66('0xa')]);router[_0x3d66('0x9')]('/describe',auth[_0x3d66('0xb')](),controller[_0x3d66('0xc')]);router[_0x3d66('0x9')](_0x3d66('0xd'),auth[_0x3d66('0xb')](),controller['show']);router[_0x3d66('0xe')]('/',auth[_0x3d66('0xb')](),controller[_0x3d66('0xf')]);router[_0x3d66('0x10')]('/:id',auth[_0x3d66('0xb')](),controller['update']);router[_0x3d66('0x11')](_0x3d66('0xd'),auth[_0x3d66('0xb')](),controller[_0x3d66('0x12')]);module[_0x3d66('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 32f20c7..1a87199 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 _0x5458=['exports','STRING','sequelize'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x5458,0x1c7));var _0x8545=function(_0x30507f,_0x41f5e0){_0x30507f=_0x30507f-0x0;var _0x219f28=_0x5458[_0x30507f];return _0x219f28;};'use strict';var Sequelize=require(_0x8545('0x0'));module[_0x8545('0x1')]={'name':{'type':Sequelize[_0x8545('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8545('0x2')]}}; \ No newline at end of file +var _0x430c=['sequelize','name','STRING'];(function(_0x124bc0,_0x2c3aec){var _0x1023c2=function(_0x3adc75){while(--_0x3adc75){_0x124bc0['push'](_0x124bc0['shift']());}};_0x1023c2(++_0x2c3aec);}(_0x430c,0x1a1));var _0xc430=function(_0x21b706,_0x1022f4){_0x21b706=_0x21b706-0x0;var _0x13b94a=_0x430c[_0x21b706];return _0x13b94a;};'use strict';var Sequelize=require(_0xc430('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc430('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc430('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index a7c7238..253545c 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 _0x9c0a=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','index','map','MailSubstatus','rawAttributes','key','model','keys','query','attributes','intersection','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','show','fields','find','create','body','catch','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x9c0a,0x1e4));var _0xa9c0=function(_0x49bca7,_0x1b5e3d){_0x49bca7=_0x49bca7-0x0;var _0x44ba48=_0x9c0a[_0x49bca7];return _0x44ba48;};'use strict';var pdf=require(_0xa9c0('0x0'));var emlformat=require(_0xa9c0('0x1'));var rimraf=require(_0xa9c0('0x2'));var zipdir=require(_0xa9c0('0x3'));var jsonpatch=require(_0xa9c0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa9c0('0x5'));var util=require('util');var path=require(_0xa9c0('0x6'));var sox=require(_0xa9c0('0x7'));var csv=require('to-csv');var ejs=require(_0xa9c0('0x8'));var fs=require('fs');var _=require(_0xa9c0('0x9'));var squel=require(_0xa9c0('0xa'));var crypto=require(_0xa9c0('0xb'));var jsforce=require(_0xa9c0('0xc'));var deskjs=require(_0xa9c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa9c0('0xe'));var Papa=require(_0xa9c0('0xf'));var Redis=require(_0xa9c0('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa9c0('0x11'));var hardwareService=require(_0xa9c0('0x12'));var logger=require(_0xa9c0('0x13'))(_0xa9c0('0x14'));var utils=require(_0xa9c0('0x15'));var config=require(_0xa9c0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x315fb0,_0x4351e7){_0x4351e7=_0x4351e7||0xcc;return function(_0x528eb2){if(_0x528eb2){return _0x315fb0[_0xa9c0('0x17')](_0x4351e7);}return _0x315fb0[_0xa9c0('0x18')](_0x4351e7)[_0xa9c0('0x19')]();};}function respondWithResult(_0x2d687c,_0xadeae){_0xadeae=_0xadeae||0xc8;return function(_0x5f02b1){if(_0x5f02b1){return _0x2d687c[_0xa9c0('0x18')](_0xadeae)[_0xa9c0('0x1a')](_0x5f02b1);}};}function respondWithFilteredResult(_0x40e056,_0x407374){return function(_0xebd476){if(_0xebd476){var _0x854cd3=_0xebd476[_0xa9c0('0x1b')],_0x23e19e=_0x407374[_0xa9c0('0x1c')],_0x2fd824=_0x407374[_0xa9c0('0x1c')]+_0x407374[_0xa9c0('0x1d')],_0xd62ac3;if(_0x2fd824>=_0x854cd3){_0x2fd824=_0x854cd3;_0xd62ac3=0xc8;}else{_0xd62ac3=0xce;}_0x40e056[_0xa9c0('0x18')](_0xd62ac3);return _0x40e056[_0xa9c0('0x1e')]('Content-Range',_0x23e19e+'-'+_0x2fd824+'/'+_0x854cd3)[_0xa9c0('0x1a')](_0xebd476);}return null;};}function patchUpdates(_0x267473){return function(_0x36aad7){try{jsonpatch['apply'](_0x36aad7,_0x267473,!![]);}catch(_0x4c220d){return BPromise[_0xa9c0('0x1f')](_0x4c220d);}return _0x36aad7[_0xa9c0('0x20')]();};}function saveUpdates(_0x4c50d5,_0x2c913c){return function(_0x4542b9){if(_0x4542b9){return _0x4542b9[_0xa9c0('0x21')](_0x4c50d5)[_0xa9c0('0x22')](function(_0x4ccb87){return _0x4ccb87;});}return null;};}function removeEntity(_0x17e533,_0x344449){return function(_0x9e62e4){if(_0x9e62e4){return _0x9e62e4[_0xa9c0('0x23')]()['then'](function(){_0x17e533[_0xa9c0('0x18')](0xcc)[_0xa9c0('0x19')]();});}};}function handleEntityNotFound(_0x56a78e,_0x1861ae){return function(_0x462d17){if(!_0x462d17){_0x56a78e[_0xa9c0('0x17')](0x194);}return _0x462d17;};}function handleError(_0x1c12ab,_0x33c126){_0x33c126=_0x33c126||0x1f4;return function(_0x137c02){logger[_0xa9c0('0x24')](_0x137c02[_0xa9c0('0x25')]);if(_0x137c02['name']){delete _0x137c02[_0xa9c0('0x26')];}_0x1c12ab[_0xa9c0('0x18')](_0x33c126)['send'](_0x137c02);};}exports[_0xa9c0('0x27')]=function(_0x13fdce,_0x21c916){var _0x12d67b={},_0xf1d152={},_0xdf738c={'count':0x0,'rows':[]};var _0x5335c2=_[_0xa9c0('0x28')](db[_0xa9c0('0x29')][_0xa9c0('0x2a')],function(_0x4b9eb7){return{'name':_0x4b9eb7['fieldName'],'type':_0x4b9eb7['type'][_0xa9c0('0x2b')]};});_0xf1d152[_0xa9c0('0x2c')]=_[_0xa9c0('0x28')](_0x5335c2,_0xa9c0('0x26'));_0xf1d152['query']=_[_0xa9c0('0x2d')](_0x13fdce[_0xa9c0('0x2e')]);_0xf1d152['filters']=_['intersection'](_0xf1d152[_0xa9c0('0x2c')],_0xf1d152[_0xa9c0('0x2e')]);_0x12d67b[_0xa9c0('0x2f')]=_[_0xa9c0('0x30')](_0xf1d152[_0xa9c0('0x2c')],qs['fields'](_0x13fdce['query']['fields']));_0x12d67b[_0xa9c0('0x2f')]=_0x12d67b[_0xa9c0('0x2f')][_0xa9c0('0x31')]?_0x12d67b[_0xa9c0('0x2f')]:_0xf1d152['model'];if(!_0x13fdce['query'][_0xa9c0('0x32')]('nolimit')){_0x12d67b[_0xa9c0('0x1d')]=qs[_0xa9c0('0x1d')](_0x13fdce['query'][_0xa9c0('0x1d')]);_0x12d67b[_0xa9c0('0x1c')]=qs['offset'](_0x13fdce[_0xa9c0('0x2e')]['offset']);}_0x12d67b[_0xa9c0('0x33')]=qs['sort'](_0x13fdce[_0xa9c0('0x2e')][_0xa9c0('0x34')]);_0x12d67b[_0xa9c0('0x35')]=qs[_0xa9c0('0x36')](_[_0xa9c0('0x37')](_0x13fdce[_0xa9c0('0x2e')],_0xf1d152[_0xa9c0('0x36')]),_0x5335c2);if(_0x13fdce['query'][_0xa9c0('0x38')]){_0x12d67b[_0xa9c0('0x35')]=_[_0xa9c0('0x39')](_0x12d67b[_0xa9c0('0x35')],{'$or':_[_0xa9c0('0x28')](_0x5335c2,function(_0x17a536){if(_0x17a536['type']!==_0xa9c0('0x3a')){var _0x3cafad={};_0x3cafad[_0x17a536[_0xa9c0('0x26')]]={'$like':'%'+_0x13fdce[_0xa9c0('0x2e')][_0xa9c0('0x38')]+'%'};return _0x3cafad;}})});}_0x12d67b=_[_0xa9c0('0x39')]({},_0x12d67b,_0x13fdce[_0xa9c0('0x3b')]);var _0x432876={'where':_0x12d67b[_0xa9c0('0x35')]};return db[_0xa9c0('0x29')]['count'](_0x432876)[_0xa9c0('0x22')](function(_0x369f87){_0xdf738c[_0xa9c0('0x1b')]=_0x369f87;if(_0x13fdce[_0xa9c0('0x2e')][_0xa9c0('0x3c')]){_0x12d67b[_0xa9c0('0x3d')]=[{'all':!![]}];}return db[_0xa9c0('0x29')]['findAll'](_0x12d67b);})[_0xa9c0('0x22')](function(_0x4a441c){_0xdf738c['rows']=_0x4a441c;return _0xdf738c;})[_0xa9c0('0x22')](respondWithFilteredResult(_0x21c916,_0x12d67b))['catch'](handleError(_0x21c916,null));};exports[_0xa9c0('0x3e')]=function(_0x481920,_0x537df1){var _0x42220c={'raw':!![],'where':{'id':_0x481920['params']['id']}},_0x236f50={};_0x236f50[_0xa9c0('0x2c')]=_[_0xa9c0('0x2d')](db[_0xa9c0('0x29')][_0xa9c0('0x2a')]);_0x236f50[_0xa9c0('0x2e')]=_[_0xa9c0('0x2d')](_0x481920[_0xa9c0('0x2e')]);_0x236f50[_0xa9c0('0x36')]=_[_0xa9c0('0x30')](_0x236f50[_0xa9c0('0x2c')],_0x236f50['query']);_0x42220c[_0xa9c0('0x2f')]=_[_0xa9c0('0x30')](_0x236f50[_0xa9c0('0x2c')],qs[_0xa9c0('0x3f')](_0x481920['query']['fields']));_0x42220c[_0xa9c0('0x2f')]=_0x42220c[_0xa9c0('0x2f')][_0xa9c0('0x31')]?_0x42220c[_0xa9c0('0x2f')]:_0x236f50['model'];if(_0x481920[_0xa9c0('0x2e')][_0xa9c0('0x3c')]){_0x42220c[_0xa9c0('0x3d')]=[{'all':!![]}];}_0x42220c=_[_0xa9c0('0x39')]({},_0x42220c,_0x481920[_0xa9c0('0x3b')]);return db['MailSubstatus'][_0xa9c0('0x40')](_0x42220c)[_0xa9c0('0x22')](handleEntityNotFound(_0x537df1,null))[_0xa9c0('0x22')](respondWithResult(_0x537df1,null))['catch'](handleError(_0x537df1,null));};exports[_0xa9c0('0x41')]=function(_0x3fc69c,_0x4f79b5){return db['MailSubstatus'][_0xa9c0('0x41')](_0x3fc69c[_0xa9c0('0x42')],{})['then'](respondWithResult(_0x4f79b5,0xc9))[_0xa9c0('0x43')](handleError(_0x4f79b5,null));};exports[_0xa9c0('0x21')]=function(_0x28330b,_0x1903dc){if(_0x28330b[_0xa9c0('0x42')]['id']){delete _0x28330b['body']['id'];}return db[_0xa9c0('0x29')][_0xa9c0('0x40')]({'where':{'id':_0x28330b[_0xa9c0('0x44')]['id']}})['then'](handleEntityNotFound(_0x1903dc,null))[_0xa9c0('0x22')](saveUpdates(_0x28330b[_0xa9c0('0x42')],null))[_0xa9c0('0x22')](respondWithResult(_0x1903dc,null))['catch'](handleError(_0x1903dc,null));};exports[_0xa9c0('0x23')]=function(_0x1bfc53,_0x417249){return db[_0xa9c0('0x29')][_0xa9c0('0x40')]({'where':{'id':_0x1bfc53[_0xa9c0('0x44')]['id']}})[_0xa9c0('0x22')](handleEntityNotFound(_0x417249,null))[_0xa9c0('0x22')](removeEntity(_0x417249,null))[_0xa9c0('0x43')](handleError(_0x417249,null));};exports[_0xa9c0('0x45')]=function(_0x287ec6,_0x1d14a3){return db['MailSubstatus'][_0xa9c0('0x45')]()[_0xa9c0('0x22')](respondWithResult(_0x1d14a3,null))['catch'](handleError(_0x1d14a3,null));}; \ No newline at end of file +var _0x0854=['MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','params','find','create','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map'];(function(_0x4d5930,_0x1debcd){var _0x1f9323=function(_0x2f49ed){while(--_0x2f49ed){_0x4d5930['push'](_0x4d5930['shift']());}};_0x1f9323(++_0x1debcd);}(_0x0854,0xf8));var _0x4085=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0854[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4085('0x0'));var rimraf=require(_0x4085('0x1'));var zipdir=require(_0x4085('0x2'));var jsonpatch=require(_0x4085('0x3'));var rp=require(_0x4085('0x4'));var moment=require(_0x4085('0x5'));var BPromise=require(_0x4085('0x6'));var Mustache=require(_0x4085('0x7'));var util=require(_0x4085('0x8'));var path=require(_0x4085('0x9'));var sox=require('sox');var csv=require(_0x4085('0xa'));var ejs=require(_0x4085('0xb'));var fs=require('fs');var _=require(_0x4085('0xc'));var squel=require(_0x4085('0xd'));var crypto=require('crypto');var jsforce=require(_0x4085('0xe'));var deskjs=require(_0x4085('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4085('0x10'));var Papa=require(_0x4085('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4085('0x12'));var as=require(_0x4085('0x13'));var hardwareService=require(_0x4085('0x14'));var logger=require(_0x4085('0x15'))(_0x4085('0x16'));var utils=require(_0x4085('0x17'));var config=require(_0x4085('0x18'));var db=require(_0x4085('0x19'))['db'];function respondWithStatusCode(_0x1cefc3,_0x72135d){_0x72135d=_0x72135d||0xcc;return function(_0x24ca76){if(_0x24ca76){return _0x1cefc3[_0x4085('0x1a')](_0x72135d);}return _0x1cefc3['status'](_0x72135d)[_0x4085('0x1b')]();};}function respondWithResult(_0x1a8924,_0x2e36e7){_0x2e36e7=_0x2e36e7||0xc8;return function(_0x31f860){if(_0x31f860){return _0x1a8924['status'](_0x2e36e7)[_0x4085('0x1c')](_0x31f860);}};}function respondWithFilteredResult(_0x2c060d,_0xb71e84){return function(_0x41dd99){if(_0x41dd99){var _0x800edb=_0x41dd99[_0x4085('0x1d')],_0x4ce7a4=_0xb71e84[_0x4085('0x1e')],_0x21b81f=_0xb71e84['offset']+_0xb71e84['limit'],_0x3173d3;if(_0x21b81f>=_0x800edb){_0x21b81f=_0x800edb;_0x3173d3=0xc8;}else{_0x3173d3=0xce;}_0x2c060d[_0x4085('0x1f')](_0x3173d3);return _0x2c060d['set'](_0x4085('0x20'),_0x4ce7a4+'-'+_0x21b81f+'/'+_0x800edb)[_0x4085('0x1c')](_0x41dd99);}return null;};}function patchUpdates(_0x2320ad){return function(_0x352e49){try{jsonpatch[_0x4085('0x21')](_0x352e49,_0x2320ad,!![]);}catch(_0x191b81){return BPromise[_0x4085('0x22')](_0x191b81);}return _0x352e49[_0x4085('0x23')]();};}function saveUpdates(_0x243922,_0x514803){return function(_0x39612d){if(_0x39612d){return _0x39612d[_0x4085('0x24')](_0x243922)[_0x4085('0x25')](function(_0x1b711b){return _0x1b711b;});}return null;};}function removeEntity(_0x4b5206,_0x58b3d5){return function(_0x258f48){if(_0x258f48){return _0x258f48[_0x4085('0x26')]()[_0x4085('0x25')](function(){_0x4b5206['status'](0xcc)[_0x4085('0x1b')]();});}};}function handleEntityNotFound(_0x510fd8,_0x26a2b7){return function(_0x34b08b){if(!_0x34b08b){_0x510fd8['sendStatus'](0x194);}return _0x34b08b;};}function handleError(_0x203748,_0x2830ed){_0x2830ed=_0x2830ed||0x1f4;return function(_0x4127b9){logger[_0x4085('0x27')](_0x4127b9[_0x4085('0x28')]);if(_0x4127b9['name']){delete _0x4127b9[_0x4085('0x29')];}_0x203748[_0x4085('0x1f')](_0x2830ed)['send'](_0x4127b9);};}exports[_0x4085('0x2a')]=function(_0x513b8a,_0x3aa9d5){var _0x5ac0b4={},_0x49fefa={},_0x2e6965={'count':0x0,'rows':[]};var _0x3c5466=_[_0x4085('0x2b')](db[_0x4085('0x2c')][_0x4085('0x2d')],function(_0x157999){return{'name':_0x157999[_0x4085('0x2e')],'type':_0x157999[_0x4085('0x2f')][_0x4085('0x30')]};});_0x49fefa[_0x4085('0x31')]=_[_0x4085('0x2b')](_0x3c5466,_0x4085('0x29'));_0x49fefa[_0x4085('0x32')]=_[_0x4085('0x33')](_0x513b8a['query']);_0x49fefa[_0x4085('0x34')]=_[_0x4085('0x35')](_0x49fefa[_0x4085('0x31')],_0x49fefa[_0x4085('0x32')]);_0x5ac0b4['attributes']=_[_0x4085('0x35')](_0x49fefa[_0x4085('0x31')],qs[_0x4085('0x36')](_0x513b8a[_0x4085('0x32')][_0x4085('0x36')]));_0x5ac0b4['attributes']=_0x5ac0b4['attributes'][_0x4085('0x37')]?_0x5ac0b4[_0x4085('0x38')]:_0x49fefa[_0x4085('0x31')];if(!_0x513b8a['query']['hasOwnProperty']('nolimit')){_0x5ac0b4[_0x4085('0x39')]=qs[_0x4085('0x39')](_0x513b8a[_0x4085('0x32')][_0x4085('0x39')]);_0x5ac0b4[_0x4085('0x1e')]=qs[_0x4085('0x1e')](_0x513b8a[_0x4085('0x32')]['offset']);}_0x5ac0b4[_0x4085('0x3a')]=qs['sort'](_0x513b8a[_0x4085('0x32')][_0x4085('0x3b')]);_0x5ac0b4[_0x4085('0x3c')]=qs[_0x4085('0x34')](_['pick'](_0x513b8a[_0x4085('0x32')],_0x49fefa[_0x4085('0x34')]),_0x3c5466);if(_0x513b8a[_0x4085('0x32')][_0x4085('0x3d')]){_0x5ac0b4['where']=_[_0x4085('0x3e')](_0x5ac0b4[_0x4085('0x3c')],{'$or':_[_0x4085('0x2b')](_0x3c5466,function(_0xdf44bf){if(_0xdf44bf[_0x4085('0x2f')]!==_0x4085('0x3f')){var _0x15973f={};_0x15973f[_0xdf44bf['name']]={'$like':'%'+_0x513b8a[_0x4085('0x32')][_0x4085('0x3d')]+'%'};return _0x15973f;}})});}_0x5ac0b4=_[_0x4085('0x3e')]({},_0x5ac0b4,_0x513b8a[_0x4085('0x40')]);var _0x1a8752={'where':_0x5ac0b4[_0x4085('0x3c')]};return db[_0x4085('0x2c')][_0x4085('0x1d')](_0x1a8752)[_0x4085('0x25')](function(_0x2a3a58){_0x2e6965[_0x4085('0x1d')]=_0x2a3a58;if(_0x513b8a[_0x4085('0x32')][_0x4085('0x41')]){_0x5ac0b4[_0x4085('0x42')]=[{'all':!![]}];}return db[_0x4085('0x2c')]['findAll'](_0x5ac0b4);})[_0x4085('0x25')](function(_0x58d479){_0x2e6965['rows']=_0x58d479;return _0x2e6965;})[_0x4085('0x25')](respondWithFilteredResult(_0x3aa9d5,_0x5ac0b4))['catch'](handleError(_0x3aa9d5,null));};exports['show']=function(_0x39b6a7,_0x25331e){var _0x4fa275={'raw':!![],'where':{'id':_0x39b6a7[_0x4085('0x43')]['id']}},_0x331321={};_0x331321[_0x4085('0x31')]=_[_0x4085('0x33')](db[_0x4085('0x2c')][_0x4085('0x2d')]);_0x331321[_0x4085('0x32')]=_[_0x4085('0x33')](_0x39b6a7[_0x4085('0x32')]);_0x331321['filters']=_[_0x4085('0x35')](_0x331321[_0x4085('0x31')],_0x331321[_0x4085('0x32')]);_0x4fa275[_0x4085('0x38')]=_[_0x4085('0x35')](_0x331321[_0x4085('0x31')],qs[_0x4085('0x36')](_0x39b6a7[_0x4085('0x32')][_0x4085('0x36')]));_0x4fa275[_0x4085('0x38')]=_0x4fa275[_0x4085('0x38')][_0x4085('0x37')]?_0x4fa275[_0x4085('0x38')]:_0x331321[_0x4085('0x31')];if(_0x39b6a7[_0x4085('0x32')][_0x4085('0x41')]){_0x4fa275[_0x4085('0x42')]=[{'all':!![]}];}_0x4fa275=_[_0x4085('0x3e')]({},_0x4fa275,_0x39b6a7['options']);return db[_0x4085('0x2c')][_0x4085('0x44')](_0x4fa275)[_0x4085('0x25')](handleEntityNotFound(_0x25331e,null))['then'](respondWithResult(_0x25331e,null))['catch'](handleError(_0x25331e,null));};exports['create']=function(_0x4d8283,_0x2f92fb){return db['MailSubstatus'][_0x4085('0x45')](_0x4d8283['body'],{})[_0x4085('0x25')](respondWithResult(_0x2f92fb,0xc9))[_0x4085('0x46')](handleError(_0x2f92fb,null));};exports[_0x4085('0x24')]=function(_0x59623d,_0x24d096){if(_0x59623d[_0x4085('0x47')]['id']){delete _0x59623d[_0x4085('0x47')]['id'];}return db[_0x4085('0x2c')][_0x4085('0x44')]({'where':{'id':_0x59623d[_0x4085('0x43')]['id']}})[_0x4085('0x25')](handleEntityNotFound(_0x24d096,null))[_0x4085('0x25')](saveUpdates(_0x59623d[_0x4085('0x47')],null))[_0x4085('0x25')](respondWithResult(_0x24d096,null))[_0x4085('0x46')](handleError(_0x24d096,null));};exports[_0x4085('0x26')]=function(_0x4537dc,_0x51d9b5){return db[_0x4085('0x2c')][_0x4085('0x44')]({'where':{'id':_0x4537dc['params']['id']}})[_0x4085('0x25')](handleEntityNotFound(_0x51d9b5,null))['then'](removeEntity(_0x51d9b5,null))[_0x4085('0x46')](handleError(_0x51d9b5,null));};exports['describe']=function(_0x575ea5,_0x39501){return db['MailSubstatus'][_0x4085('0x48')]()[_0x4085('0x25')](respondWithResult(_0x39501,null))[_0x4085('0x46')](handleError(_0x39501,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 6ded1c6..566cb15 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 _0x8b9e=['path','../../config/environment','./mailSubstatus.attributes','mail_substatuses','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x17c466,_0x292eca){var _0x37cefb=function(_0x3098ab){while(--_0x3098ab){_0x17c466['push'](_0x17c466['shift']());}};_0x37cefb(++_0x292eca);}(_0x8b9e,0xf7));var _0xe8b9=function(_0x2378ef,_0x1b182e){_0x2378ef=_0x2378ef-0x0;var _0x9dc6fb=_0x8b9e[_0x2378ef];return _0x9dc6fb;};'use strict';var _=require(_0xe8b9('0x0'));var util=require(_0xe8b9('0x1'));var logger=require(_0xe8b9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe8b9('0x3'));var rp=require(_0xe8b9('0x4'));var fs=require('fs');var path=require(_0xe8b9('0x5'));var rimraf=require('rimraf');var config=require(_0xe8b9('0x6'));var attributes=require(_0xe8b9('0x7'));module['exports']=function(_0x3b2f60,_0x52f7a8){return _0x3b2f60['define']('MailSubstatus',attributes,{'tableName':_0xe8b9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7c8=['request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','util','../../config/logger','api','moment'];(function(_0x4e9f29,_0x1bbcbf){var _0x8e1ab3=function(_0x4a4e6b){while(--_0x4a4e6b){_0x4e9f29['push'](_0x4e9f29['shift']());}};_0x8e1ab3(++_0x1bbcbf);}(_0xe7c8,0x194));var _0x8e7c=function(_0x46f139,_0x422c14){_0x46f139=_0x46f139-0x0;var _0x5a3727=_0xe7c8[_0x46f139];return _0x5a3727;};'use strict';var _=require('lodash');var util=require(_0x8e7c('0x0'));var logger=require(_0x8e7c('0x1'))(_0x8e7c('0x2'));var moment=require(_0x8e7c('0x3'));var BPromise=require('bluebird');var rp=require(_0x8e7c('0x4'));var fs=require('fs');var path=require(_0x8e7c('0x5'));var rimraf=require(_0x8e7c('0x6'));var config=require(_0x8e7c('0x7'));var attributes=require(_0x8e7c('0x8'));module[_0x8e7c('0x9')]=function(_0x1e4186,_0x1a92c4){return _0x1e4186[_0x8e7c('0xa')](_0x8e7c('0xb'),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 d7f5431..2a2f288 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailSubstatus,\x20%s,\x20%s','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x3b95ac,_0x58738b){var _0x4a777b=function(_0x2782df){while(--_0x2782df){_0x3b95ac['push'](_0x3b95ac['shift']());}};_0x4a777b(++_0x58738b);}(_0x9f62,0x154));var _0x29f6=function(_0x1b0bc0,_0x498be6){_0x1b0bc0=_0x1b0bc0-0x0;var _0x1cdbc0=_0x9f62[_0x1b0bc0];return _0x1cdbc0;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x33d7e9,_0x500ef5){_0x33d7e9=_0x33d7e9-0x0;var _0x269ff1=_0xbdb7[_0x33d7e9];return _0x269ff1;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index d4d8848..f7677f4 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 _0x66eb=['util','path','connect-timeout','express','Router','../../components/auth/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','update','delete','destroy','exports','multer'];(function(_0x3a83ef,_0x2f9c2c){var _0x4c8131=function(_0x2396c5){while(--_0x2396c5){_0x3a83ef['push'](_0x3a83ef['shift']());}};_0x4c8131(++_0x2f9c2c);}(_0x66eb,0xa9));var _0xb66e=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0x66eb[_0x50a004];return _0x5e9992;};'use strict';var multer=require(_0xb66e('0x0'));var util=require(_0xb66e('0x1'));var path=require(_0xb66e('0x2'));var timeout=require(_0xb66e('0x3'));var express=require(_0xb66e('0x4'));var router=express[_0xb66e('0x5')]();var auth=require(_0xb66e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb66e('0x7'));router[_0xb66e('0x8')]('/',auth[_0xb66e('0x9')](),controller[_0xb66e('0xa')]);router[_0xb66e('0x8')](_0xb66e('0xb'),auth[_0xb66e('0x9')](),controller['describe']);router[_0xb66e('0x8')](_0xb66e('0xc'),auth[_0xb66e('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb66e('0xc'),auth[_0xb66e('0x9')](),controller[_0xb66e('0xd')]);router[_0xb66e('0xe')]('/:id',auth[_0xb66e('0x9')](),controller[_0xb66e('0xf')]);module[_0xb66e('0x10')]=router; \ No newline at end of file +var _0x8795=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8795,0x161));var _0x5879=function(_0x4d421f,_0x114481){_0x4d421f=_0x4d421f-0x0;var _0x1cf5ab=_0x8795[_0x4d421f];return _0x1cf5ab;};'use strict';var multer=require(_0x5879('0x0'));var util=require(_0x5879('0x1'));var path=require('path');var timeout=require(_0x5879('0x2'));var express=require(_0x5879('0x3'));var router=express[_0x5879('0x4')]();var auth=require(_0x5879('0x5'));var interaction=require(_0x5879('0x6'));var config=require(_0x5879('0x7'));var controller=require(_0x5879('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5879('0x9')]);router['get'](_0x5879('0xa'),auth['isAuthenticated'](),controller[_0x5879('0xb')]);router['get'](_0x5879('0xc'),auth[_0x5879('0xd')](),controller[_0x5879('0xe')]);router[_0x5879('0xf')]('/',auth['isAuthenticated'](),controller[_0x5879('0x10')]);router[_0x5879('0x11')](_0x5879('0xc'),auth['isAuthenticated'](),controller[_0x5879('0x12')]);router[_0x5879('0x13')]('/:id',auth[_0x5879('0xd')](),controller[_0x5879('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 8f097d1..93bc7c5 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 _0x991f=['sequelize','STRING','ENUM','account','agent','queue','DATE','moment'];(function(_0x1a0db7,_0x596058){var _0x3c5f30=function(_0x4cbe71){while(--_0x4cbe71){_0x1a0db7['push'](_0x1a0db7['shift']());}};_0x3c5f30(++_0x596058);}(_0x991f,0x77));var _0xf991=function(_0x44d0d3,_0xb79a05){_0x44d0d3=_0x44d0d3-0x0;var _0x4d4a0a=_0x991f[_0x44d0d3];return _0x4d4a0a;};'use strict';var moment=require(_0xf991('0x0'));var Sequelize=require(_0xf991('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xf991('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf991('0x3')](_0xf991('0x4'),_0xf991('0x5'),_0xf991('0x6')),'allowNull':![],'defaultValue':_0xf991('0x6')},'transferredAt':{'type':Sequelize[_0xf991('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x834d=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x5e3cd6,_0x4fd9cd){var _0x125794=function(_0x4b007c){while(--_0x4b007c){_0x5e3cd6['push'](_0x5e3cd6['shift']());}};_0x125794(++_0x4fd9cd);}(_0x834d,0x93));var _0xd834=function(_0x174b97,_0x9803d5){_0x174b97=_0x174b97-0x0;var _0x5de371=_0x834d[_0x174b97];return _0x5de371;};'use strict';var moment=require(_0xd834('0x0'));var Sequelize=require('sequelize');module[_0xd834('0x1')]={'uniqueid':{'type':Sequelize[_0xd834('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd834('0x3')](_0xd834('0x4'),_0xd834('0x5'),_0xd834('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xd834('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xd834('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 3534312..3071aee 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 _0x6173=['offset','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','intersection','model','query','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','includeAll','catch','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x6173,0x167));var _0x3617=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x6173[_0x53ccf2];return _0x5a2964;};'use strict';var pdf=require(_0x3617('0x0'));var emlformat=require(_0x3617('0x1'));var rimraf=require(_0x3617('0x2'));var zipdir=require(_0x3617('0x3'));var jsonpatch=require(_0x3617('0x4'));var rp=require(_0x3617('0x5'));var moment=require(_0x3617('0x6'));var BPromise=require(_0x3617('0x7'));var Mustache=require(_0x3617('0x8'));var util=require(_0x3617('0x9'));var path=require(_0x3617('0xa'));var sox=require('sox');var csv=require(_0x3617('0xb'));var ejs=require(_0x3617('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3617('0xd'));var crypto=require('crypto');var jsforce=require(_0x3617('0xe'));var deskjs=require(_0x3617('0xf'));var toCsv=require(_0x3617('0xb'));var querystring=require(_0x3617('0x10'));var Papa=require(_0x3617('0x11'));var Redis=require(_0x3617('0x12'));var authService=require(_0x3617('0x13'));var qs=require(_0x3617('0x14'));var as=require(_0x3617('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3617('0x16'))(_0x3617('0x17'));var utils=require(_0x3617('0x18'));var config=require(_0x3617('0x19'));var db=require(_0x3617('0x1a'))['db'];function respondWithStatusCode(_0x102f07,_0x331c2d){_0x331c2d=_0x331c2d||0xcc;return function(_0x408cb9){if(_0x408cb9){return _0x102f07[_0x3617('0x1b')](_0x331c2d);}return _0x102f07[_0x3617('0x1c')](_0x331c2d)[_0x3617('0x1d')]();};}function respondWithResult(_0x46da2d,_0x31bca){_0x31bca=_0x31bca||0xc8;return function(_0x503287){if(_0x503287){return _0x46da2d[_0x3617('0x1c')](_0x31bca)['json'](_0x503287);}};}function respondWithFilteredResult(_0x2cfc2e,_0x5f557c){return function(_0x20086b){if(_0x20086b){var _0x10837d=_0x20086b[_0x3617('0x1e')],_0x4feb4a=_0x5f557c[_0x3617('0x1f')],_0x29623b=_0x5f557c['offset']+_0x5f557c['limit'],_0x57d83b;if(_0x29623b>=_0x10837d){_0x29623b=_0x10837d;_0x57d83b=0xc8;}else{_0x57d83b=0xce;}_0x2cfc2e[_0x3617('0x1c')](_0x57d83b);return _0x2cfc2e[_0x3617('0x20')](_0x3617('0x21'),_0x4feb4a+'-'+_0x29623b+'/'+_0x10837d)[_0x3617('0x22')](_0x20086b);}return null;};}function patchUpdates(_0x2a7baf){return function(_0x349a83){try{jsonpatch[_0x3617('0x23')](_0x349a83,_0x2a7baf,!![]);}catch(_0x17655e){return BPromise['reject'](_0x17655e);}return _0x349a83['save']();};}function saveUpdates(_0x413e8a,_0x10c3c4){return function(_0x309d25){if(_0x309d25){return _0x309d25[_0x3617('0x24')](_0x413e8a)[_0x3617('0x25')](function(_0xaeba8b){return _0xaeba8b;});}return null;};}function removeEntity(_0x39a700,_0x964145){return function(_0x266a1f){if(_0x266a1f){return _0x266a1f[_0x3617('0x26')]()['then'](function(){_0x39a700[_0x3617('0x1c')](0xcc)[_0x3617('0x1d')]();});}};}function handleEntityNotFound(_0x36b3fa,_0x370f06){return function(_0x1bf2bc){if(!_0x1bf2bc){_0x36b3fa[_0x3617('0x1b')](0x194);}return _0x1bf2bc;};}function handleError(_0x47fb48,_0x57e718){_0x57e718=_0x57e718||0x1f4;return function(_0x4057ea){logger[_0x3617('0x27')](_0x4057ea[_0x3617('0x28')]);if(_0x4057ea[_0x3617('0x29')]){delete _0x4057ea['name'];}_0x47fb48['status'](_0x57e718)[_0x3617('0x2a')](_0x4057ea);};}exports['index']=function(_0x329858,_0x24d2b9){var _0x376e42={},_0x32ee81={},_0x574fc3={'count':0x0,'rows':[]};var _0x408932=_[_0x3617('0x2b')](db[_0x3617('0x2c')][_0x3617('0x2d')],function(_0x44e868){return{'name':_0x44e868[_0x3617('0x2e')],'type':_0x44e868[_0x3617('0x2f')][_0x3617('0x30')]};});_0x32ee81['model']=_['map'](_0x408932,_0x3617('0x29'));_0x32ee81['query']=_['keys'](_0x329858['query']);_0x32ee81['filters']=_[_0x3617('0x31')](_0x32ee81[_0x3617('0x32')],_0x32ee81[_0x3617('0x33')]);_0x376e42['attributes']=_[_0x3617('0x31')](_0x32ee81[_0x3617('0x32')],qs[_0x3617('0x34')](_0x329858[_0x3617('0x33')][_0x3617('0x34')]));_0x376e42[_0x3617('0x35')]=_0x376e42[_0x3617('0x35')][_0x3617('0x36')]?_0x376e42[_0x3617('0x35')]:_0x32ee81[_0x3617('0x32')];if(!_0x329858['query'][_0x3617('0x37')]('nolimit')){_0x376e42['limit']=qs['limit'](_0x329858[_0x3617('0x33')][_0x3617('0x38')]);_0x376e42[_0x3617('0x1f')]=qs['offset'](_0x329858[_0x3617('0x33')][_0x3617('0x1f')]);}_0x376e42[_0x3617('0x39')]=qs[_0x3617('0x3a')](_0x329858[_0x3617('0x33')][_0x3617('0x3a')]);_0x376e42[_0x3617('0x3b')]=qs[_0x3617('0x3c')](_[_0x3617('0x3d')](_0x329858[_0x3617('0x33')],_0x32ee81[_0x3617('0x3c')]),_0x408932);if(_0x329858[_0x3617('0x33')][_0x3617('0x3e')]){_0x376e42[_0x3617('0x3b')]=_['merge'](_0x376e42[_0x3617('0x3b')],{'$or':_['map'](_0x408932,function(_0xdb3043){if(_0xdb3043[_0x3617('0x2f')]!==_0x3617('0x3f')){var _0x15cdaf={};_0x15cdaf[_0xdb3043[_0x3617('0x29')]]={'$like':'%'+_0x329858['query'][_0x3617('0x3e')]+'%'};return _0x15cdaf;}})});}_0x376e42=_[_0x3617('0x40')]({},_0x376e42,_0x329858[_0x3617('0x41')]);var _0x38ef15={'where':_0x376e42[_0x3617('0x3b')]};return db[_0x3617('0x2c')][_0x3617('0x1e')](_0x38ef15)['then'](function(_0xa0093a){_0x574fc3[_0x3617('0x1e')]=_0xa0093a;if(_0x329858[_0x3617('0x33')]['includeAll']){_0x376e42[_0x3617('0x42')]=[{'all':!![]}];}return db[_0x3617('0x2c')][_0x3617('0x43')](_0x376e42);})['then'](function(_0x34fb15){_0x574fc3[_0x3617('0x44')]=_0x34fb15;return _0x574fc3;})[_0x3617('0x25')](respondWithFilteredResult(_0x24d2b9,_0x376e42))['catch'](handleError(_0x24d2b9,null));};exports[_0x3617('0x45')]=function(_0x59e5fc,_0x144166){var _0x56827a={'raw':!![],'where':{'id':_0x59e5fc[_0x3617('0x46')]['id']}},_0x51e97e={};_0x51e97e[_0x3617('0x32')]=_[_0x3617('0x47')](db[_0x3617('0x2c')]['rawAttributes']);_0x51e97e[_0x3617('0x33')]=_[_0x3617('0x47')](_0x59e5fc[_0x3617('0x33')]);_0x51e97e[_0x3617('0x3c')]=_['intersection'](_0x51e97e['model'],_0x51e97e['query']);_0x56827a[_0x3617('0x35')]=_[_0x3617('0x31')](_0x51e97e['model'],qs[_0x3617('0x34')](_0x59e5fc['query']['fields']));_0x56827a[_0x3617('0x35')]=_0x56827a['attributes'][_0x3617('0x36')]?_0x56827a['attributes']:_0x51e97e[_0x3617('0x32')];if(_0x59e5fc['query'][_0x3617('0x48')]){_0x56827a['include']=[{'all':!![]}];}_0x56827a=_[_0x3617('0x40')]({},_0x56827a,_0x59e5fc[_0x3617('0x41')]);return db[_0x3617('0x2c')]['find'](_0x56827a)['then'](handleEntityNotFound(_0x144166,null))['then'](respondWithResult(_0x144166,null))[_0x3617('0x49')](handleError(_0x144166,null));};exports[_0x3617('0x4a')]=function(_0x53e6df,_0x3807bd){return db[_0x3617('0x2c')]['create'](_0x53e6df[_0x3617('0x4b')],{})['then'](respondWithResult(_0x3807bd,0xc9))[_0x3617('0x49')](handleError(_0x3807bd,null));};exports['update']=function(_0x4758f7,_0xa002a2){if(_0x4758f7['body']['id']){delete _0x4758f7[_0x3617('0x4b')]['id'];}return db['MailTransferReport'][_0x3617('0x4c')]({'where':{'id':_0x4758f7[_0x3617('0x46')]['id']}})[_0x3617('0x25')](handleEntityNotFound(_0xa002a2,null))['then'](saveUpdates(_0x4758f7[_0x3617('0x4b')],null))[_0x3617('0x25')](respondWithResult(_0xa002a2,null))[_0x3617('0x49')](handleError(_0xa002a2,null));};exports['destroy']=function(_0x4f397b,_0x2a34fc){return db[_0x3617('0x2c')]['find']({'where':{'id':_0x4f397b[_0x3617('0x46')]['id']}})[_0x3617('0x25')](handleEntityNotFound(_0x2a34fc,null))['then'](removeEntity(_0x2a34fc,null))['catch'](handleError(_0x2a34fc,null));};exports['describe']=function(_0x11e351,_0x300f05){return db[_0x3617('0x2c')][_0x3617('0x4d')]()[_0x3617('0x25')](respondWithResult(_0x300f05,null))[_0x3617('0x49')](handleError(_0x300f05,null));}; \ No newline at end of file +var _0xb211=['zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','end','json','count','offset','set','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','MailTransferReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','limit','order','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','show','params','length','include','find','create','body','catch','describe','eml-format','rimraf'];(function(_0x31749b,_0x3a3f5b){var _0x27ae18=function(_0x16a90e){while(--_0x16a90e){_0x31749b['push'](_0x31749b['shift']());}};_0x27ae18(++_0x3a3f5b);}(_0xb211,0xd3));var _0x1b21=function(_0x5a5aab,_0x1ca3ea){_0x5a5aab=_0x5a5aab-0x0;var _0x1ba525=_0xb211[_0x5a5aab];return _0x1ba525;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b21('0x0'));var rimraf=require(_0x1b21('0x1'));var zipdir=require(_0x1b21('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b21('0x3'));var moment=require(_0x1b21('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b21('0x5'));var path=require(_0x1b21('0x6'));var sox=require(_0x1b21('0x7'));var csv=require(_0x1b21('0x8'));var ejs=require(_0x1b21('0x9'));var fs=require('fs');var _=require(_0x1b21('0xa'));var squel=require(_0x1b21('0xb'));var crypto=require('crypto');var jsforce=require(_0x1b21('0xc'));var deskjs=require(_0x1b21('0xd'));var toCsv=require(_0x1b21('0x8'));var querystring=require('querystring');var Papa=require(_0x1b21('0xe'));var Redis=require(_0x1b21('0xf'));var authService=require(_0x1b21('0x10'));var qs=require(_0x1b21('0x11'));var as=require(_0x1b21('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1b21('0x13'));var utils=require(_0x1b21('0x14'));var config=require('../../config/environment');var db=require(_0x1b21('0x15'))['db'];function respondWithStatusCode(_0x270530,_0x5ec95c){_0x5ec95c=_0x5ec95c||0xcc;return function(_0x160c85){if(_0x160c85){return _0x270530['sendStatus'](_0x5ec95c);}return _0x270530[_0x1b21('0x16')](_0x5ec95c)[_0x1b21('0x17')]();};}function respondWithResult(_0x1671ca,_0x2aacbd){_0x2aacbd=_0x2aacbd||0xc8;return function(_0x2965b8){if(_0x2965b8){return _0x1671ca[_0x1b21('0x16')](_0x2aacbd)[_0x1b21('0x18')](_0x2965b8);}};}function respondWithFilteredResult(_0x457b48,_0x2982f0){return function(_0x54a296){if(_0x54a296){var _0x44948d=_0x54a296[_0x1b21('0x19')],_0x179f83=_0x2982f0['offset'],_0x15bd5e=_0x2982f0[_0x1b21('0x1a')]+_0x2982f0['limit'],_0x1d6ee5;if(_0x15bd5e>=_0x44948d){_0x15bd5e=_0x44948d;_0x1d6ee5=0xc8;}else{_0x1d6ee5=0xce;}_0x457b48[_0x1b21('0x16')](_0x1d6ee5);return _0x457b48[_0x1b21('0x1b')]('Content-Range',_0x179f83+'-'+_0x15bd5e+'/'+_0x44948d)[_0x1b21('0x18')](_0x54a296);}return null;};}function patchUpdates(_0x517b76){return function(_0x378668){try{jsonpatch[_0x1b21('0x1c')](_0x378668,_0x517b76,!![]);}catch(_0x1be55f){return BPromise[_0x1b21('0x1d')](_0x1be55f);}return _0x378668[_0x1b21('0x1e')]();};}function saveUpdates(_0x325649,_0x19d598){return function(_0x1c3e23){if(_0x1c3e23){return _0x1c3e23[_0x1b21('0x1f')](_0x325649)['then'](function(_0x932176){return _0x932176;});}return null;};}function removeEntity(_0x8d12dd,_0x2882bd){return function(_0x22531f){if(_0x22531f){return _0x22531f[_0x1b21('0x20')]()[_0x1b21('0x21')](function(){_0x8d12dd[_0x1b21('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ae352,_0x590749){return function(_0x1b0de0){if(!_0x1b0de0){_0x5ae352[_0x1b21('0x22')](0x194);}return _0x1b0de0;};}function handleError(_0x51a608,_0x8d7348){_0x8d7348=_0x8d7348||0x1f4;return function(_0x4c1b70){logger['error'](_0x4c1b70[_0x1b21('0x23')]);if(_0x4c1b70[_0x1b21('0x24')]){delete _0x4c1b70[_0x1b21('0x24')];}_0x51a608[_0x1b21('0x16')](_0x8d7348)[_0x1b21('0x25')](_0x4c1b70);};}exports[_0x1b21('0x26')]=function(_0x4b7124,_0x10e945){var _0x15e488={},_0x330094={},_0xaf3e0a={'count':0x0,'rows':[]};var _0x18c3c9=_['map'](db[_0x1b21('0x27')][_0x1b21('0x28')],function(_0x3a46fe){return{'name':_0x3a46fe[_0x1b21('0x29')],'type':_0x3a46fe['type'][_0x1b21('0x2a')]};});_0x330094['model']=_[_0x1b21('0x2b')](_0x18c3c9,_0x1b21('0x24'));_0x330094[_0x1b21('0x2c')]=_[_0x1b21('0x2d')](_0x4b7124[_0x1b21('0x2c')]);_0x330094[_0x1b21('0x2e')]=_[_0x1b21('0x2f')](_0x330094[_0x1b21('0x30')],_0x330094['query']);_0x15e488['attributes']=_[_0x1b21('0x2f')](_0x330094['model'],qs[_0x1b21('0x31')](_0x4b7124[_0x1b21('0x2c')][_0x1b21('0x31')]));_0x15e488[_0x1b21('0x32')]=_0x15e488['attributes']['length']?_0x15e488[_0x1b21('0x32')]:_0x330094['model'];if(!_0x4b7124[_0x1b21('0x2c')]['hasOwnProperty']('nolimit')){_0x15e488[_0x1b21('0x33')]=qs['limit'](_0x4b7124[_0x1b21('0x2c')][_0x1b21('0x33')]);_0x15e488[_0x1b21('0x1a')]=qs[_0x1b21('0x1a')](_0x4b7124[_0x1b21('0x2c')]['offset']);}_0x15e488[_0x1b21('0x34')]=qs[_0x1b21('0x35')](_0x4b7124['query'][_0x1b21('0x35')]);_0x15e488[_0x1b21('0x36')]=qs[_0x1b21('0x2e')](_['pick'](_0x4b7124['query'],_0x330094[_0x1b21('0x2e')]),_0x18c3c9);if(_0x4b7124[_0x1b21('0x2c')][_0x1b21('0x37')]){_0x15e488[_0x1b21('0x36')]=_[_0x1b21('0x38')](_0x15e488[_0x1b21('0x36')],{'$or':_[_0x1b21('0x2b')](_0x18c3c9,function(_0x454b2f){if(_0x454b2f[_0x1b21('0x39')]!==_0x1b21('0x3a')){var _0x16f9a7={};_0x16f9a7[_0x454b2f[_0x1b21('0x24')]]={'$like':'%'+_0x4b7124[_0x1b21('0x2c')][_0x1b21('0x37')]+'%'};return _0x16f9a7;}})});}_0x15e488=_['merge']({},_0x15e488,_0x4b7124[_0x1b21('0x3b')]);var _0x33b22f={'where':_0x15e488[_0x1b21('0x36')]};return db['MailTransferReport'][_0x1b21('0x19')](_0x33b22f)['then'](function(_0x2fb5c4){_0xaf3e0a[_0x1b21('0x19')]=_0x2fb5c4;if(_0x4b7124[_0x1b21('0x2c')]['includeAll']){_0x15e488['include']=[{'all':!![]}];}return db[_0x1b21('0x27')][_0x1b21('0x3c')](_0x15e488);})[_0x1b21('0x21')](function(_0xe43b75){_0xaf3e0a[_0x1b21('0x3d')]=_0xe43b75;return _0xaf3e0a;})[_0x1b21('0x21')](respondWithFilteredResult(_0x10e945,_0x15e488))['catch'](handleError(_0x10e945,null));};exports[_0x1b21('0x3e')]=function(_0xeb4cd9,_0x565b60){var _0x3b9beb={'raw':!![],'where':{'id':_0xeb4cd9[_0x1b21('0x3f')]['id']}},_0x2cfe9f={};_0x2cfe9f[_0x1b21('0x30')]=_[_0x1b21('0x2d')](db[_0x1b21('0x27')]['rawAttributes']);_0x2cfe9f[_0x1b21('0x2c')]=_['keys'](_0xeb4cd9[_0x1b21('0x2c')]);_0x2cfe9f[_0x1b21('0x2e')]=_[_0x1b21('0x2f')](_0x2cfe9f[_0x1b21('0x30')],_0x2cfe9f['query']);_0x3b9beb[_0x1b21('0x32')]=_[_0x1b21('0x2f')](_0x2cfe9f['model'],qs[_0x1b21('0x31')](_0xeb4cd9[_0x1b21('0x2c')]['fields']));_0x3b9beb[_0x1b21('0x32')]=_0x3b9beb['attributes'][_0x1b21('0x40')]?_0x3b9beb[_0x1b21('0x32')]:_0x2cfe9f['model'];if(_0xeb4cd9[_0x1b21('0x2c')]['includeAll']){_0x3b9beb[_0x1b21('0x41')]=[{'all':!![]}];}_0x3b9beb=_[_0x1b21('0x38')]({},_0x3b9beb,_0xeb4cd9['options']);return db[_0x1b21('0x27')][_0x1b21('0x42')](_0x3b9beb)[_0x1b21('0x21')](handleEntityNotFound(_0x565b60,null))[_0x1b21('0x21')](respondWithResult(_0x565b60,null))['catch'](handleError(_0x565b60,null));};exports[_0x1b21('0x43')]=function(_0xa1dd4c,_0x42735e){return db[_0x1b21('0x27')][_0x1b21('0x43')](_0xa1dd4c['body'],{})[_0x1b21('0x21')](respondWithResult(_0x42735e,0xc9))['catch'](handleError(_0x42735e,null));};exports[_0x1b21('0x1f')]=function(_0x5e29bb,_0x20dde3){if(_0x5e29bb[_0x1b21('0x44')]['id']){delete _0x5e29bb['body']['id'];}return db[_0x1b21('0x27')][_0x1b21('0x42')]({'where':{'id':_0x5e29bb[_0x1b21('0x3f')]['id']}})[_0x1b21('0x21')](handleEntityNotFound(_0x20dde3,null))[_0x1b21('0x21')](saveUpdates(_0x5e29bb[_0x1b21('0x44')],null))[_0x1b21('0x21')](respondWithResult(_0x20dde3,null))[_0x1b21('0x45')](handleError(_0x20dde3,null));};exports[_0x1b21('0x20')]=function(_0x2a599b,_0x58e5ab){return db[_0x1b21('0x27')][_0x1b21('0x42')]({'where':{'id':_0x2a599b['params']['id']}})[_0x1b21('0x21')](handleEntityNotFound(_0x58e5ab,null))[_0x1b21('0x21')](removeEntity(_0x58e5ab,null))[_0x1b21('0x45')](handleError(_0x58e5ab,null));};exports['describe']=function(_0x544b9a,_0x2ff899){return db['MailTransferReport'][_0x1b21('0x46')]()[_0x1b21('0x21')](respondWithResult(_0x2ff899,null))[_0x1b21('0x45')](handleError(_0x2ff899,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e21cd7a..2fbf0dc 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 _0xdbf5=['bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xdbf5,0x1dd));var _0x5dbf=function(_0x3ea15a,_0x516c17){_0x3ea15a=_0x3ea15a-0x0;var _0xe63ea9=_0xdbf5[_0x3ea15a];return _0xe63ea9;};'use strict';var _=require(_0x5dbf('0x0'));var util=require('util');var logger=require(_0x5dbf('0x1'))(_0x5dbf('0x2'));var moment=require(_0x5dbf('0x3'));var BPromise=require(_0x5dbf('0x4'));var rp=require(_0x5dbf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5dbf('0x6'));var config=require(_0x5dbf('0x7'));var attributes=require(_0x5dbf('0x8'));module[_0x5dbf('0x9')]=function(_0x4fde62,_0x41e6d7){return _0x4fde62['define'](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[{'name':_0x5dbf('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b81=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x2ecbbf,_0x21abde){var _0x314081=function(_0x43c908){while(--_0x43c908){_0x2ecbbf['push'](_0x2ecbbf['shift']());}};_0x314081(++_0x21abde);}(_0x9b81,0x1bb));var _0x19b8=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9b81[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x19b8('0x0'));var util=require(_0x19b8('0x1'));var logger=require(_0x19b8('0x2'))(_0x19b8('0x3'));var moment=require('moment');var BPromise=require(_0x19b8('0x4'));var rp=require(_0x19b8('0x5'));var fs=require('fs');var path=require(_0x19b8('0x6'));var rimraf=require(_0x19b8('0x7'));var config=require(_0x19b8('0x8'));var attributes=require(_0x19b8('0x9'));module[_0x19b8('0xa')]=function(_0x1221ef,_0x5a8c9e){return _0x1221ef[_0x19b8('0xb')](_0x19b8('0xc'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x19b8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 47a3124..8daaec2 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 _0xb432=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailTransferReport,\x20%s,\x20%s','result','catch','util'];(function(_0x2f2ed0,_0x1c6435){var _0x250b0d=function(_0x1909c1){while(--_0x1909c1){_0x2f2ed0['push'](_0x2f2ed0['shift']());}};_0x250b0d(++_0x1c6435);}(_0xb432,0xbc));var _0x2b43=function(_0x48354e,_0x497f46){_0x48354e=_0x48354e-0x0;var _0x3c411a=_0xb432[_0x48354e];return _0x3c411a;};'use strict';var _=require('lodash');var util=require(_0x2b43('0x0'));var moment=require(_0x2b43('0x1'));var BPromise=require(_0x2b43('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b43('0x3'));var db=require(_0x2b43('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b43('0x5'))('rpc');var config=require(_0x2b43('0x6'));var jayson=require(_0x2b43('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x597634,_0x3316e3,_0x5f3d76){return new BPromise(function(_0x4502f5,_0x1e5ee9){return client[_0x2b43('0x8')](_0x597634,_0x5f3d76)[_0x2b43('0x9')](function(_0x3b52be){logger[_0x2b43('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x3316e3,'request\x20sent');logger[_0x2b43('0xb')](_0x2b43('0xc'),_0x3316e3,_0x2b43('0xd'),JSON[_0x2b43('0xe')](_0x3b52be));if(_0x3b52be['error']){if(_0x3b52be[_0x2b43('0xf')][_0x2b43('0x10')]===0x1f4){logger[_0x2b43('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x3316e3,_0x3b52be[_0x2b43('0xf')][_0x2b43('0x11')]);return _0x1e5ee9(_0x3b52be['error'][_0x2b43('0x11')]);}logger[_0x2b43('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x3316e3,_0x3b52be[_0x2b43('0xf')][_0x2b43('0x11')]);return _0x4502f5(_0x3b52be[_0x2b43('0xf')][_0x2b43('0x11')]);}else{logger[_0x2b43('0xa')](_0x2b43('0x12'),_0x3316e3,_0x2b43('0xd'));_0x4502f5(_0x3b52be[_0x2b43('0x13')][_0x2b43('0x11')]);}})[_0x2b43('0x14')](function(_0x561def){logger[_0x2b43('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x3316e3,_0x561def);_0x1e5ee9(_0x561def);});});} \ No newline at end of file +var _0x33d5=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3e4d28,_0x3face9){var _0x11a3af=function(_0x26c146){while(--_0x26c146){_0x3e4d28['push'](_0x3e4d28['shift']());}};_0x11a3af(++_0x3face9);}(_0x33d5,0xa3));var _0x533d=function(_0x17898f,_0x177e1e){_0x17898f=_0x17898f-0x0;var _0x49908d=_0x33d5[_0x17898f];return _0x49908d;};'use strict';var _=require(_0x533d('0x0'));var util=require(_0x533d('0x1'));var moment=require(_0x533d('0x2'));var BPromise=require(_0x533d('0x3'));var rs=require(_0x533d('0x4'));var fs=require('fs');var Redis=require(_0x533d('0x5'));var db=require(_0x533d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x533d('0x7'));var config=require(_0x533d('0x8'));var jayson=require(_0x533d('0x9'));var client=jayson[_0x533d('0xa')][_0x533d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x174531,_0x380439,_0x71d9fd){return new BPromise(function(_0x21a3d5,_0x154307){return client[_0x533d('0xc')](_0x174531,_0x71d9fd)[_0x533d('0xd')](function(_0x4d7b76){logger[_0x533d('0xe')](_0x533d('0xf'),_0x380439,'request\x20sent');logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x380439,'request\x20sent',JSON['stringify'](_0x4d7b76));if(_0x4d7b76[_0x533d('0x10')]){if(_0x4d7b76[_0x533d('0x10')]['code']===0x1f4){logger[_0x533d('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x380439,_0x4d7b76[_0x533d('0x10')][_0x533d('0x11')]);return _0x154307(_0x4d7b76['error'][_0x533d('0x11')]);}logger[_0x533d('0x10')](_0x533d('0xf'),_0x380439,_0x4d7b76[_0x533d('0x10')][_0x533d('0x11')]);return _0x21a3d5(_0x4d7b76[_0x533d('0x10')][_0x533d('0x11')]);}else{logger[_0x533d('0xe')](_0x533d('0xf'),_0x380439,_0x533d('0x12'));_0x21a3d5(_0x4d7b76[_0x533d('0x13')]['message']);}})[_0x533d('0x14')](function(_0x5e6064){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x380439,_0x5e6064);_0x154307(_0x5e6064);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 44b5af2..2528570 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 _0x0801=['get','isAuthenticated','index','/describe','describe','show','post','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./memberReport.controller'];(function(_0x1d8a63,_0x5b111e){var _0x6ee2ac=function(_0x1b3750){while(--_0x1b3750){_0x1d8a63['push'](_0x1d8a63['shift']());}};_0x6ee2ac(++_0x5b111e);}(_0x0801,0x6b));var _0x1080=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0801[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x1080('0x0'));var util=require('util');var path=require(_0x1080('0x1'));var timeout=require(_0x1080('0x2'));var express=require('express');var router=express[_0x1080('0x3')]();var auth=require(_0x1080('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1080('0x5'));var controller=require(_0x1080('0x6'));router[_0x1080('0x7')]('/',auth[_0x1080('0x8')](),controller[_0x1080('0x9')]);router[_0x1080('0x7')](_0x1080('0xa'),auth[_0x1080('0x8')](),controller[_0x1080('0xb')]);router[_0x1080('0x7')]('/:id',auth[_0x1080('0x8')](),controller[_0x1080('0xc')]);router[_0x1080('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x1080('0x8')](),controller[_0x1080('0xe')]);router[_0x1080('0xf')](_0x1080('0x10'),auth[_0x1080('0x8')](),controller[_0x1080('0x11')]);module[_0x1080('0x12')]=router; \ No newline at end of file +var _0x0428=['get','/describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index'];(function(_0x10b47e,_0x1f8b2f){var _0x4e26d4=function(_0x170b66){while(--_0x170b66){_0x10b47e['push'](_0x10b47e['shift']());}};_0x4e26d4(++_0x1f8b2f);}(_0x0428,0xb2));var _0x8042=function(_0x1e603d,_0x14a537){_0x1e603d=_0x1e603d-0x0;var _0x542701=_0x0428[_0x1e603d];return _0x542701;};'use strict';var multer=require(_0x8042('0x0'));var util=require(_0x8042('0x1'));var path=require(_0x8042('0x2'));var timeout=require('connect-timeout');var express=require(_0x8042('0x3'));var router=express[_0x8042('0x4')]();var auth=require(_0x8042('0x5'));var interaction=require(_0x8042('0x6'));var config=require(_0x8042('0x7'));var controller=require(_0x8042('0x8'));router['get']('/',auth[_0x8042('0x9')](),controller[_0x8042('0xa')]);router[_0x8042('0xb')](_0x8042('0xc'),auth[_0x8042('0x9')](),controller['describe']);router[_0x8042('0xb')](_0x8042('0xd'),auth[_0x8042('0x9')](),controller['show']);router[_0x8042('0xe')]('/',auth[_0x8042('0x9')](),controller[_0x8042('0xf')]);router[_0x8042('0x10')](_0x8042('0xd'),auth[_0x8042('0x9')](),controller[_0x8042('0x11')]);router[_0x8042('0x12')](_0x8042('0xd'),auth[_0x8042('0x9')](),controller[_0x8042('0x13')]);module[_0x8042('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 51a78a9..87f5502 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 _0xe520=['STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports'];(function(_0x1a7d3f,_0x5666b8){var _0x3d5670=function(_0x5d1204){while(--_0x5d1204){_0x1a7d3f['push'](_0x1a7d3f['shift']());}};_0x3d5670(++_0x5666b8);}(_0xe520,0xeb));var _0x0e52=function(_0x18281a,_0x2b788a){_0x18281a=_0x18281a-0x0;var _0x23f94e=_0xe520[_0x18281a];return _0x23f94e;};'use strict';var Sequelize=require(_0x0e52('0x0'));var moment=require(_0x0e52('0x1'));module[_0x0e52('0x2')]={'channel':{'type':Sequelize[_0x0e52('0x3')]},'membername':{'type':Sequelize[_0x0e52('0x3')]},'interface':{'type':Sequelize[_0x0e52('0x3')]},'type':{'type':Sequelize[_0x0e52('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x0e52('0x4')},'duration':{'type':Sequelize[_0x0e52('0x5')]},'enterAt':{'type':Sequelize[_0x0e52('0x6')]},'exitAt':{'type':Sequelize[_0x0e52('0x6')],'set':function(_0x273a58){var _0x2086d6=moment(_0x273a58);var _0x26d998=moment(this[_0x0e52('0x7')](_0x0e52('0x8')));var _0x50928d=_0x2086d6[_0x0e52('0x9')](_0x26d998,_0x0e52('0xa'));this[_0x0e52('0xb')](_0x0e52('0xc'),_0x273a58);this[_0x0e52('0xb')]('duration',_0x50928d||null);}},'data1':{'type':Sequelize[_0x0e52('0x3')],'comment':_0x0e52('0xd')},'data2':{'type':Sequelize[_0x0e52('0x3')],'comment':_0x0e52('0xe')},'data3':{'type':Sequelize[_0x0e52('0x3')],'comment':_0x0e52('0xf')},'data4':{'type':Sequelize[_0x0e52('0x3')],'comment':_0x0e52('0x10')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x0e52('0x3')]},'internal':{'type':Sequelize[_0x0e52('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc481=['setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds'];(function(_0xf071fa,_0x1cd190){var _0x2a432a=function(_0x22873e){while(--_0x22873e){_0xf071fa['push'](_0xf071fa['shift']());}};_0x2a432a(++_0x1cd190);}(_0xc481,0xaa));var _0x1c48=function(_0x27a3cb,_0x4af597){_0x27a3cb=_0x27a3cb-0x0;var _0x54ff38=_0xc481[_0x27a3cb];return _0x54ff38;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1c48('0x0'));module[_0x1c48('0x1')]={'channel':{'type':Sequelize[_0x1c48('0x2')]},'membername':{'type':Sequelize[_0x1c48('0x2')]},'interface':{'type':Sequelize[_0x1c48('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x1c48('0x3'),'comment':_0x1c48('0x4')},'duration':{'type':Sequelize[_0x1c48('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x1c48('0x6')],'set':function(_0x199482){var _0x505aa6=moment(_0x199482);var _0x4447aa=moment(this[_0x1c48('0x7')]('enterAt'));var _0x17b300=_0x505aa6[_0x1c48('0x8')](_0x4447aa,_0x1c48('0x9'));this[_0x1c48('0xa')](_0x1c48('0xb'),_0x199482);this[_0x1c48('0xa')]('duration',_0x17b300||null);}},'data1':{'type':Sequelize[_0x1c48('0x2')],'comment':_0x1c48('0xc')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x1c48('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x1c48('0x2')],'comment':_0x1c48('0xd')},'data5':{'type':Sequelize[_0x1c48('0x2')],'comment':_0x1c48('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x1c48('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index c3c643b..6589a19 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 _0x80f5=['../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','save','then','destroy','end','error','stack','name','send','index','map','MemberReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','length','includeAll','create','update','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2f2169,_0x2539fa){var _0x494f41=function(_0x4aa546){while(--_0x4aa546){_0x2f2169['push'](_0x2f2169['shift']());}};_0x494f41(++_0x2539fa);}(_0x80f5,0x1e5));var _0x580f=function(_0x3b3a82,_0x53b5e0){_0x3b3a82=_0x3b3a82-0x0;var _0x267063=_0x80f5[_0x3b3a82];return _0x267063;};'use strict';var pdf=require(_0x580f('0x0'));var emlformat=require(_0x580f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x580f('0x2'));var jsonpatch=require(_0x580f('0x3'));var rp=require(_0x580f('0x4'));var moment=require(_0x580f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x580f('0x6'));var util=require(_0x580f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x580f('0x8'));var ejs=require(_0x580f('0x9'));var fs=require('fs');var _=require(_0x580f('0xa'));var squel=require(_0x580f('0xb'));var crypto=require(_0x580f('0xc'));var jsforce=require(_0x580f('0xd'));var deskjs=require(_0x580f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x580f('0xf'));var Papa=require(_0x580f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x580f('0x11'));var hardwareService=require(_0x580f('0x12'));var logger=require(_0x580f('0x13'))(_0x580f('0x14'));var utils=require(_0x580f('0x15'));var config=require('../../config/environment');var db=require(_0x580f('0x16'))['db'];function respondWithStatusCode(_0x2998d3,_0x2e137c){_0x2e137c=_0x2e137c||0xcc;return function(_0x3c2e3a){if(_0x3c2e3a){return _0x2998d3[_0x580f('0x17')](_0x2e137c);}return _0x2998d3['status'](_0x2e137c)['end']();};}function respondWithResult(_0x4cffaf,_0x1fb507){_0x1fb507=_0x1fb507||0xc8;return function(_0x432227){if(_0x432227){return _0x4cffaf[_0x580f('0x18')](_0x1fb507)[_0x580f('0x19')](_0x432227);}};}function respondWithFilteredResult(_0x23a995,_0x39052c){return function(_0x4bb60c){if(_0x4bb60c){var _0xc09dcc=_0x4bb60c[_0x580f('0x1a')],_0x16e0b3=_0x39052c[_0x580f('0x1b')],_0x5d941a=_0x39052c[_0x580f('0x1b')]+_0x39052c[_0x580f('0x1c')],_0x329b83;if(_0x5d941a>=_0xc09dcc){_0x5d941a=_0xc09dcc;_0x329b83=0xc8;}else{_0x329b83=0xce;}_0x23a995[_0x580f('0x18')](_0x329b83);return _0x23a995[_0x580f('0x1d')](_0x580f('0x1e'),_0x16e0b3+'-'+_0x5d941a+'/'+_0xc09dcc)[_0x580f('0x19')](_0x4bb60c);}return null;};}function patchUpdates(_0x381643){return function(_0x1a2a79){try{jsonpatch['apply'](_0x1a2a79,_0x381643,!![]);}catch(_0x21d65a){return BPromise['reject'](_0x21d65a);}return _0x1a2a79[_0x580f('0x1f')]();};}function saveUpdates(_0x46ef43,_0x149ef0){return function(_0xbcc1ff){if(_0xbcc1ff){return _0xbcc1ff['update'](_0x46ef43)[_0x580f('0x20')](function(_0x30d114){return _0x30d114;});}return null;};}function removeEntity(_0x14aee4,_0x45bf68){return function(_0x2b6938){if(_0x2b6938){return _0x2b6938[_0x580f('0x21')]()['then'](function(){_0x14aee4[_0x580f('0x18')](0xcc)[_0x580f('0x22')]();});}};}function handleEntityNotFound(_0xc36fe2,_0x53af48){return function(_0x45d5e5){if(!_0x45d5e5){_0xc36fe2['sendStatus'](0x194);}return _0x45d5e5;};}function handleError(_0x3efd56,_0x29bdbb){_0x29bdbb=_0x29bdbb||0x1f4;return function(_0x23dacd){logger[_0x580f('0x23')](_0x23dacd[_0x580f('0x24')]);if(_0x23dacd[_0x580f('0x25')]){delete _0x23dacd[_0x580f('0x25')];}_0x3efd56[_0x580f('0x18')](_0x29bdbb)[_0x580f('0x26')](_0x23dacd);};}exports[_0x580f('0x27')]=function(_0x6b53da,_0x32aef3){var _0xf86be3={},_0x4f9cd7={},_0x371fa3={'count':0x0,'rows':[]};var _0x234e45=_[_0x580f('0x28')](db[_0x580f('0x29')][_0x580f('0x2a')],function(_0x4a3eb7){return{'name':_0x4a3eb7['fieldName'],'type':_0x4a3eb7[_0x580f('0x2b')]['key']};});_0x4f9cd7[_0x580f('0x2c')]=_[_0x580f('0x28')](_0x234e45,'name');_0x4f9cd7[_0x580f('0x2d')]=_[_0x580f('0x2e')](_0x6b53da[_0x580f('0x2d')]);_0x4f9cd7[_0x580f('0x2f')]=_[_0x580f('0x30')](_0x4f9cd7[_0x580f('0x2c')],_0x4f9cd7['query']);_0xf86be3[_0x580f('0x31')]=_[_0x580f('0x30')](_0x4f9cd7[_0x580f('0x2c')],qs[_0x580f('0x32')](_0x6b53da[_0x580f('0x2d')]['fields']));_0xf86be3[_0x580f('0x31')]=_0xf86be3[_0x580f('0x31')]['length']?_0xf86be3['attributes']:_0x4f9cd7[_0x580f('0x2c')];if(!_0x6b53da[_0x580f('0x2d')][_0x580f('0x33')]('nolimit')){_0xf86be3[_0x580f('0x1c')]=qs[_0x580f('0x1c')](_0x6b53da[_0x580f('0x2d')][_0x580f('0x1c')]);_0xf86be3[_0x580f('0x1b')]=qs[_0x580f('0x1b')](_0x6b53da['query']['offset']);}_0xf86be3[_0x580f('0x34')]=qs[_0x580f('0x35')](_0x6b53da[_0x580f('0x2d')][_0x580f('0x35')]);_0xf86be3[_0x580f('0x36')]=qs[_0x580f('0x2f')](_[_0x580f('0x37')](_0x6b53da[_0x580f('0x2d')],_0x4f9cd7[_0x580f('0x2f')]),_0x234e45);if(_0x6b53da[_0x580f('0x2d')][_0x580f('0x38')]){_0xf86be3[_0x580f('0x36')]=_[_0x580f('0x39')](_0xf86be3[_0x580f('0x36')],{'$or':_[_0x580f('0x28')](_0x234e45,function(_0x1dd6a8){if(_0x1dd6a8[_0x580f('0x2b')]!=='VIRTUAL'){var _0x3de897={};_0x3de897[_0x1dd6a8[_0x580f('0x25')]]={'$like':'%'+_0x6b53da[_0x580f('0x2d')][_0x580f('0x38')]+'%'};return _0x3de897;}})});}_0xf86be3=_[_0x580f('0x39')]({},_0xf86be3,_0x6b53da[_0x580f('0x3a')]);var _0x4728da={'where':_0xf86be3[_0x580f('0x36')]};return db[_0x580f('0x29')][_0x580f('0x1a')](_0x4728da)[_0x580f('0x20')](function(_0x273052){_0x371fa3[_0x580f('0x1a')]=_0x273052;if(_0x6b53da[_0x580f('0x2d')]['includeAll']){_0xf86be3[_0x580f('0x3b')]=[{'all':!![]}];}return db[_0x580f('0x29')][_0x580f('0x3c')](_0xf86be3);})['then'](function(_0x49def5){_0x371fa3[_0x580f('0x3d')]=_0x49def5;return _0x371fa3;})['then'](respondWithFilteredResult(_0x32aef3,_0xf86be3))[_0x580f('0x3e')](handleError(_0x32aef3,null));};exports[_0x580f('0x3f')]=function(_0x596107,_0x584437){var _0x1107ec={'raw':!![],'where':{'id':_0x596107[_0x580f('0x40')]['id']}},_0x2769b7={};_0x2769b7[_0x580f('0x2c')]=_[_0x580f('0x2e')](db[_0x580f('0x29')]['rawAttributes']);_0x2769b7[_0x580f('0x2d')]=_[_0x580f('0x2e')](_0x596107[_0x580f('0x2d')]);_0x2769b7['filters']=_[_0x580f('0x30')](_0x2769b7[_0x580f('0x2c')],_0x2769b7['query']);_0x1107ec[_0x580f('0x31')]=_[_0x580f('0x30')](_0x2769b7['model'],qs[_0x580f('0x32')](_0x596107[_0x580f('0x2d')]['fields']));_0x1107ec[_0x580f('0x31')]=_0x1107ec[_0x580f('0x31')][_0x580f('0x41')]?_0x1107ec['attributes']:_0x2769b7[_0x580f('0x2c')];if(_0x596107[_0x580f('0x2d')][_0x580f('0x42')]){_0x1107ec[_0x580f('0x3b')]=[{'all':!![]}];}_0x1107ec=_['merge']({},_0x1107ec,_0x596107['options']);return db['MemberReport']['find'](_0x1107ec)[_0x580f('0x20')](handleEntityNotFound(_0x584437,null))[_0x580f('0x20')](respondWithResult(_0x584437,null))[_0x580f('0x3e')](handleError(_0x584437,null));};exports[_0x580f('0x43')]=function(_0x51ab9f,_0x2c24cf){return db['MemberReport'][_0x580f('0x43')](_0x51ab9f['body'],{})[_0x580f('0x20')](respondWithResult(_0x2c24cf,0xc9))['catch'](handleError(_0x2c24cf,null));};exports[_0x580f('0x44')]=function(_0x225572,_0x1ab8fc){if(_0x225572['body']['id']){delete _0x225572[_0x580f('0x45')]['id'];}return db[_0x580f('0x29')][_0x580f('0x46')]({'where':{'id':_0x225572[_0x580f('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ab8fc,null))['then'](saveUpdates(_0x225572[_0x580f('0x45')],null))[_0x580f('0x20')](respondWithResult(_0x1ab8fc,null))[_0x580f('0x3e')](handleError(_0x1ab8fc,null));};exports[_0x580f('0x21')]=function(_0x54e5ca,_0x12fb14){return db['MemberReport'][_0x580f('0x46')]({'where':{'id':_0x54e5ca[_0x580f('0x40')]['id']}})[_0x580f('0x20')](handleEntityNotFound(_0x12fb14,null))[_0x580f('0x20')](removeEntity(_0x12fb14,null))['catch'](handleError(_0x12fb14,null));};exports[_0x580f('0x47')]=function(_0xa4200a,_0x219466){return db[_0x580f('0x29')][_0x580f('0x47')]()[_0x580f('0x20')](respondWithResult(_0x219466,null))[_0x580f('0x3e')](handleError(_0x219466,null));}; \ No newline at end of file +var _0xdfdc=['destroy','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','MemberReport','includeAll','rows','catch','show','params','include','options','find','create','body'];(function(_0xeac684,_0x38acc4){var _0xb48b7c=function(_0x5b8c4f){while(--_0x5b8c4f){_0xeac684['push'](_0xeac684['shift']());}};_0xb48b7c(++_0x38acc4);}(_0xdfdc,0x10a));var _0xcdfd=function(_0x4f9b13,_0x384bae){_0x4f9b13=_0x4f9b13-0x0;var _0x5244fa=_0xdfdc[_0x4f9b13];return _0x5244fa;};'use strict';var pdf=require(_0xcdfd('0x0'));var emlformat=require(_0xcdfd('0x1'));var rimraf=require(_0xcdfd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcdfd('0x3'));var moment=require(_0xcdfd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcdfd('0x5'));var util=require(_0xcdfd('0x6'));var path=require('path');var sox=require(_0xcdfd('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(_0xcdfd('0x8'));var toCsv=require(_0xcdfd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdfd('0xa'));var authService=require(_0xcdfd('0xb'));var qs=require(_0xcdfd('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdfd('0xd'));var logger=require(_0xcdfd('0xe'))('api');var utils=require(_0xcdfd('0xf'));var config=require('../../config/environment');var db=require(_0xcdfd('0x10'))['db'];function respondWithStatusCode(_0x14bb10,_0x38dff1){_0x38dff1=_0x38dff1||0xcc;return function(_0x15ef1b){if(_0x15ef1b){return _0x14bb10[_0xcdfd('0x11')](_0x38dff1);}return _0x14bb10[_0xcdfd('0x12')](_0x38dff1)[_0xcdfd('0x13')]();};}function respondWithResult(_0x25ad3d,_0x22bcfb){_0x22bcfb=_0x22bcfb||0xc8;return function(_0x362a61){if(_0x362a61){return _0x25ad3d[_0xcdfd('0x12')](_0x22bcfb)[_0xcdfd('0x14')](_0x362a61);}};}function respondWithFilteredResult(_0x121e83,_0x4e0bb9){return function(_0x1722aa){if(_0x1722aa){var _0x28154=_0x1722aa[_0xcdfd('0x15')],_0x245789=_0x4e0bb9[_0xcdfd('0x16')],_0x3d936=_0x4e0bb9['offset']+_0x4e0bb9['limit'],_0x1f6a95;if(_0x3d936>=_0x28154){_0x3d936=_0x28154;_0x1f6a95=0xc8;}else{_0x1f6a95=0xce;}_0x121e83['status'](_0x1f6a95);return _0x121e83[_0xcdfd('0x17')](_0xcdfd('0x18'),_0x245789+'-'+_0x3d936+'/'+_0x28154)[_0xcdfd('0x14')](_0x1722aa);}return null;};}function patchUpdates(_0x30f35d){return function(_0x35ccb9){try{jsonpatch[_0xcdfd('0x19')](_0x35ccb9,_0x30f35d,!![]);}catch(_0x4b5a57){return BPromise[_0xcdfd('0x1a')](_0x4b5a57);}return _0x35ccb9[_0xcdfd('0x1b')]();};}function saveUpdates(_0x54ec0a,_0x27183d){return function(_0x31a5e4){if(_0x31a5e4){return _0x31a5e4[_0xcdfd('0x1c')](_0x54ec0a)[_0xcdfd('0x1d')](function(_0x5d1c7f){return _0x5d1c7f;});}return null;};}function removeEntity(_0x19bdb8,_0x545869){return function(_0x1f01a0){if(_0x1f01a0){return _0x1f01a0['destroy']()['then'](function(){_0x19bdb8[_0xcdfd('0x12')](0xcc)[_0xcdfd('0x13')]();});}};}function handleEntityNotFound(_0x18b7db,_0x39a79f){return function(_0x1b3d5d){if(!_0x1b3d5d){_0x18b7db[_0xcdfd('0x11')](0x194);}return _0x1b3d5d;};}function handleError(_0x50bc65,_0x141bf0){_0x141bf0=_0x141bf0||0x1f4;return function(_0x510abf){logger['error'](_0x510abf[_0xcdfd('0x1e')]);if(_0x510abf['name']){delete _0x510abf[_0xcdfd('0x1f')];}_0x50bc65['status'](_0x141bf0)[_0xcdfd('0x20')](_0x510abf);};}exports[_0xcdfd('0x21')]=function(_0x377df4,_0x13e815){var _0x3a6400={},_0x1719ed={},_0x5b66e3={'count':0x0,'rows':[]};var _0x2b3018=_[_0xcdfd('0x22')](db['MemberReport'][_0xcdfd('0x23')],function(_0x4582a1){return{'name':_0x4582a1[_0xcdfd('0x24')],'type':_0x4582a1[_0xcdfd('0x25')]['key']};});_0x1719ed['model']=_['map'](_0x2b3018,_0xcdfd('0x1f'));_0x1719ed['query']=_[_0xcdfd('0x26')](_0x377df4[_0xcdfd('0x27')]);_0x1719ed[_0xcdfd('0x28')]=_['intersection'](_0x1719ed[_0xcdfd('0x29')],_0x1719ed[_0xcdfd('0x27')]);_0x3a6400[_0xcdfd('0x2a')]=_[_0xcdfd('0x2b')](_0x1719ed[_0xcdfd('0x29')],qs[_0xcdfd('0x2c')](_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x2c')]));_0x3a6400[_0xcdfd('0x2a')]=_0x3a6400[_0xcdfd('0x2a')][_0xcdfd('0x2d')]?_0x3a6400[_0xcdfd('0x2a')]:_0x1719ed['model'];if(!_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x2e')]('nolimit')){_0x3a6400[_0xcdfd('0x2f')]=qs[_0xcdfd('0x2f')](_0x377df4['query'][_0xcdfd('0x2f')]);_0x3a6400['offset']=qs[_0xcdfd('0x16')](_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x16')]);}_0x3a6400[_0xcdfd('0x30')]=qs[_0xcdfd('0x31')](_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x31')]);_0x3a6400[_0xcdfd('0x32')]=qs['filters'](_[_0xcdfd('0x33')](_0x377df4['query'],_0x1719ed[_0xcdfd('0x28')]),_0x2b3018);if(_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x34')]){_0x3a6400[_0xcdfd('0x32')]=_['merge'](_0x3a6400['where'],{'$or':_[_0xcdfd('0x22')](_0x2b3018,function(_0x43c687){if(_0x43c687[_0xcdfd('0x25')]!=='VIRTUAL'){var _0x552793={};_0x552793[_0x43c687['name']]={'$like':'%'+_0x377df4['query'][_0xcdfd('0x34')]+'%'};return _0x552793;}})});}_0x3a6400=_['merge']({},_0x3a6400,_0x377df4['options']);var _0x3c0ae0={'where':_0x3a6400[_0xcdfd('0x32')]};return db[_0xcdfd('0x35')]['count'](_0x3c0ae0)[_0xcdfd('0x1d')](function(_0x53897a){_0x5b66e3[_0xcdfd('0x15')]=_0x53897a;if(_0x377df4[_0xcdfd('0x27')][_0xcdfd('0x36')]){_0x3a6400['include']=[{'all':!![]}];}return db['MemberReport']['findAll'](_0x3a6400);})[_0xcdfd('0x1d')](function(_0x49f6ce){_0x5b66e3[_0xcdfd('0x37')]=_0x49f6ce;return _0x5b66e3;})[_0xcdfd('0x1d')](respondWithFilteredResult(_0x13e815,_0x3a6400))[_0xcdfd('0x38')](handleError(_0x13e815,null));};exports[_0xcdfd('0x39')]=function(_0x341f6d,_0x58fc0e){var _0x22af21={'raw':!![],'where':{'id':_0x341f6d[_0xcdfd('0x3a')]['id']}},_0x5b8c50={};_0x5b8c50[_0xcdfd('0x29')]=_['keys'](db[_0xcdfd('0x35')][_0xcdfd('0x23')]);_0x5b8c50[_0xcdfd('0x27')]=_[_0xcdfd('0x26')](_0x341f6d['query']);_0x5b8c50[_0xcdfd('0x28')]=_[_0xcdfd('0x2b')](_0x5b8c50['model'],_0x5b8c50[_0xcdfd('0x27')]);_0x22af21[_0xcdfd('0x2a')]=_[_0xcdfd('0x2b')](_0x5b8c50[_0xcdfd('0x29')],qs[_0xcdfd('0x2c')](_0x341f6d[_0xcdfd('0x27')][_0xcdfd('0x2c')]));_0x22af21[_0xcdfd('0x2a')]=_0x22af21[_0xcdfd('0x2a')][_0xcdfd('0x2d')]?_0x22af21[_0xcdfd('0x2a')]:_0x5b8c50[_0xcdfd('0x29')];if(_0x341f6d[_0xcdfd('0x27')][_0xcdfd('0x36')]){_0x22af21[_0xcdfd('0x3b')]=[{'all':!![]}];}_0x22af21=_['merge']({},_0x22af21,_0x341f6d[_0xcdfd('0x3c')]);return db[_0xcdfd('0x35')][_0xcdfd('0x3d')](_0x22af21)[_0xcdfd('0x1d')](handleEntityNotFound(_0x58fc0e,null))[_0xcdfd('0x1d')](respondWithResult(_0x58fc0e,null))['catch'](handleError(_0x58fc0e,null));};exports[_0xcdfd('0x3e')]=function(_0x38a077,_0x5c3211){return db[_0xcdfd('0x35')][_0xcdfd('0x3e')](_0x38a077[_0xcdfd('0x3f')],{})[_0xcdfd('0x1d')](respondWithResult(_0x5c3211,0xc9))[_0xcdfd('0x38')](handleError(_0x5c3211,null));};exports[_0xcdfd('0x1c')]=function(_0x54e1b5,_0xdf67cf){if(_0x54e1b5[_0xcdfd('0x3f')]['id']){delete _0x54e1b5['body']['id'];}return db[_0xcdfd('0x35')][_0xcdfd('0x3d')]({'where':{'id':_0x54e1b5[_0xcdfd('0x3a')]['id']}})[_0xcdfd('0x1d')](handleEntityNotFound(_0xdf67cf,null))[_0xcdfd('0x1d')](saveUpdates(_0x54e1b5[_0xcdfd('0x3f')],null))['then'](respondWithResult(_0xdf67cf,null))[_0xcdfd('0x38')](handleError(_0xdf67cf,null));};exports[_0xcdfd('0x40')]=function(_0x54ce07,_0x1ec0f6){return db[_0xcdfd('0x35')][_0xcdfd('0x3d')]({'where':{'id':_0x54ce07[_0xcdfd('0x3a')]['id']}})[_0xcdfd('0x1d')](handleEntityNotFound(_0x1ec0f6,null))['then'](removeEntity(_0x1ec0f6,null))['catch'](handleError(_0x1ec0f6,null));};exports['describe']=function(_0x39c4e0,_0xb73585){return db['MemberReport'][_0xcdfd('0x41')]()[_0xcdfd('0x1d')](respondWithResult(_0xb73585,null))[_0xcdfd('0x38')](handleError(_0xb73585,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 626c298..1315417 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 _0xd6d6=['membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member'];(function(_0x23d1f9,_0x257def){var _0x1e85b1=function(_0x50432f){while(--_0x50432f){_0x23d1f9['push'](_0x23d1f9['shift']());}};_0x1e85b1(++_0x257def);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x38ea6b,_0x3883f4){_0x38ea6b=_0x38ea6b-0x0;var _0x370ca5=_0xd6d6[_0x38ea6b];return _0x370ca5;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[{'name':_0x6d6d('0xe'),'fields':[_0x6d6d('0xf'),_0x6d6d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x723e=['rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dbaf9,_0x1cf4d8){var _0x348d92=function(_0x47fdc7){while(--_0x47fdc7){_0x3dbaf9['push'](_0x3dbaf9['shift']());}};_0x348d92(++_0x1cf4d8);}(_0x723e,0x179));var _0xe723=function(_0x402983,_0x5b1129){_0x402983=_0x402983-0x0;var _0x2dfa7e=_0x723e[_0x402983];return _0x2dfa7e;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var logger=require(_0xe723('0x1'))(_0xe723('0x2'));var moment=require(_0xe723('0x3'));var BPromise=require(_0xe723('0x4'));var rp=require(_0xe723('0x5'));var fs=require('fs');var path=require(_0xe723('0x6'));var rimraf=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var attributes=require(_0xe723('0x9'));module['exports']=function(_0x32d689,_0x20c13b){return _0x32d689[_0xe723('0xa')](_0xe723('0xb'),attributes,{'tableName':_0xe723('0xc'),'paranoid':![],'indexes':[{'name':_0xe723('0xd'),'fields':[_0xe723('0xe'),_0xe723('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 35214b2..66c8a84 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 _0x4266=['code','MemberReport,\x20%s,\x20%s','message','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','stringify','CreateMemberReport','create','UpdateMemberReport','update','body','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x4266,0x118));var _0x6426=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x4266[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x6426('0x0'));var util=require('util');var moment=require(_0x6426('0x1'));var BPromise=require(_0x6426('0x2'));var rs=require(_0x6426('0x3'));var fs=require('fs');var Redis=require(_0x6426('0x4'));var db=require(_0x6426('0x5'))['db'];var utils=require(_0x6426('0x6'));var logger=require(_0x6426('0x7'))(_0x6426('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6426('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45a3db,_0x28ab09,_0x4435c6){return new BPromise(function(_0x4cd726,_0x2b9a3f){return client['request'](_0x45a3db,_0x4435c6)[_0x6426('0xa')](function(_0x4229a4){logger[_0x6426('0xb')]('MemberReport,\x20%s,\x20%s',_0x28ab09,'request\x20sent');logger[_0x6426('0xc')](_0x6426('0xd'),_0x28ab09,_0x6426('0xe'),JSON['stringify'](_0x4229a4));if(_0x4229a4[_0x6426('0xf')]){if(_0x4229a4[_0x6426('0xf')][_0x6426('0x10')]===0x1f4){logger['error'](_0x6426('0x11'),_0x28ab09,_0x4229a4['error'][_0x6426('0x12')]);return _0x2b9a3f(_0x4229a4['error']['message']);}logger['error'](_0x6426('0x11'),_0x28ab09,_0x4229a4['error']['message']);return _0x4cd726(_0x4229a4[_0x6426('0xf')]['message']);}else{logger[_0x6426('0xb')]('MemberReport,\x20%s,\x20%s',_0x28ab09,_0x6426('0xe'));_0x4cd726(_0x4229a4['result']['message']);}})[_0x6426('0x13')](function(_0x21c82c){logger[_0x6426('0xf')](_0x6426('0x11'),_0x28ab09,_0x21c82c);_0x2b9a3f(_0x21c82c);});});}exports[_0x6426('0x14')]=function(_0x3d9306){var _0x3f3151=this;return new Promise(function(_0x37d240,_0x57f36e){return db[_0x6426('0x15')][_0x6426('0x16')]({'raw':_0x3d9306[_0x6426('0x17')]?_0x3d9306[_0x6426('0x17')][_0x6426('0x18')]===undefined?!![]:![]:!![],'where':_0x3d9306[_0x6426('0x17')]?_0x3d9306[_0x6426('0x17')][_0x6426('0x19')]||null:null,'attributes':_0x3d9306[_0x6426('0x17')]?_0x3d9306[_0x6426('0x17')][_0x6426('0x1a')]||null:null,'limit':_0x3d9306[_0x6426('0x17')]?_0x3d9306[_0x6426('0x17')][_0x6426('0x1b')]||null:null,'include':_0x3d9306[_0x6426('0x17')]?_0x3d9306['options'][_0x6426('0x1c')]?_[_0x6426('0x1d')](_0x3d9306[_0x6426('0x17')][_0x6426('0x1c')],function(_0x99d95b){return{'model':db[_0x99d95b[_0x6426('0x1e')]],'as':_0x99d95b['as'],'attributes':_0x99d95b[_0x6426('0x1a')],'include':_0x99d95b['include']?_['map'](_0x99d95b['include'],function(_0x191339){return{'model':db[_0x191339['model']],'as':_0x191339['as'],'attributes':_0x191339['attributes'],'include':_0x191339[_0x6426('0x1c')]?_['map'](_0x191339['include'],function(_0x1860e4){return{'model':db[_0x1860e4[_0x6426('0x1e')]],'as':_0x1860e4['as'],'attributes':_0x1860e4[_0x6426('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6426('0xa')](function(_0x3ebaba){logger['info'](_0x6426('0x14'),_0x3d9306);logger[_0x6426('0xc')](_0x6426('0x14'),_0x3d9306,JSON[_0x6426('0x1f')](_0x3ebaba));_0x37d240(_0x3ebaba);})[_0x6426('0x13')](function(_0x1cc44a){logger[_0x6426('0xf')](_0x6426('0x14'),_0x1cc44a[_0x6426('0x12')],_0x3d9306);_0x57f36e(_0x3f3151[_0x6426('0xf')](0x1f4,_0x1cc44a[_0x6426('0x12')]));});});};exports[_0x6426('0x20')]=function(_0x354b77){var _0x1b5e89=this;return new Promise(function(_0x3813af,_0x518f72){return db[_0x6426('0x15')][_0x6426('0x21')](_0x354b77['body'],{'raw':_0x354b77[_0x6426('0x17')]?_0x354b77['options']['raw']===undefined?!![]:![]:!![]})[_0x6426('0xa')](function(_0x4d094d){logger[_0x6426('0xb')](_0x6426('0x20'),_0x354b77);logger['debug']('CreateMemberReport',_0x354b77,JSON['stringify'](_0x4d094d));_0x3813af(_0x4d094d);})[_0x6426('0x13')](function(_0x5f3ab4){logger[_0x6426('0xf')]('CreateMemberReport',_0x5f3ab4[_0x6426('0x12')],_0x354b77);_0x518f72(_0x1b5e89[_0x6426('0xf')](0x1f4,_0x5f3ab4[_0x6426('0x12')]));});});};exports[_0x6426('0x22')]=function(_0x1035de){var _0x4e0d44=this;return new Promise(function(_0x355228,_0x499077){return db[_0x6426('0x15')][_0x6426('0x23')](_0x1035de[_0x6426('0x24')],{'raw':_0x1035de[_0x6426('0x17')]?_0x1035de[_0x6426('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1035de[_0x6426('0x17')]?_0x1035de['options'][_0x6426('0x19')]||null:null,'attributes':_0x1035de[_0x6426('0x17')]?_0x1035de['options']['attributes']||null:null,'limit':_0x1035de['options']?_0x1035de['options']['limit']||null:null})['then'](function(_0x638463){logger[_0x6426('0xb')](_0x6426('0x22'),_0x1035de);logger[_0x6426('0xc')](_0x6426('0x22'),_0x1035de,JSON[_0x6426('0x1f')](_0x638463));_0x355228(_0x638463);})[_0x6426('0x13')](function(_0x1e149e){logger[_0x6426('0xf')]('UpdateMemberReport',_0x1e149e[_0x6426('0x12')],_0x1035de);_0x499077(_0x4e0d44['error'](0x1f4,_0x1e149e[_0x6426('0x12')]));});});}; \ No newline at end of file +var _0xe47f=['model','CreateMemberReport','create','raw','UpdateMemberReport','update','body','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMemberReport','MemberReport','options','where','attributes','map','include'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xe47f,0xc6));var _0xfe47=function(_0xe446b9,_0x4b27df){_0xe446b9=_0xe446b9-0x0;var _0xb77c67=_0xe47f[_0xe446b9];return _0xb77c67;};'use strict';var _=require('lodash');var util=require(_0xfe47('0x0'));var moment=require(_0xfe47('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe47('0x2'));var fs=require('fs');var Redis=require(_0xfe47('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe47('0x4'));var logger=require(_0xfe47('0x5'))(_0xfe47('0x6'));var config=require(_0xfe47('0x7'));var jayson=require(_0xfe47('0x8'));var client=jayson[_0xfe47('0x9')][_0xfe47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x241c04,_0x5a7e5b,_0x7aed54){return new BPromise(function(_0x2de527,_0x5cd31a){return client[_0xfe47('0xb')](_0x241c04,_0x7aed54)[_0xfe47('0xc')](function(_0x2a38df){logger['info'](_0xfe47('0xd'),_0x5a7e5b,_0xfe47('0xe'));logger[_0xfe47('0xf')](_0xfe47('0x10'),_0x5a7e5b,_0xfe47('0xe'),JSON[_0xfe47('0x11')](_0x2a38df));if(_0x2a38df[_0xfe47('0x12')]){if(_0x2a38df[_0xfe47('0x12')][_0xfe47('0x13')]===0x1f4){logger[_0xfe47('0x12')](_0xfe47('0xd'),_0x5a7e5b,_0x2a38df['error'][_0xfe47('0x14')]);return _0x5cd31a(_0x2a38df[_0xfe47('0x12')][_0xfe47('0x14')]);}logger[_0xfe47('0x12')](_0xfe47('0xd'),_0x5a7e5b,_0x2a38df[_0xfe47('0x12')][_0xfe47('0x14')]);return _0x2de527(_0x2a38df[_0xfe47('0x12')][_0xfe47('0x14')]);}else{logger[_0xfe47('0x15')](_0xfe47('0xd'),_0x5a7e5b,'request\x20sent');_0x2de527(_0x2a38df['result'][_0xfe47('0x14')]);}})[_0xfe47('0x16')](function(_0x4e09b8){logger[_0xfe47('0x12')](_0xfe47('0xd'),_0x5a7e5b,_0x4e09b8);_0x5cd31a(_0x4e09b8);});});}exports[_0xfe47('0x17')]=function(_0x4ac8a6){var _0x4e2230=this;return new Promise(function(_0x464927,_0x33a980){return db[_0xfe47('0x18')]['findAll']({'raw':_0x4ac8a6[_0xfe47('0x19')]?_0x4ac8a6[_0xfe47('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4ac8a6[_0xfe47('0x19')]?_0x4ac8a6[_0xfe47('0x19')][_0xfe47('0x1a')]||null:null,'attributes':_0x4ac8a6[_0xfe47('0x19')]?_0x4ac8a6[_0xfe47('0x19')][_0xfe47('0x1b')]||null:null,'limit':_0x4ac8a6[_0xfe47('0x19')]?_0x4ac8a6[_0xfe47('0x19')]['limit']||null:null,'include':_0x4ac8a6[_0xfe47('0x19')]?_0x4ac8a6[_0xfe47('0x19')]['include']?_[_0xfe47('0x1c')](_0x4ac8a6[_0xfe47('0x19')][_0xfe47('0x1d')],function(_0x117b76){return{'model':db[_0x117b76[_0xfe47('0x1e')]],'as':_0x117b76['as'],'attributes':_0x117b76['attributes'],'include':_0x117b76[_0xfe47('0x1d')]?_[_0xfe47('0x1c')](_0x117b76[_0xfe47('0x1d')],function(_0x404a51){return{'model':db[_0x404a51[_0xfe47('0x1e')]],'as':_0x404a51['as'],'attributes':_0x404a51[_0xfe47('0x1b')],'include':_0x404a51[_0xfe47('0x1d')]?_['map'](_0x404a51[_0xfe47('0x1d')],function(_0x328863){return{'model':db[_0x328863[_0xfe47('0x1e')]],'as':_0x328863['as'],'attributes':_0x328863['attributes']};}):[]};}):[]};}):[]:[]})[_0xfe47('0xc')](function(_0x575749){logger[_0xfe47('0x15')](_0xfe47('0x17'),_0x4ac8a6);logger[_0xfe47('0xf')](_0xfe47('0x17'),_0x4ac8a6,JSON[_0xfe47('0x11')](_0x575749));_0x464927(_0x575749);})[_0xfe47('0x16')](function(_0x177816){logger[_0xfe47('0x12')]('GetMemberReport',_0x177816[_0xfe47('0x14')],_0x4ac8a6);_0x33a980(_0x4e2230[_0xfe47('0x12')](0x1f4,_0x177816[_0xfe47('0x14')]));});});};exports[_0xfe47('0x1f')]=function(_0x28fb96){var _0x506fae=this;return new Promise(function(_0x3a5502,_0x4bff90){return db[_0xfe47('0x18')][_0xfe47('0x20')](_0x28fb96['body'],{'raw':_0x28fb96[_0xfe47('0x19')]?_0x28fb96[_0xfe47('0x19')][_0xfe47('0x21')]===undefined?!![]:![]:!![]})[_0xfe47('0xc')](function(_0x4fb02c){logger[_0xfe47('0x15')](_0xfe47('0x1f'),_0x28fb96);logger[_0xfe47('0xf')](_0xfe47('0x1f'),_0x28fb96,JSON[_0xfe47('0x11')](_0x4fb02c));_0x3a5502(_0x4fb02c);})[_0xfe47('0x16')](function(_0x421923){logger['error'](_0xfe47('0x1f'),_0x421923[_0xfe47('0x14')],_0x28fb96);_0x4bff90(_0x506fae[_0xfe47('0x12')](0x1f4,_0x421923[_0xfe47('0x14')]));});});};exports[_0xfe47('0x22')]=function(_0x1c1f4c){var _0x3b8527=this;return new Promise(function(_0x450041,_0x513797){return db[_0xfe47('0x18')][_0xfe47('0x23')](_0x1c1f4c[_0xfe47('0x24')],{'raw':_0x1c1f4c['options']?_0x1c1f4c[_0xfe47('0x19')][_0xfe47('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c1f4c[_0xfe47('0x19')]?_0x1c1f4c['options'][_0xfe47('0x1a')]||null:null,'attributes':_0x1c1f4c[_0xfe47('0x19')]?_0x1c1f4c[_0xfe47('0x19')][_0xfe47('0x1b')]||null:null,'limit':_0x1c1f4c[_0xfe47('0x19')]?_0x1c1f4c['options'][_0xfe47('0x25')]||null:null})[_0xfe47('0xc')](function(_0x6049db){logger[_0xfe47('0x15')](_0xfe47('0x22'),_0x1c1f4c);logger[_0xfe47('0xf')]('UpdateMemberReport',_0x1c1f4c,JSON[_0xfe47('0x11')](_0x6049db));_0x450041(_0x6049db);})['catch'](function(_0x173991){logger[_0xfe47('0x12')](_0xfe47('0x22'),_0x173991[_0xfe47('0x14')],_0x1c1f4c);_0x513797(_0x3b8527[_0xfe47('0x12')](0x1f4,_0x173991[_0xfe47('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 67b0926..fe37eb5 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 _0x065e=['./migration.controller','get','exports','multer','express','Router','../../components/auth/service'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x065e,0x1a7));var _0xe065=function(_0xd9d9fe,_0x3c55d5){_0xd9d9fe=_0xd9d9fe-0x0;var _0x32b000=_0x065e[_0xd9d9fe];return _0x32b000;};'use strict';var multer=require(_0xe065('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe065('0x1'));var router=express[_0xe065('0x2')]();var auth=require(_0xe065('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe065('0x4'));router[_0xe065('0x5')]('/',controller['index']);module[_0xe065('0x6')]=router; \ No newline at end of file +var _0xed3c=['index','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x587e76,_0x16aaec){var _0x54e213=function(_0x52d8fd){while(--_0x52d8fd){_0x587e76['push'](_0x587e76['shift']());}};_0x54e213(++_0x16aaec);}(_0xed3c,0x1a6));var _0xced3=function(_0x237418,_0x56e144){_0x237418=_0x237418-0x0;var _0x22393e=_0xed3c[_0x237418];return _0x22393e;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var auth=require(_0xced3('0x5'));var interaction=require(_0xced3('0x6'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xced3('0x7')]('/',controller[_0xced3('0x8')]);module[_0xced3('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 57d19e7..2485e0d 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 _0xcf25=['exports'];(function(_0x53e22d,_0x3c9f57){var _0x20435a=function(_0x4ba015){while(--_0x4ba015){_0x53e22d['push'](_0x53e22d['shift']());}};_0x20435a(++_0x3c9f57);}(_0xcf25,0x110));var _0x5cf2=function(_0x25c290,_0x5441ca){_0x25c290=_0x25c290-0x0;var _0x41a4d6=_0xcf25[_0x25c290];return _0x41a4d6;};'use strict';var Sequelize=require('sequelize');module[_0x5cf2('0x0')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0x97d9=['sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x97d9,0xda));var _0x997d=function(_0x1fe56d,_0x436977){_0x1fe56d=_0x1fe56d-0x0;var _0x49ba47=_0x97d9[_0x1fe56d];return _0x49ba47;};'use strict';var Sequelize=require(_0x997d('0x0'));module[_0x997d('0x1')]={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 4303ad3..be3e402 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 _0xedd9=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','Migration','includeAll','catch'];(function(_0x4505cb,_0x135d7d){var _0x188f78=function(_0x4837c6){while(--_0x4837c6){_0x4505cb['push'](_0x4505cb['shift']());}};_0x188f78(++_0x135d7d);}(_0xedd9,0xfc));var _0x9edd=function(_0x28ebcb,_0x207b3d){_0x28ebcb=_0x28ebcb-0x0;var _0xf64f2e=_0xedd9[_0x28ebcb];return _0xf64f2e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];function respondWithStatusCode(_0x25e64c,_0xfd544a){_0xfd544a=_0xfd544a||0xcc;return function(_0x287ddd){if(_0x287ddd){return _0x25e64c[_0x9edd('0x17')](_0xfd544a);}return _0x25e64c[_0x9edd('0x18')](_0xfd544a)[_0x9edd('0x19')]();};}function respondWithResult(_0x47eb64,_0x176bfa){_0x176bfa=_0x176bfa||0xc8;return function(_0x44fc7c){if(_0x44fc7c){return _0x47eb64[_0x9edd('0x18')](_0x176bfa)[_0x9edd('0x1a')](_0x44fc7c);}};}function respondWithFilteredResult(_0x13b6b6,_0x338f3c){return function(_0x1042aa){if(_0x1042aa){var _0x75a4ab=_0x1042aa[_0x9edd('0x1b')],_0x4ea60f=_0x338f3c['offset'],_0x5f5bf4=_0x338f3c[_0x9edd('0x1c')]+_0x338f3c[_0x9edd('0x1d')],_0x448996;if(_0x5f5bf4>=_0x75a4ab){_0x5f5bf4=_0x75a4ab;_0x448996=0xc8;}else{_0x448996=0xce;}_0x13b6b6[_0x9edd('0x18')](_0x448996);return _0x13b6b6['set'](_0x9edd('0x1e'),_0x4ea60f+'-'+_0x5f5bf4+'/'+_0x75a4ab)['json'](_0x1042aa);}return null;};}function patchUpdates(_0x2cdcef){return function(_0x1083e4){try{jsonpatch['apply'](_0x1083e4,_0x2cdcef,!![]);}catch(_0x498977){return BPromise[_0x9edd('0x1f')](_0x498977);}return _0x1083e4['save']();};}function saveUpdates(_0x27a95a,_0x54a03f){return function(_0x535f37){if(_0x535f37){return _0x535f37[_0x9edd('0x20')](_0x27a95a)[_0x9edd('0x21')](function(_0x4fb7bf){return _0x4fb7bf;});}return null;};}function removeEntity(_0x5823bc,_0x341d67){return function(_0x186186){if(_0x186186){return _0x186186[_0x9edd('0x22')]()['then'](function(){_0x5823bc[_0x9edd('0x18')](0xcc)[_0x9edd('0x19')]();});}};}function handleEntityNotFound(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(!_0x339a0d){_0x44a6c1['sendStatus'](0x194);}return _0x339a0d;};}function handleError(_0x46c383,_0xeaf55a){_0xeaf55a=_0xeaf55a||0x1f4;return function(_0x3a1ea5){logger[_0x9edd('0x23')](_0x3a1ea5[_0x9edd('0x24')]);if(_0x3a1ea5['name']){delete _0x3a1ea5['name'];}_0x46c383[_0x9edd('0x18')](_0xeaf55a)[_0x9edd('0x25')](_0x3a1ea5);};}exports[_0x9edd('0x26')]=function(_0x25e135,_0x3c2227){var _0x4fe471={},_0x57a2cc={},_0x214d0a={'count':0x0,'rows':[]};var _0x257a26=_[_0x9edd('0x27')](db['Migration'][_0x9edd('0x28')],function(_0x28cfae){return{'name':_0x28cfae[_0x9edd('0x29')],'type':_0x28cfae[_0x9edd('0x2a')]['key']};});_0x57a2cc[_0x9edd('0x2b')]=_[_0x9edd('0x27')](_0x257a26,_0x9edd('0x2c'));_0x57a2cc[_0x9edd('0x2d')]=_[_0x9edd('0x2e')](_0x25e135[_0x9edd('0x2d')]);_0x57a2cc[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x57a2cc[_0x9edd('0x2b')],_0x57a2cc[_0x9edd('0x2d')]);_0x4fe471[_0x9edd('0x31')]=_[_0x9edd('0x30')](_0x57a2cc[_0x9edd('0x2b')],qs[_0x9edd('0x32')](_0x25e135[_0x9edd('0x2d')]['fields']));_0x4fe471[_0x9edd('0x31')]=_0x4fe471[_0x9edd('0x31')][_0x9edd('0x33')]?_0x4fe471['attributes']:_0x57a2cc[_0x9edd('0x2b')];if(!_0x25e135[_0x9edd('0x2d')][_0x9edd('0x34')](_0x9edd('0x35'))){_0x4fe471[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x25e135[_0x9edd('0x2d')][_0x9edd('0x1d')]);_0x4fe471[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x25e135[_0x9edd('0x2d')][_0x9edd('0x1c')]);}_0x4fe471[_0x9edd('0x36')]=qs[_0x9edd('0x37')](_0x25e135['query'][_0x9edd('0x37')]);_0x4fe471['where']=qs[_0x9edd('0x2f')](_[_0x9edd('0x38')](_0x25e135[_0x9edd('0x2d')],_0x57a2cc[_0x9edd('0x2f')]),_0x257a26);if(_0x25e135[_0x9edd('0x2d')]['filter']){_0x4fe471[_0x9edd('0x39')]=_[_0x9edd('0x3a')](_0x4fe471[_0x9edd('0x39')],{'$or':_[_0x9edd('0x27')](_0x257a26,function(_0x1be77f){if(_0x1be77f[_0x9edd('0x2a')]!==_0x9edd('0x3b')){var _0x1cbbac={};_0x1cbbac[_0x1be77f[_0x9edd('0x2c')]]={'$like':'%'+_0x25e135[_0x9edd('0x2d')]['filter']+'%'};return _0x1cbbac;}})});}_0x4fe471=_[_0x9edd('0x3a')]({},_0x4fe471,_0x25e135['options']);var _0x3ef1d5={'where':_0x4fe471['where']};return db[_0x9edd('0x3c')][_0x9edd('0x1b')](_0x3ef1d5)[_0x9edd('0x21')](function(_0x479661){_0x214d0a[_0x9edd('0x1b')]=_0x479661;if(_0x25e135[_0x9edd('0x2d')][_0x9edd('0x3d')]){_0x4fe471['include']=[{'all':!![]}];}return db[_0x9edd('0x3c')]['findAll'](_0x4fe471);})[_0x9edd('0x21')](function(_0xfbc492){_0x214d0a['rows']=_0xfbc492;return _0x214d0a;})[_0x9edd('0x21')](respondWithFilteredResult(_0x3c2227,_0x4fe471))[_0x9edd('0x3e')](handleError(_0x3c2227,null));}; \ No newline at end of file +var _0xf4eb=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','html-pdf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','apply','save','update','then','destroy','sendStatus','error','stack','name','Migration','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes'];(function(_0x3a1b6e,_0x24a409){var _0x3ea1b6=function(_0x308d52){while(--_0x308d52){_0x3a1b6e['push'](_0x3a1b6e['shift']());}};_0x3ea1b6(++_0x24a409);}(_0xf4eb,0xec));var _0xbf4e=function(_0x52c424,_0x1bbfd3){_0x52c424=_0x52c424-0x0;var _0x31d568=_0xf4eb[_0x52c424];return _0x31d568;};'use strict';var pdf=require(_0xbf4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf4e('0x2'));var util=require(_0xbf4e('0x3'));var path=require(_0xbf4e('0x4'));var sox=require(_0xbf4e('0x5'));var csv=require(_0xbf4e('0x6'));var ejs=require(_0xbf4e('0x7'));var fs=require('fs');var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x6'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var db=require(_0xbf4e('0x12'))['db'];function respondWithStatusCode(_0x54a96e,_0x17fd01){_0x17fd01=_0x17fd01||0xcc;return function(_0x5a3035){if(_0x5a3035){return _0x54a96e['sendStatus'](_0x17fd01);}return _0x54a96e[_0xbf4e('0x13')](_0x17fd01)[_0xbf4e('0x14')]();};}function respondWithResult(_0x1e029b,_0x302841){_0x302841=_0x302841||0xc8;return function(_0x3b74bd){if(_0x3b74bd){return _0x1e029b[_0xbf4e('0x13')](_0x302841)['json'](_0x3b74bd);}};}function respondWithFilteredResult(_0x59fb15,_0x180432){return function(_0x1735ae){if(_0x1735ae){var _0x28fc6b=_0x1735ae[_0xbf4e('0x15')],_0x542909=_0x180432[_0xbf4e('0x16')],_0x14110b=_0x180432['offset']+_0x180432[_0xbf4e('0x17')],_0x2c292c;if(_0x14110b>=_0x28fc6b){_0x14110b=_0x28fc6b;_0x2c292c=0xc8;}else{_0x2c292c=0xce;}_0x59fb15['status'](_0x2c292c);return _0x59fb15['set']('Content-Range',_0x542909+'-'+_0x14110b+'/'+_0x28fc6b)['json'](_0x1735ae);}return null;};}function patchUpdates(_0x35992b){return function(_0x1ca73c){try{jsonpatch[_0xbf4e('0x18')](_0x1ca73c,_0x35992b,!![]);}catch(_0x4d9c2a){return BPromise['reject'](_0x4d9c2a);}return _0x1ca73c[_0xbf4e('0x19')]();};}function saveUpdates(_0x9a46ee,_0x3be138){return function(_0x3a875b){if(_0x3a875b){return _0x3a875b[_0xbf4e('0x1a')](_0x9a46ee)[_0xbf4e('0x1b')](function(_0x415963){return _0x415963;});}return null;};}function removeEntity(_0x3d642a,_0xd09e12){return function(_0x376832){if(_0x376832){return _0x376832[_0xbf4e('0x1c')]()['then'](function(){_0x3d642a[_0xbf4e('0x13')](0xcc)[_0xbf4e('0x14')]();});}};}function handleEntityNotFound(_0x51648c,_0x31e3f5){return function(_0x30994d){if(!_0x30994d){_0x51648c[_0xbf4e('0x1d')](0x194);}return _0x30994d;};}function handleError(_0x1bda8b,_0x3a5d72){_0x3a5d72=_0x3a5d72||0x1f4;return function(_0x4a0243){logger[_0xbf4e('0x1e')](_0x4a0243[_0xbf4e('0x1f')]);if(_0x4a0243[_0xbf4e('0x20')]){delete _0x4a0243['name'];}_0x1bda8b[_0xbf4e('0x13')](_0x3a5d72)['send'](_0x4a0243);};}exports['index']=function(_0x2bfccf,_0x5a0a9b){var _0x38c923={},_0x315df3={},_0x4021a9={'count':0x0,'rows':[]};var _0x41f918=_['map'](db[_0xbf4e('0x21')][_0xbf4e('0x22')],function(_0x43879d){return{'name':_0x43879d['fieldName'],'type':_0x43879d[_0xbf4e('0x23')]['key']};});_0x315df3[_0xbf4e('0x24')]=_[_0xbf4e('0x25')](_0x41f918,_0xbf4e('0x20'));_0x315df3['query']=_[_0xbf4e('0x26')](_0x2bfccf[_0xbf4e('0x27')]);_0x315df3[_0xbf4e('0x28')]=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],_0x315df3[_0xbf4e('0x27')]);_0x38c923['attributes']=_[_0xbf4e('0x29')](_0x315df3[_0xbf4e('0x24')],qs['fields'](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2a')]));_0x38c923['attributes']=_0x38c923[_0xbf4e('0x2b')]['length']?_0x38c923[_0xbf4e('0x2b')]:_0x315df3['model'];if(!_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2c')](_0xbf4e('0x2d'))){_0x38c923['limit']=qs[_0xbf4e('0x17')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x17')]);_0x38c923[_0xbf4e('0x16')]=qs[_0xbf4e('0x16')](_0x2bfccf[_0xbf4e('0x27')]['offset']);}_0x38c923[_0xbf4e('0x2e')]=qs[_0xbf4e('0x2f')](_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x2f')]);_0x38c923[_0xbf4e('0x30')]=qs['filters'](_['pick'](_0x2bfccf['query'],_0x315df3['filters']),_0x41f918);if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]){_0x38c923[_0xbf4e('0x30')]=_[_0xbf4e('0x32')](_0x38c923[_0xbf4e('0x30')],{'$or':_[_0xbf4e('0x25')](_0x41f918,function(_0x355b42){if(_0x355b42[_0xbf4e('0x23')]!==_0xbf4e('0x33')){var _0x54527d={};_0x54527d[_0x355b42['name']]={'$like':'%'+_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x31')]+'%'};return _0x54527d;}})});}_0x38c923=_[_0xbf4e('0x32')]({},_0x38c923,_0x2bfccf['options']);var _0x3f46f1={'where':_0x38c923['where']};return db[_0xbf4e('0x21')][_0xbf4e('0x15')](_0x3f46f1)[_0xbf4e('0x1b')](function(_0xb30f90){_0x4021a9['count']=_0xb30f90;if(_0x2bfccf[_0xbf4e('0x27')][_0xbf4e('0x34')]){_0x38c923[_0xbf4e('0x35')]=[{'all':!![]}];}return db[_0xbf4e('0x21')]['findAll'](_0x38c923);})[_0xbf4e('0x1b')](function(_0x44e96b){_0x4021a9[_0xbf4e('0x36')]=_0x44e96b;return _0x4021a9;})[_0xbf4e('0x1b')](respondWithFilteredResult(_0x5a0a9b,_0x38c923))[_0xbf4e('0x37')](handleError(_0x5a0a9b,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 44a7656..e81733d 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 _0x342e=['bluebird','request-promise','../../config/environment','./migration.attributes','exports','migrations','lodash','util','../../config/logger'];(function(_0x5b0779,_0x40d92a){var _0x2d8671=function(_0x5cd62d){while(--_0x5cd62d){_0x5b0779['push'](_0x5b0779['shift']());}};_0x2d8671(++_0x40d92a);}(_0x342e,0xde));var _0xe342=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x342e[_0x2a2166];return _0x3bcf50;};'use strict';var _=require(_0xe342('0x0'));var util=require(_0xe342('0x1'));var logger=require(_0xe342('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe342('0x3'));var rp=require(_0xe342('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe342('0x5'));var attributes=require(_0xe342('0x6'));module[_0xe342('0x7')]=function(_0x590e9,_0x164e21){return _0x590e9['define']('Migration',attributes,{'tableName':_0xe342('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7c8=['request-promise','path','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','../../config/logger','api','moment','bluebird'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xb7c8,0x119));var _0x8b7c=function(_0x363dab,_0x463714){_0x363dab=_0x363dab-0x0;var _0x1f5173=_0xb7c8[_0x363dab];return _0x1f5173;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var fs=require('fs');var path=require(_0x8b7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7c('0x7'));var attributes=require(_0x8b7c('0x8'));module[_0x8b7c('0x9')]=function(_0x440900,_0x107428){return _0x440900[_0x8b7c('0xa')](_0x8b7c('0xb'),attributes,{'tableName':_0x8b7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 3920ce4..73031e1 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 _0x0294=['request','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x16ce46,_0x3d3268){var _0x5d76b0=function(_0x8ec3fd){while(--_0x8ec3fd){_0x16ce46['push'](_0x16ce46['shift']());}};_0x5d76b0(++_0x3d3268);}(_0x0294,0xb3));var _0x4029=function(_0x17ff81,_0x4da158){_0x17ff81=_0x17ff81-0x0;var _0x431729=_0x0294[_0x17ff81];return _0x431729;};'use strict';var _=require(_0x4029('0x0'));var util=require(_0x4029('0x1'));var moment=require(_0x4029('0x2'));var BPromise=require('bluebird');var rs=require(_0x4029('0x3'));var fs=require('fs');var Redis=require(_0x4029('0x4'));var db=require(_0x4029('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4029('0x6'));var config=require(_0x4029('0x7'));var jayson=require(_0x4029('0x8'));var client=jayson['client'][_0x4029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ad3d6,_0x30ef1e,_0x3dbe90){return new BPromise(function(_0x173520,_0x3ba92e){return client[_0x4029('0xa')](_0x2ad3d6,_0x3dbe90)[_0x4029('0xb')](function(_0x415904){logger[_0x4029('0xc')]('Migration,\x20%s,\x20%s',_0x30ef1e,'request\x20sent');logger[_0x4029('0xd')](_0x4029('0xe'),_0x30ef1e,_0x4029('0xf'),JSON['stringify'](_0x415904));if(_0x415904[_0x4029('0x10')]){if(_0x415904[_0x4029('0x10')]['code']===0x1f4){logger['error'](_0x4029('0x11'),_0x30ef1e,_0x415904['error'][_0x4029('0x12')]);return _0x3ba92e(_0x415904[_0x4029('0x10')]['message']);}logger[_0x4029('0x10')](_0x4029('0x11'),_0x30ef1e,_0x415904['error'][_0x4029('0x12')]);return _0x173520(_0x415904[_0x4029('0x10')][_0x4029('0x12')]);}else{logger['info'](_0x4029('0x11'),_0x30ef1e,_0x4029('0xf'));_0x173520(_0x415904[_0x4029('0x13')]['message']);}})[_0x4029('0x14')](function(_0x5c229d){logger[_0x4029('0x10')](_0x4029('0x11'),_0x30ef1e,_0x5c229d);_0x3ba92e(_0x5c229d);});});} \ No newline at end of file +var _0x8384=['../../config/environment','jayson/promise','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x361aae,_0x2c854b){var _0x1b9a1c=function(_0x145ed7){while(--_0x145ed7){_0x361aae['push'](_0x361aae['shift']());}};_0x1b9a1c(++_0x2c854b);}(_0x8384,0xca));var _0x4838=function(_0x26260c,_0x3a9df0){_0x26260c=_0x26260c-0x0;var _0x21f487=_0x8384[_0x26260c];return _0x21f487;};'use strict';var _=require(_0x4838('0x0'));var util=require(_0x4838('0x1'));var moment=require(_0x4838('0x2'));var BPromise=require('bluebird');var rs=require(_0x4838('0x3'));var fs=require('fs');var Redis=require(_0x4838('0x4'));var db=require(_0x4838('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4838('0x6'))(_0x4838('0x7'));var config=require(_0x4838('0x8'));var jayson=require(_0x4838('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x247fc7,_0x2a435f,_0x3aeec7){return new BPromise(function(_0x18ef75,_0xa2d7ee){return client[_0x4838('0xa')](_0x247fc7,_0x3aeec7)['then'](function(_0x315cbd){logger[_0x4838('0xb')](_0x4838('0xc'),_0x2a435f,_0x4838('0xd'));logger[_0x4838('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x2a435f,_0x4838('0xd'),JSON[_0x4838('0xf')](_0x315cbd));if(_0x315cbd[_0x4838('0x10')]){if(_0x315cbd[_0x4838('0x10')][_0x4838('0x11')]===0x1f4){logger[_0x4838('0x10')](_0x4838('0xc'),_0x2a435f,_0x315cbd[_0x4838('0x10')][_0x4838('0x12')]);return _0xa2d7ee(_0x315cbd[_0x4838('0x10')]['message']);}logger['error'](_0x4838('0xc'),_0x2a435f,_0x315cbd[_0x4838('0x10')][_0x4838('0x12')]);return _0x18ef75(_0x315cbd[_0x4838('0x10')]['message']);}else{logger[_0x4838('0xb')]('Migration,\x20%s,\x20%s',_0x2a435f,_0x4838('0xd'));_0x18ef75(_0x315cbd[_0x4838('0x13')][_0x4838('0x12')]);}})[_0x4838('0x14')](function(_0x1c54a9){logger[_0x4838('0x10')](_0x4838('0xc'),_0x2a435f,_0x1c54a9);_0xa2d7ee(_0x1c54a9);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 30c87c3..1df6256 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 _0x743d=['exports','path','connect-timeout','express','Router','../../components/interaction/service','./network.controller','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x1127ca,_0x368825){var _0x197c62=function(_0x33454c){while(--_0x33454c){_0x1127ca['push'](_0x1127ca['shift']());}};_0x197c62(++_0x368825);}(_0x743d,0xa1));var _0xd743=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x743d[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd743('0x0'));var timeout=require(_0xd743('0x1'));var express=require(_0xd743('0x2'));var router=express[_0xd743('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd743('0x4'));var config=require('../../config/environment');var controller=require(_0xd743('0x5'));router['get']('/',auth[_0xd743('0x6')](),controller['index']);router['get'](_0xd743('0x7'),auth[_0xd743('0x6')](),controller[_0xd743('0x8')]);router[_0xd743('0x9')]('/',auth[_0xd743('0x6')](),controller[_0xd743('0xa')]);router[_0xd743('0xb')]('/:id',auth[_0xd743('0x6')](),controller[_0xd743('0xc')]);router[_0xd743('0xd')](_0xd743('0x7'),auth[_0xd743('0x6')](),controller[_0xd743('0xe')]);module[_0xd743('0xf')]=router; \ No newline at end of file +var _0x2cce=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./network.controller','get','/:id','isAuthenticated','show','post'];(function(_0x5705a5,_0x5496c5){var _0x1296ab=function(_0x396cc6){while(--_0x396cc6){_0x5705a5['push'](_0x5705a5['shift']());}};_0x1296ab(++_0x5496c5);}(_0x2cce,0x8e));var _0xe2cc=function(_0x41983d,_0x493b6e){_0x41983d=_0x41983d-0x0;var _0x1bff13=_0x2cce[_0x41983d];return _0x1bff13;};'use strict';var multer=require(_0xe2cc('0x0'));var util=require(_0xe2cc('0x1'));var path=require(_0xe2cc('0x2'));var timeout=require(_0xe2cc('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xe2cc('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe2cc('0x5'));router[_0xe2cc('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe2cc('0x7'),auth[_0xe2cc('0x8')](),controller[_0xe2cc('0x9')]);router[_0xe2cc('0xa')]('/',auth['isAuthenticated'](),controller[_0xe2cc('0xb')]);router[_0xe2cc('0xc')](_0xe2cc('0x7'),auth[_0xe2cc('0x8')](),controller[_0xe2cc('0xd')]);router[_0xe2cc('0xe')](_0xe2cc('0x7'),auth['isAuthenticated'](),controller[_0xe2cc('0xf')]);module[_0xe2cc('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f69bc0b..b4e5394 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(_0x32c443,_0x5d1502){var _0x2636e9=function(_0x21ee9f){while(--_0x21ee9f){_0x32c443['push'](_0x32c443['shift']());}};_0x2636e9(++_0x5d1502);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x1b4bba,_0x384921){var _0xf00e4b=function(_0x53d9bb){while(--_0x53d9bb){_0x1b4bba['push'](_0x1b4bba['shift']());}};_0xf00e4b(++_0x384921);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 0734dca..d76fefe 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 _0x2004=['result','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','then','stack','name','send','map','Network','fieldName','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','sequelize','body','type','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','readFileSync','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','update','transaction','format','destroy','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../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~!@#$%^&-_=+[{]}.','info','debug','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message'];(function(_0xf5e300,_0x2343d4){var _0x3f0978=function(_0x4382bc){while(--_0x4382bc){_0xf5e300['push'](_0xf5e300['shift']());}};_0x3f0978(++_0x2343d4);}(_0x2004,0xac));var _0x4200=function(_0xa65cc,_0x3ffcd5){_0xa65cc=_0xa65cc-0x0;var _0x22a2d4=_0x2004[_0xa65cc];return _0x22a2d4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4200('0x0'));var rimraf=require(_0x4200('0x1'));var zipdir=require(_0x4200('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4200('0x3'));var moment=require(_0x4200('0x4'));var BPromise=require(_0x4200('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4200('0x6'));var sox=require(_0x4200('0x7'));var csv=require(_0x4200('0x8'));var ejs=require(_0x4200('0x9'));var fs=require('fs');var _=require(_0x4200('0xa'));var squel=require(_0x4200('0xb'));var crypto=require(_0x4200('0xc'));var jsforce=require(_0x4200('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4200('0x8'));var querystring=require(_0x4200('0xe'));var Papa=require(_0x4200('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4200('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4200('0x11'));var logger=require(_0x4200('0x12'))('api');var utils=require(_0x4200('0x13'));var config=require('../../config/environment');var db=require(_0x4200('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x4200('0x15')]({'port':0x232a});function checkPasswordPattern(_0x123c25,_0xc3eb6b,_0x3abb2e){if(_0x3abb2e){var _0x2e3b15=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e3b15[_0x4200('0x16')](_0xc3eb6b)){return _0x123c25;}else{throw new db[(_0x4200('0x17'))][(_0x4200('0x18'))](_0x4200('0x19'));}}else{return _0x123c25;}}function respondWithRpcPromise(_0x4fb68f,_0x388335,_0x3d877c,_0x5c9bc5){return new BPromise(function(_0x160747,_0xf69d4d){var _0x1515ab=_0x5c9bc5||client;return _0x1515ab['request'](_0x4fb68f,_0x3d877c)['then'](function(_0x2b9ae4){logger[_0x4200('0x1a')]('Network,\x20%s,\x20%s',_0x388335,'request\x20sent');logger[_0x4200('0x1b')]('Network,\x20%s,\x20%s,\x20%s',_0x388335,_0x4200('0x1c'),JSON[_0x4200('0x1d')](_0x2b9ae4));if(_0x2b9ae4[_0x4200('0x1e')]){if(_0x2b9ae4['error'][_0x4200('0x1f')]===0x1f4){logger[_0x4200('0x1e')](_0x4200('0x20'),_0x388335,_0x2b9ae4[_0x4200('0x1e')]['message']);return _0xf69d4d(_0x2b9ae4[_0x4200('0x1e')][_0x4200('0x21')]);}logger[_0x4200('0x1e')](_0x4200('0x20'),_0x388335,_0x2b9ae4['error'][_0x4200('0x21')]);return _0x160747(_0x2b9ae4[_0x4200('0x1e')][_0x4200('0x21')]);}else{logger['info'](_0x4200('0x20'),_0x388335,_0x4200('0x1c'));_0x160747(_0x2b9ae4[_0x4200('0x22')][_0x4200('0x21')]);}})['catch'](function(_0x5ef023){logger[_0x4200('0x1e')](_0x4200('0x20'),_0x388335,_0x5ef023);_0xf69d4d(_0x5ef023);});});}function respondWithStatusCode(_0x23596c,_0x584fa8){_0x584fa8=_0x584fa8||0xcc;return function(_0x45c961){if(_0x45c961){return _0x23596c[_0x4200('0x23')](_0x584fa8);}return _0x23596c[_0x4200('0x24')](_0x584fa8)[_0x4200('0x25')]();};}function respondWithResult(_0xd97cad,_0xdcf1ae){_0xdcf1ae=_0xdcf1ae||0xc8;return function(_0x402b7f){if(_0x402b7f){return _0xd97cad[_0x4200('0x24')](_0xdcf1ae)['json'](_0x402b7f);}};}function respondWithFilteredResult(_0x34ad30,_0x3c1f62){return function(_0x324898){if(_0x324898){var _0x49381a=_0x324898['count'],_0x2916e8=_0x3c1f62['offset'],_0x4e2bb8=_0x3c1f62[_0x4200('0x26')]+_0x3c1f62[_0x4200('0x27')],_0x1f2992;if(_0x4e2bb8>=_0x49381a){_0x4e2bb8=_0x49381a;_0x1f2992=0xc8;}else{_0x1f2992=0xce;}_0x34ad30['status'](_0x1f2992);return _0x34ad30[_0x4200('0x28')](_0x4200('0x29'),_0x2916e8+'-'+_0x4e2bb8+'/'+_0x49381a)[_0x4200('0x2a')](_0x324898);}return null;};}function patchUpdates(_0x30cd43){return function(_0x4efa5a){try{jsonpatch['apply'](_0x4efa5a,_0x30cd43,!![]);}catch(_0x3ddc78){return BPromise[_0x4200('0x2b')](_0x3ddc78);}return _0x4efa5a[_0x4200('0x2c')]();};}function saveUpdates(_0x5b4b50,_0xbb499a){return function(_0x57085a){if(_0x57085a){return _0x57085a['update'](_0x5b4b50)[_0x4200('0x2d')](function(_0x144700){return _0x144700;});}return null;};}function removeEntity(_0xc34f8e,_0x1b6a72){return function(_0x265104){if(_0x265104){return _0x265104['destroy']()[_0x4200('0x2d')](function(){_0xc34f8e[_0x4200('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227dbf,_0x3858b5){return function(_0x23ac43){if(!_0x23ac43){_0x227dbf[_0x4200('0x23')](0x194);}return _0x23ac43;};}function handleError(_0x543c33,_0x353569){_0x353569=_0x353569||0x1f4;return function(_0x416050){logger['error'](_0x416050[_0x4200('0x2e')]);if(_0x416050[_0x4200('0x2f')]){delete _0x416050['name'];}_0x543c33[_0x4200('0x24')](_0x353569)[_0x4200('0x30')](_0x416050);};}exports['index']=function(_0x44ad90,_0x25c05f){var _0x5713c6={},_0x53c1c6={},_0x585c49={'count':0x0,'rows':[]};var _0x3a99bc=_[_0x4200('0x31')](db[_0x4200('0x32')]['rawAttributes'],function(_0x41a646){return{'name':_0x41a646[_0x4200('0x33')],'type':_0x41a646['type']['key']};});_0x53c1c6['model']=_[_0x4200('0x31')](_0x3a99bc,'name');_0x53c1c6[_0x4200('0x34')]=_[_0x4200('0x35')](_0x44ad90['query']);_0x53c1c6[_0x4200('0x36')]=_[_0x4200('0x37')](_0x53c1c6[_0x4200('0x38')],_0x53c1c6[_0x4200('0x34')]);_0x5713c6[_0x4200('0x39')]=_['intersection'](_0x53c1c6[_0x4200('0x38')],qs[_0x4200('0x3a')](_0x44ad90[_0x4200('0x34')][_0x4200('0x3a')]));_0x5713c6[_0x4200('0x39')]=_0x5713c6['attributes']['length']?_0x5713c6[_0x4200('0x39')]:_0x53c1c6['model'];if(!_0x44ad90['query']['hasOwnProperty'](_0x4200('0x3b'))){_0x5713c6[_0x4200('0x27')]=qs[_0x4200('0x27')](_0x44ad90[_0x4200('0x34')][_0x4200('0x27')]);_0x5713c6[_0x4200('0x26')]=qs['offset'](_0x44ad90[_0x4200('0x34')][_0x4200('0x26')]);}_0x5713c6[_0x4200('0x3c')]=qs['sort'](_0x44ad90[_0x4200('0x34')][_0x4200('0x3d')]);_0x5713c6[_0x4200('0x3e')]=qs[_0x4200('0x36')](_[_0x4200('0x3f')](_0x44ad90['query'],_0x53c1c6['filters']),_0x3a99bc);if(_0x44ad90[_0x4200('0x34')][_0x4200('0x40')]){_0x5713c6[_0x4200('0x3e')]=_['merge'](_0x5713c6[_0x4200('0x3e')],{'$or':_['map'](_0x3a99bc,function(_0xfe9cf2){if(_0xfe9cf2['type']!=='VIRTUAL'){var _0x2d0902={};_0x2d0902[_0xfe9cf2[_0x4200('0x2f')]]={'$like':'%'+_0x44ad90[_0x4200('0x34')][_0x4200('0x40')]+'%'};return _0x2d0902;}})});}_0x5713c6=_[_0x4200('0x41')]({},_0x5713c6,_0x44ad90['options']);var _0x564ed4={'where':_0x5713c6[_0x4200('0x3e')]};return db[_0x4200('0x32')]['count'](_0x564ed4)['then'](function(_0x13ccb2){_0x585c49['count']=_0x13ccb2;if(_0x44ad90[_0x4200('0x34')][_0x4200('0x42')]){_0x5713c6[_0x4200('0x43')]=[{'all':!![]}];}return db[_0x4200('0x32')][_0x4200('0x44')](_0x5713c6);})[_0x4200('0x2d')](function(_0x457241){_0x585c49[_0x4200('0x45')]=_0x457241;return _0x585c49;})[_0x4200('0x2d')](respondWithFilteredResult(_0x25c05f,_0x5713c6))[_0x4200('0x46')](handleError(_0x25c05f,null));};exports[_0x4200('0x47')]=function(_0x4b6e7e,_0x5320f9){var _0xc36e2={'raw':!![],'where':{'id':_0x4b6e7e[_0x4200('0x48')]['id']}},_0x1f3855={};_0x1f3855['model']=_[_0x4200('0x35')](db[_0x4200('0x32')]['rawAttributes']);_0x1f3855[_0x4200('0x34')]=_[_0x4200('0x35')](_0x4b6e7e[_0x4200('0x34')]);_0x1f3855[_0x4200('0x36')]=_['intersection'](_0x1f3855[_0x4200('0x38')],_0x1f3855[_0x4200('0x34')]);_0xc36e2[_0x4200('0x39')]=_[_0x4200('0x37')](_0x1f3855['model'],qs['fields'](_0x4b6e7e[_0x4200('0x34')][_0x4200('0x3a')]));_0xc36e2[_0x4200('0x39')]=_0xc36e2[_0x4200('0x39')][_0x4200('0x49')]?_0xc36e2[_0x4200('0x39')]:_0x1f3855[_0x4200('0x38')];if(_0x4b6e7e['query'][_0x4200('0x42')]){_0xc36e2[_0x4200('0x43')]=[{'all':!![]}];}_0xc36e2=_[_0x4200('0x41')]({},_0xc36e2,_0x4b6e7e[_0x4200('0x4a')]);return db[_0x4200('0x32')][_0x4200('0x4b')](_0xc36e2)[_0x4200('0x2d')](handleEntityNotFound(_0x5320f9,null))[_0x4200('0x2d')](respondWithResult(_0x5320f9,null))[_0x4200('0x46')](handleError(_0x5320f9,null));};exports[_0x4200('0x4c')]=function(_0xc26a07,_0x3f277d,_0x14dd72){var _0xdd1b70;return db[_0x4200('0x4d')]['transaction'](function(_0x585fa8){return db[_0x4200('0x32')][_0x4200('0x4c')](_0xc26a07[_0x4200('0x4e')],{'raw':!![]})[_0x4200('0x2d')](function(_0x5de984){_0xdd1b70=_0x5de984;return db[_0x4200('0x32')][_0x4200('0x44')]({'where':{'type':_0xc26a07[_0x4200('0x4e')][_0x4200('0x4f')]},'raw':!![]});})[_0x4200('0x2d')](function(_0x22b28c){if(_0xdd1b70['type'][_0x4200('0x50')]()==_0x4200('0x51')){var _0x59c465=fs['readFileSync'](path[_0x4200('0x52')](config[_0x4200('0x53')],_0x4200('0x54')),_0x4200('0x55'));var _0x3feb06=ejs['render'](_0x59c465,{'networks':_0x22b28c||[]});fs[_0x4200('0x56')](_0x4200('0x57'),_0x3feb06);return respondWithRpcPromise(_0x4200('0x58'),'create',{'module':_0x4200('0x59')});}else if(_0xdd1b70[_0x4200('0x4f')][_0x4200('0x50')]()==_0x4200('0x5a')){var _0x559cb3=fs['readFileSync'](path[_0x4200('0x52')](config[_0x4200('0x53')],_0x4200('0x5b')),_0x4200('0x55'));var _0x1d114f=ejs[_0x4200('0x5c')](_0x559cb3,{'networks':_0x22b28c||[]});fs[_0x4200('0x56')](_0x4200('0x5d'),_0x1d114f);return respondWithRpcPromise(_0x4200('0x58'),_0x4200('0x4c'),{'module':_0x4200('0x59')});}else{var _0xf3f0b2=fs[_0x4200('0x5e')](path[_0x4200('0x52')](config[_0x4200('0x53')],_0x4200('0x5f')),_0x4200('0x55'));var _0x2313c9=ejs[_0x4200('0x5c')](_0xf3f0b2,{'networks':_0x22b28c||[]});fs['writeFileSync'](util['format'](_0x4200('0x60'),_0xc26a07[_0x4200('0x4e')][_0x4200('0x4f')][_0x4200('0x61')]()),_0x2313c9);return respondWithRpcPromise(_0x4200('0x58'),'create',{'module':'chan_sip.so'});}return null;})[_0x4200('0x2d')](function(){return _0xdd1b70;});})['then'](respondWithResult(_0x3f277d,0xc9))[_0x4200('0x46')](handleError(_0x3f277d,null));};exports[_0x4200('0x62')]=function(_0x38849b,_0x1e83d2,_0x18a5b0){var _0x3180eb;return db[_0x4200('0x4d')][_0x4200('0x63')](function(_0x33920d){return db[_0x4200('0x32')]['find']({'where':{'id':_0x38849b[_0x4200('0x48')]['id']}})[_0x4200('0x2d')](handleEntityNotFound(_0x1e83d2,null))['then'](saveUpdates(_0x38849b[_0x4200('0x4e')],null))['then'](function(_0x4129d1){if(_0x4129d1){_0x3180eb=_0x4129d1;return db[_0x4200('0x32')]['findAll']({'where':{'type':_0x3180eb[_0x4200('0x4f')]},'raw':!![]});}return null;})[_0x4200('0x2d')](function(_0x263435){if(_0x3180eb[_0x4200('0x4f')][_0x4200('0x50')]()==_0x4200('0x51')){var _0x6f296d=fs[_0x4200('0x5e')](path['join'](config[_0x4200('0x53')],_0x4200('0x54')),_0x4200('0x55'));var _0x26fcdc=ejs[_0x4200('0x5c')](_0x6f296d,{'networks':_0x263435||[]});fs[_0x4200('0x56')]('/etc/asterisk/stun_xcally.conf',_0x26fcdc);return respondWithRpcPromise(_0x4200('0x58'),_0x4200('0x62'),{'module':'res_stun_monitor.so'});}else if(_0x3180eb['type']['toUpperCase']()==_0x4200('0x5a')){var _0x4cf249=fs['readFileSync'](path['join'](config[_0x4200('0x53')],'server/files/templates/turn_multiple.ejs'),_0x4200('0x55'));var _0x38a9f1=ejs['render'](_0x4cf249,{'networks':_0x263435||[]});fs['writeFileSync'](_0x4200('0x5d'),_0x38a9f1);return respondWithRpcPromise('Reload',_0x4200('0x62'),{'module':'res_stun_monitor.so'});}else{var _0x55fa61=fs[_0x4200('0x5e')](path[_0x4200('0x52')](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x1eb35e=ejs[_0x4200('0x5c')](_0x55fa61,{'networks':_0x263435||[]});fs['writeFileSync'](util[_0x4200('0x64')](_0x4200('0x60'),_0x38849b[_0x4200('0x4e')][_0x4200('0x4f')][_0x4200('0x61')]()),_0x1eb35e);return respondWithRpcPromise(_0x4200('0x58'),_0x4200('0x62'),{'module':'chan_sip.so'});}return null;})[_0x4200('0x2d')](function(_0xb0299f){if(_0xb0299f){return _0x3180eb;}return null;});})[_0x4200('0x2d')](respondWithResult(_0x1e83d2,null))[_0x4200('0x46')](handleError(_0x1e83d2,null));};exports[_0x4200('0x65')]=function(_0x49276a,_0x49163b,_0x23968b){var _0x4e9aed;return db[_0x4200('0x32')]['find']({'where':{'id':_0x49276a['params']['id']}})[_0x4200('0x2d')](function(_0x18464c){_0x4e9aed=_0x18464c;return _0x18464c;})[_0x4200('0x2d')](handleEntityNotFound(_0x49163b,null))['then'](removeEntity(_0x49163b,null))[_0x4200('0x2d')](function(){if(_0x4e9aed){return db[_0x4200('0x32')][_0x4200('0x44')]({'where':{'type':_0x4e9aed['type']},'raw':!![]});}})[_0x4200('0x2d')](function(_0xa684d5){if(_0x4e9aed['type'][_0x4200('0x50')]()==_0x4200('0x51')){var _0x127e0e=fs['readFileSync'](path[_0x4200('0x52')](config[_0x4200('0x53')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x37257c=ejs['render'](_0x127e0e,{'networks':_0xa684d5||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x37257c);return respondWithRpcPromise(_0x4200('0x58'),_0x4200('0x65'),{'module':_0x4200('0x59')});}else if(_0x4e9aed[_0x4200('0x4f')][_0x4200('0x50')]()==_0x4200('0x5a')){var _0x1d3858=fs[_0x4200('0x5e')](path[_0x4200('0x52')](config[_0x4200('0x53')],_0x4200('0x5b')),'utf8');var _0x4215c8=ejs[_0x4200('0x5c')](_0x1d3858,{'networks':_0xa684d5||[]});fs[_0x4200('0x56')](_0x4200('0x5d'),_0x4215c8);return respondWithRpcPromise('Reload',_0x4200('0x65'),{'module':_0x4200('0x59')});}else{var _0x721abe=fs[_0x4200('0x5e')](path[_0x4200('0x52')](config[_0x4200('0x53')],_0x4200('0x5f')),_0x4200('0x55'));var _0x2643d3=ejs[_0x4200('0x5c')](_0x721abe,{'networks':_0xa684d5||[]});fs[_0x4200('0x56')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x49276a[_0x4200('0x4e')]['type'][_0x4200('0x61')]()),_0x2643d3);return respondWithRpcPromise('Reload',_0x4200('0x65'),{'module':_0x4200('0x66')});}return null;})[_0x4200('0x46')](handleError(_0x49163b,null));}; \ No newline at end of file +var _0xb4fc=['path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','create','sequelize','transaction','findAll','body','type','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','server/files/templates/turn_multiple.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xe2a7ff,_0x489af9){var _0x5e2671=function(_0x36f89f){while(--_0x36f89f){_0xe2a7ff['push'](_0xe2a7ff['shift']());}};_0x5e2671(++_0x489af9);}(_0xb4fc,0xdd));var _0xcb4f=function(_0x1a87e8,_0x3c5fc8){_0x1a87e8=_0x1a87e8-0x0;var _0x27828f=_0xb4fc[_0x1a87e8];return _0x27828f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcb4f('0x0'));var rimraf=require(_0xcb4f('0x1'));var zipdir=require(_0xcb4f('0x2'));var jsonpatch=require(_0xcb4f('0x3'));var rp=require(_0xcb4f('0x4'));var moment=require(_0xcb4f('0x5'));var BPromise=require(_0xcb4f('0x6'));var Mustache=require(_0xcb4f('0x7'));var util=require(_0xcb4f('0x8'));var path=require(_0xcb4f('0x9'));var sox=require(_0xcb4f('0xa'));var csv=require(_0xcb4f('0xb'));var ejs=require(_0xcb4f('0xc'));var fs=require('fs');var _=require(_0xcb4f('0xd'));var squel=require('squel');var crypto=require(_0xcb4f('0xe'));var jsforce=require(_0xcb4f('0xf'));var deskjs=require(_0xcb4f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcb4f('0x11'));var Papa=require(_0xcb4f('0x12'));var Redis=require(_0xcb4f('0x13'));var authService=require(_0xcb4f('0x14'));var qs=require(_0xcb4f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb4f('0x16'));var logger=require('../../config/logger')(_0xcb4f('0x17'));var utils=require(_0xcb4f('0x18'));var config=require(_0xcb4f('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xcb4f('0x1a'));var client=jayson[_0xcb4f('0x1b')][_0xcb4f('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x406538,_0x53bcce,_0x10b56d){if(_0x10b56d){var _0x589fbd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x589fbd[_0xcb4f('0x1d')](_0x53bcce)){return _0x406538;}else{throw new db[(_0xcb4f('0x1e'))][(_0xcb4f('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 _0x406538;}}function respondWithRpcPromise(_0xe37ac7,_0x12477,_0x2eed72,_0x6416a6){return new BPromise(function(_0x5db859,_0x2299a0){var _0x49b15c=_0x6416a6||client;return _0x49b15c['request'](_0xe37ac7,_0x2eed72)[_0xcb4f('0x20')](function(_0x2d7a35){logger[_0xcb4f('0x21')](_0xcb4f('0x22'),_0x12477,'request\x20sent');logger[_0xcb4f('0x23')](_0xcb4f('0x24'),_0x12477,_0xcb4f('0x25'),JSON[_0xcb4f('0x26')](_0x2d7a35));if(_0x2d7a35['error']){if(_0x2d7a35[_0xcb4f('0x27')][_0xcb4f('0x28')]===0x1f4){logger[_0xcb4f('0x27')]('Network,\x20%s,\x20%s',_0x12477,_0x2d7a35[_0xcb4f('0x27')][_0xcb4f('0x29')]);return _0x2299a0(_0x2d7a35[_0xcb4f('0x27')][_0xcb4f('0x29')]);}logger[_0xcb4f('0x27')](_0xcb4f('0x22'),_0x12477,_0x2d7a35[_0xcb4f('0x27')][_0xcb4f('0x29')]);return _0x5db859(_0x2d7a35[_0xcb4f('0x27')][_0xcb4f('0x29')]);}else{logger[_0xcb4f('0x21')](_0xcb4f('0x22'),_0x12477,'request\x20sent');_0x5db859(_0x2d7a35['result'][_0xcb4f('0x29')]);}})[_0xcb4f('0x2a')](function(_0x4eb33c){logger[_0xcb4f('0x27')]('Network,\x20%s,\x20%s',_0x12477,_0x4eb33c);_0x2299a0(_0x4eb33c);});});}function respondWithStatusCode(_0x4ca17b,_0x4853da){_0x4853da=_0x4853da||0xcc;return function(_0x241dc4){if(_0x241dc4){return _0x4ca17b['sendStatus'](_0x4853da);}return _0x4ca17b[_0xcb4f('0x2b')](_0x4853da)[_0xcb4f('0x2c')]();};}function respondWithResult(_0xfd0b4,_0x4624f8){_0x4624f8=_0x4624f8||0xc8;return function(_0x884813){if(_0x884813){return _0xfd0b4['status'](_0x4624f8)[_0xcb4f('0x2d')](_0x884813);}};}function respondWithFilteredResult(_0x26e5fd,_0x128895){return function(_0x4c74f1){if(_0x4c74f1){var _0x5a3234=_0x4c74f1[_0xcb4f('0x2e')],_0x5d5506=_0x128895[_0xcb4f('0x2f')],_0x57e0bc=_0x128895[_0xcb4f('0x2f')]+_0x128895['limit'],_0x34e712;if(_0x57e0bc>=_0x5a3234){_0x57e0bc=_0x5a3234;_0x34e712=0xc8;}else{_0x34e712=0xce;}_0x26e5fd[_0xcb4f('0x2b')](_0x34e712);return _0x26e5fd[_0xcb4f('0x30')](_0xcb4f('0x31'),_0x5d5506+'-'+_0x57e0bc+'/'+_0x5a3234)[_0xcb4f('0x2d')](_0x4c74f1);}return null;};}function patchUpdates(_0x202975){return function(_0x579bf8){try{jsonpatch[_0xcb4f('0x32')](_0x579bf8,_0x202975,!![]);}catch(_0x1959c1){return BPromise[_0xcb4f('0x33')](_0x1959c1);}return _0x579bf8[_0xcb4f('0x34')]();};}function saveUpdates(_0x3dbe3d,_0x145298){return function(_0x24b962){if(_0x24b962){return _0x24b962[_0xcb4f('0x35')](_0x3dbe3d)[_0xcb4f('0x20')](function(_0x102efc){return _0x102efc;});}return null;};}function removeEntity(_0x1310a7,_0xa5b931){return function(_0x2788de){if(_0x2788de){return _0x2788de[_0xcb4f('0x36')]()[_0xcb4f('0x20')](function(){_0x1310a7[_0xcb4f('0x2b')](0xcc)[_0xcb4f('0x2c')]();});}};}function handleEntityNotFound(_0x5f017f,_0x572031){return function(_0x56be10){if(!_0x56be10){_0x5f017f[_0xcb4f('0x37')](0x194);}return _0x56be10;};}function handleError(_0x354c8d,_0x1b3ed6){_0x1b3ed6=_0x1b3ed6||0x1f4;return function(_0x3e1cd7){logger[_0xcb4f('0x27')](_0x3e1cd7[_0xcb4f('0x38')]);if(_0x3e1cd7[_0xcb4f('0x39')]){delete _0x3e1cd7[_0xcb4f('0x39')];}_0x354c8d[_0xcb4f('0x2b')](_0x1b3ed6)[_0xcb4f('0x3a')](_0x3e1cd7);};}exports[_0xcb4f('0x3b')]=function(_0x147ba3,_0x1140e9){var _0x379408={},_0x52806f={},_0x26d700={'count':0x0,'rows':[]};var _0x585e5e=_[_0xcb4f('0x3c')](db[_0xcb4f('0x3d')][_0xcb4f('0x3e')],function(_0xb30ed){return{'name':_0xb30ed[_0xcb4f('0x3f')],'type':_0xb30ed['type'][_0xcb4f('0x40')]};});_0x52806f[_0xcb4f('0x41')]=_[_0xcb4f('0x3c')](_0x585e5e,_0xcb4f('0x39'));_0x52806f[_0xcb4f('0x42')]=_[_0xcb4f('0x43')](_0x147ba3[_0xcb4f('0x42')]);_0x52806f[_0xcb4f('0x44')]=_[_0xcb4f('0x45')](_0x52806f[_0xcb4f('0x41')],_0x52806f[_0xcb4f('0x42')]);_0x379408['attributes']=_[_0xcb4f('0x45')](_0x52806f[_0xcb4f('0x41')],qs[_0xcb4f('0x46')](_0x147ba3[_0xcb4f('0x42')][_0xcb4f('0x46')]));_0x379408[_0xcb4f('0x47')]=_0x379408[_0xcb4f('0x47')][_0xcb4f('0x48')]?_0x379408[_0xcb4f('0x47')]:_0x52806f['model'];if(!_0x147ba3['query'][_0xcb4f('0x49')](_0xcb4f('0x4a'))){_0x379408['limit']=qs[_0xcb4f('0x4b')](_0x147ba3[_0xcb4f('0x42')][_0xcb4f('0x4b')]);_0x379408[_0xcb4f('0x2f')]=qs['offset'](_0x147ba3[_0xcb4f('0x42')]['offset']);}_0x379408[_0xcb4f('0x4c')]=qs[_0xcb4f('0x4d')](_0x147ba3[_0xcb4f('0x42')][_0xcb4f('0x4d')]);_0x379408[_0xcb4f('0x4e')]=qs['filters'](_['pick'](_0x147ba3['query'],_0x52806f[_0xcb4f('0x44')]),_0x585e5e);if(_0x147ba3[_0xcb4f('0x42')]['filter']){_0x379408['where']=_[_0xcb4f('0x4f')](_0x379408[_0xcb4f('0x4e')],{'$or':_[_0xcb4f('0x3c')](_0x585e5e,function(_0x525621){if(_0x525621['type']!==_0xcb4f('0x50')){var _0x36432e={};_0x36432e[_0x525621[_0xcb4f('0x39')]]={'$like':'%'+_0x147ba3[_0xcb4f('0x42')][_0xcb4f('0x51')]+'%'};return _0x36432e;}})});}_0x379408=_[_0xcb4f('0x4f')]({},_0x379408,_0x147ba3[_0xcb4f('0x52')]);var _0x36f334={'where':_0x379408['where']};return db['Network'][_0xcb4f('0x2e')](_0x36f334)[_0xcb4f('0x20')](function(_0x2b08ba){_0x26d700[_0xcb4f('0x2e')]=_0x2b08ba;if(_0x147ba3['query'][_0xcb4f('0x53')]){_0x379408[_0xcb4f('0x54')]=[{'all':!![]}];}return db[_0xcb4f('0x3d')]['findAll'](_0x379408);})[_0xcb4f('0x20')](function(_0x29ba22){_0x26d700[_0xcb4f('0x55')]=_0x29ba22;return _0x26d700;})[_0xcb4f('0x20')](respondWithFilteredResult(_0x1140e9,_0x379408))[_0xcb4f('0x2a')](handleError(_0x1140e9,null));};exports[_0xcb4f('0x56')]=function(_0x1e0c20,_0x8476ea){var _0xf4b2e5={'raw':!![],'where':{'id':_0x1e0c20[_0xcb4f('0x57')]['id']}},_0x98052={};_0x98052[_0xcb4f('0x41')]=_['keys'](db[_0xcb4f('0x3d')][_0xcb4f('0x3e')]);_0x98052[_0xcb4f('0x42')]=_[_0xcb4f('0x43')](_0x1e0c20['query']);_0x98052[_0xcb4f('0x44')]=_[_0xcb4f('0x45')](_0x98052[_0xcb4f('0x41')],_0x98052[_0xcb4f('0x42')]);_0xf4b2e5['attributes']=_[_0xcb4f('0x45')](_0x98052[_0xcb4f('0x41')],qs[_0xcb4f('0x46')](_0x1e0c20[_0xcb4f('0x42')]['fields']));_0xf4b2e5[_0xcb4f('0x47')]=_0xf4b2e5[_0xcb4f('0x47')][_0xcb4f('0x48')]?_0xf4b2e5[_0xcb4f('0x47')]:_0x98052[_0xcb4f('0x41')];if(_0x1e0c20[_0xcb4f('0x42')][_0xcb4f('0x53')]){_0xf4b2e5[_0xcb4f('0x54')]=[{'all':!![]}];}_0xf4b2e5=_[_0xcb4f('0x4f')]({},_0xf4b2e5,_0x1e0c20[_0xcb4f('0x52')]);return db[_0xcb4f('0x3d')]['find'](_0xf4b2e5)[_0xcb4f('0x20')](handleEntityNotFound(_0x8476ea,null))[_0xcb4f('0x20')](respondWithResult(_0x8476ea,null))['catch'](handleError(_0x8476ea,null));};exports[_0xcb4f('0x58')]=function(_0x2d4839,_0x115778,_0x1f1c5c){var _0x52df16;return db[_0xcb4f('0x59')][_0xcb4f('0x5a')](function(_0x514752){return db[_0xcb4f('0x3d')]['create'](_0x2d4839['body'],{'raw':!![]})[_0xcb4f('0x20')](function(_0x5a4a52){_0x52df16=_0x5a4a52;return db[_0xcb4f('0x3d')][_0xcb4f('0x5b')]({'where':{'type':_0x2d4839[_0xcb4f('0x5c')][_0xcb4f('0x5d')]},'raw':!![]});})[_0xcb4f('0x20')](function(_0x1b8db9){if(_0x52df16['type'][_0xcb4f('0x5e')]()==_0xcb4f('0x5f')){var _0x3ece77=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config['root'],_0xcb4f('0x62')),_0xcb4f('0x63'));var _0x58c064=ejs[_0xcb4f('0x64')](_0x3ece77,{'networks':_0x1b8db9||[]});fs[_0xcb4f('0x65')](_0xcb4f('0x66'),_0x58c064);return respondWithRpcPromise(_0xcb4f('0x67'),'create',{'module':_0xcb4f('0x68')});}else if(_0x52df16[_0xcb4f('0x5d')]['toUpperCase']()==_0xcb4f('0x69')){var _0x40ccb0=fs[_0xcb4f('0x60')](path['join'](config[_0xcb4f('0x6a')],'server/files/templates/turn_multiple.ejs'),_0xcb4f('0x63'));var _0x2cb070=ejs[_0xcb4f('0x64')](_0x40ccb0,{'networks':_0x1b8db9||[]});fs[_0xcb4f('0x65')](_0xcb4f('0x6b'),_0x2cb070);return respondWithRpcPromise(_0xcb4f('0x67'),_0xcb4f('0x58'),{'module':_0xcb4f('0x68')});}else{var _0x32f04f=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config[_0xcb4f('0x6a')],_0xcb4f('0x6c')),_0xcb4f('0x63'));var _0x3f565e=ejs['render'](_0x32f04f,{'networks':_0x1b8db9||[]});fs[_0xcb4f('0x65')](util[_0xcb4f('0x6d')](_0xcb4f('0x6e'),_0x2d4839[_0xcb4f('0x5c')][_0xcb4f('0x5d')][_0xcb4f('0x6f')]()),_0x3f565e);return respondWithRpcPromise('Reload',_0xcb4f('0x58'),{'module':_0xcb4f('0x70')});}return null;})[_0xcb4f('0x20')](function(){return _0x52df16;});})[_0xcb4f('0x20')](respondWithResult(_0x115778,0xc9))[_0xcb4f('0x2a')](handleError(_0x115778,null));};exports[_0xcb4f('0x35')]=function(_0x41ceed,_0x10dbfa,_0x727efc){var _0x2a934e;return db['sequelize'][_0xcb4f('0x5a')](function(_0x333def){return db[_0xcb4f('0x3d')][_0xcb4f('0x71')]({'where':{'id':_0x41ceed[_0xcb4f('0x57')]['id']}})[_0xcb4f('0x20')](handleEntityNotFound(_0x10dbfa,null))[_0xcb4f('0x20')](saveUpdates(_0x41ceed[_0xcb4f('0x5c')],null))[_0xcb4f('0x20')](function(_0x45f830){if(_0x45f830){_0x2a934e=_0x45f830;return db['Network'][_0xcb4f('0x5b')]({'where':{'type':_0x2a934e[_0xcb4f('0x5d')]},'raw':!![]});}return null;})[_0xcb4f('0x20')](function(_0xdce18d){if(_0x2a934e[_0xcb4f('0x5d')][_0xcb4f('0x5e')]()=='STUN'){var _0x56f20d=fs[_0xcb4f('0x60')](path['join'](config[_0xcb4f('0x6a')],_0xcb4f('0x62')),_0xcb4f('0x63'));var _0x390aff=ejs['render'](_0x56f20d,{'networks':_0xdce18d||[]});fs[_0xcb4f('0x65')]('/etc/asterisk/stun_xcally.conf',_0x390aff);return respondWithRpcPromise(_0xcb4f('0x67'),_0xcb4f('0x35'),{'module':_0xcb4f('0x68')});}else if(_0x2a934e[_0xcb4f('0x5d')][_0xcb4f('0x5e')]()==_0xcb4f('0x69')){var _0x1e8824=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config[_0xcb4f('0x6a')],_0xcb4f('0x72')),_0xcb4f('0x63'));var _0x35aba4=ejs['render'](_0x1e8824,{'networks':_0xdce18d||[]});fs['writeFileSync'](_0xcb4f('0x6b'),_0x35aba4);return respondWithRpcPromise(_0xcb4f('0x67'),_0xcb4f('0x35'),{'module':_0xcb4f('0x68')});}else{var _0x4fc4fa=fs[_0xcb4f('0x60')](path['join'](config[_0xcb4f('0x6a')],_0xcb4f('0x6c')),_0xcb4f('0x63'));var _0x3bdd8b=ejs[_0xcb4f('0x64')](_0x4fc4fa,{'networks':_0xdce18d||[]});fs[_0xcb4f('0x65')](util[_0xcb4f('0x6d')]('/etc/asterisk/sip_xcally_%s.conf',_0x41ceed[_0xcb4f('0x5c')][_0xcb4f('0x5d')][_0xcb4f('0x6f')]()),_0x3bdd8b);return respondWithRpcPromise(_0xcb4f('0x67'),_0xcb4f('0x35'),{'module':'chan_sip.so'});}return null;})[_0xcb4f('0x20')](function(_0x553203){if(_0x553203){return _0x2a934e;}return null;});})[_0xcb4f('0x20')](respondWithResult(_0x10dbfa,null))[_0xcb4f('0x2a')](handleError(_0x10dbfa,null));};exports[_0xcb4f('0x36')]=function(_0x358898,_0x126697,_0x2e41f3){var _0x1f819e;return db['Network']['find']({'where':{'id':_0x358898[_0xcb4f('0x57')]['id']}})[_0xcb4f('0x20')](function(_0x596a57){_0x1f819e=_0x596a57;return _0x596a57;})['then'](handleEntityNotFound(_0x126697,null))['then'](removeEntity(_0x126697,null))[_0xcb4f('0x20')](function(){if(_0x1f819e){return db[_0xcb4f('0x3d')][_0xcb4f('0x5b')]({'where':{'type':_0x1f819e[_0xcb4f('0x5d')]},'raw':!![]});}})[_0xcb4f('0x20')](function(_0xaddc66){if(_0x1f819e[_0xcb4f('0x5d')][_0xcb4f('0x5e')]()==_0xcb4f('0x5f')){var _0x6898ec=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config[_0xcb4f('0x6a')],_0xcb4f('0x62')),_0xcb4f('0x63'));var _0x5daba4=ejs['render'](_0x6898ec,{'networks':_0xaddc66||[]});fs['writeFileSync'](_0xcb4f('0x66'),_0x5daba4);return respondWithRpcPromise(_0xcb4f('0x67'),_0xcb4f('0x36'),{'module':'res_stun_monitor.so'});}else if(_0x1f819e['type'][_0xcb4f('0x5e')]()==_0xcb4f('0x69')){var _0x13b529=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config[_0xcb4f('0x6a')],'server/files/templates/turn_multiple.ejs'),_0xcb4f('0x63'));var _0x30b5fd=ejs[_0xcb4f('0x64')](_0x13b529,{'networks':_0xaddc66||[]});fs['writeFileSync'](_0xcb4f('0x6b'),_0x30b5fd);return respondWithRpcPromise('Reload',_0xcb4f('0x36'),{'module':_0xcb4f('0x68')});}else{var _0x17765c=fs[_0xcb4f('0x60')](path[_0xcb4f('0x61')](config['root'],_0xcb4f('0x6c')),'utf8');var _0x4f1a25=ejs['render'](_0x17765c,{'networks':_0xaddc66||[]});fs[_0xcb4f('0x65')](util[_0xcb4f('0x6d')](_0xcb4f('0x6e'),_0x358898[_0xcb4f('0x5c')][_0xcb4f('0x5d')][_0xcb4f('0x6f')]()),_0x4f1a25);return respondWithRpcPromise(_0xcb4f('0x67'),'destroy',{'module':_0xcb4f('0x70')});}return null;})[_0xcb4f('0x2a')](handleError(_0x126697,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 127d76f..bc9b3ad 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 _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util'];(function(_0x47d6d2,_0x3a5997){var _0x5dd88a=function(_0x47c979){while(--_0x47c979){_0x47d6d2['push'](_0x47d6d2['shift']());}};_0x5dd88a(++_0x3a5997);}(_0xa8a8,0xec));var _0x8a8a=function(_0x344499,_0x5ecb12){_0x344499=_0x344499-0x0;var _0x2deeef=_0xa8a8[_0x344499];return _0x2deeef;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec56=['define','Network','network','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports'];(function(_0x74a4da,_0x197b50){var _0x476b37=function(_0x43ffd7){while(--_0x43ffd7){_0x74a4da['push'](_0x74a4da['shift']());}};_0x476b37(++_0x197b50);}(_0xec56,0x1bd));var _0x6ec5=function(_0x2c68b5,_0x2bcb6b){_0x2c68b5=_0x2c68b5-0x0;var _0x2676d6=_0xec56[_0x2c68b5];return _0x2676d6;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec5('0x1'));var moment=require(_0x6ec5('0x2'));var BPromise=require(_0x6ec5('0x3'));var rp=require(_0x6ec5('0x4'));var fs=require('fs');var path=require(_0x6ec5('0x5'));var rimraf=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var attributes=require(_0x6ec5('0x8'));module[_0x6ec5('0x9')]=function(_0x28b12b,_0x2d0a93){return _0x28b12b[_0x6ec5('0xa')](_0x6ec5('0xb'),attributes,{'tableName':_0x6ec5('0xc'),'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 357ba7f..9554d4d 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 _0x335e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x335e,0xb3));var _0xe335=function(_0x34e25c,_0x142eb9){_0x34e25c=_0x34e25c-0x0;var _0xeceeba=_0x335e[_0x34e25c];return _0xeceeba;};'use strict';var _=require(_0xe335('0x0'));var util=require(_0xe335('0x1'));var moment=require(_0xe335('0x2'));var BPromise=require(_0xe335('0x3'));var rs=require(_0xe335('0x4'));var fs=require('fs');var Redis=require(_0xe335('0x5'));var db=require(_0xe335('0x6'))['db'];var utils=require(_0xe335('0x7'));var logger=require(_0xe335('0x8'))(_0xe335('0x9'));var config=require('../../config/environment');var jayson=require(_0xe335('0xa'));var client=jayson[_0xe335('0xb')][_0xe335('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cece6,_0x56ace3,_0x29f436){return new BPromise(function(_0x587a9c,_0x5ecf50){return client[_0xe335('0xd')](_0x2cece6,_0x29f436)[_0xe335('0xe')](function(_0x43fb93){logger[_0xe335('0xf')](_0xe335('0x10'),_0x56ace3,_0xe335('0x11'));logger[_0xe335('0x12')](_0xe335('0x13'),_0x56ace3,_0xe335('0x11'),JSON[_0xe335('0x14')](_0x43fb93));if(_0x43fb93[_0xe335('0x15')]){if(_0x43fb93[_0xe335('0x15')]['code']===0x1f4){logger[_0xe335('0x15')](_0xe335('0x10'),_0x56ace3,_0x43fb93['error']['message']);return _0x5ecf50(_0x43fb93['error'][_0xe335('0x16')]);}logger[_0xe335('0x15')](_0xe335('0x10'),_0x56ace3,_0x43fb93[_0xe335('0x15')][_0xe335('0x16')]);return _0x587a9c(_0x43fb93[_0xe335('0x15')][_0xe335('0x16')]);}else{logger[_0xe335('0xf')](_0xe335('0x10'),_0x56ace3,_0xe335('0x11'));_0x587a9c(_0x43fb93['result']['message']);}})['catch'](function(_0x448653){logger[_0xe335('0x15')](_0xe335('0x10'),_0x56ace3,_0x448653);_0x5ecf50(_0x448653);});});} \ No newline at end of file +var _0xafa4=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1abf3f,_0x532059){var _0x53da2b=function(_0xec0c1d){while(--_0xec0c1d){_0x1abf3f['push'](_0x1abf3f['shift']());}};_0x53da2b(++_0x532059);}(_0xafa4,0x1ca));var _0x4afa=function(_0x743621,_0x5860ef){_0x743621=_0x743621-0x0;var _0x540c4b=_0xafa4[_0x743621];return _0x540c4b;};'use strict';var _=require(_0x4afa('0x0'));var util=require(_0x4afa('0x1'));var moment=require(_0x4afa('0x2'));var BPromise=require(_0x4afa('0x3'));var rs=require(_0x4afa('0x4'));var fs=require('fs');var Redis=require(_0x4afa('0x5'));var db=require(_0x4afa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4afa('0x7'))('rpc');var config=require(_0x4afa('0x8'));var jayson=require(_0x4afa('0x9'));var client=jayson[_0x4afa('0xa')][_0x4afa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x205840,_0x39df22,_0x5b5d65){return new BPromise(function(_0xf46be9,_0xd2d49c){return client[_0x4afa('0xc')](_0x205840,_0x5b5d65)['then'](function(_0x543203){logger[_0x4afa('0xd')](_0x4afa('0xe'),_0x39df22,_0x4afa('0xf'));logger['debug'](_0x4afa('0x10'),_0x39df22,'request\x20sent',JSON[_0x4afa('0x11')](_0x543203));if(_0x543203[_0x4afa('0x12')]){if(_0x543203[_0x4afa('0x12')]['code']===0x1f4){logger[_0x4afa('0x12')]('Network,\x20%s,\x20%s',_0x39df22,_0x543203[_0x4afa('0x12')]['message']);return _0xd2d49c(_0x543203[_0x4afa('0x12')][_0x4afa('0x13')]);}logger['error'](_0x4afa('0xe'),_0x39df22,_0x543203[_0x4afa('0x12')][_0x4afa('0x13')]);return _0xf46be9(_0x543203['error'][_0x4afa('0x13')]);}else{logger[_0x4afa('0xd')]('Network,\x20%s,\x20%s',_0x39df22,_0x4afa('0xf'));_0xf46be9(_0x543203[_0x4afa('0x14')][_0x4afa('0x13')]);}})[_0x4afa('0x15')](function(_0x3b6fdf){logger['error'](_0x4afa('0xe'),_0x39df22,_0x3b6fdf);_0xd2d49c(_0x3b6fdf);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 5c22d0d..d7b20ce 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 _0xbf75=['connect-timeout','Router','../../config/environment','post','sendNotification','exports','multer','util'];(function(_0x5ede1a,_0x51e4d0){var _0x9b0761=function(_0x3cf50b){while(--_0x3cf50b){_0x5ede1a['push'](_0x5ede1a['shift']());}};_0x9b0761(++_0x51e4d0);}(_0xbf75,0x166));var _0x5bf7=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xbf75[_0x23e7c1];return _0x1add43;};'use strict';var multer=require(_0x5bf7('0x0'));var util=require(_0x5bf7('0x1'));var path=require('path');var timeout=require(_0x5bf7('0x2'));var express=require('express');var router=express[_0x5bf7('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5bf7('0x4'));var controller=require('./notification.controller');router[_0x5bf7('0x5')]('/',auth['isAuthenticated'](),controller[_0x5bf7('0x6')]);module[_0x5bf7('0x7')]=router; \ No newline at end of file +var _0x37aa=['post','sendNotification','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller'];(function(_0x4a114b,_0x2b8574){var _0x293d37=function(_0x1cf096){while(--_0x1cf096){_0x4a114b['push'](_0x4a114b['shift']());}};_0x293d37(++_0x2b8574);}(_0x37aa,0xcf));var _0xa37a=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0x37aa[_0x2c2980];return _0x2a20a9;};'use strict';var multer=require('multer');var util=require(_0xa37a('0x0'));var path=require(_0xa37a('0x1'));var timeout=require(_0xa37a('0x2'));var express=require(_0xa37a('0x3'));var router=express[_0xa37a('0x4')]();var auth=require(_0xa37a('0x5'));var interaction=require(_0xa37a('0x6'));var config=require(_0xa37a('0x7'));var controller=require(_0xa37a('0x8'));router[_0xa37a('0x9')]('/',auth['isAuthenticated'](),controller[_0xa37a('0xa')]);module[_0xa37a('0xb')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 71ac665..eaa9cd9 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 _0xb733=['TEXT','STRING','sequelize','exports'];(function(_0x184cc6,_0x4961ee){var _0x3f7435=function(_0x448fed){while(--_0x448fed){_0x184cc6['push'](_0x184cc6['shift']());}};_0x3f7435(++_0x4961ee);}(_0xb733,0xe6));var _0x3b73=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb733[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x3b73('0x0'));module[_0x3b73('0x1')]={'body':{'type':Sequelize[_0x3b73('0x2')]},'senderName':{'type':Sequelize[_0x3b73('0x3')]},'recipientsId':{'type':Sequelize[_0x3b73('0x2')]},'recipientsDescription':{'type':Sequelize[_0x3b73('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x6e3a=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x3ea778,_0x2bde3a){var _0x83d46d=function(_0x30cef3){while(--_0x30cef3){_0x3ea778['push'](_0x3ea778['shift']());}};_0x83d46d(++_0x2bde3a);}(_0x6e3a,0x13c));var _0xa6e3=function(_0x2211cd,_0xa8741c){_0x2211cd=_0x2211cd-0x0;var _0x49a339=_0x6e3a[_0x2211cd];return _0x49a339;};'use strict';var Sequelize=require(_0xa6e3('0x0'));module[_0xa6e3('0x1')]={'body':{'type':Sequelize[_0xa6e3('0x2')]},'senderName':{'type':Sequelize[_0xa6e3('0x3')]},'recipientsId':{'type':Sequelize[_0xa6e3('0x2')]},'recipientsDescription':{'type':Sequelize[_0xa6e3('0x3')]},'beep':{'type':Sequelize[_0xa6e3('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index ecd6f7c..e49e9b4 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 _0xb4ff=['push','all','union','flatten','getAgents','map','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','sendNotification','hasOwnProperty','text','body','TemplateId','ValidationError','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','Notification','create','forEach','recipient','notification:send','catch','Template','findOne','html','startCase','model','replace','Queue','ids'];(function(_0x521d9b,_0x4fa607){var _0x22eecc=function(_0x245e28){while(--_0x245e28){_0x521d9b['push'](_0x521d9b['shift']());}};_0x22eecc(++_0x4fa607);}(_0xb4ff,0x6c));var _0xfb4f=function(_0x22c1ae,_0xa0db40){_0x22c1ae=_0x22c1ae-0x0;var _0x2ccdac=_0xb4ff[_0x22c1ae];return _0x2ccdac;};'use strict';var pdf=require(_0xfb4f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfb4f('0x1'));var zipdir=require(_0xfb4f('0x2'));var jsonpatch=require(_0xfb4f('0x3'));var rp=require(_0xfb4f('0x4'));var moment=require(_0xfb4f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfb4f('0x6'));var util=require(_0xfb4f('0x7'));var path=require(_0xfb4f('0x8'));var sox=require('sox');var csv=require(_0xfb4f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb4f('0xa'));var squel=require(_0xfb4f('0xb'));var crypto=require(_0xfb4f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfb4f('0xd'));var toCsv=require(_0xfb4f('0x9'));var querystring=require(_0xfb4f('0xe'));var Papa=require(_0xfb4f('0xf'));var Redis=require(_0xfb4f('0x10'));var authService=require(_0xfb4f('0x11'));var qs=require(_0xfb4f('0x12'));var as=require(_0xfb4f('0x13'));var hardwareService=require(_0xfb4f('0x14'));var logger=require(_0xfb4f('0x15'))(_0xfb4f('0x16'));var utils=require('../../config/utils');var config=require(_0xfb4f('0x17'));var db=require(_0xfb4f('0x18'))['db'];config[_0xfb4f('0x19')]=_[_0xfb4f('0x1a')](config[_0xfb4f('0x19')],{'host':_0xfb4f('0x1b'),'port':0x18eb});var socket=require(_0xfb4f('0x1c'))(new Redis(config[_0xfb4f('0x19')]));require(_0xfb4f('0x1d'))[_0xfb4f('0x1e')](socket);function respondWithStatusCode(_0x73ed96,_0x453466){_0x453466=_0x453466||0xcc;return function(_0x3af07f){if(_0x3af07f){return _0x73ed96['sendStatus'](_0x453466);}return _0x73ed96[_0xfb4f('0x1f')](_0x453466)[_0xfb4f('0x20')]();};}function respondWithResult(_0x17ecbf,_0x1d674e){_0x1d674e=_0x1d674e||0xc8;return function(_0x59c8d7){if(_0x59c8d7){return _0x17ecbf[_0xfb4f('0x1f')](_0x1d674e)[_0xfb4f('0x21')](_0x59c8d7);}};}function respondWithFilteredResult(_0x16ef28,_0x3fd0bf){return function(_0x4cbf62){if(_0x4cbf62){var _0x265388=_0x4cbf62[_0xfb4f('0x22')],_0x1a45ee=_0x3fd0bf[_0xfb4f('0x23')],_0x39ff56=_0x3fd0bf[_0xfb4f('0x23')]+_0x3fd0bf[_0xfb4f('0x24')],_0x177d29;if(_0x39ff56>=_0x265388){_0x39ff56=_0x265388;_0x177d29=0xc8;}else{_0x177d29=0xce;}_0x16ef28[_0xfb4f('0x1f')](_0x177d29);return _0x16ef28[_0xfb4f('0x25')](_0xfb4f('0x26'),_0x1a45ee+'-'+_0x39ff56+'/'+_0x265388)[_0xfb4f('0x21')](_0x4cbf62);}return null;};}function patchUpdates(_0x31624c){return function(_0x5f167d){try{jsonpatch[_0xfb4f('0x27')](_0x5f167d,_0x31624c,!![]);}catch(_0x5e4c04){return BPromise[_0xfb4f('0x28')](_0x5e4c04);}return _0x5f167d[_0xfb4f('0x29')]();};}function saveUpdates(_0x228fcc,_0x28e1fc){return function(_0x4a77d1){if(_0x4a77d1){return _0x4a77d1[_0xfb4f('0x2a')](_0x228fcc)['then'](function(_0x489be4){return _0x489be4;});}return null;};}function removeEntity(_0x45c64a,_0x4e0c98){return function(_0x345ab3){if(_0x345ab3){return _0x345ab3[_0xfb4f('0x2b')]()[_0xfb4f('0x2c')](function(){_0x45c64a[_0xfb4f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x81ef94,_0x11668c){return function(_0x2ccacf){if(!_0x2ccacf){_0x81ef94[_0xfb4f('0x2d')](0x194);}return _0x2ccacf;};}function handleError(_0x1e8745,_0x1c36b4){_0x1c36b4=_0x1c36b4||0x1f4;return function(_0x1b521d){logger[_0xfb4f('0x2e')](_0x1b521d[_0xfb4f('0x2f')]);if(_0x1b521d[_0xfb4f('0x30')]){delete _0x1b521d[_0xfb4f('0x30')];}_0x1e8745[_0xfb4f('0x1f')](_0x1c36b4)[_0xfb4f('0x31')](_0x1b521d);};}exports[_0xfb4f('0x32')]=function(_0x483f16,_0x116e9c,_0x524612){if(!_0x483f16['body'][_0xfb4f('0x33')](_0xfb4f('0x34'))&&!_0x483f16[_0xfb4f('0x35')][_0xfb4f('0x33')](_0xfb4f('0x36'))){throw new db['Sequelize'][(_0xfb4f('0x37'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x483f16[_0xfb4f('0x35')][_0xfb4f('0x33')](_0xfb4f('0x36'))&&!_0x483f16[_0xfb4f('0x35')][_0xfb4f('0x33')](_0xfb4f('0x38'))){throw new db[(_0xfb4f('0x39'))][(_0xfb4f('0x37'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x483f16['body'][_0xfb4f('0x33')](_0xfb4f('0x3a'))){throw new db[(_0xfb4f('0x39'))][(_0xfb4f('0x37'))](_0xfb4f('0x3b'));}else{try{var _0x21ce14=JSON['parse'](_0x483f16['body'][_0xfb4f('0x3a')]);}catch(_0xd04907){logger[_0xfb4f('0x2e')](_0xd04907);throw new db[(_0xfb4f('0x39'))][(_0xfb4f('0x37'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x3aa88e=[_0xfb4f('0x3c'),_0xfb4f('0x3d'),_0xfb4f('0x3e'),_0xfb4f('0x3f'),'smsqueue',_0xfb4f('0x40'),'whatsappqueue',_0xfb4f('0x41'),_0xfb4f('0x42')];if(_[_0xfb4f('0x43')](_0x21ce14,function(_0x285c5f){return!_[_0xfb4f('0x44')](_0x3aa88e,_0x285c5f['model'][_0xfb4f('0x45')]());})){throw new db[(_0xfb4f('0x39'))][(_0xfb4f('0x37'))](_0xfb4f('0x46'));}}}var _0x5106f1={};_0x5106f1['senderName']=_0x483f16[_0xfb4f('0x35')][_0xfb4f('0x33')](_0xfb4f('0x47'))?_0x483f16[_0xfb4f('0x35')][_0xfb4f('0x47')]:_0x483f16[_0xfb4f('0x42')][_0xfb4f('0x48')];_0x5106f1[_0xfb4f('0x49')]=_[_0xfb4f('0x4a')](_0x483f16[_0xfb4f('0x35')][_0xfb4f('0x49')])?null:_0x483f16[_0xfb4f('0x35')][_0xfb4f('0x49')];_0x5106f1[_0xfb4f('0x4b')]=_0x483f16[_0xfb4f('0x35')][_0xfb4f('0x4b')]||![];_0x5106f1[_0xfb4f('0x4c')]=_0x483f16[_0xfb4f('0x42')]['id'];return getContent(_0x483f16[_0xfb4f('0x35')])[_0xfb4f('0x2c')](function(_0xe257d9){_0x5106f1[_0xfb4f('0x35')]=_0xe257d9;return getRecipients(_0x21ce14);})['then'](function(_0x5ec32a){_0x5106f1[_0xfb4f('0x4d')]=_[_0xfb4f('0x4e')](_0x5ec32a)[_0xfb4f('0x4f')](',');return db[_0xfb4f('0x50')][_0xfb4f('0x51')](function(_0x1ace02){return db[_0xfb4f('0x52')][_0xfb4f('0x53')](_0x5106f1,{'raw':!![],'transaction':_0x1ace02})[_0xfb4f('0x2c')](function(_0x371220){var _0x16691d={'sender':_0x5106f1[_0xfb4f('0x47')],'description':_0x5106f1['recipientsDescription'],'content':_0x5106f1[_0xfb4f('0x35')],'beep':_0x5106f1['beep']};_0x5ec32a[_0xfb4f('0x54')](function(_0x4491e1){_0x16691d[_0xfb4f('0x55')]=_0x4491e1;socket['emit'](_0xfb4f('0x56'),_0x16691d);});return _0x371220;});});})[_0xfb4f('0x2c')](respondWithResult(_0x116e9c,0xc9))[_0xfb4f('0x57')](handleError(_0x116e9c,null));};function getContent(_0x28db42){return new BPromise(function(_0x4b5309,_0x13a1e4){if(_0x28db42[_0xfb4f('0x34')]){_0x4b5309(_0x28db42['text']);return;}return db[_0xfb4f('0x58')][_0xfb4f('0x59')]({'attributes':[_0xfb4f('0x5a')],'where':{'id':_0x28db42[_0xfb4f('0x36')]},'raw':!![]})['then'](function(_0x85699a){if(!_0x85699a)throw new db[(_0xfb4f('0x39'))][(_0xfb4f('0x37'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x19e895=Mustache['render'](_0x85699a['html'],_0x28db42[_0xfb4f('0x38')]);_0x4b5309(_0x19e895);})[_0xfb4f('0x57')](function(_0x1688a3){_0x13a1e4(_0x1688a3);});});}function getRecipients(_0x2dd7a6){return new BPromise(function(_0x1dbfc9,_0x164b1d){var _0x420ab0=[];var _0x60bd3f=[];_0x2dd7a6[_0xfb4f('0x54')](function(_0x486b56){var _0x33a0ab=_[_0xfb4f('0x5b')](_0x486b56[_0xfb4f('0x5c')][_0xfb4f('0x45')]());if(_0x33a0ab==='User'){_0x420ab0=_['union'](_0x420ab0,_0x486b56['ids']);}else{if(_[_0xfb4f('0x44')](_0x33a0ab,'queue'))_0x33a0ab=_0x33a0ab[_0xfb4f('0x5d')]('queue',_0xfb4f('0x5e'));_0x486b56[_0xfb4f('0x5f')][_0xfb4f('0x54')](function(_0x4773f3){_0x60bd3f[_0xfb4f('0x60')](getAgents(_0x33a0ab,_0x4773f3));});}});return BPromise[_0xfb4f('0x61')](_0x60bd3f)[_0xfb4f('0x2c')](function(_0x1cd8f2){_0x420ab0=_[_0xfb4f('0x62')](_0x420ab0,_[_0xfb4f('0x63')](_0x1cd8f2));_0x1dbfc9(_0x420ab0);})[_0xfb4f('0x57')](function(_0x306c2f){_0x164b1d(_0x306c2f);});});}function getAgents(_0x434459,_0x1cf4e3){return new BPromise(function(_0x4944bf,_0x223975){return db[_0x434459][_0xfb4f('0x59')]({'where':{'id':_0x1cf4e3}})[_0xfb4f('0x2c')](function(_0xae7600){return _0xae7600[_0xfb4f('0x64')]({'attributes':['id'],'raw':!![]})['then'](function(_0xba2d30){var _0x253589=_[_0xfb4f('0x65')](_0xba2d30,'id');_0x4944bf(_0x253589);});})[_0xfb4f('0x57')](function(_0x36559e){_0x223975(_0x36559e);});});} \ No newline at end of file +var _0x285e=['whatsappqueue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','Notification','create','forEach','emit','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','startCase','User','ids','queue','Queue','push','union','flatten','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','openchannelqueue','smsqueue'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x285e,0x79));var _0xe285=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x285e[_0x4a53d];return _0x27410e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe285('0x0'));var rimraf=require(_0xe285('0x1'));var zipdir=require(_0xe285('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe285('0x3'));var moment=require(_0xe285('0x4'));var BPromise=require(_0xe285('0x5'));var Mustache=require(_0xe285('0x6'));var util=require(_0xe285('0x7'));var path=require(_0xe285('0x8'));var sox=require('sox');var csv=require(_0xe285('0x9'));var ejs=require(_0xe285('0xa'));var fs=require('fs');var _=require(_0xe285('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe285('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe285('0x9'));var querystring=require(_0xe285('0xd'));var Papa=require(_0xe285('0xe'));var Redis=require(_0xe285('0xf'));var authService=require(_0xe285('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe285('0x11'));var utils=require(_0xe285('0x12'));var config=require('../../config/environment');var db=require(_0xe285('0x13'))['db'];config[_0xe285('0x14')]=_[_0xe285('0x15')](config[_0xe285('0x14')],{'host':_0xe285('0x16'),'port':0x18eb});var socket=require(_0xe285('0x17'))(new Redis(config[_0xe285('0x14')]));require('./notification.socket')[_0xe285('0x18')](socket);function respondWithStatusCode(_0x229ea6,_0x3186d0){_0x3186d0=_0x3186d0||0xcc;return function(_0x3601b5){if(_0x3601b5){return _0x229ea6[_0xe285('0x19')](_0x3186d0);}return _0x229ea6[_0xe285('0x1a')](_0x3186d0)[_0xe285('0x1b')]();};}function respondWithResult(_0x271e4a,_0x801d48){_0x801d48=_0x801d48||0xc8;return function(_0x119eef){if(_0x119eef){return _0x271e4a['status'](_0x801d48)[_0xe285('0x1c')](_0x119eef);}};}function respondWithFilteredResult(_0x29d17f,_0x18eaeb){return function(_0x499ea9){if(_0x499ea9){var _0x5c4e33=_0x499ea9[_0xe285('0x1d')],_0x4106de=_0x18eaeb[_0xe285('0x1e')],_0x2eec21=_0x18eaeb['offset']+_0x18eaeb[_0xe285('0x1f')],_0x4334c3;if(_0x2eec21>=_0x5c4e33){_0x2eec21=_0x5c4e33;_0x4334c3=0xc8;}else{_0x4334c3=0xce;}_0x29d17f[_0xe285('0x1a')](_0x4334c3);return _0x29d17f[_0xe285('0x20')](_0xe285('0x21'),_0x4106de+'-'+_0x2eec21+'/'+_0x5c4e33)['json'](_0x499ea9);}return null;};}function patchUpdates(_0x4dd873){return function(_0x41c2ff){try{jsonpatch[_0xe285('0x22')](_0x41c2ff,_0x4dd873,!![]);}catch(_0x3e9472){return BPromise['reject'](_0x3e9472);}return _0x41c2ff[_0xe285('0x23')]();};}function saveUpdates(_0x487eb7,_0x20ba9d){return function(_0x1d715a){if(_0x1d715a){return _0x1d715a[_0xe285('0x24')](_0x487eb7)[_0xe285('0x25')](function(_0x4c88ae){return _0x4c88ae;});}return null;};}function removeEntity(_0x250cef,_0x2f157b){return function(_0x2dc565){if(_0x2dc565){return _0x2dc565[_0xe285('0x26')]()[_0xe285('0x25')](function(){_0x250cef['status'](0xcc)[_0xe285('0x1b')]();});}};}function handleEntityNotFound(_0x1b9fcf,_0x1d2854){return function(_0x4b3dfb){if(!_0x4b3dfb){_0x1b9fcf[_0xe285('0x19')](0x194);}return _0x4b3dfb;};}function handleError(_0x43cafb,_0x2a4c32){_0x2a4c32=_0x2a4c32||0x1f4;return function(_0x25a9c2){logger[_0xe285('0x27')](_0x25a9c2['stack']);if(_0x25a9c2[_0xe285('0x28')]){delete _0x25a9c2[_0xe285('0x28')];}_0x43cafb[_0xe285('0x1a')](_0x2a4c32)['send'](_0x25a9c2);};}exports[_0xe285('0x29')]=function(_0x5118ac,_0x464206,_0x69e507){if(!_0x5118ac[_0xe285('0x2a')][_0xe285('0x2b')](_0xe285('0x2c'))&&!_0x5118ac[_0xe285('0x2a')]['hasOwnProperty'](_0xe285('0x2d'))){throw new db[(_0xe285('0x2e'))][(_0xe285('0x2f'))](_0xe285('0x30'));}else{if(_0x5118ac[_0xe285('0x2a')]['hasOwnProperty'](_0xe285('0x2d'))&&!_0x5118ac[_0xe285('0x2a')][_0xe285('0x2b')](_0xe285('0x31'))){throw new db[(_0xe285('0x2e'))][(_0xe285('0x2f'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x5118ac['body'][_0xe285('0x2b')](_0xe285('0x32'))){throw new db[(_0xe285('0x2e'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x9d8199=JSON['parse'](_0x5118ac['body'][_0xe285('0x32')]);}catch(_0x43b395){logger['error'](_0x43b395);throw new db[(_0xe285('0x2e'))][(_0xe285('0x2f'))](_0xe285('0x33'));}var _0x495cc=['chatqueue',_0xe285('0x34'),'mailqueue',_0xe285('0x35'),_0xe285('0x36'),'voicequeue',_0xe285('0x37'),'team',_0xe285('0x38')];if(_['some'](_0x9d8199,function(_0x43c480){return!_[_0xe285('0x39')](_0x495cc,_0x43c480[_0xe285('0x3a')][_0xe285('0x3b')]());})){throw new db[(_0xe285('0x2e'))][(_0xe285('0x2f'))](_0xe285('0x3c'));}}}var _0x256cc7={};_0x256cc7[_0xe285('0x3d')]=_0x5118ac[_0xe285('0x2a')]['hasOwnProperty'](_0xe285('0x3d'))?_0x5118ac[_0xe285('0x2a')][_0xe285('0x3d')]:_0x5118ac[_0xe285('0x38')]['fullname'];_0x256cc7[_0xe285('0x3e')]=_[_0xe285('0x3f')](_0x5118ac['body'][_0xe285('0x3e')])?null:_0x5118ac[_0xe285('0x2a')][_0xe285('0x3e')];_0x256cc7[_0xe285('0x40')]=_0x5118ac[_0xe285('0x2a')][_0xe285('0x40')]||![];_0x256cc7[_0xe285('0x41')]=_0x5118ac[_0xe285('0x38')]['id'];return getContent(_0x5118ac[_0xe285('0x2a')])[_0xe285('0x25')](function(_0x502455){_0x256cc7[_0xe285('0x2a')]=_0x502455;return getRecipients(_0x9d8199);})[_0xe285('0x25')](function(_0x44767a){_0x256cc7['recipientsId']=_[_0xe285('0x42')](_0x44767a)[_0xe285('0x43')](',');return db[_0xe285('0x44')]['transaction'](function(_0x2fe694){return db[_0xe285('0x45')][_0xe285('0x46')](_0x256cc7,{'raw':!![],'transaction':_0x2fe694})['then'](function(_0x22add7){var _0x65a314={'sender':_0x256cc7[_0xe285('0x3d')],'description':_0x256cc7[_0xe285('0x3e')],'content':_0x256cc7['body'],'beep':_0x256cc7[_0xe285('0x40')]};_0x44767a[_0xe285('0x47')](function(_0x31b9f7){_0x65a314['recipient']=_0x31b9f7;socket[_0xe285('0x48')]('notification:send',_0x65a314);});return _0x22add7;});});})[_0xe285('0x25')](respondWithResult(_0x464206,0xc9))[_0xe285('0x49')](handleError(_0x464206,null));};function getContent(_0x39c202){return new BPromise(function(_0x26de72,_0x1eb57a){if(_0x39c202[_0xe285('0x2c')]){_0x26de72(_0x39c202[_0xe285('0x2c')]);return;}return db[_0xe285('0x4a')][_0xe285('0x4b')]({'attributes':['html'],'where':{'id':_0x39c202['TemplateId']},'raw':!![]})[_0xe285('0x25')](function(_0x1657d7){if(!_0x1657d7)throw new db[(_0xe285('0x2e'))][(_0xe285('0x2f'))](_0xe285('0x4c'));var _0x450150=Mustache['render'](_0x1657d7[_0xe285('0x4d')],_0x39c202[_0xe285('0x31')]);_0x26de72(_0x450150);})[_0xe285('0x49')](function(_0x2334c2){_0x1eb57a(_0x2334c2);});});}function getRecipients(_0x29078f){return new BPromise(function(_0xe43022,_0x21c7ef){var _0x4d8a9f=[];var _0x3b5620=[];_0x29078f[_0xe285('0x47')](function(_0x1a9a50){var _0x1f3f5e=_[_0xe285('0x4e')](_0x1a9a50[_0xe285('0x3a')][_0xe285('0x3b')]());if(_0x1f3f5e===_0xe285('0x4f')){_0x4d8a9f=_['union'](_0x4d8a9f,_0x1a9a50[_0xe285('0x50')]);}else{if(_[_0xe285('0x39')](_0x1f3f5e,_0xe285('0x51')))_0x1f3f5e=_0x1f3f5e['replace'](_0xe285('0x51'),_0xe285('0x52'));_0x1a9a50['ids'][_0xe285('0x47')](function(_0x5f5d5c){_0x3b5620[_0xe285('0x53')](getAgents(_0x1f3f5e,_0x5f5d5c));});}});return BPromise['all'](_0x3b5620)[_0xe285('0x25')](function(_0xc610a5){_0x4d8a9f=_[_0xe285('0x54')](_0x4d8a9f,_[_0xe285('0x55')](_0xc610a5));_0xe43022(_0x4d8a9f);})[_0xe285('0x49')](function(_0x6c0f2f){_0x21c7ef(_0x6c0f2f);});});}function getAgents(_0xd1c898,_0x230420){return new BPromise(function(_0x29256d,_0xac5b6){return db[_0xd1c898][_0xe285('0x4b')]({'where':{'id':_0x230420}})[_0xe285('0x25')](function(_0x1a2d98){return _0x1a2d98[_0xe285('0x56')]({'attributes':['id'],'raw':!![]})[_0xe285('0x25')](function(_0x1f1135){var _0x399149=_[_0xe285('0x57')](_0x1f1135,'id');_0x29256d(_0x399149);});})[_0xe285('0x49')](function(_0x5a0147){_0xac5b6(_0x5a0147);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 7b3c4bb..d684b15 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x383ba8,_0x2c13c8){var _0x7b8cf6=function(_0x3cd829){while(--_0x3cd829){_0x383ba8['push'](_0x383ba8['shift']());}};_0x7b8cf6(++_0x2c13c8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x74b300,_0x1f13c2){var _0x5ae816=function(_0x14b63a){while(--_0x14b63a){_0x74b300['push'](_0x74b300['shift']());}};_0x5ae816(++_0x1f13c2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'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 b2d1ca6..82a868a 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 _0xe605=['exports','define','notifications','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./notification.attributes'];(function(_0xd50eea,_0xa69d90){var _0x34fbe8=function(_0x5b2ebb){while(--_0x5b2ebb){_0xd50eea['push'](_0xd50eea['shift']());}};_0x34fbe8(++_0xa69d90);}(_0xe605,0x92));var _0x5e60=function(_0x2a55e4,_0x340e31){_0x2a55e4=_0x2a55e4-0x0;var _0x4f3539=_0xe605[_0x2a55e4];return _0x4f3539;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var logger=require('../../config/logger')(_0x5e60('0x2'));var moment=require(_0x5e60('0x3'));var BPromise=require(_0x5e60('0x4'));var rp=require(_0x5e60('0x5'));var fs=require('fs');var path=require(_0x5e60('0x6'));var rimraf=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var attributes=require(_0x5e60('0x9'));module[_0x5e60('0xa')]=function(_0xc41535,_0x1d4a08){return _0xc41535[_0x5e60('0xb')]('Notification',attributes,{'tableName':_0x5e60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x757a=['./notification.attributes','exports','define','notifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x5b9cfd,_0x163d05){var _0x367f99=function(_0x4fe6ff){while(--_0x4fe6ff){_0x5b9cfd['push'](_0x5b9cfd['shift']());}};_0x367f99(++_0x163d05);}(_0x757a,0xde));var _0xa757=function(_0x4bc83f,_0x4ae958){_0x4bc83f=_0x4bc83f-0x0;var _0x9703d5=_0x757a[_0x4bc83f];return _0x9703d5;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('Notification',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa757('0xa'),'collate':_0xa757('0xb')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index c8df839..acd56e1 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 _0x12a4=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','redis','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x17558f,_0x42f9f5){var _0x4a81a5=function(_0x14ec0a){while(--_0x14ec0a){_0x17558f['push'](_0x17558f['shift']());}};_0x4a81a5(++_0x42f9f5);}(_0x12a4,0xef));var _0x412a=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0x12a4[_0x2fe689];return _0x35ea44;};'use strict';var _=require(_0x412a('0x0'));var util=require(_0x412a('0x1'));var moment=require(_0x412a('0x2'));var BPromise=require(_0x412a('0x3'));var rs=require(_0x412a('0x4'));var fs=require('fs');var Redis=require(_0x412a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x412a('0x6'));var logger=require(_0x412a('0x7'))(_0x412a('0x8'));var config=require(_0x412a('0x9'));var jayson=require(_0x412a('0xa'));var client=jayson[_0x412a('0xb')][_0x412a('0xc')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x412a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x412a('0xe')]));require(_0x412a('0xf'))[_0x412a('0x10')](socket);function respondWithRpcPromise(_0x36bf7d,_0x3038ac,_0x16f716){return new BPromise(function(_0xf1bc45,_0x930f15){return client[_0x412a('0x11')](_0x36bf7d,_0x16f716)[_0x412a('0x12')](function(_0x4bfd68){logger[_0x412a('0x13')](_0x412a('0x14'),_0x3038ac,_0x412a('0x15'));logger['debug'](_0x412a('0x16'),_0x3038ac,_0x412a('0x15'),JSON[_0x412a('0x17')](_0x4bfd68));if(_0x4bfd68[_0x412a('0x18')]){if(_0x4bfd68[_0x412a('0x18')]['code']===0x1f4){logger[_0x412a('0x18')](_0x412a('0x14'),_0x3038ac,_0x4bfd68[_0x412a('0x18')][_0x412a('0x19')]);return _0x930f15(_0x4bfd68[_0x412a('0x18')][_0x412a('0x19')]);}logger[_0x412a('0x18')](_0x412a('0x14'),_0x3038ac,_0x4bfd68['error'][_0x412a('0x19')]);return _0xf1bc45(_0x4bfd68['error'][_0x412a('0x19')]);}else{logger[_0x412a('0x13')]('Notification,\x20%s,\x20%s',_0x3038ac,_0x412a('0x15'));_0xf1bc45(_0x4bfd68[_0x412a('0x1a')][_0x412a('0x19')]);}})['catch'](function(_0x2db984){logger['error']('Notification,\x20%s,\x20%s',_0x3038ac,_0x2db984);_0x930f15(_0x2db984);});});} \ No newline at end of file +var _0xb8cc=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./notification.socket','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2c4d04,_0x52712a){var _0x5997f8=function(_0x919cc5){while(--_0x919cc5){_0x2c4d04['push'](_0x2c4d04['shift']());}};_0x5997f8(++_0x52712a);}(_0xb8cc,0x159));var _0xcb8c=function(_0x1f3774,_0x48d33c){_0x1f3774=_0x1f3774-0x0;var _0x2ee281=_0xb8cc[_0x1f3774];return _0x2ee281;};'use strict';var _=require('lodash');var util=require(_0xcb8c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb8c('0x1'));var db=require(_0xcb8c('0x2'))['db'];var utils=require(_0xcb8c('0x3'));var logger=require('../../config/logger')(_0xcb8c('0x4'));var config=require(_0xcb8c('0x5'));var jayson=require(_0xcb8c('0x6'));var client=jayson[_0xcb8c('0x7')][_0xcb8c('0x8')]({'port':0x232a});config['redis']=_[_0xcb8c('0x9')](config[_0xcb8c('0xa')],{'host':_0xcb8c('0xb'),'port':0x18eb});var socket=require(_0xcb8c('0xc'))(new Redis(config[_0xcb8c('0xa')]));require(_0xcb8c('0xd'))['register'](socket);function respondWithRpcPromise(_0x1ead3f,_0x46ee58,_0x49722a){return new BPromise(function(_0x2fe5de,_0x59e3fc){return client[_0xcb8c('0xe')](_0x1ead3f,_0x49722a)[_0xcb8c('0xf')](function(_0x145a26){logger[_0xcb8c('0x10')](_0xcb8c('0x11'),_0x46ee58,_0xcb8c('0x12'));logger[_0xcb8c('0x13')](_0xcb8c('0x14'),_0x46ee58,'request\x20sent',JSON[_0xcb8c('0x15')](_0x145a26));if(_0x145a26[_0xcb8c('0x16')]){if(_0x145a26[_0xcb8c('0x16')][_0xcb8c('0x17')]===0x1f4){logger[_0xcb8c('0x16')](_0xcb8c('0x11'),_0x46ee58,_0x145a26['error'][_0xcb8c('0x18')]);return _0x59e3fc(_0x145a26[_0xcb8c('0x16')][_0xcb8c('0x18')]);}logger['error'](_0xcb8c('0x11'),_0x46ee58,_0x145a26[_0xcb8c('0x16')][_0xcb8c('0x18')]);return _0x2fe5de(_0x145a26[_0xcb8c('0x16')]['message']);}else{logger[_0xcb8c('0x10')](_0xcb8c('0x11'),_0x46ee58,_0xcb8c('0x12'));_0x2fe5de(_0x145a26[_0xcb8c('0x19')][_0xcb8c('0x18')]);}})[_0xcb8c('0x1a')](function(_0x490c04){logger[_0xcb8c('0x16')](_0xcb8c('0x11'),_0x46ee58,_0x490c04);_0x59e3fc(_0x490c04);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 66894fb..1151348 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 _0xc507=['remove','update','removeListener','register','length','./notification.events','save'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0xc507,0xde));var _0x7c50=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0xc507[_0x445c98];return _0x2fe913;};'use strict';var NotificationEvents=require(_0x7c50('0x0'));var events=[_0x7c50('0x1'),_0x7c50('0x2'),_0x7c50('0x3')];function createListener(_0x1eae30,_0xa36d1f){return function(_0x28cb44){_0xa36d1f['emit'](_0x1eae30,_0x28cb44);};}function removeListener(_0x22635b,_0x125192){return function(){NotificationEvents[_0x7c50('0x4')](_0x22635b,_0x125192);};}exports[_0x7c50('0x5')]=function(_0x2bdcdb){for(var _0x1533f4=0x0,_0x400113=events[_0x7c50('0x6')];_0x1533f4<_0x400113;_0x1533f4++){var _0x40eda6=events[_0x1533f4];var _0x46e53f=createListener('notification:'+_0x40eda6,_0x2bdcdb);NotificationEvents['on'](_0x40eda6,_0x46e53f);}}; \ No newline at end of file +var _0x4c20=['save','remove','update','emit','removeListener','length','notification:','./notification.events'];(function(_0x16d487,_0x2c9aa8){var _0x47a15e=function(_0x3744ab){while(--_0x3744ab){_0x16d487['push'](_0x16d487['shift']());}};_0x47a15e(++_0x2c9aa8);}(_0x4c20,0x187));var _0x04c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c20[_0x3dd15e];return _0x231fd0;};'use strict';var NotificationEvents=require(_0x04c2('0x0'));var events=[_0x04c2('0x1'),_0x04c2('0x2'),_0x04c2('0x3')];function createListener(_0x397189,_0x118a3b){return function(_0x591d66){_0x118a3b[_0x04c2('0x4')](_0x397189,_0x591d66);};}function removeListener(_0x21a96a,_0x2ebb18){return function(){NotificationEvents[_0x04c2('0x5')](_0x21a96a,_0x2ebb18);};}exports['register']=function(_0xe70701){for(var _0x381758=0x0,_0x437365=events[_0x04c2('0x6')];_0x381758<_0x437365;_0x381758++){var _0xac59eb=events[_0x381758];var _0x303411=createListener(_0x04c2('0x7')+_0xac59eb,_0xe70701);NotificationEvents['on'](_0xac59eb,_0x303411);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 7cce1bb..e148808 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 _0xdb34=['addAnswer','/:id/notify','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeAnswers','/:id/users','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/applications','/:id/interactions','getInteractions','post','addDisposition','/:id/canned_answers'];(function(_0x18ebff,_0xc7b689){var _0x59a7e6=function(_0x4bce25){while(--_0x4bce25){_0x18ebff['push'](_0x18ebff['shift']());}};_0x59a7e6(++_0xc7b689);}(_0xdb34,0x98));var _0x4db3=function(_0x38faf6,_0x47aa41){_0x38faf6=_0x38faf6-0x0;var _0x4d2c88=_0xdb34[_0x38faf6];return _0x4d2c88;};'use strict';var multer=require(_0x4db3('0x0'));var util=require(_0x4db3('0x1'));var path=require('path');var timeout=require(_0x4db3('0x2'));var express=require(_0x4db3('0x3'));var router=express[_0x4db3('0x4')]();var auth=require(_0x4db3('0x5'));var interaction=require(_0x4db3('0x6'));var config=require(_0x4db3('0x7'));var controller=require(_0x4db3('0x8'));router[_0x4db3('0x9')]('/',auth[_0x4db3('0xa')](),controller[_0x4db3('0xb')]);router['get'](_0x4db3('0xc'),auth[_0x4db3('0xa')](),controller[_0x4db3('0xd')]);router[_0x4db3('0x9')](_0x4db3('0xe'),auth[_0x4db3('0xa')](),controller[_0x4db3('0xf')]);router[_0x4db3('0x9')](_0x4db3('0x10'),auth[_0x4db3('0xa')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x4db3('0xa')](),controller['getAnswers']);router[_0x4db3('0x9')](_0x4db3('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0x4db3('0x9')](_0x4db3('0x12'),auth[_0x4db3('0xa')](),controller[_0x4db3('0x13')]);router[_0x4db3('0x9')]('/:id/users',auth[_0x4db3('0xa')](),controller['getAgents']);router[_0x4db3('0x14')]('/',auth[_0x4db3('0xa')](),controller['create']);router[_0x4db3('0x14')](_0x4db3('0x10'),auth[_0x4db3('0xa')](),controller[_0x4db3('0x15')]);router['post'](_0x4db3('0x16'),auth[_0x4db3('0xa')](),controller[_0x4db3('0x17')]);router[_0x4db3('0x14')](_0x4db3('0x18'),controller['notify']);router['post'](_0x4db3('0x11'),auth[_0x4db3('0xa')](),controller[_0x4db3('0x19')]);router[_0x4db3('0x14')]('/:id/users',auth[_0x4db3('0xa')](),controller[_0x4db3('0x1a')]);router[_0x4db3('0x14')](_0x4db3('0x1b'),auth['isAuthenticated'](),controller['send']);router[_0x4db3('0x1c')](_0x4db3('0xe'),auth[_0x4db3('0xa')](),controller[_0x4db3('0x1d')]);router[_0x4db3('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x4db3('0x1f')]);router[_0x4db3('0x1e')](_0x4db3('0x10'),auth[_0x4db3('0xa')](),controller['removeDispositions']);router[_0x4db3('0x1e')](_0x4db3('0x16'),auth['isAuthenticated'](),controller[_0x4db3('0x20')]);router[_0x4db3('0x1e')](_0x4db3('0x21'),auth[_0x4db3('0xa')](),controller['removeAgents']);module[_0x4db3('0x22')]=router; \ No newline at end of file +var _0x9ff2=['notify','addApplications','addAgents','/:id/send','send','delete','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/applications','getInteractions','/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','/:id/notify'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x9ff2,0x128));var _0x29ff=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9ff2[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x29ff('0x0'));var util=require(_0x29ff('0x1'));var path=require(_0x29ff('0x2'));var timeout=require(_0x29ff('0x3'));var express=require(_0x29ff('0x4'));var router=express[_0x29ff('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x29ff('0x6'));var config=require('../../config/environment');var controller=require(_0x29ff('0x7'));router[_0x29ff('0x8')]('/',auth[_0x29ff('0x9')](),controller['index']);router[_0x29ff('0x8')](_0x29ff('0xa'),auth['isAuthenticated'](),controller[_0x29ff('0xb')]);router[_0x29ff('0x8')](_0x29ff('0xc'),auth[_0x29ff('0x9')](),controller[_0x29ff('0xd')]);router[_0x29ff('0x8')]('/:id/dispositions',auth[_0x29ff('0x9')](),controller[_0x29ff('0xe')]);router['get']('/:id/canned_answers',auth[_0x29ff('0x9')](),controller['getAnswers']);router[_0x29ff('0x8')](_0x29ff('0xf'),auth['isAuthenticated'](),controller['getApplications']);router[_0x29ff('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x29ff('0x10')]);router[_0x29ff('0x8')](_0x29ff('0x11'),auth['isAuthenticated'](),controller[_0x29ff('0x12')]);router[_0x29ff('0x13')]('/',auth[_0x29ff('0x9')](),controller['create']);router[_0x29ff('0x13')](_0x29ff('0x14'),auth[_0x29ff('0x9')](),controller[_0x29ff('0x15')]);router[_0x29ff('0x13')](_0x29ff('0x16'),auth[_0x29ff('0x9')](),controller['addAnswer']);router[_0x29ff('0x13')](_0x29ff('0x17'),controller[_0x29ff('0x18')]);router[_0x29ff('0x13')](_0x29ff('0xf'),auth[_0x29ff('0x9')](),controller[_0x29ff('0x19')]);router[_0x29ff('0x13')]('/:id/users',auth[_0x29ff('0x9')](),controller[_0x29ff('0x1a')]);router[_0x29ff('0x13')](_0x29ff('0x1b'),auth[_0x29ff('0x9')](),controller[_0x29ff('0x1c')]);router['put'](_0x29ff('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x29ff('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x29ff('0x1d')](_0x29ff('0x14'),auth[_0x29ff('0x9')](),controller[_0x29ff('0x1e')]);router[_0x29ff('0x1d')](_0x29ff('0x16'),auth[_0x29ff('0x9')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0x29ff('0x9')](),controller[_0x29ff('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 3fb77ef..2c6a16a 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 _0x26a3=['STRING','name','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x1c6667,_0x568ae2){var _0x2e76d8=function(_0x41d950){while(--_0x41d950){_0x1c6667['push'](_0x1c6667['shift']());}};_0x2e76d8(++_0x568ae2);}(_0x26a3,0x1d1));var _0x326a=function(_0x1bdd7d,_0x49bc49){_0x1bdd7d=_0x1bdd7d-0x0;var _0x288b3e=_0x26a3[_0x1bdd7d];return _0x288b3e;};'use strict';var Sequelize=require(_0x326a('0x0'));var rs=require(_0x326a('0x1'));module[_0x326a('0x2')]={'name':{'type':Sequelize[_0x326a('0x3')],'unique':_0x326a('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x326a('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x326a('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x326a('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x326a('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x326a('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x326a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x326a('0x3')]},'queueTransfer':{'type':Sequelize[_0x326a('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x326a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x326a('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x326a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x326a('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x326a('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x326a('0x6')],'defaultValue':![],'comment':_0x326a('0x9'),'set':function(_0x230764){if(!_0x230764)this['setDataValue'](_0x326a('0xa'),null);this[_0x326a('0xb')](_0x326a('0xc'),_0x230764);}}}; \ No newline at end of file +var _0xeb49=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x4227dd,_0x86a1d2){var _0x2820b0=function(_0x295a9b){while(--_0x295a9b){_0x4227dd['push'](_0x4227dd['shift']());}};_0x2820b0(++_0x86a1d2);}(_0xeb49,0xc8));var _0x9eb4=function(_0x1f86da,_0x56c559){_0x1f86da=_0x1f86da-0x0;var _0x27ec11=_0xeb49[_0x1f86da];return _0x27ec11;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9eb4('0x0'));module['exports']={'name':{'type':Sequelize[_0x9eb4('0x1')],'unique':_0x9eb4('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9eb4('0x1')]},'token':{'type':Sequelize[_0x9eb4('0x1')],'defaultValue':function(){return rs[_0x9eb4('0x3')]();}},'replyUri':{'type':Sequelize[_0x9eb4('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9eb4('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9eb4('0x4')],'defaultValue':function(){return _0x9eb4('0x5');}},'notificationSound':{'type':Sequelize[_0x9eb4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9eb4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9eb4('0x1')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9eb4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9eb4('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9eb4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9eb4('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9eb4('0x6')],'defaultValue':![],'comment':_0x9eb4('0x9'),'set':function(_0x4f2b65){if(!_0x4f2b65)this[_0x9eb4('0xa')](_0x9eb4('0xb'),null);this['setDataValue'](_0x9eb4('0xc'),_0x4f2b65);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ef42671..1a43dfd 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 _0x8dcf=['account','applications','list','orderBy','priority','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','findOne','transaction','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','name','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','order','OpenchannelAccountId','options','removeDispositions','getAnswers','CannedAnswer','length','removeAnswers','ids','notify','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','CmList','Contacts','DESC','OpenchannelApplication','Applications','List'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8dcf,0x1aa));var _0xf8dc=function(_0x216a04,_0xdb1e7a){_0x216a04=_0x216a04-0x0;var _0x375dba=_0x8dcf[_0x216a04];return _0x375dba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf8dc('0x0'));var rimraf=require(_0xf8dc('0x1'));var zipdir=require(_0xf8dc('0x2'));var jsonpatch=require(_0xf8dc('0x3'));var rp=require(_0xf8dc('0x4'));var moment=require(_0xf8dc('0x5'));var BPromise=require(_0xf8dc('0x6'));var Mustache=require(_0xf8dc('0x7'));var util=require(_0xf8dc('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf8dc('0x9'));var ejs=require(_0xf8dc('0xa'));var fs=require('fs');var _=require(_0xf8dc('0xb'));var squel=require(_0xf8dc('0xc'));var crypto=require('crypto');var jsforce=require(_0xf8dc('0xd'));var deskjs=require(_0xf8dc('0xe'));var toCsv=require(_0xf8dc('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf8dc('0xf'));var authService=require(_0xf8dc('0x10'));var qs=require(_0xf8dc('0x11'));var as=require(_0xf8dc('0x12'));var hardwareService=require(_0xf8dc('0x13'));var logger=require(_0xf8dc('0x14'))(_0xf8dc('0x15'));var utils=require(_0xf8dc('0x16'));var config=require(_0xf8dc('0x17'));var db=require(_0xf8dc('0x18'))['db'];config[_0xf8dc('0x19')]=_[_0xf8dc('0x1a')](config[_0xf8dc('0x19')],{'host':_0xf8dc('0x1b'),'port':0x18eb});var socket=require(_0xf8dc('0x1c'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xf8dc('0x1d'));var client=jayson[_0xf8dc('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xf8dc('0x1e')][_0xf8dc('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x5b8597,_0x12ea0e,_0x4cb545){if(_0x4cb545){var _0x1e6a99=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e6a99[_0xf8dc('0x20')](_0x12ea0e)){return _0x5b8597;}else{throw new db[(_0xf8dc('0x21'))]['ValidationError'](_0xf8dc('0x22'));}}else{return _0x5b8597;}}function respondWithRpcPromise(_0x5f4ad9,_0x2968d9,_0x424948,_0xc96ad){return new BPromise(function(_0x1acfec,_0x39f29f){var _0x5c7440=_0xc96ad||client;return _0x5c7440[_0xf8dc('0x23')](_0x5f4ad9,_0x424948)[_0xf8dc('0x24')](function(_0x1def92){logger[_0xf8dc('0x25')](_0xf8dc('0x26'),_0x2968d9,'request\x20sent');logger[_0xf8dc('0x27')](_0xf8dc('0x28'),_0x2968d9,_0xf8dc('0x29'),JSON[_0xf8dc('0x2a')](_0x1def92));if(_0x1def92[_0xf8dc('0x2b')]){if(_0x1def92[_0xf8dc('0x2b')][_0xf8dc('0x2c')]===0x1f4){logger[_0xf8dc('0x2b')](_0xf8dc('0x26'),_0x2968d9,_0x1def92[_0xf8dc('0x2b')][_0xf8dc('0x2d')]);return _0x39f29f(_0x1def92[_0xf8dc('0x2b')][_0xf8dc('0x2d')]);}logger[_0xf8dc('0x2b')](_0xf8dc('0x26'),_0x2968d9,_0x1def92[_0xf8dc('0x2b')]['message']);return _0x1acfec(_0x1def92[_0xf8dc('0x2b')]['message']);}else{logger['info'](_0xf8dc('0x26'),_0x2968d9,_0xf8dc('0x29'));_0x1acfec(_0x1def92['result'][_0xf8dc('0x2d')]);}})[_0xf8dc('0x2e')](function(_0x2fbd1e){logger[_0xf8dc('0x2b')](_0xf8dc('0x26'),_0x2968d9,_0x2fbd1e);_0x39f29f(_0x2fbd1e);});});}function respondWithStatusCode(_0x1769ff,_0x1b724d){_0x1b724d=_0x1b724d||0xcc;return function(_0x537df2){if(_0x537df2){return _0x1769ff[_0xf8dc('0x2f')](_0x1b724d);}return _0x1769ff[_0xf8dc('0x30')](_0x1b724d)[_0xf8dc('0x31')]();};}function respondWithResult(_0x44d59e,_0x2abe50){_0x2abe50=_0x2abe50||0xc8;return function(_0x151a60){if(_0x151a60){return _0x44d59e[_0xf8dc('0x30')](_0x2abe50)[_0xf8dc('0x32')](_0x151a60);}};}function respondWithFilteredResult(_0x25c289,_0x267007){return function(_0x20ad46){if(_0x20ad46){var _0xde30e2=_0x20ad46[_0xf8dc('0x33')],_0x2e3c47=_0x267007[_0xf8dc('0x34')],_0x4be92d=_0x267007[_0xf8dc('0x34')]+_0x267007['limit'],_0xc009bf;if(_0x4be92d>=_0xde30e2){_0x4be92d=_0xde30e2;_0xc009bf=0xc8;}else{_0xc009bf=0xce;}_0x25c289[_0xf8dc('0x30')](_0xc009bf);return _0x25c289[_0xf8dc('0x35')](_0xf8dc('0x36'),_0x2e3c47+'-'+_0x4be92d+'/'+_0xde30e2)['json'](_0x20ad46);}return null;};}function patchUpdates(_0x262969){return function(_0x5f150a){try{jsonpatch[_0xf8dc('0x37')](_0x5f150a,_0x262969,!![]);}catch(_0x32a284){return BPromise[_0xf8dc('0x38')](_0x32a284);}return _0x5f150a[_0xf8dc('0x39')]();};}function saveUpdates(_0xc60249,_0x59b41e){return function(_0x51b95f){if(_0x51b95f){return _0x51b95f[_0xf8dc('0x3a')](_0xc60249)[_0xf8dc('0x24')](function(_0x12d625){return _0x12d625;});}return null;};}function removeEntity(_0x2e6a10,_0x37c5fe){return function(_0x51f26e){if(_0x51f26e){return _0x51f26e[_0xf8dc('0x3b')]()['then'](function(){var _0x4af55d=_0x51f26e['get']({'plain':!![]});var _0x384f2e='OpenchannelAccounts';return db[_0xf8dc('0x3c')][_0xf8dc('0x3b')]({'where':{'type':_0x384f2e,'resourceId':_0x4af55d['id']}})[_0xf8dc('0x24')](function(){return _0x51f26e;});})['then'](function(){_0x2e6a10[_0xf8dc('0x30')](0xcc)[_0xf8dc('0x31')]();});}};}function handleEntityNotFound(_0x39542a,_0x76c538){return function(_0x1ef0f9){if(!_0x1ef0f9){_0x39542a[_0xf8dc('0x2f')](0x194);}return _0x1ef0f9;};}function handleError(_0x1bb8d9,_0x2936ee){_0x2936ee=_0x2936ee||0x1f4;return function(_0x221676){logger[_0xf8dc('0x2b')](_0x221676['stack']);if(_0x221676[_0xf8dc('0x3d')]){delete _0x221676[_0xf8dc('0x3d')];}_0x1bb8d9[_0xf8dc('0x30')](_0x2936ee)['send'](_0x221676);};}exports['index']=function(_0x4d33a1,_0x1cc766){var _0x3f6d72={'include':[{'model':db[_0xf8dc('0x3e')],'as':_0xf8dc('0x3f')}]},_0x21134b={},_0x55b9d7={'count':0x0,'rows':[]};var _0x5705f7=_[_0xf8dc('0x40')](db[_0xf8dc('0x41')][_0xf8dc('0x42')],function(_0x5a0ef8){return{'name':_0x5a0ef8[_0xf8dc('0x43')],'type':_0x5a0ef8['type']['key']};});_0x21134b[_0xf8dc('0x44')]=_[_0xf8dc('0x40')](_0x5705f7,'name');_0x21134b[_0xf8dc('0x45')]=_['keys'](_0x4d33a1[_0xf8dc('0x45')]);_0x21134b[_0xf8dc('0x46')]=_['intersection'](_0x21134b[_0xf8dc('0x44')],_0x21134b['query']);_0x3f6d72[_0xf8dc('0x47')]=_[_0xf8dc('0x48')](_0x21134b[_0xf8dc('0x44')],qs[_0xf8dc('0x49')](_0x4d33a1[_0xf8dc('0x45')][_0xf8dc('0x49')]));_0x3f6d72[_0xf8dc('0x47')]=_0x3f6d72[_0xf8dc('0x47')]['length']?_0x3f6d72['attributes']:_0x21134b[_0xf8dc('0x44')];if(!_0x4d33a1[_0xf8dc('0x45')][_0xf8dc('0x4a')](_0xf8dc('0x4b'))){_0x3f6d72[_0xf8dc('0x4c')]=qs['limit'](_0x4d33a1['query']['limit']);_0x3f6d72[_0xf8dc('0x34')]=qs[_0xf8dc('0x34')](_0x4d33a1[_0xf8dc('0x45')][_0xf8dc('0x34')]);}_0x3f6d72['order']=qs[_0xf8dc('0x4d')](_0x4d33a1['query'][_0xf8dc('0x4d')]);_0x3f6d72[_0xf8dc('0x4e')]=qs[_0xf8dc('0x46')](_[_0xf8dc('0x4f')](_0x4d33a1[_0xf8dc('0x45')],_0x21134b[_0xf8dc('0x46')]),_0x5705f7);if(_0x4d33a1[_0xf8dc('0x45')][_0xf8dc('0x50')]){_0x3f6d72['where']=_[_0xf8dc('0x51')](_0x3f6d72[_0xf8dc('0x4e')],{'$or':_['map'](_0x5705f7,function(_0x141af2){if(_0x141af2['type']!==_0xf8dc('0x52')){var _0x237b09={};_0x237b09[_0x141af2['name']]={'$like':'%'+_0x4d33a1['query'][_0xf8dc('0x50')]+'%'};return _0x237b09;}})});}_0x3f6d72=_[_0xf8dc('0x51')]({},_0x3f6d72,_0x4d33a1['options']);var _0x407c83={'where':_0x3f6d72[_0xf8dc('0x4e')]};return db[_0xf8dc('0x41')][_0xf8dc('0x33')](_0x407c83)['then'](function(_0x4f1303){_0x55b9d7[_0xf8dc('0x33')]=_0x4f1303;if(_0x4d33a1[_0xf8dc('0x45')][_0xf8dc('0x53')]){_0x3f6d72[_0xf8dc('0x54')]=[{'all':!![]}];}return db[_0xf8dc('0x41')][_0xf8dc('0x55')](_0x3f6d72);})['then'](function(_0x3fab07){_0x55b9d7[_0xf8dc('0x56')]=_0x3fab07;return _0x55b9d7;})['then'](respondWithFilteredResult(_0x1cc766,_0x3f6d72))['catch'](handleError(_0x1cc766,null));};exports[_0xf8dc('0x57')]=function(_0x5bb62a,_0x312f42){var _0x3369f3={'raw':![],'where':{'id':_0x5bb62a[_0xf8dc('0x58')]['id']},'include':[{'model':db[_0xf8dc('0x3e')],'as':_0xf8dc('0x3f')}]},_0x5e6021={};_0x5e6021[_0xf8dc('0x44')]=_[_0xf8dc('0x59')](db[_0xf8dc('0x41')][_0xf8dc('0x42')]);_0x5e6021[_0xf8dc('0x45')]=_[_0xf8dc('0x59')](_0x5bb62a[_0xf8dc('0x45')]);_0x5e6021[_0xf8dc('0x46')]=_[_0xf8dc('0x48')](_0x5e6021['model'],_0x5e6021[_0xf8dc('0x45')]);_0x3369f3[_0xf8dc('0x47')]=_[_0xf8dc('0x48')](_0x5e6021['model'],qs[_0xf8dc('0x49')](_0x5bb62a[_0xf8dc('0x45')]['fields']));_0x3369f3['attributes']=_0x3369f3[_0xf8dc('0x47')]['length']?_0x3369f3[_0xf8dc('0x47')]:_0x5e6021[_0xf8dc('0x44')];if(_0x5bb62a['query'][_0xf8dc('0x53')]){_0x3369f3[_0xf8dc('0x54')]=[{'all':!![]}];}_0x3369f3=_['merge']({},_0x3369f3,_0x5bb62a['options']);return db[_0xf8dc('0x41')][_0xf8dc('0x5a')](_0x3369f3)[_0xf8dc('0x24')](handleEntityNotFound(_0x312f42,null))[_0xf8dc('0x24')](respondWithResult(_0x312f42,null))[_0xf8dc('0x2e')](handleError(_0x312f42,null));};exports['create']=function(_0x160d12,_0xc404a5){return db[_0xf8dc('0x41')][_0xf8dc('0x5b')](_0x160d12['body'],{})[_0xf8dc('0x24')](function(_0x32004e){var _0x4657ea=_0x160d12['user'][_0xf8dc('0x5c')]({'plain':!![]});if(!_0x4657ea)throw new Error(_0xf8dc('0x5d'));if(_0x4657ea[_0xf8dc('0x5e')]===_0xf8dc('0x5f')){var _0x5eac5b=_0x32004e['get']({'plain':!![]});var _0x1cecfc=_0xf8dc('0x60');return db['UserProfileSection'][_0xf8dc('0x5a')]({'where':{'name':_0x1cecfc,'userProfileId':_0x4657ea['userProfileId']},'raw':!![]})[_0xf8dc('0x24')](function(_0x2d4f47){if(_0x2d4f47&&_0x2d4f47[_0xf8dc('0x61')]===0x0){return db['UserProfileResource'][_0xf8dc('0x5b')]({'name':_0x5eac5b['name'],'resourceId':_0x5eac5b['id'],'type':_0x2d4f47['name'],'sectionId':_0x2d4f47['id']},{})[_0xf8dc('0x24')](function(){return _0x32004e;});}else{return _0x32004e;}})[_0xf8dc('0x2e')](function(_0x499c20){logger[_0xf8dc('0x2b')](_0xf8dc('0x62'),_0x499c20);throw _0x499c20;});}return _0x32004e;})[_0xf8dc('0x24')](respondWithResult(_0xc404a5,0xc9))['catch'](handleError(_0xc404a5,null));};exports[_0xf8dc('0x3a')]=function(_0x40403a,_0x13bb3a){if(_0x40403a['body']['id']){delete _0x40403a[_0xf8dc('0x63')]['id'];}return db[_0xf8dc('0x41')][_0xf8dc('0x5a')]({'where':{'id':_0x40403a[_0xf8dc('0x58')]['id']},'include':[{'model':db[_0xf8dc('0x3e')],'as':_0xf8dc('0x3f')}]})[_0xf8dc('0x24')](handleEntityNotFound(_0x13bb3a,null))[_0xf8dc('0x24')](saveUpdates(_0x40403a[_0xf8dc('0x63')],null))['then'](respondWithResult(_0x13bb3a,null))[_0xf8dc('0x2e')](handleError(_0x13bb3a,null));};exports[_0xf8dc('0x3b')]=function(_0x2ab3d9,_0x30a013){return db[_0xf8dc('0x41')][_0xf8dc('0x5a')]({'where':{'id':_0x2ab3d9['params']['id']}})['then'](handleEntityNotFound(_0x30a013,null))[_0xf8dc('0x24')](removeEntity(_0x30a013,null))[_0xf8dc('0x2e')](handleError(_0x30a013,null));};exports[_0xf8dc('0x64')]=function(_0x29d350,_0x58e594){return db[_0xf8dc('0x41')][_0xf8dc('0x64')]()[_0xf8dc('0x24')](respondWithResult(_0x58e594,null))[_0xf8dc('0x2e')](handleError(_0x58e594,null));};exports[_0xf8dc('0x65')]=function(_0x6ce961,_0xdff28f,_0x26eb16){if(_0x6ce961[_0xf8dc('0x63')]['id']){delete _0x6ce961[_0xf8dc('0x63')]['id'];}return db[_0xf8dc('0x41')]['find']({'where':{'id':_0x6ce961['params']['id']}})[_0xf8dc('0x24')](handleEntityNotFound(_0xdff28f,null))[_0xf8dc('0x24')](function(_0x372fc6){if(_0x372fc6){_0x6ce961[_0xf8dc('0x63')][_0xf8dc('0x66')]=_0x372fc6['id'];return db[_0xf8dc('0x67')][_0xf8dc('0x5b')](_0x6ce961['body']);}})[_0xf8dc('0x24')](respondWithResult(_0xdff28f,null))[_0xf8dc('0x2e')](handleError(_0xdff28f,null));};exports[_0xf8dc('0x68')]=function(_0x19df2d,_0x5adeab,_0x22c918){var _0x2adcea={'raw':![],'where':{}};var _0x2afc45={};var _0x382b4a={'count':0x0,'rows':[]};return db[_0xf8dc('0x41')]['findOne']({'where':{'id':_0x19df2d[_0xf8dc('0x58')]['id']}})['then'](handleEntityNotFound(_0x5adeab,null))[_0xf8dc('0x24')](function(_0x1c6eae){if(_0x1c6eae){_0x2afc45['model']=_[_0xf8dc('0x59')](db['Disposition'][_0xf8dc('0x42')]);_0x2afc45['query']=_[_0xf8dc('0x59')](_0x19df2d[_0xf8dc('0x45')]);_0x2afc45[_0xf8dc('0x46')]=_[_0xf8dc('0x48')](_0x2afc45[_0xf8dc('0x44')],_0x2afc45[_0xf8dc('0x45')]);_0x2adcea[_0xf8dc('0x47')]=_[_0xf8dc('0x48')](_0x2afc45['model'],qs[_0xf8dc('0x49')](_0x19df2d[_0xf8dc('0x45')]['fields']));_0x2adcea[_0xf8dc('0x47')]=_0x2adcea[_0xf8dc('0x47')]['length']?_0x2adcea[_0xf8dc('0x47')]:_0x2afc45['model'];if(!_0x19df2d[_0xf8dc('0x45')][_0xf8dc('0x4a')](_0xf8dc('0x4b'))){_0x2adcea[_0xf8dc('0x4c')]=qs[_0xf8dc('0x4c')](_0x19df2d[_0xf8dc('0x45')][_0xf8dc('0x4c')]);_0x2adcea[_0xf8dc('0x34')]=qs[_0xf8dc('0x34')](_0x19df2d[_0xf8dc('0x45')][_0xf8dc('0x34')]);}_0x2adcea[_0xf8dc('0x69')]=qs[_0xf8dc('0x4d')](_0x19df2d[_0xf8dc('0x45')][_0xf8dc('0x4d')]);_0x2adcea[_0xf8dc('0x4e')]=qs[_0xf8dc('0x46')](_['pick'](_0x19df2d[_0xf8dc('0x45')],_0x2afc45['filters']));_0x2adcea['where'][_0xf8dc('0x6a')]=_0x1c6eae['id'];if(_0x19df2d[_0xf8dc('0x45')]['filter']){_0x2adcea['where']=_[_0xf8dc('0x51')](_0x2adcea['where'],{'$or':_['map'](_0x2adcea[_0xf8dc('0x47')],function(_0x590b42){var _0x2243ca={};_0x2243ca[_0x590b42]={'$like':'%'+_0x19df2d['query'][_0xf8dc('0x50')]+'%'};return _0x2243ca;})});}_0x2adcea=_[_0xf8dc('0x51')]({},_0x2adcea,_0x19df2d[_0xf8dc('0x6b')]);return db['Disposition'][_0xf8dc('0x33')]({'where':_0x2adcea['where']})[_0xf8dc('0x24')](function(_0x3fd2cf){_0x382b4a[_0xf8dc('0x33')]=_0x3fd2cf;if(_0x19df2d['query']['includeAll']){_0x2adcea[_0xf8dc('0x54')]=[{'all':!![]}];}return db[_0xf8dc('0x67')][_0xf8dc('0x55')](_0x2adcea);})[_0xf8dc('0x24')](function(_0x4dbd75){_0x382b4a['rows']=_0x4dbd75;return _0x382b4a;});}})[_0xf8dc('0x24')](respondWithFilteredResult(_0x5adeab,_0x2adcea))['catch'](handleError(_0x5adeab,null));};exports[_0xf8dc('0x6c')]=function(_0x1e8102,_0x436738,_0x4ba040){return db[_0xf8dc('0x41')][_0xf8dc('0x5a')]({'where':{'id':_0x1e8102[_0xf8dc('0x58')]['id']}})[_0xf8dc('0x24')](handleEntityNotFound(_0x436738,null))['then'](function(_0x54423e){if(_0x54423e){return _0x54423e[_0xf8dc('0x6c')](_0x1e8102[_0xf8dc('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x436738,null))[_0xf8dc('0x2e')](handleError(_0x436738,null));};exports['addAnswer']=function(_0x41d07e,_0x31e0a0,_0x41afb5){if(_0x41d07e['body']['id']){delete _0x41d07e[_0xf8dc('0x63')]['id'];}return db['OpenchannelAccount'][_0xf8dc('0x5a')]({'where':{'id':_0x41d07e['params']['id']}})[_0xf8dc('0x24')](handleEntityNotFound(_0x31e0a0,null))['then'](function(_0x4f1107){if(_0x4f1107){_0x41d07e[_0xf8dc('0x63')][_0xf8dc('0x6a')]=_0x4f1107['id'];return db['CannedAnswer'][_0xf8dc('0x5b')](_0x41d07e['body']);}})['then'](respondWithResult(_0x31e0a0,null))[_0xf8dc('0x2e')](handleError(_0x31e0a0,null));};exports[_0xf8dc('0x6d')]=function(_0x4b6a41,_0x237130,_0x59f632){var _0x3349c7={'raw':![],'where':{}};var _0xc2962f={};var _0x3c7945={'count':0x0,'rows':[]};return db[_0xf8dc('0x41')]['findOne']({'where':{'id':_0x4b6a41[_0xf8dc('0x58')]['id']}})[_0xf8dc('0x24')](handleEntityNotFound(_0x237130,null))[_0xf8dc('0x24')](function(_0x3daefd){if(_0x3daefd){_0xc2962f[_0xf8dc('0x44')]=_[_0xf8dc('0x59')](db[_0xf8dc('0x6e')]['rawAttributes']);_0xc2962f[_0xf8dc('0x45')]=_[_0xf8dc('0x59')](_0x4b6a41[_0xf8dc('0x45')]);_0xc2962f[_0xf8dc('0x46')]=_[_0xf8dc('0x48')](_0xc2962f[_0xf8dc('0x44')],_0xc2962f[_0xf8dc('0x45')]);_0x3349c7[_0xf8dc('0x47')]=_[_0xf8dc('0x48')](_0xc2962f['model'],qs[_0xf8dc('0x49')](_0x4b6a41[_0xf8dc('0x45')][_0xf8dc('0x49')]));_0x3349c7[_0xf8dc('0x47')]=_0x3349c7['attributes'][_0xf8dc('0x6f')]?_0x3349c7['attributes']:_0xc2962f['model'];if(!_0x4b6a41[_0xf8dc('0x45')][_0xf8dc('0x4a')](_0xf8dc('0x4b'))){_0x3349c7[_0xf8dc('0x4c')]=qs['limit'](_0x4b6a41[_0xf8dc('0x45')]['limit']);_0x3349c7[_0xf8dc('0x34')]=qs[_0xf8dc('0x34')](_0x4b6a41[_0xf8dc('0x45')][_0xf8dc('0x34')]);}_0x3349c7[_0xf8dc('0x69')]=qs[_0xf8dc('0x4d')](_0x4b6a41[_0xf8dc('0x45')][_0xf8dc('0x4d')]);_0x3349c7[_0xf8dc('0x4e')]=qs['filters'](_[_0xf8dc('0x4f')](_0x4b6a41[_0xf8dc('0x45')],_0xc2962f[_0xf8dc('0x46')]));_0x3349c7['where'][_0xf8dc('0x6a')]=_0x3daefd['id'];if(_0x4b6a41[_0xf8dc('0x45')][_0xf8dc('0x50')]){_0x3349c7[_0xf8dc('0x4e')]=_[_0xf8dc('0x51')](_0x3349c7[_0xf8dc('0x4e')],{'$or':_[_0xf8dc('0x40')](_0x3349c7[_0xf8dc('0x47')],function(_0x2d7543){var _0x45acc6={};_0x45acc6[_0x2d7543]={'$like':'%'+_0x4b6a41[_0xf8dc('0x45')][_0xf8dc('0x50')]+'%'};return _0x45acc6;})});}_0x3349c7=_[_0xf8dc('0x51')]({},_0x3349c7,_0x4b6a41[_0xf8dc('0x6b')]);return db[_0xf8dc('0x6e')][_0xf8dc('0x33')]({'where':_0x3349c7['where']})[_0xf8dc('0x24')](function(_0x5604d0){_0x3c7945[_0xf8dc('0x33')]=_0x5604d0;if(_0x4b6a41[_0xf8dc('0x45')][_0xf8dc('0x53')]){_0x3349c7[_0xf8dc('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf8dc('0x55')](_0x3349c7);})['then'](function(_0x4f6ea6){_0x3c7945['rows']=_0x4f6ea6;return _0x3c7945;});}})[_0xf8dc('0x24')](respondWithFilteredResult(_0x237130,_0x3349c7))['catch'](handleError(_0x237130,null));};exports[_0xf8dc('0x70')]=function(_0x1aed90,_0x3f346d,_0x120e8a){return db[_0xf8dc('0x41')]['find']({'where':{'id':_0x1aed90[_0xf8dc('0x58')]['id']}})[_0xf8dc('0x24')](handleEntityNotFound(_0x3f346d,null))[_0xf8dc('0x24')](function(_0x4a1d23){if(_0x4a1d23){return _0x4a1d23[_0xf8dc('0x70')](_0x1aed90[_0xf8dc('0x45')][_0xf8dc('0x71')]);}})[_0xf8dc('0x24')](respondWithStatusCode(_0x3f346d,null))[_0xf8dc('0x2e')](handleError(_0x3f346d,null));};exports[_0xf8dc('0x72')]=function(_0x338b8e,_0xaa9d6c,_0x44b2c6){var _0x1322a8={'body':_0x338b8e[_0xf8dc('0x63')],'channel':_0xf8dc('0x73')};var _0x31b8d3=[];var _0x354b60=[];var _0x5a2604={};var _0x3ae360=![];return db[_0xf8dc('0x74')]['describe']()[_0xf8dc('0x24')](function(_0x41804b){if(!_0x41804b){throw new db[(_0xf8dc('0x21'))][(_0xf8dc('0x75'))]('no\x20available\x20attributes');}_0x31b8d3=_[_0xf8dc('0x76')](_['keys'](_0x41804b),[_0xf8dc('0x77'),_0xf8dc('0x78')]);_0x354b60=_[_0xf8dc('0x76')](_[_0xf8dc('0x59')](_0x41804b),['createdAt',_0xf8dc('0x78'),'CompanyId',_0xf8dc('0x79')]);if(_0x338b8e['body']['id']){delete _0x338b8e['body']['id'];}if(_['isNil'](_0x338b8e[_0xf8dc('0x63')]['from'])){throw new db[(_0xf8dc('0x21'))][(_0xf8dc('0x75'))]('from\x20is\x20mandatory');}if(_[_0xf8dc('0x7a')](_0x338b8e['body']['body'])||_0x338b8e['body'][_0xf8dc('0x63')]===''){throw new db[(_0xf8dc('0x21'))][(_0xf8dc('0x75'))](_0xf8dc('0x7b'));}if(_['isNil'](_0x338b8e[_0xf8dc('0x63')]['mapKey'])){throw new db['Sequelize'][(_0xf8dc('0x75'))](_0xf8dc('0x7c')+_0x354b60);}if(!_[_0xf8dc('0x7d')](_0x354b60,_0x338b8e[_0xf8dc('0x63')]['mapKey'])){throw new db[(_0xf8dc('0x21'))]['ValidationError'](_0xf8dc('0x7e')+_0x354b60);}_0x5a2604[_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x7f')]]=_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x80')];})['then'](function(){return db[_0xf8dc('0x41')][_0xf8dc('0x5a')]({'where':{'id':_0x338b8e[_0xf8dc('0x58')]['id']},'include':[{'model':db[_0xf8dc('0x81')],'as':'List','include':[{'model':db[_0xf8dc('0x74')],'as':_0xf8dc('0x82'),'where':_0x5a2604,'limit':0x1,'order':[[_0xf8dc('0x78'),_0xf8dc('0x83')]]}]},{'model':db[_0xf8dc('0x84')],'as':_0xf8dc('0x85')}]});})[_0xf8dc('0x24')](handleEntityNotFound(_0xaa9d6c,null))[_0xf8dc('0x24')](function(_0x45fc50){if(_0x45fc50&&_0x45fc50[_0xf8dc('0x86')]){_0x1322a8[_0xf8dc('0x87')]=_0x45fc50;_0x1322a8[_0xf8dc('0x88')]=_0x45fc50['Applications'];_0x1322a8[_0xf8dc('0x89')]=_0x45fc50[_0xf8dc('0x86')];_0x1322a8[_0xf8dc('0x88')]=_[_0xf8dc('0x8a')](_0x1322a8[_0xf8dc('0x88')],[_0xf8dc('0x8b')],['asc']);if(_0x1322a8[_0xf8dc('0x87')][_0xf8dc('0x85')]){delete _0x1322a8[_0xf8dc('0x87')][_0xf8dc('0x85')];}if(_0x1322a8[_0xf8dc('0x87')][_0xf8dc('0x86')]&&_0x1322a8[_0xf8dc('0x87')][_0xf8dc('0x86')][_0xf8dc('0x82')]['length']){return _0x1322a8[_0xf8dc('0x87')][_0xf8dc('0x86')]['Contacts'][0x0];}var _0x350072=_['defaults'](_0x338b8e[_0xf8dc('0x63')],{'firstName':_0x338b8e[_0xf8dc('0x63')]['from'],'ListId':_0x45fc50['ListId']});_0x350072[_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x7f')]]=_0x338b8e['body']['from'];return db[_0xf8dc('0x74')]['create'](_0x350072,{'fields':_0x31b8d3,'raw':!![]});}})[_0xf8dc('0x24')](handleEntityNotFound(_0xaa9d6c,null))['then'](function(_0x4bff18){_0x1322a8[_0xf8dc('0x8c')]=_0x4bff18;if(_0x4bff18){var _0x22fabd={'ContactId':_0x4bff18['id'],'OpenchannelAccountId':_0x338b8e[_0xf8dc('0x58')]['id'],'from':(_0x4bff18[_0xf8dc('0x8d')]||'')+'\x20'+(_0x4bff18['lastName']||'')};var _0x148eaf={'OpenchannelAccountId':_0x338b8e[_0xf8dc('0x58')]['id'],'closed':![]};if(_0x338b8e[_0xf8dc('0x63')]['threadId']){_0x148eaf[_0xf8dc('0x8e')]=_0x338b8e['body'][_0xf8dc('0x8e')];return db[_0xf8dc('0x8f')]['find']({'where':_0x148eaf})[_0xf8dc('0x24')](function(_0x157113){if(_0x157113){return[_0x157113,![]];}_0x22fabd[_0xf8dc('0x8e')]=_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x8e')];_0x22fabd['externalUrl']=_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x90')];return db[_0xf8dc('0x8f')][_0xf8dc('0x5b')](_0x22fabd)['then'](function(_0x4b0757){return[_0x4b0757,!![]];});});}else{_0x148eaf[_0xf8dc('0x8e')]=null;}_0x148eaf[_0xf8dc('0x91')]=_0x4bff18['id'];return db[_0xf8dc('0x8f')][_0xf8dc('0x5a')]({'where':_0x148eaf})[_0xf8dc('0x24')](function(_0x287bba){if(_0x287bba){return[_0x287bba,![]];}return db[_0xf8dc('0x8f')][_0xf8dc('0x5b')](_0x22fabd)[_0xf8dc('0x24')](function(_0xd79f70){return[_0xd79f70,!![]];});});}})[_0xf8dc('0x92')](function(_0x5dd986,_0x575832){if(_0x5dd986){_0x3ae360=_0x575832;if(!_0x575832){var _0x1c9bbd={'from':(_0x1322a8[_0xf8dc('0x8c')][_0xf8dc('0x8d')]||'')+'\x20'+(_0x1322a8[_0xf8dc('0x8c')]['lastName']||'')};if(_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x8e')]&&_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x93')]&&_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x8e')]!=_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x93')]){_0x1c9bbd[_0xf8dc('0x8e')]=_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x93')];}return _0x5dd986[_0xf8dc('0x3a')](_0x1c9bbd);}else{return _0x5dd986;}}})['then'](function(_0x17e9f4){_0x1322a8[_0xf8dc('0x94')]=_0x17e9f4[_0xf8dc('0x5c')]({'plain':!![]});_0x1322a8[_0xf8dc('0x94')][_0xf8dc('0x95')]=_0x3ae360;if(_0x1322a8[_0xf8dc('0x94')][_0xf8dc('0x95')]){if(_0x1322a8[_0xf8dc('0x87')]['autoclose']){_0x1322a8[_0xf8dc('0x88')][_0xf8dc('0x96')]({'id':0x0,'priority':_0x1322a8[_0xf8dc('0x88')][_0xf8dc('0x6f')]+0x1,'app':'close','appdata':_0xf8dc('0x97'),'interval':_0xf8dc('0x98')});}}return db[_0xf8dc('0x99')]['create']({'body':_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x63')],'OpenchannelAccountId':_0x338b8e[_0xf8dc('0x58')]['id'],'OpenchannelInteractionId':_0x17e9f4['id'],'direction':'in','ContactId':_0x1322a8['contact']['id'],'AttachmentId':_0x338b8e[_0xf8dc('0x63')][_0xf8dc('0x9a')]});})['then'](function(_0x1e6260){_0x1322a8[_0xf8dc('0x2d')]=_0x1e6260;if(_0x1322a8[_0xf8dc('0x94')][_0xf8dc('0x9b')]){return db[_0xf8dc('0x9c')][_0xf8dc('0x5a')]({'attributes':['id',_0xf8dc('0x3d')],'where':{'id':_0x1322a8[_0xf8dc('0x94')][_0xf8dc('0x9b')]}})[_0xf8dc('0x24')](function(_0x4823ff){if(_0x4823ff){_0x1322a8['applications'][_0xf8dc('0x9d')]({'id':0x0,'priority':0x0,'app':_0xf8dc('0x9e'),'appdata':_0x4823ff[_0xf8dc('0x3d')]+','+(_0x1322a8[_0xf8dc('0x87')][_0xf8dc('0x9f')]||0xa),'interval':_0xf8dc('0x98')});_0x1322a8[_0xf8dc('0xa0')]=![];}return respondWithRpcPromise(_0xf8dc('0xa1'),'startRouting',_0x1322a8);});}return respondWithRpcPromise(_0xf8dc('0xa1'),_0xf8dc('0xa2'),_0x1322a8);})[_0xf8dc('0x24')](function(_0x9b3ea4){respondWithRpcPromise(_0xf8dc('0xa3'),_0xf8dc('0xa3'),{'event':_0xf8dc('0x72'),'message':_0x9b3ea4},client9002);return _0x9b3ea4;})[_0xf8dc('0x24')](respondWithResult(_0xaa9d6c,null))[_0xf8dc('0x2e')](handleError(_0xaa9d6c,null));};exports[_0xf8dc('0xa4')]=function(_0x32e376,_0x260cce,_0x534d1f){return db['OpenchannelAccount'][_0xf8dc('0xa5')]({'where':{'id':_0x32e376[_0xf8dc('0x58')]['id']}})[_0xf8dc('0x24')](handleEntityNotFound(_0x260cce,null))['then'](function(_0x59516f){if(_0x59516f){return db['sequelize'][_0xf8dc('0xa6')](function(_0x2773ea){return db[_0xf8dc('0x84')][_0xf8dc('0x3b')]({'where':{'OpenchannelAccountId':_0x32e376[_0xf8dc('0x58')]['id']},'transaction':_0x2773ea})[_0xf8dc('0x24')](function(_0x1a4426){var _0xe33981=_[_0xf8dc('0x40')](_0x32e376[_0xf8dc('0x63')],function(_0x30c73a){_0x30c73a[_0xf8dc('0x6a')]=_0x32e376[_0xf8dc('0x58')]['id'];return _0x30c73a;});return db[_0xf8dc('0x84')]['bulkCreate'](_0xe33981,{'transaction':_0x2773ea});});})[_0xf8dc('0x24')](function(){return db[_0xf8dc('0x84')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x32e376[_0xf8dc('0x58')]['id']},'order':_0xf8dc('0x8b')});});}})[_0xf8dc('0x24')](respondWithResult(_0x260cce,null))['catch'](handleError(_0x260cce,null));};exports[_0xf8dc('0xa7')]=function(_0x2ef0ca,_0x4ea957,_0x4e5bb0){var _0x3217b7={};var _0xe19d1e={};var _0x5eab09;var _0x445842;return db[_0xf8dc('0x41')][_0xf8dc('0xa5')]({'where':{'id':_0x2ef0ca[_0xf8dc('0x58')]['id']}})['then'](handleEntityNotFound(_0x4ea957,null))[_0xf8dc('0x24')](function(_0xa7448){if(_0xa7448){_0x5eab09=_0xa7448;_0xe19d1e['model']=_[_0xf8dc('0x59')](db[_0xf8dc('0x84')][_0xf8dc('0x42')]);_0xe19d1e[_0xf8dc('0x45')]=_['keys'](_0x2ef0ca['query']);_0xe19d1e[_0xf8dc('0x46')]=_[_0xf8dc('0x48')](_0xe19d1e[_0xf8dc('0x44')],_0xe19d1e[_0xf8dc('0x45')]);_0x3217b7[_0xf8dc('0x47')]=_[_0xf8dc('0x48')](_0xe19d1e[_0xf8dc('0x44')],qs[_0xf8dc('0x49')](_0x2ef0ca['query'][_0xf8dc('0x49')]));_0x3217b7['attributes']=_0x3217b7[_0xf8dc('0x47')][_0xf8dc('0x6f')]?_0x3217b7[_0xf8dc('0x47')]:_0xe19d1e[_0xf8dc('0x44')];_0x3217b7[_0xf8dc('0x69')]=qs['sort'](_0x2ef0ca['query'][_0xf8dc('0x4d')]);_0x3217b7[_0xf8dc('0x4e')]=qs[_0xf8dc('0x46')](_['pick'](_0x2ef0ca['query'],_0xe19d1e[_0xf8dc('0x46')]));if(_0x2ef0ca[_0xf8dc('0x45')][_0xf8dc('0x50')]){_0x3217b7[_0xf8dc('0x4e')]=_[_0xf8dc('0x51')](_0x3217b7[_0xf8dc('0x4e')],{'$or':_[_0xf8dc('0x40')](_0x3217b7[_0xf8dc('0x47')],function(_0x368e54){var _0x4a0319={};_0x4a0319[_0x368e54]={'$like':'%'+_0x2ef0ca[_0xf8dc('0x45')][_0xf8dc('0x50')]+'%'};return _0x4a0319;})});}_0x3217b7=_[_0xf8dc('0x51')]({},_0x3217b7,_0x2ef0ca[_0xf8dc('0x6b')]);return _0x5eab09[_0xf8dc('0xa7')](_0x3217b7);}})[_0xf8dc('0x24')](function(_0x5d2561){if(_0x5d2561){_0x445842=_0x5d2561[_0xf8dc('0x6f')];if(!_0x2ef0ca[_0xf8dc('0x45')][_0xf8dc('0x4a')](_0xf8dc('0x4b'))){_0x3217b7['limit']=qs[_0xf8dc('0x4c')](_0x2ef0ca[_0xf8dc('0x45')][_0xf8dc('0x4c')]);_0x3217b7[_0xf8dc('0x34')]=qs[_0xf8dc('0x34')](_0x2ef0ca['query'][_0xf8dc('0x34')]);}return _0x5eab09[_0xf8dc('0xa7')](_0x3217b7);}})['then'](function(_0x3b5a8f){if(_0x3b5a8f){return _0x3b5a8f?{'count':_0x445842,'rows':_0x3b5a8f}:null;}})[_0xf8dc('0x24')](respondWithResult(_0x4ea957,null))[_0xf8dc('0x2e')](handleError(_0x4ea957,null));};exports[_0xf8dc('0xa8')]=function(_0x5f557f,_0x2b53ed,_0x34807a){var _0x1784b8={'raw':![],'where':{}};var _0x5497e7={};var _0x1713b0={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf8dc('0xa5')]({'where':{'id':_0x5f557f['params']['id']}})[_0xf8dc('0x24')](handleEntityNotFound(_0x2b53ed,null))[_0xf8dc('0x24')](function(_0xf8112a){if(_0xf8112a){_0x5497e7[_0xf8dc('0x44')]=_[_0xf8dc('0x59')](db[_0xf8dc('0x8f')][_0xf8dc('0x42')]);_0x5497e7[_0xf8dc('0x45')]=_['keys'](_0x5f557f[_0xf8dc('0x45')]);_0x5497e7['filters']=_['intersection'](_0x5497e7[_0xf8dc('0x44')],_0x5497e7['query']);_0x1784b8[_0xf8dc('0x47')]=_['intersection'](_0x5497e7['model'],qs[_0xf8dc('0x49')](_0x5f557f['query'][_0xf8dc('0x49')]));_0x1784b8[_0xf8dc('0x47')]=_0x1784b8[_0xf8dc('0x47')][_0xf8dc('0x6f')]?_0x1784b8['attributes']:_0x5497e7[_0xf8dc('0x44')];if(!_0x5f557f[_0xf8dc('0x45')][_0xf8dc('0x4a')](_0xf8dc('0x4b'))){_0x1784b8['limit']=qs[_0xf8dc('0x4c')](_0x5f557f[_0xf8dc('0x45')][_0xf8dc('0x4c')]);_0x1784b8['offset']=qs[_0xf8dc('0x34')](_0x5f557f[_0xf8dc('0x45')][_0xf8dc('0x34')]);}_0x1784b8[_0xf8dc('0x69')]=qs[_0xf8dc('0x4d')](_0x5f557f[_0xf8dc('0x45')]['sort']);_0x1784b8['where']=qs[_0xf8dc('0x46')](_[_0xf8dc('0x4f')](_0x5f557f[_0xf8dc('0x45')],_0x5497e7['filters']));_0x1784b8['where'][_0xf8dc('0x6a')]=_0xf8112a['id'];if(_0x5f557f['query'][_0xf8dc('0x50')]){_0x1784b8[_0xf8dc('0x4e')]=_[_0xf8dc('0x51')](_0x1784b8[_0xf8dc('0x4e')],{'$or':_['map'](_0x1784b8[_0xf8dc('0x47')],function(_0x1629e3){var _0x5ea46c={};_0x5ea46c[_0x1629e3]={'$like':'%'+_0x5f557f[_0xf8dc('0x45')]['filter']+'%'};return _0x5ea46c;})});}_0x1784b8=_[_0xf8dc('0x51')]({},_0x1784b8,_0x5f557f[_0xf8dc('0x6b')]);return db[_0xf8dc('0x8f')]['count']({'where':_0x1784b8['where']})[_0xf8dc('0x24')](function(_0x5ef417){_0x1713b0[_0xf8dc('0x33')]=_0x5ef417;if(_0x5f557f[_0xf8dc('0x45')]['includeAll']){_0x1784b8[_0xf8dc('0x54')]=[{'model':db[_0xf8dc('0x74')],'as':'Contact','required':![]},{'model':db[_0xf8dc('0x9c')],'as':_0xf8dc('0xa9'),'attributes':[_0xf8dc('0x3d'),_0xf8dc('0xaa'),_0xf8dc('0xab')],'required':![]},{'model':db[_0xf8dc('0xac')],'as':_0xf8dc('0xad'),'attributes':['id',_0xf8dc('0x3d'),_0xf8dc('0xae')],'where':_0x5f557f[_0xf8dc('0x45')][_0xf8dc('0xaf')]?{'id':_0x5f557f['query'][_0xf8dc('0xaf')]}:undefined,'required':_0x5f557f[_0xf8dc('0x45')][_0xf8dc('0xaf')]?!![]:![]}];}return db[_0xf8dc('0x8f')][_0xf8dc('0x55')](_0x1784b8);})['then'](function(_0x5b2513){_0x1713b0['rows']=_0x5b2513;return _0x1713b0;});}})[_0xf8dc('0x24')](respondWithFilteredResult(_0x2b53ed,_0x1784b8))[_0xf8dc('0x2e')](handleError(_0x2b53ed,null));};exports[_0xf8dc('0xb0')]=function(_0x389664,_0x4453f5,_0x2db0c2){return db[_0xf8dc('0x41')]['find']({'where':{'id':_0x389664[_0xf8dc('0x58')]['id']}})[_0xf8dc('0x24')](handleEntityNotFound(_0x4453f5,null))['then'](function(_0x400fe4){if(_0x400fe4){return _0x400fe4[_0xf8dc('0xb0')](_0x389664[_0xf8dc('0x63')][_0xf8dc('0x71')],_[_0xf8dc('0xb1')](_0x389664[_0xf8dc('0x63')],[_0xf8dc('0x71'),'id'])||{})['spread'](function(_0x260f4f){for(var _0x5684b4=0x0;_0x5684b4<_0x389664[_0xf8dc('0x63')][_0xf8dc('0x71')][_0xf8dc('0x6f')];_0x5684b4+=0x1){socket[_0xf8dc('0xb2')]('userOpenchannelAccount:save',{'UserId':_0x389664[_0xf8dc('0x63')]['ids'][_0x5684b4],'OpenchannelAccountId':_0x389664['params']['id']});}return _0x260f4f;});}})[_0xf8dc('0x24')](respondWithResult(_0x4453f5,null))['catch'](handleError(_0x4453f5,null));};exports['removeAgents']=function(_0xdda1ca,_0xdbd7e1,_0x360d70){return db[_0xf8dc('0x41')][_0xf8dc('0x5a')]({'where':{'id':_0xdda1ca[_0xf8dc('0x58')]['id']}})[_0xf8dc('0x24')](handleEntityNotFound(_0xdbd7e1,null))['then'](function(_0xd431c0){if(_0xd431c0){return _0xd431c0[_0xf8dc('0xb3')](_0xdda1ca[_0xf8dc('0x45')][_0xf8dc('0x71')])[_0xf8dc('0x24')](function(){if(_[_0xf8dc('0xb4')](_0xdda1ca[_0xf8dc('0x45')][_0xf8dc('0x71')])){for(var _0x26c8cd=0x0;_0x26c8cd<_0xdda1ca['query'][_0xf8dc('0x71')][_0xf8dc('0x6f')];_0x26c8cd+=0x1){socket[_0xf8dc('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0xdda1ca[_0xf8dc('0x45')][_0xf8dc('0x71')][_0x26c8cd]),'OpenchannelAccountId':Number(_0xdda1ca[_0xf8dc('0x58')]['id'])});}}else{socket[_0xf8dc('0xb2')](_0xf8dc('0xb5'),{'UserId':Number(_0xdda1ca[_0xf8dc('0x45')][_0xf8dc('0x71')]),'OpenchannelAccountId':Number(_0xdda1ca[_0xf8dc('0x58')]['id'])});}});}})[_0xf8dc('0x24')](respondWithStatusCode(_0xdbd7e1,null))[_0xf8dc('0x2e')](handleError(_0xdbd7e1,null));};exports[_0xf8dc('0xb6')]=function(_0x4c5aa3,_0x397956,_0xf47db2){var _0x1ee95a={};var _0x2cae36={};var _0x3b3186;var _0x542627;return db[_0xf8dc('0x41')]['findOne']({'where':{'id':_0x4c5aa3[_0xf8dc('0x58')]['id']}})[_0xf8dc('0x24')](handleEntityNotFound(_0x397956,null))[_0xf8dc('0x24')](function(_0xf6e629){if(_0xf6e629){_0x3b3186=_0xf6e629;_0x2cae36[_0xf8dc('0x44')]=_[_0xf8dc('0x59')](db[_0xf8dc('0x9c')]['rawAttributes']);_0x2cae36[_0xf8dc('0x45')]=_['keys'](_0x4c5aa3[_0xf8dc('0x45')]);_0x2cae36[_0xf8dc('0x46')]=_[_0xf8dc('0x48')](_0x2cae36['model'],_0x2cae36['query']);_0x1ee95a[_0xf8dc('0x47')]=_[_0xf8dc('0x48')](_0x2cae36[_0xf8dc('0x44')],qs[_0xf8dc('0x49')](_0x4c5aa3[_0xf8dc('0x45')]['fields']));_0x1ee95a[_0xf8dc('0x47')]=_0x1ee95a[_0xf8dc('0x47')]['length']?_0x1ee95a[_0xf8dc('0x47')]:_0x2cae36['model'];_0x1ee95a[_0xf8dc('0x69')]=qs['sort'](_0x4c5aa3['query']['sort']);_0x1ee95a[_0xf8dc('0x4e')]=qs[_0xf8dc('0x46')](_[_0xf8dc('0x4f')](_0x4c5aa3[_0xf8dc('0x45')],_0x2cae36[_0xf8dc('0x46')]));if(_0x4c5aa3['query']['filter']){_0x1ee95a[_0xf8dc('0x4e')]=_['merge'](_0x1ee95a['where'],{'$or':_[_0xf8dc('0x40')](_0x1ee95a[_0xf8dc('0x47')],function(_0x4f2e43){var _0x3ec243={};_0x3ec243[_0x4f2e43]={'$like':'%'+_0x4c5aa3[_0xf8dc('0x45')][_0xf8dc('0x50')]+'%'};return _0x3ec243;})});}_0x1ee95a=_[_0xf8dc('0x51')]({},_0x1ee95a,_0x4c5aa3[_0xf8dc('0x6b')]);return _0x3b3186[_0xf8dc('0xb6')](_0x1ee95a);}})[_0xf8dc('0x24')](function(_0x346619){if(_0x346619){_0x542627=_0x346619['length'];if(!_0x4c5aa3[_0xf8dc('0x45')]['hasOwnProperty'](_0xf8dc('0x4b'))){_0x1ee95a['limit']=qs[_0xf8dc('0x4c')](_0x4c5aa3['query'][_0xf8dc('0x4c')]);_0x1ee95a[_0xf8dc('0x34')]=qs['offset'](_0x4c5aa3[_0xf8dc('0x45')]['offset']);}return _0x3b3186[_0xf8dc('0xb6')](_0x1ee95a);}})[_0xf8dc('0x24')](function(_0x47b5f8){if(_0x47b5f8){return _0x47b5f8?{'count':_0x542627,'rows':_0x47b5f8}:null;}})[_0xf8dc('0x24')](respondWithResult(_0x397956,null))[_0xf8dc('0x2e')](handleError(_0x397956,null));};exports[_0xf8dc('0xb7')]=function(_0x2f1fc3,_0x3fe02c,_0x52c00d){var _0x182451,_0x1f6c36,_0x4f61c9;if(_['isNil'](_0x2f1fc3[_0xf8dc('0x63')][_0xf8dc('0x63')])||_0x2f1fc3[_0xf8dc('0x63')][_0xf8dc('0x63')]===''){throw new db[(_0xf8dc('0x21'))][(_0xf8dc('0x75'))](_0xf8dc('0x7b'));}if(_['isNil'](_0x2f1fc3[_0xf8dc('0x63')]['to'])){}_0x182451=_0x2f1fc3[_0xf8dc('0x63')]['to'];return db['OpenchannelAccount'][_0xf8dc('0xa5')]({'where':{'id':_0x2f1fc3[_0xf8dc('0x58')]['id']}})[_0xf8dc('0x24')](handleEntityNotFound(_0x3fe02c,null))[_0xf8dc('0x24')](function(_0x5ecec6){if(_0x5ecec6){return db[_0xf8dc('0x41')][_0xf8dc('0x5a')]({'where':{'id':_0x5ecec6['id']},'include':[{'model':db[_0xf8dc('0x81')],'as':_0xf8dc('0x86'),'include':[{'model':db[_0xf8dc('0x74')],'as':_0xf8dc('0x82'),'where':{[_0x5ecec6[_0xf8dc('0x7f')]]:_0x182451},'limit':0x1,'order':[[_0xf8dc('0x78'),_0xf8dc('0x83')]]}]}]})[_0xf8dc('0x24')](handleEntityNotFound(_0x3fe02c,null))['then'](function(_0x1a36d3){if(_0x1a36d3&&_0x1a36d3['List']){_0x1f6c36=_0x1a36d3[_0xf8dc('0x5c')]({'plain':!![]});if(_0x1f6c36[_0xf8dc('0x86')]&&_0x1f6c36[_0xf8dc('0x86')]['Contacts'][_0xf8dc('0x6f')]){return _0x1f6c36[_0xf8dc('0x86')][_0xf8dc('0x82')][0x0];}return db[_0xf8dc('0x74')][_0xf8dc('0x5b')](_[_0xf8dc('0x1a')](_0x2f1fc3[_0xf8dc('0x63')],{'firstName':_0x182451,[_0x1a36d3[_0xf8dc('0x7f')]]:_0x182451,'phone':_0x182451,'ListId':_0x1f6c36[_0xf8dc('0x79')]}));}})[_0xf8dc('0x24')](handleEntityNotFound(_0x3fe02c,null))[_0xf8dc('0x24')](function(_0x2fc271){if(_0x2fc271){_0x4f61c9=_0x2fc271;return db[_0xf8dc('0x8f')][_0xf8dc('0x5a')]({'where':{'ContactId':_0x4f61c9['id'],'closed':![],'OpenchannelAccountId':_0x1f6c36['id']}})[_0xf8dc('0x24')](function(_0x289223){if(_0x289223){return[_0x289223,![]];}return db['OpenchannelInteraction'][_0xf8dc('0x5b')]({'UserId':_0x2f1fc3[_0xf8dc('0x5f')]['id'],'ContactId':_0x4f61c9['id'],'OpenchannelAccountId':_0x1f6c36['id'],'lastMsgDirection':_0xf8dc('0xb8'),'Messages':[_[_0xf8dc('0x51')](_0x2f1fc3['body'],{'read':![],'body':_0x2f1fc3[_0xf8dc('0x63')][_0xf8dc('0x63')],'OpenchannelAccountId':_0x1f6c36['id'],'UserId':_0x2f1fc3['user']['id'],'ContactId':_0x4f61c9['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xf8dc('0xb9')}]})[_0xf8dc('0x24')](function(_0x2a5f30){return[_0x2a5f30,!![]];});});}})[_0xf8dc('0x92')](function(_0x45a111,_0xc76d50){if(_0xc76d50){return _0x45a111;}return db[_0xf8dc('0x99')][_0xf8dc('0x5b')](_['merge'](_0x2f1fc3[_0xf8dc('0x63')],{'read':![],'body':_0x2f1fc3[_0xf8dc('0x63')][_0xf8dc('0x63')],'OpenchannelAccountId':_0x1f6c36['id'],'OpenchannelInteractionId':_0x45a111['id'],'UserId':_0x2f1fc3[_0xf8dc('0x5f')]['id'],'ContactId':_0x4f61c9['id']}))[_0xf8dc('0x24')](function(_0x271058){_0x45a111['dataValues'][_0xf8dc('0xb9')]=[];_0x45a111[_0xf8dc('0xba')][_0xf8dc('0xb9')][_0xf8dc('0x96')](_0x271058[_0xf8dc('0xba')]);return _0x45a111;});});}})[_0xf8dc('0x24')](respondWithResult(_0x3fe02c,null))['catch'](handleError(_0x3fe02c,null));}; \ No newline at end of file +var _0x7d6f=['findOne','CannedAnswer','removeAnswers','notify','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','applications','list','priority','account','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','set','Content-Range','apply','save','update','destroy','get','OpenchannelAccounts','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','limit','order','filters','pick','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','show','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','body','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','nolimit','sort','ids','OpenchannelAccountId','getAnswers'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x7d6f,0x104));var _0xf7d6=function(_0x381568,_0x45619b){_0x381568=_0x381568-0x0;var _0x51e327=_0x7d6f[_0x381568];return _0x51e327;};'use strict';var pdf=require(_0xf7d6('0x0'));var emlformat=require(_0xf7d6('0x1'));var rimraf=require(_0xf7d6('0x2'));var zipdir=require(_0xf7d6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf7d6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf7d6('0x5'));var util=require(_0xf7d6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf7d6('0x7'));var ejs=require(_0xf7d6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf7d6('0x9'));var crypto=require(_0xf7d6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf7d6('0x7'));var querystring=require(_0xf7d6('0xb'));var Papa=require(_0xf7d6('0xc'));var Redis=require(_0xf7d6('0xd'));var authService=require(_0xf7d6('0xe'));var qs=require(_0xf7d6('0xf'));var as=require(_0xf7d6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7d6('0x11'))(_0xf7d6('0x12'));var utils=require('../../config/utils');var config=require(_0xf7d6('0x13'));var db=require('../../mysqldb')['db'];config[_0xf7d6('0x14')]=_[_0xf7d6('0x15')](config['redis'],{'host':_0xf7d6('0x16'),'port':0x18eb});var socket=require(_0xf7d6('0x17'))(new Redis(config[_0xf7d6('0x14')]));require('./openchannelAccount.socket')[_0xf7d6('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf7d6('0x19')][_0xf7d6('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x316682,_0x3dc73f,_0x12a5c0){if(_0x12a5c0){var _0x528451=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x528451[_0xf7d6('0x1b')](_0x3dc73f)){return _0x316682;}else{throw new db[(_0xf7d6('0x1c'))][(_0xf7d6('0x1d'))](_0xf7d6('0x1e'));}}else{return _0x316682;}}function respondWithRpcPromise(_0x57d564,_0xca9ed9,_0x8fc549,_0x5208e6){return new BPromise(function(_0x5eadac,_0x7c3072){var _0x3d2b5e=_0x5208e6||client;return _0x3d2b5e[_0xf7d6('0x1f')](_0x57d564,_0x8fc549)[_0xf7d6('0x20')](function(_0x1fe2b5){logger['info'](_0xf7d6('0x21'),_0xca9ed9,_0xf7d6('0x22'));logger[_0xf7d6('0x23')](_0xf7d6('0x24'),_0xca9ed9,_0xf7d6('0x22'),JSON[_0xf7d6('0x25')](_0x1fe2b5));if(_0x1fe2b5[_0xf7d6('0x26')]){if(_0x1fe2b5[_0xf7d6('0x26')][_0xf7d6('0x27')]===0x1f4){logger[_0xf7d6('0x26')](_0xf7d6('0x21'),_0xca9ed9,_0x1fe2b5[_0xf7d6('0x26')][_0xf7d6('0x28')]);return _0x7c3072(_0x1fe2b5[_0xf7d6('0x26')][_0xf7d6('0x28')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0xca9ed9,_0x1fe2b5['error']['message']);return _0x5eadac(_0x1fe2b5[_0xf7d6('0x26')][_0xf7d6('0x28')]);}else{logger['info'](_0xf7d6('0x21'),_0xca9ed9,_0xf7d6('0x22'));_0x5eadac(_0x1fe2b5[_0xf7d6('0x29')][_0xf7d6('0x28')]);}})[_0xf7d6('0x2a')](function(_0x2ebf1c){logger[_0xf7d6('0x26')](_0xf7d6('0x21'),_0xca9ed9,_0x2ebf1c);_0x7c3072(_0x2ebf1c);});});}function respondWithStatusCode(_0x5b6a23,_0x3464bf){_0x3464bf=_0x3464bf||0xcc;return function(_0x97c786){if(_0x97c786){return _0x5b6a23[_0xf7d6('0x2b')](_0x3464bf);}return _0x5b6a23[_0xf7d6('0x2c')](_0x3464bf)['end']();};}function respondWithResult(_0x525168,_0xd4f3d9){_0xd4f3d9=_0xd4f3d9||0xc8;return function(_0x161aa0){if(_0x161aa0){return _0x525168[_0xf7d6('0x2c')](_0xd4f3d9)[_0xf7d6('0x2d')](_0x161aa0);}};}function respondWithFilteredResult(_0x34c1ad,_0x50ea8d){return function(_0x198c69){if(_0x198c69){var _0x2f929a=_0x198c69['count'],_0x1a7279=_0x50ea8d['offset'],_0x1b9ef1=_0x50ea8d[_0xf7d6('0x2e')]+_0x50ea8d['limit'],_0x4b74ff;if(_0x1b9ef1>=_0x2f929a){_0x1b9ef1=_0x2f929a;_0x4b74ff=0xc8;}else{_0x4b74ff=0xce;}_0x34c1ad[_0xf7d6('0x2c')](_0x4b74ff);return _0x34c1ad[_0xf7d6('0x2f')](_0xf7d6('0x30'),_0x1a7279+'-'+_0x1b9ef1+'/'+_0x2f929a)['json'](_0x198c69);}return null;};}function patchUpdates(_0x29450b){return function(_0x2ad500){try{jsonpatch[_0xf7d6('0x31')](_0x2ad500,_0x29450b,!![]);}catch(_0x4f32f1){return BPromise['reject'](_0x4f32f1);}return _0x2ad500[_0xf7d6('0x32')]();};}function saveUpdates(_0x220b51,_0x31bb37){return function(_0x48d48f){if(_0x48d48f){return _0x48d48f[_0xf7d6('0x33')](_0x220b51)[_0xf7d6('0x20')](function(_0x2255e0){return _0x2255e0;});}return null;};}function removeEntity(_0x5b816d,_0x1266be){return function(_0x386bca){if(_0x386bca){return _0x386bca[_0xf7d6('0x34')]()[_0xf7d6('0x20')](function(){var _0x1f347b=_0x386bca[_0xf7d6('0x35')]({'plain':!![]});var _0x3bd0b3=_0xf7d6('0x36');return db['UserProfileResource'][_0xf7d6('0x34')]({'where':{'type':_0x3bd0b3,'resourceId':_0x1f347b['id']}})[_0xf7d6('0x20')](function(){return _0x386bca;});})[_0xf7d6('0x20')](function(){_0x5b816d[_0xf7d6('0x2c')](0xcc)[_0xf7d6('0x37')]();});}};}function handleEntityNotFound(_0x467f82,_0x5ec6a1){return function(_0x5f5408){if(!_0x5f5408){_0x467f82['sendStatus'](0x194);}return _0x5f5408;};}function handleError(_0x1fb2c4,_0x2a72f4){_0x2a72f4=_0x2a72f4||0x1f4;return function(_0x22b7e6){logger[_0xf7d6('0x26')](_0x22b7e6[_0xf7d6('0x38')]);if(_0x22b7e6[_0xf7d6('0x39')]){delete _0x22b7e6[_0xf7d6('0x39')];}_0x1fb2c4[_0xf7d6('0x2c')](_0x2a72f4)[_0xf7d6('0x3a')](_0x22b7e6);};}exports[_0xf7d6('0x3b')]=function(_0x5f007c,_0x5cc843){var _0x4e77f4={'include':[{'model':db[_0xf7d6('0x3c')],'as':_0xf7d6('0x3d')}]},_0x23b71d={},_0x26999a={'count':0x0,'rows':[]};var _0x1805ee=_[_0xf7d6('0x3e')](db[_0xf7d6('0x3f')][_0xf7d6('0x40')],function(_0x51547b){return{'name':_0x51547b['fieldName'],'type':_0x51547b[_0xf7d6('0x41')][_0xf7d6('0x42')]};});_0x23b71d[_0xf7d6('0x43')]=_['map'](_0x1805ee,_0xf7d6('0x39'));_0x23b71d['query']=_[_0xf7d6('0x44')](_0x5f007c[_0xf7d6('0x45')]);_0x23b71d['filters']=_[_0xf7d6('0x46')](_0x23b71d['model'],_0x23b71d[_0xf7d6('0x45')]);_0x4e77f4[_0xf7d6('0x47')]=_[_0xf7d6('0x46')](_0x23b71d[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x5f007c['query']['fields']));_0x4e77f4['attributes']=_0x4e77f4[_0xf7d6('0x47')]['length']?_0x4e77f4['attributes']:_0x23b71d[_0xf7d6('0x43')];if(!_0x5f007c[_0xf7d6('0x45')][_0xf7d6('0x49')]('nolimit')){_0x4e77f4[_0xf7d6('0x4a')]=qs[_0xf7d6('0x4a')](_0x5f007c[_0xf7d6('0x45')][_0xf7d6('0x4a')]);_0x4e77f4['offset']=qs[_0xf7d6('0x2e')](_0x5f007c[_0xf7d6('0x45')][_0xf7d6('0x2e')]);}_0x4e77f4[_0xf7d6('0x4b')]=qs['sort'](_0x5f007c[_0xf7d6('0x45')]['sort']);_0x4e77f4['where']=qs[_0xf7d6('0x4c')](_[_0xf7d6('0x4d')](_0x5f007c[_0xf7d6('0x45')],_0x23b71d[_0xf7d6('0x4c')]),_0x1805ee);if(_0x5f007c[_0xf7d6('0x45')][_0xf7d6('0x4e')]){_0x4e77f4[_0xf7d6('0x4f')]=_[_0xf7d6('0x50')](_0x4e77f4[_0xf7d6('0x4f')],{'$or':_[_0xf7d6('0x3e')](_0x1805ee,function(_0x3feba4){if(_0x3feba4[_0xf7d6('0x41')]!==_0xf7d6('0x51')){var _0x38d9c4={};_0x38d9c4[_0x3feba4['name']]={'$like':'%'+_0x5f007c[_0xf7d6('0x45')][_0xf7d6('0x4e')]+'%'};return _0x38d9c4;}})});}_0x4e77f4=_[_0xf7d6('0x50')]({},_0x4e77f4,_0x5f007c[_0xf7d6('0x52')]);var _0x4bae9b={'where':_0x4e77f4['where']};return db[_0xf7d6('0x3f')][_0xf7d6('0x53')](_0x4bae9b)[_0xf7d6('0x20')](function(_0x58a072){_0x26999a[_0xf7d6('0x53')]=_0x58a072;if(_0x5f007c[_0xf7d6('0x45')]['includeAll']){_0x4e77f4[_0xf7d6('0x54')]=[{'all':!![]}];}return db[_0xf7d6('0x3f')][_0xf7d6('0x55')](_0x4e77f4);})['then'](function(_0x4109dc){_0x26999a[_0xf7d6('0x56')]=_0x4109dc;return _0x26999a;})[_0xf7d6('0x20')](respondWithFilteredResult(_0x5cc843,_0x4e77f4))[_0xf7d6('0x2a')](handleError(_0x5cc843,null));};exports[_0xf7d6('0x57')]=function(_0x32bca0,_0x271c9b){var _0xff4894={'raw':![],'where':{'id':_0x32bca0[_0xf7d6('0x58')]['id']},'include':[{'model':db[_0xf7d6('0x3c')],'as':_0xf7d6('0x3d')}]},_0x2cdde6={};_0x2cdde6[_0xf7d6('0x43')]=_[_0xf7d6('0x44')](db[_0xf7d6('0x3f')][_0xf7d6('0x40')]);_0x2cdde6['query']=_[_0xf7d6('0x44')](_0x32bca0[_0xf7d6('0x45')]);_0x2cdde6[_0xf7d6('0x4c')]=_[_0xf7d6('0x46')](_0x2cdde6[_0xf7d6('0x43')],_0x2cdde6[_0xf7d6('0x45')]);_0xff4894[_0xf7d6('0x47')]=_['intersection'](_0x2cdde6[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x32bca0[_0xf7d6('0x45')][_0xf7d6('0x48')]));_0xff4894[_0xf7d6('0x47')]=_0xff4894[_0xf7d6('0x47')][_0xf7d6('0x59')]?_0xff4894[_0xf7d6('0x47')]:_0x2cdde6[_0xf7d6('0x43')];if(_0x32bca0[_0xf7d6('0x45')][_0xf7d6('0x5a')]){_0xff4894[_0xf7d6('0x54')]=[{'all':!![]}];}_0xff4894=_[_0xf7d6('0x50')]({},_0xff4894,_0x32bca0[_0xf7d6('0x52')]);return db['OpenchannelAccount'][_0xf7d6('0x5b')](_0xff4894)[_0xf7d6('0x20')](handleEntityNotFound(_0x271c9b,null))[_0xf7d6('0x20')](respondWithResult(_0x271c9b,null))[_0xf7d6('0x2a')](handleError(_0x271c9b,null));};exports[_0xf7d6('0x5c')]=function(_0x7353ad,_0xf84d60){return db[_0xf7d6('0x3f')][_0xf7d6('0x5c')](_0x7353ad['body'],{})[_0xf7d6('0x20')](function(_0x565ed1){var _0x3339cc=_0x7353ad[_0xf7d6('0x5d')]['get']({'plain':!![]});if(!_0x3339cc)throw new Error(_0xf7d6('0x5e'));if(_0x3339cc[_0xf7d6('0x5f')]==='user'){var _0x4ecaf4=_0x565ed1[_0xf7d6('0x35')]({'plain':!![]});var _0x151e84='OpenchannelAccounts';return db['UserProfileSection'][_0xf7d6('0x5b')]({'where':{'name':_0x151e84,'userProfileId':_0x3339cc[_0xf7d6('0x60')]},'raw':!![]})[_0xf7d6('0x20')](function(_0x12efa6){if(_0x12efa6&&_0x12efa6[_0xf7d6('0x61')]===0x0){return db[_0xf7d6('0x62')][_0xf7d6('0x5c')]({'name':_0x4ecaf4[_0xf7d6('0x39')],'resourceId':_0x4ecaf4['id'],'type':_0x12efa6[_0xf7d6('0x39')],'sectionId':_0x12efa6['id']},{})[_0xf7d6('0x20')](function(){return _0x565ed1;});}else{return _0x565ed1;}})[_0xf7d6('0x2a')](function(_0x48475f){logger[_0xf7d6('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48475f);throw _0x48475f;});}return _0x565ed1;})[_0xf7d6('0x20')](respondWithResult(_0xf84d60,0xc9))[_0xf7d6('0x2a')](handleError(_0xf84d60,null));};exports[_0xf7d6('0x33')]=function(_0x24330f,_0x3a0e62){if(_0x24330f[_0xf7d6('0x63')]['id']){delete _0x24330f[_0xf7d6('0x63')]['id'];}return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x24330f[_0xf7d6('0x58')]['id']},'include':[{'model':db[_0xf7d6('0x3c')],'as':_0xf7d6('0x3d')}]})[_0xf7d6('0x20')](handleEntityNotFound(_0x3a0e62,null))['then'](saveUpdates(_0x24330f['body'],null))[_0xf7d6('0x20')](respondWithResult(_0x3a0e62,null))[_0xf7d6('0x2a')](handleError(_0x3a0e62,null));};exports[_0xf7d6('0x34')]=function(_0x3bd855,_0x275b5d){return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x3bd855[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x275b5d,null))[_0xf7d6('0x20')](removeEntity(_0x275b5d,null))[_0xf7d6('0x2a')](handleError(_0x275b5d,null));};exports[_0xf7d6('0x64')]=function(_0x474ef0,_0x4f29b4){return db[_0xf7d6('0x3f')][_0xf7d6('0x64')]()['then'](respondWithResult(_0x4f29b4,null))['catch'](handleError(_0x4f29b4,null));};exports[_0xf7d6('0x65')]=function(_0x417c1d,_0x172fed,_0x2ddcfd){if(_0x417c1d['body']['id']){delete _0x417c1d[_0xf7d6('0x63')]['id'];}return db[_0xf7d6('0x3f')]['find']({'where':{'id':_0x417c1d[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x172fed,null))[_0xf7d6('0x20')](function(_0x2c9f24){if(_0x2c9f24){_0x417c1d[_0xf7d6('0x63')][_0xf7d6('0x66')]=_0x2c9f24['id'];return db[_0xf7d6('0x67')]['create'](_0x417c1d[_0xf7d6('0x63')]);}})[_0xf7d6('0x20')](respondWithResult(_0x172fed,null))[_0xf7d6('0x2a')](handleError(_0x172fed,null));};exports[_0xf7d6('0x68')]=function(_0x54164e,_0x4c0e60,_0x281d24){var _0x32b34d={'raw':![],'where':{}};var _0x4a072e={};var _0x1a6e01={'count':0x0,'rows':[]};return db[_0xf7d6('0x3f')]['findOne']({'where':{'id':_0x54164e[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x4c0e60,null))[_0xf7d6('0x20')](function(_0x175042){if(_0x175042){_0x4a072e[_0xf7d6('0x43')]=_[_0xf7d6('0x44')](db[_0xf7d6('0x67')][_0xf7d6('0x40')]);_0x4a072e[_0xf7d6('0x45')]=_[_0xf7d6('0x44')](_0x54164e[_0xf7d6('0x45')]);_0x4a072e['filters']=_[_0xf7d6('0x46')](_0x4a072e[_0xf7d6('0x43')],_0x4a072e['query']);_0x32b34d[_0xf7d6('0x47')]=_[_0xf7d6('0x46')](_0x4a072e[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x48')]));_0x32b34d['attributes']=_0x32b34d[_0xf7d6('0x47')][_0xf7d6('0x59')]?_0x32b34d[_0xf7d6('0x47')]:_0x4a072e['model'];if(!_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x49')](_0xf7d6('0x69'))){_0x32b34d[_0xf7d6('0x4a')]=qs[_0xf7d6('0x4a')](_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x4a')]);_0x32b34d[_0xf7d6('0x2e')]=qs[_0xf7d6('0x2e')](_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x2e')]);}_0x32b34d['order']=qs[_0xf7d6('0x6a')](_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x6a')]);_0x32b34d[_0xf7d6('0x4f')]=qs[_0xf7d6('0x4c')](_[_0xf7d6('0x4d')](_0x54164e[_0xf7d6('0x45')],_0x4a072e['filters']));_0x32b34d[_0xf7d6('0x4f')]['OpenchannelAccountId']=_0x175042['id'];if(_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x4e')]){_0x32b34d[_0xf7d6('0x4f')]=_[_0xf7d6('0x50')](_0x32b34d[_0xf7d6('0x4f')],{'$or':_[_0xf7d6('0x3e')](_0x32b34d[_0xf7d6('0x47')],function(_0x47934e){var _0x196879={};_0x196879[_0x47934e]={'$like':'%'+_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x4e')]+'%'};return _0x196879;})});}_0x32b34d=_['merge']({},_0x32b34d,_0x54164e[_0xf7d6('0x52')]);return db[_0xf7d6('0x67')][_0xf7d6('0x53')]({'where':_0x32b34d['where']})['then'](function(_0x53575b){_0x1a6e01['count']=_0x53575b;if(_0x54164e[_0xf7d6('0x45')][_0xf7d6('0x5a')]){_0x32b34d['include']=[{'all':!![]}];}return db[_0xf7d6('0x67')][_0xf7d6('0x55')](_0x32b34d);})[_0xf7d6('0x20')](function(_0x5aa159){_0x1a6e01[_0xf7d6('0x56')]=_0x5aa159;return _0x1a6e01;});}})[_0xf7d6('0x20')](respondWithFilteredResult(_0x4c0e60,_0x32b34d))['catch'](handleError(_0x4c0e60,null));};exports['removeDispositions']=function(_0x3072fb,_0x59579a,_0x57bbd5){return db[_0xf7d6('0x3f')]['find']({'where':{'id':_0x3072fb['params']['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x59579a,null))[_0xf7d6('0x20')](function(_0x44e3e5){if(_0x44e3e5){return _0x44e3e5['removeDispositions'](_0x3072fb[_0xf7d6('0x45')][_0xf7d6('0x6b')]);}})['then'](respondWithStatusCode(_0x59579a,null))[_0xf7d6('0x2a')](handleError(_0x59579a,null));};exports['addAnswer']=function(_0x5df76e,_0x5afd31,_0x14fb84){if(_0x5df76e[_0xf7d6('0x63')]['id']){delete _0x5df76e[_0xf7d6('0x63')]['id'];}return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x5df76e['params']['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x5afd31,null))[_0xf7d6('0x20')](function(_0x22af52){if(_0x22af52){_0x5df76e[_0xf7d6('0x63')][_0xf7d6('0x6c')]=_0x22af52['id'];return db['CannedAnswer']['create'](_0x5df76e[_0xf7d6('0x63')]);}})[_0xf7d6('0x20')](respondWithResult(_0x5afd31,null))[_0xf7d6('0x2a')](handleError(_0x5afd31,null));};exports[_0xf7d6('0x6d')]=function(_0x4fa510,_0x20baea,_0xd28a43){var _0x4b6dac={'raw':![],'where':{}};var _0x244d13={};var _0xf9f9da={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf7d6('0x6e')]({'where':{'id':_0x4fa510[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x20baea,null))[_0xf7d6('0x20')](function(_0x2c1f99){if(_0x2c1f99){_0x244d13[_0xf7d6('0x43')]=_['keys'](db['CannedAnswer'][_0xf7d6('0x40')]);_0x244d13[_0xf7d6('0x45')]=_[_0xf7d6('0x44')](_0x4fa510[_0xf7d6('0x45')]);_0x244d13[_0xf7d6('0x4c')]=_['intersection'](_0x244d13[_0xf7d6('0x43')],_0x244d13[_0xf7d6('0x45')]);_0x4b6dac[_0xf7d6('0x47')]=_['intersection'](_0x244d13[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x48')]));_0x4b6dac[_0xf7d6('0x47')]=_0x4b6dac[_0xf7d6('0x47')][_0xf7d6('0x59')]?_0x4b6dac['attributes']:_0x244d13[_0xf7d6('0x43')];if(!_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x49')](_0xf7d6('0x69'))){_0x4b6dac[_0xf7d6('0x4a')]=qs[_0xf7d6('0x4a')](_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x4a')]);_0x4b6dac[_0xf7d6('0x2e')]=qs['offset'](_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x2e')]);}_0x4b6dac[_0xf7d6('0x4b')]=qs[_0xf7d6('0x6a')](_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x6a')]);_0x4b6dac[_0xf7d6('0x4f')]=qs[_0xf7d6('0x4c')](_['pick'](_0x4fa510[_0xf7d6('0x45')],_0x244d13[_0xf7d6('0x4c')]));_0x4b6dac[_0xf7d6('0x4f')][_0xf7d6('0x6c')]=_0x2c1f99['id'];if(_0x4fa510[_0xf7d6('0x45')][_0xf7d6('0x4e')]){_0x4b6dac[_0xf7d6('0x4f')]=_[_0xf7d6('0x50')](_0x4b6dac[_0xf7d6('0x4f')],{'$or':_[_0xf7d6('0x3e')](_0x4b6dac[_0xf7d6('0x47')],function(_0x26dca1){var _0x242246={};_0x242246[_0x26dca1]={'$like':'%'+_0x4fa510[_0xf7d6('0x45')]['filter']+'%'};return _0x242246;})});}_0x4b6dac=_[_0xf7d6('0x50')]({},_0x4b6dac,_0x4fa510[_0xf7d6('0x52')]);return db[_0xf7d6('0x6f')][_0xf7d6('0x53')]({'where':_0x4b6dac[_0xf7d6('0x4f')]})[_0xf7d6('0x20')](function(_0x23e617){_0xf9f9da[_0xf7d6('0x53')]=_0x23e617;if(_0x4fa510[_0xf7d6('0x45')]['includeAll']){_0x4b6dac[_0xf7d6('0x54')]=[{'all':!![]}];}return db[_0xf7d6('0x6f')][_0xf7d6('0x55')](_0x4b6dac);})['then'](function(_0x2a3b49){_0xf9f9da[_0xf7d6('0x56')]=_0x2a3b49;return _0xf9f9da;});}})[_0xf7d6('0x20')](respondWithFilteredResult(_0x20baea,_0x4b6dac))[_0xf7d6('0x2a')](handleError(_0x20baea,null));};exports[_0xf7d6('0x70')]=function(_0x1e53ce,_0x3e78f3,_0x2b2d76){return db['OpenchannelAccount'][_0xf7d6('0x5b')]({'where':{'id':_0x1e53ce['params']['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x3e78f3,null))[_0xf7d6('0x20')](function(_0xfd2ffc){if(_0xfd2ffc){return _0xfd2ffc[_0xf7d6('0x70')](_0x1e53ce[_0xf7d6('0x45')][_0xf7d6('0x6b')]);}})[_0xf7d6('0x20')](respondWithStatusCode(_0x3e78f3,null))['catch'](handleError(_0x3e78f3,null));};exports[_0xf7d6('0x71')]=function(_0x180d05,_0xa89ce9,_0xd9d8db){var _0x1e9b8e={'body':_0x180d05['body'],'channel':'openchannel'};var _0x359419=[];var _0x3ed499=[];var _0x3e5bb4={};var _0x828195=![];return db[_0xf7d6('0x72')][_0xf7d6('0x64')]()[_0xf7d6('0x20')](function(_0xd0e52a){if(!_0xd0e52a){throw new db['Sequelize']['ValidationError'](_0xf7d6('0x73'));}_0x359419=_[_0xf7d6('0x74')](_['keys'](_0xd0e52a),[_0xf7d6('0x75'),_0xf7d6('0x76')]);_0x3ed499=_[_0xf7d6('0x74')](_[_0xf7d6('0x44')](_0xd0e52a),['createdAt','updatedAt',_0xf7d6('0x77'),_0xf7d6('0x78')]);if(_0x180d05['body']['id']){delete _0x180d05[_0xf7d6('0x63')]['id'];}if(_['isNil'](_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x79')])){throw new db[(_0xf7d6('0x1c'))][(_0xf7d6('0x1d'))](_0xf7d6('0x7a'));}if(_[_0xf7d6('0x7b')](_0x180d05[_0xf7d6('0x63')]['body'])||_0x180d05[_0xf7d6('0x63')]['body']===''){throw new db[(_0xf7d6('0x1c'))][(_0xf7d6('0x1d'))](_0xf7d6('0x7c'));}if(_[_0xf7d6('0x7b')](_0x180d05['body'][_0xf7d6('0x7d')])){throw new db[(_0xf7d6('0x1c'))][(_0xf7d6('0x1d'))](_0xf7d6('0x7e')+_0x3ed499);}if(!_['includes'](_0x3ed499,_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x7d')])){throw new db[(_0xf7d6('0x1c'))][(_0xf7d6('0x1d'))](_0xf7d6('0x7f')+_0x3ed499);}_0x3e5bb4[_0x180d05[_0xf7d6('0x63')]['mapKey']]=_0x180d05['body'][_0xf7d6('0x79')];})[_0xf7d6('0x20')](function(){return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x180d05['params']['id']},'include':[{'model':db['CmList'],'as':_0xf7d6('0x80'),'include':[{'model':db[_0xf7d6('0x72')],'as':_0xf7d6('0x81'),'where':_0x3e5bb4,'limit':0x1,'order':[[_0xf7d6('0x76'),_0xf7d6('0x82')]]}]},{'model':db[_0xf7d6('0x83')],'as':_0xf7d6('0x84')}]});})[_0xf7d6('0x20')](handleEntityNotFound(_0xa89ce9,null))[_0xf7d6('0x20')](function(_0x57aa5f){if(_0x57aa5f&&_0x57aa5f[_0xf7d6('0x80')]){_0x1e9b8e['account']=_0x57aa5f;_0x1e9b8e[_0xf7d6('0x85')]=_0x57aa5f[_0xf7d6('0x84')];_0x1e9b8e[_0xf7d6('0x86')]=_0x57aa5f[_0xf7d6('0x80')];_0x1e9b8e[_0xf7d6('0x85')]=_['orderBy'](_0x1e9b8e[_0xf7d6('0x85')],[_0xf7d6('0x87')],['asc']);if(_0x1e9b8e[_0xf7d6('0x88')]['Applications']){delete _0x1e9b8e[_0xf7d6('0x88')][_0xf7d6('0x84')];}if(_0x1e9b8e[_0xf7d6('0x88')]['List']&&_0x1e9b8e['account']['List'][_0xf7d6('0x81')][_0xf7d6('0x59')]){return _0x1e9b8e[_0xf7d6('0x88')][_0xf7d6('0x80')][_0xf7d6('0x81')][0x0];}var _0x25dfe4=_[_0xf7d6('0x15')](_0x180d05[_0xf7d6('0x63')],{'firstName':_0x180d05[_0xf7d6('0x63')]['from'],'ListId':_0x57aa5f['ListId']});_0x25dfe4[_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x7d')]]=_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x79')];return db[_0xf7d6('0x72')][_0xf7d6('0x5c')](_0x25dfe4,{'fields':_0x359419,'raw':!![]});}})['then'](handleEntityNotFound(_0xa89ce9,null))[_0xf7d6('0x20')](function(_0x468ccc){_0x1e9b8e[_0xf7d6('0x89')]=_0x468ccc;if(_0x468ccc){var _0x522ea4={'ContactId':_0x468ccc['id'],'OpenchannelAccountId':_0x180d05[_0xf7d6('0x58')]['id'],'from':(_0x468ccc[_0xf7d6('0x8a')]||'')+'\x20'+(_0x468ccc['lastName']||'')};var _0x500ffc={'OpenchannelAccountId':_0x180d05[_0xf7d6('0x58')]['id'],'closed':![]};if(_0x180d05['body'][_0xf7d6('0x8b')]){_0x500ffc['threadId']=_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8b')];return db[_0xf7d6('0x8c')]['find']({'where':_0x500ffc})[_0xf7d6('0x20')](function(_0x61af24){if(_0x61af24){return[_0x61af24,![]];}_0x522ea4[_0xf7d6('0x8b')]=_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8b')];_0x522ea4['externalUrl']=_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8d')];return db[_0xf7d6('0x8c')][_0xf7d6('0x5c')](_0x522ea4)['then'](function(_0x599392){return[_0x599392,!![]];});});}else{_0x500ffc['threadId']=null;}_0x500ffc['ContactId']=_0x468ccc['id'];return db['OpenchannelInteraction']['find']({'where':_0x500ffc})[_0xf7d6('0x20')](function(_0x333f4a){if(_0x333f4a){return[_0x333f4a,![]];}return db[_0xf7d6('0x8c')]['create'](_0x522ea4)[_0xf7d6('0x20')](function(_0x309694){return[_0x309694,!![]];});});}})[_0xf7d6('0x8e')](function(_0xe7a2a4,_0x3c3c8c){if(_0xe7a2a4){_0x828195=_0x3c3c8c;if(!_0x3c3c8c){var _0x4bf6df={'from':(_0x1e9b8e[_0xf7d6('0x89')][_0xf7d6('0x8a')]||'')+'\x20'+(_0x1e9b8e['contact']['lastName']||'')};if(_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8b')]&&_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8f')]&&_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x8b')]!=_0x180d05[_0xf7d6('0x63')]['messageId']){_0x4bf6df[_0xf7d6('0x8b')]=_0x180d05['body'][_0xf7d6('0x8f')];}return _0xe7a2a4[_0xf7d6('0x33')](_0x4bf6df);}else{return _0xe7a2a4;}}})[_0xf7d6('0x20')](function(_0x387472){_0x1e9b8e[_0xf7d6('0x90')]=_0x387472[_0xf7d6('0x35')]({'plain':!![]});_0x1e9b8e[_0xf7d6('0x90')][_0xf7d6('0x91')]=_0x828195;if(_0x1e9b8e['interaction']['created']){if(_0x1e9b8e[_0xf7d6('0x88')][_0xf7d6('0x92')]){_0x1e9b8e['applications'][_0xf7d6('0x93')]({'id':0x0,'priority':_0x1e9b8e[_0xf7d6('0x85')]['length']+0x1,'app':_0xf7d6('0x94'),'appdata':_0xf7d6('0x95'),'interval':_0xf7d6('0x96')});}}return db[_0xf7d6('0x97')]['create']({'body':_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x63')],'OpenchannelAccountId':_0x180d05[_0xf7d6('0x58')]['id'],'OpenchannelInteractionId':_0x387472['id'],'direction':'in','ContactId':_0x1e9b8e[_0xf7d6('0x89')]['id'],'AttachmentId':_0x180d05[_0xf7d6('0x63')][_0xf7d6('0x98')]});})[_0xf7d6('0x20')](function(_0x254399){_0x1e9b8e[_0xf7d6('0x28')]=_0x254399;if(_0x1e9b8e[_0xf7d6('0x90')]['UserId']){return db[_0xf7d6('0x99')][_0xf7d6('0x5b')]({'attributes':['id','name'],'where':{'id':_0x1e9b8e[_0xf7d6('0x90')]['UserId']}})['then'](function(_0x546adc){if(_0x546adc){_0x1e9b8e[_0xf7d6('0x85')][_0xf7d6('0x9a')]({'id':0x0,'priority':0x0,'app':_0xf7d6('0x9b'),'appdata':_0x546adc[_0xf7d6('0x39')]+','+(_0x1e9b8e[_0xf7d6('0x88')][_0xf7d6('0x9c')]||0xa),'interval':_0xf7d6('0x96')});_0x1e9b8e[_0xf7d6('0x9d')]=![];}return respondWithRpcPromise(_0xf7d6('0x9e'),_0xf7d6('0x9f'),_0x1e9b8e);});}return respondWithRpcPromise(_0xf7d6('0x9e'),_0xf7d6('0x9f'),_0x1e9b8e);})[_0xf7d6('0x20')](function(_0x1a1d42){respondWithRpcPromise(_0xf7d6('0xa0'),_0xf7d6('0xa0'),{'event':_0xf7d6('0x71'),'message':_0x1a1d42},client9002);return _0x1a1d42;})[_0xf7d6('0x20')](respondWithResult(_0xa89ce9,null))[_0xf7d6('0x2a')](handleError(_0xa89ce9,null));};exports[_0xf7d6('0xa1')]=function(_0x23047e,_0x1ba04b,_0x20771a){return db['OpenchannelAccount'][_0xf7d6('0x6e')]({'where':{'id':_0x23047e[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x1ba04b,null))[_0xf7d6('0x20')](function(_0x501366){if(_0x501366){return db[_0xf7d6('0xa2')][_0xf7d6('0xa3')](function(_0x4e629f){return db[_0xf7d6('0x83')][_0xf7d6('0x34')]({'where':{'OpenchannelAccountId':_0x23047e['params']['id']},'transaction':_0x4e629f})['then'](function(_0x2aa553){var _0x413550=_['map'](_0x23047e['body'],function(_0x33e079){_0x33e079[_0xf7d6('0x6c')]=_0x23047e['params']['id'];return _0x33e079;});return db[_0xf7d6('0x83')][_0xf7d6('0xa4')](_0x413550,{'transaction':_0x4e629f});});})[_0xf7d6('0x20')](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x23047e[_0xf7d6('0x58')]['id']},'order':_0xf7d6('0x87')});});}})[_0xf7d6('0x20')](respondWithResult(_0x1ba04b,null))[_0xf7d6('0x2a')](handleError(_0x1ba04b,null));};exports[_0xf7d6('0xa5')]=function(_0x347836,_0x23368f,_0xbae4e2){var _0x38b176={};var _0x4f5b4f={};var _0x260eb5;var _0x427344;return db[_0xf7d6('0x3f')][_0xf7d6('0x6e')]({'where':{'id':_0x347836['params']['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x23368f,null))[_0xf7d6('0x20')](function(_0x26e5c7){if(_0x26e5c7){_0x260eb5=_0x26e5c7;_0x4f5b4f[_0xf7d6('0x43')]=_[_0xf7d6('0x44')](db[_0xf7d6('0x83')]['rawAttributes']);_0x4f5b4f[_0xf7d6('0x45')]=_[_0xf7d6('0x44')](_0x347836[_0xf7d6('0x45')]);_0x4f5b4f['filters']=_['intersection'](_0x4f5b4f[_0xf7d6('0x43')],_0x4f5b4f[_0xf7d6('0x45')]);_0x38b176[_0xf7d6('0x47')]=_['intersection'](_0x4f5b4f[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x347836[_0xf7d6('0x45')][_0xf7d6('0x48')]));_0x38b176['attributes']=_0x38b176[_0xf7d6('0x47')][_0xf7d6('0x59')]?_0x38b176['attributes']:_0x4f5b4f[_0xf7d6('0x43')];_0x38b176['order']=qs[_0xf7d6('0x6a')](_0x347836[_0xf7d6('0x45')][_0xf7d6('0x6a')]);_0x38b176[_0xf7d6('0x4f')]=qs[_0xf7d6('0x4c')](_[_0xf7d6('0x4d')](_0x347836['query'],_0x4f5b4f[_0xf7d6('0x4c')]));if(_0x347836['query'][_0xf7d6('0x4e')]){_0x38b176[_0xf7d6('0x4f')]=_[_0xf7d6('0x50')](_0x38b176[_0xf7d6('0x4f')],{'$or':_[_0xf7d6('0x3e')](_0x38b176[_0xf7d6('0x47')],function(_0x41f062){var _0x3b7a60={};_0x3b7a60[_0x41f062]={'$like':'%'+_0x347836[_0xf7d6('0x45')]['filter']+'%'};return _0x3b7a60;})});}_0x38b176=_['merge']({},_0x38b176,_0x347836['options']);return _0x260eb5[_0xf7d6('0xa5')](_0x38b176);}})[_0xf7d6('0x20')](function(_0xeaf723){if(_0xeaf723){_0x427344=_0xeaf723['length'];if(!_0x347836['query']['hasOwnProperty'](_0xf7d6('0x69'))){_0x38b176['limit']=qs['limit'](_0x347836[_0xf7d6('0x45')][_0xf7d6('0x4a')]);_0x38b176[_0xf7d6('0x2e')]=qs['offset'](_0x347836[_0xf7d6('0x45')][_0xf7d6('0x2e')]);}return _0x260eb5[_0xf7d6('0xa5')](_0x38b176);}})[_0xf7d6('0x20')](function(_0x19c1e3){if(_0x19c1e3){return _0x19c1e3?{'count':_0x427344,'rows':_0x19c1e3}:null;}})[_0xf7d6('0x20')](respondWithResult(_0x23368f,null))['catch'](handleError(_0x23368f,null));};exports[_0xf7d6('0xa6')]=function(_0x5c3d50,_0x4dd3d3,_0x57a086){var _0x5a7c80={'raw':![],'where':{}};var _0x36f3eb={};var _0x43cb24={'count':0x0,'rows':[]};return db[_0xf7d6('0x3f')][_0xf7d6('0x6e')]({'where':{'id':_0x5c3d50[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x4dd3d3,null))[_0xf7d6('0x20')](function(_0x326fcb){if(_0x326fcb){_0x36f3eb[_0xf7d6('0x43')]=_[_0xf7d6('0x44')](db[_0xf7d6('0x8c')][_0xf7d6('0x40')]);_0x36f3eb[_0xf7d6('0x45')]=_[_0xf7d6('0x44')](_0x5c3d50[_0xf7d6('0x45')]);_0x36f3eb['filters']=_[_0xf7d6('0x46')](_0x36f3eb[_0xf7d6('0x43')],_0x36f3eb[_0xf7d6('0x45')]);_0x5a7c80[_0xf7d6('0x47')]=_[_0xf7d6('0x46')](_0x36f3eb[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x5c3d50['query'][_0xf7d6('0x48')]));_0x5a7c80[_0xf7d6('0x47')]=_0x5a7c80[_0xf7d6('0x47')][_0xf7d6('0x59')]?_0x5a7c80[_0xf7d6('0x47')]:_0x36f3eb['model'];if(!_0x5c3d50[_0xf7d6('0x45')]['hasOwnProperty'](_0xf7d6('0x69'))){_0x5a7c80['limit']=qs[_0xf7d6('0x4a')](_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0x4a')]);_0x5a7c80['offset']=qs[_0xf7d6('0x2e')](_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0x2e')]);}_0x5a7c80[_0xf7d6('0x4b')]=qs[_0xf7d6('0x6a')](_0x5c3d50[_0xf7d6('0x45')]['sort']);_0x5a7c80[_0xf7d6('0x4f')]=qs[_0xf7d6('0x4c')](_[_0xf7d6('0x4d')](_0x5c3d50['query'],_0x36f3eb[_0xf7d6('0x4c')]));_0x5a7c80['where'][_0xf7d6('0x6c')]=_0x326fcb['id'];if(_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0x4e')]){_0x5a7c80[_0xf7d6('0x4f')]=_[_0xf7d6('0x50')](_0x5a7c80[_0xf7d6('0x4f')],{'$or':_['map'](_0x5a7c80[_0xf7d6('0x47')],function(_0x57e0b8){var _0x8b21b6={};_0x8b21b6[_0x57e0b8]={'$like':'%'+_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0x4e')]+'%'};return _0x8b21b6;})});}_0x5a7c80=_[_0xf7d6('0x50')]({},_0x5a7c80,_0x5c3d50[_0xf7d6('0x52')]);return db[_0xf7d6('0x8c')][_0xf7d6('0x53')]({'where':_0x5a7c80[_0xf7d6('0x4f')]})[_0xf7d6('0x20')](function(_0xa8b42){_0x43cb24[_0xf7d6('0x53')]=_0xa8b42;if(_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0x5a')]){_0x5a7c80[_0xf7d6('0x54')]=[{'model':db[_0xf7d6('0x72')],'as':_0xf7d6('0xa7'),'required':![]},{'model':db['User'],'as':_0xf7d6('0xa8'),'attributes':[_0xf7d6('0x39'),_0xf7d6('0xa9'),_0xf7d6('0xaa')],'required':![]},{'model':db['Tag'],'as':_0xf7d6('0xab'),'attributes':['id','name',_0xf7d6('0xac')],'where':_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0xad')]?{'id':_0x5c3d50['query'][_0xf7d6('0xad')]}:undefined,'required':_0x5c3d50[_0xf7d6('0x45')][_0xf7d6('0xad')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x5a7c80);})[_0xf7d6('0x20')](function(_0x52eb26){_0x43cb24['rows']=_0x52eb26;return _0x43cb24;});}})[_0xf7d6('0x20')](respondWithFilteredResult(_0x4dd3d3,_0x5a7c80))['catch'](handleError(_0x4dd3d3,null));};exports[_0xf7d6('0xae')]=function(_0x18569b,_0x50e6be,_0x4b4fff){return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x18569b[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x50e6be,null))[_0xf7d6('0x20')](function(_0x3f0a1a){if(_0x3f0a1a){return _0x3f0a1a[_0xf7d6('0xae')](_0x18569b['body'][_0xf7d6('0x6b')],_[_0xf7d6('0xaf')](_0x18569b[_0xf7d6('0x63')],[_0xf7d6('0x6b'),'id'])||{})[_0xf7d6('0x8e')](function(_0x20db37){for(var _0x1e2e4c=0x0;_0x1e2e4c<_0x18569b[_0xf7d6('0x63')]['ids'][_0xf7d6('0x59')];_0x1e2e4c+=0x1){socket[_0xf7d6('0xb0')](_0xf7d6('0xb1'),{'UserId':_0x18569b[_0xf7d6('0x63')]['ids'][_0x1e2e4c],'OpenchannelAccountId':_0x18569b['params']['id']});}return _0x20db37;});}})['then'](respondWithResult(_0x50e6be,null))['catch'](handleError(_0x50e6be,null));};exports[_0xf7d6('0xb2')]=function(_0x158605,_0x172d98,_0x275e6c){return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x158605[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x172d98,null))[_0xf7d6('0x20')](function(_0x249d67){if(_0x249d67){return _0x249d67[_0xf7d6('0xb2')](_0x158605['query']['ids'])['then'](function(){if(_[_0xf7d6('0xb3')](_0x158605[_0xf7d6('0x45')][_0xf7d6('0x6b')])){for(var _0x19bbb5=0x0;_0x19bbb5<_0x158605[_0xf7d6('0x45')][_0xf7d6('0x6b')][_0xf7d6('0x59')];_0x19bbb5+=0x1){socket[_0xf7d6('0xb0')]('userOpenchannelAccount:remove',{'UserId':Number(_0x158605[_0xf7d6('0x45')][_0xf7d6('0x6b')][_0x19bbb5]),'OpenchannelAccountId':Number(_0x158605[_0xf7d6('0x58')]['id'])});}}else{socket[_0xf7d6('0xb0')](_0xf7d6('0xb4'),{'UserId':Number(_0x158605[_0xf7d6('0x45')][_0xf7d6('0x6b')]),'OpenchannelAccountId':Number(_0x158605['params']['id'])});}});}})['then'](respondWithStatusCode(_0x172d98,null))[_0xf7d6('0x2a')](handleError(_0x172d98,null));};exports[_0xf7d6('0xb5')]=function(_0x316b72,_0x596e30,_0x30fc0c){var _0x2648de={};var _0x5a9afa={};var _0xa4eb58;var _0x398147;return db[_0xf7d6('0x3f')][_0xf7d6('0x6e')]({'where':{'id':_0x316b72[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x596e30,null))[_0xf7d6('0x20')](function(_0x48e5d0){if(_0x48e5d0){_0xa4eb58=_0x48e5d0;_0x5a9afa[_0xf7d6('0x43')]=_[_0xf7d6('0x44')](db[_0xf7d6('0x99')][_0xf7d6('0x40')]);_0x5a9afa[_0xf7d6('0x45')]=_[_0xf7d6('0x44')](_0x316b72[_0xf7d6('0x45')]);_0x5a9afa[_0xf7d6('0x4c')]=_[_0xf7d6('0x46')](_0x5a9afa['model'],_0x5a9afa[_0xf7d6('0x45')]);_0x2648de[_0xf7d6('0x47')]=_[_0xf7d6('0x46')](_0x5a9afa[_0xf7d6('0x43')],qs[_0xf7d6('0x48')](_0x316b72['query']['fields']));_0x2648de['attributes']=_0x2648de['attributes'][_0xf7d6('0x59')]?_0x2648de[_0xf7d6('0x47')]:_0x5a9afa[_0xf7d6('0x43')];_0x2648de[_0xf7d6('0x4b')]=qs[_0xf7d6('0x6a')](_0x316b72[_0xf7d6('0x45')][_0xf7d6('0x6a')]);_0x2648de[_0xf7d6('0x4f')]=qs[_0xf7d6('0x4c')](_[_0xf7d6('0x4d')](_0x316b72['query'],_0x5a9afa[_0xf7d6('0x4c')]));if(_0x316b72[_0xf7d6('0x45')][_0xf7d6('0x4e')]){_0x2648de['where']=_[_0xf7d6('0x50')](_0x2648de[_0xf7d6('0x4f')],{'$or':_[_0xf7d6('0x3e')](_0x2648de[_0xf7d6('0x47')],function(_0x3ff6ab){var _0x188d5e={};_0x188d5e[_0x3ff6ab]={'$like':'%'+_0x316b72[_0xf7d6('0x45')][_0xf7d6('0x4e')]+'%'};return _0x188d5e;})});}_0x2648de=_[_0xf7d6('0x50')]({},_0x2648de,_0x316b72[_0xf7d6('0x52')]);return _0xa4eb58[_0xf7d6('0xb5')](_0x2648de);}})[_0xf7d6('0x20')](function(_0x9159fd){if(_0x9159fd){_0x398147=_0x9159fd[_0xf7d6('0x59')];if(!_0x316b72['query'][_0xf7d6('0x49')](_0xf7d6('0x69'))){_0x2648de['limit']=qs[_0xf7d6('0x4a')](_0x316b72[_0xf7d6('0x45')]['limit']);_0x2648de[_0xf7d6('0x2e')]=qs['offset'](_0x316b72[_0xf7d6('0x45')]['offset']);}return _0xa4eb58[_0xf7d6('0xb5')](_0x2648de);}})['then'](function(_0x33ed33){if(_0x33ed33){return _0x33ed33?{'count':_0x398147,'rows':_0x33ed33}:null;}})[_0xf7d6('0x20')](respondWithResult(_0x596e30,null))[_0xf7d6('0x2a')](handleError(_0x596e30,null));};exports[_0xf7d6('0x3a')]=function(_0xb0ffc,_0x44aec1,_0xa01d24){var _0x4179ab,_0x881e1a,_0x540cf8;if(_[_0xf7d6('0x7b')](_0xb0ffc[_0xf7d6('0x63')][_0xf7d6('0x63')])||_0xb0ffc['body']['body']===''){throw new db[(_0xf7d6('0x1c'))]['ValidationError'](_0xf7d6('0x7c'));}if(_['isNil'](_0xb0ffc['body']['to'])){}_0x4179ab=_0xb0ffc[_0xf7d6('0x63')]['to'];return db[_0xf7d6('0x3f')][_0xf7d6('0x6e')]({'where':{'id':_0xb0ffc[_0xf7d6('0x58')]['id']}})[_0xf7d6('0x20')](handleEntityNotFound(_0x44aec1,null))[_0xf7d6('0x20')](function(_0x4354fe){if(_0x4354fe){return db[_0xf7d6('0x3f')][_0xf7d6('0x5b')]({'where':{'id':_0x4354fe['id']},'include':[{'model':db['CmList'],'as':_0xf7d6('0x80'),'include':[{'model':db['CmContact'],'as':_0xf7d6('0x81'),'where':{[_0x4354fe[_0xf7d6('0x7d')]]:_0x4179ab},'limit':0x1,'order':[[_0xf7d6('0x76'),_0xf7d6('0x82')]]}]}]})[_0xf7d6('0x20')](handleEntityNotFound(_0x44aec1,null))[_0xf7d6('0x20')](function(_0x50f2f6){if(_0x50f2f6&&_0x50f2f6[_0xf7d6('0x80')]){_0x881e1a=_0x50f2f6[_0xf7d6('0x35')]({'plain':!![]});if(_0x881e1a[_0xf7d6('0x80')]&&_0x881e1a[_0xf7d6('0x80')]['Contacts'][_0xf7d6('0x59')]){return _0x881e1a[_0xf7d6('0x80')][_0xf7d6('0x81')][0x0];}return db[_0xf7d6('0x72')][_0xf7d6('0x5c')](_[_0xf7d6('0x15')](_0xb0ffc[_0xf7d6('0x63')],{'firstName':_0x4179ab,[_0x50f2f6[_0xf7d6('0x7d')]]:_0x4179ab,'phone':_0x4179ab,'ListId':_0x881e1a[_0xf7d6('0x78')]}));}})['then'](handleEntityNotFound(_0x44aec1,null))['then'](function(_0x3c0fea){if(_0x3c0fea){_0x540cf8=_0x3c0fea;return db[_0xf7d6('0x8c')][_0xf7d6('0x5b')]({'where':{'ContactId':_0x540cf8['id'],'closed':![],'OpenchannelAccountId':_0x881e1a['id']}})['then'](function(_0x1007a7){if(_0x1007a7){return[_0x1007a7,![]];}return db[_0xf7d6('0x8c')][_0xf7d6('0x5c')]({'UserId':_0xb0ffc[_0xf7d6('0x5d')]['id'],'ContactId':_0x540cf8['id'],'OpenchannelAccountId':_0x881e1a['id'],'lastMsgDirection':_0xf7d6('0xb6'),'Messages':[_[_0xf7d6('0x50')](_0xb0ffc[_0xf7d6('0x63')],{'read':![],'body':_0xb0ffc[_0xf7d6('0x63')][_0xf7d6('0x63')],'OpenchannelAccountId':_0x881e1a['id'],'UserId':_0xb0ffc[_0xf7d6('0x5d')]['id'],'ContactId':_0x540cf8['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xf7d6('0xb7')}]})[_0xf7d6('0x20')](function(_0x2ab26d){return[_0x2ab26d,!![]];});});}})['spread'](function(_0x401a8f,_0x2d168f){if(_0x2d168f){return _0x401a8f;}return db[_0xf7d6('0x97')][_0xf7d6('0x5c')](_['merge'](_0xb0ffc[_0xf7d6('0x63')],{'read':![],'body':_0xb0ffc[_0xf7d6('0x63')][_0xf7d6('0x63')],'OpenchannelAccountId':_0x881e1a['id'],'OpenchannelInteractionId':_0x401a8f['id'],'UserId':_0xb0ffc['user']['id'],'ContactId':_0x540cf8['id']}))[_0xf7d6('0x20')](function(_0x4f7855){_0x401a8f['dataValues'][_0xf7d6('0xb7')]=[];_0x401a8f[_0xf7d6('0xb8')][_0xf7d6('0xb7')][_0xf7d6('0x93')](_0x4f7855[_0xf7d6('0xb8')]);return _0x401a8f;});});}})[_0xf7d6('0x20')](respondWithResult(_0x44aec1,null))[_0xf7d6('0x2a')](handleError(_0x44aec1,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 14eecac..a697258 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 _0xaae0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xaae0,0x68));var _0x0aae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaae0[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x0aae('0x0'));var OpenchannelAccount=require(_0x0aae('0x1'))['db'][_0x0aae('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0aae('0x3'),'afterUpdate':_0x0aae('0x4'),'afterDestroy':_0x0aae('0x5')};function emitEvent(_0x3cf1b6){return function(_0x558af6,_0x55a9e7,_0x2d26e2){OpenchannelAccountEvents[_0x0aae('0x6')](_0x3cf1b6+':'+_0x558af6['id'],_0x558af6);OpenchannelAccountEvents[_0x0aae('0x6')](_0x3cf1b6,_0x558af6);_0x2d26e2(null);};}for(var e in events){if(events[_0x0aae('0x7')](e)){var event=events[e];OpenchannelAccount[_0x0aae('0x8')](e,emitEvent(event));}}module[_0x0aae('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xd433=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd433,0xe2));var _0x3d43=function(_0x34c6d1,_0x5a42b0){_0x34c6d1=_0x34c6d1-0x0;var _0x922a38=_0xd433[_0x34c6d1];return _0x922a38;};'use strict';var EventEmitter=require(_0x3d43('0x0'));var OpenchannelAccount=require(_0x3d43('0x1'))['db'][_0x3d43('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x3d43('0x3')](0x0);var events={'afterCreate':_0x3d43('0x4'),'afterUpdate':_0x3d43('0x5'),'afterDestroy':_0x3d43('0x6')};function emitEvent(_0x1f5e0e){return function(_0x1f3efc,_0x28fc39,_0x2a6fd5){OpenchannelAccountEvents[_0x3d43('0x7')](_0x1f5e0e+':'+_0x1f3efc['id'],_0x1f3efc);OpenchannelAccountEvents[_0x3d43('0x7')](_0x1f5e0e,_0x1f3efc);_0x2a6fd5(null);};}for(var e in events){if(events[_0x3d43('0x8')](e)){var event=events[e];OpenchannelAccount[_0x3d43('0x9')](e,emitEvent(event));}}module[_0x3d43('0xa')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 3bc1507..b2894be 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 _0x3988=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x24c572,_0x1b0501){var _0x26dd5d=function(_0x23b6fd){while(--_0x23b6fd){_0x24c572['push'](_0x24c572['shift']());}};_0x26dd5d(++_0x1b0501);}(_0x3988,0x1f4));var _0x8398=function(_0x1738d9,_0x47507a){_0x1738d9=_0x1738d9-0x0;var _0x48db10=_0x3988[_0x1738d9];return _0x48db10;};'use strict';var _=require(_0x8398('0x0'));var util=require(_0x8398('0x1'));var logger=require('../../config/logger')(_0x8398('0x2'));var moment=require(_0x8398('0x3'));var BPromise=require(_0x8398('0x4'));var rp=require(_0x8398('0x5'));var fs=require('fs');var path=require(_0x8398('0x6'));var rimraf=require('rimraf');var config=require(_0x8398('0x7'));var attributes=require(_0x8398('0x8'));module[_0x8398('0x9')]=function(_0xab04bc,_0x584ac1){return _0xab04bc[_0x8398('0xa')](_0x8398('0xb'),attributes,{'tableName':_0x8398('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ccf=['rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x3b11e0,_0x1bd26c){var _0x4bc5f8=function(_0xb03375){while(--_0xb03375){_0x3b11e0['push'](_0x3b11e0['shift']());}};_0x4bc5f8(++_0x1bd26c);}(_0x9ccf,0xbb));var _0xf9cc=function(_0x458959,_0x4cdf7a){_0x458959=_0x458959-0x0;var _0xde7ff6=_0x9ccf[_0x458959];return _0xde7ff6;};'use strict';var _=require(_0xf9cc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf9cc('0x1'));var moment=require(_0xf9cc('0x2'));var BPromise=require(_0xf9cc('0x3'));var rp=require(_0xf9cc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9cc('0x5'));var config=require(_0xf9cc('0x6'));var attributes=require(_0xf9cc('0x7'));module[_0xf9cc('0x8')]=function(_0x421e7d,_0x57e6f1){return _0x421e7d[_0xf9cc('0x9')](_0xf9cc('0xa'),attributes,{'tableName':_0xf9cc('0xb'),'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 0df28c1..0edcc58 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 _0xc358=['../../config/logger','../../config/environment','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x2d4ede,_0x1212c3){var _0x39da2c=function(_0x46daf0){while(--_0x46daf0){_0x2d4ede['push'](_0x2d4ede['shift']());}};_0x39da2c(++_0x1212c3);}(_0xc358,0x194));var _0x8c35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc358[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c35('0x0'));var BPromise=require(_0x8c35('0x1'));var rs=require(_0x8c35('0x2'));var fs=require('fs');var Redis=require(_0x8c35('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8c35('0x4'))('rpc');var config=require(_0x8c35('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8c35('0x6')][_0x8c35('0x7')]({'port':0x232a});config['redis']=_[_0x8c35('0x8')](config[_0x8c35('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c35('0xa'))(new Redis(config['redis']));require(_0x8c35('0xb'))[_0x8c35('0xc')](socket);function respondWithRpcPromise(_0x2c5afd,_0x4095c1,_0x234d49){return new BPromise(function(_0x35e6e5,_0x99e31b){return client[_0x8c35('0xd')](_0x2c5afd,_0x234d49)[_0x8c35('0xe')](function(_0x5dd05f){logger[_0x8c35('0xf')](_0x8c35('0x10'),_0x4095c1,_0x8c35('0x11'));logger['debug'](_0x8c35('0x12'),_0x4095c1,'request\x20sent',JSON[_0x8c35('0x13')](_0x5dd05f));if(_0x5dd05f[_0x8c35('0x14')]){if(_0x5dd05f['error']['code']===0x1f4){logger['error'](_0x8c35('0x10'),_0x4095c1,_0x5dd05f[_0x8c35('0x14')][_0x8c35('0x15')]);return _0x99e31b(_0x5dd05f[_0x8c35('0x14')][_0x8c35('0x15')]);}logger[_0x8c35('0x14')](_0x8c35('0x10'),_0x4095c1,_0x5dd05f[_0x8c35('0x14')][_0x8c35('0x15')]);return _0x35e6e5(_0x5dd05f['error'][_0x8c35('0x15')]);}else{logger[_0x8c35('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x4095c1,_0x8c35('0x11'));_0x35e6e5(_0x5dd05f[_0x8c35('0x16')]['message']);}})[_0x8c35('0x17')](function(_0xe76f16){logger[_0x8c35('0x14')](_0x8c35('0x10'),_0x4095c1,_0xe76f16);_0x99e31b(_0xe76f16);});});} \ No newline at end of file +var _0xc69c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x46688a,_0x52b8d4){var _0x4b7d58=function(_0x385c0b){while(--_0x385c0b){_0x46688a['push'](_0x46688a['shift']());}};_0x4b7d58(++_0x52b8d4);}(_0xc69c,0x190));var _0xcc69=function(_0x226e5b,_0x4935ed){_0x226e5b=_0x226e5b-0x0;var _0x3c44d3=_0xc69c[_0x226e5b];return _0x3c44d3;};'use strict';var _=require(_0xcc69('0x0'));var util=require(_0xcc69('0x1'));var moment=require(_0xcc69('0x2'));var BPromise=require(_0xcc69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc69('0x4'))['db'];var utils=require(_0xcc69('0x5'));var logger=require(_0xcc69('0x6'))(_0xcc69('0x7'));var config=require(_0xcc69('0x8'));var jayson=require(_0xcc69('0x9'));var client=jayson[_0xcc69('0xa')]['http']({'port':0x232a});config['redis']=_[_0xcc69('0xb')](config[_0xcc69('0xc')],{'host':_0xcc69('0xd'),'port':0x18eb});var socket=require(_0xcc69('0xe'))(new Redis(config['redis']));require(_0xcc69('0xf'))[_0xcc69('0x10')](socket);function respondWithRpcPromise(_0x265c26,_0x254e7e,_0x317048){return new BPromise(function(_0x452523,_0x21980b){return client['request'](_0x265c26,_0x317048)['then'](function(_0x27aeeb){logger[_0xcc69('0x11')](_0xcc69('0x12'),_0x254e7e,_0xcc69('0x13'));logger[_0xcc69('0x14')](_0xcc69('0x15'),_0x254e7e,_0xcc69('0x13'),JSON[_0xcc69('0x16')](_0x27aeeb));if(_0x27aeeb[_0xcc69('0x17')]){if(_0x27aeeb['error']['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x254e7e,_0x27aeeb['error'][_0xcc69('0x18')]);return _0x21980b(_0x27aeeb[_0xcc69('0x17')][_0xcc69('0x18')]);}logger[_0xcc69('0x17')](_0xcc69('0x12'),_0x254e7e,_0x27aeeb[_0xcc69('0x17')][_0xcc69('0x18')]);return _0x452523(_0x27aeeb[_0xcc69('0x17')]['message']);}else{logger[_0xcc69('0x11')](_0xcc69('0x12'),_0x254e7e,'request\x20sent');_0x452523(_0x27aeeb[_0xcc69('0x19')]['message']);}})[_0xcc69('0x1a')](function(_0x4dd351){logger[_0xcc69('0x17')](_0xcc69('0x12'),_0x254e7e,_0x4dd351);_0x21980b(_0x4dd351);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ec91a77..c7d4cbe 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 _0xb126=['save','remove','emit','removeListener','register','length','./openchannelAccount.events'];(function(_0x3c6975,_0x518aad){var _0x45c44a=function(_0x3f1920){while(--_0x3f1920){_0x3c6975['push'](_0x3c6975['shift']());}};_0x45c44a(++_0x518aad);}(_0xb126,0x92));var _0x6b12=function(_0x4fd28a,_0x5b64bc){_0x4fd28a=_0x4fd28a-0x0;var _0x124ae4=_0xb126[_0x4fd28a];return _0x124ae4;};'use strict';var OpenchannelAccountEvents=require(_0x6b12('0x0'));var events=[_0x6b12('0x1'),_0x6b12('0x2'),'update'];function createListener(_0x470ad8,_0x2c6779){return function(_0x2d1de6){_0x2c6779[_0x6b12('0x3')](_0x470ad8,_0x2d1de6);};}function removeListener(_0xc4713b,_0x2f63d0){return function(){OpenchannelAccountEvents[_0x6b12('0x4')](_0xc4713b,_0x2f63d0);};}exports[_0x6b12('0x5')]=function(_0x346bd6){for(var _0x1dee40=0x0,_0x5e7caa=events[_0x6b12('0x6')];_0x1dee40<_0x5e7caa;_0x1dee40++){var _0x1b1720=events[_0x1dee40];var _0x155983=createListener('openchannelAccount:'+_0x1b1720,_0x346bd6);OpenchannelAccountEvents['on'](_0x1b1720,_0x155983);}}; \ No newline at end of file +var _0x1a4d=['length','openchannelAccount:','update','emit','register'];(function(_0x5e2c70,_0x108e64){var _0x1e6cbc=function(_0x46e5fd){while(--_0x46e5fd){_0x5e2c70['push'](_0x5e2c70['shift']());}};_0x1e6cbc(++_0x108e64);}(_0x1a4d,0xc0));var _0xd1a4=function(_0xcc7ca9,_0x5a1bab){_0xcc7ca9=_0xcc7ca9-0x0;var _0x87a113=_0x1a4d[_0xcc7ca9];return _0x87a113;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save','remove',_0xd1a4('0x0')];function createListener(_0x285f64,_0x16db98){return function(_0x50c978){_0x16db98[_0xd1a4('0x1')](_0x285f64,_0x50c978);};}function removeListener(_0x39a591,_0x323f34){return function(){OpenchannelAccountEvents['removeListener'](_0x39a591,_0x323f34);};}exports[_0xd1a4('0x2')]=function(_0x40caf1){for(var _0x26e960=0x0,_0x187ba9=events[_0xd1a4('0x3')];_0x26e960<_0x187ba9;_0x26e960++){var _0x465eb1=events[_0x26e960];var _0x38505f=createListener(_0xd1a4('0x4')+_0x465eb1,_0x40caf1);OpenchannelAccountEvents['on'](_0x465eb1,_0x38505f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index b0fd668..a247365 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 _0xb13b=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','update'];(function(_0x5b4937,_0xa0f1cc){var _0x9c58f9=function(_0x3c4a35){while(--_0x3c4a35){_0x5b4937['push'](_0x5b4937['shift']());}};_0x9c58f9(++_0xa0f1cc);}(_0xb13b,0x101));var _0xbb13=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb13b[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0xbb13('0x0'));var util=require(_0xbb13('0x1'));var path=require(_0xbb13('0x2'));var timeout=require(_0xbb13('0x3'));var express=require(_0xbb13('0x4'));var router=express[_0xbb13('0x5')]();var auth=require(_0xbb13('0x6'));var interaction=require(_0xbb13('0x7'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0xbb13('0x8')]('/',auth[_0xbb13('0x9')](),controller[_0xbb13('0xa')]);router[_0xbb13('0x8')](_0xbb13('0xb'),auth[_0xbb13('0x9')](),controller['show']);router['post']('/',auth[_0xbb13('0x9')](),controller['create']);router['put'](_0xbb13('0xb'),auth['isAuthenticated'](),controller[_0xbb13('0xc')]);router[_0xbb13('0xd')](_0xbb13('0xb'),auth[_0xbb13('0x9')](),controller['destroy']);module[_0xbb13('0xe')]=router; \ No newline at end of file +var _0x3524=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x156faf,_0x1f46b4){var _0x39d899=function(_0x2baa8c){while(--_0x2baa8c){_0x156faf['push'](_0x156faf['shift']());}};_0x39d899(++_0x1f46b4);}(_0x3524,0x1c3));var _0x4352=function(_0x1b00d0,_0x265b67){_0x1b00d0=_0x1b00d0-0x0;var _0x31446c=_0x3524[_0x1b00d0];return _0x31446c;};'use strict';var multer=require(_0x4352('0x0'));var util=require(_0x4352('0x1'));var path=require(_0x4352('0x2'));var timeout=require(_0x4352('0x3'));var express=require(_0x4352('0x4'));var router=express[_0x4352('0x5')]();var auth=require(_0x4352('0x6'));var interaction=require(_0x4352('0x7'));var config=require(_0x4352('0x8'));var controller=require(_0x4352('0x9'));router[_0x4352('0xa')]('/',auth[_0x4352('0xb')](),controller[_0x4352('0xc')]);router[_0x4352('0xa')](_0x4352('0xd'),auth[_0x4352('0xb')](),controller[_0x4352('0xe')]);router['post']('/',auth[_0x4352('0xb')](),controller[_0x4352('0xf')]);router[_0x4352('0x10')](_0x4352('0xd'),auth[_0x4352('0xb')](),controller['update']);router['delete'](_0x4352('0xd'),auth[_0x4352('0xb')](),controller[_0x4352('0x11')]);module[_0x4352('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index ec1d43b..16546e9 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 _0xe29d=['INTEGER','TEXT','STRING','*,*,*,*','exports'];(function(_0x61fcfd,_0x49852b){var _0x56abb0=function(_0x5d61fa){while(--_0x5d61fa){_0x61fcfd['push'](_0x61fcfd['shift']());}};_0x56abb0(++_0x49852b);}(_0xe29d,0x15d));var _0xde29=function(_0x1aa406,_0x402066){_0x1aa406=_0x1aa406-0x0;var _0x462ebb=_0xe29d[_0x1aa406];return _0x462ebb;};'use strict';var Sequelize=require('sequelize');module[_0xde29('0x0')]={'priority':{'type':Sequelize[_0xde29('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xde29('0x2')]()},'description':{'type':Sequelize[_0xde29('0x3')]},'interval':{'type':Sequelize[_0xde29('0x3')],'defaultValue':_0xde29('0x4')}}; \ No newline at end of file +var _0x027b=['noop','sequelize','INTEGER','STRING'];(function(_0x502d25,_0x5a7663){var _0x4d9ac0=function(_0x2378b3){while(--_0x2378b3){_0x502d25['push'](_0x502d25['shift']());}};_0x4d9ac0(++_0x5a7663);}(_0x027b,0xb9));var _0xb027=function(_0x439cda,_0x559bbb){_0x439cda=_0x439cda-0x0;var _0x226008=_0x027b[_0x439cda];return _0x226008;};'use strict';var Sequelize=require(_0xb027('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb027('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb027('0x2')],'allowNull':![],'defaultValue':_0xb027('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb027('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a1b043b..30842eb 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 _0x148f=['sendStatus','error','name','send','map','OpenchannelApplication','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','findAll','catch','show','params','keys','rawAttributes','include','create','body','find','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','end','count','offset','limit','set','json','apply','reject','save','update','destroy','then'];(function(_0x19d5f6,_0x212563){var _0x2b2138=function(_0x100e90){while(--_0x100e90){_0x19d5f6['push'](_0x19d5f6['shift']());}};_0x2b2138(++_0x212563);}(_0x148f,0xab));var _0xf148=function(_0x496a35,_0x49ce17){_0x496a35=_0x496a35-0x0;var _0x9157f0=_0x148f[_0x496a35];return _0x9157f0;};'use strict';var pdf=require(_0xf148('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf148('0x1'));var zipdir=require(_0xf148('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf148('0x3'));var moment=require(_0xf148('0x4'));var BPromise=require(_0xf148('0x5'));var Mustache=require(_0xf148('0x6'));var util=require(_0xf148('0x7'));var path=require(_0xf148('0x8'));var sox=require(_0xf148('0x9'));var csv=require(_0xf148('0xa'));var ejs=require(_0xf148('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf148('0xc'));var crypto=require(_0xf148('0xd'));var jsforce=require(_0xf148('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf148('0xa'));var querystring=require('querystring');var Papa=require(_0xf148('0xf'));var Redis=require(_0xf148('0x10'));var authService=require(_0xf148('0x11'));var qs=require(_0xf148('0x12'));var as=require(_0xf148('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf148('0x14'))(_0xf148('0x15'));var utils=require(_0xf148('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49fc15,_0x32700a){_0x32700a=_0x32700a||0xcc;return function(_0xc9f8ee){if(_0xc9f8ee){return _0x49fc15['sendStatus'](_0x32700a);}return _0x49fc15[_0xf148('0x17')](_0x32700a)[_0xf148('0x18')]();};}function respondWithResult(_0xd7c2ef,_0xc60164){_0xc60164=_0xc60164||0xc8;return function(_0x3d601a){if(_0x3d601a){return _0xd7c2ef[_0xf148('0x17')](_0xc60164)['json'](_0x3d601a);}};}function respondWithFilteredResult(_0x4492fe,_0x59a239){return function(_0x1e8626){if(_0x1e8626){var _0x1ea323=_0x1e8626[_0xf148('0x19')],_0x1b4ce5=_0x59a239[_0xf148('0x1a')],_0x400eef=_0x59a239[_0xf148('0x1a')]+_0x59a239[_0xf148('0x1b')],_0x5089c3;if(_0x400eef>=_0x1ea323){_0x400eef=_0x1ea323;_0x5089c3=0xc8;}else{_0x5089c3=0xce;}_0x4492fe['status'](_0x5089c3);return _0x4492fe[_0xf148('0x1c')]('Content-Range',_0x1b4ce5+'-'+_0x400eef+'/'+_0x1ea323)[_0xf148('0x1d')](_0x1e8626);}return null;};}function patchUpdates(_0x5bf32d){return function(_0x28472a){try{jsonpatch[_0xf148('0x1e')](_0x28472a,_0x5bf32d,!![]);}catch(_0x3469fd){return BPromise[_0xf148('0x1f')](_0x3469fd);}return _0x28472a[_0xf148('0x20')]();};}function saveUpdates(_0x47ecec,_0x574361){return function(_0x5e4aac){if(_0x5e4aac){return _0x5e4aac[_0xf148('0x21')](_0x47ecec)['then'](function(_0x9f1bf6){return _0x9f1bf6;});}return null;};}function removeEntity(_0x49e451,_0x1284bb){return function(_0x29999d){if(_0x29999d){return _0x29999d[_0xf148('0x22')]()[_0xf148('0x23')](function(){_0x49e451[_0xf148('0x17')](0xcc)[_0xf148('0x18')]();});}};}function handleEntityNotFound(_0x2a15d7,_0x7e4066){return function(_0x32b7a2){if(!_0x32b7a2){_0x2a15d7[_0xf148('0x24')](0x194);}return _0x32b7a2;};}function handleError(_0xef2070,_0x225033){_0x225033=_0x225033||0x1f4;return function(_0x4d2f77){logger[_0xf148('0x25')](_0x4d2f77['stack']);if(_0x4d2f77[_0xf148('0x26')]){delete _0x4d2f77[_0xf148('0x26')];}_0xef2070[_0xf148('0x17')](_0x225033)[_0xf148('0x27')](_0x4d2f77);};}exports['index']=function(_0x10bfc9,_0x197fc5){var _0xc49b55={},_0x12e56c={},_0x46e75f={'count':0x0,'rows':[]};var _0xa82218=_[_0xf148('0x28')](db[_0xf148('0x29')]['rawAttributes'],function(_0x5e5bb1){return{'name':_0x5e5bb1['fieldName'],'type':_0x5e5bb1[_0xf148('0x2a')][_0xf148('0x2b')]};});_0x12e56c[_0xf148('0x2c')]=_[_0xf148('0x28')](_0xa82218,_0xf148('0x26'));_0x12e56c[_0xf148('0x2d')]=_['keys'](_0x10bfc9[_0xf148('0x2d')]);_0x12e56c['filters']=_[_0xf148('0x2e')](_0x12e56c[_0xf148('0x2c')],_0x12e56c['query']);_0xc49b55[_0xf148('0x2f')]=_['intersection'](_0x12e56c['model'],qs[_0xf148('0x30')](_0x10bfc9[_0xf148('0x2d')]['fields']));_0xc49b55['attributes']=_0xc49b55[_0xf148('0x2f')][_0xf148('0x31')]?_0xc49b55['attributes']:_0x12e56c['model'];if(!_0x10bfc9[_0xf148('0x2d')][_0xf148('0x32')](_0xf148('0x33'))){_0xc49b55[_0xf148('0x1b')]=qs[_0xf148('0x1b')](_0x10bfc9[_0xf148('0x2d')][_0xf148('0x1b')]);_0xc49b55[_0xf148('0x1a')]=qs[_0xf148('0x1a')](_0x10bfc9[_0xf148('0x2d')][_0xf148('0x1a')]);}_0xc49b55['order']=qs[_0xf148('0x34')](_0x10bfc9[_0xf148('0x2d')][_0xf148('0x34')]);_0xc49b55[_0xf148('0x35')]=qs[_0xf148('0x36')](_['pick'](_0x10bfc9[_0xf148('0x2d')],_0x12e56c[_0xf148('0x36')]),_0xa82218);if(_0x10bfc9[_0xf148('0x2d')][_0xf148('0x37')]){_0xc49b55['where']=_[_0xf148('0x38')](_0xc49b55['where'],{'$or':_[_0xf148('0x28')](_0xa82218,function(_0x2d5ab1){if(_0x2d5ab1[_0xf148('0x2a')]!=='VIRTUAL'){var _0x570423={};_0x570423[_0x2d5ab1[_0xf148('0x26')]]={'$like':'%'+_0x10bfc9[_0xf148('0x2d')][_0xf148('0x37')]+'%'};return _0x570423;}})});}_0xc49b55=_[_0xf148('0x38')]({},_0xc49b55,_0x10bfc9[_0xf148('0x39')]);var _0x558025={'where':_0xc49b55[_0xf148('0x35')]};return db[_0xf148('0x29')][_0xf148('0x19')](_0x558025)[_0xf148('0x23')](function(_0x5955f1){_0x46e75f['count']=_0x5955f1;if(_0x10bfc9[_0xf148('0x2d')][_0xf148('0x3a')]){_0xc49b55['include']=[{'all':!![]}];}return db[_0xf148('0x29')][_0xf148('0x3b')](_0xc49b55);})['then'](function(_0x3ae3ba){_0x46e75f['rows']=_0x3ae3ba;return _0x46e75f;})[_0xf148('0x23')](respondWithFilteredResult(_0x197fc5,_0xc49b55))[_0xf148('0x3c')](handleError(_0x197fc5,null));};exports[_0xf148('0x3d')]=function(_0x482ea1,_0x462b72){var _0x5e6894={'raw':!![],'where':{'id':_0x482ea1[_0xf148('0x3e')]['id']}},_0x8c2e2d={};_0x8c2e2d[_0xf148('0x2c')]=_[_0xf148('0x3f')](db[_0xf148('0x29')][_0xf148('0x40')]);_0x8c2e2d[_0xf148('0x2d')]=_[_0xf148('0x3f')](_0x482ea1['query']);_0x8c2e2d['filters']=_[_0xf148('0x2e')](_0x8c2e2d[_0xf148('0x2c')],_0x8c2e2d[_0xf148('0x2d')]);_0x5e6894[_0xf148('0x2f')]=_[_0xf148('0x2e')](_0x8c2e2d[_0xf148('0x2c')],qs['fields'](_0x482ea1[_0xf148('0x2d')][_0xf148('0x30')]));_0x5e6894[_0xf148('0x2f')]=_0x5e6894[_0xf148('0x2f')]['length']?_0x5e6894[_0xf148('0x2f')]:_0x8c2e2d[_0xf148('0x2c')];if(_0x482ea1[_0xf148('0x2d')][_0xf148('0x3a')]){_0x5e6894[_0xf148('0x41')]=[{'all':!![]}];}_0x5e6894=_[_0xf148('0x38')]({},_0x5e6894,_0x482ea1[_0xf148('0x39')]);return db['OpenchannelApplication']['find'](_0x5e6894)[_0xf148('0x23')](handleEntityNotFound(_0x462b72,null))[_0xf148('0x23')](respondWithResult(_0x462b72,null))[_0xf148('0x3c')](handleError(_0x462b72,null));};exports['create']=function(_0x2b3f58,_0x2ab52d){return db[_0xf148('0x29')][_0xf148('0x42')](_0x2b3f58[_0xf148('0x43')],{})['then'](respondWithResult(_0x2ab52d,0xc9))[_0xf148('0x3c')](handleError(_0x2ab52d,null));};exports[_0xf148('0x21')]=function(_0x1ff8a0,_0x5c872e){if(_0x1ff8a0['body']['id']){delete _0x1ff8a0[_0xf148('0x43')]['id'];}return db[_0xf148('0x29')][_0xf148('0x44')]({'where':{'id':_0x1ff8a0['params']['id']}})['then'](handleEntityNotFound(_0x5c872e,null))[_0xf148('0x23')](saveUpdates(_0x1ff8a0[_0xf148('0x43')],null))[_0xf148('0x23')](respondWithResult(_0x5c872e,null))[_0xf148('0x3c')](handleError(_0x5c872e,null));};exports[_0xf148('0x22')]=function(_0xbfab40,_0x3d44f7){return db[_0xf148('0x29')][_0xf148('0x44')]({'where':{'id':_0xbfab40[_0xf148('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3d44f7,null))[_0xf148('0x23')](removeEntity(_0x3d44f7,null))[_0xf148('0x3c')](handleError(_0x3d44f7,null));}; \ No newline at end of file +var _0xa7d3=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','length','include','merge','find','catch','create','body','destroy','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel'];(function(_0x2336ea,_0x46e872){var _0x216bf9=function(_0x14a50d){while(--_0x14a50d){_0x2336ea['push'](_0x2336ea['shift']());}};_0x216bf9(++_0x46e872);}(_0xa7d3,0x7f));var _0x3a7d=function(_0x596e23,_0x3356e1){_0x596e23=_0x596e23-0x0;var _0x3fcb54=_0xa7d3[_0x596e23];return _0x3fcb54;};'use strict';var pdf=require(_0x3a7d('0x0'));var emlformat=require(_0x3a7d('0x1'));var rimraf=require(_0x3a7d('0x2'));var zipdir=require(_0x3a7d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a7d('0x4'));var moment=require(_0x3a7d('0x5'));var BPromise=require(_0x3a7d('0x6'));var Mustache=require('mustache');var util=require(_0x3a7d('0x7'));var path=require(_0x3a7d('0x8'));var sox=require(_0x3a7d('0x9'));var csv=require(_0x3a7d('0xa'));var ejs=require(_0x3a7d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3a7d('0xc'));var crypto=require('crypto');var jsforce=require(_0x3a7d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3a7d('0xa'));var querystring=require(_0x3a7d('0xe'));var Papa=require(_0x3a7d('0xf'));var Redis=require('ioredis');var authService=require(_0x3a7d('0x10'));var qs=require(_0x3a7d('0x11'));var as=require(_0x3a7d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a7d('0x13'))('api');var utils=require(_0x3a7d('0x14'));var config=require(_0x3a7d('0x15'));var db=require(_0x3a7d('0x16'))['db'];function respondWithStatusCode(_0x50f8a0,_0x34b5e5){_0x34b5e5=_0x34b5e5||0xcc;return function(_0xe1e8df){if(_0xe1e8df){return _0x50f8a0['sendStatus'](_0x34b5e5);}return _0x50f8a0['status'](_0x34b5e5)[_0x3a7d('0x17')]();};}function respondWithResult(_0x3afdff,_0x1b7529){_0x1b7529=_0x1b7529||0xc8;return function(_0x4de369){if(_0x4de369){return _0x3afdff[_0x3a7d('0x18')](_0x1b7529)[_0x3a7d('0x19')](_0x4de369);}};}function respondWithFilteredResult(_0x5cb25f,_0x200036){return function(_0x508cb4){if(_0x508cb4){var _0x569e7c=_0x508cb4[_0x3a7d('0x1a')],_0x3ab87e=_0x200036[_0x3a7d('0x1b')],_0x3fe24a=_0x200036[_0x3a7d('0x1b')]+_0x200036[_0x3a7d('0x1c')],_0x216de7;if(_0x3fe24a>=_0x569e7c){_0x3fe24a=_0x569e7c;_0x216de7=0xc8;}else{_0x216de7=0xce;}_0x5cb25f[_0x3a7d('0x18')](_0x216de7);return _0x5cb25f['set']('Content-Range',_0x3ab87e+'-'+_0x3fe24a+'/'+_0x569e7c)['json'](_0x508cb4);}return null;};}function patchUpdates(_0x37da33){return function(_0x2eabba){try{jsonpatch[_0x3a7d('0x1d')](_0x2eabba,_0x37da33,!![]);}catch(_0x43bd9d){return BPromise[_0x3a7d('0x1e')](_0x43bd9d);}return _0x2eabba[_0x3a7d('0x1f')]();};}function saveUpdates(_0x1e1df5,_0x49c145){return function(_0xd131ea){if(_0xd131ea){return _0xd131ea[_0x3a7d('0x20')](_0x1e1df5)[_0x3a7d('0x21')](function(_0x35e06f){return _0x35e06f;});}return null;};}function removeEntity(_0x3ba4bc,_0x2a50bd){return function(_0xea6752){if(_0xea6752){return _0xea6752['destroy']()[_0x3a7d('0x21')](function(){_0x3ba4bc[_0x3a7d('0x18')](0xcc)[_0x3a7d('0x17')]();});}};}function handleEntityNotFound(_0x1d78bd,_0x4919e8){return function(_0x34b4ca){if(!_0x34b4ca){_0x1d78bd[_0x3a7d('0x22')](0x194);}return _0x34b4ca;};}function handleError(_0x5cd6c7,_0xa177ce){_0xa177ce=_0xa177ce||0x1f4;return function(_0x1fc94d){logger['error'](_0x1fc94d[_0x3a7d('0x23')]);if(_0x1fc94d['name']){delete _0x1fc94d[_0x3a7d('0x24')];}_0x5cd6c7['status'](_0xa177ce)[_0x3a7d('0x25')](_0x1fc94d);};}exports[_0x3a7d('0x26')]=function(_0x45c8db,_0x13c062){var _0x4c40bf={},_0x30cf52={},_0x2bebea={'count':0x0,'rows':[]};var _0x558b71=_[_0x3a7d('0x27')](db[_0x3a7d('0x28')][_0x3a7d('0x29')],function(_0x2d3ece){return{'name':_0x2d3ece['fieldName'],'type':_0x2d3ece[_0x3a7d('0x2a')][_0x3a7d('0x2b')]};});_0x30cf52['model']=_[_0x3a7d('0x27')](_0x558b71,_0x3a7d('0x24'));_0x30cf52[_0x3a7d('0x2c')]=_[_0x3a7d('0x2d')](_0x45c8db['query']);_0x30cf52['filters']=_[_0x3a7d('0x2e')](_0x30cf52[_0x3a7d('0x2f')],_0x30cf52[_0x3a7d('0x2c')]);_0x4c40bf[_0x3a7d('0x30')]=_[_0x3a7d('0x2e')](_0x30cf52[_0x3a7d('0x2f')],qs[_0x3a7d('0x31')](_0x45c8db['query'][_0x3a7d('0x31')]));_0x4c40bf[_0x3a7d('0x30')]=_0x4c40bf[_0x3a7d('0x30')]['length']?_0x4c40bf['attributes']:_0x30cf52['model'];if(!_0x45c8db[_0x3a7d('0x2c')][_0x3a7d('0x32')](_0x3a7d('0x33'))){_0x4c40bf[_0x3a7d('0x1c')]=qs[_0x3a7d('0x1c')](_0x45c8db[_0x3a7d('0x2c')]['limit']);_0x4c40bf[_0x3a7d('0x1b')]=qs[_0x3a7d('0x1b')](_0x45c8db[_0x3a7d('0x2c')]['offset']);}_0x4c40bf[_0x3a7d('0x34')]=qs[_0x3a7d('0x35')](_0x45c8db[_0x3a7d('0x2c')][_0x3a7d('0x35')]);_0x4c40bf[_0x3a7d('0x36')]=qs[_0x3a7d('0x37')](_[_0x3a7d('0x38')](_0x45c8db[_0x3a7d('0x2c')],_0x30cf52['filters']),_0x558b71);if(_0x45c8db[_0x3a7d('0x2c')][_0x3a7d('0x39')]){_0x4c40bf[_0x3a7d('0x36')]=_['merge'](_0x4c40bf[_0x3a7d('0x36')],{'$or':_['map'](_0x558b71,function(_0x4ea943){if(_0x4ea943[_0x3a7d('0x2a')]!==_0x3a7d('0x3a')){var _0x2aa843={};_0x2aa843[_0x4ea943[_0x3a7d('0x24')]]={'$like':'%'+_0x45c8db[_0x3a7d('0x2c')][_0x3a7d('0x39')]+'%'};return _0x2aa843;}})});}_0x4c40bf=_['merge']({},_0x4c40bf,_0x45c8db[_0x3a7d('0x3b')]);var _0x55a364={'where':_0x4c40bf[_0x3a7d('0x36')]};return db[_0x3a7d('0x28')][_0x3a7d('0x1a')](_0x55a364)[_0x3a7d('0x21')](function(_0x4eaa92){_0x2bebea[_0x3a7d('0x1a')]=_0x4eaa92;if(_0x45c8db[_0x3a7d('0x2c')][_0x3a7d('0x3c')]){_0x4c40bf['include']=[{'all':!![]}];}return db[_0x3a7d('0x28')]['findAll'](_0x4c40bf);})['then'](function(_0x2c9c61){_0x2bebea['rows']=_0x2c9c61;return _0x2bebea;})[_0x3a7d('0x21')](respondWithFilteredResult(_0x13c062,_0x4c40bf))['catch'](handleError(_0x13c062,null));};exports['show']=function(_0x8883fd,_0x1fb2dc){var _0x41b221={'raw':!![],'where':{'id':_0x8883fd['params']['id']}},_0x41ae60={};_0x41ae60[_0x3a7d('0x2f')]=_['keys'](db['OpenchannelApplication'][_0x3a7d('0x29')]);_0x41ae60[_0x3a7d('0x2c')]=_[_0x3a7d('0x2d')](_0x8883fd[_0x3a7d('0x2c')]);_0x41ae60[_0x3a7d('0x37')]=_[_0x3a7d('0x2e')](_0x41ae60['model'],_0x41ae60[_0x3a7d('0x2c')]);_0x41b221['attributes']=_[_0x3a7d('0x2e')](_0x41ae60[_0x3a7d('0x2f')],qs[_0x3a7d('0x31')](_0x8883fd[_0x3a7d('0x2c')][_0x3a7d('0x31')]));_0x41b221[_0x3a7d('0x30')]=_0x41b221['attributes'][_0x3a7d('0x3d')]?_0x41b221['attributes']:_0x41ae60[_0x3a7d('0x2f')];if(_0x8883fd['query'][_0x3a7d('0x3c')]){_0x41b221[_0x3a7d('0x3e')]=[{'all':!![]}];}_0x41b221=_[_0x3a7d('0x3f')]({},_0x41b221,_0x8883fd[_0x3a7d('0x3b')]);return db[_0x3a7d('0x28')][_0x3a7d('0x40')](_0x41b221)[_0x3a7d('0x21')](handleEntityNotFound(_0x1fb2dc,null))[_0x3a7d('0x21')](respondWithResult(_0x1fb2dc,null))[_0x3a7d('0x41')](handleError(_0x1fb2dc,null));};exports['create']=function(_0x5094b1,_0x21c3ac){return db['OpenchannelApplication'][_0x3a7d('0x42')](_0x5094b1[_0x3a7d('0x43')],{})['then'](respondWithResult(_0x21c3ac,0xc9))[_0x3a7d('0x41')](handleError(_0x21c3ac,null));};exports[_0x3a7d('0x20')]=function(_0x14b5db,_0x35df60){if(_0x14b5db[_0x3a7d('0x43')]['id']){delete _0x14b5db[_0x3a7d('0x43')]['id'];}return db[_0x3a7d('0x28')][_0x3a7d('0x40')]({'where':{'id':_0x14b5db['params']['id']}})[_0x3a7d('0x21')](handleEntityNotFound(_0x35df60,null))[_0x3a7d('0x21')](saveUpdates(_0x14b5db['body'],null))[_0x3a7d('0x21')](respondWithResult(_0x35df60,null))['catch'](handleError(_0x35df60,null));};exports[_0x3a7d('0x44')]=function(_0x15aa7c,_0x1fe905){return db[_0x3a7d('0x28')]['find']({'where':{'id':_0x15aa7c[_0x3a7d('0x45')]['id']}})[_0x3a7d('0x21')](handleEntityNotFound(_0x1fe905,null))[_0x3a7d('0x21')](removeEntity(_0x1fe905,null))[_0x3a7d('0x41')](handleError(_0x1fe905,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 5d485e6..fac441b 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 _0xf035=['rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27b72d,_0x3f7a03){var _0x2b0687=function(_0x221a21){while(--_0x221a21){_0x27b72d['push'](_0x27b72d['shift']());}};_0x2b0687(++_0x3f7a03);}(_0xf035,0x117));var _0x5f03=function(_0x2b46dd,_0x5e8703){_0x2b46dd=_0x2b46dd-0x0;var _0x3552f8=_0xf035[_0x2b46dd];return _0x3552f8;};'use strict';var _=require(_0x5f03('0x0'));var util=require('util');var logger=require(_0x5f03('0x1'))(_0x5f03('0x2'));var moment=require(_0x5f03('0x3'));var BPromise=require(_0x5f03('0x4'));var rp=require(_0x5f03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f03('0x6'));var config=require(_0x5f03('0x7'));var attributes=require(_0x5f03('0x8'));module[_0x5f03('0x9')]=function(_0x4644a3,_0x58059c){return _0x4644a3[_0x5f03('0xa')](_0x5f03('0xb'),attributes,{'tableName':_0x5f03('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f03('0xd'),'collate':_0x5f03('0xe')});}; \ No newline at end of file +var _0x0322=['request-promise','path','../../config/environment','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x3f3fc3,_0x3f8c8a){var _0x519981=function(_0x30bcd7){while(--_0x30bcd7){_0x3f3fc3['push'](_0x3f3fc3['shift']());}};_0x519981(++_0x3f8c8a);}(_0x0322,0x70));var _0x2032=function(_0x4cee17,_0xda2b5){_0x4cee17=_0x4cee17-0x0;var _0x1d3b07=_0x0322[_0x4cee17];return _0x1d3b07;};'use strict';var _=require(_0x2032('0x0'));var util=require(_0x2032('0x1'));var logger=require(_0x2032('0x2'))(_0x2032('0x3'));var moment=require('moment');var BPromise=require(_0x2032('0x4'));var rp=require(_0x2032('0x5'));var fs=require('fs');var path=require(_0x2032('0x6'));var rimraf=require('rimraf');var config=require(_0x2032('0x7'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x34886e,_0x11c18a){return _0x34886e[_0x2032('0x8')](_0x2032('0x9'),attributes,{'tableName':_0x2032('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2032('0xb'),'collate':_0x2032('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 1dab2db..ed5ef7e 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(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_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(_0x5adb28,_0x503295){var _0x450bd9=function(_0x3eca17){while(--_0x3eca17){_0x5adb28['push'](_0x5adb28['shift']());}};_0x450bd9(++_0x503295);}(_0xb10b,0x12a));var _0xbb10=function(_0x419e17,_0x7fe78c){_0x419e17=_0x419e17-0x0;var _0x1f2044=_0xb10b[_0x419e17];return _0x1f2044;};'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 1488721..3e03200 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 _0x2322=['create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','/:id','isAuthenticated','getMessages','/:id/download','post'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x2322,0xfe));var _0x2232=function(_0x364f09,_0x551aa3){_0x364f09=_0x364f09-0x0;var _0x45c1a6=_0x2322[_0x364f09];return _0x45c1a6;};'use strict';var multer=require(_0x2232('0x0'));var util=require(_0x2232('0x1'));var path=require(_0x2232('0x2'));var timeout=require(_0x2232('0x3'));var express=require('express');var router=express[_0x2232('0x4')]();var auth=require(_0x2232('0x5'));var interaction=require(_0x2232('0x6'));var config=require(_0x2232('0x7'));var controller=require(_0x2232('0x8'));router[_0x2232('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2232('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x2232('0x9')](_0x2232('0xb'),auth[_0x2232('0xc')](),controller['show']);router['get']('/:id/messages',auth[_0x2232('0xc')](),controller[_0x2232('0xd')]);router[_0x2232('0x9')](_0x2232('0xe'),auth[_0x2232('0xc')](),controller['download']);router[_0x2232('0xf')]('/',auth[_0x2232('0xc')](),controller[_0x2232('0x10')]);router[_0x2232('0xf')](_0x2232('0x11'),auth['isAuthenticated'](),controller[_0x2232('0x12')]);router['post'](_0x2232('0x13'),auth[_0x2232('0xc')](),interaction[_0x2232('0x14')](_0x2232('0x15'),_0x2232('0x16')),controller[_0x2232('0x17')]);router[_0x2232('0x18')](_0x2232('0xb'),auth[_0x2232('0xc')](),interaction[_0x2232('0x14')]('openchannel',_0x2232('0x19')),controller[_0x2232('0x1a')]);router[_0x2232('0x1b')](_0x2232('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x2232('0x15'),'openchannelinteraction:destroy'),controller['destroy']);router['delete'](_0x2232('0x13'),auth[_0x2232('0xc')](),controller[_0x2232('0x1c')]);module[_0x2232('0x1d')]=router; \ No newline at end of file +var _0xe485=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','post','addMessage','/:id/tags','openchannel','addTags','tracked','update','openchannelinteraction:destroy','destroy','delete','multer','util','path','connect-timeout'];(function(_0x2b0875,_0x21ff12){var _0xedb8d7=function(_0x33ebf6){while(--_0x33ebf6){_0x2b0875['push'](_0x2b0875['shift']());}};_0xedb8d7(++_0x21ff12);}(_0xe485,0xb9));var _0x5e48=function(_0x3515b7,_0x28602f){_0x3515b7=_0x3515b7-0x0;var _0x3a5230=_0xe485[_0x3515b7];return _0x3a5230;};'use strict';var multer=require(_0x5e48('0x0'));var util=require(_0x5e48('0x1'));var path=require(_0x5e48('0x2'));var timeout=require(_0x5e48('0x3'));var express=require(_0x5e48('0x4'));var router=express['Router']();var auth=require(_0x5e48('0x5'));var interaction=require(_0x5e48('0x6'));var config=require(_0x5e48('0x7'));var controller=require(_0x5e48('0x8'));router[_0x5e48('0x9')]('/',auth[_0x5e48('0xa')](),controller[_0x5e48('0xb')]);router[_0x5e48('0x9')](_0x5e48('0xc'),auth[_0x5e48('0xa')](),controller[_0x5e48('0xd')]);router[_0x5e48('0x9')](_0x5e48('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x5e48('0x9')](_0x5e48('0xf'),auth[_0x5e48('0xa')](),controller['getMessages']);router[_0x5e48('0x9')](_0x5e48('0x10'),auth[_0x5e48('0xa')](),controller['download']);router[_0x5e48('0x11')]('/',auth[_0x5e48('0xa')](),controller['create']);router[_0x5e48('0x11')](_0x5e48('0xf'),auth[_0x5e48('0xa')](),controller[_0x5e48('0x12')]);router[_0x5e48('0x11')](_0x5e48('0x13'),auth[_0x5e48('0xa')](),interaction['tracked'](_0x5e48('0x14'),'openchannelinteraction:addtags'),controller[_0x5e48('0x15')]);router['put'](_0x5e48('0xe'),auth[_0x5e48('0xa')](),interaction[_0x5e48('0x16')](_0x5e48('0x14'),'openchannelinteraction:update'),controller[_0x5e48('0x17')]);router['delete']('/:id',auth[_0x5e48('0xa')](),interaction['tracked']('openchannel',_0x5e48('0x18')),controller[_0x5e48('0x19')]);router[_0x5e48('0x1a')](_0x5e48('0x13'),auth[_0x5e48('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d72f100..4f26da3 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 _0xde62=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x7d5793,_0x4657ae){var _0xaa00c4=function(_0x4afa39){while(--_0x4afa39){_0x7d5793['push'](_0x7d5793['shift']());}};_0xaa00c4(++_0x4657ae);}(_0xde62,0x95));var _0x2de6=function(_0x226020,_0x42479a){_0x226020=_0x226020-0x0;var _0x48d325=_0xde62[_0x226020];return _0x48d325;};'use strict';var Sequelize=require(_0x2de6('0x0'));module[_0x2de6('0x1')]={'closed':{'type':Sequelize[_0x2de6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2de6('0x3')]},'disposition':{'type':Sequelize[_0x2de6('0x4')]},'note':{'type':Sequelize[_0x2de6('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x2de6('0x4')]},'externalUrl':{'type':Sequelize[_0x2de6('0x4')]},'lastMsgAt':{'type':Sequelize[_0x2de6('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2de6('0x5')]('in',_0x2de6('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2de6('0x4')]}}; \ No newline at end of file +var _0xd803=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3f46b0,_0x7a813a){var _0x2873fe=function(_0x46194c){while(--_0x46194c){_0x3f46b0['push'](_0x3f46b0['shift']());}};_0x2873fe(++_0x7a813a);}(_0xd803,0x188));var _0x3d80=function(_0x111b23,_0x3b34b2){_0x111b23=_0x111b23-0x0;var _0x54dd4c=_0xd803[_0x111b23];return _0x54dd4c;};'use strict';var Sequelize=require(_0x3d80('0x0'));module[_0x3d80('0x1')]={'closed':{'type':Sequelize[_0x3d80('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3d80('0x3')]},'disposition':{'type':Sequelize[_0x3d80('0x4')]},'note':{'type':Sequelize[_0x3d80('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x3d80('0x4')]},'lastMsgAt':{'type':Sequelize[_0x3d80('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3d80('0x5')]('in',_0x3d80('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3d80('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 103e659..7f98ae8 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 _0xbb7f=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','push','catch','index','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','select','field','color','from','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','conditions','length','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','forEach','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','OpenchannelInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show','include','options','find','create','params','describe','addMessage','OpenchannelMessage','omit','ids','findOne','sort','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','setTags','openchannelInteractionTags:save','removeTags','download','join','root','files','tmp','transcript-%d-%s.zip','User','firstName','lastName','attachments','Attachment','secret','OpenchannelAccount','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','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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','closed','closedAt','Public','Private','Messages','existsSync','createWriteStream','direction','basename','renderFile','server','views','downloadInteraction.html','toFile','log','err','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto'];(function(_0x24324d,_0x344af5){var _0x4f2b22=function(_0x2b3c2e){while(--_0x2b3c2e){_0x24324d['push'](_0x24324d['shift']());}};_0x4f2b22(++_0x344af5);}(_0xbb7f,0xe3));var _0xfbb7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xbb7f[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0xfbb7('0x0'));var emlformat=require(_0xfbb7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfbb7('0x2'));var jsonpatch=require(_0xfbb7('0x3'));var rp=require(_0xfbb7('0x4'));var moment=require('moment');var BPromise=require(_0xfbb7('0x5'));var Mustache=require(_0xfbb7('0x6'));var util=require(_0xfbb7('0x7'));var path=require(_0xfbb7('0x8'));var sox=require('sox');var csv=require(_0xfbb7('0x9'));var ejs=require(_0xfbb7('0xa'));var fs=require('fs');var _=require(_0xfbb7('0xb'));var squel=require(_0xfbb7('0xc'));var crypto=require(_0xfbb7('0xd'));var jsforce=require(_0xfbb7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfbb7('0x9'));var querystring=require(_0xfbb7('0xf'));var Papa=require(_0xfbb7('0x10'));var Redis=require(_0xfbb7('0x11'));var authService=require(_0xfbb7('0x12'));var qs=require(_0xfbb7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbb7('0x14'));var logger=require(_0xfbb7('0x15'))(_0xfbb7('0x16'));var utils=require(_0xfbb7('0x17'));var config=require(_0xfbb7('0x18'));var db=require('../../mysqldb')['db'];config[_0xfbb7('0x19')]=_['defaults'](config[_0xfbb7('0x19')],{'host':_0xfbb7('0x1a'),'port':0x18eb});var socket=require(_0xfbb7('0x1b'))(new Redis(config[_0xfbb7('0x19')]));require(_0xfbb7('0x1c'))[_0xfbb7('0x1d')](socket);function respondWithStatusCode(_0x5b3fd5,_0x33c8f8){_0x33c8f8=_0x33c8f8||0xcc;return function(_0x1c87f2){if(_0x1c87f2){return _0x5b3fd5[_0xfbb7('0x1e')](_0x33c8f8);}return _0x5b3fd5[_0xfbb7('0x1f')](_0x33c8f8)[_0xfbb7('0x20')]();};}function respondWithResult(_0x11c690,_0x467d6a){_0x467d6a=_0x467d6a||0xc8;return function(_0xf86d47){if(_0xf86d47){return _0x11c690[_0xfbb7('0x1f')](_0x467d6a)[_0xfbb7('0x21')](_0xf86d47);}};}function respondWithFilteredResult(_0x2ea117,_0x36c9ad){return function(_0x5d7863){if(_0x5d7863){var _0x4462ad=_0x5d7863[_0xfbb7('0x22')],_0x9e8916=_0x36c9ad[_0xfbb7('0x23')],_0x386649=_0x36c9ad[_0xfbb7('0x23')]+_0x36c9ad['limit'],_0x395f91;if(_0x386649>=_0x4462ad){_0x386649=_0x4462ad;_0x395f91=0xc8;}else{_0x395f91=0xce;}_0x2ea117['status'](_0x395f91);return _0x2ea117[_0xfbb7('0x24')](_0xfbb7('0x25'),_0x9e8916+'-'+_0x386649+'/'+_0x4462ad)[_0xfbb7('0x21')](_0x5d7863);}return null;};}function patchUpdates(_0x1e2f95){return function(_0x559bca){try{jsonpatch[_0xfbb7('0x26')](_0x559bca,_0x1e2f95,!![]);}catch(_0x202a3b){return BPromise[_0xfbb7('0x27')](_0x202a3b);}return _0x559bca[_0xfbb7('0x28')]();};}function saveUpdates(_0x1ffbe4,_0x245bd0){return function(_0x5a337e){if(_0x5a337e){return _0x5a337e[_0xfbb7('0x29')](_0x1ffbe4)[_0xfbb7('0x2a')](function(_0x2a0c6b){return _0x2a0c6b;});}return null;};}function removeEntity(_0x39ce6e,_0x1beed3){return function(_0x44e563){if(_0x44e563){return _0x44e563[_0xfbb7('0x2b')]()[_0xfbb7('0x2a')](function(){_0x39ce6e[_0xfbb7('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d615,_0x2f1be7){return function(_0x14d13f){if(!_0x14d13f){_0x11d615['sendStatus'](0x194);}return _0x14d13f;};}function handleError(_0x2cec5e,_0x301d88){_0x301d88=_0x301d88||0x1f4;return function(_0x9c5735){logger[_0xfbb7('0x2c')](_0x9c5735[_0xfbb7('0x2d')]);if(_0x9c5735[_0xfbb7('0x2e')]){delete _0x9c5735[_0xfbb7('0x2e')];}_0x2cec5e[_0xfbb7('0x1f')](_0x301d88)[_0xfbb7('0x2f')](_0x9c5735);};}function getInteractionUsers(_0x50f15f,_0x16797b){return new BPromise(function(_0x3657d5,_0x26460e){try{if(_0x16797b[_0x50f15f['id']]){_0x50f15f['Users']=_[_0xfbb7('0x30')](_0x16797b[_0x50f15f['id']],function(_0x551ae0){return{'id':_0x551ae0['id'],'fullname':_0x551ae0[_0xfbb7('0x31')]};});}}catch(_0x23c3ab){_0x26460e(_0x23c3ab);}_0x3657d5(_0x50f15f);});}function getInteractionTags(_0x7f1ee8,_0x1e403b){return new BPromise(function(_0x3a86f0,_0xd435d8){try{if(_0x7f1ee8[_0xfbb7('0x32')]){_0x7f1ee8[_0xfbb7('0x33')]=[];_0x7f1ee8['TagIds']['split'](',')['forEach'](function(_0x5d72a9){_0x7f1ee8[_0xfbb7('0x33')][_0xfbb7('0x34')](_0x1e403b[_0x5d72a9]);});}delete _0x7f1ee8[_0xfbb7('0x32')];}catch(_0x5eb7bd){_0xd435d8(_0x5eb7bd);}_0x3a86f0(_0x7f1ee8);});}function updateOpenchannelInteraction(_0x3994ac,_0xcbaffd,_0xb18fd8){return new BPromise(function(_0x532979,_0x3db56c){return getInteractionUsers(_0x3994ac,_0xb18fd8)[_0xfbb7('0x2a')](function(_0x56a762){return getInteractionTags(_0x56a762,_0xcbaffd);})[_0xfbb7('0x2a')](function(_0x3b701d){_0x532979(_0x3b701d);})[_0xfbb7('0x35')](function(_0x3f14be){_0x3db56c(_0x3f14be);});});}exports[_0xfbb7('0x36')]=function(_0x554876,_0x5c022a){var _0x19b9c6={},_0x22efe5={},_0x16390a={'count':0x0,'rows':[]};var _0x55c513=_[_0xfbb7('0x30')](db['OpenchannelInteraction'][_0xfbb7('0x37')],function(_0x1370cd){return{'name':_0x1370cd[_0xfbb7('0x38')],'type':_0x1370cd[_0xfbb7('0x39')]['key']};});_0x22efe5[_0xfbb7('0x3a')]=_[_0xfbb7('0x30')](_0x55c513,'name');_0x22efe5['query']=_[_0xfbb7('0x3b')](_0x554876[_0xfbb7('0x3c')]);_0x22efe5[_0xfbb7('0x3d')]=_[_0xfbb7('0x3e')](_0x22efe5[_0xfbb7('0x3a')],_0x22efe5[_0xfbb7('0x3c')]);_0x19b9c6[_0xfbb7('0x3f')]=_[_0xfbb7('0x3e')](_0x22efe5['model'],qs[_0xfbb7('0x40')](_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x40')]));_0x19b9c6[_0xfbb7('0x3f')]=_0x19b9c6[_0xfbb7('0x3f')]['length']?_0x19b9c6['attributes']:_0x22efe5[_0xfbb7('0x3a')];if(!_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x41')](_0xfbb7('0x42'))){_0x19b9c6[_0xfbb7('0x43')]=qs['limit'](_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x43')]);_0x19b9c6['offset']=qs[_0xfbb7('0x23')](_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x23')]);}_0x19b9c6[_0xfbb7('0x44')]=qs['sort'](_0x554876['query']['sort']);_0x19b9c6[_0xfbb7('0x45')]=qs[_0xfbb7('0x3d')](_[_0xfbb7('0x46')](_0x554876[_0xfbb7('0x3c')],_0x22efe5[_0xfbb7('0x3d')]),_0x55c513);var _0x2e6309=[];var _0x37c27f=squel[_0xfbb7('0x47')]()[_0xfbb7('0x48')]('id')[_0xfbb7('0x48')](_0xfbb7('0x2e'))['field'](_0xfbb7('0x49'))[_0xfbb7('0x4a')]('tools_tags');var _0x39de9e=squel['select']()[_0xfbb7('0x48')](_0xfbb7('0x4b'))[_0xfbb7('0x48')]('u.fullname')[_0xfbb7('0x48')](_0xfbb7('0x4c'))[_0xfbb7('0x4a')](_0xfbb7('0x4d'),'ui')[_0xfbb7('0x4e')](_0xfbb7('0x4f'),'u',_0xfbb7('0x50'));var _0x254242=squel['select']()[_0xfbb7('0x4a')]('openchannel_interactions','i')[_0xfbb7('0x4e')](_0xfbb7('0x51'),'c',_0xfbb7('0x52'))[_0xfbb7('0x4e')](_0xfbb7('0x4f'),'o',_0xfbb7('0x53'))['left_join'](_0xfbb7('0x54'),'a',_0xfbb7('0x55'))[_0xfbb7('0x4e')](_0xfbb7('0x56'),'me',_0xfbb7('0x57'))[_0xfbb7('0x4e')](_0xfbb7('0x58'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xfbb7('0x4e')](_0xfbb7('0x59'),'t',_0xfbb7('0x5a'));var _0x596c1e=squel[_0xfbb7('0x5b')]();var _0x25dc4e=[];var _0x8f0c31=squel['expr']();var _0xb17b7;if(_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x5c')]){_0xb17b7=as['parseSearch'](_0x554876[_0xfbb7('0x3c')]['search']);var _0x3f67c7=_0xb17b7['sqlOperator'];for(var _0x1f40ff=0x0;_0x1f40ff<_0xb17b7[_0xfbb7('0x5d')][_0xfbb7('0x5e')];_0x1f40ff++){var _0x73b7ac=_0xb17b7[_0xfbb7('0x5d')][_0x1f40ff];var _0x4f242f='i';var _0x4f00e8=_['find'](_0x55c513,[_0xfbb7('0x2e'),_0x73b7ac[_0xfbb7('0x48')]]);if(!_0x4f00e8){switch(_0x73b7ac[_0xfbb7('0x48')]){case _0xfbb7('0x5f'):if(_0x73b7ac[_0xfbb7('0x60')]==0x1){_0x254242[_0xfbb7('0x61')]('`'+_0x73b7ac[_0xfbb7('0x48')]+_0xfbb7('0x62'));}else{_0x254242['having']('`'+_0x73b7ac['field']+_0xfbb7('0x63'));}break;case _0xfbb7('0x64'):if(_0x73b7ac[_0xfbb7('0x65')]===_0xfbb7('0x66')){if(_0x73b7ac['value'][_0xfbb7('0x67')]('\x20')[_0xfbb7('0x5e')]>0x1){_0x596c1e[_0x3f67c7](_0xfbb7('0x68'),qs['getFullTextValue'](_0x73b7ac[_0xfbb7('0x60')]),null);}else{var _0x509e7c='%'+_0x73b7ac[_0xfbb7('0x60')]+'%';_0x596c1e[_0x3f67c7](_0xfbb7('0x69'),_0x509e7c,_0x509e7c,_0x509e7c);}}else{_0x4f00e8=_['find'](_0x55c513,[_0xfbb7('0x2e'),'ContactId']);_0x73b7ac[_0xfbb7('0x48')]=_0xfbb7('0x6a');_0x583186=as[_0xfbb7('0x6b')](_0x4f242f,_0x4f00e8['type'],_0x73b7ac);_0x596c1e[_0x3f67c7](_0x583186[_0xfbb7('0x6c')],_0x583186['value'][_0xfbb7('0x6d')],_0x583186['value']['end']);}break;case _0xfbb7('0x6e'):var _0xfa5c51=_0x73b7ac['value'][_0xfbb7('0x67')](',')[_0xfbb7('0x30')](function(_0x56ddde){return Number(_0x56ddde);});_0xfa5c51['forEach'](function(_0x388d00){_0x8f0c31['or'](_0xfbb7('0x6f'),'%,'+_0x388d00+',%');});_0x25dc4e=_[_0xfbb7('0x70')](_0x25dc4e,_0xfa5c51);break;case'User':if(_0x73b7ac[_0xfbb7('0x65')]===_0xfbb7('0x66')){_0x596c1e[_0x3f67c7](_0xfbb7('0x71'),'%'+_0x73b7ac[_0xfbb7('0x60')]+'%',null);}else{_0x4f00e8=_['find'](_0x55c513,[_0xfbb7('0x2e'),_0xfbb7('0x72')]);_0x73b7ac['field']=_0xfbb7('0x72');_0x583186=as['buildExpression'](_0x4f242f,_0x4f00e8[_0xfbb7('0x39')],_0x73b7ac);_0x596c1e[_0x3f67c7](_0x583186[_0xfbb7('0x6c')],_0x583186['value'][_0xfbb7('0x6d')],_0x583186[_0xfbb7('0x60')][_0xfbb7('0x20')]);}break;case _0xfbb7('0x73'):_0x583186=as[_0xfbb7('0x6b')]('me',null,_0x73b7ac);_0x596c1e[_0x3f67c7](_0x583186[_0xfbb7('0x6c')],_0x583186[_0xfbb7('0x60')][_0xfbb7('0x6d')],_0x583186['value']['end']);break;}}else{var _0x583186=as[_0xfbb7('0x6b')](_0x4f242f,_0x4f00e8[_0xfbb7('0x39')],_0x73b7ac);_0x596c1e[_0x3f67c7](_0x583186[_0xfbb7('0x6c')],_0x583186[_0xfbb7('0x60')][_0xfbb7('0x6d')],_0x583186[_0xfbb7('0x60')][_0xfbb7('0x20')]);}}}else{var _0x1cc0e1=_(_0x554876['query'])['keys']()[_0xfbb7('0x30')](function(_0x1c6e1a){return _[_0xfbb7('0x74')](_0x55c513,[_0xfbb7('0x2e'),_0x1c6e1a])?_0x1c6e1a:undefined;})[_0xfbb7('0x75')]()[_0xfbb7('0x60')]();if(!_[_0xfbb7('0x76')](_0x1cc0e1)){_0x1cc0e1[_0xfbb7('0x77')](function(_0x30fbc6){if(_0x30fbc6===_0xfbb7('0x78')){_0x254242['where'](_0xfbb7('0x79'),[][_0xfbb7('0x7a')](_0x554876[_0xfbb7('0x3c')][_0x30fbc6]));}else if(_0x30fbc6===_0xfbb7('0x7b')){var _0x20f626=JSON[_0xfbb7('0x7c')](_0x554876[_0xfbb7('0x3c')][_0x30fbc6])['$gte'];var _0x494a06=JSON['parse'](_0x554876['query'][_0x30fbc6])[_0xfbb7('0x7d')];_0x254242[_0xfbb7('0x45')](_0xfbb7('0x7e'),_0x20f626,_0x494a06);}else{if(_0x554876[_0xfbb7('0x3c')][_0x30fbc6]===_0xfbb7('0x7f')){_0x254242['where']('i.'+_0x30fbc6+'\x20IS\x20NULL');}else{_0x254242[_0xfbb7('0x45')]('i.'+_0x30fbc6+_0xfbb7('0x80'),_0x554876['query'][_0x30fbc6]);}}});}if(_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x81')]){if(_0x554876['query']['read']==0x1){_0x254242[_0xfbb7('0x61')]('`unreadMessages`\x20=\x200');}else{_0x254242['having']('`unreadMessages`\x20>\x200');}}if(_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x82')]){_0x25dc4e=_[_0xfbb7('0x83')](_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x82')])?_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x82')]:new Array(_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x82')]);_0x25dc4e[_0xfbb7('0x77')](function(_0x51202a){_0x8f0c31['or'](_0xfbb7('0x6f'),'%,'+_0x51202a+',%');});}if(_0x554876['query'][_0xfbb7('0x84')]){var _0x298dfc=_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x84')][_0xfbb7('0x85')]('\x5c','\x5c\x5c')[_0xfbb7('0x85')]('\x27\x27',_0xfbb7('0x86'));if(qs[_0xfbb7('0x87')](_0x298dfc)){_0x596c1e['or'](_0xfbb7('0x88'),_0x298dfc+'%');}else{_0x596c1e['or'](_0xfbb7('0x89'),qs[_0xfbb7('0x8a')](_0x298dfc))['or'](_0xfbb7('0x8b'),_0x298dfc+'%')['or'](_0xfbb7('0x8c'),_0x298dfc+'%');}}}_0x254242[_0xfbb7('0x45')](_0x596c1e);_0x254242[_0xfbb7('0x8d')](_0xfbb7('0x8e'));var _0x4adda7={'type':db[_0xfbb7('0x8f')][_0xfbb7('0x90')][_0xfbb7('0x91')],'raw':!![]};var _0xfd28ff=_0x254242[_0xfbb7('0x92')]();_0xfd28ff[_0xfbb7('0x48')](_0xfbb7('0x8e'));_0xfd28ff[_0xfbb7('0x48')](_0xfbb7('0x93'),_0xfbb7('0x5f'));if(_0x19b9c6[_0xfbb7('0x44')]){_0x19b9c6[_0xfbb7('0x44')][_0xfbb7('0x77')](function(_0x1152d6){_0x254242['order']('i.'+_0x1152d6[0x0],_0x1152d6[0x1]==='DESC'?![]:!![]);});}if(!_[_0xfbb7('0x76')](_0x25dc4e)){_0x254242[_0xfbb7('0x61')](_0x8f0c31);_0xfd28ff[_0xfbb7('0x45')](_0xfbb7('0x94'),_0x25dc4e);}BPromise[_0xfbb7('0x95')]()[_0xfbb7('0x2a')](function(){if(!_0xb17b7){if(_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x78')]||_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x96')])return;_0xfd28ff[_0xfbb7('0x45')](_0xfbb7('0x97'));_0x254242['where'](_0xfbb7('0x97'));return;}return _0x554876[_0xfbb7('0x98')][_0xfbb7('0x99')]({'attributes':['id'],'raw':!![]})[_0xfbb7('0x2a')](function(_0x4d47eb){if(_[_0xfbb7('0x76')](_0x4d47eb)){_0xfd28ff[_0xfbb7('0x45')](_0xfbb7('0x9a'));_0x254242['where'](_0xfbb7('0x9a'));}else{_0xfd28ff['where'](_0xfbb7('0x79'),_[_0xfbb7('0x30')](_0x4d47eb,'id'));_0x254242[_0xfbb7('0x45')](_0xfbb7('0x79'),_['map'](_0x4d47eb,'id'));}});})[_0xfbb7('0x2a')](function(){db[_0xfbb7('0x9b')][_0xfbb7('0x3c')](_0xfd28ff[_0xfbb7('0x9c')](),_0x4adda7)[_0xfbb7('0x2a')](function(_0x50ad8a){_0x16390a['count']=_0x50ad8a[_0xfbb7('0x5e')];if(_0x16390a[_0xfbb7('0x22')]===0x0)return[];return db[_0xfbb7('0x9b')][_0xfbb7('0x3c')](_0x37c27f[_0xfbb7('0x9c')](),_0x4adda7)[_0xfbb7('0x2a')](function(_0x4051b6){_0x2e6309=_['keyBy'](_0x4051b6,'id');_0x4adda7=_[_0xfbb7('0x9d')](_0x4adda7,{'model':db[_0xfbb7('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x554876[_0xfbb7('0x3c')][_0xfbb7('0x40')]){_0x19b9c6[_0xfbb7('0x3f')][_0xfbb7('0x77')](function(_0x13ebcb){_0x254242[_0xfbb7('0x48')]('i.'+_0x13ebcb);});}else{_0x254242[_0xfbb7('0x48')](_0xfbb7('0x93'),_0xfbb7('0x5f'));_0x254242['field'](_0xfbb7('0x9f'),'Account.key');_0x254242[_0xfbb7('0x48')](_0xfbb7('0xa0'),_0xfbb7('0xa1'));_0x254242[_0xfbb7('0x48')](_0xfbb7('0xa2'));_0x254242['field'](_0xfbb7('0xa3'),_0xfbb7('0xa4'));_0x254242[_0xfbb7('0x48')](_0xfbb7('0xa5'),_0xfbb7('0xa6'));_0x254242['field'](_0xfbb7('0xa7'),_0xfbb7('0xa8'));_0x254242[_0xfbb7('0x48')](_0xfbb7('0xa9'),_0xfbb7('0xaa'));_0x254242['field'](_0xfbb7('0xab'),'Contact.mobile');_0x254242['field'](_0xfbb7('0xac'),_0xfbb7('0xad'));_0x254242[_0xfbb7('0x48')]('o.fullname',_0xfbb7('0xae'));_0x254242[_0xfbb7('0x48')]('o.internal',_0xfbb7('0xaf'));_0x254242[_0xfbb7('0x48')](_0xfbb7('0xb0'),_0xfbb7('0x32'));}if(_0x19b9c6[_0xfbb7('0x43')])_0x254242[_0xfbb7('0x43')](_0x19b9c6[_0xfbb7('0x43')]);if(_0x19b9c6[_0xfbb7('0x23')])_0x254242['offset'](_0x19b9c6[_0xfbb7('0x23')]);return db[_0xfbb7('0x9b')][_0xfbb7('0x3c')](_0x254242[_0xfbb7('0x9c')](),_0x4adda7);})['then'](function(_0x518a7f){_0x39de9e[_0xfbb7('0x45')](_0xfbb7('0xb1'),_[_0xfbb7('0x30')](_0x518a7f,'id'));return db[_0xfbb7('0x9b')][_0xfbb7('0x3c')](_0x39de9e[_0xfbb7('0x9c')](),_0x4adda7)[_0xfbb7('0x2a')](function(_0x41bd5e){var _0x5e582b=_[_0xfbb7('0xb2')](_0x41bd5e,_0xfbb7('0xb3'));var _0x5f16ca=[];_0x518a7f[_0xfbb7('0x77')](function(_0x4bd292){_0x5f16ca[_0xfbb7('0x34')](updateOpenchannelInteraction(_0x4bd292,_0x2e6309,_0x5e582b));});return BPromise['all'](_0x5f16ca);});});})[_0xfbb7('0x2a')](function(_0x1a621c){_0x16390a[_0xfbb7('0xb4')]=_0x1a621c;return _0x16390a;})[_0xfbb7('0x2a')](respondWithFilteredResult(_0x5c022a,_0x19b9c6));})[_0xfbb7('0x35')](handleError(_0x5c022a,null));};exports[_0xfbb7('0xb5')]=function(_0x105806,_0xb120d7){var _0x2a1c2a={'raw':![],'where':{'id':_0x105806['params']['id']}},_0x411416={};_0x411416[_0xfbb7('0x3a')]=_[_0xfbb7('0x3b')](db['OpenchannelInteraction']['rawAttributes']);_0x411416[_0xfbb7('0x3c')]=_[_0xfbb7('0x3b')](_0x105806[_0xfbb7('0x3c')]);_0x411416['filters']=_[_0xfbb7('0x3e')](_0x411416[_0xfbb7('0x3a')],_0x411416['query']);_0x2a1c2a['attributes']=_['intersection'](_0x411416['model'],qs[_0xfbb7('0x40')](_0x105806[_0xfbb7('0x3c')]['fields']));_0x2a1c2a[_0xfbb7('0x3f')]=_0x2a1c2a[_0xfbb7('0x3f')][_0xfbb7('0x5e')]?_0x2a1c2a[_0xfbb7('0x3f')]:_0x411416[_0xfbb7('0x3a')];if(_0x105806['query']['includeAll']){_0x2a1c2a[_0xfbb7('0xb6')]=[{'all':!![]}];}_0x2a1c2a=_[_0xfbb7('0x9d')]({},_0x2a1c2a,_0x105806[_0xfbb7('0xb7')]);return db['OpenchannelInteraction'][_0xfbb7('0xb8')](_0x2a1c2a)[_0xfbb7('0x2a')](handleEntityNotFound(_0xb120d7,null))[_0xfbb7('0x2a')](respondWithResult(_0xb120d7,null))['catch'](handleError(_0xb120d7,null));};exports[_0xfbb7('0xb9')]=function(_0x13965c,_0x1a0553){return db[_0xfbb7('0x9e')][_0xfbb7('0xb9')](_0x13965c[_0xfbb7('0x73')],{})[_0xfbb7('0x2a')](respondWithResult(_0x1a0553,0xc9))['catch'](handleError(_0x1a0553,null));};exports[_0xfbb7('0x29')]=function(_0x4d4702,_0x5c63db){if(_0x4d4702[_0xfbb7('0x73')]['id']){delete _0x4d4702[_0xfbb7('0x73')]['id'];}return db[_0xfbb7('0x9e')][_0xfbb7('0xb8')]({'where':{'id':_0x4d4702['params']['id']}})[_0xfbb7('0x2a')](handleEntityNotFound(_0x5c63db,null))[_0xfbb7('0x2a')](saveUpdates(_0x4d4702[_0xfbb7('0x73')],null))[_0xfbb7('0x2a')](respondWithResult(_0x5c63db,null))[_0xfbb7('0x35')](handleError(_0x5c63db,null));};exports[_0xfbb7('0x2b')]=function(_0x5b28b5,_0x930d46){return db[_0xfbb7('0x9e')][_0xfbb7('0xb8')]({'where':{'id':_0x5b28b5[_0xfbb7('0xba')]['id']}})[_0xfbb7('0x2a')](handleEntityNotFound(_0x930d46,null))[_0xfbb7('0x2a')](removeEntity(_0x930d46,null))[_0xfbb7('0x35')](handleError(_0x930d46,null));};exports[_0xfbb7('0xbb')]=function(_0x559a54,_0x1c25aa){return db[_0xfbb7('0x9e')][_0xfbb7('0xbb')]()[_0xfbb7('0x2a')](respondWithResult(_0x1c25aa,null))[_0xfbb7('0x35')](handleError(_0x1c25aa,null));};exports[_0xfbb7('0xbc')]=function(_0x2df3d7,_0x51a12e,_0x482c53){return db[_0xfbb7('0xbd')][_0xfbb7('0xb8')]({'where':{'id':_0x2df3d7[_0xfbb7('0xba')]['id']}})[_0xfbb7('0x2a')](handleEntityNotFound(_0x51a12e,null))[_0xfbb7('0x2a')](function(_0x542349){if(_0x542349){return _0x542349[_0xfbb7('0xbc')](_0x2df3d7[_0xfbb7('0x73')]['ids'],_[_0xfbb7('0xbe')](_0x2df3d7[_0xfbb7('0x73')],[_0xfbb7('0xbf'),'id'])||{});}})['then'](respondWithResult(_0x51a12e,null))[_0xfbb7('0x35')](handleError(_0x51a12e,null));};exports['getMessages']=function(_0x49eed5,_0x8feaa7,_0x49d9a4){var _0x1027e3={'raw':![],'where':{}};var _0x4ada90={};var _0xa2543={'count':0x0,'rows':[]};return db[_0xfbb7('0x9e')][_0xfbb7('0xc0')]({'where':{'id':_0x49eed5[_0xfbb7('0xba')]['id']}})[_0xfbb7('0x2a')](handleEntityNotFound(_0x8feaa7,null))['then'](function(_0x4f1ea6){if(_0x4f1ea6){_0x4ada90[_0xfbb7('0x3a')]=_['keys'](db['OpenchannelMessage'][_0xfbb7('0x37')]);_0x4ada90['query']=_[_0xfbb7('0x3b')](_0x49eed5['query']);_0x4ada90[_0xfbb7('0x3d')]=_[_0xfbb7('0x3e')](_0x4ada90[_0xfbb7('0x3a')],_0x4ada90[_0xfbb7('0x3c')]);_0x1027e3['attributes']=_[_0xfbb7('0x3e')](_0x4ada90['model'],qs[_0xfbb7('0x40')](_0x49eed5[_0xfbb7('0x3c')][_0xfbb7('0x40')]));_0x1027e3[_0xfbb7('0x3f')]=_0x1027e3[_0xfbb7('0x3f')][_0xfbb7('0x5e')]?_0x1027e3[_0xfbb7('0x3f')]:_0x4ada90['model'];if(!_0x49eed5[_0xfbb7('0x3c')][_0xfbb7('0x41')](_0xfbb7('0x42'))){_0x1027e3['limit']=qs['limit'](_0x49eed5[_0xfbb7('0x3c')]['limit']);_0x1027e3[_0xfbb7('0x23')]=qs[_0xfbb7('0x23')](_0x49eed5[_0xfbb7('0x3c')][_0xfbb7('0x23')]);}_0x1027e3[_0xfbb7('0x44')]=qs['sort'](_0x49eed5[_0xfbb7('0x3c')][_0xfbb7('0xc1')]);_0x1027e3[_0xfbb7('0x45')]=qs[_0xfbb7('0x3d')](_[_0xfbb7('0x46')](_0x49eed5[_0xfbb7('0x3c')],_0x4ada90[_0xfbb7('0x3d')]));_0x1027e3['where'][_0xfbb7('0xb3')]=_0x4f1ea6['id'];if(_0x49eed5[_0xfbb7('0x3c')][_0xfbb7('0x84')]){_0x1027e3[_0xfbb7('0x45')]=_[_0xfbb7('0x9d')](_0x1027e3[_0xfbb7('0x45')],{'$or':_['map'](_0x1027e3['attributes'],function(_0x4b56cc){var _0x4a6959={};_0x4a6959[_0x4b56cc]={'$like':'%'+_0x49eed5[_0xfbb7('0x3c')][_0xfbb7('0x84')]+'%'};return _0x4a6959;})});}if(_0x49eed5[_0xfbb7('0x3c')][_0xfbb7('0xc2')]){var _0x2d2191=_0x49eed5[_0xfbb7('0x3c')]['$gte'][_0xfbb7('0x67')](',');var _0x3af0a8={};_0x3af0a8[_0x2d2191[0x0]]={'$gte':moment(_0x2d2191[0x1])[_0xfbb7('0xc3')](_0xfbb7('0xc4'))};_0x1027e3[_0xfbb7('0x45')]=_[_0xfbb7('0x9d')](_0x1027e3[_0xfbb7('0x45')],_0x3af0a8);}_0x1027e3=_[_0xfbb7('0x9d')]({},_0x1027e3,_0x49eed5[_0xfbb7('0xb7')]);return db['OpenchannelMessage']['count']({'where':_0x1027e3[_0xfbb7('0x45')]})['then'](function(_0x21a0e2){_0xa2543[_0xfbb7('0x22')]=_0x21a0e2;if(_0x49eed5[_0xfbb7('0x3c')][_0xfbb7('0xc5')]){_0x1027e3['include']=[{'all':!![]}];}return db[_0xfbb7('0xbd')][_0xfbb7('0xc6')](_0x1027e3);})['then'](function(_0x51df4d){_0xa2543['rows']=_0x51df4d;return _0xa2543;});}})['then'](respondWithFilteredResult(_0x8feaa7,_0x1027e3))[_0xfbb7('0x35')](handleError(_0x8feaa7,null));};exports['addTags']=function(_0x12dae7,_0x11603a,_0xce73c8){return db[_0xfbb7('0x9e')][_0xfbb7('0xb8')]({'where':{'id':_0x12dae7[_0xfbb7('0xba')]['id']}})[_0xfbb7('0x2a')](handleEntityNotFound(_0x11603a,null))['then'](function(_0x243138){if(_0x243138){return _0x243138[_0xfbb7('0xc7')](_0x12dae7['body'][_0xfbb7('0xbf')],_['omit'](_0x12dae7['body'],[_0xfbb7('0xbf'),'id'])||{})['spread'](function(){return db[_0xfbb7('0x6e')][_0xfbb7('0xc6')]({'attributes':['id','name',_0xfbb7('0x49')],'where':{'id':_0x12dae7[_0xfbb7('0x73')][_0xfbb7('0xbf')]}});})[_0xfbb7('0x2a')](function(_0x1fb274){socket['emit'](_0xfbb7('0xc8'),{'id':Number(_0x12dae7[_0xfbb7('0xba')]['id']),'tags':_0x1fb274||[]});return{'id':Number(_0x12dae7['params']['id']),'tags':_0x1fb274||[]};});}})[_0xfbb7('0x2a')](respondWithResult(_0x11603a,null))[_0xfbb7('0x35')](handleError(_0x11603a,null));};exports[_0xfbb7('0xc9')]=function(_0x469ffa,_0x4ae17d,_0xa7494f){return db[_0xfbb7('0x9e')][_0xfbb7('0xb8')]({'where':{'id':_0x469ffa[_0xfbb7('0xba')]['id']}})[_0xfbb7('0x2a')](handleEntityNotFound(_0x4ae17d,null))[_0xfbb7('0x2a')](function(_0x3627af){if(_0x3627af){return _0x3627af[_0xfbb7('0xc9')](_0x469ffa[_0xfbb7('0x3c')]['ids']);}})[_0xfbb7('0x2a')](respondWithStatusCode(_0x4ae17d,null))['catch'](handleError(_0x4ae17d,null));};exports[_0xfbb7('0xca')]=function(_0xc2a026,_0x4efb5b){var _0x8cba00=moment()['unix']()[_0xfbb7('0x9c')]();var _0x16fce0=path[_0xfbb7('0xcb')](config[_0xfbb7('0xcc')],'server',_0xfbb7('0xcd'),_0xfbb7('0xce'));var _0x241f09=path['join'](config[_0xfbb7('0xcc')],'server','files','attachments');var _0x154754=path[_0xfbb7('0xcb')](_0x16fce0,_0x8cba00);var _0x3bbe9e=util[_0xfbb7('0xc3')](_0xfbb7('0xcf'),_0xc2a026['params']['id'],_0x8cba00);var _0x2fb25d=path[_0xfbb7('0xcb')](_0x16fce0,_0x3bbe9e);var _0x2adf8b=[];_0x2adf8b[_0xfbb7('0x34')]({'model':db[_0xfbb7('0xd0')],'as':'User','attributes':['id',_0xfbb7('0x31')],'raw':!![]});_0x2adf8b['push']({'model':db['CmContact'],'as':_0xfbb7('0x64'),'attributes':['id',_0xfbb7('0xd1'),_0xfbb7('0xd2')],'raw':!![]});if(_0xc2a026[_0xfbb7('0x3c')][_0xfbb7('0xd3')]){_0x2adf8b[_0xfbb7('0x34')]({'model':db[_0xfbb7('0xd4')],'as':_0xfbb7('0xd4'),'raw':!![]});}var _0x2637b3=[{'model':db[_0xfbb7('0xbd')],'as':'Messages','attributes':['id',_0xfbb7('0x73'),_0xfbb7('0x7b'),'direction',_0xfbb7('0xd5'),_0xfbb7('0x81')],'include':_0x2adf8b}];_0x2637b3['push']({'model':db[_0xfbb7('0xd6')],'as':_0xfbb7('0xd7'),'attributes':['id','name']});_0x2637b3[_0xfbb7('0x34')]({'model':db[_0xfbb7('0xd0')],'as':_0xfbb7('0xd8'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0xfbb7('0xb8')]({'where':{'id':_0xc2a026['params']['id']},'include':_0x2637b3})[_0xfbb7('0x2a')](handleEntityNotFound(_0x4efb5b,null))[_0xfbb7('0x2a')](function(_0x13e566){if(_0x13e566){var _0x57ecff=_0x13e566[_0xfbb7('0xd9')]({'plain':!![]});fs['mkdirSync'](_0x154754);var _0x588727={'format':'A4','border':_0xfbb7('0xda'),'header':{'height':_0xfbb7('0xdb'),'contents':{'first':_0xfbb7('0xdc')}},'footer':{'height':'30px','contents':{'default':util[_0xfbb7('0xc3')](_0xfbb7('0xdd'),util[_0xfbb7('0xc3')](_0xfbb7('0xde'),_0xfbb7('0xdf'),_0x57ecff['id']),moment()[_0xfbb7('0xc3')](_0xfbb7('0xe0'))[_0xfbb7('0x9c')]())}}};var _0x404785={'channel':_0xfbb7('0xdf'),'account':_0x57ecff[_0xfbb7('0xd7')][_0xfbb7('0x2e')],'agent':_0x57ecff[_0xfbb7('0xd8')]?_0x57ecff[_0xfbb7('0xd8')][_0xfbb7('0x31')]:'N.A.','createdAt':moment(_0x57ecff[_0xfbb7('0x7b')])[_0xfbb7('0xc3')]('YYYY-MM-DD\x20HH:mm:ss')[_0xfbb7('0x9c')](),'closedAt':_0x57ecff[_0xfbb7('0xe1')]?moment(_0x57ecff[_0xfbb7('0xe2')])['format'](_0xfbb7('0xc4'))['toString']():'','disposition':_0x57ecff['disposition'],'visibility':_0x57ecff['threadId']?_0xfbb7('0xe3'):_0xfbb7('0xe4'),'messages':_(_0x57ecff[_0xfbb7('0xe5')])['filter']({'secret':![]})['map'](function(_0x3e76bb){if(_0x3e76bb[_0xfbb7('0xd4')]){var _0x5dabed=path[_0xfbb7('0xcb')](_0x241f09,_0x3e76bb[_0xfbb7('0xd4')]['basename']);if(fs[_0xfbb7('0xe6')](_0x5dabed)){fs['createReadStream'](_0x5dabed)['pipe'](fs[_0xfbb7('0xe7')](path['join'](_0x154754,_0x3e76bb[_0xfbb7('0xd4')]['basename'])));}}return{'date':moment(_0x3e76bb[_0xfbb7('0x7b')])[_0xfbb7('0xc3')](_0xfbb7('0xc4'))['toString'](),'sender':_0x3e76bb[_0xfbb7('0xe8')]==='out'?_0x3e76bb[_0xfbb7('0xd0')]?_0x3e76bb['User'][_0xfbb7('0x31')]:'System':_0x3e76bb[_0xfbb7('0x64')][_0xfbb7('0xd1')]+(_0x3e76bb[_0xfbb7('0x64')][_0xfbb7('0xd2')]?'\x20'+_0x3e76bb['Contact'][_0xfbb7('0xd2')]:''),'body':_0x3e76bb['Attachment']?_0x3e76bb[_0xfbb7('0xd4')][_0xfbb7('0xe9')]:_0x3e76bb[_0xfbb7('0x73')],'direction':_0x3e76bb[_0xfbb7('0xe8')]==='out'?'A':'C','secret':_0x3e76bb['secret'],'read':_0x3e76bb[_0xfbb7('0x81')],'attachment':_0x3e76bb[_0xfbb7('0xd4')]};})[_0xfbb7('0x60')]()};return ejs[_0xfbb7('0xea')](path[_0xfbb7('0xcb')](config['root'],_0xfbb7('0xeb'),_0xfbb7('0xec'),_0xfbb7('0xed')),{'interaction':_0x404785})[_0xfbb7('0x2a')](function(_0x5ce972){return new BPromise(function(_0x272e8d,_0x24bede){pdf[_0xfbb7('0xb9')](_0x5ce972,_0x588727)[_0xfbb7('0xee')](path[_0xfbb7('0xcb')](_0x154754,'transcript-'+_0x57ecff['id']+'-'+_0x8cba00+'.pdf'),function(_0x1e0c8e,_0x104b02){if(_0x1e0c8e)return _0x24bede(_0x1e0c8e);_0x272e8d(_0x104b02);});});})[_0xfbb7('0x2a')](function(){return new BPromise(function(_0x389c4f,_0x3b63d6){zipdir(_0x154754,{'saveTo':_0x2fb25d},function(_0x526585,_0x15aa7f){if(_0x526585)return _0x3b63d6(_0x526585);return _0x389c4f(_0x15aa7f);});})['then'](function(){return new BPromise(function(_0x4cc702,_0x46c175){rimraf(_0x154754,function(_0x2ee316){if(_0x2ee316)_0x46c175(_0x2ee316);return _0x4cc702();});});})['then'](function(){return _0x4efb5b['download'](_0x2fb25d,_0x3bbe9e,function(_0x5d4e07){if(_0x5d4e07){console[_0xfbb7('0xef')](_0xfbb7('0xf0'),_0x5d4e07);}else{fs['unlinkSync'](_0x2fb25d);}});});});}else{return _0x4efb5b['sendStatus'](0xc8);}})[_0xfbb7('0x35')](handleError(_0x4efb5b,null));}; \ No newline at end of file +var _0x2e51=['count','offset','limit','Content-Range','json','save','update','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','then','catch','index','OpenchannelInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','select','field','color','tools_tags','u.fullname','from','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','text','start','some','isEmpty','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','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','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','rawAttributes','include','merge','options','create','describe','addMessage','OpenchannelMessage','params','ids','omit','findOne','nolimit','format','includeAll','findAll','rows','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','unix','root','server','files','join','transcript-%d-%s.zip','User','firstName','lastName','attachments','Attachment','Messages','direction','secret','Account','Owner','get','mkdirSync','10px','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','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','out','renderFile','views','toFile','transcript-','download','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end'];(function(_0x47abc8,_0x14dd00){var _0x87cf98=function(_0x30a96a){while(--_0x30a96a){_0x47abc8['push'](_0x47abc8['shift']());}};_0x87cf98(++_0x14dd00);}(_0x2e51,0x1b9));var _0x12e5=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x2e51[_0x8a969d];return _0x1d8dc7;};'use strict';var pdf=require(_0x12e5('0x0'));var emlformat=require(_0x12e5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x12e5('0x2'));var jsonpatch=require(_0x12e5('0x3'));var rp=require(_0x12e5('0x4'));var moment=require(_0x12e5('0x5'));var BPromise=require(_0x12e5('0x6'));var Mustache=require(_0x12e5('0x7'));var util=require('util');var path=require(_0x12e5('0x8'));var sox=require('sox');var csv=require(_0x12e5('0x9'));var ejs=require(_0x12e5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x12e5('0xb'));var crypto=require(_0x12e5('0xc'));var jsforce=require(_0x12e5('0xd'));var deskjs=require(_0x12e5('0xe'));var toCsv=require(_0x12e5('0x9'));var querystring=require('querystring');var Papa=require(_0x12e5('0xf'));var Redis=require(_0x12e5('0x10'));var authService=require(_0x12e5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x12e5('0x12'));var hardwareService=require(_0x12e5('0x13'));var logger=require(_0x12e5('0x14'))('api');var utils=require(_0x12e5('0x15'));var config=require(_0x12e5('0x16'));var db=require(_0x12e5('0x17'))['db'];config['redis']=_[_0x12e5('0x18')](config[_0x12e5('0x19')],{'host':_0x12e5('0x1a'),'port':0x18eb});var socket=require(_0x12e5('0x1b'))(new Redis(config[_0x12e5('0x19')]));require(_0x12e5('0x1c'))[_0x12e5('0x1d')](socket);function respondWithStatusCode(_0xc39c4d,_0xb1ee43){_0xb1ee43=_0xb1ee43||0xcc;return function(_0x30b703){if(_0x30b703){return _0xc39c4d[_0x12e5('0x1e')](_0xb1ee43);}return _0xc39c4d[_0x12e5('0x1f')](_0xb1ee43)[_0x12e5('0x20')]();};}function respondWithResult(_0x2577de,_0x5ea564){_0x5ea564=_0x5ea564||0xc8;return function(_0x169342){if(_0x169342){return _0x2577de[_0x12e5('0x1f')](_0x5ea564)['json'](_0x169342);}};}function respondWithFilteredResult(_0xc81f52,_0x588891){return function(_0x2b0a00){if(_0x2b0a00){var _0x145283=_0x2b0a00[_0x12e5('0x21')],_0x5e4c52=_0x588891[_0x12e5('0x22')],_0x413f02=_0x588891['offset']+_0x588891[_0x12e5('0x23')],_0x450c4d;if(_0x413f02>=_0x145283){_0x413f02=_0x145283;_0x450c4d=0xc8;}else{_0x450c4d=0xce;}_0xc81f52['status'](_0x450c4d);return _0xc81f52['set'](_0x12e5('0x24'),_0x5e4c52+'-'+_0x413f02+'/'+_0x145283)[_0x12e5('0x25')](_0x2b0a00);}return null;};}function patchUpdates(_0x5208fe){return function(_0x39e1d2){try{jsonpatch['apply'](_0x39e1d2,_0x5208fe,!![]);}catch(_0x4a09ad){return BPromise['reject'](_0x4a09ad);}return _0x39e1d2[_0x12e5('0x26')]();};}function saveUpdates(_0x676021,_0x4f8196){return function(_0x58d9bd){if(_0x58d9bd){return _0x58d9bd[_0x12e5('0x27')](_0x676021)['then'](function(_0x32bbf7){return _0x32bbf7;});}return null;};}function removeEntity(_0x1f4cb2,_0x2217ba){return function(_0x2562b9){if(_0x2562b9){return _0x2562b9[_0x12e5('0x28')]()['then'](function(){_0x1f4cb2[_0x12e5('0x1f')](0xcc)[_0x12e5('0x20')]();});}};}function handleEntityNotFound(_0x574923,_0x44a8af){return function(_0x26b4ce){if(!_0x26b4ce){_0x574923['sendStatus'](0x194);}return _0x26b4ce;};}function handleError(_0x8f4efb,_0x1ee4b5){_0x1ee4b5=_0x1ee4b5||0x1f4;return function(_0x5c43f4){logger[_0x12e5('0x29')](_0x5c43f4[_0x12e5('0x2a')]);if(_0x5c43f4[_0x12e5('0x2b')]){delete _0x5c43f4[_0x12e5('0x2b')];}_0x8f4efb[_0x12e5('0x1f')](_0x1ee4b5)[_0x12e5('0x2c')](_0x5c43f4);};}function getInteractionUsers(_0x492677,_0x557a25){return new BPromise(function(_0x47867d,_0x16ea3d){try{if(_0x557a25[_0x492677['id']]){_0x492677[_0x12e5('0x2d')]=_[_0x12e5('0x2e')](_0x557a25[_0x492677['id']],function(_0x2c4484){return{'id':_0x2c4484['id'],'fullname':_0x2c4484[_0x12e5('0x2f')]};});}}catch(_0x3bcfb4){_0x16ea3d(_0x3bcfb4);}_0x47867d(_0x492677);});}function getInteractionTags(_0x4624ca,_0x20f35c){return new BPromise(function(_0x4744b4,_0x510cf6){try{if(_0x4624ca[_0x12e5('0x30')]){_0x4624ca[_0x12e5('0x31')]=[];_0x4624ca[_0x12e5('0x30')][_0x12e5('0x32')](',')[_0x12e5('0x33')](function(_0x586669){_0x4624ca[_0x12e5('0x31')][_0x12e5('0x34')](_0x20f35c[_0x586669]);});}delete _0x4624ca[_0x12e5('0x30')];}catch(_0x7fe51d){_0x510cf6(_0x7fe51d);}_0x4744b4(_0x4624ca);});}function updateOpenchannelInteraction(_0x550d62,_0x18e232,_0x10c0a9){return new BPromise(function(_0x3ce37c,_0x573fac){return getInteractionUsers(_0x550d62,_0x10c0a9)[_0x12e5('0x35')](function(_0x1834e1){return getInteractionTags(_0x1834e1,_0x18e232);})[_0x12e5('0x35')](function(_0x130934){_0x3ce37c(_0x130934);})[_0x12e5('0x36')](function(_0x310513){_0x573fac(_0x310513);});});}exports[_0x12e5('0x37')]=function(_0xfb4b98,_0x3d9ddf){var _0x5b82a0={},_0x530a48={},_0x486075={'count':0x0,'rows':[]};var _0x287936=_['map'](db[_0x12e5('0x38')]['rawAttributes'],function(_0x147b4e){return{'name':_0x147b4e[_0x12e5('0x39')],'type':_0x147b4e[_0x12e5('0x3a')][_0x12e5('0x3b')]};});_0x530a48[_0x12e5('0x3c')]=_[_0x12e5('0x2e')](_0x287936,_0x12e5('0x2b'));_0x530a48[_0x12e5('0x3d')]=_[_0x12e5('0x3e')](_0xfb4b98[_0x12e5('0x3d')]);_0x530a48[_0x12e5('0x3f')]=_[_0x12e5('0x40')](_0x530a48[_0x12e5('0x3c')],_0x530a48[_0x12e5('0x3d')]);_0x5b82a0[_0x12e5('0x41')]=_[_0x12e5('0x40')](_0x530a48[_0x12e5('0x3c')],qs[_0x12e5('0x42')](_0xfb4b98['query'][_0x12e5('0x42')]));_0x5b82a0[_0x12e5('0x41')]=_0x5b82a0[_0x12e5('0x41')][_0x12e5('0x43')]?_0x5b82a0['attributes']:_0x530a48['model'];if(!_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x44')]('nolimit')){_0x5b82a0[_0x12e5('0x23')]=qs[_0x12e5('0x23')](_0xfb4b98['query'][_0x12e5('0x23')]);_0x5b82a0['offset']=qs[_0x12e5('0x22')](_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x22')]);}_0x5b82a0[_0x12e5('0x45')]=qs[_0x12e5('0x46')](_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x46')]);_0x5b82a0['where']=qs[_0x12e5('0x3f')](_[_0x12e5('0x47')](_0xfb4b98[_0x12e5('0x3d')],_0x530a48[_0x12e5('0x3f')]),_0x287936);var _0x4a9937=[];var _0x3fb638=squel[_0x12e5('0x48')]()[_0x12e5('0x49')]('id')[_0x12e5('0x49')]('name')[_0x12e5('0x49')](_0x12e5('0x4a'))['from'](_0x12e5('0x4b'));var _0x24a400=squel[_0x12e5('0x48')]()[_0x12e5('0x49')]('u.id')[_0x12e5('0x49')](_0x12e5('0x4c'))[_0x12e5('0x49')]('ui.OpenchannelInteractionId')[_0x12e5('0x4d')]('user_has_openchannel_interactions','ui')[_0x12e5('0x4e')](_0x12e5('0x4f'),'u',_0x12e5('0x50'));var _0x3da4ed=squel[_0x12e5('0x48')]()['from'](_0x12e5('0x51'),'i')[_0x12e5('0x4e')](_0x12e5('0x52'),'c',_0x12e5('0x53'))[_0x12e5('0x4e')]('users','o',_0x12e5('0x54'))[_0x12e5('0x4e')](_0x12e5('0x55'),'a',_0x12e5('0x56'))[_0x12e5('0x4e')](_0x12e5('0x57'),'me',_0x12e5('0x58'))[_0x12e5('0x4e')]('openchannel_interaction_has_tags','it',_0x12e5('0x59'))['left_join'](_0x12e5('0x4b'),'t',_0x12e5('0x5a'));var _0x12eeee=squel['expr']();var _0x578046=[];var _0x5968a6=squel['expr']();var _0x463515;if(_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x5b')]){_0x463515=as[_0x12e5('0x5c')](_0xfb4b98['query']['search']);var _0x12b1ab=_0x463515[_0x12e5('0x5d')];for(var _0x298f70=0x0;_0x298f70<_0x463515['conditions']['length'];_0x298f70++){var _0x1d1ef2=_0x463515[_0x12e5('0x5e')][_0x298f70];var _0x34c9a5='i';var _0x363531=_['find'](_0x287936,['name',_0x1d1ef2[_0x12e5('0x49')]]);if(!_0x363531){switch(_0x1d1ef2['field']){case _0x12e5('0x5f'):if(_0x1d1ef2['value']==0x1){_0x3da4ed[_0x12e5('0x60')]('`'+_0x1d1ef2[_0x12e5('0x49')]+_0x12e5('0x61'));}else{_0x3da4ed[_0x12e5('0x60')]('`'+_0x1d1ef2['field']+_0x12e5('0x62'));}break;case _0x12e5('0x63'):if(_0x1d1ef2['operator']===_0x12e5('0x64')){if(_0x1d1ef2[_0x12e5('0x65')][_0x12e5('0x32')]('\x20')[_0x12e5('0x43')]>0x1){_0x12eeee[_0x12b1ab](_0x12e5('0x66'),qs['getFullTextValue'](_0x1d1ef2[_0x12e5('0x65')]),null);}else{var _0x47773d='%'+_0x1d1ef2[_0x12e5('0x65')]+'%';_0x12eeee[_0x12b1ab](_0x12e5('0x67'),_0x47773d,_0x47773d,_0x47773d);}}else{_0x363531=_[_0x12e5('0x68')](_0x287936,[_0x12e5('0x2b'),_0x12e5('0x69')]);_0x1d1ef2[_0x12e5('0x49')]=_0x12e5('0x69');_0xaf9093=as[_0x12e5('0x6a')](_0x34c9a5,_0x363531[_0x12e5('0x3a')],_0x1d1ef2);_0x12eeee[_0x12b1ab](_0xaf9093['text'],_0xaf9093[_0x12e5('0x65')]['start'],_0xaf9093[_0x12e5('0x65')][_0x12e5('0x20')]);}break;case _0x12e5('0x6b'):var _0x185842=_0x1d1ef2[_0x12e5('0x65')][_0x12e5('0x32')](',')[_0x12e5('0x2e')](function(_0x5570f3){return Number(_0x5570f3);});_0x185842['forEach'](function(_0x484b8f){_0x5968a6['or'](_0x12e5('0x6c'),'%,'+_0x484b8f+',%');});_0x578046=_[_0x12e5('0x6d')](_0x578046,_0x185842);break;case'User':if(_0x1d1ef2[_0x12e5('0x6e')]==='$substring'){_0x12eeee[_0x12b1ab](_0x12e5('0x6f'),'%'+_0x1d1ef2[_0x12e5('0x65')]+'%',null);}else{_0x363531=_[_0x12e5('0x68')](_0x287936,['name','UserId']);_0x1d1ef2['field']=_0x12e5('0x70');_0xaf9093=as[_0x12e5('0x6a')](_0x34c9a5,_0x363531[_0x12e5('0x3a')],_0x1d1ef2);_0x12eeee[_0x12b1ab](_0xaf9093['text'],_0xaf9093['value']['start'],_0xaf9093[_0x12e5('0x65')][_0x12e5('0x20')]);}break;case _0x12e5('0x71'):_0xaf9093=as[_0x12e5('0x6a')]('me',null,_0x1d1ef2);_0x12eeee[_0x12b1ab](_0xaf9093[_0x12e5('0x72')],_0xaf9093[_0x12e5('0x65')][_0x12e5('0x73')],_0xaf9093[_0x12e5('0x65')][_0x12e5('0x20')]);break;}}else{var _0xaf9093=as[_0x12e5('0x6a')](_0x34c9a5,_0x363531[_0x12e5('0x3a')],_0x1d1ef2);_0x12eeee[_0x12b1ab](_0xaf9093[_0x12e5('0x72')],_0xaf9093[_0x12e5('0x65')]['start'],_0xaf9093[_0x12e5('0x65')][_0x12e5('0x20')]);}}}else{var _0x3136e1=_(_0xfb4b98[_0x12e5('0x3d')])[_0x12e5('0x3e')]()[_0x12e5('0x2e')](function(_0x25791d){return _[_0x12e5('0x74')](_0x287936,[_0x12e5('0x2b'),_0x25791d])?_0x25791d:undefined;})['compact']()[_0x12e5('0x65')]();if(!_[_0x12e5('0x75')](_0x3136e1)){_0x3136e1['forEach'](function(_0x5c21e2){if(_0x5c21e2==='OpenchannelAccountId'){_0x3da4ed[_0x12e5('0x76')](_0x12e5('0x77'),[][_0x12e5('0x78')](_0xfb4b98[_0x12e5('0x3d')][_0x5c21e2]));}else if(_0x5c21e2===_0x12e5('0x79')){var _0x14fa4c=JSON['parse'](_0xfb4b98[_0x12e5('0x3d')][_0x5c21e2])[_0x12e5('0x7a')];var _0x161604=JSON['parse'](_0xfb4b98[_0x12e5('0x3d')][_0x5c21e2])[_0x12e5('0x7b')];_0x3da4ed[_0x12e5('0x76')](_0x12e5('0x7c'),_0x14fa4c,_0x161604);}else{if(_0xfb4b98[_0x12e5('0x3d')][_0x5c21e2]===_0x12e5('0x7d')){_0x3da4ed[_0x12e5('0x76')]('i.'+_0x5c21e2+_0x12e5('0x7e'));}else{_0x3da4ed['where']('i.'+_0x5c21e2+'\x20=\x20?',_0xfb4b98[_0x12e5('0x3d')][_0x5c21e2]);}}});}if(_0xfb4b98[_0x12e5('0x3d')]['read']){if(_0xfb4b98['query'][_0x12e5('0x7f')]==0x1){_0x3da4ed['having'](_0x12e5('0x80'));}else{_0x3da4ed[_0x12e5('0x60')](_0x12e5('0x81'));}}if(_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x82')]){_0x578046=_[_0x12e5('0x83')](_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x82')])?_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x82')]:new Array(_0xfb4b98['query'][_0x12e5('0x82')]);_0x578046[_0x12e5('0x33')](function(_0x58bae4){_0x5968a6['or'](_0x12e5('0x6c'),'%,'+_0x58bae4+',%');});}if(_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x84')]){var _0x46336e=_0xfb4b98[_0x12e5('0x3d')]['filter']['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x12e5('0x85'));if(qs[_0x12e5('0x86')](_0x46336e)){_0x12eeee['or'](_0x12e5('0x87'),_0x46336e+'%');}else{_0x12eeee['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x12e5('0x88')](_0x46336e))['or']('i.from\x20LIKE\x20?',_0x46336e+'%')['or'](_0x12e5('0x89'),_0x46336e+'%');}}}_0x3da4ed[_0x12e5('0x76')](_0x12eeee);_0x3da4ed['group'](_0x12e5('0x8a'));var _0x430528={'type':db['Sequelize'][_0x12e5('0x8b')][_0x12e5('0x8c')],'raw':!![]};var _0x24a224=_0x3da4ed[_0x12e5('0x8d')]();_0x24a224['field'](_0x12e5('0x8a'));_0x24a224['field'](_0x12e5('0x8e'),_0x12e5('0x5f'));if(_0x5b82a0[_0x12e5('0x45')]){_0x5b82a0['order'][_0x12e5('0x33')](function(_0x375121){_0x3da4ed[_0x12e5('0x45')]('i.'+_0x375121[0x0],_0x375121[0x1]===_0x12e5('0x8f')?![]:!![]);});}if(!_[_0x12e5('0x75')](_0x578046)){_0x3da4ed['having'](_0x5968a6);_0x24a224[_0x12e5('0x76')](_0x12e5('0x90'),_0x578046);}BPromise[_0x12e5('0x91')]()[_0x12e5('0x35')](function(){if(!_0x463515){if(_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x92')]||_0xfb4b98[_0x12e5('0x3d')]['journey'])return;_0x24a224[_0x12e5('0x76')](_0x12e5('0x93'));_0x3da4ed['where'](_0x12e5('0x93'));return;}return _0xfb4b98[_0x12e5('0x94')][_0x12e5('0x95')]({'attributes':['id'],'raw':!![]})[_0x12e5('0x35')](function(_0x1d1c69){if(_['isEmpty'](_0x1d1c69)){_0x24a224['where'](_0x12e5('0x96'));_0x3da4ed['where'](_0x12e5('0x96'));}else{_0x24a224[_0x12e5('0x76')](_0x12e5('0x77'),_[_0x12e5('0x2e')](_0x1d1c69,'id'));_0x3da4ed[_0x12e5('0x76')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x12e5('0x2e')](_0x1d1c69,'id'));}});})[_0x12e5('0x35')](function(){db['sequelize'][_0x12e5('0x3d')](_0x24a224[_0x12e5('0x97')](),_0x430528)['then'](function(_0x3f7d23){_0x486075[_0x12e5('0x21')]=_0x3f7d23['length'];if(_0x486075['count']===0x0)return[];return db['sequelize'][_0x12e5('0x3d')](_0x3fb638[_0x12e5('0x97')](),_0x430528)['then'](function(_0x571351){_0x4a9937=_[_0x12e5('0x98')](_0x571351,'id');_0x430528=_['merge'](_0x430528,{'model':db[_0x12e5('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xfb4b98[_0x12e5('0x3d')][_0x12e5('0x42')]){_0x5b82a0[_0x12e5('0x41')]['forEach'](function(_0x5584e8){_0x3da4ed[_0x12e5('0x49')]('i.'+_0x5584e8);});}else{_0x3da4ed['field'](_0x12e5('0x8e'),'unreadMessages');_0x3da4ed[_0x12e5('0x49')](_0x12e5('0x99'),'Account.key');_0x3da4ed[_0x12e5('0x49')](_0x12e5('0x9a'),_0x12e5('0x9b'));_0x3da4ed['field']('i.*');_0x3da4ed[_0x12e5('0x49')]('c.firstName',_0x12e5('0x9c'));_0x3da4ed[_0x12e5('0x49')](_0x12e5('0x9d'),_0x12e5('0x9e'));_0x3da4ed['field'](_0x12e5('0x9f'),_0x12e5('0xa0'));_0x3da4ed[_0x12e5('0x49')](_0x12e5('0xa1'),_0x12e5('0xa2'));_0x3da4ed[_0x12e5('0x49')](_0x12e5('0xa3'),_0x12e5('0xa4'));_0x3da4ed[_0x12e5('0x49')](_0x12e5('0xa5'),'Contact.fax');_0x3da4ed['field'](_0x12e5('0xa6'),'Owner.fullname');_0x3da4ed[_0x12e5('0x49')](_0x12e5('0xa7'),_0x12e5('0xa8'));_0x3da4ed[_0x12e5('0x49')](_0x12e5('0xa9'),_0x12e5('0x30'));}if(_0x5b82a0[_0x12e5('0x23')])_0x3da4ed[_0x12e5('0x23')](_0x5b82a0['limit']);if(_0x5b82a0['offset'])_0x3da4ed[_0x12e5('0x22')](_0x5b82a0[_0x12e5('0x22')]);return db[_0x12e5('0xaa')][_0x12e5('0x3d')](_0x3da4ed['toString'](),_0x430528);})[_0x12e5('0x35')](function(_0x34bf65){_0x24a400[_0x12e5('0x76')](_0x12e5('0xab'),_['map'](_0x34bf65,'id'));return db[_0x12e5('0xaa')][_0x12e5('0x3d')](_0x24a400[_0x12e5('0x97')](),_0x430528)[_0x12e5('0x35')](function(_0x16f370){var _0x5a8875=_['groupBy'](_0x16f370,_0x12e5('0xac'));var _0x473cb1=[];_0x34bf65[_0x12e5('0x33')](function(_0x577fe7){_0x473cb1[_0x12e5('0x34')](updateOpenchannelInteraction(_0x577fe7,_0x4a9937,_0x5a8875));});return BPromise['all'](_0x473cb1);});});})[_0x12e5('0x35')](function(_0x1c03af){_0x486075['rows']=_0x1c03af;return _0x486075;})['then'](respondWithFilteredResult(_0x3d9ddf,_0x5b82a0));})[_0x12e5('0x36')](handleError(_0x3d9ddf,null));};exports['show']=function(_0x40788d,_0x1275aa){var _0x3bc077={'raw':![],'where':{'id':_0x40788d['params']['id']}},_0x53ced8={};_0x53ced8[_0x12e5('0x3c')]=_[_0x12e5('0x3e')](db[_0x12e5('0x38')][_0x12e5('0xad')]);_0x53ced8[_0x12e5('0x3d')]=_[_0x12e5('0x3e')](_0x40788d['query']);_0x53ced8[_0x12e5('0x3f')]=_[_0x12e5('0x40')](_0x53ced8[_0x12e5('0x3c')],_0x53ced8['query']);_0x3bc077[_0x12e5('0x41')]=_[_0x12e5('0x40')](_0x53ced8[_0x12e5('0x3c')],qs[_0x12e5('0x42')](_0x40788d[_0x12e5('0x3d')]['fields']));_0x3bc077['attributes']=_0x3bc077['attributes'][_0x12e5('0x43')]?_0x3bc077['attributes']:_0x53ced8['model'];if(_0x40788d['query']['includeAll']){_0x3bc077[_0x12e5('0xae')]=[{'all':!![]}];}_0x3bc077=_[_0x12e5('0xaf')]({},_0x3bc077,_0x40788d[_0x12e5('0xb0')]);return db[_0x12e5('0x38')][_0x12e5('0x68')](_0x3bc077)[_0x12e5('0x35')](handleEntityNotFound(_0x1275aa,null))[_0x12e5('0x35')](respondWithResult(_0x1275aa,null))[_0x12e5('0x36')](handleError(_0x1275aa,null));};exports[_0x12e5('0xb1')]=function(_0x5a2267,_0x890370){return db[_0x12e5('0x38')][_0x12e5('0xb1')](_0x5a2267[_0x12e5('0x71')],{})[_0x12e5('0x35')](respondWithResult(_0x890370,0xc9))[_0x12e5('0x36')](handleError(_0x890370,null));};exports['update']=function(_0x29628b,_0x57446b){if(_0x29628b['body']['id']){delete _0x29628b[_0x12e5('0x71')]['id'];}return db['OpenchannelInteraction'][_0x12e5('0x68')]({'where':{'id':_0x29628b['params']['id']}})['then'](handleEntityNotFound(_0x57446b,null))['then'](saveUpdates(_0x29628b[_0x12e5('0x71')],null))[_0x12e5('0x35')](respondWithResult(_0x57446b,null))[_0x12e5('0x36')](handleError(_0x57446b,null));};exports[_0x12e5('0x28')]=function(_0x47e7eb,_0x2c58f3){return db[_0x12e5('0x38')][_0x12e5('0x68')]({'where':{'id':_0x47e7eb['params']['id']}})[_0x12e5('0x35')](handleEntityNotFound(_0x2c58f3,null))[_0x12e5('0x35')](removeEntity(_0x2c58f3,null))[_0x12e5('0x36')](handleError(_0x2c58f3,null));};exports[_0x12e5('0xb2')]=function(_0x39cc71,_0x545f83){return db[_0x12e5('0x38')][_0x12e5('0xb2')]()['then'](respondWithResult(_0x545f83,null))[_0x12e5('0x36')](handleError(_0x545f83,null));};exports[_0x12e5('0xb3')]=function(_0x3647c7,_0x5072c0,_0x45c0bb){return db[_0x12e5('0xb4')][_0x12e5('0x68')]({'where':{'id':_0x3647c7[_0x12e5('0xb5')]['id']}})[_0x12e5('0x35')](handleEntityNotFound(_0x5072c0,null))[_0x12e5('0x35')](function(_0x10221a){if(_0x10221a){return _0x10221a['addMessage'](_0x3647c7['body'][_0x12e5('0xb6')],_[_0x12e5('0xb7')](_0x3647c7[_0x12e5('0x71')],[_0x12e5('0xb6'),'id'])||{});}})[_0x12e5('0x35')](respondWithResult(_0x5072c0,null))['catch'](handleError(_0x5072c0,null));};exports['getMessages']=function(_0x57b101,_0x706ca6,_0x5881dd){var _0x245848={'raw':![],'where':{}};var _0x518ee1={};var _0x1d6cff={'count':0x0,'rows':[]};return db[_0x12e5('0x38')][_0x12e5('0xb8')]({'where':{'id':_0x57b101['params']['id']}})[_0x12e5('0x35')](handleEntityNotFound(_0x706ca6,null))[_0x12e5('0x35')](function(_0x2be0ae){if(_0x2be0ae){_0x518ee1[_0x12e5('0x3c')]=_[_0x12e5('0x3e')](db[_0x12e5('0xb4')]['rawAttributes']);_0x518ee1[_0x12e5('0x3d')]=_[_0x12e5('0x3e')](_0x57b101[_0x12e5('0x3d')]);_0x518ee1['filters']=_[_0x12e5('0x40')](_0x518ee1[_0x12e5('0x3c')],_0x518ee1[_0x12e5('0x3d')]);_0x245848[_0x12e5('0x41')]=_[_0x12e5('0x40')](_0x518ee1[_0x12e5('0x3c')],qs['fields'](_0x57b101['query'][_0x12e5('0x42')]));_0x245848[_0x12e5('0x41')]=_0x245848[_0x12e5('0x41')][_0x12e5('0x43')]?_0x245848['attributes']:_0x518ee1[_0x12e5('0x3c')];if(!_0x57b101[_0x12e5('0x3d')][_0x12e5('0x44')](_0x12e5('0xb9'))){_0x245848[_0x12e5('0x23')]=qs[_0x12e5('0x23')](_0x57b101[_0x12e5('0x3d')][_0x12e5('0x23')]);_0x245848[_0x12e5('0x22')]=qs[_0x12e5('0x22')](_0x57b101[_0x12e5('0x3d')][_0x12e5('0x22')]);}_0x245848[_0x12e5('0x45')]=qs[_0x12e5('0x46')](_0x57b101['query'][_0x12e5('0x46')]);_0x245848[_0x12e5('0x76')]=qs[_0x12e5('0x3f')](_[_0x12e5('0x47')](_0x57b101[_0x12e5('0x3d')],_0x518ee1[_0x12e5('0x3f')]));_0x245848[_0x12e5('0x76')][_0x12e5('0xac')]=_0x2be0ae['id'];if(_0x57b101[_0x12e5('0x3d')][_0x12e5('0x84')]){_0x245848[_0x12e5('0x76')]=_['merge'](_0x245848[_0x12e5('0x76')],{'$or':_[_0x12e5('0x2e')](_0x245848['attributes'],function(_0x1b1965){var _0x573be2={};_0x573be2[_0x1b1965]={'$like':'%'+_0x57b101[_0x12e5('0x3d')]['filter']+'%'};return _0x573be2;})});}if(_0x57b101[_0x12e5('0x3d')][_0x12e5('0x7a')]){var _0x2768fa=_0x57b101[_0x12e5('0x3d')][_0x12e5('0x7a')][_0x12e5('0x32')](',');var _0x200de9={};_0x200de9[_0x2768fa[0x0]]={'$gte':moment(_0x2768fa[0x1])[_0x12e5('0xba')]('YYYY-MM-DD\x20HH:mm:ss')};_0x245848[_0x12e5('0x76')]=_[_0x12e5('0xaf')](_0x245848[_0x12e5('0x76')],_0x200de9);}_0x245848=_['merge']({},_0x245848,_0x57b101[_0x12e5('0xb0')]);return db['OpenchannelMessage'][_0x12e5('0x21')]({'where':_0x245848['where']})['then'](function(_0x3078e0){_0x1d6cff[_0x12e5('0x21')]=_0x3078e0;if(_0x57b101[_0x12e5('0x3d')][_0x12e5('0xbb')]){_0x245848['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x12e5('0xbc')](_0x245848);})[_0x12e5('0x35')](function(_0x4a65ad){_0x1d6cff[_0x12e5('0xbd')]=_0x4a65ad;return _0x1d6cff;});}})[_0x12e5('0x35')](respondWithFilteredResult(_0x706ca6,_0x245848))[_0x12e5('0x36')](handleError(_0x706ca6,null));};exports[_0x12e5('0xbe')]=function(_0xd73ee7,_0x59f235,_0x3bd871){return db[_0x12e5('0x38')][_0x12e5('0x68')]({'where':{'id':_0xd73ee7[_0x12e5('0xb5')]['id']}})['then'](handleEntityNotFound(_0x59f235,null))[_0x12e5('0x35')](function(_0x28073e){if(_0x28073e){return _0x28073e[_0x12e5('0xbf')](_0xd73ee7[_0x12e5('0x71')][_0x12e5('0xb6')],_[_0x12e5('0xb7')](_0xd73ee7['body'],['ids','id'])||{})[_0x12e5('0xc0')](function(){return db[_0x12e5('0x6b')][_0x12e5('0xbc')]({'attributes':['id',_0x12e5('0x2b'),'color'],'where':{'id':_0xd73ee7['body'][_0x12e5('0xb6')]}});})[_0x12e5('0x35')](function(_0x50d99e){socket['emit'](_0x12e5('0xc1'),{'id':Number(_0xd73ee7['params']['id']),'tags':_0x50d99e||[]});return{'id':Number(_0xd73ee7[_0x12e5('0xb5')]['id']),'tags':_0x50d99e||[]};});}})[_0x12e5('0x35')](respondWithResult(_0x59f235,null))['catch'](handleError(_0x59f235,null));};exports[_0x12e5('0xc2')]=function(_0x46ef24,_0x5a48fc,_0xdb9668){return db['OpenchannelInteraction'][_0x12e5('0x68')]({'where':{'id':_0x46ef24[_0x12e5('0xb5')]['id']}})[_0x12e5('0x35')](handleEntityNotFound(_0x5a48fc,null))['then'](function(_0x11685a){if(_0x11685a){return _0x11685a['removeTags'](_0x46ef24[_0x12e5('0x3d')][_0x12e5('0xb6')]);}})[_0x12e5('0x35')](respondWithStatusCode(_0x5a48fc,null))[_0x12e5('0x36')](handleError(_0x5a48fc,null));};exports['download']=function(_0x2742f7,_0x88a82c){var _0x293262=moment()[_0x12e5('0xc3')]()[_0x12e5('0x97')]();var _0x570457=path['join'](config[_0x12e5('0xc4')],_0x12e5('0xc5'),_0x12e5('0xc6'),'tmp');var _0xda8603=path[_0x12e5('0xc7')](config[_0x12e5('0xc4')],_0x12e5('0xc5'),_0x12e5('0xc6'),'attachments');var _0x5beb4c=path[_0x12e5('0xc7')](_0x570457,_0x293262);var _0x3eb6e5=util['format'](_0x12e5('0xc8'),_0x2742f7[_0x12e5('0xb5')]['id'],_0x293262);var _0x39ea54=path[_0x12e5('0xc7')](_0x570457,_0x3eb6e5);var _0x119eb7=[];_0x119eb7[_0x12e5('0x34')]({'model':db[_0x12e5('0xc9')],'as':'User','attributes':['id',_0x12e5('0x2f')],'raw':!![]});_0x119eb7['push']({'model':db['CmContact'],'as':_0x12e5('0x63'),'attributes':['id',_0x12e5('0xca'),_0x12e5('0xcb')],'raw':!![]});if(_0x2742f7[_0x12e5('0x3d')][_0x12e5('0xcc')]){_0x119eb7[_0x12e5('0x34')]({'model':db[_0x12e5('0xcd')],'as':_0x12e5('0xcd'),'raw':!![]});}var _0x5b8f03=[{'model':db[_0x12e5('0xb4')],'as':_0x12e5('0xce'),'attributes':['id',_0x12e5('0x71'),'createdAt',_0x12e5('0xcf'),_0x12e5('0xd0'),_0x12e5('0x7f')],'include':_0x119eb7}];_0x5b8f03[_0x12e5('0x34')]({'model':db['OpenchannelAccount'],'as':_0x12e5('0xd1'),'attributes':['id',_0x12e5('0x2b')]});_0x5b8f03['push']({'model':db[_0x12e5('0xc9')],'as':_0x12e5('0xd2'),'attributes':['id',_0x12e5('0x2f')]});return db[_0x12e5('0x38')][_0x12e5('0x68')]({'where':{'id':_0x2742f7['params']['id']},'include':_0x5b8f03})[_0x12e5('0x35')](handleEntityNotFound(_0x88a82c,null))[_0x12e5('0x35')](function(_0x2b69df){if(_0x2b69df){var _0x45de0d=_0x2b69df[_0x12e5('0xd3')]({'plain':!![]});fs[_0x12e5('0xd4')](_0x5beb4c);var _0x3beaf3={'format':'A4','border':_0x12e5('0xd5'),'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':_0x12e5('0xd6'),'contents':{'default':util[_0x12e5('0xba')](_0x12e5('0xd7'),util[_0x12e5('0xba')](_0x12e5('0xd8'),_0x12e5('0xd9'),_0x45de0d['id']),moment()[_0x12e5('0xba')]('YYYY-MM-DD')[_0x12e5('0x97')]())}}};var _0x575960={'channel':_0x12e5('0xd9'),'account':_0x45de0d[_0x12e5('0xd1')][_0x12e5('0x2b')],'agent':_0x45de0d['Owner']?_0x45de0d[_0x12e5('0xd2')][_0x12e5('0x2f')]:_0x12e5('0xda'),'createdAt':moment(_0x45de0d[_0x12e5('0x79')])['format'](_0x12e5('0xdb'))[_0x12e5('0x97')](),'closedAt':_0x45de0d[_0x12e5('0xdc')]?moment(_0x45de0d[_0x12e5('0xdd')])['format'](_0x12e5('0xdb'))[_0x12e5('0x97')]():'','disposition':_0x45de0d[_0x12e5('0xde')],'visibility':_0x45de0d[_0x12e5('0xdf')]?_0x12e5('0xe0'):'Private','messages':_(_0x45de0d[_0x12e5('0xce')])[_0x12e5('0x84')]({'secret':![]})['map'](function(_0x1b80a5){if(_0x1b80a5[_0x12e5('0xcd')]){var _0x35a3a0=path[_0x12e5('0xc7')](_0xda8603,_0x1b80a5[_0x12e5('0xcd')][_0x12e5('0xe1')]);if(fs[_0x12e5('0xe2')](_0x35a3a0)){fs[_0x12e5('0xe3')](_0x35a3a0)[_0x12e5('0xe4')](fs['createWriteStream'](path[_0x12e5('0xc7')](_0x5beb4c,_0x1b80a5[_0x12e5('0xcd')][_0x12e5('0xe1')])));}}return{'date':moment(_0x1b80a5['createdAt'])[_0x12e5('0xba')](_0x12e5('0xdb'))['toString'](),'sender':_0x1b80a5[_0x12e5('0xcf')]==='out'?_0x1b80a5[_0x12e5('0xc9')]?_0x1b80a5[_0x12e5('0xc9')][_0x12e5('0x2f')]:'System':_0x1b80a5['Contact']['firstName']+(_0x1b80a5[_0x12e5('0x63')][_0x12e5('0xcb')]?'\x20'+_0x1b80a5['Contact']['lastName']:''),'body':_0x1b80a5[_0x12e5('0xcd')]?_0x1b80a5[_0x12e5('0xcd')][_0x12e5('0xe1')]:_0x1b80a5[_0x12e5('0x71')],'direction':_0x1b80a5[_0x12e5('0xcf')]===_0x12e5('0xe5')?'A':'C','secret':_0x1b80a5[_0x12e5('0xd0')],'read':_0x1b80a5[_0x12e5('0x7f')],'attachment':_0x1b80a5['Attachment']};})[_0x12e5('0x65')]()};return ejs[_0x12e5('0xe6')](path['join'](config['root'],_0x12e5('0xc5'),_0x12e5('0xe7'),'downloadInteraction.html'),{'interaction':_0x575960})['then'](function(_0x44d120){return new BPromise(function(_0x172076,_0x5b3069){pdf[_0x12e5('0xb1')](_0x44d120,_0x3beaf3)[_0x12e5('0xe8')](path[_0x12e5('0xc7')](_0x5beb4c,_0x12e5('0xe9')+_0x45de0d['id']+'-'+_0x293262+'.pdf'),function(_0x285302,_0x2c651c){if(_0x285302)return _0x5b3069(_0x285302);_0x172076(_0x2c651c);});});})[_0x12e5('0x35')](function(){return new BPromise(function(_0x338813,_0x4cd970){zipdir(_0x5beb4c,{'saveTo':_0x39ea54},function(_0x3cda41,_0x28e009){if(_0x3cda41)return _0x4cd970(_0x3cda41);return _0x338813(_0x28e009);});})['then'](function(){return new BPromise(function(_0x277791,_0x2826c2){rimraf(_0x5beb4c,function(_0x236256){if(_0x236256)_0x2826c2(_0x236256);return _0x277791();});});})[_0x12e5('0x35')](function(){return _0x88a82c[_0x12e5('0xea')](_0x39ea54,_0x3eb6e5,function(_0x508918){if(_0x508918){console['log'](_0x12e5('0xeb'),_0x508918);}else{fs[_0x12e5('0xec')](_0x39ea54);}});});});}else{return _0x88a82c[_0x12e5('0x1e')](0xc8);}})[_0x12e5('0x36')](handleError(_0x88a82c,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 0389dac..df89273 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 _0x340f=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x77405e,_0x56e84e){var _0x1c49f1=function(_0x233c1e){while(--_0x233c1e){_0x77405e['push'](_0x77405e['shift']());}};_0x1c49f1(++_0x56e84e);}(_0x340f,0x156));var _0xf340=function(_0x4ee19a,_0x1c7ec0){_0x4ee19a=_0x4ee19a-0x0;var _0x322b2e=_0x340f[_0x4ee19a];return _0x322b2e;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xf340('0x0'))['db'][_0xf340('0x1')];var OpenchannelMessage=require(_0xf340('0x0'))['db'][_0xf340('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf340('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf340('0x4'),'afterDestroy':_0xf340('0x5')};function emitEvent(_0x239287){return function(_0x206e4a,_0x12bbac,_0x1ca405){_0x206e4a[_0xf340('0x6')]({'attributes':['id'],'raw':!![]})[_0xf340('0x7')](function(_0x12e633){_0x206e4a[_0xf340('0x8')](_0xf340('0x9'),_0x12e633['map'](function(_0x4cba1a){return{'id':_0x4cba1a['id']};}));return OpenchannelMessage[_0xf340('0xa')]({'where':{'OpenchannelInteractionId':_0x206e4a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf340('0x7')](function(_0xe24838){_0x206e4a[_0xf340('0x8')](_0xf340('0xb'),_0xe24838[_0xf340('0xc')]);OpenchannelInteractionEvents['emit'](_0x239287+':'+_0x206e4a['id'],_0x206e4a);OpenchannelInteractionEvents[_0xf340('0xd')](_0x239287,_0x206e4a);_0x1ca405(null);})[_0xf340('0xe')](_0x1ca405(null));};}for(var e in events){if(events[_0xf340('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xf340('0x10')](e,emitEvent(event));}}module[_0xf340('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x6063=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x3cc31a,_0x4bbb08){var _0xe50e0c=function(_0x319830){while(--_0x319830){_0x3cc31a['push'](_0x3cc31a['shift']());}};_0xe50e0c(++_0x4bbb08);}(_0x6063,0x1c5));var _0x3606=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x6063[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0x3606('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x3606('0x1')];var OpenchannelMessage=require(_0x3606('0x2'))['db'][_0x3606('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3606('0x4'),'afterUpdate':_0x3606('0x5'),'afterDestroy':_0x3606('0x6')};function emitEvent(_0x2eef90){return function(_0x2365a6,_0x292dbf,_0x2c882f){_0x2365a6[_0x3606('0x7')]({'attributes':['id'],'raw':!![]})[_0x3606('0x8')](function(_0x52fb25){_0x2365a6[_0x3606('0x9')](_0x3606('0xa'),_0x52fb25['map'](function(_0x554434){return{'id':_0x554434['id']};}));return OpenchannelMessage[_0x3606('0xb')]({'where':{'OpenchannelInteractionId':_0x2365a6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3606('0x8')](function(_0x4ede4d){_0x2365a6[_0x3606('0x9')](_0x3606('0xc'),_0x4ede4d['length']);OpenchannelInteractionEvents[_0x3606('0xd')](_0x2eef90+':'+_0x2365a6['id'],_0x2365a6);OpenchannelInteractionEvents[_0x3606('0xd')](_0x2eef90,_0x2365a6);_0x2c882f(null);})['catch'](_0x2c882f(null));};}for(var e in events){if(events[_0x3606('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x3606('0xf')](e,emitEvent(event));}}module[_0x3606('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9cabe1e..fc25a33 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 _0x3946=['OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x88c91a,_0x5066ee){var _0x1c86f2=function(_0x413fa1){while(--_0x413fa1){_0x88c91a['push'](_0x88c91a['shift']());}};_0x1c86f2(++_0x5066ee);}(_0x3946,0x114));var _0x6394=function(_0x454912,_0x59ea1f){_0x454912=_0x454912-0x0;var _0x1b11dc=_0x3946[_0x454912];return _0x1b11dc;};'use strict';var _=require('lodash');var util=require(_0x6394('0x0'));var logger=require(_0x6394('0x1'))('api');var moment=require(_0x6394('0x2'));var BPromise=require(_0x6394('0x3'));var rp=require(_0x6394('0x4'));var fs=require('fs');var path=require(_0x6394('0x5'));var rimraf=require(_0x6394('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0x6394('0x7')]=function(_0x1635af,_0x1ad0e4){return _0x1635af[_0x6394('0x8')](_0x6394('0x9'),attributes,{'tableName':_0x6394('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x332963,_0xc9a7a0,_0x439802){if(_0x332963[_0x6394('0xb')](_0x6394('0xc'))){_0x332963[_0x6394('0xd')]=moment()['format'](_0x6394('0xe'));}_0x439802(null,_0x332963);}}});}; \ No newline at end of file +var _0xfbff=['exports','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes'];(function(_0x1b2618,_0x1b1af3){var _0x37de91=function(_0xbbb3a5){while(--_0xbbb3a5){_0x1b2618['push'](_0x1b2618['shift']());}};_0x37de91(++_0x1b1af3);}(_0xfbff,0x1ef));var _0xffbf=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xfbff[_0x10004e];return _0x5af990;};'use strict';var _=require(_0xffbf('0x0'));var util=require(_0xffbf('0x1'));var logger=require('../../config/logger')(_0xffbf('0x2'));var moment=require(_0xffbf('0x3'));var BPromise=require(_0xffbf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffbf('0x5'));var rimraf=require(_0xffbf('0x6'));var config=require(_0xffbf('0x7'));var attributes=require(_0xffbf('0x8'));module[_0xffbf('0x9')]=function(_0x45ff49,_0x1136e2){return _0x45ff49['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51aafb,_0xebd4f2,_0x417df0){if(_0x51aafb[_0xffbf('0xa')](_0xffbf('0xb'))){_0x51aafb[_0xffbf('0xc')]=moment()['format'](_0xffbf('0xd'));}_0x417df0(null,_0x51aafb);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3039038..50dc087 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 _0xcf7d=['UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','limit','AddTagsToOpenchannelInteraction','find','addTags','body','ids','spread','AddTags','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x5b4160,_0x739196){var _0x295148=function(_0x10c69b){while(--_0x10c69b){_0x5b4160['push'](_0x5b4160['shift']());}};_0x295148(++_0x739196);}(_0xcf7d,0x1bb));var _0xdcf7=function(_0x21bad5,_0x454a1c){_0x21bad5=_0x21bad5-0x0;var _0x559b56=_0xcf7d[_0x21bad5];return _0x559b56;};'use strict';var _=require('lodash');var util=require(_0xdcf7('0x0'));var moment=require('moment');var BPromise=require(_0xdcf7('0x1'));var rs=require(_0xdcf7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcf7('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdcf7('0x4'));var config=require(_0xdcf7('0x5'));var jayson=require(_0xdcf7('0x6'));var client=jayson[_0xdcf7('0x7')][_0xdcf7('0x8')]({'port':0x232a});config[_0xdcf7('0x9')]=_['defaults'](config[_0xdcf7('0x9')],{'host':_0xdcf7('0xa'),'port':0x18eb});var socket=require(_0xdcf7('0xb'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xdcf7('0xc')](socket);function respondWithRpcPromise(_0x468921,_0x12c176,_0x39238e){return new BPromise(function(_0x5da3e6,_0x153df7){return client[_0xdcf7('0xd')](_0x468921,_0x39238e)[_0xdcf7('0xe')](function(_0x14184d){logger[_0xdcf7('0xf')](_0xdcf7('0x10'),_0x12c176,'request\x20sent');logger[_0xdcf7('0x11')](_0xdcf7('0x12'),_0x12c176,_0xdcf7('0x13'),JSON[_0xdcf7('0x14')](_0x14184d));if(_0x14184d[_0xdcf7('0x15')]){if(_0x14184d['error']['code']===0x1f4){logger[_0xdcf7('0x15')](_0xdcf7('0x10'),_0x12c176,_0x14184d[_0xdcf7('0x15')][_0xdcf7('0x16')]);return _0x153df7(_0x14184d[_0xdcf7('0x15')][_0xdcf7('0x16')]);}logger[_0xdcf7('0x15')](_0xdcf7('0x10'),_0x12c176,_0x14184d[_0xdcf7('0x15')][_0xdcf7('0x16')]);return _0x5da3e6(_0x14184d[_0xdcf7('0x15')][_0xdcf7('0x16')]);}else{logger[_0xdcf7('0xf')](_0xdcf7('0x10'),_0x12c176,_0xdcf7('0x13'));_0x5da3e6(_0x14184d[_0xdcf7('0x17')][_0xdcf7('0x16')]);}})[_0xdcf7('0x18')](function(_0x18f4eb){logger[_0xdcf7('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x12c176,_0x18f4eb);_0x153df7(_0x18f4eb);});});}exports[_0xdcf7('0x19')]=function(_0x32204d){var _0x53b111=this;return new Promise(function(_0x4990e7,_0x337d6c){return db[_0xdcf7('0x1a')][_0xdcf7('0x1b')](_0x32204d['body'],{'raw':_0x32204d[_0xdcf7('0x1c')]?_0x32204d[_0xdcf7('0x1c')][_0xdcf7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32204d[_0xdcf7('0x1c')]?_0x32204d[_0xdcf7('0x1c')][_0xdcf7('0x1e')]||null:null,'attributes':_0x32204d[_0xdcf7('0x1c')]?_0x32204d[_0xdcf7('0x1c')]['attributes']||null:null,'limit':_0x32204d[_0xdcf7('0x1c')]?_0x32204d[_0xdcf7('0x1c')][_0xdcf7('0x1f')]||null:null})[_0xdcf7('0xe')](function(_0x507985){logger[_0xdcf7('0xf')]('UpdateOpenchannelInteraction',_0x32204d);logger[_0xdcf7('0x11')](_0xdcf7('0x19'),_0x32204d,JSON[_0xdcf7('0x14')](_0x507985));_0x4990e7(_0x507985);})[_0xdcf7('0x18')](function(_0x5b8363){logger[_0xdcf7('0x15')]('UpdateOpenchannelInteraction',_0x5b8363[_0xdcf7('0x16')],_0x32204d);_0x337d6c(_0x53b111['error'](0x1f4,_0x5b8363['message']));});});};exports[_0xdcf7('0x20')]=function(_0x213a9f){return new Promise(function(_0x34b97,_0x3b202b){return db['OpenchannelInteraction'][_0xdcf7('0x21')]({'where':_0x213a9f[_0xdcf7('0x1c')]?_0x213a9f[_0xdcf7('0x1c')][_0xdcf7('0x1e')]||null:null})[_0xdcf7('0xe')](function(_0x25d211){if(_0x25d211){return _0x25d211[_0xdcf7('0x22')](_0x213a9f[_0xdcf7('0x23')][_0xdcf7('0x24')],_['omit'](_0x213a9f[_0xdcf7('0x23')],['ids','id'])||{});}})[_0xdcf7('0x25')](function(_0x27c22d){logger['info'](_0xdcf7('0x26'),_0x213a9f);logger['debug']('AddTags',_0x213a9f,JSON[_0xdcf7('0x14')](_0x27c22d));_0x34b97(_0x27c22d);})[_0xdcf7('0x18')](function(_0xb5412d){logger[_0xdcf7('0x15')](_0xdcf7('0x26'),_0xb5412d[_0xdcf7('0x16')],_0x213a9f);_0x3b202b(_this[_0xdcf7('0x15')](0x1f4,_0xb5412d['message']));});});}; \ No newline at end of file +var _0x308b=['result','UpdateOpenchannelInteraction','body','options','where','attributes','stringify','OpenchannelInteraction','addTags','omit','AddTags','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x2ddea4,_0x3b4d83){var _0xb3eb2=function(_0x11ab0a){while(--_0x11ab0a){_0x2ddea4['push'](_0x2ddea4['shift']());}};_0xb3eb2(++_0x3b4d83);}(_0x308b,0x1d4));var _0xb308=function(_0x3326e5,_0x35dfd4){_0x3326e5=_0x3326e5-0x0;var _0x4ad0b7=_0x308b[_0x3326e5];return _0x4ad0b7;};'use strict';var _=require(_0xb308('0x0'));var util=require(_0xb308('0x1'));var moment=require(_0xb308('0x2'));var BPromise=require(_0xb308('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb308('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb308('0x5'));var logger=require(_0xb308('0x6'))(_0xb308('0x7'));var config=require(_0xb308('0x8'));var jayson=require(_0xb308('0x9'));var client=jayson[_0xb308('0xa')][_0xb308('0xb')]({'port':0x232a});config[_0xb308('0xc')]=_[_0xb308('0xd')](config[_0xb308('0xc')],{'host':_0xb308('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb308('0xc')]));require(_0xb308('0xf'))[_0xb308('0x10')](socket);function respondWithRpcPromise(_0x404e75,_0x4e55e6,_0x2886d6){return new BPromise(function(_0x2b27d9,_0x40db7a){return client[_0xb308('0x11')](_0x404e75,_0x2886d6)[_0xb308('0x12')](function(_0x22d6e9){logger[_0xb308('0x13')](_0xb308('0x14'),_0x4e55e6,_0xb308('0x15'));logger[_0xb308('0x16')](_0xb308('0x17'),_0x4e55e6,_0xb308('0x15'),JSON['stringify'](_0x22d6e9));if(_0x22d6e9[_0xb308('0x18')]){if(_0x22d6e9[_0xb308('0x18')]['code']===0x1f4){logger[_0xb308('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4e55e6,_0x22d6e9[_0xb308('0x18')][_0xb308('0x19')]);return _0x40db7a(_0x22d6e9[_0xb308('0x18')]['message']);}logger[_0xb308('0x18')](_0xb308('0x14'),_0x4e55e6,_0x22d6e9[_0xb308('0x18')][_0xb308('0x19')]);return _0x2b27d9(_0x22d6e9[_0xb308('0x18')]['message']);}else{logger[_0xb308('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4e55e6,_0xb308('0x15'));_0x2b27d9(_0x22d6e9[_0xb308('0x1a')]['message']);}})['catch'](function(_0x278e86){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4e55e6,_0x278e86);_0x40db7a(_0x278e86);});});}exports[_0xb308('0x1b')]=function(_0x830cb7){var _0x477277=this;return new Promise(function(_0x59e362,_0x1ac39e){return db['OpenchannelInteraction']['update'](_0x830cb7[_0xb308('0x1c')],{'raw':_0x830cb7[_0xb308('0x1d')]?_0x830cb7[_0xb308('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x830cb7['options']?_0x830cb7['options'][_0xb308('0x1e')]||null:null,'attributes':_0x830cb7['options']?_0x830cb7['options'][_0xb308('0x1f')]||null:null,'limit':_0x830cb7[_0xb308('0x1d')]?_0x830cb7[_0xb308('0x1d')]['limit']||null:null})['then'](function(_0x267ae8){logger[_0xb308('0x13')](_0xb308('0x1b'),_0x830cb7);logger[_0xb308('0x16')](_0xb308('0x1b'),_0x830cb7,JSON[_0xb308('0x20')](_0x267ae8));_0x59e362(_0x267ae8);})['catch'](function(_0x210cbc){logger[_0xb308('0x18')]('UpdateOpenchannelInteraction',_0x210cbc[_0xb308('0x19')],_0x830cb7);_0x1ac39e(_0x477277[_0xb308('0x18')](0x1f4,_0x210cbc['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1be074){return new Promise(function(_0x3b32dc,_0x5926f2){return db[_0xb308('0x21')]['find']({'where':_0x1be074['options']?_0x1be074[_0xb308('0x1d')][_0xb308('0x1e')]||null:null})[_0xb308('0x12')](function(_0x4f9410){if(_0x4f9410){return _0x4f9410[_0xb308('0x22')](_0x1be074['body']['ids'],_[_0xb308('0x23')](_0x1be074['body'],['ids','id'])||{});}})['spread'](function(_0x514013){logger[_0xb308('0x13')](_0xb308('0x24'),_0x1be074);logger[_0xb308('0x16')](_0xb308('0x24'),_0x1be074,JSON[_0xb308('0x20')](_0x514013));_0x3b32dc(_0x514013);})[_0xb308('0x25')](function(_0x1bf20a){logger[_0xb308('0x18')]('AddTags',_0x1bf20a[_0xb308('0x19')],_0x1be074);_0x5926f2(_this['error'](0x1f4,_0x1bf20a[_0xb308('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index c5917bf..0183a4a 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 _0xbacf=['save','remove','update','emit','register','length','./openchannelInteraction.events'];(function(_0x148acb,_0x2694f7){var _0x3b9378=function(_0x5bb255){while(--_0x5bb255){_0x148acb['push'](_0x148acb['shift']());}};_0x3b9378(++_0x2694f7);}(_0xbacf,0x1b8));var _0xfbac=function(_0x1e8b1e,_0x407bbd){_0x1e8b1e=_0x1e8b1e-0x0;var _0x4a0fde=_0xbacf[_0x1e8b1e];return _0x4a0fde;};'use strict';var OpenchannelInteractionEvents=require(_0xfbac('0x0'));var events=[_0xfbac('0x1'),_0xfbac('0x2'),_0xfbac('0x3')];function createListener(_0x5ec3af,_0x453c65){return function(_0x14741f){_0x453c65[_0xfbac('0x4')](_0x5ec3af,_0x14741f);};}function removeListener(_0x42c69e,_0x4a0812){return function(){OpenchannelInteractionEvents['removeListener'](_0x42c69e,_0x4a0812);};}exports[_0xfbac('0x5')]=function(_0x576cfe){for(var _0x40d8ae=0x0,_0x3f4068=events[_0xfbac('0x6')];_0x40d8ae<_0x3f4068;_0x40d8ae++){var _0x4197a7=events[_0x40d8ae];var _0x352696=createListener('openchannelInteraction:'+_0x4197a7,_0x576cfe);OpenchannelInteractionEvents['on'](_0x4197a7,_0x352696);}}; \ No newline at end of file +var _0x1468=['remove','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x1468,0x7e));var _0x8146=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x1468[_0x5cbf0e];return _0x1c76f8;};'use strict';var OpenchannelInteractionEvents=require(_0x8146('0x0'));var events=[_0x8146('0x1'),_0x8146('0x2'),'update'];function createListener(_0x357e9f,_0x2f2947){return function(_0x9a37e9){_0x2f2947[_0x8146('0x3')](_0x357e9f,_0x9a37e9);};}function removeListener(_0xfd302f,_0x5434e7){return function(){OpenchannelInteractionEvents[_0x8146('0x4')](_0xfd302f,_0x5434e7);};}exports[_0x8146('0x5')]=function(_0x46840e){for(var _0xd118e6=0x0,_0x18f460=events[_0x8146('0x6')];_0xd118e6<_0x18f460;_0xd118e6++){var _0x25513e=events[_0xd118e6];var _0x39a9f=createListener(_0x8146('0x7')+_0x25513e,_0x46840e);OpenchannelInteractionEvents['on'](_0x25513e,_0x39a9f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ffc8095..0e82c0d 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 _0x2239=['reject','delete','destroy','exports','util','connect-timeout','express','Router','get','isAuthenticated','/describe','/:id','show','post','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject'];(function(_0x3b70ed,_0x22dd15){var _0x5744db=function(_0xa90613){while(--_0xa90613){_0x3b70ed['push'](_0x3b70ed['shift']());}};_0x5744db(++_0x22dd15);}(_0x2239,0x1d2));var _0x9223=function(_0x3a18b5,_0x365cea){_0x3a18b5=_0x3a18b5-0x0;var _0x4cb74b=_0x2239[_0x3a18b5];return _0x4cb74b;};'use strict';var multer=require('multer');var util=require(_0x9223('0x0'));var path=require('path');var timeout=require(_0x9223('0x1'));var express=require(_0x9223('0x2'));var router=express[_0x9223('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelMessage.controller');router[_0x9223('0x4')]('/',auth[_0x9223('0x5')](),controller['index']);router[_0x9223('0x4')](_0x9223('0x6'),auth[_0x9223('0x5')](),controller['describe']);router[_0x9223('0x4')](_0x9223('0x7'),auth[_0x9223('0x5')](),controller[_0x9223('0x8')]);router[_0x9223('0x9')]('/',auth[_0x9223('0x5')](),interaction['tracked'](_0x9223('0xa'),_0x9223('0xb')),controller[_0x9223('0xc')]);router['put'](_0x9223('0x7'),auth[_0x9223('0x5')](),controller[_0x9223('0xd')]);router[_0x9223('0xe')](_0x9223('0xf'),auth['isAuthenticated'](),controller[_0x9223('0x10')]);router[_0x9223('0xe')](_0x9223('0x11'),auth['isAuthenticated'](),controller[_0x9223('0x12')]);router[_0x9223('0x13')](_0x9223('0x7'),auth[_0x9223('0x5')](),controller[_0x9223('0x14')]);module[_0x9223('0x15')]=router; \ No newline at end of file +var _0x0aa1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','/:id','show','post','tracked','openchannel','create','put','update','/:id/accept','accept','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x448fb9,_0x3f319f){var _0x2a079a=function(_0x33cd9d){while(--_0x33cd9d){_0x448fb9['push'](_0x448fb9['shift']());}};_0x2a079a(++_0x3f319f);}(_0x0aa1,0x17b));var _0x10aa=function(_0x127529,_0x170aac){_0x127529=_0x127529-0x0;var _0x2fe27a=_0x0aa1[_0x127529];return _0x2fe27a;};'use strict';var multer=require(_0x10aa('0x0'));var util=require('util');var path=require(_0x10aa('0x1'));var timeout=require(_0x10aa('0x2'));var express=require(_0x10aa('0x3'));var router=express[_0x10aa('0x4')]();var auth=require(_0x10aa('0x5'));var interaction=require(_0x10aa('0x6'));var config=require(_0x10aa('0x7'));var controller=require(_0x10aa('0x8'));router[_0x10aa('0x9')]('/',auth[_0x10aa('0xa')](),controller['index']);router[_0x10aa('0x9')](_0x10aa('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x10aa('0xc'),auth[_0x10aa('0xa')](),controller[_0x10aa('0xd')]);router[_0x10aa('0xe')]('/',auth[_0x10aa('0xa')](),interaction[_0x10aa('0xf')](_0x10aa('0x10'),'openchannelmessage:create'),controller[_0x10aa('0x11')]);router[_0x10aa('0x12')](_0x10aa('0xc'),auth['isAuthenticated'](),controller[_0x10aa('0x13')]);router[_0x10aa('0x12')](_0x10aa('0x14'),auth[_0x10aa('0xa')](),controller[_0x10aa('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x10aa('0x16')](_0x10aa('0xc'),auth[_0x10aa('0xa')](),controller[_0x10aa('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 e2b5626..e423edc 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 _0x3398=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x38e76d,_0x1c5cbc){var _0x455156=function(_0x1fdb55){while(--_0x1fdb55){_0x38e76d['push'](_0x38e76d['shift']());}};_0x455156(++_0x1c5cbc);}(_0x3398,0x1d2));var _0x8339=function(_0x48000b,_0x14bcac){_0x48000b=_0x48000b-0x0;var _0x43d09b=_0x3398[_0x48000b];return _0x43d09b;};'use strict';var Sequelize=require(_0x8339('0x0'));module[_0x8339('0x1')]={'body':{'type':Sequelize[_0x8339('0x2')](_0x8339('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8339('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8339('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8339('0x5')]('in',_0x8339('0x6')),'defaultValue':_0x8339('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x3cf4=['ENUM','out','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x43730b,_0x2097c1){var _0x4cf115=function(_0x4012de){while(--_0x4012de){_0x43730b['push'](_0x43730b['shift']());}};_0x4cf115(++_0x2097c1);}(_0x3cf4,0xc0));var _0x43cf=function(_0x4f076b,_0x50fa9e){_0x4f076b=_0x4f076b-0x0;var _0x151fc3=_0x3cf4[_0x4f076b];return _0x151fc3;};'use strict';var Sequelize=require(_0x43cf('0x0'));module[_0x43cf('0x1')]={'body':{'type':Sequelize[_0x43cf('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x43cf('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x43cf('0x4')]('in',_0x43cf('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x43cf('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 393aae1..604a80a 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 _0x907a=['save','update','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','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','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','info','end','status','json','count','offset','limit','Content-Range','apply','reject'];(function(_0x30c48d,_0x25e828){var _0x2c64aa=function(_0x244ae6){while(--_0x244ae6){_0x30c48d['push'](_0x30c48d['shift']());}};_0x2c64aa(++_0x25e828);}(_0x907a,0x142));var _0xa907=function(_0x19eddf,_0x3b50cf){_0x19eddf=_0x19eddf-0x0;var _0x1c10f6=_0x907a[_0x19eddf];return _0x1c10f6;};'use strict';var pdf=require(_0xa907('0x0'));var emlformat=require(_0xa907('0x1'));var rimraf=require(_0xa907('0x2'));var zipdir=require(_0xa907('0x3'));var jsonpatch=require(_0xa907('0x4'));var rp=require('request-promise');var moment=require(_0xa907('0x5'));var BPromise=require(_0xa907('0x6'));var Mustache=require(_0xa907('0x7'));var util=require(_0xa907('0x8'));var path=require(_0xa907('0x9'));var sox=require('sox');var csv=require(_0xa907('0xa'));var ejs=require(_0xa907('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa907('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa907('0xd'));var Papa=require(_0xa907('0xe'));var Redis=require('ioredis');var authService=require(_0xa907('0xf'));var qs=require(_0xa907('0x10'));var as=require(_0xa907('0x11'));var hardwareService=require(_0xa907('0x12'));var logger=require(_0xa907('0x13'))(_0xa907('0x14'));var utils=require(_0xa907('0x15'));var config=require(_0xa907('0x16'));var db=require(_0xa907('0x17'))['db'];config['redis']=_[_0xa907('0x18')](config[_0xa907('0x19')],{'host':_0xa907('0x1a'),'port':0x18eb});var socket=require(_0xa907('0x1b'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xa907('0x1c')](socket);var jayson=require(_0xa907('0x1d'));var client=jayson[_0xa907('0x1e')][_0xa907('0x1f')]({'port':0x232c});var client9002=jayson[_0xa907('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x1b8be7,_0xbec05d,_0x124850){if(_0x124850){var _0x1c22ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c22ad[_0xa907('0x20')](_0xbec05d)){return _0x1b8be7;}else{throw new db[(_0xa907('0x21'))][(_0xa907('0x22'))](_0xa907('0x23'));}}else{return _0x1b8be7;}}function respondWithRpcPromise(_0x26c4e7,_0x567ab7,_0x49e764,_0x152360){return new BPromise(function(_0x13f220,_0x420252){var _0x2127db=_0x152360||client;return _0x2127db[_0xa907('0x24')](_0x26c4e7,_0x49e764)[_0xa907('0x25')](function(_0x10d81a){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x567ab7,'request\x20sent');logger[_0xa907('0x26')](_0xa907('0x27'),_0x567ab7,_0xa907('0x28'),JSON[_0xa907('0x29')](_0x10d81a));if(_0x10d81a[_0xa907('0x2a')]){if(_0x10d81a[_0xa907('0x2a')][_0xa907('0x2b')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x567ab7,_0x10d81a[_0xa907('0x2a')][_0xa907('0x2c')]);return _0x420252(_0x10d81a['error'][_0xa907('0x2c')]);}logger['error'](_0xa907('0x2d'),_0x567ab7,_0x10d81a['error'][_0xa907('0x2c')]);return _0x13f220(_0x10d81a['error'][_0xa907('0x2c')]);}else{logger[_0xa907('0x2e')](_0xa907('0x2d'),_0x567ab7,'request\x20sent');_0x13f220(_0x10d81a['result']['message']);}})['catch'](function(_0x571d4b){logger[_0xa907('0x2a')](_0xa907('0x2d'),_0x567ab7,_0x571d4b);_0x420252(_0x571d4b);});});}function respondWithStatusCode(_0x231ac8,_0xcecc93){_0xcecc93=_0xcecc93||0xcc;return function(_0x3250bd){if(_0x3250bd){return _0x231ac8['sendStatus'](_0xcecc93);}return _0x231ac8['status'](_0xcecc93)[_0xa907('0x2f')]();};}function respondWithResult(_0x2e284c,_0x2f6519){_0x2f6519=_0x2f6519||0xc8;return function(_0x251df){if(_0x251df){return _0x2e284c[_0xa907('0x30')](_0x2f6519)[_0xa907('0x31')](_0x251df);}};}function respondWithFilteredResult(_0x4831fc,_0x47b3fe){return function(_0x3502a8){if(_0x3502a8){var _0x33283f=_0x3502a8[_0xa907('0x32')],_0x216174=_0x47b3fe[_0xa907('0x33')],_0x1b4f6c=_0x47b3fe[_0xa907('0x33')]+_0x47b3fe[_0xa907('0x34')],_0x1a0edc;if(_0x1b4f6c>=_0x33283f){_0x1b4f6c=_0x33283f;_0x1a0edc=0xc8;}else{_0x1a0edc=0xce;}_0x4831fc[_0xa907('0x30')](_0x1a0edc);return _0x4831fc['set'](_0xa907('0x35'),_0x216174+'-'+_0x1b4f6c+'/'+_0x33283f)[_0xa907('0x31')](_0x3502a8);}return null;};}function patchUpdates(_0x501f9a){return function(_0x1e794f){try{jsonpatch[_0xa907('0x36')](_0x1e794f,_0x501f9a,!![]);}catch(_0x914fc5){return BPromise[_0xa907('0x37')](_0x914fc5);}return _0x1e794f[_0xa907('0x38')]();};}function saveUpdates(_0x241b0b,_0xec6a37){return function(_0x399a57){if(_0x399a57){return _0x399a57[_0xa907('0x39')](_0x241b0b)[_0xa907('0x25')](function(_0x474c90){return _0x474c90;});}return null;};}function removeEntity(_0x322c83,_0x3d464c){return function(_0x34a670){if(_0x34a670){return _0x34a670[_0xa907('0x3a')]()['then'](function(){_0x322c83[_0xa907('0x30')](0xcc)[_0xa907('0x2f')]();});}};}function handleEntityNotFound(_0xb09d9e,_0x5289c6){return function(_0x4bfa62){if(!_0x4bfa62){_0xb09d9e[_0xa907('0x3b')](0x194);}return _0x4bfa62;};}function handleError(_0x50c5e2,_0x287ebb){_0x287ebb=_0x287ebb||0x1f4;return function(_0x288b43){logger[_0xa907('0x2a')](_0x288b43[_0xa907('0x3c')]);if(_0x288b43[_0xa907('0x3d')]){delete _0x288b43[_0xa907('0x3d')];}_0x50c5e2[_0xa907('0x30')](_0x287ebb)[_0xa907('0x3e')](_0x288b43);};}exports[_0xa907('0x3f')]=function(_0x343abd,_0x365052){var _0x435ace={},_0x52745c={},_0x386083={'count':0x0,'rows':[]};var _0x323ea9=_[_0xa907('0x40')](db[_0xa907('0x41')][_0xa907('0x42')],function(_0x1a8ac0){return{'name':_0x1a8ac0[_0xa907('0x43')],'type':_0x1a8ac0['type']['key']};});_0x52745c[_0xa907('0x44')]=_[_0xa907('0x40')](_0x323ea9,_0xa907('0x3d'));_0x52745c['query']=_['keys'](_0x343abd[_0xa907('0x45')]);_0x52745c[_0xa907('0x46')]=_[_0xa907('0x47')](_0x52745c[_0xa907('0x44')],_0x52745c['query']);_0x435ace[_0xa907('0x48')]=_['intersection'](_0x52745c[_0xa907('0x44')],qs[_0xa907('0x49')](_0x343abd[_0xa907('0x45')][_0xa907('0x49')]));_0x435ace['attributes']=_0x435ace['attributes'][_0xa907('0x4a')]?_0x435ace[_0xa907('0x48')]:_0x52745c[_0xa907('0x44')];if(!_0x343abd[_0xa907('0x45')][_0xa907('0x4b')](_0xa907('0x4c'))){_0x435ace[_0xa907('0x34')]=qs[_0xa907('0x34')](_0x343abd[_0xa907('0x45')][_0xa907('0x34')]);_0x435ace[_0xa907('0x33')]=qs[_0xa907('0x33')](_0x343abd[_0xa907('0x45')][_0xa907('0x33')]);}_0x435ace[_0xa907('0x4d')]=qs[_0xa907('0x4e')](_0x343abd['query'][_0xa907('0x4e')]);_0x435ace[_0xa907('0x4f')]=qs[_0xa907('0x46')](_[_0xa907('0x50')](_0x343abd[_0xa907('0x45')],_0x52745c[_0xa907('0x46')]),_0x323ea9);if(_0x343abd[_0xa907('0x45')][_0xa907('0x51')]){_0x435ace[_0xa907('0x4f')]=_[_0xa907('0x52')](_0x435ace['where'],{'$or':_[_0xa907('0x40')](_0x323ea9,function(_0x56222a){if(_0x56222a[_0xa907('0x53')]!==_0xa907('0x54')){var _0x411b56={};_0x411b56[_0x56222a[_0xa907('0x3d')]]={'$like':'%'+_0x343abd[_0xa907('0x45')][_0xa907('0x51')]+'%'};return _0x411b56;}})});}_0x435ace=_[_0xa907('0x52')]({},_0x435ace,_0x343abd[_0xa907('0x55')]);var _0x4cb9c0={'where':_0x435ace[_0xa907('0x4f')]};return db[_0xa907('0x41')][_0xa907('0x32')](_0x4cb9c0)[_0xa907('0x25')](function(_0x371dea){_0x386083[_0xa907('0x32')]=_0x371dea;if(_0x343abd[_0xa907('0x45')][_0xa907('0x56')]){_0x435ace[_0xa907('0x57')]=[{'all':!![]}];}return db[_0xa907('0x41')][_0xa907('0x58')](_0x435ace);})[_0xa907('0x25')](function(_0x32ed85){_0x386083['rows']=_0x32ed85;return _0x386083;})[_0xa907('0x25')](respondWithFilteredResult(_0x365052,_0x435ace))['catch'](handleError(_0x365052,null));};exports[_0xa907('0x59')]=function(_0x4e2d15,_0x23c617){var _0x4c7a80={'raw':!![],'where':{'id':_0x4e2d15[_0xa907('0x5a')]['id']}},_0x130b2e={};_0x130b2e['model']=_[_0xa907('0x5b')](db[_0xa907('0x41')][_0xa907('0x42')]);_0x130b2e[_0xa907('0x45')]=_[_0xa907('0x5b')](_0x4e2d15[_0xa907('0x45')]);_0x130b2e[_0xa907('0x46')]=_['intersection'](_0x130b2e[_0xa907('0x44')],_0x130b2e[_0xa907('0x45')]);_0x4c7a80[_0xa907('0x48')]=_[_0xa907('0x47')](_0x130b2e[_0xa907('0x44')],qs[_0xa907('0x49')](_0x4e2d15['query'][_0xa907('0x49')]));_0x4c7a80[_0xa907('0x48')]=_0x4c7a80[_0xa907('0x48')][_0xa907('0x4a')]?_0x4c7a80[_0xa907('0x48')]:_0x130b2e['model'];if(_0x4e2d15['query']['includeAll']){_0x4c7a80['include']=[{'all':!![]}];}_0x4c7a80=_[_0xa907('0x52')]({},_0x4c7a80,_0x4e2d15[_0xa907('0x55')]);return db['OpenchannelMessage'][_0xa907('0x5c')](_0x4c7a80)['then'](handleEntityNotFound(_0x23c617,null))['then'](respondWithResult(_0x23c617,null))[_0xa907('0x5d')](handleError(_0x23c617,null));};exports[_0xa907('0x5e')]=function(_0xddc52b,_0x38bea9){return db[_0xa907('0x41')][_0xa907('0x5e')](_0xddc52b[_0xa907('0x5f')],{})[_0xa907('0x25')](respondWithResult(_0x38bea9,0xc9))[_0xa907('0x5d')](handleError(_0x38bea9,null));};exports[_0xa907('0x39')]=function(_0x446a68,_0xbebdf5){if(_0x446a68[_0xa907('0x5f')]['id']){delete _0x446a68['body']['id'];}return db[_0xa907('0x41')][_0xa907('0x5c')]({'where':{'id':_0x446a68[_0xa907('0x5a')]['id']}})[_0xa907('0x25')](handleEntityNotFound(_0xbebdf5,null))[_0xa907('0x25')](saveUpdates(_0x446a68[_0xa907('0x5f')],null))[_0xa907('0x25')](respondWithResult(_0xbebdf5,null))[_0xa907('0x5d')](handleError(_0xbebdf5,null));};exports[_0xa907('0x3a')]=function(_0x3c560c,_0x1ed8f1){return db['OpenchannelMessage'][_0xa907('0x5c')]({'where':{'id':_0x3c560c[_0xa907('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1ed8f1,null))[_0xa907('0x25')](removeEntity(_0x1ed8f1,null))['catch'](handleError(_0x1ed8f1,null));};exports[_0xa907('0x60')]=function(_0x3a8a2f,_0x4de9b5){return db[_0xa907('0x41')][_0xa907('0x60')]()[_0xa907('0x25')](respondWithResult(_0x4de9b5,null))[_0xa907('0x5d')](handleError(_0x4de9b5,null));};var interaction_log=require(_0xa907('0x13'))(_0xa907('0x61'));exports['accept']=function(_0x16d4e6,_0x5996ed,_0x5bd076){var _0x194dc1={'channel':_0xa907('0x62')};if(_0x16d4e6[_0xa907('0x5f')]['id']){delete _0x16d4e6[_0xa907('0x5f')]['id'];}_0x16d4e6['body'][_0xa907('0x63')]=!![];_0x16d4e6[_0xa907('0x5f')][_0xa907('0x64')]=moment()[_0xa907('0x65')](_0xa907('0x66'));_0x16d4e6[_0xa907('0x5f')][_0xa907('0x67')]=_0x16d4e6[_0xa907('0x5f')][_0xa907('0x67')]||_0x16d4e6['user']['id'];return db[_0xa907('0x41')][_0xa907('0x5c')]({'where':{'id':_0x16d4e6[_0xa907('0x5a')]['id'],'UserId':null},'include':[{'model':db[_0xa907('0x68')],'as':_0xa907('0x69')}]})[_0xa907('0x25')](handleEntityNotFound(_0x5996ed,null))[_0xa907('0x25')](saveUpdates(_0x16d4e6[_0xa907('0x5f')],null))[_0xa907('0x25')](function(_0x550471){if(_0x550471){_0x194dc1[_0xa907('0x2c')]=_0x550471[_0xa907('0x6a')]({'plain':!![]});return db[_0xa907('0x6b')][_0xa907('0x5c')]({'where':{'id':_0x550471[_0xa907('0x6c')]}});}return null;})[_0xa907('0x25')](handleEntityNotFound(_0x5996ed,null))[_0xa907('0x25')](function(_0x1eb65b){if(_0x1eb65b){return _0x1eb65b[_0xa907('0x39')]({'UserId':_0x16d4e6[_0xa907('0x5f')]['UserId'],'read1stAt':_[_0xa907('0x6d')](_0x1eb65b['read1stAt'])?moment()[_0xa907('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2f6126){if(_0x2f6126){_0x194dc1[_0xa907('0x6e')]=_0x2f6126[_0xa907('0x6a')]({'plain':!![]});interaction_log[_0xa907('0x2e')](_0xa907('0x6f'),_0x16d4e6[_0xa907('0x70')]['id'],_0x16d4e6[_0xa907('0x70')][_0xa907('0x3d')],_0x16d4e6['user'][_0xa907('0x71')],_0x194dc1[_0xa907('0x6e')]['id'],_0x16d4e6['body']?JSON[_0xa907('0x29')](_0x16d4e6['body']):'null');return respondWithRpcPromise(_0xa907('0x72'),_0xa907('0x73'),_0x194dc1);}return null;})[_0xa907('0x25')](function(_0x2734e8){if(_0x2734e8){if(_0x16d4e6[_0xa907('0x5f')][_0xa907('0x74')]){_0x194dc1[_0xa907('0x2c')][_0xa907('0x75')]=util[_0xa907('0x65')](_0xa907('0x76'),_0x16d4e6[_0xa907('0x70')][_0xa907('0x3d')]);_0x194dc1[_0xa907('0x2c')]['channel']=_0x194dc1[_0xa907('0x77')];_0x194dc1[_0xa907('0x2c')][_0xa907('0x78')]='accept';return respondWithRpcPromise(_0xa907('0x79'),_0xa907('0x79'),{'event':'acceptmessage','message':_0x194dc1['message']},client9002)[_0xa907('0x25')](function(){return _0x194dc1;});}return _0x194dc1;}return null;})['then'](respondWithResult(_0x5996ed,null))[_0xa907('0x5d')](handleError(_0x5996ed,null));};var interaction_log=require(_0xa907('0x13'))('openchannel-interactions');exports['reject']=function(_0x476a5c,_0x1516b6,_0x15b4c7){var _0x5b9271={'agent':{},'channel':_0xa907('0x62')};if(_0x476a5c[_0xa907('0x5f')]['id']){delete _0x476a5c[_0xa907('0x5f')]['id'];}_0x476a5c[_0xa907('0x5f')][_0xa907('0x67')]=_0x476a5c[_0xa907('0x5f')][_0xa907('0x67')]||_0x476a5c[_0xa907('0x70')]['id'];_0x5b9271[_0xa907('0x7a')]['id']=_0x476a5c[_0xa907('0x5f')][_0xa907('0x67')];return db[_0xa907('0x41')][_0xa907('0x5c')]({'where':{'id':_0x476a5c['params']['id'],'UserId':null}})[_0xa907('0x25')](handleEntityNotFound(_0x1516b6,null))[_0xa907('0x25')](function(_0x4f2f67){if(_0x4f2f67){_0x5b9271[_0xa907('0x2c')]=_0x4f2f67['get']({'plain':!![]});return db[_0xa907('0x6b')][_0xa907('0x5c')]({'where':{'id':_0x4f2f67['OpenchannelInteractionId']}});}return null;})[_0xa907('0x25')](handleEntityNotFound(_0x1516b6,null))[_0xa907('0x25')](function(_0x473108){if(_0x473108){_0x5b9271[_0xa907('0x6e')]=_0x473108[_0xa907('0x6a')]({'plain':!![]});interaction_log[_0xa907('0x2e')](_0xa907('0x7b'),_0x476a5c[_0xa907('0x70')]['id'],_0x476a5c['user'][_0xa907('0x3d')],_0x476a5c[_0xa907('0x70')][_0xa907('0x71')],_0x5b9271[_0xa907('0x6e')]['id'],_0x476a5c[_0xa907('0x5f')]?JSON[_0xa907('0x29')](_0x476a5c[_0xa907('0x5f')]):'null');return respondWithRpcPromise('RejectMessage',_0xa907('0x7c'),_0x5b9271);}return null;})['then'](function(_0x5f55e0){if(_0x5f55e0){_0x5f55e0[_0xa907('0x2c')]['interface']=util[_0xa907('0x65')]('SIP/%s',_0x476a5c[_0xa907('0x70')][_0xa907('0x3d')]);_0x5f55e0[_0xa907('0x2c')][_0xa907('0x77')]=_0x5b9271[_0xa907('0x77')];_0x5f55e0[_0xa907('0x2c')][_0xa907('0x78')]=_0xa907('0x37');respondWithRpcPromise(_0xa907('0x79'),'EventManager',{'event':_0xa907('0x7d'),'message':_0x5f55e0['message']},client9002);return _0x5b9271;}return null;})['then'](respondWithResult(_0x1516b6,null))['catch'](handleError(_0x1516b6,null));}; \ No newline at end of file +var _0x941a=['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','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','key','model','keys','query','filters','attributes','intersection','fields','length','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','OpenchannelMessage','count','includeAll','include','findAll','catch','show','params','find','create','body','describe','openchannel-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','OpenchannelInteractionId','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./openchannelMessage.socket','jayson/promise','client','http','test'];(function(_0x462e0a,_0x5cc82f){var _0x361149=function(_0x6b7325){while(--_0x6b7325){_0x462e0a['push'](_0x462e0a['shift']());}};_0x361149(++_0x5cc82f);}(_0x941a,0xcb));var _0xa941=function(_0x115afe,_0x18664b){_0x115afe=_0x115afe-0x0;var _0x4a6cf6=_0x941a[_0x115afe];return _0x4a6cf6;};'use strict';var pdf=require(_0xa941('0x0'));var emlformat=require(_0xa941('0x1'));var rimraf=require(_0xa941('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa941('0x3'));var rp=require('request-promise');var moment=require(_0xa941('0x4'));var BPromise=require(_0xa941('0x5'));var Mustache=require(_0xa941('0x6'));var util=require(_0xa941('0x7'));var path=require(_0xa941('0x8'));var sox=require(_0xa941('0x9'));var csv=require(_0xa941('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa941('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa941('0xc'));var toCsv=require(_0xa941('0xa'));var querystring=require(_0xa941('0xd'));var Papa=require(_0xa941('0xe'));var Redis=require(_0xa941('0xf'));var authService=require(_0xa941('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa941('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa941('0x12'))('api');var utils=require(_0xa941('0x13'));var config=require(_0xa941('0x14'));var db=require(_0xa941('0x15'))['db'];config[_0xa941('0x16')]=_[_0xa941('0x17')](config[_0xa941('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa941('0x16')]));require(_0xa941('0x18'))['register'](socket);var jayson=require(_0xa941('0x19'));var client=jayson[_0xa941('0x1a')][_0xa941('0x1b')]({'port':0x232c});var client9002=jayson[_0xa941('0x1a')][_0xa941('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3698e7,_0xa68918,_0x2b3c85){if(_0x2b3c85){var _0x440bf7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x440bf7[_0xa941('0x1c')](_0xa68918)){return _0x3698e7;}else{throw new db[(_0xa941('0x1d'))]['ValidationError'](_0xa941('0x1e'));}}else{return _0x3698e7;}}function respondWithRpcPromise(_0x1077af,_0x2935dc,_0x1e5902,_0x4a434d){return new BPromise(function(_0x3ff697,_0x1fd7db){var _0x85e941=_0x4a434d||client;return _0x85e941['request'](_0x1077af,_0x1e5902)[_0xa941('0x1f')](function(_0x13a626){logger['info'](_0xa941('0x20'),_0x2935dc,_0xa941('0x21'));logger[_0xa941('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2935dc,_0xa941('0x21'),JSON[_0xa941('0x23')](_0x13a626));if(_0x13a626[_0xa941('0x24')]){if(_0x13a626[_0xa941('0x24')][_0xa941('0x25')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2935dc,_0x13a626[_0xa941('0x24')][_0xa941('0x26')]);return _0x1fd7db(_0x13a626[_0xa941('0x24')][_0xa941('0x26')]);}logger[_0xa941('0x24')](_0xa941('0x20'),_0x2935dc,_0x13a626[_0xa941('0x24')]['message']);return _0x3ff697(_0x13a626['error']['message']);}else{logger[_0xa941('0x27')](_0xa941('0x20'),_0x2935dc,_0xa941('0x21'));_0x3ff697(_0x13a626[_0xa941('0x28')][_0xa941('0x26')]);}})['catch'](function(_0x41c11d){logger[_0xa941('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x2935dc,_0x41c11d);_0x1fd7db(_0x41c11d);});});}function respondWithStatusCode(_0x20a53b,_0x9c3305){_0x9c3305=_0x9c3305||0xcc;return function(_0x335dff){if(_0x335dff){return _0x20a53b[_0xa941('0x29')](_0x9c3305);}return _0x20a53b['status'](_0x9c3305)[_0xa941('0x2a')]();};}function respondWithResult(_0x159fe8,_0x1833a8){_0x1833a8=_0x1833a8||0xc8;return function(_0x2915ea){if(_0x2915ea){return _0x159fe8[_0xa941('0x2b')](_0x1833a8)[_0xa941('0x2c')](_0x2915ea);}};}function respondWithFilteredResult(_0x2bb95d,_0x1f1529){return function(_0x3f5071){if(_0x3f5071){var _0x508365=_0x3f5071['count'],_0xb49c=_0x1f1529[_0xa941('0x2d')],_0x381413=_0x1f1529[_0xa941('0x2d')]+_0x1f1529['limit'],_0x3c533b;if(_0x381413>=_0x508365){_0x381413=_0x508365;_0x3c533b=0xc8;}else{_0x3c533b=0xce;}_0x2bb95d[_0xa941('0x2b')](_0x3c533b);return _0x2bb95d[_0xa941('0x2e')](_0xa941('0x2f'),_0xb49c+'-'+_0x381413+'/'+_0x508365)[_0xa941('0x2c')](_0x3f5071);}return null;};}function patchUpdates(_0x29230e){return function(_0x31ad2f){try{jsonpatch[_0xa941('0x30')](_0x31ad2f,_0x29230e,!![]);}catch(_0x2f337f){return BPromise[_0xa941('0x31')](_0x2f337f);}return _0x31ad2f[_0xa941('0x32')]();};}function saveUpdates(_0x304c42,_0x492afe){return function(_0x11b50a){if(_0x11b50a){return _0x11b50a[_0xa941('0x33')](_0x304c42)[_0xa941('0x1f')](function(_0x41fc70){return _0x41fc70;});}return null;};}function removeEntity(_0x25cb52,_0x7eb409){return function(_0xb1fdf3){if(_0xb1fdf3){return _0xb1fdf3[_0xa941('0x34')]()[_0xa941('0x1f')](function(){_0x25cb52[_0xa941('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x125eb8,_0x4922d1){return function(_0x4ef379){if(!_0x4ef379){_0x125eb8[_0xa941('0x29')](0x194);}return _0x4ef379;};}function handleError(_0x191a77,_0x4c245a){_0x4c245a=_0x4c245a||0x1f4;return function(_0x26ed70){logger[_0xa941('0x24')](_0x26ed70[_0xa941('0x35')]);if(_0x26ed70[_0xa941('0x36')]){delete _0x26ed70[_0xa941('0x36')];}_0x191a77[_0xa941('0x2b')](_0x4c245a)[_0xa941('0x37')](_0x26ed70);};}exports[_0xa941('0x38')]=function(_0x4467b3,_0x23b1b4){var _0x492270={},_0x574482={},_0x37e4b6={'count':0x0,'rows':[]};var _0x5e14aa=_[_0xa941('0x39')](db['OpenchannelMessage']['rawAttributes'],function(_0x3fcffb){return{'name':_0x3fcffb['fieldName'],'type':_0x3fcffb['type'][_0xa941('0x3a')]};});_0x574482[_0xa941('0x3b')]=_[_0xa941('0x39')](_0x5e14aa,_0xa941('0x36'));_0x574482['query']=_[_0xa941('0x3c')](_0x4467b3[_0xa941('0x3d')]);_0x574482[_0xa941('0x3e')]=_['intersection'](_0x574482['model'],_0x574482[_0xa941('0x3d')]);_0x492270[_0xa941('0x3f')]=_[_0xa941('0x40')](_0x574482[_0xa941('0x3b')],qs[_0xa941('0x41')](_0x4467b3[_0xa941('0x3d')][_0xa941('0x41')]));_0x492270[_0xa941('0x3f')]=_0x492270[_0xa941('0x3f')][_0xa941('0x42')]?_0x492270['attributes']:_0x574482[_0xa941('0x3b')];if(!_0x4467b3[_0xa941('0x3d')]['hasOwnProperty']('nolimit')){_0x492270['limit']=qs[_0xa941('0x43')](_0x4467b3['query']['limit']);_0x492270[_0xa941('0x2d')]=qs['offset'](_0x4467b3[_0xa941('0x3d')][_0xa941('0x2d')]);}_0x492270[_0xa941('0x44')]=qs[_0xa941('0x45')](_0x4467b3['query']['sort']);_0x492270['where']=qs[_0xa941('0x3e')](_[_0xa941('0x46')](_0x4467b3['query'],_0x574482[_0xa941('0x3e')]),_0x5e14aa);if(_0x4467b3[_0xa941('0x3d')][_0xa941('0x47')]){_0x492270[_0xa941('0x48')]=_[_0xa941('0x49')](_0x492270[_0xa941('0x48')],{'$or':_[_0xa941('0x39')](_0x5e14aa,function(_0x116d4d){if(_0x116d4d[_0xa941('0x4a')]!==_0xa941('0x4b')){var _0x2c2a91={};_0x2c2a91[_0x116d4d[_0xa941('0x36')]]={'$like':'%'+_0x4467b3[_0xa941('0x3d')][_0xa941('0x47')]+'%'};return _0x2c2a91;}})});}_0x492270=_[_0xa941('0x49')]({},_0x492270,_0x4467b3[_0xa941('0x4c')]);var _0x57bccb={'where':_0x492270['where']};return db[_0xa941('0x4d')][_0xa941('0x4e')](_0x57bccb)[_0xa941('0x1f')](function(_0x33123f){_0x37e4b6[_0xa941('0x4e')]=_0x33123f;if(_0x4467b3[_0xa941('0x3d')][_0xa941('0x4f')]){_0x492270[_0xa941('0x50')]=[{'all':!![]}];}return db[_0xa941('0x4d')][_0xa941('0x51')](_0x492270);})['then'](function(_0x32370b){_0x37e4b6['rows']=_0x32370b;return _0x37e4b6;})[_0xa941('0x1f')](respondWithFilteredResult(_0x23b1b4,_0x492270))[_0xa941('0x52')](handleError(_0x23b1b4,null));};exports[_0xa941('0x53')]=function(_0x3ac249,_0x1c3596){var _0x1cc6cd={'raw':!![],'where':{'id':_0x3ac249[_0xa941('0x54')]['id']}},_0x3b3597={};_0x3b3597[_0xa941('0x3b')]=_[_0xa941('0x3c')](db['OpenchannelMessage']['rawAttributes']);_0x3b3597[_0xa941('0x3d')]=_['keys'](_0x3ac249[_0xa941('0x3d')]);_0x3b3597[_0xa941('0x3e')]=_[_0xa941('0x40')](_0x3b3597['model'],_0x3b3597[_0xa941('0x3d')]);_0x1cc6cd[_0xa941('0x3f')]=_[_0xa941('0x40')](_0x3b3597[_0xa941('0x3b')],qs['fields'](_0x3ac249['query'][_0xa941('0x41')]));_0x1cc6cd[_0xa941('0x3f')]=_0x1cc6cd[_0xa941('0x3f')][_0xa941('0x42')]?_0x1cc6cd[_0xa941('0x3f')]:_0x3b3597[_0xa941('0x3b')];if(_0x3ac249[_0xa941('0x3d')][_0xa941('0x4f')]){_0x1cc6cd[_0xa941('0x50')]=[{'all':!![]}];}_0x1cc6cd=_[_0xa941('0x49')]({},_0x1cc6cd,_0x3ac249[_0xa941('0x4c')]);return db[_0xa941('0x4d')][_0xa941('0x55')](_0x1cc6cd)['then'](handleEntityNotFound(_0x1c3596,null))[_0xa941('0x1f')](respondWithResult(_0x1c3596,null))[_0xa941('0x52')](handleError(_0x1c3596,null));};exports[_0xa941('0x56')]=function(_0x434cfb,_0x28bd87){return db['OpenchannelMessage']['create'](_0x434cfb['body'],{})['then'](respondWithResult(_0x28bd87,0xc9))['catch'](handleError(_0x28bd87,null));};exports[_0xa941('0x33')]=function(_0x2b2019,_0x4aabca){if(_0x2b2019['body']['id']){delete _0x2b2019['body']['id'];}return db[_0xa941('0x4d')]['find']({'where':{'id':_0x2b2019[_0xa941('0x54')]['id']}})[_0xa941('0x1f')](handleEntityNotFound(_0x4aabca,null))['then'](saveUpdates(_0x2b2019[_0xa941('0x57')],null))[_0xa941('0x1f')](respondWithResult(_0x4aabca,null))['catch'](handleError(_0x4aabca,null));};exports['destroy']=function(_0x39cd2f,_0x26c3e0){return db[_0xa941('0x4d')][_0xa941('0x55')]({'where':{'id':_0x39cd2f[_0xa941('0x54')]['id']}})['then'](handleEntityNotFound(_0x26c3e0,null))[_0xa941('0x1f')](removeEntity(_0x26c3e0,null))[_0xa941('0x52')](handleError(_0x26c3e0,null));};exports[_0xa941('0x58')]=function(_0x3b67b7,_0x31657e){return db[_0xa941('0x4d')][_0xa941('0x58')]()[_0xa941('0x1f')](respondWithResult(_0x31657e,null))[_0xa941('0x52')](handleError(_0x31657e,null));};var interaction_log=require('../../config/logger')(_0xa941('0x59'));exports[_0xa941('0x5a')]=function(_0x2cba24,_0x4d663b,_0x49253f){var _0x159bc3={'channel':'openchannel'};if(_0x2cba24[_0xa941('0x57')]['id']){delete _0x2cba24[_0xa941('0x57')]['id'];}_0x2cba24['body'][_0xa941('0x5b')]=!![];_0x2cba24['body']['readAt']=moment()[_0xa941('0x5c')](_0xa941('0x5d'));_0x2cba24[_0xa941('0x57')][_0xa941('0x5e')]=_0x2cba24[_0xa941('0x57')]['UserId']||_0x2cba24[_0xa941('0x5f')]['id'];return db[_0xa941('0x4d')][_0xa941('0x55')]({'where':{'id':_0x2cba24['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xa941('0x60')}]})[_0xa941('0x1f')](handleEntityNotFound(_0x4d663b,null))[_0xa941('0x1f')](saveUpdates(_0x2cba24[_0xa941('0x57')],null))['then'](function(_0x93a5dd){if(_0x93a5dd){_0x159bc3['message']=_0x93a5dd['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xa941('0x55')]({'where':{'id':_0x93a5dd[_0xa941('0x61')]}});}return null;})[_0xa941('0x1f')](handleEntityNotFound(_0x4d663b,null))[_0xa941('0x1f')](function(_0x25b647){if(_0x25b647){return _0x25b647[_0xa941('0x33')]({'UserId':_0x2cba24[_0xa941('0x57')][_0xa941('0x5e')],'read1stAt':_['isNil'](_0x25b647['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0xa12869){if(_0xa12869){_0x159bc3[_0xa941('0x62')]=_0xa12869[_0xa941('0x63')]({'plain':!![]});interaction_log[_0xa941('0x27')](_0xa941('0x64'),_0x2cba24[_0xa941('0x5f')]['id'],_0x2cba24[_0xa941('0x5f')]['name'],_0x2cba24[_0xa941('0x5f')][_0xa941('0x65')],_0x159bc3['interaction']['id'],_0x2cba24[_0xa941('0x57')]?JSON['stringify'](_0x2cba24[_0xa941('0x57')]):_0xa941('0x66'));return respondWithRpcPromise(_0xa941('0x67'),_0xa941('0x68'),_0x159bc3);}return null;})['then'](function(_0x961703){if(_0x961703){if(_0x2cba24[_0xa941('0x57')][_0xa941('0x69')]){_0x159bc3[_0xa941('0x26')][_0xa941('0x6a')]=util[_0xa941('0x5c')](_0xa941('0x6b'),_0x2cba24['user'][_0xa941('0x36')]);_0x159bc3[_0xa941('0x26')][_0xa941('0x6c')]=_0x159bc3['channel'];_0x159bc3['message'][_0xa941('0x6d')]=_0xa941('0x5a');return respondWithRpcPromise(_0xa941('0x6e'),_0xa941('0x6e'),{'event':'acceptmessage','message':_0x159bc3[_0xa941('0x26')]},client9002)[_0xa941('0x1f')](function(){return _0x159bc3;});}return _0x159bc3;}return null;})[_0xa941('0x1f')](respondWithResult(_0x4d663b,null))['catch'](handleError(_0x4d663b,null));};var interaction_log=require(_0xa941('0x12'))('openchannel-interactions');exports['reject']=function(_0x4fefc4,_0x3e49d8,_0x2a2f93){var _0x38dc7e={'agent':{},'channel':'openchannel'};if(_0x4fefc4[_0xa941('0x57')]['id']){delete _0x4fefc4[_0xa941('0x57')]['id'];}_0x4fefc4[_0xa941('0x57')][_0xa941('0x5e')]=_0x4fefc4[_0xa941('0x57')]['UserId']||_0x4fefc4[_0xa941('0x5f')]['id'];_0x38dc7e[_0xa941('0x6f')]['id']=_0x4fefc4[_0xa941('0x57')][_0xa941('0x5e')];return db['OpenchannelMessage'][_0xa941('0x55')]({'where':{'id':_0x4fefc4[_0xa941('0x54')]['id'],'UserId':null}})[_0xa941('0x1f')](handleEntityNotFound(_0x3e49d8,null))[_0xa941('0x1f')](function(_0x590498){if(_0x590498){_0x38dc7e[_0xa941('0x26')]=_0x590498[_0xa941('0x63')]({'plain':!![]});return db[_0xa941('0x70')][_0xa941('0x55')]({'where':{'id':_0x590498[_0xa941('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x3e49d8,null))['then'](function(_0x486384){if(_0x486384){_0x38dc7e[_0xa941('0x62')]=_0x486384['get']({'plain':!![]});interaction_log[_0xa941('0x27')](_0xa941('0x71'),_0x4fefc4[_0xa941('0x5f')]['id'],_0x4fefc4[_0xa941('0x5f')]['name'],_0x4fefc4[_0xa941('0x5f')][_0xa941('0x65')],_0x38dc7e[_0xa941('0x62')]['id'],_0x4fefc4['body']?JSON[_0xa941('0x23')](_0x4fefc4[_0xa941('0x57')]):_0xa941('0x66'));return respondWithRpcPromise(_0xa941('0x72'),'rejectMessage',_0x38dc7e);}return null;})['then'](function(_0xa402f4){if(_0xa402f4){_0xa402f4[_0xa941('0x26')][_0xa941('0x6a')]=util[_0xa941('0x5c')](_0xa941('0x6b'),_0x4fefc4['user']['name']);_0xa402f4[_0xa941('0x26')][_0xa941('0x6c')]=_0x38dc7e[_0xa941('0x6c')];_0xa402f4[_0xa941('0x26')][_0xa941('0x6d')]=_0xa941('0x31');respondWithRpcPromise(_0xa941('0x6e'),'EventManager',{'event':_0xa941('0x73'),'message':_0xa402f4[_0xa941('0x26')]},client9002);return _0x38dc7e;}return null;})[_0xa941('0x1f')](respondWithResult(_0x3e49d8,null))[_0xa941('0x52')](handleError(_0x3e49d8,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index e78be25..a8f833f 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 _0x0cf6=['OpenchannelMessage','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x155458,_0x178ff2){var _0x2ce9f9=function(_0x149953){while(--_0x149953){_0x155458['push'](_0x155458['shift']());}};_0x2ce9f9(++_0x178ff2);}(_0x0cf6,0x77));var _0x60cf=function(_0x4afb4a,_0x25d8aa){_0x4afb4a=_0x4afb4a-0x0;var _0x3991b9=_0x0cf6[_0x4afb4a];return _0x3991b9;};'use strict';var EventEmitter=require(_0x60cf('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x60cf('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x60cf('0x2')](0x0);var events={'afterCreate':_0x60cf('0x3'),'afterUpdate':_0x60cf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x462503){return function(_0x1cf899,_0x4a5193,_0x107f81){OpenchannelMessageEvents['emit'](_0x462503+':'+_0x1cf899['id'],_0x1cf899);OpenchannelMessageEvents[_0x60cf('0x5')](_0x462503,_0x1cf899);_0x107f81(null);};}for(var e in events){if(events[_0x60cf('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x60cf('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x9ef8=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x9ef8,0x14f));var _0x89ef=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x9ef8[_0x3c2b2e];return _0x27a338;};'use strict';var EventEmitter=require(_0x89ef('0x0'));var OpenchannelMessage=require(_0x89ef('0x1'))['db'][_0x89ef('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x89ef('0x3'),'afterUpdate':_0x89ef('0x4'),'afterDestroy':_0x89ef('0x5')};function emitEvent(_0x57568e){return function(_0x121af1,_0x1160fe,_0x497c79){OpenchannelMessageEvents[_0x89ef('0x6')](_0x57568e+':'+_0x121af1['id'],_0x121af1);OpenchannelMessageEvents[_0x89ef('0x6')](_0x57568e,_0x121af1);_0x497c79(null);};}for(var e in events){if(events[_0x89ef('0x7')](e)){var event=events[e];OpenchannelMessage[_0x89ef('0x8')](e,emitEvent(event));}}module[_0x89ef('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 41bb2f0..48b25e4 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 _0xf006=['CmContact','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','POST','method','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','path','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','OpenchannelInteractionId'];(function(_0x203759,_0x3ea351){var _0x32866f=function(_0x1fe82a){while(--_0x1fe82a){_0x203759['push'](_0x203759['shift']());}};_0x32866f(++_0x3ea351);}(_0xf006,0x146));var _0x6f00=function(_0x584c47,_0x3f9cc8){_0x584c47=_0x584c47-0x0;var _0x25a81b=_0xf006[_0x584c47];return _0x25a81b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var moment=require('moment');var BPromise=require(_0x6f00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f00('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f00('0x4'));module[_0x6f00('0x5')]=function(_0x141e71,_0x52c9a2){return _0x141e71[_0x6f00('0x6')]('OpenchannelMessage',attributes,{'tableName':_0x6f00('0x7'),'paranoid':![],'indexes':[{'name':_0x6f00('0x8'),'fields':[_0x6f00('0x9')],'type':_0x6f00('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x286d32,_0x3001c6,_0x44b63c){var _0x1e0720=_0x141e71[_0x6f00('0xb')];var _0x3e6a41=_0x286d32[_0x6f00('0xc')]({'plain':!![]});if(_0x3e6a41[_0x6f00('0xd')][_0x6f00('0xe')]()==='in'||_0x3e6a41['direction'][_0x6f00('0xe')]()===_0x6f00('0xf')&&!_0x3e6a41[_0x6f00('0x10')]&&!_[_0x6f00('0x11')](_0x3e6a41[_0x6f00('0x12')])){_0x1e0720['OpenchannelInteraction'][_0x6f00('0x13')]({'where':{'id':_0x3e6a41['OpenchannelInteractionId']}})[_0x6f00('0x14')](function(_0x5047f5){if(_0x5047f5){_0x5047f5[_0x6f00('0x15')]({'lastMsgAt':_0x3e6a41[_0x6f00('0x16')],'lastMsgDirection':_0x3e6a41[_0x6f00('0xd')][_0x6f00('0xe')]()});}})[_0x6f00('0x17')](function(_0x411203){console[_0x6f00('0x18')](_0x411203);});}if(_0x3e6a41[_0x6f00('0xd')]===_0x6f00('0xf')&&!_0x3e6a41['secret']){var _0x14b15d;_0x1e0720['CmContact']['describe']()[_0x6f00('0x14')](function(_0x6cf83f){return _0x1e0720[_0x6f00('0x19')][_0x6f00('0x1a')]({'where':{'id':_0x3e6a41[_0x6f00('0x1b')]},'include':[{'model':_0x1e0720[_0x6f00('0x1c')],'as':_0x6f00('0x1d'),'where':{'id':_0x3e6a41[_0x6f00('0x1e')]},'limit':0x1,'include':[{'model':_0x1e0720[_0x6f00('0x1f')],'as':_0x6f00('0x20'),'attributes':_[_0x6f00('0x21')](_0x6cf83f)}]}]});})[_0x6f00('0x14')](function(_0x4e11de){_0x14b15d=_0x4e11de['get']({'plain':!![]});if(_0x14b15d&&_0x14b15d['replyUri']){logger[_0x6f00('0x22')](_0x6f00('0x23'),_0x6f00('0x24'),util['format'](_0x6f00('0x25'),_0x3e6a41['id'],_0x14b15d[_0x6f00('0x26')]));if(_0x14b15d[_0x6f00('0x1d')]&&_0x14b15d[_0x6f00('0x1d')][_0x6f00('0x27')]){_0x3e6a41[_0x6f00('0x28')]=_[_0x6f00('0x29')](_0x14b15d[_0x6f00('0x1d')][0x0],'Contact');_0x3e6a41[_0x6f00('0x20')]=_0x14b15d[_0x6f00('0x1d')][0x0][_0x6f00('0x20')];}var _0x3001c6={'method':_0x6f00('0x2a'),'uri':encodeURI(_0x14b15d['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3001c6[_0x6f00('0x2b')]){case'GET':_0x3001c6['qs']=_0x3e6a41;break;case _0x6f00('0x2a'):_0x3001c6[_0x6f00('0x9')]=_0x3e6a41;break;}return rp(_0x3001c6)[_0x6f00('0x14')](function(_0x1f84a6){logger[_0x6f00('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x6f00('0x24'),util[_0x6f00('0x2c')](_0x6f00('0x2d'),_0x3e6a41['id'],_0x14b15d[_0x6f00('0x26')]));if(_0x1f84a6[_0x6f00('0x9')][_0x6f00('0x2e')]&&_0x1f84a6[_0x6f00('0x9')][_0x6f00('0x2e')]!=_0x3e6a41[_0x6f00('0x28')][_0x6f00('0x2e')]){return _0x1e0720[_0x6f00('0x1c')][_0x6f00('0x15')]({'threadId':_0x1f84a6[_0x6f00('0x9')][_0x6f00('0x2e')]},{'logging':!![],'where':{'id':_0x3e6a41['Interaction']['id']}});}else{return;}})['then'](function(){return _0x286d32['update']({'read':!![]});})['catch'](function(_0x522d4f){logger['error'](_0x6f00('0x23'),'afterCreate',util[_0x6f00('0x2f')](_0x522d4f,{'showHidden':![],'depth':null}));_0x44b63c();});}else{_0x44b63c();}})[_0x6f00('0x30')](function(){_0x44b63c();});}else{_0x44b63c();}}},'charset':_0x6f00('0x31'),'collate':_0x6f00('0x32')});}; \ No newline at end of file +var _0x432b=['body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','update','createdAt','error','out','CmContact','describe','then','OpenchannelAccount','OpenchannelInteraction','Interactions','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','method','GET','POST','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages'];(function(_0x47c112,_0x3b3f62){var _0x2eb251=function(_0x4706bf){while(--_0x4706bf){_0x47c112['push'](_0x47c112['shift']());}};_0x2eb251(++_0x3b3f62);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb432('0x0'));var util=require('util');var logger=require(_0xb432('0x1'))(_0xb432('0x2'));var moment=require(_0xb432('0x3'));var BPromise=require(_0xb432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb432('0x5'));var config=require('../../config/environment');var attributes=require(_0xb432('0x6'));module['exports']=function(_0x143093,_0x3f1a78){return _0x143093[_0xb432('0x7')](_0xb432('0x8'),attributes,{'tableName':_0xb432('0x9'),'paranoid':![],'indexes':[{'name':_0xb432('0xa'),'fields':[_0xb432('0xb')],'type':_0xb432('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e4302,_0x12adbe,_0xca5a23){var _0x2bc6e5=_0x143093[_0xb432('0xd')];var _0x28fdde=_0x4e4302[_0xb432('0xe')]({'plain':!![]});if(_0x28fdde['direction']['toLowerCase']()==='in'||_0x28fdde[_0xb432('0xf')][_0xb432('0x10')]()==='out'&&!_0x28fdde[_0xb432('0x11')]&&!_[_0xb432('0x12')](_0x28fdde[_0xb432('0x13')])){_0x2bc6e5['OpenchannelInteraction'][_0xb432('0x14')]({'where':{'id':_0x28fdde[_0xb432('0x15')]}})['then'](function(_0x272c47){if(_0x272c47){_0x272c47[_0xb432('0x16')]({'lastMsgAt':_0x28fdde[_0xb432('0x17')],'lastMsgDirection':_0x28fdde[_0xb432('0xf')][_0xb432('0x10')]()});}})['catch'](function(_0x5e4aae){console[_0xb432('0x18')](_0x5e4aae);});}if(_0x28fdde[_0xb432('0xf')]===_0xb432('0x19')&&!_0x28fdde[_0xb432('0x11')]){var _0x27365c;_0x2bc6e5[_0xb432('0x1a')][_0xb432('0x1b')]()[_0xb432('0x1c')](function(_0x375775){return _0x2bc6e5[_0xb432('0x1d')]['find']({'where':{'id':_0x28fdde['OpenchannelAccountId']},'include':[{'model':_0x2bc6e5[_0xb432('0x1e')],'as':_0xb432('0x1f'),'where':{'id':_0x28fdde[_0xb432('0x15')]},'limit':0x1,'include':[{'model':_0x2bc6e5[_0xb432('0x1a')],'as':'Contact','attributes':_[_0xb432('0x20')](_0x375775)}]}]});})[_0xb432('0x1c')](function(_0x284b5a){_0x27365c=_0x284b5a[_0xb432('0xe')]({'plain':!![]});if(_0x27365c&&_0x27365c[_0xb432('0x21')]){logger[_0xb432('0x22')](_0xb432('0x23'),_0xb432('0x24'),util['format'](_0xb432('0x25'),_0x28fdde['id'],_0x27365c[_0xb432('0x21')]));if(_0x27365c['Interactions']&&_0x27365c[_0xb432('0x1f')][_0xb432('0x26')]){_0x28fdde[_0xb432('0x27')]=_[_0xb432('0x28')](_0x27365c[_0xb432('0x1f')][0x0],_0xb432('0x29'));_0x28fdde[_0xb432('0x29')]=_0x27365c[_0xb432('0x1f')][0x0][_0xb432('0x29')];}var _0x12adbe={'method':'POST','uri':encodeURI(_0x27365c[_0xb432('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x12adbe[_0xb432('0x2a')]){case _0xb432('0x2b'):_0x12adbe['qs']=_0x28fdde;break;case _0xb432('0x2c'):_0x12adbe[_0xb432('0xb')]=_0x28fdde;break;}return rp(_0x12adbe)[_0xb432('0x1c')](function(_0x5ce616){logger[_0xb432('0x22')](_0xb432('0x23'),_0xb432('0x24'),util[_0xb432('0x2d')](_0xb432('0x2e'),_0x28fdde['id'],_0x27365c[_0xb432('0x21')]));if(_0x5ce616[_0xb432('0xb')][_0xb432('0x2f')]&&_0x5ce616[_0xb432('0xb')]['threadId']!=_0x28fdde[_0xb432('0x27')][_0xb432('0x2f')]){return _0x2bc6e5[_0xb432('0x1e')][_0xb432('0x16')]({'threadId':_0x5ce616[_0xb432('0xb')][_0xb432('0x2f')]},{'logging':!![],'where':{'id':_0x28fdde[_0xb432('0x27')]['id']}});}else{return;}})[_0xb432('0x1c')](function(){return _0x4e4302[_0xb432('0x16')]({'read':!![]});})[_0xb432('0x30')](function(_0x405737){logger[_0xb432('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0xb432('0x24'),util['inspect'](_0x405737,{'showHidden':![],'depth':null}));_0xca5a23();});}else{_0xca5a23();}})[_0xb432('0x31')](function(){_0xca5a23();});}else{_0xca5a23();}}},'charset':_0xb432('0x32'),'collate':_0xb432('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index a744f8a..fef3f94 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 _0xfb11=['error','code','message','result','catch','OpenchannelMessage','create','options','CreateOpenchannelMessage','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4f60a8,_0x252bc6){var _0x4f011a=function(_0x2beefc){while(--_0x2beefc){_0x4f60a8['push'](_0x4f60a8['shift']());}};_0x4f011a(++_0x252bc6);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xfb11[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});config['redis']=_[_0x1fb1('0x9')](config[_0x1fb1('0xa')],{'host':_0x1fb1('0xb'),'port':0x18eb});var socket=require(_0x1fb1('0xc'))(new Redis(config[_0x1fb1('0xa')]));require(_0x1fb1('0xd'))[_0x1fb1('0xe')](socket);function respondWithRpcPromise(_0x416625,_0x377aae,_0x15d392){return new BPromise(function(_0x5bb066,_0x232036){return client['request'](_0x416625,_0x15d392)[_0x1fb1('0xf')](function(_0x58b66e){logger[_0x1fb1('0x10')](_0x1fb1('0x11'),_0x377aae,_0x1fb1('0x12'));logger[_0x1fb1('0x13')](_0x1fb1('0x14'),_0x377aae,_0x1fb1('0x12'),JSON['stringify'](_0x58b66e));if(_0x58b66e[_0x1fb1('0x15')]){if(_0x58b66e[_0x1fb1('0x15')][_0x1fb1('0x16')]===0x1f4){logger[_0x1fb1('0x15')](_0x1fb1('0x11'),_0x377aae,_0x58b66e[_0x1fb1('0x15')][_0x1fb1('0x17')]);return _0x232036(_0x58b66e[_0x1fb1('0x15')][_0x1fb1('0x17')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x377aae,_0x58b66e[_0x1fb1('0x15')][_0x1fb1('0x17')]);return _0x5bb066(_0x58b66e[_0x1fb1('0x15')]['message']);}else{logger[_0x1fb1('0x10')](_0x1fb1('0x11'),_0x377aae,_0x1fb1('0x12'));_0x5bb066(_0x58b66e[_0x1fb1('0x18')][_0x1fb1('0x17')]);}})[_0x1fb1('0x19')](function(_0x10df7b){logger[_0x1fb1('0x15')](_0x1fb1('0x11'),_0x377aae,_0x10df7b);_0x232036(_0x10df7b);});});}exports['CreateOpenchannelMessage']=function(_0xa6d7b8){var _0x55ba5b=this;return new Promise(function(_0x55e75e,_0xdf9c1b){return db[_0x1fb1('0x1a')][_0x1fb1('0x1b')](_0xa6d7b8['body'],{'raw':_0xa6d7b8[_0x1fb1('0x1c')]?_0xa6d7b8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x31178c){logger[_0x1fb1('0x10')](_0x1fb1('0x1d'),_0xa6d7b8);logger[_0x1fb1('0x13')](_0x1fb1('0x1d'),_0xa6d7b8,JSON['stringify'](_0x31178c));_0x55e75e(_0x31178c);})[_0x1fb1('0x19')](function(_0x204c7c){logger[_0x1fb1('0x15')](_0x1fb1('0x1d'),_0x204c7c[_0x1fb1('0x17')],_0xa6d7b8);_0xdf9c1b(_0x55ba5b[_0x1fb1('0x15')](0x1f4,_0x204c7c[_0x1fb1('0x17')]));});});}; \ No newline at end of file +var _0x1bb4=['create','body','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','localhost','./openchannelMessage.socket','register','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','OpenchannelMessage'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x3e7045,_0x3d28ad){_0x3e7045=_0x3e7045-0x0;var _0x2cd0cc=_0x1bb4[_0x3e7045];return _0x2cd0cc;};'use strict';var _=require(_0x41bb('0x0'));var util=require(_0x41bb('0x1'));var moment=require(_0x41bb('0x2'));var BPromise=require(_0x41bb('0x3'));var rs=require(_0x41bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x41bb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x41bb('0x6'))('rpc');var config=require(_0x41bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x41bb('0x8')][_0x41bb('0x9')]({'port':0x232a});config[_0x41bb('0xa')]=_['defaults'](config[_0x41bb('0xa')],{'host':_0x41bb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41bb('0xa')]));require(_0x41bb('0xc'))[_0x41bb('0xd')](socket);function respondWithRpcPromise(_0x570b82,_0xabb584,_0x25e298){return new BPromise(function(_0x27ce2d,_0x238449){return client[_0x41bb('0xe')](_0x570b82,_0x25e298)['then'](function(_0x78af1d){logger[_0x41bb('0xf')](_0x41bb('0x10'),_0xabb584,_0x41bb('0x11'));logger[_0x41bb('0x12')](_0x41bb('0x13'),_0xabb584,_0x41bb('0x11'),JSON[_0x41bb('0x14')](_0x78af1d));if(_0x78af1d['error']){if(_0x78af1d['error']['code']===0x1f4){logger[_0x41bb('0x15')](_0x41bb('0x10'),_0xabb584,_0x78af1d[_0x41bb('0x15')]['message']);return _0x238449(_0x78af1d['error'][_0x41bb('0x16')]);}logger[_0x41bb('0x15')](_0x41bb('0x10'),_0xabb584,_0x78af1d[_0x41bb('0x15')][_0x41bb('0x16')]);return _0x27ce2d(_0x78af1d['error'][_0x41bb('0x16')]);}else{logger['info'](_0x41bb('0x10'),_0xabb584,_0x41bb('0x11'));_0x27ce2d(_0x78af1d['result'][_0x41bb('0x16')]);}})[_0x41bb('0x17')](function(_0x57617b){logger['error'](_0x41bb('0x10'),_0xabb584,_0x57617b);_0x238449(_0x57617b);});});}exports['CreateOpenchannelMessage']=function(_0x38260a){var _0x4737db=this;return new Promise(function(_0x2d6b67,_0x2be518){return db[_0x41bb('0x18')][_0x41bb('0x19')](_0x38260a[_0x41bb('0x1a')],{'raw':_0x38260a[_0x41bb('0x1b')]?_0x38260a[_0x41bb('0x1b')][_0x41bb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x29b356){logger[_0x41bb('0xf')](_0x41bb('0x1d'),_0x38260a);logger[_0x41bb('0x12')]('CreateOpenchannelMessage',_0x38260a,JSON['stringify'](_0x29b356));_0x2d6b67(_0x29b356);})[_0x41bb('0x17')](function(_0x1d4909){logger[_0x41bb('0x15')]('CreateOpenchannelMessage',_0x1d4909[_0x41bb('0x16')],_0x38260a);_0x2be518(_0x4737db[_0x41bb('0x15')](0x1f4,_0x1d4909['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 0a1501f..833237f 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 _0xcb91=['remove','update','emit','removeListener','register'];(function(_0x48b1d4,_0x38a59e){var _0x341707=function(_0x286cb2){while(--_0x286cb2){_0x48b1d4['push'](_0x48b1d4['shift']());}};_0x341707(++_0x38a59e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0xcb91[_0x40be86];return _0xda3c3b;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1cb9('0x0'),_0x1cb9('0x1')];function createListener(_0x17d4ec,_0x22c4b8){return function(_0x4c37e8){_0x22c4b8[_0x1cb9('0x2')](_0x17d4ec,_0x4c37e8);};}function removeListener(_0x2c17b8,_0x545a34){return function(){OpenchannelMessageEvents[_0x1cb9('0x3')](_0x2c17b8,_0x545a34);};}exports[_0x1cb9('0x4')]=function(_0x53ffbd){for(var _0x226b69=0x0,_0x3f7deb=events['length'];_0x226b69<_0x3f7deb;_0x226b69++){var _0x38737d=events[_0x226b69];var _0x12567c=createListener('openchannelMessage:'+_0x38737d,_0x53ffbd);OpenchannelMessageEvents['on'](_0x38737d,_0x12567c);}}; \ No newline at end of file +var _0xbdb7=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0xbdb7[_0x671369];return _0x33f2b4;};'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 8351787..154e0e1 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 _0x2e65=['getTeams','/:id/users','create','addTeams','post','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams'];(function(_0x161f02,_0x16d857){var _0x263ac6=function(_0x283208){while(--_0x283208){_0x161f02['push'](_0x161f02['shift']());}};_0x263ac6(++_0x16d857);}(_0x2e65,0x193));var _0x52e6=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x2e65[_0xbeb808];return _0x5d6909;};'use strict';var multer=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var path=require(_0x52e6('0x2'));var timeout=require(_0x52e6('0x3'));var express=require(_0x52e6('0x4'));var router=express[_0x52e6('0x5')]();var auth=require(_0x52e6('0x6'));var interaction=require(_0x52e6('0x7'));var config=require('../../config/environment');var controller=require(_0x52e6('0x8'));router[_0x52e6('0x9')]('/',auth[_0x52e6('0xa')](),controller[_0x52e6('0xb')]);router[_0x52e6('0x9')](_0x52e6('0xc'),auth[_0x52e6('0xa')](),controller[_0x52e6('0xd')]);router[_0x52e6('0x9')](_0x52e6('0xe'),auth['isAuthenticated'](),controller[_0x52e6('0xf')]);router[_0x52e6('0x9')]('/:id/members',auth[_0x52e6('0xa')](),controller['getMembers']);router['get'](_0x52e6('0x10'),auth[_0x52e6('0xa')](),controller[_0x52e6('0x11')]);router[_0x52e6('0x9')](_0x52e6('0x12'),auth[_0x52e6('0xa')](),controller['getAgents']);router['post']('/',auth[_0x52e6('0xa')](),controller[_0x52e6('0x13')]);router['post'](_0x52e6('0x10'),auth[_0x52e6('0xa')](),controller[_0x52e6('0x14')]);router[_0x52e6('0x15')](_0x52e6('0x12'),auth[_0x52e6('0xa')](),controller[_0x52e6('0x16')]);router[_0x52e6('0x17')](_0x52e6('0xe'),auth[_0x52e6('0xa')](),controller[_0x52e6('0x18')]);router[_0x52e6('0x19')](_0x52e6('0xe'),auth[_0x52e6('0xa')](),controller['destroy']);router[_0x52e6('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x52e6('0x1a')]);router[_0x52e6('0x19')](_0x52e6('0x12'),auth['isAuthenticated'](),controller[_0x52e6('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xcd05=['update','destroy','delete','removeAgents','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addAgents'];(function(_0x20a196,_0x16409f){var _0x27953e=function(_0x1616fe){while(--_0x1616fe){_0x20a196['push'](_0x20a196['shift']());}};_0x27953e(++_0x16409f);}(_0xcd05,0x163));var _0x5cd0=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0xcd05[_0x4d6ac0];return _0x5296c4;};'use strict';var multer=require(_0x5cd0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5cd0('0x1'));var router=express[_0x5cd0('0x2')]();var auth=require(_0x5cd0('0x3'));var interaction=require(_0x5cd0('0x4'));var config=require('../../config/environment');var controller=require(_0x5cd0('0x5'));router[_0x5cd0('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5cd0('0x7'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x9')]);router[_0x5cd0('0x6')](_0x5cd0('0xa'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xb')]);router['get'](_0x5cd0('0xc'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xd')]);router[_0x5cd0('0x6')]('/:id/teams',auth[_0x5cd0('0x8')](),controller[_0x5cd0('0xe')]);router[_0x5cd0('0x6')](_0x5cd0('0xf'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x10')]);router[_0x5cd0('0x11')]('/',auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x12')]);router[_0x5cd0('0x11')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x5cd0('0x11')](_0x5cd0('0xf'),auth['isAuthenticated'](),controller[_0x5cd0('0x13')]);router['put'](_0x5cd0('0xa'),auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x14')]);router['delete']('/:id',auth[_0x5cd0('0x8')](),controller[_0x5cd0('0x15')]);router[_0x5cd0('0x16')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0x5cd0('0x16')](_0x5cd0('0xf'),auth['isAuthenticated'](),controller[_0x5cd0('0x17')]);module[_0x5cd0('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 98aac56..8d72537 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 _0x8af6=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x50f4f0,_0x663943){var _0xab0583=function(_0x5e2262){while(--_0x5e2262){_0x50f4f0['push'](_0x50f4f0['shift']());}};_0xab0583(++_0x663943);}(_0x8af6,0x76));var _0x68af=function(_0x558e3b,_0x39cca8){_0x558e3b=_0x558e3b-0x0;var _0x3d2a43=_0x8af6[_0x558e3b];return _0x3d2a43;};'use strict';var Sequelize=require(_0x68af('0x0'));module[_0x68af('0x1')]={'name':{'type':Sequelize[_0x68af('0x2')],'unique':_0x68af('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x68af('0x2')]},'timeout':{'type':Sequelize[_0x68af('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x68af('0x5')](_0x68af('0x6'),_0x68af('0x7'),_0x68af('0x8'))}}; \ No newline at end of file +var _0xef0f=['sequelize','STRING','name','ENUM','rrmemory','beepall'];(function(_0x4c0567,_0x52eca7){var _0x2c06db=function(_0x1c3e7d){while(--_0x1c3e7d){_0x4c0567['push'](_0x4c0567['shift']());}};_0x2c06db(++_0x52eca7);}(_0xef0f,0x168));var _0xfef0=function(_0x22af13,_0x30663){_0x22af13=_0x22af13-0x0;var _0x478f13=_0xef0f[_0x22af13];return _0x478f13;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'name':{'type':Sequelize[_0xfef0('0x1')],'unique':_0xfef0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfef0('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfef0('0x3')](_0xfef0('0x4'),_0xfef0('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 6c3d013..a18c51e 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 _0x5357=['include','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','OpenchannelQueues','UserProfileSection','userProfileId','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','limit','OpenchannelQueueId','findAll','UserId','agent','updatedAt','format','%s/%s','createdAt','getTeams','Team','addTeams','ids','User','Agents','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','includes','all','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','Content-Range','reject','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll'];(function(_0x187dc6,_0x510cc6){var _0x358fce=function(_0x1100d6){while(--_0x1100d6){_0x187dc6['push'](_0x187dc6['shift']());}};_0x358fce(++_0x510cc6);}(_0x5357,0xd4));var _0x7535=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x5357[_0x513aa5];return _0x1a1a7c;};'use strict';var pdf=require(_0x7535('0x0'));var emlformat=require(_0x7535('0x1'));var rimraf=require(_0x7535('0x2'));var zipdir=require(_0x7535('0x3'));var jsonpatch=require(_0x7535('0x4'));var rp=require(_0x7535('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7535('0x6'));var util=require(_0x7535('0x7'));var path=require('path');var sox=require(_0x7535('0x8'));var csv=require(_0x7535('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7535('0xa'));var squel=require(_0x7535('0xb'));var crypto=require(_0x7535('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7535('0xd'));var toCsv=require(_0x7535('0x9'));var querystring=require('querystring');var Papa=require(_0x7535('0xe'));var Redis=require(_0x7535('0xf'));var authService=require(_0x7535('0x10'));var qs=require(_0x7535('0x11'));var as=require(_0x7535('0x12'));var hardwareService=require(_0x7535('0x13'));var logger=require(_0x7535('0x14'))(_0x7535('0x15'));var utils=require(_0x7535('0x16'));var config=require(_0x7535('0x17'));var db=require(_0x7535('0x18'))['db'];config[_0x7535('0x19')]=_[_0x7535('0x1a')](config['redis'],{'host':_0x7535('0x1b'),'port':0x18eb});var socket=require(_0x7535('0x1c'))(new Redis(config[_0x7535('0x19')]));require('./openchannelQueue.socket')[_0x7535('0x1d')](socket);function respondWithStatusCode(_0xd779ea,_0x5569c0){_0x5569c0=_0x5569c0||0xcc;return function(_0x28ad08){if(_0x28ad08){return _0xd779ea[_0x7535('0x1e')](_0x5569c0);}return _0xd779ea[_0x7535('0x1f')](_0x5569c0)[_0x7535('0x20')]();};}function respondWithResult(_0x5cfd1c,_0x3a2699){_0x3a2699=_0x3a2699||0xc8;return function(_0x3c2fa9){if(_0x3c2fa9){return _0x5cfd1c[_0x7535('0x1f')](_0x3a2699)[_0x7535('0x21')](_0x3c2fa9);}};}function respondWithFilteredResult(_0x7c6d08,_0x9065da){return function(_0x48141e){if(_0x48141e){var _0x2d41b5=_0x48141e[_0x7535('0x22')],_0x15ac8f=_0x9065da[_0x7535('0x23')],_0x18a1e4=_0x9065da['offset']+_0x9065da['limit'],_0x4c023d;if(_0x18a1e4>=_0x2d41b5){_0x18a1e4=_0x2d41b5;_0x4c023d=0xc8;}else{_0x4c023d=0xce;}_0x7c6d08[_0x7535('0x1f')](_0x4c023d);return _0x7c6d08['set'](_0x7535('0x24'),_0x15ac8f+'-'+_0x18a1e4+'/'+_0x2d41b5)[_0x7535('0x21')](_0x48141e);}return null;};}function patchUpdates(_0x2a19fe){return function(_0x10d137){try{jsonpatch['apply'](_0x10d137,_0x2a19fe,!![]);}catch(_0x10c398){return BPromise[_0x7535('0x25')](_0x10c398);}return _0x10d137['save']();};}function saveUpdates(_0x2b1c90,_0x5ac38f){return function(_0x31ac9c){if(_0x31ac9c){return _0x31ac9c[_0x7535('0x26')](_0x2b1c90)[_0x7535('0x27')](function(_0x44fe4a){return _0x44fe4a;});}return null;};}function removeEntity(_0x4715c9,_0x500746){return function(_0x44c67c){if(_0x44c67c){return _0x44c67c[_0x7535('0x28')]()['then'](function(){var _0x41ec6f=_0x44c67c['get']({'plain':!![]});var _0x39a7ed='OpenchannelQueues';return db[_0x7535('0x29')][_0x7535('0x28')]({'where':{'type':_0x39a7ed,'resourceId':_0x41ec6f['id']}})['then'](function(){return _0x44c67c;});})[_0x7535('0x27')](function(){_0x4715c9['status'](0xcc)[_0x7535('0x20')]();});}};}function handleEntityNotFound(_0x34d0aa,_0x4042ec){return function(_0x568630){if(!_0x568630){_0x34d0aa[_0x7535('0x1e')](0x194);}return _0x568630;};}function handleError(_0x58078a,_0x767089){_0x767089=_0x767089||0x1f4;return function(_0x3fd546){logger[_0x7535('0x2a')](_0x3fd546[_0x7535('0x2b')]);if(_0x3fd546[_0x7535('0x2c')]){delete _0x3fd546[_0x7535('0x2c')];}_0x58078a[_0x7535('0x1f')](_0x767089)[_0x7535('0x2d')](_0x3fd546);};}exports[_0x7535('0x2e')]=function(_0x44d324,_0x349e94){var _0x1afa7b={},_0x2a9247={},_0x5b92c8={'count':0x0,'rows':[]};var _0x1dce66=_[_0x7535('0x2f')](db[_0x7535('0x30')][_0x7535('0x31')],function(_0x33c66f){return{'name':_0x33c66f[_0x7535('0x32')],'type':_0x33c66f[_0x7535('0x33')]['key']};});_0x2a9247[_0x7535('0x34')]=_['map'](_0x1dce66,'name');_0x2a9247[_0x7535('0x35')]=_[_0x7535('0x36')](_0x44d324['query']);_0x2a9247['filters']=_['intersection'](_0x2a9247[_0x7535('0x34')],_0x2a9247[_0x7535('0x35')]);_0x1afa7b[_0x7535('0x37')]=_[_0x7535('0x38')](_0x2a9247['model'],qs[_0x7535('0x39')](_0x44d324['query']['fields']));_0x1afa7b[_0x7535('0x37')]=_0x1afa7b[_0x7535('0x37')]['length']?_0x1afa7b[_0x7535('0x37')]:_0x2a9247[_0x7535('0x34')];if(!_0x44d324[_0x7535('0x35')][_0x7535('0x3a')]('nolimit')){_0x1afa7b['limit']=qs['limit'](_0x44d324['query']['limit']);_0x1afa7b['offset']=qs[_0x7535('0x23')](_0x44d324[_0x7535('0x35')]['offset']);}_0x1afa7b[_0x7535('0x3b')]=qs[_0x7535('0x3c')](_0x44d324[_0x7535('0x35')]['sort']);_0x1afa7b['where']=qs[_0x7535('0x3d')](_[_0x7535('0x3e')](_0x44d324['query'],_0x2a9247['filters']),_0x1dce66);if(_0x44d324['query'][_0x7535('0x3f')]){_0x1afa7b[_0x7535('0x40')]=_[_0x7535('0x41')](_0x1afa7b[_0x7535('0x40')],{'$or':_[_0x7535('0x2f')](_0x1dce66,function(_0x4eca71){if(_0x4eca71['type']!=='VIRTUAL'){var _0xd569ef={};_0xd569ef[_0x4eca71['name']]={'$like':'%'+_0x44d324['query']['filter']+'%'};return _0xd569ef;}})});}_0x1afa7b=_[_0x7535('0x41')]({},_0x1afa7b,_0x44d324[_0x7535('0x42')]);var _0x212e48={'where':_0x1afa7b['where']};return db[_0x7535('0x30')][_0x7535('0x22')](_0x212e48)[_0x7535('0x27')](function(_0x3fd0f6){_0x5b92c8['count']=_0x3fd0f6;if(_0x44d324[_0x7535('0x35')][_0x7535('0x43')]){_0x1afa7b[_0x7535('0x44')]=[{'all':!![]}];}return db[_0x7535('0x30')]['findAll'](_0x1afa7b);})[_0x7535('0x27')](function(_0x45d89b){_0x5b92c8[_0x7535('0x45')]=_0x45d89b;return _0x5b92c8;})[_0x7535('0x27')](respondWithFilteredResult(_0x349e94,_0x1afa7b))[_0x7535('0x46')](handleError(_0x349e94,null));};exports[_0x7535('0x47')]=function(_0x32b759,_0x238b93){var _0x3c4432={'raw':!![],'where':{'id':_0x32b759[_0x7535('0x48')]['id']}},_0x507521={};_0x507521['model']=_[_0x7535('0x36')](db[_0x7535('0x30')][_0x7535('0x31')]);_0x507521[_0x7535('0x35')]=_[_0x7535('0x36')](_0x32b759[_0x7535('0x35')]);_0x507521[_0x7535('0x3d')]=_[_0x7535('0x38')](_0x507521[_0x7535('0x34')],_0x507521[_0x7535('0x35')]);_0x3c4432[_0x7535('0x37')]=_[_0x7535('0x38')](_0x507521[_0x7535('0x34')],qs['fields'](_0x32b759[_0x7535('0x35')][_0x7535('0x39')]));_0x3c4432[_0x7535('0x37')]=_0x3c4432['attributes'][_0x7535('0x49')]?_0x3c4432['attributes']:_0x507521[_0x7535('0x34')];if(_0x32b759['query'][_0x7535('0x43')]){_0x3c4432[_0x7535('0x44')]=[{'all':!![]}];}_0x3c4432=_[_0x7535('0x41')]({},_0x3c4432,_0x32b759[_0x7535('0x42')]);return db[_0x7535('0x30')][_0x7535('0x4a')](_0x3c4432)['then'](handleEntityNotFound(_0x238b93,null))['then'](respondWithResult(_0x238b93,null))[_0x7535('0x46')](handleError(_0x238b93,null));};exports[_0x7535('0x4b')]=function(_0x104cf0,_0x2dcd1a){return db['OpenchannelQueue'][_0x7535('0x4b')](_0x104cf0[_0x7535('0x4c')],{})[_0x7535('0x27')](function(_0x42fd41){var _0x5652de=_0x104cf0[_0x7535('0x4d')]['get']({'plain':!![]});if(!_0x5652de)throw new Error(_0x7535('0x4e'));if(_0x5652de[_0x7535('0x4f')]===_0x7535('0x4d')){var _0x5ef563=_0x42fd41[_0x7535('0x50')]({'plain':!![]});var _0x2cfd5b=_0x7535('0x51');return db[_0x7535('0x52')][_0x7535('0x4a')]({'where':{'name':_0x2cfd5b,'userProfileId':_0x5652de[_0x7535('0x53')]},'raw':!![]})[_0x7535('0x27')](function(_0x124728){if(_0x124728&&_0x124728['autoAssociation']===0x0){return db[_0x7535('0x29')][_0x7535('0x4b')]({'name':_0x5ef563['name'],'resourceId':_0x5ef563['id'],'type':_0x124728[_0x7535('0x2c')],'sectionId':_0x124728['id']},{})[_0x7535('0x27')](function(){return _0x42fd41;});}else{return _0x42fd41;}})[_0x7535('0x46')](function(_0x30aac8){logger[_0x7535('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30aac8);throw _0x30aac8;});}return _0x42fd41;})[_0x7535('0x27')](respondWithResult(_0x2dcd1a,0xc9))[_0x7535('0x46')](handleError(_0x2dcd1a,null));};exports['update']=function(_0xcab48b,_0x26f36c){if(_0xcab48b[_0x7535('0x4c')]['id']){delete _0xcab48b[_0x7535('0x4c')]['id'];}return db[_0x7535('0x30')][_0x7535('0x4a')]({'where':{'id':_0xcab48b[_0x7535('0x48')]['id']}})[_0x7535('0x27')](handleEntityNotFound(_0x26f36c,null))['then'](saveUpdates(_0xcab48b[_0x7535('0x4c')],null))['then'](respondWithResult(_0x26f36c,null))[_0x7535('0x46')](handleError(_0x26f36c,null));};exports['destroy']=function(_0x3bb739,_0x1f37f7){return db[_0x7535('0x30')][_0x7535('0x4a')]({'where':{'id':_0x3bb739[_0x7535('0x48')]['id']}})[_0x7535('0x27')](handleEntityNotFound(_0x1f37f7,null))[_0x7535('0x27')](removeEntity(_0x1f37f7,null))['catch'](handleError(_0x1f37f7,null));};exports[_0x7535('0x54')]=function(_0x982681,_0x431e5f){return db[_0x7535('0x30')]['describe']()[_0x7535('0x27')](respondWithResult(_0x431e5f,null))['catch'](handleError(_0x431e5f,null));};exports[_0x7535('0x55')]=function(_0x51f3e5,_0xe7ddec,_0x555057){var _0x2f8c32={'raw':!![],'where':{}},_0x36e49a={},_0x5e53a0;return db['OpenchannelQueue'][_0x7535('0x56')]({'where':{'id':_0x51f3e5[_0x7535('0x48')]['id']}})[_0x7535('0x27')](handleEntityNotFound(_0xe7ddec,null))[_0x7535('0x27')](function(_0x23e11e){if(_0x23e11e){_0x5e53a0=_0x23e11e[_0x7535('0x50')]({'plain':!![]});_0x36e49a['model']=_[_0x7535('0x36')](db[_0x7535('0x57')]['rawAttributes']);_0x36e49a[_0x7535('0x35')]=_['keys'](_0x51f3e5[_0x7535('0x35')]);_0x36e49a[_0x7535('0x3d')]=_[_0x7535('0x38')](_0x36e49a[_0x7535('0x34')],_0x36e49a['query']);_0x2f8c32[_0x7535('0x37')]=_[_0x7535('0x38')](_0x36e49a[_0x7535('0x34')],qs['fields'](_0x51f3e5[_0x7535('0x35')]['fields']));_0x2f8c32[_0x7535('0x37')]=_0x2f8c32[_0x7535('0x37')][_0x7535('0x49')]?_0x2f8c32[_0x7535('0x37')]:_0x36e49a[_0x7535('0x34')];if(!_0x51f3e5['query'][_0x7535('0x3a')](_0x7535('0x58'))){_0x2f8c32[_0x7535('0x59')]=qs[_0x7535('0x59')](_0x51f3e5[_0x7535('0x35')][_0x7535('0x59')]);_0x2f8c32[_0x7535('0x23')]=qs['offset'](_0x51f3e5[_0x7535('0x35')][_0x7535('0x23')]);}_0x2f8c32[_0x7535('0x3b')]=qs['sort'](_0x51f3e5[_0x7535('0x35')][_0x7535('0x3c')]);_0x2f8c32[_0x7535('0x40')]=qs[_0x7535('0x3d')](_['pick'](_0x51f3e5[_0x7535('0x35')],_0x36e49a[_0x7535('0x3d')]));_0x2f8c32[_0x7535('0x40')][_0x7535('0x5a')]=_0x23e11e['id'];if(_0x51f3e5['query'][_0x7535('0x3f')]){_0x2f8c32[_0x7535('0x40')]=_[_0x7535('0x41')](_0x2f8c32['where'],{'$or':_[_0x7535('0x2f')](_0x2f8c32['attributes'],function(_0x1c28a5){var _0xeb94f7={};_0xeb94f7[_0x1c28a5]={'$like':'%'+_0x51f3e5['query']['filter']+'%'};return _0xeb94f7;})});}_0x2f8c32=_[_0x7535('0x41')]({},_0x2f8c32,_0x51f3e5[_0x7535('0x42')]);return db[_0x7535('0x57')][_0x7535('0x5b')](_0x2f8c32);}})[_0x7535('0x27')](function(_0x326e79){if(_0x326e79){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x326e79,_0x7535('0x5c')),'role':_0x7535('0x5d')},'attributes':['id','name','openchannelPause',_0x7535('0x5e'),'createdAt']});}})['then'](function(_0x257d63){if(_0x257d63){return{'count':_0x257d63[_0x7535('0x22')],'rows':_[_0x7535('0x2f')](_0x257d63[_0x7535('0x45')],function(_0x582933){return{'membername':_0x582933[_0x7535('0x2c')],'UserId':_0x582933['id'],'queue_name':_0x5e53a0[_0x7535('0x2c')],'OpenchannelQueueId':_0x5e53a0['id'],'interface':util[_0x7535('0x5f')](_0x7535('0x60'),'SIP',_0x582933['name']),'penalty':0x0,'paused':_0x582933['openchannelPause'],'createdAt':_0x582933[_0x7535('0x61')],'updatedAt':_0x582933[_0x7535('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7535('0x27')](respondWithFilteredResult(_0xe7ddec,_0x2f8c32))[_0x7535('0x46')](handleError(_0xe7ddec,null));};exports[_0x7535('0x62')]=function(_0x446cfa,_0x3e2309,_0x58eb77){var _0x308721={};var _0x3bd759={};var _0x15e5fb;var _0x3c0155;return db[_0x7535('0x30')][_0x7535('0x56')]({'where':{'id':_0x446cfa[_0x7535('0x48')]['id']}})[_0x7535('0x27')](handleEntityNotFound(_0x3e2309,null))[_0x7535('0x27')](function(_0xf6c210){if(_0xf6c210){_0x15e5fb=_0xf6c210;_0x3bd759[_0x7535('0x34')]=_[_0x7535('0x36')](db[_0x7535('0x63')][_0x7535('0x31')]);_0x3bd759[_0x7535('0x35')]=_[_0x7535('0x36')](_0x446cfa[_0x7535('0x35')]);_0x3bd759['filters']=_[_0x7535('0x38')](_0x3bd759[_0x7535('0x34')],_0x3bd759['query']);_0x308721['attributes']=_[_0x7535('0x38')](_0x3bd759[_0x7535('0x34')],qs[_0x7535('0x39')](_0x446cfa[_0x7535('0x35')][_0x7535('0x39')]));_0x308721[_0x7535('0x37')]=_0x308721[_0x7535('0x37')][_0x7535('0x49')]?_0x308721[_0x7535('0x37')]:_0x3bd759[_0x7535('0x34')];_0x308721[_0x7535('0x3b')]=qs[_0x7535('0x3c')](_0x446cfa[_0x7535('0x35')][_0x7535('0x3c')]);_0x308721[_0x7535('0x40')]=qs[_0x7535('0x3d')](_[_0x7535('0x3e')](_0x446cfa[_0x7535('0x35')],_0x3bd759['filters']));if(_0x446cfa[_0x7535('0x35')][_0x7535('0x3f')]){_0x308721['where']=_[_0x7535('0x41')](_0x308721[_0x7535('0x40')],{'$or':_[_0x7535('0x2f')](_0x308721['attributes'],function(_0x5a94c0){var _0x19815c={};_0x19815c[_0x5a94c0]={'$like':'%'+_0x446cfa['query'][_0x7535('0x3f')]+'%'};return _0x19815c;})});}_0x308721=_[_0x7535('0x41')]({},_0x308721,_0x446cfa[_0x7535('0x42')]);return _0x15e5fb[_0x7535('0x62')](_0x308721);}})[_0x7535('0x27')](function(_0x1b3f32){if(_0x1b3f32){_0x3c0155=_0x1b3f32[_0x7535('0x49')];if(!_0x446cfa[_0x7535('0x35')]['hasOwnProperty'](_0x7535('0x58'))){_0x308721[_0x7535('0x59')]=qs[_0x7535('0x59')](_0x446cfa[_0x7535('0x35')][_0x7535('0x59')]);_0x308721[_0x7535('0x23')]=qs[_0x7535('0x23')](_0x446cfa[_0x7535('0x35')]['offset']);}return _0x15e5fb['getTeams'](_0x308721);}})[_0x7535('0x27')](function(_0x1777b4){if(_0x1777b4){return _0x1777b4?{'count':_0x3c0155,'rows':_0x1777b4}:null;}})[_0x7535('0x27')](respondWithResult(_0x3e2309,null))[_0x7535('0x46')](handleError(_0x3e2309,null));};exports[_0x7535('0x64')]=function(_0x3f68cd,_0x4678c1,_0x1c9c9d){var _0x2fed4c=_0x3f68cd[_0x7535('0x4c')][_0x7535('0x65')];return db[_0x7535('0x63')][_0x7535('0x5b')]({'where':{'id':_0x2fed4c},'attributes':['id'],'include':[{'model':db[_0x7535('0x66')],'as':_0x7535('0x67'),'attributes':['id',_0x7535('0x2c'),'online',_0x7535('0x68'),_0x7535('0x69')],'raw':!![]}]})[_0x7535('0x27')](function(_0x362746){if(_0x362746){var _0x39cb25=_[_0x7535('0x6a')](_0x362746,function(_0x4ac5f4){var _0x43e582=_0x4ac5f4[_0x7535('0x50')]({'plain':!![]});return _0x43e582[_0x7535('0x67')];});return db[_0x7535('0x30')]['find']({'where':{'id':_0x3f68cd[_0x7535('0x48')]['id']}})['then'](function(_0x324ded){return db['sequelize']['transaction'](function(_0x317009){return _0x324ded[_0x7535('0x64')](_0x2fed4c,{'transaction':_0x317009})[_0x7535('0x27')](function(){return BPromise[_0x7535('0x6b')](_0x39cb25,function(_0x1a7ff6){return db[_0x7535('0x57')][_0x7535('0x6c')]({'where':{'UserId':_0x1a7ff6['id'],'OpenchannelQueueId':_0x3f68cd[_0x7535('0x48')]['id']},'transaction':_0x317009});});})[_0x7535('0x27')](function(){_0x39cb25[_0x7535('0x6d')](function(_0x2bc68a){socket[_0x7535('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x2bc68a['id'],'OpenchannelQueueId':_0x324ded['id']});});});});});}})[_0x7535('0x27')](respondWithStatusCode(_0x4678c1,null))[_0x7535('0x46')](handleError(_0x4678c1,null));};exports[_0x7535('0x6f')]=function(_0x47f14b,_0x2eec8d,_0x4b6ab1){return db[_0x7535('0x63')][_0x7535('0x5b')]({'where':{'id':_0x47f14b['query'][_0x7535('0x65')]},'attributes':['id'],'include':[{'model':db[_0x7535('0x66')],'as':_0x7535('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2eec8d,null))[_0x7535('0x27')](function(_0x7dab8c){var _0x388153=_[_0x7535('0x2f')](_0x7dab8c,'id');var _0x35df50=[];var _0x5880cb=[];var _0x341390=squel[_0x7535('0x70')]();_0x341390[_0x7535('0x71')](_0x7535('0x72'))[_0x7535('0x73')]('team_has_openchannel_queues','tq')['join'](_0x7535('0x74'),'ut',_0x7535('0x75'))[_0x7535('0x40')](_0x7535('0x76'),_0x47f14b['params']['id']);for(var _0x58085c=0x0;_0x58085c<_0x7dab8c[_0x7535('0x49')];_0x58085c+=0x1){let _0x56b9b3=_0x7dab8c[_0x58085c];for(var _0xd94726=0x0;_0xd94726<_0x56b9b3['Agents'][_0x7535('0x49')];_0xd94726+=0x1){let _0x2f364e=_0x56b9b3[_0x7535('0x67')][_0xd94726];var _0x47502c=_0x341390[_0x7535('0x77')]();_0x47502c[_0x7535('0x40')](_0x7535('0x78'),_0x2f364e['id']);_0x5880cb[_0x7535('0x79')](db[_0x7535('0x7a')][_0x7535('0x35')](_0x47502c[_0x7535('0x7b')](),{'type':db[_0x7535('0x7a')][_0x7535('0x7c')]['SELECT']})[_0x7535('0x27')](function(_0x8c29a1){if(_0x8c29a1[_0x7535('0x49')]===0x1){return _0x2f364e['id'];}else{var _0xd8e6f1=_[_0x7535('0x7d')](_['map'](_0x8c29a1,'TeamId'),function(_0x4e11ec){return _[_0x7535('0x7e')](_0x388153,_0x4e11ec);});if(_0xd8e6f1){return _0x2f364e['id'];}}}));}}return BPromise[_0x7535('0x7f')](_0x5880cb)['then'](function(_0x58a383){_0x35df50=_(_0x35df50)['union'](_0x58a383)[_0x7535('0x80')]()[_0x7535('0x81')]();return db[_0x7535('0x30')][_0x7535('0x4a')]({'where':{'id':_0x47f14b[_0x7535('0x48')]['id']}})[_0x7535('0x27')](function(_0x10ce8e){return db[_0x7535('0x7a')][_0x7535('0x82')](function(_0x153959){return _0x10ce8e['removeTeams'](_0x47f14b[_0x7535('0x35')][_0x7535('0x65')],{'transaction':_0x153959})[_0x7535('0x27')](function(){if(!_[_0x7535('0x83')](_0x35df50)){return _0x10ce8e[_0x7535('0x84')](_0x35df50,{'transaction':_0x153959});}})[_0x7535('0x27')](function(){_0x35df50[_0x7535('0x6d')](function(_0x309c6b){socket['emit'](_0x7535('0x85'),{'UserId':_0x309c6b,'OpenchannelQueueId':_0x10ce8e['id']});});});});});});})['then'](respondWithStatusCode(_0x2eec8d,null))[_0x7535('0x46')](handleError(_0x2eec8d,null));};exports['addAgents']=function(_0x468eb8,_0x59de0d,_0x5017d0){return db['OpenchannelQueue'][_0x7535('0x4a')]({'where':{'id':_0x468eb8['params']['id']}})['then'](handleEntityNotFound(_0x59de0d,null))[_0x7535('0x27')](function(_0x37ead6){if(_0x37ead6){return _0x37ead6[_0x7535('0x86')](_0x468eb8['body']['ids'],_[_0x7535('0x87')](_0x468eb8[_0x7535('0x4c')],[_0x7535('0x65'),'id'])||{})[_0x7535('0x88')](function(_0x55c51c){for(var _0x5f53bb=0x0;_0x5f53bb<_0x468eb8[_0x7535('0x4c')][_0x7535('0x65')][_0x7535('0x49')];_0x5f53bb+=0x1){socket[_0x7535('0x6e')](_0x7535('0x89'),{'UserId':_0x468eb8['body'][_0x7535('0x65')][_0x5f53bb],'OpenchannelQueueId':_0x468eb8[_0x7535('0x48')]['id']});}return _0x55c51c;});}})['then'](respondWithResult(_0x59de0d,null))[_0x7535('0x46')](handleError(_0x59de0d,null));};exports[_0x7535('0x84')]=function(_0x29b77f,_0x4d252f,_0x106399){return db['OpenchannelQueue']['find']({'where':{'id':_0x29b77f[_0x7535('0x48')]['id']}})[_0x7535('0x27')](handleEntityNotFound(_0x4d252f,null))[_0x7535('0x27')](function(_0x66bd02){if(_0x66bd02){return _0x66bd02[_0x7535('0x84')](_0x29b77f[_0x7535('0x35')][_0x7535('0x65')])['then'](function(){if(_[_0x7535('0x8a')](_0x29b77f[_0x7535('0x35')]['ids'])){for(var _0x12f5d2=0x0;_0x12f5d2<_0x29b77f[_0x7535('0x35')][_0x7535('0x65')][_0x7535('0x49')];_0x12f5d2+=0x1){socket[_0x7535('0x6e')](_0x7535('0x85'),{'UserId':Number(_0x29b77f[_0x7535('0x35')][_0x7535('0x65')][_0x12f5d2]),'OpenchannelQueueId':Number(_0x29b77f[_0x7535('0x48')]['id'])});}}else{socket[_0x7535('0x6e')](_0x7535('0x85'),{'UserId':Number(_0x29b77f[_0x7535('0x35')][_0x7535('0x65')]),'OpenchannelQueueId':Number(_0x29b77f['params']['id'])});}});}})[_0x7535('0x27')](respondWithStatusCode(_0x4d252f,null))['catch'](handleError(_0x4d252f,null));};exports[_0x7535('0x8b')]=function(_0x2ea586,_0x58505f,_0x35f9e1){var _0x442e61={};var _0x33cc21={};var _0x447cc7;var _0x27a5ed;return db[_0x7535('0x30')][_0x7535('0x56')]({'where':{'id':_0x2ea586[_0x7535('0x48')]['id']}})[_0x7535('0x27')](handleEntityNotFound(_0x58505f,null))['then'](function(_0x5b9fa6){if(_0x5b9fa6){_0x447cc7=_0x5b9fa6;_0x33cc21[_0x7535('0x34')]=_[_0x7535('0x36')](db['User']['rawAttributes']);_0x33cc21[_0x7535('0x35')]=_['keys'](_0x2ea586[_0x7535('0x35')]);_0x33cc21['filters']=_['intersection'](_0x33cc21[_0x7535('0x34')],_0x33cc21[_0x7535('0x35')]);_0x442e61[_0x7535('0x37')]=_[_0x7535('0x38')](_0x33cc21[_0x7535('0x34')],qs[_0x7535('0x39')](_0x2ea586[_0x7535('0x35')][_0x7535('0x39')]));_0x442e61[_0x7535('0x37')]=_0x442e61[_0x7535('0x37')][_0x7535('0x49')]?_0x442e61[_0x7535('0x37')]:_0x33cc21[_0x7535('0x34')];_0x442e61[_0x7535('0x3b')]=qs[_0x7535('0x3c')](_0x2ea586[_0x7535('0x35')][_0x7535('0x3c')]);_0x442e61[_0x7535('0x40')]=qs['filters'](_[_0x7535('0x3e')](_0x2ea586[_0x7535('0x35')],_0x33cc21[_0x7535('0x3d')]));if(_0x2ea586[_0x7535('0x35')][_0x7535('0x3f')]){_0x442e61['where']=_['merge'](_0x442e61[_0x7535('0x40')],{'$or':_[_0x7535('0x2f')](_0x442e61[_0x7535('0x37')],function(_0x59d5ab){var _0x43871e={};_0x43871e[_0x59d5ab]={'$like':'%'+_0x2ea586[_0x7535('0x35')][_0x7535('0x3f')]+'%'};return _0x43871e;})});}_0x442e61=_['merge']({},_0x442e61,_0x2ea586['options']);return _0x447cc7[_0x7535('0x8b')](_0x442e61);}})[_0x7535('0x27')](function(_0x206146){if(_0x206146){_0x27a5ed=_0x206146['length'];if(!_0x2ea586[_0x7535('0x35')]['hasOwnProperty'](_0x7535('0x58'))){_0x442e61[_0x7535('0x59')]=qs[_0x7535('0x59')](_0x2ea586['query'][_0x7535('0x59')]);_0x442e61[_0x7535('0x23')]=qs[_0x7535('0x23')](_0x2ea586['query'][_0x7535('0x23')]);}return _0x447cc7[_0x7535('0x8b')](_0x442e61);}})['then'](function(_0x39f065){if(_0x39f065){return _0x39f065?{'count':_0x27a5ed,'rows':_0x39f065}:null;}})[_0x7535('0x27')](respondWithResult(_0x58505f,null))[_0x7535('0x46')](handleError(_0x58505f,null));}; \ No newline at end of file +var _0x3fe0=['OpenchannelQueue','findAll','rows','catch','show','params','keys','length','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','UserId','openchannelPause','createdAt','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','removeAgents','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','include'];(function(_0x4c9316,_0x5c7f6f){var _0x146aad=function(_0x4fa179){while(--_0x4fa179){_0x4c9316['push'](_0x4c9316['shift']());}};_0x146aad(++_0x5c7f6f);}(_0x3fe0,0x1e1));var _0x03fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fe0[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x03fe('0x0'));var emlformat=require(_0x03fe('0x1'));var rimraf=require(_0x03fe('0x2'));var zipdir=require(_0x03fe('0x3'));var jsonpatch=require(_0x03fe('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x03fe('0x5'));var util=require(_0x03fe('0x6'));var path=require(_0x03fe('0x7'));var sox=require(_0x03fe('0x8'));var csv=require(_0x03fe('0x9'));var ejs=require(_0x03fe('0xa'));var fs=require('fs');var _=require(_0x03fe('0xb'));var squel=require(_0x03fe('0xc'));var crypto=require(_0x03fe('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x03fe('0xe'));var toCsv=require(_0x03fe('0x9'));var querystring=require('querystring');var Papa=require(_0x03fe('0xf'));var Redis=require(_0x03fe('0x10'));var authService=require(_0x03fe('0x11'));var qs=require(_0x03fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x03fe('0x13'))(_0x03fe('0x14'));var utils=require(_0x03fe('0x15'));var config=require(_0x03fe('0x16'));var db=require(_0x03fe('0x17'))['db'];config[_0x03fe('0x18')]=_['defaults'](config[_0x03fe('0x18')],{'host':_0x03fe('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03fe('0x18')]));require(_0x03fe('0x1a'))[_0x03fe('0x1b')](socket);function respondWithStatusCode(_0x36ac38,_0x59233e){_0x59233e=_0x59233e||0xcc;return function(_0x45bf49){if(_0x45bf49){return _0x36ac38[_0x03fe('0x1c')](_0x59233e);}return _0x36ac38[_0x03fe('0x1d')](_0x59233e)[_0x03fe('0x1e')]();};}function respondWithResult(_0x5ada1c,_0x153f3d){_0x153f3d=_0x153f3d||0xc8;return function(_0x295ff6){if(_0x295ff6){return _0x5ada1c[_0x03fe('0x1d')](_0x153f3d)['json'](_0x295ff6);}};}function respondWithFilteredResult(_0x55209a,_0x2c8979){return function(_0xcc14e2){if(_0xcc14e2){var _0x2d35b3=_0xcc14e2[_0x03fe('0x1f')],_0x3490b2=_0x2c8979[_0x03fe('0x20')],_0x3ac86e=_0x2c8979['offset']+_0x2c8979['limit'],_0xc55a56;if(_0x3ac86e>=_0x2d35b3){_0x3ac86e=_0x2d35b3;_0xc55a56=0xc8;}else{_0xc55a56=0xce;}_0x55209a[_0x03fe('0x1d')](_0xc55a56);return _0x55209a[_0x03fe('0x21')](_0x03fe('0x22'),_0x3490b2+'-'+_0x3ac86e+'/'+_0x2d35b3)[_0x03fe('0x23')](_0xcc14e2);}return null;};}function patchUpdates(_0x118aa4){return function(_0x361e57){try{jsonpatch['apply'](_0x361e57,_0x118aa4,!![]);}catch(_0x411caa){return BPromise[_0x03fe('0x24')](_0x411caa);}return _0x361e57[_0x03fe('0x25')]();};}function saveUpdates(_0x34cb31,_0x2c4cac){return function(_0xdaed03){if(_0xdaed03){return _0xdaed03[_0x03fe('0x26')](_0x34cb31)[_0x03fe('0x27')](function(_0x34dc59){return _0x34dc59;});}return null;};}function removeEntity(_0x3e4fe8,_0x3b1fd1){return function(_0xdec90b){if(_0xdec90b){return _0xdec90b['destroy']()['then'](function(){var _0xeaec79=_0xdec90b[_0x03fe('0x28')]({'plain':!![]});var _0x47ebde=_0x03fe('0x29');return db[_0x03fe('0x2a')][_0x03fe('0x2b')]({'where':{'type':_0x47ebde,'resourceId':_0xeaec79['id']}})[_0x03fe('0x27')](function(){return _0xdec90b;});})[_0x03fe('0x27')](function(){_0x3e4fe8[_0x03fe('0x1d')](0xcc)[_0x03fe('0x1e')]();});}};}function handleEntityNotFound(_0x153efe,_0x44248c){return function(_0x28f5ee){if(!_0x28f5ee){_0x153efe[_0x03fe('0x1c')](0x194);}return _0x28f5ee;};}function handleError(_0x3ab767,_0x342ce2){_0x342ce2=_0x342ce2||0x1f4;return function(_0x4ce40b){logger[_0x03fe('0x2c')](_0x4ce40b['stack']);if(_0x4ce40b[_0x03fe('0x2d')]){delete _0x4ce40b['name'];}_0x3ab767['status'](_0x342ce2)[_0x03fe('0x2e')](_0x4ce40b);};}exports[_0x03fe('0x2f')]=function(_0x40118c,_0xea0533){var _0x327cbb={},_0x25aead={},_0x355c11={'count':0x0,'rows':[]};var _0xcfa0b2=_[_0x03fe('0x30')](db['OpenchannelQueue'][_0x03fe('0x31')],function(_0x480499){return{'name':_0x480499['fieldName'],'type':_0x480499[_0x03fe('0x32')]['key']};});_0x25aead[_0x03fe('0x33')]=_['map'](_0xcfa0b2,'name');_0x25aead[_0x03fe('0x34')]=_['keys'](_0x40118c['query']);_0x25aead[_0x03fe('0x35')]=_[_0x03fe('0x36')](_0x25aead[_0x03fe('0x33')],_0x25aead[_0x03fe('0x34')]);_0x327cbb[_0x03fe('0x37')]=_[_0x03fe('0x36')](_0x25aead[_0x03fe('0x33')],qs[_0x03fe('0x38')](_0x40118c[_0x03fe('0x34')]['fields']));_0x327cbb['attributes']=_0x327cbb[_0x03fe('0x37')]['length']?_0x327cbb[_0x03fe('0x37')]:_0x25aead[_0x03fe('0x33')];if(!_0x40118c[_0x03fe('0x34')][_0x03fe('0x39')](_0x03fe('0x3a'))){_0x327cbb[_0x03fe('0x3b')]=qs[_0x03fe('0x3b')](_0x40118c[_0x03fe('0x34')][_0x03fe('0x3b')]);_0x327cbb['offset']=qs['offset'](_0x40118c['query']['offset']);}_0x327cbb[_0x03fe('0x3c')]=qs[_0x03fe('0x3d')](_0x40118c['query'][_0x03fe('0x3d')]);_0x327cbb[_0x03fe('0x3e')]=qs[_0x03fe('0x35')](_[_0x03fe('0x3f')](_0x40118c[_0x03fe('0x34')],_0x25aead[_0x03fe('0x35')]),_0xcfa0b2);if(_0x40118c[_0x03fe('0x34')]['filter']){_0x327cbb[_0x03fe('0x3e')]=_['merge'](_0x327cbb[_0x03fe('0x3e')],{'$or':_[_0x03fe('0x30')](_0xcfa0b2,function(_0x379849){if(_0x379849[_0x03fe('0x32')]!=='VIRTUAL'){var _0x4ee294={};_0x4ee294[_0x379849[_0x03fe('0x2d')]]={'$like':'%'+_0x40118c[_0x03fe('0x34')][_0x03fe('0x40')]+'%'};return _0x4ee294;}})});}_0x327cbb=_[_0x03fe('0x41')]({},_0x327cbb,_0x40118c['options']);var _0x3118f0={'where':_0x327cbb[_0x03fe('0x3e')]};return db['OpenchannelQueue'][_0x03fe('0x1f')](_0x3118f0)[_0x03fe('0x27')](function(_0x369495){_0x355c11[_0x03fe('0x1f')]=_0x369495;if(_0x40118c[_0x03fe('0x34')]['includeAll']){_0x327cbb[_0x03fe('0x42')]=[{'all':!![]}];}return db[_0x03fe('0x43')][_0x03fe('0x44')](_0x327cbb);})[_0x03fe('0x27')](function(_0x32cf0a){_0x355c11[_0x03fe('0x45')]=_0x32cf0a;return _0x355c11;})[_0x03fe('0x27')](respondWithFilteredResult(_0xea0533,_0x327cbb))[_0x03fe('0x46')](handleError(_0xea0533,null));};exports[_0x03fe('0x47')]=function(_0xb8bed8,_0x58537b){var _0x9b7456={'raw':!![],'where':{'id':_0xb8bed8[_0x03fe('0x48')]['id']}},_0x38d949={};_0x38d949[_0x03fe('0x33')]=_[_0x03fe('0x49')](db[_0x03fe('0x43')][_0x03fe('0x31')]);_0x38d949[_0x03fe('0x34')]=_['keys'](_0xb8bed8[_0x03fe('0x34')]);_0x38d949[_0x03fe('0x35')]=_[_0x03fe('0x36')](_0x38d949[_0x03fe('0x33')],_0x38d949[_0x03fe('0x34')]);_0x9b7456['attributes']=_[_0x03fe('0x36')](_0x38d949[_0x03fe('0x33')],qs[_0x03fe('0x38')](_0xb8bed8['query']['fields']));_0x9b7456[_0x03fe('0x37')]=_0x9b7456['attributes'][_0x03fe('0x4a')]?_0x9b7456[_0x03fe('0x37')]:_0x38d949[_0x03fe('0x33')];if(_0xb8bed8[_0x03fe('0x34')]['includeAll']){_0x9b7456[_0x03fe('0x42')]=[{'all':!![]}];}_0x9b7456=_['merge']({},_0x9b7456,_0xb8bed8[_0x03fe('0x4b')]);return db['OpenchannelQueue']['find'](_0x9b7456)[_0x03fe('0x27')](handleEntityNotFound(_0x58537b,null))['then'](respondWithResult(_0x58537b,null))[_0x03fe('0x46')](handleError(_0x58537b,null));};exports[_0x03fe('0x4c')]=function(_0x46e85c,_0x5d37ed){return db[_0x03fe('0x43')]['create'](_0x46e85c[_0x03fe('0x4d')],{})[_0x03fe('0x27')](function(_0x3172f9){var _0x591eda=_0x46e85c['user'][_0x03fe('0x28')]({'plain':!![]});if(!_0x591eda)throw new Error(_0x03fe('0x4e'));if(_0x591eda[_0x03fe('0x4f')]===_0x03fe('0x50')){var _0x420d85=_0x3172f9[_0x03fe('0x28')]({'plain':!![]});var _0x5471fc=_0x03fe('0x29');return db[_0x03fe('0x51')][_0x03fe('0x52')]({'where':{'name':_0x5471fc,'userProfileId':_0x591eda['userProfileId']},'raw':!![]})[_0x03fe('0x27')](function(_0x366211){if(_0x366211&&_0x366211[_0x03fe('0x53')]===0x0){return db['UserProfileResource'][_0x03fe('0x4c')]({'name':_0x420d85[_0x03fe('0x2d')],'resourceId':_0x420d85['id'],'type':_0x366211['name'],'sectionId':_0x366211['id']},{})[_0x03fe('0x27')](function(){return _0x3172f9;});}else{return _0x3172f9;}})[_0x03fe('0x46')](function(_0x4d6e7f){logger['error'](_0x03fe('0x54'),_0x4d6e7f);throw _0x4d6e7f;});}return _0x3172f9;})[_0x03fe('0x27')](respondWithResult(_0x5d37ed,0xc9))[_0x03fe('0x46')](handleError(_0x5d37ed,null));};exports[_0x03fe('0x26')]=function(_0x2e87fc,_0x4b2d1c){if(_0x2e87fc[_0x03fe('0x4d')]['id']){delete _0x2e87fc[_0x03fe('0x4d')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x2e87fc[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x4b2d1c,null))[_0x03fe('0x27')](saveUpdates(_0x2e87fc['body'],null))[_0x03fe('0x27')](respondWithResult(_0x4b2d1c,null))[_0x03fe('0x46')](handleError(_0x4b2d1c,null));};exports[_0x03fe('0x2b')]=function(_0x398884,_0x5a94ec){return db[_0x03fe('0x43')][_0x03fe('0x52')]({'where':{'id':_0x398884[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x5a94ec,null))[_0x03fe('0x27')](removeEntity(_0x5a94ec,null))[_0x03fe('0x46')](handleError(_0x5a94ec,null));};exports[_0x03fe('0x55')]=function(_0xc5d803,_0x445cfc){return db[_0x03fe('0x43')][_0x03fe('0x55')]()[_0x03fe('0x27')](respondWithResult(_0x445cfc,null))[_0x03fe('0x46')](handleError(_0x445cfc,null));};exports[_0x03fe('0x56')]=function(_0x5f3d79,_0x511f9d,_0x22032e){var _0x48670a={'raw':!![],'where':{}},_0x446706={},_0xe91aa9;return db[_0x03fe('0x43')][_0x03fe('0x57')]({'where':{'id':_0x5f3d79[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x511f9d,null))[_0x03fe('0x27')](function(_0x12f4f8){if(_0x12f4f8){_0xe91aa9=_0x12f4f8['get']({'plain':!![]});_0x446706[_0x03fe('0x33')]=_[_0x03fe('0x49')](db[_0x03fe('0x58')][_0x03fe('0x31')]);_0x446706['query']=_['keys'](_0x5f3d79[_0x03fe('0x34')]);_0x446706['filters']=_[_0x03fe('0x36')](_0x446706[_0x03fe('0x33')],_0x446706[_0x03fe('0x34')]);_0x48670a[_0x03fe('0x37')]=_[_0x03fe('0x36')](_0x446706['model'],qs['fields'](_0x5f3d79[_0x03fe('0x34')]['fields']));_0x48670a[_0x03fe('0x37')]=_0x48670a['attributes']['length']?_0x48670a['attributes']:_0x446706[_0x03fe('0x33')];if(!_0x5f3d79[_0x03fe('0x34')][_0x03fe('0x39')](_0x03fe('0x3a'))){_0x48670a[_0x03fe('0x3b')]=qs['limit'](_0x5f3d79[_0x03fe('0x34')][_0x03fe('0x3b')]);_0x48670a['offset']=qs[_0x03fe('0x20')](_0x5f3d79['query'][_0x03fe('0x20')]);}_0x48670a[_0x03fe('0x3c')]=qs[_0x03fe('0x3d')](_0x5f3d79[_0x03fe('0x34')][_0x03fe('0x3d')]);_0x48670a['where']=qs[_0x03fe('0x35')](_['pick'](_0x5f3d79[_0x03fe('0x34')],_0x446706[_0x03fe('0x35')]));_0x48670a[_0x03fe('0x3e')][_0x03fe('0x59')]=_0x12f4f8['id'];if(_0x5f3d79[_0x03fe('0x34')][_0x03fe('0x40')]){_0x48670a[_0x03fe('0x3e')]=_[_0x03fe('0x41')](_0x48670a[_0x03fe('0x3e')],{'$or':_[_0x03fe('0x30')](_0x48670a[_0x03fe('0x37')],function(_0x510163){var _0x3143e4={};_0x3143e4[_0x510163]={'$like':'%'+_0x5f3d79['query']['filter']+'%'};return _0x3143e4;})});}_0x48670a=_[_0x03fe('0x41')]({},_0x48670a,_0x5f3d79[_0x03fe('0x4b')]);return db[_0x03fe('0x58')]['findAll'](_0x48670a);}})[_0x03fe('0x27')](function(_0xca9dec){if(_0xca9dec){return db[_0x03fe('0x5a')]['findAndCountAll']({'where':{'id':_[_0x03fe('0x30')](_0xca9dec,_0x03fe('0x5b')),'role':'agent'},'attributes':['id','name',_0x03fe('0x5c'),'updatedAt',_0x03fe('0x5d')]});}})[_0x03fe('0x27')](function(_0x31e46b){if(_0x31e46b){return{'count':_0x31e46b['count'],'rows':_[_0x03fe('0x30')](_0x31e46b['rows'],function(_0x384b8b){return{'membername':_0x384b8b[_0x03fe('0x2d')],'UserId':_0x384b8b['id'],'queue_name':_0xe91aa9[_0x03fe('0x2d')],'OpenchannelQueueId':_0xe91aa9['id'],'interface':util['format']('%s/%s',_0x03fe('0x5e'),_0x384b8b[_0x03fe('0x2d')]),'penalty':0x0,'paused':_0x384b8b[_0x03fe('0x5c')],'createdAt':_0x384b8b[_0x03fe('0x5d')],'updatedAt':_0x384b8b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x03fe('0x27')](respondWithFilteredResult(_0x511f9d,_0x48670a))[_0x03fe('0x46')](handleError(_0x511f9d,null));};exports[_0x03fe('0x5f')]=function(_0x283764,_0x2a7b2c,_0x3b4d5a){var _0x91e951={};var _0x5bba73={};var _0x2401f7;var _0x23d94b;return db[_0x03fe('0x43')][_0x03fe('0x57')]({'where':{'id':_0x283764[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x2a7b2c,null))[_0x03fe('0x27')](function(_0x2ac5f1){if(_0x2ac5f1){_0x2401f7=_0x2ac5f1;_0x5bba73['model']=_['keys'](db[_0x03fe('0x60')]['rawAttributes']);_0x5bba73[_0x03fe('0x34')]=_[_0x03fe('0x49')](_0x283764[_0x03fe('0x34')]);_0x5bba73[_0x03fe('0x35')]=_[_0x03fe('0x36')](_0x5bba73[_0x03fe('0x33')],_0x5bba73['query']);_0x91e951[_0x03fe('0x37')]=_[_0x03fe('0x36')](_0x5bba73['model'],qs[_0x03fe('0x38')](_0x283764[_0x03fe('0x34')][_0x03fe('0x38')]));_0x91e951[_0x03fe('0x37')]=_0x91e951[_0x03fe('0x37')]['length']?_0x91e951[_0x03fe('0x37')]:_0x5bba73[_0x03fe('0x33')];_0x91e951[_0x03fe('0x3c')]=qs[_0x03fe('0x3d')](_0x283764[_0x03fe('0x34')][_0x03fe('0x3d')]);_0x91e951[_0x03fe('0x3e')]=qs[_0x03fe('0x35')](_['pick'](_0x283764['query'],_0x5bba73['filters']));if(_0x283764[_0x03fe('0x34')][_0x03fe('0x40')]){_0x91e951[_0x03fe('0x3e')]=_[_0x03fe('0x41')](_0x91e951[_0x03fe('0x3e')],{'$or':_[_0x03fe('0x30')](_0x91e951[_0x03fe('0x37')],function(_0x39ec73){var _0x3a9395={};_0x3a9395[_0x39ec73]={'$like':'%'+_0x283764[_0x03fe('0x34')]['filter']+'%'};return _0x3a9395;})});}_0x91e951=_[_0x03fe('0x41')]({},_0x91e951,_0x283764[_0x03fe('0x4b')]);return _0x2401f7[_0x03fe('0x5f')](_0x91e951);}})[_0x03fe('0x27')](function(_0xb587ff){if(_0xb587ff){_0x23d94b=_0xb587ff[_0x03fe('0x4a')];if(!_0x283764[_0x03fe('0x34')][_0x03fe('0x39')](_0x03fe('0x3a'))){_0x91e951['limit']=qs[_0x03fe('0x3b')](_0x283764[_0x03fe('0x34')][_0x03fe('0x3b')]);_0x91e951[_0x03fe('0x20')]=qs[_0x03fe('0x20')](_0x283764['query']['offset']);}return _0x2401f7[_0x03fe('0x5f')](_0x91e951);}})[_0x03fe('0x27')](function(_0x6d6961){if(_0x6d6961){return _0x6d6961?{'count':_0x23d94b,'rows':_0x6d6961}:null;}})[_0x03fe('0x27')](respondWithResult(_0x2a7b2c,null))[_0x03fe('0x46')](handleError(_0x2a7b2c,null));};exports[_0x03fe('0x61')]=function(_0x125d8d,_0x46cb6e,_0x307050){var _0x32fe92=_0x125d8d['body'][_0x03fe('0x62')];return db[_0x03fe('0x60')][_0x03fe('0x44')]({'where':{'id':_0x32fe92},'attributes':['id'],'include':[{'model':db[_0x03fe('0x5a')],'as':_0x03fe('0x63'),'attributes':['id',_0x03fe('0x2d'),_0x03fe('0x64'),_0x03fe('0x65'),_0x03fe('0x66')],'raw':!![]}]})[_0x03fe('0x27')](function(_0x2ea876){if(_0x2ea876){var _0x11535c=_[_0x03fe('0x67')](_0x2ea876,function(_0x499497){var _0x19a57a=_0x499497[_0x03fe('0x28')]({'plain':!![]});return _0x19a57a[_0x03fe('0x63')];});return db[_0x03fe('0x43')][_0x03fe('0x52')]({'where':{'id':_0x125d8d['params']['id']}})[_0x03fe('0x27')](function(_0x50af9c){return db[_0x03fe('0x68')][_0x03fe('0x69')](function(_0x17cab2){return _0x50af9c['addTeams'](_0x32fe92,{'transaction':_0x17cab2})[_0x03fe('0x27')](function(){return BPromise[_0x03fe('0x6a')](_0x11535c,function(_0x5dff1c){return db['UserOpenchannelQueue'][_0x03fe('0x6b')]({'where':{'UserId':_0x5dff1c['id'],'OpenchannelQueueId':_0x125d8d[_0x03fe('0x48')]['id']},'transaction':_0x17cab2});});})[_0x03fe('0x27')](function(){_0x11535c[_0x03fe('0x6c')](function(_0x2fa876){socket[_0x03fe('0x6d')](_0x03fe('0x6e'),{'UserId':_0x2fa876['id'],'OpenchannelQueueId':_0x50af9c['id']});});});});});}})[_0x03fe('0x27')](respondWithStatusCode(_0x46cb6e,null))['catch'](handleError(_0x46cb6e,null));};exports['removeTeams']=function(_0x38a7ee,_0x1d956e,_0x543045){return db[_0x03fe('0x60')][_0x03fe('0x44')]({'where':{'id':_0x38a7ee[_0x03fe('0x34')][_0x03fe('0x62')]},'attributes':['id'],'include':[{'model':db[_0x03fe('0x5a')],'as':_0x03fe('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1d956e,null))[_0x03fe('0x27')](function(_0x1ef184){var _0x52626b=_['map'](_0x1ef184,'id');var _0x51b582=[];var _0x775abf=[];var _0xf238c8=squel['select']();_0xf238c8[_0x03fe('0x6f')]('tq.TeamId')[_0x03fe('0x70')](_0x03fe('0x71'),'tq')[_0x03fe('0x72')](_0x03fe('0x73'),'ut',_0x03fe('0x74'))[_0x03fe('0x3e')](_0x03fe('0x75'),_0x38a7ee[_0x03fe('0x48')]['id']);for(var _0x44cab0=0x0;_0x44cab0<_0x1ef184['length'];_0x44cab0+=0x1){let _0x113b8e=_0x1ef184[_0x44cab0];for(var _0x26db8f=0x0;_0x26db8f<_0x113b8e[_0x03fe('0x63')][_0x03fe('0x4a')];_0x26db8f+=0x1){let _0x524229=_0x113b8e[_0x03fe('0x63')][_0x26db8f];var _0x2210b9=_0xf238c8['clone']();_0x2210b9[_0x03fe('0x3e')](_0x03fe('0x76'),_0x524229['id']);_0x775abf[_0x03fe('0x77')](db[_0x03fe('0x68')][_0x03fe('0x34')](_0x2210b9[_0x03fe('0x78')](),{'type':db['sequelize'][_0x03fe('0x79')][_0x03fe('0x7a')]})[_0x03fe('0x27')](function(_0x33f1b4){if(_0x33f1b4[_0x03fe('0x4a')]===0x1){return _0x524229['id'];}else{var _0x4eec0a=_[_0x03fe('0x7b')](_[_0x03fe('0x30')](_0x33f1b4,_0x03fe('0x7c')),function(_0x15a234){return _[_0x03fe('0x7d')](_0x52626b,_0x15a234);});if(_0x4eec0a){return _0x524229['id'];}}}));}}return BPromise['all'](_0x775abf)[_0x03fe('0x27')](function(_0xaaf08a){_0x51b582=_(_0x51b582)[_0x03fe('0x7e')](_0xaaf08a)[_0x03fe('0x7f')]()[_0x03fe('0x80')]();return db[_0x03fe('0x43')][_0x03fe('0x52')]({'where':{'id':_0x38a7ee[_0x03fe('0x48')]['id']}})['then'](function(_0x384577){return db['sequelize'][_0x03fe('0x69')](function(_0x2962f5){return _0x384577[_0x03fe('0x81')](_0x38a7ee[_0x03fe('0x34')][_0x03fe('0x62')],{'transaction':_0x2962f5})['then'](function(){if(!_['isEmpty'](_0x51b582)){return _0x384577[_0x03fe('0x82')](_0x51b582,{'transaction':_0x2962f5});}})[_0x03fe('0x27')](function(){_0x51b582[_0x03fe('0x6c')](function(_0x24b7c9){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x24b7c9,'OpenchannelQueueId':_0x384577['id']});});});});});});})[_0x03fe('0x27')](respondWithStatusCode(_0x1d956e,null))[_0x03fe('0x46')](handleError(_0x1d956e,null));};exports[_0x03fe('0x83')]=function(_0x55f256,_0x1d339b,_0x485d12){return db['OpenchannelQueue'][_0x03fe('0x52')]({'where':{'id':_0x55f256[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x1d339b,null))['then'](function(_0xf6e73c){if(_0xf6e73c){return _0xf6e73c[_0x03fe('0x83')](_0x55f256[_0x03fe('0x4d')][_0x03fe('0x62')],_[_0x03fe('0x84')](_0x55f256[_0x03fe('0x4d')],[_0x03fe('0x62'),'id'])||{})[_0x03fe('0x85')](function(_0x5c0e34){for(var _0x21a5c0=0x0;_0x21a5c0<_0x55f256[_0x03fe('0x4d')][_0x03fe('0x62')][_0x03fe('0x4a')];_0x21a5c0+=0x1){socket[_0x03fe('0x6d')](_0x03fe('0x6e'),{'UserId':_0x55f256[_0x03fe('0x4d')][_0x03fe('0x62')][_0x21a5c0],'OpenchannelQueueId':_0x55f256[_0x03fe('0x48')]['id']});}return _0x5c0e34;});}})[_0x03fe('0x27')](respondWithResult(_0x1d339b,null))[_0x03fe('0x46')](handleError(_0x1d339b,null));};exports[_0x03fe('0x82')]=function(_0x158f76,_0x5e9b6b,_0x215e7b){return db[_0x03fe('0x43')][_0x03fe('0x52')]({'where':{'id':_0x158f76[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0x5e9b6b,null))[_0x03fe('0x27')](function(_0x323abf){if(_0x323abf){return _0x323abf['removeAgents'](_0x158f76[_0x03fe('0x34')][_0x03fe('0x62')])['then'](function(){if(_[_0x03fe('0x86')](_0x158f76[_0x03fe('0x34')]['ids'])){for(var _0x2573e8=0x0;_0x2573e8<_0x158f76[_0x03fe('0x34')]['ids']['length'];_0x2573e8+=0x1){socket['emit'](_0x03fe('0x87'),{'UserId':Number(_0x158f76[_0x03fe('0x34')][_0x03fe('0x62')][_0x2573e8]),'OpenchannelQueueId':Number(_0x158f76['params']['id'])});}}else{socket['emit'](_0x03fe('0x87'),{'UserId':Number(_0x158f76['query']['ids']),'OpenchannelQueueId':Number(_0x158f76[_0x03fe('0x48')]['id'])});}});}})[_0x03fe('0x27')](respondWithStatusCode(_0x5e9b6b,null))[_0x03fe('0x46')](handleError(_0x5e9b6b,null));};exports[_0x03fe('0x88')]=function(_0x9e2a6b,_0xd4e46,_0x58b57a){var _0x41a361={};var _0x40918a={};var _0x4681c7;var _0x590cc7;return db[_0x03fe('0x43')]['findOne']({'where':{'id':_0x9e2a6b[_0x03fe('0x48')]['id']}})[_0x03fe('0x27')](handleEntityNotFound(_0xd4e46,null))[_0x03fe('0x27')](function(_0x57c49e){if(_0x57c49e){_0x4681c7=_0x57c49e;_0x40918a[_0x03fe('0x33')]=_['keys'](db[_0x03fe('0x5a')][_0x03fe('0x31')]);_0x40918a['query']=_[_0x03fe('0x49')](_0x9e2a6b['query']);_0x40918a[_0x03fe('0x35')]=_[_0x03fe('0x36')](_0x40918a['model'],_0x40918a['query']);_0x41a361['attributes']=_[_0x03fe('0x36')](_0x40918a[_0x03fe('0x33')],qs[_0x03fe('0x38')](_0x9e2a6b[_0x03fe('0x34')][_0x03fe('0x38')]));_0x41a361[_0x03fe('0x37')]=_0x41a361['attributes'][_0x03fe('0x4a')]?_0x41a361[_0x03fe('0x37')]:_0x40918a[_0x03fe('0x33')];_0x41a361[_0x03fe('0x3c')]=qs[_0x03fe('0x3d')](_0x9e2a6b[_0x03fe('0x34')][_0x03fe('0x3d')]);_0x41a361[_0x03fe('0x3e')]=qs[_0x03fe('0x35')](_['pick'](_0x9e2a6b[_0x03fe('0x34')],_0x40918a['filters']));if(_0x9e2a6b['query'][_0x03fe('0x40')]){_0x41a361[_0x03fe('0x3e')]=_[_0x03fe('0x41')](_0x41a361[_0x03fe('0x3e')],{'$or':_[_0x03fe('0x30')](_0x41a361[_0x03fe('0x37')],function(_0x1631bc){var _0x39fcf7={};_0x39fcf7[_0x1631bc]={'$like':'%'+_0x9e2a6b[_0x03fe('0x34')][_0x03fe('0x40')]+'%'};return _0x39fcf7;})});}_0x41a361=_[_0x03fe('0x41')]({},_0x41a361,_0x9e2a6b[_0x03fe('0x4b')]);return _0x4681c7['getAgents'](_0x41a361);}})[_0x03fe('0x27')](function(_0x2911f6){if(_0x2911f6){_0x590cc7=_0x2911f6[_0x03fe('0x4a')];if(!_0x9e2a6b[_0x03fe('0x34')][_0x03fe('0x39')](_0x03fe('0x3a'))){_0x41a361[_0x03fe('0x3b')]=qs[_0x03fe('0x3b')](_0x9e2a6b['query'][_0x03fe('0x3b')]);_0x41a361[_0x03fe('0x20')]=qs[_0x03fe('0x20')](_0x9e2a6b[_0x03fe('0x34')][_0x03fe('0x20')]);}return _0x4681c7[_0x03fe('0x88')](_0x41a361);}})[_0x03fe('0x27')](function(_0x3f8de3){if(_0x3f8de3){return _0x3f8de3?{'count':_0x590cc7,'rows':_0x3f8de3}:null;}})[_0x03fe('0x27')](respondWithResult(_0xd4e46,null))[_0x03fe('0x46')](handleError(_0xd4e46,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 86bbf84..874e0cc 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 _0xecbf=['hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners','save','remove','emit'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xecbf,0x174));var _0xfecb=function(_0x21df10,_0x468422){_0x21df10=_0x21df10-0x0;var _0x36a51b=_0xecbf[_0x21df10];return _0x36a51b;};'use strict';var EventEmitter=require(_0xfecb('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xfecb('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xfecb('0x2')](0x0);var events={'afterCreate':_0xfecb('0x3'),'afterUpdate':'update','afterDestroy':_0xfecb('0x4')};function emitEvent(_0x5515f2){return function(_0xf45e30,_0x30cddf,_0x2f9b81){OpenchannelQueueEvents[_0xfecb('0x5')](_0x5515f2+':'+_0xf45e30['id'],_0xf45e30);OpenchannelQueueEvents[_0xfecb('0x5')](_0x5515f2,_0xf45e30);_0x2f9b81(null);};}for(var e in events){if(events[_0xfecb('0x6')](e)){var event=events[e];OpenchannelQueue[_0xfecb('0x7')](e,emitEvent(event));}}module[_0xfecb('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xd71b=['OpenchannelQueue','save','update','remove','emit','../../mysqldb'];(function(_0x454f02,_0x32ce79){var _0x3369f7=function(_0x4c455c){while(--_0x4c455c){_0x454f02['push'](_0x454f02['shift']());}};_0x3369f7(++_0x32ce79);}(_0xd71b,0x1bb));var _0xbd71=function(_0x3640ab,_0x18bf07){_0x3640ab=_0x3640ab-0x0;var _0x46af89=_0xd71b[_0x3640ab];return _0x46af89;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xbd71('0x0'))['db'][_0xbd71('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd71('0x2'),'afterUpdate':_0xbd71('0x3'),'afterDestroy':_0xbd71('0x4')};function emitEvent(_0x2da3ec){return function(_0xf712e9,_0x469770,_0x113fdc){OpenchannelQueueEvents[_0xbd71('0x5')](_0x2da3ec+':'+_0xf712e9['id'],_0xf712e9);OpenchannelQueueEvents[_0xbd71('0x5')](_0x2da3ec,_0xf712e9);_0x113fdc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 9753540..65f3bdf 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 _0x8bc1=['bluebird','request-promise','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','../../config/logger','api'];(function(_0x394efb,_0x19132c){var _0x202f70=function(_0x3d71ff){while(--_0x3d71ff){_0x394efb['push'](_0x394efb['shift']());}};_0x202f70(++_0x19132c);}(_0x8bc1,0x10b));var _0x18bc=function(_0x406b02,_0x9b864a){_0x406b02=_0x406b02-0x0;var _0x4b96b4=_0x8bc1[_0x406b02];return _0x4b96b4;};'use strict';var _=require(_0x18bc('0x0'));var util=require('util');var logger=require(_0x18bc('0x1'))(_0x18bc('0x2'));var moment=require('moment');var BPromise=require(_0x18bc('0x3'));var rp=require(_0x18bc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x18bc('0x5'));var attributes=require(_0x18bc('0x6'));module[_0x18bc('0x7')]=function(_0x74fa19,_0x2afbcb){return _0x74fa19[_0x18bc('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x18bc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4a0=['rimraf','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','api','bluebird','request-promise','path'];(function(_0x710d39,_0x36485b){var _0x5406e2=function(_0x49c8d3){while(--_0x49c8d3){_0x710d39['push'](_0x710d39['shift']());}};_0x5406e2(++_0x36485b);}(_0xe4a0,0x1f4));var _0x0e4a=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe4a0[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x0e4a('0x0'));var util=require(_0x0e4a('0x1'));var logger=require('../../config/logger')(_0x0e4a('0x2'));var moment=require('moment');var BPromise=require(_0x0e4a('0x3'));var rp=require(_0x0e4a('0x4'));var fs=require('fs');var path=require(_0x0e4a('0x5'));var rimraf=require(_0x0e4a('0x6'));var config=require('../../config/environment');var attributes=require(_0x0e4a('0x7'));module[_0x0e4a('0x8')]=function(_0x1b8027,_0x53591d){return _0x1b8027[_0x0e4a('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x0e4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 18112ce..a3c2ce9 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 _0xce73=['request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','model','include','map','debug','ShowOpenchannelQueue','OpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register'];(function(_0x5769e0,_0x4b4ca8){var _0x5b89e3=function(_0x3a9b24){while(--_0x3a9b24){_0x5769e0['push'](_0x5769e0['shift']());}};_0x5b89e3(++_0x4b4ca8);}(_0xce73,0x90));var _0x3ce7=function(_0x5833d2,_0xdd23dc){_0x5833d2=_0x5833d2-0x0;var _0x5910fa=_0xce73[_0x5833d2];return _0x5910fa;};'use strict';var _=require(_0x3ce7('0x0'));var util=require(_0x3ce7('0x1'));var moment=require(_0x3ce7('0x2'));var BPromise=require(_0x3ce7('0x3'));var rs=require(_0x3ce7('0x4'));var fs=require('fs');var Redis=require(_0x3ce7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3ce7('0x6'))(_0x3ce7('0x7'));var config=require(_0x3ce7('0x8'));var jayson=require(_0x3ce7('0x9'));var client=jayson[_0x3ce7('0xa')][_0x3ce7('0xb')]({'port':0x232a});config[_0x3ce7('0xc')]=_['defaults'](config['redis'],{'host':_0x3ce7('0xd'),'port':0x18eb});var socket=require(_0x3ce7('0xe'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x3ce7('0xf')](socket);function respondWithRpcPromise(_0x599332,_0x7a3a10,_0x27b8f2){return new BPromise(function(_0x50221c,_0x3ccd9c){return client[_0x3ce7('0x10')](_0x599332,_0x27b8f2)[_0x3ce7('0x11')](function(_0x3f1d3f){logger[_0x3ce7('0x12')](_0x3ce7('0x13'),_0x7a3a10,_0x3ce7('0x14'));logger['debug'](_0x3ce7('0x15'),_0x7a3a10,_0x3ce7('0x14'),JSON[_0x3ce7('0x16')](_0x3f1d3f));if(_0x3f1d3f['error']){if(_0x3f1d3f[_0x3ce7('0x17')][_0x3ce7('0x18')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x7a3a10,_0x3f1d3f[_0x3ce7('0x17')]['message']);return _0x3ccd9c(_0x3f1d3f['error'][_0x3ce7('0x19')]);}logger[_0x3ce7('0x17')](_0x3ce7('0x13'),_0x7a3a10,_0x3f1d3f[_0x3ce7('0x17')]['message']);return _0x50221c(_0x3f1d3f[_0x3ce7('0x17')][_0x3ce7('0x19')]);}else{logger[_0x3ce7('0x12')](_0x3ce7('0x13'),_0x7a3a10,_0x3ce7('0x14'));_0x50221c(_0x3f1d3f[_0x3ce7('0x1a')][_0x3ce7('0x19')]);}})[_0x3ce7('0x1b')](function(_0x1b6805){logger[_0x3ce7('0x17')](_0x3ce7('0x13'),_0x7a3a10,_0x1b6805);_0x3ccd9c(_0x1b6805);});});}exports[_0x3ce7('0x1c')]=function(_0x297151){var _0x4ae426=this;return new Promise(function(_0x4a0fb0,_0x3fa699){return db['OpenchannelQueue'][_0x3ce7('0x1d')]({'raw':_0x297151[_0x3ce7('0x1e')]?_0x297151[_0x3ce7('0x1e')][_0x3ce7('0x1f')]===undefined?!![]:![]:!![],'where':_0x297151[_0x3ce7('0x1e')]?_0x297151[_0x3ce7('0x1e')][_0x3ce7('0x20')]||null:null,'attributes':_0x297151[_0x3ce7('0x1e')]?_0x297151[_0x3ce7('0x1e')][_0x3ce7('0x21')]||null:null,'limit':_0x297151['options']?_0x297151['options']['limit']||null:null,'include':_0x297151[_0x3ce7('0x1e')]?_0x297151[_0x3ce7('0x1e')]['include']?_['map'](_0x297151[_0x3ce7('0x1e')]['include'],function(_0x222d98){return{'model':db[_0x222d98[_0x3ce7('0x22')]],'as':_0x222d98['as'],'attributes':_0x222d98[_0x3ce7('0x21')],'include':_0x222d98[_0x3ce7('0x23')]?_[_0x3ce7('0x24')](_0x222d98[_0x3ce7('0x23')],function(_0x516bb3){return{'model':db[_0x516bb3[_0x3ce7('0x22')]],'as':_0x516bb3['as'],'attributes':_0x516bb3['attributes'],'include':_0x516bb3['include']?_[_0x3ce7('0x24')](_0x516bb3[_0x3ce7('0x23')],function(_0x48cbb2){return{'model':db[_0x48cbb2['model']],'as':_0x48cbb2['as'],'attributes':_0x48cbb2[_0x3ce7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3ce7('0x11')](function(_0x2a8ce4){logger[_0x3ce7('0x12')](_0x3ce7('0x1c'),_0x297151);logger[_0x3ce7('0x25')](_0x3ce7('0x1c'),_0x297151,JSON[_0x3ce7('0x16')](_0x2a8ce4));_0x4a0fb0(_0x2a8ce4);})['catch'](function(_0x322f96){logger[_0x3ce7('0x17')](_0x3ce7('0x1c'),_0x322f96[_0x3ce7('0x19')],_0x297151);_0x3fa699(_0x4ae426[_0x3ce7('0x17')](0x1f4,_0x322f96[_0x3ce7('0x19')]));});});};exports[_0x3ce7('0x26')]=function(_0x420dab){var _0x5eb04d=this;return new Promise(function(_0x45b660,_0x5a1fe3){return db[_0x3ce7('0x27')]['find']({'raw':_0x420dab['options']?_0x420dab[_0x3ce7('0x1e')][_0x3ce7('0x1f')]===undefined?!![]:![]:!![],'where':_0x420dab['options']?_0x420dab['options'][_0x3ce7('0x20')]||null:null,'attributes':_0x420dab['options']?_0x420dab['options'][_0x3ce7('0x21')]||null:null,'include':_0x420dab[_0x3ce7('0x1e')]?_0x420dab[_0x3ce7('0x1e')][_0x3ce7('0x23')]?_[_0x3ce7('0x24')](_0x420dab[_0x3ce7('0x1e')][_0x3ce7('0x23')],function(_0x561294){return{'model':db[_0x561294[_0x3ce7('0x22')]],'as':_0x561294['as'],'attributes':_0x561294[_0x3ce7('0x21')],'include':_0x561294[_0x3ce7('0x23')]?_[_0x3ce7('0x24')](_0x561294[_0x3ce7('0x23')],function(_0x30e06f){return{'model':db[_0x30e06f[_0x3ce7('0x22')]],'as':_0x30e06f['as'],'attributes':_0x30e06f['attributes'],'include':_0x30e06f[_0x3ce7('0x23')]?_[_0x3ce7('0x24')](_0x30e06f[_0x3ce7('0x23')],function(_0x480732){return{'model':db[_0x480732[_0x3ce7('0x22')]],'as':_0x480732['as'],'attributes':_0x480732[_0x3ce7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3ce7('0x11')](function(_0xdccec6){logger[_0x3ce7('0x12')]('ShowOpenchannelQueue',_0x420dab);logger['debug'](_0x3ce7('0x26'),_0x420dab,JSON[_0x3ce7('0x16')](_0xdccec6));_0x45b660(_0xdccec6);})['catch'](function(_0x511a3a){logger[_0x3ce7('0x17')](_0x3ce7('0x26'),_0x511a3a[_0x3ce7('0x19')],_0x420dab);_0x5a1fe3(_0x5eb04d[_0x3ce7('0x17')](0x1f4,_0x511a3a[_0x3ce7('0x19')]));});});}; \ No newline at end of file +var _0x28ef=['info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','map','include','model','find','ShowOpenchannelQueue','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','http','defaults','redis','localhost','./openchannelQueue.socket','register','request','then'];(function(_0x1503ac,_0x5d7ad5){var _0x3183e1=function(_0x3d8650){while(--_0x3d8650){_0x1503ac['push'](_0x1503ac['shift']());}};_0x3183e1(++_0x5d7ad5);}(_0x28ef,0x7a));var _0xf28e=function(_0x217c84,_0x45539f){_0x217c84=_0x217c84-0x0;var _0x8d46de=_0x28ef[_0x217c84];return _0x8d46de;};'use strict';var _=require('lodash');var util=require(_0xf28e('0x0'));var moment=require('moment');var BPromise=require(_0xf28e('0x1'));var rs=require(_0xf28e('0x2'));var fs=require('fs');var Redis=require(_0xf28e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf28e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf28e('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf28e('0x6')]({'port':0x232a});config['redis']=_[_0xf28e('0x7')](config[_0xf28e('0x8')],{'host':_0xf28e('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf28e('0x8')]));require(_0xf28e('0xa'))[_0xf28e('0xb')](socket);function respondWithRpcPromise(_0x1a206f,_0x5ee95b,_0x5badd6){return new BPromise(function(_0x488f98,_0x52243e){return client[_0xf28e('0xc')](_0x1a206f,_0x5badd6)[_0xf28e('0xd')](function(_0x2d1c8f){logger[_0xf28e('0xe')](_0xf28e('0xf'),_0x5ee95b,_0xf28e('0x10'));logger[_0xf28e('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5ee95b,_0xf28e('0x10'),JSON[_0xf28e('0x12')](_0x2d1c8f));if(_0x2d1c8f[_0xf28e('0x13')]){if(_0x2d1c8f['error']['code']===0x1f4){logger[_0xf28e('0x13')](_0xf28e('0xf'),_0x5ee95b,_0x2d1c8f[_0xf28e('0x13')][_0xf28e('0x14')]);return _0x52243e(_0x2d1c8f[_0xf28e('0x13')]['message']);}logger['error'](_0xf28e('0xf'),_0x5ee95b,_0x2d1c8f[_0xf28e('0x13')][_0xf28e('0x14')]);return _0x488f98(_0x2d1c8f['error'][_0xf28e('0x14')]);}else{logger['info'](_0xf28e('0xf'),_0x5ee95b,_0xf28e('0x10'));_0x488f98(_0x2d1c8f['result']['message']);}})[_0xf28e('0x15')](function(_0x5cf98e){logger[_0xf28e('0x13')](_0xf28e('0xf'),_0x5ee95b,_0x5cf98e);_0x52243e(_0x5cf98e);});});}exports[_0xf28e('0x16')]=function(_0x43df03){var _0x306437=this;return new Promise(function(_0x1450b2,_0x1e1557){return db[_0xf28e('0x17')]['findAll']({'raw':_0x43df03[_0xf28e('0x18')]?_0x43df03[_0xf28e('0x18')][_0xf28e('0x19')]===undefined?!![]:![]:!![],'where':_0x43df03[_0xf28e('0x18')]?_0x43df03[_0xf28e('0x18')][_0xf28e('0x1a')]||null:null,'attributes':_0x43df03[_0xf28e('0x18')]?_0x43df03[_0xf28e('0x18')][_0xf28e('0x1b')]||null:null,'limit':_0x43df03['options']?_0x43df03[_0xf28e('0x18')][_0xf28e('0x1c')]||null:null,'include':_0x43df03[_0xf28e('0x18')]?_0x43df03[_0xf28e('0x18')]['include']?_[_0xf28e('0x1d')](_0x43df03['options'][_0xf28e('0x1e')],function(_0xe85b94){return{'model':db[_0xe85b94['model']],'as':_0xe85b94['as'],'attributes':_0xe85b94[_0xf28e('0x1b')],'include':_0xe85b94[_0xf28e('0x1e')]?_[_0xf28e('0x1d')](_0xe85b94[_0xf28e('0x1e')],function(_0x172f31){return{'model':db[_0x172f31[_0xf28e('0x1f')]],'as':_0x172f31['as'],'attributes':_0x172f31[_0xf28e('0x1b')],'include':_0x172f31[_0xf28e('0x1e')]?_[_0xf28e('0x1d')](_0x172f31[_0xf28e('0x1e')],function(_0x93fa46){return{'model':db[_0x93fa46['model']],'as':_0x93fa46['as'],'attributes':_0x93fa46[_0xf28e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf28e('0xd')](function(_0x3cae2a){logger[_0xf28e('0xe')](_0xf28e('0x16'),_0x43df03);logger['debug'](_0xf28e('0x16'),_0x43df03,JSON['stringify'](_0x3cae2a));_0x1450b2(_0x3cae2a);})['catch'](function(_0xca4931){logger[_0xf28e('0x13')](_0xf28e('0x16'),_0xca4931[_0xf28e('0x14')],_0x43df03);_0x1e1557(_0x306437[_0xf28e('0x13')](0x1f4,_0xca4931[_0xf28e('0x14')]));});});};exports['ShowOpenchannelQueue']=function(_0x19eee0){var _0x403992=this;return new Promise(function(_0x57d67f,_0x450214){return db[_0xf28e('0x17')][_0xf28e('0x20')]({'raw':_0x19eee0['options']?_0x19eee0['options'][_0xf28e('0x19')]===undefined?!![]:![]:!![],'where':_0x19eee0[_0xf28e('0x18')]?_0x19eee0[_0xf28e('0x18')][_0xf28e('0x1a')]||null:null,'attributes':_0x19eee0['options']?_0x19eee0['options'][_0xf28e('0x1b')]||null:null,'include':_0x19eee0[_0xf28e('0x18')]?_0x19eee0[_0xf28e('0x18')]['include']?_[_0xf28e('0x1d')](_0x19eee0[_0xf28e('0x18')][_0xf28e('0x1e')],function(_0x82cb05){return{'model':db[_0x82cb05[_0xf28e('0x1f')]],'as':_0x82cb05['as'],'attributes':_0x82cb05['attributes'],'include':_0x82cb05['include']?_['map'](_0x82cb05['include'],function(_0x3e6101){return{'model':db[_0x3e6101[_0xf28e('0x1f')]],'as':_0x3e6101['as'],'attributes':_0x3e6101['attributes'],'include':_0x3e6101[_0xf28e('0x1e')]?_[_0xf28e('0x1d')](_0x3e6101[_0xf28e('0x1e')],function(_0x3d591a){return{'model':db[_0x3d591a[_0xf28e('0x1f')]],'as':_0x3d591a['as'],'attributes':_0x3d591a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ccaa5){logger[_0xf28e('0xe')]('ShowOpenchannelQueue',_0x19eee0);logger[_0xf28e('0x11')](_0xf28e('0x21'),_0x19eee0,JSON[_0xf28e('0x12')](_0x5ccaa5));_0x57d67f(_0x5ccaa5);})[_0xf28e('0x15')](function(_0x5cec8e){logger[_0xf28e('0x13')]('ShowOpenchannelQueue',_0x5cec8e[_0xf28e('0x14')],_0x19eee0);_0x450214(_0x403992[_0xf28e('0x13')](0x1f4,_0x5cec8e[_0xf28e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index da54c1b..379a816 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 _0x2cf4=['emit','register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0xa6f516,_0x5a541b){var _0x37cae2=function(_0x5a2a6a){while(--_0x5a2a6a){_0xa6f516['push'](_0xa6f516['shift']());}};_0x37cae2(++_0x5a541b);}(_0x2cf4,0xac));var _0x42cf=function(_0x421e36,_0x18776e){_0x421e36=_0x421e36-0x0;var _0x20b3e3=_0x2cf4[_0x421e36];return _0x20b3e3;};'use strict';var OpenchannelQueueEvents=require(_0x42cf('0x0'));var events=[_0x42cf('0x1'),_0x42cf('0x2'),'update'];function createListener(_0x1526d1,_0x86a3){return function(_0x4f6d94){_0x86a3[_0x42cf('0x3')](_0x1526d1,_0x4f6d94);};}function removeListener(_0x2fc699,_0x256574){return function(){OpenchannelQueueEvents['removeListener'](_0x2fc699,_0x256574);};}exports[_0x42cf('0x4')]=function(_0x2b2ea6){for(var _0x4ba0c4=0x0,_0x464560=events[_0x42cf('0x5')];_0x4ba0c4<_0x464560;_0x4ba0c4++){var _0x289752=events[_0x4ba0c4];var _0xf44568=createListener(_0x42cf('0x6')+_0x289752,_0x2b2ea6);OpenchannelQueueEvents['on'](_0x289752,_0xf44568);}}; \ No newline at end of file +var _0x0dd6=['remove','update','emit','removeListener','register','openchannelQueue:','./openchannelQueue.events'];(function(_0x55e7fc,_0x415229){var _0x4b7604=function(_0x3aa945){while(--_0x3aa945){_0x55e7fc['push'](_0x55e7fc['shift']());}};_0x4b7604(++_0x415229);}(_0x0dd6,0x7d));var _0x60dd=function(_0x2fffff,_0x415518){_0x2fffff=_0x2fffff-0x0;var _0x4f2a2c=_0x0dd6[_0x2fffff];return _0x4f2a2c;};'use strict';var OpenchannelQueueEvents=require(_0x60dd('0x0'));var events=['save',_0x60dd('0x1'),_0x60dd('0x2')];function createListener(_0x46f6e9,_0x49a6e0){return function(_0x2ffff0){_0x49a6e0[_0x60dd('0x3')](_0x46f6e9,_0x2ffff0);};}function removeListener(_0x5607ef,_0x2e7192){return function(){OpenchannelQueueEvents[_0x60dd('0x4')](_0x5607ef,_0x2e7192);};}exports[_0x60dd('0x5')]=function(_0x5bd13a){for(var _0xc24bf6=0x0,_0x19f97e=events['length'];_0xc24bf6<_0x19f97e;_0xc24bf6++){var _0x1d69ca=events[_0xc24bf6];var _0x1a5f44=createListener(_0x60dd('0x6')+_0x1d69ca,_0x5bd13a);OpenchannelQueueEvents['on'](_0x1d69ca,_0x1a5f44);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 1868253..f97840c 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 _0x3cc9=['put','delete','destroy','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x5b5977,_0x47ca7d){var _0x361510=function(_0x33e110){while(--_0x33e110){_0x5b5977['push'](_0x5b5977['shift']());}};_0x361510(++_0x47ca7d);}(_0x3cc9,0x82));var _0x93cc=function(_0x225735,_0x14814e){_0x225735=_0x225735-0x0;var _0x2fa441=_0x3cc9[_0x225735];return _0x2fa441;};'use strict';var multer=require('multer');var util=require(_0x93cc('0x0'));var path=require(_0x93cc('0x1'));var timeout=require(_0x93cc('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x93cc('0x3'));var config=require(_0x93cc('0x4'));var controller=require('./openchannelQueueReport.controller');router[_0x93cc('0x5')]('/',auth[_0x93cc('0x6')](),controller[_0x93cc('0x7')]);router['get'](_0x93cc('0x8'),auth[_0x93cc('0x6')](),controller[_0x93cc('0x9')]);router[_0x93cc('0x5')](_0x93cc('0xa'),auth[_0x93cc('0x6')](),controller[_0x93cc('0xb')]);router[_0x93cc('0xc')]('/',auth[_0x93cc('0x6')](),controller[_0x93cc('0xd')]);router[_0x93cc('0xe')](_0x93cc('0xa'),auth[_0x93cc('0x6')](),controller['update']);router[_0x93cc('0xf')](_0x93cc('0xa'),auth[_0x93cc('0x6')](),controller[_0x93cc('0x10')]);module[_0x93cc('0x11')]=router; \ No newline at end of file +var _0x2e95=['./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','delete','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x520612,_0x112776){var _0x386075=function(_0x54a77f){while(--_0x54a77f){_0x520612['push'](_0x520612['shift']());}};_0x386075(++_0x112776);}(_0x2e95,0x13e));var _0x52e9=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0x2e95[_0x421cf8];return _0x145c48;};'use strict';var multer=require('multer');var util=require(_0x52e9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x52e9('0x1'));var router=express[_0x52e9('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x52e9('0x3'));var config=require(_0x52e9('0x4'));var controller=require(_0x52e9('0x5'));router['get']('/',auth[_0x52e9('0x6')](),controller[_0x52e9('0x7')]);router[_0x52e9('0x8')](_0x52e9('0x9'),auth[_0x52e9('0x6')](),controller[_0x52e9('0xa')]);router[_0x52e9('0x8')](_0x52e9('0xb'),auth['isAuthenticated'](),controller[_0x52e9('0xc')]);router['post']('/',auth[_0x52e9('0x6')](),controller[_0x52e9('0xd')]);router['put'](_0x52e9('0xb'),auth[_0x52e9('0x6')](),controller['update']);router[_0x52e9('0xe')](_0x52e9('0xb'),auth['isAuthenticated'](),controller[_0x52e9('0xf')]);module[_0x52e9('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 ffa38ce..dc155a2 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 _0xe614=['moment','STRING','DATE'];(function(_0x3e15c2,_0x1a805a){var _0x357e55=function(_0x1d104f){while(--_0x1d104f){_0x3e15c2['push'](_0x3e15c2['shift']());}};_0x357e55(++_0x1a805a);}(_0xe614,0x192));var _0x4e61=function(_0x3ada25,_0x330cba){_0x3ada25=_0x3ada25-0x0;var _0x58a078=_0xe614[_0x3ada25];return _0x58a078;};'use strict';var moment=require(_0x4e61('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4e61('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4e61('0x1')]},'joinAt':{'type':Sequelize[_0x4e61('0x2')]},'leaveAt':{'type':Sequelize[_0x4e61('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4e61('0x2')]},'reason':{'type':Sequelize[_0x4e61('0x1')]}}; \ No newline at end of file +var _0xc1ff=['moment','sequelize','exports','STRING','DATE'];(function(_0x2824b8,_0x1fe599){var _0x16913a=function(_0x107149){while(--_0x107149){_0x2824b8['push'](_0x2824b8['shift']());}};_0x16913a(++_0x1fe599);}(_0xc1ff,0x1c2));var _0xfc1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1ff[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xfc1f('0x0'));var Sequelize=require(_0xfc1f('0x1'));module[_0xfc1f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xfc1f('0x3')]},'joinAt':{'type':Sequelize[_0xfc1f('0x4')]},'leaveAt':{'type':Sequelize[_0xfc1f('0x4')]},'acceptAt':{'type':Sequelize[_0xfc1f('0x4')]},'exitAt':{'type':Sequelize[_0xfc1f('0x4')]},'reason':{'type':Sequelize[_0xfc1f('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index cbfdd6d..738867e 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 _0xe16a=['rawAttributes','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelQueueReport','count','includeAll','include','findAll','rows','params'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0xe16a,0x122));var _0xae16=function(_0x473f81,_0x76c1b3){_0x473f81=_0x473f81-0x0;var _0x5877a8=_0xe16a[_0x473f81];return _0x5877a8;};'use strict';var pdf=require(_0xae16('0x0'));var emlformat=require(_0xae16('0x1'));var rimraf=require(_0xae16('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae16('0x3'));var rp=require(_0xae16('0x4'));var moment=require(_0xae16('0x5'));var BPromise=require(_0xae16('0x6'));var Mustache=require(_0xae16('0x7'));var util=require('util');var path=require(_0xae16('0x8'));var sox=require(_0xae16('0x9'));var csv=require(_0xae16('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xae16('0xb'));var squel=require('squel');var crypto=require(_0xae16('0xc'));var jsforce=require(_0xae16('0xd'));var deskjs=require(_0xae16('0xe'));var toCsv=require(_0xae16('0xa'));var querystring=require(_0xae16('0xf'));var Papa=require(_0xae16('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xae16('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xae16('0x12'));var db=require(_0xae16('0x13'))['db'];function respondWithStatusCode(_0x305c5c,_0x6c34ed){_0x6c34ed=_0x6c34ed||0xcc;return function(_0x4b4f73){if(_0x4b4f73){return _0x305c5c[_0xae16('0x14')](_0x6c34ed);}return _0x305c5c[_0xae16('0x15')](_0x6c34ed)['end']();};}function respondWithResult(_0x7b104a,_0x4e2302){_0x4e2302=_0x4e2302||0xc8;return function(_0x502686){if(_0x502686){return _0x7b104a[_0xae16('0x15')](_0x4e2302)[_0xae16('0x16')](_0x502686);}};}function respondWithFilteredResult(_0x11c428,_0x584879){return function(_0x4483d4){if(_0x4483d4){var _0x1c847d=_0x4483d4['count'],_0x347e6f=_0x584879[_0xae16('0x17')],_0x194469=_0x584879[_0xae16('0x17')]+_0x584879[_0xae16('0x18')],_0x695a27;if(_0x194469>=_0x1c847d){_0x194469=_0x1c847d;_0x695a27=0xc8;}else{_0x695a27=0xce;}_0x11c428[_0xae16('0x15')](_0x695a27);return _0x11c428[_0xae16('0x19')](_0xae16('0x1a'),_0x347e6f+'-'+_0x194469+'/'+_0x1c847d)['json'](_0x4483d4);}return null;};}function patchUpdates(_0x9099d0){return function(_0xc9441c){try{jsonpatch['apply'](_0xc9441c,_0x9099d0,!![]);}catch(_0x3f773a){return BPromise[_0xae16('0x1b')](_0x3f773a);}return _0xc9441c['save']();};}function saveUpdates(_0x2afd02,_0x268823){return function(_0xfbf99f){if(_0xfbf99f){return _0xfbf99f[_0xae16('0x1c')](_0x2afd02)[_0xae16('0x1d')](function(_0x4de06c){return _0x4de06c;});}return null;};}function removeEntity(_0x2b4e19,_0x487951){return function(_0xecd816){if(_0xecd816){return _0xecd816[_0xae16('0x1e')]()['then'](function(){_0x2b4e19[_0xae16('0x15')](0xcc)[_0xae16('0x1f')]();});}};}function handleEntityNotFound(_0x4dcdea,_0xbf4f6a){return function(_0x319a0c){if(!_0x319a0c){_0x4dcdea['sendStatus'](0x194);}return _0x319a0c;};}function handleError(_0x1d721f,_0x56ab00){_0x56ab00=_0x56ab00||0x1f4;return function(_0x2b5fcf){logger[_0xae16('0x20')](_0x2b5fcf[_0xae16('0x21')]);if(_0x2b5fcf[_0xae16('0x22')]){delete _0x2b5fcf[_0xae16('0x22')];}_0x1d721f[_0xae16('0x15')](_0x56ab00)[_0xae16('0x23')](_0x2b5fcf);};}exports[_0xae16('0x24')]=function(_0x503c29,_0x2de15e){var _0x1f20bb={},_0x44bd89={},_0x16e58f={'count':0x0,'rows':[]};var _0xe7fe68=_[_0xae16('0x25')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x55e05f){return{'name':_0x55e05f[_0xae16('0x26')],'type':_0x55e05f[_0xae16('0x27')][_0xae16('0x28')]};});_0x44bd89[_0xae16('0x29')]=_['map'](_0xe7fe68,_0xae16('0x22'));_0x44bd89[_0xae16('0x2a')]=_[_0xae16('0x2b')](_0x503c29[_0xae16('0x2a')]);_0x44bd89[_0xae16('0x2c')]=_[_0xae16('0x2d')](_0x44bd89[_0xae16('0x29')],_0x44bd89[_0xae16('0x2a')]);_0x1f20bb['attributes']=_[_0xae16('0x2d')](_0x44bd89[_0xae16('0x29')],qs[_0xae16('0x2e')](_0x503c29[_0xae16('0x2a')][_0xae16('0x2e')]));_0x1f20bb[_0xae16('0x2f')]=_0x1f20bb[_0xae16('0x2f')][_0xae16('0x30')]?_0x1f20bb[_0xae16('0x2f')]:_0x44bd89['model'];if(!_0x503c29[_0xae16('0x2a')][_0xae16('0x31')]('nolimit')){_0x1f20bb[_0xae16('0x18')]=qs[_0xae16('0x18')](_0x503c29['query'][_0xae16('0x18')]);_0x1f20bb[_0xae16('0x17')]=qs[_0xae16('0x17')](_0x503c29[_0xae16('0x2a')][_0xae16('0x17')]);}_0x1f20bb[_0xae16('0x32')]=qs[_0xae16('0x33')](_0x503c29[_0xae16('0x2a')][_0xae16('0x33')]);_0x1f20bb['where']=qs[_0xae16('0x2c')](_[_0xae16('0x34')](_0x503c29[_0xae16('0x2a')],_0x44bd89['filters']),_0xe7fe68);if(_0x503c29['query'][_0xae16('0x35')]){_0x1f20bb[_0xae16('0x36')]=_[_0xae16('0x37')](_0x1f20bb[_0xae16('0x36')],{'$or':_[_0xae16('0x25')](_0xe7fe68,function(_0x4e1c71){if(_0x4e1c71[_0xae16('0x27')]!==_0xae16('0x38')){var _0x1feaa2={};_0x1feaa2[_0x4e1c71['name']]={'$like':'%'+_0x503c29[_0xae16('0x2a')][_0xae16('0x35')]+'%'};return _0x1feaa2;}})});}_0x1f20bb=_['merge']({},_0x1f20bb,_0x503c29[_0xae16('0x39')]);var _0x48f496={'where':_0x1f20bb['where']};return db[_0xae16('0x3a')]['count'](_0x48f496)[_0xae16('0x1d')](function(_0x352668){_0x16e58f[_0xae16('0x3b')]=_0x352668;if(_0x503c29['query'][_0xae16('0x3c')]){_0x1f20bb[_0xae16('0x3d')]=[{'all':!![]}];}return db[_0xae16('0x3a')][_0xae16('0x3e')](_0x1f20bb);})[_0xae16('0x1d')](function(_0x5dbcf3){_0x16e58f[_0xae16('0x3f')]=_0x5dbcf3;return _0x16e58f;})[_0xae16('0x1d')](respondWithFilteredResult(_0x2de15e,_0x1f20bb))['catch'](handleError(_0x2de15e,null));};exports['show']=function(_0x3c58eb,_0x74fbd2){var _0x4e1038={'raw':!![],'where':{'id':_0x3c58eb[_0xae16('0x40')]['id']}},_0x34b282={};_0x34b282['model']=_[_0xae16('0x2b')](db[_0xae16('0x3a')][_0xae16('0x41')]);_0x34b282[_0xae16('0x2a')]=_[_0xae16('0x2b')](_0x3c58eb[_0xae16('0x2a')]);_0x34b282[_0xae16('0x2c')]=_[_0xae16('0x2d')](_0x34b282[_0xae16('0x29')],_0x34b282[_0xae16('0x2a')]);_0x4e1038['attributes']=_['intersection'](_0x34b282[_0xae16('0x29')],qs[_0xae16('0x2e')](_0x3c58eb[_0xae16('0x2a')][_0xae16('0x2e')]));_0x4e1038[_0xae16('0x2f')]=_0x4e1038['attributes']['length']?_0x4e1038[_0xae16('0x2f')]:_0x34b282[_0xae16('0x29')];if(_0x3c58eb[_0xae16('0x2a')][_0xae16('0x3c')]){_0x4e1038[_0xae16('0x3d')]=[{'all':!![]}];}_0x4e1038=_[_0xae16('0x37')]({},_0x4e1038,_0x3c58eb[_0xae16('0x39')]);return db[_0xae16('0x3a')][_0xae16('0x42')](_0x4e1038)[_0xae16('0x1d')](handleEntityNotFound(_0x74fbd2,null))[_0xae16('0x1d')](respondWithResult(_0x74fbd2,null))[_0xae16('0x43')](handleError(_0x74fbd2,null));};exports[_0xae16('0x44')]=function(_0x5da44e,_0x47b0f4){return db[_0xae16('0x3a')][_0xae16('0x44')](_0x5da44e['body'],{})[_0xae16('0x1d')](respondWithResult(_0x47b0f4,0xc9))['catch'](handleError(_0x47b0f4,null));};exports[_0xae16('0x1c')]=function(_0xee4816,_0xe6ce1b){if(_0xee4816[_0xae16('0x45')]['id']){delete _0xee4816[_0xae16('0x45')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0xee4816['params']['id']}})[_0xae16('0x1d')](handleEntityNotFound(_0xe6ce1b,null))[_0xae16('0x1d')](saveUpdates(_0xee4816['body'],null))[_0xae16('0x1d')](respondWithResult(_0xe6ce1b,null))[_0xae16('0x43')](handleError(_0xe6ce1b,null));};exports[_0xae16('0x1e')]=function(_0x2ac26b,_0x5ea553){return db[_0xae16('0x3a')]['find']({'where':{'id':_0x2ac26b[_0xae16('0x40')]['id']}})[_0xae16('0x1d')](handleEntityNotFound(_0x5ea553,null))[_0xae16('0x1d')](removeEntity(_0x5ea553,null))['catch'](handleError(_0x5ea553,null));};exports['describe']=function(_0x57d952,_0x3593f7){return db['OpenchannelQueueReport'][_0xae16('0x46')]()['then'](respondWithResult(_0x3593f7,null))[_0xae16('0x43')](handleError(_0x3593f7,null));}; \ No newline at end of file +var _0xae75=['jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','apply','reject','update','then','destroy','end','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','limit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x49f765,_0x15d520){var _0x2cceb7=function(_0x149fd3){while(--_0x149fd3){_0x49f765['push'](_0x49f765['shift']());}};_0x2cceb7(++_0x15d520);}(_0xae75,0xce));var _0x5ae7=function(_0x188097,_0x198463){_0x188097=_0x188097-0x0;var _0x3566f1=_0xae75[_0x188097];return _0x3566f1;};'use strict';var pdf=require(_0x5ae7('0x0'));var emlformat=require(_0x5ae7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5ae7('0x2'));var jsonpatch=require(_0x5ae7('0x3'));var rp=require(_0x5ae7('0x4'));var moment=require(_0x5ae7('0x5'));var BPromise=require(_0x5ae7('0x6'));var Mustache=require(_0x5ae7('0x7'));var util=require(_0x5ae7('0x8'));var path=require(_0x5ae7('0x9'));var sox=require(_0x5ae7('0xa'));var csv=require(_0x5ae7('0xb'));var ejs=require(_0x5ae7('0xc'));var fs=require('fs');var _=require(_0x5ae7('0xd'));var squel=require(_0x5ae7('0xe'));var crypto=require(_0x5ae7('0xf'));var jsforce=require(_0x5ae7('0x10'));var deskjs=require(_0x5ae7('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5ae7('0x12'));var Papa=require(_0x5ae7('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5ae7('0x14'));var as=require(_0x5ae7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ae7('0x16'))('api');var utils=require(_0x5ae7('0x17'));var config=require('../../config/environment');var db=require(_0x5ae7('0x18'))['db'];function respondWithStatusCode(_0x3c4e78,_0x13c028){_0x13c028=_0x13c028||0xcc;return function(_0x111069){if(_0x111069){return _0x3c4e78[_0x5ae7('0x19')](_0x13c028);}return _0x3c4e78[_0x5ae7('0x1a')](_0x13c028)['end']();};}function respondWithResult(_0x3751b2,_0xc761fd){_0xc761fd=_0xc761fd||0xc8;return function(_0x4cd96c){if(_0x4cd96c){return _0x3751b2[_0x5ae7('0x1a')](_0xc761fd)[_0x5ae7('0x1b')](_0x4cd96c);}};}function respondWithFilteredResult(_0x3212d1,_0x3144f9){return function(_0xf5322e){if(_0xf5322e){var _0x2e35e1=_0xf5322e[_0x5ae7('0x1c')],_0x31951e=_0x3144f9['offset'],_0x2236b3=_0x3144f9['offset']+_0x3144f9['limit'],_0x53266d;if(_0x2236b3>=_0x2e35e1){_0x2236b3=_0x2e35e1;_0x53266d=0xc8;}else{_0x53266d=0xce;}_0x3212d1[_0x5ae7('0x1a')](_0x53266d);return _0x3212d1['set']('Content-Range',_0x31951e+'-'+_0x2236b3+'/'+_0x2e35e1)['json'](_0xf5322e);}return null;};}function patchUpdates(_0x558b3e){return function(_0xdca84){try{jsonpatch[_0x5ae7('0x1d')](_0xdca84,_0x558b3e,!![]);}catch(_0x1db886){return BPromise[_0x5ae7('0x1e')](_0x1db886);}return _0xdca84['save']();};}function saveUpdates(_0x35a7a5,_0x3d2a70){return function(_0x29951a){if(_0x29951a){return _0x29951a[_0x5ae7('0x1f')](_0x35a7a5)[_0x5ae7('0x20')](function(_0x23b4e9){return _0x23b4e9;});}return null;};}function removeEntity(_0xd3c34c,_0x2e7a72){return function(_0x4084d3){if(_0x4084d3){return _0x4084d3[_0x5ae7('0x21')]()[_0x5ae7('0x20')](function(){_0xd3c34c[_0x5ae7('0x1a')](0xcc)[_0x5ae7('0x22')]();});}};}function handleEntityNotFound(_0x4d5207,_0x2a7976){return function(_0x1fb6c3){if(!_0x1fb6c3){_0x4d5207[_0x5ae7('0x19')](0x194);}return _0x1fb6c3;};}function handleError(_0x3e0e72,_0x2b0649){_0x2b0649=_0x2b0649||0x1f4;return function(_0x5cac2d){logger[_0x5ae7('0x23')](_0x5cac2d[_0x5ae7('0x24')]);if(_0x5cac2d[_0x5ae7('0x25')]){delete _0x5cac2d[_0x5ae7('0x25')];}_0x3e0e72[_0x5ae7('0x1a')](_0x2b0649)['send'](_0x5cac2d);};}exports[_0x5ae7('0x26')]=function(_0x3c8724,_0x5b35bf){var _0x22fe04={},_0x1c0402={},_0x26f71b={'count':0x0,'rows':[]};var _0x3864fd=_[_0x5ae7('0x27')](db[_0x5ae7('0x28')][_0x5ae7('0x29')],function(_0x3f6c46){return{'name':_0x3f6c46[_0x5ae7('0x2a')],'type':_0x3f6c46['type'][_0x5ae7('0x2b')]};});_0x1c0402[_0x5ae7('0x2c')]=_[_0x5ae7('0x27')](_0x3864fd,_0x5ae7('0x25'));_0x1c0402[_0x5ae7('0x2d')]=_[_0x5ae7('0x2e')](_0x3c8724[_0x5ae7('0x2d')]);_0x1c0402['filters']=_['intersection'](_0x1c0402['model'],_0x1c0402[_0x5ae7('0x2d')]);_0x22fe04[_0x5ae7('0x2f')]=_[_0x5ae7('0x30')](_0x1c0402['model'],qs[_0x5ae7('0x31')](_0x3c8724['query'][_0x5ae7('0x31')]));_0x22fe04[_0x5ae7('0x2f')]=_0x22fe04[_0x5ae7('0x2f')][_0x5ae7('0x32')]?_0x22fe04[_0x5ae7('0x2f')]:_0x1c0402[_0x5ae7('0x2c')];if(!_0x3c8724[_0x5ae7('0x2d')]['hasOwnProperty'](_0x5ae7('0x33'))){_0x22fe04['limit']=qs['limit'](_0x3c8724['query'][_0x5ae7('0x34')]);_0x22fe04[_0x5ae7('0x35')]=qs[_0x5ae7('0x35')](_0x3c8724[_0x5ae7('0x2d')]['offset']);}_0x22fe04[_0x5ae7('0x36')]=qs[_0x5ae7('0x37')](_0x3c8724[_0x5ae7('0x2d')][_0x5ae7('0x37')]);_0x22fe04[_0x5ae7('0x38')]=qs[_0x5ae7('0x39')](_[_0x5ae7('0x3a')](_0x3c8724[_0x5ae7('0x2d')],_0x1c0402[_0x5ae7('0x39')]),_0x3864fd);if(_0x3c8724[_0x5ae7('0x2d')][_0x5ae7('0x3b')]){_0x22fe04[_0x5ae7('0x38')]=_[_0x5ae7('0x3c')](_0x22fe04[_0x5ae7('0x38')],{'$or':_['map'](_0x3864fd,function(_0x270b29){if(_0x270b29['type']!==_0x5ae7('0x3d')){var _0x588bc5={};_0x588bc5[_0x270b29['name']]={'$like':'%'+_0x3c8724[_0x5ae7('0x2d')][_0x5ae7('0x3b')]+'%'};return _0x588bc5;}})});}_0x22fe04=_[_0x5ae7('0x3c')]({},_0x22fe04,_0x3c8724[_0x5ae7('0x3e')]);var _0x3b9861={'where':_0x22fe04['where']};return db[_0x5ae7('0x28')][_0x5ae7('0x1c')](_0x3b9861)[_0x5ae7('0x20')](function(_0x351822){_0x26f71b[_0x5ae7('0x1c')]=_0x351822;if(_0x3c8724[_0x5ae7('0x2d')][_0x5ae7('0x3f')]){_0x22fe04[_0x5ae7('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x5ae7('0x41')](_0x22fe04);})[_0x5ae7('0x20')](function(_0x3da282){_0x26f71b[_0x5ae7('0x42')]=_0x3da282;return _0x26f71b;})[_0x5ae7('0x20')](respondWithFilteredResult(_0x5b35bf,_0x22fe04))[_0x5ae7('0x43')](handleError(_0x5b35bf,null));};exports[_0x5ae7('0x44')]=function(_0x5cbb5e,_0x2174a6){var _0x4f8469={'raw':!![],'where':{'id':_0x5cbb5e[_0x5ae7('0x45')]['id']}},_0x3b0285={};_0x3b0285[_0x5ae7('0x2c')]=_[_0x5ae7('0x2e')](db[_0x5ae7('0x28')][_0x5ae7('0x29')]);_0x3b0285[_0x5ae7('0x2d')]=_[_0x5ae7('0x2e')](_0x5cbb5e[_0x5ae7('0x2d')]);_0x3b0285[_0x5ae7('0x39')]=_[_0x5ae7('0x30')](_0x3b0285[_0x5ae7('0x2c')],_0x3b0285[_0x5ae7('0x2d')]);_0x4f8469[_0x5ae7('0x2f')]=_[_0x5ae7('0x30')](_0x3b0285[_0x5ae7('0x2c')],qs[_0x5ae7('0x31')](_0x5cbb5e[_0x5ae7('0x2d')]['fields']));_0x4f8469['attributes']=_0x4f8469[_0x5ae7('0x2f')][_0x5ae7('0x32')]?_0x4f8469['attributes']:_0x3b0285['model'];if(_0x5cbb5e[_0x5ae7('0x2d')][_0x5ae7('0x3f')]){_0x4f8469['include']=[{'all':!![]}];}_0x4f8469=_[_0x5ae7('0x3c')]({},_0x4f8469,_0x5cbb5e[_0x5ae7('0x3e')]);return db[_0x5ae7('0x28')][_0x5ae7('0x46')](_0x4f8469)['then'](handleEntityNotFound(_0x2174a6,null))['then'](respondWithResult(_0x2174a6,null))['catch'](handleError(_0x2174a6,null));};exports[_0x5ae7('0x47')]=function(_0x240123,_0xd7b7a1){return db[_0x5ae7('0x28')]['create'](_0x240123[_0x5ae7('0x48')],{})[_0x5ae7('0x20')](respondWithResult(_0xd7b7a1,0xc9))[_0x5ae7('0x43')](handleError(_0xd7b7a1,null));};exports[_0x5ae7('0x1f')]=function(_0x2db1e6,_0x1b75e8){if(_0x2db1e6[_0x5ae7('0x48')]['id']){delete _0x2db1e6[_0x5ae7('0x48')]['id'];}return db[_0x5ae7('0x28')][_0x5ae7('0x46')]({'where':{'id':_0x2db1e6['params']['id']}})[_0x5ae7('0x20')](handleEntityNotFound(_0x1b75e8,null))[_0x5ae7('0x20')](saveUpdates(_0x2db1e6[_0x5ae7('0x48')],null))[_0x5ae7('0x20')](respondWithResult(_0x1b75e8,null))[_0x5ae7('0x43')](handleError(_0x1b75e8,null));};exports[_0x5ae7('0x21')]=function(_0xb0941b,_0x2a9eca){return db['OpenchannelQueueReport'][_0x5ae7('0x46')]({'where':{'id':_0xb0941b[_0x5ae7('0x45')]['id']}})[_0x5ae7('0x20')](handleEntityNotFound(_0x2a9eca,null))[_0x5ae7('0x20')](removeEntity(_0x2a9eca,null))['catch'](handleError(_0x2a9eca,null));};exports[_0x5ae7('0x49')]=function(_0x3894df,_0x5c6fe0){return db[_0x5ae7('0x28')][_0x5ae7('0x49')]()[_0x5ae7('0x20')](respondWithResult(_0x5c6fe0,null))['catch'](handleError(_0x5c6fe0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 6d4e447..687542a 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 _0xf9e1=['./openchannelQueueReport.attributes','define','OpenchannelQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1aaa22,_0x19d933){var _0xfdd5b4=function(_0x67bd67){while(--_0x67bd67){_0x1aaa22['push'](_0x1aaa22['shift']());}};_0xfdd5b4(++_0x19d933);}(_0xf9e1,0x14e));var _0x1f9e=function(_0x434c45,_0x301993){_0x434c45=_0x434c45-0x0;var _0x39b7b0=_0xf9e1[_0x434c45];return _0x39b7b0;};'use strict';var _=require(_0x1f9e('0x0'));var util=require(_0x1f9e('0x1'));var logger=require('../../config/logger')(_0x1f9e('0x2'));var moment=require(_0x1f9e('0x3'));var BPromise=require(_0x1f9e('0x4'));var rp=require(_0x1f9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1f9e('0x6'));module['exports']=function(_0x5c4d6b,_0x46e743){return _0x5c4d6b[_0x1f9e('0x7')](_0x1f9e('0x8'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1f9e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1342=['./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1342,0x131));var _0x2134=function(_0x3ebd38,_0x459828){_0x3ebd38=_0x3ebd38-0x0;var _0x59d797=_0x1342[_0x3ebd38];return _0x59d797;};'use strict';var _=require(_0x2134('0x0'));var util=require(_0x2134('0x1'));var logger=require(_0x2134('0x2'))(_0x2134('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2134('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2134('0x5'));var config=require(_0x2134('0x6'));var attributes=require(_0x2134('0x7'));module[_0x2134('0x8')]=function(_0xc7200c,_0x2e84c6){return _0xc7200c[_0x2134('0x9')]('OpenchannelQueueReport',attributes,{'tableName':_0x2134('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2134('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index c12050a..2799da7 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 _0xb470=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','OpenchannelQueueReport','options','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug'];(function(_0x2f5fae,_0x555535){var _0x3eb6b8=function(_0xcdf2d6){while(--_0xcdf2d6){_0x2f5fae['push'](_0x2f5fae['shift']());}};_0x3eb6b8(++_0x555535);}(_0xb470,0x75));var _0x0b47=function(_0xd8d1a0,_0x48a454){_0xd8d1a0=_0xd8d1a0-0x0;var _0x13e794=_0xb470[_0xd8d1a0];return _0x13e794;};'use strict';var _=require(_0x0b47('0x0'));var util=require(_0x0b47('0x1'));var moment=require(_0x0b47('0x2'));var BPromise=require(_0x0b47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b47('0x4'));var db=require(_0x0b47('0x5'))['db'];var utils=require(_0x0b47('0x6'));var logger=require('../../config/logger')(_0x0b47('0x7'));var config=require(_0x0b47('0x8'));var jayson=require(_0x0b47('0x9'));var client=jayson[_0x0b47('0xa')][_0x0b47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23d960,_0x201ab2,_0x37eb18){return new BPromise(function(_0x4bfebf,_0x56543c){return client['request'](_0x23d960,_0x37eb18)['then'](function(_0x38523d){logger[_0x0b47('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x201ab2,_0x0b47('0xd'));logger[_0x0b47('0xe')](_0x0b47('0xf'),_0x201ab2,_0x0b47('0xd'),JSON[_0x0b47('0x10')](_0x38523d));if(_0x38523d[_0x0b47('0x11')]){if(_0x38523d[_0x0b47('0x11')][_0x0b47('0x12')]===0x1f4){logger[_0x0b47('0x11')](_0x0b47('0x13'),_0x201ab2,_0x38523d['error']['message']);return _0x56543c(_0x38523d[_0x0b47('0x11')]['message']);}logger[_0x0b47('0x11')](_0x0b47('0x13'),_0x201ab2,_0x38523d['error'][_0x0b47('0x14')]);return _0x4bfebf(_0x38523d[_0x0b47('0x11')][_0x0b47('0x14')]);}else{logger[_0x0b47('0xc')](_0x0b47('0x13'),_0x201ab2,_0x0b47('0xd'));_0x4bfebf(_0x38523d[_0x0b47('0x15')][_0x0b47('0x14')]);}})[_0x0b47('0x16')](function(_0x1da847){logger['error'](_0x0b47('0x13'),_0x201ab2,_0x1da847);_0x56543c(_0x1da847);});});}exports['CreateOpenchannelQueueReport']=function(_0x11f305){var _0x1620fc=this;return new Promise(function(_0x2b1024,_0x478caa){return db[_0x0b47('0x17')]['create'](_0x11f305['body'],{'raw':_0x11f305[_0x0b47('0x18')]?_0x11f305[_0x0b47('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x0b47('0x19')](function(_0x501357){logger[_0x0b47('0xc')](_0x0b47('0x1a'),_0x11f305);logger[_0x0b47('0xe')](_0x0b47('0x1a'),_0x11f305,JSON[_0x0b47('0x10')](_0x501357));_0x2b1024(_0x501357);})[_0x0b47('0x16')](function(_0x3bd7f1){logger[_0x0b47('0x11')](_0x0b47('0x1a'),_0x3bd7f1[_0x0b47('0x14')],_0x11f305);_0x478caa(_0x1620fc[_0x0b47('0x11')](0x1f4,_0x3bd7f1['message']));});});};exports[_0x0b47('0x1b')]=function(_0x11935a){var _0x4e481c=this;return new Promise(function(_0x32559d,_0x2a2287){return db[_0x0b47('0x17')][_0x0b47('0x1c')](_0x11935a['body'],{'raw':_0x11935a['options']?_0x11935a[_0x0b47('0x18')][_0x0b47('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11935a['options']?_0x11935a[_0x0b47('0x18')][_0x0b47('0x1e')]||null:null,'attributes':_0x11935a[_0x0b47('0x18')]?_0x11935a[_0x0b47('0x18')][_0x0b47('0x1f')]||null:null,'limit':_0x11935a[_0x0b47('0x18')]?_0x11935a[_0x0b47('0x18')][_0x0b47('0x20')]||null:null})[_0x0b47('0x19')](function(_0x15d877){logger[_0x0b47('0xc')]('UpdateOpenchannelQueueReport',_0x11935a);logger['debug'](_0x0b47('0x1b'),_0x11935a,JSON['stringify'](_0x15d877));_0x32559d(_0x15d877);})[_0x0b47('0x16')](function(_0x9a2cc1){logger[_0x0b47('0x11')](_0x0b47('0x1b'),_0x9a2cc1[_0x0b47('0x14')],_0x11935a);_0x2a2287(_0x4e481c['error'](0x1f4,_0x9a2cc1[_0x0b47('0x14')]));});});}; \ No newline at end of file +var _0x0424=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','attributes','limit','UpdateOpenchannelQueueReport','moment','bluebird','randomstring'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x0424,0x159));var _0x4042=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0x0424[_0x318dda];return _0x3f97ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['create'](_0x466077[_0x4042('0x17')],{'raw':_0x466077[_0x4042('0x18')]?_0x466077[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xb72021){logger[_0x4042('0x12')](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('CreateOpenchannelQueueReport',_0x466077,JSON[_0x4042('0xf')](_0xb72021));_0xe5c1ec(_0xb72021);})[_0x4042('0x14')](function(_0xd6fe6c){logger[_0x4042('0x10')](_0x4042('0x15'),_0xd6fe6c['message'],_0x466077);_0x4fe024(_0x4b02d4[_0x4042('0x10')](0x1f4,_0xd6fe6c[_0x4042('0x11')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1daee8){var _0x5877d3=this;return new Promise(function(_0x271b82,_0x2c5fcf){return db[_0x4042('0x16')]['update'](_0x1daee8[_0x4042('0x17')],{'raw':_0x1daee8[_0x4042('0x18')]?_0x1daee8[_0x4042('0x18')][_0x4042('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1daee8[_0x4042('0x18')]?_0x1daee8['options']['where']||null:null,'attributes':_0x1daee8[_0x4042('0x18')]?_0x1daee8[_0x4042('0x18')][_0x4042('0x1a')]||null:null,'limit':_0x1daee8[_0x4042('0x18')]?_0x1daee8[_0x4042('0x18')][_0x4042('0x1b')]||null:null})['then'](function(_0x33733b){logger[_0x4042('0x12')]('UpdateOpenchannelQueueReport',_0x1daee8);logger[_0x4042('0xd')](_0x4042('0x1c'),_0x1daee8,JSON[_0x4042('0xf')](_0x33733b));_0x271b82(_0x33733b);})['catch'](function(_0x56d49a){logger[_0x4042('0x10')](_0x4042('0x1c'),_0x56d49a['message'],_0x1daee8);_0x2c5fcf(_0x5877d3[_0x4042('0x10')](0x1f4,_0x56d49a[_0x4042('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 1fc4573..70d2ca0 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(_0x2d994d,_0x168a27){var _0xd54be4=function(_0x1db925){while(--_0x1db925){_0x2d994d['push'](_0x2d994d['shift']());}};_0xd54be4(++_0x168a27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 cf31501..23e8d2c 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 _0xf4de=['exports','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x475359,_0x38636d){var _0x4ab13a=function(_0x152b9c){while(--_0x152b9c){_0x475359['push'](_0x475359['shift']());}};_0x4ab13a(++_0x38636d);}(_0xf4de,0x19f));var _0xef4d=function(_0x4b0d54,_0x32fe9f){_0x4b0d54=_0x4b0d54-0x0;var _0x48cb9b=_0xf4de[_0x4b0d54];return _0x48cb9b;};'use strict';var moment=require(_0xef4d('0x0'));var Sequelize=require('sequelize');module[_0xef4d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xef4d('0x2')](_0xef4d('0x3'),_0xef4d('0x4'),'queue'),'allowNull':![],'defaultValue':_0xef4d('0x5')},'transferredAt':{'type':Sequelize[_0xef4d('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xef4d('0x7')]}}; \ No newline at end of file +var _0x8357=['ENUM','queue','moment','exports'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x8357,0x6a));var _0x7835=function(_0x1632c2,_0x220490){_0x1632c2=_0x1632c2-0x0;var _0x6ee2d3=_0x8357[_0x1632c2];return _0x6ee2d3;};'use strict';var moment=require(_0x7835('0x0'));var Sequelize=require('sequelize');module[_0x7835('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7835('0x2')]('account','agent',_0x7835('0x3')),'allowNull':![],'defaultValue':_0x7835('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c6ecfc7..72b91e9 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 _0xd826=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','update','params','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x53c8ff,_0x145bd9){var _0xe71aba=function(_0x464031){while(--_0x464031){_0x53c8ff['push'](_0x53c8ff['shift']());}};_0xe71aba(++_0x145bd9);}(_0xd826,0xdb));var _0x6d82=function(_0x2fdeda,_0x17d17e){_0x2fdeda=_0x2fdeda-0x0;var _0x50b0d0=_0xd826[_0x2fdeda];return _0x50b0d0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6d82('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d82('0x1'));var rp=require(_0x6d82('0x2'));var moment=require(_0x6d82('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6d82('0x4'));var util=require(_0x6d82('0x5'));var path=require(_0x6d82('0x6'));var sox=require(_0x6d82('0x7'));var csv=require('to-csv');var ejs=require(_0x6d82('0x8'));var fs=require('fs');var _=require(_0x6d82('0x9'));var squel=require('squel');var crypto=require(_0x6d82('0xa'));var jsforce=require(_0x6d82('0xb'));var deskjs=require(_0x6d82('0xc'));var toCsv=require(_0x6d82('0xd'));var querystring=require(_0x6d82('0xe'));var Papa=require(_0x6d82('0xf'));var Redis=require(_0x6d82('0x10'));var authService=require(_0x6d82('0x11'));var qs=require(_0x6d82('0x12'));var as=require(_0x6d82('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d82('0x14'));var utils=require('../../config/utils');var config=require(_0x6d82('0x15'));var db=require(_0x6d82('0x16'))['db'];function respondWithStatusCode(_0x3afe83,_0xebf961){_0xebf961=_0xebf961||0xcc;return function(_0x135ca0){if(_0x135ca0){return _0x3afe83['sendStatus'](_0xebf961);}return _0x3afe83[_0x6d82('0x17')](_0xebf961)[_0x6d82('0x18')]();};}function respondWithResult(_0x125ca2,_0x4ed6ad){_0x4ed6ad=_0x4ed6ad||0xc8;return function(_0x5c7cd6){if(_0x5c7cd6){return _0x125ca2['status'](_0x4ed6ad)[_0x6d82('0x19')](_0x5c7cd6);}};}function respondWithFilteredResult(_0x11cb5c,_0x23ddeb){return function(_0x402051){if(_0x402051){var _0x3896d8=_0x402051['count'],_0x94364d=_0x23ddeb[_0x6d82('0x1a')],_0x1075ac=_0x23ddeb[_0x6d82('0x1a')]+_0x23ddeb[_0x6d82('0x1b')],_0x50f351;if(_0x1075ac>=_0x3896d8){_0x1075ac=_0x3896d8;_0x50f351=0xc8;}else{_0x50f351=0xce;}_0x11cb5c[_0x6d82('0x17')](_0x50f351);return _0x11cb5c[_0x6d82('0x1c')]('Content-Range',_0x94364d+'-'+_0x1075ac+'/'+_0x3896d8)[_0x6d82('0x19')](_0x402051);}return null;};}function patchUpdates(_0x193235){return function(_0x265db5){try{jsonpatch[_0x6d82('0x1d')](_0x265db5,_0x193235,!![]);}catch(_0x4b6e6a){return BPromise[_0x6d82('0x1e')](_0x4b6e6a);}return _0x265db5[_0x6d82('0x1f')]();};}function saveUpdates(_0x46bc0f,_0x479e63){return function(_0x534f46){if(_0x534f46){return _0x534f46['update'](_0x46bc0f)[_0x6d82('0x20')](function(_0xc4e4a9){return _0xc4e4a9;});}return null;};}function removeEntity(_0x9727e6,_0x2842ea){return function(_0x15243a){if(_0x15243a){return _0x15243a[_0x6d82('0x21')]()[_0x6d82('0x20')](function(){_0x9727e6[_0x6d82('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c4642,_0x568871){return function(_0x1797f7){if(!_0x1797f7){_0x4c4642[_0x6d82('0x22')](0x194);}return _0x1797f7;};}function handleError(_0xb38cbe,_0x51e453){_0x51e453=_0x51e453||0x1f4;return function(_0x4d34de){logger[_0x6d82('0x23')](_0x4d34de[_0x6d82('0x24')]);if(_0x4d34de[_0x6d82('0x25')]){delete _0x4d34de['name'];}_0xb38cbe[_0x6d82('0x17')](_0x51e453)[_0x6d82('0x26')](_0x4d34de);};}exports[_0x6d82('0x27')]=function(_0x2e4c5d,_0x1e86b2){var _0x218696={},_0x4920a1={},_0x4a6abb={'count':0x0,'rows':[]};var _0x10c537=_[_0x6d82('0x28')](db[_0x6d82('0x29')][_0x6d82('0x2a')],function(_0x41dde9){return{'name':_0x41dde9[_0x6d82('0x2b')],'type':_0x41dde9[_0x6d82('0x2c')][_0x6d82('0x2d')]};});_0x4920a1[_0x6d82('0x2e')]=_[_0x6d82('0x28')](_0x10c537,'name');_0x4920a1['query']=_[_0x6d82('0x2f')](_0x2e4c5d[_0x6d82('0x30')]);_0x4920a1[_0x6d82('0x31')]=_[_0x6d82('0x32')](_0x4920a1[_0x6d82('0x2e')],_0x4920a1[_0x6d82('0x30')]);_0x218696['attributes']=_[_0x6d82('0x32')](_0x4920a1['model'],qs[_0x6d82('0x33')](_0x2e4c5d[_0x6d82('0x30')][_0x6d82('0x33')]));_0x218696['attributes']=_0x218696[_0x6d82('0x34')]['length']?_0x218696[_0x6d82('0x34')]:_0x4920a1[_0x6d82('0x2e')];if(!_0x2e4c5d[_0x6d82('0x30')][_0x6d82('0x35')](_0x6d82('0x36'))){_0x218696['limit']=qs['limit'](_0x2e4c5d[_0x6d82('0x30')]['limit']);_0x218696['offset']=qs[_0x6d82('0x1a')](_0x2e4c5d['query']['offset']);}_0x218696['order']=qs['sort'](_0x2e4c5d[_0x6d82('0x30')][_0x6d82('0x37')]);_0x218696[_0x6d82('0x38')]=qs['filters'](_[_0x6d82('0x39')](_0x2e4c5d[_0x6d82('0x30')],_0x4920a1[_0x6d82('0x31')]),_0x10c537);if(_0x2e4c5d[_0x6d82('0x30')][_0x6d82('0x3a')]){_0x218696[_0x6d82('0x38')]=_[_0x6d82('0x3b')](_0x218696[_0x6d82('0x38')],{'$or':_[_0x6d82('0x28')](_0x10c537,function(_0x474ac1){if(_0x474ac1[_0x6d82('0x2c')]!==_0x6d82('0x3c')){var _0x19c8fb={};_0x19c8fb[_0x474ac1[_0x6d82('0x25')]]={'$like':'%'+_0x2e4c5d[_0x6d82('0x30')][_0x6d82('0x3a')]+'%'};return _0x19c8fb;}})});}_0x218696=_[_0x6d82('0x3b')]({},_0x218696,_0x2e4c5d['options']);var _0x3b3132={'where':_0x218696['where']};return db[_0x6d82('0x29')][_0x6d82('0x3d')](_0x3b3132)[_0x6d82('0x20')](function(_0x58ba86){_0x4a6abb[_0x6d82('0x3d')]=_0x58ba86;if(_0x2e4c5d[_0x6d82('0x30')][_0x6d82('0x3e')]){_0x218696[_0x6d82('0x3f')]=[{'all':!![]}];}return db[_0x6d82('0x29')][_0x6d82('0x40')](_0x218696);})[_0x6d82('0x20')](function(_0x3d4e3){_0x4a6abb[_0x6d82('0x41')]=_0x3d4e3;return _0x4a6abb;})[_0x6d82('0x20')](respondWithFilteredResult(_0x1e86b2,_0x218696))[_0x6d82('0x42')](handleError(_0x1e86b2,null));};exports[_0x6d82('0x43')]=function(_0x57c329,_0x33a9b0){var _0x1f9811={'raw':!![],'where':{'id':_0x57c329['params']['id']}},_0x15704c={};_0x15704c[_0x6d82('0x2e')]=_[_0x6d82('0x2f')](db[_0x6d82('0x29')][_0x6d82('0x2a')]);_0x15704c[_0x6d82('0x30')]=_[_0x6d82('0x2f')](_0x57c329[_0x6d82('0x30')]);_0x15704c[_0x6d82('0x31')]=_[_0x6d82('0x32')](_0x15704c[_0x6d82('0x2e')],_0x15704c[_0x6d82('0x30')]);_0x1f9811[_0x6d82('0x34')]=_['intersection'](_0x15704c[_0x6d82('0x2e')],qs[_0x6d82('0x33')](_0x57c329[_0x6d82('0x30')][_0x6d82('0x33')]));_0x1f9811['attributes']=_0x1f9811['attributes'][_0x6d82('0x44')]?_0x1f9811['attributes']:_0x15704c[_0x6d82('0x2e')];if(_0x57c329['query'][_0x6d82('0x3e')]){_0x1f9811[_0x6d82('0x3f')]=[{'all':!![]}];}_0x1f9811=_['merge']({},_0x1f9811,_0x57c329[_0x6d82('0x45')]);return db[_0x6d82('0x29')][_0x6d82('0x46')](_0x1f9811)[_0x6d82('0x20')](handleEntityNotFound(_0x33a9b0,null))[_0x6d82('0x20')](respondWithResult(_0x33a9b0,null))[_0x6d82('0x42')](handleError(_0x33a9b0,null));};exports[_0x6d82('0x47')]=function(_0x2a2063,_0x3915bb){return db[_0x6d82('0x29')][_0x6d82('0x47')](_0x2a2063[_0x6d82('0x48')],{})[_0x6d82('0x20')](respondWithResult(_0x3915bb,0xc9))['catch'](handleError(_0x3915bb,null));};exports[_0x6d82('0x49')]=function(_0x4c0302,_0x5f2ede){if(_0x4c0302[_0x6d82('0x48')]['id']){delete _0x4c0302['body']['id'];}return db[_0x6d82('0x29')][_0x6d82('0x46')]({'where':{'id':_0x4c0302[_0x6d82('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5f2ede,null))[_0x6d82('0x20')](saveUpdates(_0x4c0302[_0x6d82('0x48')],null))['then'](respondWithResult(_0x5f2ede,null))[_0x6d82('0x42')](handleError(_0x5f2ede,null));};exports['destroy']=function(_0x1b75db,_0x476c07){return db[_0x6d82('0x29')][_0x6d82('0x46')]({'where':{'id':_0x1b75db[_0x6d82('0x4a')]['id']}})[_0x6d82('0x20')](handleEntityNotFound(_0x476c07,null))['then'](removeEntity(_0x476c07,null))[_0x6d82('0x42')](handleError(_0x476c07,null));};exports['describe']=function(_0x1cd7d8,_0xcfeb6b){return db[_0x6d82('0x29')][_0x6d82('0x4b')]()[_0x6d82('0x20')](respondWithResult(_0xcfeb6b,null))[_0x6d82('0x42')](handleError(_0xcfeb6b,null));}; \ No newline at end of file +var _0x9345=['destroy','error','stack','name','index','map','OpenchannelTransferReport','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x9345,0x6c));var _0x5934=function(_0x59166d,_0x415c2d){_0x59166d=_0x59166d-0x0;var _0x2184e1=_0x9345[_0x59166d];return _0x2184e1;};'use strict';var pdf=require(_0x5934('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5934('0x1'));var zipdir=require(_0x5934('0x2'));var jsonpatch=require(_0x5934('0x3'));var rp=require('request-promise');var moment=require(_0x5934('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5934('0x5'));var util=require(_0x5934('0x6'));var path=require('path');var sox=require(_0x5934('0x7'));var csv=require('to-csv');var ejs=require(_0x5934('0x8'));var fs=require('fs');var _=require(_0x5934('0x9'));var squel=require(_0x5934('0xa'));var crypto=require('crypto');var jsforce=require(_0x5934('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5934('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x5934('0xd'));var as=require(_0x5934('0xe'));var hardwareService=require(_0x5934('0xf'));var logger=require('../../config/logger')(_0x5934('0x10'));var utils=require(_0x5934('0x11'));var config=require(_0x5934('0x12'));var db=require(_0x5934('0x13'))['db'];function respondWithStatusCode(_0x32b939,_0x410e3f){_0x410e3f=_0x410e3f||0xcc;return function(_0x55a4bf){if(_0x55a4bf){return _0x32b939[_0x5934('0x14')](_0x410e3f);}return _0x32b939[_0x5934('0x15')](_0x410e3f)[_0x5934('0x16')]();};}function respondWithResult(_0x5e5037,_0x2b9e84){_0x2b9e84=_0x2b9e84||0xc8;return function(_0x313d2d){if(_0x313d2d){return _0x5e5037[_0x5934('0x15')](_0x2b9e84)[_0x5934('0x17')](_0x313d2d);}};}function respondWithFilteredResult(_0x47c88f,_0x179b48){return function(_0x2d9eb2){if(_0x2d9eb2){var _0x592054=_0x2d9eb2[_0x5934('0x18')],_0x1e59d9=_0x179b48['offset'],_0x20a2c3=_0x179b48[_0x5934('0x19')]+_0x179b48[_0x5934('0x1a')],_0x58652e;if(_0x20a2c3>=_0x592054){_0x20a2c3=_0x592054;_0x58652e=0xc8;}else{_0x58652e=0xce;}_0x47c88f[_0x5934('0x15')](_0x58652e);return _0x47c88f[_0x5934('0x1b')](_0x5934('0x1c'),_0x1e59d9+'-'+_0x20a2c3+'/'+_0x592054)['json'](_0x2d9eb2);}return null;};}function patchUpdates(_0x485eeb){return function(_0x2be7a7){try{jsonpatch[_0x5934('0x1d')](_0x2be7a7,_0x485eeb,!![]);}catch(_0x2aa9f1){return BPromise[_0x5934('0x1e')](_0x2aa9f1);}return _0x2be7a7[_0x5934('0x1f')]();};}function saveUpdates(_0x59d5b2,_0x506ebc){return function(_0x154ad3){if(_0x154ad3){return _0x154ad3[_0x5934('0x20')](_0x59d5b2)[_0x5934('0x21')](function(_0x3b7706){return _0x3b7706;});}return null;};}function removeEntity(_0x30050e,_0x27f30f){return function(_0x21ef3e){if(_0x21ef3e){return _0x21ef3e[_0x5934('0x22')]()[_0x5934('0x21')](function(){_0x30050e[_0x5934('0x15')](0xcc)[_0x5934('0x16')]();});}};}function handleEntityNotFound(_0x332d51,_0xce46e3){return function(_0x435812){if(!_0x435812){_0x332d51[_0x5934('0x14')](0x194);}return _0x435812;};}function handleError(_0x3362c5,_0x566364){_0x566364=_0x566364||0x1f4;return function(_0x2eb616){logger[_0x5934('0x23')](_0x2eb616[_0x5934('0x24')]);if(_0x2eb616[_0x5934('0x25')]){delete _0x2eb616['name'];}_0x3362c5[_0x5934('0x15')](_0x566364)['send'](_0x2eb616);};}exports[_0x5934('0x26')]=function(_0x21ea4e,_0x5a5b7d){var _0x10feb0={},_0x3f218c={},_0x44f5bf={'count':0x0,'rows':[]};var _0x1a259d=_[_0x5934('0x27')](db[_0x5934('0x28')]['rawAttributes'],function(_0x2a8a43){return{'name':_0x2a8a43[_0x5934('0x29')],'type':_0x2a8a43[_0x5934('0x2a')][_0x5934('0x2b')]};});_0x3f218c['model']=_['map'](_0x1a259d,_0x5934('0x25'));_0x3f218c['query']=_[_0x5934('0x2c')](_0x21ea4e['query']);_0x3f218c[_0x5934('0x2d')]=_[_0x5934('0x2e')](_0x3f218c[_0x5934('0x2f')],_0x3f218c[_0x5934('0x30')]);_0x10feb0[_0x5934('0x31')]=_['intersection'](_0x3f218c[_0x5934('0x2f')],qs['fields'](_0x21ea4e['query'][_0x5934('0x32')]));_0x10feb0[_0x5934('0x31')]=_0x10feb0['attributes']['length']?_0x10feb0[_0x5934('0x31')]:_0x3f218c[_0x5934('0x2f')];if(!_0x21ea4e[_0x5934('0x30')]['hasOwnProperty'](_0x5934('0x33'))){_0x10feb0[_0x5934('0x1a')]=qs['limit'](_0x21ea4e[_0x5934('0x30')]['limit']);_0x10feb0['offset']=qs['offset'](_0x21ea4e[_0x5934('0x30')][_0x5934('0x19')]);}_0x10feb0[_0x5934('0x34')]=qs[_0x5934('0x35')](_0x21ea4e[_0x5934('0x30')][_0x5934('0x35')]);_0x10feb0[_0x5934('0x36')]=qs[_0x5934('0x2d')](_[_0x5934('0x37')](_0x21ea4e[_0x5934('0x30')],_0x3f218c[_0x5934('0x2d')]),_0x1a259d);if(_0x21ea4e['query']['filter']){_0x10feb0[_0x5934('0x36')]=_['merge'](_0x10feb0[_0x5934('0x36')],{'$or':_['map'](_0x1a259d,function(_0x162dc2){if(_0x162dc2['type']!==_0x5934('0x38')){var _0x3258fe={};_0x3258fe[_0x162dc2[_0x5934('0x25')]]={'$like':'%'+_0x21ea4e[_0x5934('0x30')]['filter']+'%'};return _0x3258fe;}})});}_0x10feb0=_[_0x5934('0x39')]({},_0x10feb0,_0x21ea4e[_0x5934('0x3a')]);var _0x272cfb={'where':_0x10feb0[_0x5934('0x36')]};return db['OpenchannelTransferReport']['count'](_0x272cfb)[_0x5934('0x21')](function(_0x6bd94f){_0x44f5bf[_0x5934('0x18')]=_0x6bd94f;if(_0x21ea4e[_0x5934('0x30')]['includeAll']){_0x10feb0[_0x5934('0x3b')]=[{'all':!![]}];}return db[_0x5934('0x28')][_0x5934('0x3c')](_0x10feb0);})[_0x5934('0x21')](function(_0x3b26db){_0x44f5bf[_0x5934('0x3d')]=_0x3b26db;return _0x44f5bf;})[_0x5934('0x21')](respondWithFilteredResult(_0x5a5b7d,_0x10feb0))[_0x5934('0x3e')](handleError(_0x5a5b7d,null));};exports[_0x5934('0x3f')]=function(_0x5c4bbb,_0x4effb0){var _0x1c42ae={'raw':!![],'where':{'id':_0x5c4bbb[_0x5934('0x40')]['id']}},_0x23b10b={};_0x23b10b['model']=_[_0x5934('0x2c')](db[_0x5934('0x28')][_0x5934('0x41')]);_0x23b10b[_0x5934('0x30')]=_[_0x5934('0x2c')](_0x5c4bbb[_0x5934('0x30')]);_0x23b10b[_0x5934('0x2d')]=_['intersection'](_0x23b10b[_0x5934('0x2f')],_0x23b10b[_0x5934('0x30')]);_0x1c42ae['attributes']=_[_0x5934('0x2e')](_0x23b10b[_0x5934('0x2f')],qs['fields'](_0x5c4bbb['query']['fields']));_0x1c42ae[_0x5934('0x31')]=_0x1c42ae['attributes'][_0x5934('0x42')]?_0x1c42ae['attributes']:_0x23b10b[_0x5934('0x2f')];if(_0x5c4bbb[_0x5934('0x30')]['includeAll']){_0x1c42ae[_0x5934('0x3b')]=[{'all':!![]}];}_0x1c42ae=_[_0x5934('0x39')]({},_0x1c42ae,_0x5c4bbb[_0x5934('0x3a')]);return db[_0x5934('0x28')]['find'](_0x1c42ae)[_0x5934('0x21')](handleEntityNotFound(_0x4effb0,null))['then'](respondWithResult(_0x4effb0,null))[_0x5934('0x3e')](handleError(_0x4effb0,null));};exports[_0x5934('0x43')]=function(_0x48272b,_0x538674){return db[_0x5934('0x28')][_0x5934('0x43')](_0x48272b[_0x5934('0x44')],{})[_0x5934('0x21')](respondWithResult(_0x538674,0xc9))[_0x5934('0x3e')](handleError(_0x538674,null));};exports[_0x5934('0x20')]=function(_0x1a7b21,_0x16d35a){if(_0x1a7b21[_0x5934('0x44')]['id']){delete _0x1a7b21[_0x5934('0x44')]['id'];}return db['OpenchannelTransferReport'][_0x5934('0x45')]({'where':{'id':_0x1a7b21[_0x5934('0x40')]['id']}})[_0x5934('0x21')](handleEntityNotFound(_0x16d35a,null))[_0x5934('0x21')](saveUpdates(_0x1a7b21[_0x5934('0x44')],null))[_0x5934('0x21')](respondWithResult(_0x16d35a,null))[_0x5934('0x3e')](handleError(_0x16d35a,null));};exports[_0x5934('0x22')]=function(_0x3d8091,_0x4773fc){return db[_0x5934('0x28')][_0x5934('0x45')]({'where':{'id':_0x3d8091[_0x5934('0x40')]['id']}})[_0x5934('0x21')](handleEntityNotFound(_0x4773fc,null))['then'](removeEntity(_0x4773fc,null))[_0x5934('0x3e')](handleError(_0x4773fc,null));};exports[_0x5934('0x46')]=function(_0x151a93,_0x2f5c6d){return db[_0x5934('0x28')][_0x5934('0x46')]()['then'](respondWithResult(_0x2f5c6d,null))[_0x5934('0x3e')](handleError(_0x2f5c6d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d24835b..8b2d170 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 _0xb458=['../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x16ad3e,_0x1ab954){var _0x245c2e=function(_0xd7d9f2){while(--_0xd7d9f2){_0x16ad3e['push'](_0x16ad3e['shift']());}};_0x245c2e(++_0x1ab954);}(_0xb458,0x94));var _0x8b45=function(_0x1d53cd,_0x24bf78){_0x1d53cd=_0x1d53cd-0x0;var _0x3a3bb4=_0xb458[_0x1d53cd];return _0x3a3bb4;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var logger=require(_0x8b45('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8b45('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b45('0x4'));var rimraf=require(_0x8b45('0x5'));var config=require(_0x8b45('0x6'));var attributes=require(_0x8b45('0x7'));module['exports']=function(_0xfe8757,_0xd23b88){return _0xfe8757[_0x8b45('0x8')](_0x8b45('0x9'),attributes,{'tableName':_0x8b45('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc9b=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','exports'];(function(_0x5aa1bd,_0x5597cc){var _0x39660d=function(_0x5a083b){while(--_0x5a083b){_0x5aa1bd['push'](_0x5aa1bd['shift']());}};_0x39660d(++_0x5597cc);}(_0xfc9b,0x74));var _0xbfc9=function(_0x3778c2,_0x1f13ba){_0x3778c2=_0x3778c2-0x0;var _0xe3717a=_0xfc9b[_0x3778c2];return _0xe3717a;};'use strict';var _=require(_0xbfc9('0x0'));var util=require(_0xbfc9('0x1'));var logger=require(_0xbfc9('0x2'))(_0xbfc9('0x3'));var moment=require(_0xbfc9('0x4'));var BPromise=require(_0xbfc9('0x5'));var rp=require(_0xbfc9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfc9('0x7'));var config=require('../../config/environment');var attributes=require(_0xbfc9('0x8'));module[_0xbfc9('0x9')]=function(_0x523ff1,_0x1dbece){return _0x523ff1[_0xbfc9('0xa')](_0xbfc9('0xb'),attributes,{'tableName':_0xbfc9('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbfc9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 04cf639..a14b50d 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 _0xc524=['../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','util','bluebird','ioredis'];(function(_0x3542c5,_0x3425bf){var _0x29f4f4=function(_0x4aa352){while(--_0x4aa352){_0x3542c5['push'](_0x3542c5['shift']());}};_0x29f4f4(++_0x3425bf);}(_0xc524,0x140));var _0x4c52=function(_0x1494d5,_0x22a91c){_0x1494d5=_0x1494d5-0x0;var _0x5c2e77=_0xc524[_0x1494d5];return _0x5c2e77;};'use strict';var _=require('lodash');var util=require(_0x4c52('0x0'));var moment=require('moment');var BPromise=require(_0x4c52('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c52('0x2'));var db=require(_0x4c52('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c52('0x4'))(_0x4c52('0x5'));var config=require('../../config/environment');var jayson=require(_0x4c52('0x6'));var client=jayson['client'][_0x4c52('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ea7ca,_0x16fad1,_0xa9d343){return new BPromise(function(_0x38d640,_0x3f2a67){return client['request'](_0x1ea7ca,_0xa9d343)[_0x4c52('0x8')](function(_0x1d1948){logger[_0x4c52('0x9')](_0x4c52('0xa'),_0x16fad1,'request\x20sent');logger[_0x4c52('0xb')](_0x4c52('0xc'),_0x16fad1,_0x4c52('0xd'),JSON['stringify'](_0x1d1948));if(_0x1d1948['error']){if(_0x1d1948['error'][_0x4c52('0xe')]===0x1f4){logger[_0x4c52('0xf')](_0x4c52('0xa'),_0x16fad1,_0x1d1948['error'][_0x4c52('0x10')]);return _0x3f2a67(_0x1d1948[_0x4c52('0xf')][_0x4c52('0x10')]);}logger[_0x4c52('0xf')](_0x4c52('0xa'),_0x16fad1,_0x1d1948[_0x4c52('0xf')][_0x4c52('0x10')]);return _0x38d640(_0x1d1948['error'][_0x4c52('0x10')]);}else{logger[_0x4c52('0x9')](_0x4c52('0xa'),_0x16fad1,_0x4c52('0xd'));_0x38d640(_0x1d1948[_0x4c52('0x11')]['message']);}})[_0x4c52('0x12')](function(_0x2d9806){logger[_0x4c52('0xf')](_0x4c52('0xa'),_0x16fad1,_0x2d9806);_0x3f2a67(_0x2d9806);});});} \ No newline at end of file +var _0x7c24=['client','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x3b1a38,_0x5ccd3f){var _0x2c1330=function(_0x51fd55){while(--_0x51fd55){_0x3b1a38['push'](_0x3b1a38['shift']());}};_0x2c1330(++_0x5ccd3f);}(_0x7c24,0x186));var _0x47c2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7c24[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x47c2('0x0'));var util=require(_0x47c2('0x1'));var moment=require(_0x47c2('0x2'));var BPromise=require(_0x47c2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47c2('0x4'));var db=require(_0x47c2('0x5'))['db'];var utils=require(_0x47c2('0x6'));var logger=require(_0x47c2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x47c2('0x8'));var client=jayson[_0x47c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x280b64,_0x2d477f,_0x2a2189){return new BPromise(function(_0x186644,_0x241961){return client['request'](_0x280b64,_0x2a2189)[_0x47c2('0xa')](function(_0x11172a){logger['info'](_0x47c2('0xb'),_0x2d477f,'request\x20sent');logger[_0x47c2('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2d477f,_0x47c2('0xd'),JSON[_0x47c2('0xe')](_0x11172a));if(_0x11172a[_0x47c2('0xf')]){if(_0x11172a[_0x47c2('0xf')][_0x47c2('0x10')]===0x1f4){logger[_0x47c2('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d477f,_0x11172a[_0x47c2('0xf')][_0x47c2('0x11')]);return _0x241961(_0x11172a['error']['message']);}logger[_0x47c2('0xf')](_0x47c2('0xb'),_0x2d477f,_0x11172a[_0x47c2('0xf')]['message']);return _0x186644(_0x11172a['error']['message']);}else{logger[_0x47c2('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d477f,_0x47c2('0xd'));_0x186644(_0x11172a[_0x47c2('0x13')][_0x47c2('0x11')]);}})[_0x47c2('0x14')](function(_0x4a3866){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2d477f,_0x4a3866);_0x241961(_0x4a3866);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 78d3fd8..02a25fe 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 _0xe0b0=['isAuthenticated','index','get','/:id','post','put','update','destroy','exports','util','path','Router','../../config/environment'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0xe0b0,0x14e));var _0x0e0b=function(_0x24d920,_0x397122){_0x24d920=_0x24d920-0x0;var _0x1ef779=_0xe0b0[_0x24d920];return _0x1ef779;};'use strict';var multer=require('multer');var util=require(_0x0e0b('0x0'));var path=require(_0x0e0b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e0b('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0e0b('0x3'));var controller=require('./pause.controller');router['get']('/',auth[_0x0e0b('0x4')](),controller[_0x0e0b('0x5')]);router[_0x0e0b('0x6')](_0x0e0b('0x7'),auth[_0x0e0b('0x4')](),controller['show']);router[_0x0e0b('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0e0b('0x9')](_0x0e0b('0x7'),auth['isAuthenticated'](),controller[_0x0e0b('0xa')]);router['delete'](_0x0e0b('0x7'),auth[_0x0e0b('0x4')](),controller[_0x0e0b('0xb')]);module[_0x0e0b('0xc')]=router; \ No newline at end of file +var _0x860a=['./pause.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2a0b56,_0x220ebf){var _0x7274eb=function(_0x1fa51a){while(--_0x1fa51a){_0x2a0b56['push'](_0x2a0b56['shift']());}};_0x7274eb(++_0x220ebf);}(_0x860a,0x19b));var _0xa860=function(_0x3cb36d,_0x1ddc72){_0x3cb36d=_0x3cb36d-0x0;var _0x15ba7b=_0x860a[_0x3cb36d];return _0x15ba7b;};'use strict';var multer=require(_0xa860('0x0'));var util=require(_0xa860('0x1'));var path=require(_0xa860('0x2'));var timeout=require(_0xa860('0x3'));var express=require(_0xa860('0x4'));var router=express[_0xa860('0x5')]();var auth=require(_0xa860('0x6'));var interaction=require(_0xa860('0x7'));var config=require(_0xa860('0x8'));var controller=require(_0xa860('0x9'));router['get']('/',auth[_0xa860('0xa')](),controller[_0xa860('0xb')]);router[_0xa860('0xc')](_0xa860('0xd'),auth['isAuthenticated'](),controller[_0xa860('0xe')]);router[_0xa860('0xf')]('/',auth[_0xa860('0xa')](),controller[_0xa860('0x10')]);router[_0xa860('0x11')](_0xa860('0xd'),auth[_0xa860('0xa')](),controller[_0xa860('0x12')]);router['delete'](_0xa860('0xd'),auth[_0xa860('0xa')](),controller[_0xa860('0x13')]);module[_0xa860('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 1914445..0909c5a 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 _0x8775=['sequelize','exports','STRING','name'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x8775,0x194));var _0x5877=function(_0x2bd1ec,_0x3fe65f){_0x2bd1ec=_0x2bd1ec-0x0;var _0x2f7577=_0x8775[_0x2bd1ec];return _0x2f7577;};'use strict';var Sequelize=require(_0x5877('0x0'));module[_0x5877('0x1')]={'name':{'type':Sequelize[_0x5877('0x2')],'unique':_0x5877('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x5877('0x2')]}}; \ No newline at end of file +var _0x9d12=['name','STRING','exports'];(function(_0xcb99ad,_0x9fc335){var _0x3b9913=function(_0x962573){while(--_0x962573){_0xcb99ad['push'](_0xcb99ad['shift']());}};_0x3b9913(++_0x9fc335);}(_0x9d12,0xbc));var _0x29d1=function(_0x58b4cc,_0x22a59d){_0x58b4cc=_0x58b4cc-0x0;var _0x3f355b=_0x9d12[_0x58b4cc];return _0x3f355b;};'use strict';var Sequelize=require('sequelize');module[_0x29d1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x29d1('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x29d1('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 807920a..c22c2ca 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 _0xc18a=['limit','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','end','error','stack','name','index','map','Pause','fieldName','type','model','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','findAll','catch','show','params','keys','include','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset'];(function(_0x5267c9,_0x3a66ba){var _0x4e98bb=function(_0x5439da){while(--_0x5439da){_0x5267c9['push'](_0x5267c9['shift']());}};_0x4e98bb(++_0x3a66ba);}(_0xc18a,0x172));var _0xac18=function(_0x3394c6,_0x1d907d){_0x3394c6=_0x3394c6-0x0;var _0x25e4ec=_0xc18a[_0x3394c6];return _0x25e4ec;};'use strict';var pdf=require(_0xac18('0x0'));var emlformat=require(_0xac18('0x1'));var rimraf=require(_0xac18('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac18('0x3'));var rp=require(_0xac18('0x4'));var moment=require(_0xac18('0x5'));var BPromise=require(_0xac18('0x6'));var Mustache=require(_0xac18('0x7'));var util=require('util');var path=require(_0xac18('0x8'));var sox=require(_0xac18('0x9'));var csv=require(_0xac18('0xa'));var ejs=require(_0xac18('0xb'));var fs=require('fs');var _=require(_0xac18('0xc'));var squel=require(_0xac18('0xd'));var crypto=require(_0xac18('0xe'));var jsforce=require(_0xac18('0xf'));var deskjs=require(_0xac18('0x10'));var toCsv=require(_0xac18('0xa'));var querystring=require(_0xac18('0x11'));var Papa=require(_0xac18('0x12'));var Redis=require(_0xac18('0x13'));var authService=require(_0xac18('0x14'));var qs=require(_0xac18('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xac18('0x16'))(_0xac18('0x17'));var utils=require(_0xac18('0x18'));var config=require(_0xac18('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35179b,_0x7d24c9){_0x7d24c9=_0x7d24c9||0xcc;return function(_0x433a4f){if(_0x433a4f){return _0x35179b[_0xac18('0x1a')](_0x7d24c9);}return _0x35179b['status'](_0x7d24c9)['end']();};}function respondWithResult(_0x1ff24b,_0x4e8315){_0x4e8315=_0x4e8315||0xc8;return function(_0x5f4167){if(_0x5f4167){return _0x1ff24b[_0xac18('0x1b')](_0x4e8315)['json'](_0x5f4167);}};}function respondWithFilteredResult(_0x1af164,_0x3af8f9){return function(_0x357f00){if(_0x357f00){var _0x1e4cb5=_0x357f00[_0xac18('0x1c')],_0x14e97e=_0x3af8f9[_0xac18('0x1d')],_0x5cc79e=_0x3af8f9[_0xac18('0x1d')]+_0x3af8f9[_0xac18('0x1e')],_0x58ffd5;if(_0x5cc79e>=_0x1e4cb5){_0x5cc79e=_0x1e4cb5;_0x58ffd5=0xc8;}else{_0x58ffd5=0xce;}_0x1af164[_0xac18('0x1b')](_0x58ffd5);return _0x1af164[_0xac18('0x1f')](_0xac18('0x20'),_0x14e97e+'-'+_0x5cc79e+'/'+_0x1e4cb5)['json'](_0x357f00);}return null;};}function patchUpdates(_0x26850e){return function(_0x16079f){try{jsonpatch[_0xac18('0x21')](_0x16079f,_0x26850e,!![]);}catch(_0x3e4044){return BPromise[_0xac18('0x22')](_0x3e4044);}return _0x16079f[_0xac18('0x23')]();};}function saveUpdates(_0x35b6eb,_0x13e558){return function(_0xe8a738){if(_0xe8a738){return _0xe8a738['update'](_0x35b6eb)['then'](function(_0x301b7e){return _0x301b7e;});}return null;};}function removeEntity(_0x46f55b,_0x2de718){return function(_0x1720e0){if(_0x1720e0){return _0x1720e0[_0xac18('0x24')]()[_0xac18('0x25')](function(){var _0xb476bc=_0x1720e0[_0xac18('0x26')]({'plain':!![]});var _0x293017='Pauses';return db[_0xac18('0x27')][_0xac18('0x24')]({'where':{'type':_0x293017,'resourceId':_0xb476bc['id']}})[_0xac18('0x25')](function(){return _0x1720e0;});})[_0xac18('0x25')](function(){_0x46f55b[_0xac18('0x1b')](0xcc)[_0xac18('0x28')]();});}};}function handleEntityNotFound(_0x833e47,_0xab1bf8){return function(_0x2f2cff){if(!_0x2f2cff){_0x833e47['sendStatus'](0x194);}return _0x2f2cff;};}function handleError(_0x5a043d,_0x1c4cc9){_0x1c4cc9=_0x1c4cc9||0x1f4;return function(_0x28ae76){logger[_0xac18('0x29')](_0x28ae76[_0xac18('0x2a')]);if(_0x28ae76[_0xac18('0x2b')]){delete _0x28ae76[_0xac18('0x2b')];}_0x5a043d[_0xac18('0x1b')](_0x1c4cc9)['send'](_0x28ae76);};}exports[_0xac18('0x2c')]=function(_0x463605,_0x451f49){var _0x2eecae={},_0x3ae758={},_0x391ba0={'count':0x0,'rows':[]};var _0x20ca85=_[_0xac18('0x2d')](db[_0xac18('0x2e')]['rawAttributes'],function(_0x3199b7){return{'name':_0x3199b7[_0xac18('0x2f')],'type':_0x3199b7[_0xac18('0x30')]['key']};});_0x3ae758[_0xac18('0x31')]=_[_0xac18('0x2d')](_0x20ca85,_0xac18('0x2b'));_0x3ae758['query']=_['keys'](_0x463605['query']);_0x3ae758[_0xac18('0x32')]=_['intersection'](_0x3ae758[_0xac18('0x31')],_0x3ae758['query']);_0x2eecae[_0xac18('0x33')]=_[_0xac18('0x34')](_0x3ae758[_0xac18('0x31')],qs[_0xac18('0x35')](_0x463605[_0xac18('0x36')][_0xac18('0x35')]));_0x2eecae[_0xac18('0x33')]=_0x2eecae[_0xac18('0x33')][_0xac18('0x37')]?_0x2eecae[_0xac18('0x33')]:_0x3ae758[_0xac18('0x31')];if(!_0x463605[_0xac18('0x36')][_0xac18('0x38')](_0xac18('0x39'))){_0x2eecae[_0xac18('0x1e')]=qs[_0xac18('0x1e')](_0x463605[_0xac18('0x36')][_0xac18('0x1e')]);_0x2eecae[_0xac18('0x1d')]=qs['offset'](_0x463605[_0xac18('0x36')][_0xac18('0x1d')]);}_0x2eecae['order']=qs['sort'](_0x463605[_0xac18('0x36')][_0xac18('0x3a')]);_0x2eecae[_0xac18('0x3b')]=qs[_0xac18('0x32')](_[_0xac18('0x3c')](_0x463605[_0xac18('0x36')],_0x3ae758['filters']),_0x20ca85);if(_0x463605[_0xac18('0x36')]['filter']){_0x2eecae[_0xac18('0x3b')]=_[_0xac18('0x3d')](_0x2eecae[_0xac18('0x3b')],{'$or':_['map'](_0x20ca85,function(_0x5f5cc5){if(_0x5f5cc5['type']!=='VIRTUAL'){var _0x1453a3={};_0x1453a3[_0x5f5cc5[_0xac18('0x2b')]]={'$like':'%'+_0x463605[_0xac18('0x36')][_0xac18('0x3e')]+'%'};return _0x1453a3;}})});}_0x2eecae=_['merge']({},_0x2eecae,_0x463605[_0xac18('0x3f')]);var _0x145464={'where':_0x2eecae[_0xac18('0x3b')]};return db[_0xac18('0x2e')]['count'](_0x145464)[_0xac18('0x25')](function(_0x5d3a02){_0x391ba0['count']=_0x5d3a02;if(_0x463605[_0xac18('0x36')][_0xac18('0x40')]){_0x2eecae['include']=[{'all':!![]}];}return db['Pause'][_0xac18('0x41')](_0x2eecae);})[_0xac18('0x25')](function(_0x52fde7){_0x391ba0['rows']=_0x52fde7;return _0x391ba0;})[_0xac18('0x25')](respondWithFilteredResult(_0x451f49,_0x2eecae))[_0xac18('0x42')](handleError(_0x451f49,null));};exports[_0xac18('0x43')]=function(_0x422d95,_0x1273eb){var _0x222dad={'raw':!![],'where':{'id':_0x422d95[_0xac18('0x44')]['id']}},_0x40a596={};_0x40a596['model']=_['keys'](db[_0xac18('0x2e')]['rawAttributes']);_0x40a596[_0xac18('0x36')]=_[_0xac18('0x45')](_0x422d95[_0xac18('0x36')]);_0x40a596[_0xac18('0x32')]=_[_0xac18('0x34')](_0x40a596[_0xac18('0x31')],_0x40a596['query']);_0x222dad[_0xac18('0x33')]=_[_0xac18('0x34')](_0x40a596[_0xac18('0x31')],qs['fields'](_0x422d95[_0xac18('0x36')]['fields']));_0x222dad[_0xac18('0x33')]=_0x222dad[_0xac18('0x33')]['length']?_0x222dad[_0xac18('0x33')]:_0x40a596[_0xac18('0x31')];if(_0x422d95[_0xac18('0x36')]['includeAll']){_0x222dad[_0xac18('0x46')]=[{'all':!![]}];}_0x222dad=_[_0xac18('0x3d')]({},_0x222dad,_0x422d95[_0xac18('0x3f')]);return db[_0xac18('0x2e')][_0xac18('0x47')](_0x222dad)[_0xac18('0x25')](handleEntityNotFound(_0x1273eb,null))[_0xac18('0x25')](respondWithResult(_0x1273eb,null))[_0xac18('0x42')](handleError(_0x1273eb,null));};exports[_0xac18('0x48')]=function(_0x4bdc0d,_0x52c5b7){return db[_0xac18('0x2e')][_0xac18('0x48')](_0x4bdc0d['body'],{})[_0xac18('0x25')](function(_0x570397){var _0x26ee43=_0x4bdc0d[_0xac18('0x49')][_0xac18('0x26')]({'plain':!![]});if(!_0x26ee43)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26ee43[_0xac18('0x4a')]==='user'){var _0x1e6c57=_0x570397[_0xac18('0x26')]({'plain':!![]});var _0x2c4cc8='Pauses';return db[_0xac18('0x4b')][_0xac18('0x47')]({'where':{'name':_0x2c4cc8,'userProfileId':_0x26ee43[_0xac18('0x4c')]},'raw':!![]})[_0xac18('0x25')](function(_0x5cbdfb){if(_0x5cbdfb&&_0x5cbdfb['autoAssociation']===0x0){return db[_0xac18('0x27')][_0xac18('0x48')]({'name':_0x1e6c57[_0xac18('0x2b')],'resourceId':_0x1e6c57['id'],'type':_0x5cbdfb[_0xac18('0x2b')],'sectionId':_0x5cbdfb['id']},{})[_0xac18('0x25')](function(){return _0x570397;});}else{return _0x570397;}})[_0xac18('0x42')](function(_0x2600d5){logger[_0xac18('0x29')](_0xac18('0x4d'),_0x2600d5);throw _0x2600d5;});}return _0x570397;})['then'](respondWithResult(_0x52c5b7,0xc9))[_0xac18('0x42')](handleError(_0x52c5b7,null));};exports[_0xac18('0x4e')]=function(_0x17ecbb,_0x1ba19e){if(_0x17ecbb[_0xac18('0x4f')]['id']){delete _0x17ecbb[_0xac18('0x4f')]['id'];}return db['Pause']['find']({'where':{'id':_0x17ecbb[_0xac18('0x44')]['id']}})[_0xac18('0x25')](handleEntityNotFound(_0x1ba19e,null))[_0xac18('0x25')](saveUpdates(_0x17ecbb[_0xac18('0x4f')],null))[_0xac18('0x25')](respondWithResult(_0x1ba19e,null))['catch'](handleError(_0x1ba19e,null));};exports['destroy']=function(_0x14dcd8,_0x2577b8){return db[_0xac18('0x2e')][_0xac18('0x47')]({'where':{'id':_0x14dcd8[_0xac18('0x44')]['id']}})['then'](handleEntityNotFound(_0x2577b8,null))['then'](removeEntity(_0x2577b8,null))[_0xac18('0x42')](handleError(_0x2577b8,null));}; \ No newline at end of file +var _0xf413=['include','findAll','rows','catch','show','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll'];(function(_0x423a9a,_0x2ec223){var _0x564475=function(_0x33b25a){while(--_0x33b25a){_0x423a9a['push'](_0x423a9a['shift']());}};_0x564475(++_0x2ec223);}(_0xf413,0x1b1));var _0x3f41=function(_0x590151,_0x5ed644){_0x590151=_0x590151-0x0;var _0x25abb8=_0xf413[_0x590151];return _0x25abb8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f41('0x0'));var rimraf=require(_0x3f41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f41('0x2'));var rp=require(_0x3f41('0x3'));var moment=require('moment');var BPromise=require(_0x3f41('0x4'));var Mustache=require(_0x3f41('0x5'));var util=require(_0x3f41('0x6'));var path=require(_0x3f41('0x7'));var sox=require(_0x3f41('0x8'));var csv=require(_0x3f41('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f41('0xa'));var squel=require(_0x3f41('0xb'));var crypto=require(_0x3f41('0xc'));var jsforce=require(_0x3f41('0xd'));var deskjs=require(_0x3f41('0xe'));var toCsv=require(_0x3f41('0x9'));var querystring=require(_0x3f41('0xf'));var Papa=require('papaparse');var Redis=require(_0x3f41('0x10'));var authService=require(_0x3f41('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3f41('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f41('0x13'))('api');var utils=require(_0x3f41('0x14'));var config=require(_0x3f41('0x15'));var db=require(_0x3f41('0x16'))['db'];function respondWithStatusCode(_0x5a9a31,_0x19ee3a){_0x19ee3a=_0x19ee3a||0xcc;return function(_0x1dfb6f){if(_0x1dfb6f){return _0x5a9a31[_0x3f41('0x17')](_0x19ee3a);}return _0x5a9a31[_0x3f41('0x18')](_0x19ee3a)[_0x3f41('0x19')]();};}function respondWithResult(_0x595a8c,_0x2595ab){_0x2595ab=_0x2595ab||0xc8;return function(_0x390ce5){if(_0x390ce5){return _0x595a8c['status'](_0x2595ab)[_0x3f41('0x1a')](_0x390ce5);}};}function respondWithFilteredResult(_0x5580bc,_0x22fd67){return function(_0x4f65df){if(_0x4f65df){var _0x236c3f=_0x4f65df['count'],_0x2fd86e=_0x22fd67[_0x3f41('0x1b')],_0x3b6254=_0x22fd67[_0x3f41('0x1b')]+_0x22fd67[_0x3f41('0x1c')],_0x48ffc0;if(_0x3b6254>=_0x236c3f){_0x3b6254=_0x236c3f;_0x48ffc0=0xc8;}else{_0x48ffc0=0xce;}_0x5580bc['status'](_0x48ffc0);return _0x5580bc[_0x3f41('0x1d')](_0x3f41('0x1e'),_0x2fd86e+'-'+_0x3b6254+'/'+_0x236c3f)['json'](_0x4f65df);}return null;};}function patchUpdates(_0x598209){return function(_0x4947dc){try{jsonpatch[_0x3f41('0x1f')](_0x4947dc,_0x598209,!![]);}catch(_0x3a5337){return BPromise[_0x3f41('0x20')](_0x3a5337);}return _0x4947dc[_0x3f41('0x21')]();};}function saveUpdates(_0x563f97,_0x1056c3){return function(_0x324757){if(_0x324757){return _0x324757['update'](_0x563f97)[_0x3f41('0x22')](function(_0xa47f85){return _0xa47f85;});}return null;};}function removeEntity(_0x22f792,_0x19d0da){return function(_0x153459){if(_0x153459){return _0x153459[_0x3f41('0x23')]()[_0x3f41('0x22')](function(){var _0x3573d2=_0x153459[_0x3f41('0x24')]({'plain':!![]});var _0x257318=_0x3f41('0x25');return db[_0x3f41('0x26')]['destroy']({'where':{'type':_0x257318,'resourceId':_0x3573d2['id']}})['then'](function(){return _0x153459;});})[_0x3f41('0x22')](function(){_0x22f792[_0x3f41('0x18')](0xcc)[_0x3f41('0x19')]();});}};}function handleEntityNotFound(_0x25a4d1,_0x3edaed){return function(_0x1227cf){if(!_0x1227cf){_0x25a4d1[_0x3f41('0x17')](0x194);}return _0x1227cf;};}function handleError(_0x5e32c7,_0x44626a){_0x44626a=_0x44626a||0x1f4;return function(_0x2537e4){logger[_0x3f41('0x27')](_0x2537e4[_0x3f41('0x28')]);if(_0x2537e4['name']){delete _0x2537e4[_0x3f41('0x29')];}_0x5e32c7[_0x3f41('0x18')](_0x44626a)[_0x3f41('0x2a')](_0x2537e4);};}exports[_0x3f41('0x2b')]=function(_0xda0ee6,_0x3ea7b5){var _0x5627f8={},_0x1b2417={},_0x105a0f={'count':0x0,'rows':[]};var _0x3df8eb=_[_0x3f41('0x2c')](db[_0x3f41('0x2d')][_0x3f41('0x2e')],function(_0x19e075){return{'name':_0x19e075['fieldName'],'type':_0x19e075[_0x3f41('0x2f')][_0x3f41('0x30')]};});_0x1b2417['model']=_[_0x3f41('0x2c')](_0x3df8eb,_0x3f41('0x29'));_0x1b2417['query']=_[_0x3f41('0x31')](_0xda0ee6[_0x3f41('0x32')]);_0x1b2417[_0x3f41('0x33')]=_[_0x3f41('0x34')](_0x1b2417[_0x3f41('0x35')],_0x1b2417[_0x3f41('0x32')]);_0x5627f8[_0x3f41('0x36')]=_[_0x3f41('0x34')](_0x1b2417[_0x3f41('0x35')],qs['fields'](_0xda0ee6['query']['fields']));_0x5627f8[_0x3f41('0x36')]=_0x5627f8[_0x3f41('0x36')]['length']?_0x5627f8[_0x3f41('0x36')]:_0x1b2417[_0x3f41('0x35')];if(!_0xda0ee6[_0x3f41('0x32')][_0x3f41('0x37')]('nolimit')){_0x5627f8['limit']=qs['limit'](_0xda0ee6['query'][_0x3f41('0x1c')]);_0x5627f8[_0x3f41('0x1b')]=qs['offset'](_0xda0ee6[_0x3f41('0x32')][_0x3f41('0x1b')]);}_0x5627f8[_0x3f41('0x38')]=qs[_0x3f41('0x39')](_0xda0ee6['query'][_0x3f41('0x39')]);_0x5627f8[_0x3f41('0x3a')]=qs['filters'](_[_0x3f41('0x3b')](_0xda0ee6[_0x3f41('0x32')],_0x1b2417[_0x3f41('0x33')]),_0x3df8eb);if(_0xda0ee6[_0x3f41('0x32')][_0x3f41('0x3c')]){_0x5627f8[_0x3f41('0x3a')]=_['merge'](_0x5627f8[_0x3f41('0x3a')],{'$or':_[_0x3f41('0x2c')](_0x3df8eb,function(_0x2e1c37){if(_0x2e1c37[_0x3f41('0x2f')]!==_0x3f41('0x3d')){var _0x454a0a={};_0x454a0a[_0x2e1c37[_0x3f41('0x29')]]={'$like':'%'+_0xda0ee6[_0x3f41('0x32')][_0x3f41('0x3c')]+'%'};return _0x454a0a;}})});}_0x5627f8=_[_0x3f41('0x3e')]({},_0x5627f8,_0xda0ee6['options']);var _0x46d056={'where':_0x5627f8[_0x3f41('0x3a')]};return db[_0x3f41('0x2d')][_0x3f41('0x3f')](_0x46d056)[_0x3f41('0x22')](function(_0x14c7a0){_0x105a0f[_0x3f41('0x3f')]=_0x14c7a0;if(_0xda0ee6[_0x3f41('0x32')][_0x3f41('0x40')]){_0x5627f8[_0x3f41('0x41')]=[{'all':!![]}];}return db[_0x3f41('0x2d')][_0x3f41('0x42')](_0x5627f8);})[_0x3f41('0x22')](function(_0x5aea07){_0x105a0f[_0x3f41('0x43')]=_0x5aea07;return _0x105a0f;})['then'](respondWithFilteredResult(_0x3ea7b5,_0x5627f8))[_0x3f41('0x44')](handleError(_0x3ea7b5,null));};exports[_0x3f41('0x45')]=function(_0x57b6ca,_0x2f8b2f){var _0x4fbf74={'raw':!![],'where':{'id':_0x57b6ca['params']['id']}},_0x3207c0={};_0x3207c0[_0x3f41('0x35')]=_['keys'](db['Pause'][_0x3f41('0x2e')]);_0x3207c0[_0x3f41('0x32')]=_['keys'](_0x57b6ca[_0x3f41('0x32')]);_0x3207c0[_0x3f41('0x33')]=_['intersection'](_0x3207c0[_0x3f41('0x35')],_0x3207c0[_0x3f41('0x32')]);_0x4fbf74[_0x3f41('0x36')]=_[_0x3f41('0x34')](_0x3207c0[_0x3f41('0x35')],qs[_0x3f41('0x46')](_0x57b6ca[_0x3f41('0x32')][_0x3f41('0x46')]));_0x4fbf74[_0x3f41('0x36')]=_0x4fbf74['attributes'][_0x3f41('0x47')]?_0x4fbf74[_0x3f41('0x36')]:_0x3207c0[_0x3f41('0x35')];if(_0x57b6ca[_0x3f41('0x32')][_0x3f41('0x40')]){_0x4fbf74['include']=[{'all':!![]}];}_0x4fbf74=_[_0x3f41('0x3e')]({},_0x4fbf74,_0x57b6ca['options']);return db[_0x3f41('0x2d')][_0x3f41('0x48')](_0x4fbf74)[_0x3f41('0x22')](handleEntityNotFound(_0x2f8b2f,null))[_0x3f41('0x22')](respondWithResult(_0x2f8b2f,null))[_0x3f41('0x44')](handleError(_0x2f8b2f,null));};exports['create']=function(_0x1ed830,_0xb19131){return db[_0x3f41('0x2d')][_0x3f41('0x49')](_0x1ed830[_0x3f41('0x4a')],{})[_0x3f41('0x22')](function(_0x1d8f4f){var _0x3d19fd=_0x1ed830[_0x3f41('0x4b')][_0x3f41('0x24')]({'plain':!![]});if(!_0x3d19fd)throw new Error(_0x3f41('0x4c'));if(_0x3d19fd[_0x3f41('0x4d')]===_0x3f41('0x4b')){var _0x3311d6=_0x1d8f4f['get']({'plain':!![]});var _0x2e624c='Pauses';return db[_0x3f41('0x4e')][_0x3f41('0x48')]({'where':{'name':_0x2e624c,'userProfileId':_0x3d19fd[_0x3f41('0x4f')]},'raw':!![]})[_0x3f41('0x22')](function(_0x4a939d){if(_0x4a939d&&_0x4a939d[_0x3f41('0x50')]===0x0){return db[_0x3f41('0x26')][_0x3f41('0x49')]({'name':_0x3311d6[_0x3f41('0x29')],'resourceId':_0x3311d6['id'],'type':_0x4a939d[_0x3f41('0x29')],'sectionId':_0x4a939d['id']},{})[_0x3f41('0x22')](function(){return _0x1d8f4f;});}else{return _0x1d8f4f;}})[_0x3f41('0x44')](function(_0x435231){logger[_0x3f41('0x27')](_0x3f41('0x51'),_0x435231);throw _0x435231;});}return _0x1d8f4f;})[_0x3f41('0x22')](respondWithResult(_0xb19131,0xc9))[_0x3f41('0x44')](handleError(_0xb19131,null));};exports['update']=function(_0x46746d,_0x568881){if(_0x46746d['body']['id']){delete _0x46746d['body']['id'];}return db[_0x3f41('0x2d')][_0x3f41('0x48')]({'where':{'id':_0x46746d[_0x3f41('0x52')]['id']}})[_0x3f41('0x22')](handleEntityNotFound(_0x568881,null))[_0x3f41('0x22')](saveUpdates(_0x46746d[_0x3f41('0x4a')],null))[_0x3f41('0x22')](respondWithResult(_0x568881,null))[_0x3f41('0x44')](handleError(_0x568881,null));};exports[_0x3f41('0x23')]=function(_0x53c3d6,_0x20a912){return db[_0x3f41('0x2d')][_0x3f41('0x48')]({'where':{'id':_0x53c3d6[_0x3f41('0x52')]['id']}})['then'](handleEntityNotFound(_0x20a912,null))['then'](removeEntity(_0x20a912,null))[_0x3f41('0x44')](handleError(_0x20a912,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ef6586e..23b58ef 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 _0x91d3=['../../config/environment','./pause.attributes','define','Pause','tools_pauses','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1a897b,_0x33c762){var _0x54da75=function(_0x45054e){while(--_0x45054e){_0x1a897b['push'](_0x1a897b['shift']());}};_0x54da75(++_0x33c762);}(_0x91d3,0xc0));var _0x391d=function(_0x43fb6e,_0x6cdaa1){_0x43fb6e=_0x43fb6e-0x0;var _0x56a9ca=_0x91d3[_0x43fb6e];return _0x56a9ca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x391d('0x0'))(_0x391d('0x1'));var moment=require(_0x391d('0x2'));var BPromise=require(_0x391d('0x3'));var rp=require(_0x391d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x391d('0x5'));var config=require(_0x391d('0x6'));var attributes=require(_0x391d('0x7'));module['exports']=function(_0x5404d3,_0x4c18e1){return _0x5404d3[_0x391d('0x8')](_0x391d('0x9'),attributes,{'tableName':_0x391d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0b2=['define','Pause','tools_pauses','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb0b2,0x85));var _0x2b0b=function(_0x355f98,_0x58c2e1){_0x355f98=_0x355f98-0x0;var _0x41dfdc=_0xb0b2[_0x355f98];return _0x41dfdc;};'use strict';var _=require('lodash');var util=require(_0x2b0b('0x0'));var logger=require(_0x2b0b('0x1'))('api');var moment=require(_0x2b0b('0x2'));var BPromise=require(_0x2b0b('0x3'));var rp=require(_0x2b0b('0x4'));var fs=require('fs');var path=require(_0x2b0b('0x5'));var rimraf=require(_0x2b0b('0x6'));var config=require(_0x2b0b('0x7'));var attributes=require(_0x2b0b('0x8'));module[_0x2b0b('0x9')]=function(_0x197f2c,_0xabcf97){return _0x197f2c[_0x2b0b('0xa')](_0x2b0b('0xb'),attributes,{'tableName':_0x2b0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 6b17c6d..edab13c 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 _0x893d=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Pause,\x20%s,\x20%s','info','catch','ShowPause','find','options','where','attributes','include','map','model','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x893d,0x180));var _0xd893=function(_0x1de047,_0x25cf3c){_0x1de047=_0x1de047-0x0;var _0x6c2b31=_0x893d[_0x1de047];return _0x6c2b31;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd893('0x0'));var rs=require(_0xd893('0x1'));var fs=require('fs');var Redis=require(_0xd893('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd893('0x3'));var logger=require(_0xd893('0x4'))(_0xd893('0x5'));var config=require(_0xd893('0x6'));var jayson=require(_0xd893('0x7'));var client=jayson[_0xd893('0x8')][_0xd893('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ed410,_0x17b233,_0x4d5527){return new BPromise(function(_0x226e79,_0x39249a){return client[_0xd893('0xa')](_0x3ed410,_0x4d5527)[_0xd893('0xb')](function(_0x3373c7){logger['info']('Pause,\x20%s,\x20%s',_0x17b233,_0xd893('0xc'));logger[_0xd893('0xd')](_0xd893('0xe'),_0x17b233,_0xd893('0xc'),JSON[_0xd893('0xf')](_0x3373c7));if(_0x3373c7[_0xd893('0x10')]){if(_0x3373c7['error'][_0xd893('0x11')]===0x1f4){logger['error']('Pause,\x20%s,\x20%s',_0x17b233,_0x3373c7[_0xd893('0x10')][_0xd893('0x12')]);return _0x39249a(_0x3373c7['error'][_0xd893('0x12')]);}logger['error'](_0xd893('0x13'),_0x17b233,_0x3373c7[_0xd893('0x10')]['message']);return _0x226e79(_0x3373c7[_0xd893('0x10')][_0xd893('0x12')]);}else{logger[_0xd893('0x14')](_0xd893('0x13'),_0x17b233,_0xd893('0xc'));_0x226e79(_0x3373c7['result'][_0xd893('0x12')]);}})[_0xd893('0x15')](function(_0x430a25){logger[_0xd893('0x10')]('Pause,\x20%s,\x20%s',_0x17b233,_0x430a25);_0x39249a(_0x430a25);});});}exports[_0xd893('0x16')]=function(_0x5bdaae){var _0x55f74=this;return new Promise(function(_0x5513fa,_0x80fdb3){return db['Pause'][_0xd893('0x17')]({'raw':_0x5bdaae[_0xd893('0x18')]?_0x5bdaae['options']['raw']===undefined?!![]:![]:!![],'where':_0x5bdaae['options']?_0x5bdaae[_0xd893('0x18')][_0xd893('0x19')]||null:null,'attributes':_0x5bdaae[_0xd893('0x18')]?_0x5bdaae['options'][_0xd893('0x1a')]||null:null,'include':_0x5bdaae[_0xd893('0x18')]?_0x5bdaae['options'][_0xd893('0x1b')]?_[_0xd893('0x1c')](_0x5bdaae[_0xd893('0x18')][_0xd893('0x1b')],function(_0x87c0ed){return{'model':db[_0x87c0ed[_0xd893('0x1d')]],'as':_0x87c0ed['as'],'attributes':_0x87c0ed['attributes'],'include':_0x87c0ed[_0xd893('0x1b')]?_['map'](_0x87c0ed['include'],function(_0x452523){return{'model':db[_0x452523[_0xd893('0x1d')]],'as':_0x452523['as'],'attributes':_0x452523['attributes'],'include':_0x452523[_0xd893('0x1b')]?_['map'](_0x452523[_0xd893('0x1b')],function(_0x178b88){return{'model':db[_0x178b88['model']],'as':_0x178b88['as'],'attributes':_0x178b88[_0xd893('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd893('0xb')](function(_0x227e56){logger['info'](_0xd893('0x16'),_0x5bdaae);logger[_0xd893('0xd')]('ShowPause',_0x5bdaae,JSON[_0xd893('0xf')](_0x227e56));_0x5513fa(_0x227e56);})[_0xd893('0x15')](function(_0x389d65){logger['error'](_0xd893('0x16'),_0x389d65['message'],_0x5bdaae);_0x80fdb3(_0x55f74[_0xd893('0x10')](0x1f4,_0x389d65[_0xd893('0x12')]));});});}; \ No newline at end of file +var _0xa512=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Pause,\x20%s,\x20%s','message','info','result','catch','ShowPause','Pause','find','options','raw','attributes','include','map','model','util','moment','bluebird','ioredis'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xa512,0x18f));var _0x2a51=function(_0x5c2cfc,_0x225457){_0x5c2cfc=_0x5c2cfc-0x0;var _0x39ef01=_0xa512[_0x5c2cfc];return _0x39ef01;};'use strict';var _=require('lodash');var util=require(_0x2a51('0x0'));var moment=require(_0x2a51('0x1'));var BPromise=require(_0x2a51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a51('0x3'));var db=require(_0x2a51('0x4'))['db'];var utils=require(_0x2a51('0x5'));var logger=require('../../config/logger')(_0x2a51('0x6'));var config=require(_0x2a51('0x7'));var jayson=require(_0x2a51('0x8'));var client=jayson[_0x2a51('0x9')][_0x2a51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32113a,_0x884e8e,_0x18c08f){return new BPromise(function(_0x2eb3dc,_0x1c104b){return client['request'](_0x32113a,_0x18c08f)[_0x2a51('0xb')](function(_0x4c4be5){logger['info']('Pause,\x20%s,\x20%s',_0x884e8e,'request\x20sent');logger[_0x2a51('0xc')](_0x2a51('0xd'),_0x884e8e,_0x2a51('0xe'),JSON[_0x2a51('0xf')](_0x4c4be5));if(_0x4c4be5[_0x2a51('0x10')]){if(_0x4c4be5[_0x2a51('0x10')]['code']===0x1f4){logger[_0x2a51('0x10')](_0x2a51('0x11'),_0x884e8e,_0x4c4be5[_0x2a51('0x10')]['message']);return _0x1c104b(_0x4c4be5[_0x2a51('0x10')][_0x2a51('0x12')]);}logger[_0x2a51('0x10')](_0x2a51('0x11'),_0x884e8e,_0x4c4be5[_0x2a51('0x10')][_0x2a51('0x12')]);return _0x2eb3dc(_0x4c4be5['error']['message']);}else{logger[_0x2a51('0x13')]('Pause,\x20%s,\x20%s',_0x884e8e,_0x2a51('0xe'));_0x2eb3dc(_0x4c4be5[_0x2a51('0x14')][_0x2a51('0x12')]);}})[_0x2a51('0x15')](function(_0x4ca614){logger[_0x2a51('0x10')](_0x2a51('0x11'),_0x884e8e,_0x4ca614);_0x1c104b(_0x4ca614);});});}exports[_0x2a51('0x16')]=function(_0x26ccea){var _0x549202=this;return new Promise(function(_0x4af3e9,_0x1b115b){return db[_0x2a51('0x17')][_0x2a51('0x18')]({'raw':_0x26ccea[_0x2a51('0x19')]?_0x26ccea[_0x2a51('0x19')][_0x2a51('0x1a')]===undefined?!![]:![]:!![],'where':_0x26ccea[_0x2a51('0x19')]?_0x26ccea['options']['where']||null:null,'attributes':_0x26ccea[_0x2a51('0x19')]?_0x26ccea[_0x2a51('0x19')][_0x2a51('0x1b')]||null:null,'include':_0x26ccea[_0x2a51('0x19')]?_0x26ccea[_0x2a51('0x19')][_0x2a51('0x1c')]?_[_0x2a51('0x1d')](_0x26ccea[_0x2a51('0x19')][_0x2a51('0x1c')],function(_0x2f6a6f){return{'model':db[_0x2f6a6f['model']],'as':_0x2f6a6f['as'],'attributes':_0x2f6a6f[_0x2a51('0x1b')],'include':_0x2f6a6f[_0x2a51('0x1c')]?_['map'](_0x2f6a6f['include'],function(_0x58d245){return{'model':db[_0x58d245[_0x2a51('0x1e')]],'as':_0x58d245['as'],'attributes':_0x58d245['attributes'],'include':_0x58d245[_0x2a51('0x1c')]?_[_0x2a51('0x1d')](_0x58d245['include'],function(_0x10e8f8){return{'model':db[_0x10e8f8[_0x2a51('0x1e')]],'as':_0x10e8f8['as'],'attributes':_0x10e8f8[_0x2a51('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7298bd){logger[_0x2a51('0x13')](_0x2a51('0x16'),_0x26ccea);logger[_0x2a51('0xc')](_0x2a51('0x16'),_0x26ccea,JSON[_0x2a51('0xf')](_0x7298bd));_0x4af3e9(_0x7298bd);})['catch'](function(_0x53b08c){logger[_0x2a51('0x10')]('ShowPause',_0x53b08c['message'],_0x26ccea);_0x1b115b(_0x549202[_0x2a51('0x10')](0x1f4,_0x53b08c[_0x2a51('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index b5737af..3e52fb1 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 _0x83f4=['extname','post','single','file','webhookPost','put','update','delete','util','path','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','show','download','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename'];(function(_0x939a09,_0x5e9b9e){var _0x85abd6=function(_0x30cfad){while(--_0x30cfad){_0x939a09['push'](_0x939a09['shift']());}};_0x85abd6(++_0x5e9b9e);}(_0x83f4,0x174));var _0x483f=function(_0x29472a,_0x1f8bf3){_0x29472a=_0x29472a-0x0;var _0x156d4f=_0x83f4[_0x29472a];return _0x156d4f;};'use strict';var multer=require('multer');var util=require(_0x483f('0x0'));var path=require(_0x483f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x483f('0x2'));var config=require(_0x483f('0x3'));var controller=require(_0x483f('0x4'));router['get']('/',auth[_0x483f('0x5')](),controller[_0x483f('0x6')]);router[_0x483f('0x7')](_0x483f('0x8'),controller[_0x483f('0x9')]);router[_0x483f('0x7')](_0x483f('0xa'),auth[_0x483f('0x5')](),controller[_0x483f('0xb')]);router['get']('/:id/download',auth[_0x483f('0x5')](),controller[_0x483f('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ac071,_0x100863,_0x14f4c0){_0x14f4c0(null,path[_0x483f('0xd')](config[_0x483f('0xe')],_0x483f('0xf')));},'filename':function(_0x3c65ef,_0x2b2f63,_0x41d465){_0x2b2f63[_0x483f('0x10')]=_0x2b2f63[_0x483f('0x10')][_0x483f('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x41d465(null,util['format'](_0x483f('0x12'),path[_0x483f('0x13')](_0x2b2f63[_0x483f('0x10')],path[_0x483f('0x14')](_0x2b2f63[_0x483f('0x10')])),Date['now'](),path[_0x483f('0x14')](_0x2b2f63[_0x483f('0x10')])));}})});router[_0x483f('0x15')]('/',upload[_0x483f('0x16')](_0x483f('0x17')),controller['upload']);router[_0x483f('0x15')](_0x483f('0x8'),controller[_0x483f('0x18')]);router[_0x483f('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x483f('0x1a')]);router['delete'](_0x483f('0xa'),auth[_0x483f('0x5')](),controller[_0x483f('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xe6c4=['/:id/download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id'];(function(_0x12e73c,_0x2cbe1d){var _0x4c41cb=function(_0x10283b){while(--_0x10283b){_0x12e73c['push'](_0x12e73c['shift']());}};_0x4c41cb(++_0x2cbe1d);}(_0xe6c4,0xc2));var _0x4e6c=function(_0x26462c,_0x2cfe36){_0x26462c=_0x26462c-0x0;var _0xabeb8a=_0xe6c4[_0x26462c];return _0xabeb8a;};'use strict';var multer=require(_0x4e6c('0x0'));var util=require(_0x4e6c('0x1'));var path=require(_0x4e6c('0x2'));var timeout=require(_0x4e6c('0x3'));var express=require(_0x4e6c('0x4'));var router=express[_0x4e6c('0x5')]();var auth=require(_0x4e6c('0x6'));var interaction=require(_0x4e6c('0x7'));var config=require(_0x4e6c('0x8'));var controller=require(_0x4e6c('0x9'));router[_0x4e6c('0xa')]('/',auth[_0x4e6c('0xb')](),controller[_0x4e6c('0xc')]);router[_0x4e6c('0xa')](_0x4e6c('0xd'),controller[_0x4e6c('0xe')]);router[_0x4e6c('0xa')](_0x4e6c('0xf'),auth[_0x4e6c('0xb')](),controller['show']);router['get'](_0x4e6c('0x10'),auth[_0x4e6c('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x4e6c('0x11')]({'destination':function(_0x1e55e9,_0x5c8452,_0x183793){_0x183793(null,path[_0x4e6c('0x12')](config[_0x4e6c('0x13')],'server/files/plugins'));},'filename':function(_0x237281,_0x495a7a,_0x3d3b3a){_0x495a7a[_0x4e6c('0x14')]=_0x495a7a[_0x4e6c('0x14')][_0x4e6c('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d3b3a(null,util[_0x4e6c('0x16')](_0x4e6c('0x17'),path[_0x4e6c('0x18')](_0x495a7a['originalname'],path['extname'](_0x495a7a[_0x4e6c('0x14')])),Date['now'](),path[_0x4e6c('0x19')](_0x495a7a['originalname'])));}})});router[_0x4e6c('0x1a')]('/',upload[_0x4e6c('0x1b')](_0x4e6c('0x1c')),controller[_0x4e6c('0x1d')]);router[_0x4e6c('0x1a')](_0x4e6c('0xd'),controller[_0x4e6c('0x1e')]);router[_0x4e6c('0x1f')](_0x4e6c('0xf'),auth[_0x4e6c('0xb')](),controller[_0x4e6c('0x20')]);router[_0x4e6c('0x21')](_0x4e6c('0xf'),auth[_0x4e6c('0xb')](),controller[_0x4e6c('0x21')]);module[_0x4e6c('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d059732..00fdbec 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 _0x2d24=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','STRING','sequelize','exports','ENUM','script'];(function(_0x22e8ac,_0x785844){var _0x352a52=function(_0x4723b1){while(--_0x4723b1){_0x22e8ac['push'](_0x22e8ac['shift']());}};_0x352a52(++_0x785844);}(_0x2d24,0x151));var _0x42d2=function(_0x18de57,_0x4f45c7){_0x18de57=_0x18de57-0x0;var _0x32e9e0=_0x2d24[_0x18de57];return _0x32e9e0;};'use strict';var Sequelize=require(_0x42d2('0x0'));module[_0x42d2('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x42d2('0x2')]('html',_0x42d2('0x3'))},'description':{'type':Sequelize[_0x42d2('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x42d2('0x5')},'active':{'type':Sequelize[_0x42d2('0x6')],'defaultValue':0x0,'comment':_0x42d2('0x7')},'sidebar':{'type':Sequelize['ENUM']('adminOnly',_0x42d2('0x8'),'always','never'),'defaultValue':_0x42d2('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x42d2('0xa')]},'adminUrl':{'type':Sequelize[_0x42d2('0xa')]},'agentUrl':{'type':Sequelize[_0x42d2('0xa')]},'scriptName':{'type':Sequelize[_0x42d2('0xa')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x190d=['STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','ENUM','html','script','TEXT'];(function(_0x471eb0,_0x1f54c8){var _0x2d9f31=function(_0x3ea4cb){while(--_0x3ea4cb){_0x471eb0['push'](_0x471eb0['shift']());}};_0x2d9f31(++_0x1f54c8);}(_0x190d,0x13b));var _0xd190=function(_0x49949e,_0x5b8339){_0x49949e=_0x49949e-0x0;var _0x3cd1c4=_0x190d[_0x49949e];return _0x3cd1c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd190('0x0')](_0xd190('0x1'),_0xd190('0x2'))},'description':{'type':Sequelize[_0xd190('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xd190('0x4')],'comment':_0xd190('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xd190('0x6')},'sidebar':{'type':Sequelize[_0xd190('0x0')]('adminOnly',_0xd190('0x7'),_0xd190('0x8'),_0xd190('0x9')),'defaultValue':_0xd190('0x8'),'comment':_0xd190('0xa')},'icon':{'type':Sequelize[_0xd190('0x4')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xd190('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xd190('0x4')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 11d1328..db6fec9 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 _0x6f84=['Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','register','status','end','count','offset','limit','set','json','apply','reject','destroy','get','Plugins','UserProfileResource','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Plugin','includeAll','include','findAll','catch','show','params','keys','fields','find','download','join','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','root','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','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','icon-apps','test','plugins'];(function(_0x2c3d28,_0x10ae74){var _0x5ac957=function(_0x29fd1b){while(--_0x29fd1b){_0x2c3d28['push'](_0x2c3d28['shift']());}};_0x5ac957(++_0x10ae74);}(_0x6f84,0xc7));var _0x46f8=function(_0x4e11a9,_0x108cda){_0x4e11a9=_0x4e11a9-0x0;var _0x1a8970=_0x6f84[_0x4e11a9];return _0x1a8970;};'use strict';var pdf=require(_0x46f8('0x0'));var emlformat=require(_0x46f8('0x1'));var rimraf=require(_0x46f8('0x2'));var zipdir=require(_0x46f8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x46f8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x46f8('0x5'));var util=require('util');var path=require(_0x46f8('0x6'));var sox=require(_0x46f8('0x7'));var csv=require(_0x46f8('0x8'));var ejs=require(_0x46f8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x46f8('0xa'));var crypto=require(_0x46f8('0xb'));var jsforce=require(_0x46f8('0xc'));var deskjs=require(_0x46f8('0xd'));var toCsv=require(_0x46f8('0x8'));var querystring=require('querystring');var Papa=require(_0x46f8('0xe'));var extract=require(_0x46f8('0xf'));var rimraf=require(_0x46f8('0x2'));var archiver=require(_0x46f8('0x10'));var Redis=require(_0x46f8('0x11'));var authService=require(_0x46f8('0x12'));var qs=require(_0x46f8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x46f8('0x14'))(_0x46f8('0x15'));var utils=require(_0x46f8('0x16'));var config=require(_0x46f8('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x46f8('0x18')](config['redis'],{'host':_0x46f8('0x19'),'port':0x18eb});var socket=require(_0x46f8('0x1a'))(new Redis(config['redis']));require('./plugin.socket')[_0x46f8('0x1b')](socket);function respondWithStatusCode(_0x2fea8e,_0x4c4a51){_0x4c4a51=_0x4c4a51||0xcc;return function(_0x1a41ac){if(_0x1a41ac){return _0x2fea8e['sendStatus'](_0x4c4a51);}return _0x2fea8e[_0x46f8('0x1c')](_0x4c4a51)[_0x46f8('0x1d')]();};}function respondWithResult(_0x1e6223,_0x48600){_0x48600=_0x48600||0xc8;return function(_0x3cf14f){if(_0x3cf14f){return _0x1e6223[_0x46f8('0x1c')](_0x48600)['json'](_0x3cf14f);}};}function respondWithFilteredResult(_0x3273f8,_0x1b4ac4){return function(_0x30878f){if(_0x30878f){var _0x1580d7=_0x30878f[_0x46f8('0x1e')],_0x10e5d2=_0x1b4ac4[_0x46f8('0x1f')],_0x58509c=_0x1b4ac4['offset']+_0x1b4ac4[_0x46f8('0x20')],_0x45560d;if(_0x58509c>=_0x1580d7){_0x58509c=_0x1580d7;_0x45560d=0xc8;}else{_0x45560d=0xce;}_0x3273f8[_0x46f8('0x1c')](_0x45560d);return _0x3273f8[_0x46f8('0x21')]('Content-Range',_0x10e5d2+'-'+_0x58509c+'/'+_0x1580d7)[_0x46f8('0x22')](_0x30878f);}return null;};}function patchUpdates(_0xfd33b2){return function(_0x5e5ffe){try{jsonpatch[_0x46f8('0x23')](_0x5e5ffe,_0xfd33b2,!![]);}catch(_0x5a1539){return BPromise[_0x46f8('0x24')](_0x5a1539);}return _0x5e5ffe['save']();};}function saveUpdates(_0x3a4500,_0x42b8c6){return function(_0x254fec){if(_0x254fec){return _0x254fec['update'](_0x3a4500)['then'](function(_0x39f342){return _0x39f342;});}return null;};}function removeEntity(_0x3e8c61,_0x5a80dc){return function(_0x11b305){if(_0x11b305){return _0x11b305[_0x46f8('0x25')]()['then'](function(){var _0x9d96d3=_0x11b305[_0x46f8('0x26')]({'plain':!![]});var _0x5217c=_0x46f8('0x27');return db[_0x46f8('0x28')][_0x46f8('0x25')]({'where':{'type':_0x5217c,'resourceId':_0x9d96d3['id']}})['then'](function(){return _0x11b305;});})[_0x46f8('0x29')](function(){_0x3e8c61[_0x46f8('0x1c')](0xcc)[_0x46f8('0x1d')]();});}};}function handleEntityNotFound(_0xcc9917,_0x413819){return function(_0x58b4df){if(!_0x58b4df){_0xcc9917[_0x46f8('0x2a')](0x194);}return _0x58b4df;};}function handleError(_0x1daaa1,_0xf882c1){_0xf882c1=_0xf882c1||0x1f4;return function(_0x8b6628){logger['error'](_0x8b6628[_0x46f8('0x2b')]);if(_0x8b6628['name']){delete _0x8b6628[_0x46f8('0x2c')];}_0x1daaa1['status'](_0xf882c1)[_0x46f8('0x2d')](_0x8b6628);};}exports[_0x46f8('0x2e')]=function(_0x2d24ca,_0x3bb767){var _0x314a67={},_0x36db6f={},_0x179eff={'count':0x0,'rows':[]};var _0x144f95=_[_0x46f8('0x2f')](db['Plugin'][_0x46f8('0x30')],function(_0xdfcd4f){return{'name':_0xdfcd4f[_0x46f8('0x31')],'type':_0xdfcd4f[_0x46f8('0x32')][_0x46f8('0x33')]};});_0x36db6f[_0x46f8('0x34')]=_[_0x46f8('0x2f')](_0x144f95,_0x46f8('0x2c'));_0x36db6f[_0x46f8('0x35')]=_['keys'](_0x2d24ca[_0x46f8('0x35')]);_0x36db6f[_0x46f8('0x36')]=_[_0x46f8('0x37')](_0x36db6f['model'],_0x36db6f[_0x46f8('0x35')]);_0x314a67[_0x46f8('0x38')]=_['intersection'](_0x36db6f[_0x46f8('0x34')],qs['fields'](_0x2d24ca[_0x46f8('0x35')]['fields']));_0x314a67['attributes']=_0x314a67[_0x46f8('0x38')][_0x46f8('0x39')]?_0x314a67[_0x46f8('0x38')]:_0x36db6f['model'];if(!_0x2d24ca[_0x46f8('0x35')][_0x46f8('0x3a')](_0x46f8('0x3b'))){_0x314a67['limit']=qs[_0x46f8('0x20')](_0x2d24ca[_0x46f8('0x35')][_0x46f8('0x20')]);_0x314a67[_0x46f8('0x1f')]=qs['offset'](_0x2d24ca[_0x46f8('0x35')][_0x46f8('0x1f')]);}_0x314a67['order']=qs[_0x46f8('0x3c')](_0x2d24ca[_0x46f8('0x35')]['sort']);_0x314a67[_0x46f8('0x3d')]=qs[_0x46f8('0x36')](_[_0x46f8('0x3e')](_0x2d24ca[_0x46f8('0x35')],_0x36db6f['filters']),_0x144f95);if(_0x2d24ca[_0x46f8('0x35')][_0x46f8('0x3f')]){_0x314a67[_0x46f8('0x3d')]=_[_0x46f8('0x40')](_0x314a67[_0x46f8('0x3d')],{'$or':_[_0x46f8('0x2f')](_0x144f95,function(_0x4b5895){if(_0x4b5895['type']!==_0x46f8('0x41')){var _0x4e3f3c={};_0x4e3f3c[_0x4b5895[_0x46f8('0x2c')]]={'$like':'%'+_0x2d24ca[_0x46f8('0x35')]['filter']+'%'};return _0x4e3f3c;}})});}_0x314a67=_[_0x46f8('0x40')]({},_0x314a67,_0x2d24ca[_0x46f8('0x42')]);var _0x5a9e15={'where':_0x314a67[_0x46f8('0x3d')]};return db[_0x46f8('0x43')][_0x46f8('0x1e')](_0x5a9e15)['then'](function(_0x33d567){_0x179eff[_0x46f8('0x1e')]=_0x33d567;if(_0x2d24ca[_0x46f8('0x35')][_0x46f8('0x44')]){_0x314a67[_0x46f8('0x45')]=[{'all':!![]}];}return db['Plugin'][_0x46f8('0x46')](_0x314a67);})[_0x46f8('0x29')](function(_0x28851e){_0x179eff['rows']=_0x28851e;return _0x179eff;})[_0x46f8('0x29')](respondWithFilteredResult(_0x3bb767,_0x314a67))[_0x46f8('0x47')](handleError(_0x3bb767,null));};exports[_0x46f8('0x48')]=function(_0x3783a8,_0x18d863){var _0x187fd2={'raw':!![],'where':{'id':_0x3783a8[_0x46f8('0x49')]['id']}},_0x219029={};_0x219029[_0x46f8('0x34')]=_[_0x46f8('0x4a')](db[_0x46f8('0x43')][_0x46f8('0x30')]);_0x219029[_0x46f8('0x35')]=_[_0x46f8('0x4a')](_0x3783a8[_0x46f8('0x35')]);_0x219029[_0x46f8('0x36')]=_[_0x46f8('0x37')](_0x219029[_0x46f8('0x34')],_0x219029[_0x46f8('0x35')]);_0x187fd2[_0x46f8('0x38')]=_[_0x46f8('0x37')](_0x219029[_0x46f8('0x34')],qs[_0x46f8('0x4b')](_0x3783a8[_0x46f8('0x35')][_0x46f8('0x4b')]));_0x187fd2['attributes']=_0x187fd2[_0x46f8('0x38')][_0x46f8('0x39')]?_0x187fd2[_0x46f8('0x38')]:_0x219029[_0x46f8('0x34')];if(_0x3783a8[_0x46f8('0x35')]['includeAll']){_0x187fd2['include']=[{'all':!![]}];}_0x187fd2=_['merge']({},_0x187fd2,_0x3783a8['options']);return db[_0x46f8('0x43')][_0x46f8('0x4c')](_0x187fd2)[_0x46f8('0x29')](handleEntityNotFound(_0x18d863,null))[_0x46f8('0x29')](respondWithResult(_0x18d863,null))['catch'](handleError(_0x18d863,null));};exports[_0x46f8('0x4d')]=function(_0x10971f,_0x2324c3,_0x34dc6e){return db[_0x46f8('0x43')][_0x46f8('0x4c')]({'where':{'id':_0x10971f['params']['id']},'attributes':[_0x46f8('0x2c'),_0x46f8('0x6')],'raw':!![]})[_0x46f8('0x29')](handleEntityNotFound(_0x2324c3,null))[_0x46f8('0x29')](function(_0x5ce3ec){if(_0x5ce3ec){var _0x171648=path[_0x46f8('0x4e')](config['root'],_0x46f8('0x4f'),util[_0x46f8('0x50')](_0x46f8('0x51'),path['basename'](_0x5ce3ec[_0x46f8('0x6')])));var _0x3f06bd=fs[_0x46f8('0x52')](_0x171648);var _0x3b541a=archiver(_0x46f8('0x53'),{'zlib':{'level':0x9}});_0x3b541a['on'](_0x46f8('0x54'),function(_0x48eafb){if(_0x48eafb[_0x46f8('0x55')]===_0x46f8('0x56')){logger[_0x46f8('0x57')](_0x48eafb);}else{throw new db[(_0x46f8('0x58'))][(_0x46f8('0x59'))](_0x46f8('0x5a'));}});_0x3b541a['on'](_0x46f8('0x57'),function(_0x286fa7){throw new db[(_0x46f8('0x58'))][(_0x46f8('0x59'))](_0x46f8('0x5a'));});_0x3b541a['pipe'](_0x3f06bd);_0x3b541a[_0x46f8('0x5b')](_0x46f8('0x5c'),{'cwd':path[_0x46f8('0x4e')](config['root'],_0x46f8('0x4f'),path[_0x46f8('0x5d')](_0x5ce3ec['path'])),'ignore':[path[_0x46f8('0x4e')](path['basename'](_0x5ce3ec['path']),_0x46f8('0x5e')),path['join'](path[_0x46f8('0x5f')](_0x5ce3ec['path']),_0x46f8('0x60'))],'nodir':!![]})[_0x46f8('0x61')]();_0x3f06bd['on'](_0x46f8('0x62'),function(){if(!fs[_0x46f8('0x63')](_0x171648)){throw new db[(_0x46f8('0x58'))][(_0x46f8('0x59'))](_0x46f8('0x64'));}return _0x2324c3[_0x46f8('0x4d')](_0x171648,util[_0x46f8('0x50')](_0x46f8('0x51'),path[_0x46f8('0x5f')](_0x5ce3ec['path'])),function(_0x3a93a5){if(_0x3a93a5){throw new db[(_0x46f8('0x58'))][(_0x46f8('0x59'))](_0x46f8('0x65'));}fs[_0x46f8('0x66')](_0x171648);logger[_0x46f8('0x67')]('Download\x20completed');logger[_0x46f8('0x67')](_0x46f8('0x68'));});});}return null;})[_0x46f8('0x47')](handleError(_0x2324c3,null));};exports[_0x46f8('0x69')]=function(_0x28532f,_0x447bfa,_0x3d7437){var _0x246f10=path[_0x46f8('0x5f')](_0x28532f[_0x46f8('0x6a')][_0x46f8('0x6b')],path['extname'](_0x28532f[_0x46f8('0x6a')][_0x46f8('0x6b')]));var _0x3fe224=path['join'](config[_0x46f8('0x6c')],_0x46f8('0x4f'),_0x28532f[_0x46f8('0x6a')][_0x46f8('0x6b')]);var _0x4d3f11=path[_0x46f8('0x4e')](config[_0x46f8('0x6c')],_0x46f8('0x4f'),_0x246f10);logger[_0x46f8('0x67')](_0x46f8('0x6d'),_0x3fe224);logger[_0x46f8('0x67')]('Plugin\x20upload\x20destination:\x20%s',_0x4d3f11);try{fs[_0x46f8('0x6e')](_0x3fe224,parseInt(_0x46f8('0x6f'),0x8));extract(_0x3fe224,{'dir':_0x4d3f11},function(_0x1fa125){if(_0x1fa125){logger[_0x46f8('0x57')](_0x1fa125);handleError(_0x1fa125,!![]);};var _0x13bea7=fs[_0x46f8('0x70')](_0x4d3f11);if(_0x13bea7[_0x46f8('0x39')]>0x1){removeReferences(_0x3fe224,_0x4d3f11);logger[_0x46f8('0x57')]('Invalid\x20plugin\x20structure');return _0x3d7437(new Error(_0x46f8('0x71')));}var _0x130696=fs[_0x46f8('0x72')](path[_0x46f8('0x4e')](_0x4d3f11,_0x13bea7[0x0]));if(_0x130696[_0x46f8('0x73')]()){removeReferences(_0x3fe224,_0x4d3f11);logger['error'](_0x46f8('0x71'));return _0x3d7437(new Error(_0x46f8('0x71')));}if(_0x130696[_0x46f8('0x74')]()){var _0x4ae8cf=fs[_0x46f8('0x70')](path[_0x46f8('0x4e')](_0x4d3f11,_0x13bea7[0x0]));if(_0x4ae8cf[_0x46f8('0x39')]===0x0){removeReferences(_0x3fe224,_0x4d3f11);logger['error']('Invalid\x20plugin\x20structure');return _0x3d7437(new Error(_0x46f8('0x71')));}var _0x2c75d4=_0x4ae8cf[_0x46f8('0x75')](function(_0x134f95){return _0x134f95===_0x46f8('0x76');});if(!_0x2c75d4){return _0x3d7437(new Error(_0x46f8('0x77')));}var _0x4fe8e0=fs[_0x46f8('0x78')](path[_0x46f8('0x4e')](_0x4d3f11,_0x13bea7[0x0],_0x46f8('0x76')));var _0x5791fb=JSON['parse'](_0x4fe8e0);if('undefined'==typeof _0x5791fb[_0x46f8('0x2c')]){return _0x3d7437(new Error(_0x46f8('0x79')));}if(_0x46f8('0x7a')==typeof _0x5791fb[_0x46f8('0x32')]){return _0x3d7437(new Error(_0x46f8('0x7b')));}if(_0x46f8('0x7a')==typeof _0x5791fb[_0x46f8('0x7c')]){return _0x3d7437(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x46f8('0x7a')==typeof _0x5791fb[_0x46f8('0x7d')]){return _0x3d7437(new Error(_0x46f8('0x7e')));}if(_0x5791fb['type']===_0x46f8('0x7f')){if(_0x46f8('0x7a')==typeof _0x5791fb[_0x46f8('0x7d')][_0x46f8('0x80')]){return _0x3d7437(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x5791fb[_0x46f8('0x7d')][_0x46f8('0x80')][_0x46f8('0x81')]&&_0x46f8('0x7a')==typeof _0x5791fb[_0x46f8('0x7d')][_0x46f8('0x80')][_0x46f8('0x82')]){return _0x3d7437(new Error(_0x46f8('0x83')));}}else if(_0x5791fb['type']===_0x46f8('0x84')){if(_0x46f8('0x7a')==typeof _0x5791fb[_0x46f8('0x7d')][_0x46f8('0x85')]){return _0x3d7437(new Error(_0x46f8('0x86')));}if(_0x46f8('0x7a')==typeof _0x5791fb[_0x46f8('0x7d')][_0x46f8('0x87')]){return _0x3d7437(new Error(_0x46f8('0x88')));}}else{return _0x3d7437(new Error(_0x46f8('0x89')));}var _0x1a7de2=_0x5791fb[_0x46f8('0x2c')];var _0x5271ad=_0x5791fb[_0x46f8('0x8a')];var _0x201ab4=_0x5791fb[_0x46f8('0x32')];var _0x2ac2cd=_0x5791fb[_0x46f8('0x8b')]?_0x5791fb[_0x46f8('0x8b')]:_0x46f8('0x8c');var _0x527468=_0x5791fb[_0x46f8('0x8d')]?_0x5791fb['icon']:_0x46f8('0x8e');var _0x2424e8='';var _0x5ef39b='';var _0x2a4931='';var _0x36e810='';var _0x2a87bf=_0x5791fb['version'];if(_0x201ab4==='html'){if(_0x46f8('0x7a')!=typeof _0x5791fb[_0x46f8('0x7d')][_0x46f8('0x80')]['admin']){var _0x536847=_0x5791fb[_0x46f8('0x7d')][_0x46f8('0x80')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x46f8('0x8f')](_0x536847)){_0x2424e8=path['join'](_0x46f8('0x90'),_0x246f10,_0x13bea7[0x0],_0x536847);}else{_0x2424e8=_0x536847;}}else{logger['info'](_0x46f8('0x91'));}if('undefined'!=typeof _0x5791fb['parameters'][_0x46f8('0x80')][_0x46f8('0x82')]){var _0x43cfc8=_0x5791fb['parameters']['views'][_0x46f8('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x46f8('0x8f')](_0x43cfc8)){_0x5ef39b=path[_0x46f8('0x4e')](_0x46f8('0x90'),_0x246f10,_0x13bea7[0x0],_0x43cfc8);}else{_0x5ef39b=_0x43cfc8;}}else{logger['info'](_0x46f8('0x92'));}}else if(_0x201ab4===_0x46f8('0x84')){_0x2a4931=_0x5791fb['parameters'][_0x46f8('0x85')];_0x36e810=_0x5791fb[_0x46f8('0x7d')][_0x46f8('0x87')];if(_0x46f8('0x7a')!=typeof _0x5791fb['parameters'][_0x46f8('0x80')]){if(_0x46f8('0x7a')!=typeof _0x5791fb[_0x46f8('0x7d')][_0x46f8('0x80')][_0x46f8('0x81')]){var _0x536847=_0x5791fb[_0x46f8('0x7d')]['views'][_0x46f8('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x536847)){_0x2424e8=path[_0x46f8('0x4e')](_0x46f8('0x90'),_0x246f10,_0x13bea7[0x0],_0x536847);}else{_0x2424e8=_0x536847;}}if(_0x46f8('0x7a')!=typeof _0x5791fb['parameters'][_0x46f8('0x80')][_0x46f8('0x82')]){var _0x43cfc8=_0x5791fb[_0x46f8('0x7d')][_0x46f8('0x80')][_0x46f8('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x46f8('0x8f')](_0x43cfc8)){_0x5ef39b=path[_0x46f8('0x4e')](_0x46f8('0x90'),_0x246f10,_0x13bea7[0x0],_0x43cfc8);}else{_0x5ef39b=_0x43cfc8;}}}}var _0x5008e8={'name':_0x1a7de2,'description':_0x5271ad,'path':path[_0x46f8('0x4e')](_0x246f10,_0x13bea7[0x0]),'type':_0x201ab4,'sidebar':_0x2ac2cd,'icon':_0x527468,'adminUrl':_0x2424e8,'agentUrl':_0x5ef39b,'scriptName':_0x2a4931,'scriptPath':_0x36e810,'version':_0x2a87bf};removeReferences(_0x3fe224,null);return db[_0x46f8('0x43')][_0x46f8('0x93')](_0x5008e8)[_0x46f8('0x29')](function(_0x19db29){var _0x3c47d3={'role':_0x28532f[_0x46f8('0x94')][_0x46f8('0x95')],'userProfileId':_0x28532f[_0x46f8('0x94')][_0x46f8('0x96')]};if(!_0x3c47d3)throw new Error(_0x46f8('0x97'));if(_0x3c47d3[_0x46f8('0x95')]===_0x46f8('0x98')){var _0x59a013=_0x19db29[_0x46f8('0x26')]({'plain':!![]});return db[_0x46f8('0x99')][_0x46f8('0x4c')]({'where':{'name':'Plugins','userProfileId':_0x3c47d3[_0x46f8('0x96')]},'raw':!![]})[_0x46f8('0x29')](function(_0x32f562){if(_0x32f562&&_0x32f562[_0x46f8('0x9a')]===0x0){return db[_0x46f8('0x28')][_0x46f8('0x93')]({'name':_0x59a013[_0x46f8('0x2c')],'resourceId':_0x59a013['id'],'type':_0x32f562['name'],'sectionId':_0x32f562['id']},{})['then'](function(){return _0x19db29;});}else{return _0x19db29;}})[_0x46f8('0x47')](function(_0x5507de){logger[_0x46f8('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5507de);throw _0x5507de;});}return _0x19db29;})[_0x46f8('0x29')](respondWithResult(_0x447bfa,null))[_0x46f8('0x47')](handleError(_0x447bfa,null));}});}catch(_0x293815){_0x447bfa[_0x46f8('0x1c')](0x1f4)['send'](_0x293815);}};function removeReferences(_0x313021,_0x1d7110){try{if(_0x313021){fs[_0x46f8('0x66')](_0x313021);logger[_0x46f8('0x67')](_0x46f8('0x9b'));}if(_0x1d7110){rimraf(_0x1d7110,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0xd274da){logger[_0x46f8('0x57')](_0xd274da);}}exports[_0x46f8('0x9c')]=function(_0x5baa25,_0x876d13,_0x34a785){return db[_0x46f8('0x43')][_0x46f8('0x4c')]({'where':{'id':_0x5baa25['params']['id']}})[_0x46f8('0x29')](handleEntityNotFound(_0x876d13,null))['then'](saveUpdates(_0x5baa25['body'],null))[_0x46f8('0x29')](respondWithResult(_0x876d13,null))[_0x46f8('0x47')](handleError(_0x876d13,null));};exports[_0x46f8('0x9d')]=function(_0x4b7142,_0x32ba24,_0x53fe31){return db[_0x46f8('0x43')][_0x46f8('0x4c')]({'where':{'id':_0x4b7142['params']['id']}})[_0x46f8('0x29')](function(_0x2b8e20){if(_0x2b8e20){return _0x2b8e20['destroy']();}})[_0x46f8('0x29')](function(_0x175051){rimraf(path['join'](config[_0x46f8('0x6c')],'server/files/plugins',path[_0x46f8('0x5d')](_0x175051[_0x46f8('0x6')])),function(){});return _0x175051;})[_0x46f8('0x29')](handleEntityNotFound(_0x32ba24,null))['then'](respondWithStatusCode(_0x32ba24,null))[_0x46f8('0x47')](handleError(_0x32ba24,null));};exports[_0x46f8('0x9e')]=function(_0x3ce39f,_0x4c146f,_0x3dd117){return BPromise['resolve']()['then'](function(){if(!_0x3ce39f[_0x46f8('0x35')][_0x46f8('0x6')]){throw new Error(_0x46f8('0x9f'));}if(!_0x3ce39f[_0x46f8('0x35')][_0x46f8('0xa0')]){throw new Error(_0x46f8('0xa1'));}var _0x283f31=_0x3ce39f[_0x46f8('0x35')][_0x46f8('0xa2')]?_0x3ce39f['query']['hostname']+':'+_0x3ce39f[_0x46f8('0x35')][_0x46f8('0xa0')]:_0x46f8('0xa3')+_0x3ce39f[_0x46f8('0x35')][_0x46f8('0xa0')];var _0x5ecb46=_0x3ce39f[_0x46f8('0x35')]['json']?_0x3ce39f[_0x46f8('0x35')][_0x46f8('0x22')]:!![];var _0x3fd702=_0x3ce39f[_0x46f8('0x35')]['encoding']?_0x3ce39f[_0x46f8('0x35')]['encoding']:null;var _0x1ac25e={'method':_0x3ce39f[_0x46f8('0xa4')],'uri':util['format']('%s%s',_0x283f31,_0x3ce39f[_0x46f8('0x35')][_0x46f8('0x6')]),'json':_0x5ecb46,'resolveWithFullResponse':!![],'encoding':_0x3fd702,'qs':_0x3ce39f[_0x46f8('0x35')]};if(_0x3ce39f[_0x46f8('0xa5')]){_0x1ac25e[_0x46f8('0xa5')]=_0x3ce39f[_0x46f8('0xa5')];if(_0x1ac25e[_0x46f8('0xa5')][_0x46f8('0xa6')]){delete _0x1ac25e['headers'][_0x46f8('0xa6')];}}if(_0x1ac25e[_0x46f8('0xa5')][_0x46f8('0xa7')]){delete _0x1ac25e[_0x46f8('0xa5')]['content-type'];}return rp(_0x1ac25e);})[_0x46f8('0x29')](function(_0x49b9c1){if(_0x49b9c1){_0x4c146f['set'](_0x49b9c1[_0x46f8('0xa5')]);logger[_0x46f8('0x67')](_0x49b9c1[_0x46f8('0x94')]);if(_[_0x46f8('0xa8')](_0x3ce39f[_0x46f8('0x35')][_0x46f8('0x6')],_0x46f8('0x4d'))&&_0x49b9c1[_0x46f8('0xa9')]==0x1f4){return _0x4c146f[_0x46f8('0x2a')](_0x49b9c1['statusCode']);}else{return _0x4c146f['status'](_0x49b9c1['statusCode'])[_0x46f8('0x2d')](_0x49b9c1[_0x46f8('0x94')]);}}else{return _0x4c146f[_0x46f8('0x2a')](0xc8);}})[_0x46f8('0x47')](handleError(_0x4c146f,null));};exports[_0x46f8('0xaa')]=function(_0x44b0fa,_0x4d2d70,_0x16ff56){return BPromise[_0x46f8('0xab')]()['then'](function(){if(!_0x44b0fa[_0x46f8('0x35')]['path']){throw new Error(_0x46f8('0x9f'));}if(!_0x44b0fa[_0x46f8('0x35')][_0x46f8('0xa0')]){throw new Error(_0x46f8('0xa1'));}var _0x180f12=_0x44b0fa[_0x46f8('0x35')][_0x46f8('0xa2')]?_0x44b0fa[_0x46f8('0x35')][_0x46f8('0xa2')]+':'+_0x44b0fa[_0x46f8('0x35')][_0x46f8('0xa0')]:_0x46f8('0xa3')+_0x44b0fa[_0x46f8('0x35')]['port'];var _0x3f3d64=_0x44b0fa['query']['json']?_0x44b0fa[_0x46f8('0x35')][_0x46f8('0x22')]:!![];var _0x47b05c=_0x44b0fa[_0x46f8('0x35')]['encoding']?_0x44b0fa[_0x46f8('0x35')]['encoding']:null;var _0x185524={'method':_0x44b0fa[_0x46f8('0xa4')],'uri':util[_0x46f8('0x50')]('%s%s',_0x180f12,_0x44b0fa[_0x46f8('0x35')]['path']),'json':_0x3f3d64,'resolveWithFullResponse':!![],'encoding':_0x47b05c,'body':_0x44b0fa[_0x46f8('0x94')]};if(_0x44b0fa['headers']){_0x185524[_0x46f8('0xa5')]=_0x44b0fa[_0x46f8('0xa5')];if(_0x185524[_0x46f8('0xa5')][_0x46f8('0xa6')]){delete _0x185524[_0x46f8('0xa5')][_0x46f8('0xa6')];}}if(_0x185524[_0x46f8('0xa5')][_0x46f8('0xa7')]){delete _0x185524['headers'][_0x46f8('0xa7')];}return rp(_0x185524);})[_0x46f8('0x29')](function(_0x47ee6f){if(_0x47ee6f){_0x4d2d70['set'](_0x47ee6f[_0x46f8('0xa5')]);logger[_0x46f8('0x67')](_0x47ee6f[_0x46f8('0x94')]);return _0x4d2d70[_0x46f8('0x1c')](_0x47ee6f['statusCode'])['send'](_0x47ee6f[_0x46f8('0x94')]);}else{return _0x4d2d70['sendStatus'](0xc8);}})[_0x46f8('0x47')](handleError(_0x4d2d70,null));}; \ No newline at end of file +var _0xb18e=['lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','hostname','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Plugin','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','length','find','catch','download','join','root','server/files/plugins','createWriteStream','zip','ENOENT','error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','basename','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure'];(function(_0x8e379,_0x31fc7d){var _0x542cde=function(_0x3e0061){while(--_0x3e0061){_0x8e379['push'](_0x8e379['shift']());}};_0x542cde(++_0x31fc7d);}(_0xb18e,0x189));var _0xeb18=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0xb18e[_0x28b0a1];return _0x21470c;};'use strict';var pdf=require(_0xeb18('0x0'));var emlformat=require(_0xeb18('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeb18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb18('0x3'));var moment=require(_0xeb18('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeb18('0x5'));var util=require('util');var path=require(_0xeb18('0x6'));var sox=require(_0xeb18('0x7'));var csv=require('to-csv');var ejs=require(_0xeb18('0x8'));var fs=require('fs');var _=require(_0xeb18('0x9'));var squel=require(_0xeb18('0xa'));var crypto=require('crypto');var jsforce=require(_0xeb18('0xb'));var deskjs=require(_0xeb18('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeb18('0xd'));var Papa=require(_0xeb18('0xe'));var extract=require(_0xeb18('0xf'));var rimraf=require(_0xeb18('0x10'));var archiver=require(_0xeb18('0x11'));var Redis=require(_0xeb18('0x12'));var authService=require(_0xeb18('0x13'));var qs=require(_0xeb18('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb18('0x15'));var logger=require('../../config/logger')(_0xeb18('0x16'));var utils=require('../../config/utils');var config=require(_0xeb18('0x17'));var db=require(_0xeb18('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0xeb18('0x19')](socket);function respondWithStatusCode(_0x567c07,_0x15dff3){_0x15dff3=_0x15dff3||0xcc;return function(_0xd00e23){if(_0xd00e23){return _0x567c07[_0xeb18('0x1a')](_0x15dff3);}return _0x567c07[_0xeb18('0x1b')](_0x15dff3)[_0xeb18('0x1c')]();};}function respondWithResult(_0x5672a1,_0x365507){_0x365507=_0x365507||0xc8;return function(_0x49f2d0){if(_0x49f2d0){return _0x5672a1[_0xeb18('0x1b')](_0x365507)[_0xeb18('0x1d')](_0x49f2d0);}};}function respondWithFilteredResult(_0x184a96,_0x107150){return function(_0x19ce8d){if(_0x19ce8d){var _0x5129b9=_0x19ce8d[_0xeb18('0x1e')],_0x588218=_0x107150[_0xeb18('0x1f')],_0xd2af3f=_0x107150[_0xeb18('0x1f')]+_0x107150[_0xeb18('0x20')],_0x54c42d;if(_0xd2af3f>=_0x5129b9){_0xd2af3f=_0x5129b9;_0x54c42d=0xc8;}else{_0x54c42d=0xce;}_0x184a96[_0xeb18('0x1b')](_0x54c42d);return _0x184a96[_0xeb18('0x21')](_0xeb18('0x22'),_0x588218+'-'+_0xd2af3f+'/'+_0x5129b9)[_0xeb18('0x1d')](_0x19ce8d);}return null;};}function patchUpdates(_0x597774){return function(_0x5c35ac){try{jsonpatch[_0xeb18('0x23')](_0x5c35ac,_0x597774,!![]);}catch(_0x5e4d1d){return BPromise[_0xeb18('0x24')](_0x5e4d1d);}return _0x5c35ac[_0xeb18('0x25')]();};}function saveUpdates(_0x426824,_0x1f189c){return function(_0x444444){if(_0x444444){return _0x444444[_0xeb18('0x26')](_0x426824)[_0xeb18('0x27')](function(_0x270102){return _0x270102;});}return null;};}function removeEntity(_0x2c6222,_0x1b02b0){return function(_0x3c3b3b){if(_0x3c3b3b){return _0x3c3b3b[_0xeb18('0x28')]()[_0xeb18('0x27')](function(){var _0x343336=_0x3c3b3b[_0xeb18('0x29')]({'plain':!![]});var _0xd55d1b='Plugins';return db[_0xeb18('0x2a')][_0xeb18('0x28')]({'where':{'type':_0xd55d1b,'resourceId':_0x343336['id']}})[_0xeb18('0x27')](function(){return _0x3c3b3b;});})[_0xeb18('0x27')](function(){_0x2c6222['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x188641,_0x31d8cc){return function(_0x13d456){if(!_0x13d456){_0x188641[_0xeb18('0x1a')](0x194);}return _0x13d456;};}function handleError(_0x1a96ff,_0x8c36a2){_0x8c36a2=_0x8c36a2||0x1f4;return function(_0x5728f5){logger['error'](_0x5728f5[_0xeb18('0x2b')]);if(_0x5728f5[_0xeb18('0x2c')]){delete _0x5728f5[_0xeb18('0x2c')];}_0x1a96ff[_0xeb18('0x1b')](_0x8c36a2)[_0xeb18('0x2d')](_0x5728f5);};}exports[_0xeb18('0x2e')]=function(_0xe79b3,_0x3c6235){var _0x33c0a9={},_0x2544d9={},_0x36dc1d={'count':0x0,'rows':[]};var _0x54b0f8=_[_0xeb18('0x2f')](db[_0xeb18('0x30')][_0xeb18('0x31')],function(_0x5e51f4){return{'name':_0x5e51f4['fieldName'],'type':_0x5e51f4[_0xeb18('0x32')]['key']};});_0x2544d9[_0xeb18('0x33')]=_[_0xeb18('0x2f')](_0x54b0f8,_0xeb18('0x2c'));_0x2544d9['query']=_[_0xeb18('0x34')](_0xe79b3[_0xeb18('0x35')]);_0x2544d9[_0xeb18('0x36')]=_[_0xeb18('0x37')](_0x2544d9[_0xeb18('0x33')],_0x2544d9[_0xeb18('0x35')]);_0x33c0a9[_0xeb18('0x38')]=_['intersection'](_0x2544d9[_0xeb18('0x33')],qs[_0xeb18('0x39')](_0xe79b3[_0xeb18('0x35')][_0xeb18('0x39')]));_0x33c0a9[_0xeb18('0x38')]=_0x33c0a9[_0xeb18('0x38')]['length']?_0x33c0a9['attributes']:_0x2544d9[_0xeb18('0x33')];if(!_0xe79b3[_0xeb18('0x35')][_0xeb18('0x3a')]('nolimit')){_0x33c0a9[_0xeb18('0x20')]=qs[_0xeb18('0x20')](_0xe79b3[_0xeb18('0x35')]['limit']);_0x33c0a9[_0xeb18('0x1f')]=qs[_0xeb18('0x1f')](_0xe79b3[_0xeb18('0x35')]['offset']);}_0x33c0a9[_0xeb18('0x3b')]=qs[_0xeb18('0x3c')](_0xe79b3[_0xeb18('0x35')][_0xeb18('0x3c')]);_0x33c0a9[_0xeb18('0x3d')]=qs['filters'](_[_0xeb18('0x3e')](_0xe79b3[_0xeb18('0x35')],_0x2544d9[_0xeb18('0x36')]),_0x54b0f8);if(_0xe79b3[_0xeb18('0x35')][_0xeb18('0x3f')]){_0x33c0a9[_0xeb18('0x3d')]=_[_0xeb18('0x40')](_0x33c0a9['where'],{'$or':_['map'](_0x54b0f8,function(_0x3f34fe){if(_0x3f34fe[_0xeb18('0x32')]!==_0xeb18('0x41')){var _0x515e35={};_0x515e35[_0x3f34fe[_0xeb18('0x2c')]]={'$like':'%'+_0xe79b3[_0xeb18('0x35')][_0xeb18('0x3f')]+'%'};return _0x515e35;}})});}_0x33c0a9=_[_0xeb18('0x40')]({},_0x33c0a9,_0xe79b3[_0xeb18('0x42')]);var _0x5395ee={'where':_0x33c0a9[_0xeb18('0x3d')]};return db[_0xeb18('0x30')]['count'](_0x5395ee)[_0xeb18('0x27')](function(_0x110b52){_0x36dc1d[_0xeb18('0x1e')]=_0x110b52;if(_0xe79b3[_0xeb18('0x35')][_0xeb18('0x43')]){_0x33c0a9[_0xeb18('0x44')]=[{'all':!![]}];}return db[_0xeb18('0x30')][_0xeb18('0x45')](_0x33c0a9);})[_0xeb18('0x27')](function(_0x4edd6b){_0x36dc1d['rows']=_0x4edd6b;return _0x36dc1d;})[_0xeb18('0x27')](respondWithFilteredResult(_0x3c6235,_0x33c0a9))['catch'](handleError(_0x3c6235,null));};exports['show']=function(_0x1e3601,_0x4c7c15){var _0x21de58={'raw':!![],'where':{'id':_0x1e3601[_0xeb18('0x46')]['id']}},_0x592cf4={};_0x592cf4[_0xeb18('0x33')]=_[_0xeb18('0x34')](db[_0xeb18('0x30')][_0xeb18('0x31')]);_0x592cf4[_0xeb18('0x35')]=_['keys'](_0x1e3601[_0xeb18('0x35')]);_0x592cf4[_0xeb18('0x36')]=_['intersection'](_0x592cf4[_0xeb18('0x33')],_0x592cf4[_0xeb18('0x35')]);_0x21de58[_0xeb18('0x38')]=_[_0xeb18('0x37')](_0x592cf4[_0xeb18('0x33')],qs[_0xeb18('0x39')](_0x1e3601[_0xeb18('0x35')][_0xeb18('0x39')]));_0x21de58[_0xeb18('0x38')]=_0x21de58[_0xeb18('0x38')][_0xeb18('0x47')]?_0x21de58['attributes']:_0x592cf4[_0xeb18('0x33')];if(_0x1e3601[_0xeb18('0x35')][_0xeb18('0x43')]){_0x21de58[_0xeb18('0x44')]=[{'all':!![]}];}_0x21de58=_[_0xeb18('0x40')]({},_0x21de58,_0x1e3601[_0xeb18('0x42')]);return db[_0xeb18('0x30')][_0xeb18('0x48')](_0x21de58)[_0xeb18('0x27')](handleEntityNotFound(_0x4c7c15,null))['then'](respondWithResult(_0x4c7c15,null))[_0xeb18('0x49')](handleError(_0x4c7c15,null));};exports[_0xeb18('0x4a')]=function(_0x1ce40b,_0x2e99a6,_0x26dec3){return db[_0xeb18('0x30')][_0xeb18('0x48')]({'where':{'id':_0x1ce40b[_0xeb18('0x46')]['id']},'attributes':['name',_0xeb18('0x6')],'raw':!![]})[_0xeb18('0x27')](handleEntityNotFound(_0x2e99a6,null))[_0xeb18('0x27')](function(_0x25f92f){if(_0x25f92f){var _0x400fce=path[_0xeb18('0x4b')](config[_0xeb18('0x4c')],_0xeb18('0x4d'),util['format']('%s.zip',path['basename'](_0x25f92f['path'])));var _0x794462=fs[_0xeb18('0x4e')](_0x400fce);var _0x3b8e55=archiver(_0xeb18('0x4f'),{'zlib':{'level':0x9}});_0x3b8e55['on']('warning',function(_0x533ac7){if(_0x533ac7['code']===_0xeb18('0x50')){logger[_0xeb18('0x51')](_0x533ac7);}else{throw new db[(_0xeb18('0x52'))]['Error'](_0xeb18('0x53'));}});_0x3b8e55['on'](_0xeb18('0x51'),function(_0x2128e5){throw new db[(_0xeb18('0x52'))][(_0xeb18('0x54'))](_0xeb18('0x53'));});_0x3b8e55[_0xeb18('0x55')](_0x794462);_0x3b8e55[_0xeb18('0x56')](_0xeb18('0x57'),{'cwd':path['join'](config['root'],_0xeb18('0x4d'),path[_0xeb18('0x58')](_0x25f92f[_0xeb18('0x6')])),'ignore':[path[_0xeb18('0x4b')](path['basename'](_0x25f92f['path']),_0xeb18('0x59')),path['join'](path['basename'](_0x25f92f['path']),'attachments/**/*')],'nodir':!![]})[_0xeb18('0x5a')]();_0x794462['on'](_0xeb18('0x5b'),function(){if(!fs[_0xeb18('0x5c')](_0x400fce)){throw new db[(_0xeb18('0x52'))]['Error'](_0xeb18('0x5d'));}return _0x2e99a6['download'](_0x400fce,util[_0xeb18('0x5e')]('%s.zip',path[_0xeb18('0x5f')](_0x25f92f[_0xeb18('0x6')])),function(_0x5e07b2){if(_0x5e07b2){throw new db['Sequelize'][(_0xeb18('0x54'))](_0xeb18('0x60'));}fs['unlinkSync'](_0x400fce);logger['info'](_0xeb18('0x61'));logger[_0xeb18('0x62')]('Temporary\x20file\x20removed');});});}return null;})[_0xeb18('0x49')](handleError(_0x2e99a6,null));};exports[_0xeb18('0x63')]=function(_0x12cb77,_0x422b33,_0x449ce6){var _0x426d96=path[_0xeb18('0x5f')](_0x12cb77['file'][_0xeb18('0x64')],path[_0xeb18('0x65')](_0x12cb77['file']['filename']));var _0x425aeb=path[_0xeb18('0x4b')](config[_0xeb18('0x4c')],_0xeb18('0x4d'),_0x12cb77[_0xeb18('0x66')][_0xeb18('0x64')]);var _0x517348=path[_0xeb18('0x4b')](config[_0xeb18('0x4c')],_0xeb18('0x4d'),_0x426d96);logger['info'](_0xeb18('0x67'),_0x425aeb);logger[_0xeb18('0x62')]('Plugin\x20upload\x20destination:\x20%s',_0x517348);try{fs[_0xeb18('0x68')](_0x425aeb,parseInt(_0xeb18('0x69'),0x8));extract(_0x425aeb,{'dir':_0x517348},function(_0x20810a){if(_0x20810a){logger[_0xeb18('0x51')](_0x20810a);handleError(_0x20810a,!![]);};var _0xca8ff9=fs[_0xeb18('0x6a')](_0x517348);if(_0xca8ff9['length']>0x1){removeReferences(_0x425aeb,_0x517348);logger[_0xeb18('0x51')](_0xeb18('0x6b'));return _0x449ce6(new Error(_0xeb18('0x6b')));}var _0x5ee149=fs[_0xeb18('0x6c')](path['join'](_0x517348,_0xca8ff9[0x0]));if(_0x5ee149[_0xeb18('0x6d')]()){removeReferences(_0x425aeb,_0x517348);logger['error']('Invalid\x20plugin\x20structure');return _0x449ce6(new Error(_0xeb18('0x6b')));}if(_0x5ee149[_0xeb18('0x6e')]()){var _0x2161b5=fs['readdirSync'](path['join'](_0x517348,_0xca8ff9[0x0]));if(_0x2161b5[_0xeb18('0x47')]===0x0){removeReferences(_0x425aeb,_0x517348);logger[_0xeb18('0x51')](_0xeb18('0x6b'));return _0x449ce6(new Error('Invalid\x20plugin\x20structure'));}var _0x3f5b2d=_0x2161b5[_0xeb18('0x6f')](function(_0x138c93){return _0x138c93===_0xeb18('0x70');});if(!_0x3f5b2d){return _0x449ce6(new Error(_0xeb18('0x71')));}var _0x16d26a=fs[_0xeb18('0x72')](path[_0xeb18('0x4b')](_0x517348,_0xca8ff9[0x0],_0xeb18('0x70')));var _0x37ec67=JSON[_0xeb18('0x73')](_0x16d26a);if(_0xeb18('0x74')==typeof _0x37ec67[_0xeb18('0x2c')]){return _0x449ce6(new Error(_0xeb18('0x75')));}if(_0xeb18('0x74')==typeof _0x37ec67[_0xeb18('0x32')]){return _0x449ce6(new Error(_0xeb18('0x76')));}if(_0xeb18('0x74')==typeof _0x37ec67[_0xeb18('0x77')]){return _0x449ce6(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xeb18('0x74')==typeof _0x37ec67[_0xeb18('0x78')]){return _0x449ce6(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x37ec67[_0xeb18('0x32')]===_0xeb18('0x79')){if(_0xeb18('0x74')==typeof _0x37ec67['parameters'][_0xeb18('0x7a')]){return _0x449ce6(new Error(_0xeb18('0x7b')));}if(_0xeb18('0x74')==typeof _0x37ec67['parameters'][_0xeb18('0x7a')][_0xeb18('0x7c')]&&'undefined'==typeof _0x37ec67['parameters'][_0xeb18('0x7a')][_0xeb18('0x7d')]){return _0x449ce6(new Error(_0xeb18('0x7e')));}}else if(_0x37ec67['type']===_0xeb18('0x7f')){if('undefined'==typeof _0x37ec67[_0xeb18('0x78')][_0xeb18('0x80')]){return _0x449ce6(new Error(_0xeb18('0x81')));}if(_0xeb18('0x74')==typeof _0x37ec67[_0xeb18('0x78')][_0xeb18('0x82')]){return _0x449ce6(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x449ce6(new Error(_0xeb18('0x83')));}var _0x5a79bf=_0x37ec67[_0xeb18('0x2c')];var _0x384a1f=_0x37ec67['description'];var _0x4fa03e=_0x37ec67['type'];var _0x51ae62=_0x37ec67[_0xeb18('0x84')]?_0x37ec67['sidebar']:_0xeb18('0x85');var _0x127d51=_0x37ec67[_0xeb18('0x86')]?_0x37ec67['icon']:_0xeb18('0x87');var _0x159f48='';var _0x44b2de='';var _0x311a3c='';var _0x10d667='';var _0x583556=_0x37ec67['version'];if(_0x4fa03e===_0xeb18('0x79')){if(_0xeb18('0x74')!=typeof _0x37ec67['parameters'][_0xeb18('0x7a')]['admin']){var _0x4979f4=_0x37ec67['parameters'][_0xeb18('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4979f4)){_0x159f48=path['join'](_0xeb18('0x88'),_0x426d96,_0xca8ff9[0x0],_0x4979f4);}else{_0x159f48=_0x4979f4;}}else{logger[_0xeb18('0x62')](_0xeb18('0x89'));}if(_0xeb18('0x74')!=typeof _0x37ec67[_0xeb18('0x78')]['views'][_0xeb18('0x7d')]){var _0x4f26c6=_0x37ec67[_0xeb18('0x78')][_0xeb18('0x7a')][_0xeb18('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xeb18('0x8a')](_0x4f26c6)){_0x44b2de=path['join']('plugins',_0x426d96,_0xca8ff9[0x0],_0x4f26c6);}else{_0x44b2de=_0x4f26c6;}}else{logger[_0xeb18('0x62')](_0xeb18('0x8b'));}}else if(_0x4fa03e===_0xeb18('0x7f')){_0x311a3c=_0x37ec67['parameters'][_0xeb18('0x80')];_0x10d667=_0x37ec67[_0xeb18('0x78')]['scriptPath'];if(_0xeb18('0x74')!=typeof _0x37ec67['parameters']['views']){if('undefined'!=typeof _0x37ec67[_0xeb18('0x78')][_0xeb18('0x7a')]['admin']){var _0x4979f4=_0x37ec67['parameters'][_0xeb18('0x7a')][_0xeb18('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4979f4)){_0x159f48=path[_0xeb18('0x4b')](_0xeb18('0x88'),_0x426d96,_0xca8ff9[0x0],_0x4979f4);}else{_0x159f48=_0x4979f4;}}if(_0xeb18('0x74')!=typeof _0x37ec67[_0xeb18('0x78')][_0xeb18('0x7a')][_0xeb18('0x7d')]){var _0x4f26c6=_0x37ec67['parameters'][_0xeb18('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xeb18('0x8a')](_0x4f26c6)){_0x44b2de=path[_0xeb18('0x4b')](_0xeb18('0x88'),_0x426d96,_0xca8ff9[0x0],_0x4f26c6);}else{_0x44b2de=_0x4f26c6;}}}}var _0x5d20cb={'name':_0x5a79bf,'description':_0x384a1f,'path':path[_0xeb18('0x4b')](_0x426d96,_0xca8ff9[0x0]),'type':_0x4fa03e,'sidebar':_0x51ae62,'icon':_0x127d51,'adminUrl':_0x159f48,'agentUrl':_0x44b2de,'scriptName':_0x311a3c,'scriptPath':_0x10d667,'version':_0x583556};removeReferences(_0x425aeb,null);return db[_0xeb18('0x30')]['create'](_0x5d20cb)[_0xeb18('0x27')](function(_0xebccb4){var _0x4848ee={'role':_0x12cb77[_0xeb18('0x8c')]['role'],'userProfileId':_0x12cb77['body']['userProfileId']};if(!_0x4848ee)throw new Error(_0xeb18('0x8d'));if(_0x4848ee[_0xeb18('0x8e')]===_0xeb18('0x8f')){var _0x31d696=_0xebccb4['get']({'plain':!![]});return db[_0xeb18('0x90')][_0xeb18('0x48')]({'where':{'name':_0xeb18('0x91'),'userProfileId':_0x4848ee['userProfileId']},'raw':!![]})['then'](function(_0x395fe4){if(_0x395fe4&&_0x395fe4[_0xeb18('0x92')]===0x0){return db[_0xeb18('0x2a')]['create']({'name':_0x31d696['name'],'resourceId':_0x31d696['id'],'type':_0x395fe4['name'],'sectionId':_0x395fe4['id']},{})[_0xeb18('0x27')](function(){return _0xebccb4;});}else{return _0xebccb4;}})[_0xeb18('0x49')](function(_0x2cd8f3){logger[_0xeb18('0x51')](_0xeb18('0x93'),_0x2cd8f3);throw _0x2cd8f3;});}return _0xebccb4;})[_0xeb18('0x27')](respondWithResult(_0x422b33,null))[_0xeb18('0x49')](handleError(_0x422b33,null));}});}catch(_0x274b72){_0x422b33[_0xeb18('0x1b')](0x1f4)[_0xeb18('0x2d')](_0x274b72);}};function removeReferences(_0x188a4d,_0x1d72df){try{if(_0x188a4d){fs[_0xeb18('0x94')](_0x188a4d);logger[_0xeb18('0x62')](_0xeb18('0x95'));}if(_0x1d72df){rimraf(_0x1d72df,function(){});logger[_0xeb18('0x62')](_0xeb18('0x96'));}}catch(_0x1a305c){logger[_0xeb18('0x51')](_0x1a305c);}}exports[_0xeb18('0x26')]=function(_0x377f24,_0x2c28a3,_0x486407){return db[_0xeb18('0x30')]['find']({'where':{'id':_0x377f24[_0xeb18('0x46')]['id']}})[_0xeb18('0x27')](handleEntityNotFound(_0x2c28a3,null))[_0xeb18('0x27')](saveUpdates(_0x377f24[_0xeb18('0x8c')],null))[_0xeb18('0x27')](respondWithResult(_0x2c28a3,null))[_0xeb18('0x49')](handleError(_0x2c28a3,null));};exports[_0xeb18('0x97')]=function(_0x563e44,_0x4e20a1,_0x3f2fd4){return db['Plugin'][_0xeb18('0x48')]({'where':{'id':_0x563e44[_0xeb18('0x46')]['id']}})[_0xeb18('0x27')](function(_0x1e1c7d){if(_0x1e1c7d){return _0x1e1c7d[_0xeb18('0x28')]();}})[_0xeb18('0x27')](function(_0x2c453a){rimraf(path['join'](config[_0xeb18('0x4c')],'server/files/plugins',path[_0xeb18('0x58')](_0x2c453a[_0xeb18('0x6')])),function(){});return _0x2c453a;})[_0xeb18('0x27')](handleEntityNotFound(_0x4e20a1,null))[_0xeb18('0x27')](respondWithStatusCode(_0x4e20a1,null))[_0xeb18('0x49')](handleError(_0x4e20a1,null));};exports['webhookGet']=function(_0x3bbc45,_0x3da2a3,_0x4c556f){return BPromise['resolve']()[_0xeb18('0x27')](function(){if(!_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x6')]){throw new Error(_0xeb18('0x98'));}if(!_0x3bbc45[_0xeb18('0x35')]['port']){throw new Error(_0xeb18('0x99'));}var _0x32d483=_0x3bbc45[_0xeb18('0x35')]['hostname']?_0x3bbc45[_0xeb18('0x35')]['hostname']+':'+_0x3bbc45['query'][_0xeb18('0x9a')]:_0xeb18('0x9b')+_0x3bbc45['query']['port'];var _0x29a8ca=_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x1d')]?_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x1d')]:!![];var _0x5252a2=_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x9c')]?_0x3bbc45[_0xeb18('0x35')]['encoding']:null;var _0xcb882a={'method':_0x3bbc45[_0xeb18('0x9d')],'uri':util['format'](_0xeb18('0x9e'),_0x32d483,_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x6')]),'json':_0x29a8ca,'resolveWithFullResponse':!![],'encoding':_0x5252a2,'qs':_0x3bbc45[_0xeb18('0x35')]};if(_0x3bbc45[_0xeb18('0x9f')]){_0xcb882a[_0xeb18('0x9f')]=_0x3bbc45[_0xeb18('0x9f')];if(_0xcb882a[_0xeb18('0x9f')]['content-length']){delete _0xcb882a[_0xeb18('0x9f')][_0xeb18('0xa0')];}}if(_0xcb882a['headers'][_0xeb18('0xa1')]){delete _0xcb882a[_0xeb18('0x9f')][_0xeb18('0xa1')];}return rp(_0xcb882a);})[_0xeb18('0x27')](function(_0x41943a){if(_0x41943a){_0x3da2a3[_0xeb18('0x21')](_0x41943a[_0xeb18('0x9f')]);logger['info'](_0x41943a[_0xeb18('0x8c')]);if(_[_0xeb18('0xa2')](_0x3bbc45[_0xeb18('0x35')][_0xeb18('0x6')],'download')&&_0x41943a[_0xeb18('0xa3')]==0x1f4){return _0x3da2a3[_0xeb18('0x1a')](_0x41943a['statusCode']);}else{return _0x3da2a3['status'](_0x41943a[_0xeb18('0xa3')])[_0xeb18('0x2d')](_0x41943a[_0xeb18('0x8c')]);}}else{return _0x3da2a3[_0xeb18('0x1a')](0xc8);}})[_0xeb18('0x49')](handleError(_0x3da2a3,null));};exports[_0xeb18('0xa4')]=function(_0x1b9a3f,_0x251c66,_0x135d6c){return BPromise[_0xeb18('0xa5')]()[_0xeb18('0x27')](function(){if(!_0x1b9a3f[_0xeb18('0x35')]['path']){throw new Error(_0xeb18('0x98'));}if(!_0x1b9a3f[_0xeb18('0x35')][_0xeb18('0x9a')]){throw new Error(_0xeb18('0x99'));}var _0x1c3da5=_0x1b9a3f[_0xeb18('0x35')][_0xeb18('0xa6')]?_0x1b9a3f[_0xeb18('0x35')][_0xeb18('0xa6')]+':'+_0x1b9a3f[_0xeb18('0x35')][_0xeb18('0x9a')]:_0xeb18('0x9b')+_0x1b9a3f['query'][_0xeb18('0x9a')];var _0x5b1af4=_0x1b9a3f['query']['json']?_0x1b9a3f['query'][_0xeb18('0x1d')]:!![];var _0x7703e6=_0x1b9a3f['query'][_0xeb18('0x9c')]?_0x1b9a3f['query'][_0xeb18('0x9c')]:null;var _0x10a49e={'method':_0x1b9a3f[_0xeb18('0x9d')],'uri':util['format'](_0xeb18('0x9e'),_0x1c3da5,_0x1b9a3f[_0xeb18('0x35')][_0xeb18('0x6')]),'json':_0x5b1af4,'resolveWithFullResponse':!![],'encoding':_0x7703e6,'body':_0x1b9a3f[_0xeb18('0x8c')]};if(_0x1b9a3f['headers']){_0x10a49e['headers']=_0x1b9a3f[_0xeb18('0x9f')];if(_0x10a49e['headers'][_0xeb18('0xa0')]){delete _0x10a49e['headers'][_0xeb18('0xa0')];}}if(_0x10a49e[_0xeb18('0x9f')][_0xeb18('0xa1')]){delete _0x10a49e[_0xeb18('0x9f')][_0xeb18('0xa1')];}return rp(_0x10a49e);})[_0xeb18('0x27')](function(_0x21f0da){if(_0x21f0da){_0x251c66['set'](_0x21f0da[_0xeb18('0x9f')]);logger[_0xeb18('0x62')](_0x21f0da[_0xeb18('0x8c')]);return _0x251c66[_0xeb18('0x1b')](_0x21f0da[_0xeb18('0xa3')])[_0xeb18('0x2d')](_0x21f0da[_0xeb18('0x8c')]);}else{return _0x251c66[_0xeb18('0x1a')](0xc8);}})['catch'](handleError(_0x251c66,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 9262def..a92889b 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 _0xd117=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xfa73ac,_0x2a7395){var _0x4e8e14=function(_0x9b5698){while(--_0x9b5698){_0xfa73ac['push'](_0xfa73ac['shift']());}};_0x4e8e14(++_0x2a7395);}(_0xd117,0x182));var _0x7d11=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xd117[_0x39106e];return _0x892aec;};'use strict';var EventEmitter=require(_0x7d11('0x0'));var Plugin=require(_0x7d11('0x1'))['db'][_0x7d11('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x7d11('0x3')](0x0);var events={'afterCreate':_0x7d11('0x4'),'afterUpdate':_0x7d11('0x5'),'afterDestroy':_0x7d11('0x6')};function emitEvent(_0x254bb4){return function(_0x3c07be,_0x31fcb0,_0x589c51){PluginEvents[_0x7d11('0x7')](_0x254bb4+':'+_0x3c07be['id'],_0x3c07be);PluginEvents[_0x7d11('0x7')](_0x254bb4,_0x3c07be);_0x589c51(null);};}for(var e in events){if(events[_0x7d11('0x8')](e)){var event=events[e];Plugin[_0x7d11('0x9')](e,emitEvent(event));}}module[_0x7d11('0xa')]=PluginEvents; \ No newline at end of file +var _0x781d=['hasOwnProperty','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x781d,0x14a));var _0xd781=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x781d[_0x3bf83f];return _0x22c4a9;};'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 7df0d1a..8e5602c 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 _0x9c0f=['request-promise','path','../../config/environment','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x9c0f,0x1c1));var _0xf9c0=function(_0x3d131a,_0x2ee691){_0x3d131a=_0x3d131a-0x0;var _0x44c22d=_0x9c0f[_0x3d131a];return _0x44c22d;};'use strict';var _=require(_0xf9c0('0x0'));var util=require(_0xf9c0('0x1'));var logger=require(_0xf9c0('0x2'))(_0xf9c0('0x3'));var moment=require(_0xf9c0('0x4'));var BPromise=require(_0xf9c0('0x5'));var rp=require(_0xf9c0('0x6'));var fs=require('fs');var path=require(_0xf9c0('0x7'));var rimraf=require('rimraf');var config=require(_0xf9c0('0x8'));var attributes=require('./plugin.attributes');module[_0xf9c0('0x9')]=function(_0x4df646,_0x1903f3){return _0x4df646[_0xf9c0('0xa')](_0xf9c0('0xb'),attributes,{'tableName':_0xf9c0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b24=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Plugin','plugins'];(function(_0x4c0c0d,_0x564581){var _0x21a5d3=function(_0x22b1ce){while(--_0x22b1ce){_0x4c0c0d['push'](_0x4c0c0d['shift']());}};_0x21a5d3(++_0x564581);}(_0x9b24,0x145));var _0x49b2=function(_0x58578f,_0x3fcf7c){_0x58578f=_0x58578f-0x0;var _0x1702e7=_0x9b24[_0x58578f];return _0x1702e7;};'use strict';var _=require(_0x49b2('0x0'));var util=require(_0x49b2('0x1'));var logger=require(_0x49b2('0x2'))(_0x49b2('0x3'));var moment=require(_0x49b2('0x4'));var BPromise=require(_0x49b2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49b2('0x6'));var rimraf=require(_0x49b2('0x7'));var config=require(_0x49b2('0x8'));var attributes=require('./plugin.attributes');module[_0x49b2('0x9')]=function(_0x465654,_0x14a81f){return _0x465654[_0x49b2('0xa')](_0x49b2('0xb'),attributes,{'tableName':_0x49b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 1454391..7f8f8fc 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 _0x5c45=['Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreatePlugin','Plugin','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5f2c2e,_0x82b99b){var _0x2e2958=function(_0x30b3da){while(--_0x30b3da){_0x5f2c2e['push'](_0x5f2c2e['shift']());}};_0x2e2958(++_0x82b99b);}(_0x5c45,0x13d));var _0x55c4=function(_0x20ee67,_0x1b0c93){_0x20ee67=_0x20ee67-0x0;var _0x4a4ab3=_0x5c45[_0x20ee67];return _0x4a4ab3;};'use strict';var _=require(_0x55c4('0x0'));var util=require(_0x55c4('0x1'));var moment=require(_0x55c4('0x2'));var BPromise=require(_0x55c4('0x3'));var rs=require(_0x55c4('0x4'));var fs=require('fs');var Redis=require(_0x55c4('0x5'));var db=require(_0x55c4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x55c4('0x7'))(_0x55c4('0x8'));var config=require(_0x55c4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x55c4('0xa')][_0x55c4('0xb')]({'port':0x232a});config[_0x55c4('0xc')]=_['defaults'](config['redis'],{'host':_0x55c4('0xd'),'port':0x18eb});var socket=require(_0x55c4('0xe'))(new Redis(config[_0x55c4('0xc')]));require(_0x55c4('0xf'))[_0x55c4('0x10')](socket);function respondWithRpcPromise(_0x71b8,_0xb71e0d,_0x588d6a){return new BPromise(function(_0x2a5b00,_0x237dba){return client[_0x55c4('0x11')](_0x71b8,_0x588d6a)[_0x55c4('0x12')](function(_0x32057c){logger[_0x55c4('0x13')](_0x55c4('0x14'),_0xb71e0d,_0x55c4('0x15'));logger[_0x55c4('0x16')](_0x55c4('0x17'),_0xb71e0d,_0x55c4('0x15'),JSON[_0x55c4('0x18')](_0x32057c));if(_0x32057c[_0x55c4('0x19')]){if(_0x32057c[_0x55c4('0x19')]['code']===0x1f4){logger['error'](_0x55c4('0x14'),_0xb71e0d,_0x32057c[_0x55c4('0x19')][_0x55c4('0x1a')]);return _0x237dba(_0x32057c['error'][_0x55c4('0x1a')]);}logger['error'](_0x55c4('0x14'),_0xb71e0d,_0x32057c['error'][_0x55c4('0x1a')]);return _0x2a5b00(_0x32057c[_0x55c4('0x19')]['message']);}else{logger[_0x55c4('0x13')](_0x55c4('0x14'),_0xb71e0d,_0x55c4('0x15'));_0x2a5b00(_0x32057c[_0x55c4('0x1b')]['message']);}})['catch'](function(_0x504d86){logger[_0x55c4('0x19')]('Plugin,\x20%s,\x20%s',_0xb71e0d,_0x504d86);_0x237dba(_0x504d86);});});}exports[_0x55c4('0x1c')]=function(_0x383ec3){var _0x430857=this;return new Promise(function(_0x2b6236,_0x221acc){return db[_0x55c4('0x1d')]['create'](_0x383ec3[_0x55c4('0x1e')],{'raw':_0x383ec3[_0x55c4('0x1f')]?_0x383ec3[_0x55c4('0x1f')][_0x55c4('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x75073b){logger[_0x55c4('0x13')](_0x55c4('0x1c'),_0x383ec3);logger[_0x55c4('0x16')](_0x55c4('0x1c'),_0x383ec3,JSON['stringify'](_0x75073b));_0x2b6236(_0x75073b);})[_0x55c4('0x21')](function(_0x55169f){logger['error'](_0x55c4('0x1c'),_0x55169f['message'],_0x383ec3);_0x221acc(_0x430857[_0x55c4('0x19')](0x1f4,_0x55169f[_0x55c4('0x1a')]));});});}; \ No newline at end of file +var _0xf133=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','request\x20sent','result','catch','CreatePlugin','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x321888,_0x39b754){var _0x438e7=function(_0x262aa5){while(--_0x262aa5){_0x321888['push'](_0x321888['shift']());}};_0x438e7(++_0x39b754);}(_0xf133,0xb3));var _0x3f13=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf133[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3f13('0x0'));var util=require('util');var moment=require(_0x3f13('0x1'));var BPromise=require(_0x3f13('0x2'));var rs=require(_0x3f13('0x3'));var fs=require('fs');var Redis=require(_0x3f13('0x4'));var db=require(_0x3f13('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3f13('0x6'));var config=require(_0x3f13('0x7'));var jayson=require(_0x3f13('0x8'));var client=jayson[_0x3f13('0x9')][_0x3f13('0xa')]({'port':0x232a});config[_0x3f13('0xb')]=_[_0x3f13('0xc')](config[_0x3f13('0xb')],{'host':_0x3f13('0xd'),'port':0x18eb});var socket=require(_0x3f13('0xe'))(new Redis(config[_0x3f13('0xb')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x4dceda,_0xc5067e,_0x7e4501){return new BPromise(function(_0x5ac8d8,_0x3b9c29){return client['request'](_0x4dceda,_0x7e4501)[_0x3f13('0xf')](function(_0x48722a){logger[_0x3f13('0x10')]('Plugin,\x20%s,\x20%s',_0xc5067e,'request\x20sent');logger[_0x3f13('0x11')](_0x3f13('0x12'),_0xc5067e,'request\x20sent',JSON[_0x3f13('0x13')](_0x48722a));if(_0x48722a['error']){if(_0x48722a[_0x3f13('0x14')][_0x3f13('0x15')]===0x1f4){logger[_0x3f13('0x14')](_0x3f13('0x16'),_0xc5067e,_0x48722a['error'][_0x3f13('0x17')]);return _0x3b9c29(_0x48722a['error'][_0x3f13('0x17')]);}logger[_0x3f13('0x14')]('Plugin,\x20%s,\x20%s',_0xc5067e,_0x48722a[_0x3f13('0x14')][_0x3f13('0x17')]);return _0x5ac8d8(_0x48722a[_0x3f13('0x14')][_0x3f13('0x17')]);}else{logger[_0x3f13('0x10')]('Plugin,\x20%s,\x20%s',_0xc5067e,_0x3f13('0x18'));_0x5ac8d8(_0x48722a[_0x3f13('0x19')][_0x3f13('0x17')]);}})[_0x3f13('0x1a')](function(_0x18f5dc){logger['error'](_0x3f13('0x16'),_0xc5067e,_0x18f5dc);_0x3b9c29(_0x18f5dc);});});}exports[_0x3f13('0x1b')]=function(_0x1cd498){var _0x1833e9=this;return new Promise(function(_0xc5e66f,_0x3af7e2){return db['Plugin'][_0x3f13('0x1c')](_0x1cd498['body'],{'raw':_0x1cd498[_0x3f13('0x1d')]?_0x1cd498[_0x3f13('0x1d')][_0x3f13('0x1e')]===undefined?!![]:![]:!![]})[_0x3f13('0xf')](function(_0x3297eb){logger['info']('CreatePlugin',_0x1cd498);logger[_0x3f13('0x11')](_0x3f13('0x1b'),_0x1cd498,JSON[_0x3f13('0x13')](_0x3297eb));_0xc5e66f(_0x3297eb);})[_0x3f13('0x1a')](function(_0x4fdf98){logger[_0x3f13('0x14')]('CreatePlugin',_0x4fdf98[_0x3f13('0x17')],_0x1cd498);_0x3af7e2(_0x1833e9[_0x3f13('0x14')](0x1f4,_0x4fdf98[_0x3f13('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index e0f8847..d944999 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 _0x3c2c=['register','length','./plugin.events','save','remove','update','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3c2c,0x160));var _0xc3c2=function(_0x5616b0,_0x14ac3b){_0x5616b0=_0x5616b0-0x0;var _0x502d8b=_0x3c2c[_0x5616b0];return _0x502d8b;};'use strict';var PluginEvents=require(_0xc3c2('0x0'));var events=[_0xc3c2('0x1'),_0xc3c2('0x2'),_0xc3c2('0x3')];function createListener(_0x59a8c0,_0x481bf9){return function(_0x321ef5){_0x481bf9[_0xc3c2('0x4')](_0x59a8c0,_0x321ef5);};}function removeListener(_0x2f4e7e,_0x3bb44f){return function(){PluginEvents['removeListener'](_0x2f4e7e,_0x3bb44f);};}exports[_0xc3c2('0x5')]=function(_0x158a5f){for(var _0x234da9=0x0,_0x21fa50=events[_0xc3c2('0x6')];_0x234da9<_0x21fa50;_0x234da9++){var _0x48cab1=events[_0x234da9];var _0x5daa76=createListener('plugin:'+_0x48cab1,_0x158a5f);PluginEvents['on'](_0x48cab1,_0x5daa76);}}; \ No newline at end of file +var _0xd7e0=['removeListener','register','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x3b8a5b,_0x238cb5){var _0x26acb5=function(_0xe0ee0b){while(--_0xe0ee0b){_0x3b8a5b['push'](_0x3b8a5b['shift']());}};_0x26acb5(++_0x238cb5);}(_0xd7e0,0xb3));var _0x0d7e=function(_0x495e65,_0x5375e4){_0x495e65=_0x495e65-0x0;var _0x518b5d=_0xd7e0[_0x495e65];return _0x518b5d;};'use strict';var PluginEvents=require(_0x0d7e('0x0'));var events=[_0x0d7e('0x1'),_0x0d7e('0x2'),_0x0d7e('0x3')];function createListener(_0x4cd800,_0x272b61){return function(_0x10956f){_0x272b61[_0x0d7e('0x4')](_0x4cd800,_0x10956f);};}function removeListener(_0x16f266,_0x4f4641){return function(){PluginEvents[_0x0d7e('0x5')](_0x16f266,_0x4f4641);};}exports[_0x0d7e('0x6')]=function(_0x287b21){for(var _0x112bd5=0x0,_0x2d0db2=events['length'];_0x112bd5<_0x2d0db2;_0x112bd5++){var _0x49581d=events[_0x112bd5];var _0x5d1084=createListener(_0x0d7e('0x7')+_0x49581d,_0x287b21);PluginEvents['on'](_0x49581d,_0x5d1084);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 6414a84..b5b0527 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 _0x7b27=['./pm2.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','express','Router','../../components/auth/service'];(function(_0x2f9806,_0x174012){var _0x2e8c64=function(_0x103fd1){while(--_0x103fd1){_0x2f9806['push'](_0x2f9806['shift']());}};_0x2e8c64(++_0x174012);}(_0x7b27,0x107));var _0x77b2=function(_0x4678fb,_0x118a45){_0x4678fb=_0x4678fb-0x0;var _0x5db241=_0x7b27[_0x4678fb];return _0x5db241;};'use strict';var express=require(_0x77b2('0x0'));var router=express[_0x77b2('0x1')]();var auth=require(_0x77b2('0x2'));var controller=require(_0x77b2('0x3'));router[_0x77b2('0x4')]('/',auth[_0x77b2('0x5')](),controller[_0x77b2('0x6')]);router[_0x77b2('0x4')](_0x77b2('0x7'),auth[_0x77b2('0x5')](),controller[_0x77b2('0x8')]);router[_0x77b2('0x9')]('/',auth[_0x77b2('0x5')](),controller['create']);router[_0x77b2('0xa')](_0x77b2('0x7'),auth[_0x77b2('0x5')](),controller[_0x77b2('0xb')]);router[_0x77b2('0xc')]('/:id',auth[_0x77b2('0x5')](),controller['destroy']);module[_0x77b2('0xd')]=router; \ No newline at end of file +var _0x727f=['update','delete','exports','./pm2.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x3d7c8e,_0x2c0844){var _0x35eebb=function(_0x5221b1){while(--_0x5221b1){_0x3d7c8e['push'](_0x3d7c8e['shift']());}};_0x35eebb(++_0x2c0844);}(_0x727f,0xa8));var _0xf727=function(_0x2bd9be,_0x58a38d){_0x2bd9be=_0x2bd9be-0x0;var _0x4db59e=_0x727f[_0x2bd9be];return _0x4db59e;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xf727('0x0'));router[_0xf727('0x1')]('/',auth[_0xf727('0x2')](),controller[_0xf727('0x3')]);router[_0xf727('0x1')](_0xf727('0x4'),auth['isAuthenticated'](),controller[_0xf727('0x5')]);router[_0xf727('0x6')]('/',auth[_0xf727('0x2')](),controller['create']);router[_0xf727('0x7')](_0xf727('0x4'),auth[_0xf727('0x2')](),controller[_0xf727('0x8')]);router[_0xf727('0x9')](_0xf727('0x4'),auth[_0xf727('0x2')](),controller['destroy']);module[_0xf727('0xa')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 12c0527..c25c81f 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 _0xc070=['path','exec','bluebird','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','create','body','script','../../files/plugins','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','params','Unknown\x20status','delete','dump','lodash','../../config/pm2','../../config/logger','api'];(function(_0x54a079,_0x52c602){var _0x2d6a3f=function(_0x39e070){while(--_0x39e070){_0x54a079['push'](_0x54a079['shift']());}};_0x2d6a3f(++_0x52c602);}(_0xc070,0xbf));var _0x0c07=function(_0x3f3296,_0x15fe95){_0x3f3296=_0x3f3296-0x0;var _0x4f146a=_0xc070[_0x3f3296];return _0x4f146a;};'use strict';var _=require(_0x0c07('0x0'));var pm2=require(_0x0c07('0x1'));var logger=require(_0x0c07('0x2'))(_0x0c07('0x3'));var path=require(_0x0c07('0x4'));var exec=require('child_process')[_0x0c07('0x5')];var BPromise=require(_0x0c07('0x6'));function handleEntityNotFound(_0x34476b,_0x4e0199){return function(_0x1d0fb0){if(!_0x1d0fb0){_0x34476b[_0x0c07('0x7')](0x194);;}return _0x1d0fb0;};}function respondWithResult(_0x2ac7c6,_0x240b84){_0x240b84=_0x240b84||0xc8;return function(_0x9d1e9e){if(_0x9d1e9e){return _0x2ac7c6['status'](_0x240b84)[_0x0c07('0x8')](_0x9d1e9e);}return null;};}function handleError(_0x13859d,_0x98ef82){_0x98ef82=_0x98ef82||0x1f4;return function(_0x138648){logger[_0x0c07('0x9')](_0x138648[_0x0c07('0xa')]);if(_0x138648['name']){delete _0x138648[_0x0c07('0xb')];}_0x13859d[_0x0c07('0xc')](_0x98ef82)[_0x0c07('0xd')](_0x138648);};}function execChildProcess(){return new BPromise(function(_0x4dd377,_0x25cd39){exec(_0x0c07('0xe'),function(_0x1f2d2b,_0x2e8a97,_0x4354b0){logger[_0x0c07('0xf')](_0x2e8a97);logger[_0x0c07('0xf')](_0x4354b0);if(_0x1f2d2b){logger[_0x0c07('0x9')](_0x1f2d2b);return _0x25cd39(_0x1f2d2b);}return _0x4dd377(_0x2e8a97);});});}exports[_0x0c07('0x10')]=function(_0x4de81b,_0x17dab3){return pm2[_0x0c07('0x11')]()[_0x0c07('0x12')](function(_0x18e93b){if(_0x18e93b){var _0x576a85=_[_0x0c07('0x13')](_0x18e93b,function(_0x1ebff7){return _0x1ebff7[_0x0c07('0xb')]===_0x0c07('0x14')||_0x1ebff7[_0x0c07('0xb')]===_0x0c07('0x15');});return{'rows':_0x576a85,'count':_0x576a85[_0x0c07('0x16')]};}return null;})[_0x0c07('0x12')](respondWithResult(_0x17dab3,null))[_0x0c07('0x17')](handleError(_0x17dab3,null));};exports[_0x0c07('0x18')]=function(_0x42b41c,_0x50f087){return pm2['describe'](_0x42b41c['params']['id'])[_0x0c07('0x12')](respondWithResult(_0x50f087,null))[_0x0c07('0x12')](handleEntityNotFound(_0x50f087,null))['catch'](handleError(_0x50f087,null));};exports[_0x0c07('0x19')]=function(_0x561693,_0x2240c8){if(_0x561693[_0x0c07('0x1a')][_0x0c07('0xb')]&&_0x561693[_0x0c07('0x1a')][_0x0c07('0x1b')]){var _0x3391a6=path['join'](__dirname,_0x0c07('0x1c'),_0x561693['body']['script']);var _0x78616d=process[_0x0c07('0x1d')]();process['chdir'](path['dirname'](_0x3391a6));return execChildProcess()[_0x0c07('0x12')](function(_0x1eae9d){process[_0x0c07('0x1e')](_0x78616d);return pm2[_0x0c07('0x1f')]({'name':_0x561693[_0x0c07('0x1a')][_0x0c07('0xb')],'script':_0x3391a6});})['then'](function(_0x3bd322){pm2['dump']();return _0x3bd322[0x0];})[_0x0c07('0x12')](respondWithResult(_0x2240c8,0xc9))[_0x0c07('0x17')](handleError(_0x2240c8,null));}else{return _0x2240c8[_0x0c07('0xc')](0x1f4)[_0x0c07('0xd')]({'message':_0x0c07('0x20')});}};exports[_0x0c07('0x21')]=function(_0x175622,_0x4aa160){if(_0x175622['body']['id']){delete _0x175622[_0x0c07('0x1a')]['id'];}var _0x4d29b2={'online':_0x0c07('0x22'),'stopped':'stop'};if(_0x4d29b2['hasOwnProperty'](_0x175622[_0x0c07('0x1a')]['status'])){return pm2[_0x4d29b2[_0x175622[_0x0c07('0x1a')][_0x0c07('0xc')]]](_0x175622[_0x0c07('0x23')]['id'])[_0x0c07('0x12')](respondWithResult(_0x4aa160,0xc8))[_0x0c07('0x17')](handleError(_0x4aa160,null));}else{return _0x4aa160['status'](0x1f4)[_0x0c07('0xd')]({'message':_0x0c07('0x24')});}};exports['destroy']=function(_0x330c88,_0x4df0d8){if(_0x330c88[_0x0c07('0x1a')]['id']){delete _0x330c88[_0x0c07('0x1a')]['id'];}if(_0x330c88[_0x0c07('0x23')]['id']){return pm2[_0x0c07('0x25')](_0x330c88[_0x0c07('0x23')]['id'])['then'](function(_0x20d5ae){pm2[_0x0c07('0x26')]();return _0x20d5ae[0x0];})[_0x0c07('0x12')](respondWithResult(_0x4df0d8,null))[_0x0c07('0x17')](handleError(_0x4df0d8,null));}else{return _0x4df0d8[_0x0c07('0xc')](0x1f4)[_0x0c07('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x59d3=['json','error','stack','name','status','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','script','join','cwd','chdir','start','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','bluebird','sendStatus'];(function(_0x37c0fb,_0x4bc9fc){var _0x3fd689=function(_0x3cb043){while(--_0x3cb043){_0x37c0fb['push'](_0x37c0fb['shift']());}};_0x3fd689(++_0x4bc9fc);}(_0x59d3,0xf0));var _0x359d=function(_0xfcba78,_0x492334){_0xfcba78=_0xfcba78-0x0;var _0x1048b9=_0x59d3[_0xfcba78];return _0x1048b9;};'use strict';var _=require(_0x359d('0x0'));var pm2=require(_0x359d('0x1'));var logger=require(_0x359d('0x2'))('api');var path=require('path');var exec=require(_0x359d('0x3'))['exec'];var BPromise=require(_0x359d('0x4'));function handleEntityNotFound(_0x198f89,_0x2cbae7){return function(_0x23dbdf){if(!_0x23dbdf){_0x198f89[_0x359d('0x5')](0x194);;}return _0x23dbdf;};}function respondWithResult(_0x364a7a,_0x3d2dea){_0x3d2dea=_0x3d2dea||0xc8;return function(_0x14f6fd){if(_0x14f6fd){return _0x364a7a['status'](_0x3d2dea)[_0x359d('0x6')](_0x14f6fd);}return null;};}function handleError(_0x451a92,_0x22473e){_0x22473e=_0x22473e||0x1f4;return function(_0x260d54){logger[_0x359d('0x7')](_0x260d54[_0x359d('0x8')]);if(_0x260d54['name']){delete _0x260d54[_0x359d('0x9')];}_0x451a92[_0x359d('0xa')](_0x22473e)['send'](_0x260d54);};}function execChildProcess(){return new BPromise(function(_0x47079c,_0x44c66d){exec(_0x359d('0xb'),function(_0xfda42,_0x1f3741,_0x43f034){logger[_0x359d('0xc')](_0x1f3741);logger['info'](_0x43f034);if(_0xfda42){logger['error'](_0xfda42);return _0x44c66d(_0xfda42);}return _0x47079c(_0x1f3741);});});}exports[_0x359d('0xd')]=function(_0x433b78,_0x3731e1){return pm2[_0x359d('0xe')]()[_0x359d('0xf')](function(_0x57b5b3){if(_0x57b5b3){var _0x43533c=_[_0x359d('0x10')](_0x57b5b3,function(_0x905a48){return _0x905a48[_0x359d('0x9')]===_0x359d('0x11')||_0x905a48[_0x359d('0x9')]===_0x359d('0x12');});return{'rows':_0x43533c,'count':_0x43533c[_0x359d('0x13')]};}return null;})[_0x359d('0xf')](respondWithResult(_0x3731e1,null))[_0x359d('0x14')](handleError(_0x3731e1,null));};exports[_0x359d('0x15')]=function(_0x41a6b9,_0x253290){return pm2[_0x359d('0x16')](_0x41a6b9[_0x359d('0x17')]['id'])['then'](respondWithResult(_0x253290,null))['then'](handleEntityNotFound(_0x253290,null))[_0x359d('0x14')](handleError(_0x253290,null));};exports[_0x359d('0x18')]=function(_0x5cd14b,_0x3dd0c5){if(_0x5cd14b[_0x359d('0x19')][_0x359d('0x9')]&&_0x5cd14b[_0x359d('0x19')][_0x359d('0x1a')]){var _0x6654e1=path[_0x359d('0x1b')](__dirname,'../../files/plugins',_0x5cd14b[_0x359d('0x19')][_0x359d('0x1a')]);var _0x1b3100=process[_0x359d('0x1c')]();process[_0x359d('0x1d')](path['dirname'](_0x6654e1));return execChildProcess()['then'](function(_0x467473){process[_0x359d('0x1d')](_0x1b3100);return pm2[_0x359d('0x1e')]({'name':_0x5cd14b[_0x359d('0x19')][_0x359d('0x9')],'script':_0x6654e1});})[_0x359d('0xf')](function(_0x19f1d6){pm2['dump']();return _0x19f1d6[0x0];})[_0x359d('0xf')](respondWithResult(_0x3dd0c5,0xc9))[_0x359d('0x14')](handleError(_0x3dd0c5,null));}else{return _0x3dd0c5[_0x359d('0xa')](0x1f4)[_0x359d('0x1f')]({'message':_0x359d('0x20')});}};exports[_0x359d('0x21')]=function(_0x37179e,_0x166b0e){if(_0x37179e[_0x359d('0x19')]['id']){delete _0x37179e['body']['id'];}var _0x3ea9c1={'online':_0x359d('0x22'),'stopped':_0x359d('0x23')};if(_0x3ea9c1[_0x359d('0x24')](_0x37179e['body'][_0x359d('0xa')])){return pm2[_0x3ea9c1[_0x37179e[_0x359d('0x19')][_0x359d('0xa')]]](_0x37179e[_0x359d('0x17')]['id'])[_0x359d('0xf')](respondWithResult(_0x166b0e,0xc8))[_0x359d('0x14')](handleError(_0x166b0e,null));}else{return _0x166b0e[_0x359d('0xa')](0x1f4)['send']({'message':_0x359d('0x25')});}};exports['destroy']=function(_0x37b686,_0x1512fe){if(_0x37b686[_0x359d('0x19')]['id']){delete _0x37b686[_0x359d('0x19')]['id'];}if(_0x37b686[_0x359d('0x17')]['id']){return pm2[_0x359d('0x26')](_0x37b686[_0x359d('0x17')]['id'])['then'](function(_0x3cfdfd){pm2[_0x359d('0x27')]();return _0x3cfdfd[0x0];})[_0x359d('0xf')](respondWithResult(_0x1512fe,null))['catch'](handleError(_0x1512fe,null));}else{return _0x1512fe[_0x359d('0xa')](0x1f4)[_0x359d('0x1f')]({'message':_0x359d('0x28')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 0a0c2ff..4f87846 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 _0xa83f=['multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x376e1d,_0x4ec1fc){var _0x20512f=function(_0x1425b6){while(--_0x1425b6){_0x376e1d['push'](_0x376e1d['shift']());}};_0x20512f(++_0x4ec1fc);}(_0xa83f,0x118));var _0xfa83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa83f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfa83('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfa83('0x1'));var express=require(_0xfa83('0x2'));var router=express[_0xfa83('0x3')]();var auth=require(_0xfa83('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfa83('0x5'));module[_0xfa83('0x6')]=router; \ No newline at end of file +var _0x5093=['multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3bf34b,_0x1bef7d){var _0x2d070a=function(_0x7f6171){while(--_0x7f6171){_0x3bf34b['push'](_0x3bf34b['shift']());}};_0x2d070a(++_0x1bef7d);}(_0x5093,0xde));var _0x3509=function(_0x5b6744,_0x49c9c2){_0x5b6744=_0x5b6744-0x0;var _0x43d97a=_0x5093[_0x5b6744];return _0x43d97a;};'use strict';var multer=require(_0x3509('0x0'));var util=require(_0x3509('0x1'));var path=require(_0x3509('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x3509('0x3'));var interaction=require(_0x3509('0x4'));var config=require(_0x3509('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 f3fc4b2..344b747 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 _0xe359=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x788984,_0x5f5d3a){var _0x11531f=function(_0xad28dd){while(--_0xad28dd){_0x788984['push'](_0x788984['shift']());}};_0x11531f(++_0x5f5d3a);}(_0xe359,0x1c8));var _0x9e35=function(_0x516bbe,_0x339531){_0x516bbe=_0x516bbe-0x0;var _0xe86fd5=_0xe359[_0x516bbe];return _0xe86fd5;};'use strict';var Sequelize=require(_0x9e35('0x0'));module[_0x9e35('0x1')]={'state':{'type':Sequelize[_0x9e35('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9e35('0x3')]},'scheduledat':{'type':Sequelize[_0x9e35('0x4')]},'uniqueid':{'type':Sequelize[_0x9e35('0x3')]},'starttime':{'type':Sequelize[_0x9e35('0x4')]},'responsetime':{'type':Sequelize[_0x9e35('0x4')]},'ringtime':{'type':Sequelize[_0x9e35('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9e35('0x3')]},'campaigntype':{'type':Sequelize[_0x9e35('0x3')]},'membername':{'type':Sequelize[_0x9e35('0x3')]}}; \ No newline at end of file +var _0x92c2=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x380f77,_0x32cb01){var _0x59bca4=function(_0x5ef98e){while(--_0x5ef98e){_0x380f77['push'](_0x380f77['shift']());}};_0x59bca4(++_0x32cb01);}(_0x92c2,0x8d));var _0x292c=function(_0x54847d,_0x1ae421){_0x54847d=_0x54847d-0x0;var _0x166562=_0x92c2[_0x54847d];return _0x166562;};'use strict';var Sequelize=require(_0x292c('0x0'));module[_0x292c('0x1')]={'state':{'type':Sequelize[_0x292c('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x292c('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x292c('0x3')]},'starttime':{'type':Sequelize[_0x292c('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x292c('0x3')]},'campaigntype':{'type':Sequelize[_0x292c('0x3')]},'membername':{'type':Sequelize[_0x292c('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 9281c44..69ed639 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 _0x0457=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview'];(function(_0x4b3d77,_0x138118){var _0x163796=function(_0xf430a6){while(--_0xf430a6){_0x4b3d77['push'](_0x4b3d77['shift']());}};_0x163796(++_0x138118);}(_0x0457,0x84));var _0x7045=function(_0x56b8dd,_0x14e979){_0x56b8dd=_0x56b8dd-0x0;var _0x391bac=_0x0457[_0x56b8dd];return _0x391bac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7045('0x0'))(_0x7045('0x1'));var moment=require(_0x7045('0x2'));var BPromise=require(_0x7045('0x3'));var rp=require(_0x7045('0x4'));var fs=require('fs');var path=require(_0x7045('0x5'));var rimraf=require(_0x7045('0x6'));var config=require(_0x7045('0x7'));var attributes=require(_0x7045('0x8'));module[_0x7045('0x9')]=function(_0x11184d,_0x5e8889){return _0x11184d['define'](_0x7045('0xa'),attributes,{'tableName':_0x7045('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8811=['path','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','api','bluebird','request-promise'];(function(_0x3a0cad,_0x555373){var _0x525205=function(_0x58f6d0){while(--_0x58f6d0){_0x3a0cad['push'](_0x3a0cad['shift']());}};_0x525205(++_0x555373);}(_0x8811,0x1db));var _0x1881=function(_0x1127ea,_0xd1c88b){_0x1127ea=_0x1127ea-0x0;var _0x4aa481=_0x8811[_0x1127ea];return _0x4aa481;};'use strict';var _=require(_0x1881('0x0'));var util=require(_0x1881('0x1'));var logger=require('../../config/logger')(_0x1881('0x2'));var moment=require('moment');var BPromise=require(_0x1881('0x3'));var rp=require(_0x1881('0x4'));var fs=require('fs');var path=require(_0x1881('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1881('0x6'));module[_0x1881('0x7')]=function(_0x5dbf1f,_0x26c3a2){return _0x5dbf1f[_0x1881('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x1881('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 af5c1d2..c61b5c2 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 _0x8e11=['create','body','options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8e11,0x1c5));var _0x18e1=function(_0x3a3e4f,_0x5b0b27){_0x3a3e4f=_0x3a3e4f-0x0;var _0x5841a6=_0x8e11[_0x3a3e4f];return _0x5841a6;};'use strict';var _=require(_0x18e1('0x0'));var util=require('util');var moment=require(_0x18e1('0x1'));var BPromise=require(_0x18e1('0x2'));var rs=require(_0x18e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18e1('0x4'))['db'];var utils=require(_0x18e1('0x5'));var logger=require(_0x18e1('0x6'))(_0x18e1('0x7'));var config=require(_0x18e1('0x8'));var jayson=require(_0x18e1('0x9'));var client=jayson[_0x18e1('0xa')][_0x18e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37f51c,_0x4dab53,_0x1843e3){return new BPromise(function(_0x13f8ca,_0x5642fc){return client[_0x18e1('0xc')](_0x37f51c,_0x1843e3)[_0x18e1('0xd')](function(_0x11addf){logger[_0x18e1('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x4dab53,_0x18e1('0xf'));logger[_0x18e1('0x10')](_0x18e1('0x11'),_0x4dab53,_0x18e1('0xf'),JSON[_0x18e1('0x12')](_0x11addf));if(_0x11addf[_0x18e1('0x13')]){if(_0x11addf[_0x18e1('0x13')][_0x18e1('0x14')]===0x1f4){logger['error'](_0x18e1('0x15'),_0x4dab53,_0x11addf[_0x18e1('0x13')][_0x18e1('0x16')]);return _0x5642fc(_0x11addf['error'][_0x18e1('0x16')]);}logger[_0x18e1('0x13')](_0x18e1('0x15'),_0x4dab53,_0x11addf[_0x18e1('0x13')][_0x18e1('0x16')]);return _0x13f8ca(_0x11addf['error']['message']);}else{logger[_0x18e1('0xe')](_0x18e1('0x15'),_0x4dab53,_0x18e1('0xf'));_0x13f8ca(_0x11addf[_0x18e1('0x17')][_0x18e1('0x16')]);}})[_0x18e1('0x18')](function(_0x28b109){logger[_0x18e1('0x13')](_0x18e1('0x15'),_0x4dab53,_0x28b109);_0x5642fc(_0x28b109);});});}exports[_0x18e1('0x19')]=function(_0xf31e57){var _0x3a3107=this;return new Promise(function(_0x25a898,_0x4f37f6){return db[_0x18e1('0x1a')][_0x18e1('0x1b')](_0xf31e57[_0x18e1('0x1c')],{'raw':_0xf31e57['options']?_0xf31e57[_0x18e1('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x18e1('0xd')](function(_0xe5b048){logger['info'](_0x18e1('0x19'),_0xf31e57);logger[_0x18e1('0x10')](_0x18e1('0x19'),_0xf31e57,JSON[_0x18e1('0x12')](_0xe5b048));_0x25a898(_0xe5b048);})[_0x18e1('0x18')](function(_0x318efe){logger[_0x18e1('0x13')](_0x18e1('0x19'),_0x318efe[_0x18e1('0x16')],_0xf31e57);_0x4f37f6(_0x3a3107['error'](0x1f4,_0x318efe[_0x18e1('0x16')]));});});}; \ No newline at end of file +var _0x3c9a=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','debug','lodash'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x3c9a,0x103));var _0xa3c9=function(_0x1be3ba,_0x562e06){_0x1be3ba=_0x1be3ba-0x0;var _0x24bb7b=_0x3c9a[_0x1be3ba];return _0x24bb7b;};'use strict';var _=require(_0xa3c9('0x0'));var util=require(_0xa3c9('0x1'));var moment=require('moment');var BPromise=require(_0xa3c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3c9('0x3'));var db=require(_0xa3c9('0x4'))['db'];var utils=require(_0xa3c9('0x5'));var logger=require(_0xa3c9('0x6'))(_0xa3c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xa3c9('0x8'));var client=jayson[_0xa3c9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x111106,_0x5d00a8,_0x234ebb){return new BPromise(function(_0x54524e,_0xe5535c){return client[_0xa3c9('0xa')](_0x111106,_0x234ebb)[_0xa3c9('0xb')](function(_0x19a265){logger[_0xa3c9('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x5d00a8,_0xa3c9('0xd'));logger['debug'](_0xa3c9('0xe'),_0x5d00a8,_0xa3c9('0xd'),JSON[_0xa3c9('0xf')](_0x19a265));if(_0x19a265['error']){if(_0x19a265[_0xa3c9('0x10')][_0xa3c9('0x11')]===0x1f4){logger[_0xa3c9('0x10')](_0xa3c9('0x12'),_0x5d00a8,_0x19a265[_0xa3c9('0x10')][_0xa3c9('0x13')]);return _0xe5535c(_0x19a265[_0xa3c9('0x10')][_0xa3c9('0x13')]);}logger[_0xa3c9('0x10')](_0xa3c9('0x12'),_0x5d00a8,_0x19a265[_0xa3c9('0x10')][_0xa3c9('0x13')]);return _0x54524e(_0x19a265['error'][_0xa3c9('0x13')]);}else{logger[_0xa3c9('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x5d00a8,_0xa3c9('0xd'));_0x54524e(_0x19a265[_0xa3c9('0x14')][_0xa3c9('0x13')]);}})[_0xa3c9('0x15')](function(_0x395e23){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x5d00a8,_0x395e23);_0xe5535c(_0x395e23);});});}exports[_0xa3c9('0x16')]=function(_0x3c2c66){var _0x2143bf=this;return new Promise(function(_0xed0eb7,_0x5db4d9){return db[_0xa3c9('0x17')]['create'](_0x3c2c66[_0xa3c9('0x18')],{'raw':_0x3c2c66['options']?_0x3c2c66['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5a85ec){logger['info']('CreateReportAgentPreview',_0x3c2c66);logger[_0xa3c9('0x19')](_0xa3c9('0x16'),_0x3c2c66,JSON[_0xa3c9('0xf')](_0x5a85ec));_0xed0eb7(_0x5a85ec);})['catch'](function(_0x434099){logger[_0xa3c9('0x10')]('CreateReportAgentPreview',_0x434099[_0xa3c9('0x13')],_0x3c2c66);_0x5db4d9(_0x2143bf[_0xa3c9('0x10')](0x1f4,_0x434099[_0xa3c9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index ef2b1a7..2b9aeb3 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 _0xa880=['queueNotify','/mail/queues/:id','post','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','Router','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','outboundChannels','/agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify'];(function(_0x4e707d,_0x4d6037){var _0x2aa5b5=function(_0xb47f87){while(--_0xb47f87){_0x4e707d['push'](_0x4e707d['shift']());}};_0x2aa5b5(++_0x4d6037);}(_0xa880,0x9f));var _0x0a88=function(_0x420516,_0x5ce5ca){_0x420516=_0x420516-0x0;var _0x16484e=_0xa880[_0x420516];return _0x16484e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require('express');var router=express[_0x0a88('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x0a88('0x1'));router[_0x0a88('0x2')](_0x0a88('0x3'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x5')]);router[_0x0a88('0x2')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x0a88('0x4')](),controller[_0x0a88('0x6')]);router[_0x0a88('0x2')](_0x0a88('0x7'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x8')]);router['get']('/voice/queues',auth[_0x0a88('0x4')](),controller[_0x0a88('0x9')]);router[_0x0a88('0x2')]('/chat/queues',auth[_0x0a88('0x4')](),controller[_0x0a88('0xa')]);router[_0x0a88('0x2')](_0x0a88('0xb'),auth[_0x0a88('0x4')](),controller[_0x0a88('0xc')]);router[_0x0a88('0x2')](_0x0a88('0xd'),auth[_0x0a88('0x4')](),controller['mailAccounts']);router[_0x0a88('0x2')](_0x0a88('0xe'),auth[_0x0a88('0x4')](),controller[_0x0a88('0xf')]);router[_0x0a88('0x2')](_0x0a88('0x10'),auth['isAuthenticated'](),controller[_0x0a88('0x11')]);router['get'](_0x0a88('0x12'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x13')]);router[_0x0a88('0x2')](_0x0a88('0x14'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x15')]);router['get'](_0x0a88('0x16'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x17')]);router[_0x0a88('0x2')](_0x0a88('0x18'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x19')]);router['get'](_0x0a88('0x1a'),auth[_0x0a88('0x4')](),controller['voiceQueuesChannel']);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x0a88('0x4')](),controller[_0x0a88('0x1b')]);router[_0x0a88('0x2')](_0x0a88('0x1c'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x1d')]);router[_0x0a88('0x2')](_0x0a88('0x1e'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x1f')]);router[_0x0a88('0x2')](_0x0a88('0x20'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x21')]);router[_0x0a88('0x2')]('/outbound/channels',auth[_0x0a88('0x4')](),controller[_0x0a88('0x22')]);router['get'](_0x0a88('0x23'),auth['isAuthenticated'](),controller['agents']);router[_0x0a88('0x24')](_0x0a88('0x25'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x26')]);router[_0x0a88('0x2')](_0x0a88('0x27'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x28')]);router[_0x0a88('0x2')](_0x0a88('0x29'),auth[_0x0a88('0x4')](),controller['trunks']);router[_0x0a88('0x2')](_0x0a88('0x2a'),auth['isAuthenticated'](),controller[_0x0a88('0x2b')]);router['get']('/fax/accounts',auth['isAuthenticated'](),controller[_0x0a88('0x2c')]);router[_0x0a88('0x2')](_0x0a88('0x2d'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router['get'](_0x0a88('0x2e'),auth[_0x0a88('0x4')](),controller['mailQueuesWaitingInteractions']);router[_0x0a88('0x2')]('/openchannel/queues/waitinginteractions',auth[_0x0a88('0x4')](),controller[_0x0a88('0x2f')]);router['get'](_0x0a88('0x30'),auth[_0x0a88('0x4')](),controller['smsQueuesWaitingInteractions']);router['get'](_0x0a88('0x31'),auth['isAuthenticated'](),controller[_0x0a88('0x32')]);router[_0x0a88('0x2')](_0x0a88('0x33'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x34')]);router['post'](_0x0a88('0x35'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x36')]('mail'));router['get'](_0x0a88('0x37'),auth[_0x0a88('0x4')](),controller['showMailQueues']);router[_0x0a88('0x38')](_0x0a88('0x39'),auth['isAuthenticated'](),controller[_0x0a88('0x36')](_0x0a88('0x3a')));router[_0x0a88('0x2')]('/chat/queues/:id',auth[_0x0a88('0x4')](),controller[_0x0a88('0x3b')]);router['post'](_0x0a88('0x3c'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x36')]('fax'));router[_0x0a88('0x2')](_0x0a88('0x3d'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x3e')]);router[_0x0a88('0x38')]('/openchannel/queues/:id/notify',auth[_0x0a88('0x4')](),controller['queueNotify']('openchannel'));router[_0x0a88('0x2')](_0x0a88('0x3f'),auth[_0x0a88('0x4')](),controller['showOpenchannelQueues']);router[_0x0a88('0x38')](_0x0a88('0x40'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x36')](_0x0a88('0x41')));router[_0x0a88('0x38')]('/whatsapp/queues/:id/notify',auth[_0x0a88('0x4')](),controller[_0x0a88('0x36')]('whatsapp'));router[_0x0a88('0x2')](_0x0a88('0x42'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x43')]);router[_0x0a88('0x2')](_0x0a88('0x44'),auth[_0x0a88('0x4')](),controller[_0x0a88('0x45')]);router[_0x0a88('0x38')](_0x0a88('0x46'),auth[_0x0a88('0x4')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0xaa9d=['chatQueues','/mail/queues','mailQueues','/mail/accounts','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','express','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0xaa9d,0x168));var _0xdaa9=function(_0x51ca5d,_0x8506ef){_0x51ca5d=_0x51ca5d-0x0;var _0x4ab656=_0xaa9d[_0x51ca5d];return _0x4ab656;};'use strict';var multer=require(_0xdaa9('0x0'));var util=require(_0xdaa9('0x1'));var path=require(_0xdaa9('0x2'));var express=require(_0xdaa9('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xdaa9('0x4'));router['get'](_0xdaa9('0x5'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x7')]);router[_0xdaa9('0x8')](_0xdaa9('0x9'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0xa')]);router[_0xdaa9('0x8')](_0xdaa9('0xb'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0xc')]);router[_0xdaa9('0x8')](_0xdaa9('0xd'),auth['isAuthenticated'](),controller['voiceQueues']);router['get'](_0xdaa9('0xe'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0xf')]);router[_0xdaa9('0x8')](_0xdaa9('0x10'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x11')]);router[_0xdaa9('0x8')](_0xdaa9('0x12'),auth[_0xdaa9('0x6')](),controller['mailAccounts']);router['get']('/openchannel/queues',auth['isAuthenticated'](),controller['openchannelQueues']);router[_0xdaa9('0x8')](_0xdaa9('0x13'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x14')]);router['get'](_0xdaa9('0x15'),auth['isAuthenticated'](),controller['whatsappQueues']);router['get'](_0xdaa9('0x16'),auth[_0xdaa9('0x6')](),controller['faxQueues']);router[_0xdaa9('0x8')](_0xdaa9('0x17'),auth['isAuthenticated'](),controller[_0xdaa9('0x18')]);router[_0xdaa9('0x8')](_0xdaa9('0x19'),auth['isAuthenticated'](),controller[_0xdaa9('0x1a')]);router[_0xdaa9('0x8')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xdaa9('0x8')](_0xdaa9('0x1b'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x1c')]);router['get'](_0xdaa9('0x1d'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x1e')]);router[_0xdaa9('0x8')](_0xdaa9('0x1f'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x20')]);router[_0xdaa9('0x8')](_0xdaa9('0x21'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x22')]);router[_0xdaa9('0x8')](_0xdaa9('0x23'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x24')]);router[_0xdaa9('0x8')](_0xdaa9('0x25'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x26')]);router[_0xdaa9('0x27')](_0xdaa9('0x28'),auth['isAuthenticated'](),controller[_0xdaa9('0x29')]);router[_0xdaa9('0x8')](_0xdaa9('0x2a'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x2b')]);router['get'](_0xdaa9('0x2c'),auth[_0xdaa9('0x6')](),controller['trunks']);router[_0xdaa9('0x8')]('/campaigns',auth[_0xdaa9('0x6')](),controller['campaigns']);router[_0xdaa9('0x8')](_0xdaa9('0x2d'),auth[_0xdaa9('0x6')](),controller['faxAccounts']);router['get'](_0xdaa9('0x2e'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x2f')]);router[_0xdaa9('0x8')](_0xdaa9('0x30'),auth[_0xdaa9('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0xdaa9('0x8')](_0xdaa9('0x31'),auth[_0xdaa9('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0xdaa9('0x8')]('/sms/queues/waitinginteractions',auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x32')]);router[_0xdaa9('0x8')](_0xdaa9('0x33'),auth[_0xdaa9('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0xdaa9('0x8')](_0xdaa9('0x34'),auth['isAuthenticated'](),controller[_0xdaa9('0x35')]);router['post']('/mail/queues/:id/notify',auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x36')](_0xdaa9('0x37')));router[_0xdaa9('0x8')](_0xdaa9('0x38'),auth['isAuthenticated'](),controller[_0xdaa9('0x39')]);router[_0xdaa9('0x3a')](_0xdaa9('0x3b'),auth['isAuthenticated'](),controller['queueNotify'](_0xdaa9('0x3c')));router['get'](_0xdaa9('0x3d'),auth[_0xdaa9('0x6')](),controller['showChatQueues']);router[_0xdaa9('0x3a')]('/fax/queues/:id/notify',auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x36')](_0xdaa9('0x3e')));router[_0xdaa9('0x8')](_0xdaa9('0x3f'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x40')]);router[_0xdaa9('0x3a')](_0xdaa9('0x41'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x36')](_0xdaa9('0x42')));router[_0xdaa9('0x8')](_0xdaa9('0x43'),auth[_0xdaa9('0x6')](),controller['showOpenchannelQueues']);router[_0xdaa9('0x3a')](_0xdaa9('0x44'),auth[_0xdaa9('0x6')](),controller['queueNotify'](_0xdaa9('0x45')));router[_0xdaa9('0x3a')]('/whatsapp/queues/:id/notify',auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x36')]('whatsapp'));router[_0xdaa9('0x8')](_0xdaa9('0x46'),auth[_0xdaa9('0x6')](),controller['showSmsQueues']);router[_0xdaa9('0x8')](_0xdaa9('0x47'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x48')]);router[_0xdaa9('0x3a')](_0xdaa9('0x49'),auth[_0xdaa9('0x6')](),controller[_0xdaa9('0x4a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index fdae3d0..1531ec2 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 _0x5420=['status','json','stack','name','isNil','find','rows','VoiceChannels','query','then','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','internal','AgentCapacity','capacity','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','smsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','queue','From','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','agent','Agent\x20not\x20found','update','MessageId','InteractionId','Start','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','message','result','catch'];(function(_0x12ac84,_0x448110){var _0x4facd0=function(_0x174100){while(--_0x174100){_0x12ac84['push'](_0x12ac84['shift']());}};_0x4facd0(++_0x448110);}(_0x5420,0x1ba));var _0x0542=function(_0x120ee5,_0x296702){_0x120ee5=_0x120ee5-0x0;var _0x76e2cc=_0x5420[_0x120ee5];return _0x76e2cc;};'use strict';var BPromise=require(_0x0542('0x0'));var moment=require('moment');var _=require(_0x0542('0x1'));var util=require(_0x0542('0x2'));var db=require(_0x0542('0x3'))['db'];var logger=require(_0x0542('0x4'))(_0x0542('0x5'));var jayson=require(_0x0542('0x6'));var amiClient=jayson[_0x0542('0x7')][_0x0542('0x8')]({'port':0x232a});var mailClient=jayson[_0x0542('0x7')][_0x0542('0x8')]({'port':0x232b});var routingClient=jayson[_0x0542('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0xd6fab,_0x5970f0,_0x56d028){return new BPromise(function(_0x36bc07,_0x189762){var _0x33e252=_0x56d028?_0x56d028:amiClient;return _0x33e252[_0x0542('0x9')](_0xd6fab,_0x5970f0)['then'](function(_0x5b87f8){if(_0x5b87f8[_0x0542('0xa')]){if(_0x5b87f8[_0x0542('0xa')]['code']===0x1f4){return _0x189762(_0x5b87f8[_0x0542('0xa')]['message']);}return _0x36bc07(_0x5b87f8['error'][_0x0542('0xb')]);}else{_0x36bc07(_0x5b87f8[_0x0542('0xc')]);}})[_0x0542('0xd')](function(_0x5eb300){_0x189762(_0x5eb300);});});}function respondWithResult(_0x1a7276,_0x116d24){_0x116d24=_0x116d24||0xc8;return function(_0x3943ad){if(_0x3943ad){return _0x1a7276[_0x0542('0xe')](_0x116d24)[_0x0542('0xf')](_0x3943ad);}return _0x1a7276['sendStatus'](0x194);};}function handleError(_0x1653ef,_0x284689){_0x284689=_0x284689||0x1f4;return function(_0xb93fc5){logger[_0x0542('0xa')](_0xb93fc5[_0x0542('0x10')]);if(_0xb93fc5[_0x0542('0x11')]){delete _0xb93fc5[_0x0542('0x11')];}_0x1653ef[_0x0542('0xe')](_0x284689)['send'](_0xb93fc5);};}function findById(_0x1d4d64){return function(_0x3cc0b5){if(!_[_0x0542('0x12')](_0x1d4d64)&&!_['isNil'](_0x3cc0b5)&&!_['isNil'](_0x3cc0b5['rows'])){return _[_0x0542('0x13')](_0x3cc0b5[_0x0542('0x14')],function(_0x5566b2){return _0x5566b2['id']==_0x1d4d64;});}return null;};}exports['voiceChannels']=function(_0x46ff5b,_0x4a36ce){return respondWithRpcPromise(_0x0542('0x15'),_0x46ff5b[_0x0542('0x16')])[_0x0542('0x17')](respondWithResult(_0x4a36ce,null))[_0x0542('0xd')](handleError(_0x4a36ce,null));};exports['voiceChannelMixMonitor']=function(_0x14d210,_0x4e1737){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x0542('0x18')](_0x14d210['query'],_0x14d210[_0x0542('0x19')]))['then'](respondWithResult(_0x4e1737,null))['catch'](handleError(_0x4e1737,null));};exports[_0x0542('0x1a')]=function(_0x297a87,_0xa2e549){return respondWithRpcPromise(_0x0542('0x1b'),_[_0x0542('0x18')](_0x297a87[_0x0542('0x16')],_0x297a87[_0x0542('0x19')]))['then'](respondWithResult(_0xa2e549,null))[_0x0542('0xd')](handleError(_0xa2e549,null));};exports['voiceQueues']=function(_0x204afc,_0xe07d10){return respondWithRpcPromise(_0x0542('0x1c'),_0x204afc[_0x0542('0x16')])[_0x0542('0x17')](respondWithResult(_0xe07d10,null))[_0x0542('0xd')](handleError(_0xe07d10,null));};exports[_0x0542('0x1d')]=function(_0x2a6925,_0x559af1){return respondWithRpcPromise('VoiceQueues',_0x2a6925[_0x0542('0x16')])[_0x0542('0x17')](findById(_0x2a6925['params']['id']))['then'](respondWithResult(_0x559af1,null))[_0x0542('0xd')](handleError(_0x559af1,null));};exports['voiceQueuesPreview']=function(_0x5a2e29,_0x39ad8a){return respondWithRpcPromise(_0x0542('0x1e'),_[_0x0542('0x18')](_0x5a2e29['query'],_0x5a2e29[_0x0542('0x19')]))[_0x0542('0x17')](respondWithResult(_0x39ad8a,null))[_0x0542('0xd')](handleError(_0x39ad8a,null));};exports['voiceQueuesChannels']=function(_0x351ae8,_0x583dd6){return respondWithRpcPromise(_0x0542('0x1f'),_0x351ae8[_0x0542('0x16')])[_0x0542('0x17')](respondWithResult(_0x583dd6,null))[_0x0542('0xd')](handleError(_0x583dd6,null));};exports[_0x0542('0x20')]=function(_0x5790a3,_0x4889b7){return respondWithRpcPromise(_0x0542('0x21'),_[_0x0542('0x18')](_0x5790a3[_0x0542('0x16')],_0x5790a3[_0x0542('0x19')]))[_0x0542('0x17')](respondWithResult(_0x4889b7,null))[_0x0542('0xd')](handleError(_0x4889b7,null));};exports[_0x0542('0x22')]=function(_0x35a4ab,_0x17359d){return respondWithRpcPromise(_0x0542('0x23'),_[_0x0542('0x18')](_0x35a4ab['query'],_0x35a4ab['params']))['then'](respondWithResult(_0x17359d,null))[_0x0542('0xd')](handleError(_0x17359d,null));};exports['voiceQueuesChannelRedirect']=function(_0x461512,_0x7a5eb1){return respondWithRpcPromise(_0x0542('0x24'),_['merge'](_0x461512[_0x0542('0x16')],_0x461512[_0x0542('0x19')]))['then'](respondWithResult(_0x7a5eb1,null))[_0x0542('0xd')](handleError(_0x7a5eb1,null));};exports['outbound']=function(_0x597774,_0x598bed){return respondWithRpcPromise(_0x0542('0x25'),_0x597774[_0x0542('0x16')])[_0x0542('0x17')](respondWithResult(_0x598bed,null))[_0x0542('0xd')](handleError(_0x598bed,null));};exports[_0x0542('0x26')]=function(_0x48bc87,_0x55aa8c){return respondWithRpcPromise(_0x0542('0x27'),_0x48bc87[_0x0542('0x16')])[_0x0542('0x17')](respondWithResult(_0x55aa8c,null))['catch'](handleError(_0x55aa8c,null));};exports[_0x0542('0x28')]=function(_0x36819f,_0x243afc){var _0x1406b5;return respondWithRpcPromise(_0x0542('0x29'),_0x36819f[_0x0542('0x16')])['then'](function(_0x9e7bf2){_0x1406b5=_0x9e7bf2;return respondWithRpcPromise(_0x0542('0x29'),_0x36819f[_0x0542('0x16')],routingClient);})[_0x0542('0x17')](function(_0x48df5c){return _['merge']({},_0x48df5c,_0x1406b5);})[_0x0542('0x17')](respondWithResult(_0x243afc,null))[_0x0542('0xd')](handleError(_0x243afc,null));};exports[_0x0542('0x2a')]=function(_0x1eaf3d,_0x162cc7){if(_0x1eaf3d[_0x0542('0x2b')]&&_0x1eaf3d['body'][_0x0542('0x2c')]&&_0x1eaf3d[_0x0542('0x2d')]&&_0x1eaf3d[_0x0542('0x2d')][_0x0542('0x11')]){for(var _0x5e053e in _0x1eaf3d[_0x0542('0x2b')][_0x0542('0x2c')]){if(_0x1eaf3d[_0x0542('0x2b')][_0x0542('0x2c')]['hasOwnProperty'](_0x5e053e)){db[_0x0542('0x2e')][_0x0542('0x2f')]({'where':{'channel':_0x5e053e,'membername':_0x1eaf3d[_0x0542('0x2d')][_0x0542('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1eaf3d[_0x0542('0x2b')][_0x0542('0x2c')][_0x5e053e]&&_0x1eaf3d[_0x0542('0x2b')][_0x0542('0x2c')][_0x5e053e][_0x0542('0x30')]?{'$notIn':_0x1eaf3d['body'][_0x0542('0x2c')][_0x5e053e]}:{'$ne':null}}})[_0x0542('0x17')](function(_0x3cbdb7){var _0x18736b=moment()[_0x0542('0x31')](_0x0542('0x32'));for(var _0x3c60ff=0x0,_0x10a324=_0x3cbdb7[_0x0542('0x30')];_0x3c60ff<_0x10a324;_0x3c60ff+=0x1){_0x3cbdb7[_0x3c60ff][_0x0542('0x33')]({'exitAt':_0x18736b});}});for(var _0x5d6513=0x0;_0x5d6513<_0x1eaf3d['body'][_0x0542('0x2c')][_0x5e053e][_0x0542('0x30')];_0x5d6513+=0x1){db[_0x0542('0x2e')][_0x0542('0x34')]({'where':{'channel':_0x5e053e,'membername':_0x1eaf3d['user'][_0x0542('0x11')],'type':_0x0542('0x35'),'uniqueid':_0x1eaf3d[_0x0542('0x2b')][_0x0542('0x2c')][_0x5e053e][_0x5d6513],'exitAt':null},'defaults':{'channel':_0x5e053e,'membername':_0x1eaf3d[_0x0542('0x2d')][_0x0542('0x11')],'interface':_['isNil'](_0x1eaf3d[_0x0542('0x2d')][_0x0542('0x36')])?util[_0x0542('0x31')](_0x0542('0x37'),_0x1eaf3d[_0x0542('0x2d')][_0x0542('0x11')]):_0x1eaf3d[_0x0542('0x2d')][_0x0542('0x36')],'type':_0x0542('0x35'),'enterAt':moment()[_0x0542('0x31')](_0x0542('0x32')),'role':'agent','internal':_0x1eaf3d[_0x0542('0x2d')][_0x0542('0x38')],'uniqueid':_0x1eaf3d[_0x0542('0x2b')][_0x0542('0x2c')][_0x5e053e][_0x5d6513]}});}}}}return respondWithRpcPromise(_0x0542('0x39'),{'id':_0x1eaf3d[_0x0542('0x19')]['id'],'capacity':_0x1eaf3d[_0x0542('0x2b')][_0x0542('0x3a')]},routingClient)['then'](respondWithResult(_0x162cc7,null))['catch'](handleError(_0x162cc7,null));};exports['telephones']=function(_0x292d82,_0x5746c9){return respondWithRpcPromise('Telephones',_0x292d82[_0x0542('0x16')])[_0x0542('0x17')](respondWithResult(_0x5746c9,null))[_0x0542('0xd')](handleError(_0x5746c9,null));};exports['trunks']=function(_0xb21b27,_0x54eb91){return respondWithRpcPromise(_0x0542('0x3b'),_0xb21b27['query'])[_0x0542('0x17')](respondWithResult(_0x54eb91,null))[_0x0542('0xd')](handleError(_0x54eb91,null));};exports[_0x0542('0x3c')]=function(_0x55e568,_0x56068f){return respondWithRpcPromise(_0x0542('0x3d'),_0x55e568[_0x0542('0x16')])['then'](respondWithResult(_0x56068f,null))[_0x0542('0xd')](handleError(_0x56068f,null));};exports[_0x0542('0x3e')]=function(_0x596bd0,_0x49dbbf){return respondWithRpcPromise('ChatQueues',_0x596bd0['query'],routingClient)[_0x0542('0x17')](respondWithResult(_0x49dbbf,null))[_0x0542('0xd')](handleError(_0x49dbbf,null));};exports[_0x0542('0x3f')]=function(_0x4ceac8,_0x1898f5){return respondWithRpcPromise(_0x0542('0x40'),_0x4ceac8[_0x0542('0x16')],routingClient)[_0x0542('0x17')](findById(_0x4ceac8['params']['id']))[_0x0542('0x17')](respondWithResult(_0x1898f5,null))[_0x0542('0xd')](handleError(_0x1898f5,null));};exports[_0x0542('0x41')]=function(_0x3b2675,_0x284288){return respondWithRpcPromise(_0x0542('0x42'),_0x3b2675['query'],routingClient)[_0x0542('0x17')](respondWithResult(_0x284288,null))[_0x0542('0xd')](handleError(_0x284288,null));};exports[_0x0542('0x43')]=function(_0x20fedb,_0xe3eacb){return respondWithRpcPromise(_0x0542('0x42'),_0x20fedb[_0x0542('0x16')],routingClient)[_0x0542('0x17')](findById(_0x20fedb['params']['id']))[_0x0542('0x17')](respondWithResult(_0xe3eacb,null))[_0x0542('0xd')](handleError(_0xe3eacb,null));};exports[_0x0542('0x44')]=function(_0x7da7eb,_0x294ea0){return respondWithRpcPromise(_0x0542('0x45'),_0x7da7eb[_0x0542('0x16')],mailClient)['then'](respondWithResult(_0x294ea0,null))[_0x0542('0xd')](handleError(_0x294ea0,null));};exports['openchannelQueues']=function(_0x14927a,_0x10ea73){return respondWithRpcPromise('OpenchannelQueues',_0x14927a[_0x0542('0x16')],routingClient)[_0x0542('0x17')](respondWithResult(_0x10ea73,null))['catch'](handleError(_0x10ea73,null));};exports[_0x0542('0x46')]=function(_0x599c4b,_0x2e3156){return respondWithRpcPromise('OpenchannelQueues',_0x599c4b['query'],routingClient)['then'](findById(_0x599c4b['params']['id']))[_0x0542('0x17')](respondWithResult(_0x2e3156,null))[_0x0542('0xd')](handleError(_0x2e3156,null));};exports[_0x0542('0x47')]=function(_0x51f00c,_0xfbd705){return respondWithRpcPromise('SmsQueues',_0x51f00c['query'],routingClient)[_0x0542('0x17')](respondWithResult(_0xfbd705,null))[_0x0542('0xd')](handleError(_0xfbd705,null));};exports[_0x0542('0x48')]=function(_0x45295b,_0x2a97ab){return respondWithRpcPromise('SmsQueues',_0x45295b[_0x0542('0x16')],routingClient)[_0x0542('0x17')](findById(_0x45295b[_0x0542('0x19')]['id']))['then'](respondWithResult(_0x2a97ab,null))[_0x0542('0xd')](handleError(_0x2a97ab,null));};exports[_0x0542('0x49')]=function(_0x428dfd,_0x38f5a7){return respondWithRpcPromise(_0x0542('0x4a'),_0x428dfd[_0x0542('0x16')],routingClient)[_0x0542('0x17')](respondWithResult(_0x38f5a7,null))[_0x0542('0xd')](handleError(_0x38f5a7,null));};exports[_0x0542('0x4b')]=function(_0x4c2a6f,_0x5d1feb){return respondWithRpcPromise(_0x0542('0x4a'),_0x4c2a6f[_0x0542('0x16')],routingClient)['then'](findById(_0x4c2a6f[_0x0542('0x19')]['id']))[_0x0542('0x17')](respondWithResult(_0x5d1feb,null))[_0x0542('0xd')](handleError(_0x5d1feb,null));};exports[_0x0542('0x4c')]=function(_0x58fc99,_0x3a24bb){return respondWithRpcPromise(_0x0542('0x4d'),_0x58fc99[_0x0542('0x16')],routingClient)['then'](respondWithResult(_0x3a24bb,null))[_0x0542('0xd')](handleError(_0x3a24bb,null));};exports[_0x0542('0x4e')]=function(_0x250b97,_0x3572ae){return respondWithRpcPromise(_0x0542('0x4d'),_0x250b97['query'],routingClient)[_0x0542('0x17')](findById(_0x250b97[_0x0542('0x19')]['id']))[_0x0542('0x17')](respondWithResult(_0x3572ae,null))[_0x0542('0xd')](handleError(_0x3572ae,null));};exports['faxAccounts']=function(_0x449f1d,_0x355e43){return respondWithRpcPromise(_0x0542('0x4f'),_0x449f1d[_0x0542('0x16')])[_0x0542('0x17')](respondWithResult(_0x355e43,null))[_0x0542('0xd')](handleError(_0x355e43,null));};exports[_0x0542('0x50')]=function(_0x3e9735,_0x1e4d98){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x3e9735[_0x0542('0x16')],routingClient)['then'](respondWithResult(_0x1e4d98,null))[_0x0542('0xd')](handleError(_0x1e4d98,null));};exports[_0x0542('0x51')]=function(_0x7ad43,_0x14ab3b){return respondWithRpcPromise(_0x0542('0x52'),_0x7ad43[_0x0542('0x16')],routingClient)[_0x0542('0x17')](respondWithResult(_0x14ab3b,null))[_0x0542('0xd')](handleError(_0x14ab3b,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x17a186,_0x30e8c2){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x17a186[_0x0542('0x16')],routingClient)[_0x0542('0x17')](respondWithResult(_0x30e8c2,null))[_0x0542('0xd')](handleError(_0x30e8c2,null));};exports['smsQueuesWaitingInteractions']=function(_0x3a91d7,_0x3ea8a1){return respondWithRpcPromise(_0x0542('0x53'),_0x3a91d7['query'],routingClient)[_0x0542('0x17')](respondWithResult(_0x3ea8a1,null))['catch'](handleError(_0x3ea8a1,null));};exports[_0x0542('0x54')]=function(_0x3ce3c5,_0x136dec){return respondWithRpcPromise(_0x0542('0x55'),_0x3ce3c5['query'],routingClient)[_0x0542('0x17')](respondWithResult(_0x136dec,null))[_0x0542('0xd')](handleError(_0x136dec,null));};exports[_0x0542('0x56')]=function(_0x3aa2f4,_0x1698df){return respondWithRpcPromise(_0x0542('0x57'),_0x3aa2f4[_0x0542('0x16')],routingClient)[_0x0542('0x17')](respondWithResult(_0x1698df,null))[_0x0542('0xd')](handleError(_0x1698df,null));};exports['queueNotify']=function(_0x3e1f87){return function(_0x24431c,_0x1932b8){var _0x531d66,_0xadf019;var _0x144c38=_[_0x0542('0x58')](_0x3e1f87);var _0x2c5bee=_0x3e1f87===_0x0542('0x59')?_0x0542('0x5a'):'Account';return db[_0x144c38+'Queue'][_0x0542('0x5b')]({'raw':!![],'where':{'id':_0x24431c[_0x0542('0x19')]['id']}})[_0x0542('0x17')](function(_0x3a2851){if(_[_0x0542('0x12')](_0x3a2851)){throw new Error(_0x144c38+_0x0542('0x5c'));}_0x531d66=_0x3a2851;return db[_0x144c38+_0x0542('0x5d')]['findOne']({'where':{'id':_0x24431c[_0x0542('0x2b')][_0x0542('0x5e')]},'include':[{'model':db[_0x144c38+_0x0542('0x5f')],'as':_0x0542('0x5f')},{'model':db[_0x144c38+_0x2c5bee],'as':_0x0542('0x60')}]});})[_0x0542('0x17')](function(_0x3afe27){if(_[_0x0542('0x12')](_0x3afe27)){throw new Error(_0x144c38+_0x0542('0x61'));}_0xadf019=_0x3afe27;return _0x3afe27['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x0542('0x17')](function(){var _0x4b5c29={'uniqueid':_0x3e1f87+'.'+_0xadf019['id']+'.'+_0xadf019[_0x0542('0x5f')]['id'],'FromUserId':_0x24431c['user']['id'],'type':_0x0542('0x62')};_0x4b5c29[_0x144c38+'MessageId']=_0xadf019['id'];_0x4b5c29[_0x144c38+'InteractionId']=_0xadf019[_0x0542('0x5f')]['id'];_0x4b5c29[_0x0542('0x63')+_0x144c38+_0x2c5bee+'Id']=_0xadf019[_0x0542('0x60')]['id'];_0x4b5c29['To'+_0x144c38+'QueueId']=_0x531d66['id'];return db[_0x144c38+_0x0542('0x64')][_0x0542('0x65')](_0x4b5c29);})[_0x0542('0x17')](function(){return respondWithRpcPromise('Start',{'channel':_0x3e1f87,'interaction':_0xadf019[_0x0542('0x5f')],'message':_0xadf019,'account':_0xadf019[_0x0542('0x60')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0542('0x62'),'appdata':_0x531d66[_0x0542('0x11')]+','+(_0xadf019[_0x0542('0x60')][_0x0542('0x66')]||0x12c),'interval':_0x0542('0x67')}]},routingClient);})[_0x0542('0x17')](respondWithResult(_0x1932b8,null))['catch'](handleError(_0x1932b8,null));};};exports[_0x0542('0x68')]=function(_0x278af1,_0x4a9222){var _0x1c3466,_0x585e75;if(_[_0x0542('0x12')](_0x278af1[_0x0542('0x2b')][_0x0542('0x69')])){throw new Error(_0x0542('0x6a'));}var _0x580e80=_0x278af1[_0x0542('0x2b')][_0x0542('0x69')];var _0x53b7b7=_[_0x0542('0x58')](_0x580e80);var _0x6923da=_0x580e80===_0x0542('0x59')?_0x0542('0x5a'):_0x0542('0x60');return db[_0x0542('0x6b')][_0x0542('0x5b')]({'raw':!![],'where':{'id':_0x278af1['params']['id'],'role':_0x0542('0x6c')}})[_0x0542('0x17')](function(_0x146ad4){if(_[_0x0542('0x12')](_0x146ad4)){throw new Error(_0x0542('0x6d'));}_0x1c3466=_0x146ad4;return db[_0x53b7b7+'Message'][_0x0542('0x5b')]({'where':{'id':_0x278af1[_0x0542('0x2b')][_0x0542('0x5e')]},'include':[{'model':db[_0x53b7b7+_0x0542('0x5f')],'as':_0x0542('0x5f')},{'model':db[_0x53b7b7+_0x6923da],'as':_0x0542('0x60')}]});})[_0x0542('0x17')](function(_0x102c5c){if(_['isNil'](_0x102c5c)){throw new Error(_0x53b7b7+_0x0542('0x61'));}_0x585e75=_0x102c5c;return _0x102c5c[_0x0542('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0542('0x17')](function(){var _0x225621={'uniqueid':_0x580e80+'.'+_0x585e75['id']+'.'+_0x585e75[_0x0542('0x5f')]['id'],'FromUserId':_0x278af1[_0x0542('0x2d')]['id'],'type':_0x0542('0x62'),'ToUserId':_0x1c3466['id']};_0x225621[_0x53b7b7+_0x0542('0x6f')]=_0x585e75['id'];_0x225621[_0x53b7b7+_0x0542('0x70')]=_0x585e75[_0x0542('0x5f')]['id'];_0x225621[_0x0542('0x63')+_0x53b7b7+_0x6923da+'Id']=_0x585e75['Account']['id'];return db[_0x53b7b7+_0x0542('0x64')][_0x0542('0x65')](_0x225621);})[_0x0542('0x17')](function(){return respondWithRpcPromise(_0x0542('0x71'),{'channel':_0x580e80,'interaction':_0x585e75[_0x0542('0x5f')],'message':_0x585e75,'account':_0x585e75[_0x0542('0x60')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x1c3466[_0x0542('0x11')]+','+(_0x585e75[_0x0542('0x60')]['agentTransferTimeout']||0x12c),'interval':_0x0542('0x67')}]},routingClient);})[_0x0542('0x17')](respondWithResult(_0x4a9222,null))[_0x0542('0xd')](handleError(_0x4a9222,null));}; \ No newline at end of file +var _0x7e46=['status','json','sendStatus','stack','isNil','find','rows','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','showVoiceQueues','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','body','user','name','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','updateAttributes','findOrCreate','interface','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','messageId','MessageId','create','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','catch'];(function(_0x947ac6,_0x8451bd){var _0xecbb79=function(_0x2b62d2){while(--_0x2b62d2){_0x947ac6['push'](_0x947ac6['shift']());}};_0xecbb79(++_0x8451bd);}(_0x7e46,0x1d4));var _0x67e4=function(_0x424d29,_0x4d1113){_0x424d29=_0x424d29-0x0;var _0x2e3b20=_0x7e46[_0x424d29];return _0x2e3b20;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require('lodash');var util=require('util');var db=require(_0x67e4('0x0'))['db'];var logger=require(_0x67e4('0x1'))(_0x67e4('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x67e4('0x3')]['http']({'port':0x232a});var mailClient=jayson['client'][_0x67e4('0x4')]({'port':0x232b});var routingClient=jayson['client'][_0x67e4('0x4')]({'port':0x232c});function respondWithRpcPromise(_0x30c432,_0x4b43b5,_0x41f1c1){return new BPromise(function(_0x45f95b,_0x6e1d97){var _0x621153=_0x41f1c1?_0x41f1c1:amiClient;return _0x621153[_0x67e4('0x5')](_0x30c432,_0x4b43b5)[_0x67e4('0x6')](function(_0x507590){if(_0x507590[_0x67e4('0x7')]){if(_0x507590[_0x67e4('0x7')][_0x67e4('0x8')]===0x1f4){return _0x6e1d97(_0x507590[_0x67e4('0x7')][_0x67e4('0x9')]);}return _0x45f95b(_0x507590[_0x67e4('0x7')]['message']);}else{_0x45f95b(_0x507590[_0x67e4('0xa')]);}})[_0x67e4('0xb')](function(_0x30b3c7){_0x6e1d97(_0x30b3c7);});});}function respondWithResult(_0x39a803,_0x3c89e5){_0x3c89e5=_0x3c89e5||0xc8;return function(_0x372ca9){if(_0x372ca9){return _0x39a803[_0x67e4('0xc')](_0x3c89e5)[_0x67e4('0xd')](_0x372ca9);}return _0x39a803[_0x67e4('0xe')](0x194);};}function handleError(_0x486bba,_0x28ef50){_0x28ef50=_0x28ef50||0x1f4;return function(_0x24e0b0){logger['error'](_0x24e0b0[_0x67e4('0xf')]);if(_0x24e0b0['name']){delete _0x24e0b0['name'];}_0x486bba[_0x67e4('0xc')](_0x28ef50)['send'](_0x24e0b0);};}function findById(_0x1a5e57){return function(_0x5a3298){if(!_['isNil'](_0x1a5e57)&&!_[_0x67e4('0x10')](_0x5a3298)&&!_[_0x67e4('0x10')](_0x5a3298['rows'])){return _[_0x67e4('0x11')](_0x5a3298[_0x67e4('0x12')],function(_0x53b3e4){return _0x53b3e4['id']==_0x1a5e57;});}return null;};}exports[_0x67e4('0x13')]=function(_0x40d354,_0x57d773){return respondWithRpcPromise('VoiceChannels',_0x40d354[_0x67e4('0x14')])[_0x67e4('0x6')](respondWithResult(_0x57d773,null))[_0x67e4('0xb')](handleError(_0x57d773,null));};exports[_0x67e4('0x15')]=function(_0x944f4e,_0x52be57){return respondWithRpcPromise(_0x67e4('0x16'),_[_0x67e4('0x17')](_0x944f4e[_0x67e4('0x14')],_0x944f4e[_0x67e4('0x18')]))[_0x67e4('0x6')](respondWithResult(_0x52be57,null))[_0x67e4('0xb')](handleError(_0x52be57,null));};exports[_0x67e4('0x19')]=function(_0x435f98,_0x4dc914){return respondWithRpcPromise(_0x67e4('0x1a'),_[_0x67e4('0x17')](_0x435f98[_0x67e4('0x14')],_0x435f98[_0x67e4('0x18')]))[_0x67e4('0x6')](respondWithResult(_0x4dc914,null))[_0x67e4('0xb')](handleError(_0x4dc914,null));};exports['voiceQueues']=function(_0x471db6,_0x3453b9){return respondWithRpcPromise('VoiceQueues',_0x471db6[_0x67e4('0x14')])[_0x67e4('0x6')](respondWithResult(_0x3453b9,null))[_0x67e4('0xb')](handleError(_0x3453b9,null));};exports[_0x67e4('0x1b')]=function(_0x2d3b90,_0x47c3a5){return respondWithRpcPromise(_0x67e4('0x1c'),_0x2d3b90[_0x67e4('0x14')])[_0x67e4('0x6')](findById(_0x2d3b90[_0x67e4('0x18')]['id']))[_0x67e4('0x6')](respondWithResult(_0x47c3a5,null))[_0x67e4('0xb')](handleError(_0x47c3a5,null));};exports[_0x67e4('0x1d')]=function(_0x57bee0,_0x311ebb){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x67e4('0x17')](_0x57bee0[_0x67e4('0x14')],_0x57bee0[_0x67e4('0x18')]))[_0x67e4('0x6')](respondWithResult(_0x311ebb,null))[_0x67e4('0xb')](handleError(_0x311ebb,null));};exports[_0x67e4('0x1e')]=function(_0x3540bb,_0x1cef69){return respondWithRpcPromise(_0x67e4('0x1f'),_0x3540bb['query'])[_0x67e4('0x6')](respondWithResult(_0x1cef69,null))[_0x67e4('0xb')](handleError(_0x1cef69,null));};exports['voiceQueuesChannel']=function(_0x34f7f4,_0x16da62){return respondWithRpcPromise(_0x67e4('0x20'),_[_0x67e4('0x17')](_0x34f7f4['query'],_0x34f7f4[_0x67e4('0x18')]))[_0x67e4('0x6')](respondWithResult(_0x16da62,null))[_0x67e4('0xb')](handleError(_0x16da62,null));};exports[_0x67e4('0x21')]=function(_0x19941f,_0x2f5f3e){return respondWithRpcPromise(_0x67e4('0x22'),_[_0x67e4('0x17')](_0x19941f[_0x67e4('0x14')],_0x19941f[_0x67e4('0x18')]))[_0x67e4('0x6')](respondWithResult(_0x2f5f3e,null))['catch'](handleError(_0x2f5f3e,null));};exports['voiceQueuesChannelRedirect']=function(_0x370ba9,_0x4e6072){return respondWithRpcPromise(_0x67e4('0x23'),_[_0x67e4('0x17')](_0x370ba9[_0x67e4('0x14')],_0x370ba9['params']))[_0x67e4('0x6')](respondWithResult(_0x4e6072,null))['catch'](handleError(_0x4e6072,null));};exports[_0x67e4('0x24')]=function(_0x1495ae,_0x104083){return respondWithRpcPromise(_0x67e4('0x25'),_0x1495ae[_0x67e4('0x14')])[_0x67e4('0x6')](respondWithResult(_0x104083,null))[_0x67e4('0xb')](handleError(_0x104083,null));};exports['outboundChannels']=function(_0x1191ba,_0x30aead){return respondWithRpcPromise(_0x67e4('0x26'),_0x1191ba['query'])[_0x67e4('0x6')](respondWithResult(_0x30aead,null))['catch'](handleError(_0x30aead,null));};exports[_0x67e4('0x27')]=function(_0xd37b56,_0x13ec6c){var _0x438c3c;return respondWithRpcPromise(_0x67e4('0x28'),_0xd37b56[_0x67e4('0x14')])[_0x67e4('0x6')](function(_0x4cea83){_0x438c3c=_0x4cea83;return respondWithRpcPromise('Agents',_0xd37b56[_0x67e4('0x14')],routingClient);})[_0x67e4('0x6')](function(_0x155915){return _[_0x67e4('0x17')]({},_0x155915,_0x438c3c);})[_0x67e4('0x6')](respondWithResult(_0x13ec6c,null))[_0x67e4('0xb')](handleError(_0x13ec6c,null));};exports['agentCapacity']=function(_0x381521,_0x3b5751){if(_0x381521[_0x67e4('0x29')]&&_0x381521[_0x67e4('0x29')]['interaction']&&_0x381521['user']&&_0x381521[_0x67e4('0x2a')][_0x67e4('0x2b')]){for(var _0x471515 in _0x381521[_0x67e4('0x29')]['interaction']){if(_0x381521[_0x67e4('0x29')]['interaction'][_0x67e4('0x2c')](_0x471515)){db[_0x67e4('0x2d')][_0x67e4('0x2e')]({'where':{'channel':_0x471515,'membername':_0x381521[_0x67e4('0x2a')]['name'],'type':_0x67e4('0x2f'),'exitAt':null,'uniqueid':_0x381521[_0x67e4('0x29')][_0x67e4('0x30')][_0x471515]&&_0x381521[_0x67e4('0x29')][_0x67e4('0x30')][_0x471515][_0x67e4('0x31')]?{'$notIn':_0x381521[_0x67e4('0x29')][_0x67e4('0x30')][_0x471515]}:{'$ne':null}}})[_0x67e4('0x6')](function(_0x334dec){var _0x1d8d72=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3fb488=0x0,_0x5a57f3=_0x334dec[_0x67e4('0x31')];_0x3fb488<_0x5a57f3;_0x3fb488+=0x1){_0x334dec[_0x3fb488][_0x67e4('0x32')]({'exitAt':_0x1d8d72});}});for(var _0x4177ba=0x0;_0x4177ba<_0x381521[_0x67e4('0x29')][_0x67e4('0x30')][_0x471515][_0x67e4('0x31')];_0x4177ba+=0x1){db['MemberReport'][_0x67e4('0x33')]({'where':{'channel':_0x471515,'membername':_0x381521[_0x67e4('0x2a')]['name'],'type':_0x67e4('0x2f'),'uniqueid':_0x381521[_0x67e4('0x29')]['interaction'][_0x471515][_0x4177ba],'exitAt':null},'defaults':{'channel':_0x471515,'membername':_0x381521[_0x67e4('0x2a')][_0x67e4('0x2b')],'interface':_['isNil'](_0x381521['user'][_0x67e4('0x34')])?util[_0x67e4('0x35')]('SIP/%s',_0x381521[_0x67e4('0x2a')]['name']):_0x381521[_0x67e4('0x2a')][_0x67e4('0x34')],'type':_0x67e4('0x2f'),'enterAt':moment()[_0x67e4('0x35')](_0x67e4('0x36')),'role':_0x67e4('0x37'),'internal':_0x381521['user'][_0x67e4('0x38')],'uniqueid':_0x381521[_0x67e4('0x29')][_0x67e4('0x30')][_0x471515][_0x4177ba]}});}}}}return respondWithRpcPromise(_0x67e4('0x39'),{'id':_0x381521[_0x67e4('0x18')]['id'],'capacity':_0x381521[_0x67e4('0x29')][_0x67e4('0x3a')]},routingClient)[_0x67e4('0x6')](respondWithResult(_0x3b5751,null))[_0x67e4('0xb')](handleError(_0x3b5751,null));};exports['telephones']=function(_0x5c01bb,_0x4f521d){return respondWithRpcPromise(_0x67e4('0x3b'),_0x5c01bb[_0x67e4('0x14')])[_0x67e4('0x6')](respondWithResult(_0x4f521d,null))['catch'](handleError(_0x4f521d,null));};exports['trunks']=function(_0x4c0603,_0x1a50c5){return respondWithRpcPromise(_0x67e4('0x3c'),_0x4c0603[_0x67e4('0x14')])[_0x67e4('0x6')](respondWithResult(_0x1a50c5,null))['catch'](handleError(_0x1a50c5,null));};exports[_0x67e4('0x3d')]=function(_0x58ce1f,_0x4286d6){return respondWithRpcPromise('Campaigns',_0x58ce1f[_0x67e4('0x14')])['then'](respondWithResult(_0x4286d6,null))['catch'](handleError(_0x4286d6,null));};exports[_0x67e4('0x3e')]=function(_0x2c5884,_0x1d942d){return respondWithRpcPromise(_0x67e4('0x3f'),_0x2c5884[_0x67e4('0x14')],routingClient)['then'](respondWithResult(_0x1d942d,null))[_0x67e4('0xb')](handleError(_0x1d942d,null));};exports[_0x67e4('0x40')]=function(_0x17c3fb,_0x3ea969){return respondWithRpcPromise(_0x67e4('0x3f'),_0x17c3fb[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](findById(_0x17c3fb[_0x67e4('0x18')]['id']))['then'](respondWithResult(_0x3ea969,null))[_0x67e4('0xb')](handleError(_0x3ea969,null));};exports[_0x67e4('0x41')]=function(_0x4a1d66,_0x4700f8){return respondWithRpcPromise(_0x67e4('0x42'),_0x4a1d66[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](respondWithResult(_0x4700f8,null))[_0x67e4('0xb')](handleError(_0x4700f8,null));};exports[_0x67e4('0x43')]=function(_0x2b36c7,_0x3878ee){return respondWithRpcPromise(_0x67e4('0x42'),_0x2b36c7[_0x67e4('0x14')],routingClient)['then'](findById(_0x2b36c7[_0x67e4('0x18')]['id']))[_0x67e4('0x6')](respondWithResult(_0x3878ee,null))[_0x67e4('0xb')](handleError(_0x3878ee,null));};exports['mailAccounts']=function(_0x1e2155,_0x35ce37){return respondWithRpcPromise(_0x67e4('0x44'),_0x1e2155[_0x67e4('0x14')],mailClient)['then'](respondWithResult(_0x35ce37,null))['catch'](handleError(_0x35ce37,null));};exports[_0x67e4('0x45')]=function(_0x899c36,_0xf339a){return respondWithRpcPromise(_0x67e4('0x46'),_0x899c36[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](respondWithResult(_0xf339a,null))['catch'](handleError(_0xf339a,null));};exports[_0x67e4('0x47')]=function(_0x3b7520,_0x45c894){return respondWithRpcPromise('OpenchannelQueues',_0x3b7520[_0x67e4('0x14')],routingClient)['then'](findById(_0x3b7520[_0x67e4('0x18')]['id']))[_0x67e4('0x6')](respondWithResult(_0x45c894,null))[_0x67e4('0xb')](handleError(_0x45c894,null));};exports[_0x67e4('0x48')]=function(_0x3683bb,_0x456c2d){return respondWithRpcPromise(_0x67e4('0x49'),_0x3683bb['query'],routingClient)['then'](respondWithResult(_0x456c2d,null))[_0x67e4('0xb')](handleError(_0x456c2d,null));};exports[_0x67e4('0x4a')]=function(_0x2bf8d6,_0x233e34){return respondWithRpcPromise(_0x67e4('0x49'),_0x2bf8d6[_0x67e4('0x14')],routingClient)['then'](findById(_0x2bf8d6['params']['id']))[_0x67e4('0x6')](respondWithResult(_0x233e34,null))['catch'](handleError(_0x233e34,null));};exports[_0x67e4('0x4b')]=function(_0x34e0d5,_0x269246){return respondWithRpcPromise('WhatsappQueues',_0x34e0d5[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](respondWithResult(_0x269246,null))[_0x67e4('0xb')](handleError(_0x269246,null));};exports[_0x67e4('0x4c')]=function(_0x3d556c,_0xb8e0d7){return respondWithRpcPromise(_0x67e4('0x4d'),_0x3d556c['query'],routingClient)[_0x67e4('0x6')](findById(_0x3d556c[_0x67e4('0x18')]['id']))[_0x67e4('0x6')](respondWithResult(_0xb8e0d7,null))['catch'](handleError(_0xb8e0d7,null));};exports[_0x67e4('0x4e')]=function(_0x528999,_0xd9d98a){return respondWithRpcPromise(_0x67e4('0x4f'),_0x528999[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](respondWithResult(_0xd9d98a,null))[_0x67e4('0xb')](handleError(_0xd9d98a,null));};exports[_0x67e4('0x50')]=function(_0x3bf9f4,_0x320bd7){return respondWithRpcPromise(_0x67e4('0x4f'),_0x3bf9f4[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](findById(_0x3bf9f4[_0x67e4('0x18')]['id']))[_0x67e4('0x6')](respondWithResult(_0x320bd7,null))[_0x67e4('0xb')](handleError(_0x320bd7,null));};exports[_0x67e4('0x51')]=function(_0x12c78b,_0x15ac44){return respondWithRpcPromise(_0x67e4('0x52'),_0x12c78b['query'])[_0x67e4('0x6')](respondWithResult(_0x15ac44,null))[_0x67e4('0xb')](handleError(_0x15ac44,null));};exports['chatQueuesWaitingInteractions']=function(_0x478d55,_0x3bb2b0){return respondWithRpcPromise(_0x67e4('0x53'),_0x478d55['query'],routingClient)[_0x67e4('0x6')](respondWithResult(_0x3bb2b0,null))[_0x67e4('0xb')](handleError(_0x3bb2b0,null));};exports[_0x67e4('0x54')]=function(_0xed5729,_0x350281){return respondWithRpcPromise(_0x67e4('0x55'),_0xed5729['query'],routingClient)[_0x67e4('0x6')](respondWithResult(_0x350281,null))['catch'](handleError(_0x350281,null));};exports[_0x67e4('0x56')]=function(_0x58d03b,_0x120210){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58d03b['query'],routingClient)[_0x67e4('0x6')](respondWithResult(_0x120210,null))['catch'](handleError(_0x120210,null));};exports[_0x67e4('0x57')]=function(_0x55949c,_0x22a19b){return respondWithRpcPromise(_0x67e4('0x58'),_0x55949c['query'],routingClient)[_0x67e4('0x6')](respondWithResult(_0x22a19b,null))[_0x67e4('0xb')](handleError(_0x22a19b,null));};exports[_0x67e4('0x59')]=function(_0x2d4f66,_0x30937d){return respondWithRpcPromise(_0x67e4('0x5a'),_0x2d4f66[_0x67e4('0x14')],routingClient)[_0x67e4('0x6')](respondWithResult(_0x30937d,null))[_0x67e4('0xb')](handleError(_0x30937d,null));};exports[_0x67e4('0x5b')]=function(_0x5be828,_0x1bf588){return respondWithRpcPromise(_0x67e4('0x5c'),_0x5be828[_0x67e4('0x14')],routingClient)['then'](respondWithResult(_0x1bf588,null))[_0x67e4('0xb')](handleError(_0x1bf588,null));};exports[_0x67e4('0x5d')]=function(_0x476332){return function(_0x17b662,_0x41afc6){var _0xc9aa8c,_0x206799;var _0x340ab8=_[_0x67e4('0x5e')](_0x476332);var _0x397200=_0x476332===_0x67e4('0x5f')?_0x67e4('0x60'):_0x67e4('0x61');return db[_0x340ab8+'Queue'][_0x67e4('0x62')]({'raw':!![],'where':{'id':_0x17b662[_0x67e4('0x18')]['id']}})['then'](function(_0x5eb894){if(_[_0x67e4('0x10')](_0x5eb894)){throw new Error(_0x340ab8+_0x67e4('0x63'));}_0xc9aa8c=_0x5eb894;return db[_0x340ab8+_0x67e4('0x64')]['findOne']({'where':{'id':_0x17b662[_0x67e4('0x29')]['messageId']},'include':[{'model':db[_0x340ab8+_0x67e4('0x65')],'as':_0x67e4('0x65')},{'model':db[_0x340ab8+_0x397200],'as':_0x67e4('0x61')}]});})[_0x67e4('0x6')](function(_0x3ea7f1){if(_[_0x67e4('0x10')](_0x3ea7f1)){throw new Error(_0x340ab8+_0x67e4('0x66'));}_0x206799=_0x3ea7f1;return _0x3ea7f1[_0x67e4('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x67e4('0x6')](function(){var _0x160afd={'uniqueid':_0x476332+'.'+_0x206799['id']+'.'+_0x206799['Interaction']['id'],'FromUserId':_0x17b662[_0x67e4('0x2a')]['id'],'type':_0x67e4('0x68')};_0x160afd[_0x340ab8+'MessageId']=_0x206799['id'];_0x160afd[_0x340ab8+_0x67e4('0x69')]=_0x206799[_0x67e4('0x65')]['id'];_0x160afd[_0x67e4('0x6a')+_0x340ab8+_0x397200+'Id']=_0x206799[_0x67e4('0x61')]['id'];_0x160afd['To'+_0x340ab8+_0x67e4('0x6b')]=_0xc9aa8c['id'];return db[_0x340ab8+_0x67e4('0x6c')]['create'](_0x160afd);})[_0x67e4('0x6')](function(){return respondWithRpcPromise(_0x67e4('0x6d'),{'channel':_0x476332,'interaction':_0x206799['Interaction'],'message':_0x206799,'account':_0x206799[_0x67e4('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0x67e4('0x68'),'appdata':_0xc9aa8c['name']+','+(_0x206799[_0x67e4('0x61')][_0x67e4('0x6e')]||0x12c),'interval':_0x67e4('0x6f')}]},routingClient);})[_0x67e4('0x6')](respondWithResult(_0x41afc6,null))[_0x67e4('0xb')](handleError(_0x41afc6,null));};};exports[_0x67e4('0x70')]=function(_0x1786ef,_0xdd39b3){var _0x418e3f,_0x3dfb1c;if(_[_0x67e4('0x10')](_0x1786ef[_0x67e4('0x29')][_0x67e4('0x71')])){throw new Error(_0x67e4('0x72'));}var _0x23714d=_0x1786ef[_0x67e4('0x29')][_0x67e4('0x71')];var _0x5c3e44=_['capitalize'](_0x23714d);var _0x1fbcd3=_0x23714d===_0x67e4('0x5f')?_0x67e4('0x60'):_0x67e4('0x61');return db[_0x67e4('0x73')]['findOne']({'raw':!![],'where':{'id':_0x1786ef['params']['id'],'role':_0x67e4('0x37')}})[_0x67e4('0x6')](function(_0x401e2e){if(_[_0x67e4('0x10')](_0x401e2e)){throw new Error(_0x67e4('0x74'));}_0x418e3f=_0x401e2e;return db[_0x5c3e44+_0x67e4('0x64')][_0x67e4('0x62')]({'where':{'id':_0x1786ef[_0x67e4('0x29')][_0x67e4('0x75')]},'include':[{'model':db[_0x5c3e44+'Interaction'],'as':_0x67e4('0x65')},{'model':db[_0x5c3e44+_0x1fbcd3],'as':_0x67e4('0x61')}]});})['then'](function(_0x3b93e6){if(_['isNil'](_0x3b93e6)){throw new Error(_0x5c3e44+'\x20Message\x20not\x20found');}_0x3dfb1c=_0x3b93e6;return _0x3b93e6[_0x67e4('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x67e4('0x6')](function(){var _0x33f597={'uniqueid':_0x23714d+'.'+_0x3dfb1c['id']+'.'+_0x3dfb1c['Interaction']['id'],'FromUserId':_0x1786ef[_0x67e4('0x2a')]['id'],'type':'queue','ToUserId':_0x418e3f['id']};_0x33f597[_0x5c3e44+_0x67e4('0x76')]=_0x3dfb1c['id'];_0x33f597[_0x5c3e44+_0x67e4('0x69')]=_0x3dfb1c['Interaction']['id'];_0x33f597[_0x67e4('0x6a')+_0x5c3e44+_0x1fbcd3+'Id']=_0x3dfb1c[_0x67e4('0x61')]['id'];return db[_0x5c3e44+_0x67e4('0x6c')][_0x67e4('0x77')](_0x33f597);})[_0x67e4('0x6')](function(){return respondWithRpcPromise('Start',{'channel':_0x23714d,'interaction':_0x3dfb1c[_0x67e4('0x65')],'message':_0x3dfb1c,'account':_0x3dfb1c[_0x67e4('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x418e3f[_0x67e4('0x2b')]+','+(_0x3dfb1c[_0x67e4('0x61')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x67e4('0x6')](respondWithResult(_0xdd39b3,null))[_0x67e4('0xb')](handleError(_0xdd39b3,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index b016017..99de8e2 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 _0x652b=['../../config/environment','./schedule.controller','isAuthenticated','index','/:id','get','post','create','put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x4467d0,_0x514b12){var _0xc5b8ce=function(_0x1cdacb){while(--_0x1cdacb){_0x4467d0['push'](_0x4467d0['shift']());}};_0xc5b8ce(++_0x514b12);}(_0x652b,0xbb));var _0xb652=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x652b[_0x155c64];return _0x1f154a;};'use strict';var multer=require(_0xb652('0x0'));var util=require(_0xb652('0x1'));var path=require('path');var timeout=require(_0xb652('0x2'));var express=require(_0xb652('0x3'));var router=express['Router']();var auth=require(_0xb652('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb652('0x5'));var controller=require(_0xb652('0x6'));router['get']('/',auth[_0xb652('0x7')](),controller[_0xb652('0x8')]);router['get'](_0xb652('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xb652('0xa')]('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0xb652('0xb')]('/',auth[_0xb652('0x7')](),controller[_0xb652('0xc')]);router[_0xb652('0xd')](_0xb652('0x9'),auth[_0xb652('0x7')](),controller['update']);router[_0xb652('0xe')](_0xb652('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xb652('0xf')]=router; \ No newline at end of file +var _0x67a0=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/run','post','put','update','delete'];(function(_0x4d502e,_0x950daa){var _0x45eac8=function(_0x535d62){while(--_0x535d62){_0x4d502e['push'](_0x4d502e['shift']());}};_0x45eac8(++_0x950daa);}(_0x67a0,0x1a0));var _0x067a=function(_0xf41ba7,_0x5d943f){_0xf41ba7=_0xf41ba7-0x0;var _0x3d6d97=_0x67a0[_0xf41ba7];return _0x3d6d97;};'use strict';var multer=require(_0x067a('0x0'));var util=require(_0x067a('0x1'));var path=require('path');var timeout=require(_0x067a('0x2'));var express=require(_0x067a('0x3'));var router=express[_0x067a('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x067a('0x5'));var config=require(_0x067a('0x6'));var controller=require('./schedule.controller');router[_0x067a('0x7')]('/',auth[_0x067a('0x8')](),controller[_0x067a('0x9')]);router[_0x067a('0x7')](_0x067a('0xa'),auth[_0x067a('0x8')](),controller['show']);router[_0x067a('0x7')](_0x067a('0xb'),auth[_0x067a('0x8')](),controller['run']);router[_0x067a('0xc')]('/',auth[_0x067a('0x8')](),controller['create']);router[_0x067a('0xd')](_0x067a('0xa'),auth['isAuthenticated'](),controller[_0x067a('0xe')]);router[_0x067a('0xf')](_0x067a('0xa'),auth['isAuthenticated'](),controller[_0x067a('0x10')]);module[_0x067a('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 70ddcb7..5864ffe 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 _0x6bac=['sequelize','STRING','BOOLEAN','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','csv','default','custom','TEXT'];(function(_0x4bb48b,_0x25894f){var _0x3d4f32=function(_0x1e9d4a){while(--_0x1e9d4a){_0x4bb48b['push'](_0x4bb48b['shift']());}};_0x3d4f32(++_0x25894f);}(_0x6bac,0xa5));var _0xc6ba=function(_0xa585ec,_0x1b698b){_0xa585ec=_0xa585ec-0x0;var _0xac8c07=_0x6bac[_0xa585ec];return _0xac8c07;};'use strict';var Sequelize=require(_0xc6ba('0x0'));module['exports']={'name':{'type':Sequelize[_0xc6ba('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc6ba('0x1')]},'active':{'type':Sequelize[_0xc6ba('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc6ba('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc6ba('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc6ba('0x4')]('years',_0xc6ba('0x5'),_0xc6ba('0x6'),_0xc6ba('0x7'),_0xc6ba('0x8'),_0xc6ba('0x9'),_0xc6ba('0xa')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0xc6ba('0xb'),'pdf','xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM']('custom',_0xc6ba('0xc')),'allowNull':![],'defaultValue':_0xc6ba('0xd')},'sendMail':{'type':Sequelize[_0xc6ba('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xc6ba('0x1')]},'cc':{'type':Sequelize[_0xc6ba('0xe')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x44ff=['TEXT','exports','STRING','DATE','INTEGER','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx','ENUM','custom','default','BOOLEAN'];(function(_0x36cc88,_0x5d3b0e){var _0x1faf9a=function(_0x15819e){while(--_0x15819e){_0x36cc88['push'](_0x36cc88['shift']());}};_0x1faf9a(++_0x5d3b0e);}(_0x44ff,0x1c3));var _0xf44f=function(_0x547427,_0x2d569c){_0x547427=_0x547427-0x0;var _0x381bbc=_0x44ff[_0x547427];return _0x381bbc;};'use strict';var Sequelize=require('sequelize');module[_0xf44f('0x0')]={'name':{'type':Sequelize[_0xf44f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf44f('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xf44f('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf44f('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xf44f('0x4'),_0xf44f('0x5'),_0xf44f('0x6'),'days',_0xf44f('0x7'),_0xf44f('0x8')),'allowNull':![],'defaultValue':_0xf44f('0x9')},'output':{'type':Sequelize['ENUM'](_0xf44f('0xa'),_0xf44f('0xb'),_0xf44f('0xc')),'allowNull':![],'defaultValue':_0xf44f('0xa')},'type':{'type':Sequelize[_0xf44f('0xd')](_0xf44f('0xe'),_0xf44f('0xf')),'allowNull':![],'defaultValue':_0xf44f('0xe')},'sendMail':{'type':Sequelize[_0xf44f('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0xf44f('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xf44f('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xf44f('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 978526b..381a348 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 _0xd466=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','stack','name','index','Schedule','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','run'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd466,0xf3));var _0x6d46=function(_0x574b7f,_0x5a758e){_0x574b7f=_0x574b7f-0x0;var _0x3da1af=_0xd466[_0x574b7f];return _0x3da1af;};'use strict';var pdf=require(_0x6d46('0x0'));var emlformat=require(_0x6d46('0x1'));var rimraf=require(_0x6d46('0x2'));var zipdir=require(_0x6d46('0x3'));var jsonpatch=require(_0x6d46('0x4'));var rp=require(_0x6d46('0x5'));var moment=require(_0x6d46('0x6'));var BPromise=require(_0x6d46('0x7'));var Mustache=require(_0x6d46('0x8'));var util=require(_0x6d46('0x9'));var path=require('path');var sox=require(_0x6d46('0xa'));var csv=require(_0x6d46('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6d46('0xc'));var squel=require(_0x6d46('0xd'));var crypto=require(_0x6d46('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6d46('0xf'));var toCsv=require(_0x6d46('0xb'));var querystring=require(_0x6d46('0x10'));var Papa=require(_0x6d46('0x11'));var Redis=require('ioredis');var authService=require(_0x6d46('0x12'));var qs=require(_0x6d46('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d46('0x14'));var logger=require(_0x6d46('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6d46('0x16'))['db'];function respondWithStatusCode(_0x90e6a9,_0xd12a33){_0xd12a33=_0xd12a33||0xcc;return function(_0x9f2932){if(_0x9f2932){return _0x90e6a9['sendStatus'](_0xd12a33);}return _0x90e6a9[_0x6d46('0x17')](_0xd12a33)[_0x6d46('0x18')]();};}function respondWithResult(_0x232c83,_0x25c291){_0x25c291=_0x25c291||0xc8;return function(_0x3aae21){if(_0x3aae21){return _0x232c83[_0x6d46('0x17')](_0x25c291)[_0x6d46('0x19')](_0x3aae21);}};}function respondWithFilteredResult(_0x2fc684,_0x19354c){return function(_0x7f6bee){if(_0x7f6bee){var _0x370a61=_0x7f6bee[_0x6d46('0x1a')],_0x36ee82=_0x19354c[_0x6d46('0x1b')],_0x3ef281=_0x19354c[_0x6d46('0x1b')]+_0x19354c[_0x6d46('0x1c')],_0x4fe3ae;if(_0x3ef281>=_0x370a61){_0x3ef281=_0x370a61;_0x4fe3ae=0xc8;}else{_0x4fe3ae=0xce;}_0x2fc684[_0x6d46('0x17')](_0x4fe3ae);return _0x2fc684[_0x6d46('0x1d')](_0x6d46('0x1e'),_0x36ee82+'-'+_0x3ef281+'/'+_0x370a61)[_0x6d46('0x19')](_0x7f6bee);}return null;};}function patchUpdates(_0x77126f){return function(_0x29f3bc){try{jsonpatch['apply'](_0x29f3bc,_0x77126f,!![]);}catch(_0x466848){return BPromise[_0x6d46('0x1f')](_0x466848);}return _0x29f3bc[_0x6d46('0x20')]();};}function saveUpdates(_0x4d3267,_0x338a62){return function(_0x2eae68){if(_0x2eae68){return _0x2eae68[_0x6d46('0x21')](_0x4d3267)[_0x6d46('0x22')](function(_0x47a6be){return _0x47a6be;});}return null;};}function removeEntity(_0x3a3e53,_0x1c2949){return function(_0x1aacb4){if(_0x1aacb4){return _0x1aacb4[_0x6d46('0x23')]()[_0x6d46('0x22')](function(){var _0x363943=_0x1aacb4[_0x6d46('0x24')]({'plain':!![]});var _0x16142c=_0x6d46('0x25');return db[_0x6d46('0x26')][_0x6d46('0x23')]({'where':{'type':_0x16142c,'resourceId':_0x363943['id']}})['then'](function(){return _0x1aacb4;});})[_0x6d46('0x22')](function(){_0x3a3e53[_0x6d46('0x17')](0xcc)[_0x6d46('0x18')]();});}};}function handleEntityNotFound(_0x119aae,_0x245ff7){return function(_0x4bfc77){if(!_0x4bfc77){_0x119aae[_0x6d46('0x27')](0x194);}return _0x4bfc77;};}function handleError(_0x233e7c,_0x104071){_0x104071=_0x104071||0x1f4;return function(_0x25113c){logger['error'](_0x25113c[_0x6d46('0x28')]);if(_0x25113c[_0x6d46('0x29')]){delete _0x25113c[_0x6d46('0x29')];}_0x233e7c[_0x6d46('0x17')](_0x104071)['send'](_0x25113c);};}exports[_0x6d46('0x2a')]=function(_0xbef7ef,_0x307b9e){var _0x195a32={},_0x3ebbba={},_0x4b9139={'count':0x0,'rows':[]};var _0x646b1=_['map'](db[_0x6d46('0x2b')][_0x6d46('0x2c')],function(_0x4711a8){return{'name':_0x4711a8[_0x6d46('0x2d')],'type':_0x4711a8[_0x6d46('0x2e')][_0x6d46('0x2f')]};});_0x3ebbba['model']=_[_0x6d46('0x30')](_0x646b1,_0x6d46('0x29'));_0x3ebbba[_0x6d46('0x31')]=_['keys'](_0xbef7ef['query']);_0x3ebbba[_0x6d46('0x32')]=_['intersection'](_0x3ebbba['model'],_0x3ebbba[_0x6d46('0x31')]);_0x195a32['attributes']=_[_0x6d46('0x33')](_0x3ebbba[_0x6d46('0x34')],qs['fields'](_0xbef7ef['query']['fields']));_0x195a32['attributes']=_0x195a32[_0x6d46('0x35')][_0x6d46('0x36')]?_0x195a32[_0x6d46('0x35')]:_0x3ebbba[_0x6d46('0x34')];if(!_0xbef7ef[_0x6d46('0x31')][_0x6d46('0x37')]('nolimit')){_0x195a32[_0x6d46('0x1c')]=qs[_0x6d46('0x1c')](_0xbef7ef[_0x6d46('0x31')][_0x6d46('0x1c')]);_0x195a32[_0x6d46('0x1b')]=qs[_0x6d46('0x1b')](_0xbef7ef[_0x6d46('0x31')][_0x6d46('0x1b')]);}_0x195a32['order']=qs['sort'](_0xbef7ef[_0x6d46('0x31')][_0x6d46('0x38')]);_0x195a32[_0x6d46('0x39')]=qs['filters'](_[_0x6d46('0x3a')](_0xbef7ef[_0x6d46('0x31')],_0x3ebbba[_0x6d46('0x32')]),_0x646b1);if(_0xbef7ef[_0x6d46('0x31')][_0x6d46('0x3b')]){_0x195a32[_0x6d46('0x39')]=_[_0x6d46('0x3c')](_0x195a32['where'],{'$or':_[_0x6d46('0x30')](_0x646b1,function(_0x4057b4){if(_0x4057b4[_0x6d46('0x2e')]!==_0x6d46('0x3d')){var _0x47eb65={};_0x47eb65[_0x4057b4[_0x6d46('0x29')]]={'$like':'%'+_0xbef7ef[_0x6d46('0x31')][_0x6d46('0x3b')]+'%'};return _0x47eb65;}})});}_0x195a32=_[_0x6d46('0x3c')]({},_0x195a32,_0xbef7ef[_0x6d46('0x3e')]);var _0x57226d={'where':_0x195a32['where']};return db[_0x6d46('0x2b')][_0x6d46('0x1a')](_0x57226d)['then'](function(_0x23ae0d){_0x4b9139[_0x6d46('0x1a')]=_0x23ae0d;if(_0xbef7ef[_0x6d46('0x31')][_0x6d46('0x3f')]){_0x195a32[_0x6d46('0x40')]=[{'all':!![]}];}return db[_0x6d46('0x2b')][_0x6d46('0x41')](_0x195a32);})[_0x6d46('0x22')](function(_0x4ea414){_0x4b9139['rows']=_0x4ea414;return _0x4b9139;})[_0x6d46('0x22')](respondWithFilteredResult(_0x307b9e,_0x195a32))[_0x6d46('0x42')](handleError(_0x307b9e,null));};exports[_0x6d46('0x43')]=function(_0x339e02,_0x3de886){var _0x1a8568={'raw':![],'where':{'id':_0x339e02[_0x6d46('0x44')]['id']}},_0x562224={};_0x562224[_0x6d46('0x34')]=_[_0x6d46('0x45')](db[_0x6d46('0x2b')]['rawAttributes']);_0x562224[_0x6d46('0x31')]=_[_0x6d46('0x45')](_0x339e02[_0x6d46('0x31')]);_0x562224['filters']=_[_0x6d46('0x33')](_0x562224[_0x6d46('0x34')],_0x562224['query']);_0x1a8568['attributes']=_[_0x6d46('0x33')](_0x562224['model'],qs[_0x6d46('0x46')](_0x339e02['query'][_0x6d46('0x46')]));_0x1a8568[_0x6d46('0x35')]=_0x1a8568['attributes'][_0x6d46('0x36')]?_0x1a8568['attributes']:_0x562224['model'];if(_0x339e02['query']['includeAll']){_0x1a8568['include']=[{'all':!![]}];}_0x1a8568=_[_0x6d46('0x3c')]({},_0x1a8568,_0x339e02[_0x6d46('0x3e')]);return db[_0x6d46('0x2b')]['find'](_0x1a8568)[_0x6d46('0x22')](handleEntityNotFound(_0x3de886,null))[_0x6d46('0x22')](respondWithResult(_0x3de886,null))[_0x6d46('0x42')](handleError(_0x3de886,null));};exports[_0x6d46('0x47')]=function(_0x1a851f,_0x47b417){return db[_0x6d46('0x2b')]['create'](_0x1a851f[_0x6d46('0x48')],{})[_0x6d46('0x22')](function(_0xfc06d4){var _0x3a2a44=_0x1a851f['user']['get']({'plain':!![]});if(!_0x3a2a44)throw new Error(_0x6d46('0x49'));if(_0x3a2a44['role']===_0x6d46('0x4a')){var _0x545f70=_0xfc06d4[_0x6d46('0x24')]({'plain':!![]});var _0x3117d5=_0x6d46('0x25');return db[_0x6d46('0x4b')]['find']({'where':{'name':_0x3117d5,'userProfileId':_0x3a2a44[_0x6d46('0x4c')]},'raw':!![]})[_0x6d46('0x22')](function(_0x1d3a56){if(_0x1d3a56&&_0x1d3a56['autoAssociation']===0x0){return db[_0x6d46('0x26')][_0x6d46('0x47')]({'name':_0x545f70[_0x6d46('0x29')],'resourceId':_0x545f70['id'],'type':_0x1d3a56[_0x6d46('0x29')],'sectionId':_0x1d3a56['id']},{})[_0x6d46('0x22')](function(){return _0xfc06d4;});}else{return _0xfc06d4;}})['catch'](function(_0x2b9dcf){logger[_0x6d46('0x4d')](_0x6d46('0x4e'),_0x2b9dcf);throw _0x2b9dcf;});}return _0xfc06d4;})[_0x6d46('0x22')](respondWithResult(_0x47b417,0xc9))[_0x6d46('0x42')](handleError(_0x47b417,null));};exports[_0x6d46('0x21')]=function(_0x1d9c0c,_0x53b3db){if(_0x1d9c0c['body']['id']){delete _0x1d9c0c[_0x6d46('0x48')]['id'];}return db['Schedule'][_0x6d46('0x4f')]({'where':{'id':_0x1d9c0c['params']['id']}})['then'](handleEntityNotFound(_0x53b3db,null))[_0x6d46('0x22')](saveUpdates(_0x1d9c0c['body'],null))[_0x6d46('0x22')](respondWithResult(_0x53b3db,null))['catch'](handleError(_0x53b3db,null));};exports[_0x6d46('0x23')]=function(_0x1c1988,_0x24c3bf){return db[_0x6d46('0x2b')][_0x6d46('0x4f')]({'where':{'id':_0x1c1988[_0x6d46('0x44')]['id']}})[_0x6d46('0x22')](handleEntityNotFound(_0x24c3bf,null))[_0x6d46('0x22')](removeEntity(_0x24c3bf,null))['catch'](handleError(_0x24c3bf,null));};exports['run']=function(_0x51f137,_0xadbefa,_0x18cd7a){var _0xf80ee7=require('../../config/schedule');return db[_0x6d46('0x2b')][_0x6d46('0x4f')]({'where':{'id':_0x51f137[_0x6d46('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xadbefa,null))[_0x6d46('0x22')](function(){_0xf80ee7[_0x6d46('0x50')](_0x51f137['params']['id']);})['then'](respondWithStatusCode(_0xadbefa,null))[_0x6d46('0x42')](handleError(_0xadbefa,null));}; \ No newline at end of file +var _0xf3d4=['body','user','get','role','autoAssociation','params','run','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','error','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','create'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xf3d4,0x1db));var _0x4f3d=function(_0x4913f9,_0x37e9f8){_0x4913f9=_0x4913f9-0x0;var _0xc1e224=_0xf3d4[_0x4913f9];return _0xc1e224;};'use strict';var pdf=require(_0x4f3d('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f3d('0x1'));var jsonpatch=require(_0x4f3d('0x2'));var rp=require(_0x4f3d('0x3'));var moment=require(_0x4f3d('0x4'));var BPromise=require(_0x4f3d('0x5'));var Mustache=require(_0x4f3d('0x6'));var util=require(_0x4f3d('0x7'));var path=require(_0x4f3d('0x8'));var sox=require(_0x4f3d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4f3d('0xa'));var squel=require(_0x4f3d('0xb'));var crypto=require(_0x4f3d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4f3d('0xd'));var toCsv=require(_0x4f3d('0xe'));var querystring=require('querystring');var Papa=require(_0x4f3d('0xf'));var Redis=require('ioredis');var authService=require(_0x4f3d('0x10'));var qs=require(_0x4f3d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4f3d('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4f3d('0x13'))['db'];function respondWithStatusCode(_0xdd01b5,_0x216e5e){_0x216e5e=_0x216e5e||0xcc;return function(_0x2a36e6){if(_0x2a36e6){return _0xdd01b5[_0x4f3d('0x14')](_0x216e5e);}return _0xdd01b5[_0x4f3d('0x15')](_0x216e5e)[_0x4f3d('0x16')]();};}function respondWithResult(_0x55b4bc,_0xbea1af){_0xbea1af=_0xbea1af||0xc8;return function(_0x4c87b2){if(_0x4c87b2){return _0x55b4bc[_0x4f3d('0x15')](_0xbea1af)[_0x4f3d('0x17')](_0x4c87b2);}};}function respondWithFilteredResult(_0x46b953,_0x16d0fd){return function(_0x1f0e39){if(_0x1f0e39){var _0x4c6007=_0x1f0e39[_0x4f3d('0x18')],_0x5f4fb9=_0x16d0fd[_0x4f3d('0x19')],_0x36021c=_0x16d0fd[_0x4f3d('0x19')]+_0x16d0fd[_0x4f3d('0x1a')],_0x98f683;if(_0x36021c>=_0x4c6007){_0x36021c=_0x4c6007;_0x98f683=0xc8;}else{_0x98f683=0xce;}_0x46b953[_0x4f3d('0x15')](_0x98f683);return _0x46b953[_0x4f3d('0x1b')](_0x4f3d('0x1c'),_0x5f4fb9+'-'+_0x36021c+'/'+_0x4c6007)[_0x4f3d('0x17')](_0x1f0e39);}return null;};}function patchUpdates(_0x31669c){return function(_0x4d0214){try{jsonpatch[_0x4f3d('0x1d')](_0x4d0214,_0x31669c,!![]);}catch(_0x4212f9){return BPromise[_0x4f3d('0x1e')](_0x4212f9);}return _0x4d0214[_0x4f3d('0x1f')]();};}function saveUpdates(_0x4182b4,_0xb962d2){return function(_0x1675eb){if(_0x1675eb){return _0x1675eb[_0x4f3d('0x20')](_0x4182b4)[_0x4f3d('0x21')](function(_0x1c756d){return _0x1c756d;});}return null;};}function removeEntity(_0x5afc1c,_0x4c9d49){return function(_0x257f21){if(_0x257f21){return _0x257f21[_0x4f3d('0x22')]()[_0x4f3d('0x21')](function(){var _0x5aa3c8=_0x257f21['get']({'plain':!![]});var _0x1d4c16=_0x4f3d('0x23');return db[_0x4f3d('0x24')][_0x4f3d('0x22')]({'where':{'type':_0x1d4c16,'resourceId':_0x5aa3c8['id']}})[_0x4f3d('0x21')](function(){return _0x257f21;});})['then'](function(){_0x5afc1c[_0x4f3d('0x15')](0xcc)[_0x4f3d('0x16')]();});}};}function handleEntityNotFound(_0x1347bf,_0x3822de){return function(_0x1c434b){if(!_0x1c434b){_0x1347bf[_0x4f3d('0x14')](0x194);}return _0x1c434b;};}function handleError(_0x31a4a5,_0x16ba3a){_0x16ba3a=_0x16ba3a||0x1f4;return function(_0x238964){logger[_0x4f3d('0x25')](_0x238964['stack']);if(_0x238964[_0x4f3d('0x26')]){delete _0x238964['name'];}_0x31a4a5[_0x4f3d('0x15')](_0x16ba3a)[_0x4f3d('0x27')](_0x238964);};}exports[_0x4f3d('0x28')]=function(_0x351f00,_0x2abfb3){var _0x11c5b3={},_0xa27eb9={},_0x14a8f7={'count':0x0,'rows':[]};var _0x7cb4bf=_[_0x4f3d('0x29')](db[_0x4f3d('0x2a')]['rawAttributes'],function(_0x1d2a11){return{'name':_0x1d2a11[_0x4f3d('0x2b')],'type':_0x1d2a11[_0x4f3d('0x2c')][_0x4f3d('0x2d')]};});_0xa27eb9[_0x4f3d('0x2e')]=_[_0x4f3d('0x29')](_0x7cb4bf,'name');_0xa27eb9[_0x4f3d('0x2f')]=_[_0x4f3d('0x30')](_0x351f00[_0x4f3d('0x2f')]);_0xa27eb9[_0x4f3d('0x31')]=_[_0x4f3d('0x32')](_0xa27eb9[_0x4f3d('0x2e')],_0xa27eb9[_0x4f3d('0x2f')]);_0x11c5b3['attributes']=_[_0x4f3d('0x32')](_0xa27eb9['model'],qs[_0x4f3d('0x33')](_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x33')]));_0x11c5b3['attributes']=_0x11c5b3[_0x4f3d('0x34')]['length']?_0x11c5b3[_0x4f3d('0x34')]:_0xa27eb9[_0x4f3d('0x2e')];if(!_0x351f00['query'][_0x4f3d('0x35')](_0x4f3d('0x36'))){_0x11c5b3[_0x4f3d('0x1a')]=qs[_0x4f3d('0x1a')](_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x1a')]);_0x11c5b3['offset']=qs[_0x4f3d('0x19')](_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x19')]);}_0x11c5b3[_0x4f3d('0x37')]=qs['sort'](_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x38')]);_0x11c5b3[_0x4f3d('0x39')]=qs[_0x4f3d('0x31')](_[_0x4f3d('0x3a')](_0x351f00[_0x4f3d('0x2f')],_0xa27eb9[_0x4f3d('0x31')]),_0x7cb4bf);if(_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x3b')]){_0x11c5b3[_0x4f3d('0x39')]=_[_0x4f3d('0x3c')](_0x11c5b3['where'],{'$or':_[_0x4f3d('0x29')](_0x7cb4bf,function(_0x27d51f){if(_0x27d51f[_0x4f3d('0x2c')]!==_0x4f3d('0x3d')){var _0x4782d4={};_0x4782d4[_0x27d51f[_0x4f3d('0x26')]]={'$like':'%'+_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x3b')]+'%'};return _0x4782d4;}})});}_0x11c5b3=_[_0x4f3d('0x3c')]({},_0x11c5b3,_0x351f00[_0x4f3d('0x3e')]);var _0x40640a={'where':_0x11c5b3[_0x4f3d('0x39')]};return db[_0x4f3d('0x2a')][_0x4f3d('0x18')](_0x40640a)[_0x4f3d('0x21')](function(_0x40a107){_0x14a8f7[_0x4f3d('0x18')]=_0x40a107;if(_0x351f00[_0x4f3d('0x2f')][_0x4f3d('0x3f')]){_0x11c5b3[_0x4f3d('0x40')]=[{'all':!![]}];}return db[_0x4f3d('0x2a')][_0x4f3d('0x41')](_0x11c5b3);})[_0x4f3d('0x21')](function(_0x1c6715){_0x14a8f7['rows']=_0x1c6715;return _0x14a8f7;})[_0x4f3d('0x21')](respondWithFilteredResult(_0x2abfb3,_0x11c5b3))[_0x4f3d('0x42')](handleError(_0x2abfb3,null));};exports[_0x4f3d('0x43')]=function(_0x1056f1,_0x26a94b){var _0x36124d={'raw':![],'where':{'id':_0x1056f1['params']['id']}},_0x560b58={};_0x560b58[_0x4f3d('0x2e')]=_[_0x4f3d('0x30')](db[_0x4f3d('0x2a')]['rawAttributes']);_0x560b58[_0x4f3d('0x2f')]=_[_0x4f3d('0x30')](_0x1056f1['query']);_0x560b58[_0x4f3d('0x31')]=_[_0x4f3d('0x32')](_0x560b58[_0x4f3d('0x2e')],_0x560b58[_0x4f3d('0x2f')]);_0x36124d[_0x4f3d('0x34')]=_[_0x4f3d('0x32')](_0x560b58[_0x4f3d('0x2e')],qs[_0x4f3d('0x33')](_0x1056f1[_0x4f3d('0x2f')][_0x4f3d('0x33')]));_0x36124d['attributes']=_0x36124d[_0x4f3d('0x34')][_0x4f3d('0x44')]?_0x36124d[_0x4f3d('0x34')]:_0x560b58[_0x4f3d('0x2e')];if(_0x1056f1['query'][_0x4f3d('0x3f')]){_0x36124d[_0x4f3d('0x40')]=[{'all':!![]}];}_0x36124d=_['merge']({},_0x36124d,_0x1056f1[_0x4f3d('0x3e')]);return db[_0x4f3d('0x2a')][_0x4f3d('0x45')](_0x36124d)[_0x4f3d('0x21')](handleEntityNotFound(_0x26a94b,null))[_0x4f3d('0x21')](respondWithResult(_0x26a94b,null))[_0x4f3d('0x42')](handleError(_0x26a94b,null));};exports[_0x4f3d('0x46')]=function(_0x2f69a1,_0x4aa605){return db['Schedule']['create'](_0x2f69a1[_0x4f3d('0x47')],{})[_0x4f3d('0x21')](function(_0x1d9b49){var _0x4df6b9=_0x2f69a1[_0x4f3d('0x48')][_0x4f3d('0x49')]({'plain':!![]});if(!_0x4df6b9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4df6b9[_0x4f3d('0x4a')]===_0x4f3d('0x48')){var _0x35341c=_0x1d9b49[_0x4f3d('0x49')]({'plain':!![]});var _0xec0fd0=_0x4f3d('0x23');return db['UserProfileSection']['find']({'where':{'name':_0xec0fd0,'userProfileId':_0x4df6b9['userProfileId']},'raw':!![]})[_0x4f3d('0x21')](function(_0x4e3f8c){if(_0x4e3f8c&&_0x4e3f8c[_0x4f3d('0x4b')]===0x0){return db[_0x4f3d('0x24')][_0x4f3d('0x46')]({'name':_0x35341c[_0x4f3d('0x26')],'resourceId':_0x35341c['id'],'type':_0x4e3f8c['name'],'sectionId':_0x4e3f8c['id']},{})[_0x4f3d('0x21')](function(){return _0x1d9b49;});}else{return _0x1d9b49;}})[_0x4f3d('0x42')](function(_0x3987b0){logger[_0x4f3d('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3987b0);throw _0x3987b0;});}return _0x1d9b49;})[_0x4f3d('0x21')](respondWithResult(_0x4aa605,0xc9))[_0x4f3d('0x42')](handleError(_0x4aa605,null));};exports[_0x4f3d('0x20')]=function(_0x240a99,_0x3cf0f7){if(_0x240a99['body']['id']){delete _0x240a99[_0x4f3d('0x47')]['id'];}return db[_0x4f3d('0x2a')][_0x4f3d('0x45')]({'where':{'id':_0x240a99[_0x4f3d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3cf0f7,null))[_0x4f3d('0x21')](saveUpdates(_0x240a99[_0x4f3d('0x47')],null))[_0x4f3d('0x21')](respondWithResult(_0x3cf0f7,null))[_0x4f3d('0x42')](handleError(_0x3cf0f7,null));};exports[_0x4f3d('0x22')]=function(_0x3b5599,_0xc27325){return db[_0x4f3d('0x2a')][_0x4f3d('0x45')]({'where':{'id':_0x3b5599[_0x4f3d('0x4c')]['id']}})[_0x4f3d('0x21')](handleEntityNotFound(_0xc27325,null))[_0x4f3d('0x21')](removeEntity(_0xc27325,null))['catch'](handleError(_0xc27325,null));};exports[_0x4f3d('0x4d')]=function(_0x4d981e,_0xbb0c64,_0x5a2426){var _0xb40c9e=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x4d981e[_0x4f3d('0x4c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xbb0c64,null))[_0x4f3d('0x21')](function(){_0xb40c9e[_0x4f3d('0x4d')](_0x4d981e[_0x4f3d('0x4c')]['id']);})['then'](respondWithStatusCode(_0xbb0c64,null))['catch'](handleError(_0xbb0c64,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 6d3dc74..0103c52 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 _0x820c=['Schedule','tools_schedules','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x820c,0xb2));var _0xc820=function(_0x271f44,_0x454bc7){_0x271f44=_0x271f44-0x0;var _0x2baf1=_0x820c[_0x271f44];return _0x2baf1;};'use strict';var _=require(_0xc820('0x0'));var util=require('util');var logger=require(_0xc820('0x1'))(_0xc820('0x2'));var moment=require(_0xc820('0x3'));var BPromise=require(_0xc820('0x4'));var rp=require(_0xc820('0x5'));var fs=require('fs');var path=require(_0xc820('0x6'));var rimraf=require(_0xc820('0x7'));var config=require(_0xc820('0x8'));var attributes=require('./schedule.attributes');module['exports']=function(_0xca5d96,_0x3863ba){return _0xca5d96['define'](_0xc820('0x9'),attributes,{'tableName':_0xc820('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd5a=['request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','moment','bluebird'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xfd5a,0x140));var _0xafd5=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xfd5a[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xafd5('0x0'));var util=require(_0xafd5('0x1'));var logger=require(_0xafd5('0x2'))('api');var moment=require(_0xafd5('0x3'));var BPromise=require(_0xafd5('0x4'));var rp=require(_0xafd5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafd5('0x6'));var config=require(_0xafd5('0x7'));var attributes=require(_0xafd5('0x8'));module[_0xafd5('0x9')]=function(_0x1f1dfd,_0x23f8a6){return _0x1f1dfd[_0xafd5('0xa')](_0xafd5('0xb'),attributes,{'tableName':_0xafd5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 13bf0b1..b608750 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 _0x45a7=['request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s','result','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2d72ce,_0x4ddcec){var _0x40e4d5=function(_0x41eb72){while(--_0x41eb72){_0x2d72ce['push'](_0x2d72ce['shift']());}};_0x40e4d5(++_0x4ddcec);}(_0x45a7,0x19b));var _0x745a=function(_0x432286,_0xc7f906){_0x432286=_0x432286-0x0;var _0x475b6e=_0x45a7[_0x432286];return _0x475b6e;};'use strict';var _=require(_0x745a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x745a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x745a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x745a('0x3'))(_0x745a('0x4'));var config=require(_0x745a('0x5'));var jayson=require(_0x745a('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x434958,_0x698b84,_0x1fa63e){return new BPromise(function(_0x2fea8d,_0x39d572){return client[_0x745a('0x7')](_0x434958,_0x1fa63e)[_0x745a('0x8')](function(_0x4dcb26){logger[_0x745a('0x9')]('Schedule,\x20%s,\x20%s',_0x698b84,_0x745a('0xa'));logger[_0x745a('0xb')](_0x745a('0xc'),_0x698b84,_0x745a('0xa'),JSON[_0x745a('0xd')](_0x4dcb26));if(_0x4dcb26[_0x745a('0xe')]){if(_0x4dcb26[_0x745a('0xe')][_0x745a('0xf')]===0x1f4){logger[_0x745a('0xe')]('Schedule,\x20%s,\x20%s',_0x698b84,_0x4dcb26['error'][_0x745a('0x10')]);return _0x39d572(_0x4dcb26[_0x745a('0xe')]['message']);}logger[_0x745a('0xe')](_0x745a('0x11'),_0x698b84,_0x4dcb26[_0x745a('0xe')][_0x745a('0x10')]);return _0x2fea8d(_0x4dcb26[_0x745a('0xe')][_0x745a('0x10')]);}else{logger[_0x745a('0x9')]('Schedule,\x20%s,\x20%s',_0x698b84,_0x745a('0xa'));_0x2fea8d(_0x4dcb26[_0x745a('0x12')][_0x745a('0x10')]);}})['catch'](function(_0x57a838){logger[_0x745a('0xe')](_0x745a('0x11'),_0x698b84,_0x57a838);_0x39d572(_0x57a838);});});} \ No newline at end of file +var _0x338e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x3e6fcf,_0x5857a2){var _0x485b82=function(_0x34aa05){while(--_0x34aa05){_0x3e6fcf['push'](_0x3e6fcf['shift']());}};_0x485b82(++_0x5857a2);}(_0x338e,0x16c));var _0xe338=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x338e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe338('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe338('0x1'));var rs=require(_0xe338('0x2'));var fs=require('fs');var Redis=require(_0xe338('0x3'));var db=require(_0xe338('0x4'))['db'];var utils=require(_0xe338('0x5'));var logger=require(_0xe338('0x6'))(_0xe338('0x7'));var config=require(_0xe338('0x8'));var jayson=require(_0xe338('0x9'));var client=jayson['client'][_0xe338('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44c4cd,_0x37d6fe,_0x19e46b){return new BPromise(function(_0x784358,_0x5815d2){return client[_0xe338('0xb')](_0x44c4cd,_0x19e46b)[_0xe338('0xc')](function(_0x5456ce){logger[_0xe338('0xd')](_0xe338('0xe'),_0x37d6fe,_0xe338('0xf'));logger[_0xe338('0x10')](_0xe338('0x11'),_0x37d6fe,'request\x20sent',JSON[_0xe338('0x12')](_0x5456ce));if(_0x5456ce[_0xe338('0x13')]){if(_0x5456ce[_0xe338('0x13')]['code']===0x1f4){logger['error'](_0xe338('0xe'),_0x37d6fe,_0x5456ce[_0xe338('0x13')][_0xe338('0x14')]);return _0x5815d2(_0x5456ce[_0xe338('0x13')][_0xe338('0x14')]);}logger[_0xe338('0x13')](_0xe338('0xe'),_0x37d6fe,_0x5456ce[_0xe338('0x13')][_0xe338('0x14')]);return _0x784358(_0x5456ce[_0xe338('0x13')]['message']);}else{logger['info'](_0xe338('0xe'),_0x37d6fe,_0xe338('0xf'));_0x784358(_0x5456ce[_0xe338('0x15')][_0xe338('0x14')]);}})[_0xe338('0x16')](function(_0x4b7515){logger[_0xe338('0x13')](_0xe338('0xe'),_0x37d6fe,_0x4b7515);_0x5815d2(_0x4b7515);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 9b5e8cc..bfbb817 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 _0x9832=['index','/describe','isAuthenticated','describe','/:id','show','/:id/download','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x13dd37,_0x1a62d7){var _0x4018ef=function(_0x24f017){while(--_0x24f017){_0x13dd37['push'](_0x13dd37['shift']());}};_0x4018ef(++_0x1a62d7);}(_0x9832,0x66));var _0x2983=function(_0x6fc5f7,_0x5dde8b){_0x6fc5f7=_0x6fc5f7-0x0;var _0x4fe306=_0x9832[_0x6fc5f7];return _0x4fe306;};'use strict';var multer=require(_0x2983('0x0'));var util=require('util');var path=require(_0x2983('0x1'));var timeout=require(_0x2983('0x2'));var express=require(_0x2983('0x3'));var router=express[_0x2983('0x4')]();var auth=require(_0x2983('0x5'));var interaction=require(_0x2983('0x6'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x2983('0x7')]('/',auth['isAuthenticated'](),controller[_0x2983('0x8')]);router[_0x2983('0x7')](_0x2983('0x9'),auth[_0x2983('0xa')](),controller[_0x2983('0xb')]);router[_0x2983('0x7')](_0x2983('0xc'),auth[_0x2983('0xa')](),controller[_0x2983('0xd')]);router[_0x2983('0x7')](_0x2983('0xe'),auth[_0x2983('0xa')](),controller['download']);router[_0x2983('0xf')]('/',auth[_0x2983('0xa')](),controller[_0x2983('0x10')]);router[_0x2983('0x11')](_0x2983('0xc'),auth['isAuthenticated'](),controller[_0x2983('0x12')]);router[_0x2983('0x13')](_0x2983('0xc'),auth[_0x2983('0xa')](),controller[_0x2983('0x14')]);module[_0x2983('0x15')]=router; \ No newline at end of file +var _0x99f7=['../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','util','express','../../components/auth/service'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x99f7,0x1ca));var _0x799f=function(_0x46f4a9,_0x38e63f){_0x46f4a9=_0x46f4a9-0x0;var _0x4cdb88=_0x99f7[_0x46f4a9];return _0x4cdb88;};'use strict';var multer=require(_0x799f('0x0'));var util=require(_0x799f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x799f('0x2'));var router=express['Router']();var auth=require(_0x799f('0x3'));var interaction=require(_0x799f('0x4'));var config=require(_0x799f('0x5'));var controller=require(_0x799f('0x6'));router[_0x799f('0x7')]('/',auth['isAuthenticated'](),controller[_0x799f('0x8')]);router[_0x799f('0x7')](_0x799f('0x9'),auth[_0x799f('0xa')](),controller[_0x799f('0xb')]);router[_0x799f('0x7')](_0x799f('0xc'),auth['isAuthenticated'](),controller[_0x799f('0xd')]);router['get'](_0x799f('0xe'),auth[_0x799f('0xa')](),controller[_0x799f('0xf')]);router[_0x799f('0x10')]('/',auth[_0x799f('0xa')](),controller[_0x799f('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x799f('0x12')]);router[_0x799f('0x13')](_0x799f('0xc'),auth[_0x799f('0xa')](),controller[_0x799f('0x14')]);module[_0x799f('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 3b21ad9..1fac65e 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 _0x5075=['VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','../../config/environment','exports'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x5075,0x73));var _0x5507=function(_0x522e32,_0x440e6d){_0x522e32=_0x522e32-0x0;var _0x216842=_0x5075[_0x522e32];return _0x216842;};'use strict';var Sequelize=require(_0x5507('0x0'));var moment=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var config=require(_0x5507('0x3'));module[_0x5507('0x4')]={'format':{'type':Sequelize[_0x5507('0x5')],'get':function(){return this[_0x5507('0x6')]('value')?path[_0x5507('0x7')](this[_0x5507('0x6')](_0x5507('0x8'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x5507('0x9')],'set':function(_0x773559){var _0x4c2d6d=_0x773559[_0x5507('0xa')](/\\/g,'/');this[_0x5507('0xb')](_0x5507('0x8'),_0x4c2d6d);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xe8c49){this[_0x5507('0xb')](_0x5507('0xc'),moment()[_0x5507('0xd')](_0xe8c49,'ms'));this['setDataValue'](_0x5507('0xe'),moment());this[_0x5507('0xb')]('duration',_0xe8c49);}},'startedAt':{'type':Sequelize[_0x5507('0xf')],'get':function(){return moment(this[_0x5507('0x6')]('startedAt'))[_0x5507('0x10')](_0x5507('0x11'))[_0x5507('0x12')]();}},'closedAt':{'type':Sequelize[_0x5507('0xf')],'get':function(){return moment(this[_0x5507('0x6')](_0x5507('0xe')))['format'](_0x5507('0x11'))[_0x5507('0x12')]();}},'createdAt':{'type':Sequelize[_0x5507('0xf')],'get':function(){return moment(this[_0x5507('0x6')]('createdAt'))[_0x5507('0x10')](_0x5507('0x11'))[_0x5507('0x12')]();}},'updatedAt':{'type':Sequelize[_0x5507('0xf')],'get':function(){return moment(this[_0x5507('0x6')](_0x5507('0x13')))[_0x5507('0x10')](_0x5507('0x11'))[_0x5507('0x12')]();}}}; \ No newline at end of file +var _0x8958=['INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','getDataValue','extname','value','STRING','replace'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x8958,0x93));var _0x8895=function(_0x323626,_0x23a399){_0x323626=_0x323626-0x0;var _0x32d9c7=_0x8958[_0x323626];return _0x32d9c7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8895('0x0'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8895('0x1')]('value')?path[_0x8895('0x2')](this[_0x8895('0x1')](_0x8895('0x3'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8895('0x4')]},'value':{'type':Sequelize[_0x8895('0x4')],'set':function(_0x124e1e){var _0x40cec6=_0x124e1e[_0x8895('0x5')](/\\/g,'/');this['setDataValue'](_0x8895('0x3'),_0x40cec6);}},'rating':{'type':Sequelize[_0x8895('0x6')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8895('0x6')],'set':function(_0x24fe49){this[_0x8895('0x7')](_0x8895('0x8'),moment()[_0x8895('0x9')](_0x24fe49,'ms'));this[_0x8895('0x7')](_0x8895('0xa'),moment());this[_0x8895('0x7')]('duration',_0x24fe49);}},'startedAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this[_0x8895('0x1')](_0x8895('0x8')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8895('0x1')](_0x8895('0xa')))[_0x8895('0xc')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this['getDataValue'](_0x8895('0xf')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}},'updatedAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this['getDataValue'](_0x8895('0x10')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index eb3ebe7..8d874db 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 _0x6108=['bluebird','mustache','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','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','apply','save','update','then','stack','name','index','map','ScreenRecording','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','send','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6108,0xbc));var _0x8610=function(_0x10aa24,_0x1546df){_0x10aa24=_0x10aa24-0x0;var _0xecaf3d=_0x6108[_0x10aa24];return _0xecaf3d;};'use strict';var pdf=require(_0x8610('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8610('0x1'));var zipdir=require(_0x8610('0x2'));var jsonpatch=require(_0x8610('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8610('0x4'));var Mustache=require(_0x8610('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8610('0x6'));var csv=require(_0x8610('0x7'));var ejs=require(_0x8610('0x8'));var fs=require('fs');var _=require(_0x8610('0x9'));var squel=require('squel');var crypto=require(_0x8610('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8610('0xb'));var toCsv=require(_0x8610('0x7'));var querystring=require(_0x8610('0xc'));var Papa=require('papaparse');var Redis=require(_0x8610('0xd'));var authService=require(_0x8610('0xe'));var qs=require(_0x8610('0xf'));var as=require(_0x8610('0x10'));var hardwareService=require(_0x8610('0x11'));var logger=require(_0x8610('0x12'))('api');var utils=require(_0x8610('0x13'));var config=require(_0x8610('0x14'));var db=require(_0x8610('0x15'))['db'];function respondWithStatusCode(_0x4ee6f4,_0xc18be9){_0xc18be9=_0xc18be9||0xcc;return function(_0x4bb57e){if(_0x4bb57e){return _0x4ee6f4[_0x8610('0x16')](_0xc18be9);}return _0x4ee6f4[_0x8610('0x17')](_0xc18be9)[_0x8610('0x18')]();};}function respondWithResult(_0x277942,_0x3f5223){_0x3f5223=_0x3f5223||0xc8;return function(_0x4eacbf){if(_0x4eacbf){return _0x277942['status'](_0x3f5223)[_0x8610('0x19')](_0x4eacbf);}};}function respondWithFilteredResult(_0x593949,_0x214015){return function(_0x5526b5){if(_0x5526b5){var _0x5e1994=_0x5526b5[_0x8610('0x1a')],_0x57e567=_0x214015[_0x8610('0x1b')],_0x3d94c2=_0x214015['offset']+_0x214015['limit'],_0x21c500;if(_0x3d94c2>=_0x5e1994){_0x3d94c2=_0x5e1994;_0x21c500=0xc8;}else{_0x21c500=0xce;}_0x593949[_0x8610('0x17')](_0x21c500);return _0x593949['set']('Content-Range',_0x57e567+'-'+_0x3d94c2+'/'+_0x5e1994)[_0x8610('0x19')](_0x5526b5);}return null;};}function patchUpdates(_0x4c7d56){return function(_0x56bf4f){try{jsonpatch[_0x8610('0x1c')](_0x56bf4f,_0x4c7d56,!![]);}catch(_0x153daa){return BPromise['reject'](_0x153daa);}return _0x56bf4f[_0x8610('0x1d')]();};}function saveUpdates(_0x327b56,_0x17fe4a){return function(_0x39ae24){if(_0x39ae24){return _0x39ae24[_0x8610('0x1e')](_0x327b56)[_0x8610('0x1f')](function(_0x2e3e69){return _0x2e3e69;});}return null;};}function removeEntity(_0x1ab679,_0x4184f0){return function(_0x19e38a){if(_0x19e38a){return _0x19e38a['destroy']()[_0x8610('0x1f')](function(){_0x1ab679['status'](0xcc)[_0x8610('0x18')]();});}};}function handleEntityNotFound(_0x2b8e7f,_0x8866a){return function(_0x5103ad){if(!_0x5103ad){_0x2b8e7f[_0x8610('0x16')](0x194);}return _0x5103ad;};}function handleError(_0x53b646,_0x585269){_0x585269=_0x585269||0x1f4;return function(_0x4b3e6a){logger['error'](_0x4b3e6a[_0x8610('0x20')]);if(_0x4b3e6a[_0x8610('0x21')]){delete _0x4b3e6a['name'];}_0x53b646[_0x8610('0x17')](_0x585269)['send'](_0x4b3e6a);};}exports[_0x8610('0x22')]=function(_0x2503bc,_0x49bef2){var _0x3a4a74={},_0x345369={},_0x3e6d97={'count':0x0,'rows':[]};var _0x260fdc=_[_0x8610('0x23')](db[_0x8610('0x24')]['rawAttributes'],function(_0x42a104){return{'name':_0x42a104[_0x8610('0x25')],'type':_0x42a104[_0x8610('0x26')]['key']};});_0x345369[_0x8610('0x27')]=_['differenceBy'](_[_0x8610('0x23')](_0x260fdc,'name'),['format']);_0x345369[_0x8610('0x28')]=_[_0x8610('0x29')](_0x2503bc[_0x8610('0x28')]);_0x345369['filters']=_['intersection'](_0x345369[_0x8610('0x27')],_0x345369[_0x8610('0x28')]);_0x3a4a74[_0x8610('0x2a')]=_[_0x8610('0x2b')](_0x345369[_0x8610('0x27')],qs[_0x8610('0x2c')](_0x2503bc['query'][_0x8610('0x2c')]));_0x3a4a74[_0x8610('0x2a')]=_0x3a4a74[_0x8610('0x2a')][_0x8610('0x2d')]?_0x3a4a74[_0x8610('0x2a')]:_0x345369[_0x8610('0x27')];if(!_0x2503bc[_0x8610('0x28')][_0x8610('0x2e')]('nolimit')){_0x3a4a74['limit']=qs[_0x8610('0x2f')](_0x2503bc[_0x8610('0x28')][_0x8610('0x2f')]);_0x3a4a74[_0x8610('0x1b')]=qs[_0x8610('0x1b')](_0x2503bc[_0x8610('0x28')][_0x8610('0x1b')]);}_0x3a4a74[_0x8610('0x30')]=qs[_0x8610('0x31')](_0x2503bc[_0x8610('0x28')][_0x8610('0x31')]);_0x3a4a74['where']=qs[_0x8610('0x32')](_[_0x8610('0x33')](_0x2503bc[_0x8610('0x28')],_0x345369['filters']),_0x260fdc);if(_0x2503bc['query'][_0x8610('0x34')]){_0x3a4a74[_0x8610('0x35')]=_[_0x8610('0x36')](_0x3a4a74[_0x8610('0x35')],{'$or':_[_0x8610('0x23')](_0x260fdc,function(_0x593b43){if(_0x593b43['type']!==_0x8610('0x37')){var _0x3c84f5={};_0x3c84f5[_0x593b43[_0x8610('0x21')]]={'$like':'%'+_0x2503bc['query']['filter']+'%'};return _0x3c84f5;}})});}_0x3a4a74=_[_0x8610('0x36')]({},_0x3a4a74,_0x2503bc[_0x8610('0x38')]);var _0x3e6a50={'where':_0x3a4a74[_0x8610('0x35')]};return db[_0x8610('0x24')][_0x8610('0x1a')](_0x3e6a50)[_0x8610('0x1f')](function(_0x229c50){_0x3e6d97[_0x8610('0x1a')]=_0x229c50;if(_0x2503bc[_0x8610('0x28')][_0x8610('0x39')]){_0x3a4a74['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x8610('0x3a')](_0x3a4a74);})[_0x8610('0x1f')](function(_0x415d55){_0x3e6d97['rows']=_0x415d55;return _0x3e6d97;})['then'](respondWithFilteredResult(_0x49bef2,_0x3a4a74))[_0x8610('0x3b')](handleError(_0x49bef2,null));};exports[_0x8610('0x3c')]=function(_0x52f640,_0xb037ab){var _0x30fc7e={'raw':![],'where':{'id':_0x52f640[_0x8610('0x3d')]['id']}},_0x5ba462={};_0x5ba462['model']=_['keys'](db[_0x8610('0x24')][_0x8610('0x3e')]);_0x5ba462[_0x8610('0x28')]=_[_0x8610('0x29')](_0x52f640[_0x8610('0x28')]);_0x5ba462[_0x8610('0x32')]=_[_0x8610('0x2b')](_0x5ba462[_0x8610('0x27')],_0x5ba462['query']);_0x30fc7e[_0x8610('0x2a')]=_[_0x8610('0x2b')](_0x5ba462[_0x8610('0x27')],qs[_0x8610('0x2c')](_0x52f640['query'][_0x8610('0x2c')]));_0x30fc7e['attributes']=_0x30fc7e[_0x8610('0x2a')][_0x8610('0x2d')]?_0x30fc7e[_0x8610('0x2a')]:_0x5ba462[_0x8610('0x27')];if(_0x52f640[_0x8610('0x28')][_0x8610('0x39')]){_0x30fc7e[_0x8610('0x3f')]=[{'all':!![]}];}_0x30fc7e=_[_0x8610('0x36')]({},_0x30fc7e,_0x52f640[_0x8610('0x38')]);return db[_0x8610('0x24')][_0x8610('0x40')](_0x30fc7e)['then'](handleEntityNotFound(_0xb037ab,null))[_0x8610('0x1f')](respondWithResult(_0xb037ab,null))[_0x8610('0x3b')](handleError(_0xb037ab,null));};exports[_0x8610('0x41')]=function(_0x5c13b9,_0x3380ef){return db['ScreenRecording'][_0x8610('0x41')](_0x5c13b9[_0x8610('0x42')],{})[_0x8610('0x1f')](respondWithResult(_0x3380ef,0xc9))[_0x8610('0x3b')](handleError(_0x3380ef,null));};exports[_0x8610('0x1e')]=function(_0x106ef4,_0x57ea5b){if(_0x106ef4['body']['id']){delete _0x106ef4[_0x8610('0x42')]['id'];}delete _0x106ef4['body']['duration'];delete _0x106ef4['body'][_0x8610('0x43')];delete _0x106ef4[_0x8610('0x42')][_0x8610('0x44')];delete _0x106ef4[_0x8610('0x42')]['value'];return db[_0x8610('0x24')]['find']({'where':{'id':_0x106ef4['params']['id']}})[_0x8610('0x1f')](handleEntityNotFound(_0x57ea5b,null))[_0x8610('0x1f')](saveUpdates(_0x106ef4[_0x8610('0x42')],null))[_0x8610('0x1f')](respondWithResult(_0x57ea5b,null))['catch'](handleError(_0x57ea5b,null));};exports['describe']=function(_0x4edb18,_0x43435b){return db[_0x8610('0x24')][_0x8610('0x45')]()[_0x8610('0x1f')](respondWithResult(_0x43435b,null))[_0x8610('0x3b')](handleError(_0x43435b,null));};exports['download']=function(_0x2264ab,_0x2118db,_0x5074d3){var _0x22ddd3=require(_0x8610('0x46'));var _0x4f3820=![];var _0x258025={};if(_0x2264ab[_0x8610('0x28')][_0x8610('0x26')]&&_0x2264ab[_0x8610('0x28')]['type']===_0x8610('0x47')){_0x258025['uniqueid']=_0x2264ab[_0x8610('0x3d')]['id'];}else{_0x258025['id']=_0x2264ab['params']['id'];}return db['ScreenRecording']['find']({'where':_0x258025,'attributes':['id',_0x8610('0x48')],'raw':!![]})[_0x8610('0x1f')](handleEntityNotFound(_0x2118db,null))[_0x8610('0x1f')](function(_0x3317f3){if(_0x3317f3){var _0x4f7ad0=path[_0x8610('0x49')](config[_0x8610('0x4a')],_0x8610('0x4b'),_0x3317f3[_0x8610('0x48')]);var _0x32ebb9=util[_0x8610('0x4c')](_0x8610('0x4d'),_0x4f7ad0);if(fs['existsSync'](_0x32ebb9)){_0x4f3820=!![];return _0x22ddd3['decryptFile'](_0x32ebb9,_0x4f7ad0,config['secrets']['recording'])['then'](function(){return _0x3317f3;});}return _0x3317f3;}})[_0x8610('0x1f')](function(_0x3942ea){if(_0x3942ea){var _0x16f565=path[_0x8610('0x49')](config[_0x8610('0x4a')],_0x8610('0x4b'),_0x3942ea[_0x8610('0x48')]);if(!fs[_0x8610('0x4e')](_0x16f565)){throw new db[(_0x8610('0x4f'))]['ValidationError'](_0x8610('0x50'));}if(_0x3942ea[_0x8610('0x51')]){return _0x2118db['download'](_0x16f565,_0x3942ea[_0x8610('0x51')]+path[_0x8610('0x52')](_0x16f565),function(){if(_0x4f3820){fs[_0x8610('0x53')](_0x16f565);}});}else{return _0x2118db[_0x8610('0x54')](_0x16f565,function(_0x2e1630){if(_0x4f3820){fs[_0x8610('0x53')](_0x16f565);}});}}})[_0x8610('0x3b')](function(_0x52dbd7){if(_0x52dbd7[_0x8610('0x55')]===_0x8610('0x50')){_0x2118db['status'](0x194)[_0x8610('0x56')](_0x8610('0x57'));}else{return handleError(_0x2118db,null);}});};exports[_0x8610('0x58')]=function(_0x3f1e74,_0x580d53){return db[_0x8610('0x24')][_0x8610('0x40')]({'where':{'id':_0x3f1e74[_0x8610('0x3d')]['id']}})['then'](function(_0x5d1221){if(!_0x5d1221)throw new ReferenceError(_0x8610('0x59'));return _0x5d1221;})[_0x8610('0x1f')](function(_0x4b02e7){var _0x12834f=path['join'](config['root'],_0x8610('0x4b'),_0x4b02e7[_0x8610('0x48')]);logger[_0x8610('0x5a')](_0x8610('0x5b'),_0x12834f);if(!_[_0x8610('0x5c')](_0x4b02e7[_0x8610('0x48')])&&fs[_0x8610('0x4e')](_0x12834f)){logger[_0x8610('0x5a')](_0x8610('0x5d')+_0x12834f+_0x8610('0x5e'));fs[_0x8610('0x5f')](_0x12834f);}_0x12834f=_0x12834f+'.cypher';if(!_[_0x8610('0x5c')](_0x4b02e7['value'])&&fs[_0x8610('0x4e')](_0x12834f)){logger['info'](_0x8610('0x5d')+_0x12834f+_0x8610('0x5e'));fs[_0x8610('0x5f')](_0x12834f);}return _0x4b02e7;})[_0x8610('0x1f')](function(_0x3aa3e8){if(!_0x3aa3e8)throw new InternalError();return _0x3aa3e8['destroy']();})[_0x8610('0x1f')](function(){_0x580d53[_0x8610('0x17')](0xcc)[_0x8610('0x18')]();})['catch'](handleError(_0x580d53,null));}; \ No newline at end of file +var _0xd484=['rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','params','length','find','create','body','duration','closedAt','describe','../../components/encryptor','uniqueid','value','root','server/files/screen_recordings','%s.cypher','secrets','recording','join','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ScreenRecording'];(function(_0x216f7d,_0x496249){var _0xc49d7f=function(_0x27be52){while(--_0x27be52){_0x216f7d['push'](_0x216f7d['shift']());}};_0xc49d7f(++_0x496249);}(_0xd484,0xff));var _0x4d48=function(_0xdb7519,_0x5b4c5b){_0xdb7519=_0xdb7519-0x0;var _0xb5ee9=_0xd484[_0xdb7519];return _0xb5ee9;};'use strict';var pdf=require(_0x4d48('0x0'));var emlformat=require(_0x4d48('0x1'));var rimraf=require(_0x4d48('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d48('0x3'));var rp=require('request-promise');var moment=require(_0x4d48('0x4'));var BPromise=require(_0x4d48('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d48('0x6'));var sox=require(_0x4d48('0x7'));var csv=require(_0x4d48('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4d48('0x9'));var squel=require(_0x4d48('0xa'));var crypto=require(_0x4d48('0xb'));var jsforce=require(_0x4d48('0xc'));var deskjs=require(_0x4d48('0xd'));var toCsv=require(_0x4d48('0x8'));var querystring=require('querystring');var Papa=require(_0x4d48('0xe'));var Redis=require('ioredis');var authService=require(_0x4d48('0xf'));var qs=require(_0x4d48('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d48('0x11'));var logger=require('../../config/logger')(_0x4d48('0x12'));var utils=require(_0x4d48('0x13'));var config=require(_0x4d48('0x14'));var db=require(_0x4d48('0x15'))['db'];function respondWithStatusCode(_0x35ecb6,_0xd3799b){_0xd3799b=_0xd3799b||0xcc;return function(_0x108c0c){if(_0x108c0c){return _0x35ecb6[_0x4d48('0x16')](_0xd3799b);}return _0x35ecb6[_0x4d48('0x17')](_0xd3799b)[_0x4d48('0x18')]();};}function respondWithResult(_0x55aa8e,_0x12eab4){_0x12eab4=_0x12eab4||0xc8;return function(_0x4a4cec){if(_0x4a4cec){return _0x55aa8e[_0x4d48('0x17')](_0x12eab4)[_0x4d48('0x19')](_0x4a4cec);}};}function respondWithFilteredResult(_0x20edc7,_0x5bdb48){return function(_0x1be7f9){if(_0x1be7f9){var _0x115267=_0x1be7f9[_0x4d48('0x1a')],_0x3249c5=_0x5bdb48[_0x4d48('0x1b')],_0x13db0d=_0x5bdb48[_0x4d48('0x1b')]+_0x5bdb48[_0x4d48('0x1c')],_0x5e5734;if(_0x13db0d>=_0x115267){_0x13db0d=_0x115267;_0x5e5734=0xc8;}else{_0x5e5734=0xce;}_0x20edc7[_0x4d48('0x17')](_0x5e5734);return _0x20edc7[_0x4d48('0x1d')](_0x4d48('0x1e'),_0x3249c5+'-'+_0x13db0d+'/'+_0x115267)[_0x4d48('0x19')](_0x1be7f9);}return null;};}function patchUpdates(_0xab60ad){return function(_0x3a0e9d){try{jsonpatch[_0x4d48('0x1f')](_0x3a0e9d,_0xab60ad,!![]);}catch(_0xd915c7){return BPromise[_0x4d48('0x20')](_0xd915c7);}return _0x3a0e9d[_0x4d48('0x21')]();};}function saveUpdates(_0xd7785d,_0x8f3636){return function(_0x5ec013){if(_0x5ec013){return _0x5ec013['update'](_0xd7785d)[_0x4d48('0x22')](function(_0x1ef05){return _0x1ef05;});}return null;};}function removeEntity(_0x14074d,_0x5e0ce1){return function(_0x1a7467){if(_0x1a7467){return _0x1a7467[_0x4d48('0x23')]()[_0x4d48('0x22')](function(){_0x14074d[_0x4d48('0x17')](0xcc)[_0x4d48('0x18')]();});}};}function handleEntityNotFound(_0x4657f,_0x1e375a){return function(_0x58c27d){if(!_0x58c27d){_0x4657f[_0x4d48('0x16')](0x194);}return _0x58c27d;};}function handleError(_0x1121e4,_0x2b3df8){_0x2b3df8=_0x2b3df8||0x1f4;return function(_0x308958){logger[_0x4d48('0x24')](_0x308958['stack']);if(_0x308958[_0x4d48('0x25')]){delete _0x308958[_0x4d48('0x25')];}_0x1121e4[_0x4d48('0x17')](_0x2b3df8)[_0x4d48('0x26')](_0x308958);};}exports[_0x4d48('0x27')]=function(_0x469422,_0x13c3a5){var _0x56b62d={},_0x393530={},_0x1bada6={'count':0x0,'rows':[]};var _0x524146=_[_0x4d48('0x28')](db[_0x4d48('0x29')][_0x4d48('0x2a')],function(_0x5c852b){return{'name':_0x5c852b[_0x4d48('0x2b')],'type':_0x5c852b[_0x4d48('0x2c')][_0x4d48('0x2d')]};});_0x393530[_0x4d48('0x2e')]=_[_0x4d48('0x2f')](_['map'](_0x524146,'name'),[_0x4d48('0x30')]);_0x393530[_0x4d48('0x31')]=_[_0x4d48('0x32')](_0x469422[_0x4d48('0x31')]);_0x393530[_0x4d48('0x33')]=_[_0x4d48('0x34')](_0x393530[_0x4d48('0x2e')],_0x393530[_0x4d48('0x31')]);_0x56b62d[_0x4d48('0x35')]=_[_0x4d48('0x34')](_0x393530['model'],qs[_0x4d48('0x36')](_0x469422[_0x4d48('0x31')][_0x4d48('0x36')]));_0x56b62d['attributes']=_0x56b62d[_0x4d48('0x35')]['length']?_0x56b62d[_0x4d48('0x35')]:_0x393530['model'];if(!_0x469422[_0x4d48('0x31')]['hasOwnProperty']('nolimit')){_0x56b62d[_0x4d48('0x1c')]=qs['limit'](_0x469422[_0x4d48('0x31')]['limit']);_0x56b62d[_0x4d48('0x1b')]=qs[_0x4d48('0x1b')](_0x469422[_0x4d48('0x31')][_0x4d48('0x1b')]);}_0x56b62d[_0x4d48('0x37')]=qs['sort'](_0x469422[_0x4d48('0x31')][_0x4d48('0x38')]);_0x56b62d[_0x4d48('0x39')]=qs[_0x4d48('0x33')](_[_0x4d48('0x3a')](_0x469422['query'],_0x393530['filters']),_0x524146);if(_0x469422[_0x4d48('0x31')][_0x4d48('0x3b')]){_0x56b62d[_0x4d48('0x39')]=_[_0x4d48('0x3c')](_0x56b62d[_0x4d48('0x39')],{'$or':_['map'](_0x524146,function(_0x3b798f){if(_0x3b798f['type']!==_0x4d48('0x3d')){var _0x1d8e17={};_0x1d8e17[_0x3b798f[_0x4d48('0x25')]]={'$like':'%'+_0x469422[_0x4d48('0x31')][_0x4d48('0x3b')]+'%'};return _0x1d8e17;}})});}_0x56b62d=_[_0x4d48('0x3c')]({},_0x56b62d,_0x469422['options']);var _0x47dacc={'where':_0x56b62d['where']};return db[_0x4d48('0x29')][_0x4d48('0x1a')](_0x47dacc)[_0x4d48('0x22')](function(_0x4a8f55){_0x1bada6['count']=_0x4a8f55;if(_0x469422[_0x4d48('0x31')][_0x4d48('0x3e')]){_0x56b62d[_0x4d48('0x3f')]=[{'all':!![]}];}return db[_0x4d48('0x29')]['findAll'](_0x56b62d);})[_0x4d48('0x22')](function(_0x45d1e3){_0x1bada6['rows']=_0x45d1e3;return _0x1bada6;})[_0x4d48('0x22')](respondWithFilteredResult(_0x13c3a5,_0x56b62d))[_0x4d48('0x40')](handleError(_0x13c3a5,null));};exports['show']=function(_0x86fad9,_0x57846a){var _0x813988={'raw':![],'where':{'id':_0x86fad9[_0x4d48('0x41')]['id']}},_0x28f33a={};_0x28f33a[_0x4d48('0x2e')]=_[_0x4d48('0x32')](db[_0x4d48('0x29')][_0x4d48('0x2a')]);_0x28f33a['query']=_[_0x4d48('0x32')](_0x86fad9[_0x4d48('0x31')]);_0x28f33a[_0x4d48('0x33')]=_[_0x4d48('0x34')](_0x28f33a[_0x4d48('0x2e')],_0x28f33a[_0x4d48('0x31')]);_0x813988[_0x4d48('0x35')]=_['intersection'](_0x28f33a[_0x4d48('0x2e')],qs[_0x4d48('0x36')](_0x86fad9['query']['fields']));_0x813988['attributes']=_0x813988['attributes'][_0x4d48('0x42')]?_0x813988['attributes']:_0x28f33a[_0x4d48('0x2e')];if(_0x86fad9[_0x4d48('0x31')][_0x4d48('0x3e')]){_0x813988[_0x4d48('0x3f')]=[{'all':!![]}];}_0x813988=_[_0x4d48('0x3c')]({},_0x813988,_0x86fad9['options']);return db[_0x4d48('0x29')][_0x4d48('0x43')](_0x813988)['then'](handleEntityNotFound(_0x57846a,null))[_0x4d48('0x22')](respondWithResult(_0x57846a,null))[_0x4d48('0x40')](handleError(_0x57846a,null));};exports[_0x4d48('0x44')]=function(_0x5d28d9,_0x3dd055){return db[_0x4d48('0x29')]['create'](_0x5d28d9[_0x4d48('0x45')],{})[_0x4d48('0x22')](respondWithResult(_0x3dd055,0xc9))[_0x4d48('0x40')](handleError(_0x3dd055,null));};exports['update']=function(_0x1904a8,_0xb319a7){if(_0x1904a8['body']['id']){delete _0x1904a8[_0x4d48('0x45')]['id'];}delete _0x1904a8[_0x4d48('0x45')][_0x4d48('0x46')];delete _0x1904a8[_0x4d48('0x45')]['createdAt'];delete _0x1904a8['body'][_0x4d48('0x47')];delete _0x1904a8[_0x4d48('0x45')]['value'];return db['ScreenRecording']['find']({'where':{'id':_0x1904a8[_0x4d48('0x41')]['id']}})[_0x4d48('0x22')](handleEntityNotFound(_0xb319a7,null))[_0x4d48('0x22')](saveUpdates(_0x1904a8[_0x4d48('0x45')],null))[_0x4d48('0x22')](respondWithResult(_0xb319a7,null))['catch'](handleError(_0xb319a7,null));};exports[_0x4d48('0x48')]=function(_0x4c45a4,_0xa90b6f){return db['ScreenRecording'][_0x4d48('0x48')]()['then'](respondWithResult(_0xa90b6f,null))[_0x4d48('0x40')](handleError(_0xa90b6f,null));};exports['download']=function(_0xece93b,_0x31cb97,_0x322112){var _0x17770a=require(_0x4d48('0x49'));var _0x3adaf6=![];var _0x301a56={};if(_0xece93b[_0x4d48('0x31')][_0x4d48('0x2c')]&&_0xece93b[_0x4d48('0x31')][_0x4d48('0x2c')]===_0x4d48('0x4a')){_0x301a56[_0x4d48('0x4a')]=_0xece93b[_0x4d48('0x41')]['id'];}else{_0x301a56['id']=_0xece93b[_0x4d48('0x41')]['id'];}return db[_0x4d48('0x29')][_0x4d48('0x43')]({'where':_0x301a56,'attributes':['id',_0x4d48('0x4b')],'raw':!![]})[_0x4d48('0x22')](handleEntityNotFound(_0x31cb97,null))[_0x4d48('0x22')](function(_0x554825){if(_0x554825){var _0x5157df=path['join'](config[_0x4d48('0x4c')],_0x4d48('0x4d'),_0x554825[_0x4d48('0x4b')]);var _0x3cf0ab=util[_0x4d48('0x30')](_0x4d48('0x4e'),_0x5157df);if(fs['existsSync'](_0x3cf0ab)){_0x3adaf6=!![];return _0x17770a['decryptFile'](_0x3cf0ab,_0x5157df,config[_0x4d48('0x4f')][_0x4d48('0x50')])['then'](function(){return _0x554825;});}return _0x554825;}})['then'](function(_0x1d5ff2){if(_0x1d5ff2){var _0x5e9a95=path[_0x4d48('0x51')](config['root'],'server/files/screen_recordings',_0x1d5ff2[_0x4d48('0x4b')]);if(!fs['existsSync'](_0x5e9a95)){throw new db['Sequelize'][(_0x4d48('0x52'))]('ScreenRecording\x20not\x20found');}if(_0x1d5ff2[_0x4d48('0x53')]){return _0x31cb97[_0x4d48('0x54')](_0x5e9a95,_0x1d5ff2['filename']+path[_0x4d48('0x55')](_0x5e9a95),function(){if(_0x3adaf6){fs['unlink'](_0x5e9a95);}});}else{return _0x31cb97[_0x4d48('0x54')](_0x5e9a95,function(_0x104569){if(_0x3adaf6){fs[_0x4d48('0x56')](_0x5e9a95);}});}}})[_0x4d48('0x40')](function(_0x2cde87){if(_0x2cde87[_0x4d48('0x57')]===_0x4d48('0x58')){_0x31cb97[_0x4d48('0x17')](0x194)[_0x4d48('0x26')](_0x4d48('0x59'));}else{return handleError(_0x31cb97,null);}});};exports[_0x4d48('0x23')]=function(_0x434c33,_0x1690f4){return db['ScreenRecording'][_0x4d48('0x43')]({'where':{'id':_0x434c33[_0x4d48('0x41')]['id']}})[_0x4d48('0x22')](function(_0x98824){if(!_0x98824)throw new ReferenceError(_0x4d48('0x5a'));return _0x98824;})[_0x4d48('0x22')](function(_0x10abbc){var _0x323ee4=path['join'](config['root'],'server/files/screen_recordings',_0x10abbc[_0x4d48('0x4b')]);logger[_0x4d48('0x5b')](_0x4d48('0x5c'),_0x323ee4);if(!_[_0x4d48('0x5d')](_0x10abbc['value'])&&fs[_0x4d48('0x5e')](_0x323ee4)){logger[_0x4d48('0x5b')](_0x4d48('0x5f')+_0x323ee4+_0x4d48('0x60'));fs[_0x4d48('0x61')](_0x323ee4);}_0x323ee4=_0x323ee4+_0x4d48('0x62');if(!_[_0x4d48('0x5d')](_0x10abbc['value'])&&fs[_0x4d48('0x5e')](_0x323ee4)){logger[_0x4d48('0x5b')](_0x4d48('0x5f')+_0x323ee4+_0x4d48('0x60'));fs['unlinkSync'](_0x323ee4);}return _0x10abbc;})[_0x4d48('0x22')](function(_0x5f2226){if(!_0x5f2226)throw new InternalError();return _0x5f2226['destroy']();})[_0x4d48('0x22')](function(){_0x1690f4[_0x4d48('0x17')](0xcc)[_0x4d48('0x18')]();})[_0x4d48('0x40')](handleError(_0x1690f4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 62c36b3..34c660b 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 _0x98de=['request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','moment'];(function(_0xd46033,_0xa8f11f){var _0x2c64d9=function(_0x54475c){while(--_0x54475c){_0xd46033['push'](_0xd46033['shift']());}};_0x2c64d9(++_0xa8f11f);}(_0x98de,0x114));var _0xe98d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x98de[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe98d('0x0'));var util=require(_0xe98d('0x1'));var logger=require(_0xe98d('0x2'))('api');var moment=require(_0xe98d('0x3'));var BPromise=require('bluebird');var rp=require(_0xe98d('0x4'));var fs=require('fs');var path=require(_0xe98d('0x5'));var rimraf=require(_0xe98d('0x6'));var config=require(_0xe98d('0x7'));var attributes=require(_0xe98d('0x8'));module[_0xe98d('0x9')]=function(_0x172896,_0x480432){return _0x172896[_0xe98d('0xa')](_0xe98d('0xb'),attributes,{'tableName':_0xe98d('0xc'),'paranoid':![],'indexes':[{'name':_0xe98d('0xd'),'fields':[_0xe98d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x438b=['ScreenRecording','screen_recordings','interactionid','util','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x2106f8,_0x2c93c2){var _0x583655=function(_0x3a43be){while(--_0x3a43be){_0x2106f8['push'](_0x2106f8['shift']());}};_0x583655(++_0x2c93c2);}(_0x438b,0x67));var _0xb438=function(_0x4a60da,_0x30f27c){_0x4a60da=_0x4a60da-0x0;var _0x33b9f8=_0x438b[_0x4a60da];return _0x33b9f8;};'use strict';var _=require('lodash');var util=require(_0xb438('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb438('0x1'));var rp=require(_0xb438('0x2'));var fs=require('fs');var path=require(_0xb438('0x3'));var rimraf=require('rimraf');var config=require(_0xb438('0x4'));var attributes=require('./screenRecording.attributes');module[_0xb438('0x5')]=function(_0x401248,_0x69489d){return _0x401248[_0xb438('0x6')](_0xb438('0x7'),attributes,{'tableName':_0xb438('0x8'),'paranoid':![],'indexes':[{'name':_0xb438('0x9'),'fields':[_0xb438('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 92c1116..ead5d12 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(_0x59ba1c,_0xd79bcd){var _0x1051bc=function(_0x4d8282){while(--_0x4d8282){_0x59ba1c['push'](_0x59ba1c['shift']());}};_0x1051bc(++_0xd79bcd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x213a21,_0x33374a){var _0x2e912a=function(_0xeef62c){while(--_0xeef62c){_0x213a21['push'](_0x213a21['shift']());}};_0x2e912a(++_0x33374a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 784d90c..290acf6 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 _0x9bd9=['/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','server/files/images/logos/','%s%s','logo','extname','originalname','post','single','file','addLogo','diskStorage','root','format','logologin','addLogoLogin','preferred','addPreferred','favicon','addFavicon','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/:id','show','/:id/logo'];(function(_0x52e2d,_0x401cb0){var _0x385d51=function(_0x22045a){while(--_0x22045a){_0x52e2d['push'](_0x52e2d['shift']());}};_0x385d51(++_0x401cb0);}(_0x9bd9,0x164));var _0x99bd=function(_0xfcdda0,_0x32479b){_0xfcdda0=_0xfcdda0-0x0;var _0x17ebe3=_0x9bd9[_0xfcdda0];return _0x17ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x99bd('0x0'));var express=require(_0x99bd('0x1'));var router=express[_0x99bd('0x2')]();var auth=require(_0x99bd('0x3'));var interaction=require(_0x99bd('0x4'));var config=require(_0x99bd('0x5'));var controller=require(_0x99bd('0x6'));router['get']('/',auth[_0x99bd('0x7')](),controller[_0x99bd('0x8')]);router[_0x99bd('0x9')](_0x99bd('0xa'),controller[_0x99bd('0xb')]);router['get'](_0x99bd('0xc'),controller['getLogo']);router[_0x99bd('0x9')](_0x99bd('0xd'),controller[_0x99bd('0xe')]);router['get'](_0x99bd('0xf'),controller[_0x99bd('0x10')]);router[_0x99bd('0x9')](_0x99bd('0x11'),controller[_0x99bd('0x12')]);router[_0x99bd('0x9')](_0x99bd('0x13'),controller[_0x99bd('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b83af,_0x1a95f7,_0x2ca592){_0x2ca592(null,path[_0x99bd('0x15')](config['root'],_0x99bd('0x16')));},'filename':function(_0x5685a0,_0x8e2f97,_0x90b614){_0x90b614(null,util['format'](_0x99bd('0x17'),_0x99bd('0x18'),path[_0x99bd('0x19')](_0x8e2f97[_0x99bd('0x1a')])));}})});router[_0x99bd('0x1b')]('/:id/logo',upload[_0x99bd('0x1c')](_0x99bd('0x1d')),controller[_0x99bd('0x1e')]);var upload=multer({'storage':multer[_0x99bd('0x1f')]({'destination':function(_0x9fa2e9,_0x2e9aee,_0x507f6a){_0x507f6a(null,path['join'](config[_0x99bd('0x20')],_0x99bd('0x16')));},'filename':function(_0x1a2236,_0x5f016a,_0x5c706b){_0x5c706b(null,util[_0x99bd('0x21')](_0x99bd('0x17'),_0x99bd('0x22'),path[_0x99bd('0x19')](_0x5f016a[_0x99bd('0x1a')])));}})});router[_0x99bd('0x1b')](_0x99bd('0xd'),upload['single']('file'),controller[_0x99bd('0x23')]);var upload=multer({'storage':multer[_0x99bd('0x1f')]({'destination':function(_0x1b08d2,_0x4978c8,_0x2ce9fb){_0x2ce9fb(null,path['join'](config['root'],_0x99bd('0x16')));},'filename':function(_0x11d070,_0x5d508d,_0x59efcb){_0x59efcb(null,util[_0x99bd('0x21')](_0x99bd('0x17'),_0x99bd('0x24'),path[_0x99bd('0x19')](_0x5d508d[_0x99bd('0x1a')])));}})});router['post'](_0x99bd('0x11'),upload[_0x99bd('0x1c')](_0x99bd('0x1d')),controller[_0x99bd('0x25')]);var upload=multer({'storage':multer[_0x99bd('0x1f')]({'destination':function(_0x40bea7,_0x4d2ac6,_0x1c41f2){_0x1c41f2(null,path[_0x99bd('0x15')](config[_0x99bd('0x20')],_0x99bd('0x16')));},'filename':function(_0x32addd,_0xdcea0f,_0x30faef){_0x30faef(null,util[_0x99bd('0x21')](_0x99bd('0x17'),_0x99bd('0x26'),path[_0x99bd('0x19')](_0xdcea0f['originalname'])));}})});router[_0x99bd('0x1b')](_0x99bd('0x13'),upload[_0x99bd('0x1c')](_0x99bd('0x1d')),controller[_0x99bd('0x27')]);router['put']('/:id',auth[_0x99bd('0x7')](),controller['update']);module[_0x99bd('0x28')]=router; \ No newline at end of file +var _0x3350=['format','%s%s','logo','extname','post','single','addLogo','diskStorage','logologin','originalname','file','addLogoLogin','preferred','addPreferred','favicon','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','join','root','server/files/images/logos/'];(function(_0x1e05fb,_0x4b5db9){var _0x3abdde=function(_0x4371cf){while(--_0x4371cf){_0x1e05fb['push'](_0x1e05fb['shift']());}};_0x3abdde(++_0x4b5db9);}(_0x3350,0x83));var _0x0335=function(_0xc85033,_0x4e7f90){_0xc85033=_0xc85033-0x0;var _0xb76a4f=_0x3350[_0xc85033];return _0xb76a4f;};'use strict';var multer=require(_0x0335('0x0'));var util=require(_0x0335('0x1'));var path=require(_0x0335('0x2'));var timeout=require(_0x0335('0x3'));var express=require(_0x0335('0x4'));var router=express[_0x0335('0x5')]();var auth=require(_0x0335('0x6'));var interaction=require(_0x0335('0x7'));var config=require(_0x0335('0x8'));var controller=require('./setting.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0335('0x9')]);router[_0x0335('0xa')]('/:id',controller[_0x0335('0xb')]);router['get'](_0x0335('0xc'),controller['getLogo']);router[_0x0335('0xa')](_0x0335('0xd'),controller[_0x0335('0xe')]);router[_0x0335('0xa')](_0x0335('0xf'),controller['gdpr']);router['get'](_0x0335('0x10'),controller['getPreferred']);router[_0x0335('0xa')](_0x0335('0x11'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x24d71a,_0x2eb7ce,_0x2d7799){_0x2d7799(null,path[_0x0335('0x12')](config[_0x0335('0x13')],_0x0335('0x14')));},'filename':function(_0x3624e9,_0x37318b,_0x396afa){_0x396afa(null,util[_0x0335('0x15')](_0x0335('0x16'),_0x0335('0x17'),path[_0x0335('0x18')](_0x37318b['originalname'])));}})});router[_0x0335('0x19')](_0x0335('0xc'),upload[_0x0335('0x1a')]('file'),controller[_0x0335('0x1b')]);var upload=multer({'storage':multer[_0x0335('0x1c')]({'destination':function(_0x47743d,_0x32019c,_0x39f630){_0x39f630(null,path[_0x0335('0x12')](config[_0x0335('0x13')],'server/files/images/logos/'));},'filename':function(_0x50813c,_0x54a895,_0x5d3e3c){_0x5d3e3c(null,util[_0x0335('0x15')](_0x0335('0x16'),_0x0335('0x1d'),path[_0x0335('0x18')](_0x54a895[_0x0335('0x1e')])));}})});router[_0x0335('0x19')](_0x0335('0xd'),upload[_0x0335('0x1a')](_0x0335('0x1f')),controller[_0x0335('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xab6f9d,_0x517133,_0x530d62){_0x530d62(null,path[_0x0335('0x12')](config[_0x0335('0x13')],_0x0335('0x14')));},'filename':function(_0x1157ee,_0x95a67a,_0x19ea07){_0x19ea07(null,util[_0x0335('0x15')](_0x0335('0x16'),_0x0335('0x21'),path['extname'](_0x95a67a['originalname'])));}})});router[_0x0335('0x19')](_0x0335('0x10'),upload[_0x0335('0x1a')]('file'),controller[_0x0335('0x22')]);var upload=multer({'storage':multer[_0x0335('0x1c')]({'destination':function(_0x3ab207,_0xa0625f,_0x4ed082){_0x4ed082(null,path['join'](config[_0x0335('0x13')],_0x0335('0x14')));},'filename':function(_0x57c820,_0x701aba,_0x124728){_0x124728(null,util['format'](_0x0335('0x16'),_0x0335('0x23'),path[_0x0335('0x18')](_0x701aba['originalname'])));}})});router[_0x0335('0x19')]('/:id/favicon',upload['single'](_0x0335('0x1f')),controller['addFavicon']);router['put']('/:id',auth[_0x0335('0x24')](),controller['update']);module[_0x0335('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index f285da7..40e4913 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 _0x95a8=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x95a8,0x174));var _0x895a=function(_0x4bf17a,_0x24d74c){_0x4bf17a=_0x4bf17a-0x0;var _0xe22657=_0x95a8[_0x4bf17a];return _0xe22657;};'use strict';var Sequelize=require(_0x895a('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x895a('0x1')](0xb),'unique':_0x895a('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x895a('0x1')](0xb),'unique':_0x895a('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x895a('0x4')},'logo':{'type':Sequelize[_0x895a('0x5')]},'defaultLogo':{'type':Sequelize[_0x895a('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x895a('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x895a('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x895a('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x895a('0x5')]},'turnaddr':{'type':Sequelize[_0x895a('0x5')]},'turnusername':{'type':Sequelize[_0x895a('0x5')]},'turnpassword':{'type':Sequelize[_0x895a('0x5')]},'pageTitle':{'type':Sequelize[_0x895a('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x895a('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x895a('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x895a('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x895a('0x5')],'defaultValue':_0x895a('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x895a('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x895a('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x895a('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x895a('0x8')},'chatTimeout':{'type':Sequelize[_0x895a('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x895a('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x895a('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x895a('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x895a('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x895a('0x5')]},'defaultFavicon':{'type':Sequelize[_0x895a('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x895a('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x895a('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x895a('0x5')]},'sentiment':{'type':Sequelize[_0x895a('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x895a('0x1')]},'sentimentRegion':{'type':Sequelize[_0x895a('0x5')]},'language':{'type':Sequelize[_0x895a('0x5')]},'bucket':{'type':Sequelize[_0x895a('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x895a('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xa42f=['exports','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa42f,0x19d));var _0xfa42=function(_0x595faf,_0x3c2d14){_0x595faf=_0x595faf-0x0;var _0x130cf2=_0xa42f[_0x595faf];return _0x130cf2;};'use strict';var Sequelize=require(_0xfa42('0x0'));module[_0xfa42('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xfa42('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xfa42('0x3')](0xb),'unique':_0xfa42('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xfa42('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xfa42('0x5')],'defaultValue':_0xfa42('0x6')},'logo':{'type':Sequelize[_0xfa42('0x5')]},'defaultLogo':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xfa42('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xfa42('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xfa42('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xfa42('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xfa42('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xfa42('0x5')],'defaultValue':_0xfa42('0x8')},'enableEmailPreview':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xfa42('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xfa42('0x5')]},'defaultFavicon':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xfa42('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xfa42('0x3')]},'transcribeRegion':{'type':Sequelize[_0xfa42('0x5')]},'sentiment':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xfa42('0x3')]},'sentimentRegion':{'type':Sequelize[_0xfa42('0x5')]},'language':{'type':Sequelize[_0xfa42('0x5')]},'bucket':{'type':Sequelize[_0xfa42('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xfa42('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 725a48d..0b4dd6d 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 _0x04c2=['params','find','body','file','filename','addLogoLogin','loginLogo','../../config/license/util','server/files/images/logos','getLicense','logo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','\x20not\x20found','download','getLogoLogin','preferred','defaultFavicon','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','default_preferred.png','getFavicon','default_favicon.ico','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','request\x20sent','result','catch','status','end','json','offset','limit','set','reject','save','update','destroy','sendStatus','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','show'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x04c2,0x9e));var _0x204c=function(_0x243a32,_0x31f4c8){_0x243a32=_0x243a32-0x0;var _0xad7b97=_0x04c2[_0x243a32];return _0xad7b97;};'use strict';var pdf=require(_0x204c('0x0'));var emlformat=require(_0x204c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x204c('0x2'));var jsonpatch=require(_0x204c('0x3'));var rp=require(_0x204c('0x4'));var moment=require(_0x204c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x204c('0x6'));var util=require(_0x204c('0x7'));var path=require(_0x204c('0x8'));var sox=require(_0x204c('0x9'));var csv=require(_0x204c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x204c('0xb'));var squel=require('squel');var crypto=require(_0x204c('0xc'));var jsforce=require(_0x204c('0xd'));var deskjs=require(_0x204c('0xe'));var toCsv=require(_0x204c('0xa'));var querystring=require(_0x204c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x204c('0x10'));var qs=require(_0x204c('0x11'));var as=require(_0x204c('0x12'));var hardwareService=require(_0x204c('0x13'));var logger=require(_0x204c('0x14'))(_0x204c('0x15'));var utils=require(_0x204c('0x16'));var config=require('../../config/environment');var db=require(_0x204c('0x17'))['db'];var jayson=require(_0x204c('0x18'));var client=jayson[_0x204c('0x19')][_0x204c('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x53f027,_0x1ff577,_0x5d750b){if(_0x5d750b){var _0xabca8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xabca8[_0x204c('0x1b')](_0x1ff577)){return _0x53f027;}else{throw new db[(_0x204c('0x1c'))][(_0x204c('0x1d'))](_0x204c('0x1e'));}}else{return _0x53f027;}}function respondWithRpcPromise(_0x34a56d,_0x5529e8,_0x378dfd,_0x59dc87){return new BPromise(function(_0x104af5,_0xd98b1e){var _0x2bcb0a=_0x59dc87||client;return _0x2bcb0a[_0x204c('0x1f')](_0x34a56d,_0x378dfd)[_0x204c('0x20')](function(_0x5b52a1){logger[_0x204c('0x21')]('Setting,\x20%s,\x20%s',_0x5529e8,'request\x20sent');logger[_0x204c('0x22')](_0x204c('0x23'),_0x5529e8,'request\x20sent',JSON[_0x204c('0x24')](_0x5b52a1));if(_0x5b52a1['error']){if(_0x5b52a1[_0x204c('0x25')][_0x204c('0x26')]===0x1f4){logger[_0x204c('0x25')](_0x204c('0x27'),_0x5529e8,_0x5b52a1['error'][_0x204c('0x28')]);return _0xd98b1e(_0x5b52a1[_0x204c('0x25')][_0x204c('0x28')]);}logger[_0x204c('0x25')](_0x204c('0x27'),_0x5529e8,_0x5b52a1[_0x204c('0x25')]['message']);return _0x104af5(_0x5b52a1[_0x204c('0x25')][_0x204c('0x28')]);}else{logger[_0x204c('0x21')](_0x204c('0x27'),_0x5529e8,_0x204c('0x29'));_0x104af5(_0x5b52a1[_0x204c('0x2a')][_0x204c('0x28')]);}})[_0x204c('0x2b')](function(_0xbf1686){logger[_0x204c('0x25')](_0x204c('0x27'),_0x5529e8,_0xbf1686);_0xd98b1e(_0xbf1686);});});}function respondWithStatusCode(_0x2f197f,_0x59f8f1){_0x59f8f1=_0x59f8f1||0xcc;return function(_0x5510c6){if(_0x5510c6){return _0x2f197f['sendStatus'](_0x59f8f1);}return _0x2f197f[_0x204c('0x2c')](_0x59f8f1)[_0x204c('0x2d')]();};}function respondWithResult(_0x4c6178,_0x174709){_0x174709=_0x174709||0xc8;return function(_0x58d4ab){if(_0x58d4ab){return _0x4c6178[_0x204c('0x2c')](_0x174709)[_0x204c('0x2e')](_0x58d4ab);}};}function respondWithFilteredResult(_0x5679c3,_0x55d1bd){return function(_0x12620e){if(_0x12620e){var _0x1fc3c8=_0x12620e['count'],_0x552a98=_0x55d1bd['offset'],_0x260a7d=_0x55d1bd[_0x204c('0x2f')]+_0x55d1bd[_0x204c('0x30')],_0x441194;if(_0x260a7d>=_0x1fc3c8){_0x260a7d=_0x1fc3c8;_0x441194=0xc8;}else{_0x441194=0xce;}_0x5679c3['status'](_0x441194);return _0x5679c3[_0x204c('0x31')]('Content-Range',_0x552a98+'-'+_0x260a7d+'/'+_0x1fc3c8)['json'](_0x12620e);}return null;};}function patchUpdates(_0x567dda){return function(_0x437151){try{jsonpatch['apply'](_0x437151,_0x567dda,!![]);}catch(_0x273890){return BPromise[_0x204c('0x32')](_0x273890);}return _0x437151[_0x204c('0x33')]();};}function saveUpdates(_0x32a692,_0x2bf526){return function(_0x17f69d){if(_0x17f69d){return _0x17f69d[_0x204c('0x34')](_0x32a692)['then'](function(_0x756bd6){return _0x756bd6;});}return null;};}function removeEntity(_0x3e39e7,_0x4ef10b){return function(_0x5d94de){if(_0x5d94de){return _0x5d94de[_0x204c('0x35')]()[_0x204c('0x20')](function(){_0x3e39e7[_0x204c('0x2c')](0xcc)[_0x204c('0x2d')]();});}};}function handleEntityNotFound(_0x583c9a,_0x202c76){return function(_0x564de2){if(!_0x564de2){_0x583c9a[_0x204c('0x36')](0x194);}return _0x564de2;};}function handleError(_0x1a975e,_0x587ebb){_0x587ebb=_0x587ebb||0x1f4;return function(_0xda3f54){logger['error'](_0xda3f54['stack']);if(_0xda3f54[_0x204c('0x37')]){delete _0xda3f54[_0x204c('0x37')];}_0x1a975e['status'](_0x587ebb)[_0x204c('0x38')](_0xda3f54);};}exports[_0x204c('0x39')]=function(_0x38ce1e,_0x326efa){var _0x5abd31={},_0x3ccb19={},_0x2cfb61={'count':0x0,'rows':[]};var _0x3f0550=_[_0x204c('0x3a')](db[_0x204c('0x3b')][_0x204c('0x3c')],function(_0x478b89){return{'name':_0x478b89[_0x204c('0x3d')],'type':_0x478b89[_0x204c('0x3e')][_0x204c('0x3f')]};});_0x3ccb19[_0x204c('0x40')]=_[_0x204c('0x3a')](_0x3f0550,_0x204c('0x37'));_0x3ccb19[_0x204c('0x41')]=_[_0x204c('0x42')](_0x38ce1e['query']);_0x3ccb19[_0x204c('0x43')]=_[_0x204c('0x44')](_0x3ccb19[_0x204c('0x40')],_0x3ccb19[_0x204c('0x41')]);_0x5abd31[_0x204c('0x45')]=_['intersection'](_0x3ccb19['model'],qs[_0x204c('0x46')](_0x38ce1e[_0x204c('0x41')][_0x204c('0x46')]));_0x5abd31[_0x204c('0x45')]=_0x5abd31['attributes'][_0x204c('0x47')]?_0x5abd31[_0x204c('0x45')]:_0x3ccb19[_0x204c('0x40')];if(!_0x38ce1e['query'][_0x204c('0x48')](_0x204c('0x49'))){_0x5abd31[_0x204c('0x30')]=qs['limit'](_0x38ce1e[_0x204c('0x41')]['limit']);_0x5abd31[_0x204c('0x2f')]=qs[_0x204c('0x2f')](_0x38ce1e['query'][_0x204c('0x2f')]);}_0x5abd31[_0x204c('0x4a')]=qs['sort'](_0x38ce1e['query'][_0x204c('0x4b')]);_0x5abd31['where']=qs[_0x204c('0x43')](_[_0x204c('0x4c')](_0x38ce1e[_0x204c('0x41')],_0x3ccb19[_0x204c('0x43')]),_0x3f0550);if(_0x38ce1e[_0x204c('0x41')][_0x204c('0x4d')]){_0x5abd31['where']=_[_0x204c('0x4e')](_0x5abd31[_0x204c('0x4f')],{'$or':_[_0x204c('0x3a')](_0x3f0550,function(_0x3f8d17){if(_0x3f8d17['type']!==_0x204c('0x50')){var _0x3dc46a={};_0x3dc46a[_0x3f8d17[_0x204c('0x37')]]={'$like':'%'+_0x38ce1e[_0x204c('0x41')]['filter']+'%'};return _0x3dc46a;}})});}_0x5abd31=_[_0x204c('0x4e')]({},_0x5abd31,_0x38ce1e[_0x204c('0x51')]);var _0x4117a3={'where':_0x5abd31[_0x204c('0x4f')]};return db[_0x204c('0x3b')][_0x204c('0x52')](_0x4117a3)[_0x204c('0x20')](function(_0x506e8e){_0x2cfb61[_0x204c('0x52')]=_0x506e8e;if(_0x38ce1e[_0x204c('0x41')][_0x204c('0x53')]){_0x5abd31[_0x204c('0x54')]=[{'all':!![]}];}return db['Setting'][_0x204c('0x55')](_0x5abd31);})[_0x204c('0x20')](function(_0x20f9b6){_0x2cfb61[_0x204c('0x56')]=_0x20f9b6;return _0x2cfb61;})['then'](respondWithFilteredResult(_0x326efa,_0x5abd31))[_0x204c('0x2b')](handleError(_0x326efa,null));};exports[_0x204c('0x57')]=function(_0x3c2e0f,_0x1dcc5b){var _0x2ca976={'raw':![],'where':{'id':_0x3c2e0f[_0x204c('0x58')]['id']}},_0x24b9a4={};_0x24b9a4[_0x204c('0x40')]=_[_0x204c('0x42')](db[_0x204c('0x3b')][_0x204c('0x3c')]);_0x24b9a4[_0x204c('0x41')]=_['keys'](_0x3c2e0f[_0x204c('0x41')]);_0x24b9a4['filters']=_['intersection'](_0x24b9a4[_0x204c('0x40')],_0x24b9a4[_0x204c('0x41')]);_0x2ca976[_0x204c('0x45')]=_[_0x204c('0x44')](_0x24b9a4[_0x204c('0x40')],qs['fields'](_0x3c2e0f[_0x204c('0x41')][_0x204c('0x46')]));_0x2ca976['attributes']=_0x2ca976[_0x204c('0x45')]['length']?_0x2ca976[_0x204c('0x45')]:_0x24b9a4[_0x204c('0x40')];if(_0x3c2e0f[_0x204c('0x41')][_0x204c('0x53')]){_0x2ca976[_0x204c('0x54')]=[{'all':!![]}];}_0x2ca976=_[_0x204c('0x4e')]({},_0x2ca976,_0x3c2e0f['options']);return db['Setting'][_0x204c('0x59')](_0x2ca976)[_0x204c('0x20')](handleEntityNotFound(_0x1dcc5b,null))['then'](respondWithResult(_0x1dcc5b,null))[_0x204c('0x2b')](handleError(_0x1dcc5b,null));};exports[_0x204c('0x34')]=function(_0x1e8436,_0x6e3a6d){if(_0x1e8436['body']['id']){delete _0x1e8436['body']['id'];}return db['Setting'][_0x204c('0x59')]({'where':{'id':_0x1e8436['params']['id']}})[_0x204c('0x20')](handleEntityNotFound(_0x6e3a6d,null))[_0x204c('0x20')](saveUpdates(_0x1e8436[_0x204c('0x5a')],null))[_0x204c('0x20')](respondWithResult(_0x6e3a6d,null))[_0x204c('0x2b')](handleError(_0x6e3a6d,null));};exports['addLogo']=function(_0x492b2e,_0x3cb702,_0x5f4edd){if(_0x492b2e['file']&&_0x492b2e[_0x204c('0x5b')][_0x204c('0x5c')]){_0x492b2e[_0x204c('0x5a')]['logo']=_0x492b2e['file'][_0x204c('0x5c')];}return db[_0x204c('0x3b')][_0x204c('0x59')]({'where':{'id':_0x492b2e['params']['id']}})[_0x204c('0x20')](handleEntityNotFound(_0x3cb702,null))['then'](saveUpdates(_0x492b2e[_0x204c('0x5a')],null))['then'](respondWithResult(_0x3cb702,null))[_0x204c('0x2b')](handleError(_0x3cb702,null));};exports[_0x204c('0x5d')]=function(_0x41781a,_0x5badcf,_0x1f5b81){if(_0x41781a[_0x204c('0x5b')]&&_0x41781a[_0x204c('0x5b')]['filename']){_0x41781a['body'][_0x204c('0x5e')]=_0x41781a[_0x204c('0x5b')][_0x204c('0x5c')];}return db[_0x204c('0x3b')][_0x204c('0x59')]({'where':{'id':_0x41781a[_0x204c('0x58')]['id']}})['then'](handleEntityNotFound(_0x5badcf,null))['then'](saveUpdates(_0x41781a['body'],null))['then'](respondWithResult(_0x5badcf,null))[_0x204c('0x2b')](handleError(_0x5badcf,null));};var utilLicense=require(_0x204c('0x5f'));exports['getLogo']=function(_0x553bdf,_0x1aa765,_0x16c5d5){var _0x508c4c=_0x204c('0x60');var _0x1723eb={'custom':![]};return utilLicense[_0x204c('0x61')]()[_0x204c('0x20')](function(_0x1e155e){if(_0x1e155e){_0x1723eb=_0x1e155e;}return db[_0x204c('0x3b')][_0x204c('0x59')]({'where':{'id':_0x553bdf['params']['id']},'attributes':[_0x204c('0x62'),'loginLogo','preferred',_0x204c('0x63'),_0x204c('0x64'),_0x204c('0x65'),_0x204c('0x66'),'defaultFavicon'],'raw':!![]});})[_0x204c('0x20')](handleEntityNotFound(_0x1aa765,null))['then'](function(_0x16d16d){if(_0x16d16d){var _0x4fcd89=_0x16d16d[_0x204c('0x62')]&&fs[_0x204c('0x67')](path[_0x204c('0x68')](config[_0x204c('0x69')],_0x508c4c,_[_0x204c('0x6a')](_0x16d16d[_0x204c('0x62')])))?path['join'](config[_0x204c('0x69')],_0x508c4c,_['toLower'](_0x16d16d[_0x204c('0x62')])):path[_0x204c('0x68')](config[_0x204c('0x69')],_0x508c4c,_[_0x204c('0x6a')](_0x204c('0x6b')));var _0x5b9c22=_0x204c('0x6c')+_[_0x204c('0x6d')](_0x204c('0x62'));if(_0x16d16d[_0x5b9c22]||!_0x1723eb['custom']){_0x4fcd89=path[_0x204c('0x68')](config['root'],_0x508c4c,_[_0x204c('0x6a')]('default_logo.svg'));}if(!fs[_0x204c('0x67')](_0x4fcd89)){throw new db[(_0x204c('0x1c'))]['ValidationError'](_['upperFirst'](_0x204c('0x62'))+_0x204c('0x6e'));}return _0x1aa765[_0x204c('0x6f')](_0x4fcd89);}})['catch'](handleError(_0x1aa765,null));};var utilLicense=require(_0x204c('0x5f'));exports[_0x204c('0x70')]=function(_0x5b0f14,_0x5d7c52,_0x57d759){var _0x52319d=_0x204c('0x60');var _0x5b898e={'custom':![]};return utilLicense[_0x204c('0x61')]()[_0x204c('0x20')](function(_0x1122c3){if(_0x1122c3){_0x5b898e=_0x1122c3;}return db['Setting'][_0x204c('0x59')]({'where':{'id':_0x5b0f14[_0x204c('0x58')]['id']},'attributes':[_0x204c('0x62'),_0x204c('0x5e'),_0x204c('0x71'),_0x204c('0x63'),_0x204c('0x64'),_0x204c('0x65'),_0x204c('0x66'),_0x204c('0x72')],'raw':!![]});})['then'](handleEntityNotFound(_0x5d7c52,null))['then'](function(_0x59c920){if(_0x59c920){var _0x33974b=_0x59c920[_0x204c('0x5e')]&&fs[_0x204c('0x67')](path['join'](config[_0x204c('0x69')],_0x52319d,_[_0x204c('0x6a')](_0x59c920[_0x204c('0x5e')])))?path[_0x204c('0x68')](config['root'],_0x52319d,_['toLower'](_0x59c920[_0x204c('0x5e')])):path[_0x204c('0x68')](config[_0x204c('0x69')],_0x52319d,_[_0x204c('0x6a')](_0x204c('0x73')));var _0x233788=_0x204c('0x6c')+_[_0x204c('0x6d')]('loginLogo');if(_0x59c920[_0x233788]||!_0x5b898e[_0x204c('0x74')]){_0x33974b=path[_0x204c('0x68')](config[_0x204c('0x69')],_0x52319d,_[_0x204c('0x6a')]('default_loginLogo.svg'));}if(!fs[_0x204c('0x67')](_0x33974b)){throw new db[(_0x204c('0x1c'))][(_0x204c('0x1d'))](_[_0x204c('0x6d')]('loginLogo')+_0x204c('0x6e'));}return _0x5d7c52[_0x204c('0x6f')](_0x33974b);}})['catch'](handleError(_0x5d7c52,null));};exports[_0x204c('0x75')]=function(_0x484255,_0x36c32a){return db['Setting'][_0x204c('0x59')]({'where':{'id':_0x484255[_0x204c('0x58')]['id']},'attributes':[_0x204c('0x76')]})[_0x204c('0x20')](respondWithResult(_0x36c32a,null))[_0x204c('0x2b')](handleError(_0x36c32a,null));};exports[_0x204c('0x77')]=function(_0x2844d5,_0x1bed1b,_0x275f2f){if(_0x2844d5[_0x204c('0x5b')]&&_0x2844d5['file'][_0x204c('0x5c')]){_0x2844d5['body'][_0x204c('0x71')]=_0x2844d5[_0x204c('0x5b')][_0x204c('0x5c')];}return db[_0x204c('0x3b')][_0x204c('0x59')]({'where':{'id':_0x2844d5[_0x204c('0x58')]['id']}})[_0x204c('0x20')](handleEntityNotFound(_0x1bed1b,null))[_0x204c('0x20')](saveUpdates(_0x2844d5[_0x204c('0x5a')],null))[_0x204c('0x20')](respondWithResult(_0x1bed1b,null))[_0x204c('0x2b')](handleError(_0x1bed1b,null));};var utilLicense=require(_0x204c('0x5f'));exports['getPreferred']=function(_0x48d31b,_0xefa1fb,_0x32ef20){var _0x117908=_0x204c('0x60');var _0x17f3e5={'custom':![]};return utilLicense[_0x204c('0x61')]()['then'](function(_0x5a90cd){if(_0x5a90cd){_0x17f3e5=_0x5a90cd;}return db[_0x204c('0x3b')]['find']({'where':{'id':_0x48d31b[_0x204c('0x58')]['id']},'attributes':['logo',_0x204c('0x5e'),_0x204c('0x71'),_0x204c('0x63'),_0x204c('0x64'),'defaultLoginLogo',_0x204c('0x66'),'defaultFavicon'],'raw':!![]});})[_0x204c('0x20')](handleEntityNotFound(_0xefa1fb,null))[_0x204c('0x20')](function(_0x5f1c4d){if(_0x5f1c4d){var _0x3f5d22=_0x5f1c4d[_0x204c('0x71')]&&fs[_0x204c('0x67')](path[_0x204c('0x68')](config['root'],_0x117908,_[_0x204c('0x6a')](_0x5f1c4d[_0x204c('0x71')])))?path[_0x204c('0x68')](config[_0x204c('0x69')],_0x117908,_[_0x204c('0x6a')](_0x5f1c4d[_0x204c('0x71')])):path[_0x204c('0x68')](config[_0x204c('0x69')],_0x117908,_[_0x204c('0x6a')]('default_preferred.png'));var _0x193e71=_0x204c('0x6c')+_[_0x204c('0x6d')]('preferred');if(_0x5f1c4d[_0x193e71]||!_0x17f3e5['custom']||!_0x17f3e5[_0x204c('0x71')]){_0x3f5d22=path[_0x204c('0x68')](config[_0x204c('0x69')],_0x117908,_[_0x204c('0x6a')](_0x204c('0x78')));}if(!fs[_0x204c('0x67')](_0x3f5d22)){throw new db[(_0x204c('0x1c'))][(_0x204c('0x1d'))](_['upperFirst']('preferred')+_0x204c('0x6e'));}return _0xefa1fb['download'](_0x3f5d22);}})[_0x204c('0x2b')](handleError(_0xefa1fb,null));};exports['addFavicon']=function(_0x687d80,_0x5b02ed,_0x16f17e){if(_0x687d80[_0x204c('0x5b')]&&_0x687d80[_0x204c('0x5b')]['filename']){_0x687d80['body']['favicon']=_0x687d80[_0x204c('0x5b')][_0x204c('0x5c')];}return db[_0x204c('0x3b')]['find']({'where':{'id':_0x687d80['params']['id']}})[_0x204c('0x20')](handleEntityNotFound(_0x5b02ed,null))['then'](saveUpdates(_0x687d80[_0x204c('0x5a')],null))[_0x204c('0x20')](respondWithResult(_0x5b02ed,null))['catch'](handleError(_0x5b02ed,null));};var utilLicense=require(_0x204c('0x5f'));exports[_0x204c('0x79')]=function(_0x36cf1b,_0x11ce3d,_0x33cbfb){var _0x3cb902='server/files/images/logos';var _0x560d2a={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x24f7b5){if(_0x24f7b5){_0x560d2a=_0x24f7b5;}return db['Setting'][_0x204c('0x59')]({'where':{'id':_0x36cf1b[_0x204c('0x58')]['id']},'attributes':['logo',_0x204c('0x5e'),_0x204c('0x71'),_0x204c('0x63'),'defaultLogo',_0x204c('0x65'),_0x204c('0x66'),_0x204c('0x72')],'raw':!![]});})['then'](handleEntityNotFound(_0x11ce3d,null))['then'](function(_0x4772a3){if(_0x4772a3){var _0x2d44bd=_0x4772a3[_0x204c('0x63')]&&fs[_0x204c('0x67')](path[_0x204c('0x68')](config[_0x204c('0x69')],_0x3cb902,_[_0x204c('0x6a')](_0x4772a3[_0x204c('0x63')])))?path['join'](config[_0x204c('0x69')],_0x3cb902,_[_0x204c('0x6a')](_0x4772a3[_0x204c('0x63')])):path[_0x204c('0x68')](config['root'],_0x3cb902,_['toLower'](_0x204c('0x7a')));var _0x53e4a6=_0x204c('0x6c')+_[_0x204c('0x6d')]('favicon');if(_0x4772a3[_0x53e4a6]||!_0x560d2a[_0x204c('0x74')]){_0x2d44bd=path['join'](config[_0x204c('0x69')],_0x3cb902,_[_0x204c('0x6a')](_0x204c('0x7a')));}if(!fs[_0x204c('0x67')](_0x2d44bd)){throw new db['Sequelize'][(_0x204c('0x1d'))](_[_0x204c('0x6d')](_0x204c('0x63'))+_0x204c('0x6e'));}return _0x11ce3d[_0x204c('0x6f')](_0x2d44bd);}})[_0x204c('0x2b')](handleError(_0x11ce3d,null));}; \ No newline at end of file +var _0x0fbd=['keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','rows','catch','show','length','options','find','body','params','file','filename','logo','loginLogo','../../config/license/util','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','upperFirst','custom','existsSync','\x20not\x20found','download','getLogoLogin','server/files/images/logos','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','Sequelize','ValidationError','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','set','json','apply','reject','update','destroy','name','index','map','Setting','rawAttributes','fieldName','key','query'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0fbd,0x125));var _0xd0fb=function(_0x3025e7,_0x105d6a){_0x3025e7=_0x3025e7-0x0;var _0x4dae32=_0x0fbd[_0x3025e7];return _0x4dae32;};'use strict';var pdf=require(_0xd0fb('0x0'));var emlformat=require(_0xd0fb('0x1'));var rimraf=require(_0xd0fb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0fb('0x3'));var rp=require(_0xd0fb('0x4'));var moment=require(_0xd0fb('0x5'));var BPromise=require(_0xd0fb('0x6'));var Mustache=require(_0xd0fb('0x7'));var util=require(_0xd0fb('0x8'));var path=require('path');var sox=require(_0xd0fb('0x9'));var csv=require('to-csv');var ejs=require(_0xd0fb('0xa'));var fs=require('fs');var _=require(_0xd0fb('0xb'));var squel=require(_0xd0fb('0xc'));var crypto=require(_0xd0fb('0xd'));var jsforce=require(_0xd0fb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd0fb('0xf'));var querystring=require(_0xd0fb('0x10'));var Papa=require(_0xd0fb('0x11'));var Redis=require(_0xd0fb('0x12'));var authService=require(_0xd0fb('0x13'));var qs=require(_0xd0fb('0x14'));var as=require(_0xd0fb('0x15'));var hardwareService=require(_0xd0fb('0x16'));var logger=require(_0xd0fb('0x17'))(_0xd0fb('0x18'));var utils=require('../../config/utils');var config=require(_0xd0fb('0x19'));var db=require(_0xd0fb('0x1a'))['db'];var jayson=require(_0xd0fb('0x1b'));var client=jayson[_0xd0fb('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x57a60a,_0xf859a7,_0x1acd14){if(_0x1acd14){var _0x306e75=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x306e75['test'](_0xf859a7)){return _0x57a60a;}else{throw new db[(_0xd0fb('0x1d'))][(_0xd0fb('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 _0x57a60a;}}function respondWithRpcPromise(_0x4b0643,_0x3930bd,_0x3f60ce,_0x39cf61){return new BPromise(function(_0xf01745,_0x510bdf){var _0x4152ae=_0x39cf61||client;return _0x4152ae[_0xd0fb('0x1f')](_0x4b0643,_0x3f60ce)[_0xd0fb('0x20')](function(_0x3c32a2){logger[_0xd0fb('0x21')]('Setting,\x20%s,\x20%s',_0x3930bd,_0xd0fb('0x22'));logger[_0xd0fb('0x23')](_0xd0fb('0x24'),_0x3930bd,_0xd0fb('0x22'),JSON[_0xd0fb('0x25')](_0x3c32a2));if(_0x3c32a2[_0xd0fb('0x26')]){if(_0x3c32a2[_0xd0fb('0x26')]['code']===0x1f4){logger[_0xd0fb('0x26')](_0xd0fb('0x27'),_0x3930bd,_0x3c32a2[_0xd0fb('0x26')][_0xd0fb('0x28')]);return _0x510bdf(_0x3c32a2[_0xd0fb('0x26')][_0xd0fb('0x28')]);}logger[_0xd0fb('0x26')]('Setting,\x20%s,\x20%s',_0x3930bd,_0x3c32a2[_0xd0fb('0x26')][_0xd0fb('0x28')]);return _0xf01745(_0x3c32a2[_0xd0fb('0x26')][_0xd0fb('0x28')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x3930bd,_0xd0fb('0x22'));_0xf01745(_0x3c32a2[_0xd0fb('0x29')][_0xd0fb('0x28')]);}})['catch'](function(_0x162cea){logger[_0xd0fb('0x26')](_0xd0fb('0x27'),_0x3930bd,_0x162cea);_0x510bdf(_0x162cea);});});}function respondWithStatusCode(_0x2f654f,_0x31dc1f){_0x31dc1f=_0x31dc1f||0xcc;return function(_0x1c762c){if(_0x1c762c){return _0x2f654f[_0xd0fb('0x2a')](_0x31dc1f);}return _0x2f654f[_0xd0fb('0x2b')](_0x31dc1f)[_0xd0fb('0x2c')]();};}function respondWithResult(_0x4fd2f4,_0x3c35f9){_0x3c35f9=_0x3c35f9||0xc8;return function(_0x36751d){if(_0x36751d){return _0x4fd2f4[_0xd0fb('0x2b')](_0x3c35f9)['json'](_0x36751d);}};}function respondWithFilteredResult(_0x36c01b,_0x21a080){return function(_0x367641){if(_0x367641){var _0xd114ad=_0x367641[_0xd0fb('0x2d')],_0xaf2e60=_0x21a080['offset'],_0x5083ae=_0x21a080[_0xd0fb('0x2e')]+_0x21a080['limit'],_0xec2d8f;if(_0x5083ae>=_0xd114ad){_0x5083ae=_0xd114ad;_0xec2d8f=0xc8;}else{_0xec2d8f=0xce;}_0x36c01b['status'](_0xec2d8f);return _0x36c01b[_0xd0fb('0x2f')]('Content-Range',_0xaf2e60+'-'+_0x5083ae+'/'+_0xd114ad)[_0xd0fb('0x30')](_0x367641);}return null;};}function patchUpdates(_0xb9481e){return function(_0x20a4ca){try{jsonpatch[_0xd0fb('0x31')](_0x20a4ca,_0xb9481e,!![]);}catch(_0x1f4fd2){return BPromise[_0xd0fb('0x32')](_0x1f4fd2);}return _0x20a4ca['save']();};}function saveUpdates(_0x1d2623,_0x4ba9db){return function(_0x4da6cc){if(_0x4da6cc){return _0x4da6cc[_0xd0fb('0x33')](_0x1d2623)['then'](function(_0x445cb2){return _0x445cb2;});}return null;};}function removeEntity(_0x2d911d,_0x3787fe){return function(_0x108f8a){if(_0x108f8a){return _0x108f8a[_0xd0fb('0x34')]()[_0xd0fb('0x20')](function(){_0x2d911d[_0xd0fb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b4427,_0x569fd5){return function(_0x10820d){if(!_0x10820d){_0x2b4427['sendStatus'](0x194);}return _0x10820d;};}function handleError(_0x3303cf,_0x38c14f){_0x38c14f=_0x38c14f||0x1f4;return function(_0x103b95){logger[_0xd0fb('0x26')](_0x103b95['stack']);if(_0x103b95[_0xd0fb('0x35')]){delete _0x103b95['name'];}_0x3303cf[_0xd0fb('0x2b')](_0x38c14f)['send'](_0x103b95);};}exports[_0xd0fb('0x36')]=function(_0x10aa74,_0x36ac4e){var _0xde1c8b={},_0x5675aa={},_0x2a190d={'count':0x0,'rows':[]};var _0x25a71a=_[_0xd0fb('0x37')](db[_0xd0fb('0x38')][_0xd0fb('0x39')],function(_0x5cbf2f){return{'name':_0x5cbf2f[_0xd0fb('0x3a')],'type':_0x5cbf2f['type'][_0xd0fb('0x3b')]};});_0x5675aa['model']=_[_0xd0fb('0x37')](_0x25a71a,_0xd0fb('0x35'));_0x5675aa[_0xd0fb('0x3c')]=_[_0xd0fb('0x3d')](_0x10aa74[_0xd0fb('0x3c')]);_0x5675aa[_0xd0fb('0x3e')]=_[_0xd0fb('0x3f')](_0x5675aa[_0xd0fb('0x40')],_0x5675aa[_0xd0fb('0x3c')]);_0xde1c8b[_0xd0fb('0x41')]=_['intersection'](_0x5675aa[_0xd0fb('0x40')],qs[_0xd0fb('0x42')](_0x10aa74[_0xd0fb('0x3c')][_0xd0fb('0x42')]));_0xde1c8b[_0xd0fb('0x41')]=_0xde1c8b[_0xd0fb('0x41')]['length']?_0xde1c8b[_0xd0fb('0x41')]:_0x5675aa[_0xd0fb('0x40')];if(!_0x10aa74['query'][_0xd0fb('0x43')](_0xd0fb('0x44'))){_0xde1c8b['limit']=qs['limit'](_0x10aa74[_0xd0fb('0x3c')]['limit']);_0xde1c8b['offset']=qs[_0xd0fb('0x2e')](_0x10aa74[_0xd0fb('0x3c')]['offset']);}_0xde1c8b[_0xd0fb('0x45')]=qs['sort'](_0x10aa74[_0xd0fb('0x3c')][_0xd0fb('0x46')]);_0xde1c8b[_0xd0fb('0x47')]=qs['filters'](_[_0xd0fb('0x48')](_0x10aa74['query'],_0x5675aa[_0xd0fb('0x3e')]),_0x25a71a);if(_0x10aa74[_0xd0fb('0x3c')][_0xd0fb('0x49')]){_0xde1c8b[_0xd0fb('0x47')]=_[_0xd0fb('0x4a')](_0xde1c8b[_0xd0fb('0x47')],{'$or':_['map'](_0x25a71a,function(_0x33ad67){if(_0x33ad67[_0xd0fb('0x4b')]!=='VIRTUAL'){var _0x1a467f={};_0x1a467f[_0x33ad67[_0xd0fb('0x35')]]={'$like':'%'+_0x10aa74['query'][_0xd0fb('0x49')]+'%'};return _0x1a467f;}})});}_0xde1c8b=_[_0xd0fb('0x4a')]({},_0xde1c8b,_0x10aa74['options']);var _0x2642a9={'where':_0xde1c8b[_0xd0fb('0x47')]};return db[_0xd0fb('0x38')]['count'](_0x2642a9)['then'](function(_0x1617bc){_0x2a190d[_0xd0fb('0x2d')]=_0x1617bc;if(_0x10aa74[_0xd0fb('0x3c')][_0xd0fb('0x4c')]){_0xde1c8b[_0xd0fb('0x4d')]=[{'all':!![]}];}return db[_0xd0fb('0x38')]['findAll'](_0xde1c8b);})[_0xd0fb('0x20')](function(_0x25ec9b){_0x2a190d[_0xd0fb('0x4e')]=_0x25ec9b;return _0x2a190d;})[_0xd0fb('0x20')](respondWithFilteredResult(_0x36ac4e,_0xde1c8b))[_0xd0fb('0x4f')](handleError(_0x36ac4e,null));};exports[_0xd0fb('0x50')]=function(_0x1f2d4c,_0x5b9636){var _0x33ccde={'raw':![],'where':{'id':_0x1f2d4c['params']['id']}},_0x22fc28={};_0x22fc28[_0xd0fb('0x40')]=_['keys'](db[_0xd0fb('0x38')]['rawAttributes']);_0x22fc28[_0xd0fb('0x3c')]=_[_0xd0fb('0x3d')](_0x1f2d4c['query']);_0x22fc28[_0xd0fb('0x3e')]=_[_0xd0fb('0x3f')](_0x22fc28[_0xd0fb('0x40')],_0x22fc28[_0xd0fb('0x3c')]);_0x33ccde[_0xd0fb('0x41')]=_[_0xd0fb('0x3f')](_0x22fc28['model'],qs[_0xd0fb('0x42')](_0x1f2d4c[_0xd0fb('0x3c')][_0xd0fb('0x42')]));_0x33ccde[_0xd0fb('0x41')]=_0x33ccde['attributes'][_0xd0fb('0x51')]?_0x33ccde[_0xd0fb('0x41')]:_0x22fc28[_0xd0fb('0x40')];if(_0x1f2d4c[_0xd0fb('0x3c')][_0xd0fb('0x4c')]){_0x33ccde[_0xd0fb('0x4d')]=[{'all':!![]}];}_0x33ccde=_[_0xd0fb('0x4a')]({},_0x33ccde,_0x1f2d4c[_0xd0fb('0x52')]);return db[_0xd0fb('0x38')][_0xd0fb('0x53')](_0x33ccde)['then'](handleEntityNotFound(_0x5b9636,null))['then'](respondWithResult(_0x5b9636,null))[_0xd0fb('0x4f')](handleError(_0x5b9636,null));};exports['update']=function(_0x328fbf,_0x1ce39e){if(_0x328fbf[_0xd0fb('0x54')]['id']){delete _0x328fbf['body']['id'];}return db['Setting'][_0xd0fb('0x53')]({'where':{'id':_0x328fbf[_0xd0fb('0x55')]['id']}})['then'](handleEntityNotFound(_0x1ce39e,null))[_0xd0fb('0x20')](saveUpdates(_0x328fbf[_0xd0fb('0x54')],null))['then'](respondWithResult(_0x1ce39e,null))[_0xd0fb('0x4f')](handleError(_0x1ce39e,null));};exports['addLogo']=function(_0x113e0f,_0x4b42f5,_0x46c7b1){if(_0x113e0f[_0xd0fb('0x56')]&&_0x113e0f['file'][_0xd0fb('0x57')]){_0x113e0f['body'][_0xd0fb('0x58')]=_0x113e0f['file'][_0xd0fb('0x57')];}return db['Setting']['find']({'where':{'id':_0x113e0f['params']['id']}})[_0xd0fb('0x20')](handleEntityNotFound(_0x4b42f5,null))[_0xd0fb('0x20')](saveUpdates(_0x113e0f['body'],null))[_0xd0fb('0x20')](respondWithResult(_0x4b42f5,null))[_0xd0fb('0x4f')](handleError(_0x4b42f5,null));};exports['addLogoLogin']=function(_0x316b3b,_0x35a87,_0x346851){if(_0x316b3b['file']&&_0x316b3b[_0xd0fb('0x56')]['filename']){_0x316b3b[_0xd0fb('0x54')][_0xd0fb('0x59')]=_0x316b3b[_0xd0fb('0x56')]['filename'];}return db[_0xd0fb('0x38')][_0xd0fb('0x53')]({'where':{'id':_0x316b3b['params']['id']}})['then'](handleEntityNotFound(_0x35a87,null))['then'](saveUpdates(_0x316b3b[_0xd0fb('0x54')],null))[_0xd0fb('0x20')](respondWithResult(_0x35a87,null))[_0xd0fb('0x4f')](handleError(_0x35a87,null));};var utilLicense=require(_0xd0fb('0x5a'));exports[_0xd0fb('0x5b')]=function(_0x36de7c,_0x5a7801,_0x2d48ef){var _0x59f31b='server/files/images/logos';var _0x3b1d49={'custom':![]};return utilLicense[_0xd0fb('0x5c')]()['then'](function(_0x4da2c8){if(_0x4da2c8){_0x3b1d49=_0x4da2c8;}return db[_0xd0fb('0x38')][_0xd0fb('0x53')]({'where':{'id':_0x36de7c['params']['id']},'attributes':[_0xd0fb('0x58'),_0xd0fb('0x59'),_0xd0fb('0x5d'),_0xd0fb('0x5e'),_0xd0fb('0x5f'),_0xd0fb('0x60'),_0xd0fb('0x61'),'defaultFavicon'],'raw':!![]});})[_0xd0fb('0x20')](handleEntityNotFound(_0x5a7801,null))['then'](function(_0x7392bb){if(_0x7392bb){var _0x3a6985=_0x7392bb['logo']&&fs['existsSync'](path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x59f31b,_[_0xd0fb('0x64')](_0x7392bb['logo'])))?path['join'](config[_0xd0fb('0x63')],_0x59f31b,_[_0xd0fb('0x64')](_0x7392bb['logo'])):path['join'](config[_0xd0fb('0x63')],_0x59f31b,_[_0xd0fb('0x64')](_0xd0fb('0x65')));var _0x13f610=_0xd0fb('0x66')+_[_0xd0fb('0x67')](_0xd0fb('0x58'));if(_0x7392bb[_0x13f610]||!_0x3b1d49[_0xd0fb('0x68')]){_0x3a6985=path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x59f31b,_[_0xd0fb('0x64')]('default_logo.svg'));}if(!fs[_0xd0fb('0x69')](_0x3a6985)){throw new db['Sequelize'][(_0xd0fb('0x1e'))](_[_0xd0fb('0x67')](_0xd0fb('0x58'))+_0xd0fb('0x6a'));}return _0x5a7801[_0xd0fb('0x6b')](_0x3a6985);}})['catch'](handleError(_0x5a7801,null));};var utilLicense=require(_0xd0fb('0x5a'));exports[_0xd0fb('0x6c')]=function(_0x37e839,_0x45221c,_0x41a947){var _0x21c399=_0xd0fb('0x6d');var _0xe7a6e2={'custom':![]};return utilLicense['getLicense']()[_0xd0fb('0x20')](function(_0x3743db){if(_0x3743db){_0xe7a6e2=_0x3743db;}return db['Setting'][_0xd0fb('0x53')]({'where':{'id':_0x37e839[_0xd0fb('0x55')]['id']},'attributes':[_0xd0fb('0x58'),_0xd0fb('0x59'),_0xd0fb('0x5d'),_0xd0fb('0x5e'),_0xd0fb('0x5f'),'defaultLoginLogo',_0xd0fb('0x61'),_0xd0fb('0x6e')],'raw':!![]});})[_0xd0fb('0x20')](handleEntityNotFound(_0x45221c,null))[_0xd0fb('0x20')](function(_0x58dea6){if(_0x58dea6){var _0xc1c841=_0x58dea6[_0xd0fb('0x59')]&&fs[_0xd0fb('0x69')](path[_0xd0fb('0x62')](config['root'],_0x21c399,_[_0xd0fb('0x64')](_0x58dea6['loginLogo'])))?path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x21c399,_[_0xd0fb('0x64')](_0x58dea6['loginLogo'])):path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x21c399,_[_0xd0fb('0x64')](_0xd0fb('0x6f')));var _0xa9c8ae='default'+_[_0xd0fb('0x67')](_0xd0fb('0x59'));if(_0x58dea6[_0xa9c8ae]||!_0xe7a6e2[_0xd0fb('0x68')]){_0xc1c841=path['join'](config[_0xd0fb('0x63')],_0x21c399,_['toLower'](_0xd0fb('0x6f')));}if(!fs['existsSync'](_0xc1c841)){throw new db[(_0xd0fb('0x1d'))][(_0xd0fb('0x1e'))](_[_0xd0fb('0x67')](_0xd0fb('0x59'))+_0xd0fb('0x6a'));}return _0x45221c[_0xd0fb('0x6b')](_0xc1c841);}})[_0xd0fb('0x4f')](handleError(_0x45221c,null));};exports[_0xd0fb('0x70')]=function(_0xc842f0,_0x14c5b8){return db[_0xd0fb('0x38')]['find']({'where':{'id':_0xc842f0[_0xd0fb('0x55')]['id']},'attributes':[_0xd0fb('0x71')]})[_0xd0fb('0x20')](respondWithResult(_0x14c5b8,null))[_0xd0fb('0x4f')](handleError(_0x14c5b8,null));};exports[_0xd0fb('0x72')]=function(_0x3b953b,_0x3e7c17,_0x3419ff){if(_0x3b953b[_0xd0fb('0x56')]&&_0x3b953b[_0xd0fb('0x56')][_0xd0fb('0x57')]){_0x3b953b[_0xd0fb('0x54')][_0xd0fb('0x5d')]=_0x3b953b[_0xd0fb('0x56')][_0xd0fb('0x57')];}return db[_0xd0fb('0x38')]['find']({'where':{'id':_0x3b953b[_0xd0fb('0x55')]['id']}})['then'](handleEntityNotFound(_0x3e7c17,null))[_0xd0fb('0x20')](saveUpdates(_0x3b953b['body'],null))[_0xd0fb('0x20')](respondWithResult(_0x3e7c17,null))[_0xd0fb('0x4f')](handleError(_0x3e7c17,null));};var utilLicense=require(_0xd0fb('0x5a'));exports['getPreferred']=function(_0x2f47ee,_0x346ea1,_0x4b67ac){var _0x557167=_0xd0fb('0x6d');var _0x4fc5dd={'custom':![]};return utilLicense[_0xd0fb('0x5c')]()[_0xd0fb('0x20')](function(_0x5f0823){if(_0x5f0823){_0x4fc5dd=_0x5f0823;}return db['Setting']['find']({'where':{'id':_0x2f47ee[_0xd0fb('0x55')]['id']},'attributes':['logo',_0xd0fb('0x59'),_0xd0fb('0x5d'),_0xd0fb('0x5e'),_0xd0fb('0x5f'),_0xd0fb('0x60'),_0xd0fb('0x61'),_0xd0fb('0x6e')],'raw':!![]});})[_0xd0fb('0x20')](handleEntityNotFound(_0x346ea1,null))[_0xd0fb('0x20')](function(_0x5430ad){if(_0x5430ad){var _0x3424d3=_0x5430ad[_0xd0fb('0x5d')]&&fs[_0xd0fb('0x69')](path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x557167,_[_0xd0fb('0x64')](_0x5430ad[_0xd0fb('0x5d')])))?path[_0xd0fb('0x62')](config['root'],_0x557167,_['toLower'](_0x5430ad['preferred'])):path['join'](config[_0xd0fb('0x63')],_0x557167,_['toLower'](_0xd0fb('0x73')));var _0xfc2052=_0xd0fb('0x66')+_[_0xd0fb('0x67')](_0xd0fb('0x5d'));if(_0x5430ad[_0xfc2052]||!_0x4fc5dd['custom']||!_0x4fc5dd[_0xd0fb('0x5d')]){_0x3424d3=path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x557167,_[_0xd0fb('0x64')](_0xd0fb('0x73')));}if(!fs[_0xd0fb('0x69')](_0x3424d3)){throw new db[(_0xd0fb('0x1d'))]['ValidationError'](_[_0xd0fb('0x67')](_0xd0fb('0x5d'))+_0xd0fb('0x6a'));}return _0x346ea1['download'](_0x3424d3);}})[_0xd0fb('0x4f')](handleError(_0x346ea1,null));};exports[_0xd0fb('0x74')]=function(_0x2a755f,_0x419116,_0x2346d0){if(_0x2a755f[_0xd0fb('0x56')]&&_0x2a755f[_0xd0fb('0x56')][_0xd0fb('0x57')]){_0x2a755f[_0xd0fb('0x54')]['favicon']=_0x2a755f['file'][_0xd0fb('0x57')];}return db['Setting'][_0xd0fb('0x53')]({'where':{'id':_0x2a755f[_0xd0fb('0x55')]['id']}})[_0xd0fb('0x20')](handleEntityNotFound(_0x419116,null))['then'](saveUpdates(_0x2a755f[_0xd0fb('0x54')],null))[_0xd0fb('0x20')](respondWithResult(_0x419116,null))[_0xd0fb('0x4f')](handleError(_0x419116,null));};var utilLicense=require(_0xd0fb('0x5a'));exports['getFavicon']=function(_0x5e3bc7,_0x4a9a8b,_0x5dd350){var _0x5596b4='server/files/images/logos';var _0x26a62c={'custom':![]};return utilLicense[_0xd0fb('0x5c')]()['then'](function(_0x50f585){if(_0x50f585){_0x26a62c=_0x50f585;}return db[_0xd0fb('0x38')][_0xd0fb('0x53')]({'where':{'id':_0x5e3bc7[_0xd0fb('0x55')]['id']},'attributes':['logo',_0xd0fb('0x59'),_0xd0fb('0x5d'),_0xd0fb('0x5e'),_0xd0fb('0x5f'),'defaultLoginLogo',_0xd0fb('0x61'),_0xd0fb('0x6e')],'raw':!![]});})[_0xd0fb('0x20')](handleEntityNotFound(_0x4a9a8b,null))['then'](function(_0x53a824){if(_0x53a824){var _0x3b156b=_0x53a824[_0xd0fb('0x5e')]&&fs['existsSync'](path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x5596b4,_[_0xd0fb('0x64')](_0x53a824[_0xd0fb('0x5e')])))?path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x5596b4,_[_0xd0fb('0x64')](_0x53a824[_0xd0fb('0x5e')])):path['join'](config['root'],_0x5596b4,_[_0xd0fb('0x64')](_0xd0fb('0x75')));var _0x2b86e4=_0xd0fb('0x66')+_[_0xd0fb('0x67')](_0xd0fb('0x5e'));if(_0x53a824[_0x2b86e4]||!_0x26a62c['custom']){_0x3b156b=path[_0xd0fb('0x62')](config[_0xd0fb('0x63')],_0x5596b4,_[_0xd0fb('0x64')](_0xd0fb('0x75')));}if(!fs['existsSync'](_0x3b156b)){throw new db['Sequelize'][(_0xd0fb('0x1e'))](_[_0xd0fb('0x67')](_0xd0fb('0x5e'))+'\x20not\x20found');}return _0x4a9a8b[_0xd0fb('0x6b')](_0x3b156b);}})[_0xd0fb('0x4f')](handleError(_0x4a9a8b,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ec93ac3..2e868a9 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 _0xfd8a=['util','api','moment','bluebird','rimraf','../../config/environment','./setting.attributes','Setting','lodash'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xfd8a,0x74));var _0xafd8=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0xfd8a[_0x2bfe52];return _0x1cf649;};'use strict';var _=require(_0xafd8('0x0'));var util=require(_0xafd8('0x1'));var logger=require('../../config/logger')(_0xafd8('0x2'));var moment=require(_0xafd8('0x3'));var BPromise=require(_0xafd8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xafd8('0x5'));var config=require(_0xafd8('0x6'));var attributes=require(_0xafd8('0x7'));module['exports']=function(_0x2ae027,_0xeaba4d){return _0x2ae027['define'](_0xafd8('0x8'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d8b=['rimraf','../../config/environment','./setting.attributes','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x1c7f5a,_0x4bd7c7){var _0xca6269=function(_0xdf406b){while(--_0xdf406b){_0x1c7f5a['push'](_0x1c7f5a['shift']());}};_0xca6269(++_0x4bd7c7);}(_0x6d8b,0x156));var _0xb6d8=function(_0x3126af,_0x1486cb){_0x3126af=_0x3126af-0x0;var _0x97340c=_0x6d8b[_0x3126af];return _0x97340c;};'use strict';var _=require(_0xb6d8('0x0'));var util=require('util');var logger=require(_0xb6d8('0x1'))(_0xb6d8('0x2'));var moment=require(_0xb6d8('0x3'));var BPromise=require(_0xb6d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6d8('0x5'));var rimraf=require(_0xb6d8('0x6'));var config=require(_0xb6d8('0x7'));var attributes=require(_0xb6d8('0x8'));module['exports']=function(_0x140acf,_0x341dc9){return _0x140acf[_0xb6d8('0x9')](_0xb6d8('0xa'),attributes,{'tableName':_0xb6d8('0xb'),'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 8a3c049..55b7f4f 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 _0xeeed=['code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x4f152f,_0xf0569f){var _0x16b76b=function(_0x2eec29){while(--_0x2eec29){_0x4f152f['push'](_0x4f152f['shift']());}};_0x16b76b(++_0xf0569f);}(_0xeeed,0x93));var _0xdeee=function(_0x31906e,_0x415d76){_0x31906e=_0x31906e-0x0;var _0x20be34=_0xeeed[_0x31906e];return _0x20be34;};'use strict';var _=require(_0xdeee('0x0'));var util=require('util');var moment=require(_0xdeee('0x1'));var BPromise=require('bluebird');var rs=require(_0xdeee('0x2'));var fs=require('fs');var Redis=require(_0xdeee('0x3'));var db=require(_0xdeee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdeee('0x5'))(_0xdeee('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdeee('0x7')][_0xdeee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9b6719,_0xc8d54a,_0x2c6ec9){return new BPromise(function(_0x162215,_0x2370a7){return client['request'](_0x9b6719,_0x2c6ec9)[_0xdeee('0x9')](function(_0x3c0710){logger[_0xdeee('0xa')](_0xdeee('0xb'),_0xc8d54a,'request\x20sent');logger[_0xdeee('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0xc8d54a,_0xdeee('0xd'),JSON['stringify'](_0x3c0710));if(_0x3c0710[_0xdeee('0xe')]){if(_0x3c0710['error'][_0xdeee('0xf')]===0x1f4){logger[_0xdeee('0xe')](_0xdeee('0xb'),_0xc8d54a,_0x3c0710[_0xdeee('0xe')][_0xdeee('0x10')]);return _0x2370a7(_0x3c0710['error'][_0xdeee('0x10')]);}logger[_0xdeee('0xe')]('Setting,\x20%s,\x20%s',_0xc8d54a,_0x3c0710[_0xdeee('0xe')][_0xdeee('0x10')]);return _0x162215(_0x3c0710[_0xdeee('0xe')]['message']);}else{logger[_0xdeee('0xa')](_0xdeee('0xb'),_0xc8d54a,'request\x20sent');_0x162215(_0x3c0710['result'][_0xdeee('0x10')]);}})[_0xdeee('0x11')](function(_0x30b350){logger[_0xdeee('0xe')](_0xdeee('0xb'),_0xc8d54a,_0x30b350);_0x2370a7(_0x30b350);});});} \ No newline at end of file +var _0x1b5a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0x1b5a,0x125));var _0xa1b5=function(_0x19d2ce,_0x39490a){_0x19d2ce=_0x19d2ce-0x0;var _0x38a263=_0x1b5a[_0x19d2ce];return _0x38a263;};'use strict';var _=require(_0xa1b5('0x0'));var util=require(_0xa1b5('0x1'));var moment=require('moment');var BPromise=require(_0xa1b5('0x2'));var rs=require(_0xa1b5('0x3'));var fs=require('fs');var Redis=require(_0xa1b5('0x4'));var db=require(_0xa1b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1b5('0x6'))(_0xa1b5('0x7'));var config=require(_0xa1b5('0x8'));var jayson=require(_0xa1b5('0x9'));var client=jayson[_0xa1b5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbf464,_0x305002,_0x1ef83b){return new BPromise(function(_0x159bc0,_0x560e8e){return client[_0xa1b5('0xb')](_0xbf464,_0x1ef83b)[_0xa1b5('0xc')](function(_0x1d2635){logger[_0xa1b5('0xd')](_0xa1b5('0xe'),_0x305002,'request\x20sent');logger[_0xa1b5('0xf')](_0xa1b5('0x10'),_0x305002,_0xa1b5('0x11'),JSON['stringify'](_0x1d2635));if(_0x1d2635[_0xa1b5('0x12')]){if(_0x1d2635[_0xa1b5('0x12')][_0xa1b5('0x13')]===0x1f4){logger[_0xa1b5('0x12')](_0xa1b5('0xe'),_0x305002,_0x1d2635['error'][_0xa1b5('0x14')]);return _0x560e8e(_0x1d2635[_0xa1b5('0x12')][_0xa1b5('0x14')]);}logger['error'](_0xa1b5('0xe'),_0x305002,_0x1d2635[_0xa1b5('0x12')][_0xa1b5('0x14')]);return _0x159bc0(_0x1d2635[_0xa1b5('0x12')]['message']);}else{logger['info'](_0xa1b5('0xe'),_0x305002,_0xa1b5('0x11'));_0x159bc0(_0x1d2635[_0xa1b5('0x15')][_0xa1b5('0x14')]);}})[_0xa1b5('0x16')](function(_0x3137fe){logger['error']('Setting,\x20%s,\x20%s',_0x305002,_0x3137fe);_0x560e8e(_0x3137fe);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 215e8a0..5493880 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 _0x6b09=['get','isAuthenticated','describe','show','/:id/dispositions','getAnswers','/:id/applications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','put','/:id','update','delete','removeAnswers','removeAgents','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','index'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0x6b09,0xe1));var _0x96b0=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0x6b09[_0x3792e6];return _0x441e44;};'use strict';var multer=require(_0x96b0('0x0'));var util=require('util');var path=require(_0x96b0('0x1'));var timeout=require(_0x96b0('0x2'));var express=require('express');var router=express[_0x96b0('0x3')]();var auth=require(_0x96b0('0x4'));var interaction=require(_0x96b0('0x5'));var config=require(_0x96b0('0x6'));var controller=require(_0x96b0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x96b0('0x8')]);router[_0x96b0('0x9')]('/describe',auth[_0x96b0('0xa')](),controller[_0x96b0('0xb')]);router['get']('/:id',auth[_0x96b0('0xa')](),controller[_0x96b0('0xc')]);router['get'](_0x96b0('0xd'),auth[_0x96b0('0xa')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0x96b0('0xa')](),controller[_0x96b0('0xe')]);router[_0x96b0('0x9')](_0x96b0('0xf'),auth[_0x96b0('0xa')](),controller['getApplications']);router[_0x96b0('0x9')](_0x96b0('0x10'),auth[_0x96b0('0xa')](),controller['getInteractions']);router['get'](_0x96b0('0x11'),controller[_0x96b0('0x12')]);router['get'](_0x96b0('0x13'),auth[_0x96b0('0xa')](),controller[_0x96b0('0x14')]);router[_0x96b0('0x15')]('/',auth['isAuthenticated'](),controller[_0x96b0('0x16')]);router[_0x96b0('0x15')](_0x96b0('0xd'),auth[_0x96b0('0xa')](),controller[_0x96b0('0x17')]);router[_0x96b0('0x15')](_0x96b0('0x18'),auth[_0x96b0('0xa')](),controller[_0x96b0('0x19')]);router[_0x96b0('0x15')](_0x96b0('0x1a'),controller[_0x96b0('0x1b')]);router[_0x96b0('0x15')]('/:id/applications',auth[_0x96b0('0xa')](),controller[_0x96b0('0x1c')]);router[_0x96b0('0x15')](_0x96b0('0x1d'),auth[_0x96b0('0xa')](),controller[_0x96b0('0x1e')]);router['post'](_0x96b0('0x11'),controller[_0x96b0('0x1f')]);router[_0x96b0('0x15')](_0x96b0('0x13'),auth[_0x96b0('0xa')](),controller[_0x96b0('0x20')]);router[_0x96b0('0x21')](_0x96b0('0x22'),auth[_0x96b0('0xa')](),controller[_0x96b0('0x23')]);router[_0x96b0('0x24')](_0x96b0('0x22'),auth[_0x96b0('0xa')](),controller['destroy']);router[_0x96b0('0x24')](_0x96b0('0xd'),auth[_0x96b0('0xa')](),controller['removeDispositions']);router['delete'](_0x96b0('0x18'),auth['isAuthenticated'](),controller[_0x96b0('0x25')]);router[_0x96b0('0x24')](_0x96b0('0x13'),auth['isAuthenticated'](),controller[_0x96b0('0x26')]);module['exports']=router; \ No newline at end of file +var _0x3980=['/:id/interactions','getInteractions','statusGet','/:id/users','getAgents','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','send','/:id/status','status','addAgents','put','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','../../components/auth/service','./smsAccount.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x3980,0xf3));var _0x0398=function(_0x27aaf2,_0x586ec1){_0x27aaf2=_0x27aaf2-0x0;var _0x14c15c=_0x3980[_0x27aaf2];return _0x14c15c;};'use strict';var multer=require(_0x0398('0x0'));var util=require(_0x0398('0x1'));var path=require(_0x0398('0x2'));var timeout=require('connect-timeout');var express=require(_0x0398('0x3'));var router=express[_0x0398('0x4')]();var auth=require(_0x0398('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0398('0x6'));router[_0x0398('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0398('0x7')](_0x0398('0x8'),auth['isAuthenticated'](),controller[_0x0398('0x9')]);router[_0x0398('0x7')](_0x0398('0xa'),auth[_0x0398('0xb')](),controller[_0x0398('0xc')]);router[_0x0398('0x7')]('/:id/dispositions',auth[_0x0398('0xb')](),controller['getDispositions']);router[_0x0398('0x7')](_0x0398('0xd'),auth[_0x0398('0xb')](),controller[_0x0398('0xe')]);router[_0x0398('0x7')](_0x0398('0xf'),auth[_0x0398('0xb')](),controller['getApplications']);router['get'](_0x0398('0x10'),auth['isAuthenticated'](),controller[_0x0398('0x11')]);router[_0x0398('0x7')]('/:id/status',controller[_0x0398('0x12')]);router['get'](_0x0398('0x13'),auth[_0x0398('0xb')](),controller[_0x0398('0x14')]);router[_0x0398('0x15')]('/',auth[_0x0398('0xb')](),controller['create']);router[_0x0398('0x15')](_0x0398('0x16'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x0398('0xd'),auth['isAuthenticated'](),controller[_0x0398('0x17')]);router[_0x0398('0x15')](_0x0398('0x18'),controller[_0x0398('0x19')]);router[_0x0398('0x15')](_0x0398('0xf'),auth['isAuthenticated'](),controller[_0x0398('0x1a')]);router[_0x0398('0x15')]('/:id/send',auth['isAuthenticated'](),controller[_0x0398('0x1b')]);router[_0x0398('0x15')](_0x0398('0x1c'),controller[_0x0398('0x1d')]);router[_0x0398('0x15')](_0x0398('0x13'),auth[_0x0398('0xb')](),controller[_0x0398('0x1e')]);router[_0x0398('0x1f')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0398('0x20')](_0x0398('0xa'),auth[_0x0398('0xb')](),controller[_0x0398('0x21')]);router[_0x0398('0x20')](_0x0398('0x16'),auth['isAuthenticated'](),controller[_0x0398('0x22')]);router['delete'](_0x0398('0xd'),auth[_0x0398('0xb')](),controller[_0x0398('0x23')]);router['delete'](_0x0398('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x0398('0x24')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 624e073..893b1f8 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 _0x1e6a=['ENUM','twilio','skebby','connectel','plivo','clickatell','intelepeer','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','sequelize','randomstring','exports','STRING','generate'];(function(_0x1586c8,_0x31d4d8){var _0x13f487=function(_0x25ab3a){while(--_0x25ab3a){_0x1586c8['push'](_0x1586c8['shift']());}};_0x13f487(++_0x31d4d8);}(_0x1e6a,0x163));var _0xa1e6=function(_0x271b8a,_0x3ae3eb){_0x271b8a=_0x271b8a-0x0;var _0x1697db=_0x1e6a[_0x271b8a];return _0x1697db;};'use strict';var Sequelize=require(_0xa1e6('0x0'));var rs=require(_0xa1e6('0x1'));module[_0xa1e6('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xa1e6('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xa1e6('0x3')],'defaultValue':function(){return rs[_0xa1e6('0x4')]();}},'phone':{'type':Sequelize[_0xa1e6('0x3')]},'type':{'type':Sequelize[_0xa1e6('0x5')](_0xa1e6('0x6'),_0xa1e6('0x7'),_0xa1e6('0x8'),'clicksend',_0xa1e6('0x9'),_0xa1e6('0xa'),'csc','infobip',_0xa1e6('0xb'))},'accountSid':{'type':Sequelize[_0xa1e6('0x3')]},'authId':{'type':Sequelize[_0xa1e6('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xa1e6('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa1e6('0x3')]},'password':{'type':Sequelize[_0xa1e6('0x3')]},'apiKey':{'type':Sequelize[_0xa1e6('0x3')]},'senderString':{'type':Sequelize[_0xa1e6('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa1e6('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa1e6('0xc')],'defaultValue':function(){return _0xa1e6('0xd');}},'notificationSound':{'type':Sequelize[_0xa1e6('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa1e6('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa1e6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa1e6('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa1e6('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa1e6('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa1e6('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa1e6('0xf')],'comment':_0xa1e6('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xa1e6('0xe')],'defaultValue':![],'comment':_0xa1e6('0x11'),'set':function(_0x564a05){if(!_0x564a05)this[_0xa1e6('0x12')](_0xa1e6('0x13'),null);this[_0xa1e6('0x12')]('mandatoryDisposition',_0x564a05);}}}; \ No newline at end of file +var _0xf181=['skebby','clicksend','plivo','csc','infobip','ENUM','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','twilio'];(function(_0x4762a8,_0x4d5cfe){var _0x436955=function(_0x7291fe){while(--_0x7291fe){_0x4762a8['push'](_0x4762a8['shift']());}};_0x436955(++_0x4d5cfe);}(_0xf181,0x6c));var _0x1f18=function(_0x50696d,_0xa93340){_0x50696d=_0x50696d-0x0;var _0x2449c2=_0xf181[_0x50696d];return _0x2449c2;};'use strict';var Sequelize=require(_0x1f18('0x0'));var rs=require(_0x1f18('0x1'));module[_0x1f18('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x1f18('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x1f18('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x1f18('0x3')],'defaultValue':function(){return rs[_0x1f18('0x4')]();}},'phone':{'type':Sequelize[_0x1f18('0x3')]},'type':{'type':Sequelize['ENUM'](_0x1f18('0x5'),_0x1f18('0x6'),'connectel',_0x1f18('0x7'),_0x1f18('0x8'),'clickatell',_0x1f18('0x9'),_0x1f18('0xa'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x1f18('0x3')]},'authToken':{'type':Sequelize[_0x1f18('0x3')]},'smsMethod':{'type':Sequelize[_0x1f18('0xb')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1f18('0x3')]},'apiKey':{'type':Sequelize[_0x1f18('0x3')]},'senderString':{'type':Sequelize[_0x1f18('0x3')]},'deliveryReport':{'type':Sequelize[_0x1f18('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x1f18('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1f18('0xd');}},'notificationSound':{'type':Sequelize[_0x1f18('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1f18('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1f18('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1f18('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1f18('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1f18('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1f18('0xf'),'set':function(_0x39db09){if(!_0x39db09)this[_0x1f18('0x10')](_0x1f18('0x11'),null);this[_0x1f18('0x10')](_0x1f18('0x12'),_0x39db09);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 36997da..c74f174 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(_0x364d99,_0x25a352){var _0x21d5ec=function(_0x37ac8b){while(--_0x37ac8b){_0x364d99['push'](_0x364d99['shift']());}};_0x21d5ec(++_0x25a352);}(_0x7a54,0x106));var _0x47a5=function(_0x34d2c0,_0x3680fe){_0x34d2c0=_0x34d2c0-0x0;var _0x153244=_0x7a54[_0x34d2c0];return _0x153244;};'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 _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x3a73bc,_0x550aef){var _0x32891b=function(_0x20b4cb){while(--_0x20b4cb){_0x3a73bc['push'](_0x3a73bc['shift']());}};_0x32891b(++_0x550aef);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('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 _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index f233d1c..c90e8b0 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 _0x949c=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x949c,0x19b));var _0xc949=function(_0x37b003,_0x330b7a){_0x37b003=_0x37b003-0x0;var _0x1cb93a=_0x949c[_0x37b003];return _0x1cb93a;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xc949('0x0'))['db'][_0xc949('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xc949('0x2')](0x0);var events={'afterCreate':_0xc949('0x3'),'afterUpdate':_0xc949('0x4'),'afterDestroy':_0xc949('0x5')};function emitEvent(_0x204446){return function(_0x356d28,_0x4a7afa,_0x4aa5f7){SmsAccountEvents[_0xc949('0x6')](_0x204446+':'+_0x356d28['id'],_0x356d28);SmsAccountEvents[_0xc949('0x6')](_0x204446,_0x356d28);_0x4aa5f7(null);};}for(var e in events){if(events[_0xc949('0x7')](e)){var event=events[e];SmsAccount[_0xc949('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x1196=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x26e39b,_0x3195a5){var _0x33f2c3=function(_0xdf6431){while(--_0xdf6431){_0x26e39b['push'](_0x26e39b['shift']());}};_0x33f2c3(++_0x3195a5);}(_0x1196,0x173));var _0x6119=function(_0x210d9e,_0x450d25){_0x210d9e=_0x210d9e-0x0;var _0x36f7fc=_0x1196[_0x210d9e];return _0x36f7fc;};'use strict';var EventEmitter=require(_0x6119('0x0'));var SmsAccount=require(_0x6119('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6119('0x2')](0x0);var events={'afterCreate':_0x6119('0x3'),'afterUpdate':_0x6119('0x4'),'afterDestroy':'remove'};function emitEvent(_0x18cde4){return function(_0x3f3192,_0x211d73,_0x4ecc78){SmsAccountEvents[_0x6119('0x5')](_0x18cde4+':'+_0x3f3192['id'],_0x3f3192);SmsAccountEvents[_0x6119('0x5')](_0x18cde4,_0x3f3192);_0x4ecc78(null);};}for(var e in events){if(events[_0x6119('0x6')](e)){var event=events[e];SmsAccount[_0x6119('0x7')](e,emitEvent(event));}}module[_0x6119('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 68d2b6f..ce43fda 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(_0x111cb5,_0x1ccd05){var _0x34f5fe=function(_0x82bc79){while(--_0x82bc79){_0x111cb5['push'](_0x111cb5['shift']());}};_0x34f5fe(++_0x1ccd05);}(_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':'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(_0x164e8a,_0x55c331){var _0x3eb716=function(_0x352563){while(--_0x352563){_0x164e8a['push'](_0x164e8a['shift']());}};_0x3eb716(++_0x55c331);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 a44f8ce..d8799ac 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 _0xdd7f=['message','result','find','options','raw','where','attributes','map','include','model','then','ShowSmsAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsAccount,\x20%s,\x20%s'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xdd7f,0x1a3));var _0xfdd7=function(_0x2872e0,_0x33e460){_0x2872e0=_0x2872e0-0x0;var _0x16fd85=_0xdd7f[_0x2872e0];return _0x16fd85;};'use strict';var _=require('lodash');var util=require(_0xfdd7('0x0'));var moment=require('moment');var BPromise=require(_0xfdd7('0x1'));var rs=require(_0xfdd7('0x2'));var fs=require('fs');var Redis=require(_0xfdd7('0x3'));var db=require(_0xfdd7('0x4'))['db'];var utils=require(_0xfdd7('0x5'));var logger=require(_0xfdd7('0x6'))('rpc');var config=require(_0xfdd7('0x7'));var jayson=require(_0xfdd7('0x8'));var client=jayson[_0xfdd7('0x9')][_0xfdd7('0xa')]({'port':0x232a});config[_0xfdd7('0xb')]=_[_0xfdd7('0xc')](config[_0xfdd7('0xb')],{'host':_0xfdd7('0xd'),'port':0x18eb});var socket=require(_0xfdd7('0xe'))(new Redis(config['redis']));require(_0xfdd7('0xf'))[_0xfdd7('0x10')](socket);function respondWithRpcPromise(_0x1d1a49,_0x5f4b2a,_0x257eae){return new BPromise(function(_0x4f4d7b,_0x46a959){return client[_0xfdd7('0x11')](_0x1d1a49,_0x257eae)['then'](function(_0x4339d1){logger[_0xfdd7('0x12')]('SmsAccount,\x20%s,\x20%s',_0x5f4b2a,'request\x20sent');logger[_0xfdd7('0x13')](_0xfdd7('0x14'),_0x5f4b2a,_0xfdd7('0x15'),JSON[_0xfdd7('0x16')](_0x4339d1));if(_0x4339d1[_0xfdd7('0x17')]){if(_0x4339d1[_0xfdd7('0x17')]['code']===0x1f4){logger['error'](_0xfdd7('0x18'),_0x5f4b2a,_0x4339d1[_0xfdd7('0x17')][_0xfdd7('0x19')]);return _0x46a959(_0x4339d1[_0xfdd7('0x17')][_0xfdd7('0x19')]);}logger[_0xfdd7('0x17')]('SmsAccount,\x20%s,\x20%s',_0x5f4b2a,_0x4339d1[_0xfdd7('0x17')][_0xfdd7('0x19')]);return _0x4f4d7b(_0x4339d1[_0xfdd7('0x17')][_0xfdd7('0x19')]);}else{logger[_0xfdd7('0x12')](_0xfdd7('0x18'),_0x5f4b2a,'request\x20sent');_0x4f4d7b(_0x4339d1[_0xfdd7('0x1a')][_0xfdd7('0x19')]);}})['catch'](function(_0x3c09be){logger[_0xfdd7('0x17')]('SmsAccount,\x20%s,\x20%s',_0x5f4b2a,_0x3c09be);_0x46a959(_0x3c09be);});});}exports['ShowSmsAccount']=function(_0x5e9658){var _0x2b7fbf=this;return new Promise(function(_0x1319cb,_0x464054){return db['SmsAccount'][_0xfdd7('0x1b')]({'raw':_0x5e9658[_0xfdd7('0x1c')]?_0x5e9658[_0xfdd7('0x1c')][_0xfdd7('0x1d')]===undefined?!![]:![]:!![],'where':_0x5e9658[_0xfdd7('0x1c')]?_0x5e9658[_0xfdd7('0x1c')][_0xfdd7('0x1e')]||null:null,'attributes':_0x5e9658[_0xfdd7('0x1c')]?_0x5e9658[_0xfdd7('0x1c')][_0xfdd7('0x1f')]||null:null,'include':_0x5e9658[_0xfdd7('0x1c')]?_0x5e9658['options']['include']?_[_0xfdd7('0x20')](_0x5e9658[_0xfdd7('0x1c')][_0xfdd7('0x21')],function(_0x3e9fbc){return{'model':db[_0x3e9fbc[_0xfdd7('0x22')]],'as':_0x3e9fbc['as'],'attributes':_0x3e9fbc[_0xfdd7('0x1f')],'include':_0x3e9fbc[_0xfdd7('0x21')]?_['map'](_0x3e9fbc[_0xfdd7('0x21')],function(_0x346023){return{'model':db[_0x346023[_0xfdd7('0x22')]],'as':_0x346023['as'],'attributes':_0x346023['attributes'],'include':_0x346023[_0xfdd7('0x21')]?_[_0xfdd7('0x20')](_0x346023[_0xfdd7('0x21')],function(_0x51b765){return{'model':db[_0x51b765[_0xfdd7('0x22')]],'as':_0x51b765['as'],'attributes':_0x51b765[_0xfdd7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfdd7('0x23')](function(_0x43d814){logger['info'](_0xfdd7('0x24'),_0x5e9658);logger[_0xfdd7('0x13')]('ShowSmsAccount',_0x5e9658,JSON[_0xfdd7('0x16')](_0x43d814));_0x1319cb(_0x43d814);})['catch'](function(_0x29ffb3){logger[_0xfdd7('0x17')](_0xfdd7('0x24'),_0x29ffb3[_0xfdd7('0x19')],_0x5e9658);_0x464054(_0x2b7fbf['error'](0x1f4,_0x29ffb3['message']));});});}; \ No newline at end of file +var _0x4872=['./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','SmsAccount','find','options','attributes','map','include','model','ShowSmsAccount','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter'];(function(_0x58cde7,_0x4fb3af){var _0x25d6d7=function(_0x236394){while(--_0x236394){_0x58cde7['push'](_0x58cde7['shift']());}};_0x25d6d7(++_0x4fb3af);}(_0x4872,0x1f0));var _0x2487=function(_0xf48d27,_0xc761af){_0xf48d27=_0xf48d27-0x0;var _0x172722=_0x4872[_0xf48d27];return _0x172722;};'use strict';var _=require(_0x2487('0x0'));var util=require(_0x2487('0x1'));var moment=require(_0x2487('0x2'));var BPromise=require('bluebird');var rs=require(_0x2487('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2487('0x4'))['db'];var utils=require(_0x2487('0x5'));var logger=require(_0x2487('0x6'))(_0x2487('0x7'));var config=require(_0x2487('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2487('0x9')][_0x2487('0xa')]({'port':0x232a});config[_0x2487('0xb')]=_[_0x2487('0xc')](config[_0x2487('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2487('0xd'))(new Redis(config[_0x2487('0xb')]));require(_0x2487('0xe'))['register'](socket);function respondWithRpcPromise(_0x379485,_0x3b243f,_0x23849f){return new BPromise(function(_0x27b472,_0x356e24){return client[_0x2487('0xf')](_0x379485,_0x23849f)[_0x2487('0x10')](function(_0x23e679){logger[_0x2487('0x11')](_0x2487('0x12'),_0x3b243f,_0x2487('0x13'));logger[_0x2487('0x14')](_0x2487('0x15'),_0x3b243f,_0x2487('0x13'),JSON['stringify'](_0x23e679));if(_0x23e679[_0x2487('0x16')]){if(_0x23e679[_0x2487('0x16')]['code']===0x1f4){logger[_0x2487('0x16')](_0x2487('0x12'),_0x3b243f,_0x23e679['error'][_0x2487('0x17')]);return _0x356e24(_0x23e679[_0x2487('0x16')]['message']);}logger['error'](_0x2487('0x12'),_0x3b243f,_0x23e679[_0x2487('0x16')]['message']);return _0x27b472(_0x23e679['error'][_0x2487('0x17')]);}else{logger[_0x2487('0x11')](_0x2487('0x12'),_0x3b243f,'request\x20sent');_0x27b472(_0x23e679[_0x2487('0x18')][_0x2487('0x17')]);}})['catch'](function(_0x46cbf1){logger['error'](_0x2487('0x12'),_0x3b243f,_0x46cbf1);_0x356e24(_0x46cbf1);});});}exports['ShowSmsAccount']=function(_0x3cf922){var _0x29120a=this;return new Promise(function(_0x52f097,_0x2f620b){return db[_0x2487('0x19')][_0x2487('0x1a')]({'raw':_0x3cf922['options']?_0x3cf922['options']['raw']===undefined?!![]:![]:!![],'where':_0x3cf922[_0x2487('0x1b')]?_0x3cf922['options']['where']||null:null,'attributes':_0x3cf922[_0x2487('0x1b')]?_0x3cf922[_0x2487('0x1b')][_0x2487('0x1c')]||null:null,'include':_0x3cf922[_0x2487('0x1b')]?_0x3cf922[_0x2487('0x1b')]['include']?_[_0x2487('0x1d')](_0x3cf922[_0x2487('0x1b')][_0x2487('0x1e')],function(_0x1895a5){return{'model':db[_0x1895a5[_0x2487('0x1f')]],'as':_0x1895a5['as'],'attributes':_0x1895a5['attributes'],'include':_0x1895a5[_0x2487('0x1e')]?_[_0x2487('0x1d')](_0x1895a5[_0x2487('0x1e')],function(_0x1a9995){return{'model':db[_0x1a9995[_0x2487('0x1f')]],'as':_0x1a9995['as'],'attributes':_0x1a9995['attributes'],'include':_0x1a9995[_0x2487('0x1e')]?_[_0x2487('0x1d')](_0x1a9995[_0x2487('0x1e')],function(_0x1268dd){return{'model':db[_0x1268dd['model']],'as':_0x1268dd['as'],'attributes':_0x1268dd[_0x2487('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2487('0x10')](function(_0x367af6){logger[_0x2487('0x11')](_0x2487('0x20'),_0x3cf922);logger['debug']('ShowSmsAccount',_0x3cf922,JSON['stringify'](_0x367af6));_0x52f097(_0x367af6);})[_0x2487('0x21')](function(_0x335d94){logger[_0x2487('0x16')](_0x2487('0x20'),_0x335d94[_0x2487('0x17')],_0x3cf922);_0x2f620b(_0x29120a[_0x2487('0x16')](0x1f4,_0x335d94[_0x2487('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 93d73d5..2c1fd6b 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 _0x9e0d=['emit','length','./smsAccount.events','save','remove','update'];(function(_0x4ef235,_0x485f12){var _0x39996f=function(_0x3d0e02){while(--_0x3d0e02){_0x4ef235['push'](_0x4ef235['shift']());}};_0x39996f(++_0x485f12);}(_0x9e0d,0xf8));var _0xd9e0=function(_0x2b78e5,_0x3126f8){_0x2b78e5=_0x2b78e5-0x0;var _0xa8d52d=_0x9e0d[_0x2b78e5];return _0xa8d52d;};'use strict';var SmsAccountEvents=require(_0xd9e0('0x0'));var events=[_0xd9e0('0x1'),_0xd9e0('0x2'),_0xd9e0('0x3')];function createListener(_0x3a6544,_0x20914e){return function(_0x1e11be){_0x20914e[_0xd9e0('0x4')](_0x3a6544,_0x1e11be);};}function removeListener(_0x3e20bb,_0x275a3b){return function(){SmsAccountEvents['removeListener'](_0x3e20bb,_0x275a3b);};}exports['register']=function(_0x25381e){for(var _0x4560a0=0x0,_0x659b86=events[_0xd9e0('0x5')];_0x4560a0<_0x659b86;_0x4560a0++){var _0x3ef9cd=events[_0x4560a0];var _0x1d39ab=createListener('smsAccount:'+_0x3ef9cd,_0x25381e);SmsAccountEvents['on'](_0x3ef9cd,_0x1d39ab);}}; \ No newline at end of file +var _0x783c=['update','./smsAccount.events','remove'];(function(_0x39b4b2,_0x1573fb){var _0x515bff=function(_0x5b9f6e){while(--_0x5b9f6e){_0x39b4b2['push'](_0x39b4b2['shift']());}};_0x515bff(++_0x1573fb);}(_0x783c,0xaf));var _0xc783=function(_0x39f6c5,_0x3c28d9){_0x39f6c5=_0x39f6c5-0x0;var _0x200953=_0x783c[_0x39f6c5];return _0x200953;};'use strict';var SmsAccountEvents=require(_0xc783('0x0'));var events=['save',_0xc783('0x1'),_0xc783('0x2')];function createListener(_0x2ae078,_0x5ed5e1){return function(_0x215704){_0x5ed5e1['emit'](_0x2ae078,_0x215704);};}function removeListener(_0x19d54f,_0x3a9330){return function(){SmsAccountEvents['removeListener'](_0x19d54f,_0x3a9330);};}exports['register']=function(_0x547328){for(var _0x39731f=0x0,_0x4f8d2d=events['length'];_0x39731f<_0x4f8d2d;_0x39731f++){var _0x62cf50=events[_0x39731f];var _0x2ad159=createListener('smsAccount:'+_0x62cf50,_0x547328);SmsAccountEvents['on'](_0x62cf50,_0x2ad159);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index f3424ad..851ff4c 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 _0xda45=['get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller'];(function(_0x4b18e3,_0x48cac8){var _0x2ec7fd=function(_0x48d1f8){while(--_0x48d1f8){_0x4b18e3['push'](_0x4b18e3['shift']());}};_0x2ec7fd(++_0x48cac8);}(_0xda45,0xe6));var _0x5da4=function(_0x20f731,_0x19f74a){_0x20f731=_0x20f731-0x0;var _0x5afe0c=_0xda45[_0x20f731];return _0x5afe0c;};'use strict';var multer=require(_0x5da4('0x0'));var util=require('util');var path=require(_0x5da4('0x1'));var timeout=require(_0x5da4('0x2'));var express=require('express');var router=express[_0x5da4('0x3')]();var auth=require(_0x5da4('0x4'));var interaction=require(_0x5da4('0x5'));var config=require(_0x5da4('0x6'));var controller=require(_0x5da4('0x7'));router[_0x5da4('0x8')]('/',auth[_0x5da4('0x9')](),controller[_0x5da4('0xa')]);router[_0x5da4('0x8')](_0x5da4('0xb'),auth[_0x5da4('0x9')](),controller[_0x5da4('0xc')]);router['post']('/',auth[_0x5da4('0x9')](),controller['create']);router[_0x5da4('0xd')]('/:id',auth[_0x5da4('0x9')](),controller['update']);router[_0x5da4('0xe')](_0x5da4('0xb'),auth[_0x5da4('0x9')](),controller[_0x5da4('0xf')]);module[_0x5da4('0x10')]=router; \ No newline at end of file +var _0x07a4=['put','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x281056,_0x3cae15){var _0x3c3112=function(_0x241500){while(--_0x241500){_0x281056['push'](_0x281056['shift']());}};_0x3c3112(++_0x3cae15);}(_0x07a4,0xac));var _0x407a=function(_0x3447d4,_0x41f025){_0x3447d4=_0x3447d4-0x0;var _0xa921fd=_0x07a4[_0x3447d4];return _0xa921fd;};'use strict';var multer=require(_0x407a('0x0'));var util=require(_0x407a('0x1'));var path=require(_0x407a('0x2'));var timeout=require(_0x407a('0x3'));var express=require(_0x407a('0x4'));var router=express[_0x407a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x407a('0x6'));var config=require(_0x407a('0x7'));var controller=require('./smsApplication.controller');router[_0x407a('0x8')]('/',auth['isAuthenticated'](),controller[_0x407a('0x9')]);router[_0x407a('0x8')](_0x407a('0xa'),auth[_0x407a('0xb')](),controller[_0x407a('0xc')]);router[_0x407a('0xd')]('/',auth[_0x407a('0xb')](),controller[_0x407a('0xe')]);router[_0x407a('0xf')](_0x407a('0xa'),auth[_0x407a('0xb')](),controller['update']);router['delete'](_0x407a('0xa'),auth[_0x407a('0xb')](),controller[_0x407a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 1cdae0d..9d65466 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 _0x717b=['noop','TEXT','STRING','*,*,*,*','sequelize','INTEGER'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x717b,0x136));var _0xb717=function(_0x472070,_0xbc8757){_0x472070=_0x472070-0x0;var _0x379085=_0x717b[_0x472070];return _0x379085;};'use strict';var Sequelize=require(_0xb717('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb717('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb717('0x2')},'appdata':{'type':Sequelize[_0xb717('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb717('0x4')],'defaultValue':_0xb717('0x5')}}; \ No newline at end of file +var _0xb669=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x26a2e0,_0x1b3d51){var _0x37d004=function(_0x109050){while(--_0x109050){_0x26a2e0['push'](_0x26a2e0['shift']());}};_0x37d004(++_0x1b3d51);}(_0xb669,0x11f));var _0x9b66=function(_0x389fb0,_0x40ccad){_0x389fb0=_0x389fb0-0x0;var _0x142b70=_0xb669[_0x389fb0];return _0x142b70;};'use strict';var Sequelize=require(_0x9b66('0x0'));module[_0x9b66('0x1')]={'priority':{'type':Sequelize[_0x9b66('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9b66('0x3')],'allowNull':![],'defaultValue':_0x9b66('0x4')},'appdata':{'type':Sequelize[_0x9b66('0x5')]()},'description':{'type':Sequelize[_0x9b66('0x3')]},'interval':{'type':Sequelize[_0x9b66('0x3')],'defaultValue':_0x9b66('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 99ef64d..384fe6c 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 _0x3423=['status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','stack','index','SmsApplication','rawAttributes','fieldName','key','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','params','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','api','../../config/utils','../../mysqldb'];(function(_0x4b4027,_0x5af0bd){var _0x559ed9=function(_0x139187){while(--_0x139187){_0x4b4027['push'](_0x4b4027['shift']());}};_0x559ed9(++_0x5af0bd);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3342('0x0'));var zipdir=require(_0x3342('0x1'));var jsonpatch=require(_0x3342('0x2'));var rp=require(_0x3342('0x3'));var moment=require(_0x3342('0x4'));var BPromise=require(_0x3342('0x5'));var Mustache=require(_0x3342('0x6'));var util=require(_0x3342('0x7'));var path=require(_0x3342('0x8'));var sox=require(_0x3342('0x9'));var csv=require(_0x3342('0xa'));var ejs=require(_0x3342('0xb'));var fs=require('fs');var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0xa'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var db=require(_0x3342('0x15'))['db'];function respondWithStatusCode(_0x5a3cb1,_0x716d80){_0x716d80=_0x716d80||0xcc;return function(_0x36e1f4){if(_0x36e1f4){return _0x5a3cb1['sendStatus'](_0x716d80);}return _0x5a3cb1[_0x3342('0x16')](_0x716d80)[_0x3342('0x17')]();};}function respondWithResult(_0x38e3f7,_0xe4689e){_0xe4689e=_0xe4689e||0xc8;return function(_0x61fcc0){if(_0x61fcc0){return _0x38e3f7[_0x3342('0x16')](_0xe4689e)[_0x3342('0x18')](_0x61fcc0);}};}function respondWithFilteredResult(_0x59be1d,_0x3e44f3){return function(_0x19bd71){if(_0x19bd71){var _0x49afe3=_0x19bd71['count'],_0x40d609=_0x3e44f3[_0x3342('0x19')],_0x2c9df0=_0x3e44f3[_0x3342('0x19')]+_0x3e44f3[_0x3342('0x1a')],_0x51ef91;if(_0x2c9df0>=_0x49afe3){_0x2c9df0=_0x49afe3;_0x51ef91=0xc8;}else{_0x51ef91=0xce;}_0x59be1d[_0x3342('0x16')](_0x51ef91);return _0x59be1d[_0x3342('0x1b')](_0x3342('0x1c'),_0x40d609+'-'+_0x2c9df0+'/'+_0x49afe3)[_0x3342('0x18')](_0x19bd71);}return null;};}function patchUpdates(_0x3ebf6b){return function(_0x2c90c8){try{jsonpatch['apply'](_0x2c90c8,_0x3ebf6b,!![]);}catch(_0x283fc1){return BPromise[_0x3342('0x1d')](_0x283fc1);}return _0x2c90c8[_0x3342('0x1e')]();};}function saveUpdates(_0x5e05f5,_0x3cb86f){return function(_0x463324){if(_0x463324){return _0x463324['update'](_0x5e05f5)[_0x3342('0x1f')](function(_0x28528b){return _0x28528b;});}return null;};}function removeEntity(_0x4b765d,_0x4e1b19){return function(_0x5a0658){if(_0x5a0658){return _0x5a0658[_0x3342('0x20')]()[_0x3342('0x1f')](function(){_0x4b765d[_0x3342('0x16')](0xcc)[_0x3342('0x17')]();});}};}function handleEntityNotFound(_0xd2b87d,_0x2925a2){return function(_0x26eb87){if(!_0x26eb87){_0xd2b87d[_0x3342('0x21')](0x194);}return _0x26eb87;};}function handleError(_0x5d4f14,_0x30ffc9){_0x30ffc9=_0x30ffc9||0x1f4;return function(_0x517db5){logger['error'](_0x517db5[_0x3342('0x22')]);if(_0x517db5['name']){delete _0x517db5['name'];}_0x5d4f14[_0x3342('0x16')](_0x30ffc9)['send'](_0x517db5);};}exports[_0x3342('0x23')]=function(_0x543ec3,_0x524286){var _0x55cddd={},_0x1497d9={},_0x286c42={'count':0x0,'rows':[]};var _0x1dd607=_['map'](db[_0x3342('0x24')][_0x3342('0x25')],function(_0x1cc542){return{'name':_0x1cc542[_0x3342('0x26')],'type':_0x1cc542['type'][_0x3342('0x27')]};});_0x1497d9[_0x3342('0x28')]=_[_0x3342('0x29')](_0x1dd607,_0x3342('0x2a'));_0x1497d9[_0x3342('0x2b')]=_[_0x3342('0x2c')](_0x543ec3[_0x3342('0x2b')]);_0x1497d9['filters']=_[_0x3342('0x2d')](_0x1497d9['model'],_0x1497d9[_0x3342('0x2b')]);_0x55cddd[_0x3342('0x2e')]=_['intersection'](_0x1497d9[_0x3342('0x28')],qs[_0x3342('0x2f')](_0x543ec3[_0x3342('0x2b')][_0x3342('0x2f')]));_0x55cddd['attributes']=_0x55cddd[_0x3342('0x2e')][_0x3342('0x30')]?_0x55cddd[_0x3342('0x2e')]:_0x1497d9[_0x3342('0x28')];if(!_0x543ec3[_0x3342('0x2b')][_0x3342('0x31')](_0x3342('0x32'))){_0x55cddd[_0x3342('0x1a')]=qs[_0x3342('0x1a')](_0x543ec3[_0x3342('0x2b')][_0x3342('0x1a')]);_0x55cddd[_0x3342('0x19')]=qs['offset'](_0x543ec3['query'][_0x3342('0x19')]);}_0x55cddd['order']=qs[_0x3342('0x33')](_0x543ec3[_0x3342('0x2b')][_0x3342('0x33')]);_0x55cddd[_0x3342('0x34')]=qs[_0x3342('0x35')](_[_0x3342('0x36')](_0x543ec3[_0x3342('0x2b')],_0x1497d9['filters']),_0x1dd607);if(_0x543ec3[_0x3342('0x2b')][_0x3342('0x37')]){_0x55cddd[_0x3342('0x34')]=_[_0x3342('0x38')](_0x55cddd[_0x3342('0x34')],{'$or':_['map'](_0x1dd607,function(_0x410d0d){if(_0x410d0d['type']!==_0x3342('0x39')){var _0x2b9923={};_0x2b9923[_0x410d0d[_0x3342('0x2a')]]={'$like':'%'+_0x543ec3[_0x3342('0x2b')]['filter']+'%'};return _0x2b9923;}})});}_0x55cddd=_[_0x3342('0x38')]({},_0x55cddd,_0x543ec3['options']);var _0x9fcf8d={'where':_0x55cddd[_0x3342('0x34')]};return db[_0x3342('0x24')][_0x3342('0x3a')](_0x9fcf8d)[_0x3342('0x1f')](function(_0xf83613){_0x286c42[_0x3342('0x3a')]=_0xf83613;if(_0x543ec3['query'][_0x3342('0x3b')]){_0x55cddd[_0x3342('0x3c')]=[{'all':!![]}];}return db['SmsApplication'][_0x3342('0x3d')](_0x55cddd);})[_0x3342('0x1f')](function(_0x494d28){_0x286c42[_0x3342('0x3e')]=_0x494d28;return _0x286c42;})[_0x3342('0x1f')](respondWithFilteredResult(_0x524286,_0x55cddd))['catch'](handleError(_0x524286,null));};exports['show']=function(_0x5acb74,_0x46eb0a){var _0x41e727={'raw':!![],'where':{'id':_0x5acb74[_0x3342('0x3f')]['id']}},_0x594285={};_0x594285[_0x3342('0x28')]=_[_0x3342('0x2c')](db[_0x3342('0x24')][_0x3342('0x25')]);_0x594285[_0x3342('0x2b')]=_[_0x3342('0x2c')](_0x5acb74[_0x3342('0x2b')]);_0x594285['filters']=_['intersection'](_0x594285[_0x3342('0x28')],_0x594285[_0x3342('0x2b')]);_0x41e727[_0x3342('0x2e')]=_[_0x3342('0x2d')](_0x594285[_0x3342('0x28')],qs[_0x3342('0x2f')](_0x5acb74['query'][_0x3342('0x2f')]));_0x41e727[_0x3342('0x2e')]=_0x41e727[_0x3342('0x2e')][_0x3342('0x30')]?_0x41e727[_0x3342('0x2e')]:_0x594285[_0x3342('0x28')];if(_0x5acb74['query'][_0x3342('0x3b')]){_0x41e727['include']=[{'all':!![]}];}_0x41e727=_[_0x3342('0x38')]({},_0x41e727,_0x5acb74[_0x3342('0x40')]);return db[_0x3342('0x24')][_0x3342('0x41')](_0x41e727)['then'](handleEntityNotFound(_0x46eb0a,null))[_0x3342('0x1f')](respondWithResult(_0x46eb0a,null))[_0x3342('0x42')](handleError(_0x46eb0a,null));};exports['create']=function(_0x1f54a8,_0x302159){return db[_0x3342('0x24')][_0x3342('0x43')](_0x1f54a8['body'],{})[_0x3342('0x1f')](respondWithResult(_0x302159,0xc9))[_0x3342('0x42')](handleError(_0x302159,null));};exports['update']=function(_0x1fc491,_0x483ba7){if(_0x1fc491['body']['id']){delete _0x1fc491[_0x3342('0x44')]['id'];}return db[_0x3342('0x24')][_0x3342('0x41')]({'where':{'id':_0x1fc491[_0x3342('0x3f')]['id']}})[_0x3342('0x1f')](handleEntityNotFound(_0x483ba7,null))[_0x3342('0x1f')](saveUpdates(_0x1fc491[_0x3342('0x44')],null))['then'](respondWithResult(_0x483ba7,null))['catch'](handleError(_0x483ba7,null));};exports[_0x3342('0x20')]=function(_0x5a9e40,_0x26251c){return db['SmsApplication']['find']({'where':{'id':_0x5a9e40['params']['id']}})[_0x3342('0x1f')](handleEntityNotFound(_0x26251c,null))[_0x3342('0x1f')](removeEntity(_0x26251c,null))[_0x3342('0x42')](handleError(_0x26251c,null));}; \ No newline at end of file +var _0xa30a=['body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','apply','update','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','create'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xaa30('0x0'));var emlformat=require(_0xaa30('0x1'));var rimraf=require(_0xaa30('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa30('0x3'));var rp=require(_0xaa30('0x4'));var moment=require(_0xaa30('0x5'));var BPromise=require(_0xaa30('0x6'));var Mustache=require(_0xaa30('0x7'));var util=require(_0xaa30('0x8'));var path=require(_0xaa30('0x9'));var sox=require('sox');var csv=require(_0xaa30('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xa'));var querystring=require(_0xaa30('0xf'));var Papa=require(_0xaa30('0x10'));var Redis=require(_0xaa30('0x11'));var authService=require(_0xaa30('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x13'));var logger=require('../../config/logger')(_0xaa30('0x14'));var utils=require(_0xaa30('0x15'));var config=require(_0xaa30('0x16'));var db=require(_0xaa30('0x17'))['db'];function respondWithStatusCode(_0x589229,_0xec992f){_0xec992f=_0xec992f||0xcc;return function(_0x3de2d1){if(_0x3de2d1){return _0x589229[_0xaa30('0x18')](_0xec992f);}return _0x589229['status'](_0xec992f)[_0xaa30('0x19')]();};}function respondWithResult(_0xdea23a,_0x25c02e){_0x25c02e=_0x25c02e||0xc8;return function(_0x14de74){if(_0x14de74){return _0xdea23a[_0xaa30('0x1a')](_0x25c02e)[_0xaa30('0x1b')](_0x14de74);}};}function respondWithFilteredResult(_0x3240e9,_0x3b8095){return function(_0x2e37af){if(_0x2e37af){var _0xfae724=_0x2e37af['count'],_0x519518=_0x3b8095[_0xaa30('0x1c')],_0x91839d=_0x3b8095[_0xaa30('0x1c')]+_0x3b8095[_0xaa30('0x1d')],_0x591478;if(_0x91839d>=_0xfae724){_0x91839d=_0xfae724;_0x591478=0xc8;}else{_0x591478=0xce;}_0x3240e9['status'](_0x591478);return _0x3240e9['set']('Content-Range',_0x519518+'-'+_0x91839d+'/'+_0xfae724)[_0xaa30('0x1b')](_0x2e37af);}return null;};}function patchUpdates(_0x4acdfa){return function(_0xfb02ab){try{jsonpatch[_0xaa30('0x1e')](_0xfb02ab,_0x4acdfa,!![]);}catch(_0x48561d){return BPromise['reject'](_0x48561d);}return _0xfb02ab['save']();};}function saveUpdates(_0x3cbf92,_0x3e4f1d){return function(_0x61b85){if(_0x61b85){return _0x61b85[_0xaa30('0x1f')](_0x3cbf92)[_0xaa30('0x20')](function(_0x4aacfd){return _0x4aacfd;});}return null;};}function removeEntity(_0x3f6295,_0x24bb25){return function(_0x2e16e7){if(_0x2e16e7){return _0x2e16e7[_0xaa30('0x21')]()[_0xaa30('0x20')](function(){_0x3f6295['status'](0xcc)[_0xaa30('0x19')]();});}};}function handleEntityNotFound(_0x13128a,_0x2fecdd){return function(_0x326f84){if(!_0x326f84){_0x13128a['sendStatus'](0x194);}return _0x326f84;};}function handleError(_0x14d7fa,_0x1be54c){_0x1be54c=_0x1be54c||0x1f4;return function(_0x19ba52){logger[_0xaa30('0x22')](_0x19ba52[_0xaa30('0x23')]);if(_0x19ba52[_0xaa30('0x24')]){delete _0x19ba52['name'];}_0x14d7fa[_0xaa30('0x1a')](_0x1be54c)[_0xaa30('0x25')](_0x19ba52);};}exports['index']=function(_0xb043e4,_0x5b3efb){var _0x2da4da={},_0x33a0c9={},_0x2aabf8={'count':0x0,'rows':[]};var _0xd1eb3a=_[_0xaa30('0x26')](db[_0xaa30('0x27')][_0xaa30('0x28')],function(_0x39f708){return{'name':_0x39f708[_0xaa30('0x29')],'type':_0x39f708[_0xaa30('0x2a')][_0xaa30('0x2b')]};});_0x33a0c9[_0xaa30('0x2c')]=_[_0xaa30('0x26')](_0xd1eb3a,_0xaa30('0x24'));_0x33a0c9[_0xaa30('0x2d')]=_[_0xaa30('0x2e')](_0xb043e4[_0xaa30('0x2d')]);_0x33a0c9[_0xaa30('0x2f')]=_['intersection'](_0x33a0c9[_0xaa30('0x2c')],_0x33a0c9[_0xaa30('0x2d')]);_0x2da4da[_0xaa30('0x30')]=_[_0xaa30('0x31')](_0x33a0c9[_0xaa30('0x2c')],qs[_0xaa30('0x32')](_0xb043e4['query']['fields']));_0x2da4da['attributes']=_0x2da4da[_0xaa30('0x30')][_0xaa30('0x33')]?_0x2da4da[_0xaa30('0x30')]:_0x33a0c9[_0xaa30('0x2c')];if(!_0xb043e4[_0xaa30('0x2d')]['hasOwnProperty']('nolimit')){_0x2da4da[_0xaa30('0x1d')]=qs[_0xaa30('0x1d')](_0xb043e4['query'][_0xaa30('0x1d')]);_0x2da4da['offset']=qs[_0xaa30('0x1c')](_0xb043e4['query'][_0xaa30('0x1c')]);}_0x2da4da[_0xaa30('0x34')]=qs['sort'](_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x35')]);_0x2da4da[_0xaa30('0x36')]=qs[_0xaa30('0x2f')](_[_0xaa30('0x37')](_0xb043e4[_0xaa30('0x2d')],_0x33a0c9['filters']),_0xd1eb3a);if(_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x38')]){_0x2da4da['where']=_[_0xaa30('0x39')](_0x2da4da[_0xaa30('0x36')],{'$or':_[_0xaa30('0x26')](_0xd1eb3a,function(_0x557012){if(_0x557012['type']!==_0xaa30('0x3a')){var _0x21ffb0={};_0x21ffb0[_0x557012[_0xaa30('0x24')]]={'$like':'%'+_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x38')]+'%'};return _0x21ffb0;}})});}_0x2da4da=_[_0xaa30('0x39')]({},_0x2da4da,_0xb043e4['options']);var _0x5ca1b0={'where':_0x2da4da[_0xaa30('0x36')]};return db[_0xaa30('0x27')][_0xaa30('0x3b')](_0x5ca1b0)['then'](function(_0x244bca){_0x2aabf8[_0xaa30('0x3b')]=_0x244bca;if(_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x3c')]){_0x2da4da['include']=[{'all':!![]}];}return db[_0xaa30('0x27')][_0xaa30('0x3d')](_0x2da4da);})[_0xaa30('0x20')](function(_0x480795){_0x2aabf8[_0xaa30('0x3e')]=_0x480795;return _0x2aabf8;})['then'](respondWithFilteredResult(_0x5b3efb,_0x2da4da))[_0xaa30('0x3f')](handleError(_0x5b3efb,null));};exports[_0xaa30('0x40')]=function(_0x22dfa5,_0x7b6a6b){var _0x13f08f={'raw':!![],'where':{'id':_0x22dfa5[_0xaa30('0x41')]['id']}},_0x4478cc={};_0x4478cc[_0xaa30('0x2c')]=_['keys'](db['SmsApplication'][_0xaa30('0x28')]);_0x4478cc['query']=_['keys'](_0x22dfa5['query']);_0x4478cc[_0xaa30('0x2f')]=_['intersection'](_0x4478cc[_0xaa30('0x2c')],_0x4478cc['query']);_0x13f08f[_0xaa30('0x30')]=_[_0xaa30('0x31')](_0x4478cc[_0xaa30('0x2c')],qs[_0xaa30('0x32')](_0x22dfa5[_0xaa30('0x2d')][_0xaa30('0x32')]));_0x13f08f[_0xaa30('0x30')]=_0x13f08f[_0xaa30('0x30')][_0xaa30('0x33')]?_0x13f08f[_0xaa30('0x30')]:_0x4478cc[_0xaa30('0x2c')];if(_0x22dfa5['query'][_0xaa30('0x3c')]){_0x13f08f[_0xaa30('0x42')]=[{'all':!![]}];}_0x13f08f=_[_0xaa30('0x39')]({},_0x13f08f,_0x22dfa5[_0xaa30('0x43')]);return db[_0xaa30('0x27')]['find'](_0x13f08f)['then'](handleEntityNotFound(_0x7b6a6b,null))[_0xaa30('0x20')](respondWithResult(_0x7b6a6b,null))['catch'](handleError(_0x7b6a6b,null));};exports[_0xaa30('0x44')]=function(_0xbf9edd,_0xef3564){return db[_0xaa30('0x27')][_0xaa30('0x44')](_0xbf9edd[_0xaa30('0x45')],{})[_0xaa30('0x20')](respondWithResult(_0xef3564,0xc9))['catch'](handleError(_0xef3564,null));};exports[_0xaa30('0x1f')]=function(_0x6c9da6,_0xfa14bf){if(_0x6c9da6['body']['id']){delete _0x6c9da6[_0xaa30('0x45')]['id'];}return db[_0xaa30('0x27')]['find']({'where':{'id':_0x6c9da6[_0xaa30('0x41')]['id']}})['then'](handleEntityNotFound(_0xfa14bf,null))[_0xaa30('0x20')](saveUpdates(_0x6c9da6['body'],null))['then'](respondWithResult(_0xfa14bf,null))[_0xaa30('0x3f')](handleError(_0xfa14bf,null));};exports['destroy']=function(_0x56389c,_0xf6a737){return db[_0xaa30('0x27')][_0xaa30('0x46')]({'where':{'id':_0x56389c[_0xaa30('0x41')]['id']}})[_0xaa30('0x20')](handleEntityNotFound(_0xf6a737,null))[_0xaa30('0x20')](removeEntity(_0xf6a737,null))['catch'](handleError(_0xf6a737,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 787a5b9..4fc19c1 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 _0x0e6a=['path','rimraf','../../config/environment','./smsApplication.attributes','SmsApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4970bc,_0x58008f){var _0x399c8c=function(_0x5df158){while(--_0x5df158){_0x4970bc['push'](_0x4970bc['shift']());}};_0x399c8c(++_0x58008f);}(_0x0e6a,0x1b4));var _0xa0e6=function(_0x4b5039,_0x23b033){_0x4b5039=_0x4b5039-0x0;var _0x597f29=_0x0e6a[_0x4b5039];return _0x597f29;};'use strict';var _=require('lodash');var util=require(_0xa0e6('0x0'));var logger=require(_0xa0e6('0x1'))(_0xa0e6('0x2'));var moment=require(_0xa0e6('0x3'));var BPromise=require(_0xa0e6('0x4'));var rp=require(_0xa0e6('0x5'));var fs=require('fs');var path=require(_0xa0e6('0x6'));var rimraf=require(_0xa0e6('0x7'));var config=require(_0xa0e6('0x8'));var attributes=require(_0xa0e6('0x9'));module['exports']=function(_0x3dc18b,_0x31c846){return _0x3dc18b['define'](_0xa0e6('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa0e6('0xb'),'collate':_0xa0e6('0xc')});}; \ No newline at end of file +var _0x496e=['api','bluebird','request-promise','path','rimraf','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x5ebc57,_0x40f17d){var _0x49f5ef=function(_0x71114b){while(--_0x71114b){_0x5ebc57['push'](_0x5ebc57['shift']());}};_0x49f5ef(++_0x40f17d);}(_0x496e,0xe2));var _0xe496=function(_0x425b08,_0x5afd33){_0x425b08=_0x425b08-0x0;var _0x4ee8ec=_0x496e[_0x425b08];return _0x4ee8ec;};'use strict';var _=require(_0xe496('0x0'));var util=require('util');var logger=require(_0xe496('0x1'))(_0xe496('0x2'));var moment=require('moment');var BPromise=require(_0xe496('0x3'));var rp=require(_0xe496('0x4'));var fs=require('fs');var path=require(_0xe496('0x5'));var rimraf=require(_0xe496('0x6'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0xe496('0x7')]=function(_0x1d84f5,_0x56c8ed){return _0x1d84f5[_0xe496('0x8')](_0xe496('0x9'),attributes,{'tableName':_0xe496('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe496('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 80eaec3..f44bf2b 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 _0x5b5a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','result','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3adc72,_0x4fb254){var _0x182b64=function(_0x5c6e6b){while(--_0x5c6e6b){_0x3adc72['push'](_0x3adc72['shift']());}};_0x182b64(++_0x4fb254);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x4c2bc5,_0x4984e2){_0x4c2bc5=_0x4c2bc5-0x0;var _0x487209=_0x5b5a[_0x4c2bc5];return _0x487209;};'use strict';var _=require('lodash');var util=require(_0xa5b5('0x0'));var moment=require(_0xa5b5('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5b5('0x2'));var fs=require('fs');var Redis=require(_0xa5b5('0x3'));var db=require(_0xa5b5('0x4'))['db'];var utils=require(_0xa5b5('0x5'));var logger=require(_0xa5b5('0x6'))(_0xa5b5('0x7'));var config=require(_0xa5b5('0x8'));var jayson=require(_0xa5b5('0x9'));var client=jayson['client'][_0xa5b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c137,_0x513641,_0x32a09a){return new BPromise(function(_0x1936d6,_0x1157ee){return client[_0xa5b5('0xb')](_0x29c137,_0x32a09a)[_0xa5b5('0xc')](function(_0x307afa){logger[_0xa5b5('0xd')](_0xa5b5('0xe'),_0x513641,_0xa5b5('0xf'));logger[_0xa5b5('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x513641,'request\x20sent',JSON['stringify'](_0x307afa));if(_0x307afa['error']){if(_0x307afa[_0xa5b5('0x11')]['code']===0x1f4){logger[_0xa5b5('0x11')]('SmsApplication,\x20%s,\x20%s',_0x513641,_0x307afa[_0xa5b5('0x11')][_0xa5b5('0x12')]);return _0x1157ee(_0x307afa[_0xa5b5('0x11')][_0xa5b5('0x12')]);}logger[_0xa5b5('0x11')](_0xa5b5('0xe'),_0x513641,_0x307afa[_0xa5b5('0x11')]['message']);return _0x1936d6(_0x307afa['error'][_0xa5b5('0x12')]);}else{logger['info'](_0xa5b5('0xe'),_0x513641,_0xa5b5('0xf'));_0x1936d6(_0x307afa[_0xa5b5('0x13')]['message']);}})['catch'](function(_0x4d3274){logger['error'](_0xa5b5('0xe'),_0x513641,_0x4d3274);_0x1157ee(_0x4d3274);});});} \ No newline at end of file +var _0x5c1f=['code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x556ddd,_0x492976){var _0x51c518=function(_0x55e214){while(--_0x55e214){_0x556ddd['push'](_0x556ddd['shift']());}};_0x51c518(++_0x492976);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0x5c1f[_0x2c6810];return _0x213881;};'use strict';var _=require(_0xf5c1('0x0'));var util=require('util');var moment=require(_0xf5c1('0x1'));var BPromise=require(_0xf5c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf5c1('0x3'));var db=require(_0xf5c1('0x4'))['db'];var utils=require(_0xf5c1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf5c1('0x6'));var client=jayson[_0xf5c1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34a073,_0x21bb02,_0x12128b){return new BPromise(function(_0x40cad7,_0x5e3ef8){return client['request'](_0x34a073,_0x12128b)['then'](function(_0x4bd3a9){logger[_0xf5c1('0x8')](_0xf5c1('0x9'),_0x21bb02,_0xf5c1('0xa'));logger[_0xf5c1('0xb')](_0xf5c1('0xc'),_0x21bb02,_0xf5c1('0xa'),JSON[_0xf5c1('0xd')](_0x4bd3a9));if(_0x4bd3a9[_0xf5c1('0xe')]){if(_0x4bd3a9['error'][_0xf5c1('0xf')]===0x1f4){logger[_0xf5c1('0xe')](_0xf5c1('0x9'),_0x21bb02,_0x4bd3a9[_0xf5c1('0xe')][_0xf5c1('0x10')]);return _0x5e3ef8(_0x4bd3a9['error'][_0xf5c1('0x10')]);}logger['error'](_0xf5c1('0x9'),_0x21bb02,_0x4bd3a9[_0xf5c1('0xe')][_0xf5c1('0x10')]);return _0x40cad7(_0x4bd3a9['error'][_0xf5c1('0x10')]);}else{logger[_0xf5c1('0x8')](_0xf5c1('0x9'),_0x21bb02,_0xf5c1('0xa'));_0x40cad7(_0x4bd3a9['result'][_0xf5c1('0x10')]);}})[_0xf5c1('0x11')](function(_0x312d6b){logger[_0xf5c1('0xe')](_0xf5c1('0x9'),_0x21bb02,_0x312d6b);_0x5e3ef8(_0x312d6b);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 261ad97..aeae7d0 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 _0x9d01=['describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','isAuthenticated','index','get'];(function(_0x346a90,_0x538586){var _0xd1059c=function(_0x5e6897){while(--_0x5e6897){_0x346a90['push'](_0x346a90['shift']());}};_0xd1059c(++_0x538586);}(_0x9d01,0x1ec));var _0x19d0=function(_0x35f5b5,_0x389e18){_0x35f5b5=_0x35f5b5-0x0;var _0x16c86b=_0x9d01[_0x35f5b5];return _0x16c86b;};'use strict';var multer=require(_0x19d0('0x0'));var util=require(_0x19d0('0x1'));var path=require(_0x19d0('0x2'));var timeout=require(_0x19d0('0x3'));var express=require(_0x19d0('0x4'));var router=express[_0x19d0('0x5')]();var auth=require(_0x19d0('0x6'));var interaction=require(_0x19d0('0x7'));var config=require('../../config/environment');var controller=require(_0x19d0('0x8'));router['get']('/',auth[_0x19d0('0x9')](),controller[_0x19d0('0xa')]);router[_0x19d0('0xb')]('/describe',auth[_0x19d0('0x9')](),controller[_0x19d0('0xc')]);router[_0x19d0('0xb')](_0x19d0('0xd'),auth[_0x19d0('0x9')](),controller[_0x19d0('0xe')]);router[_0x19d0('0xb')](_0x19d0('0xf'),auth[_0x19d0('0x9')](),controller[_0x19d0('0x10')]);router['get']('/:id/download',auth[_0x19d0('0x9')](),controller[_0x19d0('0x11')]);router[_0x19d0('0x12')]('/',auth[_0x19d0('0x9')](),controller['create']);router['post'](_0x19d0('0xf'),auth['isAuthenticated'](),controller[_0x19d0('0x13')]);router[_0x19d0('0x12')](_0x19d0('0x14'),auth['isAuthenticated'](),interaction[_0x19d0('0x15')](_0x19d0('0x16'),_0x19d0('0x17')),controller['addTags']);router[_0x19d0('0x18')](_0x19d0('0xd'),auth[_0x19d0('0x9')](),interaction[_0x19d0('0x15')](_0x19d0('0x16'),'smsinteraction:update'),controller['update']);router[_0x19d0('0x19')](_0x19d0('0xd'),auth[_0x19d0('0x9')](),interaction[_0x19d0('0x15')](_0x19d0('0x16'),_0x19d0('0x1a')),controller['destroy']);router[_0x19d0('0x19')](_0x19d0('0x14'),auth['isAuthenticated'](),controller[_0x19d0('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x28f2=['describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x28f2,0x193));var _0x228f=function(_0x2c6d62,_0x12b382){_0x2c6d62=_0x2c6d62-0x0;var _0x5ccef0=_0x28f2[_0x2c6d62];return _0x5ccef0;};'use strict';var multer=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var path=require(_0x228f('0x2'));var timeout=require(_0x228f('0x3'));var express=require(_0x228f('0x4'));var router=express['Router']();var auth=require(_0x228f('0x5'));var interaction=require(_0x228f('0x6'));var config=require(_0x228f('0x7'));var controller=require(_0x228f('0x8'));router[_0x228f('0x9')]('/',auth[_0x228f('0xa')](),controller[_0x228f('0xb')]);router['get'](_0x228f('0xc'),auth['isAuthenticated'](),controller[_0x228f('0xd')]);router[_0x228f('0x9')](_0x228f('0xe'),auth['isAuthenticated'](),controller[_0x228f('0xf')]);router['get'](_0x228f('0x10'),auth[_0x228f('0xa')](),controller['getMessages']);router[_0x228f('0x9')](_0x228f('0x11'),auth[_0x228f('0xa')](),controller[_0x228f('0x12')]);router[_0x228f('0x13')]('/',auth['isAuthenticated'](),controller[_0x228f('0x14')]);router[_0x228f('0x13')](_0x228f('0x10'),auth[_0x228f('0xa')](),controller[_0x228f('0x15')]);router[_0x228f('0x13')](_0x228f('0x16'),auth[_0x228f('0xa')](),interaction['tracked'](_0x228f('0x17'),_0x228f('0x18')),controller[_0x228f('0x19')]);router[_0x228f('0x1a')](_0x228f('0xe'),auth[_0x228f('0xa')](),interaction[_0x228f('0x1b')]('sms',_0x228f('0x1c')),controller['update']);router[_0x228f('0x1d')](_0x228f('0xe'),auth[_0x228f('0xa')](),interaction['tracked'](_0x228f('0x17'),'smsinteraction:destroy'),controller[_0x228f('0x1e')]);router['delete'](_0x228f('0x16'),auth['isAuthenticated'](),controller['removeTags']);module[_0x228f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index abead7b..28c0f35 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'closed':{'type':Sequelize[_0x3071('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3071('0x2')]},'disposition':{'type':Sequelize[_0x3071('0x3')]},'note':{'type':Sequelize[_0x3071('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x3071('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3071('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x3071('0x4')]('in',_0x3071('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x757a,0xde));var _0xa757=function(_0x339a82,_0x544447){_0x339a82=_0x339a82-0x0;var _0x31e2c1=_0x757a[_0x339a82];return _0x31e2c1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index ef8e407..852133e 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 _0x55e0=['crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','field','color','select','u.id','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','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','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?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','body','keys','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','c.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','rows','show','params','rawAttributes','include','merge','create','describe','addMessage','SmsMessage','ids','getMessages','findOne','pick','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','SmsAccount','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','Sms','Account','closed','closedAt','disposition','out','System','secret','renderFile','views','transcript-','err','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','lodash'];(function(_0x3ba937,_0x373271){var _0x590be0=function(_0x1ff501){while(--_0x1ff501){_0x3ba937['push'](_0x3ba937['shift']());}};_0x590be0(++_0x373271);}(_0x55e0,0xdc));var _0x055e=function(_0x3ee554,_0x6ff1c1){_0x3ee554=_0x3ee554-0x0;var _0x35066a=_0x55e0[_0x3ee554];return _0x35066a;};'use strict';var pdf=require(_0x055e('0x0'));var emlformat=require(_0x055e('0x1'));var rimraf=require(_0x055e('0x2'));var zipdir=require(_0x055e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x055e('0x4'));var BPromise=require(_0x055e('0x5'));var Mustache=require(_0x055e('0x6'));var util=require(_0x055e('0x7'));var path=require(_0x055e('0x8'));var sox=require(_0x055e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x055e('0xa'));var squel=require('squel');var crypto=require(_0x055e('0xb'));var jsforce=require(_0x055e('0xc'));var deskjs=require(_0x055e('0xd'));var toCsv=require(_0x055e('0xe'));var querystring=require(_0x055e('0xf'));var Papa=require('papaparse');var Redis=require(_0x055e('0x10'));var authService=require(_0x055e('0x11'));var qs=require(_0x055e('0x12'));var as=require(_0x055e('0x13'));var hardwareService=require(_0x055e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x055e('0x15'));var config=require('../../config/environment');var db=require(_0x055e('0x16'))['db'];config[_0x055e('0x17')]=_[_0x055e('0x18')](config[_0x055e('0x17')],{'host':_0x055e('0x19'),'port':0x18eb});var socket=require(_0x055e('0x1a'))(new Redis(config[_0x055e('0x17')]));require('./smsInteraction.socket')[_0x055e('0x1b')](socket);function respondWithStatusCode(_0xb80d83,_0x3cfd14){_0x3cfd14=_0x3cfd14||0xcc;return function(_0xe41bae){if(_0xe41bae){return _0xb80d83[_0x055e('0x1c')](_0x3cfd14);}return _0xb80d83['status'](_0x3cfd14)[_0x055e('0x1d')]();};}function respondWithResult(_0x2fe55f,_0x111cdb){_0x111cdb=_0x111cdb||0xc8;return function(_0x599533){if(_0x599533){return _0x2fe55f[_0x055e('0x1e')](_0x111cdb)[_0x055e('0x1f')](_0x599533);}};}function respondWithFilteredResult(_0xb4e6ca,_0x2bad86){return function(_0x2cc84e){if(_0x2cc84e){var _0x4c85dd=_0x2cc84e[_0x055e('0x20')],_0x36ef10=_0x2bad86['offset'],_0x2cf3de=_0x2bad86[_0x055e('0x21')]+_0x2bad86[_0x055e('0x22')],_0x2f4a06;if(_0x2cf3de>=_0x4c85dd){_0x2cf3de=_0x4c85dd;_0x2f4a06=0xc8;}else{_0x2f4a06=0xce;}_0xb4e6ca['status'](_0x2f4a06);return _0xb4e6ca[_0x055e('0x23')](_0x055e('0x24'),_0x36ef10+'-'+_0x2cf3de+'/'+_0x4c85dd)[_0x055e('0x1f')](_0x2cc84e);}return null;};}function patchUpdates(_0x124d86){return function(_0x4280cf){try{jsonpatch[_0x055e('0x25')](_0x4280cf,_0x124d86,!![]);}catch(_0x53b766){return BPromise[_0x055e('0x26')](_0x53b766);}return _0x4280cf[_0x055e('0x27')]();};}function saveUpdates(_0x211594,_0x5930ff){return function(_0x3f444a){if(_0x3f444a){return _0x3f444a[_0x055e('0x28')](_0x211594)[_0x055e('0x29')](function(_0x37243b){return _0x37243b;});}return null;};}function removeEntity(_0x51df23,_0x71a6e1){return function(_0x56c372){if(_0x56c372){return _0x56c372[_0x055e('0x2a')]()[_0x055e('0x29')](function(){_0x51df23[_0x055e('0x1e')](0xcc)[_0x055e('0x1d')]();});}};}function handleEntityNotFound(_0x40c62a,_0x4c653c){return function(_0x58caf9){if(!_0x58caf9){_0x40c62a[_0x055e('0x1c')](0x194);}return _0x58caf9;};}function handleError(_0x1f90a9,_0x2a82f8){_0x2a82f8=_0x2a82f8||0x1f4;return function(_0x4b5891){logger[_0x055e('0x2b')](_0x4b5891[_0x055e('0x2c')]);if(_0x4b5891[_0x055e('0x2d')]){delete _0x4b5891[_0x055e('0x2d')];}_0x1f90a9['status'](_0x2a82f8)[_0x055e('0x2e')](_0x4b5891);};}function getInteractionUsers(_0x5958ef,_0x1528c3){return new BPromise(function(_0x35def0,_0x23a506){try{if(_0x1528c3[_0x5958ef['id']]){_0x5958ef[_0x055e('0x2f')]=_[_0x055e('0x30')](_0x1528c3[_0x5958ef['id']],function(_0x5c0e76){return{'id':_0x5c0e76['id'],'fullname':_0x5c0e76[_0x055e('0x31')]};});}}catch(_0x453e5e){_0x23a506(_0x453e5e);}_0x35def0(_0x5958ef);});}function getInteractionTags(_0x293062,_0x1499e1){return new BPromise(function(_0x36abb2,_0x225c88){try{if(_0x293062[_0x055e('0x32')]){_0x293062[_0x055e('0x33')]=[];_0x293062['TagIds'][_0x055e('0x34')](',')[_0x055e('0x35')](function(_0x5cfeea){_0x293062[_0x055e('0x33')][_0x055e('0x36')](_0x1499e1[_0x5cfeea]);});}delete _0x293062[_0x055e('0x32')];}catch(_0x20717b){_0x225c88(_0x20717b);}_0x36abb2(_0x293062);});}function updateSmsInteraction(_0x23c611,_0x43d8b7,_0x5e1a92){return new BPromise(function(_0x5ddf59,_0x25d19d){return getInteractionUsers(_0x23c611,_0x5e1a92)['then'](function(_0x49b64c){return getInteractionTags(_0x49b64c,_0x43d8b7);})['then'](function(_0x31ee60){_0x5ddf59(_0x31ee60);})[_0x055e('0x37')](function(_0x35c6cf){_0x25d19d(_0x35c6cf);});});}exports[_0x055e('0x38')]=function(_0x282914,_0x16a4fa){var _0x13efb7={},_0x106543={},_0x42a33e={'count':0x0,'rows':[]};var _0x2f60fa=_[_0x055e('0x30')](db[_0x055e('0x39')]['rawAttributes'],function(_0x571b75){return{'name':_0x571b75[_0x055e('0x3a')],'type':_0x571b75[_0x055e('0x3b')][_0x055e('0x3c')]};});_0x106543[_0x055e('0x3d')]=_[_0x055e('0x30')](_0x2f60fa,_0x055e('0x2d'));_0x106543[_0x055e('0x3e')]=_['keys'](_0x282914[_0x055e('0x3e')]);_0x106543[_0x055e('0x3f')]=_[_0x055e('0x40')](_0x106543[_0x055e('0x3d')],_0x106543[_0x055e('0x3e')]);_0x13efb7['attributes']=_[_0x055e('0x40')](_0x106543[_0x055e('0x3d')],qs['fields'](_0x282914[_0x055e('0x3e')][_0x055e('0x41')]));_0x13efb7['attributes']=_0x13efb7[_0x055e('0x42')][_0x055e('0x43')]?_0x13efb7['attributes']:_0x106543[_0x055e('0x3d')];if(!_0x282914[_0x055e('0x3e')]['hasOwnProperty'](_0x055e('0x44'))){_0x13efb7[_0x055e('0x22')]=qs[_0x055e('0x22')](_0x282914['query'][_0x055e('0x22')]);_0x13efb7[_0x055e('0x21')]=qs['offset'](_0x282914[_0x055e('0x3e')][_0x055e('0x21')]);}_0x13efb7[_0x055e('0x45')]=qs['sort'](_0x282914[_0x055e('0x3e')][_0x055e('0x46')]);_0x13efb7[_0x055e('0x47')]=qs['filters'](_['pick'](_0x282914[_0x055e('0x3e')],_0x106543[_0x055e('0x3f')]),_0x2f60fa);var _0x4ff19e=[];var _0x3a5bc5=squel['select']()[_0x055e('0x48')]('id')['field'](_0x055e('0x2d'))[_0x055e('0x48')](_0x055e('0x49'))['from']('tools_tags');var _0x20b951=squel[_0x055e('0x4a')]()[_0x055e('0x48')](_0x055e('0x4b'))['field']('u.fullname')[_0x055e('0x48')](_0x055e('0x4c'))['from'](_0x055e('0x4d'),'ui')[_0x055e('0x4e')](_0x055e('0x4f'),'u',_0x055e('0x50'));var _0x19e29c=squel[_0x055e('0x4a')]()['from'](_0x055e('0x51'),'i')[_0x055e('0x4e')]('cm_contacts','c',_0x055e('0x52'))[_0x055e('0x4e')](_0x055e('0x4f'),'o',_0x055e('0x53'))[_0x055e('0x4e')](_0x055e('0x54'),'a',_0x055e('0x55'))['left_join'](_0x055e('0x56'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x055e('0x4e')](_0x055e('0x57'),'it',_0x055e('0x58'))['left_join']('tools_tags','t',_0x055e('0x59'));var _0x20114c=squel[_0x055e('0x5a')]();var _0x250cab=[];var _0xb4be7a=squel[_0x055e('0x5a')]();var _0x128e11;if(_0x282914[_0x055e('0x3e')][_0x055e('0x5b')]){_0x128e11=as['parseSearch'](_0x282914[_0x055e('0x3e')][_0x055e('0x5b')]);var _0x2f8ad0=_0x128e11[_0x055e('0x5c')];for(var _0x335415=0x0;_0x335415<_0x128e11['conditions'][_0x055e('0x43')];_0x335415++){var _0x1d4061=_0x128e11[_0x055e('0x5d')][_0x335415];var _0x4b7ba0='i';var _0x43a849=_['find'](_0x2f60fa,[_0x055e('0x2d'),_0x1d4061[_0x055e('0x48')]]);if(!_0x43a849){switch(_0x1d4061['field']){case _0x055e('0x5e'):if(_0x1d4061[_0x055e('0x5f')]==0x1){_0x19e29c[_0x055e('0x60')]('`'+_0x1d4061['field']+'`\x20=\x200');}else{_0x19e29c[_0x055e('0x60')]('`'+_0x1d4061[_0x055e('0x48')]+_0x055e('0x61'));}break;case _0x055e('0x62'):if(_0x1d4061[_0x055e('0x63')]===_0x055e('0x64')){if(_0x1d4061[_0x055e('0x5f')][_0x055e('0x34')]('\x20')[_0x055e('0x43')]>0x1){_0x20114c[_0x2f8ad0](_0x055e('0x65'),qs['getFullTextValue'](_0x1d4061[_0x055e('0x5f')]),null);}else{var _0x7f03ed='%'+_0x1d4061[_0x055e('0x5f')]+'%';_0x20114c[_0x2f8ad0](_0x055e('0x66'),_0x7f03ed,_0x7f03ed,_0x7f03ed);}}else{_0x43a849=_['find'](_0x2f60fa,[_0x055e('0x2d'),_0x055e('0x67')]);_0x1d4061[_0x055e('0x48')]=_0x055e('0x67');_0x329d46=as['buildExpression'](_0x4b7ba0,_0x43a849['type'],_0x1d4061);_0x20114c[_0x2f8ad0](_0x329d46[_0x055e('0x68')],_0x329d46[_0x055e('0x5f')][_0x055e('0x69')],_0x329d46[_0x055e('0x5f')][_0x055e('0x1d')]);}break;case _0x055e('0x6a'):var _0x3876d0=_0x1d4061[_0x055e('0x5f')]['split'](',')['map'](function(_0x1df839){return Number(_0x1df839);});_0x3876d0[_0x055e('0x35')](function(_0x5240d5){_0xb4be7a['or'](_0x055e('0x6b'),'%,'+_0x5240d5+',%');});_0x250cab=_[_0x055e('0x6c')](_0x250cab,_0x3876d0);break;case _0x055e('0x6d'):if(_0x1d4061[_0x055e('0x63')]==='$substring'){_0x20114c[_0x2f8ad0](_0x055e('0x6e'),'%'+_0x1d4061[_0x055e('0x5f')]+'%',null);}else{_0x43a849=_[_0x055e('0x6f')](_0x2f60fa,[_0x055e('0x2d'),_0x055e('0x70')]);_0x1d4061[_0x055e('0x48')]=_0x055e('0x70');_0x329d46=as[_0x055e('0x71')](_0x4b7ba0,_0x43a849['type'],_0x1d4061);_0x20114c[_0x2f8ad0](_0x329d46[_0x055e('0x68')],_0x329d46[_0x055e('0x5f')]['start'],_0x329d46[_0x055e('0x5f')][_0x055e('0x1d')]);}break;case _0x055e('0x72'):_0x329d46=as[_0x055e('0x71')]('me',null,_0x1d4061);_0x20114c[_0x2f8ad0](_0x329d46['text'],_0x329d46[_0x055e('0x5f')][_0x055e('0x69')],_0x329d46[_0x055e('0x5f')]['end']);break;}}else{var _0x329d46=as[_0x055e('0x71')](_0x4b7ba0,_0x43a849[_0x055e('0x3b')],_0x1d4061);_0x20114c[_0x2f8ad0](_0x329d46[_0x055e('0x68')],_0x329d46[_0x055e('0x5f')]['start'],_0x329d46[_0x055e('0x5f')][_0x055e('0x1d')]);}}}else{var _0x1166b5=_(_0x282914[_0x055e('0x3e')])[_0x055e('0x73')]()['map'](function(_0x43f475){return _[_0x055e('0x74')](_0x2f60fa,[_0x055e('0x2d'),_0x43f475])?_0x43f475:undefined;})['compact']()[_0x055e('0x5f')]();if(!_[_0x055e('0x75')](_0x1166b5)){_0x1166b5[_0x055e('0x35')](function(_0x2262e1){if(_0x2262e1===_0x055e('0x76')){_0x19e29c['where'](_0x055e('0x77'),[]['concat'](_0x282914[_0x055e('0x3e')][_0x2262e1]));}else if(_0x2262e1===_0x055e('0x78')){var _0x533c0a=JSON[_0x055e('0x79')](_0x282914[_0x055e('0x3e')][_0x2262e1])[_0x055e('0x7a')];var _0x2bdf06=JSON['parse'](_0x282914['query'][_0x2262e1])[_0x055e('0x7b')];_0x19e29c['where'](_0x055e('0x7c'),_0x533c0a,_0x2bdf06);}else{if(_0x282914[_0x055e('0x3e')][_0x2262e1]===_0x055e('0x7d')){_0x19e29c[_0x055e('0x47')]('i.'+_0x2262e1+_0x055e('0x7e'));}else{_0x19e29c[_0x055e('0x47')]('i.'+_0x2262e1+_0x055e('0x7f'),_0x282914[_0x055e('0x3e')][_0x2262e1]);}}});}if(_0x282914[_0x055e('0x3e')][_0x055e('0x80')]){if(_0x282914['query']['read']==0x1){_0x19e29c[_0x055e('0x60')](_0x055e('0x81'));}else{_0x19e29c['having'](_0x055e('0x82'));}}if(_0x282914['query'][_0x055e('0x83')]){_0x250cab=_[_0x055e('0x84')](_0x282914[_0x055e('0x3e')][_0x055e('0x83')])?_0x282914[_0x055e('0x3e')][_0x055e('0x83')]:new Array(_0x282914[_0x055e('0x3e')][_0x055e('0x83')]);_0x250cab['forEach'](function(_0x144fa1){_0xb4be7a['or'](_0x055e('0x6b'),'%,'+_0x144fa1+',%');});}if(_0x282914[_0x055e('0x3e')][_0x055e('0x85')]){var _0x148db3=_0x282914[_0x055e('0x3e')][_0x055e('0x85')][_0x055e('0x86')]('\x5c','\x5c\x5c')[_0x055e('0x86')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x055e('0x87')](_0x148db3)){_0x20114c['or'](_0x055e('0x88'),_0x148db3+'%')['or']('i.phone\x20LIKE\x20?',_0x148db3+'%');}else{_0x20114c['or'](_0x055e('0x89'),qs[_0x055e('0x8a')](_0x148db3))['or'](_0x055e('0x8b'),_0x148db3+'%');}}}_0x19e29c[_0x055e('0x47')](_0x20114c);_0x19e29c['group'](_0x055e('0x8c'));var _0x4dfba2={'type':db[_0x055e('0x8d')][_0x055e('0x8e')][_0x055e('0x8f')],'raw':!![]};var _0x525d4f=_0x19e29c[_0x055e('0x90')]();_0x525d4f[_0x055e('0x48')](_0x055e('0x8c'));_0x525d4f[_0x055e('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x055e('0x5e'));if(_0x13efb7[_0x055e('0x45')]){_0x13efb7[_0x055e('0x45')][_0x055e('0x35')](function(_0x29bb04){_0x19e29c['order']('i.'+_0x29bb04[0x0],_0x29bb04[0x1]===_0x055e('0x91')?![]:!![]);});}if(!_[_0x055e('0x75')](_0x250cab)){_0x19e29c[_0x055e('0x60')](_0xb4be7a);_0x525d4f[_0x055e('0x47')]('t.id\x20IN\x20?',_0x250cab);}BPromise[_0x055e('0x92')]()[_0x055e('0x29')](function(){if(!_0x128e11){if(_0x282914[_0x055e('0x3e')][_0x055e('0x76')]||_0x282914['query'][_0x055e('0x93')])return;_0x525d4f[_0x055e('0x47')](_0x055e('0x94'));_0x19e29c[_0x055e('0x47')](_0x055e('0x94'));return;}return _0x282914['user'][_0x055e('0x95')]({'attributes':['id'],'raw':!![]})[_0x055e('0x29')](function(_0x2e5122){if(_['isEmpty'](_0x2e5122)){_0x525d4f['where'](_0x055e('0x96'));_0x19e29c['where'](_0x055e('0x96'));}else{_0x525d4f[_0x055e('0x47')]('i.SmsAccountId\x20IN\x20?',_[_0x055e('0x30')](_0x2e5122,'id'));_0x19e29c[_0x055e('0x47')](_0x055e('0x77'),_[_0x055e('0x30')](_0x2e5122,'id'));}});})[_0x055e('0x29')](function(){db[_0x055e('0x97')][_0x055e('0x3e')](_0x525d4f[_0x055e('0x98')](),_0x4dfba2)[_0x055e('0x29')](function(_0x431b5e){_0x42a33e[_0x055e('0x20')]=_0x431b5e[_0x055e('0x43')];if(_0x42a33e[_0x055e('0x20')]===0x0)return[];return db[_0x055e('0x97')][_0x055e('0x3e')](_0x3a5bc5[_0x055e('0x98')](),_0x4dfba2)['then'](function(_0x27e80f){_0x4ff19e=_['keyBy'](_0x27e80f,'id');_0x4dfba2=_['merge'](_0x4dfba2,{'model':db[_0x055e('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x282914[_0x055e('0x3e')][_0x055e('0x41')]){_0x13efb7['attributes'][_0x055e('0x35')](function(_0x265b94){_0x19e29c['field']('i.'+_0x265b94);});}else{_0x19e29c[_0x055e('0x48')](_0x055e('0x99'),'unreadMessages');_0x19e29c[_0x055e('0x48')]('a.key',_0x055e('0x9a'));_0x19e29c[_0x055e('0x48')](_0x055e('0x9b'),_0x055e('0x9c'));_0x19e29c['field']('i.*');_0x19e29c['field'](_0x055e('0x9d'),'Contact.firstName');_0x19e29c['field'](_0x055e('0x9e'),'Contact.lastName');_0x19e29c[_0x055e('0x48')](_0x055e('0x9f'),_0x055e('0xa0'));_0x19e29c[_0x055e('0x48')]('c.phone','Contact.phone');_0x19e29c[_0x055e('0x48')](_0x055e('0xa1'),_0x055e('0xa2'));_0x19e29c[_0x055e('0x48')](_0x055e('0xa3'),_0x055e('0xa4'));_0x19e29c[_0x055e('0x48')]('o.fullname',_0x055e('0xa5'));_0x19e29c['field']('o.internal',_0x055e('0xa6'));_0x19e29c[_0x055e('0x48')](_0x055e('0xa7'),'TagIds');}if(_0x13efb7[_0x055e('0x22')])_0x19e29c[_0x055e('0x22')](_0x13efb7[_0x055e('0x22')]);if(_0x13efb7['offset'])_0x19e29c[_0x055e('0x21')](_0x13efb7[_0x055e('0x21')]);return db[_0x055e('0x97')][_0x055e('0x3e')](_0x19e29c[_0x055e('0x98')](),_0x4dfba2);})[_0x055e('0x29')](function(_0x2ec6d1){_0x20b951[_0x055e('0x47')](_0x055e('0xa8'),_[_0x055e('0x30')](_0x2ec6d1,'id'));return db[_0x055e('0x97')][_0x055e('0x3e')](_0x20b951[_0x055e('0x98')](),_0x4dfba2)[_0x055e('0x29')](function(_0xd6807d){var _0x3df4d8=_['groupBy'](_0xd6807d,_0x055e('0xa9'));var _0x208e75=[];_0x2ec6d1[_0x055e('0x35')](function(_0x4ac58f){_0x208e75['push'](updateSmsInteraction(_0x4ac58f,_0x4ff19e,_0x3df4d8));});return BPromise['all'](_0x208e75);});});})[_0x055e('0x29')](function(_0x10cee9){_0x42a33e[_0x055e('0xaa')]=_0x10cee9;return _0x42a33e;})[_0x055e('0x29')](respondWithFilteredResult(_0x16a4fa,_0x13efb7));})[_0x055e('0x37')](handleError(_0x16a4fa,null));};exports[_0x055e('0xab')]=function(_0x2c6c7d,_0x2f9a0f){var _0x546ca6={'raw':![],'where':{'id':_0x2c6c7d[_0x055e('0xac')]['id']}},_0x3aef2f={};_0x3aef2f[_0x055e('0x3d')]=_[_0x055e('0x73')](db[_0x055e('0x39')][_0x055e('0xad')]);_0x3aef2f[_0x055e('0x3e')]=_[_0x055e('0x73')](_0x2c6c7d[_0x055e('0x3e')]);_0x3aef2f[_0x055e('0x3f')]=_[_0x055e('0x40')](_0x3aef2f[_0x055e('0x3d')],_0x3aef2f['query']);_0x546ca6['attributes']=_[_0x055e('0x40')](_0x3aef2f[_0x055e('0x3d')],qs[_0x055e('0x41')](_0x2c6c7d['query'][_0x055e('0x41')]));_0x546ca6[_0x055e('0x42')]=_0x546ca6[_0x055e('0x42')]['length']?_0x546ca6[_0x055e('0x42')]:_0x3aef2f['model'];if(_0x2c6c7d[_0x055e('0x3e')]['includeAll']){_0x546ca6[_0x055e('0xae')]=[{'all':!![]}];}_0x546ca6=_[_0x055e('0xaf')]({},_0x546ca6,_0x2c6c7d['options']);return db['SmsInteraction'][_0x055e('0x6f')](_0x546ca6)['then'](handleEntityNotFound(_0x2f9a0f,null))['then'](respondWithResult(_0x2f9a0f,null))[_0x055e('0x37')](handleError(_0x2f9a0f,null));};exports[_0x055e('0xb0')]=function(_0x2e3249,_0x46bbaa){return db[_0x055e('0x39')]['create'](_0x2e3249[_0x055e('0x72')],{})[_0x055e('0x29')](respondWithResult(_0x46bbaa,0xc9))['catch'](handleError(_0x46bbaa,null));};exports[_0x055e('0x28')]=function(_0x1d39a6,_0x14ea19){if(_0x1d39a6[_0x055e('0x72')]['id']){delete _0x1d39a6[_0x055e('0x72')]['id'];}return db[_0x055e('0x39')][_0x055e('0x6f')]({'where':{'id':_0x1d39a6[_0x055e('0xac')]['id']}})['then'](handleEntityNotFound(_0x14ea19,null))[_0x055e('0x29')](saveUpdates(_0x1d39a6[_0x055e('0x72')],null))[_0x055e('0x29')](respondWithResult(_0x14ea19,null))[_0x055e('0x37')](handleError(_0x14ea19,null));};exports[_0x055e('0x2a')]=function(_0x3bcc80,_0xf22117){return db[_0x055e('0x39')][_0x055e('0x6f')]({'where':{'id':_0x3bcc80[_0x055e('0xac')]['id']}})[_0x055e('0x29')](handleEntityNotFound(_0xf22117,null))['then'](removeEntity(_0xf22117,null))[_0x055e('0x37')](handleError(_0xf22117,null));};exports[_0x055e('0xb1')]=function(_0x35a0bc,_0x555839){return db['SmsInteraction'][_0x055e('0xb1')]()[_0x055e('0x29')](respondWithResult(_0x555839,null))[_0x055e('0x37')](handleError(_0x555839,null));};exports[_0x055e('0xb2')]=function(_0xe63e29,_0x3cd8e5,_0x505cc4){return db[_0x055e('0xb3')][_0x055e('0x6f')]({'where':{'id':_0xe63e29[_0x055e('0xac')]['id']}})[_0x055e('0x29')](handleEntityNotFound(_0x3cd8e5,null))[_0x055e('0x29')](function(_0x20218f){if(_0x20218f){return _0x20218f[_0x055e('0xb2')](_0xe63e29[_0x055e('0x72')][_0x055e('0xb4')],_['omit'](_0xe63e29['body'],['ids','id'])||{});}})[_0x055e('0x29')](respondWithResult(_0x3cd8e5,null))[_0x055e('0x37')](handleError(_0x3cd8e5,null));};exports[_0x055e('0xb5')]=function(_0x540e41,_0x2baf49,_0x423aad){var _0x1fafc5={'raw':![],'where':{}};var _0x361c4e={};var _0x1ac2cc={'count':0x0,'rows':[]};return db[_0x055e('0x39')][_0x055e('0xb6')]({'where':{'id':_0x540e41[_0x055e('0xac')]['id']}})['then'](handleEntityNotFound(_0x2baf49,null))[_0x055e('0x29')](function(_0xd5c785){if(_0xd5c785){_0x361c4e['model']=_['keys'](db[_0x055e('0xb3')][_0x055e('0xad')]);_0x361c4e[_0x055e('0x3e')]=_[_0x055e('0x73')](_0x540e41['query']);_0x361c4e['filters']=_[_0x055e('0x40')](_0x361c4e[_0x055e('0x3d')],_0x361c4e[_0x055e('0x3e')]);_0x1fafc5[_0x055e('0x42')]=_[_0x055e('0x40')](_0x361c4e['model'],qs[_0x055e('0x41')](_0x540e41[_0x055e('0x3e')]['fields']));_0x1fafc5[_0x055e('0x42')]=_0x1fafc5['attributes']['length']?_0x1fafc5['attributes']:_0x361c4e[_0x055e('0x3d')];if(!_0x540e41[_0x055e('0x3e')]['hasOwnProperty'](_0x055e('0x44'))){_0x1fafc5[_0x055e('0x22')]=qs['limit'](_0x540e41[_0x055e('0x3e')]['limit']);_0x1fafc5[_0x055e('0x21')]=qs['offset'](_0x540e41[_0x055e('0x3e')][_0x055e('0x21')]);}_0x1fafc5[_0x055e('0x45')]=qs[_0x055e('0x46')](_0x540e41['query'][_0x055e('0x46')]);_0x1fafc5[_0x055e('0x47')]=qs['filters'](_[_0x055e('0xb7')](_0x540e41[_0x055e('0x3e')],_0x361c4e[_0x055e('0x3f')]));_0x1fafc5[_0x055e('0x47')][_0x055e('0xa9')]=_0xd5c785['id'];if(_0x540e41[_0x055e('0x3e')][_0x055e('0x85')]){_0x1fafc5[_0x055e('0x47')]=_[_0x055e('0xaf')](_0x1fafc5[_0x055e('0x47')],{'$or':_[_0x055e('0x30')](_0x1fafc5[_0x055e('0x42')],function(_0x4f9edd){var _0x156bc8={};_0x156bc8[_0x4f9edd]={'$like':'%'+_0x540e41[_0x055e('0x3e')][_0x055e('0x85')]+'%'};return _0x156bc8;})});}if(_0x540e41['query'][_0x055e('0x7a')]){var _0x484ee0=_0x540e41[_0x055e('0x3e')][_0x055e('0x7a')]['split'](',');var _0xfb3b6d={};_0xfb3b6d[_0x484ee0[0x0]]={'$gte':moment(_0x484ee0[0x1])['format'](_0x055e('0xb8'))};_0x1fafc5['where']=_[_0x055e('0xaf')](_0x1fafc5[_0x055e('0x47')],_0xfb3b6d);}_0x1fafc5=_['merge']({},_0x1fafc5,_0x540e41[_0x055e('0xb9')]);return db[_0x055e('0xb3')][_0x055e('0x20')]({'where':_0x1fafc5['where']})[_0x055e('0x29')](function(_0x1c97bc){_0x1ac2cc[_0x055e('0x20')]=_0x1c97bc;if(_0x540e41[_0x055e('0x3e')][_0x055e('0xba')]){_0x1fafc5[_0x055e('0xae')]=[{'all':!![]}];}return db['SmsMessage'][_0x055e('0xbb')](_0x1fafc5);})['then'](function(_0xb9f32){_0x1ac2cc[_0x055e('0xaa')]=_0xb9f32;return _0x1ac2cc;});}})['then'](respondWithFilteredResult(_0x2baf49,_0x1fafc5))['catch'](handleError(_0x2baf49,null));};exports[_0x055e('0xbc')]=function(_0x5cb9f6,_0x47c423,_0x24b914){return db['SmsInteraction'][_0x055e('0x6f')]({'where':{'id':_0x5cb9f6['params']['id']}})[_0x055e('0x29')](handleEntityNotFound(_0x47c423,null))[_0x055e('0x29')](function(_0x39f91b){if(_0x39f91b){return _0x39f91b[_0x055e('0xbd')](_0x5cb9f6[_0x055e('0x72')]['ids'],_['omit'](_0x5cb9f6[_0x055e('0x72')],[_0x055e('0xb4'),'id'])||{})[_0x055e('0xbe')](function(){return db[_0x055e('0x6a')]['findAll']({'attributes':['id',_0x055e('0x2d'),_0x055e('0x49')],'where':{'id':_0x5cb9f6['body'][_0x055e('0xb4')]}});})[_0x055e('0x29')](function(_0x14f015){socket[_0x055e('0xbf')](_0x055e('0xc0'),{'id':Number(_0x5cb9f6[_0x055e('0xac')]['id']),'tags':_0x14f015||[]});return{'id':Number(_0x5cb9f6['params']['id']),'tags':_0x14f015||[]};});}})[_0x055e('0x29')](respondWithResult(_0x47c423,null))[_0x055e('0x37')](handleError(_0x47c423,null));};exports[_0x055e('0xc1')]=function(_0x557c92,_0x38a846,_0x7d100){return db[_0x055e('0x39')]['find']({'where':{'id':_0x557c92['params']['id']}})[_0x055e('0x29')](handleEntityNotFound(_0x38a846,null))[_0x055e('0x29')](function(_0x5276cd){if(_0x5276cd){return _0x5276cd['removeTags'](_0x557c92[_0x055e('0x3e')]['ids']);}})[_0x055e('0x29')](respondWithStatusCode(_0x38a846,null))[_0x055e('0x37')](handleError(_0x38a846,null));};exports[_0x055e('0xc2')]=function(_0x4c7afc,_0x1423f4){var _0x31db97=moment()[_0x055e('0xc3')]()['toString']();var _0x306b88=path['join'](config[_0x055e('0xc4')],_0x055e('0xc5'),_0x055e('0xc6'),_0x055e('0xc7'));var _0x27fb93=path[_0x055e('0xc8')](config[_0x055e('0xc4')],_0x055e('0xc5'),_0x055e('0xc6'),_0x055e('0xc9'));var _0xb88a07=path['join'](_0x306b88,_0x31db97);var _0x4ce80e=util[_0x055e('0xca')](_0x055e('0xcb'),_0x4c7afc[_0x055e('0xac')]['id'],_0x31db97);var _0x45c0c6=path[_0x055e('0xc8')](_0x306b88,_0x4ce80e);var _0x4405ad=[];_0x4405ad['push']({'model':db[_0x055e('0x6d')],'as':_0x055e('0x6d'),'attributes':['id',_0x055e('0x31')],'raw':!![]});_0x4405ad[_0x055e('0x36')]({'model':db[_0x055e('0xcc')],'as':_0x055e('0x62'),'attributes':['id',_0x055e('0xcd'),_0x055e('0xce')],'raw':!![]});var _0x4900bc=[{'model':db[_0x055e('0xb3')],'as':_0x055e('0xcf'),'attributes':['id','body',_0x055e('0x78'),_0x055e('0xd0'),'secret',_0x055e('0x80')],'include':_0x4405ad}];_0x4900bc[_0x055e('0x36')]({'model':db[_0x055e('0xd1')],'as':'Account','attributes':['id',_0x055e('0x2d')]});_0x4900bc['push']({'model':db['User'],'as':_0x055e('0xd2'),'attributes':['id',_0x055e('0x31')]});return db[_0x055e('0x39')][_0x055e('0x6f')]({'where':{'id':_0x4c7afc[_0x055e('0xac')]['id']},'include':_0x4900bc})[_0x055e('0x29')](handleEntityNotFound(_0x1423f4,null))[_0x055e('0x29')](function(_0x144713){if(_0x144713){var _0x26c946=_0x144713[_0x055e('0xd3')]({'plain':!![]});fs[_0x055e('0xd4')](_0xb88a07);var _0x2a568c={'format':'A4','border':'10px','header':{'height':_0x055e('0xd5'),'contents':{'first':_0x055e('0xd6')}},'footer':{'height':_0x055e('0xd7'),'contents':{'default':util[_0x055e('0xca')](_0x055e('0xd8'),util[_0x055e('0xca')](_0x055e('0xd9'),'Sms',_0x26c946['id']),moment()[_0x055e('0xca')](_0x055e('0xda'))[_0x055e('0x98')]())}}};var _0x251e7a={'channel':_0x055e('0xdb'),'account':_0x26c946[_0x055e('0xdc')][_0x055e('0x2d')],'agent':_0x26c946[_0x055e('0xd2')]?_0x26c946[_0x055e('0xd2')][_0x055e('0x31')]:'N.A.','createdAt':moment(_0x26c946['createdAt'])[_0x055e('0xca')](_0x055e('0xb8'))[_0x055e('0x98')](),'closedAt':_0x26c946[_0x055e('0xdd')]?moment(_0x26c946[_0x055e('0xde')])['format'](_0x055e('0xb8'))[_0x055e('0x98')]():'','disposition':_0x26c946[_0x055e('0xdf')],'messages':_(_0x26c946[_0x055e('0xcf')])[_0x055e('0x85')]({'secret':![]})['map'](function(_0x279b39){return{'date':moment(_0x279b39[_0x055e('0x78')])[_0x055e('0xca')](_0x055e('0xb8'))[_0x055e('0x98')](),'sender':_0x279b39[_0x055e('0xd0')]===_0x055e('0xe0')?_0x279b39[_0x055e('0x6d')]?_0x279b39[_0x055e('0x6d')][_0x055e('0x31')]:_0x055e('0xe1'):_0x279b39['Contact'][_0x055e('0xcd')]+(_0x279b39['Contact'][_0x055e('0xce')]?'\x20'+_0x279b39[_0x055e('0x62')]['lastName']:''),'body':_0x279b39['body'],'direction':_0x279b39['direction']===_0x055e('0xe0')?'A':'C','secret':_0x279b39[_0x055e('0xe2')],'read':_0x279b39['read']};})[_0x055e('0x5f')]()};return ejs[_0x055e('0xe3')](path[_0x055e('0xc8')](config[_0x055e('0xc4')],_0x055e('0xc5'),_0x055e('0xe4'),'downloadInteraction.html'),{'interaction':_0x251e7a})[_0x055e('0x29')](function(_0x1523d9){return new BPromise(function(_0x562362,_0x22c7ef){pdf[_0x055e('0xb0')](_0x1523d9,_0x2a568c)['toFile'](path[_0x055e('0xc8')](_0xb88a07,_0x055e('0xe5')+_0x26c946['id']+'-'+_0x31db97+'.pdf'),function(_0x3c7f35,_0x51d323){if(_0x3c7f35)return _0x22c7ef(_0x3c7f35);_0x562362(_0x51d323);});});})[_0x055e('0x29')](function(){return new BPromise(function(_0x481ea0,_0xb60055){zipdir(_0xb88a07,{'saveTo':_0x45c0c6},function(_0x5819b5,_0x148621){if(_0x5819b5)return _0xb60055(_0x5819b5);return _0x481ea0(_0x148621);});})[_0x055e('0x29')](function(){return new BPromise(function(_0x26399c,_0x25011f){rimraf(_0xb88a07,function(_0xe83c1f){if(_0xe83c1f)_0x25011f(_0xe83c1f);return _0x26399c();});});})[_0x055e('0x29')](function(){return _0x1423f4[_0x055e('0xc2')](_0x45c0c6,_0x4ce80e,function(_0x197faf){if(_0x197faf){console['log'](_0x055e('0xe6'),_0x197faf);}else{fs['unlinkSync'](_0x45c0c6);}});});});}else{return _0x1423f4['sendStatus'](0xc8);}})[_0x055e('0x37')](handleError(_0x1423f4,null));}; \ No newline at end of file +var _0x6f0d=['union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$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','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','isEmpty','t.id\x20IN\x20?','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','getSmsAccounts','sequelize','toString','keyBy','merge','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','includeAll','options','create','body','update','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','color','smsInteractionTags:save','removeTags','download','files','tmp','join','root','attachments','transcript-%d-%s.zip','CmContact','lastName','Messages','direction','SmsAccount','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD','N.A.','closedAt','disposition','out','System','secret','renderFile','server','views','downloadInteraction.html','toFile','transcript-','log','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','status','json','count','offset','limit','Content-Range','apply','save','then','destroy','end','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','users','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','buildExpression','text','start','Tag'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x542533,_0x579fd2){_0x542533=_0x542533-0x0;var _0x2d2cf9=_0x6f0d[_0x542533];return _0x2d2cf9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd6f0('0x0'));var rimraf=require(_0xd6f0('0x1'));var zipdir=require(_0xd6f0('0x2'));var jsonpatch=require(_0xd6f0('0x3'));var rp=require('request-promise');var moment=require(_0xd6f0('0x4'));var BPromise=require(_0xd6f0('0x5'));var Mustache=require(_0xd6f0('0x6'));var util=require(_0xd6f0('0x7'));var path=require(_0xd6f0('0x8'));var sox=require('sox');var csv=require(_0xd6f0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var db=require(_0xd6f0('0x17'))['db'];config[_0xd6f0('0x18')]=_[_0xd6f0('0x19')](config[_0xd6f0('0x18')],{'host':_0xd6f0('0x1a'),'port':0x18eb});var socket=require(_0xd6f0('0x1b'))(new Redis(config[_0xd6f0('0x18')]));require(_0xd6f0('0x1c'))[_0xd6f0('0x1d')](socket);function respondWithStatusCode(_0x4ab979,_0x2b3f32){_0x2b3f32=_0x2b3f32||0xcc;return function(_0x354846){if(_0x354846){return _0x4ab979['sendStatus'](_0x2b3f32);}return _0x4ab979[_0xd6f0('0x1e')](_0x2b3f32)['end']();};}function respondWithResult(_0x3f4851,_0x154e3e){_0x154e3e=_0x154e3e||0xc8;return function(_0x41bd99){if(_0x41bd99){return _0x3f4851[_0xd6f0('0x1e')](_0x154e3e)[_0xd6f0('0x1f')](_0x41bd99);}};}function respondWithFilteredResult(_0x61defb,_0x25da0c){return function(_0x29fbb9){if(_0x29fbb9){var _0x2e71bd=_0x29fbb9[_0xd6f0('0x20')],_0x1862a9=_0x25da0c[_0xd6f0('0x21')],_0x23ab6c=_0x25da0c[_0xd6f0('0x21')]+_0x25da0c[_0xd6f0('0x22')],_0x17e7c6;if(_0x23ab6c>=_0x2e71bd){_0x23ab6c=_0x2e71bd;_0x17e7c6=0xc8;}else{_0x17e7c6=0xce;}_0x61defb['status'](_0x17e7c6);return _0x61defb['set'](_0xd6f0('0x23'),_0x1862a9+'-'+_0x23ab6c+'/'+_0x2e71bd)[_0xd6f0('0x1f')](_0x29fbb9);}return null;};}function patchUpdates(_0x1158dc){return function(_0x54300d){try{jsonpatch[_0xd6f0('0x24')](_0x54300d,_0x1158dc,!![]);}catch(_0x19a545){return BPromise['reject'](_0x19a545);}return _0x54300d[_0xd6f0('0x25')]();};}function saveUpdates(_0x515687,_0x1ee584){return function(_0x1c9d90){if(_0x1c9d90){return _0x1c9d90['update'](_0x515687)[_0xd6f0('0x26')](function(_0x45e99c){return _0x45e99c;});}return null;};}function removeEntity(_0x5ea2dd,_0x3dbdc3){return function(_0x402070){if(_0x402070){return _0x402070[_0xd6f0('0x27')]()['then'](function(){_0x5ea2dd[_0xd6f0('0x1e')](0xcc)[_0xd6f0('0x28')]();});}};}function handleEntityNotFound(_0x5ecb16,_0xcea0ae){return function(_0x551be8){if(!_0x551be8){_0x5ecb16[_0xd6f0('0x29')](0x194);}return _0x551be8;};}function handleError(_0x3fb5c3,_0x1630dc){_0x1630dc=_0x1630dc||0x1f4;return function(_0x3c1bff){logger[_0xd6f0('0x2a')](_0x3c1bff[_0xd6f0('0x2b')]);if(_0x3c1bff[_0xd6f0('0x2c')]){delete _0x3c1bff[_0xd6f0('0x2c')];}_0x3fb5c3['status'](_0x1630dc)[_0xd6f0('0x2d')](_0x3c1bff);};}function getInteractionUsers(_0x1982d3,_0x55656c){return new BPromise(function(_0x38a3e9,_0x385947){try{if(_0x55656c[_0x1982d3['id']]){_0x1982d3[_0xd6f0('0x2e')]=_[_0xd6f0('0x2f')](_0x55656c[_0x1982d3['id']],function(_0x1a3967){return{'id':_0x1a3967['id'],'fullname':_0x1a3967[_0xd6f0('0x30')]};});}}catch(_0x351fda){_0x385947(_0x351fda);}_0x38a3e9(_0x1982d3);});}function getInteractionTags(_0x3151f8,_0x465cf9){return new BPromise(function(_0x43f72f,_0x1dff9b){try{if(_0x3151f8[_0xd6f0('0x31')]){_0x3151f8[_0xd6f0('0x32')]=[];_0x3151f8[_0xd6f0('0x31')][_0xd6f0('0x33')](',')[_0xd6f0('0x34')](function(_0x31c493){_0x3151f8[_0xd6f0('0x32')][_0xd6f0('0x35')](_0x465cf9[_0x31c493]);});}delete _0x3151f8[_0xd6f0('0x31')];}catch(_0x3906ca){_0x1dff9b(_0x3906ca);}_0x43f72f(_0x3151f8);});}function updateSmsInteraction(_0x26ab29,_0x4a8ebe,_0x11124c){return new BPromise(function(_0x4ed523,_0x58d2c5){return getInteractionUsers(_0x26ab29,_0x11124c)[_0xd6f0('0x26')](function(_0x52e894){return getInteractionTags(_0x52e894,_0x4a8ebe);})[_0xd6f0('0x26')](function(_0x27ad7e){_0x4ed523(_0x27ad7e);})[_0xd6f0('0x36')](function(_0x5c482f){_0x58d2c5(_0x5c482f);});});}exports[_0xd6f0('0x37')]=function(_0x4e5f97,_0x27b5b0){var _0xbe1408={},_0x42c01a={},_0x1eecf0={'count':0x0,'rows':[]};var _0x518751=_['map'](db['SmsInteraction'][_0xd6f0('0x38')],function(_0xe2958d){return{'name':_0xe2958d['fieldName'],'type':_0xe2958d[_0xd6f0('0x39')]['key']};});_0x42c01a[_0xd6f0('0x3a')]=_[_0xd6f0('0x2f')](_0x518751,_0xd6f0('0x2c'));_0x42c01a[_0xd6f0('0x3b')]=_[_0xd6f0('0x3c')](_0x4e5f97[_0xd6f0('0x3b')]);_0x42c01a[_0xd6f0('0x3d')]=_['intersection'](_0x42c01a['model'],_0x42c01a[_0xd6f0('0x3b')]);_0xbe1408[_0xd6f0('0x3e')]=_[_0xd6f0('0x3f')](_0x42c01a['model'],qs['fields'](_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x40')]));_0xbe1408[_0xd6f0('0x3e')]=_0xbe1408[_0xd6f0('0x3e')][_0xd6f0('0x41')]?_0xbe1408[_0xd6f0('0x3e')]:_0x42c01a[_0xd6f0('0x3a')];if(!_0x4e5f97[_0xd6f0('0x3b')]['hasOwnProperty'](_0xd6f0('0x42'))){_0xbe1408[_0xd6f0('0x22')]=qs[_0xd6f0('0x22')](_0x4e5f97[_0xd6f0('0x3b')]['limit']);_0xbe1408[_0xd6f0('0x21')]=qs[_0xd6f0('0x21')](_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x21')]);}_0xbe1408[_0xd6f0('0x43')]=qs['sort'](_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x44')]);_0xbe1408[_0xd6f0('0x45')]=qs['filters'](_[_0xd6f0('0x46')](_0x4e5f97[_0xd6f0('0x3b')],_0x42c01a['filters']),_0x518751);var _0x516ffd=[];var _0x9cffd4=squel[_0xd6f0('0x47')]()[_0xd6f0('0x48')]('id')['field'](_0xd6f0('0x2c'))[_0xd6f0('0x48')]('color')[_0xd6f0('0x49')](_0xd6f0('0x4a'));var _0x2930c5=squel[_0xd6f0('0x47')]()['field'](_0xd6f0('0x4b'))[_0xd6f0('0x48')](_0xd6f0('0x4c'))[_0xd6f0('0x48')](_0xd6f0('0x4d'))[_0xd6f0('0x49')](_0xd6f0('0x4e'),'ui')[_0xd6f0('0x4f')]('users','u',_0xd6f0('0x50'));var _0x3d42ca=squel['select']()[_0xd6f0('0x49')](_0xd6f0('0x51'),'i')[_0xd6f0('0x4f')](_0xd6f0('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xd6f0('0x4f')](_0xd6f0('0x53'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xd6f0('0x54'),'a','a.id\x20=\x20i.SmsAccountId')[_0xd6f0('0x4f')](_0xd6f0('0x55'),'me',_0xd6f0('0x56'))['left_join'](_0xd6f0('0x57'),'it',_0xd6f0('0x58'))[_0xd6f0('0x4f')](_0xd6f0('0x4a'),'t',_0xd6f0('0x59'));var _0x4c42ce=squel[_0xd6f0('0x5a')]();var _0x5189a7=[];var _0x416a94=squel[_0xd6f0('0x5a')]();var _0x2eb338;if(_0x4e5f97[_0xd6f0('0x3b')]['search']){_0x2eb338=as['parseSearch'](_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x5b')]);var _0x56904a=_0x2eb338[_0xd6f0('0x5c')];for(var _0x56c448=0x0;_0x56c448<_0x2eb338[_0xd6f0('0x5d')][_0xd6f0('0x41')];_0x56c448++){var _0x49618b=_0x2eb338[_0xd6f0('0x5d')][_0x56c448];var _0x30082c='i';var _0x4d6bc0=_[_0xd6f0('0x5e')](_0x518751,[_0xd6f0('0x2c'),_0x49618b[_0xd6f0('0x48')]]);if(!_0x4d6bc0){switch(_0x49618b[_0xd6f0('0x48')]){case _0xd6f0('0x5f'):if(_0x49618b[_0xd6f0('0x60')]==0x1){_0x3d42ca[_0xd6f0('0x61')]('`'+_0x49618b[_0xd6f0('0x48')]+'`\x20=\x200');}else{_0x3d42ca[_0xd6f0('0x61')]('`'+_0x49618b[_0xd6f0('0x48')]+_0xd6f0('0x62'));}break;case _0xd6f0('0x63'):if(_0x49618b[_0xd6f0('0x64')]===_0xd6f0('0x65')){if(_0x49618b[_0xd6f0('0x60')][_0xd6f0('0x33')]('\x20')[_0xd6f0('0x41')]>0x1){_0x4c42ce[_0x56904a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd6f0('0x66')](_0x49618b['value']),null);}else{var _0x5505fd='%'+_0x49618b[_0xd6f0('0x60')]+'%';_0x4c42ce[_0x56904a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5505fd,_0x5505fd,_0x5505fd);}}else{_0x4d6bc0=_['find'](_0x518751,[_0xd6f0('0x2c'),_0xd6f0('0x67')]);_0x49618b[_0xd6f0('0x48')]='ContactId';_0x269dd7=as[_0xd6f0('0x68')](_0x30082c,_0x4d6bc0[_0xd6f0('0x39')],_0x49618b);_0x4c42ce[_0x56904a](_0x269dd7[_0xd6f0('0x69')],_0x269dd7['value'][_0xd6f0('0x6a')],_0x269dd7[_0xd6f0('0x60')]['end']);}break;case _0xd6f0('0x6b'):var _0x328e0a=_0x49618b['value'][_0xd6f0('0x33')](',')[_0xd6f0('0x2f')](function(_0x22e511){return Number(_0x22e511);});_0x328e0a[_0xd6f0('0x34')](function(_0x3e6533){_0x416a94['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3e6533+',%');});_0x5189a7=_[_0xd6f0('0x6c')](_0x5189a7,_0x328e0a);break;case _0xd6f0('0x6d'):if(_0x49618b['operator']===_0xd6f0('0x65')){_0x4c42ce[_0x56904a](_0xd6f0('0x6e'),'%'+_0x49618b[_0xd6f0('0x60')]+'%',null);}else{_0x4d6bc0=_['find'](_0x518751,[_0xd6f0('0x2c'),'UserId']);_0x49618b['field']='UserId';_0x269dd7=as['buildExpression'](_0x30082c,_0x4d6bc0[_0xd6f0('0x39')],_0x49618b);_0x4c42ce[_0x56904a](_0x269dd7[_0xd6f0('0x69')],_0x269dd7[_0xd6f0('0x60')][_0xd6f0('0x6a')],_0x269dd7['value'][_0xd6f0('0x28')]);}break;case'body':_0x269dd7=as[_0xd6f0('0x68')]('me',null,_0x49618b);_0x4c42ce[_0x56904a](_0x269dd7[_0xd6f0('0x69')],_0x269dd7[_0xd6f0('0x60')]['start'],_0x269dd7[_0xd6f0('0x60')][_0xd6f0('0x28')]);break;}}else{var _0x269dd7=as[_0xd6f0('0x68')](_0x30082c,_0x4d6bc0['type'],_0x49618b);_0x4c42ce[_0x56904a](_0x269dd7[_0xd6f0('0x69')],_0x269dd7[_0xd6f0('0x60')][_0xd6f0('0x6a')],_0x269dd7['value'][_0xd6f0('0x28')]);}}}else{var _0x3e74c9=_(_0x4e5f97[_0xd6f0('0x3b')])[_0xd6f0('0x3c')]()['map'](function(_0x1bde72){return _[_0xd6f0('0x6f')](_0x518751,[_0xd6f0('0x2c'),_0x1bde72])?_0x1bde72:undefined;})[_0xd6f0('0x70')]()['value']();if(!_['isEmpty'](_0x3e74c9)){_0x3e74c9['forEach'](function(_0x5ed780){if(_0x5ed780===_0xd6f0('0x71')){_0x3d42ca[_0xd6f0('0x45')](_0xd6f0('0x72'),[][_0xd6f0('0x73')](_0x4e5f97[_0xd6f0('0x3b')][_0x5ed780]));}else if(_0x5ed780===_0xd6f0('0x74')){var _0x39f937=JSON[_0xd6f0('0x75')](_0x4e5f97[_0xd6f0('0x3b')][_0x5ed780])['$gte'];var _0x55f96e=JSON[_0xd6f0('0x75')](_0x4e5f97['query'][_0x5ed780])[_0xd6f0('0x76')];_0x3d42ca[_0xd6f0('0x45')](_0xd6f0('0x77'),_0x39f937,_0x55f96e);}else{if(_0x4e5f97[_0xd6f0('0x3b')][_0x5ed780]===_0xd6f0('0x78')){_0x3d42ca[_0xd6f0('0x45')]('i.'+_0x5ed780+_0xd6f0('0x79'));}else{_0x3d42ca['where']('i.'+_0x5ed780+_0xd6f0('0x7a'),_0x4e5f97[_0xd6f0('0x3b')][_0x5ed780]);}}});}if(_0x4e5f97[_0xd6f0('0x3b')]['read']){if(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x7b')]==0x1){_0x3d42ca['having'](_0xd6f0('0x7c'));}else{_0x3d42ca[_0xd6f0('0x61')](_0xd6f0('0x7d'));}}if(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x7e')]){_0x5189a7=_[_0xd6f0('0x7f')](_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x7e')])?_0x4e5f97[_0xd6f0('0x3b')]['tag']:new Array(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x7e')]);_0x5189a7[_0xd6f0('0x34')](function(_0x46cfba){_0x416a94['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x46cfba+',%');});}if(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x80')]){var _0x1e0e54=_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x80')][_0xd6f0('0x81')]('\x5c','\x5c\x5c')[_0xd6f0('0x81')]('\x27\x27',_0xd6f0('0x82'));if(qs[_0xd6f0('0x83')](_0x1e0e54)){_0x4c42ce['or'](_0xd6f0('0x84'),_0x1e0e54+'%')['or']('i.phone\x20LIKE\x20?',_0x1e0e54+'%');}else{_0x4c42ce['or'](_0xd6f0('0x85'),qs[_0xd6f0('0x66')](_0x1e0e54))['or'](_0xd6f0('0x86'),_0x1e0e54+'%');}}}_0x3d42ca['where'](_0x4c42ce);_0x3d42ca[_0xd6f0('0x87')](_0xd6f0('0x88'));var _0x343650={'type':db[_0xd6f0('0x89')][_0xd6f0('0x8a')][_0xd6f0('0x8b')],'raw':!![]};var _0x1c7f08=_0x3d42ca[_0xd6f0('0x8c')]();_0x1c7f08[_0xd6f0('0x48')](_0xd6f0('0x88'));_0x1c7f08[_0xd6f0('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0xbe1408[_0xd6f0('0x43')]){_0xbe1408[_0xd6f0('0x43')][_0xd6f0('0x34')](function(_0x44088b){_0x3d42ca[_0xd6f0('0x43')]('i.'+_0x44088b[0x0],_0x44088b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd6f0('0x8d')](_0x5189a7)){_0x3d42ca[_0xd6f0('0x61')](_0x416a94);_0x1c7f08['where'](_0xd6f0('0x8e'),_0x5189a7);}BPromise['resolve']()[_0xd6f0('0x26')](function(){if(!_0x2eb338){if(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x71')]||_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x8f')])return;_0x1c7f08['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x3d42ca[_0xd6f0('0x45')](_0xd6f0('0x90'));return;}return _0x4e5f97['user'][_0xd6f0('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x52bf7f){if(_[_0xd6f0('0x8d')](_0x52bf7f)){_0x1c7f08['where']('i.SmsAccountId\x20IS\x20NULL');_0x3d42ca['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0x1c7f08[_0xd6f0('0x45')](_0xd6f0('0x72'),_[_0xd6f0('0x2f')](_0x52bf7f,'id'));_0x3d42ca[_0xd6f0('0x45')](_0xd6f0('0x72'),_[_0xd6f0('0x2f')](_0x52bf7f,'id'));}});})[_0xd6f0('0x26')](function(){db[_0xd6f0('0x92')][_0xd6f0('0x3b')](_0x1c7f08['toString'](),_0x343650)[_0xd6f0('0x26')](function(_0x540609){_0x1eecf0['count']=_0x540609[_0xd6f0('0x41')];if(_0x1eecf0[_0xd6f0('0x20')]===0x0)return[];return db[_0xd6f0('0x92')]['query'](_0x9cffd4[_0xd6f0('0x93')](),_0x343650)[_0xd6f0('0x26')](function(_0xc0585c){_0x516ffd=_[_0xd6f0('0x94')](_0xc0585c,'id');_0x343650=_[_0xd6f0('0x95')](_0x343650,{'model':db[_0xd6f0('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4e5f97[_0xd6f0('0x3b')][_0xd6f0('0x40')]){_0xbe1408['attributes'][_0xd6f0('0x34')](function(_0x37a29b){_0x3d42ca['field']('i.'+_0x37a29b);});}else{_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0x97'),_0xd6f0('0x5f'));_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0x98'),_0xd6f0('0x99'));_0x3d42ca[_0xd6f0('0x48')]('a.mandatoryDisposition',_0xd6f0('0x9a'));_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0x9b'));_0x3d42ca['field']('c.firstName','Contact.firstName');_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0x9c'),_0xd6f0('0x9d'));_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0x9e'),_0xd6f0('0x9f'));_0x3d42ca['field'](_0xd6f0('0xa0'),_0xd6f0('0xa1'));_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0xa2'),'Contact.mobile');_0x3d42ca[_0xd6f0('0x48')]('c.fax',_0xd6f0('0xa3'));_0x3d42ca['field'](_0xd6f0('0xa4'),_0xd6f0('0xa5'));_0x3d42ca['field'](_0xd6f0('0xa6'),_0xd6f0('0xa7'));_0x3d42ca[_0xd6f0('0x48')](_0xd6f0('0xa8'),_0xd6f0('0x31'));}if(_0xbe1408[_0xd6f0('0x22')])_0x3d42ca[_0xd6f0('0x22')](_0xbe1408[_0xd6f0('0x22')]);if(_0xbe1408[_0xd6f0('0x21')])_0x3d42ca[_0xd6f0('0x21')](_0xbe1408[_0xd6f0('0x21')]);return db[_0xd6f0('0x92')][_0xd6f0('0x3b')](_0x3d42ca[_0xd6f0('0x93')](),_0x343650);})['then'](function(_0x119865){_0x2930c5[_0xd6f0('0x45')](_0xd6f0('0xa9'),_[_0xd6f0('0x2f')](_0x119865,'id'));return db[_0xd6f0('0x92')][_0xd6f0('0x3b')](_0x2930c5[_0xd6f0('0x93')](),_0x343650)[_0xd6f0('0x26')](function(_0x5d0600){var _0x38fc48=_[_0xd6f0('0xaa')](_0x5d0600,_0xd6f0('0xab'));var _0xcefe48=[];_0x119865[_0xd6f0('0x34')](function(_0x515d68){_0xcefe48['push'](updateSmsInteraction(_0x515d68,_0x516ffd,_0x38fc48));});return BPromise[_0xd6f0('0xac')](_0xcefe48);});});})[_0xd6f0('0x26')](function(_0x374e0b){_0x1eecf0[_0xd6f0('0xad')]=_0x374e0b;return _0x1eecf0;})[_0xd6f0('0x26')](respondWithFilteredResult(_0x27b5b0,_0xbe1408));})['catch'](handleError(_0x27b5b0,null));};exports[_0xd6f0('0xae')]=function(_0xb5c516,_0x2d0d8a){var _0x425ada={'raw':![],'where':{'id':_0xb5c516[_0xd6f0('0xaf')]['id']}},_0x57d201={};_0x57d201[_0xd6f0('0x3a')]=_[_0xd6f0('0x3c')](db[_0xd6f0('0x96')][_0xd6f0('0x38')]);_0x57d201[_0xd6f0('0x3b')]=_['keys'](_0xb5c516['query']);_0x57d201[_0xd6f0('0x3d')]=_['intersection'](_0x57d201[_0xd6f0('0x3a')],_0x57d201['query']);_0x425ada[_0xd6f0('0x3e')]=_[_0xd6f0('0x3f')](_0x57d201['model'],qs[_0xd6f0('0x40')](_0xb5c516['query'][_0xd6f0('0x40')]));_0x425ada[_0xd6f0('0x3e')]=_0x425ada[_0xd6f0('0x3e')][_0xd6f0('0x41')]?_0x425ada['attributes']:_0x57d201[_0xd6f0('0x3a')];if(_0xb5c516[_0xd6f0('0x3b')][_0xd6f0('0xb0')]){_0x425ada['include']=[{'all':!![]}];}_0x425ada=_[_0xd6f0('0x95')]({},_0x425ada,_0xb5c516[_0xd6f0('0xb1')]);return db[_0xd6f0('0x96')]['find'](_0x425ada)['then'](handleEntityNotFound(_0x2d0d8a,null))[_0xd6f0('0x26')](respondWithResult(_0x2d0d8a,null))[_0xd6f0('0x36')](handleError(_0x2d0d8a,null));};exports[_0xd6f0('0xb2')]=function(_0x4b113a,_0x40d4b3){return db[_0xd6f0('0x96')][_0xd6f0('0xb2')](_0x4b113a[_0xd6f0('0xb3')],{})[_0xd6f0('0x26')](respondWithResult(_0x40d4b3,0xc9))[_0xd6f0('0x36')](handleError(_0x40d4b3,null));};exports[_0xd6f0('0xb4')]=function(_0x5eeff2,_0x27715b){if(_0x5eeff2['body']['id']){delete _0x5eeff2[_0xd6f0('0xb3')]['id'];}return db[_0xd6f0('0x96')][_0xd6f0('0x5e')]({'where':{'id':_0x5eeff2['params']['id']}})[_0xd6f0('0x26')](handleEntityNotFound(_0x27715b,null))['then'](saveUpdates(_0x5eeff2['body'],null))[_0xd6f0('0x26')](respondWithResult(_0x27715b,null))[_0xd6f0('0x36')](handleError(_0x27715b,null));};exports[_0xd6f0('0x27')]=function(_0x5b270f,_0x446896){return db['SmsInteraction']['find']({'where':{'id':_0x5b270f[_0xd6f0('0xaf')]['id']}})[_0xd6f0('0x26')](handleEntityNotFound(_0x446896,null))[_0xd6f0('0x26')](removeEntity(_0x446896,null))[_0xd6f0('0x36')](handleError(_0x446896,null));};exports[_0xd6f0('0xb5')]=function(_0x468cf5,_0x5aab52){return db[_0xd6f0('0x96')]['describe']()[_0xd6f0('0x26')](respondWithResult(_0x5aab52,null))['catch'](handleError(_0x5aab52,null));};exports[_0xd6f0('0xb6')]=function(_0x1dce9c,_0x58c187,_0x212920){return db[_0xd6f0('0xb7')][_0xd6f0('0x5e')]({'where':{'id':_0x1dce9c[_0xd6f0('0xaf')]['id']}})[_0xd6f0('0x26')](handleEntityNotFound(_0x58c187,null))[_0xd6f0('0x26')](function(_0xd905e3){if(_0xd905e3){return _0xd905e3[_0xd6f0('0xb6')](_0x1dce9c['body'][_0xd6f0('0xb8')],_[_0xd6f0('0xb9')](_0x1dce9c['body'],[_0xd6f0('0xb8'),'id'])||{});}})['then'](respondWithResult(_0x58c187,null))[_0xd6f0('0x36')](handleError(_0x58c187,null));};exports[_0xd6f0('0xba')]=function(_0x26aafd,_0x89a039,_0x4e2fa0){var _0x4f98a6={'raw':![],'where':{}};var _0x3638b7={};var _0x16160d={'count':0x0,'rows':[]};return db[_0xd6f0('0x96')][_0xd6f0('0xbb')]({'where':{'id':_0x26aafd[_0xd6f0('0xaf')]['id']}})[_0xd6f0('0x26')](handleEntityNotFound(_0x89a039,null))[_0xd6f0('0x26')](function(_0x563c11){if(_0x563c11){_0x3638b7[_0xd6f0('0x3a')]=_[_0xd6f0('0x3c')](db[_0xd6f0('0xb7')][_0xd6f0('0x38')]);_0x3638b7['query']=_[_0xd6f0('0x3c')](_0x26aafd['query']);_0x3638b7['filters']=_[_0xd6f0('0x3f')](_0x3638b7['model'],_0x3638b7[_0xd6f0('0x3b')]);_0x4f98a6[_0xd6f0('0x3e')]=_[_0xd6f0('0x3f')](_0x3638b7[_0xd6f0('0x3a')],qs[_0xd6f0('0x40')](_0x26aafd[_0xd6f0('0x3b')][_0xd6f0('0x40')]));_0x4f98a6['attributes']=_0x4f98a6[_0xd6f0('0x3e')][_0xd6f0('0x41')]?_0x4f98a6[_0xd6f0('0x3e')]:_0x3638b7['model'];if(!_0x26aafd[_0xd6f0('0x3b')][_0xd6f0('0xbc')](_0xd6f0('0x42'))){_0x4f98a6[_0xd6f0('0x22')]=qs['limit'](_0x26aafd[_0xd6f0('0x3b')]['limit']);_0x4f98a6[_0xd6f0('0x21')]=qs['offset'](_0x26aafd[_0xd6f0('0x3b')][_0xd6f0('0x21')]);}_0x4f98a6[_0xd6f0('0x43')]=qs[_0xd6f0('0x44')](_0x26aafd[_0xd6f0('0x3b')][_0xd6f0('0x44')]);_0x4f98a6[_0xd6f0('0x45')]=qs['filters'](_['pick'](_0x26aafd[_0xd6f0('0x3b')],_0x3638b7['filters']));_0x4f98a6[_0xd6f0('0x45')][_0xd6f0('0xab')]=_0x563c11['id'];if(_0x26aafd[_0xd6f0('0x3b')][_0xd6f0('0x80')]){_0x4f98a6[_0xd6f0('0x45')]=_[_0xd6f0('0x95')](_0x4f98a6[_0xd6f0('0x45')],{'$or':_[_0xd6f0('0x2f')](_0x4f98a6[_0xd6f0('0x3e')],function(_0x33ae30){var _0x37df8d={};_0x37df8d[_0x33ae30]={'$like':'%'+_0x26aafd['query'][_0xd6f0('0x80')]+'%'};return _0x37df8d;})});}if(_0x26aafd['query'][_0xd6f0('0xbd')]){var _0x210946=_0x26aafd['query'][_0xd6f0('0xbd')][_0xd6f0('0x33')](',');var _0x3704e6={};_0x3704e6[_0x210946[0x0]]={'$gte':moment(_0x210946[0x1])[_0xd6f0('0xbe')](_0xd6f0('0xbf'))};_0x4f98a6[_0xd6f0('0x45')]=_[_0xd6f0('0x95')](_0x4f98a6[_0xd6f0('0x45')],_0x3704e6);}_0x4f98a6=_[_0xd6f0('0x95')]({},_0x4f98a6,_0x26aafd['options']);return db[_0xd6f0('0xb7')][_0xd6f0('0x20')]({'where':_0x4f98a6['where']})[_0xd6f0('0x26')](function(_0x592b10){_0x16160d['count']=_0x592b10;if(_0x26aafd['query'][_0xd6f0('0xb0')]){_0x4f98a6[_0xd6f0('0xc0')]=[{'all':!![]}];}return db['SmsMessage'][_0xd6f0('0xc1')](_0x4f98a6);})[_0xd6f0('0x26')](function(_0x3fb73f){_0x16160d[_0xd6f0('0xad')]=_0x3fb73f;return _0x16160d;});}})[_0xd6f0('0x26')](respondWithFilteredResult(_0x89a039,_0x4f98a6))[_0xd6f0('0x36')](handleError(_0x89a039,null));};exports[_0xd6f0('0xc2')]=function(_0x340ca1,_0x560a37,_0x2859ab){return db[_0xd6f0('0x96')]['find']({'where':{'id':_0x340ca1[_0xd6f0('0xaf')]['id']}})['then'](handleEntityNotFound(_0x560a37,null))[_0xd6f0('0x26')](function(_0x6752ae){if(_0x6752ae){return _0x6752ae[_0xd6f0('0xc3')](_0x340ca1[_0xd6f0('0xb3')]['ids'],_[_0xd6f0('0xb9')](_0x340ca1['body'],['ids','id'])||{})[_0xd6f0('0xc4')](function(){return db[_0xd6f0('0x6b')][_0xd6f0('0xc1')]({'attributes':['id','name',_0xd6f0('0xc5')],'where':{'id':_0x340ca1[_0xd6f0('0xb3')][_0xd6f0('0xb8')]}});})[_0xd6f0('0x26')](function(_0x259b01){socket['emit'](_0xd6f0('0xc6'),{'id':Number(_0x340ca1[_0xd6f0('0xaf')]['id']),'tags':_0x259b01||[]});return{'id':Number(_0x340ca1['params']['id']),'tags':_0x259b01||[]};});}})[_0xd6f0('0x26')](respondWithResult(_0x560a37,null))['catch'](handleError(_0x560a37,null));};exports[_0xd6f0('0xc7')]=function(_0x38c3ca,_0x46f385,_0x30f693){return db[_0xd6f0('0x96')][_0xd6f0('0x5e')]({'where':{'id':_0x38c3ca[_0xd6f0('0xaf')]['id']}})['then'](handleEntityNotFound(_0x46f385,null))['then'](function(_0x1f0880){if(_0x1f0880){return _0x1f0880['removeTags'](_0x38c3ca[_0xd6f0('0x3b')][_0xd6f0('0xb8')]);}})[_0xd6f0('0x26')](respondWithStatusCode(_0x46f385,null))['catch'](handleError(_0x46f385,null));};exports[_0xd6f0('0xc8')]=function(_0x498cc2,_0x39f781){var _0x2e2fc5=moment()['unix']()[_0xd6f0('0x93')]();var _0xc4e8c=path['join'](config['root'],'server',_0xd6f0('0xc9'),_0xd6f0('0xca'));var _0x3c5883=path[_0xd6f0('0xcb')](config[_0xd6f0('0xcc')],'server',_0xd6f0('0xc9'),_0xd6f0('0xcd'));var _0x1e908d=path[_0xd6f0('0xcb')](_0xc4e8c,_0x2e2fc5);var _0x211c2a=util[_0xd6f0('0xbe')](_0xd6f0('0xce'),_0x498cc2[_0xd6f0('0xaf')]['id'],_0x2e2fc5);var _0xa4c4e3=path[_0xd6f0('0xcb')](_0xc4e8c,_0x211c2a);var _0x6bc094=[];_0x6bc094[_0xd6f0('0x35')]({'model':db[_0xd6f0('0x6d')],'as':_0xd6f0('0x6d'),'attributes':['id','fullname'],'raw':!![]});_0x6bc094['push']({'model':db[_0xd6f0('0xcf')],'as':_0xd6f0('0x63'),'attributes':['id','firstName',_0xd6f0('0xd0')],'raw':!![]});var _0x2f7e8f=[{'model':db[_0xd6f0('0xb7')],'as':_0xd6f0('0xd1'),'attributes':['id',_0xd6f0('0xb3'),_0xd6f0('0x74'),_0xd6f0('0xd2'),'secret',_0xd6f0('0x7b')],'include':_0x6bc094}];_0x2f7e8f[_0xd6f0('0x35')]({'model':db[_0xd6f0('0xd3')],'as':_0xd6f0('0xd4'),'attributes':['id','name']});_0x2f7e8f[_0xd6f0('0x35')]({'model':db[_0xd6f0('0x6d')],'as':_0xd6f0('0xd5'),'attributes':['id','fullname']});return db[_0xd6f0('0x96')]['find']({'where':{'id':_0x498cc2[_0xd6f0('0xaf')]['id']},'include':_0x2f7e8f})[_0xd6f0('0x26')](handleEntityNotFound(_0x39f781,null))[_0xd6f0('0x26')](function(_0x2aa249){if(_0x2aa249){var _0x356b9b=_0x2aa249[_0xd6f0('0xd6')]({'plain':!![]});fs[_0xd6f0('0xd7')](_0x1e908d);var _0x1c2650={'format':'A4','border':_0xd6f0('0xd8'),'header':{'height':_0xd6f0('0xd9'),'contents':{'first':_0xd6f0('0xda')}},'footer':{'height':_0xd6f0('0xdb'),'contents':{'default':util[_0xd6f0('0xbe')](_0xd6f0('0xdc'),util[_0xd6f0('0xbe')](_0xd6f0('0xdd'),'Sms',_0x356b9b['id']),moment()[_0xd6f0('0xbe')](_0xd6f0('0xde'))[_0xd6f0('0x93')]())}}};var _0x1b50a5={'channel':'Sms','account':_0x356b9b[_0xd6f0('0xd4')]['name'],'agent':_0x356b9b['Owner']?_0x356b9b[_0xd6f0('0xd5')]['fullname']:_0xd6f0('0xdf'),'createdAt':moment(_0x356b9b[_0xd6f0('0x74')])[_0xd6f0('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd6f0('0x93')](),'closedAt':_0x356b9b['closed']?moment(_0x356b9b[_0xd6f0('0xe0')])[_0xd6f0('0xbe')](_0xd6f0('0xbf'))['toString']():'','disposition':_0x356b9b[_0xd6f0('0xe1')],'messages':_(_0x356b9b[_0xd6f0('0xd1')])[_0xd6f0('0x80')]({'secret':![]})[_0xd6f0('0x2f')](function(_0x108dd8){return{'date':moment(_0x108dd8[_0xd6f0('0x74')])['format'](_0xd6f0('0xbf'))[_0xd6f0('0x93')](),'sender':_0x108dd8[_0xd6f0('0xd2')]===_0xd6f0('0xe2')?_0x108dd8['User']?_0x108dd8[_0xd6f0('0x6d')]['fullname']:_0xd6f0('0xe3'):_0x108dd8['Contact']['firstName']+(_0x108dd8[_0xd6f0('0x63')][_0xd6f0('0xd0')]?'\x20'+_0x108dd8[_0xd6f0('0x63')]['lastName']:''),'body':_0x108dd8[_0xd6f0('0xb3')],'direction':_0x108dd8['direction']===_0xd6f0('0xe2')?'A':'C','secret':_0x108dd8[_0xd6f0('0xe4')],'read':_0x108dd8[_0xd6f0('0x7b')]};})[_0xd6f0('0x60')]()};return ejs[_0xd6f0('0xe5')](path[_0xd6f0('0xcb')](config[_0xd6f0('0xcc')],_0xd6f0('0xe6'),_0xd6f0('0xe7'),_0xd6f0('0xe8')),{'interaction':_0x1b50a5})[_0xd6f0('0x26')](function(_0x1b4af2){return new BPromise(function(_0x4b964b,_0x4d99ac){pdf[_0xd6f0('0xb2')](_0x1b4af2,_0x1c2650)[_0xd6f0('0xe9')](path[_0xd6f0('0xcb')](_0x1e908d,_0xd6f0('0xea')+_0x356b9b['id']+'-'+_0x2e2fc5+'.pdf'),function(_0x27e590,_0x5e4556){if(_0x27e590)return _0x4d99ac(_0x27e590);_0x4b964b(_0x5e4556);});});})[_0xd6f0('0x26')](function(){return new BPromise(function(_0x220e81,_0x3f32e6){zipdir(_0x1e908d,{'saveTo':_0xa4c4e3},function(_0x1244e7,_0x4649d2){if(_0x1244e7)return _0x3f32e6(_0x1244e7);return _0x220e81(_0x4649d2);});})['then'](function(){return new BPromise(function(_0x2ce814,_0x174f35){rimraf(_0x1e908d,function(_0x4c3b1d){if(_0x4c3b1d)_0x174f35(_0x4c3b1d);return _0x2ce814();});});})[_0xd6f0('0x26')](function(){return _0x39f781[_0xd6f0('0xc8')](_0xa4c4e3,_0x211c2a,function(_0x2e7576){if(_0x2e7576){console[_0xd6f0('0xeb')]('err',_0x2e7576);}else{fs['unlinkSync'](_0xa4c4e3);}});});});}else{return _0x39f781[_0xd6f0('0x29')](0xc8);}})[_0xd6f0('0x36')](handleError(_0x39f781,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index d81fc1f..f455c18 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 _0xcb99=['length','emit','catch','hasOwnProperty','events','SmsInteraction','setMaxListeners','save','update','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x51db22,_0x198ad2){var _0x80faef=function(_0x8b4331){while(--_0x8b4331){_0x51db22['push'](_0x51db22['shift']());}};_0x80faef(++_0x198ad2);}(_0xcb99,0x8b));var _0x9cb9=function(_0x4911ed,_0x476941){_0x4911ed=_0x4911ed-0x0;var _0x230288=_0xcb99[_0x4911ed];return _0x230288;};'use strict';var EventEmitter=require(_0x9cb9('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x9cb9('0x1')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9cb9('0x2')](0x0);var events={'afterCreate':_0x9cb9('0x3'),'afterUpdate':_0x9cb9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x167735){return function(_0x41788c,_0x544d32,_0x214b72){_0x41788c['getUsers']({'attributes':['id'],'raw':!![]})[_0x9cb9('0x5')](function(_0xa84493){_0x41788c[_0x9cb9('0x6')](_0x9cb9('0x7'),_0xa84493[_0x9cb9('0x8')](function(_0x124bd0){return{'id':_0x124bd0['id']};}));return SmsMessage[_0x9cb9('0x9')]({'where':{'SmsInteractionId':_0x41788c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9cb9('0x5')](function(_0x48d99a){_0x41788c['setDataValue'](_0x9cb9('0xa'),_0x48d99a[_0x9cb9('0xb')]);SmsInteractionEvents[_0x9cb9('0xc')](_0x167735+':'+_0x41788c['id'],_0x41788c);SmsInteractionEvents['emit'](_0x167735,_0x41788c);_0x214b72(null);})[_0x9cb9('0xd')](_0x214b72(null));};}for(var e in events){if(events[_0x9cb9('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xd67b=['map','findAll','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage','setMaxListeners','update','getUsers','then','setDataValue','Users'];(function(_0x4d4c66,_0x557376){var _0x3e2a3b=function(_0x107067){while(--_0x107067){_0x4d4c66['push'](_0x4d4c66['shift']());}};_0x3e2a3b(++_0x557376);}(_0xd67b,0x133));var _0xbd67=function(_0x1e8533,_0x42deba){_0x1e8533=_0x1e8533-0x0;var _0xa44709=_0xd67b[_0x1e8533];return _0xa44709;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xbd67('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0xbd67('0x0'))['db'][_0xbd67('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xbd67('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbd67('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1bf96){return function(_0x5a827b,_0x309962,_0xa5c384){_0x5a827b[_0xbd67('0x4')]({'attributes':['id'],'raw':!![]})[_0xbd67('0x5')](function(_0x1860c9){_0x5a827b[_0xbd67('0x6')](_0xbd67('0x7'),_0x1860c9[_0xbd67('0x8')](function(_0x1da7f1){return{'id':_0x1da7f1['id']};}));return SmsMessage[_0xbd67('0x9')]({'where':{'SmsInteractionId':_0x5a827b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbd67('0x5')](function(_0x3a7f43){_0x5a827b[_0xbd67('0x6')]('unreadMessages',_0x3a7f43['length']);SmsInteractionEvents[_0xbd67('0xa')](_0x1bf96+':'+_0x5a827b['id'],_0x5a827b);SmsInteractionEvents['emit'](_0x1bf96,_0x5a827b);_0xa5c384(null);})[_0xbd67('0xb')](_0xa5c384(null));};}for(var e in events){if(events[_0xbd67('0xc')](e)){var event=events[e];SmsInteraction[_0xbd67('0xd')](e,emitEvent(event));}}module[_0xbd67('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a8939d3..ef0d235 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 _0xeda6=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','define','sms_interactions','changed','closed'];(function(_0x4ac00b,_0x486aa9){var _0x3ed73f=function(_0x29fd28){while(--_0x29fd28){_0x4ac00b['push'](_0x4ac00b['shift']());}};_0x3ed73f(++_0x486aa9);}(_0xeda6,0xa7));var _0x6eda=function(_0x38e6c1,_0x65eb49){_0x38e6c1=_0x38e6c1-0x0;var _0x28d507=_0xeda6[_0x38e6c1];return _0x28d507;};'use strict';var _=require(_0x6eda('0x0'));var util=require(_0x6eda('0x1'));var logger=require('../../config/logger')(_0x6eda('0x2'));var moment=require(_0x6eda('0x3'));var BPromise=require(_0x6eda('0x4'));var rp=require(_0x6eda('0x5'));var fs=require('fs');var path=require(_0x6eda('0x6'));var rimraf=require('rimraf');var config=require(_0x6eda('0x7'));var attributes=require(_0x6eda('0x8'));module['exports']=function(_0x3ab5ef,_0x1002fe){return _0x3ab5ef[_0x6eda('0x9')]('SmsInteraction',attributes,{'tableName':_0x6eda('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xd9da8,_0x282fa2,_0xc46ba1){if(_0xd9da8[_0x6eda('0xb')](_0x6eda('0xc'))){_0xd9da8[_0x6eda('0xd')]=moment()['format'](_0x6eda('0xe'));}_0xc46ba1(null,_0xd9da8);}}});}; \ No newline at end of file +var _0x4af7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xe212e7,_0x2a7f83){var _0xfa290c=function(_0x23330f){while(--_0x23330f){_0xe212e7['push'](_0xe212e7['shift']());}};_0xfa290c(++_0x2a7f83);}(_0x4af7,0x121));var _0x74af=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x4af7[_0xfedc72];return _0x2c7c78;};'use strict';var _=require('lodash');var util=require(_0x74af('0x0'));var logger=require(_0x74af('0x1'))('api');var moment=require(_0x74af('0x2'));var BPromise=require(_0x74af('0x3'));var rp=require(_0x74af('0x4'));var fs=require('fs');var path=require(_0x74af('0x5'));var rimraf=require(_0x74af('0x6'));var config=require(_0x74af('0x7'));var attributes=require(_0x74af('0x8'));module[_0x74af('0x9')]=function(_0x523604,_0x42d092){return _0x523604['define'](_0x74af('0xa'),attributes,{'tableName':_0x74af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x39bbe1,_0x1cbb82,_0x20d5a7){if(_0x39bbe1[_0x74af('0xc')](_0x74af('0xd'))){_0x39bbe1[_0x74af('0xe')]=moment()[_0x74af('0xf')](_0x74af('0x10'));}_0x20d5a7(null,_0x39bbe1);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index bc8d8b6..398ff16 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 _0xbb64=['socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','attributes','stringify','find','where','addTags','body','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x2bb465,_0x5e00ee){var _0x1a4ce5=function(_0x18ef51){while(--_0x18ef51){_0x2bb465['push'](_0x2bb465['shift']());}};_0x1a4ce5(++_0x5e00ee);}(_0xbb64,0x118));var _0x4bb6=function(_0x27440c,_0x56558b){_0x27440c=_0x27440c-0x0;var _0xda47ee=_0xbb64[_0x27440c];return _0xda47ee;};'use strict';var _=require(_0x4bb6('0x0'));var util=require(_0x4bb6('0x1'));var moment=require('moment');var BPromise=require(_0x4bb6('0x2'));var rs=require(_0x4bb6('0x3'));var fs=require('fs');var Redis=require(_0x4bb6('0x4'));var db=require(_0x4bb6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bb6('0x6'))(_0x4bb6('0x7'));var config=require(_0x4bb6('0x8'));var jayson=require(_0x4bb6('0x9'));var client=jayson[_0x4bb6('0xa')][_0x4bb6('0xb')]({'port':0x232a});config[_0x4bb6('0xc')]=_[_0x4bb6('0xd')](config[_0x4bb6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4bb6('0xe'))(new Redis(config[_0x4bb6('0xc')]));require(_0x4bb6('0xf'))[_0x4bb6('0x10')](socket);function respondWithRpcPromise(_0x149cf6,_0x12aad4,_0x18aa3e){return new BPromise(function(_0x41d983,_0x254352){return client[_0x4bb6('0x11')](_0x149cf6,_0x18aa3e)[_0x4bb6('0x12')](function(_0x55e1a9){logger[_0x4bb6('0x13')](_0x4bb6('0x14'),_0x12aad4,'request\x20sent');logger[_0x4bb6('0x15')](_0x4bb6('0x16'),_0x12aad4,_0x4bb6('0x17'),JSON['stringify'](_0x55e1a9));if(_0x55e1a9['error']){if(_0x55e1a9[_0x4bb6('0x18')][_0x4bb6('0x19')]===0x1f4){logger[_0x4bb6('0x18')](_0x4bb6('0x14'),_0x12aad4,_0x55e1a9[_0x4bb6('0x18')][_0x4bb6('0x1a')]);return _0x254352(_0x55e1a9[_0x4bb6('0x18')][_0x4bb6('0x1a')]);}logger[_0x4bb6('0x18')](_0x4bb6('0x14'),_0x12aad4,_0x55e1a9[_0x4bb6('0x18')][_0x4bb6('0x1a')]);return _0x41d983(_0x55e1a9[_0x4bb6('0x18')][_0x4bb6('0x1a')]);}else{logger['info'](_0x4bb6('0x14'),_0x12aad4,_0x4bb6('0x17'));_0x41d983(_0x55e1a9['result']['message']);}})[_0x4bb6('0x1b')](function(_0x2f4b1c){logger['error'](_0x4bb6('0x14'),_0x12aad4,_0x2f4b1c);_0x254352(_0x2f4b1c);});});}exports[_0x4bb6('0x1c')]=function(_0x4dab4b){var _0x474576=this;return new Promise(function(_0x353274,_0x471680){return db[_0x4bb6('0x1d')][_0x4bb6('0x1e')](_0x4dab4b['body'],{'raw':_0x4dab4b[_0x4bb6('0x1f')]?_0x4dab4b['options'][_0x4bb6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dab4b['options']?_0x4dab4b[_0x4bb6('0x1f')]['where']||null:null,'attributes':_0x4dab4b[_0x4bb6('0x1f')]?_0x4dab4b[_0x4bb6('0x1f')][_0x4bb6('0x21')]||null:null,'limit':_0x4dab4b[_0x4bb6('0x1f')]?_0x4dab4b[_0x4bb6('0x1f')]['limit']||null:null})[_0x4bb6('0x12')](function(_0x233880){logger[_0x4bb6('0x13')]('UpdateSmsInteraction',_0x4dab4b);logger[_0x4bb6('0x15')](_0x4bb6('0x1c'),_0x4dab4b,JSON[_0x4bb6('0x22')](_0x233880));_0x353274(_0x233880);})[_0x4bb6('0x1b')](function(_0x19c4f7){logger[_0x4bb6('0x18')]('UpdateSmsInteraction',_0x19c4f7[_0x4bb6('0x1a')],_0x4dab4b);_0x471680(_0x474576[_0x4bb6('0x18')](0x1f4,_0x19c4f7[_0x4bb6('0x1a')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1b85ec){return new Promise(function(_0x4aad5a,_0x3f3be9){return db[_0x4bb6('0x1d')][_0x4bb6('0x23')]({'where':_0x1b85ec['options']?_0x1b85ec['options'][_0x4bb6('0x24')]||null:null})['then'](function(_0x504da4){if(_0x504da4){return _0x504da4[_0x4bb6('0x25')](_0x1b85ec[_0x4bb6('0x26')]['ids'],_[_0x4bb6('0x27')](_0x1b85ec['body'],['ids','id'])||{});}})[_0x4bb6('0x28')](function(_0x31cba0){logger['info'](_0x4bb6('0x29'),_0x1b85ec);logger[_0x4bb6('0x15')](_0x4bb6('0x29'),_0x1b85ec,JSON[_0x4bb6('0x22')](_0x31cba0));_0x4aad5a(_0x31cba0);})[_0x4bb6('0x1b')](function(_0x58cdb){logger['error']('AddTags',_0x58cdb[_0x4bb6('0x1a')],_0x1b85ec);_0x3f3be9(_this[_0x4bb6('0x18')](0x1f4,_0x58cdb[_0x4bb6('0x1a')]));});});}; \ No newline at end of file +var _0x3aec=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','info','SmsInteraction,\x20%s,\x20%s','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SmsInteraction','update','body','options','raw','attributes','limit','UpdateSmsInteraction','debug','AddTagsToSmsInteraction','find','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x131614,_0x87a6e){var _0x33a5b3=function(_0x5911fa){while(--_0x5911fa){_0x131614['push'](_0x131614['shift']());}};_0x33a5b3(++_0x87a6e);}(_0x3aec,0x78));var _0xc3ae=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0x3aec[_0x4ac60a];return _0x4b22e8;};'use strict';var _=require(_0xc3ae('0x0'));var util=require(_0xc3ae('0x1'));var moment=require(_0xc3ae('0x2'));var BPromise=require(_0xc3ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ae('0x4'));var db=require(_0xc3ae('0x5'))['db'];var utils=require(_0xc3ae('0x6'));var logger=require(_0xc3ae('0x7'))(_0xc3ae('0x8'));var config=require(_0xc3ae('0x9'));var jayson=require(_0xc3ae('0xa'));var client=jayson[_0xc3ae('0xb')][_0xc3ae('0xc')]({'port':0x232a});config[_0xc3ae('0xd')]=_['defaults'](config[_0xc3ae('0xd')],{'host':_0xc3ae('0xe'),'port':0x18eb});var socket=require(_0xc3ae('0xf'))(new Redis(config[_0xc3ae('0xd')]));require(_0xc3ae('0x10'))[_0xc3ae('0x11')](socket);function respondWithRpcPromise(_0x2f5416,_0x3e28af,_0x2ecc20){return new BPromise(function(_0x58c1d7,_0x1db974){return client['request'](_0x2f5416,_0x2ecc20)['then'](function(_0x5824e5){logger[_0xc3ae('0x12')](_0xc3ae('0x13'),_0x3e28af,'request\x20sent');logger['debug'](_0xc3ae('0x14'),_0x3e28af,_0xc3ae('0x15'),JSON[_0xc3ae('0x16')](_0x5824e5));if(_0x5824e5['error']){if(_0x5824e5[_0xc3ae('0x17')][_0xc3ae('0x18')]===0x1f4){logger[_0xc3ae('0x17')](_0xc3ae('0x13'),_0x3e28af,_0x5824e5['error']['message']);return _0x1db974(_0x5824e5[_0xc3ae('0x17')][_0xc3ae('0x19')]);}logger[_0xc3ae('0x17')](_0xc3ae('0x13'),_0x3e28af,_0x5824e5[_0xc3ae('0x17')][_0xc3ae('0x19')]);return _0x58c1d7(_0x5824e5[_0xc3ae('0x17')][_0xc3ae('0x19')]);}else{logger['info'](_0xc3ae('0x13'),_0x3e28af,_0xc3ae('0x15'));_0x58c1d7(_0x5824e5['result'][_0xc3ae('0x19')]);}})[_0xc3ae('0x1a')](function(_0x430373){logger[_0xc3ae('0x17')](_0xc3ae('0x13'),_0x3e28af,_0x430373);_0x1db974(_0x430373);});});}exports['UpdateSmsInteraction']=function(_0x20ddfe){var _0x47d7bd=this;return new Promise(function(_0x5a332d,_0x40b954){return db[_0xc3ae('0x1b')][_0xc3ae('0x1c')](_0x20ddfe[_0xc3ae('0x1d')],{'raw':_0x20ddfe[_0xc3ae('0x1e')]?_0x20ddfe[_0xc3ae('0x1e')][_0xc3ae('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20ddfe['options']?_0x20ddfe[_0xc3ae('0x1e')]['where']||null:null,'attributes':_0x20ddfe[_0xc3ae('0x1e')]?_0x20ddfe[_0xc3ae('0x1e')][_0xc3ae('0x20')]||null:null,'limit':_0x20ddfe['options']?_0x20ddfe[_0xc3ae('0x1e')][_0xc3ae('0x21')]||null:null})['then'](function(_0x311b77){logger[_0xc3ae('0x12')](_0xc3ae('0x22'),_0x20ddfe);logger[_0xc3ae('0x23')](_0xc3ae('0x22'),_0x20ddfe,JSON[_0xc3ae('0x16')](_0x311b77));_0x5a332d(_0x311b77);})['catch'](function(_0x2a3f66){logger[_0xc3ae('0x17')](_0xc3ae('0x22'),_0x2a3f66[_0xc3ae('0x19')],_0x20ddfe);_0x40b954(_0x47d7bd['error'](0x1f4,_0x2a3f66[_0xc3ae('0x19')]));});});};exports[_0xc3ae('0x24')]=function(_0x901ce8){return new Promise(function(_0x271812,_0x33bce0){return db['SmsInteraction'][_0xc3ae('0x25')]({'where':_0x901ce8['options']?_0x901ce8[_0xc3ae('0x1e')][_0xc3ae('0x26')]||null:null})['then'](function(_0x42a6fe){if(_0x42a6fe){return _0x42a6fe[_0xc3ae('0x27')](_0x901ce8[_0xc3ae('0x1d')][_0xc3ae('0x28')],_[_0xc3ae('0x29')](_0x901ce8[_0xc3ae('0x1d')],[_0xc3ae('0x28'),'id'])||{});}})['spread'](function(_0x59a0aa){logger[_0xc3ae('0x12')](_0xc3ae('0x2a'),_0x901ce8);logger[_0xc3ae('0x23')](_0xc3ae('0x2a'),_0x901ce8,JSON[_0xc3ae('0x16')](_0x59a0aa));_0x271812(_0x59a0aa);})[_0xc3ae('0x1a')](function(_0x555a29){logger[_0xc3ae('0x17')](_0xc3ae('0x2a'),_0x555a29[_0xc3ae('0x19')],_0x901ce8);_0x33bce0(_this['error'](0x1f4,_0x555a29[_0xc3ae('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e091b66..73d6ca1 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0x489fb7,_0xe0d692){var _0x4815e0=function(_0x39eb63){while(--_0x39eb63){_0x489fb7['push'](_0x489fb7['shift']());}};_0x4815e0(++_0xe0d692);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){SmsInteractionEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0xb10b,0x12a));var _0xbb10=function(_0x455fea,_0x51f808){_0x455fea=_0x455fea-0x0;var _0x32f39b=_0xb10b[_0x455fea];return _0x32f39b;};'use strict';var SmsInteractionEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){SmsInteractionEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 8825a87..479dc9a 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 _0x3f70=['../../components/auth/service','get','isAuthenticated','index','/describe','describe','post','tracked','smsmessage:create','create','/:id/status','status','/:id','update','put','/:id/accept','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x1b8f2b,_0x987af7){var _0xc0b07f=function(_0x17a8e4){while(--_0x17a8e4){_0x1b8f2b['push'](_0x1b8f2b['shift']());}};_0xc0b07f(++_0x987af7);}(_0x3f70,0x164));var _0x03f7=function(_0x396a1c,_0x303068){_0x396a1c=_0x396a1c-0x0;var _0x4baaee=_0x3f70[_0x396a1c];return _0x4baaee;};'use strict';var multer=require(_0x03f7('0x0'));var util=require(_0x03f7('0x1'));var path=require('path');var timeout=require(_0x03f7('0x2'));var express=require('express');var router=express[_0x03f7('0x3')]();var auth=require(_0x03f7('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x03f7('0x5')]('/',auth[_0x03f7('0x6')](),controller[_0x03f7('0x7')]);router[_0x03f7('0x5')](_0x03f7('0x8'),auth['isAuthenticated'](),controller[_0x03f7('0x9')]);router['get']('/:id',auth[_0x03f7('0x6')](),controller['show']);router[_0x03f7('0xa')]('/',auth[_0x03f7('0x6')](),interaction[_0x03f7('0xb')]('sms',_0x03f7('0xc')),controller[_0x03f7('0xd')]);router['post'](_0x03f7('0xe'),controller[_0x03f7('0xf')]);router['put'](_0x03f7('0x10'),auth[_0x03f7('0x6')](),controller[_0x03f7('0x11')]);router[_0x03f7('0x12')](_0x03f7('0x13'),auth[_0x03f7('0x6')](),controller['accept']);router[_0x03f7('0x12')](_0x03f7('0x14'),auth[_0x03f7('0x6')](),controller['reject']);router[_0x03f7('0x15')](_0x03f7('0x10'),auth[_0x03f7('0x6')](),controller[_0x03f7('0x16')]);module[_0x03f7('0x17')]=router; \ No newline at end of file +var _0x1d45=['reject','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','sms','smsmessage:create','create','status','put','/:id/accept','accept','/:id/reject'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x1d45,0xc1));var _0x51d4=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x1d45[_0x2261ce];return _0x524640;};'use strict';var multer=require('multer');var util=require(_0x51d4('0x0'));var path=require(_0x51d4('0x1'));var timeout=require('connect-timeout');var express=require(_0x51d4('0x2'));var router=express[_0x51d4('0x3')]();var auth=require(_0x51d4('0x4'));var interaction=require(_0x51d4('0x5'));var config=require(_0x51d4('0x6'));var controller=require(_0x51d4('0x7'));router[_0x51d4('0x8')]('/',auth[_0x51d4('0x9')](),controller[_0x51d4('0xa')]);router['get']('/describe',auth[_0x51d4('0x9')](),controller[_0x51d4('0xb')]);router[_0x51d4('0x8')](_0x51d4('0xc'),auth[_0x51d4('0x9')](),controller[_0x51d4('0xd')]);router[_0x51d4('0xe')]('/',auth[_0x51d4('0x9')](),interaction['tracked'](_0x51d4('0xf'),_0x51d4('0x10')),controller[_0x51d4('0x11')]);router[_0x51d4('0xe')]('/:id/status',controller[_0x51d4('0x12')]);router[_0x51d4('0x13')](_0x51d4('0xc'),auth[_0x51d4('0x9')](),controller['update']);router[_0x51d4('0x13')](_0x51d4('0x14'),auth[_0x51d4('0x9')](),controller[_0x51d4('0x15')]);router[_0x51d4('0x13')](_0x51d4('0x16'),auth[_0x51d4('0x9')](),controller[_0x51d4('0x17')]);router[_0x51d4('0x18')](_0x51d4('0xc'),auth[_0x51d4('0x9')](),controller[_0x51d4('0x19')]);module[_0x51d4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index bd59b8b..722144d 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 _0x7899=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7899,0x168));var _0x9789=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x7899[_0x15ca1a];return _0x507626;};'use strict';var Sequelize=require(_0x9789('0x0'));module[_0x9789('0x1')]={'body':{'type':Sequelize[_0x9789('0x2')](_0x9789('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9789('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9789('0x5')]('in',_0x9789('0x6')),'defaultValue':_0x9789('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x9789('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x9789('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2127=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x41f936,_0x217ec3){var _0x11a6fe=function(_0x551da4){while(--_0x551da4){_0x41f936['push'](_0x41f936['shift']());}};_0x11a6fe(++_0x217ec3);}(_0x2127,0x8a));var _0x7212=function(_0x5c85b0,_0x2981fb){_0x5c85b0=_0x5c85b0-0x0;var _0x42b216=_0x2127[_0x5c85b0];return _0x42b216;};'use strict';var Sequelize=require(_0x7212('0x0'));module[_0x7212('0x1')]={'body':{'type':Sequelize[_0x7212('0x2')](_0x7212('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7212('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7212('0x5')]('in',_0x7212('0x6')),'defaultValue':_0x7212('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7212('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x7212('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 36ff3af..ef43591 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 _0x63c6=['options','count','include','findAll','catch','show','params','rawAttributes','find','create','body','sms-interactions','accept','sms','read','readAt','format','UserId','Contact','get','SmsInteraction','SmsInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','reject','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','event','SmsAccount','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','plivio','results','groupName','infobip','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','status','end','json','offset','limit','apply','save','update','destroy','sendStatus','stack','name','send','index','map','SmsMessage','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0x63c6,0xbb));var _0x663c=function(_0x3c1be6,_0x1649fd){_0x3c1be6=_0x3c1be6-0x0;var _0x42db4f=_0x63c6[_0x3c1be6];return _0x42db4f;};'use strict';var pdf=require(_0x663c('0x0'));var emlformat=require(_0x663c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x663c('0x2'));var rp=require(_0x663c('0x3'));var moment=require(_0x663c('0x4'));var BPromise=require(_0x663c('0x5'));var Mustache=require(_0x663c('0x6'));var util=require(_0x663c('0x7'));var path=require(_0x663c('0x8'));var sox=require(_0x663c('0x9'));var csv=require(_0x663c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x663c('0xb'));var squel=require(_0x663c('0xc'));var crypto=require(_0x663c('0xd'));var jsforce=require(_0x663c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x663c('0xa'));var querystring=require('querystring');var Papa=require(_0x663c('0xf'));var Redis=require('ioredis');var authService=require(_0x663c('0x10'));var qs=require(_0x663c('0x11'));var as=require(_0x663c('0x12'));var hardwareService=require(_0x663c('0x13'));var logger=require(_0x663c('0x14'))(_0x663c('0x15'));var utils=require(_0x663c('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x663c('0x17')]=_[_0x663c('0x18')](config['redis'],{'host':_0x663c('0x19'),'port':0x18eb});var socket=require(_0x663c('0x1a'))(new Redis(config[_0x663c('0x17')]));require(_0x663c('0x1b'))['register'](socket);var jayson=require(_0x663c('0x1c'));var client=jayson[_0x663c('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x663c('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x44ffaa,_0xb1e1bf,_0x2a7b0d){if(_0x2a7b0d){var _0x14cb89=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14cb89[_0x663c('0x1e')](_0xb1e1bf)){return _0x44ffaa;}else{throw new db[(_0x663c('0x1f'))][(_0x663c('0x20'))](_0x663c('0x21'));}}else{return _0x44ffaa;}}function respondWithRpcPromise(_0x31895b,_0x3c87fe,_0x517f70,_0x2fd707){return new BPromise(function(_0x33f149,_0x6e56fd){var _0x49665e=_0x2fd707||client;return _0x49665e[_0x663c('0x22')](_0x31895b,_0x517f70)[_0x663c('0x23')](function(_0x2c0cb4){logger[_0x663c('0x24')](_0x663c('0x25'),_0x3c87fe,'request\x20sent');logger[_0x663c('0x26')](_0x663c('0x27'),_0x3c87fe,_0x663c('0x28'),JSON[_0x663c('0x29')](_0x2c0cb4));if(_0x2c0cb4['error']){if(_0x2c0cb4['error'][_0x663c('0x2a')]===0x1f4){logger[_0x663c('0x2b')](_0x663c('0x25'),_0x3c87fe,_0x2c0cb4[_0x663c('0x2b')][_0x663c('0x2c')]);return _0x6e56fd(_0x2c0cb4['error']['message']);}logger['error'](_0x663c('0x25'),_0x3c87fe,_0x2c0cb4[_0x663c('0x2b')][_0x663c('0x2c')]);return _0x33f149(_0x2c0cb4[_0x663c('0x2b')]['message']);}else{logger[_0x663c('0x24')](_0x663c('0x25'),_0x3c87fe,_0x663c('0x28'));_0x33f149(_0x2c0cb4[_0x663c('0x2d')][_0x663c('0x2c')]);}})['catch'](function(_0x34fc73){logger['error'](_0x663c('0x25'),_0x3c87fe,_0x34fc73);_0x6e56fd(_0x34fc73);});});}function respondWithStatusCode(_0x5ead23,_0x4ec72b){_0x4ec72b=_0x4ec72b||0xcc;return function(_0x34cd8c){if(_0x34cd8c){return _0x5ead23['sendStatus'](_0x4ec72b);}return _0x5ead23[_0x663c('0x2e')](_0x4ec72b)[_0x663c('0x2f')]();};}function respondWithResult(_0x30ff6f,_0x46d722){_0x46d722=_0x46d722||0xc8;return function(_0x1ab262){if(_0x1ab262){return _0x30ff6f[_0x663c('0x2e')](_0x46d722)[_0x663c('0x30')](_0x1ab262);}};}function respondWithFilteredResult(_0x567184,_0x61ebd3){return function(_0x29f074){if(_0x29f074){var _0x43ad67=_0x29f074['count'],_0x248345=_0x61ebd3[_0x663c('0x31')],_0x3b3d39=_0x61ebd3['offset']+_0x61ebd3[_0x663c('0x32')],_0x242ba7;if(_0x3b3d39>=_0x43ad67){_0x3b3d39=_0x43ad67;_0x242ba7=0xc8;}else{_0x242ba7=0xce;}_0x567184['status'](_0x242ba7);return _0x567184['set']('Content-Range',_0x248345+'-'+_0x3b3d39+'/'+_0x43ad67)[_0x663c('0x30')](_0x29f074);}return null;};}function patchUpdates(_0x10f4c4){return function(_0x5b4740){try{jsonpatch[_0x663c('0x33')](_0x5b4740,_0x10f4c4,!![]);}catch(_0x6c7d72){return BPromise['reject'](_0x6c7d72);}return _0x5b4740[_0x663c('0x34')]();};}function saveUpdates(_0x38278d,_0x31b3d5){return function(_0xdc1ba6){if(_0xdc1ba6){return _0xdc1ba6[_0x663c('0x35')](_0x38278d)['then'](function(_0x2326b8){return _0x2326b8;});}return null;};}function removeEntity(_0x2f2d8e,_0x36809f){return function(_0x4d29ef){if(_0x4d29ef){return _0x4d29ef[_0x663c('0x36')]()[_0x663c('0x23')](function(){_0x2f2d8e[_0x663c('0x2e')](0xcc)[_0x663c('0x2f')]();});}};}function handleEntityNotFound(_0x58b228,_0x3178cc){return function(_0xba7d56){if(!_0xba7d56){_0x58b228[_0x663c('0x37')](0x194);}return _0xba7d56;};}function handleError(_0xd16d2,_0x5752e1){_0x5752e1=_0x5752e1||0x1f4;return function(_0x4af133){logger[_0x663c('0x2b')](_0x4af133[_0x663c('0x38')]);if(_0x4af133['name']){delete _0x4af133[_0x663c('0x39')];}_0xd16d2[_0x663c('0x2e')](_0x5752e1)[_0x663c('0x3a')](_0x4af133);};}exports[_0x663c('0x3b')]=function(_0x50b42a,_0x2ab331){var _0x38123e={},_0x50a2e7={},_0x4e8d68={'count':0x0,'rows':[]};var _0x45acd5=_[_0x663c('0x3c')](db[_0x663c('0x3d')]['rawAttributes'],function(_0x51b931){return{'name':_0x51b931['fieldName'],'type':_0x51b931[_0x663c('0x3e')]['key']};});_0x50a2e7[_0x663c('0x3f')]=_[_0x663c('0x3c')](_0x45acd5,_0x663c('0x39'));_0x50a2e7['query']=_[_0x663c('0x40')](_0x50b42a[_0x663c('0x41')]);_0x50a2e7[_0x663c('0x42')]=_[_0x663c('0x43')](_0x50a2e7['model'],_0x50a2e7[_0x663c('0x41')]);_0x38123e[_0x663c('0x44')]=_[_0x663c('0x43')](_0x50a2e7[_0x663c('0x3f')],qs['fields'](_0x50b42a[_0x663c('0x41')][_0x663c('0x45')]));_0x38123e[_0x663c('0x44')]=_0x38123e['attributes'][_0x663c('0x46')]?_0x38123e[_0x663c('0x44')]:_0x50a2e7[_0x663c('0x3f')];if(!_0x50b42a['query'][_0x663c('0x47')]('nolimit')){_0x38123e[_0x663c('0x32')]=qs['limit'](_0x50b42a[_0x663c('0x41')][_0x663c('0x32')]);_0x38123e[_0x663c('0x31')]=qs['offset'](_0x50b42a[_0x663c('0x41')][_0x663c('0x31')]);}_0x38123e[_0x663c('0x48')]=qs['sort'](_0x50b42a[_0x663c('0x41')]['sort']);_0x38123e[_0x663c('0x49')]=qs[_0x663c('0x42')](_[_0x663c('0x4a')](_0x50b42a['query'],_0x50a2e7[_0x663c('0x42')]),_0x45acd5);if(_0x50b42a[_0x663c('0x41')][_0x663c('0x4b')]){_0x38123e[_0x663c('0x49')]=_[_0x663c('0x4c')](_0x38123e[_0x663c('0x49')],{'$or':_[_0x663c('0x3c')](_0x45acd5,function(_0x36b14a){if(_0x36b14a[_0x663c('0x3e')]!=='VIRTUAL'){var _0x10632d={};_0x10632d[_0x36b14a[_0x663c('0x39')]]={'$like':'%'+_0x50b42a[_0x663c('0x41')][_0x663c('0x4b')]+'%'};return _0x10632d;}})});}_0x38123e=_[_0x663c('0x4c')]({},_0x38123e,_0x50b42a[_0x663c('0x4d')]);var _0x3930cd={'where':_0x38123e['where']};return db[_0x663c('0x3d')][_0x663c('0x4e')](_0x3930cd)[_0x663c('0x23')](function(_0x4229e4){_0x4e8d68[_0x663c('0x4e')]=_0x4229e4;if(_0x50b42a[_0x663c('0x41')]['includeAll']){_0x38123e[_0x663c('0x4f')]=[{'all':!![]}];}return db[_0x663c('0x3d')][_0x663c('0x50')](_0x38123e);})['then'](function(_0x14b180){_0x4e8d68['rows']=_0x14b180;return _0x4e8d68;})[_0x663c('0x23')](respondWithFilteredResult(_0x2ab331,_0x38123e))[_0x663c('0x51')](handleError(_0x2ab331,null));};exports[_0x663c('0x52')]=function(_0x3db2fc,_0x4cb522){var _0x488e1d={'raw':!![],'where':{'id':_0x3db2fc[_0x663c('0x53')]['id']}},_0x167e07={};_0x167e07[_0x663c('0x3f')]=_[_0x663c('0x40')](db[_0x663c('0x3d')][_0x663c('0x54')]);_0x167e07[_0x663c('0x41')]=_[_0x663c('0x40')](_0x3db2fc[_0x663c('0x41')]);_0x167e07[_0x663c('0x42')]=_[_0x663c('0x43')](_0x167e07[_0x663c('0x3f')],_0x167e07['query']);_0x488e1d['attributes']=_[_0x663c('0x43')](_0x167e07[_0x663c('0x3f')],qs['fields'](_0x3db2fc[_0x663c('0x41')][_0x663c('0x45')]));_0x488e1d[_0x663c('0x44')]=_0x488e1d['attributes']['length']?_0x488e1d['attributes']:_0x167e07[_0x663c('0x3f')];if(_0x3db2fc[_0x663c('0x41')]['includeAll']){_0x488e1d[_0x663c('0x4f')]=[{'all':!![]}];}_0x488e1d=_[_0x663c('0x4c')]({},_0x488e1d,_0x3db2fc['options']);return db[_0x663c('0x3d')][_0x663c('0x55')](_0x488e1d)['then'](handleEntityNotFound(_0x4cb522,null))['then'](respondWithResult(_0x4cb522,null))[_0x663c('0x51')](handleError(_0x4cb522,null));};exports['create']=function(_0x3c7cab,_0x367528){return db['SmsMessage'][_0x663c('0x56')](_0x3c7cab[_0x663c('0x57')],{})[_0x663c('0x23')](respondWithResult(_0x367528,0xc9))[_0x663c('0x51')](handleError(_0x367528,null));};exports[_0x663c('0x35')]=function(_0x3112e1,_0x14fad7){if(_0x3112e1[_0x663c('0x57')]['id']){delete _0x3112e1[_0x663c('0x57')]['id'];}return db[_0x663c('0x3d')][_0x663c('0x55')]({'where':{'id':_0x3112e1[_0x663c('0x53')]['id']}})[_0x663c('0x23')](handleEntityNotFound(_0x14fad7,null))[_0x663c('0x23')](saveUpdates(_0x3112e1['body'],null))['then'](respondWithResult(_0x14fad7,null))[_0x663c('0x51')](handleError(_0x14fad7,null));};exports[_0x663c('0x36')]=function(_0x550ed1,_0xd2f377){return db[_0x663c('0x3d')][_0x663c('0x55')]({'where':{'id':_0x550ed1[_0x663c('0x53')]['id']}})['then'](handleEntityNotFound(_0xd2f377,null))[_0x663c('0x23')](removeEntity(_0xd2f377,null))['catch'](handleError(_0xd2f377,null));};exports['describe']=function(_0x213261,_0x37014b){return db[_0x663c('0x3d')]['describe']()[_0x663c('0x23')](respondWithResult(_0x37014b,null))[_0x663c('0x51')](handleError(_0x37014b,null));};var interaction_log=require(_0x663c('0x14'))(_0x663c('0x58'));exports[_0x663c('0x59')]=function(_0x127d91,_0x306243,_0xe8f953){var _0x392887={'channel':_0x663c('0x5a')};if(_0x127d91[_0x663c('0x57')]['id']){delete _0x127d91['body']['id'];}_0x127d91[_0x663c('0x57')][_0x663c('0x5b')]=!![];_0x127d91[_0x663c('0x57')][_0x663c('0x5c')]=moment()[_0x663c('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x127d91[_0x663c('0x57')]['UserId']=_0x127d91['body'][_0x663c('0x5e')]||_0x127d91['user']['id'];return db['SmsMessage'][_0x663c('0x55')]({'where':{'id':_0x127d91[_0x663c('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x663c('0x5f')}]})[_0x663c('0x23')](handleEntityNotFound(_0x306243,null))['then'](saveUpdates(_0x127d91['body'],null))[_0x663c('0x23')](function(_0x424bab){if(_0x424bab){_0x392887[_0x663c('0x2c')]=_0x424bab[_0x663c('0x60')]({'plain':!![]});return db[_0x663c('0x61')][_0x663c('0x55')]({'where':{'id':_0x424bab[_0x663c('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x306243,null))[_0x663c('0x23')](function(_0x581e1d){if(_0x581e1d){return _0x581e1d[_0x663c('0x35')]({'UserId':_0x127d91[_0x663c('0x57')][_0x663c('0x5e')],'read1stAt':_['isNil'](_0x581e1d[_0x663c('0x63')])?moment()[_0x663c('0x5d')](_0x663c('0x64')):undefined});}return null;})[_0x663c('0x23')](function(_0x63035a){if(_0x63035a){_0x392887[_0x663c('0x65')]=_0x63035a[_0x663c('0x60')]({'plain':!![]});interaction_log[_0x663c('0x24')](_0x663c('0x66'),_0x127d91[_0x663c('0x67')]['id'],_0x127d91[_0x663c('0x67')][_0x663c('0x39')],_0x127d91[_0x663c('0x67')][_0x663c('0x68')],_0x392887[_0x663c('0x65')]['id'],_0x127d91['body']?JSON[_0x663c('0x29')](_0x127d91[_0x663c('0x57')]):_0x663c('0x69'));return respondWithRpcPromise('AcceptMessage',_0x663c('0x6a'),_0x392887);}return null;})['then'](function(_0x45b626){if(_0x45b626){if(_0x127d91['body'][_0x663c('0x6b')]){_0x392887['message'][_0x663c('0x6c')]=util[_0x663c('0x5d')](_0x663c('0x6d'),_0x127d91[_0x663c('0x67')][_0x663c('0x39')]);_0x392887[_0x663c('0x2c')][_0x663c('0x6e')]=_0x392887[_0x663c('0x6e')];_0x392887[_0x663c('0x2c')]['event']=_0x663c('0x59');return respondWithRpcPromise('EventManager',_0x663c('0x6f'),{'event':_0x663c('0x70'),'message':_0x392887[_0x663c('0x2c')]},client9002)['then'](function(){return _0x392887;});}return _0x392887;}return null;})[_0x663c('0x23')](respondWithResult(_0x306243,null))[_0x663c('0x51')](handleError(_0x306243,null));};var interaction_log=require('../../config/logger')(_0x663c('0x58'));exports[_0x663c('0x71')]=function(_0x54aad8,_0x21b70f,_0x45a4ba){var _0x40cd62={'agent':{},'channel':_0x663c('0x5a')};if(_0x54aad8[_0x663c('0x57')]['id']){delete _0x54aad8[_0x663c('0x57')]['id'];}_0x54aad8[_0x663c('0x57')][_0x663c('0x5e')]=_0x54aad8[_0x663c('0x57')]['UserId']||_0x54aad8[_0x663c('0x67')]['id'];_0x40cd62[_0x663c('0x72')]['id']=_0x54aad8['body'][_0x663c('0x5e')];return db[_0x663c('0x3d')][_0x663c('0x55')]({'where':{'id':_0x54aad8[_0x663c('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x21b70f,null))[_0x663c('0x23')](function(_0x2ae4d0){if(_0x2ae4d0){_0x40cd62[_0x663c('0x2c')]=_0x2ae4d0[_0x663c('0x60')]({'plain':!![]});return db['SmsInteraction'][_0x663c('0x55')]({'where':{'id':_0x2ae4d0[_0x663c('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x21b70f,null))['then'](function(_0x169dfd){if(_0x169dfd){_0x40cd62['interaction']=_0x169dfd[_0x663c('0x60')]({'plain':!![]});interaction_log[_0x663c('0x24')](_0x663c('0x73'),_0x54aad8['user']['id'],_0x54aad8[_0x663c('0x67')][_0x663c('0x39')],_0x54aad8['user'][_0x663c('0x68')],_0x40cd62['interaction']['id'],_0x54aad8[_0x663c('0x57')]?JSON[_0x663c('0x29')](_0x54aad8[_0x663c('0x57')]):'null');return respondWithRpcPromise('RejectMessage',_0x663c('0x74'),_0x40cd62);}return null;})['then'](function(_0x1e8ecc){if(_0x1e8ecc){_0x1e8ecc[_0x663c('0x2c')][_0x663c('0x6c')]=util['format']('SIP/%s',_0x54aad8['user'][_0x663c('0x39')]);_0x1e8ecc['message'][_0x663c('0x6e')]=_0x40cd62[_0x663c('0x6e')];_0x1e8ecc[_0x663c('0x2c')][_0x663c('0x75')]=_0x663c('0x71');respondWithRpcPromise(_0x663c('0x6f'),'EventManager',{'event':'rejectmessage','message':_0x1e8ecc[_0x663c('0x2c')]},client9002);return _0x40cd62;}return null;})[_0x663c('0x23')](respondWithResult(_0x21b70f,null))[_0x663c('0x51')](handleError(_0x21b70f,null));};exports[_0x663c('0x2e')]=function(_0x4992c9,_0x3f09c5,_0x5e9423){if(_0x4992c9[_0x663c('0x57')]['id']){delete _0x4992c9['body']['id'];}var _0x4a8987;return db['SmsMessage'][_0x663c('0x55')]({'where':{'id':_0x4992c9[_0x663c('0x53')]['id']}})[_0x663c('0x23')](handleEntityNotFound(_0x3f09c5,null))['then'](function(_0x199531){if(_0x199531){_0x4a8987=_0x199531;return db[_0x663c('0x76')][_0x663c('0x55')]({'where':{'id':_0x199531['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x3f09c5,null))[_0x663c('0x23')](function(_0x4466d6){if(_0x4466d6){logger[_0x663c('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x663c('0x2e'),_0x663c('0x77'),_0x4466d6[_0x663c('0x3e')],util[_0x663c('0x78')](_0x4992c9[_0x663c('0x57')],{'showHidden':![],'depth':null}));switch(_0x4466d6[_0x663c('0x3e')]){case _0x663c('0x79'):if(_0x4992c9[_0x663c('0x57')][_0x663c('0x7a')]&&_0x4992c9[_0x663c('0x57')][_0x663c('0x7a')]===_0x4a8987[_0x663c('0x7b')]){return _0x4a8987[_0x663c('0x35')]({'read':!![]});}else{logger['error'](_0x663c('0x7c'),_0x663c('0x2e'),'twilio',util['inspect'](_0x4992c9[_0x663c('0x57')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x4992c9['body']['MessageUUID']&&_0x4992c9['body'][_0x663c('0x7d')]===_0x4a8987[_0x663c('0x7b')]&&_[_0x663c('0x7e')]([_0x663c('0x7f'),'delivered'],_0x4992c9[_0x663c('0x57')]['Status'])>=0x0){return _0x4a8987['update']({'read':!![]});}else{logger[_0x663c('0x2b')](_0x663c('0x7c'),_0x663c('0x2e'),_0x663c('0x80'),util['inspect'](_0x4992c9[_0x663c('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x118150=_0x4992c9[_0x663c('0x57')][_0x663c('0x81')][0x0];if(_0x118150['status'][_0x663c('0x82')]==='DELIVERED'){return _0x4a8987[_0x663c('0x35')]({'read':!![]});}else{logger[_0x663c('0x2b')](_0x663c('0x7c'),'status',_0x663c('0x83'),util[_0x663c('0x78')](_0x4992c9[_0x663c('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4a8987;}})[_0x663c('0x23')](respondWithResult(_0x3f09c5,null))['catch'](handleError(_0x3f09c5,null));}; \ No newline at end of file +var _0x4058=['[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','SmsAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','defaults','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','show','params','find','create','body','describe','sms-interactions','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','SmsInteraction','isNil','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','accept','EventManager','acceptmessage','agent'];(function(_0x763d08,_0x434cf5){var _0x4ef90f=function(_0x4ff8a0){while(--_0x4ff8a0){_0x763d08['push'](_0x763d08['shift']());}};_0x4ef90f(++_0x434cf5);}(_0x4058,0x129));var _0x8405=function(_0x4b71c7,_0x155cde){_0x4b71c7=_0x4b71c7-0x0;var _0x10b764=_0x4058[_0x4b71c7];return _0x10b764;};'use strict';var pdf=require(_0x8405('0x0'));var emlformat=require(_0x8405('0x1'));var rimraf=require(_0x8405('0x2'));var zipdir=require(_0x8405('0x3'));var jsonpatch=require(_0x8405('0x4'));var rp=require(_0x8405('0x5'));var moment=require(_0x8405('0x6'));var BPromise=require(_0x8405('0x7'));var Mustache=require(_0x8405('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8405('0x9'));var ejs=require(_0x8405('0xa'));var fs=require('fs');var _=require(_0x8405('0xb'));var squel=require(_0x8405('0xc'));var crypto=require(_0x8405('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8405('0xe'));var toCsv=require(_0x8405('0x9'));var querystring=require(_0x8405('0xf'));var Papa=require('papaparse');var Redis=require(_0x8405('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8405('0x11'));var as=require(_0x8405('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8405('0x13'))(_0x8405('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8405('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x8405('0x16')](socket);var jayson=require(_0x8405('0x17'));var client=jayson['client'][_0x8405('0x18')]({'port':0x232c});var client9002=jayson[_0x8405('0x19')][_0x8405('0x18')]({'port':0x232a});function checkPasswordPattern(_0x422822,_0x58eb66,_0x218fe7){if(_0x218fe7){var _0x2d7601=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d7601[_0x8405('0x1a')](_0x58eb66)){return _0x422822;}else{throw new db[(_0x8405('0x1b'))][(_0x8405('0x1c'))](_0x8405('0x1d'));}}else{return _0x422822;}}function respondWithRpcPromise(_0x2d067e,_0x358633,_0x30a506,_0x1e608f){return new BPromise(function(_0x34c79c,_0x21376d){var _0x131857=_0x1e608f||client;return _0x131857[_0x8405('0x1e')](_0x2d067e,_0x30a506)[_0x8405('0x1f')](function(_0x42c191){logger[_0x8405('0x20')](_0x8405('0x21'),_0x358633,_0x8405('0x22'));logger[_0x8405('0x23')](_0x8405('0x24'),_0x358633,_0x8405('0x22'),JSON[_0x8405('0x25')](_0x42c191));if(_0x42c191[_0x8405('0x26')]){if(_0x42c191[_0x8405('0x26')][_0x8405('0x27')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x358633,_0x42c191[_0x8405('0x26')][_0x8405('0x28')]);return _0x21376d(_0x42c191[_0x8405('0x26')]['message']);}logger[_0x8405('0x26')]('SmsMessage,\x20%s,\x20%s',_0x358633,_0x42c191[_0x8405('0x26')]['message']);return _0x34c79c(_0x42c191[_0x8405('0x26')][_0x8405('0x28')]);}else{logger[_0x8405('0x20')](_0x8405('0x21'),_0x358633,_0x8405('0x22'));_0x34c79c(_0x42c191[_0x8405('0x29')][_0x8405('0x28')]);}})[_0x8405('0x2a')](function(_0x44b495){logger[_0x8405('0x26')](_0x8405('0x21'),_0x358633,_0x44b495);_0x21376d(_0x44b495);});});}function respondWithStatusCode(_0x293789,_0x53bb61){_0x53bb61=_0x53bb61||0xcc;return function(_0x132c0f){if(_0x132c0f){return _0x293789['sendStatus'](_0x53bb61);}return _0x293789['status'](_0x53bb61)[_0x8405('0x2b')]();};}function respondWithResult(_0x41f06a,_0x3022cc){_0x3022cc=_0x3022cc||0xc8;return function(_0x26d5ec){if(_0x26d5ec){return _0x41f06a[_0x8405('0x2c')](_0x3022cc)[_0x8405('0x2d')](_0x26d5ec);}};}function respondWithFilteredResult(_0x45fd8f,_0xa1efa2){return function(_0x7e216b){if(_0x7e216b){var _0xe019ff=_0x7e216b['count'],_0x20bca3=_0xa1efa2[_0x8405('0x2e')],_0x3b14e5=_0xa1efa2[_0x8405('0x2e')]+_0xa1efa2['limit'],_0xcbee2b;if(_0x3b14e5>=_0xe019ff){_0x3b14e5=_0xe019ff;_0xcbee2b=0xc8;}else{_0xcbee2b=0xce;}_0x45fd8f[_0x8405('0x2c')](_0xcbee2b);return _0x45fd8f[_0x8405('0x2f')](_0x8405('0x30'),_0x20bca3+'-'+_0x3b14e5+'/'+_0xe019ff)['json'](_0x7e216b);}return null;};}function patchUpdates(_0x130bd2){return function(_0x42c28f){try{jsonpatch[_0x8405('0x31')](_0x42c28f,_0x130bd2,!![]);}catch(_0x518f27){return BPromise[_0x8405('0x32')](_0x518f27);}return _0x42c28f[_0x8405('0x33')]();};}function saveUpdates(_0x50c891,_0x1ebf6f){return function(_0x5e67de){if(_0x5e67de){return _0x5e67de[_0x8405('0x34')](_0x50c891)[_0x8405('0x1f')](function(_0xa0e7a5){return _0xa0e7a5;});}return null;};}function removeEntity(_0xe8de32,_0xafcc64){return function(_0x2b0929){if(_0x2b0929){return _0x2b0929[_0x8405('0x35')]()[_0x8405('0x1f')](function(){_0xe8de32[_0x8405('0x2c')](0xcc)[_0x8405('0x2b')]();});}};}function handleEntityNotFound(_0x2ddb8d,_0x3b774d){return function(_0x4cd2bf){if(!_0x4cd2bf){_0x2ddb8d[_0x8405('0x36')](0x194);}return _0x4cd2bf;};}function handleError(_0x4c174c,_0x47fbb0){_0x47fbb0=_0x47fbb0||0x1f4;return function(_0x39f2a8){logger[_0x8405('0x26')](_0x39f2a8['stack']);if(_0x39f2a8[_0x8405('0x37')]){delete _0x39f2a8[_0x8405('0x37')];}_0x4c174c[_0x8405('0x2c')](_0x47fbb0)[_0x8405('0x38')](_0x39f2a8);};}exports[_0x8405('0x39')]=function(_0x565324,_0x40b6e0){var _0x968b59={},_0x177600={},_0x2d1e0a={'count':0x0,'rows':[]};var _0x451faa=_['map'](db[_0x8405('0x3a')][_0x8405('0x3b')],function(_0xac5f4b){return{'name':_0xac5f4b[_0x8405('0x3c')],'type':_0xac5f4b[_0x8405('0x3d')][_0x8405('0x3e')]};});_0x177600['model']=_[_0x8405('0x3f')](_0x451faa,_0x8405('0x37'));_0x177600[_0x8405('0x40')]=_[_0x8405('0x41')](_0x565324[_0x8405('0x40')]);_0x177600[_0x8405('0x42')]=_[_0x8405('0x43')](_0x177600['model'],_0x177600[_0x8405('0x40')]);_0x968b59['attributes']=_[_0x8405('0x43')](_0x177600[_0x8405('0x44')],qs['fields'](_0x565324[_0x8405('0x40')][_0x8405('0x45')]));_0x968b59[_0x8405('0x46')]=_0x968b59[_0x8405('0x46')][_0x8405('0x47')]?_0x968b59[_0x8405('0x46')]:_0x177600[_0x8405('0x44')];if(!_0x565324[_0x8405('0x40')][_0x8405('0x48')](_0x8405('0x49'))){_0x968b59['limit']=qs['limit'](_0x565324[_0x8405('0x40')]['limit']);_0x968b59[_0x8405('0x2e')]=qs[_0x8405('0x2e')](_0x565324[_0x8405('0x40')]['offset']);}_0x968b59[_0x8405('0x4a')]=qs[_0x8405('0x4b')](_0x565324['query'][_0x8405('0x4b')]);_0x968b59[_0x8405('0x4c')]=qs[_0x8405('0x42')](_[_0x8405('0x4d')](_0x565324[_0x8405('0x40')],_0x177600[_0x8405('0x42')]),_0x451faa);if(_0x565324[_0x8405('0x40')]['filter']){_0x968b59['where']=_['merge'](_0x968b59[_0x8405('0x4c')],{'$or':_[_0x8405('0x3f')](_0x451faa,function(_0x1c0350){if(_0x1c0350[_0x8405('0x3d')]!=='VIRTUAL'){var _0x51ffcc={};_0x51ffcc[_0x1c0350[_0x8405('0x37')]]={'$like':'%'+_0x565324[_0x8405('0x40')][_0x8405('0x4e')]+'%'};return _0x51ffcc;}})});}_0x968b59=_[_0x8405('0x4f')]({},_0x968b59,_0x565324[_0x8405('0x50')]);var _0x3c516f={'where':_0x968b59[_0x8405('0x4c')]};return db[_0x8405('0x3a')]['count'](_0x3c516f)[_0x8405('0x1f')](function(_0x4e9c9e){_0x2d1e0a[_0x8405('0x51')]=_0x4e9c9e;if(_0x565324[_0x8405('0x40')][_0x8405('0x52')]){_0x968b59[_0x8405('0x53')]=[{'all':!![]}];}return db[_0x8405('0x3a')][_0x8405('0x54')](_0x968b59);})[_0x8405('0x1f')](function(_0x32fb03){_0x2d1e0a['rows']=_0x32fb03;return _0x2d1e0a;})[_0x8405('0x1f')](respondWithFilteredResult(_0x40b6e0,_0x968b59))[_0x8405('0x2a')](handleError(_0x40b6e0,null));};exports[_0x8405('0x55')]=function(_0x3e4473,_0x5d733d){var _0x53b60b={'raw':!![],'where':{'id':_0x3e4473[_0x8405('0x56')]['id']}},_0x3ca145={};_0x3ca145[_0x8405('0x44')]=_[_0x8405('0x41')](db[_0x8405('0x3a')][_0x8405('0x3b')]);_0x3ca145[_0x8405('0x40')]=_['keys'](_0x3e4473['query']);_0x3ca145[_0x8405('0x42')]=_['intersection'](_0x3ca145[_0x8405('0x44')],_0x3ca145[_0x8405('0x40')]);_0x53b60b[_0x8405('0x46')]=_['intersection'](_0x3ca145['model'],qs[_0x8405('0x45')](_0x3e4473['query'][_0x8405('0x45')]));_0x53b60b[_0x8405('0x46')]=_0x53b60b[_0x8405('0x46')][_0x8405('0x47')]?_0x53b60b[_0x8405('0x46')]:_0x3ca145[_0x8405('0x44')];if(_0x3e4473[_0x8405('0x40')][_0x8405('0x52')]){_0x53b60b[_0x8405('0x53')]=[{'all':!![]}];}_0x53b60b=_['merge']({},_0x53b60b,_0x3e4473[_0x8405('0x50')]);return db[_0x8405('0x3a')][_0x8405('0x57')](_0x53b60b)[_0x8405('0x1f')](handleEntityNotFound(_0x5d733d,null))['then'](respondWithResult(_0x5d733d,null))[_0x8405('0x2a')](handleError(_0x5d733d,null));};exports[_0x8405('0x58')]=function(_0x47760c,_0x22d378){return db[_0x8405('0x3a')][_0x8405('0x58')](_0x47760c['body'],{})[_0x8405('0x1f')](respondWithResult(_0x22d378,0xc9))[_0x8405('0x2a')](handleError(_0x22d378,null));};exports[_0x8405('0x34')]=function(_0x550f08,_0x43a0f4){if(_0x550f08[_0x8405('0x59')]['id']){delete _0x550f08[_0x8405('0x59')]['id'];}return db[_0x8405('0x3a')][_0x8405('0x57')]({'where':{'id':_0x550f08[_0x8405('0x56')]['id']}})[_0x8405('0x1f')](handleEntityNotFound(_0x43a0f4,null))[_0x8405('0x1f')](saveUpdates(_0x550f08[_0x8405('0x59')],null))[_0x8405('0x1f')](respondWithResult(_0x43a0f4,null))['catch'](handleError(_0x43a0f4,null));};exports[_0x8405('0x35')]=function(_0x5a2a1a,_0x28ba4f){return db['SmsMessage'][_0x8405('0x57')]({'where':{'id':_0x5a2a1a[_0x8405('0x56')]['id']}})[_0x8405('0x1f')](handleEntityNotFound(_0x28ba4f,null))[_0x8405('0x1f')](removeEntity(_0x28ba4f,null))[_0x8405('0x2a')](handleError(_0x28ba4f,null));};exports['describe']=function(_0x350e04,_0x48f7a7){return db['SmsMessage'][_0x8405('0x5a')]()['then'](respondWithResult(_0x48f7a7,null))[_0x8405('0x2a')](handleError(_0x48f7a7,null));};var interaction_log=require(_0x8405('0x13'))(_0x8405('0x5b'));exports['accept']=function(_0x37793c,_0x2dd310,_0x2b4013){var _0x1f5c6e={'channel':_0x8405('0x5c')};if(_0x37793c[_0x8405('0x59')]['id']){delete _0x37793c['body']['id'];}_0x37793c[_0x8405('0x59')][_0x8405('0x5d')]=!![];_0x37793c[_0x8405('0x59')]['readAt']=moment()['format'](_0x8405('0x5e'));_0x37793c[_0x8405('0x59')][_0x8405('0x5f')]=_0x37793c[_0x8405('0x59')][_0x8405('0x5f')]||_0x37793c['user']['id'];return db['SmsMessage']['find']({'where':{'id':_0x37793c[_0x8405('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x8405('0x60')],'as':_0x8405('0x61')}]})[_0x8405('0x1f')](handleEntityNotFound(_0x2dd310,null))[_0x8405('0x1f')](saveUpdates(_0x37793c[_0x8405('0x59')],null))[_0x8405('0x1f')](function(_0x22ce58){if(_0x22ce58){_0x1f5c6e[_0x8405('0x28')]=_0x22ce58[_0x8405('0x62')]({'plain':!![]});return db[_0x8405('0x63')][_0x8405('0x57')]({'where':{'id':_0x22ce58['SmsInteractionId']}});}return null;})[_0x8405('0x1f')](handleEntityNotFound(_0x2dd310,null))[_0x8405('0x1f')](function(_0x50c8e2){if(_0x50c8e2){return _0x50c8e2[_0x8405('0x34')]({'UserId':_0x37793c[_0x8405('0x59')][_0x8405('0x5f')],'read1stAt':_[_0x8405('0x64')](_0x50c8e2[_0x8405('0x65')])?moment()[_0x8405('0x66')](_0x8405('0x5e')):undefined});}return null;})[_0x8405('0x1f')](function(_0xe0f908){if(_0xe0f908){_0x1f5c6e['interaction']=_0xe0f908[_0x8405('0x62')]({'plain':!![]});interaction_log[_0x8405('0x20')](_0x8405('0x67'),_0x37793c['user']['id'],_0x37793c[_0x8405('0x68')][_0x8405('0x37')],_0x37793c[_0x8405('0x68')][_0x8405('0x69')],_0x1f5c6e[_0x8405('0x6a')]['id'],_0x37793c['body']?JSON[_0x8405('0x25')](_0x37793c[_0x8405('0x59')]):_0x8405('0x6b'));return respondWithRpcPromise(_0x8405('0x6c'),_0x8405('0x6d'),_0x1f5c6e);}return null;})[_0x8405('0x1f')](function(_0x8875e3){if(_0x8875e3){if(_0x37793c[_0x8405('0x59')][_0x8405('0x6e')]){_0x1f5c6e['message'][_0x8405('0x6f')]=util['format'](_0x8405('0x70'),_0x37793c[_0x8405('0x68')]['name']);_0x1f5c6e['message']['channel']=_0x1f5c6e['channel'];_0x1f5c6e[_0x8405('0x28')]['event']=_0x8405('0x71');return respondWithRpcPromise(_0x8405('0x72'),_0x8405('0x72'),{'event':_0x8405('0x73'),'message':_0x1f5c6e[_0x8405('0x28')]},client9002)[_0x8405('0x1f')](function(){return _0x1f5c6e;});}return _0x1f5c6e;}return null;})[_0x8405('0x1f')](respondWithResult(_0x2dd310,null))['catch'](handleError(_0x2dd310,null));};var interaction_log=require(_0x8405('0x13'))(_0x8405('0x5b'));exports['reject']=function(_0x55f959,_0x48b045,_0x4eea07){var _0x4d6e0c={'agent':{},'channel':'sms'};if(_0x55f959[_0x8405('0x59')]['id']){delete _0x55f959[_0x8405('0x59')]['id'];}_0x55f959[_0x8405('0x59')][_0x8405('0x5f')]=_0x55f959[_0x8405('0x59')]['UserId']||_0x55f959[_0x8405('0x68')]['id'];_0x4d6e0c[_0x8405('0x74')]['id']=_0x55f959[_0x8405('0x59')][_0x8405('0x5f')];return db[_0x8405('0x3a')]['find']({'where':{'id':_0x55f959[_0x8405('0x56')]['id'],'UserId':null}})[_0x8405('0x1f')](handleEntityNotFound(_0x48b045,null))[_0x8405('0x1f')](function(_0x32766f){if(_0x32766f){_0x4d6e0c[_0x8405('0x28')]=_0x32766f[_0x8405('0x62')]({'plain':!![]});return db[_0x8405('0x63')][_0x8405('0x57')]({'where':{'id':_0x32766f['SmsInteractionId']}});}return null;})[_0x8405('0x1f')](handleEntityNotFound(_0x48b045,null))[_0x8405('0x1f')](function(_0x2d3847){if(_0x2d3847){_0x4d6e0c[_0x8405('0x6a')]=_0x2d3847[_0x8405('0x62')]({'plain':!![]});interaction_log[_0x8405('0x20')](_0x8405('0x75'),_0x55f959[_0x8405('0x68')]['id'],_0x55f959[_0x8405('0x68')][_0x8405('0x37')],_0x55f959[_0x8405('0x68')][_0x8405('0x69')],_0x4d6e0c[_0x8405('0x6a')]['id'],_0x55f959[_0x8405('0x59')]?JSON[_0x8405('0x25')](_0x55f959[_0x8405('0x59')]):'null');return respondWithRpcPromise(_0x8405('0x76'),_0x8405('0x77'),_0x4d6e0c);}return null;})[_0x8405('0x1f')](function(_0x5b2b2b){if(_0x5b2b2b){_0x5b2b2b[_0x8405('0x28')][_0x8405('0x6f')]=util[_0x8405('0x66')](_0x8405('0x70'),_0x55f959[_0x8405('0x68')][_0x8405('0x37')]);_0x5b2b2b[_0x8405('0x28')][_0x8405('0x78')]=_0x4d6e0c[_0x8405('0x78')];_0x5b2b2b[_0x8405('0x28')]['event']='reject';respondWithRpcPromise(_0x8405('0x72'),_0x8405('0x72'),{'event':'rejectmessage','message':_0x5b2b2b[_0x8405('0x28')]},client9002);return _0x4d6e0c;}return null;})[_0x8405('0x1f')](respondWithResult(_0x48b045,null))[_0x8405('0x2a')](handleError(_0x48b045,null));};exports['status']=function(_0x537624,_0x4d185e,_0x4ed271){if(_0x537624[_0x8405('0x59')]['id']){delete _0x537624[_0x8405('0x59')]['id'];}var _0x37a642;return db['SmsMessage'][_0x8405('0x57')]({'where':{'id':_0x537624[_0x8405('0x56')]['id']}})[_0x8405('0x1f')](handleEntityNotFound(_0x4d185e,null))[_0x8405('0x1f')](function(_0x496893){if(_0x496893){_0x37a642=_0x496893;return db['SmsAccount'][_0x8405('0x57')]({'where':{'id':_0x496893[_0x8405('0x79')]}});}})['then'](handleEntityNotFound(_0x4d185e,null))[_0x8405('0x1f')](function(_0x1bbb21){if(_0x1bbb21){logger[_0x8405('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8405('0x2c'),_0x8405('0x7a'),_0x1bbb21[_0x8405('0x3d')],util[_0x8405('0x7b')](_0x537624[_0x8405('0x59')],{'showHidden':![],'depth':null}));switch(_0x1bbb21[_0x8405('0x3d')]){case _0x8405('0x7c'):if(_0x537624[_0x8405('0x59')][_0x8405('0x7d')]&&_0x537624[_0x8405('0x59')]['MessageSid']===_0x37a642[_0x8405('0x7e')]){return _0x37a642[_0x8405('0x34')]({'read':!![]});}else{logger[_0x8405('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x8405('0x7b')](_0x537624[_0x8405('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8405('0x7f'):if(_0x537624[_0x8405('0x59')]['MessageUUID']&&_0x537624[_0x8405('0x59')][_0x8405('0x80')]===_0x37a642[_0x8405('0x7e')]&&_[_0x8405('0x81')]([_0x8405('0x82'),_0x8405('0x83')],_0x537624[_0x8405('0x59')][_0x8405('0x84')])>=0x0){return _0x37a642[_0x8405('0x34')]({'read':!![]});}else{logger[_0x8405('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x8405('0x85'),util[_0x8405('0x7b')](_0x537624[_0x8405('0x59')],{'showHidden':![],'depth':null}));}break;case _0x8405('0x86'):var _0x689ca1=_0x537624[_0x8405('0x59')][_0x8405('0x87')][0x0];if(_0x689ca1[_0x8405('0x2c')][_0x8405('0x88')]==='DELIVERED'){return _0x37a642[_0x8405('0x34')]({'read':!![]});}else{logger[_0x8405('0x26')](_0x8405('0x89'),'status',_0x8405('0x86'),util[_0x8405('0x7b')](_0x537624[_0x8405('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x37a642;}})['then'](respondWithResult(_0x4d185e,null))['catch'](handleError(_0x4d185e,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index f507234..ae761eb 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 _0x25d8=['save','remove','emit','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x25d8,0x125));var _0x825d=function(_0x569f87,_0x23836a){_0x569f87=_0x569f87-0x0;var _0x2c87cb=_0x25d8[_0x569f87];return _0x2c87cb;};'use strict';var EventEmitter=require(_0x825d('0x0'));var SmsMessage=require(_0x825d('0x1'))['db'][_0x825d('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x825d('0x3'),'afterUpdate':'update','afterDestroy':_0x825d('0x4')};function emitEvent(_0x7b1089){return function(_0x9c07fe,_0x4c572e,_0x5d6600){SmsMessageEvents[_0x825d('0x5')](_0x7b1089+':'+_0x9c07fe['id'],_0x9c07fe);SmsMessageEvents[_0x825d('0x5')](_0x7b1089,_0x9c07fe);_0x5d6600(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x825d('0x6')](e,emitEvent(event));}}module[_0x825d('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xbcce=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x56f4a0,_0x45922a){var _0xbb731b=function(_0x1b39c5){while(--_0x1b39c5){_0x56f4a0['push'](_0x56f4a0['shift']());}};_0xbb731b(++_0x45922a);}(_0xbcce,0x1ee));var _0xebcc=function(_0x5965dc,_0x4dcb0a){_0x5965dc=_0x5965dc-0x0;var _0x5c82d1=_0xbcce[_0x5965dc];return _0x5c82d1;};'use strict';var EventEmitter=require(_0xebcc('0x0'));var SmsMessage=require(_0xebcc('0x1'))['db'][_0xebcc('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xebcc('0x3')](0x0);var events={'afterCreate':_0xebcc('0x4'),'afterUpdate':_0xebcc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3a3f8a){return function(_0x4932c8,_0x47e328,_0x320e12){SmsMessageEvents[_0xebcc('0x6')](_0x3a3f8a+':'+_0x4932c8['id'],_0x4932c8);SmsMessageEvents[_0xebcc('0x6')](_0x3a3f8a,_0x4932c8);_0x320e12(null);};}for(var e in events){if(events[_0xebcc('0x7')](e)){var event=events[e];SmsMessage[_0xebcc('0x8')](e,emitEvent(event));}}module[_0xebcc('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 9fc69fb..1613569 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 _0x5290=['toLowerCase','out','secret','UserId','SmsInteraction','findOne','createdAt','error','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','phone','messages','create','remote','/api/sms/messages/','/status?token=','update','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','http_code','data','head','message_id','clickSend','plivo','authToken','token','authId','toString','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','length','createHash','md5','digest','signature=','GET','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','messageId','body','FULLTEXT','models','get','direction'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5290,0x65));var _0x0529=function(_0x7b1927,_0x7d3e65){_0x7b1927=_0x7b1927-0x0;var _0x2deaaa=_0x5290[_0x7b1927];return _0x2deaaa;};'use strict';var _=require(_0x0529('0x0'));var util=require(_0x0529('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0529('0x2'));var rp=require(_0x0529('0x3'));var fs=require('fs');var path=require(_0x0529('0x4'));var rimraf=require(_0x0529('0x5'));var config=require(_0x0529('0x6'));var attributes=require(_0x0529('0x7'));module[_0x0529('0x8')]=function(_0x4d68ea,_0x3cbbf4){return _0x4d68ea[_0x0529('0x9')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x0529('0xa'),'fields':[_0x0529('0xa')]},{'name':'fti_sms_messages','fields':[_0x0529('0xb')],'type':_0x0529('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x255229,_0x2f2931,_0x2f09fa){var _0x54e22a=_0x4d68ea[_0x0529('0xd')];var _0x382873=_0x255229[_0x0529('0xe')]({'plain':!![]});if(_0x382873[_0x0529('0xf')]['toLowerCase']()==='in'||_0x382873['direction'][_0x0529('0x10')]()===_0x0529('0x11')&&!_0x382873[_0x0529('0x12')]&&!_['isNil'](_0x382873[_0x0529('0x13')])){_0x54e22a[_0x0529('0x14')][_0x0529('0x15')]({'where':{'id':_0x382873['SmsInteractionId']}})['then'](function(_0x4f3a7e){if(_0x4f3a7e){_0x4f3a7e['update']({'lastMsgAt':_0x382873[_0x0529('0x16')],'lastMsgDirection':_0x382873[_0x0529('0xf')][_0x0529('0x10')]()});}})['catch'](function(_0x3b9f7b){console[_0x0529('0x17')](_0x3b9f7b);});}if(_0x382873[_0x0529('0xf')]===_0x0529('0x11')&&!_0x382873['secret']){var _0xca87bb;_0x54e22a[_0x0529('0x18')][_0x0529('0x19')]({'where':{'id':_0x382873[_0x0529('0x1a')]},'raw':!![]})[_0x0529('0x1b')](function(_0x1b9fbc){_0xca87bb=_0x1b9fbc;if(_0xca87bb&&_0xca87bb['type']){switch(_0xca87bb[_0x0529('0x1c')]){case _0x0529('0x1d'):var _0x3e2069=require(_0x0529('0x1d'));if(_0xca87bb[_0x0529('0x1e')]&&_0xca87bb['authToken']&&_0xca87bb[_0x0529('0x1f')]){var _0x4caed1=new _0x3e2069(_0xca87bb[_0x0529('0x1e')],_0xca87bb['authToken']);_0x4caed1[_0x0529('0x20')][_0x0529('0x21')]({'body':_0x382873[_0x0529('0xb')],'to':_0x382873[_0x0529('0x1f')],'from':_0xca87bb[_0x0529('0x1f')],'statusCallback':_0xca87bb[_0x0529('0x22')]+_0x0529('0x23')+_0x382873['id']+_0x0529('0x24')+_0xca87bb['token']})[_0x0529('0x1b')](function(_0xc4bd5){if(_0xc4bd5['sid']){return _0x255229[_0x0529('0x25')]({'messageId':_0xc4bd5[_0x0529('0x26')]});}})[_0x0529('0x27')](function(_0x2e33a6){logger[_0x0529('0x17')](_0x0529('0x28'),_0x0529('0x29'),_0x0529('0x1d'),util[_0x0529('0x2a')](_0x2e33a6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0529('0x28'),'afterCreate',_0x0529('0x1d'),_0x0529('0x2b'));}break;case'skebby':var _0x39f248=_0x0529('0x2c');if(_0xca87bb[_0x0529('0x2d')]&&_0xca87bb[_0x0529('0x2e')]){var _0x3ee9db={'recipient':[_0x382873['phone']],'message':_0x382873[_0x0529('0xb')],'message_type':_0xca87bb[_0x0529('0x2f')]};if(_0xca87bb['smsMethod']&&_0xca87bb[_0x0529('0x2f')]!=='SI'){_0x3ee9db[_0x0529('0x30')]=_0xca87bb[_0x0529('0x1f')];}var _0x42b609={'url':_0x39f248+_0x0529('0x31')+_0xca87bb[_0x0529('0x2d')]+'&password='+_0xca87bb['password'],'method':'GET'};rp(_0x42b609)[_0x0529('0x1b')](function(_0x11e598){var _0x268a0b=_0x11e598[_0x0529('0x32')](';');var _0x1ec745={'user_key':_0x268a0b[0x0],'session_key':_0x268a0b[0x1]};_0x42b609={'url':_0x39f248+_0x0529('0x33'),'method':_0x0529('0x34'),'headers':{'user_key':_0x1ec745[_0x0529('0x35')],'Session_key':_0x1ec745[_0x0529('0x36')]},'json':!![],'body':_0x3ee9db};return rp(_0x42b609);})[_0x0529('0x1b')](function(_0x1da36c){if(_0x1da36c[_0x0529('0x37')]>=0x1){var _0xbc3c4f={'messageId':_0x1da36c[_0x0529('0x38')]};if(_0xca87bb['smsMethod']!=='GP'||!_0xca87bb[_0x0529('0x39')]){_0xbc3c4f[_0x0529('0x3a')]=!![];}return _0x255229['update'](_0xbc3c4f);}else{return logger[_0x0529('0x17')](_0x0529('0x28'),_0x0529('0x29'),_0x0529('0x3b'),util[_0x0529('0x2a')](_0x1da36c,{'showHidden':![],'depth':null}));}})[_0x0529('0x27')](function(_0x5122d7){return logger[_0x0529('0x17')](_0x0529('0x28'),_0x0529('0x29'),'skebby',util[_0x0529('0x2a')](_0x5122d7,{'showHidden':![],'depth':null}));});}else{logger[_0x0529('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0529('0x29'),_0x0529('0x3b'),_0x0529('0x3c'));}break;case'connectel':if(_0xca87bb['authToken']){var _0x10020f={'recipient':_0x382873[_0x0529('0x1f')],'message':_0x382873['body'],'sender':_0xca87bb[_0x0529('0x3d')]||_0xca87bb[_0x0529('0x1f')],'authorization':_0xca87bb['authToken']};var _0x2f2931={'method':_0x0529('0x34'),'uri':_0x0529('0x3e'),'body':_0x10020f,'json':!![]};rp(_0x2f2931)[_0x0529('0x1b')](function(_0x6fc863){var _0x20c813={'messageId':_0x6fc863[_0x0529('0x3f')]};if(!_0xca87bb[_0x0529('0x39')]){_0x20c813[_0x0529('0x3a')]=!![];}return _0x255229[_0x0529('0x25')](_0x20c813);})[_0x0529('0x27')](function(_0x32a5c0){logger[_0x0529('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel',util[_0x0529('0x2a')](_0x32a5c0,{'showHidden':![],'depth':null}));});}else{logger[_0x0529('0x17')](_0x0529('0x28'),_0x0529('0x29'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0x0529('0x40'):if(_0xca87bb[_0x0529('0x2d')]&&_0xca87bb[_0x0529('0x2e')]){var _0x10020f={'messages':[{'source':_0x0529('0x41'),'to':_0x382873[_0x0529('0x1f')],'body':_0x382873[_0x0529('0xb')],'from':_0xca87bb[_0x0529('0x3d')]||_0xca87bb['phone']}]};var _0x19dada=util[_0x0529('0x42')](_0x0529('0x43'),_0xca87bb[_0x0529('0x2d')],_0xca87bb[_0x0529('0x2e')]);var _0x2f2931={'method':_0x0529('0x34'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x10020f,'headers':{'Authorization':util[_0x0529('0x42')](_0x0529('0x44'),new Buffer(_0x19dada)['toString']('base64'))},'json':!![]};rp(_0x2f2931)[_0x0529('0x1b')](function(_0x614057){if(_0x614057['http_code']>=0xc8&&_0x614057[_0x0529('0x45')]<=0xce){if(_0x614057['data']&&_0x614057[_0x0529('0x46')]['queued_count']>0x0){var _0x2ceb95=_[_0x0529('0x47')](_0x614057[_0x0529('0x46')][_0x0529('0x20')]);var _0x1bc535={'messageId':_0x2ceb95[_0x0529('0x48')]};if(!_0xca87bb[_0x0529('0x39')]){_0x1bc535[_0x0529('0x3a')]=!![];}return _0x255229[_0x0529('0x25')](_0x1bc535);}else{logger['error'](_0x0529('0x28'),_0x0529('0x29'),_0x0529('0x49'),util[_0x0529('0x2a')](_0x614057,{'showHidden':![],'depth':null}));}}else{logger[_0x0529('0x17')](_0x0529('0x28'),'afterCreate','clickSend',util[_0x0529('0x2a')](_0x614057,{'showHidden':![],'depth':null}));}})[_0x0529('0x27')](function(_0x139593){logger[_0x0529('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0529('0x29'),_0x0529('0x49'),util[_0x0529('0x2a')](_0x139593,{'showHidden':![],'depth':null}));});}else{logger[_0x0529('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0529('0x49'),_0x0529('0x3c'));}break;case _0x0529('0x4a'):if(_0xca87bb['authId']&&_0xca87bb[_0x0529('0x4b')]){var _0x10020f={'dst':_0x382873[_0x0529('0x1f')],'text':_0x382873['body'],'src':_0xca87bb[_0x0529('0x3d')]||_0xca87bb[_0x0529('0x1f')],'url':_0xca87bb['remote']+'/api/sms/messages/'+_0x382873['id']+_0x0529('0x24')+_0xca87bb[_0x0529('0x4c')]};var _0x19dada=util[_0x0529('0x42')](_0x0529('0x43'),_0xca87bb[_0x0529('0x4d')],_0xca87bb['authToken']);var _0x2f2931={'method':_0x0529('0x34'),'uri':util[_0x0529('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0xca87bb[_0x0529('0x4d')]),'body':_0x10020f,'headers':{'Authorization':util[_0x0529('0x42')](_0x0529('0x44'),new Buffer(_0x19dada)[_0x0529('0x4e')](_0x0529('0x4f')))},'json':!![]};rp(_0x2f2931)['then'](function(_0x189f5d){var _0x345974={'messageId':_0x189f5d[_0x0529('0x50')][0x0]};return _0x255229[_0x0529('0x25')](_0x345974);})[_0x0529('0x27')](function(_0x5f28e9){logger['error'](_0x0529('0x28'),_0x0529('0x29'),_0x0529('0x4a'),util[_0x0529('0x2a')](_0x5f28e9,{'showHidden':![],'depth':null}));});}else{logger[_0x0529('0x17')](_0x0529('0x28'),_0x0529('0x29'),_0x0529('0x4a'),_0x0529('0x51'));}break;case _0x0529('0x52'):if(_0xca87bb[_0x0529('0x2d')]&&_0xca87bb['password']){if(_0xca87bb['baseUrl']){var _0x2a9a9f={'method':'POST','uri':_0xca87bb[_0x0529('0x53')]+'/auth/1/session','body':{'username':_0xca87bb[_0x0529('0x2d')],'password':_0xca87bb[_0x0529('0x2e')]},'json':!![]};return rp(_0x2a9a9f)['then'](function(_0x23ae46){var _0x5c799c={'method':'POST','uri':_0xca87bb[_0x0529('0x53')]+_0x0529('0x54'),'body':{'messages':[{'from':_0xca87bb[_0x0529('0x1f')],'destinations':[{'to':_0x382873[_0x0529('0x1f')]}],'text':_0x382873[_0x0529('0xb')],'notifyUrl':_0xca87bb[_0x0529('0x22')]+'/api/sms/messages/'+_0x382873['id']+_0x0529('0x24')+_0xca87bb[_0x0529('0x4c')],'notifyContentType':'application/json','callbackData':_0xca87bb[_0x0529('0x1f')]+';'+_0x382873[_0x0529('0xb')]}]},'headers':{'Authorization':_0x0529('0x55')+_0x23ae46[_0x0529('0x4c')]},'json':!![]};return rp(_0x5c799c)[_0x0529('0x1b')](function(_0x21409d){if(_0x21409d[_0x0529('0x20')]){var _0x5517d0={'messageId':_0x21409d[_0x0529('0x20')][0x0][_0x0529('0xa')]};if(!_0xca87bb[_0x0529('0x39')]){_0x5517d0[_0x0529('0x3a')]=!![];}return _0x255229[_0x0529('0x25')](_0x5517d0);}else{return logger[_0x0529('0x17')](_0x0529('0x28'),_0x0529('0x29'),_0x0529('0x52'),util[_0x0529('0x2a')](_0x21409d,{'showHidden':![],'depth':null}));}});})[_0x0529('0x27')](function(_0x224d96){return logger[_0x0529('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0529('0x29'),'infobip',util['inspect'](_0x224d96,{'showHidden':![],'depth':null}));});}else{logger[_0x0529('0x17')](_0x0529('0x28'),_0x0529('0x29'),_0x0529('0x52'),_0x0529('0x56'));}}else{logger[_0x0529('0x17')](_0x0529('0x28'),_0x0529('0x29'),_0x0529('0x52'),_0x0529('0x3c'));}break;case'csc':var _0x2064ab=require(_0x0529('0x57'));if(_0xca87bb[_0x0529('0x58')]){var _0x287c5e={};_0x287c5e[_0x0529('0x59')]=_0xca87bb[_0x0529('0x2d')];_0x287c5e['phone']=_0x382873[_0x0529('0x1f')];_0x287c5e['sender']=_0xca87bb[_0x0529('0x1f')];_0x287c5e[_0x0529('0x5a')]=_0x382873['body'];_0x287c5e['timestamp']=+new Date();var _0x5e1f3a='';var _0x4ababb='';var _0x3dc9b8=Object['keys'](_0x287c5e);_0x3dc9b8['sort']();for(var _0x447f15=0x0;_0x447f15<_0x3dc9b8[_0x0529('0x5b')];_0x447f15++){if(_0x5e1f3a!=''){_0x5e1f3a+='&';}_0x5e1f3a+=_0x3dc9b8[_0x447f15]+'='+encodeURIComponent(_0x287c5e[_0x3dc9b8[_0x447f15]]);_0x4ababb+=_0x287c5e[_0x3dc9b8[_0x447f15]];}_0x4ababb+=_0xca87bb[_0x0529('0x58')];_0x4ababb=_0x2064ab[_0x0529('0x5c')](_0x0529('0x5d'))['update'](_0x4ababb)[_0x0529('0x5e')]('hex');if(_0x5e1f3a!==''){_0x5e1f3a+='&';}_0x5e1f3a+=_0x0529('0x5f')+_0x4ababb;var _0x42b609={'method':_0x0529('0x60'),'uri':_0xca87bb[_0x0529('0x53')]+_0x0529('0x61')+_0x5e1f3a,'json':!![]};return rp(_0x42b609)[_0x0529('0x1b')](function(_0x2696fc){var _0x3bc7a9=Object[_0x0529('0x62')](_0x2696fc);if(_0x2696fc[_0x3bc7a9[0x0]]['error']&&parseInt(_0x2696fc[_0x3bc7a9[0x0]][_0x0529('0x17')])===0x0){var _0x3286a6={'messageId':_0x2696fc[_0x3bc7a9[0x0]][_0x0529('0x63')]};if(!_0xca87bb[_0x0529('0x39')]){_0x3286a6['read']=!![];}return _0x255229[_0x0529('0x25')](_0x3286a6);}else{return logger['error'](_0x0529('0x28'),_0x0529('0x29'),'csc',util[_0x0529('0x2a')](_0x2696fc['error'],{'showHidden':![],'depth':null}));}})[_0x0529('0x27')](function(_0x140ee7){return logger[_0x0529('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0529('0x29'),'csc',util[_0x0529('0x2a')](_0x140ee7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0529('0x28'),_0x0529('0x29'),'csc',_0x0529('0x64'));}break;case'clickatell':if(_0xca87bb[_0x0529('0x58')]){var _0x198873={'method':_0x0529('0x34'),'uri':_0x0529('0x65'),'headers':{'Authorization':_0xca87bb[_0x0529('0x58')]},'body':{'content':_0x382873[_0x0529('0xb')],'to':[_0x382873[_0x0529('0x1f')]],'from':_0xca87bb['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x0529('0x66')},'json':!![]};rp(_0x198873)[_0x0529('0x1b')](function(_0x568932){if(!_0x568932[_0x0529('0x17')]){var _0x301b55={'messageId':_0x568932[_0x0529('0x20')][0x0][_0x0529('0x67')]};if(!_0xca87bb[_0x0529('0x39')]){_0x301b55[_0x0529('0x3a')]=!![];}return _0x255229[_0x0529('0x25')](_0x301b55);}else{return logger[_0x0529('0x17')](_0x0529('0x28'),_0x0529('0x29'),_0x0529('0x68'),util[_0x0529('0x2a')](_0x568932['error'],{'showHidden':![],'depth':null}));}})[_0x0529('0x27')](function(_0x46c18f){return logger[_0x0529('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0529('0x68'),util['inspect'](_0x46c18f,{'showHidden':![],'depth':null}));});}else{logger[_0x0529('0x17')](_0x0529('0x28'),'afterCreate',_0x0529('0x68'),'Missing\x20parameters:\x20apiKey');}break;case'intelepeer':if(_0xca87bb[_0x0529('0x58')]){var _0x5845ca={};var _0x42b609={'method':_0x0529('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x0529('0x69')+_0xca87bb[_0x0529('0x58')],'Content-Type':_0x0529('0x6a')},'body':{'from':_0xca87bb[_0x0529('0x1f')],'to':_0x382873[_0x0529('0x1f')],'text':_0x382873[_0x0529('0xb')]},'json':!![]};return rp(_0x42b609)[_0x0529('0x1b')](function(_0x112424){if(_0x112424[_0x0529('0x6b')]==0xca){_0x5845ca[_0x0529('0x6c')]=_0x112424;var _0x3884b6={'method':'POST','uri':_0x0529('0x6d'),'headers':{'Authorization':_0x0529('0x69')+_0xca87bb[_0x0529('0x58')],'Content-Type':'application/json'},'body':{'refid':_0x5845ca[_0x0529('0x6c')][_0x0529('0x6e')]},'json':!![]};return rp(_0x3884b6)[_0x0529('0x1b')](function(_0x4e7cdd){_0x5845ca[_0x0529('0x6f')]=_0x4e7cdd;var _0x3a9e4e={'messageId':_0x5845ca[_0x0529('0x6c')][_0x0529('0x6e')],'read':!![]};return _0x255229['update'](_0x3a9e4e);});}else{return logger[_0x0529('0x17')](_0x0529('0x28'),_0x0529('0x29'),_0x0529('0x70'),util[_0x0529('0x2a')](_0x112424,{'showHidden':![],'depth':null}));}})['catch'](function(_0x581bc0){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0529('0x70'),util[_0x0529('0x2a')](_0x581bc0,{'showHidden':![],'depth':null}));});}else{return logger[_0x0529('0x17')](_0x0529('0x28'),_0x0529('0x29'),_0x0529('0x70'),_0x0529('0x71'));}break;}}})[_0x0529('0x72')](function(){_0x2f09fa();});}else{_0x2f09fa();}}},'charset':_0x0529('0x73'),'collate':_0x0529('0x74')});}; \ No newline at end of file +var _0xc3c7=['sms_messages','messageId','fti_sms_messages','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','error','secret','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','body','smsMethod','&password=','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','senderString','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','apiKey','createHash','md5','digest','hex','/external/get/send.php?','clickatell','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsMessage'];(function(_0x4e3f19,_0x2998f3){var _0x1bb71b=function(_0x56b9bd){while(--_0x56b9bd){_0x4e3f19['push'](_0x4e3f19['shift']());}};_0x1bb71b(++_0x2998f3);}(_0xc3c7,0x1d5));var _0x7c3c=function(_0x3f88d7,_0x44425d){_0x3f88d7=_0x3f88d7-0x0;var _0x1833b3=_0xc3c7[_0x3f88d7];return _0x1833b3;};'use strict';var _=require(_0x7c3c('0x0'));var util=require(_0x7c3c('0x1'));var logger=require(_0x7c3c('0x2'))(_0x7c3c('0x3'));var moment=require('moment');var BPromise=require(_0x7c3c('0x4'));var rp=require(_0x7c3c('0x5'));var fs=require('fs');var path=require(_0x7c3c('0x6'));var rimraf=require(_0x7c3c('0x7'));var config=require(_0x7c3c('0x8'));var attributes=require('./smsMessage.attributes');module[_0x7c3c('0x9')]=function(_0x463c74,_0x485dac){return _0x463c74['define'](_0x7c3c('0xa'),attributes,{'tableName':_0x7c3c('0xb'),'paranoid':![],'indexes':[{'name':_0x7c3c('0xc'),'fields':['messageId']},{'name':_0x7c3c('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x399eef,_0x3b3940,_0x55045e){var _0x5900a9=_0x463c74[_0x7c3c('0xe')];var _0x2beafa=_0x399eef[_0x7c3c('0xf')]({'plain':!![]});if(_0x2beafa[_0x7c3c('0x10')]['toLowerCase']()==='in'||_0x2beafa[_0x7c3c('0x10')][_0x7c3c('0x11')]()===_0x7c3c('0x12')&&!_0x2beafa['secret']&&!_[_0x7c3c('0x13')](_0x2beafa[_0x7c3c('0x14')])){_0x5900a9[_0x7c3c('0x15')][_0x7c3c('0x16')]({'where':{'id':_0x2beafa['SmsInteractionId']}})[_0x7c3c('0x17')](function(_0x59121d){if(_0x59121d){_0x59121d[_0x7c3c('0x18')]({'lastMsgAt':_0x2beafa[_0x7c3c('0x19')],'lastMsgDirection':_0x2beafa[_0x7c3c('0x10')][_0x7c3c('0x11')]()});}})['catch'](function(_0x5a5ca9){console[_0x7c3c('0x1a')](_0x5a5ca9);});}if(_0x2beafa[_0x7c3c('0x10')]===_0x7c3c('0x12')&&!_0x2beafa[_0x7c3c('0x1b')]){var _0x8f4e04;_0x5900a9['SmsAccount'][_0x7c3c('0x1c')]({'where':{'id':_0x2beafa[_0x7c3c('0x1d')]},'raw':!![]})[_0x7c3c('0x17')](function(_0x39815a){_0x8f4e04=_0x39815a;if(_0x8f4e04&&_0x8f4e04[_0x7c3c('0x1e')]){switch(_0x8f4e04['type']){case _0x7c3c('0x1f'):var _0x1ba415=require(_0x7c3c('0x1f'));if(_0x8f4e04[_0x7c3c('0x20')]&&_0x8f4e04[_0x7c3c('0x21')]&&_0x8f4e04[_0x7c3c('0x22')]){var _0x4f0233=new _0x1ba415(_0x8f4e04[_0x7c3c('0x20')],_0x8f4e04['authToken']);_0x4f0233[_0x7c3c('0x23')]['create']({'body':_0x2beafa['body'],'to':_0x2beafa[_0x7c3c('0x22')],'from':_0x8f4e04[_0x7c3c('0x22')],'statusCallback':_0x8f4e04[_0x7c3c('0x24')]+_0x7c3c('0x25')+_0x2beafa['id']+_0x7c3c('0x26')+_0x8f4e04[_0x7c3c('0x27')]})[_0x7c3c('0x17')](function(_0x588172){if(_0x588172[_0x7c3c('0x28')]){return _0x399eef[_0x7c3c('0x18')]({'messageId':_0x588172[_0x7c3c('0x28')]});}})[_0x7c3c('0x29')](function(_0x8348ae){logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x1f'),util['inspect'](_0x8348ae,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'twilio',_0x7c3c('0x2c'));}break;case _0x7c3c('0x2d'):var _0x40f42e=_0x7c3c('0x2e');if(_0x8f4e04[_0x7c3c('0x2f')]&&_0x8f4e04[_0x7c3c('0x30')]){var _0x33769b={'recipient':[_0x2beafa[_0x7c3c('0x22')]],'message':_0x2beafa[_0x7c3c('0x31')],'message_type':_0x8f4e04['smsMethod']};if(_0x8f4e04[_0x7c3c('0x32')]&&_0x8f4e04[_0x7c3c('0x32')]!=='SI'){_0x33769b['sender']=_0x8f4e04[_0x7c3c('0x22')];}var _0x3f3bd7={'url':_0x40f42e+'login?username='+_0x8f4e04[_0x7c3c('0x2f')]+_0x7c3c('0x33')+_0x8f4e04[_0x7c3c('0x30')],'method':_0x7c3c('0x34')};rp(_0x3f3bd7)[_0x7c3c('0x17')](function(_0x5a338c){var _0x3ea8ad=_0x5a338c[_0x7c3c('0x35')](';');var _0x11754e={'user_key':_0x3ea8ad[0x0],'session_key':_0x3ea8ad[0x1]};_0x3f3bd7={'url':_0x40f42e+_0x7c3c('0x36'),'method':_0x7c3c('0x37'),'headers':{'user_key':_0x11754e[_0x7c3c('0x38')],'Session_key':_0x11754e[_0x7c3c('0x39')]},'json':!![],'body':_0x33769b};return rp(_0x3f3bd7);})[_0x7c3c('0x17')](function(_0xf47904){if(_0xf47904['total_sent']>=0x1){var _0x212e47={'messageId':_0xf47904[_0x7c3c('0x3a')]};if(_0x8f4e04[_0x7c3c('0x32')]!=='GP'||!_0x8f4e04[_0x7c3c('0x3b')]){_0x212e47[_0x7c3c('0x3c')]=!![];}return _0x399eef[_0x7c3c('0x18')](_0x212e47);}else{return logger[_0x7c3c('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c3c('0x2b'),_0x7c3c('0x2d'),util[_0x7c3c('0x3d')](_0xf47904,{'showHidden':![],'depth':null}));}})[_0x7c3c('0x29')](function(_0x1fce3f){return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),'afterCreate',_0x7c3c('0x2d'),util[_0x7c3c('0x3d')](_0x1fce3f,{'showHidden':![],'depth':null}));});}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x2d'),_0x7c3c('0x3e'));}break;case'connectel':if(_0x8f4e04['authToken']){var _0xc5a44f={'recipient':_0x2beafa[_0x7c3c('0x22')],'message':_0x2beafa[_0x7c3c('0x31')],'sender':_0x8f4e04['senderString']||_0x8f4e04['phone'],'authorization':_0x8f4e04[_0x7c3c('0x21')]};var _0x3b3940={'method':_0x7c3c('0x37'),'uri':_0x7c3c('0x3f'),'body':_0xc5a44f,'json':!![]};rp(_0x3b3940)['then'](function(_0x35b050){var _0x12d42d={'messageId':_0x35b050[_0x7c3c('0x40')]};if(!_0x8f4e04['deliveryReport']){_0x12d42d[_0x7c3c('0x3c')]=!![];}return _0x399eef[_0x7c3c('0x18')](_0x12d42d);})['catch'](function(_0x11ff38){logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),'afterCreate',_0x7c3c('0x41'),util[_0x7c3c('0x3d')](_0x11ff38,{'showHidden':![],'depth':null}));});}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x41'),_0x7c3c('0x42'));}break;case'clicksend':if(_0x8f4e04[_0x7c3c('0x2f')]&&_0x8f4e04[_0x7c3c('0x30')]){var _0xc5a44f={'messages':[{'source':_0x7c3c('0x43'),'to':_0x2beafa['phone'],'body':_0x2beafa[_0x7c3c('0x31')],'from':_0x8f4e04['senderString']||_0x8f4e04['phone']}]};var _0x299bab=util[_0x7c3c('0x44')](_0x7c3c('0x45'),_0x8f4e04[_0x7c3c('0x2f')],_0x8f4e04[_0x7c3c('0x30')]);var _0x3b3940={'method':_0x7c3c('0x37'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0xc5a44f,'headers':{'Authorization':util[_0x7c3c('0x44')](_0x7c3c('0x46'),new Buffer(_0x299bab)[_0x7c3c('0x47')](_0x7c3c('0x48')))},'json':!![]};rp(_0x3b3940)[_0x7c3c('0x17')](function(_0x1be0c2){if(_0x1be0c2['http_code']>=0xc8&&_0x1be0c2[_0x7c3c('0x49')]<=0xce){if(_0x1be0c2[_0x7c3c('0x4a')]&&_0x1be0c2[_0x7c3c('0x4a')][_0x7c3c('0x4b')]>0x0){var _0x19c1fa=_[_0x7c3c('0x4c')](_0x1be0c2[_0x7c3c('0x4a')][_0x7c3c('0x23')]);var _0x53db1c={'messageId':_0x19c1fa[_0x7c3c('0x4d')]};if(!_0x8f4e04[_0x7c3c('0x3b')]){_0x53db1c[_0x7c3c('0x3c')]=!![];}return _0x399eef[_0x7c3c('0x18')](_0x53db1c);}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x4e'),util[_0x7c3c('0x3d')](_0x1be0c2,{'showHidden':![],'depth':null}));}}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'clickSend',util[_0x7c3c('0x3d')](_0x1be0c2,{'showHidden':![],'depth':null}));}})[_0x7c3c('0x29')](function(_0xb2c145){logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'clickSend',util[_0x7c3c('0x3d')](_0xb2c145,{'showHidden':![],'depth':null}));});}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),'afterCreate',_0x7c3c('0x4e'),_0x7c3c('0x3e'));}break;case _0x7c3c('0x4f'):if(_0x8f4e04[_0x7c3c('0x50')]&&_0x8f4e04[_0x7c3c('0x21')]){var _0xc5a44f={'dst':_0x2beafa[_0x7c3c('0x22')],'text':_0x2beafa[_0x7c3c('0x31')],'src':_0x8f4e04[_0x7c3c('0x51')]||_0x8f4e04[_0x7c3c('0x22')],'url':_0x8f4e04['remote']+_0x7c3c('0x25')+_0x2beafa['id']+_0x7c3c('0x26')+_0x8f4e04[_0x7c3c('0x27')]};var _0x299bab=util[_0x7c3c('0x44')]('%s:%s',_0x8f4e04[_0x7c3c('0x50')],_0x8f4e04['authToken']);var _0x3b3940={'method':'POST','uri':util['format'](_0x7c3c('0x52'),_0x8f4e04[_0x7c3c('0x50')]),'body':_0xc5a44f,'headers':{'Authorization':util[_0x7c3c('0x44')](_0x7c3c('0x46'),new Buffer(_0x299bab)['toString'](_0x7c3c('0x48')))},'json':!![]};rp(_0x3b3940)['then'](function(_0x154385){var _0x5881a3={'messageId':_0x154385[_0x7c3c('0x53')][0x0]};return _0x399eef[_0x7c3c('0x18')](_0x5881a3);})[_0x7c3c('0x29')](function(_0x44609c){logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x4f'),util[_0x7c3c('0x3d')](_0x44609c,{'showHidden':![],'depth':null}));});}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'plivo',_0x7c3c('0x54'));}break;case _0x7c3c('0x55'):if(_0x8f4e04[_0x7c3c('0x2f')]&&_0x8f4e04[_0x7c3c('0x30')]){if(_0x8f4e04['baseUrl']){var _0x5c5722={'method':_0x7c3c('0x37'),'uri':_0x8f4e04[_0x7c3c('0x56')]+_0x7c3c('0x57'),'body':{'username':_0x8f4e04['username'],'password':_0x8f4e04['password']},'json':!![]};return rp(_0x5c5722)[_0x7c3c('0x17')](function(_0x1097e4){var _0x2e4e1f={'method':'POST','uri':_0x8f4e04[_0x7c3c('0x56')]+_0x7c3c('0x58'),'body':{'messages':[{'from':_0x8f4e04[_0x7c3c('0x22')],'destinations':[{'to':_0x2beafa['phone']}],'text':_0x2beafa[_0x7c3c('0x31')],'notifyUrl':_0x8f4e04[_0x7c3c('0x24')]+_0x7c3c('0x25')+_0x2beafa['id']+'/status?token='+_0x8f4e04['token'],'notifyContentType':_0x7c3c('0x59'),'callbackData':_0x8f4e04['phone']+';'+_0x2beafa[_0x7c3c('0x31')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x1097e4[_0x7c3c('0x27')]},'json':!![]};return rp(_0x2e4e1f)['then'](function(_0x133d82){if(_0x133d82[_0x7c3c('0x23')]){var _0x4fdc4a={'messageId':_0x133d82['messages'][0x0][_0x7c3c('0xc')]};if(!_0x8f4e04['deliveryReport']){_0x4fdc4a[_0x7c3c('0x3c')]=!![];}return _0x399eef[_0x7c3c('0x18')](_0x4fdc4a);}else{return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'infobip',util[_0x7c3c('0x3d')](_0x133d82,{'showHidden':![],'depth':null}));}});})['catch'](function(_0xaf9d6c){return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x55'),util[_0x7c3c('0x3d')](_0xaf9d6c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x55'),_0x7c3c('0x5a'));}}else{logger[_0x7c3c('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7c3c('0x2b'),_0x7c3c('0x55'),_0x7c3c('0x3e'));}break;case _0x7c3c('0x5b'):var _0x177dad=require(_0x7c3c('0x5c'));if(_0x8f4e04['apiKey']){var _0x4e0acc={};_0x4e0acc[_0x7c3c('0x5d')]=_0x8f4e04['username'];_0x4e0acc[_0x7c3c('0x22')]=_0x2beafa[_0x7c3c('0x22')];_0x4e0acc['sender']=_0x8f4e04[_0x7c3c('0x22')];_0x4e0acc[_0x7c3c('0x5e')]=_0x2beafa[_0x7c3c('0x31')];_0x4e0acc[_0x7c3c('0x5f')]=+new Date();var _0xa14cfb='';var _0x54bad8='';var _0x424c2e=Object[_0x7c3c('0x60')](_0x4e0acc);_0x424c2e[_0x7c3c('0x61')]();for(var _0x3a9a58=0x0;_0x3a9a58<_0x424c2e[_0x7c3c('0x62')];_0x3a9a58++){if(_0xa14cfb!=''){_0xa14cfb+='&';}_0xa14cfb+=_0x424c2e[_0x3a9a58]+'='+encodeURIComponent(_0x4e0acc[_0x424c2e[_0x3a9a58]]);_0x54bad8+=_0x4e0acc[_0x424c2e[_0x3a9a58]];}_0x54bad8+=_0x8f4e04[_0x7c3c('0x63')];_0x54bad8=_0x177dad[_0x7c3c('0x64')](_0x7c3c('0x65'))[_0x7c3c('0x18')](_0x54bad8)[_0x7c3c('0x66')](_0x7c3c('0x67'));if(_0xa14cfb!==''){_0xa14cfb+='&';}_0xa14cfb+='signature='+_0x54bad8;var _0x3f3bd7={'method':'GET','uri':_0x8f4e04['baseUrl']+_0x7c3c('0x68')+_0xa14cfb,'json':!![]};return rp(_0x3f3bd7)[_0x7c3c('0x17')](function(_0x9a1d4a){var _0x7d7feb=Object[_0x7c3c('0x60')](_0x9a1d4a);if(_0x9a1d4a[_0x7d7feb[0x0]][_0x7c3c('0x1a')]&&parseInt(_0x9a1d4a[_0x7d7feb[0x0]][_0x7c3c('0x1a')])===0x0){var _0x392d1b={'messageId':_0x9a1d4a[_0x7d7feb[0x0]]['id_sms']};if(!_0x8f4e04[_0x7c3c('0x3b')]){_0x392d1b[_0x7c3c('0x3c')]=!![];}return _0x399eef[_0x7c3c('0x18')](_0x392d1b);}else{return logger[_0x7c3c('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7c3c('0x5b'),util[_0x7c3c('0x3d')](_0x9a1d4a[_0x7c3c('0x1a')],{'showHidden':![],'depth':null}));}})[_0x7c3c('0x29')](function(_0x3f13db){return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x5b'),util[_0x7c3c('0x3d')](_0x3f13db,{'showHidden':![],'depth':null}));});}else{logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case _0x7c3c('0x69'):if(_0x8f4e04[_0x7c3c('0x63')]){var _0x2f1813={'method':_0x7c3c('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x8f4e04[_0x7c3c('0x63')]},'body':{'content':_0x2beafa[_0x7c3c('0x31')],'to':[_0x2beafa['phone']],'from':_0x8f4e04[_0x7c3c('0x22')],'binary':![],'clientMessageId':_0x7c3c('0x6a'),'charset':_0x7c3c('0x6b')},'json':!![]};rp(_0x2f1813)[_0x7c3c('0x17')](function(_0x468f4c){if(!_0x468f4c['error']){var _0x208338={'messageId':_0x468f4c[_0x7c3c('0x23')][0x0][_0x7c3c('0x6c')]};if(!_0x8f4e04['deliveryReport']){_0x208338[_0x7c3c('0x3c')]=!![];}return _0x399eef['update'](_0x208338);}else{return logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x69'),util['inspect'](_0x468f4c[_0x7c3c('0x1a')],{'showHidden':![],'depth':null}));}})[_0x7c3c('0x29')](function(_0x1544fb){return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x69'),util['inspect'](_0x1544fb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),_0x7c3c('0x69'),_0x7c3c('0x6d'));}break;case'intelepeer':if(_0x8f4e04['apiKey']){var _0x509eaf={};var _0x3f3bd7={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x7c3c('0x6e')+_0x8f4e04['apiKey'],'Content-Type':_0x7c3c('0x59')},'body':{'from':_0x8f4e04[_0x7c3c('0x22')],'to':_0x2beafa[_0x7c3c('0x22')],'text':_0x2beafa[_0x7c3c('0x31')]},'json':!![]};return rp(_0x3f3bd7)[_0x7c3c('0x17')](function(_0xb21d32){if(_0xb21d32['code']==0xca){_0x509eaf[_0x7c3c('0x6f')]=_0xb21d32;var _0xd1394b={'method':_0x7c3c('0x37'),'uri':_0x7c3c('0x70'),'headers':{'Authorization':_0x7c3c('0x6e')+_0x8f4e04[_0x7c3c('0x63')],'Content-Type':_0x7c3c('0x59')},'body':{'refid':_0x509eaf['message'][_0x7c3c('0x71')]},'json':!![]};return rp(_0xd1394b)[_0x7c3c('0x17')](function(_0x17d4e6){_0x509eaf[_0x7c3c('0x72')]=_0x17d4e6;var _0x323bc4={'messageId':_0x509eaf['message'][_0x7c3c('0x71')],'read':!![]};return _0x399eef[_0x7c3c('0x18')](_0x323bc4);});}else{return logger['error'](_0x7c3c('0x2a'),_0x7c3c('0x2b'),'intelepeer',util['inspect'](_0xb21d32,{'showHidden':![],'depth':null}));}})[_0x7c3c('0x29')](function(_0x4795b5){return logger[_0x7c3c('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7c3c('0x73'),util['inspect'](_0x4795b5,{'showHidden':![],'depth':null}));});}else{return logger[_0x7c3c('0x1a')](_0x7c3c('0x2a'),'afterCreate',_0x7c3c('0x73'),_0x7c3c('0x74'));}break;}}})[_0x7c3c('0x75')](function(){_0x55045e();});}else{_0x55045e();}}},'charset':_0x7c3c('0x76'),'collate':_0x7c3c('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2a215d0..1d61f06 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(_0x31f06e,_0x52385d){var _0x2f6fd7=function(_0x2ede9f){while(--_0x2ede9f){_0x31f06e['push'](_0x31f06e['shift']());}};_0x2f6fd7(++_0x52385d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x39bc68,_0x269d2d){_0x39bc68=_0x39bc68-0x0;var _0x395d16=_0x5f2f[_0x39bc68];return _0x395d16;};'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 _0xda2d=['body','options','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','SmsMessage'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xda2d,0x102));var _0xdda2=function(_0x34ff42,_0x4d41a7){_0x34ff42=_0x34ff42-0x0;var _0x5e39cb=_0xda2d[_0x34ff42];return _0x5e39cb;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});config[_0xdda2('0xa')]=_[_0xdda2('0xb')](config[_0xdda2('0xa')],{'host':_0xdda2('0xc'),'port':0x18eb});var socket=require(_0xdda2('0xd'))(new Redis(config['redis']));require(_0xdda2('0xe'))[_0xdda2('0xf')](socket);function respondWithRpcPromise(_0x4df6b8,_0x1c11b2,_0x2f3454){return new BPromise(function(_0x42d990,_0x346119){return client[_0xdda2('0x10')](_0x4df6b8,_0x2f3454)[_0xdda2('0x11')](function(_0x26fe81){logger[_0xdda2('0x12')]('SmsMessage,\x20%s,\x20%s',_0x1c11b2,'request\x20sent');logger['debug'](_0xdda2('0x13'),_0x1c11b2,_0xdda2('0x14'),JSON[_0xdda2('0x15')](_0x26fe81));if(_0x26fe81[_0xdda2('0x16')]){if(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x17')]===0x1f4){logger[_0xdda2('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x346119(_0x26fe81[_0xdda2('0x16')][_0xdda2('0x18')]);}logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x26fe81[_0xdda2('0x16')]['message']);return _0x42d990(_0x26fe81['error'][_0xdda2('0x18')]);}else{logger['info'](_0xdda2('0x19'),_0x1c11b2,_0xdda2('0x14'));_0x42d990(_0x26fe81[_0xdda2('0x1a')][_0xdda2('0x18')]);}})[_0xdda2('0x1b')](function(_0x17015f){logger[_0xdda2('0x16')](_0xdda2('0x19'),_0x1c11b2,_0x17015f);_0x346119(_0x17015f);});});}exports[_0xdda2('0x1c')]=function(_0x337b0b){var _0x312ef1=this;return new Promise(function(_0x6fdede,_0x4eed30){return db[_0xdda2('0x1d')]['create'](_0x337b0b[_0xdda2('0x1e')],{'raw':_0x337b0b[_0xdda2('0x1f')]?_0x337b0b[_0xdda2('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xdda2('0x11')](function(_0x5a9bb8){logger[_0xdda2('0x12')](_0xdda2('0x1c'),_0x337b0b);logger['debug'](_0xdda2('0x1c'),_0x337b0b,JSON[_0xdda2('0x15')](_0x5a9bb8));_0x6fdede(_0x5a9bb8);})[_0xdda2('0x1b')](function(_0x13b0f3){logger[_0xdda2('0x16')]('CreateSmsMessage',_0x13b0f3[_0xdda2('0x18')],_0x337b0b);_0x4eed30(_0x312ef1[_0xdda2('0x16')](0x1f4,_0x13b0f3[_0xdda2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 47ea7a4..0a849ed 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 _0xe59a=['remove','update','emit','removeListener','register','smsMessage:','save'];(function(_0x175ed1,_0x3d9a30){var _0x1b4c37=function(_0x59522f){while(--_0x59522f){_0x175ed1['push'](_0x175ed1['shift']());}};_0x1b4c37(++_0x3d9a30);}(_0xe59a,0xca));var _0xae59=function(_0x571dfd,_0x5c5d0d){_0x571dfd=_0x571dfd-0x0;var _0x1731d9=_0xe59a[_0x571dfd];return _0x1731d9;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xae59('0x0'),_0xae59('0x1'),_0xae59('0x2')];function createListener(_0x2575bc,_0x2bb3e7){return function(_0x3d04b0){_0x2bb3e7[_0xae59('0x3')](_0x2575bc,_0x3d04b0);};}function removeListener(_0x379b58,_0x2b93a5){return function(){SmsMessageEvents[_0xae59('0x4')](_0x379b58,_0x2b93a5);};}exports[_0xae59('0x5')]=function(_0x46b8f6){for(var _0x1fcf1d=0x0,_0x59a09b=events['length'];_0x1fcf1d<_0x59a09b;_0x1fcf1d++){var _0x495e8e=events[_0x1fcf1d];var _0x32329b=createListener(_0xae59('0x6')+_0x495e8e,_0x46b8f6);SmsMessageEvents['on'](_0x495e8e,_0x32329b);}}; \ No newline at end of file +var _0x3205=['update','emit','length','smsMessage:','./smsMessage.events','save'];(function(_0x5c68b1,_0x4ac4b1){var _0x6bba3=function(_0x1bf0a3){while(--_0x1bf0a3){_0x5c68b1['push'](_0x5c68b1['shift']());}};_0x6bba3(++_0x4ac4b1);}(_0x3205,0x1f0));var _0x5320=function(_0x2629a6,_0x3a908d){_0x2629a6=_0x2629a6-0x0;var _0x49f5bd=_0x3205[_0x2629a6];return _0x49f5bd;};'use strict';var SmsMessageEvents=require(_0x5320('0x0'));var events=[_0x5320('0x1'),'remove',_0x5320('0x2')];function createListener(_0x5a19fe,_0x5ae1c6){return function(_0x51ba6a){_0x5ae1c6[_0x5320('0x3')](_0x5a19fe,_0x51ba6a);};}function removeListener(_0x36cedc,_0x40a580){return function(){SmsMessageEvents['removeListener'](_0x36cedc,_0x40a580);};}exports['register']=function(_0x43e2b0){for(var _0xe603c6=0x0,_0xbd07c8=events[_0x5320('0x4')];_0xe603c6<_0xbd07c8;_0xe603c6++){var _0x5b128d=events[_0xe603c6];var _0x3b7a7c=createListener(_0x5320('0x5')+_0x5b128d,_0x43e2b0);SmsMessageEvents['on'](_0x5b128d,_0x3b7a7c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d0e2abe..28b0613 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 _0x82f8=['./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','/:id','destroy','removeTeams','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0x82f8,0x157));var _0x882f=function(_0x38d0af,_0x5d2f92){_0x38d0af=_0x38d0af-0x0;var _0x29fa3f=_0x82f8[_0x38d0af];return _0x29fa3f;};'use strict';var multer=require('multer');var util=require(_0x882f('0x0'));var path=require(_0x882f('0x1'));var timeout=require('connect-timeout');var express=require(_0x882f('0x2'));var router=express[_0x882f('0x3')]();var auth=require(_0x882f('0x4'));var interaction=require(_0x882f('0x5'));var config=require(_0x882f('0x6'));var controller=require(_0x882f('0x7'));router[_0x882f('0x8')]('/',auth[_0x882f('0x9')](),controller['index']);router['get'](_0x882f('0xa'),auth[_0x882f('0x9')](),controller[_0x882f('0xb')]);router[_0x882f('0x8')]('/:id',auth[_0x882f('0x9')](),controller['show']);router[_0x882f('0x8')]('/:id/members',auth[_0x882f('0x9')](),controller['getMembers']);router['get'](_0x882f('0xc'),auth[_0x882f('0x9')](),controller[_0x882f('0xd')]);router[_0x882f('0x8')](_0x882f('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0x882f('0xf')]('/',auth[_0x882f('0x9')](),controller[_0x882f('0x10')]);router[_0x882f('0xf')](_0x882f('0xc'),auth[_0x882f('0x9')](),controller[_0x882f('0x11')]);router['post'](_0x882f('0xe'),auth[_0x882f('0x9')](),controller[_0x882f('0x12')]);router[_0x882f('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x882f('0x14')](_0x882f('0x15'),auth[_0x882f('0x9')](),controller[_0x882f('0x16')]);router[_0x882f('0x14')](_0x882f('0xc'),auth[_0x882f('0x9')](),controller[_0x882f('0x17')]);router['delete'](_0x882f('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x882f('0x18')]=router; \ No newline at end of file +var _0x0c42=['/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/:id','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x2b049b,_0x250f3a){var _0x29bbeb=function(_0x2e408d){while(--_0x2e408d){_0x2b049b['push'](_0x2b049b['shift']());}};_0x29bbeb(++_0x250f3a);}(_0x0c42,0x191));var _0x20c4=function(_0x2d8d67,_0x1d084d){_0x2d8d67=_0x2d8d67-0x0;var _0x42a068=_0x0c42[_0x2d8d67];return _0x42a068;};'use strict';var multer=require(_0x20c4('0x0'));var util=require(_0x20c4('0x1'));var path=require(_0x20c4('0x2'));var timeout=require(_0x20c4('0x3'));var express=require(_0x20c4('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x20c4('0x5'));var config=require(_0x20c4('0x6'));var controller=require(_0x20c4('0x7'));router[_0x20c4('0x8')]('/',auth[_0x20c4('0x9')](),controller['index']);router[_0x20c4('0x8')]('/describe',auth[_0x20c4('0x9')](),controller['describe']);router[_0x20c4('0x8')](_0x20c4('0xa'),auth[_0x20c4('0x9')](),controller['show']);router[_0x20c4('0x8')](_0x20c4('0xb'),auth[_0x20c4('0x9')](),controller[_0x20c4('0xc')]);router[_0x20c4('0x8')](_0x20c4('0xd'),auth[_0x20c4('0x9')](),controller[_0x20c4('0xe')]);router[_0x20c4('0x8')](_0x20c4('0xf'),auth[_0x20c4('0x9')](),controller[_0x20c4('0x10')]);router[_0x20c4('0x11')]('/',auth['isAuthenticated'](),controller[_0x20c4('0x12')]);router['post'](_0x20c4('0xd'),auth[_0x20c4('0x9')](),controller['addTeams']);router[_0x20c4('0x11')]('/:id/users',auth[_0x20c4('0x9')](),controller[_0x20c4('0x13')]);router[_0x20c4('0x14')]('/:id',auth[_0x20c4('0x9')](),controller[_0x20c4('0x15')]);router[_0x20c4('0x16')](_0x20c4('0xa'),auth[_0x20c4('0x9')](),controller[_0x20c4('0x17')]);router[_0x20c4('0x16')](_0x20c4('0xd'),auth[_0x20c4('0x9')](),controller[_0x20c4('0x18')]);router[_0x20c4('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x20c4('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 2bd2b01..f709bd7 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 _0x4a29=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x4a29,0x6b));var _0x94a2=function(_0x3f0512,_0xe123e){_0x3f0512=_0x3f0512-0x0;var _0x4c9de2=_0x4a29[_0x3f0512];return _0x4c9de2;};'use strict';var Sequelize=require(_0x94a2('0x0'));module[_0x94a2('0x1')]={'name':{'type':Sequelize[_0x94a2('0x2')],'unique':_0x94a2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x94a2('0x2')]},'timeout':{'type':Sequelize[_0x94a2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x94a2('0x5'),_0x94a2('0x6'),_0x94a2('0x7'))}}; \ No newline at end of file +var _0x93d2=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2fcc5b,_0x47e1c0){var _0x198739=function(_0x282e86){while(--_0x282e86){_0x2fcc5b['push'](_0x2fcc5b['shift']());}};_0x198739(++_0x47e1c0);}(_0x93d2,0x110));var _0x293d=function(_0x2c5e72,_0x33556e){_0x2c5e72=_0x2c5e72-0x0;var _0x5e9f9a=_0x93d2[_0x2c5e72];return _0x5e9f9a;};'use strict';var Sequelize=require(_0x293d('0x0'));module[_0x293d('0x1')]={'name':{'type':Sequelize[_0x293d('0x2')],'unique':_0x293d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x293d('0x2')]},'timeout':{'type':Sequelize[_0x293d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x293d('0x5')](_0x293d('0x6'),_0x293d('0x7'),_0x293d('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 74d15e5..8d73f42 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 _0x9b9b=['query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','user','role','find','userProfileId','update','describe','getMembers','UserSmsQueue','sort','SmsQueueId','User','findAndCountAll','UserId','smsPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','getTeams','addTeams','ids','online','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','Team','Agents','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','userSmsQueue:save','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','offset','limit','set','json','reject','save','then','get','SmsQueues','destroy','end','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','key','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b9b,0xe3));var _0xb9b9=function(_0x2b38a6,_0x4fbc47){_0x2b38a6=_0x2b38a6-0x0;var _0x118544=_0x9b9b[_0x2b38a6];return _0x118544;};'use strict';var pdf=require(_0xb9b9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb9b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var moment=require('moment');var BPromise=require(_0xb9b9('0x4'));var Mustache=require(_0xb9b9('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb9b9('0x6'));var csv=require('to-csv');var ejs=require(_0xb9b9('0x7'));var fs=require('fs');var _=require(_0xb9b9('0x8'));var squel=require(_0xb9b9('0x9'));var crypto=require(_0xb9b9('0xa'));var jsforce=require(_0xb9b9('0xb'));var deskjs=require(_0xb9b9('0xc'));var toCsv=require(_0xb9b9('0xd'));var querystring=require(_0xb9b9('0xe'));var Papa=require(_0xb9b9('0xf'));var Redis=require('ioredis');var authService=require(_0xb9b9('0x10'));var qs=require(_0xb9b9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9b9('0x12'));var logger=require(_0xb9b9('0x13'))(_0xb9b9('0x14'));var utils=require(_0xb9b9('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb9b9('0x16')]=_[_0xb9b9('0x17')](config[_0xb9b9('0x16')],{'host':_0xb9b9('0x18'),'port':0x18eb});var socket=require(_0xb9b9('0x19'))(new Redis(config[_0xb9b9('0x16')]));require(_0xb9b9('0x1a'))['register'](socket);function respondWithStatusCode(_0x38d3ef,_0x18f759){_0x18f759=_0x18f759||0xcc;return function(_0x52e791){if(_0x52e791){return _0x38d3ef[_0xb9b9('0x1b')](_0x18f759);}return _0x38d3ef['status'](_0x18f759)['end']();};}function respondWithResult(_0x186255,_0x155835){_0x155835=_0x155835||0xc8;return function(_0xa01b64){if(_0xa01b64){return _0x186255[_0xb9b9('0x1c')](_0x155835)['json'](_0xa01b64);}};}function respondWithFilteredResult(_0x1bb3eb,_0xd1257e){return function(_0x33d10c){if(_0x33d10c){var _0xc47538=_0x33d10c['count'],_0x76bcd=_0xd1257e[_0xb9b9('0x1d')],_0x32622e=_0xd1257e[_0xb9b9('0x1d')]+_0xd1257e[_0xb9b9('0x1e')],_0x157f06;if(_0x32622e>=_0xc47538){_0x32622e=_0xc47538;_0x157f06=0xc8;}else{_0x157f06=0xce;}_0x1bb3eb[_0xb9b9('0x1c')](_0x157f06);return _0x1bb3eb[_0xb9b9('0x1f')]('Content-Range',_0x76bcd+'-'+_0x32622e+'/'+_0xc47538)[_0xb9b9('0x20')](_0x33d10c);}return null;};}function patchUpdates(_0x32f7c9){return function(_0x465b5c){try{jsonpatch['apply'](_0x465b5c,_0x32f7c9,!![]);}catch(_0x5880b8){return BPromise[_0xb9b9('0x21')](_0x5880b8);}return _0x465b5c[_0xb9b9('0x22')]();};}function saveUpdates(_0x238c5a,_0x49bd56){return function(_0x53755a){if(_0x53755a){return _0x53755a['update'](_0x238c5a)[_0xb9b9('0x23')](function(_0x498955){return _0x498955;});}return null;};}function removeEntity(_0x483b3b,_0x282576){return function(_0x10fc83){if(_0x10fc83){return _0x10fc83['destroy']()[_0xb9b9('0x23')](function(){var _0x56dd76=_0x10fc83[_0xb9b9('0x24')]({'plain':!![]});var _0x25e710=_0xb9b9('0x25');return db['UserProfileResource'][_0xb9b9('0x26')]({'where':{'type':_0x25e710,'resourceId':_0x56dd76['id']}})[_0xb9b9('0x23')](function(){return _0x10fc83;});})[_0xb9b9('0x23')](function(){_0x483b3b[_0xb9b9('0x1c')](0xcc)[_0xb9b9('0x27')]();});}};}function handleEntityNotFound(_0x38323d,_0x34f8a0){return function(_0x195654){if(!_0x195654){_0x38323d['sendStatus'](0x194);}return _0x195654;};}function handleError(_0x52a700,_0x28c09f){_0x28c09f=_0x28c09f||0x1f4;return function(_0x2e2c39){logger[_0xb9b9('0x28')](_0x2e2c39[_0xb9b9('0x29')]);if(_0x2e2c39[_0xb9b9('0x2a')]){delete _0x2e2c39[_0xb9b9('0x2a')];}_0x52a700[_0xb9b9('0x1c')](_0x28c09f)[_0xb9b9('0x2b')](_0x2e2c39);};}exports[_0xb9b9('0x2c')]=function(_0x4eece8,_0x2a4f2){var _0x105993={},_0x5b9dc9={},_0x1e516d={'count':0x0,'rows':[]};var _0x24772b=_['map'](db[_0xb9b9('0x2d')][_0xb9b9('0x2e')],function(_0x128579){return{'name':_0x128579[_0xb9b9('0x2f')],'type':_0x128579[_0xb9b9('0x30')][_0xb9b9('0x31')]};});_0x5b9dc9[_0xb9b9('0x32')]=_['map'](_0x24772b,_0xb9b9('0x2a'));_0x5b9dc9[_0xb9b9('0x33')]=_[_0xb9b9('0x34')](_0x4eece8['query']);_0x5b9dc9['filters']=_['intersection'](_0x5b9dc9[_0xb9b9('0x32')],_0x5b9dc9['query']);_0x105993[_0xb9b9('0x35')]=_[_0xb9b9('0x36')](_0x5b9dc9[_0xb9b9('0x32')],qs[_0xb9b9('0x37')](_0x4eece8[_0xb9b9('0x33')]['fields']));_0x105993[_0xb9b9('0x35')]=_0x105993[_0xb9b9('0x35')][_0xb9b9('0x38')]?_0x105993['attributes']:_0x5b9dc9[_0xb9b9('0x32')];if(!_0x4eece8[_0xb9b9('0x33')][_0xb9b9('0x39')](_0xb9b9('0x3a'))){_0x105993[_0xb9b9('0x1e')]=qs[_0xb9b9('0x1e')](_0x4eece8[_0xb9b9('0x33')][_0xb9b9('0x1e')]);_0x105993[_0xb9b9('0x1d')]=qs[_0xb9b9('0x1d')](_0x4eece8[_0xb9b9('0x33')][_0xb9b9('0x1d')]);}_0x105993[_0xb9b9('0x3b')]=qs['sort'](_0x4eece8[_0xb9b9('0x33')]['sort']);_0x105993['where']=qs[_0xb9b9('0x3c')](_[_0xb9b9('0x3d')](_0x4eece8['query'],_0x5b9dc9[_0xb9b9('0x3c')]),_0x24772b);if(_0x4eece8[_0xb9b9('0x33')][_0xb9b9('0x3e')]){_0x105993[_0xb9b9('0x3f')]=_[_0xb9b9('0x40')](_0x105993[_0xb9b9('0x3f')],{'$or':_[_0xb9b9('0x41')](_0x24772b,function(_0x10d144){if(_0x10d144[_0xb9b9('0x30')]!==_0xb9b9('0x42')){var _0x594f16={};_0x594f16[_0x10d144[_0xb9b9('0x2a')]]={'$like':'%'+_0x4eece8[_0xb9b9('0x33')][_0xb9b9('0x3e')]+'%'};return _0x594f16;}})});}_0x105993=_['merge']({},_0x105993,_0x4eece8[_0xb9b9('0x43')]);var _0x4a0e29={'where':_0x105993['where']};return db[_0xb9b9('0x2d')][_0xb9b9('0x44')](_0x4a0e29)[_0xb9b9('0x23')](function(_0x486084){_0x1e516d[_0xb9b9('0x44')]=_0x486084;if(_0x4eece8[_0xb9b9('0x33')][_0xb9b9('0x45')]){_0x105993[_0xb9b9('0x46')]=[{'all':!![]}];}return db[_0xb9b9('0x2d')][_0xb9b9('0x47')](_0x105993);})[_0xb9b9('0x23')](function(_0x3bd9c3){_0x1e516d[_0xb9b9('0x48')]=_0x3bd9c3;return _0x1e516d;})[_0xb9b9('0x23')](respondWithFilteredResult(_0x2a4f2,_0x105993))['catch'](handleError(_0x2a4f2,null));};exports[_0xb9b9('0x49')]=function(_0x1f6dfa,_0x215fb3){var _0x6b1ecb={'raw':!![],'where':{'id':_0x1f6dfa[_0xb9b9('0x4a')]['id']}},_0x16bbd6={};_0x16bbd6['model']=_[_0xb9b9('0x34')](db[_0xb9b9('0x2d')][_0xb9b9('0x2e')]);_0x16bbd6['query']=_[_0xb9b9('0x34')](_0x1f6dfa[_0xb9b9('0x33')]);_0x16bbd6[_0xb9b9('0x3c')]=_[_0xb9b9('0x36')](_0x16bbd6[_0xb9b9('0x32')],_0x16bbd6['query']);_0x6b1ecb['attributes']=_[_0xb9b9('0x36')](_0x16bbd6[_0xb9b9('0x32')],qs[_0xb9b9('0x37')](_0x1f6dfa[_0xb9b9('0x33')][_0xb9b9('0x37')]));_0x6b1ecb[_0xb9b9('0x35')]=_0x6b1ecb[_0xb9b9('0x35')]['length']?_0x6b1ecb[_0xb9b9('0x35')]:_0x16bbd6[_0xb9b9('0x32')];if(_0x1f6dfa[_0xb9b9('0x33')][_0xb9b9('0x45')]){_0x6b1ecb[_0xb9b9('0x46')]=[{'all':!![]}];}_0x6b1ecb=_[_0xb9b9('0x40')]({},_0x6b1ecb,_0x1f6dfa[_0xb9b9('0x43')]);return db[_0xb9b9('0x2d')]['find'](_0x6b1ecb)[_0xb9b9('0x23')](handleEntityNotFound(_0x215fb3,null))[_0xb9b9('0x23')](respondWithResult(_0x215fb3,null))[_0xb9b9('0x4b')](handleError(_0x215fb3,null));};exports[_0xb9b9('0x4c')]=function(_0x130435,_0x489c19){return db[_0xb9b9('0x2d')]['create'](_0x130435[_0xb9b9('0x4d')],{})[_0xb9b9('0x23')](function(_0x51870e){var _0x3e52de=_0x130435[_0xb9b9('0x4e')][_0xb9b9('0x24')]({'plain':!![]});if(!_0x3e52de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e52de[_0xb9b9('0x4f')]===_0xb9b9('0x4e')){var _0x17f3cc=_0x51870e[_0xb9b9('0x24')]({'plain':!![]});var _0x76f63e=_0xb9b9('0x25');return db['UserProfileSection'][_0xb9b9('0x50')]({'where':{'name':_0x76f63e,'userProfileId':_0x3e52de[_0xb9b9('0x51')]},'raw':!![]})[_0xb9b9('0x23')](function(_0x5e9d34){if(_0x5e9d34&&_0x5e9d34['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x17f3cc['name'],'resourceId':_0x17f3cc['id'],'type':_0x5e9d34[_0xb9b9('0x2a')],'sectionId':_0x5e9d34['id']},{})[_0xb9b9('0x23')](function(){return _0x51870e;});}else{return _0x51870e;}})[_0xb9b9('0x4b')](function(_0x2e3a4a){logger[_0xb9b9('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e3a4a);throw _0x2e3a4a;});}return _0x51870e;})[_0xb9b9('0x23')](respondWithResult(_0x489c19,0xc9))[_0xb9b9('0x4b')](handleError(_0x489c19,null));};exports[_0xb9b9('0x52')]=function(_0x1c7935,_0x1470fc){if(_0x1c7935[_0xb9b9('0x4d')]['id']){delete _0x1c7935[_0xb9b9('0x4d')]['id'];}return db[_0xb9b9('0x2d')]['find']({'where':{'id':_0x1c7935['params']['id']}})[_0xb9b9('0x23')](handleEntityNotFound(_0x1470fc,null))[_0xb9b9('0x23')](saveUpdates(_0x1c7935['body'],null))[_0xb9b9('0x23')](respondWithResult(_0x1470fc,null))['catch'](handleError(_0x1470fc,null));};exports[_0xb9b9('0x26')]=function(_0x103527,_0x57425e){return db['SmsQueue'][_0xb9b9('0x50')]({'where':{'id':_0x103527[_0xb9b9('0x4a')]['id']}})[_0xb9b9('0x23')](handleEntityNotFound(_0x57425e,null))[_0xb9b9('0x23')](removeEntity(_0x57425e,null))[_0xb9b9('0x4b')](handleError(_0x57425e,null));};exports['describe']=function(_0x7f4937,_0xe311eb){return db[_0xb9b9('0x2d')][_0xb9b9('0x53')]()[_0xb9b9('0x23')](respondWithResult(_0xe311eb,null))[_0xb9b9('0x4b')](handleError(_0xe311eb,null));};exports[_0xb9b9('0x54')]=function(_0x57722a,_0x14378b,_0x12f546){var _0x16a2fb={'raw':!![],'where':{}},_0x47ccd6={},_0x542d29;return db[_0xb9b9('0x2d')]['findOne']({'where':{'id':_0x57722a['params']['id']}})['then'](handleEntityNotFound(_0x14378b,null))[_0xb9b9('0x23')](function(_0x51e221){if(_0x51e221){_0x542d29=_0x51e221['get']({'plain':!![]});_0x47ccd6[_0xb9b9('0x32')]=_[_0xb9b9('0x34')](db[_0xb9b9('0x55')][_0xb9b9('0x2e')]);_0x47ccd6[_0xb9b9('0x33')]=_[_0xb9b9('0x34')](_0x57722a[_0xb9b9('0x33')]);_0x47ccd6['filters']=_[_0xb9b9('0x36')](_0x47ccd6[_0xb9b9('0x32')],_0x47ccd6['query']);_0x16a2fb[_0xb9b9('0x35')]=_[_0xb9b9('0x36')](_0x47ccd6[_0xb9b9('0x32')],qs['fields'](_0x57722a[_0xb9b9('0x33')]['fields']));_0x16a2fb['attributes']=_0x16a2fb[_0xb9b9('0x35')][_0xb9b9('0x38')]?_0x16a2fb[_0xb9b9('0x35')]:_0x47ccd6[_0xb9b9('0x32')];if(!_0x57722a[_0xb9b9('0x33')][_0xb9b9('0x39')]('nolimit')){_0x16a2fb[_0xb9b9('0x1e')]=qs[_0xb9b9('0x1e')](_0x57722a[_0xb9b9('0x33')]['limit']);_0x16a2fb[_0xb9b9('0x1d')]=qs[_0xb9b9('0x1d')](_0x57722a['query']['offset']);}_0x16a2fb['order']=qs[_0xb9b9('0x56')](_0x57722a[_0xb9b9('0x33')][_0xb9b9('0x56')]);_0x16a2fb[_0xb9b9('0x3f')]=qs[_0xb9b9('0x3c')](_[_0xb9b9('0x3d')](_0x57722a[_0xb9b9('0x33')],_0x47ccd6[_0xb9b9('0x3c')]));_0x16a2fb[_0xb9b9('0x3f')][_0xb9b9('0x57')]=_0x51e221['id'];if(_0x57722a[_0xb9b9('0x33')][_0xb9b9('0x3e')]){_0x16a2fb[_0xb9b9('0x3f')]=_[_0xb9b9('0x40')](_0x16a2fb[_0xb9b9('0x3f')],{'$or':_[_0xb9b9('0x41')](_0x16a2fb[_0xb9b9('0x35')],function(_0xba386f){var _0x4ea862={};_0x4ea862[_0xba386f]={'$like':'%'+_0x57722a['query']['filter']+'%'};return _0x4ea862;})});}_0x16a2fb=_[_0xb9b9('0x40')]({},_0x16a2fb,_0x57722a[_0xb9b9('0x43')]);return db[_0xb9b9('0x55')][_0xb9b9('0x47')](_0x16a2fb);}})[_0xb9b9('0x23')](function(_0xb57698){if(_0xb57698){return db[_0xb9b9('0x58')][_0xb9b9('0x59')]({'where':{'id':_[_0xb9b9('0x41')](_0xb57698,_0xb9b9('0x5a')),'role':'agent'},'attributes':['id','name',_0xb9b9('0x5b'),_0xb9b9('0x5c'),_0xb9b9('0x5d')]});}})[_0xb9b9('0x23')](function(_0x30b34d){if(_0x30b34d){return{'count':_0x30b34d[_0xb9b9('0x44')],'rows':_[_0xb9b9('0x41')](_0x30b34d[_0xb9b9('0x48')],function(_0x3378b1){return{'membername':_0x3378b1[_0xb9b9('0x2a')],'UserId':_0x3378b1['id'],'queue_name':_0x542d29['name'],'SmsQueueId':_0x542d29['id'],'interface':util[_0xb9b9('0x5e')](_0xb9b9('0x5f'),_0xb9b9('0x60'),_0x3378b1[_0xb9b9('0x2a')]),'penalty':0x0,'paused':_0x3378b1[_0xb9b9('0x5b')],'createdAt':_0x3378b1[_0xb9b9('0x5d')],'updatedAt':_0x3378b1[_0xb9b9('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x14378b,_0x16a2fb))[_0xb9b9('0x4b')](handleError(_0x14378b,null));};exports['getTeams']=function(_0x44333e,_0x27c674,_0x377d36){var _0x158a7d={};var _0xc862be={};var _0x2d1ed2;var _0x25930f;return db[_0xb9b9('0x2d')][_0xb9b9('0x61')]({'where':{'id':_0x44333e[_0xb9b9('0x4a')]['id']}})[_0xb9b9('0x23')](handleEntityNotFound(_0x27c674,null))[_0xb9b9('0x23')](function(_0x5b3515){if(_0x5b3515){_0x2d1ed2=_0x5b3515;_0xc862be[_0xb9b9('0x32')]=_[_0xb9b9('0x34')](db['Team']['rawAttributes']);_0xc862be[_0xb9b9('0x33')]=_[_0xb9b9('0x34')](_0x44333e['query']);_0xc862be['filters']=_[_0xb9b9('0x36')](_0xc862be['model'],_0xc862be[_0xb9b9('0x33')]);_0x158a7d[_0xb9b9('0x35')]=_[_0xb9b9('0x36')](_0xc862be['model'],qs[_0xb9b9('0x37')](_0x44333e[_0xb9b9('0x33')][_0xb9b9('0x37')]));_0x158a7d['attributes']=_0x158a7d[_0xb9b9('0x35')][_0xb9b9('0x38')]?_0x158a7d[_0xb9b9('0x35')]:_0xc862be[_0xb9b9('0x32')];_0x158a7d['order']=qs['sort'](_0x44333e['query'][_0xb9b9('0x56')]);_0x158a7d['where']=qs[_0xb9b9('0x3c')](_[_0xb9b9('0x3d')](_0x44333e[_0xb9b9('0x33')],_0xc862be['filters']));if(_0x44333e[_0xb9b9('0x33')]['filter']){_0x158a7d[_0xb9b9('0x3f')]=_[_0xb9b9('0x40')](_0x158a7d[_0xb9b9('0x3f')],{'$or':_[_0xb9b9('0x41')](_0x158a7d['attributes'],function(_0x15b9e6){var _0x518e6d={};_0x518e6d[_0x15b9e6]={'$like':'%'+_0x44333e[_0xb9b9('0x33')][_0xb9b9('0x3e')]+'%'};return _0x518e6d;})});}_0x158a7d=_[_0xb9b9('0x40')]({},_0x158a7d,_0x44333e[_0xb9b9('0x43')]);return _0x2d1ed2[_0xb9b9('0x62')](_0x158a7d);}})['then'](function(_0x502c3d){if(_0x502c3d){_0x25930f=_0x502c3d[_0xb9b9('0x38')];if(!_0x44333e[_0xb9b9('0x33')][_0xb9b9('0x39')](_0xb9b9('0x3a'))){_0x158a7d['limit']=qs[_0xb9b9('0x1e')](_0x44333e['query']['limit']);_0x158a7d[_0xb9b9('0x1d')]=qs[_0xb9b9('0x1d')](_0x44333e[_0xb9b9('0x33')][_0xb9b9('0x1d')]);}return _0x2d1ed2['getTeams'](_0x158a7d);}})[_0xb9b9('0x23')](function(_0x346abe){if(_0x346abe){return _0x346abe?{'count':_0x25930f,'rows':_0x346abe}:null;}})[_0xb9b9('0x23')](respondWithResult(_0x27c674,null))[_0xb9b9('0x4b')](handleError(_0x27c674,null));};exports[_0xb9b9('0x63')]=function(_0x12c2d6,_0x1278f7,_0x5317e7){var _0x11d486=_0x12c2d6[_0xb9b9('0x4d')][_0xb9b9('0x64')];return db['Team'][_0xb9b9('0x47')]({'where':{'id':_0x11d486},'attributes':['id'],'include':[{'model':db[_0xb9b9('0x58')],'as':'Agents','attributes':['id',_0xb9b9('0x2a'),_0xb9b9('0x65'),'voicePause',_0xb9b9('0x66')],'raw':!![]}]})['then'](function(_0x51db50){if(_0x51db50){var _0x4a0121=_[_0xb9b9('0x67')](_0x51db50,function(_0x97942){var _0x385def=_0x97942[_0xb9b9('0x24')]({'plain':!![]});return _0x385def['Agents'];});return db['SmsQueue'][_0xb9b9('0x50')]({'where':{'id':_0x12c2d6[_0xb9b9('0x4a')]['id']}})[_0xb9b9('0x23')](function(_0x3fef45){return db[_0xb9b9('0x68')]['transaction'](function(_0x4bde4d){return _0x3fef45[_0xb9b9('0x63')](_0x11d486,{'transaction':_0x4bde4d})[_0xb9b9('0x23')](function(){return BPromise[_0xb9b9('0x69')](_0x4a0121,function(_0x289b9a){return db[_0xb9b9('0x55')][_0xb9b9('0x6a')]({'where':{'UserId':_0x289b9a['id'],'SmsQueueId':_0x12c2d6[_0xb9b9('0x4a')]['id']},'transaction':_0x4bde4d});});})[_0xb9b9('0x23')](function(){_0x4a0121[_0xb9b9('0x6b')](function(_0x432859){socket[_0xb9b9('0x6c')]('userSmsQueue:save',{'UserId':_0x432859['id'],'SmsQueueId':_0x3fef45['id']});});});});});}})[_0xb9b9('0x23')](respondWithStatusCode(_0x1278f7,null))[_0xb9b9('0x4b')](handleError(_0x1278f7,null));};exports[_0xb9b9('0x6d')]=function(_0x2912b1,_0x4b6bff,_0x46fd1b){return db[_0xb9b9('0x6e')]['findAll']({'where':{'id':_0x2912b1[_0xb9b9('0x33')][_0xb9b9('0x64')]},'attributes':['id'],'include':[{'model':db[_0xb9b9('0x58')],'as':_0xb9b9('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xb9b9('0x23')](handleEntityNotFound(_0x4b6bff,null))[_0xb9b9('0x23')](function(_0x234ad3){var _0x157703=_[_0xb9b9('0x41')](_0x234ad3,'id');var _0x2b8eb1=[];var _0x5a60ee=[];var _0x818786=squel[_0xb9b9('0x70')]();_0x818786[_0xb9b9('0x71')](_0xb9b9('0x72'))[_0xb9b9('0x73')](_0xb9b9('0x74'),'tq')['join'](_0xb9b9('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xb9b9('0x76'),_0x2912b1[_0xb9b9('0x4a')]['id']);for(var _0x4b9427=0x0;_0x4b9427<_0x234ad3['length'];_0x4b9427+=0x1){let _0x3fa8d3=_0x234ad3[_0x4b9427];for(var _0x127015=0x0;_0x127015<_0x3fa8d3[_0xb9b9('0x6f')][_0xb9b9('0x38')];_0x127015+=0x1){let _0x438c6b=_0x3fa8d3[_0xb9b9('0x6f')][_0x127015];var _0x4bdec5=_0x818786[_0xb9b9('0x77')]();_0x4bdec5['where'](_0xb9b9('0x78'),_0x438c6b['id']);_0x5a60ee[_0xb9b9('0x79')](db['sequelize'][_0xb9b9('0x33')](_0x4bdec5['toString'](),{'type':db[_0xb9b9('0x68')]['QueryTypes'][_0xb9b9('0x7a')]})[_0xb9b9('0x23')](function(_0x4b4941){if(_0x4b4941[_0xb9b9('0x38')]===0x1){return _0x438c6b['id'];}else{var _0x542de2=_[_0xb9b9('0x7b')](_[_0xb9b9('0x41')](_0x4b4941,_0xb9b9('0x7c')),function(_0x5d34bb){return _[_0xb9b9('0x7d')](_0x157703,_0x5d34bb);});if(_0x542de2){return _0x438c6b['id'];}}}));}}return BPromise[_0xb9b9('0x7e')](_0x5a60ee)[_0xb9b9('0x23')](function(_0x1861c4){_0x2b8eb1=_(_0x2b8eb1)[_0xb9b9('0x7f')](_0x1861c4)[_0xb9b9('0x80')]()[_0xb9b9('0x81')]();return db[_0xb9b9('0x2d')][_0xb9b9('0x50')]({'where':{'id':_0x2912b1[_0xb9b9('0x4a')]['id']}})[_0xb9b9('0x23')](function(_0x148158){return db[_0xb9b9('0x68')][_0xb9b9('0x82')](function(_0x3c346c){return _0x148158[_0xb9b9('0x6d')](_0x2912b1['query'][_0xb9b9('0x64')],{'transaction':_0x3c346c})['then'](function(){if(!_[_0xb9b9('0x83')](_0x2b8eb1)){return _0x148158[_0xb9b9('0x84')](_0x2b8eb1,{'transaction':_0x3c346c});}})[_0xb9b9('0x23')](function(){_0x2b8eb1[_0xb9b9('0x6b')](function(_0x1d4fae){socket[_0xb9b9('0x6c')](_0xb9b9('0x85'),{'UserId':_0x1d4fae,'SmsQueueId':_0x148158['id']});});});});});});})[_0xb9b9('0x23')](respondWithStatusCode(_0x4b6bff,null))[_0xb9b9('0x4b')](handleError(_0x4b6bff,null));};exports['addAgents']=function(_0xcc1f88,_0x2da1ff,_0x2da082){return db['SmsQueue'][_0xb9b9('0x50')]({'where':{'id':_0xcc1f88[_0xb9b9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2da1ff,null))['then'](function(_0x555680){if(_0x555680){return _0x555680[_0xb9b9('0x86')](_0xcc1f88['body'][_0xb9b9('0x64')],_['omit'](_0xcc1f88[_0xb9b9('0x4d')],[_0xb9b9('0x64'),'id'])||{})[_0xb9b9('0x87')](function(_0x3b0885){for(var _0x2fa59d=0x0;_0x2fa59d<_0xcc1f88['body'][_0xb9b9('0x64')][_0xb9b9('0x38')];_0x2fa59d+=0x1){socket['emit'](_0xb9b9('0x88'),{'UserId':_0xcc1f88[_0xb9b9('0x4d')][_0xb9b9('0x64')][_0x2fa59d],'SmsQueueId':_0xcc1f88[_0xb9b9('0x4a')]['id']});}return _0x3b0885;});}})[_0xb9b9('0x23')](respondWithResult(_0x2da1ff,null))[_0xb9b9('0x4b')](handleError(_0x2da1ff,null));};exports[_0xb9b9('0x84')]=function(_0x384aa4,_0x45b360,_0x1f8a9d){return db[_0xb9b9('0x2d')][_0xb9b9('0x50')]({'where':{'id':_0x384aa4[_0xb9b9('0x4a')]['id']}})[_0xb9b9('0x23')](handleEntityNotFound(_0x45b360,null))[_0xb9b9('0x23')](function(_0x3d969a){if(_0x3d969a){return _0x3d969a[_0xb9b9('0x84')](_0x384aa4[_0xb9b9('0x33')][_0xb9b9('0x64')])[_0xb9b9('0x23')](function(){if(_[_0xb9b9('0x89')](_0x384aa4[_0xb9b9('0x33')][_0xb9b9('0x64')])){for(var _0x3186d0=0x0;_0x3186d0<_0x384aa4[_0xb9b9('0x33')]['ids']['length'];_0x3186d0+=0x1){socket[_0xb9b9('0x6c')](_0xb9b9('0x85'),{'UserId':Number(_0x384aa4[_0xb9b9('0x33')]['ids'][_0x3186d0]),'SmsQueueId':Number(_0x384aa4['params']['id'])});}}else{socket['emit'](_0xb9b9('0x85'),{'UserId':Number(_0x384aa4[_0xb9b9('0x33')][_0xb9b9('0x64')]),'SmsQueueId':Number(_0x384aa4['params']['id'])});}});}})[_0xb9b9('0x23')](respondWithStatusCode(_0x45b360,null))[_0xb9b9('0x4b')](handleError(_0x45b360,null));};exports[_0xb9b9('0x8a')]=function(_0x1bbf66,_0x564134,_0x1ad746){var _0x21254d={};var _0x5bd635={};var _0x4d16c3;var _0x3c0372;return db[_0xb9b9('0x2d')][_0xb9b9('0x61')]({'where':{'id':_0x1bbf66[_0xb9b9('0x4a')]['id']}})[_0xb9b9('0x23')](handleEntityNotFound(_0x564134,null))['then'](function(_0x5ae5f2){if(_0x5ae5f2){_0x4d16c3=_0x5ae5f2;_0x5bd635[_0xb9b9('0x32')]=_['keys'](db['User'][_0xb9b9('0x2e')]);_0x5bd635[_0xb9b9('0x33')]=_[_0xb9b9('0x34')](_0x1bbf66['query']);_0x5bd635[_0xb9b9('0x3c')]=_[_0xb9b9('0x36')](_0x5bd635['model'],_0x5bd635[_0xb9b9('0x33')]);_0x21254d[_0xb9b9('0x35')]=_['intersection'](_0x5bd635[_0xb9b9('0x32')],qs[_0xb9b9('0x37')](_0x1bbf66[_0xb9b9('0x33')][_0xb9b9('0x37')]));_0x21254d[_0xb9b9('0x35')]=_0x21254d[_0xb9b9('0x35')][_0xb9b9('0x38')]?_0x21254d[_0xb9b9('0x35')]:_0x5bd635[_0xb9b9('0x32')];_0x21254d['order']=qs['sort'](_0x1bbf66[_0xb9b9('0x33')]['sort']);_0x21254d[_0xb9b9('0x3f')]=qs[_0xb9b9('0x3c')](_[_0xb9b9('0x3d')](_0x1bbf66[_0xb9b9('0x33')],_0x5bd635[_0xb9b9('0x3c')]));if(_0x1bbf66[_0xb9b9('0x33')]['filter']){_0x21254d[_0xb9b9('0x3f')]=_[_0xb9b9('0x40')](_0x21254d['where'],{'$or':_[_0xb9b9('0x41')](_0x21254d['attributes'],function(_0x3e2857){var _0x5eac12={};_0x5eac12[_0x3e2857]={'$like':'%'+_0x1bbf66['query']['filter']+'%'};return _0x5eac12;})});}_0x21254d=_['merge']({},_0x21254d,_0x1bbf66[_0xb9b9('0x43')]);return _0x4d16c3[_0xb9b9('0x8a')](_0x21254d);}})[_0xb9b9('0x23')](function(_0x21e8f3){if(_0x21e8f3){_0x3c0372=_0x21e8f3[_0xb9b9('0x38')];if(!_0x1bbf66['query'][_0xb9b9('0x39')](_0xb9b9('0x3a'))){_0x21254d[_0xb9b9('0x1e')]=qs[_0xb9b9('0x1e')](_0x1bbf66[_0xb9b9('0x33')][_0xb9b9('0x1e')]);_0x21254d['offset']=qs['offset'](_0x1bbf66[_0xb9b9('0x33')][_0xb9b9('0x1d')]);}return _0x4d16c3['getAgents'](_0x21254d);}})[_0xb9b9('0x23')](function(_0x2cb71a){if(_0x2cb71a){return _0x2cb71a?{'count':_0x3c0372,'rows':_0x2cb71a}:null;}})[_0xb9b9('0x23')](respondWithResult(_0x564134,null))[_0xb9b9('0x4b')](handleError(_0x564134,null));}; \ No newline at end of file +var _0x8ec9=['getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','./smsQueue.socket','sendStatus','end','status','json','count','offset','limit','set','apply','save','then','destroy','SmsQueues','UserProfileResource','error','name','send','index','map','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','SmsQueue','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','findOne','SmsQueueId','UserSmsQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','isArray'];(function(_0x1ebb10,_0x156b3e){var _0x20d709=function(_0x4cc093){while(--_0x4cc093){_0x1ebb10['push'](_0x1ebb10['shift']());}};_0x20d709(++_0x156b3e);}(_0x8ec9,0x8d));var _0x98ec=function(_0x53d119,_0x4c230e){_0x53d119=_0x53d119-0x0;var _0x15f150=_0x8ec9[_0x53d119];return _0x15f150;};'use strict';var pdf=require(_0x98ec('0x0'));var emlformat=require(_0x98ec('0x1'));var rimraf=require(_0x98ec('0x2'));var zipdir=require(_0x98ec('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x98ec('0x4'));var moment=require(_0x98ec('0x5'));var BPromise=require(_0x98ec('0x6'));var Mustache=require(_0x98ec('0x7'));var util=require(_0x98ec('0x8'));var path=require(_0x98ec('0x9'));var sox=require(_0x98ec('0xa'));var csv=require(_0x98ec('0xb'));var ejs=require(_0x98ec('0xc'));var fs=require('fs');var _=require(_0x98ec('0xd'));var squel=require(_0x98ec('0xe'));var crypto=require('crypto');var jsforce=require(_0x98ec('0xf'));var deskjs=require(_0x98ec('0x10'));var toCsv=require('to-csv');var querystring=require(_0x98ec('0x11'));var Papa=require('papaparse');var Redis=require(_0x98ec('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x98ec('0x13'));var as=require(_0x98ec('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x98ec('0x15'));var utils=require(_0x98ec('0x16'));var config=require(_0x98ec('0x17'));var db=require('../../mysqldb')['db'];config[_0x98ec('0x18')]=_[_0x98ec('0x19')](config[_0x98ec('0x18')],{'host':_0x98ec('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98ec('0x18')]));require(_0x98ec('0x1b'))['register'](socket);function respondWithStatusCode(_0x5e41eb,_0x347ed3){_0x347ed3=_0x347ed3||0xcc;return function(_0x193e7a){if(_0x193e7a){return _0x5e41eb[_0x98ec('0x1c')](_0x347ed3);}return _0x5e41eb['status'](_0x347ed3)[_0x98ec('0x1d')]();};}function respondWithResult(_0x20e85d,_0x69df1b){_0x69df1b=_0x69df1b||0xc8;return function(_0x212957){if(_0x212957){return _0x20e85d[_0x98ec('0x1e')](_0x69df1b)[_0x98ec('0x1f')](_0x212957);}};}function respondWithFilteredResult(_0x40919b,_0x27b867){return function(_0x48bbf3){if(_0x48bbf3){var _0x454fd1=_0x48bbf3[_0x98ec('0x20')],_0x1debfd=_0x27b867[_0x98ec('0x21')],_0x22f588=_0x27b867[_0x98ec('0x21')]+_0x27b867[_0x98ec('0x22')],_0x3ba139;if(_0x22f588>=_0x454fd1){_0x22f588=_0x454fd1;_0x3ba139=0xc8;}else{_0x3ba139=0xce;}_0x40919b[_0x98ec('0x1e')](_0x3ba139);return _0x40919b[_0x98ec('0x23')]('Content-Range',_0x1debfd+'-'+_0x22f588+'/'+_0x454fd1)[_0x98ec('0x1f')](_0x48bbf3);}return null;};}function patchUpdates(_0x279a12){return function(_0x44f4a1){try{jsonpatch[_0x98ec('0x24')](_0x44f4a1,_0x279a12,!![]);}catch(_0x1294ce){return BPromise['reject'](_0x1294ce);}return _0x44f4a1[_0x98ec('0x25')]();};}function saveUpdates(_0x1454bb,_0x4c56be){return function(_0x116ef6){if(_0x116ef6){return _0x116ef6['update'](_0x1454bb)[_0x98ec('0x26')](function(_0x945dea){return _0x945dea;});}return null;};}function removeEntity(_0x146565,_0x5f2355){return function(_0x25bf1d){if(_0x25bf1d){return _0x25bf1d[_0x98ec('0x27')]()[_0x98ec('0x26')](function(){var _0x13a6cd=_0x25bf1d['get']({'plain':!![]});var _0x3e5edd=_0x98ec('0x28');return db[_0x98ec('0x29')][_0x98ec('0x27')]({'where':{'type':_0x3e5edd,'resourceId':_0x13a6cd['id']}})[_0x98ec('0x26')](function(){return _0x25bf1d;});})[_0x98ec('0x26')](function(){_0x146565[_0x98ec('0x1e')](0xcc)[_0x98ec('0x1d')]();});}};}function handleEntityNotFound(_0x1e82fc,_0x582536){return function(_0x1d3c44){if(!_0x1d3c44){_0x1e82fc[_0x98ec('0x1c')](0x194);}return _0x1d3c44;};}function handleError(_0x871280,_0x271a1c){_0x271a1c=_0x271a1c||0x1f4;return function(_0x2640ac){logger[_0x98ec('0x2a')](_0x2640ac['stack']);if(_0x2640ac[_0x98ec('0x2b')]){delete _0x2640ac[_0x98ec('0x2b')];}_0x871280[_0x98ec('0x1e')](_0x271a1c)[_0x98ec('0x2c')](_0x2640ac);};}exports[_0x98ec('0x2d')]=function(_0xc5beab,_0x2f0795){var _0x58b3be={},_0x4226e5={},_0x5ad966={'count':0x0,'rows':[]};var _0x5b8c92=_[_0x98ec('0x2e')](db['SmsQueue']['rawAttributes'],function(_0xa2170b){return{'name':_0xa2170b[_0x98ec('0x2f')],'type':_0xa2170b['type'][_0x98ec('0x30')]};});_0x4226e5[_0x98ec('0x31')]=_['map'](_0x5b8c92,_0x98ec('0x2b'));_0x4226e5[_0x98ec('0x32')]=_[_0x98ec('0x33')](_0xc5beab[_0x98ec('0x32')]);_0x4226e5['filters']=_['intersection'](_0x4226e5[_0x98ec('0x31')],_0x4226e5[_0x98ec('0x32')]);_0x58b3be['attributes']=_[_0x98ec('0x34')](_0x4226e5[_0x98ec('0x31')],qs[_0x98ec('0x35')](_0xc5beab[_0x98ec('0x32')]['fields']));_0x58b3be[_0x98ec('0x36')]=_0x58b3be[_0x98ec('0x36')][_0x98ec('0x37')]?_0x58b3be[_0x98ec('0x36')]:_0x4226e5[_0x98ec('0x31')];if(!_0xc5beab[_0x98ec('0x32')][_0x98ec('0x38')](_0x98ec('0x39'))){_0x58b3be[_0x98ec('0x22')]=qs[_0x98ec('0x22')](_0xc5beab[_0x98ec('0x32')][_0x98ec('0x22')]);_0x58b3be[_0x98ec('0x21')]=qs[_0x98ec('0x21')](_0xc5beab[_0x98ec('0x32')][_0x98ec('0x21')]);}_0x58b3be[_0x98ec('0x3a')]=qs[_0x98ec('0x3b')](_0xc5beab[_0x98ec('0x32')]['sort']);_0x58b3be[_0x98ec('0x3c')]=qs[_0x98ec('0x3d')](_[_0x98ec('0x3e')](_0xc5beab[_0x98ec('0x32')],_0x4226e5[_0x98ec('0x3d')]),_0x5b8c92);if(_0xc5beab[_0x98ec('0x32')][_0x98ec('0x3f')]){_0x58b3be['where']=_['merge'](_0x58b3be[_0x98ec('0x3c')],{'$or':_[_0x98ec('0x2e')](_0x5b8c92,function(_0x4db245){if(_0x4db245['type']!=='VIRTUAL'){var _0x594cd8={};_0x594cd8[_0x4db245[_0x98ec('0x2b')]]={'$like':'%'+_0xc5beab[_0x98ec('0x32')]['filter']+'%'};return _0x594cd8;}})});}_0x58b3be=_[_0x98ec('0x40')]({},_0x58b3be,_0xc5beab[_0x98ec('0x41')]);var _0x44085e={'where':_0x58b3be[_0x98ec('0x3c')]};return db[_0x98ec('0x42')][_0x98ec('0x20')](_0x44085e)['then'](function(_0x407ec0){_0x5ad966[_0x98ec('0x20')]=_0x407ec0;if(_0xc5beab[_0x98ec('0x32')][_0x98ec('0x43')]){_0x58b3be[_0x98ec('0x44')]=[{'all':!![]}];}return db[_0x98ec('0x42')][_0x98ec('0x45')](_0x58b3be);})[_0x98ec('0x26')](function(_0x5d18d7){_0x5ad966[_0x98ec('0x46')]=_0x5d18d7;return _0x5ad966;})['then'](respondWithFilteredResult(_0x2f0795,_0x58b3be))[_0x98ec('0x47')](handleError(_0x2f0795,null));};exports[_0x98ec('0x48')]=function(_0x4706eb,_0x157ca4){var _0x2632f0={'raw':!![],'where':{'id':_0x4706eb['params']['id']}},_0x76f303={};_0x76f303[_0x98ec('0x31')]=_[_0x98ec('0x33')](db[_0x98ec('0x42')][_0x98ec('0x49')]);_0x76f303[_0x98ec('0x32')]=_['keys'](_0x4706eb[_0x98ec('0x32')]);_0x76f303[_0x98ec('0x3d')]=_[_0x98ec('0x34')](_0x76f303[_0x98ec('0x31')],_0x76f303[_0x98ec('0x32')]);_0x2632f0[_0x98ec('0x36')]=_[_0x98ec('0x34')](_0x76f303[_0x98ec('0x31')],qs[_0x98ec('0x35')](_0x4706eb[_0x98ec('0x32')][_0x98ec('0x35')]));_0x2632f0[_0x98ec('0x36')]=_0x2632f0[_0x98ec('0x36')][_0x98ec('0x37')]?_0x2632f0['attributes']:_0x76f303[_0x98ec('0x31')];if(_0x4706eb[_0x98ec('0x32')][_0x98ec('0x43')]){_0x2632f0[_0x98ec('0x44')]=[{'all':!![]}];}_0x2632f0=_[_0x98ec('0x40')]({},_0x2632f0,_0x4706eb[_0x98ec('0x41')]);return db[_0x98ec('0x42')][_0x98ec('0x4a')](_0x2632f0)['then'](handleEntityNotFound(_0x157ca4,null))[_0x98ec('0x26')](respondWithResult(_0x157ca4,null))[_0x98ec('0x47')](handleError(_0x157ca4,null));};exports[_0x98ec('0x4b')]=function(_0xe3d0c0,_0x5f400a){return db[_0x98ec('0x42')][_0x98ec('0x4b')](_0xe3d0c0[_0x98ec('0x4c')],{})['then'](function(_0xb05521){var _0xddd8b=_0xe3d0c0[_0x98ec('0x4d')][_0x98ec('0x4e')]({'plain':!![]});if(!_0xddd8b)throw new Error(_0x98ec('0x4f'));if(_0xddd8b[_0x98ec('0x50')]===_0x98ec('0x4d')){var _0x1abd37=_0xb05521[_0x98ec('0x4e')]({'plain':!![]});var _0x486300=_0x98ec('0x28');return db[_0x98ec('0x51')]['find']({'where':{'name':_0x486300,'userProfileId':_0xddd8b['userProfileId']},'raw':!![]})[_0x98ec('0x26')](function(_0x16b666){if(_0x16b666&&_0x16b666['autoAssociation']===0x0){return db[_0x98ec('0x29')][_0x98ec('0x4b')]({'name':_0x1abd37[_0x98ec('0x2b')],'resourceId':_0x1abd37['id'],'type':_0x16b666[_0x98ec('0x2b')],'sectionId':_0x16b666['id']},{})[_0x98ec('0x26')](function(){return _0xb05521;});}else{return _0xb05521;}})[_0x98ec('0x47')](function(_0x5ace42){logger[_0x98ec('0x2a')](_0x98ec('0x52'),_0x5ace42);throw _0x5ace42;});}return _0xb05521;})['then'](respondWithResult(_0x5f400a,0xc9))[_0x98ec('0x47')](handleError(_0x5f400a,null));};exports[_0x98ec('0x53')]=function(_0x2de672,_0x476ea7){if(_0x2de672[_0x98ec('0x4c')]['id']){delete _0x2de672['body']['id'];}return db[_0x98ec('0x42')][_0x98ec('0x4a')]({'where':{'id':_0x2de672[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x476ea7,null))[_0x98ec('0x26')](saveUpdates(_0x2de672['body'],null))[_0x98ec('0x26')](respondWithResult(_0x476ea7,null))['catch'](handleError(_0x476ea7,null));};exports[_0x98ec('0x27')]=function(_0x7feda0,_0x4f9ee2){return db[_0x98ec('0x42')][_0x98ec('0x4a')]({'where':{'id':_0x7feda0[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x4f9ee2,null))['then'](removeEntity(_0x4f9ee2,null))[_0x98ec('0x47')](handleError(_0x4f9ee2,null));};exports['describe']=function(_0x21cdac,_0x51192e){return db['SmsQueue'][_0x98ec('0x55')]()['then'](respondWithResult(_0x51192e,null))[_0x98ec('0x47')](handleError(_0x51192e,null));};exports['getMembers']=function(_0x45dc07,_0x175975,_0x88f5de){var _0x4384f6={'raw':!![],'where':{}},_0x493d81={},_0x242b81;return db['SmsQueue'][_0x98ec('0x56')]({'where':{'id':_0x45dc07[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x175975,null))[_0x98ec('0x26')](function(_0x899795){if(_0x899795){_0x242b81=_0x899795[_0x98ec('0x4e')]({'plain':!![]});_0x493d81[_0x98ec('0x31')]=_['keys'](db['UserSmsQueue']['rawAttributes']);_0x493d81[_0x98ec('0x32')]=_[_0x98ec('0x33')](_0x45dc07['query']);_0x493d81[_0x98ec('0x3d')]=_[_0x98ec('0x34')](_0x493d81[_0x98ec('0x31')],_0x493d81[_0x98ec('0x32')]);_0x4384f6[_0x98ec('0x36')]=_[_0x98ec('0x34')](_0x493d81['model'],qs[_0x98ec('0x35')](_0x45dc07['query']['fields']));_0x4384f6['attributes']=_0x4384f6[_0x98ec('0x36')]['length']?_0x4384f6[_0x98ec('0x36')]:_0x493d81[_0x98ec('0x31')];if(!_0x45dc07[_0x98ec('0x32')][_0x98ec('0x38')](_0x98ec('0x39'))){_0x4384f6[_0x98ec('0x22')]=qs[_0x98ec('0x22')](_0x45dc07[_0x98ec('0x32')][_0x98ec('0x22')]);_0x4384f6[_0x98ec('0x21')]=qs[_0x98ec('0x21')](_0x45dc07['query'][_0x98ec('0x21')]);}_0x4384f6[_0x98ec('0x3a')]=qs[_0x98ec('0x3b')](_0x45dc07['query'][_0x98ec('0x3b')]);_0x4384f6[_0x98ec('0x3c')]=qs[_0x98ec('0x3d')](_[_0x98ec('0x3e')](_0x45dc07['query'],_0x493d81['filters']));_0x4384f6[_0x98ec('0x3c')][_0x98ec('0x57')]=_0x899795['id'];if(_0x45dc07[_0x98ec('0x32')]['filter']){_0x4384f6[_0x98ec('0x3c')]=_[_0x98ec('0x40')](_0x4384f6[_0x98ec('0x3c')],{'$or':_[_0x98ec('0x2e')](_0x4384f6[_0x98ec('0x36')],function(_0x50011a){var _0x59346d={};_0x59346d[_0x50011a]={'$like':'%'+_0x45dc07['query'][_0x98ec('0x3f')]+'%'};return _0x59346d;})});}_0x4384f6=_['merge']({},_0x4384f6,_0x45dc07['options']);return db[_0x98ec('0x58')][_0x98ec('0x45')](_0x4384f6);}})[_0x98ec('0x26')](function(_0x3390e5){if(_0x3390e5){return db[_0x98ec('0x59')][_0x98ec('0x5a')]({'where':{'id':_['map'](_0x3390e5,_0x98ec('0x5b')),'role':_0x98ec('0x5c')},'attributes':['id',_0x98ec('0x2b'),'smsPause',_0x98ec('0x5d'),_0x98ec('0x5e')]});}})[_0x98ec('0x26')](function(_0x550099){if(_0x550099){return{'count':_0x550099['count'],'rows':_[_0x98ec('0x2e')](_0x550099['rows'],function(_0x4ef76f){return{'membername':_0x4ef76f[_0x98ec('0x2b')],'UserId':_0x4ef76f['id'],'queue_name':_0x242b81[_0x98ec('0x2b')],'SmsQueueId':_0x242b81['id'],'interface':util[_0x98ec('0x5f')](_0x98ec('0x60'),_0x98ec('0x61'),_0x4ef76f[_0x98ec('0x2b')]),'penalty':0x0,'paused':_0x4ef76f['smsPause'],'createdAt':_0x4ef76f[_0x98ec('0x5e')],'updatedAt':_0x4ef76f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x175975,_0x4384f6))[_0x98ec('0x47')](handleError(_0x175975,null));};exports[_0x98ec('0x62')]=function(_0x42fb21,_0x199ec0,_0x4d431c){var _0xa922f4={};var _0x326212={};var _0x5028d7;var _0x224305;return db[_0x98ec('0x42')]['findOne']({'where':{'id':_0x42fb21[_0x98ec('0x54')]['id']}})['then'](handleEntityNotFound(_0x199ec0,null))[_0x98ec('0x26')](function(_0x5eb83b){if(_0x5eb83b){_0x5028d7=_0x5eb83b;_0x326212[_0x98ec('0x31')]=_[_0x98ec('0x33')](db[_0x98ec('0x63')][_0x98ec('0x49')]);_0x326212[_0x98ec('0x32')]=_[_0x98ec('0x33')](_0x42fb21['query']);_0x326212['filters']=_[_0x98ec('0x34')](_0x326212[_0x98ec('0x31')],_0x326212[_0x98ec('0x32')]);_0xa922f4[_0x98ec('0x36')]=_[_0x98ec('0x34')](_0x326212[_0x98ec('0x31')],qs[_0x98ec('0x35')](_0x42fb21[_0x98ec('0x32')][_0x98ec('0x35')]));_0xa922f4['attributes']=_0xa922f4['attributes']['length']?_0xa922f4[_0x98ec('0x36')]:_0x326212['model'];_0xa922f4['order']=qs[_0x98ec('0x3b')](_0x42fb21[_0x98ec('0x32')][_0x98ec('0x3b')]);_0xa922f4[_0x98ec('0x3c')]=qs[_0x98ec('0x3d')](_[_0x98ec('0x3e')](_0x42fb21[_0x98ec('0x32')],_0x326212[_0x98ec('0x3d')]));if(_0x42fb21[_0x98ec('0x32')][_0x98ec('0x3f')]){_0xa922f4['where']=_['merge'](_0xa922f4['where'],{'$or':_[_0x98ec('0x2e')](_0xa922f4['attributes'],function(_0x4db556){var _0x454c69={};_0x454c69[_0x4db556]={'$like':'%'+_0x42fb21[_0x98ec('0x32')][_0x98ec('0x3f')]+'%'};return _0x454c69;})});}_0xa922f4=_[_0x98ec('0x40')]({},_0xa922f4,_0x42fb21[_0x98ec('0x41')]);return _0x5028d7[_0x98ec('0x62')](_0xa922f4);}})[_0x98ec('0x26')](function(_0x35ea4d){if(_0x35ea4d){_0x224305=_0x35ea4d[_0x98ec('0x37')];if(!_0x42fb21[_0x98ec('0x32')][_0x98ec('0x38')](_0x98ec('0x39'))){_0xa922f4[_0x98ec('0x22')]=qs[_0x98ec('0x22')](_0x42fb21[_0x98ec('0x32')][_0x98ec('0x22')]);_0xa922f4[_0x98ec('0x21')]=qs[_0x98ec('0x21')](_0x42fb21[_0x98ec('0x32')][_0x98ec('0x21')]);}return _0x5028d7[_0x98ec('0x62')](_0xa922f4);}})[_0x98ec('0x26')](function(_0x4cbb6a){if(_0x4cbb6a){return _0x4cbb6a?{'count':_0x224305,'rows':_0x4cbb6a}:null;}})[_0x98ec('0x26')](respondWithResult(_0x199ec0,null))[_0x98ec('0x47')](handleError(_0x199ec0,null));};exports['addTeams']=function(_0x3b35ad,_0x15e2f1,_0x554442){var _0x1ddd8f=_0x3b35ad['body'][_0x98ec('0x64')];return db[_0x98ec('0x63')][_0x98ec('0x45')]({'where':{'id':_0x1ddd8f},'attributes':['id'],'include':[{'model':db[_0x98ec('0x59')],'as':_0x98ec('0x65'),'attributes':['id',_0x98ec('0x2b'),_0x98ec('0x66'),_0x98ec('0x67'),_0x98ec('0x68')],'raw':!![]}]})['then'](function(_0x15d838){if(_0x15d838){var _0x23068c=_[_0x98ec('0x69')](_0x15d838,function(_0x3b565a){var _0x32d8da=_0x3b565a['get']({'plain':!![]});return _0x32d8da[_0x98ec('0x65')];});return db[_0x98ec('0x42')]['find']({'where':{'id':_0x3b35ad[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](function(_0x2a83bb){return db[_0x98ec('0x6a')][_0x98ec('0x6b')](function(_0x2702d5){return _0x2a83bb[_0x98ec('0x6c')](_0x1ddd8f,{'transaction':_0x2702d5})[_0x98ec('0x26')](function(){return BPromise[_0x98ec('0x6d')](_0x23068c,function(_0x378546){return db[_0x98ec('0x58')][_0x98ec('0x6e')]({'where':{'UserId':_0x378546['id'],'SmsQueueId':_0x3b35ad[_0x98ec('0x54')]['id']},'transaction':_0x2702d5});});})['then'](function(){_0x23068c[_0x98ec('0x6f')](function(_0x37633d){socket[_0x98ec('0x70')](_0x98ec('0x71'),{'UserId':_0x37633d['id'],'SmsQueueId':_0x2a83bb['id']});});});});});}})['then'](respondWithStatusCode(_0x15e2f1,null))[_0x98ec('0x47')](handleError(_0x15e2f1,null));};exports[_0x98ec('0x72')]=function(_0x52c3bb,_0xeb94b9,_0x5f0f47){return db['Team'][_0x98ec('0x45')]({'where':{'id':_0x52c3bb['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x98ec('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x98ec('0x26')](handleEntityNotFound(_0xeb94b9,null))[_0x98ec('0x26')](function(_0x1d3b6d){var _0x484d1b=_[_0x98ec('0x2e')](_0x1d3b6d,'id');var _0x17aa0a=[];var _0x388eb4=[];var _0x402618=squel[_0x98ec('0x73')]();_0x402618[_0x98ec('0x74')](_0x98ec('0x75'))['from'](_0x98ec('0x76'),'tq')[_0x98ec('0x77')](_0x98ec('0x78'),'ut',_0x98ec('0x79'))[_0x98ec('0x3c')](_0x98ec('0x7a'),_0x52c3bb['params']['id']);for(var _0xa00155=0x0;_0xa00155<_0x1d3b6d[_0x98ec('0x37')];_0xa00155+=0x1){let _0x2143e8=_0x1d3b6d[_0xa00155];for(var _0x272211=0x0;_0x272211<_0x2143e8[_0x98ec('0x65')][_0x98ec('0x37')];_0x272211+=0x1){let _0x519b8d=_0x2143e8[_0x98ec('0x65')][_0x272211];var _0x38fbe0=_0x402618[_0x98ec('0x7b')]();_0x38fbe0[_0x98ec('0x3c')](_0x98ec('0x7c'),_0x519b8d['id']);_0x388eb4['push'](db[_0x98ec('0x6a')]['query'](_0x38fbe0[_0x98ec('0x7d')](),{'type':db['sequelize'][_0x98ec('0x7e')][_0x98ec('0x7f')]})[_0x98ec('0x26')](function(_0x566234){if(_0x566234[_0x98ec('0x37')]===0x1){return _0x519b8d['id'];}else{var _0x3c2606=_['every'](_[_0x98ec('0x2e')](_0x566234,_0x98ec('0x80')),function(_0x4c14df){return _[_0x98ec('0x81')](_0x484d1b,_0x4c14df);});if(_0x3c2606){return _0x519b8d['id'];}}}));}}return BPromise[_0x98ec('0x82')](_0x388eb4)[_0x98ec('0x26')](function(_0xc67385){_0x17aa0a=_(_0x17aa0a)[_0x98ec('0x83')](_0xc67385)[_0x98ec('0x84')]()[_0x98ec('0x85')]();return db[_0x98ec('0x42')][_0x98ec('0x4a')]({'where':{'id':_0x52c3bb[_0x98ec('0x54')]['id']}})['then'](function(_0x58fba5){return db['sequelize'][_0x98ec('0x6b')](function(_0x52f2c8){return _0x58fba5[_0x98ec('0x72')](_0x52c3bb[_0x98ec('0x32')][_0x98ec('0x64')],{'transaction':_0x52f2c8})[_0x98ec('0x26')](function(){if(!_[_0x98ec('0x86')](_0x17aa0a)){return _0x58fba5[_0x98ec('0x87')](_0x17aa0a,{'transaction':_0x52f2c8});}})[_0x98ec('0x26')](function(){_0x17aa0a['forEach'](function(_0x4c5646){socket[_0x98ec('0x70')](_0x98ec('0x88'),{'UserId':_0x4c5646,'SmsQueueId':_0x58fba5['id']});});});});});});})[_0x98ec('0x26')](respondWithStatusCode(_0xeb94b9,null))[_0x98ec('0x47')](handleError(_0xeb94b9,null));};exports[_0x98ec('0x89')]=function(_0x148e16,_0x5aacc3,_0x35eec2){return db[_0x98ec('0x42')][_0x98ec('0x4a')]({'where':{'id':_0x148e16[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x5aacc3,null))[_0x98ec('0x26')](function(_0x1c5085){if(_0x1c5085){return _0x1c5085[_0x98ec('0x89')](_0x148e16[_0x98ec('0x4c')]['ids'],_['omit'](_0x148e16[_0x98ec('0x4c')],[_0x98ec('0x64'),'id'])||{})['spread'](function(_0x8d5d10){for(var _0x2d1d6d=0x0;_0x2d1d6d<_0x148e16[_0x98ec('0x4c')][_0x98ec('0x64')][_0x98ec('0x37')];_0x2d1d6d+=0x1){socket[_0x98ec('0x70')](_0x98ec('0x71'),{'UserId':_0x148e16['body']['ids'][_0x2d1d6d],'SmsQueueId':_0x148e16[_0x98ec('0x54')]['id']});}return _0x8d5d10;});}})[_0x98ec('0x26')](respondWithResult(_0x5aacc3,null))[_0x98ec('0x47')](handleError(_0x5aacc3,null));};exports[_0x98ec('0x87')]=function(_0x4ced71,_0x3daafc,_0x2972f2){return db[_0x98ec('0x42')][_0x98ec('0x4a')]({'where':{'id':_0x4ced71['params']['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x3daafc,null))[_0x98ec('0x26')](function(_0x52f3ee){if(_0x52f3ee){return _0x52f3ee[_0x98ec('0x87')](_0x4ced71['query'][_0x98ec('0x64')])[_0x98ec('0x26')](function(){if(_[_0x98ec('0x8a')](_0x4ced71['query'][_0x98ec('0x64')])){for(var _0x3323fc=0x0;_0x3323fc<_0x4ced71['query'][_0x98ec('0x64')][_0x98ec('0x37')];_0x3323fc+=0x1){socket[_0x98ec('0x70')](_0x98ec('0x88'),{'UserId':Number(_0x4ced71[_0x98ec('0x32')][_0x98ec('0x64')][_0x3323fc]),'SmsQueueId':Number(_0x4ced71['params']['id'])});}}else{socket[_0x98ec('0x70')](_0x98ec('0x88'),{'UserId':Number(_0x4ced71[_0x98ec('0x32')][_0x98ec('0x64')]),'SmsQueueId':Number(_0x4ced71[_0x98ec('0x54')]['id'])});}});}})[_0x98ec('0x26')](respondWithStatusCode(_0x3daafc,null))[_0x98ec('0x47')](handleError(_0x3daafc,null));};exports[_0x98ec('0x8b')]=function(_0x13207a,_0x249c39,_0x126015){var _0x10879a={};var _0x129208={};var _0x4c9d5a;var _0x2244aa;return db[_0x98ec('0x42')][_0x98ec('0x56')]({'where':{'id':_0x13207a[_0x98ec('0x54')]['id']}})[_0x98ec('0x26')](handleEntityNotFound(_0x249c39,null))['then'](function(_0x5810fe){if(_0x5810fe){_0x4c9d5a=_0x5810fe;_0x129208['model']=_[_0x98ec('0x33')](db['User'][_0x98ec('0x49')]);_0x129208[_0x98ec('0x32')]=_['keys'](_0x13207a[_0x98ec('0x32')]);_0x129208[_0x98ec('0x3d')]=_[_0x98ec('0x34')](_0x129208[_0x98ec('0x31')],_0x129208[_0x98ec('0x32')]);_0x10879a[_0x98ec('0x36')]=_['intersection'](_0x129208[_0x98ec('0x31')],qs[_0x98ec('0x35')](_0x13207a[_0x98ec('0x32')][_0x98ec('0x35')]));_0x10879a[_0x98ec('0x36')]=_0x10879a[_0x98ec('0x36')][_0x98ec('0x37')]?_0x10879a[_0x98ec('0x36')]:_0x129208[_0x98ec('0x31')];_0x10879a[_0x98ec('0x3a')]=qs[_0x98ec('0x3b')](_0x13207a[_0x98ec('0x32')][_0x98ec('0x3b')]);_0x10879a['where']=qs[_0x98ec('0x3d')](_[_0x98ec('0x3e')](_0x13207a[_0x98ec('0x32')],_0x129208[_0x98ec('0x3d')]));if(_0x13207a['query'][_0x98ec('0x3f')]){_0x10879a[_0x98ec('0x3c')]=_[_0x98ec('0x40')](_0x10879a[_0x98ec('0x3c')],{'$or':_[_0x98ec('0x2e')](_0x10879a[_0x98ec('0x36')],function(_0x510c10){var _0x3a61d4={};_0x3a61d4[_0x510c10]={'$like':'%'+_0x13207a[_0x98ec('0x32')][_0x98ec('0x3f')]+'%'};return _0x3a61d4;})});}_0x10879a=_[_0x98ec('0x40')]({},_0x10879a,_0x13207a[_0x98ec('0x41')]);return _0x4c9d5a[_0x98ec('0x8b')](_0x10879a);}})[_0x98ec('0x26')](function(_0x5513bc){if(_0x5513bc){_0x2244aa=_0x5513bc[_0x98ec('0x37')];if(!_0x13207a[_0x98ec('0x32')][_0x98ec('0x38')]('nolimit')){_0x10879a[_0x98ec('0x22')]=qs[_0x98ec('0x22')](_0x13207a['query'][_0x98ec('0x22')]);_0x10879a[_0x98ec('0x21')]=qs[_0x98ec('0x21')](_0x13207a['query'][_0x98ec('0x21')]);}return _0x4c9d5a[_0x98ec('0x8b')](_0x10879a);}})[_0x98ec('0x26')](function(_0x53fa7c){if(_0x53fa7c){return _0x53fa7c?{'count':_0x2244aa,'rows':_0x53fa7c}:null;}})[_0x98ec('0x26')](respondWithResult(_0x249c39,null))[_0x98ec('0x47')](handleError(_0x249c39,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 19653a6..9b75b81 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 _0x81ff=['events','SmsQueue','setMaxListeners','save','remove','hasOwnProperty','exports'];(function(_0x2a56db,_0x2d1d7f){var _0x3cf7f3=function(_0x57ffc7){while(--_0x57ffc7){_0x2a56db['push'](_0x2a56db['shift']());}};_0x3cf7f3(++_0x2d1d7f);}(_0x81ff,0x149));var _0xf81f=function(_0x537831,_0x118c2f){_0x537831=_0x537831-0x0;var _0x29719b=_0x81ff[_0x537831];return _0x29719b;};'use strict';var EventEmitter=require(_0xf81f('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xf81f('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf81f('0x2')](0x0);var events={'afterCreate':_0xf81f('0x3'),'afterUpdate':'update','afterDestroy':_0xf81f('0x4')};function emitEvent(_0x254884){return function(_0x3324e2,_0x4376a3,_0x588ed5){SmsQueueEvents['emit'](_0x254884+':'+_0x3324e2['id'],_0x3324e2);SmsQueueEvents['emit'](_0x254884,_0x3324e2);_0x588ed5(null);};}for(var e in events){if(events[_0xf81f('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xf81f('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x4ba9=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ba9,0x18f));var _0x94ba=function(_0x562362,_0x5d54f4){_0x562362=_0x562362-0x0;var _0x3a18ce=_0x4ba9[_0x562362];return _0x3a18ce;};'use strict';var EventEmitter=require(_0x94ba('0x0'));var SmsQueue=require(_0x94ba('0x1'))['db'][_0x94ba('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x94ba('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x94ba('0x4'),'afterDestroy':_0x94ba('0x5')};function emitEvent(_0x23ff2e){return function(_0x50eb2d,_0x694254,_0x3aa212){SmsQueueEvents[_0x94ba('0x6')](_0x23ff2e+':'+_0x50eb2d['id'],_0x50eb2d);SmsQueueEvents[_0x94ba('0x6')](_0x23ff2e,_0x50eb2d);_0x3aa212(null);};}for(var e in events){if(events[_0x94ba('0x7')](e)){var event=events[e];SmsQueue[_0x94ba('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 011689b..b7bd2d2 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 _0x49c4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','SmsQueue','sms_queues','lodash'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x49c4,0x9b));var _0x449c=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x49c4[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0x449c('0x0'));var util=require('util');var logger=require(_0x449c('0x1'))(_0x449c('0x2'));var moment=require(_0x449c('0x3'));var BPromise=require(_0x449c('0x4'));var rp=require(_0x449c('0x5'));var fs=require('fs');var path=require(_0x449c('0x6'));var rimraf=require(_0x449c('0x7'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x449c('0x8')]=function(_0x442e56,_0x12586c){return _0x442e56[_0x449c('0x9')](_0x449c('0xa'),attributes,{'tableName':_0x449c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x7217,0x19e));var _0x7721=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x7217[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 4c3cc4c..3d1e78d 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 _0xc6e9=['../../config/utils','../../config/logger','rpc','redis','socket.io-emitter','./smsQueue.socket','register','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SmsQueue','findAll','options','raw','where','attributes','limit','map','model','include','GetSmsQueue','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring'];(function(_0x4bfa31,_0x2ff098){var _0x479a0d=function(_0x226cc8){while(--_0x226cc8){_0x4bfa31['push'](_0x4bfa31['shift']());}};_0x479a0d(++_0x2ff098);}(_0xc6e9,0x11b));var _0x9c6e=function(_0x1a7783,_0x5a81af){_0x1a7783=_0x1a7783-0x0;var _0x1f41a6=_0xc6e9[_0x1a7783];return _0x1f41a6;};'use strict';var _=require(_0x9c6e('0x0'));var util=require(_0x9c6e('0x1'));var moment=require(_0x9c6e('0x2'));var BPromise=require(_0x9c6e('0x3'));var rs=require(_0x9c6e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9c6e('0x5'));var logger=require(_0x9c6e('0x6'))(_0x9c6e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x9c6e('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9c6e('0x9'))(new Redis(config[_0x9c6e('0x8')]));require(_0x9c6e('0xa'))[_0x9c6e('0xb')](socket);function respondWithRpcPromise(_0xd4e5e3,_0x3fad79,_0x487fa2){return new BPromise(function(_0x4fba64,_0x3f3de7){return client['request'](_0xd4e5e3,_0x487fa2)[_0x9c6e('0xc')](function(_0x531e6b){logger['info'](_0x9c6e('0xd'),_0x3fad79,_0x9c6e('0xe'));logger[_0x9c6e('0xf')](_0x9c6e('0x10'),_0x3fad79,_0x9c6e('0xe'),JSON[_0x9c6e('0x11')](_0x531e6b));if(_0x531e6b['error']){if(_0x531e6b[_0x9c6e('0x12')][_0x9c6e('0x13')]===0x1f4){logger[_0x9c6e('0x12')](_0x9c6e('0xd'),_0x3fad79,_0x531e6b[_0x9c6e('0x12')]['message']);return _0x3f3de7(_0x531e6b[_0x9c6e('0x12')][_0x9c6e('0x14')]);}logger[_0x9c6e('0x12')](_0x9c6e('0xd'),_0x3fad79,_0x531e6b[_0x9c6e('0x12')][_0x9c6e('0x14')]);return _0x4fba64(_0x531e6b[_0x9c6e('0x12')][_0x9c6e('0x14')]);}else{logger[_0x9c6e('0x15')](_0x9c6e('0xd'),_0x3fad79,_0x9c6e('0xe'));_0x4fba64(_0x531e6b['result'][_0x9c6e('0x14')]);}})[_0x9c6e('0x16')](function(_0x10470d){logger['error'](_0x9c6e('0xd'),_0x3fad79,_0x10470d);_0x3f3de7(_0x10470d);});});}exports['GetSmsQueue']=function(_0x4f89d0){var _0x23222f=this;return new Promise(function(_0x6ca215,_0x1f9263){return db[_0x9c6e('0x17')][_0x9c6e('0x18')]({'raw':_0x4f89d0[_0x9c6e('0x19')]?_0x4f89d0[_0x9c6e('0x19')][_0x9c6e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f89d0[_0x9c6e('0x19')]?_0x4f89d0['options'][_0x9c6e('0x1b')]||null:null,'attributes':_0x4f89d0[_0x9c6e('0x19')]?_0x4f89d0[_0x9c6e('0x19')][_0x9c6e('0x1c')]||null:null,'limit':_0x4f89d0[_0x9c6e('0x19')]?_0x4f89d0[_0x9c6e('0x19')][_0x9c6e('0x1d')]||null:null,'include':_0x4f89d0[_0x9c6e('0x19')]?_0x4f89d0[_0x9c6e('0x19')]['include']?_[_0x9c6e('0x1e')](_0x4f89d0['options']['include'],function(_0x1e3404){return{'model':db[_0x1e3404[_0x9c6e('0x1f')]],'as':_0x1e3404['as'],'attributes':_0x1e3404[_0x9c6e('0x1c')],'include':_0x1e3404[_0x9c6e('0x20')]?_[_0x9c6e('0x1e')](_0x1e3404[_0x9c6e('0x20')],function(_0x58c818){return{'model':db[_0x58c818[_0x9c6e('0x1f')]],'as':_0x58c818['as'],'attributes':_0x58c818[_0x9c6e('0x1c')],'include':_0x58c818[_0x9c6e('0x20')]?_[_0x9c6e('0x1e')](_0x58c818[_0x9c6e('0x20')],function(_0x3001d4){return{'model':db[_0x3001d4[_0x9c6e('0x1f')]],'as':_0x3001d4['as'],'attributes':_0x3001d4[_0x9c6e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d7344){logger['info'](_0x9c6e('0x21'),_0x4f89d0);logger['debug']('GetSmsQueue',_0x4f89d0,JSON['stringify'](_0x3d7344));_0x6ca215(_0x3d7344);})[_0x9c6e('0x16')](function(_0x4848b2){logger[_0x9c6e('0x12')]('GetSmsQueue',_0x4848b2['message'],_0x4f89d0);_0x1f9263(_0x23222f[_0x9c6e('0x12')](0x1f4,_0x4848b2[_0x9c6e('0x14')]));});});};exports[_0x9c6e('0x22')]=function(_0x546e7a){var _0x2ed938=this;return new Promise(function(_0x3c5842,_0x39b4b5){return db[_0x9c6e('0x17')][_0x9c6e('0x23')]({'raw':_0x546e7a[_0x9c6e('0x19')]?_0x546e7a[_0x9c6e('0x19')][_0x9c6e('0x1a')]===undefined?!![]:![]:!![],'where':_0x546e7a[_0x9c6e('0x19')]?_0x546e7a[_0x9c6e('0x19')][_0x9c6e('0x1b')]||null:null,'attributes':_0x546e7a['options']?_0x546e7a[_0x9c6e('0x19')]['attributes']||null:null,'include':_0x546e7a[_0x9c6e('0x19')]?_0x546e7a[_0x9c6e('0x19')][_0x9c6e('0x20')]?_[_0x9c6e('0x1e')](_0x546e7a['options'][_0x9c6e('0x20')],function(_0x5d7c97){return{'model':db[_0x5d7c97[_0x9c6e('0x1f')]],'as':_0x5d7c97['as'],'attributes':_0x5d7c97[_0x9c6e('0x1c')],'include':_0x5d7c97[_0x9c6e('0x20')]?_[_0x9c6e('0x1e')](_0x5d7c97[_0x9c6e('0x20')],function(_0x127b1c){return{'model':db[_0x127b1c[_0x9c6e('0x1f')]],'as':_0x127b1c['as'],'attributes':_0x127b1c[_0x9c6e('0x1c')],'include':_0x127b1c['include']?_[_0x9c6e('0x1e')](_0x127b1c[_0x9c6e('0x20')],function(_0x322882){return{'model':db[_0x322882[_0x9c6e('0x1f')]],'as':_0x322882['as'],'attributes':_0x322882[_0x9c6e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9c6e('0xc')](function(_0x5de565){logger['info'](_0x9c6e('0x22'),_0x546e7a);logger['debug']('ShowSmsQueue',_0x546e7a,JSON[_0x9c6e('0x11')](_0x5de565));_0x3c5842(_0x5de565);})[_0x9c6e('0x16')](function(_0x2f7072){logger[_0x9c6e('0x12')](_0x9c6e('0x22'),_0x2f7072[_0x9c6e('0x14')],_0x546e7a);_0x39b4b5(_0x2ed938[_0x9c6e('0x12')](0x1f4,_0x2f7072[_0x9c6e('0x14')]));});});}; \ No newline at end of file +var _0x7465=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','SmsQueue','find','ShowSmsQueue'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x7465,0x148));var _0x5746=function(_0x119c85,_0x268175){_0x119c85=_0x119c85-0x0;var _0x41d288=_0x7465[_0x119c85];return _0x41d288;};'use strict';var _=require(_0x5746('0x0'));var util=require(_0x5746('0x1'));var moment=require('moment');var BPromise=require(_0x5746('0x2'));var rs=require(_0x5746('0x3'));var fs=require('fs');var Redis=require(_0x5746('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5746('0x5'));var logger=require(_0x5746('0x6'))('rpc');var config=require(_0x5746('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5746('0x8')][_0x5746('0x9')]({'port':0x232a});config[_0x5746('0xa')]=_[_0x5746('0xb')](config['redis'],{'host':_0x5746('0xc'),'port':0x18eb});var socket=require(_0x5746('0xd'))(new Redis(config[_0x5746('0xa')]));require(_0x5746('0xe'))[_0x5746('0xf')](socket);function respondWithRpcPromise(_0x5c4a5c,_0xdc88f1,_0x479b86){return new BPromise(function(_0x190ff7,_0x4cecbb){return client['request'](_0x5c4a5c,_0x479b86)[_0x5746('0x10')](function(_0x36d507){logger[_0x5746('0x11')](_0x5746('0x12'),_0xdc88f1,_0x5746('0x13'));logger[_0x5746('0x14')](_0x5746('0x15'),_0xdc88f1,'request\x20sent',JSON[_0x5746('0x16')](_0x36d507));if(_0x36d507[_0x5746('0x17')]){if(_0x36d507[_0x5746('0x17')][_0x5746('0x18')]===0x1f4){logger[_0x5746('0x17')](_0x5746('0x12'),_0xdc88f1,_0x36d507[_0x5746('0x17')][_0x5746('0x19')]);return _0x4cecbb(_0x36d507['error'][_0x5746('0x19')]);}logger['error'](_0x5746('0x12'),_0xdc88f1,_0x36d507['error'][_0x5746('0x19')]);return _0x190ff7(_0x36d507[_0x5746('0x17')][_0x5746('0x19')]);}else{logger[_0x5746('0x11')](_0x5746('0x12'),_0xdc88f1,_0x5746('0x13'));_0x190ff7(_0x36d507[_0x5746('0x1a')][_0x5746('0x19')]);}})[_0x5746('0x1b')](function(_0x4efa5b){logger[_0x5746('0x17')](_0x5746('0x12'),_0xdc88f1,_0x4efa5b);_0x4cecbb(_0x4efa5b);});});}exports[_0x5746('0x1c')]=function(_0x16b152){var _0x17663a=this;return new Promise(function(_0x58c9ea,_0xcc3ad3){return db['SmsQueue'][_0x5746('0x1d')]({'raw':_0x16b152['options']?_0x16b152[_0x5746('0x1e')][_0x5746('0x1f')]===undefined?!![]:![]:!![],'where':_0x16b152[_0x5746('0x1e')]?_0x16b152['options'][_0x5746('0x20')]||null:null,'attributes':_0x16b152[_0x5746('0x1e')]?_0x16b152[_0x5746('0x1e')]['attributes']||null:null,'limit':_0x16b152['options']?_0x16b152[_0x5746('0x1e')][_0x5746('0x21')]||null:null,'include':_0x16b152[_0x5746('0x1e')]?_0x16b152[_0x5746('0x1e')][_0x5746('0x22')]?_[_0x5746('0x23')](_0x16b152[_0x5746('0x1e')][_0x5746('0x22')],function(_0x2b72a6){return{'model':db[_0x2b72a6[_0x5746('0x24')]],'as':_0x2b72a6['as'],'attributes':_0x2b72a6[_0x5746('0x25')],'include':_0x2b72a6['include']?_[_0x5746('0x23')](_0x2b72a6['include'],function(_0x3da561){return{'model':db[_0x3da561['model']],'as':_0x3da561['as'],'attributes':_0x3da561[_0x5746('0x25')],'include':_0x3da561[_0x5746('0x22')]?_[_0x5746('0x23')](_0x3da561[_0x5746('0x22')],function(_0x24dcdb){return{'model':db[_0x24dcdb['model']],'as':_0x24dcdb['as'],'attributes':_0x24dcdb[_0x5746('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43937f){logger[_0x5746('0x11')](_0x5746('0x1c'),_0x16b152);logger[_0x5746('0x14')](_0x5746('0x1c'),_0x16b152,JSON[_0x5746('0x16')](_0x43937f));_0x58c9ea(_0x43937f);})[_0x5746('0x1b')](function(_0x41e5e1){logger[_0x5746('0x17')](_0x5746('0x1c'),_0x41e5e1[_0x5746('0x19')],_0x16b152);_0xcc3ad3(_0x17663a[_0x5746('0x17')](0x1f4,_0x41e5e1[_0x5746('0x19')]));});});};exports['ShowSmsQueue']=function(_0xdfd2ca){var _0x57f5e7=this;return new Promise(function(_0x63c047,_0x316f4e){return db[_0x5746('0x26')][_0x5746('0x27')]({'raw':_0xdfd2ca['options']?_0xdfd2ca[_0x5746('0x1e')][_0x5746('0x1f')]===undefined?!![]:![]:!![],'where':_0xdfd2ca[_0x5746('0x1e')]?_0xdfd2ca[_0x5746('0x1e')][_0x5746('0x20')]||null:null,'attributes':_0xdfd2ca[_0x5746('0x1e')]?_0xdfd2ca['options'][_0x5746('0x25')]||null:null,'include':_0xdfd2ca[_0x5746('0x1e')]?_0xdfd2ca['options']['include']?_[_0x5746('0x23')](_0xdfd2ca[_0x5746('0x1e')][_0x5746('0x22')],function(_0x3c8706){return{'model':db[_0x3c8706[_0x5746('0x24')]],'as':_0x3c8706['as'],'attributes':_0x3c8706[_0x5746('0x25')],'include':_0x3c8706[_0x5746('0x22')]?_['map'](_0x3c8706[_0x5746('0x22')],function(_0x4ecd3c){return{'model':db[_0x4ecd3c[_0x5746('0x24')]],'as':_0x4ecd3c['as'],'attributes':_0x4ecd3c[_0x5746('0x25')],'include':_0x4ecd3c[_0x5746('0x22')]?_['map'](_0x4ecd3c[_0x5746('0x22')],function(_0x3832ad){return{'model':db[_0x3832ad[_0x5746('0x24')]],'as':_0x3832ad['as'],'attributes':_0x3832ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x5746('0x10')](function(_0x6ba7db){logger[_0x5746('0x11')](_0x5746('0x28'),_0xdfd2ca);logger[_0x5746('0x14')](_0x5746('0x28'),_0xdfd2ca,JSON[_0x5746('0x16')](_0x6ba7db));_0x63c047(_0x6ba7db);})[_0x5746('0x1b')](function(_0x31a531){logger['error']('ShowSmsQueue',_0x31a531[_0x5746('0x19')],_0xdfd2ca);_0x316f4e(_0x57f5e7[_0x5746('0x17')](0x1f4,_0x31a531[_0x5746('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index f1749e6..e1cfe02 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 _0xf590=['emit','register','length','remove'];(function(_0x3a9cdc,_0x20f028){var _0x1ad79d=function(_0x5d76db){while(--_0x5d76db){_0x3a9cdc['push'](_0x3a9cdc['shift']());}};_0x1ad79d(++_0x20f028);}(_0xf590,0x14b));var _0x0f59=function(_0x1aa835,_0x23e8ac){_0x1aa835=_0x1aa835-0x0;var _0x5ad5c7=_0xf590[_0x1aa835];return _0x5ad5c7;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0x0f59('0x0'),'update'];function createListener(_0x1b0a02,_0x34a361){return function(_0x2639f7){_0x34a361[_0x0f59('0x1')](_0x1b0a02,_0x2639f7);};}function removeListener(_0x3e8b88,_0x4f3f9f){return function(){SmsQueueEvents['removeListener'](_0x3e8b88,_0x4f3f9f);};}exports[_0x0f59('0x2')]=function(_0xd29089){for(var _0xf73f1f=0x0,_0x312aaa=events[_0x0f59('0x3')];_0xf73f1f<_0x312aaa;_0xf73f1f++){var _0x149401=events[_0xf73f1f];var _0x2cbb86=createListener('smsQueue:'+_0x149401,_0xd29089);SmsQueueEvents['on'](_0x149401,_0x2cbb86);}}; \ No newline at end of file +var _0xba56=['smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','register'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xba56,0x79));var _0x6ba5=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xba56[_0x56916d];return _0x2b7f1f;};'use strict';var SmsQueueEvents=require(_0x6ba5('0x0'));var events=[_0x6ba5('0x1'),_0x6ba5('0x2'),_0x6ba5('0x3')];function createListener(_0x4a791a,_0x551cdb){return function(_0x4747ee){_0x551cdb[_0x6ba5('0x4')](_0x4a791a,_0x4747ee);};}function removeListener(_0x194e13,_0x359952){return function(){SmsQueueEvents[_0x6ba5('0x5')](_0x194e13,_0x359952);};}exports[_0x6ba5('0x6')]=function(_0x55aef1){for(var _0x4028e0=0x0,_0x592126=events['length'];_0x4028e0<_0x592126;_0x4028e0++){var _0xef4ac4=events[_0x4028e0];var _0x288769=createListener(_0x6ba5('0x7')+_0xef4ac4,_0x55aef1);SmsQueueEvents['on'](_0xef4ac4,_0x288769);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 8df1c23..90d8acf 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 _0xcf08=['isAuthenticated','index','/describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0x3ca027,_0x1efc3a){var _0x586745=function(_0xb676e1){while(--_0xb676e1){_0x3ca027['push'](_0x3ca027['shift']());}};_0x586745(++_0x1efc3a);}(_0xcf08,0xe6));var _0x8cf0=function(_0x4c4d26,_0x56bcf0){_0x4c4d26=_0x4c4d26-0x0;var _0x32ce49=_0xcf08[_0x4c4d26];return _0x32ce49;};'use strict';var multer=require(_0x8cf0('0x0'));var util=require(_0x8cf0('0x1'));var path=require(_0x8cf0('0x2'));var timeout=require(_0x8cf0('0x3'));var express=require(_0x8cf0('0x4'));var router=express[_0x8cf0('0x5')]();var auth=require(_0x8cf0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8cf0('0x7'));var controller=require(_0x8cf0('0x8'));router[_0x8cf0('0x9')]('/',auth[_0x8cf0('0xa')](),controller[_0x8cf0('0xb')]);router[_0x8cf0('0x9')](_0x8cf0('0xc'),auth[_0x8cf0('0xa')](),controller['describe']);router['get'](_0x8cf0('0xd'),auth[_0x8cf0('0xa')](),controller[_0x8cf0('0xe')]);router[_0x8cf0('0xf')]('/',auth[_0x8cf0('0xa')](),controller['create']);router['put'](_0x8cf0('0xd'),auth[_0x8cf0('0xa')](),controller[_0x8cf0('0x10')]);router[_0x8cf0('0x11')](_0x8cf0('0xd'),auth[_0x8cf0('0xa')](),controller[_0x8cf0('0x12')]);module[_0x8cf0('0x13')]=router; \ No newline at end of file +var _0x7a72=['put','update','delete','destroy','util','path','express','../../components/auth/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','post','create'];(function(_0x2381fc,_0x42e102){var _0x458d9f=function(_0x385221){while(--_0x385221){_0x2381fc['push'](_0x2381fc['shift']());}};_0x458d9f(++_0x42e102);}(_0x7a72,0x1be));var _0x27a7=function(_0x29a97c,_0x370826){_0x29a97c=_0x29a97c-0x0;var _0x2cbe06=_0x7a72[_0x29a97c];return _0x2cbe06;};'use strict';var multer=require('multer');var util=require(_0x27a7('0x0'));var path=require(_0x27a7('0x1'));var timeout=require('connect-timeout');var express=require(_0x27a7('0x2'));var router=express['Router']();var auth=require(_0x27a7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x27a7('0x4'));var controller=require('./smsQueueReport.controller');router[_0x27a7('0x5')]('/',auth['isAuthenticated'](),controller[_0x27a7('0x6')]);router[_0x27a7('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x27a7('0x7')]);router['get'](_0x27a7('0x8'),auth[_0x27a7('0x9')](),controller[_0x27a7('0xa')]);router[_0x27a7('0xb')]('/',auth['isAuthenticated'](),controller[_0x27a7('0xc')]);router[_0x27a7('0xd')](_0x27a7('0x8'),auth['isAuthenticated'](),controller[_0x27a7('0xe')]);router[_0x27a7('0xf')]('/:id',auth[_0x27a7('0x9')](),controller[_0x27a7('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index f61c60c..4c1bc61 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 _0x3e7f=['STRING','DATE','moment','exports'];(function(_0x15ad67,_0x3da0bb){var _0x1db054=function(_0x24b472){while(--_0x24b472){_0x15ad67['push'](_0x15ad67['shift']());}};_0x1db054(++_0x3da0bb);}(_0x3e7f,0x11e));var _0xf3e7=function(_0x3278fb,_0x46292a){_0x3278fb=_0x3278fb-0x0;var _0x50aced=_0x3e7f[_0x3278fb];return _0x50aced;};'use strict';var moment=require(_0xf3e7('0x0'));var Sequelize=require('sequelize');module[_0xf3e7('0x1')]={'uniqueid':{'type':Sequelize[_0xf3e7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf3e7('0x2')]},'joinAt':{'type':Sequelize[_0xf3e7('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf3e7('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf3e7('0x2')]}}; \ No newline at end of file +var _0x5a52=['STRING','DATE','sequelize','exports'];(function(_0x5d4c50,_0x532e42){var _0x33557a=function(_0x480286){while(--_0x480286){_0x5d4c50['push'](_0x5d4c50['shift']());}};_0x33557a(++_0x532e42);}(_0x5a52,0xae));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var moment=require('moment');var Sequelize=require(_0x25a5('0x0'));module[_0x25a5('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x25a5('0x2')]},'joinAt':{'type':Sequelize[_0x25a5('0x3')]},'leaveAt':{'type':Sequelize[_0x25a5('0x3')]},'acceptAt':{'type':Sequelize[_0x25a5('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index bebc5fd..9792d55 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 _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(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'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 +var _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','SmsQueueReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x7126b4,_0x5240df){var _0x43af7a=function(_0x5171a2){while(--_0x5171a2){_0x7126b4['push'](_0x7126b4['shift']());}};_0x43af7a(++_0x5240df);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['SmsQueueReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]),_0x132a42);if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 54d2755..9fa1045 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 _0xa47e=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','SmsQueueReport','report_sms_queue'];(function(_0x4b26b5,_0x4f71fd){var _0x4dec71=function(_0x184329){while(--_0x184329){_0x4b26b5['push'](_0x4b26b5['shift']());}};_0x4dec71(++_0x4f71fd);}(_0xa47e,0x90));var _0xea47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa47e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea47('0x0'));var util=require(_0xea47('0x1'));var logger=require(_0xea47('0x2'))(_0xea47('0x3'));var moment=require(_0xea47('0x4'));var BPromise=require(_0xea47('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea47('0x6'));var rimraf=require(_0xea47('0x7'));var config=require(_0xea47('0x8'));var attributes=require(_0xea47('0x9'));module['exports']=function(_0x37fad1,_0x49dec3){return _0x37fad1['define'](_0xea47('0xa'),attributes,{'tableName':_0xea47('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xea47('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1650=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsQueueReport','report_sms_queue','uniqueid','lodash'];(function(_0x45e9d4,_0x396832){var _0x15de55=function(_0xaff54a){while(--_0xaff54a){_0x45e9d4['push'](_0x45e9d4['shift']());}};_0x15de55(++_0x396832);}(_0x1650,0xdc));var _0x0165=function(_0x538a20,_0x5c14d6){_0x538a20=_0x538a20-0x0;var _0xec72f5=_0x1650[_0x538a20];return _0xec72f5;};'use strict';var _=require(_0x0165('0x0'));var util=require(_0x0165('0x1'));var logger=require(_0x0165('0x2'))('api');var moment=require(_0x0165('0x3'));var BPromise=require(_0x0165('0x4'));var rp=require(_0x0165('0x5'));var fs=require('fs');var path=require(_0x0165('0x6'));var rimraf=require(_0x0165('0x7'));var config=require(_0x0165('0x8'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x1e0a28,_0x4e407c){return _0x1e0a28[_0x0165('0x9')](_0x0165('0xa'),attributes,{'tableName':_0x0165('0xb'),'paranoid':![],'indexes':[{'name':_0x0165('0xc'),'fields':[_0x0165('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 07a0188..d6c4fd1 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 _0x4acb=['SmsQueueReport','raw','UpdateSmsQueueReport','update','body','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','request\x20sent','result','catch','CreateSmsQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4acb,0x99));var _0xb4ac=function(_0x4c8c19,_0x15d473){_0x4c8c19=_0x4c8c19-0x0;var _0x32c443=_0x4acb[_0x4c8c19];return _0x32c443;};'use strict';var _=require(_0xb4ac('0x0'));var util=require(_0xb4ac('0x1'));var moment=require(_0xb4ac('0x2'));var BPromise=require(_0xb4ac('0x3'));var rs=require(_0xb4ac('0x4'));var fs=require('fs');var Redis=require(_0xb4ac('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4ac('0x6'));var logger=require(_0xb4ac('0x7'))(_0xb4ac('0x8'));var config=require(_0xb4ac('0x9'));var jayson=require(_0xb4ac('0xa'));var client=jayson[_0xb4ac('0xb')][_0xb4ac('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52e4f7,_0x1530a8,_0x18fd27){return new BPromise(function(_0x435b1b,_0x4f3784){return client[_0xb4ac('0xd')](_0x52e4f7,_0x18fd27)[_0xb4ac('0xe')](function(_0x549155){logger[_0xb4ac('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x1530a8,'request\x20sent');logger[_0xb4ac('0x10')](_0xb4ac('0x11'),_0x1530a8,'request\x20sent',JSON[_0xb4ac('0x12')](_0x549155));if(_0x549155[_0xb4ac('0x13')]){if(_0x549155['error'][_0xb4ac('0x14')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x1530a8,_0x549155[_0xb4ac('0x13')][_0xb4ac('0x15')]);return _0x4f3784(_0x549155[_0xb4ac('0x13')]['message']);}logger[_0xb4ac('0x13')](_0xb4ac('0x16'),_0x1530a8,_0x549155[_0xb4ac('0x13')][_0xb4ac('0x15')]);return _0x435b1b(_0x549155['error'][_0xb4ac('0x15')]);}else{logger[_0xb4ac('0xf')](_0xb4ac('0x16'),_0x1530a8,_0xb4ac('0x17'));_0x435b1b(_0x549155[_0xb4ac('0x18')]['message']);}})[_0xb4ac('0x19')](function(_0x38ced3){logger[_0xb4ac('0x13')](_0xb4ac('0x16'),_0x1530a8,_0x38ced3);_0x4f3784(_0x38ced3);});});}exports[_0xb4ac('0x1a')]=function(_0x33e179){var _0x17684c=this;return new Promise(function(_0x294ff6,_0x5427a1){return db[_0xb4ac('0x1b')]['create'](_0x33e179['body'],{'raw':_0x33e179['options']?_0x33e179['options'][_0xb4ac('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4e6e3a){logger[_0xb4ac('0xf')](_0xb4ac('0x1a'),_0x33e179);logger[_0xb4ac('0x10')](_0xb4ac('0x1a'),_0x33e179,JSON[_0xb4ac('0x12')](_0x4e6e3a));_0x294ff6(_0x4e6e3a);})[_0xb4ac('0x19')](function(_0xefaa){logger[_0xb4ac('0x13')](_0xb4ac('0x1a'),_0xefaa[_0xb4ac('0x15')],_0x33e179);_0x5427a1(_0x17684c[_0xb4ac('0x13')](0x1f4,_0xefaa['message']));});});};exports[_0xb4ac('0x1d')]=function(_0x54a21f){var _0x570925=this;return new Promise(function(_0xf032e0,_0x161ab7){return db[_0xb4ac('0x1b')][_0xb4ac('0x1e')](_0x54a21f[_0xb4ac('0x1f')],{'raw':_0x54a21f[_0xb4ac('0x20')]?_0x54a21f['options'][_0xb4ac('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54a21f[_0xb4ac('0x20')]?_0x54a21f[_0xb4ac('0x20')][_0xb4ac('0x21')]||null:null,'attributes':_0x54a21f[_0xb4ac('0x20')]?_0x54a21f[_0xb4ac('0x20')][_0xb4ac('0x22')]||null:null,'limit':_0x54a21f[_0xb4ac('0x20')]?_0x54a21f[_0xb4ac('0x20')][_0xb4ac('0x23')]||null:null})[_0xb4ac('0xe')](function(_0x18da04){logger[_0xb4ac('0xf')](_0xb4ac('0x1d'),_0x54a21f);logger[_0xb4ac('0x10')]('UpdateSmsQueueReport',_0x54a21f,JSON[_0xb4ac('0x12')](_0x18da04));_0xf032e0(_0x18da04);})[_0xb4ac('0x19')](function(_0x523580){logger[_0xb4ac('0x13')]('UpdateSmsQueueReport',_0x523580[_0xb4ac('0x15')],_0x54a21f);_0x161ab7(_0x570925['error'](0x1f4,_0x523580[_0xb4ac('0x15')]));});});}; \ No newline at end of file +var _0x8ca6=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','UpdateSmsQueueReport','update','where','attributes','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','SmsQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x8ca6,0x199));var _0x68ca=function(_0x390925,_0x42cab0){_0x390925=_0x390925-0x0;var _0x47735b=_0x8ca6[_0x390925];return _0x47735b;};'use strict';var _=require(_0x68ca('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x68ca('0x1'));var rs=require(_0x68ca('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68ca('0x3'))['db'];var utils=require(_0x68ca('0x4'));var logger=require(_0x68ca('0x5'))(_0x68ca('0x6'));var config=require('../../config/environment');var jayson=require(_0x68ca('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3cb798,_0xa95e07,_0xe8af43){return new BPromise(function(_0x5d9779,_0x8c91c3){return client[_0x68ca('0x8')](_0x3cb798,_0xe8af43)['then'](function(_0x56f11d){logger['info'](_0x68ca('0x9'),_0xa95e07,_0x68ca('0xa'));logger[_0x68ca('0xb')](_0x68ca('0xc'),_0xa95e07,_0x68ca('0xa'),JSON['stringify'](_0x56f11d));if(_0x56f11d['error']){if(_0x56f11d['error']['code']===0x1f4){logger[_0x68ca('0xd')](_0x68ca('0x9'),_0xa95e07,_0x56f11d[_0x68ca('0xd')][_0x68ca('0xe')]);return _0x8c91c3(_0x56f11d[_0x68ca('0xd')][_0x68ca('0xe')]);}logger[_0x68ca('0xd')](_0x68ca('0x9'),_0xa95e07,_0x56f11d[_0x68ca('0xd')][_0x68ca('0xe')]);return _0x5d9779(_0x56f11d['error'][_0x68ca('0xe')]);}else{logger[_0x68ca('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0xa95e07,_0x68ca('0xa'));_0x5d9779(_0x56f11d['result']['message']);}})[_0x68ca('0x10')](function(_0x1657bb){logger['error'](_0x68ca('0x9'),_0xa95e07,_0x1657bb);_0x8c91c3(_0x1657bb);});});}exports[_0x68ca('0x11')]=function(_0x47f09a){var _0x20d759=this;return new Promise(function(_0x54628f,_0x29baa4){return db[_0x68ca('0x12')]['create'](_0x47f09a[_0x68ca('0x13')],{'raw':_0x47f09a[_0x68ca('0x14')]?_0x47f09a['options'][_0x68ca('0x15')]===undefined?!![]:![]:!![]})[_0x68ca('0x16')](function(_0x5ed59d){logger['info'](_0x68ca('0x11'),_0x47f09a);logger['debug'](_0x68ca('0x11'),_0x47f09a,JSON['stringify'](_0x5ed59d));_0x54628f(_0x5ed59d);})[_0x68ca('0x10')](function(_0x5e8192){logger[_0x68ca('0xd')]('CreateSmsQueueReport',_0x5e8192['message'],_0x47f09a);_0x29baa4(_0x20d759['error'](0x1f4,_0x5e8192[_0x68ca('0xe')]));});});};exports[_0x68ca('0x17')]=function(_0x4ebe22){var _0x144c7c=this;return new Promise(function(_0x2d7e5b,_0x5e352b){return db['SmsQueueReport'][_0x68ca('0x18')](_0x4ebe22[_0x68ca('0x13')],{'raw':_0x4ebe22[_0x68ca('0x14')]?_0x4ebe22[_0x68ca('0x14')][_0x68ca('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ebe22[_0x68ca('0x14')]?_0x4ebe22['options'][_0x68ca('0x19')]||null:null,'attributes':_0x4ebe22['options']?_0x4ebe22[_0x68ca('0x14')][_0x68ca('0x1a')]||null:null,'limit':_0x4ebe22[_0x68ca('0x14')]?_0x4ebe22[_0x68ca('0x14')]['limit']||null:null})[_0x68ca('0x16')](function(_0x180368){logger[_0x68ca('0xf')](_0x68ca('0x17'),_0x4ebe22);logger[_0x68ca('0xb')](_0x68ca('0x17'),_0x4ebe22,JSON[_0x68ca('0x1b')](_0x180368));_0x2d7e5b(_0x180368);})[_0x68ca('0x10')](function(_0x1726c6){logger[_0x68ca('0xd')](_0x68ca('0x17'),_0x1726c6[_0x68ca('0xe')],_0x4ebe22);_0x5e352b(_0x144c7c['error'](0x1f4,_0x1726c6[_0x68ca('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 41f2ab7..dda8f9e 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 _0x2032=['describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3600af,_0x1cf875){var _0x11845d=function(_0x57d7a){while(--_0x57d7a){_0x3600af['push'](_0x3600af['shift']());}};_0x11845d(++_0x1cf875);}(_0x2032,0xd9));var _0x2203=function(_0x224e2a,_0x1c4d32){_0x224e2a=_0x224e2a-0x0;var _0x29bd78=_0x2032[_0x224e2a];return _0x29bd78;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file +var _0xa74f=['post','create','delete','destroy','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x6a4fe7,_0x40a337){var _0x5e467d=function(_0x24eb0b){while(--_0x24eb0b){_0x6a4fe7['push'](_0x6a4fe7['shift']());}};_0x5e467d(++_0x40a337);}(_0xa74f,0x9a));var _0xfa74=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0xa74f[_0x594e11];return _0x5418ad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var auth=require(_0xfa74('0x2'));var interaction=require(_0xfa74('0x3'));var config=require(_0xfa74('0x4'));var controller=require('./smsTransferReport.controller');router[_0xfa74('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfa74('0x5')](_0xfa74('0x6'),auth[_0xfa74('0x7')](),controller[_0xfa74('0x8')]);router[_0xfa74('0x5')](_0xfa74('0x9'),auth['isAuthenticated'](),controller[_0xfa74('0xa')]);router[_0xfa74('0xb')]('/',auth[_0xfa74('0x7')](),controller[_0xfa74('0xc')]);router['put'](_0xfa74('0x9'),auth[_0xfa74('0x7')](),controller['update']);router[_0xfa74('0xd')](_0xfa74('0x9'),auth[_0xfa74('0x7')](),controller[_0xfa74('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 984048f..330e2a7 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 _0x2dd5=['queue','moment','sequelize','STRING','ENUM','account'];(function(_0x492739,_0x4d7d80){var _0x4b668c=function(_0x1136af){while(--_0x1136af){_0x492739['push'](_0x492739['shift']());}};_0x4b668c(++_0x4d7d80);}(_0x2dd5,0x1db));var _0x52dd=function(_0x2b2c7d,_0x52cee6){_0x2b2c7d=_0x2b2c7d-0x0;var _0x3bd7a7=_0x2dd5[_0x2b2c7d];return _0x3bd7a7;};'use strict';var moment=require(_0x52dd('0x0'));var Sequelize=require(_0x52dd('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x52dd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x52dd('0x3')](_0x52dd('0x4'),'agent',_0x52dd('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xffea=['moment','sequelize','exports','STRING','account','agent','queue','DATE','NOW'];(function(_0xe5a862,_0x5b7f20){var _0x313545=function(_0x5985cf){while(--_0x5985cf){_0xe5a862['push'](_0xe5a862['shift']());}};_0x313545(++_0x5b7f20);}(_0xffea,0x18c));var _0xaffe=function(_0x1e9b50,_0x44f9b3){_0x1e9b50=_0x1e9b50-0x0;var _0x5aa5c8=_0xffea[_0x1e9b50];return _0x5aa5c8;};'use strict';var moment=require(_0xaffe('0x0'));var Sequelize=require(_0xaffe('0x1'));module[_0xaffe('0x2')]={'uniqueid':{'type':Sequelize[_0xaffe('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xaffe('0x4'),_0xaffe('0x5'),_0xaffe('0x6')),'allowNull':![],'defaultValue':_0xaffe('0x6')},'transferredAt':{'type':Sequelize[_0xaffe('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xaffe('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 0c63e62..3ab007a 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(_0x2702c5,_0x121a91){var _0x400d27=function(_0xbb9c22){while(--_0xbb9c22){_0x2702c5['push'](_0x2702c5['shift']());}};_0x400d27(++_0x121a91);}(_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 _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','SmsTransferReport','include','findAll','rows','params','includeAll','options','find'];(function(_0x137132,_0x47e564){var _0x1ea26c=function(_0x4bf289){while(--_0x4bf289){_0x137132['push'](_0x137132['shift']());}};_0x1ea26c(++_0x47e564);}(_0xe706,0xa3));var _0x6e70=function(_0x53b93b,_0x1bfab1){_0x53b93b=_0x53b93b-0x0;var _0x485761=_0xe706[_0x53b93b];return _0x485761;};'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['SmsTransferReport'][_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/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 529bc43..adfb84e 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 _0x53e1=['rimraf','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','request-promise','path'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x53e1,0x16f));var _0x153e=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x53e1[_0x9df3d8];return _0x366da1;};'use strict';var _=require(_0x153e('0x0'));var util=require('util');var logger=require(_0x153e('0x1'))(_0x153e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x153e('0x3'));var fs=require('fs');var path=require(_0x153e('0x4'));var rimraf=require(_0x153e('0x5'));var config=require(_0x153e('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x153e('0x7')]=function(_0x1b9f85,_0x1c4ddc){return _0x1b9f85[_0x153e('0x8')](_0x153e('0x9'),attributes,{'tableName':_0x153e('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x153e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe755=['define','SmsTransferReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x230d90,_0x2e96de){var _0x13487c=function(_0x44ff30){while(--_0x44ff30){_0x230d90['push'](_0x230d90['shift']());}};_0x13487c(++_0x2e96de);}(_0xe755,0xe7));var _0x5e75=function(_0x3b2d98,_0xaa0b26){_0x3b2d98=_0x3b2d98-0x0;var _0x256bf1=_0xe755[_0x3b2d98];return _0x256bf1;};'use strict';var _=require(_0x5e75('0x0'));var util=require('util');var logger=require(_0x5e75('0x1'))('api');var moment=require(_0x5e75('0x2'));var BPromise=require(_0x5e75('0x3'));var rp=require(_0x5e75('0x4'));var fs=require('fs');var path=require(_0x5e75('0x5'));var rimraf=require(_0x5e75('0x6'));var config=require(_0x5e75('0x7'));var attributes=require('./smsTransferReport.attributes');module[_0x5e75('0x8')]=function(_0x116b0d,_0x5d6247){return _0x116b0d[_0x5e75('0x9')](_0x5e75('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x5e75('0xb'),'fields':[_0x5e75('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 5c7f1ab..971b21c 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 _0xd6b4=['SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1564a7,_0x3159ff){var _0x247eee=function(_0x51899c){while(--_0x51899c){_0x1564a7['push'](_0x1564a7['shift']());}};_0x247eee(++_0x3159ff);}(_0xd6b4,0x72));var _0x4d6b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd6b4[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x4d6b('0x0'));var util=require(_0x4d6b('0x1'));var moment=require(_0x4d6b('0x2'));var BPromise=require(_0x4d6b('0x3'));var rs=require(_0x4d6b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d6b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4d6b('0x6'));var config=require(_0x4d6b('0x7'));var jayson=require(_0x4d6b('0x8'));var client=jayson[_0x4d6b('0x9')][_0x4d6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d61bb,_0x261a9a,_0x307347){return new BPromise(function(_0x2607b7,_0x84c358){return client[_0x4d6b('0xb')](_0x1d61bb,_0x307347)['then'](function(_0x2d0ae4){logger[_0x4d6b('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x261a9a,_0x4d6b('0xd'));logger[_0x4d6b('0xe')](_0x4d6b('0xf'),_0x261a9a,_0x4d6b('0xd'),JSON['stringify'](_0x2d0ae4));if(_0x2d0ae4[_0x4d6b('0x10')]){if(_0x2d0ae4[_0x4d6b('0x10')][_0x4d6b('0x11')]===0x1f4){logger[_0x4d6b('0x10')](_0x4d6b('0x12'),_0x261a9a,_0x2d0ae4['error'][_0x4d6b('0x13')]);return _0x84c358(_0x2d0ae4['error'][_0x4d6b('0x13')]);}logger[_0x4d6b('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x261a9a,_0x2d0ae4['error'][_0x4d6b('0x13')]);return _0x2607b7(_0x2d0ae4[_0x4d6b('0x10')]['message']);}else{logger[_0x4d6b('0xc')](_0x4d6b('0x12'),_0x261a9a,_0x4d6b('0xd'));_0x2607b7(_0x2d0ae4[_0x4d6b('0x14')][_0x4d6b('0x13')]);}})[_0x4d6b('0x15')](function(_0x257ead){logger[_0x4d6b('0x10')](_0x4d6b('0x12'),_0x261a9a,_0x257ead);_0x84c358(_0x257ead);});});} \ No newline at end of file +var _0xaeb0=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x33d159,_0x433b98){var _0x2ebbb2=function(_0x377e52){while(--_0x377e52){_0x33d159['push'](_0x33d159['shift']());}};_0x2ebbb2(++_0x433b98);}(_0xaeb0,0x152));var _0x0aeb=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xaeb0[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0x0aeb('0x0'));var moment=require(_0x0aeb('0x1'));var BPromise=require(_0x0aeb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0aeb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0aeb('0x4'));var logger=require(_0x0aeb('0x5'))(_0x0aeb('0x6'));var config=require(_0x0aeb('0x7'));var jayson=require(_0x0aeb('0x8'));var client=jayson[_0x0aeb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30ed79,_0x54df15,_0x4410f9){return new BPromise(function(_0x24be3f,_0x38444b){return client[_0x0aeb('0xa')](_0x30ed79,_0x4410f9)[_0x0aeb('0xb')](function(_0x519ed9){logger[_0x0aeb('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x54df15,_0x0aeb('0xd'));logger[_0x0aeb('0xe')](_0x0aeb('0xf'),_0x54df15,_0x0aeb('0xd'),JSON[_0x0aeb('0x10')](_0x519ed9));if(_0x519ed9[_0x0aeb('0x11')]){if(_0x519ed9[_0x0aeb('0x11')][_0x0aeb('0x12')]===0x1f4){logger[_0x0aeb('0x11')](_0x0aeb('0x13'),_0x54df15,_0x519ed9['error'][_0x0aeb('0x14')]);return _0x38444b(_0x519ed9[_0x0aeb('0x11')][_0x0aeb('0x14')]);}logger[_0x0aeb('0x11')](_0x0aeb('0x13'),_0x54df15,_0x519ed9[_0x0aeb('0x11')]['message']);return _0x24be3f(_0x519ed9['error'][_0x0aeb('0x14')]);}else{logger[_0x0aeb('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x54df15,_0x0aeb('0xd'));_0x24be3f(_0x519ed9[_0x0aeb('0x15')][_0x0aeb('0x14')]);}})[_0x0aeb('0x16')](function(_0x4082bb){logger['error'](_0x0aeb('0x13'),_0x54df15,_0x4082bb);_0x38444b(_0x4082bb);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 2ddbd9b..feeabae 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 _0x095a=['./sound.controller','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x92724b,_0x18e7d6){var _0x12e4f5=function(_0x406734){while(--_0x406734){_0x92724b['push'](_0x92724b['shift']());}};_0x12e4f5(++_0x18e7d6);}(_0x095a,0x119));var _0xa095=function(_0x10f7a8,_0x21c281){_0x10f7a8=_0x10f7a8-0x0;var _0x2102a0=_0x095a[_0x10f7a8];return _0x2102a0;};'use strict';var multer=require(_0xa095('0x0'));var util=require(_0xa095('0x1'));var path=require(_0xa095('0x2'));var timeout=require(_0xa095('0x3'));var express=require(_0xa095('0x4'));var router=express[_0xa095('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa095('0x6'));var controller=require(_0xa095('0x7'));router[_0xa095('0x8')]('/',auth[_0xa095('0x9')](),controller['index']);router[_0xa095('0x8')](_0xa095('0xa'),auth[_0xa095('0x9')](),controller[_0xa095('0xb')]);router[_0xa095('0x8')](_0xa095('0xc'),auth[_0xa095('0x9')](),controller[_0xa095('0xd')]);var upload=multer({'storage':multer[_0xa095('0xe')]({'destination':function(_0x458059,_0x46bd92,_0x2a2173){_0x2a2173(null,path[_0xa095('0xf')](config[_0xa095('0x10')],'server/files/sounds/original/'));},'filename':function(_0x2d56ef,_0x4cf77b,_0x508d46){_0x4cf77b[_0xa095('0x11')]=_0x4cf77b['originalname'][_0xa095('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x508d46(null,util[_0xa095('0x13')](_0xa095('0x14'),path[_0xa095('0x15')](_0x4cf77b['originalname'],path[_0xa095('0x16')](_0x4cf77b['originalname'])),Date[_0xa095('0x17')](),path[_0xa095('0x16')](_0x4cf77b['originalname'])));}})});router[_0xa095('0x18')]('/',upload[_0xa095('0x19')](_0xa095('0x1a')),controller[_0xa095('0x1b')]);router[_0xa095('0x1c')](_0xa095('0xa'),auth['isAuthenticated'](),controller[_0xa095('0x1d')]);router[_0xa095('0x1e')]('/:id',auth[_0xa095('0x9')](),controller[_0xa095('0x1e')]);module[_0xa095('0x1f')]=router; \ No newline at end of file +var _0x27a4=['show','/:id/download','isAuthenticated','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','post','single','file','put','update','delete','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','/:id'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x27a4,0xd8));var _0x427a=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x27a4[_0x1cc8fe];return _0x230054;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x427a('0x0'));var express=require(_0x427a('0x1'));var router=express['Router']();var auth=require(_0x427a('0x2'));var interaction=require(_0x427a('0x3'));var config=require('../../config/environment');var controller=require(_0x427a('0x4'));router[_0x427a('0x5')]('/',auth['isAuthenticated'](),controller[_0x427a('0x6')]);router[_0x427a('0x5')](_0x427a('0x7'),auth['isAuthenticated'](),controller[_0x427a('0x8')]);router[_0x427a('0x5')](_0x427a('0x9'),auth[_0x427a('0xa')](),controller[_0x427a('0xb')]);var upload=multer({'storage':multer[_0x427a('0xc')]({'destination':function(_0x54ac66,_0x10c90a,_0x1469de){_0x1469de(null,path[_0x427a('0xd')](config[_0x427a('0xe')],_0x427a('0xf')));},'filename':function(_0x389a17,_0xe6a21e,_0x338d5f){_0xe6a21e[_0x427a('0x10')]=_0xe6a21e['originalname'][_0x427a('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x338d5f(null,util[_0x427a('0x12')]('%s-%s%s',path[_0x427a('0x13')](_0xe6a21e[_0x427a('0x10')],path[_0x427a('0x14')](_0xe6a21e['originalname'])),Date['now'](),path[_0x427a('0x14')](_0xe6a21e['originalname'])));}})});router[_0x427a('0x15')]('/',upload[_0x427a('0x16')](_0x427a('0x17')),controller['create']);router[_0x427a('0x18')]('/:id',auth[_0x427a('0xa')](),controller[_0x427a('0x19')]);router['delete'](_0x427a('0x7'),auth[_0x427a('0xa')](),controller[_0x427a('0x1a')]);module[_0x427a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 40d5564..0bd47fe 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 _0xbc3c=['sequelize','exports','name','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x296d85,_0x2a3cec){var _0x56e54e=function(_0x3dd54a){while(--_0x3dd54a){_0x296d85['push'](_0x296d85['shift']());}};_0x56e54e(++_0x2a3cec);}(_0xbc3c,0xd2));var _0xcbc3=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xbc3c[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require(_0xcbc3('0x0'));module[_0xcbc3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcbc3('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xcbc3('0x3')]},'display_name':{'type':Sequelize[_0xcbc3('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xcbc3('0x3')]},'original_duration':{'type':Sequelize[_0xcbc3('0x4')]},'original_sampleCount':{'type':Sequelize[_0xcbc3('0x5')]},'original_channelCount':{'type':Sequelize[_0xcbc3('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xcbc3('0x6')]},'converted_format':{'type':Sequelize[_0xcbc3('0x3')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xcbc3('0x5')]},'converted_channelCount':{'type':Sequelize[_0xcbc3('0x6')]},'converted_bitRate':{'type':Sequelize[_0xcbc3('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xcbc3('0x6')]}}; \ No newline at end of file +var _0x2189=['BIGINT','INTEGER','exports','STRING','name','FLOAT'];(function(_0x25f583,_0x5b00b8){var _0x1fab64=function(_0x9dcf23){while(--_0x9dcf23){_0x25f583['push'](_0x25f583['shift']());}};_0x1fab64(++_0x5b00b8);}(_0x2189,0x12e));var _0x9218=function(_0x2a9093,_0x1c447d){_0x2a9093=_0x2a9093-0x0;var _0x291b9e=_0x2189[_0x2a9093];return _0x291b9e;};'use strict';var Sequelize=require('sequelize');module[_0x9218('0x0')]={'name':{'type':Sequelize[_0x9218('0x1')],'unique':_0x9218('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9218('0x1')]},'display_name':{'type':Sequelize[_0x9218('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x9218('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x9218('0x3')]},'original_sampleCount':{'type':Sequelize[_0x9218('0x4')]},'original_channelCount':{'type':Sequelize[_0x9218('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x9218('0x4')]},'converted_channelCount':{'type':Sequelize[_0x9218('0x5')]},'converted_bitRate':{'type':Sequelize[_0x9218('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x9218('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 6c6ec2c..bf87848 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 _0x38d9=['path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','Sound','includeAll','include','rows','catch','show','rawAttributes','download','find','params','save_name','converted_format','join','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','wav','unlinkSync','src','original_duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_channelCount','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x40c51a,_0x2fdc07){var _0x4f9782=function(_0x3963f1){while(--_0x3963f1){_0x40c51a['push'](_0x40c51a['shift']());}};_0x4f9782(++_0x2fdc07);}(_0x38d9,0x167));var _0x938d=function(_0x2af541,_0x334192){_0x2af541=_0x2af541-0x0;var _0x27c609=_0x38d9[_0x2af541];return _0x27c609;};'use strict';var pdf=require(_0x938d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x938d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x938d('0x2'));var moment=require(_0x938d('0x3'));var BPromise=require(_0x938d('0x4'));var Mustache=require(_0x938d('0x5'));var util=require(_0x938d('0x6'));var path=require(_0x938d('0x7'));var sox=require('sox');var csv=require(_0x938d('0x8'));var ejs=require(_0x938d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x938d('0xa'));var crypto=require(_0x938d('0xb'));var jsforce=require(_0x938d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x938d('0xd'));var Papa=require('papaparse');var Redis=require(_0x938d('0xe'));var authService=require(_0x938d('0xf'));var qs=require(_0x938d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x938d('0x11'));var logger=require(_0x938d('0x12'))(_0x938d('0x13'));var utils=require(_0x938d('0x14'));var config=require(_0x938d('0x15'));var db=require(_0x938d('0x16'))['db'];function respondWithStatusCode(_0x3d797d,_0x37422a){_0x37422a=_0x37422a||0xcc;return function(_0x29e7ac){if(_0x29e7ac){return _0x3d797d[_0x938d('0x17')](_0x37422a);}return _0x3d797d[_0x938d('0x18')](_0x37422a)['end']();};}function respondWithResult(_0x2ea19b,_0x292fb3){_0x292fb3=_0x292fb3||0xc8;return function(_0x3b6a9b){if(_0x3b6a9b){return _0x2ea19b[_0x938d('0x18')](_0x292fb3)[_0x938d('0x19')](_0x3b6a9b);}};}function respondWithFilteredResult(_0xbb35fd,_0x5d0b0a){return function(_0x3e978f){if(_0x3e978f){var _0x1ba058=_0x3e978f[_0x938d('0x1a')],_0x46eb9f=_0x5d0b0a[_0x938d('0x1b')],_0x484ebc=_0x5d0b0a['offset']+_0x5d0b0a[_0x938d('0x1c')],_0x2f677e;if(_0x484ebc>=_0x1ba058){_0x484ebc=_0x1ba058;_0x2f677e=0xc8;}else{_0x2f677e=0xce;}_0xbb35fd[_0x938d('0x18')](_0x2f677e);return _0xbb35fd['set'](_0x938d('0x1d'),_0x46eb9f+'-'+_0x484ebc+'/'+_0x1ba058)[_0x938d('0x19')](_0x3e978f);}return null;};}function patchUpdates(_0x1d90dc){return function(_0x153b89){try{jsonpatch['apply'](_0x153b89,_0x1d90dc,!![]);}catch(_0x2220e8){return BPromise['reject'](_0x2220e8);}return _0x153b89[_0x938d('0x1e')]();};}function saveUpdates(_0x29241f,_0x2108d4){return function(_0x470fda){if(_0x470fda){return _0x470fda[_0x938d('0x1f')](_0x29241f)[_0x938d('0x20')](function(_0x538fa2){return _0x538fa2;});}return null;};}function removeEntity(_0x3126bd,_0x212675){return function(_0x169558){if(_0x169558){return _0x169558[_0x938d('0x21')]()['then'](function(){var _0xbfc208=_0x169558[_0x938d('0x22')]({'plain':!![]});var _0x319579='Sounds';return db[_0x938d('0x23')][_0x938d('0x21')]({'where':{'type':_0x319579,'resourceId':_0xbfc208['id']}})[_0x938d('0x20')](function(){return _0x169558;});})[_0x938d('0x20')](function(){_0x3126bd[_0x938d('0x18')](0xcc)[_0x938d('0x24')]();});}};}function handleEntityNotFound(_0x1ddf5a,_0x41fd5b){return function(_0x417da3){if(!_0x417da3){_0x1ddf5a[_0x938d('0x17')](0x194);}return _0x417da3;};}function handleError(_0x278182,_0x163637){_0x163637=_0x163637||0x1f4;return function(_0x3301d3){logger[_0x938d('0x25')](_0x3301d3[_0x938d('0x26')]);if(_0x3301d3[_0x938d('0x27')]){delete _0x3301d3[_0x938d('0x27')];}_0x278182[_0x938d('0x18')](_0x163637)[_0x938d('0x28')](_0x3301d3);};}exports['index']=function(_0x30768f,_0x35d47b){var _0x3f3786={},_0x535358={},_0x21fa95={'count':0x0,'rows':[]};var _0x2c3977=_['map'](db['Sound']['rawAttributes'],function(_0x159cce){return{'name':_0x159cce[_0x938d('0x29')],'type':_0x159cce[_0x938d('0x2a')][_0x938d('0x2b')]};});_0x535358[_0x938d('0x2c')]=_[_0x938d('0x2d')](_0x2c3977,'name');_0x535358[_0x938d('0x2e')]=_[_0x938d('0x2f')](_0x30768f['query']);_0x535358['filters']=_[_0x938d('0x30')](_0x535358[_0x938d('0x2c')],_0x535358[_0x938d('0x2e')]);_0x3f3786[_0x938d('0x31')]=_[_0x938d('0x30')](_0x535358[_0x938d('0x2c')],qs[_0x938d('0x32')](_0x30768f[_0x938d('0x2e')][_0x938d('0x32')]));_0x3f3786['attributes']=_0x3f3786[_0x938d('0x31')][_0x938d('0x33')]?_0x3f3786['attributes']:_0x535358[_0x938d('0x2c')];if(!_0x30768f[_0x938d('0x2e')][_0x938d('0x34')](_0x938d('0x35'))){_0x3f3786[_0x938d('0x1c')]=qs[_0x938d('0x1c')](_0x30768f[_0x938d('0x2e')][_0x938d('0x1c')]);_0x3f3786[_0x938d('0x1b')]=qs[_0x938d('0x1b')](_0x30768f['query'][_0x938d('0x1b')]);}_0x3f3786[_0x938d('0x36')]=qs[_0x938d('0x37')](_0x30768f['query'][_0x938d('0x37')]);_0x3f3786[_0x938d('0x38')]=qs['filters'](_[_0x938d('0x39')](_0x30768f[_0x938d('0x2e')],_0x535358[_0x938d('0x3a')]),_0x2c3977);if(_0x30768f[_0x938d('0x2e')]['filter']){_0x3f3786['where']=_[_0x938d('0x3b')](_0x3f3786[_0x938d('0x38')],{'$or':_[_0x938d('0x2d')](_0x2c3977,function(_0x34510e){if(_0x34510e['type']!==_0x938d('0x3c')){var _0x3430d4={};_0x3430d4[_0x34510e[_0x938d('0x27')]]={'$like':'%'+_0x30768f[_0x938d('0x2e')][_0x938d('0x3d')]+'%'};return _0x3430d4;}})});}_0x3f3786=_['merge']({},_0x3f3786,_0x30768f[_0x938d('0x3e')]);var _0x62cfff={'where':_0x3f3786['where']};return db[_0x938d('0x3f')][_0x938d('0x1a')](_0x62cfff)['then'](function(_0x28431e){_0x21fa95[_0x938d('0x1a')]=_0x28431e;if(_0x30768f[_0x938d('0x2e')][_0x938d('0x40')]){_0x3f3786[_0x938d('0x41')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x3f3786);})['then'](function(_0x9dd8d9){_0x21fa95[_0x938d('0x42')]=_0x9dd8d9;return _0x21fa95;})[_0x938d('0x20')](respondWithFilteredResult(_0x35d47b,_0x3f3786))[_0x938d('0x43')](handleError(_0x35d47b,null));};exports[_0x938d('0x44')]=function(_0x2f4c01,_0x3442a1){var _0x28e5ee={'raw':!![],'where':{'id':_0x2f4c01['params']['id']}},_0x3457c6={};_0x3457c6[_0x938d('0x2c')]=_[_0x938d('0x2f')](db['Sound'][_0x938d('0x45')]);_0x3457c6[_0x938d('0x2e')]=_[_0x938d('0x2f')](_0x2f4c01[_0x938d('0x2e')]);_0x3457c6[_0x938d('0x3a')]=_['intersection'](_0x3457c6['model'],_0x3457c6[_0x938d('0x2e')]);_0x28e5ee[_0x938d('0x31')]=_[_0x938d('0x30')](_0x3457c6[_0x938d('0x2c')],qs['fields'](_0x2f4c01[_0x938d('0x2e')][_0x938d('0x32')]));_0x28e5ee['attributes']=_0x28e5ee[_0x938d('0x31')]['length']?_0x28e5ee['attributes']:_0x3457c6['model'];if(_0x2f4c01[_0x938d('0x2e')]['includeAll']){_0x28e5ee[_0x938d('0x41')]=[{'all':!![]}];}_0x28e5ee=_['merge']({},_0x28e5ee,_0x2f4c01['options']);return db[_0x938d('0x3f')]['find'](_0x28e5ee)[_0x938d('0x20')](handleEntityNotFound(_0x3442a1,null))[_0x938d('0x20')](respondWithResult(_0x3442a1,null))[_0x938d('0x43')](handleError(_0x3442a1,null));};exports[_0x938d('0x46')]=function(_0x2ed980,_0x14917c,_0x83c728){return db['Sound'][_0x938d('0x47')]({'where':{'id':_0x2ed980[_0x938d('0x48')]['id']},'attributes':[_0x938d('0x27'),_0x938d('0x49'),_0x938d('0x4a')],'raw':!![]})[_0x938d('0x20')](handleEntityNotFound(_0x14917c,null))[_0x938d('0x20')](function(_0x519a66){if(_0x519a66){if(!fs['existsSync'](path[_0x938d('0x4b')](config[_0x938d('0x4c')],'server/files/sounds/converted',_0x519a66[_0x938d('0x49')]+'.'+_0x519a66[_0x938d('0x4a')]))){throw new db[(_0x938d('0x4d'))][(_0x938d('0x4e'))](_0x938d('0x4f'));}return _0x14917c[_0x938d('0x46')](path[_0x938d('0x4b')](config[_0x938d('0x4c')],_0x938d('0x50'),util[_0x938d('0x51')](_0x938d('0x52'),_0x519a66['save_name'],_0x519a66[_0x938d('0x4a')])),util['format'](_0x938d('0x52'),_0x519a66[_0x938d('0x27')],_0x519a66[_0x938d('0x4a')]));}return null;})[_0x938d('0x43')](handleError(_0x14917c,null));};exports[_0x938d('0x53')]=function(_0x4fef56,_0x5d8337,_0x42e518){var _0x57619b={'name':path[_0x938d('0x54')](_0x4fef56[_0x938d('0x55')][_0x938d('0x56')],path[_0x938d('0x57')](_0x4fef56['file'][_0x938d('0x56')])),'save_name':path[_0x938d('0x54')](_0x4fef56['file'][_0x938d('0x58')],path[_0x938d('0x57')](_0x4fef56[_0x938d('0x55')][_0x938d('0x58')])),'original_format':path[_0x938d('0x57')](_0x4fef56['file'][_0x938d('0x56')])[_0x938d('0x59')](0x1),'converted_format':'wav'};var _0x2fe185=path[_0x938d('0x4b')](config[_0x938d('0x4c')],'server/files/sounds/original',_0x4fef56[_0x938d('0x55')][_0x938d('0x58')]);var _0x30f916=path[_0x938d('0x4b')](config[_0x938d('0x4c')],'server/files/sounds/converted',util[_0x938d('0x51')](_0x938d('0x52'),path['basename'](_0x4fef56[_0x938d('0x55')]['filename'],path['extname'](_0x4fef56['file'][_0x938d('0x58')])),_0x57619b[_0x938d('0x4a')]));logger[_0x938d('0x5a')](_0x938d('0x5b'),_0x2fe185);logger[_0x938d('0x5a')](_0x938d('0x5c'),_0x30f916);try{fs[_0x938d('0x5d')](_0x2fe185,parseInt('0777',0x8));var _0x2cc29f=sox[_0x938d('0x5e')](_0x2fe185,_0x30f916,{'sampleRate':0x1f40,'format':_0x938d('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2cc29f['on'](_0x938d('0x25'),function(_0x56506c){fs[_0x938d('0x60')](_0x2fe185);_0x5d8337[_0x938d('0x18')](0x1f4)[_0x938d('0x28')](_0x56506c);});_0x2cc29f['on'](_0x938d('0x61'),function(_0x561641){_0x57619b[_0x938d('0x62')]=isNaN(_0x561641['duration'])?null:_0x561641['duration']*0x3e8;_0x57619b['original_sampleCount']=isNaN(_0x561641[_0x938d('0x63')])?null:_0x561641['sampleCount'];_0x57619b[_0x938d('0x64')]=isNaN(_0x561641[_0x938d('0x65')])?null:_0x561641[_0x938d('0x65')];_0x57619b[_0x938d('0x66')]=isNaN(_0x561641[_0x938d('0x67')])?null:_0x561641[_0x938d('0x67')];_0x57619b[_0x938d('0x68')]=isNaN(_0x561641['sampleRate'])?null:_0x561641[_0x938d('0x69')];});_0x2cc29f['on'](_0x938d('0x6a'),function(_0x771e82){_0x57619b[_0x938d('0x6b')]=isNaN(_0x771e82[_0x938d('0x6c')])?null:_0x771e82['duration']*0x3e8;_0x57619b['converted_sampleCount']=isNaN(_0x771e82['sampleCount'])?null:_0x771e82['sampleCount'];_0x57619b[_0x938d('0x6d')]=isNaN(_0x771e82['channelCount'])?null:_0x771e82[_0x938d('0x65')];_0x57619b['converted_bitRate']=isNaN(_0x771e82['bitRate'])?null:_0x771e82[_0x938d('0x67')];_0x57619b[_0x938d('0x6e')]=isNaN(_0x771e82[_0x938d('0x69')])?null:_0x771e82[_0x938d('0x69')];});_0x2cc29f['on'](_0x938d('0x24'),function(){fs[_0x938d('0x5d')](_0x30f916,parseInt('0777',0x8));return db[_0x938d('0x3f')][_0x938d('0x53')](_0x57619b)[_0x938d('0x20')](function(_0x1b08a5){var _0x31d06c={'role':_0x4fef56[_0x938d('0x6f')][_0x938d('0x70')],'userProfileId':_0x4fef56[_0x938d('0x6f')][_0x938d('0x71')]};if(!_0x31d06c)throw new Error(_0x938d('0x72'));if(_0x31d06c[_0x938d('0x70')]===_0x938d('0x73')){var _0x227582=_0x1b08a5[_0x938d('0x22')]({'plain':!![]});return db['UserProfileSection'][_0x938d('0x47')]({'where':{'name':_0x938d('0x74'),'userProfileId':_0x31d06c[_0x938d('0x71')]},'raw':!![]})['then'](function(_0x5b274f){if(_0x5b274f&&_0x5b274f[_0x938d('0x75')]===0x0){return db[_0x938d('0x23')]['create']({'name':_0x227582[_0x938d('0x27')],'resourceId':_0x227582['id'],'type':_0x5b274f[_0x938d('0x27')],'sectionId':_0x5b274f['id']},{})[_0x938d('0x20')](function(){return _0x1b08a5;});}else{return _0x1b08a5;}})[_0x938d('0x43')](function(_0xb67d2d){logger['error'](_0x938d('0x76'),_0xb67d2d);throw _0xb67d2d;});}return _0x1b08a5;})[_0x938d('0x20')](respondWithResult(_0x5d8337,null))[_0x938d('0x43')](handleError(_0x5d8337,null));});_0x2cc29f[_0x938d('0x77')]();}catch(_0x211e67){_0x5d8337[_0x938d('0x18')](0x1f4)[_0x938d('0x28')](_0x211e67);}};exports['update']=function(_0x1f765a,_0x533ef6,_0x2ba50c){return db['Sound'][_0x938d('0x47')]({'where':{'id':_0x1f765a[_0x938d('0x48')]['id']}})[_0x938d('0x20')](handleEntityNotFound(_0x533ef6,null))[_0x938d('0x20')](saveUpdates(_[_0x938d('0x39')](_0x1f765a[_0x938d('0x6f')],['name',_0x938d('0x78')]),null))[_0x938d('0x20')](respondWithResult(_0x533ef6,null))['catch'](handleError(_0x533ef6,null));};exports['delete']=function(_0x342b56,_0x20de8e,_0x520598){return db[_0x938d('0x3f')][_0x938d('0x47')]({'where':{'id':_0x342b56['params']['id']}})[_0x938d('0x20')](function(_0x560c25){if(_0x560c25){return _0x560c25[_0x938d('0x21')]();}})[_0x938d('0x20')](function(_0x3d6e95){var _0x105970=path[_0x938d('0x4b')](config[_0x938d('0x4c')],'server/files/sounds/original',util[_0x938d('0x51')](_0x938d('0x52'),_0x3d6e95['save_name'],_0x3d6e95[_0x938d('0x79')]));var _0x585af2=path[_0x938d('0x4b')](config['root'],_0x938d('0x50'),util['format'](_0x938d('0x52'),_0x3d6e95[_0x938d('0x49')],_0x3d6e95['converted_format']));fs[_0x938d('0x60')](_0x105970);fs['unlinkSync'](_0x585af2);return _0x3d6e95;})['then'](function(_0x333aa8){if(_0x333aa8){return _0x20de8e[_0x938d('0x18')](0xcc)[_0x938d('0x24')]();}})[_0x938d('0x20')](handleEntityNotFound(_0x20de8e,null))[_0x938d('0x43')](handleError(_0x20de8e,null));}; \ No newline at end of file +var _0xeb6c=['rows','catch','show','params','length','options','find','download','converted_format','join','save_name','Sequelize','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','basename','originalname','extname','file','filename','substring','wav','root','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','duration','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','delete','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','get','Sounds','UserProfileResource','error','stack','name','send','Sound','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll'];(function(_0x2ddc42,_0x426454){var _0x4105df=function(_0x32a731){while(--_0x32a731){_0x2ddc42['push'](_0x2ddc42['shift']());}};_0x4105df(++_0x426454);}(_0xeb6c,0x1a7));var _0xceb6=function(_0x5a974d,_0x4bf5f3){_0x5a974d=_0x5a974d-0x0;var _0x405a84=_0xeb6c[_0x5a974d];return _0x405a84;};'use strict';var pdf=require(_0xceb6('0x0'));var emlformat=require(_0xceb6('0x1'));var rimraf=require(_0xceb6('0x2'));var zipdir=require(_0xceb6('0x3'));var jsonpatch=require(_0xceb6('0x4'));var rp=require(_0xceb6('0x5'));var moment=require('moment');var BPromise=require(_0xceb6('0x6'));var Mustache=require(_0xceb6('0x7'));var util=require('util');var path=require(_0xceb6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xceb6('0x9'));var fs=require('fs');var _=require(_0xceb6('0xa'));var squel=require(_0xceb6('0xb'));var crypto=require(_0xceb6('0xc'));var jsforce=require(_0xceb6('0xd'));var deskjs=require(_0xceb6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xceb6('0xf'));var Papa=require(_0xceb6('0x10'));var Redis=require(_0xceb6('0x11'));var authService=require(_0xceb6('0x12'));var qs=require(_0xceb6('0x13'));var as=require(_0xceb6('0x14'));var hardwareService=require(_0xceb6('0x15'));var logger=require(_0xceb6('0x16'))(_0xceb6('0x17'));var utils=require(_0xceb6('0x18'));var config=require('../../config/environment');var db=require(_0xceb6('0x19'))['db'];function respondWithStatusCode(_0x52b3e9,_0x101fcb){_0x101fcb=_0x101fcb||0xcc;return function(_0x208e12){if(_0x208e12){return _0x52b3e9[_0xceb6('0x1a')](_0x101fcb);}return _0x52b3e9['status'](_0x101fcb)[_0xceb6('0x1b')]();};}function respondWithResult(_0x5e05c3,_0x10c97c){_0x10c97c=_0x10c97c||0xc8;return function(_0x388664){if(_0x388664){return _0x5e05c3[_0xceb6('0x1c')](_0x10c97c)['json'](_0x388664);}};}function respondWithFilteredResult(_0x48bb6d,_0x4cebcc){return function(_0x351d19){if(_0x351d19){var _0x4aead9=_0x351d19[_0xceb6('0x1d')],_0x471abe=_0x4cebcc['offset'],_0x26f2dc=_0x4cebcc[_0xceb6('0x1e')]+_0x4cebcc['limit'],_0x3f118a;if(_0x26f2dc>=_0x4aead9){_0x26f2dc=_0x4aead9;_0x3f118a=0xc8;}else{_0x3f118a=0xce;}_0x48bb6d[_0xceb6('0x1c')](_0x3f118a);return _0x48bb6d['set'](_0xceb6('0x1f'),_0x471abe+'-'+_0x26f2dc+'/'+_0x4aead9)[_0xceb6('0x20')](_0x351d19);}return null;};}function patchUpdates(_0x3d5a9b){return function(_0x3473df){try{jsonpatch[_0xceb6('0x21')](_0x3473df,_0x3d5a9b,!![]);}catch(_0x32d1df){return BPromise[_0xceb6('0x22')](_0x32d1df);}return _0x3473df[_0xceb6('0x23')]();};}function saveUpdates(_0x2508fb,_0x3efc39){return function(_0x530b37){if(_0x530b37){return _0x530b37[_0xceb6('0x24')](_0x2508fb)['then'](function(_0x4b7be8){return _0x4b7be8;});}return null;};}function removeEntity(_0x50d663,_0x443007){return function(_0x417e9f){if(_0x417e9f){return _0x417e9f[_0xceb6('0x25')]()[_0xceb6('0x26')](function(){var _0x158009=_0x417e9f[_0xceb6('0x27')]({'plain':!![]});var _0xa1a095=_0xceb6('0x28');return db[_0xceb6('0x29')]['destroy']({'where':{'type':_0xa1a095,'resourceId':_0x158009['id']}})['then'](function(){return _0x417e9f;});})[_0xceb6('0x26')](function(){_0x50d663[_0xceb6('0x1c')](0xcc)[_0xceb6('0x1b')]();});}};}function handleEntityNotFound(_0x3df445,_0x3f843b){return function(_0x159c05){if(!_0x159c05){_0x3df445[_0xceb6('0x1a')](0x194);}return _0x159c05;};}function handleError(_0x5b1d20,_0x2cb99d){_0x2cb99d=_0x2cb99d||0x1f4;return function(_0xe56e5d){logger[_0xceb6('0x2a')](_0xe56e5d[_0xceb6('0x2b')]);if(_0xe56e5d[_0xceb6('0x2c')]){delete _0xe56e5d[_0xceb6('0x2c')];}_0x5b1d20[_0xceb6('0x1c')](_0x2cb99d)[_0xceb6('0x2d')](_0xe56e5d);};}exports['index']=function(_0x531316,_0x190b6b){var _0x209f70={},_0x4c7f32={},_0x52601d={'count':0x0,'rows':[]};var _0x155b67=_['map'](db[_0xceb6('0x2e')][_0xceb6('0x2f')],function(_0x51c227){return{'name':_0x51c227[_0xceb6('0x30')],'type':_0x51c227[_0xceb6('0x31')]['key']};});_0x4c7f32[_0xceb6('0x32')]=_[_0xceb6('0x33')](_0x155b67,'name');_0x4c7f32[_0xceb6('0x34')]=_[_0xceb6('0x35')](_0x531316[_0xceb6('0x34')]);_0x4c7f32['filters']=_[_0xceb6('0x36')](_0x4c7f32[_0xceb6('0x32')],_0x4c7f32['query']);_0x209f70[_0xceb6('0x37')]=_[_0xceb6('0x36')](_0x4c7f32['model'],qs[_0xceb6('0x38')](_0x531316[_0xceb6('0x34')][_0xceb6('0x38')]));_0x209f70['attributes']=_0x209f70[_0xceb6('0x37')]['length']?_0x209f70[_0xceb6('0x37')]:_0x4c7f32[_0xceb6('0x32')];if(!_0x531316[_0xceb6('0x34')][_0xceb6('0x39')](_0xceb6('0x3a'))){_0x209f70['limit']=qs[_0xceb6('0x3b')](_0x531316[_0xceb6('0x34')][_0xceb6('0x3b')]);_0x209f70[_0xceb6('0x1e')]=qs[_0xceb6('0x1e')](_0x531316[_0xceb6('0x34')][_0xceb6('0x1e')]);}_0x209f70[_0xceb6('0x3c')]=qs[_0xceb6('0x3d')](_0x531316[_0xceb6('0x34')][_0xceb6('0x3d')]);_0x209f70[_0xceb6('0x3e')]=qs[_0xceb6('0x3f')](_['pick'](_0x531316['query'],_0x4c7f32['filters']),_0x155b67);if(_0x531316['query'][_0xceb6('0x40')]){_0x209f70['where']=_[_0xceb6('0x41')](_0x209f70[_0xceb6('0x3e')],{'$or':_[_0xceb6('0x33')](_0x155b67,function(_0x1ca6e8){if(_0x1ca6e8[_0xceb6('0x31')]!==_0xceb6('0x42')){var _0x1dcce6={};_0x1dcce6[_0x1ca6e8[_0xceb6('0x2c')]]={'$like':'%'+_0x531316[_0xceb6('0x34')][_0xceb6('0x40')]+'%'};return _0x1dcce6;}})});}_0x209f70=_['merge']({},_0x209f70,_0x531316['options']);var _0x43b442={'where':_0x209f70[_0xceb6('0x3e')]};return db[_0xceb6('0x2e')][_0xceb6('0x1d')](_0x43b442)[_0xceb6('0x26')](function(_0x391ac5){_0x52601d[_0xceb6('0x1d')]=_0x391ac5;if(_0x531316[_0xceb6('0x34')]['includeAll']){_0x209f70[_0xceb6('0x43')]=[{'all':!![]}];}return db[_0xceb6('0x2e')][_0xceb6('0x44')](_0x209f70);})['then'](function(_0x3d7531){_0x52601d[_0xceb6('0x45')]=_0x3d7531;return _0x52601d;})[_0xceb6('0x26')](respondWithFilteredResult(_0x190b6b,_0x209f70))[_0xceb6('0x46')](handleError(_0x190b6b,null));};exports[_0xceb6('0x47')]=function(_0x36b8a3,_0x315f68){var _0x20555d={'raw':!![],'where':{'id':_0x36b8a3[_0xceb6('0x48')]['id']}},_0x1096a9={};_0x1096a9[_0xceb6('0x32')]=_['keys'](db[_0xceb6('0x2e')][_0xceb6('0x2f')]);_0x1096a9[_0xceb6('0x34')]=_[_0xceb6('0x35')](_0x36b8a3[_0xceb6('0x34')]);_0x1096a9[_0xceb6('0x3f')]=_[_0xceb6('0x36')](_0x1096a9[_0xceb6('0x32')],_0x1096a9[_0xceb6('0x34')]);_0x20555d['attributes']=_[_0xceb6('0x36')](_0x1096a9['model'],qs[_0xceb6('0x38')](_0x36b8a3[_0xceb6('0x34')][_0xceb6('0x38')]));_0x20555d[_0xceb6('0x37')]=_0x20555d[_0xceb6('0x37')][_0xceb6('0x49')]?_0x20555d[_0xceb6('0x37')]:_0x1096a9['model'];if(_0x36b8a3[_0xceb6('0x34')]['includeAll']){_0x20555d[_0xceb6('0x43')]=[{'all':!![]}];}_0x20555d=_['merge']({},_0x20555d,_0x36b8a3[_0xceb6('0x4a')]);return db[_0xceb6('0x2e')][_0xceb6('0x4b')](_0x20555d)[_0xceb6('0x26')](handleEntityNotFound(_0x315f68,null))[_0xceb6('0x26')](respondWithResult(_0x315f68,null))['catch'](handleError(_0x315f68,null));};exports[_0xceb6('0x4c')]=function(_0x24ef83,_0x34d875,_0x5e816a){return db[_0xceb6('0x2e')][_0xceb6('0x4b')]({'where':{'id':_0x24ef83['params']['id']},'attributes':[_0xceb6('0x2c'),'save_name',_0xceb6('0x4d')],'raw':!![]})[_0xceb6('0x26')](handleEntityNotFound(_0x34d875,null))[_0xceb6('0x26')](function(_0x48d267){if(_0x48d267){if(!fs['existsSync'](path[_0xceb6('0x4e')](config['root'],'server/files/sounds/converted',_0x48d267[_0xceb6('0x4f')]+'.'+_0x48d267[_0xceb6('0x4d')]))){throw new db[(_0xceb6('0x50'))]['ValidationError'](_0xceb6('0x51'));}return _0x34d875['download'](path[_0xceb6('0x4e')](config['root'],_0xceb6('0x52'),util[_0xceb6('0x53')](_0xceb6('0x54'),_0x48d267[_0xceb6('0x4f')],_0x48d267[_0xceb6('0x4d')])),util[_0xceb6('0x53')](_0xceb6('0x54'),_0x48d267[_0xceb6('0x2c')],_0x48d267['converted_format']));}return null;})[_0xceb6('0x46')](handleError(_0x34d875,null));};exports['create']=function(_0x1e43dd,_0x9b1574,_0x55c2d8){var _0x264547={'name':path[_0xceb6('0x55')](_0x1e43dd['file'][_0xceb6('0x56')],path[_0xceb6('0x57')](_0x1e43dd[_0xceb6('0x58')]['originalname'])),'save_name':path[_0xceb6('0x55')](_0x1e43dd[_0xceb6('0x58')]['filename'],path[_0xceb6('0x57')](_0x1e43dd[_0xceb6('0x58')][_0xceb6('0x59')])),'original_format':path['extname'](_0x1e43dd['file'][_0xceb6('0x56')])[_0xceb6('0x5a')](0x1),'converted_format':_0xceb6('0x5b')};var _0x55d450=path[_0xceb6('0x4e')](config[_0xceb6('0x5c')],_0xceb6('0x5d'),_0x1e43dd['file'][_0xceb6('0x59')]);var _0x41d3bd=path[_0xceb6('0x4e')](config['root'],_0xceb6('0x52'),util['format'](_0xceb6('0x54'),path[_0xceb6('0x55')](_0x1e43dd[_0xceb6('0x58')]['filename'],path[_0xceb6('0x57')](_0x1e43dd['file'][_0xceb6('0x59')])),_0x264547[_0xceb6('0x4d')]));logger[_0xceb6('0x5e')](_0xceb6('0x5f'),_0x55d450);logger[_0xceb6('0x5e')](_0xceb6('0x60'),_0x41d3bd);try{fs[_0xceb6('0x61')](_0x55d450,parseInt('0777',0x8));var _0x2c9864=sox[_0xceb6('0x62')](_0x55d450,_0x41d3bd,{'sampleRate':0x1f40,'format':_0xceb6('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c9864['on'](_0xceb6('0x2a'),function(_0x3ff0fd){fs[_0xceb6('0x63')](_0x55d450);_0x9b1574['status'](0x1f4)[_0xceb6('0x2d')](_0x3ff0fd);});_0x2c9864['on'](_0xceb6('0x64'),function(_0x17646a){_0x264547['original_duration']=isNaN(_0x17646a[_0xceb6('0x65')])?null:_0x17646a[_0xceb6('0x65')]*0x3e8;_0x264547['original_sampleCount']=isNaN(_0x17646a[_0xceb6('0x66')])?null:_0x17646a[_0xceb6('0x66')];_0x264547['original_channelCount']=isNaN(_0x17646a[_0xceb6('0x67')])?null:_0x17646a['channelCount'];_0x264547['original_bitRate']=isNaN(_0x17646a['bitRate'])?null:_0x17646a[_0xceb6('0x68')];_0x264547[_0xceb6('0x69')]=isNaN(_0x17646a[_0xceb6('0x6a')])?null:_0x17646a[_0xceb6('0x6a')];});_0x2c9864['on']('dest',function(_0x2a35b8){_0x264547['converted_duration']=isNaN(_0x2a35b8['duration'])?null:_0x2a35b8['duration']*0x3e8;_0x264547['converted_sampleCount']=isNaN(_0x2a35b8[_0xceb6('0x66')])?null:_0x2a35b8[_0xceb6('0x66')];_0x264547[_0xceb6('0x6b')]=isNaN(_0x2a35b8[_0xceb6('0x67')])?null:_0x2a35b8[_0xceb6('0x67')];_0x264547[_0xceb6('0x6c')]=isNaN(_0x2a35b8['bitRate'])?null:_0x2a35b8['bitRate'];_0x264547[_0xceb6('0x6d')]=isNaN(_0x2a35b8[_0xceb6('0x6a')])?null:_0x2a35b8[_0xceb6('0x6a')];});_0x2c9864['on'](_0xceb6('0x1b'),function(){fs[_0xceb6('0x61')](_0x41d3bd,parseInt(_0xceb6('0x6e'),0x8));return db[_0xceb6('0x2e')]['create'](_0x264547)['then'](function(_0x3955a4){var _0x3cf52a={'role':_0x1e43dd[_0xceb6('0x6f')][_0xceb6('0x70')],'userProfileId':_0x1e43dd[_0xceb6('0x6f')][_0xceb6('0x71')]};if(!_0x3cf52a)throw new Error(_0xceb6('0x72'));if(_0x3cf52a['role']===_0xceb6('0x73')){var _0x12d616=_0x3955a4['get']({'plain':!![]});return db[_0xceb6('0x74')][_0xceb6('0x4b')]({'where':{'name':_0xceb6('0x28'),'userProfileId':_0x3cf52a[_0xceb6('0x71')]},'raw':!![]})[_0xceb6('0x26')](function(_0xc84bdd){if(_0xc84bdd&&_0xc84bdd[_0xceb6('0x75')]===0x0){return db['UserProfileResource'][_0xceb6('0x76')]({'name':_0x12d616[_0xceb6('0x2c')],'resourceId':_0x12d616['id'],'type':_0xc84bdd['name'],'sectionId':_0xc84bdd['id']},{})[_0xceb6('0x26')](function(){return _0x3955a4;});}else{return _0x3955a4;}})['catch'](function(_0x46387e){logger[_0xceb6('0x2a')](_0xceb6('0x77'),_0x46387e);throw _0x46387e;});}return _0x3955a4;})[_0xceb6('0x26')](respondWithResult(_0x9b1574,null))[_0xceb6('0x46')](handleError(_0x9b1574,null));});_0x2c9864['start']();}catch(_0x437fce){_0x9b1574[_0xceb6('0x1c')](0x1f4)[_0xceb6('0x2d')](_0x437fce);}};exports['update']=function(_0x5fd897,_0xf9dd99,_0x35102c){return db[_0xceb6('0x2e')][_0xceb6('0x4b')]({'where':{'id':_0x5fd897[_0xceb6('0x48')]['id']}})['then'](handleEntityNotFound(_0xf9dd99,null))[_0xceb6('0x26')](saveUpdates(_[_0xceb6('0x78')](_0x5fd897[_0xceb6('0x6f')],[_0xceb6('0x2c'),_0xceb6('0x79')]),null))[_0xceb6('0x26')](respondWithResult(_0xf9dd99,null))[_0xceb6('0x46')](handleError(_0xf9dd99,null));};exports[_0xceb6('0x7a')]=function(_0x3639b8,_0x154a40,_0x3dd363){return db['Sound'][_0xceb6('0x4b')]({'where':{'id':_0x3639b8[_0xceb6('0x48')]['id']}})['then'](function(_0x13be3f){if(_0x13be3f){return _0x13be3f[_0xceb6('0x25')]();}})[_0xceb6('0x26')](function(_0x11ffda){var _0x12cf9e=path[_0xceb6('0x4e')](config[_0xceb6('0x5c')],_0xceb6('0x5d'),util[_0xceb6('0x53')]('%s.%s',_0x11ffda[_0xceb6('0x4f')],_0x11ffda['original_format']));var _0x2106be=path[_0xceb6('0x4e')](config['root'],'server/files/sounds/converted',util['format']('%s.%s',_0x11ffda['save_name'],_0x11ffda[_0xceb6('0x4d')]));fs[_0xceb6('0x63')](_0x12cf9e);fs[_0xceb6('0x63')](_0x2106be);return _0x11ffda;})[_0xceb6('0x26')](function(_0x227433){if(_0x227433){return _0x154a40[_0xceb6('0x1c')](0xcc)[_0xceb6('0x1b')]();}})[_0xceb6('0x26')](handleEntityNotFound(_0x154a40,null))[_0xceb6('0x46')](handleError(_0x154a40,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c6209e9..d2dfe3a 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 _0x939b=['./sound.attributes','exports','define','tools_sounds','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3c118e,_0x4da89e){var _0x3ed1b6=function(_0x42d38a){while(--_0x42d38a){_0x3c118e['push'](_0x3c118e['shift']());}};_0x3ed1b6(++_0x4da89e);}(_0x939b,0x64));var _0xb939=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x939b[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xb939('0x0'));var util=require(_0xb939('0x1'));var logger=require(_0xb939('0x2'))(_0xb939('0x3'));var moment=require(_0xb939('0x4'));var BPromise=require('bluebird');var rp=require(_0xb939('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb939('0x6'));var config=require(_0xb939('0x7'));var attributes=require(_0xb939('0x8'));module[_0xb939('0x9')]=function(_0x22eec4,_0x1bc786){return _0x22eec4[_0xb939('0xa')]('Sound',attributes,{'tableName':_0xb939('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd347=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./sound.attributes','define','Sound'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xd347,0x155));var _0x7d34=function(_0x5c591f,_0x2b0678){_0x5c591f=_0x5c591f-0x0;var _0x5d90b9=_0xd347[_0x5c591f];return _0x5d90b9;};'use strict';var _=require(_0x7d34('0x0'));var util=require(_0x7d34('0x1'));var logger=require('../../config/logger')(_0x7d34('0x2'));var moment=require(_0x7d34('0x3'));var BPromise=require(_0x7d34('0x4'));var rp=require(_0x7d34('0x5'));var fs=require('fs');var path=require(_0x7d34('0x6'));var rimraf=require(_0x7d34('0x7'));var config=require('../../config/environment');var attributes=require(_0x7d34('0x8'));module['exports']=function(_0x519500,_0x2d02de){return _0x519500[_0x7d34('0x9')](_0x7d34('0xa'),attributes,{'tableName':'tools_sounds','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 16f0bbb..87ec160 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 _0xd3a3=['model','attributes','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSound','Sound','find','options','raw','where','include','map'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0xd3a3,0x87));var _0x3d3a=function(_0x24f6c4,_0x54f981){_0x24f6c4=_0x24f6c4-0x0;var _0x61891f=_0xd3a3[_0x24f6c4];return _0x61891f;};'use strict';var _=require(_0x3d3a('0x0'));var util=require(_0x3d3a('0x1'));var moment=require(_0x3d3a('0x2'));var BPromise=require(_0x3d3a('0x3'));var rs=require(_0x3d3a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d3a('0x5'))['db'];var utils=require(_0x3d3a('0x6'));var logger=require(_0x3d3a('0x7'))(_0x3d3a('0x8'));var config=require(_0x3d3a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3d3a('0xa')][_0x3d3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cdded,_0x300cea,_0x56e596){return new BPromise(function(_0xa0fa2b,_0x52f3bd){return client['request'](_0x1cdded,_0x56e596)[_0x3d3a('0xc')](function(_0x453a95){logger[_0x3d3a('0xd')](_0x3d3a('0xe'),_0x300cea,_0x3d3a('0xf'));logger[_0x3d3a('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x300cea,_0x3d3a('0xf'),JSON[_0x3d3a('0x11')](_0x453a95));if(_0x453a95[_0x3d3a('0x12')]){if(_0x453a95[_0x3d3a('0x12')][_0x3d3a('0x13')]===0x1f4){logger[_0x3d3a('0x12')](_0x3d3a('0xe'),_0x300cea,_0x453a95[_0x3d3a('0x12')][_0x3d3a('0x14')]);return _0x52f3bd(_0x453a95[_0x3d3a('0x12')][_0x3d3a('0x14')]);}logger[_0x3d3a('0x12')](_0x3d3a('0xe'),_0x300cea,_0x453a95[_0x3d3a('0x12')]['message']);return _0xa0fa2b(_0x453a95[_0x3d3a('0x12')][_0x3d3a('0x14')]);}else{logger['info'](_0x3d3a('0xe'),_0x300cea,_0x3d3a('0xf'));_0xa0fa2b(_0x453a95[_0x3d3a('0x15')][_0x3d3a('0x14')]);}})['catch'](function(_0x364411){logger[_0x3d3a('0x12')](_0x3d3a('0xe'),_0x300cea,_0x364411);_0x52f3bd(_0x364411);});});}exports[_0x3d3a('0x16')]=function(_0x4bf65c){var _0x33c83b=this;return new Promise(function(_0x5d2d22,_0x30917c){return db[_0x3d3a('0x17')][_0x3d3a('0x18')]({'raw':_0x4bf65c[_0x3d3a('0x19')]?_0x4bf65c['options'][_0x3d3a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4bf65c[_0x3d3a('0x19')]?_0x4bf65c[_0x3d3a('0x19')][_0x3d3a('0x1b')]||null:null,'attributes':_0x4bf65c[_0x3d3a('0x19')]?_0x4bf65c['options']['attributes']||null:null,'include':_0x4bf65c[_0x3d3a('0x19')]?_0x4bf65c[_0x3d3a('0x19')][_0x3d3a('0x1c')]?_[_0x3d3a('0x1d')](_0x4bf65c[_0x3d3a('0x19')]['include'],function(_0x68c72f){return{'model':db[_0x68c72f[_0x3d3a('0x1e')]],'as':_0x68c72f['as'],'attributes':_0x68c72f[_0x3d3a('0x1f')],'include':_0x68c72f[_0x3d3a('0x1c')]?_[_0x3d3a('0x1d')](_0x68c72f[_0x3d3a('0x1c')],function(_0x39e688){return{'model':db[_0x39e688[_0x3d3a('0x1e')]],'as':_0x39e688['as'],'attributes':_0x39e688[_0x3d3a('0x1f')],'include':_0x39e688['include']?_[_0x3d3a('0x1d')](_0x39e688['include'],function(_0x2408e1){return{'model':db[_0x2408e1[_0x3d3a('0x1e')]],'as':_0x2408e1['as'],'attributes':_0x2408e1[_0x3d3a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3d3a('0xc')](function(_0x26c322){logger[_0x3d3a('0xd')](_0x3d3a('0x16'),_0x4bf65c);logger[_0x3d3a('0x10')](_0x3d3a('0x16'),_0x4bf65c,JSON[_0x3d3a('0x11')](_0x26c322));_0x5d2d22(_0x26c322);})[_0x3d3a('0x20')](function(_0x13483f){logger[_0x3d3a('0x12')](_0x3d3a('0x16'),_0x13483f['message'],_0x4bf65c);_0x30917c(_0x33c83b['error'](0x1f4,_0x13483f[_0x3d3a('0x14')]));});});}; \ No newline at end of file +var _0x768e=['request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','ShowSound','Sound','options','raw','where','include','map','attributes','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5bc2b0,_0x4aa427){var _0x3c1b03=function(_0x1eecee){while(--_0x1eecee){_0x5bc2b0['push'](_0x5bc2b0['shift']());}};_0x3c1b03(++_0x4aa427);}(_0x768e,0x12b));var _0xe768=function(_0x1caa1e,_0x36f5a2){_0x1caa1e=_0x1caa1e-0x0;var _0x3ae08d=_0x768e[_0x1caa1e];return _0x3ae08d;};'use strict';var _=require(_0xe768('0x0'));var util=require(_0xe768('0x1'));var moment=require(_0xe768('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe768('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe768('0x4'));var logger=require(_0xe768('0x5'))(_0xe768('0x6'));var config=require(_0xe768('0x7'));var jayson=require(_0xe768('0x8'));var client=jayson[_0xe768('0x9')][_0xe768('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ecb46,_0x255a47,_0x18267e){return new BPromise(function(_0x461706,_0x345659){return client[_0xe768('0xb')](_0x1ecb46,_0x18267e)[_0xe768('0xc')](function(_0x2ced55){logger[_0xe768('0xd')](_0xe768('0xe'),_0x255a47,'request\x20sent');logger[_0xe768('0xf')](_0xe768('0x10'),_0x255a47,'request\x20sent',JSON[_0xe768('0x11')](_0x2ced55));if(_0x2ced55[_0xe768('0x12')]){if(_0x2ced55[_0xe768('0x12')][_0xe768('0x13')]===0x1f4){logger[_0xe768('0x12')](_0xe768('0xe'),_0x255a47,_0x2ced55[_0xe768('0x12')][_0xe768('0x14')]);return _0x345659(_0x2ced55[_0xe768('0x12')][_0xe768('0x14')]);}logger[_0xe768('0x12')]('Sound,\x20%s,\x20%s',_0x255a47,_0x2ced55[_0xe768('0x12')][_0xe768('0x14')]);return _0x461706(_0x2ced55['error'][_0xe768('0x14')]);}else{logger[_0xe768('0xd')](_0xe768('0xe'),_0x255a47,_0xe768('0x15'));_0x461706(_0x2ced55['result'][_0xe768('0x14')]);}})[_0xe768('0x16')](function(_0x40c8f7){logger['error'](_0xe768('0xe'),_0x255a47,_0x40c8f7);_0x345659(_0x40c8f7);});});}exports[_0xe768('0x17')]=function(_0x316993){var _0x2fa0e0=this;return new Promise(function(_0x44ff31,_0x22d55e){return db[_0xe768('0x18')]['find']({'raw':_0x316993[_0xe768('0x19')]?_0x316993[_0xe768('0x19')][_0xe768('0x1a')]===undefined?!![]:![]:!![],'where':_0x316993[_0xe768('0x19')]?_0x316993[_0xe768('0x19')][_0xe768('0x1b')]||null:null,'attributes':_0x316993[_0xe768('0x19')]?_0x316993['options']['attributes']||null:null,'include':_0x316993[_0xe768('0x19')]?_0x316993[_0xe768('0x19')][_0xe768('0x1c')]?_[_0xe768('0x1d')](_0x316993['options'][_0xe768('0x1c')],function(_0x17ad21){return{'model':db[_0x17ad21['model']],'as':_0x17ad21['as'],'attributes':_0x17ad21[_0xe768('0x1e')],'include':_0x17ad21[_0xe768('0x1c')]?_[_0xe768('0x1d')](_0x17ad21['include'],function(_0x250def){return{'model':db[_0x250def['model']],'as':_0x250def['as'],'attributes':_0x250def[_0xe768('0x1e')],'include':_0x250def[_0xe768('0x1c')]?_[_0xe768('0x1d')](_0x250def[_0xe768('0x1c')],function(_0x1366b7){return{'model':db[_0x1366b7['model']],'as':_0x1366b7['as'],'attributes':_0x1366b7[_0xe768('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe768('0xc')](function(_0x54530a){logger[_0xe768('0xd')](_0xe768('0x17'),_0x316993);logger[_0xe768('0xf')](_0xe768('0x17'),_0x316993,JSON['stringify'](_0x54530a));_0x44ff31(_0x54530a);})[_0xe768('0x16')](function(_0x5299a9){logger[_0xe768('0x12')](_0xe768('0x17'),_0x5299a9[_0xe768('0x14')],_0x316993);_0x22d55e(_0x2fa0e0[_0xe768('0x12')](0x1f4,_0x5299a9[_0xe768('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b7df289..d200b77 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 _0x5e35=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x5e35,0xd9));var _0x55e3=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x5e35[_0x342baa];return _0x1208f3;};'use strict';var multer=require('multer');var util=require(_0x55e3('0x0'));var path=require(_0x55e3('0x1'));var timeout=require(_0x55e3('0x2'));var express=require(_0x55e3('0x3'));var router=express[_0x55e3('0x4')]();var auth=require(_0x55e3('0x5'));var interaction=require(_0x55e3('0x6'));var config=require(_0x55e3('0x7'));var controller=require(_0x55e3('0x8'));router[_0x55e3('0x9')]('/',auth[_0x55e3('0xa')](),controller[_0x55e3('0xb')]);router[_0x55e3('0x9')](_0x55e3('0xc'),auth['isAuthenticated'](),controller[_0x55e3('0xd')]);router[_0x55e3('0xe')]('/',auth['isAuthenticated'](),controller[_0x55e3('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x55e3('0x10')]);router[_0x55e3('0x11')](_0x55e3('0xc'),auth['isAuthenticated'](),controller[_0x55e3('0x12')]);module[_0x55e3('0x13')]=router; \ No newline at end of file +var _0x6d47=['put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','post','isAuthenticated','create'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x6d47,0x180));var _0x76d4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x6d47[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x76d4('0x0'));var util=require(_0x76d4('0x1'));var path=require('path');var timeout=require(_0x76d4('0x2'));var express=require(_0x76d4('0x3'));var router=express[_0x76d4('0x4')]();var auth=require(_0x76d4('0x5'));var interaction=require(_0x76d4('0x6'));var config=require(_0x76d4('0x7'));var controller=require('./squareMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x76d4('0x8')]);router[_0x76d4('0x9')](_0x76d4('0xa'),auth['isAuthenticated'](),controller[_0x76d4('0xb')]);router[_0x76d4('0xc')]('/',auth[_0x76d4('0xd')](),controller[_0x76d4('0xe')]);router[_0x76d4('0xf')](_0x76d4('0xa'),auth[_0x76d4('0xd')](),controller[_0x76d4('0x10')]);router[_0x76d4('0x11')](_0x76d4('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x76d4('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a7f8a91..cc31b67 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 _0x3d41=['STRING','TEXT','medium','ENUM','out','sequelize','exports'];(function(_0x7265d8,_0x266c82){var _0x31098a=function(_0x4f1eef){while(--_0x4f1eef){_0x7265d8['push'](_0x7265d8['shift']());}};_0x31098a(++_0x266c82);}(_0x3d41,0x6e));var _0x13d4=function(_0x10a212,_0x579d85){_0x10a212=_0x10a212-0x0;var _0x23c82b=_0x3d41[_0x10a212];return _0x23c82b;};'use strict';var Sequelize=require(_0x13d4('0x0'));module[_0x13d4('0x1')]={'uniqueid':{'type':Sequelize[_0x13d4('0x2')]},'body':{'type':Sequelize[_0x13d4('0x3')](_0x13d4('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x13d4('0x5')]('in',_0x13d4('0x6')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file +var _0xdbb8=['TEXT','ENUM','out','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdbb8,0x107));var _0x8dbb=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0xdbb8[_0x2e4cbf];return _0x52840f;};'use strict';var Sequelize=require('sequelize');module[_0x8dbb('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x8dbb('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x8dbb('0x2')]('in',_0x8dbb('0x3')),'defaultValue':'out','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1530c8a..f011d55 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 _0x4b00=['desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','apply','reject','update','then','destroy','error','stack','name','send','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','merge','options','includeAll','include','SquareMessage','findAll','rows','catch','show','params','keys','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x5cd251,_0x300c67){var _0x26c9cd=function(_0x2fc33c){while(--_0x2fc33c){_0x5cd251['push'](_0x5cd251['shift']());}};_0x26c9cd(++_0x300c67);}(_0x4b00,0x14f));var _0x04b0=function(_0x2ae2bc,_0x177514){_0x2ae2bc=_0x2ae2bc-0x0;var _0x53c290=_0x4b00[_0x2ae2bc];return _0x53c290;};'use strict';var pdf=require(_0x04b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x04b0('0x1'));var zipdir=require(_0x04b0('0x2'));var jsonpatch=require(_0x04b0('0x3'));var rp=require(_0x04b0('0x4'));var moment=require('moment');var BPromise=require(_0x04b0('0x5'));var Mustache=require(_0x04b0('0x6'));var util=require(_0x04b0('0x7'));var path=require(_0x04b0('0x8'));var sox=require(_0x04b0('0x9'));var csv=require('to-csv');var ejs=require(_0x04b0('0xa'));var fs=require('fs');var _=require(_0x04b0('0xb'));var squel=require(_0x04b0('0xc'));var crypto=require(_0x04b0('0xd'));var jsforce=require(_0x04b0('0xe'));var deskjs=require(_0x04b0('0xf'));var toCsv=require(_0x04b0('0x10'));var querystring=require(_0x04b0('0x11'));var Papa=require(_0x04b0('0x12'));var Redis=require(_0x04b0('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04b0('0x14'));var logger=require(_0x04b0('0x15'))('api');var utils=require(_0x04b0('0x16'));var config=require(_0x04b0('0x17'));var db=require(_0x04b0('0x18'))['db'];function respondWithStatusCode(_0x5cb1a5,_0x30ec61){_0x30ec61=_0x30ec61||0xcc;return function(_0x3b7456){if(_0x3b7456){return _0x5cb1a5[_0x04b0('0x19')](_0x30ec61);}return _0x5cb1a5['status'](_0x30ec61)[_0x04b0('0x1a')]();};}function respondWithResult(_0x13cce3,_0x54ab27){_0x54ab27=_0x54ab27||0xc8;return function(_0x26af21){if(_0x26af21){return _0x13cce3[_0x04b0('0x1b')](_0x54ab27)[_0x04b0('0x1c')](_0x26af21);}};}function respondWithFilteredResult(_0x27c2f2,_0x4366f8){return function(_0x4272ad){if(_0x4272ad){var _0x30cfa9=_0x4272ad[_0x04b0('0x1d')],_0x807617=_0x4366f8[_0x04b0('0x1e')],_0x4a55fe=_0x4366f8[_0x04b0('0x1e')]+_0x4366f8['limit'],_0x42bff9;if(_0x4a55fe>=_0x30cfa9){_0x4a55fe=_0x30cfa9;_0x42bff9=0xc8;}else{_0x42bff9=0xce;}_0x27c2f2[_0x04b0('0x1b')](_0x42bff9);return _0x27c2f2['set']('Content-Range',_0x807617+'-'+_0x4a55fe+'/'+_0x30cfa9)['json'](_0x4272ad);}return null;};}function patchUpdates(_0x49e05e){return function(_0x643a16){try{jsonpatch[_0x04b0('0x1f')](_0x643a16,_0x49e05e,!![]);}catch(_0x9ef747){return BPromise[_0x04b0('0x20')](_0x9ef747);}return _0x643a16['save']();};}function saveUpdates(_0x5c67bf,_0x4fc03f){return function(_0x34fc9){if(_0x34fc9){return _0x34fc9[_0x04b0('0x21')](_0x5c67bf)[_0x04b0('0x22')](function(_0x577393){return _0x577393;});}return null;};}function removeEntity(_0x5be4ff,_0x152959){return function(_0x4873ed){if(_0x4873ed){return _0x4873ed[_0x04b0('0x23')]()[_0x04b0('0x22')](function(){_0x5be4ff[_0x04b0('0x1b')](0xcc)[_0x04b0('0x1a')]();});}};}function handleEntityNotFound(_0x2127ac,_0x4931eb){return function(_0x1bc37c){if(!_0x1bc37c){_0x2127ac[_0x04b0('0x19')](0x194);}return _0x1bc37c;};}function handleError(_0x366f6e,_0x5ebd12){_0x5ebd12=_0x5ebd12||0x1f4;return function(_0xce6898){logger[_0x04b0('0x24')](_0xce6898[_0x04b0('0x25')]);if(_0xce6898[_0x04b0('0x26')]){delete _0xce6898[_0x04b0('0x26')];}_0x366f6e[_0x04b0('0x1b')](_0x5ebd12)[_0x04b0('0x27')](_0xce6898);};}exports['index']=function(_0x15e6ce,_0x565fc5){var _0x3063bc={},_0x2dc3fe={},_0x299704={'count':0x0,'rows':[]};var _0xfe1287=_['map'](db['SquareMessage']['rawAttributes'],function(_0x20a944){return{'name':_0x20a944[_0x04b0('0x28')],'type':_0x20a944[_0x04b0('0x29')][_0x04b0('0x2a')]};});_0x2dc3fe[_0x04b0('0x2b')]=_[_0x04b0('0x2c')](_0xfe1287,_0x04b0('0x26'));_0x2dc3fe[_0x04b0('0x2d')]=_['keys'](_0x15e6ce[_0x04b0('0x2d')]);_0x2dc3fe[_0x04b0('0x2e')]=_[_0x04b0('0x2f')](_0x2dc3fe[_0x04b0('0x2b')],_0x2dc3fe['query']);_0x3063bc['attributes']=_['intersection'](_0x2dc3fe[_0x04b0('0x2b')],qs[_0x04b0('0x30')](_0x15e6ce['query'][_0x04b0('0x30')]));_0x3063bc[_0x04b0('0x31')]=_0x3063bc[_0x04b0('0x31')][_0x04b0('0x32')]?_0x3063bc[_0x04b0('0x31')]:_0x2dc3fe[_0x04b0('0x2b')];if(!_0x15e6ce['query'][_0x04b0('0x33')](_0x04b0('0x34'))){_0x3063bc[_0x04b0('0x35')]=qs[_0x04b0('0x35')](_0x15e6ce['query']['limit']);_0x3063bc['offset']=qs['offset'](_0x15e6ce[_0x04b0('0x2d')][_0x04b0('0x1e')]);}_0x3063bc['order']=qs[_0x04b0('0x36')](_0x15e6ce['query']['sort']);_0x3063bc[_0x04b0('0x37')]=qs[_0x04b0('0x2e')](_['pick'](_0x15e6ce[_0x04b0('0x2d')],_0x2dc3fe[_0x04b0('0x2e')]),_0xfe1287);if(_0x15e6ce[_0x04b0('0x2d')]['filter']){_0x3063bc[_0x04b0('0x37')]=_[_0x04b0('0x38')](_0x3063bc[_0x04b0('0x37')],{'$or':_[_0x04b0('0x2c')](_0xfe1287,function(_0x1cba2b){if(_0x1cba2b[_0x04b0('0x29')]!=='VIRTUAL'){var _0x59a2c4={};_0x59a2c4[_0x1cba2b[_0x04b0('0x26')]]={'$like':'%'+_0x15e6ce[_0x04b0('0x2d')]['filter']+'%'};return _0x59a2c4;}})});}_0x3063bc=_[_0x04b0('0x38')]({},_0x3063bc,_0x15e6ce[_0x04b0('0x39')]);var _0x6f955={'where':_0x3063bc[_0x04b0('0x37')]};return db['SquareMessage'][_0x04b0('0x1d')](_0x6f955)[_0x04b0('0x22')](function(_0x5ab54c){_0x299704[_0x04b0('0x1d')]=_0x5ab54c;if(_0x15e6ce[_0x04b0('0x2d')][_0x04b0('0x3a')]){_0x3063bc[_0x04b0('0x3b')]=[{'all':!![]}];}return db[_0x04b0('0x3c')][_0x04b0('0x3d')](_0x3063bc);})[_0x04b0('0x22')](function(_0x4257f2){_0x299704[_0x04b0('0x3e')]=_0x4257f2;return _0x299704;})[_0x04b0('0x22')](respondWithFilteredResult(_0x565fc5,_0x3063bc))[_0x04b0('0x3f')](handleError(_0x565fc5,null));};exports[_0x04b0('0x40')]=function(_0x1427d1,_0x51dc11){var _0x4e6acd={'raw':!![],'where':{'id':_0x1427d1[_0x04b0('0x41')]['id']}},_0xa2d181={};_0xa2d181['model']=_['keys'](db['SquareMessage']['rawAttributes']);_0xa2d181[_0x04b0('0x2d')]=_[_0x04b0('0x42')](_0x1427d1[_0x04b0('0x2d')]);_0xa2d181[_0x04b0('0x2e')]=_[_0x04b0('0x2f')](_0xa2d181[_0x04b0('0x2b')],_0xa2d181[_0x04b0('0x2d')]);_0x4e6acd[_0x04b0('0x31')]=_[_0x04b0('0x2f')](_0xa2d181['model'],qs[_0x04b0('0x30')](_0x1427d1['query'][_0x04b0('0x30')]));_0x4e6acd['attributes']=_0x4e6acd[_0x04b0('0x31')][_0x04b0('0x32')]?_0x4e6acd['attributes']:_0xa2d181[_0x04b0('0x2b')];if(_0x1427d1[_0x04b0('0x2d')]['includeAll']){_0x4e6acd[_0x04b0('0x3b')]=[{'all':!![]}];}_0x4e6acd=_[_0x04b0('0x38')]({},_0x4e6acd,_0x1427d1[_0x04b0('0x39')]);return db[_0x04b0('0x3c')]['find'](_0x4e6acd)['then'](handleEntityNotFound(_0x51dc11,null))['then'](respondWithResult(_0x51dc11,null))['catch'](handleError(_0x51dc11,null));};exports[_0x04b0('0x43')]=function(_0x3fe9cf,_0x3cfb09){return db[_0x04b0('0x3c')][_0x04b0('0x43')](_0x3fe9cf[_0x04b0('0x44')],{})[_0x04b0('0x22')](respondWithResult(_0x3cfb09,0xc9))[_0x04b0('0x3f')](handleError(_0x3cfb09,null));};exports[_0x04b0('0x21')]=function(_0xbf2122,_0x5093c7){if(_0xbf2122[_0x04b0('0x44')]['id']){delete _0xbf2122[_0x04b0('0x44')]['id'];}return db[_0x04b0('0x3c')]['find']({'where':{'id':_0xbf2122[_0x04b0('0x41')]['id']}})[_0x04b0('0x22')](handleEntityNotFound(_0x5093c7,null))[_0x04b0('0x22')](saveUpdates(_0xbf2122['body'],null))[_0x04b0('0x22')](respondWithResult(_0x5093c7,null))[_0x04b0('0x3f')](handleError(_0x5093c7,null));};exports[_0x04b0('0x23')]=function(_0x5450aa,_0x42ad93){return db['SquareMessage'][_0x04b0('0x45')]({'where':{'id':_0x5450aa[_0x04b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x42ad93,null))[_0x04b0('0x22')](removeEntity(_0x42ad93,null))[_0x04b0('0x3f')](handleError(_0x42ad93,null));}; \ No newline at end of file +var _0xfdcc=['sort','filter','where','map','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','squel','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','name','send','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xfdcc,0x93));var _0xcfdc=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0xfdcc[_0x31bab3];return _0x4fd382;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcfdc('0x0'));var rimraf=require(_0xcfdc('0x1'));var zipdir=require(_0xcfdc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcfdc('0x3'));var moment=require(_0xcfdc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcfdc('0x5'));var util=require(_0xcfdc('0x6'));var path=require(_0xcfdc('0x7'));var sox=require(_0xcfdc('0x8'));var csv=require('to-csv');var ejs=require(_0xcfdc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcfdc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcfdc('0xb'));var querystring=require(_0xcfdc('0xc'));var Papa=require(_0xcfdc('0xd'));var Redis=require(_0xcfdc('0xe'));var authService=require(_0xcfdc('0xf'));var qs=require(_0xcfdc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xcfdc('0x11'));var config=require('../../config/environment');var db=require(_0xcfdc('0x12'))['db'];function respondWithStatusCode(_0x1ab7b3,_0x2d2397){_0x2d2397=_0x2d2397||0xcc;return function(_0x2e29f6){if(_0x2e29f6){return _0x1ab7b3[_0xcfdc('0x13')](_0x2d2397);}return _0x1ab7b3[_0xcfdc('0x14')](_0x2d2397)['end']();};}function respondWithResult(_0x4a5337,_0x2065bb){_0x2065bb=_0x2065bb||0xc8;return function(_0x1195d6){if(_0x1195d6){return _0x4a5337['status'](_0x2065bb)[_0xcfdc('0x15')](_0x1195d6);}};}function respondWithFilteredResult(_0x3559b9,_0x36f58f){return function(_0xc7d70b){if(_0xc7d70b){var _0x363548=_0xc7d70b[_0xcfdc('0x16')],_0x5f116d=_0x36f58f[_0xcfdc('0x17')],_0xbd66e9=_0x36f58f[_0xcfdc('0x17')]+_0x36f58f[_0xcfdc('0x18')],_0x21b304;if(_0xbd66e9>=_0x363548){_0xbd66e9=_0x363548;_0x21b304=0xc8;}else{_0x21b304=0xce;}_0x3559b9[_0xcfdc('0x14')](_0x21b304);return _0x3559b9['set'](_0xcfdc('0x19'),_0x5f116d+'-'+_0xbd66e9+'/'+_0x363548)[_0xcfdc('0x15')](_0xc7d70b);}return null;};}function patchUpdates(_0x3f427e){return function(_0x38c734){try{jsonpatch['apply'](_0x38c734,_0x3f427e,!![]);}catch(_0x5f3c5d){return BPromise[_0xcfdc('0x1a')](_0x5f3c5d);}return _0x38c734[_0xcfdc('0x1b')]();};}function saveUpdates(_0x667e84,_0x5791df){return function(_0x4d2025){if(_0x4d2025){return _0x4d2025[_0xcfdc('0x1c')](_0x667e84)[_0xcfdc('0x1d')](function(_0x2097b8){return _0x2097b8;});}return null;};}function removeEntity(_0x5e09c5,_0x4de32c){return function(_0x363fdb){if(_0x363fdb){return _0x363fdb[_0xcfdc('0x1e')]()[_0xcfdc('0x1d')](function(){_0x5e09c5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cb352,_0x38171e){return function(_0x396f35){if(!_0x396f35){_0x2cb352[_0xcfdc('0x13')](0x194);}return _0x396f35;};}function handleError(_0x3994df,_0x23bb84){_0x23bb84=_0x23bb84||0x1f4;return function(_0x186827){logger[_0xcfdc('0x1f')](_0x186827['stack']);if(_0x186827[_0xcfdc('0x20')]){delete _0x186827['name'];}_0x3994df[_0xcfdc('0x14')](_0x23bb84)[_0xcfdc('0x21')](_0x186827);};}exports['index']=function(_0x57c83c,_0x4b7a27){var _0x5adced={},_0x3f5ab9={},_0x5c3abc={'count':0x0,'rows':[]};var _0x5e7043=_['map'](db[_0xcfdc('0x22')][_0xcfdc('0x23')],function(_0x10d357){return{'name':_0x10d357[_0xcfdc('0x24')],'type':_0x10d357[_0xcfdc('0x25')][_0xcfdc('0x26')]};});_0x3f5ab9[_0xcfdc('0x27')]=_['map'](_0x5e7043,'name');_0x3f5ab9[_0xcfdc('0x28')]=_[_0xcfdc('0x29')](_0x57c83c['query']);_0x3f5ab9[_0xcfdc('0x2a')]=_[_0xcfdc('0x2b')](_0x3f5ab9[_0xcfdc('0x27')],_0x3f5ab9[_0xcfdc('0x28')]);_0x5adced['attributes']=_['intersection'](_0x3f5ab9[_0xcfdc('0x27')],qs[_0xcfdc('0x2c')](_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x2c')]));_0x5adced[_0xcfdc('0x2d')]=_0x5adced[_0xcfdc('0x2d')]['length']?_0x5adced[_0xcfdc('0x2d')]:_0x3f5ab9[_0xcfdc('0x27')];if(!_0x57c83c[_0xcfdc('0x28')]['hasOwnProperty'](_0xcfdc('0x2e'))){_0x5adced[_0xcfdc('0x18')]=qs[_0xcfdc('0x18')](_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x18')]);_0x5adced[_0xcfdc('0x17')]=qs[_0xcfdc('0x17')](_0x57c83c['query']['offset']);}_0x5adced[_0xcfdc('0x2f')]=qs[_0xcfdc('0x30')](_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x30')]);_0x5adced['where']=qs['filters'](_['pick'](_0x57c83c[_0xcfdc('0x28')],_0x3f5ab9[_0xcfdc('0x2a')]),_0x5e7043);if(_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x31')]){_0x5adced[_0xcfdc('0x32')]=_['merge'](_0x5adced[_0xcfdc('0x32')],{'$or':_[_0xcfdc('0x33')](_0x5e7043,function(_0x44363b){if(_0x44363b[_0xcfdc('0x25')]!=='VIRTUAL'){var _0x1c7739={};_0x1c7739[_0x44363b[_0xcfdc('0x20')]]={'$like':'%'+_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x31')]+'%'};return _0x1c7739;}})});}_0x5adced=_[_0xcfdc('0x34')]({},_0x5adced,_0x57c83c[_0xcfdc('0x35')]);var _0x555df9={'where':_0x5adced[_0xcfdc('0x32')]};return db[_0xcfdc('0x22')][_0xcfdc('0x16')](_0x555df9)[_0xcfdc('0x1d')](function(_0x2fbeb7){_0x5c3abc[_0xcfdc('0x16')]=_0x2fbeb7;if(_0x57c83c[_0xcfdc('0x28')][_0xcfdc('0x36')]){_0x5adced[_0xcfdc('0x37')]=[{'all':!![]}];}return db['SquareMessage'][_0xcfdc('0x38')](_0x5adced);})['then'](function(_0x1e0366){_0x5c3abc[_0xcfdc('0x39')]=_0x1e0366;return _0x5c3abc;})[_0xcfdc('0x1d')](respondWithFilteredResult(_0x4b7a27,_0x5adced))[_0xcfdc('0x3a')](handleError(_0x4b7a27,null));};exports[_0xcfdc('0x3b')]=function(_0x4504cc,_0x2e92b0){var _0x15f0b0={'raw':!![],'where':{'id':_0x4504cc[_0xcfdc('0x3c')]['id']}},_0x4103ae={};_0x4103ae[_0xcfdc('0x27')]=_[_0xcfdc('0x29')](db[_0xcfdc('0x22')][_0xcfdc('0x23')]);_0x4103ae[_0xcfdc('0x28')]=_[_0xcfdc('0x29')](_0x4504cc[_0xcfdc('0x28')]);_0x4103ae['filters']=_[_0xcfdc('0x2b')](_0x4103ae[_0xcfdc('0x27')],_0x4103ae[_0xcfdc('0x28')]);_0x15f0b0[_0xcfdc('0x2d')]=_['intersection'](_0x4103ae[_0xcfdc('0x27')],qs[_0xcfdc('0x2c')](_0x4504cc[_0xcfdc('0x28')]['fields']));_0x15f0b0['attributes']=_0x15f0b0[_0xcfdc('0x2d')][_0xcfdc('0x3d')]?_0x15f0b0['attributes']:_0x4103ae[_0xcfdc('0x27')];if(_0x4504cc[_0xcfdc('0x28')][_0xcfdc('0x36')]){_0x15f0b0[_0xcfdc('0x37')]=[{'all':!![]}];}_0x15f0b0=_['merge']({},_0x15f0b0,_0x4504cc[_0xcfdc('0x35')]);return db[_0xcfdc('0x22')][_0xcfdc('0x3e')](_0x15f0b0)['then'](handleEntityNotFound(_0x2e92b0,null))['then'](respondWithResult(_0x2e92b0,null))[_0xcfdc('0x3a')](handleError(_0x2e92b0,null));};exports[_0xcfdc('0x3f')]=function(_0xd13156,_0x21beda){return db['SquareMessage'][_0xcfdc('0x3f')](_0xd13156[_0xcfdc('0x40')],{})[_0xcfdc('0x1d')](respondWithResult(_0x21beda,0xc9))[_0xcfdc('0x3a')](handleError(_0x21beda,null));};exports[_0xcfdc('0x1c')]=function(_0x581b44,_0x629324){if(_0x581b44[_0xcfdc('0x40')]['id']){delete _0x581b44[_0xcfdc('0x40')]['id'];}return db[_0xcfdc('0x22')][_0xcfdc('0x3e')]({'where':{'id':_0x581b44[_0xcfdc('0x3c')]['id']}})[_0xcfdc('0x1d')](handleEntityNotFound(_0x629324,null))[_0xcfdc('0x1d')](saveUpdates(_0x581b44['body'],null))[_0xcfdc('0x1d')](respondWithResult(_0x629324,null))[_0xcfdc('0x3a')](handleError(_0x629324,null));};exports[_0xcfdc('0x1e')]=function(_0x25278a,_0x2e1ed3){return db[_0xcfdc('0x22')][_0xcfdc('0x3e')]({'where':{'id':_0x25278a[_0xcfdc('0x3c')]['id']}})[_0xcfdc('0x1d')](handleEntityNotFound(_0x2e1ed3,null))[_0xcfdc('0x1d')](removeEntity(_0x2e1ed3,null))[_0xcfdc('0x3a')](handleError(_0x2e1ed3,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6b8bd55..9d14505 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 _0x2675=['lodash','moment','bluebird','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x113bc1,_0x200ad4){var _0x39abbe=function(_0x5053d6){while(--_0x5053d6){_0x113bc1['push'](_0x113bc1['shift']());}};_0x39abbe(++_0x200ad4);}(_0x2675,0x75));var _0x5267=function(_0x1da8e9,_0x8fc6bb){_0x1da8e9=_0x1da8e9-0x0;var _0x46eab5=_0x2675[_0x1da8e9];return _0x46eab5;};'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':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['../../config/environment','exports','define','SquareMessage','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x16938f,_0x35e57f){var _0x5c66e9=function(_0x5167d7){while(--_0x5167d7){_0x16938f['push'](_0x16938f['shift']());}};_0x5c66e9(++_0x35e57f);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./squareMessage.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'square_messages','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 5058f22..ef1b33d 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 _0x1115=['CreateSquareMessage','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','info','result','SquareMessage','create','body','options','raw'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1115,0x1b6));var _0x5111=function(_0x59cd10,_0x5c644b){_0x59cd10=_0x59cd10-0x0;var _0x5f10fe=_0x1115[_0x59cd10];return _0x5f10fe;};'use strict';var _=require('lodash');var util=require(_0x5111('0x0'));var moment=require(_0x5111('0x1'));var BPromise=require(_0x5111('0x2'));var rs=require(_0x5111('0x3'));var fs=require('fs');var Redis=require(_0x5111('0x4'));var db=require(_0x5111('0x5'))['db'];var utils=require(_0x5111('0x6'));var logger=require(_0x5111('0x7'))(_0x5111('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5111('0x9')][_0x5111('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50f0a3,_0x400661,_0x2d2777){return new BPromise(function(_0x54d5ae,_0x42a3c5){return client['request'](_0x50f0a3,_0x2d2777)[_0x5111('0xb')](function(_0x3bbc8c){logger['info']('SquareMessage,\x20%s,\x20%s',_0x400661,_0x5111('0xc'));logger['debug'](_0x5111('0xd'),_0x400661,'request\x20sent',JSON[_0x5111('0xe')](_0x3bbc8c));if(_0x3bbc8c[_0x5111('0xf')]){if(_0x3bbc8c[_0x5111('0xf')][_0x5111('0x10')]===0x1f4){logger[_0x5111('0xf')](_0x5111('0x11'),_0x400661,_0x3bbc8c[_0x5111('0xf')][_0x5111('0x12')]);return _0x42a3c5(_0x3bbc8c[_0x5111('0xf')][_0x5111('0x12')]);}logger[_0x5111('0xf')](_0x5111('0x11'),_0x400661,_0x3bbc8c[_0x5111('0xf')][_0x5111('0x12')]);return _0x54d5ae(_0x3bbc8c[_0x5111('0xf')][_0x5111('0x12')]);}else{logger[_0x5111('0x13')](_0x5111('0x11'),_0x400661,'request\x20sent');_0x54d5ae(_0x3bbc8c[_0x5111('0x14')]['message']);}})['catch'](function(_0x387e1e){logger[_0x5111('0xf')](_0x5111('0x11'),_0x400661,_0x387e1e);_0x42a3c5(_0x387e1e);});});}exports['CreateSquareMessage']=function(_0x367f8d){var _0xa3f4ba=this;return new Promise(function(_0x52c614,_0x204c4f){return db[_0x5111('0x15')][_0x5111('0x16')](_0x367f8d[_0x5111('0x17')],{'raw':_0x367f8d['options']?_0x367f8d[_0x5111('0x18')][_0x5111('0x19')]===undefined?!![]:![]:!![]})[_0x5111('0xb')](function(_0x1b3136){logger[_0x5111('0x13')](_0x5111('0x1a'),_0x367f8d);logger[_0x5111('0x1b')](_0x5111('0x1a'),_0x367f8d,JSON[_0x5111('0xe')](_0x1b3136));_0x52c614(_0x1b3136);})[_0x5111('0x1c')](function(_0x4b73ce){logger[_0x5111('0xf')](_0x5111('0x1a'),_0x4b73ce[_0x5111('0x12')],_0x367f8d);_0x204c4f(_0xa3f4ba['error'](0x1f4,_0x4b73ce[_0x5111('0x12')]));});});}; \ No newline at end of file +var _0xa46e=['info','result','catch','SquareMessage','create','options','raw','CreateSquareMessage','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','message','SquareMessage,\x20%s,\x20%s'];(function(_0x45f42e,_0x417bb){var _0x5704b6=function(_0x4d1621){while(--_0x4d1621){_0x45f42e['push'](_0x45f42e['shift']());}};_0x5704b6(++_0x417bb);}(_0xa46e,0x8a));var _0xea46=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0xa46e[_0x57add2];return _0x4e3670;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('SquareMessage,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('SquareMessage,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('SquareMessage,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});}exports['CreateSquareMessage']=function(_0x19d5c1){var _0x3f463d=this;return new Promise(function(_0x5cf5dd,_0x4b6745){return db[_0xea46('0x15')][_0xea46('0x16')](_0x19d5c1['body'],{'raw':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![]})[_0xea46('0xa')](function(_0x53b8db){logger[_0xea46('0x12')]('CreateSquareMessage',_0x19d5c1);logger['debug'](_0xea46('0x19'),_0x19d5c1,JSON['stringify'](_0x53b8db));_0x5cf5dd(_0x53b8db);})['catch'](function(_0x5064d8){logger[_0xea46('0xe')](_0xea46('0x19'),_0x5064d8[_0xea46('0x10')],_0x19d5c1);_0x4b6745(_0x3f463d['error'](0x1f4,_0x5064d8[_0xea46('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 85f93df..251baa8 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 _0xd720=['Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x4e0edd,_0x536c32){var _0x4cabad=function(_0x47e5ae){while(--_0x47e5ae){_0x4e0edd['push'](_0x4e0edd['shift']());}};_0x4cabad(++_0x536c32);}(_0xd720,0x8f));var _0x0d72=function(_0x40eb86,_0x35fd71){_0x40eb86=_0x40eb86-0x0;var _0x187e1c=_0xd720[_0x40eb86];return _0x187e1c;};'use strict';var multer=require('multer');var util=require(_0x0d72('0x0'));var path=require(_0x0d72('0x1'));var timeout=require(_0x0d72('0x2'));var express=require(_0x0d72('0x3'));var router=express[_0x0d72('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0d72('0x5'));var config=require(_0x0d72('0x6'));var controller=require(_0x0d72('0x7'));router[_0x0d72('0x8')]('/',auth[_0x0d72('0x9')](),controller[_0x0d72('0xa')]);router['get'](_0x0d72('0xb'),auth[_0x0d72('0x9')](),controller[_0x0d72('0xc')]);router[_0x0d72('0x8')](_0x0d72('0xd'),auth[_0x0d72('0x9')](),timeout(_0x0d72('0xe')),controller[_0x0d72('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0d72('0x10')]);router[_0x0d72('0x11')](_0x0d72('0xb'),auth[_0x0d72('0x9')](),controller[_0x0d72('0x12')]);router['delete'](_0x0d72('0xb'),auth['isAuthenticated'](),controller[_0x0d72('0x13')]);module[_0x0d72('0x14')]=router; \ No newline at end of file +var _0x8f9f=['15s','test','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','/:id','show','get','/:id/test'];(function(_0x24c45d,_0xce99f8){var _0x1f2fe0=function(_0x468a8c){while(--_0x468a8c){_0x24c45d['push'](_0x24c45d['shift']());}};_0x1f2fe0(++_0xce99f8);}(_0x8f9f,0xbf));var _0xf8f9=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x8f9f[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0xf8f9('0x0'));var util=require(_0xf8f9('0x1'));var path=require(_0xf8f9('0x2'));var timeout=require(_0xf8f9('0x3'));var express=require(_0xf8f9('0x4'));var router=express[_0xf8f9('0x5')]();var auth=require(_0xf8f9('0x6'));var interaction=require(_0xf8f9('0x7'));var config=require(_0xf8f9('0x8'));var controller=require(_0xf8f9('0x9'));router['get']('/',auth[_0xf8f9('0xa')](),controller[_0xf8f9('0xb')]);router['get'](_0xf8f9('0xc'),auth[_0xf8f9('0xa')](),controller[_0xf8f9('0xd')]);router[_0xf8f9('0xe')](_0xf8f9('0xf'),auth[_0xf8f9('0xa')](),timeout(_0xf8f9('0x10')),controller[_0xf8f9('0x11')]);router[_0xf8f9('0x12')]('/',auth['isAuthenticated'](),controller[_0xf8f9('0x13')]);router[_0xf8f9('0x14')](_0xf8f9('0xc'),auth['isAuthenticated'](),controller[_0xf8f9('0x15')]);router['delete'](_0xf8f9('0xc'),auth[_0xf8f9('0xa')](),controller[_0xf8f9('0x16')]);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 4c42f69..268e04a 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 _0x5fef=['name','sequelize','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5fef,0xa9));var _0xf5fe=function(_0x4cdac6,_0x71ab3d){_0x4cdac6=_0x4cdac6-0x0;var _0x37de73=_0x5fef[_0x4cdac6];return _0x37de73;};'use strict';var Sequelize=require(_0xf5fe('0x0'));module['exports']={'name':{'type':Sequelize[_0xf5fe('0x1')],'unique':_0xf5fe('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf5fe('0x1')]},'description':{'type':Sequelize[_0xf5fe('0x1')]}}; \ No newline at end of file +var _0x8944=['name','sequelize','exports','STRING'];(function(_0x190ff6,_0x515cfd){var _0x5356d2=function(_0x2cf77c){while(--_0x2cf77c){_0x190ff6['push'](_0x190ff6['shift']());}};_0x5356d2(++_0x515cfd);}(_0x8944,0x1ed));var _0x4894=function(_0x341c34,_0x59d114){_0x341c34=_0x341c34-0x0;var _0x222581=_0x8944[_0x341c34];return _0x222581;};'use strict';var Sequelize=require(_0x4894('0x0'));module[_0x4894('0x1')]={'name':{'type':Sequelize[_0x4894('0x2')],'unique':_0x4894('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4894('0x2')]},'description':{'type':Sequelize[_0x4894('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 31148da..e3e83ab 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 _0xcbbb=['dsn','odbc','closeSync','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','then','destroy','ODBC','UserProfileResource','stack','name','index','map','SquareOdbc','fieldName','type','key','model','query','keys','intersection','attributes','length','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','update','test'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0xcbbb,0x147));var _0xbcbb=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0xcbbb[_0x5a2285];return _0x48f6ed;};'use strict';var pdf=require(_0xbcbb('0x0'));var emlformat=require(_0xbcbb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbcbb('0x2'));var jsonpatch=require(_0xbcbb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbcbb('0x4'));var Mustache=require(_0xbcbb('0x5'));var util=require(_0xbcbb('0x6'));var path=require(_0xbcbb('0x7'));var sox=require(_0xbcbb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xbcbb('0x9'));var squel=require(_0xbcbb('0xa'));var crypto=require(_0xbcbb('0xb'));var jsforce=require(_0xbcbb('0xc'));var deskjs=require(_0xbcbb('0xd'));var toCsv=require(_0xbcbb('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbcbb('0xf'));var authService=require(_0xbcbb('0x10'));var qs=require(_0xbcbb('0x11'));var as=require(_0xbcbb('0x12'));var hardwareService=require(_0xbcbb('0x13'));var logger=require('../../config/logger')(_0xbcbb('0x14'));var utils=require(_0xbcbb('0x15'));var config=require('../../config/environment');var db=require(_0xbcbb('0x16'))['db'];function respondWithStatusCode(_0x2d1353,_0x46ff1c){_0x46ff1c=_0x46ff1c||0xcc;return function(_0x435941){if(_0x435941){return _0x2d1353[_0xbcbb('0x17')](_0x46ff1c);}return _0x2d1353[_0xbcbb('0x18')](_0x46ff1c)[_0xbcbb('0x19')]();};}function respondWithResult(_0x30d165,_0x3df624){_0x3df624=_0x3df624||0xc8;return function(_0x5d110e){if(_0x5d110e){return _0x30d165[_0xbcbb('0x18')](_0x3df624)[_0xbcbb('0x1a')](_0x5d110e);}};}function respondWithFilteredResult(_0x4efaed,_0x35b16b){return function(_0x1899cc){if(_0x1899cc){var _0x32a795=_0x1899cc[_0xbcbb('0x1b')],_0x4c0d82=_0x35b16b[_0xbcbb('0x1c')],_0x4aa633=_0x35b16b[_0xbcbb('0x1c')]+_0x35b16b['limit'],_0x1ea7bf;if(_0x4aa633>=_0x32a795){_0x4aa633=_0x32a795;_0x1ea7bf=0xc8;}else{_0x1ea7bf=0xce;}_0x4efaed[_0xbcbb('0x18')](_0x1ea7bf);return _0x4efaed['set'](_0xbcbb('0x1d'),_0x4c0d82+'-'+_0x4aa633+'/'+_0x32a795)[_0xbcbb('0x1a')](_0x1899cc);}return null;};}function patchUpdates(_0x450c80){return function(_0x185886){try{jsonpatch[_0xbcbb('0x1e')](_0x185886,_0x450c80,!![]);}catch(_0x3b0a75){return BPromise[_0xbcbb('0x1f')](_0x3b0a75);}return _0x185886['save']();};}function saveUpdates(_0x331986,_0x4a6c52){return function(_0x1edb05){if(_0x1edb05){return _0x1edb05['update'](_0x331986)[_0xbcbb('0x20')](function(_0x178643){return _0x178643;});}return null;};}function removeEntity(_0xb933f9,_0x1c286e){return function(_0xc8e44a){if(_0xc8e44a){return _0xc8e44a[_0xbcbb('0x21')]()[_0xbcbb('0x20')](function(){var _0x260d16=_0xc8e44a['get']({'plain':!![]});var _0x35ec0f=_0xbcbb('0x22');return db[_0xbcbb('0x23')][_0xbcbb('0x21')]({'where':{'type':_0x35ec0f,'resourceId':_0x260d16['id']}})[_0xbcbb('0x20')](function(){return _0xc8e44a;});})[_0xbcbb('0x20')](function(){_0xb933f9[_0xbcbb('0x18')](0xcc)[_0xbcbb('0x19')]();});}};}function handleEntityNotFound(_0x1828c7,_0x476a80){return function(_0x2a2603){if(!_0x2a2603){_0x1828c7['sendStatus'](0x194);}return _0x2a2603;};}function handleError(_0x28a8c6,_0x4d9326){_0x4d9326=_0x4d9326||0x1f4;return function(_0x198cc1){logger['error'](_0x198cc1[_0xbcbb('0x24')]);if(_0x198cc1[_0xbcbb('0x25')]){delete _0x198cc1[_0xbcbb('0x25')];}_0x28a8c6[_0xbcbb('0x18')](_0x4d9326)['send'](_0x198cc1);};}exports[_0xbcbb('0x26')]=function(_0x44dd0d,_0x4efc35){var _0x252bcc={},_0x57b6fa={},_0x5474d8={'count':0x0,'rows':[]};var _0x549f32=_[_0xbcbb('0x27')](db[_0xbcbb('0x28')]['rawAttributes'],function(_0x4f9b0d){return{'name':_0x4f9b0d[_0xbcbb('0x29')],'type':_0x4f9b0d[_0xbcbb('0x2a')][_0xbcbb('0x2b')]};});_0x57b6fa[_0xbcbb('0x2c')]=_['map'](_0x549f32,_0xbcbb('0x25'));_0x57b6fa[_0xbcbb('0x2d')]=_[_0xbcbb('0x2e')](_0x44dd0d[_0xbcbb('0x2d')]);_0x57b6fa['filters']=_[_0xbcbb('0x2f')](_0x57b6fa[_0xbcbb('0x2c')],_0x57b6fa[_0xbcbb('0x2d')]);_0x252bcc[_0xbcbb('0x30')]=_['intersection'](_0x57b6fa[_0xbcbb('0x2c')],qs['fields'](_0x44dd0d[_0xbcbb('0x2d')]['fields']));_0x252bcc['attributes']=_0x252bcc[_0xbcbb('0x30')][_0xbcbb('0x31')]?_0x252bcc[_0xbcbb('0x30')]:_0x57b6fa[_0xbcbb('0x2c')];if(!_0x44dd0d[_0xbcbb('0x2d')]['hasOwnProperty']('nolimit')){_0x252bcc[_0xbcbb('0x32')]=qs[_0xbcbb('0x32')](_0x44dd0d[_0xbcbb('0x2d')][_0xbcbb('0x32')]);_0x252bcc[_0xbcbb('0x1c')]=qs[_0xbcbb('0x1c')](_0x44dd0d[_0xbcbb('0x2d')][_0xbcbb('0x1c')]);}_0x252bcc[_0xbcbb('0x33')]=qs['sort'](_0x44dd0d[_0xbcbb('0x2d')][_0xbcbb('0x34')]);_0x252bcc[_0xbcbb('0x35')]=qs['filters'](_[_0xbcbb('0x36')](_0x44dd0d[_0xbcbb('0x2d')],_0x57b6fa[_0xbcbb('0x37')]),_0x549f32);if(_0x44dd0d[_0xbcbb('0x2d')][_0xbcbb('0x38')]){_0x252bcc['where']=_[_0xbcbb('0x39')](_0x252bcc['where'],{'$or':_[_0xbcbb('0x27')](_0x549f32,function(_0x2397e3){if(_0x2397e3[_0xbcbb('0x2a')]!==_0xbcbb('0x3a')){var _0x4df063={};_0x4df063[_0x2397e3[_0xbcbb('0x25')]]={'$like':'%'+_0x44dd0d[_0xbcbb('0x2d')][_0xbcbb('0x38')]+'%'};return _0x4df063;}})});}_0x252bcc=_[_0xbcbb('0x39')]({},_0x252bcc,_0x44dd0d[_0xbcbb('0x3b')]);var _0x5b125f={'where':_0x252bcc[_0xbcbb('0x35')]};return db[_0xbcbb('0x28')][_0xbcbb('0x1b')](_0x5b125f)['then'](function(_0x5b347a){_0x5474d8[_0xbcbb('0x1b')]=_0x5b347a;if(_0x44dd0d[_0xbcbb('0x2d')][_0xbcbb('0x3c')]){_0x252bcc[_0xbcbb('0x3d')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x252bcc);})[_0xbcbb('0x20')](function(_0xead37d){_0x5474d8['rows']=_0xead37d;return _0x5474d8;})[_0xbcbb('0x20')](respondWithFilteredResult(_0x4efc35,_0x252bcc))[_0xbcbb('0x3e')](handleError(_0x4efc35,null));};exports[_0xbcbb('0x3f')]=function(_0x412189,_0x1e4ec4){var _0x2615b1={'raw':!![],'where':{'id':_0x412189[_0xbcbb('0x40')]['id']}},_0x398ce9={};_0x398ce9['model']=_[_0xbcbb('0x2e')](db[_0xbcbb('0x28')][_0xbcbb('0x41')]);_0x398ce9[_0xbcbb('0x2d')]=_[_0xbcbb('0x2e')](_0x412189[_0xbcbb('0x2d')]);_0x398ce9['filters']=_[_0xbcbb('0x2f')](_0x398ce9[_0xbcbb('0x2c')],_0x398ce9['query']);_0x2615b1['attributes']=_['intersection'](_0x398ce9[_0xbcbb('0x2c')],qs[_0xbcbb('0x42')](_0x412189['query']['fields']));_0x2615b1[_0xbcbb('0x30')]=_0x2615b1[_0xbcbb('0x30')][_0xbcbb('0x31')]?_0x2615b1[_0xbcbb('0x30')]:_0x398ce9[_0xbcbb('0x2c')];if(_0x412189['query'][_0xbcbb('0x3c')]){_0x2615b1[_0xbcbb('0x3d')]=[{'all':!![]}];}_0x2615b1=_['merge']({},_0x2615b1,_0x412189[_0xbcbb('0x3b')]);return db[_0xbcbb('0x28')][_0xbcbb('0x43')](_0x2615b1)[_0xbcbb('0x20')](handleEntityNotFound(_0x1e4ec4,null))[_0xbcbb('0x20')](respondWithResult(_0x1e4ec4,null))[_0xbcbb('0x3e')](handleError(_0x1e4ec4,null));};exports[_0xbcbb('0x44')]=function(_0x275d6b,_0x531766){return db['SquareOdbc'][_0xbcbb('0x44')](_0x275d6b[_0xbcbb('0x45')],{})[_0xbcbb('0x20')](function(_0x3edb8a){var _0x12d35d=_0x275d6b[_0xbcbb('0x46')][_0xbcbb('0x47')]({'plain':!![]});if(!_0x12d35d)throw new Error(_0xbcbb('0x48'));if(_0x12d35d[_0xbcbb('0x49')]===_0xbcbb('0x46')){var _0x5300fa=_0x3edb8a[_0xbcbb('0x47')]({'plain':!![]});var _0x59eeeb='ODBC';return db[_0xbcbb('0x4a')][_0xbcbb('0x43')]({'where':{'name':_0x59eeeb,'userProfileId':_0x12d35d['userProfileId']},'raw':!![]})[_0xbcbb('0x20')](function(_0x32d5a3){if(_0x32d5a3&&_0x32d5a3['autoAssociation']===0x0){return db['UserProfileResource'][_0xbcbb('0x44')]({'name':_0x5300fa[_0xbcbb('0x25')],'resourceId':_0x5300fa['id'],'type':_0x32d5a3[_0xbcbb('0x25')],'sectionId':_0x32d5a3['id']},{})['then'](function(){return _0x3edb8a;});}else{return _0x3edb8a;}})[_0xbcbb('0x3e')](function(_0x1a53f0){logger[_0xbcbb('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a53f0);throw _0x1a53f0;});}return _0x3edb8a;})[_0xbcbb('0x20')](respondWithResult(_0x531766,0xc9))[_0xbcbb('0x3e')](handleError(_0x531766,null));};exports[_0xbcbb('0x4c')]=function(_0x148872,_0x3e804c){if(_0x148872['body']['id']){delete _0x148872[_0xbcbb('0x45')]['id'];}return db[_0xbcbb('0x28')][_0xbcbb('0x43')]({'where':{'id':_0x148872[_0xbcbb('0x40')]['id']}})[_0xbcbb('0x20')](handleEntityNotFound(_0x3e804c,null))[_0xbcbb('0x20')](saveUpdates(_0x148872[_0xbcbb('0x45')],null))[_0xbcbb('0x20')](respondWithResult(_0x3e804c,null))[_0xbcbb('0x3e')](handleError(_0x3e804c,null));};exports[_0xbcbb('0x21')]=function(_0x46f9c5,_0x11c8a9){return db[_0xbcbb('0x28')]['find']({'where':{'id':_0x46f9c5[_0xbcbb('0x40')]['id']}})[_0xbcbb('0x20')](handleEntityNotFound(_0x11c8a9,null))[_0xbcbb('0x20')](removeEntity(_0x11c8a9,null))[_0xbcbb('0x3e')](handleError(_0x11c8a9,null));};exports[_0xbcbb('0x4d')]=function(_0x299356,_0x3912c1,_0x24953b){var _0x28403e;return db[_0xbcbb('0x28')][_0xbcbb('0x43')]({'where':{'id':_0x299356[_0xbcbb('0x40')]['id']},'attributes':['id',_0xbcbb('0x4e')]})[_0xbcbb('0x20')](handleEntityNotFound(_0x3912c1,null))['then'](function(_0x1820af){if(_0x1820af){var _0x6188bd=require(_0xbcbb('0x4f'))();_0x6188bd['openSync'](_0x1820af['dsn']);_0x6188bd[_0xbcbb('0x50')]();return _0x1820af;}})[_0xbcbb('0x20')](respondWithResult(_0x3912c1,null))[_0xbcbb('0x3e')](handleError(_0x3912c1,null));}; \ No newline at end of file +var _0x7b9e=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','dsn','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','ODBC','error','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x577c8d,_0x420561){var _0x5c7f0d=function(_0x44abef){while(--_0x44abef){_0x577c8d['push'](_0x577c8d['shift']());}};_0x5c7f0d(++_0x420561);}(_0x7b9e,0xdc));var _0xe7b9=function(_0x44f725,_0x8221d2){_0x44f725=_0x44f725-0x0;var _0x315c33=_0x7b9e[_0x44f725];return _0x315c33;};'use strict';var pdf=require(_0xe7b9('0x0'));var emlformat=require(_0xe7b9('0x1'));var rimraf=require(_0xe7b9('0x2'));var zipdir=require(_0xe7b9('0x3'));var jsonpatch=require(_0xe7b9('0x4'));var rp=require(_0xe7b9('0x5'));var moment=require('moment');var BPromise=require(_0xe7b9('0x6'));var Mustache=require(_0xe7b9('0x7'));var util=require(_0xe7b9('0x8'));var path=require(_0xe7b9('0x9'));var sox=require(_0xe7b9('0xa'));var csv=require(_0xe7b9('0xb'));var ejs=require(_0xe7b9('0xc'));var fs=require('fs');var _=require(_0xe7b9('0xd'));var squel=require(_0xe7b9('0xe'));var crypto=require(_0xe7b9('0xf'));var jsforce=require(_0xe7b9('0x10'));var deskjs=require(_0xe7b9('0x11'));var toCsv=require(_0xe7b9('0xb'));var querystring=require('querystring');var Papa=require(_0xe7b9('0x12'));var Redis=require(_0xe7b9('0x13'));var authService=require(_0xe7b9('0x14'));var qs=require(_0xe7b9('0x15'));var as=require(_0xe7b9('0x16'));var hardwareService=require(_0xe7b9('0x17'));var logger=require(_0xe7b9('0x18'))(_0xe7b9('0x19'));var utils=require(_0xe7b9('0x1a'));var config=require(_0xe7b9('0x1b'));var db=require(_0xe7b9('0x1c'))['db'];function respondWithStatusCode(_0x38fd85,_0x503a26){_0x503a26=_0x503a26||0xcc;return function(_0x399cbf){if(_0x399cbf){return _0x38fd85[_0xe7b9('0x1d')](_0x503a26);}return _0x38fd85[_0xe7b9('0x1e')](_0x503a26)[_0xe7b9('0x1f')]();};}function respondWithResult(_0x548c32,_0x133944){_0x133944=_0x133944||0xc8;return function(_0x3f9d3f){if(_0x3f9d3f){return _0x548c32[_0xe7b9('0x1e')](_0x133944)[_0xe7b9('0x20')](_0x3f9d3f);}};}function respondWithFilteredResult(_0x31b2cf,_0x407b96){return function(_0x3dbb0d){if(_0x3dbb0d){var _0x2a23a9=_0x3dbb0d[_0xe7b9('0x21')],_0x417b4a=_0x407b96[_0xe7b9('0x22')],_0x48cdd6=_0x407b96[_0xe7b9('0x22')]+_0x407b96[_0xe7b9('0x23')],_0x41f81d;if(_0x48cdd6>=_0x2a23a9){_0x48cdd6=_0x2a23a9;_0x41f81d=0xc8;}else{_0x41f81d=0xce;}_0x31b2cf['status'](_0x41f81d);return _0x31b2cf[_0xe7b9('0x24')](_0xe7b9('0x25'),_0x417b4a+'-'+_0x48cdd6+'/'+_0x2a23a9)[_0xe7b9('0x20')](_0x3dbb0d);}return null;};}function patchUpdates(_0x431ad3){return function(_0x76ad44){try{jsonpatch[_0xe7b9('0x26')](_0x76ad44,_0x431ad3,!![]);}catch(_0x119225){return BPromise['reject'](_0x119225);}return _0x76ad44[_0xe7b9('0x27')]();};}function saveUpdates(_0x73167c,_0x5dc666){return function(_0xc7f7f){if(_0xc7f7f){return _0xc7f7f['update'](_0x73167c)[_0xe7b9('0x28')](function(_0x5d924a){return _0x5d924a;});}return null;};}function removeEntity(_0x12315e,_0xffe525){return function(_0x585ce5){if(_0x585ce5){return _0x585ce5[_0xe7b9('0x29')]()[_0xe7b9('0x28')](function(){var _0x1becfe=_0x585ce5[_0xe7b9('0x2a')]({'plain':!![]});var _0xc2bb7=_0xe7b9('0x2b');return db['UserProfileResource'][_0xe7b9('0x29')]({'where':{'type':_0xc2bb7,'resourceId':_0x1becfe['id']}})[_0xe7b9('0x28')](function(){return _0x585ce5;});})[_0xe7b9('0x28')](function(){_0x12315e[_0xe7b9('0x1e')](0xcc)[_0xe7b9('0x1f')]();});}};}function handleEntityNotFound(_0x682f3,_0x3dce68){return function(_0x1585af){if(!_0x1585af){_0x682f3[_0xe7b9('0x1d')](0x194);}return _0x1585af;};}function handleError(_0x3bc59d,_0x2c749f){_0x2c749f=_0x2c749f||0x1f4;return function(_0x2196b8){logger[_0xe7b9('0x2c')](_0x2196b8['stack']);if(_0x2196b8[_0xe7b9('0x2d')]){delete _0x2196b8[_0xe7b9('0x2d')];}_0x3bc59d['status'](_0x2c749f)[_0xe7b9('0x2e')](_0x2196b8);};}exports['index']=function(_0x107191,_0x5f258d){var _0x2c97b7={},_0x403358={},_0x10d210={'count':0x0,'rows':[]};var _0x7f6656=_[_0xe7b9('0x2f')](db[_0xe7b9('0x30')][_0xe7b9('0x31')],function(_0x15f748){return{'name':_0x15f748[_0xe7b9('0x32')],'type':_0x15f748[_0xe7b9('0x33')][_0xe7b9('0x34')]};});_0x403358['model']=_[_0xe7b9('0x2f')](_0x7f6656,_0xe7b9('0x2d'));_0x403358[_0xe7b9('0x35')]=_[_0xe7b9('0x36')](_0x107191['query']);_0x403358[_0xe7b9('0x37')]=_[_0xe7b9('0x38')](_0x403358[_0xe7b9('0x39')],_0x403358[_0xe7b9('0x35')]);_0x2c97b7['attributes']=_[_0xe7b9('0x38')](_0x403358[_0xe7b9('0x39')],qs['fields'](_0x107191[_0xe7b9('0x35')][_0xe7b9('0x3a')]));_0x2c97b7[_0xe7b9('0x3b')]=_0x2c97b7[_0xe7b9('0x3b')][_0xe7b9('0x3c')]?_0x2c97b7[_0xe7b9('0x3b')]:_0x403358[_0xe7b9('0x39')];if(!_0x107191['query'][_0xe7b9('0x3d')](_0xe7b9('0x3e'))){_0x2c97b7[_0xe7b9('0x23')]=qs[_0xe7b9('0x23')](_0x107191[_0xe7b9('0x35')][_0xe7b9('0x23')]);_0x2c97b7[_0xe7b9('0x22')]=qs[_0xe7b9('0x22')](_0x107191[_0xe7b9('0x35')][_0xe7b9('0x22')]);}_0x2c97b7[_0xe7b9('0x3f')]=qs[_0xe7b9('0x40')](_0x107191[_0xe7b9('0x35')][_0xe7b9('0x40')]);_0x2c97b7[_0xe7b9('0x41')]=qs[_0xe7b9('0x37')](_[_0xe7b9('0x42')](_0x107191[_0xe7b9('0x35')],_0x403358['filters']),_0x7f6656);if(_0x107191['query'][_0xe7b9('0x43')]){_0x2c97b7[_0xe7b9('0x41')]=_['merge'](_0x2c97b7[_0xe7b9('0x41')],{'$or':_[_0xe7b9('0x2f')](_0x7f6656,function(_0x43e151){if(_0x43e151[_0xe7b9('0x33')]!==_0xe7b9('0x44')){var _0x5e05f2={};_0x5e05f2[_0x43e151['name']]={'$like':'%'+_0x107191['query'][_0xe7b9('0x43')]+'%'};return _0x5e05f2;}})});}_0x2c97b7=_[_0xe7b9('0x45')]({},_0x2c97b7,_0x107191[_0xe7b9('0x46')]);var _0x176fcb={'where':_0x2c97b7[_0xe7b9('0x41')]};return db[_0xe7b9('0x30')][_0xe7b9('0x21')](_0x176fcb)[_0xe7b9('0x28')](function(_0x1804af){_0x10d210[_0xe7b9('0x21')]=_0x1804af;if(_0x107191[_0xe7b9('0x35')]['includeAll']){_0x2c97b7[_0xe7b9('0x47')]=[{'all':!![]}];}return db[_0xe7b9('0x30')][_0xe7b9('0x48')](_0x2c97b7);})[_0xe7b9('0x28')](function(_0x34a199){_0x10d210[_0xe7b9('0x49')]=_0x34a199;return _0x10d210;})['then'](respondWithFilteredResult(_0x5f258d,_0x2c97b7))['catch'](handleError(_0x5f258d,null));};exports[_0xe7b9('0x4a')]=function(_0x15ebdc,_0x30f612){var _0x820730={'raw':!![],'where':{'id':_0x15ebdc[_0xe7b9('0x4b')]['id']}},_0x20e138={};_0x20e138[_0xe7b9('0x39')]=_[_0xe7b9('0x36')](db[_0xe7b9('0x30')][_0xe7b9('0x31')]);_0x20e138[_0xe7b9('0x35')]=_[_0xe7b9('0x36')](_0x15ebdc[_0xe7b9('0x35')]);_0x20e138[_0xe7b9('0x37')]=_[_0xe7b9('0x38')](_0x20e138[_0xe7b9('0x39')],_0x20e138['query']);_0x820730['attributes']=_['intersection'](_0x20e138[_0xe7b9('0x39')],qs[_0xe7b9('0x3a')](_0x15ebdc[_0xe7b9('0x35')][_0xe7b9('0x3a')]));_0x820730[_0xe7b9('0x3b')]=_0x820730[_0xe7b9('0x3b')][_0xe7b9('0x3c')]?_0x820730[_0xe7b9('0x3b')]:_0x20e138[_0xe7b9('0x39')];if(_0x15ebdc['query'][_0xe7b9('0x4c')]){_0x820730[_0xe7b9('0x47')]=[{'all':!![]}];}_0x820730=_[_0xe7b9('0x45')]({},_0x820730,_0x15ebdc[_0xe7b9('0x46')]);return db[_0xe7b9('0x30')][_0xe7b9('0x4d')](_0x820730)['then'](handleEntityNotFound(_0x30f612,null))[_0xe7b9('0x28')](respondWithResult(_0x30f612,null))[_0xe7b9('0x4e')](handleError(_0x30f612,null));};exports[_0xe7b9('0x4f')]=function(_0x3e00d0,_0x4383cf){return db[_0xe7b9('0x30')]['create'](_0x3e00d0[_0xe7b9('0x50')],{})[_0xe7b9('0x28')](function(_0x1a9d3b){var _0x1af361=_0x3e00d0[_0xe7b9('0x51')][_0xe7b9('0x2a')]({'plain':!![]});if(!_0x1af361)throw new Error(_0xe7b9('0x52'));if(_0x1af361[_0xe7b9('0x53')]===_0xe7b9('0x51')){var _0xc00af8=_0x1a9d3b[_0xe7b9('0x2a')]({'plain':!![]});var _0x50d575=_0xe7b9('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x50d575,'userProfileId':_0x1af361[_0xe7b9('0x54')]},'raw':!![]})[_0xe7b9('0x28')](function(_0x351188){if(_0x351188&&_0x351188[_0xe7b9('0x55')]===0x0){return db[_0xe7b9('0x56')][_0xe7b9('0x4f')]({'name':_0xc00af8[_0xe7b9('0x2d')],'resourceId':_0xc00af8['id'],'type':_0x351188['name'],'sectionId':_0x351188['id']},{})[_0xe7b9('0x28')](function(){return _0x1a9d3b;});}else{return _0x1a9d3b;}})[_0xe7b9('0x4e')](function(_0x313639){logger[_0xe7b9('0x2c')](_0xe7b9('0x57'),_0x313639);throw _0x313639;});}return _0x1a9d3b;})[_0xe7b9('0x28')](respondWithResult(_0x4383cf,0xc9))[_0xe7b9('0x4e')](handleError(_0x4383cf,null));};exports[_0xe7b9('0x58')]=function(_0x4c3c8b,_0x502661){if(_0x4c3c8b['body']['id']){delete _0x4c3c8b[_0xe7b9('0x50')]['id'];}return db[_0xe7b9('0x30')][_0xe7b9('0x4d')]({'where':{'id':_0x4c3c8b[_0xe7b9('0x4b')]['id']}})[_0xe7b9('0x28')](handleEntityNotFound(_0x502661,null))['then'](saveUpdates(_0x4c3c8b[_0xe7b9('0x50')],null))['then'](respondWithResult(_0x502661,null))[_0xe7b9('0x4e')](handleError(_0x502661,null));};exports[_0xe7b9('0x29')]=function(_0x53bc28,_0x3ee471){return db[_0xe7b9('0x30')][_0xe7b9('0x4d')]({'where':{'id':_0x53bc28[_0xe7b9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3ee471,null))['then'](removeEntity(_0x3ee471,null))[_0xe7b9('0x4e')](handleError(_0x3ee471,null));};exports['test']=function(_0x2bbebc,_0x42fe1f,_0x52f317){var _0x220de2;return db[_0xe7b9('0x30')][_0xe7b9('0x4d')]({'where':{'id':_0x2bbebc[_0xe7b9('0x4b')]['id']},'attributes':['id',_0xe7b9('0x59')]})[_0xe7b9('0x28')](handleEntityNotFound(_0x42fe1f,null))[_0xe7b9('0x28')](function(_0x49f890){if(_0x49f890){var _0x2646a9=require('odbc')();_0x2646a9[_0xe7b9('0x5a')](_0x49f890[_0xe7b9('0x59')]);_0x2646a9[_0xe7b9('0x5b')]();return _0x49f890;}})[_0xe7b9('0x28')](respondWithResult(_0x42fe1f,null))[_0xe7b9('0x4e')](handleError(_0x42fe1f,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 77e6893..4b40467 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 _0x65a4=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','SquareOdbc','square_odbc','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65a4,0x166));var _0x465a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x65a4[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x465a('0x0'));var util=require(_0x465a('0x1'));var logger=require(_0x465a('0x2'))(_0x465a('0x3'));var moment=require(_0x465a('0x4'));var BPromise=require(_0x465a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x465a('0x6'));var rimraf=require('rimraf');var config=require(_0x465a('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x465a('0x8')]=function(_0x2d8378,_0x16dc5d){return _0x2d8378[_0x465a('0x9')](_0x465a('0xa'),attributes,{'tableName':_0x465a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd354=['api','moment','bluebird','request-promise','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','../../config/logger'];(function(_0x1e1c7e,_0x2a7390){var _0x21b358=function(_0x402cbe){while(--_0x402cbe){_0x1e1c7e['push'](_0x1e1c7e['shift']());}};_0x21b358(++_0x2a7390);}(_0xd354,0x1dd));var _0x4d35=function(_0x35eb4a,_0x435fea){_0x35eb4a=_0x35eb4a-0x0;var _0x122fee=_0xd354[_0x35eb4a];return _0x122fee;};'use strict';var _=require(_0x4d35('0x0'));var util=require(_0x4d35('0x1'));var logger=require(_0x4d35('0x2'))(_0x4d35('0x3'));var moment=require(_0x4d35('0x4'));var BPromise=require(_0x4d35('0x5'));var rp=require(_0x4d35('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4d35('0x7'));var attributes=require(_0x4d35('0x8'));module[_0x4d35('0x9')]=function(_0x52ab8c,_0x5e336f){return _0x52ab8c[_0x4d35('0xa')]('SquareOdbc',attributes,{'tableName':_0x4d35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index fa63064..cd65048 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 _0x9957=['stringify','error','code','message','result','catch','ShowSquareOdbc','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x4b1d4d,_0x386cab){var _0x3d2157=function(_0x171da){while(--_0x171da){_0x4b1d4d['push'](_0x4b1d4d['shift']());}};_0x3d2157(++_0x386cab);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('SquareOdbc,\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['SquareOdbc'][_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,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowSquareOdbc',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x2a26da,_0x3dfca3){var _0x59fc7f=function(_0x46c223){while(--_0x46c223){_0x2a26da['push'](_0x2a26da['shift']());}};_0x59fc7f(++_0x3dfca3);}(_0x008c,0x188));var _0xc008=function(_0xe0f242,_0x2f4ecf){_0xe0f242=_0xe0f242-0x0;var _0x3b801a=_0x008c[_0xe0f242];return _0x3b801a;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index afba734..90d7b27 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 _0xeb74=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','getUsers','post','create','/:id/users','addUsers','update','delete','destroy','removeUsers','multer','util','path'];(function(_0x2dc53c,_0x4a29ce){var _0x32ea88=function(_0x159135){while(--_0x159135){_0x2dc53c['push'](_0x2dc53c['shift']());}};_0x32ea88(++_0x4a29ce);}(_0xeb74,0xe3));var _0x4eb7=function(_0x17cdc7,_0x233fec){_0x17cdc7=_0x17cdc7-0x0;var _0xbcbbeb=_0xeb74[_0x17cdc7];return _0xbcbbeb;};'use strict';var multer=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var path=require(_0x4eb7('0x2'));var timeout=require(_0x4eb7('0x3'));var express=require(_0x4eb7('0x4'));var router=express[_0x4eb7('0x5')]();var auth=require(_0x4eb7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4eb7('0x7'));var controller=require(_0x4eb7('0x8'));router[_0x4eb7('0x9')]('/',auth[_0x4eb7('0xa')](),controller[_0x4eb7('0xb')]);router['get'](_0x4eb7('0xc'),auth['isAuthenticated'](),controller[_0x4eb7('0xd')]);router[_0x4eb7('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x4eb7('0xe')]);router[_0x4eb7('0xf')]('/',auth['isAuthenticated'](),controller[_0x4eb7('0x10')]);router['post'](_0x4eb7('0x11'),auth[_0x4eb7('0xa')](),controller[_0x4eb7('0x12')]);router['put'](_0x4eb7('0xc'),auth[_0x4eb7('0xa')](),controller[_0x4eb7('0x13')]);router[_0x4eb7('0x14')](_0x4eb7('0xc'),auth[_0x4eb7('0xa')](),controller[_0x4eb7('0x15')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x4eb7('0x16')]);module['exports']=router; \ No newline at end of file +var _0x1c9a=['isAuthenticated','show','getUsers','post','/:id/users','addUsers','put','/:id','update','delete','destroy','removeUsers','multer','path','express','Router','../../components/auth/service','../../config/environment','./squareProject.controller','get'];(function(_0x33924a,_0x46ef5b){var _0x47fc4c=function(_0x5addc5){while(--_0x5addc5){_0x33924a['push'](_0x33924a['shift']());}};_0x47fc4c(++_0x46ef5b);}(_0x1c9a,0x98));var _0xa1c9=function(_0x194266,_0x5db317){_0x194266=_0x194266-0x0;var _0x3deed0=_0x1c9a[_0x194266];return _0x3deed0;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require('util');var path=require(_0xa1c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1c9('0x2'));var router=express[_0xa1c9('0x3')]();var auth=require(_0xa1c9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c9('0x5'));var controller=require(_0xa1c9('0x6'));router[_0xa1c9('0x7')]('/',auth[_0xa1c9('0x8')](),controller['index']);router[_0xa1c9('0x7')]('/:id',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x9')]);router[_0xa1c9('0x7')]('/:id/users',auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xa')]);router[_0xa1c9('0xb')]('/',auth[_0xa1c9('0x8')](),controller['create']);router[_0xa1c9('0xb')](_0xa1c9('0xc'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0xd')]);router[_0xa1c9('0xe')](_0xa1c9('0xf'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x10')]);router[_0xa1c9('0x11')](_0xa1c9('0xf'),auth['isAuthenticated'](),controller[_0xa1c9('0x12')]);router[_0xa1c9('0x11')](_0xa1c9('0xc'),auth[_0xa1c9('0x8')](),controller[_0xa1c9('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 8f41e5a..9fba1f5 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 _0x095c=['sequelize','exports','STRING','name','TEXT','BLOB','long','preproduction','toString','getDataValue','production','utf8'];(function(_0x29f0f0,_0x1cc22c){var _0x20a1ce=function(_0x96c4a8){while(--_0x96c4a8){_0x29f0f0['push'](_0x29f0f0['shift']());}};_0x20a1ce(++_0x1cc22c);}(_0x095c,0x1d4));var _0xc095=function(_0x54d75c,_0xdc2bbd){_0x54d75c=_0x54d75c-0x0;var _0x21dbbd=_0x095c[_0x54d75c];return _0x21dbbd;};'use strict';var Sequelize=require(_0xc095('0x0'));module[_0xc095('0x1')]={'name':{'type':Sequelize[_0xc095('0x2')],'unique':_0xc095('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc095('0x2')]},'notes':{'type':Sequelize[_0xc095('0x4')]},'preproduction':{'type':Sequelize[_0xc095('0x5')](_0xc095('0x6')),'get':function(){if(this['getDataValue'](_0xc095('0x7'))){return this['getDataValue'](_0xc095('0x7'))[_0xc095('0x8')]('utf8');}}},'production':{'type':Sequelize[_0xc095('0x5')]('long'),'get':function(){if(this[_0xc095('0x9')](_0xc095('0xa'))){return this[_0xc095('0x9')](_0xc095('0xa'))['toString'](_0xc095('0xb'));}}}}; \ No newline at end of file +var _0xed65=['exports','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','utf8','production','toString','sequelize'];(function(_0x2904fa,_0xffeb4e){var _0xf14705=function(_0x3f59f0){while(--_0x3f59f0){_0x2904fa['push'](_0x2904fa['shift']());}};_0xf14705(++_0xffeb4e);}(_0xed65,0x143));var _0x5ed6=function(_0xd31621,_0x17b567){_0xd31621=_0xd31621-0x0;var _0x2e7ac0=_0xed65[_0xd31621];return _0x2e7ac0;};'use strict';var Sequelize=require(_0x5ed6('0x0'));module[_0x5ed6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5ed6('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5ed6('0x3')]},'notes':{'type':Sequelize[_0x5ed6('0x4')]},'preproduction':{'type':Sequelize[_0x5ed6('0x5')](_0x5ed6('0x6')),'get':function(){if(this[_0x5ed6('0x7')](_0x5ed6('0x8'))){return this[_0x5ed6('0x7')]('preproduction')['toString'](_0x5ed6('0x9'));}}},'production':{'type':Sequelize[_0x5ed6('0x5')]('long'),'get':function(){if(this[_0x5ed6('0x7')](_0x5ed6('0xa'))){return this['getDataValue']('production')[_0x5ed6('0xb')](_0x5ed6('0x9'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2c46c7a..be14850 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 _0x3dc0=['querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','rawAttributes','type','key','model','query','intersection','attributes','fields','length','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','pick','nolimit','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','lodash','squel','crypto','jsforce','desk.js'];(function(_0x3825ec,_0x5437a1){var _0x5462db=function(_0x458f4c){while(--_0x458f4c){_0x3825ec['push'](_0x3825ec['shift']());}};_0x5462db(++_0x5437a1);}(_0x3dc0,0x10d));var _0x03dc=function(_0x3fda0e,_0x4ff970){_0x3fda0e=_0x3fda0e-0x0;var _0x6937aa=_0x3dc0[_0x3fda0e];return _0x6937aa;};'use strict';var pdf=require(_0x03dc('0x0'));var emlformat=require(_0x03dc('0x1'));var rimraf=require(_0x03dc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03dc('0x3'));var rp=require(_0x03dc('0x4'));var moment=require(_0x03dc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x03dc('0x6'));var util=require(_0x03dc('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x03dc('0x8'));var squel=require(_0x03dc('0x9'));var crypto=require(_0x03dc('0xa'));var jsforce=require(_0x03dc('0xb'));var deskjs=require(_0x03dc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x03dc('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x03dc('0xe'));var qs=require(_0x03dc('0xf'));var as=require(_0x03dc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03dc('0x11'))(_0x03dc('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x03dc('0x13'))['db'];config[_0x03dc('0x14')]=_[_0x03dc('0x15')](config[_0x03dc('0x14')],{'host':_0x03dc('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x03dc('0x17'))[_0x03dc('0x18')](socket);function respondWithStatusCode(_0x41612f,_0x3c1da7){_0x3c1da7=_0x3c1da7||0xcc;return function(_0x1c95d0){if(_0x1c95d0){return _0x41612f[_0x03dc('0x19')](_0x3c1da7);}return _0x41612f[_0x03dc('0x1a')](_0x3c1da7)[_0x03dc('0x1b')]();};}function respondWithResult(_0x2bc524,_0x2ec7cb){_0x2ec7cb=_0x2ec7cb||0xc8;return function(_0x55ad2b){if(_0x55ad2b){return _0x2bc524[_0x03dc('0x1a')](_0x2ec7cb)[_0x03dc('0x1c')](_0x55ad2b);}};}function respondWithFilteredResult(_0x114895,_0x19863b){return function(_0x49b9d5){if(_0x49b9d5){var _0x3554f1=_0x49b9d5[_0x03dc('0x1d')],_0x2ab2bf=_0x19863b['offset'],_0x360928=_0x19863b[_0x03dc('0x1e')]+_0x19863b['limit'],_0x2a4f55;if(_0x360928>=_0x3554f1){_0x360928=_0x3554f1;_0x2a4f55=0xc8;}else{_0x2a4f55=0xce;}_0x114895['status'](_0x2a4f55);return _0x114895[_0x03dc('0x1f')]('Content-Range',_0x2ab2bf+'-'+_0x360928+'/'+_0x3554f1)[_0x03dc('0x1c')](_0x49b9d5);}return null;};}function patchUpdates(_0xd4a1e7){return function(_0x126422){try{jsonpatch[_0x03dc('0x20')](_0x126422,_0xd4a1e7,!![]);}catch(_0x59bd88){return BPromise[_0x03dc('0x21')](_0x59bd88);}return _0x126422[_0x03dc('0x22')]();};}function saveUpdates(_0x42335d,_0x35db81){return function(_0x5c8a49){if(_0x5c8a49){return _0x5c8a49[_0x03dc('0x23')](_0x42335d)[_0x03dc('0x24')](function(_0x3be605){return _0x3be605;});}return null;};}function removeEntity(_0x504c14,_0xfc85a2){return function(_0x475454){if(_0x475454){return _0x475454[_0x03dc('0x25')]()[_0x03dc('0x24')](function(){var _0x2333dc=_0x475454[_0x03dc('0x26')]({'plain':!![]});var _0x18acd6=_0x03dc('0x27');return db[_0x03dc('0x28')][_0x03dc('0x25')]({'where':{'type':_0x18acd6,'resourceId':_0x2333dc['id']}})['then'](function(){return _0x475454;});})[_0x03dc('0x24')](function(){_0x504c14[_0x03dc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4333eb,_0x52b7b8){return function(_0x306328){if(!_0x306328){_0x4333eb[_0x03dc('0x19')](0x194);}return _0x306328;};}function handleError(_0x1b8c39,_0x5c342d){_0x5c342d=_0x5c342d||0x1f4;return function(_0x126230){logger[_0x03dc('0x29')](_0x126230[_0x03dc('0x2a')]);if(_0x126230[_0x03dc('0x2b')]){delete _0x126230[_0x03dc('0x2b')];}_0x1b8c39['status'](_0x5c342d)[_0x03dc('0x2c')](_0x126230);};}exports[_0x03dc('0x2d')]=function(_0x79cdd9,_0x405b2a){var _0x3ff01c={},_0x335dbc={},_0x1b472d={'count':0x0,'rows':[]};var _0x2ac4c0=_[_0x03dc('0x2e')](db[_0x03dc('0x2f')][_0x03dc('0x30')],function(_0x3020ad){return{'name':_0x3020ad['fieldName'],'type':_0x3020ad[_0x03dc('0x31')][_0x03dc('0x32')]};});_0x335dbc[_0x03dc('0x33')]=_[_0x03dc('0x2e')](_0x2ac4c0,_0x03dc('0x2b'));_0x335dbc[_0x03dc('0x34')]=_['keys'](_0x79cdd9[_0x03dc('0x34')]);_0x335dbc['filters']=_[_0x03dc('0x35')](_0x335dbc['model'],_0x335dbc['query']);_0x3ff01c[_0x03dc('0x36')]=_[_0x03dc('0x35')](_0x335dbc[_0x03dc('0x33')],qs[_0x03dc('0x37')](_0x79cdd9[_0x03dc('0x34')][_0x03dc('0x37')]));_0x3ff01c['attributes']=_0x3ff01c[_0x03dc('0x36')][_0x03dc('0x38')]?_0x3ff01c['attributes']:_0x335dbc['model'];if(!_0x79cdd9['query']['hasOwnProperty']('nolimit')){_0x3ff01c[_0x03dc('0x39')]=qs[_0x03dc('0x39')](_0x79cdd9[_0x03dc('0x34')]['limit']);_0x3ff01c[_0x03dc('0x1e')]=qs[_0x03dc('0x1e')](_0x79cdd9[_0x03dc('0x34')][_0x03dc('0x1e')]);}_0x3ff01c[_0x03dc('0x3a')]=qs[_0x03dc('0x3b')](_0x79cdd9[_0x03dc('0x34')][_0x03dc('0x3b')]);_0x3ff01c[_0x03dc('0x3c')]=qs[_0x03dc('0x3d')](_['pick'](_0x79cdd9[_0x03dc('0x34')],_0x335dbc[_0x03dc('0x3d')]),_0x2ac4c0);if(_0x79cdd9['query'][_0x03dc('0x3e')]){_0x3ff01c[_0x03dc('0x3c')]=_[_0x03dc('0x3f')](_0x3ff01c['where'],{'$or':_['map'](_0x2ac4c0,function(_0x4104a0){if(_0x4104a0[_0x03dc('0x31')]!==_0x03dc('0x40')){var _0x81deb5={};_0x81deb5[_0x4104a0[_0x03dc('0x2b')]]={'$like':'%'+_0x79cdd9[_0x03dc('0x34')][_0x03dc('0x3e')]+'%'};return _0x81deb5;}})});}_0x3ff01c=_[_0x03dc('0x3f')]({},_0x3ff01c,_0x79cdd9[_0x03dc('0x41')]);var _0x585efe={'where':_0x3ff01c[_0x03dc('0x3c')]};return db[_0x03dc('0x2f')][_0x03dc('0x1d')](_0x585efe)[_0x03dc('0x24')](function(_0x3d093d){_0x1b472d[_0x03dc('0x1d')]=_0x3d093d;if(_0x79cdd9['query']['includeAll']){_0x3ff01c[_0x03dc('0x42')]=[{'all':!![]}];}return db[_0x03dc('0x2f')][_0x03dc('0x43')](_0x3ff01c);})['then'](function(_0x73833b){_0x1b472d[_0x03dc('0x44')]=_0x73833b;return _0x1b472d;})[_0x03dc('0x24')](respondWithFilteredResult(_0x405b2a,_0x3ff01c))[_0x03dc('0x45')](handleError(_0x405b2a,null));};exports[_0x03dc('0x46')]=function(_0xffcf5d,_0x4cd7e5){var _0xe2d29b={'raw':![],'where':{'id':_0xffcf5d[_0x03dc('0x47')]['id']}},_0x4cb965={};_0x4cb965[_0x03dc('0x33')]=_['keys'](db[_0x03dc('0x2f')][_0x03dc('0x30')]);_0x4cb965['query']=_[_0x03dc('0x48')](_0xffcf5d[_0x03dc('0x34')]);_0x4cb965[_0x03dc('0x3d')]=_[_0x03dc('0x35')](_0x4cb965[_0x03dc('0x33')],_0x4cb965[_0x03dc('0x34')]);_0xe2d29b[_0x03dc('0x36')]=_[_0x03dc('0x35')](_0x4cb965[_0x03dc('0x33')],qs['fields'](_0xffcf5d[_0x03dc('0x34')][_0x03dc('0x37')]));_0xe2d29b['attributes']=_0xe2d29b['attributes'][_0x03dc('0x38')]?_0xe2d29b['attributes']:_0x4cb965[_0x03dc('0x33')];if(_0xffcf5d[_0x03dc('0x34')][_0x03dc('0x49')]){_0xe2d29b[_0x03dc('0x42')]=[{'all':!![]}];}_0xe2d29b=_['merge']({},_0xe2d29b,_0xffcf5d[_0x03dc('0x41')]);return db[_0x03dc('0x2f')]['find'](_0xe2d29b)['then'](handleEntityNotFound(_0x4cd7e5,null))[_0x03dc('0x24')](respondWithResult(_0x4cd7e5,null))[_0x03dc('0x45')](handleError(_0x4cd7e5,null));};exports[_0x03dc('0x4a')]=function(_0x13579c,_0x5a5fde){return db['SquareProject'][_0x03dc('0x4a')](_0x13579c['body'],{})[_0x03dc('0x24')](function(_0x8f8038){var _0x30dc8c=_0x13579c[_0x03dc('0x4b')][_0x03dc('0x26')]({'plain':!![]});if(!_0x30dc8c)throw new Error(_0x03dc('0x4c'));if(_0x30dc8c[_0x03dc('0x4d')]==='user'){var _0xe35d48=_0x8f8038[_0x03dc('0x26')]({'plain':!![]});var _0x96480d=_0x03dc('0x27');return db[_0x03dc('0x4e')][_0x03dc('0x4f')]({'where':{'name':_0x96480d,'userProfileId':_0x30dc8c['userProfileId']},'raw':!![]})[_0x03dc('0x24')](function(_0x1a4511){if(_0x1a4511&&_0x1a4511[_0x03dc('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0xe35d48['name'],'resourceId':_0xe35d48['id'],'type':_0x1a4511[_0x03dc('0x2b')],'sectionId':_0x1a4511['id']},{})[_0x03dc('0x24')](function(){return _0x8f8038;});}else{return _0x8f8038;}})[_0x03dc('0x45')](function(_0x56d60c){logger[_0x03dc('0x29')](_0x03dc('0x51'),_0x56d60c);throw _0x56d60c;});}return _0x8f8038;})[_0x03dc('0x24')](respondWithResult(_0x5a5fde,0xc9))[_0x03dc('0x45')](handleError(_0x5a5fde,null));};exports[_0x03dc('0x23')]=function(_0x3cc6e6,_0x34092d){if(_0x3cc6e6[_0x03dc('0x52')]['id']){delete _0x3cc6e6['body']['id'];}return db[_0x03dc('0x2f')][_0x03dc('0x4f')]({'where':{'id':_0x3cc6e6[_0x03dc('0x47')]['id']}})[_0x03dc('0x24')](handleEntityNotFound(_0x34092d,null))[_0x03dc('0x24')](saveUpdates(_0x3cc6e6[_0x03dc('0x52')],null))[_0x03dc('0x24')](respondWithResult(_0x34092d,null))[_0x03dc('0x45')](handleError(_0x34092d,null));};exports[_0x03dc('0x25')]=function(_0x3036b2,_0x2795ee){return db[_0x03dc('0x2f')][_0x03dc('0x4f')]({'where':{'id':_0x3036b2[_0x03dc('0x47')]['id']}})[_0x03dc('0x24')](handleEntityNotFound(_0x2795ee,null))[_0x03dc('0x24')](removeEntity(_0x2795ee,null))[_0x03dc('0x45')](handleError(_0x2795ee,null));};exports[_0x03dc('0x53')]=function(_0x57910d,_0x1a92f2,_0x318acd){return db['SquareProject'][_0x03dc('0x4f')]({'where':{'id':_0x57910d['params']['id']}})[_0x03dc('0x24')](handleEntityNotFound(_0x1a92f2,null))['then'](function(_0x5c1f92){if(_0x5c1f92){return _0x5c1f92[_0x03dc('0x53')](_0x57910d[_0x03dc('0x52')][_0x03dc('0x54')],_[_0x03dc('0x55')](_0x57910d[_0x03dc('0x52')],['ids','id'])||{});}})['then'](respondWithResult(_0x1a92f2,null))[_0x03dc('0x45')](handleError(_0x1a92f2,null));};exports[_0x03dc('0x56')]=function(_0x337589,_0x6d34c8,_0x31fef4){return db[_0x03dc('0x2f')][_0x03dc('0x4f')]({'where':{'id':_0x337589['params']['id']}})[_0x03dc('0x24')](handleEntityNotFound(_0x6d34c8,null))['then'](function(_0x2be7){if(_0x2be7){return _0x2be7[_0x03dc('0x56')](_0x337589[_0x03dc('0x34')][_0x03dc('0x54')])[_0x03dc('0x24')](function(){if(_[_0x03dc('0x57')](_0x337589[_0x03dc('0x34')]['ids'])){for(var _0x5c273e=0x0;_0x5c273e<_0x337589[_0x03dc('0x34')][_0x03dc('0x54')][_0x03dc('0x38')];_0x5c273e+=0x1){socket[_0x03dc('0x58')](_0x03dc('0x59'),{'UserId':Number(_0x337589['query'][_0x03dc('0x54')][_0x5c273e]),'SquareProjectId':Number(_0x337589['params']['id'])});}}else{socket[_0x03dc('0x58')](_0x03dc('0x59'),{'UserId':Number(_0x337589[_0x03dc('0x34')][_0x03dc('0x54')]),'SquareProjectId':Number(_0x337589[_0x03dc('0x47')]['id'])});}});}})[_0x03dc('0x24')](respondWithStatusCode(_0x6d34c8,null))[_0x03dc('0x45')](handleError(_0x6d34c8,null));};exports[_0x03dc('0x5a')]=function(_0x32898e,_0x4d3d1b,_0x53ddea){var _0x1aa835={};var _0x49149e={};var _0x9bff49;var _0x320926;return db[_0x03dc('0x2f')]['findOne']({'where':{'id':_0x32898e[_0x03dc('0x47')]['id']}})[_0x03dc('0x24')](handleEntityNotFound(_0x4d3d1b,null))[_0x03dc('0x24')](function(_0x48c159){if(_0x48c159){_0x9bff49=_0x48c159;_0x49149e[_0x03dc('0x33')]=_['keys'](db[_0x03dc('0x5b')]['rawAttributes']);_0x49149e[_0x03dc('0x34')]=_[_0x03dc('0x48')](_0x32898e['query']);_0x49149e[_0x03dc('0x3d')]=_[_0x03dc('0x35')](_0x49149e[_0x03dc('0x33')],_0x49149e['query']);_0x1aa835[_0x03dc('0x36')]=_[_0x03dc('0x35')](_0x49149e[_0x03dc('0x33')],qs['fields'](_0x32898e[_0x03dc('0x34')]['fields']));_0x1aa835[_0x03dc('0x36')]=_0x1aa835[_0x03dc('0x36')][_0x03dc('0x38')]?_0x1aa835[_0x03dc('0x36')]:_0x49149e[_0x03dc('0x33')];_0x1aa835[_0x03dc('0x3a')]=qs[_0x03dc('0x3b')](_0x32898e['query'][_0x03dc('0x3b')]);_0x1aa835[_0x03dc('0x3c')]=qs['filters'](_[_0x03dc('0x5c')](_0x32898e[_0x03dc('0x34')],_0x49149e[_0x03dc('0x3d')]));if(_0x32898e['query']['filter']){_0x1aa835[_0x03dc('0x3c')]=_[_0x03dc('0x3f')](_0x1aa835[_0x03dc('0x3c')],{'$or':_['map'](_0x1aa835[_0x03dc('0x36')],function(_0x5e8636){var _0x579b3d={};_0x579b3d[_0x5e8636]={'$like':'%'+_0x32898e[_0x03dc('0x34')][_0x03dc('0x3e')]+'%'};return _0x579b3d;})});}_0x1aa835=_['merge']({},_0x1aa835,_0x32898e['options']);return _0x9bff49[_0x03dc('0x5a')](_0x1aa835);}})[_0x03dc('0x24')](function(_0x20d51a){if(_0x20d51a){_0x320926=_0x20d51a[_0x03dc('0x38')];if(!_0x32898e[_0x03dc('0x34')]['hasOwnProperty'](_0x03dc('0x5d'))){_0x1aa835[_0x03dc('0x39')]=qs[_0x03dc('0x39')](_0x32898e['query']['limit']);_0x1aa835[_0x03dc('0x1e')]=qs['offset'](_0x32898e[_0x03dc('0x34')][_0x03dc('0x1e')]);}return _0x9bff49[_0x03dc('0x5a')](_0x1aa835);}})[_0x03dc('0x24')](function(_0x198f02){if(_0x198f02){return _0x198f02?{'count':_0x320926,'rows':_0x198f02}:null;}})[_0x03dc('0x24')](respondWithResult(_0x4d3d1b,null))[_0x03dc('0x45')](handleError(_0x4d3d1b,null));}; \ No newline at end of file +var _0xc420=['options','count','include','rows','catch','show','params','rawAttributes','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','set','apply','reject','save','update','then','end','error','stack','name','index','map','SquareProject','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','merge'];(function(_0x48f038,_0x2bde84){var _0x2edc62=function(_0x1e6cc8){while(--_0x1e6cc8){_0x48f038['push'](_0x48f038['shift']());}};_0x2edc62(++_0x2bde84);}(_0xc420,0x13f));var _0x0c42=function(_0x4e919d,_0x8c9bd5){_0x4e919d=_0x4e919d-0x0;var _0x1e86eb=_0xc420[_0x4e919d];return _0x1e86eb;};'use strict';var pdf=require(_0x0c42('0x0'));var emlformat=require(_0x0c42('0x1'));var rimraf=require(_0x0c42('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c42('0x3'));var rp=require(_0x0c42('0x4'));var moment=require(_0x0c42('0x5'));var BPromise=require(_0x0c42('0x6'));var Mustache=require('mustache');var util=require(_0x0c42('0x7'));var path=require(_0x0c42('0x8'));var sox=require(_0x0c42('0x9'));var csv=require('to-csv');var ejs=require(_0x0c42('0xa'));var fs=require('fs');var _=require(_0x0c42('0xb'));var squel=require(_0x0c42('0xc'));var crypto=require('crypto');var jsforce=require(_0x0c42('0xd'));var deskjs=require(_0x0c42('0xe'));var toCsv=require(_0x0c42('0xf'));var querystring=require(_0x0c42('0x10'));var Papa=require(_0x0c42('0x11'));var Redis=require('ioredis');var authService=require(_0x0c42('0x12'));var qs=require(_0x0c42('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c42('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0c42('0x15'));var config=require('../../config/environment');var db=require(_0x0c42('0x16'))['db'];config[_0x0c42('0x17')]=_[_0x0c42('0x18')](config[_0x0c42('0x17')],{'host':_0x0c42('0x19'),'port':0x18eb});var socket=require(_0x0c42('0x1a'))(new Redis(config['redis']));require('./squareProject.socket')[_0x0c42('0x1b')](socket);function respondWithStatusCode(_0x4efbd1,_0x2fdac4){_0x2fdac4=_0x2fdac4||0xcc;return function(_0x34b6f7){if(_0x34b6f7){return _0x4efbd1[_0x0c42('0x1c')](_0x2fdac4);}return _0x4efbd1[_0x0c42('0x1d')](_0x2fdac4)['end']();};}function respondWithResult(_0x5d6a9a,_0x5d14d3){_0x5d14d3=_0x5d14d3||0xc8;return function(_0x5d8c0f){if(_0x5d8c0f){return _0x5d6a9a['status'](_0x5d14d3)[_0x0c42('0x1e')](_0x5d8c0f);}};}function respondWithFilteredResult(_0xa0ed4d,_0x1809ce){return function(_0x434d07){if(_0x434d07){var _0x2a357f=_0x434d07['count'],_0x4b7e12=_0x1809ce[_0x0c42('0x1f')],_0x49ad20=_0x1809ce[_0x0c42('0x1f')]+_0x1809ce['limit'],_0x108914;if(_0x49ad20>=_0x2a357f){_0x49ad20=_0x2a357f;_0x108914=0xc8;}else{_0x108914=0xce;}_0xa0ed4d[_0x0c42('0x1d')](_0x108914);return _0xa0ed4d[_0x0c42('0x20')]('Content-Range',_0x4b7e12+'-'+_0x49ad20+'/'+_0x2a357f)[_0x0c42('0x1e')](_0x434d07);}return null;};}function patchUpdates(_0x4c5a35){return function(_0x1e8559){try{jsonpatch[_0x0c42('0x21')](_0x1e8559,_0x4c5a35,!![]);}catch(_0x210fbe){return BPromise[_0x0c42('0x22')](_0x210fbe);}return _0x1e8559[_0x0c42('0x23')]();};}function saveUpdates(_0x119de7,_0x45762b){return function(_0x180a22){if(_0x180a22){return _0x180a22[_0x0c42('0x24')](_0x119de7)[_0x0c42('0x25')](function(_0x43a419){return _0x43a419;});}return null;};}function removeEntity(_0x564adc,_0x4da627){return function(_0x2c584a){if(_0x2c584a){return _0x2c584a['destroy']()[_0x0c42('0x25')](function(){var _0x76e7f2=_0x2c584a['get']({'plain':!![]});var _0x384492='SquareProjects';return db['UserProfileResource']['destroy']({'where':{'type':_0x384492,'resourceId':_0x76e7f2['id']}})[_0x0c42('0x25')](function(){return _0x2c584a;});})[_0x0c42('0x25')](function(){_0x564adc[_0x0c42('0x1d')](0xcc)[_0x0c42('0x26')]();});}};}function handleEntityNotFound(_0xbf4af7,_0x212fad){return function(_0x26c79c){if(!_0x26c79c){_0xbf4af7[_0x0c42('0x1c')](0x194);}return _0x26c79c;};}function handleError(_0x454968,_0x5724f4){_0x5724f4=_0x5724f4||0x1f4;return function(_0x465158){logger[_0x0c42('0x27')](_0x465158[_0x0c42('0x28')]);if(_0x465158['name']){delete _0x465158[_0x0c42('0x29')];}_0x454968['status'](_0x5724f4)['send'](_0x465158);};}exports[_0x0c42('0x2a')]=function(_0x53c83b,_0x3f67f2){var _0xa5cd42={},_0x295946={},_0x50d3d9={'count':0x0,'rows':[]};var _0x2f88d8=_[_0x0c42('0x2b')](db[_0x0c42('0x2c')]['rawAttributes'],function(_0x369787){return{'name':_0x369787[_0x0c42('0x2d')],'type':_0x369787[_0x0c42('0x2e')][_0x0c42('0x2f')]};});_0x295946['model']=_[_0x0c42('0x2b')](_0x2f88d8,_0x0c42('0x29'));_0x295946['query']=_[_0x0c42('0x30')](_0x53c83b[_0x0c42('0x31')]);_0x295946[_0x0c42('0x32')]=_[_0x0c42('0x33')](_0x295946[_0x0c42('0x34')],_0x295946['query']);_0xa5cd42[_0x0c42('0x35')]=_[_0x0c42('0x33')](_0x295946['model'],qs[_0x0c42('0x36')](_0x53c83b[_0x0c42('0x31')][_0x0c42('0x36')]));_0xa5cd42[_0x0c42('0x35')]=_0xa5cd42[_0x0c42('0x35')][_0x0c42('0x37')]?_0xa5cd42[_0x0c42('0x35')]:_0x295946[_0x0c42('0x34')];if(!_0x53c83b[_0x0c42('0x31')][_0x0c42('0x38')](_0x0c42('0x39'))){_0xa5cd42[_0x0c42('0x3a')]=qs['limit'](_0x53c83b[_0x0c42('0x31')]['limit']);_0xa5cd42[_0x0c42('0x1f')]=qs[_0x0c42('0x1f')](_0x53c83b[_0x0c42('0x31')][_0x0c42('0x1f')]);}_0xa5cd42['order']=qs[_0x0c42('0x3b')](_0x53c83b['query'][_0x0c42('0x3b')]);_0xa5cd42[_0x0c42('0x3c')]=qs[_0x0c42('0x32')](_[_0x0c42('0x3d')](_0x53c83b['query'],_0x295946[_0x0c42('0x32')]),_0x2f88d8);if(_0x53c83b[_0x0c42('0x31')]['filter']){_0xa5cd42['where']=_['merge'](_0xa5cd42[_0x0c42('0x3c')],{'$or':_['map'](_0x2f88d8,function(_0x1e9c02){if(_0x1e9c02['type']!==_0x0c42('0x3e')){var _0x279b96={};_0x279b96[_0x1e9c02[_0x0c42('0x29')]]={'$like':'%'+_0x53c83b[_0x0c42('0x31')][_0x0c42('0x3f')]+'%'};return _0x279b96;}})});}_0xa5cd42=_[_0x0c42('0x40')]({},_0xa5cd42,_0x53c83b[_0x0c42('0x41')]);var _0x20ca8d={'where':_0xa5cd42[_0x0c42('0x3c')]};return db['SquareProject'][_0x0c42('0x42')](_0x20ca8d)[_0x0c42('0x25')](function(_0x408598){_0x50d3d9[_0x0c42('0x42')]=_0x408598;if(_0x53c83b['query']['includeAll']){_0xa5cd42[_0x0c42('0x43')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0xa5cd42);})[_0x0c42('0x25')](function(_0x4a37cc){_0x50d3d9[_0x0c42('0x44')]=_0x4a37cc;return _0x50d3d9;})[_0x0c42('0x25')](respondWithFilteredResult(_0x3f67f2,_0xa5cd42))[_0x0c42('0x45')](handleError(_0x3f67f2,null));};exports[_0x0c42('0x46')]=function(_0x3b1344,_0x25b40e){var _0x289f14={'raw':![],'where':{'id':_0x3b1344[_0x0c42('0x47')]['id']}},_0x1fb6ff={};_0x1fb6ff['model']=_[_0x0c42('0x30')](db['SquareProject'][_0x0c42('0x48')]);_0x1fb6ff[_0x0c42('0x31')]=_[_0x0c42('0x30')](_0x3b1344['query']);_0x1fb6ff[_0x0c42('0x32')]=_[_0x0c42('0x33')](_0x1fb6ff['model'],_0x1fb6ff['query']);_0x289f14[_0x0c42('0x35')]=_[_0x0c42('0x33')](_0x1fb6ff[_0x0c42('0x34')],qs['fields'](_0x3b1344[_0x0c42('0x31')][_0x0c42('0x36')]));_0x289f14[_0x0c42('0x35')]=_0x289f14[_0x0c42('0x35')][_0x0c42('0x37')]?_0x289f14[_0x0c42('0x35')]:_0x1fb6ff['model'];if(_0x3b1344[_0x0c42('0x31')][_0x0c42('0x49')]){_0x289f14[_0x0c42('0x43')]=[{'all':!![]}];}_0x289f14=_[_0x0c42('0x40')]({},_0x289f14,_0x3b1344[_0x0c42('0x41')]);return db['SquareProject']['find'](_0x289f14)[_0x0c42('0x25')](handleEntityNotFound(_0x25b40e,null))[_0x0c42('0x25')](respondWithResult(_0x25b40e,null))[_0x0c42('0x45')](handleError(_0x25b40e,null));};exports[_0x0c42('0x4a')]=function(_0x1d470e,_0x13a6e1){return db[_0x0c42('0x2c')][_0x0c42('0x4a')](_0x1d470e[_0x0c42('0x4b')],{})[_0x0c42('0x25')](function(_0x4697e4){var _0x1f656e=_0x1d470e['user'][_0x0c42('0x4c')]({'plain':!![]});if(!_0x1f656e)throw new Error(_0x0c42('0x4d'));if(_0x1f656e[_0x0c42('0x4e')]==='user'){var _0x123ec1=_0x4697e4['get']({'plain':!![]});var _0x1b0c3c=_0x0c42('0x4f');return db[_0x0c42('0x50')][_0x0c42('0x51')]({'where':{'name':_0x1b0c3c,'userProfileId':_0x1f656e[_0x0c42('0x52')]},'raw':!![]})[_0x0c42('0x25')](function(_0x499196){if(_0x499196&&_0x499196['autoAssociation']===0x0){return db[_0x0c42('0x53')][_0x0c42('0x4a')]({'name':_0x123ec1['name'],'resourceId':_0x123ec1['id'],'type':_0x499196[_0x0c42('0x29')],'sectionId':_0x499196['id']},{})['then'](function(){return _0x4697e4;});}else{return _0x4697e4;}})[_0x0c42('0x45')](function(_0x586d55){logger[_0x0c42('0x27')](_0x0c42('0x54'),_0x586d55);throw _0x586d55;});}return _0x4697e4;})[_0x0c42('0x25')](respondWithResult(_0x13a6e1,0xc9))[_0x0c42('0x45')](handleError(_0x13a6e1,null));};exports[_0x0c42('0x24')]=function(_0x13e520,_0x56234e){if(_0x13e520['body']['id']){delete _0x13e520['body']['id'];}return db[_0x0c42('0x2c')]['find']({'where':{'id':_0x13e520[_0x0c42('0x47')]['id']}})['then'](handleEntityNotFound(_0x56234e,null))[_0x0c42('0x25')](saveUpdates(_0x13e520[_0x0c42('0x4b')],null))['then'](respondWithResult(_0x56234e,null))['catch'](handleError(_0x56234e,null));};exports[_0x0c42('0x55')]=function(_0x8ae20,_0x4da155){return db[_0x0c42('0x2c')][_0x0c42('0x51')]({'where':{'id':_0x8ae20[_0x0c42('0x47')]['id']}})[_0x0c42('0x25')](handleEntityNotFound(_0x4da155,null))[_0x0c42('0x25')](removeEntity(_0x4da155,null))[_0x0c42('0x45')](handleError(_0x4da155,null));};exports[_0x0c42('0x56')]=function(_0x3f680d,_0x445b71,_0x41e974){return db['SquareProject'][_0x0c42('0x51')]({'where':{'id':_0x3f680d[_0x0c42('0x47')]['id']}})[_0x0c42('0x25')](handleEntityNotFound(_0x445b71,null))['then'](function(_0x134ab7){if(_0x134ab7){return _0x134ab7[_0x0c42('0x56')](_0x3f680d[_0x0c42('0x4b')][_0x0c42('0x57')],_['omit'](_0x3f680d[_0x0c42('0x4b')],[_0x0c42('0x57'),'id'])||{});}})['then'](respondWithResult(_0x445b71,null))[_0x0c42('0x45')](handleError(_0x445b71,null));};exports[_0x0c42('0x58')]=function(_0x1a8c5c,_0x2de156,_0xd01460){return db[_0x0c42('0x2c')][_0x0c42('0x51')]({'where':{'id':_0x1a8c5c['params']['id']}})[_0x0c42('0x25')](handleEntityNotFound(_0x2de156,null))['then'](function(_0x46d72e){if(_0x46d72e){return _0x46d72e[_0x0c42('0x58')](_0x1a8c5c[_0x0c42('0x31')][_0x0c42('0x57')])[_0x0c42('0x25')](function(){if(_[_0x0c42('0x59')](_0x1a8c5c[_0x0c42('0x31')][_0x0c42('0x57')])){for(var _0xdef88c=0x0;_0xdef88c<_0x1a8c5c[_0x0c42('0x31')][_0x0c42('0x57')][_0x0c42('0x37')];_0xdef88c+=0x1){socket[_0x0c42('0x5a')](_0x0c42('0x5b'),{'UserId':Number(_0x1a8c5c[_0x0c42('0x31')][_0x0c42('0x57')][_0xdef88c]),'SquareProjectId':Number(_0x1a8c5c[_0x0c42('0x47')]['id'])});}}else{socket[_0x0c42('0x5a')](_0x0c42('0x5b'),{'UserId':Number(_0x1a8c5c[_0x0c42('0x31')][_0x0c42('0x57')]),'SquareProjectId':Number(_0x1a8c5c['params']['id'])});}});}})[_0x0c42('0x25')](respondWithStatusCode(_0x2de156,null))[_0x0c42('0x45')](handleError(_0x2de156,null));};exports[_0x0c42('0x5c')]=function(_0xe94826,_0x31cd0a,_0x31ae6c){var _0x57e99f={};var _0x758d9c={};var _0x485a4e;var _0x11cc52;return db[_0x0c42('0x2c')][_0x0c42('0x5d')]({'where':{'id':_0xe94826[_0x0c42('0x47')]['id']}})[_0x0c42('0x25')](handleEntityNotFound(_0x31cd0a,null))[_0x0c42('0x25')](function(_0x50a3b1){if(_0x50a3b1){_0x485a4e=_0x50a3b1;_0x758d9c[_0x0c42('0x34')]=_['keys'](db[_0x0c42('0x5e')]['rawAttributes']);_0x758d9c[_0x0c42('0x31')]=_['keys'](_0xe94826[_0x0c42('0x31')]);_0x758d9c[_0x0c42('0x32')]=_[_0x0c42('0x33')](_0x758d9c[_0x0c42('0x34')],_0x758d9c[_0x0c42('0x31')]);_0x57e99f[_0x0c42('0x35')]=_[_0x0c42('0x33')](_0x758d9c[_0x0c42('0x34')],qs[_0x0c42('0x36')](_0xe94826['query'][_0x0c42('0x36')]));_0x57e99f[_0x0c42('0x35')]=_0x57e99f[_0x0c42('0x35')][_0x0c42('0x37')]?_0x57e99f[_0x0c42('0x35')]:_0x758d9c[_0x0c42('0x34')];_0x57e99f[_0x0c42('0x5f')]=qs[_0x0c42('0x3b')](_0xe94826[_0x0c42('0x31')][_0x0c42('0x3b')]);_0x57e99f[_0x0c42('0x3c')]=qs[_0x0c42('0x32')](_['pick'](_0xe94826['query'],_0x758d9c[_0x0c42('0x32')]));if(_0xe94826['query'][_0x0c42('0x3f')]){_0x57e99f[_0x0c42('0x3c')]=_[_0x0c42('0x40')](_0x57e99f['where'],{'$or':_['map'](_0x57e99f[_0x0c42('0x35')],function(_0x22fff5){var _0xdc7109={};_0xdc7109[_0x22fff5]={'$like':'%'+_0xe94826[_0x0c42('0x31')][_0x0c42('0x3f')]+'%'};return _0xdc7109;})});}_0x57e99f=_['merge']({},_0x57e99f,_0xe94826[_0x0c42('0x41')]);return _0x485a4e[_0x0c42('0x5c')](_0x57e99f);}})[_0x0c42('0x25')](function(_0x3fa6c7){if(_0x3fa6c7){_0x11cc52=_0x3fa6c7[_0x0c42('0x37')];if(!_0xe94826[_0x0c42('0x31')]['hasOwnProperty'](_0x0c42('0x39'))){_0x57e99f[_0x0c42('0x3a')]=qs[_0x0c42('0x3a')](_0xe94826[_0x0c42('0x31')][_0x0c42('0x3a')]);_0x57e99f[_0x0c42('0x1f')]=qs['offset'](_0xe94826[_0x0c42('0x31')][_0x0c42('0x1f')]);}return _0x485a4e[_0x0c42('0x5c')](_0x57e99f);}})[_0x0c42('0x25')](function(_0x3d958d){if(_0x3d958d){return _0x3d958d?{'count':_0x11cc52,'rows':_0x3d958d}:null;}})['then'](respondWithResult(_0x31cd0a,null))['catch'](handleError(_0x31cd0a,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 30f050d..b1696a7 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 _0x5e37=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SquareProject'];(function(_0x46d5ac,_0x4cc7df){var _0xb6f383=function(_0x3c7740){while(--_0x3c7740){_0x46d5ac['push'](_0x46d5ac['shift']());}};_0xb6f383(++_0x4cc7df);}(_0x5e37,0xcc));var _0x75e3=function(_0x4631eb,_0x55649e){_0x4631eb=_0x4631eb-0x0;var _0x562eca=_0x5e37[_0x4631eb];return _0x562eca;};'use strict';var EventEmitter=require(_0x75e3('0x0'));var SquareProject=require(_0x75e3('0x1'))['db'][_0x75e3('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x75e3('0x3')](0x0);var events={'afterCreate':_0x75e3('0x4'),'afterUpdate':'update','afterDestroy':_0x75e3('0x5')};function emitEvent(_0x3618e1){return function(_0x1f320e,_0x11cc09,_0x5d1ea0){SquareProjectEvents[_0x75e3('0x6')](_0x3618e1+':'+_0x1f320e['id'],_0x1f320e);SquareProjectEvents['emit'](_0x3618e1,_0x1f320e);_0x5d1ea0(null);};}for(var e in events){if(events[_0x75e3('0x7')](e)){var event=events[e];SquareProject[_0x75e3('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x20a5=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x4d81b1,_0x35da49){var _0x38c376=function(_0x4724d8){while(--_0x4724d8){_0x4d81b1['push'](_0x4d81b1['shift']());}};_0x38c376(++_0x35da49);}(_0x20a5,0x7e));var _0x520a=function(_0x380bcc,_0x57fafb){_0x380bcc=_0x380bcc-0x0;var _0x2b8d22=_0x20a5[_0x380bcc];return _0x2b8d22;};'use strict';var EventEmitter=require(_0x520a('0x0'));var SquareProject=require(_0x520a('0x1'))['db'][_0x520a('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x520a('0x3')](0x0);var events={'afterCreate':_0x520a('0x4'),'afterUpdate':'update','afterDestroy':_0x520a('0x5')};function emitEvent(_0x1f1f31){return function(_0x3f356b,_0x4a6372,_0x2ec110){SquareProjectEvents[_0x520a('0x6')](_0x1f1f31+':'+_0x3f356b['id'],_0x3f356b);SquareProjectEvents['emit'](_0x1f1f31,_0x3f356b);_0x2ec110(null);};}for(var e in events){if(events[_0x520a('0x7')](e)){var event=events[e];SquareProject[_0x520a('0x8')](e,emitEvent(event));}}module[_0x520a('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 4463d9b..87e12b9 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 _0x57ca=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./squareProject.attributes','exports','define','SquareProject','square_projects'];(function(_0x5d7916,_0x1ed837){var _0x3c27ec=function(_0x4ace7f){while(--_0x4ace7f){_0x5d7916['push'](_0x5d7916['shift']());}};_0x3c27ec(++_0x1ed837);}(_0x57ca,0x108));var _0xa57c=function(_0x266a3f,_0x5768e8){_0x266a3f=_0x266a3f-0x0;var _0x39d8d2=_0x57ca[_0x266a3f];return _0x39d8d2;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));module[_0xa57c('0x8')]=function(_0x113dcf,_0x19473f){return _0x113dcf[_0xa57c('0x9')](_0xa57c('0xa'),attributes,{'tableName':_0xa57c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareProject','square_projects','lodash','util'];(function(_0x5bc65b,_0x104ef4){var _0xf372dc=function(_0x22127b){while(--_0x22127b){_0x5bc65b['push'](_0x5bc65b['shift']());}};_0xf372dc(++_0x104ef4);}(_0xdb28,0x106));var _0x8db2=function(_0x44ff47,_0x28b83c){_0x44ff47=_0x44ff47-0x0;var _0x540826=_0xdb28[_0x44ff47];return _0x540826;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./squareProject.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 0f8fd93..d2db62f 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 _0xab02=['SquareProject','find','options','raw','where','attributes','map','include','model','then','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','register','request','info','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab02,0x1de));var _0x2ab0=function(_0x428af1,_0x2400e6){_0x428af1=_0x428af1-0x0;var _0x8a89bb=_0xab02[_0x428af1];return _0x8a89bb;};'use strict';var _=require('lodash');var util=require(_0x2ab0('0x0'));var moment=require(_0x2ab0('0x1'));var BPromise=require(_0x2ab0('0x2'));var rs=require(_0x2ab0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ab0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2ab0('0x5'));var jayson=require(_0x2ab0('0x6'));var client=jayson[_0x2ab0('0x7')][_0x2ab0('0x8')]({'port':0x232a});config[_0x2ab0('0x9')]=_[_0x2ab0('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2ab0('0xb'))(new Redis(config[_0x2ab0('0x9')]));require(_0x2ab0('0xc'))[_0x2ab0('0xd')](socket);function respondWithRpcPromise(_0x1557da,_0x24ad93,_0x871ff6){return new BPromise(function(_0x1da890,_0xab97c1){return client[_0x2ab0('0xe')](_0x1557da,_0x871ff6)['then'](function(_0x19889){logger[_0x2ab0('0xf')]('SquareProject,\x20%s,\x20%s',_0x24ad93,_0x2ab0('0x10'));logger['debug'](_0x2ab0('0x11'),_0x24ad93,_0x2ab0('0x10'),JSON[_0x2ab0('0x12')](_0x19889));if(_0x19889[_0x2ab0('0x13')]){if(_0x19889[_0x2ab0('0x13')][_0x2ab0('0x14')]===0x1f4){logger[_0x2ab0('0x13')](_0x2ab0('0x15'),_0x24ad93,_0x19889[_0x2ab0('0x13')][_0x2ab0('0x16')]);return _0xab97c1(_0x19889[_0x2ab0('0x13')][_0x2ab0('0x16')]);}logger[_0x2ab0('0x13')](_0x2ab0('0x15'),_0x24ad93,_0x19889['error'][_0x2ab0('0x16')]);return _0x1da890(_0x19889[_0x2ab0('0x13')]['message']);}else{logger[_0x2ab0('0xf')](_0x2ab0('0x15'),_0x24ad93,_0x2ab0('0x10'));_0x1da890(_0x19889[_0x2ab0('0x17')][_0x2ab0('0x16')]);}})[_0x2ab0('0x18')](function(_0x482ff2){logger[_0x2ab0('0x13')](_0x2ab0('0x15'),_0x24ad93,_0x482ff2);_0xab97c1(_0x482ff2);});});}exports[_0x2ab0('0x19')]=function(_0x549eb4){var _0x10405b=this;return new Promise(function(_0x122386,_0x1e2b5f){return db[_0x2ab0('0x1a')][_0x2ab0('0x1b')]({'raw':_0x549eb4['options']?_0x549eb4[_0x2ab0('0x1c')][_0x2ab0('0x1d')]===undefined?!![]:![]:!![],'where':_0x549eb4[_0x2ab0('0x1c')]?_0x549eb4[_0x2ab0('0x1c')][_0x2ab0('0x1e')]||null:null,'attributes':_0x549eb4[_0x2ab0('0x1c')]?_0x549eb4[_0x2ab0('0x1c')][_0x2ab0('0x1f')]||null:null,'include':_0x549eb4[_0x2ab0('0x1c')]?_0x549eb4[_0x2ab0('0x1c')]['include']?_[_0x2ab0('0x20')](_0x549eb4[_0x2ab0('0x1c')][_0x2ab0('0x21')],function(_0x40ebfa){return{'model':db[_0x40ebfa[_0x2ab0('0x22')]],'as':_0x40ebfa['as'],'attributes':_0x40ebfa[_0x2ab0('0x1f')],'include':_0x40ebfa[_0x2ab0('0x21')]?_[_0x2ab0('0x20')](_0x40ebfa[_0x2ab0('0x21')],function(_0xf83e93){return{'model':db[_0xf83e93[_0x2ab0('0x22')]],'as':_0xf83e93['as'],'attributes':_0xf83e93[_0x2ab0('0x1f')],'include':_0xf83e93['include']?_[_0x2ab0('0x20')](_0xf83e93['include'],function(_0x5e1996){return{'model':db[_0x5e1996['model']],'as':_0x5e1996['as'],'attributes':_0x5e1996['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ab0('0x23')](function(_0x16bd45){logger[_0x2ab0('0xf')](_0x2ab0('0x19'),_0x549eb4);logger['debug'](_0x2ab0('0x19'),_0x549eb4,JSON[_0x2ab0('0x12')](_0x16bd45));_0x122386(_0x16bd45);})['catch'](function(_0x10f695){logger[_0x2ab0('0x13')](_0x2ab0('0x19'),_0x10f695[_0x2ab0('0x16')],_0x549eb4);_0x1e2b5f(_0x10405b[_0x2ab0('0x13')](0x1f4,_0x10f695['message']));});});}; \ No newline at end of file +var _0x9b63=['moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowSquareProject','SquareProject','options','raw','where','include','model','attributes','stringify','catch','util'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x9b63,0x65));var _0x39b6=function(_0x1d69ba,_0x4090c9){_0x1d69ba=_0x1d69ba-0x0;var _0x8bab8c=_0x9b63[_0x1d69ba];return _0x8bab8c;};'use strict';var _=require('lodash');var util=require(_0x39b6('0x0'));var moment=require(_0x39b6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39b6('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x39b6('0x3'))(_0x39b6('0x4'));var config=require(_0x39b6('0x5'));var jayson=require(_0x39b6('0x6'));var client=jayson[_0x39b6('0x7')][_0x39b6('0x8')]({'port':0x232a});config[_0x39b6('0x9')]=_[_0x39b6('0xa')](config[_0x39b6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x39b6('0xb'))(new Redis(config[_0x39b6('0x9')]));require('./squareProject.socket')[_0x39b6('0xc')](socket);function respondWithRpcPromise(_0x422cc3,_0x2b8a3e,_0x56752b){return new BPromise(function(_0x2311a8,_0x8586db){return client[_0x39b6('0xd')](_0x422cc3,_0x56752b)[_0x39b6('0xe')](function(_0x8c8bf8){logger['info'](_0x39b6('0xf'),_0x2b8a3e,_0x39b6('0x10'));logger[_0x39b6('0x11')](_0x39b6('0x12'),_0x2b8a3e,_0x39b6('0x10'),JSON['stringify'](_0x8c8bf8));if(_0x8c8bf8[_0x39b6('0x13')]){if(_0x8c8bf8[_0x39b6('0x13')][_0x39b6('0x14')]===0x1f4){logger[_0x39b6('0x13')](_0x39b6('0xf'),_0x2b8a3e,_0x8c8bf8[_0x39b6('0x13')][_0x39b6('0x15')]);return _0x8586db(_0x8c8bf8[_0x39b6('0x13')][_0x39b6('0x15')]);}logger[_0x39b6('0x13')]('SquareProject,\x20%s,\x20%s',_0x2b8a3e,_0x8c8bf8['error'][_0x39b6('0x15')]);return _0x2311a8(_0x8c8bf8[_0x39b6('0x13')][_0x39b6('0x15')]);}else{logger[_0x39b6('0x16')](_0x39b6('0xf'),_0x2b8a3e,_0x39b6('0x10'));_0x2311a8(_0x8c8bf8[_0x39b6('0x17')]['message']);}})['catch'](function(_0x3c858c){logger['error'](_0x39b6('0xf'),_0x2b8a3e,_0x3c858c);_0x8586db(_0x3c858c);});});}exports[_0x39b6('0x18')]=function(_0x102172){var _0x6e2062=this;return new Promise(function(_0x4994c0,_0x1c14b1){return db[_0x39b6('0x19')]['find']({'raw':_0x102172[_0x39b6('0x1a')]?_0x102172[_0x39b6('0x1a')][_0x39b6('0x1b')]===undefined?!![]:![]:!![],'where':_0x102172['options']?_0x102172[_0x39b6('0x1a')][_0x39b6('0x1c')]||null:null,'attributes':_0x102172['options']?_0x102172[_0x39b6('0x1a')]['attributes']||null:null,'include':_0x102172['options']?_0x102172[_0x39b6('0x1a')][_0x39b6('0x1d')]?_['map'](_0x102172['options'][_0x39b6('0x1d')],function(_0x4a87c6){return{'model':db[_0x4a87c6[_0x39b6('0x1e')]],'as':_0x4a87c6['as'],'attributes':_0x4a87c6[_0x39b6('0x1f')],'include':_0x4a87c6[_0x39b6('0x1d')]?_['map'](_0x4a87c6[_0x39b6('0x1d')],function(_0x3d8cc3){return{'model':db[_0x3d8cc3[_0x39b6('0x1e')]],'as':_0x3d8cc3['as'],'attributes':_0x3d8cc3[_0x39b6('0x1f')],'include':_0x3d8cc3[_0x39b6('0x1d')]?_['map'](_0x3d8cc3[_0x39b6('0x1d')],function(_0x50803a){return{'model':db[_0x50803a[_0x39b6('0x1e')]],'as':_0x50803a['as'],'attributes':_0x50803a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xcfbcc0){logger[_0x39b6('0x16')](_0x39b6('0x18'),_0x102172);logger[_0x39b6('0x11')](_0x39b6('0x18'),_0x102172,JSON[_0x39b6('0x20')](_0xcfbcc0));_0x4994c0(_0xcfbcc0);})[_0x39b6('0x21')](function(_0x470edf){logger[_0x39b6('0x13')]('ShowSquareProject',_0x470edf['message'],_0x102172);_0x1c14b1(_0x6e2062[_0x39b6('0x13')](0x1f4,_0x470edf[_0x39b6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index ed85985..9b0699b 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 _0x1261=['save','remove','update','emit','removeListener','squareProject:'];(function(_0x524865,_0x1d33d0){var _0x4e3817=function(_0x1f945b){while(--_0x1f945b){_0x524865['push'](_0x524865['shift']());}};_0x4e3817(++_0x1d33d0);}(_0x1261,0x144));var _0x1126=function(_0x3a85ab,_0x1f3525){_0x3a85ab=_0x3a85ab-0x0;var _0x32d91a=_0x1261[_0x3a85ab];return _0x32d91a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){SquareProjectEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);SquareProjectEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file +var _0x4975=['length','./squareProject.events','remove','update','emit','removeListener','register'];(function(_0xc9d01c,_0x5819c4){var _0x56f380=function(_0x457dac){while(--_0x457dac){_0xc9d01c['push'](_0xc9d01c['shift']());}};_0x56f380(++_0x5819c4);}(_0x4975,0x86));var _0x5497=function(_0x332ddc,_0x118f54){_0x332ddc=_0x332ddc-0x0;var _0x3df124=_0x4975[_0x332ddc];return _0x3df124;};'use strict';var SquareProjectEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){SquareProjectEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('squareProject:'+_0x674a2a,_0x539a27);SquareProjectEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 47cbbd4..41dc395 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 _0x531f=['index','/:id/download','download','post','put','/:id','delete','/:id/delete','exports','path','connect-timeout','../../config/environment','get','isAuthenticated'];(function(_0x43186d,_0x4b40ec){var _0x5f562c=function(_0x18ed7e){while(--_0x18ed7e){_0x43186d['push'](_0x43186d['shift']());}};_0x5f562c(++_0x4b40ec);}(_0x531f,0x1c9));var _0xf531=function(_0xf4f343,_0x41fe4a){_0xf4f343=_0xf4f343-0x0;var _0x4cda68=_0x531f[_0xf4f343];return _0x4cda68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf531('0x0'));var timeout=require(_0xf531('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf531('0x2'));var controller=require('./squareRecording.controller');router[_0xf531('0x3')]('/',auth[_0xf531('0x4')](),controller[_0xf531('0x5')]);router[_0xf531('0x3')]('/:id',auth[_0xf531('0x4')](),controller['show']);router[_0xf531('0x3')](_0xf531('0x6'),auth[_0xf531('0x4')](),controller[_0xf531('0x7')]);router[_0xf531('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf531('0x9')](_0xf531('0xa'),auth[_0xf531('0x4')](),controller['update']);router[_0xf531('0xb')](_0xf531('0xc'),auth[_0xf531('0x4')](),controller['destroy']);module[_0xf531('0xd')]=router; \ No newline at end of file +var _0xd3c3=['download','post','create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd3c3,0x16f));var _0x3d3c=function(_0x431772,_0x365fd6){_0x431772=_0x431772-0x0;var _0x37fc76=_0xd3c3[_0x431772];return _0x37fc76;};'use strict';var multer=require(_0x3d3c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3d3c('0x1'));var express=require(_0x3d3c('0x2'));var router=express[_0x3d3c('0x3')]();var auth=require(_0x3d3c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3d3c('0x5'));var controller=require(_0x3d3c('0x6'));router[_0x3d3c('0x7')]('/',auth[_0x3d3c('0x8')](),controller[_0x3d3c('0x9')]);router[_0x3d3c('0x7')](_0x3d3c('0xa'),auth[_0x3d3c('0x8')](),controller[_0x3d3c('0xb')]);router[_0x3d3c('0x7')](_0x3d3c('0xc'),auth['isAuthenticated'](),controller[_0x3d3c('0xd')]);router[_0x3d3c('0xe')]('/',auth[_0x3d3c('0x8')](),controller[_0x3d3c('0xf')]);router[_0x3d3c('0x10')](_0x3d3c('0xa'),auth[_0x3d3c('0x8')](),controller['update']);router[_0x3d3c('0x11')]('/:id/delete',auth['isAuthenticated'](),controller[_0x3d3c('0x12')]);module[_0x3d3c('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 ef6933c..317d60a 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 _0x7f9e=['VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x2e0979,_0x1d6067){var _0x486780=function(_0x11c955){while(--_0x11c955){_0x2e0979['push'](_0x2e0979['shift']());}};_0x486780(++_0x1d6067);}(_0x7f9e,0x90));var _0xe7f9=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x7f9e[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require(_0xe7f9('0x0'));module[_0xe7f9('0x1')]={'uniqueid':{'type':Sequelize[_0xe7f9('0x2')]},'callerid':{'type':Sequelize[_0xe7f9('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xe7f9('0x2')]},'extension':{'type':Sequelize[_0xe7f9('0x2')]},'priority':{'type':Sequelize[_0xe7f9('0x2')]},'accountcode':{'type':Sequelize[_0xe7f9('0x2')]},'dnid':{'type':Sequelize[_0xe7f9('0x2')]},'projectName':{'type':Sequelize[_0xe7f9('0x2')]},'saveName':{'type':Sequelize[_0xe7f9('0x2')]},'filename':{'type':Sequelize[_0xe7f9('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xe7f9('0x3')],'get':function(){var _0x4ce68d='';var _0x149229=this[_0xe7f9('0x4')]('savePath');if(_0x149229){_0x4ce68d=_0x149229[_0xe7f9('0x5')](_0x149229[_0xe7f9('0x6')]('.'));}return _0x4ce68d;}}}; \ No newline at end of file +var _0x6960=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize'];(function(_0x12cd04,_0x391a8b){var _0x4b9427=function(_0x4ceff9){while(--_0x4ceff9){_0x12cd04['push'](_0x12cd04['shift']());}};_0x4b9427(++_0x391a8b);}(_0x6960,0xae));var _0x0696=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6960[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x0696('0x0'));module[_0x0696('0x1')]={'uniqueid':{'type':Sequelize[_0x0696('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0696('0x2')]},'context':{'type':Sequelize[_0x0696('0x2')]},'extension':{'type':Sequelize[_0x0696('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x0696('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x0696('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x0696('0x3')],'get':function(){var _0x2acd2a='';var _0x300f94=this[_0x0696('0x4')](_0x0696('0x5'));if(_0x300f94){_0x2acd2a=_0x300f94['substring'](_0x300f94[_0x0696('0x6')]('.'));}return _0x2acd2a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index cd89a2b..f536796 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 _0x308e=['info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','destroy','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','create','update','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','decryptFile','secrets','recording','existsSync','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found'];(function(_0x112147,_0x4e692e){var _0x3ba744=function(_0x191b87){while(--_0x191b87){_0x112147['push'](_0x112147['shift']());}};_0x3ba744(++_0x4e692e);}(_0x308e,0x187));var _0xe308=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x308e[_0x1e7b16];return _0x37fadc;};'use strict';var pdf=require(_0xe308('0x0'));var emlformat=require(_0xe308('0x1'));var rimraf=require(_0xe308('0x2'));var zipdir=require(_0xe308('0x3'));var jsonpatch=require(_0xe308('0x4'));var rp=require('request-promise');var moment=require(_0xe308('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe308('0x6'));var util=require('util');var path=require(_0xe308('0x7'));var sox=require(_0xe308('0x8'));var csv=require(_0xe308('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe308('0xa'));var squel=require(_0xe308('0xb'));var crypto=require('crypto');var jsforce=require(_0xe308('0xc'));var deskjs=require(_0xe308('0xd'));var toCsv=require(_0xe308('0x9'));var querystring=require(_0xe308('0xe'));var Papa=require('papaparse');var Redis=require(_0xe308('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe308('0x10'));var as=require(_0xe308('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe308('0x12'))(_0xe308('0x13'));var utils=require('../../config/utils');var config=require(_0xe308('0x14'));var db=require(_0xe308('0x15'))['db'];function respondWithStatusCode(_0x4efd12,_0x5582f8){_0x5582f8=_0x5582f8||0xcc;return function(_0x5b4b15){if(_0x5b4b15){return _0x4efd12[_0xe308('0x16')](_0x5582f8);}return _0x4efd12[_0xe308('0x17')](_0x5582f8)[_0xe308('0x18')]();};}function respondWithResult(_0x57cf15,_0x3de5db){_0x3de5db=_0x3de5db||0xc8;return function(_0x57ac81){if(_0x57ac81){return _0x57cf15[_0xe308('0x17')](_0x3de5db)['json'](_0x57ac81);}};}function respondWithFilteredResult(_0x49379c,_0x2b50d1){return function(_0xa71cda){if(_0xa71cda){var _0x56c4c0=_0xa71cda[_0xe308('0x19')],_0x478607=_0x2b50d1[_0xe308('0x1a')],_0x489ba0=_0x2b50d1[_0xe308('0x1a')]+_0x2b50d1[_0xe308('0x1b')],_0x1c664c;if(_0x489ba0>=_0x56c4c0){_0x489ba0=_0x56c4c0;_0x1c664c=0xc8;}else{_0x1c664c=0xce;}_0x49379c[_0xe308('0x17')](_0x1c664c);return _0x49379c[_0xe308('0x1c')](_0xe308('0x1d'),_0x478607+'-'+_0x489ba0+'/'+_0x56c4c0)[_0xe308('0x1e')](_0xa71cda);}return null;};}function patchUpdates(_0x303d08){return function(_0x2b87bc){try{jsonpatch[_0xe308('0x1f')](_0x2b87bc,_0x303d08,!![]);}catch(_0x6e3402){return BPromise[_0xe308('0x20')](_0x6e3402);}return _0x2b87bc['save']();};}function saveUpdates(_0x27e019,_0x193d7f){return function(_0x1479d8){if(_0x1479d8){return _0x1479d8['update'](_0x27e019)['then'](function(_0x5b96d7){return _0x5b96d7;});}return null;};}function removeEntity(_0x375470,_0x1298e1){return function(_0x346d7b){if(_0x346d7b){return _0x346d7b[_0xe308('0x21')]()[_0xe308('0x22')](function(){_0x375470[_0xe308('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x562642,_0x40119d){return function(_0x316364){if(!_0x316364){_0x562642['sendStatus'](0x194);}return _0x316364;};}function handleError(_0xa44e74,_0x2c1527){_0x2c1527=_0x2c1527||0x1f4;return function(_0x70af23){logger[_0xe308('0x23')](_0x70af23[_0xe308('0x24')]);if(_0x70af23[_0xe308('0x25')]){delete _0x70af23['name'];}_0xa44e74[_0xe308('0x17')](_0x2c1527)[_0xe308('0x26')](_0x70af23);};}exports[_0xe308('0x27')]=function(_0x3aa414,_0x16ce8f){var _0xc6c193={},_0x3cbdfd={},_0x2b9dfe={'count':0x0,'rows':[]};var _0xd2a735=_[_0xe308('0x28')](db[_0xe308('0x29')][_0xe308('0x2a')],function(_0x4a75c8){return{'name':_0x4a75c8[_0xe308('0x2b')],'type':_0x4a75c8[_0xe308('0x2c')][_0xe308('0x2d')]};});_0x3cbdfd[_0xe308('0x2e')]=_[_0xe308('0x28')](_0xd2a735,'name');_0x3cbdfd[_0xe308('0x2f')]=_[_0xe308('0x30')](_0x3aa414[_0xe308('0x2f')]);_0x3cbdfd[_0xe308('0x31')]=_[_0xe308('0x32')](_0x3cbdfd['model'],_0x3cbdfd['query']);_0xc6c193['attributes']=_[_0xe308('0x32')](_0x3cbdfd[_0xe308('0x2e')],qs[_0xe308('0x33')](_0x3aa414['query'][_0xe308('0x33')]));_0xc6c193[_0xe308('0x34')]=_0xc6c193['attributes'][_0xe308('0x35')]?_0xc6c193[_0xe308('0x34')]:_0x3cbdfd[_0xe308('0x2e')];if(!_0x3aa414[_0xe308('0x2f')][_0xe308('0x36')](_0xe308('0x37'))){_0xc6c193[_0xe308('0x1b')]=qs[_0xe308('0x1b')](_0x3aa414['query']['limit']);_0xc6c193['offset']=qs['offset'](_0x3aa414[_0xe308('0x2f')]['offset']);}_0xc6c193['order']=qs[_0xe308('0x38')](_0x3aa414[_0xe308('0x2f')][_0xe308('0x38')]);_0xc6c193[_0xe308('0x39')]=qs[_0xe308('0x31')](_[_0xe308('0x3a')](_0x3aa414['query'],_0x3cbdfd[_0xe308('0x31')]),_0xd2a735);if(_0x3aa414[_0xe308('0x2f')][_0xe308('0x3b')]){_0xc6c193[_0xe308('0x39')]=_[_0xe308('0x3c')](_0xc6c193['where'],{'$or':_[_0xe308('0x28')](_0xd2a735,function(_0x2be1bc){if(_0x2be1bc[_0xe308('0x2c')]!==_0xe308('0x3d')){var _0x58ce5b={};_0x58ce5b[_0x2be1bc[_0xe308('0x25')]]={'$like':'%'+_0x3aa414[_0xe308('0x2f')][_0xe308('0x3b')]+'%'};return _0x58ce5b;}})});}_0xc6c193=_[_0xe308('0x3c')]({},_0xc6c193,_0x3aa414[_0xe308('0x3e')]);var _0x55d80b={'where':_0xc6c193[_0xe308('0x39')]};return db[_0xe308('0x29')][_0xe308('0x19')](_0x55d80b)[_0xe308('0x22')](function(_0x1f3835){_0x2b9dfe[_0xe308('0x19')]=_0x1f3835;if(_0x3aa414[_0xe308('0x2f')]['includeAll']){_0xc6c193['include']=[{'all':!![]}];}return db['SquareRecording'][_0xe308('0x3f')](_0xc6c193);})[_0xe308('0x22')](function(_0x57a118){_0x2b9dfe[_0xe308('0x40')]=_0x57a118;return _0x2b9dfe;})[_0xe308('0x22')](respondWithFilteredResult(_0x16ce8f,_0xc6c193))[_0xe308('0x41')](handleError(_0x16ce8f,null));};exports[_0xe308('0x42')]=function(_0x5f4d5d,_0x177b5e){var _0x10d40b={'raw':!![],'where':{'id':_0x5f4d5d[_0xe308('0x43')]['id']}},_0x171b5a={};_0x171b5a[_0xe308('0x2e')]=_[_0xe308('0x30')](db[_0xe308('0x29')][_0xe308('0x2a')]);_0x171b5a['query']=_[_0xe308('0x30')](_0x5f4d5d[_0xe308('0x2f')]);_0x171b5a['filters']=_[_0xe308('0x32')](_0x171b5a['model'],_0x171b5a[_0xe308('0x2f')]);_0x10d40b[_0xe308('0x34')]=_[_0xe308('0x32')](_0x171b5a[_0xe308('0x2e')],qs['fields'](_0x5f4d5d[_0xe308('0x2f')][_0xe308('0x33')]));_0x10d40b[_0xe308('0x34')]=_0x10d40b[_0xe308('0x34')][_0xe308('0x35')]?_0x10d40b[_0xe308('0x34')]:_0x171b5a['model'];if(_0x5f4d5d['query'][_0xe308('0x44')]){_0x10d40b['include']=[{'all':!![]}];}_0x10d40b=_[_0xe308('0x3c')]({},_0x10d40b,_0x5f4d5d[_0xe308('0x3e')]);return db[_0xe308('0x29')][_0xe308('0x45')](_0x10d40b)[_0xe308('0x22')](handleEntityNotFound(_0x177b5e,null))[_0xe308('0x22')](respondWithResult(_0x177b5e,null))[_0xe308('0x41')](handleError(_0x177b5e,null));};exports[_0xe308('0x46')]=function(_0x55e065,_0x42b807){return db[_0xe308('0x29')][_0xe308('0x46')](_0x55e065['body'],{})[_0xe308('0x22')](respondWithResult(_0x42b807,0xc9))['catch'](handleError(_0x42b807,null));};exports[_0xe308('0x47')]=function(_0x134a2b,_0x58dcbe){if(_0x134a2b[_0xe308('0x48')]['id']){delete _0x134a2b[_0xe308('0x48')]['id'];}return db[_0xe308('0x29')][_0xe308('0x45')]({'where':{'id':_0x134a2b['params']['id']}})[_0xe308('0x22')](handleEntityNotFound(_0x58dcbe,null))['then'](saveUpdates(_0x134a2b[_0xe308('0x48')],null))[_0xe308('0x22')](respondWithResult(_0x58dcbe,null))[_0xe308('0x41')](handleError(_0x58dcbe,null));};exports[_0xe308('0x49')]=function(_0x5e36c0,_0x32d05f,_0x204454){var _0x5365f7=require(_0xe308('0x4a'));var _0x3dd212=![];var _0x449968={};if(_0x5e36c0[_0xe308('0x2f')][_0xe308('0x2c')]&&_0x5e36c0[_0xe308('0x2f')][_0xe308('0x2c')]==='uniqueid'){_0x449968[_0xe308('0x4b')]=_0x5e36c0[_0xe308('0x43')]['id'];}else{_0x449968['id']=_0x5e36c0[_0xe308('0x43')]['id'];}return db['SquareRecording'][_0xe308('0x45')]({'where':_0x449968,'attributes':['id',_0xe308('0x4c'),_0xe308('0x4d')],'raw':!![]})[_0xe308('0x22')](handleEntityNotFound(_0x32d05f,null))[_0xe308('0x22')](function(_0xa32ec8){if(_0xa32ec8){var _0xe83cfe=_0xa32ec8[_0xe308('0x4c')];var _0x4fcd43=util['format'](_0xe308('0x4e'),_0xe83cfe);if(fs['existsSync'](_0x4fcd43)){_0x3dd212=!![];return _0x5365f7[_0xe308('0x4f')](_0x4fcd43,_0xe83cfe,config[_0xe308('0x50')][_0xe308('0x51')])[_0xe308('0x22')](function(){return _0xa32ec8;});}return _0xa32ec8;}})['then'](function(_0xeb1dc1){if(_0xeb1dc1){var _0x42e9b4=_0xeb1dc1[_0xe308('0x4c')];if(!fs[_0xe308('0x52')](_0x42e9b4)){throw new db['Sequelize']['ValidationError'](_0xe308('0x53'));}if(_0xeb1dc1[_0xe308('0x4d')]){return _0x32d05f['download'](_0x42e9b4,_0xeb1dc1[_0xe308('0x4d')]+path[_0xe308('0x54')](_0x42e9b4),function(){if(_0x3dd212){fs[_0xe308('0x55')](_0x42e9b4);}});}else{return _0x32d05f[_0xe308('0x49')](_0x42e9b4,function(_0x13a889){if(_0x3dd212){fs['unlink'](_0x42e9b4);}});}}})[_0xe308('0x41')](function(_0x24320b){if(_0x24320b[_0xe308('0x56')]===_0xe308('0x53')){_0x32d05f[_0xe308('0x17')](0x194)[_0xe308('0x26')](_0xe308('0x57'));}else{return handleError(_0x32d05f,null);}});};exports[_0xe308('0x21')]=function(_0x233a08,_0xaa0d31){return db[_0xe308('0x29')][_0xe308('0x45')]({'where':{'id':_0x233a08[_0xe308('0x43')]['id']}})['then'](function(_0x4e4200){if(!_0x4e4200)throw new ReferenceError(_0xe308('0x58'));return _0x4e4200;})[_0xe308('0x22')](function(_0x2893e6){var _0x5ec0b0=_0x2893e6[_0xe308('0x4c')];logger[_0xe308('0x59')](_0xe308('0x5a'),_0x5ec0b0);if(!_['isNil'](_0x2893e6[_0xe308('0x4c')])&&fs[_0xe308('0x52')](_0x5ec0b0)){logger[_0xe308('0x59')](_0xe308('0x5b')+_0x5ec0b0+_0xe308('0x5c'));fs['unlinkSync'](_0x5ec0b0);}_0x5ec0b0=_0x5ec0b0+_0xe308('0x5d');if(!_[_0xe308('0x5e')](_0x2893e6[_0xe308('0x4c')])&&fs[_0xe308('0x52')](_0x5ec0b0)){logger[_0xe308('0x59')](_0xe308('0x5b')+_0x5ec0b0+_0xe308('0x5c'));fs[_0xe308('0x5f')](_0x5ec0b0);}return _0x2893e6;})[_0xe308('0x22')](function(_0xd171bf){if(!_0xd171bf)throw new InternalError();return _0xd171bf['destroy']();})[_0xe308('0x22')](function(){_0xaa0d31[_0xe308('0x17')](0xcc)[_0xe308('0x18')]();})['catch'](handleError(_0xaa0d31,null));}; \ No newline at end of file +var _0x6e37=['show','params','find','create','body','download','../../components/encryptor','type','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','error','stack','name','send','index','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','catch'];(function(_0x5ee73b,_0x282c4c){var _0x22948a=function(_0x4bb79b){while(--_0x4bb79b){_0x5ee73b['push'](_0x5ee73b['shift']());}};_0x22948a(++_0x282c4c);}(_0x6e37,0xd9));var _0x76e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e37[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x76e3('0x0'));var emlformat=require(_0x76e3('0x1'));var rimraf=require(_0x76e3('0x2'));var zipdir=require(_0x76e3('0x3'));var jsonpatch=require(_0x76e3('0x4'));var rp=require('request-promise');var moment=require(_0x76e3('0x5'));var BPromise=require(_0x76e3('0x6'));var Mustache=require(_0x76e3('0x7'));var util=require(_0x76e3('0x8'));var path=require(_0x76e3('0x9'));var sox=require(_0x76e3('0xa'));var csv=require(_0x76e3('0xb'));var ejs=require(_0x76e3('0xc'));var fs=require('fs');var _=require(_0x76e3('0xd'));var squel=require(_0x76e3('0xe'));var crypto=require(_0x76e3('0xf'));var jsforce=require(_0x76e3('0x10'));var deskjs=require(_0x76e3('0x11'));var toCsv=require(_0x76e3('0xb'));var querystring=require(_0x76e3('0x12'));var Papa=require(_0x76e3('0x13'));var Redis=require(_0x76e3('0x14'));var authService=require(_0x76e3('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x76e3('0x16'));var hardwareService=require(_0x76e3('0x17'));var logger=require(_0x76e3('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x76e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x472f5e,_0x4222be){_0x4222be=_0x4222be||0xcc;return function(_0x4c1b39){if(_0x4c1b39){return _0x472f5e[_0x76e3('0x1a')](_0x4222be);}return _0x472f5e[_0x76e3('0x1b')](_0x4222be)[_0x76e3('0x1c')]();};}function respondWithResult(_0x49e993,_0x127c30){_0x127c30=_0x127c30||0xc8;return function(_0x4871e7){if(_0x4871e7){return _0x49e993[_0x76e3('0x1b')](_0x127c30)[_0x76e3('0x1d')](_0x4871e7);}};}function respondWithFilteredResult(_0x48a96f,_0xe09b7){return function(_0x5d270d){if(_0x5d270d){var _0x5d7cd3=_0x5d270d[_0x76e3('0x1e')],_0x4b6d49=_0xe09b7[_0x76e3('0x1f')],_0x16924a=_0xe09b7[_0x76e3('0x1f')]+_0xe09b7[_0x76e3('0x20')],_0x22f9a1;if(_0x16924a>=_0x5d7cd3){_0x16924a=_0x5d7cd3;_0x22f9a1=0xc8;}else{_0x22f9a1=0xce;}_0x48a96f[_0x76e3('0x1b')](_0x22f9a1);return _0x48a96f['set'](_0x76e3('0x21'),_0x4b6d49+'-'+_0x16924a+'/'+_0x5d7cd3)[_0x76e3('0x1d')](_0x5d270d);}return null;};}function patchUpdates(_0x445dbd){return function(_0x2815cf){try{jsonpatch[_0x76e3('0x22')](_0x2815cf,_0x445dbd,!![]);}catch(_0x555fb2){return BPromise['reject'](_0x555fb2);}return _0x2815cf['save']();};}function saveUpdates(_0x257bb8,_0x1278b6){return function(_0x41df89){if(_0x41df89){return _0x41df89[_0x76e3('0x23')](_0x257bb8)['then'](function(_0x2cb453){return _0x2cb453;});}return null;};}function removeEntity(_0x417000,_0x5abf60){return function(_0x2bfcf7){if(_0x2bfcf7){return _0x2bfcf7['destroy']()[_0x76e3('0x24')](function(){_0x417000[_0x76e3('0x1b')](0xcc)[_0x76e3('0x1c')]();});}};}function handleEntityNotFound(_0x4cb8fd,_0x201228){return function(_0x5ba9c9){if(!_0x5ba9c9){_0x4cb8fd[_0x76e3('0x1a')](0x194);}return _0x5ba9c9;};}function handleError(_0x38834c,_0x38aafb){_0x38aafb=_0x38aafb||0x1f4;return function(_0x34aa5d){logger[_0x76e3('0x25')](_0x34aa5d[_0x76e3('0x26')]);if(_0x34aa5d['name']){delete _0x34aa5d[_0x76e3('0x27')];}_0x38834c[_0x76e3('0x1b')](_0x38aafb)[_0x76e3('0x28')](_0x34aa5d);};}exports[_0x76e3('0x29')]=function(_0x5e1111,_0x4e8c1a){var _0x3d6f18={},_0x34fd63={},_0x5bf352={'count':0x0,'rows':[]};var _0x4d8d69=_['map'](db['SquareRecording'][_0x76e3('0x2a')],function(_0x4ec592){return{'name':_0x4ec592['fieldName'],'type':_0x4ec592['type']['key']};});_0x34fd63[_0x76e3('0x2b')]=_[_0x76e3('0x2c')](_0x4d8d69,_0x76e3('0x27'));_0x34fd63[_0x76e3('0x2d')]=_[_0x76e3('0x2e')](_0x5e1111['query']);_0x34fd63[_0x76e3('0x2f')]=_[_0x76e3('0x30')](_0x34fd63[_0x76e3('0x2b')],_0x34fd63[_0x76e3('0x2d')]);_0x3d6f18[_0x76e3('0x31')]=_[_0x76e3('0x30')](_0x34fd63[_0x76e3('0x2b')],qs['fields'](_0x5e1111[_0x76e3('0x2d')][_0x76e3('0x32')]));_0x3d6f18[_0x76e3('0x31')]=_0x3d6f18[_0x76e3('0x31')][_0x76e3('0x33')]?_0x3d6f18[_0x76e3('0x31')]:_0x34fd63[_0x76e3('0x2b')];if(!_0x5e1111[_0x76e3('0x2d')]['hasOwnProperty'](_0x76e3('0x34'))){_0x3d6f18[_0x76e3('0x20')]=qs[_0x76e3('0x20')](_0x5e1111['query'][_0x76e3('0x20')]);_0x3d6f18['offset']=qs['offset'](_0x5e1111[_0x76e3('0x2d')][_0x76e3('0x1f')]);}_0x3d6f18['order']=qs[_0x76e3('0x35')](_0x5e1111[_0x76e3('0x2d')][_0x76e3('0x35')]);_0x3d6f18[_0x76e3('0x36')]=qs['filters'](_[_0x76e3('0x37')](_0x5e1111['query'],_0x34fd63['filters']),_0x4d8d69);if(_0x5e1111[_0x76e3('0x2d')][_0x76e3('0x38')]){_0x3d6f18[_0x76e3('0x36')]=_[_0x76e3('0x39')](_0x3d6f18[_0x76e3('0x36')],{'$or':_['map'](_0x4d8d69,function(_0x5eb41b){if(_0x5eb41b['type']!==_0x76e3('0x3a')){var _0x13f125={};_0x13f125[_0x5eb41b[_0x76e3('0x27')]]={'$like':'%'+_0x5e1111['query'][_0x76e3('0x38')]+'%'};return _0x13f125;}})});}_0x3d6f18=_['merge']({},_0x3d6f18,_0x5e1111[_0x76e3('0x3b')]);var _0x39d835={'where':_0x3d6f18[_0x76e3('0x36')]};return db[_0x76e3('0x3c')][_0x76e3('0x1e')](_0x39d835)[_0x76e3('0x24')](function(_0x1ed2ca){_0x5bf352[_0x76e3('0x1e')]=_0x1ed2ca;if(_0x5e1111[_0x76e3('0x2d')][_0x76e3('0x3d')]){_0x3d6f18[_0x76e3('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0x76e3('0x3f')](_0x3d6f18);})[_0x76e3('0x24')](function(_0x288d42){_0x5bf352['rows']=_0x288d42;return _0x5bf352;})[_0x76e3('0x24')](respondWithFilteredResult(_0x4e8c1a,_0x3d6f18))[_0x76e3('0x40')](handleError(_0x4e8c1a,null));};exports[_0x76e3('0x41')]=function(_0x29619f,_0x5e5c05){var _0x4ec77a={'raw':!![],'where':{'id':_0x29619f[_0x76e3('0x42')]['id']}},_0x31fc93={};_0x31fc93[_0x76e3('0x2b')]=_[_0x76e3('0x2e')](db[_0x76e3('0x3c')][_0x76e3('0x2a')]);_0x31fc93[_0x76e3('0x2d')]=_['keys'](_0x29619f[_0x76e3('0x2d')]);_0x31fc93[_0x76e3('0x2f')]=_['intersection'](_0x31fc93['model'],_0x31fc93[_0x76e3('0x2d')]);_0x4ec77a['attributes']=_['intersection'](_0x31fc93[_0x76e3('0x2b')],qs[_0x76e3('0x32')](_0x29619f[_0x76e3('0x2d')][_0x76e3('0x32')]));_0x4ec77a[_0x76e3('0x31')]=_0x4ec77a[_0x76e3('0x31')][_0x76e3('0x33')]?_0x4ec77a['attributes']:_0x31fc93['model'];if(_0x29619f[_0x76e3('0x2d')]['includeAll']){_0x4ec77a[_0x76e3('0x3e')]=[{'all':!![]}];}_0x4ec77a=_[_0x76e3('0x39')]({},_0x4ec77a,_0x29619f[_0x76e3('0x3b')]);return db['SquareRecording'][_0x76e3('0x43')](_0x4ec77a)[_0x76e3('0x24')](handleEntityNotFound(_0x5e5c05,null))[_0x76e3('0x24')](respondWithResult(_0x5e5c05,null))[_0x76e3('0x40')](handleError(_0x5e5c05,null));};exports['create']=function(_0x2cb4c1,_0x389c1b){return db[_0x76e3('0x3c')][_0x76e3('0x44')](_0x2cb4c1[_0x76e3('0x45')],{})['then'](respondWithResult(_0x389c1b,0xc9))[_0x76e3('0x40')](handleError(_0x389c1b,null));};exports[_0x76e3('0x23')]=function(_0x513ca2,_0x369b2d){if(_0x513ca2[_0x76e3('0x45')]['id']){delete _0x513ca2[_0x76e3('0x45')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x513ca2[_0x76e3('0x42')]['id']}})['then'](handleEntityNotFound(_0x369b2d,null))[_0x76e3('0x24')](saveUpdates(_0x513ca2[_0x76e3('0x45')],null))[_0x76e3('0x24')](respondWithResult(_0x369b2d,null))['catch'](handleError(_0x369b2d,null));};exports[_0x76e3('0x46')]=function(_0x4e068d,_0x2de292,_0x24b78a){var _0x1b34cd=require(_0x76e3('0x47'));var _0x127fec=![];var _0x4d1476={};if(_0x4e068d[_0x76e3('0x2d')][_0x76e3('0x48')]&&_0x4e068d[_0x76e3('0x2d')][_0x76e3('0x48')]===_0x76e3('0x49')){_0x4d1476[_0x76e3('0x49')]=_0x4e068d[_0x76e3('0x42')]['id'];}else{_0x4d1476['id']=_0x4e068d[_0x76e3('0x42')]['id'];}return db[_0x76e3('0x3c')][_0x76e3('0x43')]({'where':_0x4d1476,'attributes':['id',_0x76e3('0x4a'),_0x76e3('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x2de292,null))[_0x76e3('0x24')](function(_0x4d6f53){if(_0x4d6f53){var _0x30309a=_0x4d6f53[_0x76e3('0x4a')];var _0x3c415d=util['format'](_0x76e3('0x4c'),_0x30309a);if(fs[_0x76e3('0x4d')](_0x3c415d)){_0x127fec=!![];return _0x1b34cd[_0x76e3('0x4e')](_0x3c415d,_0x30309a,config[_0x76e3('0x4f')][_0x76e3('0x50')])['then'](function(){return _0x4d6f53;});}return _0x4d6f53;}})['then'](function(_0x2a8fe6){if(_0x2a8fe6){var _0xdbc6f1=_0x2a8fe6[_0x76e3('0x4a')];if(!fs[_0x76e3('0x4d')](_0xdbc6f1)){throw new db[(_0x76e3('0x51'))]['ValidationError'](_0x76e3('0x52'));}if(_0x2a8fe6[_0x76e3('0x4b')]){return _0x2de292[_0x76e3('0x46')](_0xdbc6f1,_0x2a8fe6[_0x76e3('0x4b')]+path[_0x76e3('0x53')](_0xdbc6f1),function(){if(_0x127fec){fs[_0x76e3('0x54')](_0xdbc6f1);}});}else{return _0x2de292[_0x76e3('0x46')](_0xdbc6f1,function(_0x32440f){if(_0x127fec){fs[_0x76e3('0x54')](_0xdbc6f1);}});}}})[_0x76e3('0x40')](function(_0x3af978){if(_0x3af978[_0x76e3('0x55')]===_0x76e3('0x52')){_0x2de292[_0x76e3('0x1b')](0x194)['send'](_0x76e3('0x56'));}else{return handleError(_0x2de292,null);}});};exports['destroy']=function(_0x216c4b,_0x52011d){return db['SquareRecording'][_0x76e3('0x43')]({'where':{'id':_0x216c4b['params']['id']}})['then'](function(_0x3b2f39){if(!_0x3b2f39)throw new ReferenceError('Entity\x20not\x20found');return _0x3b2f39;})[_0x76e3('0x24')](function(_0x531dd5){var _0x53029b=_0x531dd5['savePath'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x53029b);if(!_[_0x76e3('0x57')](_0x531dd5[_0x76e3('0x4a')])&&fs[_0x76e3('0x4d')](_0x53029b)){logger[_0x76e3('0x58')](_0x76e3('0x59')+_0x53029b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76e3('0x5a')](_0x53029b);}_0x53029b=_0x53029b+_0x76e3('0x5b');if(!_[_0x76e3('0x57')](_0x531dd5['savePath'])&&fs[_0x76e3('0x4d')](_0x53029b)){logger[_0x76e3('0x58')](_0x76e3('0x59')+_0x53029b+_0x76e3('0x5c'));fs[_0x76e3('0x5a')](_0x53029b);}return _0x531dd5;})[_0x76e3('0x24')](function(_0x535fbe){if(!_0x535fbe)throw new InternalError();return _0x535fbe[_0x76e3('0x5d')]();})[_0x76e3('0x24')](function(){_0x52011d['status'](0xcc)['end']();})[_0x76e3('0x40')](handleError(_0x52011d,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 8d24ed6..9be46a2 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 _0x79b0=['api','moment','request-promise','path','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger'];(function(_0x543b08,_0x36bcfc){var _0x1e08e4=function(_0x3bf864){while(--_0x3bf864){_0x543b08['push'](_0x543b08['shift']());}};_0x1e08e4(++_0x36bcfc);}(_0x79b0,0x1ad));var _0x079b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x79b0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x079b('0x0'));var util=require(_0x079b('0x1'));var logger=require(_0x079b('0x2'))(_0x079b('0x3'));var moment=require(_0x079b('0x4'));var BPromise=require('bluebird');var rp=require(_0x079b('0x5'));var fs=require('fs');var path=require(_0x079b('0x6'));var rimraf=require('rimraf');var config=require(_0x079b('0x7'));var attributes=require('./squareRecording.attributes');module[_0x079b('0x8')]=function(_0x1feadc,_0x588203){return _0x1feadc[_0x079b('0x9')](_0x079b('0xa'),attributes,{'tableName':_0x079b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb450=['../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','rimraf'];(function(_0x3afec0,_0x2c7752){var _0x90b878=function(_0x43b4aa){while(--_0x43b4aa){_0x3afec0['push'](_0x3afec0['shift']());}};_0x90b878(++_0x2c7752);}(_0xb450,0x195));var _0x0b45=function(_0x3f87f2,_0x250b96){_0x3f87f2=_0x3f87f2-0x0;var _0x2d70ac=_0xb450[_0x3f87f2];return _0x2d70ac;};'use strict';var _=require(_0x0b45('0x0'));var util=require(_0x0b45('0x1'));var logger=require(_0x0b45('0x2'))(_0x0b45('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0b45('0x4'));var config=require(_0x0b45('0x5'));var attributes=require('./squareRecording.attributes');module[_0x0b45('0x6')]=function(_0x260aaf,_0x1997fb){return _0x260aaf[_0x0b45('0x7')](_0x0b45('0x8'),attributes,{'tableName':_0x0b45('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 ec88eff..8f2ee5c 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 _0x2804=['options','raw','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','SquareRecording,\x20%s,\x20%s','message','info','result','catch','CreateSquareRecording','SquareRecording','body'];(function(_0x4d1de7,_0x5c5fed){var _0x28ae8a=function(_0x2fc7e6){while(--_0x2fc7e6){_0x4d1de7['push'](_0x4d1de7['shift']());}};_0x28ae8a(++_0x5c5fed);}(_0x2804,0x16c));var _0x4280=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2804[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4280('0x0'));var util=require(_0x4280('0x1'));var moment=require('moment');var BPromise=require(_0x4280('0x2'));var rs=require(_0x4280('0x3'));var fs=require('fs');var Redis=require(_0x4280('0x4'));var db=require(_0x4280('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4280('0x6'))(_0x4280('0x7'));var config=require(_0x4280('0x8'));var jayson=require(_0x4280('0x9'));var client=jayson[_0x4280('0xa')][_0x4280('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x522e42,_0x3d7c51,_0x3cd6c1){return new BPromise(function(_0x2f796e,_0x253ee8){return client[_0x4280('0xc')](_0x522e42,_0x3cd6c1)[_0x4280('0xd')](function(_0x8d4323){logger['info']('SquareRecording,\x20%s,\x20%s',_0x3d7c51,_0x4280('0xe'));logger['debug'](_0x4280('0xf'),_0x3d7c51,_0x4280('0xe'),JSON['stringify'](_0x8d4323));if(_0x8d4323[_0x4280('0x10')]){if(_0x8d4323[_0x4280('0x10')][_0x4280('0x11')]===0x1f4){logger[_0x4280('0x10')](_0x4280('0x12'),_0x3d7c51,_0x8d4323[_0x4280('0x10')]['message']);return _0x253ee8(_0x8d4323['error'][_0x4280('0x13')]);}logger[_0x4280('0x10')]('SquareRecording,\x20%s,\x20%s',_0x3d7c51,_0x8d4323['error'][_0x4280('0x13')]);return _0x2f796e(_0x8d4323[_0x4280('0x10')]['message']);}else{logger[_0x4280('0x14')](_0x4280('0x12'),_0x3d7c51,_0x4280('0xe'));_0x2f796e(_0x8d4323[_0x4280('0x15')][_0x4280('0x13')]);}})[_0x4280('0x16')](function(_0x510e5f){logger['error'](_0x4280('0x12'),_0x3d7c51,_0x510e5f);_0x253ee8(_0x510e5f);});});}exports[_0x4280('0x17')]=function(_0x442cb6){var _0x2ba7d0=this;return new Promise(function(_0x1699a2,_0x484a86){return db[_0x4280('0x18')]['create'](_0x442cb6[_0x4280('0x19')],{'raw':_0x442cb6['options']?_0x442cb6[_0x4280('0x1a')][_0x4280('0x1b')]===undefined?!![]:![]:!![]})[_0x4280('0xd')](function(_0x2d1938){logger['info'](_0x4280('0x17'),_0x442cb6);logger[_0x4280('0x1c')](_0x4280('0x17'),_0x442cb6,JSON[_0x4280('0x1d')](_0x2d1938));_0x1699a2(_0x2d1938);})[_0x4280('0x16')](function(_0x55ad83){logger[_0x4280('0x10')](_0x4280('0x17'),_0x55ad83[_0x4280('0x13')],_0x442cb6);_0x484a86(_0x2ba7d0[_0x4280('0x10')](0x1f4,_0x55ad83[_0x4280('0x13')]));});});}; \ No newline at end of file +var _0x9985=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareRecording','SquareRecording','create','options','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3b4bef,_0x17022c){var _0x23c51b=function(_0x3bfdb6){while(--_0x3bfdb6){_0x3b4bef['push'](_0x3b4bef['shift']());}};_0x23c51b(++_0x17022c);}(_0x9985,0x176));var _0x5998=function(_0x4a584a,_0x2d893d){_0x4a584a=_0x4a584a-0x0;var _0x24d74c=_0x9985[_0x4a584a];return _0x24d74c;};'use strict';var _=require(_0x5998('0x0'));var util=require(_0x5998('0x1'));var moment=require(_0x5998('0x2'));var BPromise=require('bluebird');var rs=require(_0x5998('0x3'));var fs=require('fs');var Redis=require(_0x5998('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5998('0x5'));var logger=require(_0x5998('0x6'))(_0x5998('0x7'));var config=require('../../config/environment');var jayson=require(_0x5998('0x8'));var client=jayson[_0x5998('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eae7e,_0x446d02,_0x3aa45d){return new BPromise(function(_0x2f8be5,_0x4cfc1a){return client[_0x5998('0xa')](_0x2eae7e,_0x3aa45d)[_0x5998('0xb')](function(_0x1a5d58){logger[_0x5998('0xc')](_0x5998('0xd'),_0x446d02,_0x5998('0xe'));logger[_0x5998('0xf')](_0x5998('0x10'),_0x446d02,_0x5998('0xe'),JSON[_0x5998('0x11')](_0x1a5d58));if(_0x1a5d58[_0x5998('0x12')]){if(_0x1a5d58[_0x5998('0x12')]['code']===0x1f4){logger[_0x5998('0x12')](_0x5998('0xd'),_0x446d02,_0x1a5d58['error'][_0x5998('0x13')]);return _0x4cfc1a(_0x1a5d58[_0x5998('0x12')][_0x5998('0x13')]);}logger['error'](_0x5998('0xd'),_0x446d02,_0x1a5d58[_0x5998('0x12')][_0x5998('0x13')]);return _0x2f8be5(_0x1a5d58[_0x5998('0x12')][_0x5998('0x13')]);}else{logger[_0x5998('0xc')](_0x5998('0xd'),_0x446d02,_0x5998('0xe'));_0x2f8be5(_0x1a5d58[_0x5998('0x14')]['message']);}})['catch'](function(_0x33e60e){logger[_0x5998('0x12')](_0x5998('0xd'),_0x446d02,_0x33e60e);_0x4cfc1a(_0x33e60e);});});}exports[_0x5998('0x15')]=function(_0xe470c8){var _0x36321d=this;return new Promise(function(_0x4ba657,_0xf93471){return db[_0x5998('0x16')][_0x5998('0x17')](_0xe470c8['body'],{'raw':_0xe470c8[_0x5998('0x18')]?_0xe470c8[_0x5998('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x5998('0xb')](function(_0xb5024d){logger['info'](_0x5998('0x15'),_0xe470c8);logger['debug'](_0x5998('0x15'),_0xe470c8,JSON['stringify'](_0xb5024d));_0x4ba657(_0xb5024d);})[_0x5998('0x19')](function(_0x3ff603){logger[_0x5998('0x12')]('CreateSquareRecording',_0x3ff603[_0x5998('0x13')],_0xe470c8);_0xf93471(_0x36321d[_0x5998('0x12')](0x1f4,_0x3ff603['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index a001c16..9ebc0c3 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 _0xf5f0=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x5e9bbd,_0x4b43cd){var _0xc7828d=function(_0x7a6a5c){while(--_0x7a6a5c){_0x5e9bbd['push'](_0x5e9bbd['shift']());}};_0xc7828d(++_0x4b43cd);}(_0xf5f0,0x171));var _0x0f5f=function(_0x592a18,_0x20d4dd){_0x592a18=_0x592a18-0x0;var _0x34ccb9=_0xf5f0[_0x592a18];return _0x34ccb9;};'use strict';var multer=require(_0x0f5f('0x0'));var util=require(_0x0f5f('0x1'));var path=require(_0x0f5f('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f5f('0x3'));var router=express[_0x0f5f('0x4')]();var auth=require(_0x0f5f('0x5'));var interaction=require(_0x0f5f('0x6'));var config=require(_0x0f5f('0x7'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0f5f('0x8')](),controller[_0x0f5f('0x9')]);router['get'](_0x0f5f('0xa'),auth[_0x0f5f('0x8')](),controller[_0x0f5f('0xb')]);router[_0x0f5f('0xc')](_0x0f5f('0xd'),auth[_0x0f5f('0x8')](),controller[_0x0f5f('0xe')]);router[_0x0f5f('0xf')]('/',auth[_0x0f5f('0x8')](),controller[_0x0f5f('0x10')]);router[_0x0f5f('0x11')](_0x0f5f('0xd'),auth[_0x0f5f('0x8')](),controller[_0x0f5f('0x12')]);router[_0x0f5f('0x13')](_0x0f5f('0xd'),auth[_0x0f5f('0x8')](),controller[_0x0f5f('0x14')]);module[_0x0f5f('0x15')]=router; \ No newline at end of file +var _0x4eda=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4eda,0x1ed));var _0xa4ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4eda[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xa4ed('0x0'));var util=require(_0xa4ed('0x1'));var path=require(_0xa4ed('0x2'));var timeout=require(_0xa4ed('0x3'));var express=require(_0xa4ed('0x4'));var router=express[_0xa4ed('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa4ed('0x6'));var config=require(_0xa4ed('0x7'));var controller=require(_0xa4ed('0x8'));router[_0xa4ed('0x9')]('/',auth[_0xa4ed('0xa')](),controller[_0xa4ed('0xb')]);router[_0xa4ed('0x9')](_0xa4ed('0xc'),auth[_0xa4ed('0xa')](),controller['describe']);router[_0xa4ed('0x9')](_0xa4ed('0xd'),auth[_0xa4ed('0xa')](),controller[_0xa4ed('0xe')]);router['post']('/',auth[_0xa4ed('0xa')](),controller['create']);router[_0xa4ed('0xf')](_0xa4ed('0xd'),auth[_0xa4ed('0xa')](),controller[_0xa4ed('0x10')]);router[_0xa4ed('0x11')](_0xa4ed('0xd'),auth[_0xa4ed('0xa')](),controller['destroy']);module[_0xa4ed('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index d37b6a6..ac236b9 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 _0x006b=['exports','STRING','DATE','BOOLEAN'];(function(_0x261bcb,_0x52b65a){var _0x5de730=function(_0x5d1e11){while(--_0x5d1e11){_0x261bcb['push'](_0x261bcb['shift']());}};_0x5de730(++_0x52b65a);}(_0x006b,0xbc));var _0xb006=function(_0x4a0b63,_0x1b9603){_0x4a0b63=_0x4a0b63-0x0;var _0x3bdfdd=_0x006b[_0x4a0b63];return _0x3bdfdd;};'use strict';var Sequelize=require('sequelize');module[_0xb006('0x0')]={'network':{'type':Sequelize[_0xb006('0x1')]},'network_script':{'type':Sequelize[_0xb006('0x1')]},'request':{'type':Sequelize[_0xb006('0x1')]},'channel':{'type':Sequelize[_0xb006('0x1')]},'language':{'type':Sequelize[_0xb006('0x1')]},'type':{'type':Sequelize[_0xb006('0x1')]},'uniqueid':{'type':Sequelize[_0xb006('0x1')]},'version':{'type':Sequelize[_0xb006('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb006('0x1')]},'callingpres':{'type':Sequelize[_0xb006('0x1')]},'callingani2':{'type':Sequelize[_0xb006('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xb006('0x1')]},'dnid':{'type':Sequelize[_0xb006('0x1')]},'rdnis':{'type':Sequelize[_0xb006('0x1')]},'context':{'type':Sequelize[_0xb006('0x1')]},'extension':{'type':Sequelize[_0xb006('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xb006('0x1')]},'accountcode':{'type':Sequelize[_0xb006('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xb006('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb006('0x2')]},'bot':{'type':Sequelize[_0xb006('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4be1=['DATE','BOOLEAN','exports','STRING'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x4be1,0x14a));var _0x14be=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x4be1[_0x1eda20];return _0x31b953;};'use strict';var Sequelize=require('sequelize');module[_0x14be('0x0')]={'network':{'type':Sequelize[_0x14be('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x14be('0x1')]},'channel':{'type':Sequelize[_0x14be('0x1')]},'language':{'type':Sequelize[_0x14be('0x1')]},'type':{'type':Sequelize[_0x14be('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x14be('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x14be('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x14be('0x1')]},'callingtns':{'type':Sequelize[_0x14be('0x1')]},'dnid':{'type':Sequelize[_0x14be('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x14be('0x1')]},'extension':{'type':Sequelize[_0x14be('0x1')]},'priority':{'type':Sequelize[_0x14be('0x1')]},'enhanced':{'type':Sequelize[_0x14be('0x1')]},'accountcode':{'type':Sequelize[_0x14be('0x1')]},'threadid':{'type':Sequelize[_0x14be('0x1')]},'project_name':{'type':Sequelize[_0x14be('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x14be('0x2')]},'bot':{'type':Sequelize[_0x14be('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index bc6b034..d205535 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 _0x459d=['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','status','end','json','count','offset','Content-Range','reject','save','update','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','findAll','catch','params','length','include','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x501f8b,_0x537f45){var _0x125925=function(_0x42ded7){while(--_0x42ded7){_0x501f8b['push'](_0x501f8b['shift']());}};_0x125925(++_0x537f45);}(_0x459d,0x8f));var _0xd459=function(_0x582e51,_0x48e819){_0x582e51=_0x582e51-0x0;var _0x363ec5=_0x459d[_0x582e51];return _0x363ec5;};'use strict';var pdf=require(_0xd459('0x0'));var emlformat=require(_0xd459('0x1'));var rimraf=require(_0xd459('0x2'));var zipdir=require(_0xd459('0x3'));var jsonpatch=require(_0xd459('0x4'));var rp=require(_0xd459('0x5'));var moment=require(_0xd459('0x6'));var BPromise=require(_0xd459('0x7'));var Mustache=require(_0xd459('0x8'));var util=require('util');var path=require(_0xd459('0x9'));var sox=require(_0xd459('0xa'));var csv=require(_0xd459('0xb'));var ejs=require(_0xd459('0xc'));var fs=require('fs');var _=require(_0xd459('0xd'));var squel=require(_0xd459('0xe'));var crypto=require(_0xd459('0xf'));var jsforce=require(_0xd459('0x10'));var deskjs=require(_0xd459('0x11'));var toCsv=require(_0xd459('0xb'));var querystring=require(_0xd459('0x12'));var Papa=require(_0xd459('0x13'));var Redis=require(_0xd459('0x14'));var authService=require(_0xd459('0x15'));var qs=require(_0xd459('0x16'));var as=require(_0xd459('0x17'));var hardwareService=require(_0xd459('0x18'));var logger=require('../../config/logger')(_0xd459('0x19'));var utils=require(_0xd459('0x1a'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x188034,_0x5304d2){_0x5304d2=_0x5304d2||0xcc;return function(_0x14431e){if(_0x14431e){return _0x188034['sendStatus'](_0x5304d2);}return _0x188034[_0xd459('0x1b')](_0x5304d2)[_0xd459('0x1c')]();};}function respondWithResult(_0x309ba0,_0x5436c3){_0x5436c3=_0x5436c3||0xc8;return function(_0x2805d9){if(_0x2805d9){return _0x309ba0[_0xd459('0x1b')](_0x5436c3)[_0xd459('0x1d')](_0x2805d9);}};}function respondWithFilteredResult(_0x5aebc5,_0x412dce){return function(_0xb3331a){if(_0xb3331a){var _0x126d59=_0xb3331a[_0xd459('0x1e')],_0x538552=_0x412dce[_0xd459('0x1f')],_0x1e5e2f=_0x412dce[_0xd459('0x1f')]+_0x412dce['limit'],_0x34f59d;if(_0x1e5e2f>=_0x126d59){_0x1e5e2f=_0x126d59;_0x34f59d=0xc8;}else{_0x34f59d=0xce;}_0x5aebc5[_0xd459('0x1b')](_0x34f59d);return _0x5aebc5['set'](_0xd459('0x20'),_0x538552+'-'+_0x1e5e2f+'/'+_0x126d59)['json'](_0xb3331a);}return null;};}function patchUpdates(_0x67e593){return function(_0x4a2d95){try{jsonpatch['apply'](_0x4a2d95,_0x67e593,!![]);}catch(_0x26b55d){return BPromise[_0xd459('0x21')](_0x26b55d);}return _0x4a2d95[_0xd459('0x22')]();};}function saveUpdates(_0x3383c9,_0x565a14){return function(_0x484af8){if(_0x484af8){return _0x484af8[_0xd459('0x23')](_0x3383c9)['then'](function(_0x2af92f){return _0x2af92f;});}return null;};}function removeEntity(_0x123f85,_0x12e4b6){return function(_0x5ee7af){if(_0x5ee7af){return _0x5ee7af['destroy']()[_0xd459('0x24')](function(){_0x123f85[_0xd459('0x1b')](0xcc)[_0xd459('0x1c')]();});}};}function handleEntityNotFound(_0x2fa9e1,_0x5beb20){return function(_0xec7ed2){if(!_0xec7ed2){_0x2fa9e1[_0xd459('0x25')](0x194);}return _0xec7ed2;};}function handleError(_0x2486a0,_0x1ffa98){_0x1ffa98=_0x1ffa98||0x1f4;return function(_0x46e69b){logger[_0xd459('0x26')](_0x46e69b[_0xd459('0x27')]);if(_0x46e69b[_0xd459('0x28')]){delete _0x46e69b[_0xd459('0x28')];}_0x2486a0[_0xd459('0x1b')](_0x1ffa98)['send'](_0x46e69b);};}exports[_0xd459('0x29')]=function(_0x264765,_0x451466){var _0x421992={},_0x3a6d44={},_0x1018c2={'count':0x0,'rows':[]};var _0xb2310a=_[_0xd459('0x2a')](db['SquareReport'][_0xd459('0x2b')],function(_0x5dc494){return{'name':_0x5dc494[_0xd459('0x2c')],'type':_0x5dc494['type'][_0xd459('0x2d')]};});_0x3a6d44[_0xd459('0x2e')]=_[_0xd459('0x2a')](_0xb2310a,_0xd459('0x28'));_0x3a6d44[_0xd459('0x2f')]=_[_0xd459('0x30')](_0x264765[_0xd459('0x2f')]);_0x3a6d44[_0xd459('0x31')]=_[_0xd459('0x32')](_0x3a6d44['model'],_0x3a6d44['query']);_0x421992[_0xd459('0x33')]=_[_0xd459('0x32')](_0x3a6d44['model'],qs[_0xd459('0x34')](_0x264765['query']['fields']));_0x421992[_0xd459('0x33')]=_0x421992[_0xd459('0x33')]['length']?_0x421992[_0xd459('0x33')]:_0x3a6d44[_0xd459('0x2e')];if(!_0x264765['query'][_0xd459('0x35')](_0xd459('0x36'))){_0x421992[_0xd459('0x37')]=qs[_0xd459('0x37')](_0x264765[_0xd459('0x2f')]['limit']);_0x421992[_0xd459('0x1f')]=qs[_0xd459('0x1f')](_0x264765[_0xd459('0x2f')][_0xd459('0x1f')]);}_0x421992[_0xd459('0x38')]=qs[_0xd459('0x39')](_0x264765[_0xd459('0x2f')]['sort']);_0x421992[_0xd459('0x3a')]=qs['filters'](_[_0xd459('0x3b')](_0x264765['query'],_0x3a6d44['filters']),_0xb2310a);if(_0x264765[_0xd459('0x2f')][_0xd459('0x3c')]){_0x421992[_0xd459('0x3a')]=_[_0xd459('0x3d')](_0x421992[_0xd459('0x3a')],{'$or':_[_0xd459('0x2a')](_0xb2310a,function(_0x1a31f5){if(_0x1a31f5['type']!==_0xd459('0x3e')){var _0x5584e7={};_0x5584e7[_0x1a31f5[_0xd459('0x28')]]={'$like':'%'+_0x264765[_0xd459('0x2f')][_0xd459('0x3c')]+'%'};return _0x5584e7;}})});}_0x421992=_['merge']({},_0x421992,_0x264765[_0xd459('0x3f')]);var _0x334b8e={'where':_0x421992[_0xd459('0x3a')]};return db[_0xd459('0x40')]['count'](_0x334b8e)[_0xd459('0x24')](function(_0x288d52){_0x1018c2['count']=_0x288d52;if(_0x264765[_0xd459('0x2f')][_0xd459('0x41')]){_0x421992['include']=[{'all':!![]}];}return db[_0xd459('0x40')][_0xd459('0x42')](_0x421992);})[_0xd459('0x24')](function(_0x36be19){_0x1018c2['rows']=_0x36be19;return _0x1018c2;})['then'](respondWithFilteredResult(_0x451466,_0x421992))[_0xd459('0x43')](handleError(_0x451466,null));};exports['show']=function(_0x2b9e3c,_0x23c1ba){var _0x3302d2={'raw':!![],'where':{'id':_0x2b9e3c[_0xd459('0x44')]['id']}},_0x15f1d3={};_0x15f1d3[_0xd459('0x2e')]=_[_0xd459('0x30')](db['SquareReport'][_0xd459('0x2b')]);_0x15f1d3[_0xd459('0x2f')]=_['keys'](_0x2b9e3c[_0xd459('0x2f')]);_0x15f1d3[_0xd459('0x31')]=_['intersection'](_0x15f1d3[_0xd459('0x2e')],_0x15f1d3[_0xd459('0x2f')]);_0x3302d2[_0xd459('0x33')]=_[_0xd459('0x32')](_0x15f1d3[_0xd459('0x2e')],qs[_0xd459('0x34')](_0x2b9e3c[_0xd459('0x2f')]['fields']));_0x3302d2[_0xd459('0x33')]=_0x3302d2[_0xd459('0x33')][_0xd459('0x45')]?_0x3302d2[_0xd459('0x33')]:_0x15f1d3[_0xd459('0x2e')];if(_0x2b9e3c[_0xd459('0x2f')][_0xd459('0x41')]){_0x3302d2[_0xd459('0x46')]=[{'all':!![]}];}_0x3302d2=_[_0xd459('0x3d')]({},_0x3302d2,_0x2b9e3c[_0xd459('0x3f')]);return db[_0xd459('0x40')][_0xd459('0x47')](_0x3302d2)['then'](handleEntityNotFound(_0x23c1ba,null))['then'](respondWithResult(_0x23c1ba,null))[_0xd459('0x43')](handleError(_0x23c1ba,null));};exports[_0xd459('0x48')]=function(_0xb06a97,_0x3e82d2){return db[_0xd459('0x40')][_0xd459('0x48')](_0xb06a97[_0xd459('0x49')],{})[_0xd459('0x24')](respondWithResult(_0x3e82d2,0xc9))['catch'](handleError(_0x3e82d2,null));};exports[_0xd459('0x23')]=function(_0x4cb352,_0x46501f){if(_0x4cb352[_0xd459('0x49')]['id']){delete _0x4cb352['body']['id'];}return db[_0xd459('0x40')][_0xd459('0x47')]({'where':{'id':_0x4cb352[_0xd459('0x44')]['id']}})['then'](handleEntityNotFound(_0x46501f,null))[_0xd459('0x24')](saveUpdates(_0x4cb352[_0xd459('0x49')],null))[_0xd459('0x24')](respondWithResult(_0x46501f,null))[_0xd459('0x43')](handleError(_0x46501f,null));};exports[_0xd459('0x4a')]=function(_0x3f9aef,_0x40e678){return db[_0xd459('0x40')]['find']({'where':{'id':_0x3f9aef[_0xd459('0x44')]['id']}})[_0xd459('0x24')](handleEntityNotFound(_0x40e678,null))[_0xd459('0x24')](removeEntity(_0x40e678,null))[_0xd459('0x43')](handleError(_0x40e678,null));};exports[_0xd459('0x4b')]=function(_0x42b503,_0x4c3146){return db['SquareReport']['describe']()['then'](respondWithResult(_0x4c3146,null))[_0xd459('0x43')](handleError(_0x4c3146,null));}; \ No newline at end of file +var _0x7a24=['fast-json-patch','request-promise','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','options','find','create','body','params','describe','html-pdf','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a24,0xd2));var _0x47a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a24[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x47a2('0x0'));var emlformat=require(_0x47a2('0x1'));var rimraf=require(_0x47a2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a2('0x3'));var rp=require(_0x47a2('0x4'));var moment=require('moment');var BPromise=require(_0x47a2('0x5'));var Mustache=require(_0x47a2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x47a2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x47a2('0x8'));var squel=require(_0x47a2('0x9'));var crypto=require(_0x47a2('0xa'));var jsforce=require(_0x47a2('0xb'));var deskjs=require(_0x47a2('0xc'));var toCsv=require(_0x47a2('0x7'));var querystring=require(_0x47a2('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x47a2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x47a2('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47a2('0x10'))(_0x47a2('0x11'));var utils=require(_0x47a2('0x12'));var config=require(_0x47a2('0x13'));var db=require(_0x47a2('0x14'))['db'];function respondWithStatusCode(_0x2dbb59,_0x47ff67){_0x47ff67=_0x47ff67||0xcc;return function(_0x1e51b0){if(_0x1e51b0){return _0x2dbb59[_0x47a2('0x15')](_0x47ff67);}return _0x2dbb59[_0x47a2('0x16')](_0x47ff67)[_0x47a2('0x17')]();};}function respondWithResult(_0x432e5a,_0x32b885){_0x32b885=_0x32b885||0xc8;return function(_0x44b7fb){if(_0x44b7fb){return _0x432e5a[_0x47a2('0x16')](_0x32b885)[_0x47a2('0x18')](_0x44b7fb);}};}function respondWithFilteredResult(_0x34d28c,_0x23c5b3){return function(_0x55f5c1){if(_0x55f5c1){var _0x1c55fe=_0x55f5c1[_0x47a2('0x19')],_0x2bfcee=_0x23c5b3[_0x47a2('0x1a')],_0x3cbbec=_0x23c5b3[_0x47a2('0x1a')]+_0x23c5b3[_0x47a2('0x1b')],_0x1f8ccd;if(_0x3cbbec>=_0x1c55fe){_0x3cbbec=_0x1c55fe;_0x1f8ccd=0xc8;}else{_0x1f8ccd=0xce;}_0x34d28c[_0x47a2('0x16')](_0x1f8ccd);return _0x34d28c['set'](_0x47a2('0x1c'),_0x2bfcee+'-'+_0x3cbbec+'/'+_0x1c55fe)['json'](_0x55f5c1);}return null;};}function patchUpdates(_0x20172f){return function(_0x22616d){try{jsonpatch[_0x47a2('0x1d')](_0x22616d,_0x20172f,!![]);}catch(_0x4e8915){return BPromise['reject'](_0x4e8915);}return _0x22616d[_0x47a2('0x1e')]();};}function saveUpdates(_0x4f9a03,_0x347949){return function(_0x507c9e){if(_0x507c9e){return _0x507c9e[_0x47a2('0x1f')](_0x4f9a03)[_0x47a2('0x20')](function(_0x2b8cc2){return _0x2b8cc2;});}return null;};}function removeEntity(_0x21bcf6,_0x563719){return function(_0x2f36f8){if(_0x2f36f8){return _0x2f36f8[_0x47a2('0x21')]()[_0x47a2('0x20')](function(){_0x21bcf6['status'](0xcc)[_0x47a2('0x17')]();});}};}function handleEntityNotFound(_0x3ae924,_0x440dcc){return function(_0x1ad833){if(!_0x1ad833){_0x3ae924[_0x47a2('0x15')](0x194);}return _0x1ad833;};}function handleError(_0x1cd9d6,_0x46441c){_0x46441c=_0x46441c||0x1f4;return function(_0x509ca8){logger[_0x47a2('0x22')](_0x509ca8[_0x47a2('0x23')]);if(_0x509ca8[_0x47a2('0x24')]){delete _0x509ca8[_0x47a2('0x24')];}_0x1cd9d6[_0x47a2('0x16')](_0x46441c)[_0x47a2('0x25')](_0x509ca8);};}exports['index']=function(_0x265015,_0x2cdbdb){var _0x21ee3d={},_0x372991={},_0x1d1336={'count':0x0,'rows':[]};var _0x1db8ac=_[_0x47a2('0x26')](db[_0x47a2('0x27')][_0x47a2('0x28')],function(_0x1775ed){return{'name':_0x1775ed[_0x47a2('0x29')],'type':_0x1775ed[_0x47a2('0x2a')][_0x47a2('0x2b')]};});_0x372991[_0x47a2('0x2c')]=_[_0x47a2('0x26')](_0x1db8ac,_0x47a2('0x24'));_0x372991[_0x47a2('0x2d')]=_[_0x47a2('0x2e')](_0x265015[_0x47a2('0x2d')]);_0x372991[_0x47a2('0x2f')]=_['intersection'](_0x372991[_0x47a2('0x2c')],_0x372991[_0x47a2('0x2d')]);_0x21ee3d[_0x47a2('0x30')]=_[_0x47a2('0x31')](_0x372991[_0x47a2('0x2c')],qs[_0x47a2('0x32')](_0x265015[_0x47a2('0x2d')][_0x47a2('0x32')]));_0x21ee3d[_0x47a2('0x30')]=_0x21ee3d['attributes'][_0x47a2('0x33')]?_0x21ee3d[_0x47a2('0x30')]:_0x372991[_0x47a2('0x2c')];if(!_0x265015[_0x47a2('0x2d')][_0x47a2('0x34')](_0x47a2('0x35'))){_0x21ee3d[_0x47a2('0x1b')]=qs[_0x47a2('0x1b')](_0x265015[_0x47a2('0x2d')][_0x47a2('0x1b')]);_0x21ee3d[_0x47a2('0x1a')]=qs['offset'](_0x265015[_0x47a2('0x2d')][_0x47a2('0x1a')]);}_0x21ee3d[_0x47a2('0x36')]=qs[_0x47a2('0x37')](_0x265015['query'][_0x47a2('0x37')]);_0x21ee3d[_0x47a2('0x38')]=qs[_0x47a2('0x2f')](_[_0x47a2('0x39')](_0x265015['query'],_0x372991[_0x47a2('0x2f')]),_0x1db8ac);if(_0x265015[_0x47a2('0x2d')][_0x47a2('0x3a')]){_0x21ee3d[_0x47a2('0x38')]=_['merge'](_0x21ee3d['where'],{'$or':_['map'](_0x1db8ac,function(_0x46cbc6){if(_0x46cbc6[_0x47a2('0x2a')]!==_0x47a2('0x3b')){var _0x2281c7={};_0x2281c7[_0x46cbc6[_0x47a2('0x24')]]={'$like':'%'+_0x265015[_0x47a2('0x2d')][_0x47a2('0x3a')]+'%'};return _0x2281c7;}})});}_0x21ee3d=_[_0x47a2('0x3c')]({},_0x21ee3d,_0x265015['options']);var _0x283909={'where':_0x21ee3d[_0x47a2('0x38')]};return db['SquareReport'][_0x47a2('0x19')](_0x283909)[_0x47a2('0x20')](function(_0x4d12fe){_0x1d1336['count']=_0x4d12fe;if(_0x265015[_0x47a2('0x2d')][_0x47a2('0x3d')]){_0x21ee3d[_0x47a2('0x3e')]=[{'all':!![]}];}return db[_0x47a2('0x27')][_0x47a2('0x3f')](_0x21ee3d);})[_0x47a2('0x20')](function(_0x138997){_0x1d1336['rows']=_0x138997;return _0x1d1336;})[_0x47a2('0x20')](respondWithFilteredResult(_0x2cdbdb,_0x21ee3d))[_0x47a2('0x40')](handleError(_0x2cdbdb,null));};exports['show']=function(_0x530bbf,_0x27b7c6){var _0x6a7afb={'raw':!![],'where':{'id':_0x530bbf['params']['id']}},_0xe08ecb={};_0xe08ecb['model']=_[_0x47a2('0x2e')](db['SquareReport'][_0x47a2('0x28')]);_0xe08ecb[_0x47a2('0x2d')]=_['keys'](_0x530bbf[_0x47a2('0x2d')]);_0xe08ecb['filters']=_['intersection'](_0xe08ecb[_0x47a2('0x2c')],_0xe08ecb[_0x47a2('0x2d')]);_0x6a7afb[_0x47a2('0x30')]=_[_0x47a2('0x31')](_0xe08ecb['model'],qs['fields'](_0x530bbf[_0x47a2('0x2d')]['fields']));_0x6a7afb[_0x47a2('0x30')]=_0x6a7afb['attributes'][_0x47a2('0x33')]?_0x6a7afb[_0x47a2('0x30')]:_0xe08ecb[_0x47a2('0x2c')];if(_0x530bbf[_0x47a2('0x2d')][_0x47a2('0x3d')]){_0x6a7afb[_0x47a2('0x3e')]=[{'all':!![]}];}_0x6a7afb=_[_0x47a2('0x3c')]({},_0x6a7afb,_0x530bbf[_0x47a2('0x41')]);return db['SquareReport'][_0x47a2('0x42')](_0x6a7afb)['then'](handleEntityNotFound(_0x27b7c6,null))[_0x47a2('0x20')](respondWithResult(_0x27b7c6,null))[_0x47a2('0x40')](handleError(_0x27b7c6,null));};exports[_0x47a2('0x43')]=function(_0x1b4d84,_0x2ef9c0){return db[_0x47a2('0x27')]['create'](_0x1b4d84['body'],{})[_0x47a2('0x20')](respondWithResult(_0x2ef9c0,0xc9))[_0x47a2('0x40')](handleError(_0x2ef9c0,null));};exports[_0x47a2('0x1f')]=function(_0x22df5b,_0xc1355b){if(_0x22df5b[_0x47a2('0x44')]['id']){delete _0x22df5b[_0x47a2('0x44')]['id'];}return db[_0x47a2('0x27')][_0x47a2('0x42')]({'where':{'id':_0x22df5b[_0x47a2('0x45')]['id']}})[_0x47a2('0x20')](handleEntityNotFound(_0xc1355b,null))[_0x47a2('0x20')](saveUpdates(_0x22df5b['body'],null))['then'](respondWithResult(_0xc1355b,null))[_0x47a2('0x40')](handleError(_0xc1355b,null));};exports['destroy']=function(_0x408dc0,_0x124d11){return db['SquareReport'][_0x47a2('0x42')]({'where':{'id':_0x408dc0['params']['id']}})['then'](handleEntityNotFound(_0x124d11,null))[_0x47a2('0x20')](removeEntity(_0x124d11,null))[_0x47a2('0x40')](handleError(_0x124d11,null));};exports[_0x47a2('0x46')]=function(_0x2c1a25,_0x12f847){return db[_0x47a2('0x27')][_0x47a2('0x46')]()['then'](respondWithResult(_0x12f847,null))[_0x47a2('0x40')](handleError(_0x12f847,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 69e4477..f138d54 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 _0xf074=['uniqueid','project_name','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','define','report_square','uid_pname'];(function(_0x261a0e,_0x371f85){var _0x3442a2=function(_0x30c904){while(--_0x30c904){_0x261a0e['push'](_0x261a0e['shift']());}};_0x3442a2(++_0x371f85);}(_0xf074,0x16b));var _0x4f07=function(_0x50e441,_0xc3e0be){_0x50e441=_0x50e441-0x0;var _0x14d824=_0xf074[_0x50e441];return _0x14d824;};'use strict';var _=require('lodash');var util=require(_0x4f07('0x0'));var logger=require(_0x4f07('0x1'))(_0x4f07('0x2'));var moment=require(_0x4f07('0x3'));var BPromise=require(_0x4f07('0x4'));var rp=require(_0x4f07('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f07('0x6'));var config=require(_0x4f07('0x7'));var attributes=require(_0x4f07('0x8'));module['exports']=function(_0x59dade,_0x5a2ff2){return _0x59dade[_0x4f07('0x9')]('SquareReport',attributes,{'tableName':_0x4f07('0xa'),'paranoid':![],'indexes':[{'name':_0x4f07('0xb'),'fields':[_0x4f07('0xc'),_0x4f07('0xd')]},{'name':_0x4f07('0xe'),'fields':[_0x4f07('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea3e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','uid_pname','uniqueid','project_name','leaveAt','lodash','util'];(function(_0x24579a,_0x59612d){var _0x59dff7=function(_0x47c50f){while(--_0x47c50f){_0x24579a['push'](_0x24579a['shift']());}};_0x59dff7(++_0x59612d);}(_0xea3e,0x163));var _0xeea3=function(_0x410a89,_0x528790){_0x410a89=_0x410a89-0x0;var _0x4bf3cb=_0xea3e[_0x410a89];return _0x4bf3cb;};'use strict';var _=require(_0xeea3('0x0'));var util=require(_0xeea3('0x1'));var logger=require(_0xeea3('0x2'))(_0xeea3('0x3'));var moment=require(_0xeea3('0x4'));var BPromise=require(_0xeea3('0x5'));var rp=require(_0xeea3('0x6'));var fs=require('fs');var path=require(_0xeea3('0x7'));var rimraf=require(_0xeea3('0x8'));var config=require(_0xeea3('0x9'));var attributes=require(_0xeea3('0xa'));module[_0xeea3('0xb')]=function(_0x2e8048,_0x3f9469){return _0x2e8048['define'](_0xeea3('0xc'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xeea3('0xd'),'fields':[_0xeea3('0xe'),_0xeea3('0xf')]},{'name':_0xeea3('0x10'),'fields':[_0xeea3('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index cc12006..30ba278 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 _0x55d2=['error','code','message','SquareReport,\x20%s,\x20%s','request\x20sent','result','CreateSquareReport','SquareReport','create','body','options','then','UpdateSquareReport','update','raw','where','limit','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x70404,_0x507113){var _0x2da0b9=function(_0x3fa2a9){while(--_0x3fa2a9){_0x70404['push'](_0x70404['shift']());}};_0x2da0b9(++_0x507113);}(_0x55d2,0x188));var _0x255d=function(_0x2739ac,_0x45a29d){_0x2739ac=_0x2739ac-0x0;var _0xa610df=_0x55d2[_0x2739ac];return _0xa610df;};'use strict';var _=require(_0x255d('0x0'));var util=require(_0x255d('0x1'));var moment=require('moment');var BPromise=require(_0x255d('0x2'));var rs=require(_0x255d('0x3'));var fs=require('fs');var Redis=require(_0x255d('0x4'));var db=require(_0x255d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x255d('0x6'));var config=require(_0x255d('0x7'));var jayson=require(_0x255d('0x8'));var client=jayson[_0x255d('0x9')][_0x255d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d7e87,_0x1e3592,_0x59a355){return new BPromise(function(_0x4c9a2c,_0x40a34c){return client[_0x255d('0xb')](_0x3d7e87,_0x59a355)['then'](function(_0x4ec8fb){logger[_0x255d('0xc')]('SquareReport,\x20%s,\x20%s',_0x1e3592,'request\x20sent');logger[_0x255d('0xd')](_0x255d('0xe'),_0x1e3592,'request\x20sent',JSON[_0x255d('0xf')](_0x4ec8fb));if(_0x4ec8fb['error']){if(_0x4ec8fb[_0x255d('0x10')][_0x255d('0x11')]===0x1f4){logger[_0x255d('0x10')]('SquareReport,\x20%s,\x20%s',_0x1e3592,_0x4ec8fb[_0x255d('0x10')][_0x255d('0x12')]);return _0x40a34c(_0x4ec8fb[_0x255d('0x10')]['message']);}logger[_0x255d('0x10')](_0x255d('0x13'),_0x1e3592,_0x4ec8fb[_0x255d('0x10')][_0x255d('0x12')]);return _0x4c9a2c(_0x4ec8fb['error']['message']);}else{logger[_0x255d('0xc')](_0x255d('0x13'),_0x1e3592,_0x255d('0x14'));_0x4c9a2c(_0x4ec8fb[_0x255d('0x15')]['message']);}})['catch'](function(_0x3f9e43){logger['error']('SquareReport,\x20%s,\x20%s',_0x1e3592,_0x3f9e43);_0x40a34c(_0x3f9e43);});});}exports[_0x255d('0x16')]=function(_0xe3167c){var _0x27730b=this;return new Promise(function(_0x22bb90,_0x321172){return db[_0x255d('0x17')][_0x255d('0x18')](_0xe3167c[_0x255d('0x19')],{'raw':_0xe3167c[_0x255d('0x1a')]?_0xe3167c['options']['raw']===undefined?!![]:![]:!![]})[_0x255d('0x1b')](function(_0x395890){logger['info']('CreateSquareReport',_0xe3167c);logger['debug']('CreateSquareReport',_0xe3167c,JSON[_0x255d('0xf')](_0x395890));_0x22bb90(_0x395890);})['catch'](function(_0x3c9529){logger[_0x255d('0x10')](_0x255d('0x16'),_0x3c9529[_0x255d('0x12')],_0xe3167c);_0x321172(_0x27730b[_0x255d('0x10')](0x1f4,_0x3c9529[_0x255d('0x12')]));});});};exports[_0x255d('0x1c')]=function(_0x5cd561){var _0x1855a7=this;return new Promise(function(_0x3159d3,_0x413a08){return db['SquareReport'][_0x255d('0x1d')](_0x5cd561[_0x255d('0x19')],{'raw':_0x5cd561['options']?_0x5cd561[_0x255d('0x1a')][_0x255d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cd561[_0x255d('0x1a')]?_0x5cd561[_0x255d('0x1a')][_0x255d('0x1f')]||null:null,'attributes':_0x5cd561[_0x255d('0x1a')]?_0x5cd561[_0x255d('0x1a')]['attributes']||null:null,'limit':_0x5cd561[_0x255d('0x1a')]?_0x5cd561[_0x255d('0x1a')][_0x255d('0x20')]||null:null})[_0x255d('0x1b')](function(_0x246a58){logger[_0x255d('0xc')](_0x255d('0x1c'),_0x5cd561);logger[_0x255d('0xd')]('UpdateSquareReport',_0x5cd561,JSON[_0x255d('0xf')](_0x246a58));_0x3159d3(_0x246a58);})[_0x255d('0x21')](function(_0x33459a){logger['error'](_0x255d('0x1c'),_0x33459a[_0x255d('0x12')],_0x5cd561);_0x413a08(_0x1855a7['error'](0x1f4,_0x33459a[_0x255d('0x12')]));});});}; \ No newline at end of file +var _0xf041=['request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareReport','SquareReport','create','options','raw','then','UpdateSquareReport','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x555fb7,_0x4d894e){var _0x9348f1=function(_0x25adc6){while(--_0x25adc6){_0x555fb7['push'](_0x555fb7['shift']());}};_0x9348f1(++_0x4d894e);}(_0xf041,0x90));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1f04('0x0'));var util=require('util');var moment=require(_0x1f04('0x1'));var BPromise=require(_0x1f04('0x2'));var rs=require(_0x1f04('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f04('0x4'))['db'];var utils=require(_0x1f04('0x5'));var logger=require('../../config/logger')(_0x1f04('0x6'));var config=require(_0x1f04('0x7'));var jayson=require(_0x1f04('0x8'));var client=jayson[_0x1f04('0x9')][_0x1f04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8c9c84,_0xc3c194,_0x4df84a){return new BPromise(function(_0x2be561,_0x252320){return client[_0x1f04('0xb')](_0x8c9c84,_0x4df84a)['then'](function(_0x372f12){logger[_0x1f04('0xc')](_0x1f04('0xd'),_0xc3c194,_0x1f04('0xe'));logger[_0x1f04('0xf')](_0x1f04('0x10'),_0xc3c194,'request\x20sent',JSON[_0x1f04('0x11')](_0x372f12));if(_0x372f12[_0x1f04('0x12')]){if(_0x372f12[_0x1f04('0x12')][_0x1f04('0x13')]===0x1f4){logger['error'](_0x1f04('0xd'),_0xc3c194,_0x372f12[_0x1f04('0x12')][_0x1f04('0x14')]);return _0x252320(_0x372f12[_0x1f04('0x12')][_0x1f04('0x14')]);}logger[_0x1f04('0x12')](_0x1f04('0xd'),_0xc3c194,_0x372f12[_0x1f04('0x12')]['message']);return _0x2be561(_0x372f12['error'][_0x1f04('0x14')]);}else{logger['info'](_0x1f04('0xd'),_0xc3c194,_0x1f04('0xe'));_0x2be561(_0x372f12['result'][_0x1f04('0x14')]);}})[_0x1f04('0x15')](function(_0x34a7f2){logger[_0x1f04('0x12')]('SquareReport,\x20%s,\x20%s',_0xc3c194,_0x34a7f2);_0x252320(_0x34a7f2);});});}exports[_0x1f04('0x16')]=function(_0x100347){var _0x4b31ad=this;return new Promise(function(_0x46842b,_0x3ee907){return db[_0x1f04('0x17')][_0x1f04('0x18')](_0x100347['body'],{'raw':_0x100347[_0x1f04('0x19')]?_0x100347[_0x1f04('0x19')][_0x1f04('0x1a')]===undefined?!![]:![]:!![]})[_0x1f04('0x1b')](function(_0x53ebaa){logger['info']('CreateSquareReport',_0x100347);logger['debug'](_0x1f04('0x16'),_0x100347,JSON[_0x1f04('0x11')](_0x53ebaa));_0x46842b(_0x53ebaa);})['catch'](function(_0x27c6ca){logger['error'](_0x1f04('0x16'),_0x27c6ca[_0x1f04('0x14')],_0x100347);_0x3ee907(_0x4b31ad[_0x1f04('0x12')](0x1f4,_0x27c6ca[_0x1f04('0x14')]));});});};exports[_0x1f04('0x1c')]=function(_0x593095){var _0x889021=this;return new Promise(function(_0x782d69,_0x5e2ebb){return db[_0x1f04('0x17')]['update'](_0x593095['body'],{'raw':_0x593095[_0x1f04('0x19')]?_0x593095[_0x1f04('0x19')][_0x1f04('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x593095[_0x1f04('0x19')]?_0x593095[_0x1f04('0x19')]['where']||null:null,'attributes':_0x593095[_0x1f04('0x19')]?_0x593095['options'][_0x1f04('0x1d')]||null:null,'limit':_0x593095['options']?_0x593095[_0x1f04('0x19')][_0x1f04('0x1e')]||null:null})[_0x1f04('0x1b')](function(_0xaca0f1){logger['info'](_0x1f04('0x1c'),_0x593095);logger[_0x1f04('0xf')]('UpdateSquareReport',_0x593095,JSON['stringify'](_0xaca0f1));_0x782d69(_0xaca0f1);})[_0x1f04('0x15')](function(_0x5067cf){logger[_0x1f04('0x12')](_0x1f04('0x1c'),_0x5067cf[_0x1f04('0x14')],_0x593095);_0x5e2ebb(_0x889021[_0x1f04('0x12')](0x1f4,_0x5067cf[_0x1f04('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index e3994d7..ebadf12 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x322da0,_0x525dc1){var _0x5dfc58=function(_0x28085c){while(--_0x28085c){_0x322da0['push'](_0x322da0['shift']());}};_0x5dfc58(++_0x525dc1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4e1d7d,_0x5a7761){_0x4e1d7d=_0x4e1d7d-0x0;var _0x53f086=_0x5f2f[_0x4e1d7d];return _0x53f086;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x814b,0x1a2));var _0xb814=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x814b[_0xd67723];return _0x53b62b;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 7660e38..a670271 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 _0x6fce=['exports','STRING','TEXT'];(function(_0x3e1944,_0x481749){var _0x24d309=function(_0x95597){while(--_0x95597){_0x3e1944['push'](_0x3e1944['shift']());}};_0x24d309(++_0x481749);}(_0x6fce,0x186));var _0xe6fc=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x6fce[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require('sequelize');module[_0xe6fc('0x0')]={'uniqueid':{'type':Sequelize[_0xe6fc('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xe6fc('0x1')]},'data':{'type':Sequelize[_0xe6fc('0x2')]},'project_name':{'type':Sequelize[_0xe6fc('0x1')]},'callerid':{'type':Sequelize[_0xe6fc('0x1')]}}; \ No newline at end of file +var _0x9211=['STRING','TEXT','sequelize','exports'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0x9211,0x14e));var _0x1921=function(_0x24529e,_0x20b864){_0x24529e=_0x24529e-0x0;var _0x4f37ba=_0x9211[_0x24529e];return _0x4f37ba;};'use strict';var Sequelize=require(_0x1921('0x0'));module[_0x1921('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x1921('0x2')]},'data':{'type':Sequelize[_0x1921('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x1921('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 9d0e97d..902892c 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 _0x4201=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','update','destroy','then','error','name','send','map','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','count','includeAll','include','SquareDetailsReport','findAll','rows','keys','rawAttributes','options','find','create','body','catch','params','describe','html-pdf','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x4201,0x86));var _0x1420=function(_0x1e235e,_0x994b77){_0x1e235e=_0x1e235e-0x0;var _0x1e8e94=_0x4201[_0x1e235e];return _0x1e8e94;};'use strict';var pdf=require(_0x1420('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1420('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1420('0x2'));var BPromise=require(_0x1420('0x3'));var Mustache=require(_0x1420('0x4'));var util=require(_0x1420('0x5'));var path=require(_0x1420('0x6'));var sox=require(_0x1420('0x7'));var csv=require(_0x1420('0x8'));var ejs=require(_0x1420('0x9'));var fs=require('fs');var _=require(_0x1420('0xa'));var squel=require(_0x1420('0xb'));var crypto=require(_0x1420('0xc'));var jsforce=require(_0x1420('0xd'));var deskjs=require(_0x1420('0xe'));var toCsv=require(_0x1420('0x8'));var querystring=require(_0x1420('0xf'));var Papa=require(_0x1420('0x10'));var Redis=require(_0x1420('0x11'));var authService=require(_0x1420('0x12'));var qs=require(_0x1420('0x13'));var as=require(_0x1420('0x14'));var hardwareService=require(_0x1420('0x15'));var logger=require(_0x1420('0x16'))(_0x1420('0x17'));var utils=require(_0x1420('0x18'));var config=require(_0x1420('0x19'));var db=require(_0x1420('0x1a'))['db'];function respondWithStatusCode(_0x18a425,_0x54219f){_0x54219f=_0x54219f||0xcc;return function(_0x1b2759){if(_0x1b2759){return _0x18a425[_0x1420('0x1b')](_0x54219f);}return _0x18a425['status'](_0x54219f)[_0x1420('0x1c')]();};}function respondWithResult(_0x1469d9,_0x328db0){_0x328db0=_0x328db0||0xc8;return function(_0x41386e){if(_0x41386e){return _0x1469d9[_0x1420('0x1d')](_0x328db0)[_0x1420('0x1e')](_0x41386e);}};}function respondWithFilteredResult(_0x175e02,_0x5884ac){return function(_0x33e7be){if(_0x33e7be){var _0x3d044d=_0x33e7be['count'],_0x1b261b=_0x5884ac[_0x1420('0x1f')],_0x20b77a=_0x5884ac[_0x1420('0x1f')]+_0x5884ac['limit'],_0x5dca23;if(_0x20b77a>=_0x3d044d){_0x20b77a=_0x3d044d;_0x5dca23=0xc8;}else{_0x5dca23=0xce;}_0x175e02[_0x1420('0x1d')](_0x5dca23);return _0x175e02[_0x1420('0x20')](_0x1420('0x21'),_0x1b261b+'-'+_0x20b77a+'/'+_0x3d044d)[_0x1420('0x1e')](_0x33e7be);}return null;};}function patchUpdates(_0x2e1ee6){return function(_0x53d489){try{jsonpatch[_0x1420('0x22')](_0x53d489,_0x2e1ee6,!![]);}catch(_0x411970){return BPromise[_0x1420('0x23')](_0x411970);}return _0x53d489['save']();};}function saveUpdates(_0x5101f4,_0x211c2f){return function(_0x2b2900){if(_0x2b2900){return _0x2b2900[_0x1420('0x24')](_0x5101f4)['then'](function(_0x1ffc2a){return _0x1ffc2a;});}return null;};}function removeEntity(_0x57d847,_0x36149c){return function(_0x1afa05){if(_0x1afa05){return _0x1afa05[_0x1420('0x25')]()[_0x1420('0x26')](function(){_0x57d847[_0x1420('0x1d')](0xcc)[_0x1420('0x1c')]();});}};}function handleEntityNotFound(_0x3a9437,_0x50a3ee){return function(_0x4c2063){if(!_0x4c2063){_0x3a9437[_0x1420('0x1b')](0x194);}return _0x4c2063;};}function handleError(_0x55cc0a,_0x3b1013){_0x3b1013=_0x3b1013||0x1f4;return function(_0x536f1c){logger[_0x1420('0x27')](_0x536f1c['stack']);if(_0x536f1c[_0x1420('0x28')]){delete _0x536f1c[_0x1420('0x28')];}_0x55cc0a[_0x1420('0x1d')](_0x3b1013)[_0x1420('0x29')](_0x536f1c);};}exports['index']=function(_0x3d2f13,_0x51bd5b){var _0x29ce9a={},_0x31d4f2={},_0x998b55={'count':0x0,'rows':[]};var _0x51fa35=_[_0x1420('0x2a')](db['SquareDetailsReport']['rawAttributes'],function(_0x467e87){return{'name':_0x467e87[_0x1420('0x2b')],'type':_0x467e87['type']['key']};});_0x31d4f2[_0x1420('0x2c')]=_['map'](_0x51fa35,_0x1420('0x28'));_0x31d4f2[_0x1420('0x2d')]=_['keys'](_0x3d2f13['query']);_0x31d4f2['filters']=_[_0x1420('0x2e')](_0x31d4f2['model'],_0x31d4f2[_0x1420('0x2d')]);_0x29ce9a[_0x1420('0x2f')]=_[_0x1420('0x2e')](_0x31d4f2[_0x1420('0x2c')],qs[_0x1420('0x30')](_0x3d2f13[_0x1420('0x2d')]['fields']));_0x29ce9a[_0x1420('0x2f')]=_0x29ce9a[_0x1420('0x2f')][_0x1420('0x31')]?_0x29ce9a[_0x1420('0x2f')]:_0x31d4f2[_0x1420('0x2c')];if(!_0x3d2f13[_0x1420('0x2d')][_0x1420('0x32')](_0x1420('0x33'))){_0x29ce9a[_0x1420('0x34')]=qs[_0x1420('0x34')](_0x3d2f13['query'][_0x1420('0x34')]);_0x29ce9a['offset']=qs[_0x1420('0x1f')](_0x3d2f13[_0x1420('0x2d')]['offset']);}_0x29ce9a[_0x1420('0x35')]=qs[_0x1420('0x36')](_0x3d2f13[_0x1420('0x2d')][_0x1420('0x36')]);_0x29ce9a[_0x1420('0x37')]=qs[_0x1420('0x38')](_[_0x1420('0x39')](_0x3d2f13['query'],_0x31d4f2[_0x1420('0x38')]),_0x51fa35);if(_0x3d2f13[_0x1420('0x2d')][_0x1420('0x3a')]){_0x29ce9a['where']=_['merge'](_0x29ce9a[_0x1420('0x37')],{'$or':_['map'](_0x51fa35,function(_0x51ce32){if(_0x51ce32[_0x1420('0x3b')]!==_0x1420('0x3c')){var _0x22eb05={};_0x22eb05[_0x51ce32['name']]={'$like':'%'+_0x3d2f13[_0x1420('0x2d')][_0x1420('0x3a')]+'%'};return _0x22eb05;}})});}_0x29ce9a=_[_0x1420('0x3d')]({},_0x29ce9a,_0x3d2f13['options']);var _0x1f2300={'where':_0x29ce9a['where']};return db['SquareDetailsReport'][_0x1420('0x3e')](_0x1f2300)[_0x1420('0x26')](function(_0x5248ff){_0x998b55[_0x1420('0x3e')]=_0x5248ff;if(_0x3d2f13[_0x1420('0x2d')][_0x1420('0x3f')]){_0x29ce9a[_0x1420('0x40')]=[{'all':!![]}];}return db[_0x1420('0x41')][_0x1420('0x42')](_0x29ce9a);})['then'](function(_0x36799d){_0x998b55[_0x1420('0x43')]=_0x36799d;return _0x998b55;})['then'](respondWithFilteredResult(_0x51bd5b,_0x29ce9a))['catch'](handleError(_0x51bd5b,null));};exports['show']=function(_0x3ded9a,_0x14348c){var _0x187101={'raw':!![],'where':{'id':_0x3ded9a['params']['id']}},_0x1f98dd={};_0x1f98dd['model']=_[_0x1420('0x44')](db[_0x1420('0x41')][_0x1420('0x45')]);_0x1f98dd[_0x1420('0x2d')]=_[_0x1420('0x44')](_0x3ded9a['query']);_0x1f98dd[_0x1420('0x38')]=_[_0x1420('0x2e')](_0x1f98dd[_0x1420('0x2c')],_0x1f98dd[_0x1420('0x2d')]);_0x187101[_0x1420('0x2f')]=_[_0x1420('0x2e')](_0x1f98dd['model'],qs[_0x1420('0x30')](_0x3ded9a[_0x1420('0x2d')][_0x1420('0x30')]));_0x187101[_0x1420('0x2f')]=_0x187101[_0x1420('0x2f')]['length']?_0x187101['attributes']:_0x1f98dd[_0x1420('0x2c')];if(_0x3ded9a[_0x1420('0x2d')]['includeAll']){_0x187101[_0x1420('0x40')]=[{'all':!![]}];}_0x187101=_[_0x1420('0x3d')]({},_0x187101,_0x3ded9a[_0x1420('0x46')]);return db[_0x1420('0x41')][_0x1420('0x47')](_0x187101)[_0x1420('0x26')](handleEntityNotFound(_0x14348c,null))['then'](respondWithResult(_0x14348c,null))['catch'](handleError(_0x14348c,null));};exports[_0x1420('0x48')]=function(_0x5b8af2,_0x5084d8){return db[_0x1420('0x41')]['create'](_0x5b8af2[_0x1420('0x49')],{})[_0x1420('0x26')](respondWithResult(_0x5084d8,0xc9))[_0x1420('0x4a')](handleError(_0x5084d8,null));};exports[_0x1420('0x24')]=function(_0x2898e7,_0x3241c2){if(_0x2898e7[_0x1420('0x49')]['id']){delete _0x2898e7[_0x1420('0x49')]['id'];}return db[_0x1420('0x41')]['find']({'where':{'id':_0x2898e7[_0x1420('0x4b')]['id']}})[_0x1420('0x26')](handleEntityNotFound(_0x3241c2,null))[_0x1420('0x26')](saveUpdates(_0x2898e7[_0x1420('0x49')],null))[_0x1420('0x26')](respondWithResult(_0x3241c2,null))[_0x1420('0x4a')](handleError(_0x3241c2,null));};exports['destroy']=function(_0x5f1746,_0x13afe8){return db[_0x1420('0x41')][_0x1420('0x47')]({'where':{'id':_0x5f1746['params']['id']}})['then'](handleEntityNotFound(_0x13afe8,null))[_0x1420('0x26')](removeEntity(_0x13afe8,null))[_0x1420('0x4a')](handleError(_0x13afe8,null));};exports[_0x1420('0x4c')]=function(_0x4f7800,_0xf7e10e){return db[_0x1420('0x41')][_0x1420('0x4c')]()[_0x1420('0x26')](respondWithResult(_0xf7e10e,null))[_0x1420('0x4a')](handleError(_0xf7e10e,null));}; \ No newline at end of file +var _0xb413=['send','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','options','find','create','body','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','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb413,0x141));var _0x3b41=function(_0x1d1dd1,_0x384707){_0x1d1dd1=_0x1d1dd1-0x0;var _0x43611b=_0xb413[_0x1d1dd1];return _0x43611b;};'use strict';var pdf=require(_0x3b41('0x0'));var emlformat=require(_0x3b41('0x1'));var rimraf=require(_0x3b41('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3b41('0x3'));var rp=require(_0x3b41('0x4'));var moment=require(_0x3b41('0x5'));var BPromise=require(_0x3b41('0x6'));var Mustache=require(_0x3b41('0x7'));var util=require(_0x3b41('0x8'));var path=require(_0x3b41('0x9'));var sox=require(_0x3b41('0xa'));var csv=require(_0x3b41('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b41('0xc'));var squel=require(_0x3b41('0xd'));var crypto=require(_0x3b41('0xe'));var jsforce=require(_0x3b41('0xf'));var deskjs=require(_0x3b41('0x10'));var toCsv=require(_0x3b41('0xb'));var querystring=require(_0x3b41('0x11'));var Papa=require(_0x3b41('0x12'));var Redis=require(_0x3b41('0x13'));var authService=require(_0x3b41('0x14'));var qs=require(_0x3b41('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b41('0x16'));var logger=require(_0x3b41('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3b41('0x18'))['db'];function respondWithStatusCode(_0x47dbe5,_0x5623d9){_0x5623d9=_0x5623d9||0xcc;return function(_0xe892a6){if(_0xe892a6){return _0x47dbe5[_0x3b41('0x19')](_0x5623d9);}return _0x47dbe5[_0x3b41('0x1a')](_0x5623d9)[_0x3b41('0x1b')]();};}function respondWithResult(_0x3a69d2,_0x415d05){_0x415d05=_0x415d05||0xc8;return function(_0xe53e51){if(_0xe53e51){return _0x3a69d2[_0x3b41('0x1a')](_0x415d05)['json'](_0xe53e51);}};}function respondWithFilteredResult(_0x5430f1,_0x5568f0){return function(_0x4034ca){if(_0x4034ca){var _0xc044a9=_0x4034ca[_0x3b41('0x1c')],_0x307f5a=_0x5568f0[_0x3b41('0x1d')],_0x428c3b=_0x5568f0[_0x3b41('0x1d')]+_0x5568f0['limit'],_0x9ee9ba;if(_0x428c3b>=_0xc044a9){_0x428c3b=_0xc044a9;_0x9ee9ba=0xc8;}else{_0x9ee9ba=0xce;}_0x5430f1[_0x3b41('0x1a')](_0x9ee9ba);return _0x5430f1[_0x3b41('0x1e')](_0x3b41('0x1f'),_0x307f5a+'-'+_0x428c3b+'/'+_0xc044a9)['json'](_0x4034ca);}return null;};}function patchUpdates(_0x2ade48){return function(_0x19f8b7){try{jsonpatch[_0x3b41('0x20')](_0x19f8b7,_0x2ade48,!![]);}catch(_0x4735a2){return BPromise['reject'](_0x4735a2);}return _0x19f8b7['save']();};}function saveUpdates(_0x2d7b8c,_0xe02448){return function(_0x4bef3c){if(_0x4bef3c){return _0x4bef3c[_0x3b41('0x21')](_0x2d7b8c)[_0x3b41('0x22')](function(_0x58a9aa){return _0x58a9aa;});}return null;};}function removeEntity(_0x2a6c1b,_0x48b7a2){return function(_0x86df44){if(_0x86df44){return _0x86df44[_0x3b41('0x23')]()[_0x3b41('0x22')](function(){_0x2a6c1b[_0x3b41('0x1a')](0xcc)[_0x3b41('0x1b')]();});}};}function handleEntityNotFound(_0x6cbcb4,_0x2d43e1){return function(_0xf2fb57){if(!_0xf2fb57){_0x6cbcb4[_0x3b41('0x19')](0x194);}return _0xf2fb57;};}function handleError(_0x189da5,_0x58fff6){_0x58fff6=_0x58fff6||0x1f4;return function(_0x413d64){logger[_0x3b41('0x24')](_0x413d64[_0x3b41('0x25')]);if(_0x413d64[_0x3b41('0x26')]){delete _0x413d64['name'];}_0x189da5['status'](_0x58fff6)[_0x3b41('0x27')](_0x413d64);};}exports['index']=function(_0x322dd8,_0x106ea7){var _0x33ddbe={},_0x56a3cc={},_0x25922b={'count':0x0,'rows':[]};var _0x550b34=_[_0x3b41('0x28')](db[_0x3b41('0x29')][_0x3b41('0x2a')],function(_0x40b713){return{'name':_0x40b713['fieldName'],'type':_0x40b713[_0x3b41('0x2b')][_0x3b41('0x2c')]};});_0x56a3cc[_0x3b41('0x2d')]=_[_0x3b41('0x28')](_0x550b34,_0x3b41('0x26'));_0x56a3cc[_0x3b41('0x2e')]=_[_0x3b41('0x2f')](_0x322dd8[_0x3b41('0x2e')]);_0x56a3cc[_0x3b41('0x30')]=_[_0x3b41('0x31')](_0x56a3cc[_0x3b41('0x2d')],_0x56a3cc[_0x3b41('0x2e')]);_0x33ddbe[_0x3b41('0x32')]=_[_0x3b41('0x31')](_0x56a3cc[_0x3b41('0x2d')],qs[_0x3b41('0x33')](_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x33')]));_0x33ddbe[_0x3b41('0x32')]=_0x33ddbe[_0x3b41('0x32')][_0x3b41('0x34')]?_0x33ddbe[_0x3b41('0x32')]:_0x56a3cc[_0x3b41('0x2d')];if(!_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x35')]('nolimit')){_0x33ddbe[_0x3b41('0x36')]=qs['limit'](_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x36')]);_0x33ddbe[_0x3b41('0x1d')]=qs[_0x3b41('0x1d')](_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x1d')]);}_0x33ddbe[_0x3b41('0x37')]=qs[_0x3b41('0x38')](_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x38')]);_0x33ddbe[_0x3b41('0x39')]=qs[_0x3b41('0x30')](_[_0x3b41('0x3a')](_0x322dd8[_0x3b41('0x2e')],_0x56a3cc[_0x3b41('0x30')]),_0x550b34);if(_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x3b')]){_0x33ddbe['where']=_['merge'](_0x33ddbe['where'],{'$or':_[_0x3b41('0x28')](_0x550b34,function(_0x5cea1b){if(_0x5cea1b[_0x3b41('0x2b')]!=='VIRTUAL'){var _0x49938d={};_0x49938d[_0x5cea1b[_0x3b41('0x26')]]={'$like':'%'+_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x3b')]+'%'};return _0x49938d;}})});}_0x33ddbe=_[_0x3b41('0x3c')]({},_0x33ddbe,_0x322dd8['options']);var _0x36e5e7={'where':_0x33ddbe[_0x3b41('0x39')]};return db[_0x3b41('0x29')][_0x3b41('0x1c')](_0x36e5e7)['then'](function(_0x3798ca){_0x25922b[_0x3b41('0x1c')]=_0x3798ca;if(_0x322dd8[_0x3b41('0x2e')][_0x3b41('0x3d')]){_0x33ddbe[_0x3b41('0x3e')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x33ddbe);})[_0x3b41('0x22')](function(_0x33d0b8){_0x25922b[_0x3b41('0x3f')]=_0x33d0b8;return _0x25922b;})[_0x3b41('0x22')](respondWithFilteredResult(_0x106ea7,_0x33ddbe))[_0x3b41('0x40')](handleError(_0x106ea7,null));};exports[_0x3b41('0x41')]=function(_0x3b8276,_0x69f398){var _0x5d180e={'raw':!![],'where':{'id':_0x3b8276['params']['id']}},_0x5798a9={};_0x5798a9[_0x3b41('0x2d')]=_[_0x3b41('0x2f')](db[_0x3b41('0x29')][_0x3b41('0x2a')]);_0x5798a9[_0x3b41('0x2e')]=_['keys'](_0x3b8276[_0x3b41('0x2e')]);_0x5798a9['filters']=_[_0x3b41('0x31')](_0x5798a9[_0x3b41('0x2d')],_0x5798a9[_0x3b41('0x2e')]);_0x5d180e[_0x3b41('0x32')]=_[_0x3b41('0x31')](_0x5798a9['model'],qs[_0x3b41('0x33')](_0x3b8276[_0x3b41('0x2e')][_0x3b41('0x33')]));_0x5d180e['attributes']=_0x5d180e[_0x3b41('0x32')][_0x3b41('0x34')]?_0x5d180e[_0x3b41('0x32')]:_0x5798a9['model'];if(_0x3b8276[_0x3b41('0x2e')]['includeAll']){_0x5d180e['include']=[{'all':!![]}];}_0x5d180e=_[_0x3b41('0x3c')]({},_0x5d180e,_0x3b8276[_0x3b41('0x42')]);return db[_0x3b41('0x29')][_0x3b41('0x43')](_0x5d180e)['then'](handleEntityNotFound(_0x69f398,null))[_0x3b41('0x22')](respondWithResult(_0x69f398,null))[_0x3b41('0x40')](handleError(_0x69f398,null));};exports['create']=function(_0x4e0224,_0x2de7b2){return db['SquareDetailsReport'][_0x3b41('0x44')](_0x4e0224[_0x3b41('0x45')],{})[_0x3b41('0x22')](respondWithResult(_0x2de7b2,0xc9))['catch'](handleError(_0x2de7b2,null));};exports[_0x3b41('0x21')]=function(_0x2bc9af,_0x3e17b5){if(_0x2bc9af['body']['id']){delete _0x2bc9af[_0x3b41('0x45')]['id'];}return db[_0x3b41('0x29')][_0x3b41('0x43')]({'where':{'id':_0x2bc9af[_0x3b41('0x46')]['id']}})[_0x3b41('0x22')](handleEntityNotFound(_0x3e17b5,null))[_0x3b41('0x22')](saveUpdates(_0x2bc9af['body'],null))[_0x3b41('0x22')](respondWithResult(_0x3e17b5,null))[_0x3b41('0x40')](handleError(_0x3e17b5,null));};exports[_0x3b41('0x23')]=function(_0x34f876,_0x4b5c6e){return db[_0x3b41('0x29')]['find']({'where':{'id':_0x34f876[_0x3b41('0x46')]['id']}})[_0x3b41('0x22')](handleEntityNotFound(_0x4b5c6e,null))[_0x3b41('0x22')](removeEntity(_0x4b5c6e,null))[_0x3b41('0x40')](handleError(_0x4b5c6e,null));};exports[_0x3b41('0x47')]=function(_0x1dbd4e,_0x4a36aa){return db[_0x3b41('0x29')][_0x3b41('0x47')]()[_0x3b41('0x22')](respondWithResult(_0x4a36aa,null))[_0x3b41('0x40')](handleError(_0x4a36aa,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 66c4664..1ebec30 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 _0x3d7e=['exports','define','report_square_details','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x5d141f,_0x167646){var _0x390840=function(_0x41a8d5){while(--_0x41a8d5){_0x5d141f['push'](_0x5d141f['shift']());}};_0x390840(++_0x167646);}(_0x3d7e,0xab));var _0xe3d7=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x3d7e[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0xe3d7('0x0'));var util=require(_0xe3d7('0x1'));var logger=require(_0xe3d7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe3d7('0x3'));var rp=require(_0xe3d7('0x4'));var fs=require('fs');var path=require(_0xe3d7('0x5'));var rimraf=require(_0xe3d7('0x6'));var config=require(_0xe3d7('0x7'));var attributes=require(_0xe3d7('0x8'));module[_0xe3d7('0x9')]=function(_0x28405d,_0x5d39f6){return _0x28405d[_0xe3d7('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xe3d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce2e=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0xce2e,0x1e9));var _0xece2=function(_0x1c7291,_0x5d5bc8){_0x1c7291=_0x1c7291-0x0;var _0x15db4f=_0xce2e[_0x1c7291];return _0x15db4f;};'use strict';var _=require(_0xece2('0x0'));var util=require(_0xece2('0x1'));var logger=require(_0xece2('0x2'))(_0xece2('0x3'));var moment=require(_0xece2('0x4'));var BPromise=require('bluebird');var rp=require(_0xece2('0x5'));var fs=require('fs');var path=require(_0xece2('0x6'));var rimraf=require(_0xece2('0x7'));var config=require(_0xece2('0x8'));var attributes=require(_0xece2('0x9'));module[_0xece2('0xa')]=function(_0x3ccd62,_0x1da666){return _0x3ccd62[_0xece2('0xb')]('SquareDetailsReport',attributes,{'tableName':_0xece2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index ffcfb04..ec2ca5c 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 _0xfb80=['util','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport'];(function(_0x4d2dea,_0x4e608e){var _0x1a5bb3=function(_0xbf8917){while(--_0xbf8917){_0x4d2dea['push'](_0x4d2dea['shift']());}};_0x1a5bb3(++_0x4e608e);}(_0xfb80,0x1a9));var _0x0fb8=function(_0x451ffc,_0x25afb7){_0x451ffc=_0x451ffc-0x0;var _0x1269bc=_0xfb80[_0x451ffc];return _0x1269bc;};'use strict';var _=require('lodash');var util=require(_0x0fb8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fb8('0x1'));var fs=require('fs');var Redis=require(_0x0fb8('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0fb8('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0fb8('0x4'));var client=jayson[_0x0fb8('0x5')][_0x0fb8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x57c52e,_0x84e4fb,_0x195c54){return new BPromise(function(_0x4e65e1,_0x94a5d6){return client[_0x0fb8('0x7')](_0x57c52e,_0x195c54)[_0x0fb8('0x8')](function(_0x1c7b5e){logger[_0x0fb8('0x9')](_0x0fb8('0xa'),_0x84e4fb,_0x0fb8('0xb'));logger['debug'](_0x0fb8('0xc'),_0x84e4fb,_0x0fb8('0xb'),JSON[_0x0fb8('0xd')](_0x1c7b5e));if(_0x1c7b5e[_0x0fb8('0xe')]){if(_0x1c7b5e[_0x0fb8('0xe')][_0x0fb8('0xf')]===0x1f4){logger[_0x0fb8('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x84e4fb,_0x1c7b5e['error'][_0x0fb8('0x10')]);return _0x94a5d6(_0x1c7b5e[_0x0fb8('0xe')][_0x0fb8('0x10')]);}logger[_0x0fb8('0xe')](_0x0fb8('0xa'),_0x84e4fb,_0x1c7b5e[_0x0fb8('0xe')][_0x0fb8('0x10')]);return _0x4e65e1(_0x1c7b5e['error'][_0x0fb8('0x10')]);}else{logger[_0x0fb8('0x9')](_0x0fb8('0xa'),_0x84e4fb,_0x0fb8('0xb'));_0x4e65e1(_0x1c7b5e[_0x0fb8('0x11')]['message']);}})[_0x0fb8('0x12')](function(_0x134c9b){logger[_0x0fb8('0xe')](_0x0fb8('0xa'),_0x84e4fb,_0x134c9b);_0x94a5d6(_0x134c9b);});});}exports['CreateSquareDetailsReport']=function(_0x54a19a){var _0x34b6e6=this;return new Promise(function(_0x36131f,_0x376893){return db[_0x0fb8('0x13')][_0x0fb8('0x14')](_0x54a19a[_0x0fb8('0x15')],{'raw':_0x54a19a[_0x0fb8('0x16')]?_0x54a19a[_0x0fb8('0x16')][_0x0fb8('0x17')]===undefined?!![]:![]:!![]})[_0x0fb8('0x8')](function(_0x3f2c47){logger[_0x0fb8('0x9')](_0x0fb8('0x18'),_0x54a19a);logger['debug'](_0x0fb8('0x18'),_0x54a19a,JSON[_0x0fb8('0xd')](_0x3f2c47));_0x36131f(_0x3f2c47);})[_0x0fb8('0x12')](function(_0x1a04d3){logger['error'](_0x0fb8('0x18'),_0x1a04d3[_0x0fb8('0x10')],_0x54a19a);_0x376893(_0x34b6e6[_0x0fb8('0xe')](0x1f4,_0x1a04d3[_0x0fb8('0x10')]));});});}; \ No newline at end of file +var _0x9b49=['then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0x9b49,0x1dd));var _0x99b4=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x9b49[_0x296754];return _0x1d9f1d;};'use strict';var _=require(_0x99b4('0x0'));var util=require(_0x99b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x99b4('0x2'));var fs=require('fs');var Redis=require(_0x99b4('0x3'));var db=require(_0x99b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x99b4('0x5'))(_0x99b4('0x6'));var config=require('../../config/environment');var jayson=require(_0x99b4('0x7'));var client=jayson['client'][_0x99b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x490881,_0x4e5bd3,_0x472ed7){return new BPromise(function(_0x43163e,_0x36236c){return client['request'](_0x490881,_0x472ed7)[_0x99b4('0x9')](function(_0xd19eac){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x4e5bd3,_0x99b4('0xa'));logger[_0x99b4('0xb')](_0x99b4('0xc'),_0x4e5bd3,_0x99b4('0xa'),JSON[_0x99b4('0xd')](_0xd19eac));if(_0xd19eac[_0x99b4('0xe')]){if(_0xd19eac[_0x99b4('0xe')][_0x99b4('0xf')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4e5bd3,_0xd19eac['error'][_0x99b4('0x10')]);return _0x36236c(_0xd19eac['error'][_0x99b4('0x10')]);}logger[_0x99b4('0xe')](_0x99b4('0x11'),_0x4e5bd3,_0xd19eac[_0x99b4('0xe')][_0x99b4('0x10')]);return _0x43163e(_0xd19eac['error'][_0x99b4('0x10')]);}else{logger[_0x99b4('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x4e5bd3,_0x99b4('0xa'));_0x43163e(_0xd19eac[_0x99b4('0x13')][_0x99b4('0x10')]);}})[_0x99b4('0x14')](function(_0x3aa348){logger[_0x99b4('0xe')](_0x99b4('0x11'),_0x4e5bd3,_0x3aa348);_0x36236c(_0x3aa348);});});}exports[_0x99b4('0x15')]=function(_0x3761f4){var _0x5ace8e=this;return new Promise(function(_0x4a7d53,_0x430196){return db[_0x99b4('0x16')][_0x99b4('0x17')](_0x3761f4[_0x99b4('0x18')],{'raw':_0x3761f4[_0x99b4('0x19')]?_0x3761f4[_0x99b4('0x19')][_0x99b4('0x1a')]===undefined?!![]:![]:!![]})[_0x99b4('0x9')](function(_0x522c63){logger['info'](_0x99b4('0x15'),_0x3761f4);logger[_0x99b4('0xb')](_0x99b4('0x15'),_0x3761f4,JSON[_0x99b4('0xd')](_0x522c63));_0x4a7d53(_0x522c63);})[_0x99b4('0x14')](function(_0x2db8b3){logger[_0x99b4('0xe')]('CreateSquareDetailsReport',_0x2db8b3[_0x99b4('0x10')],_0x3761f4);_0x430196(_0x5ace8e[_0x99b4('0xe')](0x1f4,_0x2db8b3['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 54ef5dc..3ea3101 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 _0x4f01=['get','isAuthenticated','index','/process/:pid/kill','exports','Router','../../components/auth/service','./system.controller'];(function(_0x541021,_0x6149e3){var _0x2ddc10=function(_0x19dd20){while(--_0x19dd20){_0x541021['push'](_0x541021['shift']());}};_0x2ddc10(++_0x6149e3);}(_0x4f01,0xe5));var _0x14f0=function(_0x215af5,_0x372c28){_0x215af5=_0x215af5-0x0;var _0x591625=_0x4f01[_0x215af5];return _0x591625;};'use strict';var express=require('express');var router=express[_0x14f0('0x0')]();var auth=require(_0x14f0('0x1'));var controller=require(_0x14f0('0x2'));router[_0x14f0('0x3')]('/',auth[_0x14f0('0x4')](),controller[_0x14f0('0x5')]);router[_0x14f0('0x3')](_0x14f0('0x6'),auth[_0x14f0('0x4')](),controller['killProcess']);module[_0x14f0('0x7')]=router; \ No newline at end of file +var _0xfbc6=['get','/process/:pid/kill','killProcess','express','Router','isAuthenticated','index'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xfbc6,0x1d8));var _0x6fbc=function(_0x331615,_0x13aebd){_0x331615=_0x331615-0x0;var _0x4ba773=_0xfbc6[_0x331615];return _0x4ba773;};'use strict';var express=require(_0x6fbc('0x0'));var router=express[_0x6fbc('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth[_0x6fbc('0x2')](),controller[_0x6fbc('0x3')]);router[_0x6fbc('0x4')](_0x6fbc('0x5'),auth[_0x6fbc('0x2')](),controller[_0x6fbc('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 513e949..81adb11 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 _0x1401=['exec','api','util','bluebird','error','inspect','status','send','then','catch','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process'];(function(_0x4851b1,_0x3f3607){var _0x1b643c=function(_0x41f67a){while(--_0x41f67a){_0x4851b1['push'](_0x4851b1['shift']());}};_0x1b643c(++_0x3f3607);}(_0x1401,0x144));var _0x1140=function(_0x24b281,_0x7be283){_0x24b281=_0x24b281-0x0;var _0x1da33e=_0x1401[_0x24b281];return _0x1da33e;};'use strict';var info=require('systeminformation');var exec=require(_0x1140('0x0'))[_0x1140('0x1')];var logger=require('../../config/logger')(_0x1140('0x2'));var util=require(_0x1140('0x3'));var BPromise=require(_0x1140('0x4'));var _=require('lodash');function handleError(_0x1b348c,_0x120ef2,_0x631155){_0x120ef2=_0x120ef2||0x1f4;return function(_0x59f9aa){logger[_0x1140('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x631155,_0x120ef2,util[_0x1140('0x6')](_0x59f9aa,{'showHidden':![],'depth':null}));delete _0x59f9aa['name'];_0x1b348c[_0x1140('0x7')](_0x120ef2)[_0x1140('0x8')](_0x59f9aa);};}exports['index']=function(_0x579393,_0xd2f75){return info['getAllData']()[_0x1140('0x9')](function(_0x4dc05e){return _0xd2f75['status'](0xc8)['json'](_0x4dc05e);})[_0x1140('0xa')](function(_0x53d516){return _0xd2f75['status'](0x1f4)[_0x1140('0xb')](_0x53d516);});};exports[_0x1140('0xc')]=function(_0x56cabf,_0x3b47bf){var _0x1775bf=[_0x1140('0xd')];return new BPromise(function(_0x126366,_0x6c00de){return exec(util['format'](_0x1140('0xe'),_0x56cabf[_0x1140('0xf')]['pid']),function(_0x31ded6,_0x246198,_0x4e3085){if(_0x31ded6){return _0x6c00de(_0x31ded6);}return _0x126366(_0x246198);});})['then'](function(_0x2702e4){var _0xcbbec3=![];var _0x39eae4=_0x2702e4[_0x1140('0x10')](/\n/);for(var _0x2e326f=0x0,_0x43cd7f=_0x1775bf[_0x1140('0x11')];_0x2e326f<_0x43cd7f,_0xcbbec3===![];_0x2e326f+=0x1){if(_0x2702e4[_0x1140('0x12')](_0x1775bf[_0x2e326f])>=0x0){_0xcbbec3=!![];}}if(!_0xcbbec3){throw new Error(util[_0x1140('0x13')](_0x1140('0x14'),_0x56cabf[_0x1140('0xf')][_0x1140('0x15')]));}process[_0x1140('0x16')](_0x56cabf[_0x1140('0xf')][_0x1140('0x15')],_0x1140('0x17'));return _0x3b47bf['status'](0xc8)[_0x1140('0xb')]({'message':util['format'](_0x1140('0x18'),_0x56cabf['params']['pid'])});})[_0x1140('0xa')](handleError(_0x3b47bf,null,_0x1140('0xc')));}; \ No newline at end of file +var _0x5f02=['api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','index','then','status','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','exec'];(function(_0x1fa1de,_0x135b2b){var _0x12d9f6=function(_0x23e98d){while(--_0x23e98d){_0x1fa1de['push'](_0x1fa1de['shift']());}};_0x12d9f6(++_0x135b2b);}(_0x5f02,0xa6));var _0x25f0=function(_0x3f67bd,_0x597f1f){_0x3f67bd=_0x3f67bd-0x0;var _0x35a5b0=_0x5f02[_0x3f67bd];return _0x35a5b0;};'use strict';var info=require(_0x25f0('0x0'));var exec=require('child_process')[_0x25f0('0x1')];var logger=require('../../config/logger')(_0x25f0('0x2'));var util=require('util');var BPromise=require(_0x25f0('0x3'));var _=require(_0x25f0('0x4'));function handleError(_0x127271,_0x2a4994,_0x548a05){_0x2a4994=_0x2a4994||0x1f4;return function(_0x5cf1a6){logger[_0x25f0('0x5')](_0x25f0('0x6'),_0x548a05,_0x2a4994,util[_0x25f0('0x7')](_0x5cf1a6,{'showHidden':![],'depth':null}));delete _0x5cf1a6['name'];_0x127271['status'](_0x2a4994)['send'](_0x5cf1a6);};}exports[_0x25f0('0x8')]=function(_0x488cb9,_0xa6d3b2){return info['getAllData']()[_0x25f0('0x9')](function(_0x4d0f20){return _0xa6d3b2[_0x25f0('0xa')](0xc8)[_0x25f0('0xb')](_0x4d0f20);})['catch'](function(_0xbad749){return _0xa6d3b2[_0x25f0('0xa')](0x1f4)[_0x25f0('0xb')](_0xbad749);});};exports[_0x25f0('0xc')]=function(_0x3678e3,_0x2ef0fd){var _0x254de4=[_0x25f0('0xd')];return new BPromise(function(_0x58551d,_0x2d9deb){return exec(util[_0x25f0('0xe')](_0x25f0('0xf'),_0x3678e3[_0x25f0('0x10')][_0x25f0('0x11')]),function(_0x55e013,_0x314638,_0x4678b6){if(_0x55e013){return _0x2d9deb(_0x55e013);}return _0x58551d(_0x314638);});})[_0x25f0('0x9')](function(_0x2a6b60){var _0x59f386=![];var _0x36d8e7=_0x2a6b60['split'](/\n/);for(var _0x526df9=0x0,_0x180cef=_0x254de4['length'];_0x526df9<_0x180cef,_0x59f386===![];_0x526df9+=0x1){if(_0x2a6b60[_0x25f0('0x12')](_0x254de4[_0x526df9])>=0x0){_0x59f386=!![];}}if(!_0x59f386){throw new Error(util[_0x25f0('0xe')](_0x25f0('0x13'),_0x3678e3[_0x25f0('0x10')]['pid']));}process[_0x25f0('0x14')](_0x3678e3[_0x25f0('0x10')]['pid'],_0x25f0('0x15'));return _0x2ef0fd[_0x25f0('0xa')](0xc8)[_0x25f0('0xb')]({'message':util[_0x25f0('0xe')](_0x25f0('0x16'),_0x3678e3['params']['pid'])});})[_0x25f0('0x17')](handleError(_0x2ef0fd,null,_0x25f0('0xc')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a31f294..96001ab 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 _0xe706=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0xe706,0xa3));var _0x6e70=function(_0x566667,_0x3f99c2){_0x566667=_0x566667-0x0;var _0x277136=_0xe706[_0x566667];return _0x277136;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0xe')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x12')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);module['exports']=router; \ No newline at end of file +var _0x00bb=['/:id','isAuthenticated','show','post','create','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./tag.controller','get'];(function(_0x2e4394,_0x5a2858){var _0x4f84e0=function(_0x38ae30){while(--_0x38ae30){_0x2e4394['push'](_0x2e4394['shift']());}};_0x4f84e0(++_0x5a2858);}(_0x00bb,0x1d8));var _0xb00b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00bb[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var auth=require(_0xb00b('0x4'));var interaction=require(_0xb00b('0x5'));var config=require('../../config/environment');var controller=require(_0xb00b('0x6'));router[_0xb00b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xa')]);router[_0xb00b('0xb')]('/',auth[_0xb00b('0x9')](),controller[_0xb00b('0xc')]);router['put']('/:id',auth[_0xb00b('0x9')](),controller[_0xb00b('0xd')]);router[_0xb00b('0xe')](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller['destroy']);module[_0xb00b('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 3fe71f1..7369353 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 _0x2032=['#0091EA','exports','STRING','name'];(function(_0x54220b,_0x45aacf){var _0x54968f=function(_0x3c27de){while(--_0x3c27de){_0x54220b['push'](_0x54220b['shift']());}};_0x54968f(++_0x45aacf);}(_0x2032,0xd9));var _0x2203=function(_0xc42daf,_0x550248){_0xc42daf=_0xc42daf-0x0;var _0x2802ba=_0x2032[_0xc42daf];return _0x2802ba;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'unique':_0x2203('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x3')},'description':{'type':Sequelize[_0x2203('0x1')]}}; \ No newline at end of file +var _0x878f=['STRING','name','#0091EA','exports'];(function(_0x4e227c,_0x4429fd){var _0x558d08=function(_0x3135fc){while(--_0x3135fc){_0x4e227c['push'](_0x4e227c['shift']());}};_0x558d08(++_0x4429fd);}(_0x878f,0x173));var _0xf878=function(_0x1ca7b0,_0x87ff35){_0x1ca7b0=_0x1ca7b0-0x0;var _0x4ccc7f=_0x878f[_0x1ca7b0];return _0x4ccc7f;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 1ad6366..6127537 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 _0x5460=['map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','Tag','rawAttributes','fieldName','key','model'];(function(_0x430326,_0x4d74cf){var _0x218bd3=function(_0x79a0ac){while(--_0x79a0ac){_0x430326['push'](_0x430326['shift']());}};_0x218bd3(++_0x4d74cf);}(_0x5460,0xd2));var _0x0546=function(_0x5dd511,_0x375d07){_0x5dd511=_0x5dd511-0x0;var _0x128597=_0x5460[_0x5dd511];return _0x128597;};'use strict';var pdf=require(_0x0546('0x0'));var emlformat=require(_0x0546('0x1'));var rimraf=require(_0x0546('0x2'));var zipdir=require(_0x0546('0x3'));var jsonpatch=require(_0x0546('0x4'));var rp=require(_0x0546('0x5'));var moment=require(_0x0546('0x6'));var BPromise=require(_0x0546('0x7'));var Mustache=require(_0x0546('0x8'));var util=require(_0x0546('0x9'));var path=require('path');var sox=require(_0x0546('0xa'));var csv=require(_0x0546('0xb'));var ejs=require(_0x0546('0xc'));var fs=require('fs');var _=require(_0x0546('0xd'));var squel=require('squel');var crypto=require(_0x0546('0xe'));var jsforce=require(_0x0546('0xf'));var deskjs=require(_0x0546('0x10'));var toCsv=require('to-csv');var querystring=require(_0x0546('0x11'));var Papa=require(_0x0546('0x12'));var Redis=require(_0x0546('0x13'));var authService=require(_0x0546('0x14'));var qs=require(_0x0546('0x15'));var as=require(_0x0546('0x16'));var hardwareService=require(_0x0546('0x17'));var logger=require(_0x0546('0x18'))(_0x0546('0x19'));var utils=require(_0x0546('0x1a'));var config=require(_0x0546('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x376e6b,_0xfc0a93){_0xfc0a93=_0xfc0a93||0xcc;return function(_0x662f1d){if(_0x662f1d){return _0x376e6b[_0x0546('0x1c')](_0xfc0a93);}return _0x376e6b[_0x0546('0x1d')](_0xfc0a93)[_0x0546('0x1e')]();};}function respondWithResult(_0x22c271,_0x20b60a){_0x20b60a=_0x20b60a||0xc8;return function(_0x4635f7){if(_0x4635f7){return _0x22c271[_0x0546('0x1d')](_0x20b60a)[_0x0546('0x1f')](_0x4635f7);}};}function respondWithFilteredResult(_0x427ba5,_0xbaaa1f){return function(_0x1b3d97){if(_0x1b3d97){var _0x3c78ce=_0x1b3d97[_0x0546('0x20')],_0x2c8931=_0xbaaa1f[_0x0546('0x21')],_0x122ab6=_0xbaaa1f['offset']+_0xbaaa1f['limit'],_0x242b17;if(_0x122ab6>=_0x3c78ce){_0x122ab6=_0x3c78ce;_0x242b17=0xc8;}else{_0x242b17=0xce;}_0x427ba5[_0x0546('0x1d')](_0x242b17);return _0x427ba5[_0x0546('0x22')](_0x0546('0x23'),_0x2c8931+'-'+_0x122ab6+'/'+_0x3c78ce)[_0x0546('0x1f')](_0x1b3d97);}return null;};}function patchUpdates(_0x4fb3f7){return function(_0x4b7625){try{jsonpatch[_0x0546('0x24')](_0x4b7625,_0x4fb3f7,!![]);}catch(_0xd762fc){return BPromise['reject'](_0xd762fc);}return _0x4b7625[_0x0546('0x25')]();};}function saveUpdates(_0x4ba9a5,_0x11c35){return function(_0x5a79b8){if(_0x5a79b8){return _0x5a79b8[_0x0546('0x26')](_0x4ba9a5)[_0x0546('0x27')](function(_0x108f03){return _0x108f03;});}return null;};}function removeEntity(_0x576e13,_0x45df02){return function(_0x1ef663){if(_0x1ef663){return _0x1ef663[_0x0546('0x28')]()['then'](function(){var _0x2d07c8=_0x1ef663[_0x0546('0x29')]({'plain':!![]});var _0x57ad23=_0x0546('0x2a');return db[_0x0546('0x2b')]['destroy']({'where':{'type':_0x57ad23,'resourceId':_0x2d07c8['id']}})[_0x0546('0x27')](function(){return _0x1ef663;});})[_0x0546('0x27')](function(){_0x576e13[_0x0546('0x1d')](0xcc)[_0x0546('0x1e')]();});}};}function handleEntityNotFound(_0x6b3def,_0x26a4d5){return function(_0x10f1f7){if(!_0x10f1f7){_0x6b3def[_0x0546('0x1c')](0x194);}return _0x10f1f7;};}function handleError(_0x103504,_0x2ae92b){_0x2ae92b=_0x2ae92b||0x1f4;return function(_0x21b3e1){logger[_0x0546('0x2c')](_0x21b3e1[_0x0546('0x2d')]);if(_0x21b3e1[_0x0546('0x2e')]){delete _0x21b3e1['name'];}_0x103504['status'](_0x2ae92b)[_0x0546('0x2f')](_0x21b3e1);};}exports[_0x0546('0x30')]=function(_0x5625d3,_0x43e0ff){var _0x4cc05b={},_0x1ed266={},_0x12deaa={'count':0x0,'rows':[]};var _0x1a6b62=_['map'](db[_0x0546('0x31')][_0x0546('0x32')],function(_0x1eeea9){return{'name':_0x1eeea9[_0x0546('0x33')],'type':_0x1eeea9['type'][_0x0546('0x34')]};});_0x1ed266[_0x0546('0x35')]=_[_0x0546('0x36')](_0x1a6b62,_0x0546('0x2e'));_0x1ed266[_0x0546('0x37')]=_[_0x0546('0x38')](_0x5625d3[_0x0546('0x37')]);_0x1ed266['filters']=_[_0x0546('0x39')](_0x1ed266['model'],_0x1ed266['query']);_0x4cc05b['attributes']=_['intersection'](_0x1ed266[_0x0546('0x35')],qs[_0x0546('0x3a')](_0x5625d3['query']['fields']));_0x4cc05b[_0x0546('0x3b')]=_0x4cc05b[_0x0546('0x3b')][_0x0546('0x3c')]?_0x4cc05b['attributes']:_0x1ed266['model'];if(!_0x5625d3[_0x0546('0x37')][_0x0546('0x3d')](_0x0546('0x3e'))){_0x4cc05b[_0x0546('0x3f')]=qs[_0x0546('0x3f')](_0x5625d3[_0x0546('0x37')][_0x0546('0x3f')]);_0x4cc05b['offset']=qs[_0x0546('0x21')](_0x5625d3['query'][_0x0546('0x21')]);}_0x4cc05b['order']=qs[_0x0546('0x40')](_0x5625d3[_0x0546('0x37')][_0x0546('0x40')]);_0x4cc05b[_0x0546('0x41')]=qs[_0x0546('0x42')](_['pick'](_0x5625d3['query'],_0x1ed266[_0x0546('0x42')]),_0x1a6b62);if(_0x5625d3[_0x0546('0x37')][_0x0546('0x43')]){_0x4cc05b[_0x0546('0x41')]=_['merge'](_0x4cc05b[_0x0546('0x41')],{'$or':_['map'](_0x1a6b62,function(_0x164603){if(_0x164603[_0x0546('0x44')]!==_0x0546('0x45')){var _0xcbe22d={};_0xcbe22d[_0x164603[_0x0546('0x2e')]]={'$like':'%'+_0x5625d3[_0x0546('0x37')]['filter']+'%'};return _0xcbe22d;}})});}_0x4cc05b=_[_0x0546('0x46')]({},_0x4cc05b,_0x5625d3[_0x0546('0x47')]);var _0x313fbd={'where':_0x4cc05b[_0x0546('0x41')]};return db[_0x0546('0x31')]['count'](_0x313fbd)[_0x0546('0x27')](function(_0x2c0fc9){_0x12deaa[_0x0546('0x20')]=_0x2c0fc9;if(_0x5625d3['query'][_0x0546('0x48')]){_0x4cc05b[_0x0546('0x49')]=[{'all':!![]}];}return db[_0x0546('0x31')][_0x0546('0x4a')](_0x4cc05b);})['then'](function(_0x59ab2a){_0x12deaa[_0x0546('0x4b')]=_0x59ab2a;return _0x12deaa;})[_0x0546('0x27')](respondWithFilteredResult(_0x43e0ff,_0x4cc05b))['catch'](handleError(_0x43e0ff,null));};exports[_0x0546('0x4c')]=function(_0x2de6bd,_0x565bec){var _0x1af656={'raw':!![],'where':{'id':_0x2de6bd['params']['id']}},_0x2ce445={};_0x2ce445[_0x0546('0x35')]=_['keys'](db[_0x0546('0x31')][_0x0546('0x32')]);_0x2ce445[_0x0546('0x37')]=_[_0x0546('0x38')](_0x2de6bd[_0x0546('0x37')]);_0x2ce445[_0x0546('0x42')]=_[_0x0546('0x39')](_0x2ce445[_0x0546('0x35')],_0x2ce445['query']);_0x1af656[_0x0546('0x3b')]=_[_0x0546('0x39')](_0x2ce445[_0x0546('0x35')],qs[_0x0546('0x3a')](_0x2de6bd['query'][_0x0546('0x3a')]));_0x1af656[_0x0546('0x3b')]=_0x1af656[_0x0546('0x3b')]['length']?_0x1af656[_0x0546('0x3b')]:_0x2ce445[_0x0546('0x35')];if(_0x2de6bd[_0x0546('0x37')][_0x0546('0x48')]){_0x1af656[_0x0546('0x49')]=[{'all':!![]}];}_0x1af656=_[_0x0546('0x46')]({},_0x1af656,_0x2de6bd['options']);return db[_0x0546('0x31')]['find'](_0x1af656)[_0x0546('0x27')](handleEntityNotFound(_0x565bec,null))[_0x0546('0x27')](respondWithResult(_0x565bec,null))[_0x0546('0x4d')](handleError(_0x565bec,null));};exports[_0x0546('0x4e')]=function(_0x3e14f2,_0x408903){return db[_0x0546('0x31')][_0x0546('0x4e')](_0x3e14f2[_0x0546('0x4f')],{})[_0x0546('0x27')](function(_0x1d8b8d){var _0x10daa4=_0x3e14f2[_0x0546('0x50')][_0x0546('0x29')]({'plain':!![]});if(!_0x10daa4)throw new Error(_0x0546('0x51'));if(_0x10daa4[_0x0546('0x52')]==='user'){var _0x43dd59=_0x1d8b8d['get']({'plain':!![]});var _0x4ec9ed=_0x0546('0x2a');return db[_0x0546('0x53')]['find']({'where':{'name':_0x4ec9ed,'userProfileId':_0x10daa4[_0x0546('0x54')]},'raw':!![]})[_0x0546('0x27')](function(_0x14ae37){if(_0x14ae37&&_0x14ae37[_0x0546('0x55')]===0x0){return db[_0x0546('0x2b')][_0x0546('0x4e')]({'name':_0x43dd59[_0x0546('0x2e')],'resourceId':_0x43dd59['id'],'type':_0x14ae37[_0x0546('0x2e')],'sectionId':_0x14ae37['id']},{})[_0x0546('0x27')](function(){return _0x1d8b8d;});}else{return _0x1d8b8d;}})['catch'](function(_0x3d5f49){logger[_0x0546('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d5f49);throw _0x3d5f49;});}return _0x1d8b8d;})['then'](respondWithResult(_0x408903,0xc9))['catch'](handleError(_0x408903,null));};exports[_0x0546('0x26')]=function(_0x122185,_0x1d77ad){if(_0x122185['body']['id']){delete _0x122185[_0x0546('0x4f')]['id'];}return db[_0x0546('0x31')]['find']({'where':{'id':_0x122185[_0x0546('0x56')]['id']}})[_0x0546('0x27')](handleEntityNotFound(_0x1d77ad,null))[_0x0546('0x27')](saveUpdates(_0x122185[_0x0546('0x4f')],null))[_0x0546('0x27')](respondWithResult(_0x1d77ad,null))[_0x0546('0x4d')](handleError(_0x1d77ad,null));};exports['destroy']=function(_0x347e97,_0x4e76dd){return db['Tag'][_0x0546('0x57')]({'where':{'id':_0x347e97['params']['id']}})[_0x0546('0x27')](handleEntityNotFound(_0x4e76dd,null))['then'](removeEntity(_0x4e76dd,null))['catch'](handleError(_0x4e76dd,null));}; \ No newline at end of file +var _0x3d8d=['includeAll','include','findAll','rows','catch','params','rawAttributes','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','map','Tag','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','options','count'];(function(_0x2feaba,_0x4fcabc){var _0x5b36b5=function(_0x568024){while(--_0x568024){_0x2feaba['push'](_0x2feaba['shift']());}};_0x5b36b5(++_0x4fcabc);}(_0x3d8d,0xad));var _0xd3d8=function(_0x208c54,_0x120a70){_0x208c54=_0x208c54-0x0;var _0x4b0116=_0x3d8d[_0x208c54];return _0x4b0116;};'use strict';var pdf=require(_0xd3d8('0x0'));var emlformat=require(_0xd3d8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd3d8('0x2'));var jsonpatch=require(_0xd3d8('0x3'));var rp=require(_0xd3d8('0x4'));var moment=require('moment');var BPromise=require(_0xd3d8('0x5'));var Mustache=require('mustache');var util=require(_0xd3d8('0x6'));var path=require('path');var sox=require(_0xd3d8('0x7'));var csv=require('to-csv');var ejs=require(_0xd3d8('0x8'));var fs=require('fs');var _=require(_0xd3d8('0x9'));var squel=require(_0xd3d8('0xa'));var crypto=require(_0xd3d8('0xb'));var jsforce=require(_0xd3d8('0xc'));var deskjs=require(_0xd3d8('0xd'));var toCsv=require(_0xd3d8('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd3d8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd3d8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3d8('0x11'));var logger=require(_0xd3d8('0x12'))(_0xd3d8('0x13'));var utils=require(_0xd3d8('0x14'));var config=require(_0xd3d8('0x15'));var db=require(_0xd3d8('0x16'))['db'];function respondWithStatusCode(_0xd241bf,_0x199620){_0x199620=_0x199620||0xcc;return function(_0x37eec){if(_0x37eec){return _0xd241bf[_0xd3d8('0x17')](_0x199620);}return _0xd241bf[_0xd3d8('0x18')](_0x199620)[_0xd3d8('0x19')]();};}function respondWithResult(_0x483a62,_0x1fe65e){_0x1fe65e=_0x1fe65e||0xc8;return function(_0x5648aa){if(_0x5648aa){return _0x483a62['status'](_0x1fe65e)[_0xd3d8('0x1a')](_0x5648aa);}};}function respondWithFilteredResult(_0x1f2066,_0x2a950c){return function(_0x563055){if(_0x563055){var _0x44eeb3=_0x563055['count'],_0x36be59=_0x2a950c[_0xd3d8('0x1b')],_0x3bd0d3=_0x2a950c['offset']+_0x2a950c[_0xd3d8('0x1c')],_0x2dfdf6;if(_0x3bd0d3>=_0x44eeb3){_0x3bd0d3=_0x44eeb3;_0x2dfdf6=0xc8;}else{_0x2dfdf6=0xce;}_0x1f2066['status'](_0x2dfdf6);return _0x1f2066['set']('Content-Range',_0x36be59+'-'+_0x3bd0d3+'/'+_0x44eeb3)['json'](_0x563055);}return null;};}function patchUpdates(_0x157eb2){return function(_0x505dcc){try{jsonpatch['apply'](_0x505dcc,_0x157eb2,!![]);}catch(_0x49ce67){return BPromise[_0xd3d8('0x1d')](_0x49ce67);}return _0x505dcc[_0xd3d8('0x1e')]();};}function saveUpdates(_0x450cb4,_0x190077){return function(_0x5a17aa){if(_0x5a17aa){return _0x5a17aa['update'](_0x450cb4)[_0xd3d8('0x1f')](function(_0x2455c7){return _0x2455c7;});}return null;};}function removeEntity(_0x431676,_0x4ac030){return function(_0x364a12){if(_0x364a12){return _0x364a12[_0xd3d8('0x20')]()[_0xd3d8('0x1f')](function(){var _0x4b5383=_0x364a12[_0xd3d8('0x21')]({'plain':!![]});var _0x2ab7a5=_0xd3d8('0x22');return db[_0xd3d8('0x23')][_0xd3d8('0x20')]({'where':{'type':_0x2ab7a5,'resourceId':_0x4b5383['id']}})[_0xd3d8('0x1f')](function(){return _0x364a12;});})['then'](function(){_0x431676[_0xd3d8('0x18')](0xcc)[_0xd3d8('0x19')]();});}};}function handleEntityNotFound(_0x1f215b,_0x3a38fb){return function(_0x23ff80){if(!_0x23ff80){_0x1f215b['sendStatus'](0x194);}return _0x23ff80;};}function handleError(_0x4a9a74,_0x4e1791){_0x4e1791=_0x4e1791||0x1f4;return function(_0x1ded20){logger[_0xd3d8('0x24')](_0x1ded20[_0xd3d8('0x25')]);if(_0x1ded20[_0xd3d8('0x26')]){delete _0x1ded20['name'];}_0x4a9a74[_0xd3d8('0x18')](_0x4e1791)[_0xd3d8('0x27')](_0x1ded20);};}exports['index']=function(_0x279137,_0x30c8bd){var _0x31dcc6={},_0x40770e={},_0x14917f={'count':0x0,'rows':[]};var _0x2c38a2=_[_0xd3d8('0x28')](db[_0xd3d8('0x29')]['rawAttributes'],function(_0x2c892a){return{'name':_0x2c892a[_0xd3d8('0x2a')],'type':_0x2c892a['type'][_0xd3d8('0x2b')]};});_0x40770e[_0xd3d8('0x2c')]=_['map'](_0x2c38a2,'name');_0x40770e[_0xd3d8('0x2d')]=_[_0xd3d8('0x2e')](_0x279137[_0xd3d8('0x2d')]);_0x40770e[_0xd3d8('0x2f')]=_[_0xd3d8('0x30')](_0x40770e['model'],_0x40770e[_0xd3d8('0x2d')]);_0x31dcc6[_0xd3d8('0x31')]=_[_0xd3d8('0x30')](_0x40770e['model'],qs[_0xd3d8('0x32')](_0x279137[_0xd3d8('0x2d')][_0xd3d8('0x32')]));_0x31dcc6[_0xd3d8('0x31')]=_0x31dcc6[_0xd3d8('0x31')][_0xd3d8('0x33')]?_0x31dcc6[_0xd3d8('0x31')]:_0x40770e['model'];if(!_0x279137[_0xd3d8('0x2d')]['hasOwnProperty']('nolimit')){_0x31dcc6[_0xd3d8('0x1c')]=qs[_0xd3d8('0x1c')](_0x279137[_0xd3d8('0x2d')]['limit']);_0x31dcc6[_0xd3d8('0x1b')]=qs[_0xd3d8('0x1b')](_0x279137[_0xd3d8('0x2d')]['offset']);}_0x31dcc6['order']=qs[_0xd3d8('0x34')](_0x279137[_0xd3d8('0x2d')][_0xd3d8('0x34')]);_0x31dcc6[_0xd3d8('0x35')]=qs[_0xd3d8('0x2f')](_[_0xd3d8('0x36')](_0x279137['query'],_0x40770e['filters']),_0x2c38a2);if(_0x279137[_0xd3d8('0x2d')][_0xd3d8('0x37')]){_0x31dcc6[_0xd3d8('0x35')]=_[_0xd3d8('0x38')](_0x31dcc6[_0xd3d8('0x35')],{'$or':_[_0xd3d8('0x28')](_0x2c38a2,function(_0x348c0e){if(_0x348c0e[_0xd3d8('0x39')]!==_0xd3d8('0x3a')){var _0x3d85b4={};_0x3d85b4[_0x348c0e[_0xd3d8('0x26')]]={'$like':'%'+_0x279137[_0xd3d8('0x2d')][_0xd3d8('0x37')]+'%'};return _0x3d85b4;}})});}_0x31dcc6=_[_0xd3d8('0x38')]({},_0x31dcc6,_0x279137[_0xd3d8('0x3b')]);var _0x3f1bee={'where':_0x31dcc6['where']};return db[_0xd3d8('0x29')][_0xd3d8('0x3c')](_0x3f1bee)[_0xd3d8('0x1f')](function(_0x8709a4){_0x14917f[_0xd3d8('0x3c')]=_0x8709a4;if(_0x279137[_0xd3d8('0x2d')][_0xd3d8('0x3d')]){_0x31dcc6[_0xd3d8('0x3e')]=[{'all':!![]}];}return db[_0xd3d8('0x29')][_0xd3d8('0x3f')](_0x31dcc6);})['then'](function(_0x57fef4){_0x14917f[_0xd3d8('0x40')]=_0x57fef4;return _0x14917f;})[_0xd3d8('0x1f')](respondWithFilteredResult(_0x30c8bd,_0x31dcc6))[_0xd3d8('0x41')](handleError(_0x30c8bd,null));};exports['show']=function(_0x2f0b50,_0x554173){var _0x18a61c={'raw':!![],'where':{'id':_0x2f0b50[_0xd3d8('0x42')]['id']}},_0x3a537e={};_0x3a537e[_0xd3d8('0x2c')]=_[_0xd3d8('0x2e')](db[_0xd3d8('0x29')][_0xd3d8('0x43')]);_0x3a537e[_0xd3d8('0x2d')]=_[_0xd3d8('0x2e')](_0x2f0b50[_0xd3d8('0x2d')]);_0x3a537e[_0xd3d8('0x2f')]=_[_0xd3d8('0x30')](_0x3a537e[_0xd3d8('0x2c')],_0x3a537e[_0xd3d8('0x2d')]);_0x18a61c[_0xd3d8('0x31')]=_['intersection'](_0x3a537e[_0xd3d8('0x2c')],qs[_0xd3d8('0x32')](_0x2f0b50['query'][_0xd3d8('0x32')]));_0x18a61c[_0xd3d8('0x31')]=_0x18a61c[_0xd3d8('0x31')][_0xd3d8('0x33')]?_0x18a61c['attributes']:_0x3a537e['model'];if(_0x2f0b50[_0xd3d8('0x2d')][_0xd3d8('0x3d')]){_0x18a61c['include']=[{'all':!![]}];}_0x18a61c=_['merge']({},_0x18a61c,_0x2f0b50[_0xd3d8('0x3b')]);return db['Tag']['find'](_0x18a61c)[_0xd3d8('0x1f')](handleEntityNotFound(_0x554173,null))[_0xd3d8('0x1f')](respondWithResult(_0x554173,null))[_0xd3d8('0x41')](handleError(_0x554173,null));};exports['create']=function(_0x51b370,_0x1172d2){return db['Tag']['create'](_0x51b370[_0xd3d8('0x44')],{})['then'](function(_0x1f9b13){var _0x4bed3a=_0x51b370['user'][_0xd3d8('0x21')]({'plain':!![]});if(!_0x4bed3a)throw new Error(_0xd3d8('0x45'));if(_0x4bed3a[_0xd3d8('0x46')]==='user'){var _0x27236c=_0x1f9b13[_0xd3d8('0x21')]({'plain':!![]});var _0x63ea88=_0xd3d8('0x22');return db[_0xd3d8('0x47')][_0xd3d8('0x48')]({'where':{'name':_0x63ea88,'userProfileId':_0x4bed3a[_0xd3d8('0x49')]},'raw':!![]})['then'](function(_0xa66680){if(_0xa66680&&_0xa66680[_0xd3d8('0x4a')]===0x0){return db['UserProfileResource'][_0xd3d8('0x4b')]({'name':_0x27236c[_0xd3d8('0x26')],'resourceId':_0x27236c['id'],'type':_0xa66680[_0xd3d8('0x26')],'sectionId':_0xa66680['id']},{})[_0xd3d8('0x1f')](function(){return _0x1f9b13;});}else{return _0x1f9b13;}})['catch'](function(_0x354fb3){logger[_0xd3d8('0x24')](_0xd3d8('0x4c'),_0x354fb3);throw _0x354fb3;});}return _0x1f9b13;})[_0xd3d8('0x1f')](respondWithResult(_0x1172d2,0xc9))[_0xd3d8('0x41')](handleError(_0x1172d2,null));};exports[_0xd3d8('0x4d')]=function(_0x4e5012,_0x4ab489){if(_0x4e5012[_0xd3d8('0x44')]['id']){delete _0x4e5012['body']['id'];}return db['Tag'][_0xd3d8('0x48')]({'where':{'id':_0x4e5012['params']['id']}})[_0xd3d8('0x1f')](handleEntityNotFound(_0x4ab489,null))[_0xd3d8('0x1f')](saveUpdates(_0x4e5012[_0xd3d8('0x44')],null))[_0xd3d8('0x1f')](respondWithResult(_0x4ab489,null))[_0xd3d8('0x41')](handleError(_0x4ab489,null));};exports[_0xd3d8('0x20')]=function(_0x3dda5e,_0x5033c5){return db['Tag'][_0xd3d8('0x48')]({'where':{'id':_0x3dda5e[_0xd3d8('0x42')]['id']}})[_0xd3d8('0x1f')](handleEntityNotFound(_0x5033c5,null))['then'](removeEntity(_0x5033c5,null))[_0xd3d8('0x41')](handleError(_0x5033c5,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 1a4a028..eddde11 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 _0x1d06=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x579e52,_0x164227){var _0x2ca01d=function(_0x5a7c48){while(--_0x5a7c48){_0x579e52['push'](_0x579e52['shift']());}};_0x2ca01d(++_0x164227);}(_0x1d06,0x1bc));var _0x61d0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1d06[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x61d0('0x0'));var util=require('util');var logger=require(_0x61d0('0x1'))(_0x61d0('0x2'));var moment=require(_0x61d0('0x3'));var BPromise=require('bluebird');var rp=require(_0x61d0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61d0('0x5'));var config=require(_0x61d0('0x6'));var attributes=require(_0x61d0('0x7'));module[_0x61d0('0x8')]=function(_0x4698f0,_0x47367d){return _0x4698f0[_0x61d0('0x9')](_0x61d0('0xa'),attributes,{'tableName':_0x61d0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbb3=['util','api','bluebird','request-promise','path','rimraf','./tag.attributes','tools_tags','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdbb3,0x98));var _0x3dbb=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xdbb3[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x3dbb('0x0'));var util=require(_0x3dbb('0x1'));var logger=require('../../config/logger')(_0x3dbb('0x2'));var moment=require('moment');var BPromise=require(_0x3dbb('0x3'));var rp=require(_0x3dbb('0x4'));var fs=require('fs');var path=require(_0x3dbb('0x5'));var rimraf=require(_0x3dbb('0x6'));var config=require('../../config/environment');var attributes=require(_0x3dbb('0x7'));module['exports']=function(_0x5dac77,_0x464258){return _0x5dac77['define']('Tag',attributes,{'tableName':_0x3dbb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index f7bf539..5976f1b 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 _0x3140=['jayson/promise','client','http','request','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3d7883,_0x334166){var _0x386248=function(_0x3f2fa0){while(--_0x3f2fa0){_0x3d7883['push'](_0x3d7883['shift']());}};_0x386248(++_0x334166);}(_0x3140,0xaf));var _0x0314=function(_0x29af75,_0x152b87){_0x29af75=_0x29af75-0x0;var _0x32b56b=_0x3140[_0x29af75];return _0x32b56b;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var moment=require(_0x0314('0x2'));var BPromise=require(_0x0314('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0314('0x4'))['db'];var utils=require(_0x0314('0x5'));var logger=require(_0x0314('0x6'))(_0x0314('0x7'));var config=require(_0x0314('0x8'));var jayson=require(_0x0314('0x9'));var client=jayson[_0x0314('0xa')][_0x0314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11ee94,_0x44762d,_0x176944){return new BPromise(function(_0x495b27,_0x26031f){return client[_0x0314('0xc')](_0x11ee94,_0x176944)['then'](function(_0x5e9bca){logger[_0x0314('0xd')]('Tag,\x20%s,\x20%s',_0x44762d,_0x0314('0xe'));logger[_0x0314('0xf')](_0x0314('0x10'),_0x44762d,_0x0314('0xe'),JSON[_0x0314('0x11')](_0x5e9bca));if(_0x5e9bca[_0x0314('0x12')]){if(_0x5e9bca['error'][_0x0314('0x13')]===0x1f4){logger[_0x0314('0x12')](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x26031f(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}logger['error'](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x495b27(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}else{logger[_0x0314('0xd')](_0x0314('0x14'),_0x44762d,_0x0314('0xe'));_0x495b27(_0x5e9bca['result'][_0x0314('0x15')]);}})[_0x0314('0x16')](function(_0x1f23c6){logger['error'](_0x0314('0x14'),_0x44762d,_0x1f23c6);_0x26031f(_0x1f23c6);});});} \ No newline at end of file +var _0x22fb=['Tag,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1af1c0,_0x3d01d6){var _0x380b46=function(_0x1d32cf){while(--_0x1d32cf){_0x1af1c0['push'](_0x1af1c0['shift']());}};_0x380b46(++_0x3d01d6);}(_0x22fb,0x192));var _0xb22f=function(_0x2783a7,_0x238f88){_0x2783a7=_0x2783a7-0x0;var _0x3e287b=_0x22fb[_0x2783a7];return _0x3e287b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412a95,_0x367d4b,_0x47f61a){return new BPromise(function(_0x34433b,_0x22c509){return client[_0xb22f('0xa')](_0x412a95,_0x47f61a)[_0xb22f('0xb')](function(_0x1a3aae){logger[_0xb22f('0xc')](_0xb22f('0xd'),_0x367d4b,_0xb22f('0xe'));logger[_0xb22f('0xf')](_0xb22f('0x10'),_0x367d4b,_0xb22f('0xe'),JSON['stringify'](_0x1a3aae));if(_0x1a3aae['error']){if(_0x1a3aae['error'][_0xb22f('0x11')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x367d4b,_0x1a3aae['error'][_0xb22f('0x12')]);return _0x22c509(_0x1a3aae[_0xb22f('0x13')][_0xb22f('0x12')]);}logger[_0xb22f('0x13')](_0xb22f('0xd'),_0x367d4b,_0x1a3aae[_0xb22f('0x13')]['message']);return _0x34433b(_0x1a3aae[_0xb22f('0x13')]['message']);}else{logger[_0xb22f('0xc')]('Tag,\x20%s,\x20%s',_0x367d4b,_0xb22f('0xe'));_0x34433b(_0x1a3aae[_0xb22f('0x14')][_0xb22f('0x12')]);}})[_0xb22f('0x15')](function(_0x447eaf){logger['error'](_0xb22f('0xd'),_0x367d4b,_0x447eaf);_0x22c509(_0x447eaf);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 902ab91..772a3c4 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 _0xebb0=['put','update','delete','removeQueues','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','isAuthenticated','show','/:id/queues','/:id/users','getAgents','post','addQueues'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xebb0,0xa6));var _0x0ebb=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0xebb0[_0x263f4c];return _0x3a78d3;};'use strict';var multer=require(_0x0ebb('0x0'));var util=require('util');var path=require(_0x0ebb('0x1'));var timeout=require(_0x0ebb('0x2'));var express=require(_0x0ebb('0x3'));var router=express['Router']();var auth=require(_0x0ebb('0x4'));var interaction=require(_0x0ebb('0x5'));var config=require(_0x0ebb('0x6'));var controller=require(_0x0ebb('0x7'));router[_0x0ebb('0x8')]('/',auth['isAuthenticated'](),controller[_0x0ebb('0x9')]);router['get'](_0x0ebb('0xa'),auth[_0x0ebb('0xb')](),controller[_0x0ebb('0xc')]);router[_0x0ebb('0x8')](_0x0ebb('0xd'),auth[_0x0ebb('0xb')](),controller['getQueues']);router['get'](_0x0ebb('0xe'),auth[_0x0ebb('0xb')](),controller[_0x0ebb('0xf')]);router[_0x0ebb('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0ebb('0x10')](_0x0ebb('0xd'),auth[_0x0ebb('0xb')](),controller[_0x0ebb('0x11')]);router['post'](_0x0ebb('0xe'),auth[_0x0ebb('0xb')](),controller['addAgents']);router[_0x0ebb('0x12')](_0x0ebb('0xa'),auth['isAuthenticated'](),controller[_0x0ebb('0x13')]);router[_0x0ebb('0x14')](_0x0ebb('0xa'),auth[_0x0ebb('0xb')](),controller['destroy']);router[_0x0ebb('0x14')](_0x0ebb('0xd'),auth[_0x0ebb('0xb')](),controller[_0x0ebb('0x15')]);router[_0x0ebb('0x14')]('/:id/users',auth[_0x0ebb('0xb')](),controller[_0x0ebb('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf717=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','show','/:id/queues','post','create','addQueues','/:id/users','addAgents','put','/:id','destroy','delete','removeQueues','removeAgents','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf717,0x11e));var _0x7f71=function(_0x218312,_0x532982){_0x218312=_0x218312-0x0;var _0x316e47=_0xf717[_0x218312];return _0x316e47;};'use strict';var multer=require(_0x7f71('0x0'));var util=require(_0x7f71('0x1'));var path=require('path');var timeout=require(_0x7f71('0x2'));var express=require('express');var router=express[_0x7f71('0x3')]();var auth=require(_0x7f71('0x4'));var interaction=require(_0x7f71('0x5'));var config=require(_0x7f71('0x6'));var controller=require(_0x7f71('0x7'));router[_0x7f71('0x8')]('/',auth[_0x7f71('0x9')](),controller[_0x7f71('0xa')]);router['get']('/:id',auth[_0x7f71('0x9')](),controller[_0x7f71('0xb')]);router[_0x7f71('0x8')](_0x7f71('0xc'),auth['isAuthenticated'](),controller['getQueues']);router['get']('/:id/users',auth[_0x7f71('0x9')](),controller['getAgents']);router[_0x7f71('0xd')]('/',auth[_0x7f71('0x9')](),controller[_0x7f71('0xe')]);router[_0x7f71('0xd')](_0x7f71('0xc'),auth[_0x7f71('0x9')](),controller[_0x7f71('0xf')]);router[_0x7f71('0xd')](_0x7f71('0x10'),auth[_0x7f71('0x9')](),controller[_0x7f71('0x11')]);router[_0x7f71('0x12')]('/:id',auth[_0x7f71('0x9')](),controller['update']);router['delete'](_0x7f71('0x13'),auth[_0x7f71('0x9')](),controller[_0x7f71('0x14')]);router[_0x7f71('0x15')](_0x7f71('0xc'),auth['isAuthenticated'](),controller[_0x7f71('0x16')]);router[_0x7f71('0x15')](_0x7f71('0x10'),auth[_0x7f71('0x9')](),controller[_0x7f71('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 89ed58d..aee191e 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 _0x3158=['name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3158,0x1ba));var _0x8315=function(_0x2c4fba,_0x1c0bb7){_0x2c4fba=_0x2c4fba-0x0;var _0x207521=_0x3158[_0x2c4fba];return _0x207521;};'use strict';var Sequelize=require(_0x8315('0x0'));module[_0x8315('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8315('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4302=['exports','STRING'];(function(_0x29a2c1,_0x20d6d1){var _0x5b4f2e=function(_0x341778){while(--_0x341778){_0x29a2c1['push'](_0x29a2c1['shift']());}};_0x5b4f2e(++_0x20d6d1);}(_0x4302,0x112));var _0x2430=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4302[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x2430('0x0')]={'name':{'type':Sequelize[_0x2430('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 90b21e0..0db41dc 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 _0xc476=['ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','count','offset','limit','Content-Range','json','apply','reject','update','destroy','then','Teams','UserProfileResource','sendStatus','error','name','send','index','map','Team','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','catch','user','get','role','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','sort','pick','Queues','add','ids','remove','Voice','Chat','Mail','Sms','Fax','Whatsapp','each','addAgents','User','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','spread','userTeam:save','removeAgents','voice','chat','mail','sms','fax','openchannel','isArray','userTeam:remove','emit','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv'];(function(_0x1e6b59,_0x5eca5d){var _0x40d7c5=function(_0x2dd544){while(--_0x2dd544){_0x1e6b59['push'](_0x1e6b59['shift']());}};_0x40d7c5(++_0x5eca5d);}(_0xc476,0xfb));var _0x6c47=function(_0x433157,_0x5bc755){_0x433157=_0x433157-0x0;var _0x30dd99=_0xc476[_0x433157];return _0x30dd99;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6c47('0x0'));var rimraf=require(_0x6c47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c47('0x2'));var rp=require('request-promise');var moment=require(_0x6c47('0x3'));var BPromise=require(_0x6c47('0x4'));var Mustache=require(_0x6c47('0x5'));var util=require(_0x6c47('0x6'));var path=require(_0x6c47('0x7'));var sox=require('sox');var csv=require(_0x6c47('0x8'));var ejs=require(_0x6c47('0x9'));var fs=require('fs');var _=require(_0x6c47('0xa'));var squel=require(_0x6c47('0xb'));var crypto=require(_0x6c47('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6c47('0x8'));var querystring=require('querystring');var Papa=require(_0x6c47('0xd'));var Redis=require(_0x6c47('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6c47('0xf'));var as=require(_0x6c47('0x10'));var hardwareService=require(_0x6c47('0x11'));var logger=require(_0x6c47('0x12'))(_0x6c47('0x13'));var utils=require('../../config/utils');var config=require(_0x6c47('0x14'));var db=require(_0x6c47('0x15'))['db'];config[_0x6c47('0x16')]=_[_0x6c47('0x17')](config[_0x6c47('0x16')],{'host':_0x6c47('0x18'),'port':0x18eb});var socket=require(_0x6c47('0x19'))(new Redis(config[_0x6c47('0x16')]));require(_0x6c47('0x1a'))[_0x6c47('0x1b')](socket);function respondWithStatusCode(_0x2cbc54,_0xcb76af){_0xcb76af=_0xcb76af||0xcc;return function(_0x2335d9){if(_0x2335d9){return _0x2cbc54['sendStatus'](_0xcb76af);}return _0x2cbc54[_0x6c47('0x1c')](_0xcb76af)[_0x6c47('0x1d')]();};}function respondWithResult(_0x234a80,_0x1c084e){_0x1c084e=_0x1c084e||0xc8;return function(_0x579403){if(_0x579403){return _0x234a80['status'](_0x1c084e)['json'](_0x579403);}};}function respondWithFilteredResult(_0x1c5139,_0x1e893e){return function(_0x3e86ba){if(_0x3e86ba){var _0x202d16=_0x3e86ba[_0x6c47('0x1e')],_0xd3b58c=_0x1e893e['offset'],_0x1266e8=_0x1e893e[_0x6c47('0x1f')]+_0x1e893e[_0x6c47('0x20')],_0x308c6a;if(_0x1266e8>=_0x202d16){_0x1266e8=_0x202d16;_0x308c6a=0xc8;}else{_0x308c6a=0xce;}_0x1c5139[_0x6c47('0x1c')](_0x308c6a);return _0x1c5139['set'](_0x6c47('0x21'),_0xd3b58c+'-'+_0x1266e8+'/'+_0x202d16)[_0x6c47('0x22')](_0x3e86ba);}return null;};}function patchUpdates(_0x2536bf){return function(_0x25094e){try{jsonpatch[_0x6c47('0x23')](_0x25094e,_0x2536bf,!![]);}catch(_0x4782d2){return BPromise[_0x6c47('0x24')](_0x4782d2);}return _0x25094e['save']();};}function saveUpdates(_0x1aefc1,_0x1d7357){return function(_0x504484){if(_0x504484){return _0x504484[_0x6c47('0x25')](_0x1aefc1)['then'](function(_0x577d53){return _0x577d53;});}return null;};}function removeEntity(_0x2c7d15,_0xc93140){return function(_0x34a75d){if(_0x34a75d){return _0x34a75d[_0x6c47('0x26')]()[_0x6c47('0x27')](function(){var _0xecdc2e=_0x34a75d['get']({'plain':!![]});var _0x26eb07=_0x6c47('0x28');return db[_0x6c47('0x29')][_0x6c47('0x26')]({'where':{'type':_0x26eb07,'resourceId':_0xecdc2e['id']}})['then'](function(){return _0x34a75d;});})[_0x6c47('0x27')](function(){_0x2c7d15[_0x6c47('0x1c')](0xcc)[_0x6c47('0x1d')]();});}};}function handleEntityNotFound(_0x4cf2ce,_0x5f4836){return function(_0xa2a0c1){if(!_0xa2a0c1){_0x4cf2ce[_0x6c47('0x2a')](0x194);}return _0xa2a0c1;};}function handleError(_0x4081ea,_0x32e67b){_0x32e67b=_0x32e67b||0x1f4;return function(_0x7b006){logger[_0x6c47('0x2b')](_0x7b006['stack']);if(_0x7b006[_0x6c47('0x2c')]){delete _0x7b006[_0x6c47('0x2c')];}_0x4081ea[_0x6c47('0x1c')](_0x32e67b)[_0x6c47('0x2d')](_0x7b006);};}exports[_0x6c47('0x2e')]=function(_0x5ac482,_0x39a220){var _0x5c0e96={},_0x40b58e={},_0xa4204c={'count':0x0,'rows':[]};var _0x11228f=_[_0x6c47('0x2f')](db[_0x6c47('0x30')]['rawAttributes'],function(_0x4a4a22){return{'name':_0x4a4a22[_0x6c47('0x31')],'type':_0x4a4a22[_0x6c47('0x32')][_0x6c47('0x33')]};});_0x40b58e['model']=_[_0x6c47('0x2f')](_0x11228f,_0x6c47('0x2c'));_0x40b58e[_0x6c47('0x34')]=_[_0x6c47('0x35')](_0x5ac482[_0x6c47('0x34')]);_0x40b58e[_0x6c47('0x36')]=_[_0x6c47('0x37')](_0x40b58e[_0x6c47('0x38')],_0x40b58e['query']);_0x5c0e96[_0x6c47('0x39')]=_[_0x6c47('0x37')](_0x40b58e[_0x6c47('0x38')],qs['fields'](_0x5ac482['query']['fields']));_0x5c0e96[_0x6c47('0x39')]=_0x5c0e96[_0x6c47('0x39')][_0x6c47('0x3a')]?_0x5c0e96[_0x6c47('0x39')]:_0x40b58e[_0x6c47('0x38')];if(!_0x5ac482[_0x6c47('0x34')][_0x6c47('0x3b')](_0x6c47('0x3c'))){_0x5c0e96[_0x6c47('0x20')]=qs[_0x6c47('0x20')](_0x5ac482[_0x6c47('0x34')]['limit']);_0x5c0e96[_0x6c47('0x1f')]=qs[_0x6c47('0x1f')](_0x5ac482[_0x6c47('0x34')][_0x6c47('0x1f')]);}_0x5c0e96[_0x6c47('0x3d')]=qs['sort'](_0x5ac482[_0x6c47('0x34')]['sort']);_0x5c0e96['where']=qs['filters'](_['pick'](_0x5ac482[_0x6c47('0x34')],_0x40b58e[_0x6c47('0x36')]),_0x11228f);if(_0x5ac482[_0x6c47('0x34')][_0x6c47('0x3e')]){_0x5c0e96[_0x6c47('0x3f')]=_['merge'](_0x5c0e96[_0x6c47('0x3f')],{'$or':_[_0x6c47('0x2f')](_0x11228f,function(_0xe56531){if(_0xe56531[_0x6c47('0x32')]!==_0x6c47('0x40')){var _0x5675b3={};_0x5675b3[_0xe56531['name']]={'$like':'%'+_0x5ac482[_0x6c47('0x34')][_0x6c47('0x3e')]+'%'};return _0x5675b3;}})});}_0x5c0e96=_[_0x6c47('0x41')]({},_0x5c0e96,_0x5ac482[_0x6c47('0x42')]);var _0x922e05={'where':_0x5c0e96[_0x6c47('0x3f')]};return db[_0x6c47('0x30')][_0x6c47('0x1e')](_0x922e05)[_0x6c47('0x27')](function(_0x5448d3){_0xa4204c['count']=_0x5448d3;if(_0x5ac482[_0x6c47('0x34')][_0x6c47('0x43')]){_0x5c0e96[_0x6c47('0x44')]=[{'all':!![]}];}return db[_0x6c47('0x30')][_0x6c47('0x45')](_0x5c0e96);})['then'](function(_0x2228af){_0xa4204c[_0x6c47('0x46')]=_0x2228af;return _0xa4204c;})[_0x6c47('0x27')](respondWithFilteredResult(_0x39a220,_0x5c0e96))['catch'](handleError(_0x39a220,null));};exports[_0x6c47('0x47')]=function(_0x24d229,_0x2e8d99){var _0x49df07={'raw':![],'where':{'id':_0x24d229[_0x6c47('0x48')]['id']}},_0x236fd8={};_0x236fd8[_0x6c47('0x38')]=_[_0x6c47('0x35')](db[_0x6c47('0x30')][_0x6c47('0x49')]);_0x236fd8['query']=_['keys'](_0x24d229[_0x6c47('0x34')]);_0x236fd8[_0x6c47('0x36')]=_[_0x6c47('0x37')](_0x236fd8[_0x6c47('0x38')],_0x236fd8[_0x6c47('0x34')]);_0x49df07['attributes']=_[_0x6c47('0x37')](_0x236fd8[_0x6c47('0x38')],qs[_0x6c47('0x4a')](_0x24d229[_0x6c47('0x34')][_0x6c47('0x4a')]));_0x49df07[_0x6c47('0x39')]=_0x49df07['attributes'][_0x6c47('0x3a')]?_0x49df07[_0x6c47('0x39')]:_0x236fd8[_0x6c47('0x38')];if(_0x24d229[_0x6c47('0x34')][_0x6c47('0x43')]){_0x49df07[_0x6c47('0x44')]=[{'all':!![]}];}_0x49df07=_[_0x6c47('0x41')]({},_0x49df07,_0x24d229[_0x6c47('0x42')]);return db[_0x6c47('0x30')]['find'](_0x49df07)[_0x6c47('0x27')](handleEntityNotFound(_0x2e8d99,null))[_0x6c47('0x27')](respondWithResult(_0x2e8d99,null))[_0x6c47('0x4b')](handleError(_0x2e8d99,null));};exports['create']=function(_0x333680,_0x29bdf3){return db[_0x6c47('0x30')]['create'](_0x333680['body'],{})[_0x6c47('0x27')](function(_0x5c32be){var _0x2b8903=_0x333680[_0x6c47('0x4c')][_0x6c47('0x4d')]({'plain':!![]});if(!_0x2b8903)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b8903[_0x6c47('0x4e')]===_0x6c47('0x4c')){var _0x12f2c5=_0x5c32be[_0x6c47('0x4d')]({'plain':!![]});var _0x3327c3=_0x6c47('0x28');return db['UserProfileSection'][_0x6c47('0x4f')]({'where':{'name':_0x3327c3,'userProfileId':_0x2b8903['userProfileId']},'raw':!![]})[_0x6c47('0x27')](function(_0x320783){if(_0x320783&&_0x320783[_0x6c47('0x50')]===0x0){return db[_0x6c47('0x29')][_0x6c47('0x51')]({'name':_0x12f2c5[_0x6c47('0x2c')],'resourceId':_0x12f2c5['id'],'type':_0x320783['name'],'sectionId':_0x320783['id']},{})[_0x6c47('0x27')](function(){return _0x5c32be;});}else{return _0x5c32be;}})['catch'](function(_0x10b7b1){logger['error'](_0x6c47('0x52'),_0x10b7b1);throw _0x10b7b1;});}return _0x5c32be;})[_0x6c47('0x27')](respondWithResult(_0x29bdf3,0xc9))[_0x6c47('0x4b')](handleError(_0x29bdf3,null));};exports[_0x6c47('0x25')]=function(_0x2dc802,_0x4a5eea){if(_0x2dc802[_0x6c47('0x53')]['id']){delete _0x2dc802[_0x6c47('0x53')]['id'];}return db[_0x6c47('0x30')][_0x6c47('0x4f')]({'where':{'id':_0x2dc802[_0x6c47('0x48')]['id']}})['then'](handleEntityNotFound(_0x4a5eea,null))[_0x6c47('0x27')](saveUpdates(_0x2dc802[_0x6c47('0x53')],null))[_0x6c47('0x27')](respondWithResult(_0x4a5eea,null))[_0x6c47('0x4b')](handleError(_0x4a5eea,null));};exports[_0x6c47('0x26')]=function(_0x174207,_0x17f366){return db[_0x6c47('0x30')][_0x6c47('0x4f')]({'where':{'id':_0x174207[_0x6c47('0x48')]['id']}})[_0x6c47('0x27')](handleEntityNotFound(_0x17f366,null))[_0x6c47('0x27')](removeEntity(_0x17f366,null))['catch'](handleError(_0x17f366,null));};exports[_0x6c47('0x54')]=function(_0x23c2df,_0x1767a0,_0x5457f0){return db[_0x6c47('0x30')][_0x6c47('0x55')]({'where':{'id':_0x23c2df[_0x6c47('0x48')]['id']}})[_0x6c47('0x27')](handleEntityNotFound(_0x1767a0,null))[_0x6c47('0x27')](function(_0x1277f4){if(!_0x23c2df['query'][_0x6c47('0x56')]||!utils[_0x6c47('0x57')](_0x23c2df[_0x6c47('0x34')]['channel'])){throw new db[(_0x6c47('0x58'))][(_0x6c47('0x59'))](_0x6c47('0x5a'));}var _0x539232={};var _0x261258={};_0x261258[_0x6c47('0x38')]=_[_0x6c47('0x35')](db[_[_0x6c47('0x5b')](_0x23c2df[_0x6c47('0x34')]['channel'][_0x6c47('0x5c')]())+_0x6c47('0x5d')][_0x6c47('0x49')]);_0x261258[_0x6c47('0x34')]=_[_0x6c47('0x35')](_0x23c2df[_0x6c47('0x34')]);_0x261258['filters']=_[_0x6c47('0x37')](_0x261258['model'],_0x261258[_0x6c47('0x34')]);_0x539232[_0x6c47('0x39')]=_[_0x6c47('0x37')](_0x261258[_0x6c47('0x38')],qs['fields'](_0x23c2df['query'][_0x6c47('0x4a')]));_0x539232[_0x6c47('0x39')]=_0x539232[_0x6c47('0x39')][_0x6c47('0x3a')]?_0x539232[_0x6c47('0x39')]:_0x261258[_0x6c47('0x38')];_0x539232[_0x6c47('0x20')]=qs[_0x6c47('0x20')](_0x23c2df['query'][_0x6c47('0x20')]);_0x539232[_0x6c47('0x1f')]=qs[_0x6c47('0x1f')](_0x23c2df[_0x6c47('0x34')][_0x6c47('0x1f')]);_0x539232['order']=qs[_0x6c47('0x5e')](_0x23c2df[_0x6c47('0x34')][_0x6c47('0x5e')]);_0x539232['where']=qs[_0x6c47('0x36')](_[_0x6c47('0x5f')](_0x23c2df[_0x6c47('0x34')],_0x261258[_0x6c47('0x36')]));_0x539232=_[_0x6c47('0x41')]({},_0x539232,_0x23c2df['options']);return _0x1277f4['get'+_['capitalize'](_0x23c2df['query'][_0x6c47('0x56')][_0x6c47('0x5c')]())+_0x6c47('0x60')](_0x539232);})[_0x6c47('0x27')](respondWithResult(_0x1767a0,null))[_0x6c47('0x4b')](handleError(_0x1767a0,null));};exports['addQueues']=function(_0x161f55,_0x403957,_0x4e0aa3){return db[_0x6c47('0x30')][_0x6c47('0x55')]({'where':{'id':_0x161f55['params']['id']}})[_0x6c47('0x27')](function(_0x8209e8){if(_0x8209e8){if(!_0x161f55['body']['channel']||!utils['isValidChannel'](_0x161f55[_0x6c47('0x53')]['channel'])){throw new db[(_0x6c47('0x58'))]['ValidationError'](_0x6c47('0x5a'));}return _0x8209e8[_0x6c47('0x61')+_[_0x6c47('0x5b')](_0x161f55[_0x6c47('0x53')]['channel'][_0x6c47('0x5c')]())+_0x6c47('0x60')](_0x161f55[_0x6c47('0x53')][_0x6c47('0x62')]);}return null;})[_0x6c47('0x27')](handleEntityNotFound(_0x403957,null))['then'](respondWithStatusCode(_0x403957,null))[_0x6c47('0x4b')](handleError(_0x403957,null));};exports['removeQueues']=function(_0x37c75f,_0x3a9d7a,_0x5bd8c9){return db['Team'][_0x6c47('0x55')]({'where':{'id':_0x37c75f[_0x6c47('0x48')]['id']}})[_0x6c47('0x27')](function(_0x592ea6){if(_0x592ea6){if(!_0x37c75f[_0x6c47('0x34')][_0x6c47('0x56')]||!utils['isValidChannel'](_0x37c75f['query']['channel'])){throw new db[(_0x6c47('0x58'))][(_0x6c47('0x59'))](_0x6c47('0x5a'));}return _0x592ea6[_0x6c47('0x63')+_['capitalize'](_0x37c75f['query'][_0x6c47('0x56')][_0x6c47('0x5c')]())+_0x6c47('0x60')](_0x37c75f[_0x6c47('0x34')][_0x6c47('0x62')]);}return null;})[_0x6c47('0x27')](handleEntityNotFound(_0x3a9d7a,null))[_0x6c47('0x27')](respondWithStatusCode(_0x3a9d7a,null))[_0x6c47('0x4b')](handleError(_0x3a9d7a,null));};exports['addAgents']=function(_0x121546,_0x4472df,_0x4cf678){return db[_0x6c47('0x30')]['find']({'where':{'id':_0x121546[_0x6c47('0x48')]['id']}})[_0x6c47('0x27')](handleEntityNotFound(_0x4472df,null))[_0x6c47('0x27')](function(_0x3ac246){if(_0x3ac246){var _0x6f7abd=[_0x6c47('0x64'),_0x6c47('0x65'),_0x6c47('0x66'),_0x6c47('0x67'),_0x6c47('0x68'),'Openchannel',_0x6c47('0x69')];return BPromise[_0x6c47('0x6a')](_0x6f7abd,function(_0xef8035){return _0x3ac246[_0x6c47('0x4d')+_0xef8035+_0x6c47('0x60')]({'attributes':['id',_0x6c47('0x2c')]})[_0x6c47('0x27')](function(_0x36152d){return BPromise[_0x6c47('0x6a')](_0x36152d,function(_0x497a4f){return _0x497a4f[_0x6c47('0x6b')](_0x121546['body'][_0x6c47('0x62')])[_0x6c47('0x27')](function(){if(_0xef8035===_0x6c47('0x64')){return db[_0x6c47('0x6c')]['findAll']({'where':{'id':_0x121546[_0x6c47('0x53')][_0x6c47('0x62')]},'attributes':['id',_0x6c47('0x2c'),_0x6c47('0x6d'),'voicePause',_0x6c47('0x6e')],'raw':!![]})[_0x6c47('0x27')](function(_0x1dc8c4){return BPromise[_0x6c47('0x6a')](_[_0x6c47('0x3e')](_0x1dc8c4,{'online':0x1}),function(_0x27eefb){return db[_0x6c47('0x6f')][_0x6c47('0x70')]({'membername':_0x27eefb[_0x6c47('0x2c')],'UserId':_0x27eefb['id'],'queue_name':_0x497a4f[_0x6c47('0x2c')],'VoiceQueueId':_0x497a4f['id'],'interface':_[_0x6c47('0x71')](_0x27eefb['interface'])?util[_0x6c47('0x72')](_0x6c47('0x73'),_0x27eefb['name']):_0x27eefb[_0x6c47('0x6e')],'paused':_0x27eefb[_0x6c47('0x74')]||![],'penalty':0x0});});});}});});})[_0x6c47('0x27')](function(){return _0x3ac246;});})[_0x6c47('0x27')](function(){return _0x3ac246;});}})['then'](function(_0x322b9b){if(_0x322b9b){return _0x322b9b['addAgents'](_0x121546['body'][_0x6c47('0x62')],_['omit'](_0x121546['body'],[_0x6c47('0x62'),'id'])||{})[_0x6c47('0x75')](function(_0x35c604){for(var _0x3973f8=0x0;_0x3973f8<_0x121546['body'][_0x6c47('0x62')][_0x6c47('0x3a')];_0x3973f8+=0x1){socket['emit'](_0x6c47('0x76'),{'UserId':_0x121546[_0x6c47('0x53')]['ids'][_0x3973f8],'TeamId':_0x121546[_0x6c47('0x48')]['id']});}return _0x35c604;});}})[_0x6c47('0x27')](respondWithResult(_0x4472df,null))['catch'](handleError(_0x4472df,null));};exports[_0x6c47('0x77')]=function(_0x48c949,_0xdc229c,_0x379416){return db['Team'][_0x6c47('0x4f')]({'where':{'id':_0x48c949[_0x6c47('0x48')]['id']}})['then'](handleEntityNotFound(_0xdc229c,null))[_0x6c47('0x27')](function(_0x3a92b9){if(_0x3a92b9){return BPromise[_0x6c47('0x6a')]([_0x6c47('0x78'),_0x6c47('0x79'),_0x6c47('0x7a'),_0x6c47('0x7b'),_0x6c47('0x7c'),_0x6c47('0x7d'),'whatsapp'],function(_0x11fafc){return _0x3a92b9[_0x6c47('0x4d')+_[_0x6c47('0x5b')](_0x11fafc)+_0x6c47('0x60')]({'attributes':['id',_0x6c47('0x2c')]})[_0x6c47('0x27')](function(_0x16823f){return BPromise[_0x6c47('0x6a')](_0x16823f,function(_0x346669){return _0x346669[_0x6c47('0x77')](_0x48c949['query'][_0x6c47('0x62')])[_0x6c47('0x27')](function(){if(_0x11fafc===_0x6c47('0x78')){return db[_0x6c47('0x6f')][_0x6c47('0x26')]({'where':{'VoiceQueueId':_0x346669['id'],'UserId':_0x48c949['query']['ids']}});}});});})[_0x6c47('0x27')](function(){return _0x3a92b9;});})[_0x6c47('0x27')](function(){return _0x3a92b9;});}})['then'](function(_0x2c5bc5){if(_0x2c5bc5){return _0x2c5bc5['removeAgents'](_0x48c949['query']['ids'])[_0x6c47('0x27')](function(){if(_[_0x6c47('0x7e')](_0x48c949['query'][_0x6c47('0x62')])){for(var _0x15dfdc=0x0;_0x15dfdc<_0x48c949['query']['ids'][_0x6c47('0x3a')];_0x15dfdc+=0x1){socket['emit'](_0x6c47('0x7f'),{'UserId':Number(_0x48c949[_0x6c47('0x34')][_0x6c47('0x62')][_0x15dfdc]),'TeamId':Number(_0x48c949[_0x6c47('0x48')]['id'])});}}else{socket[_0x6c47('0x80')]('userTeam:remove',{'UserId':Number(_0x48c949[_0x6c47('0x34')][_0x6c47('0x62')]),'TeamId':Number(_0x48c949[_0x6c47('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0xdc229c,null))[_0x6c47('0x4b')](handleError(_0xdc229c,null));};exports[_0x6c47('0x81')]=function(_0x42dfa0,_0xec3fb8,_0x2e247f){var _0x1a8a61={};var _0x5e6a9d={};var _0x4abf16;var _0x1a263e;return db[_0x6c47('0x30')][_0x6c47('0x55')]({'where':{'id':_0x42dfa0[_0x6c47('0x48')]['id']}})[_0x6c47('0x27')](handleEntityNotFound(_0xec3fb8,null))[_0x6c47('0x27')](function(_0x18f88e){if(_0x18f88e){_0x4abf16=_0x18f88e;_0x5e6a9d[_0x6c47('0x38')]=_[_0x6c47('0x35')](db['User'][_0x6c47('0x49')]);_0x5e6a9d[_0x6c47('0x34')]=_['keys'](_0x42dfa0['query']);_0x5e6a9d['filters']=_['intersection'](_0x5e6a9d[_0x6c47('0x38')],_0x5e6a9d[_0x6c47('0x34')]);_0x1a8a61['attributes']=_[_0x6c47('0x37')](_0x5e6a9d[_0x6c47('0x38')],qs['fields'](_0x42dfa0[_0x6c47('0x34')]['fields']));_0x1a8a61[_0x6c47('0x39')]=_0x1a8a61['attributes'][_0x6c47('0x3a')]?_0x1a8a61['attributes']:_0x5e6a9d[_0x6c47('0x38')];_0x1a8a61['order']=qs['sort'](_0x42dfa0['query']['sort']);_0x1a8a61[_0x6c47('0x3f')]=qs[_0x6c47('0x36')](_[_0x6c47('0x5f')](_0x42dfa0[_0x6c47('0x34')],_0x5e6a9d[_0x6c47('0x36')]));if(_0x42dfa0[_0x6c47('0x34')][_0x6c47('0x3e')]){_0x1a8a61['where']=_['merge'](_0x1a8a61['where'],{'$or':_[_0x6c47('0x2f')](_0x1a8a61[_0x6c47('0x39')],function(_0x4e8622){var _0x174b2c={};_0x174b2c[_0x4e8622]={'$like':'%'+_0x42dfa0[_0x6c47('0x34')][_0x6c47('0x3e')]+'%'};return _0x174b2c;})});}_0x1a8a61=_[_0x6c47('0x41')]({},_0x1a8a61,_0x42dfa0[_0x6c47('0x42')]);return _0x4abf16[_0x6c47('0x81')](_0x1a8a61);}})[_0x6c47('0x27')](function(_0x133ef5){if(_0x133ef5){_0x1a263e=_0x133ef5[_0x6c47('0x3a')];if(!_0x42dfa0[_0x6c47('0x34')][_0x6c47('0x3b')]('nolimit')){_0x1a8a61[_0x6c47('0x20')]=qs[_0x6c47('0x20')](_0x42dfa0[_0x6c47('0x34')][_0x6c47('0x20')]);_0x1a8a61[_0x6c47('0x1f')]=qs[_0x6c47('0x1f')](_0x42dfa0['query']['offset']);}return _0x4abf16[_0x6c47('0x81')](_0x1a8a61);}})[_0x6c47('0x27')](function(_0x1ae4c1){if(_0x1ae4c1){return _0x1ae4c1?{'count':_0x1a263e,'rows':_0x1ae4c1}:null;}})[_0x6c47('0x27')](respondWithResult(_0xec3fb8,null))[_0x6c47('0x4b')](handleError(_0xec3fb8,null));}; \ No newline at end of file +var _0x3fea=['show','params','find','user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','rawAttributes','length','add','Queues','ids','removeQueues','remove','Chat','Mail','Sms','Openchannel','each','addAgents','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','omit','spread','emit','userTeam:save','voice','mail','sms','fax','openchannel','whatsapp','removeAgents','isArray','userTeam:remove','getAgents','User','pick','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','path','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','defaults','localhost','redis','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Teams','end','error','name','send','index','Team','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3fea,0x1bc));var _0xa3fe=function(_0x450baf,_0x2c9f1e){_0x450baf=_0x450baf-0x0;var _0x448041=_0x3fea[_0x450baf];return _0x448041;};'use strict';var pdf=require(_0xa3fe('0x0'));var emlformat=require(_0xa3fe('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa3fe('0x2'));var rp=require(_0xa3fe('0x3'));var moment=require(_0xa3fe('0x4'));var BPromise=require(_0xa3fe('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa3fe('0x6'));var sox=require('sox');var csv=require(_0xa3fe('0x7'));var ejs=require(_0xa3fe('0x8'));var fs=require('fs');var _=require(_0xa3fe('0x9'));var squel=require(_0xa3fe('0xa'));var crypto=require(_0xa3fe('0xb'));var jsforce=require(_0xa3fe('0xc'));var deskjs=require(_0xa3fe('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa3fe('0xe'));var Papa=require(_0xa3fe('0xf'));var Redis=require(_0xa3fe('0x10'));var authService=require(_0xa3fe('0x11'));var qs=require(_0xa3fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3fe('0x13'));var logger=require(_0xa3fe('0x14'))('api');var utils=require(_0xa3fe('0x15'));var config=require(_0xa3fe('0x16'));var db=require(_0xa3fe('0x17'))['db'];config['redis']=_[_0xa3fe('0x18')](config['redis'],{'host':_0xa3fe('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3fe('0x1a')]));require('./team.socket')[_0xa3fe('0x1b')](socket);function respondWithStatusCode(_0x18e180,_0x2fea55){_0x2fea55=_0x2fea55||0xcc;return function(_0x53c516){if(_0x53c516){return _0x18e180[_0xa3fe('0x1c')](_0x2fea55);}return _0x18e180[_0xa3fe('0x1d')](_0x2fea55)['end']();};}function respondWithResult(_0xde7c9,_0x37715e){_0x37715e=_0x37715e||0xc8;return function(_0x5390a4){if(_0x5390a4){return _0xde7c9[_0xa3fe('0x1d')](_0x37715e)[_0xa3fe('0x1e')](_0x5390a4);}};}function respondWithFilteredResult(_0x3f8db3,_0x296c0b){return function(_0x233e3d){if(_0x233e3d){var _0x2ff6a2=_0x233e3d[_0xa3fe('0x1f')],_0x235ed1=_0x296c0b[_0xa3fe('0x20')],_0xa250ca=_0x296c0b[_0xa3fe('0x20')]+_0x296c0b[_0xa3fe('0x21')],_0x1242fc;if(_0xa250ca>=_0x2ff6a2){_0xa250ca=_0x2ff6a2;_0x1242fc=0xc8;}else{_0x1242fc=0xce;}_0x3f8db3[_0xa3fe('0x1d')](_0x1242fc);return _0x3f8db3[_0xa3fe('0x22')](_0xa3fe('0x23'),_0x235ed1+'-'+_0xa250ca+'/'+_0x2ff6a2)['json'](_0x233e3d);}return null;};}function patchUpdates(_0x33e28c){return function(_0x2d7356){try{jsonpatch[_0xa3fe('0x24')](_0x2d7356,_0x33e28c,!![]);}catch(_0x35227c){return BPromise[_0xa3fe('0x25')](_0x35227c);}return _0x2d7356[_0xa3fe('0x26')]();};}function saveUpdates(_0x3a0bd5,_0xb649ed){return function(_0x144bf0){if(_0x144bf0){return _0x144bf0[_0xa3fe('0x27')](_0x3a0bd5)[_0xa3fe('0x28')](function(_0x1a70d7){return _0x1a70d7;});}return null;};}function removeEntity(_0x2d9e50,_0x3b5c55){return function(_0x25a536){if(_0x25a536){return _0x25a536['destroy']()['then'](function(){var _0x1b80bd=_0x25a536[_0xa3fe('0x29')]({'plain':!![]});var _0x23dd23=_0xa3fe('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x23dd23,'resourceId':_0x1b80bd['id']}})[_0xa3fe('0x28')](function(){return _0x25a536;});})[_0xa3fe('0x28')](function(){_0x2d9e50[_0xa3fe('0x1d')](0xcc)[_0xa3fe('0x2b')]();});}};}function handleEntityNotFound(_0x2806df,_0x5ba6ca){return function(_0x572083){if(!_0x572083){_0x2806df['sendStatus'](0x194);}return _0x572083;};}function handleError(_0x2f0242,_0x4507a3){_0x4507a3=_0x4507a3||0x1f4;return function(_0x19747f){logger[_0xa3fe('0x2c')](_0x19747f['stack']);if(_0x19747f[_0xa3fe('0x2d')]){delete _0x19747f[_0xa3fe('0x2d')];}_0x2f0242[_0xa3fe('0x1d')](_0x4507a3)[_0xa3fe('0x2e')](_0x19747f);};}exports[_0xa3fe('0x2f')]=function(_0x2c7e64,_0x30127b){var _0x29c988={},_0x2960c5={},_0x5179cb={'count':0x0,'rows':[]};var _0xcc6984=_['map'](db[_0xa3fe('0x30')]['rawAttributes'],function(_0x27776f){return{'name':_0x27776f['fieldName'],'type':_0x27776f[_0xa3fe('0x31')]['key']};});_0x2960c5[_0xa3fe('0x32')]=_[_0xa3fe('0x33')](_0xcc6984,_0xa3fe('0x2d'));_0x2960c5[_0xa3fe('0x34')]=_[_0xa3fe('0x35')](_0x2c7e64[_0xa3fe('0x34')]);_0x2960c5[_0xa3fe('0x36')]=_[_0xa3fe('0x37')](_0x2960c5[_0xa3fe('0x32')],_0x2960c5['query']);_0x29c988[_0xa3fe('0x38')]=_[_0xa3fe('0x37')](_0x2960c5[_0xa3fe('0x32')],qs[_0xa3fe('0x39')](_0x2c7e64[_0xa3fe('0x34')][_0xa3fe('0x39')]));_0x29c988[_0xa3fe('0x38')]=_0x29c988[_0xa3fe('0x38')]['length']?_0x29c988[_0xa3fe('0x38')]:_0x2960c5[_0xa3fe('0x32')];if(!_0x2c7e64[_0xa3fe('0x34')][_0xa3fe('0x3a')](_0xa3fe('0x3b'))){_0x29c988['limit']=qs[_0xa3fe('0x21')](_0x2c7e64[_0xa3fe('0x34')]['limit']);_0x29c988[_0xa3fe('0x20')]=qs[_0xa3fe('0x20')](_0x2c7e64[_0xa3fe('0x34')][_0xa3fe('0x20')]);}_0x29c988[_0xa3fe('0x3c')]=qs[_0xa3fe('0x3d')](_0x2c7e64[_0xa3fe('0x34')]['sort']);_0x29c988['where']=qs['filters'](_['pick'](_0x2c7e64[_0xa3fe('0x34')],_0x2960c5[_0xa3fe('0x36')]),_0xcc6984);if(_0x2c7e64[_0xa3fe('0x34')][_0xa3fe('0x3e')]){_0x29c988[_0xa3fe('0x3f')]=_[_0xa3fe('0x40')](_0x29c988[_0xa3fe('0x3f')],{'$or':_[_0xa3fe('0x33')](_0xcc6984,function(_0x1e56ee){if(_0x1e56ee[_0xa3fe('0x31')]!==_0xa3fe('0x41')){var _0x26aeb9={};_0x26aeb9[_0x1e56ee[_0xa3fe('0x2d')]]={'$like':'%'+_0x2c7e64['query'][_0xa3fe('0x3e')]+'%'};return _0x26aeb9;}})});}_0x29c988=_['merge']({},_0x29c988,_0x2c7e64[_0xa3fe('0x42')]);var _0x3a35f4={'where':_0x29c988['where']};return db[_0xa3fe('0x30')][_0xa3fe('0x1f')](_0x3a35f4)[_0xa3fe('0x28')](function(_0x351e1b){_0x5179cb[_0xa3fe('0x1f')]=_0x351e1b;if(_0x2c7e64['query'][_0xa3fe('0x43')]){_0x29c988[_0xa3fe('0x44')]=[{'all':!![]}];}return db[_0xa3fe('0x30')][_0xa3fe('0x45')](_0x29c988);})[_0xa3fe('0x28')](function(_0x49fa16){_0x5179cb[_0xa3fe('0x46')]=_0x49fa16;return _0x5179cb;})[_0xa3fe('0x28')](respondWithFilteredResult(_0x30127b,_0x29c988))[_0xa3fe('0x47')](handleError(_0x30127b,null));};exports[_0xa3fe('0x48')]=function(_0x3dbf95,_0x4fb8ef){var _0x2dcaf8={'raw':![],'where':{'id':_0x3dbf95[_0xa3fe('0x49')]['id']}},_0x2588cd={};_0x2588cd[_0xa3fe('0x32')]=_['keys'](db[_0xa3fe('0x30')]['rawAttributes']);_0x2588cd['query']=_[_0xa3fe('0x35')](_0x3dbf95['query']);_0x2588cd[_0xa3fe('0x36')]=_[_0xa3fe('0x37')](_0x2588cd['model'],_0x2588cd[_0xa3fe('0x34')]);_0x2dcaf8[_0xa3fe('0x38')]=_[_0xa3fe('0x37')](_0x2588cd[_0xa3fe('0x32')],qs[_0xa3fe('0x39')](_0x3dbf95['query']['fields']));_0x2dcaf8[_0xa3fe('0x38')]=_0x2dcaf8[_0xa3fe('0x38')]['length']?_0x2dcaf8['attributes']:_0x2588cd[_0xa3fe('0x32')];if(_0x3dbf95[_0xa3fe('0x34')][_0xa3fe('0x43')]){_0x2dcaf8[_0xa3fe('0x44')]=[{'all':!![]}];}_0x2dcaf8=_[_0xa3fe('0x40')]({},_0x2dcaf8,_0x3dbf95[_0xa3fe('0x42')]);return db[_0xa3fe('0x30')][_0xa3fe('0x4a')](_0x2dcaf8)[_0xa3fe('0x28')](handleEntityNotFound(_0x4fb8ef,null))[_0xa3fe('0x28')](respondWithResult(_0x4fb8ef,null))['catch'](handleError(_0x4fb8ef,null));};exports['create']=function(_0x3799ab,_0x3cbff7){return db[_0xa3fe('0x30')]['create'](_0x3799ab['body'],{})['then'](function(_0x4932ab){var _0x5eeb1a=_0x3799ab[_0xa3fe('0x4b')]['get']({'plain':!![]});if(!_0x5eeb1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5eeb1a[_0xa3fe('0x4c')]===_0xa3fe('0x4b')){var _0x5528ec=_0x4932ab['get']({'plain':!![]});var _0x1220c7=_0xa3fe('0x2a');return db['UserProfileSection'][_0xa3fe('0x4a')]({'where':{'name':_0x1220c7,'userProfileId':_0x5eeb1a[_0xa3fe('0x4d')]},'raw':!![]})[_0xa3fe('0x28')](function(_0x3a253b){if(_0x3a253b&&_0x3a253b[_0xa3fe('0x4e')]===0x0){return db['UserProfileResource'][_0xa3fe('0x4f')]({'name':_0x5528ec[_0xa3fe('0x2d')],'resourceId':_0x5528ec['id'],'type':_0x3a253b['name'],'sectionId':_0x3a253b['id']},{})[_0xa3fe('0x28')](function(){return _0x4932ab;});}else{return _0x4932ab;}})['catch'](function(_0x2ea668){logger['error'](_0xa3fe('0x50'),_0x2ea668);throw _0x2ea668;});}return _0x4932ab;})[_0xa3fe('0x28')](respondWithResult(_0x3cbff7,0xc9))['catch'](handleError(_0x3cbff7,null));};exports[_0xa3fe('0x27')]=function(_0x63556,_0x360c28){if(_0x63556[_0xa3fe('0x51')]['id']){delete _0x63556[_0xa3fe('0x51')]['id'];}return db[_0xa3fe('0x30')][_0xa3fe('0x4a')]({'where':{'id':_0x63556['params']['id']}})[_0xa3fe('0x28')](handleEntityNotFound(_0x360c28,null))['then'](saveUpdates(_0x63556[_0xa3fe('0x51')],null))['then'](respondWithResult(_0x360c28,null))[_0xa3fe('0x47')](handleError(_0x360c28,null));};exports[_0xa3fe('0x52')]=function(_0x540b40,_0x11cdb9){return db['Team'][_0xa3fe('0x4a')]({'where':{'id':_0x540b40[_0xa3fe('0x49')]['id']}})[_0xa3fe('0x28')](handleEntityNotFound(_0x11cdb9,null))[_0xa3fe('0x28')](removeEntity(_0x11cdb9,null))[_0xa3fe('0x47')](handleError(_0x11cdb9,null));};exports[_0xa3fe('0x53')]=function(_0xd9af13,_0x5ed00a,_0x2a5e38){return db[_0xa3fe('0x30')][_0xa3fe('0x54')]({'where':{'id':_0xd9af13['params']['id']}})[_0xa3fe('0x28')](handleEntityNotFound(_0x5ed00a,null))[_0xa3fe('0x28')](function(_0x1b1794){if(!_0xd9af13[_0xa3fe('0x34')][_0xa3fe('0x55')]||!utils[_0xa3fe('0x56')](_0xd9af13[_0xa3fe('0x34')][_0xa3fe('0x55')])){throw new db[(_0xa3fe('0x57'))][(_0xa3fe('0x58'))](_0xa3fe('0x59'));}var _0x38b99={};var _0x16fb62={};_0x16fb62['model']=_['keys'](db[_[_0xa3fe('0x5a')](_0xd9af13['query'][_0xa3fe('0x55')][_0xa3fe('0x5b')]())+_0xa3fe('0x5c')][_0xa3fe('0x5d')]);_0x16fb62[_0xa3fe('0x34')]=_[_0xa3fe('0x35')](_0xd9af13[_0xa3fe('0x34')]);_0x16fb62[_0xa3fe('0x36')]=_['intersection'](_0x16fb62[_0xa3fe('0x32')],_0x16fb62[_0xa3fe('0x34')]);_0x38b99[_0xa3fe('0x38')]=_[_0xa3fe('0x37')](_0x16fb62['model'],qs[_0xa3fe('0x39')](_0xd9af13[_0xa3fe('0x34')][_0xa3fe('0x39')]));_0x38b99[_0xa3fe('0x38')]=_0x38b99[_0xa3fe('0x38')][_0xa3fe('0x5e')]?_0x38b99[_0xa3fe('0x38')]:_0x16fb62[_0xa3fe('0x32')];_0x38b99['limit']=qs[_0xa3fe('0x21')](_0xd9af13[_0xa3fe('0x34')][_0xa3fe('0x21')]);_0x38b99[_0xa3fe('0x20')]=qs[_0xa3fe('0x20')](_0xd9af13['query'][_0xa3fe('0x20')]);_0x38b99[_0xa3fe('0x3c')]=qs[_0xa3fe('0x3d')](_0xd9af13[_0xa3fe('0x34')]['sort']);_0x38b99[_0xa3fe('0x3f')]=qs[_0xa3fe('0x36')](_['pick'](_0xd9af13[_0xa3fe('0x34')],_0x16fb62[_0xa3fe('0x36')]));_0x38b99=_['merge']({},_0x38b99,_0xd9af13[_0xa3fe('0x42')]);return _0x1b1794[_0xa3fe('0x29')+_[_0xa3fe('0x5a')](_0xd9af13[_0xa3fe('0x34')][_0xa3fe('0x55')]['toLowerCase']())+'Queues'](_0x38b99);})['then'](respondWithResult(_0x5ed00a,null))[_0xa3fe('0x47')](handleError(_0x5ed00a,null));};exports['addQueues']=function(_0x34e8ee,_0xfb87df,_0x111341){return db['Team'][_0xa3fe('0x54')]({'where':{'id':_0x34e8ee[_0xa3fe('0x49')]['id']}})[_0xa3fe('0x28')](function(_0x275696){if(_0x275696){if(!_0x34e8ee[_0xa3fe('0x51')]['channel']||!utils['isValidChannel'](_0x34e8ee[_0xa3fe('0x51')]['channel'])){throw new db[(_0xa3fe('0x57'))]['ValidationError'](_0xa3fe('0x59'));}return _0x275696[_0xa3fe('0x5f')+_[_0xa3fe('0x5a')](_0x34e8ee[_0xa3fe('0x51')]['channel'][_0xa3fe('0x5b')]())+_0xa3fe('0x60')](_0x34e8ee[_0xa3fe('0x51')][_0xa3fe('0x61')]);}return null;})[_0xa3fe('0x28')](handleEntityNotFound(_0xfb87df,null))[_0xa3fe('0x28')](respondWithStatusCode(_0xfb87df,null))['catch'](handleError(_0xfb87df,null));};exports[_0xa3fe('0x62')]=function(_0x1540dc,_0xb4e956,_0x2f52c3){return db[_0xa3fe('0x30')]['findOne']({'where':{'id':_0x1540dc[_0xa3fe('0x49')]['id']}})['then'](function(_0x2e1b29){if(_0x2e1b29){if(!_0x1540dc[_0xa3fe('0x34')]['channel']||!utils[_0xa3fe('0x56')](_0x1540dc[_0xa3fe('0x34')][_0xa3fe('0x55')])){throw new db[(_0xa3fe('0x57'))][(_0xa3fe('0x58'))](_0xa3fe('0x59'));}return _0x2e1b29[_0xa3fe('0x63')+_[_0xa3fe('0x5a')](_0x1540dc[_0xa3fe('0x34')][_0xa3fe('0x55')]['toLowerCase']())+'Queues'](_0x1540dc['query'][_0xa3fe('0x61')]);}return null;})['then'](handleEntityNotFound(_0xb4e956,null))[_0xa3fe('0x28')](respondWithStatusCode(_0xb4e956,null))[_0xa3fe('0x47')](handleError(_0xb4e956,null));};exports['addAgents']=function(_0xe8033b,_0x16e0f2,_0x39407e){return db[_0xa3fe('0x30')][_0xa3fe('0x4a')]({'where':{'id':_0xe8033b[_0xa3fe('0x49')]['id']}})['then'](handleEntityNotFound(_0x16e0f2,null))[_0xa3fe('0x28')](function(_0x5d6707){if(_0x5d6707){var _0x47111d=['Voice',_0xa3fe('0x64'),_0xa3fe('0x65'),_0xa3fe('0x66'),'Fax',_0xa3fe('0x67'),'Whatsapp'];return BPromise[_0xa3fe('0x68')](_0x47111d,function(_0x290b35){return _0x5d6707[_0xa3fe('0x29')+_0x290b35+_0xa3fe('0x60')]({'attributes':['id','name']})[_0xa3fe('0x28')](function(_0x3c8b24){return BPromise[_0xa3fe('0x68')](_0x3c8b24,function(_0x215b2b){return _0x215b2b[_0xa3fe('0x69')](_0xe8033b[_0xa3fe('0x51')]['ids'])[_0xa3fe('0x28')](function(){if(_0x290b35==='Voice'){return db['User'][_0xa3fe('0x45')]({'where':{'id':_0xe8033b[_0xa3fe('0x51')][_0xa3fe('0x61')]},'attributes':['id','name','online',_0xa3fe('0x6a'),'interface'],'raw':!![]})[_0xa3fe('0x28')](function(_0x361f1e){return BPromise['each'](_['filter'](_0x361f1e,{'online':0x1}),function(_0x5d544f){return db[_0xa3fe('0x6b')][_0xa3fe('0x6c')]({'membername':_0x5d544f[_0xa3fe('0x2d')],'UserId':_0x5d544f['id'],'queue_name':_0x215b2b[_0xa3fe('0x2d')],'VoiceQueueId':_0x215b2b['id'],'interface':_[_0xa3fe('0x6d')](_0x5d544f[_0xa3fe('0x6e')])?util[_0xa3fe('0x6f')](_0xa3fe('0x70'),_0x5d544f[_0xa3fe('0x2d')]):_0x5d544f[_0xa3fe('0x6e')],'paused':_0x5d544f[_0xa3fe('0x6a')]||![],'penalty':0x0});});});}});});})[_0xa3fe('0x28')](function(){return _0x5d6707;});})['then'](function(){return _0x5d6707;});}})[_0xa3fe('0x28')](function(_0x479fc4){if(_0x479fc4){return _0x479fc4[_0xa3fe('0x69')](_0xe8033b['body'][_0xa3fe('0x61')],_[_0xa3fe('0x71')](_0xe8033b[_0xa3fe('0x51')],[_0xa3fe('0x61'),'id'])||{})[_0xa3fe('0x72')](function(_0xddebf2){for(var _0xe18e9b=0x0;_0xe18e9b<_0xe8033b[_0xa3fe('0x51')][_0xa3fe('0x61')]['length'];_0xe18e9b+=0x1){socket[_0xa3fe('0x73')](_0xa3fe('0x74'),{'UserId':_0xe8033b[_0xa3fe('0x51')]['ids'][_0xe18e9b],'TeamId':_0xe8033b['params']['id']});}return _0xddebf2;});}})[_0xa3fe('0x28')](respondWithResult(_0x16e0f2,null))[_0xa3fe('0x47')](handleError(_0x16e0f2,null));};exports['removeAgents']=function(_0xe9774e,_0x44bc7b,_0x1a8c23){return db[_0xa3fe('0x30')][_0xa3fe('0x4a')]({'where':{'id':_0xe9774e[_0xa3fe('0x49')]['id']}})[_0xa3fe('0x28')](handleEntityNotFound(_0x44bc7b,null))[_0xa3fe('0x28')](function(_0x258a73){if(_0x258a73){return BPromise[_0xa3fe('0x68')]([_0xa3fe('0x75'),'chat',_0xa3fe('0x76'),_0xa3fe('0x77'),_0xa3fe('0x78'),_0xa3fe('0x79'),_0xa3fe('0x7a')],function(_0x12577f){return _0x258a73[_0xa3fe('0x29')+_['capitalize'](_0x12577f)+_0xa3fe('0x60')]({'attributes':['id',_0xa3fe('0x2d')]})['then'](function(_0xdd2ed1){return BPromise['each'](_0xdd2ed1,function(_0x2933db){return _0x2933db[_0xa3fe('0x7b')](_0xe9774e[_0xa3fe('0x34')][_0xa3fe('0x61')])[_0xa3fe('0x28')](function(){if(_0x12577f===_0xa3fe('0x75')){return db['UserVoiceQueueRt'][_0xa3fe('0x52')]({'where':{'VoiceQueueId':_0x2933db['id'],'UserId':_0xe9774e[_0xa3fe('0x34')][_0xa3fe('0x61')]}});}});});})['then'](function(){return _0x258a73;});})[_0xa3fe('0x28')](function(){return _0x258a73;});}})['then'](function(_0x5b9f52){if(_0x5b9f52){return _0x5b9f52[_0xa3fe('0x7b')](_0xe9774e[_0xa3fe('0x34')][_0xa3fe('0x61')])[_0xa3fe('0x28')](function(){if(_[_0xa3fe('0x7c')](_0xe9774e['query'][_0xa3fe('0x61')])){for(var _0x5207b6=0x0;_0x5207b6<_0xe9774e['query'][_0xa3fe('0x61')][_0xa3fe('0x5e')];_0x5207b6+=0x1){socket[_0xa3fe('0x73')](_0xa3fe('0x7d'),{'UserId':Number(_0xe9774e[_0xa3fe('0x34')][_0xa3fe('0x61')][_0x5207b6]),'TeamId':Number(_0xe9774e['params']['id'])});}}else{socket[_0xa3fe('0x73')]('userTeam:remove',{'UserId':Number(_0xe9774e[_0xa3fe('0x34')][_0xa3fe('0x61')]),'TeamId':Number(_0xe9774e[_0xa3fe('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x44bc7b,null))['catch'](handleError(_0x44bc7b,null));};exports[_0xa3fe('0x7e')]=function(_0x366b37,_0x381ed9,_0x1a6ed3){var _0x5f3f7e={};var _0x341ed3={};var _0x1ea8fc;var _0x270aeb;return db[_0xa3fe('0x30')][_0xa3fe('0x54')]({'where':{'id':_0x366b37[_0xa3fe('0x49')]['id']}})[_0xa3fe('0x28')](handleEntityNotFound(_0x381ed9,null))[_0xa3fe('0x28')](function(_0x470b76){if(_0x470b76){_0x1ea8fc=_0x470b76;_0x341ed3[_0xa3fe('0x32')]=_['keys'](db[_0xa3fe('0x7f')][_0xa3fe('0x5d')]);_0x341ed3[_0xa3fe('0x34')]=_[_0xa3fe('0x35')](_0x366b37[_0xa3fe('0x34')]);_0x341ed3[_0xa3fe('0x36')]=_[_0xa3fe('0x37')](_0x341ed3['model'],_0x341ed3[_0xa3fe('0x34')]);_0x5f3f7e[_0xa3fe('0x38')]=_[_0xa3fe('0x37')](_0x341ed3[_0xa3fe('0x32')],qs[_0xa3fe('0x39')](_0x366b37[_0xa3fe('0x34')][_0xa3fe('0x39')]));_0x5f3f7e[_0xa3fe('0x38')]=_0x5f3f7e[_0xa3fe('0x38')][_0xa3fe('0x5e')]?_0x5f3f7e[_0xa3fe('0x38')]:_0x341ed3[_0xa3fe('0x32')];_0x5f3f7e[_0xa3fe('0x3c')]=qs[_0xa3fe('0x3d')](_0x366b37[_0xa3fe('0x34')][_0xa3fe('0x3d')]);_0x5f3f7e[_0xa3fe('0x3f')]=qs[_0xa3fe('0x36')](_[_0xa3fe('0x80')](_0x366b37[_0xa3fe('0x34')],_0x341ed3[_0xa3fe('0x36')]));if(_0x366b37['query'][_0xa3fe('0x3e')]){_0x5f3f7e[_0xa3fe('0x3f')]=_[_0xa3fe('0x40')](_0x5f3f7e[_0xa3fe('0x3f')],{'$or':_[_0xa3fe('0x33')](_0x5f3f7e['attributes'],function(_0x3d8ff7){var _0x45e8dd={};_0x45e8dd[_0x3d8ff7]={'$like':'%'+_0x366b37[_0xa3fe('0x34')][_0xa3fe('0x3e')]+'%'};return _0x45e8dd;})});}_0x5f3f7e=_[_0xa3fe('0x40')]({},_0x5f3f7e,_0x366b37[_0xa3fe('0x42')]);return _0x1ea8fc['getAgents'](_0x5f3f7e);}})[_0xa3fe('0x28')](function(_0x106756){if(_0x106756){_0x270aeb=_0x106756[_0xa3fe('0x5e')];if(!_0x366b37[_0xa3fe('0x34')][_0xa3fe('0x3a')](_0xa3fe('0x3b'))){_0x5f3f7e[_0xa3fe('0x21')]=qs[_0xa3fe('0x21')](_0x366b37['query'][_0xa3fe('0x21')]);_0x5f3f7e[_0xa3fe('0x20')]=qs[_0xa3fe('0x20')](_0x366b37[_0xa3fe('0x34')][_0xa3fe('0x20')]);}return _0x1ea8fc[_0xa3fe('0x7e')](_0x5f3f7e);}})[_0xa3fe('0x28')](function(_0x534f65){if(_0x534f65){return _0x534f65?{'count':_0x270aeb,'rows':_0x534f65}:null;}})['then'](respondWithResult(_0x381ed9,null))[_0xa3fe('0x47')](handleError(_0x381ed9,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 43d1b0b..7d6499b 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 _0xfa5c=['events','Team','save','update','remove','emit','exports'];(function(_0x4a9a1b,_0x3d6647){var _0x57b089=function(_0x2049e6){while(--_0x2049e6){_0x4a9a1b['push'](_0x4a9a1b['shift']());}};_0x57b089(++_0x3d6647);}(_0xfa5c,0xd2));var _0xcfa5=function(_0x3390df,_0x1a7605){_0x3390df=_0x3390df-0x0;var _0x1e7b87=_0xfa5c[_0x3390df];return _0x1e7b87;};'use strict';var EventEmitter=require(_0xcfa5('0x0'));var Team=require('../../mysqldb')['db'][_0xcfa5('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcfa5('0x2'),'afterUpdate':_0xcfa5('0x3'),'afterDestroy':_0xcfa5('0x4')};function emitEvent(_0xad7bf1){return function(_0x4817a4,_0x68c9d8,_0x2d3a36){TeamEvents[_0xcfa5('0x5')](_0xad7bf1+':'+_0x4817a4['id'],_0x4817a4);TeamEvents[_0xcfa5('0x5')](_0xad7bf1,_0x4817a4);_0x2d3a36(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xcfa5('0x6')]=TeamEvents; \ No newline at end of file +var _0xe6dc=['hook','exports','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x9d2ae9,_0xe43b7e){var _0x356d6f=function(_0x2c32cf){while(--_0x2c32cf){_0x9d2ae9['push'](_0x9d2ae9['shift']());}};_0x356d6f(++_0xe43b7e);}(_0xe6dc,0xbf));var _0xce6d=function(_0x2538ea,_0x2b06ab){_0x2538ea=_0x2538ea-0x0;var _0x861643=_0xe6dc[_0x2538ea];return _0x861643;};'use strict';var EventEmitter=require('events');var Team=require(_0xce6d('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xce6d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xce6d('0x2')};function emitEvent(_0x2b9ed0){return function(_0x38ccaf,_0x32b09d,_0x2c64da){TeamEvents[_0xce6d('0x3')](_0x2b9ed0+':'+_0x38ccaf['id'],_0x38ccaf);TeamEvents[_0xce6d('0x3')](_0x2b9ed0,_0x38ccaf);_0x2c64da(null);};}for(var e in events){if(events[_0xce6d('0x4')](e)){var event=events[e];Team[_0xce6d('0x5')](e,emitEvent(event));}}module[_0xce6d('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c8e4fd6..7d36d3b 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 _0x340b=['define','Team','teams','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3c45de,_0x1f0979){var _0x270350=function(_0x45f304){while(--_0x45f304){_0x3c45de['push'](_0x3c45de['shift']());}};_0x270350(++_0x1f0979);}(_0x340b,0xcf));var _0xb340=function(_0xefb6aa,_0x2af122){_0xefb6aa=_0xefb6aa-0x0;var _0x5e9867=_0x340b[_0xefb6aa];return _0x5e9867;};'use strict';var _=require(_0xb340('0x0'));var util=require('util');var logger=require(_0xb340('0x1'))('api');var moment=require(_0xb340('0x2'));var BPromise=require(_0xb340('0x3'));var rp=require(_0xb340('0x4'));var fs=require('fs');var path=require(_0xb340('0x5'));var rimraf=require(_0xb340('0x6'));var config=require(_0xb340('0x7'));var attributes=require('./team.attributes');module[_0xb340('0x8')]=function(_0x9e987d,_0x4f2332){return _0x9e987d[_0xb340('0x9')](_0xb340('0xa'),attributes,{'tableName':_0xb340('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7595=['teams','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','Team'];(function(_0x4c22ab,_0x16b105){var _0x28a653=function(_0x461fc9){while(--_0x461fc9){_0x4c22ab['push'](_0x4c22ab['shift']());}};_0x28a653(++_0x16b105);}(_0x7595,0x64));var _0x5759=function(_0x41c088,_0x155e0f){_0x41c088=_0x41c088-0x0;var _0x273b77=_0x7595[_0x41c088];return _0x273b77;};'use strict';var _=require('lodash');var util=require(_0x5759('0x0'));var logger=require(_0x5759('0x1'))(_0x5759('0x2'));var moment=require('moment');var BPromise=require(_0x5759('0x3'));var rp=require(_0x5759('0x4'));var fs=require('fs');var path=require(_0x5759('0x5'));var rimraf=require(_0x5759('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x5759('0x7')]=function(_0x273cf9,_0xc2c7fc){return _0x273cf9[_0x5759('0x8')](_0x5759('0x9'),attributes,{'tableName':_0x5759('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 865ce74..9652ae5 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 _0x4542=['../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4542,0x14a));var _0x2454=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4542[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x2454('0x0'));var util=require(_0x2454('0x1'));var moment=require(_0x2454('0x2'));var BPromise=require(_0x2454('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2454('0x4'))(_0x2454('0x5'));var config=require(_0x2454('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2454('0x7')][_0x2454('0x8')]({'port':0x232a});config[_0x2454('0x9')]=_[_0x2454('0xa')](config[_0x2454('0x9')],{'host':_0x2454('0xb'),'port':0x18eb});var socket=require(_0x2454('0xc'))(new Redis(config['redis']));require(_0x2454('0xd'))[_0x2454('0xe')](socket);function respondWithRpcPromise(_0x21ef2a,_0x36b7f4,_0x8eb78c){return new BPromise(function(_0x4310b9,_0x59c9e0){return client['request'](_0x21ef2a,_0x8eb78c)['then'](function(_0x23d603){logger[_0x2454('0xf')](_0x2454('0x10'),_0x36b7f4,_0x2454('0x11'));logger['debug'](_0x2454('0x12'),_0x36b7f4,'request\x20sent',JSON[_0x2454('0x13')](_0x23d603));if(_0x23d603[_0x2454('0x14')]){if(_0x23d603[_0x2454('0x14')]['code']===0x1f4){logger[_0x2454('0x14')](_0x2454('0x10'),_0x36b7f4,_0x23d603[_0x2454('0x14')]['message']);return _0x59c9e0(_0x23d603[_0x2454('0x14')][_0x2454('0x15')]);}logger[_0x2454('0x14')](_0x2454('0x10'),_0x36b7f4,_0x23d603['error']['message']);return _0x4310b9(_0x23d603[_0x2454('0x14')]['message']);}else{logger[_0x2454('0xf')](_0x2454('0x10'),_0x36b7f4,_0x2454('0x11'));_0x4310b9(_0x23d603[_0x2454('0x16')][_0x2454('0x15')]);}})[_0x2454('0x17')](function(_0x1471d5){logger[_0x2454('0x14')](_0x2454('0x10'),_0x36b7f4,_0x1471d5);_0x59c9e0(_0x1471d5);});});} \ No newline at end of file +var _0x2eff=['info','result','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','Team,\x20%s,\x20%s','message'];(function(_0x1a243c,_0x455768){var _0x147800=function(_0x4346f5){while(--_0x4346f5){_0x1a243c['push'](_0x1a243c['shift']());}};_0x147800(++_0x455768);}(_0x2eff,0x76));var _0xf2ef=function(_0x16e824,_0x23ab90){_0x16e824=_0x16e824-0x0;var _0x1745ea=_0x2eff[_0x16e824];return _0x1745ea;};'use strict';var _=require(_0xf2ef('0x0'));var util=require(_0xf2ef('0x1'));var moment=require(_0xf2ef('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf2ef('0x5'));var config=require(_0xf2ef('0x6'));var jayson=require(_0xf2ef('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xf2ef('0x8')]=_[_0xf2ef('0x9')](config['redis'],{'host':_0xf2ef('0xa'),'port':0x18eb});var socket=require(_0xf2ef('0xb'))(new Redis(config[_0xf2ef('0x8')]));require('./team.socket')[_0xf2ef('0xc')](socket);function respondWithRpcPromise(_0x4fdff9,_0x3359ed,_0x22336f){return new BPromise(function(_0x1ad5b9,_0x45e341){return client[_0xf2ef('0xd')](_0x4fdff9,_0x22336f)['then'](function(_0x1dbff0){logger['info']('Team,\x20%s,\x20%s',_0x3359ed,_0xf2ef('0xe'));logger['debug'](_0xf2ef('0xf'),_0x3359ed,_0xf2ef('0xe'),JSON['stringify'](_0x1dbff0));if(_0x1dbff0['error']){if(_0x1dbff0[_0xf2ef('0x10')][_0xf2ef('0x11')]===0x1f4){logger[_0xf2ef('0x10')](_0xf2ef('0x12'),_0x3359ed,_0x1dbff0['error'][_0xf2ef('0x13')]);return _0x45e341(_0x1dbff0['error'][_0xf2ef('0x13')]);}logger[_0xf2ef('0x10')](_0xf2ef('0x12'),_0x3359ed,_0x1dbff0[_0xf2ef('0x10')][_0xf2ef('0x13')]);return _0x1ad5b9(_0x1dbff0[_0xf2ef('0x10')]['message']);}else{logger[_0xf2ef('0x14')]('Team,\x20%s,\x20%s',_0x3359ed,_0xf2ef('0xe'));_0x1ad5b9(_0x1dbff0[_0xf2ef('0x15')][_0xf2ef('0x13')]);}})[_0xf2ef('0x16')](function(_0x1d2092){logger[_0xf2ef('0x10')]('Team,\x20%s,\x20%s',_0x3359ed,_0x1d2092);_0x45e341(_0x1d2092);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 89c8fc5..b3a9ca2 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 _0xaafc=['removeListener','length','save','remove','update','emit'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xaafc,0x176));var _0xcaaf=function(_0x4ea37d,_0x254048){_0x4ea37d=_0x4ea37d-0x0;var _0x49e7b6=_0xaafc[_0x4ea37d];return _0x49e7b6;};'use strict';var TeamEvents=require('./team.events');var events=[_0xcaaf('0x0'),_0xcaaf('0x1'),_0xcaaf('0x2')];function createListener(_0xaa122e,_0x58deea){return function(_0x3a9705){_0x58deea[_0xcaaf('0x3')](_0xaa122e,_0x3a9705);};}function removeListener(_0x4e9be3,_0x4a3b11){return function(){TeamEvents[_0xcaaf('0x4')](_0x4e9be3,_0x4a3b11);};}exports['register']=function(_0x291f15){for(var _0x54757a=0x0,_0x31e6bb=events[_0xcaaf('0x5')];_0x54757a<_0x31e6bb;_0x54757a++){var _0x22d1b2=events[_0x54757a];var _0xdccf0d=createListener('team:'+_0x22d1b2,_0x291f15);TeamEvents['on'](_0x22d1b2,_0xdccf0d);}}; \ No newline at end of file +var _0x2709=['length','./team.events','remove','update','emit','removeListener','register'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2709,0x189));var _0x9270=function(_0x1cfa2b,_0x45911a){_0x1cfa2b=_0x1cfa2b-0x0;var _0x92c2b=_0x2709[_0x1cfa2b];return _0x92c2b;};'use strict';var TeamEvents=require(_0x9270('0x0'));var events=['save',_0x9270('0x1'),_0x9270('0x2')];function createListener(_0x5e755b,_0x1d935b){return function(_0x4f5b2e){_0x1d935b[_0x9270('0x3')](_0x5e755b,_0x4f5b2e);};}function removeListener(_0x26bdf5,_0x326c2a){return function(){TeamEvents[_0x9270('0x4')](_0x26bdf5,_0x326c2a);};}exports[_0x9270('0x5')]=function(_0x446f78){for(var _0x4c71c5=0x0,_0x421b84=events[_0x9270('0x6')];_0x4c71c5<_0x421b84;_0x4c71c5++){var _0x1927c=events[_0x4c71c5];var _0x28e580=createListener('team:'+_0x1927c,_0x446f78);TeamEvents['on'](_0x1927c,_0x28e580);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 8383570..32912e4 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 _0x994b=['post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./template.controller','isAuthenticated','/:id','show'];(function(_0x53f107,_0x5c244f){var _0x55e922=function(_0xf3c644){while(--_0xf3c644){_0x53f107['push'](_0x53f107['shift']());}};_0x55e922(++_0x5c244f);}(_0x994b,0xf4));var _0xb994=function(_0x3884b7,_0x37682d){_0x3884b7=_0x3884b7-0x0;var _0x598253=_0x994b[_0x3884b7];return _0x598253;};'use strict';var multer=require(_0xb994('0x0'));var util=require(_0xb994('0x1'));var path=require(_0xb994('0x2'));var timeout=require('connect-timeout');var express=require(_0xb994('0x3'));var router=express[_0xb994('0x4')]();var auth=require(_0xb994('0x5'));var interaction=require(_0xb994('0x6'));var config=require('../../config/environment');var controller=require(_0xb994('0x7'));router['get']('/',auth[_0xb994('0x8')](),controller['index']);router['get'](_0xb994('0x9'),auth[_0xb994('0x8')](),controller[_0xb994('0xa')]);router[_0xb994('0xb')]('/',auth['isAuthenticated'](),controller[_0xb994('0xc')]);router[_0xb994('0xd')](_0xb994('0x9'),auth['isAuthenticated'](),controller[_0xb994('0xe')]);router[_0xb994('0xf')]('/:id',auth[_0xb994('0x8')](),controller[_0xb994('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4cbf=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./template.controller','isAuthenticated','index','get','/:id','create','put','update','exports','multer','util'];(function(_0x14e3f9,_0x1b27f8){var _0x287c94=function(_0x54ad34){while(--_0x54ad34){_0x14e3f9['push'](_0x14e3f9['shift']());}};_0x287c94(++_0x1b27f8);}(_0x4cbf,0xb9));var _0xf4cb=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x4cbf[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0xf4cb('0x0'));var util=require(_0xf4cb('0x1'));var path=require(_0xf4cb('0x2'));var timeout=require(_0xf4cb('0x3'));var express=require(_0xf4cb('0x4'));var router=express[_0xf4cb('0x5')]();var auth=require(_0xf4cb('0x6'));var interaction=require(_0xf4cb('0x7'));var config=require('../../config/environment');var controller=require(_0xf4cb('0x8'));router['get']('/',auth[_0xf4cb('0x9')](),controller[_0xf4cb('0xa')]);router[_0xf4cb('0xb')](_0xf4cb('0xc'),auth[_0xf4cb('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf4cb('0xd')]);router[_0xf4cb('0xe')](_0xf4cb('0xc'),auth['isAuthenticated'](),controller[_0xf4cb('0xf')]);router['delete'](_0xf4cb('0xc'),auth[_0xf4cb('0x9')](),controller['destroy']);module[_0xf4cb('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 45396ff..773c0ec 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 _0x93e9=['sequelize','exports','STRING','TEXT'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x93e9,0xcc));var _0x993e=function(_0x37fbfa,_0xfc2d47){_0x37fbfa=_0x37fbfa-0x0;var _0x55296f=_0x93e9[_0x37fbfa];return _0x55296f;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'name':{'type':Sequelize[_0x993e('0x2')]},'description':{'type':Sequelize[_0x993e('0x2')]},'html':{'type':Sequelize[_0x993e('0x3')]}}; \ No newline at end of file +var _0xf630=['sequelize','exports','STRING','TEXT'];(function(_0x5d5a09,_0x11860){var _0x582d42=function(_0x36260c){while(--_0x36260c){_0x5d5a09['push'](_0x5d5a09['shift']());}};_0x582d42(++_0x11860);}(_0xf630,0xc8));var _0x0f63=function(_0x486462,_0x1e67a2){_0x486462=_0x486462-0x0;var _0x4e18bf=_0xf630[_0x486462];return _0x4e18bf;};'use strict';var Sequelize=require(_0x0f63('0x0'));module[_0x0f63('0x1')]={'name':{'type':Sequelize[_0x0f63('0x2')]},'description':{'type':Sequelize[_0x0f63('0x2')]},'html':{'type':Sequelize[_0x0f63('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c81d378..7389bee 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 _0x1f10=['stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','then','get','Templates','UserProfileResource','destroy','error'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x1f10,0x12a));var _0x01f1=function(_0x18dfbd,_0x575eb8){_0x18dfbd=_0x18dfbd-0x0;var _0x3e63bc=_0x1f10[_0x18dfbd];return _0x3e63bc;};'use strict';var pdf=require(_0x01f1('0x0'));var emlformat=require(_0x01f1('0x1'));var rimraf=require(_0x01f1('0x2'));var zipdir=require(_0x01f1('0x3'));var jsonpatch=require(_0x01f1('0x4'));var rp=require('request-promise');var moment=require(_0x01f1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x01f1('0x6'));var util=require(_0x01f1('0x7'));var path=require(_0x01f1('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x01f1('0x9'));var fs=require('fs');var _=require(_0x01f1('0xa'));var squel=require(_0x01f1('0xb'));var crypto=require('crypto');var jsforce=require(_0x01f1('0xc'));var deskjs=require(_0x01f1('0xd'));var toCsv=require(_0x01f1('0xe'));var querystring=require(_0x01f1('0xf'));var Papa=require(_0x01f1('0x10'));var Redis=require(_0x01f1('0x11'));var authService=require(_0x01f1('0x12'));var qs=require(_0x01f1('0x13'));var as=require(_0x01f1('0x14'));var hardwareService=require(_0x01f1('0x15'));var logger=require('../../config/logger')(_0x01f1('0x16'));var utils=require(_0x01f1('0x17'));var config=require(_0x01f1('0x18'));var db=require(_0x01f1('0x19'))['db'];function respondWithStatusCode(_0xd8ba1a,_0x262a75){_0x262a75=_0x262a75||0xcc;return function(_0x2aee3a){if(_0x2aee3a){return _0xd8ba1a[_0x01f1('0x1a')](_0x262a75);}return _0xd8ba1a[_0x01f1('0x1b')](_0x262a75)[_0x01f1('0x1c')]();};}function respondWithResult(_0x148728,_0x4a59fb){_0x4a59fb=_0x4a59fb||0xc8;return function(_0x4a8908){if(_0x4a8908){return _0x148728[_0x01f1('0x1b')](_0x4a59fb)[_0x01f1('0x1d')](_0x4a8908);}};}function respondWithFilteredResult(_0x2980c7,_0x541c5a){return function(_0x4a020d){if(_0x4a020d){var _0x2c7941=_0x4a020d['count'],_0x1a40fd=_0x541c5a['offset'],_0xf82ac6=_0x541c5a[_0x01f1('0x1e')]+_0x541c5a[_0x01f1('0x1f')],_0x155435;if(_0xf82ac6>=_0x2c7941){_0xf82ac6=_0x2c7941;_0x155435=0xc8;}else{_0x155435=0xce;}_0x2980c7['status'](_0x155435);return _0x2980c7['set'](_0x01f1('0x20'),_0x1a40fd+'-'+_0xf82ac6+'/'+_0x2c7941)['json'](_0x4a020d);}return null;};}function patchUpdates(_0x2cf7b6){return function(_0x4ec3da){try{jsonpatch[_0x01f1('0x21')](_0x4ec3da,_0x2cf7b6,!![]);}catch(_0x32039a){return BPromise[_0x01f1('0x22')](_0x32039a);}return _0x4ec3da['save']();};}function saveUpdates(_0x5548b1,_0x483084){return function(_0x5e840b){if(_0x5e840b){return _0x5e840b[_0x01f1('0x23')](_0x5548b1)[_0x01f1('0x24')](function(_0x9e61ec){return _0x9e61ec;});}return null;};}function removeEntity(_0xc41636,_0x563c85){return function(_0x4942f7){if(_0x4942f7){return _0x4942f7['destroy']()[_0x01f1('0x24')](function(){var _0xa0c5e4=_0x4942f7[_0x01f1('0x25')]({'plain':!![]});var _0x4a4c9d=_0x01f1('0x26');return db[_0x01f1('0x27')][_0x01f1('0x28')]({'where':{'type':_0x4a4c9d,'resourceId':_0xa0c5e4['id']}})['then'](function(){return _0x4942f7;});})['then'](function(){_0xc41636[_0x01f1('0x1b')](0xcc)[_0x01f1('0x1c')]();});}};}function handleEntityNotFound(_0x11bb12,_0x5c39a8){return function(_0x2ef5b1){if(!_0x2ef5b1){_0x11bb12[_0x01f1('0x1a')](0x194);}return _0x2ef5b1;};}function handleError(_0xdebfb,_0x365e11){_0x365e11=_0x365e11||0x1f4;return function(_0x229714){logger[_0x01f1('0x29')](_0x229714[_0x01f1('0x2a')]);if(_0x229714[_0x01f1('0x2b')]){delete _0x229714[_0x01f1('0x2b')];}_0xdebfb[_0x01f1('0x1b')](_0x365e11)[_0x01f1('0x2c')](_0x229714);};}exports[_0x01f1('0x2d')]=function(_0x501817,_0x3312d9){var _0x40ed27={},_0x1315c0={},_0x1bec6c={'count':0x0,'rows':[]};var _0x18b3b0=_[_0x01f1('0x2e')](db[_0x01f1('0x2f')][_0x01f1('0x30')],function(_0x1a11b4){return{'name':_0x1a11b4[_0x01f1('0x31')],'type':_0x1a11b4[_0x01f1('0x32')][_0x01f1('0x33')]};});_0x1315c0[_0x01f1('0x34')]=_['map'](_0x18b3b0,_0x01f1('0x2b'));_0x1315c0[_0x01f1('0x35')]=_[_0x01f1('0x36')](_0x501817[_0x01f1('0x35')]);_0x1315c0[_0x01f1('0x37')]=_['intersection'](_0x1315c0[_0x01f1('0x34')],_0x1315c0[_0x01f1('0x35')]);_0x40ed27[_0x01f1('0x38')]=_[_0x01f1('0x39')](_0x1315c0[_0x01f1('0x34')],qs[_0x01f1('0x3a')](_0x501817[_0x01f1('0x35')][_0x01f1('0x3a')]));_0x40ed27[_0x01f1('0x38')]=_0x40ed27[_0x01f1('0x38')][_0x01f1('0x3b')]?_0x40ed27['attributes']:_0x1315c0['model'];if(!_0x501817[_0x01f1('0x35')]['hasOwnProperty'](_0x01f1('0x3c'))){_0x40ed27[_0x01f1('0x1f')]=qs[_0x01f1('0x1f')](_0x501817['query'][_0x01f1('0x1f')]);_0x40ed27['offset']=qs[_0x01f1('0x1e')](_0x501817[_0x01f1('0x35')][_0x01f1('0x1e')]);}_0x40ed27[_0x01f1('0x3d')]=qs['sort'](_0x501817[_0x01f1('0x35')][_0x01f1('0x3e')]);_0x40ed27['where']=qs[_0x01f1('0x37')](_[_0x01f1('0x3f')](_0x501817[_0x01f1('0x35')],_0x1315c0[_0x01f1('0x37')]),_0x18b3b0);if(_0x501817[_0x01f1('0x35')][_0x01f1('0x40')]){_0x40ed27[_0x01f1('0x41')]=_[_0x01f1('0x42')](_0x40ed27[_0x01f1('0x41')],{'$or':_[_0x01f1('0x2e')](_0x18b3b0,function(_0x598101){if(_0x598101[_0x01f1('0x32')]!==_0x01f1('0x43')){var _0x40dd44={};_0x40dd44[_0x598101['name']]={'$like':'%'+_0x501817[_0x01f1('0x35')][_0x01f1('0x40')]+'%'};return _0x40dd44;}})});}_0x40ed27=_[_0x01f1('0x42')]({},_0x40ed27,_0x501817[_0x01f1('0x44')]);var _0x294e49={'where':_0x40ed27[_0x01f1('0x41')]};return db[_0x01f1('0x2f')][_0x01f1('0x45')](_0x294e49)[_0x01f1('0x24')](function(_0x2329f8){_0x1bec6c[_0x01f1('0x45')]=_0x2329f8;if(_0x501817[_0x01f1('0x35')][_0x01f1('0x46')]){_0x40ed27[_0x01f1('0x47')]=[{'all':!![]}];}return db[_0x01f1('0x2f')][_0x01f1('0x48')](_0x40ed27);})[_0x01f1('0x24')](function(_0x23805b){_0x1bec6c[_0x01f1('0x49')]=_0x23805b;return _0x1bec6c;})[_0x01f1('0x24')](respondWithFilteredResult(_0x3312d9,_0x40ed27))[_0x01f1('0x4a')](handleError(_0x3312d9,null));};exports[_0x01f1('0x4b')]=function(_0x51b459,_0x104667){var _0x1622e1={'raw':!![],'where':{'id':_0x51b459[_0x01f1('0x4c')]['id']}},_0x421c7d={};_0x421c7d[_0x01f1('0x34')]=_[_0x01f1('0x36')](db[_0x01f1('0x2f')][_0x01f1('0x30')]);_0x421c7d[_0x01f1('0x35')]=_[_0x01f1('0x36')](_0x51b459[_0x01f1('0x35')]);_0x421c7d[_0x01f1('0x37')]=_[_0x01f1('0x39')](_0x421c7d[_0x01f1('0x34')],_0x421c7d[_0x01f1('0x35')]);_0x1622e1[_0x01f1('0x38')]=_[_0x01f1('0x39')](_0x421c7d[_0x01f1('0x34')],qs[_0x01f1('0x3a')](_0x51b459[_0x01f1('0x35')]['fields']));_0x1622e1[_0x01f1('0x38')]=_0x1622e1[_0x01f1('0x38')]['length']?_0x1622e1['attributes']:_0x421c7d['model'];if(_0x51b459['query'][_0x01f1('0x46')]){_0x1622e1[_0x01f1('0x47')]=[{'all':!![]}];}_0x1622e1=_[_0x01f1('0x42')]({},_0x1622e1,_0x51b459[_0x01f1('0x44')]);return db[_0x01f1('0x2f')]['find'](_0x1622e1)[_0x01f1('0x24')](handleEntityNotFound(_0x104667,null))['then'](respondWithResult(_0x104667,null))[_0x01f1('0x4a')](handleError(_0x104667,null));};exports[_0x01f1('0x4d')]=function(_0x5d13f6,_0x47f814){return db[_0x01f1('0x2f')][_0x01f1('0x4d')](_0x5d13f6['body'],{})[_0x01f1('0x24')](function(_0x5eaa2e){var _0x302703=_0x5d13f6[_0x01f1('0x4e')][_0x01f1('0x25')]({'plain':!![]});if(!_0x302703)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x302703[_0x01f1('0x4f')]===_0x01f1('0x4e')){var _0x5d9228=_0x5eaa2e[_0x01f1('0x25')]({'plain':!![]});var _0x24e875=_0x01f1('0x26');return db[_0x01f1('0x50')][_0x01f1('0x51')]({'where':{'name':_0x24e875,'userProfileId':_0x302703['userProfileId']},'raw':!![]})[_0x01f1('0x24')](function(_0x467eb5){if(_0x467eb5&&_0x467eb5[_0x01f1('0x52')]===0x0){return db[_0x01f1('0x27')][_0x01f1('0x4d')]({'name':_0x5d9228[_0x01f1('0x2b')],'resourceId':_0x5d9228['id'],'type':_0x467eb5['name'],'sectionId':_0x467eb5['id']},{})[_0x01f1('0x24')](function(){return _0x5eaa2e;});}else{return _0x5eaa2e;}})[_0x01f1('0x4a')](function(_0x445392){logger[_0x01f1('0x29')](_0x01f1('0x53'),_0x445392);throw _0x445392;});}return _0x5eaa2e;})[_0x01f1('0x24')](respondWithResult(_0x47f814,0xc9))['catch'](handleError(_0x47f814,null));};exports[_0x01f1('0x23')]=function(_0x4c4e45,_0x72c155){if(_0x4c4e45[_0x01f1('0x54')]['id']){delete _0x4c4e45[_0x01f1('0x54')]['id'];}return db[_0x01f1('0x2f')][_0x01f1('0x51')]({'where':{'id':_0x4c4e45[_0x01f1('0x4c')]['id']}})[_0x01f1('0x24')](handleEntityNotFound(_0x72c155,null))[_0x01f1('0x24')](saveUpdates(_0x4c4e45['body'],null))['then'](respondWithResult(_0x72c155,null))['catch'](handleError(_0x72c155,null));};exports['destroy']=function(_0x4aa848,_0x1f8c0a){return db[_0x01f1('0x2f')]['find']({'where':{'id':_0x4aa848[_0x01f1('0x4c')]['id']}})[_0x01f1('0x24')](handleEntityNotFound(_0x1f8c0a,null))['then'](removeEntity(_0x1f8c0a,null))[_0x01f1('0x4a')](handleError(_0x1f8c0a,null));}; \ No newline at end of file +var _0x4e29=['request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','then','Templates','UserProfileResource','destroy','error','name','send','index','Template','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x4e29,0xa5));var _0x94e2=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0x4e29[_0x35d59c];return _0x18cd27;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x94e2('0x0'));var zipdir=require(_0x94e2('0x1'));var jsonpatch=require(_0x94e2('0x2'));var rp=require(_0x94e2('0x3'));var moment=require(_0x94e2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x94e2('0x5'));var util=require(_0x94e2('0x6'));var path=require(_0x94e2('0x7'));var sox=require('sox');var csv=require(_0x94e2('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x94e2('0x9'));var squel=require(_0x94e2('0xa'));var crypto=require(_0x94e2('0xb'));var jsforce=require(_0x94e2('0xc'));var deskjs=require(_0x94e2('0xd'));var toCsv=require(_0x94e2('0x8'));var querystring=require(_0x94e2('0xe'));var Papa=require(_0x94e2('0xf'));var Redis=require(_0x94e2('0x10'));var authService=require(_0x94e2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94e2('0x12'));var logger=require(_0x94e2('0x13'))(_0x94e2('0x14'));var utils=require(_0x94e2('0x15'));var config=require(_0x94e2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x247103,_0x2c5a47){_0x2c5a47=_0x2c5a47||0xcc;return function(_0xf2f17a){if(_0xf2f17a){return _0x247103[_0x94e2('0x17')](_0x2c5a47);}return _0x247103['status'](_0x2c5a47)[_0x94e2('0x18')]();};}function respondWithResult(_0x5157a1,_0x3b4630){_0x3b4630=_0x3b4630||0xc8;return function(_0x204df1){if(_0x204df1){return _0x5157a1[_0x94e2('0x19')](_0x3b4630)[_0x94e2('0x1a')](_0x204df1);}};}function respondWithFilteredResult(_0x37eef0,_0x2dd3b5){return function(_0x2523c5){if(_0x2523c5){var _0x20478a=_0x2523c5[_0x94e2('0x1b')],_0x53a2f6=_0x2dd3b5[_0x94e2('0x1c')],_0x4c8391=_0x2dd3b5[_0x94e2('0x1c')]+_0x2dd3b5[_0x94e2('0x1d')],_0x6cb643;if(_0x4c8391>=_0x20478a){_0x4c8391=_0x20478a;_0x6cb643=0xc8;}else{_0x6cb643=0xce;}_0x37eef0[_0x94e2('0x19')](_0x6cb643);return _0x37eef0[_0x94e2('0x1e')]('Content-Range',_0x53a2f6+'-'+_0x4c8391+'/'+_0x20478a)[_0x94e2('0x1a')](_0x2523c5);}return null;};}function patchUpdates(_0x49b410){return function(_0x2a7af5){try{jsonpatch[_0x94e2('0x1f')](_0x2a7af5,_0x49b410,!![]);}catch(_0x279f0c){return BPromise[_0x94e2('0x20')](_0x279f0c);}return _0x2a7af5['save']();};}function saveUpdates(_0x15074a,_0x59b845){return function(_0x30cde7){if(_0x30cde7){return _0x30cde7[_0x94e2('0x21')](_0x15074a)[_0x94e2('0x22')](function(_0x24aa47){return _0x24aa47;});}return null;};}function removeEntity(_0x35ed67,_0x459f95){return function(_0x41dc30){if(_0x41dc30){return _0x41dc30['destroy']()[_0x94e2('0x22')](function(){var _0x50fb06=_0x41dc30['get']({'plain':!![]});var _0x8d7fbe=_0x94e2('0x23');return db[_0x94e2('0x24')][_0x94e2('0x25')]({'where':{'type':_0x8d7fbe,'resourceId':_0x50fb06['id']}})['then'](function(){return _0x41dc30;});})[_0x94e2('0x22')](function(){_0x35ed67['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a101,_0x3beaf2){return function(_0x362428){if(!_0x362428){_0x45a101['sendStatus'](0x194);}return _0x362428;};}function handleError(_0xd1dd5e,_0x40fccd){_0x40fccd=_0x40fccd||0x1f4;return function(_0x198c50){logger[_0x94e2('0x26')](_0x198c50['stack']);if(_0x198c50[_0x94e2('0x27')]){delete _0x198c50['name'];}_0xd1dd5e[_0x94e2('0x19')](_0x40fccd)[_0x94e2('0x28')](_0x198c50);};}exports[_0x94e2('0x29')]=function(_0xe2a7f4,_0x44cf0c){var _0x395fcf={},_0x1fd7b8={},_0x374228={'count':0x0,'rows':[]};var _0x578949=_['map'](db[_0x94e2('0x2a')][_0x94e2('0x2b')],function(_0x15298c){return{'name':_0x15298c[_0x94e2('0x2c')],'type':_0x15298c['type'][_0x94e2('0x2d')]};});_0x1fd7b8[_0x94e2('0x2e')]=_[_0x94e2('0x2f')](_0x578949,_0x94e2('0x27'));_0x1fd7b8[_0x94e2('0x30')]=_[_0x94e2('0x31')](_0xe2a7f4[_0x94e2('0x30')]);_0x1fd7b8[_0x94e2('0x32')]=_[_0x94e2('0x33')](_0x1fd7b8[_0x94e2('0x2e')],_0x1fd7b8[_0x94e2('0x30')]);_0x395fcf['attributes']=_[_0x94e2('0x33')](_0x1fd7b8[_0x94e2('0x2e')],qs[_0x94e2('0x34')](_0xe2a7f4[_0x94e2('0x30')]['fields']));_0x395fcf['attributes']=_0x395fcf['attributes'][_0x94e2('0x35')]?_0x395fcf[_0x94e2('0x36')]:_0x1fd7b8[_0x94e2('0x2e')];if(!_0xe2a7f4['query'][_0x94e2('0x37')](_0x94e2('0x38'))){_0x395fcf[_0x94e2('0x1d')]=qs[_0x94e2('0x1d')](_0xe2a7f4[_0x94e2('0x30')][_0x94e2('0x1d')]);_0x395fcf[_0x94e2('0x1c')]=qs[_0x94e2('0x1c')](_0xe2a7f4[_0x94e2('0x30')]['offset']);}_0x395fcf[_0x94e2('0x39')]=qs[_0x94e2('0x3a')](_0xe2a7f4[_0x94e2('0x30')][_0x94e2('0x3a')]);_0x395fcf[_0x94e2('0x3b')]=qs[_0x94e2('0x32')](_[_0x94e2('0x3c')](_0xe2a7f4[_0x94e2('0x30')],_0x1fd7b8[_0x94e2('0x32')]),_0x578949);if(_0xe2a7f4['query'][_0x94e2('0x3d')]){_0x395fcf['where']=_[_0x94e2('0x3e')](_0x395fcf['where'],{'$or':_[_0x94e2('0x2f')](_0x578949,function(_0xb432d6){if(_0xb432d6[_0x94e2('0x3f')]!==_0x94e2('0x40')){var _0x5281f4={};_0x5281f4[_0xb432d6['name']]={'$like':'%'+_0xe2a7f4['query'][_0x94e2('0x3d')]+'%'};return _0x5281f4;}})});}_0x395fcf=_[_0x94e2('0x3e')]({},_0x395fcf,_0xe2a7f4[_0x94e2('0x41')]);var _0x3035f8={'where':_0x395fcf[_0x94e2('0x3b')]};return db[_0x94e2('0x2a')][_0x94e2('0x1b')](_0x3035f8)[_0x94e2('0x22')](function(_0x529d0b){_0x374228['count']=_0x529d0b;if(_0xe2a7f4[_0x94e2('0x30')][_0x94e2('0x42')]){_0x395fcf[_0x94e2('0x43')]=[{'all':!![]}];}return db[_0x94e2('0x2a')][_0x94e2('0x44')](_0x395fcf);})[_0x94e2('0x22')](function(_0x52880c){_0x374228[_0x94e2('0x45')]=_0x52880c;return _0x374228;})[_0x94e2('0x22')](respondWithFilteredResult(_0x44cf0c,_0x395fcf))[_0x94e2('0x46')](handleError(_0x44cf0c,null));};exports[_0x94e2('0x47')]=function(_0x2476e4,_0x333509){var _0x5ed29c={'raw':!![],'where':{'id':_0x2476e4['params']['id']}},_0x6ebf0c={};_0x6ebf0c[_0x94e2('0x2e')]=_[_0x94e2('0x31')](db[_0x94e2('0x2a')][_0x94e2('0x2b')]);_0x6ebf0c[_0x94e2('0x30')]=_[_0x94e2('0x31')](_0x2476e4[_0x94e2('0x30')]);_0x6ebf0c[_0x94e2('0x32')]=_[_0x94e2('0x33')](_0x6ebf0c[_0x94e2('0x2e')],_0x6ebf0c[_0x94e2('0x30')]);_0x5ed29c[_0x94e2('0x36')]=_[_0x94e2('0x33')](_0x6ebf0c['model'],qs[_0x94e2('0x34')](_0x2476e4[_0x94e2('0x30')][_0x94e2('0x34')]));_0x5ed29c[_0x94e2('0x36')]=_0x5ed29c[_0x94e2('0x36')]['length']?_0x5ed29c[_0x94e2('0x36')]:_0x6ebf0c[_0x94e2('0x2e')];if(_0x2476e4[_0x94e2('0x30')][_0x94e2('0x42')]){_0x5ed29c[_0x94e2('0x43')]=[{'all':!![]}];}_0x5ed29c=_[_0x94e2('0x3e')]({},_0x5ed29c,_0x2476e4['options']);return db['Template'][_0x94e2('0x48')](_0x5ed29c)[_0x94e2('0x22')](handleEntityNotFound(_0x333509,null))['then'](respondWithResult(_0x333509,null))[_0x94e2('0x46')](handleError(_0x333509,null));};exports[_0x94e2('0x49')]=function(_0x2abf4c,_0x50ba3a){return db[_0x94e2('0x2a')][_0x94e2('0x49')](_0x2abf4c[_0x94e2('0x4a')],{})[_0x94e2('0x22')](function(_0x3cddac){var _0x3a8c95=_0x2abf4c[_0x94e2('0x4b')][_0x94e2('0x4c')]({'plain':!![]});if(!_0x3a8c95)throw new Error(_0x94e2('0x4d'));if(_0x3a8c95[_0x94e2('0x4e')]===_0x94e2('0x4b')){var _0xc1c670=_0x3cddac['get']({'plain':!![]});var _0x451093=_0x94e2('0x23');return db[_0x94e2('0x4f')][_0x94e2('0x48')]({'where':{'name':_0x451093,'userProfileId':_0x3a8c95[_0x94e2('0x50')]},'raw':!![]})['then'](function(_0x1fa7cd){if(_0x1fa7cd&&_0x1fa7cd[_0x94e2('0x51')]===0x0){return db['UserProfileResource'][_0x94e2('0x49')]({'name':_0xc1c670['name'],'resourceId':_0xc1c670['id'],'type':_0x1fa7cd[_0x94e2('0x27')],'sectionId':_0x1fa7cd['id']},{})['then'](function(){return _0x3cddac;});}else{return _0x3cddac;}})[_0x94e2('0x46')](function(_0x208a86){logger[_0x94e2('0x26')](_0x94e2('0x52'),_0x208a86);throw _0x208a86;});}return _0x3cddac;})[_0x94e2('0x22')](respondWithResult(_0x50ba3a,0xc9))[_0x94e2('0x46')](handleError(_0x50ba3a,null));};exports[_0x94e2('0x21')]=function(_0x1befb7,_0x254696){if(_0x1befb7[_0x94e2('0x4a')]['id']){delete _0x1befb7[_0x94e2('0x4a')]['id'];}return db[_0x94e2('0x2a')][_0x94e2('0x48')]({'where':{'id':_0x1befb7[_0x94e2('0x53')]['id']}})[_0x94e2('0x22')](handleEntityNotFound(_0x254696,null))['then'](saveUpdates(_0x1befb7['body'],null))[_0x94e2('0x22')](respondWithResult(_0x254696,null))[_0x94e2('0x46')](handleError(_0x254696,null));};exports['destroy']=function(_0x4d62fa,_0x4a02f5){return db[_0x94e2('0x2a')][_0x94e2('0x48')]({'where':{'id':_0x4d62fa[_0x94e2('0x53')]['id']}})[_0x94e2('0x22')](handleEntityNotFound(_0x4a02f5,null))[_0x94e2('0x22')](removeEntity(_0x4a02f5,null))[_0x94e2('0x46')](handleError(_0x4a02f5,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 6ca60e4..91f2a4d 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 _0x896e=['lodash','util','bluebird','request-promise','path','../../config/environment','./template.attributes','exports','define','Template'];(function(_0x4d8d0f,_0x53a0e9){var _0x212d10=function(_0x72d9d8){while(--_0x72d9d8){_0x4d8d0f['push'](_0x4d8d0f['shift']());}};_0x212d10(++_0x53a0e9);}(_0x896e,0x6e));var _0xe896=function(_0x10d7b0,_0x27e100){_0x10d7b0=_0x10d7b0-0x0;var _0x2f7c78=_0x896e[_0x10d7b0];return _0x2f7c78;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe896('0x2'));var rp=require(_0xe896('0x3'));var fs=require('fs');var path=require(_0xe896('0x4'));var rimraf=require('rimraf');var config=require(_0xe896('0x5'));var attributes=require(_0xe896('0x6'));module[_0xe896('0x7')]=function(_0x237373,_0x33c68d){return _0x237373[_0xe896('0x8')](_0xe896('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7711=['rimraf','./template.attributes','exports','define','Template','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x259706,_0x2937c9){var _0x1524a8=function(_0x29fac1){while(--_0x29fac1){_0x259706['push'](_0x259706['shift']());}};_0x1524a8(++_0x2937c9);}(_0x7711,0xf7));var _0x1771=function(_0x29c5cc,_0x141127){_0x29c5cc=_0x29c5cc-0x0;var _0x402af4=_0x7711[_0x29c5cc];return _0x402af4;};'use strict';var _=require(_0x1771('0x0'));var util=require(_0x1771('0x1'));var logger=require(_0x1771('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1771('0x3'));var rp=require(_0x1771('0x4'));var fs=require('fs');var path=require(_0x1771('0x5'));var rimraf=require(_0x1771('0x6'));var config=require('../../config/environment');var attributes=require(_0x1771('0x7'));module[_0x1771('0x8')]=function(_0x509859,_0x5eef6f){return _0x509859[_0x1771('0x9')](_0x1771('0xa'),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 50bef6c..b28598c 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 _0xcabd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','code','message','Template,\x20%s,\x20%s','result','catch','findAll','options','where','attributes','map','include','model','GetTemplate','lodash','util','bluebird','randomstring'];(function(_0x21f19a,_0x12adef){var _0x14edb2=function(_0x2156f4){while(--_0x2156f4){_0x21f19a['push'](_0x21f19a['shift']());}};_0x14edb2(++_0x12adef);}(_0xcabd,0x1bc));var _0xdcab=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xcabd[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require(_0xdcab('0x0'));var util=require(_0xdcab('0x1'));var moment=require('moment');var BPromise=require(_0xdcab('0x2'));var rs=require(_0xdcab('0x3'));var fs=require('fs');var Redis=require(_0xdcab('0x4'));var db=require(_0xdcab('0x5'))['db'];var utils=require(_0xdcab('0x6'));var logger=require(_0xdcab('0x7'))(_0xdcab('0x8'));var config=require(_0xdcab('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdcab('0xa')][_0xdcab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b6618,_0x45b692,_0x1fa258){return new BPromise(function(_0xd4c0b6,_0x113ecb){return client[_0xdcab('0xc')](_0x2b6618,_0x1fa258)[_0xdcab('0xd')](function(_0xfb72c3){logger[_0xdcab('0xe')]('Template,\x20%s,\x20%s',_0x45b692,'request\x20sent');logger[_0xdcab('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x45b692,_0xdcab('0x10'),JSON[_0xdcab('0x11')](_0xfb72c3));if(_0xfb72c3[_0xdcab('0x12')]){if(_0xfb72c3['error'][_0xdcab('0x13')]===0x1f4){logger[_0xdcab('0x12')]('Template,\x20%s,\x20%s',_0x45b692,_0xfb72c3['error'][_0xdcab('0x14')]);return _0x113ecb(_0xfb72c3['error']['message']);}logger[_0xdcab('0x12')](_0xdcab('0x15'),_0x45b692,_0xfb72c3['error'][_0xdcab('0x14')]);return _0xd4c0b6(_0xfb72c3['error'][_0xdcab('0x14')]);}else{logger[_0xdcab('0xe')](_0xdcab('0x15'),_0x45b692,_0xdcab('0x10'));_0xd4c0b6(_0xfb72c3[_0xdcab('0x16')][_0xdcab('0x14')]);}})[_0xdcab('0x17')](function(_0x3fe8d6){logger[_0xdcab('0x12')](_0xdcab('0x15'),_0x45b692,_0x3fe8d6);_0x113ecb(_0x3fe8d6);});});}exports['GetTemplate']=function(_0x4079d3){var _0x28b56e=this;return new Promise(function(_0x2dc40f,_0x3837e6){return db['Template'][_0xdcab('0x18')]({'raw':_0x4079d3[_0xdcab('0x19')]?_0x4079d3[_0xdcab('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4079d3['options']?_0x4079d3['options'][_0xdcab('0x1a')]||null:null,'attributes':_0x4079d3['options']?_0x4079d3[_0xdcab('0x19')][_0xdcab('0x1b')]||null:null,'limit':_0x4079d3[_0xdcab('0x19')]?_0x4079d3[_0xdcab('0x19')]['limit']||null:null,'include':_0x4079d3['options']?_0x4079d3[_0xdcab('0x19')]['include']?_[_0xdcab('0x1c')](_0x4079d3[_0xdcab('0x19')][_0xdcab('0x1d')],function(_0x2aa732){return{'model':db[_0x2aa732['model']],'as':_0x2aa732['as'],'attributes':_0x2aa732['attributes'],'include':_0x2aa732[_0xdcab('0x1d')]?_[_0xdcab('0x1c')](_0x2aa732[_0xdcab('0x1d')],function(_0x3bed83){return{'model':db[_0x3bed83[_0xdcab('0x1e')]],'as':_0x3bed83['as'],'attributes':_0x3bed83['attributes'],'include':_0x3bed83[_0xdcab('0x1d')]?_[_0xdcab('0x1c')](_0x3bed83[_0xdcab('0x1d')],function(_0x18b027){return{'model':db[_0x18b027[_0xdcab('0x1e')]],'as':_0x18b027['as'],'attributes':_0x18b027[_0xdcab('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdcab('0xd')](function(_0x40efe6){logger[_0xdcab('0xe')]('GetTemplate',_0x4079d3);logger['debug']('GetTemplate',_0x4079d3,JSON['stringify'](_0x40efe6));_0x2dc40f(_0x40efe6);})['catch'](function(_0x4350a5){logger['error'](_0xdcab('0x1f'),_0x4350a5['message'],_0x4079d3);_0x3837e6(_0x28b56e[_0xdcab('0x12')](0x1f4,_0x4350a5[_0xdcab('0x14')]));});});}; \ No newline at end of file +var _0xfbdf=['result','catch','findAll','raw','options','where','attributes','limit','include','map','model','GetTemplate','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1a6399,_0x437d38){var _0x3a42d1=function(_0xeacda1){while(--_0xeacda1){_0x1a6399['push'](_0x1a6399['shift']());}};_0x3a42d1(++_0x437d38);}(_0xfbdf,0x160));var _0xffbd=function(_0x35f748,_0x2cd546){_0x35f748=_0x35f748-0x0;var _0x17ae2b=_0xfbdf[_0x35f748];return _0x17ae2b;};'use strict';var _=require(_0xffbd('0x0'));var util=require(_0xffbd('0x1'));var moment=require(_0xffbd('0x2'));var BPromise=require('bluebird');var rs=require(_0xffbd('0x3'));var fs=require('fs');var Redis=require(_0xffbd('0x4'));var db=require(_0xffbd('0x5'))['db'];var utils=require(_0xffbd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xffbd('0x7'));var jayson=require(_0xffbd('0x8'));var client=jayson[_0xffbd('0x9')][_0xffbd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc2bb61,_0x5f0267,_0xd07527){return new BPromise(function(_0x29a20f,_0x33b49c){return client[_0xffbd('0xb')](_0xc2bb61,_0xd07527)[_0xffbd('0xc')](function(_0x751737){logger[_0xffbd('0xd')](_0xffbd('0xe'),_0x5f0267,_0xffbd('0xf'));logger[_0xffbd('0x10')](_0xffbd('0x11'),_0x5f0267,_0xffbd('0xf'),JSON[_0xffbd('0x12')](_0x751737));if(_0x751737[_0xffbd('0x13')]){if(_0x751737['error'][_0xffbd('0x14')]===0x1f4){logger[_0xffbd('0x13')](_0xffbd('0xe'),_0x5f0267,_0x751737[_0xffbd('0x13')][_0xffbd('0x15')]);return _0x33b49c(_0x751737[_0xffbd('0x13')][_0xffbd('0x15')]);}logger[_0xffbd('0x13')](_0xffbd('0xe'),_0x5f0267,_0x751737[_0xffbd('0x13')][_0xffbd('0x15')]);return _0x29a20f(_0x751737['error'][_0xffbd('0x15')]);}else{logger[_0xffbd('0xd')](_0xffbd('0xe'),_0x5f0267,'request\x20sent');_0x29a20f(_0x751737[_0xffbd('0x16')][_0xffbd('0x15')]);}})[_0xffbd('0x17')](function(_0x34cf71){logger['error'](_0xffbd('0xe'),_0x5f0267,_0x34cf71);_0x33b49c(_0x34cf71);});});}exports['GetTemplate']=function(_0x207a67){var _0x404b40=this;return new Promise(function(_0x57aea5,_0x763ec5){return db['Template'][_0xffbd('0x18')]({'raw':_0x207a67['options']?_0x207a67['options'][_0xffbd('0x19')]===undefined?!![]:![]:!![],'where':_0x207a67[_0xffbd('0x1a')]?_0x207a67[_0xffbd('0x1a')][_0xffbd('0x1b')]||null:null,'attributes':_0x207a67['options']?_0x207a67[_0xffbd('0x1a')][_0xffbd('0x1c')]||null:null,'limit':_0x207a67[_0xffbd('0x1a')]?_0x207a67['options'][_0xffbd('0x1d')]||null:null,'include':_0x207a67[_0xffbd('0x1a')]?_0x207a67['options'][_0xffbd('0x1e')]?_[_0xffbd('0x1f')](_0x207a67[_0xffbd('0x1a')][_0xffbd('0x1e')],function(_0x4b08a8){return{'model':db[_0x4b08a8['model']],'as':_0x4b08a8['as'],'attributes':_0x4b08a8[_0xffbd('0x1c')],'include':_0x4b08a8[_0xffbd('0x1e')]?_['map'](_0x4b08a8['include'],function(_0x310c55){return{'model':db[_0x310c55[_0xffbd('0x20')]],'as':_0x310c55['as'],'attributes':_0x310c55[_0xffbd('0x1c')],'include':_0x310c55[_0xffbd('0x1e')]?_[_0xffbd('0x1f')](_0x310c55[_0xffbd('0x1e')],function(_0x7792b6){return{'model':db[_0x7792b6[_0xffbd('0x20')]],'as':_0x7792b6['as'],'attributes':_0x7792b6['attributes']};}):[]};}):[]};}):[]:[]})[_0xffbd('0xc')](function(_0x11fb66){logger[_0xffbd('0xd')](_0xffbd('0x21'),_0x207a67);logger['debug'](_0xffbd('0x21'),_0x207a67,JSON[_0xffbd('0x12')](_0x11fb66));_0x57aea5(_0x11fb66);})[_0xffbd('0x17')](function(_0x2f5116){logger[_0xffbd('0x13')](_0xffbd('0x21'),_0x2f5116['message'],_0x207a67);_0x763ec5(_0x404b40[_0xffbd('0x13')](0x1f4,_0x2f5116[_0xffbd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 4e67aeb..4dff159 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 _0x893e=['addAction','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','getAllConditions','/:id/any_conditions','/:id/actions','getActions','create','post','/:id/all_conditions','addAnyCondition'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x893e,0x10a));var _0xe893=function(_0x4b150b,_0x248e21){_0x4b150b=_0x4b150b-0x0;var _0x67a9fd=_0x893e[_0x4b150b];return _0x67a9fd;};'use strict';var multer=require(_0xe893('0x0'));var util=require(_0xe893('0x1'));var path=require(_0xe893('0x2'));var timeout=require('connect-timeout');var express=require(_0xe893('0x3'));var router=express[_0xe893('0x4')]();var auth=require(_0xe893('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe893('0x6'));var controller=require(_0xe893('0x7'));router[_0xe893('0x8')]('/',auth[_0xe893('0x9')](),controller[_0xe893('0xa')]);router[_0xe893('0x8')]('/:id',auth[_0xe893('0x9')](),controller[_0xe893('0xb')]);router[_0xe893('0x8')]('/:id/all_conditions',auth[_0xe893('0x9')](),controller[_0xe893('0xc')]);router['get'](_0xe893('0xd'),auth[_0xe893('0x9')](),controller['getAnyConditions']);router[_0xe893('0x8')](_0xe893('0xe'),auth[_0xe893('0x9')](),controller[_0xe893('0xf')]);router['post']('/',auth[_0xe893('0x9')](),controller[_0xe893('0x10')]);router[_0xe893('0x11')](_0xe893('0x12'),auth[_0xe893('0x9')](),controller['addAllCondition']);router['post'](_0xe893('0xd'),auth[_0xe893('0x9')](),controller[_0xe893('0x13')]);router[_0xe893('0x11')](_0xe893('0xe'),auth[_0xe893('0x9')](),controller[_0xe893('0x14')]);router['put'](_0xe893('0x15'),auth[_0xe893('0x9')](),controller[_0xe893('0x16')]);router[_0xe893('0x17')](_0xe893('0x15'),auth[_0xe893('0x9')](),controller[_0xe893('0x18')]);module[_0xe893('0x19')]=router; \ No newline at end of file +var _0xc1ce=['index','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','post','create','addAllCondition','/:id/actions','addAction','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x4c96e4,_0x2fe2ea){var _0x2dd5d2=function(_0x3f040d){while(--_0x3f040d){_0x4c96e4['push'](_0x4c96e4['shift']());}};_0x2dd5d2(++_0x2fe2ea);}(_0xc1ce,0xf2));var _0xec1c=function(_0x1c3a7e,_0x506153){_0x1c3a7e=_0x1c3a7e-0x0;var _0x43d514=_0xc1ce[_0x1c3a7e];return _0x43d514;};'use strict';var multer=require(_0xec1c('0x0'));var util=require(_0xec1c('0x1'));var path=require(_0xec1c('0x2'));var timeout=require(_0xec1c('0x3'));var express=require(_0xec1c('0x4'));var router=express['Router']();var auth=require(_0xec1c('0x5'));var interaction=require(_0xec1c('0x6'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth[_0xec1c('0x7')](),controller[_0xec1c('0x8')]);router[_0xec1c('0x9')](_0xec1c('0xa'),auth['isAuthenticated'](),controller[_0xec1c('0xb')]);router['get'](_0xec1c('0xc'),auth[_0xec1c('0x7')](),controller[_0xec1c('0xd')]);router[_0xec1c('0x9')](_0xec1c('0xe'),auth[_0xec1c('0x7')](),controller[_0xec1c('0xf')]);router[_0xec1c('0x9')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0xec1c('0x10')]('/',auth[_0xec1c('0x7')](),controller[_0xec1c('0x11')]);router[_0xec1c('0x10')](_0xec1c('0xc'),auth[_0xec1c('0x7')](),controller[_0xec1c('0x12')]);router[_0xec1c('0x10')](_0xec1c('0xe'),auth['isAuthenticated'](),controller['addAnyCondition']);router['post'](_0xec1c('0x13'),auth[_0xec1c('0x7')](),controller[_0xec1c('0x14')]);router[_0xec1c('0x15')](_0xec1c('0xa'),auth[_0xec1c('0x7')](),controller[_0xec1c('0x16')]);router[_0xec1c('0x17')](_0xec1c('0xa'),auth[_0xec1c('0x7')](),controller[_0xec1c('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index da44349..8a0caff 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 _0x65cc=['BOOLEAN','sequelize','exports','STRING'];(function(_0x285228,_0x537f9e){var _0x3240ad=function(_0xc587ef){while(--_0xc587ef){_0x285228['push'](_0x285228['shift']());}};_0x3240ad(++_0x537f9e);}(_0x65cc,0x1b1));var _0xc65c=function(_0x5b9986,_0x5d376a){_0x5b9986=_0x5b9986-0x0;var _0x2c3085=_0x65cc[_0x5b9986];return _0x2c3085;};'use strict';var Sequelize=require(_0xc65c('0x0'));module[_0xc65c('0x1')]={'name':{'type':Sequelize[_0xc65c('0x2')]},'channel':{'type':Sequelize[_0xc65c('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xc65c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x691b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x5b3782,_0x581c67){var _0x5921ec=function(_0x125a41){while(--_0x125a41){_0x5b3782['push'](_0x5b3782['shift']());}};_0x5921ec(++_0x581c67);}(_0x691b,0x134));var _0xb691=function(_0x30daaf,_0x4e0b37){_0x30daaf=_0x30daaf-0x0;var _0x9f0f04=_0x691b[_0x30daaf];return _0x9f0f04;};'use strict';var Sequelize=require(_0xb691('0x0'));module[_0xb691('0x1')]={'name':{'type':Sequelize[_0xb691('0x2')]},'channel':{'type':Sequelize[_0xb691('0x2')]},'description':{'type':Sequelize[_0xb691('0x2')]},'status':{'type':Sequelize[_0xb691('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 7acb892..6b8c8ce 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 _0xb090=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','update','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','Triggers','error','stack','name','index','map','Trigger','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','includeAll','findAll','catch','show','params','keys','rawAttributes','include','options','find','create','body','user'];(function(_0x467079,_0x3e668c){var _0x1a0f56=function(_0x5abc34){while(--_0x5abc34){_0x467079['push'](_0x467079['shift']());}};_0x1a0f56(++_0x3e668c);}(_0xb090,0xcb));var _0x0b09=function(_0x5864c0,_0x3b5531){_0x5864c0=_0x5864c0-0x0;var _0x10cc0a=_0xb090[_0x5864c0];return _0x10cc0a;};'use strict';var pdf=require(_0x0b09('0x0'));var emlformat=require(_0x0b09('0x1'));var rimraf=require(_0x0b09('0x2'));var zipdir=require(_0x0b09('0x3'));var jsonpatch=require(_0x0b09('0x4'));var rp=require(_0x0b09('0x5'));var moment=require('moment');var BPromise=require(_0x0b09('0x6'));var Mustache=require(_0x0b09('0x7'));var util=require(_0x0b09('0x8'));var path=require('path');var sox=require(_0x0b09('0x9'));var csv=require(_0x0b09('0xa'));var ejs=require(_0x0b09('0xb'));var fs=require('fs');var _=require(_0x0b09('0xc'));var squel=require(_0x0b09('0xd'));var crypto=require(_0x0b09('0xe'));var jsforce=require(_0x0b09('0xf'));var deskjs=require(_0x0b09('0x10'));var toCsv=require(_0x0b09('0xa'));var querystring=require(_0x0b09('0x11'));var Papa=require(_0x0b09('0x12'));var Redis=require(_0x0b09('0x13'));var authService=require(_0x0b09('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b09('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0b09('0x16'));var db=require(_0x0b09('0x17'))['db'];function respondWithStatusCode(_0x1427b9,_0x2a1c2e){_0x2a1c2e=_0x2a1c2e||0xcc;return function(_0x4e1590){if(_0x4e1590){return _0x1427b9['sendStatus'](_0x2a1c2e);}return _0x1427b9[_0x0b09('0x18')](_0x2a1c2e)[_0x0b09('0x19')]();};}function respondWithResult(_0x2cacb7,_0x4bfeab){_0x4bfeab=_0x4bfeab||0xc8;return function(_0x227db9){if(_0x227db9){return _0x2cacb7[_0x0b09('0x18')](_0x4bfeab)['json'](_0x227db9);}};}function respondWithFilteredResult(_0x3f2a0b,_0x31dc6d){return function(_0x325b41){if(_0x325b41){var _0x36759b=_0x325b41[_0x0b09('0x1a')],_0x87d84=_0x31dc6d['offset'],_0x584ff2=_0x31dc6d[_0x0b09('0x1b')]+_0x31dc6d[_0x0b09('0x1c')],_0xc0c0dd;if(_0x584ff2>=_0x36759b){_0x584ff2=_0x36759b;_0xc0c0dd=0xc8;}else{_0xc0c0dd=0xce;}_0x3f2a0b[_0x0b09('0x18')](_0xc0c0dd);return _0x3f2a0b[_0x0b09('0x1d')](_0x0b09('0x1e'),_0x87d84+'-'+_0x584ff2+'/'+_0x36759b)[_0x0b09('0x1f')](_0x325b41);}return null;};}function patchUpdates(_0x4fcb85){return function(_0x4954f8){try{jsonpatch['apply'](_0x4954f8,_0x4fcb85,!![]);}catch(_0x406cc2){return BPromise[_0x0b09('0x20')](_0x406cc2);}return _0x4954f8[_0x0b09('0x21')]();};}function saveUpdates(_0xb7a578,_0x2ae6a8){return function(_0x3e0749){if(_0x3e0749){return _0x3e0749['update'](_0xb7a578)[_0x0b09('0x22')](function(_0x48ecf2){return _0x48ecf2;});}return null;};}function removeEntity(_0x2924bf,_0x40806a){return function(_0x3fa279){if(_0x3fa279){return _0x3fa279[_0x0b09('0x23')]()[_0x0b09('0x22')](function(){var _0x499f18=_0x3fa279['get']({'plain':!![]});var _0x26e2f3=_0x0b09('0x24');return db['UserProfileResource'][_0x0b09('0x23')]({'where':{'type':_0x26e2f3,'resourceId':_0x499f18['id']}})['then'](function(){return _0x3fa279;});})[_0x0b09('0x22')](function(){_0x2924bf[_0x0b09('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35b3ec,_0x29563d){return function(_0x8c8c3e){if(!_0x8c8c3e){_0x35b3ec['sendStatus'](0x194);}return _0x8c8c3e;};}function handleError(_0x503f35,_0x2b8851){_0x2b8851=_0x2b8851||0x1f4;return function(_0x2bff8b){logger[_0x0b09('0x25')](_0x2bff8b[_0x0b09('0x26')]);if(_0x2bff8b[_0x0b09('0x27')]){delete _0x2bff8b[_0x0b09('0x27')];}_0x503f35['status'](_0x2b8851)['send'](_0x2bff8b);};}exports[_0x0b09('0x28')]=function(_0x22fd0e,_0x30defb){var _0x4e6861={},_0x373754={},_0x2e0cb0={'count':0x0,'rows':[]};var _0x34805c=_[_0x0b09('0x29')](db[_0x0b09('0x2a')]['rawAttributes'],function(_0x3a7755){return{'name':_0x3a7755[_0x0b09('0x2b')],'type':_0x3a7755[_0x0b09('0x2c')][_0x0b09('0x2d')]};});_0x373754[_0x0b09('0x2e')]=_['map'](_0x34805c,_0x0b09('0x27'));_0x373754[_0x0b09('0x2f')]=_['keys'](_0x22fd0e['query']);_0x373754[_0x0b09('0x30')]=_[_0x0b09('0x31')](_0x373754[_0x0b09('0x2e')],_0x373754[_0x0b09('0x2f')]);_0x4e6861['attributes']=_[_0x0b09('0x31')](_0x373754[_0x0b09('0x2e')],qs[_0x0b09('0x32')](_0x22fd0e[_0x0b09('0x2f')][_0x0b09('0x32')]));_0x4e6861[_0x0b09('0x33')]=_0x4e6861['attributes'][_0x0b09('0x34')]?_0x4e6861['attributes']:_0x373754[_0x0b09('0x2e')];if(!_0x22fd0e[_0x0b09('0x2f')][_0x0b09('0x35')](_0x0b09('0x36'))){_0x4e6861[_0x0b09('0x1c')]=qs[_0x0b09('0x1c')](_0x22fd0e['query']['limit']);_0x4e6861[_0x0b09('0x1b')]=qs[_0x0b09('0x1b')](_0x22fd0e['query'][_0x0b09('0x1b')]);}_0x4e6861['order']=qs[_0x0b09('0x37')](_0x22fd0e[_0x0b09('0x2f')]['sort']);_0x4e6861['where']=qs[_0x0b09('0x30')](_[_0x0b09('0x38')](_0x22fd0e['query'],_0x373754[_0x0b09('0x30')]),_0x34805c);if(_0x22fd0e['query'][_0x0b09('0x39')]){_0x4e6861[_0x0b09('0x3a')]=_[_0x0b09('0x3b')](_0x4e6861[_0x0b09('0x3a')],{'$or':_[_0x0b09('0x29')](_0x34805c,function(_0x26c2b7){if(_0x26c2b7[_0x0b09('0x2c')]!=='VIRTUAL'){var _0x2ac810={};_0x2ac810[_0x26c2b7['name']]={'$like':'%'+_0x22fd0e[_0x0b09('0x2f')]['filter']+'%'};return _0x2ac810;}})});}_0x4e6861=_[_0x0b09('0x3b')]({},_0x4e6861,_0x22fd0e['options']);var _0x1e5734={'where':_0x4e6861['where']};return db['Trigger']['count'](_0x1e5734)[_0x0b09('0x22')](function(_0x14f6a9){_0x2e0cb0[_0x0b09('0x1a')]=_0x14f6a9;if(_0x22fd0e['query'][_0x0b09('0x3c')]){_0x4e6861['include']=[{'all':!![]}];}return db[_0x0b09('0x2a')][_0x0b09('0x3d')](_0x4e6861);})[_0x0b09('0x22')](function(_0x5f034e){_0x2e0cb0['rows']=_0x5f034e;return _0x2e0cb0;})[_0x0b09('0x22')](respondWithFilteredResult(_0x30defb,_0x4e6861))[_0x0b09('0x3e')](handleError(_0x30defb,null));};exports[_0x0b09('0x3f')]=function(_0x175857,_0x1fb1a3){var _0x16baca={'raw':![],'where':{'id':_0x175857[_0x0b09('0x40')]['id']}},_0x14a41e={};_0x14a41e[_0x0b09('0x2e')]=_[_0x0b09('0x41')](db[_0x0b09('0x2a')][_0x0b09('0x42')]);_0x14a41e[_0x0b09('0x2f')]=_['keys'](_0x175857[_0x0b09('0x2f')]);_0x14a41e[_0x0b09('0x30')]=_[_0x0b09('0x31')](_0x14a41e[_0x0b09('0x2e')],_0x14a41e[_0x0b09('0x2f')]);_0x16baca[_0x0b09('0x33')]=_[_0x0b09('0x31')](_0x14a41e['model'],qs[_0x0b09('0x32')](_0x175857[_0x0b09('0x2f')][_0x0b09('0x32')]));_0x16baca[_0x0b09('0x33')]=_0x16baca['attributes'][_0x0b09('0x34')]?_0x16baca[_0x0b09('0x33')]:_0x14a41e[_0x0b09('0x2e')];if(_0x175857[_0x0b09('0x2f')][_0x0b09('0x3c')]){_0x16baca[_0x0b09('0x43')]=[{'all':!![]}];}_0x16baca=_['merge']({},_0x16baca,_0x175857[_0x0b09('0x44')]);return db['Trigger'][_0x0b09('0x45')](_0x16baca)['then'](handleEntityNotFound(_0x1fb1a3,null))[_0x0b09('0x22')](respondWithResult(_0x1fb1a3,null))['catch'](handleError(_0x1fb1a3,null));};exports[_0x0b09('0x46')]=function(_0x350a44,_0x540a26){return db[_0x0b09('0x2a')][_0x0b09('0x46')](_0x350a44[_0x0b09('0x47')],{})[_0x0b09('0x22')](function(_0x4de9aa){var _0x2e2633=_0x350a44[_0x0b09('0x48')][_0x0b09('0x49')]({'plain':!![]});if(!_0x2e2633)throw new Error(_0x0b09('0x4a'));if(_0x2e2633[_0x0b09('0x4b')]===_0x0b09('0x48')){var _0x519cd7=_0x4de9aa['get']({'plain':!![]});var _0x1e0cb3=_0x0b09('0x24');return db[_0x0b09('0x4c')]['find']({'where':{'name':_0x1e0cb3,'userProfileId':_0x2e2633[_0x0b09('0x4d')]},'raw':!![]})[_0x0b09('0x22')](function(_0xacb35){if(_0xacb35&&_0xacb35['autoAssociation']===0x0){return db[_0x0b09('0x4e')][_0x0b09('0x46')]({'name':_0x519cd7[_0x0b09('0x27')],'resourceId':_0x519cd7['id'],'type':_0xacb35[_0x0b09('0x27')],'sectionId':_0xacb35['id']},{})[_0x0b09('0x22')](function(){return _0x4de9aa;});}else{return _0x4de9aa;}})[_0x0b09('0x3e')](function(_0x10db9f){logger[_0x0b09('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10db9f);throw _0x10db9f;});}return _0x4de9aa;})[_0x0b09('0x22')](respondWithResult(_0x540a26,0xc9))[_0x0b09('0x3e')](handleError(_0x540a26,null));};exports[_0x0b09('0x4f')]=function(_0x55fb64,_0x425da2){if(_0x55fb64[_0x0b09('0x47')]['id']){delete _0x55fb64[_0x0b09('0x47')]['id'];}return db[_0x0b09('0x2a')][_0x0b09('0x45')]({'where':{'id':_0x55fb64['params']['id']}})['then'](handleEntityNotFound(_0x425da2,null))[_0x0b09('0x22')](saveUpdates(_0x55fb64[_0x0b09('0x47')],null))[_0x0b09('0x22')](respondWithResult(_0x425da2,null))[_0x0b09('0x3e')](handleError(_0x425da2,null));};exports['destroy']=function(_0x261670,_0x55f37e){return db['Trigger'][_0x0b09('0x45')]({'where':{'id':_0x261670[_0x0b09('0x40')]['id']}})[_0x0b09('0x22')](handleEntityNotFound(_0x55f37e,null))['then'](removeEntity(_0x55f37e,null))['catch'](handleError(_0x55f37e,null));};exports['addAllCondition']=function(_0x795c38,_0x3366dc,_0xb5a62){if(_0x795c38['body']['id']){delete _0x795c38[_0x0b09('0x47')]['id'];}return db[_0x0b09('0x2a')]['find']({'where':{'id':_0x795c38[_0x0b09('0x40')]['id']}})[_0x0b09('0x22')](handleEntityNotFound(_0x3366dc,null))['then'](function(_0x385ec5){if(_0x385ec5){_0x795c38['body'][_0x0b09('0x50')]=_0x385ec5['id'];return db[_0x0b09('0x51')]['create'](_0x795c38[_0x0b09('0x47')]);}})['then'](respondWithResult(_0x3366dc,null))[_0x0b09('0x3e')](handleError(_0x3366dc,null));};exports[_0x0b09('0x52')]=function(_0x505442,_0x959bf5,_0x96be6b){if(_0x505442[_0x0b09('0x47')]['id']){delete _0x505442['body']['id'];}return db['Trigger'][_0x0b09('0x45')]({'where':{'id':_0x505442['params']['id']}})['then'](handleEntityNotFound(_0x959bf5,null))[_0x0b09('0x22')](function(_0x49749a){if(_0x49749a){_0x505442[_0x0b09('0x47')][_0x0b09('0x53')]=_0x49749a['id'];return db['Condition'][_0x0b09('0x46')](_0x505442[_0x0b09('0x47')]);}})['then'](respondWithResult(_0x959bf5,null))[_0x0b09('0x3e')](handleError(_0x959bf5,null));};exports[_0x0b09('0x54')]=function(_0xdb5633,_0x289f80,_0x37cbee){var _0x37b884={};var _0x3e5567={};var _0x709448;var _0x3bc819;return db[_0x0b09('0x2a')][_0x0b09('0x55')]({'where':{'id':_0xdb5633['params']['id']}})[_0x0b09('0x22')](handleEntityNotFound(_0x289f80,null))[_0x0b09('0x22')](function(_0x16ae41){if(_0x16ae41){_0x709448=_0x16ae41;_0x3e5567[_0x0b09('0x2e')]=_[_0x0b09('0x41')](db[_0x0b09('0x51')][_0x0b09('0x42')]);_0x3e5567['query']=_['keys'](_0xdb5633['query']);_0x3e5567[_0x0b09('0x30')]=_[_0x0b09('0x31')](_0x3e5567['model'],_0x3e5567[_0x0b09('0x2f')]);_0x37b884[_0x0b09('0x33')]=_[_0x0b09('0x31')](_0x3e5567[_0x0b09('0x2e')],qs[_0x0b09('0x32')](_0xdb5633['query']['fields']));_0x37b884[_0x0b09('0x33')]=_0x37b884[_0x0b09('0x33')]['length']?_0x37b884[_0x0b09('0x33')]:_0x3e5567[_0x0b09('0x2e')];_0x37b884[_0x0b09('0x56')]=qs['sort'](_0xdb5633[_0x0b09('0x2f')][_0x0b09('0x37')]);_0x37b884[_0x0b09('0x3a')]=qs['filters'](_[_0x0b09('0x38')](_0xdb5633[_0x0b09('0x2f')],_0x3e5567[_0x0b09('0x30')]));if(_0xdb5633[_0x0b09('0x2f')][_0x0b09('0x39')]){_0x37b884[_0x0b09('0x3a')]=_['merge'](_0x37b884[_0x0b09('0x3a')],{'$or':_[_0x0b09('0x29')](_0x37b884[_0x0b09('0x33')],function(_0x575daf){var _0x3e2144={};_0x3e2144[_0x575daf]={'$like':'%'+_0xdb5633['query'][_0x0b09('0x39')]+'%'};return _0x3e2144;})});}_0x37b884=_[_0x0b09('0x3b')]({},_0x37b884,_0xdb5633[_0x0b09('0x44')]);return _0x709448[_0x0b09('0x54')](_0x37b884);}})[_0x0b09('0x22')](function(_0xca14a4){if(_0xca14a4){_0x3bc819=_0xca14a4['length'];if(!_0xdb5633['query'][_0x0b09('0x35')]('nolimit')){_0x37b884[_0x0b09('0x1c')]=qs[_0x0b09('0x1c')](_0xdb5633[_0x0b09('0x2f')][_0x0b09('0x1c')]);_0x37b884[_0x0b09('0x1b')]=qs['offset'](_0xdb5633[_0x0b09('0x2f')][_0x0b09('0x1b')]);}return _0x709448['getAllConditions'](_0x37b884);}})[_0x0b09('0x22')](function(_0x5e2711){if(_0x5e2711){return _0x5e2711?{'count':_0x3bc819,'rows':_0x5e2711}:null;}})[_0x0b09('0x22')](respondWithResult(_0x289f80,null))[_0x0b09('0x3e')](handleError(_0x289f80,null));};exports[_0x0b09('0x57')]=function(_0x39bc00,_0x3fc0d2,_0x2c8255){var _0x24173f={};var _0x5b1423={};var _0x53759a;var _0x2283b2;return db['Trigger']['findOne']({'where':{'id':_0x39bc00['params']['id']}})[_0x0b09('0x22')](handleEntityNotFound(_0x3fc0d2,null))[_0x0b09('0x22')](function(_0x1c69c0){if(_0x1c69c0){_0x53759a=_0x1c69c0;_0x5b1423['model']=_[_0x0b09('0x41')](db[_0x0b09('0x51')]['rawAttributes']);_0x5b1423[_0x0b09('0x2f')]=_[_0x0b09('0x41')](_0x39bc00['query']);_0x5b1423[_0x0b09('0x30')]=_[_0x0b09('0x31')](_0x5b1423[_0x0b09('0x2e')],_0x5b1423[_0x0b09('0x2f')]);_0x24173f[_0x0b09('0x33')]=_[_0x0b09('0x31')](_0x5b1423[_0x0b09('0x2e')],qs[_0x0b09('0x32')](_0x39bc00[_0x0b09('0x2f')]['fields']));_0x24173f[_0x0b09('0x33')]=_0x24173f['attributes'][_0x0b09('0x34')]?_0x24173f[_0x0b09('0x33')]:_0x5b1423[_0x0b09('0x2e')];_0x24173f['order']=qs[_0x0b09('0x37')](_0x39bc00['query'][_0x0b09('0x37')]);_0x24173f[_0x0b09('0x3a')]=qs['filters'](_[_0x0b09('0x38')](_0x39bc00['query'],_0x5b1423['filters']));if(_0x39bc00[_0x0b09('0x2f')][_0x0b09('0x39')]){_0x24173f[_0x0b09('0x3a')]=_[_0x0b09('0x3b')](_0x24173f['where'],{'$or':_['map'](_0x24173f[_0x0b09('0x33')],function(_0xe56fe9){var _0xe340b7={};_0xe340b7[_0xe56fe9]={'$like':'%'+_0x39bc00[_0x0b09('0x2f')][_0x0b09('0x39')]+'%'};return _0xe340b7;})});}_0x24173f=_['merge']({},_0x24173f,_0x39bc00[_0x0b09('0x44')]);return _0x53759a[_0x0b09('0x57')](_0x24173f);}})[_0x0b09('0x22')](function(_0x20d8c6){if(_0x20d8c6){_0x2283b2=_0x20d8c6[_0x0b09('0x34')];if(!_0x39bc00[_0x0b09('0x2f')]['hasOwnProperty'](_0x0b09('0x36'))){_0x24173f[_0x0b09('0x1c')]=qs[_0x0b09('0x1c')](_0x39bc00['query'][_0x0b09('0x1c')]);_0x24173f[_0x0b09('0x1b')]=qs[_0x0b09('0x1b')](_0x39bc00[_0x0b09('0x2f')][_0x0b09('0x1b')]);}return _0x53759a['getAnyConditions'](_0x24173f);}})[_0x0b09('0x22')](function(_0xdd62b8){if(_0xdd62b8){return _0xdd62b8?{'count':_0x2283b2,'rows':_0xdd62b8}:null;}})[_0x0b09('0x22')](respondWithResult(_0x3fc0d2,null))[_0x0b09('0x3e')](handleError(_0x3fc0d2,null));};exports[_0x0b09('0x58')]=function(_0x55c39e,_0x28e29d,_0x1b4f89){if(_0x55c39e[_0x0b09('0x47')]['id']){delete _0x55c39e[_0x0b09('0x47')]['id'];}return db[_0x0b09('0x2a')][_0x0b09('0x45')]({'where':{'id':_0x55c39e[_0x0b09('0x40')]['id']}})[_0x0b09('0x22')](handleEntityNotFound(_0x28e29d,null))[_0x0b09('0x22')](function(_0xc43976){if(_0xc43976){_0x55c39e['body'][_0x0b09('0x59')]=_0xc43976['id'];return db[_0x0b09('0x5a')]['create'](_0x55c39e[_0x0b09('0x47')]);}})[_0x0b09('0x22')](respondWithResult(_0x28e29d,null))[_0x0b09('0x3e')](handleError(_0x28e29d,null));};exports[_0x0b09('0x5b')]=function(_0x28b1e3,_0x4d661a,_0x42e97a){var _0x5be372={};var _0x5ebb6b={};var _0x4d38ad;var _0x3c3d91;return db[_0x0b09('0x2a')]['findOne']({'where':{'id':_0x28b1e3[_0x0b09('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d661a,null))[_0x0b09('0x22')](function(_0x5d447d){if(_0x5d447d){_0x4d38ad=_0x5d447d;_0x5ebb6b[_0x0b09('0x2e')]=_[_0x0b09('0x41')](db[_0x0b09('0x5a')][_0x0b09('0x42')]);_0x5ebb6b[_0x0b09('0x2f')]=_[_0x0b09('0x41')](_0x28b1e3[_0x0b09('0x2f')]);_0x5ebb6b[_0x0b09('0x30')]=_[_0x0b09('0x31')](_0x5ebb6b[_0x0b09('0x2e')],_0x5ebb6b[_0x0b09('0x2f')]);_0x5be372[_0x0b09('0x33')]=_[_0x0b09('0x31')](_0x5ebb6b[_0x0b09('0x2e')],qs['fields'](_0x28b1e3[_0x0b09('0x2f')][_0x0b09('0x32')]));_0x5be372['attributes']=_0x5be372[_0x0b09('0x33')][_0x0b09('0x34')]?_0x5be372[_0x0b09('0x33')]:_0x5ebb6b[_0x0b09('0x2e')];_0x5be372[_0x0b09('0x56')]=qs[_0x0b09('0x37')](_0x28b1e3[_0x0b09('0x2f')][_0x0b09('0x37')]);_0x5be372[_0x0b09('0x3a')]=qs[_0x0b09('0x30')](_[_0x0b09('0x38')](_0x28b1e3[_0x0b09('0x2f')],_0x5ebb6b['filters']));if(_0x28b1e3[_0x0b09('0x2f')][_0x0b09('0x39')]){_0x5be372[_0x0b09('0x3a')]=_['merge'](_0x5be372[_0x0b09('0x3a')],{'$or':_[_0x0b09('0x29')](_0x5be372[_0x0b09('0x33')],function(_0x26c990){var _0x1b6b96={};_0x1b6b96[_0x26c990]={'$like':'%'+_0x28b1e3['query']['filter']+'%'};return _0x1b6b96;})});}_0x5be372=_[_0x0b09('0x3b')]({},_0x5be372,_0x28b1e3[_0x0b09('0x44')]);return _0x4d38ad[_0x0b09('0x5b')](_0x5be372);}})[_0x0b09('0x22')](function(_0x1b0f2b){if(_0x1b0f2b){_0x3c3d91=_0x1b0f2b[_0x0b09('0x34')];if(!_0x28b1e3[_0x0b09('0x2f')][_0x0b09('0x35')](_0x0b09('0x36'))){_0x5be372[_0x0b09('0x1c')]=qs[_0x0b09('0x1c')](_0x28b1e3['query'][_0x0b09('0x1c')]);_0x5be372[_0x0b09('0x1b')]=qs[_0x0b09('0x1b')](_0x28b1e3[_0x0b09('0x2f')][_0x0b09('0x1b')]);}return _0x4d38ad['getActions'](_0x5be372);}})['then'](function(_0x542302){if(_0x542302){return _0x542302?{'count':_0x3c3d91,'rows':_0x542302}:null;}})[_0x0b09('0x22')](respondWithResult(_0x4d661a,null))[_0x0b09('0x3e')](handleError(_0x4d661a,null));}; \ No newline at end of file +var _0xf2c7=['api','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','map','VIRTUAL','includeAll','include','findAll','catch','show','options','create','body','user','role','Triggers','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','merge','getAllConditions','hasOwnProperty','getAnyConditions','addAction','getActions','Action','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x160085,_0x4d040b){var _0x3f5f59=function(_0x12b937){while(--_0x12b937){_0x160085['push'](_0x160085['shift']());}};_0x3f5f59(++_0x4d040b);}(_0xf2c7,0xf7));var _0x7f2c=function(_0x4f8d61,_0x29eff0){_0x4f8d61=_0x4f8d61-0x0;var _0x3bc078=_0xf2c7[_0x4f8d61];return _0x3bc078;};'use strict';var pdf=require(_0x7f2c('0x0'));var emlformat=require(_0x7f2c('0x1'));var rimraf=require(_0x7f2c('0x2'));var zipdir=require(_0x7f2c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f2c('0x4'));var moment=require(_0x7f2c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7f2c('0x6'));var path=require(_0x7f2c('0x7'));var sox=require(_0x7f2c('0x8'));var csv=require(_0x7f2c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7f2c('0xa'));var squel=require(_0x7f2c('0xb'));var crypto=require(_0x7f2c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7f2c('0xd'));var Papa=require(_0x7f2c('0xe'));var Redis=require(_0x7f2c('0xf'));var authService=require(_0x7f2c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7f2c('0x11'));var hardwareService=require(_0x7f2c('0x12'));var logger=require(_0x7f2c('0x13'))(_0x7f2c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x7f2c('0x15'))['db'];function respondWithStatusCode(_0x449a1d,_0x58d491){_0x58d491=_0x58d491||0xcc;return function(_0x325a1c){if(_0x325a1c){return _0x449a1d[_0x7f2c('0x16')](_0x58d491);}return _0x449a1d[_0x7f2c('0x17')](_0x58d491)['end']();};}function respondWithResult(_0x433956,_0x11433f){_0x11433f=_0x11433f||0xc8;return function(_0x19a215){if(_0x19a215){return _0x433956[_0x7f2c('0x17')](_0x11433f)['json'](_0x19a215);}};}function respondWithFilteredResult(_0x180a09,_0x1c7d1b){return function(_0x1cc4a7){if(_0x1cc4a7){var _0x4593df=_0x1cc4a7[_0x7f2c('0x18')],_0x330409=_0x1c7d1b[_0x7f2c('0x19')],_0x3e48d9=_0x1c7d1b[_0x7f2c('0x19')]+_0x1c7d1b[_0x7f2c('0x1a')],_0x21e1e6;if(_0x3e48d9>=_0x4593df){_0x3e48d9=_0x4593df;_0x21e1e6=0xc8;}else{_0x21e1e6=0xce;}_0x180a09[_0x7f2c('0x17')](_0x21e1e6);return _0x180a09[_0x7f2c('0x1b')](_0x7f2c('0x1c'),_0x330409+'-'+_0x3e48d9+'/'+_0x4593df)[_0x7f2c('0x1d')](_0x1cc4a7);}return null;};}function patchUpdates(_0x269f8e){return function(_0x35364f){try{jsonpatch[_0x7f2c('0x1e')](_0x35364f,_0x269f8e,!![]);}catch(_0x498262){return BPromise[_0x7f2c('0x1f')](_0x498262);}return _0x35364f['save']();};}function saveUpdates(_0x44db35,_0x4bf13e){return function(_0x4e0556){if(_0x4e0556){return _0x4e0556[_0x7f2c('0x20')](_0x44db35)[_0x7f2c('0x21')](function(_0x28232d){return _0x28232d;});}return null;};}function removeEntity(_0x268bd8,_0x5e1827){return function(_0xba8446){if(_0xba8446){return _0xba8446[_0x7f2c('0x22')]()[_0x7f2c('0x21')](function(){var _0x5c53bd=_0xba8446[_0x7f2c('0x23')]({'plain':!![]});var _0x59be66='Triggers';return db[_0x7f2c('0x24')][_0x7f2c('0x22')]({'where':{'type':_0x59be66,'resourceId':_0x5c53bd['id']}})[_0x7f2c('0x21')](function(){return _0xba8446;});})[_0x7f2c('0x21')](function(){_0x268bd8[_0x7f2c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa606e8,_0x5cbe14){return function(_0x1c0d78){if(!_0x1c0d78){_0xa606e8[_0x7f2c('0x16')](0x194);}return _0x1c0d78;};}function handleError(_0x1a71f5,_0x89fbe4){_0x89fbe4=_0x89fbe4||0x1f4;return function(_0x219996){logger[_0x7f2c('0x25')](_0x219996[_0x7f2c('0x26')]);if(_0x219996[_0x7f2c('0x27')]){delete _0x219996[_0x7f2c('0x27')];}_0x1a71f5[_0x7f2c('0x17')](_0x89fbe4)[_0x7f2c('0x28')](_0x219996);};}exports['index']=function(_0x4a78c8,_0x107f39){var _0x2e5826={},_0x1a2caa={},_0x29801={'count':0x0,'rows':[]};var _0x533147=_['map'](db[_0x7f2c('0x29')][_0x7f2c('0x2a')],function(_0x252e67){return{'name':_0x252e67[_0x7f2c('0x2b')],'type':_0x252e67[_0x7f2c('0x2c')]['key']};});_0x1a2caa[_0x7f2c('0x2d')]=_['map'](_0x533147,_0x7f2c('0x27'));_0x1a2caa[_0x7f2c('0x2e')]=_[_0x7f2c('0x2f')](_0x4a78c8[_0x7f2c('0x2e')]);_0x1a2caa[_0x7f2c('0x30')]=_[_0x7f2c('0x31')](_0x1a2caa['model'],_0x1a2caa[_0x7f2c('0x2e')]);_0x2e5826['attributes']=_[_0x7f2c('0x31')](_0x1a2caa[_0x7f2c('0x2d')],qs[_0x7f2c('0x32')](_0x4a78c8[_0x7f2c('0x2e')]['fields']));_0x2e5826[_0x7f2c('0x33')]=_0x2e5826[_0x7f2c('0x33')][_0x7f2c('0x34')]?_0x2e5826[_0x7f2c('0x33')]:_0x1a2caa[_0x7f2c('0x2d')];if(!_0x4a78c8[_0x7f2c('0x2e')]['hasOwnProperty'](_0x7f2c('0x35'))){_0x2e5826[_0x7f2c('0x1a')]=qs[_0x7f2c('0x1a')](_0x4a78c8['query'][_0x7f2c('0x1a')]);_0x2e5826[_0x7f2c('0x19')]=qs[_0x7f2c('0x19')](_0x4a78c8[_0x7f2c('0x2e')][_0x7f2c('0x19')]);}_0x2e5826[_0x7f2c('0x36')]=qs['sort'](_0x4a78c8[_0x7f2c('0x2e')][_0x7f2c('0x37')]);_0x2e5826[_0x7f2c('0x38')]=qs['filters'](_[_0x7f2c('0x39')](_0x4a78c8[_0x7f2c('0x2e')],_0x1a2caa['filters']),_0x533147);if(_0x4a78c8[_0x7f2c('0x2e')][_0x7f2c('0x3a')]){_0x2e5826[_0x7f2c('0x38')]=_['merge'](_0x2e5826[_0x7f2c('0x38')],{'$or':_[_0x7f2c('0x3b')](_0x533147,function(_0x4a552b){if(_0x4a552b['type']!==_0x7f2c('0x3c')){var _0x45ed53={};_0x45ed53[_0x4a552b[_0x7f2c('0x27')]]={'$like':'%'+_0x4a78c8[_0x7f2c('0x2e')][_0x7f2c('0x3a')]+'%'};return _0x45ed53;}})});}_0x2e5826=_['merge']({},_0x2e5826,_0x4a78c8['options']);var _0x1894d3={'where':_0x2e5826['where']};return db[_0x7f2c('0x29')][_0x7f2c('0x18')](_0x1894d3)[_0x7f2c('0x21')](function(_0x5c7c35){_0x29801[_0x7f2c('0x18')]=_0x5c7c35;if(_0x4a78c8[_0x7f2c('0x2e')][_0x7f2c('0x3d')]){_0x2e5826[_0x7f2c('0x3e')]=[{'all':!![]}];}return db[_0x7f2c('0x29')][_0x7f2c('0x3f')](_0x2e5826);})['then'](function(_0x1e60e0){_0x29801['rows']=_0x1e60e0;return _0x29801;})[_0x7f2c('0x21')](respondWithFilteredResult(_0x107f39,_0x2e5826))[_0x7f2c('0x40')](handleError(_0x107f39,null));};exports[_0x7f2c('0x41')]=function(_0x3afdaf,_0x1f19f0){var _0x2581dc={'raw':![],'where':{'id':_0x3afdaf['params']['id']}},_0x337c4c={};_0x337c4c[_0x7f2c('0x2d')]=_[_0x7f2c('0x2f')](db[_0x7f2c('0x29')][_0x7f2c('0x2a')]);_0x337c4c[_0x7f2c('0x2e')]=_[_0x7f2c('0x2f')](_0x3afdaf[_0x7f2c('0x2e')]);_0x337c4c[_0x7f2c('0x30')]=_[_0x7f2c('0x31')](_0x337c4c['model'],_0x337c4c[_0x7f2c('0x2e')]);_0x2581dc[_0x7f2c('0x33')]=_['intersection'](_0x337c4c[_0x7f2c('0x2d')],qs[_0x7f2c('0x32')](_0x3afdaf[_0x7f2c('0x2e')][_0x7f2c('0x32')]));_0x2581dc[_0x7f2c('0x33')]=_0x2581dc[_0x7f2c('0x33')][_0x7f2c('0x34')]?_0x2581dc[_0x7f2c('0x33')]:_0x337c4c[_0x7f2c('0x2d')];if(_0x3afdaf[_0x7f2c('0x2e')][_0x7f2c('0x3d')]){_0x2581dc['include']=[{'all':!![]}];}_0x2581dc=_['merge']({},_0x2581dc,_0x3afdaf[_0x7f2c('0x42')]);return db[_0x7f2c('0x29')]['find'](_0x2581dc)['then'](handleEntityNotFound(_0x1f19f0,null))[_0x7f2c('0x21')](respondWithResult(_0x1f19f0,null))[_0x7f2c('0x40')](handleError(_0x1f19f0,null));};exports[_0x7f2c('0x43')]=function(_0x2b0345,_0x3192fe){return db['Trigger'][_0x7f2c('0x43')](_0x2b0345[_0x7f2c('0x44')],{})['then'](function(_0x94d0f0){var _0x27a7c8=_0x2b0345[_0x7f2c('0x45')]['get']({'plain':!![]});if(!_0x27a7c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27a7c8[_0x7f2c('0x46')]===_0x7f2c('0x45')){var _0x21a547=_0x94d0f0[_0x7f2c('0x23')]({'plain':!![]});var _0x29afd6=_0x7f2c('0x47');return db[_0x7f2c('0x48')][_0x7f2c('0x49')]({'where':{'name':_0x29afd6,'userProfileId':_0x27a7c8[_0x7f2c('0x4a')]},'raw':!![]})['then'](function(_0x3c5821){if(_0x3c5821&&_0x3c5821['autoAssociation']===0x0){return db['UserProfileResource'][_0x7f2c('0x43')]({'name':_0x21a547['name'],'resourceId':_0x21a547['id'],'type':_0x3c5821[_0x7f2c('0x27')],'sectionId':_0x3c5821['id']},{})[_0x7f2c('0x21')](function(){return _0x94d0f0;});}else{return _0x94d0f0;}})[_0x7f2c('0x40')](function(_0x1e8caa){logger[_0x7f2c('0x25')](_0x7f2c('0x4b'),_0x1e8caa);throw _0x1e8caa;});}return _0x94d0f0;})[_0x7f2c('0x21')](respondWithResult(_0x3192fe,0xc9))[_0x7f2c('0x40')](handleError(_0x3192fe,null));};exports['update']=function(_0x13b634,_0x318964){if(_0x13b634[_0x7f2c('0x44')]['id']){delete _0x13b634[_0x7f2c('0x44')]['id'];}return db['Trigger'][_0x7f2c('0x49')]({'where':{'id':_0x13b634[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x318964,null))[_0x7f2c('0x21')](saveUpdates(_0x13b634[_0x7f2c('0x44')],null))[_0x7f2c('0x21')](respondWithResult(_0x318964,null))['catch'](handleError(_0x318964,null));};exports[_0x7f2c('0x22')]=function(_0x2da0fb,_0x3291f6){return db[_0x7f2c('0x29')]['find']({'where':{'id':_0x2da0fb[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x3291f6,null))[_0x7f2c('0x21')](removeEntity(_0x3291f6,null))[_0x7f2c('0x40')](handleError(_0x3291f6,null));};exports['addAllCondition']=function(_0x21607a,_0x2ff06e,_0x1ab8b3){if(_0x21607a[_0x7f2c('0x44')]['id']){delete _0x21607a[_0x7f2c('0x44')]['id'];}return db[_0x7f2c('0x29')][_0x7f2c('0x49')]({'where':{'id':_0x21607a[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x2ff06e,null))['then'](function(_0x450e3d){if(_0x450e3d){_0x21607a[_0x7f2c('0x44')][_0x7f2c('0x4d')]=_0x450e3d['id'];return db[_0x7f2c('0x4e')][_0x7f2c('0x43')](_0x21607a[_0x7f2c('0x44')]);}})[_0x7f2c('0x21')](respondWithResult(_0x2ff06e,null))[_0x7f2c('0x40')](handleError(_0x2ff06e,null));};exports[_0x7f2c('0x4f')]=function(_0x30fc81,_0x179063,_0x2b80a4){if(_0x30fc81[_0x7f2c('0x44')]['id']){delete _0x30fc81[_0x7f2c('0x44')]['id'];}return db['Trigger'][_0x7f2c('0x49')]({'where':{'id':_0x30fc81[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x179063,null))[_0x7f2c('0x21')](function(_0x218fdb){if(_0x218fdb){_0x30fc81[_0x7f2c('0x44')][_0x7f2c('0x50')]=_0x218fdb['id'];return db[_0x7f2c('0x4e')][_0x7f2c('0x43')](_0x30fc81[_0x7f2c('0x44')]);}})[_0x7f2c('0x21')](respondWithResult(_0x179063,null))[_0x7f2c('0x40')](handleError(_0x179063,null));};exports['getAllConditions']=function(_0x27b601,_0x32e0eb,_0x6fcfa1){var _0x1d15da={};var _0xb6ec43={};var _0xc2cb97;var _0x3808b5;return db[_0x7f2c('0x29')][_0x7f2c('0x51')]({'where':{'id':_0x27b601['params']['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x32e0eb,null))[_0x7f2c('0x21')](function(_0x31b58c){if(_0x31b58c){_0xc2cb97=_0x31b58c;_0xb6ec43[_0x7f2c('0x2d')]=_['keys'](db['Condition'][_0x7f2c('0x2a')]);_0xb6ec43[_0x7f2c('0x2e')]=_['keys'](_0x27b601[_0x7f2c('0x2e')]);_0xb6ec43[_0x7f2c('0x30')]=_[_0x7f2c('0x31')](_0xb6ec43['model'],_0xb6ec43[_0x7f2c('0x2e')]);_0x1d15da[_0x7f2c('0x33')]=_[_0x7f2c('0x31')](_0xb6ec43[_0x7f2c('0x2d')],qs[_0x7f2c('0x32')](_0x27b601[_0x7f2c('0x2e')]['fields']));_0x1d15da[_0x7f2c('0x33')]=_0x1d15da[_0x7f2c('0x33')]['length']?_0x1d15da[_0x7f2c('0x33')]:_0xb6ec43['model'];_0x1d15da[_0x7f2c('0x36')]=qs[_0x7f2c('0x37')](_0x27b601[_0x7f2c('0x2e')][_0x7f2c('0x37')]);_0x1d15da[_0x7f2c('0x38')]=qs['filters'](_[_0x7f2c('0x39')](_0x27b601[_0x7f2c('0x2e')],_0xb6ec43[_0x7f2c('0x30')]));if(_0x27b601[_0x7f2c('0x2e')][_0x7f2c('0x3a')]){_0x1d15da[_0x7f2c('0x38')]=_[_0x7f2c('0x52')](_0x1d15da[_0x7f2c('0x38')],{'$or':_[_0x7f2c('0x3b')](_0x1d15da[_0x7f2c('0x33')],function(_0x16f928){var _0xb96f0b={};_0xb96f0b[_0x16f928]={'$like':'%'+_0x27b601['query'][_0x7f2c('0x3a')]+'%'};return _0xb96f0b;})});}_0x1d15da=_[_0x7f2c('0x52')]({},_0x1d15da,_0x27b601[_0x7f2c('0x42')]);return _0xc2cb97[_0x7f2c('0x53')](_0x1d15da);}})[_0x7f2c('0x21')](function(_0x2d0da1){if(_0x2d0da1){_0x3808b5=_0x2d0da1[_0x7f2c('0x34')];if(!_0x27b601[_0x7f2c('0x2e')][_0x7f2c('0x54')]('nolimit')){_0x1d15da[_0x7f2c('0x1a')]=qs[_0x7f2c('0x1a')](_0x27b601[_0x7f2c('0x2e')][_0x7f2c('0x1a')]);_0x1d15da['offset']=qs[_0x7f2c('0x19')](_0x27b601[_0x7f2c('0x2e')][_0x7f2c('0x19')]);}return _0xc2cb97[_0x7f2c('0x53')](_0x1d15da);}})[_0x7f2c('0x21')](function(_0x462902){if(_0x462902){return _0x462902?{'count':_0x3808b5,'rows':_0x462902}:null;}})[_0x7f2c('0x21')](respondWithResult(_0x32e0eb,null))[_0x7f2c('0x40')](handleError(_0x32e0eb,null));};exports['getAnyConditions']=function(_0x118460,_0x3e747c,_0x871429){var _0x131d37={};var _0x55f64e={};var _0x5efc26;var _0x4de734;return db[_0x7f2c('0x29')]['findOne']({'where':{'id':_0x118460[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x3e747c,null))['then'](function(_0x53d950){if(_0x53d950){_0x5efc26=_0x53d950;_0x55f64e['model']=_[_0x7f2c('0x2f')](db[_0x7f2c('0x4e')]['rawAttributes']);_0x55f64e[_0x7f2c('0x2e')]=_[_0x7f2c('0x2f')](_0x118460[_0x7f2c('0x2e')]);_0x55f64e[_0x7f2c('0x30')]=_[_0x7f2c('0x31')](_0x55f64e[_0x7f2c('0x2d')],_0x55f64e[_0x7f2c('0x2e')]);_0x131d37[_0x7f2c('0x33')]=_[_0x7f2c('0x31')](_0x55f64e[_0x7f2c('0x2d')],qs['fields'](_0x118460[_0x7f2c('0x2e')][_0x7f2c('0x32')]));_0x131d37[_0x7f2c('0x33')]=_0x131d37[_0x7f2c('0x33')][_0x7f2c('0x34')]?_0x131d37[_0x7f2c('0x33')]:_0x55f64e[_0x7f2c('0x2d')];_0x131d37[_0x7f2c('0x36')]=qs[_0x7f2c('0x37')](_0x118460[_0x7f2c('0x2e')][_0x7f2c('0x37')]);_0x131d37[_0x7f2c('0x38')]=qs['filters'](_[_0x7f2c('0x39')](_0x118460[_0x7f2c('0x2e')],_0x55f64e[_0x7f2c('0x30')]));if(_0x118460[_0x7f2c('0x2e')][_0x7f2c('0x3a')]){_0x131d37[_0x7f2c('0x38')]=_[_0x7f2c('0x52')](_0x131d37[_0x7f2c('0x38')],{'$or':_[_0x7f2c('0x3b')](_0x131d37['attributes'],function(_0x33c6c2){var _0x28119a={};_0x28119a[_0x33c6c2]={'$like':'%'+_0x118460[_0x7f2c('0x2e')][_0x7f2c('0x3a')]+'%'};return _0x28119a;})});}_0x131d37=_[_0x7f2c('0x52')]({},_0x131d37,_0x118460[_0x7f2c('0x42')]);return _0x5efc26[_0x7f2c('0x55')](_0x131d37);}})[_0x7f2c('0x21')](function(_0x3cb554){if(_0x3cb554){_0x4de734=_0x3cb554[_0x7f2c('0x34')];if(!_0x118460[_0x7f2c('0x2e')][_0x7f2c('0x54')]('nolimit')){_0x131d37[_0x7f2c('0x1a')]=qs['limit'](_0x118460['query'][_0x7f2c('0x1a')]);_0x131d37[_0x7f2c('0x19')]=qs[_0x7f2c('0x19')](_0x118460[_0x7f2c('0x2e')]['offset']);}return _0x5efc26[_0x7f2c('0x55')](_0x131d37);}})['then'](function(_0x4db8d7){if(_0x4db8d7){return _0x4db8d7?{'count':_0x4de734,'rows':_0x4db8d7}:null;}})['then'](respondWithResult(_0x3e747c,null))[_0x7f2c('0x40')](handleError(_0x3e747c,null));};exports[_0x7f2c('0x56')]=function(_0x4f74c4,_0x4eef26,_0x5de1a3){if(_0x4f74c4[_0x7f2c('0x44')]['id']){delete _0x4f74c4['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x4f74c4[_0x7f2c('0x4c')]['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x4eef26,null))[_0x7f2c('0x21')](function(_0x2e3aad){if(_0x2e3aad){_0x4f74c4[_0x7f2c('0x44')]['TriggerId']=_0x2e3aad['id'];return db['Action'][_0x7f2c('0x43')](_0x4f74c4[_0x7f2c('0x44')]);}})[_0x7f2c('0x21')](respondWithResult(_0x4eef26,null))['catch'](handleError(_0x4eef26,null));};exports[_0x7f2c('0x57')]=function(_0x345821,_0x6c8d1e,_0xe746af){var _0x4793eb={};var _0x4297a6={};var _0x5e4608;var _0x57e3ef;return db[_0x7f2c('0x29')][_0x7f2c('0x51')]({'where':{'id':_0x345821['params']['id']}})[_0x7f2c('0x21')](handleEntityNotFound(_0x6c8d1e,null))[_0x7f2c('0x21')](function(_0x3df9a6){if(_0x3df9a6){_0x5e4608=_0x3df9a6;_0x4297a6[_0x7f2c('0x2d')]=_[_0x7f2c('0x2f')](db[_0x7f2c('0x58')]['rawAttributes']);_0x4297a6['query']=_['keys'](_0x345821[_0x7f2c('0x2e')]);_0x4297a6[_0x7f2c('0x30')]=_['intersection'](_0x4297a6[_0x7f2c('0x2d')],_0x4297a6[_0x7f2c('0x2e')]);_0x4793eb['attributes']=_[_0x7f2c('0x31')](_0x4297a6[_0x7f2c('0x2d')],qs[_0x7f2c('0x32')](_0x345821['query']['fields']));_0x4793eb[_0x7f2c('0x33')]=_0x4793eb[_0x7f2c('0x33')][_0x7f2c('0x34')]?_0x4793eb[_0x7f2c('0x33')]:_0x4297a6['model'];_0x4793eb[_0x7f2c('0x36')]=qs['sort'](_0x345821[_0x7f2c('0x2e')][_0x7f2c('0x37')]);_0x4793eb['where']=qs['filters'](_[_0x7f2c('0x39')](_0x345821['query'],_0x4297a6[_0x7f2c('0x30')]));if(_0x345821[_0x7f2c('0x2e')]['filter']){_0x4793eb[_0x7f2c('0x38')]=_['merge'](_0x4793eb[_0x7f2c('0x38')],{'$or':_[_0x7f2c('0x3b')](_0x4793eb[_0x7f2c('0x33')],function(_0x5c9082){var _0x2a1475={};_0x2a1475[_0x5c9082]={'$like':'%'+_0x345821['query']['filter']+'%'};return _0x2a1475;})});}_0x4793eb=_['merge']({},_0x4793eb,_0x345821['options']);return _0x5e4608[_0x7f2c('0x57')](_0x4793eb);}})[_0x7f2c('0x21')](function(_0x5ca4fc){if(_0x5ca4fc){_0x57e3ef=_0x5ca4fc['length'];if(!_0x345821['query'][_0x7f2c('0x54')](_0x7f2c('0x35'))){_0x4793eb[_0x7f2c('0x1a')]=qs[_0x7f2c('0x1a')](_0x345821[_0x7f2c('0x2e')]['limit']);_0x4793eb[_0x7f2c('0x19')]=qs[_0x7f2c('0x19')](_0x345821[_0x7f2c('0x2e')][_0x7f2c('0x19')]);}return _0x5e4608[_0x7f2c('0x57')](_0x4793eb);}})[_0x7f2c('0x21')](function(_0x50bc64){if(_0x50bc64){return _0x50bc64?{'count':_0x57e3ef,'rows':_0x50bc64}:null;}})[_0x7f2c('0x21')](respondWithResult(_0x6c8d1e,null))['catch'](handleError(_0x6c8d1e,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 146e7df..683595a 100644 --- a/server/api/trigger/trigger.model.js +++ b/server/api/trigger/trigger.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./trigger.attributes'];(function(_0x437a20,_0x218d35){var _0x26706c=function(_0x4f73bd){while(--_0x4f73bd){_0x437a20['push'](_0x437a20['shift']());}};_0x26706c(++_0x218d35);}(_0x2ef3,0xba));var _0x32ef=function(_0xa5f7b2,_0x192c9c){_0xa5f7b2=_0xa5f7b2-0x0;var _0x413f8b=_0x2ef3[_0xa5f7b2];return _0x413f8b;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util'];(function(_0x30af23,_0x1b9d6a){var _0x5cea96=function(_0x31be06){while(--_0x31be06){_0x30af23['push'](_0x30af23['shift']());}};_0x5cea96(++_0x1b9d6a);}(_0x7a54,0x106));var _0x47a5=function(_0x21f918,_0x215fe2){_0x21f918=_0x21f918-0x0;var _0x5700ae=_0x7a54[_0x21f918];return _0x5700ae;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 7c48f80..644ee1c 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 _0xd914=['raw','where','attributes','limit','include','map','model','then','ShowTrigger','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrigger','Trigger','options'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0xd914,0x17f));var _0x4d91=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0xd914[_0x7feb90];return _0x3c5b33;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175ce3,_0x27c0d5,_0x22f2a4){return new BPromise(function(_0x150767,_0x3016c0){return client[_0x4d91('0xb')](_0x175ce3,_0x22f2a4)['then'](function(_0x37bde4){logger[_0x4d91('0xc')](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));logger[_0x4d91('0xf')](_0x4d91('0x10'),_0x27c0d5,'request\x20sent',JSON['stringify'](_0x37bde4));if(_0x37bde4[_0x4d91('0x11')]){if(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x12')]===0x1f4){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')]['message']);return _0x3016c0(_0x37bde4['error'][_0x4d91('0x13')]);}logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);return _0x150767(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);}else{logger['info'](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));_0x150767(_0x37bde4[_0x4d91('0x14')][_0x4d91('0x13')]);}})[_0x4d91('0x15')](function(_0x554ca8){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x554ca8);_0x3016c0(_0x554ca8);});});}exports[_0x4d91('0x16')]=function(_0x44b9a7){var _0x4cfa40=this;return new Promise(function(_0x350e23,_0x3b579b){return db[_0x4d91('0x17')]['findAll']({'raw':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x19')]===undefined?!![]:![]:!![],'where':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1a')]||null:null,'attributes':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1b')]||null:null,'limit':_0x44b9a7[_0x4d91('0x18')]?_0x44b9a7['options'][_0x4d91('0x1c')]||null:null,'include':_0x44b9a7['options']?_0x44b9a7['options'][_0x4d91('0x1d')]?_[_0x4d91('0x1e')](_0x44b9a7[_0x4d91('0x18')][_0x4d91('0x1d')],function(_0x7d8cbf){return{'model':db[_0x7d8cbf[_0x4d91('0x1f')]],'as':_0x7d8cbf['as'],'attributes':_0x7d8cbf[_0x4d91('0x1b')],'include':_0x7d8cbf[_0x4d91('0x1d')]?_['map'](_0x7d8cbf['include'],function(_0x1ee6b3){return{'model':db[_0x1ee6b3[_0x4d91('0x1f')]],'as':_0x1ee6b3['as'],'attributes':_0x1ee6b3[_0x4d91('0x1b')],'include':_0x1ee6b3[_0x4d91('0x1d')]?_[_0x4d91('0x1e')](_0x1ee6b3[_0x4d91('0x1d')],function(_0x14bdb4){return{'model':db[_0x14bdb4['model']],'as':_0x14bdb4['as'],'attributes':_0x14bdb4[_0x4d91('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4d91('0x20')](function(_0x12ac74){logger['info']('GetTrigger',_0x44b9a7);logger[_0x4d91('0xf')](_0x4d91('0x16'),_0x44b9a7,JSON['stringify'](_0x12ac74));_0x350e23(_0x12ac74);})['catch'](function(_0x42d5a0){logger[_0x4d91('0x11')](_0x4d91('0x16'),_0x42d5a0[_0x4d91('0x13')],_0x44b9a7);_0x3b579b(_0x4cfa40['error'](0x1f4,_0x42d5a0[_0x4d91('0x13')]));});});};exports[_0x4d91('0x21')]=function(_0x468e95){var _0xee7535=this;return new Promise(function(_0xa63422,_0x3466f3){return db[_0x4d91('0x17')]['find']({'raw':_0x468e95[_0x4d91('0x18')]?_0x468e95['options']['raw']===undefined?!![]:![]:!![],'where':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')]['where']||null:null,'attributes':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')][_0x4d91('0x1b')]||null:null,'include':_0x468e95[_0x4d91('0x18')]?_0x468e95[_0x4d91('0x18')]['include']?_[_0x4d91('0x1e')](_0x468e95[_0x4d91('0x18')][_0x4d91('0x1d')],function(_0x2b8131){return{'model':db[_0x2b8131[_0x4d91('0x1f')]],'as':_0x2b8131['as'],'attributes':_0x2b8131[_0x4d91('0x1b')],'include':_0x2b8131['include']?_[_0x4d91('0x1e')](_0x2b8131[_0x4d91('0x1d')],function(_0x5c2247){return{'model':db[_0x5c2247[_0x4d91('0x1f')]],'as':_0x5c2247['as'],'attributes':_0x5c2247[_0x4d91('0x1b')],'include':_0x5c2247[_0x4d91('0x1d')]?_['map'](_0x5c2247[_0x4d91('0x1d')],function(_0x2c8b54){return{'model':db[_0x2c8b54[_0x4d91('0x1f')]],'as':_0x2c8b54['as'],'attributes':_0x2c8b54[_0x4d91('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x64cee3){logger[_0x4d91('0xc')](_0x4d91('0x21'),_0x468e95);logger[_0x4d91('0xf')]('ShowTrigger',_0x468e95,JSON['stringify'](_0x64cee3));_0xa63422(_0x64cee3);})[_0x4d91('0x15')](function(_0x3dac76){logger['error'](_0x4d91('0x21'),_0x3dac76[_0x4d91('0x13')],_0x468e95);_0x3466f3(_0xee7535[_0x4d91('0x11')](0x1f4,_0x3dac76[_0x4d91('0x13')]));});});}; \ No newline at end of file +var _0xf4f4=['then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','ShowTrigger','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x2e4be2,_0x48c87a){var _0x44bf97=function(_0x58cda7){while(--_0x58cda7){_0x2e4be2['push'](_0x2e4be2['shift']());}};_0x44bf97(++_0x48c87a);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x505dcb,_0x3d3646){_0x505dcb=_0x505dcb-0x0;var _0x3f1944=_0xf4f4[_0x505dcb];return _0x3f1944;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff75a,_0x3c4877,_0x249f8a){return new BPromise(function(_0x2faba9,_0x3768d7){return client['request'](_0x1ff75a,_0x249f8a)[_0x4f4f('0xb')](function(_0x38d110){logger[_0x4f4f('0xc')](_0x4f4f('0xd'),_0x3c4877,_0x4f4f('0xe'));logger[_0x4f4f('0xf')](_0x4f4f('0x10'),_0x3c4877,_0x4f4f('0xe'),JSON['stringify'](_0x38d110));if(_0x38d110['error']){if(_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x12')]===0x1f4){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x3768d7(_0x38d110['error'][_0x4f4f('0x13')]);}logger['error'](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x2faba9(_0x38d110[_0x4f4f('0x11')]['message']);}else{logger[_0x4f4f('0xc')]('Trigger,\x20%s,\x20%s',_0x3c4877,'request\x20sent');_0x2faba9(_0x38d110['result'][_0x4f4f('0x13')]);}})[_0x4f4f('0x14')](function(_0x2d21ed){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x2d21ed);_0x3768d7(_0x2d21ed);});});}exports[_0x4f4f('0x15')]=function(_0x1245c4){var _0x60ce2=this;return new Promise(function(_0x929a0b,_0x2f9397){return db[_0x4f4f('0x16')][_0x4f4f('0x17')]({'raw':_0x1245c4['options']?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x19')]===undefined?!![]:![]:!![],'where':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1a')]||null:null,'attributes':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1b')]||null:null,'limit':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1c')]||null:null,'include':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1d')]?_['map'](_0x1245c4['options']['include'],function(_0x272125){return{'model':db[_0x272125[_0x4f4f('0x1e')]],'as':_0x272125['as'],'attributes':_0x272125['attributes'],'include':_0x272125[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x272125[_0x4f4f('0x1d')],function(_0x2ec92a){return{'model':db[_0x2ec92a[_0x4f4f('0x1e')]],'as':_0x2ec92a['as'],'attributes':_0x2ec92a[_0x4f4f('0x1b')],'include':_0x2ec92a[_0x4f4f('0x1d')]?_['map'](_0x2ec92a[_0x4f4f('0x1d')],function(_0x237cf9){return{'model':db[_0x237cf9[_0x4f4f('0x1e')]],'as':_0x237cf9['as'],'attributes':_0x237cf9[_0x4f4f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f4f('0xb')](function(_0x4ad33d){logger[_0x4f4f('0xc')](_0x4f4f('0x15'),_0x1245c4);logger[_0x4f4f('0xf')]('GetTrigger',_0x1245c4,JSON['stringify'](_0x4ad33d));_0x929a0b(_0x4ad33d);})['catch'](function(_0x73b8bb){logger['error'](_0x4f4f('0x15'),_0x73b8bb[_0x4f4f('0x13')],_0x1245c4);_0x2f9397(_0x60ce2[_0x4f4f('0x11')](0x1f4,_0x73b8bb['message']));});});};exports[_0x4f4f('0x20')]=function(_0x1b6f53){var _0x5dd5a3=this;return new Promise(function(_0x413b71,_0x1a551a){return db[_0x4f4f('0x16')]['find']({'raw':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1b6f53['options']?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1a')]||null:null,'attributes':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1b')]||null:null,'include':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x1b6f53[_0x4f4f('0x18')]['include'],function(_0x4d87fd){return{'model':db[_0x4d87fd[_0x4f4f('0x1e')]],'as':_0x4d87fd['as'],'attributes':_0x4d87fd['attributes'],'include':_0x4d87fd[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x4d87fd[_0x4f4f('0x1d')],function(_0x4215da){return{'model':db[_0x4215da[_0x4f4f('0x1e')]],'as':_0x4215da['as'],'attributes':_0x4215da[_0x4f4f('0x1b')],'include':_0x4215da[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x4215da[_0x4f4f('0x1d')],function(_0x19785e){return{'model':db[_0x19785e[_0x4f4f('0x1e')]],'as':_0x19785e['as'],'attributes':_0x19785e[_0x4f4f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x411e94){logger[_0x4f4f('0xc')](_0x4f4f('0x20'),_0x1b6f53);logger[_0x4f4f('0xf')](_0x4f4f('0x20'),_0x1b6f53,JSON[_0x4f4f('0x21')](_0x411e94));_0x413b71(_0x411e94);})[_0x4f4f('0x14')](function(_0x32b077){logger[_0x4f4f('0x11')]('ShowTrigger',_0x32b077[_0x4f4f('0x13')],_0x1b6f53);_0x1a551a(_0x5dd5a3[_0x4f4f('0x11')](0x1f4,_0x32b077[_0x4f4f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 306fb98..3ad8551 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 _0x33c5=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','util'];(function(_0x523ec1,_0x1cdeb0){var _0x15a70b=function(_0x32af8e){while(--_0x32af8e){_0x523ec1['push'](_0x523ec1['shift']());}};_0x15a70b(++_0x1cdeb0);}(_0x33c5,0xe6));var _0x533c=function(_0x21a2b3,_0x5d6564){_0x21a2b3=_0x21a2b3-0x0;var _0x4651a7=_0x33c5[_0x21a2b3];return _0x4651a7;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var auth=require(_0x533c('0x4'));var interaction=require(_0x533c('0x5'));var config=require(_0x533c('0x6'));var controller=require('./trunk.controller');router[_0x533c('0x7')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0x9')]);router[_0x533c('0x7')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xb')]);router[_0x533c('0xc')](_0x533c('0xd'),auth[_0x533c('0x8')](),controller[_0x533c('0xe')]);router[_0x533c('0xc')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0xf')]);router[_0x533c('0x10')](_0x533c('0xa'),auth['isAuthenticated'](),controller[_0x533c('0x11')]);router[_0x533c('0x12')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0x13')]);module[_0x533c('0x14')]=router; \ No newline at end of file +var _0x34e8=['create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','post','/:id/clone','clone'];(function(_0x255019,_0x4d7269){var _0x560331=function(_0x41bf8f){while(--_0x41bf8f){_0x255019['push'](_0x255019['shift']());}};_0x560331(++_0x4d7269);}(_0x34e8,0x12c));var _0x834e=function(_0x5b1a08,_0x95fb0){_0x5b1a08=_0x5b1a08-0x0;var _0x19c178=_0x34e8[_0x5b1a08];return _0x19c178;};'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')](_0x834e('0xd'),auth[_0x834e('0xa')](),controller[_0x834e('0xe')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x10')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index ec470ae..18ac302 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 _0xd7bc=['PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','ENUM','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','BOOLEAN','sequelize','STRING','name','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0xd7bc,0x102));var _0xcd7b=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0xd7bc[_0x3ec122];return _0x4ecf41;};'use strict';var Sequelize=require(_0xcd7b('0x0'));module['exports']={'name':{'type':Sequelize[_0xcd7b('0x1')],'allowNull':![],'unique':_0xcd7b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xcd7b('0x3'),_0xcd7b('0x4'),_0xcd7b('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xcd7b('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xcd7b('0x6'),_0xcd7b('0x7'),_0xcd7b('0x8'),_0xcd7b('0x9'),_0xcd7b('0xa'),_0xcd7b('0xb'),_0xcd7b('0xc'),_0xcd7b('0xd'))},'deny':{'type':Sequelize[_0xcd7b('0x1')]},'permit':{'type':Sequelize[_0xcd7b('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xcd7b('0x1')]},'remotesecret':{'type':Sequelize[_0xcd7b('0x1')]},'transport':{'type':Sequelize[_0xcd7b('0x1')],'defaultValue':_0xcd7b('0xe'),'set':function(_0x4c135d){this[_0xcd7b('0xf')](_0xcd7b('0x10'),_0x4c135d?_0x4c135d[_0xcd7b('0x11')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xcd7b('0x12')](_0xcd7b('0x10'))[_0xcd7b('0x13')](','):null;},'comment':_0xcd7b('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0xcd7b('0x15'),_0xcd7b('0x16'),_0xcd7b('0x17'),_0xcd7b('0x18'),_0xcd7b('0x19')),'defaultValue':_0xcd7b('0x15')},'directmedia':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no',_0xcd7b('0x1c'),_0xcd7b('0x1d'),_0xcd7b('0x1e')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xcd7b('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcd7b('0x1')]},'directmediadeny':{'type':Sequelize[_0xcd7b('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xcd7b('0x1f'),'set':function(_0x4b2a2b){this['setDataValue'](_0xcd7b('0x20'),_0x4b2a2b?_0x4b2a2b[_0xcd7b('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xcd7b('0x20'))?this[_0xcd7b('0x12')]('nat')[_0xcd7b('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xcd7b('0x1')]},'namedcallgroup':{'type':Sequelize[_0xcd7b('0x1')]},'pickupgroup':{'type':Sequelize[_0xcd7b('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xcd7b('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcd7b('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcd7b('0x1')],'defaultValue':_0xcd7b('0x21')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x23f906){this[_0xcd7b('0xf')]('allow',_0x23f906?_0x23f906[_0xcd7b('0x11')](';'):_0xcd7b('0x22'));},'get':function(){return this[_0xcd7b('0x12')](_0xcd7b('0x23'))?this['getDataValue']('allow')[_0xcd7b('0x13')](';'):null;},'comment':_0xcd7b('0x24')},'autoframing':{'type':Sequelize['ENUM'](_0xcd7b('0x1b'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x3d18e0){this[_0xcd7b('0xf')](_0xcd7b('0x25'),_0x3d18e0?_0x3d18e0[_0xcd7b('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xcd7b('0x25'))?this[_0xcd7b('0x12')](_0xcd7b('0x25'))[_0xcd7b('0x13')](','):null;},'comment':_0xcd7b('0x26')},'trustrpid':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no',_0xcd7b('0x27'))},'promiscredir':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0xcd7b('0x28')](0xb)},'setvar':{'type':Sequelize[_0xcd7b('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xcd7b('0x29')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no'),'defaultValue':_0xcd7b('0x1b')},'busylevel':{'type':Sequelize[_0xcd7b('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0xcd7b('0x1a')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xcd7b('0x1')]},'template':{'type':Sequelize[_0xcd7b('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xcd7b('0x1b'),'no',_0xcd7b('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcd7b('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no')},'mailbox':{'type':Sequelize[_0xcd7b('0x1')]},'session_timers':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x2b'),_0xcd7b('0x2c'),'originate')},'session_expires':{'type':Sequelize[_0xcd7b('0x28')](0xb)},'session_minse':{'type':Sequelize[_0xcd7b('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x2d'),_0xcd7b('0x2e')),'defaultValue':_0xcd7b('0x2e')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xcd7b('0x1')]},'fromdomain':{'type':Sequelize[_0xcd7b('0x1')]},'fromuser':{'type':Sequelize[_0xcd7b('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no'),'defaultValue':_0xcd7b('0x1b')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xcd7b('0x1')]},'defaultuser':{'type':Sequelize[_0xcd7b('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xcd7b('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no',_0xcd7b('0x2f')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcd7b('0x1')]},'callbackextension':{'type':Sequelize[_0xcd7b('0x1')]},'timert1':{'type':Sequelize[_0xcd7b('0x28')](0xb)},'timerb':{'type':Sequelize[_0xcd7b('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0xcd7b('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0xcd7b('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xcd7b('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xcd7b('0x28')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xcd7b('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no')},'force_avp':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xcd7b('0x1b'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0xcd7b('0x1a')]('yes','no',_0xcd7b('0x30'),_0xcd7b('0x31'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xcd7b('0x1')]},'dtlssetup':{'type':Sequelize[_0xcd7b('0x1a')]('active',_0xcd7b('0x32'),_0xcd7b('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcd7b('0x1')]},'usereqphone':{'type':Sequelize[_0xcd7b('0x1a')](_0xcd7b('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcd7b('0x1a')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xcd7b('0x1a')]('yes','no')},'vmexten':{'type':Sequelize[_0xcd7b('0x1')]},'mohinterpret':{'type':Sequelize[_0xcd7b('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xcd7b('0x1')]},'description':{'type':Sequelize[_0xcd7b('0x1')]},'host':{'type':Sequelize[_0xcd7b('0x1')],'defaultValue':_0xcd7b('0x34')},'canreinvite':{'type':Sequelize['ENUM'](_0xcd7b('0x1b'),'no',_0xcd7b('0x1c'),_0xcd7b('0x1d'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xcd7b('0x1')]},'otherFields':{'type':Sequelize[_0xcd7b('0x1')]},'active':{'type':Sequelize[_0xcd7b('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xcd7b('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x1275=['passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','shortinfo','inband','auto','rfc2833','nonat','update','outgoing','yes','force_rport,comedia','nat','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','refuse','uac','uas','pai'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1275,0x6b));var _0x5127=function(_0x3f82a5,_0x554c14){_0x3f82a5=_0x3f82a5-0x0;var _0x36543b=_0x1275[_0x3f82a5];return _0x36543b;};'use strict';var Sequelize=require(_0x5127('0x0'));module[_0x5127('0x1')]={'name':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x5127('0x3'),_0x5127('0x4'),_0x5127('0x5')),'allowNull':![],'defaultValue':_0x5127('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5127('0x6')},'callingpres':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x8'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x5127('0x9'),_0x5127('0xa'),_0x5127('0xb'),_0x5127('0xc'),_0x5127('0xd'))},'deny':{'type':Sequelize[_0x5127('0x2')]},'permit':{'type':Sequelize[_0x5127('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x5127('0x2')]},'remotesecret':{'type':Sequelize[_0x5127('0x2')]},'transport':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0xe'),'set':function(_0x303dcf){this[_0x5127('0xf')](_0x5127('0x10'),_0x303dcf?_0x303dcf[_0x5127('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x5127('0x10'))?this['getDataValue'](_0x5127('0x10'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x5127('0x7')]('rfc2833','info',_0x5127('0x12'),_0x5127('0x13'),_0x5127('0x14')),'defaultValue':_0x5127('0x15')},'directmedia':{'type':Sequelize[_0x5127('0x7')]('yes','no',_0x5127('0x16'),_0x5127('0x17'),_0x5127('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5127('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0x1a'),'set':function(_0x50298d){this[_0x5127('0xf')](_0x5127('0x1b'),_0x50298d?_0x50298d['join'](','):null);},'get':function(){return this[_0x5127('0x1c')]('nat')?this[_0x5127('0x1c')](_0x5127('0x1b'))[_0x5127('0x1d')](','):null;},'comment':_0x5127('0x1e')},'callgroup':{'type':Sequelize[_0x5127('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x5127('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x5127('0x2')]},'language':{'type':Sequelize[_0x5127('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0x1f')},'allow':{'type':Sequelize[_0x5127('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x52ef84){this[_0x5127('0xf')](_0x5127('0x20'),_0x52ef84?_0x52ef84['join'](';'):_0x5127('0x21'));},'get':function(){return this[_0x5127('0x1c')](_0x5127('0x20'))?this[_0x5127('0x1c')](_0x5127('0x20'))[_0x5127('0x1d')](';'):null;},'comment':_0x5127('0x22')},'autoframing':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'insecure':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0x23'),'set':function(_0x3ffb06){this[_0x5127('0xf')](_0x5127('0x24'),_0x3ffb06?_0x3ffb06['join'](','):null);},'get':function(){return this['getDataValue'](_0x5127('0x24'))?this['getDataValue']('insecure')['split'](','):null;},'comment':_0x5127('0x25')},'trustrpid':{'type':Sequelize[_0x5127('0x7')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x5127('0x7')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no',_0x5127('0x26'))},'promiscredir':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'accountcode':{'type':Sequelize[_0x5127('0x27')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0x28')},'amaflags':{'type':Sequelize[_0x5127('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x5127('0x19'),'no'),'defaultValue':_0x5127('0x19')},'busylevel':{'type':Sequelize[_0x5127('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x5127('0x7')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5127('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'mailbox':{'type':Sequelize[_0x5127('0x2')]},'session_timers':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x29'),_0x5127('0x2a'),'originate')},'session_expires':{'type':Sequelize[_0x5127('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x5127('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x2b'),_0x5127('0x2c')),'defaultValue':_0x5127('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x5127('0x2')]},'fromuser':{'type':Sequelize[_0x5127('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x5127('0x19'),'no'),'defaultValue':_0x5127('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x5127('0x2')]},'defaultuser':{'type':Sequelize[_0x5127('0x2')]},'rtptimeout':{'type':Sequelize[_0x5127('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5127('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x5127('0x19'),'no',_0x5127('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5127('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x5127('0x27')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x5127('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x5127('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x5127('0x2')]},'use_q850_reason':{'type':Sequelize[_0x5127('0x2')]},'maxforwards':{'type':Sequelize[_0x5127('0x27')](0xb)},'encryption':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x5127('0x19'),'no')},'force_avp':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'icesupport':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x5127('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x5127('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x5127('0x2')]},'dtlscafile':{'type':Sequelize[_0x5127('0x2')]},'dtlscapath':{'type':Sequelize[_0x5127('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x5127('0x2e'),_0x5127('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x5127('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x5127('0x2')]},'call_limit':{'type':Sequelize[_0x5127('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x5127('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x5127('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5127('0x2')],'defaultValue':_0x5127('0x30')},'canreinvite':{'type':Sequelize[_0x5127('0x7')](_0x5127('0x19'),'no',_0x5127('0x16'),_0x5127('0x17'),_0x5127('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x5127('0x2')]},'otherFields':{'type':Sequelize[_0x5127('0x2')]},'active':{'type':Sequelize[_0x5127('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5127('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 8b36ef4..9eaf6d8 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 _0xd4f4=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','utf8','readFileSync','server/files/templates/registry.ejs','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','userProfileId','update','server/files/templates/trunk.ejs','Reload','/etc/asterisk/sip_xcally_trunks.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','destroy','then','get','Trunks','sendStatus','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','intersection','includeAll','find','clone','omit','updatedAt','body','createdAt','create'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x10c0ad,_0x248702){_0x10c0ad=_0x10c0ad-0x0;var _0x35b79a=_0xd4f4[_0x10c0ad];return _0x35b79a;};'use strict';var pdf=require(_0x4d4f('0x0'));var emlformat=require(_0x4d4f('0x1'));var rimraf=require(_0x4d4f('0x2'));var zipdir=require(_0x4d4f('0x3'));var jsonpatch=require(_0x4d4f('0x4'));var rp=require(_0x4d4f('0x5'));var moment=require(_0x4d4f('0x6'));var BPromise=require(_0x4d4f('0x7'));var Mustache=require(_0x4d4f('0x8'));var util=require(_0x4d4f('0x9'));var path=require(_0x4d4f('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var db=require(_0x4d4f('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x15fe6a,_0xe9b7a6,_0x4b7472){if(_0x4b7472){var _0x1ea8b3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ea8b3[_0x4d4f('0x1d')](_0xe9b7a6)){return _0x15fe6a;}else{throw new db[(_0x4d4f('0x1e'))]['ValidationError'](_0x4d4f('0x1f'));}}else{return _0x15fe6a;}}function respondWithRpcPromise(_0x2e736b,_0x1a9173,_0x4a3364,_0x59bfb5){return new BPromise(function(_0x5e4ff5,_0x18a528){var _0x16f8e7=_0x59bfb5||client;return _0x16f8e7[_0x4d4f('0x20')](_0x2e736b,_0x4a3364)['then'](function(_0x30b6b1){logger[_0x4d4f('0x21')]('Trunk,\x20%s,\x20%s',_0x1a9173,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x1a9173,'request\x20sent',JSON[_0x4d4f('0x22')](_0x30b6b1));if(_0x30b6b1[_0x4d4f('0x23')]){if(_0x30b6b1[_0x4d4f('0x23')][_0x4d4f('0x24')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x1a9173,_0x30b6b1[_0x4d4f('0x23')]['message']);return _0x18a528(_0x30b6b1[_0x4d4f('0x23')][_0x4d4f('0x25')]);}logger[_0x4d4f('0x23')](_0x4d4f('0x26'),_0x1a9173,_0x30b6b1[_0x4d4f('0x23')]['message']);return _0x5e4ff5(_0x30b6b1['error'][_0x4d4f('0x25')]);}else{logger['info'](_0x4d4f('0x26'),_0x1a9173,_0x4d4f('0x27'));_0x5e4ff5(_0x30b6b1[_0x4d4f('0x28')][_0x4d4f('0x25')]);}})[_0x4d4f('0x29')](function(_0x497cec){logger[_0x4d4f('0x23')](_0x4d4f('0x26'),_0x1a9173,_0x497cec);_0x18a528(_0x497cec);});});}function respondWithStatusCode(_0x1cf365,_0x28443b){_0x28443b=_0x28443b||0xcc;return function(_0x5cf9e7){if(_0x5cf9e7){return _0x1cf365['sendStatus'](_0x28443b);}return _0x1cf365[_0x4d4f('0x2a')](_0x28443b)[_0x4d4f('0x2b')]();};}function respondWithResult(_0xa2492c,_0x1f79f9){_0x1f79f9=_0x1f79f9||0xc8;return function(_0x58acbe){if(_0x58acbe){return _0xa2492c[_0x4d4f('0x2a')](_0x1f79f9)[_0x4d4f('0x2c')](_0x58acbe);}};}function respondWithFilteredResult(_0x388593,_0x2e91b2){return function(_0x4effb1){if(_0x4effb1){var _0x338ba2=_0x4effb1['count'],_0x51cb3d=_0x2e91b2[_0x4d4f('0x2d')],_0x1688bb=_0x2e91b2[_0x4d4f('0x2d')]+_0x2e91b2[_0x4d4f('0x2e')],_0x333a40;if(_0x1688bb>=_0x338ba2){_0x1688bb=_0x338ba2;_0x333a40=0xc8;}else{_0x333a40=0xce;}_0x388593[_0x4d4f('0x2a')](_0x333a40);return _0x388593[_0x4d4f('0x2f')](_0x4d4f('0x30'),_0x51cb3d+'-'+_0x1688bb+'/'+_0x338ba2)['json'](_0x4effb1);}return null;};}function patchUpdates(_0x36eede){return function(_0x4578b6){try{jsonpatch[_0x4d4f('0x31')](_0x4578b6,_0x36eede,!![]);}catch(_0x43c37b){return BPromise[_0x4d4f('0x32')](_0x43c37b);}return _0x4578b6['save']();};}function saveUpdates(_0x2d6565,_0x486e33){return function(_0x35f9e2){if(_0x35f9e2){return _0x35f9e2['update'](_0x2d6565)['then'](function(_0x5c751e){return _0x5c751e;});}return null;};}function removeEntity(_0x9abc01,_0x57fc2b){return function(_0x16ccd2){if(_0x16ccd2){return _0x16ccd2[_0x4d4f('0x33')]()[_0x4d4f('0x34')](function(){var _0x4f79f9=_0x16ccd2[_0x4d4f('0x35')]({'plain':!![]});var _0x1ab7c4=_0x4d4f('0x36');return db['UserProfileResource'][_0x4d4f('0x33')]({'where':{'type':_0x1ab7c4,'resourceId':_0x4f79f9['id']}})['then'](function(){return _0x16ccd2;});})[_0x4d4f('0x34')](function(){_0x9abc01[_0x4d4f('0x2a')](0xcc)[_0x4d4f('0x2b')]();});}};}function handleEntityNotFound(_0x128e3d,_0x2448f3){return function(_0x13f341){if(!_0x13f341){_0x128e3d[_0x4d4f('0x37')](0x194);}return _0x13f341;};}function handleError(_0x461900,_0x5d8058){_0x5d8058=_0x5d8058||0x1f4;return function(_0x54a21e){logger[_0x4d4f('0x23')](_0x54a21e['stack']);if(_0x54a21e['name']){delete _0x54a21e[_0x4d4f('0x38')];}_0x461900[_0x4d4f('0x2a')](_0x5d8058)[_0x4d4f('0x39')](_0x54a21e);};}exports[_0x4d4f('0x3a')]=function(_0x129103,_0x56eed8){var _0x12c512={},_0x27466f={},_0x5cc3e7={'count':0x0,'rows':[]};var _0x32af9a=_[_0x4d4f('0x3b')](db[_0x4d4f('0x3c')][_0x4d4f('0x3d')],function(_0x18800e){return{'name':_0x18800e[_0x4d4f('0x3e')],'type':_0x18800e[_0x4d4f('0x3f')][_0x4d4f('0x40')]};});_0x27466f[_0x4d4f('0x41')]=_['map'](_0x32af9a,'name');_0x27466f[_0x4d4f('0x42')]=_[_0x4d4f('0x43')](_0x129103[_0x4d4f('0x42')]);_0x27466f[_0x4d4f('0x44')]=_['intersection'](_0x27466f['model'],_0x27466f[_0x4d4f('0x42')]);_0x12c512[_0x4d4f('0x45')]=_['intersection'](_0x27466f['model'],qs[_0x4d4f('0x46')](_0x129103[_0x4d4f('0x42')]['fields']));_0x12c512[_0x4d4f('0x45')]=_0x12c512[_0x4d4f('0x45')][_0x4d4f('0x47')]?_0x12c512[_0x4d4f('0x45')]:_0x27466f[_0x4d4f('0x41')];if(!_0x129103['query'][_0x4d4f('0x48')]('nolimit')){_0x12c512[_0x4d4f('0x2e')]=qs[_0x4d4f('0x2e')](_0x129103['query'][_0x4d4f('0x2e')]);_0x12c512[_0x4d4f('0x2d')]=qs[_0x4d4f('0x2d')](_0x129103['query'][_0x4d4f('0x2d')]);}_0x12c512['order']=qs[_0x4d4f('0x49')](_0x129103['query'][_0x4d4f('0x49')]);_0x12c512[_0x4d4f('0x4a')]=qs[_0x4d4f('0x44')](_[_0x4d4f('0x4b')](_0x129103[_0x4d4f('0x42')],_0x27466f['filters']),_0x32af9a);if(_0x129103['query'][_0x4d4f('0x4c')]){_0x12c512[_0x4d4f('0x4a')]=_[_0x4d4f('0x4d')](_0x12c512[_0x4d4f('0x4a')],{'$or':_['map'](_0x32af9a,function(_0x54d0d5){if(_0x54d0d5['type']!==_0x4d4f('0x4e')){var _0x1a093e={};_0x1a093e[_0x54d0d5[_0x4d4f('0x38')]]={'$like':'%'+_0x129103[_0x4d4f('0x42')][_0x4d4f('0x4c')]+'%'};return _0x1a093e;}})});}_0x12c512=_[_0x4d4f('0x4d')]({},_0x12c512,_0x129103[_0x4d4f('0x4f')]);var _0x437da9={'where':_0x12c512[_0x4d4f('0x4a')]};return db[_0x4d4f('0x3c')][_0x4d4f('0x50')](_0x437da9)[_0x4d4f('0x34')](function(_0x5c7a41){_0x5cc3e7[_0x4d4f('0x50')]=_0x5c7a41;if(_0x129103[_0x4d4f('0x42')]['includeAll']){_0x12c512[_0x4d4f('0x51')]=[{'all':!![]}];}return db['Trunk'][_0x4d4f('0x52')](_0x12c512);})[_0x4d4f('0x34')](function(_0x50a3b3){_0x5cc3e7[_0x4d4f('0x53')]=_0x50a3b3;return _0x5cc3e7;})[_0x4d4f('0x34')](respondWithFilteredResult(_0x56eed8,_0x12c512))[_0x4d4f('0x29')](handleError(_0x56eed8,null));};exports[_0x4d4f('0x54')]=function(_0x7f22f2,_0x3eae74){var _0x11a63e={'raw':![],'where':{'id':_0x7f22f2[_0x4d4f('0x55')]['id']}},_0x3cf05c={};_0x3cf05c[_0x4d4f('0x41')]=_[_0x4d4f('0x43')](db[_0x4d4f('0x3c')]['rawAttributes']);_0x3cf05c[_0x4d4f('0x42')]=_['keys'](_0x7f22f2['query']);_0x3cf05c['filters']=_[_0x4d4f('0x56')](_0x3cf05c[_0x4d4f('0x41')],_0x3cf05c['query']);_0x11a63e['attributes']=_[_0x4d4f('0x56')](_0x3cf05c[_0x4d4f('0x41')],qs['fields'](_0x7f22f2[_0x4d4f('0x42')]['fields']));_0x11a63e[_0x4d4f('0x45')]=_0x11a63e[_0x4d4f('0x45')][_0x4d4f('0x47')]?_0x11a63e[_0x4d4f('0x45')]:_0x3cf05c['model'];if(_0x7f22f2[_0x4d4f('0x42')][_0x4d4f('0x57')]){_0x11a63e[_0x4d4f('0x51')]=[{'all':!![]}];}_0x11a63e=_[_0x4d4f('0x4d')]({},_0x11a63e,_0x7f22f2[_0x4d4f('0x4f')]);return db['Trunk'][_0x4d4f('0x58')](_0x11a63e)['then'](handleEntityNotFound(_0x3eae74,null))[_0x4d4f('0x34')](respondWithResult(_0x3eae74,null))['catch'](handleError(_0x3eae74,null));};exports[_0x4d4f('0x59')]=function(_0xc23eb6,_0x57f4b3){var _0x1c072d={'where':{'id':_0xc23eb6['params']['id']}},_0x1d8ae6={};_0x1d8ae6[_0x4d4f('0x41')]=_['keys'](db[_0x4d4f('0x3c')]['rawAttributes']);_0x1c072d['attributes']=_[_0x4d4f('0x56')](_0x1d8ae6[_0x4d4f('0x41')],qs[_0x4d4f('0x46')](_0xc23eb6[_0x4d4f('0x42')][_0x4d4f('0x46')]));_0x1c072d['attributes']=_0x1c072d['attributes'][_0x4d4f('0x47')]?_0x1c072d['attributes']:_0x1d8ae6[_0x4d4f('0x41')];if(_0xc23eb6[_0x4d4f('0x42')][_0x4d4f('0x57')]){_0x1c072d[_0x4d4f('0x51')]=[{'all':!![]}];}_0x1c072d=_[_0x4d4f('0x4d')]({},_0x1c072d,_0xc23eb6[_0x4d4f('0x4f')]);return db['Trunk'][_0x4d4f('0x58')](_0x1c072d)[_0x4d4f('0x34')](handleEntityNotFound(_0x57f4b3,null))[_0x4d4f('0x34')](function(_0x4bb7ac){if(_0x4bb7ac){var _0x2011aa=_0x4bb7ac[_0x4d4f('0x35')]({'plain':!![]});_0x2011aa=qs[_0x4d4f('0x5a')](_0x2011aa,['id','createdAt',_0x4d4f('0x5b')]);_0xc23eb6['body']=_[_0x4d4f('0x5a')](_0xc23eb6[_0x4d4f('0x5c')],['id',_0x4d4f('0x5d'),_0x4d4f('0x5b')]);return db[_0x4d4f('0x3c')][_0x4d4f('0x5e')](_[_0x4d4f('0x4d')](_0x2011aa,_0xc23eb6[_0x4d4f('0x5c')]),{'include':_0xc23eb6[_0x4d4f('0x42')]['includeAll']?[{'all':!![]}]:undefined})[_0x4d4f('0x34')](function(_0x255771){var _0x4907b6=_0xc23eb6[_0x4d4f('0x5f')][_0x4d4f('0x35')]({'plain':!![]});if(!_0x4907b6)throw new Error(_0x4d4f('0x60'));if(_0x4907b6[_0x4d4f('0x61')]==='user'){var _0x4013a9=_0x255771[_0x4d4f('0x35')]({'plain':!![]});var _0x5995f2='Trunks';return db[_0x4d4f('0x62')][_0x4d4f('0x58')]({'where':{'name':_0x5995f2,'userProfileId':_0x4907b6['userProfileId']},'raw':!![]})['then'](function(_0x4d34fc){if(_0x4d34fc&&_0x4d34fc[_0x4d4f('0x63')]===0x0){return db[_0x4d4f('0x64')]['create']({'name':_0x4013a9[_0x4d4f('0x38')],'resourceId':_0x4013a9['id'],'type':_0x4d34fc[_0x4d4f('0x38')],'sectionId':_0x4d34fc['id']},{})[_0x4d4f('0x34')](function(){return _0x255771;});}else{return _0x255771;}})[_0x4d4f('0x29')](function(_0x1d9552){logger[_0x4d4f('0x23')](_0x4d4f('0x65'),_0x1d9552);throw _0x1d9552;});}return _0x255771;});}})[_0x4d4f('0x34')](respondWithResult(_0x57f4b3,0xc9))['catch'](handleError(_0x57f4b3,null));};exports[_0x4d4f('0x5e')]=function(_0x4e4196,_0x403cb2,_0x289653){var _0x1567c3;return db['Trunk'][_0x4d4f('0x5e')](_0x4e4196[_0x4d4f('0x5c')],{'raw':!![]})[_0x4d4f('0x34')](function(_0x14675c){_0x1567c3=_0x14675c;return db['Trunk'][_0x4d4f('0x52')]({'raw':!![]});})['then'](function(_0x268b34){var _0x50d0da=fs['readFileSync'](path[_0x4d4f('0x66')](config[_0x4d4f('0x67')],'server/files/templates/trunk.ejs'),_0x4d4f('0x68'));var _0x53a18b=fs[_0x4d4f('0x69')](path[_0x4d4f('0x66')](config[_0x4d4f('0x67')],_0x4d4f('0x6a')),'utf8');var _0x4952f0=ejs[_0x4d4f('0x6b')](_0x50d0da,{'trunks':_0x268b34||[]});fs[_0x4d4f('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4952f0);if(_0x1567c3[_0x4d4f('0x6d')]){var _0x140cfd=ejs[_0x4d4f('0x6b')](_0x53a18b,{'trunks':_0x268b34||[]});fs[_0x4d4f('0x6c')](_0x4d4f('0x6e'),_0x140cfd);}})[_0x4d4f('0x34')](function(){return respondWithRpcPromise('Reload','create',{'module':_0x4d4f('0x6f')});})[_0x4d4f('0x34')](function(){var _0x5e199d=_0x4e4196[_0x4d4f('0x5f')][_0x4d4f('0x35')]({'plain':!![]});if(!_0x5e199d)throw new Error(_0x4d4f('0x60'));if(_0x5e199d[_0x4d4f('0x61')]===_0x4d4f('0x5f')){var _0x45000f=_0x1567c3[_0x4d4f('0x35')]({'plain':!![]});return db[_0x4d4f('0x62')][_0x4d4f('0x58')]({'where':{'name':_0x4d4f('0x36'),'userProfileId':_0x5e199d[_0x4d4f('0x70')]},'raw':!![]})[_0x4d4f('0x34')](function(_0x13f45c){if(_0x13f45c&&_0x13f45c[_0x4d4f('0x63')]===0x0){return db[_0x4d4f('0x64')]['create']({'name':_0x45000f[_0x4d4f('0x38')],'resourceId':_0x45000f['id'],'type':_0x13f45c[_0x4d4f('0x38')],'sectionId':_0x13f45c['id']},{})[_0x4d4f('0x34')](function(){return _0x1567c3;});}else{return _0x1567c3;}})[_0x4d4f('0x29')](function(_0x5daf28){logger['error'](_0x4d4f('0x65'),_0x5daf28);throw _0x5daf28;});}return _0x1567c3;})[_0x4d4f('0x34')](respondWithResult(_0x403cb2,0xc9))[_0x4d4f('0x29')](handleError(_0x403cb2,null));};exports[_0x4d4f('0x71')]=function(_0x64820e,_0x2876b5,_0x19a8fb){var _0x342d66;return db[_0x4d4f('0x3c')][_0x4d4f('0x58')]({'where':{'id':_0x64820e['params']['id']}})[_0x4d4f('0x34')](handleEntityNotFound(_0x2876b5,null))[_0x4d4f('0x34')](saveUpdates(_0x64820e[_0x4d4f('0x5c')],null))[_0x4d4f('0x34')](function(_0x584c53){if(_0x584c53){_0x342d66=_0x584c53;return db['Trunk']['findAll']({'raw':!![]});}})[_0x4d4f('0x34')](function(_0x50b625){if(_0x50b625){var _0x3e592b=fs[_0x4d4f('0x69')](path[_0x4d4f('0x66')](config[_0x4d4f('0x67')],_0x4d4f('0x72')),_0x4d4f('0x68'));var _0x1990d6=fs[_0x4d4f('0x69')](path['join'](config['root'],_0x4d4f('0x6a')),'utf8');var _0x3a81b7=ejs[_0x4d4f('0x6b')](_0x3e592b,{'trunks':_0x50b625||[]});fs[_0x4d4f('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3a81b7);var _0x535407=ejs['render'](_0x1990d6,{'trunks':_0x50b625||[]});fs[_0x4d4f('0x6c')]('/etc/asterisk/sip_xcally_registers.conf',_0x535407);return respondWithRpcPromise(_0x4d4f('0x73'),'update',{'module':_0x4d4f('0x6f')});}return null;})[_0x4d4f('0x34')](function(_0x1e8b6f){if(_0x1e8b6f){return _0x342d66;}})[_0x4d4f('0x34')](respondWithResult(_0x2876b5,null))[_0x4d4f('0x29')](handleError(_0x2876b5,null));};exports[_0x4d4f('0x33')]=function(_0x548709,_0x18274e,_0x3beacf){var _0x4691b7;return db[_0x4d4f('0x3c')][_0x4d4f('0x58')]({'where':{'id':_0x548709['params']['id']}})[_0x4d4f('0x34')](handleEntityNotFound(_0x18274e,null))['then'](removeEntity(_0x18274e,null))[_0x4d4f('0x34')](function(){return db[_0x4d4f('0x3c')][_0x4d4f('0x52')]({'raw':!![]});})[_0x4d4f('0x34')](function(_0x46fd1a){var _0x20d8df=fs[_0x4d4f('0x69')](path['join'](config[_0x4d4f('0x67')],_0x4d4f('0x72')),_0x4d4f('0x68'));var _0x4fb657=fs[_0x4d4f('0x69')](path['join'](config[_0x4d4f('0x67')],'server/files/templates/registry.ejs'),_0x4d4f('0x68'));var _0x20e632=ejs[_0x4d4f('0x6b')](_0x20d8df,{'trunks':_0x46fd1a});var _0x5dd02f=ejs[_0x4d4f('0x6b')](_0x4fb657,{'trunks':_0x46fd1a});fs[_0x4d4f('0x6c')](_0x4d4f('0x74'),_0x20e632);fs[_0x4d4f('0x6c')]('/etc/asterisk/sip_xcally_registers.conf',_0x5dd02f);return respondWithRpcPromise(_0x4d4f('0x73'),_0x4d4f('0x33'),{'module':'chan_sip.so'});})[_0x4d4f('0x29')](handleError(_0x18274e,null));}; \ No newline at end of file +var _0xd3f5=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','Sequelize','ValidationError','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','clone','createdAt','updatedAt','omit','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x18bf5f,_0x2e048c){var _0x3fa7a5=function(_0x2ad0f6){while(--_0x2ad0f6){_0x18bf5f['push'](_0x18bf5f['shift']());}};_0x3fa7a5(++_0x2e048c);}(_0xd3f5,0x147));var _0x5d3f=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd3f5[_0xbca1b1];return _0x4e1686;};'use strict';var pdf=require(_0x5d3f('0x0'));var emlformat=require(_0x5d3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5d3f('0x2'));var jsonpatch=require(_0x5d3f('0x3'));var rp=require(_0x5d3f('0x4'));var moment=require(_0x5d3f('0x5'));var BPromise=require(_0x5d3f('0x6'));var Mustache=require(_0x5d3f('0x7'));var util=require(_0x5d3f('0x8'));var path=require(_0x5d3f('0x9'));var sox=require('sox');var csv=require(_0x5d3f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5d3f('0xb'));var squel=require(_0x5d3f('0xc'));var crypto=require('crypto');var jsforce=require(_0x5d3f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5d3f('0xa'));var querystring=require('querystring');var Papa=require(_0x5d3f('0xe'));var Redis=require('ioredis');var authService=require(_0x5d3f('0xf'));var qs=require(_0x5d3f('0x10'));var as=require(_0x5d3f('0x11'));var hardwareService=require(_0x5d3f('0x12'));var logger=require(_0x5d3f('0x13'))(_0x5d3f('0x14'));var utils=require(_0x5d3f('0x15'));var config=require(_0x5d3f('0x16'));var db=require(_0x5d3f('0x17'))['db'];var jayson=require(_0x5d3f('0x18'));var client=jayson[_0x5d3f('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x2359ae,_0x3135c8,_0x1def4d){if(_0x1def4d){var _0x4171f3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4171f3['test'](_0x3135c8)){return _0x2359ae;}else{throw new db[(_0x5d3f('0x1a'))][(_0x5d3f('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 _0x2359ae;}}function respondWithRpcPromise(_0x1d2189,_0x5d1342,_0xcb108e,_0x3e03ed){return new BPromise(function(_0x1f55bb,_0x166b95){var _0x3ac7d5=_0x3e03ed||client;return _0x3ac7d5[_0x5d3f('0x1c')](_0x1d2189,_0xcb108e)[_0x5d3f('0x1d')](function(_0x56b671){logger[_0x5d3f('0x1e')]('Trunk,\x20%s,\x20%s',_0x5d1342,_0x5d3f('0x1f'));logger[_0x5d3f('0x20')](_0x5d3f('0x21'),_0x5d1342,_0x5d3f('0x1f'),JSON['stringify'](_0x56b671));if(_0x56b671[_0x5d3f('0x22')]){if(_0x56b671['error'][_0x5d3f('0x23')]===0x1f4){logger[_0x5d3f('0x22')]('Trunk,\x20%s,\x20%s',_0x5d1342,_0x56b671['error'][_0x5d3f('0x24')]);return _0x166b95(_0x56b671[_0x5d3f('0x22')][_0x5d3f('0x24')]);}logger[_0x5d3f('0x22')]('Trunk,\x20%s,\x20%s',_0x5d1342,_0x56b671['error'][_0x5d3f('0x24')]);return _0x1f55bb(_0x56b671[_0x5d3f('0x22')][_0x5d3f('0x24')]);}else{logger['info'](_0x5d3f('0x25'),_0x5d1342,_0x5d3f('0x1f'));_0x1f55bb(_0x56b671['result'][_0x5d3f('0x24')]);}})['catch'](function(_0x14a8f0){logger['error'](_0x5d3f('0x25'),_0x5d1342,_0x14a8f0);_0x166b95(_0x14a8f0);});});}function respondWithStatusCode(_0x65449,_0x1544e3){_0x1544e3=_0x1544e3||0xcc;return function(_0x37345b){if(_0x37345b){return _0x65449[_0x5d3f('0x26')](_0x1544e3);}return _0x65449[_0x5d3f('0x27')](_0x1544e3)['end']();};}function respondWithResult(_0x29d2b8,_0x3f7f7f){_0x3f7f7f=_0x3f7f7f||0xc8;return function(_0x2e0f23){if(_0x2e0f23){return _0x29d2b8['status'](_0x3f7f7f)[_0x5d3f('0x28')](_0x2e0f23);}};}function respondWithFilteredResult(_0x4ecf3c,_0x5f41c3){return function(_0x4ced45){if(_0x4ced45){var _0x2f2c74=_0x4ced45[_0x5d3f('0x29')],_0x23469a=_0x5f41c3[_0x5d3f('0x2a')],_0xa9a943=_0x5f41c3[_0x5d3f('0x2a')]+_0x5f41c3[_0x5d3f('0x2b')],_0x52aaf2;if(_0xa9a943>=_0x2f2c74){_0xa9a943=_0x2f2c74;_0x52aaf2=0xc8;}else{_0x52aaf2=0xce;}_0x4ecf3c['status'](_0x52aaf2);return _0x4ecf3c['set'](_0x5d3f('0x2c'),_0x23469a+'-'+_0xa9a943+'/'+_0x2f2c74)[_0x5d3f('0x28')](_0x4ced45);}return null;};}function patchUpdates(_0x5dd308){return function(_0x5407d4){try{jsonpatch[_0x5d3f('0x2d')](_0x5407d4,_0x5dd308,!![]);}catch(_0x3cf1ae){return BPromise['reject'](_0x3cf1ae);}return _0x5407d4[_0x5d3f('0x2e')]();};}function saveUpdates(_0x41ace6,_0x702dfd){return function(_0x3bd68f){if(_0x3bd68f){return _0x3bd68f[_0x5d3f('0x2f')](_0x41ace6)[_0x5d3f('0x1d')](function(_0x3adafc){return _0x3adafc;});}return null;};}function removeEntity(_0x13e954,_0x4a813a){return function(_0x150077){if(_0x150077){return _0x150077[_0x5d3f('0x30')]()[_0x5d3f('0x1d')](function(){var _0x5d80c2=_0x150077[_0x5d3f('0x31')]({'plain':!![]});var _0xf6a9ff=_0x5d3f('0x32');return db[_0x5d3f('0x33')][_0x5d3f('0x30')]({'where':{'type':_0xf6a9ff,'resourceId':_0x5d80c2['id']}})[_0x5d3f('0x1d')](function(){return _0x150077;});})[_0x5d3f('0x1d')](function(){_0x13e954[_0x5d3f('0x27')](0xcc)[_0x5d3f('0x34')]();});}};}function handleEntityNotFound(_0x5aa315,_0xf39782){return function(_0x4fa28b){if(!_0x4fa28b){_0x5aa315[_0x5d3f('0x26')](0x194);}return _0x4fa28b;};}function handleError(_0x3c11ba,_0x4576ec){_0x4576ec=_0x4576ec||0x1f4;return function(_0x4f17cd){logger[_0x5d3f('0x22')](_0x4f17cd[_0x5d3f('0x35')]);if(_0x4f17cd['name']){delete _0x4f17cd[_0x5d3f('0x36')];}_0x3c11ba[_0x5d3f('0x27')](_0x4576ec)[_0x5d3f('0x37')](_0x4f17cd);};}exports[_0x5d3f('0x38')]=function(_0x3dccc9,_0x8313f2){var _0x426392={},_0x390810={},_0x547940={'count':0x0,'rows':[]};var _0x338341=_[_0x5d3f('0x39')](db[_0x5d3f('0x3a')][_0x5d3f('0x3b')],function(_0x337554){return{'name':_0x337554[_0x5d3f('0x3c')],'type':_0x337554[_0x5d3f('0x3d')][_0x5d3f('0x3e')]};});_0x390810['model']=_[_0x5d3f('0x39')](_0x338341,'name');_0x390810[_0x5d3f('0x3f')]=_['keys'](_0x3dccc9[_0x5d3f('0x3f')]);_0x390810[_0x5d3f('0x40')]=_[_0x5d3f('0x41')](_0x390810['model'],_0x390810['query']);_0x426392[_0x5d3f('0x42')]=_[_0x5d3f('0x41')](_0x390810[_0x5d3f('0x43')],qs[_0x5d3f('0x44')](_0x3dccc9['query'][_0x5d3f('0x44')]));_0x426392[_0x5d3f('0x42')]=_0x426392[_0x5d3f('0x42')][_0x5d3f('0x45')]?_0x426392['attributes']:_0x390810['model'];if(!_0x3dccc9[_0x5d3f('0x3f')][_0x5d3f('0x46')](_0x5d3f('0x47'))){_0x426392[_0x5d3f('0x2b')]=qs['limit'](_0x3dccc9[_0x5d3f('0x3f')][_0x5d3f('0x2b')]);_0x426392[_0x5d3f('0x2a')]=qs[_0x5d3f('0x2a')](_0x3dccc9[_0x5d3f('0x3f')]['offset']);}_0x426392[_0x5d3f('0x48')]=qs[_0x5d3f('0x49')](_0x3dccc9['query'][_0x5d3f('0x49')]);_0x426392[_0x5d3f('0x4a')]=qs[_0x5d3f('0x40')](_[_0x5d3f('0x4b')](_0x3dccc9['query'],_0x390810[_0x5d3f('0x40')]),_0x338341);if(_0x3dccc9[_0x5d3f('0x3f')][_0x5d3f('0x4c')]){_0x426392['where']=_[_0x5d3f('0x4d')](_0x426392[_0x5d3f('0x4a')],{'$or':_[_0x5d3f('0x39')](_0x338341,function(_0xa9313e){if(_0xa9313e[_0x5d3f('0x3d')]!==_0x5d3f('0x4e')){var _0x1339c1={};_0x1339c1[_0xa9313e[_0x5d3f('0x36')]]={'$like':'%'+_0x3dccc9[_0x5d3f('0x3f')][_0x5d3f('0x4c')]+'%'};return _0x1339c1;}})});}_0x426392=_[_0x5d3f('0x4d')]({},_0x426392,_0x3dccc9[_0x5d3f('0x4f')]);var _0x45c3da={'where':_0x426392['where']};return db[_0x5d3f('0x3a')][_0x5d3f('0x29')](_0x45c3da)[_0x5d3f('0x1d')](function(_0x3dcd0b){_0x547940['count']=_0x3dcd0b;if(_0x3dccc9[_0x5d3f('0x3f')]['includeAll']){_0x426392[_0x5d3f('0x50')]=[{'all':!![]}];}return db['Trunk'][_0x5d3f('0x51')](_0x426392);})[_0x5d3f('0x1d')](function(_0x398ae2){_0x547940[_0x5d3f('0x52')]=_0x398ae2;return _0x547940;})[_0x5d3f('0x1d')](respondWithFilteredResult(_0x8313f2,_0x426392))[_0x5d3f('0x53')](handleError(_0x8313f2,null));};exports[_0x5d3f('0x54')]=function(_0x1d1d8f,_0x4df43e){var _0x1debf8={'raw':![],'where':{'id':_0x1d1d8f[_0x5d3f('0x55')]['id']}},_0x3aeb6d={};_0x3aeb6d['model']=_['keys'](db[_0x5d3f('0x3a')][_0x5d3f('0x3b')]);_0x3aeb6d[_0x5d3f('0x3f')]=_[_0x5d3f('0x56')](_0x1d1d8f[_0x5d3f('0x3f')]);_0x3aeb6d[_0x5d3f('0x40')]=_[_0x5d3f('0x41')](_0x3aeb6d[_0x5d3f('0x43')],_0x3aeb6d[_0x5d3f('0x3f')]);_0x1debf8[_0x5d3f('0x42')]=_['intersection'](_0x3aeb6d[_0x5d3f('0x43')],qs[_0x5d3f('0x44')](_0x1d1d8f[_0x5d3f('0x3f')][_0x5d3f('0x44')]));_0x1debf8[_0x5d3f('0x42')]=_0x1debf8[_0x5d3f('0x42')][_0x5d3f('0x45')]?_0x1debf8['attributes']:_0x3aeb6d[_0x5d3f('0x43')];if(_0x1d1d8f[_0x5d3f('0x3f')][_0x5d3f('0x57')]){_0x1debf8[_0x5d3f('0x50')]=[{'all':!![]}];}_0x1debf8=_['merge']({},_0x1debf8,_0x1d1d8f[_0x5d3f('0x4f')]);return db[_0x5d3f('0x3a')][_0x5d3f('0x58')](_0x1debf8)[_0x5d3f('0x1d')](handleEntityNotFound(_0x4df43e,null))['then'](respondWithResult(_0x4df43e,null))[_0x5d3f('0x53')](handleError(_0x4df43e,null));};exports[_0x5d3f('0x59')]=function(_0x350ca1,_0x1a7799){var _0x2bf52f={'where':{'id':_0x350ca1['params']['id']}},_0x286fe5={};_0x286fe5[_0x5d3f('0x43')]=_['keys'](db[_0x5d3f('0x3a')][_0x5d3f('0x3b')]);_0x2bf52f[_0x5d3f('0x42')]=_['intersection'](_0x286fe5[_0x5d3f('0x43')],qs[_0x5d3f('0x44')](_0x350ca1[_0x5d3f('0x3f')]['fields']));_0x2bf52f[_0x5d3f('0x42')]=_0x2bf52f[_0x5d3f('0x42')][_0x5d3f('0x45')]?_0x2bf52f['attributes']:_0x286fe5[_0x5d3f('0x43')];if(_0x350ca1[_0x5d3f('0x3f')][_0x5d3f('0x57')]){_0x2bf52f['include']=[{'all':!![]}];}_0x2bf52f=_['merge']({},_0x2bf52f,_0x350ca1['options']);return db['Trunk'][_0x5d3f('0x58')](_0x2bf52f)[_0x5d3f('0x1d')](handleEntityNotFound(_0x1a7799,null))[_0x5d3f('0x1d')](function(_0x232745){if(_0x232745){var _0x22cc64=_0x232745['get']({'plain':!![]});_0x22cc64=qs['omit'](_0x22cc64,['id',_0x5d3f('0x5a'),_0x5d3f('0x5b')]);_0x350ca1['body']=_[_0x5d3f('0x5c')](_0x350ca1[_0x5d3f('0x5d')],['id',_0x5d3f('0x5a'),_0x5d3f('0x5b')]);return db[_0x5d3f('0x3a')][_0x5d3f('0x5e')](_[_0x5d3f('0x4d')](_0x22cc64,_0x350ca1[_0x5d3f('0x5d')]),{'include':_0x350ca1['query'][_0x5d3f('0x57')]?[{'all':!![]}]:undefined})[_0x5d3f('0x1d')](function(_0xe0acb1){var _0x2f689c=_0x350ca1[_0x5d3f('0x5f')]['get']({'plain':!![]});if(!_0x2f689c)throw new Error(_0x5d3f('0x60'));if(_0x2f689c['role']==='user'){var _0xb95f3=_0xe0acb1[_0x5d3f('0x31')]({'plain':!![]});var _0x3f1e86=_0x5d3f('0x32');return db[_0x5d3f('0x61')]['find']({'where':{'name':_0x3f1e86,'userProfileId':_0x2f689c[_0x5d3f('0x62')]},'raw':!![]})[_0x5d3f('0x1d')](function(_0x1924d1){if(_0x1924d1&&_0x1924d1[_0x5d3f('0x63')]===0x0){return db[_0x5d3f('0x33')][_0x5d3f('0x5e')]({'name':_0xb95f3[_0x5d3f('0x36')],'resourceId':_0xb95f3['id'],'type':_0x1924d1[_0x5d3f('0x36')],'sectionId':_0x1924d1['id']},{})['then'](function(){return _0xe0acb1;});}else{return _0xe0acb1;}})['catch'](function(_0x29fb86){logger['error'](_0x5d3f('0x64'),_0x29fb86);throw _0x29fb86;});}return _0xe0acb1;});}})['then'](respondWithResult(_0x1a7799,0xc9))[_0x5d3f('0x53')](handleError(_0x1a7799,null));};exports[_0x5d3f('0x5e')]=function(_0x39fbfa,_0xeadc7c,_0x1c9f44){var _0x5c46da;return db[_0x5d3f('0x3a')][_0x5d3f('0x5e')](_0x39fbfa['body'],{'raw':!![]})[_0x5d3f('0x1d')](function(_0x43e96c){_0x5c46da=_0x43e96c;return db['Trunk'][_0x5d3f('0x51')]({'raw':!![]});})[_0x5d3f('0x1d')](function(_0x3a5fec){var _0x1500c7=fs[_0x5d3f('0x65')](path[_0x5d3f('0x66')](config[_0x5d3f('0x67')],_0x5d3f('0x68')),_0x5d3f('0x69'));var _0x3eef35=fs['readFileSync'](path[_0x5d3f('0x66')](config[_0x5d3f('0x67')],_0x5d3f('0x6a')),_0x5d3f('0x69'));var _0x3ad092=ejs[_0x5d3f('0x6b')](_0x1500c7,{'trunks':_0x3a5fec||[]});fs[_0x5d3f('0x6c')](_0x5d3f('0x6d'),_0x3ad092);if(_0x5c46da[_0x5d3f('0x6e')]){var _0x46efbe=ejs['render'](_0x3eef35,{'trunks':_0x3a5fec||[]});fs[_0x5d3f('0x6c')](_0x5d3f('0x6f'),_0x46efbe);}})[_0x5d3f('0x1d')](function(){return respondWithRpcPromise(_0x5d3f('0x70'),_0x5d3f('0x5e'),{'module':_0x5d3f('0x71')});})[_0x5d3f('0x1d')](function(){var _0x297a27=_0x39fbfa[_0x5d3f('0x5f')]['get']({'plain':!![]});if(!_0x297a27)throw new Error(_0x5d3f('0x60'));if(_0x297a27[_0x5d3f('0x72')]===_0x5d3f('0x5f')){var _0x58d348=_0x5c46da[_0x5d3f('0x31')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x5d3f('0x32'),'userProfileId':_0x297a27[_0x5d3f('0x62')]},'raw':!![]})[_0x5d3f('0x1d')](function(_0x192429){if(_0x192429&&_0x192429[_0x5d3f('0x63')]===0x0){return db[_0x5d3f('0x33')][_0x5d3f('0x5e')]({'name':_0x58d348['name'],'resourceId':_0x58d348['id'],'type':_0x192429[_0x5d3f('0x36')],'sectionId':_0x192429['id']},{})['then'](function(){return _0x5c46da;});}else{return _0x5c46da;}})[_0x5d3f('0x53')](function(_0x41e010){logger[_0x5d3f('0x22')](_0x5d3f('0x64'),_0x41e010);throw _0x41e010;});}return _0x5c46da;})[_0x5d3f('0x1d')](respondWithResult(_0xeadc7c,0xc9))[_0x5d3f('0x53')](handleError(_0xeadc7c,null));};exports[_0x5d3f('0x2f')]=function(_0x1b5a9d,_0x2d97bf,_0x19d074){var _0x21c5c0;return db[_0x5d3f('0x3a')][_0x5d3f('0x58')]({'where':{'id':_0x1b5a9d[_0x5d3f('0x55')]['id']}})[_0x5d3f('0x1d')](handleEntityNotFound(_0x2d97bf,null))[_0x5d3f('0x1d')](saveUpdates(_0x1b5a9d['body'],null))[_0x5d3f('0x1d')](function(_0x4909f2){if(_0x4909f2){_0x21c5c0=_0x4909f2;return db[_0x5d3f('0x3a')][_0x5d3f('0x51')]({'raw':!![]});}})[_0x5d3f('0x1d')](function(_0x3600c4){if(_0x3600c4){var _0x568cc7=fs['readFileSync'](path[_0x5d3f('0x66')](config['root'],_0x5d3f('0x68')),_0x5d3f('0x69'));var _0x426e0c=fs[_0x5d3f('0x65')](path[_0x5d3f('0x66')](config[_0x5d3f('0x67')],_0x5d3f('0x6a')),'utf8');var _0x5116de=ejs[_0x5d3f('0x6b')](_0x568cc7,{'trunks':_0x3600c4||[]});fs[_0x5d3f('0x6c')](_0x5d3f('0x6d'),_0x5116de);var _0xa3546d=ejs[_0x5d3f('0x6b')](_0x426e0c,{'trunks':_0x3600c4||[]});fs[_0x5d3f('0x6c')](_0x5d3f('0x6f'),_0xa3546d);return respondWithRpcPromise(_0x5d3f('0x70'),_0x5d3f('0x2f'),{'module':'chan_sip.so'});}return null;})[_0x5d3f('0x1d')](function(_0x2175b0){if(_0x2175b0){return _0x21c5c0;}})[_0x5d3f('0x1d')](respondWithResult(_0x2d97bf,null))[_0x5d3f('0x53')](handleError(_0x2d97bf,null));};exports[_0x5d3f('0x30')]=function(_0x3735b5,_0x43e2fe,_0x3c18c1){var _0x5bcb38;return db[_0x5d3f('0x3a')][_0x5d3f('0x58')]({'where':{'id':_0x3735b5[_0x5d3f('0x55')]['id']}})[_0x5d3f('0x1d')](handleEntityNotFound(_0x43e2fe,null))['then'](removeEntity(_0x43e2fe,null))['then'](function(){return db['Trunk'][_0x5d3f('0x51')]({'raw':!![]});})['then'](function(_0x14d436){var _0xd74eda=fs['readFileSync'](path['join'](config[_0x5d3f('0x67')],_0x5d3f('0x68')),_0x5d3f('0x69'));var _0x2dab50=fs[_0x5d3f('0x65')](path[_0x5d3f('0x66')](config[_0x5d3f('0x67')],_0x5d3f('0x6a')),_0x5d3f('0x69'));var _0x5f21e8=ejs[_0x5d3f('0x6b')](_0xd74eda,{'trunks':_0x14d436});var _0x3ea27e=ejs[_0x5d3f('0x6b')](_0x2dab50,{'trunks':_0x14d436});fs[_0x5d3f('0x6c')](_0x5d3f('0x6d'),_0x5f21e8);fs[_0x5d3f('0x6c')]('/etc/asterisk/sip_xcally_registers.conf',_0x3ea27e);return respondWithRpcPromise('Reload','destroy',{'module':_0x5d3f('0x71')});})[_0x5d3f('0x53')](handleError(_0x43e2fe,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 0c703fb..95fcb15 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 _0xa823=['rimraf','../../config/environment','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0xcba291,_0x10e9d5){var _0x162274=function(_0x38100e){while(--_0x38100e){_0xcba291['push'](_0xcba291['shift']());}};_0x162274(++_0x10e9d5);}(_0xa823,0x1d3));var _0x3a82=function(_0x5a7710,_0x42c551){_0x5a7710=_0x5a7710-0x0;var _0x4b4839=_0xa823[_0x5a7710];return _0x4b4839;};'use strict';var _=require(_0x3a82('0x0'));var util=require(_0x3a82('0x1'));var logger=require(_0x3a82('0x2'))('api');var moment=require(_0x3a82('0x3'));var BPromise=require('bluebird');var rp=require(_0x3a82('0x4'));var fs=require('fs');var path=require(_0x3a82('0x5'));var rimraf=require(_0x3a82('0x6'));var config=require(_0x3a82('0x7'));var attributes=require('./trunk.attributes');module['exports']=function(_0x4ba92e,_0x259d9c){return _0x4ba92e[_0x3a82('0x8')](_0x3a82('0x9'),attributes,{'tableName':_0x3a82('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea60=['exports','define','Trunk','tools_trunks','lodash','util','api','moment','bluebird','path','../../config/environment','./trunk.attributes'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xea60,0xe8));var _0x0ea6=function(_0x44349b,_0x345bb4){_0x44349b=_0x44349b-0x0;var _0x193133=_0xea60[_0x44349b];return _0x193133;};'use strict';var _=require(_0x0ea6('0x0'));var util=require(_0x0ea6('0x1'));var logger=require('../../config/logger')(_0x0ea6('0x2'));var moment=require(_0x0ea6('0x3'));var BPromise=require(_0x0ea6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ea6('0x5'));var rimraf=require('rimraf');var config=require(_0x0ea6('0x6'));var attributes=require(_0x0ea6('0x7'));module[_0x0ea6('0x8')]=function(_0x2efb2f,_0x87c70){return _0x2efb2f[_0x0ea6('0x9')](_0x0ea6('0xa'),attributes,{'tableName':_0x0ea6('0xb'),'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 f285551..f8f4eb9 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 _0x757a=['stringify','error','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_0xad6452,_0x34d448){var _0x497f9c=function(_0x158e70){while(--_0x158e70){_0xad6452['push'](_0xad6452['shift']());}};_0x497f9c(++_0x34d448);}(_0x757a,0xde));var _0xa757=function(_0xb86121,_0x587d9f){_0xb86121=_0xb86121-0x0;var _0x552702=_0x757a[_0xb86121];return _0x552702;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetTrunk',_0x4d9f58);logger['debug']('GetTrunk',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrunk',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0x5f66=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetTrunk','findAll','options','attributes','limit','include','model','map','ShowTrunk','Trunk','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x480c8a,_0x12086f){var _0xc3e46a=function(_0x5e7f70){while(--_0x5e7f70){_0x480c8a['push'](_0x480c8a['shift']());}};_0xc3e46a(++_0x12086f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Trunk,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['Trunk'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowTrunk',_0x144e55);logger[_0x65f6('0xd')]('ShowTrunk',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowTrunk',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5bd0067..417a58a 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 _0x9f29=['addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeWhatsappAccounts','multer','path','express','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','single','file','login','/:id/logout','/:id/pause','pause','/:id/unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts'];(function(_0x5169af,_0x158682){var _0x4eeaa1=function(_0x4dd87a){while(--_0x4dd87a){_0x5169af['push'](_0x5169af['shift']());}};_0x4eeaa1(++_0x158682);}(_0x9f29,0x1c6));var _0x99f2=function(_0x1ee338,_0x2b4056){_0x1ee338=_0x1ee338-0x0;var _0xa76c8e=_0x9f29[_0x1ee338];return _0xa76c8e;};'use strict';var multer=require(_0x99f2('0x0'));var util=require('util');var path=require(_0x99f2('0x1'));var timeout=require('connect-timeout');var express=require(_0x99f2('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x99f2('0x3'));var config=require(_0x99f2('0x4'));var controller=require(_0x99f2('0x5'));router[_0x99f2('0x6')]('/',auth['isAuthenticated'](),controller[_0x99f2('0x7')]);router['get'](_0x99f2('0x8'),auth[_0x99f2('0x9')](),controller[_0x99f2('0xa')]);router[_0x99f2('0x6')](_0x99f2('0xb'),auth['isAuthenticated'](),controller['whoami']);router[_0x99f2('0x6')]('/:id',auth[_0x99f2('0x9')](),controller[_0x99f2('0xc')]);router[_0x99f2('0x6')](_0x99f2('0xd'),controller[_0x99f2('0xe')]);router[_0x99f2('0x6')](_0x99f2('0xf'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x10')]);router[_0x99f2('0x6')](_0x99f2('0x11'),auth['isAuthenticated'](),controller[_0x99f2('0x12')]);router[_0x99f2('0x6')](_0x99f2('0x13'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x99f2('0x6')](_0x99f2('0x14'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x15')]);router[_0x99f2('0x6')](_0x99f2('0x16'),auth['isAuthenticated'](),controller['getRecordings']);router[_0x99f2('0x6')]('/:id/screen_recordings',auth[_0x99f2('0x9')](),controller['getScreenRecordings']);router['get'](_0x99f2('0x17'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x18')]);router[_0x99f2('0x6')](_0x99f2('0x19'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x1a')]);router[_0x99f2('0x6')](_0x99f2('0x1b'),auth[_0x99f2('0x9')](),controller['getMailInteractions']);router['get'](_0x99f2('0x1c'),auth['isAuthenticated'](),controller[_0x99f2('0x1d')]);router[_0x99f2('0x6')]('/:id/fax/interactions',auth[_0x99f2('0x9')](),controller['getFaxInteractions']);router[_0x99f2('0x6')](_0x99f2('0x1e'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x1f')]);router[_0x99f2('0x6')](_0x99f2('0x20'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x21')]);router[_0x99f2('0x6')](_0x99f2('0x22'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x23')]);router[_0x99f2('0x6')](_0x99f2('0x24'),auth['isAuthenticated'](),controller[_0x99f2('0x25')]);router['get'](_0x99f2('0x26'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x99f2('0x6')](_0x99f2('0x27'),auth[_0x99f2('0x9')](),controller['getFaxAccounts']);router[_0x99f2('0x6')](_0x99f2('0x28'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x29')]);router[_0x99f2('0x6')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x99f2('0x2a')]);router['get'](_0x99f2('0x2b'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x2c')]);router[_0x99f2('0x6')]('/:id/chat_websites',auth[_0x99f2('0x9')](),controller[_0x99f2('0x2d')]);router[_0x99f2('0x6')](_0x99f2('0x2e'),auth['isAuthenticated'](),controller[_0x99f2('0x2f')]);router[_0x99f2('0x6')](_0x99f2('0x30'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x31')]);router[_0x99f2('0x6')](_0x99f2('0x32'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x33')]);router[_0x99f2('0x6')](_0x99f2('0x34'),auth[_0x99f2('0x9')](),controller['getApiKey']);router[_0x99f2('0x35')]('/create_many',auth[_0x99f2('0x9')](),controller[_0x99f2('0x36')]);router[_0x99f2('0x35')]('/:id/contacts',auth[_0x99f2('0x9')](),controller['addContacts']);router[_0x99f2('0x35')]('/',auth[_0x99f2('0x9')](),controller['create']);router[_0x99f2('0x35')]('/:id/queues',auth[_0x99f2('0x9')](),controller[_0x99f2('0x37')]);var upload=multer({'storage':multer[_0x99f2('0x38')]({'destination':function(_0x3f9b8f,_0x36170f,_0x31a7b7){_0x31a7b7(null,path[_0x99f2('0x39')](config[_0x99f2('0x3a')],_0x99f2('0x3b')));},'filename':function(_0x5d8db7,_0x5ac3fe,_0x52a38b){_0x52a38b(null,util['format'](_0x99f2('0x3c'),Date[_0x99f2('0x3d')](),_0x5ac3fe[_0x99f2('0x3e')]));}})});router[_0x99f2('0x35')]('/:id/avatar',upload[_0x99f2('0x3f')](_0x99f2('0x40')),controller['addAvatar']);router['post']('/:id/login',auth[_0x99f2('0x9')](),controller[_0x99f2('0x41')]);router[_0x99f2('0x35')](_0x99f2('0x42'),auth[_0x99f2('0x9')](),controller['logout']);router[_0x99f2('0x35')](_0x99f2('0x43'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x44')]);router[_0x99f2('0x35')](_0x99f2('0x45'),auth[_0x99f2('0x9')](),controller['unpause']);router[_0x99f2('0x35')](_0x99f2('0x20'),auth['isAuthenticated'](),controller['addTeams']);router[_0x99f2('0x35')](_0x99f2('0x46'),auth['isAuthenticated'](),controller[_0x99f2('0x47')]);router[_0x99f2('0x35')](_0x99f2('0x48'),auth['isAuthenticated'](),controller[_0x99f2('0x49')]);router[_0x99f2('0x35')](_0x99f2('0x4a'),auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x99f2('0x35')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x99f2('0x4b')]);router[_0x99f2('0x35')](_0x99f2('0x4c'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x99f2('0x35')](_0x99f2('0x4d'),auth[_0x99f2('0x9')](),controller['addWhatsappInteractions']);router[_0x99f2('0x35')]('/:id/fax_accounts',auth[_0x99f2('0x9')](),controller[_0x99f2('0x4e')]);router[_0x99f2('0x35')](_0x99f2('0x28'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x4f')]);router[_0x99f2('0x35')](_0x99f2('0x50'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x51')]);router[_0x99f2('0x35')](_0x99f2('0x2b'),auth['isAuthenticated'](),controller[_0x99f2('0x52')]);router[_0x99f2('0x35')](_0x99f2('0x53'),auth['isAuthenticated'](),controller[_0x99f2('0x54')]);router['post'](_0x99f2('0x2e'),auth['isAuthenticated'](),controller[_0x99f2('0x55')]);router['post']('/:id/square_projects',auth[_0x99f2('0x9')](),controller[_0x99f2('0x56')]);router[_0x99f2('0x35')](_0x99f2('0x34'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x57')]);router[_0x99f2('0x58')](_0x99f2('0x59'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x5a')]);router[_0x99f2('0x58')](_0x99f2('0x5b'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x5c')]);router[_0x99f2('0x5d')](_0x99f2('0x11'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x5e')]);router[_0x99f2('0x5d')](_0x99f2('0x20'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x5f')]);router[_0x99f2('0x5d')](_0x99f2('0x59'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x60')]);router['delete'](_0x99f2('0x46'),auth['isAuthenticated'](),controller[_0x99f2('0x61')]);router[_0x99f2('0x5d')](_0x99f2('0x48'),auth[_0x99f2('0x9')](),controller['removeMailInteractions']);router[_0x99f2('0x5d')](_0x99f2('0x4a'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x62')]);router['delete'](_0x99f2('0x63'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x64')]);router[_0x99f2('0x5d')](_0x99f2('0x4c'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x65')]);router[_0x99f2('0x5d')](_0x99f2('0x4d'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x66')]);router[_0x99f2('0x5d')](_0x99f2('0x27'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x67')]);router[_0x99f2('0x5d')](_0x99f2('0x28'),auth[_0x99f2('0x9')](),controller[_0x99f2('0x68')]);router['delete'](_0x99f2('0x50'),auth['isAuthenticated'](),controller[_0x99f2('0x69')]);router[_0x99f2('0x5d')](_0x99f2('0x2b'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0x99f2('0x5d')](_0x99f2('0x53'),auth[_0x99f2('0x9')](),controller['removeChatWebsites']);router[_0x99f2('0x5d')]('/:id/whatsapp_accounts',auth[_0x99f2('0x9')](),controller[_0x99f2('0x6a')]);router['delete']('/:id/square_projects',auth['isAuthenticated'](),controller['removeSquareProjects']);router['delete'](_0x99f2('0x34'),auth[_0x99f2('0x9')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0xf8ba=['getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','/create_many','bulkCreate','post','addContacts','root','server/files/images/','format','%s-%s','now','file','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','update','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','util','Router','../../components/interaction/service','./user.controller','isAuthenticated','index','describe','get','/:id','show','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0xf8ba,0xb6));var _0xaf8b=function(_0x14d969,_0x522c63){_0x14d969=_0x14d969-0x0;var _0x55d55c=_0xf8ba[_0x14d969];return _0x55d55c;};'use strict';var multer=require('multer');var util=require(_0xaf8b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaf8b('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xaf8b('0x2'));var config=require('../../config/environment');var controller=require(_0xaf8b('0x3'));router['get']('/',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5')]);router['get']('/describe',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x6')]);router[_0xaf8b('0x7')]('/whoami',auth[_0xaf8b('0x4')](),controller['whoami']);router['get'](_0xaf8b('0x8'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x9')]);router[_0xaf8b('0x7')](_0xaf8b('0xa'),controller[_0xaf8b('0xb')]);router[_0xaf8b('0x7')](_0xaf8b('0xc'),auth[_0xaf8b('0x4')](),controller['getContacts']);router[_0xaf8b('0x7')](_0xaf8b('0xd'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0xe')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0xaf8b('0xf')]);router[_0xaf8b('0x7')](_0xaf8b('0x10'),auth[_0xaf8b('0x4')](),controller['getGroups']);router[_0xaf8b('0x7')](_0xaf8b('0x11'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x12')]);router[_0xaf8b('0x7')]('/:id/screen_recordings',auth[_0xaf8b('0x4')](),controller['getScreenRecordings']);router[_0xaf8b('0x7')]('/:id/chat/interactions',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x13')]);router[_0xaf8b('0x7')](_0xaf8b('0x14'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x15')]);router[_0xaf8b('0x7')](_0xaf8b('0x16'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x17')]);router['get']('/:id/sms/interactions',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x18')]);router[_0xaf8b('0x7')](_0xaf8b('0x19'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x1a')]);router[_0xaf8b('0x7')](_0xaf8b('0x1b'),auth['isAuthenticated'](),controller[_0xaf8b('0x1c')]);router[_0xaf8b('0x7')](_0xaf8b('0x1d'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x1e')]);router[_0xaf8b('0x7')](_0xaf8b('0x1f'),auth['isAuthenticated'](),controller[_0xaf8b('0x20')]);router[_0xaf8b('0x7')](_0xaf8b('0x21'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x22')]);router[_0xaf8b('0x7')](_0xaf8b('0x23'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x24')]);router[_0xaf8b('0x7')]('/:id/fax_accounts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x25')]);router['get'](_0xaf8b('0x26'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x27')]);router[_0xaf8b('0x7')](_0xaf8b('0x28'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x29')]);router[_0xaf8b('0x7')](_0xaf8b('0x2a'),auth[_0xaf8b('0x4')](),controller['getSmsAccounts']);router['get'](_0xaf8b('0x2b'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x2c')]);router['get']('/:id/whatsapp_accounts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x2d')]);router[_0xaf8b('0x7')](_0xaf8b('0x2e'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x2f')]);router[_0xaf8b('0x7')]('/:id/scheduled_calls',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x30')]);router[_0xaf8b('0x7')](_0xaf8b('0x31'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x32')]);router['post'](_0xaf8b('0x33'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x34')]);router[_0xaf8b('0x35')]('/:id/contacts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x36')]);router['post']('/',auth[_0xaf8b('0x4')](),controller['create']);router['post'](_0xaf8b('0xd'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x283723,_0x3d9960,_0x48f677){_0x48f677(null,path['join'](config[_0xaf8b('0x37')],_0xaf8b('0x38')));},'filename':function(_0x380cdf,_0xfbeedc,_0x4814b4){_0x4814b4(null,util[_0xaf8b('0x39')](_0xaf8b('0x3a'),Date[_0xaf8b('0x3b')](),_0xfbeedc['originalname']));}})});router[_0xaf8b('0x35')](_0xaf8b('0xa'),upload['single'](_0xaf8b('0x3c')),controller['addAvatar']);router[_0xaf8b('0x35')](_0xaf8b('0x3d'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x3e')]);router[_0xaf8b('0x35')](_0xaf8b('0x3f'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x40')]);router[_0xaf8b('0x35')](_0xaf8b('0x41'),auth['isAuthenticated'](),controller[_0xaf8b('0x42')]);router[_0xaf8b('0x35')]('/:id/unpause',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x43')]);router[_0xaf8b('0x35')](_0xaf8b('0x1d'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x44')]);router['post']('/:id/chat_interactions',auth[_0xaf8b('0x4')](),controller['addChatInteractions']);router[_0xaf8b('0x35')](_0xaf8b('0x45'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x46')]);router[_0xaf8b('0x35')](_0xaf8b('0x47'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x48')]);router[_0xaf8b('0x35')](_0xaf8b('0x49'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x4a')]);router[_0xaf8b('0x35')](_0xaf8b('0x4b'),auth[_0xaf8b('0x4')](),controller['addOpenchannelInteractions']);router[_0xaf8b('0x35')](_0xaf8b('0x4c'),auth[_0xaf8b('0x4')](),controller['addWhatsappInteractions']);router['post'](_0xaf8b('0x4d'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x4e')]);router[_0xaf8b('0x35')]('/:id/mail_accounts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x4f')]);router[_0xaf8b('0x35')]('/:id/openchannel_accounts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x50')]);router[_0xaf8b('0x35')](_0xaf8b('0x2a'),auth[_0xaf8b('0x4')](),controller['addSmsAccounts']);router['post'](_0xaf8b('0x2b'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0xaf8b('0x35')](_0xaf8b('0x51'),auth['isAuthenticated'](),controller[_0xaf8b('0x52')]);router['post']('/:id/square_projects',auth[_0xaf8b('0x4')](),controller['addSquareProjects']);router[_0xaf8b('0x35')]('/:id/api_key',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x53')]);router[_0xaf8b('0x54')](_0xaf8b('0x8'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x55')]);router[_0xaf8b('0x54')]('/:id/password',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x56')]);router[_0xaf8b('0x57')](_0xaf8b('0xd'),auth[_0xaf8b('0x4')](),controller['removeQueues']);router[_0xaf8b('0x57')](_0xaf8b('0x1d'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x58')]);router['delete']('/:id',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x59')]);router['delete'](_0xaf8b('0x5a'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5b')]);router[_0xaf8b('0x57')](_0xaf8b('0x45'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5c')]);router[_0xaf8b('0x57')]('/:id/fax_interactions',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5d')]);router[_0xaf8b('0x57')](_0xaf8b('0x49'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5e')]);router[_0xaf8b('0x57')](_0xaf8b('0x4b'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x5f')]);router['delete'](_0xaf8b('0x4c'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x60')]);router['delete']('/:id/fax_accounts',auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x61')]);router[_0xaf8b('0x57')](_0xaf8b('0x26'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x62')]);router['delete']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xaf8b('0x63')]);router[_0xaf8b('0x57')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xaf8b('0x64')]);router['delete'](_0xaf8b('0x2b'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x65')]);router[_0xaf8b('0x57')](_0xaf8b('0x51'),auth[_0xaf8b('0x4')](),controller['removeWhatsappAccounts']);router[_0xaf8b('0x57')](_0xaf8b('0x2e'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x66')]);router['delete'](_0xaf8b('0x31'),auth[_0xaf8b('0x4')](),controller[_0xaf8b('0x67')]);module[_0xaf8b('0x68')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index bb8cd17..f6255ed 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 _0x1482=['info','inband','auto','yes','nonat','update','nat','split','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','originate','uac','uas','certificate','active','passive','actpass','showWebBar','get','isArray','udp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','wss','avpf','force_avp','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','telephone','local','INTEGER','accountcode','callerid','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','rfc2833'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x1482,0x8f));var _0x2148=function(_0x33744d,_0x54a4fd){_0x33744d=_0x33744d-0x0;var _0x428b6e=_0x1482[_0x33744d];return _0x428b6e;};'use strict';var Sequelize=require(_0x2148('0x0'));var moment=require(_0x2148('0x1'));var util=require(_0x2148('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x2148('0x3')],'allowNull':![],'unique':_0x2148('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x47d160){this[_0x2148('0x5')]('name',_0x47d160);this[_0x2148('0x5')]('defaultuser',_0x47d160);},'comment':_0x2148('0x6')},'fullname':{'type':Sequelize[_0x2148('0x3')],'allowNull':![],'set':function(_0x4938cb){this[_0x2148('0x5')](_0x2148('0x7'),_0x4938cb);this[_0x2148('0x5')]('callerid',util[_0x2148('0x8')](_0x2148('0x9'),_0x4938cb,this[_0x2148('0xa')](_0x2148('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2148('0xc'),'validate':{'isEmail':!![]},'set':function(_0x3a7486){if(_0x3a7486){this['setDataValue'](_0x2148('0xc'),_0x3a7486[_0x2148('0xd')]());}}},'role':{'type':Sequelize[_0x2148('0xe')](_0x2148('0xf'),_0x2148('0x10'),'agent',_0x2148('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x2148('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x2148('0x3')],'defaultValue':_0x2148('0x12')},'internal':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':![],'unique':_0x2148('0xb'),'set':function(_0x35d26f){this['setDataValue'](_0x2148('0xb'),_0x35d26f);this[_0x2148('0x5')](_0x2148('0x14'),_0x35d26f);this[_0x2148('0x5')](_0x2148('0x15'),util[_0x2148('0x8')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0x2148('0x7')),_0x35d26f));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x2148('0x3')]},'mobile':{'type':Sequelize[_0x2148('0x3')]},'address':{'type':Sequelize[_0x2148('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x2148('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2148('0x3')],'defaultValue':_0x2148('0x17')},'lastPauseAt':{'type':Sequelize[_0x2148('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2148('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2148('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2148('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2148('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x2148('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2148('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x2148('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![],'defaultValue':_0x2148('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x2148('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x1a'),_0x2148('0x10'),'peer'),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![],'defaultValue':_0x2148('0x1b')},'callingpres':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x1c'),_0x2148('0x1d'),_0x2148('0x1e'),_0x2148('0x1f'),_0x2148('0x20'),_0x2148('0x21'),_0x2148('0x22'),_0x2148('0x23')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2febe8){this[_0x2148('0x5')](_0x2148('0x24'),_0x2febe8?_0x2febe8[_0x2148('0x25')](','):null);},'get':function(){return this[_0x2148('0xa')]('transport')?this['getDataValue'](_0x2148('0x24'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x26'),_0x2148('0x27'),'shortinfo',_0x2148('0x28'),_0x2148('0x29')),'allowNull':!![],'defaultValue':_0x2148('0x26')},'directmedia':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no',_0x2148('0x2b'),_0x2148('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x2148('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x2bb954){this['setDataValue']('nat',_0x2bb954?_0x2bb954[_0x2148('0x25')](','):null);},'get':function(){return this[_0x2148('0xa')](_0x2148('0x2d'))?this[_0x2148('0xa')](_0x2148('0x2d'))[_0x2148('0x2e')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2148('0x3')]},'pickupgroup':{'type':Sequelize[_0x2148('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x2148('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2148('0x3')]},'disallow':{'type':Sequelize[_0x2148('0x3')],'allowNull':![],'defaultValue':_0x2148('0x2f')},'allow':{'type':Sequelize[_0x2148('0x3')],'allowNull':![],'defaultValue':_0x2148('0x30'),'set':function(_0x47ce76){this['setDataValue'](_0x2148('0x31'),_0x47ce76?_0x47ce76[_0x2148('0x25')](';'):_0x2148('0x30'));},'get':function(){return this[_0x2148('0xa')](_0x2148('0x31'))?this['getDataValue'](_0x2148('0x31'))[_0x2148('0x2e')](';'):null;},'comment':_0x2148('0x32')},'autoframing':{'type':Sequelize[_0x2148('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![],'set':function(_0x328fe2){this[_0x2148('0x5')](_0x2148('0x33'),_0x328fe2?_0x328fe2[_0x2148('0x25')](','):null);},'get':function(){return this[_0x2148('0xa')](_0x2148('0x33'))?this[_0x2148('0xa')](_0x2148('0x33'))[_0x2148('0x2e')](','):null;},'comment':_0x2148('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2148('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2148('0x2a'),'no',_0x2148('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x2148('0x2a')},'busylevel':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2148('0xe')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x2148('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x2148('0xe')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no',_0x2148('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x37'),'refuse',_0x2148('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x39'),_0x2148('0x3a')),'allowNull':!![],'defaultValue':_0x2148('0x3a')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x2148('0x2a')},'keepalive':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2148('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2148('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x2148('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x2148('0x2a'),'no','fingerprint',_0x2148('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x3c'),_0x2148('0x3d'),_0x2148('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x2148('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2148('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x2148('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x2148('0xe')]('yes','no',_0x2148('0x2b'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2148('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize[_0x2148('0x13')],'defaultValue':0x0,'set':function(_0x1a79f5){this['setDataValue'](_0x2148('0x3f'),_0x1a79f5);var _0x337ab9=this[_0x2148('0x40')]({'plain':!![]});switch(_0x1a79f5){case 0x0:case 0x1:var _0xe05a5=_0x337ab9[_0x2148('0x24')]?_[_0x2148('0x41')](_0x337ab9[_0x2148('0x24')])?_0x337ab9[_0x2148('0x24')][_0x2148('0x25')]():_0x337ab9[_0x2148('0x24')]:_0x2148('0x42');if(_0xe05a5==='wss'){_0xe05a5=_0x2148('0x42');}this[_0x2148('0x5')](_0x2148('0x24'),_0xe05a5);this[_0x2148('0x5')]('encryption','no');this[_0x2148('0x5')]('avpf',null);this['setDataValue']('force_avp',null);this['setDataValue'](_0x2148('0x43'),null);this[_0x2148('0x5')](_0x2148('0x44'),null);this[_0x2148('0x5')](_0x2148('0x45'),null);this[_0x2148('0x5')]('dtlssetup',null);this[_0x2148('0x5')](_0x2148('0x46'),null);this['setDataValue'](_0x2148('0x47'),null);this[_0x2148('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x2148('0x24'),_0x2148('0x48'));this[_0x2148('0x5')]('encryption',_0x2148('0x2a'));this[_0x2148('0x5')](_0x2148('0x49'),_0x2148('0x2a'));this[_0x2148('0x5')](_0x2148('0x4a'),_0x2148('0x2a'));this[_0x2148('0x5')](_0x2148('0x43'),_0x2148('0x2a'));this['setDataValue'](_0x2148('0x44'),_0x2148('0x2a'));this[_0x2148('0x5')](_0x2148('0x45'),'no');this[_0x2148('0x5')](_0x2148('0x4b'),_0x2148('0x3e'));this['setDataValue']('dtlscertfile',_0x337ab9[_0x2148('0x46')]||_0x2148('0x4c'));this[_0x2148('0x5')]('dtlsprivatekey',_0x337ab9['dtlsprivatekey']||_0x2148('0x4d'));this['setDataValue'](_0x2148('0x4e'),_0x2148('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x2148('0x4f')],'set':function(_0x26293f){this['setDataValue'](_0x2148('0x50'),_0x26293f?_0x26293f[_0x2148('0x25')](','):[]);},'get':function(){return this[_0x2148('0xa')](_0x2148('0x50'))?_[_0x2148('0x51')](this[_0x2148('0xa')]('permissions')['split'](','),function(_0x42efb5){return parseInt(_0x42efb5,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2148('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x2148('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x2148('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x2148('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x2148('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2148('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2148('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2148('0xe')](_0x2148('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2148('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2148('0x3')]},'passwordResetAt':{'type':Sequelize[_0x2148('0x18')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2148('0x52')],'get':function(){return this[_0x2148('0xa')](_0x2148('0x53'))?this[_0x2148('0xa')](_0x2148('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x2148('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2148('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![],'set':function(_0x403bcc){if(typeof _0x403bcc===_0x2148('0x54')){var _0x256a00=_0x403bcc==='1'?!![]:_0x403bcc==='0'?![]:_0x403bcc===_0x2148('0x55')?!![]:_0x403bcc===_0x2148('0x56')?![]:![];this[_0x2148('0x5')](_0x2148('0x57'),_0x256a00);}else{this[_0x2148('0x5')](_0x2148('0x57'),_0x403bcc);}}},'blocked':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![],'set':function(_0x3856b7){this[_0x2148('0x5')](_0x2148('0x58'),_0x3856b7);if(_0x3856b7===!![]){this['setDataValue'](_0x2148('0x59'),moment());this['setDataValue'](_0x2148('0x5a'),0x0);}else{this[_0x2148('0x5')](_0x2148('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0x2148('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2148('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0xbeda=['rfc2833','info','shortinfo','inband','auto','update','yes','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','accept','uac','uas','fingerprint','active','passive','actpass','nonat','update,nonat','get','isArray','encryption','force_avp','icesupport','dtlsenable','dtlscertfile','rtcp_mux','wss','avpf','dtlssetup','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','admin','agent','telephone','local','INTEGER','accountcode','getDataValue','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xbeda,0x8c));var _0xabed=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbeda[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xabed('0x0'));var moment=require(_0xabed('0x1'));var util=require(_0xabed('0x2'));var _=require(_0xabed('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x581a73){this['setDataValue']('name',_0x581a73);this[_0xabed('0x4')](_0xabed('0x5'),_0x581a73);},'comment':_0xabed('0x6')},'fullname':{'type':Sequelize[_0xabed('0x7')],'allowNull':![],'set':function(_0x126462){this[_0xabed('0x4')]('fullname',_0x126462);this[_0xabed('0x4')](_0xabed('0x8'),util[_0xabed('0x9')](_0xabed('0xa'),_0x126462,this['getDataValue'](_0xabed('0xb'))));}},'alias':{'type':Sequelize[_0xabed('0x7')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xabed('0xc'),'validate':{'isEmail':!![]},'set':function(_0x223c40){if(_0x223c40){this['setDataValue']('email',_0x223c40[_0xabed('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0xabed('0xe'),'user',_0xabed('0xf'),_0xabed('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xabed('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xabed('0x7')],'defaultValue':_0xabed('0x11')},'internal':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':![],'unique':'internal','set':function(_0x206e4b){this[_0xabed('0x4')](_0xabed('0xb'),_0x206e4b);this[_0xabed('0x4')](_0xabed('0x13'),_0x206e4b);this[_0xabed('0x4')]('callerid',util[_0xabed('0x9')](_0xabed('0xa'),this[_0xabed('0x14')](_0xabed('0x15')),_0x206e4b));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xabed('0x7')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xabed('0x7')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xabed('0x7')]},'country':{'type':Sequelize[_0xabed('0x7')]},'online':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xabed('0x7')],'defaultValue':_0xabed('0x17')},'lastPauseAt':{'type':Sequelize[_0xabed('0x18')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xabed('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'host':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'defaultValue':_0xabed('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xabed('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0xabed('0x1a')},'context':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'defaultValue':_0xabed('0x1b')},'callingpres':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x1d'),_0xabed('0x1e'),'ALLOWED_FAILED_SCREEN',_0xabed('0x1f'),_0xabed('0x20'),_0xabed('0x21'),_0xabed('0x22'),_0xabed('0x23')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'defaultValue':_0xabed('0x24'),'set':function(_0x506796){this[_0xabed('0x4')](_0xabed('0x25'),_0x506796?_0x506796[_0xabed('0x26')](','):null);},'get':function(){return this[_0xabed('0x14')](_0xabed('0x25'))?this['getDataValue'](_0xabed('0x25'))['split'](','):null;},'comment':_0xabed('0x27')},'dtmfmode':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x28'),_0xabed('0x29'),_0xabed('0x2a'),_0xabed('0x2b'),_0xabed('0x2c')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xabed('0x1c')]('yes','no','nonat',_0xabed('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'defaultValue':_0xabed('0x2f'),'set':function(_0x2eafac){this[_0xabed('0x4')](_0xabed('0x30'),_0x2eafac?_0x2eafac[_0xabed('0x26')](','):null);},'get':function(){return this[_0xabed('0x14')](_0xabed('0x30'))?this[_0xabed('0x14')]('nat')[_0xabed('0x31')](','):null;},'comment':_0xabed('0x32')},'callgroup':{'type':Sequelize[_0xabed('0x7')]},'namedcallgroup':{'type':Sequelize[_0xabed('0x7')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xabed('0x7')]},'language':{'type':Sequelize[_0xabed('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xabed('0x7')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xabed('0x33')},'allow':{'type':Sequelize[_0xabed('0x7')],'allowNull':![],'defaultValue':_0xabed('0x34'),'set':function(_0x580192){this[_0xabed('0x4')]('allow',_0x580192?_0x580192['join'](';'):_0xabed('0x34'));},'get':function(){return this[_0xabed('0x14')](_0xabed('0x35'))?this[_0xabed('0x14')]('allow')[_0xabed('0x31')](';'):null;},'comment':_0xabed('0x36')},'autoframing':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'set':function(_0x48c07a){this[_0xabed('0x4')](_0xabed('0x37'),_0x48c07a?_0x48c07a['join'](','):null);},'get':function(){return this[_0xabed('0x14')]('insecure')?this[_0xabed('0x14')](_0xabed('0x37'))[_0xabed('0x31')](','):null;},'comment':_0xabed('0x38')},'trustrpid':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no',_0xabed('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xabed('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xabed('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xabed('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x3a'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x3b'),_0xabed('0x3c')),'allowNull':!![],'defaultValue':_0xabed('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xabed('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xabed('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no',_0xabed('0x3d'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xabed('0x3e'),_0xabed('0x3f'),_0xabed('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xabed('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xabed('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xabed('0x1c')](_0xabed('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xabed('0x1c')]('yes','no',_0xabed('0x41'),'update',_0xabed('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xabed('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0xabed('0x18')]},'showWebBar':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0,'set':function(_0x5ec4dd){this['setDataValue']('showWebBar',_0x5ec4dd);var _0x57edb3=this[_0xabed('0x43')]({'plain':!![]});switch(_0x5ec4dd){case 0x0:case 0x1:var _0x1768ca=_0x57edb3[_0xabed('0x25')]?_[_0xabed('0x44')](_0x57edb3['transport'])?_0x57edb3[_0xabed('0x25')][_0xabed('0x26')]():_0x57edb3[_0xabed('0x25')]:_0xabed('0x24');if(_0x1768ca==='wss'){_0x1768ca=_0xabed('0x24');}this['setDataValue'](_0xabed('0x25'),_0x1768ca);this['setDataValue'](_0xabed('0x45'),'no');this['setDataValue']('avpf',null);this[_0xabed('0x4')](_0xabed('0x46'),null);this[_0xabed('0x4')](_0xabed('0x47'),null);this[_0xabed('0x4')](_0xabed('0x48'),null);this[_0xabed('0x4')]('dtlsverify',null);this[_0xabed('0x4')]('dtlssetup',null);this['setDataValue'](_0xabed('0x49'),null);this[_0xabed('0x4')]('dtlsprivatekey',null);this[_0xabed('0x4')](_0xabed('0x4a'),'no');break;case 0x2:this[_0xabed('0x4')](_0xabed('0x25'),_0xabed('0x4b'));this[_0xabed('0x4')]('encryption',_0xabed('0x2e'));this['setDataValue'](_0xabed('0x4c'),_0xabed('0x2e'));this[_0xabed('0x4')](_0xabed('0x46'),_0xabed('0x2e'));this[_0xabed('0x4')](_0xabed('0x47'),_0xabed('0x2e'));this[_0xabed('0x4')](_0xabed('0x48'),_0xabed('0x2e'));this[_0xabed('0x4')]('dtlsverify','no');this[_0xabed('0x4')](_0xabed('0x4d'),_0xabed('0x40'));this[_0xabed('0x4')](_0xabed('0x49'),_0x57edb3[_0xabed('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0xabed('0x4')](_0xabed('0x4e'),_0x57edb3['dtlsprivatekey']||_0xabed('0x4f'));this[_0xabed('0x4')]('rtcp_mux',_0xabed('0x2e'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x24fd74){this['setDataValue'](_0xabed('0x50'),_0x24fd74?_0x24fd74[_0xabed('0x26')](','):[]);},'get':function(){return this[_0xabed('0x14')](_0xabed('0x50'))?_[_0xabed('0x51')](this[_0xabed('0x14')]('permissions')['split'](','),function(_0x129a26){return parseInt(_0x129a26,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xabed('0x7')]},'phoneBarUnconditional':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xabed('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xabed('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xabed('0x1c')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xabed('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xabed('0x7')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xabed('0x52')],'get':function(){return this[_0xabed('0x14')]('phoneBarEnableScreenRecordingByAgent')?this[_0xabed('0x14')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xabed('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xabed('0x7')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![],'set':function(_0x3f2c33){if(typeof _0x3f2c33===_0xabed('0x53')){var _0x59f26b=_0x3f2c33==='1'?!![]:_0x3f2c33==='0'?![]:_0x3f2c33===_0xabed('0x54')?!![]:_0x3f2c33===_0xabed('0x55')?![]:![];this[_0xabed('0x4')](_0xabed('0x56'),_0x59f26b);}else{this[_0xabed('0x4')]('screenrecording',_0x3f2c33);}}},'blocked':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![],'set':function(_0x5c2402){this[_0xabed('0x4')](_0xabed('0x57'),_0x5c2402);if(_0x5c2402===!![]){this['setDataValue'](_0xabed('0x58'),moment());this[_0xabed('0x4')](_0xabed('0x59'),0x0);}else{this[_0xabed('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xabed('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xabed('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xabed('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index f0d0d52..b65de19 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 _0x1c2f=['isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','CmHopper','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.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','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','Users','Agents','agent','Telephones','telephone','filter','role','find','value','name','stack','index','User','rawAttributes','type','key','model','differenceBy','map','password','salt','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','sequelize','lower','options','count','includeAll','findAll','rows','params','filters','include','bulkCreate','body','describe','addContacts','ids','omit','agent\x20role','../../config/license/util','getLicense','telephones','users','License\x20limit\x20reached','create','internal','Setting','min_internal','max','isNil','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','fullname','email','permissions','101','103','113','110','104','106','107','108','109','100','111','VoiceMail','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','UserProfileResource','changePassword','findOne','securePassword','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','admin','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','loginInPause','voicePause','interface','capitalize','Queues','penalty','spread','toLowerCase','QueueId','emit','Queue:save','voice','VoiceQueue','online','push','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','Unknown\x20channel','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','root','download','existsSync','join','server/files/images/','CmContact','getContacts','hasOwnProperty','List','Tag','Tags','color','tag','getQueues','isValidChannel','pick','Queue','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','each','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','logout','all','pause','QueuePause','unpause','faxPause','openchannelPause','smsPause','whatsapppause','manual','sms','whatsapp','openchannel','%s%s','Pause','getTeams','addTeams','Team','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','setDataValue','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','removeAgent','getLists','getAgents','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions'];(function(_0x597b3b,_0x3febc1){var _0x2bf1db=function(_0x99d339){while(--_0x99d339){_0x597b3b['push'](_0x597b3b['shift']());}};_0x2bf1db(++_0x3febc1);}(_0x1c2f,0x1c3));var _0xf1c2=function(_0x3b3be2,_0x166b4f){_0x3b3be2=_0x3b3be2-0x0;var _0x46858e=_0x1c2f[_0x3b3be2];return _0x46858e;};'use strict';var pdf=require(_0xf1c2('0x0'));var emlformat=require(_0xf1c2('0x1'));var rimraf=require(_0xf1c2('0x2'));var zipdir=require(_0xf1c2('0x3'));var jsonpatch=require(_0xf1c2('0x4'));var rp=require(_0xf1c2('0x5'));var moment=require('moment');var BPromise=require(_0xf1c2('0x6'));var Mustache=require(_0xf1c2('0x7'));var util=require(_0xf1c2('0x8'));var path=require(_0xf1c2('0x9'));var sox=require('sox');var csv=require(_0xf1c2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf1c2('0xb'));var squel=require(_0xf1c2('0xc'));var crypto=require(_0xf1c2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf1c2('0xe'));var toCsv=require(_0xf1c2('0xa'));var querystring=require('querystring');var Papa=require(_0xf1c2('0xf'));var Redis=require(_0xf1c2('0x10'));var authService=require(_0xf1c2('0x11'));var qs=require(_0xf1c2('0x12'));var as=require(_0xf1c2('0x13'));var hardwareService=require(_0xf1c2('0x14'));var logger=require(_0xf1c2('0x15'))(_0xf1c2('0x16'));var utils=require(_0xf1c2('0x17'));var config=require('../../config/environment');var db=require(_0xf1c2('0x18'))['db'];config[_0xf1c2('0x19')]=_[_0xf1c2('0x1a')](config[_0xf1c2('0x19')],{'host':_0xf1c2('0x1b'),'port':0x18eb});var socket=require(_0xf1c2('0x1c'))(new Redis(config[_0xf1c2('0x19')]));require(_0xf1c2('0x1d'))[_0xf1c2('0x1e')](socket);var jayson=require(_0xf1c2('0x1f'));var client=jayson[_0xf1c2('0x20')][_0xf1c2('0x21')]({'port':0x232a});function checkPasswordPattern(_0x4fe5ea,_0x497b41,_0x3aa22e){if(_0x3aa22e){var _0x3d50b6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d50b6[_0xf1c2('0x22')](_0x497b41)){return _0x4fe5ea;}else{throw new db[(_0xf1c2('0x23'))][(_0xf1c2('0x24'))](_0xf1c2('0x25'));}}else{return _0x4fe5ea;}}function respondWithRpcPromise(_0x3d5538,_0x574719,_0x4cc13c,_0x53b450){return new BPromise(function(_0x59264d,_0x1e0e02){var _0x5f468a=_0x53b450||client;return _0x5f468a[_0xf1c2('0x26')](_0x3d5538,_0x4cc13c)[_0xf1c2('0x27')](function(_0x78a751){logger['info'](_0xf1c2('0x28'),_0x574719,_0xf1c2('0x29'));logger[_0xf1c2('0x2a')](_0xf1c2('0x2b'),_0x574719,'request\x20sent',JSON[_0xf1c2('0x2c')](_0x78a751));if(_0x78a751[_0xf1c2('0x2d')]){if(_0x78a751[_0xf1c2('0x2d')][_0xf1c2('0x2e')]===0x1f4){logger['error'](_0xf1c2('0x28'),_0x574719,_0x78a751[_0xf1c2('0x2d')][_0xf1c2('0x2f')]);return _0x1e0e02(_0x78a751[_0xf1c2('0x2d')][_0xf1c2('0x2f')]);}logger[_0xf1c2('0x2d')](_0xf1c2('0x28'),_0x574719,_0x78a751['error'][_0xf1c2('0x2f')]);return _0x59264d(_0x78a751[_0xf1c2('0x2d')]['message']);}else{logger[_0xf1c2('0x30')](_0xf1c2('0x28'),_0x574719,'request\x20sent');_0x59264d(_0x78a751['result']['message']);}})[_0xf1c2('0x31')](function(_0x3d1a26){logger[_0xf1c2('0x2d')](_0xf1c2('0x28'),_0x574719,_0x3d1a26);_0x1e0e02(_0x3d1a26);});});}function respondWithStatusCode(_0x13befc,_0x173210){_0x173210=_0x173210||0xcc;return function(_0x32d910){if(_0x32d910){return _0x13befc[_0xf1c2('0x32')](_0x173210);}return _0x13befc[_0xf1c2('0x33')](_0x173210)[_0xf1c2('0x34')]();};}function respondWithResult(_0xcfb32f,_0x20612d){_0x20612d=_0x20612d||0xc8;return function(_0x33dcdf){if(_0x33dcdf){return _0xcfb32f[_0xf1c2('0x33')](_0x20612d)[_0xf1c2('0x35')](_0x33dcdf);}};}function respondWithFilteredResult(_0x1ed76f,_0x2e904a){return function(_0x19daf5){if(_0x19daf5){var _0x449126=_0x19daf5['count'],_0x2347e7=_0x2e904a['offset'],_0xec1b47=_0x2e904a[_0xf1c2('0x36')]+_0x2e904a[_0xf1c2('0x37')],_0x22773;if(_0xec1b47>=_0x449126){_0xec1b47=_0x449126;_0x22773=0xc8;}else{_0x22773=0xce;}_0x1ed76f[_0xf1c2('0x33')](_0x22773);return _0x1ed76f[_0xf1c2('0x38')](_0xf1c2('0x39'),_0x2347e7+'-'+_0xec1b47+'/'+_0x449126)['json'](_0x19daf5);}return null;};}function patchUpdates(_0x34bddf){return function(_0x585833){try{jsonpatch[_0xf1c2('0x3a')](_0x585833,_0x34bddf,!![]);}catch(_0x33012){return BPromise[_0xf1c2('0x3b')](_0x33012);}return _0x585833[_0xf1c2('0x3c')]();};}function saveUpdates(_0x26332d,_0x163b23){return function(_0x4b2654){if(_0x4b2654){return _0x4b2654[_0xf1c2('0x3d')](_0x26332d)[_0xf1c2('0x27')](function(_0x506636){return _0x506636;});}return null;};}function removeEntity(_0x326e9e,_0x165de0){return function(_0x5a86b7){if(_0x5a86b7){return _0x5a86b7[_0xf1c2('0x3e')]()['then'](function(){var _0x45f190=_0x5a86b7['get']({'plain':!![]});var _0x2aa392=[{'name':_0xf1c2('0x3f'),'value':'user','ignore':!![]},{'name':_0xf1c2('0x40'),'value':_0xf1c2('0x41'),'ignore':![]},{'name':_0xf1c2('0x42'),'value':_0xf1c2('0x43'),'ignore':![]}];var _0x3d17bc=_(_0x2aa392)[_0xf1c2('0x44')]('ignore')['map']('value')['value']();if(_['includes'](_0x3d17bc,_0x45f190[_0xf1c2('0x45')])){return;}var _0x205207=_[_0xf1c2('0x46')](_0x2aa392,[_0xf1c2('0x47'),_0x45f190[_0xf1c2('0x45')]])[_0xf1c2('0x48')];return db['UserProfileResource']['destroy']({'where':{'type':_0x205207,'resourceId':_0x45f190['id']}})['then'](function(){return _0x5a86b7;});})[_0xf1c2('0x27')](function(){_0x326e9e[_0xf1c2('0x33')](0xcc)[_0xf1c2('0x34')]();});}};}function handleEntityNotFound(_0x131d40,_0x289b64){return function(_0xf64ef7){if(!_0xf64ef7){_0x131d40[_0xf1c2('0x32')](0x194);}return _0xf64ef7;};}function handleError(_0x5e4d9f,_0x24084a){_0x24084a=_0x24084a||0x1f4;return function(_0x33e402){logger[_0xf1c2('0x2d')](_0x33e402[_0xf1c2('0x49')]);if(_0x33e402['name']){delete _0x33e402[_0xf1c2('0x48')];}_0x5e4d9f[_0xf1c2('0x33')](_0x24084a)['send'](_0x33e402);};}exports[_0xf1c2('0x4a')]=function(_0x6f9041,_0x2c9cef){var _0x4c6d80={},_0x1cc7de={},_0x581a96={'count':0x0,'rows':[]};var _0x3eef15=_['map'](db[_0xf1c2('0x4b')][_0xf1c2('0x4c')],function(_0x57adf8){return{'name':_0x57adf8['fieldName'],'type':_0x57adf8[_0xf1c2('0x4d')][_0xf1c2('0x4e')]};});_0x1cc7de[_0xf1c2('0x4f')]=_[_0xf1c2('0x50')](_[_0xf1c2('0x51')](_0x3eef15,'name'),[_0xf1c2('0x52'),_0xf1c2('0x53')]);_0x1cc7de[_0xf1c2('0x54')]=_[_0xf1c2('0x55')](_0x6f9041['query']);_0x1cc7de['filters']=_[_0xf1c2('0x56')](_0x1cc7de[_0xf1c2('0x4f')],_0x1cc7de['query']);_0x4c6d80[_0xf1c2('0x57')]=_['intersection'](_0x1cc7de[_0xf1c2('0x4f')],qs[_0xf1c2('0x58')](_0x6f9041[_0xf1c2('0x54')][_0xf1c2('0x58')]));_0x4c6d80[_0xf1c2('0x57')]=_0x4c6d80['attributes'][_0xf1c2('0x59')]?_0x4c6d80[_0xf1c2('0x57')]:_0x1cc7de['model'];if(!_0x6f9041[_0xf1c2('0x54')]['hasOwnProperty'](_0xf1c2('0x5a'))){_0x4c6d80[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x6f9041[_0xf1c2('0x54')][_0xf1c2('0x37')]);_0x4c6d80[_0xf1c2('0x36')]=qs['offset'](_0x6f9041['query'][_0xf1c2('0x36')]);}_0x4c6d80[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x6f9041[_0xf1c2('0x54')]['sort']);_0x4c6d80[_0xf1c2('0x5d')]=qs['filters'](_['pick'](_0x6f9041[_0xf1c2('0x54')],_0x1cc7de['filters']),_0x3eef15);if(_0x6f9041[_0xf1c2('0x54')]['filter']){_0x4c6d80[_0xf1c2('0x5d')]=_[_0xf1c2('0x5e')](_0x4c6d80[_0xf1c2('0x5d')],{'$or':_[_0xf1c2('0x51')](_0x3eef15,function(_0x3ab220){if(_0x3ab220[_0xf1c2('0x4d')]!==_0xf1c2('0x5f')){return db[_0xf1c2('0x60')][_0xf1c2('0x5d')](db[_0xf1c2('0x60')]['fn'](_0xf1c2('0x61'),db[_0xf1c2('0x60')]['col'](_0x3ab220[_0xf1c2('0x48')])),{'$like':db['sequelize']['fn'](_0xf1c2('0x61'),'%'+_0x6f9041[_0xf1c2('0x54')][_0xf1c2('0x44')]+'%')});}})});}_0x4c6d80=_[_0xf1c2('0x5e')]({},_0x4c6d80,_0x6f9041[_0xf1c2('0x62')]);var _0x25a2e5={'where':_0x4c6d80[_0xf1c2('0x5d')]};return db[_0xf1c2('0x4b')]['count'](_0x25a2e5)['then'](function(_0x14ca7a){_0x581a96[_0xf1c2('0x63')]=_0x14ca7a;if(_0x6f9041[_0xf1c2('0x54')][_0xf1c2('0x64')]){_0x4c6d80['include']=[{'all':!![]}];}return db['User'][_0xf1c2('0x65')](_0x4c6d80);})[_0xf1c2('0x27')](function(_0x54551d){_0x581a96[_0xf1c2('0x66')]=_0x54551d;return _0x581a96;})[_0xf1c2('0x27')](respondWithFilteredResult(_0x2c9cef,_0x4c6d80))['catch'](handleError(_0x2c9cef,null));};exports['show']=function(_0x5478e9,_0x16b427){var _0x2c9ec9={'raw':![],'where':{'id':_0x5478e9[_0xf1c2('0x67')]['id']}},_0x2d5fe9={};_0x2d5fe9[_0xf1c2('0x4f')]=_[_0xf1c2('0x50')](_[_0xf1c2('0x55')](db['User'][_0xf1c2('0x4c')]),['password',_0xf1c2('0x53')]);_0x2d5fe9['query']=_[_0xf1c2('0x55')](_0x5478e9[_0xf1c2('0x54')]);_0x2d5fe9[_0xf1c2('0x68')]=_[_0xf1c2('0x56')](_0x2d5fe9[_0xf1c2('0x4f')],_0x2d5fe9[_0xf1c2('0x54')]);_0x2c9ec9[_0xf1c2('0x57')]=_[_0xf1c2('0x56')](_0x2d5fe9[_0xf1c2('0x4f')],qs[_0xf1c2('0x58')](_0x5478e9[_0xf1c2('0x54')][_0xf1c2('0x58')]));_0x2c9ec9['attributes']=_0x2c9ec9['attributes']['length']?_0x2c9ec9[_0xf1c2('0x57')]:_0x2d5fe9['model'];if(_0x5478e9['query'][_0xf1c2('0x64')]){_0x2c9ec9[_0xf1c2('0x69')]=[{'all':!![]}];}_0x2c9ec9=_['merge']({},_0x2c9ec9,_0x5478e9['options']);return db[_0xf1c2('0x4b')][_0xf1c2('0x46')](_0x2c9ec9)[_0xf1c2('0x27')](handleEntityNotFound(_0x16b427,null))[_0xf1c2('0x27')](respondWithResult(_0x16b427,null))[_0xf1c2('0x31')](handleError(_0x16b427,null));};exports[_0xf1c2('0x6a')]=function(_0x355775,_0x5931bd){return db[_0xf1c2('0x4b')][_0xf1c2('0x6a')](_0x355775[_0xf1c2('0x6b')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5931bd,0xc9))[_0xf1c2('0x31')](handleError(_0x5931bd,null));};exports[_0xf1c2('0x3d')]=function(_0xe94887,_0x3efa5d){if(_0xe94887['body']['id']){delete _0xe94887[_0xf1c2('0x6b')]['id'];}delete _0xe94887[_0xf1c2('0x6b')][_0xf1c2('0x45')];return db[_0xf1c2('0x4b')][_0xf1c2('0x46')]({'where':{'id':_0xe94887[_0xf1c2('0x67')]['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x3efa5d,null))[_0xf1c2('0x27')](saveUpdates(_0xe94887[_0xf1c2('0x6b')],null))[_0xf1c2('0x27')](respondWithResult(_0x3efa5d,null))[_0xf1c2('0x31')](handleError(_0x3efa5d,null));};exports[_0xf1c2('0x6c')]=function(_0x10c37b,_0x3e304e){return db[_0xf1c2('0x4b')][_0xf1c2('0x6c')]()[_0xf1c2('0x27')](respondWithResult(_0x3e304e,null))[_0xf1c2('0x31')](handleError(_0x3e304e,null));};exports[_0xf1c2('0x6d')]=function(_0x136532,_0x2f6736,_0x32af84){return db[_0xf1c2('0x4b')]['find']({'where':{'id':_0x136532[_0xf1c2('0x67')]['id']}})['then'](handleEntityNotFound(_0x2f6736,null))['then'](function(_0xd93484){if(_0xd93484){return _0xd93484[_0xf1c2('0x6d')](_0x136532[_0xf1c2('0x6b')][_0xf1c2('0x6e')],_[_0xf1c2('0x6f')](_0x136532[_0xf1c2('0x6b')],['ids','id'])||{});}})[_0xf1c2('0x27')](respondWithResult(_0x2f6736,null))[_0xf1c2('0x31')](handleError(_0x2f6736,null));};var getLicense=function(_0x3e8e62){return new BPromise(function(_0x4a5507,_0x569228){var _0x127b17=0x0;_0x3e8e62['body']['role']===_0xf1c2('0x41')&&_0x4a5507(_0xf1c2('0x70'));return db[_0xf1c2('0x4b')]['count']({'where':{'$or':[{'role':_0x3e8e62[_0xf1c2('0x6b')]['role']===_0xf1c2('0x43')?_0xf1c2('0x43'):['admin','user']}]}})['then'](function(_0x4bc10c){_0x127b17=_0x4bc10c;return require(_0xf1c2('0x71'))[_0xf1c2('0x72')]();})[_0xf1c2('0x27')](function(_0x296e25){var _0x58437f=_0x3e8e62['body'][_0xf1c2('0x45')]===_0xf1c2('0x43')?_0xf1c2('0x73'):_0xf1c2('0x74');if(!_['isNil'](_0x296e25[_0x58437f])&&_0x127b17>=_0x296e25[_0x58437f]){return _0x569228({'message':_0xf1c2('0x75')});}return _0x4a5507(util['format']('count\x20%s:\x20%s',_0x58437f,_0x127b17));})[_0xf1c2('0x31')](function(_0x10bbb4){return _0x569228(_0x10bbb4);});});};exports[_0xf1c2('0x76')]=function(_0x31443b,_0xb38878){return getLicense(_0x31443b)[_0xf1c2('0x27')](function(_0x534d86){if(!_0x31443b[_0xf1c2('0x6b')][_0xf1c2('0x77')]){var _0x1306e8;return db[_0xf1c2('0x78')]['findById'](0x1)[_0xf1c2('0x27')](function(_0x1e3d5d){return checkPasswordPattern(_0x1e3d5d,_0x31443b[_0xf1c2('0x6b')][_0xf1c2('0x52')],_0x1e3d5d['securePassword']);})[_0xf1c2('0x27')](function(_0x1a685c){_0x1306e8=_0x1a685c[_0xf1c2('0x79')];return db[_0xf1c2('0x4b')][_0xf1c2('0x7a')](_0xf1c2('0x77'));})[_0xf1c2('0x27')](function(_0x583262){if(_['isNil'](_0x583262)){if(_0x1306e8){_0x31443b[_0xf1c2('0x6b')][_0xf1c2('0x77')]=_0x1306e8;}else{_0x31443b['body'][_0xf1c2('0x77')]=0x1;}}else{if(_[_0xf1c2('0x7b')](_0x1306e8)||_0x1306e8==_0x583262){_0x31443b['body'][_0xf1c2('0x77')]=_0x583262+0x1;}else if(_0x1306e8>_0x583262){_0x31443b['body'][_0xf1c2('0x77')]=_0x1306e8;}else{return db[_0xf1c2('0x60')]['query'](_0xf1c2('0x7c'),{'type':db['sequelize'][_0xf1c2('0x7d')][_0xf1c2('0x7e')]})[_0xf1c2('0x27')](function(_0x449333){if(_0x449333&&_0x449333[_0xf1c2('0x59')]){for(var _0x17b679=0x0,_0x3d3ff2=_0x449333[_0xf1c2('0x59')];_0x17b679<_0x3d3ff2&&_[_0xf1c2('0x7b')](_0x31443b['body']['internal']);_0x17b679++){if(_0x1306e8<=_0x449333[_0x17b679][_0xf1c2('0x7f')]){_0x31443b[_0xf1c2('0x6b')]['internal']=_0x449333[_0x17b679][_0xf1c2('0x7f')];}else if(_0x1306e8>_0x449333[_0x17b679][_0xf1c2('0x7f')]&&_0x1306e8<=_0x449333[_0x17b679]['to']){_0x31443b['body']['internal']=_0x1306e8;}}}if(_[_0xf1c2('0x7b')](_0x31443b[_0xf1c2('0x6b')][_0xf1c2('0x77')])){_0x31443b[_0xf1c2('0x6b')][_0xf1c2('0x77')]=_0x583262+0x1;}});}}});}})['then'](function(){if(_0x31443b['body']['voicemail']){_0x31443b['body'][_0xf1c2('0x80')]=_0x31443b[_0xf1c2('0x6b')][_0xf1c2('0x77')];_0x31443b[_0xf1c2('0x6b')]['VoiceMail']={'mailbox':_0x31443b['body'][_0xf1c2('0x77')],'password':_0x31443b['body'][_0xf1c2('0x52')],'fullname':_0x31443b['body'][_0xf1c2('0x81')],'email':_0x31443b[_0xf1c2('0x6b')][_0xf1c2('0x82')]};}if(_0x31443b['body']&&_0x31443b[_0xf1c2('0x6b')][_0xf1c2('0x45')]===_0xf1c2('0x41')){if(!_0x31443b['body'][_0xf1c2('0x83')]){_0x31443b[_0xf1c2('0x6b')][_0xf1c2('0x83')]=[_0xf1c2('0x84'),'102',_0xf1c2('0x85'),_0xf1c2('0x86'),_0xf1c2('0x87'),_0xf1c2('0x88'),'105',_0xf1c2('0x89'),_0xf1c2('0x8a'),_0xf1c2('0x8b'),_0xf1c2('0x8c'),_0xf1c2('0x8d'),_0xf1c2('0x8e'),'114'];}}return db['User'][_0xf1c2('0x76')](_0x31443b['body'],{'include':[{'model':db[_0xf1c2('0x8f')],'as':_0xf1c2('0x8f')}]});})[_0xf1c2('0x27')](function(_0x205b70){if(_0x31443b[_0xf1c2('0x6b')][_0xf1c2('0x45')]===_0xf1c2('0x90'))return _0x205b70;var _0x26bff4=_0x31443b[_0xf1c2('0x90')]['get']({'plain':!![]});if(!_0x26bff4)throw new Error(_0xf1c2('0x91'));if(_0x26bff4['role']===_0xf1c2('0x90')){var _0x29e039=_0x205b70[_0xf1c2('0x92')]({'plain':!![]});var _0x16475d=[{'name':_0xf1c2('0x40'),'value':_0xf1c2('0x41')},{'name':_0xf1c2('0x42'),'value':'telephone'}];var _0x12a6d0=_[_0xf1c2('0x46')](_0x16475d,[_0xf1c2('0x47'),_0x29e039[_0xf1c2('0x45')]])[_0xf1c2('0x48')];return db[_0xf1c2('0x93')][_0xf1c2('0x46')]({'where':{'name':_0x12a6d0,'userProfileId':_0x26bff4[_0xf1c2('0x94')]},'raw':!![]})[_0xf1c2('0x27')](function(_0x198a02){if(_0x198a02&&_0x198a02['autoAssociation']===0x0){return db[_0xf1c2('0x95')]['create']({'name':_0x29e039[_0xf1c2('0x48')],'resourceId':_0x29e039['id'],'type':_0x198a02[_0xf1c2('0x48')],'sectionId':_0x198a02['id']},{})['then'](function(){return _0x205b70;});}else{return _0x205b70;}})['catch'](function(_0x121db5){logger[_0xf1c2('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x121db5);throw _0x121db5;});}return _0x205b70;})[_0xf1c2('0x27')](respondWithResult(_0xb38878,0xc9))[_0xf1c2('0x31')](handleError(_0xb38878,null));};exports[_0xf1c2('0x96')]=function(_0x265d43,_0x1dfa1a,_0x230ced){var _0x8c8648=![];if(_0x265d43[_0xf1c2('0x6b')]['id']){delete _0x265d43[_0xf1c2('0x6b')]['id'];}return db[_0xf1c2('0x78')][_0xf1c2('0x97')]({'attributes':['id',_0xf1c2('0x98')]})[_0xf1c2('0x27')](function(_0xa277e4){_0x8c8648=_0xa277e4[_0xf1c2('0x98')];return db[_0xf1c2('0x4b')][_0xf1c2('0x46')]({'where':{'id':_0x265d43['params']['id']}});})['then'](function(_0x9ef5bc){if(_0x9ef5bc){if(_0x9ef5bc['id']==_0x265d43[_0xf1c2('0x90')]['id']){if(!_0x265d43['body'][_0xf1c2('0x99')]||!_0x265d43['body'][_0xf1c2('0x9a')]){throw new db[(_0xf1c2('0x23'))][(_0xf1c2('0x24'))](_0xf1c2('0x9b'));}if(!_0x9ef5bc['authenticate'](_0x265d43[_0xf1c2('0x6b')][_0xf1c2('0x99')])){throw new db['Sequelize']['ValidationError'](_0xf1c2('0x9c'));}if(_0x265d43[_0xf1c2('0x6b')][_0xf1c2('0x99')]==_0x265d43[_0xf1c2('0x6b')][_0xf1c2('0x9a')]){throw new db[(_0xf1c2('0x23'))][(_0xf1c2('0x24'))](_0xf1c2('0x9d'));}return _0x9ef5bc;}else if(_0x265d43[_0xf1c2('0x90')][_0xf1c2('0x45')]==_0xf1c2('0x9e')){if(!_0x265d43[_0xf1c2('0x6b')][_0xf1c2('0x9a')]){throw new db[(_0xf1c2('0x23'))]['ValidationError'](_0xf1c2('0x9f'));}return _0x9ef5bc;}else if(_0x265d43[_0xf1c2('0x90')][_0xf1c2('0x45')]=='user'){if(!_0x265d43[_0xf1c2('0x6b')][_0xf1c2('0x9a')]){throw new db[(_0xf1c2('0x23'))]['ValidationError'](_0xf1c2('0x9f'));}if(_0x9ef5bc['role']!='agent'){throw new db['Sequelize']['ValidationError'](_0xf1c2('0xa0'));}return _0x9ef5bc;}else{throw new db[(_0xf1c2('0x23'))][(_0xf1c2('0x24'))](_0xf1c2('0xa0'));}}return null;})[_0xf1c2('0x27')](handleEntityNotFound(_0x1dfa1a,null))[_0xf1c2('0x27')](function(_0x7ded0c){return checkPasswordPattern(_0x7ded0c,_0x265d43[_0xf1c2('0x6b')][_0xf1c2('0x9a')],_0x8c8648);})[_0xf1c2('0x27')](saveUpdates({'password':_0x265d43[_0xf1c2('0x6b')][_0xf1c2('0x9a')],'passwordResetAt':_0x265d43[_0xf1c2('0x90')]['id']==_0x265d43[_0xf1c2('0x67')]['id']?moment():null},null))[_0xf1c2('0x27')](respondWithResult(_0x1dfa1a,null))['catch'](handleError(_0x1dfa1a,null));};exports[_0xf1c2('0xa1')]=function(_0x38e51c,_0x3cf152,_0x226c83){var _0x55329b=_0x38e51c[_0xf1c2('0x6b')][_0xf1c2('0xa2')];return db[_0xf1c2('0x4b')][_0xf1c2('0x46')]({'where':{'id':_0x38e51c[_0xf1c2('0x67')]['id']},'attributes':['id',_0xf1c2('0x48'),_0xf1c2('0x45'),'online',_0xf1c2('0xa3'),_0xf1c2('0xa4'),_0xf1c2('0xa5')]})[_0xf1c2('0x27')](handleEntityNotFound(_0x3cf152,null))['then'](function(_0x48f2e5){if(_0x48f2e5){if(!utils['isValidChannel'](_0x55329b)){throw new db[(_0xf1c2('0x23'))][(_0xf1c2('0x24'))]('Unknown\x20channel');}return _0x48f2e5['add'+_[_0xf1c2('0xa6')](_0x55329b['toLowerCase']())+_0xf1c2('0xa7')](_0x38e51c[_0xf1c2('0x6b')]['ids'],{'penalty':_0x38e51c[_0xf1c2('0x6b')][_0xf1c2('0xa8')]||0x0})[_0xf1c2('0xa9')](function(_0x2bbd6a){for(var _0x51282c=0x0;_0x51282c<_0x38e51c[_0xf1c2('0x6b')][_0xf1c2('0x6e')][_0xf1c2('0x59')];_0x51282c+=0x1){var _0x38131f={'UserId':_0x38e51c[_0xf1c2('0x67')]['id']};_0x38131f[_[_0xf1c2('0xa6')](_0x55329b[_0xf1c2('0xaa')]())+_0xf1c2('0xab')]=_0x38e51c[_0xf1c2('0x6b')][_0xf1c2('0x6e')][_0x51282c];socket[_0xf1c2('0xac')]('user'+_['capitalize'](_0x55329b[_0xf1c2('0xaa')]())+_0xf1c2('0xad'),_0x38131f);}return _0x2bbd6a;})[_0xf1c2('0x27')](function(){if(_0x55329b===_0xf1c2('0xae')){return db[_0xf1c2('0xaf')][_0xf1c2('0x65')]({'where':{'id':_0x38e51c[_0xf1c2('0x6b')]['ids']||[]},'raw':!![],'attributes':['id',_0xf1c2('0x48')]});}})[_0xf1c2('0x27')](function(_0xe83cd1){var _0x570ea2=_0x48f2e5['get']({'plain':!![]});var _0x442bfc=[];if(_0x55329b==='voice'&&_0x570ea2[_0xf1c2('0x45')]===_0xf1c2('0x41')&&_0x570ea2[_0xf1c2('0xb0')]){for(var _0x4c1df0=0x0;_0x4c1df0<_0xe83cd1[_0xf1c2('0x59')];_0x4c1df0+=0x1){_0x442bfc[_0xf1c2('0xb1')]({'membername':_0x570ea2[_0xf1c2('0x48')],'UserId':_0x570ea2['id'],'queue_name':_0xe83cd1[_0x4c1df0][_0xf1c2('0x48')],'VoiceQueueId':_0xe83cd1[_0x4c1df0]['id'],'interface':_[_0xf1c2('0x7b')](_0x570ea2['interface'])?util[_0xf1c2('0xb2')](_0xf1c2('0xb3'),_0x570ea2[_0xf1c2('0x48')]):_0x570ea2[_0xf1c2('0xa5')],'paused':_0x570ea2[_0xf1c2('0xa4')]||![],'penalty':_0x38e51c[_0xf1c2('0x6b')][_0xf1c2('0xa8')]||0x0});}return BPromise['each'](_0x442bfc,function(_0x201788){return db[_0xf1c2('0xb4')][_0xf1c2('0xb5')](_0x201788);});}return _0x48f2e5;});}})[_0xf1c2('0x27')](respondWithStatusCode(_0x3cf152,null))[_0xf1c2('0x31')](handleError(_0x3cf152,null));};exports[_0xf1c2('0xb6')]=function(_0xec9d1c,_0x245184,_0x42341e){var _0x77b6a5;return db[_0xf1c2('0x4b')][_0xf1c2('0x46')]({'where':{'id':_0xec9d1c['params']['id']},'attributes':['id','name',_0xf1c2('0x45')]})[_0xf1c2('0x27')](handleEntityNotFound(_0x245184,null))[_0xf1c2('0x27')](function(_0x25e15f){if(_0x25e15f){_0x77b6a5=_0x25e15f;if(!_0xec9d1c[_0xf1c2('0x54')][_0xf1c2('0xa2')]||!utils['isValidChannel'](_0xec9d1c[_0xf1c2('0x54')]['channel'])){throw new db[(_0xf1c2('0x23'))][(_0xf1c2('0x24'))](_0xf1c2('0xb7'));}return _0x25e15f[_0xf1c2('0xb8')+_['capitalize'](_0xec9d1c['query']['channel']['toLowerCase']())+_0xf1c2('0xa7')](_0xec9d1c[_0xf1c2('0x54')]['ids']);}})[_0xf1c2('0x27')](function(_0x1c3975){for(var _0x2d3adb=0x0;_0x2d3adb<_0xec9d1c[_0xf1c2('0x54')]['ids'][_0xf1c2('0x59')];_0x2d3adb+=0x1){var _0x562061={'UserId':_0xec9d1c[_0xf1c2('0x67')]['id']};_0x562061[_[_0xf1c2('0xa6')](_0xec9d1c['query'][_0xf1c2('0xa2')][_0xf1c2('0xaa')]())+_0xf1c2('0xab')]=_0xec9d1c[_0xf1c2('0x54')][_0xf1c2('0x6e')][_0x2d3adb];socket[_0xf1c2('0xac')]('user'+_[_0xf1c2('0xa6')](_0xec9d1c[_0xf1c2('0x54')][_0xf1c2('0xa2')][_0xf1c2('0xaa')]())+_0xf1c2('0xb9'),_0x562061);}return _0x1c3975;})[_0xf1c2('0x27')](function(){if(_0xec9d1c[_0xf1c2('0x54')][_0xf1c2('0xa2')]===_0xf1c2('0xae')){return db[_0xf1c2('0xb4')][_0xf1c2('0x3e')]({'where':{'UserId':_0xec9d1c[_0xf1c2('0x67')]['id'],'VoiceQueueId':_0xec9d1c['query'][_0xf1c2('0x6e')]},'individualHooks':!![]})[_0xf1c2('0x27')](function(){return _0x77b6a5;});}return _0x77b6a5;})[_0xf1c2('0x27')](respondWithStatusCode(_0x245184,null))[_0xf1c2('0x31')](handleError(_0x245184,null));};exports[_0xf1c2('0xba')]=function(_0x37bb25,_0x40c179,_0x4b56fc){_0x37bb25[_0xf1c2('0x6b')][_0xf1c2('0xbb')]=_0x37bb25[_0xf1c2('0xbc')][_0xf1c2('0xbd')];return db[_0xf1c2('0x4b')][_0xf1c2('0x46')]({'where':{'id':_0x37bb25[_0xf1c2('0x67')]['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x40c179,null))['then'](saveUpdates(_0x37bb25[_0xf1c2('0x6b')],null))[_0xf1c2('0x27')](respondWithResult(_0x40c179,null))[_0xf1c2('0x31')](handleError(_0x40c179,null));};exports[_0xf1c2('0xbe')]=function(_0x26d2ee,_0x5f4ad1,_0x4b4b64){var _0x3519d2=path['join'](config[_0xf1c2('0xbf')],'server/files/images/logos/default_profile.png');return db[_0xf1c2('0x4b')][_0xf1c2('0x46')]({'where':{'id':_0x26d2ee['params']['id']},'attributes':['id',_0xf1c2('0xbb')],'raw':!![]})[_0xf1c2('0x27')](handleEntityNotFound(_0x5f4ad1,null))[_0xf1c2('0x27')](function(_0x5d5e9a){if(_0x5d5e9a){if(_[_0xf1c2('0x7b')](_0x5d5e9a['userpic'])){return _0x5f4ad1[_0xf1c2('0xc0')](_0x3519d2);}else{if(!fs[_0xf1c2('0xc1')](path[_0xf1c2('0xc2')](config[_0xf1c2('0xbf')],'server/files/images/',_0x5d5e9a[_0xf1c2('0xbb')]))){return _0x5f4ad1['download'](_0x3519d2);}return _0x5f4ad1[_0xf1c2('0xc0')](path[_0xf1c2('0xc2')](config[_0xf1c2('0xbf')],_0xf1c2('0xc3'),_0x5d5e9a['userpic']));}}})['catch'](handleError(_0x5f4ad1,null));};exports['getContacts']=function(_0x4c26c4,_0x167d36,_0xf5e0bb){var _0x3f6b76={};var _0x3064bb={};var _0x57028a;var _0x7ee8f6;return db[_0xf1c2('0x4b')][_0xf1c2('0x97')]({'where':{'id':_0x4c26c4[_0xf1c2('0x67')]['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x167d36,null))[_0xf1c2('0x27')](function(_0x140ce3){if(_0x140ce3){_0x57028a=_0x140ce3;_0x3064bb[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db[_0xf1c2('0xc4')][_0xf1c2('0x4c')]);_0x3064bb[_0xf1c2('0x54')]=_[_0xf1c2('0x55')](_0x4c26c4['query']);_0x3064bb[_0xf1c2('0x68')]=_['intersection'](_0x3064bb[_0xf1c2('0x4f')],_0x3064bb[_0xf1c2('0x54')]);_0x3f6b76[_0xf1c2('0x57')]=_['intersection'](_0x3064bb[_0xf1c2('0x4f')],qs[_0xf1c2('0x58')](_0x4c26c4[_0xf1c2('0x54')][_0xf1c2('0x58')]));_0x3f6b76[_0xf1c2('0x57')]=_0x3f6b76[_0xf1c2('0x57')][_0xf1c2('0x59')]?_0x3f6b76[_0xf1c2('0x57')]:_0x3064bb['model'];_0x3f6b76[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x4c26c4[_0xf1c2('0x54')]['sort']);_0x3f6b76[_0xf1c2('0x5d')]=qs[_0xf1c2('0x68')](_['pick'](_0x4c26c4[_0xf1c2('0x54')],_0x3064bb['filters']));if(_0x4c26c4[_0xf1c2('0x54')][_0xf1c2('0x44')]){_0x3f6b76[_0xf1c2('0x5d')]=_[_0xf1c2('0x5e')](_0x3f6b76[_0xf1c2('0x5d')],{'$or':_['map'](_0x3f6b76[_0xf1c2('0x57')],function(_0x367ca0){var _0x166414={};_0x166414[_0x367ca0]={'$like':'%'+_0x4c26c4[_0xf1c2('0x54')][_0xf1c2('0x44')]+'%'};return _0x166414;})});}_0x3f6b76=_[_0xf1c2('0x5e')]({},_0x3f6b76,_0x4c26c4['options']);return _0x57028a[_0xf1c2('0xc5')](_0x3f6b76);}})[_0xf1c2('0x27')](function(_0x55e5c1){if(_0x55e5c1){_0x7ee8f6=_0x55e5c1[_0xf1c2('0x59')];if(_0x4c26c4['query'][_0xf1c2('0xc6')](_0xf1c2('0x64'))){_0x3f6b76[_0xf1c2('0x69')]=[{'model':db['CmList'],'as':_0xf1c2('0xc7'),'required':![]},{'model':db[_0xf1c2('0xc8')],'as':_0xf1c2('0xc9'),'attributes':['id',_0xf1c2('0x48'),_0xf1c2('0xca')],'where':_0x4c26c4[_0xf1c2('0x54')][_0xf1c2('0xcb')]?{'id':_0x4c26c4[_0xf1c2('0x54')][_0xf1c2('0xcb')]}:undefined,'required':_0x4c26c4['query'][_0xf1c2('0xcb')]?!![]:![]}];}if(!_0x4c26c4[_0xf1c2('0x54')][_0xf1c2('0xc6')]('nolimit')){_0x3f6b76[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x4c26c4['query'][_0xf1c2('0x37')]);_0x3f6b76[_0xf1c2('0x36')]=qs[_0xf1c2('0x36')](_0x4c26c4[_0xf1c2('0x54')][_0xf1c2('0x36')]);}return _0x57028a[_0xf1c2('0xc5')](_0x3f6b76);}})[_0xf1c2('0x27')](function(_0x12b5bf){if(_0x12b5bf){return _0x12b5bf?{'count':_0x7ee8f6,'rows':_0x12b5bf}:null;}})[_0xf1c2('0x27')](respondWithResult(_0x167d36,null))[_0xf1c2('0x31')](handleError(_0x167d36,null));};exports[_0xf1c2('0xcc')]=function(_0x13a45a,_0xc6d1d1,_0x43aae3){var _0x15a623;var _0x24c9da;var _0x336a6b={};var _0x2fd1f2;return db[_0xf1c2('0x4b')][_0xf1c2('0x97')]({'where':{'id':_0x13a45a['params']['id']},'attributes':['id','name',_0xf1c2('0x45')]})[_0xf1c2('0x27')](handleEntityNotFound(_0xc6d1d1,null))[_0xf1c2('0x27')](function(_0x2fa613){if(!utils[_0xf1c2('0xcd')](_0x13a45a[_0xf1c2('0x54')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xf1c2('0xb7'));}_0x15a623=_0x2fa613;var _0xed70e0={};_0xed70e0[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db[_[_0xf1c2('0xa6')](_0x13a45a['query']['channel'])+'Queue'][_0xf1c2('0x4c')]);_0xed70e0[_0xf1c2('0x54')]=_[_0xf1c2('0x55')](_0x13a45a['query']);_0xed70e0[_0xf1c2('0x68')]=_[_0xf1c2('0x56')](_0xed70e0[_0xf1c2('0x4f')],_0xed70e0[_0xf1c2('0x54')]);_0x336a6b[_0xf1c2('0x57')]=_[_0xf1c2('0x56')](_0xed70e0[_0xf1c2('0x4f')],qs['fields'](_0x13a45a[_0xf1c2('0x54')]['fields']));_0x336a6b['attributes']=_0x336a6b[_0xf1c2('0x57')]['length']?_0x336a6b[_0xf1c2('0x57')]:_0xed70e0[_0xf1c2('0x4f')];_0x336a6b[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x13a45a['query'][_0xf1c2('0x5c')]);_0x336a6b[_0xf1c2('0x5d')]=qs[_0xf1c2('0x68')](_[_0xf1c2('0xce')](_0x13a45a[_0xf1c2('0x54')],_0xed70e0[_0xf1c2('0x68')]));if(_0x13a45a[_0xf1c2('0x54')][_0xf1c2('0x44')]){_0x336a6b['where']=_[_0xf1c2('0x5e')](_0x336a6b[_0xf1c2('0x5d')],{'$or':_[_0xf1c2('0x51')](_0x336a6b['attributes'],function(_0x40f9ab){var _0x2a6807={};_0x2a6807[_0x40f9ab]={'$like':'%'+_0x13a45a['query'][_0xf1c2('0x44')]+'%'};return _0x2a6807;})});}_0x336a6b=_[_0xf1c2('0x5e')]({},_0x336a6b,_0x13a45a['options']);switch(_0x15a623['role']){case _0xf1c2('0x9e'):return db[_[_0xf1c2('0xa6')](_0x13a45a[_0xf1c2('0x54')][_0xf1c2('0xa2')])+'Queue']['findAll'](_0x336a6b);case'user':case _0xf1c2('0x41'):return _0x15a623[_0xf1c2('0x92')+_[_0xf1c2('0xa6')](_0x13a45a[_0xf1c2('0x54')]['channel'])+_0xf1c2('0xa7')](_0x336a6b);default:throw new db['Sequelize'][(_0xf1c2('0x24'))]('Unknown\x20role');}})['then'](function(_0x1daf08){_0x2fd1f2=_0x1daf08[_0xf1c2('0x59')];if(!_0x13a45a['query']['hasOwnProperty']('nolimit')){_0x336a6b[_0xf1c2('0x37')]=qs['limit'](_0x13a45a[_0xf1c2('0x54')][_0xf1c2('0x37')]);_0x336a6b['offset']=qs['offset'](_0x13a45a[_0xf1c2('0x54')][_0xf1c2('0x36')]);}switch(_0x15a623[_0xf1c2('0x45')]){case _0xf1c2('0x9e'):return db[_[_0xf1c2('0xa6')](_0x13a45a[_0xf1c2('0x54')]['channel'])+_0xf1c2('0xcf')]['findAll'](_0x336a6b);case _0xf1c2('0x90'):case'agent':return _0x15a623[_0xf1c2('0x92')+_[_0xf1c2('0xa6')](_0x13a45a[_0xf1c2('0x54')][_0xf1c2('0xa2')])+_0xf1c2('0xa7')](_0x336a6b);}})[_0xf1c2('0x27')](function(_0xb9f588){return{'count':_0x2fd1f2,'rows':_0xb9f588};})[_0xf1c2('0x27')](respondWithResult(_0xc6d1d1,null))[_0xf1c2('0x31')](handleError(_0xc6d1d1,null));};exports['getVoiceQueuesRt']=function(_0x99de94,_0x2156c6,_0x51d2e1){var _0x41562f={};var _0x1c8ff2={};var _0x27377e;var _0x471186;return db[_0xf1c2('0x4b')][_0xf1c2('0x97')]({'where':{'id':_0x99de94[_0xf1c2('0x67')]['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x2156c6,null))[_0xf1c2('0x27')](function(_0x75f530){if(_0x75f530){_0x27377e=_0x75f530;_0x1c8ff2[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db[_0xf1c2('0xb4')]['rawAttributes']);_0x1c8ff2[_0xf1c2('0x54')]=_[_0xf1c2('0x55')](_0x99de94['query']);_0x1c8ff2[_0xf1c2('0x68')]=_[_0xf1c2('0x56')](_0x1c8ff2[_0xf1c2('0x4f')],_0x1c8ff2['query']);_0x41562f['attributes']=_['intersection'](_0x1c8ff2[_0xf1c2('0x4f')],qs['fields'](_0x99de94[_0xf1c2('0x54')][_0xf1c2('0x58')]));_0x41562f[_0xf1c2('0x57')]=_0x41562f['attributes'][_0xf1c2('0x59')]?_0x41562f[_0xf1c2('0x57')]:_0x1c8ff2[_0xf1c2('0x4f')];_0x41562f[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x99de94[_0xf1c2('0x54')][_0xf1c2('0x5c')]);_0x41562f[_0xf1c2('0x5d')]=qs[_0xf1c2('0x68')](_['pick'](_0x99de94['query'],_0x1c8ff2[_0xf1c2('0x68')]));if(_0x99de94[_0xf1c2('0x54')][_0xf1c2('0x44')]){_0x41562f[_0xf1c2('0x5d')]=_[_0xf1c2('0x5e')](_0x41562f[_0xf1c2('0x5d')],{'$or':_[_0xf1c2('0x51')](_0x41562f[_0xf1c2('0x57')],function(_0x4f5ebd){var _0x518a26={};_0x518a26[_0x4f5ebd]={'$like':'%'+_0x99de94[_0xf1c2('0x54')][_0xf1c2('0x44')]+'%'};return _0x518a26;})});}_0x41562f=_['merge']({},_0x41562f,_0x99de94['options']);return _0x27377e['getVoiceQueuesRt'](_0x41562f);}})[_0xf1c2('0x27')](function(_0x1f94e2){if(_0x1f94e2){_0x471186=_0x1f94e2[_0xf1c2('0x59')];if(!_0x99de94['query'][_0xf1c2('0xc6')](_0xf1c2('0x5a'))){_0x41562f[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x99de94[_0xf1c2('0x54')][_0xf1c2('0x37')]);_0x41562f[_0xf1c2('0x36')]=qs[_0xf1c2('0x36')](_0x99de94[_0xf1c2('0x54')][_0xf1c2('0x36')]);}return _0x27377e[_0xf1c2('0xd0')](_0x41562f);}})[_0xf1c2('0x27')](function(_0x49bec1){if(_0x49bec1){return _0x49bec1?{'count':_0x471186,'rows':_0x49bec1}:null;}})[_0xf1c2('0x27')](respondWithResult(_0x2156c6,null))[_0xf1c2('0x31')](handleError(_0x2156c6,null));};exports[_0xf1c2('0xd1')]=function(_0x18f8a4,_0x49671e,_0x53ab2f){var _0x1ce449={};var _0x10f0b4={};var _0x3685d;var _0x1849d8;return db[_0xf1c2('0x4b')]['findOne']({'where':{'id':_0x18f8a4[_0xf1c2('0x67')]['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x49671e,null))['then'](function(_0x2d1f18){if(_0x2d1f18){_0x3685d=_0x2d1f18;_0x10f0b4['model']=_[_0xf1c2('0x55')](db[_0xf1c2('0xd2')][_0xf1c2('0x4c')]);_0x10f0b4[_0xf1c2('0x54')]=_['keys'](_0x18f8a4[_0xf1c2('0x54')]);_0x10f0b4['filters']=_[_0xf1c2('0x56')](_0x10f0b4[_0xf1c2('0x4f')],_0x10f0b4[_0xf1c2('0x54')]);_0x1ce449[_0xf1c2('0x57')]=_[_0xf1c2('0x56')](_0x10f0b4[_0xf1c2('0x4f')],qs[_0xf1c2('0x58')](_0x18f8a4[_0xf1c2('0x54')][_0xf1c2('0x58')]));_0x1ce449['attributes']=_0x1ce449[_0xf1c2('0x57')][_0xf1c2('0x59')]?_0x1ce449['attributes']:_0x10f0b4[_0xf1c2('0x4f')];_0x1ce449[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x18f8a4[_0xf1c2('0x54')][_0xf1c2('0x5c')]);_0x1ce449[_0xf1c2('0x5d')]=qs[_0xf1c2('0x68')](_['pick'](_0x18f8a4['query'],_0x10f0b4[_0xf1c2('0x68')]));if(_0x18f8a4[_0xf1c2('0x54')]['filter']){_0x1ce449[_0xf1c2('0x5d')]=_['merge'](_0x1ce449['where'],{'$or':_[_0xf1c2('0x51')](_0x1ce449[_0xf1c2('0x57')],function(_0x3485c0){var _0x4a6bba={};_0x4a6bba[_0x3485c0]={'$like':'%'+_0x18f8a4[_0xf1c2('0x54')][_0xf1c2('0x44')]+'%'};return _0x4a6bba;})});}_0x1ce449=_[_0xf1c2('0x5e')]({},_0x1ce449,_0x18f8a4[_0xf1c2('0x62')]);return _0x3685d[_0xf1c2('0xd1')](_0x1ce449);}})['then'](function(_0x4d1f0f){if(_0x4d1f0f){_0x1849d8=_0x4d1f0f['length'];if(!_0x18f8a4[_0xf1c2('0x54')][_0xf1c2('0xc6')](_0xf1c2('0x5a'))){_0x1ce449[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x18f8a4[_0xf1c2('0x54')][_0xf1c2('0x37')]);_0x1ce449[_0xf1c2('0x36')]=qs['offset'](_0x18f8a4[_0xf1c2('0x54')][_0xf1c2('0x36')]);}return _0x3685d[_0xf1c2('0xd1')](_0x1ce449);}})[_0xf1c2('0x27')](function(_0x4575cf){if(_0x4575cf){return _0x4575cf?{'count':_0x1849d8,'rows':_0x4575cf}:null;}})['then'](respondWithResult(_0x49671e,null))['catch'](handleError(_0x49671e,null));};exports['getRecordings']=function(_0x4a13d5,_0x3d1c4e,_0x56ede0){var _0x13aa29={'raw':!![],'where':{}};var _0x328f5f={};var _0x3c4fe5={'count':0x0,'rows':[]};return db[_0xf1c2('0x4b')][_0xf1c2('0x97')]({'where':{'id':_0x4a13d5[_0xf1c2('0x67')]['id']}})['then'](handleEntityNotFound(_0x3d1c4e,null))[_0xf1c2('0x27')](function(_0x5d1582){if(_0x5d1582){_0x328f5f[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db[_0xf1c2('0xd3')]['rawAttributes']);_0x328f5f[_0xf1c2('0x54')]=_[_0xf1c2('0x55')](_0x4a13d5[_0xf1c2('0x54')]);_0x328f5f['filters']=_[_0xf1c2('0x56')](_0x328f5f['model'],_0x328f5f['query']);_0x13aa29[_0xf1c2('0x57')]=_[_0xf1c2('0x56')](_0x328f5f[_0xf1c2('0x4f')],qs[_0xf1c2('0x58')](_0x4a13d5[_0xf1c2('0x54')]['fields']));_0x13aa29['attributes']=_0x13aa29[_0xf1c2('0x57')][_0xf1c2('0x59')]?_0x13aa29[_0xf1c2('0x57')]:_0x328f5f[_0xf1c2('0x4f')];if(!_0x4a13d5[_0xf1c2('0x54')]['hasOwnProperty'](_0xf1c2('0x5a'))){_0x13aa29[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x4a13d5[_0xf1c2('0x54')][_0xf1c2('0x37')]);_0x13aa29['offset']=qs[_0xf1c2('0x36')](_0x4a13d5['query'][_0xf1c2('0x36')]);}_0x13aa29[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x4a13d5[_0xf1c2('0x54')][_0xf1c2('0x5c')]);_0x13aa29[_0xf1c2('0x5d')]=qs[_0xf1c2('0x68')](_[_0xf1c2('0xce')](_0x4a13d5[_0xf1c2('0x54')],_0x328f5f['filters']));_0x13aa29[_0xf1c2('0x5d')][_0xf1c2('0xd4')]=_0x5d1582['id'];if(_0x4a13d5[_0xf1c2('0x54')][_0xf1c2('0x44')]){_0x13aa29['where']=_[_0xf1c2('0x5e')](_0x13aa29['where'],{'$or':_[_0xf1c2('0x51')](_0x13aa29[_0xf1c2('0x57')],function(_0x2a588f){var _0x1594fc={};_0x1594fc[_0x2a588f]={'$like':'%'+_0x4a13d5['query'][_0xf1c2('0x44')]+'%'};return _0x1594fc;})});}_0x13aa29=_[_0xf1c2('0x5e')]({},_0x13aa29,_0x4a13d5['options']);return db[_0xf1c2('0xd3')][_0xf1c2('0x63')]({'where':_0x13aa29[_0xf1c2('0x5d')]})[_0xf1c2('0x27')](function(_0x46a683){_0x3c4fe5[_0xf1c2('0x63')]=_0x46a683;if(_0x4a13d5[_0xf1c2('0x54')][_0xf1c2('0x64')]){_0x13aa29[_0xf1c2('0x69')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x13aa29);})[_0xf1c2('0x27')](function(_0x43257c){_0x3c4fe5[_0xf1c2('0x66')]=_0x43257c;return _0x3c4fe5;});}})[_0xf1c2('0x27')](respondWithFilteredResult(_0x3d1c4e,_0x13aa29))[_0xf1c2('0x31')](handleError(_0x3d1c4e,null));};exports[_0xf1c2('0xd5')]=function(_0x119f82,_0x4374c3,_0x4c521e){var _0x129907={'raw':!![],'where':{}};var _0x28dfbc={};var _0x365fec={'count':0x0,'rows':[]};return db[_0xf1c2('0x4b')][_0xf1c2('0x97')]({'where':{'id':_0x119f82[_0xf1c2('0x67')]['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x4374c3,null))[_0xf1c2('0x27')](function(_0x1ec745){if(_0x1ec745){_0x28dfbc[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db[_0xf1c2('0xd6')][_0xf1c2('0x4c')]);_0x28dfbc[_0xf1c2('0x54')]=_[_0xf1c2('0x55')](_0x119f82['query']);_0x28dfbc[_0xf1c2('0x68')]=_[_0xf1c2('0x56')](_0x28dfbc[_0xf1c2('0x4f')],_0x28dfbc[_0xf1c2('0x54')]);_0x129907[_0xf1c2('0x57')]=_[_0xf1c2('0x56')](_0x28dfbc[_0xf1c2('0x4f')],qs[_0xf1c2('0x58')](_0x119f82['query'][_0xf1c2('0x58')]));_0x129907[_0xf1c2('0x57')]=_0x129907[_0xf1c2('0x57')][_0xf1c2('0x59')]?_0x129907['attributes']:_0x28dfbc['model'];if(!_0x119f82[_0xf1c2('0x54')][_0xf1c2('0xc6')](_0xf1c2('0x5a'))){_0x129907[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x119f82['query'][_0xf1c2('0x37')]);_0x129907['offset']=qs['offset'](_0x119f82[_0xf1c2('0x54')][_0xf1c2('0x36')]);}_0x129907['order']=qs[_0xf1c2('0x5c')](_0x119f82[_0xf1c2('0x54')][_0xf1c2('0x5c')]);_0x129907['where']=qs[_0xf1c2('0x68')](_[_0xf1c2('0xce')](_0x119f82['query'],_0x28dfbc[_0xf1c2('0x68')]));_0x129907[_0xf1c2('0x5d')][_0xf1c2('0xd4')]=_0x1ec745['id'];if(_0x119f82['query'][_0xf1c2('0x44')]){_0x129907['where']=_[_0xf1c2('0x5e')](_0x129907[_0xf1c2('0x5d')],{'$or':_[_0xf1c2('0x51')](_0x129907[_0xf1c2('0x57')],function(_0x574051){var _0x493b80={};_0x493b80[_0x574051]={'$like':'%'+_0x119f82[_0xf1c2('0x54')][_0xf1c2('0x44')]+'%'};return _0x493b80;})});}_0x129907=_['merge']({},_0x129907,_0x119f82[_0xf1c2('0x62')]);return db['ScreenRecording'][_0xf1c2('0x63')]({'where':_0x129907[_0xf1c2('0x5d')]})[_0xf1c2('0x27')](function(_0x18ab9e){_0x365fec[_0xf1c2('0x63')]=_0x18ab9e;if(_0x119f82[_0xf1c2('0x54')][_0xf1c2('0x64')]){_0x129907[_0xf1c2('0x69')]=[{'all':!![]}];}return db['ScreenRecording'][_0xf1c2('0x65')](_0x129907);})[_0xf1c2('0x27')](function(_0xd84cc5){_0x365fec[_0xf1c2('0x66')]=_0xd84cc5;return _0x365fec;});}})[_0xf1c2('0x27')](respondWithFilteredResult(_0x4374c3,_0x129907))[_0xf1c2('0x31')](handleError(_0x4374c3,null));};exports[_0xf1c2('0xd7')]=function(_0x545943,_0x29f0c2,_0x4c80b5){var _0x225af4={};var _0x5ecf5c={};var _0x56b4d7;var _0x5df493;return db[_0xf1c2('0x4b')][_0xf1c2('0x97')]({'where':{'id':_0x545943[_0xf1c2('0x67')]['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x29f0c2,null))[_0xf1c2('0x27')](function(_0xdeeb4e){if(_0xdeeb4e){_0x56b4d7=_0xdeeb4e;_0x5ecf5c[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db[_0xf1c2('0xd8')]['rawAttributes']);_0x5ecf5c[_0xf1c2('0x54')]=_['keys'](_0x545943[_0xf1c2('0x54')]);_0x5ecf5c['filters']=_[_0xf1c2('0x56')](_0x5ecf5c[_0xf1c2('0x4f')],_0x5ecf5c[_0xf1c2('0x54')]);_0x225af4['attributes']=_['intersection'](_0x5ecf5c[_0xf1c2('0x4f')],qs[_0xf1c2('0x58')](_0x545943['query'][_0xf1c2('0x58')]));_0x225af4[_0xf1c2('0x57')]=_0x225af4[_0xf1c2('0x57')][_0xf1c2('0x59')]?_0x225af4[_0xf1c2('0x57')]:_0x5ecf5c[_0xf1c2('0x4f')];_0x225af4[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x545943[_0xf1c2('0x54')][_0xf1c2('0x5c')]);_0x225af4[_0xf1c2('0x5d')]=qs['filters'](_[_0xf1c2('0xce')](_0x545943[_0xf1c2('0x54')],_0x5ecf5c['filters']));if(_0x545943[_0xf1c2('0x54')][_0xf1c2('0x44')]){_0x225af4[_0xf1c2('0x5d')]=_['merge'](_0x225af4[_0xf1c2('0x5d')],{'$or':_[_0xf1c2('0x51')](_0x225af4[_0xf1c2('0x57')],function(_0x5d543f){var _0x5f3c30={};_0x5f3c30[_0x5d543f]={'$like':'%'+_0x545943['query']['filter']+'%'};return _0x5f3c30;})});}_0x225af4=_['merge']({},_0x225af4,_0x545943['options']);return _0x56b4d7[_0xf1c2('0xd7')](_0x225af4);}})['then'](function(_0x1a30c3){if(_0x1a30c3){_0x5df493=_0x1a30c3['length'];if(!_0x545943[_0xf1c2('0x54')][_0xf1c2('0xc6')](_0xf1c2('0x5a'))){_0x225af4[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x545943[_0xf1c2('0x54')][_0xf1c2('0x37')]);_0x225af4['offset']=qs[_0xf1c2('0x36')](_0x545943[_0xf1c2('0x54')][_0xf1c2('0x36')]);}return _0x56b4d7['getChatInteractions'](_0x225af4);}})[_0xf1c2('0x27')](function(_0x107f26){if(_0x107f26){return _0x107f26?{'count':_0x5df493,'rows':_0x107f26}:null;}})[_0xf1c2('0x27')](respondWithResult(_0x29f0c2,null))[_0xf1c2('0x31')](handleError(_0x29f0c2,null));};exports[_0xf1c2('0xd9')]=function(_0x5e2f9e,_0x45b984,_0x2c12c0){var _0x1c889e={};var _0x505272={};var _0x3ed02d;var _0x840411;return db[_0xf1c2('0x4b')][_0xf1c2('0x97')]({'where':{'id':_0x5e2f9e[_0xf1c2('0x67')]['id']}})['then'](handleEntityNotFound(_0x45b984,null))[_0xf1c2('0x27')](function(_0x62de44){if(_0x62de44){_0x3ed02d=_0x62de44;_0x505272[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db[_0xf1c2('0xda')][_0xf1c2('0x4c')]);_0x505272[_0xf1c2('0x54')]=_[_0xf1c2('0x55')](_0x5e2f9e['query']);_0x505272['filters']=_[_0xf1c2('0x56')](_0x505272['model'],_0x505272['query']);_0x1c889e['attributes']=_[_0xf1c2('0x56')](_0x505272[_0xf1c2('0x4f')],qs['fields'](_0x5e2f9e[_0xf1c2('0x54')][_0xf1c2('0x58')]));_0x1c889e[_0xf1c2('0x57')]=_0x1c889e[_0xf1c2('0x57')][_0xf1c2('0x59')]?_0x1c889e[_0xf1c2('0x57')]:_0x505272[_0xf1c2('0x4f')];_0x1c889e[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x5e2f9e['query'][_0xf1c2('0x5c')]);_0x1c889e[_0xf1c2('0x5d')]=qs['filters'](_[_0xf1c2('0xce')](_0x5e2f9e[_0xf1c2('0x54')],_0x505272[_0xf1c2('0x68')]));if(_0x5e2f9e[_0xf1c2('0x54')][_0xf1c2('0x44')]){_0x1c889e[_0xf1c2('0x5d')]=_[_0xf1c2('0x5e')](_0x1c889e[_0xf1c2('0x5d')],{'$or':_[_0xf1c2('0x51')](_0x1c889e[_0xf1c2('0x57')],function(_0x3009b4){var _0x5c3832={};_0x5c3832[_0x3009b4]={'$like':'%'+_0x5e2f9e[_0xf1c2('0x54')]['filter']+'%'};return _0x5c3832;})});}_0x1c889e=_['merge']({},_0x1c889e,_0x5e2f9e[_0xf1c2('0x62')]);return _0x3ed02d[_0xf1c2('0xd9')](_0x1c889e);}})[_0xf1c2('0x27')](function(_0x1e90f0){if(_0x1e90f0){_0x840411=_0x1e90f0[_0xf1c2('0x59')];if(!_0x5e2f9e['query'][_0xf1c2('0xc6')]('nolimit')){_0x1c889e[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x5e2f9e[_0xf1c2('0x54')]['limit']);_0x1c889e['offset']=qs[_0xf1c2('0x36')](_0x5e2f9e[_0xf1c2('0x54')][_0xf1c2('0x36')]);}return _0x3ed02d[_0xf1c2('0xd9')](_0x1c889e);}})[_0xf1c2('0x27')](function(_0x1f03bd){if(_0x1f03bd){return _0x1f03bd?{'count':_0x840411,'rows':_0x1f03bd}:null;}})[_0xf1c2('0x27')](respondWithResult(_0x45b984,null))[_0xf1c2('0x31')](handleError(_0x45b984,null));};exports[_0xf1c2('0xdb')]=function(_0x4981e8,_0xccf39b,_0x41a7a){var _0x4b1aaa={'raw':!![],'where':{}};var _0x132f53={};var _0x50c73e={'count':0x0,'rows':[]};return db['User'][_0xf1c2('0x97')]({'where':{'id':_0x4981e8[_0xf1c2('0x67')]['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0xccf39b,null))[_0xf1c2('0x27')](function(_0x2e4305){if(_0x2e4305){_0x132f53[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db['MailInteraction'][_0xf1c2('0x4c')]);_0x132f53[_0xf1c2('0x54')]=_['keys'](_0x4981e8[_0xf1c2('0x54')]);_0x132f53['filters']=_[_0xf1c2('0x56')](_0x132f53[_0xf1c2('0x4f')],_0x132f53['query']);_0x4b1aaa['attributes']=_['intersection'](_0x132f53[_0xf1c2('0x4f')],qs['fields'](_0x4981e8[_0xf1c2('0x54')]['fields']));_0x4b1aaa[_0xf1c2('0x57')]=_0x4b1aaa[_0xf1c2('0x57')][_0xf1c2('0x59')]?_0x4b1aaa[_0xf1c2('0x57')]:_0x132f53[_0xf1c2('0x4f')];if(!_0x4981e8[_0xf1c2('0x54')][_0xf1c2('0xc6')](_0xf1c2('0x5a'))){_0x4b1aaa[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x4981e8['query'][_0xf1c2('0x37')]);_0x4b1aaa[_0xf1c2('0x36')]=qs[_0xf1c2('0x36')](_0x4981e8[_0xf1c2('0x54')][_0xf1c2('0x36')]);}_0x4b1aaa[_0xf1c2('0x5b')]=qs['sort'](_0x4981e8[_0xf1c2('0x54')][_0xf1c2('0x5c')]);_0x4b1aaa[_0xf1c2('0x5d')]=qs['filters'](_[_0xf1c2('0xce')](_0x4981e8['query'],_0x132f53[_0xf1c2('0x68')]));_0x4b1aaa[_0xf1c2('0x5d')][_0xf1c2('0xd4')]=_0x2e4305['id'];if(_0x4981e8[_0xf1c2('0x54')][_0xf1c2('0x44')]){_0x4b1aaa[_0xf1c2('0x5d')]=_[_0xf1c2('0x5e')](_0x4b1aaa['where'],{'$or':_[_0xf1c2('0x51')](_0x4b1aaa[_0xf1c2('0x57')],function(_0x593916){var _0x506b8e={};_0x506b8e[_0x593916]={'$like':'%'+_0x4981e8[_0xf1c2('0x54')][_0xf1c2('0x44')]+'%'};return _0x506b8e;})});}_0x4b1aaa=_[_0xf1c2('0x5e')]({},_0x4b1aaa,_0x4981e8[_0xf1c2('0x62')]);return db[_0xf1c2('0xdc')][_0xf1c2('0x63')]({'where':_0x4b1aaa['where']})['then'](function(_0x84d76f){_0x50c73e[_0xf1c2('0x63')]=_0x84d76f;if(_0x4981e8[_0xf1c2('0x54')][_0xf1c2('0x64')]){_0x4b1aaa[_0xf1c2('0x69')]=[{'all':!![]}];}return db[_0xf1c2('0xdc')][_0xf1c2('0x65')](_0x4b1aaa);})[_0xf1c2('0x27')](function(_0x26ac98){_0x50c73e[_0xf1c2('0x66')]=_0x26ac98;return _0x50c73e;});}})[_0xf1c2('0x27')](respondWithFilteredResult(_0xccf39b,_0x4b1aaa))['catch'](handleError(_0xccf39b,null));};exports[_0xf1c2('0xdd')]=function(_0x3dfbbe,_0x51c711,_0x21c820){var _0x16bddd={};var _0x5851b3={};var _0x5a8095;var _0x24a962;return db['User']['findOne']({'where':{'id':_0x3dfbbe[_0xf1c2('0x67')]['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x51c711,null))[_0xf1c2('0x27')](function(_0x235574){if(_0x235574){_0x5a8095=_0x235574;_0x5851b3[_0xf1c2('0x4f')]=_['keys'](db[_0xf1c2('0xde')][_0xf1c2('0x4c')]);_0x5851b3['query']=_['keys'](_0x3dfbbe[_0xf1c2('0x54')]);_0x5851b3[_0xf1c2('0x68')]=_['intersection'](_0x5851b3[_0xf1c2('0x4f')],_0x5851b3[_0xf1c2('0x54')]);_0x16bddd[_0xf1c2('0x57')]=_[_0xf1c2('0x56')](_0x5851b3[_0xf1c2('0x4f')],qs['fields'](_0x3dfbbe[_0xf1c2('0x54')]['fields']));_0x16bddd['attributes']=_0x16bddd[_0xf1c2('0x57')][_0xf1c2('0x59')]?_0x16bddd['attributes']:_0x5851b3[_0xf1c2('0x4f')];_0x16bddd['order']=qs[_0xf1c2('0x5c')](_0x3dfbbe[_0xf1c2('0x54')][_0xf1c2('0x5c')]);_0x16bddd['where']=qs[_0xf1c2('0x68')](_[_0xf1c2('0xce')](_0x3dfbbe[_0xf1c2('0x54')],_0x5851b3[_0xf1c2('0x68')]));if(_0x3dfbbe[_0xf1c2('0x54')][_0xf1c2('0x44')]){_0x16bddd['where']=_[_0xf1c2('0x5e')](_0x16bddd[_0xf1c2('0x5d')],{'$or':_[_0xf1c2('0x51')](_0x16bddd[_0xf1c2('0x57')],function(_0x570e8a){var _0x44e7fb={};_0x44e7fb[_0x570e8a]={'$like':'%'+_0x3dfbbe['query'][_0xf1c2('0x44')]+'%'};return _0x44e7fb;})});}_0x16bddd=_[_0xf1c2('0x5e')]({},_0x16bddd,_0x3dfbbe[_0xf1c2('0x62')]);return _0x5a8095['getSmsInteractions'](_0x16bddd);}})[_0xf1c2('0x27')](function(_0x1d3558){if(_0x1d3558){_0x24a962=_0x1d3558[_0xf1c2('0x59')];if(!_0x3dfbbe['query'][_0xf1c2('0xc6')](_0xf1c2('0x5a'))){_0x16bddd[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x3dfbbe[_0xf1c2('0x54')][_0xf1c2('0x37')]);_0x16bddd['offset']=qs[_0xf1c2('0x36')](_0x3dfbbe[_0xf1c2('0x54')][_0xf1c2('0x36')]);}return _0x5a8095[_0xf1c2('0xdd')](_0x16bddd);}})['then'](function(_0x107365){if(_0x107365){return _0x107365?{'count':_0x24a962,'rows':_0x107365}:null;}})[_0xf1c2('0x27')](respondWithResult(_0x51c711,null))['catch'](handleError(_0x51c711,null));};exports[_0xf1c2('0xdf')]=function(_0x49ce0a,_0x203c36,_0x56f9bd){var _0x7a1003={};var _0x79ed3a={};var _0x72fb42;var _0x1aa1a6;return db['User'][_0xf1c2('0x97')]({'where':{'id':_0x49ce0a['params']['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x203c36,null))['then'](function(_0x40d9c5){if(_0x40d9c5){_0x72fb42=_0x40d9c5;_0x79ed3a[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db['FaxInteraction'][_0xf1c2('0x4c')]);_0x79ed3a[_0xf1c2('0x54')]=_['keys'](_0x49ce0a[_0xf1c2('0x54')]);_0x79ed3a[_0xf1c2('0x68')]=_[_0xf1c2('0x56')](_0x79ed3a['model'],_0x79ed3a[_0xf1c2('0x54')]);_0x7a1003[_0xf1c2('0x57')]=_[_0xf1c2('0x56')](_0x79ed3a[_0xf1c2('0x4f')],qs['fields'](_0x49ce0a[_0xf1c2('0x54')][_0xf1c2('0x58')]));_0x7a1003[_0xf1c2('0x57')]=_0x7a1003[_0xf1c2('0x57')][_0xf1c2('0x59')]?_0x7a1003['attributes']:_0x79ed3a[_0xf1c2('0x4f')];_0x7a1003[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x49ce0a[_0xf1c2('0x54')]['sort']);_0x7a1003['where']=qs[_0xf1c2('0x68')](_['pick'](_0x49ce0a[_0xf1c2('0x54')],_0x79ed3a[_0xf1c2('0x68')]));if(_0x49ce0a[_0xf1c2('0x54')]['filter']){_0x7a1003['where']=_[_0xf1c2('0x5e')](_0x7a1003['where'],{'$or':_[_0xf1c2('0x51')](_0x7a1003[_0xf1c2('0x57')],function(_0x180c2c){var _0x8df080={};_0x8df080[_0x180c2c]={'$like':'%'+_0x49ce0a[_0xf1c2('0x54')]['filter']+'%'};return _0x8df080;})});}_0x7a1003=_[_0xf1c2('0x5e')]({},_0x7a1003,_0x49ce0a[_0xf1c2('0x62')]);return _0x72fb42[_0xf1c2('0xdf')](_0x7a1003);}})[_0xf1c2('0x27')](function(_0x182752){if(_0x182752){_0x1aa1a6=_0x182752[_0xf1c2('0x59')];if(!_0x49ce0a[_0xf1c2('0x54')][_0xf1c2('0xc6')](_0xf1c2('0x5a'))){_0x7a1003[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x49ce0a[_0xf1c2('0x54')][_0xf1c2('0x37')]);_0x7a1003['offset']=qs['offset'](_0x49ce0a[_0xf1c2('0x54')][_0xf1c2('0x36')]);}return _0x72fb42[_0xf1c2('0xdf')](_0x7a1003);}})[_0xf1c2('0x27')](function(_0x31fa56){if(_0x31fa56){return _0x31fa56?{'count':_0x1aa1a6,'rows':_0x31fa56}:null;}})[_0xf1c2('0x27')](respondWithResult(_0x203c36,null))[_0xf1c2('0x31')](handleError(_0x203c36,null));};exports[_0xf1c2('0xe0')]=function(_0x4a27e8,_0x51b98a,_0x3d1068){var _0x5b7a8e={};var _0x12223f={};var _0x4afcb4;var _0x3363b8;return db['User']['findOne']({'where':{'id':_0x4a27e8[_0xf1c2('0x67')]['id']}})['then'](handleEntityNotFound(_0x51b98a,null))[_0xf1c2('0x27')](function(_0x319d77){if(_0x319d77){_0x4afcb4=_0x319d77;_0x12223f[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db[_0xf1c2('0xe1')][_0xf1c2('0x4c')]);_0x12223f[_0xf1c2('0x54')]=_[_0xf1c2('0x55')](_0x4a27e8[_0xf1c2('0x54')]);_0x12223f['filters']=_['intersection'](_0x12223f['model'],_0x12223f[_0xf1c2('0x54')]);_0x5b7a8e['attributes']=_[_0xf1c2('0x56')](_0x12223f['model'],qs[_0xf1c2('0x58')](_0x4a27e8['query'][_0xf1c2('0x58')]));_0x5b7a8e['attributes']=_0x5b7a8e['attributes'][_0xf1c2('0x59')]?_0x5b7a8e[_0xf1c2('0x57')]:_0x12223f['model'];_0x5b7a8e[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x4a27e8[_0xf1c2('0x54')][_0xf1c2('0x5c')]);_0x5b7a8e[_0xf1c2('0x5d')]=qs[_0xf1c2('0x68')](_[_0xf1c2('0xce')](_0x4a27e8[_0xf1c2('0x54')],_0x12223f[_0xf1c2('0x68')]));if(_0x4a27e8[_0xf1c2('0x54')][_0xf1c2('0x44')]){_0x5b7a8e['where']=_[_0xf1c2('0x5e')](_0x5b7a8e['where'],{'$or':_['map'](_0x5b7a8e[_0xf1c2('0x57')],function(_0x369bba){var _0x5074c0={};_0x5074c0[_0x369bba]={'$like':'%'+_0x4a27e8['query'][_0xf1c2('0x44')]+'%'};return _0x5074c0;})});}_0x5b7a8e=_[_0xf1c2('0x5e')]({},_0x5b7a8e,_0x4a27e8[_0xf1c2('0x62')]);return _0x4afcb4[_0xf1c2('0xe0')](_0x5b7a8e);}})[_0xf1c2('0x27')](function(_0x1b6b1b){if(_0x1b6b1b){_0x3363b8=_0x1b6b1b[_0xf1c2('0x59')];if(!_0x4a27e8[_0xf1c2('0x54')][_0xf1c2('0xc6')](_0xf1c2('0x5a'))){_0x5b7a8e['limit']=qs[_0xf1c2('0x37')](_0x4a27e8[_0xf1c2('0x54')]['limit']);_0x5b7a8e[_0xf1c2('0x36')]=qs['offset'](_0x4a27e8[_0xf1c2('0x54')][_0xf1c2('0x36')]);}return _0x4afcb4[_0xf1c2('0xe0')](_0x5b7a8e);}})['then'](function(_0x11b8b9){if(_0x11b8b9){return _0x11b8b9?{'count':_0x3363b8,'rows':_0x11b8b9}:null;}})[_0xf1c2('0x27')](respondWithResult(_0x51b98a,null))[_0xf1c2('0x31')](handleError(_0x51b98a,null));};exports[_0xf1c2('0xe2')]=function(_0x5cb381,_0x3cc196,_0x13bf25){var _0xcac66b;var _0x845711;var _0x25c975;var _0x36750d=!_[_0xf1c2('0x7b')](_0x5cb381[_0xf1c2('0x67')]['id'])?_0x5cb381[_0xf1c2('0x67')]['id']:!_['isNil'](_0x5cb381[_0xf1c2('0x90')]['id'])?_0x5cb381[_0xf1c2('0x90')]['id']:null;return db['User'][_0xf1c2('0x46')]({'where':{'id':_0x36750d,'role':{'$or':[_0xf1c2('0x9e'),'user',_0xf1c2('0x41')]}},'attributes':['id',_0xf1c2('0x48'),_0xf1c2('0xe3'),_0xf1c2('0xe4'),_0xf1c2('0x45'),_0xf1c2('0x77'),_0xf1c2('0xa3')]})['then'](function(_0x3796ce){if(_0x3796ce){if(_0x3796ce[_0xf1c2('0x45')]==='agent'){_0xcac66b=_0x3796ce;if(_0x5cb381[_0xf1c2('0x6b')][_0xf1c2('0xa5')]){_0x25c975=util['format'](_0xf1c2('0xe5'),_0xcac66b[_0x5cb381[_0xf1c2('0x6b')]['interface']]);}else if(_0x5cb381[_0xf1c2('0x6b')][_0xf1c2('0xe6')]){_0x25c975=util[_0xf1c2('0xb2')](_0xf1c2('0xb3'),_0x5cb381[_0xf1c2('0x6b')][_0xf1c2('0xe6')]);}else{_0x25c975=util['format'](_0xf1c2('0xb3'),_0xcac66b[_0xf1c2('0x48')]);}socket['to'](util[_0xf1c2('0xb2')](_0xf1c2('0xe7'),_0xcac66b[_0xf1c2('0x48')]))[_0xf1c2('0xac')]('user:forcelogout',{'ip':_0x5cb381[_0xf1c2('0xe8')][_0xf1c2('0xe9')]||_0x5cb381[_0xf1c2('0xea')][_0xf1c2('0xeb')]||_0x5cb381[_0xf1c2('0xec')][_0xf1c2('0xeb')]||_0x5cb381['connection'][_0xf1c2('0xec')][_0xf1c2('0xeb')]});return db[_0xf1c2('0xb4')][_0xf1c2('0x3e')]({'where':{'membername':_0xcac66b[_0xf1c2('0x48')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xf1c2('0x24'))](_0xf1c2('0xed'));}})['then'](function(){if(_0xcac66b){return _0xcac66b[_0xf1c2('0xee')]({'raw':!![]});}})['then'](function(_0x409209){if(_0xcac66b){var _0x4abd0b=[];if(_0x409209){_0x845711=_0x409209;if(_0x845711[_0xf1c2('0x59')]){for(var _0x4b8fea=0x0;_0x4b8fea<_0x845711['length'];_0x4b8fea++){_0x4abd0b[_0xf1c2('0xb1')]({'membername':_0xcac66b['name'],'UserId':_0xcac66b['id'],'queue_name':_0x845711[_0x4b8fea]['name'],'VoiceQueueId':_0x845711[_0x4b8fea]['id'],'interface':_0x25c975,'paused':_0xcac66b[_0xf1c2('0xa3')]||![],'penalty':_0x845711[_0x4b8fea][_0xf1c2('0xef')]||0x0});}return BPromise[_0xf1c2('0xf0')](_0x4abd0b,function(_0x45864f){return db[_0xf1c2('0xb4')][_0xf1c2('0xb5')](_0x45864f);});}}}})[_0xf1c2('0x27')](function(){if(_0xcac66b){return db[_0xf1c2('0xf1')][_0xf1c2('0x65')]({'where':{'membername':_0xcac66b['name'],'exitAt':null}});}})[_0xf1c2('0x27')](function(_0x57ccfb){if(_0xcac66b){var _0x5c4cfc=[];_0x57ccfb[_0xf1c2('0xf2')](function(_0x3ae3b0){_0x5c4cfc[_0xf1c2('0xb1')](_0x3ae3b0[_0xf1c2('0x3d')]({'exitAt':moment()['format'](_0xf1c2('0xf3'))}));});return BPromise['all'](_0x5c4cfc);}})['then'](function(){if(_0xcac66b){var _0x47d69b=[];var _0x341d58=[];var _0x1b4c00=utils[_0xf1c2('0xf4')]();var _0x31456b={'membername':_0xcac66b[_0xf1c2('0x48')],'interface':_0x25c975,'enterAt':moment()[_0xf1c2('0xb2')](_0xf1c2('0xf3')),'role':_0xcac66b[_0xf1c2('0x45')],'internal':_0xcac66b[_0xf1c2('0x77')]};_0x1b4c00['forEach'](function(_0x222aed){_0x47d69b[_0xf1c2('0xb1')](_[_0xf1c2('0x5e')]({'channel':_0x222aed,'type':_0xf1c2('0xf5'),'data1':_0x5cb381[_0xf1c2('0x6b')][_0xf1c2('0xf6')],'data2':_0x25c975},_0x31456b));if(_0xcac66b[_0xf1c2('0xa3')]){_0x341d58['push'](_[_0xf1c2('0x5e')]({'channel':_0x222aed,'type':_0xf1c2('0xf7'),'data1':_0xf1c2('0xf8')},_0x31456b));}});return db['MemberReport']['bulkCreate'](_0x47d69b[_0xf1c2('0xf9')](_0x341d58),{'individualHooks':!![]});}})[_0xf1c2('0x27')](function(){if(_0xcac66b){return _0xcac66b['update']({'online':!![],'lastLoginAt':moment()[_0xf1c2('0xb2')](_0xf1c2('0xf3')),'voicePause':_0xcac66b[_0xf1c2('0xa3')]||![],'mailPause':_0xcac66b['loginInPause']||![],'chatPause':_0xcac66b[_0xf1c2('0xa3')]||![],'faxPause':_0xcac66b[_0xf1c2('0xa3')]||![],'smsPause':_0xcac66b[_0xf1c2('0xa3')]||![],'openchannelPause':_0xcac66b[_0xf1c2('0xa3')]||![],'whatsappPause':_0xcac66b['loginInPause']||![],'pauseType':_0xcac66b[_0xf1c2('0xa3')]?_0xf1c2('0xf8'):null,'interface':_0x25c975,'lastPauseAt':moment()[_0xf1c2('0xb2')](_0xf1c2('0xf3'))});}})[_0xf1c2('0x27')](function(_0xbb002d){if(_0x5cb381['isMiddleware']){return _0x13bf25();}else{return BPromise['resolve'](_0xbb002d)['then'](respondWithResult(_0x3cc196,null));}})[_0xf1c2('0x31')](handleError(_0x3cc196,null));};exports[_0xf1c2('0xfa')]=function(_0x602da7,_0x17ce37,_0x40403c){var _0x1b08fb;return db[_0xf1c2('0x4b')][_0xf1c2('0x46')]({'where':{'id':_0x602da7[_0xf1c2('0x67')]['id'],'role':_0xf1c2('0x41')},'attributes':['id',_0xf1c2('0x48'),_0xf1c2('0x45')]})[_0xf1c2('0x27')](handleEntityNotFound(_0x17ce37,null))[_0xf1c2('0x27')](function(_0x5233f5){if(_0x5233f5){_0x1b08fb=_0x5233f5;return db['UserVoiceQueueRt'][_0xf1c2('0x3e')]({'where':{'membername':_0x1b08fb['name']},'individualHooks':!![]});}})[_0xf1c2('0x27')](function(){return db[_0xf1c2('0xf1')][_0xf1c2('0x65')]({'where':{'membername':_0x1b08fb['name'],'exitAt':null}});})[_0xf1c2('0x27')](function(_0x1bbab2){var _0x498dc5=[];_0x1bbab2[_0xf1c2('0xf2')](function(_0x5f1c3f){_0x498dc5[_0xf1c2('0xb1')](_0x5f1c3f[_0xf1c2('0x3d')]({'exitAt':moment()['format'](_0xf1c2('0xf3'))}));});return BPromise[_0xf1c2('0xfb')](_0x498dc5);})[_0xf1c2('0x27')](function(){return _0x1b08fb[_0xf1c2('0x3d')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xf1c2('0x27')](respondWithResult(_0x17ce37,null))[_0xf1c2('0x31')](handleError(_0x17ce37,null));};exports[_0xf1c2('0xfc')]=function(_0x265566,_0x47e946,_0x4627eb){var _0xcacdb9;return db['UserVoiceQueueRt'][_0xf1c2('0x3d')]({'paused':0x1},{'where':{'UserId':_0x265566[_0xf1c2('0x67')]['id']},'individualHooks':!![]})[_0xf1c2('0x27')](function(){return db[_0xf1c2('0x4b')][_0xf1c2('0x46')]({'where':{'id':_0x265566['params']['id'],'role':_0xf1c2('0x41')},'attributes':['id',_0xf1c2('0x48'),'role','internal','interface']});})['then'](handleEntityNotFound(_0x47e946,null))[_0xf1c2('0x27')](function(_0x255853){if(_0x255853){_0xcacdb9=_0x255853;return respondWithRpcPromise(_0xf1c2('0xfd'),_0xf1c2('0xfc'),{'id':_0xcacdb9['id'],'name':_0xcacdb9[_0xf1c2('0x48')],'pause':!![]});}})[_0xf1c2('0x27')](function(){if(_0xcacdb9){return db[_0xf1c2('0xf1')][_0xf1c2('0x65')]({'where':{'membername':_0xcacdb9[_0xf1c2('0x48')],'type':_0xf1c2('0xf7'),'exitAt':null}});}})[_0xf1c2('0x27')](function(_0x1faadc){if(_0x1faadc[_0xf1c2('0x59')]){var _0x5194e0=moment()[_0xf1c2('0xb2')](_0xf1c2('0xf3'));for(var _0x26b6e7=0x0,_0x1257ad=_0x1faadc[_0xf1c2('0x59')];_0x26b6e7<_0x1257ad;_0x26b6e7++){_0x1faadc[_0x26b6e7]['updateAttributes']({'exitAt':_0x5194e0});}}})['then'](function(){var _0x591d03=[];var _0xcc4c6a=utils[_0xf1c2('0xf4')]();_0xcc4c6a[_0xf1c2('0xf2')](function(_0x48a151){_0x591d03[_0xf1c2('0xb1')]({'channel':_0x48a151,'membername':_0xcacdb9[_0xf1c2('0x48')],'interface':_[_0xf1c2('0x7b')](_0xcacdb9[_0xf1c2('0xa5')])?util[_0xf1c2('0xb2')](_0xf1c2('0xb3'),_0xcacdb9[_0xf1c2('0x48')]):_0xcacdb9[_0xf1c2('0xa5')],'type':_0xf1c2('0xf7'),'enterAt':moment()['format'](_0xf1c2('0xf3')),'data1':_0x265566[_0xf1c2('0x6b')][_0xf1c2('0x4d')]||'DEFAULT\x20PAUSE','role':_0xcacdb9[_0xf1c2('0x45')],'internal':_0xcacdb9[_0xf1c2('0x77')]});});return db[_0xf1c2('0xf1')][_0xf1c2('0x6a')](_0x591d03,{'individualHooks':!![]});})[_0xf1c2('0x27')](function(){return _0xcacdb9[_0xf1c2('0x3d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x265566[_0xf1c2('0x6b')][_0xf1c2('0x4d')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xf1c2('0xf3'))});})[_0xf1c2('0x27')](respondWithResult(_0x47e946,null))[_0xf1c2('0x31')](handleError(_0x47e946,null));};exports[_0xf1c2('0xfe')]=function(_0x18983c,_0x373f2e,_0x26e6e5){var _0x45c49f;return db[_0xf1c2('0x4b')]['find']({'where':{'id':_0x18983c[_0xf1c2('0x67')]['id']},'attributes':['id','name',_0xf1c2('0x45'),_0xf1c2('0xa4'),'mailPause','chatPause',_0xf1c2('0xff'),_0xf1c2('0x100'),_0xf1c2('0x101'),_0xf1c2('0x102'),'pauseType','lastPauseAt']})['then'](handleEntityNotFound(_0x373f2e,null))[_0xf1c2('0x27')](function(_0xba04a4){if(_0xba04a4){_0x45c49f=_0xba04a4;if(_0x18983c['body'][_0xf1c2('0xa2')]&&!utils[_0xf1c2('0xcd')](_0x18983c[_0xf1c2('0x6b')][_0xf1c2('0xa2')])){throw new db['Sequelize'][(_0xf1c2('0x24'))](_0xf1c2('0xb7'));}switch(_0x18983c[_0xf1c2('0x6b')][_0xf1c2('0xa2')]){case'voice':return respondWithRpcPromise(_0xf1c2('0xfd'),_0xf1c2('0xfe'),{'id':_0x45c49f['id'],'name':_0x45c49f['name'],'pause':![]})[_0xf1c2('0x27')](function(){return db['UserVoiceQueueRt'][_0xf1c2('0x3d')]({'paused':0x0},{'where':{'UserId':_0x45c49f['id']},'individualHooks':!![]});})[_0xf1c2('0x27')](function(){return db[_0xf1c2('0xf1')][_0xf1c2('0x46')]({'where':{'channel':_0x18983c[_0xf1c2('0x6b')]['channel'],'membername':_0x45c49f['name'],'type':_0xf1c2('0xf7'),'exitAt':null}});})[_0xf1c2('0x27')](function(_0x4f6d22){if(_0x4f6d22){return _0x4f6d22[_0xf1c2('0x3d')]({'exitAt':moment()[_0xf1c2('0xb2')](_0xf1c2('0xf3')),'data2':_0xf1c2('0x103')},{'individualHooks':!![]});}return null;})[_0xf1c2('0x27')](function(){return _0x45c49f[_0xf1c2('0x3d')]({'voicePause':![]});});case'mail':case'chat':case'fax':case _0xf1c2('0x104'):case _0xf1c2('0x105'):case _0xf1c2('0x106'):return db[_0xf1c2('0xf1')][_0xf1c2('0x46')]({'where':{'channel':_0x18983c[_0xf1c2('0x6b')][_0xf1c2('0xa2')],'membername':_0x45c49f[_0xf1c2('0x48')],'type':_0xf1c2('0xf7'),'exitAt':null}})['then'](function(_0x26a870){if(_0x26a870){return _0x26a870[_0xf1c2('0x3d')]({'exitAt':moment()[_0xf1c2('0xb2')](_0xf1c2('0xf3')),'data2':_0xf1c2('0x103')},{'individualHooks':!![]});}return null;})[_0xf1c2('0x27')](function(){var _0x25ae84={};_['set'](_0x25ae84,util[_0xf1c2('0xb2')](_0xf1c2('0x107'),_0x18983c[_0xf1c2('0x6b')]['channel'],_0xf1c2('0x108')),![]);return _0x45c49f[_0xf1c2('0x3d')](_0x25ae84);});default:return respondWithRpcPromise('QueuePause',_0xf1c2('0xfe'),{'id':_0x45c49f['id'],'name':_0x45c49f[_0xf1c2('0x48')],'pause':![]})['then'](function(){return db[_0xf1c2('0xb4')][_0xf1c2('0x3d')]({'paused':0x0},{'where':{'UserId':_0x45c49f['id']}});})[_0xf1c2('0x27')](function(){return db[_0xf1c2('0xf1')][_0xf1c2('0x65')]({'where':{'membername':_0x45c49f[_0xf1c2('0x48')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x570783){var _0x166532=[];_0x570783['forEach'](function(_0x12361e){_0x166532[_0xf1c2('0xb1')](_0x12361e['update']({'exitAt':moment()['format'](_0xf1c2('0xf3')),'data2':'manual'}));});return BPromise[_0xf1c2('0xfb')](_0x166532);})[_0xf1c2('0x27')](function(){return _0x45c49f['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x373f2e,null))[_0xf1c2('0x31')](handleError(_0x373f2e,null));};exports[_0xf1c2('0x109')]=function(_0x84f937,_0x1406c5,_0x249dbf){var _0x4880d7={};var _0x4c91dd={};var _0x567a7a;var _0x1a4d41;return db[_0xf1c2('0x4b')][_0xf1c2('0x97')]({'where':{'id':_0x84f937['params']['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x1406c5,null))[_0xf1c2('0x27')](function(_0x2d6e3c){if(_0x2d6e3c){_0x567a7a=_0x2d6e3c;_0x4c91dd[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db['Team'][_0xf1c2('0x4c')]);_0x4c91dd[_0xf1c2('0x54')]=_[_0xf1c2('0x55')](_0x84f937[_0xf1c2('0x54')]);_0x4c91dd[_0xf1c2('0x68')]=_[_0xf1c2('0x56')](_0x4c91dd[_0xf1c2('0x4f')],_0x4c91dd[_0xf1c2('0x54')]);_0x4880d7[_0xf1c2('0x57')]=_['intersection'](_0x4c91dd[_0xf1c2('0x4f')],qs[_0xf1c2('0x58')](_0x84f937[_0xf1c2('0x54')][_0xf1c2('0x58')]));_0x4880d7[_0xf1c2('0x57')]=_0x4880d7['attributes']['length']?_0x4880d7[_0xf1c2('0x57')]:_0x4c91dd[_0xf1c2('0x4f')];_0x4880d7[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x84f937[_0xf1c2('0x54')]['sort']);_0x4880d7[_0xf1c2('0x5d')]=qs[_0xf1c2('0x68')](_[_0xf1c2('0xce')](_0x84f937[_0xf1c2('0x54')],_0x4c91dd[_0xf1c2('0x68')]));if(_0x84f937[_0xf1c2('0x54')][_0xf1c2('0x44')]){_0x4880d7[_0xf1c2('0x5d')]=_[_0xf1c2('0x5e')](_0x4880d7[_0xf1c2('0x5d')],{'$or':_[_0xf1c2('0x51')](_0x4880d7['attributes'],function(_0x5bcba9){var _0x4b0aca={};_0x4b0aca[_0x5bcba9]={'$like':'%'+_0x84f937[_0xf1c2('0x54')][_0xf1c2('0x44')]+'%'};return _0x4b0aca;})});}_0x4880d7=_[_0xf1c2('0x5e')]({},_0x4880d7,_0x84f937[_0xf1c2('0x62')]);return _0x567a7a[_0xf1c2('0x109')](_0x4880d7);}})[_0xf1c2('0x27')](function(_0x29ddee){if(_0x29ddee){_0x1a4d41=_0x29ddee[_0xf1c2('0x59')];if(!_0x84f937[_0xf1c2('0x54')][_0xf1c2('0xc6')](_0xf1c2('0x5a'))){_0x4880d7['limit']=qs[_0xf1c2('0x37')](_0x84f937['query'][_0xf1c2('0x37')]);_0x4880d7['offset']=qs[_0xf1c2('0x36')](_0x84f937[_0xf1c2('0x54')][_0xf1c2('0x36')]);}return _0x567a7a[_0xf1c2('0x109')](_0x4880d7);}})[_0xf1c2('0x27')](function(_0x405f29){if(_0x405f29){return _0x405f29?{'count':_0x1a4d41,'rows':_0x405f29}:null;}})['then'](respondWithResult(_0x1406c5,null))['catch'](handleError(_0x1406c5,null));};exports[_0xf1c2('0x10a')]=function(_0x187b2a,_0x2cb48f){return db[_0xf1c2('0x4b')][_0xf1c2('0x46')]({'where':{'id':_0x187b2a[_0xf1c2('0x67')]['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x2cb48f,null))['then'](function(_0x902144){if(_0x902144){var _0x56928d=_0x902144[_0xf1c2('0x92')]({'plain':!![]});return _0x902144[_0xf1c2('0x10a')](_0x187b2a['body'][_0xf1c2('0x6e')],_['omit'](_0x187b2a[_0xf1c2('0x6b')],[_0xf1c2('0x6e'),'id'])||{})[_0xf1c2('0x27')](function(){for(var _0x5292ab=0x0;_0x5292ab<_0x187b2a[_0xf1c2('0x6b')][_0xf1c2('0x6e')][_0xf1c2('0x59')];_0x5292ab++){var _0x54952b=[];db[_0xf1c2('0x10b')]['findOne']({'where':{'id':_0x187b2a[_0xf1c2('0x6b')]['ids'][_0x5292ab]}})[_0xf1c2('0x27')](function(_0x13edbd){_0x54952b['push'](_0x13edbd['getVoiceQueues']()[_0xf1c2('0x27')](function(_0xede140){for(var _0x312428=0x0;_0x312428<_0xede140[_0xf1c2('0x59')];_0x312428++){_0xede140[_0x312428]['setDataValue'](_0xf1c2('0xa2'),_0xf1c2('0x10c'));}return _0xede140;}));_0x54952b['push'](_0x13edbd[_0xf1c2('0x10d')]()[_0xf1c2('0x27')](function(_0x5d6f2b){for(var _0x581b12=0x0;_0x581b12<_0x5d6f2b[_0xf1c2('0x59')];_0x581b12++){_0x5d6f2b[_0x581b12]['setDataValue']('channel',_0xf1c2('0x10e'));}return _0x5d6f2b;}));_0x54952b['push'](_0x13edbd[_0xf1c2('0x10f')]()[_0xf1c2('0x27')](function(_0x2cc007){for(var _0x1236a8=0x0;_0x1236a8<_0x2cc007['length'];_0x1236a8++){_0x2cc007[_0x1236a8]['setDataValue'](_0xf1c2('0xa2'),_0xf1c2('0x110'));}return _0x2cc007;}));_0x54952b[_0xf1c2('0xb1')](_0x13edbd[_0xf1c2('0x111')]()[_0xf1c2('0x27')](function(_0x1ed4ca){for(var _0xa79889=0x0;_0xa79889<_0x1ed4ca[_0xf1c2('0x59')];_0xa79889++){_0x1ed4ca[_0xa79889][_0xf1c2('0x112')]('channel',_0xf1c2('0x113'));}return _0x1ed4ca;}));_0x54952b[_0xf1c2('0xb1')](_0x13edbd[_0xf1c2('0x114')]()['then'](function(_0xde9169){for(var _0x1c2815=0x0;_0x1c2815<_0xde9169[_0xf1c2('0x59')];_0x1c2815++){_0xde9169[_0x1c2815][_0xf1c2('0x112')](_0xf1c2('0xa2'),_0xf1c2('0x115'));}return _0xde9169;}));_0x54952b[_0xf1c2('0xb1')](_0x13edbd[_0xf1c2('0x116')]()['then'](function(_0x25f6de){for(var _0x4bda13=0x0;_0x4bda13<_0x25f6de[_0xf1c2('0x59')];_0x4bda13++){_0x25f6de[_0x4bda13][_0xf1c2('0x112')]('channel',_0xf1c2('0x117'));}return _0x25f6de;}));_0x54952b['push'](_0x13edbd[_0xf1c2('0x118')]()['then'](function(_0x8ee9a7){for(var _0x47a5b5=0x0;_0x47a5b5<_0x8ee9a7[_0xf1c2('0x59')];_0x47a5b5++){_0x8ee9a7[_0x47a5b5][_0xf1c2('0x112')](_0xf1c2('0xa2'),_0xf1c2('0x119'));}return _0x8ee9a7;}));return BPromise[_0xf1c2('0xfb')](_0x54952b);})['then'](function(_0x113e39){var _0x1c2542=_[_0xf1c2('0x11a')](_0x113e39);_0x54952b=[];return db['sequelize'][_0xf1c2('0x11b')](function(_0x4287a1){for(var _0x2ed185=0x0;_0x2ed185<_0x1c2542['length'];_0x2ed185++){_0x54952b[_0xf1c2('0xb1')](_0x1c2542[_0x2ed185][_0xf1c2('0x11c')](_0x56928d['id']),{'transaction':_0x4287a1});}return BPromise['all'](_0x54952b)[_0xf1c2('0x27')](function(){if(_0x56928d[_0xf1c2('0xb0')]){return BPromise[_0xf1c2('0xf0')](_[_0xf1c2('0x44')](_0x1c2542,function(_0x3290cd){return _0x3290cd[_0xf1c2('0x11d')](_0xf1c2('0xa2'))===_0xf1c2('0x10c');}),function(_0xfa09b6){return db[_0xf1c2('0xb4')][_0xf1c2('0xb5')]({'membername':_0x56928d['name'],'UserId':_0x56928d['id'],'queue_name':_0xfa09b6['name'],'VoiceQueueId':_0xfa09b6['id'],'interface':_[_0xf1c2('0x7b')](_0x56928d[_0xf1c2('0xa5')])?util[_0xf1c2('0xb2')](_0xf1c2('0xb3'),_0x56928d[_0xf1c2('0x48')]):_0x56928d[_0xf1c2('0xa5')],'paused':_0x56928d['voicePause']||![],'penalty':_0x56928d['penalty']},{'transaction':_0x4287a1});});}else{return;}})[_0xf1c2('0x27')](function(){for(var _0x9b0ed=0x0;_0x9b0ed<_0x1c2542['length'];_0x9b0ed++){var _0x2a11ae=_0x1c2542[_0x9b0ed][_0xf1c2('0x11d')](_0xf1c2('0xa2'));var _0x5bfb8a=_0x2a11ae+_0xf1c2('0xab');socket[_0xf1c2('0xac')]('user'+_0x2a11ae+_0xf1c2('0xad'),{'UserId':_0x56928d['id'],['queueField']:_0x1c2542[_0x9b0ed]['id']});}});});});}});}})[_0xf1c2('0x27')](respondWithStatusCode(_0x2cb48f,null))[_0xf1c2('0x31')](handleError(_0x2cb48f,null));};exports[_0xf1c2('0x11e')]=function(_0x4b1986,_0x185cfd){return db['User']['findOne']({'where':{'id':_0x4b1986[_0xf1c2('0x67')]['id']}})['then'](handleEntityNotFound(_0x185cfd,null))['then'](function(_0x56c5af){if(_0x56c5af){var _0x54bcb4=_0x56c5af[_0xf1c2('0x92')]({'plain':!![]});var _0x167e24=_0x4b1986[_0xf1c2('0x54')][_0xf1c2('0x6e')];return _0x56c5af[_0xf1c2('0x11e')](_0x167e24)['then'](function(){for(var _0x367cde=0x0;_0x367cde<_0x167e24[_0xf1c2('0x59')];_0x367cde++){var _0x44640e=[];db['Team'][_0xf1c2('0x97')]({'where':{'id':_0x167e24[_0x367cde]}})[_0xf1c2('0x27')](function(_0x18a09f){_0x44640e[_0xf1c2('0xb1')](_0x18a09f[_0xf1c2('0xee')]()[_0xf1c2('0x27')](function(_0x3bf0bb){for(var _0x10403e=0x0;_0x10403e<_0x3bf0bb[_0xf1c2('0x59')];_0x10403e++){_0x3bf0bb[_0x10403e][_0xf1c2('0x112')](_0xf1c2('0xa2'),_0xf1c2('0x10c'));}return _0x3bf0bb;}));_0x44640e[_0xf1c2('0xb1')](_0x18a09f['getChatQueues']()[_0xf1c2('0x27')](function(_0x3c5ae0){for(var _0x97ffa9=0x0;_0x97ffa9<_0x3c5ae0[_0xf1c2('0x59')];_0x97ffa9++){_0x3c5ae0[_0x97ffa9]['setDataValue'](_0xf1c2('0xa2'),_0xf1c2('0x10e'));}return _0x3c5ae0;}));_0x44640e[_0xf1c2('0xb1')](_0x18a09f[_0xf1c2('0x10f')]()[_0xf1c2('0x27')](function(_0x45a6e0){for(var _0x1773ef=0x0;_0x1773ef<_0x45a6e0[_0xf1c2('0x59')];_0x1773ef++){_0x45a6e0[_0x1773ef]['setDataValue'](_0xf1c2('0xa2'),_0xf1c2('0x110'));}return _0x45a6e0;}));_0x44640e[_0xf1c2('0xb1')](_0x18a09f[_0xf1c2('0x111')]()['then'](function(_0x250a38){for(var _0x49f6ff=0x0;_0x49f6ff<_0x250a38[_0xf1c2('0x59')];_0x49f6ff++){_0x250a38[_0x49f6ff][_0xf1c2('0x112')](_0xf1c2('0xa2'),'Sms');}return _0x250a38;}));_0x44640e[_0xf1c2('0xb1')](_0x18a09f['getWhatsappQueues']()[_0xf1c2('0x27')](function(_0x372396){for(var _0x5094cb=0x0;_0x5094cb<_0x372396[_0xf1c2('0x59')];_0x5094cb++){_0x372396[_0x5094cb][_0xf1c2('0x112')](_0xf1c2('0xa2'),_0xf1c2('0x115'));}return _0x372396;}));_0x44640e[_0xf1c2('0xb1')](_0x18a09f[_0xf1c2('0x116')]()[_0xf1c2('0x27')](function(_0x56ce08){for(var _0x12718e=0x0;_0x12718e<_0x56ce08[_0xf1c2('0x59')];_0x12718e++){_0x56ce08[_0x12718e][_0xf1c2('0x112')]('channel',_0xf1c2('0x117'));}return _0x56ce08;}));_0x44640e[_0xf1c2('0xb1')](_0x18a09f[_0xf1c2('0x118')]()['then'](function(_0x3008d8){for(var _0x35b3d5=0x0;_0x35b3d5<_0x3008d8['length'];_0x35b3d5++){_0x3008d8[_0x35b3d5]['setDataValue'](_0xf1c2('0xa2'),_0xf1c2('0x119'));}return _0x3008d8;}));return BPromise[_0xf1c2('0xfb')](_0x44640e);})[_0xf1c2('0x27')](function(_0x307150){var _0x1a060c=_[_0xf1c2('0x11a')](_0x307150);_0x44640e=[];return db[_0xf1c2('0x60')][_0xf1c2('0x11b')](function(_0x15c4d3){for(var _0x2c5a29=0x0;_0x2c5a29<_0x1a060c[_0xf1c2('0x59')];_0x2c5a29++){_0x44640e[_0xf1c2('0xb1')](_0x1a060c[_0x2c5a29][_0xf1c2('0x11f')](_0x54bcb4['id']),{'transaction':_0x15c4d3});}return BPromise[_0xf1c2('0xfb')](_0x44640e)[_0xf1c2('0x27')](function(){if(_0x54bcb4['online']){return BPromise[_0xf1c2('0xf0')](_[_0xf1c2('0x44')](_0x1a060c,function(_0x54ea05){return _0x54ea05[_0xf1c2('0x11d')](_0xf1c2('0xa2'))===_0xf1c2('0x10c');}),function(_0x4f2312){return db['UserVoiceQueueRt'][_0xf1c2('0x3e')]({'where':{'VoiceQueueId':_0x4f2312['id'],'UserId':_0x54bcb4['id']},'transaction':_0x15c4d3});});}else{return;}})[_0xf1c2('0x27')](function(){for(var _0x55e572=0x0;_0x55e572<_0x1a060c[_0xf1c2('0x59')];_0x55e572++){var _0x403f82=_0x1a060c[_0x55e572][_0xf1c2('0x11d')](_0xf1c2('0xa2'));var _0x1e1762=_0x403f82+'QueueId';socket[_0xf1c2('0xac')](_0xf1c2('0x90')+_0x403f82+_0xf1c2('0xb9'),{'UserId':_0x54bcb4['id'],['queueField']:_0x1a060c[_0x55e572]['id']});}});});});}});}})[_0xf1c2('0x27')](respondWithStatusCode(_0x185cfd,null))['catch'](handleError(_0x185cfd,null));};exports[_0xf1c2('0x120')]=function(_0x1d4476,_0x112715,_0x430967){var _0x1de36a={};var _0x4378d3={};var _0x1a3448;var _0x3a9100;return db[_0xf1c2('0x4b')][_0xf1c2('0x97')]({'where':{'id':_0x1d4476['params']['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x112715,null))[_0xf1c2('0x27')](function(_0x118bb2){if(_0x118bb2){_0x1a3448=_0x118bb2;_0x4378d3[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db['CmList'][_0xf1c2('0x4c')]);_0x4378d3[_0xf1c2('0x54')]=_[_0xf1c2('0x55')](_0x1d4476['query']);_0x4378d3[_0xf1c2('0x68')]=_[_0xf1c2('0x56')](_0x4378d3['model'],_0x4378d3[_0xf1c2('0x54')]);_0x1de36a[_0xf1c2('0x57')]=_['intersection'](_0x4378d3['model'],qs[_0xf1c2('0x58')](_0x1d4476[_0xf1c2('0x54')][_0xf1c2('0x58')]));_0x1de36a['attributes']=_0x1de36a[_0xf1c2('0x57')]['length']?_0x1de36a[_0xf1c2('0x57')]:_0x4378d3['model'];_0x1de36a[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x1d4476[_0xf1c2('0x54')][_0xf1c2('0x5c')]);_0x1de36a['where']=qs['filters'](_[_0xf1c2('0xce')](_0x1d4476[_0xf1c2('0x54')],_0x4378d3[_0xf1c2('0x68')]));if(_0x1d4476['query'][_0xf1c2('0x44')]){_0x1de36a[_0xf1c2('0x5d')]=_[_0xf1c2('0x5e')](_0x1de36a[_0xf1c2('0x5d')],{'$or':_[_0xf1c2('0x51')](_0x1de36a[_0xf1c2('0x57')],function(_0x1b1276){var _0x1a389c={};_0x1a389c[_0x1b1276]={'$like':'%'+_0x1d4476[_0xf1c2('0x54')][_0xf1c2('0x44')]+'%'};return _0x1a389c;})});}_0x1de36a=_[_0xf1c2('0x5e')]({},_0x1de36a,_0x1d4476[_0xf1c2('0x62')]);return _0x1a3448[_0xf1c2('0x120')](_0x1de36a);}})[_0xf1c2('0x27')](function(_0x1ab921){if(_0x1ab921){_0x3a9100=_0x1ab921[_0xf1c2('0x59')];if(!_0x1d4476[_0xf1c2('0x54')][_0xf1c2('0xc6')](_0xf1c2('0x5a'))){_0x1de36a[_0xf1c2('0x37')]=qs[_0xf1c2('0x37')](_0x1d4476[_0xf1c2('0x54')][_0xf1c2('0x37')]);_0x1de36a[_0xf1c2('0x36')]=qs['offset'](_0x1d4476[_0xf1c2('0x54')]['offset']);}return _0x1a3448[_0xf1c2('0x120')](_0x1de36a);}})['then'](function(_0x91e4a7){if(_0x91e4a7){return _0x91e4a7?{'count':_0x3a9100,'rows':_0x91e4a7}:null;}})[_0xf1c2('0x27')](respondWithResult(_0x112715,null))[_0xf1c2('0x31')](handleError(_0x112715,null));};exports[_0xf1c2('0x121')]=function(_0x2d5aa7,_0x16ecda,_0x22960c){var _0x4f9976={};var _0x548f52={};var _0x48267f;var _0x2e48b1;return db[_0xf1c2('0x4b')][_0xf1c2('0x97')]({'where':{'id':_0x2d5aa7['params']['id']}})[_0xf1c2('0x27')](handleEntityNotFound(_0x16ecda,null))[_0xf1c2('0x27')](function(_0x25bc48){if(_0x25bc48){_0x48267f=_0x25bc48;_0x548f52[_0xf1c2('0x4f')]=_[_0xf1c2('0x55')](db[_0xf1c2('0x4b')][_0xf1c2('0x4c')]);_0x548f52[_0xf1c2('0x54')]=_[_0xf1c2('0x55')](_0x2d5aa7[_0xf1c2('0x54')]);_0x548f52[_0xf1c2('0x68')]=_[_0xf1c2('0x56')](_0x548f52['model'],_0x548f52[_0xf1c2('0x54')]);_0x4f9976[_0xf1c2('0x57')]=_['intersection'](_0x548f52['model'],qs[_0xf1c2('0x58')](_0x2d5aa7[_0xf1c2('0x54')][_0xf1c2('0x58')]));_0x4f9976[_0xf1c2('0x57')]=_0x4f9976[_0xf1c2('0x57')][_0xf1c2('0x59')]?_0x4f9976['attributes']:_0x548f52[_0xf1c2('0x4f')];_0x4f9976[_0xf1c2('0x5b')]=qs[_0xf1c2('0x5c')](_0x2d5aa7[_0xf1c2('0x54')]['sort']);_0x4f9976[_0xf1c2('0x5d')]=qs[_0xf1c2('0x68')](_['pick'](_0x2d5aa7[_0xf1c2('0x54')],_0x548f52[_0xf1c2('0x68')]));if(_0x2d5aa7[_0xf1c2('0x54')][_0xf1c2('0x44')]){_0x4f9976[_0xf1c2('0x5d')]=_['merge'](_0x4f9976[_0xf1c2('0x5d')],{'$or':_['map'](_0x4f9976[_0xf1c2('0x57')],function(_0x42771d){var _0x187f0b={};_0x187f0b[_0x42771d]={'$like':'%'+_0x2d5aa7[_0xf1c2('0x54')]['filter']+'%'};return _0x187f0b;})});}_0x4f9976['model']=db[_0xf1c2('0x4b')];_0x4f9976['as']=_0xf1c2('0x40');_0x4f9976=_[_0xf1c2('0x5e')]({},_0x4f9976,_0x2d5aa7['options']);return _0x48267f['getVoiceQueues']({'include':[_0x4f9976]});}})[_0xf1c2('0x27')](function(_0x53cc3b){if(_0x53cc3b){var _0x4e3687={},_0x4cd180=[],_0x3f53e5=0x0;for(var _0xfe5229=0x0;_0xfe5229<_0x53cc3b[_0xf1c2('0x59')];_0xfe5229+=0x1){for(var _0x392330=0x0,_0x58b56e;_0x392330<_0x53cc3b[_0xfe5229][_0xf1c2('0x40')][_0xf1c2('0x59')];_0x392330+=0x1){_0x58b56e=_0x53cc3b[_0xfe5229]['Agents'][_0x392330][_0xf1c2('0x92')]({'plain':!![]});_0x4e3687[_0x58b56e['id']]=_0x58b56e;}}_0x4e3687=_['values'](_0x4e3687);for(var _0x3b1e52=qs[_0xf1c2('0x36')](_0x2d5aa7[_0xf1c2('0x54')][_0xf1c2('0x36')]);_0x3b1e52<_0x4e3687[_0xf1c2('0x59')]&&_0x4cd180[_0xf1c2('0x59')]=_0x1a9eea){_0x138318=_0x1a9eea;_0x135f46=0xc8;}else{_0x135f46=0xce;}_0xe066d8[_0x6709('0x2d')](_0x135f46);return _0xe066d8[_0x6709('0x30')](_0x6709('0x31'),_0x5deff5+'-'+_0x138318+'/'+_0x1a9eea)[_0x6709('0x32')](_0x4ad1c3);}return null;};}function patchUpdates(_0x69593c){return function(_0x402e45){try{jsonpatch[_0x6709('0x33')](_0x402e45,_0x69593c,!![]);}catch(_0x5d399b){return BPromise[_0x6709('0x34')](_0x5d399b);}return _0x402e45[_0x6709('0x35')]();};}function saveUpdates(_0x3cfbe6,_0x27e929){return function(_0x5dc856){if(_0x5dc856){return _0x5dc856[_0x6709('0x36')](_0x3cfbe6)[_0x6709('0x37')](function(_0x124e01){return _0x124e01;});}return null;};}function removeEntity(_0x1bd075,_0x4fd344){return function(_0x3bfc6d){if(_0x3bfc6d){return _0x3bfc6d[_0x6709('0x38')]()['then'](function(){var _0x8952f1=_0x3bfc6d[_0x6709('0x39')]({'plain':!![]});var _0x5aa83b=[{'name':_0x6709('0x3a'),'value':_0x6709('0x3b'),'ignore':!![]},{'name':_0x6709('0x3c'),'value':_0x6709('0x3d'),'ignore':![]},{'name':_0x6709('0x3e'),'value':_0x6709('0x3f'),'ignore':![]}];var _0x2cd68b=_(_0x5aa83b)['filter'](_0x6709('0x40'))[_0x6709('0x41')]('value')[_0x6709('0x42')]();if(_[_0x6709('0x43')](_0x2cd68b,_0x8952f1[_0x6709('0x44')])){return;}var _0x2bb89c=_[_0x6709('0x45')](_0x5aa83b,[_0x6709('0x42'),_0x8952f1['role']])[_0x6709('0x46')];return db['UserProfileResource'][_0x6709('0x38')]({'where':{'type':_0x2bb89c,'resourceId':_0x8952f1['id']}})[_0x6709('0x37')](function(){return _0x3bfc6d;});})[_0x6709('0x37')](function(){_0x1bd075['status'](0xcc)[_0x6709('0x47')]();});}};}function handleEntityNotFound(_0x300c5b,_0x2d9879){return function(_0x3f06d8){if(!_0x3f06d8){_0x300c5b[_0x6709('0x48')](0x194);}return _0x3f06d8;};}function handleError(_0x1030ee,_0x450654){_0x450654=_0x450654||0x1f4;return function(_0x4fd4af){logger[_0x6709('0x29')](_0x4fd4af[_0x6709('0x49')]);if(_0x4fd4af[_0x6709('0x46')]){delete _0x4fd4af[_0x6709('0x46')];}_0x1030ee[_0x6709('0x2d')](_0x450654)[_0x6709('0x4a')](_0x4fd4af);};}exports[_0x6709('0x4b')]=function(_0x5ef9e2,_0x5abb53){var _0x265750={},_0x3f0da1={},_0x98a12c={'count':0x0,'rows':[]};var _0x42790d=_['map'](db['User']['rawAttributes'],function(_0x3d4237){return{'name':_0x3d4237[_0x6709('0x4c')],'type':_0x3d4237['type'][_0x6709('0x4d')]};});_0x3f0da1[_0x6709('0x4e')]=_['differenceBy'](_['map'](_0x42790d,_0x6709('0x46')),[_0x6709('0x4f'),_0x6709('0x50')]);_0x3f0da1[_0x6709('0x51')]=_[_0x6709('0x52')](_0x5ef9e2['query']);_0x3f0da1[_0x6709('0x53')]=_['intersection'](_0x3f0da1[_0x6709('0x4e')],_0x3f0da1[_0x6709('0x51')]);_0x265750[_0x6709('0x54')]=_['intersection'](_0x3f0da1[_0x6709('0x4e')],qs['fields'](_0x5ef9e2['query'][_0x6709('0x55')]));_0x265750[_0x6709('0x54')]=_0x265750[_0x6709('0x54')][_0x6709('0x56')]?_0x265750[_0x6709('0x54')]:_0x3f0da1[_0x6709('0x4e')];if(!_0x5ef9e2[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x265750[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x5ef9e2[_0x6709('0x51')][_0x6709('0x2f')]);_0x265750[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x5ef9e2['query'][_0x6709('0x2e')]);}_0x265750['order']=qs['sort'](_0x5ef9e2[_0x6709('0x51')][_0x6709('0x59')]);_0x265750[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x5ef9e2[_0x6709('0x51')],_0x3f0da1[_0x6709('0x53')]),_0x42790d);if(_0x5ef9e2[_0x6709('0x51')]['filter']){_0x265750[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x265750[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x42790d,function(_0x4c01e3){if(_0x4c01e3[_0x6709('0x5d')]!=='VIRTUAL'){return db[_0x6709('0x5e')][_0x6709('0x5a')](db[_0x6709('0x5e')]['fn'](_0x6709('0x5f'),db[_0x6709('0x5e')]['col'](_0x4c01e3[_0x6709('0x46')])),{'$like':db[_0x6709('0x5e')]['fn'](_0x6709('0x5f'),'%'+_0x5ef9e2[_0x6709('0x51')][_0x6709('0x60')]+'%')});}})});}_0x265750=_['merge']({},_0x265750,_0x5ef9e2['options']);var _0x447aa5={'where':_0x265750['where']};return db['User'][_0x6709('0x61')](_0x447aa5)[_0x6709('0x37')](function(_0x1bf824){_0x98a12c[_0x6709('0x61')]=_0x1bf824;if(_0x5ef9e2[_0x6709('0x51')][_0x6709('0x62')]){_0x265750[_0x6709('0x63')]=[{'all':!![]}];}return db[_0x6709('0x64')][_0x6709('0x65')](_0x265750);})[_0x6709('0x37')](function(_0x3c6d1f){_0x98a12c['rows']=_0x3c6d1f;return _0x98a12c;})[_0x6709('0x37')](respondWithFilteredResult(_0x5abb53,_0x265750))[_0x6709('0x2c')](handleError(_0x5abb53,null));};exports['show']=function(_0x4bec85,_0x151ec8){var _0x1b7966={'raw':![],'where':{'id':_0x4bec85[_0x6709('0x66')]['id']}},_0x14bdd3={};_0x14bdd3['model']=_[_0x6709('0x67')](_['keys'](db[_0x6709('0x64')][_0x6709('0x68')]),[_0x6709('0x4f'),_0x6709('0x50')]);_0x14bdd3[_0x6709('0x51')]=_['keys'](_0x4bec85['query']);_0x14bdd3[_0x6709('0x53')]=_[_0x6709('0x69')](_0x14bdd3['model'],_0x14bdd3[_0x6709('0x51')]);_0x1b7966[_0x6709('0x54')]=_['intersection'](_0x14bdd3[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x4bec85[_0x6709('0x51')][_0x6709('0x55')]));_0x1b7966['attributes']=_0x1b7966['attributes'][_0x6709('0x56')]?_0x1b7966['attributes']:_0x14bdd3[_0x6709('0x4e')];if(_0x4bec85[_0x6709('0x51')][_0x6709('0x62')]){_0x1b7966['include']=[{'all':!![]}];}_0x1b7966=_[_0x6709('0x5c')]({},_0x1b7966,_0x4bec85['options']);return db['User'][_0x6709('0x45')](_0x1b7966)['then'](handleEntityNotFound(_0x151ec8,null))[_0x6709('0x37')](respondWithResult(_0x151ec8,null))['catch'](handleError(_0x151ec8,null));};exports[_0x6709('0x6a')]=function(_0x34f790,_0x103261){return db[_0x6709('0x64')]['bulkCreate'](_0x34f790[_0x6709('0x6b')],{'raw':![],'individualHooks':!![]})[_0x6709('0x37')](respondWithResult(_0x103261,0xc9))[_0x6709('0x2c')](handleError(_0x103261,null));};exports[_0x6709('0x36')]=function(_0x210451,_0x3d4d1c){if(_0x210451[_0x6709('0x6b')]['id']){delete _0x210451['body']['id'];}delete _0x210451[_0x6709('0x6b')][_0x6709('0x44')];return db[_0x6709('0x64')][_0x6709('0x45')]({'where':{'id':_0x210451[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x3d4d1c,null))[_0x6709('0x37')](saveUpdates(_0x210451[_0x6709('0x6b')],null))[_0x6709('0x37')](respondWithResult(_0x3d4d1c,null))['catch'](handleError(_0x3d4d1c,null));};exports[_0x6709('0x6c')]=function(_0x122080,_0x50f992){return db[_0x6709('0x64')][_0x6709('0x6c')]()[_0x6709('0x37')](respondWithResult(_0x50f992,null))[_0x6709('0x2c')](handleError(_0x50f992,null));};exports[_0x6709('0x6d')]=function(_0x1df26d,_0x32db99,_0x475449){return db[_0x6709('0x64')]['find']({'where':{'id':_0x1df26d[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x32db99,null))[_0x6709('0x37')](function(_0x379020){if(_0x379020){return _0x379020[_0x6709('0x6d')](_0x1df26d[_0x6709('0x6b')][_0x6709('0x6e')],_[_0x6709('0x6f')](_0x1df26d[_0x6709('0x6b')],[_0x6709('0x6e'),'id'])||{});}})[_0x6709('0x37')](respondWithResult(_0x32db99,null))['catch'](handleError(_0x32db99,null));};var getLicense=function(_0x319b7e){return new BPromise(function(_0x47f73e,_0x566d6d){var _0x336b01=0x0;_0x319b7e[_0x6709('0x6b')][_0x6709('0x44')]===_0x6709('0x3d')&&_0x47f73e(_0x6709('0x70'));return db[_0x6709('0x64')][_0x6709('0x61')]({'where':{'$or':[{'role':_0x319b7e['body']['role']===_0x6709('0x3f')?'telephone':[_0x6709('0x71'),'user']}]}})[_0x6709('0x37')](function(_0x2f1faf){_0x336b01=_0x2f1faf;return require('../../config/license/util')['getLicense']();})['then'](function(_0x278148){var _0x2faf8f=_0x319b7e[_0x6709('0x6b')][_0x6709('0x44')]===_0x6709('0x3f')?_0x6709('0x72'):_0x6709('0x73');if(!_[_0x6709('0x74')](_0x278148[_0x2faf8f])&&_0x336b01>=_0x278148[_0x2faf8f]){return _0x566d6d({'message':_0x6709('0x75')});}return _0x47f73e(util[_0x6709('0x76')](_0x6709('0x77'),_0x2faf8f,_0x336b01));})[_0x6709('0x2c')](function(_0xde3469){return _0x566d6d(_0xde3469);});});};exports['create']=function(_0x296d9f,_0x549565){return getLicense(_0x296d9f)[_0x6709('0x37')](function(_0x31800f){if(!_0x296d9f['body']['internal']){var _0x18fe97;return db['Setting']['findById'](0x1)[_0x6709('0x37')](function(_0x3b19ae){return checkPasswordPattern(_0x3b19ae,_0x296d9f['body'][_0x6709('0x4f')],_0x3b19ae[_0x6709('0x78')]);})[_0x6709('0x37')](function(_0x3ef64c){_0x18fe97=_0x3ef64c[_0x6709('0x79')];return db['User']['max'](_0x6709('0x7a'));})[_0x6709('0x37')](function(_0x5906aa){if(_[_0x6709('0x74')](_0x5906aa)){if(_0x18fe97){_0x296d9f[_0x6709('0x6b')][_0x6709('0x7a')]=_0x18fe97;}else{_0x296d9f['body'][_0x6709('0x7a')]=0x1;}}else{if(_[_0x6709('0x74')](_0x18fe97)||_0x18fe97==_0x5906aa){_0x296d9f[_0x6709('0x6b')][_0x6709('0x7a')]=_0x5906aa+0x1;}else if(_0x18fe97>_0x5906aa){_0x296d9f['body']['internal']=_0x18fe97;}else{return db[_0x6709('0x5e')][_0x6709('0x51')](_0x6709('0x7b'),{'type':db[_0x6709('0x5e')][_0x6709('0x7c')]['SELECT']})[_0x6709('0x37')](function(_0x3e8e5c){if(_0x3e8e5c&&_0x3e8e5c['length']){for(var _0xea6d7=0x0,_0x12f077=_0x3e8e5c[_0x6709('0x56')];_0xea6d7<_0x12f077&&_[_0x6709('0x74')](_0x296d9f[_0x6709('0x6b')]['internal']);_0xea6d7++){if(_0x18fe97<=_0x3e8e5c[_0xea6d7][_0x6709('0x7d')]){_0x296d9f['body'][_0x6709('0x7a')]=_0x3e8e5c[_0xea6d7]['from'];}else if(_0x18fe97>_0x3e8e5c[_0xea6d7][_0x6709('0x7d')]&&_0x18fe97<=_0x3e8e5c[_0xea6d7]['to']){_0x296d9f[_0x6709('0x6b')][_0x6709('0x7a')]=_0x18fe97;}}}if(_[_0x6709('0x74')](_0x296d9f['body'][_0x6709('0x7a')])){_0x296d9f[_0x6709('0x6b')][_0x6709('0x7a')]=_0x5906aa+0x1;}});}}});}})[_0x6709('0x37')](function(){if(_0x296d9f[_0x6709('0x6b')][_0x6709('0x7e')]){_0x296d9f['body'][_0x6709('0x7f')]=_0x296d9f[_0x6709('0x6b')][_0x6709('0x7a')];_0x296d9f['body'][_0x6709('0x80')]={'mailbox':_0x296d9f[_0x6709('0x6b')]['internal'],'password':_0x296d9f[_0x6709('0x6b')][_0x6709('0x4f')],'fullname':_0x296d9f[_0x6709('0x6b')]['fullname'],'email':_0x296d9f[_0x6709('0x6b')][_0x6709('0x81')]};}if(_0x296d9f[_0x6709('0x6b')]&&_0x296d9f['body'][_0x6709('0x44')]===_0x6709('0x3d')){if(!_0x296d9f[_0x6709('0x6b')][_0x6709('0x82')]){_0x296d9f[_0x6709('0x6b')][_0x6709('0x82')]=['101',_0x6709('0x83'),_0x6709('0x84'),'113',_0x6709('0x85'),_0x6709('0x86'),_0x6709('0x87'),'106',_0x6709('0x88'),_0x6709('0x89'),_0x6709('0x8a'),_0x6709('0x8b'),_0x6709('0x8c'),_0x6709('0x8d')];}}return db[_0x6709('0x64')]['create'](_0x296d9f[_0x6709('0x6b')],{'include':[{'model':db[_0x6709('0x80')],'as':_0x6709('0x80')}]});})[_0x6709('0x37')](function(_0x34096e){if(_0x296d9f[_0x6709('0x6b')][_0x6709('0x44')]==='user')return _0x34096e;var _0x1d1f24=_0x296d9f['user'][_0x6709('0x39')]({'plain':!![]});if(!_0x1d1f24)throw new Error(_0x6709('0x8e'));if(_0x1d1f24[_0x6709('0x44')]===_0x6709('0x3b')){var _0x329561=_0x34096e[_0x6709('0x39')]({'plain':!![]});var _0x223fb5=[{'name':_0x6709('0x3c'),'value':_0x6709('0x3d')},{'name':_0x6709('0x3e'),'value':_0x6709('0x3f')}];var _0xcba655=_[_0x6709('0x45')](_0x223fb5,[_0x6709('0x42'),_0x329561['role']])['name'];return db[_0x6709('0x8f')][_0x6709('0x45')]({'where':{'name':_0xcba655,'userProfileId':_0x1d1f24['userProfileId']},'raw':!![]})[_0x6709('0x37')](function(_0xca17a6){if(_0xca17a6&&_0xca17a6[_0x6709('0x90')]===0x0){return db[_0x6709('0x91')][_0x6709('0x92')]({'name':_0x329561[_0x6709('0x46')],'resourceId':_0x329561['id'],'type':_0xca17a6[_0x6709('0x46')],'sectionId':_0xca17a6['id']},{})['then'](function(){return _0x34096e;});}else{return _0x34096e;}})[_0x6709('0x2c')](function(_0x2385cb){logger[_0x6709('0x29')](_0x6709('0x93'),_0x2385cb);throw _0x2385cb;});}return _0x34096e;})['then'](respondWithResult(_0x549565,0xc9))['catch'](handleError(_0x549565,null));};exports[_0x6709('0x94')]=function(_0x17d074,_0x24bb82,_0x1473ab){var _0x16a3e2=![];if(_0x17d074[_0x6709('0x6b')]['id']){delete _0x17d074[_0x6709('0x6b')]['id'];}return db[_0x6709('0x95')][_0x6709('0x96')]({'attributes':['id',_0x6709('0x78')]})[_0x6709('0x37')](function(_0x158e1d){_0x16a3e2=_0x158e1d['securePassword'];return db[_0x6709('0x64')][_0x6709('0x45')]({'where':{'id':_0x17d074[_0x6709('0x66')]['id']}});})['then'](function(_0x1f1dc2){if(_0x1f1dc2){if(_0x1f1dc2['id']==_0x17d074[_0x6709('0x3b')]['id']){if(!_0x17d074['body'][_0x6709('0x97')]||!_0x17d074['body'][_0x6709('0x98')]){throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0x99'));}if(!_0x1f1dc2[_0x6709('0x9a')](_0x17d074[_0x6709('0x6b')][_0x6709('0x97')])){throw new db[(_0x6709('0x21'))]['ValidationError'](_0x6709('0x9b'));}if(_0x17d074[_0x6709('0x6b')][_0x6709('0x97')]==_0x17d074['body']['newPassword']){throw new db['Sequelize'][(_0x6709('0x22'))](_0x6709('0x9c'));}return _0x1f1dc2;}else if(_0x17d074[_0x6709('0x3b')][_0x6709('0x44')]==_0x6709('0x71')){if(!_0x17d074['body'][_0x6709('0x98')]){throw new db['Sequelize'][(_0x6709('0x22'))](_0x6709('0x9d'));}return _0x1f1dc2;}else if(_0x17d074[_0x6709('0x3b')][_0x6709('0x44')]=='user'){if(!_0x17d074[_0x6709('0x6b')][_0x6709('0x98')]){throw new db['Sequelize'][(_0x6709('0x22'))](_0x6709('0x9d'));}if(_0x1f1dc2[_0x6709('0x44')]!=_0x6709('0x3d')){throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0x9e'));}return _0x1f1dc2;}else{throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0x9e'));}}return null;})['then'](handleEntityNotFound(_0x24bb82,null))['then'](function(_0x49e603){return checkPasswordPattern(_0x49e603,_0x17d074['body']['newPassword'],_0x16a3e2);})['then'](saveUpdates({'password':_0x17d074['body'][_0x6709('0x98')],'passwordResetAt':_0x17d074[_0x6709('0x3b')]['id']==_0x17d074[_0x6709('0x66')]['id']?moment():null},null))[_0x6709('0x37')](respondWithResult(_0x24bb82,null))[_0x6709('0x2c')](handleError(_0x24bb82,null));};exports[_0x6709('0x9f')]=function(_0x2ba8b3,_0x44cb0e,_0x48f212){var _0x20db55=_0x2ba8b3[_0x6709('0x6b')][_0x6709('0xa0')];return db[_0x6709('0x64')][_0x6709('0x45')]({'where':{'id':_0x2ba8b3[_0x6709('0x66')]['id']},'attributes':['id',_0x6709('0x46'),_0x6709('0x44'),_0x6709('0xa1'),'loginInPause','voicePause',_0x6709('0xa2')]})['then'](handleEntityNotFound(_0x44cb0e,null))['then'](function(_0x7f72eb){if(_0x7f72eb){if(!utils[_0x6709('0xa3')](_0x20db55)){throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0xa4'));}return _0x7f72eb['add'+_[_0x6709('0xa5')](_0x20db55['toLowerCase']())+_0x6709('0xa6')](_0x2ba8b3[_0x6709('0x6b')]['ids'],{'penalty':_0x2ba8b3['body'][_0x6709('0xa7')]||0x0})[_0x6709('0xa8')](function(_0x5ababa){for(var _0x27812b=0x0;_0x27812b<_0x2ba8b3[_0x6709('0x6b')][_0x6709('0x6e')][_0x6709('0x56')];_0x27812b+=0x1){var _0x252797={'UserId':_0x2ba8b3[_0x6709('0x66')]['id']};_0x252797[_[_0x6709('0xa5')](_0x20db55['toLowerCase']())+_0x6709('0xa9')]=_0x2ba8b3[_0x6709('0x6b')][_0x6709('0x6e')][_0x27812b];socket[_0x6709('0xaa')](_0x6709('0x3b')+_['capitalize'](_0x20db55[_0x6709('0xab')]())+_0x6709('0xac'),_0x252797);}return _0x5ababa;})['then'](function(){if(_0x20db55==='voice'){return db['VoiceQueue'][_0x6709('0x65')]({'where':{'id':_0x2ba8b3['body'][_0x6709('0x6e')]||[]},'raw':!![],'attributes':['id',_0x6709('0x46')]});}})[_0x6709('0x37')](function(_0x2cc27d){var _0x165495=_0x7f72eb['get']({'plain':!![]});var _0x3bf7d3=[];if(_0x20db55===_0x6709('0xad')&&_0x165495[_0x6709('0x44')]===_0x6709('0x3d')&&_0x165495['online']){for(var _0xfae4b5=0x0;_0xfae4b5<_0x2cc27d['length'];_0xfae4b5+=0x1){_0x3bf7d3['push']({'membername':_0x165495[_0x6709('0x46')],'UserId':_0x165495['id'],'queue_name':_0x2cc27d[_0xfae4b5]['name'],'VoiceQueueId':_0x2cc27d[_0xfae4b5]['id'],'interface':_[_0x6709('0x74')](_0x165495[_0x6709('0xa2')])?util['format']('SIP/%s',_0x165495[_0x6709('0x46')]):_0x165495[_0x6709('0xa2')],'paused':_0x165495['voicePause']||![],'penalty':_0x2ba8b3['body'][_0x6709('0xa7')]||0x0});}return BPromise[_0x6709('0xae')](_0x3bf7d3,function(_0x5c6113){return db[_0x6709('0xaf')][_0x6709('0xb0')](_0x5c6113);});}return _0x7f72eb;});}})[_0x6709('0x37')](respondWithStatusCode(_0x44cb0e,null))[_0x6709('0x2c')](handleError(_0x44cb0e,null));};exports[_0x6709('0xb1')]=function(_0x42ca7b,_0x3d981a,_0x57839){var _0x1c503e;return db[_0x6709('0x64')][_0x6709('0x45')]({'where':{'id':_0x42ca7b[_0x6709('0x66')]['id']},'attributes':['id',_0x6709('0x46'),'role']})[_0x6709('0x37')](handleEntityNotFound(_0x3d981a,null))[_0x6709('0x37')](function(_0x832179){if(_0x832179){_0x1c503e=_0x832179;if(!_0x42ca7b['query'][_0x6709('0xa0')]||!utils['isValidChannel'](_0x42ca7b[_0x6709('0x51')]['channel'])){throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0xa4'));}return _0x832179[_0x6709('0xb2')+_[_0x6709('0xa5')](_0x42ca7b['query'][_0x6709('0xa0')]['toLowerCase']())+_0x6709('0xa6')](_0x42ca7b[_0x6709('0x51')][_0x6709('0x6e')]);}})['then'](function(_0x54f63d){for(var _0x1fb84e=0x0;_0x1fb84e<_0x42ca7b[_0x6709('0x51')][_0x6709('0x6e')]['length'];_0x1fb84e+=0x1){var _0x396c9b={'UserId':_0x42ca7b[_0x6709('0x66')]['id']};_0x396c9b[_[_0x6709('0xa5')](_0x42ca7b[_0x6709('0x51')][_0x6709('0xa0')][_0x6709('0xab')]())+_0x6709('0xa9')]=_0x42ca7b['query']['ids'][_0x1fb84e];socket['emit'](_0x6709('0x3b')+_['capitalize'](_0x42ca7b[_0x6709('0x51')][_0x6709('0xa0')][_0x6709('0xab')]())+_0x6709('0xb3'),_0x396c9b);}return _0x54f63d;})[_0x6709('0x37')](function(){if(_0x42ca7b['query']['channel']===_0x6709('0xad')){return db[_0x6709('0xaf')][_0x6709('0x38')]({'where':{'UserId':_0x42ca7b[_0x6709('0x66')]['id'],'VoiceQueueId':_0x42ca7b['query'][_0x6709('0x6e')]},'individualHooks':!![]})[_0x6709('0x37')](function(){return _0x1c503e;});}return _0x1c503e;})[_0x6709('0x37')](respondWithStatusCode(_0x3d981a,null))[_0x6709('0x2c')](handleError(_0x3d981a,null));};exports[_0x6709('0xb4')]=function(_0x10bf16,_0x32bb84,_0x380114){_0x10bf16[_0x6709('0x6b')][_0x6709('0xb5')]=_0x10bf16[_0x6709('0xb6')][_0x6709('0xb7')];return db[_0x6709('0x64')]['find']({'where':{'id':_0x10bf16['params']['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x32bb84,null))['then'](saveUpdates(_0x10bf16['body'],null))[_0x6709('0x37')](respondWithResult(_0x32bb84,null))['catch'](handleError(_0x32bb84,null));};exports[_0x6709('0xb8')]=function(_0x17f7d6,_0x1a427c,_0x39a42d){var _0x3bea4e=path[_0x6709('0xb9')](config[_0x6709('0xba')],_0x6709('0xbb'));return db[_0x6709('0x64')]['find']({'where':{'id':_0x17f7d6['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x6709('0x37')](handleEntityNotFound(_0x1a427c,null))[_0x6709('0x37')](function(_0x27198d){if(_0x27198d){if(_[_0x6709('0x74')](_0x27198d[_0x6709('0xb5')])){return _0x1a427c['download'](_0x3bea4e);}else{if(!fs[_0x6709('0xbc')](path[_0x6709('0xb9')](config[_0x6709('0xba')],_0x6709('0xbd'),_0x27198d[_0x6709('0xb5')]))){return _0x1a427c[_0x6709('0xbe')](_0x3bea4e);}return _0x1a427c['download'](path['join'](config['root'],'server/files/images/',_0x27198d[_0x6709('0xb5')]));}}})[_0x6709('0x2c')](handleError(_0x1a427c,null));};exports[_0x6709('0xbf')]=function(_0x5030e9,_0x4cc5cd,_0x166855){var _0x20b176={};var _0x1b204d={};var _0x1ae2ee;var _0x55683f;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x5030e9['params']['id']}})['then'](handleEntityNotFound(_0x4cc5cd,null))[_0x6709('0x37')](function(_0x3ddebf){if(_0x3ddebf){_0x1ae2ee=_0x3ddebf;_0x1b204d['model']=_['keys'](db['CmContact']['rawAttributes']);_0x1b204d['query']=_[_0x6709('0x52')](_0x5030e9[_0x6709('0x51')]);_0x1b204d['filters']=_[_0x6709('0x69')](_0x1b204d[_0x6709('0x4e')],_0x1b204d[_0x6709('0x51')]);_0x20b176[_0x6709('0x54')]=_[_0x6709('0x69')](_0x1b204d[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x5030e9[_0x6709('0x51')][_0x6709('0x55')]));_0x20b176[_0x6709('0x54')]=_0x20b176[_0x6709('0x54')]['length']?_0x20b176[_0x6709('0x54')]:_0x1b204d[_0x6709('0x4e')];_0x20b176[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x5030e9[_0x6709('0x51')][_0x6709('0x59')]);_0x20b176[_0x6709('0x5a')]=qs[_0x6709('0x53')](_['pick'](_0x5030e9['query'],_0x1b204d[_0x6709('0x53')]));if(_0x5030e9[_0x6709('0x51')][_0x6709('0x60')]){_0x20b176[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x20b176['where'],{'$or':_[_0x6709('0x41')](_0x20b176[_0x6709('0x54')],function(_0x52c59c){var _0x25f9ae={};_0x25f9ae[_0x52c59c]={'$like':'%'+_0x5030e9['query']['filter']+'%'};return _0x25f9ae;})});}_0x20b176=_[_0x6709('0x5c')]({},_0x20b176,_0x5030e9[_0x6709('0xc1')]);return _0x1ae2ee[_0x6709('0xbf')](_0x20b176);}})['then'](function(_0x39e13c){if(_0x39e13c){_0x55683f=_0x39e13c[_0x6709('0x56')];if(_0x5030e9[_0x6709('0x51')]['hasOwnProperty'](_0x6709('0x62'))){_0x20b176[_0x6709('0x63')]=[{'model':db[_0x6709('0xc2')],'as':_0x6709('0xc3'),'required':![]},{'model':db[_0x6709('0xc4')],'as':_0x6709('0xc5'),'attributes':['id','name',_0x6709('0xc6')],'where':_0x5030e9[_0x6709('0x51')][_0x6709('0xc7')]?{'id':_0x5030e9[_0x6709('0x51')][_0x6709('0xc7')]}:undefined,'required':_0x5030e9['query']['tag']?!![]:![]}];}if(!_0x5030e9[_0x6709('0x51')]['hasOwnProperty']('nolimit')){_0x20b176['limit']=qs[_0x6709('0x2f')](_0x5030e9['query'][_0x6709('0x2f')]);_0x20b176[_0x6709('0x2e')]=qs['offset'](_0x5030e9[_0x6709('0x51')]['offset']);}return _0x1ae2ee[_0x6709('0xbf')](_0x20b176);}})[_0x6709('0x37')](function(_0x13f9c4){if(_0x13f9c4){return _0x13f9c4?{'count':_0x55683f,'rows':_0x13f9c4}:null;}})['then'](respondWithResult(_0x4cc5cd,null))['catch'](handleError(_0x4cc5cd,null));};exports[_0x6709('0xc8')]=function(_0x58e8d8,_0x241839,_0xdfe870){var _0x5a0826;var _0x294b8b;var _0x1dc08f={};var _0x512815;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x58e8d8[_0x6709('0x66')]['id']},'attributes':['id',_0x6709('0x46'),'role']})[_0x6709('0x37')](handleEntityNotFound(_0x241839,null))[_0x6709('0x37')](function(_0x31c4c0){if(!utils[_0x6709('0xa3')](_0x58e8d8[_0x6709('0x51')]['channel'])){throw new db['Sequelize'][(_0x6709('0x22'))]('Unknown\x20channel');}_0x5a0826=_0x31c4c0;var _0x396738={};_0x396738[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_[_0x6709('0xa5')](_0x58e8d8[_0x6709('0x51')][_0x6709('0xa0')])+_0x6709('0xc9')][_0x6709('0x68')]);_0x396738[_0x6709('0x51')]=_['keys'](_0x58e8d8['query']);_0x396738[_0x6709('0x53')]=_[_0x6709('0x69')](_0x396738[_0x6709('0x4e')],_0x396738[_0x6709('0x51')]);_0x1dc08f[_0x6709('0x54')]=_['intersection'](_0x396738[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x58e8d8[_0x6709('0x51')]['fields']));_0x1dc08f[_0x6709('0x54')]=_0x1dc08f[_0x6709('0x54')][_0x6709('0x56')]?_0x1dc08f[_0x6709('0x54')]:_0x396738[_0x6709('0x4e')];_0x1dc08f[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x58e8d8['query'][_0x6709('0x59')]);_0x1dc08f[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x58e8d8['query'],_0x396738[_0x6709('0x53')]));if(_0x58e8d8[_0x6709('0x51')]['filter']){_0x1dc08f[_0x6709('0x5a')]=_['merge'](_0x1dc08f[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x1dc08f[_0x6709('0x54')],function(_0x5860b3){var _0x7cb76c={};_0x7cb76c[_0x5860b3]={'$like':'%'+_0x58e8d8[_0x6709('0x51')]['filter']+'%'};return _0x7cb76c;})});}_0x1dc08f=_[_0x6709('0x5c')]({},_0x1dc08f,_0x58e8d8[_0x6709('0xc1')]);switch(_0x5a0826[_0x6709('0x44')]){case _0x6709('0x71'):return db[_['capitalize'](_0x58e8d8[_0x6709('0x51')][_0x6709('0xa0')])+'Queue'][_0x6709('0x65')](_0x1dc08f);case _0x6709('0x3b'):case _0x6709('0x3d'):return _0x5a0826[_0x6709('0x39')+_[_0x6709('0xa5')](_0x58e8d8[_0x6709('0x51')][_0x6709('0xa0')])+_0x6709('0xa6')](_0x1dc08f);default:throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))](_0x6709('0xca'));}})['then'](function(_0x574b4e){_0x512815=_0x574b4e['length'];if(!_0x58e8d8[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x1dc08f[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x58e8d8[_0x6709('0x51')][_0x6709('0x2f')]);_0x1dc08f[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x58e8d8[_0x6709('0x51')]['offset']);}switch(_0x5a0826[_0x6709('0x44')]){case _0x6709('0x71'):return db[_[_0x6709('0xa5')](_0x58e8d8[_0x6709('0x51')]['channel'])+'Queue']['findAll'](_0x1dc08f);case _0x6709('0x3b'):case _0x6709('0x3d'):return _0x5a0826['get'+_[_0x6709('0xa5')](_0x58e8d8[_0x6709('0x51')][_0x6709('0xa0')])+_0x6709('0xa6')](_0x1dc08f);}})[_0x6709('0x37')](function(_0x5d14e5){return{'count':_0x512815,'rows':_0x5d14e5};})[_0x6709('0x37')](respondWithResult(_0x241839,null))[_0x6709('0x2c')](handleError(_0x241839,null));};exports[_0x6709('0xcb')]=function(_0x1fe96c,_0x28aa16,_0x539975){var _0x35080c={};var _0x426f2f={};var _0x266450;var _0x3f6961;return db['User'][_0x6709('0x96')]({'where':{'id':_0x1fe96c['params']['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x28aa16,null))[_0x6709('0x37')](function(_0x514154){if(_0x514154){_0x266450=_0x514154;_0x426f2f[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0xaf')][_0x6709('0x68')]);_0x426f2f[_0x6709('0x51')]=_[_0x6709('0x52')](_0x1fe96c[_0x6709('0x51')]);_0x426f2f[_0x6709('0x53')]=_[_0x6709('0x69')](_0x426f2f[_0x6709('0x4e')],_0x426f2f[_0x6709('0x51')]);_0x35080c[_0x6709('0x54')]=_['intersection'](_0x426f2f[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x1fe96c[_0x6709('0x51')][_0x6709('0x55')]));_0x35080c['attributes']=_0x35080c[_0x6709('0x54')]['length']?_0x35080c[_0x6709('0x54')]:_0x426f2f[_0x6709('0x4e')];_0x35080c['order']=qs[_0x6709('0x59')](_0x1fe96c[_0x6709('0x51')][_0x6709('0x59')]);_0x35080c[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x1fe96c[_0x6709('0x51')],_0x426f2f[_0x6709('0x53')]));if(_0x1fe96c['query'][_0x6709('0x60')]){_0x35080c[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x35080c[_0x6709('0x5a')],{'$or':_['map'](_0x35080c['attributes'],function(_0x30ae87){var _0x2388cb={};_0x2388cb[_0x30ae87]={'$like':'%'+_0x1fe96c[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x2388cb;})});}_0x35080c=_[_0x6709('0x5c')]({},_0x35080c,_0x1fe96c[_0x6709('0xc1')]);return _0x266450[_0x6709('0xcb')](_0x35080c);}})[_0x6709('0x37')](function(_0x1c4ba0){if(_0x1c4ba0){_0x3f6961=_0x1c4ba0[_0x6709('0x56')];if(!_0x1fe96c[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x35080c[_0x6709('0x2f')]=qs['limit'](_0x1fe96c[_0x6709('0x51')]['limit']);_0x35080c[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x1fe96c[_0x6709('0x51')]['offset']);}return _0x266450[_0x6709('0xcb')](_0x35080c);}})[_0x6709('0x37')](function(_0x1c2fb9){if(_0x1c2fb9){return _0x1c2fb9?{'count':_0x3f6961,'rows':_0x1c2fb9}:null;}})[_0x6709('0x37')](respondWithResult(_0x28aa16,null))[_0x6709('0x2c')](handleError(_0x28aa16,null));};exports['getGroups']=function(_0x529689,_0xe68f09,_0x5a0718){var _0x160582={};var _0x23f3d2={};var _0x53982e;var _0x94c149;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x529689[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0xe68f09,null))[_0x6709('0x37')](function(_0x1ff331){if(_0x1ff331){_0x53982e=_0x1ff331;_0x23f3d2['model']=_[_0x6709('0x52')](db[_0x6709('0xcc')][_0x6709('0x68')]);_0x23f3d2[_0x6709('0x51')]=_[_0x6709('0x52')](_0x529689[_0x6709('0x51')]);_0x23f3d2[_0x6709('0x53')]=_[_0x6709('0x69')](_0x23f3d2[_0x6709('0x4e')],_0x23f3d2[_0x6709('0x51')]);_0x160582[_0x6709('0x54')]=_[_0x6709('0x69')](_0x23f3d2[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x529689['query'][_0x6709('0x55')]));_0x160582[_0x6709('0x54')]=_0x160582['attributes'][_0x6709('0x56')]?_0x160582[_0x6709('0x54')]:_0x23f3d2[_0x6709('0x4e')];_0x160582[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x529689[_0x6709('0x51')][_0x6709('0x59')]);_0x160582[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x529689[_0x6709('0x51')],_0x23f3d2['filters']));if(_0x529689['query'][_0x6709('0x60')]){_0x160582[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x160582['where'],{'$or':_[_0x6709('0x41')](_0x160582[_0x6709('0x54')],function(_0x4d0d86){var _0x15e3cc={};_0x15e3cc[_0x4d0d86]={'$like':'%'+_0x529689[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x15e3cc;})});}_0x160582=_[_0x6709('0x5c')]({},_0x160582,_0x529689['options']);return _0x53982e['getGroups'](_0x160582);}})[_0x6709('0x37')](function(_0x569597){if(_0x569597){_0x94c149=_0x569597[_0x6709('0x56')];if(!_0x529689['query']['hasOwnProperty']('nolimit')){_0x160582[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x529689[_0x6709('0x51')][_0x6709('0x2f')]);_0x160582[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x529689['query'][_0x6709('0x2e')]);}return _0x53982e[_0x6709('0xcd')](_0x160582);}})[_0x6709('0x37')](function(_0x511ba7){if(_0x511ba7){return _0x511ba7?{'count':_0x94c149,'rows':_0x511ba7}:null;}})[_0x6709('0x37')](respondWithResult(_0xe68f09,null))['catch'](handleError(_0xe68f09,null));};exports[_0x6709('0xce')]=function(_0x3bc389,_0x2904f5,_0x17b3db){var _0x36bdd5={'raw':!![],'where':{}};var _0x14b824={};var _0x55ad03={'count':0x0,'rows':[]};return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x3bc389[_0x6709('0x66')]['id']}})['then'](handleEntityNotFound(_0x2904f5,null))[_0x6709('0x37')](function(_0x3af6e3){if(_0x3af6e3){_0x14b824[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0xcf')]['rawAttributes']);_0x14b824[_0x6709('0x51')]=_[_0x6709('0x52')](_0x3bc389[_0x6709('0x51')]);_0x14b824[_0x6709('0x53')]=_[_0x6709('0x69')](_0x14b824[_0x6709('0x4e')],_0x14b824[_0x6709('0x51')]);_0x36bdd5[_0x6709('0x54')]=_[_0x6709('0x69')](_0x14b824[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x3bc389[_0x6709('0x51')][_0x6709('0x55')]));_0x36bdd5[_0x6709('0x54')]=_0x36bdd5[_0x6709('0x54')][_0x6709('0x56')]?_0x36bdd5[_0x6709('0x54')]:_0x14b824[_0x6709('0x4e')];if(!_0x3bc389['query'][_0x6709('0x57')]('nolimit')){_0x36bdd5['limit']=qs['limit'](_0x3bc389[_0x6709('0x51')]['limit']);_0x36bdd5[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x3bc389['query'][_0x6709('0x2e')]);}_0x36bdd5[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x3bc389['query'][_0x6709('0x59')]);_0x36bdd5[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x3bc389[_0x6709('0x51')],_0x14b824['filters']));_0x36bdd5['where'][_0x6709('0xd0')]=_0x3af6e3['id'];if(_0x3bc389[_0x6709('0x51')][_0x6709('0x60')]){_0x36bdd5['where']=_['merge'](_0x36bdd5[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x36bdd5[_0x6709('0x54')],function(_0x451fd0){var _0x4b7a78={};_0x4b7a78[_0x451fd0]={'$like':'%'+_0x3bc389['query']['filter']+'%'};return _0x4b7a78;})});}_0x36bdd5=_[_0x6709('0x5c')]({},_0x36bdd5,_0x3bc389[_0x6709('0xc1')]);return db[_0x6709('0xcf')][_0x6709('0x61')]({'where':_0x36bdd5[_0x6709('0x5a')]})[_0x6709('0x37')](function(_0x2681f5){_0x55ad03[_0x6709('0x61')]=_0x2681f5;if(_0x3bc389['query'][_0x6709('0x62')]){_0x36bdd5['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x6709('0x65')](_0x36bdd5);})[_0x6709('0x37')](function(_0x290235){_0x55ad03['rows']=_0x290235;return _0x55ad03;});}})[_0x6709('0x37')](respondWithFilteredResult(_0x2904f5,_0x36bdd5))['catch'](handleError(_0x2904f5,null));};exports[_0x6709('0xd1')]=function(_0x3ff2d6,_0x174fe3,_0x5c5be3){var _0x368fca={'raw':!![],'where':{}};var _0x10bd88={};var _0x352ee4={'count':0x0,'rows':[]};return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x3ff2d6['params']['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x174fe3,null))[_0x6709('0x37')](function(_0x38956f){if(_0x38956f){_0x10bd88[_0x6709('0x4e')]=_['keys'](db[_0x6709('0xd2')][_0x6709('0x68')]);_0x10bd88[_0x6709('0x51')]=_['keys'](_0x3ff2d6['query']);_0x10bd88[_0x6709('0x53')]=_['intersection'](_0x10bd88[_0x6709('0x4e')],_0x10bd88[_0x6709('0x51')]);_0x368fca[_0x6709('0x54')]=_[_0x6709('0x69')](_0x10bd88['model'],qs[_0x6709('0x55')](_0x3ff2d6['query'][_0x6709('0x55')]));_0x368fca['attributes']=_0x368fca['attributes'][_0x6709('0x56')]?_0x368fca[_0x6709('0x54')]:_0x10bd88[_0x6709('0x4e')];if(!_0x3ff2d6['query']['hasOwnProperty'](_0x6709('0x58'))){_0x368fca['limit']=qs[_0x6709('0x2f')](_0x3ff2d6['query'][_0x6709('0x2f')]);_0x368fca[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x3ff2d6['query'][_0x6709('0x2e')]);}_0x368fca[_0x6709('0xc0')]=qs['sort'](_0x3ff2d6[_0x6709('0x51')][_0x6709('0x59')]);_0x368fca[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x3ff2d6[_0x6709('0x51')],_0x10bd88['filters']));_0x368fca[_0x6709('0x5a')]['UserId']=_0x38956f['id'];if(_0x3ff2d6[_0x6709('0x51')]['filter']){_0x368fca['where']=_[_0x6709('0x5c')](_0x368fca[_0x6709('0x5a')],{'$or':_['map'](_0x368fca[_0x6709('0x54')],function(_0x4612ca){var _0x180e96={};_0x180e96[_0x4612ca]={'$like':'%'+_0x3ff2d6[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x180e96;})});}_0x368fca=_[_0x6709('0x5c')]({},_0x368fca,_0x3ff2d6['options']);return db[_0x6709('0xd2')][_0x6709('0x61')]({'where':_0x368fca[_0x6709('0x5a')]})['then'](function(_0x56dab8){_0x352ee4[_0x6709('0x61')]=_0x56dab8;if(_0x3ff2d6[_0x6709('0x51')][_0x6709('0x62')]){_0x368fca[_0x6709('0x63')]=[{'all':!![]}];}return db[_0x6709('0xd2')][_0x6709('0x65')](_0x368fca);})['then'](function(_0x2ff6e0){_0x352ee4[_0x6709('0xd3')]=_0x2ff6e0;return _0x352ee4;});}})[_0x6709('0x37')](respondWithFilteredResult(_0x174fe3,_0x368fca))[_0x6709('0x2c')](handleError(_0x174fe3,null));};exports[_0x6709('0xd4')]=function(_0x3ef287,_0x7ab43c,_0x58d5b5){var _0x5f5bdc={};var _0x6963ad={};var _0x145557;var _0x4478d7;return db['User'][_0x6709('0x96')]({'where':{'id':_0x3ef287['params']['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x7ab43c,null))[_0x6709('0x37')](function(_0x5c6d1a){if(_0x5c6d1a){_0x145557=_0x5c6d1a;_0x6963ad[_0x6709('0x4e')]=_[_0x6709('0x52')](db['ChatInteraction'][_0x6709('0x68')]);_0x6963ad[_0x6709('0x51')]=_[_0x6709('0x52')](_0x3ef287[_0x6709('0x51')]);_0x6963ad[_0x6709('0x53')]=_['intersection'](_0x6963ad[_0x6709('0x4e')],_0x6963ad[_0x6709('0x51')]);_0x5f5bdc['attributes']=_[_0x6709('0x69')](_0x6963ad[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x3ef287[_0x6709('0x51')][_0x6709('0x55')]));_0x5f5bdc[_0x6709('0x54')]=_0x5f5bdc[_0x6709('0x54')][_0x6709('0x56')]?_0x5f5bdc[_0x6709('0x54')]:_0x6963ad[_0x6709('0x4e')];_0x5f5bdc[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x3ef287[_0x6709('0x51')][_0x6709('0x59')]);_0x5f5bdc[_0x6709('0x5a')]=qs[_0x6709('0x53')](_['pick'](_0x3ef287['query'],_0x6963ad[_0x6709('0x53')]));if(_0x3ef287[_0x6709('0x51')][_0x6709('0x60')]){_0x5f5bdc[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x5f5bdc[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x5f5bdc['attributes'],function(_0x55c582){var _0x17a28d={};_0x17a28d[_0x55c582]={'$like':'%'+_0x3ef287[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x17a28d;})});}_0x5f5bdc=_[_0x6709('0x5c')]({},_0x5f5bdc,_0x3ef287[_0x6709('0xc1')]);return _0x145557[_0x6709('0xd4')](_0x5f5bdc);}})[_0x6709('0x37')](function(_0x46cc47){if(_0x46cc47){_0x4478d7=_0x46cc47[_0x6709('0x56')];if(!_0x3ef287['query'][_0x6709('0x57')]('nolimit')){_0x5f5bdc['limit']=qs[_0x6709('0x2f')](_0x3ef287[_0x6709('0x51')][_0x6709('0x2f')]);_0x5f5bdc[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x3ef287[_0x6709('0x51')][_0x6709('0x2e')]);}return _0x145557['getChatInteractions'](_0x5f5bdc);}})[_0x6709('0x37')](function(_0x37aa0d){if(_0x37aa0d){return _0x37aa0d?{'count':_0x4478d7,'rows':_0x37aa0d}:null;}})[_0x6709('0x37')](respondWithResult(_0x7ab43c,null))[_0x6709('0x2c')](handleError(_0x7ab43c,null));};exports[_0x6709('0xd5')]=function(_0x402ac8,_0x56ec9f,_0x58a02f){var _0x1315b9={};var _0x5d4cd1={};var _0x5dfe16;var _0x87c13f;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x402ac8[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x56ec9f,null))[_0x6709('0x37')](function(_0x22dcd6){if(_0x22dcd6){_0x5dfe16=_0x22dcd6;_0x5d4cd1['model']=_['keys'](db[_0x6709('0xd6')][_0x6709('0x68')]);_0x5d4cd1[_0x6709('0x51')]=_[_0x6709('0x52')](_0x402ac8['query']);_0x5d4cd1[_0x6709('0x53')]=_['intersection'](_0x5d4cd1[_0x6709('0x4e')],_0x5d4cd1[_0x6709('0x51')]);_0x1315b9[_0x6709('0x54')]=_[_0x6709('0x69')](_0x5d4cd1[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x402ac8[_0x6709('0x51')][_0x6709('0x55')]));_0x1315b9[_0x6709('0x54')]=_0x1315b9[_0x6709('0x54')][_0x6709('0x56')]?_0x1315b9[_0x6709('0x54')]:_0x5d4cd1['model'];_0x1315b9[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x402ac8[_0x6709('0x51')]['sort']);_0x1315b9[_0x6709('0x5a')]=qs['filters'](_['pick'](_0x402ac8[_0x6709('0x51')],_0x5d4cd1[_0x6709('0x53')]));if(_0x402ac8[_0x6709('0x51')][_0x6709('0x60')]){_0x1315b9[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x1315b9['where'],{'$or':_[_0x6709('0x41')](_0x1315b9[_0x6709('0x54')],function(_0x1abe0e){var _0x5f57f1={};_0x5f57f1[_0x1abe0e]={'$like':'%'+_0x402ac8[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x5f57f1;})});}_0x1315b9=_[_0x6709('0x5c')]({},_0x1315b9,_0x402ac8[_0x6709('0xc1')]);return _0x5dfe16[_0x6709('0xd5')](_0x1315b9);}})['then'](function(_0x2cfa93){if(_0x2cfa93){_0x87c13f=_0x2cfa93['length'];if(!_0x402ac8[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x1315b9['limit']=qs[_0x6709('0x2f')](_0x402ac8[_0x6709('0x51')][_0x6709('0x2f')]);_0x1315b9[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x402ac8['query']['offset']);}return _0x5dfe16[_0x6709('0xd5')](_0x1315b9);}})['then'](function(_0x46eaae){if(_0x46eaae){return _0x46eaae?{'count':_0x87c13f,'rows':_0x46eaae}:null;}})['then'](respondWithResult(_0x56ec9f,null))[_0x6709('0x2c')](handleError(_0x56ec9f,null));};exports['getMailInteractions']=function(_0x28be39,_0x530187,_0xfc0fff){var _0x280f7f={'raw':!![],'where':{}};var _0x1f5df3={};var _0x25988c={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x28be39[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x530187,null))[_0x6709('0x37')](function(_0x10f170){if(_0x10f170){_0x1f5df3[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0xd7')]['rawAttributes']);_0x1f5df3['query']=_[_0x6709('0x52')](_0x28be39['query']);_0x1f5df3['filters']=_[_0x6709('0x69')](_0x1f5df3['model'],_0x1f5df3[_0x6709('0x51')]);_0x280f7f[_0x6709('0x54')]=_[_0x6709('0x69')](_0x1f5df3[_0x6709('0x4e')],qs['fields'](_0x28be39[_0x6709('0x51')][_0x6709('0x55')]));_0x280f7f[_0x6709('0x54')]=_0x280f7f[_0x6709('0x54')][_0x6709('0x56')]?_0x280f7f[_0x6709('0x54')]:_0x1f5df3[_0x6709('0x4e')];if(!_0x28be39['query'][_0x6709('0x57')]('nolimit')){_0x280f7f[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x28be39[_0x6709('0x51')][_0x6709('0x2f')]);_0x280f7f[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x28be39[_0x6709('0x51')]['offset']);}_0x280f7f[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x28be39['query'][_0x6709('0x59')]);_0x280f7f[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x28be39['query'],_0x1f5df3[_0x6709('0x53')]));_0x280f7f[_0x6709('0x5a')][_0x6709('0xd0')]=_0x10f170['id'];if(_0x28be39['query']['filter']){_0x280f7f[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x280f7f['where'],{'$or':_[_0x6709('0x41')](_0x280f7f[_0x6709('0x54')],function(_0x36db2d){var _0x17dd1a={};_0x17dd1a[_0x36db2d]={'$like':'%'+_0x28be39[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x17dd1a;})});}_0x280f7f=_['merge']({},_0x280f7f,_0x28be39[_0x6709('0xc1')]);return db[_0x6709('0xd7')]['count']({'where':_0x280f7f[_0x6709('0x5a')]})[_0x6709('0x37')](function(_0x410c6a){_0x25988c[_0x6709('0x61')]=_0x410c6a;if(_0x28be39[_0x6709('0x51')]['includeAll']){_0x280f7f[_0x6709('0x63')]=[{'all':!![]}];}return db[_0x6709('0xd7')][_0x6709('0x65')](_0x280f7f);})[_0x6709('0x37')](function(_0x5e92ef){_0x25988c[_0x6709('0xd3')]=_0x5e92ef;return _0x25988c;});}})[_0x6709('0x37')](respondWithFilteredResult(_0x530187,_0x280f7f))['catch'](handleError(_0x530187,null));};exports[_0x6709('0xd8')]=function(_0x266b26,_0x377ec5,_0x32fe8f){var _0x5e81c0={};var _0x272427={};var _0x14a285;var _0x4a6962;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x266b26[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x377ec5,null))[_0x6709('0x37')](function(_0x3f0b92){if(_0x3f0b92){_0x14a285=_0x3f0b92;_0x272427[_0x6709('0x4e')]=_['keys'](db[_0x6709('0xd9')]['rawAttributes']);_0x272427[_0x6709('0x51')]=_[_0x6709('0x52')](_0x266b26[_0x6709('0x51')]);_0x272427['filters']=_[_0x6709('0x69')](_0x272427[_0x6709('0x4e')],_0x272427['query']);_0x5e81c0[_0x6709('0x54')]=_[_0x6709('0x69')](_0x272427[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x266b26['query'][_0x6709('0x55')]));_0x5e81c0[_0x6709('0x54')]=_0x5e81c0[_0x6709('0x54')][_0x6709('0x56')]?_0x5e81c0[_0x6709('0x54')]:_0x272427['model'];_0x5e81c0[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x266b26['query']['sort']);_0x5e81c0[_0x6709('0x5a')]=qs['filters'](_[_0x6709('0x5b')](_0x266b26[_0x6709('0x51')],_0x272427[_0x6709('0x53')]));if(_0x266b26[_0x6709('0x51')][_0x6709('0x60')]){_0x5e81c0[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x5e81c0[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x5e81c0[_0x6709('0x54')],function(_0x53e85f){var _0x313c72={};_0x313c72[_0x53e85f]={'$like':'%'+_0x266b26[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x313c72;})});}_0x5e81c0=_['merge']({},_0x5e81c0,_0x266b26[_0x6709('0xc1')]);return _0x14a285[_0x6709('0xd8')](_0x5e81c0);}})[_0x6709('0x37')](function(_0xb15863){if(_0xb15863){_0x4a6962=_0xb15863[_0x6709('0x56')];if(!_0x266b26[_0x6709('0x51')][_0x6709('0x57')]('nolimit')){_0x5e81c0[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x266b26[_0x6709('0x51')]['limit']);_0x5e81c0[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x266b26[_0x6709('0x51')][_0x6709('0x2e')]);}return _0x14a285[_0x6709('0xd8')](_0x5e81c0);}})['then'](function(_0x15e5b8){if(_0x15e5b8){return _0x15e5b8?{'count':_0x4a6962,'rows':_0x15e5b8}:null;}})[_0x6709('0x37')](respondWithResult(_0x377ec5,null))['catch'](handleError(_0x377ec5,null));};exports[_0x6709('0xda')]=function(_0x3cf2ed,_0x2455f3,_0x445fcc){var _0x96cc20={};var _0x1ceea3={};var _0x4becda;var _0x4386cc;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x3cf2ed[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x2455f3,null))['then'](function(_0x38537a){if(_0x38537a){_0x4becda=_0x38537a;_0x1ceea3['model']=_[_0x6709('0x52')](db[_0x6709('0xdb')][_0x6709('0x68')]);_0x1ceea3[_0x6709('0x51')]=_[_0x6709('0x52')](_0x3cf2ed['query']);_0x1ceea3['filters']=_[_0x6709('0x69')](_0x1ceea3[_0x6709('0x4e')],_0x1ceea3[_0x6709('0x51')]);_0x96cc20[_0x6709('0x54')]=_[_0x6709('0x69')](_0x1ceea3[_0x6709('0x4e')],qs['fields'](_0x3cf2ed[_0x6709('0x51')][_0x6709('0x55')]));_0x96cc20[_0x6709('0x54')]=_0x96cc20['attributes'][_0x6709('0x56')]?_0x96cc20[_0x6709('0x54')]:_0x1ceea3[_0x6709('0x4e')];_0x96cc20[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x3cf2ed[_0x6709('0x51')][_0x6709('0x59')]);_0x96cc20[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x3cf2ed[_0x6709('0x51')],_0x1ceea3[_0x6709('0x53')]));if(_0x3cf2ed[_0x6709('0x51')][_0x6709('0x60')]){_0x96cc20[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x96cc20[_0x6709('0x5a')],{'$or':_['map'](_0x96cc20['attributes'],function(_0x3b20d8){var _0x18bbf7={};_0x18bbf7[_0x3b20d8]={'$like':'%'+_0x3cf2ed[_0x6709('0x51')]['filter']+'%'};return _0x18bbf7;})});}_0x96cc20=_[_0x6709('0x5c')]({},_0x96cc20,_0x3cf2ed['options']);return _0x4becda['getFaxInteractions'](_0x96cc20);}})[_0x6709('0x37')](function(_0x59049b){if(_0x59049b){_0x4386cc=_0x59049b[_0x6709('0x56')];if(!_0x3cf2ed[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x96cc20[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x3cf2ed['query'][_0x6709('0x2f')]);_0x96cc20['offset']=qs[_0x6709('0x2e')](_0x3cf2ed[_0x6709('0x51')]['offset']);}return _0x4becda[_0x6709('0xda')](_0x96cc20);}})['then'](function(_0x3a91fb){if(_0x3a91fb){return _0x3a91fb?{'count':_0x4386cc,'rows':_0x3a91fb}:null;}})[_0x6709('0x37')](respondWithResult(_0x2455f3,null))[_0x6709('0x2c')](handleError(_0x2455f3,null));};exports['getWhatsappInteractions']=function(_0x3ea0ec,_0x2899b9,_0x1d4cff){var _0x321f86={};var _0x59dd4a={};var _0x58190e;var _0x3b1418;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x3ea0ec['params']['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x2899b9,null))['then'](function(_0x47b830){if(_0x47b830){_0x58190e=_0x47b830;_0x59dd4a[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0xdc')][_0x6709('0x68')]);_0x59dd4a[_0x6709('0x51')]=_['keys'](_0x3ea0ec['query']);_0x59dd4a['filters']=_[_0x6709('0x69')](_0x59dd4a[_0x6709('0x4e')],_0x59dd4a['query']);_0x321f86[_0x6709('0x54')]=_[_0x6709('0x69')](_0x59dd4a[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x3ea0ec['query'][_0x6709('0x55')]));_0x321f86[_0x6709('0x54')]=_0x321f86[_0x6709('0x54')][_0x6709('0x56')]?_0x321f86['attributes']:_0x59dd4a[_0x6709('0x4e')];_0x321f86['order']=qs[_0x6709('0x59')](_0x3ea0ec[_0x6709('0x51')][_0x6709('0x59')]);_0x321f86[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x3ea0ec['query'],_0x59dd4a[_0x6709('0x53')]));if(_0x3ea0ec['query']['filter']){_0x321f86['where']=_['merge'](_0x321f86['where'],{'$or':_['map'](_0x321f86[_0x6709('0x54')],function(_0x4c90c5){var _0x1475df={};_0x1475df[_0x4c90c5]={'$like':'%'+_0x3ea0ec[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x1475df;})});}_0x321f86=_[_0x6709('0x5c')]({},_0x321f86,_0x3ea0ec[_0x6709('0xc1')]);return _0x58190e[_0x6709('0xdd')](_0x321f86);}})['then'](function(_0x3c3ad6){if(_0x3c3ad6){_0x3b1418=_0x3c3ad6[_0x6709('0x56')];if(!_0x3ea0ec['query'][_0x6709('0x57')]('nolimit')){_0x321f86[_0x6709('0x2f')]=qs[_0x6709('0x2f')](_0x3ea0ec[_0x6709('0x51')][_0x6709('0x2f')]);_0x321f86[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x3ea0ec[_0x6709('0x51')]['offset']);}return _0x58190e[_0x6709('0xdd')](_0x321f86);}})[_0x6709('0x37')](function(_0x35ff8e){if(_0x35ff8e){return _0x35ff8e?{'count':_0x3b1418,'rows':_0x35ff8e}:null;}})[_0x6709('0x37')](respondWithResult(_0x2899b9,null))[_0x6709('0x2c')](handleError(_0x2899b9,null));};exports['login']=function(_0xa2cb21,_0x37f8ef,_0x3a8d29){var _0x55b574;var _0x3c35bb;var _0x83a02;var _0x449319=!_['isNil'](_0xa2cb21[_0x6709('0x66')]['id'])?_0xa2cb21['params']['id']:!_['isNil'](_0xa2cb21[_0x6709('0x3b')]['id'])?_0xa2cb21['user']['id']:null;return db['User'][_0x6709('0x45')]({'where':{'id':_0x449319,'role':{'$or':[_0x6709('0x71'),_0x6709('0x3b'),_0x6709('0x3d')]}},'attributes':['id','name',_0x6709('0xde'),_0x6709('0xdf'),_0x6709('0x44'),_0x6709('0x7a'),'loginInPause']})[_0x6709('0x37')](function(_0x322f7f){if(_0x322f7f){if(_0x322f7f['role']===_0x6709('0x3d')){_0x55b574=_0x322f7f;if(_0xa2cb21[_0x6709('0x6b')]['interface']){_0x83a02=util['format'](_0x6709('0xe0'),_0x55b574[_0xa2cb21['body'][_0x6709('0xa2')]]);}else if(_0xa2cb21['body'][_0x6709('0xe1')]){_0x83a02=util['format'](_0x6709('0xe2'),_0xa2cb21[_0x6709('0x6b')][_0x6709('0xe1')]);}else{_0x83a02=util[_0x6709('0x76')]('SIP/%s',_0x55b574[_0x6709('0x46')]);}socket['to'](util['format'](_0x6709('0xe3'),_0x55b574[_0x6709('0x46')]))[_0x6709('0xaa')](_0x6709('0xe4'),{'ip':_0xa2cb21[_0x6709('0xe5')][_0x6709('0xe6')]||_0xa2cb21[_0x6709('0xe7')][_0x6709('0xe8')]||_0xa2cb21[_0x6709('0xe9')][_0x6709('0xe8')]||_0xa2cb21[_0x6709('0xe7')][_0x6709('0xe9')][_0x6709('0xe8')]});return db[_0x6709('0xaf')]['destroy']({'where':{'membername':_0x55b574['name']},'individualHooks':!![]});}}else{throw new db[(_0x6709('0x21'))][(_0x6709('0x22'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x55b574){return _0x55b574[_0x6709('0xea')]({'raw':!![]});}})['then'](function(_0x14b923){if(_0x55b574){var _0x1a2ad9=[];if(_0x14b923){_0x3c35bb=_0x14b923;if(_0x3c35bb[_0x6709('0x56')]){for(var _0x3094f2=0x0;_0x3094f2<_0x3c35bb[_0x6709('0x56')];_0x3094f2++){_0x1a2ad9[_0x6709('0xeb')]({'membername':_0x55b574[_0x6709('0x46')],'UserId':_0x55b574['id'],'queue_name':_0x3c35bb[_0x3094f2]['name'],'VoiceQueueId':_0x3c35bb[_0x3094f2]['id'],'interface':_0x83a02,'paused':_0x55b574['loginInPause']||![],'penalty':_0x3c35bb[_0x3094f2][_0x6709('0xec')]||0x0});}return BPromise[_0x6709('0xae')](_0x1a2ad9,function(_0x9106c5){return db[_0x6709('0xaf')][_0x6709('0xb0')](_0x9106c5);});}}}})[_0x6709('0x37')](function(){if(_0x55b574){return db[_0x6709('0xed')][_0x6709('0x65')]({'where':{'membername':_0x55b574[_0x6709('0x46')],'exitAt':null}});}})[_0x6709('0x37')](function(_0x58b66c){if(_0x55b574){var _0x414746=[];_0x58b66c[_0x6709('0xee')](function(_0x3a0f43){_0x414746[_0x6709('0xeb')](_0x3a0f43['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x6709('0xef')](_0x414746);}})[_0x6709('0x37')](function(){if(_0x55b574){var _0xbfbee6=[];var _0x402273=[];var _0x268974=utils[_0x6709('0xf0')]();var _0x2808f8={'membername':_0x55b574[_0x6709('0x46')],'interface':_0x83a02,'enterAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'role':_0x55b574[_0x6709('0x44')],'internal':_0x55b574[_0x6709('0x7a')]};_0x268974['forEach'](function(_0x49829a){_0xbfbee6['push'](_[_0x6709('0x5c')]({'channel':_0x49829a,'type':_0x6709('0xf2'),'data1':_0xa2cb21[_0x6709('0x6b')]['device'],'data2':_0x83a02},_0x2808f8));if(_0x55b574[_0x6709('0xf3')]){_0x402273[_0x6709('0xeb')](_[_0x6709('0x5c')]({'channel':_0x49829a,'type':_0x6709('0xf4'),'data1':'LOGININPAUSE'},_0x2808f8));}});return db[_0x6709('0xed')]['bulkCreate'](_0xbfbee6[_0x6709('0xf5')](_0x402273),{'individualHooks':!![]});}})[_0x6709('0x37')](function(){if(_0x55b574){return _0x55b574[_0x6709('0x36')]({'online':!![],'lastLoginAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'voicePause':_0x55b574[_0x6709('0xf3')]||![],'mailPause':_0x55b574[_0x6709('0xf3')]||![],'chatPause':_0x55b574[_0x6709('0xf3')]||![],'faxPause':_0x55b574[_0x6709('0xf3')]||![],'smsPause':_0x55b574[_0x6709('0xf3')]||![],'openchannelPause':_0x55b574['loginInPause']||![],'whatsappPause':_0x55b574[_0x6709('0xf3')]||![],'pauseType':_0x55b574[_0x6709('0xf3')]?'LOGININPAUSE':null,'interface':_0x83a02,'lastPauseAt':moment()[_0x6709('0x76')](_0x6709('0xf1'))});}})[_0x6709('0x37')](function(_0x4b2173){if(_0xa2cb21[_0x6709('0xf6')]){return _0x3a8d29();}else{return BPromise[_0x6709('0xf7')](_0x4b2173)[_0x6709('0x37')](respondWithResult(_0x37f8ef,null));}})['catch'](handleError(_0x37f8ef,null));};exports[_0x6709('0xf8')]=function(_0x162a37,_0xb6e828,_0x47ac2f){var _0x48f37a;return db['User']['find']({'where':{'id':_0x162a37[_0x6709('0x66')]['id'],'role':_0x6709('0x3d')},'attributes':['id',_0x6709('0x46'),'role']})[_0x6709('0x37')](handleEntityNotFound(_0xb6e828,null))['then'](function(_0x1588b1){if(_0x1588b1){_0x48f37a=_0x1588b1;return db['UserVoiceQueueRt'][_0x6709('0x38')]({'where':{'membername':_0x48f37a[_0x6709('0x46')]},'individualHooks':!![]});}})[_0x6709('0x37')](function(){return db[_0x6709('0xed')][_0x6709('0x65')]({'where':{'membername':_0x48f37a[_0x6709('0x46')],'exitAt':null}});})[_0x6709('0x37')](function(_0x2567fc){var _0x1e8cfc=[];_0x2567fc[_0x6709('0xee')](function(_0x223a6b){_0x1e8cfc[_0x6709('0xeb')](_0x223a6b[_0x6709('0x36')]({'exitAt':moment()[_0x6709('0x76')](_0x6709('0xf1'))}));});return BPromise['all'](_0x1e8cfc);})['then'](function(){return _0x48f37a[_0x6709('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6709('0x37')](respondWithResult(_0xb6e828,null))[_0x6709('0x2c')](handleError(_0xb6e828,null));};exports['pause']=function(_0x1f188f,_0x4e4709,_0x55883b){var _0x17a159;return db[_0x6709('0xaf')][_0x6709('0x36')]({'paused':0x1},{'where':{'UserId':_0x1f188f[_0x6709('0x66')]['id']},'individualHooks':!![]})[_0x6709('0x37')](function(){return db[_0x6709('0x64')]['find']({'where':{'id':_0x1f188f[_0x6709('0x66')]['id'],'role':_0x6709('0x3d')},'attributes':['id',_0x6709('0x46'),_0x6709('0x44'),_0x6709('0x7a'),_0x6709('0xa2')]});})[_0x6709('0x37')](handleEntityNotFound(_0x4e4709,null))[_0x6709('0x37')](function(_0x24f582){if(_0x24f582){_0x17a159=_0x24f582;return respondWithRpcPromise(_0x6709('0xf9'),_0x6709('0xfa'),{'id':_0x17a159['id'],'name':_0x17a159['name'],'pause':!![]});}})[_0x6709('0x37')](function(){if(_0x17a159){return db['MemberReport'][_0x6709('0x65')]({'where':{'membername':_0x17a159[_0x6709('0x46')],'type':'PAUSE','exitAt':null}});}})[_0x6709('0x37')](function(_0x48943f){if(_0x48943f[_0x6709('0x56')]){var _0x5a14dc=moment()[_0x6709('0x76')](_0x6709('0xf1'));for(var _0x1ab6de=0x0,_0x14b649=_0x48943f['length'];_0x1ab6de<_0x14b649;_0x1ab6de++){_0x48943f[_0x1ab6de][_0x6709('0xfb')]({'exitAt':_0x5a14dc});}}})[_0x6709('0x37')](function(){var _0x15bbcc=[];var _0x149d54=utils[_0x6709('0xf0')]();_0x149d54['forEach'](function(_0x35bb0d){_0x15bbcc['push']({'channel':_0x35bb0d,'membername':_0x17a159['name'],'interface':_[_0x6709('0x74')](_0x17a159[_0x6709('0xa2')])?util[_0x6709('0x76')]('SIP/%s',_0x17a159[_0x6709('0x46')]):_0x17a159['interface'],'type':_0x6709('0xf4'),'enterAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'data1':_0x1f188f['body'][_0x6709('0x5d')]||_0x6709('0xfc'),'role':_0x17a159[_0x6709('0x44')],'internal':_0x17a159[_0x6709('0x7a')]});});return db[_0x6709('0xed')][_0x6709('0x6a')](_0x15bbcc,{'individualHooks':!![]});})['then'](function(){return _0x17a159[_0x6709('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1f188f[_0x6709('0x6b')][_0x6709('0x5d')]||_0x6709('0xfc'),'lastPauseAt':moment()[_0x6709('0x76')](_0x6709('0xf1'))});})['then'](respondWithResult(_0x4e4709,null))[_0x6709('0x2c')](handleError(_0x4e4709,null));};exports['unpause']=function(_0x101d23,_0x496e1b,_0x269352){var _0x2eeb87;return db[_0x6709('0x64')]['find']({'where':{'id':_0x101d23[_0x6709('0x66')]['id']},'attributes':['id',_0x6709('0x46'),_0x6709('0x44'),'voicePause','mailPause','chatPause',_0x6709('0xfd'),'openchannelPause',_0x6709('0xfe'),_0x6709('0xff'),_0x6709('0x100'),_0x6709('0x101')]})[_0x6709('0x37')](handleEntityNotFound(_0x496e1b,null))[_0x6709('0x37')](function(_0x4e5dce){if(_0x4e5dce){_0x2eeb87=_0x4e5dce;if(_0x101d23[_0x6709('0x6b')][_0x6709('0xa0')]&&!utils['isValidChannel'](_0x101d23[_0x6709('0x6b')]['channel'])){throw new db[(_0x6709('0x21'))]['ValidationError'](_0x6709('0xa4'));}switch(_0x101d23['body'][_0x6709('0xa0')]){case _0x6709('0xad'):return respondWithRpcPromise(_0x6709('0xf9'),_0x6709('0x102'),{'id':_0x2eeb87['id'],'name':_0x2eeb87[_0x6709('0x46')],'pause':![]})[_0x6709('0x37')](function(){return db[_0x6709('0xaf')]['update']({'paused':0x0},{'where':{'UserId':_0x2eeb87['id']},'individualHooks':!![]});})[_0x6709('0x37')](function(){return db[_0x6709('0xed')]['find']({'where':{'channel':_0x101d23['body'][_0x6709('0xa0')],'membername':_0x2eeb87[_0x6709('0x46')],'type':_0x6709('0xf4'),'exitAt':null}});})['then'](function(_0xfb93fc){if(_0xfb93fc){return _0xfb93fc[_0x6709('0x36')]({'exitAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'data2':_0x6709('0x103')},{'individualHooks':!![]});}return null;})[_0x6709('0x37')](function(){return _0x2eeb87['update']({'voicePause':![]});});case _0x6709('0x104'):case _0x6709('0x105'):case'fax':case'sms':case _0x6709('0x106'):case _0x6709('0x107'):return db['MemberReport'][_0x6709('0x45')]({'where':{'channel':_0x101d23[_0x6709('0x6b')][_0x6709('0xa0')],'membername':_0x2eeb87[_0x6709('0x46')],'type':_0x6709('0xf4'),'exitAt':null}})[_0x6709('0x37')](function(_0xcc5545){if(_0xcc5545){return _0xcc5545[_0x6709('0x36')]({'exitAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'data2':_0x6709('0x103')},{'individualHooks':!![]});}return null;})[_0x6709('0x37')](function(){var _0x6606={};_[_0x6709('0x30')](_0x6606,util[_0x6709('0x76')](_0x6709('0x108'),_0x101d23[_0x6709('0x6b')][_0x6709('0xa0')],_0x6709('0x109')),![]);return _0x2eeb87['update'](_0x6606);});default:return respondWithRpcPromise(_0x6709('0xf9'),_0x6709('0x102'),{'id':_0x2eeb87['id'],'name':_0x2eeb87[_0x6709('0x46')],'pause':![]})[_0x6709('0x37')](function(){return db['UserVoiceQueueRt'][_0x6709('0x36')]({'paused':0x0},{'where':{'UserId':_0x2eeb87['id']}});})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x2eeb87['name'],'type':_0x6709('0xf4'),'exitAt':null}});})[_0x6709('0x37')](function(_0x831546){var _0xee9759=[];_0x831546[_0x6709('0xee')](function(_0x4a4c2f){_0xee9759[_0x6709('0xeb')](_0x4a4c2f['update']({'exitAt':moment()[_0x6709('0x76')](_0x6709('0xf1')),'data2':_0x6709('0x103')}));});return BPromise[_0x6709('0xef')](_0xee9759);})[_0x6709('0x37')](function(){return _0x2eeb87[_0x6709('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x496e1b,null))[_0x6709('0x2c')](handleError(_0x496e1b,null));};exports[_0x6709('0x10a')]=function(_0x236eac,_0x17c21f,_0x5c7aec){var _0x24e055={};var _0x14364c={};var _0x2f0e79;var _0x5bab6c;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x236eac[_0x6709('0x66')]['id']}})['then'](handleEntityNotFound(_0x17c21f,null))[_0x6709('0x37')](function(_0x56aa6c){if(_0x56aa6c){_0x2f0e79=_0x56aa6c;_0x14364c[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0x10b')][_0x6709('0x68')]);_0x14364c[_0x6709('0x51')]=_[_0x6709('0x52')](_0x236eac['query']);_0x14364c[_0x6709('0x53')]=_['intersection'](_0x14364c[_0x6709('0x4e')],_0x14364c[_0x6709('0x51')]);_0x24e055[_0x6709('0x54')]=_['intersection'](_0x14364c[_0x6709('0x4e')],qs[_0x6709('0x55')](_0x236eac['query'][_0x6709('0x55')]));_0x24e055[_0x6709('0x54')]=_0x24e055[_0x6709('0x54')][_0x6709('0x56')]?_0x24e055['attributes']:_0x14364c[_0x6709('0x4e')];_0x24e055[_0x6709('0xc0')]=qs[_0x6709('0x59')](_0x236eac['query']['sort']);_0x24e055[_0x6709('0x5a')]=qs['filters'](_[_0x6709('0x5b')](_0x236eac[_0x6709('0x51')],_0x14364c['filters']));if(_0x236eac[_0x6709('0x51')][_0x6709('0x60')]){_0x24e055[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x24e055[_0x6709('0x5a')],{'$or':_['map'](_0x24e055['attributes'],function(_0x5dabe4){var _0x397622={};_0x397622[_0x5dabe4]={'$like':'%'+_0x236eac[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x397622;})});}_0x24e055=_[_0x6709('0x5c')]({},_0x24e055,_0x236eac[_0x6709('0xc1')]);return _0x2f0e79[_0x6709('0x10a')](_0x24e055);}})['then'](function(_0x6d7017){if(_0x6d7017){_0x5bab6c=_0x6d7017[_0x6709('0x56')];if(!_0x236eac[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x24e055[_0x6709('0x2f')]=qs['limit'](_0x236eac[_0x6709('0x51')][_0x6709('0x2f')]);_0x24e055['offset']=qs['offset'](_0x236eac['query'][_0x6709('0x2e')]);}return _0x2f0e79[_0x6709('0x10a')](_0x24e055);}})['then'](function(_0x49f906){if(_0x49f906){return _0x49f906?{'count':_0x5bab6c,'rows':_0x49f906}:null;}})['then'](respondWithResult(_0x17c21f,null))[_0x6709('0x2c')](handleError(_0x17c21f,null));};exports[_0x6709('0x10c')]=function(_0x5551c0,_0x5bd629){return db[_0x6709('0x64')][_0x6709('0x45')]({'where':{'id':_0x5551c0[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x5bd629,null))[_0x6709('0x37')](function(_0x57e7a9){if(_0x57e7a9){var _0x12547d=_0x57e7a9[_0x6709('0x39')]({'plain':!![]});return _0x57e7a9['addTeams'](_0x5551c0[_0x6709('0x6b')][_0x6709('0x6e')],_[_0x6709('0x6f')](_0x5551c0['body'],[_0x6709('0x6e'),'id'])||{})[_0x6709('0x37')](function(){for(var _0x33798d=0x0;_0x33798d<_0x5551c0[_0x6709('0x6b')][_0x6709('0x6e')][_0x6709('0x56')];_0x33798d++){var _0x22b30a=[];db[_0x6709('0x10b')][_0x6709('0x96')]({'where':{'id':_0x5551c0[_0x6709('0x6b')][_0x6709('0x6e')][_0x33798d]}})['then'](function(_0x35024a){_0x22b30a['push'](_0x35024a[_0x6709('0xea')]()[_0x6709('0x37')](function(_0x3f9550){for(var _0x1245c0=0x0;_0x1245c0<_0x3f9550[_0x6709('0x56')];_0x1245c0++){_0x3f9550[_0x1245c0][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x10e'));}return _0x3f9550;}));_0x22b30a[_0x6709('0xeb')](_0x35024a[_0x6709('0x10f')]()[_0x6709('0x37')](function(_0x83555b){for(var _0x1bfca9=0x0;_0x1bfca9<_0x83555b[_0x6709('0x56')];_0x1bfca9++){_0x83555b[_0x1bfca9][_0x6709('0x10d')]('channel',_0x6709('0x110'));}return _0x83555b;}));_0x22b30a[_0x6709('0xeb')](_0x35024a['getMailQueues']()[_0x6709('0x37')](function(_0xdc2607){for(var _0x2a74bd=0x0;_0x2a74bd<_0xdc2607[_0x6709('0x56')];_0x2a74bd++){_0xdc2607[_0x2a74bd][_0x6709('0x10d')]('channel','Mail');}return _0xdc2607;}));_0x22b30a[_0x6709('0xeb')](_0x35024a[_0x6709('0x111')]()[_0x6709('0x37')](function(_0x51b537){for(var _0x5f5d7e=0x0;_0x5f5d7e<_0x51b537[_0x6709('0x56')];_0x5f5d7e++){_0x51b537[_0x5f5d7e][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x112'));}return _0x51b537;}));_0x22b30a[_0x6709('0xeb')](_0x35024a[_0x6709('0x113')]()[_0x6709('0x37')](function(_0x4074be){for(var _0x2e28a0=0x0;_0x2e28a0<_0x4074be['length'];_0x2e28a0++){_0x4074be[_0x2e28a0][_0x6709('0x10d')](_0x6709('0xa0'),'Whatsapp');}return _0x4074be;}));_0x22b30a['push'](_0x35024a[_0x6709('0x114')]()[_0x6709('0x37')](function(_0x4964b0){for(var _0x2320ce=0x0;_0x2320ce<_0x4964b0['length'];_0x2320ce++){_0x4964b0[_0x2320ce][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x115'));}return _0x4964b0;}));_0x22b30a[_0x6709('0xeb')](_0x35024a['getOpenchannelQueues']()['then'](function(_0x3133b8){for(var _0x41501e=0x0;_0x41501e<_0x3133b8[_0x6709('0x56')];_0x41501e++){_0x3133b8[_0x41501e][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x116'));}return _0x3133b8;}));return BPromise[_0x6709('0xef')](_0x22b30a);})['then'](function(_0x403e7a){var _0x297f36=_['flatten'](_0x403e7a);_0x22b30a=[];return db[_0x6709('0x5e')][_0x6709('0x117')](function(_0x55d838){for(var _0x255471=0x0;_0x255471<_0x297f36['length'];_0x255471++){_0x22b30a['push'](_0x297f36[_0x255471][_0x6709('0x118')](_0x12547d['id']),{'transaction':_0x55d838});}return BPromise[_0x6709('0xef')](_0x22b30a)[_0x6709('0x37')](function(){if(_0x12547d[_0x6709('0xa1')]){return BPromise['each'](_[_0x6709('0x60')](_0x297f36,function(_0x16dc75){return _0x16dc75['getDataValue'](_0x6709('0xa0'))===_0x6709('0x10e');}),function(_0x332f50){return db[_0x6709('0xaf')][_0x6709('0xb0')]({'membername':_0x12547d[_0x6709('0x46')],'UserId':_0x12547d['id'],'queue_name':_0x332f50[_0x6709('0x46')],'VoiceQueueId':_0x332f50['id'],'interface':_[_0x6709('0x74')](_0x12547d[_0x6709('0xa2')])?util[_0x6709('0x76')](_0x6709('0xe2'),_0x12547d['name']):_0x12547d[_0x6709('0xa2')],'paused':_0x12547d[_0x6709('0x119')]||![],'penalty':_0x12547d[_0x6709('0xa7')]},{'transaction':_0x55d838});});}else{return;}})['then'](function(){for(var _0x144435=0x0;_0x144435<_0x297f36[_0x6709('0x56')];_0x144435++){var _0x1dcd87=_0x297f36[_0x144435]['getDataValue'](_0x6709('0xa0'));var _0x50b2a0=_0x1dcd87+_0x6709('0xa9');socket[_0x6709('0xaa')](_0x6709('0x3b')+_0x1dcd87+'Queue:save',{'UserId':_0x12547d['id'],['queueField']:_0x297f36[_0x144435]['id']});}});});});}});}})[_0x6709('0x37')](respondWithStatusCode(_0x5bd629,null))['catch'](handleError(_0x5bd629,null));};exports[_0x6709('0x11a')]=function(_0x434c3b,_0x11e562){return db['User'][_0x6709('0x96')]({'where':{'id':_0x434c3b[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x11e562,null))[_0x6709('0x37')](function(_0x3cb574){if(_0x3cb574){var _0x37a2f1=_0x3cb574[_0x6709('0x39')]({'plain':!![]});var _0x2df80c=_0x434c3b['query'][_0x6709('0x6e')];return _0x3cb574[_0x6709('0x11a')](_0x2df80c)['then'](function(){for(var _0x2b288c=0x0;_0x2b288c<_0x2df80c[_0x6709('0x56')];_0x2b288c++){var _0x573e3b=[];db[_0x6709('0x10b')][_0x6709('0x96')]({'where':{'id':_0x2df80c[_0x2b288c]}})[_0x6709('0x37')](function(_0x2cb0b1){_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0xea')]()[_0x6709('0x37')](function(_0x121c04){for(var _0x215151=0x0;_0x215151<_0x121c04[_0x6709('0x56')];_0x215151++){_0x121c04[_0x215151]['setDataValue'](_0x6709('0xa0'),'Voice');}return _0x121c04;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1['getChatQueues']()[_0x6709('0x37')](function(_0x5825f9){for(var _0x279109=0x0;_0x279109<_0x5825f9[_0x6709('0x56')];_0x279109++){_0x5825f9[_0x279109][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x110'));}return _0x5825f9;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0x11b')]()[_0x6709('0x37')](function(_0x579839){for(var _0x12c032=0x0;_0x12c032<_0x579839['length'];_0x12c032++){_0x579839[_0x12c032][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x11c'));}return _0x579839;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0x111')]()[_0x6709('0x37')](function(_0x21c693){for(var _0x1f9171=0x0;_0x1f9171<_0x21c693['length'];_0x1f9171++){_0x21c693[_0x1f9171]['setDataValue'](_0x6709('0xa0'),_0x6709('0x112'));}return _0x21c693;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0x113')]()['then'](function(_0x32cea8){for(var _0x495261=0x0;_0x495261<_0x32cea8['length'];_0x495261++){_0x32cea8[_0x495261][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x11d'));}return _0x32cea8;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0x114')]()['then'](function(_0x54171e){for(var _0x208d55=0x0;_0x208d55<_0x54171e[_0x6709('0x56')];_0x208d55++){_0x54171e[_0x208d55][_0x6709('0x10d')](_0x6709('0xa0'),_0x6709('0x115'));}return _0x54171e;}));_0x573e3b[_0x6709('0xeb')](_0x2cb0b1[_0x6709('0x11e')]()[_0x6709('0x37')](function(_0x5dfc0d){for(var _0x3d8bcd=0x0;_0x3d8bcd<_0x5dfc0d[_0x6709('0x56')];_0x3d8bcd++){_0x5dfc0d[_0x3d8bcd]['setDataValue'](_0x6709('0xa0'),_0x6709('0x116'));}return _0x5dfc0d;}));return BPromise[_0x6709('0xef')](_0x573e3b);})[_0x6709('0x37')](function(_0x127ad8){var _0x53b918=_['flatten'](_0x127ad8);_0x573e3b=[];return db['sequelize'][_0x6709('0x117')](function(_0x1fb570){for(var _0x1ee96b=0x0;_0x1ee96b<_0x53b918[_0x6709('0x56')];_0x1ee96b++){_0x573e3b[_0x6709('0xeb')](_0x53b918[_0x1ee96b][_0x6709('0x11f')](_0x37a2f1['id']),{'transaction':_0x1fb570});}return BPromise[_0x6709('0xef')](_0x573e3b)[_0x6709('0x37')](function(){if(_0x37a2f1[_0x6709('0xa1')]){return BPromise[_0x6709('0xae')](_[_0x6709('0x60')](_0x53b918,function(_0x4913a7){return _0x4913a7[_0x6709('0x120')](_0x6709('0xa0'))==='Voice';}),function(_0x4d080d){return db[_0x6709('0xaf')]['destroy']({'where':{'VoiceQueueId':_0x4d080d['id'],'UserId':_0x37a2f1['id']},'transaction':_0x1fb570});});}else{return;}})[_0x6709('0x37')](function(){for(var _0x423923=0x0;_0x423923<_0x53b918[_0x6709('0x56')];_0x423923++){var _0x44794f=_0x53b918[_0x423923]['getDataValue'](_0x6709('0xa0'));var _0x46e26d=_0x44794f+_0x6709('0xa9');socket['emit']('user'+_0x44794f+'Queue:remove',{'UserId':_0x37a2f1['id'],['queueField']:_0x53b918[_0x423923]['id']});}});});});}});}})[_0x6709('0x37')](respondWithStatusCode(_0x11e562,null))[_0x6709('0x2c')](handleError(_0x11e562,null));};exports['getLists']=function(_0x626978,_0x866ff2,_0x4ca37c){var _0x45ccc4={};var _0x2be6ec={};var _0x86fd38;var _0x1dce3c;return db['User'][_0x6709('0x96')]({'where':{'id':_0x626978[_0x6709('0x66')]['id']}})[_0x6709('0x37')](handleEntityNotFound(_0x866ff2,null))[_0x6709('0x37')](function(_0x32c755){if(_0x32c755){_0x86fd38=_0x32c755;_0x2be6ec[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0xc2')][_0x6709('0x68')]);_0x2be6ec[_0x6709('0x51')]=_[_0x6709('0x52')](_0x626978[_0x6709('0x51')]);_0x2be6ec[_0x6709('0x53')]=_[_0x6709('0x69')](_0x2be6ec[_0x6709('0x4e')],_0x2be6ec[_0x6709('0x51')]);_0x45ccc4['attributes']=_['intersection'](_0x2be6ec[_0x6709('0x4e')],qs['fields'](_0x626978[_0x6709('0x51')]['fields']));_0x45ccc4[_0x6709('0x54')]=_0x45ccc4[_0x6709('0x54')][_0x6709('0x56')]?_0x45ccc4[_0x6709('0x54')]:_0x2be6ec[_0x6709('0x4e')];_0x45ccc4['order']=qs['sort'](_0x626978['query'][_0x6709('0x59')]);_0x45ccc4[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x626978[_0x6709('0x51')],_0x2be6ec[_0x6709('0x53')]));if(_0x626978[_0x6709('0x51')][_0x6709('0x60')]){_0x45ccc4[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x45ccc4['where'],{'$or':_[_0x6709('0x41')](_0x45ccc4[_0x6709('0x54')],function(_0xcfbc0b){var _0x2be741={};_0x2be741[_0xcfbc0b]={'$like':'%'+_0x626978[_0x6709('0x51')][_0x6709('0x60')]+'%'};return _0x2be741;})});}_0x45ccc4=_[_0x6709('0x5c')]({},_0x45ccc4,_0x626978['options']);return _0x86fd38[_0x6709('0x121')](_0x45ccc4);}})[_0x6709('0x37')](function(_0x3a9f44){if(_0x3a9f44){_0x1dce3c=_0x3a9f44[_0x6709('0x56')];if(!_0x626978[_0x6709('0x51')][_0x6709('0x57')](_0x6709('0x58'))){_0x45ccc4[_0x6709('0x2f')]=qs['limit'](_0x626978[_0x6709('0x51')][_0x6709('0x2f')]);_0x45ccc4[_0x6709('0x2e')]=qs[_0x6709('0x2e')](_0x626978[_0x6709('0x51')][_0x6709('0x2e')]);}return _0x86fd38[_0x6709('0x121')](_0x45ccc4);}})['then'](function(_0x5b8c14){if(_0x5b8c14){return _0x5b8c14?{'count':_0x1dce3c,'rows':_0x5b8c14}:null;}})['then'](respondWithResult(_0x866ff2,null))[_0x6709('0x2c')](handleError(_0x866ff2,null));};exports[_0x6709('0x122')]=function(_0x5b078e,_0x3f5db7,_0x2c365b){var _0x44d73f={};var _0x5c897b={};var _0x500c7b;var _0x26deaf;return db[_0x6709('0x64')][_0x6709('0x96')]({'where':{'id':_0x5b078e[_0x6709('0x66')]['id']}})['then'](handleEntityNotFound(_0x3f5db7,null))[_0x6709('0x37')](function(_0x36093b){if(_0x36093b){_0x500c7b=_0x36093b;_0x5c897b[_0x6709('0x4e')]=_[_0x6709('0x52')](db[_0x6709('0x64')][_0x6709('0x68')]);_0x5c897b[_0x6709('0x51')]=_[_0x6709('0x52')](_0x5b078e['query']);_0x5c897b[_0x6709('0x53')]=_[_0x6709('0x69')](_0x5c897b[_0x6709('0x4e')],_0x5c897b['query']);_0x44d73f[_0x6709('0x54')]=_[_0x6709('0x69')](_0x5c897b['model'],qs['fields'](_0x5b078e['query']['fields']));_0x44d73f['attributes']=_0x44d73f[_0x6709('0x54')][_0x6709('0x56')]?_0x44d73f[_0x6709('0x54')]:_0x5c897b['model'];_0x44d73f['order']=qs[_0x6709('0x59')](_0x5b078e[_0x6709('0x51')][_0x6709('0x59')]);_0x44d73f[_0x6709('0x5a')]=qs[_0x6709('0x53')](_[_0x6709('0x5b')](_0x5b078e[_0x6709('0x51')],_0x5c897b['filters']));if(_0x5b078e[_0x6709('0x51')][_0x6709('0x60')]){_0x44d73f[_0x6709('0x5a')]=_[_0x6709('0x5c')](_0x44d73f[_0x6709('0x5a')],{'$or':_[_0x6709('0x41')](_0x44d73f[_0x6709('0x54')],function(_0x58e029){var _0x2e8bfd={};_0x2e8bfd[_0x58e029]={'$like':'%'+_0x5b078e[_0x6709('0x51')]['filter']+'%'};return _0x2e8bfd;})});}_0x44d73f[_0x6709('0x4e')]=db['User'];_0x44d73f['as']=_0x6709('0x3c');_0x44d73f=_['merge']({},_0x44d73f,_0x5b078e['options']);return _0x500c7b[_0x6709('0xea')]({'include':[_0x44d73f]});}})[_0x6709('0x37')](function(_0x5d4936){if(_0x5d4936){var _0x5f5306={},_0x192458=[],_0x5d6673=0x0;for(var _0xbc95e7=0x0;_0xbc95e7<_0x5d4936[_0x6709('0x56')];_0xbc95e7+=0x1){for(var _0x570244=0x0,_0x169653;_0x570244<_0x5d4936[_0xbc95e7][_0x6709('0x3c')][_0x6709('0x56')];_0x570244+=0x1){_0x169653=_0x5d4936[_0xbc95e7]['Agents'][_0x570244]['get']({'plain':!![]});_0x5f5306[_0x169653['id']]=_0x169653;}}_0x5f5306=_['values'](_0x5f5306);for(var _0x1f6f99=qs[_0x6709('0x2e')](_0x5b078e[_0x6709('0x51')][_0x6709('0x2e')]);_0x1f6f99<_0x5f5306['length']&&_0x192458['length']=_0xad1edf[_0x760f('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x760f('0xf')](function(){if(_0x5a5a1c){return db[_0x760f('0x2a')][_0x760f('0x52')]({'where':{'membername':_0x5a5a1c[_0x760f('0x28')]},'individualHooks':!![]});}})[_0x760f('0xf')](function(){if(_0x5a5a1c){return _0x5a5a1c['getVoiceQueues']({'raw':!![]});}})[_0x760f('0xf')](function(_0x125abd){if(_0x5a5a1c){if(_0x125abd){var _0xa2bc56=[];_0x3aeacf=_0x125abd;if(_0x3aeacf[_0x760f('0x30')]){for(var _0xa8fb6d=0x0;_0xa8fb6d<_0x3aeacf[_0x760f('0x30')];_0xa8fb6d++){_0xa2bc56[_0x760f('0x33')](db[_0x760f('0x2a')][_0x760f('0x53')]({'membername':_0x5a5a1c[_0x760f('0x28')],'UserId':_0x5a5a1c['id'],'queue_name':_0x3aeacf[_0xa8fb6d][_0x760f('0x28')],'VoiceQueueId':_0x3aeacf[_0xa8fb6d]['id'],'interface':_0x828e21,'paused':_0x5a5a1c[_0x760f('0x54')]||![],'penalty':_0x3aeacf[_0xa8fb6d][_0x760f('0x55')]||0x0}));}return BPromise[_0x760f('0x48')](_0xa2bc56);}}}})['then'](function(){if(_0x5a5a1c){return db['MemberReport']['findAll']({'where':{'membername':_0x5a5a1c[_0x760f('0x28')],'exitAt':null}});}})[_0x760f('0xf')](function(_0x5d2fcd){if(_0x5a5a1c){if(_0x5d2fcd&&_0x5d2fcd[_0x760f('0x30')]){var _0x19309f=[];_0x5d2fcd['forEach'](function(_0x2391bc){_0x19309f[_0x760f('0x33')](_0x2391bc['update']({'exitAt':moment()[_0x760f('0x2e')](_0x760f('0x2f'))}));});return BPromise[_0x760f('0x48')](_0x19309f);}}})[_0x760f('0xf')](function(_0x5745b1){if(_0x5a5a1c){var _0x261617=[];var _0x493789=[];var _0x36ac5b=utils[_0x760f('0x56')]();var _0x2d8d5d={'membername':_0x5a5a1c['name'],'interface':_0x828e21,'enterAt':moment()[_0x760f('0x2e')](_0x760f('0x2f')),'role':_0x5a5a1c[_0x760f('0x29')],'internal':_0x5a5a1c[_0x760f('0x38')]};_0x36ac5b[_0x760f('0x32')](function(_0x1929c8){_0x261617['push'](_[_0x760f('0x57')]({'channel':_0x1929c8,'type':_0x760f('0x58'),'data1':_0x760f('0x59'),'data2':_0x828e21},_0x2d8d5d));if(_0x5a5a1c[_0x760f('0x54')]){_0x493789['push'](_[_0x760f('0x57')]({'channel':_0x1929c8,'type':_0x760f('0x2d'),'data1':_0x760f('0x5a')},_0x2d8d5d));}});return db['MemberReport']['bulkCreate'](_0x261617[_0x760f('0x5b')](_0x493789),{'individualHooks':!![]});}})[_0x760f('0xf')](function(){if(_0x5a5a1c){return _0x5a5a1c[_0x760f('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x760f('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5a5a1c[_0x760f('0x54')]||![],'mailPause':_0x5a5a1c['loginInPause']||![],'chatPause':_0x5a5a1c[_0x760f('0x54')]||![],'faxPause':_0x5a5a1c['loginInPause']||![],'smsPause':_0x5a5a1c['loginInPause']||![],'openchannelPause':_0x5a5a1c[_0x760f('0x54')]||![],'pauseType':_0x5a5a1c['loginInPause']?_0x760f('0x5a'):null,'lastPauseAt':moment()[_0x760f('0x2e')](_0x760f('0x2f')),'interface':_0x828e21});}})['then'](function(_0x47a7b5){_0x3e316f(_0x47a7b5);})[_0x760f('0x18')](function(_0x54dc0e){_0x2fbba9(_0x8de3d7[_0x760f('0x14')](0x1f4,_0x54dc0e[_0x760f('0x15')]));});});}; \ No newline at end of file +var _0x2373=['attributes','limit','include','map','model','debug','find','ShowUser','name','internal','interface','UserVoiceQueueRt','MemberReport','findAll','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','push','SIP/%s','body','type','role','uniqueid','update','UnpauseUser','channel','isValidChannel','Unknown\x20channel','voice','PAUSE','system','mail','chat','fax','sms','openchannel','%s%s','Pause','forEach','all','findOne','destroy','LoginUser','mobile','phone','count','../../config/license/util','getLicense','agents','upsert','loginInPause','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','socket.io-emitter','redis','./user.socket','request','then','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetUser','User','options','raw','where'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x2373,0x96));var _0x3237=function(_0x382c48,_0x11d9f0){_0x382c48=_0x382c48-0x0;var _0x58b3d2=_0x2373[_0x382c48];return _0x58b3d2;};'use strict';var _=require(_0x3237('0x0'));var util=require(_0x3237('0x1'));var moment=require(_0x3237('0x2'));var BPromise=require(_0x3237('0x3'));var rs=require(_0x3237('0x4'));var fs=require('fs');var Redis=require(_0x3237('0x5'));var db=require(_0x3237('0x6'))['db'];var utils=require(_0x3237('0x7'));var logger=require(_0x3237('0x8'))(_0x3237('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3237('0xa')][_0x3237('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3237('0xc'))(new Redis(config[_0x3237('0xd')]));require(_0x3237('0xe'))['register'](socket);function respondWithRpcPromise(_0x11f200,_0x4919de,_0x4c9404){return new BPromise(function(_0x546949,_0x536f4f){return client[_0x3237('0xf')](_0x11f200,_0x4c9404)[_0x3237('0x10')](function(_0x6c0320){logger['info'](_0x3237('0x11'),_0x4919de,_0x3237('0x12'));logger['debug'](_0x3237('0x13'),_0x4919de,'request\x20sent',JSON[_0x3237('0x14')](_0x6c0320));if(_0x6c0320[_0x3237('0x15')]){if(_0x6c0320[_0x3237('0x15')][_0x3237('0x16')]===0x1f4){logger[_0x3237('0x15')](_0x3237('0x11'),_0x4919de,_0x6c0320['error']['message']);return _0x536f4f(_0x6c0320['error'][_0x3237('0x17')]);}logger[_0x3237('0x15')](_0x3237('0x11'),_0x4919de,_0x6c0320[_0x3237('0x15')]['message']);return _0x546949(_0x6c0320[_0x3237('0x15')][_0x3237('0x17')]);}else{logger[_0x3237('0x18')](_0x3237('0x11'),_0x4919de,_0x3237('0x12'));_0x546949(_0x6c0320[_0x3237('0x19')][_0x3237('0x17')]);}})[_0x3237('0x1a')](function(_0x3cbee0){logger[_0x3237('0x15')]('User,\x20%s,\x20%s',_0x4919de,_0x3cbee0);_0x536f4f(_0x3cbee0);});});}exports[_0x3237('0x1b')]=function(_0x2eba4d){var _0x216d25=this;return new Promise(function(_0x35fe51,_0x2c70f3){return db[_0x3237('0x1c')]['findAll']({'raw':_0x2eba4d[_0x3237('0x1d')]?_0x2eba4d[_0x3237('0x1d')][_0x3237('0x1e')]===undefined?!![]:![]:!![],'where':_0x2eba4d[_0x3237('0x1d')]?_0x2eba4d[_0x3237('0x1d')][_0x3237('0x1f')]||null:null,'attributes':_0x2eba4d[_0x3237('0x1d')]?_0x2eba4d['options'][_0x3237('0x20')]||null:null,'limit':_0x2eba4d[_0x3237('0x1d')]?_0x2eba4d['options'][_0x3237('0x21')]||null:null,'include':_0x2eba4d[_0x3237('0x1d')]?_0x2eba4d[_0x3237('0x1d')][_0x3237('0x22')]?_[_0x3237('0x23')](_0x2eba4d[_0x3237('0x1d')][_0x3237('0x22')],function(_0x3e8001){return{'model':db[_0x3e8001[_0x3237('0x24')]],'as':_0x3e8001['as'],'attributes':_0x3e8001['attributes'],'include':_0x3e8001[_0x3237('0x22')]?_[_0x3237('0x23')](_0x3e8001[_0x3237('0x22')],function(_0x371181){return{'model':db[_0x371181[_0x3237('0x24')]],'as':_0x371181['as'],'attributes':_0x371181['attributes'],'include':_0x371181['include']?_[_0x3237('0x23')](_0x371181[_0x3237('0x22')],function(_0x3f2f9d){return{'model':db[_0x3f2f9d[_0x3237('0x24')]],'as':_0x3f2f9d['as'],'attributes':_0x3f2f9d[_0x3237('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3237('0x10')](function(_0x1bc73b){logger[_0x3237('0x18')](_0x3237('0x1b'),_0x2eba4d);logger[_0x3237('0x25')](_0x3237('0x1b'),_0x2eba4d,JSON['stringify'](_0x1bc73b));_0x35fe51(_0x1bc73b);})[_0x3237('0x1a')](function(_0x1b13dd){logger['error'](_0x3237('0x1b'),_0x1b13dd[_0x3237('0x17')],_0x2eba4d);_0x2c70f3(_0x216d25[_0x3237('0x15')](0x1f4,_0x1b13dd[_0x3237('0x17')]));});});};exports['ShowUser']=function(_0x1e4fd0){var _0x3c1b17=this;return new Promise(function(_0x42f7a1,_0x44eb9d){return db[_0x3237('0x1c')][_0x3237('0x26')]({'raw':_0x1e4fd0[_0x3237('0x1d')]?_0x1e4fd0[_0x3237('0x1d')][_0x3237('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e4fd0[_0x3237('0x1d')]?_0x1e4fd0[_0x3237('0x1d')][_0x3237('0x1f')]||null:null,'attributes':_0x1e4fd0['options']?_0x1e4fd0[_0x3237('0x1d')]['attributes']||null:null,'include':_0x1e4fd0[_0x3237('0x1d')]?_0x1e4fd0['options'][_0x3237('0x22')]?_[_0x3237('0x23')](_0x1e4fd0[_0x3237('0x1d')][_0x3237('0x22')],function(_0x48b864){return{'model':db[_0x48b864[_0x3237('0x24')]],'as':_0x48b864['as'],'attributes':_0x48b864[_0x3237('0x20')],'include':_0x48b864[_0x3237('0x22')]?_[_0x3237('0x23')](_0x48b864[_0x3237('0x22')],function(_0x14632d){return{'model':db[_0x14632d[_0x3237('0x24')]],'as':_0x14632d['as'],'attributes':_0x14632d[_0x3237('0x20')],'include':_0x14632d[_0x3237('0x22')]?_[_0x3237('0x23')](_0x14632d[_0x3237('0x22')],function(_0x31338a){return{'model':db[_0x31338a[_0x3237('0x24')]],'as':_0x31338a['as'],'attributes':_0x31338a[_0x3237('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3237('0x10')](function(_0x474724){logger[_0x3237('0x18')](_0x3237('0x27'),_0x1e4fd0);logger[_0x3237('0x25')](_0x3237('0x27'),_0x1e4fd0,JSON[_0x3237('0x14')](_0x474724));_0x42f7a1(_0x474724);})[_0x3237('0x1a')](function(_0x3c3a72){logger['error']('ShowUser',_0x3c3a72[_0x3237('0x17')],_0x1e4fd0);_0x44eb9d(_0x3c1b17['error'](0x1f4,_0x3c3a72[_0x3237('0x17')]));});});};exports['PauseUser']=function(_0x4a8840){var _0x27c924=this;return new Promise(function(_0x27cbfb,_0x3e8956){var _0x24d75f;return db[_0x3237('0x1c')][_0x3237('0x26')]({'where':_0x4a8840[_0x3237('0x1d')][_0x3237('0x1f')]||{},'attributes':['id',_0x3237('0x28'),'role',_0x3237('0x29'),_0x3237('0x2a')]})[_0x3237('0x10')](function(_0x12d1c2){if(_0x12d1c2){_0x24d75f=_0x12d1c2;return db[_0x3237('0x2b')]['update']({'paused':0x1},{'where':{'UserId':_0x24d75f['id']},'individualHooks':!![]});}})[_0x3237('0x10')](function(){if(_0x24d75f){return db[_0x3237('0x2c')][_0x3237('0x2d')]({'where':{'membername':_0x24d75f[_0x3237('0x28')],'type':'PAUSE','exitAt':null}});}})[_0x3237('0x10')](function(_0x11e478){if(_0x24d75f){if(_0x11e478&&_0x11e478['length']){var _0xc00596=moment()[_0x3237('0x2e')](_0x3237('0x2f'));for(var _0x50e1a3=0x0,_0x78edee=_0x11e478[_0x3237('0x30')];_0x50e1a3<_0x78edee;_0x50e1a3++){_0x11e478[_0x50e1a3][_0x3237('0x31')]({'exitAt':_0xc00596});}}}})[_0x3237('0x10')](function(){if(_0x24d75f){var _0x37affc=[];var _0x8dc4c8=utils[_0x3237('0x32')]();_0x8dc4c8['forEach'](function(_0x9f1564){_0x37affc[_0x3237('0x33')]({'channel':_0x9f1564,'membername':_0x24d75f[_0x3237('0x28')],'interface':_['isNil'](_0x24d75f[_0x3237('0x2a')])?util[_0x3237('0x2e')](_0x3237('0x34'),_0x24d75f[_0x3237('0x28')]):_0x24d75f[_0x3237('0x2a')],'type':'PAUSE','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4a8840[_0x3237('0x35')][_0x3237('0x36')]||'DEFAULT\x20PAUSE','role':_0x24d75f[_0x3237('0x37')],'internal':_0x24d75f[_0x3237('0x29')],'uniqueid':_0x4a8840[_0x3237('0x35')][_0x3237('0x38')]||null});});return db['MemberReport']['bulkCreate'](_0x37affc,{'individualHooks':!![]});}})[_0x3237('0x10')](function(){if(_0x24d75f){return _0x24d75f[_0x3237('0x39')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4a8840[_0x3237('0x35')][_0x3237('0x36')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x3237('0x2e')](_0x3237('0x2f'))});}})[_0x3237('0x10')](function(_0x25a52e){_0x27cbfb(_0x25a52e);})[_0x3237('0x1a')](function(_0xf1ef0){_0x3e8956(_0x27c924[_0x3237('0x15')](0x1f4,_0xf1ef0[_0x3237('0x17')]));});});};exports[_0x3237('0x3a')]=function(_0x519446){var _0xde9580=this;return new Promise(function(_0x186d33,_0x346e18){var _0x487865;return db[_0x3237('0x1c')]['findOne']({'where':_0x519446[_0x3237('0x1d')]['where']||{},'attributes':['id','name']})[_0x3237('0x10')](function(_0x529efb){if(_0x529efb){_0x487865=_0x529efb;if(_0x519446['body'][_0x3237('0x3b')]&&!utils[_0x3237('0x3c')](_0x519446[_0x3237('0x35')]['channel'])){throw new Error(_0x3237('0x3d'));}switch(_0x519446['body']['channel']){case _0x3237('0x3e'):return db[_0x3237('0x2b')][_0x3237('0x39')]({'paused':0x0},{'where':{'UserId':_0x487865['id']}})['then'](function(){return db[_0x3237('0x2c')][_0x3237('0x26')]({'where':{'channel':_0x519446['body'][_0x3237('0x3b')],'membername':_0x487865[_0x3237('0x28')],'type':_0x3237('0x3f'),'exitAt':null}});})[_0x3237('0x10')](function(_0x41e4bf){if(_0x41e4bf){return _0x41e4bf['update']({'exitAt':moment()[_0x3237('0x2e')](_0x3237('0x2f')),'data2':_0x3237('0x40')},{'individualHooks':!![]});}return null;})[_0x3237('0x10')](function(){return _0x487865[_0x3237('0x39')]({'voicePause':![]});});case _0x3237('0x41'):case _0x3237('0x42'):case _0x3237('0x43'):case _0x3237('0x44'):case _0x3237('0x45'):return db[_0x3237('0x2c')]['find']({'where':{'channel':_0x519446['body']['channel'],'membername':_0x487865[_0x3237('0x28')],'type':'PAUSE','exitAt':null}})[_0x3237('0x10')](function(_0x5b068f){return _0x5b068f[_0x3237('0x39')]({'exitAt':moment()[_0x3237('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});})[_0x3237('0x10')](function(){var _0x49dbf9={};_['set'](_0x49dbf9,util[_0x3237('0x2e')](_0x3237('0x46'),_0x519446['body'][_0x3237('0x3b')],_0x3237('0x47')),![]);return _0x487865['update'](_0x49dbf9);});default:return db[_0x3237('0x2b')][_0x3237('0x39')]({'paused':0x0},{'where':{'UserId':_0x487865['id']}})[_0x3237('0x10')](function(){return db[_0x3237('0x2c')]['findAll']({'where':{'membername':_0x487865[_0x3237('0x28')],'type':_0x3237('0x3f'),'exitAt':null}});})[_0x3237('0x10')](function(_0x25a1e2){var _0x4131fc=[];_0x25a1e2[_0x3237('0x48')](function(_0x21443e){_0x4131fc[_0x3237('0x33')](_0x21443e[_0x3237('0x39')]({'exitAt':moment()[_0x3237('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x3237('0x40')}));});return BPromise[_0x3237('0x49')](_0x4131fc);})[_0x3237('0x10')](function(){return _0x487865[_0x3237('0x39')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x3237('0x10')](function(_0x3c64f0){_0x186d33(_0x3c64f0);})[_0x3237('0x1a')](function(_0x53fd4f){_0x346e18(_0xde9580[_0x3237('0x15')](0x1f4,_0x53fd4f[_0x3237('0x17')]));});});};exports['LogoutUser']=function(_0x5b39d3){var _0x1ef05d=this;return new Promise(function(_0x2b5961,_0x24a619){var _0x1f338d;return db[_0x3237('0x1c')][_0x3237('0x4a')]({'where':_0x5b39d3[_0x3237('0x1d')][_0x3237('0x1f')]||{},'attributes':['id',_0x3237('0x28')]})[_0x3237('0x10')](function(_0x1340b8){if(_0x1340b8){_0x1f338d=_0x1340b8;return db[_0x3237('0x2b')][_0x3237('0x4b')]({'where':{'membername':_0x1f338d[_0x3237('0x28')]},'individualHooks':!![]});}})[_0x3237('0x10')](function(){if(_0x1f338d){return db[_0x3237('0x2c')][_0x3237('0x2d')]({'where':{'membername':_0x1f338d['name'],'exitAt':null}});}})[_0x3237('0x10')](function(_0x3fefc3){if(_0x1f338d){if(_0x3fefc3&&_0x3fefc3[_0x3237('0x30')]){var _0x451178=[];_0x3fefc3['forEach'](function(_0xba99f6){_0x451178[_0x3237('0x33')](_0xba99f6[_0x3237('0x39')]({'exitAt':moment()[_0x3237('0x2e')](_0x3237('0x2f'))}));});return BPromise['all'](_0x451178);}}})[_0x3237('0x10')](function(){if(_0x1f338d){return _0x1f338d[_0x3237('0x39')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x3237('0x10')](function(_0x234c14){_0x2b5961(_0x234c14);})[_0x3237('0x1a')](function(_0x236bdd){_0x24a619(_0x1ef05d[_0x3237('0x15')](0x1f4,_0x236bdd[_0x3237('0x17')]));});});};exports[_0x3237('0x4c')]=function(_0x245ab4){var _0x321465=this;return new Promise(function(_0x482438,_0x885126){var _0x103443;var _0x3c6419;var _0x43c55a;var _0x583b95;return db['User'][_0x3237('0x4a')]({'where':_0x245ab4['options'][_0x3237('0x1f')]||{},'attributes':['id',_0x3237('0x28'),_0x3237('0x37'),_0x3237('0x4d'),_0x3237('0x4e'),_0x3237('0x29'),'loginInPause',_0x3237('0x2a')]})[_0x3237('0x10')](function(_0x5a6481){if(_0x5a6481){_0x103443=_0x5a6481;_0x583b95=_0x245ab4[_0x3237('0x35')][_0x3237('0x2a')]?_0x245ab4[_0x3237('0x35')][_0x3237('0x2a')]:util[_0x3237('0x2e')]('SIP/%s',_0x103443[_0x3237('0x28')]);return db[_0x3237('0x1c')][_0x3237('0x4f')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x103443['id']}}});}})[_0x3237('0x10')](function(_0x10411f){if(_0x10411f){_0x43c55a=_0x10411f;return require(_0x3237('0x50'))[_0x3237('0x51')]();}})[_0x3237('0x10')](function(_0x457f91){if(_0x457f91&&_0x457f91[_0x3237('0x52')]&&_0x43c55a>=_0x457f91['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x3237('0x10')](function(){if(_0x103443){return db[_0x3237('0x2b')][_0x3237('0x4b')]({'where':{'membername':_0x103443['name']},'individualHooks':!![]});}})['then'](function(){if(_0x103443){return _0x103443['getVoiceQueues']({'raw':!![]});}})[_0x3237('0x10')](function(_0x44681f){if(_0x103443){if(_0x44681f){var _0x38ae12=[];_0x3c6419=_0x44681f;if(_0x3c6419['length']){for(var _0x103549=0x0;_0x103549<_0x3c6419[_0x3237('0x30')];_0x103549++){_0x38ae12[_0x3237('0x33')](db[_0x3237('0x2b')][_0x3237('0x53')]({'membername':_0x103443['name'],'UserId':_0x103443['id'],'queue_name':_0x3c6419[_0x103549][_0x3237('0x28')],'VoiceQueueId':_0x3c6419[_0x103549]['id'],'interface':_0x583b95,'paused':_0x103443[_0x3237('0x54')]||![],'penalty':_0x3c6419[_0x103549][_0x3237('0x55')]||0x0}));}return BPromise[_0x3237('0x49')](_0x38ae12);}}}})[_0x3237('0x10')](function(){if(_0x103443){return db[_0x3237('0x2c')]['findAll']({'where':{'membername':_0x103443[_0x3237('0x28')],'exitAt':null}});}})[_0x3237('0x10')](function(_0x62323e){if(_0x103443){if(_0x62323e&&_0x62323e[_0x3237('0x30')]){var _0x3b5fda=[];_0x62323e[_0x3237('0x48')](function(_0x3fa3b0){_0x3b5fda['push'](_0x3fa3b0['update']({'exitAt':moment()[_0x3237('0x2e')](_0x3237('0x2f'))}));});return BPromise['all'](_0x3b5fda);}}})[_0x3237('0x10')](function(_0x31adfe){if(_0x103443){var _0x95ce39=[];var _0x1da394=[];var _0x357098=utils['getChannels']();var _0xeaf25c={'membername':_0x103443[_0x3237('0x28')],'interface':_0x583b95,'enterAt':moment()[_0x3237('0x2e')](_0x3237('0x2f')),'role':_0x103443['role'],'internal':_0x103443[_0x3237('0x29')]};_0x357098[_0x3237('0x48')](function(_0x3ae06f){_0x95ce39[_0x3237('0x33')](_['merge']({'channel':_0x3ae06f,'type':_0x3237('0x56'),'data1':_0x3237('0x57'),'data2':_0x583b95},_0xeaf25c));if(_0x103443['loginInPause']){_0x1da394[_0x3237('0x33')](_[_0x3237('0x58')]({'channel':_0x3ae06f,'type':_0x3237('0x3f'),'data1':_0x3237('0x59')},_0xeaf25c));}});return db[_0x3237('0x2c')]['bulkCreate'](_0x95ce39[_0x3237('0x5a')](_0x1da394),{'individualHooks':!![]});}})[_0x3237('0x10')](function(){if(_0x103443){return _0x103443['update']({'online':!![],'lastLoginAt':moment()[_0x3237('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x103443[_0x3237('0x54')]||![],'mailPause':_0x103443[_0x3237('0x54')]||![],'chatPause':_0x103443[_0x3237('0x54')]||![],'faxPause':_0x103443[_0x3237('0x54')]||![],'smsPause':_0x103443['loginInPause']||![],'openchannelPause':_0x103443['loginInPause']||![],'pauseType':_0x103443['loginInPause']?_0x3237('0x59'):null,'lastPauseAt':moment()['format'](_0x3237('0x2f')),'interface':_0x583b95});}})[_0x3237('0x10')](function(_0x1295b4){_0x482438(_0x1295b4);})['catch'](function(_0x30c9a6){_0x885126(_0x321465[_0x3237('0x15')](0x1f4,_0x30c9a6[_0x3237('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 93c1064..d58b53b 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 _0x4396=['emit','removeListener','register','length','user:','./user.events','save'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x4396,0x194));var _0x6439=function(_0x59ef3d,_0x5c7aee){_0x59ef3d=_0x59ef3d-0x0;var _0x585558=_0x4396[_0x59ef3d];return _0x585558;};'use strict';var UserEvents=require(_0x6439('0x0'));var events=[_0x6439('0x1'),'remove','update'];function createListener(_0x8e852,_0x1d4505){return function(_0x5738ad){_0x1d4505[_0x6439('0x2')](_0x8e852,_0x5738ad);};}function removeListener(_0x2329a6,_0x4c7497){return function(){UserEvents[_0x6439('0x3')](_0x2329a6,_0x4c7497);};}exports[_0x6439('0x4')]=function(_0x1c8090){for(var _0x5d4f78=0x0,_0xa44a58=events[_0x6439('0x5')];_0x5d4f78<_0xa44a58;_0x5d4f78++){var _0xb564f3=events[_0x5d4f78];var _0x62ef3b=createListener(_0x6439('0x6')+_0xb564f3,_0x1c8090);UserEvents['on'](_0xb564f3,_0x62ef3b);}}; \ No newline at end of file +var _0xcfcc=['remove','update','emit','removeListener','register','length','save'];(function(_0x333eba,_0x180c4e){var _0x29b4ed=function(_0x6ef490){while(--_0x6ef490){_0x333eba['push'](_0x333eba['shift']());}};_0x29b4ed(++_0x180c4e);}(_0xcfcc,0x8b));var _0xccfc=function(_0x3dc26a,_0x1f9069){_0x3dc26a=_0x3dc26a-0x0;var _0x5356bc=_0xcfcc[_0x3dc26a];return _0x5356bc;};'use strict';var UserEvents=require('./user.events');var events=[_0xccfc('0x0'),_0xccfc('0x1'),_0xccfc('0x2')];function createListener(_0x1b14ae,_0xf47010){return function(_0x76e163){_0xf47010[_0xccfc('0x3')](_0x1b14ae,_0x76e163);};}function removeListener(_0x46b31a,_0x477c5e){return function(){UserEvents[_0xccfc('0x4')](_0x46b31a,_0x477c5e);};}exports[_0xccfc('0x5')]=function(_0x2f8294){for(var _0x4151de=0x0,_0x276315=events[_0xccfc('0x6')];_0x4151de<_0x276315;_0x4151de++){var _0x40cb8a=events[_0x4151de];var _0x437c01=createListener('user:'+_0x40cb8a,_0x2f8294);UserEvents['on'](_0x40cb8a,_0x437c01);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 25acb7d..c5b142c 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 _0xf330=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4d892b,_0x734dc8){var _0x5c6f01=function(_0x1e6973){while(--_0x1e6973){_0x4d892b['push'](_0x4d892b['shift']());}};_0x5c6f01(++_0x734dc8);}(_0xf330,0xcb));var _0x0f33=function(_0x82c104,_0x9c644a){_0x82c104=_0x82c104-0x0;var _0x4ab8ef=_0xf330[_0x82c104];return _0x4ab8ef;};'use strict';var multer=require('multer');var util=require(_0x0f33('0x0'));var path=require(_0x0f33('0x1'));var timeout=require(_0x0f33('0x2'));var express=require(_0x0f33('0x3'));var router=express['Router']();var auth=require(_0x0f33('0x4'));var interaction=require(_0x0f33('0x5'));var config=require('../../config/environment');module[_0x0f33('0x6')]=router; \ No newline at end of file +var _0x93ff=['exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4c61a1,_0x8c62ef){var _0x594b8e=function(_0x12c576){while(--_0x12c576){_0x4c61a1['push'](_0x4c61a1['shift']());}};_0x594b8e(++_0x8c62ef);}(_0x93ff,0x133));var _0xf93f=function(_0x5e13fe,_0x339218){_0x5e13fe=_0x5e13fe-0x0;var _0x26f143=_0x93ff[_0x5e13fe];return _0x26f143;};'use strict';var multer=require(_0xf93f('0x0'));var util=require(_0xf93f('0x1'));var path=require(_0xf93f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf93f('0x3')]();var auth=require(_0xf93f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xf93f('0x5')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 920beef..d34703a 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x36674f,_0x40012b){var _0x406ab2=function(_0x394e1e){while(--_0x394e1e){_0x36674f['push'](_0x36674f['shift']());}};_0x406ab2(++_0x40012b);}(_0xe706,0xa3));var _0x6e70=function(_0x28087c,_0x895c0f){_0x28087c=_0x28087c-0x0;var _0x329122=_0xe706[_0x28087c];return _0x329122;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x32c8ed,_0x45fef2){var _0x580764=function(_0xeb440e){while(--_0xeb440e){_0x32c8ed['push'](_0x32c8ed['shift']());}};_0x580764(++_0x45fef2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index cef0431..1829fc5 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 _0x2e27=['./userChatQueue.attributes','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0x2e27,0x19b));var _0x72e2=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0x2e27[_0x18fb16];return _0x147b0d;};'use strict';var _=require(_0x72e2('0x0'));var util=require(_0x72e2('0x1'));var logger=require(_0x72e2('0x2'))(_0x72e2('0x3'));var moment=require('moment');var BPromise=require(_0x72e2('0x4'));var rp=require(_0x72e2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72e2('0x6'));var config=require('../../config/environment');var attributes=require(_0x72e2('0x7'));module['exports']=function(_0x335266,_0x2fae29){return _0x335266[_0x72e2('0x8')](_0x72e2('0x9'),attributes,{'tableName':_0x72e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5aa9=['bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','lodash','util','../../config/logger','moment'];(function(_0xc7deb7,_0x14acfb){var _0x3e6946=function(_0x3ca4c6){while(--_0x3ca4c6){_0xc7deb7['push'](_0xc7deb7['shift']());}};_0x3e6946(++_0x14acfb);}(_0x5aa9,0x1b4));var _0x95aa=function(_0x6cdf8f,_0x14f16a){_0x6cdf8f=_0x6cdf8f-0x0;var _0x34dec3=_0x5aa9[_0x6cdf8f];return _0x34dec3;};'use strict';var _=require(_0x95aa('0x0'));var util=require(_0x95aa('0x1'));var logger=require(_0x95aa('0x2'))('api');var moment=require(_0x95aa('0x3'));var BPromise=require(_0x95aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95aa('0x5'));var rimraf=require(_0x95aa('0x6'));var config=require(_0x95aa('0x7'));var attributes=require(_0x95aa('0x8'));module['exports']=function(_0x40a46f,_0x5904b2){return _0x40a46f[_0x95aa('0x9')](_0x95aa('0xa'),attributes,{'tableName':'user_has_chat_queues','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 b34552f..278eef9 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 _0xcd1b=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x11cdb3,_0x228295){var _0x414dfc=function(_0x4d794d){while(--_0x4d794d){_0x11cdb3['push'](_0x11cdb3['shift']());}};_0x414dfc(++_0x228295);}(_0xcd1b,0xd5));var _0xbcd1=function(_0x24a90a,_0x40e57e){_0x24a90a=_0x24a90a-0x0;var _0x1fb916=_0xcd1b[_0x24a90a];return _0x1fb916;};'use strict';var _=require(_0xbcd1('0x0'));var util=require('util');var moment=require(_0xbcd1('0x1'));var BPromise=require(_0xbcd1('0x2'));var rs=require(_0xbcd1('0x3'));var fs=require('fs');var Redis=require(_0xbcd1('0x4'));var db=require(_0xbcd1('0x5'))['db'];var utils=require(_0xbcd1('0x6'));var logger=require('../../config/logger')(_0xbcd1('0x7'));var config=require(_0xbcd1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbcd1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b0e50,_0x9ee97,_0x3ddcb7){return new BPromise(function(_0x286956,_0x4d499a){return client[_0xbcd1('0xa')](_0x1b0e50,_0x3ddcb7)['then'](function(_0x4e4e3a){logger[_0xbcd1('0xb')](_0xbcd1('0xc'),_0x9ee97,_0xbcd1('0xd'));logger[_0xbcd1('0xe')](_0xbcd1('0xf'),_0x9ee97,_0xbcd1('0xd'),JSON[_0xbcd1('0x10')](_0x4e4e3a));if(_0x4e4e3a[_0xbcd1('0x11')]){if(_0x4e4e3a[_0xbcd1('0x11')]['code']===0x1f4){logger[_0xbcd1('0x11')](_0xbcd1('0xc'),_0x9ee97,_0x4e4e3a[_0xbcd1('0x11')][_0xbcd1('0x12')]);return _0x4d499a(_0x4e4e3a['error'][_0xbcd1('0x12')]);}logger[_0xbcd1('0x11')](_0xbcd1('0xc'),_0x9ee97,_0x4e4e3a[_0xbcd1('0x11')][_0xbcd1('0x12')]);return _0x286956(_0x4e4e3a[_0xbcd1('0x11')][_0xbcd1('0x12')]);}else{logger[_0xbcd1('0xb')](_0xbcd1('0xc'),_0x9ee97,'request\x20sent');_0x286956(_0x4e4e3a[_0xbcd1('0x13')][_0xbcd1('0x12')]);}})[_0xbcd1('0x14')](function(_0x19815b){logger[_0xbcd1('0x11')](_0xbcd1('0xc'),_0x9ee97,_0x19815b);_0x4d499a(_0x19815b);});});} \ No newline at end of file +var _0x096c=['then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x096c,0xff));var _0xc096=function(_0x38a4dd,_0x12d247){_0x38a4dd=_0x38a4dd-0x0;var _0x40d8b8=_0x096c[_0x38a4dd];return _0x40d8b8;};'use strict';var _=require('lodash');var util=require(_0xc096('0x0'));var moment=require(_0xc096('0x1'));var BPromise=require(_0xc096('0x2'));var rs=require(_0xc096('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc096('0x4'))['db'];var utils=require(_0xc096('0x5'));var logger=require(_0xc096('0x6'))(_0xc096('0x7'));var config=require(_0xc096('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc096('0x9')][_0xc096('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6ed1,_0x37a010,_0x32b789){return new BPromise(function(_0x558edb,_0x121553){return client['request'](_0x4a6ed1,_0x32b789)[_0xc096('0xb')](function(_0x3b6440){logger['info'](_0xc096('0xc'),_0x37a010,_0xc096('0xd'));logger[_0xc096('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x37a010,_0xc096('0xd'),JSON[_0xc096('0xf')](_0x3b6440));if(_0x3b6440[_0xc096('0x10')]){if(_0x3b6440[_0xc096('0x10')][_0xc096('0x11')]===0x1f4){logger['error'](_0xc096('0xc'),_0x37a010,_0x3b6440[_0xc096('0x10')][_0xc096('0x12')]);return _0x121553(_0x3b6440[_0xc096('0x10')][_0xc096('0x12')]);}logger[_0xc096('0x10')](_0xc096('0xc'),_0x37a010,_0x3b6440['error'][_0xc096('0x12')]);return _0x558edb(_0x3b6440[_0xc096('0x10')]['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x37a010,'request\x20sent');_0x558edb(_0x3b6440['result'][_0xc096('0x12')]);}})['catch'](function(_0x2d49f4){logger['error'](_0xc096('0xc'),_0x37a010,_0x2d49f4);_0x121553(_0x2d49f4);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 8441de3..e8f094c 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 _0xe254=['express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','path'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0xe254,0xad));var _0x4e25=function(_0x263ca9,_0x4c8ba0){_0x263ca9=_0x263ca9-0x0;var _0x318d2d=_0xe254[_0x263ca9];return _0x318d2d;};'use strict';var multer=require(_0x4e25('0x0'));var util=require('util');var path=require(_0x4e25('0x1'));var timeout=require('connect-timeout');var express=require(_0x4e25('0x2'));var router=express[_0x4e25('0x3')]();var auth=require(_0x4e25('0x4'));var interaction=require(_0x4e25('0x5'));var config=require('../../config/environment');module[_0x4e25('0x6')]=router; \ No newline at end of file +var _0x0b1a=['../../components/interaction/service','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2b8e2f,_0x998a4a){var _0x1ab69f=function(_0x73d264){while(--_0x73d264){_0x2b8e2f['push'](_0x2b8e2f['shift']());}};_0x1ab69f(++_0x998a4a);}(_0x0b1a,0x132));var _0xa0b1=function(_0x237ba5,_0xf18cee){_0x237ba5=_0x237ba5-0x0;var _0x3ca94d=_0x0b1a[_0x237ba5];return _0x3ca94d;};'use strict';var multer=require('multer');var util=require(_0xa0b1('0x0'));var path=require(_0xa0b1('0x1'));var timeout=require(_0xa0b1('0x2'));var express=require(_0xa0b1('0x3'));var router=express[_0xa0b1('0x4')]();var auth=require(_0xa0b1('0x5'));var interaction=require(_0xa0b1('0x6'));var config=require('../../config/environment');module[_0xa0b1('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c902df1..62b17b5 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 _0x5c00=['INTEGER','STRING','sequelize','exports'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0x5c00,0x17e));var _0x05c0=function(_0x1c5cd2,_0x277ceb){_0x1c5cd2=_0x1c5cd2-0x0;var _0x895e35=_0x5c00[_0x1c5cd2];return _0x895e35;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'penalty':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x05c0('0x3')]}}; \ No newline at end of file +var _0x8603=['exports','INTEGER'];(function(_0x2a146d,_0x582664){var _0x721361=function(_0x5df666){while(--_0x5df666){_0x2a146d['push'](_0x2a146d['shift']());}};_0x721361(++_0x582664);}(_0x8603,0x190));var _0x3860=function(_0x1ea8c0,_0x1b1409){_0x1ea8c0=_0x1ea8c0-0x0;var _0x2314ce=_0x8603[_0x1ea8c0];return _0x2314ce;};'use strict';var Sequelize=require('sequelize');module[_0x3860('0x0')]={'penalty':{'type':Sequelize[_0x3860('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3860('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index e66dc51..897f738 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(_0x3d8240,_0x2663d4){var _0x3d0372=function(_0xc47c6b){while(--_0xc47c6b){_0x3d8240['push'](_0x3d8240['shift']());}};_0x3d0372(++_0x2663d4);}(_0xb10b,0x12a));var _0xbb10=function(_0x512eb0,_0x27edfe){_0x512eb0=_0x512eb0-0x0;var _0x1378fe=_0xb10b[_0x512eb0];return _0x1378fe;};'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 _0xd8b0=['define','user_has_fax_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x53a35c,_0x3dcc7a){var _0x37d699=function(_0x3a477f){while(--_0x3a477f){_0x53a35c['push'](_0x53a35c['shift']());}};_0x37d699(++_0x3dcc7a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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('./userFaxQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserFaxQueue',attributes,{'tableName':_0x0d8b('0x8'),'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 c3b92bb..dd25aec 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 _0xc264=['jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc264,0x1a6));var _0x4c26=function(_0x1c206c,_0x30bdcf){_0x1c206c=_0x1c206c-0x0;var _0x188aaa=_0xc264[_0x1c206c];return _0x188aaa;};'use strict';var _=require(_0x4c26('0x0'));var util=require(_0x4c26('0x1'));var moment=require(_0x4c26('0x2'));var BPromise=require(_0x4c26('0x3'));var rs=require(_0x4c26('0x4'));var fs=require('fs');var Redis=require(_0x4c26('0x5'));var db=require(_0x4c26('0x6'))['db'];var utils=require(_0x4c26('0x7'));var logger=require(_0x4c26('0x8'))('rpc');var config=require(_0x4c26('0x9'));var jayson=require(_0x4c26('0xa'));var client=jayson[_0x4c26('0xb')][_0x4c26('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x208947,_0x54730d,_0x3c1a8f){return new BPromise(function(_0x4fabcd,_0x18e509){return client[_0x4c26('0xd')](_0x208947,_0x3c1a8f)[_0x4c26('0xe')](function(_0x46dcae){logger[_0x4c26('0xf')](_0x4c26('0x10'),_0x54730d,'request\x20sent');logger[_0x4c26('0x11')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x54730d,'request\x20sent',JSON[_0x4c26('0x12')](_0x46dcae));if(_0x46dcae[_0x4c26('0x13')]){if(_0x46dcae[_0x4c26('0x13')][_0x4c26('0x14')]===0x1f4){logger[_0x4c26('0x13')](_0x4c26('0x10'),_0x54730d,_0x46dcae['error'][_0x4c26('0x15')]);return _0x18e509(_0x46dcae[_0x4c26('0x13')][_0x4c26('0x15')]);}logger[_0x4c26('0x13')](_0x4c26('0x10'),_0x54730d,_0x46dcae[_0x4c26('0x13')][_0x4c26('0x15')]);return _0x4fabcd(_0x46dcae['error'][_0x4c26('0x15')]);}else{logger['info'](_0x4c26('0x10'),_0x54730d,'request\x20sent');_0x4fabcd(_0x46dcae[_0x4c26('0x16')][_0x4c26('0x15')]);}})[_0x4c26('0x17')](function(_0x434e2a){logger[_0x4c26('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x54730d,_0x434e2a);_0x18e509(_0x434e2a);});});} \ No newline at end of file +var _0x2d8e=['info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0xa72cf,_0x24a05c){var _0x263735=function(_0x21b2ae){while(--_0x21b2ae){_0xa72cf['push'](_0xa72cf['shift']());}};_0x263735(++_0x24a05c);}(_0x2d8e,0x17a));var _0xe2d8=function(_0x429370,_0x46ff4c){_0x429370=_0x429370-0x0;var _0x41a3ad=_0x2d8e[_0x429370];return _0x41a3ad;};'use strict';var _=require(_0xe2d8('0x0'));var util=require(_0xe2d8('0x1'));var moment=require(_0xe2d8('0x2'));var BPromise=require(_0xe2d8('0x3'));var rs=require(_0xe2d8('0x4'));var fs=require('fs');var Redis=require(_0xe2d8('0x5'));var db=require(_0xe2d8('0x6'))['db'];var utils=require(_0xe2d8('0x7'));var logger=require(_0xe2d8('0x8'))('rpc');var config=require(_0xe2d8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe2d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eaa11,_0x30b8e8,_0xa54798){return new BPromise(function(_0xdd1a00,_0x54bad0){return client[_0xe2d8('0xb')](_0x3eaa11,_0xa54798)[_0xe2d8('0xc')](function(_0x3c47d0){logger[_0xe2d8('0xd')](_0xe2d8('0xe'),_0x30b8e8,'request\x20sent');logger[_0xe2d8('0xf')](_0xe2d8('0x10'),_0x30b8e8,_0xe2d8('0x11'),JSON[_0xe2d8('0x12')](_0x3c47d0));if(_0x3c47d0[_0xe2d8('0x13')]){if(_0x3c47d0[_0xe2d8('0x13')][_0xe2d8('0x14')]===0x1f4){logger[_0xe2d8('0x13')](_0xe2d8('0xe'),_0x30b8e8,_0x3c47d0[_0xe2d8('0x13')][_0xe2d8('0x15')]);return _0x54bad0(_0x3c47d0[_0xe2d8('0x13')][_0xe2d8('0x15')]);}logger[_0xe2d8('0x13')](_0xe2d8('0xe'),_0x30b8e8,_0x3c47d0[_0xe2d8('0x13')][_0xe2d8('0x15')]);return _0xdd1a00(_0x3c47d0[_0xe2d8('0x13')][_0xe2d8('0x15')]);}else{logger[_0xe2d8('0xd')](_0xe2d8('0xe'),_0x30b8e8,_0xe2d8('0x11'));_0xdd1a00(_0x3c47d0['result']['message']);}})[_0xe2d8('0x16')](function(_0x38747c){logger[_0xe2d8('0x13')](_0xe2d8('0xe'),_0x30b8e8,_0x38747c);_0x54bad0(_0x38747c);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index eb1fd6d..3eedfe4 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 _0xb6c6=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x3748b0,_0x437de7){var _0x554fcd=function(_0x41ea38){while(--_0x41ea38){_0x3748b0['push'](_0x3748b0['shift']());}};_0x554fcd(++_0x437de7);}(_0xb6c6,0xf7));var _0x6b6c=function(_0x578bf5,_0x24b8d5){_0x578bf5=_0x578bf5-0x0;var _0x60f678=_0xb6c6[_0x578bf5];return _0x60f678;};'use strict';var multer=require(_0x6b6c('0x0'));var util=require(_0x6b6c('0x1'));var path=require(_0x6b6c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6b6c('0x3'));var router=express[_0x6b6c('0x4')]();var auth=require(_0x6b6c('0x5'));var interaction=require(_0x6b6c('0x6'));var config=require(_0x6b6c('0x7'));module['exports']=router; \ No newline at end of file +var _0x8b55=['connect-timeout','Router','../../components/auth/service','../../config/environment','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b55,0x154));var _0x58b5=function(_0x4aa902,_0xc6d1b4){_0x4aa902=_0x4aa902-0x0;var _0x2ec26f=_0x8b55[_0x4aa902];return _0x2ec26f;};'use strict';var multer=require(_0x58b5('0x0'));var util=require(_0x58b5('0x1'));var path=require(_0x58b5('0x2'));var timeout=require(_0x58b5('0x3'));var express=require('express');var router=express[_0x58b5('0x4')]();var auth=require(_0x58b5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x58b5('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 6e207f4..2b00fb0 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(_0x5b0d3f,_0xab2919){var _0xe597d0=function(_0x182802){while(--_0x182802){_0x5b0d3f['push'](_0x5b0d3f['shift']());}};_0xe597d0(++_0xab2919);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x4a6dd2,_0xfb5f96){var _0x5a51f7=function(_0x4ab679){while(--_0x4ab679){_0x4a6dd2['push'](_0x4a6dd2['shift']());}};_0x5a51f7(++_0xfb5f96);}(_0xe706,0xa3));var _0x6e70=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0xe706[_0x1d7037];return _0x4d6568;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 9424608..30477d4 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(_0x302fc4,_0x27b9ce){var _0x2e4c7d=function(_0x89ed4a){while(--_0x89ed4a){_0x302fc4['push'](_0x302fc4['shift']());}};_0x2e4c7d(++_0x27b9ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2d3635,_0x31c669){var _0x3ab168=function(_0x219890){while(--_0x219890){_0x2d3635['push'](_0x2d3635['shift']());}};_0x3ab168(++_0x31c669);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 923ebc7..6176bdb 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 _0xce27=['UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','UserMailQueue,\x20%s,\x20%s','debug'];(function(_0x5570cd,_0xace1a7){var _0x3f07b8=function(_0x3813f0){while(--_0x3813f0){_0x5570cd['push'](_0x5570cd['shift']());}};_0x3f07b8(++_0xace1a7);}(_0xce27,0xef));var _0x7ce2=function(_0x2937ec,_0x26f651){_0x2937ec=_0x2937ec-0x0;var _0x3ccece=_0xce27[_0x2937ec];return _0x3ccece;};'use strict';var _=require(_0x7ce2('0x0'));var util=require(_0x7ce2('0x1'));var moment=require(_0x7ce2('0x2'));var BPromise=require(_0x7ce2('0x3'));var rs=require(_0x7ce2('0x4'));var fs=require('fs');var Redis=require(_0x7ce2('0x5'));var db=require(_0x7ce2('0x6'))['db'];var utils=require(_0x7ce2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7ce2('0x8'));var jayson=require(_0x7ce2('0x9'));var client=jayson[_0x7ce2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eacb4,_0x1eb216,_0x258865){return new BPromise(function(_0x5ad6df,_0x23f9a2){return client[_0x7ce2('0xb')](_0x5eacb4,_0x258865)['then'](function(_0x27d952){logger['info'](_0x7ce2('0xc'),_0x1eb216,'request\x20sent');logger[_0x7ce2('0xd')](_0x7ce2('0xe'),_0x1eb216,_0x7ce2('0xf'),JSON[_0x7ce2('0x10')](_0x27d952));if(_0x27d952[_0x7ce2('0x11')]){if(_0x27d952[_0x7ce2('0x11')][_0x7ce2('0x12')]===0x1f4){logger[_0x7ce2('0x11')](_0x7ce2('0xc'),_0x1eb216,_0x27d952['error'][_0x7ce2('0x13')]);return _0x23f9a2(_0x27d952['error'][_0x7ce2('0x13')]);}logger[_0x7ce2('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x1eb216,_0x27d952[_0x7ce2('0x11')][_0x7ce2('0x13')]);return _0x5ad6df(_0x27d952[_0x7ce2('0x11')][_0x7ce2('0x13')]);}else{logger[_0x7ce2('0x14')](_0x7ce2('0xc'),_0x1eb216,_0x7ce2('0xf'));_0x5ad6df(_0x27d952[_0x7ce2('0x15')][_0x7ce2('0x13')]);}})[_0x7ce2('0x16')](function(_0x45c8d8){logger[_0x7ce2('0x11')](_0x7ce2('0xc'),_0x1eb216,_0x45c8d8);_0x23f9a2(_0x45c8d8);});});} \ No newline at end of file +var _0x35f5=['ioredis','rpc','../../config/environment','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x4d692a,_0x5c1506){var _0x9ef565=function(_0x2e17c8){while(--_0x2e17c8){_0x4d692a['push'](_0x4d692a['shift']());}};_0x9ef565(++_0x5c1506);}(_0x35f5,0x100));var _0x535f=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x35f5[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x535f('0x0'));var util=require('util');var moment=require(_0x535f('0x1'));var BPromise=require(_0x535f('0x2'));var rs=require(_0x535f('0x3'));var fs=require('fs');var Redis=require(_0x535f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x535f('0x5'));var config=require(_0x535f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x535f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a137,_0x14c55b,_0x4b3440){return new BPromise(function(_0x30802d,_0x4cc7b6){return client[_0x535f('0x8')](_0x24a137,_0x4b3440)[_0x535f('0x9')](function(_0x41e216){logger[_0x535f('0xa')](_0x535f('0xb'),_0x14c55b,_0x535f('0xc'));logger[_0x535f('0xd')](_0x535f('0xe'),_0x14c55b,'request\x20sent',JSON[_0x535f('0xf')](_0x41e216));if(_0x41e216[_0x535f('0x10')]){if(_0x41e216[_0x535f('0x10')][_0x535f('0x11')]===0x1f4){logger[_0x535f('0x10')](_0x535f('0xb'),_0x14c55b,_0x41e216['error'][_0x535f('0x12')]);return _0x4cc7b6(_0x41e216['error']['message']);}logger[_0x535f('0x10')](_0x535f('0xb'),_0x14c55b,_0x41e216[_0x535f('0x10')]['message']);return _0x30802d(_0x41e216['error'][_0x535f('0x12')]);}else{logger['info'](_0x535f('0xb'),_0x14c55b,_0x535f('0xc'));_0x30802d(_0x41e216['result']['message']);}})[_0x535f('0x13')](function(_0x571289){logger[_0x535f('0x10')](_0x535f('0xb'),_0x14c55b,_0x571289);_0x4cc7b6(_0x571289);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 3b6bdb4..d61403f 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 _0xaecd=['util','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x167f24,_0x2f5452){var _0x321f97=function(_0x24313d){while(--_0x24313d){_0x167f24['push'](_0x167f24['shift']());}};_0x321f97(++_0x2f5452);}(_0xaecd,0xfa));var _0xdaec=function(_0x487bcc,_0x3ac993){_0x487bcc=_0x487bcc-0x0;var _0x370aa2=_0xaecd[_0x487bcc];return _0x370aa2;};'use strict';var multer=require('multer');var util=require(_0xdaec('0x0'));var path=require(_0xdaec('0x1'));var timeout=require(_0xdaec('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xdaec('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdaec('0x4'));module['exports']=router; \ No newline at end of file +var _0x85f6=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path'];(function(_0x1b2f77,_0x502ded){var _0x2fc6a6=function(_0x36c504){while(--_0x36c504){_0x1b2f77['push'](_0x1b2f77['shift']());}};_0x2fc6a6(++_0x502ded);}(_0x85f6,0x1ad));var _0x685f=function(_0x55864c,_0x7622b6){_0x55864c=_0x55864c-0x0;var _0x281b0e=_0x85f6[_0x55864c];return _0x281b0e;};'use strict';var multer=require(_0x685f('0x0'));var util=require(_0x685f('0x1'));var path=require(_0x685f('0x2'));var timeout=require(_0x685f('0x3'));var express=require(_0x685f('0x4'));var router=express[_0x685f('0x5')]();var auth=require(_0x685f('0x6'));var interaction=require(_0x685f('0x7'));var config=require('../../config/environment');module[_0x685f('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 869e6bc..c389982 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x10bd3d,_0x478dfb){var _0x48d6fd=function(_0xdf597f){while(--_0xdf597f){_0x10bd3d['push'](_0x10bd3d['shift']());}};_0x48d6fd(++_0x478dfb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index a4fb9db..9ead5af 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 _0xaff2=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xaff2,0x18c));var _0x2aff=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xaff2[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2aff('0x0'))(_0x2aff('0x1'));var moment=require(_0x2aff('0x2'));var BPromise=require(_0x2aff('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2aff('0x4'));var rimraf=require(_0x2aff('0x5'));var config=require(_0x2aff('0x6'));var attributes=require(_0x2aff('0x7'));module[_0x2aff('0x8')]=function(_0x3b0a1c,_0x2cc279){return _0x3b0a1c[_0x2aff('0x9')](_0x2aff('0xa'),attributes,{'tableName':_0x2aff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2203=['bluebird','request-promise','path','rimraf','../../config/environment','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x5d990e,_0x4ba9f5){var _0x36c763=function(_0x52270c){while(--_0x52270c){_0x5d990e['push'](_0x5d990e['shift']());}};_0x36c763(++_0x4ba9f5);}(_0x2203,0x1c1));var _0x3220=function(_0x18ee80,_0x2adf1c){_0x18ee80=_0x18ee80-0x0;var _0x2f60c2=_0x2203[_0x18ee80];return _0x2f60c2;};'use strict';var _=require(_0x3220('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3220('0x1'));var rp=require(_0x3220('0x2'));var fs=require('fs');var path=require(_0x3220('0x3'));var rimraf=require(_0x3220('0x4'));var config=require(_0x3220('0x5'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x2a4a55,_0x45ed46){return _0x2a4a55[_0x3220('0x6')](_0x3220('0x7'),attributes,{'tableName':_0x3220('0x8'),'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 6bb70bf..2c89048 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 _0x4ff0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','lodash'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4ff0,0xbc));var _0x04ff=function(_0x2fe75b,_0x293f4d){_0x2fe75b=_0x2fe75b-0x0;var _0x935b21=_0x4ff0[_0x2fe75b];return _0x935b21;};'use strict';var _=require(_0x04ff('0x0'));var util=require('util');var moment=require(_0x04ff('0x1'));var BPromise=require(_0x04ff('0x2'));var rs=require(_0x04ff('0x3'));var fs=require('fs');var Redis=require(_0x04ff('0x4'));var db=require(_0x04ff('0x5'))['db'];var utils=require(_0x04ff('0x6'));var logger=require('../../config/logger')(_0x04ff('0x7'));var config=require('../../config/environment');var jayson=require(_0x04ff('0x8'));var client=jayson[_0x04ff('0x9')][_0x04ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x425fdb,_0x6a7a28,_0x45e9c0){return new BPromise(function(_0x3b72f0,_0x4754ad){return client[_0x04ff('0xb')](_0x425fdb,_0x45e9c0)[_0x04ff('0xc')](function(_0x3fead4){logger[_0x04ff('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x6a7a28,_0x04ff('0xe'));logger[_0x04ff('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x6a7a28,_0x04ff('0xe'),JSON[_0x04ff('0x10')](_0x3fead4));if(_0x3fead4[_0x04ff('0x11')]){if(_0x3fead4['error'][_0x04ff('0x12')]===0x1f4){logger[_0x04ff('0x11')](_0x04ff('0x13'),_0x6a7a28,_0x3fead4['error'][_0x04ff('0x14')]);return _0x4754ad(_0x3fead4[_0x04ff('0x11')]['message']);}logger[_0x04ff('0x11')](_0x04ff('0x13'),_0x6a7a28,_0x3fead4[_0x04ff('0x11')][_0x04ff('0x14')]);return _0x3b72f0(_0x3fead4['error']['message']);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x6a7a28,_0x04ff('0xe'));_0x3b72f0(_0x3fead4['result'][_0x04ff('0x14')]);}})['catch'](function(_0x16226c){logger[_0x04ff('0x11')](_0x04ff('0x13'),_0x6a7a28,_0x16226c);_0x4754ad(_0x16226c);});});} \ No newline at end of file +var _0xff1d=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis'];(function(_0x485907,_0x47224d){var _0x3ed143=function(_0x12e968){while(--_0x12e968){_0x485907['push'](_0x485907['shift']());}};_0x3ed143(++_0x47224d);}(_0xff1d,0x188));var _0xdff1=function(_0x3602c7,_0x5aec63){_0x3602c7=_0x3602c7-0x0;var _0x3afb86=_0xff1d[_0x3602c7];return _0x3afb86;};'use strict';var _=require(_0xdff1('0x0'));var util=require(_0xdff1('0x1'));var moment=require('moment');var BPromise=require(_0xdff1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdff1('0x3'));var db=require(_0xdff1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdff1('0x5'))('rpc');var config=require(_0xdff1('0x6'));var jayson=require(_0xdff1('0x7'));var client=jayson['client'][_0xdff1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x523e59,_0x42651f,_0x15dc29){return new BPromise(function(_0x1c225e,_0x575a45){return client[_0xdff1('0x9')](_0x523e59,_0x15dc29)[_0xdff1('0xa')](function(_0x58b511){logger[_0xdff1('0xb')](_0xdff1('0xc'),_0x42651f,_0xdff1('0xd'));logger[_0xdff1('0xe')](_0xdff1('0xf'),_0x42651f,_0xdff1('0xd'),JSON[_0xdff1('0x10')](_0x58b511));if(_0x58b511['error']){if(_0x58b511[_0xdff1('0x11')][_0xdff1('0x12')]===0x1f4){logger[_0xdff1('0x11')](_0xdff1('0xc'),_0x42651f,_0x58b511[_0xdff1('0x11')][_0xdff1('0x13')]);return _0x575a45(_0x58b511[_0xdff1('0x11')][_0xdff1('0x13')]);}logger[_0xdff1('0x11')](_0xdff1('0xc'),_0x42651f,_0x58b511[_0xdff1('0x11')][_0xdff1('0x13')]);return _0x1c225e(_0x58b511['error'][_0xdff1('0x13')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x42651f,'request\x20sent');_0x1c225e(_0x58b511[_0xdff1('0x14')][_0xdff1('0x13')]);}})[_0xdff1('0x15')](function(_0x734545){logger[_0xdff1('0x11')](_0xdff1('0xc'),_0x42651f,_0x734545);_0x575a45(_0x734545);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 4273d7d..077bbb2 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 _0xb7db=['get','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index'];(function(_0x256ce7,_0x3a602b){var _0x7bab9e=function(_0x2a9568){while(--_0x2a9568){_0x256ce7['push'](_0x256ce7['shift']());}};_0x7bab9e(++_0x3a602b);}(_0xb7db,0xac));var _0xbb7d=function(_0x495d33,_0x4acb6f){_0x495d33=_0x495d33-0x0;var _0x2436b1=_0xb7db[_0x495d33];return _0x2436b1;};'use strict';var multer=require('multer');var util=require(_0xbb7d('0x0'));var path=require(_0xbb7d('0x1'));var timeout=require(_0xbb7d('0x2'));var express=require(_0xbb7d('0x3'));var router=express[_0xbb7d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbb7d('0x5'));var config=require(_0xbb7d('0x6'));var controller=require(_0xbb7d('0x7'));router['get']('/',auth[_0xbb7d('0x8')](),controller[_0xbb7d('0x9')]);router[_0xbb7d('0xa')]('/describe',auth[_0xbb7d('0x8')](),controller[_0xbb7d('0xb')]);router[_0xbb7d('0xa')]('/:id',auth[_0xbb7d('0x8')](),controller[_0xbb7d('0xc')]);router['get'](_0xbb7d('0xd'),auth[_0xbb7d('0x8')](),controller[_0xbb7d('0xe')]);router[_0xbb7d('0xa')](_0xbb7d('0xf'),auth[_0xbb7d('0x8')](),controller[_0xbb7d('0x10')]);router[_0xbb7d('0x11')]('/',auth[_0xbb7d('0x8')](),controller[_0xbb7d('0x12')]);router[_0xbb7d('0x11')](_0xbb7d('0x13'),auth[_0xbb7d('0x8')](),controller['clone']);router[_0xbb7d('0x11')](_0xbb7d('0xd'),auth[_0xbb7d('0x8')](),controller[_0xbb7d('0x14')]);router[_0xbb7d('0x11')](_0xbb7d('0xf'),auth['isAuthenticated'](),controller[_0xbb7d('0x15')]);router['put'](_0xbb7d('0x16'),auth[_0xbb7d('0x8')](),controller[_0xbb7d('0x17')]);router[_0xbb7d('0x18')](_0xbb7d('0x16'),auth[_0xbb7d('0x8')](),controller[_0xbb7d('0x19')]);router[_0xbb7d('0x18')](_0xbb7d('0xd'),auth['isAuthenticated'](),controller['removeSections']);router[_0xbb7d('0x18')](_0xbb7d('0xf'),auth[_0xbb7d('0x8')](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0x8205=['/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','/:id','update','delete','destroy','removeSections','removeResources','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfile.controller','isAuthenticated','index','/describe','show','get','/:id/sections','getSections'];(function(_0x191c44,_0x20a896){var _0x1086cd=function(_0x2e2cac){while(--_0x2e2cac){_0x191c44['push'](_0x191c44['shift']());}};_0x1086cd(++_0x20a896);}(_0x8205,0x1b3));var _0x5820=function(_0x4d7908,_0x3d5ebc){_0x4d7908=_0x4d7908-0x0;var _0xaa313e=_0x8205[_0x4d7908];return _0xaa313e;};'use strict';var multer=require(_0x5820('0x0'));var util=require(_0x5820('0x1'));var path=require(_0x5820('0x2'));var timeout=require(_0x5820('0x3'));var express=require('express');var router=express[_0x5820('0x4')]();var auth=require(_0x5820('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5820('0x6'));var controller=require(_0x5820('0x7'));router['get']('/',auth[_0x5820('0x8')](),controller[_0x5820('0x9')]);router['get'](_0x5820('0xa'),auth[_0x5820('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5820('0xb')]);router[_0x5820('0xc')](_0x5820('0xd'),auth[_0x5820('0x8')](),controller[_0x5820('0xe')]);router[_0x5820('0xc')](_0x5820('0xf'),auth[_0x5820('0x8')](),controller[_0x5820('0x10')]);router[_0x5820('0x11')]('/',auth[_0x5820('0x8')](),controller[_0x5820('0x12')]);router[_0x5820('0x11')](_0x5820('0x13'),auth['isAuthenticated'](),controller[_0x5820('0x14')]);router[_0x5820('0x11')](_0x5820('0xd'),auth[_0x5820('0x8')](),controller[_0x5820('0x15')]);router[_0x5820('0x11')]('/:id/resources',auth[_0x5820('0x8')](),controller[_0x5820('0x16')]);router[_0x5820('0x17')](_0x5820('0x18'),auth['isAuthenticated'](),controller[_0x5820('0x19')]);router[_0x5820('0x1a')]('/:id',auth[_0x5820('0x8')](),controller[_0x5820('0x1b')]);router[_0x5820('0x1a')](_0x5820('0xd'),auth['isAuthenticated'](),controller[_0x5820('0x1c')]);router[_0x5820('0x1a')](_0x5820('0xf'),auth[_0x5820('0x8')](),controller[_0x5820('0x1d')]);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 0056cf7..e696bda 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 _0x4704=['crudPermissions','getDataValue','sequelize','STRING','name','setDataValue'];(function(_0xd12b8d,_0x503b2){var _0x1132e3=function(_0x3176dc){while(--_0x3176dc){_0xd12b8d['push'](_0xd12b8d['shift']());}};_0x1132e3(++_0x503b2);}(_0x4704,0x19a));var _0x4470=function(_0xc471d2,_0x26ab16){_0xc471d2=_0xc471d2-0x0;var _0x334c68=_0x4704[_0xc471d2];return _0x334c68;};'use strict';var Sequelize=require(_0x4470('0x0'));module['exports']={'name':{'type':Sequelize[_0x4470('0x1')],'allowNull':![],'unique':_0x4470('0x2')},'crudPermissions':{'type':Sequelize[_0x4470('0x1')],'set':function(_0x388b71){this[_0x4470('0x3')](_0x4470('0x4'),_0x388b71?_0x388b71['join'](''):[]);},'get':function(){return this[_0x4470('0x5')]('crudPermissions')?this[_0x4470('0x5')](_0x4470('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4470('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8efe=['crudPermissions','getDataValue','exports','STRING','name','setDataValue'];(function(_0x4b3ec4,_0x3c573c){var _0x192836=function(_0x498cc0){while(--_0x498cc0){_0x4b3ec4['push'](_0x4b3ec4['shift']());}};_0x192836(++_0x3c573c);}(_0x8efe,0x1e2));var _0xe8ef=function(_0x54d751,_0x21e3ee){_0x54d751=_0x54d751-0x0;var _0x392125=_0x8efe[_0x54d751];return _0x392125;};'use strict';var Sequelize=require('sequelize');module[_0xe8ef('0x0')]={'name':{'type':Sequelize[_0xe8ef('0x1')],'allowNull':![],'unique':_0xe8ef('0x2')},'crudPermissions':{'type':Sequelize[_0xe8ef('0x1')],'set':function(_0x38e63d){this[_0xe8ef('0x3')](_0xe8ef('0x4'),_0x38e63d?_0x38e63d['join'](''):[]);},'get':function(){return this[_0xe8ef('0x5')]('crudPermissions')?this[_0xe8ef('0x5')](_0xe8ef('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe8ef('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 9292b3d..c9046b2 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 _0x373f=['triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','metrics','AnalyticMetric','whatsappaccounts','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','catch','length','options','create','body','createdAt','updatedAt','omit','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','find','destroy','describe','addSections','params','each','push','get','removeSections','getSections','includes','subsections','enabled','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','undefined','Sequelize','Unknown\x20section','ValidationError','Invalid\x20section\x20\x27','isEmpty','parentSections','all','ignore','union','childModel','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','DefaultReports','reportId','CustomReports','CmContact','Tag','Tags','ThroughTags','color','tag','rows','value','toLowerCase','squareprojects','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','VoiceQueues','VoiceQueue','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','Team','voicequeues','users','Users','admin','user','salesforceaccounts','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','templates','Template'];(function(_0x17a781,_0x1dcf27){var _0x279db2=function(_0x32a614){while(--_0x32a614){_0x17a781['push'](_0x17a781['shift']());}};_0x279db2(++_0x1dcf27);}(_0x373f,0xfd));var _0xf373=function(_0x5430d5,_0x484426){_0x5430d5=_0x5430d5-0x0;var _0x1e6f03=_0x373f[_0x5430d5];return _0x1e6f03;};'use strict';var pdf=require(_0xf373('0x0'));var emlformat=require(_0xf373('0x1'));var rimraf=require(_0xf373('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf373('0x3'));var rp=require(_0xf373('0x4'));var moment=require(_0xf373('0x5'));var BPromise=require(_0xf373('0x6'));var Mustache=require(_0xf373('0x7'));var util=require('util');var path=require(_0xf373('0x8'));var sox=require(_0xf373('0x9'));var csv=require(_0xf373('0xa'));var ejs=require(_0xf373('0xb'));var fs=require('fs');var _=require(_0xf373('0xc'));var squel=require('squel');var crypto=require(_0xf373('0xd'));var jsforce=require(_0xf373('0xe'));var deskjs=require(_0xf373('0xf'));var toCsv=require(_0xf373('0xa'));var querystring=require(_0xf373('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf373('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf373('0x12'));var hardwareService=require(_0xf373('0x13'));var logger=require(_0xf373('0x14'))(_0xf373('0x15'));var utils=require(_0xf373('0x16'));var config=require(_0xf373('0x17'));var db=require(_0xf373('0x18'))['db'];config[_0xf373('0x19')]=_[_0xf373('0x1a')](config[_0xf373('0x19')],{'host':_0xf373('0x1b'),'port':0x18eb});var socket=require(_0xf373('0x1c'))(new Redis(config['redis']));require(_0xf373('0x1d'))['register'](socket);function respondWithStatusCode(_0x20d4cf,_0x3243af){_0x3243af=_0x3243af||0xcc;return function(_0x413b2e){if(_0x413b2e){return _0x20d4cf['sendStatus'](_0x3243af);}return _0x20d4cf[_0xf373('0x1e')](_0x3243af)[_0xf373('0x1f')]();};}function respondWithResult(_0x2a2ab0,_0x14080f){_0x14080f=_0x14080f||0xc8;return function(_0x55d409){if(_0x55d409){return _0x2a2ab0[_0xf373('0x1e')](_0x14080f)[_0xf373('0x20')](_0x55d409);}};}function respondWithFilteredResult(_0x9edda0,_0x5dfc82){return function(_0x27bec3){if(_0x27bec3){var _0xd9e2a2=_0x27bec3['count'],_0x1c0780=_0x5dfc82[_0xf373('0x21')],_0x35763b=_0x5dfc82[_0xf373('0x21')]+_0x5dfc82[_0xf373('0x22')],_0x51cb14;if(_0x35763b>=_0xd9e2a2){_0x35763b=_0xd9e2a2;_0x51cb14=0xc8;}else{_0x51cb14=0xce;}_0x9edda0[_0xf373('0x1e')](_0x51cb14);return _0x9edda0[_0xf373('0x23')](_0xf373('0x24'),_0x1c0780+'-'+_0x35763b+'/'+_0xd9e2a2)['json'](_0x27bec3);}return null;};}function patchUpdates(_0x49fafb){return function(_0x31301b){try{jsonpatch[_0xf373('0x25')](_0x31301b,_0x49fafb,!![]);}catch(_0x3177a7){return BPromise[_0xf373('0x26')](_0x3177a7);}return _0x31301b['save']();};}function saveUpdates(_0x4a9078,_0x19f99d){return function(_0x4be25b){if(_0x4be25b){return _0x4be25b[_0xf373('0x27')](_0x4a9078)[_0xf373('0x28')](function(_0x4a937b){return _0x4a937b;});}return null;};}function removeEntity(_0x24b6d4,_0x2ad8c6){return function(_0x59cc9c){if(_0x59cc9c){return _0x59cc9c['destroy']()[_0xf373('0x28')](function(){_0x24b6d4[_0xf373('0x1e')](0xcc)[_0xf373('0x1f')]();});}};}function handleEntityNotFound(_0x335430,_0x3e5279){return function(_0x230973){if(!_0x230973){_0x335430[_0xf373('0x29')](0x194);}return _0x230973;};}function handleError(_0x184585,_0x3a3d9c){_0x3a3d9c=_0x3a3d9c||0x1f4;return function(_0x1492d3){logger[_0xf373('0x2a')](_0x1492d3[_0xf373('0x2b')]);if(_0x1492d3[_0xf373('0x2c')]){delete _0x1492d3[_0xf373('0x2c')];}_0x184585[_0xf373('0x1e')](_0x3a3d9c)['send'](_0x1492d3);};}exports[_0xf373('0x2d')]=function(_0x11fda9,_0x3d4cd1){var _0x1ce590={},_0x111476={},_0x591f04={'count':0x0,'rows':[]};var _0x44bc73=_[_0xf373('0x2e')](db[_0xf373('0x2f')][_0xf373('0x30')],function(_0x30bad9){return{'name':_0x30bad9[_0xf373('0x31')],'type':_0x30bad9['type'][_0xf373('0x32')]};});_0x111476[_0xf373('0x33')]=_[_0xf373('0x2e')](_0x44bc73,_0xf373('0x2c'));_0x111476[_0xf373('0x34')]=_[_0xf373('0x35')](_0x11fda9[_0xf373('0x34')]);_0x111476['filters']=_[_0xf373('0x36')](_0x111476[_0xf373('0x33')],_0x111476[_0xf373('0x34')]);_0x1ce590[_0xf373('0x37')]=_[_0xf373('0x36')](_0x111476[_0xf373('0x33')],qs[_0xf373('0x38')](_0x11fda9[_0xf373('0x34')][_0xf373('0x38')]));_0x1ce590['attributes']=_0x1ce590['attributes']['length']?_0x1ce590[_0xf373('0x37')]:_0x111476[_0xf373('0x33')];if(!_0x11fda9['query']['hasOwnProperty'](_0xf373('0x39'))){_0x1ce590['limit']=qs[_0xf373('0x22')](_0x11fda9['query'][_0xf373('0x22')]);_0x1ce590[_0xf373('0x21')]=qs[_0xf373('0x21')](_0x11fda9[_0xf373('0x34')][_0xf373('0x21')]);}_0x1ce590[_0xf373('0x3a')]=qs[_0xf373('0x3b')](_0x11fda9[_0xf373('0x34')]['sort']);_0x1ce590[_0xf373('0x3c')]=qs[_0xf373('0x3d')](_[_0xf373('0x3e')](_0x11fda9[_0xf373('0x34')],_0x111476[_0xf373('0x3d')]),_0x44bc73);if(_0x11fda9[_0xf373('0x34')][_0xf373('0x3f')]){_0x1ce590[_0xf373('0x3c')]=_[_0xf373('0x40')](_0x1ce590[_0xf373('0x3c')],{'$or':_[_0xf373('0x2e')](_0x44bc73,function(_0x3fa9d4){if(_0x3fa9d4[_0xf373('0x41')]!==_0xf373('0x42')){var _0x569a38={};_0x569a38[_0x3fa9d4[_0xf373('0x2c')]]={'$like':'%'+_0x11fda9['query'][_0xf373('0x3f')]+'%'};return _0x569a38;}})});}_0x1ce590=_[_0xf373('0x40')]({},_0x1ce590,_0x11fda9['options']);var _0x3ad8fe={'where':_0x1ce590[_0xf373('0x3c')]};return db['UserProfile'][_0xf373('0x43')](_0x3ad8fe)[_0xf373('0x28')](function(_0x211c19){_0x591f04['count']=_0x211c19;if(_0x11fda9[_0xf373('0x34')][_0xf373('0x44')]){_0x1ce590[_0xf373('0x45')]=[{'all':!![]}];}return db[_0xf373('0x2f')][_0xf373('0x46')](_0x1ce590);})[_0xf373('0x28')](function(_0x1f710a){_0x591f04['rows']=_0x1f710a;return _0x591f04;})['then'](respondWithFilteredResult(_0x3d4cd1,_0x1ce590))[_0xf373('0x47')](handleError(_0x3d4cd1,null));};exports['show']=function(_0x27f35b,_0x50bc6b){var _0x1b2d86={'raw':![],'where':{'id':_0x27f35b['params']['id']}},_0x1908b4={};_0x1908b4[_0xf373('0x33')]=_[_0xf373('0x35')](db[_0xf373('0x2f')][_0xf373('0x30')]);_0x1908b4[_0xf373('0x34')]=_['keys'](_0x27f35b['query']);_0x1908b4['filters']=_['intersection'](_0x1908b4[_0xf373('0x33')],_0x1908b4[_0xf373('0x34')]);_0x1b2d86[_0xf373('0x37')]=_[_0xf373('0x36')](_0x1908b4[_0xf373('0x33')],qs[_0xf373('0x38')](_0x27f35b['query'][_0xf373('0x38')]));_0x1b2d86['attributes']=_0x1b2d86[_0xf373('0x37')][_0xf373('0x48')]?_0x1b2d86['attributes']:_0x1908b4[_0xf373('0x33')];if(_0x27f35b[_0xf373('0x34')][_0xf373('0x44')]){_0x1b2d86[_0xf373('0x45')]=[{'all':!![]}];}_0x1b2d86=_[_0xf373('0x40')]({},_0x1b2d86,_0x27f35b[_0xf373('0x49')]);return db['UserProfile']['find'](_0x1b2d86)[_0xf373('0x28')](handleEntityNotFound(_0x50bc6b,null))[_0xf373('0x28')](respondWithResult(_0x50bc6b,null))['catch'](handleError(_0x50bc6b,null));};exports[_0xf373('0x4a')]=function(_0x3706bf,_0x3ca490){return db[_0xf373('0x2f')][_0xf373('0x4a')](_0x3706bf[_0xf373('0x4b')],{})[_0xf373('0x28')](respondWithResult(_0x3ca490,0xc9))[_0xf373('0x47')](handleError(_0x3ca490,null));};exports['clone']=function(_0x170fd4,_0x210b31){var _0x393817={'where':{'id':_0x170fd4['params']['id']}},_0x3b7a4c={};_0x3b7a4c[_0xf373('0x33')]=_[_0xf373('0x35')](db[_0xf373('0x2f')]['rawAttributes']);_0x393817['attributes']=_[_0xf373('0x36')](_0x3b7a4c[_0xf373('0x33')],qs['fields'](_0x170fd4['query'][_0xf373('0x38')]));_0x393817['attributes']=_0x393817[_0xf373('0x37')]['length']?_0x393817['attributes']:_0x3b7a4c['model'];if(_0x170fd4[_0xf373('0x34')][_0xf373('0x44')]){_0x393817[_0xf373('0x45')]=[{'all':!![]}];}_0x393817=_[_0xf373('0x40')]({},_0x393817,_0x170fd4[_0xf373('0x49')]);return db['UserProfile']['find'](_0x393817)[_0xf373('0x28')](handleEntityNotFound(_0x210b31,null))[_0xf373('0x28')](function(_0x219ce5){if(_0x219ce5){var _0xf2dac=_0x219ce5['get']({'plain':!![]});_0xf2dac=qs['omit'](_0xf2dac,['id',_0xf373('0x4c'),_0xf373('0x4d'),'crudPermissions']);_0x170fd4[_0xf373('0x4b')]=_[_0xf373('0x4e')](_0x170fd4[_0xf373('0x4b')],['id',_0xf373('0x4c'),'updatedAt']);return db[_0xf373('0x4f')][_0xf373('0x50')](function(_0x24ae20){return db[_0xf373('0x2f')][_0xf373('0x4a')](_[_0xf373('0x40')](_0xf2dac,_0x170fd4[_0xf373('0x4b')]),{'include':_0x170fd4[_0xf373('0x34')][_0xf373('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x24ae20})[_0xf373('0x28')](function(_0x218cb7){var _0x1d68b0=_0x218cb7['get']({'plain':!![]});return db[_0xf373('0x51')][_0xf373('0x46')]({'where':{'userProfileId':_0x170fd4['params']['id']},'raw':!![]})[_0xf373('0x28')](function(_0x3580af){if(_0x3580af){return BPromise['each'](_0x3580af,function(_0x126715){return new BPromise(function(_0xcccf63,_0x597ef3){if(_0x126715[_0xf373('0x52')]===null||_0x126715[_0xf373('0x52')]===0x1)_0xcccf63(null);return db[_0xf373('0x53')][_0xf373('0x46')]({'where':{'sectionId':_0x126715['id']},'raw':!![]})[_0xf373('0x28')](function(_0x2a7887){var _0x556ac7=_[_0xf373('0x2e')](_0x2a7887,function(_0xbee9ea){return qs[_0xf373('0x4e')](_0xbee9ea,['id',_0xf373('0x4c'),'updatedAt',_0xf373('0x54')]);});_0xcccf63(_0x556ac7);})['catch'](function(_0x45e7ab){_0x597ef3(_0x45e7ab);});})[_0xf373('0x28')](function(_0x26490f){var _0x29b8d5=qs[_0xf373('0x4e')](_0x126715,['id',_0xf373('0x4c'),_0xf373('0x4d')]);_0x29b8d5[_0xf373('0x55')]=_0x1d68b0['id'];if(_0x26490f)_0x29b8d5[_0xf373('0x56')]=_0x26490f;return _0x29b8d5;})[_0xf373('0x28')](function(_0x956167){return db[_0xf373('0x51')]['create'](_0x956167,{'include':[{'model':db[_0xf373('0x53')],'as':_0xf373('0x56')}],'raw':!![],'transaction':_0x24ae20});});})[_0xf373('0x28')](function(){return _0x1d68b0;});}});});});}})[_0xf373('0x28')](respondWithResult(_0x210b31,0xc9))['catch'](handleError(_0x210b31,null));};exports[_0xf373('0x27')]=function(_0x95265,_0x4b74ad){if(_0x95265[_0xf373('0x4b')]['id']){delete _0x95265[_0xf373('0x4b')]['id'];}return db[_0xf373('0x2f')][_0xf373('0x57')]({'where':{'id':_0x95265['params']['id']}})['then'](handleEntityNotFound(_0x4b74ad,null))[_0xf373('0x28')](saveUpdates(_0x95265[_0xf373('0x4b')],null))[_0xf373('0x28')](respondWithResult(_0x4b74ad,null))[_0xf373('0x47')](handleError(_0x4b74ad,null));};exports[_0xf373('0x58')]=function(_0x37e2c6,_0x1679b6){return db[_0xf373('0x2f')][_0xf373('0x57')]({'where':{'id':_0x37e2c6['params']['id']}})['then'](handleEntityNotFound(_0x1679b6,null))[_0xf373('0x28')](removeEntity(_0x1679b6,null))['catch'](handleError(_0x1679b6,null));};exports[_0xf373('0x59')]=function(_0x6e193d,_0x57d8c6){return db[_0xf373('0x2f')]['describe']()[_0xf373('0x28')](respondWithResult(_0x57d8c6,null))['catch'](handleError(_0x57d8c6,null));};exports[_0xf373('0x5a')]=function(_0x47be40,_0x33b9ad){var _0x453e20=_0x47be40[_0xf373('0x4b')];return db[_0xf373('0x2f')][_0xf373('0x57')]({'where':{'id':_0x47be40[_0xf373('0x5b')]['id']}})[_0xf373('0x28')](handleEntityNotFound(_0x33b9ad,null))[_0xf373('0x28')](function(_0x8584df){if(_0x8584df){return db[_0xf373('0x4f')][_0xf373('0x50')](function(_0x5efc63){return db[_0xf373('0x51')][_0xf373('0x58')]({'where':{'userProfileId':_0x47be40[_0xf373('0x5b')]['id'],'sectionId':_[_0xf373('0x2e')](_0x453e20,function(_0x43f778){return _0x43f778[_0xf373('0x54')];})},'transaction':_0x5efc63})[_0xf373('0x28')](function(){var _0xe9145f=_['map'](_0x453e20,function(_0x24ebeb){_0x24ebeb[_0xf373('0x55')]=_0x47be40['params']['id'];return _0x24ebeb;});var _0x409524=[];return BPromise[_0xf373('0x5c')](_0xe9145f,function(_0x8f7955){return db[_0xf373('0x51')][_0xf373('0x4a')](_0x8f7955,{'include':[{'model':db['UserProfileResource'],'as':_0xf373('0x56')}],'raw':!![],'transaction':_0x5efc63})[_0xf373('0x28')](function(_0x45567d){_0x409524[_0xf373('0x5d')](_0x45567d[_0xf373('0x5e')]({'plain':!![]}));});})[_0xf373('0x28')](function(){return _0x409524;});});});}})[_0xf373('0x28')](function(_0xcbfd41){return _0xcbfd41;})[_0xf373('0x28')](respondWithResult(_0x33b9ad,null))[_0xf373('0x47')](handleError(_0x33b9ad,null));};exports[_0xf373('0x5f')]=function(_0x38635a,_0x46e5e2){var _0x2b5c39;return db[_0xf373('0x2f')]['find']({'where':{'id':_0x38635a[_0xf373('0x5b')]['id']},'attributes':['id',_0xf373('0x2c')]})[_0xf373('0x28')](handleEntityNotFound(_0x46e5e2,null))[_0xf373('0x28')](function(_0xd1fd17){if(_0xd1fd17){_0x2b5c39=_0xd1fd17;return db['UserProfileSection'][_0xf373('0x58')]({'where':{'userProfileId':_0x38635a[_0xf373('0x5b')]['id'],'sectionId':_0x38635a[_0xf373('0x34')]['ids']}});}})['then'](function(){return _0x2b5c39;})['then'](respondWithStatusCode(_0x46e5e2,null))[_0xf373('0x47')](handleError(_0x46e5e2,null));};exports[_0xf373('0x60')]=function(_0x4dbdb0,_0x3f8530){var _0x17bb01=[];var _0x147632=[];return db['UserProfileSection'][_0xf373('0x46')]({'where':{'userProfileId':_0x4dbdb0[_0xf373('0x5b')]['id']},'raw':!![]})['then'](function(_0x19b398){_0x17bb01=_[_0xf373('0x3f')](_0x19b398,function(_0x151da6){return _0x151da6['enabled']===0x1||_[_0xf373('0x61')]([0x3eb,0x709],_0x151da6[_0xf373('0x54')]);});if(!_['isEmpty'](_0x17bb01)){return _[_0xf373('0x2e')](_0x17bb01,function(_0x3feef6){return _0x3feef6['sectionId'];});}else{return;}})[_0xf373('0x28')](function(_0x13e1c2){if(_0x13e1c2)_0x147632=_0x13e1c2;if(_[_0xf373('0x61')](_0x147632,0x64)){var _0x4f271a=_[_0xf373('0x57')](_0x17bb01,{'sectionId':0x64});return hasDefaultDashboard(_0x4f271a)[_0xf373('0x28')](function(_0x18646a){return _[_0xf373('0x2e')](_0x17bb01,function(_0x314492){if(_0x314492[_0xf373('0x54')]===0x64){_0x314492[_0xf373('0x62')]=_0x18646a;}return _0x314492;});});}else{return;}})[_0xf373('0x28')](function(_0x52d12e){if(_0x52d12e)_0x17bb01=_0x52d12e;if(_[_0xf373('0x61')](_0x147632,0x3eb)){var _0xf7a9d8=_[_0xf373('0x57')](_0x17bb01,{'sectionId':0x3eb});return getCustomDashboards(_0xf7a9d8)[_0xf373('0x28')](function(_0x433482){return _[_0xf373('0x2e')](_0x17bb01,function(_0x29169e){if(_0xf7a9d8[_0xf373('0x63')]){if(_0x29169e[_0xf373('0x54')]===0x3eb){_0x29169e['subsections']=_0x433482;}}else{if(_0x29169e['sectionId']===0x64){_0x29169e['subsections']=_0x433482;}}return _0x29169e;});});}else{return;}})[_0xf373('0x28')](function(_0x441667){if(_0x441667)_0x17bb01=_0x441667;if(_[_0xf373('0x61')](_0x147632,0x709)){var _0x5e2100=_[_0xf373('0x57')](_0x17bb01,{'sectionId':0x709});return getPlugins(_0x5e2100)[_0xf373('0x28')](function(_0x231849){if(_0x5e2100['enabled']){return _[_0xf373('0x2e')](_0x17bb01,function(_0x4e09e2){if(_0x4e09e2[_0xf373('0x54')]===0x709){_0x4e09e2['subsections']=_0x231849;}return _0x4e09e2;});}else{var _0x501844={'sectionId':0x76c,'enabled':0x1,'subsections':_0x231849};var _0x283caf=_[_0xf373('0x2e')](_0x17bb01);_0x283caf['push'](_0x501844);return _0x283caf;}});}else{return;}})[_0xf373('0x28')](function(_0x309d17){if(_0x309d17)_0x17bb01=_0x309d17;return _[_0xf373('0x3f')](_0x17bb01,['enabled',0x1]);})[_0xf373('0x28')](respondWithResult(_0x3f8530,null))[_0xf373('0x47')](handleError(_0x3f8530,null));};function hasDefaultDashboard(_0x2b6af7){var _0x32e205=[0x65];return new BPromise(function(_0x435899,_0x295a6c){try{if(_0x2b6af7[_0xf373('0x52')]){_0x435899(_0x32e205);}else{return db[_0xf373('0x53')][_0xf373('0x64')]({'where':{'sectionId':_0x2b6af7['id']},'raw':!![]})[_0xf373('0x28')](function(_0x681570){_0x681570?_0x435899(_0x32e205):_0x435899();});}}catch(_0x394545){_0x295a6c(_0x394545);}});}function getCustomDashboards(_0x2cfe8e){var _0x5b0ef=[];return new BPromise(function(_0x27b7a6,_0x2a5a95){try{if(_0x2cfe8e[_0xf373('0x52')]){return db[_0xf373('0x65')][_0xf373('0x46')]({'raw':!![]})['then'](function(_0x3325aa){_0x3325aa[_0xf373('0x66')](function(_0x3103f3){_0x5b0ef['push'](_0x3103f3['id']+0x1869f);});_0x27b7a6(_0x5b0ef);});}else{return db[_0xf373('0x53')][_0xf373('0x46')]({'where':{'sectionId':_0x2cfe8e['id']},'raw':!![]})['then'](function(_0x44eef4){_0x44eef4[_0xf373('0x66')](function(_0x501d2e){_0x5b0ef[_0xf373('0x5d')](_0x501d2e[_0xf373('0x67')]+0x1869f);});_0x27b7a6(_0x5b0ef);});}}catch(_0x441ef3){_0x2a5a95(_0x441ef3);}});}function getPlugins(_0x208760){var _0x1b3cb9=[];return new BPromise(function(_0x2d37f0,_0x1735b0){try{if(_0x208760[_0xf373('0x52')]){return db['Plugin'][_0xf373('0x46')]({'raw':!![]})['then'](function(_0x4e5ba6){_0x4e5ba6[_0xf373('0x66')](function(_0x1e41a2){_0x1b3cb9['push'](_0x1e41a2['id']+0x15b38);});_0x2d37f0(_0x1b3cb9);});}else{return db[_0xf373('0x53')][_0xf373('0x46')]({'where':{'sectionId':_0x208760['id']},'raw':!![]})['then'](function(_0x97ff01){_0x97ff01[_0xf373('0x66')](function(_0x263f47){_0x1b3cb9[_0xf373('0x5d')](_0x263f47[_0xf373('0x67')]+0x15b38);});_0x2d37f0(_0x1b3cb9);});}}catch(_0x11b394){_0x1735b0(_0x11b394);}});}exports[_0xf373('0x68')]=function(_0xebdbcb,_0x15134a){return db[_0xf373('0x2f')][_0xf373('0x57')]({'where':{'id':_0xebdbcb[_0xf373('0x5b')]['id']}})[_0xf373('0x28')](handleEntityNotFound(_0x15134a,null))['then'](function(_0x4af7b4){if(_0x4af7b4){return db[_0xf373('0x4f')][_0xf373('0x50')](function(_0x170490){return db[_0xf373('0x51')][_0xf373('0x46')]({'where':{'userProfileId':_0xebdbcb[_0xf373('0x5b')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x1576b0){if(_0x1576b0){return db['UserProfileSection'][_0xf373('0x58')]({'where':{'userProfileId':_0xebdbcb['params']['id'],'id':_[_0xf373('0x2e')](_0x1576b0,function(_0x94a6ed){return _0x94a6ed['id'];})},'transaction':_0x170490});}})[_0xf373('0x28')](function(_0x1f3dc4){var _0x493f17=_['map'](_0xebdbcb[_0xf373('0x4b')],function(_0x18d246){_0x18d246[_0xf373('0x55')]=_0xebdbcb[_0xf373('0x5b')]['id'];return _0x18d246;});return db[_0xf373('0x51')][_0xf373('0x69')](_0x493f17,{'raw':!![],'transaction':_0x170490});})[_0xf373('0x28')](function(_0x990223){var _0x475a7b=_[_0xf373('0x3f')](_[_0xf373('0x2e')](_0x990223,function(_0x5a5845){return _0x5a5845[_0xf373('0x5e')]({'plain':!![]});}),{'includeAll':![]});if(_0x475a7b){return db[_0xf373('0x51')][_0xf373('0x46')]({'where':{'userProfileId':_0xebdbcb['params']['id'],'sectionId':_[_0xf373('0x2e')](_0x475a7b,function(_0x3c239e){return _0x3c239e[_0xf373('0x54')];})},'attributes':['id',_0xf373('0x54')],'raw':!![]})[_0xf373('0x28')](function(_0x2b6b2d){var _0x5dba4a=_[_0xf373('0x2e')](_0xebdbcb[_0xf373('0x4b')],function(_0x1e747b){_0x1e747b[_0xf373('0x55')]=_0xebdbcb[_0xf373('0x5b')]['id'];return _0x1e747b;});return db['UserProfileResource'][_0xf373('0x69')](_0x5dba4a,{'raw':!![],'transaction':_0x170490});});}})[_0xf373('0x47')](handleError(_0x15134a,null));});}})[_0xf373('0x28')](function(_0x12a22a){var _0x2d1d91=_['map'](_0x12a22a,function(_0x1c03f6){return _0x1c03f6[_0xf373('0x5e')]({'plain':!![]});});})[_0xf373('0x28')](respondWithResult(_0x15134a,null))['catch'](handleError(_0x15134a,null));};exports[_0xf373('0x6a')]=function(_0x265762,_0x2cf316,_0x404232){return db[_0xf373('0x2f')][_0xf373('0x57')]({'where':{'id':_0x265762[_0xf373('0x5b')]['id']}})[_0xf373('0x28')](handleEntityNotFound(_0x2cf316,null))['then'](function(_0x2d88b5){if(_0x2d88b5){return _0x2d88b5[_0xf373('0x6a')](_0x265762[_0xf373('0x34')][_0xf373('0x6b')]);}})['then'](respondWithStatusCode(_0x2cf316,null))['catch'](handleError(_0x2cf316,null));};exports[_0xf373('0x6c')]=function(_0x4c642f,_0x5182ff){var _0x1298c2={'raw':![],'where':{}};var _0x17c864={};var _0x22b26a={'count':0x0,'rows':[]};var _0x4b514d=_0x4c642f[_0xf373('0x34')][_0xf373('0x6d')];if(typeof _0x4b514d===_0xf373('0x6e')){throw new db[(_0xf373('0x6f'))]['ValidationError'](_0xf373('0x70'));}var _0x4fc8df=_0x4c642f[_0xf373('0x34')]['mergeResources']||![];var _0x5e73e6=getQueryModels(_0x4b514d,_0x4fc8df);if(typeof _0x5e73e6['childModel']===_0xf373('0x6e')){throw new db[(_0xf373('0x6f'))][(_0xf373('0x71'))](_0xf373('0x72')+_0x4b514d+'\x27');}var _0x36b0d6=[];if(!_[_0xf373('0x73')](_0x5e73e6['parentSections'])){_0x36b0d6=_0x5e73e6[_0xf373('0x74')];}else{_0x36b0d6=[{'name':_0x4b514d}];}return db[_0xf373('0x2f')][_0xf373('0x64')]({'where':{'id':_0x4c642f['params']['id']}})['then'](handleEntityNotFound(_0x5182ff,null))[_0xf373('0x28')](function(_0x8cbbbc){if(_0x8cbbbc){var _0x910eb4=[];for(var _0x43ad89=0x0;_0x43ad89<_0x36b0d6['length'];_0x43ad89++){_0x910eb4[_0xf373('0x5d')](db[_0xf373('0x51')]['findOne']({'where':{'userProfileId':_0x8cbbbc['id'],'name':_0x36b0d6[_0x43ad89][_0xf373('0x2c')]},'raw':!![]}));}return BPromise[_0xf373('0x75')](_0x910eb4);}})[_0xf373('0x28')](function(_0x6f6275){var _0x114c8d=_[_0xf373('0x3f')](_0x6f6275,function(_0x1d36c8){return _0x1d36c8?_0x1d36c8:undefined;});var _0x223e63=_[_0xf373('0x3f')](_0x36b0d6,[_0xf373('0x76'),!![]]);var _0xa9a265=_[_0xf373('0x73')](_0x114c8d)&&_['isEmpty'](_0x223e63)?null:_[_0xf373('0x77')](_0x223e63,_0x114c8d);if(_0xa9a265){var _0x2d3203=[];for(var _0x27f825=0x0;_0x27f825<_0xa9a265['length'];_0x27f825++){var _0x56c318=_['find'](_0x36b0d6,function(_0xae4462){return _0xa9a265[_0x27f825]?_0xae4462[_0xf373('0x2c')]===_0xa9a265[_0x27f825][_0xf373('0x2c')]:null;});if(_0x56c318){if(_0xa9a265[_0x27f825][_0xf373('0x76')]){_0x2d3203['push'](getAllResources(_0x5e73e6[_0xf373('0x78')],_0xa9a265[_0x27f825]));}else{if(!_0xa9a265[_0x27f825][_0xf373('0x52')]){_0x2d3203['push'](getAllowedResources(_0x56c318,_0xa9a265[_0x27f825],_0x5e73e6[_0xf373('0x78')]));}else{if(_0x56c318[_0xf373('0x33')]){_0x2d3203[_0xf373('0x5d')](getAllFilteredResources(_0x56c318,_0xa9a265[_0x27f825]));}}}}}return BPromise[_0xf373('0x75')](_0x2d3203);}else{return null;}})[_0xf373('0x28')](function(_0x53fd7a){var _0x40679c=_0x53fd7a;var _0x3af0f6=null;if(_0x40679c){_0x3af0f6=_0x40679c[_0xf373('0x48')]===0x1?_0x40679c[0x0]:null;}if(_0x3af0f6||_0x40679c){var _0x261089=db[_0x5e73e6[_0xf373('0x78')]][_0xf373('0x30')];_0x17c864[_0xf373('0x33')]=_[_0xf373('0x35')](_0x261089);_0x17c864[_0xf373('0x34')]=_['keys'](_0x4c642f[_0xf373('0x34')]);_0x17c864[_0xf373('0x3d')]=_[_0xf373('0x36')](_0x17c864[_0xf373('0x33')],_0x17c864[_0xf373('0x34')]);_0x1298c2['attributes']=_[_0xf373('0x36')](_0x17c864[_0xf373('0x33')],qs[_0xf373('0x38')](_0x4c642f['query'][_0xf373('0x38')]));_0x1298c2['attributes']=_0x1298c2[_0xf373('0x37')][_0xf373('0x48')]?_0x1298c2[_0xf373('0x37')]:_0x17c864[_0xf373('0x33')];if(!_0x4c642f[_0xf373('0x34')]['hasOwnProperty']('nolimit')){_0x1298c2[_0xf373('0x22')]=qs['limit'](_0x4c642f[_0xf373('0x34')][_0xf373('0x22')]);_0x1298c2['offset']=qs[_0xf373('0x21')](_0x4c642f[_0xf373('0x34')][_0xf373('0x21')]);}_0x1298c2['order']=qs[_0xf373('0x3b')](_0x4c642f['query'][_0xf373('0x3b')]);_0x1298c2[_0xf373('0x3c')]=qs['filters'](_[_0xf373('0x3e')](_0x4c642f[_0xf373('0x34')],_0x17c864[_0xf373('0x3d')]));if(_0x4c642f[_0xf373('0x34')][_0xf373('0x3f')]){_0x1298c2[_0xf373('0x3c')]=_['merge'](_0x1298c2[_0xf373('0x3c')],{'$or':_[_0xf373('0x2e')](_0x261089,function(_0xde0c98){if(_0xde0c98[_0xf373('0x41')][_0xf373('0x32')]!=='VIRTUAL'){var _0x519b7c={};_0x519b7c[_0xde0c98[_0xf373('0x79')]]={'$like':'%'+_0x4c642f[_0xf373('0x34')][_0xf373('0x3f')]+'%'};return _0x519b7c;}})});}var _0x31e4a9=[];if(_0x3af0f6){var _0x3a1c6b=_[_0xf373('0x57')](_0x36b0d6,[_0xf373('0x2c'),_0x3af0f6[_0xf373('0x2c')]]);if(_0x3a1c6b['field']){var _0x1ece5b={};if(_0x5e73e6[_0xf373('0x78')]===_0xf373('0x7a')){_0x1ece5b[_0x3a1c6b[_0xf373('0x7b')]]=_['map'](_0x3af0f6[_0xf373('0x7c')],'id');}else{_0x1ece5b[_0x3a1c6b['foreignKey']]=_0x3af0f6[_0xf373('0x7c')];}_0x31e4a9['push'](_0x1ece5b);}else{_0x1298c2[_0xf373('0x3c')]['id']=_0x3af0f6[_0xf373('0x7c')];}}else{for(var _0x53f492=0x0;_0x53f492<_0x40679c[_0xf373('0x48')];_0x53f492++){var _0x3a1c6b=_['find'](_0x36b0d6,['name',_0x40679c[_0x53f492][_0xf373('0x2c')]]);if(_0x3a1c6b[_0xf373('0x79')]){var _0x1ece5b={};_0x1ece5b[_0x3a1c6b[_0xf373('0x7b')]]=_0x40679c[_0x53f492][_0xf373('0x7c')];_0x31e4a9['push'](_0x1ece5b);}else{if(!_0x1298c2[_0xf373('0x3c')]['id'])_0x1298c2['where']['id']=[];_0x40679c[_0x53f492][_0xf373('0x7c')][_0xf373('0x66')](function(_0x1b195d){_0x1298c2['where']['id'][_0xf373('0x5d')](_0x1b195d);});}}}if(!_['isEmpty'](_0x31e4a9)){_0x1298c2['where']=_[_0xf373('0x40')](_0x1298c2[_0xf373('0x3c')],{'$and':{'$or':_0x31e4a9}});}_0x1298c2=_[_0xf373('0x40')]({},_0x1298c2,_0x4c642f[_0xf373('0x49')]);if(_0x3af0f6&&!_0x3af0f6[_0xf373('0x52')]&&_0x5e73e6[_0xf373('0x78')]===_0xf373('0x7a')){if(_0x4c642f['query']['includeAll']){_0x1298c2[_0xf373('0x45')]=[{'all':!![]}];}return db[_0x5e73e6[_0xf373('0x78')]][_0xf373('0x46')](_0x1298c2)['then'](function(_0xbea445){var _0x42fdb2=[];_0xbea445['forEach'](function(_0xab7a7d){var _0x56ff26;switch(_0xab7a7d[_0xf373('0x7d')]){case _0xf373('0x7e'):_0x56ff26=_[_0xf373('0x57')](_0x3af0f6[_0xf373('0x7c')],function(_0x5b8f95){return _0x5b8f95['id']===_0xab7a7d['reportId']&&_0x5b8f95['type']===_0xf373('0x7f');});break;case'custom':_0x56ff26=_[_0xf373('0x57')](_0x3af0f6[_0xf373('0x7c')],function(_0x566c19){return _0x566c19['id']===_0xab7a7d[_0xf373('0x80')]&&_0x566c19[_0xf373('0x41')]===_0xf373('0x81');});break;}if(_0x56ff26)_0x42fdb2[_0xf373('0x5d')](_0xab7a7d);});_0x22b26a['count']=_0x42fdb2[_0xf373('0x48')];_0x22b26a['rows']=_0x42fdb2;return _0x22b26a;});}else{return db[_0x5e73e6[_0xf373('0x78')]][_0xf373('0x43')]({'where':_0x1298c2[_0xf373('0x3c')]})['then'](function(_0x30f99c){_0x22b26a[_0xf373('0x43')]=_0x30f99c;if(_0x4c642f[_0xf373('0x34')][_0xf373('0x44')]){if(_0x5e73e6[_0xf373('0x78')]===_0xf373('0x82')){_0x1298c2[_0xf373('0x45')]=[{'model':db[_0xf373('0x83')],'as':_0xf373('0x84'),'attributes':['id',_0xf373('0x2c'),'color'],'required':_0x4c642f[_0xf373('0x34')]['tag']?!![]:![]},{'model':db[_0xf373('0x83')],'as':_0xf373('0x85'),'attributes':['id','name',_0xf373('0x86')],'through':_0x4c642f[_0xf373('0x34')]['tag']?{'attributes':[],'where':{'TagId':_0x4c642f[_0xf373('0x34')][_0xf373('0x87')]||undefined}}:{},'required':_0x4c642f[_0xf373('0x34')][_0xf373('0x87')]?!![]:![]}];}else{_0x1298c2[_0xf373('0x45')]=[{'all':!![]}];}}return db[_0x5e73e6[_0xf373('0x78')]][_0xf373('0x46')](_0x1298c2);})[_0xf373('0x28')](function(_0x2ca92b){_0x22b26a[_0xf373('0x88')]=_0x2ca92b;return _0x22b26a;});}}else{return _0x22b26a;}})[_0xf373('0x28')](respondWithFilteredResult(_0x5182ff,_0x1298c2))['catch'](handleError(_0x5182ff,null));};function getAllResources(_0x18657b,_0x317f90){return new BPromise(function(_0x5c3921,_0x34d15d){if(_0x317f90){var _0x5bb532=_0x317f90['filter']?{[_0x317f90[_0xf373('0x3f')][_0xf373('0x79')]]:_0x317f90[_0xf373('0x3f')]['value']}:undefined;return db[_0x18657b][_0xf373('0x46')]({'where':_0x5bb532,'raw':!![]})[_0xf373('0x28')](function(_0x37b599){_0x317f90[_0xf373('0x7c')]=_[_0xf373('0x2e')](_0x37b599,'id');_0x5c3921(_0x317f90);})[_0xf373('0x47')](function(_0x39f7a4){_0x34d15d(_0x39f7a4);});}else{_0x5c3921(null);}});}function getAllFilteredResources(_0x26a953,_0x41b717){return new BPromise(function(_0x7c7568,_0x36097c){var _0x1e9271=_0x26a953[_0xf373('0x3f')]?{[_0x26a953[_0xf373('0x3f')][_0xf373('0x79')]]:_0x26a953[_0xf373('0x3f')][_0xf373('0x89')]}:undefined;return db[_0x26a953['model']][_0xf373('0x46')]({'where':_0x1e9271,'raw':!![]})[_0xf373('0x28')](function(_0x591a89){_0x41b717[_0xf373('0x7c')]=_[_0xf373('0x2e')](_0x591a89,function(_0x22a53c){return _0x22a53c[_0xf373('0x2c')];});_0x7c7568(_0x41b717);})[_0xf373('0x47')](function(_0x4d06b5){_0x36097c(_0x4d06b5);});});}function getAllowedResources(_0x3a6c05,_0x1f314e,_0x32b17b){return new BPromise(function(_0xa6259,_0xe103b1){if(_0x1f314e){return db['UserProfileResource'][_0xf373('0x46')]({'where':{'sectionId':_0x1f314e['id']},'raw':!![]})[_0xf373('0x28')](function(_0x164e52){if(_0x3a6c05[_0xf373('0x79')]&&_0x3a6c05['field']!=='id'){_0x1f314e[_0xf373('0x7c')]=_[_0xf373('0x2e')](_0x164e52,function(_0x248736){return _0x248736[_0x3a6c05[_0xf373('0x79')]];});}else{if(_0x32b17b==='AnalyticExtractedReport'){_0x1f314e[_0xf373('0x7c')]=_['map'](_0x164e52,function(_0x2230b3){return{'id':_0x2230b3[_0xf373('0x67')],'type':_0x2230b3[_0xf373('0x41')]};});}else{_0x1f314e[_0xf373('0x7c')]=_[_0xf373('0x2e')](_0x164e52,function(_0x51792c){return _0x51792c['resourceId'];});}}_0xa6259(_0x1f314e);})[_0xf373('0x47')](function(_0x105b3e){_0xe103b1(_0x105b3e);});}else{_0xa6259(null);}});}function getQueryModels(_0x344ea4,_0x4f164b){var _0x58b721=_0x344ea4[_0xf373('0x8a')]();var _0x13303d={'childModel':undefined,'parentSections':[]};switch(_0x58b721){case _0xf373('0x8b'):_0x13303d[_0xf373('0x78')]='SquareProject';break;case _0xf373('0x8c'):_0x13303d[_0xf373('0x78')]=_0xf373('0x8d');break;case _0xf373('0x8e'):_0x13303d[_0xf373('0x78')]=_0xf373('0x8f');_0x13303d[_0xf373('0x74')]=[{'name':_0xf373('0x90'),'field':_0xf373('0x2c'),'foreignKey':'projectName'}];break;case _0xf373('0x91'):_0x13303d['childModel']='JscriptyProject';break;case _0xf373('0x92'):_0x13303d[_0xf373('0x78')]=_0xf373('0x82');_0x13303d[_0xf373('0x74')]=[{'name':'Lists','field':'id','foreignKey':_0xf373('0x93')}];break;case _0xf373('0x94'):_0x13303d[_0xf373('0x78')]=_0xf373('0x95');break;case _0xf373('0x96'):_0x13303d[_0xf373('0x78')]=_0xf373('0x97');break;case _0xf373('0x98'):_0x13303d[_0xf373('0x78')]=_0xf373('0x99');break;case _0xf373('0x9a'):_0x13303d[_0xf373('0x78')]=_0xf373('0x9b');break;case _0xf373('0x9c'):_0x13303d[_0xf373('0x78')]=_0xf373('0x9d');break;case _0xf373('0x9e'):_0x13303d[_0xf373('0x78')]=_0xf373('0x9f');break;case'faxaccounts':_0x13303d['childModel']=_0xf373('0xa0');break;case _0xf373('0xa1'):case _0xf373('0xa2'):case'outboundroutes':_0x13303d[_0xf373('0x78')]=_0xf373('0xa3');break;case _0xf373('0xa4'):_0x13303d[_0xf373('0x78')]=_0xf373('0xa5');break;case _0xf373('0xa6'):_0x13303d[_0xf373('0x78')]=_0xf373('0xa7');break;case _0xf373('0xa8'):_0x13303d[_0xf373('0x78')]=_0xf373('0xa9');_0x13303d[_0xf373('0x74')]=[{'name':_0xf373('0xaa'),'field':_0xf373('0x2c'),'foreignKey':_0xf373('0xab'),'model':'User','filter':{'field':_0xf373('0xac'),'value':[_0xf373('0xad')]}},{'name':_0xf373('0xae'),'field':_0xf373('0x2c'),'foreignKey':_0xf373('0xab'),'model':_0xf373('0xaf'),'filter':{'field':_0xf373('0xac'),'value':['telephone']}},{'name':_0xf373('0xb0'),'field':_0xf373('0x2c'),'foreignKey':'queue','model':_0xf373('0xb1'),'filter':{'field':'type','value':['inbound']}},{'name':_0xf373('0xb2'),'field':'name','foreignKey':_0xf373('0xb3'),'model':_0xf373('0xb1'),'filter':{'field':_0xf373('0x41'),'value':[_0xf373('0xb4')]}}];break;case'musiconholds':_0x13303d[_0xf373('0x78')]=_0xf373('0xb5');break;case _0xf373('0xb6'):_0x13303d[_0xf373('0x78')]='VoiceChanSpy';break;case _0xf373('0xb7'):_0x13303d[_0xf373('0x78')]=_0xf373('0xb8');break;case _0xf373('0xb9'):_0x13303d[_0xf373('0x78')]=_0xf373('0xba');break;case _0xf373('0xbb'):_0x13303d['childModel']=_0xf373('0xbc');break;case'mailaccounts':_0x13303d['childModel']='MailAccount';break;case _0xf373('0xbd'):_0x13303d[_0xf373('0x78')]=_0xf373('0xbe');break;case _0xf373('0xbf'):_0x13303d['childModel']='OpenchannelQueue';break;case _0xf373('0xc0'):_0x13303d[_0xf373('0x78')]=_0xf373('0xc1');break;case _0xf373('0xc2'):_0x13303d[_0xf373('0x78')]=_0xf373('0xc3');break;case _0xf373('0xc4'):_0x13303d[_0xf373('0x78')]=_0xf373('0xc5');break;case _0xf373('0xc6'):_0x13303d[_0xf373('0x78')]=_0xf373('0xc7');break;case'whatsappaccounts':_0x13303d[_0xf373('0x78')]=_0xf373('0xc8');break;case'teams':_0x13303d[_0xf373('0x78')]=_0xf373('0xc9');break;case _0xf373('0xca'):case'queuecampaigns':_0x13303d[_0xf373('0x78')]=_0xf373('0xb1');if(_0x4f164b){_0x13303d[_0xf373('0x74')]=[{'name':_0xf373('0xb0')},{'name':'QueueCampaigns'}];}break;case _0xf373('0xcb'):case'agents':case'telephones':_0x13303d[_0xf373('0x78')]=_0xf373('0xaf');if(_0x4f164b){_0x13303d[_0xf373('0x74')]=[{'name':_0xf373('0xcc'),'filter':{'field':_0xf373('0xac'),'value':[_0xf373('0xcd'),_0xf373('0xce')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x13303d[_0xf373('0x78')]='ZendeskAccount';break;case _0xf373('0xcf'):_0x13303d[_0xf373('0x78')]=_0xf373('0xd0');break;case _0xf373('0xd1'):_0x13303d['childModel']='FreshdeskAccount';break;case'sugarcrmaccounts':_0x13303d['childModel']=_0xf373('0xd2');break;case _0xf373('0xd3'):_0x13303d[_0xf373('0x78')]=_0xf373('0xd4');break;case _0xf373('0xd5'):_0x13303d[_0xf373('0x78')]=_0xf373('0xd6');break;case'vtigeraccounts':_0x13303d['childModel']='User';break;case'cannedanswers':_0x13303d[_0xf373('0x78')]=_0xf373('0xd7');break;case _0xf373('0xd8'):_0x13303d['childModel']=_0xf373('0xd9');break;case _0xf373('0xda'):_0x13303d[_0xf373('0x78')]=_0xf373('0x65');break;case _0xf373('0xdb'):_0x13303d[_0xf373('0x78')]=_0xf373('0xdc');break;case _0xf373('0xdd'):_0x13303d['childModel']='Pause';break;case _0xf373('0xde'):_0x13303d[_0xf373('0x78')]=_0xf373('0xdf');break;case _0xf373('0xe0'):_0x13303d[_0xf373('0x78')]=_0xf373('0xe1');break;case _0xf373('0xe2'):_0x13303d[_0xf373('0x78')]='Tag';break;case _0xf373('0xe3'):_0x13303d[_0xf373('0x78')]=_0xf373('0xe4');break;case _0xf373('0xe5'):_0x13303d['childModel']=_0xf373('0xe6');break;case _0xf373('0xe7'):_0x13303d['childModel']=_0xf373('0xe8');break;case _0xf373('0xe9'):_0x13303d[_0xf373('0x78')]=_0xf373('0xea');break;case _0xf373('0xeb'):_0x13303d[_0xf373('0x78')]=_0xf373('0xec');break;case'extractedreports':_0x13303d[_0xf373('0x78')]='AnalyticExtractedReport';_0x13303d[_0xf373('0x74')]=[{'name':_0xf373('0xed'),'field':'id','foreignKey':_0xf373('0x80')}];break;case _0xf373('0xee'):_0x13303d['childModel']=_0xf373('0xef');break;case _0xf373('0xf0'):_0x13303d[_0xf373('0x78')]='WhatsappAccount';break;default:return _0x13303d;}return _0x13303d;} \ No newline at end of file +var _0x4c2d=['ignore','childModel','order','key','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','Tag','color','tag','value','toLowerCase','squareprojects','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','JscriptyProject','contacts','CmContact','ListId','CmList','companies','CmCompany','CmCustomField','chatqueues','chatwebsites','faxqueues','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','users','agents','telephones','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','scheduler','tags','templates','Template','triggers','Trigger','trunks','variables','Plugin','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','end','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','body','clone','get','omit','updatedAt','createdAt','UserProfileSection','each','autoAssociation','UserProfileResource','destroy','describe','addSections','find','transaction','sectionId','userProfileId','Resources','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','all','union'];(function(_0xa4585d,_0x8231b7){var _0x4e204e=function(_0x2a0e08){while(--_0x2a0e08){_0xa4585d['push'](_0xa4585d['shift']());}};_0x4e204e(++_0x8231b7);}(_0x4c2d,0x166));var _0xd4c2=function(_0x3c37d3,_0x1afaea){_0x3c37d3=_0x3c37d3-0x0;var _0x33bdd9=_0x4c2d[_0x3c37d3];return _0x33bdd9;};'use strict';var pdf=require(_0xd4c2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd4c2('0x1'));var zipdir=require(_0xd4c2('0x2'));var jsonpatch=require(_0xd4c2('0x3'));var rp=require(_0xd4c2('0x4'));var moment=require(_0xd4c2('0x5'));var BPromise=require(_0xd4c2('0x6'));var Mustache=require('mustache');var util=require(_0xd4c2('0x7'));var path=require(_0xd4c2('0x8'));var sox=require(_0xd4c2('0x9'));var csv=require(_0xd4c2('0xa'));var ejs=require(_0xd4c2('0xb'));var fs=require('fs');var _=require(_0xd4c2('0xc'));var squel=require(_0xd4c2('0xd'));var crypto=require(_0xd4c2('0xe'));var jsforce=require(_0xd4c2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd4c2('0x10'));var Papa=require(_0xd4c2('0x11'));var Redis=require(_0xd4c2('0x12'));var authService=require(_0xd4c2('0x13'));var qs=require(_0xd4c2('0x14'));var as=require(_0xd4c2('0x15'));var hardwareService=require(_0xd4c2('0x16'));var logger=require(_0xd4c2('0x17'))(_0xd4c2('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd4c2('0x19')]=_[_0xd4c2('0x1a')](config[_0xd4c2('0x19')],{'host':_0xd4c2('0x1b'),'port':0x18eb});var socket=require(_0xd4c2('0x1c'))(new Redis(config['redis']));require(_0xd4c2('0x1d'))[_0xd4c2('0x1e')](socket);function respondWithStatusCode(_0x38e0ad,_0x4d60b6){_0x4d60b6=_0x4d60b6||0xcc;return function(_0x1e2329){if(_0x1e2329){return _0x38e0ad[_0xd4c2('0x1f')](_0x4d60b6);}return _0x38e0ad[_0xd4c2('0x20')](_0x4d60b6)['end']();};}function respondWithResult(_0x411855,_0x31ec0e){_0x31ec0e=_0x31ec0e||0xc8;return function(_0x12d5f0){if(_0x12d5f0){return _0x411855[_0xd4c2('0x20')](_0x31ec0e)[_0xd4c2('0x21')](_0x12d5f0);}};}function respondWithFilteredResult(_0x4f89f9,_0x5e6463){return function(_0xb4c433){if(_0xb4c433){var _0x3c02ee=_0xb4c433[_0xd4c2('0x22')],_0x1b79d8=_0x5e6463[_0xd4c2('0x23')],_0x4ba2d0=_0x5e6463['offset']+_0x5e6463['limit'],_0x2e8770;if(_0x4ba2d0>=_0x3c02ee){_0x4ba2d0=_0x3c02ee;_0x2e8770=0xc8;}else{_0x2e8770=0xce;}_0x4f89f9[_0xd4c2('0x20')](_0x2e8770);return _0x4f89f9[_0xd4c2('0x24')](_0xd4c2('0x25'),_0x1b79d8+'-'+_0x4ba2d0+'/'+_0x3c02ee)[_0xd4c2('0x21')](_0xb4c433);}return null;};}function patchUpdates(_0x214b77){return function(_0x3efc4c){try{jsonpatch['apply'](_0x3efc4c,_0x214b77,!![]);}catch(_0x3ef356){return BPromise[_0xd4c2('0x26')](_0x3ef356);}return _0x3efc4c[_0xd4c2('0x27')]();};}function saveUpdates(_0x1874c9,_0x527136){return function(_0x11222a){if(_0x11222a){return _0x11222a[_0xd4c2('0x28')](_0x1874c9)[_0xd4c2('0x29')](function(_0x3bfa01){return _0x3bfa01;});}return null;};}function removeEntity(_0x47e0a0,_0x5ef2d3){return function(_0x3ee397){if(_0x3ee397){return _0x3ee397['destroy']()[_0xd4c2('0x29')](function(){_0x47e0a0[_0xd4c2('0x20')](0xcc)[_0xd4c2('0x2a')]();});}};}function handleEntityNotFound(_0x11f941,_0x1a1382){return function(_0x5c169e){if(!_0x5c169e){_0x11f941[_0xd4c2('0x1f')](0x194);}return _0x5c169e;};}function handleError(_0x55a8c4,_0x3940d1){_0x3940d1=_0x3940d1||0x1f4;return function(_0x548b76){logger[_0xd4c2('0x2b')](_0x548b76['stack']);if(_0x548b76[_0xd4c2('0x2c')]){delete _0x548b76[_0xd4c2('0x2c')];}_0x55a8c4[_0xd4c2('0x20')](_0x3940d1)[_0xd4c2('0x2d')](_0x548b76);};}exports[_0xd4c2('0x2e')]=function(_0x5189ab,_0x4438c9){var _0x356119={},_0x3a7874={},_0x1ba943={'count':0x0,'rows':[]};var _0x572253=_[_0xd4c2('0x2f')](db[_0xd4c2('0x30')][_0xd4c2('0x31')],function(_0x1d618c){return{'name':_0x1d618c[_0xd4c2('0x32')],'type':_0x1d618c[_0xd4c2('0x33')]['key']};});_0x3a7874[_0xd4c2('0x34')]=_['map'](_0x572253,'name');_0x3a7874[_0xd4c2('0x35')]=_[_0xd4c2('0x36')](_0x5189ab['query']);_0x3a7874[_0xd4c2('0x37')]=_[_0xd4c2('0x38')](_0x3a7874[_0xd4c2('0x34')],_0x3a7874[_0xd4c2('0x35')]);_0x356119[_0xd4c2('0x39')]=_['intersection'](_0x3a7874['model'],qs[_0xd4c2('0x3a')](_0x5189ab['query'][_0xd4c2('0x3a')]));_0x356119[_0xd4c2('0x39')]=_0x356119[_0xd4c2('0x39')]['length']?_0x356119[_0xd4c2('0x39')]:_0x3a7874[_0xd4c2('0x34')];if(!_0x5189ab['query'][_0xd4c2('0x3b')](_0xd4c2('0x3c'))){_0x356119[_0xd4c2('0x3d')]=qs['limit'](_0x5189ab['query'][_0xd4c2('0x3d')]);_0x356119['offset']=qs[_0xd4c2('0x23')](_0x5189ab[_0xd4c2('0x35')][_0xd4c2('0x23')]);}_0x356119['order']=qs['sort'](_0x5189ab[_0xd4c2('0x35')][_0xd4c2('0x3e')]);_0x356119[_0xd4c2('0x3f')]=qs[_0xd4c2('0x37')](_[_0xd4c2('0x40')](_0x5189ab[_0xd4c2('0x35')],_0x3a7874[_0xd4c2('0x37')]),_0x572253);if(_0x5189ab[_0xd4c2('0x35')][_0xd4c2('0x41')]){_0x356119['where']=_[_0xd4c2('0x42')](_0x356119[_0xd4c2('0x3f')],{'$or':_[_0xd4c2('0x2f')](_0x572253,function(_0x434149){if(_0x434149['type']!==_0xd4c2('0x43')){var _0x5b8a46={};_0x5b8a46[_0x434149[_0xd4c2('0x2c')]]={'$like':'%'+_0x5189ab['query'][_0xd4c2('0x41')]+'%'};return _0x5b8a46;}})});}_0x356119=_[_0xd4c2('0x42')]({},_0x356119,_0x5189ab[_0xd4c2('0x44')]);var _0x50fa8f={'where':_0x356119[_0xd4c2('0x3f')]};return db[_0xd4c2('0x30')][_0xd4c2('0x22')](_0x50fa8f)[_0xd4c2('0x29')](function(_0x2df484){_0x1ba943[_0xd4c2('0x22')]=_0x2df484;if(_0x5189ab[_0xd4c2('0x35')][_0xd4c2('0x45')]){_0x356119['include']=[{'all':!![]}];}return db[_0xd4c2('0x30')][_0xd4c2('0x46')](_0x356119);})[_0xd4c2('0x29')](function(_0x318f19){_0x1ba943[_0xd4c2('0x47')]=_0x318f19;return _0x1ba943;})['then'](respondWithFilteredResult(_0x4438c9,_0x356119))[_0xd4c2('0x48')](handleError(_0x4438c9,null));};exports[_0xd4c2('0x49')]=function(_0x5bd652,_0x4c506c){var _0x3de48f={'raw':![],'where':{'id':_0x5bd652[_0xd4c2('0x4a')]['id']}},_0x42da8e={};_0x42da8e[_0xd4c2('0x34')]=_[_0xd4c2('0x36')](db[_0xd4c2('0x30')][_0xd4c2('0x31')]);_0x42da8e['query']=_[_0xd4c2('0x36')](_0x5bd652[_0xd4c2('0x35')]);_0x42da8e['filters']=_[_0xd4c2('0x38')](_0x42da8e['model'],_0x42da8e[_0xd4c2('0x35')]);_0x3de48f['attributes']=_[_0xd4c2('0x38')](_0x42da8e['model'],qs[_0xd4c2('0x3a')](_0x5bd652['query']['fields']));_0x3de48f[_0xd4c2('0x39')]=_0x3de48f[_0xd4c2('0x39')][_0xd4c2('0x4b')]?_0x3de48f[_0xd4c2('0x39')]:_0x42da8e[_0xd4c2('0x34')];if(_0x5bd652[_0xd4c2('0x35')]['includeAll']){_0x3de48f[_0xd4c2('0x4c')]=[{'all':!![]}];}_0x3de48f=_[_0xd4c2('0x42')]({},_0x3de48f,_0x5bd652[_0xd4c2('0x44')]);return db['UserProfile']['find'](_0x3de48f)[_0xd4c2('0x29')](handleEntityNotFound(_0x4c506c,null))[_0xd4c2('0x29')](respondWithResult(_0x4c506c,null))[_0xd4c2('0x48')](handleError(_0x4c506c,null));};exports['create']=function(_0x1ef788,_0x215450){return db['UserProfile']['create'](_0x1ef788[_0xd4c2('0x4d')],{})['then'](respondWithResult(_0x215450,0xc9))[_0xd4c2('0x48')](handleError(_0x215450,null));};exports[_0xd4c2('0x4e')]=function(_0x54fe63,_0x351611){var _0x52f4cb={'where':{'id':_0x54fe63[_0xd4c2('0x4a')]['id']}},_0x557c81={};_0x557c81['model']=_['keys'](db[_0xd4c2('0x30')][_0xd4c2('0x31')]);_0x52f4cb['attributes']=_[_0xd4c2('0x38')](_0x557c81[_0xd4c2('0x34')],qs[_0xd4c2('0x3a')](_0x54fe63[_0xd4c2('0x35')][_0xd4c2('0x3a')]));_0x52f4cb['attributes']=_0x52f4cb[_0xd4c2('0x39')][_0xd4c2('0x4b')]?_0x52f4cb[_0xd4c2('0x39')]:_0x557c81['model'];if(_0x54fe63[_0xd4c2('0x35')][_0xd4c2('0x45')]){_0x52f4cb['include']=[{'all':!![]}];}_0x52f4cb=_['merge']({},_0x52f4cb,_0x54fe63[_0xd4c2('0x44')]);return db['UserProfile']['find'](_0x52f4cb)[_0xd4c2('0x29')](handleEntityNotFound(_0x351611,null))[_0xd4c2('0x29')](function(_0x2eaa04){if(_0x2eaa04){var _0x277901=_0x2eaa04[_0xd4c2('0x4f')]({'plain':!![]});_0x277901=qs[_0xd4c2('0x50')](_0x277901,['id','createdAt',_0xd4c2('0x51'),'crudPermissions']);_0x54fe63[_0xd4c2('0x4d')]=_[_0xd4c2('0x50')](_0x54fe63['body'],['id',_0xd4c2('0x52'),_0xd4c2('0x51')]);return db['sequelize']['transaction'](function(_0x4b5cf9){return db[_0xd4c2('0x30')]['create'](_[_0xd4c2('0x42')](_0x277901,_0x54fe63[_0xd4c2('0x4d')]),{'include':_0x54fe63[_0xd4c2('0x35')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4b5cf9})[_0xd4c2('0x29')](function(_0x34d8f8){var _0x3076b6=_0x34d8f8[_0xd4c2('0x4f')]({'plain':!![]});return db[_0xd4c2('0x53')]['findAll']({'where':{'userProfileId':_0x54fe63['params']['id']},'raw':!![]})['then'](function(_0x5747e7){if(_0x5747e7){return BPromise[_0xd4c2('0x54')](_0x5747e7,function(_0x9e060e){return new BPromise(function(_0x49f23e,_0x343d34){if(_0x9e060e[_0xd4c2('0x55')]===null||_0x9e060e['autoAssociation']===0x1)_0x49f23e(null);return db[_0xd4c2('0x56')]['findAll']({'where':{'sectionId':_0x9e060e['id']},'raw':!![]})[_0xd4c2('0x29')](function(_0x31749f){var _0x431776=_['map'](_0x31749f,function(_0x775e18){return qs['omit'](_0x775e18,['id',_0xd4c2('0x52'),_0xd4c2('0x51'),'sectionId']);});_0x49f23e(_0x431776);})[_0xd4c2('0x48')](function(_0x5c35df){_0x343d34(_0x5c35df);});})[_0xd4c2('0x29')](function(_0x1c33da){var _0x4a5f7f=qs['omit'](_0x9e060e,['id',_0xd4c2('0x52'),_0xd4c2('0x51')]);_0x4a5f7f['userProfileId']=_0x3076b6['id'];if(_0x1c33da)_0x4a5f7f['Resources']=_0x1c33da;return _0x4a5f7f;})[_0xd4c2('0x29')](function(_0x34e1b6){return db[_0xd4c2('0x53')]['create'](_0x34e1b6,{'include':[{'model':db[_0xd4c2('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x4b5cf9});});})[_0xd4c2('0x29')](function(){return _0x3076b6;});}});});});}})[_0xd4c2('0x29')](respondWithResult(_0x351611,0xc9))[_0xd4c2('0x48')](handleError(_0x351611,null));};exports[_0xd4c2('0x28')]=function(_0x514c53,_0x1ac762){if(_0x514c53['body']['id']){delete _0x514c53[_0xd4c2('0x4d')]['id'];}return db[_0xd4c2('0x30')]['find']({'where':{'id':_0x514c53[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x1ac762,null))[_0xd4c2('0x29')](saveUpdates(_0x514c53[_0xd4c2('0x4d')],null))[_0xd4c2('0x29')](respondWithResult(_0x1ac762,null))[_0xd4c2('0x48')](handleError(_0x1ac762,null));};exports[_0xd4c2('0x57')]=function(_0x3586c3,_0x5aabbb){return db[_0xd4c2('0x30')]['find']({'where':{'id':_0x3586c3[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x5aabbb,null))[_0xd4c2('0x29')](removeEntity(_0x5aabbb,null))[_0xd4c2('0x48')](handleError(_0x5aabbb,null));};exports[_0xd4c2('0x58')]=function(_0x1de41c,_0x1036f2){return db[_0xd4c2('0x30')][_0xd4c2('0x58')]()['then'](respondWithResult(_0x1036f2,null))['catch'](handleError(_0x1036f2,null));};exports[_0xd4c2('0x59')]=function(_0x2db495,_0x4bfab6){var _0x16e779=_0x2db495[_0xd4c2('0x4d')];return db[_0xd4c2('0x30')][_0xd4c2('0x5a')]({'where':{'id':_0x2db495[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x4bfab6,null))[_0xd4c2('0x29')](function(_0x5439d2){if(_0x5439d2){return db['sequelize'][_0xd4c2('0x5b')](function(_0x5c6fe1){return db[_0xd4c2('0x53')][_0xd4c2('0x57')]({'where':{'userProfileId':_0x2db495[_0xd4c2('0x4a')]['id'],'sectionId':_[_0xd4c2('0x2f')](_0x16e779,function(_0x43cea8){return _0x43cea8[_0xd4c2('0x5c')];})},'transaction':_0x5c6fe1})[_0xd4c2('0x29')](function(){var _0x39fbd0=_['map'](_0x16e779,function(_0x10c6b1){_0x10c6b1[_0xd4c2('0x5d')]=_0x2db495['params']['id'];return _0x10c6b1;});var _0x53f32f=[];return BPromise[_0xd4c2('0x54')](_0x39fbd0,function(_0x49e72e){return db[_0xd4c2('0x53')]['create'](_0x49e72e,{'include':[{'model':db[_0xd4c2('0x56')],'as':_0xd4c2('0x5e')}],'raw':!![],'transaction':_0x5c6fe1})[_0xd4c2('0x29')](function(_0x3a24c3){_0x53f32f[_0xd4c2('0x5f')](_0x3a24c3[_0xd4c2('0x4f')]({'plain':!![]}));});})['then'](function(){return _0x53f32f;});});});}})[_0xd4c2('0x29')](function(_0x2415f8){return _0x2415f8;})[_0xd4c2('0x29')](respondWithResult(_0x4bfab6,null))[_0xd4c2('0x48')](handleError(_0x4bfab6,null));};exports[_0xd4c2('0x60')]=function(_0x2eec06,_0x1b912a){var _0x58fcdd;return db['UserProfile'][_0xd4c2('0x5a')]({'where':{'id':_0x2eec06[_0xd4c2('0x4a')]['id']},'attributes':['id',_0xd4c2('0x2c')]})['then'](handleEntityNotFound(_0x1b912a,null))[_0xd4c2('0x29')](function(_0x6c12ad){if(_0x6c12ad){_0x58fcdd=_0x6c12ad;return db['UserProfileSection'][_0xd4c2('0x57')]({'where':{'userProfileId':_0x2eec06[_0xd4c2('0x4a')]['id'],'sectionId':_0x2eec06[_0xd4c2('0x35')][_0xd4c2('0x61')]}});}})[_0xd4c2('0x29')](function(){return _0x58fcdd;})[_0xd4c2('0x29')](respondWithStatusCode(_0x1b912a,null))[_0xd4c2('0x48')](handleError(_0x1b912a,null));};exports[_0xd4c2('0x62')]=function(_0x2b2ed7,_0x5e864a){var _0x2f0bae=[];var _0x31d8c7=[];return db[_0xd4c2('0x53')][_0xd4c2('0x46')]({'where':{'userProfileId':_0x2b2ed7[_0xd4c2('0x4a')]['id']},'raw':!![]})['then'](function(_0x352d65){_0x2f0bae=_[_0xd4c2('0x41')](_0x352d65,function(_0x402a4e){return _0x402a4e['enabled']===0x1||_[_0xd4c2('0x63')]([0x3eb,0x709],_0x402a4e[_0xd4c2('0x5c')]);});if(!_[_0xd4c2('0x64')](_0x2f0bae)){return _[_0xd4c2('0x2f')](_0x2f0bae,function(_0x27ced2){return _0x27ced2['sectionId'];});}else{return;}})['then'](function(_0x1bdbaf){if(_0x1bdbaf)_0x31d8c7=_0x1bdbaf;if(_[_0xd4c2('0x63')](_0x31d8c7,0x64)){var _0x595c9e=_['find'](_0x2f0bae,{'sectionId':0x64});return hasDefaultDashboard(_0x595c9e)[_0xd4c2('0x29')](function(_0x353233){return _[_0xd4c2('0x2f')](_0x2f0bae,function(_0x18ac5c){if(_0x18ac5c[_0xd4c2('0x5c')]===0x64){_0x18ac5c[_0xd4c2('0x65')]=_0x353233;}return _0x18ac5c;});});}else{return;}})[_0xd4c2('0x29')](function(_0x12ab44){if(_0x12ab44)_0x2f0bae=_0x12ab44;if(_['includes'](_0x31d8c7,0x3eb)){var _0x3aba8c=_[_0xd4c2('0x5a')](_0x2f0bae,{'sectionId':0x3eb});return getCustomDashboards(_0x3aba8c)[_0xd4c2('0x29')](function(_0x458f29){return _['map'](_0x2f0bae,function(_0x4ff3e9){if(_0x3aba8c['enabled']){if(_0x4ff3e9['sectionId']===0x3eb){_0x4ff3e9[_0xd4c2('0x65')]=_0x458f29;}}else{if(_0x4ff3e9[_0xd4c2('0x5c')]===0x64){_0x4ff3e9['subsections']=_0x458f29;}}return _0x4ff3e9;});});}else{return;}})[_0xd4c2('0x29')](function(_0x554b70){if(_0x554b70)_0x2f0bae=_0x554b70;if(_[_0xd4c2('0x63')](_0x31d8c7,0x709)){var _0x217d6f=_[_0xd4c2('0x5a')](_0x2f0bae,{'sectionId':0x709});return getPlugins(_0x217d6f)[_0xd4c2('0x29')](function(_0x1b047f){if(_0x217d6f['enabled']){return _[_0xd4c2('0x2f')](_0x2f0bae,function(_0x207a61){if(_0x207a61[_0xd4c2('0x5c')]===0x709){_0x207a61[_0xd4c2('0x65')]=_0x1b047f;}return _0x207a61;});}else{var _0x3dc400={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1b047f};var _0x46f18b=_[_0xd4c2('0x2f')](_0x2f0bae);_0x46f18b['push'](_0x3dc400);return _0x46f18b;}});}else{return;}})[_0xd4c2('0x29')](function(_0x92dcf0){if(_0x92dcf0)_0x2f0bae=_0x92dcf0;return _[_0xd4c2('0x41')](_0x2f0bae,[_0xd4c2('0x66'),0x1]);})[_0xd4c2('0x29')](respondWithResult(_0x5e864a,null))[_0xd4c2('0x48')](handleError(_0x5e864a,null));};function hasDefaultDashboard(_0x504564){var _0x2ff7ed=[0x65];return new BPromise(function(_0x248899,_0x467d99){try{if(_0x504564[_0xd4c2('0x55')]){_0x248899(_0x2ff7ed);}else{return db[_0xd4c2('0x56')][_0xd4c2('0x67')]({'where':{'sectionId':_0x504564['id']},'raw':!![]})['then'](function(_0x2d6adc){_0x2d6adc?_0x248899(_0x2ff7ed):_0x248899();});}}catch(_0x41d342){_0x467d99(_0x41d342);}});}function getCustomDashboards(_0x4742aa){var _0x243625=[];return new BPromise(function(_0x56c76a,_0x110db4){try{if(_0x4742aa[_0xd4c2('0x55')]){return db[_0xd4c2('0x68')][_0xd4c2('0x46')]({'raw':!![]})[_0xd4c2('0x29')](function(_0x5ddae0){_0x5ddae0[_0xd4c2('0x69')](function(_0x367051){_0x243625[_0xd4c2('0x5f')](_0x367051['id']+0x1869f);});_0x56c76a(_0x243625);});}else{return db['UserProfileResource'][_0xd4c2('0x46')]({'where':{'sectionId':_0x4742aa['id']},'raw':!![]})['then'](function(_0x136124){_0x136124[_0xd4c2('0x69')](function(_0x1d2b1b){_0x243625[_0xd4c2('0x5f')](_0x1d2b1b['resourceId']+0x1869f);});_0x56c76a(_0x243625);});}}catch(_0x48bfcc){_0x110db4(_0x48bfcc);}});}function getPlugins(_0x546c8f){var _0x476b58=[];return new BPromise(function(_0x16570f,_0x5eccb0){try{if(_0x546c8f[_0xd4c2('0x55')]){return db['Plugin']['findAll']({'raw':!![]})[_0xd4c2('0x29')](function(_0xdfdddd){_0xdfdddd[_0xd4c2('0x69')](function(_0x67c010){_0x476b58['push'](_0x67c010['id']+0x15b38);});_0x16570f(_0x476b58);});}else{return db[_0xd4c2('0x56')]['findAll']({'where':{'sectionId':_0x546c8f['id']},'raw':!![]})[_0xd4c2('0x29')](function(_0x163182){_0x163182[_0xd4c2('0x69')](function(_0x366822){_0x476b58[_0xd4c2('0x5f')](_0x366822[_0xd4c2('0x6a')]+0x15b38);});_0x16570f(_0x476b58);});}}catch(_0x5330eb){_0x5eccb0(_0x5330eb);}});}exports[_0xd4c2('0x6b')]=function(_0x578bfc,_0x3141c6){return db[_0xd4c2('0x30')]['find']({'where':{'id':_0x578bfc[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x3141c6,null))[_0xd4c2('0x29')](function(_0x23406e){if(_0x23406e){return db['sequelize'][_0xd4c2('0x5b')](function(_0x33a46e){return db[_0xd4c2('0x53')][_0xd4c2('0x46')]({'where':{'userProfileId':_0x578bfc[_0xd4c2('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xd4c2('0x29')](function(_0x48054f){if(_0x48054f){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x578bfc['params']['id'],'id':_[_0xd4c2('0x2f')](_0x48054f,function(_0x43eb5a){return _0x43eb5a['id'];})},'transaction':_0x33a46e});}})['then'](function(_0x466e44){var _0x37c834=_[_0xd4c2('0x2f')](_0x578bfc['body'],function(_0x36c437){_0x36c437[_0xd4c2('0x5d')]=_0x578bfc[_0xd4c2('0x4a')]['id'];return _0x36c437;});return db[_0xd4c2('0x53')][_0xd4c2('0x6c')](_0x37c834,{'raw':!![],'transaction':_0x33a46e});})[_0xd4c2('0x29')](function(_0x1acf6b){var _0x27347c=_[_0xd4c2('0x41')](_[_0xd4c2('0x2f')](_0x1acf6b,function(_0x60d4ef){return _0x60d4ef[_0xd4c2('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x27347c){return db['UserProfileSection'][_0xd4c2('0x46')]({'where':{'userProfileId':_0x578bfc[_0xd4c2('0x4a')]['id'],'sectionId':_['map'](_0x27347c,function(_0x293523){return _0x293523[_0xd4c2('0x5c')];})},'attributes':['id',_0xd4c2('0x5c')],'raw':!![]})['then'](function(_0x5694b7){var _0x35a1b9=_[_0xd4c2('0x2f')](_0x578bfc[_0xd4c2('0x4d')],function(_0x5cd636){_0x5cd636[_0xd4c2('0x5d')]=_0x578bfc[_0xd4c2('0x4a')]['id'];return _0x5cd636;});return db['UserProfileResource'][_0xd4c2('0x6c')](_0x35a1b9,{'raw':!![],'transaction':_0x33a46e});});}})[_0xd4c2('0x48')](handleError(_0x3141c6,null));});}})['then'](function(_0x4010e7){var _0x2e0af0=_[_0xd4c2('0x2f')](_0x4010e7,function(_0x1730fc){return _0x1730fc['get']({'plain':!![]});});})[_0xd4c2('0x29')](respondWithResult(_0x3141c6,null))[_0xd4c2('0x48')](handleError(_0x3141c6,null));};exports['removeResources']=function(_0x3f57ad,_0x4c2132,_0x2850d6){return db[_0xd4c2('0x30')][_0xd4c2('0x5a')]({'where':{'id':_0x3f57ad[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x4c2132,null))[_0xd4c2('0x29')](function(_0x51b2ad){if(_0x51b2ad){return _0x51b2ad[_0xd4c2('0x6d')](_0x3f57ad[_0xd4c2('0x35')][_0xd4c2('0x61')]);}})[_0xd4c2('0x29')](respondWithStatusCode(_0x4c2132,null))[_0xd4c2('0x48')](handleError(_0x4c2132,null));};exports['getResources']=function(_0x52f233,_0x4257b2){var _0x533a5e={'raw':![],'where':{}};var _0x26c21d={};var _0x5de7ed={'count':0x0,'rows':[]};var _0x589e67=_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x6e')];if(typeof _0x589e67===_0xd4c2('0x6f')){throw new db[(_0xd4c2('0x70'))][(_0xd4c2('0x71'))](_0xd4c2('0x72'));}var _0xed514b=_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x73')]||![];var _0x22e836=getQueryModels(_0x589e67,_0xed514b);if(typeof _0x22e836['childModel']===_0xd4c2('0x6f')){throw new db[(_0xd4c2('0x70'))][(_0xd4c2('0x71'))](_0xd4c2('0x74')+_0x589e67+'\x27');}var _0x5a4354=[];if(!_[_0xd4c2('0x64')](_0x22e836[_0xd4c2('0x75')])){_0x5a4354=_0x22e836['parentSections'];}else{_0x5a4354=[{'name':_0x589e67}];}return db[_0xd4c2('0x30')]['findOne']({'where':{'id':_0x52f233[_0xd4c2('0x4a')]['id']}})[_0xd4c2('0x29')](handleEntityNotFound(_0x4257b2,null))['then'](function(_0xc4d3f7){if(_0xc4d3f7){var _0x3b88f4=[];for(var _0x39ddac=0x0;_0x39ddac<_0x5a4354[_0xd4c2('0x4b')];_0x39ddac++){_0x3b88f4[_0xd4c2('0x5f')](db[_0xd4c2('0x53')]['findOne']({'where':{'userProfileId':_0xc4d3f7['id'],'name':_0x5a4354[_0x39ddac][_0xd4c2('0x2c')]},'raw':!![]}));}return BPromise[_0xd4c2('0x76')](_0x3b88f4);}})[_0xd4c2('0x29')](function(_0x49778d){var _0x382789=_[_0xd4c2('0x41')](_0x49778d,function(_0x3aacd1){return _0x3aacd1?_0x3aacd1:undefined;});var _0x2a5fc6=_[_0xd4c2('0x41')](_0x5a4354,['ignore',!![]]);var _0x17f771=_[_0xd4c2('0x64')](_0x382789)&&_[_0xd4c2('0x64')](_0x2a5fc6)?null:_[_0xd4c2('0x77')](_0x2a5fc6,_0x382789);if(_0x17f771){var _0x18bbce=[];for(var _0x193337=0x0;_0x193337<_0x17f771[_0xd4c2('0x4b')];_0x193337++){var _0x1f81d7=_['find'](_0x5a4354,function(_0x390bfe){return _0x17f771[_0x193337]?_0x390bfe[_0xd4c2('0x2c')]===_0x17f771[_0x193337][_0xd4c2('0x2c')]:null;});if(_0x1f81d7){if(_0x17f771[_0x193337][_0xd4c2('0x78')]){_0x18bbce[_0xd4c2('0x5f')](getAllResources(_0x22e836['childModel'],_0x17f771[_0x193337]));}else{if(!_0x17f771[_0x193337][_0xd4c2('0x55')]){_0x18bbce['push'](getAllowedResources(_0x1f81d7,_0x17f771[_0x193337],_0x22e836[_0xd4c2('0x79')]));}else{if(_0x1f81d7['model']){_0x18bbce[_0xd4c2('0x5f')](getAllFilteredResources(_0x1f81d7,_0x17f771[_0x193337]));}}}}}return BPromise[_0xd4c2('0x76')](_0x18bbce);}else{return null;}})[_0xd4c2('0x29')](function(_0x36c759){var _0x9ebb31=_0x36c759;var _0x168628=null;if(_0x9ebb31){_0x168628=_0x9ebb31['length']===0x1?_0x9ebb31[0x0]:null;}if(_0x168628||_0x9ebb31){var _0x3ccdb1=db[_0x22e836['childModel']][_0xd4c2('0x31')];_0x26c21d[_0xd4c2('0x34')]=_[_0xd4c2('0x36')](_0x3ccdb1);_0x26c21d[_0xd4c2('0x35')]=_['keys'](_0x52f233[_0xd4c2('0x35')]);_0x26c21d[_0xd4c2('0x37')]=_[_0xd4c2('0x38')](_0x26c21d[_0xd4c2('0x34')],_0x26c21d['query']);_0x533a5e[_0xd4c2('0x39')]=_[_0xd4c2('0x38')](_0x26c21d[_0xd4c2('0x34')],qs['fields'](_0x52f233['query']['fields']));_0x533a5e[_0xd4c2('0x39')]=_0x533a5e[_0xd4c2('0x39')][_0xd4c2('0x4b')]?_0x533a5e[_0xd4c2('0x39')]:_0x26c21d[_0xd4c2('0x34')];if(!_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x3b')](_0xd4c2('0x3c'))){_0x533a5e['limit']=qs[_0xd4c2('0x3d')](_0x52f233['query'][_0xd4c2('0x3d')]);_0x533a5e[_0xd4c2('0x23')]=qs[_0xd4c2('0x23')](_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x23')]);}_0x533a5e[_0xd4c2('0x7a')]=qs[_0xd4c2('0x3e')](_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x3e')]);_0x533a5e[_0xd4c2('0x3f')]=qs[_0xd4c2('0x37')](_[_0xd4c2('0x40')](_0x52f233[_0xd4c2('0x35')],_0x26c21d[_0xd4c2('0x37')]));if(_0x52f233[_0xd4c2('0x35')]['filter']){_0x533a5e[_0xd4c2('0x3f')]=_['merge'](_0x533a5e[_0xd4c2('0x3f')],{'$or':_[_0xd4c2('0x2f')](_0x3ccdb1,function(_0x298395){if(_0x298395[_0xd4c2('0x33')][_0xd4c2('0x7b')]!=='VIRTUAL'){var _0x32a3e1={};_0x32a3e1[_0x298395[_0xd4c2('0x7c')]]={'$like':'%'+_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x41')]+'%'};return _0x32a3e1;}})});}var _0x17319c=[];if(_0x168628){var _0x4165e6=_[_0xd4c2('0x5a')](_0x5a4354,['name',_0x168628['name']]);if(_0x4165e6[_0xd4c2('0x7c')]){var _0x878f75={};if(_0x22e836['childModel']===_0xd4c2('0x7d')){_0x878f75[_0x4165e6[_0xd4c2('0x7e')]]=_[_0xd4c2('0x2f')](_0x168628[_0xd4c2('0x7f')],'id');}else{_0x878f75[_0x4165e6['foreignKey']]=_0x168628['associatedResources'];}_0x17319c[_0xd4c2('0x5f')](_0x878f75);}else{_0x533a5e[_0xd4c2('0x3f')]['id']=_0x168628[_0xd4c2('0x7f')];}}else{for(var _0x28c1f3=0x0;_0x28c1f3<_0x9ebb31[_0xd4c2('0x4b')];_0x28c1f3++){var _0x4165e6=_[_0xd4c2('0x5a')](_0x5a4354,['name',_0x9ebb31[_0x28c1f3][_0xd4c2('0x2c')]]);if(_0x4165e6['field']){var _0x878f75={};_0x878f75[_0x4165e6[_0xd4c2('0x7e')]]=_0x9ebb31[_0x28c1f3][_0xd4c2('0x7f')];_0x17319c[_0xd4c2('0x5f')](_0x878f75);}else{if(!_0x533a5e[_0xd4c2('0x3f')]['id'])_0x533a5e[_0xd4c2('0x3f')]['id']=[];_0x9ebb31[_0x28c1f3][_0xd4c2('0x7f')][_0xd4c2('0x69')](function(_0x389cfd){_0x533a5e[_0xd4c2('0x3f')]['id'][_0xd4c2('0x5f')](_0x389cfd);});}}}if(!_[_0xd4c2('0x64')](_0x17319c)){_0x533a5e[_0xd4c2('0x3f')]=_['merge'](_0x533a5e[_0xd4c2('0x3f')],{'$and':{'$or':_0x17319c}});}_0x533a5e=_[_0xd4c2('0x42')]({},_0x533a5e,_0x52f233[_0xd4c2('0x44')]);if(_0x168628&&!_0x168628['autoAssociation']&&_0x22e836['childModel']===_0xd4c2('0x7d')){if(_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x45')]){_0x533a5e[_0xd4c2('0x4c')]=[{'all':!![]}];}return db[_0x22e836[_0xd4c2('0x79')]][_0xd4c2('0x46')](_0x533a5e)['then'](function(_0x53d4f1){var _0x1b661b=[];_0x53d4f1[_0xd4c2('0x69')](function(_0x5d3bd9){var _0x77e11d;switch(_0x5d3bd9[_0xd4c2('0x80')]){case _0xd4c2('0x81'):_0x77e11d=_[_0xd4c2('0x5a')](_0x168628[_0xd4c2('0x7f')],function(_0x5c7c12){return _0x5c7c12['id']===_0x5d3bd9[_0xd4c2('0x82')]&&_0x5c7c12['type']===_0xd4c2('0x83');});break;case _0xd4c2('0x84'):_0x77e11d=_[_0xd4c2('0x5a')](_0x168628[_0xd4c2('0x7f')],function(_0x112ddd){return _0x112ddd['id']===_0x5d3bd9[_0xd4c2('0x82')]&&_0x112ddd[_0xd4c2('0x33')]===_0xd4c2('0x85');});break;}if(_0x77e11d)_0x1b661b['push'](_0x5d3bd9);});_0x5de7ed[_0xd4c2('0x22')]=_0x1b661b[_0xd4c2('0x4b')];_0x5de7ed[_0xd4c2('0x47')]=_0x1b661b;return _0x5de7ed;});}else{return db[_0x22e836['childModel']][_0xd4c2('0x22')]({'where':_0x533a5e[_0xd4c2('0x3f')]})[_0xd4c2('0x29')](function(_0x394722){_0x5de7ed[_0xd4c2('0x22')]=_0x394722;if(_0x52f233['query'][_0xd4c2('0x45')]){if(_0x22e836[_0xd4c2('0x79')]==='CmContact'){_0x533a5e['include']=[{'model':db[_0xd4c2('0x86')],'as':'Tags','attributes':['id','name',_0xd4c2('0x87')],'required':_0x52f233[_0xd4c2('0x35')]['tag']?!![]:![]},{'model':db[_0xd4c2('0x86')],'as':'ThroughTags','attributes':['id','name',_0xd4c2('0x87')],'through':_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x88')]?{'attributes':[],'where':{'TagId':_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x88')]||undefined}}:{},'required':_0x52f233[_0xd4c2('0x35')][_0xd4c2('0x88')]?!![]:![]}];}else{_0x533a5e[_0xd4c2('0x4c')]=[{'all':!![]}];}}return db[_0x22e836[_0xd4c2('0x79')]][_0xd4c2('0x46')](_0x533a5e);})[_0xd4c2('0x29')](function(_0x439b73){_0x5de7ed[_0xd4c2('0x47')]=_0x439b73;return _0x5de7ed;});}}else{return _0x5de7ed;}})[_0xd4c2('0x29')](respondWithFilteredResult(_0x4257b2,_0x533a5e))[_0xd4c2('0x48')](handleError(_0x4257b2,null));};function getAllResources(_0x1d7568,_0x458d1c){return new BPromise(function(_0x5b0c79,_0x817820){if(_0x458d1c){var _0x244037=_0x458d1c[_0xd4c2('0x41')]?{[_0x458d1c['filter'][_0xd4c2('0x7c')]]:_0x458d1c[_0xd4c2('0x41')]['value']}:undefined;return db[_0x1d7568][_0xd4c2('0x46')]({'where':_0x244037,'raw':!![]})[_0xd4c2('0x29')](function(_0x42a37d){_0x458d1c[_0xd4c2('0x7f')]=_[_0xd4c2('0x2f')](_0x42a37d,'id');_0x5b0c79(_0x458d1c);})[_0xd4c2('0x48')](function(_0x444c6b){_0x817820(_0x444c6b);});}else{_0x5b0c79(null);}});}function getAllFilteredResources(_0x52430c,_0x6fd2c2){return new BPromise(function(_0x582caa,_0xf3e1e7){var _0x10512d=_0x52430c['filter']?{[_0x52430c[_0xd4c2('0x41')][_0xd4c2('0x7c')]]:_0x52430c[_0xd4c2('0x41')][_0xd4c2('0x89')]}:undefined;return db[_0x52430c['model']][_0xd4c2('0x46')]({'where':_0x10512d,'raw':!![]})['then'](function(_0x1a22a6){_0x6fd2c2[_0xd4c2('0x7f')]=_[_0xd4c2('0x2f')](_0x1a22a6,function(_0x210412){return _0x210412[_0xd4c2('0x2c')];});_0x582caa(_0x6fd2c2);})[_0xd4c2('0x48')](function(_0x2c983d){_0xf3e1e7(_0x2c983d);});});}function getAllowedResources(_0x3bd912,_0x512789,_0xa82db1){return new BPromise(function(_0x386b27,_0x43a0e5){if(_0x512789){return db[_0xd4c2('0x56')]['findAll']({'where':{'sectionId':_0x512789['id']},'raw':!![]})[_0xd4c2('0x29')](function(_0x1dcdba){if(_0x3bd912[_0xd4c2('0x7c')]&&_0x3bd912[_0xd4c2('0x7c')]!=='id'){_0x512789[_0xd4c2('0x7f')]=_[_0xd4c2('0x2f')](_0x1dcdba,function(_0x9345b6){return _0x9345b6[_0x3bd912[_0xd4c2('0x7c')]];});}else{if(_0xa82db1===_0xd4c2('0x7d')){_0x512789[_0xd4c2('0x7f')]=_[_0xd4c2('0x2f')](_0x1dcdba,function(_0x12e79b){return{'id':_0x12e79b[_0xd4c2('0x6a')],'type':_0x12e79b[_0xd4c2('0x33')]};});}else{_0x512789[_0xd4c2('0x7f')]=_[_0xd4c2('0x2f')](_0x1dcdba,function(_0x22e28d){return _0x22e28d[_0xd4c2('0x6a')];});}}_0x386b27(_0x512789);})[_0xd4c2('0x48')](function(_0x178140){_0x43a0e5(_0x178140);});}else{_0x386b27(null);}});}function getQueryModels(_0x34aebe,_0x4c188a){var _0x578eb2=_0x34aebe[_0xd4c2('0x8a')]();var _0x4810b9={'childModel':undefined,'parentSections':[]};switch(_0x578eb2){case _0xd4c2('0x8b'):_0x4810b9[_0xd4c2('0x79')]='SquareProject';break;case _0xd4c2('0x8c'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x8d');break;case _0xd4c2('0x8e'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x8f');_0x4810b9[_0xd4c2('0x75')]=[{'name':_0xd4c2('0x90'),'field':_0xd4c2('0x2c'),'foreignKey':'projectName'}];break;case _0xd4c2('0x91'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x92');break;case _0xd4c2('0x93'):_0x4810b9['childModel']=_0xd4c2('0x94');_0x4810b9[_0xd4c2('0x75')]=[{'name':'Lists','field':'id','foreignKey':_0xd4c2('0x95')}];break;case'lists':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x96');break;case _0xd4c2('0x97'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x98');break;case'globalcustomfields':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x99');break;case _0xd4c2('0x9a'):_0x4810b9[_0xd4c2('0x79')]='ChatQueue';break;case _0xd4c2('0x9b'):_0x4810b9[_0xd4c2('0x79')]='ChatWebsite';break;case _0xd4c2('0x9c'):_0x4810b9['childModel']='FaxQueue';break;case _0xd4c2('0x9d'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x9e');break;case'inboundroutes':case'internalroutes':case _0xd4c2('0x9f'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xa0');break;case _0xd4c2('0xa1'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xa2');break;case _0xd4c2('0xa3'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xa4');break;case _0xd4c2('0xa5'):_0x4810b9['childModel']=_0xd4c2('0xa6');_0x4810b9[_0xd4c2('0x75')]=[{'name':'Agents','field':_0xd4c2('0x2c'),'foreignKey':'membername','model':'User','filter':{'field':_0xd4c2('0xa7'),'value':[_0xd4c2('0xa8')]}},{'name':_0xd4c2('0xa9'),'field':_0xd4c2('0x2c'),'foreignKey':'membername','model':_0xd4c2('0xaa'),'filter':{'field':_0xd4c2('0xa7'),'value':[_0xd4c2('0xab')]}},{'name':_0xd4c2('0xac'),'field':'name','foreignKey':_0xd4c2('0xad'),'model':_0xd4c2('0xae'),'filter':{'field':_0xd4c2('0x33'),'value':[_0xd4c2('0xaf')]}},{'name':_0xd4c2('0xb0'),'field':_0xd4c2('0x2c'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0xd4c2('0xb1')]}}];break;case'musiconholds':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xb2');break;case _0xd4c2('0xb3'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xb4');break;case _0xd4c2('0xb5'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xb6');break;case _0xd4c2('0xb7'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xb8');break;case'mailqueues':_0x4810b9['childModel']=_0xd4c2('0xb9');break;case _0xd4c2('0xba'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xbb');break;case'mailsubstatuses':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xbc');break;case _0xd4c2('0xbd'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xbe');break;case _0xd4c2('0xbf'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xc0');break;case _0xd4c2('0xc1'):_0x4810b9['childModel']=_0xd4c2('0xc2');break;case _0xd4c2('0xc3'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xc4');break;case _0xd4c2('0xc5'):_0x4810b9[_0xd4c2('0x79')]='WhatsappQueue';break;case _0xd4c2('0xc6'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xc7');break;case'teams':_0x4810b9[_0xd4c2('0x79')]='Team';break;case _0xd4c2('0xc8'):case _0xd4c2('0xc9'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xae');if(_0x4c188a){_0x4810b9['parentSections']=[{'name':_0xd4c2('0xac')},{'name':_0xd4c2('0xb0')}];}break;case _0xd4c2('0xca'):case _0xd4c2('0xcb'):case _0xd4c2('0xcc'):_0x4810b9['childModel']=_0xd4c2('0xaa');if(_0x4c188a){_0x4810b9[_0xd4c2('0x75')]=[{'name':'Users','filter':{'field':'role','value':[_0xd4c2('0xcd'),_0xd4c2('0xce')]},'ignore':!![]},{'name':_0xd4c2('0xcf')},{'name':_0xd4c2('0xa9')}];}break;case _0xd4c2('0xd0'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xd1');break;case _0xd4c2('0xd2'):_0x4810b9['childModel']=_0xd4c2('0xd3');break;case _0xd4c2('0xd4'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xd5');break;case _0xd4c2('0xd6'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xd7');break;case _0xd4c2('0xd8'):_0x4810b9[_0xd4c2('0x79')]='DeskAccount';break;case'zohoaccounts':_0x4810b9['childModel']=_0xd4c2('0xd9');break;case _0xd4c2('0xda'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xaa');break;case _0xd4c2('0xdb'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xdc');break;case'dispositions':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xdd');break;case _0xd4c2('0xde'):_0x4810b9['childModel']=_0xd4c2('0x68');break;case _0xd4c2('0xdf'):_0x4810b9['childModel']=_0xd4c2('0xe0');break;case _0xd4c2('0xe1'):_0x4810b9[_0xd4c2('0x79')]='Pause';break;case _0xd4c2('0xe2'):_0x4810b9['childModel']='Schedule';break;case'sounds':_0x4810b9['childModel']='Sound';break;case _0xd4c2('0xe3'):_0x4810b9[_0xd4c2('0x79')]='Tag';break;case _0xd4c2('0xe4'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xe5');break;case _0xd4c2('0xe6'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xe7');break;case _0xd4c2('0xe8'):_0x4810b9[_0xd4c2('0x79')]='Trunk';break;case _0xd4c2('0xe9'):_0x4810b9[_0xd4c2('0x79')]='Variable';break;case'plugins':_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0xea');break;case _0xd4c2('0xeb'):_0x4810b9[_0xd4c2('0x79')]=_0xd4c2('0x7d');_0x4810b9[_0xd4c2('0x75')]=[{'name':_0xd4c2('0xec'),'field':'id','foreignKey':'reportId'}];break;case _0xd4c2('0xed'):_0x4810b9['childModel']=_0xd4c2('0xee');break;case'whatsappaccounts':_0x4810b9[_0xd4c2('0x79')]='WhatsappAccount';break;default:return _0x4810b9;}return _0x4810b9;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 8f231b7..f3bc275 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 _0x9383=['hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','update','remove','hasOwnProperty'];(function(_0x1fc3b6,_0x4efd2){var _0xa0f9f6=function(_0x3c9960){while(--_0x3c9960){_0x1fc3b6['push'](_0x1fc3b6['shift']());}};_0xa0f9f6(++_0x4efd2);}(_0x9383,0xec));var _0x3938=function(_0x5a7cc6,_0x12f72e){_0x5a7cc6=_0x5a7cc6-0x0;var _0x5b805b=_0x9383[_0x5a7cc6];return _0x5b805b;};'use strict';var EventEmitter=require(_0x3938('0x0'));var UserProfile=require(_0x3938('0x1'))['db'][_0x3938('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3938('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3938('0x4'),'afterDestroy':_0x3938('0x5')};function emitEvent(_0x284873){return function(_0x56968a,_0x298501,_0x374e88){UserProfileEvents['emit'](_0x284873+':'+_0x56968a['id'],_0x56968a);UserProfileEvents['emit'](_0x284873,_0x56968a);_0x374e88(null);};}for(var e in events){if(events[_0x3938('0x6')](e)){var event=events[e];UserProfile[_0x3938('0x7')](e,emitEvent(event));}}module[_0x3938('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x5204=['remove','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x59006c,_0x59645d){var _0x3510af=function(_0x21412b){while(--_0x21412b){_0x59006c['push'](_0x59006c['shift']());}};_0x3510af(++_0x59645d);}(_0x5204,0xe4));var _0x4520=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0x5204[_0x124298];return _0x35ac24;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x4520('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4520('0x1')](0x0);var events={'afterCreate':_0x4520('0x2'),'afterUpdate':_0x4520('0x3'),'afterDestroy':_0x4520('0x4')};function emitEvent(_0x3afae0){return function(_0x414d8b,_0x386b08,_0xf03f6a){UserProfileEvents['emit'](_0x3afae0+':'+_0x414d8b['id'],_0x414d8b);UserProfileEvents['emit'](_0x3afae0,_0x414d8b);_0xf03f6a(null);};}for(var e in events){if(events[_0x4520('0x5')](e)){var event=events[e];UserProfile[_0x4520('0x6')](e,emitEvent(event));}}module[_0x4520('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 8219993..47c5621 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 _0x9c74=['define','UserProfile','user_profiles','lodash','util','api','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports'];(function(_0x136a01,_0x3e0f10){var _0x39ccee=function(_0x1fa530){while(--_0x1fa530){_0x136a01['push'](_0x136a01['shift']());}};_0x39ccee(++_0x3e0f10);}(_0x9c74,0xe7));var _0x49c7=function(_0x11a846,_0x2c29cb){_0x11a846=_0x11a846-0x0;var _0x2b8c28=_0x9c74[_0x11a846];return _0x2b8c28;};'use strict';var _=require(_0x49c7('0x0'));var util=require(_0x49c7('0x1'));var logger=require('../../config/logger')(_0x49c7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x49c7('0x3'));var fs=require('fs');var path=require(_0x49c7('0x4'));var rimraf=require(_0x49c7('0x5'));var config=require(_0x49c7('0x6'));var attributes=require(_0x49c7('0x7'));module[_0x49c7('0x8')]=function(_0x4429f8,_0xb349f5){return _0x4429f8[_0x49c7('0x9')](_0x49c7('0xa'),attributes,{'tableName':_0x49c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc0e=['moment','bluebird','request-promise','path','rimraf','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','util','api'];(function(_0x27d895,_0x4791ce){var _0x204118=function(_0x833c2b){while(--_0x833c2b){_0x27d895['push'](_0x27d895['shift']());}};_0x204118(++_0x4791ce);}(_0xfc0e,0x8c));var _0xefc0=function(_0x115d5b,_0x26aff2){_0x115d5b=_0x115d5b-0x0;var _0x6cfc50=_0xfc0e[_0x115d5b];return _0x6cfc50;};'use strict';var _=require(_0xefc0('0x0'));var util=require(_0xefc0('0x1'));var logger=require('../../config/logger')(_0xefc0('0x2'));var moment=require(_0xefc0('0x3'));var BPromise=require(_0xefc0('0x4'));var rp=require(_0xefc0('0x5'));var fs=require('fs');var path=require(_0xefc0('0x6'));var rimraf=require(_0xefc0('0x7'));var config=require('../../config/environment');var attributes=require(_0xefc0('0x8'));module[_0xefc0('0x9')]=function(_0x493e97,_0x4b3690){return _0x493e97[_0xefc0('0xa')](_0xefc0('0xb'),attributes,{'tableName':_0xefc0('0xc'),'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 34ec0de..0a8a6b2 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 _0xdc97=['redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserProfile,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x54b83b,_0x50919b){var _0x4e4405=function(_0x2f420f){while(--_0x2f420f){_0x54b83b['push'](_0x54b83b['shift']());}};_0x4e4405(++_0x50919b);}(_0xdc97,0x13b));var _0x7dc9=function(_0xb0aecb,_0x4ee98f){_0xb0aecb=_0xb0aecb-0x0;var _0xb8f0f2=_0xdc97[_0xb0aecb];return _0xb8f0f2;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dc9('0x4'))['db'];var utils=require(_0x7dc9('0x5'));var logger=require('../../config/logger')(_0x7dc9('0x6'));var config=require(_0x7dc9('0x7'));var jayson=require(_0x7dc9('0x8'));var client=jayson[_0x7dc9('0x9')]['http']({'port':0x232a});config[_0x7dc9('0xa')]=_['defaults'](config['redis'],{'host':_0x7dc9('0xb'),'port':0x18eb});var socket=require(_0x7dc9('0xc'))(new Redis(config[_0x7dc9('0xa')]));require(_0x7dc9('0xd'))[_0x7dc9('0xe')](socket);function respondWithRpcPromise(_0x5ca05b,_0xb2fa2a,_0x44fe24){return new BPromise(function(_0x37dfc,_0x1dc3f7){return client[_0x7dc9('0xf')](_0x5ca05b,_0x44fe24)[_0x7dc9('0x10')](function(_0x1e336a){logger['info']('UserProfile,\x20%s,\x20%s',_0xb2fa2a,'request\x20sent');logger['debug'](_0x7dc9('0x11'),_0xb2fa2a,_0x7dc9('0x12'),JSON['stringify'](_0x1e336a));if(_0x1e336a[_0x7dc9('0x13')]){if(_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x14')]===0x1f4){logger[_0x7dc9('0x13')](_0x7dc9('0x15'),_0xb2fa2a,_0x1e336a[_0x7dc9('0x13')]['message']);return _0x1dc3f7(_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x16')]);}logger[_0x7dc9('0x13')](_0x7dc9('0x15'),_0xb2fa2a,_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x16')]);return _0x37dfc(_0x1e336a[_0x7dc9('0x13')][_0x7dc9('0x16')]);}else{logger[_0x7dc9('0x17')]('UserProfile,\x20%s,\x20%s',_0xb2fa2a,_0x7dc9('0x12'));_0x37dfc(_0x1e336a['result'][_0x7dc9('0x16')]);}})[_0x7dc9('0x18')](function(_0x5d61d7){logger[_0x7dc9('0x13')](_0x7dc9('0x15'),_0xb2fa2a,_0x5d61d7);_0x1dc3f7(_0x5d61d7);});});} \ No newline at end of file +var _0xeff8=['./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x378a11,_0x4b214e){var _0x3a02e4=function(_0x1e5b47){while(--_0x1e5b47){_0x378a11['push'](_0x378a11['shift']());}};_0x3a02e4(++_0x4b214e);}(_0xeff8,0x186));var _0x8eff=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xeff8[_0x3afe18];return _0x19ed1f;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var moment=require('moment');var BPromise=require(_0x8eff('0x2'));var rs=require(_0x8eff('0x3'));var fs=require('fs');var Redis=require(_0x8eff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eff('0x5'));var logger=require(_0x8eff('0x6'))(_0x8eff('0x7'));var config=require(_0x8eff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8eff('0x9')][_0x8eff('0xa')]({'port':0x232a});config[_0x8eff('0xb')]=_[_0x8eff('0xc')](config['redis'],{'host':_0x8eff('0xd'),'port':0x18eb});var socket=require(_0x8eff('0xe'))(new Redis(config[_0x8eff('0xb')]));require(_0x8eff('0xf'))['register'](socket);function respondWithRpcPromise(_0x56f120,_0x359d62,_0x430b45){return new BPromise(function(_0xb2117e,_0x52d250){return client[_0x8eff('0x10')](_0x56f120,_0x430b45)[_0x8eff('0x11')](function(_0x5172a5){logger[_0x8eff('0x12')](_0x8eff('0x13'),_0x359d62,'request\x20sent');logger['debug'](_0x8eff('0x14'),_0x359d62,_0x8eff('0x15'),JSON[_0x8eff('0x16')](_0x5172a5));if(_0x5172a5[_0x8eff('0x17')]){if(_0x5172a5[_0x8eff('0x17')]['code']===0x1f4){logger[_0x8eff('0x17')](_0x8eff('0x13'),_0x359d62,_0x5172a5[_0x8eff('0x17')][_0x8eff('0x18')]);return _0x52d250(_0x5172a5[_0x8eff('0x17')][_0x8eff('0x18')]);}logger[_0x8eff('0x17')](_0x8eff('0x13'),_0x359d62,_0x5172a5[_0x8eff('0x17')][_0x8eff('0x18')]);return _0xb2117e(_0x5172a5[_0x8eff('0x17')]['message']);}else{logger[_0x8eff('0x12')](_0x8eff('0x13'),_0x359d62,_0x8eff('0x15'));_0xb2117e(_0x5172a5[_0x8eff('0x19')][_0x8eff('0x18')]);}})[_0x8eff('0x1a')](function(_0x38f5ee){logger[_0x8eff('0x17')](_0x8eff('0x13'),_0x359d62,_0x38f5ee);_0x52d250(_0x38f5ee);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 0b00ada..2680f69 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 _0x9be1=['register','userProfile:','./userProfile.events','save','remove','update','emit','removeListener'];(function(_0x2a02f8,_0x69bc26){var _0x266beb=function(_0x4f3fb5){while(--_0x4f3fb5){_0x2a02f8['push'](_0x2a02f8['shift']());}};_0x266beb(++_0x69bc26);}(_0x9be1,0x1c2));var _0x19be=function(_0x38faa4,_0x4d90a2){_0x38faa4=_0x38faa4-0x0;var _0x652493=_0x9be1[_0x38faa4];return _0x652493;};'use strict';var UserProfileEvents=require(_0x19be('0x0'));var events=[_0x19be('0x1'),_0x19be('0x2'),_0x19be('0x3')];function createListener(_0x309b81,_0x14e644){return function(_0x44da91){_0x14e644[_0x19be('0x4')](_0x309b81,_0x44da91);};}function removeListener(_0x51067b,_0x7b876e){return function(){UserProfileEvents[_0x19be('0x5')](_0x51067b,_0x7b876e);};}exports[_0x19be('0x6')]=function(_0x417659){for(var _0x3640bd=0x0,_0x22cc48=events['length'];_0x3640bd<_0x22cc48;_0x3640bd++){var _0x54b45c=events[_0x3640bd];var _0x304168=createListener(_0x19be('0x7')+_0x54b45c,_0x417659);UserProfileEvents['on'](_0x54b45c,_0x304168);}}; \ No newline at end of file +var _0xd325=['removeListener','length','userProfile:','remove','emit'];(function(_0x2a27d1,_0x282ce8){var _0x1e0843=function(_0xd97732){while(--_0xd97732){_0x2a27d1['push'](_0x2a27d1['shift']());}};_0x1e0843(++_0x282ce8);}(_0xd325,0x14d));var _0x5d32=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0xd325[_0x1dd532];return _0x3732aa;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x5d32('0x0'),'update'];function createListener(_0x208d7a,_0x2ad45f){return function(_0xa83b38){_0x2ad45f[_0x5d32('0x1')](_0x208d7a,_0xa83b38);};}function removeListener(_0x14d972,_0xf558d6){return function(){UserProfileEvents[_0x5d32('0x2')](_0x14d972,_0xf558d6);};}exports['register']=function(_0x46d614){for(var _0x464d15=0x0,_0x2ee500=events[_0x5d32('0x3')];_0x464d15<_0x2ee500;_0x464d15++){var _0x443f75=events[_0x464d15];var _0x4445be=createListener(_0x5d32('0x4')+_0x443f75,_0x46d614);UserProfileEvents['on'](_0x443f75,_0x4445be);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index ad13aa6..370fd6c 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 _0x578c=['/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put'];(function(_0x34df4a,_0x209d10){var _0x145c69=function(_0xb9bcbd){while(--_0xb9bcbd){_0x34df4a['push'](_0x34df4a['shift']());}};_0x145c69(++_0x209d10);}(_0x578c,0x1e8));var _0xc578=function(_0x209a80,_0x3df498){_0x209a80=_0x209a80-0x0;var _0x453a9d=_0x578c[_0x209a80];return _0x453a9d;};'use strict';var multer=require(_0xc578('0x0'));var util=require(_0xc578('0x1'));var path=require(_0xc578('0x2'));var timeout=require(_0xc578('0x3'));var express=require(_0xc578('0x4'));var router=express[_0xc578('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc578('0x6'));var config=require(_0xc578('0x7'));var controller=require(_0xc578('0x8'));router[_0xc578('0x9')]('/',auth[_0xc578('0xa')](),controller[_0xc578('0xb')]);router['get'](_0xc578('0xc'),auth[_0xc578('0xa')](),controller[_0xc578('0xd')]);router[_0xc578('0x9')]('/:id',auth[_0xc578('0xa')](),controller[_0xc578('0xe')]);router[_0xc578('0xf')]('/',auth[_0xc578('0xa')](),controller[_0xc578('0x10')]);router[_0xc578('0x11')](_0xc578('0x12'),auth['isAuthenticated'](),controller[_0xc578('0x13')]);router[_0xc578('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xc578('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe206=['show','post','create','put','/:id','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','/describe','describe'];(function(_0x247176,_0x2b6f40){var _0x26839e=function(_0x210380){while(--_0x210380){_0x247176['push'](_0x247176['shift']());}};_0x26839e(++_0x2b6f40);}(_0xe206,0x1e4));var _0x6e20=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xe206[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require('multer');var util=require(_0x6e20('0x0'));var path=require(_0x6e20('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6e20('0x2')]();var auth=require(_0x6e20('0x3'));var interaction=require(_0x6e20('0x4'));var config=require('../../config/environment');var controller=require(_0x6e20('0x5'));router[_0x6e20('0x6')]('/',auth[_0x6e20('0x7')](),controller['index']);router['get'](_0x6e20('0x8'),auth[_0x6e20('0x7')](),controller[_0x6e20('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6e20('0xa')]);router[_0x6e20('0xb')]('/',auth[_0x6e20('0x7')](),controller[_0x6e20('0xc')]);router[_0x6e20('0xd')](_0x6e20('0xe'),auth[_0x6e20('0x7')](),controller[_0x6e20('0xf')]);router[_0x6e20('0x10')](_0x6e20('0xe'),auth[_0x6e20('0x7')](),controller[_0x6e20('0x11')]);module[_0x6e20('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 99c0ed3..ac5fe7a 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 _0x876d=['STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x876d,0x1e8));var _0xd876=function(_0x58b01d,_0x5a2303){_0x58b01d=_0x58b01d-0x0;var _0x572cc2=_0x876d[_0x58b01d];return _0x572cc2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd876('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xd876('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xeb2c=['exports','STRING','INTEGER','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeb2c,0xf7));var _0xceb2=function(_0x359994,_0x45527b){_0x359994=_0x359994-0x0;var _0x3e0575=_0xeb2c[_0x359994];return _0x3e0575;};'use strict';var Sequelize=require(_0xceb2('0x0'));module[_0xceb2('0x1')]={'name':{'type':Sequelize[_0xceb2('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xceb2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xceb2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 3d3c562..80542a3 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 _0xabce=['Content-Range','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','keys','options','UserProfileResource','find','catch','create','body','params','describe','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','sendStatus','end','json','count','offset','limit','status','set'];(function(_0x4bcc22,_0x5a9086){var _0x43fa37=function(_0x1f63d3){while(--_0x1f63d3){_0x4bcc22['push'](_0x4bcc22['shift']());}};_0x43fa37(++_0x5a9086);}(_0xabce,0x103));var _0xeabc=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xabce[_0x5e3b04];return _0x1fc44d;};'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'];function respondWithStatusCode(_0x435ea7,_0x3fd0b5){_0x3fd0b5=_0x3fd0b5||0xcc;return function(_0x36a92e){if(_0x36a92e){return _0x435ea7[_0xeabc('0x19')](_0x3fd0b5);}return _0x435ea7['status'](_0x3fd0b5)[_0xeabc('0x1a')]();};}function respondWithResult(_0x1319f3,_0x3251c6){_0x3251c6=_0x3251c6||0xc8;return function(_0x55f0de){if(_0x55f0de){return _0x1319f3['status'](_0x3251c6)[_0xeabc('0x1b')](_0x55f0de);}};}function respondWithFilteredResult(_0x3ae954,_0x326bac){return function(_0x53d5cb){if(_0x53d5cb){var _0xf913d7=_0x53d5cb[_0xeabc('0x1c')],_0x638976=_0x326bac['offset'],_0x49f2d8=_0x326bac[_0xeabc('0x1d')]+_0x326bac[_0xeabc('0x1e')],_0x53fe28;if(_0x49f2d8>=_0xf913d7){_0x49f2d8=_0xf913d7;_0x53fe28=0xc8;}else{_0x53fe28=0xce;}_0x3ae954[_0xeabc('0x1f')](_0x53fe28);return _0x3ae954[_0xeabc('0x20')](_0xeabc('0x21'),_0x638976+'-'+_0x49f2d8+'/'+_0xf913d7)[_0xeabc('0x1b')](_0x53d5cb);}return null;};}function patchUpdates(_0x384be5){return function(_0x5e30ee){try{jsonpatch['apply'](_0x5e30ee,_0x384be5,!![]);}catch(_0x1253e4){return BPromise['reject'](_0x1253e4);}return _0x5e30ee[_0xeabc('0x22')]();};}function saveUpdates(_0x16530c,_0x502947){return function(_0x28063a){if(_0x28063a){return _0x28063a[_0xeabc('0x23')](_0x16530c)[_0xeabc('0x24')](function(_0x184e60){return _0x184e60;});}return null;};}function removeEntity(_0x3c9611,_0x4e99a4){return function(_0xecdbf){if(_0xecdbf){return _0xecdbf[_0xeabc('0x25')]()[_0xeabc('0x24')](function(){_0x3c9611['status'](0xcc)[_0xeabc('0x1a')]();});}};}function handleEntityNotFound(_0x3854d2,_0x214953){return function(_0x319119){if(!_0x319119){_0x3854d2['sendStatus'](0x194);}return _0x319119;};}function handleError(_0x109e1d,_0x480440){_0x480440=_0x480440||0x1f4;return function(_0x27dbaf){logger['error'](_0x27dbaf[_0xeabc('0x26')]);if(_0x27dbaf[_0xeabc('0x27')]){delete _0x27dbaf[_0xeabc('0x27')];}_0x109e1d[_0xeabc('0x1f')](_0x480440)[_0xeabc('0x28')](_0x27dbaf);};}exports[_0xeabc('0x29')]=function(_0x131722,_0x4c2693){var _0x5b2934={},_0x459c8a={},_0x5bf8f2={'count':0x0,'rows':[]};var _0x3c1b5b=_[_0xeabc('0x2a')](db['UserProfileResource'][_0xeabc('0x2b')],function(_0x38572d){return{'name':_0x38572d[_0xeabc('0x2c')],'type':_0x38572d[_0xeabc('0x2d')][_0xeabc('0x2e')]};});_0x459c8a[_0xeabc('0x2f')]=_[_0xeabc('0x2a')](_0x3c1b5b,_0xeabc('0x27'));_0x459c8a[_0xeabc('0x30')]=_['keys'](_0x131722[_0xeabc('0x30')]);_0x459c8a['filters']=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],_0x459c8a[_0xeabc('0x30')]);_0x5b2934[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0x459c8a[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x131722['query'][_0xeabc('0x33')]));_0x5b2934[_0xeabc('0x32')]=_0x5b2934[_0xeabc('0x32')]['length']?_0x5b2934[_0xeabc('0x32')]:_0x459c8a[_0xeabc('0x2f')];if(!_0x131722[_0xeabc('0x30')]['hasOwnProperty'](_0xeabc('0x34'))){_0x5b2934[_0xeabc('0x1e')]=qs[_0xeabc('0x1e')](_0x131722['query'][_0xeabc('0x1e')]);_0x5b2934[_0xeabc('0x1d')]=qs['offset'](_0x131722['query'][_0xeabc('0x1d')]);}_0x5b2934[_0xeabc('0x35')]=qs['sort'](_0x131722[_0xeabc('0x30')][_0xeabc('0x36')]);_0x5b2934[_0xeabc('0x37')]=qs[_0xeabc('0x38')](_[_0xeabc('0x39')](_0x131722['query'],_0x459c8a[_0xeabc('0x38')]),_0x3c1b5b);if(_0x131722['query'][_0xeabc('0x3a')]){_0x5b2934[_0xeabc('0x37')]=_[_0xeabc('0x3b')](_0x5b2934['where'],{'$or':_['map'](_0x3c1b5b,function(_0x452580){if(_0x452580['type']!==_0xeabc('0x3c')){var _0x4ebd64={};_0x4ebd64[_0x452580['name']]={'$like':'%'+_0x131722['query']['filter']+'%'};return _0x4ebd64;}})});}_0x5b2934=_[_0xeabc('0x3b')]({},_0x5b2934,_0x131722['options']);var _0x257fe8={'where':_0x5b2934[_0xeabc('0x37')]};return db['UserProfileResource'][_0xeabc('0x1c')](_0x257fe8)['then'](function(_0x3d48f4){_0x5bf8f2['count']=_0x3d48f4;if(_0x131722[_0xeabc('0x30')][_0xeabc('0x3d')]){_0x5b2934[_0xeabc('0x3e')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5b2934);})['then'](function(_0x46056c){_0x5bf8f2[_0xeabc('0x3f')]=_0x46056c;return _0x5bf8f2;})[_0xeabc('0x24')](respondWithFilteredResult(_0x4c2693,_0x5b2934))['catch'](handleError(_0x4c2693,null));};exports['show']=function(_0x5cd62e,_0x1680e8){var _0x5e9cb3={'raw':![],'where':{'id':_0x5cd62e['params']['id']}},_0xc6af4d={};_0xc6af4d[_0xeabc('0x2f')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0xc6af4d[_0xeabc('0x30')]=_[_0xeabc('0x40')](_0x5cd62e[_0xeabc('0x30')]);_0xc6af4d[_0xeabc('0x38')]=_['intersection'](_0xc6af4d[_0xeabc('0x2f')],_0xc6af4d['query']);_0x5e9cb3[_0xeabc('0x32')]=_[_0xeabc('0x31')](_0xc6af4d[_0xeabc('0x2f')],qs[_0xeabc('0x33')](_0x5cd62e[_0xeabc('0x30')]['fields']));_0x5e9cb3['attributes']=_0x5e9cb3[_0xeabc('0x32')]['length']?_0x5e9cb3[_0xeabc('0x32')]:_0xc6af4d[_0xeabc('0x2f')];if(_0x5cd62e['query'][_0xeabc('0x3d')]){_0x5e9cb3[_0xeabc('0x3e')]=[{'all':!![]}];}_0x5e9cb3=_[_0xeabc('0x3b')]({},_0x5e9cb3,_0x5cd62e[_0xeabc('0x41')]);return db[_0xeabc('0x42')][_0xeabc('0x43')](_0x5e9cb3)[_0xeabc('0x24')](handleEntityNotFound(_0x1680e8,null))['then'](respondWithResult(_0x1680e8,null))[_0xeabc('0x44')](handleError(_0x1680e8,null));};exports[_0xeabc('0x45')]=function(_0x2e7a5e,_0x1b41c8){return db[_0xeabc('0x42')][_0xeabc('0x45')](_0x2e7a5e[_0xeabc('0x46')],{})[_0xeabc('0x24')](respondWithResult(_0x1b41c8,0xc9))[_0xeabc('0x44')](handleError(_0x1b41c8,null));};exports[_0xeabc('0x23')]=function(_0x5689fc,_0x38356c){if(_0x5689fc[_0xeabc('0x46')]['id']){delete _0x5689fc[_0xeabc('0x46')]['id'];}return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x5689fc[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x38356c,null))['then'](saveUpdates(_0x5689fc[_0xeabc('0x46')],null))[_0xeabc('0x24')](respondWithResult(_0x38356c,null))[_0xeabc('0x44')](handleError(_0x38356c,null));};exports[_0xeabc('0x25')]=function(_0x47440e,_0x58e2c1){return db[_0xeabc('0x42')][_0xeabc('0x43')]({'where':{'id':_0x47440e[_0xeabc('0x47')]['id']}})[_0xeabc('0x24')](handleEntityNotFound(_0x58e2c1,null))['then'](removeEntity(_0x58e2c1,null))[_0xeabc('0x44')](handleError(_0x58e2c1,null));};exports[_0xeabc('0x48')]=function(_0x568847,_0x43e596){return db['UserProfileResource'][_0xeabc('0x48')]()['then'](respondWithResult(_0x43e596,null))[_0xeabc('0x44')](handleError(_0x43e596,null));}; \ No newline at end of file +var _0xdbf5=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','show','find','create','body','update','params','catch','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x17d84f,_0x4b29e3){var _0x314944=function(_0x252a44){while(--_0x252a44){_0x17d84f['push'](_0x17d84f['shift']());}};_0x314944(++_0x4b29e3);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4e0517,_0x238b29){_0x4e0517=_0x4e0517-0x0;var _0x191fd2=_0xdbf5[_0x4e0517];return _0x191fd2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5dbf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5dbf('0x1'));var rp=require(_0x5dbf('0x2'));var moment=require(_0x5dbf('0x3'));var BPromise=require(_0x5dbf('0x4'));var Mustache=require(_0x5dbf('0x5'));var util=require(_0x5dbf('0x6'));var path=require(_0x5dbf('0x7'));var sox=require(_0x5dbf('0x8'));var csv=require(_0x5dbf('0x9'));var ejs=require(_0x5dbf('0xa'));var fs=require('fs');var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5dbf('0x15'))['db'];function respondWithStatusCode(_0x490b38,_0x182cec){_0x182cec=_0x182cec||0xcc;return function(_0x2bb7ed){if(_0x2bb7ed){return _0x490b38[_0x5dbf('0x16')](_0x182cec);}return _0x490b38[_0x5dbf('0x17')](_0x182cec)[_0x5dbf('0x18')]();};}function respondWithResult(_0x587e58,_0x4803ca){_0x4803ca=_0x4803ca||0xc8;return function(_0x2b4e1c){if(_0x2b4e1c){return _0x587e58[_0x5dbf('0x17')](_0x4803ca)['json'](_0x2b4e1c);}};}function respondWithFilteredResult(_0x19624e,_0x248e3c){return function(_0x23f763){if(_0x23f763){var _0x2dfa44=_0x23f763['count'],_0x181816=_0x248e3c['offset'],_0x472eb9=_0x248e3c[_0x5dbf('0x19')]+_0x248e3c[_0x5dbf('0x1a')],_0x2d32cc;if(_0x472eb9>=_0x2dfa44){_0x472eb9=_0x2dfa44;_0x2d32cc=0xc8;}else{_0x2d32cc=0xce;}_0x19624e[_0x5dbf('0x17')](_0x2d32cc);return _0x19624e[_0x5dbf('0x1b')](_0x5dbf('0x1c'),_0x181816+'-'+_0x472eb9+'/'+_0x2dfa44)['json'](_0x23f763);}return null;};}function patchUpdates(_0x11cd00){return function(_0x4dd03c){try{jsonpatch['apply'](_0x4dd03c,_0x11cd00,!![]);}catch(_0x577ca2){return BPromise[_0x5dbf('0x1d')](_0x577ca2);}return _0x4dd03c[_0x5dbf('0x1e')]();};}function saveUpdates(_0x358d46,_0x2ab57c){return function(_0x1e3cce){if(_0x1e3cce){return _0x1e3cce['update'](_0x358d46)[_0x5dbf('0x1f')](function(_0x58e9ac){return _0x58e9ac;});}return null;};}function removeEntity(_0xb68f92,_0x11cc67){return function(_0x14d133){if(_0x14d133){return _0x14d133[_0x5dbf('0x20')]()[_0x5dbf('0x1f')](function(){_0xb68f92[_0x5dbf('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(!_0x2d3e1b){_0x4027c3[_0x5dbf('0x16')](0x194);}return _0x2d3e1b;};}function handleError(_0x2763ec,_0x226b93){_0x226b93=_0x226b93||0x1f4;return function(_0x290456){logger[_0x5dbf('0x21')](_0x290456[_0x5dbf('0x22')]);if(_0x290456[_0x5dbf('0x23')]){delete _0x290456[_0x5dbf('0x23')];}_0x2763ec[_0x5dbf('0x17')](_0x226b93)[_0x5dbf('0x24')](_0x290456);};}exports[_0x5dbf('0x25')]=function(_0x729d8f,_0x17f135){var _0x466985={},_0x3f8341={},_0x159e61={'count':0x0,'rows':[]};var _0x22ec42=_[_0x5dbf('0x26')](db[_0x5dbf('0x27')][_0x5dbf('0x28')],function(_0x5768b7){return{'name':_0x5768b7[_0x5dbf('0x29')],'type':_0x5768b7[_0x5dbf('0x2a')][_0x5dbf('0x2b')]};});_0x3f8341[_0x5dbf('0x2c')]=_[_0x5dbf('0x26')](_0x22ec42,_0x5dbf('0x23'));_0x3f8341[_0x5dbf('0x2d')]=_[_0x5dbf('0x2e')](_0x729d8f[_0x5dbf('0x2d')]);_0x3f8341[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x3f8341['model'],_0x3f8341['query']);_0x466985[_0x5dbf('0x31')]=_[_0x5dbf('0x30')](_0x3f8341[_0x5dbf('0x2c')],qs[_0x5dbf('0x32')](_0x729d8f[_0x5dbf('0x2d')]['fields']));_0x466985['attributes']=_0x466985[_0x5dbf('0x31')][_0x5dbf('0x33')]?_0x466985['attributes']:_0x3f8341[_0x5dbf('0x2c')];if(!_0x729d8f[_0x5dbf('0x2d')][_0x5dbf('0x34')](_0x5dbf('0x35'))){_0x466985[_0x5dbf('0x1a')]=qs['limit'](_0x729d8f[_0x5dbf('0x2d')][_0x5dbf('0x1a')]);_0x466985[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x729d8f[_0x5dbf('0x2d')]['offset']);}_0x466985[_0x5dbf('0x36')]=qs[_0x5dbf('0x37')](_0x729d8f[_0x5dbf('0x2d')][_0x5dbf('0x37')]);_0x466985['where']=qs[_0x5dbf('0x2f')](_[_0x5dbf('0x38')](_0x729d8f[_0x5dbf('0x2d')],_0x3f8341[_0x5dbf('0x2f')]),_0x22ec42);if(_0x729d8f[_0x5dbf('0x2d')][_0x5dbf('0x39')]){_0x466985[_0x5dbf('0x3a')]=_[_0x5dbf('0x3b')](_0x466985[_0x5dbf('0x3a')],{'$or':_[_0x5dbf('0x26')](_0x22ec42,function(_0x1ba835){if(_0x1ba835['type']!==_0x5dbf('0x3c')){var _0xefc995={};_0xefc995[_0x1ba835[_0x5dbf('0x23')]]={'$like':'%'+_0x729d8f['query'][_0x5dbf('0x39')]+'%'};return _0xefc995;}})});}_0x466985=_[_0x5dbf('0x3b')]({},_0x466985,_0x729d8f[_0x5dbf('0x3d')]);var _0x5b3738={'where':_0x466985[_0x5dbf('0x3a')]};return db[_0x5dbf('0x27')][_0x5dbf('0x3e')](_0x5b3738)['then'](function(_0x4527fb){_0x159e61[_0x5dbf('0x3e')]=_0x4527fb;if(_0x729d8f[_0x5dbf('0x2d')][_0x5dbf('0x3f')]){_0x466985[_0x5dbf('0x40')]=[{'all':!![]}];}return db[_0x5dbf('0x27')][_0x5dbf('0x41')](_0x466985);})[_0x5dbf('0x1f')](function(_0x4b71c1){_0x159e61['rows']=_0x4b71c1;return _0x159e61;})['then'](respondWithFilteredResult(_0x17f135,_0x466985))['catch'](handleError(_0x17f135,null));};exports[_0x5dbf('0x42')]=function(_0x21122d,_0x54e5e7){var _0x3ef0eb={'raw':![],'where':{'id':_0x21122d['params']['id']}},_0x229abf={};_0x229abf[_0x5dbf('0x2c')]=_[_0x5dbf('0x2e')](db[_0x5dbf('0x27')][_0x5dbf('0x28')]);_0x229abf[_0x5dbf('0x2d')]=_[_0x5dbf('0x2e')](_0x21122d[_0x5dbf('0x2d')]);_0x229abf[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x229abf[_0x5dbf('0x2c')],_0x229abf['query']);_0x3ef0eb[_0x5dbf('0x31')]=_[_0x5dbf('0x30')](_0x229abf[_0x5dbf('0x2c')],qs['fields'](_0x21122d[_0x5dbf('0x2d')][_0x5dbf('0x32')]));_0x3ef0eb[_0x5dbf('0x31')]=_0x3ef0eb[_0x5dbf('0x31')]['length']?_0x3ef0eb[_0x5dbf('0x31')]:_0x229abf['model'];if(_0x21122d[_0x5dbf('0x2d')][_0x5dbf('0x3f')]){_0x3ef0eb[_0x5dbf('0x40')]=[{'all':!![]}];}_0x3ef0eb=_[_0x5dbf('0x3b')]({},_0x3ef0eb,_0x21122d['options']);return db['UserProfileResource'][_0x5dbf('0x43')](_0x3ef0eb)[_0x5dbf('0x1f')](handleEntityNotFound(_0x54e5e7,null))[_0x5dbf('0x1f')](respondWithResult(_0x54e5e7,null))['catch'](handleError(_0x54e5e7,null));};exports[_0x5dbf('0x44')]=function(_0x4a9a80,_0x4d8df1){return db['UserProfileResource']['create'](_0x4a9a80[_0x5dbf('0x45')],{})[_0x5dbf('0x1f')](respondWithResult(_0x4d8df1,0xc9))['catch'](handleError(_0x4d8df1,null));};exports[_0x5dbf('0x46')]=function(_0x3ba5cb,_0x4b6f30){if(_0x3ba5cb[_0x5dbf('0x45')]['id']){delete _0x3ba5cb[_0x5dbf('0x45')]['id'];}return db['UserProfileResource'][_0x5dbf('0x43')]({'where':{'id':_0x3ba5cb['params']['id']}})['then'](handleEntityNotFound(_0x4b6f30,null))[_0x5dbf('0x1f')](saveUpdates(_0x3ba5cb[_0x5dbf('0x45')],null))[_0x5dbf('0x1f')](respondWithResult(_0x4b6f30,null))['catch'](handleError(_0x4b6f30,null));};exports['destroy']=function(_0x442a43,_0x3e8612){return db[_0x5dbf('0x27')][_0x5dbf('0x43')]({'where':{'id':_0x442a43[_0x5dbf('0x47')]['id']}})[_0x5dbf('0x1f')](handleEntityNotFound(_0x3e8612,null))[_0x5dbf('0x1f')](removeEntity(_0x3e8612,null))[_0x5dbf('0x48')](handleError(_0x3e8612,null));};exports['describe']=function(_0x3f38a0,_0x387eb7){return db[_0x5dbf('0x27')][_0x5dbf('0x49')]()[_0x5dbf('0x1f')](respondWithResult(_0x387eb7,null))[_0x5dbf('0x48')](handleError(_0x387eb7,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 86832da..1912f8d 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 _0xee5b=['request-promise','path','rimraf','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0xee5b,0x1f4));var _0xbee5=function(_0x484dda,_0x562550){_0x484dda=_0x484dda-0x0;var _0x13e119=_0xee5b[_0x484dda];return _0x13e119;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b02=['./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x21dace,_0x400b38){_0x21dace=_0x21dace-0x0;var _0x1c70d5=_0x5b02[_0x21dace];return _0x1c70d5;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x25b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var attributes=require(_0x25b0('0x7'));module[_0x25b0('0x8')]=function(_0x2d84a9,_0x4eea55){return _0x2d84a9[_0x25b0('0x9')](_0x25b0('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x25b0('0xb'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 6245548..72bdef8 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 _0xdecc=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','UserProfileResource,\x20%s,\x20%s','catch','lodash','util','moment'];(function(_0x251d43,_0xd5a05a){var _0x3d7759=function(_0x13bd1c){while(--_0x13bd1c){_0x251d43['push'](_0x251d43['shift']());}};_0x3d7759(++_0xd5a05a);}(_0xdecc,0x1b5));var _0xcdec=function(_0xf363f0,_0x3b5eeb){_0xf363f0=_0xf363f0-0x0;var _0x55a386=_0xdecc[_0xf363f0];return _0x55a386;};'use strict';var _=require(_0xcdec('0x0'));var util=require(_0xcdec('0x1'));var moment=require(_0xcdec('0x2'));var BPromise=require(_0xcdec('0x3'));var rs=require(_0xcdec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdec('0x5'))['db'];var utils=require(_0xcdec('0x6'));var logger=require('../../config/logger')(_0xcdec('0x7'));var config=require(_0xcdec('0x8'));var jayson=require(_0xcdec('0x9'));var client=jayson['client'][_0xcdec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x459c22,_0xdd1796,_0x1fd413){return new BPromise(function(_0x3b0db3,_0x5a74e6){return client[_0xcdec('0xb')](_0x459c22,_0x1fd413)[_0xcdec('0xc')](function(_0x41df7b){logger[_0xcdec('0xd')]('UserProfileResource,\x20%s,\x20%s',_0xdd1796,_0xcdec('0xe'));logger[_0xcdec('0xf')](_0xcdec('0x10'),_0xdd1796,_0xcdec('0xe'),JSON[_0xcdec('0x11')](_0x41df7b));if(_0x41df7b[_0xcdec('0x12')]){if(_0x41df7b[_0xcdec('0x12')]['code']===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0xdd1796,_0x41df7b[_0xcdec('0x12')]['message']);return _0x5a74e6(_0x41df7b[_0xcdec('0x12')][_0xcdec('0x13')]);}logger[_0xcdec('0x12')](_0xcdec('0x14'),_0xdd1796,_0x41df7b[_0xcdec('0x12')][_0xcdec('0x13')]);return _0x3b0db3(_0x41df7b[_0xcdec('0x12')][_0xcdec('0x13')]);}else{logger['info'](_0xcdec('0x14'),_0xdd1796,'request\x20sent');_0x3b0db3(_0x41df7b['result'][_0xcdec('0x13')]);}})[_0xcdec('0x15')](function(_0x58556d){logger[_0xcdec('0x12')](_0xcdec('0x14'),_0xdd1796,_0x58556d);_0x5a74e6(_0x58556d);});});} \ No newline at end of file +var _0x99e1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0x99e1,0x1c4));var _0x199e=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0x99e1[_0x251d9c];return _0x16ae64;};'use strict';var _=require(_0x199e('0x0'));var util=require(_0x199e('0x1'));var moment=require(_0x199e('0x2'));var BPromise=require(_0x199e('0x3'));var rs=require(_0x199e('0x4'));var fs=require('fs');var Redis=require(_0x199e('0x5'));var db=require(_0x199e('0x6'))['db'];var utils=require(_0x199e('0x7'));var logger=require(_0x199e('0x8'))(_0x199e('0x9'));var config=require(_0x199e('0xa'));var jayson=require(_0x199e('0xb'));var client=jayson[_0x199e('0xc')][_0x199e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdafd4b,_0x1472f1,_0x390c2d){return new BPromise(function(_0x1beb4d,_0xb08c34){return client[_0x199e('0xe')](_0xdafd4b,_0x390c2d)[_0x199e('0xf')](function(_0x840095){logger['info'](_0x199e('0x10'),_0x1472f1,_0x199e('0x11'));logger[_0x199e('0x12')](_0x199e('0x13'),_0x1472f1,'request\x20sent',JSON[_0x199e('0x14')](_0x840095));if(_0x840095['error']){if(_0x840095[_0x199e('0x15')][_0x199e('0x16')]===0x1f4){logger[_0x199e('0x15')](_0x199e('0x10'),_0x1472f1,_0x840095[_0x199e('0x15')]['message']);return _0xb08c34(_0x840095[_0x199e('0x15')][_0x199e('0x17')]);}logger['error'](_0x199e('0x10'),_0x1472f1,_0x840095[_0x199e('0x15')]['message']);return _0x1beb4d(_0x840095[_0x199e('0x15')][_0x199e('0x17')]);}else{logger[_0x199e('0x18')]('UserProfileResource,\x20%s,\x20%s',_0x1472f1,'request\x20sent');_0x1beb4d(_0x840095[_0x199e('0x19')][_0x199e('0x17')]);}})[_0x199e('0x1a')](function(_0x246d7e){logger[_0x199e('0x15')](_0x199e('0x10'),_0x1472f1,_0x246d7e);_0xb08c34(_0x246d7e);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index b5a3bfd..8bfef76 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 _0x20c0=['update','exports','util','path','express','Router','../../components/auth/service','./userProfileSection.controller','get','isAuthenticated','index','describe','post','put','/:id'];(function(_0x133f5f,_0x1f73f8){var _0x4b421c=function(_0xdcb362){while(--_0xdcb362){_0x133f5f['push'](_0x133f5f['shift']());}};_0x4b421c(++_0x1f73f8);}(_0x20c0,0x13d));var _0x020c=function(_0x450b87,_0x1a66fe){_0x450b87=_0x450b87-0x0;var _0x5d147e=_0x20c0[_0x450b87];return _0x5d147e;};'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']('/describe',auth[_0x020c('0x7')](),controller[_0x020c('0x9')]);router[_0x020c('0x6')]('/:id',auth[_0x020c('0x7')](),controller['show']);router[_0x020c('0xa')]('/',auth[_0x020c('0x7')](),controller['create']);router[_0x020c('0xb')](_0x020c('0xc'),auth[_0x020c('0x7')](),controller[_0x020c('0xd')]);router['delete'](_0x020c('0xc'),auth[_0x020c('0x7')](),controller['destroy']);module[_0x020c('0xe')]=router; \ No newline at end of file +var _0x395a=['/:id','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','post','put'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x395a,0x159));var _0xa395=function(_0x43c8b8,_0x5e8934){_0x43c8b8=_0x43c8b8-0x0;var _0x413be3=_0x395a[_0x43c8b8];return _0x413be3;};'use strict';var multer=require(_0xa395('0x0'));var util=require(_0xa395('0x1'));var path=require(_0xa395('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa395('0x3'));var interaction=require(_0xa395('0x4'));var config=require(_0xa395('0x5'));var controller=require('./userProfileSection.controller');router[_0xa395('0x6')]('/',auth[_0xa395('0x7')](),controller[_0xa395('0x8')]);router['get']('/describe',auth[_0xa395('0x7')](),controller[_0xa395('0x9')]);router[_0xa395('0x6')]('/:id',auth[_0xa395('0x7')](),controller['show']);router[_0xa395('0xa')]('/',auth[_0xa395('0x7')](),controller['create']);router[_0xa395('0xb')](_0xa395('0xc'),auth[_0xa395('0x7')](),controller[_0xa395('0xd')]);router[_0xa395('0xe')](_0xa395('0xc'),auth[_0xa395('0x7')](),controller[_0xa395('0xf')]);module[_0xa395('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 938193d..5bd5e91 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 _0x5c42=['STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions','split','sequelize'];(function(_0x43a6f1,_0x571f82){var _0x56974a=function(_0x5979be){while(--_0x5979be){_0x43a6f1['push'](_0x43a6f1['shift']());}};_0x56974a(++_0x571f82);}(_0x5c42,0x182));var _0x25c4=function(_0x15f01d,_0x38678a){_0x15f01d=_0x15f01d-0x0;var _0x33e1cb=_0x5c42[_0x15f01d];return _0x33e1cb;};'use strict';var Sequelize=require(_0x25c4('0x0'));module['exports']={'name':{'type':Sequelize[_0x25c4('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x25c4('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x25c4('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x25c4('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x25c4('0x1')],'set':function(_0x4341d3){this[_0x25c4('0x4')]('crudPermissions',_0x4341d3?_0x4341d3[_0x25c4('0x5')](''):[]);},'get':function(){return this[_0x25c4('0x6')](_0x25c4('0x7'))?this[_0x25c4('0x6')](_0x25c4('0x7'))[_0x25c4('0x8')](''):[];}}}; \ No newline at end of file +var _0xb0de=['join','crudPermissions','getDataValue','split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x31cefb,_0x10ae73){var _0x6f8b4f=function(_0x206165){while(--_0x206165){_0x31cefb['push'](_0x31cefb['shift']());}};_0x6f8b4f(++_0x10ae73);}(_0xb0de,0x148));var _0xeb0d=function(_0x4f3048,_0x5db880){_0x4f3048=_0x4f3048-0x0;var _0x53b9d4=_0xb0de[_0x4f3048];return _0x53b9d4;};'use strict';var Sequelize=require(_0xeb0d('0x0'));module['exports']={'name':{'type':Sequelize[_0xeb0d('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xeb0d('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb0d('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb0d('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb0d('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb0d('0x1')],'set':function(_0x1f1762){this[_0xeb0d('0x4')]('crudPermissions',_0x1f1762?_0x1f1762[_0xeb0d('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xeb0d('0x6'))?this[_0xeb0d('0x7')]('crudPermissions')[_0xeb0d('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index a4686f4..dd049d6 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 _0xa4f9=['attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','options','UserProfileSection','count','includeAll','include','findAll','rows','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','set','json','apply','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','key','name','query','keys','intersection','model'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa4f9,0x1cf));var _0x9a4f=function(_0x379426,_0x3a369e){_0x379426=_0x379426-0x0;var _0x5873c2=_0xa4f9[_0x379426];return _0x5873c2;};'use strict';var pdf=require(_0x9a4f('0x0'));var emlformat=require(_0x9a4f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9a4f('0x2'));var jsonpatch=require(_0x9a4f('0x3'));var rp=require(_0x9a4f('0x4'));var moment=require(_0x9a4f('0x5'));var BPromise=require(_0x9a4f('0x6'));var Mustache=require(_0x9a4f('0x7'));var util=require(_0x9a4f('0x8'));var path=require(_0x9a4f('0x9'));var sox=require(_0x9a4f('0xa'));var csv=require(_0x9a4f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9a4f('0xc'));var squel=require(_0x9a4f('0xd'));var crypto=require(_0x9a4f('0xe'));var jsforce=require(_0x9a4f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9a4f('0xb'));var querystring=require(_0x9a4f('0x10'));var Papa=require('papaparse');var Redis=require(_0x9a4f('0x11'));var authService=require(_0x9a4f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9a4f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a4f('0x14'))(_0x9a4f('0x15'));var utils=require(_0x9a4f('0x16'));var config=require(_0x9a4f('0x17'));var db=require(_0x9a4f('0x18'))['db'];function respondWithStatusCode(_0x3c9131,_0x2b8baf){_0x2b8baf=_0x2b8baf||0xcc;return function(_0x6c6371){if(_0x6c6371){return _0x3c9131[_0x9a4f('0x19')](_0x2b8baf);}return _0x3c9131[_0x9a4f('0x1a')](_0x2b8baf)['end']();};}function respondWithResult(_0x253e88,_0x3f82b3){_0x3f82b3=_0x3f82b3||0xc8;return function(_0x45822b){if(_0x45822b){return _0x253e88['status'](_0x3f82b3)['json'](_0x45822b);}};}function respondWithFilteredResult(_0x33bf9c,_0x2f1ed9){return function(_0x1b9bf7){if(_0x1b9bf7){var _0x5b5f0e=_0x1b9bf7['count'],_0x327f39=_0x2f1ed9['offset'],_0x3ea00e=_0x2f1ed9[_0x9a4f('0x1b')]+_0x2f1ed9['limit'],_0x319b3b;if(_0x3ea00e>=_0x5b5f0e){_0x3ea00e=_0x5b5f0e;_0x319b3b=0xc8;}else{_0x319b3b=0xce;}_0x33bf9c[_0x9a4f('0x1a')](_0x319b3b);return _0x33bf9c[_0x9a4f('0x1c')]('Content-Range',_0x327f39+'-'+_0x3ea00e+'/'+_0x5b5f0e)[_0x9a4f('0x1d')](_0x1b9bf7);}return null;};}function patchUpdates(_0x2cdeb9){return function(_0x1bfa35){try{jsonpatch[_0x9a4f('0x1e')](_0x1bfa35,_0x2cdeb9,!![]);}catch(_0x2aec16){return BPromise[_0x9a4f('0x1f')](_0x2aec16);}return _0x1bfa35[_0x9a4f('0x20')]();};}function saveUpdates(_0x58a533,_0x46c756){return function(_0x1eb0df){if(_0x1eb0df){return _0x1eb0df[_0x9a4f('0x21')](_0x58a533)[_0x9a4f('0x22')](function(_0x2cee85){return _0x2cee85;});}return null;};}function removeEntity(_0x5a7a60,_0x2ba826){return function(_0x4ebed3){if(_0x4ebed3){return _0x4ebed3[_0x9a4f('0x23')]()[_0x9a4f('0x22')](function(){_0x5a7a60[_0x9a4f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c1df7,_0xd7af4f){return function(_0x141ec9){if(!_0x141ec9){_0x5c1df7[_0x9a4f('0x19')](0x194);}return _0x141ec9;};}function handleError(_0x1081e2,_0x1bf6ae){_0x1bf6ae=_0x1bf6ae||0x1f4;return function(_0x553df4){logger[_0x9a4f('0x24')](_0x553df4[_0x9a4f('0x25')]);if(_0x553df4['name']){delete _0x553df4['name'];}_0x1081e2[_0x9a4f('0x1a')](_0x1bf6ae)[_0x9a4f('0x26')](_0x553df4);};}exports[_0x9a4f('0x27')]=function(_0x294909,_0x49c805){var _0x59a442={},_0x1e74ca={},_0x2d5bc6={'count':0x0,'rows':[]};var _0x107944=_[_0x9a4f('0x28')](db['UserProfileSection'][_0x9a4f('0x29')],function(_0x16138d){return{'name':_0x16138d['fieldName'],'type':_0x16138d['type'][_0x9a4f('0x2a')]};});_0x1e74ca['model']=_['map'](_0x107944,_0x9a4f('0x2b'));_0x1e74ca[_0x9a4f('0x2c')]=_[_0x9a4f('0x2d')](_0x294909[_0x9a4f('0x2c')]);_0x1e74ca['filters']=_[_0x9a4f('0x2e')](_0x1e74ca[_0x9a4f('0x2f')],_0x1e74ca['query']);_0x59a442[_0x9a4f('0x30')]=_[_0x9a4f('0x2e')](_0x1e74ca[_0x9a4f('0x2f')],qs[_0x9a4f('0x31')](_0x294909[_0x9a4f('0x2c')]['fields']));_0x59a442['attributes']=_0x59a442[_0x9a4f('0x30')][_0x9a4f('0x32')]?_0x59a442[_0x9a4f('0x30')]:_0x1e74ca['model'];if(!_0x294909[_0x9a4f('0x2c')]['hasOwnProperty'](_0x9a4f('0x33'))){_0x59a442['limit']=qs['limit'](_0x294909[_0x9a4f('0x2c')][_0x9a4f('0x34')]);_0x59a442['offset']=qs[_0x9a4f('0x1b')](_0x294909['query'][_0x9a4f('0x1b')]);}_0x59a442[_0x9a4f('0x35')]=qs[_0x9a4f('0x36')](_0x294909[_0x9a4f('0x2c')][_0x9a4f('0x36')]);_0x59a442[_0x9a4f('0x37')]=qs[_0x9a4f('0x38')](_[_0x9a4f('0x39')](_0x294909['query'],_0x1e74ca[_0x9a4f('0x38')]),_0x107944);if(_0x294909[_0x9a4f('0x2c')][_0x9a4f('0x3a')]){_0x59a442[_0x9a4f('0x37')]=_[_0x9a4f('0x3b')](_0x59a442['where'],{'$or':_['map'](_0x107944,function(_0x1e238f){if(_0x1e238f[_0x9a4f('0x3c')]!=='VIRTUAL'){var _0x41c08d={};_0x41c08d[_0x1e238f[_0x9a4f('0x2b')]]={'$like':'%'+_0x294909[_0x9a4f('0x2c')][_0x9a4f('0x3a')]+'%'};return _0x41c08d;}})});}_0x59a442=_[_0x9a4f('0x3b')]({},_0x59a442,_0x294909[_0x9a4f('0x3d')]);var _0xe5c8e2={'where':_0x59a442['where']};return db[_0x9a4f('0x3e')]['count'](_0xe5c8e2)[_0x9a4f('0x22')](function(_0x8b363e){_0x2d5bc6[_0x9a4f('0x3f')]=_0x8b363e;if(_0x294909[_0x9a4f('0x2c')][_0x9a4f('0x40')]){_0x59a442[_0x9a4f('0x41')]=[{'all':!![]}];}return db[_0x9a4f('0x3e')][_0x9a4f('0x42')](_0x59a442);})[_0x9a4f('0x22')](function(_0x263715){_0x2d5bc6[_0x9a4f('0x43')]=_0x263715;return _0x2d5bc6;})[_0x9a4f('0x22')](respondWithFilteredResult(_0x49c805,_0x59a442))['catch'](handleError(_0x49c805,null));};exports['show']=function(_0x37e03e,_0x3182c6){var _0x37998f={'raw':![],'where':{'id':_0x37e03e['params']['id']}},_0x37b2f6={};_0x37b2f6[_0x9a4f('0x2f')]=_[_0x9a4f('0x2d')](db[_0x9a4f('0x3e')][_0x9a4f('0x29')]);_0x37b2f6[_0x9a4f('0x2c')]=_[_0x9a4f('0x2d')](_0x37e03e[_0x9a4f('0x2c')]);_0x37b2f6[_0x9a4f('0x38')]=_[_0x9a4f('0x2e')](_0x37b2f6[_0x9a4f('0x2f')],_0x37b2f6[_0x9a4f('0x2c')]);_0x37998f[_0x9a4f('0x30')]=_[_0x9a4f('0x2e')](_0x37b2f6[_0x9a4f('0x2f')],qs[_0x9a4f('0x31')](_0x37e03e[_0x9a4f('0x2c')][_0x9a4f('0x31')]));_0x37998f['attributes']=_0x37998f[_0x9a4f('0x30')]['length']?_0x37998f[_0x9a4f('0x30')]:_0x37b2f6['model'];if(_0x37e03e[_0x9a4f('0x2c')][_0x9a4f('0x40')]){_0x37998f[_0x9a4f('0x41')]=[{'all':!![]}];}_0x37998f=_[_0x9a4f('0x3b')]({},_0x37998f,_0x37e03e[_0x9a4f('0x3d')]);return db[_0x9a4f('0x3e')][_0x9a4f('0x44')](_0x37998f)['then'](handleEntityNotFound(_0x3182c6,null))[_0x9a4f('0x22')](respondWithResult(_0x3182c6,null))[_0x9a4f('0x45')](handleError(_0x3182c6,null));};exports[_0x9a4f('0x46')]=function(_0x565c19,_0x425b38){return db[_0x9a4f('0x3e')]['create'](_0x565c19[_0x9a4f('0x47')],{})[_0x9a4f('0x22')](respondWithResult(_0x425b38,0xc9))[_0x9a4f('0x45')](handleError(_0x425b38,null));};exports[_0x9a4f('0x21')]=function(_0x1ae9fc,_0x484a34){if(_0x1ae9fc[_0x9a4f('0x47')]['id']){delete _0x1ae9fc['body']['id'];}return db[_0x9a4f('0x3e')][_0x9a4f('0x44')]({'where':{'id':_0x1ae9fc['params']['id']}})[_0x9a4f('0x22')](handleEntityNotFound(_0x484a34,null))[_0x9a4f('0x22')](saveUpdates(_0x1ae9fc[_0x9a4f('0x47')],null))[_0x9a4f('0x22')](respondWithResult(_0x484a34,null))[_0x9a4f('0x45')](handleError(_0x484a34,null));};exports['destroy']=function(_0x39f750,_0x3d2391){return db['UserProfileSection'][_0x9a4f('0x44')]({'where':{'id':_0x39f750['params']['id']}})[_0x9a4f('0x22')](handleEntityNotFound(_0x3d2391,null))[_0x9a4f('0x22')](removeEntity(_0x3d2391,null))[_0x9a4f('0x45')](handleError(_0x3d2391,null));};exports[_0x9a4f('0x48')]=function(_0x4f4185,_0x2f6898){return db['UserProfileSection'][_0x9a4f('0x48')]()[_0x9a4f('0x22')](respondWithResult(_0x2f6898,null))[_0x9a4f('0x45')](handleError(_0x2f6898,null));}; \ No newline at end of file +var _0x91e6=['request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1cfb46,_0xf2adf0){var _0x4b490b=function(_0x56b5dd){while(--_0x56b5dd){_0x1cfb46['push'](_0x1cfb46['shift']());}};_0x4b490b(++_0xf2adf0);}(_0x91e6,0x123));var _0x691e=function(_0x460e5e,_0x305a44){_0x460e5e=_0x460e5e-0x0;var _0x5aef43=_0x91e6[_0x460e5e];return _0x5aef43;};'use strict';var pdf=require(_0x691e('0x0'));var emlformat=require(_0x691e('0x1'));var rimraf=require(_0x691e('0x2'));var zipdir=require(_0x691e('0x3'));var jsonpatch=require(_0x691e('0x4'));var rp=require(_0x691e('0x5'));var moment=require(_0x691e('0x6'));var BPromise=require(_0x691e('0x7'));var Mustache=require(_0x691e('0x8'));var util=require('util');var path=require(_0x691e('0x9'));var sox=require(_0x691e('0xa'));var csv=require(_0x691e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x691e('0xc'));var squel=require(_0x691e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x691e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x691e('0xf'));var Papa=require(_0x691e('0x10'));var Redis=require(_0x691e('0x11'));var authService=require(_0x691e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x691e('0x13'));var hardwareService=require(_0x691e('0x14'));var logger=require(_0x691e('0x15'))(_0x691e('0x16'));var utils=require(_0x691e('0x17'));var config=require('../../config/environment');var db=require(_0x691e('0x18'))['db'];function respondWithStatusCode(_0x54b0f0,_0x38b478){_0x38b478=_0x38b478||0xcc;return function(_0x39c8b3){if(_0x39c8b3){return _0x54b0f0[_0x691e('0x19')](_0x38b478);}return _0x54b0f0['status'](_0x38b478)[_0x691e('0x1a')]();};}function respondWithResult(_0x507e3d,_0x5922bb){_0x5922bb=_0x5922bb||0xc8;return function(_0x2dfa6c){if(_0x2dfa6c){return _0x507e3d[_0x691e('0x1b')](_0x5922bb)['json'](_0x2dfa6c);}};}function respondWithFilteredResult(_0x520ef6,_0x37ca73){return function(_0x33e3dd){if(_0x33e3dd){var _0x12aad3=_0x33e3dd['count'],_0x50fa02=_0x37ca73['offset'],_0x527527=_0x37ca73[_0x691e('0x1c')]+_0x37ca73[_0x691e('0x1d')],_0x1fd2c1;if(_0x527527>=_0x12aad3){_0x527527=_0x12aad3;_0x1fd2c1=0xc8;}else{_0x1fd2c1=0xce;}_0x520ef6['status'](_0x1fd2c1);return _0x520ef6[_0x691e('0x1e')](_0x691e('0x1f'),_0x50fa02+'-'+_0x527527+'/'+_0x12aad3)[_0x691e('0x20')](_0x33e3dd);}return null;};}function patchUpdates(_0x12ea4c){return function(_0x4f464f){try{jsonpatch[_0x691e('0x21')](_0x4f464f,_0x12ea4c,!![]);}catch(_0x3f97b1){return BPromise['reject'](_0x3f97b1);}return _0x4f464f['save']();};}function saveUpdates(_0x4aed54,_0x2bf89e){return function(_0x4b8768){if(_0x4b8768){return _0x4b8768[_0x691e('0x22')](_0x4aed54)[_0x691e('0x23')](function(_0x403b89){return _0x403b89;});}return null;};}function removeEntity(_0x180413,_0x413a8b){return function(_0x103f22){if(_0x103f22){return _0x103f22[_0x691e('0x24')]()[_0x691e('0x23')](function(){_0x180413['status'](0xcc)[_0x691e('0x1a')]();});}};}function handleEntityNotFound(_0x12435b,_0x3959cb){return function(_0x30842f){if(!_0x30842f){_0x12435b[_0x691e('0x19')](0x194);}return _0x30842f;};}function handleError(_0x241c8a,_0xc94614){_0xc94614=_0xc94614||0x1f4;return function(_0x5115e8){logger[_0x691e('0x25')](_0x5115e8[_0x691e('0x26')]);if(_0x5115e8[_0x691e('0x27')]){delete _0x5115e8['name'];}_0x241c8a['status'](_0xc94614)[_0x691e('0x28')](_0x5115e8);};}exports[_0x691e('0x29')]=function(_0x3eb857,_0x3557ba){var _0x124b7e={},_0x4b1844={},_0xf89be6={'count':0x0,'rows':[]};var _0x86a5ec=_[_0x691e('0x2a')](db[_0x691e('0x2b')][_0x691e('0x2c')],function(_0x9d6d59){return{'name':_0x9d6d59[_0x691e('0x2d')],'type':_0x9d6d59[_0x691e('0x2e')]['key']};});_0x4b1844['model']=_['map'](_0x86a5ec,'name');_0x4b1844[_0x691e('0x2f')]=_[_0x691e('0x30')](_0x3eb857[_0x691e('0x2f')]);_0x4b1844[_0x691e('0x31')]=_[_0x691e('0x32')](_0x4b1844[_0x691e('0x33')],_0x4b1844[_0x691e('0x2f')]);_0x124b7e[_0x691e('0x34')]=_['intersection'](_0x4b1844['model'],qs['fields'](_0x3eb857[_0x691e('0x2f')][_0x691e('0x35')]));_0x124b7e[_0x691e('0x34')]=_0x124b7e['attributes'][_0x691e('0x36')]?_0x124b7e[_0x691e('0x34')]:_0x4b1844[_0x691e('0x33')];if(!_0x3eb857[_0x691e('0x2f')][_0x691e('0x37')](_0x691e('0x38'))){_0x124b7e['limit']=qs[_0x691e('0x1d')](_0x3eb857[_0x691e('0x2f')][_0x691e('0x1d')]);_0x124b7e[_0x691e('0x1c')]=qs[_0x691e('0x1c')](_0x3eb857[_0x691e('0x2f')][_0x691e('0x1c')]);}_0x124b7e['order']=qs['sort'](_0x3eb857[_0x691e('0x2f')][_0x691e('0x39')]);_0x124b7e[_0x691e('0x3a')]=qs['filters'](_[_0x691e('0x3b')](_0x3eb857['query'],_0x4b1844['filters']),_0x86a5ec);if(_0x3eb857[_0x691e('0x2f')][_0x691e('0x3c')]){_0x124b7e[_0x691e('0x3a')]=_[_0x691e('0x3d')](_0x124b7e[_0x691e('0x3a')],{'$or':_['map'](_0x86a5ec,function(_0x1e0c4c){if(_0x1e0c4c[_0x691e('0x2e')]!==_0x691e('0x3e')){var _0x3c7a2c={};_0x3c7a2c[_0x1e0c4c[_0x691e('0x27')]]={'$like':'%'+_0x3eb857[_0x691e('0x2f')]['filter']+'%'};return _0x3c7a2c;}})});}_0x124b7e=_[_0x691e('0x3d')]({},_0x124b7e,_0x3eb857[_0x691e('0x3f')]);var _0x3b9c09={'where':_0x124b7e['where']};return db['UserProfileSection'][_0x691e('0x40')](_0x3b9c09)['then'](function(_0x5a95d5){_0xf89be6[_0x691e('0x40')]=_0x5a95d5;if(_0x3eb857[_0x691e('0x2f')][_0x691e('0x41')]){_0x124b7e['include']=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x124b7e);})[_0x691e('0x23')](function(_0x38cb8b){_0xf89be6[_0x691e('0x42')]=_0x38cb8b;return _0xf89be6;})[_0x691e('0x23')](respondWithFilteredResult(_0x3557ba,_0x124b7e))[_0x691e('0x43')](handleError(_0x3557ba,null));};exports[_0x691e('0x44')]=function(_0x2be921,_0x5a7bc8){var _0x426655={'raw':![],'where':{'id':_0x2be921[_0x691e('0x45')]['id']}},_0x3675bd={};_0x3675bd[_0x691e('0x33')]=_[_0x691e('0x30')](db[_0x691e('0x2b')]['rawAttributes']);_0x3675bd[_0x691e('0x2f')]=_[_0x691e('0x30')](_0x2be921['query']);_0x3675bd[_0x691e('0x31')]=_[_0x691e('0x32')](_0x3675bd[_0x691e('0x33')],_0x3675bd[_0x691e('0x2f')]);_0x426655[_0x691e('0x34')]=_[_0x691e('0x32')](_0x3675bd['model'],qs[_0x691e('0x35')](_0x2be921[_0x691e('0x2f')]['fields']));_0x426655['attributes']=_0x426655[_0x691e('0x34')][_0x691e('0x36')]?_0x426655[_0x691e('0x34')]:_0x3675bd['model'];if(_0x2be921['query'][_0x691e('0x41')]){_0x426655['include']=[{'all':!![]}];}_0x426655=_[_0x691e('0x3d')]({},_0x426655,_0x2be921[_0x691e('0x3f')]);return db[_0x691e('0x2b')][_0x691e('0x46')](_0x426655)[_0x691e('0x23')](handleEntityNotFound(_0x5a7bc8,null))[_0x691e('0x23')](respondWithResult(_0x5a7bc8,null))[_0x691e('0x43')](handleError(_0x5a7bc8,null));};exports[_0x691e('0x47')]=function(_0x1bd600,_0x1dc1ed){return db[_0x691e('0x2b')]['create'](_0x1bd600['body'],{})[_0x691e('0x23')](respondWithResult(_0x1dc1ed,0xc9))[_0x691e('0x43')](handleError(_0x1dc1ed,null));};exports[_0x691e('0x22')]=function(_0x453a89,_0x321f14){if(_0x453a89[_0x691e('0x48')]['id']){delete _0x453a89[_0x691e('0x48')]['id'];}return db[_0x691e('0x2b')]['find']({'where':{'id':_0x453a89[_0x691e('0x45')]['id']}})[_0x691e('0x23')](handleEntityNotFound(_0x321f14,null))[_0x691e('0x23')](saveUpdates(_0x453a89['body'],null))[_0x691e('0x23')](respondWithResult(_0x321f14,null))['catch'](handleError(_0x321f14,null));};exports[_0x691e('0x24')]=function(_0x436daa,_0x4daf02){return db[_0x691e('0x2b')][_0x691e('0x46')]({'where':{'id':_0x436daa[_0x691e('0x45')]['id']}})[_0x691e('0x23')](handleEntityNotFound(_0x4daf02,null))[_0x691e('0x23')](removeEntity(_0x4daf02,null))[_0x691e('0x43')](handleError(_0x4daf02,null));};exports[_0x691e('0x49')]=function(_0x10b22e,_0x233aea){return db[_0x691e('0x2b')][_0x691e('0x49')]()[_0x691e('0x23')](respondWithResult(_0x233aea,null))[_0x691e('0x43')](handleError(_0x233aea,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 6c1a1a2..ca49aa9 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 _0x1be3=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4145c9,_0x5ca502){var _0x4a4b95=function(_0x79a9ca){while(--_0x79a9ca){_0x4145c9['push'](_0x4145c9['shift']());}};_0x4a4b95(++_0x5ca502);}(_0x1be3,0x108));var _0x31be=function(_0xf70b15,_0x38960d){_0xf70b15=_0xf70b15-0x0;var _0x4b8ce7=_0x1be3[_0xf70b15];return _0x4b8ce7;};'use strict';var _=require(_0x31be('0x0'));var util=require(_0x31be('0x1'));var logger=require(_0x31be('0x2'))(_0x31be('0x3'));var moment=require(_0x31be('0x4'));var BPromise=require('bluebird');var rp=require(_0x31be('0x5'));var fs=require('fs');var path=require(_0x31be('0x6'));var rimraf=require(_0x31be('0x7'));var config=require(_0x31be('0x8'));var attributes=require(_0x31be('0x9'));module[_0x31be('0xa')]=function(_0x30c0a6,_0x280d51){return _0x30c0a6[_0x31be('0xb')](_0x31be('0xc'),attributes,{'tableName':_0x31be('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x31be('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x241d=['./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x41bcd5,_0x2877d8){var _0x45a42c=function(_0x5cbcdb){while(--_0x5cbcdb){_0x41bcd5['push'](_0x41bcd5['shift']());}};_0x45a42c(++_0x2877d8);}(_0x241d,0xe7));var _0xd241=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x241d[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xd241('0x0'));var util=require(_0xd241('0x1'));var logger=require(_0xd241('0x2'))('api');var moment=require(_0xd241('0x3'));var BPromise=require(_0xd241('0x4'));var rp=require(_0xd241('0x5'));var fs=require('fs');var path=require(_0xd241('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd241('0x7'));module[_0xd241('0x8')]=function(_0x8ac38a,_0x111be2){return _0x8ac38a[_0xd241('0x9')](_0xd241('0xa'),attributes,{'tableName':_0xd241('0xb'),'paranoid':![],'indexes':[{'name':_0xd241('0xc'),'fields':['sectionId',_0xd241('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 6cb3e59..f96c418 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 _0xc21e=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x10a18d,_0x460b58){var _0x352317=function(_0x3e526d){while(--_0x3e526d){_0x10a18d['push'](_0x10a18d['shift']());}};_0x352317(++_0x460b58);}(_0xc21e,0x1ca));var _0xec21=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc21e[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xec21('0x0'));var moment=require(_0xec21('0x1'));var BPromise=require(_0xec21('0x2'));var rs=require(_0xec21('0x3'));var fs=require('fs');var Redis=require(_0xec21('0x4'));var db=require(_0xec21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec21('0x6'))(_0xec21('0x7'));var config=require(_0xec21('0x8'));var jayson=require(_0xec21('0x9'));var client=jayson[_0xec21('0xa')][_0xec21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x406b66,_0x2f15e7,_0x51f6dc){return new BPromise(function(_0x2b1396,_0x3d74a2){return client[_0xec21('0xc')](_0x406b66,_0x51f6dc)[_0xec21('0xd')](function(_0x4d478){logger['info'](_0xec21('0xe'),_0x2f15e7,_0xec21('0xf'));logger[_0xec21('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2f15e7,'request\x20sent',JSON[_0xec21('0x11')](_0x4d478));if(_0x4d478[_0xec21('0x12')]){if(_0x4d478['error'][_0xec21('0x13')]===0x1f4){logger[_0xec21('0x12')](_0xec21('0xe'),_0x2f15e7,_0x4d478[_0xec21('0x12')][_0xec21('0x14')]);return _0x3d74a2(_0x4d478['error'][_0xec21('0x14')]);}logger['error'](_0xec21('0xe'),_0x2f15e7,_0x4d478[_0xec21('0x12')][_0xec21('0x14')]);return _0x2b1396(_0x4d478['error'][_0xec21('0x14')]);}else{logger[_0xec21('0x15')](_0xec21('0xe'),_0x2f15e7,_0xec21('0xf'));_0x2b1396(_0x4d478[_0xec21('0x16')][_0xec21('0x14')]);}})[_0xec21('0x17')](function(_0x350a53){logger['error'](_0xec21('0xe'),_0x2f15e7,_0x350a53);_0x3d74a2(_0x350a53);});});} \ No newline at end of file +var _0x30cb=['../../config/utils','rpc','jayson/promise','client','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x14280a,_0x5930a9){var _0x3cae77=function(_0x18cf8){while(--_0x18cf8){_0x14280a['push'](_0x14280a['shift']());}};_0x3cae77(++_0x5930a9);}(_0x30cb,0xb8));var _0xb30c=function(_0x503294,_0x806171){_0x503294=_0x503294-0x0;var _0xcdf233=_0x30cb[_0x503294];return _0xcdf233;};'use strict';var _=require(_0xb30c('0x0'));var util=require(_0xb30c('0x1'));var moment=require(_0xb30c('0x2'));var BPromise=require('bluebird');var rs=require(_0xb30c('0x3'));var fs=require('fs');var Redis=require(_0xb30c('0x4'));var db=require(_0xb30c('0x5'))['db'];var utils=require(_0xb30c('0x6'));var logger=require('../../config/logger')(_0xb30c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb30c('0x8'));var client=jayson[_0xb30c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f0614,_0x59ea19,_0x27c524){return new BPromise(function(_0x141279,_0x53a5db){return client[_0xb30c('0xa')](_0x1f0614,_0x27c524)['then'](function(_0x19463e){logger[_0xb30c('0xb')](_0xb30c('0xc'),_0x59ea19,_0xb30c('0xd'));logger['debug'](_0xb30c('0xe'),_0x59ea19,_0xb30c('0xd'),JSON[_0xb30c('0xf')](_0x19463e));if(_0x19463e[_0xb30c('0x10')]){if(_0x19463e['error']['code']===0x1f4){logger[_0xb30c('0x10')](_0xb30c('0xc'),_0x59ea19,_0x19463e[_0xb30c('0x10')]['message']);return _0x53a5db(_0x19463e[_0xb30c('0x10')][_0xb30c('0x11')]);}logger[_0xb30c('0x10')](_0xb30c('0xc'),_0x59ea19,_0x19463e[_0xb30c('0x10')][_0xb30c('0x11')]);return _0x141279(_0x19463e['error'][_0xb30c('0x11')]);}else{logger[_0xb30c('0xb')](_0xb30c('0xc'),_0x59ea19,_0xb30c('0xd'));_0x141279(_0x19463e[_0xb30c('0x12')][_0xb30c('0x11')]);}})['catch'](function(_0x8815d){logger[_0xb30c('0x10')](_0xb30c('0xc'),_0x59ea19,_0x8815d);_0x53a5db(_0x8815d);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 060212b..a2cd8c8 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 _0x986d=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x12d917,_0x59ddd4){var _0x576d1a=function(_0x360f23){while(--_0x360f23){_0x12d917['push'](_0x12d917['shift']());}};_0x576d1a(++_0x59ddd4);}(_0x986d,0xa9));var _0xd986=function(_0x50ee6b,_0x5af008){_0x50ee6b=_0x50ee6b-0x0;var _0x36cbab=_0x986d[_0x50ee6b];return _0x36cbab;};'use strict';var multer=require(_0xd986('0x0'));var util=require('util');var path=require(_0xd986('0x1'));var timeout=require(_0xd986('0x2'));var express=require('express');var router=express[_0xd986('0x3')]();var auth=require(_0xd986('0x4'));var interaction=require(_0xd986('0x5'));var config=require(_0xd986('0x6'));module[_0xd986('0x7')]=router; \ No newline at end of file +var _0x4b1e=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4b1e,0x12a));var _0xe4b1=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x4b1e[_0x54b283];return _0x2462b3;};'use strict';var multer=require(_0xe4b1('0x0'));var util=require(_0xe4b1('0x1'));var path=require(_0xe4b1('0x2'));var timeout=require(_0xe4b1('0x3'));var express=require(_0xe4b1('0x4'));var router=express[_0xe4b1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe4b1('0x6'));var config=require('../../config/environment');module[_0xe4b1('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 81fa231..3bb4132 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 _0xb10b=['sequelize','INTEGER'];(function(_0xce492c,_0x2bdb82){var _0x2be746=function(_0x4e9984){while(--_0x4e9984){_0xce492c['push'](_0xce492c['shift']());}};_0x2be746(++_0x2bdb82);}(_0xb10b,0x12a));var _0xbb10=function(_0x58b6a8,_0x307021){_0x58b6a8=_0x58b6a8-0x0;var _0xc566dc=_0xb10b[_0x58b6a8];return _0xc566dc;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x4072be,_0x5dde18){var _0x4e21ce=function(_0x198cf7){while(--_0x198cf7){_0x4072be['push'](_0x4072be['shift']());}};_0x4e21ce(++_0x5dde18);}(_0xe706,0xa3));var _0x6e70=function(_0x48564d,_0x2c1c8c){_0x48564d=_0x48564d-0x0;var _0x2ad779=_0xe706[_0x48564d];return _0x2ad779;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index c8a1580..d7e5bb8 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 _0x3276=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','user_has_sms_queues','lodash'];(function(_0x65ca91,_0x9a26fd){var _0x361969=function(_0x5282b7){while(--_0x5282b7){_0x65ca91['push'](_0x65ca91['shift']());}};_0x361969(++_0x9a26fd);}(_0x3276,0xc7));var _0x6327=function(_0x2f194e,_0xaa5aa9){_0x2f194e=_0x2f194e-0x0;var _0xc6c609=_0x3276[_0x2f194e];return _0xc6c609;};'use strict';var _=require(_0x6327('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6327('0x1'));var moment=require(_0x6327('0x2'));var BPromise=require(_0x6327('0x3'));var rp=require(_0x6327('0x4'));var fs=require('fs');var path=require(_0x6327('0x5'));var rimraf=require(_0x6327('0x6'));var config=require(_0x6327('0x7'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x10b982,_0x37adde){return _0x10b982[_0x6327('0x8')]('UserSmsQueue',attributes,{'tableName':_0x6327('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fd9=['./userSmsQueue.attributes','exports','UserSmsQueue','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x2086bd,_0x2b9a85){var _0x7517c2=function(_0x484416){while(--_0x484416){_0x2086bd['push'](_0x2086bd['shift']());}};_0x7517c2(++_0x2b9a85);}(_0x0fd9,0xa3));var _0x90fd=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x0fd9[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var logger=require(_0x90fd('0x1'))(_0x90fd('0x2'));var moment=require(_0x90fd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x90fd('0x4'));var rimraf=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var attributes=require(_0x90fd('0x7'));module[_0x90fd('0x8')]=function(_0x23e11b,_0x5e2107){return _0x23e11b['define'](_0x90fd('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 1299e57..5db33aa 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 _0x2d50=['code','message','catch','moment','randomstring','ioredis','rpc','../../config/environment','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0x2d50,0x7a));var _0x02d5=function(_0x53c4bd,_0x29c89f){_0x53c4bd=_0x53c4bd-0x0;var _0x356988=_0x2d50[_0x53c4bd];return _0x356988;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x02d5('0x0'));var BPromise=require('bluebird');var rs=require(_0x02d5('0x1'));var fs=require('fs');var Redis=require(_0x02d5('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x02d5('0x3'));var config=require(_0x02d5('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x02d5('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a93ed,_0x1850e3,_0xc82a0b){return new BPromise(function(_0x266bec,_0x54b694){return client[_0x02d5('0x6')](_0x2a93ed,_0xc82a0b)[_0x02d5('0x7')](function(_0x5d577b){logger[_0x02d5('0x8')](_0x02d5('0x9'),_0x1850e3,_0x02d5('0xa'));logger['debug'](_0x02d5('0xb'),_0x1850e3,_0x02d5('0xa'),JSON[_0x02d5('0xc')](_0x5d577b));if(_0x5d577b[_0x02d5('0xd')]){if(_0x5d577b[_0x02d5('0xd')][_0x02d5('0xe')]===0x1f4){logger[_0x02d5('0xd')](_0x02d5('0x9'),_0x1850e3,_0x5d577b[_0x02d5('0xd')][_0x02d5('0xf')]);return _0x54b694(_0x5d577b[_0x02d5('0xd')][_0x02d5('0xf')]);}logger[_0x02d5('0xd')](_0x02d5('0x9'),_0x1850e3,_0x5d577b['error']['message']);return _0x266bec(_0x5d577b[_0x02d5('0xd')][_0x02d5('0xf')]);}else{logger[_0x02d5('0x8')](_0x02d5('0x9'),_0x1850e3,_0x02d5('0xa'));_0x266bec(_0x5d577b['result']['message']);}})[_0x02d5('0x10')](function(_0x1a1675){logger[_0x02d5('0xd')](_0x02d5('0x9'),_0x1850e3,_0x1a1675);_0x54b694(_0x1a1675);});});} \ No newline at end of file +var _0xb486=['stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x1eeb7c,_0x40c87d){var _0x54d122=function(_0x59fe24){while(--_0x59fe24){_0x1eeb7c['push'](_0x1eeb7c['shift']());}};_0x54d122(++_0x40c87d);}(_0xb486,0xd4));var _0x6b48=function(_0x281c92,_0x244f70){_0x281c92=_0x281c92-0x0;var _0x3301bb=_0xb486[_0x281c92];return _0x3301bb;};'use strict';var _=require(_0x6b48('0x0'));var util=require(_0x6b48('0x1'));var moment=require(_0x6b48('0x2'));var BPromise=require(_0x6b48('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b48('0x4'));var db=require(_0x6b48('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b48('0x6'))(_0x6b48('0x7'));var config=require(_0x6b48('0x8'));var jayson=require(_0x6b48('0x9'));var client=jayson[_0x6b48('0xa')][_0x6b48('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a7ef2,_0x17e25c,_0x54b3b3){return new BPromise(function(_0x22707b,_0x74de32){return client[_0x6b48('0xc')](_0x1a7ef2,_0x54b3b3)[_0x6b48('0xd')](function(_0xd56b18){logger[_0x6b48('0xe')](_0x6b48('0xf'),_0x17e25c,'request\x20sent');logger[_0x6b48('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x17e25c,_0x6b48('0x11'),JSON[_0x6b48('0x12')](_0xd56b18));if(_0xd56b18[_0x6b48('0x13')]){if(_0xd56b18[_0x6b48('0x13')][_0x6b48('0x14')]===0x1f4){logger['error'](_0x6b48('0xf'),_0x17e25c,_0xd56b18[_0x6b48('0x13')]['message']);return _0x74de32(_0xd56b18[_0x6b48('0x13')]['message']);}logger[_0x6b48('0x13')](_0x6b48('0xf'),_0x17e25c,_0xd56b18['error']['message']);return _0x22707b(_0xd56b18['error'][_0x6b48('0x15')]);}else{logger[_0x6b48('0xe')](_0x6b48('0xf'),_0x17e25c,_0x6b48('0x11'));_0x22707b(_0xd56b18['result'][_0x6b48('0x15')]);}})[_0x6b48('0x16')](function(_0x49f410){logger['error'](_0x6b48('0xf'),_0x17e25c,_0x49f410);_0x74de32(_0x49f410);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 047204e..2536c65 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 _0x0ff1=['multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x4c409e,_0x259ad5){var _0xa2fb65=function(_0x9cdc9e){while(--_0x9cdc9e){_0x4c409e['push'](_0x4c409e['shift']());}};_0xa2fb65(++_0x259ad5);}(_0x0ff1,0x68));var _0x10ff=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x0ff1[_0x296754];return _0x1d9f1d;};'use strict';var multer=require(_0x10ff('0x0'));var util=require(_0x10ff('0x1'));var path=require('path');var timeout=require(_0x10ff('0x2'));var express=require(_0x10ff('0x3'));var router=express['Router']();var auth=require(_0x10ff('0x4'));var interaction=require(_0x10ff('0x5'));var config=require(_0x10ff('0x6'));module[_0x10ff('0x7')]=router; \ No newline at end of file +var _0x87de=['path','connect-timeout','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0x87de,0xc2));var _0xe87d=function(_0x194e2b,_0x260485){_0x194e2b=_0x194e2b-0x0;var _0x5a1d1f=_0x87de[_0x194e2b];return _0x5a1d1f;};'use strict';var multer=require(_0xe87d('0x0'));var util=require(_0xe87d('0x1'));var path=require(_0xe87d('0x2'));var timeout=require(_0xe87d('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe87d('0x4'));var config=require(_0xe87d('0x5'));module[_0xe87d('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 042afea..205812b 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(_0xed4e3c,_0x39e976){var _0x4297cc=function(_0x5a0cb8){while(--_0x5a0cb8){_0xed4e3c['push'](_0xed4e3c['shift']());}};_0x4297cc(++_0x39e976);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x2d1541,_0x50d32a){var _0x43448c=function(_0x24d4b3){while(--_0x24d4b3){_0x2d1541['push'](_0x2d1541['shift']());}};_0x43448c(++_0x50d32a);}(_0xe706,0xa3));var _0x6e70=function(_0x37f212,_0x9bf1b2){_0x37f212=_0x37f212-0x0;var _0x57ba32=_0xe706[_0x37f212];return _0x57ba32;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index ecd6882..ea3836a 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 _0x2c46=['moment','bluebird','request-promise','rimraf','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0x2c46,0x12f));var _0x62c4=function(_0x23e144,_0x3009ba){_0x23e144=_0x23e144-0x0;var _0x177781=_0x2c46[_0x23e144];return _0x177781;};'use strict';var _=require('lodash');var util=require(_0x62c4('0x0'));var logger=require(_0x62c4('0x1'))(_0x62c4('0x2'));var moment=require(_0x62c4('0x3'));var BPromise=require(_0x62c4('0x4'));var rp=require(_0x62c4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62c4('0x6'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x3cca8b,_0x3750da){return _0x3cca8b['define'](_0x62c4('0x7'),attributes,{'tableName':_0x62c4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10c7=['./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2fa334,_0xa351de){var _0x5b846c=function(_0x2badc6){while(--_0x2badc6){_0x2fa334['push'](_0x2fa334['shift']());}};_0x5b846c(++_0xa351de);}(_0x10c7,0xee));var _0x710c=function(_0xe1441d,_0x36fb8e){_0xe1441d=_0xe1441d-0x0;var _0x2ef242=_0x10c7[_0xe1441d];return _0x2ef242;};'use strict';var _=require(_0x710c('0x0'));var util=require(_0x710c('0x1'));var logger=require(_0x710c('0x2'))(_0x710c('0x3'));var moment=require('moment');var BPromise=require(_0x710c('0x4'));var rp=require(_0x710c('0x5'));var fs=require('fs');var path=require(_0x710c('0x6'));var rimraf=require(_0x710c('0x7'));var config=require(_0x710c('0x8'));var attributes=require(_0x710c('0x9'));module['exports']=function(_0x442fcc,_0x171dd6){return _0x442fcc[_0x710c('0xa')](_0x710c('0xb'),attributes,{'tableName':_0x710c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index b5623f3..838fd15 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 _0x42bc=['bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3fd2df,_0x52c281){var _0x14c770=function(_0x568ae3){while(--_0x568ae3){_0x3fd2df['push'](_0x3fd2df['shift']());}};_0x14c770(++_0x52c281);}(_0x42bc,0xc5));var _0xc42b=function(_0x2b9e33,_0x266ac7){_0x2b9e33=_0x2b9e33-0x0;var _0x3062a6=_0x42bc[_0x2b9e33];return _0x3062a6;};'use strict';var _=require(_0xc42b('0x0'));var util=require(_0xc42b('0x1'));var moment=require(_0xc42b('0x2'));var BPromise=require(_0xc42b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc42b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc42b('0x5'));var logger=require(_0xc42b('0x6'))('rpc');var config=require(_0xc42b('0x7'));var jayson=require(_0xc42b('0x8'));var client=jayson[_0xc42b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11a463,_0x11070f,_0x41ecec){return new BPromise(function(_0x1e8740,_0x5b9add){return client[_0xc42b('0xa')](_0x11a463,_0x41ecec)['then'](function(_0x45b052){logger[_0xc42b('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x11070f,'request\x20sent');logger[_0xc42b('0xc')](_0xc42b('0xd'),_0x11070f,_0xc42b('0xe'),JSON['stringify'](_0x45b052));if(_0x45b052[_0xc42b('0xf')]){if(_0x45b052[_0xc42b('0xf')]['code']===0x1f4){logger['error'](_0xc42b('0x10'),_0x11070f,_0x45b052[_0xc42b('0xf')]['message']);return _0x5b9add(_0x45b052['error'][_0xc42b('0x11')]);}logger[_0xc42b('0xf')](_0xc42b('0x10'),_0x11070f,_0x45b052[_0xc42b('0xf')][_0xc42b('0x11')]);return _0x1e8740(_0x45b052[_0xc42b('0xf')][_0xc42b('0x11')]);}else{logger['info'](_0xc42b('0x10'),_0x11070f,_0xc42b('0xe'));_0x1e8740(_0x45b052[_0xc42b('0x12')][_0xc42b('0x11')]);}})[_0xc42b('0x13')](function(_0x16a4a8){logger[_0xc42b('0xf')](_0xc42b('0x10'),_0x11070f,_0x16a4a8);_0x5b9add(_0x16a4a8);});});} \ No newline at end of file +var _0x15a4=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x217d8a,_0x481fe3){var _0x3242f6=function(_0x2c4d77){while(--_0x2c4d77){_0x217d8a['push'](_0x217d8a['shift']());}};_0x3242f6(++_0x481fe3);}(_0x15a4,0xdb));var _0x415a=function(_0x4ea728,_0x3ba8a8){_0x4ea728=_0x4ea728-0x0;var _0x290764=_0x15a4[_0x4ea728];return _0x290764;};'use strict';var _=require('lodash');var util=require(_0x415a('0x0'));var moment=require('moment');var BPromise=require(_0x415a('0x1'));var rs=require(_0x415a('0x2'));var fs=require('fs');var Redis=require(_0x415a('0x3'));var db=require(_0x415a('0x4'))['db'];var utils=require(_0x415a('0x5'));var logger=require(_0x415a('0x6'))(_0x415a('0x7'));var config=require(_0x415a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x415a('0x9')][_0x415a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x332e93,_0x144dcf,_0x402b64){return new BPromise(function(_0x372aab,_0x2b99b7){return client['request'](_0x332e93,_0x402b64)[_0x415a('0xb')](function(_0x168d95){logger[_0x415a('0xc')](_0x415a('0xd'),_0x144dcf,_0x415a('0xe'));logger[_0x415a('0xf')](_0x415a('0x10'),_0x144dcf,_0x415a('0xe'),JSON['stringify'](_0x168d95));if(_0x168d95[_0x415a('0x11')]){if(_0x168d95[_0x415a('0x11')]['code']===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x144dcf,_0x168d95['error'][_0x415a('0x12')]);return _0x2b99b7(_0x168d95[_0x415a('0x11')]['message']);}logger['error'](_0x415a('0xd'),_0x144dcf,_0x168d95[_0x415a('0x11')][_0x415a('0x12')]);return _0x372aab(_0x168d95[_0x415a('0x11')][_0x415a('0x12')]);}else{logger[_0x415a('0xc')](_0x415a('0xd'),_0x144dcf,'request\x20sent');_0x372aab(_0x168d95[_0x415a('0x13')][_0x415a('0x12')]);}})[_0x415a('0x14')](function(_0x4853f1){logger[_0x415a('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x144dcf,_0x4853f1);_0x2b99b7(_0x4853f1);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4289cb7..6166326 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 _0x685d=['Router','../../components/interaction/service','../../config/environment','exports','multer','path','express'];(function(_0x8bd9ad,_0x44a34d){var _0x492b04=function(_0x167e0b){while(--_0x167e0b){_0x8bd9ad['push'](_0x8bd9ad['shift']());}};_0x492b04(++_0x44a34d);}(_0x685d,0x17e));var _0xd685=function(_0x296ca9,_0x2f25a7){_0x296ca9=_0x296ca9-0x0;var _0x29804c=_0x685d[_0x296ca9];return _0x29804c;};'use strict';var multer=require(_0xd685('0x0'));var util=require('util');var path=require(_0xd685('0x1'));var timeout=require('connect-timeout');var express=require(_0xd685('0x2'));var router=express[_0xd685('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd685('0x4'));var config=require(_0xd685('0x5'));module[_0xd685('0x6')]=router; \ No newline at end of file +var _0x8763=['express','Router','../../config/environment','exports','multer','util','path'];(function(_0x2cbfd8,_0x394056){var _0x8f14f8=function(_0x3308c5){while(--_0x3308c5){_0x2cbfd8['push'](_0x2cbfd8['shift']());}};_0x8f14f8(++_0x394056);}(_0x8763,0x193));var _0x3876=function(_0x17a08b,_0x3a8ff4){_0x17a08b=_0x17a08b-0x0;var _0x334837=_0x8763[_0x17a08b];return _0x334837;};'use strict';var multer=require(_0x3876('0x0'));var util=require(_0x3876('0x1'));var path=require(_0x3876('0x2'));var timeout=require('connect-timeout');var express=require(_0x3876('0x3'));var router=express[_0x3876('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3876('0x5'));module[_0x3876('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 10ca3ff..438d51e 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 _0x7a54=['STRING','INTEGER','queue_interface','sequelize','exports','Required\x20by\x20Asterisk'];(function(_0x18c34d,_0x182e9b){var _0x5f4b4b=function(_0x170ae5){while(--_0x170ae5){_0x18c34d['push'](_0x18c34d['shift']());}};_0x5f4b4b(++_0x182e9b);}(_0x7a54,0x11d));var _0x47a5=function(_0x1e565c,_0x2569e9){_0x1e565c=_0x1e565c-0x0;var _0x1300f6=_0x7a54[_0x1e565c];return _0x1300f6;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x47a5('0x2')},'membername':{'type':Sequelize[_0x47a5('0x3')],'allowNull':![],'comment':_0x47a5('0x2')},'UserId':{'type':Sequelize[_0x47a5('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x47a5('0x3')],'allowNull':![],'unique':_0x47a5('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x47a5('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x47a5('0x3')],'allowNull':![],'unique':_0x47a5('0x5'),'comment':_0x47a5('0x2')},'penalty':{'type':Sequelize[_0x47a5('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x47a5('0x4')](0xb),'defaultValue':0x0,'comment':_0x47a5('0x2')}}; \ No newline at end of file +var _0x95c2=['STRING','INTEGER','queue_interface','Required\x20by\x20Asterisk'];(function(_0x454d98,_0x231594){var _0x4a3ab0=function(_0x42cf9c){while(--_0x42cf9c){_0x454d98['push'](_0x454d98['shift']());}};_0x4a3ab0(++_0x231594);}(_0x95c2,0xff));var _0x295c=function(_0x1a43ed,_0x1a445b){_0x1a43ed=_0x1a43ed-0x0;var _0x1f05a8=_0x95c2[_0x1a43ed];return _0x1f05a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x295c('0x0')},'membername':{'type':Sequelize[_0x295c('0x1')],'allowNull':![],'comment':_0x295c('0x0')},'UserId':{'type':Sequelize[_0x295c('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x295c('0x1')],'allowNull':![],'unique':'queue_interface','comment':_0x295c('0x0')},'VoiceQueueId':{'type':Sequelize[_0x295c('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x295c('0x1')],'allowNull':![],'unique':_0x295c('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x295c('0x2')](0xb),'defaultValue':0x0,'comment':_0x295c('0x0')},'paused':{'type':Sequelize[_0x295c('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index d549f18..25f9bbe 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 _0x51a3=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','save','update'];(function(_0x3c5f8d,_0x39891f){var _0x3b7beb=function(_0x44d6c9){while(--_0x44d6c9){_0x3c5f8d['push'](_0x3c5f8d['shift']());}};_0x3b7beb(++_0x39891f);}(_0x51a3,0x1ac));var _0x351a=function(_0x17a504,_0x42b47b){_0x17a504=_0x17a504-0x0;var _0xb6f356=_0x51a3[_0x17a504];return _0xb6f356;};'use strict';var EventEmitter=require(_0x351a('0x0'));var UserVoiceQueueRt=require(_0x351a('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x351a('0x2'),'afterUpdate':_0x351a('0x3'),'afterDestroy':_0x351a('0x4')};function emitEvent(_0x476a44){return function(_0xd22bd1,_0x209638,_0x21aa07){UserVoiceQueueRtEvents[_0x351a('0x5')](_0x476a44+':'+_0xd22bd1['id'],_0xd22bd1);UserVoiceQueueRtEvents[_0x351a('0x5')](_0x476a44,_0xd22bd1);_0x21aa07(null);};}for(var e in events){if(events[_0x351a('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x351a('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe784=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x534a01,_0x538722){var _0x367cc4=function(_0x4fba29){while(--_0x4fba29){_0x534a01['push'](_0x534a01['shift']());}};_0x367cc4(++_0x538722);}(_0xe784,0x144));var _0x4e78=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe784[_0x32f7d7];return _0x133d09;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x4e78('0x0'))['db'][_0x4e78('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4e78('0x2')](0x0);var events={'afterCreate':_0x4e78('0x3'),'afterUpdate':_0x4e78('0x4'),'afterDestroy':_0x4e78('0x5')};function emitEvent(_0x442b22){return function(_0x7ff41c,_0x2dde4d,_0x11812f){UserVoiceQueueRtEvents[_0x4e78('0x6')](_0x442b22+':'+_0x7ff41c['id'],_0x7ff41c);UserVoiceQueueRtEvents[_0x4e78('0x6')](_0x442b22,_0x7ff41c);_0x11812f(null);};}for(var e in events){if(events[_0x4e78('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x4e78('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 81e9f44..3cf5333 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 _0xce64=['user_has_voice_queues_rt','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','UserVoiceQueueRt'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xce64,0x169));var _0x4ce6=function(_0x1b59fc,_0x340dcc){_0x1b59fc=_0x1b59fc-0x0;var _0x1815af=_0xce64[_0x1b59fc];return _0x1815af;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ce6('0x0'))('api');var moment=require('moment');var BPromise=require(_0x4ce6('0x1'));var rp=require(_0x4ce6('0x2'));var fs=require('fs');var path=require(_0x4ce6('0x3'));var rimraf=require('rimraf');var config=require(_0x4ce6('0x4'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x4ce6('0x5')]=function(_0x3730ab,_0x3b10ce){return _0x3730ab['define'](_0x4ce6('0x6'),attributes,{'tableName':_0x4ce6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x512c=['../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','moment','bluebird','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x512c,0x13a));var _0xc512=function(_0x500f3e,_0x11d70f){_0x500f3e=_0x500f3e-0x0;var _0x40fe63=_0x512c[_0x500f3e];return _0x40fe63;};'use strict';var _=require(_0xc512('0x0'));var util=require(_0xc512('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc512('0x2'));var BPromise=require(_0xc512('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc512('0x4'));var rimraf=require(_0xc512('0x5'));var config=require(_0xc512('0x6'));var attributes=require(_0xc512('0x7'));module['exports']=function(_0x558919,_0x5a83c7){return _0x558919['define'](_0xc512('0x8'),attributes,{'tableName':_0xc512('0x9'),'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 dc896d2..c20111a 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 _0xef60=['stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','catch','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef60,0xaa));var _0x0ef6=function(_0x4dd45b,_0x117280){_0x4dd45b=_0x4dd45b-0x0;var _0x22b033=_0xef60[_0x4dd45b];return _0x22b033;};'use strict';var _=require('lodash');var util=require(_0x0ef6('0x0'));var moment=require('moment');var BPromise=require(_0x0ef6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ef6('0x2'))['db'];var utils=require(_0x0ef6('0x3'));var logger=require(_0x0ef6('0x4'))('rpc');var config=require(_0x0ef6('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ef6('0x6')]({'port':0x232a});config[_0x0ef6('0x7')]=_['defaults'](config[_0x0ef6('0x7')],{'host':_0x0ef6('0x8'),'port':0x18eb});var socket=require(_0x0ef6('0x9'))(new Redis(config['redis']));require(_0x0ef6('0xa'))[_0x0ef6('0xb')](socket);function respondWithRpcPromise(_0x23b064,_0x4ece59,_0x1f79ee){return new BPromise(function(_0x249740,_0x3b974b){return client['request'](_0x23b064,_0x1f79ee)[_0x0ef6('0xc')](function(_0x8a4a88){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x4ece59,_0x0ef6('0xd'));logger[_0x0ef6('0xe')](_0x0ef6('0xf'),_0x4ece59,_0x0ef6('0xd'),JSON[_0x0ef6('0x10')](_0x8a4a88));if(_0x8a4a88[_0x0ef6('0x11')]){if(_0x8a4a88[_0x0ef6('0x11')][_0x0ef6('0x12')]===0x1f4){logger[_0x0ef6('0x11')](_0x0ef6('0x13'),_0x4ece59,_0x8a4a88[_0x0ef6('0x11')]['message']);return _0x3b974b(_0x8a4a88[_0x0ef6('0x11')][_0x0ef6('0x14')]);}logger[_0x0ef6('0x11')](_0x0ef6('0x13'),_0x4ece59,_0x8a4a88['error']['message']);return _0x249740(_0x8a4a88[_0x0ef6('0x11')][_0x0ef6('0x14')]);}else{logger[_0x0ef6('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4ece59,_0x0ef6('0xd'));_0x249740(_0x8a4a88['result'][_0x0ef6('0x14')]);}})[_0x0ef6('0x16')](function(_0x4a66b0){logger[_0x0ef6('0x11')](_0x0ef6('0x13'),_0x4ece59,_0x4a66b0);_0x3b974b(_0x4a66b0);});});}exports[_0x0ef6('0x17')]=function(_0xbfe34b){var _0x3c4388=this;return new Promise(function(_0x4e7693,_0x5414d6){return db['UserVoiceQueueRt'][_0x0ef6('0x18')]({'raw':_0xbfe34b['options']?_0xbfe34b[_0x0ef6('0x19')][_0x0ef6('0x1a')]===undefined?!![]:![]:!![],'where':_0xbfe34b[_0x0ef6('0x19')]?_0xbfe34b[_0x0ef6('0x19')][_0x0ef6('0x1b')]||null:null,'attributes':[[db[_0x0ef6('0x1c')]['fn'](_0x0ef6('0x1d'),db[_0x0ef6('0x1c')]['fn']('IF',db[_0x0ef6('0x1c')]['literal'](_0x0ef6('0x1e')))),'outboundQueuePauses']]})['then'](function(_0x561af1){logger['info'](_0x0ef6('0x17'),_0xbfe34b);logger[_0x0ef6('0xe')](_0x0ef6('0x17'),_0xbfe34b,JSON[_0x0ef6('0x10')](_0x561af1));_0x4e7693(_0x561af1);})[_0x0ef6('0x16')](function(_0x1f0d4c){logger[_0x0ef6('0x11')]('GetVoiceQueueRtPauses',_0x1f0d4c[_0x0ef6('0x14')],_0xbfe34b);_0x5414d6(_0x3c4388['error'](0x1f4,_0x1f0d4c[_0x0ef6('0x14')]));});});}; \ No newline at end of file +var _0x397a=['socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','result','GetVoiceQueueRtPauses','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','stringify','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x10d090,_0x2f7517){var _0x25a7b9=function(_0x170790){while(--_0x170790){_0x10d090['push'](_0x10d090['shift']());}};_0x25a7b9(++_0x2f7517);}(_0x397a,0x7a));var _0xa397=function(_0x29802a,_0x2d2a54){_0x29802a=_0x29802a-0x0;var _0x11eb27=_0x397a[_0x29802a];return _0x11eb27;};'use strict';var _=require(_0xa397('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa397('0x1'));var fs=require('fs');var Redis=require(_0xa397('0x2'));var db=require(_0xa397('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa397('0x4'))(_0xa397('0x5'));var config=require(_0xa397('0x6'));var jayson=require(_0xa397('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xa397('0x8')]=_[_0xa397('0x9')](config[_0xa397('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa397('0xa'))(new Redis(config[_0xa397('0x8')]));require(_0xa397('0xb'))[_0xa397('0xc')](socket);function respondWithRpcPromise(_0x12868e,_0x5e27e3,_0x5262f1){return new BPromise(function(_0x14c0d9,_0x44c222){return client[_0xa397('0xd')](_0x12868e,_0x5262f1)[_0xa397('0xe')](function(_0x240f7f){logger[_0xa397('0xf')](_0xa397('0x10'),_0x5e27e3,_0xa397('0x11'));logger['debug'](_0xa397('0x12'),_0x5e27e3,'request\x20sent',JSON['stringify'](_0x240f7f));if(_0x240f7f[_0xa397('0x13')]){if(_0x240f7f[_0xa397('0x13')]['code']===0x1f4){logger['error'](_0xa397('0x10'),_0x5e27e3,_0x240f7f[_0xa397('0x13')]['message']);return _0x44c222(_0x240f7f[_0xa397('0x13')][_0xa397('0x14')]);}logger[_0xa397('0x13')](_0xa397('0x10'),_0x5e27e3,_0x240f7f[_0xa397('0x13')]['message']);return _0x14c0d9(_0x240f7f[_0xa397('0x13')][_0xa397('0x14')]);}else{logger[_0xa397('0xf')](_0xa397('0x10'),_0x5e27e3,_0xa397('0x11'));_0x14c0d9(_0x240f7f[_0xa397('0x15')][_0xa397('0x14')]);}})['catch'](function(_0x525580){logger[_0xa397('0x13')](_0xa397('0x10'),_0x5e27e3,_0x525580);_0x44c222(_0x525580);});});}exports[_0xa397('0x16')]=function(_0x4da23a){var _0x7d5c6d=this;return new Promise(function(_0x40887d,_0x447325){return db['UserVoiceQueueRt']['findAll']({'raw':_0x4da23a[_0xa397('0x17')]?_0x4da23a[_0xa397('0x17')][_0xa397('0x18')]===undefined?!![]:![]:!![],'where':_0x4da23a[_0xa397('0x17')]?_0x4da23a[_0xa397('0x17')][_0xa397('0x19')]||null:null,'attributes':[[db[_0xa397('0x1a')]['fn'](_0xa397('0x1b'),db[_0xa397('0x1a')]['fn']('IF',db[_0xa397('0x1a')][_0xa397('0x1c')](_0xa397('0x1d')))),_0xa397('0x1e')]]})[_0xa397('0xe')](function(_0x4297c4){logger[_0xa397('0xf')](_0xa397('0x16'),_0x4da23a);logger[_0xa397('0x1f')](_0xa397('0x16'),_0x4da23a,JSON[_0xa397('0x20')](_0x4297c4));_0x40887d(_0x4297c4);})['catch'](function(_0x52aad2){logger['error'](_0xa397('0x16'),_0x52aad2[_0xa397('0x14')],_0x4da23a);_0x447325(_0x7d5c6d[_0xa397('0x13')](0x1f4,_0x52aad2[_0xa397('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 95db7a3..7686221 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 _0x3e41=['./userVoiceQueueRt.events','remove','update','emit','register','userVoiceQueueRt:'];(function(_0x5c5904,_0xa16eeb){var _0x1eb4b8=function(_0x103d25){while(--_0x103d25){_0x5c5904['push'](_0x5c5904['shift']());}};_0x1eb4b8(++_0xa16eeb);}(_0x3e41,0x138));var _0x13e4=function(_0x350976,_0x4bdcb1){_0x350976=_0x350976-0x0;var _0x57b884=_0x3e41[_0x350976];return _0x57b884;};'use strict';var UserVoiceQueueRtEvents=require(_0x13e4('0x0'));var events=['save',_0x13e4('0x1'),_0x13e4('0x2')];function createListener(_0x9a8db1,_0x33bb57){return function(_0x4a1efc){_0x33bb57[_0x13e4('0x3')](_0x9a8db1,_0x4a1efc);};}function removeListener(_0x430fd3,_0x4dce82){return function(){UserVoiceQueueRtEvents['removeListener'](_0x430fd3,_0x4dce82);};}exports[_0x13e4('0x4')]=function(_0x7b9206){for(var _0x56caf1=0x0,_0x55a0a8=events['length'];_0x56caf1<_0x55a0a8;_0x56caf1++){var _0x4ad7aa=events[_0x56caf1];var _0xf69aca=createListener(_0x13e4('0x5')+_0x4ad7aa,_0x7b9206);UserVoiceQueueRtEvents['on'](_0x4ad7aa,_0xf69aca);}}; \ No newline at end of file +var _0xca2a=['./userVoiceQueueRt.events','save','emit','removeListener','register','length','userVoiceQueueRt:'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xca2a,0xaf));var _0xaca2=function(_0x17a0db,_0x17b665){_0x17a0db=_0x17a0db-0x0;var _0x30b9d5=_0xca2a[_0x17a0db];return _0x30b9d5;};'use strict';var UserVoiceQueueRtEvents=require(_0xaca2('0x0'));var events=[_0xaca2('0x1'),'remove','update'];function createListener(_0x3d94ec,_0x202039){return function(_0x253d76){_0x202039[_0xaca2('0x2')](_0x3d94ec,_0x253d76);};}function removeListener(_0x53b040,_0x2594df){return function(){UserVoiceQueueRtEvents[_0xaca2('0x3')](_0x53b040,_0x2594df);};}exports[_0xaca2('0x4')]=function(_0x219204){for(var _0x41381a=0x0,_0x4b6d05=events[_0xaca2('0x5')];_0x41381a<_0x4b6d05;_0x41381a++){var _0x5803da=events[_0x41381a];var _0x755b56=createListener(_0xaca2('0x6')+_0x5803da,_0x219204);UserVoiceQueueRtEvents['on'](_0x5803da,_0x755b56);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d0e3bf4..cf83c74 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 _0x6dcb=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path'];(function(_0x4571fb,_0x44b35a){var _0x3fcfef=function(_0x373021){while(--_0x373021){_0x4571fb['push'](_0x4571fb['shift']());}};_0x3fcfef(++_0x44b35a);}(_0x6dcb,0x156));var _0xb6dc=function(_0x3b7d8e,_0x310dae){_0x3b7d8e=_0x3b7d8e-0x0;var _0x2d4427=_0x6dcb[_0x3b7d8e];return _0x2d4427;};'use strict';var multer=require(_0xb6dc('0x0'));var util=require('util');var path=require(_0xb6dc('0x1'));var timeout=require(_0xb6dc('0x2'));var express=require('express');var router=express[_0xb6dc('0x3')]();var auth=require(_0xb6dc('0x4'));var interaction=require(_0xb6dc('0x5'));var config=require(_0xb6dc('0x6'));module[_0xb6dc('0x7')]=router; \ No newline at end of file +var _0x0a33=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','multer','util'];(function(_0x5d5979,_0x3b4921){var _0x237182=function(_0xbd4df7){while(--_0xbd4df7){_0x5d5979['push'](_0x5d5979['shift']());}};_0x237182(++_0x3b4921);}(_0x0a33,0x1e8));var _0x30a3=function(_0x3a0f55,_0x1b1f65){_0x3a0f55=_0x3a0f55-0x0;var _0x129a1a=_0x0a33[_0x3a0f55];return _0x129a1a;};'use strict';var multer=require(_0x30a3('0x0'));var util=require(_0x30a3('0x1'));var path=require(_0x30a3('0x2'));var timeout=require(_0x30a3('0x3'));var express=require('express');var router=express[_0x30a3('0x4')]();var auth=require(_0x30a3('0x5'));var interaction=require(_0x30a3('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 1087c12..9888aec 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x452450,_0x40b419){var _0x448b19=function(_0x5467b0){while(--_0x5467b0){_0x452450['push'](_0x452450['shift']());}};_0x448b19(++_0x40b419);}(_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(_0x8f9c9,_0x25649d){var _0xcb89d=function(_0x68d43e){while(--_0x68d43e){_0x8f9c9['push'](_0x8f9c9['shift']());}};_0xcb89d(++_0x25649d);}(_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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index d0e84b0..b1bac33 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 _0x16b2=['util','../../config/logger','api','bluebird','request-promise','path','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x542f79,_0x2df7d7){var _0x5b0e12=function(_0x95b1af){while(--_0x95b1af){_0x542f79['push'](_0x542f79['shift']());}};_0x5b0e12(++_0x2df7d7);}(_0x16b2,0x149));var _0x216b=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x16b2[_0x10791d];return _0x1b4f9c;};'use strict';var _=require(_0x216b('0x0'));var util=require(_0x216b('0x1'));var logger=require(_0x216b('0x2'))(_0x216b('0x3'));var moment=require('moment');var BPromise=require(_0x216b('0x4'));var rp=require(_0x216b('0x5'));var fs=require('fs');var path=require(_0x216b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x216b('0x7'));module[_0x216b('0x8')]=function(_0x32b50a,_0x88fa10){return _0x32b50a['define'](_0x216b('0x9'),attributes,{'tableName':_0x216b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x323f,0x185));var _0xf323=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x323f[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xf323('0x0'));var util=require('util');var logger=require(_0xf323('0x1'))(_0xf323('0x2'));var moment=require(_0xf323('0x3'));var BPromise=require(_0xf323('0x4'));var rp=require(_0xf323('0x5'));var fs=require('fs');var path=require(_0xf323('0x6'));var rimraf=require(_0xf323('0x7'));var config=require(_0xf323('0x8'));var attributes=require(_0xf323('0x9'));module[_0xf323('0xa')]=function(_0x3e86dd,_0x317fc6){return _0x3e86dd[_0xf323('0xb')](_0xf323('0xc'),attributes,{'tableName':_0xf323('0xd'),'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 de1cba4..063de50 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(_0x4bd951,_0x516604){var _0x8ebe7e=function(_0x3f1713){while(--_0x3f1713){_0x4bd951['push'](_0x4bd951['shift']());}};_0x8ebe7e(++_0x516604);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x37aeb0,_0x587e18){var _0xe0eb67=function(_0x42d5df){while(--_0x42d5df){_0x37aeb0['push'](_0x37aeb0['shift']());}};_0xe0eb67(++_0x587e18);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 b524fd1..77dab6d 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 _0x031b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x1cf29b,_0x391e21){var _0x43f745=function(_0x157813){while(--_0x157813){_0x1cf29b['push'](_0x1cf29b['shift']());}};_0x43f745(++_0x391e21);}(_0x031b,0x1e9));var _0xb031=function(_0x344f03,_0x58c5e0){_0x344f03=_0x344f03-0x0;var _0x1ff746=_0x031b[_0x344f03];return _0x1ff746;};'use strict';var multer=require('multer');var util=require(_0xb031('0x0'));var path=require(_0xb031('0x1'));var timeout=require(_0xb031('0x2'));var express=require(_0xb031('0x3'));var router=express[_0xb031('0x4')]();var auth=require(_0xb031('0x5'));var interaction=require(_0xb031('0x6'));var config=require(_0xb031('0x7'));var controller=require(_0xb031('0x8'));router['get']('/',auth[_0xb031('0x9')](),controller[_0xb031('0xa')]);router[_0xb031('0xb')](_0xb031('0xc'),auth[_0xb031('0x9')](),controller[_0xb031('0xd')]);router[_0xb031('0xe')]('/',auth[_0xb031('0x9')](),controller[_0xb031('0xf')]);router['put'](_0xb031('0xc'),auth[_0xb031('0x9')](),controller['update']);router[_0xb031('0x10')]('/:id',auth[_0xb031('0x9')](),controller[_0xb031('0x11')]);module[_0xb031('0x12')]=router; \ No newline at end of file +var _0x42bf=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x24e294,_0x14aae1){var _0x1d71d2=function(_0x3468ff){while(--_0x3468ff){_0x24e294['push'](_0x24e294['shift']());}};_0x1d71d2(++_0x14aae1);}(_0x42bf,0x18c));var _0xf42b=function(_0x25cebc,_0x399f2e){_0x25cebc=_0x25cebc-0x0;var _0xad9e2f=_0x42bf[_0x25cebc];return _0xad9e2f;};'use strict';var multer=require(_0xf42b('0x0'));var util=require(_0xf42b('0x1'));var path=require(_0xf42b('0x2'));var timeout=require(_0xf42b('0x3'));var express=require(_0xf42b('0x4'));var router=express['Router']();var auth=require(_0xf42b('0x5'));var interaction=require(_0xf42b('0x6'));var config=require(_0xf42b('0x7'));var controller=require(_0xf42b('0x8'));router[_0xf42b('0x9')]('/',auth[_0xf42b('0xa')](),controller[_0xf42b('0xb')]);router['get'](_0xf42b('0xc'),auth['isAuthenticated'](),controller[_0xf42b('0xd')]);router[_0xf42b('0xe')]('/',auth[_0xf42b('0xa')](),controller[_0xf42b('0xf')]);router[_0xf42b('0x10')](_0xf42b('0xc'),auth[_0xf42b('0xa')](),controller[_0xf42b('0x11')]);router[_0xf42b('0x12')](_0xf42b('0xc'),auth[_0xf42b('0xa')](),controller[_0xf42b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 48575dd..26329c7 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 _0x02f9=['sequelize','exports','STRING','name'];(function(_0x16a8ef,_0x160f81){var _0xc9bc08=function(_0x55e258){while(--_0x55e258){_0x16a8ef['push'](_0x16a8ef['shift']());}};_0xc9bc08(++_0x160f81);}(_0x02f9,0xf0));var _0x902f=function(_0x35f616,_0xc97542){_0x35f616=_0x35f616-0x0;var _0x4057dc=_0x02f9[_0x35f616];return _0x4057dc;};'use strict';var Sequelize=require(_0x902f('0x0'));module[_0x902f('0x1')]={'name':{'type':Sequelize[_0x902f('0x2')],'unique':_0x902f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x902f('0x2')]}}; \ No newline at end of file +var _0x2c15=['name','STRING','exports'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x2c15,0x77));var _0x52c1=function(_0x59d5e6,_0x3fd841){_0x59d5e6=_0x59d5e6-0x0;var _0x359118=_0x2c15[_0x59d5e6];return _0x359118;};'use strict';var Sequelize=require('sequelize');module[_0x52c1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x52c1('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x52c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 494503c..8a0454e 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 _0xffb0=['filter','merge','VIRTUAL','options','count','includeAll','show','params','keys','include','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','update','then','destroy','get','Variables','UserProfileResource','error','name','send','index','Variable','rawAttributes','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick'];(function(_0x214c7c,_0x3f8be3){var _0x52192c=function(_0x521810){while(--_0x521810){_0x214c7c['push'](_0x214c7c['shift']());}};_0x52192c(++_0x3f8be3);}(_0xffb0,0x1d5));var _0x0ffb=function(_0x47f3f2,_0x45fb40){_0x47f3f2=_0x47f3f2-0x0;var _0xfb1613=_0xffb0[_0x47f3f2];return _0xfb1613;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0ffb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ffb('0x1'));var rp=require(_0x0ffb('0x2'));var moment=require('moment');var BPromise=require(_0x0ffb('0x3'));var Mustache=require(_0x0ffb('0x4'));var util=require('util');var path=require('path');var sox=require(_0x0ffb('0x5'));var csv=require(_0x0ffb('0x6'));var ejs=require(_0x0ffb('0x7'));var fs=require('fs');var _=require(_0x0ffb('0x8'));var squel=require(_0x0ffb('0x9'));var crypto=require('crypto');var jsforce=require(_0x0ffb('0xa'));var deskjs=require(_0x0ffb('0xb'));var toCsv=require(_0x0ffb('0x6'));var querystring=require(_0x0ffb('0xc'));var Papa=require('papaparse');var Redis=require(_0x0ffb('0xd'));var authService=require(_0x0ffb('0xe'));var qs=require(_0x0ffb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ffb('0x10'));var utils=require(_0x0ffb('0x11'));var config=require(_0x0ffb('0x12'));var db=require(_0x0ffb('0x13'))['db'];function respondWithStatusCode(_0xfed812,_0x28b254){_0x28b254=_0x28b254||0xcc;return function(_0x4449e7){if(_0x4449e7){return _0xfed812[_0x0ffb('0x14')](_0x28b254);}return _0xfed812[_0x0ffb('0x15')](_0x28b254)[_0x0ffb('0x16')]();};}function respondWithResult(_0x3b183f,_0x566357){_0x566357=_0x566357||0xc8;return function(_0x18bb87){if(_0x18bb87){return _0x3b183f[_0x0ffb('0x15')](_0x566357)[_0x0ffb('0x17')](_0x18bb87);}};}function respondWithFilteredResult(_0x5016d7,_0x4f4f17){return function(_0x55d5d2){if(_0x55d5d2){var _0x1eec24=_0x55d5d2['count'],_0x38cb12=_0x4f4f17[_0x0ffb('0x18')],_0x296221=_0x4f4f17['offset']+_0x4f4f17['limit'],_0x3d204e;if(_0x296221>=_0x1eec24){_0x296221=_0x1eec24;_0x3d204e=0xc8;}else{_0x3d204e=0xce;}_0x5016d7[_0x0ffb('0x15')](_0x3d204e);return _0x5016d7[_0x0ffb('0x19')](_0x0ffb('0x1a'),_0x38cb12+'-'+_0x296221+'/'+_0x1eec24)[_0x0ffb('0x17')](_0x55d5d2);}return null;};}function patchUpdates(_0x1ab7f1){return function(_0x529eb2){try{jsonpatch[_0x0ffb('0x1b')](_0x529eb2,_0x1ab7f1,!![]);}catch(_0x45124e){return BPromise['reject'](_0x45124e);}return _0x529eb2['save']();};}function saveUpdates(_0xf5e5c8,_0x4a0309){return function(_0x2ffd49){if(_0x2ffd49){return _0x2ffd49[_0x0ffb('0x1c')](_0xf5e5c8)[_0x0ffb('0x1d')](function(_0x275306){return _0x275306;});}return null;};}function removeEntity(_0x107f54,_0x205cf6){return function(_0x3de305){if(_0x3de305){return _0x3de305[_0x0ffb('0x1e')]()[_0x0ffb('0x1d')](function(){var _0xc3ee8=_0x3de305[_0x0ffb('0x1f')]({'plain':!![]});var _0x4aaa07=_0x0ffb('0x20');return db[_0x0ffb('0x21')][_0x0ffb('0x1e')]({'where':{'type':_0x4aaa07,'resourceId':_0xc3ee8['id']}})[_0x0ffb('0x1d')](function(){return _0x3de305;});})[_0x0ffb('0x1d')](function(){_0x107f54[_0x0ffb('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x566d0a,_0x10a756){return function(_0x12ef5f){if(!_0x12ef5f){_0x566d0a['sendStatus'](0x194);}return _0x12ef5f;};}function handleError(_0x1709eb,_0x3ede70){_0x3ede70=_0x3ede70||0x1f4;return function(_0x2588e6){logger[_0x0ffb('0x22')](_0x2588e6['stack']);if(_0x2588e6[_0x0ffb('0x23')]){delete _0x2588e6[_0x0ffb('0x23')];}_0x1709eb[_0x0ffb('0x15')](_0x3ede70)[_0x0ffb('0x24')](_0x2588e6);};}exports[_0x0ffb('0x25')]=function(_0x3aa368,_0xa210){var _0x5a9543={},_0x8a52f7={},_0x35ab6e={'count':0x0,'rows':[]};var _0x10e6ee=_['map'](db[_0x0ffb('0x26')][_0x0ffb('0x27')],function(_0x2a1b70){return{'name':_0x2a1b70['fieldName'],'type':_0x2a1b70[_0x0ffb('0x28')][_0x0ffb('0x29')]};});_0x8a52f7['model']=_[_0x0ffb('0x2a')](_0x10e6ee,_0x0ffb('0x23'));_0x8a52f7[_0x0ffb('0x2b')]=_['keys'](_0x3aa368[_0x0ffb('0x2b')]);_0x8a52f7[_0x0ffb('0x2c')]=_['intersection'](_0x8a52f7[_0x0ffb('0x2d')],_0x8a52f7[_0x0ffb('0x2b')]);_0x5a9543[_0x0ffb('0x2e')]=_[_0x0ffb('0x2f')](_0x8a52f7[_0x0ffb('0x2d')],qs['fields'](_0x3aa368[_0x0ffb('0x2b')][_0x0ffb('0x30')]));_0x5a9543[_0x0ffb('0x2e')]=_0x5a9543[_0x0ffb('0x2e')][_0x0ffb('0x31')]?_0x5a9543[_0x0ffb('0x2e')]:_0x8a52f7['model'];if(!_0x3aa368[_0x0ffb('0x2b')][_0x0ffb('0x32')](_0x0ffb('0x33'))){_0x5a9543[_0x0ffb('0x34')]=qs[_0x0ffb('0x34')](_0x3aa368['query'][_0x0ffb('0x34')]);_0x5a9543[_0x0ffb('0x18')]=qs[_0x0ffb('0x18')](_0x3aa368['query'][_0x0ffb('0x18')]);}_0x5a9543['order']=qs['sort'](_0x3aa368[_0x0ffb('0x2b')][_0x0ffb('0x35')]);_0x5a9543[_0x0ffb('0x36')]=qs[_0x0ffb('0x2c')](_[_0x0ffb('0x37')](_0x3aa368['query'],_0x8a52f7[_0x0ffb('0x2c')]),_0x10e6ee);if(_0x3aa368['query'][_0x0ffb('0x38')]){_0x5a9543['where']=_[_0x0ffb('0x39')](_0x5a9543[_0x0ffb('0x36')],{'$or':_[_0x0ffb('0x2a')](_0x10e6ee,function(_0x2260e3){if(_0x2260e3[_0x0ffb('0x28')]!==_0x0ffb('0x3a')){var _0xf0711a={};_0xf0711a[_0x2260e3[_0x0ffb('0x23')]]={'$like':'%'+_0x3aa368[_0x0ffb('0x2b')]['filter']+'%'};return _0xf0711a;}})});}_0x5a9543=_[_0x0ffb('0x39')]({},_0x5a9543,_0x3aa368[_0x0ffb('0x3b')]);var _0x56dbe1={'where':_0x5a9543[_0x0ffb('0x36')]};return db[_0x0ffb('0x26')][_0x0ffb('0x3c')](_0x56dbe1)['then'](function(_0x540e0f){_0x35ab6e['count']=_0x540e0f;if(_0x3aa368[_0x0ffb('0x2b')][_0x0ffb('0x3d')]){_0x5a9543['include']=[{'all':!![]}];}return db[_0x0ffb('0x26')]['findAll'](_0x5a9543);})[_0x0ffb('0x1d')](function(_0x1edd2a){_0x35ab6e['rows']=_0x1edd2a;return _0x35ab6e;})[_0x0ffb('0x1d')](respondWithFilteredResult(_0xa210,_0x5a9543))['catch'](handleError(_0xa210,null));};exports[_0x0ffb('0x3e')]=function(_0x2c577f,_0x3f7e82){var _0x15a5d6={'raw':!![],'where':{'id':_0x2c577f[_0x0ffb('0x3f')]['id']}},_0x117644={};_0x117644[_0x0ffb('0x2d')]=_[_0x0ffb('0x40')](db['Variable']['rawAttributes']);_0x117644['query']=_['keys'](_0x2c577f['query']);_0x117644[_0x0ffb('0x2c')]=_[_0x0ffb('0x2f')](_0x117644[_0x0ffb('0x2d')],_0x117644['query']);_0x15a5d6[_0x0ffb('0x2e')]=_[_0x0ffb('0x2f')](_0x117644['model'],qs['fields'](_0x2c577f[_0x0ffb('0x2b')][_0x0ffb('0x30')]));_0x15a5d6[_0x0ffb('0x2e')]=_0x15a5d6['attributes'][_0x0ffb('0x31')]?_0x15a5d6[_0x0ffb('0x2e')]:_0x117644['model'];if(_0x2c577f[_0x0ffb('0x2b')]['includeAll']){_0x15a5d6[_0x0ffb('0x41')]=[{'all':!![]}];}_0x15a5d6=_[_0x0ffb('0x39')]({},_0x15a5d6,_0x2c577f[_0x0ffb('0x3b')]);return db['Variable']['find'](_0x15a5d6)['then'](handleEntityNotFound(_0x3f7e82,null))[_0x0ffb('0x1d')](respondWithResult(_0x3f7e82,null))[_0x0ffb('0x42')](handleError(_0x3f7e82,null));};exports[_0x0ffb('0x43')]=function(_0x3b6f5b,_0x19cea0){return db[_0x0ffb('0x26')]['create'](_0x3b6f5b['body'],{})[_0x0ffb('0x1d')](function(_0x4b0cc6){var _0x2e1905=_0x3b6f5b['user'][_0x0ffb('0x1f')]({'plain':!![]});if(!_0x2e1905)throw new Error(_0x0ffb('0x44'));if(_0x2e1905[_0x0ffb('0x45')]===_0x0ffb('0x46')){var _0x1f3453=_0x4b0cc6['get']({'plain':!![]});var _0xfb1768=_0x0ffb('0x20');return db['UserProfileSection']['find']({'where':{'name':_0xfb1768,'userProfileId':_0x2e1905['userProfileId']},'raw':!![]})['then'](function(_0x21404e){if(_0x21404e&&_0x21404e[_0x0ffb('0x47')]===0x0){return db[_0x0ffb('0x21')][_0x0ffb('0x43')]({'name':_0x1f3453[_0x0ffb('0x23')],'resourceId':_0x1f3453['id'],'type':_0x21404e[_0x0ffb('0x23')],'sectionId':_0x21404e['id']},{})['then'](function(){return _0x4b0cc6;});}else{return _0x4b0cc6;}})[_0x0ffb('0x42')](function(_0x2ab5b6){logger[_0x0ffb('0x22')](_0x0ffb('0x48'),_0x2ab5b6);throw _0x2ab5b6;});}return _0x4b0cc6;})[_0x0ffb('0x1d')](respondWithResult(_0x19cea0,0xc9))[_0x0ffb('0x42')](handleError(_0x19cea0,null));};exports[_0x0ffb('0x1c')]=function(_0x43a6a9,_0x361d48){if(_0x43a6a9[_0x0ffb('0x49')]['id']){delete _0x43a6a9[_0x0ffb('0x49')]['id'];}return db[_0x0ffb('0x26')][_0x0ffb('0x4a')]({'where':{'id':_0x43a6a9[_0x0ffb('0x3f')]['id']}})[_0x0ffb('0x1d')](handleEntityNotFound(_0x361d48,null))[_0x0ffb('0x1d')](saveUpdates(_0x43a6a9[_0x0ffb('0x49')],null))['then'](respondWithResult(_0x361d48,null))[_0x0ffb('0x42')](handleError(_0x361d48,null));};exports[_0x0ffb('0x1e')]=function(_0x12ff1d,_0x27b569){return db['Variable'][_0x0ffb('0x4a')]({'where':{'id':_0x12ff1d[_0x0ffb('0x3f')]['id']}})[_0x0ffb('0x1d')](handleEntityNotFound(_0x27b569,null))['then'](removeEntity(_0x27b569,null))[_0x0ffb('0x42')](handleError(_0x27b569,null));}; \ No newline at end of file +var _0x0c8d=['send','index','Variable','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','fields','include','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name'];(function(_0x45a22f,_0x3b0be6){var _0x5bdeba=function(_0x19360){while(--_0x19360){_0x45a22f['push'](_0x45a22f['shift']());}};_0x5bdeba(++_0x3b0be6);}(_0x0c8d,0x79));var _0xd0c8=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x0c8d[_0x2aea9e];return _0x430b92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd0c8('0x0'));var rimraf=require(_0xd0c8('0x1'));var zipdir=require(_0xd0c8('0x2'));var jsonpatch=require(_0xd0c8('0x3'));var rp=require(_0xd0c8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd0c8('0x5'));var sox=require(_0xd0c8('0x6'));var csv=require(_0xd0c8('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd0c8('0x8'));var squel=require('squel');var crypto=require(_0xd0c8('0x9'));var jsforce=require(_0xd0c8('0xa'));var deskjs=require(_0xd0c8('0xb'));var toCsv=require(_0xd0c8('0x7'));var querystring=require(_0xd0c8('0xc'));var Papa=require('papaparse');var Redis=require(_0xd0c8('0xd'));var authService=require(_0xd0c8('0xe'));var qs=require(_0xd0c8('0xf'));var as=require(_0xd0c8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd0c8('0x11'));var utils=require(_0xd0c8('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x537bc6,_0x512702){_0x512702=_0x512702||0xcc;return function(_0x52b163){if(_0x52b163){return _0x537bc6[_0xd0c8('0x13')](_0x512702);}return _0x537bc6[_0xd0c8('0x14')](_0x512702)['end']();};}function respondWithResult(_0x1e8049,_0x133ea4){_0x133ea4=_0x133ea4||0xc8;return function(_0x3346f3){if(_0x3346f3){return _0x1e8049[_0xd0c8('0x14')](_0x133ea4)[_0xd0c8('0x15')](_0x3346f3);}};}function respondWithFilteredResult(_0x39f5ae,_0x112b53){return function(_0x29ce57){if(_0x29ce57){var _0x2c25e8=_0x29ce57['count'],_0x3f52c9=_0x112b53[_0xd0c8('0x16')],_0x1d100c=_0x112b53[_0xd0c8('0x16')]+_0x112b53[_0xd0c8('0x17')],_0x1903f1;if(_0x1d100c>=_0x2c25e8){_0x1d100c=_0x2c25e8;_0x1903f1=0xc8;}else{_0x1903f1=0xce;}_0x39f5ae['status'](_0x1903f1);return _0x39f5ae['set'](_0xd0c8('0x18'),_0x3f52c9+'-'+_0x1d100c+'/'+_0x2c25e8)['json'](_0x29ce57);}return null;};}function patchUpdates(_0x5e797c){return function(_0x41a4ac){try{jsonpatch[_0xd0c8('0x19')](_0x41a4ac,_0x5e797c,!![]);}catch(_0x5b6b6f){return BPromise[_0xd0c8('0x1a')](_0x5b6b6f);}return _0x41a4ac[_0xd0c8('0x1b')]();};}function saveUpdates(_0x559ddd,_0x1a5a3d){return function(_0x26bee0){if(_0x26bee0){return _0x26bee0[_0xd0c8('0x1c')](_0x559ddd)[_0xd0c8('0x1d')](function(_0x15bf62){return _0x15bf62;});}return null;};}function removeEntity(_0x2cd879,_0x145b95){return function(_0x1a05fd){if(_0x1a05fd){return _0x1a05fd[_0xd0c8('0x1e')]()[_0xd0c8('0x1d')](function(){var _0x1e3536=_0x1a05fd[_0xd0c8('0x1f')]({'plain':!![]});var _0x30d143=_0xd0c8('0x20');return db[_0xd0c8('0x21')][_0xd0c8('0x1e')]({'where':{'type':_0x30d143,'resourceId':_0x1e3536['id']}})[_0xd0c8('0x1d')](function(){return _0x1a05fd;});})[_0xd0c8('0x1d')](function(){_0x2cd879[_0xd0c8('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49fa75,_0xc109ee){return function(_0x41cfd9){if(!_0x41cfd9){_0x49fa75[_0xd0c8('0x13')](0x194);}return _0x41cfd9;};}function handleError(_0x2ebc92,_0x1c84e5){_0x1c84e5=_0x1c84e5||0x1f4;return function(_0x1ccb37){logger[_0xd0c8('0x22')](_0x1ccb37[_0xd0c8('0x23')]);if(_0x1ccb37[_0xd0c8('0x24')]){delete _0x1ccb37['name'];}_0x2ebc92[_0xd0c8('0x14')](_0x1c84e5)[_0xd0c8('0x25')](_0x1ccb37);};}exports[_0xd0c8('0x26')]=function(_0x5b3f45,_0x51d660){var _0x4fa819={},_0x22e125={},_0x58f2c2={'count':0x0,'rows':[]};var _0x62ecc6=_['map'](db[_0xd0c8('0x27')][_0xd0c8('0x28')],function(_0x4abb89){return{'name':_0x4abb89[_0xd0c8('0x29')],'type':_0x4abb89[_0xd0c8('0x2a')][_0xd0c8('0x2b')]};});_0x22e125['model']=_[_0xd0c8('0x2c')](_0x62ecc6,_0xd0c8('0x24'));_0x22e125[_0xd0c8('0x2d')]=_[_0xd0c8('0x2e')](_0x5b3f45[_0xd0c8('0x2d')]);_0x22e125[_0xd0c8('0x2f')]=_[_0xd0c8('0x30')](_0x22e125[_0xd0c8('0x31')],_0x22e125[_0xd0c8('0x2d')]);_0x4fa819[_0xd0c8('0x32')]=_['intersection'](_0x22e125['model'],qs['fields'](_0x5b3f45[_0xd0c8('0x2d')]['fields']));_0x4fa819[_0xd0c8('0x32')]=_0x4fa819['attributes'][_0xd0c8('0x33')]?_0x4fa819[_0xd0c8('0x32')]:_0x22e125[_0xd0c8('0x31')];if(!_0x5b3f45[_0xd0c8('0x2d')][_0xd0c8('0x34')](_0xd0c8('0x35'))){_0x4fa819[_0xd0c8('0x17')]=qs['limit'](_0x5b3f45[_0xd0c8('0x2d')][_0xd0c8('0x17')]);_0x4fa819['offset']=qs[_0xd0c8('0x16')](_0x5b3f45[_0xd0c8('0x2d')][_0xd0c8('0x16')]);}_0x4fa819[_0xd0c8('0x36')]=qs[_0xd0c8('0x37')](_0x5b3f45[_0xd0c8('0x2d')]['sort']);_0x4fa819[_0xd0c8('0x38')]=qs[_0xd0c8('0x2f')](_[_0xd0c8('0x39')](_0x5b3f45[_0xd0c8('0x2d')],_0x22e125[_0xd0c8('0x2f')]),_0x62ecc6);if(_0x5b3f45[_0xd0c8('0x2d')][_0xd0c8('0x3a')]){_0x4fa819['where']=_[_0xd0c8('0x3b')](_0x4fa819[_0xd0c8('0x38')],{'$or':_[_0xd0c8('0x2c')](_0x62ecc6,function(_0x4dfc7f){if(_0x4dfc7f[_0xd0c8('0x2a')]!==_0xd0c8('0x3c')){var _0x1da5b7={};_0x1da5b7[_0x4dfc7f[_0xd0c8('0x24')]]={'$like':'%'+_0x5b3f45[_0xd0c8('0x2d')][_0xd0c8('0x3a')]+'%'};return _0x1da5b7;}})});}_0x4fa819=_[_0xd0c8('0x3b')]({},_0x4fa819,_0x5b3f45['options']);var _0x41e672={'where':_0x4fa819[_0xd0c8('0x38')]};return db[_0xd0c8('0x27')][_0xd0c8('0x3d')](_0x41e672)[_0xd0c8('0x1d')](function(_0x1470c4){_0x58f2c2[_0xd0c8('0x3d')]=_0x1470c4;if(_0x5b3f45['query'][_0xd0c8('0x3e')]){_0x4fa819['include']=[{'all':!![]}];}return db[_0xd0c8('0x27')][_0xd0c8('0x3f')](_0x4fa819);})['then'](function(_0x4a478c){_0x58f2c2[_0xd0c8('0x40')]=_0x4a478c;return _0x58f2c2;})[_0xd0c8('0x1d')](respondWithFilteredResult(_0x51d660,_0x4fa819))[_0xd0c8('0x41')](handleError(_0x51d660,null));};exports[_0xd0c8('0x42')]=function(_0x4e3af0,_0x2a72c1){var _0x296d85={'raw':!![],'where':{'id':_0x4e3af0['params']['id']}},_0x1187e1={};_0x1187e1[_0xd0c8('0x31')]=_[_0xd0c8('0x2e')](db[_0xd0c8('0x27')][_0xd0c8('0x28')]);_0x1187e1[_0xd0c8('0x2d')]=_['keys'](_0x4e3af0[_0xd0c8('0x2d')]);_0x1187e1[_0xd0c8('0x2f')]=_[_0xd0c8('0x30')](_0x1187e1[_0xd0c8('0x31')],_0x1187e1[_0xd0c8('0x2d')]);_0x296d85[_0xd0c8('0x32')]=_[_0xd0c8('0x30')](_0x1187e1[_0xd0c8('0x31')],qs[_0xd0c8('0x43')](_0x4e3af0['query'][_0xd0c8('0x43')]));_0x296d85[_0xd0c8('0x32')]=_0x296d85[_0xd0c8('0x32')]['length']?_0x296d85[_0xd0c8('0x32')]:_0x1187e1['model'];if(_0x4e3af0['query']['includeAll']){_0x296d85[_0xd0c8('0x44')]=[{'all':!![]}];}_0x296d85=_[_0xd0c8('0x3b')]({},_0x296d85,_0x4e3af0[_0xd0c8('0x45')]);return db[_0xd0c8('0x27')]['find'](_0x296d85)[_0xd0c8('0x1d')](handleEntityNotFound(_0x2a72c1,null))[_0xd0c8('0x1d')](respondWithResult(_0x2a72c1,null))['catch'](handleError(_0x2a72c1,null));};exports[_0xd0c8('0x46')]=function(_0x2e598d,_0x5b9fa6){return db[_0xd0c8('0x27')][_0xd0c8('0x46')](_0x2e598d[_0xd0c8('0x47')],{})['then'](function(_0x38309c){var _0x125e10=_0x2e598d[_0xd0c8('0x48')][_0xd0c8('0x1f')]({'plain':!![]});if(!_0x125e10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x125e10[_0xd0c8('0x49')]===_0xd0c8('0x48')){var _0x544049=_0x38309c[_0xd0c8('0x1f')]({'plain':!![]});var _0x5824ca=_0xd0c8('0x20');return db[_0xd0c8('0x4a')][_0xd0c8('0x4b')]({'where':{'name':_0x5824ca,'userProfileId':_0x125e10[_0xd0c8('0x4c')]},'raw':!![]})[_0xd0c8('0x1d')](function(_0x43d401){if(_0x43d401&&_0x43d401[_0xd0c8('0x4d')]===0x0){return db['UserProfileResource'][_0xd0c8('0x46')]({'name':_0x544049[_0xd0c8('0x24')],'resourceId':_0x544049['id'],'type':_0x43d401['name'],'sectionId':_0x43d401['id']},{})[_0xd0c8('0x1d')](function(){return _0x38309c;});}else{return _0x38309c;}})[_0xd0c8('0x41')](function(_0x21d9e9){logger[_0xd0c8('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21d9e9);throw _0x21d9e9;});}return _0x38309c;})[_0xd0c8('0x1d')](respondWithResult(_0x5b9fa6,0xc9))['catch'](handleError(_0x5b9fa6,null));};exports[_0xd0c8('0x1c')]=function(_0x195af6,_0x2b47d7){if(_0x195af6['body']['id']){delete _0x195af6['body']['id'];}return db['Variable'][_0xd0c8('0x4b')]({'where':{'id':_0x195af6[_0xd0c8('0x4e')]['id']}})[_0xd0c8('0x1d')](handleEntityNotFound(_0x2b47d7,null))[_0xd0c8('0x1d')](saveUpdates(_0x195af6[_0xd0c8('0x47')],null))[_0xd0c8('0x1d')](respondWithResult(_0x2b47d7,null))[_0xd0c8('0x41')](handleError(_0x2b47d7,null));};exports[_0xd0c8('0x1e')]=function(_0x54d13e,_0x106182){return db[_0xd0c8('0x27')]['find']({'where':{'id':_0x54d13e['params']['id']}})['then'](handleEntityNotFound(_0x106182,null))['then'](removeEntity(_0x106182,null))[_0xd0c8('0x41')](handleError(_0x106182,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a38ff96..a3df20f 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 _0xf937=['../../config/environment','./variable.attributes','exports','tools_variables','lodash','util','moment','bluebird','path','rimraf'];(function(_0x5e1d9b,_0x53fdbd){var _0x5761b0=function(_0x21fde8){while(--_0x21fde8){_0x5e1d9b['push'](_0x5e1d9b['shift']());}};_0x5761b0(++_0x53fdbd);}(_0xf937,0x1e4));var _0x7f93=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0xf937[_0x4207f4];return _0x29a621;};'use strict';var _=require(_0x7f93('0x0'));var util=require(_0x7f93('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7f93('0x2'));var BPromise=require(_0x7f93('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f93('0x4'));var rimraf=require(_0x7f93('0x5'));var config=require(_0x7f93('0x6'));var attributes=require(_0x7f93('0x7'));module[_0x7f93('0x8')]=function(_0x1eaca8,_0x329996){return _0x1eaca8['define']('Variable',attributes,{'tableName':_0x7f93('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0077=['tools_variables','util','api','bluebird','request-promise','rimraf','./variable.attributes','exports','define'];(function(_0xbc2e2f,_0x2e5db5){var _0x4293fc=function(_0x415ac4){while(--_0x415ac4){_0xbc2e2f['push'](_0xbc2e2f['shift']());}};_0x4293fc(++_0x2e5db5);}(_0x0077,0x64));var _0x7007=function(_0x559e6f,_0x34cfd2){_0x559e6f=_0x559e6f-0x0;var _0x345135=_0x0077[_0x559e6f];return _0x345135;};'use strict';var _=require('lodash');var util=require(_0x7007('0x0'));var logger=require('../../config/logger')(_0x7007('0x1'));var moment=require('moment');var BPromise=require(_0x7007('0x2'));var rp=require(_0x7007('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7007('0x4'));var config=require('../../config/environment');var attributes=require(_0x7007('0x5'));module[_0x7007('0x6')]=function(_0x45b7ea,_0x47798f){return _0x45b7ea[_0x7007('0x7')]('Variable',attributes,{'tableName':_0x7007('0x8'),'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 45425c2..22aa5fd 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 _0xceb2=['Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','options','raw','where','include','attributes','model','ShowVariable','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Variable,\x20%s,\x20%s','debug'];(function(_0x499d15,_0x5376c1){var _0x189291=function(_0x52884f){while(--_0x52884f){_0x499d15['push'](_0x499d15['shift']());}};_0x189291(++_0x5376c1);}(_0xceb2,0xc4));var _0x2ceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceb2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2ceb('0x0'));var util=require('util');var moment=require(_0x2ceb('0x1'));var BPromise=require('bluebird');var rs=require(_0x2ceb('0x2'));var fs=require('fs');var Redis=require(_0x2ceb('0x3'));var db=require(_0x2ceb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ceb('0x5'))(_0x2ceb('0x6'));var config=require(_0x2ceb('0x7'));var jayson=require(_0x2ceb('0x8'));var client=jayson[_0x2ceb('0x9')][_0x2ceb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7b90,_0xf567f0,_0xe83a23){return new BPromise(function(_0x2f960a,_0x54e6c0){return client['request'](_0x3f7b90,_0xe83a23)[_0x2ceb('0xb')](function(_0x4b2c98){logger['info'](_0x2ceb('0xc'),_0xf567f0,'request\x20sent');logger[_0x2ceb('0xd')](_0x2ceb('0xe'),_0xf567f0,_0x2ceb('0xf'),JSON['stringify'](_0x4b2c98));if(_0x4b2c98['error']){if(_0x4b2c98[_0x2ceb('0x10')][_0x2ceb('0x11')]===0x1f4){logger['error'](_0x2ceb('0xc'),_0xf567f0,_0x4b2c98[_0x2ceb('0x10')][_0x2ceb('0x12')]);return _0x54e6c0(_0x4b2c98[_0x2ceb('0x10')][_0x2ceb('0x12')]);}logger['error'](_0x2ceb('0xc'),_0xf567f0,_0x4b2c98['error'][_0x2ceb('0x12')]);return _0x2f960a(_0x4b2c98[_0x2ceb('0x10')][_0x2ceb('0x12')]);}else{logger[_0x2ceb('0x13')]('Variable,\x20%s,\x20%s',_0xf567f0,_0x2ceb('0xf'));_0x2f960a(_0x4b2c98[_0x2ceb('0x14')][_0x2ceb('0x12')]);}})[_0x2ceb('0x15')](function(_0x42b6ba){logger[_0x2ceb('0x10')](_0x2ceb('0xc'),_0xf567f0,_0x42b6ba);_0x54e6c0(_0x42b6ba);});});}exports['ShowVariable']=function(_0x2c541c){var _0x3200ac=this;return new Promise(function(_0x3e8d1e,_0x283c2a){return db['Variable']['find']({'raw':_0x2c541c[_0x2ceb('0x16')]?_0x2c541c[_0x2ceb('0x16')][_0x2ceb('0x17')]===undefined?!![]:![]:!![],'where':_0x2c541c['options']?_0x2c541c[_0x2ceb('0x16')][_0x2ceb('0x18')]||null:null,'attributes':_0x2c541c[_0x2ceb('0x16')]?_0x2c541c[_0x2ceb('0x16')]['attributes']||null:null,'include':_0x2c541c['options']?_0x2c541c['options']['include']?_['map'](_0x2c541c[_0x2ceb('0x16')][_0x2ceb('0x19')],function(_0x30b885){return{'model':db[_0x30b885['model']],'as':_0x30b885['as'],'attributes':_0x30b885['attributes'],'include':_0x30b885[_0x2ceb('0x19')]?_['map'](_0x30b885[_0x2ceb('0x19')],function(_0x4c066d){return{'model':db[_0x4c066d['model']],'as':_0x4c066d['as'],'attributes':_0x4c066d[_0x2ceb('0x1a')],'include':_0x4c066d['include']?_['map'](_0x4c066d[_0x2ceb('0x19')],function(_0x2efe56){return{'model':db[_0x2efe56[_0x2ceb('0x1b')]],'as':_0x2efe56['as'],'attributes':_0x2efe56[_0x2ceb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2ceb('0xb')](function(_0x290144){logger['info'](_0x2ceb('0x1c'),_0x2c541c);logger[_0x2ceb('0xd')](_0x2ceb('0x1c'),_0x2c541c,JSON[_0x2ceb('0x1d')](_0x290144));_0x3e8d1e(_0x290144);})[_0x2ceb('0x15')](function(_0x2362a1){logger[_0x2ceb('0x10')](_0x2ceb('0x1c'),_0x2362a1[_0x2ceb('0x12')],_0x2c541c);_0x283c2a(_0x3200ac[_0x2ceb('0x10')](0x1f4,_0x2362a1['message']));});});}; \ No newline at end of file +var _0x142a=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','find','options','raw','include','model','attributes','map','then','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x21ab01,_0x116a43){var _0x1a6be1=function(_0x806ff2){while(--_0x806ff2){_0x21ab01['push'](_0x21ab01['shift']());}};_0x1a6be1(++_0x116a43);}(_0x142a,0xc6));var _0xa142=function(_0x5ec933,_0x3a9505){_0x5ec933=_0x5ec933-0x0;var _0x3ad2c9=_0x142a[_0x5ec933];return _0x3ad2c9;};'use strict';var _=require(_0xa142('0x0'));var util=require(_0xa142('0x1'));var moment=require(_0xa142('0x2'));var BPromise=require(_0xa142('0x3'));var rs=require(_0xa142('0x4'));var fs=require('fs');var Redis=require(_0xa142('0x5'));var db=require(_0xa142('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa142('0x7'))(_0xa142('0x8'));var config=require(_0xa142('0x9'));var jayson=require(_0xa142('0xa'));var client=jayson[_0xa142('0xb')][_0xa142('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c8a91,_0x24f9c6,_0x5cf43c){return new BPromise(function(_0x278298,_0x4b0b14){return client[_0xa142('0xd')](_0x1c8a91,_0x5cf43c)['then'](function(_0x2bbb55){logger[_0xa142('0xe')](_0xa142('0xf'),_0x24f9c6,_0xa142('0x10'));logger[_0xa142('0x11')](_0xa142('0x12'),_0x24f9c6,'request\x20sent',JSON[_0xa142('0x13')](_0x2bbb55));if(_0x2bbb55['error']){if(_0x2bbb55['error']['code']===0x1f4){logger[_0xa142('0x14')](_0xa142('0xf'),_0x24f9c6,_0x2bbb55[_0xa142('0x14')][_0xa142('0x15')]);return _0x4b0b14(_0x2bbb55[_0xa142('0x14')][_0xa142('0x15')]);}logger['error'](_0xa142('0xf'),_0x24f9c6,_0x2bbb55[_0xa142('0x14')][_0xa142('0x15')]);return _0x278298(_0x2bbb55[_0xa142('0x14')][_0xa142('0x15')]);}else{logger[_0xa142('0xe')]('Variable,\x20%s,\x20%s',_0x24f9c6,_0xa142('0x10'));_0x278298(_0x2bbb55[_0xa142('0x16')][_0xa142('0x15')]);}})[_0xa142('0x17')](function(_0x3e5500){logger['error'](_0xa142('0xf'),_0x24f9c6,_0x3e5500);_0x4b0b14(_0x3e5500);});});}exports[_0xa142('0x18')]=function(_0x381bcf){var _0x2eabf9=this;return new Promise(function(_0x2eb226,_0x30ef64){return db[_0xa142('0x19')][_0xa142('0x1a')]({'raw':_0x381bcf[_0xa142('0x1b')]?_0x381bcf['options'][_0xa142('0x1c')]===undefined?!![]:![]:!![],'where':_0x381bcf[_0xa142('0x1b')]?_0x381bcf[_0xa142('0x1b')]['where']||null:null,'attributes':_0x381bcf[_0xa142('0x1b')]?_0x381bcf['options']['attributes']||null:null,'include':_0x381bcf[_0xa142('0x1b')]?_0x381bcf[_0xa142('0x1b')][_0xa142('0x1d')]?_['map'](_0x381bcf[_0xa142('0x1b')][_0xa142('0x1d')],function(_0x20a63e){return{'model':db[_0x20a63e[_0xa142('0x1e')]],'as':_0x20a63e['as'],'attributes':_0x20a63e['attributes'],'include':_0x20a63e[_0xa142('0x1d')]?_['map'](_0x20a63e['include'],function(_0x1536f2){return{'model':db[_0x1536f2[_0xa142('0x1e')]],'as':_0x1536f2['as'],'attributes':_0x1536f2[_0xa142('0x1f')],'include':_0x1536f2[_0xa142('0x1d')]?_[_0xa142('0x20')](_0x1536f2[_0xa142('0x1d')],function(_0x2f6f69){return{'model':db[_0x2f6f69[_0xa142('0x1e')]],'as':_0x2f6f69['as'],'attributes':_0x2f6f69[_0xa142('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa142('0x21')](function(_0x38396f){logger['info'](_0xa142('0x18'),_0x381bcf);logger[_0xa142('0x11')](_0xa142('0x18'),_0x381bcf,JSON[_0xa142('0x13')](_0x38396f));_0x2eb226(_0x38396f);})[_0xa142('0x17')](function(_0x2cc285){logger['error']('ShowVariable',_0x2cc285[_0xa142('0x15')],_0x381bcf);_0x30ef64(_0x2eabf9[_0xa142('0x14')](0x1f4,_0x2cc285[_0xa142('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 342dda7..fac2126 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 _0x0e45=['../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router'];(function(_0x47994e,_0x270c34){var _0x1c55fb=function(_0x2e7b35){while(--_0x2e7b35){_0x47994e['push'](_0x47994e['shift']());}};_0x1c55fb(++_0x270c34);}(_0x0e45,0x18a));var _0x50e4=function(_0x3a1600,_0x460ef0){_0x3a1600=_0x3a1600-0x0;var _0xfc157f=_0x0e45[_0x3a1600];return _0xfc157f;};'use strict';var express=require(_0x50e4('0x0'));var router=express[_0x50e4('0x1')]();var auth=require(_0x50e4('0x2'));var controller=require(_0x50e4('0x3'));router[_0x50e4('0x4')]('/',controller[_0x50e4('0x5')]);router[_0x50e4('0x4')](_0x50e4('0x6'),auth[_0x50e4('0x7')](),auth[_0x50e4('0x8')](),controller[_0x50e4('0x9')]);router[_0x50e4('0x4')]('/reset',auth[_0x50e4('0x7')](),auth[_0x50e4('0x8')](),controller[_0x50e4('0xa')]);router['get'](_0x50e4('0xb'),auth[_0x50e4('0x7')](),auth['canUpdate'](),controller[_0x50e4('0xc')]);router[_0x50e4('0x4')](_0x50e4('0xd'),auth[_0x50e4('0x7')](),controller[_0x50e4('0xe')]);router[_0x50e4('0x4')](_0x50e4('0xf'),controller[_0x50e4('0x10')]);module[_0x50e4('0x11')]=router; \ No newline at end of file +var _0x5569=['express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull','/migrations','migrations'];(function(_0x3862cd,_0x299e88){var _0x2864a1=function(_0x3aa417){while(--_0x3aa417){_0x3862cd['push'](_0x3862cd['shift']());}};_0x2864a1(++_0x299e88);}(_0x5569,0x1a4));var _0x9556=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x5569[_0x296809];return _0x18c0d3;};'use strict';var express=require(_0x9556('0x0'));var router=express['Router']();var auth=require(_0x9556('0x1'));var controller=require(_0x9556('0x2'));router[_0x9556('0x3')]('/',controller[_0x9556('0x4')]);router[_0x9556('0x3')](_0x9556('0x5'),auth[_0x9556('0x6')](),auth[_0x9556('0x7')](),controller[_0x9556('0x8')]);router[_0x9556('0x3')](_0x9556('0x9'),auth[_0x9556('0x6')](),auth[_0x9556('0x7')](),controller['reset']);router['get'](_0x9556('0xa'),auth[_0x9556('0x6')](),auth[_0x9556('0x7')](),controller[_0x9556('0xb')]);router['get']('/restart',auth['isAuthenticated'](),controller['restart']);router[_0x9556('0x3')](_0x9556('0xc'),controller[_0x9556('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index ce93ec2..a84f0f2 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 _0xfb11=['.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','exec','../../config/environment','../../config/pm2','update','simple-git','index','exports','version','query','latest','fetch','2.0.0','status','json','origin','master','error','git\x20fetch','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','root','server','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xfb11[_0x4fc9e6];return _0x551d28;};'use strict';var Umzug=require(_0x1fb1('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x1fb1('0x1'));var pkginfo=require(_0x1fb1('0x2'))(module,'version');var compareVersions=require(_0x1fb1('0x3'));var exec=require('child_process')[_0x1fb1('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0x1fb1('0x5'));var pm2=require(_0x1fb1('0x6'));var logger=require('../../config/logger')(_0x1fb1('0x7'));var git=require(_0x1fb1('0x8'))(config['root']);exports[_0x1fb1('0x9')]=function(_0x2596c2,_0x34e61a){var _0x236b20={'current':module[_0x1fb1('0xa')][_0x1fb1('0xb')],'phonebar':0x2};if(_0x2596c2[_0x1fb1('0xc')]&&_0x2596c2[_0x1fb1('0xc')][_0x1fb1('0xd')]){return git[_0x1fb1('0xe')]()['tags'](function(_0x232036,_0x53f30e){_0x236b20[_0x1fb1('0xd')]=(_0x232036?module['exports'][_0x1fb1('0xb')]:_0x53f30e[_0x1fb1('0xd')])||_0x1fb1('0xf');return _0x34e61a[_0x1fb1('0x10')](0xc8)[_0x1fb1('0x11')](_0x236b20);});}else{return _0x34e61a[_0x1fb1('0x10')](0xc8)['json'](_0x236b20);}};exports[_0x1fb1('0xe')]=function(_0xf371e8,_0x2c5be1){return git[_0x1fb1('0xe')]([_0x1fb1('0x12'),_0x1fb1('0x13')],function(_0x151152){if(_0x151152){logger[_0x1fb1('0x14')](_0x151152);return _0x2c5be1[_0x1fb1('0x10')](0x1f4)['json'](_0x151152);}logger['info'](_0x1fb1('0x15'));return _0x2c5be1[_0x1fb1('0x10')](0xc8)[_0x1fb1('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x1fb1('0x16')]=function(_0x23f1f5,_0x24d4df){return git[_0x1fb1('0x16')]([_0x1fb1('0x17'),_0x1fb1('0x18')],function(_0x10df7b){if(_0x10df7b){logger[_0x1fb1('0x14')](_0x10df7b);return _0x24d4df[_0x1fb1('0x10')](0x1f4)['json'](_0x10df7b);}logger[_0x1fb1('0x19')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x24d4df['status'](0xc8)[_0x1fb1('0x11')]({'output':_0x1fb1('0x1a')});});};exports[_0x1fb1('0x1b')]=function(_0x54ad97,_0x12df9f){exec('npm\x20install\x20--production',function(_0x5c76f5,_0x532c63,_0x31178c){logger[_0x1fb1('0x19')](_0x532c63);logger[_0x1fb1('0x19')](_0x31178c);if(_0x5c76f5){logger[_0x1fb1('0x14')](_0x5c76f5);return _0x12df9f[_0x1fb1('0x10')](0x1f4)['json'](_0x5c76f5);}return _0x12df9f[_0x1fb1('0x10')](0xc8)[_0x1fb1('0x11')]({'output':_0x532c63});});};exports[_0x1fb1('0x1c')]=function(_0x5fc9e6,_0x2bc885){return pm2[_0x1fb1('0x1c')](_0x1fb1('0x1d'))[_0x1fb1('0x1e')](function(_0x530a5e){logger[_0x1fb1('0x19')](_0x1fb1('0x1f'),_0x530a5e);return _0x2bc885[_0x1fb1('0x10')](0xc8)[_0x1fb1('0x11')]({'output':_0x1fb1('0x20')});})[_0x1fb1('0x21')](function(_0x1a74c4){logger[_0x1fb1('0x14')](_0x1a74c4);return _0x2bc885[_0x1fb1('0x10')](0x1f4)[_0x1fb1('0x11')](_0x1a74c4);});};exports[_0x1fb1('0x22')]=function(_0x497017,_0x39fc43){var _0xe8ec0a=fs[_0x1fb1('0x23')](path['join'](config[_0x1fb1('0x24')],_0x1fb1('0x25'),_0x1fb1('0x22')));var _0x1b71cb=[];for(var _0x5402e9=0x0;_0x5402e9<_0xe8ec0a[_0x1fb1('0x26')];_0x5402e9++){var _0x30c8eb=_0xe8ec0a[_0x5402e9]['replace'](_0x1fb1('0x27'),'');if(compareVersions(module['exports']['version'],_0x30c8eb)===-0x1){_0x1b71cb[_0x1fb1('0x28')](_0x30c8eb);}}if(_0x1b71cb[_0x1fb1('0x26')]){var _0x54e813=_0x1b71cb[_0x1fb1('0x29')](compareVersions);var _0x149753=new Umzug({'storage':_0x1fb1('0x2a'),'storageOptions':{'model':db[_0x1fb1('0x2b')],'modelName':_0x1fb1('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0x1fb1('0x2a')][_0x1fb1('0x2c')](),db[_0x1fb1('0x2a')][_0x1fb1('0x2d')],function(){throw new Error(_0x1fb1('0x2e'));}],'path':path[_0x1fb1('0x2f')](config[_0x1fb1('0x24')],_0x1fb1('0x25'),_0x1fb1('0x22')),'pattern':/\.js$/}});_0x149753['up']({'migrations':_['map'](_0x54e813,function(_0x2d74b9){return _0x2d74b9+'.js';})})[_0x1fb1('0x1e')](function(){return _0x39fc43['status'](0xc8)[_0x1fb1('0x11')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x1fb1('0xb')]+_0x1fb1('0x30')+_[_0x1fb1('0x31')](_0x54e813),'migrations':_[_0x1fb1('0x2f')](_0x54e813)});})['catch'](function(_0x3b0642){if(_0x3b0642 instanceof db[_0x1fb1('0x2a')][_0x1fb1('0x32')]){return _0x39fc43['status'](0xc8)[_0x1fb1('0x11')]({'output':_0x1fb1('0x33')});}else{return _0x39fc43[_0x1fb1('0x10')](0x1f4)[_0x1fb1('0x11')](_0x3b0642);}});}else{return _0x39fc43[_0x1fb1('0x10')](0xc8)[_0x1fb1('0x11')]({'output':_0x1fb1('0x33')});}}; \ No newline at end of file +var _0x5ed9=['path','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','update','root','index','exports','query','latest','tags','json','status','fetch','origin','error','info','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','push','length','sort','sequelize','Migration','constructor','.js','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug'];(function(_0x1130e4,_0x14fa7f){var _0x46b2fc=function(_0x463454){while(--_0x463454){_0x1130e4['push'](_0x1130e4['shift']());}};_0x46b2fc(++_0x14fa7f);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5ed9[_0x138adb];return _0x1b27f2;};'use strict';var Umzug=require(_0x95ed('0x0'));var path=require(_0x95ed('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x95ed('0x2'))(module,_0x95ed('0x3'));var compareVersions=require(_0x95ed('0x4'));var exec=require(_0x95ed('0x5'))['exec'];var db=require(_0x95ed('0x6'))['db'];var config=require(_0x95ed('0x7'));var pm2=require(_0x95ed('0x8'));var logger=require('../../config/logger')(_0x95ed('0x9'));var git=require('simple-git')(config[_0x95ed('0xa')]);exports[_0x95ed('0xb')]=function(_0x3753b5,_0x1df51f){var _0x46ed43={'current':module[_0x95ed('0xc')]['version'],'phonebar':0x2};if(_0x3753b5[_0x95ed('0xd')]&&_0x3753b5[_0x95ed('0xd')][_0x95ed('0xe')]){return git['fetch']()[_0x95ed('0xf')](function(_0x478a34,_0x3a4333){_0x46ed43[_0x95ed('0xe')]=(_0x478a34?module[_0x95ed('0xc')][_0x95ed('0x3')]:_0x3a4333[_0x95ed('0xe')])||'2.0.0';return _0x1df51f['status'](0xc8)[_0x95ed('0x10')](_0x46ed43);});}else{return _0x1df51f[_0x95ed('0x11')](0xc8)['json'](_0x46ed43);}};exports['fetch']=function(_0x2782a5,_0x11671d){return git[_0x95ed('0x12')]([_0x95ed('0x13'),'master'],function(_0x213355){if(_0x213355){logger[_0x95ed('0x14')](_0x213355);return _0x11671d[_0x95ed('0x11')](0x1f4)[_0x95ed('0x10')](_0x213355);}logger[_0x95ed('0x15')]('git\x20fetch');return _0x11671d[_0x95ed('0x11')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x1ffa55,_0x58fb9e){return git[_0x95ed('0x16')]([_0x95ed('0x17'),'FETCH_HEAD'],function(_0xa5a91){if(_0xa5a91){logger[_0x95ed('0x14')](_0xa5a91);return _0x58fb9e[_0x95ed('0x11')](0x1f4)[_0x95ed('0x10')](_0xa5a91);}logger[_0x95ed('0x15')](_0x95ed('0x18'));return _0x58fb9e[_0x95ed('0x11')](0xc8)[_0x95ed('0x10')]({'output':_0x95ed('0x19')});});};exports[_0x95ed('0x1a')]=function(_0x5887e3,_0xd798ec){exec(_0x95ed('0x1b'),function(_0x4e8a5d,_0x5d5afe,_0x54c5ae){logger[_0x95ed('0x15')](_0x5d5afe);logger[_0x95ed('0x15')](_0x54c5ae);if(_0x4e8a5d){logger[_0x95ed('0x14')](_0x4e8a5d);return _0xd798ec[_0x95ed('0x11')](0x1f4)[_0x95ed('0x10')](_0x4e8a5d);}return _0xd798ec[_0x95ed('0x11')](0xc8)[_0x95ed('0x10')]({'output':_0x5d5afe});});};exports[_0x95ed('0x1c')]=function(_0x146f74,_0x3bcb6d){return pm2[_0x95ed('0x1c')](_0x95ed('0x1d'))[_0x95ed('0x1e')](function(_0x25b1fc){logger['info'](_0x95ed('0x1f'),_0x25b1fc);return _0x3bcb6d['status'](0xc8)['json']({'output':_0x95ed('0x20')});})[_0x95ed('0x21')](function(_0x45e403){logger[_0x95ed('0x14')](_0x45e403);return _0x3bcb6d[_0x95ed('0x11')](0x1f4)[_0x95ed('0x10')](_0x45e403);});};exports[_0x95ed('0x22')]=function(_0x190620,_0x39330d){var _0x3f3ed9=fs[_0x95ed('0x23')](path[_0x95ed('0x24')](config['root'],_0x95ed('0x25'),_0x95ed('0x22')));var _0x53b1f4=[];for(var _0x28c738=0x0;_0x28c738<_0x3f3ed9['length'];_0x28c738++){var _0x5365ae=_0x3f3ed9[_0x28c738]['replace']('.js','');if(compareVersions(module['exports'][_0x95ed('0x3')],_0x5365ae)===-0x1){_0x53b1f4[_0x95ed('0x26')](_0x5365ae);}}if(_0x53b1f4[_0x95ed('0x27')]){var _0x20f565=_0x53b1f4[_0x95ed('0x28')](compareVersions);var _0x2f9d90=new Umzug({'storage':_0x95ed('0x29'),'storageOptions':{'model':db['Migration'],'modelName':_0x95ed('0x2a'),'columnName':_0x95ed('0x3')},'migrations':{'params':[db[_0x95ed('0x29')]['getQueryInterface'](),db['sequelize'][_0x95ed('0x2b')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config['root'],'server',_0x95ed('0x22')),'pattern':/\.js$/}});_0x2f9d90['up']({'migrations':_['map'](_0x20f565,function(_0x15c1b5){return _0x15c1b5+_0x95ed('0x2c');})})['then'](function(){return _0x39330d['status'](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x95ed('0x3')]+_0x95ed('0x2d')+_[_0x95ed('0x2e')](_0x20f565),'migrations':_[_0x95ed('0x24')](_0x20f565)});})[_0x95ed('0x21')](function(_0x431690){if(_0x431690 instanceof db['sequelize'][_0x95ed('0x2f')]){return _0x39330d[_0x95ed('0x11')](0xc8)[_0x95ed('0x10')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x39330d[_0x95ed('0x11')](0x1f4)[_0x95ed('0x10')](_0x431690);}});}else{return _0x39330d[_0x95ed('0x11')](0xc8)[_0x95ed('0x10')]({'output':_0x95ed('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9e51cf9..c00a62f 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 _0x6ab1=['put','/:id','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','show','post','create'];(function(_0x25b400,_0x135d12){var _0x4249ed=function(_0xce5811){while(--_0xce5811){_0x25b400['push'](_0x25b400['shift']());}};_0x4249ed(++_0x135d12);}(_0x6ab1,0x77));var _0x16ab=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x6ab1[_0x540133];return _0x26b6e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x16ab('0x0'));var timeout=require(_0x16ab('0x1'));var express=require(_0x16ab('0x2'));var router=express[_0x16ab('0x3')]();var auth=require(_0x16ab('0x4'));var interaction=require(_0x16ab('0x5'));var config=require(_0x16ab('0x6'));var controller=require(_0x16ab('0x7'));router[_0x16ab('0x8')]('/',auth[_0x16ab('0x9')](),controller['index']);router[_0x16ab('0x8')](_0x16ab('0xa'),auth[_0x16ab('0x9')](),controller['describe']);router[_0x16ab('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x16ab('0xb')]);router[_0x16ab('0xc')]('/',auth[_0x16ab('0x9')](),controller[_0x16ab('0xd')]);router[_0x16ab('0xe')](_0x16ab('0xf'),auth[_0x16ab('0x9')](),controller[_0x16ab('0x10')]);router[_0x16ab('0x11')]('/:id',auth[_0x16ab('0x9')](),controller['destroy']);module[_0x16ab('0x12')]=router; \ No newline at end of file +var _0xa6c7=['/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x8854f2,_0x79542c){var _0x38505d=function(_0x5af02b){while(--_0x5af02b){_0x8854f2['push'](_0x8854f2['shift']());}};_0x38505d(++_0x79542c);}(_0xa6c7,0x196));var _0x7a6c=function(_0x268c52,_0x1c41e3){_0x268c52=_0x268c52-0x0;var _0x933625=_0xa6c7[_0x268c52];return _0x933625;};'use strict';var multer=require(_0x7a6c('0x0'));var util=require(_0x7a6c('0x1'));var path=require(_0x7a6c('0x2'));var timeout=require(_0x7a6c('0x3'));var express=require(_0x7a6c('0x4'));var router=express[_0x7a6c('0x5')]();var auth=require(_0x7a6c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7a6c('0x7'));var controller=require(_0x7a6c('0x8'));router[_0x7a6c('0x9')]('/',auth[_0x7a6c('0xa')](),controller[_0x7a6c('0xb')]);router['get'](_0x7a6c('0xc'),auth[_0x7a6c('0xa')](),controller['describe']);router[_0x7a6c('0x9')](_0x7a6c('0xd'),auth[_0x7a6c('0xa')](),controller[_0x7a6c('0xe')]);router[_0x7a6c('0xf')]('/',auth[_0x7a6c('0xa')](),controller[_0x7a6c('0x10')]);router[_0x7a6c('0x11')](_0x7a6c('0xd'),auth['isAuthenticated'](),controller[_0x7a6c('0x12')]);router[_0x7a6c('0x13')](_0x7a6c('0xd'),auth[_0x7a6c('0xa')](),controller[_0x7a6c('0x14')]);module[_0x7a6c('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 94c38d8..f2b57c0 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d17=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x51b368,_0xcfee9){var _0x4e4934=function(_0x46677d){while(--_0x46677d){_0x51b368['push'](_0x51b368['shift']());}};_0x4e4934(++_0xcfee9);}(_0x2d17,0x17e));var _0x72d1=function(_0x636970,_0x50c5ae){_0x636970=_0x636970-0x0;var _0x5ac5a5=_0x2d17[_0x636970];return _0x5ac5a5;};'use strict';var Sequelize=require(_0x72d1('0x0'));module[_0x72d1('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x72d1('0x2')]},'calleridnum':{'type':Sequelize[_0x72d1('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x72d1('0x2')]},'interface':{'type':Sequelize[_0x72d1('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x72d1('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x72d1('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x72d1('0x3')]},'holdtime':{'type':Sequelize[_0x72d1('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x72d1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x72d1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x72d1('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x72d1('0x4')]},'reason':{'type':Sequelize[_0x72d1('0x2')]},'lastevent':{'type':Sequelize[_0x72d1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x72d1('0x4')]},'channelstatedesc':{'type':Sequelize[_0x72d1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x72d1('0x2')]},'connectedlinename':{'type':Sequelize[_0x72d1('0x2')]},'language':{'type':Sequelize[_0x72d1('0x2')]},'accountcode':{'type':Sequelize[_0x72d1('0x2')]},'context':{'type':Sequelize[_0x72d1('0x2')]},'exten':{'type':Sequelize[_0x72d1('0x2')]},'priority':{'type':Sequelize[_0x72d1('0x2')]},'destchannel':{'type':Sequelize[_0x72d1('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x72d1('0x2')]},'destcalleridnum':{'type':Sequelize[_0x72d1('0x2')]},'destcalleridname':{'type':Sequelize[_0x72d1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x72d1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x72d1('0x2')]},'destlanguage':{'type':Sequelize[_0x72d1('0x2')]},'destaccountcode':{'type':Sequelize[_0x72d1('0x2')]},'destcontext':{'type':Sequelize[_0x72d1('0x2')]},'destexten':{'type':Sequelize[_0x72d1('0x2')]},'destpriority':{'type':Sequelize[_0x72d1('0x2')]},'destuniqueid':{'type':Sequelize[_0x72d1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x72d1('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x72d1('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x72d1('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x72d1('0x2')]},'transferuniqueid':{'type':Sequelize[_0x72d1('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x33c5=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER'];(function(_0x2056cb,_0x4eb699){var _0x209c44=function(_0x42fd2c){while(--_0x42fd2c){_0x2056cb['push'](_0x2056cb['shift']());}};_0x209c44(++_0x4eb699);}(_0x33c5,0xe6));var _0x533c=function(_0x273f88,_0x5d4150){_0x273f88=_0x273f88-0x0;var _0x177ca1=_0x33c5[_0x273f88];return _0x177ca1;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'type':{'type':Sequelize[_0x533c('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x533c('0x1')]},'calleridname':{'type':Sequelize[_0x533c('0x1')]},'queue':{'type':Sequelize[_0x533c('0x1')]},'interface':{'type':Sequelize[_0x533c('0x1')]},'membername':{'type':Sequelize[_0x533c('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x533c('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x533c('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x533c('0x2')]},'agentdumpAt':{'type':Sequelize[_0x533c('0x2')]},'holdtime':{'type':Sequelize[_0x533c('0x3')]},'agentcomplete':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x533c('0x3')]},'agentacw':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x533c('0x3')]},'reason':{'type':Sequelize[_0x533c('0x1')]},'lastevent':{'type':Sequelize[_0x533c('0x1')]},'channel':{'type':Sequelize[_0x533c('0x1')]},'channelstate':{'type':Sequelize[_0x533c('0x3')]},'channelstatedesc':{'type':Sequelize[_0x533c('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x533c('0x1')]},'language':{'type':Sequelize[_0x533c('0x1')]},'accountcode':{'type':Sequelize[_0x533c('0x1')]},'context':{'type':Sequelize[_0x533c('0x1')]},'exten':{'type':Sequelize[_0x533c('0x1')]},'priority':{'type':Sequelize[_0x533c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x533c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x533c('0x1')]},'destcalleridnum':{'type':Sequelize[_0x533c('0x1')]},'destcalleridname':{'type':Sequelize[_0x533c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x533c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x533c('0x1')]},'destlanguage':{'type':Sequelize[_0x533c('0x1')]},'destaccountcode':{'type':Sequelize[_0x533c('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x533c('0x1')]},'destpriority':{'type':Sequelize[_0x533c('0x1')]},'destuniqueid':{'type':Sequelize[_0x533c('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x533c('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x533c('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x533c('0x1')],'comment':_0x533c('0x5')},'transferexten':{'type':Sequelize[_0x533c('0x1')]},'transferuniqueid':{'type':Sequelize[_0x533c('0x1')]},'agententerreason':{'type':Sequelize[_0x533c('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 54fc96d..a15692e 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 _0xfb71=['name','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','error','stack'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xfb71,0x6c));var _0x1fb7=function(_0x5e8826,_0x40ca2d){_0x5e8826=_0x5e8826-0x0;var _0x2c3b15=_0xfb71[_0x5e8826];return _0x2c3b15;};'use strict';var pdf=require(_0x1fb7('0x0'));var emlformat=require(_0x1fb7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1fb7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fb7('0x3'));var moment=require(_0x1fb7('0x4'));var BPromise=require(_0x1fb7('0x5'));var Mustache=require(_0x1fb7('0x6'));var util=require(_0x1fb7('0x7'));var path=require(_0x1fb7('0x8'));var sox=require(_0x1fb7('0x9'));var csv=require(_0x1fb7('0xa'));var ejs=require(_0x1fb7('0xb'));var fs=require('fs');var _=require(_0x1fb7('0xc'));var squel=require(_0x1fb7('0xd'));var crypto=require(_0x1fb7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1fb7('0xf'));var toCsv=require(_0x1fb7('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1fb7('0x10'));var authService=require(_0x1fb7('0x11'));var qs=require(_0x1fb7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb7('0x13'));var logger=require(_0x1fb7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1fb7('0x15'));var db=require(_0x1fb7('0x16'))['db'];function respondWithStatusCode(_0x31b73e,_0xe5b4f7){_0xe5b4f7=_0xe5b4f7||0xcc;return function(_0x227d95){if(_0x227d95){return _0x31b73e[_0x1fb7('0x17')](_0xe5b4f7);}return _0x31b73e[_0x1fb7('0x18')](_0xe5b4f7)[_0x1fb7('0x19')]();};}function respondWithResult(_0xaace39,_0xb0b0b3){_0xb0b0b3=_0xb0b0b3||0xc8;return function(_0x5da80f){if(_0x5da80f){return _0xaace39[_0x1fb7('0x18')](_0xb0b0b3)[_0x1fb7('0x1a')](_0x5da80f);}};}function respondWithFilteredResult(_0x221d24,_0x1de0a6){return function(_0x4cc9c2){if(_0x4cc9c2){var _0x30e2c2=_0x4cc9c2[_0x1fb7('0x1b')],_0x46ebf2=_0x1de0a6['offset'],_0x334e7d=_0x1de0a6[_0x1fb7('0x1c')]+_0x1de0a6[_0x1fb7('0x1d')],_0x4f4bc6;if(_0x334e7d>=_0x30e2c2){_0x334e7d=_0x30e2c2;_0x4f4bc6=0xc8;}else{_0x4f4bc6=0xce;}_0x221d24[_0x1fb7('0x18')](_0x4f4bc6);return _0x221d24[_0x1fb7('0x1e')]('Content-Range',_0x46ebf2+'-'+_0x334e7d+'/'+_0x30e2c2)[_0x1fb7('0x1a')](_0x4cc9c2);}return null;};}function patchUpdates(_0x541b6c){return function(_0x4cc946){try{jsonpatch[_0x1fb7('0x1f')](_0x4cc946,_0x541b6c,!![]);}catch(_0x58cb5a){return BPromise[_0x1fb7('0x20')](_0x58cb5a);}return _0x4cc946['save']();};}function saveUpdates(_0x9e1301,_0x2de84c){return function(_0x5db294){if(_0x5db294){return _0x5db294[_0x1fb7('0x21')](_0x9e1301)[_0x1fb7('0x22')](function(_0x4f1ff3){return _0x4f1ff3;});}return null;};}function removeEntity(_0x450206,_0x4a72e4){return function(_0x43be47){if(_0x43be47){return _0x43be47[_0x1fb7('0x23')]()['then'](function(){_0x450206[_0x1fb7('0x18')](0xcc)[_0x1fb7('0x19')]();});}};}function handleEntityNotFound(_0x2fcb67,_0x57de2d){return function(_0x35a3ca){if(!_0x35a3ca){_0x2fcb67[_0x1fb7('0x17')](0x194);}return _0x35a3ca;};}function handleError(_0x534df7,_0x1e0e26){_0x1e0e26=_0x1e0e26||0x1f4;return function(_0x14158){logger[_0x1fb7('0x24')](_0x14158[_0x1fb7('0x25')]);if(_0x14158[_0x1fb7('0x26')]){delete _0x14158[_0x1fb7('0x26')];}_0x534df7[_0x1fb7('0x18')](_0x1e0e26)['send'](_0x14158);};}exports[_0x1fb7('0x27')]=function(_0xd0d3d0,_0x19c01e){var _0x40e9bc={},_0x1244bd={},_0x5c47ee={'count':0x0,'rows':[]};var _0x28e5d7=_[_0x1fb7('0x28')](db[_0x1fb7('0x29')][_0x1fb7('0x2a')],function(_0x3631c7){return{'name':_0x3631c7[_0x1fb7('0x2b')],'type':_0x3631c7[_0x1fb7('0x2c')][_0x1fb7('0x2d')]};});_0x1244bd['model']=_[_0x1fb7('0x28')](_0x28e5d7,_0x1fb7('0x26'));_0x1244bd[_0x1fb7('0x2e')]=_['keys'](_0xd0d3d0[_0x1fb7('0x2e')]);_0x1244bd[_0x1fb7('0x2f')]=_['intersection'](_0x1244bd[_0x1fb7('0x30')],_0x1244bd[_0x1fb7('0x2e')]);_0x40e9bc[_0x1fb7('0x31')]=_[_0x1fb7('0x32')](_0x1244bd[_0x1fb7('0x30')],qs['fields'](_0xd0d3d0[_0x1fb7('0x2e')]['fields']));_0x40e9bc[_0x1fb7('0x31')]=_0x40e9bc[_0x1fb7('0x31')][_0x1fb7('0x33')]?_0x40e9bc[_0x1fb7('0x31')]:_0x1244bd[_0x1fb7('0x30')];if(!_0xd0d3d0['query'][_0x1fb7('0x34')](_0x1fb7('0x35'))){_0x40e9bc[_0x1fb7('0x1d')]=qs[_0x1fb7('0x1d')](_0xd0d3d0['query'][_0x1fb7('0x1d')]);_0x40e9bc['offset']=qs[_0x1fb7('0x1c')](_0xd0d3d0[_0x1fb7('0x2e')]['offset']);}_0x40e9bc[_0x1fb7('0x36')]=qs[_0x1fb7('0x37')](_0xd0d3d0[_0x1fb7('0x2e')][_0x1fb7('0x37')]);_0x40e9bc[_0x1fb7('0x38')]=qs[_0x1fb7('0x2f')](_[_0x1fb7('0x39')](_0xd0d3d0['query'],_0x1244bd['filters']),_0x28e5d7);if(_0xd0d3d0[_0x1fb7('0x2e')][_0x1fb7('0x3a')]){_0x40e9bc['where']=_['merge'](_0x40e9bc[_0x1fb7('0x38')],{'$or':_['map'](_0x28e5d7,function(_0x225d21){if(_0x225d21[_0x1fb7('0x2c')]!==_0x1fb7('0x3b')){var _0x202a20={};_0x202a20[_0x225d21[_0x1fb7('0x26')]]={'$like':'%'+_0xd0d3d0[_0x1fb7('0x2e')][_0x1fb7('0x3a')]+'%'};return _0x202a20;}})});}_0x40e9bc=_[_0x1fb7('0x3c')]({},_0x40e9bc,_0xd0d3d0[_0x1fb7('0x3d')]);var _0x3507d2={'where':_0x40e9bc[_0x1fb7('0x38')]};return db[_0x1fb7('0x29')][_0x1fb7('0x1b')](_0x3507d2)[_0x1fb7('0x22')](function(_0x22a343){_0x5c47ee[_0x1fb7('0x1b')]=_0x22a343;if(_0xd0d3d0[_0x1fb7('0x2e')][_0x1fb7('0x3e')]){_0x40e9bc[_0x1fb7('0x3f')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x1fb7('0x40')](_0x40e9bc);})['then'](function(_0x49159c){_0x5c47ee[_0x1fb7('0x41')]=_0x49159c;return _0x5c47ee;})[_0x1fb7('0x22')](respondWithFilteredResult(_0x19c01e,_0x40e9bc))[_0x1fb7('0x42')](handleError(_0x19c01e,null));};exports['show']=function(_0x13293d,_0x570ddb){var _0x5876e4={'raw':![],'where':{'id':_0x13293d[_0x1fb7('0x43')]['id']}},_0x2a1e52={};_0x2a1e52[_0x1fb7('0x30')]=_[_0x1fb7('0x44')](db[_0x1fb7('0x29')][_0x1fb7('0x2a')]);_0x2a1e52['query']=_['keys'](_0x13293d[_0x1fb7('0x2e')]);_0x2a1e52[_0x1fb7('0x2f')]=_[_0x1fb7('0x32')](_0x2a1e52[_0x1fb7('0x30')],_0x2a1e52[_0x1fb7('0x2e')]);_0x5876e4[_0x1fb7('0x31')]=_['intersection'](_0x2a1e52[_0x1fb7('0x30')],qs['fields'](_0x13293d[_0x1fb7('0x2e')]['fields']));_0x5876e4['attributes']=_0x5876e4[_0x1fb7('0x31')][_0x1fb7('0x33')]?_0x5876e4[_0x1fb7('0x31')]:_0x2a1e52[_0x1fb7('0x30')];if(_0x13293d[_0x1fb7('0x2e')][_0x1fb7('0x3e')]){_0x5876e4['include']=[{'all':!![]}];}_0x5876e4=_[_0x1fb7('0x3c')]({},_0x5876e4,_0x13293d[_0x1fb7('0x3d')]);return db[_0x1fb7('0x29')][_0x1fb7('0x45')](_0x5876e4)[_0x1fb7('0x22')](handleEntityNotFound(_0x570ddb,null))['then'](respondWithResult(_0x570ddb,null))[_0x1fb7('0x42')](handleError(_0x570ddb,null));};exports['create']=function(_0x5d33ad,_0x557ec7){return db[_0x1fb7('0x29')][_0x1fb7('0x46')](_0x5d33ad[_0x1fb7('0x47')],{})[_0x1fb7('0x22')](respondWithResult(_0x557ec7,0xc9))[_0x1fb7('0x42')](handleError(_0x557ec7,null));};exports[_0x1fb7('0x21')]=function(_0x98844e,_0x1d7c44){if(_0x98844e[_0x1fb7('0x47')]['id']){delete _0x98844e['body']['id'];}return db[_0x1fb7('0x29')][_0x1fb7('0x45')]({'where':{'id':_0x98844e[_0x1fb7('0x43')]['id']}})[_0x1fb7('0x22')](handleEntityNotFound(_0x1d7c44,null))['then'](saveUpdates(_0x98844e[_0x1fb7('0x47')],null))[_0x1fb7('0x22')](respondWithResult(_0x1d7c44,null))[_0x1fb7('0x42')](handleError(_0x1d7c44,null));};exports[_0x1fb7('0x23')]=function(_0x50b470,_0x53b82a){return db[_0x1fb7('0x29')][_0x1fb7('0x45')]({'where':{'id':_0x50b470[_0x1fb7('0x43')]['id']}})[_0x1fb7('0x22')](handleEntityNotFound(_0x53b82a,null))[_0x1fb7('0x22')](removeEntity(_0x53b82a,null))['catch'](handleError(_0x53b82a,null));};exports['describe']=function(_0x20ff87,_0x1962f7){return db['VoiceAgentReport'][_0x1fb7('0x48')]()[_0x1fb7('0x22')](respondWithResult(_0x1962f7,null))[_0x1fb7('0x42')](handleError(_0x1962f7,null));}; \ No newline at end of file +var _0xdc9d=['intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x2d7c31,_0x4e567f){var _0x558ffc=function(_0x50348c){while(--_0x50348c){_0x2d7c31['push'](_0x2d7c31['shift']());}};_0x558ffc(++_0x4e567f);}(_0xdc9d,0x144));var _0xddc9=function(_0x3c2f8a,_0x1c22a8){_0x3c2f8a=_0x3c2f8a-0x0;var _0x21fdc5=_0xdc9d[_0x3c2f8a];return _0x21fdc5;};'use strict';var pdf=require(_0xddc9('0x0'));var emlformat=require(_0xddc9('0x1'));var rimraf=require(_0xddc9('0x2'));var zipdir=require(_0xddc9('0x3'));var jsonpatch=require(_0xddc9('0x4'));var rp=require(_0xddc9('0x5'));var moment=require('moment');var BPromise=require(_0xddc9('0x6'));var Mustache=require(_0xddc9('0x7'));var util=require('util');var path=require(_0xddc9('0x8'));var sox=require(_0xddc9('0x9'));var csv=require('to-csv');var ejs=require(_0xddc9('0xa'));var fs=require('fs');var _=require(_0xddc9('0xb'));var squel=require('squel');var crypto=require(_0xddc9('0xc'));var jsforce=require(_0xddc9('0xd'));var deskjs=require(_0xddc9('0xe'));var toCsv=require(_0xddc9('0xf'));var querystring=require('querystring');var Papa=require(_0xddc9('0x10'));var Redis=require(_0xddc9('0x11'));var authService=require(_0xddc9('0x12'));var qs=require(_0xddc9('0x13'));var as=require(_0xddc9('0x14'));var hardwareService=require(_0xddc9('0x15'));var logger=require(_0xddc9('0x16'))('api');var utils=require(_0xddc9('0x17'));var config=require(_0xddc9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x553c1a,_0x27ea18){_0x27ea18=_0x27ea18||0xcc;return function(_0x3fc168){if(_0x3fc168){return _0x553c1a['sendStatus'](_0x27ea18);}return _0x553c1a[_0xddc9('0x19')](_0x27ea18)[_0xddc9('0x1a')]();};}function respondWithResult(_0x477877,_0x5da090){_0x5da090=_0x5da090||0xc8;return function(_0x3a6be3){if(_0x3a6be3){return _0x477877[_0xddc9('0x19')](_0x5da090)[_0xddc9('0x1b')](_0x3a6be3);}};}function respondWithFilteredResult(_0x31c405,_0xe7fc90){return function(_0x10c7ad){if(_0x10c7ad){var _0x52314a=_0x10c7ad['count'],_0x19c137=_0xe7fc90[_0xddc9('0x1c')],_0x53686f=_0xe7fc90[_0xddc9('0x1c')]+_0xe7fc90['limit'],_0x23cb5a;if(_0x53686f>=_0x52314a){_0x53686f=_0x52314a;_0x23cb5a=0xc8;}else{_0x23cb5a=0xce;}_0x31c405[_0xddc9('0x19')](_0x23cb5a);return _0x31c405[_0xddc9('0x1d')](_0xddc9('0x1e'),_0x19c137+'-'+_0x53686f+'/'+_0x52314a)[_0xddc9('0x1b')](_0x10c7ad);}return null;};}function patchUpdates(_0x57dd97){return function(_0x310e7b){try{jsonpatch[_0xddc9('0x1f')](_0x310e7b,_0x57dd97,!![]);}catch(_0x1a7d62){return BPromise[_0xddc9('0x20')](_0x1a7d62);}return _0x310e7b['save']();};}function saveUpdates(_0x78f401,_0x4fd04c){return function(_0x2707e6){if(_0x2707e6){return _0x2707e6[_0xddc9('0x21')](_0x78f401)[_0xddc9('0x22')](function(_0x4f6bf4){return _0x4f6bf4;});}return null;};}function removeEntity(_0x3381e6,_0x57561a){return function(_0x1fbebe){if(_0x1fbebe){return _0x1fbebe[_0xddc9('0x23')]()['then'](function(){_0x3381e6[_0xddc9('0x19')](0xcc)[_0xddc9('0x1a')]();});}};}function handleEntityNotFound(_0x3eaef1,_0x55751f){return function(_0x5e1c25){if(!_0x5e1c25){_0x3eaef1['sendStatus'](0x194);}return _0x5e1c25;};}function handleError(_0x1e818c,_0x1e1bb6){_0x1e1bb6=_0x1e1bb6||0x1f4;return function(_0x6e55f6){logger[_0xddc9('0x24')](_0x6e55f6[_0xddc9('0x25')]);if(_0x6e55f6[_0xddc9('0x26')]){delete _0x6e55f6['name'];}_0x1e818c[_0xddc9('0x19')](_0x1e1bb6)[_0xddc9('0x27')](_0x6e55f6);};}exports[_0xddc9('0x28')]=function(_0x41e884,_0x24eb47){var _0x130af5={},_0x194f43={},_0x4dcf4a={'count':0x0,'rows':[]};var _0x254605=_[_0xddc9('0x29')](db[_0xddc9('0x2a')][_0xddc9('0x2b')],function(_0x29467e){return{'name':_0x29467e[_0xddc9('0x2c')],'type':_0x29467e[_0xddc9('0x2d')][_0xddc9('0x2e')]};});_0x194f43[_0xddc9('0x2f')]=_[_0xddc9('0x29')](_0x254605,_0xddc9('0x26'));_0x194f43[_0xddc9('0x30')]=_[_0xddc9('0x31')](_0x41e884[_0xddc9('0x30')]);_0x194f43[_0xddc9('0x32')]=_[_0xddc9('0x33')](_0x194f43['model'],_0x194f43[_0xddc9('0x30')]);_0x130af5[_0xddc9('0x34')]=_[_0xddc9('0x33')](_0x194f43['model'],qs[_0xddc9('0x35')](_0x41e884[_0xddc9('0x30')][_0xddc9('0x35')]));_0x130af5[_0xddc9('0x34')]=_0x130af5['attributes']['length']?_0x130af5[_0xddc9('0x34')]:_0x194f43[_0xddc9('0x2f')];if(!_0x41e884[_0xddc9('0x30')][_0xddc9('0x36')]('nolimit')){_0x130af5[_0xddc9('0x37')]=qs[_0xddc9('0x37')](_0x41e884[_0xddc9('0x30')][_0xddc9('0x37')]);_0x130af5[_0xddc9('0x1c')]=qs['offset'](_0x41e884[_0xddc9('0x30')][_0xddc9('0x1c')]);}_0x130af5[_0xddc9('0x38')]=qs[_0xddc9('0x39')](_0x41e884[_0xddc9('0x30')][_0xddc9('0x39')]);_0x130af5[_0xddc9('0x3a')]=qs[_0xddc9('0x32')](_['pick'](_0x41e884[_0xddc9('0x30')],_0x194f43[_0xddc9('0x32')]),_0x254605);if(_0x41e884['query'][_0xddc9('0x3b')]){_0x130af5[_0xddc9('0x3a')]=_[_0xddc9('0x3c')](_0x130af5[_0xddc9('0x3a')],{'$or':_[_0xddc9('0x29')](_0x254605,function(_0x517867){if(_0x517867[_0xddc9('0x2d')]!==_0xddc9('0x3d')){var _0x4989ad={};_0x4989ad[_0x517867[_0xddc9('0x26')]]={'$like':'%'+_0x41e884[_0xddc9('0x30')][_0xddc9('0x3b')]+'%'};return _0x4989ad;}})});}_0x130af5=_[_0xddc9('0x3c')]({},_0x130af5,_0x41e884[_0xddc9('0x3e')]);var _0x46ea39={'where':_0x130af5[_0xddc9('0x3a')]};return db[_0xddc9('0x2a')]['count'](_0x46ea39)[_0xddc9('0x22')](function(_0xee69f7){_0x4dcf4a[_0xddc9('0x3f')]=_0xee69f7;if(_0x41e884['query'][_0xddc9('0x40')]){_0x130af5[_0xddc9('0x41')]=[{'all':!![]}];}return db[_0xddc9('0x2a')][_0xddc9('0x42')](_0x130af5);})[_0xddc9('0x22')](function(_0x43e154){_0x4dcf4a[_0xddc9('0x43')]=_0x43e154;return _0x4dcf4a;})[_0xddc9('0x22')](respondWithFilteredResult(_0x24eb47,_0x130af5))[_0xddc9('0x44')](handleError(_0x24eb47,null));};exports['show']=function(_0x49d90e,_0x2d150a){var _0x361172={'raw':![],'where':{'id':_0x49d90e[_0xddc9('0x45')]['id']}},_0x4b3486={};_0x4b3486[_0xddc9('0x2f')]=_['keys'](db['VoiceAgentReport']['rawAttributes']);_0x4b3486[_0xddc9('0x30')]=_['keys'](_0x49d90e[_0xddc9('0x30')]);_0x4b3486['filters']=_[_0xddc9('0x33')](_0x4b3486[_0xddc9('0x2f')],_0x4b3486['query']);_0x361172[_0xddc9('0x34')]=_[_0xddc9('0x33')](_0x4b3486['model'],qs[_0xddc9('0x35')](_0x49d90e[_0xddc9('0x30')][_0xddc9('0x35')]));_0x361172[_0xddc9('0x34')]=_0x361172[_0xddc9('0x34')][_0xddc9('0x46')]?_0x361172[_0xddc9('0x34')]:_0x4b3486[_0xddc9('0x2f')];if(_0x49d90e[_0xddc9('0x30')][_0xddc9('0x40')]){_0x361172[_0xddc9('0x41')]=[{'all':!![]}];}_0x361172=_['merge']({},_0x361172,_0x49d90e[_0xddc9('0x3e')]);return db['VoiceAgentReport'][_0xddc9('0x47')](_0x361172)[_0xddc9('0x22')](handleEntityNotFound(_0x2d150a,null))['then'](respondWithResult(_0x2d150a,null))[_0xddc9('0x44')](handleError(_0x2d150a,null));};exports[_0xddc9('0x48')]=function(_0x44b061,_0x14e4c4){return db['VoiceAgentReport'][_0xddc9('0x48')](_0x44b061[_0xddc9('0x49')],{})[_0xddc9('0x22')](respondWithResult(_0x14e4c4,0xc9))[_0xddc9('0x44')](handleError(_0x14e4c4,null));};exports[_0xddc9('0x21')]=function(_0x359370,_0x506346){if(_0x359370[_0xddc9('0x49')]['id']){delete _0x359370[_0xddc9('0x49')]['id'];}return db[_0xddc9('0x2a')]['find']({'where':{'id':_0x359370[_0xddc9('0x45')]['id']}})[_0xddc9('0x22')](handleEntityNotFound(_0x506346,null))[_0xddc9('0x22')](saveUpdates(_0x359370[_0xddc9('0x49')],null))[_0xddc9('0x22')](respondWithResult(_0x506346,null))['catch'](handleError(_0x506346,null));};exports[_0xddc9('0x23')]=function(_0x210908,_0x4a09c1){return db['VoiceAgentReport']['find']({'where':{'id':_0x210908[_0xddc9('0x45')]['id']}})[_0xddc9('0x22')](handleEntityNotFound(_0x4a09c1,null))[_0xddc9('0x22')](removeEntity(_0x4a09c1,null))[_0xddc9('0x44')](handleError(_0x4a09c1,null));};exports[_0xddc9('0x4a')]=function(_0x21747e,_0x4f919c){return db['VoiceAgentReport'][_0xddc9('0x4a')]()[_0xddc9('0x22')](respondWithResult(_0x4f919c,null))['catch'](handleError(_0x4f919c,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index c8a23f1..be4ed58 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 _0xa9e0=['define','VoiceAgentReport','destuniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 +var _0x70e0=['rimraf','./voiceAgentReport.attributes','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x2dcb75,_0x233a51){var _0x3abd00=function(_0x3e13e0){while(--_0x3e13e0){_0x2dcb75['push'](_0x2dcb75['shift']());}};_0x3abd00(++_0x233a51);}(_0x70e0,0x17b));var _0x070e=function(_0x5350db,_0x4443b2){_0x5350db=_0x5350db-0x0;var _0x5a7721=_0x70e0[_0x5350db];return _0x5a7721;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceAgentReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'fields':[_0x070e('0x9'),_0x070e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 76df7f8..6a4ba3e 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 _0xf929=['stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','catch','VoiceAgentReport','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf929,0x164));var _0x9f92=function(_0x23aa7f,_0x1fd440){_0x23aa7f=_0x23aa7f-0x0;var _0x1441fd=_0xf929[_0x23aa7f];return _0x1441fd;};'use strict';var _=require(_0x9f92('0x0'));var util=require('util');var moment=require(_0x9f92('0x1'));var BPromise=require(_0x9f92('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f92('0x3'));var db=require(_0x9f92('0x4'))['db'];var utils=require(_0x9f92('0x5'));var logger=require(_0x9f92('0x6'))(_0x9f92('0x7'));var config=require(_0x9f92('0x8'));var jayson=require(_0x9f92('0x9'));var client=jayson[_0x9f92('0xa')][_0x9f92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29a770,_0x77aa18,_0x5f343f){return new BPromise(function(_0x98a2f5,_0x2d4115){return client[_0x9f92('0xc')](_0x29a770,_0x5f343f)[_0x9f92('0xd')](function(_0x35adc2){logger[_0x9f92('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x77aa18,_0x9f92('0xf'));logger[_0x9f92('0x10')](_0x9f92('0x11'),_0x77aa18,_0x9f92('0xf'),JSON[_0x9f92('0x12')](_0x35adc2));if(_0x35adc2[_0x9f92('0x13')]){if(_0x35adc2[_0x9f92('0x13')][_0x9f92('0x14')]===0x1f4){logger[_0x9f92('0x13')](_0x9f92('0x15'),_0x77aa18,_0x35adc2[_0x9f92('0x13')]['message']);return _0x2d4115(_0x35adc2[_0x9f92('0x13')][_0x9f92('0x16')]);}logger[_0x9f92('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x77aa18,_0x35adc2[_0x9f92('0x13')]['message']);return _0x98a2f5(_0x35adc2[_0x9f92('0x13')][_0x9f92('0x16')]);}else{logger[_0x9f92('0xe')](_0x9f92('0x15'),_0x77aa18,_0x9f92('0xf'));_0x98a2f5(_0x35adc2['result']['message']);}})[_0x9f92('0x17')](function(_0x27dcf4){logger[_0x9f92('0x13')](_0x9f92('0x15'),_0x77aa18,_0x27dcf4);_0x2d4115(_0x27dcf4);});});}exports['CreateVoiceAgentReport']=function(_0x1045c1){var _0x1ead43=this;return new Promise(function(_0x31acf3,_0x1d058a){return db[_0x9f92('0x18')][_0x9f92('0x19')](_0x1045c1[_0x9f92('0x1a')],{'raw':_0x1045c1[_0x9f92('0x1b')]?_0x1045c1[_0x9f92('0x1b')][_0x9f92('0x1c')]===undefined?!![]:![]:!![]})[_0x9f92('0xd')](function(_0x340e0a){logger[_0x9f92('0xe')](_0x9f92('0x1d'),_0x1045c1);logger['debug'](_0x9f92('0x1d'),_0x1045c1,JSON[_0x9f92('0x12')](_0x340e0a));_0x31acf3(_0x340e0a);})[_0x9f92('0x17')](function(_0x5b6f2f){logger[_0x9f92('0x13')](_0x9f92('0x1d'),_0x5b6f2f[_0x9f92('0x16')],_0x1045c1);_0x1d058a(_0x1ead43[_0x9f92('0x13')](0x1f4,_0x5b6f2f[_0x9f92('0x16')]));});});};exports[_0x9f92('0x1e')]=function(_0xf2b1db){var _0x2c2812=this;return new Promise(function(_0x5ca0f2,_0x214dfd){return db['VoiceAgentReport']['update'](_0xf2b1db[_0x9f92('0x1a')],{'raw':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x1f')]||null:null,'attributes':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x20')]||null:null,'limit':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x21')]||null:null})['then'](function(_0x2dc012){logger['info'](_0x9f92('0x1e'),_0xf2b1db);logger[_0x9f92('0x10')]('UpdateVoiceAgentReport',_0xf2b1db,JSON[_0x9f92('0x12')](_0x2dc012));_0x5ca0f2(_0x2dc012);})[_0x9f92('0x17')](function(_0x56b814){logger[_0x9f92('0x13')](_0x9f92('0x1e'),_0x56b814['message'],_0xf2b1db);_0x214dfd(_0x2c2812['error'](0x1f4,_0x56b814['message']));});});}; \ No newline at end of file +var _0x2579=['result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','catch','update','where','limit','UpdateVoiceAgentReport','lodash','util','bluebird','../../mysqldb','rpc','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x2579,0xeb));var _0x9257=function(_0x29d24d,_0x5c08dd){_0x29d24d=_0x29d24d-0x0;var _0x28bbee=_0x2579[_0x29d24d];return _0x28bbee;};'use strict';var _=require(_0x9257('0x0'));var util=require(_0x9257('0x1'));var moment=require('moment');var BPromise=require(_0x9257('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9257('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9257('0x4'));var config=require('../../config/environment');var jayson=require(_0x9257('0x5'));var client=jayson[_0x9257('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x325ff2,_0x26dfa9,_0xc46e11){return new BPromise(function(_0x21d490,_0xdea570){return client[_0x9257('0x7')](_0x325ff2,_0xc46e11)[_0x9257('0x8')](function(_0x211b08){logger[_0x9257('0x9')](_0x9257('0xa'),_0x26dfa9,'request\x20sent');logger['debug'](_0x9257('0xb'),_0x26dfa9,_0x9257('0xc'),JSON[_0x9257('0xd')](_0x211b08));if(_0x211b08[_0x9257('0xe')]){if(_0x211b08[_0x9257('0xe')][_0x9257('0xf')]===0x1f4){logger[_0x9257('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x26dfa9,_0x211b08[_0x9257('0xe')][_0x9257('0x10')]);return _0xdea570(_0x211b08[_0x9257('0xe')][_0x9257('0x10')]);}logger['error'](_0x9257('0xa'),_0x26dfa9,_0x211b08[_0x9257('0xe')][_0x9257('0x10')]);return _0x21d490(_0x211b08['error']['message']);}else{logger[_0x9257('0x9')]('VoiceAgentReport,\x20%s,\x20%s',_0x26dfa9,_0x9257('0xc'));_0x21d490(_0x211b08[_0x9257('0x11')][_0x9257('0x10')]);}})['catch'](function(_0x57d8bb){logger[_0x9257('0xe')](_0x9257('0xa'),_0x26dfa9,_0x57d8bb);_0xdea570(_0x57d8bb);});});}exports[_0x9257('0x12')]=function(_0x23d019){var _0x2ef41a=this;return new Promise(function(_0x12e544,_0x1e5c01){return db[_0x9257('0x13')][_0x9257('0x14')](_0x23d019['body'],{'raw':_0x23d019['options']?_0x23d019[_0x9257('0x15')][_0x9257('0x16')]===undefined?!![]:![]:!![]})[_0x9257('0x8')](function(_0x30cc7f){logger[_0x9257('0x9')](_0x9257('0x12'),_0x23d019);logger['debug'](_0x9257('0x12'),_0x23d019,JSON[_0x9257('0xd')](_0x30cc7f));_0x12e544(_0x30cc7f);})[_0x9257('0x17')](function(_0x2073c8){logger['error']('CreateVoiceAgentReport',_0x2073c8[_0x9257('0x10')],_0x23d019);_0x1e5c01(_0x2ef41a[_0x9257('0xe')](0x1f4,_0x2073c8[_0x9257('0x10')]));});});};exports['UpdateVoiceAgentReport']=function(_0x45be94){var _0x40c7db=this;return new Promise(function(_0x5c5253,_0x532925){return db[_0x9257('0x13')][_0x9257('0x18')](_0x45be94['body'],{'raw':_0x45be94[_0x9257('0x15')]?_0x45be94[_0x9257('0x15')][_0x9257('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45be94[_0x9257('0x15')]?_0x45be94['options'][_0x9257('0x19')]||null:null,'attributes':_0x45be94['options']?_0x45be94[_0x9257('0x15')]['attributes']||null:null,'limit':_0x45be94['options']?_0x45be94[_0x9257('0x15')][_0x9257('0x1a')]||null:null})['then'](function(_0x4b3567){logger['info'](_0x9257('0x1b'),_0x45be94);logger['debug']('UpdateVoiceAgentReport',_0x45be94,JSON[_0x9257('0xd')](_0x4b3567));_0x5c5253(_0x4b3567);})[_0x9257('0x17')](function(_0x14b9e3){logger[_0x9257('0xe')](_0x9257('0x1b'),_0x14b9e3[_0x9257('0x10')],_0x45be94);_0x532925(_0x40c7db['error'](0x1f4,_0x14b9e3[_0x9257('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index b3371f3..0c68870 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 _0xba02=['destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','/:id'];(function(_0x29f0d1,_0x329499){var _0x4560d3=function(_0x19fb1f){while(--_0x19fb1f){_0x29f0d1['push'](_0x29f0d1['shift']());}};_0x4560d3(++_0x329499);}(_0xba02,0x65));var _0x2ba0=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xba02[_0x1203f];return _0x365f0a;};'use strict';var multer=require('multer');var util=require(_0x2ba0('0x0'));var path=require(_0x2ba0('0x1'));var timeout=require('connect-timeout');var express=require(_0x2ba0('0x2'));var router=express[_0x2ba0('0x3')]();var auth=require(_0x2ba0('0x4'));var interaction=require(_0x2ba0('0x5'));var config=require(_0x2ba0('0x6'));var controller=require(_0x2ba0('0x7'));router[_0x2ba0('0x8')]('/',auth[_0x2ba0('0x9')](),controller[_0x2ba0('0xa')]);router[_0x2ba0('0x8')](_0x2ba0('0xb'),auth['isAuthenticated'](),controller[_0x2ba0('0xc')]);router[_0x2ba0('0x8')]('/:id',auth[_0x2ba0('0x9')](),controller[_0x2ba0('0xd')]);router[_0x2ba0('0xe')]('/',auth[_0x2ba0('0x9')](),controller[_0x2ba0('0xf')]);router[_0x2ba0('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2ba0('0x11')]);router['delete'](_0x2ba0('0x12'),auth[_0x2ba0('0x9')](),controller[_0x2ba0('0x13')]);module['exports']=router; \ No newline at end of file +var _0x791e=['connect-timeout','express','../../components/auth/service','isAuthenticated','index','get','describe','show','post','/:id','update','destroy','exports','multer','util','path'];(function(_0x190ccf,_0x3b3d84){var _0x2fc6a5=function(_0x4a9acf){while(--_0x4a9acf){_0x190ccf['push'](_0x190ccf['shift']());}};_0x2fc6a5(++_0x3b3d84);}(_0x791e,0x18d));var _0xe791=function(_0x3aa43e,_0x33059b){_0x3aa43e=_0x3aa43e-0x0;var _0x2dfb98=_0x791e[_0x3aa43e];return _0x2dfb98;};'use strict';var multer=require(_0xe791('0x0'));var util=require(_0xe791('0x1'));var path=require(_0xe791('0x2'));var timeout=require(_0xe791('0x3'));var express=require(_0xe791('0x4'));var router=express['Router']();var auth=require(_0xe791('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0xe791('0x6')](),controller[_0xe791('0x7')]);router[_0xe791('0x8')]('/describe',auth[_0xe791('0x6')](),controller[_0xe791('0x9')]);router['get']('/:id',auth[_0xe791('0x6')](),controller[_0xe791('0xa')]);router[_0xe791('0xb')]('/',auth[_0xe791('0x6')](),controller['create']);router['put'](_0xe791('0xc'),auth[_0xe791('0x6')](),controller[_0xe791('0xd')]);router['delete'](_0xe791('0xc'),auth[_0xe791('0x6')](),controller[_0xe791('0xe')]);module[_0xe791('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0d85c29..86db313 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(_0x567f86,_0x5d2e15){var _0x35eae4=function(_0x4c4d16){while(--_0x4c4d16){_0x567f86['push'](_0x567f86['shift']());}};_0x35eae4(++_0x5d2e15);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0xa9e0=['dialer','DATE','INTEGER','sequelize','exports','STRING','internal','inbound-fax','outbound-fax'];(function(_0x359dcf,_0x5786cf){var _0x25a5c5=function(_0x2351a7){while(--_0x2351a7){_0x359dcf['push'](_0x359dcf['shift']());}};_0x25a5c5(++_0x5786cf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 1f6f6b4..87976e1 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 _0x63a8=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','update','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','include','fullname','User','findAll','catch','params','includeAll','find','create','body','describe','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x15d9d6,_0x793d4f){var _0x1e2dc0=function(_0x184d6b){while(--_0x184d6b){_0x15d9d6['push'](_0x15d9d6['shift']());}};_0x1e2dc0(++_0x793d4f);}(_0x63a8,0x1ab));var _0x863a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x63a8[_0xfae23b];return _0x200640;};'use strict';var pdf=require(_0x863a('0x0'));var emlformat=require(_0x863a('0x1'));var rimraf=require(_0x863a('0x2'));var zipdir=require(_0x863a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x863a('0x4'));var moment=require(_0x863a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x863a('0x6'));var util=require(_0x863a('0x7'));var path=require(_0x863a('0x8'));var sox=require(_0x863a('0x9'));var csv=require(_0x863a('0xa'));var ejs=require(_0x863a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x863a('0xc'));var crypto=require(_0x863a('0xd'));var jsforce=require(_0x863a('0xe'));var deskjs=require(_0x863a('0xf'));var toCsv=require(_0x863a('0xa'));var querystring=require(_0x863a('0x10'));var Papa=require(_0x863a('0x11'));var Redis=require(_0x863a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x863a('0x13'));var as=require(_0x863a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x863a('0x15'))(_0x863a('0x16'));var utils=require(_0x863a('0x17'));var config=require(_0x863a('0x18'));var db=require(_0x863a('0x19'))['db'];function respondWithStatusCode(_0x2f1d82,_0x1bdebb){_0x1bdebb=_0x1bdebb||0xcc;return function(_0x19519b){if(_0x19519b){return _0x2f1d82[_0x863a('0x1a')](_0x1bdebb);}return _0x2f1d82[_0x863a('0x1b')](_0x1bdebb)[_0x863a('0x1c')]();};}function respondWithResult(_0x343a89,_0x176b5b){_0x176b5b=_0x176b5b||0xc8;return function(_0x4eadc6){if(_0x4eadc6){return _0x343a89[_0x863a('0x1b')](_0x176b5b)[_0x863a('0x1d')](_0x4eadc6);}};}function respondWithFilteredResult(_0x1be3cc,_0x4ddb3a){return function(_0x35054a){if(_0x35054a){var _0x2165f5=_0x35054a[_0x863a('0x1e')],_0x8e338a=_0x4ddb3a[_0x863a('0x1f')],_0x14e931=_0x4ddb3a[_0x863a('0x1f')]+_0x4ddb3a[_0x863a('0x20')],_0x181d22;if(_0x14e931>=_0x2165f5){_0x14e931=_0x2165f5;_0x181d22=0xc8;}else{_0x181d22=0xce;}_0x1be3cc[_0x863a('0x1b')](_0x181d22);return _0x1be3cc['set']('Content-Range',_0x8e338a+'-'+_0x14e931+'/'+_0x2165f5)['json'](_0x35054a);}return null;};}function patchUpdates(_0x5f0a55){return function(_0x28e537){try{jsonpatch[_0x863a('0x21')](_0x28e537,_0x5f0a55,!![]);}catch(_0x36cf28){return BPromise['reject'](_0x36cf28);}return _0x28e537['save']();};}function saveUpdates(_0x27b32f,_0x1fbad4){return function(_0x26e9fa){if(_0x26e9fa){return _0x26e9fa[_0x863a('0x22')](_0x27b32f)[_0x863a('0x23')](function(_0xe8dba2){return _0xe8dba2;});}return null;};}function removeEntity(_0x4ce600,_0x3f51f7){return function(_0x11e230){if(_0x11e230){return _0x11e230[_0x863a('0x24')]()[_0x863a('0x23')](function(){_0x4ce600[_0x863a('0x1b')](0xcc)[_0x863a('0x1c')]();});}};}function handleEntityNotFound(_0x338e64,_0x807736){return function(_0x4db6ff){if(!_0x4db6ff){_0x338e64['sendStatus'](0x194);}return _0x4db6ff;};}function handleError(_0x579484,_0x2fe47c){_0x2fe47c=_0x2fe47c||0x1f4;return function(_0x1cec49){logger[_0x863a('0x25')](_0x1cec49[_0x863a('0x26')]);if(_0x1cec49[_0x863a('0x27')]){delete _0x1cec49['name'];}_0x579484['status'](_0x2fe47c)['send'](_0x1cec49);};}exports[_0x863a('0x28')]=function(_0x150b0e,_0x5bf718){var _0x52ebb7={},_0x4f9077={},_0x5be215={'count':0x0,'rows':[]};var _0x3d1713=_[_0x863a('0x29')](db[_0x863a('0x2a')][_0x863a('0x2b')],function(_0x1f234f){return{'name':_0x1f234f[_0x863a('0x2c')],'type':_0x1f234f[_0x863a('0x2d')]['key']};});_0x4f9077[_0x863a('0x2e')]=_[_0x863a('0x29')](_0x3d1713,_0x863a('0x27'));_0x4f9077['query']=_[_0x863a('0x2f')](_0x150b0e[_0x863a('0x30')]);_0x4f9077[_0x863a('0x31')]=_[_0x863a('0x32')](_0x4f9077['model'],_0x4f9077[_0x863a('0x30')]);_0x52ebb7['attributes']=_[_0x863a('0x32')](_0x4f9077[_0x863a('0x2e')],qs[_0x863a('0x33')](_0x150b0e[_0x863a('0x30')][_0x863a('0x33')]));_0x52ebb7[_0x863a('0x34')]=_0x52ebb7[_0x863a('0x34')][_0x863a('0x35')]?_0x52ebb7['attributes']:_0x4f9077[_0x863a('0x2e')];if(!_0x150b0e[_0x863a('0x30')]['hasOwnProperty'](_0x863a('0x36'))){_0x52ebb7[_0x863a('0x20')]=qs[_0x863a('0x20')](_0x150b0e[_0x863a('0x30')][_0x863a('0x20')]);_0x52ebb7[_0x863a('0x1f')]=qs['offset'](_0x150b0e[_0x863a('0x30')][_0x863a('0x1f')]);}_0x52ebb7[_0x863a('0x37')]=qs[_0x863a('0x38')](_0x150b0e[_0x863a('0x30')]['sort']);_0x52ebb7['where']=qs['filters'](_[_0x863a('0x39')](_0x150b0e[_0x863a('0x30')],_0x4f9077[_0x863a('0x31')]),_0x3d1713);if(_0x150b0e[_0x863a('0x30')][_0x863a('0x3a')]){_0x52ebb7['where']=_[_0x863a('0x3b')](_0x52ebb7[_0x863a('0x3c')],{'$or':_['map'](_0x3d1713,function(_0x5e5b37){if(_0x5e5b37['type']!==_0x863a('0x3d')){var _0x48ca5c={};_0x48ca5c[_0x5e5b37[_0x863a('0x27')]]={'$like':'%'+_0x150b0e[_0x863a('0x30')][_0x863a('0x3a')]+'%'};return _0x48ca5c;}})});}_0x52ebb7=_[_0x863a('0x3b')]({},_0x52ebb7,_0x150b0e['options']);var _0x17b8f6={'where':_0x52ebb7['where']};return db[_0x863a('0x2a')][_0x863a('0x1e')](_0x17b8f6)[_0x863a('0x23')](function(_0x4566b1){_0x5be215['count']=_0x4566b1;if(_0x150b0e['query']['includeAll']){_0x52ebb7[_0x863a('0x3e')]=[{'attributes':['id','name',_0x863a('0x3f'),'alias'],'model':db[_0x863a('0x40')],'as':'User'}];}return db[_0x863a('0x2a')][_0x863a('0x41')](_0x52ebb7);})['then'](function(_0x44f0c8){_0x5be215['rows']=_0x44f0c8;return _0x5be215;})[_0x863a('0x23')](respondWithFilteredResult(_0x5bf718,_0x52ebb7))[_0x863a('0x42')](handleError(_0x5bf718,null));};exports['show']=function(_0x495676,_0x2ec43f){var _0x497245={'raw':!![],'where':{'id':_0x495676[_0x863a('0x43')]['id']}},_0x269b39={};_0x269b39['model']=_[_0x863a('0x2f')](db['VoiceCallReport'][_0x863a('0x2b')]);_0x269b39[_0x863a('0x30')]=_[_0x863a('0x2f')](_0x495676[_0x863a('0x30')]);_0x269b39[_0x863a('0x31')]=_[_0x863a('0x32')](_0x269b39[_0x863a('0x2e')],_0x269b39['query']);_0x497245['attributes']=_[_0x863a('0x32')](_0x269b39[_0x863a('0x2e')],qs['fields'](_0x495676[_0x863a('0x30')][_0x863a('0x33')]));_0x497245[_0x863a('0x34')]=_0x497245[_0x863a('0x34')][_0x863a('0x35')]?_0x497245[_0x863a('0x34')]:_0x269b39['model'];if(_0x495676[_0x863a('0x30')][_0x863a('0x44')]){_0x497245['include']=[{'all':!![]}];}_0x497245=_['merge']({},_0x497245,_0x495676['options']);return db[_0x863a('0x2a')][_0x863a('0x45')](_0x497245)[_0x863a('0x23')](handleEntityNotFound(_0x2ec43f,null))['then'](respondWithResult(_0x2ec43f,null))[_0x863a('0x42')](handleError(_0x2ec43f,null));};exports['create']=function(_0x106d27,_0x5ce6c6){return db['VoiceCallReport'][_0x863a('0x46')](_0x106d27[_0x863a('0x47')],{})[_0x863a('0x23')](respondWithResult(_0x5ce6c6,0xc9))[_0x863a('0x42')](handleError(_0x5ce6c6,null));};exports['destroy']=function(_0x4d9616,_0x114c68){return db[_0x863a('0x2a')][_0x863a('0x45')]({'where':{'id':_0x4d9616[_0x863a('0x43')]['id']}})['then'](handleEntityNotFound(_0x114c68,null))[_0x863a('0x23')](removeEntity(_0x114c68,null))['catch'](handleError(_0x114c68,null));};exports[_0x863a('0x48')]=function(_0x1ad86b,_0x3a13b0){return db[_0x863a('0x2a')][_0x863a('0x48')]()[_0x863a('0x23')](respondWithResult(_0x3a13b0,null))['catch'](handleError(_0x3a13b0,null));};exports[_0x863a('0x22')]=function(_0x3cf5f2,_0x279fdc){if(_0x3cf5f2[_0x863a('0x47')][_0x863a('0x49')]){delete _0x3cf5f2[_0x863a('0x47')][_0x863a('0x49')];}return db['VoiceCallReport'][_0x863a('0x45')]({'where':{'uniqueid':_0x3cf5f2[_0x863a('0x43')]['id'],'UserId':{'$or':[null,_0x3cf5f2[_0x863a('0x4a')]['id']]}}})[_0x863a('0x23')](handleEntityNotFound(_0x279fdc,null))[_0x863a('0x23')](saveUpdates(_0x3cf5f2[_0x863a('0x47')],null))[_0x863a('0x23')](respondWithResult(_0x279fdc,null))[_0x863a('0x42')](handleError(_0x279fdc,null));}; \ No newline at end of file +var _0xe514=['send','index','map','VoiceCallReport','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','where','filter','merge','options','count','includeAll','include','fullname','User','rows','catch','show','params','keys','length','create','body','destroy','find','describe','uniqueid','user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','reject','update','then','sendStatus','error','stack','name'];(function(_0x4ed17b,_0x2b1745){var _0x24b248=function(_0x136ab1){while(--_0x136ab1){_0x4ed17b['push'](_0x4ed17b['shift']());}};_0x24b248(++_0x2b1745);}(_0xe514,0x1a3));var _0x4e51=function(_0x51e587,_0x28de13){_0x51e587=_0x51e587-0x0;var _0x1ecc53=_0xe514[_0x51e587];return _0x1ecc53;};'use strict';var pdf=require(_0x4e51('0x0'));var emlformat=require(_0x4e51('0x1'));var rimraf=require(_0x4e51('0x2'));var zipdir=require(_0x4e51('0x3'));var jsonpatch=require(_0x4e51('0x4'));var rp=require(_0x4e51('0x5'));var moment=require(_0x4e51('0x6'));var BPromise=require(_0x4e51('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4e51('0x8'));var sox=require(_0x4e51('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4e51('0xa'));var jsforce=require(_0x4e51('0xb'));var deskjs=require(_0x4e51('0xc'));var toCsv=require(_0x4e51('0xd'));var querystring=require(_0x4e51('0xe'));var Papa=require(_0x4e51('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4e51('0x10'));var as=require(_0x4e51('0x11'));var hardwareService=require(_0x4e51('0x12'));var logger=require('../../config/logger')(_0x4e51('0x13'));var utils=require('../../config/utils');var config=require(_0x4e51('0x14'));var db=require(_0x4e51('0x15'))['db'];function respondWithStatusCode(_0x1cf705,_0x5c23ba){_0x5c23ba=_0x5c23ba||0xcc;return function(_0x4c5be8){if(_0x4c5be8){return _0x1cf705['sendStatus'](_0x5c23ba);}return _0x1cf705[_0x4e51('0x16')](_0x5c23ba)[_0x4e51('0x17')]();};}function respondWithResult(_0x45f191,_0x22b506){_0x22b506=_0x22b506||0xc8;return function(_0x441f81){if(_0x441f81){return _0x45f191[_0x4e51('0x16')](_0x22b506)['json'](_0x441f81);}};}function respondWithFilteredResult(_0x3d927d,_0x3ab233){return function(_0x19eb3f){if(_0x19eb3f){var _0x1a334e=_0x19eb3f['count'],_0x224fc2=_0x3ab233['offset'],_0xbfe793=_0x3ab233[_0x4e51('0x18')]+_0x3ab233[_0x4e51('0x19')],_0x577907;if(_0xbfe793>=_0x1a334e){_0xbfe793=_0x1a334e;_0x577907=0xc8;}else{_0x577907=0xce;}_0x3d927d[_0x4e51('0x16')](_0x577907);return _0x3d927d[_0x4e51('0x1a')](_0x4e51('0x1b'),_0x224fc2+'-'+_0xbfe793+'/'+_0x1a334e)[_0x4e51('0x1c')](_0x19eb3f);}return null;};}function patchUpdates(_0x19fa6a){return function(_0x2c6372){try{jsonpatch[_0x4e51('0x1d')](_0x2c6372,_0x19fa6a,!![]);}catch(_0x236980){return BPromise[_0x4e51('0x1e')](_0x236980);}return _0x2c6372['save']();};}function saveUpdates(_0x524ac5,_0x4817cb){return function(_0x535c1e){if(_0x535c1e){return _0x535c1e[_0x4e51('0x1f')](_0x524ac5)[_0x4e51('0x20')](function(_0x5abe97){return _0x5abe97;});}return null;};}function removeEntity(_0x1cc1e3,_0x4a9edb){return function(_0x5431a9){if(_0x5431a9){return _0x5431a9['destroy']()[_0x4e51('0x20')](function(){_0x1cc1e3[_0x4e51('0x16')](0xcc)[_0x4e51('0x17')]();});}};}function handleEntityNotFound(_0x122523,_0x282058){return function(_0x8c9ce4){if(!_0x8c9ce4){_0x122523[_0x4e51('0x21')](0x194);}return _0x8c9ce4;};}function handleError(_0x3e974d,_0x440b16){_0x440b16=_0x440b16||0x1f4;return function(_0x22e28d){logger[_0x4e51('0x22')](_0x22e28d[_0x4e51('0x23')]);if(_0x22e28d[_0x4e51('0x24')]){delete _0x22e28d[_0x4e51('0x24')];}_0x3e974d['status'](_0x440b16)[_0x4e51('0x25')](_0x22e28d);};}exports[_0x4e51('0x26')]=function(_0xd13e13,_0x2a4611){var _0x430cae={},_0x1e6f21={},_0x2309e8={'count':0x0,'rows':[]};var _0x31a9ef=_[_0x4e51('0x27')](db[_0x4e51('0x28')][_0x4e51('0x29')],function(_0x10da31){return{'name':_0x10da31[_0x4e51('0x2a')],'type':_0x10da31['type'][_0x4e51('0x2b')]};});_0x1e6f21['model']=_[_0x4e51('0x27')](_0x31a9ef,_0x4e51('0x24'));_0x1e6f21['query']=_['keys'](_0xd13e13[_0x4e51('0x2c')]);_0x1e6f21[_0x4e51('0x2d')]=_[_0x4e51('0x2e')](_0x1e6f21[_0x4e51('0x2f')],_0x1e6f21[_0x4e51('0x2c')]);_0x430cae['attributes']=_[_0x4e51('0x2e')](_0x1e6f21[_0x4e51('0x2f')],qs[_0x4e51('0x30')](_0xd13e13['query']['fields']));_0x430cae['attributes']=_0x430cae['attributes']['length']?_0x430cae[_0x4e51('0x31')]:_0x1e6f21[_0x4e51('0x2f')];if(!_0xd13e13[_0x4e51('0x2c')][_0x4e51('0x32')]('nolimit')){_0x430cae[_0x4e51('0x19')]=qs['limit'](_0xd13e13[_0x4e51('0x2c')][_0x4e51('0x19')]);_0x430cae[_0x4e51('0x18')]=qs[_0x4e51('0x18')](_0xd13e13[_0x4e51('0x2c')]['offset']);}_0x430cae[_0x4e51('0x33')]=qs[_0x4e51('0x34')](_0xd13e13[_0x4e51('0x2c')][_0x4e51('0x34')]);_0x430cae['where']=qs[_0x4e51('0x2d')](_[_0x4e51('0x35')](_0xd13e13[_0x4e51('0x2c')],_0x1e6f21[_0x4e51('0x2d')]),_0x31a9ef);if(_0xd13e13[_0x4e51('0x2c')]['filter']){_0x430cae[_0x4e51('0x36')]=_['merge'](_0x430cae['where'],{'$or':_[_0x4e51('0x27')](_0x31a9ef,function(_0x36c14a){if(_0x36c14a['type']!=='VIRTUAL'){var _0x46e18d={};_0x46e18d[_0x36c14a[_0x4e51('0x24')]]={'$like':'%'+_0xd13e13['query'][_0x4e51('0x37')]+'%'};return _0x46e18d;}})});}_0x430cae=_[_0x4e51('0x38')]({},_0x430cae,_0xd13e13[_0x4e51('0x39')]);var _0xfbb45b={'where':_0x430cae[_0x4e51('0x36')]};return db[_0x4e51('0x28')][_0x4e51('0x3a')](_0xfbb45b)[_0x4e51('0x20')](function(_0x4a2efb){_0x2309e8['count']=_0x4a2efb;if(_0xd13e13['query'][_0x4e51('0x3b')]){_0x430cae[_0x4e51('0x3c')]=[{'attributes':['id',_0x4e51('0x24'),_0x4e51('0x3d'),'alias'],'model':db[_0x4e51('0x3e')],'as':_0x4e51('0x3e')}];}return db[_0x4e51('0x28')]['findAll'](_0x430cae);})['then'](function(_0x14d348){_0x2309e8[_0x4e51('0x3f')]=_0x14d348;return _0x2309e8;})[_0x4e51('0x20')](respondWithFilteredResult(_0x2a4611,_0x430cae))[_0x4e51('0x40')](handleError(_0x2a4611,null));};exports[_0x4e51('0x41')]=function(_0x26c453,_0xfcd298){var _0x487753={'raw':!![],'where':{'id':_0x26c453[_0x4e51('0x42')]['id']}},_0x1ff702={};_0x1ff702[_0x4e51('0x2f')]=_[_0x4e51('0x43')](db[_0x4e51('0x28')][_0x4e51('0x29')]);_0x1ff702[_0x4e51('0x2c')]=_[_0x4e51('0x43')](_0x26c453[_0x4e51('0x2c')]);_0x1ff702[_0x4e51('0x2d')]=_['intersection'](_0x1ff702['model'],_0x1ff702[_0x4e51('0x2c')]);_0x487753['attributes']=_[_0x4e51('0x2e')](_0x1ff702[_0x4e51('0x2f')],qs[_0x4e51('0x30')](_0x26c453['query'][_0x4e51('0x30')]));_0x487753[_0x4e51('0x31')]=_0x487753[_0x4e51('0x31')][_0x4e51('0x44')]?_0x487753['attributes']:_0x1ff702[_0x4e51('0x2f')];if(_0x26c453[_0x4e51('0x2c')][_0x4e51('0x3b')]){_0x487753['include']=[{'all':!![]}];}_0x487753=_[_0x4e51('0x38')]({},_0x487753,_0x26c453[_0x4e51('0x39')]);return db[_0x4e51('0x28')]['find'](_0x487753)[_0x4e51('0x20')](handleEntityNotFound(_0xfcd298,null))[_0x4e51('0x20')](respondWithResult(_0xfcd298,null))['catch'](handleError(_0xfcd298,null));};exports[_0x4e51('0x45')]=function(_0x1acd17,_0x15cdb1){return db[_0x4e51('0x28')][_0x4e51('0x45')](_0x1acd17[_0x4e51('0x46')],{})['then'](respondWithResult(_0x15cdb1,0xc9))[_0x4e51('0x40')](handleError(_0x15cdb1,null));};exports[_0x4e51('0x47')]=function(_0x365926,_0x5d6a05){return db['VoiceCallReport'][_0x4e51('0x48')]({'where':{'id':_0x365926[_0x4e51('0x42')]['id']}})[_0x4e51('0x20')](handleEntityNotFound(_0x5d6a05,null))[_0x4e51('0x20')](removeEntity(_0x5d6a05,null))[_0x4e51('0x40')](handleError(_0x5d6a05,null));};exports[_0x4e51('0x49')]=function(_0x37cbf1,_0x385ee3){return db[_0x4e51('0x28')][_0x4e51('0x49')]()[_0x4e51('0x20')](respondWithResult(_0x385ee3,null))[_0x4e51('0x40')](handleError(_0x385ee3,null));};exports[_0x4e51('0x1f')]=function(_0x34aaff,_0x2aaeff){if(_0x34aaff[_0x4e51('0x46')][_0x4e51('0x4a')]){delete _0x34aaff[_0x4e51('0x46')][_0x4e51('0x4a')];}return db[_0x4e51('0x28')][_0x4e51('0x48')]({'where':{'uniqueid':_0x34aaff[_0x4e51('0x42')]['id'],'UserId':{'$or':[null,_0x34aaff[_0x4e51('0x4b')]['id']]}}})['then'](handleEntityNotFound(_0x2aaeff,null))[_0x4e51('0x20')](saveUpdates(_0x34aaff['body'],null))[_0x4e51('0x20')](respondWithResult(_0x2aaeff,null))[_0x4e51('0x40')](handleError(_0x2aaeff,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 48f00c2..4d5d615 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 _0x80f1=['../../config/logger','moment','request-promise','path','rimraf','./voiceCallReport.attributes','exports','VoiceCallReport','uniqueid','lodash','util'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x80f1,0x1c1));var _0x180f=function(_0x1df83c,_0x1f4e23){_0x1df83c=_0x1df83c-0x0;var _0x16933a=_0x80f1[_0x1df83c];return _0x16933a;};'use strict';var _=require(_0x180f('0x0'));var util=require(_0x180f('0x1'));var logger=require(_0x180f('0x2'))('api');var moment=require(_0x180f('0x3'));var BPromise=require('bluebird');var rp=require(_0x180f('0x4'));var fs=require('fs');var path=require(_0x180f('0x5'));var rimraf=require(_0x180f('0x6'));var config=require('../../config/environment');var attributes=require(_0x180f('0x7'));module[_0x180f('0x8')]=function(_0x23fe75,_0x3ebb34){return _0x23fe75['define'](_0x180f('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x180f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f52=['path','rimraf','./voiceCallReport.attributes','define','report_call','uniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0x9f52,0x1c9));var _0x29f5=function(_0x294b68,_0x3f0093){_0x294b68=_0x294b68-0x0;var _0x4b104b=_0x9f52[_0x294b68];return _0x4b104b;};'use strict';var _=require(_0x29f5('0x0'));var util=require('util');var logger=require(_0x29f5('0x1'))(_0x29f5('0x2'));var moment=require('moment');var BPromise=require(_0x29f5('0x3'));var rp=require(_0x29f5('0x4'));var fs=require('fs');var path=require(_0x29f5('0x5'));var rimraf=require(_0x29f5('0x6'));var config=require('../../config/environment');var attributes=require(_0x29f5('0x7'));module['exports']=function(_0x57030b,_0x35daf9){return _0x57030b[_0x29f5('0x8')]('VoiceCallReport',attributes,{'tableName':_0x29f5('0x9'),'paranoid':![],'indexes':[{'fields':[_0x29f5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5338f86..78ab9d0 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 _0x6521=['request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','attributes','limit','include','map','model','stringify','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x3aac36,_0x287fe1){var _0x519fe0=function(_0x1da7de){while(--_0x1da7de){_0x3aac36['push'](_0x3aac36['shift']());}};_0x519fe0(++_0x287fe1);}(_0x6521,0x91));var _0x1652=function(_0xd41ece,_0x241cdb){_0xd41ece=_0xd41ece-0x0;var _0x5e2da2=_0x6521[_0xd41ece];return _0x5e2da2;};'use strict';var _=require(_0x1652('0x0'));var util=require(_0x1652('0x1'));var moment=require(_0x1652('0x2'));var BPromise=require(_0x1652('0x3'));var rs=require(_0x1652('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1652('0x5'))['db'];var utils=require(_0x1652('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1652('0x7'));var jayson=require(_0x1652('0x8'));var client=jayson[_0x1652('0x9')][_0x1652('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x334a1f,_0x37c33a,_0x477cfc){return new BPromise(function(_0x49195d,_0x2bf3af){return client[_0x1652('0xb')](_0x334a1f,_0x477cfc)[_0x1652('0xc')](function(_0x2162e3){logger[_0x1652('0xd')](_0x1652('0xe'),_0x37c33a,_0x1652('0xf'));logger[_0x1652('0x10')](_0x1652('0x11'),_0x37c33a,_0x1652('0xf'),JSON['stringify'](_0x2162e3));if(_0x2162e3[_0x1652('0x12')]){if(_0x2162e3[_0x1652('0x12')][_0x1652('0x13')]===0x1f4){logger[_0x1652('0x12')](_0x1652('0xe'),_0x37c33a,_0x2162e3[_0x1652('0x12')][_0x1652('0x14')]);return _0x2bf3af(_0x2162e3[_0x1652('0x12')][_0x1652('0x14')]);}logger['error'](_0x1652('0xe'),_0x37c33a,_0x2162e3[_0x1652('0x12')][_0x1652('0x14')]);return _0x49195d(_0x2162e3[_0x1652('0x12')]['message']);}else{logger[_0x1652('0xd')](_0x1652('0xe'),_0x37c33a,_0x1652('0xf'));_0x49195d(_0x2162e3[_0x1652('0x15')][_0x1652('0x14')]);}})[_0x1652('0x16')](function(_0xe36443){logger[_0x1652('0x12')](_0x1652('0xe'),_0x37c33a,_0xe36443);_0x2bf3af(_0xe36443);});});}exports[_0x1652('0x17')]=function(_0x5a37c1){var _0x57ac4e=this;return new Promise(function(_0x1e29a9,_0x4ca00b){return db[_0x1652('0x18')][_0x1652('0x19')]({'raw':_0x5a37c1[_0x1652('0x1a')]?_0x5a37c1['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a37c1[_0x1652('0x1a')]?_0x5a37c1[_0x1652('0x1a')][_0x1652('0x1b')]||null:null,'attributes':_0x5a37c1[_0x1652('0x1a')]?_0x5a37c1[_0x1652('0x1a')][_0x1652('0x1c')]||null:null,'limit':_0x5a37c1['options']?_0x5a37c1[_0x1652('0x1a')][_0x1652('0x1d')]||null:null,'include':_0x5a37c1['options']?_0x5a37c1[_0x1652('0x1a')][_0x1652('0x1e')]?_[_0x1652('0x1f')](_0x5a37c1['options']['include'],function(_0x367f7){return{'model':db[_0x367f7[_0x1652('0x20')]],'as':_0x367f7['as'],'attributes':_0x367f7['attributes'],'include':_0x367f7[_0x1652('0x1e')]?_[_0x1652('0x1f')](_0x367f7[_0x1652('0x1e')],function(_0x9cbb28){return{'model':db[_0x9cbb28[_0x1652('0x20')]],'as':_0x9cbb28['as'],'attributes':_0x9cbb28['attributes'],'include':_0x9cbb28['include']?_[_0x1652('0x1f')](_0x9cbb28[_0x1652('0x1e')],function(_0x322494){return{'model':db[_0x322494[_0x1652('0x20')]],'as':_0x322494['as'],'attributes':_0x322494[_0x1652('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1652('0xc')](function(_0x35fce2){logger[_0x1652('0xd')]('GetVoiceCallReport',_0x5a37c1);logger[_0x1652('0x10')](_0x1652('0x17'),_0x5a37c1,JSON[_0x1652('0x21')](_0x35fce2));_0x1e29a9(_0x35fce2);})[_0x1652('0x16')](function(_0x71eaeb){logger['error'](_0x1652('0x17'),_0x71eaeb['message'],_0x5a37c1);_0x4ca00b(_0x57ac4e[_0x1652('0x12')](0x1f4,_0x71eaeb[_0x1652('0x14')]));});});};exports[_0x1652('0x22')]=function(_0x56b9d2){var _0x4e1ded=this;return new Promise(function(_0x2e5041,_0x35ef2a){return db[_0x1652('0x18')][_0x1652('0x23')](_0x56b9d2['body'],{'raw':_0x56b9d2[_0x1652('0x1a')]?_0x56b9d2['options']['raw']===undefined?!![]:![]:!![]})[_0x1652('0xc')](function(_0x56cb5e){logger[_0x1652('0xd')](_0x1652('0x22'),_0x56b9d2);logger['debug']('CreateVoiceCallReport',_0x56b9d2,JSON[_0x1652('0x21')](_0x56cb5e));_0x2e5041(_0x56cb5e);})['catch'](function(_0x37c4af){logger[_0x1652('0x12')](_0x1652('0x22'),_0x37c4af['message'],_0x56b9d2);_0x35ef2a(_0x4e1ded[_0x1652('0x12')](0x1f4,_0x37c4af[_0x1652('0x14')]));});});};exports[_0x1652('0x24')]=function(_0x3cf61e){var _0x32e04d=this;return new Promise(function(_0x15a5e3,_0x293f36){return db[_0x1652('0x18')][_0x1652('0x25')](_0x3cf61e['body'],{'raw':_0x3cf61e[_0x1652('0x1a')]?_0x3cf61e[_0x1652('0x1a')][_0x1652('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cf61e[_0x1652('0x1a')]?_0x3cf61e[_0x1652('0x1a')][_0x1652('0x1b')]||null:null,'attributes':_0x3cf61e['options']?_0x3cf61e[_0x1652('0x1a')][_0x1652('0x1c')]||null:null,'limit':_0x3cf61e[_0x1652('0x1a')]?_0x3cf61e[_0x1652('0x1a')][_0x1652('0x1d')]||null:null})[_0x1652('0xc')](function(_0x223781){logger['info'](_0x1652('0x24'),_0x3cf61e);logger[_0x1652('0x10')](_0x1652('0x24'),_0x3cf61e,JSON[_0x1652('0x21')](_0x223781));_0x15a5e3(_0x223781);})[_0x1652('0x16')](function(_0x319273){logger[_0x1652('0x12')](_0x1652('0x24'),_0x319273[_0x1652('0x14')],_0x3cf61e);_0x293f36(_0x32e04d[_0x1652('0x12')](0x1f4,_0x319273['message']));});});}; \ No newline at end of file +var _0x28a3=['error','code','message','info','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','limit','include','map','attributes','model','stringify','CreateVoiceCallReport','create','body','raw','update','UpdateVoiceCallReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0x28a3,0x1ba));var _0x328a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28a3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x328a('0x0'));var BPromise=require(_0x328a('0x1'));var rs=require(_0x328a('0x2'));var fs=require('fs');var Redis=require(_0x328a('0x3'));var db=require(_0x328a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x328a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x328a('0x6')][_0x328a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x20820a,_0x1877da,_0xf5dd6){return new BPromise(function(_0x337e94,_0x274185){return client[_0x328a('0x8')](_0x20820a,_0xf5dd6)[_0x328a('0x9')](function(_0x56dced){logger['info'](_0x328a('0xa'),_0x1877da,_0x328a('0xb'));logger[_0x328a('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1877da,'request\x20sent',JSON['stringify'](_0x56dced));if(_0x56dced[_0x328a('0xd')]){if(_0x56dced[_0x328a('0xd')][_0x328a('0xe')]===0x1f4){logger[_0x328a('0xd')](_0x328a('0xa'),_0x1877da,_0x56dced[_0x328a('0xd')][_0x328a('0xf')]);return _0x274185(_0x56dced[_0x328a('0xd')][_0x328a('0xf')]);}logger[_0x328a('0xd')](_0x328a('0xa'),_0x1877da,_0x56dced[_0x328a('0xd')][_0x328a('0xf')]);return _0x337e94(_0x56dced[_0x328a('0xd')][_0x328a('0xf')]);}else{logger[_0x328a('0x10')](_0x328a('0xa'),_0x1877da,_0x328a('0xb'));_0x337e94(_0x56dced['result']['message']);}})[_0x328a('0x11')](function(_0x5a7565){logger[_0x328a('0xd')](_0x328a('0xa'),_0x1877da,_0x5a7565);_0x274185(_0x5a7565);});});}exports[_0x328a('0x12')]=function(_0x3b9eec){var _0x10a98b=this;return new Promise(function(_0x165402,_0x4af4f1){return db[_0x328a('0x13')][_0x328a('0x14')]({'raw':_0x3b9eec[_0x328a('0x15')]?_0x3b9eec['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b9eec[_0x328a('0x15')]?_0x3b9eec[_0x328a('0x15')][_0x328a('0x16')]||null:null,'attributes':_0x3b9eec['options']?_0x3b9eec[_0x328a('0x15')]['attributes']||null:null,'limit':_0x3b9eec['options']?_0x3b9eec['options'][_0x328a('0x17')]||null:null,'include':_0x3b9eec[_0x328a('0x15')]?_0x3b9eec['options'][_0x328a('0x18')]?_[_0x328a('0x19')](_0x3b9eec[_0x328a('0x15')][_0x328a('0x18')],function(_0x2f865e){return{'model':db[_0x2f865e['model']],'as':_0x2f865e['as'],'attributes':_0x2f865e[_0x328a('0x1a')],'include':_0x2f865e[_0x328a('0x18')]?_[_0x328a('0x19')](_0x2f865e[_0x328a('0x18')],function(_0x53b5cf){return{'model':db[_0x53b5cf[_0x328a('0x1b')]],'as':_0x53b5cf['as'],'attributes':_0x53b5cf['attributes'],'include':_0x53b5cf[_0x328a('0x18')]?_['map'](_0x53b5cf[_0x328a('0x18')],function(_0x9b5091){return{'model':db[_0x9b5091[_0x328a('0x1b')]],'as':_0x9b5091['as'],'attributes':_0x9b5091[_0x328a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x328a('0x9')](function(_0x46ab8e){logger[_0x328a('0x10')](_0x328a('0x12'),_0x3b9eec);logger['debug'](_0x328a('0x12'),_0x3b9eec,JSON[_0x328a('0x1c')](_0x46ab8e));_0x165402(_0x46ab8e);})[_0x328a('0x11')](function(_0x549ff8){logger[_0x328a('0xd')](_0x328a('0x12'),_0x549ff8['message'],_0x3b9eec);_0x4af4f1(_0x10a98b[_0x328a('0xd')](0x1f4,_0x549ff8[_0x328a('0xf')]));});});};exports[_0x328a('0x1d')]=function(_0x25815d){var _0x59a4a4=this;return new Promise(function(_0x309964,_0x34c3c9){return db[_0x328a('0x13')][_0x328a('0x1e')](_0x25815d[_0x328a('0x1f')],{'raw':_0x25815d['options']?_0x25815d['options'][_0x328a('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x5accd6){logger[_0x328a('0x10')](_0x328a('0x1d'),_0x25815d);logger[_0x328a('0xc')](_0x328a('0x1d'),_0x25815d,JSON[_0x328a('0x1c')](_0x5accd6));_0x309964(_0x5accd6);})[_0x328a('0x11')](function(_0x43ac10){logger['error'](_0x328a('0x1d'),_0x43ac10[_0x328a('0xf')],_0x25815d);_0x34c3c9(_0x59a4a4[_0x328a('0xd')](0x1f4,_0x43ac10[_0x328a('0xf')]));});});};exports['UpdateVoiceCallReport']=function(_0x1f3a2a){var _0x4cd890=this;return new Promise(function(_0x456736,_0x13ffd0){return db['VoiceCallReport'][_0x328a('0x21')](_0x1f3a2a[_0x328a('0x1f')],{'raw':_0x1f3a2a[_0x328a('0x15')]?_0x1f3a2a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f3a2a['options']?_0x1f3a2a['options'][_0x328a('0x16')]||null:null,'attributes':_0x1f3a2a[_0x328a('0x15')]?_0x1f3a2a[_0x328a('0x15')][_0x328a('0x1a')]||null:null,'limit':_0x1f3a2a['options']?_0x1f3a2a['options']['limit']||null:null})['then'](function(_0x2e39af){logger[_0x328a('0x10')](_0x328a('0x22'),_0x1f3a2a);logger[_0x328a('0xc')](_0x328a('0x22'),_0x1f3a2a,JSON[_0x328a('0x1c')](_0x2e39af));_0x456736(_0x2e39af);})['catch'](function(_0x192b88){logger['error']('UpdateVoiceCallReport',_0x192b88[_0x328a('0xf')],_0x1f3a2a);_0x13ffd0(_0x4cd890['error'](0x1f4,_0x192b88[_0x328a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 30a7dfd..56dc992 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 _0xd9dc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd9dc,0x18b));var _0xcd9d=function(_0x125cb4,_0xd3bfd8){_0x125cb4=_0x125cb4-0x0;var _0x22579d=_0xd9dc[_0x125cb4];return _0x22579d;};'use strict';var multer=require(_0xcd9d('0x0'));var util=require('util');var path=require(_0xcd9d('0x1'));var timeout=require(_0xcd9d('0x2'));var express=require(_0xcd9d('0x3'));var router=express[_0xcd9d('0x4')]();var auth=require(_0xcd9d('0x5'));var interaction=require(_0xcd9d('0x6'));var config=require(_0xcd9d('0x7'));var controller=require(_0xcd9d('0x8'));router[_0xcd9d('0x9')]('/',auth[_0xcd9d('0xa')](),controller[_0xcd9d('0xb')]);router[_0xcd9d('0x9')](_0xcd9d('0xc'),auth[_0xcd9d('0xa')](),controller['show']);router[_0xcd9d('0xd')]('/',auth[_0xcd9d('0xa')](),controller[_0xcd9d('0xe')]);router[_0xcd9d('0xf')](_0xcd9d('0xc'),auth[_0xcd9d('0xa')](),controller[_0xcd9d('0x10')]);router[_0xcd9d('0x11')](_0xcd9d('0xc'),auth[_0xcd9d('0xa')](),controller[_0xcd9d('0x12')]);module[_0xcd9d('0x13')]=router; \ No newline at end of file +var _0x43d7=['update','delete','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x42d10f,_0x56d428){var _0x3b874e=function(_0x7bfc9d){while(--_0x7bfc9d){_0x42d10f['push'](_0x42d10f['shift']());}};_0x3b874e(++_0x56d428);}(_0x43d7,0x7b));var _0x743d=function(_0x197793,_0x335ef4){_0x197793=_0x197793-0x0;var _0x4c52ba=_0x43d7[_0x197793];return _0x4c52ba;};'use strict';var multer=require(_0x743d('0x0'));var util=require(_0x743d('0x1'));var path=require(_0x743d('0x2'));var timeout=require('connect-timeout');var express=require(_0x743d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x743d('0x4'));var config=require(_0x743d('0x5'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x743d('0x6')](),controller[_0x743d('0x7')]);router[_0x743d('0x8')](_0x743d('0x9'),auth[_0x743d('0x6')](),controller[_0x743d('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x743d('0xb')]);router[_0x743d('0xc')](_0x743d('0x9'),auth['isAuthenticated'](),controller[_0x743d('0xd')]);router[_0x743d('0xe')](_0x743d('0x9'),auth['isAuthenticated'](),controller[_0x743d('0xf')]);module[_0x743d('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 65b3ea0..17c0e4a 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 _0x725c=['name','options','join','getDataValue','BOOLEAN','STRING'];(function(_0x2d6549,_0x916739){var _0x493273=function(_0x23ae46){while(--_0x23ae46){_0x2d6549['push'](_0x2d6549['shift']());}};_0x493273(++_0x916739);}(_0x725c,0x197));var _0xc725=function(_0x5c2d24,_0x1c1173){_0x5c2d24=_0x5c2d24-0x0;var _0x416f96=_0x725c[_0x5c2d24];return _0x416f96;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xc725('0x0')],'unique':_0xc725('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0xc725('0x0')],'set':function(_0x358a61){this['setDataValue'](_0xc725('0x2'),_0x358a61?_0x358a61[_0xc725('0x3')](''):[]);},'get':function(){return this[_0xc725('0x4')]('options')?this[_0xc725('0x4')](_0xc725('0x2'))['split'](''):[];}},'auth':{'type':Sequelize[_0xc725('0x5')],'defaultValue':![]},'password':{'type':Sequelize[_0xc725('0x0')]},'record':{'type':Sequelize[_0xc725('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7b5c=['options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x391db2,_0x2af5bb){var _0x39d595=function(_0x5e35f5){while(--_0x5e35f5){_0x391db2['push'](_0x391db2['shift']());}};_0x39d595(++_0x2af5bb);}(_0x7b5c,0x11c));var _0xc7b5=function(_0x3374b1,_0x425c70){_0x3374b1=_0x3374b1-0x0;var _0x245ffe=_0x7b5c[_0x3374b1];return _0x245ffe;};'use strict';var Sequelize=require(_0xc7b5('0x0'));module[_0xc7b5('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xc7b5('0x2')],'unique':_0xc7b5('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xc7b5('0x2')],'set':function(_0x3768e9){this['setDataValue'](_0xc7b5('0x4'),_0x3768e9?_0x3768e9[_0xc7b5('0x5')](''):[]);},'get':function(){return this[_0xc7b5('0x6')](_0xc7b5('0x4'))?this[_0xc7b5('0x6')](_0xc7b5('0x4'))[_0xc7b5('0x7')](''):[];}},'auth':{'type':Sequelize[_0xc7b5('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xc7b5('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc7b5('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 390f3e6..b707efc 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 _0xb07d=['name','send','index','map','VoiceChanSpy','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','html-pdf','eml-format','rimraf','request-promise','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','destroy','get','UserProfileResource','error','stack'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0xb07d,0x10d));var _0xdb07=function(_0x516adf,_0x8c64dd){_0x516adf=_0x516adf-0x0;var _0xd6f7ff=_0xb07d[_0x516adf];return _0xd6f7ff;};'use strict';var pdf=require(_0xdb07('0x0'));var emlformat=require(_0xdb07('0x1'));var rimraf=require(_0xdb07('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdb07('0x3'));var moment=require('moment');var BPromise=require(_0xdb07('0x4'));var Mustache=require('mustache');var util=require(_0xdb07('0x5'));var path=require(_0xdb07('0x6'));var sox=require('sox');var csv=require(_0xdb07('0x7'));var ejs=require(_0xdb07('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdb07('0x9'));var crypto=require('crypto');var jsforce=require(_0xdb07('0xa'));var deskjs=require(_0xdb07('0xb'));var toCsv=require(_0xdb07('0x7'));var querystring=require(_0xdb07('0xc'));var Papa=require(_0xdb07('0xd'));var Redis=require(_0xdb07('0xe'));var authService=require(_0xdb07('0xf'));var qs=require(_0xdb07('0x10'));var as=require(_0xdb07('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb07('0x12'))(_0xdb07('0x13'));var utils=require(_0xdb07('0x14'));var config=require(_0xdb07('0x15'));var db=require(_0xdb07('0x16'))['db'];function respondWithStatusCode(_0x3e1de5,_0x4d065d){_0x4d065d=_0x4d065d||0xcc;return function(_0x3684a7){if(_0x3684a7){return _0x3e1de5[_0xdb07('0x17')](_0x4d065d);}return _0x3e1de5[_0xdb07('0x18')](_0x4d065d)[_0xdb07('0x19')]();};}function respondWithResult(_0x58acc7,_0x4f6fd8){_0x4f6fd8=_0x4f6fd8||0xc8;return function(_0x544f82){if(_0x544f82){return _0x58acc7[_0xdb07('0x18')](_0x4f6fd8)[_0xdb07('0x1a')](_0x544f82);}};}function respondWithFilteredResult(_0x53373d,_0x202094){return function(_0x5b0b00){if(_0x5b0b00){var _0x5cfb15=_0x5b0b00[_0xdb07('0x1b')],_0x30dfab=_0x202094[_0xdb07('0x1c')],_0x495547=_0x202094[_0xdb07('0x1c')]+_0x202094[_0xdb07('0x1d')],_0x1dfb25;if(_0x495547>=_0x5cfb15){_0x495547=_0x5cfb15;_0x1dfb25=0xc8;}else{_0x1dfb25=0xce;}_0x53373d[_0xdb07('0x18')](_0x1dfb25);return _0x53373d['set']('Content-Range',_0x30dfab+'-'+_0x495547+'/'+_0x5cfb15)['json'](_0x5b0b00);}return null;};}function patchUpdates(_0x3c7ef6){return function(_0x2ecf1f){try{jsonpatch['apply'](_0x2ecf1f,_0x3c7ef6,!![]);}catch(_0xf3b10c){return BPromise[_0xdb07('0x1e')](_0xf3b10c);}return _0x2ecf1f[_0xdb07('0x1f')]();};}function saveUpdates(_0x5e7dce,_0x2c6283){return function(_0x223d24){if(_0x223d24){return _0x223d24[_0xdb07('0x20')](_0x5e7dce)[_0xdb07('0x21')](function(_0x279327){return _0x279327;});}return null;};}function removeEntity(_0x1691fe,_0x2e1358){return function(_0x2dfdc1){if(_0x2dfdc1){return _0x2dfdc1[_0xdb07('0x22')]()[_0xdb07('0x21')](function(){var _0x44656b=_0x2dfdc1[_0xdb07('0x23')]({'plain':!![]});var _0x3c4c56='ChanSpies';return db[_0xdb07('0x24')][_0xdb07('0x22')]({'where':{'type':_0x3c4c56,'resourceId':_0x44656b['id']}})[_0xdb07('0x21')](function(){return _0x2dfdc1;});})[_0xdb07('0x21')](function(){_0x1691fe[_0xdb07('0x18')](0xcc)[_0xdb07('0x19')]();});}};}function handleEntityNotFound(_0x5c9aa8,_0x445a04){return function(_0x2434e6){if(!_0x2434e6){_0x5c9aa8[_0xdb07('0x17')](0x194);}return _0x2434e6;};}function handleError(_0xdbccb0,_0x21fed9){_0x21fed9=_0x21fed9||0x1f4;return function(_0x509edf){logger[_0xdb07('0x25')](_0x509edf[_0xdb07('0x26')]);if(_0x509edf[_0xdb07('0x27')]){delete _0x509edf[_0xdb07('0x27')];}_0xdbccb0[_0xdb07('0x18')](_0x21fed9)[_0xdb07('0x28')](_0x509edf);};}exports[_0xdb07('0x29')]=function(_0x5c6409,_0x38d537){var _0x40d824={},_0x2b662a={},_0x5a7472={'count':0x0,'rows':[]};var _0x5d67c9=_[_0xdb07('0x2a')](db[_0xdb07('0x2b')]['rawAttributes'],function(_0x29c198){return{'name':_0x29c198[_0xdb07('0x2c')],'type':_0x29c198[_0xdb07('0x2d')][_0xdb07('0x2e')]};});_0x2b662a[_0xdb07('0x2f')]=_[_0xdb07('0x2a')](_0x5d67c9,_0xdb07('0x27'));_0x2b662a['query']=_[_0xdb07('0x30')](_0x5c6409['query']);_0x2b662a['filters']=_[_0xdb07('0x31')](_0x2b662a['model'],_0x2b662a[_0xdb07('0x32')]);_0x40d824[_0xdb07('0x33')]=_[_0xdb07('0x31')](_0x2b662a[_0xdb07('0x2f')],qs[_0xdb07('0x34')](_0x5c6409[_0xdb07('0x32')]['fields']));_0x40d824[_0xdb07('0x33')]=_0x40d824[_0xdb07('0x33')][_0xdb07('0x35')]?_0x40d824['attributes']:_0x2b662a['model'];if(!_0x5c6409['query']['hasOwnProperty'](_0xdb07('0x36'))){_0x40d824[_0xdb07('0x1d')]=qs[_0xdb07('0x1d')](_0x5c6409[_0xdb07('0x32')]['limit']);_0x40d824['offset']=qs[_0xdb07('0x1c')](_0x5c6409['query']['offset']);}_0x40d824['order']=qs['sort'](_0x5c6409[_0xdb07('0x32')][_0xdb07('0x37')]);_0x40d824[_0xdb07('0x38')]=qs[_0xdb07('0x39')](_['pick'](_0x5c6409['query'],_0x2b662a[_0xdb07('0x39')]),_0x5d67c9);if(_0x5c6409[_0xdb07('0x32')][_0xdb07('0x3a')]){_0x40d824[_0xdb07('0x38')]=_[_0xdb07('0x3b')](_0x40d824[_0xdb07('0x38')],{'$or':_['map'](_0x5d67c9,function(_0x3464f7){if(_0x3464f7['type']!=='VIRTUAL'){var _0x268d3c={};_0x268d3c[_0x3464f7[_0xdb07('0x27')]]={'$like':'%'+_0x5c6409[_0xdb07('0x32')][_0xdb07('0x3a')]+'%'};return _0x268d3c;}})});}_0x40d824=_[_0xdb07('0x3b')]({},_0x40d824,_0x5c6409[_0xdb07('0x3c')]);var _0x86e416={'where':_0x40d824[_0xdb07('0x38')]};return db[_0xdb07('0x2b')][_0xdb07('0x1b')](_0x86e416)[_0xdb07('0x21')](function(_0x3db2fc){_0x5a7472[_0xdb07('0x1b')]=_0x3db2fc;if(_0x5c6409[_0xdb07('0x32')][_0xdb07('0x3d')]){_0x40d824[_0xdb07('0x3e')]=[{'all':!![]}];}return db[_0xdb07('0x2b')][_0xdb07('0x3f')](_0x40d824);})[_0xdb07('0x21')](function(_0x58729b){_0x5a7472[_0xdb07('0x40')]=_0x58729b;return _0x5a7472;})['then'](respondWithFilteredResult(_0x38d537,_0x40d824))[_0xdb07('0x41')](handleError(_0x38d537,null));};exports[_0xdb07('0x42')]=function(_0x3ccb7d,_0x11e860){var _0x3f3ff5={'raw':![],'where':{'id':_0x3ccb7d[_0xdb07('0x43')]['id']}},_0x1c9208={};_0x1c9208[_0xdb07('0x2f')]=_[_0xdb07('0x30')](db['VoiceChanSpy'][_0xdb07('0x44')]);_0x1c9208['query']=_[_0xdb07('0x30')](_0x3ccb7d['query']);_0x1c9208[_0xdb07('0x39')]=_['intersection'](_0x1c9208[_0xdb07('0x2f')],_0x1c9208[_0xdb07('0x32')]);_0x3f3ff5['attributes']=_[_0xdb07('0x31')](_0x1c9208[_0xdb07('0x2f')],qs['fields'](_0x3ccb7d[_0xdb07('0x32')][_0xdb07('0x34')]));_0x3f3ff5[_0xdb07('0x33')]=_0x3f3ff5[_0xdb07('0x33')][_0xdb07('0x35')]?_0x3f3ff5[_0xdb07('0x33')]:_0x1c9208['model'];if(_0x3ccb7d['query'][_0xdb07('0x3d')]){_0x3f3ff5[_0xdb07('0x3e')]=[{'all':!![]}];}_0x3f3ff5=_['merge']({},_0x3f3ff5,_0x3ccb7d[_0xdb07('0x3c')]);return db['VoiceChanSpy'][_0xdb07('0x45')](_0x3f3ff5)[_0xdb07('0x21')](handleEntityNotFound(_0x11e860,null))[_0xdb07('0x21')](respondWithResult(_0x11e860,null))[_0xdb07('0x41')](handleError(_0x11e860,null));};exports[_0xdb07('0x46')]=function(_0x503f54,_0x2a202c){return db[_0xdb07('0x2b')][_0xdb07('0x46')](_0x503f54[_0xdb07('0x47')],{})[_0xdb07('0x21')](function(_0x32479e){var _0x2e7d1f=_0x503f54[_0xdb07('0x48')][_0xdb07('0x23')]({'plain':!![]});if(!_0x2e7d1f)throw new Error(_0xdb07('0x49'));if(_0x2e7d1f[_0xdb07('0x4a')]===_0xdb07('0x48')){var _0x385198=_0x32479e['get']({'plain':!![]});var _0x28c548='ChanSpies';return db[_0xdb07('0x4b')]['find']({'where':{'name':_0x28c548,'userProfileId':_0x2e7d1f[_0xdb07('0x4c')]},'raw':!![]})[_0xdb07('0x21')](function(_0x33b321){if(_0x33b321&&_0x33b321['autoAssociation']===0x0){return db[_0xdb07('0x24')][_0xdb07('0x46')]({'name':_0x385198[_0xdb07('0x27')],'resourceId':_0x385198['id'],'type':_0x33b321['name'],'sectionId':_0x33b321['id']},{})[_0xdb07('0x21')](function(){return _0x32479e;});}else{return _0x32479e;}})[_0xdb07('0x41')](function(_0x4e6799){logger[_0xdb07('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e6799);throw _0x4e6799;});}return _0x32479e;})['then'](respondWithResult(_0x2a202c,0xc9))['catch'](handleError(_0x2a202c,null));};exports[_0xdb07('0x20')]=function(_0x22b455,_0x197eb1){if(_0x22b455[_0xdb07('0x47')]['id']){delete _0x22b455['body']['id'];}return db[_0xdb07('0x2b')][_0xdb07('0x45')]({'where':{'id':_0x22b455[_0xdb07('0x43')]['id']}})[_0xdb07('0x21')](handleEntityNotFound(_0x197eb1,null))[_0xdb07('0x21')](saveUpdates(_0x22b455['body'],null))[_0xdb07('0x21')](respondWithResult(_0x197eb1,null))['catch'](handleError(_0x197eb1,null));};exports['destroy']=function(_0x1a6c16,_0xebb721){return db['VoiceChanSpy'][_0xdb07('0x45')]({'where':{'id':_0x1a6c16['params']['id']}})[_0xdb07('0x21')](handleEntityNotFound(_0xebb721,null))['then'](removeEntity(_0xebb721,null))[_0xdb07('0x41')](handleError(_0xebb721,null));}; \ No newline at end of file +var _0x013b=['where','filter','options','VoiceChanSpy','include','findAll','rows','catch','show','params','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','apply','save','update','then','destroy','get','ChanSpies','UserProfileResource','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge'];(function(_0x112689,_0x1ec4af){var _0x451925=function(_0x140c41){while(--_0x140c41){_0x112689['push'](_0x112689['shift']());}};_0x451925(++_0x1ec4af);}(_0x013b,0x198));var _0xb013=function(_0x2b84d5,_0x428914){_0x2b84d5=_0x2b84d5-0x0;var _0x51452a=_0x013b[_0x2b84d5];return _0x51452a;};'use strict';var pdf=require(_0xb013('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb013('0x1'));var zipdir=require(_0xb013('0x2'));var jsonpatch=require(_0xb013('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb013('0x4'));var Mustache=require(_0xb013('0x5'));var util=require('util');var path=require(_0xb013('0x6'));var sox=require(_0xb013('0x7'));var csv=require(_0xb013('0x8'));var ejs=require(_0xb013('0x9'));var fs=require('fs');var _=require(_0xb013('0xa'));var squel=require(_0xb013('0xb'));var crypto=require(_0xb013('0xc'));var jsforce=require(_0xb013('0xd'));var deskjs=require(_0xb013('0xe'));var toCsv=require(_0xb013('0x8'));var querystring=require(_0xb013('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb013('0x10'));var qs=require(_0xb013('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb013('0x12'));var utils=require(_0xb013('0x13'));var config=require(_0xb013('0x14'));var db=require(_0xb013('0x15'))['db'];function respondWithStatusCode(_0x94ed6a,_0x32b778){_0x32b778=_0x32b778||0xcc;return function(_0x168833){if(_0x168833){return _0x94ed6a[_0xb013('0x16')](_0x32b778);}return _0x94ed6a[_0xb013('0x17')](_0x32b778)['end']();};}function respondWithResult(_0x1256f5,_0x3e46da){_0x3e46da=_0x3e46da||0xc8;return function(_0x4527f7){if(_0x4527f7){return _0x1256f5[_0xb013('0x17')](_0x3e46da)['json'](_0x4527f7);}};}function respondWithFilteredResult(_0x1f7deb,_0x123043){return function(_0x436dbf){if(_0x436dbf){var _0x3271c0=_0x436dbf[_0xb013('0x18')],_0x246fc3=_0x123043[_0xb013('0x19')],_0x3b38d8=_0x123043[_0xb013('0x19')]+_0x123043[_0xb013('0x1a')],_0x15a36d;if(_0x3b38d8>=_0x3271c0){_0x3b38d8=_0x3271c0;_0x15a36d=0xc8;}else{_0x15a36d=0xce;}_0x1f7deb[_0xb013('0x17')](_0x15a36d);return _0x1f7deb[_0xb013('0x1b')]('Content-Range',_0x246fc3+'-'+_0x3b38d8+'/'+_0x3271c0)['json'](_0x436dbf);}return null;};}function patchUpdates(_0x3e6c16){return function(_0x1ece37){try{jsonpatch[_0xb013('0x1c')](_0x1ece37,_0x3e6c16,!![]);}catch(_0x184568){return BPromise['reject'](_0x184568);}return _0x1ece37[_0xb013('0x1d')]();};}function saveUpdates(_0x47ae52,_0x51b6c7){return function(_0x5c7317){if(_0x5c7317){return _0x5c7317[_0xb013('0x1e')](_0x47ae52)[_0xb013('0x1f')](function(_0x4b5643){return _0x4b5643;});}return null;};}function removeEntity(_0x3e49f8,_0x36cda8){return function(_0x4f02d4){if(_0x4f02d4){return _0x4f02d4[_0xb013('0x20')]()['then'](function(){var _0x1c9cd0=_0x4f02d4[_0xb013('0x21')]({'plain':!![]});var _0x24879c=_0xb013('0x22');return db[_0xb013('0x23')]['destroy']({'where':{'type':_0x24879c,'resourceId':_0x1c9cd0['id']}})[_0xb013('0x1f')](function(){return _0x4f02d4;});})['then'](function(){_0x3e49f8[_0xb013('0x17')](0xcc)[_0xb013('0x24')]();});}};}function handleEntityNotFound(_0x790739,_0x3108f0){return function(_0x40fb2f){if(!_0x40fb2f){_0x790739[_0xb013('0x16')](0x194);}return _0x40fb2f;};}function handleError(_0x25a42d,_0x3cab73){_0x3cab73=_0x3cab73||0x1f4;return function(_0x590d69){logger[_0xb013('0x25')](_0x590d69[_0xb013('0x26')]);if(_0x590d69[_0xb013('0x27')]){delete _0x590d69['name'];}_0x25a42d[_0xb013('0x17')](_0x3cab73)['send'](_0x590d69);};}exports[_0xb013('0x28')]=function(_0x357cdf,_0x210183){var _0x1144e3={},_0x3eaa70={},_0x22df71={'count':0x0,'rows':[]};var _0x930fa0=_['map'](db['VoiceChanSpy'][_0xb013('0x29')],function(_0x4f08cd){return{'name':_0x4f08cd[_0xb013('0x2a')],'type':_0x4f08cd[_0xb013('0x2b')][_0xb013('0x2c')]};});_0x3eaa70[_0xb013('0x2d')]=_[_0xb013('0x2e')](_0x930fa0,'name');_0x3eaa70[_0xb013('0x2f')]=_[_0xb013('0x30')](_0x357cdf['query']);_0x3eaa70[_0xb013('0x31')]=_[_0xb013('0x32')](_0x3eaa70['model'],_0x3eaa70[_0xb013('0x2f')]);_0x1144e3[_0xb013('0x33')]=_[_0xb013('0x32')](_0x3eaa70['model'],qs[_0xb013('0x34')](_0x357cdf[_0xb013('0x2f')][_0xb013('0x34')]));_0x1144e3[_0xb013('0x33')]=_0x1144e3[_0xb013('0x33')][_0xb013('0x35')]?_0x1144e3[_0xb013('0x33')]:_0x3eaa70['model'];if(!_0x357cdf['query'][_0xb013('0x36')](_0xb013('0x37'))){_0x1144e3[_0xb013('0x1a')]=qs['limit'](_0x357cdf['query'][_0xb013('0x1a')]);_0x1144e3[_0xb013('0x19')]=qs[_0xb013('0x19')](_0x357cdf[_0xb013('0x2f')][_0xb013('0x19')]);}_0x1144e3[_0xb013('0x38')]=qs['sort'](_0x357cdf[_0xb013('0x2f')][_0xb013('0x39')]);_0x1144e3['where']=qs[_0xb013('0x31')](_[_0xb013('0x3a')](_0x357cdf[_0xb013('0x2f')],_0x3eaa70[_0xb013('0x31')]),_0x930fa0);if(_0x357cdf[_0xb013('0x2f')]['filter']){_0x1144e3['where']=_[_0xb013('0x3b')](_0x1144e3[_0xb013('0x3c')],{'$or':_[_0xb013('0x2e')](_0x930fa0,function(_0x3f2599){if(_0x3f2599[_0xb013('0x2b')]!=='VIRTUAL'){var _0x1dcc31={};_0x1dcc31[_0x3f2599[_0xb013('0x27')]]={'$like':'%'+_0x357cdf[_0xb013('0x2f')][_0xb013('0x3d')]+'%'};return _0x1dcc31;}})});}_0x1144e3=_['merge']({},_0x1144e3,_0x357cdf[_0xb013('0x3e')]);var _0x3d042f={'where':_0x1144e3[_0xb013('0x3c')]};return db[_0xb013('0x3f')]['count'](_0x3d042f)[_0xb013('0x1f')](function(_0x52b535){_0x22df71['count']=_0x52b535;if(_0x357cdf['query']['includeAll']){_0x1144e3[_0xb013('0x40')]=[{'all':!![]}];}return db[_0xb013('0x3f')][_0xb013('0x41')](_0x1144e3);})[_0xb013('0x1f')](function(_0x3e2662){_0x22df71[_0xb013('0x42')]=_0x3e2662;return _0x22df71;})[_0xb013('0x1f')](respondWithFilteredResult(_0x210183,_0x1144e3))[_0xb013('0x43')](handleError(_0x210183,null));};exports[_0xb013('0x44')]=function(_0x374860,_0xde85f1){var _0x239069={'raw':![],'where':{'id':_0x374860[_0xb013('0x45')]['id']}},_0x55c4d2={};_0x55c4d2['model']=_['keys'](db[_0xb013('0x3f')][_0xb013('0x29')]);_0x55c4d2['query']=_[_0xb013('0x30')](_0x374860[_0xb013('0x2f')]);_0x55c4d2[_0xb013('0x31')]=_[_0xb013('0x32')](_0x55c4d2[_0xb013('0x2d')],_0x55c4d2['query']);_0x239069['attributes']=_[_0xb013('0x32')](_0x55c4d2['model'],qs[_0xb013('0x34')](_0x374860[_0xb013('0x2f')][_0xb013('0x34')]));_0x239069[_0xb013('0x33')]=_0x239069[_0xb013('0x33')]['length']?_0x239069[_0xb013('0x33')]:_0x55c4d2['model'];if(_0x374860['query']['includeAll']){_0x239069[_0xb013('0x40')]=[{'all':!![]}];}_0x239069=_[_0xb013('0x3b')]({},_0x239069,_0x374860[_0xb013('0x3e')]);return db[_0xb013('0x3f')]['find'](_0x239069)[_0xb013('0x1f')](handleEntityNotFound(_0xde85f1,null))['then'](respondWithResult(_0xde85f1,null))['catch'](handleError(_0xde85f1,null));};exports[_0xb013('0x46')]=function(_0x44d85e,_0x5056af){return db['VoiceChanSpy'][_0xb013('0x46')](_0x44d85e['body'],{})[_0xb013('0x1f')](function(_0x12b794){var _0x10176f=_0x44d85e[_0xb013('0x47')][_0xb013('0x21')]({'plain':!![]});if(!_0x10176f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10176f[_0xb013('0x48')]===_0xb013('0x47')){var _0x45e0a0=_0x12b794[_0xb013('0x21')]({'plain':!![]});var _0x3fe2c7=_0xb013('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x3fe2c7,'userProfileId':_0x10176f[_0xb013('0x49')]},'raw':!![]})['then'](function(_0x198bc0){if(_0x198bc0&&_0x198bc0[_0xb013('0x4a')]===0x0){return db[_0xb013('0x23')][_0xb013('0x46')]({'name':_0x45e0a0[_0xb013('0x27')],'resourceId':_0x45e0a0['id'],'type':_0x198bc0[_0xb013('0x27')],'sectionId':_0x198bc0['id']},{})[_0xb013('0x1f')](function(){return _0x12b794;});}else{return _0x12b794;}})[_0xb013('0x43')](function(_0x58f796){logger[_0xb013('0x25')](_0xb013('0x4b'),_0x58f796);throw _0x58f796;});}return _0x12b794;})[_0xb013('0x1f')](respondWithResult(_0x5056af,0xc9))[_0xb013('0x43')](handleError(_0x5056af,null));};exports[_0xb013('0x1e')]=function(_0x1c7513,_0x4f34ea){if(_0x1c7513['body']['id']){delete _0x1c7513[_0xb013('0x4c')]['id'];}return db['VoiceChanSpy'][_0xb013('0x4d')]({'where':{'id':_0x1c7513[_0xb013('0x45')]['id']}})[_0xb013('0x1f')](handleEntityNotFound(_0x4f34ea,null))['then'](saveUpdates(_0x1c7513[_0xb013('0x4c')],null))[_0xb013('0x1f')](respondWithResult(_0x4f34ea,null))[_0xb013('0x43')](handleError(_0x4f34ea,null));};exports[_0xb013('0x20')]=function(_0x4b6622,_0x458601){return db['VoiceChanSpy']['find']({'where':{'id':_0x4b6622[_0xb013('0x45')]['id']}})['then'](handleEntityNotFound(_0x458601,null))['then'](removeEntity(_0x458601,null))['catch'](handleError(_0x458601,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index ab37d08..bee6c01 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 _0x7ece=['concat','internal','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','merge','CDR(type)=%s','chanspy','record','push','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','length'];(function(_0x30750f,_0x4c5518){var _0x19c56c=function(_0x4075c5){while(--_0x4075c5){_0x30750f['push'](_0x30750f['shift']());}};_0x19c56c(++_0x4c5518);}(_0x7ece,0x1e3));var _0xe7ec=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7ece[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xe7ec('0x0'));var util=require(_0xe7ec('0x1'));var BPromise=require(_0xe7ec('0x2'));var attributes=require(_0xe7ec('0x3'));var getUserApplications=function(_0x5b9111,_0x283582,_0x50b4dc){var _0x9194cc=0x1;var _0x2180ba=[];var _0x1434a2={'context':_0x283582[_0xe7ec('0x4')]||_0xe7ec('0x5'),'exten':util[_0xe7ec('0x6')]('%s%s',_0x5b9111[_0xe7ec('0x7')],_0x50b4dc),'type':_0xe7ec('0x8'),'isApp':![],'ChanSpyId':_0x5b9111['id'],'UserId':_0x283582['id']};_0x2180ba['push'](_[_0xe7ec('0x9')]({'app':'Set','appdata':util[_0xe7ec('0x6')](_0xe7ec('0xa'),_0xe7ec('0xb')),'priority':_0x9194cc++},_0x1434a2));if(_0x5b9111[_0xe7ec('0xc')]){_0x2180ba[_0xe7ec('0xd')](_[_0xe7ec('0x9')]({'app':'MixMonitor','appdata':util['format']('${UNIQUEID}.%s,a',_0x5b9111[_0xe7ec('0xe')]),'priority':_0x9194cc++},_0x1434a2));}if(_0x5b9111[_0xe7ec('0xf')]){_0x2180ba[_0xe7ec('0xd')](_[_0xe7ec('0x9')]({'app':_0xe7ec('0x10'),'appdata':_0x5b9111[_0xe7ec('0x11')],'priority':_0x9194cc++},_0x1434a2));}_0x2180ba[_0xe7ec('0xd')](_[_0xe7ec('0x9')]({'app':'ChanSpy','appdata':util[_0xe7ec('0x6')](_0xe7ec('0x12'),_0x283582[_0xe7ec('0x13')],_0x5b9111[_0xe7ec('0x14')]?_0x5b9111[_0xe7ec('0x14')][_0xe7ec('0x15')](''):''),'priority':_0x9194cc++},_0x1434a2));if(_0x5b9111[_0xe7ec('0xc')]){_0x2180ba['push'](_[_0xe7ec('0x9')]({'app':_0xe7ec('0x16'),'priority':_0x9194cc++},_0x1434a2));}return _0x2180ba;};var getChanSpyApplications=function(_0x12bd5e,_0x5178de){var _0x5bdd19=[];for(var _0x1f79b7=0x0,_0x25dad5=0x1;_0x1f79b7<_0x5178de[_0xe7ec('0x17')];_0x1f79b7++,_0x25dad5=0x1){_0x5bdd19=_0x5bdd19[_0xe7ec('0x18')](getUserApplications(_0x12bd5e,_0x5178de[_0x1f79b7],_0x5178de[_0x1f79b7][_0xe7ec('0x19')]));if(_0x5178de[_0x1f79b7][_0xe7ec('0x19')]!=_0x5178de[_0x1f79b7][_0xe7ec('0x13')]){_0x5bdd19=_0x5bdd19['concat'](getUserApplications(_0x12bd5e,_0x5178de[_0x1f79b7],_0x5178de[_0x1f79b7]['name']));}}return _0x5bdd19;};var getChanSpyPromise=function(_0x77c267,_0x490e83){return new BPromise(function(_0xb61f2d,_0x494b46){return _0x77c267[_0xe7ec('0x1a')][_0xe7ec('0x1b')]({'attributes':['id',_0xe7ec('0x13'),_0xe7ec('0x19')],'where':{'role':_0xe7ec('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x4c974e){if(_0x4c974e){return _0xb61f2d(getChanSpyApplications(_0x490e83,_0x4c974e));}return _0xb61f2d([]);})[_0xe7ec('0x1d')](function(_0x479171){_0x494b46(_0x479171);});});};module[_0xe7ec('0x1e')]=function(_0x349717,_0x1285ec){var _0x5349bd=_0x349717[_0xe7ec('0x1f')];return _0x349717[_0xe7ec('0x20')](_0xe7ec('0x21'),attributes,{'tableName':_0xe7ec('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xcd2f3e,_0x169f07,_0x4c63be){return getChanSpyPromise(_0x5349bd,_0xcd2f3e)[_0xe7ec('0x23')](function(_0x296763){if(_0x296763&&_0x296763[_0xe7ec('0x17')]){return _0x5349bd['VoiceExtension']['bulkCreate'](_0x296763);}})[_0xe7ec('0x23')](function(){_0x4c63be();})[_0xe7ec('0x1d')](function(_0x47f286){_0x4c63be(_0x47f286);});},'afterUpdate':function(_0x3abcdb,_0x566f2b,_0x43d705){return _0x5349bd[_0xe7ec('0x24')][_0xe7ec('0x25')]({'where':{'ChanSpyId':_0x3abcdb['id']}})[_0xe7ec('0x23')](function(){return getChanSpyPromise(_0x5349bd,_0x3abcdb);})[_0xe7ec('0x23')](function(_0x95c73e){if(_0x95c73e&&_0x95c73e['length']){return _0x5349bd[_0xe7ec('0x24')][_0xe7ec('0x26')](_0x95c73e);}})[_0xe7ec('0x23')](function(){_0x43d705();})[_0xe7ec('0x1d')](function(_0x17591){_0x43d705(_0x17591);});},'afterDestroy':function(_0x51b7cb,_0x337aab,_0x5e6e51){return _0x5349bd['VoiceExtension'][_0xe7ec('0x25')]({'where':{'ChanSpyId':_0x51b7cb['id']}})['then'](function(){_0x5e6e51();})[_0xe7ec('0x1d')](function(_0x20823e){_0x5e6e51(_0x20823e);});}}});}; \ No newline at end of file +var _0xf681=['CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','agent','catch','exports','models','define','VoiceChanSpy','then','VoiceExtension','destroy','bulkCreate','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','push','merge','Set'];(function(_0x3da7f2,_0x31e9ae){var _0x2f7d13=function(_0x5c4a7c){while(--_0x5c4a7c){_0x3da7f2['push'](_0x3da7f2['shift']());}};_0x2f7d13(++_0x31e9ae);}(_0xf681,0xc9));var _0x1f68=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf681[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x1f68('0x0'));var BPromise=require(_0x1f68('0x1'));var attributes=require(_0x1f68('0x2'));var getUserApplications=function(_0x2cb4fb,_0x56d4f7,_0x3f265a){var _0x4b0db4=0x1;var _0x8bf4eb=[];var _0xdea373={'context':_0x56d4f7['context']||_0x1f68('0x3'),'exten':util[_0x1f68('0x4')](_0x1f68('0x5'),_0x2cb4fb['prefix'],_0x3f265a),'type':'system','isApp':![],'ChanSpyId':_0x2cb4fb['id'],'UserId':_0x56d4f7['id']};_0x8bf4eb[_0x1f68('0x6')](_[_0x1f68('0x7')]({'app':_0x1f68('0x8'),'appdata':util['format'](_0x1f68('0x9'),_0x1f68('0xa')),'priority':_0x4b0db4++},_0xdea373));if(_0x2cb4fb[_0x1f68('0xb')]){_0x8bf4eb[_0x1f68('0x6')](_[_0x1f68('0x7')]({'app':_0x1f68('0xc'),'appdata':util[_0x1f68('0x4')](_0x1f68('0xd'),_0x2cb4fb['recordingFormat']),'priority':_0x4b0db4++},_0xdea373));}if(_0x2cb4fb[_0x1f68('0xe')]){_0x8bf4eb[_0x1f68('0x6')](_[_0x1f68('0x7')]({'app':_0x1f68('0xf'),'appdata':_0x2cb4fb[_0x1f68('0x10')],'priority':_0x4b0db4++},_0xdea373));}_0x8bf4eb['push'](_[_0x1f68('0x7')]({'app':_0x1f68('0x11'),'appdata':util[_0x1f68('0x4')](_0x1f68('0x12'),_0x56d4f7[_0x1f68('0x13')],_0x2cb4fb[_0x1f68('0x14')]?_0x2cb4fb[_0x1f68('0x14')][_0x1f68('0x15')](''):''),'priority':_0x4b0db4++},_0xdea373));if(_0x2cb4fb[_0x1f68('0xb')]){_0x8bf4eb[_0x1f68('0x6')](_['merge']({'app':'StopMixMonitor','priority':_0x4b0db4++},_0xdea373));}return _0x8bf4eb;};var getChanSpyApplications=function(_0x1c8ba1,_0x30a60e){var _0x65c1f7=[];for(var _0x708c7c=0x0,_0x2a0b61=0x1;_0x708c7c<_0x30a60e[_0x1f68('0x16')];_0x708c7c++,_0x2a0b61=0x1){_0x65c1f7=_0x65c1f7[_0x1f68('0x17')](getUserApplications(_0x1c8ba1,_0x30a60e[_0x708c7c],_0x30a60e[_0x708c7c]['internal']));if(_0x30a60e[_0x708c7c]['internal']!=_0x30a60e[_0x708c7c][_0x1f68('0x13')]){_0x65c1f7=_0x65c1f7[_0x1f68('0x17')](getUserApplications(_0x1c8ba1,_0x30a60e[_0x708c7c],_0x30a60e[_0x708c7c]['name']));}}return _0x65c1f7;};var getChanSpyPromise=function(_0x5ecac4,_0x5e3979){return new BPromise(function(_0x597731,_0x24d5e8){return _0x5ecac4['User']['findAll']({'attributes':['id',_0x1f68('0x13'),_0x1f68('0x18')],'where':{'role':_0x1f68('0x19'),'chanspy':!![]},'raw':!![]})['then'](function(_0x35b8ea){if(_0x35b8ea){return _0x597731(getChanSpyApplications(_0x5e3979,_0x35b8ea));}return _0x597731([]);})[_0x1f68('0x1a')](function(_0x94d000){_0x24d5e8(_0x94d000);});});};module[_0x1f68('0x1b')]=function(_0x16d895,_0x182a35){var _0x5d888d=_0x16d895[_0x1f68('0x1c')];return _0x16d895[_0x1f68('0x1d')](_0x1f68('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x31dba6,_0x5e9c12,_0x59b461){return getChanSpyPromise(_0x5d888d,_0x31dba6)[_0x1f68('0x1f')](function(_0xdb5be5){if(_0xdb5be5&&_0xdb5be5['length']){return _0x5d888d[_0x1f68('0x20')]['bulkCreate'](_0xdb5be5);}})[_0x1f68('0x1f')](function(){_0x59b461();})['catch'](function(_0x57bf30){_0x59b461(_0x57bf30);});},'afterUpdate':function(_0x13cdce,_0xde6430,_0x2ce93f){return _0x5d888d[_0x1f68('0x20')][_0x1f68('0x21')]({'where':{'ChanSpyId':_0x13cdce['id']}})['then'](function(){return getChanSpyPromise(_0x5d888d,_0x13cdce);})[_0x1f68('0x1f')](function(_0x2b5e22){if(_0x2b5e22&&_0x2b5e22[_0x1f68('0x16')]){return _0x5d888d[_0x1f68('0x20')][_0x1f68('0x22')](_0x2b5e22);}})['then'](function(){_0x2ce93f();})['catch'](function(_0x37534f){_0x2ce93f(_0x37534f);});},'afterDestroy':function(_0x403109,_0x3ad261,_0x4ad1f3){return _0x5d888d[_0x1f68('0x20')][_0x1f68('0x21')]({'where':{'ChanSpyId':_0x403109['id']}})[_0x1f68('0x1f')](function(){_0x4ad1f3();})[_0x1f68('0x1a')](function(_0x18f895){_0x4ad1f3(_0x18f895);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index addabe6..1fab20a 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 _0x1277=['request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x1277,0x125));var _0x7127=function(_0x40827f,_0x415800){_0x40827f=_0x40827f-0x0;var _0x109173=_0x1277[_0x40827f];return _0x109173;};'use strict';var _=require(_0x7127('0x0'));var util=require('util');var moment=require(_0x7127('0x1'));var BPromise=require(_0x7127('0x2'));var rs=require(_0x7127('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7127('0x4'));var logger=require(_0x7127('0x5'))(_0x7127('0x6'));var config=require(_0x7127('0x7'));var jayson=require(_0x7127('0x8'));var client=jayson[_0x7127('0x9')][_0x7127('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bf7b5,_0x1b5dc9,_0x343f1a){return new BPromise(function(_0x24dcb4,_0x3250d7){return client[_0x7127('0xb')](_0x4bf7b5,_0x343f1a)[_0x7127('0xc')](function(_0x864f50){logger[_0x7127('0xd')](_0x7127('0xe'),_0x1b5dc9,_0x7127('0xf'));logger[_0x7127('0x10')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1b5dc9,_0x7127('0xf'),JSON[_0x7127('0x11')](_0x864f50));if(_0x864f50['error']){if(_0x864f50['error']['code']===0x1f4){logger[_0x7127('0x12')](_0x7127('0xe'),_0x1b5dc9,_0x864f50['error'][_0x7127('0x13')]);return _0x3250d7(_0x864f50[_0x7127('0x12')][_0x7127('0x13')]);}logger[_0x7127('0x12')](_0x7127('0xe'),_0x1b5dc9,_0x864f50[_0x7127('0x12')][_0x7127('0x13')]);return _0x24dcb4(_0x864f50[_0x7127('0x12')][_0x7127('0x13')]);}else{logger[_0x7127('0xd')](_0x7127('0xe'),_0x1b5dc9,_0x7127('0xf'));_0x24dcb4(_0x864f50[_0x7127('0x14')][_0x7127('0x13')]);}})[_0x7127('0x15')](function(_0x18f1aa){logger[_0x7127('0x12')](_0x7127('0xe'),_0x1b5dc9,_0x18f1aa);_0x3250d7(_0x18f1aa);});});} \ No newline at end of file +var _0x2be2=['stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x2be2,0x65));var _0x22be=function(_0x52ea49,_0x2dcda9){_0x52ea49=_0x52ea49-0x0;var _0x56b4fb=_0x2be2[_0x52ea49];return _0x56b4fb;};'use strict';var _=require(_0x22be('0x0'));var util=require(_0x22be('0x1'));var moment=require(_0x22be('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22be('0x3'));var db=require(_0x22be('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x22be('0x5'));var config=require('../../config/environment');var jayson=require(_0x22be('0x6'));var client=jayson[_0x22be('0x7')][_0x22be('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bab95,_0x521dc0,_0xea4dbe){return new BPromise(function(_0x4b7602,_0x39dbea){return client[_0x22be('0x9')](_0x1bab95,_0xea4dbe)[_0x22be('0xa')](function(_0x35a50b){logger['info'](_0x22be('0xb'),_0x521dc0,'request\x20sent');logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x521dc0,_0x22be('0xc'),JSON[_0x22be('0xd')](_0x35a50b));if(_0x35a50b['error']){if(_0x35a50b[_0x22be('0xe')][_0x22be('0xf')]===0x1f4){logger[_0x22be('0xe')](_0x22be('0xb'),_0x521dc0,_0x35a50b['error'][_0x22be('0x10')]);return _0x39dbea(_0x35a50b[_0x22be('0xe')][_0x22be('0x10')]);}logger['error'](_0x22be('0xb'),_0x521dc0,_0x35a50b[_0x22be('0xe')][_0x22be('0x10')]);return _0x4b7602(_0x35a50b[_0x22be('0xe')][_0x22be('0x10')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x521dc0,_0x22be('0xc'));_0x4b7602(_0x35a50b[_0x22be('0x11')][_0x22be('0x10')]);}})[_0x22be('0x12')](function(_0x2c3cfe){logger['error'](_0x22be('0xb'),_0x521dc0,_0x2c3cfe);_0x39dbea(_0x2c3cfe);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 2438eb8..b540bde 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 _0xced1=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','get','/:id','show','post','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x45c253,_0x354552){var _0x7fb9c5=function(_0x53631c){while(--_0x53631c){_0x45c253['push'](_0x45c253['shift']());}};_0x7fb9c5(++_0x354552);}(_0xced1,0xb0));var _0x1ced=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xced1[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x1ced('0x0'));var util=require(_0x1ced('0x1'));var path=require(_0x1ced('0x2'));var timeout=require(_0x1ced('0x3'));var express=require(_0x1ced('0x4'));var router=express[_0x1ced('0x5')]();var auth=require(_0x1ced('0x6'));var interaction=require(_0x1ced('0x7'));var config=require(_0x1ced('0x8'));var controller=require(_0x1ced('0x9'));router['get']('/',auth[_0x1ced('0xa')](),controller['index']);router[_0x1ced('0xb')](_0x1ced('0xc'),auth['isAuthenticated'](),controller[_0x1ced('0xd')]);router[_0x1ced('0xe')]('/',auth[_0x1ced('0xa')](),controller['create']);router['put'](_0x1ced('0xc'),auth[_0x1ced('0xa')](),controller[_0x1ced('0xf')]);router['delete'](_0x1ced('0xc'),auth[_0x1ced('0xa')](),controller[_0x1ced('0x10')]);module[_0x1ced('0x11')]=router; \ No newline at end of file +var _0x2cce=['put','delete','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x2cce,0x19a));var _0xe2cc=function(_0xb4d24a,_0x57953e){_0xb4d24a=_0xb4d24a-0x0;var _0x1e65b5=_0x2cce[_0xb4d24a];return _0x1e65b5;};'use strict';var multer=require(_0xe2cc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe2cc('0x1'));var express=require(_0xe2cc('0x2'));var router=express[_0xe2cc('0x3')]();var auth=require(_0xe2cc('0x4'));var interaction=require(_0xe2cc('0x5'));var config=require(_0xe2cc('0x6'));var controller=require(_0xe2cc('0x7'));router['get']('/',auth[_0xe2cc('0x8')](),controller[_0xe2cc('0x9')]);router[_0xe2cc('0xa')](_0xe2cc('0xb'),auth['isAuthenticated'](),controller[_0xe2cc('0xc')]);router[_0xe2cc('0xd')]('/',auth[_0xe2cc('0x8')](),controller[_0xe2cc('0xe')]);router[_0xe2cc('0xf')]('/:id',auth[_0xe2cc('0x8')](),controller['update']);router[_0xe2cc('0x10')]('/:id',auth[_0xe2cc('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 1b41087..2153d61 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 _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x16f565,_0xdcb691){var _0xcd6cc1=function(_0x45b294){while(--_0x45b294){_0x16f565['push'](_0x16f565['shift']());}};_0xcd6cc1(++_0xdcb691);}(_0xe14b,0x93));var _0xbe14=function(_0xa79b23,_0x30e2cc){_0xa79b23=_0xa79b23-0x0;var _0x277865=_0xe14b[_0xa79b23];return _0x277865;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x3e74,0x175));var _0x43e7=function(_0x5ce0bb,_0x95fdd3){_0x5ce0bb=_0x5ce0bb-0x0;var _0xfca9d7=_0x3e74[_0x5ce0bb];return _0xfca9d7;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index dd47403..c477ae1 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 _0x34e8=['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','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','Contexts','sendStatus','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','VoiceContext','includeAll','include','findAll','rows','show','length','create','body','join','root','utf8','render','writeFileSync','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client'];(function(_0x2192ee,_0x13521d){var _0x5b944a=function(_0x34962f){while(--_0x34962f){_0x2192ee['push'](_0x2192ee['shift']());}};_0x5b944a(++_0x13521d);}(_0x34e8,0x12c));var _0x834e=function(_0x52c701,_0x1b22f0){_0x52c701=_0x52c701-0x0;var _0x433f9e=_0x34e8[_0x52c701];return _0x433f9e;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x834e('0x1d')][_0x834e('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x58a27e,_0x23848e,_0x2d95f2){if(_0x2d95f2){var _0x28e659=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x28e659[_0x834e('0x1f')](_0x23848e)){return _0x58a27e;}else{throw new db['Sequelize'][(_0x834e('0x20'))](_0x834e('0x21'));}}else{return _0x58a27e;}}function respondWithRpcPromise(_0x57274a,_0x316205,_0x4a9cdc,_0x38a8cd){return new BPromise(function(_0x36d443,_0x478afe){var _0x43ac41=_0x38a8cd||client;return _0x43ac41[_0x834e('0x22')](_0x57274a,_0x4a9cdc)[_0x834e('0x23')](function(_0x50b3f6){logger[_0x834e('0x24')](_0x834e('0x25'),_0x316205,_0x834e('0x26'));logger[_0x834e('0x27')](_0x834e('0x28'),_0x316205,_0x834e('0x26'),JSON[_0x834e('0x29')](_0x50b3f6));if(_0x50b3f6['error']){if(_0x50b3f6[_0x834e('0x2a')][_0x834e('0x2b')]===0x1f4){logger[_0x834e('0x2a')](_0x834e('0x25'),_0x316205,_0x50b3f6['error'][_0x834e('0x2c')]);return _0x478afe(_0x50b3f6[_0x834e('0x2a')]['message']);}logger[_0x834e('0x2a')](_0x834e('0x25'),_0x316205,_0x50b3f6[_0x834e('0x2a')]['message']);return _0x36d443(_0x50b3f6['error'][_0x834e('0x2c')]);}else{logger[_0x834e('0x24')]('VoiceContext,\x20%s,\x20%s',_0x316205,_0x834e('0x26'));_0x36d443(_0x50b3f6[_0x834e('0x2d')]['message']);}})[_0x834e('0x2e')](function(_0x2e1983){logger[_0x834e('0x2a')]('VoiceContext,\x20%s,\x20%s',_0x316205,_0x2e1983);_0x478afe(_0x2e1983);});});}function respondWithStatusCode(_0x24fcf7,_0x3e310f){_0x3e310f=_0x3e310f||0xcc;return function(_0x5e1cc5){if(_0x5e1cc5){return _0x24fcf7['sendStatus'](_0x3e310f);}return _0x24fcf7[_0x834e('0x2f')](_0x3e310f)['end']();};}function respondWithResult(_0x2826ec,_0x3f1b0b){_0x3f1b0b=_0x3f1b0b||0xc8;return function(_0x3db026){if(_0x3db026){return _0x2826ec[_0x834e('0x2f')](_0x3f1b0b)[_0x834e('0x30')](_0x3db026);}};}function respondWithFilteredResult(_0x130cc5,_0x491919){return function(_0x510780){if(_0x510780){var _0x4dc64a=_0x510780[_0x834e('0x31')],_0x58c1d7=_0x491919['offset'],_0x2c7a8d=_0x491919[_0x834e('0x32')]+_0x491919[_0x834e('0x33')],_0x567cea;if(_0x2c7a8d>=_0x4dc64a){_0x2c7a8d=_0x4dc64a;_0x567cea=0xc8;}else{_0x567cea=0xce;}_0x130cc5[_0x834e('0x2f')](_0x567cea);return _0x130cc5[_0x834e('0x34')](_0x834e('0x35'),_0x58c1d7+'-'+_0x2c7a8d+'/'+_0x4dc64a)[_0x834e('0x30')](_0x510780);}return null;};}function patchUpdates(_0x3d149d){return function(_0xfaf716){try{jsonpatch[_0x834e('0x36')](_0xfaf716,_0x3d149d,!![]);}catch(_0x493289){return BPromise[_0x834e('0x37')](_0x493289);}return _0xfaf716['save']();};}function saveUpdates(_0x2c75c2,_0x3787b0){return function(_0x9ab921){if(_0x9ab921){return _0x9ab921[_0x834e('0x38')](_0x2c75c2)[_0x834e('0x23')](function(_0x4689c2){return _0x4689c2;});}return null;};}function removeEntity(_0x4696a1,_0x38cd29){return function(_0x358c31){if(_0x358c31){return _0x358c31[_0x834e('0x39')]()['then'](function(){var _0x2a3c7f=_0x358c31[_0x834e('0x3a')]({'plain':!![]});var _0x24a9df=_0x834e('0x3b');return db['UserProfileResource'][_0x834e('0x39')]({'where':{'type':_0x24a9df,'resourceId':_0x2a3c7f['id']}})[_0x834e('0x23')](function(){return _0x358c31;});})['then'](function(){_0x4696a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e58fa,_0x41bf4d){return function(_0x20c6ae){if(!_0x20c6ae){_0x3e58fa[_0x834e('0x3c')](0x194);}return _0x20c6ae;};}function handleError(_0x339e28,_0x1b76dd){_0x1b76dd=_0x1b76dd||0x1f4;return function(_0x4c2ef6){logger[_0x834e('0x2a')](_0x4c2ef6['stack']);if(_0x4c2ef6[_0x834e('0x3d')]){delete _0x4c2ef6[_0x834e('0x3d')];}_0x339e28['status'](_0x1b76dd)[_0x834e('0x3e')](_0x4c2ef6);};}exports[_0x834e('0x3f')]=function(_0x491c28,_0x481f70){var _0x388711={},_0xd0d43a={},_0x2e9383={'count':0x0,'rows':[]};var _0x130c23=_[_0x834e('0x40')](db['VoiceContext'][_0x834e('0x41')],function(_0x548d1d){return{'name':_0x548d1d['fieldName'],'type':_0x548d1d[_0x834e('0x42')]['key']};});_0xd0d43a[_0x834e('0x43')]=_[_0x834e('0x40')](_0x130c23,_0x834e('0x3d'));_0xd0d43a[_0x834e('0x44')]=_[_0x834e('0x45')](_0x491c28['query']);_0xd0d43a[_0x834e('0x46')]=_[_0x834e('0x47')](_0xd0d43a[_0x834e('0x43')],_0xd0d43a['query']);_0x388711[_0x834e('0x48')]=_[_0x834e('0x47')](_0xd0d43a['model'],qs[_0x834e('0x49')](_0x491c28['query'][_0x834e('0x49')]));_0x388711[_0x834e('0x48')]=_0x388711['attributes']['length']?_0x388711[_0x834e('0x48')]:_0xd0d43a[_0x834e('0x43')];if(!_0x491c28[_0x834e('0x44')][_0x834e('0x4a')](_0x834e('0x4b'))){_0x388711[_0x834e('0x33')]=qs[_0x834e('0x33')](_0x491c28['query'][_0x834e('0x33')]);_0x388711['offset']=qs[_0x834e('0x32')](_0x491c28['query'][_0x834e('0x32')]);}_0x388711['order']=qs[_0x834e('0x4c')](_0x491c28[_0x834e('0x44')]['sort']);_0x388711[_0x834e('0x4d')]=qs[_0x834e('0x46')](_[_0x834e('0x4e')](_0x491c28[_0x834e('0x44')],_0xd0d43a[_0x834e('0x46')]),_0x130c23);if(_0x491c28[_0x834e('0x44')][_0x834e('0x4f')]){_0x388711[_0x834e('0x4d')]=_[_0x834e('0x50')](_0x388711[_0x834e('0x4d')],{'$or':_['map'](_0x130c23,function(_0x3124be){if(_0x3124be[_0x834e('0x42')]!=='VIRTUAL'){var _0x112306={};_0x112306[_0x3124be[_0x834e('0x3d')]]={'$like':'%'+_0x491c28[_0x834e('0x44')][_0x834e('0x4f')]+'%'};return _0x112306;}})});}_0x388711=_[_0x834e('0x50')]({},_0x388711,_0x491c28[_0x834e('0x51')]);var _0x4eab06={'where':_0x388711['where']};return db[_0x834e('0x52')][_0x834e('0x31')](_0x4eab06)[_0x834e('0x23')](function(_0x40ff5a){_0x2e9383[_0x834e('0x31')]=_0x40ff5a;if(_0x491c28[_0x834e('0x44')][_0x834e('0x53')]){_0x388711[_0x834e('0x54')]=[{'all':!![]}];}return db[_0x834e('0x52')][_0x834e('0x55')](_0x388711);})[_0x834e('0x23')](function(_0x385435){_0x2e9383[_0x834e('0x56')]=_0x385435;return _0x2e9383;})[_0x834e('0x23')](respondWithFilteredResult(_0x481f70,_0x388711))[_0x834e('0x2e')](handleError(_0x481f70,null));};exports[_0x834e('0x57')]=function(_0x3df078,_0x32b8f7){var _0x420841={'raw':![],'where':{'id':_0x3df078['params']['id']}},_0x1adf86={};_0x1adf86[_0x834e('0x43')]=_[_0x834e('0x45')](db['VoiceContext'][_0x834e('0x41')]);_0x1adf86[_0x834e('0x44')]=_['keys'](_0x3df078[_0x834e('0x44')]);_0x1adf86[_0x834e('0x46')]=_[_0x834e('0x47')](_0x1adf86[_0x834e('0x43')],_0x1adf86[_0x834e('0x44')]);_0x420841[_0x834e('0x48')]=_[_0x834e('0x47')](_0x1adf86['model'],qs[_0x834e('0x49')](_0x3df078[_0x834e('0x44')][_0x834e('0x49')]));_0x420841[_0x834e('0x48')]=_0x420841[_0x834e('0x48')][_0x834e('0x58')]?_0x420841[_0x834e('0x48')]:_0x1adf86[_0x834e('0x43')];if(_0x3df078['query'][_0x834e('0x53')]){_0x420841['include']=[{'all':!![]}];}_0x420841=_[_0x834e('0x50')]({},_0x420841,_0x3df078['options']);return db[_0x834e('0x52')]['find'](_0x420841)['then'](handleEntityNotFound(_0x32b8f7,null))[_0x834e('0x23')](respondWithResult(_0x32b8f7,null))[_0x834e('0x2e')](handleError(_0x32b8f7,null));};exports['create']=function(_0x5be43d,_0x2c8155,_0x2452b4){var _0x138ed2;return db[_0x834e('0x52')][_0x834e('0x59')](_0x5be43d[_0x834e('0x5a')],{'raw':!![]})[_0x834e('0x23')](function(_0x4273f1){_0x138ed2=_0x4273f1;return db['VoiceContext'][_0x834e('0x55')]({'raw':!![]});})[_0x834e('0x23')](function(_0x5d5ac2){var _0x281342=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],'server/files/templates/context.ejs'),_0x834e('0x5d'));var _0x37ee0e=ejs[_0x834e('0x5e')](_0x281342,{'contexts':_0x5d5ac2||[]});fs[_0x834e('0x5f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x37ee0e);})[_0x834e('0x23')](function(){return respondWithRpcPromise(_0x834e('0x60'),_0x834e('0x59'),{'module':'chan_sip.so'});})[_0x834e('0x23')](function(){var _0x1fcae9=_0x5be43d[_0x834e('0x61')][_0x834e('0x3a')]({'plain':!![]});if(!_0x1fcae9)throw new Error(_0x834e('0x62'));if(_0x1fcae9[_0x834e('0x63')]===_0x834e('0x61')){var _0x1def00=_0x138ed2[_0x834e('0x3a')]({'plain':!![]});return db[_0x834e('0x64')][_0x834e('0x65')]({'where':{'name':_0x834e('0x3b'),'userProfileId':_0x1fcae9[_0x834e('0x66')]},'raw':!![]})[_0x834e('0x23')](function(_0x460a7a){if(_0x460a7a&&_0x460a7a[_0x834e('0x67')]===0x0){return db[_0x834e('0x68')][_0x834e('0x59')]({'name':_0x1def00[_0x834e('0x3d')],'resourceId':_0x1def00['id'],'type':_0x460a7a[_0x834e('0x3d')],'sectionId':_0x460a7a['id']},{})[_0x834e('0x23')](function(){return _0x138ed2;});}else{return _0x138ed2;}})[_0x834e('0x2e')](function(_0x5c83eb){logger[_0x834e('0x2a')](_0x834e('0x69'),_0x5c83eb);throw _0x5c83eb;});}return _0x138ed2;})[_0x834e('0x23')](respondWithResult(_0x2c8155,0xc9))[_0x834e('0x2e')](handleError(_0x2c8155,null));};exports['update']=function(_0x30faa8,_0x5a9c70,_0x56a152){var _0x2fdb1b;return db[_0x834e('0x52')][_0x834e('0x65')]({'where':{'id':_0x30faa8[_0x834e('0x6a')]['id']}})[_0x834e('0x23')](handleEntityNotFound(_0x5a9c70,null))[_0x834e('0x23')](saveUpdates(_0x30faa8[_0x834e('0x5a')],null))[_0x834e('0x23')](function(_0x525ed3){if(_0x525ed3){_0x2fdb1b=_0x525ed3;return db[_0x834e('0x52')]['findAll']({'raw':!![]});}})[_0x834e('0x23')](function(_0xd35dda){var _0x514fe5=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],_0x834e('0x6b')),_0x834e('0x5d'));var _0x2c41bd=ejs['render'](_0x514fe5,{'contexts':_0xd35dda||[]});fs[_0x834e('0x5f')](_0x834e('0x6c'),_0x2c41bd);})[_0x834e('0x23')](function(){return respondWithRpcPromise(_0x834e('0x60'),_0x834e('0x38'),{'module':_0x834e('0x6d')});})[_0x834e('0x23')](function(){return _0x2fdb1b;})[_0x834e('0x23')](respondWithResult(_0x5a9c70,null))[_0x834e('0x2e')](handleError(_0x5a9c70,null));};exports[_0x834e('0x39')]=function(_0x5b2bf6,_0x1b158b,_0x2e4d80){var _0x42fc96;return db[_0x834e('0x52')]['find']({'where':{'id':_0x5b2bf6[_0x834e('0x6a')]['id']}})['then'](handleEntityNotFound(_0x1b158b,null))['then'](removeEntity(_0x1b158b,null))['then'](function(){return db[_0x834e('0x52')][_0x834e('0x55')]({'raw':!![]});})['then'](function(_0x2645df){var _0x1b200d=fs['readFileSync'](path[_0x834e('0x5b')](config[_0x834e('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x346be5=ejs[_0x834e('0x5e')](_0x1b200d,{'contexts':_0x2645df});fs[_0x834e('0x5f')](_0x834e('0x6c'),_0x346be5);return respondWithRpcPromise(_0x834e('0x60'),'destroy',{'module':_0x834e('0x6d')});})['catch'](handleError(_0x1b158b,null));}; \ No newline at end of file +var _0x9957=['attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','server/files/templates/context.ejs','utf8','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('VoiceContext,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){var _0x577412=_0x33e24e[_0x7995('0x36')]({'plain':!![]});var _0x3acfc3='Contexts';return db[_0x7995('0x37')]['destroy']({'where':{'type':_0x3acfc3,'resourceId':_0x577412['id']}})[_0x7995('0x20')](function(){return _0x33e24e;});})[_0x7995('0x20')](function(){_0x510841[_0x7995('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d76d,_0x36d057){return function(_0x5e67fe){if(!_0x5e67fe){_0x52d76d['sendStatus'](0x194);}return _0x5e67fe;};}function handleError(_0x3e99cd,_0xe328b1){_0xe328b1=_0xe328b1||0x1f4;return function(_0x5212ff){logger[_0x7995('0x27')](_0x5212ff[_0x7995('0x38')]);if(_0x5212ff[_0x7995('0x39')]){delete _0x5212ff[_0x7995('0x39')];}_0x3e99cd[_0x7995('0x2c')](_0xe328b1)['send'](_0x5212ff);};}exports[_0x7995('0x3a')]=function(_0x242713,_0xf612e6){var _0x1d60b8={},_0x4b1541={},_0x2be2c0={'count':0x0,'rows':[]};var _0x235df7=_[_0x7995('0x3b')](db[_0x7995('0x3c')][_0x7995('0x3d')],function(_0x1035dc){return{'name':_0x1035dc['fieldName'],'type':_0x1035dc[_0x7995('0x3e')][_0x7995('0x3f')]};});_0x4b1541[_0x7995('0x40')]=_[_0x7995('0x3b')](_0x235df7,_0x7995('0x39'));_0x4b1541[_0x7995('0x41')]=_[_0x7995('0x42')](_0x242713[_0x7995('0x41')]);_0x4b1541[_0x7995('0x43')]=_[_0x7995('0x44')](_0x4b1541[_0x7995('0x40')],_0x4b1541[_0x7995('0x41')]);_0x1d60b8[_0x7995('0x45')]=_['intersection'](_0x4b1541['model'],qs[_0x7995('0x46')](_0x242713[_0x7995('0x41')]['fields']));_0x1d60b8['attributes']=_0x1d60b8[_0x7995('0x45')]['length']?_0x1d60b8['attributes']:_0x4b1541[_0x7995('0x40')];if(!_0x242713[_0x7995('0x41')][_0x7995('0x47')]('nolimit')){_0x1d60b8[_0x7995('0x48')]=qs['limit'](_0x242713[_0x7995('0x41')]['limit']);_0x1d60b8['offset']=qs[_0x7995('0x30')](_0x242713[_0x7995('0x41')][_0x7995('0x30')]);}_0x1d60b8[_0x7995('0x49')]=qs['sort'](_0x242713[_0x7995('0x41')][_0x7995('0x4a')]);_0x1d60b8[_0x7995('0x4b')]=qs[_0x7995('0x43')](_['pick'](_0x242713['query'],_0x4b1541[_0x7995('0x43')]),_0x235df7);if(_0x242713['query'][_0x7995('0x4c')]){_0x1d60b8['where']=_[_0x7995('0x4d')](_0x1d60b8['where'],{'$or':_[_0x7995('0x3b')](_0x235df7,function(_0x1b0373){if(_0x1b0373['type']!==_0x7995('0x4e')){var _0x336ff2={};_0x336ff2[_0x1b0373[_0x7995('0x39')]]={'$like':'%'+_0x242713[_0x7995('0x41')]['filter']+'%'};return _0x336ff2;}})});}_0x1d60b8=_[_0x7995('0x4d')]({},_0x1d60b8,_0x242713[_0x7995('0x4f')]);var _0x237270={'where':_0x1d60b8['where']};return db[_0x7995('0x3c')][_0x7995('0x2f')](_0x237270)[_0x7995('0x20')](function(_0x3d8ae3){_0x2be2c0[_0x7995('0x2f')]=_0x3d8ae3;if(_0x242713['query'][_0x7995('0x50')]){_0x1d60b8[_0x7995('0x51')]=[{'all':!![]}];}return db['VoiceContext'][_0x7995('0x52')](_0x1d60b8);})['then'](function(_0x1d87f9){_0x2be2c0[_0x7995('0x53')]=_0x1d87f9;return _0x2be2c0;})[_0x7995('0x20')](respondWithFilteredResult(_0xf612e6,_0x1d60b8))[_0x7995('0x2a')](handleError(_0xf612e6,null));};exports[_0x7995('0x54')]=function(_0x14b537,_0x1579b9){var _0x4d46bc={'raw':![],'where':{'id':_0x14b537[_0x7995('0x55')]['id']}},_0x427dcf={};_0x427dcf[_0x7995('0x40')]=_['keys'](db[_0x7995('0x3c')][_0x7995('0x3d')]);_0x427dcf[_0x7995('0x41')]=_['keys'](_0x14b537['query']);_0x427dcf['filters']=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],_0x427dcf['query']);_0x4d46bc[_0x7995('0x45')]=_[_0x7995('0x44')](_0x427dcf[_0x7995('0x40')],qs[_0x7995('0x46')](_0x14b537[_0x7995('0x41')]['fields']));_0x4d46bc[_0x7995('0x45')]=_0x4d46bc['attributes'][_0x7995('0x56')]?_0x4d46bc[_0x7995('0x45')]:_0x427dcf[_0x7995('0x40')];if(_0x14b537['query']['includeAll']){_0x4d46bc['include']=[{'all':!![]}];}_0x4d46bc=_['merge']({},_0x4d46bc,_0x14b537[_0x7995('0x4f')]);return db[_0x7995('0x3c')][_0x7995('0x57')](_0x4d46bc)[_0x7995('0x20')](handleEntityNotFound(_0x1579b9,null))[_0x7995('0x20')](respondWithResult(_0x1579b9,null))[_0x7995('0x2a')](handleError(_0x1579b9,null));};exports[_0x7995('0x58')]=function(_0xda6ce8,_0x328671,_0x17ecd3){var _0xa7af8c;return db[_0x7995('0x3c')][_0x7995('0x58')](_0xda6ce8[_0x7995('0x59')],{'raw':!![]})[_0x7995('0x20')](function(_0x416133){_0xa7af8c=_0x416133;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x50b7c2){var _0x56a374=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x402fa0=ejs[_0x7995('0x5d')](_0x56a374,{'contexts':_0x50b7c2||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x402fa0);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x58'),{'module':_0x7995('0x61')});})[_0x7995('0x20')](function(){var _0x502d43=_0xda6ce8['user'][_0x7995('0x36')]({'plain':!![]});if(!_0x502d43)throw new Error(_0x7995('0x62'));if(_0x502d43[_0x7995('0x63')]===_0x7995('0x64')){var _0x37072=_0xa7af8c[_0x7995('0x36')]({'plain':!![]});return db[_0x7995('0x65')][_0x7995('0x57')]({'where':{'name':_0x7995('0x66'),'userProfileId':_0x502d43['userProfileId']},'raw':!![]})[_0x7995('0x20')](function(_0x3ec5a8){if(_0x3ec5a8&&_0x3ec5a8[_0x7995('0x67')]===0x0){return db[_0x7995('0x37')]['create']({'name':_0x37072['name'],'resourceId':_0x37072['id'],'type':_0x3ec5a8[_0x7995('0x39')],'sectionId':_0x3ec5a8['id']},{})[_0x7995('0x20')](function(){return _0xa7af8c;});}else{return _0xa7af8c;}})['catch'](function(_0x971a23){logger[_0x7995('0x27')](_0x7995('0x68'),_0x971a23);throw _0x971a23;});}return _0xa7af8c;})[_0x7995('0x20')](respondWithResult(_0x328671,0xc9))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['update']=function(_0x457d09,_0x564fca,_0x3e0a46){var _0xe31dcb;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x457d09[_0x7995('0x55')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x564fca,null))[_0x7995('0x20')](saveUpdates(_0x457d09[_0x7995('0x59')],null))[_0x7995('0x20')](function(_0x3f2bde){if(_0x3f2bde){_0xe31dcb=_0x3f2bde;return db[_0x7995('0x3c')][_0x7995('0x52')]({'raw':!![]});}})['then'](function(_0x45351d){var _0x23bbc1=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x268fde=ejs[_0x7995('0x5d')](_0x23bbc1,{'contexts':_0x45351d||[]});fs[_0x7995('0x5e')](_0x7995('0x5f'),_0x268fde);})['then'](function(){return respondWithRpcPromise(_0x7995('0x60'),'update',{'module':'chan_sip.so'});})[_0x7995('0x20')](function(){return _0xe31dcb;})[_0x7995('0x20')](respondWithResult(_0x564fca,null))[_0x7995('0x2a')](handleError(_0x564fca,null));};exports[_0x7995('0x69')]=function(_0x290eae,_0x25d9a4,_0x32a52f){var _0x13dc73;return db[_0x7995('0x3c')][_0x7995('0x57')]({'where':{'id':_0x290eae['params']['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x25d9a4,null))[_0x7995('0x20')](removeEntity(_0x25d9a4,null))[_0x7995('0x20')](function(){return db['VoiceContext'][_0x7995('0x52')]({'raw':!![]});})[_0x7995('0x20')](function(_0x705f0){var _0x3a7d9d=fs[_0x7995('0x5a')](path[_0x7995('0x5b')](config[_0x7995('0x5c')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x1fdff6=ejs[_0x7995('0x5d')](_0x3a7d9d,{'contexts':_0x705f0});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x1fdff6);return respondWithRpcPromise(_0x7995('0x60'),_0x7995('0x69'),{'module':_0x7995('0x61')});})[_0x7995('0x2a')](handleError(_0x25d9a4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index db3bf59..c7a495c 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(_0x412a61,_0x766110){var _0x2e14db=function(_0x5e13d2){while(--_0x5e13d2){_0x412a61['push'](_0x412a61['shift']());}};_0x2e14db(++_0x766110);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xf8eff4,_0x2bf578){var _0x2e8cc0=function(_0x2f3aa3){while(--_0x2f3aa3){_0xf8eff4['push'](_0xf8eff4['shift']());}};_0x2e8cc0(++_0x2bf578);}(_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':'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 7ee8f60..4b0fe92 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 _0xdafb=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xdafb,0x10a));var _0xbdaf=function(_0x44dfc3,_0x16ef6c){_0x44dfc3=_0x44dfc3-0x0;var _0x165ba3=_0xdafb[_0x44dfc3];return _0x165ba3;};'use strict';var _=require('lodash');var util=require(_0xbdaf('0x0'));var moment=require(_0xbdaf('0x1'));var BPromise=require(_0xbdaf('0x2'));var rs=require(_0xbdaf('0x3'));var fs=require('fs');var Redis=require(_0xbdaf('0x4'));var db=require(_0xbdaf('0x5'))['db'];var utils=require(_0xbdaf('0x6'));var logger=require('../../config/logger')(_0xbdaf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbdaf('0x8')][_0xbdaf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5254c0,_0x56237f,_0x2aa643){return new BPromise(function(_0x4dac6c,_0x1a01aa){return client[_0xbdaf('0xa')](_0x5254c0,_0x2aa643)[_0xbdaf('0xb')](function(_0x38053c){logger[_0xbdaf('0xc')](_0xbdaf('0xd'),_0x56237f,'request\x20sent');logger[_0xbdaf('0xe')](_0xbdaf('0xf'),_0x56237f,_0xbdaf('0x10'),JSON[_0xbdaf('0x11')](_0x38053c));if(_0x38053c[_0xbdaf('0x12')]){if(_0x38053c[_0xbdaf('0x12')][_0xbdaf('0x13')]===0x1f4){logger[_0xbdaf('0x12')](_0xbdaf('0xd'),_0x56237f,_0x38053c[_0xbdaf('0x12')]['message']);return _0x1a01aa(_0x38053c[_0xbdaf('0x12')][_0xbdaf('0x14')]);}logger['error'](_0xbdaf('0xd'),_0x56237f,_0x38053c['error'][_0xbdaf('0x14')]);return _0x4dac6c(_0x38053c[_0xbdaf('0x12')][_0xbdaf('0x14')]);}else{logger[_0xbdaf('0xc')](_0xbdaf('0xd'),_0x56237f,'request\x20sent');_0x4dac6c(_0x38053c[_0xbdaf('0x15')][_0xbdaf('0x14')]);}})['catch'](function(_0x47b8a8){logger[_0xbdaf('0x12')](_0xbdaf('0xd'),_0x56237f,_0x47b8a8);_0x1a01aa(_0x47b8a8);});});} \ No newline at end of file +var _0xc57d=['client','http','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x40af28,_0x48ea63){var _0x4b0950=function(_0x53c0a7){while(--_0x53c0a7){_0x40af28['push'](_0x40af28['shift']());}};_0x4b0950(++_0x48ea63);}(_0xc57d,0x1c1));var _0xdc57=function(_0x5934b6,_0x18e9b2){_0x5934b6=_0x5934b6-0x0;var _0x1af769=_0xc57d[_0x5934b6];return _0x1af769;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdc57('0x0'));var BPromise=require(_0xdc57('0x1'));var rs=require(_0xdc57('0x2'));var fs=require('fs');var Redis=require(_0xdc57('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc57('0x4'));var logger=require(_0xdc57('0x5'))('rpc');var config=require(_0xdc57('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdc57('0x7')][_0xdc57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x540298,_0x5c8eb4,_0x3abf1f){return new BPromise(function(_0x24c844,_0x2a5ee5){return client['request'](_0x540298,_0x3abf1f)['then'](function(_0x24f25b){logger['info'](_0xdc57('0x9'),_0x5c8eb4,_0xdc57('0xa'));logger['debug'](_0xdc57('0xb'),_0x5c8eb4,_0xdc57('0xa'),JSON[_0xdc57('0xc')](_0x24f25b));if(_0x24f25b[_0xdc57('0xd')]){if(_0x24f25b[_0xdc57('0xd')][_0xdc57('0xe')]===0x1f4){logger[_0xdc57('0xd')](_0xdc57('0x9'),_0x5c8eb4,_0x24f25b['error'][_0xdc57('0xf')]);return _0x2a5ee5(_0x24f25b[_0xdc57('0xd')][_0xdc57('0xf')]);}logger[_0xdc57('0xd')]('VoiceContext,\x20%s,\x20%s',_0x5c8eb4,_0x24f25b[_0xdc57('0xd')][_0xdc57('0xf')]);return _0x24c844(_0x24f25b['error'][_0xdc57('0xf')]);}else{logger[_0xdc57('0x10')]('VoiceContext,\x20%s,\x20%s',_0x5c8eb4,'request\x20sent');_0x24c844(_0x24f25b[_0xdc57('0x11')]['message']);}})[_0xdc57('0x12')](function(_0x32f4dd){logger[_0xdc57('0xd')](_0xdc57('0x9'),_0x5c8eb4,_0x32f4dd);_0x2a5ee5(_0x32f4dd);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 9d3db39..39f0f06 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 _0xdee7=['exports','express','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','/describe','show','post','create','put','/:id','destroy'];(function(_0x241ada,_0x38127a){var _0x3662b7=function(_0x35e5a0){while(--_0x35e5a0){_0x241ada['push'](_0x241ada['shift']());}};_0x3662b7(++_0x38127a);}(_0xdee7,0xe1));var _0x7dee=function(_0x53a50e,_0x48be94){_0x53a50e=_0x53a50e-0x0;var _0x5bac61=_0xdee7[_0x53a50e];return _0x5bac61;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7dee('0x0'));var router=express['Router']();var auth=require(_0x7dee('0x1'));var interaction=require(_0x7dee('0x2'));var config=require('../../config/environment');var controller=require(_0x7dee('0x3'));router[_0x7dee('0x4')]('/',auth[_0x7dee('0x5')](),controller['index']);router[_0x7dee('0x4')](_0x7dee('0x6'),auth[_0x7dee('0x5')](),controller['describe']);router[_0x7dee('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x7dee('0x7')]);router[_0x7dee('0x8')]('/',auth[_0x7dee('0x5')](),controller[_0x7dee('0x9')]);router[_0x7dee('0xa')](_0x7dee('0xb'),auth[_0x7dee('0x5')](),controller['update']);router['delete'](_0x7dee('0xb'),auth[_0x7dee('0x5')](),controller[_0x7dee('0xc')]);module[_0x7dee('0xd')]=router; \ No newline at end of file +var _0xf670=['exports','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','show','create','put','/:id','update','delete'];(function(_0x2ecfca,_0x4f5d2c){var _0x3cbd36=function(_0x3f7c17){while(--_0x3f7c17){_0x2ecfca['push'](_0x2ecfca['shift']());}};_0x3cbd36(++_0x4f5d2c);}(_0xf670,0x155));var _0x0f67=function(_0x3a16d4,_0x23ecda){_0x3a16d4=_0x3a16d4-0x0;var _0x31ea9c=_0xf670[_0x3a16d4];return _0x31ea9c;};'use strict';var multer=require('multer');var util=require(_0x0f67('0x0'));var path=require('path');var timeout=require(_0x0f67('0x1'));var express=require('express');var router=express[_0x0f67('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0f67('0x3'));var config=require(_0x0f67('0x4'));var controller=require(_0x0f67('0x5'));router['get']('/',auth[_0x0f67('0x6')](),controller[_0x0f67('0x7')]);router[_0x0f67('0x8')](_0x0f67('0x9'),auth[_0x0f67('0x6')](),controller['describe']);router['get']('/:id',auth[_0x0f67('0x6')](),controller[_0x0f67('0xa')]);router['post']('/',auth[_0x0f67('0x6')](),controller[_0x0f67('0xb')]);router[_0x0f67('0xc')](_0x0f67('0xd'),auth[_0x0f67('0x6')](),controller[_0x0f67('0xe')]);router[_0x0f67('0xf')]('/:id',auth[_0x0f67('0x6')](),controller['destroy']);module[_0x0f67('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 2d5321b..6ae69aa 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 _0x5d17=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x2842cc,_0x180702){var _0x803635=function(_0x49180b){while(--_0x49180b){_0x2842cc['push'](_0x2842cc['shift']());}};_0x803635(++_0x180702);}(_0x5d17,0x148));var _0x75d1=function(_0x196dc5,_0x50be9d){_0x196dc5=_0x196dc5-0x0;var _0x56458e=_0x5d17[_0x196dc5];return _0x56458e;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x75d1('0x2')]},'channelstate':{'type':Sequelize[_0x75d1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x75d1('0x2')]},'calleridnum':{'type':Sequelize[_0x75d1('0x2')]},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x75d1('0x2')]},'connectedlinename':{'type':Sequelize[_0x75d1('0x2')]},'language':{'type':Sequelize[_0x75d1('0x2')]},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'exten':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize[_0x75d1('0x3')]},'uniqueid':{'type':Sequelize[_0x75d1('0x2')]},'linkedid':{'type':Sequelize[_0x75d1('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x75d1('0x2')]},'destcalleridnum':{'type':Sequelize[_0x75d1('0x2')]},'destcalleridname':{'type':Sequelize[_0x75d1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x75d1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x75d1('0x2')]},'destlanguage':{'type':Sequelize[_0x75d1('0x2')]},'destaccountcode':{'type':Sequelize[_0x75d1('0x2')]},'destcontext':{'type':Sequelize[_0x75d1('0x2')]},'destexten':{'type':Sequelize[_0x75d1('0x2')]},'destpriority':{'type':Sequelize[_0x75d1('0x3')]},'destuniqueid':{'type':Sequelize[_0x75d1('0x2')]},'destlinkedid':{'type':Sequelize[_0x75d1('0x2')]},'dialstring':{'type':Sequelize[_0x75d1('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x75d1('0x4')]},'lastevent':{'type':Sequelize[_0x75d1('0x2')],'comment':_0x75d1('0x5')},'routeId':{'type':Sequelize[_0x75d1('0x3')]},'duration':{'type':Sequelize[_0x75d1('0x3')]},'holdtime':{'type':Sequelize[_0x75d1('0x3')]},'billableseconds':{'type':Sequelize[_0x75d1('0x3')]}}; \ No newline at end of file +var _0x8ced=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x1bafab,_0xabb520){var _0x21a3ed=function(_0x34058a){while(--_0x34058a){_0x1bafab['push'](_0x1bafab['shift']());}};_0x21a3ed(++_0xabb520);}(_0x8ced,0x6a));var _0xd8ce=function(_0x5e9aa2,_0xd197ca){_0x5e9aa2=_0x5e9aa2-0x0;var _0xc42277=_0x8ced[_0x5e9aa2];return _0xc42277;};'use strict';var Sequelize=require(_0xd8ce('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd8ce('0x1')]},'channel':{'type':Sequelize[_0xd8ce('0x1')]},'channelstate':{'type':Sequelize[_0xd8ce('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd8ce('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd8ce('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd8ce('0x1')]},'language':{'type':Sequelize[_0xd8ce('0x1')]},'accountcode':{'type':Sequelize[_0xd8ce('0x1')]},'context':{'type':Sequelize[_0xd8ce('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd8ce('0x1')]},'destchannel':{'type':Sequelize[_0xd8ce('0x1')]},'destchannelstate':{'type':Sequelize[_0xd8ce('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd8ce('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd8ce('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd8ce('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd8ce('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd8ce('0x1')]},'destcontext':{'type':Sequelize[_0xd8ce('0x1')]},'destexten':{'type':Sequelize[_0xd8ce('0x1')]},'destpriority':{'type':Sequelize[_0xd8ce('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xd8ce('0x1')]},'dialstring':{'type':Sequelize[_0xd8ce('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd8ce('0x3')]},'answertime':{'type':Sequelize[_0xd8ce('0x3')]},'endtime':{'type':Sequelize[_0xd8ce('0x3')]},'lastevent':{'type':Sequelize[_0xd8ce('0x1')],'comment':_0xd8ce('0x4')},'routeId':{'type':Sequelize[_0xd8ce('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd8ce('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 8753b54..f9bfc62 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 _0xd1d7=['end','sendStatus','error','stack','name','index','map','VoiceDialReport','key','model','keys','filters','intersection','query','attributes','fields','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','Content-Range','reject','save','then','destroy'];(function(_0x474f36,_0x104751){var _0x451b9e=function(_0x2f8abc){while(--_0x2f8abc){_0x474f36['push'](_0x474f36['shift']());}};_0x451b9e(++_0x104751);}(_0xd1d7,0x144));var _0x7d1d=function(_0xca18be,_0x5bbe40){_0xca18be=_0xca18be-0x0;var _0x2815ad=_0xd1d7[_0xca18be];return _0x2815ad;};'use strict';var pdf=require(_0x7d1d('0x0'));var emlformat=require(_0x7d1d('0x1'));var rimraf=require(_0x7d1d('0x2'));var zipdir=require(_0x7d1d('0x3'));var jsonpatch=require(_0x7d1d('0x4'));var rp=require(_0x7d1d('0x5'));var moment=require(_0x7d1d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x7d1d('0x7'));var util=require(_0x7d1d('0x8'));var path=require(_0x7d1d('0x9'));var sox=require('sox');var csv=require(_0x7d1d('0xa'));var ejs=require(_0x7d1d('0xb'));var fs=require('fs');var _=require(_0x7d1d('0xc'));var squel=require(_0x7d1d('0xd'));var crypto=require(_0x7d1d('0xe'));var jsforce=require(_0x7d1d('0xf'));var deskjs=require(_0x7d1d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7d1d('0x11'));var Redis=require(_0x7d1d('0x12'));var authService=require(_0x7d1d('0x13'));var qs=require(_0x7d1d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d1d('0x15'));var logger=require(_0x7d1d('0x16'))(_0x7d1d('0x17'));var utils=require(_0x7d1d('0x18'));var config=require(_0x7d1d('0x19'));var db=require(_0x7d1d('0x1a'))['db'];function respondWithStatusCode(_0x1e7c82,_0x3dc349){_0x3dc349=_0x3dc349||0xcc;return function(_0x170640){if(_0x170640){return _0x1e7c82['sendStatus'](_0x3dc349);}return _0x1e7c82['status'](_0x3dc349)['end']();};}function respondWithResult(_0x4d45a9,_0x2a0b3d){_0x2a0b3d=_0x2a0b3d||0xc8;return function(_0x34084b){if(_0x34084b){return _0x4d45a9[_0x7d1d('0x1b')](_0x2a0b3d)['json'](_0x34084b);}};}function respondWithFilteredResult(_0x48ee8b,_0x444b8a){return function(_0x859739){if(_0x859739){var _0x1b9108=_0x859739[_0x7d1d('0x1c')],_0x4776f3=_0x444b8a[_0x7d1d('0x1d')],_0xc6f9c6=_0x444b8a[_0x7d1d('0x1d')]+_0x444b8a[_0x7d1d('0x1e')],_0x24c033;if(_0xc6f9c6>=_0x1b9108){_0xc6f9c6=_0x1b9108;_0x24c033=0xc8;}else{_0x24c033=0xce;}_0x48ee8b[_0x7d1d('0x1b')](_0x24c033);return _0x48ee8b['set'](_0x7d1d('0x1f'),_0x4776f3+'-'+_0xc6f9c6+'/'+_0x1b9108)['json'](_0x859739);}return null;};}function patchUpdates(_0x4c098d){return function(_0x3c8b64){try{jsonpatch['apply'](_0x3c8b64,_0x4c098d,!![]);}catch(_0x4e07b7){return BPromise[_0x7d1d('0x20')](_0x4e07b7);}return _0x3c8b64[_0x7d1d('0x21')]();};}function saveUpdates(_0x3c210b,_0x23d1a6){return function(_0x555004){if(_0x555004){return _0x555004['update'](_0x3c210b)[_0x7d1d('0x22')](function(_0x5d1bb7){return _0x5d1bb7;});}return null;};}function removeEntity(_0x3034c9,_0x29c705){return function(_0x4efbac){if(_0x4efbac){return _0x4efbac[_0x7d1d('0x23')]()[_0x7d1d('0x22')](function(){_0x3034c9[_0x7d1d('0x1b')](0xcc)[_0x7d1d('0x24')]();});}};}function handleEntityNotFound(_0x30c170,_0x158f10){return function(_0x240a82){if(!_0x240a82){_0x30c170[_0x7d1d('0x25')](0x194);}return _0x240a82;};}function handleError(_0x204be7,_0x26a826){_0x26a826=_0x26a826||0x1f4;return function(_0x350331){logger[_0x7d1d('0x26')](_0x350331[_0x7d1d('0x27')]);if(_0x350331[_0x7d1d('0x28')]){delete _0x350331['name'];}_0x204be7[_0x7d1d('0x1b')](_0x26a826)['send'](_0x350331);};}exports[_0x7d1d('0x29')]=function(_0x356294,_0x1fe626){var _0x402ecd={},_0x2a1bef={},_0x163aea={'count':0x0,'rows':[]};var _0x1aa5b5=_[_0x7d1d('0x2a')](db[_0x7d1d('0x2b')]['rawAttributes'],function(_0xe21bcf){return{'name':_0xe21bcf['fieldName'],'type':_0xe21bcf['type'][_0x7d1d('0x2c')]};});_0x2a1bef[_0x7d1d('0x2d')]=_['map'](_0x1aa5b5,_0x7d1d('0x28'));_0x2a1bef['query']=_[_0x7d1d('0x2e')](_0x356294['query']);_0x2a1bef[_0x7d1d('0x2f')]=_[_0x7d1d('0x30')](_0x2a1bef[_0x7d1d('0x2d')],_0x2a1bef[_0x7d1d('0x31')]);_0x402ecd[_0x7d1d('0x32')]=_[_0x7d1d('0x30')](_0x2a1bef[_0x7d1d('0x2d')],qs[_0x7d1d('0x33')](_0x356294[_0x7d1d('0x31')][_0x7d1d('0x33')]));_0x402ecd[_0x7d1d('0x32')]=_0x402ecd[_0x7d1d('0x32')]['length']?_0x402ecd[_0x7d1d('0x32')]:_0x2a1bef['model'];if(!_0x356294['query']['hasOwnProperty'](_0x7d1d('0x34'))){_0x402ecd[_0x7d1d('0x1e')]=qs[_0x7d1d('0x1e')](_0x356294[_0x7d1d('0x31')][_0x7d1d('0x1e')]);_0x402ecd[_0x7d1d('0x1d')]=qs[_0x7d1d('0x1d')](_0x356294[_0x7d1d('0x31')]['offset']);}_0x402ecd['order']=qs[_0x7d1d('0x35')](_0x356294[_0x7d1d('0x31')][_0x7d1d('0x35')]);_0x402ecd[_0x7d1d('0x36')]=qs[_0x7d1d('0x2f')](_[_0x7d1d('0x37')](_0x356294['query'],_0x2a1bef[_0x7d1d('0x2f')]),_0x1aa5b5);if(_0x356294[_0x7d1d('0x31')][_0x7d1d('0x38')]){_0x402ecd[_0x7d1d('0x36')]=_[_0x7d1d('0x39')](_0x402ecd[_0x7d1d('0x36')],{'$or':_[_0x7d1d('0x2a')](_0x1aa5b5,function(_0x53cac1){if(_0x53cac1[_0x7d1d('0x3a')]!==_0x7d1d('0x3b')){var _0x23e037={};_0x23e037[_0x53cac1[_0x7d1d('0x28')]]={'$like':'%'+_0x356294['query'][_0x7d1d('0x38')]+'%'};return _0x23e037;}})});}_0x402ecd=_['merge']({},_0x402ecd,_0x356294[_0x7d1d('0x3c')]);var _0x390e90={'where':_0x402ecd[_0x7d1d('0x36')]};return db[_0x7d1d('0x2b')][_0x7d1d('0x1c')](_0x390e90)['then'](function(_0x2b2d33){_0x163aea[_0x7d1d('0x1c')]=_0x2b2d33;if(_0x356294['query'][_0x7d1d('0x3d')]){_0x402ecd[_0x7d1d('0x3e')]=[{'all':!![]}];}return db[_0x7d1d('0x2b')]['findAll'](_0x402ecd);})[_0x7d1d('0x22')](function(_0x71d52c){_0x163aea[_0x7d1d('0x3f')]=_0x71d52c;return _0x163aea;})['then'](respondWithFilteredResult(_0x1fe626,_0x402ecd))[_0x7d1d('0x40')](handleError(_0x1fe626,null));};exports['show']=function(_0xa8e9bf,_0x165edc){var _0x407543={'raw':!![],'where':{'id':_0xa8e9bf[_0x7d1d('0x41')]['id']}},_0x3f2970={};_0x3f2970[_0x7d1d('0x2d')]=_['keys'](db[_0x7d1d('0x2b')][_0x7d1d('0x42')]);_0x3f2970[_0x7d1d('0x31')]=_[_0x7d1d('0x2e')](_0xa8e9bf[_0x7d1d('0x31')]);_0x3f2970[_0x7d1d('0x2f')]=_['intersection'](_0x3f2970[_0x7d1d('0x2d')],_0x3f2970[_0x7d1d('0x31')]);_0x407543[_0x7d1d('0x32')]=_[_0x7d1d('0x30')](_0x3f2970[_0x7d1d('0x2d')],qs[_0x7d1d('0x33')](_0xa8e9bf['query'][_0x7d1d('0x33')]));_0x407543[_0x7d1d('0x32')]=_0x407543[_0x7d1d('0x32')]['length']?_0x407543[_0x7d1d('0x32')]:_0x3f2970[_0x7d1d('0x2d')];if(_0xa8e9bf[_0x7d1d('0x31')]['includeAll']){_0x407543[_0x7d1d('0x3e')]=[{'all':!![]}];}_0x407543=_['merge']({},_0x407543,_0xa8e9bf['options']);return db[_0x7d1d('0x2b')][_0x7d1d('0x43')](_0x407543)['then'](handleEntityNotFound(_0x165edc,null))[_0x7d1d('0x22')](respondWithResult(_0x165edc,null))[_0x7d1d('0x40')](handleError(_0x165edc,null));};exports['create']=function(_0x236e0b,_0x196595){return db[_0x7d1d('0x2b')][_0x7d1d('0x44')](_0x236e0b[_0x7d1d('0x45')],{})[_0x7d1d('0x22')](respondWithResult(_0x196595,0xc9))[_0x7d1d('0x40')](handleError(_0x196595,null));};exports[_0x7d1d('0x46')]=function(_0x5f3935,_0x341d5d){if(_0x5f3935[_0x7d1d('0x45')]['id']){delete _0x5f3935[_0x7d1d('0x45')]['id'];}return db[_0x7d1d('0x2b')][_0x7d1d('0x43')]({'where':{'id':_0x5f3935['params']['id']}})[_0x7d1d('0x22')](handleEntityNotFound(_0x341d5d,null))[_0x7d1d('0x22')](saveUpdates(_0x5f3935[_0x7d1d('0x45')],null))[_0x7d1d('0x22')](respondWithResult(_0x341d5d,null))['catch'](handleError(_0x341d5d,null));};exports[_0x7d1d('0x23')]=function(_0x189bd8,_0x5c54f8){return db[_0x7d1d('0x2b')][_0x7d1d('0x43')]({'where':{'id':_0x189bd8['params']['id']}})[_0x7d1d('0x22')](handleEntityNotFound(_0x5c54f8,null))[_0x7d1d('0x22')](removeEntity(_0x5c54f8,null))[_0x7d1d('0x40')](handleError(_0x5c54f8,null));};exports[_0x7d1d('0x47')]=function(_0x4fa45d,_0xf1e92b){return db[_0x7d1d('0x2b')][_0x7d1d('0x47')]()[_0x7d1d('0x22')](respondWithResult(_0xf1e92b,null))[_0x7d1d('0x40')](handleError(_0xf1e92b,null));}; \ No newline at end of file +var _0xf9fd=['ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','VoiceDialReport','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','rawAttributes','length','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','to-csv'];(function(_0x462548,_0x2fe430){var _0x543854=function(_0x417387){while(--_0x417387){_0x462548['push'](_0x462548['shift']());}};_0x543854(++_0x2fe430);}(_0xf9fd,0x118));var _0xdf9f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf9fd[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0xdf9f('0x0'));var emlformat=require(_0xdf9f('0x1'));var rimraf=require(_0xdf9f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf9f('0x3'));var rp=require(_0xdf9f('0x4'));var moment=require('moment');var BPromise=require(_0xdf9f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdf9f('0x6'));var sox=require('sox');var csv=require(_0xdf9f('0x7'));var ejs=require(_0xdf9f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdf9f('0x9'));var crypto=require(_0xdf9f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdf9f('0xb'));var toCsv=require(_0xdf9f('0x7'));var querystring=require('querystring');var Papa=require(_0xdf9f('0xc'));var Redis=require(_0xdf9f('0xd'));var authService=require(_0xdf9f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xdf9f('0xf'));var hardwareService=require(_0xdf9f('0x10'));var logger=require(_0xdf9f('0x11'))(_0xdf9f('0x12'));var utils=require(_0xdf9f('0x13'));var config=require(_0xdf9f('0x14'));var db=require(_0xdf9f('0x15'))['db'];function respondWithStatusCode(_0x122b40,_0x59ccd9){_0x59ccd9=_0x59ccd9||0xcc;return function(_0x1bc5ef){if(_0x1bc5ef){return _0x122b40['sendStatus'](_0x59ccd9);}return _0x122b40[_0xdf9f('0x16')](_0x59ccd9)[_0xdf9f('0x17')]();};}function respondWithResult(_0x1bd711,_0x2917ef){_0x2917ef=_0x2917ef||0xc8;return function(_0x1f5b2a){if(_0x1f5b2a){return _0x1bd711[_0xdf9f('0x16')](_0x2917ef)[_0xdf9f('0x18')](_0x1f5b2a);}};}function respondWithFilteredResult(_0x5834cb,_0x136788){return function(_0x757c0b){if(_0x757c0b){var _0x180627=_0x757c0b['count'],_0x6fb173=_0x136788[_0xdf9f('0x19')],_0x4bac62=_0x136788[_0xdf9f('0x19')]+_0x136788[_0xdf9f('0x1a')],_0x33e541;if(_0x4bac62>=_0x180627){_0x4bac62=_0x180627;_0x33e541=0xc8;}else{_0x33e541=0xce;}_0x5834cb[_0xdf9f('0x16')](_0x33e541);return _0x5834cb['set'](_0xdf9f('0x1b'),_0x6fb173+'-'+_0x4bac62+'/'+_0x180627)['json'](_0x757c0b);}return null;};}function patchUpdates(_0x3ee1fc){return function(_0x22277a){try{jsonpatch[_0xdf9f('0x1c')](_0x22277a,_0x3ee1fc,!![]);}catch(_0x3786a9){return BPromise[_0xdf9f('0x1d')](_0x3786a9);}return _0x22277a[_0xdf9f('0x1e')]();};}function saveUpdates(_0x3ff17d,_0x483f7d){return function(_0xb00a11){if(_0xb00a11){return _0xb00a11[_0xdf9f('0x1f')](_0x3ff17d)['then'](function(_0x24398d){return _0x24398d;});}return null;};}function removeEntity(_0x588bcd,_0x3cde3e){return function(_0x6107bd){if(_0x6107bd){return _0x6107bd[_0xdf9f('0x20')]()[_0xdf9f('0x21')](function(){_0x588bcd[_0xdf9f('0x16')](0xcc)[_0xdf9f('0x17')]();});}};}function handleEntityNotFound(_0x569600,_0x484bd9){return function(_0x382cd5){if(!_0x382cd5){_0x569600[_0xdf9f('0x22')](0x194);}return _0x382cd5;};}function handleError(_0xcb66a8,_0x46301f){_0x46301f=_0x46301f||0x1f4;return function(_0x475853){logger[_0xdf9f('0x23')](_0x475853[_0xdf9f('0x24')]);if(_0x475853[_0xdf9f('0x25')]){delete _0x475853['name'];}_0xcb66a8[_0xdf9f('0x16')](_0x46301f)['send'](_0x475853);};}exports[_0xdf9f('0x26')]=function(_0x74ccfa,_0x3b61ca){var _0x2955b5={},_0x57b516={},_0x495c0b={'count':0x0,'rows':[]};var _0x140a8e=_[_0xdf9f('0x27')](db[_0xdf9f('0x28')]['rawAttributes'],function(_0x3dc6f0){return{'name':_0x3dc6f0[_0xdf9f('0x29')],'type':_0x3dc6f0[_0xdf9f('0x2a')]['key']};});_0x57b516[_0xdf9f('0x2b')]=_['map'](_0x140a8e,_0xdf9f('0x25'));_0x57b516[_0xdf9f('0x2c')]=_[_0xdf9f('0x2d')](_0x74ccfa[_0xdf9f('0x2c')]);_0x57b516['filters']=_[_0xdf9f('0x2e')](_0x57b516['model'],_0x57b516[_0xdf9f('0x2c')]);_0x2955b5[_0xdf9f('0x2f')]=_['intersection'](_0x57b516[_0xdf9f('0x2b')],qs[_0xdf9f('0x30')](_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x30')]));_0x2955b5['attributes']=_0x2955b5[_0xdf9f('0x2f')]['length']?_0x2955b5['attributes']:_0x57b516[_0xdf9f('0x2b')];if(!_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x31')]('nolimit')){_0x2955b5[_0xdf9f('0x1a')]=qs['limit'](_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x1a')]);_0x2955b5['offset']=qs[_0xdf9f('0x19')](_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x19')]);}_0x2955b5[_0xdf9f('0x32')]=qs[_0xdf9f('0x33')](_0x74ccfa[_0xdf9f('0x2c')]['sort']);_0x2955b5[_0xdf9f('0x34')]=qs[_0xdf9f('0x35')](_[_0xdf9f('0x36')](_0x74ccfa[_0xdf9f('0x2c')],_0x57b516[_0xdf9f('0x35')]),_0x140a8e);if(_0x74ccfa[_0xdf9f('0x2c')]['filter']){_0x2955b5[_0xdf9f('0x34')]=_[_0xdf9f('0x37')](_0x2955b5['where'],{'$or':_['map'](_0x140a8e,function(_0x4c17f3){if(_0x4c17f3[_0xdf9f('0x2a')]!==_0xdf9f('0x38')){var _0x4b5c1b={};_0x4b5c1b[_0x4c17f3[_0xdf9f('0x25')]]={'$like':'%'+_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x39')]+'%'};return _0x4b5c1b;}})});}_0x2955b5=_['merge']({},_0x2955b5,_0x74ccfa[_0xdf9f('0x3a')]);var _0x24f6e={'where':_0x2955b5[_0xdf9f('0x34')]};return db[_0xdf9f('0x28')]['count'](_0x24f6e)['then'](function(_0x10b76c){_0x495c0b[_0xdf9f('0x3b')]=_0x10b76c;if(_0x74ccfa[_0xdf9f('0x2c')][_0xdf9f('0x3c')]){_0x2955b5[_0xdf9f('0x3d')]=[{'all':!![]}];}return db[_0xdf9f('0x28')][_0xdf9f('0x3e')](_0x2955b5);})[_0xdf9f('0x21')](function(_0x248eb3){_0x495c0b[_0xdf9f('0x3f')]=_0x248eb3;return _0x495c0b;})[_0xdf9f('0x21')](respondWithFilteredResult(_0x3b61ca,_0x2955b5))[_0xdf9f('0x40')](handleError(_0x3b61ca,null));};exports['show']=function(_0x17c4df,_0x2dbcf0){var _0x3315c5={'raw':!![],'where':{'id':_0x17c4df['params']['id']}},_0x17d00f={};_0x17d00f[_0xdf9f('0x2b')]=_[_0xdf9f('0x2d')](db[_0xdf9f('0x28')][_0xdf9f('0x41')]);_0x17d00f[_0xdf9f('0x2c')]=_[_0xdf9f('0x2d')](_0x17c4df['query']);_0x17d00f['filters']=_[_0xdf9f('0x2e')](_0x17d00f[_0xdf9f('0x2b')],_0x17d00f[_0xdf9f('0x2c')]);_0x3315c5[_0xdf9f('0x2f')]=_[_0xdf9f('0x2e')](_0x17d00f[_0xdf9f('0x2b')],qs[_0xdf9f('0x30')](_0x17c4df[_0xdf9f('0x2c')][_0xdf9f('0x30')]));_0x3315c5[_0xdf9f('0x2f')]=_0x3315c5['attributes'][_0xdf9f('0x42')]?_0x3315c5[_0xdf9f('0x2f')]:_0x17d00f[_0xdf9f('0x2b')];if(_0x17c4df[_0xdf9f('0x2c')][_0xdf9f('0x3c')]){_0x3315c5['include']=[{'all':!![]}];}_0x3315c5=_[_0xdf9f('0x37')]({},_0x3315c5,_0x17c4df['options']);return db[_0xdf9f('0x28')][_0xdf9f('0x43')](_0x3315c5)[_0xdf9f('0x21')](handleEntityNotFound(_0x2dbcf0,null))[_0xdf9f('0x21')](respondWithResult(_0x2dbcf0,null))['catch'](handleError(_0x2dbcf0,null));};exports[_0xdf9f('0x44')]=function(_0x13ae1f,_0x455e21){return db['VoiceDialReport'][_0xdf9f('0x44')](_0x13ae1f[_0xdf9f('0x45')],{})[_0xdf9f('0x21')](respondWithResult(_0x455e21,0xc9))[_0xdf9f('0x40')](handleError(_0x455e21,null));};exports['update']=function(_0x4eeee3,_0x4aa0ad){if(_0x4eeee3[_0xdf9f('0x45')]['id']){delete _0x4eeee3['body']['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x4eeee3[_0xdf9f('0x46')]['id']}})[_0xdf9f('0x21')](handleEntityNotFound(_0x4aa0ad,null))[_0xdf9f('0x21')](saveUpdates(_0x4eeee3['body'],null))[_0xdf9f('0x21')](respondWithResult(_0x4aa0ad,null))[_0xdf9f('0x40')](handleError(_0x4aa0ad,null));};exports[_0xdf9f('0x20')]=function(_0x17708f,_0x506a46){return db['VoiceDialReport']['find']({'where':{'id':_0x17708f[_0xdf9f('0x46')]['id']}})[_0xdf9f('0x21')](handleEntityNotFound(_0x506a46,null))['then'](removeEntity(_0x506a46,null))[_0xdf9f('0x40')](handleError(_0x506a46,null));};exports['describe']=function(_0xf36b52,_0x3aff8e){return db[_0xdf9f('0x28')][_0xdf9f('0x47')]()[_0xdf9f('0x21')](respondWithResult(_0x3aff8e,null))[_0xdf9f('0x40')](handleError(_0x3aff8e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 4d41852..9b3f5bf 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 _0x6136=['util','../../config/logger','api','moment','bluebird','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','lodash'];(function(_0x4cf475,_0x375c28){var _0x8876fe=function(_0x157658){while(--_0x157658){_0x4cf475['push'](_0x4cf475['shift']());}};_0x8876fe(++_0x375c28);}(_0x6136,0x112));var _0x6613=function(_0x180ab8,_0x54dee0){_0x180ab8=_0x180ab8-0x0;var _0x33c46b=_0x6136[_0x180ab8];return _0x33c46b;};'use strict';var _=require(_0x6613('0x0'));var util=require(_0x6613('0x1'));var logger=require(_0x6613('0x2'))(_0x6613('0x3'));var moment=require(_0x6613('0x4'));var BPromise=require(_0x6613('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6613('0x6'));var attributes=require(_0x6613('0x7'));module[_0x6613('0x8')]=function(_0x410b70,_0x17ce54){return _0x410b70['define'](_0x6613('0x9'),attributes,{'tableName':_0x6613('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc66c=['path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','request-promise'];(function(_0x1b8a76,_0x4ffd3b){var _0xb115bf=function(_0x59179d){while(--_0x59179d){_0x1b8a76['push'](_0x1b8a76['shift']());}};_0xb115bf(++_0x4ffd3b);}(_0xc66c,0x181));var _0xcc66=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xc66c[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xcc66('0x0'));var util=require(_0xcc66('0x1'));var logger=require(_0xcc66('0x2'))(_0xcc66('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcc66('0x4'));var fs=require('fs');var path=require(_0xcc66('0x5'));var rimraf=require(_0xcc66('0x6'));var config=require(_0xcc66('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0xcc66('0x8')]=function(_0x5dea4b,_0x2e61bb){return _0x5dea4b[_0xcc66('0x9')](_0xcc66('0xa'),attributes,{'tableName':_0xcc66('0xb'),'paranoid':![],'indexes':[{'fields':[_0xcc66('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 3afff20..3e92b37 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 _0x1978=['create','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update','body','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x1978,0x174));var _0x8197=function(_0x384e4c,_0x241881){_0x384e4c=_0x384e4c-0x0;var _0x361098=_0x1978[_0x384e4c];return _0x361098;};'use strict';var _=require('lodash');var util=require(_0x8197('0x0'));var moment=require(_0x8197('0x1'));var BPromise=require(_0x8197('0x2'));var rs=require(_0x8197('0x3'));var fs=require('fs');var Redis=require(_0x8197('0x4'));var db=require(_0x8197('0x5'))['db'];var utils=require(_0x8197('0x6'));var logger=require(_0x8197('0x7'))(_0x8197('0x8'));var config=require(_0x8197('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8197('0xa')][_0x8197('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x117bf1,_0x374969,_0x3e8799){return new BPromise(function(_0x1bc265,_0x108379){return client[_0x8197('0xc')](_0x117bf1,_0x3e8799)[_0x8197('0xd')](function(_0x3fd8ee){logger[_0x8197('0xe')](_0x8197('0xf'),_0x374969,_0x8197('0x10'));logger[_0x8197('0x11')](_0x8197('0x12'),_0x374969,'request\x20sent',JSON[_0x8197('0x13')](_0x3fd8ee));if(_0x3fd8ee[_0x8197('0x14')]){if(_0x3fd8ee[_0x8197('0x14')][_0x8197('0x15')]===0x1f4){logger[_0x8197('0x14')](_0x8197('0xf'),_0x374969,_0x3fd8ee['error']['message']);return _0x108379(_0x3fd8ee[_0x8197('0x14')][_0x8197('0x16')]);}logger[_0x8197('0x14')](_0x8197('0xf'),_0x374969,_0x3fd8ee[_0x8197('0x14')]['message']);return _0x1bc265(_0x3fd8ee[_0x8197('0x14')]['message']);}else{logger[_0x8197('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x374969,_0x8197('0x10'));_0x1bc265(_0x3fd8ee['result'][_0x8197('0x16')]);}})[_0x8197('0x17')](function(_0x56fd37){logger[_0x8197('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0x374969,_0x56fd37);_0x108379(_0x56fd37);});});}exports['CreateVoiceDialReport']=function(_0x4695a5){var _0x48bce1=this;return new Promise(function(_0x170d65,_0x34292d){return db['VoiceDialReport'][_0x8197('0x18')](_0x4695a5['body'],{'raw':_0x4695a5[_0x8197('0x19')]?_0x4695a5[_0x8197('0x19')][_0x8197('0x1a')]===undefined?!![]:![]:!![]})[_0x8197('0xd')](function(_0x22e831){logger[_0x8197('0xe')]('CreateVoiceDialReport',_0x4695a5);logger[_0x8197('0x11')](_0x8197('0x1b'),_0x4695a5,JSON[_0x8197('0x13')](_0x22e831));_0x170d65(_0x22e831);})['catch'](function(_0x4c06d1){logger[_0x8197('0x14')](_0x8197('0x1b'),_0x4c06d1[_0x8197('0x16')],_0x4695a5);_0x34292d(_0x48bce1[_0x8197('0x14')](0x1f4,_0x4c06d1[_0x8197('0x16')]));});});};exports[_0x8197('0x1c')]=function(_0x570241){var _0x4199d8=this;return new Promise(function(_0xe50ccd,_0xd7285e){return db['VoiceDialReport'][_0x8197('0x1d')](_0x570241[_0x8197('0x1e')],{'raw':_0x570241[_0x8197('0x19')]?_0x570241[_0x8197('0x19')][_0x8197('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x570241[_0x8197('0x19')]?_0x570241[_0x8197('0x19')]['where']||null:null,'attributes':_0x570241[_0x8197('0x19')]?_0x570241[_0x8197('0x19')][_0x8197('0x1f')]||null:null,'limit':_0x570241[_0x8197('0x19')]?_0x570241[_0x8197('0x19')][_0x8197('0x20')]||null:null})['then'](function(_0x8cd98c){logger[_0x8197('0xe')]('UpdateVoiceDialReport',_0x570241);logger[_0x8197('0x11')](_0x8197('0x1c'),_0x570241,JSON['stringify'](_0x8cd98c));_0xe50ccd(_0x8cd98c);})[_0x8197('0x17')](function(_0x21c7a4){logger[_0x8197('0x14')](_0x8197('0x1c'),_0x21c7a4[_0x8197('0x16')],_0x570241);_0xd7285e(_0x4199d8[_0x8197('0x14')](0x1f4,_0x21c7a4[_0x8197('0x16')]));});});}; \ No newline at end of file +var _0xbb95=['catch','VoiceDialReport','body','options','raw','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','update','where','attributes','lodash','util','randomstring','ioredis','../../config/utils','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3ff235,_0x428b4d){var _0x409302=function(_0x4ef822){while(--_0x4ef822){_0x3ff235['push'](_0x3ff235['shift']());}};_0x409302(++_0x428b4d);}(_0xbb95,0x7f));var _0x5bb9=function(_0x4f2b48,_0x4ca75a){_0x4f2b48=_0x4f2b48-0x0;var _0x44015c=_0xbb95[_0x4f2b48];return _0x44015c;};'use strict';var _=require(_0x5bb9('0x0'));var util=require(_0x5bb9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5bb9('0x2'));var fs=require('fs');var Redis=require(_0x5bb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bb9('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5bb9('0x5'));var client=jayson[_0x5bb9('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x180e69,_0x123a6a,_0x39f347){return new BPromise(function(_0x5e8b1c,_0x95777c){return client[_0x5bb9('0x7')](_0x180e69,_0x39f347)[_0x5bb9('0x8')](function(_0x267319){logger[_0x5bb9('0x9')](_0x5bb9('0xa'),_0x123a6a,_0x5bb9('0xb'));logger[_0x5bb9('0xc')](_0x5bb9('0xd'),_0x123a6a,_0x5bb9('0xb'),JSON['stringify'](_0x267319));if(_0x267319['error']){if(_0x267319[_0x5bb9('0xe')][_0x5bb9('0xf')]===0x1f4){logger[_0x5bb9('0xe')](_0x5bb9('0xa'),_0x123a6a,_0x267319[_0x5bb9('0xe')][_0x5bb9('0x10')]);return _0x95777c(_0x267319[_0x5bb9('0xe')]['message']);}logger['error'](_0x5bb9('0xa'),_0x123a6a,_0x267319[_0x5bb9('0xe')][_0x5bb9('0x10')]);return _0x5e8b1c(_0x267319['error'][_0x5bb9('0x10')]);}else{logger[_0x5bb9('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0x123a6a,_0x5bb9('0xb'));_0x5e8b1c(_0x267319[_0x5bb9('0x11')][_0x5bb9('0x10')]);}})[_0x5bb9('0x12')](function(_0x119092){logger[_0x5bb9('0xe')](_0x5bb9('0xa'),_0x123a6a,_0x119092);_0x95777c(_0x119092);});});}exports['CreateVoiceDialReport']=function(_0x16b7ab){var _0x56c337=this;return new Promise(function(_0xecb76c,_0x54dcd4){return db[_0x5bb9('0x13')]['create'](_0x16b7ab[_0x5bb9('0x14')],{'raw':_0x16b7ab[_0x5bb9('0x15')]?_0x16b7ab[_0x5bb9('0x15')][_0x5bb9('0x16')]===undefined?!![]:![]:!![]})[_0x5bb9('0x8')](function(_0x2c9b5e){logger[_0x5bb9('0x9')](_0x5bb9('0x17'),_0x16b7ab);logger[_0x5bb9('0xc')]('CreateVoiceDialReport',_0x16b7ab,JSON[_0x5bb9('0x18')](_0x2c9b5e));_0xecb76c(_0x2c9b5e);})['catch'](function(_0x1949c1){logger[_0x5bb9('0xe')]('CreateVoiceDialReport',_0x1949c1[_0x5bb9('0x10')],_0x16b7ab);_0x54dcd4(_0x56c337[_0x5bb9('0xe')](0x1f4,_0x1949c1['message']));});});};exports[_0x5bb9('0x19')]=function(_0x48c553){var _0x2de62c=this;return new Promise(function(_0x4db9ae,_0x4909ea){return db[_0x5bb9('0x13')][_0x5bb9('0x1a')](_0x48c553[_0x5bb9('0x14')],{'raw':_0x48c553[_0x5bb9('0x15')]?_0x48c553[_0x5bb9('0x15')][_0x5bb9('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48c553[_0x5bb9('0x15')]?_0x48c553['options'][_0x5bb9('0x1b')]||null:null,'attributes':_0x48c553[_0x5bb9('0x15')]?_0x48c553['options'][_0x5bb9('0x1c')]||null:null,'limit':_0x48c553[_0x5bb9('0x15')]?_0x48c553[_0x5bb9('0x15')]['limit']||null:null})['then'](function(_0x10f2b9){logger[_0x5bb9('0x9')]('UpdateVoiceDialReport',_0x48c553);logger[_0x5bb9('0xc')](_0x5bb9('0x19'),_0x48c553,JSON[_0x5bb9('0x18')](_0x10f2b9));_0x4db9ae(_0x10f2b9);})[_0x5bb9('0x12')](function(_0x4d9902){logger['error']('UpdateVoiceDialReport',_0x4d9902['message'],_0x48c553);_0x4909ea(_0x2de62c['error'](0x1f4,_0x4d9902[_0x5bb9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5a3a276..7cc4a24 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 _0x5e01=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','put','update','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x560b59,_0x102048){var _0x31c2d1=function(_0xf16c23){while(--_0xf16c23){_0x560b59['push'](_0x560b59['shift']());}};_0x31c2d1(++_0x102048);}(_0x5e01,0x160));var _0x15e0=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x5e01[_0x28aea5];return _0x6a55f9;};'use strict';var multer=require(_0x15e0('0x0'));var util=require('util');var path=require(_0x15e0('0x1'));var timeout=require(_0x15e0('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x15e0('0x3'));var interaction=require(_0x15e0('0x4'));var config=require(_0x15e0('0x5'));var controller=require(_0x15e0('0x6'));router[_0x15e0('0x7')]('/',auth[_0x15e0('0x8')](),controller[_0x15e0('0x9')]);router['get'](_0x15e0('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x15e0('0xb')]('/',auth[_0x15e0('0x8')](),controller[_0x15e0('0xc')]);router[_0x15e0('0xb')](_0x15e0('0xd'),auth[_0x15e0('0x8')](),controller['addApplications']);router[_0x15e0('0xe')]('/:id',auth[_0x15e0('0x8')](),controller[_0x15e0('0xf')]);router['delete'](_0x15e0('0xa'),auth[_0x15e0('0x8')](),controller['destroy']);module[_0x15e0('0x10')]=router; \ No newline at end of file +var _0x9931=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','addApplications','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x47b0d9,_0x41b561){var _0x599df3=function(_0x4c0c30){while(--_0x4c0c30){_0x47b0d9['push'](_0x47b0d9['shift']());}};_0x599df3(++_0x41b561);}(_0x9931,0x1b6));var _0x1993=function(_0x22219c,_0x54f875){_0x22219c=_0x22219c-0x0;var _0x27c3f7=_0x9931[_0x22219c];return _0x27c3f7;};'use strict';var multer=require('multer');var util=require(_0x1993('0x0'));var path=require('path');var timeout=require(_0x1993('0x1'));var express=require(_0x1993('0x2'));var router=express[_0x1993('0x3')]();var auth=require(_0x1993('0x4'));var interaction=require(_0x1993('0x5'));var config=require(_0x1993('0x6'));var controller=require(_0x1993('0x7'));router[_0x1993('0x8')]('/',auth[_0x1993('0x9')](),controller[_0x1993('0xa')]);router[_0x1993('0x8')](_0x1993('0xb'),auth[_0x1993('0x9')](),controller[_0x1993('0xc')]);router[_0x1993('0xd')]('/',auth[_0x1993('0x9')](),controller[_0x1993('0xe')]);router['post']('/:id/applications',auth[_0x1993('0x9')](),controller[_0x1993('0xf')]);router[_0x1993('0x10')](_0x1993('0xb'),auth[_0x1993('0x9')](),controller[_0x1993('0x11')]);router[_0x1993('0x12')](_0x1993('0xb'),auth[_0x1993('0x9')](),controller[_0x1993('0x13')]);module[_0x1993('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 2fb5790..efde30b 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(_0x4a1bae,_0x586a09){var _0x10fd38=function(_0x260dcc){while(--_0x260dcc){_0x4a1bae['push'](_0x4a1bae['shift']());}};_0x10fd38(++_0x586a09);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x41173e,_0x233978){var _0x103b99=function(_0x785ea8){while(--_0x785ea8){_0x41173e['push'](_0x41173e['shift']());}};_0x103b99(++_0x233978);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 c471285..d71175f 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 _0x524e=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','findOne','sequelize','transaction','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','find','type','name','destroy','end','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','includeAll','include','show','params','catch','create','startsWith','body','exten','concat','user'];(function(_0x61074,_0x3ecd30){var _0x53434b=function(_0x55b924){while(--_0x55b924){_0x61074['push'](_0x61074['shift']());}};_0x53434b(++_0x3ecd30);}(_0x524e,0x15e));var _0xe524=function(_0x1be552,_0x482a7b){_0x1be552=_0x1be552-0x0;var _0x4044f6=_0x524e[_0x1be552];return _0x4044f6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];config[_0xe524('0x1c')]=_['defaults'](config['redis'],{'host':_0xe524('0x1d'),'port':0x18eb});var socket=require(_0xe524('0x1e'))(new Redis(config[_0xe524('0x1c')]));require(_0xe524('0x1f'))[_0xe524('0x20')](socket);function respondWithStatusCode(_0x57c1b6,_0x12ff75){_0x12ff75=_0x12ff75||0xcc;return function(_0x51e9fe){if(_0x51e9fe){return _0x57c1b6[_0xe524('0x21')](_0x12ff75);}return _0x57c1b6[_0xe524('0x22')](_0x12ff75)['end']();};}function respondWithResult(_0x569660,_0x488fce){_0x488fce=_0x488fce||0xc8;return function(_0x109795){if(_0x109795){return _0x569660['status'](_0x488fce)[_0xe524('0x23')](_0x109795);}};}function respondWithFilteredResult(_0x5f17fe,_0x5c8736){return function(_0x5a5c0d){if(_0x5a5c0d){var _0x3a4027=_0x5a5c0d[_0xe524('0x24')],_0x4f1dfb=_0x5c8736[_0xe524('0x25')],_0x11b2a1=_0x5c8736['offset']+_0x5c8736[_0xe524('0x26')],_0x238f8f;if(_0x11b2a1>=_0x3a4027){_0x11b2a1=_0x3a4027;_0x238f8f=0xc8;}else{_0x238f8f=0xce;}_0x5f17fe[_0xe524('0x22')](_0x238f8f);return _0x5f17fe['set'](_0xe524('0x27'),_0x4f1dfb+'-'+_0x11b2a1+'/'+_0x3a4027)[_0xe524('0x23')](_0x5a5c0d);}return null;};}function patchUpdates(_0x43a4f9){return function(_0x1dcc0f){try{jsonpatch[_0xe524('0x28')](_0x1dcc0f,_0x43a4f9,!![]);}catch(_0x1cab6c){return BPromise[_0xe524('0x29')](_0x1cab6c);}return _0x1dcc0f[_0xe524('0x2a')]();};}function saveUpdates(_0x7dfe97,_0x5c4d21){return function(_0x7d1f92){if(_0x7d1f92){return _0x7d1f92['update'](_0x7dfe97)['then'](function(_0x2d2f83){return _0x2d2f83;});}return null;};}function removeEntity(_0x23df5e,_0x1ad106){return function(_0x85fc51){if(_0x85fc51){return _0x85fc51['destroy']()[_0xe524('0x2b')](function(){var _0x4a03bc=_0x85fc51[_0xe524('0x2c')]({'plain':!![]});var _0xcf5db=[{'name':_0xe524('0x2d'),'value':_0xe524('0x2e'),'ignore':![]},{'name':_0xe524('0x2f'),'value':_0xe524('0x30'),'ignore':![]},{'name':_0xe524('0x31'),'value':'internal','ignore':![]}];var _0x58a896=_(_0xcf5db)[_0xe524('0x32')](_0xe524('0x33'))[_0xe524('0x34')](_0xe524('0x35'))[_0xe524('0x35')]();if(_['includes'](_0x58a896,_0x4a03bc['type'])){return;}var _0x4b1ff=_[_0xe524('0x36')](_0xcf5db,[_0xe524('0x35'),_0x4a03bc[_0xe524('0x37')]])[_0xe524('0x38')];return db['UserProfileResource'][_0xe524('0x39')]({'where':{'type':_0x4b1ff,'resourceId':_0x4a03bc['id']}})[_0xe524('0x2b')](function(){return _0x85fc51;});})['then'](function(){_0x23df5e['status'](0xcc)[_0xe524('0x3a')]();});}};}function handleEntityNotFound(_0x376324,_0x5b2fc3){return function(_0x31d4a7){if(!_0x31d4a7){_0x376324['sendStatus'](0x194);}return _0x31d4a7;};}function handleError(_0x3fec06,_0x54af2a){_0x54af2a=_0x54af2a||0x1f4;return function(_0x315e56){logger[_0xe524('0x3b')](_0x315e56[_0xe524('0x3c')]);if(_0x315e56['name']){delete _0x315e56[_0xe524('0x38')];}_0x3fec06['status'](_0x54af2a)[_0xe524('0x3d')](_0x315e56);};}exports[_0xe524('0x3e')]=function(_0x276343,_0x502256){var _0x16e124={},_0x119cc3={},_0x49c43e={'count':0x0,'rows':[]};var _0x27817e=_[_0xe524('0x34')](db[_0xe524('0x3f')][_0xe524('0x40')],function(_0x53560d){return{'name':_0x53560d[_0xe524('0x41')],'type':_0x53560d[_0xe524('0x37')][_0xe524('0x42')]};});_0x119cc3[_0xe524('0x43')]=_[_0xe524('0x34')](_0x27817e,_0xe524('0x38'));_0x119cc3[_0xe524('0x44')]=_[_0xe524('0x45')](_0x276343['query']);_0x119cc3[_0xe524('0x46')]=_['intersection'](_0x119cc3[_0xe524('0x43')],_0x119cc3[_0xe524('0x44')]);_0x16e124['attributes']=_[_0xe524('0x47')](_0x119cc3['model'],qs[_0xe524('0x48')](_0x276343[_0xe524('0x44')][_0xe524('0x48')]));_0x16e124[_0xe524('0x49')]=_0x16e124[_0xe524('0x49')][_0xe524('0x4a')]?_0x16e124[_0xe524('0x49')]:_0x119cc3[_0xe524('0x43')];if(!_0x276343['query'][_0xe524('0x4b')](_0xe524('0x4c'))){_0x16e124[_0xe524('0x26')]=qs[_0xe524('0x26')](_0x276343[_0xe524('0x44')][_0xe524('0x26')]);_0x16e124[_0xe524('0x25')]=qs[_0xe524('0x25')](_0x276343['query'][_0xe524('0x25')]);}_0x16e124[_0xe524('0x4d')]=qs[_0xe524('0x4e')](_0x276343['query'][_0xe524('0x4e')]);_0x16e124['where']=qs[_0xe524('0x46')](_[_0xe524('0x4f')](_0x276343[_0xe524('0x44')],_0x119cc3[_0xe524('0x46')]),_0x27817e);if(_0x276343[_0xe524('0x44')][_0xe524('0x32')]){_0x16e124[_0xe524('0x50')]=_['merge'](_0x16e124[_0xe524('0x50')],{'$or':_[_0xe524('0x34')](_0x27817e,function(_0x13c54c){if(_0x13c54c[_0xe524('0x37')]!==_0xe524('0x51')){var _0x1ae283={};_0x1ae283[_0x13c54c['name']]={'$like':'%'+_0x276343[_0xe524('0x44')][_0xe524('0x32')]+'%'};return _0x1ae283;}})});}_0x16e124=_[_0xe524('0x52')]({},_0x16e124,_0x276343['options']);var _0x21ea32={'where':_0x16e124['where']};return db['VoiceExtension'][_0xe524('0x24')](_0x21ea32)[_0xe524('0x2b')](function(_0x4da26f){_0x49c43e[_0xe524('0x24')]=_0x4da26f;if(_0x276343[_0xe524('0x44')][_0xe524('0x53')]){_0x16e124[_0xe524('0x54')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x16e124);})[_0xe524('0x2b')](function(_0x10aad6){_0x49c43e['rows']=_0x10aad6;return _0x49c43e;})[_0xe524('0x2b')](respondWithFilteredResult(_0x502256,_0x16e124))['catch'](handleError(_0x502256,null));};exports[_0xe524('0x55')]=function(_0x181680,_0x462b87){var _0x312c47={'raw':![],'where':{'id':_0x181680[_0xe524('0x56')]['id']}},_0xbde17b={};_0xbde17b[_0xe524('0x43')]=_[_0xe524('0x45')](db[_0xe524('0x3f')][_0xe524('0x40')]);_0xbde17b[_0xe524('0x44')]=_[_0xe524('0x45')](_0x181680[_0xe524('0x44')]);_0xbde17b[_0xe524('0x46')]=_[_0xe524('0x47')](_0xbde17b['model'],_0xbde17b[_0xe524('0x44')]);_0x312c47['attributes']=_['intersection'](_0xbde17b[_0xe524('0x43')],qs['fields'](_0x181680[_0xe524('0x44')][_0xe524('0x48')]));_0x312c47['attributes']=_0x312c47[_0xe524('0x49')]['length']?_0x312c47['attributes']:_0xbde17b[_0xe524('0x43')];if(_0x181680[_0xe524('0x44')][_0xe524('0x53')]){_0x312c47['include']=[{'all':!![]}];}_0x312c47=_['merge']({},_0x312c47,_0x181680['options']);return db['VoiceExtension']['find'](_0x312c47)['then'](handleEntityNotFound(_0x462b87,null))[_0xe524('0x2b')](respondWithResult(_0x462b87,null))[_0xe524('0x57')](handleError(_0x462b87,null));};exports['destroy']=function(_0x465fb5,_0x40b871){return db[_0xe524('0x3f')][_0xe524('0x36')]({'where':{'id':_0x465fb5[_0xe524('0x56')]['id']}})['then'](handleEntityNotFound(_0x40b871,null))[_0xe524('0x2b')](removeEntity(_0x40b871,null))[_0xe524('0x57')](handleError(_0x40b871,null));};exports[_0xe524('0x58')]=function(_0x494c39,_0x24f65b){if(_0x494c39['body'][_0xe524('0x37')]===_0xe524('0x30')&&!_[_0xe524('0x59')](_0x494c39[_0xe524('0x5a')][_0xe524('0x5b')],'_')){_0x494c39[_0xe524('0x5a')][_0xe524('0x5b')]='_'[_0xe524('0x5c')](_0x494c39[_0xe524('0x5a')][_0xe524('0x5b')]);}return db[_0xe524('0x3f')][_0xe524('0x58')](_0x494c39['body'],{'raw':![]})['then'](function(_0x4831fa){var _0xe49f84=_0x494c39[_0xe524('0x5d')][_0xe524('0x2c')]({'plain':!![]});if(!_0xe49f84)throw new Error(_0xe524('0x5e'));if(_0xe49f84[_0xe524('0x5f')]===_0xe524('0x5d')){var _0x33ae9d=_0x4831fa[_0xe524('0x2c')]({'plain':!![]});var _0x1e9006=[{'name':_0xe524('0x2d'),'value':_0xe524('0x2e')},{'name':'OutboundRoutes','value':_0xe524('0x30')},{'name':_0xe524('0x31'),'value':'internal'}];var _0x53da86=_['find'](_0x1e9006,['value',_0x33ae9d[_0xe524('0x37')]])[_0xe524('0x38')];return db[_0xe524('0x60')][_0xe524('0x36')]({'where':{'name':_0x53da86,'userProfileId':_0xe49f84['userProfileId']},'raw':!![]})[_0xe524('0x2b')](function(_0x244f08){if(_0x244f08&&_0x244f08[_0xe524('0x61')]===0x0){return db[_0xe524('0x62')]['create']({'name':_0x33ae9d['name'],'resourceId':_0x33ae9d['id'],'type':_0x244f08['name'],'sectionId':_0x244f08['id']},{})[_0xe524('0x2b')](function(){return _0x4831fa;});}else{return _0x4831fa;}})['catch'](function(_0x357418){logger[_0xe524('0x3b')](_0xe524('0x63'),_0x357418);throw _0x357418;});}return _0x4831fa;})[_0xe524('0x2b')](respondWithResult(_0x24f65b,0xc9))[_0xe524('0x57')](handleError(_0x24f65b,null));};exports['update']=function(_0x5d0507,_0x29a519){if(_0x5d0507[_0xe524('0x5a')]['id']){delete _0x5d0507[_0xe524('0x5a')]['id'];}return db[_0xe524('0x3f')][_0xe524('0x36')]({'where':{'id':_0x5d0507[_0xe524('0x56')]['id']}})['then'](handleEntityNotFound(_0x29a519,null))[_0xe524('0x2b')](function(_0x26160b){if(_0x26160b){return db[_0xe524('0x3f')]['update'](_[_0xe524('0x4f')](_0x5d0507[_0xe524('0x5a')],[_0xe524('0x5b'),'context','description',_0xe524('0x64'),_0xe524('0x65'),_0xe524('0x66')]),{'where':{'context':_0x26160b[_0xe524('0x67')],'exten':_0x26160b[_0xe524('0x5b')]},'individualHooks':!![]})['then'](function(_0xe102a0){return _0xe102a0;});}return null;})[_0xe524('0x2b')](respondWithStatusCode(_0x29a519,null))[_0xe524('0x57')](handleError(_0x29a519,null));};exports[_0xe524('0x68')]=function(_0x3ce098,_0x22d06a,_0x35e6b2){return db[_0xe524('0x3f')][_0xe524('0x69')]({'where':{'id':_0x3ce098[_0xe524('0x56')]['id']}})[_0xe524('0x2b')](handleEntityNotFound(_0x22d06a,null))['then'](function(_0x3cf9c2){if(_0x3cf9c2){return db[_0xe524('0x6a')][_0xe524('0x6b')](function(_0xfed246){return db[_0xe524('0x3f')]['destroy']({'where':{'VoiceExtensionId':_0x3ce098[_0xe524('0x56')]['id']},'transaction':_0xfed246})[_0xe524('0x2b')](function(_0x2ea4c9){var _0x32d11a=_[_0xe524('0x34')](_0x3ce098[_0xe524('0x5a')],function(_0x2a09f5){_0x2a09f5['VoiceExtensionId']=_0x3ce098[_0xe524('0x56')]['id'];return _0x2a09f5;});return db[_0xe524('0x3f')][_0xe524('0x6c')](_0x32d11a,{'transaction':_0xfed246});});})[_0xe524('0x2b')](function(){return db['VoiceExtension'][_0xe524('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3ce098['params']['id']},'order':_0xe524('0x6e')});});}})[_0xe524('0x2b')](respondWithResult(_0x22d06a,null))[_0xe524('0x57')](handleError(_0x22d06a,null));}; \ No newline at end of file +var _0xda2d=['nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','length','merge','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','InboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','then','stack','send','index','VoiceExtension','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda2d,0x102));var _0xdda2=function(_0x3d75d1,_0x252be9){_0x3d75d1=_0x3d75d1-0x0;var _0x415f69=_0xda2d[_0x3d75d1];return _0x415f69;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda2('0x0'));var rimraf=require(_0xdda2('0x1'));var zipdir=require(_0xdda2('0x2'));var jsonpatch=require(_0xdda2('0x3'));var rp=require(_0xdda2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdda2('0x5'));var path=require(_0xdda2('0x6'));var sox=require(_0xdda2('0x7'));var csv=require(_0xdda2('0x8'));var ejs=require(_0xdda2('0x9'));var fs=require('fs');var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xdda2('0x19')],{'host':_0xdda2('0x1a'),'port':0x18eb});var socket=require(_0xdda2('0x1b'))(new Redis(config[_0xdda2('0x19')]));require(_0xdda2('0x1c'))[_0xdda2('0x1d')](socket);function respondWithStatusCode(_0x3490f1,_0x4df902){_0x4df902=_0x4df902||0xcc;return function(_0x79c6d4){if(_0x79c6d4){return _0x3490f1['sendStatus'](_0x4df902);}return _0x3490f1[_0xdda2('0x1e')](_0x4df902)[_0xdda2('0x1f')]();};}function respondWithResult(_0x3553d5,_0x457764){_0x457764=_0x457764||0xc8;return function(_0x1922b1){if(_0x1922b1){return _0x3553d5['status'](_0x457764)['json'](_0x1922b1);}};}function respondWithFilteredResult(_0x43f67b,_0x518c6d){return function(_0x1a5192){if(_0x1a5192){var _0x1a3b35=_0x1a5192[_0xdda2('0x20')],_0x335fb5=_0x518c6d[_0xdda2('0x21')],_0x2b6ee8=_0x518c6d[_0xdda2('0x21')]+_0x518c6d[_0xdda2('0x22')],_0x8d44b7;if(_0x2b6ee8>=_0x1a3b35){_0x2b6ee8=_0x1a3b35;_0x8d44b7=0xc8;}else{_0x8d44b7=0xce;}_0x43f67b[_0xdda2('0x1e')](_0x8d44b7);return _0x43f67b[_0xdda2('0x23')](_0xdda2('0x24'),_0x335fb5+'-'+_0x2b6ee8+'/'+_0x1a3b35)['json'](_0x1a5192);}return null;};}function patchUpdates(_0x41fe7d){return function(_0x5dfce7){try{jsonpatch[_0xdda2('0x25')](_0x5dfce7,_0x41fe7d,!![]);}catch(_0x1a4db4){return BPromise[_0xdda2('0x26')](_0x1a4db4);}return _0x5dfce7['save']();};}function saveUpdates(_0x347ee6,_0x5a9bb8){return function(_0x425489){if(_0x425489){return _0x425489[_0xdda2('0x27')](_0x347ee6)['then'](function(_0x144f1e){return _0x144f1e;});}return null;};}function removeEntity(_0xfda248,_0x2528d7){return function(_0x13b0f3){if(_0x13b0f3){return _0x13b0f3[_0xdda2('0x28')]()['then'](function(){var _0x38cdf=_0x13b0f3[_0xdda2('0x29')]({'plain':!![]});var _0x2391a5=[{'name':_0xdda2('0x2a'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0xdda2('0x2b'),'ignore':![]},{'name':_0xdda2('0x2c'),'value':_0xdda2('0x2d'),'ignore':![]}];var _0x5e9e74=_(_0x2391a5)[_0xdda2('0x2e')](_0xdda2('0x2f'))[_0xdda2('0x30')](_0xdda2('0x31'))[_0xdda2('0x31')]();if(_[_0xdda2('0x32')](_0x5e9e74,_0x38cdf['type'])){return;}var _0x24c37d=_[_0xdda2('0x33')](_0x2391a5,['value',_0x38cdf[_0xdda2('0x34')]])[_0xdda2('0x35')];return db[_0xdda2('0x36')][_0xdda2('0x28')]({'where':{'type':_0x24c37d,'resourceId':_0x38cdf['id']}})['then'](function(){return _0x13b0f3;});})[_0xdda2('0x37')](function(){_0xfda248[_0xdda2('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ca9f3,_0x5edf7e){return function(_0x2b8cd6){if(!_0x2b8cd6){_0x1ca9f3['sendStatus'](0x194);}return _0x2b8cd6;};}function handleError(_0x53ff76,_0x510b7b){_0x510b7b=_0x510b7b||0x1f4;return function(_0x239c25){logger['error'](_0x239c25[_0xdda2('0x38')]);if(_0x239c25['name']){delete _0x239c25['name'];}_0x53ff76['status'](_0x510b7b)[_0xdda2('0x39')](_0x239c25);};}exports[_0xdda2('0x3a')]=function(_0xca6046,_0x2fd592){var _0x12e96d={},_0x644a24={},_0x2bcfba={'count':0x0,'rows':[]};var _0x1426fd=_[_0xdda2('0x30')](db[_0xdda2('0x3b')]['rawAttributes'],function(_0x461621){return{'name':_0x461621[_0xdda2('0x3c')],'type':_0x461621[_0xdda2('0x34')][_0xdda2('0x3d')]};});_0x644a24[_0xdda2('0x3e')]=_[_0xdda2('0x30')](_0x1426fd,_0xdda2('0x35'));_0x644a24['query']=_['keys'](_0xca6046[_0xdda2('0x3f')]);_0x644a24[_0xdda2('0x40')]=_[_0xdda2('0x41')](_0x644a24['model'],_0x644a24['query']);_0x12e96d[_0xdda2('0x42')]=_[_0xdda2('0x41')](_0x644a24[_0xdda2('0x3e')],qs[_0xdda2('0x43')](_0xca6046[_0xdda2('0x3f')]['fields']));_0x12e96d[_0xdda2('0x42')]=_0x12e96d[_0xdda2('0x42')]['length']?_0x12e96d['attributes']:_0x644a24[_0xdda2('0x3e')];if(!_0xca6046[_0xdda2('0x3f')][_0xdda2('0x44')](_0xdda2('0x45'))){_0x12e96d[_0xdda2('0x22')]=qs['limit'](_0xca6046[_0xdda2('0x3f')][_0xdda2('0x22')]);_0x12e96d[_0xdda2('0x21')]=qs[_0xdda2('0x21')](_0xca6046['query']['offset']);}_0x12e96d[_0xdda2('0x46')]=qs[_0xdda2('0x47')](_0xca6046[_0xdda2('0x3f')]['sort']);_0x12e96d[_0xdda2('0x48')]=qs['filters'](_[_0xdda2('0x49')](_0xca6046['query'],_0x644a24[_0xdda2('0x40')]),_0x1426fd);if(_0xca6046[_0xdda2('0x3f')][_0xdda2('0x2e')]){_0x12e96d[_0xdda2('0x48')]=_['merge'](_0x12e96d[_0xdda2('0x48')],{'$or':_['map'](_0x1426fd,function(_0x392f70){if(_0x392f70['type']!==_0xdda2('0x4a')){var _0x12589b={};_0x12589b[_0x392f70[_0xdda2('0x35')]]={'$like':'%'+_0xca6046[_0xdda2('0x3f')][_0xdda2('0x2e')]+'%'};return _0x12589b;}})});}_0x12e96d=_['merge']({},_0x12e96d,_0xca6046[_0xdda2('0x4b')]);var _0x15a616={'where':_0x12e96d['where']};return db[_0xdda2('0x3b')]['count'](_0x15a616)[_0xdda2('0x37')](function(_0x45c802){_0x2bcfba[_0xdda2('0x20')]=_0x45c802;if(_0xca6046[_0xdda2('0x3f')][_0xdda2('0x4c')]){_0x12e96d[_0xdda2('0x4d')]=[{'all':!![]}];}return db[_0xdda2('0x3b')][_0xdda2('0x4e')](_0x12e96d);})[_0xdda2('0x37')](function(_0x104a60){_0x2bcfba[_0xdda2('0x4f')]=_0x104a60;return _0x2bcfba;})[_0xdda2('0x37')](respondWithFilteredResult(_0x2fd592,_0x12e96d))[_0xdda2('0x50')](handleError(_0x2fd592,null));};exports['show']=function(_0x5cb8b5,_0x4fe8e8){var _0x36573e={'raw':![],'where':{'id':_0x5cb8b5['params']['id']}},_0x383536={};_0x383536[_0xdda2('0x3e')]=_[_0xdda2('0x51')](db[_0xdda2('0x3b')]['rawAttributes']);_0x383536[_0xdda2('0x3f')]=_[_0xdda2('0x51')](_0x5cb8b5['query']);_0x383536['filters']=_[_0xdda2('0x41')](_0x383536['model'],_0x383536[_0xdda2('0x3f')]);_0x36573e['attributes']=_[_0xdda2('0x41')](_0x383536[_0xdda2('0x3e')],qs['fields'](_0x5cb8b5['query'][_0xdda2('0x43')]));_0x36573e[_0xdda2('0x42')]=_0x36573e[_0xdda2('0x42')][_0xdda2('0x52')]?_0x36573e['attributes']:_0x383536[_0xdda2('0x3e')];if(_0x5cb8b5[_0xdda2('0x3f')][_0xdda2('0x4c')]){_0x36573e[_0xdda2('0x4d')]=[{'all':!![]}];}_0x36573e=_[_0xdda2('0x53')]({},_0x36573e,_0x5cb8b5['options']);return db[_0xdda2('0x3b')][_0xdda2('0x33')](_0x36573e)['then'](handleEntityNotFound(_0x4fe8e8,null))[_0xdda2('0x37')](respondWithResult(_0x4fe8e8,null))[_0xdda2('0x50')](handleError(_0x4fe8e8,null));};exports[_0xdda2('0x28')]=function(_0x2c2a4a,_0x161d7b){return db[_0xdda2('0x3b')]['find']({'where':{'id':_0x2c2a4a[_0xdda2('0x54')]['id']}})['then'](handleEntityNotFound(_0x161d7b,null))[_0xdda2('0x37')](removeEntity(_0x161d7b,null))['catch'](handleError(_0x161d7b,null));};exports[_0xdda2('0x55')]=function(_0x4df7cf,_0x3b5bbf){if(_0x4df7cf[_0xdda2('0x56')][_0xdda2('0x34')]===_0xdda2('0x2b')&&!_[_0xdda2('0x57')](_0x4df7cf[_0xdda2('0x56')][_0xdda2('0x58')],'_')){_0x4df7cf[_0xdda2('0x56')]['exten']='_'[_0xdda2('0x59')](_0x4df7cf[_0xdda2('0x56')][_0xdda2('0x58')]);}return db['VoiceExtension'][_0xdda2('0x55')](_0x4df7cf[_0xdda2('0x56')],{'raw':![]})['then'](function(_0x3868e7){var _0x5d9437=_0x4df7cf[_0xdda2('0x5a')][_0xdda2('0x29')]({'plain':!![]});if(!_0x5d9437)throw new Error(_0xdda2('0x5b'));if(_0x5d9437[_0xdda2('0x5c')]===_0xdda2('0x5a')){var _0x4fd561=_0x3868e7['get']({'plain':!![]});var _0x5c2cb2=[{'name':_0xdda2('0x2a'),'value':_0xdda2('0x5d')},{'name':'OutboundRoutes','value':_0xdda2('0x2b')},{'name':_0xdda2('0x2c'),'value':_0xdda2('0x2d')}];var _0x4b067e=_[_0xdda2('0x33')](_0x5c2cb2,[_0xdda2('0x31'),_0x4fd561[_0xdda2('0x34')]])['name'];return db[_0xdda2('0x5e')][_0xdda2('0x33')]({'where':{'name':_0x4b067e,'userProfileId':_0x5d9437[_0xdda2('0x5f')]},'raw':!![]})[_0xdda2('0x37')](function(_0x5d8602){if(_0x5d8602&&_0x5d8602[_0xdda2('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fd561['name'],'resourceId':_0x4fd561['id'],'type':_0x5d8602[_0xdda2('0x35')],'sectionId':_0x5d8602['id']},{})[_0xdda2('0x37')](function(){return _0x3868e7;});}else{return _0x3868e7;}})[_0xdda2('0x50')](function(_0x433cb0){logger[_0xdda2('0x61')](_0xdda2('0x62'),_0x433cb0);throw _0x433cb0;});}return _0x3868e7;})[_0xdda2('0x37')](respondWithResult(_0x3b5bbf,0xc9))[_0xdda2('0x50')](handleError(_0x3b5bbf,null));};exports[_0xdda2('0x27')]=function(_0x138c2f,_0x26e7de){if(_0x138c2f['body']['id']){delete _0x138c2f[_0xdda2('0x56')]['id'];}return db[_0xdda2('0x3b')][_0xdda2('0x33')]({'where':{'id':_0x138c2f[_0xdda2('0x54')]['id']}})[_0xdda2('0x37')](handleEntityNotFound(_0x26e7de,null))[_0xdda2('0x37')](function(_0x2affc6){if(_0x2affc6){return db['VoiceExtension'][_0xdda2('0x27')](_[_0xdda2('0x49')](_0x138c2f[_0xdda2('0x56')],[_0xdda2('0x58'),_0xdda2('0x63'),'description',_0xdda2('0x64'),_0xdda2('0x65'),_0xdda2('0x66')]),{'where':{'context':_0x2affc6[_0xdda2('0x63')],'exten':_0x2affc6[_0xdda2('0x58')]},'individualHooks':!![]})['then'](function(_0x17aaab){return _0x17aaab;});}return null;})[_0xdda2('0x37')](respondWithStatusCode(_0x26e7de,null))[_0xdda2('0x50')](handleError(_0x26e7de,null));};exports[_0xdda2('0x67')]=function(_0x1ac15a,_0x5d34d7,_0x29dd19){return db[_0xdda2('0x3b')][_0xdda2('0x68')]({'where':{'id':_0x1ac15a['params']['id']}})[_0xdda2('0x37')](handleEntityNotFound(_0x5d34d7,null))['then'](function(_0x3cc35c){if(_0x3cc35c){return db[_0xdda2('0x69')][_0xdda2('0x6a')](function(_0x5c351c){return db[_0xdda2('0x3b')][_0xdda2('0x28')]({'where':{'VoiceExtensionId':_0x1ac15a['params']['id']},'transaction':_0x5c351c})[_0xdda2('0x37')](function(_0x5adab5){var _0x3d645b=_[_0xdda2('0x30')](_0x1ac15a[_0xdda2('0x56')],function(_0x29cf1a){_0x29cf1a[_0xdda2('0x6b')]=_0x1ac15a['params']['id'];return _0x29cf1a;});return db['VoiceExtension'][_0xdda2('0x6c')](_0x3d645b,{'transaction':_0x5c351c});});})[_0xdda2('0x37')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1ac15a[_0xdda2('0x54')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xdda2('0x37')](respondWithResult(_0x5d34d7,null))[_0xdda2('0x50')](handleError(_0x5d34d7,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index be9438e..67341de 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 _0xc22b=['remove','emit','hasOwnProperty','hook','VoiceExtension','setMaxListeners','update'];(function(_0x272587,_0x4e5fb1){var _0x3c2ff6=function(_0x36b68d){while(--_0x36b68d){_0x272587['push'](_0x272587['shift']());}};_0x3c2ff6(++_0x4e5fb1);}(_0xc22b,0x1c4));var _0xbc22=function(_0x34321f,_0x8cf48b){_0x34321f=_0x34321f-0x0;var _0x43b7e2=_0xc22b[_0x34321f];return _0x43b7e2;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xbc22('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xbc22('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbc22('0x2'),'afterDestroy':_0xbc22('0x3')};function emitEvent(_0x31bff3){return function(_0x47af60,_0x446573,_0xb3259a){VoiceExtensionEvents[_0xbc22('0x4')](_0x31bff3+':'+_0x47af60['id'],_0x47af60);VoiceExtensionEvents[_0xbc22('0x4')](_0x31bff3,_0x47af60);_0xb3259a(null);};}for(var e in events){if(events[_0xbc22('0x5')](e)){var event=events[e];VoiceExtension[_0xbc22('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x9edb=['emit','hook','exports','events','../../mysqldb','VoiceExtension','save','update'];(function(_0x53721c,_0x248c6e){var _0xd36d24=function(_0x565d3f){while(--_0x565d3f){_0x53721c['push'](_0x53721c['shift']());}};_0xd36d24(++_0x248c6e);}(_0x9edb,0x7b));var _0xb9ed=function(_0x5dd30a,_0x483911){_0x5dd30a=_0x5dd30a-0x0;var _0x4616ee=_0x9edb[_0x5dd30a];return _0x4616ee;};'use strict';var EventEmitter=require(_0xb9ed('0x0'));var VoiceExtension=require(_0xb9ed('0x1'))['db'][_0xb9ed('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb9ed('0x3'),'afterUpdate':_0xb9ed('0x4'),'afterDestroy':'remove'};function emitEvent(_0x18cd4d){return function(_0x53e6f7,_0x13709f,_0x2b1fd9){VoiceExtensionEvents[_0xb9ed('0x5')](_0x18cd4d+':'+_0x53e6f7['id'],_0x53e6f7);VoiceExtensionEvents[_0xb9ed('0x5')](_0x18cd4d,_0x53e6f7);_0x2b1fd9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb9ed('0x6')](e,emitEvent(event));}}module[_0xb9ed('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index c6031a5..2e6f5b1 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 _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','VoiceExtension','voice_extensions','util','api','moment'];(function(_0x80eb66,_0x5a1622){var _0x24b084=function(_0x204535){while(--_0x204535){_0x80eb66['push'](_0x80eb66['shift']());}};_0x24b084(++_0x5a1622);}(_0xadb5,0xad));var _0x5adb=function(_0xc560aa,_0x337e3f){_0xc560aa=_0xc560aa-0x0;var _0x157adc=_0xadb5[_0xc560aa];return _0x157adc;};'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('./voiceExtension.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','VoiceExtension','voice_extensions','util','api','moment'];(function(_0x14e3c8,_0x195fdc){var _0x20c909=function(_0x33dad7){while(--_0x33dad7){_0x14e3c8['push'](_0x14e3c8['shift']());}};_0x20c909(++_0x195fdc);}(_0xadb5,0xad));var _0x5adb=function(_0x22cbd1,_0x22e94f){_0x22cbd1=_0x22cbd1-0x0;var _0x5af8c4=_0xadb5[_0x22cbd1];return _0x5af8c4;};'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('./voiceExtension.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/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 48e1cb5..130d91b 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 _0xae8a=['result','catch','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceExtension','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x381f58,_0x18e5f7){var _0x4c32ca=function(_0x117cf7){while(--_0x117cf7){_0x381f58['push'](_0x381f58['shift']());}};_0x4c32ca(++_0x18e5f7);}(_0xae8a,0x1c7));var _0xaae8=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xae8a[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xaae8('0x0'));var util=require(_0xaae8('0x1'));var moment=require(_0xaae8('0x2'));var BPromise=require(_0xaae8('0x3'));var rs=require(_0xaae8('0x4'));var fs=require('fs');var Redis=require(_0xaae8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaae8('0x6'));var logger=require('../../config/logger')(_0xaae8('0x7'));var config=require(_0xaae8('0x8'));var jayson=require(_0xaae8('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xaae8('0xa')]=_['defaults'](config['redis'],{'host':_0xaae8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaae8('0xc'))['register'](socket);function respondWithRpcPromise(_0x4a996c,_0x4cdda8,_0x3b67b2){return new BPromise(function(_0x33dec3,_0x2fe7e8){return client['request'](_0x4a996c,_0x3b67b2)[_0xaae8('0xd')](function(_0x1d4d23){logger[_0xaae8('0xe')](_0xaae8('0xf'),_0x4cdda8,_0xaae8('0x10'));logger[_0xaae8('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x4cdda8,'request\x20sent',JSON['stringify'](_0x1d4d23));if(_0x1d4d23[_0xaae8('0x12')]){if(_0x1d4d23[_0xaae8('0x12')][_0xaae8('0x13')]===0x1f4){logger[_0xaae8('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x4cdda8,_0x1d4d23['error'][_0xaae8('0x14')]);return _0x2fe7e8(_0x1d4d23[_0xaae8('0x12')]['message']);}logger[_0xaae8('0x12')](_0xaae8('0xf'),_0x4cdda8,_0x1d4d23[_0xaae8('0x12')][_0xaae8('0x14')]);return _0x33dec3(_0x1d4d23[_0xaae8('0x12')]['message']);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x4cdda8,_0xaae8('0x10'));_0x33dec3(_0x1d4d23[_0xaae8('0x15')][_0xaae8('0x14')]);}})[_0xaae8('0x16')](function(_0x508186){logger['error'](_0xaae8('0xf'),_0x4cdda8,_0x508186);_0x2fe7e8(_0x508186);});});}exports['GetVoiceExtension']=function(_0x55c2e9){var _0x228457=this;return new Promise(function(_0x3b5984,_0x5a4992){return db[_0xaae8('0x17')][_0xaae8('0x18')]({'raw':_0x55c2e9[_0xaae8('0x19')]?_0x55c2e9[_0xaae8('0x19')][_0xaae8('0x1a')]===undefined?!![]:![]:!![],'where':_0x55c2e9[_0xaae8('0x19')]?_0x55c2e9[_0xaae8('0x19')][_0xaae8('0x1b')]||null:null,'attributes':_0x55c2e9[_0xaae8('0x19')]?_0x55c2e9[_0xaae8('0x19')][_0xaae8('0x1c')]||null:null,'limit':_0x55c2e9['options']?_0x55c2e9[_0xaae8('0x19')][_0xaae8('0x1d')]||null:null,'include':_0x55c2e9[_0xaae8('0x19')]?_0x55c2e9[_0xaae8('0x19')][_0xaae8('0x1e')]?_[_0xaae8('0x1f')](_0x55c2e9['options']['include'],function(_0x4d34a3){return{'model':db[_0x4d34a3[_0xaae8('0x20')]],'as':_0x4d34a3['as'],'attributes':_0x4d34a3[_0xaae8('0x1c')],'include':_0x4d34a3[_0xaae8('0x1e')]?_[_0xaae8('0x1f')](_0x4d34a3[_0xaae8('0x1e')],function(_0x1bdfb9){return{'model':db[_0x1bdfb9[_0xaae8('0x20')]],'as':_0x1bdfb9['as'],'attributes':_0x1bdfb9[_0xaae8('0x1c')],'include':_0x1bdfb9[_0xaae8('0x1e')]?_[_0xaae8('0x1f')](_0x1bdfb9[_0xaae8('0x1e')],function(_0x21db26){return{'model':db[_0x21db26['model']],'as':_0x21db26['as'],'attributes':_0x21db26['attributes']};}):[]};}):[]};}):[]:[]})[_0xaae8('0xd')](function(_0x1881fa){logger[_0xaae8('0xe')]('GetVoiceExtension',_0x55c2e9);logger[_0xaae8('0x11')](_0xaae8('0x21'),_0x55c2e9,JSON['stringify'](_0x1881fa));_0x3b5984(_0x1881fa);})[_0xaae8('0x16')](function(_0x4d1296){logger['error'](_0xaae8('0x21'),_0x4d1296['message'],_0x55c2e9);_0x5a4992(_0x228457[_0xaae8('0x12')](0x1f4,_0x4d1296[_0xaae8('0x14')]));});});}; \ No newline at end of file +var _0x8ed9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','VoiceExtension','findAll','options','raw','where','map','include','model','attributes','GetVoiceExtension','stringify','catch','lodash','util'];(function(_0x42f57c,_0x579a36){var _0x30ea57=function(_0x4d149e){while(--_0x4d149e){_0x42f57c['push'](_0x42f57c['shift']());}};_0x30ea57(++_0x579a36);}(_0x8ed9,0x9a));var _0x98ed=function(_0x27998f,_0x3caf38){_0x27998f=_0x27998f-0x0;var _0x21b0ad=_0x8ed9[_0x27998f];return _0x21b0ad;};'use strict';var _=require(_0x98ed('0x0'));var util=require(_0x98ed('0x1'));var moment=require('moment');var BPromise=require(_0x98ed('0x2'));var rs=require(_0x98ed('0x3'));var fs=require('fs');var Redis=require(_0x98ed('0x4'));var db=require(_0x98ed('0x5'))['db'];var utils=require(_0x98ed('0x6'));var logger=require(_0x98ed('0x7'))(_0x98ed('0x8'));var config=require('../../config/environment');var jayson=require(_0x98ed('0x9'));var client=jayson['client'][_0x98ed('0xa')]({'port':0x232a});config[_0x98ed('0xb')]=_['defaults'](config[_0x98ed('0xb')],{'host':_0x98ed('0xc'),'port':0x18eb});var socket=require(_0x98ed('0xd'))(new Redis(config[_0x98ed('0xb')]));require(_0x98ed('0xe'))[_0x98ed('0xf')](socket);function respondWithRpcPromise(_0x3e65aa,_0x5987ea,_0x420a94){return new BPromise(function(_0x189c5b,_0x4b638b){return client[_0x98ed('0x10')](_0x3e65aa,_0x420a94)[_0x98ed('0x11')](function(_0x3c841e){logger['info'](_0x98ed('0x12'),_0x5987ea,'request\x20sent');logger[_0x98ed('0x13')](_0x98ed('0x14'),_0x5987ea,_0x98ed('0x15'),JSON['stringify'](_0x3c841e));if(_0x3c841e[_0x98ed('0x16')]){if(_0x3c841e['error'][_0x98ed('0x17')]===0x1f4){logger[_0x98ed('0x16')](_0x98ed('0x12'),_0x5987ea,_0x3c841e[_0x98ed('0x16')][_0x98ed('0x18')]);return _0x4b638b(_0x3c841e['error'][_0x98ed('0x18')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x5987ea,_0x3c841e['error'][_0x98ed('0x18')]);return _0x189c5b(_0x3c841e['error']['message']);}else{logger[_0x98ed('0x19')](_0x98ed('0x12'),_0x5987ea,_0x98ed('0x15'));_0x189c5b(_0x3c841e[_0x98ed('0x1a')][_0x98ed('0x18')]);}})['catch'](function(_0x5ab6fc){logger['error'](_0x98ed('0x12'),_0x5987ea,_0x5ab6fc);_0x4b638b(_0x5ab6fc);});});}exports['GetVoiceExtension']=function(_0x10b1c3){var _0x3b5d2e=this;return new Promise(function(_0x105a63,_0x3ddd33){return db[_0x98ed('0x1b')][_0x98ed('0x1c')]({'raw':_0x10b1c3[_0x98ed('0x1d')]?_0x10b1c3[_0x98ed('0x1d')][_0x98ed('0x1e')]===undefined?!![]:![]:!![],'where':_0x10b1c3[_0x98ed('0x1d')]?_0x10b1c3['options'][_0x98ed('0x1f')]||null:null,'attributes':_0x10b1c3[_0x98ed('0x1d')]?_0x10b1c3[_0x98ed('0x1d')]['attributes']||null:null,'limit':_0x10b1c3[_0x98ed('0x1d')]?_0x10b1c3['options']['limit']||null:null,'include':_0x10b1c3['options']?_0x10b1c3['options']['include']?_[_0x98ed('0x20')](_0x10b1c3['options'][_0x98ed('0x21')],function(_0x987fc5){return{'model':db[_0x987fc5[_0x98ed('0x22')]],'as':_0x987fc5['as'],'attributes':_0x987fc5[_0x98ed('0x23')],'include':_0x987fc5[_0x98ed('0x21')]?_[_0x98ed('0x20')](_0x987fc5[_0x98ed('0x21')],function(_0x52c22e){return{'model':db[_0x52c22e[_0x98ed('0x22')]],'as':_0x52c22e['as'],'attributes':_0x52c22e['attributes'],'include':_0x52c22e['include']?_[_0x98ed('0x20')](_0x52c22e[_0x98ed('0x21')],function(_0x59f353){return{'model':db[_0x59f353[_0x98ed('0x22')]],'as':_0x59f353['as'],'attributes':_0x59f353[_0x98ed('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x607a34){logger[_0x98ed('0x19')]('GetVoiceExtension',_0x10b1c3);logger['debug'](_0x98ed('0x24'),_0x10b1c3,JSON[_0x98ed('0x25')](_0x607a34));_0x105a63(_0x607a34);})[_0x98ed('0x26')](function(_0x2a6fad){logger[_0x98ed('0x16')](_0x98ed('0x24'),_0x2a6fad[_0x98ed('0x18')],_0x10b1c3);_0x3ddd33(_0x3b5d2e[_0x98ed('0x16')](0x1f4,_0x2a6fad[_0x98ed('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0e3f92c..e0b2961 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 _0x5dfe=['remove','update','emit','removeListener','register','voiceExtension:','./voiceExtension.events','save'];(function(_0x3ef490,_0xff3e7a){var _0x400885=function(_0x1ef8e2){while(--_0x1ef8e2){_0x3ef490['push'](_0x3ef490['shift']());}};_0x400885(++_0xff3e7a);}(_0x5dfe,0x15e));var _0xe5df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5dfe[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceExtensionEvents=require(_0xe5df('0x0'));var events=[_0xe5df('0x1'),_0xe5df('0x2'),_0xe5df('0x3')];function createListener(_0x27a00d,_0x5c5c34){return function(_0x4811ec){_0x5c5c34[_0xe5df('0x4')](_0x27a00d,_0x4811ec);};}function removeListener(_0x429c2c,_0xfd3f79){return function(){VoiceExtensionEvents[_0xe5df('0x5')](_0x429c2c,_0xfd3f79);};}exports[_0xe5df('0x6')]=function(_0x67b4fe){for(var _0x5c3375=0x0,_0x45947b=events['length'];_0x5c3375<_0x45947b;_0x5c3375++){var _0x48198e=events[_0x5c3375];var _0x8d7ebd=createListener(_0xe5df('0x7')+_0x48198e,_0x67b4fe);VoiceExtensionEvents['on'](_0x48198e,_0x8d7ebd);}}; \ No newline at end of file +var _0x6119=['save','update','emit','removeListener','length','voiceExtension:','./voiceExtension.events'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x6119,0xe6));var _0x9611=function(_0x407730,_0x30ca6c){_0x407730=_0x407730-0x0;var _0x299908=_0x6119[_0x407730];return _0x299908;};'use strict';var VoiceExtensionEvents=require(_0x9611('0x0'));var events=[_0x9611('0x1'),'remove',_0x9611('0x2')];function createListener(_0x4847c3,_0x54b751){return function(_0x4b4741){_0x54b751[_0x9611('0x3')](_0x4847c3,_0x4b4741);};}function removeListener(_0x171fa5,_0x582832){return function(){VoiceExtensionEvents[_0x9611('0x4')](_0x171fa5,_0x582832);};}exports['register']=function(_0x46651f){for(var _0x3e995c=0x0,_0x3bcb87=events[_0x9611('0x5')];_0x3e995c<_0x3bcb87;_0x3e995c++){var _0x4ae464=events[_0x3e995c];var _0x2a30a1=createListener(_0x9611('0x6')+_0x4ae464,_0x46651f);VoiceExtensionEvents['on'](_0x4ae464,_0x2a30a1);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 206fb89..d4fe03a 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 _0xce0a=['get','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated','index'];(function(_0x3e73ef,_0x1d6589){var _0x14be4a=function(_0x3844be){while(--_0x3844be){_0x3e73ef['push'](_0x3e73ef['shift']());}};_0x14be4a(++_0x1d6589);}(_0xce0a,0x1e4));var _0xace0=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0xce0a[_0x591cfd];return _0x4d0100;};'use strict';var multer=require('multer');var util=require(_0xace0('0x0'));var path=require(_0xace0('0x1'));var timeout=require(_0xace0('0x2'));var express=require(_0xace0('0x3'));var router=express[_0xace0('0x4')]();var auth=require(_0xace0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xace0('0x6'));var controller=require(_0xace0('0x7'));router['get']('/',auth[_0xace0('0x8')](),controller[_0xace0('0x9')]);router[_0xace0('0xa')]('/:id',auth[_0xace0('0x8')](),controller['show']);router[_0xace0('0xa')]('/:id/messages',auth[_0xace0('0x8')](),controller['getMessages']);router[_0xace0('0xb')]('/',auth[_0xace0('0x8')](),controller[_0xace0('0xc')]);router[_0xace0('0xd')](_0xace0('0xe'),auth[_0xace0('0x8')](),controller[_0xace0('0xf')]);router[_0xace0('0x10')]('/:id',auth[_0xace0('0x8')](),controller[_0xace0('0x11')]);module[_0xace0('0x12')]=router; \ No newline at end of file +var _0x9009=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','create','put','update','destroy','exports','multer'];(function(_0x3483eb,_0x1f5d3e){var _0x4f3867=function(_0x4730bf){while(--_0x4730bf){_0x3483eb['push'](_0x3483eb['shift']());}};_0x4f3867(++_0x1f5d3e);}(_0x9009,0x84));var _0x9900=function(_0x31970d,_0x313d50){_0x31970d=_0x31970d-0x0;var _0x47cd6a=_0x9009[_0x31970d];return _0x47cd6a;};'use strict';var multer=require(_0x9900('0x0'));var util=require(_0x9900('0x1'));var path=require(_0x9900('0x2'));var timeout=require(_0x9900('0x3'));var express=require(_0x9900('0x4'));var router=express['Router']();var auth=require(_0x9900('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9900('0x6'));var controller=require(_0x9900('0x7'));router[_0x9900('0x8')]('/',auth[_0x9900('0x9')](),controller[_0x9900('0xa')]);router[_0x9900('0x8')](_0x9900('0xb'),auth['isAuthenticated'](),controller[_0x9900('0xc')]);router[_0x9900('0x8')](_0x9900('0xd'),auth[_0x9900('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x9900('0xe')]);router[_0x9900('0xf')](_0x9900('0xb'),auth[_0x9900('0x9')](),controller[_0x9900('0x10')]);router['delete'](_0x9900('0xb'),auth[_0x9900('0x9')](),controller[_0x9900('0x11')]);module[_0x9900('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index eeb5dc2..ad8152e 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 _0x36ee=['trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','mailbox','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x564cf7,_0x26a298){var _0x1d0962=function(_0x5be2e8){while(--_0x5be2e8){_0x564cf7['push'](_0x564cf7['shift']());}};_0x1d0962(++_0x26a298);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0xe36e('0x0')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xe36e('0x1'),'unique':_0xe36e('0x2')},'mailbox':{'type':Sequelize[_0xe36e('0x0')],'defaultValue':'','allowNull':![],'unique':_0xe36e('0x2')},'password':{'type':Sequelize[_0xe36e('0x0')]},'fullname':{'type':Sequelize[_0xe36e('0x0')]},'email':{'type':Sequelize[_0xe36e('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3f29e1){this[_0xe36e('0x3')](_0xe36e('0x4'),typeof _0x3f29e1===_0xe36e('0x5')&&_0x3f29e1[_0xe36e('0x6')]()?_0x3f29e1['trim']():null);}},'pager':{'type':Sequelize[_0xe36e('0x0')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xe36e('0x7')},'attach':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':_0xe36e('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xe36e('0x0')]},'callback':{'type':Sequelize[_0xe36e('0x0')]},'review':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xe36e('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xe36e('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xe36e('0x9'),'no'),'defaultValue':_0xe36e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe36e('0x8')](_0xe36e('0x9'),'no'),'defaultValue':_0xe36e('0x9'),'allowNull':![]},'stamp':{'type':_0xe36e('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xe36e('0x0')]},'maxsecs':{'type':Sequelize[_0xe36e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xe36e('0xd')],'get':function(){return this['getDataValue'](_0xe36e('0xe'))+_0xe36e('0xf')+this['getDataValue'](_0xe36e('0x10'));}}}; \ No newline at end of file +var _0x4fc2=['mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20'];(function(_0x2a4693,_0x12ad8b){var _0x105c88=function(_0x4d7371){while(--_0x4d7371){_0x2a4693['push'](_0x2a4693['shift']());}};_0x105c88(++_0x12ad8b);}(_0x4fc2,0x111));var _0x24fc=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x4fc2[_0x3c2b2e];return _0x27a338;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'customer_id':{'type':Sequelize[_0x24fc('0x2')]},'context':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':'from-voicemail','unique':_0x24fc('0x3')},'mailbox':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':'','allowNull':![],'unique':_0x24fc('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x24fc('0x2')]},'email':{'type':Sequelize[_0x24fc('0x2')],'validate':{'isEmail':!![]},'set':function(_0x58dafc){this[_0x24fc('0x4')](_0x24fc('0x5'),typeof _0x58dafc==='string'&&_0x58dafc[_0x24fc('0x6')]()?_0x58dafc[_0x24fc('0x6')]():null);}},'pager':{'type':Sequelize[_0x24fc('0x2')]},'tz':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':_0x24fc('0x7')},'attach':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x24fc('0x2')]},'callback':{'type':Sequelize[_0x24fc('0x2')]},'review':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x24fc('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x24fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x24fc('0x8')](_0x24fc('0x9'),'no'),'defaultValue':_0x24fc('0x9'),'allowNull':![]},'stamp':{'type':_0x24fc('0xb')},'emailsubject':{'type':Sequelize[_0x24fc('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x24fc('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x24fc('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x24fc('0xd')],'get':function(){return this[_0x24fc('0xe')]('fullname')+_0x24fc('0xf')+this[_0x24fc('0xe')](_0x24fc('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index aeda3a0..60ea807 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 _0x423a=['includeAll','include','catch','params','rawAttributes','keys','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','hasOwnProperty','nolimit','mailbox','findAndCountAll','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','update','then','get','Voicemails','destroy','end','error','stack','name','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMail'];(function(_0x5731d0,_0xf174fa){var _0xb9de31=function(_0x5a4273){while(--_0x5a4273){_0x5731d0['push'](_0x5731d0['shift']());}};_0xb9de31(++_0xf174fa);}(_0x423a,0xb4));var _0xa423=function(_0x27f7c8,_0x2310a4){_0x27f7c8=_0x27f7c8-0x0;var _0x3bdb6c=_0x423a[_0x27f7c8];return _0x3bdb6c;};'use strict';var pdf=require(_0xa423('0x0'));var emlformat=require(_0xa423('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa423('0x2'));var rp=require(_0xa423('0x3'));var moment=require(_0xa423('0x4'));var BPromise=require(_0xa423('0x5'));var Mustache=require(_0xa423('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa423('0x7'));var csv=require(_0xa423('0x8'));var ejs=require(_0xa423('0x9'));var fs=require('fs');var _=require(_0xa423('0xa'));var squel=require(_0xa423('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa423('0xc'));var Papa=require(_0xa423('0xd'));var Redis=require(_0xa423('0xe'));var authService=require(_0xa423('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa423('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa423('0x11'))(_0xa423('0x12'));var utils=require(_0xa423('0x13'));var config=require(_0xa423('0x14'));var db=require(_0xa423('0x15'))['db'];function respondWithStatusCode(_0x39ce0c,_0x567599){_0x567599=_0x567599||0xcc;return function(_0x3011d3){if(_0x3011d3){return _0x39ce0c[_0xa423('0x16')](_0x567599);}return _0x39ce0c[_0xa423('0x17')](_0x567599)['end']();};}function respondWithResult(_0x144f2f,_0x160758){_0x160758=_0x160758||0xc8;return function(_0x372f3b){if(_0x372f3b){return _0x144f2f[_0xa423('0x17')](_0x160758)['json'](_0x372f3b);}};}function respondWithFilteredResult(_0x2149b1,_0x4c5beb){return function(_0x1d317d){if(_0x1d317d){var _0x2a887b=_0x1d317d[_0xa423('0x18')],_0xcb08e4=_0x4c5beb[_0xa423('0x19')],_0x3c84f3=_0x4c5beb[_0xa423('0x19')]+_0x4c5beb[_0xa423('0x1a')],_0x5d5021;if(_0x3c84f3>=_0x2a887b){_0x3c84f3=_0x2a887b;_0x5d5021=0xc8;}else{_0x5d5021=0xce;}_0x2149b1[_0xa423('0x17')](_0x5d5021);return _0x2149b1[_0xa423('0x1b')](_0xa423('0x1c'),_0xcb08e4+'-'+_0x3c84f3+'/'+_0x2a887b)[_0xa423('0x1d')](_0x1d317d);}return null;};}function patchUpdates(_0x886dc1){return function(_0x3f9f70){try{jsonpatch['apply'](_0x3f9f70,_0x886dc1,!![]);}catch(_0x48ab61){return BPromise[_0xa423('0x1e')](_0x48ab61);}return _0x3f9f70['save']();};}function saveUpdates(_0x2882c0,_0x36d2b5){return function(_0x3a90ec){if(_0x3a90ec){return _0x3a90ec[_0xa423('0x1f')](_0x2882c0)[_0xa423('0x20')](function(_0x133487){return _0x133487;});}return null;};}function removeEntity(_0xff9317,_0x1d81a4){return function(_0x34746e){if(_0x34746e){return _0x34746e['destroy']()['then'](function(){var _0x27f5a8=_0x34746e[_0xa423('0x21')]({'plain':!![]});var _0x524289=_0xa423('0x22');return db['UserProfileResource'][_0xa423('0x23')]({'where':{'type':_0x524289,'resourceId':_0x27f5a8['id']}})[_0xa423('0x20')](function(){return _0x34746e;});})['then'](function(){_0xff9317[_0xa423('0x17')](0xcc)[_0xa423('0x24')]();});}};}function handleEntityNotFound(_0x2e5104,_0x517a7a){return function(_0x133e94){if(!_0x133e94){_0x2e5104[_0xa423('0x16')](0x194);}return _0x133e94;};}function handleError(_0x31d867,_0x2a99d3){_0x2a99d3=_0x2a99d3||0x1f4;return function(_0x3d35c4){logger[_0xa423('0x25')](_0x3d35c4[_0xa423('0x26')]);if(_0x3d35c4[_0xa423('0x27')]){delete _0x3d35c4[_0xa423('0x27')];}_0x31d867[_0xa423('0x17')](_0x2a99d3)['send'](_0x3d35c4);};}exports['index']=function(_0xa4de69,_0x18003d){var _0x33e78a={},_0x29f226={},_0x58323c={'count':0x0,'rows':[]};var _0x337613=_[_0xa423('0x28')](db['VoiceMail']['rawAttributes'],function(_0x262217){return{'name':_0x262217[_0xa423('0x29')],'type':_0x262217[_0xa423('0x2a')][_0xa423('0x2b')]};});_0x29f226[_0xa423('0x2c')]=_['map'](_0x337613,_0xa423('0x27'));_0x29f226['query']=_['keys'](_0xa4de69[_0xa423('0x2d')]);_0x29f226[_0xa423('0x2e')]=_[_0xa423('0x2f')](_0x29f226[_0xa423('0x2c')],_0x29f226[_0xa423('0x2d')]);_0x33e78a[_0xa423('0x30')]=_[_0xa423('0x2f')](_0x29f226[_0xa423('0x2c')],qs['fields'](_0xa4de69[_0xa423('0x2d')][_0xa423('0x31')]));_0x33e78a[_0xa423('0x30')]=_0x33e78a[_0xa423('0x30')][_0xa423('0x32')]?_0x33e78a[_0xa423('0x30')]:_0x29f226[_0xa423('0x2c')];if(!_0xa4de69[_0xa423('0x2d')]['hasOwnProperty']('nolimit')){_0x33e78a[_0xa423('0x1a')]=qs[_0xa423('0x1a')](_0xa4de69[_0xa423('0x2d')]['limit']);_0x33e78a[_0xa423('0x19')]=qs[_0xa423('0x19')](_0xa4de69['query'][_0xa423('0x19')]);}_0x33e78a[_0xa423('0x33')]=qs[_0xa423('0x34')](_0xa4de69[_0xa423('0x2d')][_0xa423('0x34')]);_0x33e78a[_0xa423('0x35')]=qs[_0xa423('0x2e')](_[_0xa423('0x36')](_0xa4de69[_0xa423('0x2d')],_0x29f226[_0xa423('0x2e')]),_0x337613);if(_0xa4de69[_0xa423('0x2d')][_0xa423('0x37')]){_0x33e78a['where']=_[_0xa423('0x38')](_0x33e78a[_0xa423('0x35')],{'$or':_['map'](_0x337613,function(_0xefc586){if(_0xefc586[_0xa423('0x2a')]!==_0xa423('0x39')){var _0x51c799={};_0x51c799[_0xefc586[_0xa423('0x27')]]={'$like':'%'+_0xa4de69[_0xa423('0x2d')][_0xa423('0x37')]+'%'};return _0x51c799;}})});}_0x33e78a=_['merge']({},_0x33e78a,_0xa4de69[_0xa423('0x3a')]);var _0xba57c8={'where':_0x33e78a['where']};return db[_0xa423('0x3b')]['count'](_0xba57c8)['then'](function(_0x5917d3){_0x58323c[_0xa423('0x18')]=_0x5917d3;if(_0xa4de69[_0xa423('0x2d')][_0xa423('0x3c')]){_0x33e78a[_0xa423('0x3d')]=[{'all':!![]}];}return db[_0xa423('0x3b')]['findAll'](_0x33e78a);})[_0xa423('0x20')](function(_0x4d4969){_0x58323c['rows']=_0x4d4969;return _0x58323c;})[_0xa423('0x20')](respondWithFilteredResult(_0x18003d,_0x33e78a))[_0xa423('0x3e')](handleError(_0x18003d,null));};exports['show']=function(_0x249090,_0x1c9f96){var _0x5add3f={'raw':!![],'where':{'id':_0x249090[_0xa423('0x3f')]['id']}},_0x39afcb={};_0x39afcb[_0xa423('0x2c')]=_['keys'](db['VoiceMail'][_0xa423('0x40')]);_0x39afcb['query']=_[_0xa423('0x41')](_0x249090[_0xa423('0x2d')]);_0x39afcb[_0xa423('0x2e')]=_['intersection'](_0x39afcb[_0xa423('0x2c')],_0x39afcb['query']);_0x5add3f[_0xa423('0x30')]=_[_0xa423('0x2f')](_0x39afcb[_0xa423('0x2c')],qs[_0xa423('0x31')](_0x249090[_0xa423('0x2d')][_0xa423('0x31')]));_0x5add3f[_0xa423('0x30')]=_0x5add3f[_0xa423('0x30')]['length']?_0x5add3f['attributes']:_0x39afcb[_0xa423('0x2c')];if(_0x249090[_0xa423('0x2d')][_0xa423('0x3c')]){_0x5add3f[_0xa423('0x3d')]=[{'all':!![]}];}_0x5add3f=_[_0xa423('0x38')]({},_0x5add3f,_0x249090[_0xa423('0x3a')]);return db[_0xa423('0x3b')][_0xa423('0x42')](_0x5add3f)[_0xa423('0x20')](handleEntityNotFound(_0x1c9f96,null))[_0xa423('0x20')](respondWithResult(_0x1c9f96,null))[_0xa423('0x3e')](handleError(_0x1c9f96,null));};exports['create']=function(_0x2cf13c,_0x3dd7a7){return db[_0xa423('0x3b')]['create'](_0x2cf13c[_0xa423('0x43')],{})[_0xa423('0x20')](function(_0x2af369){var _0x1667c1=_0x2cf13c['user'][_0xa423('0x21')]({'plain':!![]});if(!_0x1667c1)throw new Error(_0xa423('0x44'));if(_0x1667c1[_0xa423('0x45')]===_0xa423('0x46')){var _0x9d44ba=_0x2af369[_0xa423('0x21')]({'plain':!![]});var _0x4d28a7=_0xa423('0x22');return db[_0xa423('0x47')][_0xa423('0x42')]({'where':{'name':_0x4d28a7,'userProfileId':_0x1667c1['userProfileId']},'raw':!![]})[_0xa423('0x20')](function(_0x5a726c){if(_0x5a726c&&_0x5a726c['autoAssociation']===0x0){return db[_0xa423('0x48')][_0xa423('0x49')]({'name':_0x9d44ba[_0xa423('0x27')],'resourceId':_0x9d44ba['id'],'type':_0x5a726c['name'],'sectionId':_0x5a726c['id']},{})[_0xa423('0x20')](function(){return _0x2af369;});}else{return _0x2af369;}})['catch'](function(_0x22bb27){logger[_0xa423('0x25')](_0xa423('0x4a'),_0x22bb27);throw _0x22bb27;});}return _0x2af369;})[_0xa423('0x20')](respondWithResult(_0x3dd7a7,0xc9))[_0xa423('0x3e')](handleError(_0x3dd7a7,null));};exports[_0xa423('0x1f')]=function(_0x39e80b,_0x3c94b3){if(_0x39e80b[_0xa423('0x43')]['id']){delete _0x39e80b[_0xa423('0x43')]['id'];}return db['VoiceMail'][_0xa423('0x42')]({'where':{'id':_0x39e80b[_0xa423('0x3f')]['id']}})[_0xa423('0x20')](handleEntityNotFound(_0x3c94b3,null))[_0xa423('0x20')](saveUpdates(_0x39e80b[_0xa423('0x43')],null))[_0xa423('0x20')](respondWithResult(_0x3c94b3,null))[_0xa423('0x3e')](handleError(_0x3c94b3,null));};exports[_0xa423('0x23')]=function(_0x4294f1,_0x5d845f){return db[_0xa423('0x3b')][_0xa423('0x42')]({'where':{'id':_0x4294f1['params']['id']}})['then'](handleEntityNotFound(_0x5d845f,null))[_0xa423('0x20')](removeEntity(_0x5d845f,null))[_0xa423('0x3e')](handleError(_0x5d845f,null));};exports['getMessages']=function(_0x34aaf7,_0x5ad58d,_0x4f49d6){return db['VoiceMail'][_0xa423('0x4b')]({'where':{'id':_0x34aaf7['params']['id']}})['then'](handleEntityNotFound(_0x5ad58d,null))[_0xa423('0x20')](function(_0x36e516){var _0x41b698;var _0x113f0b={},_0x4ee744={};_0x4ee744[_0xa423('0x2c')]=_[_0xa423('0x41')](db['VoiceMailMessage']['rawAttributes']);_0x4ee744[_0xa423('0x2d')]=_[_0xa423('0x41')](_0x34aaf7[_0xa423('0x2d')]);_0x4ee744[_0xa423('0x2e')]=_[_0xa423('0x2f')](_0x4ee744[_0xa423('0x2c')],_0x4ee744['query']);_0x113f0b[_0xa423('0x30')]=_[_0xa423('0x2f')](_0x4ee744['model'],qs[_0xa423('0x31')](_0x34aaf7[_0xa423('0x2d')][_0xa423('0x31')]));_0x113f0b[_0xa423('0x30')]=_0x113f0b[_0xa423('0x30')][_0xa423('0x32')]?_0x113f0b['attributes']:_0x4ee744[_0xa423('0x2c')];if(!_0x34aaf7[_0xa423('0x2d')][_0xa423('0x4c')](_0xa423('0x4d'))){_0x113f0b['limit']=qs[_0xa423('0x1a')](_0x34aaf7[_0xa423('0x2d')][_0xa423('0x1a')]);_0x113f0b[_0xa423('0x19')]=qs[_0xa423('0x19')](_0x34aaf7[_0xa423('0x2d')][_0xa423('0x19')]);}_0x113f0b['order']=qs[_0xa423('0x34')](_0x34aaf7[_0xa423('0x2d')][_0xa423('0x34')]);_0x113f0b[_0xa423('0x35')]=qs[_0xa423('0x2e')](_['pick'](_0x34aaf7[_0xa423('0x2d')],_0x4ee744['filters']));if(_0x34aaf7['query'][_0xa423('0x37')]){_0x113f0b[_0xa423('0x35')]=_['merge'](_0x113f0b[_0xa423('0x35')],{'$or':_[_0xa423('0x28')](_0x113f0b[_0xa423('0x30')],function(_0x46088b){var _0x1540d5={};_0x1540d5[_0x46088b]={'$like':'%'+_0x34aaf7['query']['filter']+'%'};return _0x1540d5;})});}_0x113f0b[_0xa423('0x35')]=_[_0xa423('0x38')](_0x113f0b[_0xa423('0x35')],{'mailboxuser':_0x36e516[_0xa423('0x4e')]});_0x113f0b=_[_0xa423('0x38')]({},_0x113f0b,_0x34aaf7['options']);return db['VoiceMailMessage'][_0xa423('0x4f')](_0x113f0b)['then'](respondWithFilteredResult(_0x5ad58d,_0x113f0b));})[_0xa423('0x3e')](handleError(_0x5ad58d,null));}; \ No newline at end of file +var _0x67a8=['merge','options','includeAll','include','catch','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','order','pick','mailbox','findAndCountAll','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','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL'];(function(_0x3fc36a,_0x463b5f){var _0x1eb364=function(_0x24c616){while(--_0x24c616){_0x3fc36a['push'](_0x3fc36a['shift']());}};_0x1eb364(++_0x463b5f);}(_0x67a8,0xbe));var _0x867a=function(_0x3735f9,_0x1ae262){_0x3735f9=_0x3735f9-0x0;var _0x1ad32=_0x67a8[_0x3735f9];return _0x1ad32;};'use strict';var pdf=require(_0x867a('0x0'));var emlformat=require(_0x867a('0x1'));var rimraf=require(_0x867a('0x2'));var zipdir=require(_0x867a('0x3'));var jsonpatch=require(_0x867a('0x4'));var rp=require(_0x867a('0x5'));var moment=require(_0x867a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x867a('0x7'));var util=require(_0x867a('0x8'));var path=require('path');var sox=require(_0x867a('0x9'));var csv=require(_0x867a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x867a('0xb'));var squel=require('squel');var crypto=require(_0x867a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x867a('0xd'));var toCsv=require(_0x867a('0xa'));var querystring=require(_0x867a('0xe'));var Papa=require(_0x867a('0xf'));var Redis=require(_0x867a('0x10'));var authService=require(_0x867a('0x11'));var qs=require(_0x867a('0x12'));var as=require(_0x867a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x867a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x867a('0x15'));var db=require(_0x867a('0x16'))['db'];function respondWithStatusCode(_0xb00eb3,_0x55f035){_0x55f035=_0x55f035||0xcc;return function(_0x40a272){if(_0x40a272){return _0xb00eb3[_0x867a('0x17')](_0x55f035);}return _0xb00eb3[_0x867a('0x18')](_0x55f035)['end']();};}function respondWithResult(_0x140f3a,_0x25817a){_0x25817a=_0x25817a||0xc8;return function(_0x19f00d){if(_0x19f00d){return _0x140f3a[_0x867a('0x18')](_0x25817a)[_0x867a('0x19')](_0x19f00d);}};}function respondWithFilteredResult(_0x196339,_0x467d04){return function(_0x20020d){if(_0x20020d){var _0x4121a0=_0x20020d[_0x867a('0x1a')],_0x5eb595=_0x467d04['offset'],_0x5baf21=_0x467d04[_0x867a('0x1b')]+_0x467d04[_0x867a('0x1c')],_0x3431bd;if(_0x5baf21>=_0x4121a0){_0x5baf21=_0x4121a0;_0x3431bd=0xc8;}else{_0x3431bd=0xce;}_0x196339[_0x867a('0x18')](_0x3431bd);return _0x196339[_0x867a('0x1d')]('Content-Range',_0x5eb595+'-'+_0x5baf21+'/'+_0x4121a0)[_0x867a('0x19')](_0x20020d);}return null;};}function patchUpdates(_0x31ebb){return function(_0x2a7ba9){try{jsonpatch[_0x867a('0x1e')](_0x2a7ba9,_0x31ebb,!![]);}catch(_0xa414b0){return BPromise['reject'](_0xa414b0);}return _0x2a7ba9[_0x867a('0x1f')]();};}function saveUpdates(_0x13a547,_0x30970f){return function(_0x14e457){if(_0x14e457){return _0x14e457[_0x867a('0x20')](_0x13a547)[_0x867a('0x21')](function(_0x39db43){return _0x39db43;});}return null;};}function removeEntity(_0x9100a1,_0x2fe8f5){return function(_0xd2946a){if(_0xd2946a){return _0xd2946a[_0x867a('0x22')]()['then'](function(){var _0x1e0811=_0xd2946a[_0x867a('0x23')]({'plain':!![]});var _0x32a7c9=_0x867a('0x24');return db[_0x867a('0x25')][_0x867a('0x22')]({'where':{'type':_0x32a7c9,'resourceId':_0x1e0811['id']}})[_0x867a('0x21')](function(){return _0xd2946a;});})[_0x867a('0x21')](function(){_0x9100a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e9b04,_0xf48860){return function(_0x203a0a){if(!_0x203a0a){_0x3e9b04['sendStatus'](0x194);}return _0x203a0a;};}function handleError(_0x5cfa0e,_0x144814){_0x144814=_0x144814||0x1f4;return function(_0x3a1fca){logger[_0x867a('0x26')](_0x3a1fca[_0x867a('0x27')]);if(_0x3a1fca[_0x867a('0x28')]){delete _0x3a1fca[_0x867a('0x28')];}_0x5cfa0e[_0x867a('0x18')](_0x144814)[_0x867a('0x29')](_0x3a1fca);};}exports[_0x867a('0x2a')]=function(_0x40ea00,_0x4c632a){var _0x18e897={},_0x342c84={},_0x5645da={'count':0x0,'rows':[]};var _0x44e7f5=_[_0x867a('0x2b')](db[_0x867a('0x2c')][_0x867a('0x2d')],function(_0x39bae9){return{'name':_0x39bae9[_0x867a('0x2e')],'type':_0x39bae9['type'][_0x867a('0x2f')]};});_0x342c84[_0x867a('0x30')]=_[_0x867a('0x2b')](_0x44e7f5,'name');_0x342c84[_0x867a('0x31')]=_['keys'](_0x40ea00[_0x867a('0x31')]);_0x342c84[_0x867a('0x32')]=_[_0x867a('0x33')](_0x342c84['model'],_0x342c84['query']);_0x18e897[_0x867a('0x34')]=_['intersection'](_0x342c84[_0x867a('0x30')],qs[_0x867a('0x35')](_0x40ea00[_0x867a('0x31')]['fields']));_0x18e897[_0x867a('0x34')]=_0x18e897[_0x867a('0x34')][_0x867a('0x36')]?_0x18e897[_0x867a('0x34')]:_0x342c84[_0x867a('0x30')];if(!_0x40ea00[_0x867a('0x31')][_0x867a('0x37')](_0x867a('0x38'))){_0x18e897[_0x867a('0x1c')]=qs['limit'](_0x40ea00['query']['limit']);_0x18e897['offset']=qs['offset'](_0x40ea00[_0x867a('0x31')][_0x867a('0x1b')]);}_0x18e897['order']=qs[_0x867a('0x39')](_0x40ea00[_0x867a('0x31')][_0x867a('0x39')]);_0x18e897[_0x867a('0x3a')]=qs[_0x867a('0x32')](_['pick'](_0x40ea00[_0x867a('0x31')],_0x342c84[_0x867a('0x32')]),_0x44e7f5);if(_0x40ea00[_0x867a('0x31')][_0x867a('0x3b')]){_0x18e897[_0x867a('0x3a')]=_['merge'](_0x18e897[_0x867a('0x3a')],{'$or':_[_0x867a('0x2b')](_0x44e7f5,function(_0x2ae6c5){if(_0x2ae6c5[_0x867a('0x3c')]!==_0x867a('0x3d')){var _0x2bfa80={};_0x2bfa80[_0x2ae6c5[_0x867a('0x28')]]={'$like':'%'+_0x40ea00[_0x867a('0x31')]['filter']+'%'};return _0x2bfa80;}})});}_0x18e897=_[_0x867a('0x3e')]({},_0x18e897,_0x40ea00[_0x867a('0x3f')]);var _0x7116ab={'where':_0x18e897[_0x867a('0x3a')]};return db[_0x867a('0x2c')][_0x867a('0x1a')](_0x7116ab)[_0x867a('0x21')](function(_0x312b71){_0x5645da[_0x867a('0x1a')]=_0x312b71;if(_0x40ea00[_0x867a('0x31')][_0x867a('0x40')]){_0x18e897[_0x867a('0x41')]=[{'all':!![]}];}return db[_0x867a('0x2c')]['findAll'](_0x18e897);})[_0x867a('0x21')](function(_0x4d3217){_0x5645da['rows']=_0x4d3217;return _0x5645da;})[_0x867a('0x21')](respondWithFilteredResult(_0x4c632a,_0x18e897))[_0x867a('0x42')](handleError(_0x4c632a,null));};exports['show']=function(_0x21792d,_0x3c4fb2){var _0x3aa658={'raw':!![],'where':{'id':_0x21792d[_0x867a('0x43')]['id']}},_0x45240f={};_0x45240f[_0x867a('0x30')]=_[_0x867a('0x44')](db[_0x867a('0x2c')][_0x867a('0x2d')]);_0x45240f[_0x867a('0x31')]=_[_0x867a('0x44')](_0x21792d[_0x867a('0x31')]);_0x45240f[_0x867a('0x32')]=_['intersection'](_0x45240f[_0x867a('0x30')],_0x45240f['query']);_0x3aa658[_0x867a('0x34')]=_[_0x867a('0x33')](_0x45240f[_0x867a('0x30')],qs['fields'](_0x21792d[_0x867a('0x31')][_0x867a('0x35')]));_0x3aa658['attributes']=_0x3aa658[_0x867a('0x34')][_0x867a('0x36')]?_0x3aa658[_0x867a('0x34')]:_0x45240f['model'];if(_0x21792d['query'][_0x867a('0x40')]){_0x3aa658[_0x867a('0x41')]=[{'all':!![]}];}_0x3aa658=_[_0x867a('0x3e')]({},_0x3aa658,_0x21792d[_0x867a('0x3f')]);return db[_0x867a('0x2c')]['find'](_0x3aa658)['then'](handleEntityNotFound(_0x3c4fb2,null))['then'](respondWithResult(_0x3c4fb2,null))[_0x867a('0x42')](handleError(_0x3c4fb2,null));};exports[_0x867a('0x45')]=function(_0x4ad9be,_0x1a5385){return db[_0x867a('0x2c')]['create'](_0x4ad9be[_0x867a('0x46')],{})[_0x867a('0x21')](function(_0x5ee37f){var _0x26ed4f=_0x4ad9be['user'][_0x867a('0x23')]({'plain':!![]});if(!_0x26ed4f)throw new Error(_0x867a('0x47'));if(_0x26ed4f[_0x867a('0x48')]===_0x867a('0x49')){var _0x5832a8=_0x5ee37f[_0x867a('0x23')]({'plain':!![]});var _0x330a5a='Voicemails';return db[_0x867a('0x4a')][_0x867a('0x4b')]({'where':{'name':_0x330a5a,'userProfileId':_0x26ed4f[_0x867a('0x4c')]},'raw':!![]})[_0x867a('0x21')](function(_0x279127){if(_0x279127&&_0x279127['autoAssociation']===0x0){return db['UserProfileResource'][_0x867a('0x45')]({'name':_0x5832a8['name'],'resourceId':_0x5832a8['id'],'type':_0x279127['name'],'sectionId':_0x279127['id']},{})[_0x867a('0x21')](function(){return _0x5ee37f;});}else{return _0x5ee37f;}})[_0x867a('0x42')](function(_0x1daf09){logger[_0x867a('0x26')](_0x867a('0x4d'),_0x1daf09);throw _0x1daf09;});}return _0x5ee37f;})[_0x867a('0x21')](respondWithResult(_0x1a5385,0xc9))['catch'](handleError(_0x1a5385,null));};exports['update']=function(_0x3e3614,_0x166b20){if(_0x3e3614[_0x867a('0x46')]['id']){delete _0x3e3614[_0x867a('0x46')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x3e3614[_0x867a('0x43')]['id']}})['then'](handleEntityNotFound(_0x166b20,null))['then'](saveUpdates(_0x3e3614[_0x867a('0x46')],null))['then'](respondWithResult(_0x166b20,null))['catch'](handleError(_0x166b20,null));};exports[_0x867a('0x22')]=function(_0x46045c,_0x1cf647){return db[_0x867a('0x2c')][_0x867a('0x4b')]({'where':{'id':_0x46045c[_0x867a('0x43')]['id']}})[_0x867a('0x21')](handleEntityNotFound(_0x1cf647,null))['then'](removeEntity(_0x1cf647,null))[_0x867a('0x42')](handleError(_0x1cf647,null));};exports[_0x867a('0x4e')]=function(_0x20362e,_0x178a39,_0x481d1d){return db['VoiceMail']['findOne']({'where':{'id':_0x20362e['params']['id']}})[_0x867a('0x21')](handleEntityNotFound(_0x178a39,null))[_0x867a('0x21')](function(_0x404d34){var _0x5e33f0;var _0x29b47f={},_0x4de071={};_0x4de071[_0x867a('0x30')]=_['keys'](db[_0x867a('0x4f')]['rawAttributes']);_0x4de071[_0x867a('0x31')]=_[_0x867a('0x44')](_0x20362e[_0x867a('0x31')]);_0x4de071['filters']=_[_0x867a('0x33')](_0x4de071[_0x867a('0x30')],_0x4de071[_0x867a('0x31')]);_0x29b47f[_0x867a('0x34')]=_[_0x867a('0x33')](_0x4de071[_0x867a('0x30')],qs[_0x867a('0x35')](_0x20362e[_0x867a('0x31')]['fields']));_0x29b47f[_0x867a('0x34')]=_0x29b47f[_0x867a('0x34')][_0x867a('0x36')]?_0x29b47f[_0x867a('0x34')]:_0x4de071[_0x867a('0x30')];if(!_0x20362e[_0x867a('0x31')]['hasOwnProperty'](_0x867a('0x38'))){_0x29b47f[_0x867a('0x1c')]=qs['limit'](_0x20362e['query'][_0x867a('0x1c')]);_0x29b47f[_0x867a('0x1b')]=qs['offset'](_0x20362e[_0x867a('0x31')][_0x867a('0x1b')]);}_0x29b47f[_0x867a('0x50')]=qs[_0x867a('0x39')](_0x20362e['query'][_0x867a('0x39')]);_0x29b47f[_0x867a('0x3a')]=qs[_0x867a('0x32')](_[_0x867a('0x51')](_0x20362e[_0x867a('0x31')],_0x4de071[_0x867a('0x32')]));if(_0x20362e[_0x867a('0x31')][_0x867a('0x3b')]){_0x29b47f[_0x867a('0x3a')]=_[_0x867a('0x3e')](_0x29b47f[_0x867a('0x3a')],{'$or':_['map'](_0x29b47f[_0x867a('0x34')],function(_0x10924a){var _0x4c6b50={};_0x4c6b50[_0x10924a]={'$like':'%'+_0x20362e[_0x867a('0x31')][_0x867a('0x3b')]+'%'};return _0x4c6b50;})});}_0x29b47f[_0x867a('0x3a')]=_[_0x867a('0x3e')](_0x29b47f['where'],{'mailboxuser':_0x404d34[_0x867a('0x52')]});_0x29b47f=_[_0x867a('0x3e')]({},_0x29b47f,_0x20362e[_0x867a('0x3f')]);return db[_0x867a('0x4f')][_0x867a('0x53')](_0x29b47f)[_0x867a('0x21')](respondWithFilteredResult(_0x178a39,_0x29b47f));})['catch'](handleError(_0x178a39,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index b68262c..6b864fd 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 _0x1cd9=['mailbox','context','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceMail','mailbox_context'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0x1cd9,0x1b4));var _0x91cd=function(_0x498e3e,_0x5cf823){_0x498e3e=_0x498e3e-0x0;var _0x247afb=_0x1cd9[_0x498e3e];return _0x247afb;};'use strict';var _=require(_0x91cd('0x0'));var util=require(_0x91cd('0x1'));var logger=require(_0x91cd('0x2'))('api');var moment=require(_0x91cd('0x3'));var BPromise=require(_0x91cd('0x4'));var rp=require(_0x91cd('0x5'));var fs=require('fs');var path=require(_0x91cd('0x6'));var rimraf=require(_0x91cd('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x91cd('0x8')]=function(_0x5cc40e,_0x289ae9){return _0x5cc40e[_0x91cd('0x9')](_0x91cd('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x91cd('0xb'),'fields':[_0x91cd('0xc'),_0x91cd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc14=['./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1acc01,_0x5cb80c){var _0x5603f1=function(_0x5e7558){while(--_0x5e7558){_0x1acc01['push'](_0x1acc01['shift']());}};_0x5603f1(++_0x5cb80c);}(_0xcc14,0x7f));var _0x4cc1=function(_0x24755a,_0x38f540){_0x24755a=_0x24755a-0x0;var _0x41ca80=_0xcc14[_0x24755a];return _0x41ca80;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4cc1('0x0'))(_0x4cc1('0x1'));var moment=require(_0x4cc1('0x2'));var BPromise=require(_0x4cc1('0x3'));var rp=require(_0x4cc1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4cc1('0x5'));module[_0x4cc1('0x6')]=function(_0x1a3578,_0x5dd8b6){return _0x1a3578[_0x4cc1('0x7')](_0x4cc1('0x8'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x4cc1('0x9'),'fields':[_0x4cc1('0xa'),_0x4cc1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8195310..e67b020 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 _0x9fad=['../../config/environment','jayson/promise','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x1b7721,_0x4abafe){var _0x123bc1=function(_0x190c97){while(--_0x190c97){_0x1b7721['push'](_0x1b7721['shift']());}};_0x123bc1(++_0x4abafe);}(_0x9fad,0x143));var _0xd9fa=function(_0x5f271d,_0x5ab21f){_0x5f271d=_0x5f271d-0x0;var _0x18f5f9=_0x9fad[_0x5f271d];return _0x18f5f9;};'use strict';var _=require(_0xd9fa('0x0'));var util=require(_0xd9fa('0x1'));var moment=require(_0xd9fa('0x2'));var BPromise=require(_0xd9fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd9fa('0x5'));var logger=require(_0xd9fa('0x6'))('rpc');var config=require(_0xd9fa('0x7'));var jayson=require(_0xd9fa('0x8'));var client=jayson['client'][_0xd9fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c7f9b,_0x2e3ea1,_0x200cda){return new BPromise(function(_0x5c5a3b,_0x1b98f6){return client['request'](_0x2c7f9b,_0x200cda)[_0xd9fa('0xa')](function(_0x715fc1){logger['info'](_0xd9fa('0xb'),_0x2e3ea1,_0xd9fa('0xc'));logger[_0xd9fa('0xd')](_0xd9fa('0xe'),_0x2e3ea1,'request\x20sent',JSON[_0xd9fa('0xf')](_0x715fc1));if(_0x715fc1[_0xd9fa('0x10')]){if(_0x715fc1[_0xd9fa('0x10')][_0xd9fa('0x11')]===0x1f4){logger['error'](_0xd9fa('0xb'),_0x2e3ea1,_0x715fc1['error'][_0xd9fa('0x12')]);return _0x1b98f6(_0x715fc1[_0xd9fa('0x10')]['message']);}logger[_0xd9fa('0x10')](_0xd9fa('0xb'),_0x2e3ea1,_0x715fc1[_0xd9fa('0x10')][_0xd9fa('0x12')]);return _0x5c5a3b(_0x715fc1[_0xd9fa('0x10')][_0xd9fa('0x12')]);}else{logger[_0xd9fa('0x13')](_0xd9fa('0xb'),_0x2e3ea1,_0xd9fa('0xc'));_0x5c5a3b(_0x715fc1[_0xd9fa('0x14')][_0xd9fa('0x12')]);}})[_0xd9fa('0x15')](function(_0x3a0d33){logger[_0xd9fa('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2e3ea1,_0x3a0d33);_0x1b98f6(_0x3a0d33);});});} \ No newline at end of file +var _0xb001=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','VoiceMail,\x20%s,\x20%s'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0xb001,0xbd));var _0x1b00=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb001[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x1b00('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1b00('0x1'));var fs=require('fs');var Redis=require(_0x1b00('0x2'));var db=require(_0x1b00('0x3'))['db'];var utils=require(_0x1b00('0x4'));var logger=require(_0x1b00('0x5'))(_0x1b00('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbfcd9a,_0x37789a,_0x165bc4){return new BPromise(function(_0x47ce6b,_0x48d18b){return client[_0x1b00('0x7')](_0xbfcd9a,_0x165bc4)[_0x1b00('0x8')](function(_0x4cf94e){logger[_0x1b00('0x9')](_0x1b00('0xa'),_0x37789a,'request\x20sent');logger[_0x1b00('0xb')](_0x1b00('0xc'),_0x37789a,_0x1b00('0xd'),JSON[_0x1b00('0xe')](_0x4cf94e));if(_0x4cf94e['error']){if(_0x4cf94e['error'][_0x1b00('0xf')]===0x1f4){logger['error'](_0x1b00('0xa'),_0x37789a,_0x4cf94e[_0x1b00('0x10')][_0x1b00('0x11')]);return _0x48d18b(_0x4cf94e['error'][_0x1b00('0x11')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x37789a,_0x4cf94e[_0x1b00('0x10')][_0x1b00('0x11')]);return _0x47ce6b(_0x4cf94e[_0x1b00('0x10')][_0x1b00('0x11')]);}else{logger[_0x1b00('0x9')]('VoiceMail,\x20%s,\x20%s',_0x37789a,_0x1b00('0xd'));_0x47ce6b(_0x4cf94e[_0x1b00('0x12')][_0x1b00('0x11')]);}})[_0x1b00('0x13')](function(_0x520f1e){logger[_0x1b00('0x10')](_0x1b00('0xa'),_0x37789a,_0x520f1e);_0x48d18b(_0x520f1e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index e1351e5..494609b 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 _0x9c5a=['get','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated'];(function(_0x1681ca,_0xfd3029){var _0x433f6c=function(_0x3fcc5d){while(--_0x3fcc5d){_0x1681ca['push'](_0x1681ca['shift']());}};_0x433f6c(++_0xfd3029);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x52293c,_0x7d71cd){_0x52293c=_0x52293c-0x0;var _0x4396e0=_0x9c5a[_0x52293c];return _0x4396e0;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var auth=require(_0xa9c5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa9c5('0x6'));var controller=require(_0xa9c5('0x7'));router['get']('/',auth[_0xa9c5('0x8')](),controller['index']);router[_0xa9c5('0x9')](_0xa9c5('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa9c5('0x9')](_0xa9c5('0xb'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0xd')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0xe')]);router[_0xa9c5('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa9c5('0x10')]);router[_0xa9c5('0x11')](_0xa9c5('0xa'),auth[_0xa9c5('0x8')](),controller[_0xa9c5('0x12')]);module[_0xa9c5('0x13')]=router; \ No newline at end of file +var _0xe14b=['update','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','download','post','create'];(function(_0x96dbf,_0x42f48a){var _0x43ce02=function(_0x5471ab){while(--_0x5471ab){_0x96dbf['push'](_0x96dbf['shift']());}};_0x43ce02(++_0x42f48a);}(_0xe14b,0x93));var _0xbe14=function(_0x590efc,_0x5e23b0){_0x590efc=_0x590efc-0x0;var _0x52524e=_0xe14b[_0x590efc];return _0x52524e;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['put']('/:id',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['delete'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);module[_0xbe14('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 61e81d9..b3488bb 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 _0x9c63=['exports','getDataValue','INTEGER','STRING','BLOB','long','sequelize'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x9c63,0x16b));var _0x39c6=function(_0x3f8c5d,_0x3e0286){_0x3f8c5d=_0x3f8c5d-0x0;var _0x4f45b4=_0x9c63[_0x3f8c5d];return _0x4f45b4;};'use strict';var Sequelize=require(_0x39c6('0x0'));module[_0x39c6('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2c039a){return this[_0x39c6('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x39c6('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x39c6('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x39c6('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x39c6('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x39c6('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x39c6('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x39c6('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x39c6('0x5')](_0x39c6('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x39c6('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x4a56=['TIMESTAMP','exports','VIRTUAL','getDataValue','STRING','BLOB','long'];(function(_0x122364,_0x318101){var _0x2a9d7c=function(_0x5efffa){while(--_0x5efffa){_0x122364['push'](_0x122364['shift']());}};_0x2a9d7c(++_0x318101);}(_0x4a56,0xe1));var _0x64a5=function(_0x23ef53,_0x12ca2f){_0x23ef53=_0x23ef53-0x0;var _0x3d3e10=_0x4a56[_0x23ef53];return _0x3d3e10;};'use strict';var Sequelize=require('sequelize');module[_0x64a5('0x0')]={'name':{'type':Sequelize[_0x64a5('0x1')],'get':function(_0x5e35ec){return this[_0x64a5('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x64a5('0x4')](_0x64a5('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x64a5('0x3')],'defaultValue':''},'stamp':{'type':_0x64a5('0x6'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c95a630..2637439 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 _0xad95=['hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','VoiceMailMessage','findAll','rows','show','params','rawAttributes','includeAll','catch','create','update','body','find','destroy','download','recording','msg_id','Sequelize','ValidationError','attachment','Content-Disposition','.wav\x22','html-pdf','eml-format','rimraf','request-promise','moment','util','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','set','Content-Range','apply','save','then','end','error','stack','name','send','map','fieldName','type','key','model','differenceBy','query','keys','intersection','fields','attributes','length'];(function(_0x585be3,_0x495b13){var _0x132590=function(_0x45e57c){while(--_0x45e57c){_0x585be3['push'](_0x585be3['shift']());}};_0x132590(++_0x495b13);}(_0xad95,0x70));var _0x5ad9=function(_0x2b3981,_0x1ca1aa){_0x2b3981=_0x2b3981-0x0;var _0x4cbfc8=_0xad95[_0x2b3981];return _0x4cbfc8;};'use strict';var pdf=require(_0x5ad9('0x0'));var emlformat=require(_0x5ad9('0x1'));var rimraf=require(_0x5ad9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ad9('0x3'));var moment=require(_0x5ad9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5ad9('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5ad9('0x6'));var squel=require(_0x5ad9('0x7'));var crypto=require(_0x5ad9('0x8'));var jsforce=require(_0x5ad9('0x9'));var deskjs=require(_0x5ad9('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5ad9('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ad9('0xc'));var qs=require(_0x5ad9('0xd'));var as=require(_0x5ad9('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ad9('0xf'))(_0x5ad9('0x10'));var utils=require('../../config/utils');var config=require(_0x5ad9('0x11'));var db=require(_0x5ad9('0x12'))['db'];function respondWithStatusCode(_0x329ed9,_0x3b2718){_0x3b2718=_0x3b2718||0xcc;return function(_0x262ce4){if(_0x262ce4){return _0x329ed9[_0x5ad9('0x13')](_0x3b2718);}return _0x329ed9['status'](_0x3b2718)['end']();};}function respondWithResult(_0x48253b,_0x431358){_0x431358=_0x431358||0xc8;return function(_0x4519ad){if(_0x4519ad){return _0x48253b['status'](_0x431358)[_0x5ad9('0x14')](_0x4519ad);}};}function respondWithFilteredResult(_0xcf9adc,_0x3f16ef){return function(_0x543743){if(_0x543743){var _0x3da125=_0x543743[_0x5ad9('0x15')],_0x32b0bd=_0x3f16ef[_0x5ad9('0x16')],_0x112d44=_0x3f16ef['offset']+_0x3f16ef[_0x5ad9('0x17')],_0x321c78;if(_0x112d44>=_0x3da125){_0x112d44=_0x3da125;_0x321c78=0xc8;}else{_0x321c78=0xce;}_0xcf9adc['status'](_0x321c78);return _0xcf9adc[_0x5ad9('0x18')](_0x5ad9('0x19'),_0x32b0bd+'-'+_0x112d44+'/'+_0x3da125)[_0x5ad9('0x14')](_0x543743);}return null;};}function patchUpdates(_0xb83249){return function(_0x1c5ab7){try{jsonpatch[_0x5ad9('0x1a')](_0x1c5ab7,_0xb83249,!![]);}catch(_0x110c04){return BPromise['reject'](_0x110c04);}return _0x1c5ab7[_0x5ad9('0x1b')]();};}function saveUpdates(_0x5885b5,_0x49363b){return function(_0x3356e5){if(_0x3356e5){return _0x3356e5['update'](_0x5885b5)[_0x5ad9('0x1c')](function(_0x36a2e9){return _0x36a2e9;});}return null;};}function removeEntity(_0x13e38c,_0xebbe63){return function(_0x1274f7){if(_0x1274f7){return _0x1274f7['destroy']()[_0x5ad9('0x1c')](function(){_0x13e38c['status'](0xcc)[_0x5ad9('0x1d')]();});}};}function handleEntityNotFound(_0x5b816d,_0x570d3c){return function(_0x524249){if(!_0x524249){_0x5b816d[_0x5ad9('0x13')](0x194);}return _0x524249;};}function handleError(_0x3701d8,_0x39a124){_0x39a124=_0x39a124||0x1f4;return function(_0x30b102){logger[_0x5ad9('0x1e')](_0x30b102[_0x5ad9('0x1f')]);if(_0x30b102[_0x5ad9('0x20')]){delete _0x30b102['name'];}_0x3701d8['status'](_0x39a124)[_0x5ad9('0x21')](_0x30b102);};}exports['index']=function(_0x3a2357,_0x584de3){var _0x346f35={},_0x55a0e4={},_0x58a156={'count':0x0,'rows':[]};var _0x243f82=_[_0x5ad9('0x22')](db['VoiceMailMessage']['rawAttributes'],function(_0x3942fa){return{'name':_0x3942fa[_0x5ad9('0x23')],'type':_0x3942fa[_0x5ad9('0x24')][_0x5ad9('0x25')]};});_0x55a0e4[_0x5ad9('0x26')]=_[_0x5ad9('0x27')](_['map'](_0x243f82,_0x5ad9('0x20')),[_0x5ad9('0x20')]);_0x55a0e4[_0x5ad9('0x28')]=_[_0x5ad9('0x29')](_0x3a2357['query']);_0x55a0e4['filters']=_[_0x5ad9('0x2a')](_0x55a0e4[_0x5ad9('0x26')],_0x55a0e4['query']);_0x346f35['attributes']=_['intersection'](_0x55a0e4[_0x5ad9('0x26')],qs[_0x5ad9('0x2b')](_0x3a2357['query'][_0x5ad9('0x2b')]));_0x346f35[_0x5ad9('0x2c')]=_0x346f35[_0x5ad9('0x2c')][_0x5ad9('0x2d')]?_0x346f35['attributes']:_0x55a0e4['model'];if(!_0x3a2357[_0x5ad9('0x28')][_0x5ad9('0x2e')](_0x5ad9('0x2f'))){_0x346f35[_0x5ad9('0x17')]=qs[_0x5ad9('0x17')](_0x3a2357['query'][_0x5ad9('0x17')]);_0x346f35[_0x5ad9('0x16')]=qs[_0x5ad9('0x16')](_0x3a2357[_0x5ad9('0x28')][_0x5ad9('0x16')]);}_0x346f35[_0x5ad9('0x30')]=qs['sort'](_0x3a2357[_0x5ad9('0x28')][_0x5ad9('0x31')]);_0x346f35['where']=qs[_0x5ad9('0x32')](_[_0x5ad9('0x33')](_0x3a2357['query'],_0x55a0e4[_0x5ad9('0x32')]),_0x243f82);if(_0x3a2357[_0x5ad9('0x28')][_0x5ad9('0x34')]){_0x346f35['where']=_[_0x5ad9('0x35')](_0x346f35[_0x5ad9('0x36')],{'$or':_[_0x5ad9('0x22')](_0x243f82,function(_0x234f92){if(_0x234f92['type']!==_0x5ad9('0x37')){var _0xf3301a={};_0xf3301a[_0x234f92[_0x5ad9('0x20')]]={'$like':'%'+_0x3a2357[_0x5ad9('0x28')][_0x5ad9('0x34')]+'%'};return _0xf3301a;}})});}_0x346f35=_[_0x5ad9('0x35')]({},_0x346f35,_0x3a2357[_0x5ad9('0x38')]);var _0x9219c6={'where':_0x346f35[_0x5ad9('0x36')]};return db['VoiceMailMessage'][_0x5ad9('0x15')](_0x9219c6)[_0x5ad9('0x1c')](function(_0x41d733){_0x58a156[_0x5ad9('0x15')]=_0x41d733;if(_0x3a2357[_0x5ad9('0x28')]['includeAll']){_0x346f35[_0x5ad9('0x39')]=[{'all':!![]}];}return db[_0x5ad9('0x3a')][_0x5ad9('0x3b')](_0x346f35);})['then'](function(_0x3d027a){_0x58a156[_0x5ad9('0x3c')]=_0x3d027a;return _0x58a156;})[_0x5ad9('0x1c')](respondWithFilteredResult(_0x584de3,_0x346f35))['catch'](handleError(_0x584de3,null));};exports[_0x5ad9('0x3d')]=function(_0x5cfe5b,_0x4fb3b9){var _0x77689e={'raw':!![],'where':{'id':_0x5cfe5b[_0x5ad9('0x3e')]['id']}},_0x34d201={};_0x34d201[_0x5ad9('0x26')]=_['keys'](db['VoiceMailMessage'][_0x5ad9('0x3f')]);_0x34d201['query']=_[_0x5ad9('0x29')](_0x5cfe5b['query']);_0x34d201[_0x5ad9('0x32')]=_['intersection'](_0x34d201[_0x5ad9('0x26')],_0x34d201[_0x5ad9('0x28')]);_0x77689e[_0x5ad9('0x2c')]=_[_0x5ad9('0x2a')](_0x34d201[_0x5ad9('0x26')],qs[_0x5ad9('0x2b')](_0x5cfe5b[_0x5ad9('0x28')][_0x5ad9('0x2b')]));_0x77689e[_0x5ad9('0x2c')]=_0x77689e['attributes'][_0x5ad9('0x2d')]?_0x77689e[_0x5ad9('0x2c')]:_0x34d201[_0x5ad9('0x26')];if(_0x5cfe5b[_0x5ad9('0x28')][_0x5ad9('0x40')]){_0x77689e['include']=[{'all':!![]}];}_0x77689e=_[_0x5ad9('0x35')]({},_0x77689e,_0x5cfe5b['options']);return db['VoiceMailMessage']['find'](_0x77689e)[_0x5ad9('0x1c')](handleEntityNotFound(_0x4fb3b9,null))[_0x5ad9('0x1c')](respondWithResult(_0x4fb3b9,null))[_0x5ad9('0x41')](handleError(_0x4fb3b9,null));};exports['create']=function(_0x39db4b,_0x21074f){return db[_0x5ad9('0x3a')][_0x5ad9('0x42')](_0x39db4b['body'],{})[_0x5ad9('0x1c')](respondWithResult(_0x21074f,0xc9))[_0x5ad9('0x41')](handleError(_0x21074f,null));};exports[_0x5ad9('0x43')]=function(_0x1920c7,_0x4fdbb6){if(_0x1920c7[_0x5ad9('0x44')]['id']){delete _0x1920c7[_0x5ad9('0x44')]['id'];}return db[_0x5ad9('0x3a')][_0x5ad9('0x45')]({'where':{'id':_0x1920c7[_0x5ad9('0x3e')]['id']}})[_0x5ad9('0x1c')](handleEntityNotFound(_0x4fdbb6,null))[_0x5ad9('0x1c')](saveUpdates(_0x1920c7['body'],null))[_0x5ad9('0x1c')](respondWithResult(_0x4fdbb6,null))['catch'](handleError(_0x4fdbb6,null));};exports[_0x5ad9('0x46')]=function(_0xb2cbc4,_0x9671da){return db[_0x5ad9('0x3a')][_0x5ad9('0x45')]({'where':{'id':_0xb2cbc4[_0x5ad9('0x3e')]['id']}})[_0x5ad9('0x1c')](handleEntityNotFound(_0x9671da,null))[_0x5ad9('0x1c')](removeEntity(_0x9671da,null))[_0x5ad9('0x41')](handleError(_0x9671da,null));};exports[_0x5ad9('0x47')]=function(_0x46e971,_0x2457aa,_0x2e99cb){return db[_0x5ad9('0x3a')][_0x5ad9('0x45')]({'where':{'id':_0x46e971['params']['id']},'attributes':['id',_0x5ad9('0x48'),_0x5ad9('0x49')]})[_0x5ad9('0x1c')](handleEntityNotFound(_0x2457aa,null))[_0x5ad9('0x1c')](function(_0x1c4f6e){if(_0x1c4f6e){if(!_0x1c4f6e[_0x5ad9('0x48')]){throw new db[(_0x5ad9('0x4a'))][(_0x5ad9('0x4b'))]('VoiceMailMessage\x20not\x20found');}var _0x2fc61a={'Content-Type':'audio/wav','Content-Disposition':_0x5ad9('0x4c')};if(_0x1c4f6e[_0x5ad9('0x49')]){_0x2fc61a[_0x5ad9('0x4d')]='attachment;\x20filename=\x22'+_0x1c4f6e[_0x5ad9('0x49')]+_0x5ad9('0x4e');}_0x2457aa[_0x5ad9('0x18')](_0x2fc61a);return _0x2457aa['send'](new Buffer(_0x1c4f6e[_0x5ad9('0x48')]));}})['catch'](handleError(_0x2457aa,null));}; \ No newline at end of file +var _0x8d05=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3cfd5f,_0x360ea1){var _0x3b1938=function(_0x47a79c){while(--_0x47a79c){_0x3cfd5f['push'](_0x3cfd5f['shift']());}};_0x3b1938(++_0x360ea1);}(_0x8d05,0xe8));var _0x58d0=function(_0x313903,_0x338dc6){_0x313903=_0x313903-0x0;var _0x4c6d4b=_0x8d05[_0x313903];return _0x4c6d4b;};'use strict';var pdf=require(_0x58d0('0x0'));var emlformat=require(_0x58d0('0x1'));var rimraf=require(_0x58d0('0x2'));var zipdir=require(_0x58d0('0x3'));var jsonpatch=require(_0x58d0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x58d0('0x5'));var Mustache=require(_0x58d0('0x6'));var util=require(_0x58d0('0x7'));var path=require(_0x58d0('0x8'));var sox=require('sox');var csv=require(_0x58d0('0x9'));var ejs=require(_0x58d0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x58d0('0xb'));var crypto=require('crypto');var jsforce=require(_0x58d0('0xc'));var deskjs=require(_0x58d0('0xd'));var toCsv=require(_0x58d0('0x9'));var querystring=require(_0x58d0('0xe'));var Papa=require(_0x58d0('0xf'));var Redis=require('ioredis');var authService=require(_0x58d0('0x10'));var qs=require(_0x58d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58d0('0x12'));var logger=require(_0x58d0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x58d0('0x14'));var db=require(_0x58d0('0x15'))['db'];function respondWithStatusCode(_0x85352e,_0x1efa0d){_0x1efa0d=_0x1efa0d||0xcc;return function(_0xf90244){if(_0xf90244){return _0x85352e[_0x58d0('0x16')](_0x1efa0d);}return _0x85352e[_0x58d0('0x17')](_0x1efa0d)[_0x58d0('0x18')]();};}function respondWithResult(_0x28adc0,_0x5d10d4){_0x5d10d4=_0x5d10d4||0xc8;return function(_0x15528b){if(_0x15528b){return _0x28adc0[_0x58d0('0x17')](_0x5d10d4)[_0x58d0('0x19')](_0x15528b);}};}function respondWithFilteredResult(_0x20b61b,_0x9f133a){return function(_0x1e92b7){if(_0x1e92b7){var _0x3d560f=_0x1e92b7[_0x58d0('0x1a')],_0x246f48=_0x9f133a[_0x58d0('0x1b')],_0x437721=_0x9f133a[_0x58d0('0x1b')]+_0x9f133a[_0x58d0('0x1c')],_0x49f232;if(_0x437721>=_0x3d560f){_0x437721=_0x3d560f;_0x49f232=0xc8;}else{_0x49f232=0xce;}_0x20b61b[_0x58d0('0x17')](_0x49f232);return _0x20b61b[_0x58d0('0x1d')](_0x58d0('0x1e'),_0x246f48+'-'+_0x437721+'/'+_0x3d560f)[_0x58d0('0x19')](_0x1e92b7);}return null;};}function patchUpdates(_0x1e4ca2){return function(_0x924f94){try{jsonpatch[_0x58d0('0x1f')](_0x924f94,_0x1e4ca2,!![]);}catch(_0x27796a){return BPromise[_0x58d0('0x20')](_0x27796a);}return _0x924f94[_0x58d0('0x21')]();};}function saveUpdates(_0x562a87,_0x3072f9){return function(_0x9ad72a){if(_0x9ad72a){return _0x9ad72a[_0x58d0('0x22')](_0x562a87)['then'](function(_0x1d3cb4){return _0x1d3cb4;});}return null;};}function removeEntity(_0x22a3c1,_0x412583){return function(_0x575b34){if(_0x575b34){return _0x575b34[_0x58d0('0x23')]()['then'](function(){_0x22a3c1['status'](0xcc)[_0x58d0('0x18')]();});}};}function handleEntityNotFound(_0x161bf5,_0x388772){return function(_0x6c0cd0){if(!_0x6c0cd0){_0x161bf5['sendStatus'](0x194);}return _0x6c0cd0;};}function handleError(_0xca616e,_0x28b6e2){_0x28b6e2=_0x28b6e2||0x1f4;return function(_0x281bf8){logger['error'](_0x281bf8[_0x58d0('0x24')]);if(_0x281bf8[_0x58d0('0x25')]){delete _0x281bf8['name'];}_0xca616e[_0x58d0('0x17')](_0x28b6e2)[_0x58d0('0x26')](_0x281bf8);};}exports[_0x58d0('0x27')]=function(_0x41f180,_0x3e16ea){var _0x5301d8={},_0x55c899={},_0x2593d4={'count':0x0,'rows':[]};var _0x18dec5=_[_0x58d0('0x28')](db[_0x58d0('0x29')][_0x58d0('0x2a')],function(_0x4bff4f){return{'name':_0x4bff4f[_0x58d0('0x2b')],'type':_0x4bff4f['type'][_0x58d0('0x2c')]};});_0x55c899[_0x58d0('0x2d')]=_[_0x58d0('0x2e')](_[_0x58d0('0x28')](_0x18dec5,'name'),[_0x58d0('0x25')]);_0x55c899[_0x58d0('0x2f')]=_[_0x58d0('0x30')](_0x41f180['query']);_0x55c899[_0x58d0('0x31')]=_[_0x58d0('0x32')](_0x55c899[_0x58d0('0x2d')],_0x55c899[_0x58d0('0x2f')]);_0x5301d8['attributes']=_[_0x58d0('0x32')](_0x55c899[_0x58d0('0x2d')],qs[_0x58d0('0x33')](_0x41f180[_0x58d0('0x2f')][_0x58d0('0x33')]));_0x5301d8['attributes']=_0x5301d8[_0x58d0('0x34')][_0x58d0('0x35')]?_0x5301d8[_0x58d0('0x34')]:_0x55c899[_0x58d0('0x2d')];if(!_0x41f180[_0x58d0('0x2f')][_0x58d0('0x36')](_0x58d0('0x37'))){_0x5301d8[_0x58d0('0x1c')]=qs[_0x58d0('0x1c')](_0x41f180[_0x58d0('0x2f')]['limit']);_0x5301d8[_0x58d0('0x1b')]=qs[_0x58d0('0x1b')](_0x41f180[_0x58d0('0x2f')][_0x58d0('0x1b')]);}_0x5301d8[_0x58d0('0x38')]=qs[_0x58d0('0x39')](_0x41f180[_0x58d0('0x2f')]['sort']);_0x5301d8['where']=qs[_0x58d0('0x31')](_[_0x58d0('0x3a')](_0x41f180['query'],_0x55c899[_0x58d0('0x31')]),_0x18dec5);if(_0x41f180[_0x58d0('0x2f')][_0x58d0('0x3b')]){_0x5301d8[_0x58d0('0x3c')]=_[_0x58d0('0x3d')](_0x5301d8['where'],{'$or':_['map'](_0x18dec5,function(_0x3b02cc){if(_0x3b02cc['type']!=='VIRTUAL'){var _0x489884={};_0x489884[_0x3b02cc[_0x58d0('0x25')]]={'$like':'%'+_0x41f180['query'][_0x58d0('0x3b')]+'%'};return _0x489884;}})});}_0x5301d8=_['merge']({},_0x5301d8,_0x41f180[_0x58d0('0x3e')]);var _0x5eb3d2={'where':_0x5301d8['where']};return db['VoiceMailMessage'][_0x58d0('0x1a')](_0x5eb3d2)[_0x58d0('0x3f')](function(_0x5d6655){_0x2593d4[_0x58d0('0x1a')]=_0x5d6655;if(_0x41f180['query'][_0x58d0('0x40')]){_0x5301d8[_0x58d0('0x41')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x58d0('0x42')](_0x5301d8);})['then'](function(_0x9cb078){_0x2593d4[_0x58d0('0x43')]=_0x9cb078;return _0x2593d4;})[_0x58d0('0x3f')](respondWithFilteredResult(_0x3e16ea,_0x5301d8))[_0x58d0('0x44')](handleError(_0x3e16ea,null));};exports[_0x58d0('0x45')]=function(_0x492262,_0x490e03){var _0x53b007={'raw':!![],'where':{'id':_0x492262[_0x58d0('0x46')]['id']}},_0x432cb6={};_0x432cb6['model']=_[_0x58d0('0x30')](db['VoiceMailMessage']['rawAttributes']);_0x432cb6[_0x58d0('0x2f')]=_[_0x58d0('0x30')](_0x492262[_0x58d0('0x2f')]);_0x432cb6[_0x58d0('0x31')]=_[_0x58d0('0x32')](_0x432cb6['model'],_0x432cb6['query']);_0x53b007['attributes']=_[_0x58d0('0x32')](_0x432cb6[_0x58d0('0x2d')],qs[_0x58d0('0x33')](_0x492262[_0x58d0('0x2f')][_0x58d0('0x33')]));_0x53b007[_0x58d0('0x34')]=_0x53b007[_0x58d0('0x34')]['length']?_0x53b007[_0x58d0('0x34')]:_0x432cb6[_0x58d0('0x2d')];if(_0x492262['query']['includeAll']){_0x53b007[_0x58d0('0x41')]=[{'all':!![]}];}_0x53b007=_[_0x58d0('0x3d')]({},_0x53b007,_0x492262[_0x58d0('0x3e')]);return db[_0x58d0('0x29')][_0x58d0('0x47')](_0x53b007)[_0x58d0('0x3f')](handleEntityNotFound(_0x490e03,null))[_0x58d0('0x3f')](respondWithResult(_0x490e03,null))[_0x58d0('0x44')](handleError(_0x490e03,null));};exports[_0x58d0('0x48')]=function(_0x53ad38,_0x34ee2b){return db[_0x58d0('0x29')]['create'](_0x53ad38['body'],{})[_0x58d0('0x3f')](respondWithResult(_0x34ee2b,0xc9))['catch'](handleError(_0x34ee2b,null));};exports[_0x58d0('0x22')]=function(_0x4f1681,_0x593526){if(_0x4f1681[_0x58d0('0x49')]['id']){delete _0x4f1681[_0x58d0('0x49')]['id'];}return db[_0x58d0('0x29')][_0x58d0('0x47')]({'where':{'id':_0x4f1681[_0x58d0('0x46')]['id']}})['then'](handleEntityNotFound(_0x593526,null))[_0x58d0('0x3f')](saveUpdates(_0x4f1681[_0x58d0('0x49')],null))[_0x58d0('0x3f')](respondWithResult(_0x593526,null))[_0x58d0('0x44')](handleError(_0x593526,null));};exports[_0x58d0('0x23')]=function(_0x5ddbb9,_0x550662){return db[_0x58d0('0x29')][_0x58d0('0x47')]({'where':{'id':_0x5ddbb9[_0x58d0('0x46')]['id']}})['then'](handleEntityNotFound(_0x550662,null))[_0x58d0('0x3f')](removeEntity(_0x550662,null))['catch'](handleError(_0x550662,null));};exports[_0x58d0('0x4a')]=function(_0x312e3b,_0x1c478a,_0x5a8e99){return db['VoiceMailMessage'][_0x58d0('0x47')]({'where':{'id':_0x312e3b[_0x58d0('0x46')]['id']},'attributes':['id',_0x58d0('0x4b'),'msg_id']})[_0x58d0('0x3f')](handleEntityNotFound(_0x1c478a,null))[_0x58d0('0x3f')](function(_0x48189c){if(_0x48189c){if(!_0x48189c['recording']){throw new db[(_0x58d0('0x4c'))][(_0x58d0('0x4d'))](_0x58d0('0x4e'));}var _0xd41afa={'Content-Type':_0x58d0('0x4f'),'Content-Disposition':_0x58d0('0x50')};if(_0x48189c[_0x58d0('0x51')]){_0xd41afa['Content-Disposition']=_0x58d0('0x52')+_0x48189c[_0x58d0('0x51')]+_0x58d0('0x53');}_0x1c478a[_0x58d0('0x1d')](_0xd41afa);return _0x1c478a['send'](new Buffer(_0x48189c[_0x58d0('0x4b')]));}})['catch'](handleError(_0x1c478a,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1a44774..76429f3 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 _0x6582=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x4df7b3,_0xc1cadb){var _0x3dd819=function(_0xcbf7df){while(--_0xcbf7df){_0x4df7b3['push'](_0x4df7b3['shift']());}};_0x3dd819(++_0xc1cadb);}(_0x6582,0x108));var _0x2658=function(_0x3e72da,_0x7909e3){_0x3e72da=_0x3e72da-0x0;var _0x20a27d=_0x6582[_0x3e72da];return _0x20a27d;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var logger=require(_0x2658('0x2'))(_0x2658('0x3'));var moment=require(_0x2658('0x4'));var BPromise=require('bluebird');var rp=require(_0x2658('0x5'));var fs=require('fs');var path=require(_0x2658('0x6'));var rimraf=require(_0x2658('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x2ef520,_0x1702bd){return _0x2ef520[_0x2658('0x8')](_0x2658('0x9'),attributes,{'tableName':_0x2658('0xa'),'paranoid':![],'indexes':[{'name':_0x2658('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x1ab1=['dir','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages'];(function(_0x27c804,_0x20e64b){var _0x41b537=function(_0xf195a2){while(--_0xf195a2){_0x27c804['push'](_0x27c804['shift']());}};_0x41b537(++_0x20e64b);}(_0x1ab1,0x83));var _0x11ab=function(_0x1814f3,_0x37ed7d){_0x1814f3=_0x1814f3-0x0;var _0x513cda=_0x1ab1[_0x1814f3];return _0x513cda;};'use strict';var _=require('lodash');var util=require(_0x11ab('0x0'));var logger=require(_0x11ab('0x1'))(_0x11ab('0x2'));var moment=require(_0x11ab('0x3'));var BPromise=require(_0x11ab('0x4'));var rp=require(_0x11ab('0x5'));var fs=require('fs');var path=require(_0x11ab('0x6'));var rimraf=require('rimraf');var config=require(_0x11ab('0x7'));var attributes=require(_0x11ab('0x8'));module[_0x11ab('0x9')]=function(_0x173e17,_0x643c32){return _0x173e17['define'](_0x11ab('0xa'),attributes,{'tableName':_0x11ab('0xb'),'paranoid':![],'indexes':[{'name':_0x11ab('0xc'),'fields':[_0x11ab('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 00ea529..df99a81 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(_0x3a96e2,_0x5ecb0f){var _0x2c1e1f=function(_0x1fc4b3){while(--_0x1fc4b3){_0x3a96e2['push'](_0x3a96e2['shift']());}};_0x2c1e1f(++_0x5ecb0f);}(_0xda2d,0x102));var _0xdda2=function(_0x407bbe,_0x1ca38b){_0x407bbe=_0x407bbe-0x0;var _0x52fb99=_0xda2d[_0x407bbe];return _0x52fb99;};'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 _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(_0x81d23e,_0x176dc5){var _0x1ec56d=function(_0x336238){while(--_0x336238){_0x81d23e['push'](_0x81d23e['shift']());}};_0x1ec56d(++_0x176dc5);}(_0xda2d,0x102));var _0xdda2=function(_0x233b33,_0x3a372f){_0x233b33=_0x233b33-0x0;var _0x3fee6a=_0xda2d[_0x233b33];return _0x3fee6a;};'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 diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 414a97a..cd65928 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 _0x4ad7=['isAuthenticated','index','/:id/sounds','getSounds','post','addSound','put','/:id','delete','destroy','/:id/sounds/:id2','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x8c31d4,_0x2e106e){var _0x32661f=function(_0xb8b031){while(--_0xb8b031){_0x8c31d4['push'](_0x8c31d4['shift']());}};_0x32661f(++_0x2e106e);}(_0x4ad7,0x110));var _0x74ad=function(_0x3d54ff,_0xee87b){_0x3d54ff=_0x3d54ff-0x0;var _0x256ea9=_0x4ad7[_0x3d54ff];return _0x256ea9;};'use strict';var multer=require(_0x74ad('0x0'));var util=require(_0x74ad('0x1'));var path=require('path');var timeout=require(_0x74ad('0x2'));var express=require(_0x74ad('0x3'));var router=express[_0x74ad('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x74ad('0x5'));var config=require(_0x74ad('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x74ad('0x7')]('/',auth[_0x74ad('0x8')](),controller[_0x74ad('0x9')]);router[_0x74ad('0x7')]('/:id',auth[_0x74ad('0x8')](),controller['show']);router[_0x74ad('0x7')](_0x74ad('0xa'),auth['isAuthenticated'](),controller[_0x74ad('0xb')]);router[_0x74ad('0xc')]('/',auth[_0x74ad('0x8')](),controller['create']);router[_0x74ad('0xc')]('/:id/sounds',auth[_0x74ad('0x8')](),controller[_0x74ad('0xd')]);router[_0x74ad('0xe')](_0x74ad('0xf'),auth[_0x74ad('0x8')](),controller['update']);router[_0x74ad('0x10')](_0x74ad('0xf'),auth[_0x74ad('0x8')](),controller[_0x74ad('0x11')]);router['delete'](_0x74ad('0x12'),auth[_0x74ad('0x8')](),controller['removeSound']);module[_0x74ad('0x13')]=router; \ No newline at end of file +var _0xe366=['getSounds','post','create','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','/:id/sounds'];(function(_0x335054,_0x44093e){var _0x3dc99e=function(_0x397506){while(--_0x397506){_0x335054['push'](_0x335054['shift']());}};_0x3dc99e(++_0x44093e);}(_0xe366,0x199));var _0x6e36=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xe366[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x6e36('0x0'));var util=require(_0x6e36('0x1'));var path=require(_0x6e36('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e36('0x3'));var router=express[_0x6e36('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6e36('0x5'));var config=require('../../config/environment');var controller=require(_0x6e36('0x6'));router[_0x6e36('0x7')]('/',auth[_0x6e36('0x8')](),controller['index']);router[_0x6e36('0x7')](_0x6e36('0x9'),auth[_0x6e36('0x8')](),controller['show']);router[_0x6e36('0x7')](_0x6e36('0xa'),auth['isAuthenticated'](),controller[_0x6e36('0xb')]);router[_0x6e36('0xc')]('/',auth['isAuthenticated'](),controller[_0x6e36('0xd')]);router[_0x6e36('0xc')](_0x6e36('0xa'),auth[_0x6e36('0x8')](),controller[_0x6e36('0xe')]);router['put'](_0x6e36('0x9'),auth[_0x6e36('0x8')](),controller[_0x6e36('0xf')]);router[_0x6e36('0x10')](_0x6e36('0x9'),auth[_0x6e36('0x8')](),controller[_0x6e36('0x11')]);router['delete'](_0x6e36('0x12'),auth['isAuthenticated'](),controller[_0x6e36('0x13')]);module[_0x6e36('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c5ce5ba..7df7891 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 _0x2205=['files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','exports','STRING','name','ENUM','custom'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2205,0x1b7));var _0x5220=function(_0xa39a8,_0x54030d){_0xa39a8=_0xa39a8-0x0;var _0x1534a9=_0x2205[_0xa39a8];return _0x1534a9;};'use strict';var Sequelize=require('sequelize');module[_0x5220('0x0')]={'name':{'type':Sequelize[_0x5220('0x1')],'allowNull':![],'unique':_0x5220('0x2')},'mode':{'type':Sequelize[_0x5220('0x3')](_0x5220('0x4'),_0x5220('0x5'),_0x5220('0x6'),_0x5220('0x7'),_0x5220('0x8'),_0x5220('0x9')),'allowNull':!![],'defaultValue':_0x5220('0x5')},'directory':{'type':Sequelize[_0x5220('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x5220('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5220('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5220('0x1')],'allowNull':!![],'defaultValue':_0x5220('0xa')},'format':{'type':Sequelize[_0x5220('0x1')],'allowNull':!![]},'stamp':{'type':_0x5220('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8c2e=['custom','files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x22abe7,_0x16ea1a){var _0x17fc4e=function(_0x487a19){while(--_0x487a19){_0x22abe7['push'](_0x22abe7['shift']());}};_0x17fc4e(++_0x16ea1a);}(_0x8c2e,0x17c));var _0xe8c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c2e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe8c2('0x0'));module[_0xe8c2('0x1')]={'name':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xe8c2('0x3')](_0xe8c2('0x4'),_0xe8c2('0x5'),_0xe8c2('0x6'),'quietmp3nb',_0xe8c2('0x7'),_0xe8c2('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':!![],'defaultValue':_0xe8c2('0x9')},'format':{'type':Sequelize[_0xe8c2('0x2')],'allowNull':!![]},'stamp':{'type':_0xe8c2('0xa')},'defaultEntry':{'type':Sequelize[_0xe8c2('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 477953c..0d4a98a 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 _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(_0x144050,_0x58d1ce){var _0x409f13=function(_0x2cbc80){while(--_0x2cbc80){_0x144050['push'](_0x144050['shift']());}};_0x409f13(++_0x58d1ce);}(_0x5f2f,0x73));var _0xf5f2=function(_0x30fe3a,_0x26a088){_0x30fe3a=_0x30fe3a-0x0;var _0x5a08d2=_0x5f2f[_0x30fe3a];return _0x5a08d2;};'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 +var _0xb10b=['stack','name','send','VoiceMusicOnHold','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','findOne','converted_format','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','Sequelize','removeSound','Sound','getSounds','rawAttributes','pick','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x239caf,_0xb45e6a){var _0x1813e0=function(_0x41da84){while(--_0x41da84){_0x239caf['push'](_0x239caf['shift']());}};_0x1813e0(++_0xb45e6a);}(_0xb10b,0x12a));var _0xbb10=function(_0x49155d,_0x2bb881){_0x49155d=_0x49155d-0x0;var _0x4c5f0f=_0xb10b[_0x49155d];return _0x4c5f0f;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x317da4=_0x8e2b97[_0xbb10('0x25')]({'plain':!![]});var _0x1824b7=_0xbb10('0x26');return db[_0xbb10('0x27')][_0xbb10('0x24')]({'where':{'type':_0x1824b7,'resourceId':_0x317da4['id']}})[_0xbb10('0x23')](function(){return _0x8e2b97;});})[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fedac,_0x4fb5e0){return function(_0xc93a04){if(!_0xc93a04){_0x4fedac[_0xbb10('0x18')](0x194);}return _0xc93a04;};}function handleError(_0x2c89b9,_0x4e25ff){_0x4e25ff=_0x4e25ff||0x1f4;return function(_0x2fdde9){logger[_0xbb10('0x28')](_0x2fdde9[_0xbb10('0x29')]);if(_0x2fdde9[_0xbb10('0x2a')]){delete _0x2fdde9[_0xbb10('0x2a')];}_0x2c89b9[_0xbb10('0x19')](_0x4e25ff)[_0xbb10('0x2b')](_0x2fdde9);};}exports['index']=function(_0x3796c7,_0x21ac54){var _0xfc3595={},_0x2e0249={},_0x1d30aa={'count':0x0,'rows':[]};var _0x2ff4c1=_['map'](db[_0xbb10('0x2c')]['rawAttributes'],function(_0x448d5c){return{'name':_0x448d5c['fieldName'],'type':_0x448d5c[_0xbb10('0x2d')][_0xbb10('0x2e')]};});_0x2e0249[_0xbb10('0x2f')]=_['map'](_0x2ff4c1,'name');_0x2e0249[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x3796c7['query']);_0x2e0249[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],_0x2e0249[_0xbb10('0x30')]);_0xfc3595[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x2e0249[_0xbb10('0x2f')],qs['fields'](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x35')]));_0xfc3595[_0xbb10('0x34')]=_0xfc3595[_0xbb10('0x34')][_0xbb10('0x36')]?_0xfc3595[_0xbb10('0x34')]:_0x2e0249[_0xbb10('0x2f')];if(!_0x3796c7[_0xbb10('0x30')][_0xbb10('0x37')]('nolimit')){_0xfc3595[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x1e')]);_0xfc3595['offset']=qs[_0xbb10('0x1d')](_0x3796c7['query']['offset']);}_0xfc3595[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x3796c7[_0xbb10('0x30')][_0xbb10('0x39')]);_0xfc3595[_0xbb10('0x3a')]=qs[_0xbb10('0x32')](_['pick'](_0x3796c7[_0xbb10('0x30')],_0x2e0249[_0xbb10('0x32')]),_0x2ff4c1);if(_0x3796c7['query']['filter']){_0xfc3595['where']=_[_0xbb10('0x3b')](_0xfc3595[_0xbb10('0x3a')],{'$or':_[_0xbb10('0x3c')](_0x2ff4c1,function(_0x4d5a9b){if(_0x4d5a9b[_0xbb10('0x2d')]!==_0xbb10('0x3d')){var _0x4345f3={};_0x4345f3[_0x4d5a9b['name']]={'$like':'%'+_0x3796c7[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4345f3;}})});}_0xfc3595=_[_0xbb10('0x3b')]({},_0xfc3595,_0x3796c7[_0xbb10('0x3f')]);var _0x4f1cdd={'where':_0xfc3595[_0xbb10('0x3a')]};return db[_0xbb10('0x2c')]['count'](_0x4f1cdd)[_0xbb10('0x23')](function(_0x2e3214){_0x1d30aa[_0xbb10('0x1c')]=_0x2e3214;if(_0x3796c7[_0xbb10('0x30')][_0xbb10('0x40')]){_0xfc3595[_0xbb10('0x41')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xbb10('0x42')](_0xfc3595);})[_0xbb10('0x23')](function(_0x3e7b4c){_0x1d30aa[_0xbb10('0x43')]=_0x3e7b4c;return _0x1d30aa;})['then'](respondWithFilteredResult(_0x21ac54,_0xfc3595))[_0xbb10('0x44')](handleError(_0x21ac54,null));};exports[_0xbb10('0x45')]=function(_0x23dc18,_0x403beb){var _0x5e2cfa={'raw':![],'where':{'id':_0x23dc18[_0xbb10('0x46')]['id']}},_0x351484={};_0x351484['model']=_['keys'](db[_0xbb10('0x2c')]['rawAttributes']);_0x351484[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x23dc18['query']);_0x351484[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],_0x351484['query']);_0x5e2cfa[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x351484[_0xbb10('0x2f')],qs[_0xbb10('0x35')](_0x23dc18[_0xbb10('0x30')][_0xbb10('0x35')]));_0x5e2cfa[_0xbb10('0x34')]=_0x5e2cfa[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5e2cfa[_0xbb10('0x34')]:_0x351484[_0xbb10('0x2f')];if(_0x23dc18[_0xbb10('0x30')]['includeAll']){_0x5e2cfa[_0xbb10('0x41')]=[{'all':!![]}];}_0x5e2cfa=_[_0xbb10('0x3b')]({},_0x5e2cfa,_0x23dc18['options']);return db[_0xbb10('0x2c')][_0xbb10('0x47')](_0x5e2cfa)[_0xbb10('0x23')](handleEntityNotFound(_0x403beb,null))[_0xbb10('0x23')](respondWithResult(_0x403beb,null))[_0xbb10('0x44')](handleError(_0x403beb,null));};exports[_0xbb10('0x48')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x44')](handleError(_0x5be85e,null));};exports[_0xbb10('0x4a')]=function(_0x22b315,_0x2f2552,_0x460788){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x550111){if(_0x22b315['body'][_0xbb10('0x4d')]===_0xbb10('0x4e')){_0x22b315[_0xbb10('0x49')][_0xbb10('0x4f')]=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x52'),_0x22b315[_0xbb10('0x49')][_0xbb10('0x2a')]);}return db[_0xbb10('0x2c')][_0xbb10('0x4a')](_0x22b315[_0xbb10('0x49')],{'transaction':_0x550111})[_0xbb10('0x23')](function(_0x2e6fd9){if(_0x22b315[_0xbb10('0x49')]['mode']===_0xbb10('0x4e')){fs['mkdirSync'](_0x2e6fd9[_0xbb10('0x4f')],parseInt(_0xbb10('0x53'),0x8));}var _0x1ffe20=_0x22b315[_0xbb10('0x54')][_0xbb10('0x25')]({'plain':!![]});if(!_0x1ffe20)throw new Error(_0xbb10('0x55'));if(_0x1ffe20[_0xbb10('0x56')]===_0xbb10('0x54')){var _0x180400=_0x2e6fd9[_0xbb10('0x25')]({'plain':!![]});return db[_0xbb10('0x57')][_0xbb10('0x47')]({'where':{'name':_0xbb10('0x26'),'userProfileId':_0x1ffe20[_0xbb10('0x58')]},'raw':!![]})[_0xbb10('0x23')](function(_0x5de0cc){if(_0x5de0cc&&_0x5de0cc[_0xbb10('0x59')]===0x0){return db[_0xbb10('0x27')][_0xbb10('0x4a')]({'name':_0x180400[_0xbb10('0x2a')],'resourceId':_0x180400['id'],'type':_0x5de0cc[_0xbb10('0x2a')],'sectionId':_0x5de0cc['id']},{})[_0xbb10('0x23')](function(){return _0x2e6fd9;});}else{return _0x2e6fd9;}})['catch'](function(_0x120bda){logger[_0xbb10('0x28')](_0xbb10('0x5a'),_0x120bda);});}return _0x2e6fd9;});})[_0xbb10('0x23')](respondWithResult(_0x2f2552,0xc9))[_0xbb10('0x44')](handleError(_0x2f2552,null));};exports[_0xbb10('0x24')]=function(_0x175872,_0x12ec18,_0x205e01){var _0x40c4fb;return db[_0xbb10('0x2c')][_0xbb10('0x47')]({'where':{'id':_0x175872[_0xbb10('0x46')]['id']}})['then'](function(_0x4ea1a6){if(_0x4ea1a6){return db[_0xbb10('0x4b')][_0xbb10('0x4c')](function(_0x3d0cb7){return _0x4ea1a6[_0xbb10('0x24')]({'transaction':_0x3d0cb7,'raw':!![]})['then'](function(_0x506498){if(_0x506498[_0xbb10('0x4f')]){fs[_0xbb10('0x5b')](_0x506498[_0xbb10('0x4f')])[_0xbb10('0x5c')](function(_0x412f13){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x506498['directory'],_0x412f13));});fs[_0xbb10('0x5e')](_0x506498[_0xbb10('0x4f')]);}return _0x506498;});})['catch'](function(_0x5e03cb){throw new db['Sequelize'][(_0xbb10('0x5f'))](_0x5e03cb[_0xbb10('0x60')]);});}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))['then'](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['addSound']=function(_0x3ebc5f,_0x249b33,_0x45167a){return db['sequelize'][_0xbb10('0x4c')](function(_0x13131c){var _0x5a6538;return db['VoiceMusicOnHold'][_0xbb10('0x47')]({'where':{'id':_0x3ebc5f[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x5a6538=_0x237246;return _0x237246['addSound'](_0x3ebc5f[_0xbb10('0x49')]['id'],{'transaction':_0x13131c});}})[_0xbb10('0x23')](function(_0xa7179d){if(_0xa7179d){return db['Sound'][_0xbb10('0x61')]({'where':{'id':_0x3ebc5f[_0xbb10('0x49')]['id']},'attributes':['id',_0xbb10('0x2a'),'save_name',_0xbb10('0x62'),_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x37b65f){if(_0x37b65f){var _0x5e4a6e=path[_0xbb10('0x50')](config[_0xbb10('0x51')],_0xbb10('0x64'),util[_0xbb10('0x65')]('%s.%s',path[_0xbb10('0x66')](_0x37b65f[_0xbb10('0x67')],path[_0xbb10('0x68')](_0x37b65f[_0xbb10('0x67')])),_0x37b65f[_0xbb10('0x62')]));var _0x17807e=path[_0xbb10('0x50')](config['root'],'server/files/moh',_0x5a6538['name'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x37b65f[_0xbb10('0x2a')],_0x37b65f['converted_format']));fs['symlinkSync'](_0x5e4a6e,_0x17807e);return _0x37b65f;}})[_0xbb10('0x44')](function(_0x1b11c0){throw new db[(_0xbb10('0x6a'))][(_0xbb10('0x5f'))](_0x1b11c0[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x249b33,null))['then'](respondWithResult(_0x249b33,0xc9))[_0xbb10('0x44')](handleError(_0x249b33,null));};exports[_0xbb10('0x6b')]=function(_0x270fdb,_0x14f16b,_0x2aaaa6){return db['sequelize']['transaction'](function(_0x5ad6ad){var _0x329da7;return db[_0xbb10('0x2c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](function(_0x5d942d){if(_0x5d942d){_0x329da7=_0x5d942d;return _0x5d942d[_0xbb10('0x6b')](_0x270fdb['params']['id2']);}})['then'](function(_0xdf634f){if(_0xdf634f){return db[_0xbb10('0x6c')][_0xbb10('0x61')]({'where':{'id':_0x270fdb[_0xbb10('0x46')]['id2']},'attributes':['id',_0xbb10('0x2a'),'save_name','converted_format',_0xbb10('0x63')],'raw':!![]});}})[_0xbb10('0x23')](function(_0x29529c){if(_0x29529c){fs[_0xbb10('0x5d')](path[_0xbb10('0x50')](_0x329da7['directory'],util[_0xbb10('0x65')](_0xbb10('0x69'),_0x29529c[_0xbb10('0x2a')],_0x29529c[_0xbb10('0x62')])));return _0x29529c;}})[_0xbb10('0x44')](function(_0x27f42f){throw new db[(_0xbb10('0x6a'))]['ValidationError'](_0x27f42f[_0xbb10('0x60')]);});})[_0xbb10('0x23')](handleEntityNotFound(_0x14f16b,null))[_0xbb10('0x23')](respondWithStatusCode(_0x14f16b,0xcc))[_0xbb10('0x44')](handleError(_0x14f16b,null));};exports[_0xbb10('0x6d')]=function(_0x172be3,_0xa3b23,_0x312a08){var _0x5a4429={};var _0x428146={};var _0x218690;var _0x145baf;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x172be3['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0xa3b23,null))['then'](function(_0x4e3d6a){if(_0x4e3d6a){_0x218690=_0x4e3d6a;_0x428146[_0xbb10('0x2f')]=_[_0xbb10('0x31')](db[_0xbb10('0x6c')][_0xbb10('0x6e')]);_0x428146[_0xbb10('0x30')]=_[_0xbb10('0x31')](_0x172be3[_0xbb10('0x30')]);_0x428146[_0xbb10('0x32')]=_[_0xbb10('0x33')](_0x428146['model'],_0x428146[_0xbb10('0x30')]);_0x5a4429[_0xbb10('0x34')]=_[_0xbb10('0x33')](_0x428146[_0xbb10('0x2f')],qs['fields'](_0x172be3['query'][_0xbb10('0x35')]));_0x5a4429[_0xbb10('0x34')]=_0x5a4429[_0xbb10('0x34')][_0xbb10('0x36')]?_0x5a4429['attributes']:_0x428146[_0xbb10('0x2f')];_0x5a4429[_0xbb10('0x38')]=qs[_0xbb10('0x39')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x39')]);_0x5a4429['where']=qs['filters'](_[_0xbb10('0x6f')](_0x172be3[_0xbb10('0x30')],_0x428146[_0xbb10('0x32')]));if(_0x172be3['query'][_0xbb10('0x3e')]){_0x5a4429[_0xbb10('0x3a')]=_['merge'](_0x5a4429['where'],{'$or':_[_0xbb10('0x3c')](_0x5a4429[_0xbb10('0x34')],function(_0x177f77){var _0x4d64ff={};_0x4d64ff[_0x177f77]={'$like':'%'+_0x172be3[_0xbb10('0x30')][_0xbb10('0x3e')]+'%'};return _0x4d64ff;})});}_0x5a4429=_[_0xbb10('0x3b')]({},_0x5a4429,_0x172be3[_0xbb10('0x3f')]);return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x45bd4e){if(_0x45bd4e){_0x145baf=_0x45bd4e[_0xbb10('0x36')];if(!_0x172be3[_0xbb10('0x30')]['hasOwnProperty'](_0xbb10('0x70'))){_0x5a4429[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x5a4429[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x172be3[_0xbb10('0x30')][_0xbb10('0x1d')]);}return _0x218690[_0xbb10('0x6d')](_0x5a4429);}})[_0xbb10('0x23')](function(_0x2a4278){if(_0x2a4278){return _0x2a4278?{'count':_0x145baf,'rows':_0x2a4278}:null;}})['then'](respondWithResult(_0xa3b23,null))['catch'](handleError(_0xa3b23,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 6672df7..43c51ae 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 _0xb87a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x2cc923,_0xb5ece){var _0x1e2359=function(_0x301d59){while(--_0x301d59){_0x2cc923['push'](_0x2cc923['shift']());}};_0x1e2359(++_0xb5ece);}(_0xb87a,0x7c));var _0xab87=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xb87a[_0x934425];return _0x31d596;};'use strict';var _=require(_0xab87('0x0'));var util=require(_0xab87('0x1'));var logger=require('../../config/logger')(_0xab87('0x2'));var moment=require(_0xab87('0x3'));var BPromise=require(_0xab87('0x4'));var rp=require(_0xab87('0x5'));var fs=require('fs');var path=require(_0xab87('0x6'));var rimraf=require(_0xab87('0x7'));var config=require(_0xab87('0x8'));var attributes=require(_0xab87('0x9'));module[_0xab87('0xa')]=function(_0x3ae818,_0x1e4b00){return _0x3ae818[_0xab87('0xb')](_0xab87('0xc'),attributes,{'tableName':_0xab87('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb049=['./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','api','moment','path','../../config/environment'];(function(_0x32f6b9,_0x2d4aa9){var _0x267d52=function(_0x10f74f){while(--_0x10f74f){_0x32f6b9['push'](_0x32f6b9['shift']());}};_0x267d52(++_0x2d4aa9);}(_0xb049,0x118));var _0x9b04=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb049[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x9b04('0x0'));var util=require('util');var logger=require(_0x9b04('0x1'))(_0x9b04('0x2'));var moment=require(_0x9b04('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b04('0x4'));var rimraf=require('rimraf');var config=require(_0x9b04('0x5'));var attributes=require(_0x9b04('0x6'));module[_0x9b04('0x7')]=function(_0x1f69e1,_0x524f48){return _0x1f69e1[_0x9b04('0x8')](_0x9b04('0x9'),attributes,{'tableName':_0x9b04('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 1cba98e..87cf29e 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 _0x8bfb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x1bb9b6,_0x5eb8a3){var _0x3ade32=function(_0xe0134a){while(--_0xe0134a){_0x1bb9b6['push'](_0x1bb9b6['shift']());}};_0x3ade32(++_0x5eb8a3);}(_0x8bfb,0xa3));var _0xb8bf=function(_0x48f5ca,_0x5e4750){_0x48f5ca=_0x48f5ca-0x0;var _0x50b00e=_0x8bfb[_0x48f5ca];return _0x50b00e;};'use strict';var _=require(_0xb8bf('0x0'));var util=require(_0xb8bf('0x1'));var moment=require(_0xb8bf('0x2'));var BPromise=require(_0xb8bf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8bf('0x4'));var db=require(_0xb8bf('0x5'))['db'];var utils=require(_0xb8bf('0x6'));var logger=require(_0xb8bf('0x7'))(_0xb8bf('0x8'));var config=require(_0xb8bf('0x9'));var jayson=require(_0xb8bf('0xa'));var client=jayson['client'][_0xb8bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55c382,_0x2373e2,_0x44bbd5){return new BPromise(function(_0x790edd,_0x4c4fa9){return client[_0xb8bf('0xc')](_0x55c382,_0x44bbd5)[_0xb8bf('0xd')](function(_0x258391){logger[_0xb8bf('0xe')](_0xb8bf('0xf'),_0x2373e2,_0xb8bf('0x10'));logger[_0xb8bf('0x11')](_0xb8bf('0x12'),_0x2373e2,_0xb8bf('0x10'),JSON[_0xb8bf('0x13')](_0x258391));if(_0x258391[_0xb8bf('0x14')]){if(_0x258391[_0xb8bf('0x14')]['code']===0x1f4){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2373e2,_0x258391[_0xb8bf('0x14')][_0xb8bf('0x15')]);return _0x4c4fa9(_0x258391[_0xb8bf('0x14')][_0xb8bf('0x15')]);}logger[_0xb8bf('0x14')](_0xb8bf('0xf'),_0x2373e2,_0x258391[_0xb8bf('0x14')][_0xb8bf('0x15')]);return _0x790edd(_0x258391['error'][_0xb8bf('0x15')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2373e2,_0xb8bf('0x10'));_0x790edd(_0x258391[_0xb8bf('0x16')][_0xb8bf('0x15')]);}})[_0xb8bf('0x17')](function(_0x4599f7){logger[_0xb8bf('0x14')](_0xb8bf('0xf'),_0x2373e2,_0x4599f7);_0x4c4fa9(_0x4599f7);});});} \ No newline at end of file +var _0x7ce4=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','util'];(function(_0x596a82,_0x24f446){var _0x17262a=function(_0x231893){while(--_0x231893){_0x596a82['push'](_0x596a82['shift']());}};_0x17262a(++_0x24f446);}(_0x7ce4,0x14f));var _0x47ce=function(_0x4dabb1,_0x304306){_0x4dabb1=_0x4dabb1-0x0;var _0x4ab072=_0x7ce4[_0x4dabb1];return _0x4ab072;};'use strict';var _=require('lodash');var util=require(_0x47ce('0x0'));var moment=require(_0x47ce('0x1'));var BPromise=require('bluebird');var rs=require(_0x47ce('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47ce('0x3'))['db'];var utils=require(_0x47ce('0x4'));var logger=require(_0x47ce('0x5'))(_0x47ce('0x6'));var config=require(_0x47ce('0x7'));var jayson=require(_0x47ce('0x8'));var client=jayson['client'][_0x47ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa3dd96,_0x5958f9,_0x2eb884){return new BPromise(function(_0x5ed1c5,_0x1edc78){return client[_0x47ce('0xa')](_0xa3dd96,_0x2eb884)[_0x47ce('0xb')](function(_0x16ad26){logger['info'](_0x47ce('0xc'),_0x5958f9,'request\x20sent');logger['debug'](_0x47ce('0xd'),_0x5958f9,_0x47ce('0xe'),JSON[_0x47ce('0xf')](_0x16ad26));if(_0x16ad26['error']){if(_0x16ad26['error'][_0x47ce('0x10')]===0x1f4){logger[_0x47ce('0x11')](_0x47ce('0xc'),_0x5958f9,_0x16ad26['error'][_0x47ce('0x12')]);return _0x1edc78(_0x16ad26['error'][_0x47ce('0x12')]);}logger[_0x47ce('0x11')](_0x47ce('0xc'),_0x5958f9,_0x16ad26[_0x47ce('0x11')]['message']);return _0x5ed1c5(_0x16ad26['error']['message']);}else{logger['info'](_0x47ce('0xc'),_0x5958f9,_0x47ce('0xe'));_0x5ed1c5(_0x16ad26[_0x47ce('0x13')][_0x47ce('0x12')]);}})[_0x47ce('0x14')](function(_0x5915be){logger[_0x47ce('0x11')](_0x47ce('0xc'),_0x5958f9,_0x5915be);_0x1edc78(_0x5915be);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 1dddcaf..7f1ad9b 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 _0x71a7=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router'];(function(_0x39602d,_0x1edf77){var _0x5b8548=function(_0x409251){while(--_0x409251){_0x39602d['push'](_0x39602d['shift']());}};_0x5b8548(++_0x1edf77);}(_0x71a7,0x126));var _0x771a=function(_0x992f81,_0x2ac0bc){_0x992f81=_0x992f81-0x0;var _0x54937e=_0x71a7[_0x992f81];return _0x54937e;};'use strict';var multer=require(_0x771a('0x0'));var util=require(_0x771a('0x1'));var path=require(_0x771a('0x2'));var timeout=require('connect-timeout');var express=require(_0x771a('0x3'));var router=express[_0x771a('0x4')]();var auth=require(_0x771a('0x5'));var interaction=require(_0x771a('0x6'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x771a('0x7')]('/',auth[_0x771a('0x8')](),controller[_0x771a('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x771a('0xa')]);router[_0x771a('0x7')](_0x771a('0xb'),auth[_0x771a('0x8')](),controller['show']);router[_0x771a('0x7')](_0x771a('0xc'),auth[_0x771a('0x8')](),controller[_0x771a('0xd')]);router[_0x771a('0xe')]('/',auth[_0x771a('0x8')](),controller[_0x771a('0xf')]);router[_0x771a('0xe')](_0x771a('0xc'),auth[_0x771a('0x8')](),controller[_0x771a('0x10')]);router[_0x771a('0x11')]('/:id',auth[_0x771a('0x8')](),controller[_0x771a('0x12')]);router[_0x771a('0x13')]('/:id',auth[_0x771a('0x8')](),controller[_0x771a('0x14')]);router[_0x771a('0x13')](_0x771a('0xc'),auth['isAuthenticated'](),controller[_0x771a('0x15')]);module[_0x771a('0x16')]=router; \ No newline at end of file +var _0x5c48=['show','/:id/users','getAgents','post','create','/:id','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4a808f,_0x146501){var _0x6f28c8=function(_0x12cc81){while(--_0x12cc81){_0x4a808f['push'](_0x4a808f['shift']());}};_0x6f28c8(++_0x146501);}(_0x5c48,0xc3));var _0x85c4=function(_0x444b1b,_0x5efca4){_0x444b1b=_0x444b1b-0x0;var _0x2c0363=_0x5c48[_0x444b1b];return _0x2c0363;};'use strict';var multer=require(_0x85c4('0x0'));var util=require(_0x85c4('0x1'));var path=require(_0x85c4('0x2'));var timeout=require(_0x85c4('0x3'));var express=require('express');var router=express[_0x85c4('0x4')]();var auth=require(_0x85c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x85c4('0x6'));router[_0x85c4('0x7')]('/',auth[_0x85c4('0x8')](),controller[_0x85c4('0x9')]);router[_0x85c4('0x7')](_0x85c4('0xa'),auth[_0x85c4('0x8')](),controller[_0x85c4('0xb')]);router[_0x85c4('0x7')]('/:id',auth[_0x85c4('0x8')](),controller[_0x85c4('0xc')]);router[_0x85c4('0x7')](_0x85c4('0xd'),auth[_0x85c4('0x8')](),controller[_0x85c4('0xe')]);router[_0x85c4('0xf')]('/',auth[_0x85c4('0x8')](),controller[_0x85c4('0x10')]);router[_0x85c4('0xf')](_0x85c4('0xd'),auth[_0x85c4('0x8')](),controller['addAgents']);router['put'](_0x85c4('0x11'),auth['isAuthenticated'](),controller[_0x85c4('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x85c4('0x13')]);router[_0x85c4('0x14')]('/:id/users',auth[_0x85c4('0x8')](),controller[_0x85c4('0x15')]);module[_0x85c4('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index c19ba48..8360851 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 _0xfdb8=['system-','getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL'];(function(_0x4aab5f,_0x47181b){var _0x27909b=function(_0x1c3175){while(--_0x1c3175){_0x4aab5f['push'](_0x4aab5f['shift']());}};_0x27909b(++_0x47181b);}(_0xfdb8,0x184));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8fdb('0x0'));module['exports']={'name':{'type':Sequelize[_0x8fdb('0x1')],'allowNull':![],'unique':_0x8fdb('0x2')},'prefix':{'type':Sequelize[_0x8fdb('0x3')],'get':function(_0x2f4dea){return _0x8fdb('0x4')+this[_0x8fdb('0x5')](_0x8fdb('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x8fdb('0x6')]}}; \ No newline at end of file +var _0xa8a9=['exports','name','system-','getDataValue','STRING','INTEGER','sequelize'];(function(_0x5d0a80,_0x3a16b7){var _0x10215d=function(_0xe555ea){while(--_0xe555ea){_0x5d0a80['push'](_0x5d0a80['shift']());}};_0x10215d(++_0x3a16b7);}(_0xa8a9,0x180));var _0x9a8a=function(_0x23eb6d,_0x5b0516){_0x23eb6d=_0x23eb6d-0x0;var _0x1dfed9=_0xa8a9[_0x23eb6d];return _0x1dfed9;};'use strict';var Sequelize=require(_0x9a8a('0x0'));module[_0x9a8a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9a8a('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x31c9a8){return _0x9a8a('0x3')+this[_0x9a8a('0x4')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x9a8a('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x9a8a('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f4a0ae5..9cf939f 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 _0xdf43=['Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','system-','sequelize','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','filter','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','name','index','map','VoicePrefix','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','merge','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','catch','create','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','app','description','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate'];(function(_0x2a3405,_0x282cdf){var _0x467a0e=function(_0x2c0df5){while(--_0x2c0df5){_0x2a3405['push'](_0x2a3405['shift']());}};_0x467a0e(++_0x282cdf);}(_0xdf43,0x91));var _0x3df4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdf43[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0x3df4('0x0'));var emlformat=require(_0x3df4('0x1'));var rimraf=require(_0x3df4('0x2'));var zipdir=require(_0x3df4('0x3'));var jsonpatch=require(_0x3df4('0x4'));var rp=require(_0x3df4('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3df4('0x6'));var path=require(_0x3df4('0x7'));var sox=require(_0x3df4('0x8'));var csv=require(_0x3df4('0x9'));var ejs=require(_0x3df4('0xa'));var fs=require('fs');var _=require(_0x3df4('0xb'));var squel=require(_0x3df4('0xc'));var crypto=require(_0x3df4('0xd'));var jsforce=require(_0x3df4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3df4('0x9'));var querystring=require(_0x3df4('0xf'));var Papa=require(_0x3df4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3df4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3df4('0x12'));var logger=require('../../config/logger')(_0x3df4('0x13'));var utils=require(_0x3df4('0x14'));var config=require(_0x3df4('0x15'));var db=require('../../mysqldb')['db'];config[_0x3df4('0x16')]=_[_0x3df4('0x17')](config['redis'],{'host':_0x3df4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3df4('0x16')]));require(_0x3df4('0x19'))[_0x3df4('0x1a')](socket);function respondWithStatusCode(_0x53b956,_0x43a9c4){_0x43a9c4=_0x43a9c4||0xcc;return function(_0x42bcc8){if(_0x42bcc8){return _0x53b956[_0x3df4('0x1b')](_0x43a9c4);}return _0x53b956['status'](_0x43a9c4)['end']();};}function respondWithResult(_0x122f2b,_0x52d122){_0x52d122=_0x52d122||0xc8;return function(_0x6ec1d5){if(_0x6ec1d5){return _0x122f2b[_0x3df4('0x1c')](_0x52d122)[_0x3df4('0x1d')](_0x6ec1d5);}};}function respondWithFilteredResult(_0x4d2034,_0x4a19b4){return function(_0x41477b){if(_0x41477b){var _0x1e2afc=_0x41477b[_0x3df4('0x1e')],_0x35faf8=_0x4a19b4['offset'],_0x463821=_0x4a19b4[_0x3df4('0x1f')]+_0x4a19b4['limit'],_0x33db66;if(_0x463821>=_0x1e2afc){_0x463821=_0x1e2afc;_0x33db66=0xc8;}else{_0x33db66=0xce;}_0x4d2034[_0x3df4('0x1c')](_0x33db66);return _0x4d2034[_0x3df4('0x20')]('Content-Range',_0x35faf8+'-'+_0x463821+'/'+_0x1e2afc)[_0x3df4('0x1d')](_0x41477b);}return null;};}function patchUpdates(_0x462189){return function(_0x532669){try{jsonpatch[_0x3df4('0x21')](_0x532669,_0x462189,!![]);}catch(_0x4e2ed9){return BPromise[_0x3df4('0x22')](_0x4e2ed9);}return _0x532669[_0x3df4('0x23')]();};}function saveUpdates(_0xff126e,_0x2b37d4){return function(_0x1b4019){if(_0x1b4019){return _0x1b4019[_0x3df4('0x24')](_0xff126e)[_0x3df4('0x25')](function(_0x3fe0a5){return _0x3fe0a5;});}return null;};}function removeEntity(_0x2490fe,_0x1951d4){return function(_0x1a747e){if(_0x1a747e){return _0x1a747e[_0x3df4('0x26')]()[_0x3df4('0x25')](function(){var _0x45613a=_0x1a747e[_0x3df4('0x27')]({'plain':!![]});var _0x498a27=_0x3df4('0x28');return db[_0x3df4('0x29')][_0x3df4('0x26')]({'where':{'type':_0x498a27,'resourceId':_0x45613a['id']}})[_0x3df4('0x25')](function(){return _0x1a747e;});})[_0x3df4('0x25')](function(){_0x2490fe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd6fd75,_0x467230){return function(_0x58fdfa){if(!_0x58fdfa){_0xd6fd75[_0x3df4('0x1b')](0x194);}return _0x58fdfa;};}function handleError(_0x478752,_0x376754){_0x376754=_0x376754||0x1f4;return function(_0x23637a){logger[_0x3df4('0x2a')](_0x23637a['stack']);if(_0x23637a[_0x3df4('0x2b')]){delete _0x23637a['name'];}_0x478752[_0x3df4('0x1c')](_0x376754)['send'](_0x23637a);};}exports[_0x3df4('0x2c')]=function(_0x2e9f8b,_0x448138){var _0xb6229={},_0x195089={},_0x5e6779={'count':0x0,'rows':[]};var _0x2b6978=_[_0x3df4('0x2d')](db[_0x3df4('0x2e')]['rawAttributes'],function(_0x1e17ef){return{'name':_0x1e17ef[_0x3df4('0x2f')],'type':_0x1e17ef[_0x3df4('0x30')][_0x3df4('0x31')]};});_0x195089[_0x3df4('0x32')]=_[_0x3df4('0x2d')](_0x2b6978,_0x3df4('0x2b'));_0x195089[_0x3df4('0x33')]=_['keys'](_0x2e9f8b[_0x3df4('0x33')]);_0x195089[_0x3df4('0x34')]=_[_0x3df4('0x35')](_0x195089['model'],_0x195089[_0x3df4('0x33')]);_0xb6229['attributes']=_[_0x3df4('0x35')](_0x195089[_0x3df4('0x32')],qs[_0x3df4('0x36')](_0x2e9f8b[_0x3df4('0x33')][_0x3df4('0x36')]));_0xb6229[_0x3df4('0x37')]=_0xb6229[_0x3df4('0x37')][_0x3df4('0x38')]?_0xb6229[_0x3df4('0x37')]:_0x195089['model'];if(!_0x2e9f8b[_0x3df4('0x33')][_0x3df4('0x39')]('nolimit')){_0xb6229['limit']=qs[_0x3df4('0x3a')](_0x2e9f8b[_0x3df4('0x33')][_0x3df4('0x3a')]);_0xb6229[_0x3df4('0x1f')]=qs[_0x3df4('0x1f')](_0x2e9f8b[_0x3df4('0x33')]['offset']);}_0xb6229['order']=qs[_0x3df4('0x3b')](_0x2e9f8b[_0x3df4('0x33')][_0x3df4('0x3b')]);_0xb6229[_0x3df4('0x3c')]=qs[_0x3df4('0x34')](_[_0x3df4('0x3d')](_0x2e9f8b['query'],_0x195089[_0x3df4('0x34')]),_0x2b6978);if(_0x2e9f8b[_0x3df4('0x33')]['filter']){_0xb6229[_0x3df4('0x3c')]=_[_0x3df4('0x3e')](_0xb6229[_0x3df4('0x3c')],{'$or':_[_0x3df4('0x2d')](_0x2b6978,function(_0x385de3){if(_0x385de3[_0x3df4('0x30')]!=='VIRTUAL'){var _0x3cef1a={};_0x3cef1a[_0x385de3[_0x3df4('0x2b')]]={'$like':'%'+_0x2e9f8b[_0x3df4('0x33')]['filter']+'%'};return _0x3cef1a;}})});}_0xb6229=_[_0x3df4('0x3e')]({},_0xb6229,_0x2e9f8b[_0x3df4('0x3f')]);var _0x20c2e6={'where':_0xb6229[_0x3df4('0x3c')]};return db[_0x3df4('0x2e')]['count'](_0x20c2e6)['then'](function(_0x32c287){_0x5e6779[_0x3df4('0x1e')]=_0x32c287;if(_0x2e9f8b['query'][_0x3df4('0x40')]){_0xb6229[_0x3df4('0x41')]=[{'all':!![]}];}return db[_0x3df4('0x2e')][_0x3df4('0x42')](_0xb6229);})[_0x3df4('0x25')](function(_0x2038b7){_0x5e6779['rows']=_0x2038b7;return _0x5e6779;})[_0x3df4('0x25')](respondWithFilteredResult(_0x448138,_0xb6229))['catch'](handleError(_0x448138,null));};exports[_0x3df4('0x43')]=function(_0x400679,_0x5bf1d0){var _0x329f5e={'raw':![],'where':{'id':_0x400679[_0x3df4('0x44')]['id']}},_0x28cc5a={};_0x28cc5a[_0x3df4('0x32')]=_[_0x3df4('0x45')](db[_0x3df4('0x2e')][_0x3df4('0x46')]);_0x28cc5a[_0x3df4('0x33')]=_[_0x3df4('0x45')](_0x400679[_0x3df4('0x33')]);_0x28cc5a['filters']=_[_0x3df4('0x35')](_0x28cc5a[_0x3df4('0x32')],_0x28cc5a[_0x3df4('0x33')]);_0x329f5e['attributes']=_[_0x3df4('0x35')](_0x28cc5a[_0x3df4('0x32')],qs[_0x3df4('0x36')](_0x400679[_0x3df4('0x33')][_0x3df4('0x36')]));_0x329f5e['attributes']=_0x329f5e[_0x3df4('0x37')]['length']?_0x329f5e[_0x3df4('0x37')]:_0x28cc5a['model'];if(_0x400679['query'][_0x3df4('0x40')]){_0x329f5e[_0x3df4('0x41')]=[{'all':!![]}];}_0x329f5e=_['merge']({},_0x329f5e,_0x400679['options']);return db[_0x3df4('0x2e')][_0x3df4('0x47')](_0x329f5e)['then'](handleEntityNotFound(_0x5bf1d0,null))[_0x3df4('0x25')](respondWithResult(_0x5bf1d0,null))['catch'](handleError(_0x5bf1d0,null));};exports[_0x3df4('0x26')]=function(_0x3e17de,_0x5c65c2){return db[_0x3df4('0x2e')][_0x3df4('0x47')]({'where':{'id':_0x3e17de[_0x3df4('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c65c2,null))['then'](removeEntity(_0x5c65c2,null))[_0x3df4('0x48')](handleError(_0x5c65c2,null));};exports['describe']=function(_0x4ac6fc,_0x1b11c4){return db[_0x3df4('0x2e')]['describe']()[_0x3df4('0x25')](respondWithResult(_0x1b11c4,null))['catch'](handleError(_0x1b11c4,null));};exports[_0x3df4('0x49')]=function(_0x43337a,_0x300f38){var _0x56da45;return db['sequelize'][_0x3df4('0x4a')](function(_0x1af275){return db[_0x3df4('0x2e')][_0x3df4('0x49')](_0x43337a[_0x3df4('0x4b')],{'transaction':_0x1af275})[_0x3df4('0x25')](function(_0x11d7b9){_0x56da45=_0x11d7b9[_0x3df4('0x27')]({'plain':!![]});return db[_0x3df4('0x4c')][_0x3df4('0x47')]({'where':{'id':_0x56da45[_0x3df4('0x4d')]},'raw':!![]})[_0x3df4('0x25')](function(_0xc2e553){return createVoicePrefixExtensions(_0x56da45,_0xc2e553,_0x1af275);});});})[_0x3df4('0x25')](function(){var _0x23e33a=_0x43337a['user'][_0x3df4('0x27')]({'plain':!![]});if(!_0x23e33a)throw new Error(_0x3df4('0x4e'));if(_0x23e33a[_0x3df4('0x4f')]==='user'){var _0x480bd9=_0x56da45;return db[_0x3df4('0x50')][_0x3df4('0x47')]({'where':{'name':'VoicePrefixes','userProfileId':_0x23e33a[_0x3df4('0x51')]},'raw':!![]})[_0x3df4('0x25')](function(_0x31d8c2){if(_0x31d8c2&&_0x31d8c2[_0x3df4('0x52')]===0x0){return db['UserProfileResource'][_0x3df4('0x49')]({'name':_0x480bd9[_0x3df4('0x2b')],'resourceId':_0x480bd9['id'],'type':_0x31d8c2['name'],'sectionId':_0x31d8c2['id']},{})[_0x3df4('0x25')](function(){return _0x56da45;});}else{return _0x56da45;}})[_0x3df4('0x48')](function(_0x5225c6){logger[_0x3df4('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5225c6);throw _0x5225c6;});}return _0x56da45;})[_0x3df4('0x25')](respondWithResult(_0x300f38,null))[_0x3df4('0x48')](handleError(_0x300f38,null));};function Extension(_0x43e2cf,_0x9428a2,_0x48b36d,_0x1b7b8c){this[_0x3df4('0x53')]=_0x3df4('0x54');this['exten']=_0x43e2cf;this[_0x3df4('0x55')]=_0x48b36d;this[_0x3df4('0x30')]='system';this[_0x3df4('0x56')]='Voice\x20Prefix\x20Extension';this[_0x3df4('0x57')]=_0x9428a2;this[_0x3df4('0x58')]=_0x1b7b8c;}function createVoicePrefixExtensions(_0x447013,_0x4d38a3,_0x28031b){return new BPromise(function(_0x30e755,_0x2a6e00){var _0x155ae9=new Extension(formatPrefixName(_0x447013['prefix']),0x1,_0x3df4('0x59'),_0x3df4('0x5a'));_0x155ae9[_0x3df4('0x5b')]=_0x447013['id'];return db['VoiceExtension']['create'](_0x155ae9,{'transaction':_0x28031b})[_0x3df4('0x25')](function(_0xe8ff6f){var _0x42e99f=_0xe8ff6f['get']({'plain':!![]});var _0x12e447=_['map'](addVoicePrefixExtensions(_0x447013,_0x4d38a3),function(_0x3e6ad9){_0x3e6ad9[_0x3df4('0x4d')]=_0x42e99f['id'];_0x3e6ad9['VoicePrefixId']=_0x447013['id'];return _0x3e6ad9;});return db[_0x3df4('0x4c')][_0x3df4('0x5c')](_0x12e447,{'transaction':_0x28031b})[_0x3df4('0x25')](function(_0x5b3bb3){if(!_0x5b3bb3){return _0x2a6e00(_0x3df4('0x5d'));}else{return _0x30e755(_0x5b3bb3);}})[_0x3df4('0x48')](function(_0x4a7bdc){return _0x2a6e00(_0x4a7bdc);});});;});};function addVoicePrefixExtensions(_0x2e7bbb,_0x21605c){var _0x47a7c7=[];var _0x1ac5c0=formatPrefixName(_0x2e7bbb[_0x3df4('0x5e')]);_0x47a7c7[_0x3df4('0x5f')](new Extension(_0x1ac5c0,0x2,_0x3df4('0x60'),_0x3df4('0x61')+_0x2e7bbb[_0x3df4('0x2b')]));if(_0x2e7bbb[_0x3df4('0x62')]){_0x47a7c7['push'](new Extension(_0x1ac5c0,0x3,_0x3df4('0x60'),_0x3df4('0x63')+_0x2e7bbb[_0x3df4('0x62')]));}else{_0x47a7c7[_0x3df4('0x5f')](new Extension(_0x1ac5c0,0x3,_0x3df4('0x59'),_0x3df4('0x64')));}_0x47a7c7['push'](new Extension(_0x1ac5c0,0x4,'goto',_0x21605c['context']+','+_0x3df4('0x65')+(0x8+_0x2e7bbb['name'][_0x3df4('0x38')])+'}'+','+0x1));return _0x47a7c7;}function formatPrefixName(_0x423b34){var _0x204c13='_';for(var _0x4b8f6c=0x0;_0x4b8f6c<_0x423b34['length'];_0x4b8f6c++){if(_0x423b34[_0x3df4('0x66')](_0x4b8f6c)=='-'){_0x204c13+=_0x423b34[_0x3df4('0x66')](_0x4b8f6c);}else{_0x204c13+='['+_0x423b34[_0x3df4('0x66')](_0x4b8f6c)+']';}}_0x204c13+='.';return _0x204c13;}exports[_0x3df4('0x24')]=function(_0x9024bd,_0x27a215,_0x23a076){var _0x52c26c=_0x9024bd['body'];_0x52c26c[_0x3df4('0x5e')]=_0x3df4('0x67')+_0x52c26c[_0x3df4('0x2b')]+'-';return db[_0x3df4('0x68')][_0x3df4('0x4a')](function(_0x4cc3b5){return db[_0x3df4('0x2e')][_0x3df4('0x24')](_0x52c26c,{'where':{'id':_0x52c26c['id']},'transaction':_0x4cc3b5})['then'](function(){return db[_0x3df4('0x4c')]['destroy']({'where':{'VoicePrefixId':_0x52c26c['id']},'transaction':_0x4cc3b5})[_0x3df4('0x25')](function(){return db[_0x3df4('0x4c')][_0x3df4('0x47')]({'where':{'id':_0x52c26c[_0x3df4('0x4d')]},'raw':!![]})[_0x3df4('0x25')](function(_0x45d5d4){return createVoicePrefixExtensions(_0x52c26c,_0x45d5d4,_0x4cc3b5);});});});})[_0x3df4('0x25')](function(){return db[_0x3df4('0x2e')]['findById'](_0x52c26c['id']);})[_0x3df4('0x25')](respondWithResult(_0x27a215,null))[_0x3df4('0x48')](handleError(_0x27a215,null));};exports[_0x3df4('0x69')]=function(_0x2a9751,_0x332c68,_0x37f23e){return db[_0x3df4('0x2e')][_0x3df4('0x47')]({'where':{'id':_0x2a9751[_0x3df4('0x44')]['id']}})[_0x3df4('0x25')](handleEntityNotFound(_0x332c68,null))[_0x3df4('0x25')](function(_0x1eca0e){if(_0x1eca0e){return _0x1eca0e[_0x3df4('0x69')](_0x2a9751['body'][_0x3df4('0x6a')],_[_0x3df4('0x6b')](_0x2a9751[_0x3df4('0x4b')],[_0x3df4('0x6a'),'id'])||{})['spread'](function(_0x4ce994){for(var _0x82f736=0x0;_0x82f736<_0x2a9751[_0x3df4('0x4b')][_0x3df4('0x6a')][_0x3df4('0x38')];_0x82f736+=0x1){socket[_0x3df4('0x6c')](_0x3df4('0x6d'),{'UserId':_0x2a9751['body'][_0x3df4('0x6a')][_0x82f736],'VoicePrefixId':_0x2a9751[_0x3df4('0x44')]['id']});}return _0x4ce994;});}})[_0x3df4('0x25')](respondWithResult(_0x332c68,null))[_0x3df4('0x48')](handleError(_0x332c68,null));};exports[_0x3df4('0x6e')]=function(_0x2c8cd2,_0x4ca72f,_0x69c39d){return db[_0x3df4('0x2e')][_0x3df4('0x47')]({'where':{'id':_0x2c8cd2[_0x3df4('0x44')]['id']}})[_0x3df4('0x25')](handleEntityNotFound(_0x4ca72f,null))[_0x3df4('0x25')](function(_0x8c900d){if(_0x8c900d){return _0x8c900d[_0x3df4('0x6e')](_0x2c8cd2[_0x3df4('0x33')][_0x3df4('0x6a')])['then'](function(){if(_[_0x3df4('0x6f')](_0x2c8cd2[_0x3df4('0x33')][_0x3df4('0x6a')])){for(var _0x4c6fe2=0x0;_0x4c6fe2<_0x2c8cd2[_0x3df4('0x33')][_0x3df4('0x6a')]['length'];_0x4c6fe2+=0x1){socket[_0x3df4('0x6c')](_0x3df4('0x70'),{'UserId':Number(_0x2c8cd2['query']['ids'][_0x4c6fe2]),'VoicePrefixId':Number(_0x2c8cd2[_0x3df4('0x44')]['id'])});}}else{socket[_0x3df4('0x6c')]('userVoicePrefix:remove',{'UserId':Number(_0x2c8cd2['query'][_0x3df4('0x6a')]),'VoicePrefixId':Number(_0x2c8cd2[_0x3df4('0x44')]['id'])});}});}})['then'](respondWithStatusCode(_0x4ca72f,null))[_0x3df4('0x48')](handleError(_0x4ca72f,null));};exports[_0x3df4('0x71')]=function(_0x53e371,_0x3bba83,_0x454117){var _0x588cdb={};var _0x4d8f2d={};var _0x591cec;var _0x3b26f8;return db[_0x3df4('0x2e')][_0x3df4('0x72')]({'where':{'id':_0x53e371['params']['id']}})[_0x3df4('0x25')](handleEntityNotFound(_0x3bba83,null))['then'](function(_0x3b5d5b){if(_0x3b5d5b){_0x591cec=_0x3b5d5b;_0x4d8f2d[_0x3df4('0x32')]=_[_0x3df4('0x45')](db[_0x3df4('0x73')][_0x3df4('0x46')]);_0x4d8f2d['query']=_[_0x3df4('0x45')](_0x53e371[_0x3df4('0x33')]);_0x4d8f2d[_0x3df4('0x34')]=_['intersection'](_0x4d8f2d[_0x3df4('0x32')],_0x4d8f2d[_0x3df4('0x33')]);_0x588cdb[_0x3df4('0x37')]=_[_0x3df4('0x35')](_0x4d8f2d[_0x3df4('0x32')],qs['fields'](_0x53e371['query'][_0x3df4('0x36')]));_0x588cdb[_0x3df4('0x37')]=_0x588cdb[_0x3df4('0x37')][_0x3df4('0x38')]?_0x588cdb[_0x3df4('0x37')]:_0x4d8f2d['model'];_0x588cdb[_0x3df4('0x74')]=qs[_0x3df4('0x3b')](_0x53e371[_0x3df4('0x33')][_0x3df4('0x3b')]);_0x588cdb['where']=qs[_0x3df4('0x34')](_[_0x3df4('0x3d')](_0x53e371[_0x3df4('0x33')],_0x4d8f2d[_0x3df4('0x34')]));if(_0x53e371[_0x3df4('0x33')][_0x3df4('0x75')]){_0x588cdb['where']=_[_0x3df4('0x3e')](_0x588cdb[_0x3df4('0x3c')],{'$or':_[_0x3df4('0x2d')](_0x588cdb['attributes'],function(_0x1fee7c){var _0x2c5827={};_0x2c5827[_0x1fee7c]={'$like':'%'+_0x53e371[_0x3df4('0x33')]['filter']+'%'};return _0x2c5827;})});}_0x588cdb=_[_0x3df4('0x3e')]({},_0x588cdb,_0x53e371[_0x3df4('0x3f')]);return _0x591cec[_0x3df4('0x71')](_0x588cdb);}})[_0x3df4('0x25')](function(_0x20c968){if(_0x20c968){_0x3b26f8=_0x20c968[_0x3df4('0x38')];if(!_0x53e371[_0x3df4('0x33')]['hasOwnProperty'](_0x3df4('0x76'))){_0x588cdb[_0x3df4('0x3a')]=qs['limit'](_0x53e371[_0x3df4('0x33')][_0x3df4('0x3a')]);_0x588cdb[_0x3df4('0x1f')]=qs['offset'](_0x53e371['query'][_0x3df4('0x1f')]);}return _0x591cec['getAgents'](_0x588cdb);}})[_0x3df4('0x25')](function(_0xafa1e1){if(_0xafa1e1){return _0xafa1e1?{'count':_0x3b26f8,'rows':_0xafa1e1}:null;}})[_0x3df4('0x25')](respondWithResult(_0x3bba83,null))[_0x3df4('0x48')](handleError(_0x3bba83,null));}; \ No newline at end of file +var _0x1b16=['where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','VoicePrefix','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./voicePrefix.socket','end','status','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','get','VoicePrefixes','UserProfileResource','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3c2c62,_0x2033c2){var _0x58bcb8=function(_0x25c172){while(--_0x25c172){_0x3c2c62['push'](_0x3c2c62['shift']());}};_0x58bcb8(++_0x2033c2);}(_0x1b16,0x1ac));var _0x61b1=function(_0xd95b05,_0x46018d){_0xd95b05=_0xd95b05-0x0;var _0x109df8=_0x1b16[_0xd95b05];return _0x109df8;};'use strict';var pdf=require(_0x61b1('0x0'));var emlformat=require(_0x61b1('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x61b1('0x2'));var moment=require(_0x61b1('0x3'));var BPromise=require(_0x61b1('0x4'));var Mustache=require(_0x61b1('0x5'));var util=require(_0x61b1('0x6'));var path=require(_0x61b1('0x7'));var sox=require(_0x61b1('0x8'));var csv=require(_0x61b1('0x9'));var ejs=require(_0x61b1('0xa'));var fs=require('fs');var _=require(_0x61b1('0xb'));var squel=require(_0x61b1('0xc'));var crypto=require('crypto');var jsforce=require(_0x61b1('0xd'));var deskjs=require(_0x61b1('0xe'));var toCsv=require(_0x61b1('0x9'));var querystring=require(_0x61b1('0xf'));var Papa=require('papaparse');var Redis=require(_0x61b1('0x10'));var authService=require(_0x61b1('0x11'));var qs=require(_0x61b1('0x12'));var as=require(_0x61b1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61b1('0x14'))(_0x61b1('0x15'));var utils=require('../../config/utils');var config=require(_0x61b1('0x16'));var db=require(_0x61b1('0x17'))['db'];config['redis']=_[_0x61b1('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x61b1('0x19'))(new Redis(config[_0x61b1('0x1a')]));require(_0x61b1('0x1b'))['register'](socket);function respondWithStatusCode(_0x1b8481,_0x28cdbd){_0x28cdbd=_0x28cdbd||0xcc;return function(_0xcaf92c){if(_0xcaf92c){return _0x1b8481['sendStatus'](_0x28cdbd);}return _0x1b8481['status'](_0x28cdbd)[_0x61b1('0x1c')]();};}function respondWithResult(_0x6f6bf,_0x3fbb57){_0x3fbb57=_0x3fbb57||0xc8;return function(_0x3f6344){if(_0x3f6344){return _0x6f6bf[_0x61b1('0x1d')](_0x3fbb57)[_0x61b1('0x1e')](_0x3f6344);}};}function respondWithFilteredResult(_0x532fb2,_0x19923d){return function(_0x1a00f4){if(_0x1a00f4){var _0x8c2092=_0x1a00f4[_0x61b1('0x1f')],_0x4bbffd=_0x19923d[_0x61b1('0x20')],_0x21c81a=_0x19923d[_0x61b1('0x20')]+_0x19923d[_0x61b1('0x21')],_0xde3eba;if(_0x21c81a>=_0x8c2092){_0x21c81a=_0x8c2092;_0xde3eba=0xc8;}else{_0xde3eba=0xce;}_0x532fb2[_0x61b1('0x1d')](_0xde3eba);return _0x532fb2['set'](_0x61b1('0x22'),_0x4bbffd+'-'+_0x21c81a+'/'+_0x8c2092)[_0x61b1('0x1e')](_0x1a00f4);}return null;};}function patchUpdates(_0x558f4c){return function(_0x27ffc3){try{jsonpatch[_0x61b1('0x23')](_0x27ffc3,_0x558f4c,!![]);}catch(_0x5811ad){return BPromise['reject'](_0x5811ad);}return _0x27ffc3[_0x61b1('0x24')]();};}function saveUpdates(_0x505407,_0x4f1cf0){return function(_0x126439){if(_0x126439){return _0x126439[_0x61b1('0x25')](_0x505407)['then'](function(_0x3def3a){return _0x3def3a;});}return null;};}function removeEntity(_0x15c018,_0x524419){return function(_0x3f12f6){if(_0x3f12f6){return _0x3f12f6[_0x61b1('0x26')]()[_0x61b1('0x27')](function(){var _0x3f1d41=_0x3f12f6[_0x61b1('0x28')]({'plain':!![]});var _0x3c990a=_0x61b1('0x29');return db[_0x61b1('0x2a')]['destroy']({'where':{'type':_0x3c990a,'resourceId':_0x3f1d41['id']}})[_0x61b1('0x27')](function(){return _0x3f12f6;});})[_0x61b1('0x27')](function(){_0x15c018['status'](0xcc)[_0x61b1('0x1c')]();});}};}function handleEntityNotFound(_0x3e901e,_0x15ef6e){return function(_0x21657f){if(!_0x21657f){_0x3e901e[_0x61b1('0x2b')](0x194);}return _0x21657f;};}function handleError(_0x19d50c,_0x23c21f){_0x23c21f=_0x23c21f||0x1f4;return function(_0x437b90){logger[_0x61b1('0x2c')](_0x437b90['stack']);if(_0x437b90[_0x61b1('0x2d')]){delete _0x437b90[_0x61b1('0x2d')];}_0x19d50c['status'](_0x23c21f)[_0x61b1('0x2e')](_0x437b90);};}exports['index']=function(_0x353f64,_0x1455a4){var _0x429c23={},_0x57ff6c={},_0x1fe5b0={'count':0x0,'rows':[]};var _0x24a987=_[_0x61b1('0x2f')](db['VoicePrefix'][_0x61b1('0x30')],function(_0x56cbd6){return{'name':_0x56cbd6[_0x61b1('0x31')],'type':_0x56cbd6[_0x61b1('0x32')][_0x61b1('0x33')]};});_0x57ff6c[_0x61b1('0x34')]=_[_0x61b1('0x2f')](_0x24a987,_0x61b1('0x2d'));_0x57ff6c[_0x61b1('0x35')]=_[_0x61b1('0x36')](_0x353f64['query']);_0x57ff6c[_0x61b1('0x37')]=_['intersection'](_0x57ff6c[_0x61b1('0x34')],_0x57ff6c['query']);_0x429c23['attributes']=_[_0x61b1('0x38')](_0x57ff6c[_0x61b1('0x34')],qs['fields'](_0x353f64[_0x61b1('0x35')][_0x61b1('0x39')]));_0x429c23[_0x61b1('0x3a')]=_0x429c23[_0x61b1('0x3a')][_0x61b1('0x3b')]?_0x429c23[_0x61b1('0x3a')]:_0x57ff6c['model'];if(!_0x353f64['query'][_0x61b1('0x3c')](_0x61b1('0x3d'))){_0x429c23[_0x61b1('0x21')]=qs[_0x61b1('0x21')](_0x353f64[_0x61b1('0x35')][_0x61b1('0x21')]);_0x429c23[_0x61b1('0x20')]=qs[_0x61b1('0x20')](_0x353f64[_0x61b1('0x35')]['offset']);}_0x429c23[_0x61b1('0x3e')]=qs['sort'](_0x353f64[_0x61b1('0x35')][_0x61b1('0x3f')]);_0x429c23[_0x61b1('0x40')]=qs[_0x61b1('0x37')](_[_0x61b1('0x41')](_0x353f64[_0x61b1('0x35')],_0x57ff6c[_0x61b1('0x37')]),_0x24a987);if(_0x353f64[_0x61b1('0x35')][_0x61b1('0x42')]){_0x429c23[_0x61b1('0x40')]=_[_0x61b1('0x43')](_0x429c23[_0x61b1('0x40')],{'$or':_['map'](_0x24a987,function(_0x26a8ee){if(_0x26a8ee[_0x61b1('0x32')]!==_0x61b1('0x44')){var _0x1e8941={};_0x1e8941[_0x26a8ee[_0x61b1('0x2d')]]={'$like':'%'+_0x353f64[_0x61b1('0x35')][_0x61b1('0x42')]+'%'};return _0x1e8941;}})});}_0x429c23=_['merge']({},_0x429c23,_0x353f64['options']);var _0x21fb1a={'where':_0x429c23[_0x61b1('0x40')]};return db['VoicePrefix'][_0x61b1('0x1f')](_0x21fb1a)['then'](function(_0x2b2be7){_0x1fe5b0[_0x61b1('0x1f')]=_0x2b2be7;if(_0x353f64['query'][_0x61b1('0x45')]){_0x429c23[_0x61b1('0x46')]=[{'all':!![]}];}return db['VoicePrefix'][_0x61b1('0x47')](_0x429c23);})[_0x61b1('0x27')](function(_0x42379a){_0x1fe5b0[_0x61b1('0x48')]=_0x42379a;return _0x1fe5b0;})[_0x61b1('0x27')](respondWithFilteredResult(_0x1455a4,_0x429c23))[_0x61b1('0x49')](handleError(_0x1455a4,null));};exports[_0x61b1('0x4a')]=function(_0x14d52b,_0x38655a){var _0x7cba84={'raw':![],'where':{'id':_0x14d52b[_0x61b1('0x4b')]['id']}},_0x2a3131={};_0x2a3131[_0x61b1('0x34')]=_['keys'](db['VoicePrefix'][_0x61b1('0x30')]);_0x2a3131[_0x61b1('0x35')]=_[_0x61b1('0x36')](_0x14d52b['query']);_0x2a3131[_0x61b1('0x37')]=_[_0x61b1('0x38')](_0x2a3131[_0x61b1('0x34')],_0x2a3131[_0x61b1('0x35')]);_0x7cba84[_0x61b1('0x3a')]=_[_0x61b1('0x38')](_0x2a3131[_0x61b1('0x34')],qs[_0x61b1('0x39')](_0x14d52b[_0x61b1('0x35')][_0x61b1('0x39')]));_0x7cba84[_0x61b1('0x3a')]=_0x7cba84[_0x61b1('0x3a')][_0x61b1('0x3b')]?_0x7cba84['attributes']:_0x2a3131[_0x61b1('0x34')];if(_0x14d52b['query']['includeAll']){_0x7cba84[_0x61b1('0x46')]=[{'all':!![]}];}_0x7cba84=_[_0x61b1('0x43')]({},_0x7cba84,_0x14d52b[_0x61b1('0x4c')]);return db[_0x61b1('0x4d')][_0x61b1('0x4e')](_0x7cba84)[_0x61b1('0x27')](handleEntityNotFound(_0x38655a,null))[_0x61b1('0x27')](respondWithResult(_0x38655a,null))['catch'](handleError(_0x38655a,null));};exports[_0x61b1('0x26')]=function(_0x59ca78,_0x4240e2){return db[_0x61b1('0x4d')][_0x61b1('0x4e')]({'where':{'id':_0x59ca78[_0x61b1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4240e2,null))[_0x61b1('0x27')](removeEntity(_0x4240e2,null))[_0x61b1('0x49')](handleError(_0x4240e2,null));};exports['describe']=function(_0x5d8cab,_0x46b975){return db[_0x61b1('0x4d')][_0x61b1('0x4f')]()[_0x61b1('0x27')](respondWithResult(_0x46b975,null))[_0x61b1('0x49')](handleError(_0x46b975,null));};exports[_0x61b1('0x50')]=function(_0x1c791a,_0x5f07f2){var _0x6658ec;return db[_0x61b1('0x51')][_0x61b1('0x52')](function(_0x134333){return db[_0x61b1('0x4d')][_0x61b1('0x50')](_0x1c791a[_0x61b1('0x53')],{'transaction':_0x134333})[_0x61b1('0x27')](function(_0x2d42fc){_0x6658ec=_0x2d42fc[_0x61b1('0x28')]({'plain':!![]});return db[_0x61b1('0x54')][_0x61b1('0x4e')]({'where':{'id':_0x6658ec[_0x61b1('0x55')]},'raw':!![]})[_0x61b1('0x27')](function(_0x21c983){return createVoicePrefixExtensions(_0x6658ec,_0x21c983,_0x134333);});});})[_0x61b1('0x27')](function(){var _0x35293a=_0x1c791a[_0x61b1('0x56')][_0x61b1('0x28')]({'plain':!![]});if(!_0x35293a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35293a[_0x61b1('0x57')]==='user'){var _0x1c3467=_0x6658ec;return db[_0x61b1('0x58')][_0x61b1('0x4e')]({'where':{'name':_0x61b1('0x29'),'userProfileId':_0x35293a['userProfileId']},'raw':!![]})[_0x61b1('0x27')](function(_0x39925d){if(_0x39925d&&_0x39925d[_0x61b1('0x59')]===0x0){return db[_0x61b1('0x2a')]['create']({'name':_0x1c3467[_0x61b1('0x2d')],'resourceId':_0x1c3467['id'],'type':_0x39925d['name'],'sectionId':_0x39925d['id']},{})[_0x61b1('0x27')](function(){return _0x6658ec;});}else{return _0x6658ec;}})[_0x61b1('0x49')](function(_0xf7f356){logger[_0x61b1('0x2c')](_0x61b1('0x5a'),_0xf7f356);throw _0xf7f356;});}return _0x6658ec;})['then'](respondWithResult(_0x5f07f2,null))[_0x61b1('0x49')](handleError(_0x5f07f2,null));};function Extension(_0x224e8c,_0x4758d0,_0x1c40c0,_0x263d5b){this[_0x61b1('0x5b')]='from-sip';this[_0x61b1('0x5c')]=_0x224e8c;this[_0x61b1('0x5d')]=_0x1c40c0;this[_0x61b1('0x32')]=_0x61b1('0x5e');this['description']=_0x61b1('0x5f');this['priority']=_0x4758d0;this[_0x61b1('0x60')]=_0x263d5b;}function createVoicePrefixExtensions(_0x50727a,_0x147965,_0x37d809){return new BPromise(function(_0x1508ba,_0x31f520){var _0xabb3cc=new Extension(formatPrefixName(_0x50727a[_0x61b1('0x61')]),0x1,_0x61b1('0x62'),_0x61b1('0x63'));_0xabb3cc[_0x61b1('0x64')]=_0x50727a['id'];return db[_0x61b1('0x54')][_0x61b1('0x50')](_0xabb3cc,{'transaction':_0x37d809})[_0x61b1('0x27')](function(_0x5d49b8){var _0x53fa26=_0x5d49b8[_0x61b1('0x28')]({'plain':!![]});var _0x406604=_[_0x61b1('0x2f')](addVoicePrefixExtensions(_0x50727a,_0x147965),function(_0x50e849){_0x50e849[_0x61b1('0x55')]=_0x53fa26['id'];_0x50e849[_0x61b1('0x64')]=_0x50727a['id'];return _0x50e849;});return db[_0x61b1('0x54')][_0x61b1('0x65')](_0x406604,{'transaction':_0x37d809})[_0x61b1('0x27')](function(_0x5f3c42){if(!_0x5f3c42){return _0x31f520(_0x61b1('0x66'));}else{return _0x1508ba(_0x5f3c42);}})[_0x61b1('0x49')](function(_0x3ac766){return _0x31f520(_0x3ac766);});});;});};function addVoicePrefixExtensions(_0x1085cc,_0x4f0b77){var _0xe09396=[];var _0x990d73=formatPrefixName(_0x1085cc[_0x61b1('0x61')]);_0xe09396[_0x61b1('0x67')](new Extension(_0x990d73,0x2,_0x61b1('0x68'),'CDR(prefix)='+_0x1085cc[_0x61b1('0x2d')]));if(_0x1085cc[_0x61b1('0x69')]){_0xe09396['push'](new Extension(_0x990d73,0x3,_0x61b1('0x68'),_0x61b1('0x6a')+_0x1085cc[_0x61b1('0x69')]));}else{_0xe09396[_0x61b1('0x67')](new Extension(_0x990d73,0x3,_0x61b1('0x62'),_0x61b1('0x6b')));}_0xe09396[_0x61b1('0x67')](new Extension(_0x990d73,0x4,_0x61b1('0x6c'),_0x4f0b77['context']+','+_0x61b1('0x6d')+(0x8+_0x1085cc[_0x61b1('0x2d')][_0x61b1('0x3b')])+'}'+','+0x1));return _0xe09396;}function formatPrefixName(_0x26f895){var _0x14617a='_';for(var _0x230ba8=0x0;_0x230ba8<_0x26f895[_0x61b1('0x3b')];_0x230ba8++){if(_0x26f895[_0x61b1('0x6e')](_0x230ba8)=='-'){_0x14617a+=_0x26f895['charAt'](_0x230ba8);}else{_0x14617a+='['+_0x26f895[_0x61b1('0x6e')](_0x230ba8)+']';}}_0x14617a+='.';return _0x14617a;}exports[_0x61b1('0x25')]=function(_0x2382db,_0x62a233,_0x196802){var _0x4a9968=_0x2382db[_0x61b1('0x53')];_0x4a9968[_0x61b1('0x61')]=_0x61b1('0x6f')+_0x4a9968[_0x61b1('0x2d')]+'-';return db[_0x61b1('0x51')][_0x61b1('0x52')](function(_0x166a1e){return db[_0x61b1('0x4d')]['update'](_0x4a9968,{'where':{'id':_0x4a9968['id']},'transaction':_0x166a1e})['then'](function(){return db[_0x61b1('0x54')][_0x61b1('0x26')]({'where':{'VoicePrefixId':_0x4a9968['id']},'transaction':_0x166a1e})[_0x61b1('0x27')](function(){return db['VoiceExtension'][_0x61b1('0x4e')]({'where':{'id':_0x4a9968[_0x61b1('0x55')]},'raw':!![]})[_0x61b1('0x27')](function(_0x4efb11){return createVoicePrefixExtensions(_0x4a9968,_0x4efb11,_0x166a1e);});});});})[_0x61b1('0x27')](function(){return db[_0x61b1('0x4d')][_0x61b1('0x70')](_0x4a9968['id']);})[_0x61b1('0x27')](respondWithResult(_0x62a233,null))[_0x61b1('0x49')](handleError(_0x62a233,null));};exports['addAgents']=function(_0x553637,_0x2c2dac,_0x15c79f){return db[_0x61b1('0x4d')][_0x61b1('0x4e')]({'where':{'id':_0x553637[_0x61b1('0x4b')]['id']}})[_0x61b1('0x27')](handleEntityNotFound(_0x2c2dac,null))['then'](function(_0x34d0ca){if(_0x34d0ca){return _0x34d0ca[_0x61b1('0x71')](_0x553637[_0x61b1('0x53')][_0x61b1('0x72')],_[_0x61b1('0x73')](_0x553637[_0x61b1('0x53')],['ids','id'])||{})[_0x61b1('0x74')](function(_0xe06c80){for(var _0x40a79e=0x0;_0x40a79e<_0x553637[_0x61b1('0x53')]['ids'][_0x61b1('0x3b')];_0x40a79e+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x553637['body'][_0x61b1('0x72')][_0x40a79e],'VoicePrefixId':_0x553637[_0x61b1('0x4b')]['id']});}return _0xe06c80;});}})[_0x61b1('0x27')](respondWithResult(_0x2c2dac,null))[_0x61b1('0x49')](handleError(_0x2c2dac,null));};exports[_0x61b1('0x75')]=function(_0x22ca55,_0x2f61f2,_0xcaf3c7){return db[_0x61b1('0x4d')][_0x61b1('0x4e')]({'where':{'id':_0x22ca55[_0x61b1('0x4b')]['id']}})[_0x61b1('0x27')](handleEntityNotFound(_0x2f61f2,null))[_0x61b1('0x27')](function(_0xa1b429){if(_0xa1b429){return _0xa1b429['removeAgents'](_0x22ca55[_0x61b1('0x35')][_0x61b1('0x72')])[_0x61b1('0x27')](function(){if(_[_0x61b1('0x76')](_0x22ca55['query'][_0x61b1('0x72')])){for(var _0x20cea8=0x0;_0x20cea8<_0x22ca55[_0x61b1('0x35')][_0x61b1('0x72')][_0x61b1('0x3b')];_0x20cea8+=0x1){socket[_0x61b1('0x77')](_0x61b1('0x78'),{'UserId':Number(_0x22ca55[_0x61b1('0x35')][_0x61b1('0x72')][_0x20cea8]),'VoicePrefixId':Number(_0x22ca55['params']['id'])});}}else{socket[_0x61b1('0x77')](_0x61b1('0x78'),{'UserId':Number(_0x22ca55[_0x61b1('0x35')][_0x61b1('0x72')]),'VoicePrefixId':Number(_0x22ca55[_0x61b1('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x2f61f2,null))[_0x61b1('0x49')](handleError(_0x2f61f2,null));};exports[_0x61b1('0x79')]=function(_0xdb9a3a,_0x41f461,_0x3e297e){var _0x126997={};var _0x3e02d6={};var _0x13f23f;var _0x30166b;return db['VoicePrefix'][_0x61b1('0x7a')]({'where':{'id':_0xdb9a3a[_0x61b1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41f461,null))[_0x61b1('0x27')](function(_0x582a32){if(_0x582a32){_0x13f23f=_0x582a32;_0x3e02d6[_0x61b1('0x34')]=_[_0x61b1('0x36')](db['User'][_0x61b1('0x30')]);_0x3e02d6['query']=_[_0x61b1('0x36')](_0xdb9a3a['query']);_0x3e02d6['filters']=_[_0x61b1('0x38')](_0x3e02d6[_0x61b1('0x34')],_0x3e02d6['query']);_0x126997[_0x61b1('0x3a')]=_[_0x61b1('0x38')](_0x3e02d6['model'],qs[_0x61b1('0x39')](_0xdb9a3a[_0x61b1('0x35')][_0x61b1('0x39')]));_0x126997[_0x61b1('0x3a')]=_0x126997[_0x61b1('0x3a')][_0x61b1('0x3b')]?_0x126997[_0x61b1('0x3a')]:_0x3e02d6[_0x61b1('0x34')];_0x126997[_0x61b1('0x3e')]=qs[_0x61b1('0x3f')](_0xdb9a3a[_0x61b1('0x35')][_0x61b1('0x3f')]);_0x126997[_0x61b1('0x40')]=qs[_0x61b1('0x37')](_[_0x61b1('0x41')](_0xdb9a3a[_0x61b1('0x35')],_0x3e02d6[_0x61b1('0x37')]));if(_0xdb9a3a['query'][_0x61b1('0x42')]){_0x126997[_0x61b1('0x40')]=_['merge'](_0x126997[_0x61b1('0x40')],{'$or':_[_0x61b1('0x2f')](_0x126997[_0x61b1('0x3a')],function(_0x3d22c6){var _0x457973={};_0x457973[_0x3d22c6]={'$like':'%'+_0xdb9a3a[_0x61b1('0x35')][_0x61b1('0x42')]+'%'};return _0x457973;})});}_0x126997=_[_0x61b1('0x43')]({},_0x126997,_0xdb9a3a['options']);return _0x13f23f[_0x61b1('0x79')](_0x126997);}})[_0x61b1('0x27')](function(_0x3350bd){if(_0x3350bd){_0x30166b=_0x3350bd[_0x61b1('0x3b')];if(!_0xdb9a3a[_0x61b1('0x35')][_0x61b1('0x3c')](_0x61b1('0x3d'))){_0x126997[_0x61b1('0x21')]=qs[_0x61b1('0x21')](_0xdb9a3a['query'][_0x61b1('0x21')]);_0x126997[_0x61b1('0x20')]=qs[_0x61b1('0x20')](_0xdb9a3a[_0x61b1('0x35')]['offset']);}return _0x13f23f[_0x61b1('0x79')](_0x126997);}})[_0x61b1('0x27')](function(_0xd712f8){if(_0xd712f8){return _0xd712f8?{'count':_0x30166b,'rows':_0xd712f8}:null;}})[_0x61b1('0x27')](respondWithResult(_0x41f461,null))[_0x61b1('0x49')](handleError(_0x41f461,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 048ff9c..e36fd1d 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 _0x3e74=['hasOwnProperty','exports','events','VoicePrefix','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x3e12a7,_0x34c2a6){_0x3e12a7=_0x3e12a7-0x0;var _0x135bb5=_0x3e74[_0x3e12a7];return _0x135bb5;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x43e7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){VoicePrefixEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);VoicePrefixEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=VoicePrefixEvents; \ No newline at end of file +var _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x55b093,_0x532595){var _0x10dfba=function(_0x21225f){while(--_0x21225f){_0x55b093['push'](_0x55b093['shift']());}};_0x10dfba(++_0x532595);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 7a13234..305912f 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 _0x4200=['bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','util','../../config/logger','api'];(function(_0x2f5de9,_0x2485be){var _0x890a7f=function(_0x1687da){while(--_0x1687da){_0x2f5de9['push'](_0x2f5de9['shift']());}};_0x890a7f(++_0x2485be);}(_0x4200,0xe1));var _0x0420=function(_0x8ba184,_0x45ed1b){_0x8ba184=_0x8ba184-0x0;var _0x4f0f8c=_0x4200[_0x8ba184];return _0x4f0f8c;};'use strict';var _=require('lodash');var util=require(_0x0420('0x0'));var logger=require(_0x0420('0x1'))(_0x0420('0x2'));var moment=require('moment');var BPromise=require(_0x0420('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0420('0x4'));var rimraf=require(_0x0420('0x5'));var config=require(_0x0420('0x6'));var attributes=require(_0x0420('0x7'));module[_0x0420('0x8')]=function(_0x1be5cb,_0x4ca8d4){return _0x1be5cb[_0x0420('0x9')](_0x0420('0xa'),attributes,{'tableName':_0x0420('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c1a=['bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','moment'];(function(_0x4186c3,_0x1c0521){var _0x23ff6c=function(_0x459a01){while(--_0x459a01){_0x4186c3['push'](_0x4186c3['shift']());}};_0x23ff6c(++_0x1c0521);}(_0x2c1a,0x1ac));var _0xa2c1=function(_0x568b73,_0x403347){_0x568b73=_0x568b73-0x0;var _0x2ff268=_0x2c1a[_0x568b73];return _0x2ff268;};'use strict';var _=require(_0xa2c1('0x0'));var util=require('util');var logger=require(_0xa2c1('0x1'))(_0xa2c1('0x2'));var moment=require(_0xa2c1('0x3'));var BPromise=require(_0xa2c1('0x4'));var rp=require(_0xa2c1('0x5'));var fs=require('fs');var path=require(_0xa2c1('0x6'));var rimraf=require(_0xa2c1('0x7'));var config=require('../../config/environment');var attributes=require(_0xa2c1('0x8'));module[_0xa2c1('0x9')]=function(_0x11d2e7,_0x5d8c8c){return _0x11d2e7['define'](_0xa2c1('0xa'),attributes,{'tableName':_0xa2c1('0xb'),'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 cda2c21..91e46a5 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 _0xd15b=['redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client'];(function(_0x2a2dcb,_0x569773){var _0x2cadd5=function(_0x30a451){while(--_0x30a451){_0x2a2dcb['push'](_0x2a2dcb['shift']());}};_0x2cadd5(++_0x569773);}(_0xd15b,0x187));var _0xbd15=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd15b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbd15('0x0'));var util=require(_0xbd15('0x1'));var moment=require(_0xbd15('0x2'));var BPromise=require(_0xbd15('0x3'));var rs=require(_0xbd15('0x4'));var fs=require('fs');var Redis=require(_0xbd15('0x5'));var db=require(_0xbd15('0x6'))['db'];var utils=require(_0xbd15('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbd15('0x8')]['http']({'port':0x232a});config[_0xbd15('0x9')]=_['defaults'](config[_0xbd15('0x9')],{'host':_0xbd15('0xa'),'port':0x18eb});var socket=require(_0xbd15('0xb'))(new Redis(config[_0xbd15('0x9')]));require(_0xbd15('0xc'))[_0xbd15('0xd')](socket);function respondWithRpcPromise(_0x1ce8b1,_0x5f0303,_0x52dd2c){return new BPromise(function(_0x1e103e,_0x2c6420){return client['request'](_0x1ce8b1,_0x52dd2c)[_0xbd15('0xe')](function(_0xebe547){logger['info'](_0xbd15('0xf'),_0x5f0303,_0xbd15('0x10'));logger[_0xbd15('0x11')](_0xbd15('0x12'),_0x5f0303,_0xbd15('0x10'),JSON[_0xbd15('0x13')](_0xebe547));if(_0xebe547[_0xbd15('0x14')]){if(_0xebe547['error']['code']===0x1f4){logger['error'](_0xbd15('0xf'),_0x5f0303,_0xebe547['error'][_0xbd15('0x15')]);return _0x2c6420(_0xebe547[_0xbd15('0x14')][_0xbd15('0x15')]);}logger['error'](_0xbd15('0xf'),_0x5f0303,_0xebe547[_0xbd15('0x14')][_0xbd15('0x15')]);return _0x1e103e(_0xebe547[_0xbd15('0x14')][_0xbd15('0x15')]);}else{logger[_0xbd15('0x16')](_0xbd15('0xf'),_0x5f0303,_0xbd15('0x10'));_0x1e103e(_0xebe547[_0xbd15('0x17')]['message']);}})[_0xbd15('0x18')](function(_0x10f675){logger[_0xbd15('0x14')](_0xbd15('0xf'),_0x5f0303,_0x10f675);_0x2c6420(_0x10f675);});});} \ No newline at end of file +var _0x0aa1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring'];(function(_0x535019,_0x5c68f6){var _0x2cd7f9=function(_0x3ea530){while(--_0x3ea530){_0x535019['push'](_0x535019['shift']());}};_0x2cd7f9(++_0x5c68f6);}(_0x0aa1,0x129));var _0x10aa=function(_0x257ca5,_0x3f0ecb){_0x257ca5=_0x257ca5-0x0;var _0x33c99f=_0x0aa1[_0x257ca5];return _0x33c99f;};'use strict';var _=require(_0x10aa('0x0'));var util=require('util');var moment=require(_0x10aa('0x1'));var BPromise=require('bluebird');var rs=require(_0x10aa('0x2'));var fs=require('fs');var Redis=require(_0x10aa('0x3'));var db=require(_0x10aa('0x4'))['db'];var utils=require(_0x10aa('0x5'));var logger=require(_0x10aa('0x6'))('rpc');var config=require(_0x10aa('0x7'));var jayson=require(_0x10aa('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x10aa('0x9')]=_[_0x10aa('0xa')](config[_0x10aa('0x9')],{'host':_0x10aa('0xb'),'port':0x18eb});var socket=require(_0x10aa('0xc'))(new Redis(config[_0x10aa('0x9')]));require(_0x10aa('0xd'))[_0x10aa('0xe')](socket);function respondWithRpcPromise(_0x5d9e09,_0x5b6d0f,_0x151b1a){return new BPromise(function(_0x597ea8,_0x2f928c){return client['request'](_0x5d9e09,_0x151b1a)[_0x10aa('0xf')](function(_0x47a105){logger[_0x10aa('0x10')](_0x10aa('0x11'),_0x5b6d0f,_0x10aa('0x12'));logger['debug'](_0x10aa('0x13'),_0x5b6d0f,_0x10aa('0x12'),JSON['stringify'](_0x47a105));if(_0x47a105[_0x10aa('0x14')]){if(_0x47a105[_0x10aa('0x14')][_0x10aa('0x15')]===0x1f4){logger[_0x10aa('0x14')](_0x10aa('0x11'),_0x5b6d0f,_0x47a105[_0x10aa('0x14')][_0x10aa('0x16')]);return _0x2f928c(_0x47a105[_0x10aa('0x14')][_0x10aa('0x16')]);}logger[_0x10aa('0x14')](_0x10aa('0x11'),_0x5b6d0f,_0x47a105['error'][_0x10aa('0x16')]);return _0x597ea8(_0x47a105[_0x10aa('0x14')][_0x10aa('0x16')]);}else{logger[_0x10aa('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x5b6d0f,'request\x20sent');_0x597ea8(_0x47a105[_0x10aa('0x17')][_0x10aa('0x16')]);}})[_0x10aa('0x18')](function(_0x5357de){logger[_0x10aa('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x5b6d0f,_0x5357de);_0x2f928c(_0x5357de);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f971d2b..63c9f6d 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 _0xc84c=['register','length','voicePrefix:','./voicePrefix.events','save','emit','removeListener'];(function(_0x3b399f,_0x8c9abd){var _0x11c97c=function(_0x38b510){while(--_0x38b510){_0x3b399f['push'](_0x3b399f['shift']());}};_0x11c97c(++_0x8c9abd);}(_0xc84c,0x13e));var _0xcc84=function(_0x3ecc30,_0x75412b){_0x3ecc30=_0x3ecc30-0x0;var _0x2682bc=_0xc84c[_0x3ecc30];return _0x2682bc;};'use strict';var VoicePrefixEvents=require(_0xcc84('0x0'));var events=[_0xcc84('0x1'),'remove','update'];function createListener(_0x4d570c,_0x1089bf){return function(_0x576b80){_0x1089bf[_0xcc84('0x2')](_0x4d570c,_0x576b80);};}function removeListener(_0x205f0c,_0x254518){return function(){VoicePrefixEvents[_0xcc84('0x3')](_0x205f0c,_0x254518);};}exports[_0xcc84('0x4')]=function(_0x5b97b8){for(var _0x34cf4c=0x0,_0x4ee335=events[_0xcc84('0x5')];_0x34cf4c<_0x4ee335;_0x34cf4c++){var _0x1f3c7b=events[_0x34cf4c];var _0x9e143f=createListener(_0xcc84('0x6')+_0x1f3c7b,_0x5b97b8);VoicePrefixEvents['on'](_0x1f3c7b,_0x9e143f);}}; \ No newline at end of file +var _0xd81f=['removeListener','register','length','voicePrefix:','./voicePrefix.events','remove','update','emit'];(function(_0x1a6ac7,_0x34cda8){var _0x4d7b2=function(_0x50dc62){while(--_0x50dc62){_0x1a6ac7['push'](_0x1a6ac7['shift']());}};_0x4d7b2(++_0x34cda8);}(_0xd81f,0x1d4));var _0xfd81=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xd81f[_0x55abd9];return _0x3e5669;};'use strict';var VoicePrefixEvents=require(_0xfd81('0x0'));var events=['save',_0xfd81('0x1'),_0xfd81('0x2')];function createListener(_0x12ce53,_0x38d64e){return function(_0x274b53){_0x38d64e[_0xfd81('0x3')](_0x12ce53,_0x274b53);};}function removeListener(_0x5c07fe,_0x4998c1){return function(){VoicePrefixEvents[_0xfd81('0x4')](_0x5c07fe,_0x4998c1);};}exports[_0xfd81('0x5')]=function(_0xcb89b){for(var _0x1a3946=0x0,_0x2b635e=events[_0xfd81('0x6')];_0x1a3946<_0x2b635e;_0x1a3946++){var _0x3fb404=events[_0x1a3946];var _0x564f93=createListener(_0xfd81('0x7')+_0x3fb404,_0xcb89b);VoicePrefixEvents['on'](_0x3fb404,_0x564f93);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 46933b1..bcb1319 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 _0x76b7=['destroy','removeAgents','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','/:id/members','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','put','/:id','update','delete'];(function(_0x54f493,_0x385811){var _0x5f2b47=function(_0x2d2323){while(--_0x2d2323){_0x54f493['push'](_0x54f493['shift']());}};_0x5f2b47(++_0x385811);}(_0x76b7,0x1e5));var _0x776b=function(_0x6d1ca7,_0x3aa503){_0x6d1ca7=_0x6d1ca7-0x0;var _0x24fa1e=_0x76b7[_0x6d1ca7];return _0x24fa1e;};'use strict';var multer=require('multer');var util=require(_0x776b('0x0'));var path=require(_0x776b('0x1'));var timeout=require(_0x776b('0x2'));var express=require(_0x776b('0x3'));var router=express[_0x776b('0x4')]();var auth=require(_0x776b('0x5'));var interaction=require(_0x776b('0x6'));var config=require(_0x776b('0x7'));var controller=require('./voiceQueue.controller');router[_0x776b('0x8')]('/',auth[_0x776b('0x9')](),controller[_0x776b('0xa')]);router[_0x776b('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x776b('0xb')]);router[_0x776b('0x8')](_0x776b('0xc'),auth['isAuthenticated'](),controller['getHoppers']);router[_0x776b('0x8')](_0x776b('0xd'),auth[_0x776b('0x9')](),controller[_0x776b('0xe')]);router['get']('/:id/hopper_finals',auth[_0x776b('0x9')](),controller['getHopperFinals']);router[_0x776b('0x8')](_0x776b('0xf'),auth[_0x776b('0x9')](),controller[_0x776b('0x10')]);router[_0x776b('0x8')](_0x776b('0x11'),auth[_0x776b('0x9')](),controller[_0x776b('0x12')]);router['get'](_0x776b('0x13'),auth[_0x776b('0x9')](),controller['getAgents']);router['get'](_0x776b('0x14'),auth[_0x776b('0x9')](),controller['getMembers']);router['get'](_0x776b('0x15'),auth['isAuthenticated'](),controller[_0x776b('0x16')]);router[_0x776b('0x8')](_0x776b('0x17'),auth[_0x776b('0x9')](),controller[_0x776b('0x18')]);router[_0x776b('0x19')]('/',auth[_0x776b('0x9')](),controller[_0x776b('0x1a')]);router['post'](_0x776b('0x1b'),auth[_0x776b('0x9')](),controller[_0x776b('0x1c')]);router[_0x776b('0x19')](_0x776b('0x11'),auth[_0x776b('0x9')](),controller[_0x776b('0x1d')]);router[_0x776b('0x19')](_0x776b('0x13'),auth['isAuthenticated'](),controller[_0x776b('0x1e')]);router[_0x776b('0x19')](_0x776b('0x15'),auth['isAuthenticated'](),controller['addLists']);router['post'](_0x776b('0x17'),auth[_0x776b('0x9')](),controller['addBlackLists']);router[_0x776b('0x1f')](_0x776b('0x20'),auth['isAuthenticated'](),controller[_0x776b('0x21')]);router[_0x776b('0x22')](_0x776b('0x20'),auth[_0x776b('0x9')](),controller[_0x776b('0x23')]);router[_0x776b('0x22')](_0x776b('0x11'),auth[_0x776b('0x9')](),controller['removeTeams']);router[_0x776b('0x22')](_0x776b('0x13'),auth['isAuthenticated'](),controller[_0x776b('0x24')]);router[_0x776b('0x22')]('/:id/lists',auth[_0x776b('0x9')](),controller[_0x776b('0x25')]);router[_0x776b('0x22')](_0x776b('0x17'),auth[_0x776b('0x9')](),controller[_0x776b('0x26')]);module[_0x776b('0x27')]=router; \ No newline at end of file +var _0x81db=['/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addTeams','addAgents','/:id/lists','put','update','delete','removeTeams','removeLists','removeBlackLists','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','index','get','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories'];(function(_0x4b4bb0,_0x4c335b){var _0x3ada1f=function(_0x3ec566){while(--_0x3ec566){_0x4b4bb0['push'](_0x4b4bb0['shift']());}};_0x3ada1f(++_0x4c335b);}(_0x81db,0x1e0));var _0xb81d=function(_0x3f8ba3,_0x4fe833){_0x3f8ba3=_0x3f8ba3-0x0;var _0x1c2e73=_0x81db[_0x3f8ba3];return _0x1c2e73;};'use strict';var multer=require(_0xb81d('0x0'));var util=require(_0xb81d('0x1'));var path=require('path');var timeout=require(_0xb81d('0x2'));var express=require('express');var router=express[_0xb81d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb81d('0x4'));var config=require(_0xb81d('0x5'));var controller=require(_0xb81d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb81d('0x7')]);router[_0xb81d('0x8')](_0xb81d('0x9'),auth[_0xb81d('0xa')](),controller[_0xb81d('0xb')]);router[_0xb81d('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xb81d('0xc')]);router[_0xb81d('0x8')](_0xb81d('0xd'),auth[_0xb81d('0xa')](),controller['getHopperHistories']);router['get'](_0xb81d('0xe'),auth['isAuthenticated'](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0xb81d('0xa')](),controller[_0xb81d('0xf')]);router['get'](_0xb81d('0x10'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x11')]);router[_0xb81d('0x8')](_0xb81d('0x12'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x13')]);router[_0xb81d('0x8')](_0xb81d('0x14'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x15')]);router[_0xb81d('0x8')]('/:id/lists',auth['isAuthenticated'](),controller[_0xb81d('0x16')]);router[_0xb81d('0x8')](_0xb81d('0x17'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x18')]);router[_0xb81d('0x19')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xb81d('0x1a'),auth['isAuthenticated'](),controller[_0xb81d('0x1b')]);router[_0xb81d('0x19')](_0xb81d('0x10'),auth['isAuthenticated'](),controller[_0xb81d('0x1c')]);router[_0xb81d('0x19')](_0xb81d('0x12'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x1d')]);router['post'](_0xb81d('0x1e'),auth[_0xb81d('0xa')](),controller['addLists']);router[_0xb81d('0x19')]('/:id/blacklists',auth[_0xb81d('0xa')](),controller['addBlackLists']);router[_0xb81d('0x1f')]('/:id',auth[_0xb81d('0xa')](),controller[_0xb81d('0x20')]);router[_0xb81d('0x21')]('/:id',auth[_0xb81d('0xa')](),controller['destroy']);router[_0xb81d('0x21')](_0xb81d('0x10'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x22')]);router[_0xb81d('0x21')]('/:id/users',auth[_0xb81d('0xa')](),controller['removeAgents']);router[_0xb81d('0x21')](_0xb81d('0x1e'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x23')]);router[_0xb81d('0x21')](_0xb81d('0x17'),auth[_0xb81d('0xa')](),controller[_0xb81d('0x24')]);module[_0xb81d('0x25')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 27dc532..2bae62d 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(_0x4c8700,_0x25e672){var _0x16dcaa=function(_0x18c324){while(--_0x18c324){_0x4c8700['push'](_0x4c8700['shift']());}};_0x16dcaa(++_0x25e672);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x1bad26,_0xf6f79f){var _0x23b581=function(_0x4040c9){while(--_0x4040c9){_0x1bad26['push'](_0x1bad26['shift']());}};_0x23b581(++_0xf6f79f);}(_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')]={'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 3eda98c..2fcb182 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 _0x15d5=['fieldName','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','catch','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','createdAt','updatedAt','QueueCampaigns','params','findOne','CmHopper','VoiceQueueId','findAll','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','User','online','voicePause','interface','forEach','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','penalty','emit','userVoiceQueue:save','removeTeams','Agents','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','all','union','compact','ids','isEmpty','userVoiceQueue:remove','addAgents','spread','removeAgents','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','ListId','select','phone','scheduledAt','ContactId','CmListId','toString','NOW()','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','removeLists','getBlackLists','addBlackLists','cm_hopper_black','deletedAt\x20IS\x20NULL','removeBlackLists','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','./voiceQueue.socket','register','status','end','json','count','offset','limit','set','apply','update','then','destroy','get','outbound','filter','ignore','value','includes','type','name','UserProfileResource','sendStatus','error','stack','send','index','map','VoiceQueue','rawAttributes'];(function(_0x3f4932,_0x34425e){var _0xafc18b=function(_0x45f50a){while(--_0x45f50a){_0x3f4932['push'](_0x3f4932['shift']());}};_0xafc18b(++_0x34425e);}(_0x15d5,0x7e));var _0x515d=function(_0x22d2b9,_0x3a9312){_0x22d2b9=_0x22d2b9-0x0;var _0x8c44ef=_0x15d5[_0x22d2b9];return _0x8c44ef;};'use strict';var pdf=require(_0x515d('0x0'));var emlformat=require(_0x515d('0x1'));var rimraf=require(_0x515d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x515d('0x3'));var rp=require(_0x515d('0x4'));var moment=require(_0x515d('0x5'));var BPromise=require(_0x515d('0x6'));var Mustache=require(_0x515d('0x7'));var util=require('util');var path=require(_0x515d('0x8'));var sox=require('sox');var csv=require(_0x515d('0x9'));var ejs=require(_0x515d('0xa'));var fs=require('fs');var _=require(_0x515d('0xb'));var squel=require(_0x515d('0xc'));var crypto=require(_0x515d('0xd'));var jsforce=require(_0x515d('0xe'));var deskjs=require(_0x515d('0xf'));var toCsv=require(_0x515d('0x9'));var querystring=require(_0x515d('0x10'));var Papa=require(_0x515d('0x11'));var Redis=require('ioredis');var authService=require(_0x515d('0x12'));var qs=require(_0x515d('0x13'));var as=require(_0x515d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x515d('0x15'));var utils=require(_0x515d('0x16'));var config=require(_0x515d('0x17'));var db=require('../../mysqldb')['db'];config[_0x515d('0x18')]=_[_0x515d('0x19')](config[_0x515d('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x515d('0x18')]));require(_0x515d('0x1a'))[_0x515d('0x1b')](socket);function respondWithStatusCode(_0x23e507,_0x232758){_0x232758=_0x232758||0xcc;return function(_0x1a1df7){if(_0x1a1df7){return _0x23e507['sendStatus'](_0x232758);}return _0x23e507[_0x515d('0x1c')](_0x232758)[_0x515d('0x1d')]();};}function respondWithResult(_0x462c4c,_0x224c25){_0x224c25=_0x224c25||0xc8;return function(_0x52be4f){if(_0x52be4f){return _0x462c4c['status'](_0x224c25)[_0x515d('0x1e')](_0x52be4f);}};}function respondWithFilteredResult(_0x4c21a0,_0x4d3b11){return function(_0x176082){if(_0x176082){var _0x435be0=_0x176082[_0x515d('0x1f')],_0x26a955=_0x4d3b11[_0x515d('0x20')],_0x5d27df=_0x4d3b11[_0x515d('0x20')]+_0x4d3b11[_0x515d('0x21')],_0x52db60;if(_0x5d27df>=_0x435be0){_0x5d27df=_0x435be0;_0x52db60=0xc8;}else{_0x52db60=0xce;}_0x4c21a0['status'](_0x52db60);return _0x4c21a0[_0x515d('0x22')]('Content-Range',_0x26a955+'-'+_0x5d27df+'/'+_0x435be0)[_0x515d('0x1e')](_0x176082);}return null;};}function patchUpdates(_0x6e834a){return function(_0xcb6759){try{jsonpatch[_0x515d('0x23')](_0xcb6759,_0x6e834a,!![]);}catch(_0x1bb372){return BPromise['reject'](_0x1bb372);}return _0xcb6759['save']();};}function saveUpdates(_0x15f54e,_0x3a8106){return function(_0x3fa849){if(_0x3fa849){return _0x3fa849[_0x515d('0x24')](_0x15f54e)[_0x515d('0x25')](function(_0x3be20a){return _0x3be20a;});}return null;};}function removeEntity(_0x3ea406,_0x25a983){return function(_0x519445){if(_0x519445){return _0x519445[_0x515d('0x26')]()[_0x515d('0x25')](function(){var _0x377e32=_0x519445[_0x515d('0x27')]({'plain':!![]});var _0x1be2ab=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x515d('0x28'),'ignore':![]}];var _0x6298ab=_(_0x1be2ab)[_0x515d('0x29')](_0x515d('0x2a'))['map'](_0x515d('0x2b'))[_0x515d('0x2b')]();if(_[_0x515d('0x2c')](_0x6298ab,_0x377e32[_0x515d('0x2d')])){return;}var _0x19d7d0=_['find'](_0x1be2ab,[_0x515d('0x2b'),_0x377e32['type']])[_0x515d('0x2e')];return db[_0x515d('0x2f')][_0x515d('0x26')]({'where':{'type':_0x19d7d0,'resourceId':_0x377e32['id']}})['then'](function(){return _0x519445;});})[_0x515d('0x25')](function(){_0x3ea406[_0x515d('0x1c')](0xcc)[_0x515d('0x1d')]();});}};}function handleEntityNotFound(_0x4647dd,_0x240256){return function(_0x5251d5){if(!_0x5251d5){_0x4647dd[_0x515d('0x30')](0x194);}return _0x5251d5;};}function handleError(_0x51fddb,_0x5c80ae){_0x5c80ae=_0x5c80ae||0x1f4;return function(_0x22d222){logger[_0x515d('0x31')](_0x22d222[_0x515d('0x32')]);if(_0x22d222[_0x515d('0x2e')]){delete _0x22d222[_0x515d('0x2e')];}_0x51fddb[_0x515d('0x1c')](_0x5c80ae)[_0x515d('0x33')](_0x22d222);};}exports[_0x515d('0x34')]=function(_0x2b35aa,_0xebbd86){var _0x59203b={},_0x1af3e9={},_0x28818b={'count':0x0,'rows':[]};var _0x180530=_[_0x515d('0x35')](db[_0x515d('0x36')][_0x515d('0x37')],function(_0x571732){return{'name':_0x571732[_0x515d('0x38')],'type':_0x571732[_0x515d('0x2d')][_0x515d('0x39')]};});_0x1af3e9[_0x515d('0x3a')]=_[_0x515d('0x35')](_0x180530,_0x515d('0x2e'));_0x1af3e9['query']=_['keys'](_0x2b35aa['query']);_0x1af3e9[_0x515d('0x3b')]=_[_0x515d('0x3c')](_0x1af3e9[_0x515d('0x3a')],_0x1af3e9[_0x515d('0x3d')]);_0x59203b[_0x515d('0x3e')]=_[_0x515d('0x3c')](_0x1af3e9[_0x515d('0x3a')],qs['fields'](_0x2b35aa['query'][_0x515d('0x3f')]));_0x59203b['attributes']=_0x59203b[_0x515d('0x3e')][_0x515d('0x40')]?_0x59203b[_0x515d('0x3e')]:_0x1af3e9['model'];if(!_0x2b35aa['query'][_0x515d('0x41')](_0x515d('0x42'))){_0x59203b['limit']=qs[_0x515d('0x21')](_0x2b35aa[_0x515d('0x3d')][_0x515d('0x21')]);_0x59203b[_0x515d('0x20')]=qs[_0x515d('0x20')](_0x2b35aa['query'][_0x515d('0x20')]);}_0x59203b[_0x515d('0x43')]=qs[_0x515d('0x44')](_0x2b35aa[_0x515d('0x3d')][_0x515d('0x44')]);_0x59203b[_0x515d('0x45')]=qs[_0x515d('0x3b')](_[_0x515d('0x46')](_0x2b35aa[_0x515d('0x3d')],_0x1af3e9[_0x515d('0x3b')]),_0x180530);if(_0x2b35aa[_0x515d('0x3d')]['filter']){_0x59203b[_0x515d('0x45')]=_[_0x515d('0x47')](_0x59203b[_0x515d('0x45')],{'$or':_[_0x515d('0x35')](_0x180530,function(_0x102ffd){if(_0x102ffd[_0x515d('0x2d')]!==_0x515d('0x48')){var _0x485efc={};_0x485efc[_0x102ffd[_0x515d('0x2e')]]={'$like':'%'+_0x2b35aa[_0x515d('0x3d')][_0x515d('0x29')]+'%'};return _0x485efc;}})});}_0x59203b=_[_0x515d('0x47')]({},_0x59203b,_0x2b35aa[_0x515d('0x49')]);var _0xa1e520={'where':_0x59203b[_0x515d('0x45')]};return db[_0x515d('0x36')][_0x515d('0x1f')](_0xa1e520)['then'](function(_0x23d698){_0x28818b[_0x515d('0x1f')]=_0x23d698;if(_0x2b35aa[_0x515d('0x3d')][_0x515d('0x4a')]){_0x59203b[_0x515d('0x4b')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x59203b);})[_0x515d('0x25')](function(_0x59f84c){_0x28818b['rows']=_0x59f84c;return _0x28818b;})[_0x515d('0x25')](respondWithFilteredResult(_0xebbd86,_0x59203b))[_0x515d('0x4c')](handleError(_0xebbd86,null));};exports[_0x515d('0x4d')]=function(_0x2515af,_0x3851c8){var _0x251d58={'raw':![],'where':{'id':_0x2515af['params']['id']}},_0x526dff={};_0x526dff['model']=_[_0x515d('0x4e')](db[_0x515d('0x36')][_0x515d('0x37')]);_0x526dff[_0x515d('0x3d')]=_['keys'](_0x2515af[_0x515d('0x3d')]);_0x526dff[_0x515d('0x3b')]=_[_0x515d('0x3c')](_0x526dff['model'],_0x526dff['query']);_0x251d58['attributes']=_[_0x515d('0x3c')](_0x526dff[_0x515d('0x3a')],qs[_0x515d('0x3f')](_0x2515af[_0x515d('0x3d')][_0x515d('0x3f')]));_0x251d58[_0x515d('0x3e')]=_0x251d58['attributes'][_0x515d('0x40')]?_0x251d58[_0x515d('0x3e')]:_0x526dff['model'];if(_0x2515af['query'][_0x515d('0x4a')]){_0x251d58[_0x515d('0x4b')]=[{'all':!![]}];}_0x251d58=_[_0x515d('0x47')]({},_0x251d58,_0x2515af[_0x515d('0x49')]);return db[_0x515d('0x36')][_0x515d('0x4f')](_0x251d58)['then'](handleEntityNotFound(_0x3851c8,null))['then'](respondWithResult(_0x3851c8,null))[_0x515d('0x4c')](handleError(_0x3851c8,null));};exports[_0x515d('0x50')]=function(_0xea84fb,_0x13b38a){return db[_0x515d('0x36')][_0x515d('0x50')](_0xea84fb['body'],{})[_0x515d('0x25')](function(_0x573080){var _0x32a402=_0xea84fb[_0x515d('0x51')][_0x515d('0x27')]({'plain':!![]});if(!_0x32a402)throw new Error(_0x515d('0x52'));if(_0x32a402[_0x515d('0x53')]===_0x515d('0x51')){var _0x2e33ef=_0x573080[_0x515d('0x27')]({'plain':!![]});var _0x14e4b3=[{'name':_0x515d('0x54'),'value':_0x515d('0x55')},{'name':'QueueCampaigns','value':_0x515d('0x28')}];var _0x28ad68=_[_0x515d('0x4f')](_0x14e4b3,[_0x515d('0x2b'),_0x2e33ef['type']])[_0x515d('0x2e')];return db[_0x515d('0x56')][_0x515d('0x4f')]({'where':{'name':_0x28ad68,'userProfileId':_0x32a402[_0x515d('0x57')]},'raw':!![]})[_0x515d('0x25')](function(_0x3dd52d){if(_0x3dd52d&&_0x3dd52d[_0x515d('0x58')]===0x0){return db[_0x515d('0x2f')][_0x515d('0x50')]({'name':_0x2e33ef[_0x515d('0x2e')],'resourceId':_0x2e33ef['id'],'type':_0x3dd52d[_0x515d('0x2e')],'sectionId':_0x3dd52d['id']},{})[_0x515d('0x25')](function(){return _0x573080;});}else{return _0x573080;}})['catch'](function(_0x342fda){logger['error'](_0x515d('0x59'),_0x342fda);throw _0x342fda;});}return _0x573080;})[_0x515d('0x25')](respondWithResult(_0x13b38a,0xc9))[_0x515d('0x4c')](handleError(_0x13b38a,null));};exports[_0x515d('0x5a')]=function(_0x1fce8a,_0x13458c){var _0x2f302d={'where':{'id':_0x1fce8a['params']['id']}},_0x12116a={};_0x12116a[_0x515d('0x3a')]=_['keys'](db[_0x515d('0x36')]['rawAttributes']);_0x2f302d[_0x515d('0x3e')]=_[_0x515d('0x3c')](_0x12116a[_0x515d('0x3a')],qs[_0x515d('0x3f')](_0x1fce8a[_0x515d('0x3d')][_0x515d('0x3f')]));_0x2f302d[_0x515d('0x3e')]=_0x2f302d['attributes'][_0x515d('0x40')]?_0x2f302d[_0x515d('0x3e')]:_0x12116a['model'];if(_0x1fce8a[_0x515d('0x3d')][_0x515d('0x4a')]){_0x2f302d['include']=[{'all':!![]}];}_0x2f302d=_[_0x515d('0x47')]({},_0x2f302d,_0x1fce8a[_0x515d('0x49')]);return db[_0x515d('0x36')][_0x515d('0x4f')](_0x2f302d)[_0x515d('0x25')](handleEntityNotFound(_0x13458c,null))['then'](function(_0xe97b55){if(_0xe97b55){var _0x3ec8d3=_0xe97b55[_0x515d('0x27')]({'plain':!![]});_0x3ec8d3=qs['omit'](_0x3ec8d3,['id','createdAt','updatedAt']);_0x1fce8a['body']=_[_0x515d('0x5b')](_0x1fce8a[_0x515d('0x5c')],['id',_0x515d('0x5d'),_0x515d('0x5e')]);return db[_0x515d('0x36')][_0x515d('0x50')](_[_0x515d('0x47')](_0x3ec8d3,_0x1fce8a[_0x515d('0x5c')]),{'include':_0x1fce8a[_0x515d('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0x515d('0x25')](function(_0x119f47){var _0x2de81a=_0x1fce8a[_0x515d('0x51')][_0x515d('0x27')]({'plain':!![]});if(!_0x2de81a)throw new Error(_0x515d('0x52'));if(_0x2de81a[_0x515d('0x53')]===_0x515d('0x51')){var _0x4b2e97=_0x119f47[_0x515d('0x27')]({'plain':!![]});var _0x217906=[{'name':'VoiceQueues','value':_0x515d('0x55')},{'name':_0x515d('0x5f'),'value':_0x515d('0x28')}];var _0x484b19=_[_0x515d('0x4f')](_0x217906,[_0x515d('0x2b'),_0x4b2e97[_0x515d('0x2d')]])['name'];return db['UserProfileSection'][_0x515d('0x4f')]({'where':{'name':_0x484b19,'userProfileId':_0x2de81a[_0x515d('0x57')]},'raw':!![]})[_0x515d('0x25')](function(_0x2ecee4){if(_0x2ecee4&&_0x2ecee4[_0x515d('0x58')]===0x0){return db[_0x515d('0x2f')][_0x515d('0x50')]({'name':_0x4b2e97['name'],'resourceId':_0x4b2e97['id'],'type':_0x2ecee4['name'],'sectionId':_0x2ecee4['id']},{})['then'](function(){return _0x119f47;});}else{return _0x119f47;}})[_0x515d('0x4c')](function(_0x44c111){logger[_0x515d('0x31')](_0x515d('0x59'),_0x44c111);throw _0x44c111;});}return _0x119f47;});}})[_0x515d('0x25')](respondWithResult(_0x13458c,0xc9))['catch'](handleError(_0x13458c,null));};exports[_0x515d('0x24')]=function(_0x43333c,_0x3e2117){if(_0x43333c[_0x515d('0x5c')]['id']){delete _0x43333c[_0x515d('0x5c')]['id'];}return db['VoiceQueue'][_0x515d('0x4f')]({'where':{'id':_0x43333c[_0x515d('0x60')]['id']}})[_0x515d('0x25')](handleEntityNotFound(_0x3e2117,null))[_0x515d('0x25')](saveUpdates(_0x43333c[_0x515d('0x5c')],null))[_0x515d('0x25')](respondWithResult(_0x3e2117,null))[_0x515d('0x4c')](handleError(_0x3e2117,null));};exports[_0x515d('0x26')]=function(_0x5935fa,_0x1ba612){return db[_0x515d('0x36')][_0x515d('0x4f')]({'where':{'id':_0x5935fa[_0x515d('0x60')]['id']}})[_0x515d('0x25')](handleEntityNotFound(_0x1ba612,null))[_0x515d('0x25')](removeEntity(_0x1ba612,null))[_0x515d('0x4c')](handleError(_0x1ba612,null));};exports['getHoppers']=function(_0x37a205,_0x586836,_0x252c32){var _0x43a4aa={'raw':![],'where':{}};var _0x9c22a9={};var _0x245245={'count':0x0,'rows':[]};return db[_0x515d('0x36')][_0x515d('0x61')]({'where':{'id':_0x37a205[_0x515d('0x60')]['id']}})[_0x515d('0x25')](handleEntityNotFound(_0x586836,null))[_0x515d('0x25')](function(_0x27bd4b){if(_0x27bd4b){_0x9c22a9[_0x515d('0x3a')]=_['keys'](db[_0x515d('0x62')][_0x515d('0x37')]);_0x9c22a9[_0x515d('0x3d')]=_[_0x515d('0x4e')](_0x37a205[_0x515d('0x3d')]);_0x9c22a9['filters']=_[_0x515d('0x3c')](_0x9c22a9[_0x515d('0x3a')],_0x9c22a9[_0x515d('0x3d')]);_0x43a4aa[_0x515d('0x3e')]=_[_0x515d('0x3c')](_0x9c22a9[_0x515d('0x3a')],qs[_0x515d('0x3f')](_0x37a205[_0x515d('0x3d')][_0x515d('0x3f')]));_0x43a4aa[_0x515d('0x3e')]=_0x43a4aa['attributes'][_0x515d('0x40')]?_0x43a4aa[_0x515d('0x3e')]:_0x9c22a9['model'];if(!_0x37a205[_0x515d('0x3d')][_0x515d('0x41')](_0x515d('0x42'))){_0x43a4aa[_0x515d('0x21')]=qs[_0x515d('0x21')](_0x37a205[_0x515d('0x3d')][_0x515d('0x21')]);_0x43a4aa[_0x515d('0x20')]=qs['offset'](_0x37a205['query']['offset']);}_0x43a4aa[_0x515d('0x43')]=qs['sort'](_0x37a205[_0x515d('0x3d')][_0x515d('0x44')]);_0x43a4aa[_0x515d('0x45')]=qs[_0x515d('0x3b')](_[_0x515d('0x46')](_0x37a205['query'],_0x9c22a9[_0x515d('0x3b')]));_0x43a4aa[_0x515d('0x45')][_0x515d('0x63')]=_0x27bd4b['id'];if(_0x37a205['query']['filter']){_0x43a4aa[_0x515d('0x45')]=_[_0x515d('0x47')](_0x43a4aa['where'],{'$or':_['map'](_0x43a4aa[_0x515d('0x3e')],function(_0x17e945){var _0x474ffa={};_0x474ffa[_0x17e945]={'$like':'%'+_0x37a205[_0x515d('0x3d')]['filter']+'%'};return _0x474ffa;})});}_0x43a4aa=_[_0x515d('0x47')]({},_0x43a4aa,_0x37a205['options']);return db['CmHopper'][_0x515d('0x1f')]({'where':_0x43a4aa[_0x515d('0x45')]})[_0x515d('0x25')](function(_0x209550){_0x245245[_0x515d('0x1f')]=_0x209550;if(_0x37a205[_0x515d('0x3d')][_0x515d('0x4a')]){_0x43a4aa[_0x515d('0x4b')]=[{'all':!![]}];}return db[_0x515d('0x62')][_0x515d('0x64')](_0x43a4aa);})[_0x515d('0x25')](function(_0x328e3b){_0x245245[_0x515d('0x65')]=_0x328e3b;return _0x245245;});}})[_0x515d('0x25')](respondWithFilteredResult(_0x586836,_0x43a4aa))[_0x515d('0x4c')](handleError(_0x586836,null));};exports['getHopperHistories']=function(_0x3d35cb,_0x36602f,_0xfa1047){var _0x3f5ad2={'raw':!![],'where':{}};var _0x416f1e={};var _0x2326ba={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x515d('0x61')]({'where':{'id':_0x3d35cb[_0x515d('0x60')]['id']}})[_0x515d('0x25')](handleEntityNotFound(_0x36602f,null))[_0x515d('0x25')](function(_0x4868ca){if(_0x4868ca){_0x416f1e[_0x515d('0x3a')]=_[_0x515d('0x4e')](db['CmHopperHistory'][_0x515d('0x37')]);_0x416f1e['query']=_['keys'](_0x3d35cb['query']);_0x416f1e[_0x515d('0x3b')]=_[_0x515d('0x3c')](_0x416f1e[_0x515d('0x3a')],_0x416f1e[_0x515d('0x3d')]);_0x3f5ad2['attributes']=_[_0x515d('0x3c')](_0x416f1e['model'],qs[_0x515d('0x3f')](_0x3d35cb[_0x515d('0x3d')][_0x515d('0x3f')]));_0x3f5ad2[_0x515d('0x3e')]=_0x3f5ad2[_0x515d('0x3e')]['length']?_0x3f5ad2[_0x515d('0x3e')]:_0x416f1e[_0x515d('0x3a')];if(!_0x3d35cb[_0x515d('0x3d')][_0x515d('0x41')](_0x515d('0x42'))){_0x3f5ad2['limit']=qs[_0x515d('0x21')](_0x3d35cb[_0x515d('0x3d')]['limit']);_0x3f5ad2['offset']=qs['offset'](_0x3d35cb[_0x515d('0x3d')][_0x515d('0x20')]);}_0x3f5ad2[_0x515d('0x43')]=qs[_0x515d('0x44')](_0x3d35cb['query'][_0x515d('0x44')]);_0x3f5ad2['where']=qs[_0x515d('0x3b')](_[_0x515d('0x46')](_0x3d35cb[_0x515d('0x3d')],_0x416f1e['filters']));_0x3f5ad2['where'][_0x515d('0x63')]=_0x4868ca['id'];if(_0x3d35cb['query'][_0x515d('0x29')]){_0x3f5ad2['where']=_[_0x515d('0x47')](_0x3f5ad2[_0x515d('0x45')],{'$or':_[_0x515d('0x35')](_0x3f5ad2[_0x515d('0x3e')],function(_0x58b4a1){var _0x315f5d={};_0x315f5d[_0x58b4a1]={'$like':'%'+_0x3d35cb['query']['filter']+'%'};return _0x315f5d;})});}_0x3f5ad2=_[_0x515d('0x47')]({},_0x3f5ad2,_0x3d35cb[_0x515d('0x49')]);return db[_0x515d('0x66')][_0x515d('0x1f')]({'where':_0x3f5ad2[_0x515d('0x45')]})['then'](function(_0x2536a1){_0x2326ba[_0x515d('0x1f')]=_0x2536a1;if(_0x3d35cb['query']['includeAll']){_0x3f5ad2['include']=[{'all':!![]}];}return db[_0x515d('0x66')][_0x515d('0x64')](_0x3f5ad2);})[_0x515d('0x25')](function(_0x4373c3){_0x2326ba[_0x515d('0x65')]=_0x4373c3;return _0x2326ba;});}})[_0x515d('0x25')](respondWithFilteredResult(_0x36602f,_0x3f5ad2))[_0x515d('0x4c')](handleError(_0x36602f,null));};exports[_0x515d('0x67')]=function(_0x39dd16,_0x565f8d,_0xc5824d){var _0xd09208={'raw':!![],'where':{}};var _0x227d0b={};var _0x217790={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x39dd16[_0x515d('0x60')]['id']}})['then'](handleEntityNotFound(_0x565f8d,null))['then'](function(_0x180598){if(_0x180598){_0x227d0b[_0x515d('0x3a')]=_[_0x515d('0x4e')](db[_0x515d('0x68')][_0x515d('0x37')]);_0x227d0b[_0x515d('0x3d')]=_[_0x515d('0x4e')](_0x39dd16[_0x515d('0x3d')]);_0x227d0b[_0x515d('0x3b')]=_[_0x515d('0x3c')](_0x227d0b[_0x515d('0x3a')],_0x227d0b[_0x515d('0x3d')]);_0xd09208[_0x515d('0x3e')]=_['intersection'](_0x227d0b[_0x515d('0x3a')],qs[_0x515d('0x3f')](_0x39dd16['query'][_0x515d('0x3f')]));_0xd09208[_0x515d('0x3e')]=_0xd09208[_0x515d('0x3e')][_0x515d('0x40')]?_0xd09208['attributes']:_0x227d0b[_0x515d('0x3a')];if(!_0x39dd16['query']['hasOwnProperty'](_0x515d('0x42'))){_0xd09208[_0x515d('0x21')]=qs[_0x515d('0x21')](_0x39dd16[_0x515d('0x3d')][_0x515d('0x21')]);_0xd09208[_0x515d('0x20')]=qs['offset'](_0x39dd16[_0x515d('0x3d')][_0x515d('0x20')]);}_0xd09208[_0x515d('0x43')]=qs[_0x515d('0x44')](_0x39dd16[_0x515d('0x3d')][_0x515d('0x44')]);_0xd09208[_0x515d('0x45')]=qs['filters'](_[_0x515d('0x46')](_0x39dd16[_0x515d('0x3d')],_0x227d0b['filters']));_0xd09208[_0x515d('0x45')][_0x515d('0x63')]=_0x180598['id'];if(_0x39dd16[_0x515d('0x3d')][_0x515d('0x29')]){_0xd09208[_0x515d('0x45')]=_['merge'](_0xd09208['where'],{'$or':_[_0x515d('0x35')](_0xd09208[_0x515d('0x3e')],function(_0x407683){var _0x13aea4={};_0x13aea4[_0x407683]={'$like':'%'+_0x39dd16[_0x515d('0x3d')]['filter']+'%'};return _0x13aea4;})});}_0xd09208=_[_0x515d('0x47')]({},_0xd09208,_0x39dd16[_0x515d('0x49')]);return db[_0x515d('0x68')][_0x515d('0x1f')]({'where':_0xd09208[_0x515d('0x45')]})[_0x515d('0x25')](function(_0x20eda8){_0x217790[_0x515d('0x1f')]=_0x20eda8;if(_0x39dd16[_0x515d('0x3d')][_0x515d('0x4a')]){_0xd09208[_0x515d('0x4b')]=[{'all':!![]}];}return db[_0x515d('0x68')][_0x515d('0x64')](_0xd09208);})[_0x515d('0x25')](function(_0x212c4e){_0x217790[_0x515d('0x65')]=_0x212c4e;return _0x217790;});}})['then'](respondWithFilteredResult(_0x565f8d,_0xd09208))[_0x515d('0x4c')](handleError(_0x565f8d,null));};exports['getHopperBlacks']=function(_0x1b8d9c,_0x3d144d,_0x21ea39){var _0x1e0c7b={'raw':!![],'where':{}};var _0x46b148={};var _0xd2338b={'count':0x0,'rows':[]};return db[_0x515d('0x36')][_0x515d('0x61')]({'where':{'id':_0x1b8d9c[_0x515d('0x60')]['id']}})['then'](handleEntityNotFound(_0x3d144d,null))[_0x515d('0x25')](function(_0x3fbce6){if(_0x3fbce6){_0x46b148['model']=_['keys'](db['CmHopperBlack'][_0x515d('0x37')]);_0x46b148[_0x515d('0x3d')]=_['keys'](_0x1b8d9c[_0x515d('0x3d')]);_0x46b148[_0x515d('0x3b')]=_[_0x515d('0x3c')](_0x46b148[_0x515d('0x3a')],_0x46b148[_0x515d('0x3d')]);_0x1e0c7b[_0x515d('0x3e')]=_['intersection'](_0x46b148[_0x515d('0x3a')],qs[_0x515d('0x3f')](_0x1b8d9c[_0x515d('0x3d')][_0x515d('0x3f')]));_0x1e0c7b[_0x515d('0x3e')]=_0x1e0c7b[_0x515d('0x3e')]['length']?_0x1e0c7b[_0x515d('0x3e')]:_0x46b148[_0x515d('0x3a')];if(!_0x1b8d9c[_0x515d('0x3d')][_0x515d('0x41')](_0x515d('0x42'))){_0x1e0c7b[_0x515d('0x21')]=qs[_0x515d('0x21')](_0x1b8d9c[_0x515d('0x3d')][_0x515d('0x21')]);_0x1e0c7b[_0x515d('0x20')]=qs['offset'](_0x1b8d9c['query'][_0x515d('0x20')]);}_0x1e0c7b[_0x515d('0x43')]=qs['sort'](_0x1b8d9c[_0x515d('0x3d')][_0x515d('0x44')]);_0x1e0c7b[_0x515d('0x45')]=qs[_0x515d('0x3b')](_[_0x515d('0x46')](_0x1b8d9c[_0x515d('0x3d')],_0x46b148['filters']));_0x1e0c7b[_0x515d('0x45')][_0x515d('0x63')]=_0x3fbce6['id'];if(_0x1b8d9c[_0x515d('0x3d')]['filter']){_0x1e0c7b[_0x515d('0x45')]=_['merge'](_0x1e0c7b['where'],{'$or':_[_0x515d('0x35')](_0x1e0c7b['attributes'],function(_0xe75da4){var _0x42bfe7={};_0x42bfe7[_0xe75da4]={'$like':'%'+_0x1b8d9c[_0x515d('0x3d')][_0x515d('0x29')]+'%'};return _0x42bfe7;})});}_0x1e0c7b=_[_0x515d('0x47')]({},_0x1e0c7b,_0x1b8d9c['options']);return db[_0x515d('0x69')][_0x515d('0x1f')]({'where':_0x1e0c7b[_0x515d('0x45')]})['then'](function(_0x578a06){_0xd2338b[_0x515d('0x1f')]=_0x578a06;if(_0x1b8d9c[_0x515d('0x3d')][_0x515d('0x4a')]){_0x1e0c7b[_0x515d('0x4b')]=[{'all':!![]}];}return db[_0x515d('0x69')]['findAll'](_0x1e0c7b);})[_0x515d('0x25')](function(_0x1a14ad){_0xd2338b[_0x515d('0x65')]=_0x1a14ad;return _0xd2338b;});}})[_0x515d('0x25')](respondWithFilteredResult(_0x3d144d,_0x1e0c7b))['catch'](handleError(_0x3d144d,null));};exports[_0x515d('0x6a')]=function(_0x5f1c99,_0x22da55,_0x55facf){var _0x28d0f7={};var _0x78438e={};var _0x20d459;var _0x44abb9;return db['VoiceQueue'][_0x515d('0x61')]({'where':{'id':_0x5f1c99[_0x515d('0x60')]['id']}})[_0x515d('0x25')](handleEntityNotFound(_0x22da55,null))['then'](function(_0x5a53dc){if(_0x5a53dc){_0x20d459=_0x5a53dc;_0x78438e[_0x515d('0x3a')]=_[_0x515d('0x4e')](db['Team'][_0x515d('0x37')]);_0x78438e['query']=_[_0x515d('0x4e')](_0x5f1c99['query']);_0x78438e[_0x515d('0x3b')]=_[_0x515d('0x3c')](_0x78438e['model'],_0x78438e[_0x515d('0x3d')]);_0x28d0f7[_0x515d('0x3e')]=_[_0x515d('0x3c')](_0x78438e[_0x515d('0x3a')],qs[_0x515d('0x3f')](_0x5f1c99[_0x515d('0x3d')][_0x515d('0x3f')]));_0x28d0f7[_0x515d('0x3e')]=_0x28d0f7[_0x515d('0x3e')][_0x515d('0x40')]?_0x28d0f7[_0x515d('0x3e')]:_0x78438e['model'];_0x28d0f7['order']=qs[_0x515d('0x44')](_0x5f1c99[_0x515d('0x3d')]['sort']);_0x28d0f7['where']=qs[_0x515d('0x3b')](_['pick'](_0x5f1c99[_0x515d('0x3d')],_0x78438e[_0x515d('0x3b')]));if(_0x5f1c99[_0x515d('0x3d')][_0x515d('0x29')]){_0x28d0f7[_0x515d('0x45')]=_[_0x515d('0x47')](_0x28d0f7[_0x515d('0x45')],{'$or':_['map'](_0x28d0f7[_0x515d('0x3e')],function(_0x22684d){var _0x2d946e={};_0x2d946e[_0x22684d]={'$like':'%'+_0x5f1c99[_0x515d('0x3d')]['filter']+'%'};return _0x2d946e;})});}_0x28d0f7=_['merge']({},_0x28d0f7,_0x5f1c99[_0x515d('0x49')]);return _0x20d459['getTeams'](_0x28d0f7);}})[_0x515d('0x25')](function(_0x14dd2f){if(_0x14dd2f){_0x44abb9=_0x14dd2f['length'];if(!_0x5f1c99[_0x515d('0x3d')][_0x515d('0x41')](_0x515d('0x42'))){_0x28d0f7[_0x515d('0x21')]=qs[_0x515d('0x21')](_0x5f1c99['query'][_0x515d('0x21')]);_0x28d0f7[_0x515d('0x20')]=qs['offset'](_0x5f1c99[_0x515d('0x3d')][_0x515d('0x20')]);}return _0x20d459[_0x515d('0x6a')](_0x28d0f7);}})[_0x515d('0x25')](function(_0x35d751){if(_0x35d751){return _0x35d751?{'count':_0x44abb9,'rows':_0x35d751}:null;}})[_0x515d('0x25')](respondWithResult(_0x22da55,null))[_0x515d('0x4c')](handleError(_0x22da55,null));};exports[_0x515d('0x6b')]=function(_0x2dce9e,_0x2c20cc,_0x20071a){var _0x2acc10=_0x2dce9e[_0x515d('0x5c')][_0x515d('0x6c')];var _0x2bda2b=_['map'](_0x2acc10,'id');return db[_0x515d('0x6d')][_0x515d('0x64')]({'where':{'id':_0x2bda2b},'attributes':['id'],'include':[{'model':db[_0x515d('0x6e')],'as':'Agents','attributes':['id',_0x515d('0x2e'),_0x515d('0x6f'),_0x515d('0x70'),_0x515d('0x71')],'raw':!![]}]})[_0x515d('0x25')](function(_0x1b81d2){if(_0x1b81d2){var _0x2f57f7=_['flatMap'](_0x1b81d2,function(_0x4bb0ce){var _0x2c0a57=_0x4bb0ce[_0x515d('0x27')]({'plain':!![]});_0x2c0a57['Agents'][_0x515d('0x72')](function(_0x278f77){_0x278f77['penalty']=_['find'](_0x2acc10,{'id':_0x2c0a57['id']})['penalty'];});return _0x2c0a57['Agents'];});return db[_0x515d('0x36')][_0x515d('0x4f')]({'where':{'id':_0x2dce9e[_0x515d('0x60')]['id']}})[_0x515d('0x25')](function(_0x52c7fd){return db['sequelize'][_0x515d('0x73')](function(_0x573582){return _0x52c7fd['addTeams'](_0x2bda2b,{'transaction':_0x573582})[_0x515d('0x25')](function(){return BPromise[_0x515d('0x74')](_0x2f57f7,function(_0x65efa0){return db[_0x515d('0x75')][_0x515d('0x76')]({'where':{'UserId':_0x65efa0['id'],'VoiceQueueId':_0x2dce9e['params']['id']},'defaults':{'penalty':_0x65efa0['penalty']},'transaction':_0x573582});});})[_0x515d('0x25')](function(){return BPromise[_0x515d('0x74')](_['filter'](_0x2f57f7,{'online':!![]}),function(_0x148f09){return db[_0x515d('0x77')][_0x515d('0x78')]({'membername':_0x148f09['name'],'UserId':_0x148f09['id'],'queue_name':_0x52c7fd[_0x515d('0x2e')],'VoiceQueueId':_0x52c7fd['id'],'interface':_[_0x515d('0x79')](_0x148f09[_0x515d('0x71')])?util[_0x515d('0x7a')](_0x515d('0x7b'),_0x148f09[_0x515d('0x2e')]):_0x148f09[_0x515d('0x71')],'paused':_0x148f09[_0x515d('0x70')]||![],'penalty':_0x148f09[_0x515d('0x7c')]},{'transaction':_0x573582});});})[_0x515d('0x25')](function(){_0x2f57f7[_0x515d('0x72')](function(_0x13dfd7){socket[_0x515d('0x7d')](_0x515d('0x7e'),{'UserId':_0x13dfd7['id'],'VoiceQueueId':_0x52c7fd['id']});});});});});}})['then'](respondWithStatusCode(_0x2c20cc,null))[_0x515d('0x4c')](handleError(_0x2c20cc,null));};exports[_0x515d('0x7f')]=function(_0x50840d,_0x45891a,_0x422ba7){return db[_0x515d('0x6d')][_0x515d('0x64')]({'where':{'id':_0x50840d[_0x515d('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x515d('0x6e')],'as':_0x515d('0x80'),'attributes':['id'],'raw':!![]}]})[_0x515d('0x25')](handleEntityNotFound(_0x45891a,null))['then'](function(_0x5ecc73){var _0x2dcf29=_[_0x515d('0x35')](_0x5ecc73,'id');var _0x521dd3=[];var _0xa966de=[];var _0x330154=squel['select']();_0x330154[_0x515d('0x81')](_0x515d('0x82'))[_0x515d('0x83')](_0x515d('0x84'),'tq')['join'](_0x515d('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x515d('0x45')](_0x515d('0x86'),_0x50840d[_0x515d('0x60')]['id']);for(var _0x2dfb51=0x0;_0x2dfb51<_0x5ecc73[_0x515d('0x40')];_0x2dfb51+=0x1){let _0xfcf022=_0x5ecc73[_0x2dfb51];for(var _0x2ff762=0x0;_0x2ff762<_0xfcf022[_0x515d('0x80')][_0x515d('0x40')];_0x2ff762+=0x1){let _0x1b2889=_0xfcf022[_0x515d('0x80')][_0x2ff762];var _0x29f78a=_0x330154[_0x515d('0x5a')]();_0x29f78a[_0x515d('0x45')](_0x515d('0x87'),_0x1b2889['id']);_0xa966de[_0x515d('0x88')](db[_0x515d('0x89')]['query'](_0x29f78a['toString'](),{'type':db['sequelize']['QueryTypes'][_0x515d('0x8a')]})['then'](function(_0x2327fc){if(_0x2327fc[_0x515d('0x40')]===0x1){return _0x1b2889['id'];}else{var _0x3250d3=_[_0x515d('0x8b')](_['map'](_0x2327fc,_0x515d('0x8c')),function(_0x552540){return _[_0x515d('0x2c')](_0x2dcf29,_0x552540);});if(_0x3250d3){return _0x1b2889['id'];}}}));}}return BPromise[_0x515d('0x8d')](_0xa966de)[_0x515d('0x25')](function(_0x511f33){_0x521dd3=_(_0x521dd3)[_0x515d('0x8e')](_0x511f33)[_0x515d('0x8f')]()[_0x515d('0x2b')]();return db[_0x515d('0x36')][_0x515d('0x4f')]({'where':{'id':_0x50840d[_0x515d('0x60')]['id']}})[_0x515d('0x25')](function(_0x1d71eb){return db[_0x515d('0x89')][_0x515d('0x73')](function(_0x23187e){return _0x1d71eb[_0x515d('0x7f')](_0x50840d[_0x515d('0x3d')][_0x515d('0x90')],{'transaction':_0x23187e})[_0x515d('0x25')](function(){if(!_[_0x515d('0x91')](_0x521dd3)){return _0x1d71eb['removeAgents'](_0x521dd3,{'transaction':_0x23187e})[_0x515d('0x25')](function(){return db['UserVoiceQueueRt'][_0x515d('0x26')]({'where':{'VoiceQueueId':_0x50840d[_0x515d('0x60')]['id'],'UserId':_0x521dd3},'transaction':_0x23187e});});}})[_0x515d('0x25')](function(){_0x521dd3[_0x515d('0x72')](function(_0x1ace3a){socket[_0x515d('0x7d')](_0x515d('0x92'),{'UserId':_0x1ace3a,'VoiceQueueId':_0x1d71eb['id']});});});});});});})[_0x515d('0x25')](respondWithStatusCode(_0x45891a,null))['catch'](handleError(_0x45891a,null));};exports[_0x515d('0x93')]=function(_0x2af6b6,_0x4d26f0,_0x27922b){var _0x2c76bf,_0x20b793;return db[_0x515d('0x36')][_0x515d('0x4f')]({'where':{'id':_0x2af6b6[_0x515d('0x60')]['id']}})[_0x515d('0x25')](handleEntityNotFound(_0x4d26f0,null))['then'](function(_0x1ffcad){if(_0x1ffcad){_0x20b793=_0x1ffcad;return _0x1ffcad[_0x515d('0x93')](_0x2af6b6[_0x515d('0x5c')][_0x515d('0x90')],_['omit'](_0x2af6b6[_0x515d('0x5c')],['ids','id'])||{})[_0x515d('0x94')](function(_0x5ad257){for(var _0x250a95=0x0;_0x250a95<_0x2af6b6[_0x515d('0x5c')][_0x515d('0x90')][_0x515d('0x40')];_0x250a95+=0x1){socket[_0x515d('0x7d')](_0x515d('0x7e'),{'UserId':_0x2af6b6[_0x515d('0x5c')][_0x515d('0x90')][_0x250a95],'VoiceQueueId':_0x2af6b6[_0x515d('0x60')]['id']});}return _0x5ad257;});}})[_0x515d('0x25')](function(_0x2885ef){_0x2c76bf=_0x2885ef||[];if(_0x20b793){return db['User'][_0x515d('0x64')]({'where':{'id':_0x2af6b6[_0x515d('0x5c')][_0x515d('0x90')]},'attributes':['id',_0x515d('0x2e'),_0x515d('0x6f'),_0x515d('0x70'),_0x515d('0x71')],'raw':!![]});}})['then'](function(_0x42c380){if(!_[_0x515d('0x91')](_0x42c380)){var _0x56911b=[];for(var _0x4e4fa1=0x0;_0x4e4fa1<_0x42c380[_0x515d('0x40')];_0x4e4fa1++){if(_0x42c380[_0x4e4fa1][_0x515d('0x6f')]){_0x56911b[_0x515d('0x88')](db[_0x515d('0x77')][_0x515d('0x78')]({'membername':_0x42c380[_0x4e4fa1][_0x515d('0x2e')],'UserId':_0x42c380[_0x4e4fa1]['id'],'queue_name':_0x20b793[_0x515d('0x2e')],'VoiceQueueId':_0x20b793['id'],'interface':_['isNil'](_0x42c380[_0x4e4fa1][_0x515d('0x71')])?util['format'](_0x515d('0x7b'),_0x42c380[_0x4e4fa1][_0x515d('0x2e')]):_0x42c380[_0x4e4fa1][_0x515d('0x71')],'paused':_0x42c380[_0x4e4fa1][_0x515d('0x70')]||![],'penalty':_0x2af6b6[_0x515d('0x5c')][_0x515d('0x7c')]||0x0}));}}return BPromise[_0x515d('0x8d')](_0x56911b);}})[_0x515d('0x25')](function(){return _0x2c76bf;})[_0x515d('0x25')](respondWithResult(_0x4d26f0,null))[_0x515d('0x4c')](handleError(_0x4d26f0,null));};exports['removeAgents']=function(_0x594299,_0x4c22fb,_0xa65253){return db['VoiceQueue']['find']({'where':{'id':_0x594299['params']['id']}})[_0x515d('0x25')](handleEntityNotFound(_0x4c22fb,null))['then'](function(_0x1fb6b6){if(_0x1fb6b6){return _0x1fb6b6[_0x515d('0x95')](_0x594299[_0x515d('0x3d')][_0x515d('0x90')])['then'](function(){if(_['isArray'](_0x594299[_0x515d('0x3d')][_0x515d('0x90')])){for(var _0x591ac9=0x0;_0x591ac9<_0x594299[_0x515d('0x3d')]['ids']['length'];_0x591ac9+=0x1){socket[_0x515d('0x7d')](_0x515d('0x92'),{'UserId':Number(_0x594299['query'][_0x515d('0x90')][_0x591ac9]),'VoiceQueueId':Number(_0x594299[_0x515d('0x60')]['id'])});}}else{socket[_0x515d('0x7d')](_0x515d('0x92'),{'UserId':Number(_0x594299[_0x515d('0x3d')][_0x515d('0x90')]),'VoiceQueueId':Number(_0x594299[_0x515d('0x60')]['id'])});}});}})[_0x515d('0x25')](function(_0x35eeaa){return db[_0x515d('0x77')][_0x515d('0x26')]({'where':{'VoiceQueueId':_0x594299[_0x515d('0x60')]['id'],'UserId':_0x594299[_0x515d('0x3d')][_0x515d('0x90')]}})[_0x515d('0x25')](function(){return _0x35eeaa;});})[_0x515d('0x25')](respondWithStatusCode(_0x4c22fb,null))[_0x515d('0x4c')](handleError(_0x4c22fb,null));};exports[_0x515d('0x96')]=function(_0x3e8502,_0x3d1fcf,_0x2ee2f8){var _0x1b0ed0={};var _0x24cad0={};var _0x315e91;var _0x4fc38b;return db[_0x515d('0x36')]['findOne']({'where':{'id':_0x3e8502['params']['id']}})[_0x515d('0x25')](handleEntityNotFound(_0x3d1fcf,null))[_0x515d('0x25')](function(_0x4e20b1){if(_0x4e20b1){_0x315e91=_0x4e20b1;_0x24cad0[_0x515d('0x3a')]=_['keys'](db['User'][_0x515d('0x37')]);_0x24cad0['query']=_['keys'](_0x3e8502[_0x515d('0x3d')]);_0x24cad0['filters']=_[_0x515d('0x3c')](_0x24cad0[_0x515d('0x3a')],_0x24cad0[_0x515d('0x3d')]);_0x1b0ed0[_0x515d('0x3e')]=_[_0x515d('0x3c')](_0x24cad0[_0x515d('0x3a')],qs[_0x515d('0x3f')](_0x3e8502[_0x515d('0x3d')][_0x515d('0x3f')]));_0x1b0ed0[_0x515d('0x3e')]=_0x1b0ed0[_0x515d('0x3e')]['length']?_0x1b0ed0['attributes']:_0x24cad0[_0x515d('0x3a')];_0x1b0ed0[_0x515d('0x43')]=qs[_0x515d('0x44')](_0x3e8502['query'][_0x515d('0x44')]);_0x1b0ed0['where']=qs[_0x515d('0x3b')](_[_0x515d('0x46')](_0x3e8502['query'],_0x24cad0[_0x515d('0x3b')]));if(_0x3e8502['query'][_0x515d('0x29')]){_0x1b0ed0[_0x515d('0x45')]=_[_0x515d('0x47')](_0x1b0ed0[_0x515d('0x45')],{'$or':_[_0x515d('0x35')](_0x1b0ed0[_0x515d('0x3e')],function(_0x1a9eba){var _0x4ade5b={};_0x4ade5b[_0x1a9eba]={'$like':'%'+_0x3e8502[_0x515d('0x3d')][_0x515d('0x29')]+'%'};return _0x4ade5b;})});}_0x1b0ed0=_[_0x515d('0x47')]({},_0x1b0ed0,_0x3e8502[_0x515d('0x49')]);return _0x315e91[_0x515d('0x96')](_0x1b0ed0);}})[_0x515d('0x25')](function(_0x1ffb56){if(_0x1ffb56){_0x4fc38b=_0x1ffb56[_0x515d('0x40')];if(!_0x3e8502[_0x515d('0x3d')][_0x515d('0x41')](_0x515d('0x42'))){_0x1b0ed0[_0x515d('0x21')]=qs[_0x515d('0x21')](_0x3e8502[_0x515d('0x3d')][_0x515d('0x21')]);_0x1b0ed0['offset']=qs['offset'](_0x3e8502[_0x515d('0x3d')][_0x515d('0x20')]);}return _0x315e91[_0x515d('0x96')](_0x1b0ed0);}})['then'](function(_0x40efa6){if(_0x40efa6){return _0x40efa6?{'count':_0x4fc38b,'rows':_0x40efa6}:null;}})['then'](respondWithResult(_0x3d1fcf,null))[_0x515d('0x4c')](handleError(_0x3d1fcf,null));};exports[_0x515d('0x97')]=function(_0x27f44a,_0x3d6fec,_0x2c8a1e){var _0x52f8c7={};var _0x25ddd0={};var _0x3b0349;var _0xd26ec7;return db[_0x515d('0x36')][_0x515d('0x61')]({'where':{'id':_0x27f44a['params']['id']}})['then'](handleEntityNotFound(_0x3d6fec,null))['then'](function(_0x2b7c97){if(_0x2b7c97){_0x3b0349=_0x2b7c97;_0x25ddd0[_0x515d('0x3a')]=_[_0x515d('0x4e')](db['UserVoiceQueueRt'][_0x515d('0x37')]);_0x25ddd0['query']=_[_0x515d('0x4e')](_0x27f44a[_0x515d('0x3d')]);_0x25ddd0[_0x515d('0x3b')]=_[_0x515d('0x3c')](_0x25ddd0[_0x515d('0x3a')],_0x25ddd0[_0x515d('0x3d')]);_0x52f8c7[_0x515d('0x3e')]=_[_0x515d('0x3c')](_0x25ddd0[_0x515d('0x3a')],qs[_0x515d('0x3f')](_0x27f44a[_0x515d('0x3d')]['fields']));_0x52f8c7[_0x515d('0x3e')]=_0x52f8c7[_0x515d('0x3e')][_0x515d('0x40')]?_0x52f8c7[_0x515d('0x3e')]:_0x25ddd0[_0x515d('0x3a')];_0x52f8c7[_0x515d('0x43')]=qs[_0x515d('0x44')](_0x27f44a[_0x515d('0x3d')][_0x515d('0x44')]);_0x52f8c7[_0x515d('0x45')]=qs[_0x515d('0x3b')](_['pick'](_0x27f44a[_0x515d('0x3d')],_0x25ddd0[_0x515d('0x3b')]));if(_0x27f44a[_0x515d('0x3d')]['filter']){_0x52f8c7[_0x515d('0x45')]=_[_0x515d('0x47')](_0x52f8c7[_0x515d('0x45')],{'$or':_[_0x515d('0x35')](_0x52f8c7[_0x515d('0x3e')],function(_0x1a314c){var _0x5a2876={};_0x5a2876[_0x1a314c]={'$like':'%'+_0x27f44a['query'][_0x515d('0x29')]+'%'};return _0x5a2876;})});}_0x52f8c7=_[_0x515d('0x47')]({},_0x52f8c7,_0x27f44a['options']);return _0x3b0349[_0x515d('0x97')](_0x52f8c7);}})[_0x515d('0x25')](function(_0x105172){if(_0x105172){_0xd26ec7=_0x105172[_0x515d('0x40')];if(!_0x27f44a['query']['hasOwnProperty'](_0x515d('0x42'))){_0x52f8c7[_0x515d('0x21')]=qs[_0x515d('0x21')](_0x27f44a[_0x515d('0x3d')][_0x515d('0x21')]);_0x52f8c7[_0x515d('0x20')]=qs[_0x515d('0x20')](_0x27f44a[_0x515d('0x3d')][_0x515d('0x20')]);}return _0x3b0349[_0x515d('0x97')](_0x52f8c7);}})[_0x515d('0x25')](function(_0x154d24){return _0x154d24?{'count':_0xd26ec7,'rows':_0x154d24}:null;})[_0x515d('0x25')](respondWithResult(_0x3d6fec,null))[_0x515d('0x4c')](handleError(_0x3d6fec,null));};exports[_0x515d('0x98')]=function(_0x4d2b17,_0x5b51fa,_0x1a0e1d){var _0x2c3178={};var _0x5211db={};var _0x1b4eea;var _0x531210;return db['VoiceQueue'][_0x515d('0x61')]({'where':{'id':_0x4d2b17[_0x515d('0x60')]['id']}})[_0x515d('0x25')](handleEntityNotFound(_0x5b51fa,null))[_0x515d('0x25')](function(_0x4eb6f4){if(_0x4eb6f4){_0x1b4eea=_0x4eb6f4;_0x5211db['model']=_[_0x515d('0x4e')](db[_0x515d('0x99')]['rawAttributes']);_0x5211db[_0x515d('0x3d')]=_[_0x515d('0x4e')](_0x4d2b17[_0x515d('0x3d')]);_0x5211db['filters']=_[_0x515d('0x3c')](_0x5211db[_0x515d('0x3a')],_0x5211db[_0x515d('0x3d')]);_0x2c3178[_0x515d('0x3e')]=_[_0x515d('0x3c')](_0x5211db[_0x515d('0x3a')],qs[_0x515d('0x3f')](_0x4d2b17[_0x515d('0x3d')][_0x515d('0x3f')]));_0x2c3178['attributes']=_0x2c3178[_0x515d('0x3e')][_0x515d('0x40')]?_0x2c3178[_0x515d('0x3e')]:_0x5211db[_0x515d('0x3a')];_0x2c3178[_0x515d('0x43')]=qs[_0x515d('0x44')](_0x4d2b17[_0x515d('0x3d')][_0x515d('0x44')]);_0x2c3178['where']=qs['filters'](_[_0x515d('0x46')](_0x4d2b17[_0x515d('0x3d')],_0x5211db[_0x515d('0x3b')]));if(_0x4d2b17[_0x515d('0x3d')]['filter']){_0x2c3178[_0x515d('0x45')]=_[_0x515d('0x47')](_0x2c3178[_0x515d('0x45')],{'$or':_[_0x515d('0x35')](_0x2c3178[_0x515d('0x3e')],function(_0xaac775){var _0x2af54e={};_0x2af54e[_0xaac775]={'$like':'%'+_0x4d2b17['query'][_0x515d('0x29')]+'%'};return _0x2af54e;})});}_0x2c3178=_[_0x515d('0x47')]({},_0x2c3178,_0x4d2b17[_0x515d('0x49')]);return _0x1b4eea[_0x515d('0x98')](_0x2c3178);}})['then'](function(_0x3f6607){if(_0x3f6607){_0x531210=_0x3f6607[_0x515d('0x40')];if(!_0x4d2b17['query'][_0x515d('0x41')](_0x515d('0x42'))){_0x2c3178[_0x515d('0x21')]=qs[_0x515d('0x21')](_0x4d2b17[_0x515d('0x3d')][_0x515d('0x21')]);_0x2c3178['offset']=qs[_0x515d('0x20')](_0x4d2b17[_0x515d('0x3d')][_0x515d('0x20')]);}return _0x1b4eea[_0x515d('0x98')](_0x2c3178);}})['then'](function(_0x519e9a){if(_0x519e9a){return _0x519e9a?{'count':_0x531210,'rows':_0x519e9a}:null;}})['then'](respondWithResult(_0x5b51fa,null))['catch'](handleError(_0x5b51fa,null));};exports[_0x515d('0x9a')]=function(_0x4ae324,_0x254d8e,_0x521e66){var _0xedb62b,_0x3cd940;return db['VoiceQueue'][_0x515d('0x4f')]({'where':{'id':_0x4ae324[_0x515d('0x60')]['id']}})[_0x515d('0x25')](handleEntityNotFound(_0x254d8e,null))[_0x515d('0x25')](function(_0xa31b08){if(_0xa31b08){_0x3cd940=_0xa31b08;return _0xa31b08[_0x515d('0x9a')](_0x4ae324[_0x515d('0x5c')][_0x515d('0x90')],_[_0x515d('0x5b')](_0x4ae324[_0x515d('0x5c')],['ids','id'])||{});}return null;})[_0x515d('0x94')](function(_0x42eaab){var _0x13122f;_0xedb62b=_0x42eaab||[];var _0x55c247=[];if(_0x42eaab){for(var _0x3b36f4=0x0;_0x3b36f4<_0x42eaab[_0x515d('0x40')];_0x3b36f4+=0x1){var _0x38ce05=_0x42eaab[_0x3b36f4][_0x515d('0x27')]({'plain':!![]});_0x3cd940[_0x515d('0x9b')]=_0x4ae324[_0x515d('0x5c')][_0x515d('0x9b')]?_0x4ae324[_0x515d('0x5c')]['dialCheckDuplicateType']:_0x3cd940[_0x515d('0x9b')];switch(_0x3cd940['dialCheckDuplicateType']){case _0x515d('0x9c'):_0x13122f=squel[_0x515d('0x9d')]()['into'](_0x515d('0x9e'))[_0x515d('0x9f')](['phone','scheduledAt','ContactId',_0x515d('0xa0'),_0x515d('0x63'),_0x515d('0x5d'),_0x515d('0x5e')],squel[_0x515d('0xa1')]()[_0x515d('0x81')](_0x515d('0xa2'),_0x515d('0xa2'))[_0x515d('0x81')]('NOW()',_0x515d('0xa3'))['field']('id',_0x515d('0xa4'))[_0x515d('0x81')](_0x38ce05[_0x515d('0xa5')][_0x515d('0xa6')](),_0x515d('0xa0'))['field'](_0x4ae324['params']['id']['toString'](),_0x515d('0x63'))[_0x515d('0x81')](_0x515d('0xa7'),_0x515d('0x5d'))[_0x515d('0x81')](_0x515d('0xa7'),'updatedAt')[_0x515d('0x83')](_0x515d('0xa8'))['where']('deletedAt\x20IS\x20NULL')[_0x515d('0x45')](_0x515d('0xa9'),_0x38ce05[_0x515d('0xa5')][_0x515d('0xa6')]())[_0x515d('0x45')](_0x515d('0xaa'))['where'](_0x515d('0xab'),squel[_0x515d('0xa1')]()[_0x515d('0x81')](_0x515d('0xac'))['from']('cm_hopper_final')['where'](_0x515d('0x86'),_0x4ae324['params']['id']['toString']()))['where'](_0x515d('0xab'),squel[_0x515d('0xa1')]()[_0x515d('0x81')](_0x515d('0xad'))[_0x515d('0x83')](_0x515d('0x9e'))['where'](_0x515d('0x86'),_0x4ae324[_0x515d('0x60')]['id'][_0x515d('0xa6')]())))['toString']();break;case _0x515d('0xae'):_0x13122f=squel['insert']()[_0x515d('0xaf')]('cm_hopper')['fromQuery']([_0x515d('0xa2'),_0x515d('0xa3'),_0x515d('0xa4'),_0x515d('0xa0'),_0x515d('0x63'),_0x515d('0x5d'),_0x515d('0x5e')],squel[_0x515d('0xa1')]()[_0x515d('0x81')](_0x515d('0xa2'),_0x515d('0xa2'))[_0x515d('0x81')](_0x515d('0xa7'),_0x515d('0xa3'))[_0x515d('0x81')]('id',_0x515d('0xa4'))['field'](_0x38ce05[_0x515d('0xa5')][_0x515d('0xa6')](),'ListId')[_0x515d('0x81')](_0x4ae324['params']['id'][_0x515d('0xa6')](),_0x515d('0x63'))[_0x515d('0x81')](_0x515d('0xa7'),_0x515d('0x5d'))[_0x515d('0x81')](_0x515d('0xa7'),'updatedAt')[_0x515d('0x83')](_0x515d('0xa8'))[_0x515d('0x45')]('deletedAt\x20IS\x20NULL')[_0x515d('0x45')]('ListId\x20=\x20?',_0x38ce05[_0x515d('0xa5')]['toString']())[_0x515d('0x45')](_0x515d('0xaa'))['where'](_0x515d('0xab'),squel[_0x515d('0xa1')]()[_0x515d('0x81')](_0x515d('0xad'))[_0x515d('0x83')](_0x515d('0x9e'))[_0x515d('0x45')]('VoiceQueueId\x20=\x20?',_0x4ae324[_0x515d('0x60')]['id'][_0x515d('0xa6')]())))[_0x515d('0xa6')]();break;default:_0x13122f=squel['insert']()[_0x515d('0xaf')](_0x515d('0x9e'))[_0x515d('0x9f')]([_0x515d('0xa2'),_0x515d('0xa3'),_0x515d('0xa4'),'ListId',_0x515d('0x63'),_0x515d('0x5d'),'updatedAt'],squel[_0x515d('0xa1')]()[_0x515d('0x81')](_0x515d('0xa2'),'phone')['field']('NOW()','scheduledAt')[_0x515d('0x81')]('id',_0x515d('0xa4'))['field'](_0x38ce05[_0x515d('0xa5')][_0x515d('0xa6')](),_0x515d('0xa0'))['field'](_0x4ae324[_0x515d('0x60')]['id'][_0x515d('0xa6')](),_0x515d('0x63'))['field'](_0x515d('0xa7'),'createdAt')[_0x515d('0x81')](_0x515d('0xa7'),'updatedAt')[_0x515d('0x83')]('cm_contacts')[_0x515d('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0x515d('0xa9'),_0x38ce05[_0x515d('0xa5')][_0x515d('0xa6')]())[_0x515d('0x45')](_0x515d('0xaa')))[_0x515d('0xa6')]();}_0x55c247['push'](db[_0x515d('0x89')][_0x515d('0x3d')](_0x13122f));}return BPromise[_0x515d('0x8d')](_0x55c247);}})[_0x515d('0x25')](function(){return _0xedb62b;})[_0x515d('0x25')](respondWithResult(_0x254d8e,null))[_0x515d('0x4c')](handleError(_0x254d8e,null));};exports[_0x515d('0xb0')]=function(_0xf5c29e,_0x1577cd,_0x466f2f){return db[_0x515d('0x36')][_0x515d('0x4f')]({'where':{'id':_0xf5c29e[_0x515d('0x60')]['id']}})['then'](handleEntityNotFound(_0x1577cd,null))[_0x515d('0x25')](function(_0x16e3c7){if(_0x16e3c7){return _0x16e3c7[_0x515d('0xb0')](_0xf5c29e[_0x515d('0x3d')][_0x515d('0x90')]);}})['then'](function(_0x2a2f4e){if(_0x2a2f4e){return db[_0x515d('0x62')]['destroy']({'where':{'ListId':_0xf5c29e[_0x515d('0x3d')][_0x515d('0x90')],'VoiceQueueId':_0xf5c29e['params']['id']}})[_0x515d('0x25')](function(){return _0x2a2f4e;});}})[_0x515d('0x25')](respondWithStatusCode(_0x1577cd,null))['catch'](handleError(_0x1577cd,null));};exports['getBlackLists']=function(_0x31f352,_0x3d0c45,_0xbb2399){var _0x12b158={};var _0x47cd87={};var _0x27a017;var _0x213873;return db['VoiceQueue'][_0x515d('0x61')]({'where':{'id':_0x31f352[_0x515d('0x60')]['id']}})['then'](handleEntityNotFound(_0x3d0c45,null))[_0x515d('0x25')](function(_0x2f38a6){if(_0x2f38a6){_0x27a017=_0x2f38a6;_0x47cd87[_0x515d('0x3a')]=_[_0x515d('0x4e')](db['CmList'][_0x515d('0x37')]);_0x47cd87['query']=_['keys'](_0x31f352[_0x515d('0x3d')]);_0x47cd87['filters']=_[_0x515d('0x3c')](_0x47cd87[_0x515d('0x3a')],_0x47cd87[_0x515d('0x3d')]);_0x12b158[_0x515d('0x3e')]=_[_0x515d('0x3c')](_0x47cd87['model'],qs['fields'](_0x31f352[_0x515d('0x3d')][_0x515d('0x3f')]));_0x12b158[_0x515d('0x3e')]=_0x12b158[_0x515d('0x3e')]['length']?_0x12b158[_0x515d('0x3e')]:_0x47cd87[_0x515d('0x3a')];_0x12b158[_0x515d('0x43')]=qs['sort'](_0x31f352[_0x515d('0x3d')][_0x515d('0x44')]);_0x12b158[_0x515d('0x45')]=qs[_0x515d('0x3b')](_[_0x515d('0x46')](_0x31f352[_0x515d('0x3d')],_0x47cd87['filters']));if(_0x31f352[_0x515d('0x3d')][_0x515d('0x29')]){_0x12b158[_0x515d('0x45')]=_[_0x515d('0x47')](_0x12b158[_0x515d('0x45')],{'$or':_[_0x515d('0x35')](_0x12b158[_0x515d('0x3e')],function(_0x5a7be9){var _0x2ed1e0={};_0x2ed1e0[_0x5a7be9]={'$like':'%'+_0x31f352[_0x515d('0x3d')][_0x515d('0x29')]+'%'};return _0x2ed1e0;})});}_0x12b158=_[_0x515d('0x47')]({},_0x12b158,_0x31f352[_0x515d('0x49')]);return _0x27a017['getBlackLists'](_0x12b158);}})[_0x515d('0x25')](function(_0x2606c2){if(_0x2606c2){_0x213873=_0x2606c2[_0x515d('0x40')];if(!_0x31f352[_0x515d('0x3d')][_0x515d('0x41')]('nolimit')){_0x12b158[_0x515d('0x21')]=qs[_0x515d('0x21')](_0x31f352[_0x515d('0x3d')][_0x515d('0x21')]);_0x12b158[_0x515d('0x20')]=qs[_0x515d('0x20')](_0x31f352['query'][_0x515d('0x20')]);}return _0x27a017[_0x515d('0xb1')](_0x12b158);}})[_0x515d('0x25')](function(_0x56f45f){if(_0x56f45f){return _0x56f45f?{'count':_0x213873,'rows':_0x56f45f}:null;}})[_0x515d('0x25')](respondWithResult(_0x3d0c45,null))[_0x515d('0x4c')](handleError(_0x3d0c45,null));};exports[_0x515d('0xb2')]=function(_0x3a91a9,_0x5d84b8,_0x200ae9){var _0xe2dff4,_0xb2228b;return db[_0x515d('0x36')][_0x515d('0x4f')]({'where':{'id':_0x3a91a9['params']['id']}})['then'](handleEntityNotFound(_0x5d84b8,null))[_0x515d('0x25')](function(_0x51dbc8){if(_0x51dbc8){_0xb2228b=_0x51dbc8;return _0x51dbc8[_0x515d('0xb2')](_0x3a91a9[_0x515d('0x5c')][_0x515d('0x90')],_[_0x515d('0x5b')](_0x3a91a9[_0x515d('0x5c')],['ids','id'])||{});}return null;})[_0x515d('0x94')](function(_0x36dac8){var _0x522453;_0xe2dff4=_0x36dac8||[];var _0x3c4be9=[];if(_0x36dac8){for(var _0x1f428b=0x0;_0x1f428b<_0x36dac8[_0x515d('0x40')];_0x1f428b+=0x1){var _0x8bb66d=_0x36dac8[_0x1f428b]['get']({'plain':!![]});_0x522453=squel[_0x515d('0x9d')]()[_0x515d('0xaf')](_0x515d('0xb3'))[_0x515d('0x9f')]([_0x515d('0xa2'),_0x515d('0xa4'),_0x515d('0xa0'),_0x515d('0x63'),_0x515d('0x5d'),_0x515d('0x5e')],squel['select']()[_0x515d('0x81')](_0x515d('0xa2'),_0x515d('0xa2'))[_0x515d('0x81')]('id',_0x515d('0xa4'))[_0x515d('0x81')](_0x8bb66d[_0x515d('0xa5')]['toString'](),_0x515d('0xa0'))[_0x515d('0x81')](_0x3a91a9[_0x515d('0x60')]['id'][_0x515d('0xa6')](),_0x515d('0x63'))['field'](_0x515d('0xa7'),_0x515d('0x5d'))[_0x515d('0x81')]('NOW()',_0x515d('0x5e'))[_0x515d('0x83')](_0x515d('0xa8'))[_0x515d('0x45')](_0x515d('0xb4'))['where'](_0x515d('0xa9'),_0x8bb66d[_0x515d('0xa5')][_0x515d('0xa6')]())[_0x515d('0x45')](_0x515d('0xaa')))['toString']();_0x3c4be9[_0x515d('0x88')](db[_0x515d('0x89')][_0x515d('0x3d')](_0x522453));}return BPromise[_0x515d('0x8d')](_0x3c4be9);}})[_0x515d('0x25')](function(){return _0xe2dff4;})[_0x515d('0x25')](respondWithResult(_0x5d84b8,null))[_0x515d('0x4c')](handleError(_0x5d84b8,null));};exports[_0x515d('0xb5')]=function(_0x2c8c80,_0xd34b6,_0x305dfc){return db['VoiceQueue']['find']({'where':{'id':_0x2c8c80[_0x515d('0x60')]['id']}})[_0x515d('0x25')](handleEntityNotFound(_0xd34b6,null))['then'](function(_0x399518){if(_0x399518){return _0x399518[_0x515d('0xb5')](_0x2c8c80[_0x515d('0x3d')]['ids']);}})[_0x515d('0x25')](function(_0x238738){if(_0x238738){return db['CmHopperBlack'][_0x515d('0x26')]({'where':{'ListId':_0x2c8c80[_0x515d('0x3d')][_0x515d('0x90')],'VoiceQueueId':_0x2c8c80[_0x515d('0x60')]['id']}})[_0x515d('0x25')](function(){return _0x238738;});}})[_0x515d('0x25')](respondWithStatusCode(_0xd34b6,null))['catch'](handleError(_0xd34b6,null));}; \ No newline at end of file +var _0xa632=['online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','SELECT','every','TeamId','all','union','compact','isEmpty','emit','addAgents','push','removeAgents','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','cm_hopper','phone','scheduledAt','ContactId','select','field','NOW()','CmListId','toString','ListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','insert','into','fromQuery','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','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','./voiceQueue.socket','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','show','params','options','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','CmHopper','hasOwnProperty','VoiceQueueId','findAll','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','User','Agents'];(function(_0xf9a6cf,_0x11870e){var _0x59e2bc=function(_0x1cd606){while(--_0x1cd606){_0xf9a6cf['push'](_0xf9a6cf['shift']());}};_0x59e2bc(++_0x11870e);}(_0xa632,0x1b2));var _0x2a63=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa632[_0x5783f4];return _0x28e380;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2a63('0x0'));var zipdir=require(_0x2a63('0x1'));var jsonpatch=require(_0x2a63('0x2'));var rp=require(_0x2a63('0x3'));var moment=require(_0x2a63('0x4'));var BPromise=require(_0x2a63('0x5'));var Mustache=require(_0x2a63('0x6'));var util=require(_0x2a63('0x7'));var path=require('path');var sox=require(_0x2a63('0x8'));var csv=require(_0x2a63('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2a63('0xa'));var squel=require(_0x2a63('0xb'));var crypto=require(_0x2a63('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2a63('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2a63('0xe'));var Papa=require(_0x2a63('0xf'));var Redis=require(_0x2a63('0x10'));var authService=require(_0x2a63('0x11'));var qs=require(_0x2a63('0x12'));var as=require(_0x2a63('0x13'));var hardwareService=require(_0x2a63('0x14'));var logger=require('../../config/logger')(_0x2a63('0x15'));var utils=require(_0x2a63('0x16'));var config=require(_0x2a63('0x17'));var db=require(_0x2a63('0x18'))['db'];config[_0x2a63('0x19')]=_[_0x2a63('0x1a')](config['redis'],{'host':_0x2a63('0x1b'),'port':0x18eb});var socket=require(_0x2a63('0x1c'))(new Redis(config[_0x2a63('0x19')]));require(_0x2a63('0x1d'))['register'](socket);function respondWithStatusCode(_0x407d24,_0x2a7a98){_0x2a7a98=_0x2a7a98||0xcc;return function(_0x49252b){if(_0x49252b){return _0x407d24[_0x2a63('0x1e')](_0x2a7a98);}return _0x407d24[_0x2a63('0x1f')](_0x2a7a98)[_0x2a63('0x20')]();};}function respondWithResult(_0x174c84,_0x176a23){_0x176a23=_0x176a23||0xc8;return function(_0x1ed85b){if(_0x1ed85b){return _0x174c84['status'](_0x176a23)[_0x2a63('0x21')](_0x1ed85b);}};}function respondWithFilteredResult(_0x1b19d9,_0x12c6f0){return function(_0x5f4388){if(_0x5f4388){var _0x25b317=_0x5f4388[_0x2a63('0x22')],_0x4c0c52=_0x12c6f0[_0x2a63('0x23')],_0x4afb92=_0x12c6f0[_0x2a63('0x23')]+_0x12c6f0['limit'],_0x25fabf;if(_0x4afb92>=_0x25b317){_0x4afb92=_0x25b317;_0x25fabf=0xc8;}else{_0x25fabf=0xce;}_0x1b19d9[_0x2a63('0x1f')](_0x25fabf);return _0x1b19d9['set'](_0x2a63('0x24'),_0x4c0c52+'-'+_0x4afb92+'/'+_0x25b317)[_0x2a63('0x21')](_0x5f4388);}return null;};}function patchUpdates(_0x52d826){return function(_0x275359){try{jsonpatch[_0x2a63('0x25')](_0x275359,_0x52d826,!![]);}catch(_0x5cb694){return BPromise[_0x2a63('0x26')](_0x5cb694);}return _0x275359['save']();};}function saveUpdates(_0x3f3c3a,_0x4c22ed){return function(_0x48f024){if(_0x48f024){return _0x48f024['update'](_0x3f3c3a)['then'](function(_0x15e80c){return _0x15e80c;});}return null;};}function removeEntity(_0x266fe5,_0x2eb051){return function(_0x2fb321){if(_0x2fb321){return _0x2fb321[_0x2a63('0x27')]()[_0x2a63('0x28')](function(){var _0x107525=_0x2fb321[_0x2a63('0x29')]({'plain':!![]});var _0x2ffa14=[{'name':_0x2a63('0x2a'),'value':_0x2a63('0x2b'),'ignore':![]},{'name':_0x2a63('0x2c'),'value':_0x2a63('0x2d'),'ignore':![]}];var _0x776107=_(_0x2ffa14)[_0x2a63('0x2e')](_0x2a63('0x2f'))[_0x2a63('0x30')](_0x2a63('0x31'))[_0x2a63('0x31')]();if(_[_0x2a63('0x32')](_0x776107,_0x107525[_0x2a63('0x33')])){return;}var _0x3b4f92=_[_0x2a63('0x34')](_0x2ffa14,[_0x2a63('0x31'),_0x107525['type']])[_0x2a63('0x35')];return db[_0x2a63('0x36')][_0x2a63('0x27')]({'where':{'type':_0x3b4f92,'resourceId':_0x107525['id']}})[_0x2a63('0x28')](function(){return _0x2fb321;});})[_0x2a63('0x28')](function(){_0x266fe5[_0x2a63('0x1f')](0xcc)[_0x2a63('0x20')]();});}};}function handleEntityNotFound(_0x3c3f03,_0x5df0d6){return function(_0x4ae04b){if(!_0x4ae04b){_0x3c3f03['sendStatus'](0x194);}return _0x4ae04b;};}function handleError(_0x4b8502,_0x225637){_0x225637=_0x225637||0x1f4;return function(_0x287659){logger[_0x2a63('0x37')](_0x287659[_0x2a63('0x38')]);if(_0x287659[_0x2a63('0x35')]){delete _0x287659[_0x2a63('0x35')];}_0x4b8502[_0x2a63('0x1f')](_0x225637)[_0x2a63('0x39')](_0x287659);};}exports[_0x2a63('0x3a')]=function(_0x9c648c,_0x4531c6){var _0x96b90a={},_0x2d231e={},_0x278d2f={'count':0x0,'rows':[]};var _0x2fe468=_['map'](db[_0x2a63('0x3b')][_0x2a63('0x3c')],function(_0x52bfa0){return{'name':_0x52bfa0[_0x2a63('0x3d')],'type':_0x52bfa0[_0x2a63('0x33')][_0x2a63('0x3e')]};});_0x2d231e[_0x2a63('0x3f')]=_[_0x2a63('0x30')](_0x2fe468,_0x2a63('0x35'));_0x2d231e[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x9c648c[_0x2a63('0x40')]);_0x2d231e[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0x2d231e[_0x2a63('0x3f')],_0x2d231e[_0x2a63('0x40')]);_0x96b90a[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x2d231e[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0x9c648c[_0x2a63('0x40')]['fields']));_0x96b90a[_0x2a63('0x44')]=_0x96b90a[_0x2a63('0x44')][_0x2a63('0x46')]?_0x96b90a[_0x2a63('0x44')]:_0x2d231e[_0x2a63('0x3f')];if(!_0x9c648c['query']['hasOwnProperty'](_0x2a63('0x47'))){_0x96b90a[_0x2a63('0x48')]=qs['limit'](_0x9c648c[_0x2a63('0x40')]['limit']);_0x96b90a[_0x2a63('0x23')]=qs[_0x2a63('0x23')](_0x9c648c[_0x2a63('0x40')][_0x2a63('0x23')]);}_0x96b90a[_0x2a63('0x49')]=qs[_0x2a63('0x4a')](_0x9c648c['query']['sort']);_0x96b90a[_0x2a63('0x4b')]=qs[_0x2a63('0x42')](_[_0x2a63('0x4c')](_0x9c648c[_0x2a63('0x40')],_0x2d231e['filters']),_0x2fe468);if(_0x9c648c[_0x2a63('0x40')][_0x2a63('0x2e')]){_0x96b90a[_0x2a63('0x4b')]=_[_0x2a63('0x4d')](_0x96b90a[_0x2a63('0x4b')],{'$or':_['map'](_0x2fe468,function(_0x31e4ed){if(_0x31e4ed[_0x2a63('0x33')]!==_0x2a63('0x4e')){var _0x1837ad={};_0x1837ad[_0x31e4ed[_0x2a63('0x35')]]={'$like':'%'+_0x9c648c[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x1837ad;}})});}_0x96b90a=_[_0x2a63('0x4d')]({},_0x96b90a,_0x9c648c['options']);var _0x55ba9a={'where':_0x96b90a[_0x2a63('0x4b')]};return db[_0x2a63('0x3b')][_0x2a63('0x22')](_0x55ba9a)[_0x2a63('0x28')](function(_0xc1209e){_0x278d2f['count']=_0xc1209e;if(_0x9c648c['query'][_0x2a63('0x4f')]){_0x96b90a[_0x2a63('0x50')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x96b90a);})[_0x2a63('0x28')](function(_0x48a11c){_0x278d2f[_0x2a63('0x51')]=_0x48a11c;return _0x278d2f;})[_0x2a63('0x28')](respondWithFilteredResult(_0x4531c6,_0x96b90a))['catch'](handleError(_0x4531c6,null));};exports[_0x2a63('0x52')]=function(_0x47c4e2,_0x3e1bf5){var _0x926809={'raw':![],'where':{'id':_0x47c4e2[_0x2a63('0x53')]['id']}},_0x38718d={};_0x38718d['model']=_[_0x2a63('0x41')](db[_0x2a63('0x3b')]['rawAttributes']);_0x38718d[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x47c4e2[_0x2a63('0x40')]);_0x38718d['filters']=_[_0x2a63('0x43')](_0x38718d['model'],_0x38718d[_0x2a63('0x40')]);_0x926809['attributes']=_[_0x2a63('0x43')](_0x38718d['model'],qs[_0x2a63('0x45')](_0x47c4e2[_0x2a63('0x40')][_0x2a63('0x45')]));_0x926809['attributes']=_0x926809['attributes'][_0x2a63('0x46')]?_0x926809[_0x2a63('0x44')]:_0x38718d[_0x2a63('0x3f')];if(_0x47c4e2[_0x2a63('0x40')][_0x2a63('0x4f')]){_0x926809[_0x2a63('0x50')]=[{'all':!![]}];}_0x926809=_[_0x2a63('0x4d')]({},_0x926809,_0x47c4e2[_0x2a63('0x54')]);return db[_0x2a63('0x3b')]['find'](_0x926809)[_0x2a63('0x28')](handleEntityNotFound(_0x3e1bf5,null))[_0x2a63('0x28')](respondWithResult(_0x3e1bf5,null))[_0x2a63('0x55')](handleError(_0x3e1bf5,null));};exports[_0x2a63('0x56')]=function(_0x3db00d,_0x160bea){return db['VoiceQueue']['create'](_0x3db00d[_0x2a63('0x57')],{})[_0x2a63('0x28')](function(_0x21eb96){var _0x40b2ae=_0x3db00d[_0x2a63('0x58')][_0x2a63('0x29')]({'plain':!![]});if(!_0x40b2ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40b2ae[_0x2a63('0x59')]===_0x2a63('0x58')){var _0x4084b5=_0x21eb96[_0x2a63('0x29')]({'plain':!![]});var _0x5051c0=[{'name':_0x2a63('0x2a'),'value':_0x2a63('0x2b')},{'name':_0x2a63('0x2c'),'value':_0x2a63('0x2d')}];var _0x54e814=_[_0x2a63('0x34')](_0x5051c0,[_0x2a63('0x31'),_0x4084b5[_0x2a63('0x33')]])[_0x2a63('0x35')];return db[_0x2a63('0x5a')][_0x2a63('0x34')]({'where':{'name':_0x54e814,'userProfileId':_0x40b2ae[_0x2a63('0x5b')]},'raw':!![]})[_0x2a63('0x28')](function(_0x5bae95){if(_0x5bae95&&_0x5bae95[_0x2a63('0x5c')]===0x0){return db[_0x2a63('0x36')][_0x2a63('0x56')]({'name':_0x4084b5[_0x2a63('0x35')],'resourceId':_0x4084b5['id'],'type':_0x5bae95[_0x2a63('0x35')],'sectionId':_0x5bae95['id']},{})[_0x2a63('0x28')](function(){return _0x21eb96;});}else{return _0x21eb96;}})[_0x2a63('0x55')](function(_0x27a2e0){logger[_0x2a63('0x37')](_0x2a63('0x5d'),_0x27a2e0);throw _0x27a2e0;});}return _0x21eb96;})['then'](respondWithResult(_0x160bea,0xc9))['catch'](handleError(_0x160bea,null));};exports[_0x2a63('0x5e')]=function(_0x3ef688,_0x1e7109){var _0x18da33={'where':{'id':_0x3ef688[_0x2a63('0x53')]['id']}},_0x2330e7={};_0x2330e7[_0x2a63('0x3f')]=_[_0x2a63('0x41')](db[_0x2a63('0x3b')][_0x2a63('0x3c')]);_0x18da33[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x2330e7[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0x3ef688[_0x2a63('0x40')]['fields']));_0x18da33[_0x2a63('0x44')]=_0x18da33[_0x2a63('0x44')]['length']?_0x18da33[_0x2a63('0x44')]:_0x2330e7[_0x2a63('0x3f')];if(_0x3ef688[_0x2a63('0x40')][_0x2a63('0x4f')]){_0x18da33[_0x2a63('0x50')]=[{'all':!![]}];}_0x18da33=_[_0x2a63('0x4d')]({},_0x18da33,_0x3ef688['options']);return db['VoiceQueue'][_0x2a63('0x34')](_0x18da33)[_0x2a63('0x28')](handleEntityNotFound(_0x1e7109,null))[_0x2a63('0x28')](function(_0x5d9cbe){if(_0x5d9cbe){var _0x45e613=_0x5d9cbe[_0x2a63('0x29')]({'plain':!![]});_0x45e613=qs[_0x2a63('0x5f')](_0x45e613,['id',_0x2a63('0x60'),'updatedAt']);_0x3ef688[_0x2a63('0x57')]=_['omit'](_0x3ef688[_0x2a63('0x57')],['id',_0x2a63('0x60'),_0x2a63('0x61')]);return db['VoiceQueue']['create'](_[_0x2a63('0x4d')](_0x45e613,_0x3ef688[_0x2a63('0x57')]),{'include':_0x3ef688[_0x2a63('0x40')][_0x2a63('0x4f')]?[{'all':!![]}]:undefined})[_0x2a63('0x28')](function(_0x41b699){var _0x4482ff=_0x3ef688[_0x2a63('0x58')][_0x2a63('0x29')]({'plain':!![]});if(!_0x4482ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4482ff['role']===_0x2a63('0x58')){var _0x1549c6=_0x41b699[_0x2a63('0x29')]({'plain':!![]});var _0x5ddeb8=[{'name':_0x2a63('0x2a'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x2a63('0x2d')}];var _0x1d198a=_[_0x2a63('0x34')](_0x5ddeb8,['value',_0x1549c6['type']])[_0x2a63('0x35')];return db[_0x2a63('0x5a')]['find']({'where':{'name':_0x1d198a,'userProfileId':_0x4482ff[_0x2a63('0x5b')]},'raw':!![]})[_0x2a63('0x28')](function(_0x56bb89){if(_0x56bb89&&_0x56bb89[_0x2a63('0x5c')]===0x0){return db[_0x2a63('0x36')]['create']({'name':_0x1549c6[_0x2a63('0x35')],'resourceId':_0x1549c6['id'],'type':_0x56bb89[_0x2a63('0x35')],'sectionId':_0x56bb89['id']},{})['then'](function(){return _0x41b699;});}else{return _0x41b699;}})['catch'](function(_0x33ad83){logger[_0x2a63('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33ad83);throw _0x33ad83;});}return _0x41b699;});}})[_0x2a63('0x28')](respondWithResult(_0x1e7109,0xc9))[_0x2a63('0x55')](handleError(_0x1e7109,null));};exports[_0x2a63('0x62')]=function(_0x5d941e,_0x2c0ee3){if(_0x5d941e[_0x2a63('0x57')]['id']){delete _0x5d941e['body']['id'];}return db['VoiceQueue'][_0x2a63('0x34')]({'where':{'id':_0x5d941e['params']['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x2c0ee3,null))['then'](saveUpdates(_0x5d941e['body'],null))['then'](respondWithResult(_0x2c0ee3,null))[_0x2a63('0x55')](handleError(_0x2c0ee3,null));};exports[_0x2a63('0x27')]=function(_0xa859b9,_0xd39787){return db[_0x2a63('0x3b')][_0x2a63('0x34')]({'where':{'id':_0xa859b9[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0xd39787,null))[_0x2a63('0x28')](removeEntity(_0xd39787,null))[_0x2a63('0x55')](handleError(_0xd39787,null));};exports['getHoppers']=function(_0x5c5943,_0x5ea82b,_0x3bce34){var _0x334d7d={'raw':![],'where':{}};var _0x411d08={};var _0xc26359={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x5c5943[_0x2a63('0x53')]['id']}})['then'](handleEntityNotFound(_0x5ea82b,null))['then'](function(_0x3437fe){if(_0x3437fe){_0x411d08[_0x2a63('0x3f')]=_['keys'](db[_0x2a63('0x63')][_0x2a63('0x3c')]);_0x411d08[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x5c5943[_0x2a63('0x40')]);_0x411d08[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0x411d08['model'],_0x411d08[_0x2a63('0x40')]);_0x334d7d['attributes']=_[_0x2a63('0x43')](_0x411d08['model'],qs[_0x2a63('0x45')](_0x5c5943[_0x2a63('0x40')][_0x2a63('0x45')]));_0x334d7d[_0x2a63('0x44')]=_0x334d7d['attributes'][_0x2a63('0x46')]?_0x334d7d[_0x2a63('0x44')]:_0x411d08[_0x2a63('0x3f')];if(!_0x5c5943[_0x2a63('0x40')][_0x2a63('0x64')]('nolimit')){_0x334d7d[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x5c5943[_0x2a63('0x40')][_0x2a63('0x48')]);_0x334d7d[_0x2a63('0x23')]=qs[_0x2a63('0x23')](_0x5c5943[_0x2a63('0x40')][_0x2a63('0x23')]);}_0x334d7d['order']=qs[_0x2a63('0x4a')](_0x5c5943[_0x2a63('0x40')]['sort']);_0x334d7d[_0x2a63('0x4b')]=qs[_0x2a63('0x42')](_[_0x2a63('0x4c')](_0x5c5943[_0x2a63('0x40')],_0x411d08['filters']));_0x334d7d[_0x2a63('0x4b')][_0x2a63('0x65')]=_0x3437fe['id'];if(_0x5c5943[_0x2a63('0x40')][_0x2a63('0x2e')]){_0x334d7d['where']=_[_0x2a63('0x4d')](_0x334d7d[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x334d7d['attributes'],function(_0x38e208){var _0x4f4163={};_0x4f4163[_0x38e208]={'$like':'%'+_0x5c5943['query'][_0x2a63('0x2e')]+'%'};return _0x4f4163;})});}_0x334d7d=_[_0x2a63('0x4d')]({},_0x334d7d,_0x5c5943[_0x2a63('0x54')]);return db[_0x2a63('0x63')][_0x2a63('0x22')]({'where':_0x334d7d[_0x2a63('0x4b')]})['then'](function(_0x1915fe){_0xc26359[_0x2a63('0x22')]=_0x1915fe;if(_0x5c5943[_0x2a63('0x40')][_0x2a63('0x4f')]){_0x334d7d['include']=[{'all':!![]}];}return db[_0x2a63('0x63')][_0x2a63('0x66')](_0x334d7d);})['then'](function(_0x3f5807){_0xc26359[_0x2a63('0x51')]=_0x3f5807;return _0xc26359;});}})[_0x2a63('0x28')](respondWithFilteredResult(_0x5ea82b,_0x334d7d))[_0x2a63('0x55')](handleError(_0x5ea82b,null));};exports[_0x2a63('0x67')]=function(_0x152b3a,_0x399a36,_0x9111e9){var _0x551adf={'raw':!![],'where':{}};var _0x54b839={};var _0x1c4955={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2a63('0x68')]({'where':{'id':_0x152b3a[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x399a36,null))[_0x2a63('0x28')](function(_0xc1dfeb){if(_0xc1dfeb){_0x54b839['model']=_[_0x2a63('0x41')](db[_0x2a63('0x69')]['rawAttributes']);_0x54b839[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x152b3a[_0x2a63('0x40')]);_0x54b839['filters']=_[_0x2a63('0x43')](_0x54b839[_0x2a63('0x3f')],_0x54b839[_0x2a63('0x40')]);_0x551adf[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x54b839['model'],qs['fields'](_0x152b3a[_0x2a63('0x40')]['fields']));_0x551adf[_0x2a63('0x44')]=_0x551adf[_0x2a63('0x44')]['length']?_0x551adf[_0x2a63('0x44')]:_0x54b839['model'];if(!_0x152b3a[_0x2a63('0x40')]['hasOwnProperty'](_0x2a63('0x47'))){_0x551adf[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x152b3a[_0x2a63('0x40')][_0x2a63('0x48')]);_0x551adf['offset']=qs[_0x2a63('0x23')](_0x152b3a[_0x2a63('0x40')][_0x2a63('0x23')]);}_0x551adf[_0x2a63('0x49')]=qs[_0x2a63('0x4a')](_0x152b3a[_0x2a63('0x40')][_0x2a63('0x4a')]);_0x551adf[_0x2a63('0x4b')]=qs[_0x2a63('0x42')](_[_0x2a63('0x4c')](_0x152b3a[_0x2a63('0x40')],_0x54b839[_0x2a63('0x42')]));_0x551adf[_0x2a63('0x4b')]['VoiceQueueId']=_0xc1dfeb['id'];if(_0x152b3a[_0x2a63('0x40')][_0x2a63('0x2e')]){_0x551adf['where']=_[_0x2a63('0x4d')](_0x551adf['where'],{'$or':_[_0x2a63('0x30')](_0x551adf['attributes'],function(_0x11c3b5){var _0xace2b3={};_0xace2b3[_0x11c3b5]={'$like':'%'+_0x152b3a[_0x2a63('0x40')]['filter']+'%'};return _0xace2b3;})});}_0x551adf=_[_0x2a63('0x4d')]({},_0x551adf,_0x152b3a[_0x2a63('0x54')]);return db[_0x2a63('0x69')][_0x2a63('0x22')]({'where':_0x551adf[_0x2a63('0x4b')]})[_0x2a63('0x28')](function(_0x396139){_0x1c4955['count']=_0x396139;if(_0x152b3a['query'][_0x2a63('0x4f')]){_0x551adf[_0x2a63('0x50')]=[{'all':!![]}];}return db[_0x2a63('0x69')][_0x2a63('0x66')](_0x551adf);})[_0x2a63('0x28')](function(_0x182347){_0x1c4955[_0x2a63('0x51')]=_0x182347;return _0x1c4955;});}})[_0x2a63('0x28')](respondWithFilteredResult(_0x399a36,_0x551adf))[_0x2a63('0x55')](handleError(_0x399a36,null));};exports['getHopperFinals']=function(_0x534d85,_0x48f67e,_0xce4695){var _0x2daf9a={'raw':!![],'where':{}};var _0xfe1491={};var _0x45e5ca={'count':0x0,'rows':[]};return db[_0x2a63('0x3b')][_0x2a63('0x68')]({'where':{'id':_0x534d85[_0x2a63('0x53')]['id']}})['then'](handleEntityNotFound(_0x48f67e,null))[_0x2a63('0x28')](function(_0x234598){if(_0x234598){_0xfe1491[_0x2a63('0x3f')]=_['keys'](db[_0x2a63('0x6a')][_0x2a63('0x3c')]);_0xfe1491[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x534d85[_0x2a63('0x40')]);_0xfe1491[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0xfe1491[_0x2a63('0x3f')],_0xfe1491[_0x2a63('0x40')]);_0x2daf9a['attributes']=_['intersection'](_0xfe1491[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0x534d85[_0x2a63('0x40')][_0x2a63('0x45')]));_0x2daf9a[_0x2a63('0x44')]=_0x2daf9a[_0x2a63('0x44')][_0x2a63('0x46')]?_0x2daf9a[_0x2a63('0x44')]:_0xfe1491[_0x2a63('0x3f')];if(!_0x534d85[_0x2a63('0x40')][_0x2a63('0x64')](_0x2a63('0x47'))){_0x2daf9a[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x534d85[_0x2a63('0x40')][_0x2a63('0x48')]);_0x2daf9a[_0x2a63('0x23')]=qs['offset'](_0x534d85[_0x2a63('0x40')][_0x2a63('0x23')]);}_0x2daf9a[_0x2a63('0x49')]=qs[_0x2a63('0x4a')](_0x534d85['query'][_0x2a63('0x4a')]);_0x2daf9a[_0x2a63('0x4b')]=qs['filters'](_['pick'](_0x534d85[_0x2a63('0x40')],_0xfe1491[_0x2a63('0x42')]));_0x2daf9a[_0x2a63('0x4b')]['VoiceQueueId']=_0x234598['id'];if(_0x534d85[_0x2a63('0x40')]['filter']){_0x2daf9a[_0x2a63('0x4b')]=_[_0x2a63('0x4d')](_0x2daf9a['where'],{'$or':_[_0x2a63('0x30')](_0x2daf9a[_0x2a63('0x44')],function(_0x32bf44){var _0x3334a2={};_0x3334a2[_0x32bf44]={'$like':'%'+_0x534d85[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x3334a2;})});}_0x2daf9a=_[_0x2a63('0x4d')]({},_0x2daf9a,_0x534d85[_0x2a63('0x54')]);return db[_0x2a63('0x6a')]['count']({'where':_0x2daf9a[_0x2a63('0x4b')]})[_0x2a63('0x28')](function(_0x11609d){_0x45e5ca['count']=_0x11609d;if(_0x534d85[_0x2a63('0x40')][_0x2a63('0x4f')]){_0x2daf9a['include']=[{'all':!![]}];}return db[_0x2a63('0x6a')][_0x2a63('0x66')](_0x2daf9a);})[_0x2a63('0x28')](function(_0x1160f5){_0x45e5ca['rows']=_0x1160f5;return _0x45e5ca;});}})['then'](respondWithFilteredResult(_0x48f67e,_0x2daf9a))['catch'](handleError(_0x48f67e,null));};exports[_0x2a63('0x6b')]=function(_0xd0ce76,_0x205149,_0x37794a){var _0x3c67f1={'raw':!![],'where':{}};var _0x57d527={};var _0x3da9b5={'count':0x0,'rows':[]};return db[_0x2a63('0x3b')][_0x2a63('0x68')]({'where':{'id':_0xd0ce76[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x205149,null))[_0x2a63('0x28')](function(_0x192c52){if(_0x192c52){_0x57d527[_0x2a63('0x3f')]=_[_0x2a63('0x41')](db[_0x2a63('0x6c')][_0x2a63('0x3c')]);_0x57d527[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0xd0ce76[_0x2a63('0x40')]);_0x57d527['filters']=_['intersection'](_0x57d527['model'],_0x57d527[_0x2a63('0x40')]);_0x3c67f1[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x57d527[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0xd0ce76[_0x2a63('0x40')][_0x2a63('0x45')]));_0x3c67f1[_0x2a63('0x44')]=_0x3c67f1['attributes'][_0x2a63('0x46')]?_0x3c67f1[_0x2a63('0x44')]:_0x57d527['model'];if(!_0xd0ce76[_0x2a63('0x40')][_0x2a63('0x64')](_0x2a63('0x47'))){_0x3c67f1[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0xd0ce76[_0x2a63('0x40')][_0x2a63('0x48')]);_0x3c67f1['offset']=qs['offset'](_0xd0ce76[_0x2a63('0x40')][_0x2a63('0x23')]);}_0x3c67f1['order']=qs['sort'](_0xd0ce76['query'][_0x2a63('0x4a')]);_0x3c67f1[_0x2a63('0x4b')]=qs['filters'](_['pick'](_0xd0ce76[_0x2a63('0x40')],_0x57d527[_0x2a63('0x42')]));_0x3c67f1['where']['VoiceQueueId']=_0x192c52['id'];if(_0xd0ce76['query']['filter']){_0x3c67f1[_0x2a63('0x4b')]=_['merge'](_0x3c67f1[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x3c67f1[_0x2a63('0x44')],function(_0x3732a7){var _0x5cde9b={};_0x5cde9b[_0x3732a7]={'$like':'%'+_0xd0ce76['query']['filter']+'%'};return _0x5cde9b;})});}_0x3c67f1=_[_0x2a63('0x4d')]({},_0x3c67f1,_0xd0ce76[_0x2a63('0x54')]);return db[_0x2a63('0x6c')]['count']({'where':_0x3c67f1[_0x2a63('0x4b')]})[_0x2a63('0x28')](function(_0x7a1b5b){_0x3da9b5['count']=_0x7a1b5b;if(_0xd0ce76[_0x2a63('0x40')][_0x2a63('0x4f')]){_0x3c67f1[_0x2a63('0x50')]=[{'all':!![]}];}return db[_0x2a63('0x6c')]['findAll'](_0x3c67f1);})[_0x2a63('0x28')](function(_0x9a803e){_0x3da9b5[_0x2a63('0x51')]=_0x9a803e;return _0x3da9b5;});}})[_0x2a63('0x28')](respondWithFilteredResult(_0x205149,_0x3c67f1))[_0x2a63('0x55')](handleError(_0x205149,null));};exports['getTeams']=function(_0x45052e,_0xc3364e,_0x32bda3){var _0x528f58={};var _0x387225={};var _0x3c96a9;var _0x18a77a;return db[_0x2a63('0x3b')]['findOne']({'where':{'id':_0x45052e['params']['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0xc3364e,null))[_0x2a63('0x28')](function(_0x2ca943){if(_0x2ca943){_0x3c96a9=_0x2ca943;_0x387225[_0x2a63('0x3f')]=_[_0x2a63('0x41')](db[_0x2a63('0x6d')]['rawAttributes']);_0x387225[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x45052e['query']);_0x387225[_0x2a63('0x42')]=_['intersection'](_0x387225[_0x2a63('0x3f')],_0x387225['query']);_0x528f58[_0x2a63('0x44')]=_['intersection'](_0x387225['model'],qs['fields'](_0x45052e[_0x2a63('0x40')][_0x2a63('0x45')]));_0x528f58[_0x2a63('0x44')]=_0x528f58[_0x2a63('0x44')][_0x2a63('0x46')]?_0x528f58[_0x2a63('0x44')]:_0x387225[_0x2a63('0x3f')];_0x528f58[_0x2a63('0x49')]=qs[_0x2a63('0x4a')](_0x45052e[_0x2a63('0x40')][_0x2a63('0x4a')]);_0x528f58['where']=qs['filters'](_['pick'](_0x45052e[_0x2a63('0x40')],_0x387225[_0x2a63('0x42')]));if(_0x45052e['query'][_0x2a63('0x2e')]){_0x528f58[_0x2a63('0x4b')]=_[_0x2a63('0x4d')](_0x528f58[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x528f58[_0x2a63('0x44')],function(_0xb9a2ce){var _0x5c8722={};_0x5c8722[_0xb9a2ce]={'$like':'%'+_0x45052e[_0x2a63('0x40')]['filter']+'%'};return _0x5c8722;})});}_0x528f58=_[_0x2a63('0x4d')]({},_0x528f58,_0x45052e[_0x2a63('0x54')]);return _0x3c96a9['getTeams'](_0x528f58);}})[_0x2a63('0x28')](function(_0x189f58){if(_0x189f58){_0x18a77a=_0x189f58[_0x2a63('0x46')];if(!_0x45052e['query']['hasOwnProperty'](_0x2a63('0x47'))){_0x528f58[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x45052e[_0x2a63('0x40')][_0x2a63('0x48')]);_0x528f58['offset']=qs[_0x2a63('0x23')](_0x45052e[_0x2a63('0x40')][_0x2a63('0x23')]);}return _0x3c96a9[_0x2a63('0x6e')](_0x528f58);}})[_0x2a63('0x28')](function(_0x30adb0){if(_0x30adb0){return _0x30adb0?{'count':_0x18a77a,'rows':_0x30adb0}:null;}})['then'](respondWithResult(_0xc3364e,null))[_0x2a63('0x55')](handleError(_0xc3364e,null));};exports[_0x2a63('0x6f')]=function(_0x487dcc,_0x33ad71,_0x58200c){var _0x431e36=_0x487dcc[_0x2a63('0x57')][_0x2a63('0x70')];var _0x5ea869=_['map'](_0x431e36,'id');return db[_0x2a63('0x6d')][_0x2a63('0x66')]({'where':{'id':_0x5ea869},'attributes':['id'],'include':[{'model':db[_0x2a63('0x71')],'as':_0x2a63('0x72'),'attributes':['id',_0x2a63('0x35'),_0x2a63('0x73'),_0x2a63('0x74'),_0x2a63('0x75')],'raw':!![]}]})[_0x2a63('0x28')](function(_0x504885){if(_0x504885){var _0x3749c8=_[_0x2a63('0x76')](_0x504885,function(_0x31fb6e){var _0x16c977=_0x31fb6e[_0x2a63('0x29')]({'plain':!![]});_0x16c977[_0x2a63('0x72')][_0x2a63('0x77')](function(_0x181b84){_0x181b84[_0x2a63('0x78')]=_['find'](_0x431e36,{'id':_0x16c977['id']})[_0x2a63('0x78')];});return _0x16c977['Agents'];});return db[_0x2a63('0x3b')][_0x2a63('0x34')]({'where':{'id':_0x487dcc['params']['id']}})[_0x2a63('0x28')](function(_0x41c58b){return db[_0x2a63('0x79')][_0x2a63('0x7a')](function(_0x2ec788){return _0x41c58b[_0x2a63('0x6f')](_0x5ea869,{'transaction':_0x2ec788})['then'](function(){return BPromise[_0x2a63('0x7b')](_0x3749c8,function(_0x2802e6){return db['UserVoiceQueue'][_0x2a63('0x7c')]({'where':{'UserId':_0x2802e6['id'],'VoiceQueueId':_0x487dcc[_0x2a63('0x53')]['id']},'defaults':{'penalty':_0x2802e6['penalty']},'transaction':_0x2ec788});});})[_0x2a63('0x28')](function(){return BPromise[_0x2a63('0x7b')](_[_0x2a63('0x2e')](_0x3749c8,{'online':!![]}),function(_0x53af41){return db[_0x2a63('0x7d')][_0x2a63('0x7e')]({'membername':_0x53af41['name'],'UserId':_0x53af41['id'],'queue_name':_0x41c58b['name'],'VoiceQueueId':_0x41c58b['id'],'interface':_[_0x2a63('0x7f')](_0x53af41[_0x2a63('0x75')])?util[_0x2a63('0x80')](_0x2a63('0x81'),_0x53af41[_0x2a63('0x35')]):_0x53af41[_0x2a63('0x75')],'paused':_0x53af41['voicePause']||![],'penalty':_0x53af41[_0x2a63('0x78')]},{'transaction':_0x2ec788});});})['then'](function(){_0x3749c8[_0x2a63('0x77')](function(_0x167c97){socket['emit'](_0x2a63('0x82'),{'UserId':_0x167c97['id'],'VoiceQueueId':_0x41c58b['id']});});});});});}})['then'](respondWithStatusCode(_0x33ad71,null))[_0x2a63('0x55')](handleError(_0x33ad71,null));};exports[_0x2a63('0x83')]=function(_0x4ed5b8,_0x3d17ac,_0x4a7a7c){return db[_0x2a63('0x6d')][_0x2a63('0x66')]({'where':{'id':_0x4ed5b8[_0x2a63('0x40')][_0x2a63('0x84')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2a63('0x72'),'attributes':['id'],'raw':!![]}]})[_0x2a63('0x28')](handleEntityNotFound(_0x3d17ac,null))[_0x2a63('0x28')](function(_0x1fdadc){var _0x500009=_[_0x2a63('0x30')](_0x1fdadc,'id');var _0x550fd5=[];var _0xaa7fa0=[];var _0x3b77d2=squel['select']();_0x3b77d2['field']('tq.TeamId')[_0x2a63('0x85')](_0x2a63('0x86'),'tq')[_0x2a63('0x87')]('user_has_teams','ut',_0x2a63('0x88'))[_0x2a63('0x4b')](_0x2a63('0x89'),_0x4ed5b8['params']['id']);for(var _0x13f124=0x0;_0x13f124<_0x1fdadc[_0x2a63('0x46')];_0x13f124+=0x1){let _0x54e74f=_0x1fdadc[_0x13f124];for(var _0x39c173=0x0;_0x39c173<_0x54e74f[_0x2a63('0x72')][_0x2a63('0x46')];_0x39c173+=0x1){let _0x2ac815=_0x54e74f[_0x2a63('0x72')][_0x39c173];var _0x26020f=_0x3b77d2[_0x2a63('0x5e')]();_0x26020f[_0x2a63('0x4b')]('ut.UserId\x20=\x20?',_0x2ac815['id']);_0xaa7fa0['push'](db['sequelize'][_0x2a63('0x40')](_0x26020f['toString'](),{'type':db[_0x2a63('0x79')]['QueryTypes'][_0x2a63('0x8a')]})[_0x2a63('0x28')](function(_0x40951d){if(_0x40951d[_0x2a63('0x46')]===0x1){return _0x2ac815['id'];}else{var _0x26735e=_[_0x2a63('0x8b')](_[_0x2a63('0x30')](_0x40951d,_0x2a63('0x8c')),function(_0x4444cf){return _[_0x2a63('0x32')](_0x500009,_0x4444cf);});if(_0x26735e){return _0x2ac815['id'];}}}));}}return BPromise[_0x2a63('0x8d')](_0xaa7fa0)[_0x2a63('0x28')](function(_0x4b3e10){_0x550fd5=_(_0x550fd5)[_0x2a63('0x8e')](_0x4b3e10)[_0x2a63('0x8f')]()['value']();return db['VoiceQueue'][_0x2a63('0x34')]({'where':{'id':_0x4ed5b8[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](function(_0x265217){return db[_0x2a63('0x79')][_0x2a63('0x7a')](function(_0x518d16){return _0x265217[_0x2a63('0x83')](_0x4ed5b8['query'][_0x2a63('0x84')],{'transaction':_0x518d16})[_0x2a63('0x28')](function(){if(!_[_0x2a63('0x90')](_0x550fd5)){return _0x265217['removeAgents'](_0x550fd5,{'transaction':_0x518d16})['then'](function(){return db[_0x2a63('0x7d')][_0x2a63('0x27')]({'where':{'VoiceQueueId':_0x4ed5b8['params']['id'],'UserId':_0x550fd5},'transaction':_0x518d16});});}})['then'](function(){_0x550fd5['forEach'](function(_0x20a7bf){socket[_0x2a63('0x91')]('userVoiceQueue:remove',{'UserId':_0x20a7bf,'VoiceQueueId':_0x265217['id']});});});});});});})['then'](respondWithStatusCode(_0x3d17ac,null))[_0x2a63('0x55')](handleError(_0x3d17ac,null));};exports[_0x2a63('0x92')]=function(_0x3dd2f9,_0x140574,_0x44ec3d){var _0x4ddeff,_0x389ec7;return db['VoiceQueue'][_0x2a63('0x34')]({'where':{'id':_0x3dd2f9[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x140574,null))[_0x2a63('0x28')](function(_0x46ac46){if(_0x46ac46){_0x389ec7=_0x46ac46;return _0x46ac46[_0x2a63('0x92')](_0x3dd2f9[_0x2a63('0x57')][_0x2a63('0x84')],_[_0x2a63('0x5f')](_0x3dd2f9['body'],[_0x2a63('0x84'),'id'])||{})['spread'](function(_0x433981){for(var _0x52f33d=0x0;_0x52f33d<_0x3dd2f9[_0x2a63('0x57')]['ids']['length'];_0x52f33d+=0x1){socket[_0x2a63('0x91')](_0x2a63('0x82'),{'UserId':_0x3dd2f9[_0x2a63('0x57')][_0x2a63('0x84')][_0x52f33d],'VoiceQueueId':_0x3dd2f9[_0x2a63('0x53')]['id']});}return _0x433981;});}})[_0x2a63('0x28')](function(_0x503eae){_0x4ddeff=_0x503eae||[];if(_0x389ec7){return db[_0x2a63('0x71')][_0x2a63('0x66')]({'where':{'id':_0x3dd2f9['body'][_0x2a63('0x84')]},'attributes':['id',_0x2a63('0x35'),_0x2a63('0x73'),_0x2a63('0x74'),'interface'],'raw':!![]});}})[_0x2a63('0x28')](function(_0x4843ea){if(!_[_0x2a63('0x90')](_0x4843ea)){var _0x15bf1f=[];for(var _0x5e5f7c=0x0;_0x5e5f7c<_0x4843ea[_0x2a63('0x46')];_0x5e5f7c++){if(_0x4843ea[_0x5e5f7c][_0x2a63('0x73')]){_0x15bf1f[_0x2a63('0x93')](db[_0x2a63('0x7d')]['upsert']({'membername':_0x4843ea[_0x5e5f7c][_0x2a63('0x35')],'UserId':_0x4843ea[_0x5e5f7c]['id'],'queue_name':_0x389ec7[_0x2a63('0x35')],'VoiceQueueId':_0x389ec7['id'],'interface':_[_0x2a63('0x7f')](_0x4843ea[_0x5e5f7c][_0x2a63('0x75')])?util[_0x2a63('0x80')](_0x2a63('0x81'),_0x4843ea[_0x5e5f7c]['name']):_0x4843ea[_0x5e5f7c][_0x2a63('0x75')],'paused':_0x4843ea[_0x5e5f7c]['voicePause']||![],'penalty':_0x3dd2f9[_0x2a63('0x57')][_0x2a63('0x78')]||0x0}));}}return BPromise[_0x2a63('0x8d')](_0x15bf1f);}})[_0x2a63('0x28')](function(){return _0x4ddeff;})['then'](respondWithResult(_0x140574,null))[_0x2a63('0x55')](handleError(_0x140574,null));};exports['removeAgents']=function(_0x33b909,_0x1303f3,_0x2a5edf){return db[_0x2a63('0x3b')][_0x2a63('0x34')]({'where':{'id':_0x33b909[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x1303f3,null))[_0x2a63('0x28')](function(_0x261178){if(_0x261178){return _0x261178[_0x2a63('0x94')](_0x33b909[_0x2a63('0x40')][_0x2a63('0x84')])[_0x2a63('0x28')](function(){if(_['isArray'](_0x33b909['query']['ids'])){for(var _0x339b09=0x0;_0x339b09<_0x33b909[_0x2a63('0x40')][_0x2a63('0x84')][_0x2a63('0x46')];_0x339b09+=0x1){socket[_0x2a63('0x91')](_0x2a63('0x95'),{'UserId':Number(_0x33b909[_0x2a63('0x40')][_0x2a63('0x84')][_0x339b09]),'VoiceQueueId':Number(_0x33b909['params']['id'])});}}else{socket[_0x2a63('0x91')](_0x2a63('0x95'),{'UserId':Number(_0x33b909[_0x2a63('0x40')][_0x2a63('0x84')]),'VoiceQueueId':Number(_0x33b909[_0x2a63('0x53')]['id'])});}});}})[_0x2a63('0x28')](function(_0x54ebc2){return db[_0x2a63('0x7d')][_0x2a63('0x27')]({'where':{'VoiceQueueId':_0x33b909[_0x2a63('0x53')]['id'],'UserId':_0x33b909[_0x2a63('0x40')][_0x2a63('0x84')]}})[_0x2a63('0x28')](function(){return _0x54ebc2;});})['then'](respondWithStatusCode(_0x1303f3,null))[_0x2a63('0x55')](handleError(_0x1303f3,null));};exports[_0x2a63('0x96')]=function(_0x192e9b,_0x3d09eb,_0x303633){var _0x31672d={};var _0x58555c={};var _0x1ab630;var _0x260824;return db['VoiceQueue'][_0x2a63('0x68')]({'where':{'id':_0x192e9b[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x3d09eb,null))[_0x2a63('0x28')](function(_0x2b56f2){if(_0x2b56f2){_0x1ab630=_0x2b56f2;_0x58555c[_0x2a63('0x3f')]=_['keys'](db['User']['rawAttributes']);_0x58555c[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x192e9b['query']);_0x58555c[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0x58555c['model'],_0x58555c[_0x2a63('0x40')]);_0x31672d['attributes']=_[_0x2a63('0x43')](_0x58555c[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0x192e9b[_0x2a63('0x40')][_0x2a63('0x45')]));_0x31672d[_0x2a63('0x44')]=_0x31672d['attributes'][_0x2a63('0x46')]?_0x31672d[_0x2a63('0x44')]:_0x58555c[_0x2a63('0x3f')];_0x31672d['order']=qs[_0x2a63('0x4a')](_0x192e9b[_0x2a63('0x40')][_0x2a63('0x4a')]);_0x31672d[_0x2a63('0x4b')]=qs[_0x2a63('0x42')](_['pick'](_0x192e9b['query'],_0x58555c[_0x2a63('0x42')]));if(_0x192e9b['query'][_0x2a63('0x2e')]){_0x31672d['where']=_[_0x2a63('0x4d')](_0x31672d[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x31672d['attributes'],function(_0x41baef){var _0x4a44e1={};_0x4a44e1[_0x41baef]={'$like':'%'+_0x192e9b[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x4a44e1;})});}_0x31672d=_[_0x2a63('0x4d')]({},_0x31672d,_0x192e9b[_0x2a63('0x54')]);return _0x1ab630['getAgents'](_0x31672d);}})['then'](function(_0x55dc8a){if(_0x55dc8a){_0x260824=_0x55dc8a[_0x2a63('0x46')];if(!_0x192e9b['query'][_0x2a63('0x64')](_0x2a63('0x47'))){_0x31672d[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x192e9b[_0x2a63('0x40')][_0x2a63('0x48')]);_0x31672d[_0x2a63('0x23')]=qs['offset'](_0x192e9b[_0x2a63('0x40')][_0x2a63('0x23')]);}return _0x1ab630[_0x2a63('0x96')](_0x31672d);}})[_0x2a63('0x28')](function(_0x45814f){if(_0x45814f){return _0x45814f?{'count':_0x260824,'rows':_0x45814f}:null;}})[_0x2a63('0x28')](respondWithResult(_0x3d09eb,null))['catch'](handleError(_0x3d09eb,null));};exports[_0x2a63('0x97')]=function(_0x5acd80,_0x5a3276,_0x4513d9){var _0x155db5={};var _0x4a37a4={};var _0x32f702;var _0x2b1859;return db[_0x2a63('0x3b')]['findOne']({'where':{'id':_0x5acd80[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x5a3276,null))[_0x2a63('0x28')](function(_0x223e67){if(_0x223e67){_0x32f702=_0x223e67;_0x4a37a4['model']=_[_0x2a63('0x41')](db[_0x2a63('0x7d')][_0x2a63('0x3c')]);_0x4a37a4[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x5acd80['query']);_0x4a37a4['filters']=_[_0x2a63('0x43')](_0x4a37a4[_0x2a63('0x3f')],_0x4a37a4[_0x2a63('0x40')]);_0x155db5[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x4a37a4[_0x2a63('0x3f')],qs[_0x2a63('0x45')](_0x5acd80[_0x2a63('0x40')][_0x2a63('0x45')]));_0x155db5['attributes']=_0x155db5[_0x2a63('0x44')][_0x2a63('0x46')]?_0x155db5['attributes']:_0x4a37a4[_0x2a63('0x3f')];_0x155db5[_0x2a63('0x49')]=qs[_0x2a63('0x4a')](_0x5acd80[_0x2a63('0x40')][_0x2a63('0x4a')]);_0x155db5[_0x2a63('0x4b')]=qs[_0x2a63('0x42')](_['pick'](_0x5acd80[_0x2a63('0x40')],_0x4a37a4[_0x2a63('0x42')]));if(_0x5acd80[_0x2a63('0x40')][_0x2a63('0x2e')]){_0x155db5[_0x2a63('0x4b')]=_[_0x2a63('0x4d')](_0x155db5[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x155db5[_0x2a63('0x44')],function(_0x43264a){var _0x150039={};_0x150039[_0x43264a]={'$like':'%'+_0x5acd80[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x150039;})});}_0x155db5=_['merge']({},_0x155db5,_0x5acd80[_0x2a63('0x54')]);return _0x32f702[_0x2a63('0x97')](_0x155db5);}})[_0x2a63('0x28')](function(_0x226ff5){if(_0x226ff5){_0x2b1859=_0x226ff5[_0x2a63('0x46')];if(!_0x5acd80[_0x2a63('0x40')]['hasOwnProperty'](_0x2a63('0x47'))){_0x155db5[_0x2a63('0x48')]=qs['limit'](_0x5acd80['query'][_0x2a63('0x48')]);_0x155db5[_0x2a63('0x23')]=qs[_0x2a63('0x23')](_0x5acd80[_0x2a63('0x40')][_0x2a63('0x23')]);}return _0x32f702['getMembers'](_0x155db5);}})[_0x2a63('0x28')](function(_0x915d6f){return _0x915d6f?{'count':_0x2b1859,'rows':_0x915d6f}:null;})[_0x2a63('0x28')](respondWithResult(_0x5a3276,null))['catch'](handleError(_0x5a3276,null));};exports[_0x2a63('0x98')]=function(_0x253df9,_0x30dfe6,_0xca4c85){var _0x78f54a={};var _0x21f333={};var _0x46b5f1;var _0x380c38;return db[_0x2a63('0x3b')][_0x2a63('0x68')]({'where':{'id':_0x253df9['params']['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x30dfe6,null))[_0x2a63('0x28')](function(_0x57fb26){if(_0x57fb26){_0x46b5f1=_0x57fb26;_0x21f333[_0x2a63('0x3f')]=_[_0x2a63('0x41')](db[_0x2a63('0x99')]['rawAttributes']);_0x21f333[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x253df9[_0x2a63('0x40')]);_0x21f333[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0x21f333['model'],_0x21f333[_0x2a63('0x40')]);_0x78f54a[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x21f333[_0x2a63('0x3f')],qs['fields'](_0x253df9['query']['fields']));_0x78f54a[_0x2a63('0x44')]=_0x78f54a[_0x2a63('0x44')][_0x2a63('0x46')]?_0x78f54a[_0x2a63('0x44')]:_0x21f333[_0x2a63('0x3f')];_0x78f54a[_0x2a63('0x49')]=qs['sort'](_0x253df9[_0x2a63('0x40')]['sort']);_0x78f54a['where']=qs['filters'](_[_0x2a63('0x4c')](_0x253df9['query'],_0x21f333[_0x2a63('0x42')]));if(_0x253df9[_0x2a63('0x40')][_0x2a63('0x2e')]){_0x78f54a['where']=_[_0x2a63('0x4d')](_0x78f54a[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x78f54a[_0x2a63('0x44')],function(_0x46f4b9){var _0x43efb2={};_0x43efb2[_0x46f4b9]={'$like':'%'+_0x253df9[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x43efb2;})});}_0x78f54a=_[_0x2a63('0x4d')]({},_0x78f54a,_0x253df9['options']);return _0x46b5f1[_0x2a63('0x98')](_0x78f54a);}})[_0x2a63('0x28')](function(_0x2c6498){if(_0x2c6498){_0x380c38=_0x2c6498['length'];if(!_0x253df9[_0x2a63('0x40')][_0x2a63('0x64')](_0x2a63('0x47'))){_0x78f54a[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x253df9[_0x2a63('0x40')]['limit']);_0x78f54a['offset']=qs[_0x2a63('0x23')](_0x253df9[_0x2a63('0x40')][_0x2a63('0x23')]);}return _0x46b5f1[_0x2a63('0x98')](_0x78f54a);}})[_0x2a63('0x28')](function(_0x3d1d10){if(_0x3d1d10){return _0x3d1d10?{'count':_0x380c38,'rows':_0x3d1d10}:null;}})[_0x2a63('0x28')](respondWithResult(_0x30dfe6,null))['catch'](handleError(_0x30dfe6,null));};exports['addLists']=function(_0x25cfa2,_0x3ef4ae,_0x547a06){var _0x487d74,_0x2f1692;return db[_0x2a63('0x3b')][_0x2a63('0x34')]({'where':{'id':_0x25cfa2['params']['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x3ef4ae,null))['then'](function(_0x5a1c8f){if(_0x5a1c8f){_0x2f1692=_0x5a1c8f;return _0x5a1c8f[_0x2a63('0x9a')](_0x25cfa2[_0x2a63('0x57')][_0x2a63('0x84')],_[_0x2a63('0x5f')](_0x25cfa2[_0x2a63('0x57')],[_0x2a63('0x84'),'id'])||{});}return null;})[_0x2a63('0x9b')](function(_0x4ca728){var _0x2df2c9;_0x487d74=_0x4ca728||[];var _0x473929=[];if(_0x4ca728){for(var _0x56442b=0x0;_0x56442b<_0x4ca728[_0x2a63('0x46')];_0x56442b+=0x1){var _0x21530a=_0x4ca728[_0x56442b][_0x2a63('0x29')]({'plain':!![]});_0x2f1692['dialCheckDuplicateType']=_0x25cfa2[_0x2a63('0x57')][_0x2a63('0x9c')]?_0x25cfa2[_0x2a63('0x57')][_0x2a63('0x9c')]:_0x2f1692[_0x2a63('0x9c')];switch(_0x2f1692['dialCheckDuplicateType']){case _0x2a63('0x9d'):_0x2df2c9=squel['insert']()['into'](_0x2a63('0x9e'))['fromQuery']([_0x2a63('0x9f'),_0x2a63('0xa0'),_0x2a63('0xa1'),'ListId',_0x2a63('0x65'),_0x2a63('0x60'),_0x2a63('0x61')],squel[_0x2a63('0xa2')]()['field'](_0x2a63('0x9f'),'phone')[_0x2a63('0xa3')](_0x2a63('0xa4'),_0x2a63('0xa0'))[_0x2a63('0xa3')]('id','ContactId')[_0x2a63('0xa3')](_0x21530a[_0x2a63('0xa5')][_0x2a63('0xa6')](),_0x2a63('0xa7'))[_0x2a63('0xa3')](_0x25cfa2['params']['id'][_0x2a63('0xa6')](),_0x2a63('0x65'))[_0x2a63('0xa3')](_0x2a63('0xa4'),_0x2a63('0x60'))[_0x2a63('0xa3')](_0x2a63('0xa4'),_0x2a63('0x61'))['from']('cm_contacts')[_0x2a63('0x4b')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x21530a[_0x2a63('0xa5')]['toString']())[_0x2a63('0x4b')](_0x2a63('0xa8'))[_0x2a63('0x4b')](_0x2a63('0xa9'),squel[_0x2a63('0xa2')]()[_0x2a63('0xa3')](_0x2a63('0xaa'))[_0x2a63('0x85')](_0x2a63('0xab'))[_0x2a63('0x4b')](_0x2a63('0x89'),_0x25cfa2['params']['id'][_0x2a63('0xa6')]()))[_0x2a63('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2a63('0xa2')]()[_0x2a63('0xa3')]('COALESCE(phone,\x27\x27)')[_0x2a63('0x85')](_0x2a63('0x9e'))['where'](_0x2a63('0x89'),_0x25cfa2[_0x2a63('0x53')]['id'][_0x2a63('0xa6')]())))['toString']();break;case'onlyIfOpen':_0x2df2c9=squel[_0x2a63('0xac')]()[_0x2a63('0xad')](_0x2a63('0x9e'))[_0x2a63('0xae')]([_0x2a63('0x9f'),_0x2a63('0xa0'),'ContactId',_0x2a63('0xa7'),_0x2a63('0x65'),'createdAt',_0x2a63('0x61')],squel[_0x2a63('0xa2')]()[_0x2a63('0xa3')](_0x2a63('0x9f'),_0x2a63('0x9f'))[_0x2a63('0xa3')](_0x2a63('0xa4'),_0x2a63('0xa0'))['field']('id','ContactId')['field'](_0x21530a[_0x2a63('0xa5')][_0x2a63('0xa6')](),_0x2a63('0xa7'))[_0x2a63('0xa3')](_0x25cfa2[_0x2a63('0x53')]['id']['toString'](),'VoiceQueueId')['field'](_0x2a63('0xa4'),_0x2a63('0x60'))[_0x2a63('0xa3')]('NOW()','updatedAt')[_0x2a63('0x85')](_0x2a63('0xaf'))[_0x2a63('0x4b')](_0x2a63('0xb0'))[_0x2a63('0x4b')](_0x2a63('0xb1'),_0x21530a[_0x2a63('0xa5')][_0x2a63('0xa6')]())[_0x2a63('0x4b')]('phone\x20IS\x20NOT\x20NULL')[_0x2a63('0x4b')](_0x2a63('0xa9'),squel[_0x2a63('0xa2')]()['field']('COALESCE(phone,\x27\x27)')[_0x2a63('0x85')]('cm_hopper')[_0x2a63('0x4b')](_0x2a63('0x89'),_0x25cfa2[_0x2a63('0x53')]['id'][_0x2a63('0xa6')]())))[_0x2a63('0xa6')]();break;default:_0x2df2c9=squel[_0x2a63('0xac')]()[_0x2a63('0xad')]('cm_hopper')[_0x2a63('0xae')]([_0x2a63('0x9f'),_0x2a63('0xa0'),_0x2a63('0xa1'),'ListId',_0x2a63('0x65'),_0x2a63('0x60'),'updatedAt'],squel[_0x2a63('0xa2')]()[_0x2a63('0xa3')](_0x2a63('0x9f'),_0x2a63('0x9f'))[_0x2a63('0xa3')]('NOW()','scheduledAt')['field']('id','ContactId')['field'](_0x21530a[_0x2a63('0xa5')][_0x2a63('0xa6')](),_0x2a63('0xa7'))[_0x2a63('0xa3')](_0x25cfa2[_0x2a63('0x53')]['id'][_0x2a63('0xa6')](),_0x2a63('0x65'))[_0x2a63('0xa3')](_0x2a63('0xa4'),_0x2a63('0x60'))[_0x2a63('0xa3')](_0x2a63('0xa4'),'updatedAt')['from'](_0x2a63('0xaf'))[_0x2a63('0x4b')](_0x2a63('0xb0'))[_0x2a63('0x4b')](_0x2a63('0xb1'),_0x21530a[_0x2a63('0xa5')][_0x2a63('0xa6')]())[_0x2a63('0x4b')](_0x2a63('0xa8')))[_0x2a63('0xa6')]();}_0x473929[_0x2a63('0x93')](db['sequelize'][_0x2a63('0x40')](_0x2df2c9));}return BPromise['all'](_0x473929);}})[_0x2a63('0x28')](function(){return _0x487d74;})[_0x2a63('0x28')](respondWithResult(_0x3ef4ae,null))[_0x2a63('0x55')](handleError(_0x3ef4ae,null));};exports[_0x2a63('0xb2')]=function(_0x52f188,_0x58136b,_0x708e80){return db[_0x2a63('0x3b')]['find']({'where':{'id':_0x52f188[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x58136b,null))[_0x2a63('0x28')](function(_0x1eb828){if(_0x1eb828){return _0x1eb828[_0x2a63('0xb2')](_0x52f188[_0x2a63('0x40')][_0x2a63('0x84')]);}})[_0x2a63('0x28')](function(_0xa38c81){if(_0xa38c81){return db[_0x2a63('0x63')][_0x2a63('0x27')]({'where':{'ListId':_0x52f188[_0x2a63('0x40')][_0x2a63('0x84')],'VoiceQueueId':_0x52f188['params']['id']}})[_0x2a63('0x28')](function(){return _0xa38c81;});}})['then'](respondWithStatusCode(_0x58136b,null))[_0x2a63('0x55')](handleError(_0x58136b,null));};exports['getBlackLists']=function(_0x4b5fde,_0x3b2b80,_0x11f298){var _0x13bda1={};var _0x1e4a47={};var _0x130612;var _0xc0f4ea;return db[_0x2a63('0x3b')][_0x2a63('0x68')]({'where':{'id':_0x4b5fde[_0x2a63('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b2b80,null))[_0x2a63('0x28')](function(_0x532253){if(_0x532253){_0x130612=_0x532253;_0x1e4a47[_0x2a63('0x3f')]=_['keys'](db[_0x2a63('0x99')][_0x2a63('0x3c')]);_0x1e4a47[_0x2a63('0x40')]=_[_0x2a63('0x41')](_0x4b5fde[_0x2a63('0x40')]);_0x1e4a47[_0x2a63('0x42')]=_[_0x2a63('0x43')](_0x1e4a47['model'],_0x1e4a47[_0x2a63('0x40')]);_0x13bda1[_0x2a63('0x44')]=_[_0x2a63('0x43')](_0x1e4a47['model'],qs[_0x2a63('0x45')](_0x4b5fde[_0x2a63('0x40')]['fields']));_0x13bda1[_0x2a63('0x44')]=_0x13bda1[_0x2a63('0x44')][_0x2a63('0x46')]?_0x13bda1[_0x2a63('0x44')]:_0x1e4a47[_0x2a63('0x3f')];_0x13bda1['order']=qs['sort'](_0x4b5fde['query'][_0x2a63('0x4a')]);_0x13bda1['where']=qs[_0x2a63('0x42')](_[_0x2a63('0x4c')](_0x4b5fde[_0x2a63('0x40')],_0x1e4a47[_0x2a63('0x42')]));if(_0x4b5fde[_0x2a63('0x40')]['filter']){_0x13bda1['where']=_[_0x2a63('0x4d')](_0x13bda1[_0x2a63('0x4b')],{'$or':_[_0x2a63('0x30')](_0x13bda1['attributes'],function(_0x5ee5b9){var _0x5ebe85={};_0x5ebe85[_0x5ee5b9]={'$like':'%'+_0x4b5fde[_0x2a63('0x40')][_0x2a63('0x2e')]+'%'};return _0x5ebe85;})});}_0x13bda1=_[_0x2a63('0x4d')]({},_0x13bda1,_0x4b5fde['options']);return _0x130612['getBlackLists'](_0x13bda1);}})['then'](function(_0x4bdcf6){if(_0x4bdcf6){_0xc0f4ea=_0x4bdcf6[_0x2a63('0x46')];if(!_0x4b5fde[_0x2a63('0x40')][_0x2a63('0x64')](_0x2a63('0x47'))){_0x13bda1[_0x2a63('0x48')]=qs[_0x2a63('0x48')](_0x4b5fde['query'][_0x2a63('0x48')]);_0x13bda1['offset']=qs[_0x2a63('0x23')](_0x4b5fde[_0x2a63('0x40')][_0x2a63('0x23')]);}return _0x130612[_0x2a63('0xb3')](_0x13bda1);}})[_0x2a63('0x28')](function(_0x3aad2a){if(_0x3aad2a){return _0x3aad2a?{'count':_0xc0f4ea,'rows':_0x3aad2a}:null;}})[_0x2a63('0x28')](respondWithResult(_0x3b2b80,null))[_0x2a63('0x55')](handleError(_0x3b2b80,null));};exports[_0x2a63('0xb4')]=function(_0x24f8ea,_0x4f9187,_0xe9bc85){var _0x4f619e,_0x482c6b;return db[_0x2a63('0x3b')][_0x2a63('0x34')]({'where':{'id':_0x24f8ea[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x4f9187,null))[_0x2a63('0x28')](function(_0x427683){if(_0x427683){_0x482c6b=_0x427683;return _0x427683['addBlackLists'](_0x24f8ea['body'][_0x2a63('0x84')],_[_0x2a63('0x5f')](_0x24f8ea[_0x2a63('0x57')],[_0x2a63('0x84'),'id'])||{});}return null;})[_0x2a63('0x9b')](function(_0x4f84ad){var _0x324dfd;_0x4f619e=_0x4f84ad||[];var _0x3b956d=[];if(_0x4f84ad){for(var _0x52cb01=0x0;_0x52cb01<_0x4f84ad[_0x2a63('0x46')];_0x52cb01+=0x1){var _0xc001cc=_0x4f84ad[_0x52cb01][_0x2a63('0x29')]({'plain':!![]});_0x324dfd=squel[_0x2a63('0xac')]()[_0x2a63('0xad')](_0x2a63('0xb5'))[_0x2a63('0xae')]([_0x2a63('0x9f'),_0x2a63('0xa1'),_0x2a63('0xa7'),_0x2a63('0x65'),_0x2a63('0x60'),_0x2a63('0x61')],squel[_0x2a63('0xa2')]()['field']('phone',_0x2a63('0x9f'))['field']('id','ContactId')[_0x2a63('0xa3')](_0xc001cc['CmListId'][_0x2a63('0xa6')](),'ListId')[_0x2a63('0xa3')](_0x24f8ea[_0x2a63('0x53')]['id'][_0x2a63('0xa6')](),_0x2a63('0x65'))[_0x2a63('0xa3')](_0x2a63('0xa4'),'createdAt')[_0x2a63('0xa3')]('NOW()',_0x2a63('0x61'))[_0x2a63('0x85')](_0x2a63('0xaf'))[_0x2a63('0x4b')]('deletedAt\x20IS\x20NULL')[_0x2a63('0x4b')](_0x2a63('0xb1'),_0xc001cc['CmListId'][_0x2a63('0xa6')]())[_0x2a63('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0x2a63('0xa6')]();_0x3b956d[_0x2a63('0x93')](db[_0x2a63('0x79')][_0x2a63('0x40')](_0x324dfd));}return BPromise['all'](_0x3b956d);}})[_0x2a63('0x28')](function(){return _0x4f619e;})['then'](respondWithResult(_0x4f9187,null))[_0x2a63('0x55')](handleError(_0x4f9187,null));};exports[_0x2a63('0xb6')]=function(_0x5cd250,_0x4e56b0,_0x7f850){return db['VoiceQueue'][_0x2a63('0x34')]({'where':{'id':_0x5cd250[_0x2a63('0x53')]['id']}})[_0x2a63('0x28')](handleEntityNotFound(_0x4e56b0,null))['then'](function(_0x5d6b9e){if(_0x5d6b9e){return _0x5d6b9e[_0x2a63('0xb6')](_0x5cd250['query'][_0x2a63('0x84')]);}})[_0x2a63('0x28')](function(_0x2f9a47){if(_0x2f9a47){return db[_0x2a63('0x6c')]['destroy']({'where':{'ListId':_0x5cd250[_0x2a63('0x40')]['ids'],'VoiceQueueId':_0x5cd250[_0x2a63('0x53')]['id']}})['then'](function(){return _0x2f9a47;});}})[_0x2a63('0x28')](respondWithStatusCode(_0x4e56b0,null))[_0x2a63('0x55')](handleError(_0x4e56b0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 7cf3a8b..4e0ad20 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 _0x1b5e=['VoiceQueue','save','update','emit','hook','exports','events'];(function(_0x4bf3a7,_0x5d756b){var _0x58c9cc=function(_0x13c6c9){while(--_0x13c6c9){_0x4bf3a7['push'](_0x4bf3a7['shift']());}};_0x58c9cc(++_0x5d756b);}(_0x1b5e,0x1b1));var _0xe1b5=function(_0x4265bb,_0x18e130){_0x4265bb=_0x4265bb-0x0;var _0x316c1d=_0x1b5e[_0x4265bb];return _0x316c1d;};'use strict';var EventEmitter=require(_0xe1b5('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xe1b5('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe1b5('0x2'),'afterUpdate':_0xe1b5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x26c0c6){return function(_0x52dcd5,_0x4efdb8,_0x2a772a){VoiceQueueEvents['emit'](_0x26c0c6+':'+_0x52dcd5['id'],_0x52dcd5);VoiceQueueEvents[_0xe1b5('0x4')](_0x26c0c6,_0x52dcd5);_0x2a772a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xe1b5('0x5')](e,emitEvent(event));}}module[_0xe1b5('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0xac96=['emit','hasOwnProperty','hook','exports','events','VoiceQueue','save','update','remove'];(function(_0x1ba19c,_0x3975e2){var _0x4e069b=function(_0xd95964){while(--_0xd95964){_0x1ba19c['push'](_0x1ba19c['shift']());}};_0x4e069b(++_0x3975e2);}(_0xac96,0xd3));var _0x6ac9=function(_0x4ee0f4,_0x535766){_0x4ee0f4=_0x4ee0f4-0x0;var _0xe402e0=_0xac96[_0x4ee0f4];return _0xe402e0;};'use strict';var EventEmitter=require(_0x6ac9('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x6ac9('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6ac9('0x2'),'afterUpdate':_0x6ac9('0x3'),'afterDestroy':_0x6ac9('0x4')};function emitEvent(_0x3e6ca9){return function(_0x5ada38,_0x4513e6,_0x26300a){VoiceQueueEvents[_0x6ac9('0x5')](_0x3e6ca9+':'+_0x5ada38['id'],_0x5ada38);VoiceQueueEvents[_0x6ac9('0x5')](_0x3e6ca9,_0x5ada38);_0x26300a(null);};}for(var e in events){if(events[_0x6ac9('0x6')](e)){var event=events[e];VoiceQueue[_0x6ac9('0x7')](e,emitEvent(event));}}module[_0x6ac9('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index aa2eea3..1818987 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 _0x89d6=['request-promise','path','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment'];(function(_0x10f967,_0x28917b){var _0x4022e1=function(_0x134224){while(--_0x134224){_0x10f967['push'](_0x10f967['shift']());}};_0x4022e1(++_0x28917b);}(_0x89d6,0xa4));var _0x689d=function(_0x28cd9c,_0x57c79e){_0x28cd9c=_0x28cd9c-0x0;var _0x39b7c4=_0x89d6[_0x28cd9c];return _0x39b7c4;};'use strict';var _=require(_0x689d('0x0'));var util=require('util');var logger=require(_0x689d('0x1'))(_0x689d('0x2'));var moment=require(_0x689d('0x3'));var BPromise=require('bluebird');var rp=require(_0x689d('0x4'));var fs=require('fs');var path=require(_0x689d('0x5'));var rimraf=require('rimraf');var config=require(_0x689d('0x6'));var attributes=require(_0x689d('0x7'));module[_0x689d('0x8')]=function(_0x255d66,_0x2a36df){return _0x255d66[_0x689d('0x9')](_0x689d('0xa'),attributes,{'tableName':_0x689d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x075b=['path','rimraf','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x075b,0x11b));var _0xb075=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x075b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb075('0x0'));var util=require(_0xb075('0x1'));var logger=require(_0xb075('0x2'))(_0xb075('0x3'));var moment=require(_0xb075('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb075('0x5'));var rimraf=require(_0xb075('0x6'));var config=require('../../config/environment');var attributes=require(_0xb075('0x7'));module[_0xb075('0x8')]=function(_0x1a8cf4,_0x3010dc){return _0x1a8cf4[_0xb075('0x9')](_0xb075('0xa'),attributes,{'tableName':_0xb075('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 739995a..4995746 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 _0x20d6=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','VoiceQueue','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','catch','ShowVoiceQueue','find','lodash','util'];(function(_0x1e0aaf,_0xdb3209){var _0x23c16e=function(_0x1948e1){while(--_0x1948e1){_0x1e0aaf['push'](_0x1e0aaf['shift']());}};_0x23c16e(++_0xdb3209);}(_0x20d6,0x76));var _0x620d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x20d6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var moment=require(_0x620d('0x2'));var BPromise=require(_0x620d('0x3'));var rs=require(_0x620d('0x4'));var fs=require('fs');var Redis=require(_0x620d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x620d('0x6'));var logger=require(_0x620d('0x7'))('rpc');var config=require(_0x620d('0x8'));var jayson=require(_0x620d('0x9'));var client=jayson['client'][_0x620d('0xa')]({'port':0x232a});config[_0x620d('0xb')]=_[_0x620d('0xc')](config[_0x620d('0xb')],{'host':_0x620d('0xd'),'port':0x18eb});var socket=require(_0x620d('0xe'))(new Redis(config['redis']));require(_0x620d('0xf'))['register'](socket);function respondWithRpcPromise(_0x3a9d12,_0x5a1f5c,_0x5930f3){return new BPromise(function(_0x2634d5,_0x5ea0cf){return client['request'](_0x3a9d12,_0x5930f3)[_0x620d('0x10')](function(_0x343359){logger[_0x620d('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x5a1f5c,_0x620d('0x12'));logger[_0x620d('0x13')](_0x620d('0x14'),_0x5a1f5c,_0x620d('0x12'),JSON[_0x620d('0x15')](_0x343359));if(_0x343359[_0x620d('0x16')]){if(_0x343359[_0x620d('0x16')][_0x620d('0x17')]===0x1f4){logger[_0x620d('0x16')](_0x620d('0x18'),_0x5a1f5c,_0x343359[_0x620d('0x16')][_0x620d('0x19')]);return _0x5ea0cf(_0x343359['error'][_0x620d('0x19')]);}logger[_0x620d('0x16')](_0x620d('0x18'),_0x5a1f5c,_0x343359[_0x620d('0x16')][_0x620d('0x19')]);return _0x2634d5(_0x343359['error'][_0x620d('0x19')]);}else{logger['info'](_0x620d('0x18'),_0x5a1f5c,_0x620d('0x12'));_0x2634d5(_0x343359[_0x620d('0x1a')][_0x620d('0x19')]);}})['catch'](function(_0x1e6bbd){logger[_0x620d('0x16')](_0x620d('0x18'),_0x5a1f5c,_0x1e6bbd);_0x5ea0cf(_0x1e6bbd);});});}exports['GetVoiceQueue']=function(_0x5876fe){var _0x22ae04=this;return new Promise(function(_0x5b2adc,_0x45d4e7){return db[_0x620d('0x1b')]['findAll']({'raw':_0x5876fe[_0x620d('0x1c')]?_0x5876fe[_0x620d('0x1c')][_0x620d('0x1d')]===undefined?!![]:![]:!![],'where':_0x5876fe[_0x620d('0x1c')]?_0x5876fe[_0x620d('0x1c')][_0x620d('0x1e')]||null:null,'attributes':_0x5876fe[_0x620d('0x1c')]?_0x5876fe[_0x620d('0x1c')][_0x620d('0x1f')]||null:null,'limit':_0x5876fe[_0x620d('0x1c')]?_0x5876fe['options'][_0x620d('0x20')]||null:null,'include':_0x5876fe[_0x620d('0x1c')]?_0x5876fe[_0x620d('0x1c')][_0x620d('0x21')]?_[_0x620d('0x22')](_0x5876fe[_0x620d('0x1c')][_0x620d('0x21')],function(_0xa75ea1){return{'model':db[_0xa75ea1[_0x620d('0x23')]],'as':_0xa75ea1['as'],'attributes':_0xa75ea1['attributes'],'include':_0xa75ea1[_0x620d('0x21')]?_['map'](_0xa75ea1[_0x620d('0x21')],function(_0x133238){return{'model':db[_0x133238[_0x620d('0x23')]],'as':_0x133238['as'],'attributes':_0x133238[_0x620d('0x1f')],'include':_0x133238['include']?_[_0x620d('0x22')](_0x133238['include'],function(_0x433c48){return{'model':db[_0x433c48[_0x620d('0x23')]],'as':_0x433c48['as'],'attributes':_0x433c48[_0x620d('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d2e98){logger[_0x620d('0x11')](_0x620d('0x24'),_0x5876fe);logger['debug'](_0x620d('0x24'),_0x5876fe,JSON[_0x620d('0x15')](_0x1d2e98));_0x5b2adc(_0x1d2e98);})[_0x620d('0x25')](function(_0x3d92b9){logger[_0x620d('0x16')]('GetVoiceQueue',_0x3d92b9['message'],_0x5876fe);_0x45d4e7(_0x22ae04[_0x620d('0x16')](0x1f4,_0x3d92b9[_0x620d('0x19')]));});});};exports[_0x620d('0x26')]=function(_0x303395){var _0x444ece=this;return new Promise(function(_0x1c5fe9,_0x4f83d0){return db['VoiceQueue'][_0x620d('0x27')]({'raw':_0x303395[_0x620d('0x1c')]?_0x303395['options'][_0x620d('0x1d')]===undefined?!![]:![]:!![],'where':_0x303395[_0x620d('0x1c')]?_0x303395[_0x620d('0x1c')]['where']||null:null,'attributes':_0x303395[_0x620d('0x1c')]?_0x303395[_0x620d('0x1c')]['attributes']||null:null,'include':_0x303395[_0x620d('0x1c')]?_0x303395[_0x620d('0x1c')][_0x620d('0x21')]?_['map'](_0x303395[_0x620d('0x1c')][_0x620d('0x21')],function(_0x68ca6e){return{'model':db[_0x68ca6e[_0x620d('0x23')]],'as':_0x68ca6e['as'],'attributes':_0x68ca6e['attributes'],'include':_0x68ca6e[_0x620d('0x21')]?_['map'](_0x68ca6e['include'],function(_0x2d527b){return{'model':db[_0x2d527b[_0x620d('0x23')]],'as':_0x2d527b['as'],'attributes':_0x2d527b[_0x620d('0x1f')],'include':_0x2d527b[_0x620d('0x21')]?_[_0x620d('0x22')](_0x2d527b[_0x620d('0x21')],function(_0x4b908e){return{'model':db[_0x4b908e[_0x620d('0x23')]],'as':_0x4b908e['as'],'attributes':_0x4b908e[_0x620d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x620d('0x10')](function(_0x4c9c62){logger['info'](_0x620d('0x26'),_0x303395);logger['debug']('ShowVoiceQueue',_0x303395,JSON['stringify'](_0x4c9c62));_0x1c5fe9(_0x4c9c62);})[_0x620d('0x25')](function(_0x453013){logger[_0x620d('0x16')](_0x620d('0x26'),_0x453013[_0x620d('0x19')],_0x303395);_0x4f83d0(_0x444ece[_0x620d('0x16')](0x1f4,_0x453013[_0x620d('0x19')]));});});}; \ No newline at end of file +var _0x1a49=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue','findAll','options','attributes','limit','include','model','map','VoiceQueue','find','where','debug','ShowVoiceQueue','lodash'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x1a49,0x1c6));var _0x91a4=function(_0x5eae36,_0xef9a7){_0x5eae36=_0x5eae36-0x0;var _0x5acb40=_0x1a49[_0x5eae36];return _0x5acb40;};'use strict';var _=require(_0x91a4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x91a4('0x1'));var fs=require('fs');var Redis=require(_0x91a4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x91a4('0x3'));var logger=require('../../config/logger')(_0x91a4('0x4'));var config=require(_0x91a4('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x91a4('0x6')]({'port':0x232a});config[_0x91a4('0x7')]=_[_0x91a4('0x8')](config[_0x91a4('0x7')],{'host':_0x91a4('0x9'),'port':0x18eb});var socket=require(_0x91a4('0xa'))(new Redis(config[_0x91a4('0x7')]));require('./voiceQueue.socket')[_0x91a4('0xb')](socket);function respondWithRpcPromise(_0x4775f6,_0x2bf075,_0x124c95){return new BPromise(function(_0x37ace0,_0x30880a){return client['request'](_0x4775f6,_0x124c95)[_0x91a4('0xc')](function(_0x5b9cc4){logger[_0x91a4('0xd')](_0x91a4('0xe'),_0x2bf075,_0x91a4('0xf'));logger['debug'](_0x91a4('0x10'),_0x2bf075,_0x91a4('0xf'),JSON[_0x91a4('0x11')](_0x5b9cc4));if(_0x5b9cc4[_0x91a4('0x12')]){if(_0x5b9cc4[_0x91a4('0x12')]['code']===0x1f4){logger[_0x91a4('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x2bf075,_0x5b9cc4[_0x91a4('0x12')][_0x91a4('0x13')]);return _0x30880a(_0x5b9cc4['error'][_0x91a4('0x13')]);}logger[_0x91a4('0x12')](_0x91a4('0xe'),_0x2bf075,_0x5b9cc4[_0x91a4('0x12')][_0x91a4('0x13')]);return _0x37ace0(_0x5b9cc4[_0x91a4('0x12')][_0x91a4('0x13')]);}else{logger[_0x91a4('0xd')]('VoiceQueue,\x20%s,\x20%s',_0x2bf075,_0x91a4('0xf'));_0x37ace0(_0x5b9cc4[_0x91a4('0x14')][_0x91a4('0x13')]);}})[_0x91a4('0x15')](function(_0x22ac12){logger[_0x91a4('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x2bf075,_0x22ac12);_0x30880a(_0x22ac12);});});}exports[_0x91a4('0x16')]=function(_0x3bf608){var _0xab24cd=this;return new Promise(function(_0x5c9ec2,_0x5c1596){return db['VoiceQueue'][_0x91a4('0x17')]({'raw':_0x3bf608[_0x91a4('0x18')]?_0x3bf608['options']['raw']===undefined?!![]:![]:!![],'where':_0x3bf608['options']?_0x3bf608[_0x91a4('0x18')]['where']||null:null,'attributes':_0x3bf608[_0x91a4('0x18')]?_0x3bf608['options'][_0x91a4('0x19')]||null:null,'limit':_0x3bf608[_0x91a4('0x18')]?_0x3bf608[_0x91a4('0x18')][_0x91a4('0x1a')]||null:null,'include':_0x3bf608['options']?_0x3bf608['options']['include']?_['map'](_0x3bf608[_0x91a4('0x18')][_0x91a4('0x1b')],function(_0x53903c){return{'model':db[_0x53903c[_0x91a4('0x1c')]],'as':_0x53903c['as'],'attributes':_0x53903c[_0x91a4('0x19')],'include':_0x53903c[_0x91a4('0x1b')]?_['map'](_0x53903c[_0x91a4('0x1b')],function(_0x5b0aa6){return{'model':db[_0x5b0aa6[_0x91a4('0x1c')]],'as':_0x5b0aa6['as'],'attributes':_0x5b0aa6['attributes'],'include':_0x5b0aa6[_0x91a4('0x1b')]?_[_0x91a4('0x1d')](_0x5b0aa6[_0x91a4('0x1b')],function(_0x2b57af){return{'model':db[_0x2b57af[_0x91a4('0x1c')]],'as':_0x2b57af['as'],'attributes':_0x2b57af['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f1984){logger[_0x91a4('0xd')](_0x91a4('0x16'),_0x3bf608);logger['debug']('GetVoiceQueue',_0x3bf608,JSON['stringify'](_0x5f1984));_0x5c9ec2(_0x5f1984);})['catch'](function(_0x5ca54b){logger['error'](_0x91a4('0x16'),_0x5ca54b[_0x91a4('0x13')],_0x3bf608);_0x5c1596(_0xab24cd[_0x91a4('0x12')](0x1f4,_0x5ca54b[_0x91a4('0x13')]));});});};exports['ShowVoiceQueue']=function(_0x2b9b38){var _0x257c6a=this;return new Promise(function(_0x31b473,_0x457583){return db[_0x91a4('0x1e')][_0x91a4('0x1f')]({'raw':_0x2b9b38['options']?_0x2b9b38[_0x91a4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2b9b38[_0x91a4('0x18')]?_0x2b9b38['options'][_0x91a4('0x20')]||null:null,'attributes':_0x2b9b38[_0x91a4('0x18')]?_0x2b9b38['options']['attributes']||null:null,'include':_0x2b9b38[_0x91a4('0x18')]?_0x2b9b38['options']['include']?_[_0x91a4('0x1d')](_0x2b9b38[_0x91a4('0x18')]['include'],function(_0x44592d){return{'model':db[_0x44592d['model']],'as':_0x44592d['as'],'attributes':_0x44592d[_0x91a4('0x19')],'include':_0x44592d[_0x91a4('0x1b')]?_[_0x91a4('0x1d')](_0x44592d['include'],function(_0x555a9a){return{'model':db[_0x555a9a[_0x91a4('0x1c')]],'as':_0x555a9a['as'],'attributes':_0x555a9a[_0x91a4('0x19')],'include':_0x555a9a['include']?_[_0x91a4('0x1d')](_0x555a9a['include'],function(_0x1546da){return{'model':db[_0x1546da['model']],'as':_0x1546da['as'],'attributes':_0x1546da[_0x91a4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x91a4('0xc')](function(_0x1963c9){logger[_0x91a4('0xd')]('ShowVoiceQueue',_0x2b9b38);logger[_0x91a4('0x21')](_0x91a4('0x22'),_0x2b9b38,JSON[_0x91a4('0x11')](_0x1963c9));_0x31b473(_0x1963c9);})[_0x91a4('0x15')](function(_0x376079){logger['error'](_0x91a4('0x22'),_0x376079[_0x91a4('0x13')],_0x2b9b38);_0x457583(_0x257c6a[_0x91a4('0x12')](0x1f4,_0x376079[_0x91a4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 60cb324..a966b67 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 _0x2e26=['emit','removeListener','register','voiceQueue:','./voiceQueue.events','remove','update'];(function(_0x4f2cb,_0xd72207){var _0x1e895b=function(_0x28f350){while(--_0x28f350){_0x4f2cb['push'](_0x4f2cb['shift']());}};_0x1e895b(++_0xd72207);}(_0x2e26,0xc1));var _0x62e2=function(_0xa5bd5b,_0x5294d9){_0xa5bd5b=_0xa5bd5b-0x0;var _0x340535=_0x2e26[_0xa5bd5b];return _0x340535;};'use strict';var VoiceQueueEvents=require(_0x62e2('0x0'));var events=['save',_0x62e2('0x1'),_0x62e2('0x2')];function createListener(_0x360796,_0x508c97){return function(_0x951572){_0x508c97[_0x62e2('0x3')](_0x360796,_0x951572);};}function removeListener(_0x122d09,_0x5b1534){return function(){VoiceQueueEvents[_0x62e2('0x4')](_0x122d09,_0x5b1534);};}exports[_0x62e2('0x5')]=function(_0x506b03){for(var _0x291001=0x0,_0x52c7b9=events['length'];_0x291001<_0x52c7b9;_0x291001++){var _0x1efc88=events[_0x291001];var _0x3c53cb=createListener(_0x62e2('0x6')+_0x1efc88,_0x506b03);VoiceQueueEvents['on'](_0x1efc88,_0x3c53cb);}}; \ No newline at end of file +var _0xf8fb=['voiceQueue:','./voiceQueue.events','save','remove','update','emit','register'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf8fb,0xd3));var _0xbf8f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf8fb[_0x2641f9];return _0x585741;};'use strict';var VoiceQueueEvents=require(_0xbf8f('0x0'));var events=[_0xbf8f('0x1'),_0xbf8f('0x2'),_0xbf8f('0x3')];function createListener(_0x294f0a,_0x1868fa){return function(_0x156512){_0x1868fa[_0xbf8f('0x4')](_0x294f0a,_0x156512);};}function removeListener(_0x2cbfd0,_0x1a9836){return function(){VoiceQueueEvents['removeListener'](_0x2cbfd0,_0x1a9836);};}exports[_0xbf8f('0x5')]=function(_0x2b15b9){for(var _0xe08549=0x0,_0x4c78c0=events['length'];_0xe08549<_0x4c78c0;_0xe08549++){var _0xb43b2d=events[_0xe08549];var _0x331b7=createListener(_0xbf8f('0x6')+_0xb43b2d,_0x2b15b9);VoiceQueueEvents['on'](_0xb43b2d,_0x331b7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index be5a94e..2161d33 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 _0x444e=['index','getVoiceQueuesReport','show','post','create','delete','/:id','destroy','multer','path','express','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated'];(function(_0x3c0051,_0x4b3d5d){var _0x654720=function(_0x368414){while(--_0x368414){_0x3c0051['push'](_0x3c0051['shift']());}};_0x654720(++_0x4b3d5d);}(_0x444e,0xe8));var _0xe444=function(_0x212deb,_0x360d11){_0x212deb=_0x212deb-0x0;var _0x2ce4c4=_0x444e[_0x212deb];return _0x2ce4c4;};'use strict';var multer=require(_0xe444('0x0'));var util=require('util');var path=require(_0xe444('0x1'));var timeout=require('connect-timeout');var express=require(_0xe444('0x2'));var router=express['Router']();var auth=require(_0xe444('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe444('0x4'));var controller=require(_0xe444('0x5'));router[_0xe444('0x6')]('/',auth[_0xe444('0x7')](),controller[_0xe444('0x8')]);router[_0xe444('0x6')]('/describe',auth[_0xe444('0x7')](),controller['describe']);router[_0xe444('0x6')]('/index',auth[_0xe444('0x7')](),controller[_0xe444('0x9')]);router[_0xe444('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xe444('0xa')]);router[_0xe444('0xb')]('/',auth['isAuthenticated'](),controller[_0xe444('0xc')]);router['put']('/:id',auth[_0xe444('0x7')](),controller['update']);router[_0xe444('0xd')](_0xe444('0xe'),auth['isAuthenticated'](),controller[_0xe444('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5a5a=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','isAuthenticated','describe','/index','/:id','show','post','create','put','update'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x538c70,_0x35531f){_0x538c70=_0x538c70-0x0;var _0x42ae01=_0x5a5a[_0x538c70];return _0x42ae01;};'use strict';var multer=require('multer');var util=require(_0xa5a5('0x0'));var path=require(_0xa5a5('0x1'));var timeout=require(_0xa5a5('0x2'));var express=require(_0xa5a5('0x3'));var router=express[_0xa5a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa5a5('0x5'));var config=require(_0xa5a5('0x6'));var controller=require(_0xa5a5('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa5a5('0x8')]);router[_0xa5a5('0x9')]('/describe',auth[_0xa5a5('0xa')](),controller[_0xa5a5('0xb')]);router[_0xa5a5('0x9')](_0xa5a5('0xc'),auth[_0xa5a5('0xa')](),controller['getVoiceQueuesReport']);router[_0xa5a5('0x9')](_0xa5a5('0xd'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0xe')]);router[_0xa5a5('0xf')]('/',auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x10')]);router[_0xa5a5('0x11')](_0xa5a5('0xd'),auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x12')]);router[_0xa5a5('0x13')]('/:id',auth[_0xa5a5('0xa')](),controller[_0xa5a5('0x14')]);module[_0xa5a5('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 a663fbb..4786aed 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 _0x78d2=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','DATE'];(function(_0x37fb83,_0x11fa4c){var _0x429520=function(_0x341e19){while(--_0x341e19){_0x37fb83['push'](_0x37fb83['shift']());}};_0x429520(++_0x11fa4c);}(_0x78d2,0xdf));var _0x278d=function(_0x1915e2,_0x51f382){_0x1915e2=_0x1915e2-0x0;var _0x550ab2=_0x78d2[_0x1915e2];return _0x550ab2;};'use strict';var Sequelize=require(_0x278d('0x0'));var moment=require(_0x278d('0x1'));module[_0x278d('0x2')]={'type':{'type':Sequelize[_0x278d('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x278d('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x1c5f52){var _0x4c9354=moment(_0x1c5f52);var _0x458841=moment(this[_0x278d('0x4')]('queuecallerjoinAt'))[_0x278d('0x5')](_0x278d('0x6'));var _0x2729c8=_0x4c9354[_0x278d('0x7')](_0x458841,_0x278d('0x8'));this[_0x278d('0x9')](_0x278d('0xa'),_0x1c5f52);this[_0x278d('0x9')](_0x278d('0xb'),_0x2729c8||null);}},'position':{'type':Sequelize[_0x278d('0xc')]},'count':{'type':Sequelize[_0x278d('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x278d('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x278d('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x278d('0xe')]},'queuecallerexit':{'type':Sequelize[_0x278d('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x278d('0x3')],'comment':_0x278d('0xf')},'originalposition':{'type':Sequelize[_0x278d('0xc')]},'channel':{'type':Sequelize[_0x278d('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x278d('0x3')]},'accountcode':{'type':Sequelize[_0x278d('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x278d('0x3')]},'priority':{'type':Sequelize[_0x278d('0x3')]},'holdtime':{'type':Sequelize[_0x278d('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x278d('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x278d('0x3')]},'transfer':{'type':Sequelize[_0x278d('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x278d('0x3')],'comment':_0x278d('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x278d('0x3')]},'disposition':{'type':Sequelize[_0x278d('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x278d('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc2b6=['diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1817bd,_0x4a5667){var _0x5f52f9=function(_0x4b0d57){while(--_0x4b0d57){_0x1817bd['push'](_0x1817bd['shift']());}};_0x5f52f9(++_0x4a5667);}(_0xc2b6,0x1e8));var _0x6c2b=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xc2b6[_0x489b87];return _0x1823b6;};'use strict';var Sequelize=require(_0x6c2b('0x0'));var moment=require(_0x6c2b('0x1'));module[_0x6c2b('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6c2b('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6c2b('0x3')]},'queue':{'type':Sequelize[_0x6c2b('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6c2b('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6c2b('0x4')],'set':function(_0x575cb4){var _0x2e9f79=moment(_0x575cb4);var _0x3b6db2=moment(this['getDataValue'](_0x6c2b('0x5')))['format'](_0x6c2b('0x6'));var _0x58834b=_0x2e9f79[_0x6c2b('0x7')](_0x3b6db2,_0x6c2b('0x8'));this[_0x6c2b('0x9')](_0x6c2b('0xa'),_0x575cb4);this[_0x6c2b('0x9')]('holdtime',_0x58834b||null);}},'position':{'type':Sequelize[_0x6c2b('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x6c2b('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6c2b('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x6c2b('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6c2b('0x4')]},'queuecallerexit':{'type':Sequelize[_0x6c2b('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6c2b('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6c2b('0x3')],'comment':_0x6c2b('0xd')},'originalposition':{'type':Sequelize[_0x6c2b('0xb')]},'channel':{'type':Sequelize[_0x6c2b('0x3')]},'connectedlinenum':{'type':Sequelize[_0x6c2b('0x3')]},'connectedlinename':{'type':Sequelize[_0x6c2b('0x3')]},'accountcode':{'type':Sequelize[_0x6c2b('0x3')]},'context':{'type':Sequelize[_0x6c2b('0x3')]},'exten':{'type':Sequelize[_0x6c2b('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6c2b('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x6c2b('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6c2b('0x3')],'comment':_0x6c2b('0xe')},'transferexten':{'type':Sequelize[_0x6c2b('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6c2b('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x6c2b('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 55c66a3..e495ecf 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x7a54,0x106));var _0x47a5=function(_0x1225e8,_0x1c8fde){_0x1225e8=_0x1225e8-0x0;var _0x59d75d=_0x7a54[_0x1225e8];return _0x59d75d;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file +var _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(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x7a54,0x106));var _0x47a5=function(_0x4441b7,_0x570698){_0x4441b7=_0x4441b7-0x0;var _0x2b8299=_0x7a54[_0x4441b7];return _0x2b8299;};'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 5565804..b8e03b3 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 _0xef17=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','save'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xef17,0x1be));var _0x7ef1=function(_0x49140d,_0x1bb53a){_0x49140d=_0x49140d-0x0;var _0x5961e2=_0xef17[_0x49140d];return _0x5961e2;};'use strict';var EventEmitter=require(_0x7ef1('0x0'));var VoiceQueueReport=require(_0x7ef1('0x1'))['db'][_0x7ef1('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7ef1('0x3'),'afterUpdate':_0x7ef1('0x4'),'afterDestroy':_0x7ef1('0x5')};function emitEvent(_0x268ed2){return function(_0x127bdc,_0x44634a,_0x5b2518){VoiceQueueReportEvents[_0x7ef1('0x6')](_0x268ed2+':'+_0x127bdc['id'],_0x127bdc);VoiceQueueReportEvents['emit'](_0x268ed2,_0x127bdc);_0x5b2518(null);};}for(var e in events){if(events[_0x7ef1('0x7')](e)){var event=events[e];VoiceQueueReport[_0x7ef1('0x8')](e,emitEvent(event));}}module[_0x7ef1('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x2e4d=['setMaxListeners','save','update','emit','hasOwnProperty','exports','../../mysqldb','VoiceQueueReport'];(function(_0x98abe0,_0x11bf0d){var _0x2e1178=function(_0x398726){while(--_0x398726){_0x98abe0['push'](_0x98abe0['shift']());}};_0x2e1178(++_0x11bf0d);}(_0x2e4d,0x6e));var _0xd2e4=function(_0x1fb7f6,_0x55e073){_0x1fb7f6=_0x1fb7f6-0x0;var _0x173353=_0x2e4d[_0x1fb7f6];return _0x173353;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xd2e4('0x0'))['db'][_0xd2e4('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd2e4('0x2')](0x0);var events={'afterCreate':_0xd2e4('0x3'),'afterUpdate':_0xd2e4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2714f0){return function(_0x16eb4c,_0x4354d7,_0x5d5d96){VoiceQueueReportEvents[_0xd2e4('0x5')](_0x2714f0+':'+_0x16eb4c['id'],_0x16eb4c);VoiceQueueReportEvents[_0xd2e4('0x5')](_0x2714f0,_0x16eb4c);_0x5d5d96(null);};}for(var e in events){if(events[_0xd2e4('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xd2e4('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index e670258..c40d94b 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 _0x4a1c=['path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x175892,_0x4a3e56){var _0x307ab9=function(_0x1d162c){while(--_0x1d162c){_0x175892['push'](_0x175892['shift']());}};_0x307ab9(++_0x4a3e56);}(_0x4a1c,0x140));var _0xc4a1=function(_0x364b32,_0x4dec35){_0x364b32=_0x364b32-0x0;var _0x3f3ea0=_0x4a1c[_0x364b32];return _0x3f3ea0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc4a1('0x0'))(_0xc4a1('0x1'));var moment=require(_0xc4a1('0x2'));var BPromise=require(_0xc4a1('0x3'));var rp=require(_0xc4a1('0x4'));var fs=require('fs');var path=require(_0xc4a1('0x5'));var rimraf=require(_0xc4a1('0x6'));var config=require('../../config/environment');var attributes=require(_0xc4a1('0x7'));module[_0xc4a1('0x8')]=function(_0x3d7243,_0xac2ea){return _0x3d7243[_0xc4a1('0x9')](_0xc4a1('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xc4a1('0xb')]},{'fields':[_0xc4a1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc3d=['uniqueid','calleridnum','lodash','util','../../config/logger','bluebird','request-promise','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue'];(function(_0x1907cd,_0x202496){var _0xc77506=function(_0x1e16a3){while(--_0x1e16a3){_0x1907cd['push'](_0x1907cd['shift']());}};_0xc77506(++_0x202496);}(_0xcc3d,0x146));var _0xdcc3=function(_0x116c2d,_0x2a79ce){_0x116c2d=_0x116c2d-0x0;var _0x3395e1=_0xcc3d[_0x116c2d];return _0x3395e1;};'use strict';var _=require(_0xdcc3('0x0'));var util=require(_0xdcc3('0x1'));var logger=require(_0xdcc3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdcc3('0x3'));var rp=require(_0xdcc3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdcc3('0x5'));module[_0xdcc3('0x6')]=function(_0x231c7e,_0x451ca8){return _0x231c7e[_0xdcc3('0x7')](_0xdcc3('0x8'),attributes,{'tableName':_0xdcc3('0x9'),'paranoid':![],'indexes':[{'fields':[_0xdcc3('0xa')]},{'fields':[_0xdcc3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d8cabe4..c70e6e0 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 _0x8343=['where','attributes','limit','include','map','model','stringify','CreateVoiceQueueReport','body','then','UpdateVoiceQueueReport','update','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options'];(function(_0xb23c05,_0xbb6c8a){var _0xde8542=function(_0x4c096d){while(--_0x4c096d){_0xb23c05['push'](_0xb23c05['shift']());}};_0xde8542(++_0xbb6c8a);}(_0x8343,0x175));var _0x3834=function(_0x2af95d,_0xd602d6){_0x2af95d=_0x2af95d-0x0;var _0x17c87b=_0x8343[_0x2af95d];return _0x17c87b;};'use strict';var _=require(_0x3834('0x0'));var util=require(_0x3834('0x1'));var moment=require(_0x3834('0x2'));var BPromise=require('bluebird');var rs=require(_0x3834('0x3'));var fs=require('fs');var Redis=require(_0x3834('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3834('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3834('0x6'));var client=jayson[_0x3834('0x7')][_0x3834('0x8')]({'port':0x232a});config[_0x3834('0x9')]=_['defaults'](config[_0x3834('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3834('0xa'))(new Redis(config[_0x3834('0x9')]));require(_0x3834('0xb'))[_0x3834('0xc')](socket);function respondWithRpcPromise(_0x28ea6c,_0x1e0031,_0x3fa76c){return new BPromise(function(_0xf1b549,_0x448182){return client[_0x3834('0xd')](_0x28ea6c,_0x3fa76c)['then'](function(_0x1ae1cb){logger[_0x3834('0xe')](_0x3834('0xf'),_0x1e0031,_0x3834('0x10'));logger[_0x3834('0x11')](_0x3834('0x12'),_0x1e0031,_0x3834('0x10'),JSON['stringify'](_0x1ae1cb));if(_0x1ae1cb[_0x3834('0x13')]){if(_0x1ae1cb[_0x3834('0x13')][_0x3834('0x14')]===0x1f4){logger[_0x3834('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x1e0031,_0x1ae1cb['error'][_0x3834('0x15')]);return _0x448182(_0x1ae1cb[_0x3834('0x13')][_0x3834('0x15')]);}logger[_0x3834('0x13')](_0x3834('0xf'),_0x1e0031,_0x1ae1cb[_0x3834('0x13')][_0x3834('0x15')]);return _0xf1b549(_0x1ae1cb[_0x3834('0x13')]['message']);}else{logger[_0x3834('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x1e0031,_0x3834('0x10'));_0xf1b549(_0x1ae1cb['result'][_0x3834('0x15')]);}})[_0x3834('0x16')](function(_0x36c51f){logger[_0x3834('0x13')](_0x3834('0xf'),_0x1e0031,_0x36c51f);_0x448182(_0x36c51f);});});}exports[_0x3834('0x17')]=function(_0x32d848){var _0x315b8f=this;return new Promise(function(_0x492bec,_0x53aaa3){return db[_0x3834('0x18')][_0x3834('0x19')]({'raw':_0x32d848[_0x3834('0x1a')]?_0x32d848['options']['raw']===undefined?!![]:![]:!![],'where':_0x32d848['options']?_0x32d848['options'][_0x3834('0x1b')]||null:null,'attributes':_0x32d848['options']?_0x32d848[_0x3834('0x1a')][_0x3834('0x1c')]||null:null,'limit':_0x32d848[_0x3834('0x1a')]?_0x32d848['options'][_0x3834('0x1d')]||null:null,'include':_0x32d848[_0x3834('0x1a')]?_0x32d848['options'][_0x3834('0x1e')]?_[_0x3834('0x1f')](_0x32d848['options'][_0x3834('0x1e')],function(_0x171862){return{'model':db[_0x171862[_0x3834('0x20')]],'as':_0x171862['as'],'attributes':_0x171862[_0x3834('0x1c')],'include':_0x171862['include']?_[_0x3834('0x1f')](_0x171862[_0x3834('0x1e')],function(_0x1d1022){return{'model':db[_0x1d1022[_0x3834('0x20')]],'as':_0x1d1022['as'],'attributes':_0x1d1022[_0x3834('0x1c')],'include':_0x1d1022[_0x3834('0x1e')]?_['map'](_0x1d1022[_0x3834('0x1e')],function(_0x77a2bd){return{'model':db[_0x77a2bd['model']],'as':_0x77a2bd['as'],'attributes':_0x77a2bd[_0x3834('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b8652){logger[_0x3834('0xe')](_0x3834('0x17'),_0x32d848);logger['debug']('GetVoiceQueueReport',_0x32d848,JSON[_0x3834('0x21')](_0x2b8652));_0x492bec(_0x2b8652);})['catch'](function(_0x432b4c){logger[_0x3834('0x13')](_0x3834('0x17'),_0x432b4c['message'],_0x32d848);_0x53aaa3(_0x315b8f[_0x3834('0x13')](0x1f4,_0x432b4c[_0x3834('0x15')]));});});};exports[_0x3834('0x22')]=function(_0x38dcc4){var _0x555d43=this;return new Promise(function(_0x120594,_0x1f0168){return db['VoiceQueueReport']['create'](_0x38dcc4[_0x3834('0x23')],{'raw':_0x38dcc4['options']?_0x38dcc4['options']['raw']===undefined?!![]:![]:!![]})[_0x3834('0x24')](function(_0x28352f){logger[_0x3834('0xe')](_0x3834('0x22'),_0x38dcc4);logger[_0x3834('0x11')](_0x3834('0x22'),_0x38dcc4,JSON[_0x3834('0x21')](_0x28352f));_0x120594(_0x28352f);})[_0x3834('0x16')](function(_0x3d01ae){logger[_0x3834('0x13')](_0x3834('0x22'),_0x3d01ae[_0x3834('0x15')],_0x38dcc4);_0x1f0168(_0x555d43[_0x3834('0x13')](0x1f4,_0x3d01ae[_0x3834('0x15')]));});});};exports[_0x3834('0x25')]=function(_0x1cfce1){var _0x49a17a=this;return new Promise(function(_0x3570a5,_0x3a7770){return db['VoiceQueueReport'][_0x3834('0x26')](_0x1cfce1[_0x3834('0x23')],{'raw':_0x1cfce1[_0x3834('0x1a')]?_0x1cfce1['options'][_0x3834('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cfce1[_0x3834('0x1a')]?_0x1cfce1['options'][_0x3834('0x1b')]||null:null,'attributes':_0x1cfce1['options']?_0x1cfce1[_0x3834('0x1a')]['attributes']||null:null,'limit':_0x1cfce1[_0x3834('0x1a')]?_0x1cfce1[_0x3834('0x1a')][_0x3834('0x1d')]||null:null})[_0x3834('0x24')](function(_0x1f4357){logger[_0x3834('0xe')](_0x3834('0x25'),_0x1cfce1);logger[_0x3834('0x11')](_0x3834('0x25'),_0x1cfce1,JSON[_0x3834('0x21')](_0x1f4357));_0x3570a5(_0x1f4357);})[_0x3834('0x16')](function(_0x354078){logger[_0x3834('0x13')](_0x3834('0x25'),_0x354078[_0x3834('0x15')],_0x1cfce1);_0x3a7770(_0x49a17a['error'](0x1f4,_0x354078[_0x3834('0x15')]));});});}; \ No newline at end of file +var _0x2dfe=['bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','VoiceQueueReport','options','attributes','map','include','model','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','UpdateVoiceQueueReport','body','raw','where','limit','util'];(function(_0x2253aa,_0x186d8b){var _0x2041f8=function(_0x21f3c0){while(--_0x21f3c0){_0x2253aa['push'](_0x2253aa['shift']());}};_0x2041f8(++_0x186d8b);}(_0x2dfe,0x1d3));var _0xe2df=function(_0x5cb001,_0x408eb8){_0x5cb001=_0x5cb001-0x0;var _0xc90831=_0x2dfe[_0x5cb001];return _0xc90831;};'use strict';var _=require('lodash');var util=require(_0xe2df('0x0'));var moment=require('moment');var BPromise=require(_0xe2df('0x1'));var rs=require(_0xe2df('0x2'));var fs=require('fs');var Redis=require(_0xe2df('0x3'));var db=require(_0xe2df('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe2df('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe2df('0x6')][_0xe2df('0x7')]({'port':0x232a});config['redis']=_[_0xe2df('0x8')](config['redis'],{'host':_0xe2df('0x9'),'port':0x18eb});var socket=require(_0xe2df('0xa'))(new Redis(config[_0xe2df('0xb')]));require(_0xe2df('0xc'))['register'](socket);function respondWithRpcPromise(_0x23e3a7,_0x1c0c54,_0x4753a0){return new BPromise(function(_0x3e7e8d,_0x1263f5){return client[_0xe2df('0xd')](_0x23e3a7,_0x4753a0)[_0xe2df('0xe')](function(_0x32e1df){logger[_0xe2df('0xf')](_0xe2df('0x10'),_0x1c0c54,'request\x20sent');logger[_0xe2df('0x11')](_0xe2df('0x12'),_0x1c0c54,_0xe2df('0x13'),JSON['stringify'](_0x32e1df));if(_0x32e1df[_0xe2df('0x14')]){if(_0x32e1df[_0xe2df('0x14')][_0xe2df('0x15')]===0x1f4){logger[_0xe2df('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x1c0c54,_0x32e1df[_0xe2df('0x14')][_0xe2df('0x16')]);return _0x1263f5(_0x32e1df['error'][_0xe2df('0x16')]);}logger[_0xe2df('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x1c0c54,_0x32e1df[_0xe2df('0x14')][_0xe2df('0x16')]);return _0x3e7e8d(_0x32e1df['error'][_0xe2df('0x16')]);}else{logger[_0xe2df('0xf')](_0xe2df('0x10'),_0x1c0c54,'request\x20sent');_0x3e7e8d(_0x32e1df[_0xe2df('0x17')][_0xe2df('0x16')]);}})[_0xe2df('0x18')](function(_0x158652){logger[_0xe2df('0x14')](_0xe2df('0x10'),_0x1c0c54,_0x158652);_0x1263f5(_0x158652);});});}exports['GetVoiceQueueReport']=function(_0x38167a){var _0x3b09a5=this;return new Promise(function(_0x5d27c5,_0x347137){return db[_0xe2df('0x19')]['findAll']({'raw':_0x38167a[_0xe2df('0x1a')]?_0x38167a[_0xe2df('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x38167a[_0xe2df('0x1a')]?_0x38167a[_0xe2df('0x1a')]['where']||null:null,'attributes':_0x38167a[_0xe2df('0x1a')]?_0x38167a[_0xe2df('0x1a')][_0xe2df('0x1b')]||null:null,'limit':_0x38167a[_0xe2df('0x1a')]?_0x38167a[_0xe2df('0x1a')]['limit']||null:null,'include':_0x38167a[_0xe2df('0x1a')]?_0x38167a[_0xe2df('0x1a')]['include']?_[_0xe2df('0x1c')](_0x38167a[_0xe2df('0x1a')][_0xe2df('0x1d')],function(_0xf77322){return{'model':db[_0xf77322[_0xe2df('0x1e')]],'as':_0xf77322['as'],'attributes':_0xf77322['attributes'],'include':_0xf77322['include']?_[_0xe2df('0x1c')](_0xf77322[_0xe2df('0x1d')],function(_0x3cc68f){return{'model':db[_0x3cc68f[_0xe2df('0x1e')]],'as':_0x3cc68f['as'],'attributes':_0x3cc68f[_0xe2df('0x1b')],'include':_0x3cc68f['include']?_[_0xe2df('0x1c')](_0x3cc68f[_0xe2df('0x1d')],function(_0x5c69e2){return{'model':db[_0x5c69e2[_0xe2df('0x1e')]],'as':_0x5c69e2['as'],'attributes':_0x5c69e2[_0xe2df('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe2df('0xe')](function(_0x168c6b){logger[_0xe2df('0xf')](_0xe2df('0x1f'),_0x38167a);logger['debug']('GetVoiceQueueReport',_0x38167a,JSON[_0xe2df('0x20')](_0x168c6b));_0x5d27c5(_0x168c6b);})[_0xe2df('0x18')](function(_0x5e8c50){logger['error'](_0xe2df('0x1f'),_0x5e8c50[_0xe2df('0x16')],_0x38167a);_0x347137(_0x3b09a5[_0xe2df('0x14')](0x1f4,_0x5e8c50[_0xe2df('0x16')]));});});};exports[_0xe2df('0x21')]=function(_0x44110c){var _0x520960=this;return new Promise(function(_0x45ae7b,_0x220a52){return db[_0xe2df('0x19')]['create'](_0x44110c['body'],{'raw':_0x44110c[_0xe2df('0x1a')]?_0x44110c[_0xe2df('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xe2df('0xe')](function(_0x1e5ce4){logger['info']('CreateVoiceQueueReport',_0x44110c);logger[_0xe2df('0x11')](_0xe2df('0x21'),_0x44110c,JSON[_0xe2df('0x20')](_0x1e5ce4));_0x45ae7b(_0x1e5ce4);})[_0xe2df('0x18')](function(_0x4c8cf2){logger[_0xe2df('0x14')](_0xe2df('0x21'),_0x4c8cf2[_0xe2df('0x16')],_0x44110c);_0x220a52(_0x520960[_0xe2df('0x14')](0x1f4,_0x4c8cf2['message']));});});};exports[_0xe2df('0x22')]=function(_0x5ee8e5){var _0x24d40d=this;return new Promise(function(_0x505210,_0x14f16a){return db[_0xe2df('0x19')]['update'](_0x5ee8e5[_0xe2df('0x23')],{'raw':_0x5ee8e5[_0xe2df('0x1a')]?_0x5ee8e5[_0xe2df('0x1a')][_0xe2df('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ee8e5[_0xe2df('0x1a')]?_0x5ee8e5[_0xe2df('0x1a')][_0xe2df('0x25')]||null:null,'attributes':_0x5ee8e5[_0xe2df('0x1a')]?_0x5ee8e5[_0xe2df('0x1a')][_0xe2df('0x1b')]||null:null,'limit':_0x5ee8e5[_0xe2df('0x1a')]?_0x5ee8e5[_0xe2df('0x1a')][_0xe2df('0x26')]||null:null})[_0xe2df('0xe')](function(_0x156c4c){logger['info'](_0xe2df('0x22'),_0x5ee8e5);logger[_0xe2df('0x11')](_0xe2df('0x22'),_0x5ee8e5,JSON[_0xe2df('0x20')](_0x156c4c));_0x505210(_0x156c4c);})[_0xe2df('0x18')](function(_0x18c59f){logger[_0xe2df('0x14')](_0xe2df('0x22'),_0x18c59f[_0xe2df('0x16')],_0x5ee8e5);_0x14f16a(_0x24d40d[_0xe2df('0x14')](0x1f4,_0x18c59f[_0xe2df('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 5177e3a..782da74 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 _0xeefe=['./voiceQueueReport.events','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x35db8f,_0x1657d2){var _0x49173b=function(_0x1aeb1a){while(--_0x1aeb1a){_0x35db8f['push'](_0x35db8f['shift']());}};_0x49173b(++_0x1657d2);}(_0xeefe,0xd9));var _0xeeef=function(_0x39b913,_0x46e913){_0x39b913=_0x39b913-0x0;var _0x131c47=_0xeefe[_0x39b913];return _0x131c47;};'use strict';var VoiceQueueReportEvents=require(_0xeeef('0x0'));var events=['save','remove',_0xeeef('0x1')];function createListener(_0x1f5d17,_0x34abf8){return function(_0x45a98b){_0x34abf8[_0xeeef('0x2')](_0x1f5d17,_0x45a98b);};}function removeListener(_0x510186,_0x49e158){return function(){VoiceQueueReportEvents[_0xeeef('0x3')](_0x510186,_0x49e158);};}exports[_0xeeef('0x4')]=function(_0x5d32ae){for(var _0x2d0881=0x0,_0x85ba4c=events[_0xeeef('0x5')];_0x2d0881<_0x85ba4c;_0x2d0881++){var _0x39b6df=events[_0x2d0881];var _0x1cae49=createListener(_0xeeef('0x6')+_0x39b6df,_0x5d32ae);VoiceQueueReportEvents['on'](_0x39b6df,_0x1cae49);}}; \ No newline at end of file +var _0x7a4a=['voiceQueueReport:','save','remove','update','emit','register'];(function(_0x309b20,_0x5f0e7b){var _0x3680d7=function(_0x1ff6ef){while(--_0x1ff6ef){_0x309b20['push'](_0x309b20['shift']());}};_0x3680d7(++_0x5f0e7b);}(_0x7a4a,0x1c9));var _0xa7a4=function(_0x557fc5,_0x5cb281){_0x557fc5=_0x557fc5-0x0;var _0x1eefb0=_0x7a4a[_0x557fc5];return _0x1eefb0;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xa7a4('0x0'),_0xa7a4('0x1'),_0xa7a4('0x2')];function createListener(_0x328735,_0x4d8ff4){return function(_0x5856a8){_0x4d8ff4[_0xa7a4('0x3')](_0x328735,_0x5856a8);};}function removeListener(_0x370a10,_0x6e6e45){return function(){VoiceQueueReportEvents['removeListener'](_0x370a10,_0x6e6e45);};}exports[_0xa7a4('0x4')]=function(_0xca903){for(var _0x347d6d=0x0,_0x1da75a=events['length'];_0x347d6d<_0x1da75a;_0x347d6d++){var _0x1d7244=events[_0x347d6d];var _0x1065b9=createListener(_0xa7a4('0x5')+_0x1d7244,_0xca903);VoiceQueueReportEvents['on'](_0x1d7244,_0x1065b9);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index fc6a392..8058277 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 _0x5643=['delete','/:id','destroy','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','put','update'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5643,0x162));var _0x3564=function(_0x23a14e,_0x125a00){_0x23a14e=_0x23a14e-0x0;var _0x31f181=_0x5643[_0x23a14e];return _0x31f181;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3564('0x0')]();var auth=require(_0x3564('0x1'));var interaction=require(_0x3564('0x2'));var config=require(_0x3564('0x3'));var controller=require('./voiceQueuesLog.controller');router[_0x3564('0x4')]('/',auth[_0x3564('0x5')](),controller['index']);router[_0x3564('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x3564('0x6')]);router[_0x3564('0x7')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3564('0x8')]('/:id',auth[_0x3564('0x5')](),controller[_0x3564('0x9')]);router[_0x3564('0xa')](_0x3564('0xb'),auth[_0x3564('0x5')](),controller[_0x3564('0xc')]);module['exports']=router; \ No newline at end of file +var _0xa83b=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x3e2e82,_0x369bbe){var _0xba15aa=function(_0x4ac6d4){while(--_0x4ac6d4){_0x3e2e82['push'](_0x3e2e82['shift']());}};_0xba15aa(++_0x369bbe);}(_0xa83b,0x1f2));var _0xba83=function(_0x46efdc,_0x709cb5){_0x46efdc=_0x46efdc-0x0;var _0x43c539=_0xa83b[_0x46efdc];return _0x43c539;};'use strict';var multer=require(_0xba83('0x0'));var util=require(_0xba83('0x1'));var path=require(_0xba83('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xba83('0x3')]();var auth=require(_0xba83('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xba83('0x5'));var controller=require(_0xba83('0x6'));router['get']('/',auth[_0xba83('0x7')](),controller[_0xba83('0x8')]);router[_0xba83('0x9')](_0xba83('0xa'),auth[_0xba83('0x7')](),controller[_0xba83('0xb')]);router[_0xba83('0xc')]('/',auth[_0xba83('0x7')](),controller[_0xba83('0xd')]);router[_0xba83('0xe')](_0xba83('0xa'),auth[_0xba83('0x7')](),controller[_0xba83('0xf')]);router[_0xba83('0x10')](_0xba83('0xa'),auth[_0xba83('0x7')](),controller[_0xba83('0x11')]);module[_0xba83('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 3cbf21f..11c78ab 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 _0xda44=['sequelize','moment','STRING','DATE','format'];(function(_0x54fdd8,_0x2e81ae){var _0x4f6f8a=function(_0x2a970c){while(--_0x2a970c){_0x54fdd8['push'](_0x54fdd8['shift']());}};_0x4f6f8a(++_0x2e81ae);}(_0xda44,0x1d1));var _0x4da4=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xda44[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x4da4('0x0'));var moment=require(_0x4da4('0x1'));module['exports']={'time':{'type':Sequelize[_0x4da4('0x2')]},'callid':{'type':Sequelize[_0x4da4('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4da4('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4da4('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4da4('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4da4('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4da4('0x3')],'allowNull':![],'defaultValue':moment()[_0x4da4('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x2790=['format','YYYY-MM-DD\x20HH:mm:ss','exports','STRING'];(function(_0x3e2039,_0x5597d3){var _0x384c10=function(_0x4fec2f){while(--_0x4fec2f){_0x3e2039['push'](_0x3e2039['shift']());}};_0x384c10(++_0x5597d3);}(_0x2790,0x8a));var _0x0279=function(_0x10a77f,_0x8575b0){_0x10a77f=_0x10a77f-0x0;var _0x40e612=_0x2790[_0x10a77f];return _0x40e612;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x0279('0x0')]={'time':{'type':Sequelize[_0x0279('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x0279('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x0279('0x2')](_0x0279('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index ccdf960..f809175 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['where','merge','VoiceQueuesLog','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x45405b,_0x207f59){var _0x41ff74=function(_0x25a7cc){while(--_0x25a7cc){_0x45405b['push'](_0x45405b['shift']());}};_0x41ff74(++_0x207f59);}(_0xb10b,0x12a));var _0xbb10=function(_0x69ede,_0x3f8e97){_0x69ede=_0x69ede-0x0;var _0x13e7e1=_0xb10b[_0x69ede];return _0x13e7e1;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['VoiceQueuesLog'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]),_0x20d946);if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};exports[_0xbb10('0x3f')]=function(_0x5f3d67,_0x1e8f79){var _0x1c7fae={'raw':!![],'where':{'id':_0x5f3d67[_0xbb10('0x40')]['id']}},_0x3e7b4c={};_0x3e7b4c['model']=_[_0xbb10('0x2d')](db[_0xbb10('0x3b')][_0xbb10('0x28')]);_0x3e7b4c[_0xbb10('0x30')]=_['keys'](_0x5f3d67[_0xbb10('0x30')]);_0x3e7b4c[_0xbb10('0x2e')]=_['intersection'](_0x3e7b4c['model'],_0x3e7b4c[_0xbb10('0x30')]);_0x1c7fae['attributes']=_[_0xbb10('0x2f')](_0x3e7b4c[_0xbb10('0x2c')],qs['fields'](_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x31')]));_0x1c7fae[_0xbb10('0x32')]=_0x1c7fae['attributes'][_0xbb10('0x33')]?_0x1c7fae[_0xbb10('0x32')]:_0x3e7b4c[_0xbb10('0x2c')];if(_0x5f3d67[_0xbb10('0x30')][_0xbb10('0x41')]){_0x1c7fae[_0xbb10('0x3c')]=[{'all':!![]}];}_0x1c7fae=_[_0xbb10('0x3a')]({},_0x1c7fae,_0x5f3d67[_0xbb10('0x42')]);return db[_0xbb10('0x3b')][_0xbb10('0x43')](_0x1c7fae)[_0xbb10('0x23')](handleEntityNotFound(_0x1e8f79,null))[_0xbb10('0x23')](respondWithResult(_0x1e8f79,null))['catch'](handleError(_0x1e8f79,null));};exports[_0xbb10('0x44')]=function(_0x41bbf8,_0x4a1248){return db[_0xbb10('0x3b')][_0xbb10('0x44')](_0x41bbf8[_0xbb10('0x45')],{})[_0xbb10('0x23')](respondWithResult(_0x4a1248,0xc9))[_0xbb10('0x3e')](handleError(_0x4a1248,null));};exports[_0xbb10('0x46')]=function(_0x3e06b0,_0x5be85e){if(_0x3e06b0['body']['id']){delete _0x3e06b0[_0xbb10('0x45')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x3e06b0['params']['id']}})['then'](handleEntityNotFound(_0x5be85e,null))[_0xbb10('0x23')](saveUpdates(_0x3e06b0[_0xbb10('0x45')],null))[_0xbb10('0x23')](respondWithResult(_0x5be85e,null))[_0xbb10('0x3e')](handleError(_0x5be85e,null));};exports[_0xbb10('0x24')]=function(_0x22b315,_0x2f2552){return db[_0xbb10('0x3b')][_0xbb10('0x43')]({'where':{'id':_0x22b315[_0xbb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x2f2552,null))['then'](removeEntity(_0x2f2552,null))[_0xbb10('0x3e')](handleError(_0x2f2552,null));}; \ No newline at end of file +var _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(_0x306290,_0x104eb0){var _0x28bd17=function(_0xa17e39){while(--_0xa17e39){_0x306290['push'](_0x306290['shift']());}};_0x28bd17(++_0x104eb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 422fea4..b2f5cb3 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 _0xe2fe=['event_dtm','dtm','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog'];(function(_0x302325,_0x51c70c){var _0x3d0e32=function(_0x5deadb){while(--_0x5deadb){_0x302325['push'](_0x302325['shift']());}};_0x3d0e32(++_0x51c70c);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['event',_0xee2f('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xdbf5=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5eed57,_0x224dc5){var _0x1ca877=function(_0xcdca76){while(--_0xcdca76){_0x5eed57['push'](_0x5eed57['shift']());}};_0x1ca877(++_0x224dc5);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2ab78c,_0x27a4ed){_0x2ab78c=_0x2ab78c-0x0;var _0x108fb9=_0xdbf5[_0x2ab78c];return _0x108fb9;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x5dbf('0xc'),'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 630cdc9..94961b7 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 _0x3f8c=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then','info'];(function(_0x28d685,_0x20a8b0){var _0x5abd39=function(_0x2cd5f3){while(--_0x2cd5f3){_0x28d685['push'](_0x28d685['shift']());}};_0x5abd39(++_0x20a8b0);}(_0x3f8c,0x104));var _0xc3f8=function(_0x523f81,_0x1769e0){_0x523f81=_0x523f81-0x0;var _0x23a2b2=_0x3f8c[_0x523f81];return _0x23a2b2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});} \ No newline at end of file +var _0x236c=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x57ea71,_0xf57beb){var _0x392b25=function(_0x31daa8){while(--_0x31daa8){_0x57ea71['push'](_0x57ea71['shift']());}};_0x392b25(++_0xf57beb);}(_0x236c,0x155));var _0xc236=function(_0x477441,_0x5b3ee5){_0x477441=_0x477441-0x0;var _0x4998bd=_0x236c[_0x477441];return _0x4998bd;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5abd65,_0xd612c6,_0x4d349b){return new BPromise(function(_0x51a13b,_0x5bc6a2){return client['request'](_0x5abd65,_0x4d349b)[_0xc236('0xc')](function(_0x4b8dc6){logger[_0xc236('0xd')](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));logger[_0xc236('0x10')](_0xc236('0x11'),_0xd612c6,'request\x20sent',JSON[_0xc236('0x12')](_0x4b8dc6));if(_0x4b8dc6[_0xc236('0x13')]){if(_0x4b8dc6['error'][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x5bc6a2(_0x4b8dc6['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0xe'),_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x51a13b(_0x4b8dc6[_0xc236('0x13')]['message']);}else{logger['info'](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));_0x51a13b(_0x4b8dc6[_0xc236('0x16')][_0xc236('0x15')]);}})[_0xc236('0x17')](function(_0x5ac3ed){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xd612c6,_0x5ac3ed);_0x5bc6a2(_0x5ac3ed);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 8818bf5..0fe1dd2 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(_0x4ba5e3,_0x3fb9b8){var _0xbb1325=function(_0x2d77cf){while(--_0x2d77cf){_0x4ba5e3['push'](_0x4ba5e3['shift']());}};_0xbb1325(++_0x3fb9b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x3cc57e,_0x29cd65){var _0x264316=function(_0x12992b){while(--_0x12992b){_0x3cc57e['push'](_0x3cc57e['shift']());}};_0x264316(++_0x29cd65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 584b9db..90c39e0 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 _0xf886=['STRING','setDataValue','channel','membername','split','TEXT','NEW','FLOAT','BOOLEAN','createdAt','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','format','sequelize','moment','path','exports','VIRTUAL','getDataValue','extname','value'];(function(_0x1fe016,_0x2f5394){var _0x5e3d1d=function(_0x38d799){while(--_0x38d799){_0x1fe016['push'](_0x1fe016['shift']());}};_0x5e3d1d(++_0x2f5394);}(_0xf886,0x82));var _0x6f88=function(_0x3181cc,_0x28447f){_0x3181cc=_0x3181cc-0x0;var _0x547a4a=_0xf886[_0x3181cc];return _0x547a4a;};'use strict';var Sequelize=require(_0x6f88('0x0'));var moment=require(_0x6f88('0x1'));var path=require(_0x6f88('0x2'));module[_0x6f88('0x3')]={'format':{'type':Sequelize[_0x6f88('0x4')],'get':function(){return this[_0x6f88('0x5')]('value')?path[_0x6f88('0x6')](this[_0x6f88('0x5')](_0x6f88('0x7'))):undefined;}},'uniqueid':{'type':Sequelize[_0x6f88('0x8')]},'channel':{'type':Sequelize[_0x6f88('0x8')],'set':function(_0x9ea9b5){if(_0x9ea9b5){this[_0x6f88('0x9')](_0x6f88('0xa'),_0x9ea9b5);this['setDataValue'](_0x6f88('0xb'),_0x9ea9b5[_0x6f88('0xc')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x6f88('0x8')]},'calleridnum':{'type':Sequelize[_0x6f88('0x8')]},'calleridname':{'type':Sequelize[_0x6f88('0x8')]},'connectedlinenum':{'type':Sequelize[_0x6f88('0x8')]},'connectedlinename':{'type':Sequelize[_0x6f88('0x8')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6f88('0x8')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x6f88('0x8')]},'type':{'type':Sequelize[_0x6f88('0x8')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x6f88('0x8')]},'userDisposition':{'type':Sequelize[_0x6f88('0x8')]},'location':{'type':Sequelize[_0x6f88('0xd')]},'transcribeName':{'type':Sequelize[_0x6f88('0x8')]},'transcribeStatus':{'type':Sequelize[_0x6f88('0x8')],'defaultValue':_0x6f88('0xe')},'fileUri':{'type':Sequelize[_0x6f88('0xd')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x6f88('0xd')]},'sentiment':{'type':Sequelize[_0x6f88('0x8')]},'sPositive':{'type':Sequelize[_0x6f88('0xf')]},'sNegative':{'type':Sequelize[_0x6f88('0xf')]},'sNeutral':{'type':Sequelize[_0x6f88('0xf')]},'sMixed':{'type':Sequelize[_0x6f88('0xf')]},'tempSentiment':{'type':Sequelize[_0x6f88('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6f88('0x5')](_0x6f88('0x11')))['format'](_0x6f88('0x12'))[_0x6f88('0x13')]();}},'updatedAt':{'type':Sequelize[_0x6f88('0x14')],'get':function(){return moment(this['getDataValue'](_0x6f88('0x15')))[_0x6f88('0x16')](_0x6f88('0x12'))[_0x6f88('0x13')]();}}}; \ No newline at end of file +var _0x5857=['extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','format','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue'];(function(_0x38b1e5,_0x43246b){var _0x187247=function(_0x3c6a40){while(--_0x3c6a40){_0x38b1e5['push'](_0x38b1e5['shift']());}};_0x187247(++_0x43246b);}(_0x5857,0x68));var _0x7585=function(_0x455059,_0x3db1fd){_0x455059=_0x455059-0x0;var _0x3f11d4=_0x5857[_0x455059];return _0x3f11d4;};'use strict';var Sequelize=require(_0x7585('0x0'));var moment=require(_0x7585('0x1'));var path=require(_0x7585('0x2'));module[_0x7585('0x3')]={'format':{'type':Sequelize[_0x7585('0x4')],'get':function(){return this[_0x7585('0x5')]('value')?path[_0x7585('0x6')](this[_0x7585('0x5')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x7585('0x7')]},'channel':{'type':Sequelize[_0x7585('0x7')],'set':function(_0x5633ff){if(_0x5633ff){this[_0x7585('0x8')](_0x7585('0x9'),_0x5633ff);this[_0x7585('0x8')](_0x7585('0xa'),_0x5633ff[_0x7585('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7585('0x7')]},'connectedlinenum':{'type':Sequelize[_0x7585('0x7')]},'connectedlinename':{'type':Sequelize[_0x7585('0x7')]},'accountcode':{'type':Sequelize[_0x7585('0x7')]},'context':{'type':Sequelize[_0x7585('0x7')]},'exten':{'type':Sequelize[_0x7585('0x7')]},'value':{'type':Sequelize[_0x7585('0x7')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x7585('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x7585('0xd')]},'transcribeName':{'type':Sequelize[_0x7585('0x7')]},'transcribeStatus':{'type':Sequelize[_0x7585('0x7')],'defaultValue':_0x7585('0xe')},'fileUri':{'type':Sequelize[_0x7585('0xd')]},'fileText':{'type':Sequelize[_0x7585('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x7585('0x7')]},'sPositive':{'type':Sequelize[_0x7585('0xf')]},'sNegative':{'type':Sequelize[_0x7585('0xf')]},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize[_0x7585('0xf')]},'tempSentiment':{'type':Sequelize[_0x7585('0x10')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x7585('0x11')],'get':function(){return moment(this[_0x7585('0x5')](_0x7585('0x12')))[_0x7585('0x13')]('MM-DD-YYYY\x20HH:mm')[_0x7585('0x14')]();}},'updatedAt':{'type':Sequelize[_0x7585('0x11')],'get':function(){return moment(this[_0x7585('0x5')](_0x7585('0x15')))[_0x7585('0x13')]('MM-DD-YYYY\x20HH:mm')[_0x7585('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 1b92ebe..3121ea3 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 _0xa9b7=['../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','index','map','VoiceRecording','rawAttributes','type','model','format','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','catch','params','fields','includeAll','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','sequelize','col','token','$and','push','ValidationError','destroy','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','bucket','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','uuid/v4','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2029f7,_0x53b3f1){var _0x5c6c6f=function(_0x22836a){while(--_0x22836a){_0x2029f7['push'](_0x2029f7['shift']());}};_0x5c6c6f(++_0x53b3f1);}(_0xa9b7,0x1af));var _0x7a9b=function(_0x484642,_0x3b8c1e){_0x484642=_0x484642-0x0;var _0x287bc6=_0xa9b7[_0x484642];return _0x287bc6;};'use strict';var pdf=require(_0x7a9b('0x0'));var emlformat=require(_0x7a9b('0x1'));var rimraf=require(_0x7a9b('0x2'));var zipdir=require(_0x7a9b('0x3'));var jsonpatch=require(_0x7a9b('0x4'));var rp=require(_0x7a9b('0x5'));var moment=require(_0x7a9b('0x6'));var BPromise=require(_0x7a9b('0x7'));var Mustache=require(_0x7a9b('0x8'));var util=require(_0x7a9b('0x9'));var path=require(_0x7a9b('0xa'));var sox=require(_0x7a9b('0xb'));var csv=require(_0x7a9b('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7a9b('0xd'));var squel=require(_0x7a9b('0xe'));var crypto=require(_0x7a9b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7a9b('0x10'));var toCsv=require(_0x7a9b('0xc'));var querystring=require('querystring');var Papa=require(_0x7a9b('0x11'));var AWS=require('aws-sdk');var uuidv4=require(_0x7a9b('0x12'));var Redis=require(_0x7a9b('0x13'));var authService=require(_0x7a9b('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a9b('0x15'));var logger=require(_0x7a9b('0x16'))(_0x7a9b('0x17'));var utils=require(_0x7a9b('0x18'));var config=require(_0x7a9b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x268fa0,_0x5d7002){_0x5d7002=_0x5d7002||0xcc;return function(_0x5d4ef1){if(_0x5d4ef1){return _0x268fa0[_0x7a9b('0x1a')](_0x5d7002);}return _0x268fa0[_0x7a9b('0x1b')](_0x5d7002)[_0x7a9b('0x1c')]();};}function respondWithResult(_0x28b13f,_0x3652c6){_0x3652c6=_0x3652c6||0xc8;return function(_0x1c9072){if(_0x1c9072){return _0x28b13f['status'](_0x3652c6)['json'](_0x1c9072);}};}function respondWithFilteredResult(_0x87d2d4,_0x35b2c8){return function(_0x54e7c9){if(_0x54e7c9){var _0x4d1488=_0x54e7c9[_0x7a9b('0x1d')],_0x493cdf=_0x35b2c8[_0x7a9b('0x1e')],_0x3e45b8=_0x35b2c8['offset']+_0x35b2c8[_0x7a9b('0x1f')],_0x3cb53a;if(_0x3e45b8>=_0x4d1488){_0x3e45b8=_0x4d1488;_0x3cb53a=0xc8;}else{_0x3cb53a=0xce;}_0x87d2d4['status'](_0x3cb53a);return _0x87d2d4[_0x7a9b('0x20')](_0x7a9b('0x21'),_0x493cdf+'-'+_0x3e45b8+'/'+_0x4d1488)[_0x7a9b('0x22')](_0x54e7c9);}return null;};}function patchUpdates(_0x30f39b){return function(_0xb82555){try{jsonpatch['apply'](_0xb82555,_0x30f39b,!![]);}catch(_0x74b28){return BPromise[_0x7a9b('0x23')](_0x74b28);}return _0xb82555[_0x7a9b('0x24')]();};}function saveUpdates(_0x506d4e,_0x7514ef){return function(_0xb2adec){if(_0xb2adec){return _0xb2adec[_0x7a9b('0x25')](_0x506d4e)[_0x7a9b('0x26')](function(_0xe12e38){return _0xe12e38;});}return null;};}function removeEntity(_0xd9fd9b,_0x1340d3){return function(_0x23a26f){if(_0x23a26f){return _0x23a26f['destroy']()['then'](function(){_0xd9fd9b[_0x7a9b('0x1b')](0xcc)[_0x7a9b('0x1c')]();});}};}function handleEntityNotFound(_0x455c96,_0x33b542){return function(_0xf49cc4){if(!_0xf49cc4){_0x455c96[_0x7a9b('0x1a')](0x194);}return _0xf49cc4;};}function handleError(_0x48296a,_0x1f9d53){_0x1f9d53=_0x1f9d53||0x1f4;return function(_0x8f443e){logger[_0x7a9b('0x27')](_0x8f443e[_0x7a9b('0x28')]);if(_0x8f443e[_0x7a9b('0x29')]){delete _0x8f443e[_0x7a9b('0x29')];}_0x48296a[_0x7a9b('0x1b')](_0x1f9d53)['send'](_0x8f443e);};}exports[_0x7a9b('0x2a')]=function(_0x2c6efb,_0x170158){var _0x28d50a={},_0x2362c6={},_0xfc1e73={'count':0x0,'rows':[]};var _0x51c681=_[_0x7a9b('0x2b')](db[_0x7a9b('0x2c')][_0x7a9b('0x2d')],function(_0xe16f7f){return{'name':_0xe16f7f['fieldName'],'type':_0xe16f7f[_0x7a9b('0x2e')]['key']};});_0x2362c6[_0x7a9b('0x2f')]=_['differenceBy'](_[_0x7a9b('0x2b')](_0x51c681,'name'),[_0x7a9b('0x30')]);_0x2362c6[_0x7a9b('0x31')]=_[_0x7a9b('0x32')](_0x2c6efb[_0x7a9b('0x31')]);_0x2362c6[_0x7a9b('0x33')]=_[_0x7a9b('0x34')](_0x2362c6['model'],_0x2362c6[_0x7a9b('0x31')]);_0x28d50a[_0x7a9b('0x35')]=_[_0x7a9b('0x34')](_0x2362c6[_0x7a9b('0x2f')],qs['fields'](_0x2c6efb[_0x7a9b('0x31')]['fields']));_0x28d50a['attributes']=_0x28d50a['attributes'][_0x7a9b('0x36')]?_0x28d50a['attributes']:_0x2362c6['model'];if(!_0x2c6efb['query'][_0x7a9b('0x37')](_0x7a9b('0x38'))){_0x28d50a['limit']=qs['limit'](_0x2c6efb['query']['limit']);_0x28d50a['offset']=qs['offset'](_0x2c6efb[_0x7a9b('0x31')][_0x7a9b('0x1e')]);}_0x28d50a[_0x7a9b('0x39')]=qs[_0x7a9b('0x3a')](_0x2c6efb[_0x7a9b('0x31')][_0x7a9b('0x3a')]);_0x28d50a['where']=qs['filters'](_[_0x7a9b('0x3b')](_0x2c6efb[_0x7a9b('0x31')],_0x2362c6[_0x7a9b('0x33')]),_0x51c681);if(_0x2c6efb[_0x7a9b('0x31')][_0x7a9b('0x3c')]){_0x28d50a[_0x7a9b('0x3d')]=_[_0x7a9b('0x3e')](_0x28d50a[_0x7a9b('0x3d')],{'$or':_[_0x7a9b('0x2b')](_0x51c681,function(_0x4c2242){if(_0x4c2242[_0x7a9b('0x2e')]!=='VIRTUAL'){var _0x1f66f5={};_0x1f66f5[_0x4c2242[_0x7a9b('0x29')]]={'$like':'%'+_0x2c6efb[_0x7a9b('0x31')]['filter']+'%'};return _0x1f66f5;}})});}_0x28d50a=_['merge']({},_0x28d50a,_0x2c6efb['options']);var _0x2e8ab1={'where':_0x28d50a[_0x7a9b('0x3d')]};return db[_0x7a9b('0x2c')][_0x7a9b('0x1d')](_0x2e8ab1)[_0x7a9b('0x26')](function(_0xad5a87){_0xfc1e73['count']=_0xad5a87;if(_0x2c6efb[_0x7a9b('0x31')]['includeAll']){_0x28d50a[_0x7a9b('0x3f')]=[{'all':!![]}];}return db[_0x7a9b('0x2c')][_0x7a9b('0x40')](_0x28d50a);})['then'](function(_0x51b12d){_0xfc1e73[_0x7a9b('0x41')]=_0x51b12d;return _0xfc1e73;})[_0x7a9b('0x26')](respondWithFilteredResult(_0x170158,_0x28d50a))[_0x7a9b('0x42')](handleError(_0x170158,null));};exports['show']=function(_0x4e8fe5,_0x46aa3b){var _0x38ea9d={'raw':![],'where':{'id':_0x4e8fe5[_0x7a9b('0x43')]['id']}},_0x1a97a3={};_0x1a97a3[_0x7a9b('0x2f')]=_['keys'](db[_0x7a9b('0x2c')][_0x7a9b('0x2d')]);_0x1a97a3['query']=_[_0x7a9b('0x32')](_0x4e8fe5['query']);_0x1a97a3['filters']=_['intersection'](_0x1a97a3[_0x7a9b('0x2f')],_0x1a97a3[_0x7a9b('0x31')]);_0x38ea9d['attributes']=_[_0x7a9b('0x34')](_0x1a97a3[_0x7a9b('0x2f')],qs[_0x7a9b('0x44')](_0x4e8fe5[_0x7a9b('0x31')][_0x7a9b('0x44')]));_0x38ea9d[_0x7a9b('0x35')]=_0x38ea9d['attributes'][_0x7a9b('0x36')]?_0x38ea9d[_0x7a9b('0x35')]:_0x1a97a3[_0x7a9b('0x2f')];if(_0x4e8fe5['query'][_0x7a9b('0x45')]){_0x38ea9d[_0x7a9b('0x3f')]=[{'all':!![]}];}_0x38ea9d=_[_0x7a9b('0x3e')]({},_0x38ea9d,_0x4e8fe5['options']);return db[_0x7a9b('0x2c')][_0x7a9b('0x46')](_0x38ea9d)['then'](handleEntityNotFound(_0x46aa3b,null))[_0x7a9b('0x26')](respondWithResult(_0x46aa3b,null))[_0x7a9b('0x42')](handleError(_0x46aa3b,null));};exports['create']=function(_0x366268,_0x46964e){return db[_0x7a9b('0x2c')][_0x7a9b('0x47')](_0x366268[_0x7a9b('0x48')],{})['then'](respondWithResult(_0x46964e,0xc9))[_0x7a9b('0x42')](handleError(_0x46964e,null));};exports[_0x7a9b('0x25')]=function(_0x212212,_0x58ba31){if(_0x212212[_0x7a9b('0x48')]['id']){delete _0x212212[_0x7a9b('0x48')]['id'];}return db[_0x7a9b('0x2c')][_0x7a9b('0x46')]({'where':{'id':_0x212212[_0x7a9b('0x43')]['id']}})[_0x7a9b('0x26')](handleEntityNotFound(_0x58ba31,null))['then'](saveUpdates(_0x212212['body'],null))[_0x7a9b('0x26')](respondWithResult(_0x58ba31,null))[_0x7a9b('0x42')](handleError(_0x58ba31,null));};exports[_0x7a9b('0x49')]=function(_0x75cfb1,_0x4f8dac){return db['VoiceRecording'][_0x7a9b('0x49')]()[_0x7a9b('0x26')](respondWithResult(_0x4f8dac,null))[_0x7a9b('0x42')](handleError(_0x4f8dac,null));};exports[_0x7a9b('0x4a')]=function(_0x5f205f,_0x302827,_0x4fb27e){var _0x20e405=require(_0x7a9b('0x4b'));var _0x5b5a46=![];var _0x58a1d0={};if(_0x5f205f[_0x7a9b('0x31')][_0x7a9b('0x2e')]&&_0x5f205f[_0x7a9b('0x31')]['type']===_0x7a9b('0x4c')){_0x58a1d0[_0x7a9b('0x4c')]=_0x5f205f[_0x7a9b('0x43')]['id'];}else{_0x58a1d0['id']=_0x5f205f[_0x7a9b('0x43')]['id'];}return db['VoiceRecording'][_0x7a9b('0x46')]({'where':_0x58a1d0,'attributes':['id',_0x7a9b('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x302827,null))[_0x7a9b('0x26')](function(_0x4e3053){if(_0x4e3053){var _0x3f8b82=_0x4e3053[_0x7a9b('0x4d')];var _0x54d94d=util[_0x7a9b('0x30')](_0x7a9b('0x4e'),_0x3f8b82);if(fs[_0x7a9b('0x4f')](_0x54d94d)){_0x5b5a46=!![];return _0x20e405[_0x7a9b('0x50')](_0x54d94d,_0x3f8b82,config[_0x7a9b('0x51')][_0x7a9b('0x52')])[_0x7a9b('0x26')](function(){return _0x4e3053;});}return _0x4e3053;}})[_0x7a9b('0x26')](function(_0x643332){if(_0x643332){var _0x5887fb=_0x643332[_0x7a9b('0x4d')];if(!fs['existsSync'](_0x5887fb)){throw new db[(_0x7a9b('0x53'))]['ValidationError'](_0x7a9b('0x54'));}if(_0x643332[_0x7a9b('0x55')]){return _0x302827[_0x7a9b('0x4a')](_0x5887fb,_0x643332[_0x7a9b('0x55')]+path[_0x7a9b('0x56')](_0x5887fb),function(){if(_0x5b5a46){fs['unlink'](_0x5887fb);}});}else{return _0x302827[_0x7a9b('0x4a')](_0x5887fb,function(_0x9cdd8f){if(_0x5b5a46){fs[_0x7a9b('0x57')](_0x5887fb);}});}}})[_0x7a9b('0x42')](function(_0x50efff){if(_0x50efff[_0x7a9b('0x58')]===_0x7a9b('0x54')){_0x302827[_0x7a9b('0x1b')](0x194)[_0x7a9b('0x59')]('Not\x20found');}else{return handleError(_0x302827,null);}});};exports['downloads']=function(_0x3804c4,_0x337269,_0x4f10d4){var _0x1e05f4=require(_0x7a9b('0x4b'));var _0x569dbe=![];var _0x4532a5={'$and':[db[_0x7a9b('0x5a')][_0x7a9b('0x3d')](db[_0x7a9b('0x5a')]['fn']('MD5',db[_0x7a9b('0x5a')][_0x7a9b('0x5b')]('uniqueid')),_0x3804c4[_0x7a9b('0x31')][_0x7a9b('0x5c')])]};if(_0x3804c4[_0x7a9b('0x31')]['type']&&_0x3804c4['query'][_0x7a9b('0x2e')]===_0x7a9b('0x4c')){_0x4532a5[_0x7a9b('0x5d')][_0x7a9b('0x5e')]({'uniqueid':_0x3804c4[_0x7a9b('0x43')]['id']});}else{_0x4532a5['$and']['push']({'id':_0x3804c4['params']['id']});}return db[_0x7a9b('0x2c')][_0x7a9b('0x46')]({'where':_0x4532a5,'attributes':['id',_0x7a9b('0x4d')],'raw':!![]})[_0x7a9b('0x26')](handleEntityNotFound(_0x337269,null))[_0x7a9b('0x26')](function(_0x597327){if(_0x597327){var _0x5d0667=util[_0x7a9b('0x30')]('%s.cypher',_0x597327[_0x7a9b('0x4d')]);if(fs[_0x7a9b('0x4f')](_0x5d0667)){_0x569dbe=!![];return _0x1e05f4['decryptFile'](_0x5d0667,_0x597327[_0x7a9b('0x4d')],config[_0x7a9b('0x51')][_0x7a9b('0x52')])[_0x7a9b('0x26')](function(){return _0x597327;});}return _0x597327;}})[_0x7a9b('0x26')](function(_0x5ee6ac){if(_0x5ee6ac){if(!fs[_0x7a9b('0x4f')](_0x5ee6ac[_0x7a9b('0x4d')])){throw new db[(_0x7a9b('0x53'))][(_0x7a9b('0x5f'))](_0x7a9b('0x54'));}if(_0x5ee6ac[_0x7a9b('0x55')]){return _0x337269[_0x7a9b('0x4a')](_0x5ee6ac[_0x7a9b('0x4d')],_0x5ee6ac[_0x7a9b('0x55')]+path[_0x7a9b('0x56')](_0x5ee6ac['value']),function(){if(_0x569dbe){fs[_0x7a9b('0x57')](_0x5ee6ac['value']);}});}else{return _0x337269[_0x7a9b('0x4a')](_0x5ee6ac[_0x7a9b('0x4d')],function(_0x588b8e){if(_0x569dbe){fs['unlink'](_0x5ee6ac[_0x7a9b('0x4d')]);}});}}})[_0x7a9b('0x42')](handleError(_0x337269,null));};exports[_0x7a9b('0x60')]=function(_0x2a2491,_0x4a53c0){return db['VoiceRecording'][_0x7a9b('0x46')]({'where':{'id':_0x2a2491[_0x7a9b('0x43')]['id']}})[_0x7a9b('0x26')](function(_0x3e97b7){if(!_0x3e97b7)throw new ReferenceError(_0x7a9b('0x61'));return _0x3e97b7;})[_0x7a9b('0x26')](function(_0x4ef29c){var _0x503994=_0x4ef29c[_0x7a9b('0x4d')];logger['info'](_0x7a9b('0x62'),_0x503994);if(!_['isNil'](_0x4ef29c[_0x7a9b('0x4d')])&&fs[_0x7a9b('0x4f')](_0x503994)){logger[_0x7a9b('0x63')](_0x7a9b('0x64')+_0x503994+_0x7a9b('0x65'));fs[_0x7a9b('0x66')](_0x503994);}_0x503994=_0x503994+'.cypher';if(!_[_0x7a9b('0x67')](_0x4ef29c[_0x7a9b('0x4d')])&&fs['existsSync'](_0x503994)){logger['info'](_0x7a9b('0x64')+_0x503994+_0x7a9b('0x65'));fs[_0x7a9b('0x66')](_0x503994);}return _0x4ef29c;})[_0x7a9b('0x26')](function(_0x586a1f){if(!_0x586a1f)throw new InternalError();return _0x586a1f[_0x7a9b('0x60')]();})[_0x7a9b('0x26')](function(){_0x4a53c0[_0x7a9b('0x1b')](0xcc)[_0x7a9b('0x1c')]();})[_0x7a9b('0x42')](handleError(_0x4a53c0,null));};function getBucketslist(_0x1a583f,_0x4744b8,_0x177976){return new Promise(function(_0x1328ee,_0x29b318){var _0x29bc0d=new AWS['S3']({'accessKeyId':_0x4744b8,'secretAccessKey':_0x1a583f,'region':_0x177976});_0x29bc0d[_0x7a9b('0x68')]({},function(_0x238a97,_0xbe4c2a){if(_0x238a97){return _0x29b318(_0x238a97);}else{return _0x1328ee(_0xbe4c2a);}});});}function createBucket(_0x3d7ed3,_0x514882,_0x4e0fae,_0x5c8723){return new Promise(function(_0xd86075,_0x1123f2){var _0x179c25=new AWS['S3']({'accessKeyId':_0x514882,'secretAccessKey':_0x3d7ed3,'region':_0x4e0fae});_0x179c25[_0x7a9b('0x69')]({'Bucket':_0x5c8723},function(_0x5a9041,_0x425121){if(_0x5a9041){return _0x1123f2(_0x5a9041);}else{return _0xd86075(_0x425121);}});});}function uploadFile(_0x5acdc1,_0x340683,_0x3f7030,_0x47f953,_0x4314fd,_0x47bec8){return new Promise(function(_0x14eeb4,_0x34e2f2){var _0x59b22f=new AWS['S3']({'accessKeyId':_0x340683,'secretAccessKey':_0x5acdc1,'region':_0x3f7030});_0x59b22f[_0x7a9b('0x6a')]({'Bucket':_0x47f953,'Key':_0x4314fd,'Body':_0x47bec8},function(_0x3c3ef9,_0x2e83ee){if(_0x3c3ef9){return _0x34e2f2(_0x3c3ef9);}else{return _0x14eeb4(_0x2e83ee);}});});}function startTranscribe(_0x18f960,_0x5df199,_0x2e4b8a,_0x1508b5,_0x2e3be2,_0xc2aa10){return new Promise(function(_0x54c4ff,_0xad498){var _0x3ad413=new AWS[(_0x7a9b('0x6b'))]({'accessKeyId':_0x5df199,'secretAccessKey':_0x18f960,'region':_0x2e4b8a});_0x3ad413[_0x7a9b('0x6c')]({'TranscriptionJobName':_0x1508b5,'LanguageCode':_0x2e3be2,'Media':{'MediaFileUri':_0xc2aa10}},function(_0x650157,_0x294dd5){if(_0x650157){return _0xad498(_0x650157);}else{return _0x54c4ff(_0x294dd5);}});});}function transcribe(_0x30af5a,_0x2d1cb5,_0x516bb0,_0x2a23b0,_0x300493,_0x543f38,_0x1c4bda){return new Promise(function(_0x4bd22,_0x3710f5){var _0x48cee5={};logger[_0x7a9b('0x63')](util[_0x7a9b('0x30')](_0x7a9b('0x6d'),_0x30af5a,_0x300493));return uploadFile(_0x2d1cb5,_0x516bb0,_0x2a23b0,_0x300493,path[_0x7a9b('0x6e')](_0x543f38),fs[_0x7a9b('0x6f')](_0x543f38))['then'](function(_0x5ca025){logger[_0x7a9b('0x63')](util['format'](_0x7a9b('0x70'),_0x30af5a,_0x300493,_0x5ca025[_0x7a9b('0x71')]));_0x48cee5['bucket']=_0x5ca025[_0x7a9b('0x72')];_0x48cee5[_0x7a9b('0x73')]=_0x5ca025['Location'];logger[_0x7a9b('0x63')](util[_0x7a9b('0x30')](_0x7a9b('0x74'),_0x30af5a));return startTranscribe(_0x2d1cb5,_0x516bb0,_0x2a23b0,uuidv4(),_0x1c4bda,_0x5ca025[_0x7a9b('0x71')]);})[_0x7a9b('0x26')](function(_0x1c25cb){logger['info'](util['format'](_0x7a9b('0x75'),_0x30af5a,_0x1c25cb[_0x7a9b('0x76')][_0x7a9b('0x77')]));_0x48cee5[_0x7a9b('0x78')]=_0x1c25cb['TranscriptionJob'][_0x7a9b('0x77')];_0x48cee5['transcribeStatus']=_0x1c25cb[_0x7a9b('0x76')][_0x7a9b('0x79')];return _0x4bd22(_0x48cee5);})['catch'](function(_0x11f08d){return _0x3710f5(_0x11f08d);});});}exports[_0x7a9b('0x7a')]=function(_0x284b83,_0x4ddacc,_0x16167e){var _0x1fa17c;var _0x328724;var _0x2a8a72;var _0xe05ac0=require(_0x7a9b('0x4b'));return db[_0x7a9b('0x2c')][_0x7a9b('0x7b')]({'where':{'id':_0x284b83['params']['id']}})[_0x7a9b('0x26')](function(_0x8c4d50){if(_0x8c4d50){var _0x2234de=util[_0x7a9b('0x30')]('%s.cypher',_0x8c4d50[_0x7a9b('0x4d')]);if(fs[_0x7a9b('0x4f')](_0x2234de)){cypher=!![];return _0xe05ac0['decryptFile'](_0x2234de,_0x8c4d50['value'],config[_0x7a9b('0x51')][_0x7a9b('0x52')])['then'](function(){return _0x8c4d50;});}return _0x8c4d50;}})['then'](function(_0x19ff0e){if(!_0x19ff0e){throw new db[(_0x7a9b('0x53'))][(_0x7a9b('0x5f'))](_0x7a9b('0x7c'));}_0x328724=_0x19ff0e;return db[_0x7a9b('0x7d')][_0x7a9b('0x7b')]({'where':{'id':0x1}});})[_0x7a9b('0x26')](handleEntityNotFound(_0x4ddacc,null))[_0x7a9b('0x26')](function(_0x2dd82d){if(_0x2dd82d){_0x1fa17c=_0x2dd82d;if(!_0x1fa17c[_0x7a9b('0x7e')]||!_0x1fa17c[_0x7a9b('0x7f')]||!_0x1fa17c['transcribeRegion']||!_0x1fa17c['language']||!_0x1fa17c[_0x7a9b('0x80')]){throw new db['Sequelize'][(_0x7a9b('0x5f'))]('Transcribe\x20not\x20configured');}if(_0x284b83['body']['runSentiment']&&(!_0x1fa17c['sentiment']||!_0x1fa17c['sentimentAccountId']||!_0x1fa17c[_0x7a9b('0x81')]||!_0x1fa17c['language']||!_0x1fa17c[_0x7a9b('0x80')])){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x7a9b('0x82')][_0x7a9b('0x7b')]({'where':{'id':_0x1fa17c['transcribeAccountId']}});}})[_0x7a9b('0x26')](function(_0x5557aa){if(!_0x5557aa){throw new db[(_0x7a9b('0x53'))][(_0x7a9b('0x5f'))](_0x7a9b('0x83'));}if(!_0x5557aa[_0x7a9b('0x84')]||!_0x5557aa['data2']){throw new db[(_0x7a9b('0x53'))][(_0x7a9b('0x5f'))](_0x7a9b('0x85'));}_0x2a8a72=_0x5557aa;return getBucketslist(_0x2a8a72[_0x7a9b('0x84')],_0x2a8a72[_0x7a9b('0x86')],_0x1fa17c['transcribeRegion']);})[_0x7a9b('0x26')](function(_0xc8697f){if(_0xc8697f&&_0xc8697f['Buckets']){var _0x3a2ae9=_[_0x7a9b('0x46')](_0xc8697f[_0x7a9b('0x87')],function(_0x97b258){return _0x97b258['Name']===_0x1fa17c[_0x7a9b('0x80')];});if(!_0x3a2ae9){logger[_0x7a9b('0x63')](util[_0x7a9b('0x30')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x284b83[_0x7a9b('0x43')]['id'],_0x1fa17c[_0x7a9b('0x80')]));return createBucket(_0x2a8a72[_0x7a9b('0x84')],_0x2a8a72[_0x7a9b('0x86')],_0x1fa17c[_0x7a9b('0x88')],_0x1fa17c['bucket']);}logger[_0x7a9b('0x63')](util[_0x7a9b('0x30')](_0x7a9b('0x89'),_0x284b83[_0x7a9b('0x43')]['id'],_0x1fa17c[_0x7a9b('0x80')]));return;}})[_0x7a9b('0x26')](function(_0xb42410){if(_0x328724['transcribeStatus']===_0x7a9b('0x8a')){return transcribe(_0x284b83[_0x7a9b('0x43')]['id'],_0x2a8a72[_0x7a9b('0x84')],_0x2a8a72[_0x7a9b('0x86')],_0x1fa17c[_0x7a9b('0x88')],_0x1fa17c['bucket'],_0x328724[_0x7a9b('0x4d')],_0x1fa17c[_0x7a9b('0x8b')]);}else{logger[_0x7a9b('0x63')](util['format'](_0x7a9b('0x8c'),_0x284b83[_0x7a9b('0x43')]['id']));return{'transcribeStatus':_0x7a9b('0x8d')};}})[_0x7a9b('0x26')](function(_0x59fdbe){if(_0x59fdbe){_0x59fdbe[_0x7a9b('0x8e')]=_0x284b83[_0x7a9b('0x48')][_0x7a9b('0x8f')];return _0x328724[_0x7a9b('0x90')](_0x59fdbe);}})[_0x7a9b('0x26')](respondWithResult(_0x4ddacc,null))[_0x7a9b('0x42')](handleError(_0x4ddacc,null));};function writeFile(_0x16bd17,_0x1ee140){return new Promise(function(_0x5deacb,_0xa6896){fs[_0x7a9b('0x91')](_0x1ee140,_0x16bd17,function(_0x15af0d,_0x546bb7){if(_0x15af0d){return _0xa6896(_0x15af0d);}else{return _0x5deacb(_0x546bb7);}});});}exports[_0x7a9b('0x92')]=function(_0x1032e7,_0x15311e,_0x1dc1c0){return db['VoiceRecording']['findOne']({'where':{'id':_0x1032e7[_0x7a9b('0x43')]['id']}})['then'](handleEntityNotFound(_0x15311e))['then'](function(_0x5dc1b9){if(_0x5dc1b9&&_0x5dc1b9['fileText']){var _0x3173ee=_0x5dc1b9[_0x7a9b('0x93')];var _0x430d81=config[_0x7a9b('0x94')]+_0x7a9b('0x95')+_0x5dc1b9['id']+_0x7a9b('0x96');if(fs['existsSync'](_0x430d81)){return _0x430d81;}return writeFile(_0x3173ee,_0x430d81)['then'](function(){return _0x430d81;});}else{throw new db[(_0x7a9b('0x53'))][(_0x7a9b('0x5f'))](_0x7a9b('0x97'));}})[_0x7a9b('0x26')](function(_0x4d3c63){return _0x15311e[_0x7a9b('0x4a')](_0x4d3c63);})[_0x7a9b('0x42')](handleError(_0x15311e));}; \ No newline at end of file +var _0x296f=['find','create','body','params','describe','download','../../components/encryptor','type','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','sequelize','MD5','col','token','push','$and','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','fields'];(function(_0x3b0da2,_0x306d66){var _0x45a240=function(_0x557598){while(--_0x557598){_0x3b0da2['push'](_0x3b0da2['shift']());}};_0x45a240(++_0x306d66);}(_0x296f,0xdf));var _0xf296=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0x296f[_0x55e1d1];return _0x1165db;};'use strict';var pdf=require(_0xf296('0x0'));var emlformat=require(_0xf296('0x1'));var rimraf=require(_0xf296('0x2'));var zipdir=require(_0xf296('0x3'));var jsonpatch=require(_0xf296('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf296('0x5'));var util=require(_0xf296('0x6'));var path=require('path');var sox=require(_0xf296('0x7'));var csv=require(_0xf296('0x8'));var ejs=require(_0xf296('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf296('0xa'));var crypto=require(_0xf296('0xb'));var jsforce=require(_0xf296('0xc'));var deskjs=require(_0xf296('0xd'));var toCsv=require(_0xf296('0x8'));var querystring=require(_0xf296('0xe'));var Papa=require(_0xf296('0xf'));var AWS=require(_0xf296('0x10'));var uuidv4=require(_0xf296('0x11'));var Redis=require(_0xf296('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf296('0x13'));var hardwareService=require(_0xf296('0x14'));var logger=require('../../config/logger')(_0xf296('0x15'));var utils=require(_0xf296('0x16'));var config=require(_0xf296('0x17'));var db=require(_0xf296('0x18'))['db'];function respondWithStatusCode(_0x5784d7,_0x3bf22d){_0x3bf22d=_0x3bf22d||0xcc;return function(_0x30ad76){if(_0x30ad76){return _0x5784d7[_0xf296('0x19')](_0x3bf22d);}return _0x5784d7[_0xf296('0x1a')](_0x3bf22d)[_0xf296('0x1b')]();};}function respondWithResult(_0x298987,_0x72f5b7){_0x72f5b7=_0x72f5b7||0xc8;return function(_0xfa6208){if(_0xfa6208){return _0x298987['status'](_0x72f5b7)[_0xf296('0x1c')](_0xfa6208);}};}function respondWithFilteredResult(_0x28ebd8,_0x88e236){return function(_0x4fd015){if(_0x4fd015){var _0x116de8=_0x4fd015[_0xf296('0x1d')],_0x4563a6=_0x88e236[_0xf296('0x1e')],_0x5c3708=_0x88e236[_0xf296('0x1e')]+_0x88e236['limit'],_0x1ef90b;if(_0x5c3708>=_0x116de8){_0x5c3708=_0x116de8;_0x1ef90b=0xc8;}else{_0x1ef90b=0xce;}_0x28ebd8[_0xf296('0x1a')](_0x1ef90b);return _0x28ebd8[_0xf296('0x1f')](_0xf296('0x20'),_0x4563a6+'-'+_0x5c3708+'/'+_0x116de8)[_0xf296('0x1c')](_0x4fd015);}return null;};}function patchUpdates(_0x49e44e){return function(_0x42a51f){try{jsonpatch[_0xf296('0x21')](_0x42a51f,_0x49e44e,!![]);}catch(_0x3d5a61){return BPromise['reject'](_0x3d5a61);}return _0x42a51f[_0xf296('0x22')]();};}function saveUpdates(_0x331997,_0x45fa3d){return function(_0x13e7ba){if(_0x13e7ba){return _0x13e7ba[_0xf296('0x23')](_0x331997)[_0xf296('0x24')](function(_0x3ee81d){return _0x3ee81d;});}return null;};}function removeEntity(_0x591848,_0x513767){return function(_0x4f1fd0){if(_0x4f1fd0){return _0x4f1fd0[_0xf296('0x25')]()[_0xf296('0x24')](function(){_0x591848[_0xf296('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x587b2a,_0x494730){return function(_0x33163f){if(!_0x33163f){_0x587b2a['sendStatus'](0x194);}return _0x33163f;};}function handleError(_0x1b813b,_0x579239){_0x579239=_0x579239||0x1f4;return function(_0x28ef8b){logger[_0xf296('0x26')](_0x28ef8b['stack']);if(_0x28ef8b[_0xf296('0x27')]){delete _0x28ef8b['name'];}_0x1b813b['status'](_0x579239)[_0xf296('0x28')](_0x28ef8b);};}exports[_0xf296('0x29')]=function(_0x561412,_0x53e2e9){var _0x2f2084={},_0x655b3f={},_0x3c0b0e={'count':0x0,'rows':[]};var _0x2f2e3c=_[_0xf296('0x2a')](db[_0xf296('0x2b')][_0xf296('0x2c')],function(_0x482cd5){return{'name':_0x482cd5[_0xf296('0x2d')],'type':_0x482cd5['type'][_0xf296('0x2e')]};});_0x655b3f[_0xf296('0x2f')]=_[_0xf296('0x30')](_[_0xf296('0x2a')](_0x2f2e3c,_0xf296('0x27')),[_0xf296('0x31')]);_0x655b3f[_0xf296('0x32')]=_[_0xf296('0x33')](_0x561412[_0xf296('0x32')]);_0x655b3f['filters']=_[_0xf296('0x34')](_0x655b3f[_0xf296('0x2f')],_0x655b3f[_0xf296('0x32')]);_0x2f2084[_0xf296('0x35')]=_[_0xf296('0x34')](_0x655b3f['model'],qs['fields'](_0x561412[_0xf296('0x32')]['fields']));_0x2f2084['attributes']=_0x2f2084['attributes'][_0xf296('0x36')]?_0x2f2084[_0xf296('0x35')]:_0x655b3f[_0xf296('0x2f')];if(!_0x561412[_0xf296('0x32')][_0xf296('0x37')](_0xf296('0x38'))){_0x2f2084[_0xf296('0x39')]=qs[_0xf296('0x39')](_0x561412[_0xf296('0x32')][_0xf296('0x39')]);_0x2f2084[_0xf296('0x1e')]=qs[_0xf296('0x1e')](_0x561412[_0xf296('0x32')][_0xf296('0x1e')]);}_0x2f2084[_0xf296('0x3a')]=qs['sort'](_0x561412[_0xf296('0x32')][_0xf296('0x3b')]);_0x2f2084[_0xf296('0x3c')]=qs[_0xf296('0x3d')](_[_0xf296('0x3e')](_0x561412['query'],_0x655b3f[_0xf296('0x3d')]),_0x2f2e3c);if(_0x561412[_0xf296('0x32')]['filter']){_0x2f2084['where']=_[_0xf296('0x3f')](_0x2f2084[_0xf296('0x3c')],{'$or':_[_0xf296('0x2a')](_0x2f2e3c,function(_0x4be42c){if(_0x4be42c['type']!==_0xf296('0x40')){var _0x527b10={};_0x527b10[_0x4be42c[_0xf296('0x27')]]={'$like':'%'+_0x561412[_0xf296('0x32')][_0xf296('0x41')]+'%'};return _0x527b10;}})});}_0x2f2084=_[_0xf296('0x3f')]({},_0x2f2084,_0x561412[_0xf296('0x42')]);var _0x4b84d1={'where':_0x2f2084[_0xf296('0x3c')]};return db[_0xf296('0x2b')]['count'](_0x4b84d1)[_0xf296('0x24')](function(_0x23acbb){_0x3c0b0e[_0xf296('0x1d')]=_0x23acbb;if(_0x561412[_0xf296('0x32')][_0xf296('0x43')]){_0x2f2084['include']=[{'all':!![]}];}return db[_0xf296('0x2b')][_0xf296('0x44')](_0x2f2084);})[_0xf296('0x24')](function(_0x4afb14){_0x3c0b0e[_0xf296('0x45')]=_0x4afb14;return _0x3c0b0e;})[_0xf296('0x24')](respondWithFilteredResult(_0x53e2e9,_0x2f2084))[_0xf296('0x46')](handleError(_0x53e2e9,null));};exports[_0xf296('0x47')]=function(_0x32f353,_0x4ed6fc){var _0x5bcddc={'raw':![],'where':{'id':_0x32f353['params']['id']}},_0x595895={};_0x595895[_0xf296('0x2f')]=_[_0xf296('0x33')](db[_0xf296('0x2b')][_0xf296('0x2c')]);_0x595895['query']=_['keys'](_0x32f353[_0xf296('0x32')]);_0x595895['filters']=_[_0xf296('0x34')](_0x595895[_0xf296('0x2f')],_0x595895[_0xf296('0x32')]);_0x5bcddc[_0xf296('0x35')]=_[_0xf296('0x34')](_0x595895['model'],qs[_0xf296('0x48')](_0x32f353[_0xf296('0x32')][_0xf296('0x48')]));_0x5bcddc['attributes']=_0x5bcddc[_0xf296('0x35')][_0xf296('0x36')]?_0x5bcddc['attributes']:_0x595895[_0xf296('0x2f')];if(_0x32f353[_0xf296('0x32')][_0xf296('0x43')]){_0x5bcddc['include']=[{'all':!![]}];}_0x5bcddc=_['merge']({},_0x5bcddc,_0x32f353[_0xf296('0x42')]);return db['VoiceRecording'][_0xf296('0x49')](_0x5bcddc)[_0xf296('0x24')](handleEntityNotFound(_0x4ed6fc,null))[_0xf296('0x24')](respondWithResult(_0x4ed6fc,null))[_0xf296('0x46')](handleError(_0x4ed6fc,null));};exports[_0xf296('0x4a')]=function(_0x6b0721,_0x1177ff){return db[_0xf296('0x2b')]['create'](_0x6b0721['body'],{})[_0xf296('0x24')](respondWithResult(_0x1177ff,0xc9))[_0xf296('0x46')](handleError(_0x1177ff,null));};exports['update']=function(_0x5a01dd,_0x507a4a){if(_0x5a01dd[_0xf296('0x4b')]['id']){delete _0x5a01dd[_0xf296('0x4b')]['id'];}return db[_0xf296('0x2b')][_0xf296('0x49')]({'where':{'id':_0x5a01dd[_0xf296('0x4c')]['id']}})[_0xf296('0x24')](handleEntityNotFound(_0x507a4a,null))[_0xf296('0x24')](saveUpdates(_0x5a01dd[_0xf296('0x4b')],null))['then'](respondWithResult(_0x507a4a,null))[_0xf296('0x46')](handleError(_0x507a4a,null));};exports[_0xf296('0x4d')]=function(_0x17ea73,_0x16898f){return db[_0xf296('0x2b')][_0xf296('0x4d')]()[_0xf296('0x24')](respondWithResult(_0x16898f,null))[_0xf296('0x46')](handleError(_0x16898f,null));};exports[_0xf296('0x4e')]=function(_0x37e287,_0x6a87a2,_0x5ebaf6){var _0x53b61b=require(_0xf296('0x4f'));var _0x31c73c=![];var _0x4520e6={};if(_0x37e287[_0xf296('0x32')][_0xf296('0x50')]&&_0x37e287[_0xf296('0x32')][_0xf296('0x50')]==='uniqueid'){_0x4520e6[_0xf296('0x51')]=_0x37e287['params']['id'];}else{_0x4520e6['id']=_0x37e287[_0xf296('0x4c')]['id'];}return db['VoiceRecording']['find']({'where':_0x4520e6,'attributes':['id',_0xf296('0x52')],'raw':!![]})[_0xf296('0x24')](handleEntityNotFound(_0x6a87a2,null))[_0xf296('0x24')](function(_0x1effbd){if(_0x1effbd){var _0x4cb7f6=_0x1effbd[_0xf296('0x52')];var _0x4d546b=util['format']('%s.cypher',_0x4cb7f6);if(fs[_0xf296('0x53')](_0x4d546b)){_0x31c73c=!![];return _0x53b61b[_0xf296('0x54')](_0x4d546b,_0x4cb7f6,config[_0xf296('0x55')][_0xf296('0x56')])[_0xf296('0x24')](function(){return _0x1effbd;});}return _0x1effbd;}})[_0xf296('0x24')](function(_0x17673a){if(_0x17673a){var _0x392960=_0x17673a['value'];if(!fs[_0xf296('0x53')](_0x392960)){throw new db[(_0xf296('0x57'))][(_0xf296('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x17673a[_0xf296('0x59')]){return _0x6a87a2[_0xf296('0x4e')](_0x392960,_0x17673a[_0xf296('0x59')]+path[_0xf296('0x5a')](_0x392960),function(){if(_0x31c73c){fs[_0xf296('0x5b')](_0x392960);}});}else{return _0x6a87a2[_0xf296('0x4e')](_0x392960,function(_0x27b2d7){if(_0x31c73c){fs[_0xf296('0x5b')](_0x392960);}});}}})[_0xf296('0x46')](function(_0x78c9da){if(_0x78c9da[_0xf296('0x5c')]===_0xf296('0x5d')){_0x6a87a2['status'](0x194)[_0xf296('0x28')](_0xf296('0x5e'));}else{return handleError(_0x6a87a2,null);}});};exports['downloads']=function(_0x3cdcaf,_0x5b2cbe,_0x395f9a){var _0x51d449=require('../../components/encryptor');var _0xea2a9c=![];var _0x30fd11={'$and':[db[_0xf296('0x5f')][_0xf296('0x3c')](db[_0xf296('0x5f')]['fn'](_0xf296('0x60'),db[_0xf296('0x5f')][_0xf296('0x61')]('uniqueid')),_0x3cdcaf[_0xf296('0x32')][_0xf296('0x62')])]};if(_0x3cdcaf[_0xf296('0x32')]['type']&&_0x3cdcaf[_0xf296('0x32')][_0xf296('0x50')]===_0xf296('0x51')){_0x30fd11['$and'][_0xf296('0x63')]({'uniqueid':_0x3cdcaf[_0xf296('0x4c')]['id']});}else{_0x30fd11[_0xf296('0x64')][_0xf296('0x63')]({'id':_0x3cdcaf['params']['id']});}return db[_0xf296('0x2b')]['find']({'where':_0x30fd11,'attributes':['id','value'],'raw':!![]})[_0xf296('0x24')](handleEntityNotFound(_0x5b2cbe,null))[_0xf296('0x24')](function(_0x222e4b){if(_0x222e4b){var _0x53434f=util[_0xf296('0x31')]('%s.cypher',_0x222e4b['value']);if(fs[_0xf296('0x53')](_0x53434f)){_0xea2a9c=!![];return _0x51d449['decryptFile'](_0x53434f,_0x222e4b['value'],config['secrets'][_0xf296('0x56')])[_0xf296('0x24')](function(){return _0x222e4b;});}return _0x222e4b;}})['then'](function(_0x26d6f2){if(_0x26d6f2){if(!fs['existsSync'](_0x26d6f2['value'])){throw new db[(_0xf296('0x57'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x26d6f2[_0xf296('0x59')]){return _0x5b2cbe['download'](_0x26d6f2['value'],_0x26d6f2[_0xf296('0x59')]+path['extname'](_0x26d6f2['value']),function(){if(_0xea2a9c){fs[_0xf296('0x5b')](_0x26d6f2['value']);}});}else{return _0x5b2cbe['download'](_0x26d6f2[_0xf296('0x52')],function(_0x2e10fe){if(_0xea2a9c){fs[_0xf296('0x5b')](_0x26d6f2[_0xf296('0x52')]);}});}}})[_0xf296('0x46')](handleError(_0x5b2cbe,null));};exports[_0xf296('0x25')]=function(_0xa77d4b,_0x3663f6){return db[_0xf296('0x2b')][_0xf296('0x49')]({'where':{'id':_0xa77d4b[_0xf296('0x4c')]['id']}})[_0xf296('0x24')](function(_0x533d8e){if(!_0x533d8e)throw new ReferenceError(_0xf296('0x65'));return _0x533d8e;})['then'](function(_0x242cd3){var _0x48bda5=_0x242cd3['value'];logger['info'](_0xf296('0x66'),_0x48bda5);if(!_['isNil'](_0x242cd3[_0xf296('0x52')])&&fs['existsSync'](_0x48bda5)){logger[_0xf296('0x67')](_0xf296('0x68')+_0x48bda5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf296('0x69')](_0x48bda5);}_0x48bda5=_0x48bda5+_0xf296('0x6a');if(!_['isNil'](_0x242cd3[_0xf296('0x52')])&&fs[_0xf296('0x53')](_0x48bda5)){logger[_0xf296('0x67')](_0xf296('0x68')+_0x48bda5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf296('0x69')](_0x48bda5);}return _0x242cd3;})['then'](function(_0x373c83){if(!_0x373c83)throw new InternalError();return _0x373c83[_0xf296('0x25')]();})[_0xf296('0x24')](function(){_0x3663f6[_0xf296('0x1a')](0xcc)[_0xf296('0x1b')]();})['catch'](handleError(_0x3663f6,null));};function getBucketslist(_0x1a5039,_0x5770a6,_0x46d1b9){return new Promise(function(_0x29cded,_0x2623cc){var _0x272145=new AWS['S3']({'accessKeyId':_0x5770a6,'secretAccessKey':_0x1a5039,'region':_0x46d1b9});_0x272145['listBuckets']({},function(_0x2eb7d7,_0x2cdce7){if(_0x2eb7d7){return _0x2623cc(_0x2eb7d7);}else{return _0x29cded(_0x2cdce7);}});});}function createBucket(_0x3a584d,_0xa1e180,_0x54c946,_0x5cd5fe){return new Promise(function(_0xde7b9c,_0x253021){var _0xba6294=new AWS['S3']({'accessKeyId':_0xa1e180,'secretAccessKey':_0x3a584d,'region':_0x54c946});_0xba6294[_0xf296('0x6b')]({'Bucket':_0x5cd5fe},function(_0x55d9e2,_0x1830da){if(_0x55d9e2){return _0x253021(_0x55d9e2);}else{return _0xde7b9c(_0x1830da);}});});}function uploadFile(_0x3d37c9,_0x564c8d,_0xfa0560,_0xae2f84,_0x5a3752,_0x5c7ba2){return new Promise(function(_0x2af879,_0x38ccd2){var _0x5529e5=new AWS['S3']({'accessKeyId':_0x564c8d,'secretAccessKey':_0x3d37c9,'region':_0xfa0560});_0x5529e5[_0xf296('0x6c')]({'Bucket':_0xae2f84,'Key':_0x5a3752,'Body':_0x5c7ba2},function(_0x2bf24,_0x2220bf){if(_0x2bf24){return _0x38ccd2(_0x2bf24);}else{return _0x2af879(_0x2220bf);}});});}function startTranscribe(_0x332ee1,_0x5e74c3,_0x16eeac,_0x4d36f5,_0x12d39d,_0x231d21){return new Promise(function(_0x515677,_0x1d76a7){var _0x194d14=new AWS[(_0xf296('0x6d'))]({'accessKeyId':_0x5e74c3,'secretAccessKey':_0x332ee1,'region':_0x16eeac});_0x194d14[_0xf296('0x6e')]({'TranscriptionJobName':_0x4d36f5,'LanguageCode':_0x12d39d,'Media':{'MediaFileUri':_0x231d21}},function(_0xf1ec1d,_0x5a28cd){if(_0xf1ec1d){return _0x1d76a7(_0xf1ec1d);}else{return _0x515677(_0x5a28cd);}});});}function transcribe(_0x45c8f2,_0x5895db,_0x99ec91,_0x2aa11f,_0x5d3972,_0x387f7b,_0x1df787){return new Promise(function(_0x49902e,_0x3ea093){var _0x587b02={};logger[_0xf296('0x67')](util[_0xf296('0x31')](_0xf296('0x6f'),_0x45c8f2,_0x5d3972));return uploadFile(_0x5895db,_0x99ec91,_0x2aa11f,_0x5d3972,path[_0xf296('0x70')](_0x387f7b),fs['readFileSync'](_0x387f7b))[_0xf296('0x24')](function(_0x1e2cd9){logger['info'](util['format'](_0xf296('0x71'),_0x45c8f2,_0x5d3972,_0x1e2cd9[_0xf296('0x72')]));_0x587b02[_0xf296('0x73')]=_0x1e2cd9[_0xf296('0x74')];_0x587b02['location']=_0x1e2cd9[_0xf296('0x72')];logger[_0xf296('0x67')](util[_0xf296('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x45c8f2));return startTranscribe(_0x5895db,_0x99ec91,_0x2aa11f,uuidv4(),_0x1df787,_0x1e2cd9[_0xf296('0x72')]);})[_0xf296('0x24')](function(_0x5e7e60){logger['info'](util[_0xf296('0x31')](_0xf296('0x75'),_0x45c8f2,_0x5e7e60[_0xf296('0x76')][_0xf296('0x77')]));_0x587b02['transcribeName']=_0x5e7e60['TranscriptionJob'][_0xf296('0x77')];_0x587b02['transcribeStatus']=_0x5e7e60['TranscriptionJob']['TranscriptionJobStatus'];return _0x49902e(_0x587b02);})['catch'](function(_0x8a7170){return _0x3ea093(_0x8a7170);});});}exports[_0xf296('0x78')]=function(_0x4de85d,_0x188155,_0x46b1e7){var _0x4e7b1c;var _0x175206;var _0x896fe4;var _0x410140=require(_0xf296('0x4f'));return db[_0xf296('0x2b')][_0xf296('0x79')]({'where':{'id':_0x4de85d['params']['id']}})['then'](function(_0x571514){if(_0x571514){var _0x447054=util[_0xf296('0x31')](_0xf296('0x7a'),_0x571514[_0xf296('0x52')]);if(fs[_0xf296('0x53')](_0x447054)){cypher=!![];return _0x410140['decryptFile'](_0x447054,_0x571514[_0xf296('0x52')],config[_0xf296('0x55')][_0xf296('0x56')])['then'](function(){return _0x571514;});}return _0x571514;}})[_0xf296('0x24')](function(_0x30838c){if(!_0x30838c){throw new db[(_0xf296('0x57'))][(_0xf296('0x58'))](_0xf296('0x7b'));}_0x175206=_0x30838c;return db['Setting'][_0xf296('0x79')]({'where':{'id':0x1}});})[_0xf296('0x24')](handleEntityNotFound(_0x188155,null))['then'](function(_0xc68666){if(_0xc68666){_0x4e7b1c=_0xc68666;if(!_0x4e7b1c[_0xf296('0x7c')]||!_0x4e7b1c[_0xf296('0x7d')]||!_0x4e7b1c[_0xf296('0x7e')]||!_0x4e7b1c[_0xf296('0x7f')]||!_0x4e7b1c[_0xf296('0x73')]){throw new db[(_0xf296('0x57'))][(_0xf296('0x58'))]('Transcribe\x20not\x20configured');}if(_0x4de85d[_0xf296('0x4b')]['runSentiment']&&(!_0x4e7b1c['sentiment']||!_0x4e7b1c[_0xf296('0x80')]||!_0x4e7b1c[_0xf296('0x81')]||!_0x4e7b1c['language']||!_0x4e7b1c[_0xf296('0x73')])){throw new db[(_0xf296('0x57'))][(_0xf296('0x58'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xf296('0x82')][_0xf296('0x79')]({'where':{'id':_0x4e7b1c[_0xf296('0x7d')]}});}})[_0xf296('0x24')](function(_0xad9d3b){if(!_0xad9d3b){throw new db['Sequelize'][(_0xf296('0x58'))](_0xf296('0x83'));}if(!_0xad9d3b['data1']||!_0xad9d3b[_0xf296('0x84')]){throw new db[(_0xf296('0x57'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x896fe4=_0xad9d3b;return getBucketslist(_0x896fe4[_0xf296('0x85')],_0x896fe4[_0xf296('0x84')],_0x4e7b1c[_0xf296('0x7e')]);})[_0xf296('0x24')](function(_0x1a1e58){if(_0x1a1e58&&_0x1a1e58[_0xf296('0x86')]){var _0x519135=_[_0xf296('0x49')](_0x1a1e58['Buckets'],function(_0xd0e6fd){return _0xd0e6fd[_0xf296('0x87')]===_0x4e7b1c['bucket'];});if(!_0x519135){logger[_0xf296('0x67')](util[_0xf296('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4de85d[_0xf296('0x4c')]['id'],_0x4e7b1c['bucket']));return createBucket(_0x896fe4[_0xf296('0x85')],_0x896fe4[_0xf296('0x84')],_0x4e7b1c[_0xf296('0x7e')],_0x4e7b1c[_0xf296('0x73')]);}logger[_0xf296('0x67')](util[_0xf296('0x31')](_0xf296('0x88'),_0x4de85d['params']['id'],_0x4e7b1c['bucket']));return;}})[_0xf296('0x24')](function(_0x371e18){if(_0x175206['transcribeStatus']===_0xf296('0x89')){return transcribe(_0x4de85d['params']['id'],_0x896fe4[_0xf296('0x85')],_0x896fe4['data2'],_0x4e7b1c[_0xf296('0x7e')],_0x4e7b1c['bucket'],_0x175206['value'],_0x4e7b1c['language']);}else{logger[_0xf296('0x67')](util[_0xf296('0x31')](_0xf296('0x8a'),_0x4de85d[_0xf296('0x4c')]['id']));return{'transcribeStatus':_0xf296('0x8b')};}})[_0xf296('0x24')](function(_0x5c1304){if(_0x5c1304){_0x5c1304[_0xf296('0x8c')]=_0x4de85d[_0xf296('0x4b')][_0xf296('0x8d')];return _0x175206['updateAttributes'](_0x5c1304);}})[_0xf296('0x24')](respondWithResult(_0x188155,null))[_0xf296('0x46')](handleError(_0x188155,null));};function writeFile(_0x37b964,_0x550764){return new Promise(function(_0x749987,_0x1ca448){fs[_0xf296('0x8e')](_0x550764,_0x37b964,function(_0x14af32,_0x2ff595){if(_0x14af32){return _0x1ca448(_0x14af32);}else{return _0x749987(_0x2ff595);}});});}exports[_0xf296('0x8f')]=function(_0x4cf84a,_0xb86a13,_0x35f5f8){return db[_0xf296('0x2b')][_0xf296('0x79')]({'where':{'id':_0x4cf84a['params']['id']}})[_0xf296('0x24')](handleEntityNotFound(_0xb86a13))[_0xf296('0x24')](function(_0x4f1f39){if(_0x4f1f39&&_0x4f1f39[_0xf296('0x90')]){var _0x407445=_0x4f1f39[_0xf296('0x90')];var _0x3ab805=config[_0xf296('0x91')]+_0xf296('0x92')+_0x4f1f39['id']+'.txt';if(fs[_0xf296('0x53')](_0x3ab805)){return _0x3ab805;}return writeFile(_0x407445,_0x3ab805)[_0xf296('0x24')](function(){return _0x3ab805;});}else{throw new db[(_0xf296('0x57'))][(_0xf296('0x58'))](_0xf296('0x93'));}})['then'](function(_0xfba1cf){return _0xb86a13[_0xf296('0x4e')](_0xfba1cf);})[_0xf296('0x46')](handleError(_0xb86a13));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index eb46972..dd5d014 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 _0x68fd=['path','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x4b04c5,_0x55156d){var _0x43a208=function(_0x5c97a4){while(--_0x5c97a4){_0x4b04c5['push'](_0x4b04c5['shift']());}};_0x43a208(++_0x55156d);}(_0x68fd,0x1e9));var _0xd68f=function(_0x54da5b,_0x12fd71){_0x54da5b=_0x54da5b-0x0;var _0x285d3b=_0x68fd[_0x54da5b];return _0x285d3b;};'use strict';var _=require(_0xd68f('0x0'));var util=require('util');var logger=require(_0xd68f('0x1'))(_0xd68f('0x2'));var moment=require('moment');var BPromise=require(_0xd68f('0x3'));var rp=require(_0xd68f('0x4'));var fs=require('fs');var path=require(_0xd68f('0x5'));var rimraf=require(_0xd68f('0x6'));var config=require(_0xd68f('0x7'));var attributes=require(_0xd68f('0x8'));module[_0xd68f('0x9')]=function(_0x52b007,_0xc59f3e){return _0x52b007['define'](_0xd68f('0xa'),attributes,{'tableName':_0xd68f('0xb'),'paranoid':![],'indexes':[{'name':_0xd68f('0xc'),'fields':[_0xd68f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa23f=['define','voice_recordings','uniqueid','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa23f,0x7c));var _0xfa23=function(_0x3475d3,_0x213e5f){_0x3475d3=_0x3475d3-0x0;var _0x78afb8=_0xa23f[_0x3475d3];return _0x78afb8;};'use strict';var _=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfa23('0x2'));var BPromise=require(_0xfa23('0x3'));var rp=require(_0xfa23('0x4'));var fs=require('fs');var path=require(_0xfa23('0x5'));var rimraf=require('rimraf');var config=require(_0xfa23('0x6'));var attributes=require('./voiceRecording.attributes');module[_0xfa23('0x7')]=function(_0x2df2f5,_0x4c3f4){return _0x2df2f5[_0xfa23('0x8')]('VoiceRecording',attributes,{'tableName':_0xfa23('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfa23('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 79c0f0c..609ec21 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(_0x21a2b3,_0x5d6564){var _0x4651a7=function(_0x285f59){while(--_0x285f59){_0x21a2b3['push'](_0x21a2b3['shift']());}};_0x4651a7(++_0x5d6564);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0x27125a,_0x252d0d){var _0x391f7a=function(_0x4068fb){while(--_0x4068fb){_0x27125a['push'](_0x27125a['shift']());}};_0x391f7a(++_0x252d0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 70c533b..2194039 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 _0x326f=['show','post','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x326f,0xd1));var _0xf326=function(_0x1757fc,_0xc79556){_0x1757fc=_0x1757fc-0x0;var _0x2cda58=_0x326f[_0x1757fc];return _0x2cda58;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb4c7=['create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/:id','show','post'];(function(_0x2a70d4,_0x4fc86b){var _0x1040fe=function(_0x19678c){while(--_0x19678c){_0x2a70d4['push'](_0x2a70d4['shift']());}};_0x1040fe(++_0x4fc86b);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x23beac,_0x4749da){_0x23beac=_0x23beac-0x0;var _0x399aa5=_0xb4c7[_0x23beac];return _0x399aa5;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var auth=require(_0x7b4c('0x5'));var interaction=require(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var controller=require(_0x7b4c('0x8'));router[_0x7b4c('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xa')]);router[_0x7b4c('0x9')](_0x7b4c('0xb'),auth['isAuthenticated'](),controller[_0x7b4c('0xc')]);router[_0x7b4c('0xd')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0x12')](_0x7b4c('0xb'),auth[_0x7b4c('0x10')](),controller[_0x7b4c('0x13')]);module[_0x7b4c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 97d6316..2d63672 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 _0xce71=['sequelize','moment','exports','ENUM','attended','STRING','Yes'];(function(_0x325939,_0x30fc6f){var _0x4ea27c=function(_0x24b7f7){while(--_0x24b7f7){_0x325939['push'](_0x325939['shift']());}};_0x4ea27c(++_0x30fc6f);}(_0xce71,0x93));var _0x1ce7=function(_0x612703,_0x24de39){_0x612703=_0x612703-0x0;var _0x5d258a=_0xce71[_0x612703];return _0x5d258a;};'use strict';var Sequelize=require(_0x1ce7('0x0'));var moment=require(_0x1ce7('0x1'));module[_0x1ce7('0x2')]={'type':{'type':Sequelize[_0x1ce7('0x3')]('blind',_0x1ce7('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x1ce7('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x1ce7('0x5')]},'transferercalleridname':{'type':Sequelize[_0x1ce7('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x1ce7('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x1ce7('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x1ce7('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x1ce7('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1ce7('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x1ce7('0x5')]},'transfereecontext':{'type':Sequelize[_0x1ce7('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x1ce7('0x5')]},'isexternal':{'type':Sequelize[_0x1ce7('0x3')](_0x1ce7('0x6'),'No')},'context':{'type':Sequelize[_0x1ce7('0x5')]},'extension':{'type':Sequelize[_0x1ce7('0x5')]}}; \ No newline at end of file +var _0xa3b8=['STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x3d9544,_0x51ab4c){var _0x5c47ae=function(_0xc96eac){while(--_0xc96eac){_0x3d9544['push'](_0x3d9544['shift']());}};_0x5c47ae(++_0x51ab4c);}(_0xa3b8,0x105));var _0x8a3b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa3b8[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x8a3b('0x0'));var moment=require(_0x8a3b('0x1'));module[_0x8a3b('0x2')]={'type':{'type':Sequelize[_0x8a3b('0x3')](_0x8a3b('0x4'),'attended')},'result':{'type':Sequelize[_0x8a3b('0x5')]},'transfererchannel':{'type':Sequelize[_0x8a3b('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x8a3b('0x5')]},'transferercalleridname':{'type':Sequelize[_0x8a3b('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8a3b('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x8a3b('0x5')]},'transferercontext':{'type':Sequelize[_0x8a3b('0x5')]},'transfererexten':{'type':Sequelize[_0x8a3b('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x8a3b('0x5')]},'transfereechannel':{'type':Sequelize[_0x8a3b('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8a3b('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8a3b('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8a3b('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8a3b('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x8a3b('0x5')]},'transfereeexten':{'type':Sequelize[_0x8a3b('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8a3b('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x8a3b('0x6'),'No')},'context':{'type':Sequelize[_0x8a3b('0x5')]},'extension':{'type':Sequelize[_0x8a3b('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index bbe59dd..75000f3 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 _0x9895=['type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName'];(function(_0x271b9f,_0x43e9c7){var _0x4f7f00=function(_0x55d14f){while(--_0x55d14f){_0x271b9f['push'](_0x271b9f['shift']());}};_0x4f7f00(++_0x43e9c7);}(_0x9895,0x14b));var _0x5989=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9895[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x5989('0x0'));var emlformat=require(_0x5989('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5989('0x2'));var jsonpatch=require(_0x5989('0x3'));var rp=require('request-promise');var moment=require(_0x5989('0x4'));var BPromise=require(_0x5989('0x5'));var Mustache=require(_0x5989('0x6'));var util=require(_0x5989('0x7'));var path=require(_0x5989('0x8'));var sox=require(_0x5989('0x9'));var csv=require(_0x5989('0xa'));var ejs=require(_0x5989('0xb'));var fs=require('fs');var _=require(_0x5989('0xc'));var squel=require(_0x5989('0xd'));var crypto=require(_0x5989('0xe'));var jsforce=require(_0x5989('0xf'));var deskjs=require(_0x5989('0x10'));var toCsv=require(_0x5989('0xa'));var querystring=require(_0x5989('0x11'));var Papa=require('papaparse');var Redis=require(_0x5989('0x12'));var authService=require(_0x5989('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5989('0x14'));var logger=require(_0x5989('0x15'))(_0x5989('0x16'));var utils=require('../../config/utils');var config=require(_0x5989('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31df42,_0x1bbd0e){_0x1bbd0e=_0x1bbd0e||0xcc;return function(_0x26bcb9){if(_0x26bcb9){return _0x31df42[_0x5989('0x18')](_0x1bbd0e);}return _0x31df42[_0x5989('0x19')](_0x1bbd0e)[_0x5989('0x1a')]();};}function respondWithResult(_0x2dcd37,_0x7eedec){_0x7eedec=_0x7eedec||0xc8;return function(_0x2834db){if(_0x2834db){return _0x2dcd37['status'](_0x7eedec)[_0x5989('0x1b')](_0x2834db);}};}function respondWithFilteredResult(_0x3afb6b,_0x296a39){return function(_0x3fc9df){if(_0x3fc9df){var _0x1ba956=_0x3fc9df['count'],_0xb518fc=_0x296a39[_0x5989('0x1c')],_0x35ef1d=_0x296a39[_0x5989('0x1c')]+_0x296a39[_0x5989('0x1d')],_0x3171e4;if(_0x35ef1d>=_0x1ba956){_0x35ef1d=_0x1ba956;_0x3171e4=0xc8;}else{_0x3171e4=0xce;}_0x3afb6b['status'](_0x3171e4);return _0x3afb6b[_0x5989('0x1e')](_0x5989('0x1f'),_0xb518fc+'-'+_0x35ef1d+'/'+_0x1ba956)[_0x5989('0x1b')](_0x3fc9df);}return null;};}function patchUpdates(_0x4c4826){return function(_0x2cc738){try{jsonpatch[_0x5989('0x20')](_0x2cc738,_0x4c4826,!![]);}catch(_0x57b56b){return BPromise[_0x5989('0x21')](_0x57b56b);}return _0x2cc738['save']();};}function saveUpdates(_0x217237,_0x581675){return function(_0x3e1c41){if(_0x3e1c41){return _0x3e1c41[_0x5989('0x22')](_0x217237)[_0x5989('0x23')](function(_0x5222fa){return _0x5222fa;});}return null;};}function removeEntity(_0x1e1be6,_0x559f2f){return function(_0x2ba94d){if(_0x2ba94d){return _0x2ba94d['destroy']()[_0x5989('0x23')](function(){_0x1e1be6[_0x5989('0x19')](0xcc)[_0x5989('0x1a')]();});}};}function handleEntityNotFound(_0x1f0690,_0x14c924){return function(_0x20d302){if(!_0x20d302){_0x1f0690[_0x5989('0x18')](0x194);}return _0x20d302;};}function handleError(_0x4c253d,_0x1b8a69){_0x1b8a69=_0x1b8a69||0x1f4;return function(_0x47fd65){logger[_0x5989('0x24')](_0x47fd65[_0x5989('0x25')]);if(_0x47fd65[_0x5989('0x26')]){delete _0x47fd65[_0x5989('0x26')];}_0x4c253d['status'](_0x1b8a69)[_0x5989('0x27')](_0x47fd65);};}exports[_0x5989('0x28')]=function(_0x4e06f1,_0x14b763){var _0x1f375e={},_0x353fa4={},_0x2723bd={'count':0x0,'rows':[]};var _0x24ee89=_['map'](db[_0x5989('0x29')][_0x5989('0x2a')],function(_0x28cecd){return{'name':_0x28cecd[_0x5989('0x2b')],'type':_0x28cecd[_0x5989('0x2c')][_0x5989('0x2d')]};});_0x353fa4[_0x5989('0x2e')]=_[_0x5989('0x2f')](_0x24ee89,'name');_0x353fa4['query']=_[_0x5989('0x30')](_0x4e06f1[_0x5989('0x31')]);_0x353fa4[_0x5989('0x32')]=_[_0x5989('0x33')](_0x353fa4[_0x5989('0x2e')],_0x353fa4[_0x5989('0x31')]);_0x1f375e[_0x5989('0x34')]=_[_0x5989('0x33')](_0x353fa4[_0x5989('0x2e')],qs[_0x5989('0x35')](_0x4e06f1[_0x5989('0x31')][_0x5989('0x35')]));_0x1f375e[_0x5989('0x34')]=_0x1f375e['attributes'][_0x5989('0x36')]?_0x1f375e[_0x5989('0x34')]:_0x353fa4['model'];if(!_0x4e06f1['query'][_0x5989('0x37')](_0x5989('0x38'))){_0x1f375e['limit']=qs[_0x5989('0x1d')](_0x4e06f1[_0x5989('0x31')]['limit']);_0x1f375e[_0x5989('0x1c')]=qs[_0x5989('0x1c')](_0x4e06f1[_0x5989('0x31')]['offset']);}_0x1f375e[_0x5989('0x39')]=qs[_0x5989('0x3a')](_0x4e06f1['query']['sort']);_0x1f375e[_0x5989('0x3b')]=qs[_0x5989('0x32')](_['pick'](_0x4e06f1[_0x5989('0x31')],_0x353fa4['filters']),_0x24ee89);if(_0x4e06f1[_0x5989('0x31')]['filter']){_0x1f375e[_0x5989('0x3b')]=_['merge'](_0x1f375e[_0x5989('0x3b')],{'$or':_[_0x5989('0x2f')](_0x24ee89,function(_0x3accc5){if(_0x3accc5[_0x5989('0x2c')]!==_0x5989('0x3c')){var _0x1fed07={};_0x1fed07[_0x3accc5[_0x5989('0x26')]]={'$like':'%'+_0x4e06f1[_0x5989('0x31')][_0x5989('0x3d')]+'%'};return _0x1fed07;}})});}_0x1f375e=_[_0x5989('0x3e')]({},_0x1f375e,_0x4e06f1[_0x5989('0x3f')]);var _0x5d95cb={'where':_0x1f375e['where']};return db[_0x5989('0x29')][_0x5989('0x40')](_0x5d95cb)[_0x5989('0x23')](function(_0x351294){_0x2723bd['count']=_0x351294;if(_0x4e06f1[_0x5989('0x31')][_0x5989('0x41')]){_0x1f375e['include']=[{'all':!![]}];}return db[_0x5989('0x29')][_0x5989('0x42')](_0x1f375e);})[_0x5989('0x23')](function(_0x408489){_0x2723bd[_0x5989('0x43')]=_0x408489;return _0x2723bd;})[_0x5989('0x23')](respondWithFilteredResult(_0x14b763,_0x1f375e))[_0x5989('0x44')](handleError(_0x14b763,null));};exports[_0x5989('0x45')]=function(_0x10fdc5,_0x396683){var _0x24a26d={'raw':!![],'where':{'id':_0x10fdc5[_0x5989('0x46')]['id']}},_0x4d5428={};_0x4d5428['model']=_[_0x5989('0x30')](db['VoiceTransferReport'][_0x5989('0x2a')]);_0x4d5428[_0x5989('0x31')]=_[_0x5989('0x30')](_0x10fdc5['query']);_0x4d5428['filters']=_['intersection'](_0x4d5428[_0x5989('0x2e')],_0x4d5428[_0x5989('0x31')]);_0x24a26d[_0x5989('0x34')]=_[_0x5989('0x33')](_0x4d5428[_0x5989('0x2e')],qs[_0x5989('0x35')](_0x10fdc5[_0x5989('0x31')]['fields']));_0x24a26d[_0x5989('0x34')]=_0x24a26d[_0x5989('0x34')][_0x5989('0x36')]?_0x24a26d['attributes']:_0x4d5428[_0x5989('0x2e')];if(_0x10fdc5['query'][_0x5989('0x41')]){_0x24a26d[_0x5989('0x47')]=[{'all':!![]}];}_0x24a26d=_[_0x5989('0x3e')]({},_0x24a26d,_0x10fdc5['options']);return db[_0x5989('0x29')][_0x5989('0x48')](_0x24a26d)[_0x5989('0x23')](handleEntityNotFound(_0x396683,null))[_0x5989('0x23')](respondWithResult(_0x396683,null))[_0x5989('0x44')](handleError(_0x396683,null));};exports[_0x5989('0x49')]=function(_0x2ec54a,_0x412c57){return db[_0x5989('0x29')]['create'](_0x2ec54a[_0x5989('0x4a')],{})['then'](respondWithResult(_0x412c57,0xc9))[_0x5989('0x44')](handleError(_0x412c57,null));};exports[_0x5989('0x22')]=function(_0x3c7edf,_0x26b25c){if(_0x3c7edf[_0x5989('0x4a')]['id']){delete _0x3c7edf[_0x5989('0x4a')]['id'];}return db[_0x5989('0x29')]['find']({'where':{'id':_0x3c7edf['params']['id']}})['then'](handleEntityNotFound(_0x26b25c,null))[_0x5989('0x23')](saveUpdates(_0x3c7edf[_0x5989('0x4a')],null))[_0x5989('0x23')](respondWithResult(_0x26b25c,null))[_0x5989('0x44')](handleError(_0x26b25c,null));};exports['destroy']=function(_0x55ef2e,_0x57edbb){return db[_0x5989('0x29')][_0x5989('0x48')]({'where':{'id':_0x55ef2e[_0x5989('0x46')]['id']}})[_0x5989('0x23')](handleEntityNotFound(_0x57edbb,null))[_0x5989('0x23')](removeEntity(_0x57edbb,null))[_0x5989('0x44')](handleError(_0x57edbb,null));}; \ No newline at end of file +var _0xc42b=['../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','then','destroy','end','error','stack','send','index','map','VoiceTransferReport','fieldName','type','key','model','name','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','update','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xf334f5,_0x5a708a){var _0x1009d0=function(_0x5979d0){while(--_0x5979d0){_0xf334f5['push'](_0xf334f5['shift']());}};_0x1009d0(++_0x5a708a);}(_0xc42b,0x109));var _0xbc42=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc42b[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbc42('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbc42('0x1'));var rp=require(_0xbc42('0x2'));var moment=require('moment');var BPromise=require(_0xbc42('0x3'));var Mustache=require(_0xbc42('0x4'));var util=require(_0xbc42('0x5'));var path=require(_0xbc42('0x6'));var sox=require('sox');var csv=require(_0xbc42('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbc42('0x8'));var crypto=require(_0xbc42('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xbc42('0xa'));var toCsv=require(_0xbc42('0x7'));var querystring=require('querystring');var Papa=require(_0xbc42('0xb'));var Redis=require('ioredis');var authService=require(_0xbc42('0xc'));var qs=require(_0xbc42('0xd'));var as=require(_0xbc42('0xe'));var hardwareService=require(_0xbc42('0xf'));var logger=require(_0xbc42('0x10'))(_0xbc42('0x11'));var utils=require(_0xbc42('0x12'));var config=require(_0xbc42('0x13'));var db=require(_0xbc42('0x14'))['db'];function respondWithStatusCode(_0x49d00d,_0x3ab74f){_0x3ab74f=_0x3ab74f||0xcc;return function(_0x1c1696){if(_0x1c1696){return _0x49d00d[_0xbc42('0x15')](_0x3ab74f);}return _0x49d00d[_0xbc42('0x16')](_0x3ab74f)['end']();};}function respondWithResult(_0x4ca006,_0x3d7f92){_0x3d7f92=_0x3d7f92||0xc8;return function(_0x2c0d82){if(_0x2c0d82){return _0x4ca006[_0xbc42('0x16')](_0x3d7f92)[_0xbc42('0x17')](_0x2c0d82);}};}function respondWithFilteredResult(_0x4a08a5,_0x16e3fd){return function(_0x1ad0b3){if(_0x1ad0b3){var _0x2619bf=_0x1ad0b3[_0xbc42('0x18')],_0x4baad4=_0x16e3fd[_0xbc42('0x19')],_0x555700=_0x16e3fd[_0xbc42('0x19')]+_0x16e3fd['limit'],_0x2a12b5;if(_0x555700>=_0x2619bf){_0x555700=_0x2619bf;_0x2a12b5=0xc8;}else{_0x2a12b5=0xce;}_0x4a08a5['status'](_0x2a12b5);return _0x4a08a5[_0xbc42('0x1a')](_0xbc42('0x1b'),_0x4baad4+'-'+_0x555700+'/'+_0x2619bf)[_0xbc42('0x17')](_0x1ad0b3);}return null;};}function patchUpdates(_0x93f203){return function(_0x46a0a6){try{jsonpatch[_0xbc42('0x1c')](_0x46a0a6,_0x93f203,!![]);}catch(_0x1cb6ed){return BPromise['reject'](_0x1cb6ed);}return _0x46a0a6['save']();};}function saveUpdates(_0x529323,_0x5b17ba){return function(_0x228cef){if(_0x228cef){return _0x228cef['update'](_0x529323)[_0xbc42('0x1d')](function(_0x2c308c){return _0x2c308c;});}return null;};}function removeEntity(_0xaaf132,_0x384167){return function(_0x47ea81){if(_0x47ea81){return _0x47ea81[_0xbc42('0x1e')]()[_0xbc42('0x1d')](function(){_0xaaf132['status'](0xcc)[_0xbc42('0x1f')]();});}};}function handleEntityNotFound(_0x4e839a,_0x422e09){return function(_0x1153f3){if(!_0x1153f3){_0x4e839a[_0xbc42('0x15')](0x194);}return _0x1153f3;};}function handleError(_0x20d1d1,_0x45b523){_0x45b523=_0x45b523||0x1f4;return function(_0x1e7ed6){logger[_0xbc42('0x20')](_0x1e7ed6[_0xbc42('0x21')]);if(_0x1e7ed6['name']){delete _0x1e7ed6['name'];}_0x20d1d1[_0xbc42('0x16')](_0x45b523)[_0xbc42('0x22')](_0x1e7ed6);};}exports[_0xbc42('0x23')]=function(_0x25eabf,_0x46f876){var _0x4a8c49={},_0x3efa1d={},_0x110aab={'count':0x0,'rows':[]};var _0x1f1878=_[_0xbc42('0x24')](db[_0xbc42('0x25')]['rawAttributes'],function(_0x22c84e){return{'name':_0x22c84e[_0xbc42('0x26')],'type':_0x22c84e[_0xbc42('0x27')][_0xbc42('0x28')]};});_0x3efa1d[_0xbc42('0x29')]=_[_0xbc42('0x24')](_0x1f1878,_0xbc42('0x2a'));_0x3efa1d['query']=_[_0xbc42('0x2b')](_0x25eabf[_0xbc42('0x2c')]);_0x3efa1d[_0xbc42('0x2d')]=_['intersection'](_0x3efa1d['model'],_0x3efa1d[_0xbc42('0x2c')]);_0x4a8c49[_0xbc42('0x2e')]=_[_0xbc42('0x2f')](_0x3efa1d[_0xbc42('0x29')],qs['fields'](_0x25eabf[_0xbc42('0x2c')]['fields']));_0x4a8c49[_0xbc42('0x2e')]=_0x4a8c49[_0xbc42('0x2e')][_0xbc42('0x30')]?_0x4a8c49['attributes']:_0x3efa1d[_0xbc42('0x29')];if(!_0x25eabf[_0xbc42('0x2c')][_0xbc42('0x31')](_0xbc42('0x32'))){_0x4a8c49['limit']=qs[_0xbc42('0x33')](_0x25eabf[_0xbc42('0x2c')][_0xbc42('0x33')]);_0x4a8c49['offset']=qs['offset'](_0x25eabf['query'][_0xbc42('0x19')]);}_0x4a8c49['order']=qs['sort'](_0x25eabf[_0xbc42('0x2c')][_0xbc42('0x34')]);_0x4a8c49['where']=qs[_0xbc42('0x2d')](_['pick'](_0x25eabf['query'],_0x3efa1d[_0xbc42('0x2d')]),_0x1f1878);if(_0x25eabf['query'][_0xbc42('0x35')]){_0x4a8c49[_0xbc42('0x36')]=_[_0xbc42('0x37')](_0x4a8c49[_0xbc42('0x36')],{'$or':_['map'](_0x1f1878,function(_0x3bcb92){if(_0x3bcb92[_0xbc42('0x27')]!==_0xbc42('0x38')){var _0x1b1627={};_0x1b1627[_0x3bcb92[_0xbc42('0x2a')]]={'$like':'%'+_0x25eabf[_0xbc42('0x2c')][_0xbc42('0x35')]+'%'};return _0x1b1627;}})});}_0x4a8c49=_['merge']({},_0x4a8c49,_0x25eabf[_0xbc42('0x39')]);var _0x34c1d9={'where':_0x4a8c49[_0xbc42('0x36')]};return db[_0xbc42('0x25')][_0xbc42('0x18')](_0x34c1d9)[_0xbc42('0x1d')](function(_0x48029f){_0x110aab[_0xbc42('0x18')]=_0x48029f;if(_0x25eabf[_0xbc42('0x2c')][_0xbc42('0x3a')]){_0x4a8c49[_0xbc42('0x3b')]=[{'all':!![]}];}return db[_0xbc42('0x25')][_0xbc42('0x3c')](_0x4a8c49);})[_0xbc42('0x1d')](function(_0x4a398c){_0x110aab[_0xbc42('0x3d')]=_0x4a398c;return _0x110aab;})[_0xbc42('0x1d')](respondWithFilteredResult(_0x46f876,_0x4a8c49))[_0xbc42('0x3e')](handleError(_0x46f876,null));};exports[_0xbc42('0x3f')]=function(_0x10a51f,_0x4df378){var _0xf32110={'raw':!![],'where':{'id':_0x10a51f[_0xbc42('0x40')]['id']}},_0x1136b9={};_0x1136b9[_0xbc42('0x29')]=_[_0xbc42('0x2b')](db['VoiceTransferReport'][_0xbc42('0x41')]);_0x1136b9[_0xbc42('0x2c')]=_['keys'](_0x10a51f['query']);_0x1136b9[_0xbc42('0x2d')]=_[_0xbc42('0x2f')](_0x1136b9[_0xbc42('0x29')],_0x1136b9['query']);_0xf32110[_0xbc42('0x2e')]=_[_0xbc42('0x2f')](_0x1136b9[_0xbc42('0x29')],qs[_0xbc42('0x42')](_0x10a51f[_0xbc42('0x2c')][_0xbc42('0x42')]));_0xf32110[_0xbc42('0x2e')]=_0xf32110['attributes']['length']?_0xf32110[_0xbc42('0x2e')]:_0x1136b9['model'];if(_0x10a51f[_0xbc42('0x2c')][_0xbc42('0x3a')]){_0xf32110[_0xbc42('0x3b')]=[{'all':!![]}];}_0xf32110=_[_0xbc42('0x37')]({},_0xf32110,_0x10a51f[_0xbc42('0x39')]);return db[_0xbc42('0x25')][_0xbc42('0x43')](_0xf32110)[_0xbc42('0x1d')](handleEntityNotFound(_0x4df378,null))[_0xbc42('0x1d')](respondWithResult(_0x4df378,null))[_0xbc42('0x3e')](handleError(_0x4df378,null));};exports['create']=function(_0x3232e5,_0x14d8dc){return db[_0xbc42('0x25')][_0xbc42('0x44')](_0x3232e5['body'],{})[_0xbc42('0x1d')](respondWithResult(_0x14d8dc,0xc9))[_0xbc42('0x3e')](handleError(_0x14d8dc,null));};exports[_0xbc42('0x45')]=function(_0x4871b2,_0x295d6d){if(_0x4871b2[_0xbc42('0x46')]['id']){delete _0x4871b2[_0xbc42('0x46')]['id'];}return db[_0xbc42('0x25')][_0xbc42('0x43')]({'where':{'id':_0x4871b2[_0xbc42('0x40')]['id']}})[_0xbc42('0x1d')](handleEntityNotFound(_0x295d6d,null))['then'](saveUpdates(_0x4871b2[_0xbc42('0x46')],null))[_0xbc42('0x1d')](respondWithResult(_0x295d6d,null))[_0xbc42('0x3e')](handleError(_0x295d6d,null));};exports[_0xbc42('0x1e')]=function(_0x2239a8,_0x3bd77e){return db[_0xbc42('0x25')][_0xbc42('0x43')]({'where':{'id':_0x2239a8[_0xbc42('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bd77e,null))[_0xbc42('0x1d')](removeEntity(_0x3bd77e,null))['catch'](handleError(_0x3bd77e,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index fa1aceb..ddd354b 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 _0x5357=['../../config/logger','api','request-promise','path','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','util'];(function(_0x4031b4,_0x198544){var _0x2d4eb9=function(_0x15360c){while(--_0x15360c){_0x4031b4['push'](_0x4031b4['shift']());}};_0x2d4eb9(++_0x198544);}(_0x5357,0x7d));var _0x7535=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x5357[_0x4b2863];return _0x567d67;};'use strict';var _=require('lodash');var util=require(_0x7535('0x0'));var logger=require(_0x7535('0x1'))(_0x7535('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7535('0x3'));var fs=require('fs');var path=require(_0x7535('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7535('0x5'));module[_0x7535('0x6')]=function(_0x2edfdc,_0xee9fa3){return _0x2edfdc[_0x7535('0x7')](_0x7535('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf64=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','report_call_transfer','util'];(function(_0x427b2a,_0x181905){var _0x239493=function(_0x3602c6){while(--_0x3602c6){_0x427b2a['push'](_0x427b2a['shift']());}};_0x239493(++_0x181905);}(_0xcf64,0x15f));var _0x4cf6=function(_0x2ed99b,_0x230ef0){_0x2ed99b=_0x2ed99b-0x0;var _0x3e8c84=_0xcf64[_0x2ed99b];return _0x3e8c84;};'use strict';var _=require('lodash');var util=require(_0x4cf6('0x0'));var logger=require(_0x4cf6('0x1'))(_0x4cf6('0x2'));var moment=require(_0x4cf6('0x3'));var BPromise=require('bluebird');var rp=require(_0x4cf6('0x4'));var fs=require('fs');var path=require(_0x4cf6('0x5'));var rimraf=require(_0x4cf6('0x6'));var config=require(_0x4cf6('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x4cf6('0x8')]=function(_0x5ab909,_0x24474d){return _0x5ab909[_0x4cf6('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x4cf6('0xa'),'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 bbd7dae..bd55f2d 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 _0x51cb=['error','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','info','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x34ed48,_0x2cc995){var _0x37da5c=function(_0x5b6e16){while(--_0x5b6e16){_0x34ed48['push'](_0x34ed48['shift']());}};_0x37da5c(++_0x2cc995);}(_0x51cb,0xb1));var _0xb51c=function(_0x34f33d,_0x48e914){_0x34f33d=_0x34f33d-0x0;var _0x456ffe=_0x51cb[_0x34f33d];return _0x456ffe;};'use strict';var _=require(_0xb51c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb51c('0x1'));var fs=require('fs');var Redis=require(_0xb51c('0x2'));var db=require(_0xb51c('0x3'))['db'];var utils=require(_0xb51c('0x4'));var logger=require(_0xb51c('0x5'))(_0xb51c('0x6'));var config=require(_0xb51c('0x7'));var jayson=require(_0xb51c('0x8'));var client=jayson[_0xb51c('0x9')][_0xb51c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x265c8e,_0x25d417,_0x2e7871){return new BPromise(function(_0x2a0a86,_0x12d79a){return client[_0xb51c('0xb')](_0x265c8e,_0x2e7871)[_0xb51c('0xc')](function(_0x11f46d){logger['info'](_0xb51c('0xd'),_0x25d417,_0xb51c('0xe'));logger[_0xb51c('0xf')](_0xb51c('0x10'),_0x25d417,_0xb51c('0xe'),JSON[_0xb51c('0x11')](_0x11f46d));if(_0x11f46d['error']){if(_0x11f46d['error'][_0xb51c('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x25d417,_0x11f46d[_0xb51c('0x13')][_0xb51c('0x14')]);return _0x12d79a(_0x11f46d[_0xb51c('0x13')]['message']);}logger[_0xb51c('0x13')](_0xb51c('0xd'),_0x25d417,_0x11f46d[_0xb51c('0x13')][_0xb51c('0x14')]);return _0x2a0a86(_0x11f46d[_0xb51c('0x13')][_0xb51c('0x14')]);}else{logger['info'](_0xb51c('0xd'),_0x25d417,_0xb51c('0xe'));_0x2a0a86(_0x11f46d['result'][_0xb51c('0x14')]);}})[_0xb51c('0x15')](function(_0x18b87a){logger[_0xb51c('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x25d417,_0x18b87a);_0x12d79a(_0x18b87a);});});}exports[_0xb51c('0x16')]=function(_0xccd31b){var _0x55614f=this;return new Promise(function(_0x3af866,_0x1f95b6){return db[_0xb51c('0x17')][_0xb51c('0x18')](_0xccd31b[_0xb51c('0x19')],{'raw':_0xccd31b[_0xb51c('0x1a')]?_0xccd31b[_0xb51c('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xc3cb0d){logger[_0xb51c('0x1b')](_0xb51c('0x16'),_0xccd31b);logger[_0xb51c('0xf')](_0xb51c('0x16'),_0xccd31b,JSON[_0xb51c('0x11')](_0xc3cb0d));_0x3af866(_0xc3cb0d);})[_0xb51c('0x15')](function(_0x2ab35b){logger[_0xb51c('0x13')](_0xb51c('0x16'),_0x2ab35b[_0xb51c('0x14')],_0xccd31b);_0x1f95b6(_0x55614f[_0xb51c('0x13')](0x1f4,_0x2ab35b['message']));});});}; \ No newline at end of file +var _0x2542=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','catch','lodash'];(function(_0x1505e5,_0x5cc291){var _0x5b1dcd=function(_0x18bfe5){while(--_0x18bfe5){_0x1505e5['push'](_0x1505e5['shift']());}};_0x5b1dcd(++_0x5cc291);}(_0x2542,0x1b2));var _0x2254=function(_0x1b34a9,_0x7cab18){_0x1b34a9=_0x1b34a9-0x0;var _0xf9051e=_0x2542[_0x1b34a9];return _0xf9051e;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require(_0x2254('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2254('0x5'))['db'];var utils=require(_0x2254('0x6'));var logger=require(_0x2254('0x7'))(_0x2254('0x8'));var config=require('../../config/environment');var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc813c6,_0x37cb1b,_0x1cdd49){return new BPromise(function(_0x5a4e52,_0x5bf3f3){return client[_0x2254('0xb')](_0xc813c6,_0x1cdd49)[_0x2254('0xc')](function(_0x35c44e){logger[_0x2254('0xd')](_0x2254('0xe'),_0x37cb1b,_0x2254('0xf'));logger[_0x2254('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x37cb1b,_0x2254('0xf'),JSON[_0x2254('0x11')](_0x35c44e));if(_0x35c44e[_0x2254('0x12')]){if(_0x35c44e[_0x2254('0x12')][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x37cb1b,_0x35c44e[_0x2254('0x12')][_0x2254('0x14')]);return _0x5bf3f3(_0x35c44e[_0x2254('0x12')][_0x2254('0x14')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x37cb1b,_0x35c44e[_0x2254('0x12')][_0x2254('0x14')]);return _0x5a4e52(_0x35c44e[_0x2254('0x12')][_0x2254('0x14')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x37cb1b,'request\x20sent');_0x5a4e52(_0x35c44e[_0x2254('0x15')]['message']);}})['catch'](function(_0x3001c9){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x37cb1b,_0x3001c9);_0x5bf3f3(_0x3001c9);});});}exports[_0x2254('0x16')]=function(_0x19ec72){var _0xd286b3=this;return new Promise(function(_0x262d1c,_0x325cd5){return db[_0x2254('0x17')][_0x2254('0x18')](_0x19ec72[_0x2254('0x19')],{'raw':_0x19ec72[_0x2254('0x1a')]?_0x19ec72[_0x2254('0x1a')][_0x2254('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3f895c){logger[_0x2254('0xd')]('CreateVoiceTransferReport',_0x19ec72);logger['debug'](_0x2254('0x16'),_0x19ec72,JSON[_0x2254('0x11')](_0x3f895c));_0x262d1c(_0x3f895c);})[_0x2254('0x1c')](function(_0x271347){logger[_0x2254('0x12')](_0x2254('0x16'),_0x271347['message'],_0x19ec72);_0x325cd5(_0xd286b3[_0x2254('0x12')](0x1f4,_0x271347['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 652c179..723c0c8 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 _0x1d5b=['isAuthenticated','canUpdate','originate','hangup','/answer','answer','/unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','post'];(function(_0x91e917,_0x280010){var _0x4a0d09=function(_0xb83d86){while(--_0xb83d86){_0x91e917['push'](_0x91e917['shift']());}};_0x4a0d09(++_0x280010);}(_0x1d5b,0x13c));var _0xb1d5=function(_0xea2742,_0x32af37){_0xea2742=_0xea2742-0x0;var _0x54833c=_0x1d5b[_0xea2742];return _0x54833c;};'use strict';var express=require(_0xb1d5('0x0'));var router=express[_0xb1d5('0x1')]();var auth=require(_0xb1d5('0x2'));var controller=require('./webbar.controller');router[_0xb1d5('0x3')]('/originate',auth[_0xb1d5('0x4')](),auth[_0xb1d5('0x5')](),controller[_0xb1d5('0x6')]);router[_0xb1d5('0x3')]('/hangup',auth['isAuthenticated'](),auth[_0xb1d5('0x5')](),controller[_0xb1d5('0x7')]);router[_0xb1d5('0x3')](_0xb1d5('0x8'),auth[_0xb1d5('0x4')](),auth[_0xb1d5('0x5')](),controller[_0xb1d5('0x9')]);router[_0xb1d5('0x3')]('/hold',auth[_0xb1d5('0x4')](),auth[_0xb1d5('0x5')](),controller['hold']);router['post'](_0xb1d5('0xa'),auth[_0xb1d5('0x4')](),auth[_0xb1d5('0x5')](),controller['unhold']);router[_0xb1d5('0x3')](_0xb1d5('0xb'),auth[_0xb1d5('0x4')](),auth['canUpdate'](),controller[_0xb1d5('0xc')]);router[_0xb1d5('0x3')](_0xb1d5('0xd'),auth[_0xb1d5('0x4')](),auth['canUpdate'](),controller[_0xb1d5('0xe')]);module[_0xb1d5('0xf')]=router; \ No newline at end of file +var _0xfaa4=['calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','canUpdate','originate','/hangup','hangup','answer','/hold','hold','/unhold','isAuthenticated','/calls'];(function(_0x31d0e0,_0x44fe32){var _0x21407b=function(_0x4d6927){while(--_0x4d6927){_0x31d0e0['push'](_0x31d0e0['shift']());}};_0x21407b(++_0x44fe32);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x3c3c80,_0x10de81){_0x3c3c80=_0x3c3c80-0x0;var _0x489e94=_0xfaa4[_0x3c3c80];return _0x489e94;};'use strict';var express=require(_0x4faa('0x0'));var router=express[_0x4faa('0x1')]();var auth=require(_0x4faa('0x2'));var controller=require(_0x4faa('0x3'));router[_0x4faa('0x4')](_0x4faa('0x5'),auth['isAuthenticated'](),auth[_0x4faa('0x6')](),controller[_0x4faa('0x7')]);router[_0x4faa('0x4')](_0x4faa('0x8'),auth['isAuthenticated'](),auth[_0x4faa('0x6')](),controller[_0x4faa('0x9')]);router[_0x4faa('0x4')]('/answer',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4faa('0xa')]);router[_0x4faa('0x4')](_0x4faa('0xb'),auth['isAuthenticated'](),auth[_0x4faa('0x6')](),controller[_0x4faa('0xc')]);router[_0x4faa('0x4')](_0x4faa('0xd'),auth[_0x4faa('0xe')](),auth['canUpdate'](),controller['unhold']);router[_0x4faa('0x4')](_0x4faa('0xf'),auth[_0x4faa('0xe')](),auth[_0x4faa('0x6')](),controller[_0x4faa('0x10')]);router[_0x4faa('0x4')](_0x4faa('0x11'),auth[_0x4faa('0xe')](),auth[_0x4faa('0x6')](),controller[_0x4faa('0x12')]);module[_0x4faa('0x13')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1a54f46..7eb16ed 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 _0xb43b=['localhost','socket.io-emitter','redis','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','emit','handleError:','stack','name','send','status','request','error','code','result','catch','User','findOne','agent','VoiceChannels','all','then','filter','rows','sessionId','originate','info','originate\x20fired:','body','length','json','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','userId','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','UserId','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','defaults'];(function(_0x187785,_0xbd2c11){var _0x390aeb=function(_0x438ceb){while(--_0x438ceb){_0x187785['push'](_0x187785['shift']());}};_0x390aeb(++_0xbd2c11);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4f7ba6,_0x19a2c9){_0x4f7ba6=_0x4f7ba6-0x0;var _0xfb1f81=_0xb43b[_0x4f7ba6];return _0xfb1f81;};'use strict';var path=require(_0xbb43('0x0'));var fs=require('fs');var _=require(_0xbb43('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xbb43('0x2'));var util=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xbb43('0x5')][_0xbb43('0x6')]({'port':0x232a});var logger=require(_0xbb43('0x7'))(_0xbb43('0x8'));var Redis=require('ioredis');config['redis']=_[_0xbb43('0x9')](config['redis'],{'host':_0xbb43('0xa'),'port':0x18eb});var io=require(_0xbb43('0xb'))(new Redis(config[_0xbb43('0xc')]));var Schema=require(_0xbb43('0xd'));var originateValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xbb43('0xf'),'required':[!![],_0xbb43('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xbb43('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':_0xbb43('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xbb43('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xbb43('0xe'),'required':[!![],_0xbb43('0x11')]}});function emit(_0x57bd1d,_0x526330,_0x202980){logger['info'](_0x57bd1d,_0x526330,JSON['stringify'](_0x202980));io['to'](_0x57bd1d)[_0xbb43('0x12')](_0x526330,_0x202980);}function handleError(_0x8242ab){return function(_0x2e3b43){console['log'](_0xbb43('0x13'),_0x2e3b43,_0x2e3b43 instanceof RangeError);logger['error'](_0x2e3b43[_0xbb43('0x14')]);if(_0x2e3b43 instanceof RangeError){if(_0x2e3b43[_0xbb43('0x15')]){delete _0x2e3b43['name'];}_0x8242ab['status'](0x194)[_0xbb43('0x16')](_0x2e3b43);}else{if(_0x2e3b43[_0xbb43('0x15')]){delete _0x2e3b43[_0xbb43('0x15')];}_0x8242ab[_0xbb43('0x17')](0x1f4)['send'](_0x2e3b43);}};}function checkError(){return function(_0x40a650){if(!_0x40a650){throw new RangeError('NotFound');}return _0x40a650;};}function respondWithRpcPromise(_0x3a257d,_0x4bfaca){return new BPromise(function(_0x2f5e31,_0x565256){var _0x3f323e=amiClient;return _0x3f323e[_0xbb43('0x18')](_0x3a257d,_0x4bfaca)['then'](function(_0x1d0768){if(_0x1d0768['error']){if(_0x1d0768[_0xbb43('0x19')][_0xbb43('0x1a')]===0x1f4){return _0x565256(_0x1d0768[_0xbb43('0x19')]['message']);}return _0x2f5e31(_0x1d0768['error']['message']);}else{_0x2f5e31(_0x1d0768[_0xbb43('0x1b')]);}})[_0xbb43('0x1c')](function(_0x5d8310){_0x565256(_0x5d8310);});});}function getAgent(_0x3b3083){return db[_0xbb43('0x1d')][_0xbb43('0x1e')]({'where':{'id':_0x3b3083,'role':_0xbb43('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x4b5342,_0x27fd7a){return new BPromise(function(_0x42800f,_0xa88db0){var _0x8b3205=respondWithRpcPromise(_0xbb43('0x20'));var _0x40b04b=getAgent(_0x4b5342);Promise[_0xbb43('0x21')]([_0x8b3205,_0x40b04b])[_0xbb43('0x22')](function(_0x539730){var _0x2ad6da=_0x539730[0x0];var _0x56fe33=_0x539730[0x1];var _0x31fbc8=_[_0xbb43('0x23')](_0x2ad6da[_0xbb43('0x24')],function(_0x1880cd){return _0x1880cd['UserId']==_0x56fe33['id']&&_0x1880cd[_0xbb43('0x25')]==_0x27fd7a;});if(_0x31fbc8['length']==0x1){_0x42800f(_0x56fe33);}else{_0xa88db0(new RangeError('sessionId\x20'+_0x27fd7a+'\x20not\x20found!'));}});});}exports[_0xbb43('0x26')]=function(_0x573a05,_0xa7e144){logger[_0xbb43('0x27')](_0xbb43('0x28'),_0x573a05['body']);var _0x205011=originateValidation[_0xbb43('0xd')](_0x573a05[_0xbb43('0x29')]);if(_0x205011[_0xbb43('0x2a')]>0x0){return _0xa7e144[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x205011);}var _0x3de482=_0x573a05[_0xbb43('0x29')]['userId'];var _0x2109aa=_0x573a05[_0xbb43('0x29')][_0xbb43('0x2c')];var _0x244d66=_0x573a05[_0xbb43('0x29')][_0xbb43('0x2d')];var _0x1eae09=_0x573a05[_0xbb43('0x29')][_0xbb43('0x2e')];return getAgent(_0x3de482)[_0xbb43('0x22')](function(_0x21346a){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x21346a[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')](_0xbb43('0x31'),_0x21346a['name']),_0xbb43('0x32'),{'callNumber':_0x2109aa,'callerId':_0x244d66,'callbackUrl':_0x1eae09});return _0xa7e144[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x33')});})[_0xbb43('0x1c')](handleError(_0xa7e144));};exports[_0xbb43('0x34')]=function(_0x5374a2,_0x5f4601){logger['info'](_0xbb43('0x35'),_0x5374a2[_0xbb43('0x29')]);var _0x4a95c3=hangupValidation['validate'](_0x5374a2[_0xbb43('0x29')]);if(_0x4a95c3[_0xbb43('0x2a')]>0x0){return _0x5f4601[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x4a95c3);}var _0x3f9e7f=_0x5374a2['body'][_0xbb43('0x36')];var _0x526cb8=_0x5374a2[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x3f9e7f)[_0xbb43('0x22')](function(_0x531d96){logger[_0xbb43('0x27')]('entityFound:',_0x531d96[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')]('user:%s',_0x531d96[_0xbb43('0x15')]),'webbar:hangup',{'sessionId':_0x526cb8});return _0x5f4601[_0xbb43('0x17')](0xc8)[_0xbb43('0x2b')]({'error':![],'message':_0xbb43('0x37')});})[_0xbb43('0x1c')](handleError(_0x5f4601));};exports['answer']=function(_0x3e0871,_0x136bd4){logger['info'](_0xbb43('0x38'),_0x3e0871['body']);var _0x42b965=answerValidation[_0xbb43('0xd')](_0x3e0871[_0xbb43('0x29')]);if(_0x42b965[_0xbb43('0x2a')]>0x0){return _0x136bd4[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x42b965);}var _0x4bf8ed=_0x3e0871[_0xbb43('0x29')]['userId'];var _0x307f1e=_0x3e0871[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x4bf8ed)[_0xbb43('0x22')](function(_0x4970fb){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x4970fb[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')](_0xbb43('0x31'),_0x4970fb[_0xbb43('0x15')]),_0xbb43('0x39'),{'sessionId':_0x307f1e});return _0x136bd4[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x3a')});})[_0xbb43('0x1c')](handleError(_0x136bd4));};exports['hold']=function(_0x1a66f0,_0x5d4c19){logger['info']('hold\x20fired:',_0x1a66f0['body']);var _0x1c3482=holdValidation['validate'](_0x1a66f0[_0xbb43('0x29')]);if(_0x1c3482['length']>0x0){return _0x5d4c19[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x1c3482);}var _0x1f3fb4=_0x1a66f0['body'][_0xbb43('0x36')];var _0x4d9f18=_0x1a66f0[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x1f3fb4)[_0xbb43('0x22')](function(_0x29840e){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x29840e[_0xbb43('0x15')]);emit(util['format'](_0xbb43('0x31'),_0x29840e[_0xbb43('0x15')]),_0xbb43('0x3b'),{'sessionId':_0x4d9f18});return _0x5d4c19[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x3c')});})[_0xbb43('0x1c')](handleError(_0x5d4c19));};exports[_0xbb43('0x3d')]=function(_0xb1883e,_0x4b7712){logger[_0xbb43('0x27')](_0xbb43('0x3e'),_0xb1883e[_0xbb43('0x29')]);var _0x4e1959=unholdValidation[_0xbb43('0xd')](_0xb1883e[_0xbb43('0x29')]);if(_0x4e1959[_0xbb43('0x2a')]>0x0){return _0x4b7712[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x4e1959);}var _0x59c805=_0xb1883e['body'][_0xbb43('0x36')];var _0x5c75ba=_0xb1883e[_0xbb43('0x29')][_0xbb43('0x25')];return getAgent(_0x59c805)['then'](function(_0x29aea0){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x29aea0[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')]('user:%s',_0x29aea0[_0xbb43('0x15')]),'webbar:unhold',{'sessionId':_0x5c75ba});return _0x4b7712['status'](0xc8)[_0xbb43('0x2b')]({'error':![],'message':_0xbb43('0x3f')});})[_0xbb43('0x1c')](handleError(_0x4b7712));};exports[_0xbb43('0x40')]=function(_0x129ee6,_0x5db053){logger['info'](_0xbb43('0x41'),_0x5db053[_0xbb43('0x29')]);var _0x3a84ad=callsValidation[_0xbb43('0xd')](_0x129ee6[_0xbb43('0x29')]);if(_0x3a84ad[_0xbb43('0x2a')]>0x0){return _0x5db053[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x3a84ad);}var _0x1a3f98=_0x129ee6['body'][_0xbb43('0x36')];var _0xb996d7=respondWithRpcPromise(_0xbb43('0x20'));var _0x3675d9=getAgent(_0x1a3f98);return Promise[_0xbb43('0x21')]([_0xb996d7,_0x3675d9])[_0xbb43('0x22')](function(_0x3f7262){var _0x3589fd=_0x3f7262[0x0];var _0x3e01e4=_0x3f7262[0x1];var _0x49a54e=_['filter'](_0x3589fd[_0xbb43('0x24')],function(_0x2b72ae){return _0x2b72ae[_0xbb43('0x42')]==_0x3e01e4['id'];});return _0x5db053[_0xbb43('0x17')](0xc8)[_0xbb43('0x2b')]({'count':_0x49a54e[_0xbb43('0x2a')],'rows':_0x49a54e});})[_0xbb43('0x1c')](handleError(_0x5db053));};exports['conference']=function(_0x3bda63,_0x599eec){logger['info'](_0xbb43('0x43'),_0x3bda63[_0xbb43('0x29')]);var _0x3cccea=conferenceValidation[_0xbb43('0xd')](_0x3bda63[_0xbb43('0x29')]);if(_0x3cccea[_0xbb43('0x2a')]>0x0){return _0x599eec[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x3cccea);}var _0x51b076=_0x3bda63['body'][_0xbb43('0x36')];return getAgent(_0x51b076)[_0xbb43('0x22')](function(_0x137e75){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x137e75[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')](_0xbb43('0x31'),_0x137e75[_0xbb43('0x15')]),'webbar:conference');return _0x599eec[_0xbb43('0x17')](0xc8)[_0xbb43('0x2b')]({'error':![],'message':_0xbb43('0x44')});})[_0xbb43('0x1c')](handleError(_0x599eec));};exports[_0xbb43('0x45')]=function(_0x33a4db,_0x5745eb){logger[_0xbb43('0x27')](_0xbb43('0x46'),_0x33a4db[_0xbb43('0x29')]);var _0x6d3bb1=transferValidation[_0xbb43('0xd')](_0x33a4db['body']);if(_0x6d3bb1[_0xbb43('0x2a')]>0x0){return _0x5745eb[_0xbb43('0x17')](0x190)[_0xbb43('0x2b')](_0x6d3bb1);}var _0x231b11=_0x33a4db[_0xbb43('0x29')][_0xbb43('0x36')];var _0x2bd30e=_0x33a4db[_0xbb43('0x29')][_0xbb43('0x25')];var _0x3ab906=_0x33a4db['body'][_0xbb43('0x47')];return getAgent(_0x231b11)['then'](function(_0x2b9e5d){logger[_0xbb43('0x27')](_0xbb43('0x2f'),_0x2b9e5d[_0xbb43('0x15')]);emit(util[_0xbb43('0x30')]('user:%s',_0x2b9e5d['name']),_0xbb43('0x48'),{'sessionId':_0x2bd30e,'transferNumber':_0x3ab906});return _0x5745eb[_0xbb43('0x17')](0xc8)['json']({'error':![],'message':_0xbb43('0x49')});})[_0xbb43('0x1c')](handleError(_0x5745eb));}; \ No newline at end of file +var _0x44f8=['hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','bluebird','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','result','catch','findOne','agent','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x44f8,0xfb));var _0x844f=function(_0x1e39fa,_0x5d7a28){_0x1e39fa=_0x1e39fa-0x0;var _0x27d1a6=_0x44f8[_0x1e39fa];return _0x27d1a6;};'use strict';var path=require(_0x844f('0x0'));var fs=require('fs');var _=require(_0x844f('0x1'));var db=require(_0x844f('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x844f('0x3'));var BPromise=require(_0x844f('0x4'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x844f('0x5')]({'port':0x232a});var logger=require(_0x844f('0x6'))(_0x844f('0x7'));var Redis=require('ioredis');config[_0x844f('0x8')]=_[_0x844f('0x9')](config[_0x844f('0x8')],{'host':_0x844f('0xa'),'port':0x18eb});var io=require(_0x844f('0xb'))(new Redis(config[_0x844f('0x8')]));var Schema=require(_0x844f('0xc'));var originateValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x844f('0xe'),'required':[!![],_0x844f('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x844f('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],_0x844f('0x10')]},'sessionId':{'type':_0x844f('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],_0x844f('0x10')]},'sessionId':{'type':_0x844f('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0x844f('0x11')]},'transferNumber':{'type':'string','required':[!![],_0x844f('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],_0x844f('0x10')]},'sessionId':{'type':_0x844f('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],_0x844f('0x10')]},'sessionId':{'type':_0x844f('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],_0x844f('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x844f('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x5e3653,_0x29f7b4,_0x37d26a){logger[_0x844f('0x13')](_0x5e3653,_0x29f7b4,JSON[_0x844f('0x14')](_0x37d26a));io['to'](_0x5e3653)[_0x844f('0x15')](_0x29f7b4,_0x37d26a);}function handleError(_0x5873e2){return function(_0x4d8a0a){console[_0x844f('0x16')](_0x844f('0x17'),_0x4d8a0a,_0x4d8a0a instanceof RangeError);logger['error'](_0x4d8a0a[_0x844f('0x18')]);if(_0x4d8a0a instanceof RangeError){if(_0x4d8a0a[_0x844f('0x19')]){delete _0x4d8a0a[_0x844f('0x19')];}_0x5873e2[_0x844f('0x1a')](0x194)[_0x844f('0x1b')](_0x4d8a0a);}else{if(_0x4d8a0a[_0x844f('0x19')]){delete _0x4d8a0a[_0x844f('0x19')];}_0x5873e2['status'](0x1f4)[_0x844f('0x1b')](_0x4d8a0a);}};}function checkError(){return function(_0x3ce48b){if(!_0x3ce48b){throw new RangeError(_0x844f('0x1c'));}return _0x3ce48b;};}function respondWithRpcPromise(_0x3e289d,_0x53340a){return new BPromise(function(_0x164f4e,_0x30997a){var _0x3b49e2=amiClient;return _0x3b49e2[_0x844f('0x1d')](_0x3e289d,_0x53340a)[_0x844f('0x1e')](function(_0x5cf6ab){if(_0x5cf6ab[_0x844f('0x1f')]){if(_0x5cf6ab[_0x844f('0x1f')]['code']===0x1f4){return _0x30997a(_0x5cf6ab['error']['message']);}return _0x164f4e(_0x5cf6ab[_0x844f('0x1f')]['message']);}else{_0x164f4e(_0x5cf6ab[_0x844f('0x20')]);}})[_0x844f('0x21')](function(_0xead905){_0x30997a(_0xead905);});});}function getAgent(_0x5d0811){return db['User'][_0x844f('0x22')]({'where':{'id':_0x5d0811,'role':_0x844f('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x5b9f0c,_0x202aa5){return new BPromise(function(_0x3e16f8,_0x2843ab){var _0x2ab145=respondWithRpcPromise(_0x844f('0x24'));var _0x4d316d=getAgent(_0x5b9f0c);Promise['all']([_0x2ab145,_0x4d316d])[_0x844f('0x1e')](function(_0x5b40c3){var _0x76db2a=_0x5b40c3[0x0];var _0x67c13e=_0x5b40c3[0x1];var _0x9e6cc9=_[_0x844f('0x25')](_0x76db2a[_0x844f('0x26')],function(_0x394e31){return _0x394e31[_0x844f('0x27')]==_0x67c13e['id']&&_0x394e31[_0x844f('0x28')]==_0x202aa5;});if(_0x9e6cc9[_0x844f('0x29')]==0x1){_0x3e16f8(_0x67c13e);}else{_0x2843ab(new RangeError(_0x844f('0x2a')+_0x202aa5+_0x844f('0x2b')));}});});}exports[_0x844f('0x2c')]=function(_0x583ac2,_0x429443){logger['info'](_0x844f('0x2d'),_0x583ac2[_0x844f('0x2e')]);var _0x9743a9=originateValidation['validate'](_0x583ac2['body']);if(_0x9743a9['length']>0x0){return _0x429443[_0x844f('0x1a')](0x190)[_0x844f('0x2f')](_0x9743a9);}var _0x51badb=_0x583ac2[_0x844f('0x2e')][_0x844f('0x30')];var _0x5061ea=_0x583ac2[_0x844f('0x2e')][_0x844f('0x31')];var _0x1c59a7=_0x583ac2['body'][_0x844f('0x32')];var _0x12fbfa=_0x583ac2['body'][_0x844f('0x33')];return getAgent(_0x51badb)[_0x844f('0x1e')](function(_0x4cca8c){logger['info'](_0x844f('0x34'),_0x4cca8c[_0x844f('0x19')]);emit(util[_0x844f('0x35')](_0x844f('0x36'),_0x4cca8c[_0x844f('0x19')]),'webbar:originate',{'callNumber':_0x5061ea,'callerId':_0x1c59a7,'callbackUrl':_0x12fbfa});return _0x429443[_0x844f('0x1a')](0xc8)[_0x844f('0x2f')]({'error':![],'message':'originate\x20executed!'});})[_0x844f('0x21')](handleError(_0x429443));};exports[_0x844f('0x37')]=function(_0x3495dc,_0x28b8f3){logger[_0x844f('0x13')](_0x844f('0x38'),_0x3495dc['body']);var _0xfd26f=hangupValidation[_0x844f('0xc')](_0x3495dc['body']);if(_0xfd26f['length']>0x0){return _0x28b8f3['status'](0x190)[_0x844f('0x2f')](_0xfd26f);}var _0x3ede65=_0x3495dc[_0x844f('0x2e')][_0x844f('0x30')];var _0x5ee65c=_0x3495dc[_0x844f('0x2e')][_0x844f('0x28')];return getAgent(_0x3ede65)['then'](function(_0x46afc4){logger[_0x844f('0x13')]('entityFound:',_0x46afc4[_0x844f('0x19')]);emit(util[_0x844f('0x35')]('user:%s',_0x46afc4[_0x844f('0x19')]),_0x844f('0x39'),{'sessionId':_0x5ee65c});return _0x28b8f3[_0x844f('0x1a')](0xc8)[_0x844f('0x2f')]({'error':![],'message':_0x844f('0x3a')});})['catch'](handleError(_0x28b8f3));};exports[_0x844f('0x3b')]=function(_0x53045e,_0x5dcbf1){logger[_0x844f('0x13')](_0x844f('0x3c'),_0x53045e[_0x844f('0x2e')]);var _0x55510f=answerValidation[_0x844f('0xc')](_0x53045e[_0x844f('0x2e')]);if(_0x55510f[_0x844f('0x29')]>0x0){return _0x5dcbf1['status'](0x190)['json'](_0x55510f);}var _0x481b63=_0x53045e[_0x844f('0x2e')][_0x844f('0x30')];var _0x1a3506=_0x53045e['body'][_0x844f('0x28')];return getAgent(_0x481b63)[_0x844f('0x1e')](function(_0x3edd04){logger[_0x844f('0x13')](_0x844f('0x34'),_0x3edd04[_0x844f('0x19')]);emit(util['format'](_0x844f('0x36'),_0x3edd04[_0x844f('0x19')]),_0x844f('0x3d'),{'sessionId':_0x1a3506});return _0x5dcbf1[_0x844f('0x1a')](0xc8)[_0x844f('0x2f')]({'error':![],'message':_0x844f('0x3e')});})[_0x844f('0x21')](handleError(_0x5dcbf1));};exports[_0x844f('0x3f')]=function(_0xeb2d61,_0x595311){logger[_0x844f('0x13')](_0x844f('0x40'),_0xeb2d61['body']);var _0x54c351=holdValidation[_0x844f('0xc')](_0xeb2d61[_0x844f('0x2e')]);if(_0x54c351[_0x844f('0x29')]>0x0){return _0x595311[_0x844f('0x1a')](0x190)[_0x844f('0x2f')](_0x54c351);}var _0x465f27=_0xeb2d61['body'][_0x844f('0x30')];var _0x3317ea=_0xeb2d61[_0x844f('0x2e')][_0x844f('0x28')];return getAgent(_0x465f27)[_0x844f('0x1e')](function(_0x5ba2d2){logger['info'](_0x844f('0x34'),_0x5ba2d2[_0x844f('0x19')]);emit(util[_0x844f('0x35')]('user:%s',_0x5ba2d2[_0x844f('0x19')]),'webbar:hold',{'sessionId':_0x3317ea});return _0x595311[_0x844f('0x1a')](0xc8)['json']({'error':![],'message':_0x844f('0x41')});})['catch'](handleError(_0x595311));};exports[_0x844f('0x42')]=function(_0x3d066f,_0x111666){logger['info'](_0x844f('0x43'),_0x3d066f[_0x844f('0x2e')]);var _0xb1ee4a=unholdValidation['validate'](_0x3d066f[_0x844f('0x2e')]);if(_0xb1ee4a['length']>0x0){return _0x111666[_0x844f('0x1a')](0x190)[_0x844f('0x2f')](_0xb1ee4a);}var _0x41f05e=_0x3d066f['body'][_0x844f('0x30')];var _0x14e2a7=_0x3d066f['body'][_0x844f('0x28')];return getAgent(_0x41f05e)[_0x844f('0x1e')](function(_0x4ac8cb){logger[_0x844f('0x13')](_0x844f('0x34'),_0x4ac8cb[_0x844f('0x19')]);emit(util['format'](_0x844f('0x36'),_0x4ac8cb[_0x844f('0x19')]),'webbar:unhold',{'sessionId':_0x14e2a7});return _0x111666[_0x844f('0x1a')](0xc8)[_0x844f('0x2f')]({'error':![],'message':_0x844f('0x44')});})['catch'](handleError(_0x111666));};exports[_0x844f('0x45')]=function(_0x566513,_0x405557){logger[_0x844f('0x13')](_0x844f('0x46'),_0x405557[_0x844f('0x2e')]);var _0x443451=callsValidation['validate'](_0x566513['body']);if(_0x443451[_0x844f('0x29')]>0x0){return _0x405557['status'](0x190)[_0x844f('0x2f')](_0x443451);}var _0xe2ccdf=_0x566513[_0x844f('0x2e')][_0x844f('0x30')];var _0x5281bf=respondWithRpcPromise(_0x844f('0x24'));var _0x13eec2=getAgent(_0xe2ccdf);return Promise['all']([_0x5281bf,_0x13eec2])[_0x844f('0x1e')](function(_0x10a489){var _0x208be9=_0x10a489[0x0];var _0x14797a=_0x10a489[0x1];var _0x366521=_[_0x844f('0x25')](_0x208be9[_0x844f('0x26')],function(_0x3ee8d3){return _0x3ee8d3['UserId']==_0x14797a['id'];});return _0x405557[_0x844f('0x1a')](0xc8)[_0x844f('0x2f')]({'count':_0x366521[_0x844f('0x29')],'rows':_0x366521});})[_0x844f('0x21')](handleError(_0x405557));};exports[_0x844f('0x47')]=function(_0x1c60c1,_0x79765e){logger[_0x844f('0x13')](_0x844f('0x48'),_0x1c60c1[_0x844f('0x2e')]);var _0x58a240=conferenceValidation[_0x844f('0xc')](_0x1c60c1[_0x844f('0x2e')]);if(_0x58a240['length']>0x0){return _0x79765e[_0x844f('0x1a')](0x190)[_0x844f('0x2f')](_0x58a240);}var _0x187a76=_0x1c60c1[_0x844f('0x2e')][_0x844f('0x30')];return getAgent(_0x187a76)['then'](function(_0x3ea4d3){logger[_0x844f('0x13')](_0x844f('0x34'),_0x3ea4d3['name']);emit(util[_0x844f('0x35')]('user:%s',_0x3ea4d3['name']),'webbar:conference');return _0x79765e['status'](0xc8)['json']({'error':![],'message':_0x844f('0x49')});})[_0x844f('0x21')](handleError(_0x79765e));};exports[_0x844f('0x4a')]=function(_0x38b62e,_0xd1444){logger[_0x844f('0x13')](_0x844f('0x4b'),_0x38b62e['body']);var _0x10ca99=transferValidation['validate'](_0x38b62e[_0x844f('0x2e')]);if(_0x10ca99['length']>0x0){return _0xd1444[_0x844f('0x1a')](0x190)[_0x844f('0x2f')](_0x10ca99);}var _0x59ec8e=_0x38b62e[_0x844f('0x2e')][_0x844f('0x30')];var _0xeafed6=_0x38b62e[_0x844f('0x2e')][_0x844f('0x28')];var _0x443332=_0x38b62e[_0x844f('0x2e')][_0x844f('0x4c')];return getAgent(_0x59ec8e)['then'](function(_0x53cf8a){logger[_0x844f('0x13')]('entityFound:',_0x53cf8a[_0x844f('0x19')]);emit(util[_0x844f('0x35')](_0x844f('0x36'),_0x53cf8a[_0x844f('0x19')]),_0x844f('0x4d'),{'sessionId':_0xeafed6,'transferNumber':_0x443332});return _0xd1444['status'](0xc8)[_0x844f('0x2f')]({'error':![],'message':_0x844f('0x4e')});})[_0x844f('0x21')](handleError(_0xd1444));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index e39e8d2..c7604ad 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 _0xe155=['connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','/:id/send','put','update','delete','removeDispositions','/:id/canned_answers','removeAnswers','exports','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe155,0x1ad));var _0x5e15=function(_0xf04024,_0x2e034d){_0xf04024=_0xf04024-0x0;var _0x4b4cd2=_0xe155[_0xf04024];return _0x4b4cd2;};'use strict';var multer=require(_0x5e15('0x0'));var util=require(_0x5e15('0x1'));var path=require(_0x5e15('0x2'));var timeout=require(_0x5e15('0x3'));var express=require(_0x5e15('0x4'));var router=express['Router']();var auth=require(_0x5e15('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5e15('0x6'));var controller=require(_0x5e15('0x7'));router[_0x5e15('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5e15('0x8')](_0x5e15('0x9'),auth[_0x5e15('0xa')](),controller[_0x5e15('0xb')]);router['get'](_0x5e15('0xc'),auth[_0x5e15('0xa')](),controller[_0x5e15('0xd')]);router[_0x5e15('0x8')](_0x5e15('0xe'),auth[_0x5e15('0xa')](),controller[_0x5e15('0xf')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x5e15('0x10')]);router[_0x5e15('0x8')]('/:id/users',auth[_0x5e15('0xa')](),controller[_0x5e15('0x11')]);router[_0x5e15('0x8')](_0x5e15('0x12'),auth['isAuthenticated'](),controller[_0x5e15('0x13')]);router[_0x5e15('0x14')]('/',auth['isAuthenticated'](),controller[_0x5e15('0x15')]);router['post'](_0x5e15('0xe'),auth[_0x5e15('0xa')](),controller[_0x5e15('0x16')]);router[_0x5e15('0x14')]('/:id/canned_answers',auth[_0x5e15('0xa')](),controller[_0x5e15('0x17')]);router[_0x5e15('0x14')](_0x5e15('0x18'),auth[_0x5e15('0xa')](),controller[_0x5e15('0x19')]);router[_0x5e15('0x14')](_0x5e15('0x12'),auth['isAuthenticated'](),controller[_0x5e15('0x1a')]);router[_0x5e15('0x14')](_0x5e15('0x1b'),controller['notify']);router[_0x5e15('0x14')](_0x5e15('0x1c'),auth[_0x5e15('0xa')](),controller['send']);router[_0x5e15('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x5e15('0x1e')]);router[_0x5e15('0x1f')](_0x5e15('0xc'),auth[_0x5e15('0xa')](),controller['destroy']);router[_0x5e15('0x1f')](_0x5e15('0xe'),auth[_0x5e15('0xa')](),controller[_0x5e15('0x20')]);router[_0x5e15('0x1f')](_0x5e15('0x21'),auth[_0x5e15('0xa')](),controller[_0x5e15('0x22')]);router[_0x5e15('0x1f')](_0x5e15('0x18'),auth[_0x5e15('0xa')](),controller['removeAgents']);module[_0x5e15('0x23')]=router; \ No newline at end of file +var _0xeac6=['create','addDisposition','addAnswer','addAgents','/:id/notify','/:id/send','put','update','destroy','delete','removeAnswers','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','post'];(function(_0x5ff464,_0x5038d7){var _0x347182=function(_0xeef52c){while(--_0xeef52c){_0x5ff464['push'](_0x5ff464['shift']());}};_0x347182(++_0x5038d7);}(_0xeac6,0x1eb));var _0x6eac=function(_0x43108e,_0x37048a){_0x43108e=_0x43108e-0x0;var _0x6de8f6=_0xeac6[_0x43108e];return _0x6de8f6;};'use strict';var multer=require(_0x6eac('0x0'));var util=require(_0x6eac('0x1'));var path=require(_0x6eac('0x2'));var timeout=require(_0x6eac('0x3'));var express=require(_0x6eac('0x4'));var router=express['Router']();var auth=require(_0x6eac('0x5'));var interaction=require(_0x6eac('0x6'));var config=require(_0x6eac('0x7'));var controller=require(_0x6eac('0x8'));router[_0x6eac('0x9')]('/',auth[_0x6eac('0xa')](),controller['index']);router[_0x6eac('0x9')](_0x6eac('0xb'),auth['isAuthenticated'](),controller[_0x6eac('0xc')]);router[_0x6eac('0x9')](_0x6eac('0xd'),auth['isAuthenticated'](),controller[_0x6eac('0xe')]);router[_0x6eac('0x9')](_0x6eac('0xf'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x10')]);router[_0x6eac('0x9')](_0x6eac('0x11'),auth[_0x6eac('0xa')](),controller['getAnswers']);router['get'](_0x6eac('0x12'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0x6eac('0x13'),auth[_0x6eac('0xa')](),controller['getApplications']);router[_0x6eac('0x14')]('/',auth[_0x6eac('0xa')](),controller[_0x6eac('0x15')]);router['post'](_0x6eac('0xf'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x16')]);router[_0x6eac('0x14')](_0x6eac('0x11'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x17')]);router[_0x6eac('0x14')](_0x6eac('0x12'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x18')]);router['post'](_0x6eac('0x13'),auth[_0x6eac('0xa')](),controller['addApplications']);router[_0x6eac('0x14')](_0x6eac('0x19'),controller['notify']);router[_0x6eac('0x14')](_0x6eac('0x1a'),auth[_0x6eac('0xa')](),controller['send']);router[_0x6eac('0x1b')](_0x6eac('0xd'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x1c')]);router['delete'](_0x6eac('0xd'),auth[_0x6eac('0xa')](),controller[_0x6eac('0x1d')]);router['delete']('/:id/dispositions',auth[_0x6eac('0xa')](),controller['removeDispositions']);router[_0x6eac('0x1e')]('/:id/canned_answers',auth[_0x6eac('0xa')](),controller[_0x6eac('0x1f')]);router[_0x6eac('0x1e')](_0x6eac('0x12'),auth[_0x6eac('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index a69c762..db6781c 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 _0x9701=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','generate','ENUM','twilio','TEXT'];(function(_0xf1c0fb,_0x5eadfc){var _0x25a71f=function(_0x17acb4){while(--_0x17acb4){_0xf1c0fb['push'](_0xf1c0fb['shift']());}};_0x25a71f(++_0x5eadfc);}(_0x9701,0xfc));var _0x1970=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9701[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x1970('0x0'));var rs=require('randomstring');module[_0x1970('0x1')]={'name':{'type':Sequelize[_0x1970('0x2')],'unique':_0x1970('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1970('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x1970('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x1970('0x2')],'defaultValue':function(){return rs[_0x1970('0x4')]();}},'phone':{'type':Sequelize[_0x1970('0x2')]},'type':{'type':Sequelize[_0x1970('0x5')](_0x1970('0x6'))},'accountSid':{'type':Sequelize[_0x1970('0x2')]},'authToken':{'type':Sequelize[_0x1970('0x2')]},'notificationTemplate':{'type':Sequelize[_0x1970('0x7')],'defaultValue':function(){return _0x1970('0x8');}},'notificationSound':{'type':Sequelize[_0x1970('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1970('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1970('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1970('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1970('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1970('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1970('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1970('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1970('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1e6e4f){if(!_0x1e6e4f){this[_0x1970('0xb')](_0x1970('0xc'),null);}this[_0x1970('0xb')]('mandatoryDisposition',_0x1e6e4f);}},'description':{'type':Sequelize[_0x1970('0x2')]}}; \ No newline at end of file +var _0x2db2=['randomstring','exports','STRING','name','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x2fa07f,_0x44b7bc){var _0x4183ae=function(_0x385729){while(--_0x385729){_0x2fa07f['push'](_0x2fa07f['shift']());}};_0x4183ae(++_0x44b7bc);}(_0x2db2,0x1ee));var _0x22db=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0x2db2[_0x29c261];return _0x1a9335;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x22db('0x0'));module[_0x22db('0x1')]={'name':{'type':Sequelize[_0x22db('0x2')],'unique':_0x22db('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x22db('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x22db('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x22db('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x22db('0x4')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x22db('0x2')]},'notificationTemplate':{'type':Sequelize[_0x22db('0x5')],'defaultValue':function(){return _0x22db('0x6');}},'notificationSound':{'type':Sequelize[_0x22db('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x22db('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x22db('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x22db('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x22db('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x22db('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x22db('0x8')],'comment':_0x22db('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x22db('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3bf6d8){if(!_0x3bf6d8){this[_0x22db('0xa')](_0x22db('0xb'),null);}this[_0x22db('0xa')](_0x22db('0xc'),_0x3bf6d8);}},'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 757f426..55c50a8 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 _0xd404=['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','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getDispositions','findOne','rawAttributes','sort','WhatsappAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','nolimit','removeAnswers','addAgents','omit','spread','removeAgents','emit','userWhatsappAccount:remove','User','getAgents','addApplications','transaction','WhatsappApplication','bulkCreate','findAndCountAll','getApplications','notify','account','applications','priority','asc','Applications','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','type','twilio','From','replace','whatsapp:','Body','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise'];(function(_0x2af333,_0x54f43f){var _0x1f22a5=function(_0x15ff1b){while(--_0x15ff1b){_0x2af333['push'](_0x2af333['shift']());}};_0x1f22a5(++_0x54f43f);}(_0xd404,0x15b));var _0x4d40=function(_0x32974a,_0xd71e64){_0x32974a=_0x32974a-0x0;var _0x29fb8b=_0xd404[_0x32974a];return _0x29fb8b;};'use strict';var pdf=require(_0x4d40('0x0'));var emlformat=require(_0x4d40('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d40('0x2'));var jsonpatch=require(_0x4d40('0x3'));var rp=require('request-promise');var moment=require(_0x4d40('0x4'));var BPromise=require(_0x4d40('0x5'));var Mustache=require(_0x4d40('0x6'));var util=require(_0x4d40('0x7'));var path=require(_0x4d40('0x8'));var sox=require(_0x4d40('0x9'));var csv=require(_0x4d40('0xa'));var ejs=require(_0x4d40('0xb'));var fs=require('fs');var _=require(_0x4d40('0xc'));var squel=require('squel');var crypto=require(_0x4d40('0xd'));var jsforce=require(_0x4d40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d40('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d40('0xf'));var authService=require(_0x4d40('0x10'));var qs=require(_0x4d40('0x11'));var as=require(_0x4d40('0x12'));var hardwareService=require(_0x4d40('0x13'));var logger=require(_0x4d40('0x14'))(_0x4d40('0x15'));var utils=require(_0x4d40('0x16'));var config=require(_0x4d40('0x17'));var db=require(_0x4d40('0x18'))['db'];config[_0x4d40('0x19')]=_[_0x4d40('0x1a')](config[_0x4d40('0x19')],{'host':_0x4d40('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d40('0x19')]));require(_0x4d40('0x1c'))[_0x4d40('0x1d')](socket);var jayson=require(_0x4d40('0x1e'));var client=jayson[_0x4d40('0x1f')]['http']({'port':0x232c});function checkPasswordPattern(_0x23de7b,_0x4077ce,_0x20bc1b){if(_0x20bc1b){var _0xcee25a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xcee25a[_0x4d40('0x20')](_0x4077ce)){return _0x23de7b;}else{throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))](_0x4d40('0x23'));}}else{return _0x23de7b;}}function respondWithRpcPromise(_0x1439a7,_0x4b5d23,_0x535989,_0x1ae5c7){return new BPromise(function(_0x1c0cd8,_0x4e505f){var _0x23b8fd=_0x1ae5c7||client;return _0x23b8fd[_0x4d40('0x24')](_0x1439a7,_0x535989)['then'](function(_0x36d031){logger['info'](_0x4d40('0x25'),_0x4b5d23,_0x4d40('0x26'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4b5d23,_0x4d40('0x26'),JSON[_0x4d40('0x27')](_0x36d031));if(_0x36d031['error']){if(_0x36d031[_0x4d40('0x28')][_0x4d40('0x29')]===0x1f4){logger[_0x4d40('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x4b5d23,_0x36d031[_0x4d40('0x28')][_0x4d40('0x2a')]);return _0x4e505f(_0x36d031[_0x4d40('0x28')]['message']);}logger['error'](_0x4d40('0x25'),_0x4b5d23,_0x36d031[_0x4d40('0x28')][_0x4d40('0x2a')]);return _0x1c0cd8(_0x36d031[_0x4d40('0x28')][_0x4d40('0x2a')]);}else{logger['info'](_0x4d40('0x25'),_0x4b5d23,_0x4d40('0x26'));_0x1c0cd8(_0x36d031['result']['message']);}})[_0x4d40('0x2b')](function(_0x2a0c82){logger[_0x4d40('0x28')](_0x4d40('0x25'),_0x4b5d23,_0x2a0c82);_0x4e505f(_0x2a0c82);});});}function respondWithStatusCode(_0x4a8ad6,_0x325f6f){_0x325f6f=_0x325f6f||0xcc;return function(_0x105635){if(_0x105635){return _0x4a8ad6[_0x4d40('0x2c')](_0x325f6f);}return _0x4a8ad6[_0x4d40('0x2d')](_0x325f6f)[_0x4d40('0x2e')]();};}function respondWithResult(_0x1c0fcf,_0x4ca431){_0x4ca431=_0x4ca431||0xc8;return function(_0x4e4e61){if(_0x4e4e61){return _0x1c0fcf['status'](_0x4ca431)[_0x4d40('0x2f')](_0x4e4e61);}};}function respondWithFilteredResult(_0x350488,_0x1ac240){return function(_0x18f18f){if(_0x18f18f){var _0x598ca9=_0x18f18f['count'],_0x18e601=_0x1ac240[_0x4d40('0x30')],_0x1c8a1b=_0x1ac240[_0x4d40('0x30')]+_0x1ac240[_0x4d40('0x31')],_0x429da9;if(_0x1c8a1b>=_0x598ca9){_0x1c8a1b=_0x598ca9;_0x429da9=0xc8;}else{_0x429da9=0xce;}_0x350488[_0x4d40('0x2d')](_0x429da9);return _0x350488[_0x4d40('0x32')]('Content-Range',_0x18e601+'-'+_0x1c8a1b+'/'+_0x598ca9)[_0x4d40('0x2f')](_0x18f18f);}return null;};}function patchUpdates(_0x4ae4ce){return function(_0x263d0a){try{jsonpatch[_0x4d40('0x33')](_0x263d0a,_0x4ae4ce,!![]);}catch(_0x3cd439){return BPromise[_0x4d40('0x34')](_0x3cd439);}return _0x263d0a['save']();};}function saveUpdates(_0x5bbe0b,_0x5e483c){return function(_0x3642ee){if(_0x3642ee){return _0x3642ee[_0x4d40('0x35')](_0x5bbe0b)[_0x4d40('0x36')](function(_0x5e195a){return _0x5e195a;});}return null;};}function removeEntity(_0xf5f494,_0x5f1d1c){return function(_0x2fde16){if(_0x2fde16){return _0x2fde16[_0x4d40('0x37')]()[_0x4d40('0x36')](function(){var _0x1b8b68=_0x2fde16[_0x4d40('0x38')]({'plain':!![]});var _0x2c6a94=_0x4d40('0x39');return db[_0x4d40('0x3a')][_0x4d40('0x37')]({'where':{'type':_0x2c6a94,'resourceId':_0x1b8b68['id']}})[_0x4d40('0x36')](function(){return _0x2fde16;});})['then'](function(){_0xf5f494[_0x4d40('0x2d')](0xcc)[_0x4d40('0x2e')]();});}};}function handleEntityNotFound(_0x537a6a,_0x5bad1c){return function(_0x5087e1){if(!_0x5087e1){_0x537a6a[_0x4d40('0x2c')](0x194);}return _0x5087e1;};}function handleError(_0xcb42f6,_0x5784aa){_0x5784aa=_0x5784aa||0x1f4;return function(_0x256cc8){logger[_0x4d40('0x28')](_0x256cc8[_0x4d40('0x3b')]);if(_0x256cc8[_0x4d40('0x3c')]){delete _0x256cc8[_0x4d40('0x3c')];}_0xcb42f6['status'](_0x5784aa)[_0x4d40('0x3d')](_0x256cc8);};}exports[_0x4d40('0x3e')]=function(_0x4a84fa,_0x4eb405){var _0x3a4924={'include':[{'model':db[_0x4d40('0x3f')],'as':_0x4d40('0x40')}]},_0x11ed1a={},_0x56f52e={'count':0x0,'rows':[]};var _0x4ab819=_[_0x4d40('0x41')](db[_0x4d40('0x42')]['rawAttributes'],function(_0x3ed6c2){return{'name':_0x3ed6c2[_0x4d40('0x43')],'type':_0x3ed6c2['type'][_0x4d40('0x44')]};});_0x11ed1a['model']=_[_0x4d40('0x41')](_0x4ab819,_0x4d40('0x3c'));_0x11ed1a[_0x4d40('0x45')]=_[_0x4d40('0x46')](_0x4a84fa[_0x4d40('0x45')]);_0x11ed1a[_0x4d40('0x47')]=_[_0x4d40('0x48')](_0x11ed1a[_0x4d40('0x49')],_0x11ed1a[_0x4d40('0x45')]);_0x3a4924['attributes']=_[_0x4d40('0x48')](_0x11ed1a[_0x4d40('0x49')],qs[_0x4d40('0x4a')](_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x3a4924['attributes']=_0x3a4924[_0x4d40('0x4b')]['length']?_0x3a4924[_0x4d40('0x4b')]:_0x11ed1a[_0x4d40('0x49')];if(!_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x4c')]('nolimit')){_0x3a4924[_0x4d40('0x31')]=qs[_0x4d40('0x31')](_0x4a84fa['query'][_0x4d40('0x31')]);_0x3a4924['offset']=qs[_0x4d40('0x30')](_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x30')]);}_0x3a4924[_0x4d40('0x4d')]=qs['sort'](_0x4a84fa[_0x4d40('0x45')]['sort']);_0x3a4924[_0x4d40('0x4e')]=qs[_0x4d40('0x47')](_[_0x4d40('0x4f')](_0x4a84fa[_0x4d40('0x45')],_0x11ed1a['filters']),_0x4ab819);if(_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x50')]){_0x3a4924[_0x4d40('0x4e')]=_[_0x4d40('0x51')](_0x3a4924['where'],{'$or':_[_0x4d40('0x41')](_0x4ab819,function(_0x3b057d){if(_0x3b057d['type']!==_0x4d40('0x52')){var _0x493d8e={};_0x493d8e[_0x3b057d[_0x4d40('0x3c')]]={'$like':'%'+_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x50')]+'%'};return _0x493d8e;}})});}_0x3a4924=_[_0x4d40('0x51')]({},_0x3a4924,_0x4a84fa[_0x4d40('0x53')]);var _0x351900={'where':_0x3a4924[_0x4d40('0x4e')]};return db[_0x4d40('0x42')][_0x4d40('0x54')](_0x351900)['then'](function(_0x532fde){_0x56f52e[_0x4d40('0x54')]=_0x532fde;if(_0x4a84fa[_0x4d40('0x45')][_0x4d40('0x55')]){_0x3a4924[_0x4d40('0x56')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x4d40('0x57')](_0x3a4924);})[_0x4d40('0x36')](function(_0x4f7b36){_0x56f52e[_0x4d40('0x58')]=_0x4f7b36;return _0x56f52e;})['then'](respondWithFilteredResult(_0x4eb405,_0x3a4924))[_0x4d40('0x2b')](handleError(_0x4eb405,null));};exports[_0x4d40('0x59')]=function(_0x3e294e,_0x53d73a){var _0x2937bb={'raw':![],'where':{'id':_0x3e294e[_0x4d40('0x5a')]['id']},'include':[{'model':db[_0x4d40('0x3f')],'as':_0x4d40('0x40')}]},_0x17e039={};_0x17e039['model']=_[_0x4d40('0x46')](db[_0x4d40('0x42')]['rawAttributes']);_0x17e039[_0x4d40('0x45')]=_['keys'](_0x3e294e[_0x4d40('0x45')]);_0x17e039['filters']=_[_0x4d40('0x48')](_0x17e039[_0x4d40('0x49')],_0x17e039['query']);_0x2937bb[_0x4d40('0x4b')]=_[_0x4d40('0x48')](_0x17e039[_0x4d40('0x49')],qs[_0x4d40('0x4a')](_0x3e294e[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x2937bb[_0x4d40('0x4b')]=_0x2937bb[_0x4d40('0x4b')][_0x4d40('0x5b')]?_0x2937bb[_0x4d40('0x4b')]:_0x17e039[_0x4d40('0x49')];if(_0x3e294e[_0x4d40('0x45')][_0x4d40('0x55')]){_0x2937bb[_0x4d40('0x56')]=[{'all':!![]}];}_0x2937bb=_[_0x4d40('0x51')]({},_0x2937bb,_0x3e294e[_0x4d40('0x53')]);return db[_0x4d40('0x42')][_0x4d40('0x5c')](_0x2937bb)[_0x4d40('0x36')](handleEntityNotFound(_0x53d73a,null))['then'](respondWithResult(_0x53d73a,null))[_0x4d40('0x2b')](handleError(_0x53d73a,null));};exports[_0x4d40('0x5d')]=function(_0x4de203,_0x5cebfc){return db[_0x4d40('0x42')][_0x4d40('0x5d')](_0x4de203['body'],{})['then'](function(_0x33b61b){var _0x4c9df4=_0x4de203[_0x4d40('0x5e')]['get']({'plain':!![]});if(!_0x4c9df4)throw new Error(_0x4d40('0x5f'));if(_0x4c9df4[_0x4d40('0x60')]===_0x4d40('0x5e')){var _0x3e3160=_0x33b61b[_0x4d40('0x38')]({'plain':!![]});var _0x4a6e3e='WhatsappAccounts';return db['UserProfileSection'][_0x4d40('0x5c')]({'where':{'name':_0x4a6e3e,'userProfileId':_0x4c9df4[_0x4d40('0x61')]},'raw':!![]})[_0x4d40('0x36')](function(_0x21a798){if(_0x21a798&&_0x21a798[_0x4d40('0x62')]===0x0){return db['UserProfileResource'][_0x4d40('0x5d')]({'name':_0x3e3160['name'],'resourceId':_0x3e3160['id'],'type':_0x21a798[_0x4d40('0x3c')],'sectionId':_0x21a798['id']},{})[_0x4d40('0x36')](function(){return _0x33b61b;});}else{return _0x33b61b;}})[_0x4d40('0x2b')](function(_0x22305e){logger[_0x4d40('0x28')](_0x4d40('0x63'),_0x22305e);throw _0x22305e;});}return _0x33b61b;})['then'](respondWithResult(_0x5cebfc,0xc9))['catch'](handleError(_0x5cebfc,null));};exports[_0x4d40('0x35')]=function(_0x221552,_0x9f16bb){if(_0x221552[_0x4d40('0x64')]['id']){delete _0x221552[_0x4d40('0x64')]['id'];}return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x221552[_0x4d40('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x4d40('0x40')}]})['then'](handleEntityNotFound(_0x9f16bb,null))['then'](saveUpdates(_0x221552['body'],null))[_0x4d40('0x36')](respondWithResult(_0x9f16bb,null))[_0x4d40('0x2b')](handleError(_0x9f16bb,null));};exports[_0x4d40('0x37')]=function(_0x36f590,_0x4d0af5){return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x36f590[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x4d0af5,null))[_0x4d40('0x36')](removeEntity(_0x4d0af5,null))['catch'](handleError(_0x4d0af5,null));};exports['describe']=function(_0x23bc80,_0x4b24a7){return db[_0x4d40('0x42')][_0x4d40('0x65')]()[_0x4d40('0x36')](respondWithResult(_0x4b24a7,null))['catch'](handleError(_0x4b24a7,null));};exports['addDisposition']=function(_0x3ede3b,_0x506ac3,_0x19b92c){if(_0x3ede3b[_0x4d40('0x64')]['id']){delete _0x3ede3b['body']['id'];}return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x3ede3b[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x506ac3,null))[_0x4d40('0x36')](function(_0x2061a3){if(_0x2061a3){_0x3ede3b['body']['WhatsappAccountId']=_0x2061a3['id'];return db['Disposition'][_0x4d40('0x5d')](_0x3ede3b[_0x4d40('0x64')]);}})[_0x4d40('0x36')](respondWithResult(_0x506ac3,null))['catch'](handleError(_0x506ac3,null));};exports[_0x4d40('0x66')]=function(_0x22b423,_0x4bb2df,_0x595fa5){var _0x1e8a5f={'raw':![],'where':{}};var _0x1b5aa9={};var _0x4db818={'count':0x0,'rows':[]};return db[_0x4d40('0x42')][_0x4d40('0x67')]({'where':{'id':_0x22b423[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x4bb2df,null))[_0x4d40('0x36')](function(_0x717bc1){if(_0x717bc1){_0x1b5aa9['model']=_[_0x4d40('0x46')](db['Disposition'][_0x4d40('0x68')]);_0x1b5aa9[_0x4d40('0x45')]=_['keys'](_0x22b423[_0x4d40('0x45')]);_0x1b5aa9[_0x4d40('0x47')]=_['intersection'](_0x1b5aa9[_0x4d40('0x49')],_0x1b5aa9[_0x4d40('0x45')]);_0x1e8a5f['attributes']=_[_0x4d40('0x48')](_0x1b5aa9[_0x4d40('0x49')],qs[_0x4d40('0x4a')](_0x22b423[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x1e8a5f['attributes']=_0x1e8a5f[_0x4d40('0x4b')][_0x4d40('0x5b')]?_0x1e8a5f[_0x4d40('0x4b')]:_0x1b5aa9[_0x4d40('0x49')];if(!_0x22b423[_0x4d40('0x45')][_0x4d40('0x4c')]('nolimit')){_0x1e8a5f[_0x4d40('0x31')]=qs['limit'](_0x22b423[_0x4d40('0x45')][_0x4d40('0x31')]);_0x1e8a5f[_0x4d40('0x30')]=qs[_0x4d40('0x30')](_0x22b423[_0x4d40('0x45')]['offset']);}_0x1e8a5f[_0x4d40('0x4d')]=qs[_0x4d40('0x69')](_0x22b423[_0x4d40('0x45')][_0x4d40('0x69')]);_0x1e8a5f['where']=qs[_0x4d40('0x47')](_[_0x4d40('0x4f')](_0x22b423[_0x4d40('0x45')],_0x1b5aa9[_0x4d40('0x47')]));_0x1e8a5f['where'][_0x4d40('0x6a')]=_0x717bc1['id'];if(_0x22b423['query'][_0x4d40('0x50')]){_0x1e8a5f[_0x4d40('0x4e')]=_[_0x4d40('0x51')](_0x1e8a5f[_0x4d40('0x4e')],{'$or':_['map'](_0x1e8a5f['attributes'],function(_0x3c14b6){var _0x4660b8={};_0x4660b8[_0x3c14b6]={'$like':'%'+_0x22b423['query'][_0x4d40('0x50')]+'%'};return _0x4660b8;})});}_0x1e8a5f=_[_0x4d40('0x51')]({},_0x1e8a5f,_0x22b423[_0x4d40('0x53')]);return db[_0x4d40('0x6b')][_0x4d40('0x54')]({'where':_0x1e8a5f['where']})[_0x4d40('0x36')](function(_0x2036a8){_0x4db818[_0x4d40('0x54')]=_0x2036a8;if(_0x22b423[_0x4d40('0x45')][_0x4d40('0x55')]){_0x1e8a5f[_0x4d40('0x56')]=[{'all':!![]}];}return db[_0x4d40('0x6b')][_0x4d40('0x57')](_0x1e8a5f);})[_0x4d40('0x36')](function(_0x27085b){_0x4db818[_0x4d40('0x58')]=_0x27085b;return _0x4db818;});}})['then'](respondWithFilteredResult(_0x4bb2df,_0x1e8a5f))[_0x4d40('0x2b')](handleError(_0x4bb2df,null));};exports[_0x4d40('0x6c')]=function(_0x599727,_0xbb9020,_0xbec312){return db['WhatsappAccount']['find']({'where':{'id':_0x599727[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0xbb9020,null))['then'](function(_0x233f77){if(_0x233f77){return _0x233f77[_0x4d40('0x6c')](_0x599727['query'][_0x4d40('0x6d')]);}})[_0x4d40('0x36')](respondWithStatusCode(_0xbb9020,null))['catch'](handleError(_0xbb9020,null));};exports['addAnswer']=function(_0x50d012,_0x5e5004,_0xc7ec7d){if(_0x50d012['body']['id']){delete _0x50d012['body']['id'];}return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x50d012[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x5e5004,null))[_0x4d40('0x36')](function(_0xf8b560){if(_0xf8b560){_0x50d012[_0x4d40('0x64')]['WhatsappAccountId']=_0xf8b560['id'];return db[_0x4d40('0x6e')][_0x4d40('0x5d')](_0x50d012[_0x4d40('0x64')]);}})[_0x4d40('0x36')](respondWithResult(_0x5e5004,null))[_0x4d40('0x2b')](handleError(_0x5e5004,null));};exports[_0x4d40('0x6f')]=function(_0x43760a,_0x6f0128,_0x560121){var _0x570fe5={'raw':![],'where':{}};var _0x3bdda3={};var _0x9ea21d={'count':0x0,'rows':[]};return db[_0x4d40('0x42')][_0x4d40('0x67')]({'where':{'id':_0x43760a[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x6f0128,null))['then'](function(_0x185574){if(_0x185574){_0x3bdda3[_0x4d40('0x49')]=_['keys'](db[_0x4d40('0x6e')]['rawAttributes']);_0x3bdda3['query']=_['keys'](_0x43760a[_0x4d40('0x45')]);_0x3bdda3[_0x4d40('0x47')]=_[_0x4d40('0x48')](_0x3bdda3[_0x4d40('0x49')],_0x3bdda3['query']);_0x570fe5[_0x4d40('0x4b')]=_['intersection'](_0x3bdda3[_0x4d40('0x49')],qs[_0x4d40('0x4a')](_0x43760a[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x570fe5[_0x4d40('0x4b')]=_0x570fe5[_0x4d40('0x4b')]['length']?_0x570fe5[_0x4d40('0x4b')]:_0x3bdda3[_0x4d40('0x49')];if(!_0x43760a['query']['hasOwnProperty'](_0x4d40('0x70'))){_0x570fe5[_0x4d40('0x31')]=qs[_0x4d40('0x31')](_0x43760a[_0x4d40('0x45')][_0x4d40('0x31')]);_0x570fe5['offset']=qs[_0x4d40('0x30')](_0x43760a[_0x4d40('0x45')][_0x4d40('0x30')]);}_0x570fe5['order']=qs[_0x4d40('0x69')](_0x43760a['query'][_0x4d40('0x69')]);_0x570fe5[_0x4d40('0x4e')]=qs[_0x4d40('0x47')](_['pick'](_0x43760a[_0x4d40('0x45')],_0x3bdda3[_0x4d40('0x47')]));_0x570fe5['where'][_0x4d40('0x6a')]=_0x185574['id'];if(_0x43760a[_0x4d40('0x45')][_0x4d40('0x50')]){_0x570fe5[_0x4d40('0x4e')]=_['merge'](_0x570fe5[_0x4d40('0x4e')],{'$or':_['map'](_0x570fe5[_0x4d40('0x4b')],function(_0x16373c){var _0x4c74ff={};_0x4c74ff[_0x16373c]={'$like':'%'+_0x43760a[_0x4d40('0x45')]['filter']+'%'};return _0x4c74ff;})});}_0x570fe5=_['merge']({},_0x570fe5,_0x43760a[_0x4d40('0x53')]);return db['CannedAnswer'][_0x4d40('0x54')]({'where':_0x570fe5[_0x4d40('0x4e')]})[_0x4d40('0x36')](function(_0x283796){_0x9ea21d[_0x4d40('0x54')]=_0x283796;if(_0x43760a[_0x4d40('0x45')][_0x4d40('0x55')]){_0x570fe5['include']=[{'all':!![]}];}return db[_0x4d40('0x6e')]['findAll'](_0x570fe5);})[_0x4d40('0x36')](function(_0x58e05b){_0x9ea21d['rows']=_0x58e05b;return _0x9ea21d;});}})['then'](respondWithFilteredResult(_0x6f0128,_0x570fe5))['catch'](handleError(_0x6f0128,null));};exports[_0x4d40('0x71')]=function(_0x14ef80,_0x3593fe,_0x1be4ea){return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x14ef80[_0x4d40('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3593fe,null))[_0x4d40('0x36')](function(_0x7f96d0){if(_0x7f96d0){return _0x7f96d0['removeAnswers'](_0x14ef80[_0x4d40('0x45')][_0x4d40('0x6d')]);}})[_0x4d40('0x36')](respondWithStatusCode(_0x3593fe,null))['catch'](handleError(_0x3593fe,null));};exports[_0x4d40('0x72')]=function(_0x38cd6f,_0x14c6a8,_0x30e51c){return db['WhatsappAccount'][_0x4d40('0x5c')]({'where':{'id':_0x38cd6f[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x14c6a8,null))[_0x4d40('0x36')](function(_0x345dde){if(_0x345dde){return _0x345dde[_0x4d40('0x72')](_0x38cd6f[_0x4d40('0x64')][_0x4d40('0x6d')],_[_0x4d40('0x73')](_0x38cd6f['body'],[_0x4d40('0x6d'),'id'])||{})[_0x4d40('0x74')](function(_0x111363){for(var _0x334eb9=0x0;_0x334eb9<_0x38cd6f[_0x4d40('0x64')][_0x4d40('0x6d')][_0x4d40('0x5b')];_0x334eb9+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x38cd6f[_0x4d40('0x64')][_0x4d40('0x6d')][_0x334eb9],'WhatsappAccountId':_0x38cd6f[_0x4d40('0x5a')]['id']});}return _0x111363;});}})[_0x4d40('0x36')](respondWithResult(_0x14c6a8,null))[_0x4d40('0x2b')](handleError(_0x14c6a8,null));};exports[_0x4d40('0x75')]=function(_0x455170,_0x3b6eea,_0x2ad153){return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x455170[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x3b6eea,null))[_0x4d40('0x36')](function(_0xcd3354){if(_0xcd3354){return _0xcd3354[_0x4d40('0x75')](_0x455170[_0x4d40('0x45')][_0x4d40('0x6d')])[_0x4d40('0x36')](function(){if(_['isArray'](_0x455170['query'][_0x4d40('0x6d')])){for(var _0x3afa95=0x0;_0x3afa95<_0x455170[_0x4d40('0x45')]['ids'][_0x4d40('0x5b')];_0x3afa95+=0x1){socket[_0x4d40('0x76')](_0x4d40('0x77'),{'UserId':Number(_0x455170[_0x4d40('0x45')][_0x4d40('0x6d')][_0x3afa95]),'WhatsappAccountId':Number(_0x455170[_0x4d40('0x5a')]['id'])});}}else{socket[_0x4d40('0x76')](_0x4d40('0x77'),{'UserId':Number(_0x455170[_0x4d40('0x45')][_0x4d40('0x6d')]),'WhatsappAccountId':Number(_0x455170['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3b6eea,null))[_0x4d40('0x2b')](handleError(_0x3b6eea,null));};exports['getAgents']=function(_0x599c98,_0x4c58ad,_0x33ef8a){var _0x37ca45={};var _0x219acc={};var _0x2f1747;var _0x267d64;return db['WhatsappAccount'][_0x4d40('0x67')]({'where':{'id':_0x599c98['params']['id']}})['then'](handleEntityNotFound(_0x4c58ad,null))[_0x4d40('0x36')](function(_0x1d5533){if(_0x1d5533){_0x2f1747=_0x1d5533;_0x219acc['model']=_[_0x4d40('0x46')](db[_0x4d40('0x78')][_0x4d40('0x68')]);_0x219acc['query']=_[_0x4d40('0x46')](_0x599c98['query']);_0x219acc[_0x4d40('0x47')]=_[_0x4d40('0x48')](_0x219acc[_0x4d40('0x49')],_0x219acc[_0x4d40('0x45')]);_0x37ca45['attributes']=_[_0x4d40('0x48')](_0x219acc[_0x4d40('0x49')],qs[_0x4d40('0x4a')](_0x599c98[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x37ca45[_0x4d40('0x4b')]=_0x37ca45[_0x4d40('0x4b')][_0x4d40('0x5b')]?_0x37ca45['attributes']:_0x219acc[_0x4d40('0x49')];_0x37ca45['order']=qs[_0x4d40('0x69')](_0x599c98[_0x4d40('0x45')][_0x4d40('0x69')]);_0x37ca45[_0x4d40('0x4e')]=qs[_0x4d40('0x47')](_[_0x4d40('0x4f')](_0x599c98[_0x4d40('0x45')],_0x219acc[_0x4d40('0x47')]));if(_0x599c98['query'][_0x4d40('0x50')]){_0x37ca45[_0x4d40('0x4e')]=_[_0x4d40('0x51')](_0x37ca45[_0x4d40('0x4e')],{'$or':_[_0x4d40('0x41')](_0x37ca45['attributes'],function(_0x3a0458){var _0x3c35d8={};_0x3c35d8[_0x3a0458]={'$like':'%'+_0x599c98[_0x4d40('0x45')][_0x4d40('0x50')]+'%'};return _0x3c35d8;})});}_0x37ca45=_[_0x4d40('0x51')]({},_0x37ca45,_0x599c98[_0x4d40('0x53')]);return _0x2f1747[_0x4d40('0x79')](_0x37ca45);}})[_0x4d40('0x36')](function(_0xd70130){if(_0xd70130){_0x267d64=_0xd70130[_0x4d40('0x5b')];if(!_0x599c98['query']['hasOwnProperty'](_0x4d40('0x70'))){_0x37ca45[_0x4d40('0x31')]=qs[_0x4d40('0x31')](_0x599c98[_0x4d40('0x45')][_0x4d40('0x31')]);_0x37ca45['offset']=qs['offset'](_0x599c98['query'][_0x4d40('0x30')]);}return _0x2f1747[_0x4d40('0x79')](_0x37ca45);}})[_0x4d40('0x36')](function(_0x5464f8){if(_0x5464f8){return _0x5464f8?{'count':_0x267d64,'rows':_0x5464f8}:null;}})[_0x4d40('0x36')](respondWithResult(_0x4c58ad,null))[_0x4d40('0x2b')](handleError(_0x4c58ad,null));};exports[_0x4d40('0x7a')]=function(_0x594211,_0x1b106d,_0x571704){return db[_0x4d40('0x42')][_0x4d40('0x67')]({'where':{'id':_0x594211[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x1b106d,null))['then'](function(_0x411a4c){if(_0x411a4c){return db['sequelize'][_0x4d40('0x7b')](function(_0x3dd6a1){return db[_0x4d40('0x7c')][_0x4d40('0x37')]({'where':{'WhatsappAccountId':_0x594211['params']['id']},'transaction':_0x3dd6a1})[_0x4d40('0x36')](function(_0x3a59d3){var _0x5141c6=_[_0x4d40('0x41')](_0x594211[_0x4d40('0x64')],function(_0x1340bd){_0x1340bd[_0x4d40('0x6a')]=_0x594211['params']['id'];return _0x1340bd;});return db[_0x4d40('0x7c')][_0x4d40('0x7d')](_0x5141c6,{'transaction':_0x3dd6a1});});})[_0x4d40('0x36')](function(){return db[_0x4d40('0x7c')][_0x4d40('0x7e')]({'where':{'WhatsappAccountId':_0x594211[_0x4d40('0x5a')]['id']},'order':'priority'});});}})[_0x4d40('0x36')](respondWithResult(_0x1b106d,null))[_0x4d40('0x2b')](handleError(_0x1b106d,null));};exports[_0x4d40('0x7f')]=function(_0x4f92f4,_0x37ca4d,_0x3079b9){var _0x5b44b0={};var _0xd6c220={};var _0x39ea8e;var _0x346d9c;return db[_0x4d40('0x42')][_0x4d40('0x67')]({'where':{'id':_0x4f92f4[_0x4d40('0x5a')]['id']}})[_0x4d40('0x36')](handleEntityNotFound(_0x37ca4d,null))[_0x4d40('0x36')](function(_0x4001af){if(_0x4001af){_0x39ea8e=_0x4001af;_0xd6c220[_0x4d40('0x49')]=_['keys'](db['WhatsappApplication']['rawAttributes']);_0xd6c220[_0x4d40('0x45')]=_[_0x4d40('0x46')](_0x4f92f4[_0x4d40('0x45')]);_0xd6c220['filters']=_['intersection'](_0xd6c220[_0x4d40('0x49')],_0xd6c220[_0x4d40('0x45')]);_0x5b44b0['attributes']=_[_0x4d40('0x48')](_0xd6c220['model'],qs[_0x4d40('0x4a')](_0x4f92f4[_0x4d40('0x45')][_0x4d40('0x4a')]));_0x5b44b0['attributes']=_0x5b44b0[_0x4d40('0x4b')][_0x4d40('0x5b')]?_0x5b44b0[_0x4d40('0x4b')]:_0xd6c220['model'];_0x5b44b0[_0x4d40('0x4d')]=qs[_0x4d40('0x69')](_0x4f92f4[_0x4d40('0x45')]['sort']);_0x5b44b0[_0x4d40('0x4e')]=qs['filters'](_[_0x4d40('0x4f')](_0x4f92f4[_0x4d40('0x45')],_0xd6c220['filters']));if(_0x4f92f4['query'][_0x4d40('0x50')]){_0x5b44b0[_0x4d40('0x4e')]=_['merge'](_0x5b44b0['where'],{'$or':_['map'](_0x5b44b0[_0x4d40('0x4b')],function(_0x36605e){var _0x4839a1={};_0x4839a1[_0x36605e]={'$like':'%'+_0x4f92f4[_0x4d40('0x45')]['filter']+'%'};return _0x4839a1;})});}_0x5b44b0=_['merge']({},_0x5b44b0,_0x4f92f4[_0x4d40('0x53')]);return _0x39ea8e[_0x4d40('0x7f')](_0x5b44b0);}})[_0x4d40('0x36')](function(_0x1cd057){if(_0x1cd057){_0x346d9c=_0x1cd057[_0x4d40('0x5b')];if(!_0x4f92f4[_0x4d40('0x45')][_0x4d40('0x4c')](_0x4d40('0x70'))){_0x5b44b0[_0x4d40('0x31')]=qs[_0x4d40('0x31')](_0x4f92f4[_0x4d40('0x45')][_0x4d40('0x31')]);_0x5b44b0['offset']=qs['offset'](_0x4f92f4[_0x4d40('0x45')]['offset']);}return _0x39ea8e[_0x4d40('0x7f')](_0x5b44b0);}})[_0x4d40('0x36')](function(_0x3df448){if(_0x3df448){return _0x3df448?{'count':_0x346d9c,'rows':_0x3df448}:null;}})[_0x4d40('0x36')](respondWithResult(_0x37ca4d,null))[_0x4d40('0x2b')](handleError(_0x37ca4d,null));};exports[_0x4d40('0x80')]=function(_0x2e2b5a,_0xdeb15b,_0x3efc1a){var _0x456cc6={'channel':'whatsapp'};var _0x3b97e5=[];var _0xbc145=[];var _0x3b3e7a={};return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x2e2b5a[_0x4d40('0x5a')]['id']},'include':[{'model':db[_0x4d40('0x7c')],'as':'Applications'}]})[_0x4d40('0x36')](handleEntityNotFound(_0xdeb15b,null))[_0x4d40('0x36')](function(_0x2b7726){_0x456cc6[_0x4d40('0x81')]=_0x2b7726;_0x456cc6[_0x4d40('0x82')]=_['orderBy'](_0x2b7726['Applications'],[_0x4d40('0x83')],[_0x4d40('0x84')]);if(_0x456cc6[_0x4d40('0x81')][_0x4d40('0x85')]){delete _0x456cc6[_0x4d40('0x81')][_0x4d40('0x85')];}return db[_0x4d40('0x86')][_0x4d40('0x65')]();})[_0x4d40('0x36')](function(_0x177109){if(!_0x177109){throw new db[(_0x4d40('0x21'))]['ValidationError'](_0x4d40('0x87'));}_0x3b97e5=_[_0x4d40('0x88')](_[_0x4d40('0x46')](_0x177109),[_0x4d40('0x89'),_0x4d40('0x8a')]);_0xbc145=_['difference'](_[_0x4d40('0x46')](_0x177109),[_0x4d40('0x89'),'updatedAt','CompanyId',_0x4d40('0x8b')]);_0x456cc6[_0x4d40('0x64')]={'mapKey':_0x4d40('0x8c')};if(_0x456cc6[_0x4d40('0x81')]['type']&&_0x456cc6[_0x4d40('0x81')][_0x4d40('0x8d')]===_0x4d40('0x8e')){_0x456cc6[_0x4d40('0x64')]['from']=_0x2e2b5a[_0x4d40('0x64')][_0x4d40('0x8f')][_0x4d40('0x90')](_0x4d40('0x91'),'');_0x456cc6['body'][_0x4d40('0x64')]=_0x2e2b5a[_0x4d40('0x64')][_0x4d40('0x92')];_0x456cc6['body'][_0x4d40('0x93')]=_0x2e2b5a[_0x4d40('0x64')]['MessageSid'];}if(_0x456cc6[_0x4d40('0x64')]['id']){delete _0x456cc6['body']['id'];}if(_[_0x4d40('0x94')](_0x456cc6[_0x4d40('0x64')]['from'])){throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))](_0x4d40('0x95'));}if(_[_0x4d40('0x94')](_0x456cc6[_0x4d40('0x64')]['body'])||_0x456cc6[_0x4d40('0x64')][_0x4d40('0x64')]===''){throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))](_0x4d40('0x96'));}if(_[_0x4d40('0x94')](_0x456cc6[_0x4d40('0x64')][_0x4d40('0x97')])){throw new db[(_0x4d40('0x21'))]['ValidationError'](_0x4d40('0x98')+_0xbc145);}if(!_[_0x4d40('0x99')](_0xbc145,_0x456cc6[_0x4d40('0x64')][_0x4d40('0x97')])){throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))](_0x4d40('0x9a')+_0xbc145);}_0x3b3e7a[_0x456cc6[_0x4d40('0x64')]['mapKey']]=_0x456cc6[_0x4d40('0x64')][_0x4d40('0x9b')];return db[_0x4d40('0x9c')][_0x4d40('0x5c')]({'where':{'id':_0x456cc6['account'][_0x4d40('0x8b')]},'include':[{'model':db[_0x4d40('0x86')],'as':_0x4d40('0x9d'),'where':_0x3b3e7a,'limit':0x1,'order':[['updatedAt',_0x4d40('0x9e')]]}]});})[_0x4d40('0x36')](handleEntityNotFound(_0xdeb15b,null))[_0x4d40('0x36')](function(_0x193bce){if(_0x193bce){_0x456cc6['list']=_['omit'](_0x193bce,[_0x4d40('0x9d')]);if(_0x193bce['Contacts']['length']){return _0x193bce[_0x4d40('0x9d')][0x0];}var _0x44926f=_[_0x4d40('0x1a')](_0x456cc6[_0x4d40('0x64')],{'firstName':_0x456cc6[_0x4d40('0x64')][_0x4d40('0x9b')],'ListId':_0x193bce['id']});_0x44926f[_0x456cc6[_0x4d40('0x64')][_0x4d40('0x97')]]=_0x456cc6[_0x4d40('0x64')][_0x4d40('0x9b')];return db[_0x4d40('0x86')][_0x4d40('0x5d')](_0x44926f,{'fields':_0x3b97e5,'raw':!![]});}})['then'](handleEntityNotFound(_0xdeb15b,null))[_0x4d40('0x36')](function(_0x383021){if(_0x383021){_0x456cc6[_0x4d40('0x9f')]=_0x383021;var _0x5c06d1={'ContactId':_0x383021['id'],'phone':_0x456cc6[_0x4d40('0x64')]['from'],'WhatsappAccountId':_0x2e2b5a['params']['id']};var _0x4c0533={'ContactId':_0x383021['id'],'WhatsappAccountId':_0x2e2b5a[_0x4d40('0x5a')]['id'],'closed':![]};return db[_0x4d40('0xa0')][_0x4d40('0x5c')]({'where':_0x4c0533})[_0x4d40('0x36')](function(_0x5a5585){if(_0x5a5585){return[_0x5a5585,![]];}return db['WhatsappInteraction'][_0x4d40('0x5d')](_0x5c06d1)[_0x4d40('0x36')](function(_0x1b6207){return[_0x1b6207,!![]];});});}})[_0x4d40('0x74')](function(_0x13a6dc,_0x4f2ecb){_0x456cc6[_0x4d40('0xa1')]=_0x13a6dc['get']({'plain':!![]});_0x456cc6[_0x4d40('0xa1')][_0x4d40('0xa2')]=![];if(_0x4f2ecb){if(_0x456cc6[_0x4d40('0x81')][_0x4d40('0xa3')]){_0x456cc6[_0x4d40('0x82')]['push']({'id':0x0,'priority':_0x456cc6['applications'][_0x4d40('0x5b')]+0x1,'app':_0x4d40('0xa4'),'appdata':_0x4d40('0xa5'),'interval':'*,*,*,*'});}_0x456cc6[_0x4d40('0xa1')]['created']=!![];}return db[_0x4d40('0xa6')][_0x4d40('0x5d')]({'phone':_0x456cc6['body'][_0x4d40('0x9b')],'messageId':_0x456cc6[_0x4d40('0x64')]['messageId'],'body':_0x456cc6['body'][_0x4d40('0x64')],'WhatsappAccountId':_0x2e2b5a[_0x4d40('0x5a')]['id'],'WhatsappInteractionId':_0x13a6dc['id'],'direction':'in','ContactId':_0x13a6dc[_0x4d40('0xa7')],'AttachmentId':_0x456cc6[_0x4d40('0x64')][_0x4d40('0xa8')]});})['then'](function(_0x465da3){_0x456cc6[_0x4d40('0x2a')]=_0x465da3;if(_0x456cc6[_0x4d40('0xa1')][_0x4d40('0xa9')]){return db[_0x4d40('0x78')]['find']({'attributes':['id',_0x4d40('0x3c')],'where':{'id':_0x456cc6[_0x4d40('0xa1')][_0x4d40('0xa9')]}})[_0x4d40('0x36')](function(_0x199885){if(_0x199885){_0x456cc6[_0x4d40('0x82')][_0x4d40('0xaa')]({'id':0x0,'priority':0x0,'app':_0x4d40('0xab'),'appdata':_0x199885[_0x4d40('0x3c')]+','+(_0x456cc6[_0x4d40('0x81')][_0x4d40('0xac')]||0xa),'interval':_0x4d40('0xad')});}return respondWithRpcPromise('Start',_0x4d40('0xae'),_0x456cc6);});}return respondWithRpcPromise(_0x4d40('0xaf'),_0x4d40('0xae'),_0x456cc6);})[_0x4d40('0x36')](function(_0x22cf44){if(_0x22cf44){var _0x1332e3=0xc8;var _0xc86cc2=_0x4d40('0xb0');logger[_0x4d40('0xb1')](_0x4d40('0xb2'),_0xc86cc2,_0x1332e3,_0x4d40('0xb3'));logger[_0x4d40('0xb4')](_0x4d40('0xb5'),_0xc86cc2,_0x1332e3,_0x4d40('0xb3'),JSON[_0x4d40('0x27')](_0x22cf44));if(_0x456cc6[_0x4d40('0x81')][_0x4d40('0x8d')]===_0x4d40('0x8e')){return _0xdeb15b[_0x4d40('0x2d')](_0x1332e3)['set'](_0x4d40('0xb6'),'text/xml')[_0x4d40('0x3d')](_0x4d40('0xb7'));}else{return _0xdeb15b['status'](_0x1332e3)[_0x4d40('0x2f')](_0x22cf44);}}})[_0x4d40('0x2b')](handleError(_0xdeb15b,null));};exports[_0x4d40('0x3d')]=function(_0x50dcda,_0x55774f,_0x47faa9){var _0x2b6cfd,_0x494d0c,_0x296dac;if(_['isNil'](_0x50dcda[_0x4d40('0x64')]['body'])||_0x50dcda['body'][_0x4d40('0x64')]===''){throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4d40('0x94')](_0x50dcda['body']['to'])){throw new db[(_0x4d40('0x21'))][(_0x4d40('0x22'))](_0x4d40('0xb8'));}_0x2b6cfd=_0x50dcda[_0x4d40('0x64')]['to'];return db[_0x4d40('0x42')][_0x4d40('0x5c')]({'where':{'id':_0x50dcda[_0x4d40('0x5a')]['id']},'include':[{'model':db[_0x4d40('0x9c')],'as':_0x4d40('0xb9'),'include':[{'model':db['CmContact'],'as':_0x4d40('0x9d'),'where':{'mobile':_0x2b6cfd},'limit':0x1,'order':[[_0x4d40('0x8a'),_0x4d40('0x9e')]]}]}]})[_0x4d40('0x36')](handleEntityNotFound(_0x55774f,null))[_0x4d40('0x36')](function(_0x5ddcdb){if(_0x5ddcdb&&_0x5ddcdb[_0x4d40('0xb9')]){_0x494d0c=_0x5ddcdb[_0x4d40('0x38')]({'plain':!![]});if(_0x494d0c[_0x4d40('0xb9')]&&_0x494d0c[_0x4d40('0xb9')][_0x4d40('0x9d')][_0x4d40('0x5b')]){return _0x494d0c[_0x4d40('0xb9')][_0x4d40('0x9d')][0x0];}return db['CmContact'][_0x4d40('0x5d')](_[_0x4d40('0x1a')](_0x50dcda[_0x4d40('0x64')],{'firstName':_0x2b6cfd,'mobile':_0x2b6cfd,'phone':_0x2b6cfd,'ListId':_0x494d0c['ListId']}));}})[_0x4d40('0x36')](handleEntityNotFound(_0x55774f,null))[_0x4d40('0x36')](function(_0x523d37){if(_0x523d37){_0x296dac=_0x523d37;return db[_0x4d40('0xa0')]['find']({'where':{'ContactId':_0x296dac['id'],'closed':![],'WhatsappAccountId':_0x494d0c['id']}})[_0x4d40('0x36')](function(_0x558de3){if(_0x558de3){return[_0x558de3,![]];}return db[_0x4d40('0xa0')]['create']({'UserId':_0x50dcda[_0x4d40('0x5e')]['id'],'ContactId':_0x296dac['id'],'WhatsappAccountId':_0x494d0c['id'],'phone':_0x2b6cfd,'firstMsgDirection':_0x4d40('0xba'),'Messages':[_[_0x4d40('0x51')](_0x50dcda[_0x4d40('0x64')],{'read':![],'body':_0x50dcda[_0x4d40('0x64')][_0x4d40('0x64')],'phone':_0x2b6cfd,'WhatsappAccountId':_0x494d0c['id'],'UserId':_0x50dcda[_0x4d40('0x5e')]['id'],'ContactId':_0x296dac['id']})]},{'include':[{'model':db[_0x4d40('0xa6')],'as':_0x4d40('0xbb')}]})[_0x4d40('0x36')](function(_0x53a8ec){return[_0x53a8ec,!![]];});});}})[_0x4d40('0x74')](function(_0x41d30c,_0x2bbfe1){if(_0x2bbfe1){return _0x41d30c;}return db['WhatsappMessage'][_0x4d40('0x5d')](_['merge'](_0x50dcda['body'],{'read':![],'body':_0x50dcda[_0x4d40('0x64')]['body'],'phone':_0x2b6cfd,'WhatsappAccountId':_0x494d0c['id'],'WhatsappInteractionId':_0x41d30c['id'],'UserId':_0x50dcda[_0x4d40('0x5e')]['id'],'ContactId':_0x296dac['id']}))[_0x4d40('0x36')](function(_0x4d1e19){_0x41d30c[_0x4d40('0xbc')]['Messages']=[];_0x41d30c['dataValues']['Messages']['push'](_0x4d1e19[_0x4d40('0xbc')]);return _0x41d30c;});})[_0x4d40('0x36')](respondWithResult(_0x55774f,null))[_0x4d40('0x2b')](handleError(_0x55774f,null));}; \ No newline at end of file +var _0xb688=['unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappAccount,\x20%s,\x20%s','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','WhatsappAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','rawAttributes','nolimit','removeAnswers','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','describe','Sequelize','createdAt','updatedAt','difference','CompanyId','ListId','type','twilio','from','From','replace','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0xb688,0xcf));var _0x8b68=function(_0x367432,_0x1d5c68){_0x367432=_0x367432-0x0;var _0x29cab0=_0xb688[_0x367432];return _0x29cab0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8b68('0x0'));var rimraf=require(_0x8b68('0x1'));var zipdir=require(_0x8b68('0x2'));var jsonpatch=require(_0x8b68('0x3'));var rp=require(_0x8b68('0x4'));var moment=require(_0x8b68('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8b68('0x6'));var util=require(_0x8b68('0x7'));var path=require(_0x8b68('0x8'));var sox=require(_0x8b68('0x9'));var csv=require('to-csv');var ejs=require(_0x8b68('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require(_0x8b68('0xf'));var querystring=require(_0x8b68('0x10'));var Papa=require(_0x8b68('0x11'));var Redis=require(_0x8b68('0x12'));var authService=require(_0x8b68('0x13'));var qs=require(_0x8b68('0x14'));var as=require(_0x8b68('0x15'));var hardwareService=require(_0x8b68('0x16'));var logger=require(_0x8b68('0x17'))('api');var utils=require(_0x8b68('0x18'));var config=require(_0x8b68('0x19'));var db=require(_0x8b68('0x1a'))['db'];config[_0x8b68('0x1b')]=_[_0x8b68('0x1c')](config[_0x8b68('0x1b')],{'host':_0x8b68('0x1d'),'port':0x18eb});var socket=require(_0x8b68('0x1e'))(new Redis(config[_0x8b68('0x1b')]));require('./whatsappAccount.socket')[_0x8b68('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8b68('0x20')]({'port':0x232c});function checkPasswordPattern(_0x1554d6,_0x27d717,_0x5d3468){if(_0x5d3468){var _0x5c8d0e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c8d0e[_0x8b68('0x21')](_0x27d717)){return _0x1554d6;}else{throw new db['Sequelize'][(_0x8b68('0x22'))](_0x8b68('0x23'));}}else{return _0x1554d6;}}function respondWithRpcPromise(_0x1df44f,_0x10c9c6,_0x491695,_0xd17693){return new BPromise(function(_0x203dd4,_0x4a68c7){var _0x42b3bd=_0xd17693||client;return _0x42b3bd[_0x8b68('0x24')](_0x1df44f,_0x491695)[_0x8b68('0x25')](function(_0x17f321){logger[_0x8b68('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x10c9c6,_0x8b68('0x27'));logger[_0x8b68('0x28')](_0x8b68('0x29'),_0x10c9c6,_0x8b68('0x27'),JSON[_0x8b68('0x2a')](_0x17f321));if(_0x17f321[_0x8b68('0x2b')]){if(_0x17f321['error']['code']===0x1f4){logger[_0x8b68('0x2b')]('WhatsappAccount,\x20%s,\x20%s',_0x10c9c6,_0x17f321[_0x8b68('0x2b')][_0x8b68('0x2c')]);return _0x4a68c7(_0x17f321[_0x8b68('0x2b')][_0x8b68('0x2c')]);}logger[_0x8b68('0x2b')](_0x8b68('0x2d'),_0x10c9c6,_0x17f321['error'][_0x8b68('0x2c')]);return _0x203dd4(_0x17f321[_0x8b68('0x2b')]['message']);}else{logger[_0x8b68('0x26')](_0x8b68('0x2d'),_0x10c9c6,_0x8b68('0x27'));_0x203dd4(_0x17f321['result']['message']);}})['catch'](function(_0x92d186){logger[_0x8b68('0x2b')](_0x8b68('0x2d'),_0x10c9c6,_0x92d186);_0x4a68c7(_0x92d186);});});}function respondWithStatusCode(_0x583476,_0x3311c7){_0x3311c7=_0x3311c7||0xcc;return function(_0x53aaa2){if(_0x53aaa2){return _0x583476['sendStatus'](_0x3311c7);}return _0x583476[_0x8b68('0x2e')](_0x3311c7)['end']();};}function respondWithResult(_0x26cad7,_0x3ac356){_0x3ac356=_0x3ac356||0xc8;return function(_0x48e2c8){if(_0x48e2c8){return _0x26cad7['status'](_0x3ac356)[_0x8b68('0x2f')](_0x48e2c8);}};}function respondWithFilteredResult(_0x1cd230,_0x1e7c06){return function(_0xfb4f06){if(_0xfb4f06){var _0x210926=_0xfb4f06[_0x8b68('0x30')],_0x2ad2df=_0x1e7c06['offset'],_0x460c37=_0x1e7c06[_0x8b68('0x31')]+_0x1e7c06[_0x8b68('0x32')],_0x5b7ed1;if(_0x460c37>=_0x210926){_0x460c37=_0x210926;_0x5b7ed1=0xc8;}else{_0x5b7ed1=0xce;}_0x1cd230['status'](_0x5b7ed1);return _0x1cd230[_0x8b68('0x33')](_0x8b68('0x34'),_0x2ad2df+'-'+_0x460c37+'/'+_0x210926)[_0x8b68('0x2f')](_0xfb4f06);}return null;};}function patchUpdates(_0x49ce2d){return function(_0x51f169){try{jsonpatch[_0x8b68('0x35')](_0x51f169,_0x49ce2d,!![]);}catch(_0x8c11aa){return BPromise[_0x8b68('0x36')](_0x8c11aa);}return _0x51f169[_0x8b68('0x37')]();};}function saveUpdates(_0x2c0ace,_0x334b13){return function(_0x29449b){if(_0x29449b){return _0x29449b[_0x8b68('0x38')](_0x2c0ace)[_0x8b68('0x25')](function(_0x7fe301){return _0x7fe301;});}return null;};}function removeEntity(_0x49e2db,_0x15027a){return function(_0x232fa9){if(_0x232fa9){return _0x232fa9[_0x8b68('0x39')]()[_0x8b68('0x25')](function(){var _0x151277=_0x232fa9[_0x8b68('0x3a')]({'plain':!![]});var _0x2a7dd5=_0x8b68('0x3b');return db[_0x8b68('0x3c')][_0x8b68('0x39')]({'where':{'type':_0x2a7dd5,'resourceId':_0x151277['id']}})[_0x8b68('0x25')](function(){return _0x232fa9;});})['then'](function(){_0x49e2db['status'](0xcc)[_0x8b68('0x3d')]();});}};}function handleEntityNotFound(_0x262d6c,_0x23554d){return function(_0xb9b5b1){if(!_0xb9b5b1){_0x262d6c[_0x8b68('0x3e')](0x194);}return _0xb9b5b1;};}function handleError(_0xce486c,_0x75a62f){_0x75a62f=_0x75a62f||0x1f4;return function(_0x43feb3){logger['error'](_0x43feb3[_0x8b68('0x3f')]);if(_0x43feb3[_0x8b68('0x40')]){delete _0x43feb3[_0x8b68('0x40')];}_0xce486c[_0x8b68('0x2e')](_0x75a62f)[_0x8b68('0x41')](_0x43feb3);};}exports[_0x8b68('0x42')]=function(_0xff4080,_0x2dd264){var _0x517571={'include':[{'model':db[_0x8b68('0x43')],'as':_0x8b68('0x44')}]},_0x3f874c={},_0x42cc82={'count':0x0,'rows':[]};var _0x3ecc60=_[_0x8b68('0x45')](db[_0x8b68('0x46')]['rawAttributes'],function(_0x162b0c){return{'name':_0x162b0c[_0x8b68('0x47')],'type':_0x162b0c['type'][_0x8b68('0x48')]};});_0x3f874c[_0x8b68('0x49')]=_['map'](_0x3ecc60,'name');_0x3f874c['query']=_['keys'](_0xff4080[_0x8b68('0x4a')]);_0x3f874c[_0x8b68('0x4b')]=_['intersection'](_0x3f874c[_0x8b68('0x49')],_0x3f874c['query']);_0x517571[_0x8b68('0x4c')]=_[_0x8b68('0x4d')](_0x3f874c['model'],qs[_0x8b68('0x4e')](_0xff4080['query']['fields']));_0x517571['attributes']=_0x517571[_0x8b68('0x4c')][_0x8b68('0x4f')]?_0x517571[_0x8b68('0x4c')]:_0x3f874c[_0x8b68('0x49')];if(!_0xff4080['query'][_0x8b68('0x50')]('nolimit')){_0x517571[_0x8b68('0x32')]=qs[_0x8b68('0x32')](_0xff4080['query'][_0x8b68('0x32')]);_0x517571[_0x8b68('0x31')]=qs[_0x8b68('0x31')](_0xff4080[_0x8b68('0x4a')]['offset']);}_0x517571[_0x8b68('0x51')]=qs[_0x8b68('0x52')](_0xff4080[_0x8b68('0x4a')][_0x8b68('0x52')]);_0x517571[_0x8b68('0x53')]=qs[_0x8b68('0x4b')](_[_0x8b68('0x54')](_0xff4080[_0x8b68('0x4a')],_0x3f874c[_0x8b68('0x4b')]),_0x3ecc60);if(_0xff4080[_0x8b68('0x4a')][_0x8b68('0x55')]){_0x517571[_0x8b68('0x53')]=_[_0x8b68('0x56')](_0x517571[_0x8b68('0x53')],{'$or':_[_0x8b68('0x45')](_0x3ecc60,function(_0xe65007){if(_0xe65007['type']!==_0x8b68('0x57')){var _0x20681a={};_0x20681a[_0xe65007['name']]={'$like':'%'+_0xff4080[_0x8b68('0x4a')]['filter']+'%'};return _0x20681a;}})});}_0x517571=_['merge']({},_0x517571,_0xff4080['options']);var _0x1c8a3e={'where':_0x517571[_0x8b68('0x53')]};return db[_0x8b68('0x46')][_0x8b68('0x30')](_0x1c8a3e)['then'](function(_0x522f47){_0x42cc82[_0x8b68('0x30')]=_0x522f47;if(_0xff4080[_0x8b68('0x4a')][_0x8b68('0x58')]){_0x517571['include']=[{'all':!![]}];}return db[_0x8b68('0x46')][_0x8b68('0x59')](_0x517571);})['then'](function(_0x429ebb){_0x42cc82[_0x8b68('0x5a')]=_0x429ebb;return _0x42cc82;})['then'](respondWithFilteredResult(_0x2dd264,_0x517571))[_0x8b68('0x5b')](handleError(_0x2dd264,null));};exports[_0x8b68('0x5c')]=function(_0x51bf1b,_0x3f7f89){var _0x735e17={'raw':![],'where':{'id':_0x51bf1b['params']['id']},'include':[{'model':db['Pause'],'as':_0x8b68('0x44')}]},_0x48f886={};_0x48f886[_0x8b68('0x49')]=_[_0x8b68('0x5d')](db[_0x8b68('0x46')]['rawAttributes']);_0x48f886['query']=_[_0x8b68('0x5d')](_0x51bf1b[_0x8b68('0x4a')]);_0x48f886[_0x8b68('0x4b')]=_['intersection'](_0x48f886[_0x8b68('0x49')],_0x48f886[_0x8b68('0x4a')]);_0x735e17[_0x8b68('0x4c')]=_['intersection'](_0x48f886[_0x8b68('0x49')],qs['fields'](_0x51bf1b[_0x8b68('0x4a')][_0x8b68('0x4e')]));_0x735e17['attributes']=_0x735e17[_0x8b68('0x4c')][_0x8b68('0x4f')]?_0x735e17[_0x8b68('0x4c')]:_0x48f886[_0x8b68('0x49')];if(_0x51bf1b[_0x8b68('0x4a')]['includeAll']){_0x735e17[_0x8b68('0x5e')]=[{'all':!![]}];}_0x735e17=_[_0x8b68('0x56')]({},_0x735e17,_0x51bf1b[_0x8b68('0x5f')]);return db[_0x8b68('0x46')][_0x8b68('0x60')](_0x735e17)[_0x8b68('0x25')](handleEntityNotFound(_0x3f7f89,null))[_0x8b68('0x25')](respondWithResult(_0x3f7f89,null))[_0x8b68('0x5b')](handleError(_0x3f7f89,null));};exports['create']=function(_0x3f423e,_0x1a85da){return db[_0x8b68('0x46')][_0x8b68('0x61')](_0x3f423e[_0x8b68('0x62')],{})[_0x8b68('0x25')](function(_0x3a90ba){var _0x37c4cb=_0x3f423e[_0x8b68('0x63')][_0x8b68('0x3a')]({'plain':!![]});if(!_0x37c4cb)throw new Error(_0x8b68('0x64'));if(_0x37c4cb[_0x8b68('0x65')]===_0x8b68('0x63')){var _0x275b31=_0x3a90ba[_0x8b68('0x3a')]({'plain':!![]});var _0xd7e86d=_0x8b68('0x3b');return db[_0x8b68('0x66')][_0x8b68('0x60')]({'where':{'name':_0xd7e86d,'userProfileId':_0x37c4cb[_0x8b68('0x67')]},'raw':!![]})['then'](function(_0xaac776){if(_0xaac776&&_0xaac776['autoAssociation']===0x0){return db['UserProfileResource'][_0x8b68('0x61')]({'name':_0x275b31['name'],'resourceId':_0x275b31['id'],'type':_0xaac776[_0x8b68('0x40')],'sectionId':_0xaac776['id']},{})[_0x8b68('0x25')](function(){return _0x3a90ba;});}else{return _0x3a90ba;}})[_0x8b68('0x5b')](function(_0x4e2980){logger[_0x8b68('0x2b')](_0x8b68('0x68'),_0x4e2980);throw _0x4e2980;});}return _0x3a90ba;})[_0x8b68('0x25')](respondWithResult(_0x1a85da,0xc9))[_0x8b68('0x5b')](handleError(_0x1a85da,null));};exports[_0x8b68('0x38')]=function(_0x3031d1,_0x368025){if(_0x3031d1['body']['id']){delete _0x3031d1['body']['id'];}return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x3031d1[_0x8b68('0x69')]['id']},'include':[{'model':db[_0x8b68('0x43')],'as':_0x8b68('0x44')}]})[_0x8b68('0x25')](handleEntityNotFound(_0x368025,null))[_0x8b68('0x25')](saveUpdates(_0x3031d1[_0x8b68('0x62')],null))[_0x8b68('0x25')](respondWithResult(_0x368025,null))[_0x8b68('0x5b')](handleError(_0x368025,null));};exports[_0x8b68('0x39')]=function(_0x2379d4,_0x316652){return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x2379d4[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x316652,null))[_0x8b68('0x25')](removeEntity(_0x316652,null))['catch'](handleError(_0x316652,null));};exports['describe']=function(_0xdc096c,_0x23e01a){return db['WhatsappAccount']['describe']()['then'](respondWithResult(_0x23e01a,null))[_0x8b68('0x5b')](handleError(_0x23e01a,null));};exports[_0x8b68('0x6a')]=function(_0xd5f52e,_0x3c8e0d,_0xc52321){if(_0xd5f52e['body']['id']){delete _0xd5f52e[_0x8b68('0x62')]['id'];}return db[_0x8b68('0x46')]['find']({'where':{'id':_0xd5f52e[_0x8b68('0x69')]['id']}})['then'](handleEntityNotFound(_0x3c8e0d,null))['then'](function(_0x5d8cea){if(_0x5d8cea){_0xd5f52e[_0x8b68('0x62')][_0x8b68('0x6b')]=_0x5d8cea['id'];return db[_0x8b68('0x6c')][_0x8b68('0x61')](_0xd5f52e[_0x8b68('0x62')]);}})[_0x8b68('0x25')](respondWithResult(_0x3c8e0d,null))[_0x8b68('0x5b')](handleError(_0x3c8e0d,null));};exports[_0x8b68('0x6d')]=function(_0x427752,_0x20a556,_0x55e04f){var _0x3a8d15={'raw':![],'where':{}};var _0x335b3b={};var _0x310ec9={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x427752[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x20a556,null))['then'](function(_0x1c3f37){if(_0x1c3f37){_0x335b3b[_0x8b68('0x49')]=_[_0x8b68('0x5d')](db[_0x8b68('0x6c')]['rawAttributes']);_0x335b3b[_0x8b68('0x4a')]=_['keys'](_0x427752['query']);_0x335b3b[_0x8b68('0x4b')]=_['intersection'](_0x335b3b[_0x8b68('0x49')],_0x335b3b[_0x8b68('0x4a')]);_0x3a8d15['attributes']=_[_0x8b68('0x4d')](_0x335b3b[_0x8b68('0x49')],qs[_0x8b68('0x4e')](_0x427752[_0x8b68('0x4a')][_0x8b68('0x4e')]));_0x3a8d15['attributes']=_0x3a8d15[_0x8b68('0x4c')][_0x8b68('0x4f')]?_0x3a8d15[_0x8b68('0x4c')]:_0x335b3b[_0x8b68('0x49')];if(!_0x427752[_0x8b68('0x4a')]['hasOwnProperty']('nolimit')){_0x3a8d15[_0x8b68('0x32')]=qs['limit'](_0x427752[_0x8b68('0x4a')][_0x8b68('0x32')]);_0x3a8d15[_0x8b68('0x31')]=qs[_0x8b68('0x31')](_0x427752[_0x8b68('0x4a')][_0x8b68('0x31')]);}_0x3a8d15[_0x8b68('0x51')]=qs['sort'](_0x427752[_0x8b68('0x4a')]['sort']);_0x3a8d15[_0x8b68('0x53')]=qs[_0x8b68('0x4b')](_[_0x8b68('0x54')](_0x427752['query'],_0x335b3b[_0x8b68('0x4b')]));_0x3a8d15['where'][_0x8b68('0x6b')]=_0x1c3f37['id'];if(_0x427752['query'][_0x8b68('0x55')]){_0x3a8d15[_0x8b68('0x53')]=_[_0x8b68('0x56')](_0x3a8d15['where'],{'$or':_[_0x8b68('0x45')](_0x3a8d15[_0x8b68('0x4c')],function(_0x3d8a44){var _0x214fe4={};_0x214fe4[_0x3d8a44]={'$like':'%'+_0x427752[_0x8b68('0x4a')][_0x8b68('0x55')]+'%'};return _0x214fe4;})});}_0x3a8d15=_[_0x8b68('0x56')]({},_0x3a8d15,_0x427752[_0x8b68('0x5f')]);return db[_0x8b68('0x6c')]['count']({'where':_0x3a8d15[_0x8b68('0x53')]})[_0x8b68('0x25')](function(_0x9a5bec){_0x310ec9[_0x8b68('0x30')]=_0x9a5bec;if(_0x427752[_0x8b68('0x4a')]['includeAll']){_0x3a8d15[_0x8b68('0x5e')]=[{'all':!![]}];}return db['Disposition'][_0x8b68('0x59')](_0x3a8d15);})[_0x8b68('0x25')](function(_0x524763){_0x310ec9[_0x8b68('0x5a')]=_0x524763;return _0x310ec9;});}})[_0x8b68('0x25')](respondWithFilteredResult(_0x20a556,_0x3a8d15))[_0x8b68('0x5b')](handleError(_0x20a556,null));};exports['removeDispositions']=function(_0x3cca8c,_0x18ee1a,_0x43a874){return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x3cca8c[_0x8b68('0x69')]['id']}})['then'](handleEntityNotFound(_0x18ee1a,null))[_0x8b68('0x25')](function(_0x14474f){if(_0x14474f){return _0x14474f[_0x8b68('0x6e')](_0x3cca8c['query'][_0x8b68('0x6f')]);}})[_0x8b68('0x25')](respondWithStatusCode(_0x18ee1a,null))[_0x8b68('0x5b')](handleError(_0x18ee1a,null));};exports[_0x8b68('0x70')]=function(_0xa02ad9,_0x377045,_0x320f42){if(_0xa02ad9[_0x8b68('0x62')]['id']){delete _0xa02ad9[_0x8b68('0x62')]['id'];}return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0xa02ad9['params']['id']}})['then'](handleEntityNotFound(_0x377045,null))[_0x8b68('0x25')](function(_0x3c6398){if(_0x3c6398){_0xa02ad9[_0x8b68('0x62')][_0x8b68('0x6b')]=_0x3c6398['id'];return db[_0x8b68('0x71')]['create'](_0xa02ad9[_0x8b68('0x62')]);}})[_0x8b68('0x25')](respondWithResult(_0x377045,null))[_0x8b68('0x5b')](handleError(_0x377045,null));};exports[_0x8b68('0x72')]=function(_0x48f60a,_0x52aa06,_0x417bc0){var _0x42a69b={'raw':![],'where':{}};var _0x2905a5={};var _0x1bf8cd={'count':0x0,'rows':[]};return db[_0x8b68('0x46')][_0x8b68('0x73')]({'where':{'id':_0x48f60a[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x52aa06,null))['then'](function(_0x7864cf){if(_0x7864cf){_0x2905a5[_0x8b68('0x49')]=_[_0x8b68('0x5d')](db[_0x8b68('0x71')][_0x8b68('0x74')]);_0x2905a5[_0x8b68('0x4a')]=_['keys'](_0x48f60a[_0x8b68('0x4a')]);_0x2905a5[_0x8b68('0x4b')]=_[_0x8b68('0x4d')](_0x2905a5['model'],_0x2905a5[_0x8b68('0x4a')]);_0x42a69b['attributes']=_[_0x8b68('0x4d')](_0x2905a5['model'],qs[_0x8b68('0x4e')](_0x48f60a[_0x8b68('0x4a')][_0x8b68('0x4e')]));_0x42a69b[_0x8b68('0x4c')]=_0x42a69b[_0x8b68('0x4c')][_0x8b68('0x4f')]?_0x42a69b['attributes']:_0x2905a5['model'];if(!_0x48f60a['query'][_0x8b68('0x50')](_0x8b68('0x75'))){_0x42a69b[_0x8b68('0x32')]=qs[_0x8b68('0x32')](_0x48f60a[_0x8b68('0x4a')][_0x8b68('0x32')]);_0x42a69b[_0x8b68('0x31')]=qs[_0x8b68('0x31')](_0x48f60a[_0x8b68('0x4a')][_0x8b68('0x31')]);}_0x42a69b[_0x8b68('0x51')]=qs[_0x8b68('0x52')](_0x48f60a[_0x8b68('0x4a')][_0x8b68('0x52')]);_0x42a69b[_0x8b68('0x53')]=qs['filters'](_['pick'](_0x48f60a['query'],_0x2905a5[_0x8b68('0x4b')]));_0x42a69b[_0x8b68('0x53')][_0x8b68('0x6b')]=_0x7864cf['id'];if(_0x48f60a[_0x8b68('0x4a')][_0x8b68('0x55')]){_0x42a69b['where']=_[_0x8b68('0x56')](_0x42a69b['where'],{'$or':_[_0x8b68('0x45')](_0x42a69b['attributes'],function(_0x1f9786){var _0x577e52={};_0x577e52[_0x1f9786]={'$like':'%'+_0x48f60a[_0x8b68('0x4a')]['filter']+'%'};return _0x577e52;})});}_0x42a69b=_[_0x8b68('0x56')]({},_0x42a69b,_0x48f60a[_0x8b68('0x5f')]);return db['CannedAnswer'][_0x8b68('0x30')]({'where':_0x42a69b[_0x8b68('0x53')]})['then'](function(_0x3d8d42){_0x1bf8cd['count']=_0x3d8d42;if(_0x48f60a[_0x8b68('0x4a')]['includeAll']){_0x42a69b[_0x8b68('0x5e')]=[{'all':!![]}];}return db[_0x8b68('0x71')][_0x8b68('0x59')](_0x42a69b);})[_0x8b68('0x25')](function(_0x2d24f8){_0x1bf8cd[_0x8b68('0x5a')]=_0x2d24f8;return _0x1bf8cd;});}})[_0x8b68('0x25')](respondWithFilteredResult(_0x52aa06,_0x42a69b))['catch'](handleError(_0x52aa06,null));};exports[_0x8b68('0x76')]=function(_0x2ecedc,_0x1e34f8,_0x22c8cb){return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x2ecedc[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x1e34f8,null))[_0x8b68('0x25')](function(_0x2bd8e4){if(_0x2bd8e4){return _0x2bd8e4[_0x8b68('0x76')](_0x2ecedc[_0x8b68('0x4a')][_0x8b68('0x6f')]);}})[_0x8b68('0x25')](respondWithStatusCode(_0x1e34f8,null))['catch'](handleError(_0x1e34f8,null));};exports[_0x8b68('0x77')]=function(_0x477cd3,_0x17bea5,_0x2e690b){return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x477cd3['params']['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x17bea5,null))[_0x8b68('0x25')](function(_0x3a24f8){if(_0x3a24f8){return _0x3a24f8[_0x8b68('0x77')](_0x477cd3[_0x8b68('0x62')][_0x8b68('0x6f')],_[_0x8b68('0x78')](_0x477cd3[_0x8b68('0x62')],[_0x8b68('0x6f'),'id'])||{})['spread'](function(_0x31d70c){for(var _0x4df181=0x0;_0x4df181<_0x477cd3['body']['ids'][_0x8b68('0x4f')];_0x4df181+=0x1){socket[_0x8b68('0x79')]('userWhatsappAccount:save',{'UserId':_0x477cd3[_0x8b68('0x62')][_0x8b68('0x6f')][_0x4df181],'WhatsappAccountId':_0x477cd3[_0x8b68('0x69')]['id']});}return _0x31d70c;});}})[_0x8b68('0x25')](respondWithResult(_0x17bea5,null))[_0x8b68('0x5b')](handleError(_0x17bea5,null));};exports[_0x8b68('0x7a')]=function(_0x466a77,_0x387644,_0x14bbfc){return db[_0x8b68('0x46')]['find']({'where':{'id':_0x466a77[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x387644,null))['then'](function(_0x1a62dd){if(_0x1a62dd){return _0x1a62dd[_0x8b68('0x7a')](_0x466a77['query']['ids'])[_0x8b68('0x25')](function(){if(_[_0x8b68('0x7b')](_0x466a77[_0x8b68('0x4a')][_0x8b68('0x6f')])){for(var _0x20d8ff=0x0;_0x20d8ff<_0x466a77[_0x8b68('0x4a')][_0x8b68('0x6f')][_0x8b68('0x4f')];_0x20d8ff+=0x1){socket['emit'](_0x8b68('0x7c'),{'UserId':Number(_0x466a77['query']['ids'][_0x20d8ff]),'WhatsappAccountId':Number(_0x466a77[_0x8b68('0x69')]['id'])});}}else{socket[_0x8b68('0x79')]('userWhatsappAccount:remove',{'UserId':Number(_0x466a77[_0x8b68('0x4a')]['ids']),'WhatsappAccountId':Number(_0x466a77[_0x8b68('0x69')]['id'])});}});}})[_0x8b68('0x25')](respondWithStatusCode(_0x387644,null))[_0x8b68('0x5b')](handleError(_0x387644,null));};exports['getAgents']=function(_0x133557,_0x4fea56,_0x4b4409){var _0x1154b8={};var _0xe9810c={};var _0xd27126;var _0x2812c3;return db[_0x8b68('0x46')][_0x8b68('0x73')]({'where':{'id':_0x133557[_0x8b68('0x69')]['id']}})['then'](handleEntityNotFound(_0x4fea56,null))[_0x8b68('0x25')](function(_0x114f5){if(_0x114f5){_0xd27126=_0x114f5;_0xe9810c[_0x8b68('0x49')]=_[_0x8b68('0x5d')](db[_0x8b68('0x7d')][_0x8b68('0x74')]);_0xe9810c[_0x8b68('0x4a')]=_['keys'](_0x133557[_0x8b68('0x4a')]);_0xe9810c[_0x8b68('0x4b')]=_['intersection'](_0xe9810c['model'],_0xe9810c[_0x8b68('0x4a')]);_0x1154b8[_0x8b68('0x4c')]=_['intersection'](_0xe9810c[_0x8b68('0x49')],qs[_0x8b68('0x4e')](_0x133557[_0x8b68('0x4a')][_0x8b68('0x4e')]));_0x1154b8[_0x8b68('0x4c')]=_0x1154b8[_0x8b68('0x4c')][_0x8b68('0x4f')]?_0x1154b8['attributes']:_0xe9810c[_0x8b68('0x49')];_0x1154b8[_0x8b68('0x51')]=qs[_0x8b68('0x52')](_0x133557['query']['sort']);_0x1154b8[_0x8b68('0x53')]=qs[_0x8b68('0x4b')](_[_0x8b68('0x54')](_0x133557['query'],_0xe9810c['filters']));if(_0x133557[_0x8b68('0x4a')][_0x8b68('0x55')]){_0x1154b8[_0x8b68('0x53')]=_['merge'](_0x1154b8['where'],{'$or':_['map'](_0x1154b8[_0x8b68('0x4c')],function(_0x3e7544){var _0xb1e53c={};_0xb1e53c[_0x3e7544]={'$like':'%'+_0x133557[_0x8b68('0x4a')][_0x8b68('0x55')]+'%'};return _0xb1e53c;})});}_0x1154b8=_['merge']({},_0x1154b8,_0x133557['options']);return _0xd27126[_0x8b68('0x7e')](_0x1154b8);}})['then'](function(_0x5a1823){if(_0x5a1823){_0x2812c3=_0x5a1823['length'];if(!_0x133557[_0x8b68('0x4a')][_0x8b68('0x50')](_0x8b68('0x75'))){_0x1154b8['limit']=qs[_0x8b68('0x32')](_0x133557['query'][_0x8b68('0x32')]);_0x1154b8[_0x8b68('0x31')]=qs[_0x8b68('0x31')](_0x133557[_0x8b68('0x4a')][_0x8b68('0x31')]);}return _0xd27126[_0x8b68('0x7e')](_0x1154b8);}})[_0x8b68('0x25')](function(_0x229dee){if(_0x229dee){return _0x229dee?{'count':_0x2812c3,'rows':_0x229dee}:null;}})[_0x8b68('0x25')](respondWithResult(_0x4fea56,null))[_0x8b68('0x5b')](handleError(_0x4fea56,null));};exports[_0x8b68('0x7f')]=function(_0x14e073,_0x21e601,_0x331ce4){return db[_0x8b68('0x46')][_0x8b68('0x73')]({'where':{'id':_0x14e073[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x21e601,null))[_0x8b68('0x25')](function(_0x4af96b){if(_0x4af96b){return db[_0x8b68('0x80')]['transaction'](function(_0xdb96d9){return db[_0x8b68('0x81')][_0x8b68('0x39')]({'where':{'WhatsappAccountId':_0x14e073[_0x8b68('0x69')]['id']},'transaction':_0xdb96d9})[_0x8b68('0x25')](function(_0x6b1ce1){var _0x3eebf9=_[_0x8b68('0x45')](_0x14e073[_0x8b68('0x62')],function(_0x3ed9cf){_0x3ed9cf[_0x8b68('0x6b')]=_0x14e073[_0x8b68('0x69')]['id'];return _0x3ed9cf;});return db['WhatsappApplication'][_0x8b68('0x82')](_0x3eebf9,{'transaction':_0xdb96d9});});})[_0x8b68('0x25')](function(){return db[_0x8b68('0x81')][_0x8b68('0x83')]({'where':{'WhatsappAccountId':_0x14e073[_0x8b68('0x69')]['id']},'order':_0x8b68('0x84')});});}})[_0x8b68('0x25')](respondWithResult(_0x21e601,null))[_0x8b68('0x5b')](handleError(_0x21e601,null));};exports[_0x8b68('0x85')]=function(_0x267011,_0x2ba260,_0x499eb1){var _0x1825f1={};var _0x446bf9={};var _0x17251d;var _0x421689;return db[_0x8b68('0x46')]['findOne']({'where':{'id':_0x267011[_0x8b68('0x69')]['id']}})[_0x8b68('0x25')](handleEntityNotFound(_0x2ba260,null))['then'](function(_0x14021d){if(_0x14021d){_0x17251d=_0x14021d;_0x446bf9[_0x8b68('0x49')]=_['keys'](db['WhatsappApplication'][_0x8b68('0x74')]);_0x446bf9[_0x8b68('0x4a')]=_[_0x8b68('0x5d')](_0x267011[_0x8b68('0x4a')]);_0x446bf9[_0x8b68('0x4b')]=_[_0x8b68('0x4d')](_0x446bf9[_0x8b68('0x49')],_0x446bf9[_0x8b68('0x4a')]);_0x1825f1['attributes']=_[_0x8b68('0x4d')](_0x446bf9[_0x8b68('0x49')],qs[_0x8b68('0x4e')](_0x267011[_0x8b68('0x4a')]['fields']));_0x1825f1[_0x8b68('0x4c')]=_0x1825f1['attributes'][_0x8b68('0x4f')]?_0x1825f1[_0x8b68('0x4c')]:_0x446bf9[_0x8b68('0x49')];_0x1825f1[_0x8b68('0x51')]=qs[_0x8b68('0x52')](_0x267011[_0x8b68('0x4a')]['sort']);_0x1825f1['where']=qs['filters'](_['pick'](_0x267011['query'],_0x446bf9[_0x8b68('0x4b')]));if(_0x267011[_0x8b68('0x4a')]['filter']){_0x1825f1['where']=_[_0x8b68('0x56')](_0x1825f1[_0x8b68('0x53')],{'$or':_['map'](_0x1825f1[_0x8b68('0x4c')],function(_0x2a1efe){var _0x50df91={};_0x50df91[_0x2a1efe]={'$like':'%'+_0x267011['query'][_0x8b68('0x55')]+'%'};return _0x50df91;})});}_0x1825f1=_[_0x8b68('0x56')]({},_0x1825f1,_0x267011[_0x8b68('0x5f')]);return _0x17251d[_0x8b68('0x85')](_0x1825f1);}})[_0x8b68('0x25')](function(_0x1bf1ac){if(_0x1bf1ac){_0x421689=_0x1bf1ac[_0x8b68('0x4f')];if(!_0x267011[_0x8b68('0x4a')]['hasOwnProperty'](_0x8b68('0x75'))){_0x1825f1[_0x8b68('0x32')]=qs[_0x8b68('0x32')](_0x267011[_0x8b68('0x4a')][_0x8b68('0x32')]);_0x1825f1['offset']=qs[_0x8b68('0x31')](_0x267011['query'][_0x8b68('0x31')]);}return _0x17251d['getApplications'](_0x1825f1);}})[_0x8b68('0x25')](function(_0x2afa34){if(_0x2afa34){return _0x2afa34?{'count':_0x421689,'rows':_0x2afa34}:null;}})[_0x8b68('0x25')](respondWithResult(_0x2ba260,null))['catch'](handleError(_0x2ba260,null));};exports[_0x8b68('0x86')]=function(_0x4ca4ce,_0x18d02d,_0x150ff0){var _0x16eb4c={'channel':_0x8b68('0x87')};var _0x5a25d1=[];var _0x43e869=[];var _0x1b12a6={};return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x4ca4ce[_0x8b68('0x69')]['id']},'include':[{'model':db[_0x8b68('0x81')],'as':_0x8b68('0x88')}]})[_0x8b68('0x25')](handleEntityNotFound(_0x18d02d,null))[_0x8b68('0x25')](function(_0x3b1ed3){_0x16eb4c[_0x8b68('0x89')]=_0x3b1ed3;_0x16eb4c[_0x8b68('0x8a')]=_[_0x8b68('0x8b')](_0x3b1ed3[_0x8b68('0x88')],[_0x8b68('0x84')],[_0x8b68('0x8c')]);if(_0x16eb4c['account'][_0x8b68('0x88')]){delete _0x16eb4c['account'][_0x8b68('0x88')];}return db[_0x8b68('0x8d')][_0x8b68('0x8e')]();})[_0x8b68('0x25')](function(_0x30a51e){if(!_0x30a51e){throw new db[(_0x8b68('0x8f'))]['ValidationError']('no\x20available\x20attributes');}_0x5a25d1=_['difference'](_[_0x8b68('0x5d')](_0x30a51e),[_0x8b68('0x90'),_0x8b68('0x91')]);_0x43e869=_[_0x8b68('0x92')](_[_0x8b68('0x5d')](_0x30a51e),[_0x8b68('0x90'),_0x8b68('0x91'),_0x8b68('0x93'),_0x8b68('0x94')]);_0x16eb4c[_0x8b68('0x62')]={'mapKey':'mobile'};if(_0x16eb4c['account'][_0x8b68('0x95')]&&_0x16eb4c['account'][_0x8b68('0x95')]===_0x8b68('0x96')){_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x97')]=_0x4ca4ce[_0x8b68('0x62')][_0x8b68('0x98')][_0x8b68('0x99')]('whatsapp:','');_0x16eb4c['body'][_0x8b68('0x62')]=_0x4ca4ce[_0x8b68('0x62')][_0x8b68('0x9a')];_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x9b')]=_0x4ca4ce['body'][_0x8b68('0x9c')];}if(_0x16eb4c[_0x8b68('0x62')]['id']){delete _0x16eb4c[_0x8b68('0x62')]['id'];}if(_[_0x8b68('0x9d')](_0x16eb4c[_0x8b68('0x62')]['from'])){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x22'))](_0x8b68('0x9e'));}if(_[_0x8b68('0x9d')](_0x16eb4c[_0x8b68('0x62')]['body'])||_0x16eb4c[_0x8b68('0x62')]['body']===''){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8b68('0x9d')](_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x9f')])){throw new db['Sequelize'][(_0x8b68('0x22'))](_0x8b68('0xa0')+_0x43e869);}if(!_['includes'](_0x43e869,_0x16eb4c[_0x8b68('0x62')]['mapKey'])){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x22'))](_0x8b68('0xa1')+_0x43e869);}_0x1b12a6[_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x9f')]]=_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x97')];return db[_0x8b68('0xa2')][_0x8b68('0x60')]({'where':{'id':_0x16eb4c[_0x8b68('0x89')][_0x8b68('0x94')]},'include':[{'model':db['CmContact'],'as':_0x8b68('0xa3'),'where':_0x1b12a6,'limit':0x1,'order':[['updatedAt',_0x8b68('0xa4')]]}]});})[_0x8b68('0x25')](handleEntityNotFound(_0x18d02d,null))[_0x8b68('0x25')](function(_0x5d6896){if(_0x5d6896){_0x16eb4c[_0x8b68('0xa5')]=_['omit'](_0x5d6896,[_0x8b68('0xa3')]);if(_0x5d6896[_0x8b68('0xa3')]['length']){return _0x5d6896[_0x8b68('0xa3')][0x0];}var _0x4e4c0f=_[_0x8b68('0x1c')](_0x16eb4c['body'],{'firstName':_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x97')],'ListId':_0x5d6896['id']});_0x4e4c0f[_0x16eb4c['body'][_0x8b68('0x9f')]]=_0x16eb4c[_0x8b68('0x62')]['from'];return db['CmContact']['create'](_0x4e4c0f,{'fields':_0x5a25d1,'raw':!![]});}})[_0x8b68('0x25')](handleEntityNotFound(_0x18d02d,null))[_0x8b68('0x25')](function(_0x421fd5){if(_0x421fd5){_0x16eb4c[_0x8b68('0xa6')]=_0x421fd5;var _0x54419f={'ContactId':_0x421fd5['id'],'phone':_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x97')],'WhatsappAccountId':_0x4ca4ce[_0x8b68('0x69')]['id']};var _0x111e8b={'ContactId':_0x421fd5['id'],'WhatsappAccountId':_0x4ca4ce[_0x8b68('0x69')]['id'],'closed':![]};return db[_0x8b68('0xa7')][_0x8b68('0x60')]({'where':_0x111e8b})[_0x8b68('0x25')](function(_0x124655){if(_0x124655){return[_0x124655,![]];}return db['WhatsappInteraction'][_0x8b68('0x61')](_0x54419f)['then'](function(_0x4e5184){return[_0x4e5184,!![]];});});}})['spread'](function(_0x3b9ba6,_0x3a2e90){_0x16eb4c[_0x8b68('0xa8')]=_0x3b9ba6[_0x8b68('0x3a')]({'plain':!![]});_0x16eb4c[_0x8b68('0xa8')][_0x8b68('0xa9')]=![];if(_0x3a2e90){if(_0x16eb4c[_0x8b68('0x89')][_0x8b68('0xaa')]){_0x16eb4c[_0x8b68('0x8a')][_0x8b68('0xab')]({'id':0x0,'priority':_0x16eb4c[_0x8b68('0x8a')][_0x8b68('0x4f')]+0x1,'app':_0x8b68('0xac'),'appdata':_0x8b68('0xad'),'interval':_0x8b68('0xae')});}_0x16eb4c[_0x8b68('0xa8')]['created']=!![];}return db[_0x8b68('0xaf')][_0x8b68('0x61')]({'phone':_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x97')],'messageId':_0x16eb4c[_0x8b68('0x62')]['messageId'],'body':_0x16eb4c[_0x8b68('0x62')][_0x8b68('0x62')],'WhatsappAccountId':_0x4ca4ce[_0x8b68('0x69')]['id'],'WhatsappInteractionId':_0x3b9ba6['id'],'direction':'in','ContactId':_0x3b9ba6[_0x8b68('0xb0')],'AttachmentId':_0x16eb4c[_0x8b68('0x62')][_0x8b68('0xb1')]});})[_0x8b68('0x25')](function(_0x11b4a6){_0x16eb4c[_0x8b68('0x2c')]=_0x11b4a6;if(_0x16eb4c[_0x8b68('0xa8')][_0x8b68('0xb2')]){return db[_0x8b68('0x7d')]['find']({'attributes':['id','name'],'where':{'id':_0x16eb4c[_0x8b68('0xa8')][_0x8b68('0xb2')]}})['then'](function(_0x2bb536){if(_0x2bb536){_0x16eb4c[_0x8b68('0x8a')][_0x8b68('0xb3')]({'id':0x0,'priority':0x0,'app':_0x8b68('0xb4'),'appdata':_0x2bb536[_0x8b68('0x40')]+','+(_0x16eb4c['account']['waitForTheAssignedAgent']||0xa),'interval':_0x8b68('0xae')});}return respondWithRpcPromise(_0x8b68('0xb5'),'startRouting',_0x16eb4c);});}return respondWithRpcPromise(_0x8b68('0xb5'),_0x8b68('0xb6'),_0x16eb4c);})['then'](function(_0x3791e0){if(_0x3791e0){var _0x47e2ea=0xc8;var _0x2a2758=_0x8b68('0xb7');logger[_0x8b68('0x26')](_0x8b68('0x29'),_0x2a2758,_0x47e2ea,_0x8b68('0xb8'));logger[_0x8b68('0x28')](_0x8b68('0xb9'),_0x2a2758,_0x47e2ea,_0x8b68('0xb8'),JSON['stringify'](_0x3791e0));if(_0x16eb4c[_0x8b68('0x89')]['type']==='twilio'){return _0x18d02d[_0x8b68('0x2e')](_0x47e2ea)[_0x8b68('0x33')](_0x8b68('0xba'),'text/xml')['send'](_0x8b68('0xbb'));}else{return _0x18d02d['status'](_0x47e2ea)[_0x8b68('0x2f')](_0x3791e0);}}})[_0x8b68('0x5b')](handleError(_0x18d02d,null));};exports[_0x8b68('0x41')]=function(_0x4de88e,_0x22aacc,_0x4fb7f2){var _0x5968cc,_0x26047a,_0x508455;if(_[_0x8b68('0x9d')](_0x4de88e[_0x8b68('0x62')][_0x8b68('0x62')])||_0x4de88e[_0x8b68('0x62')][_0x8b68('0x62')]===''){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x22'))](_0x8b68('0xbc'));}if(_[_0x8b68('0x9d')](_0x4de88e[_0x8b68('0x62')]['to'])){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x22'))]('to\x20is\x20mandatory');}_0x5968cc=_0x4de88e[_0x8b68('0x62')]['to'];return db[_0x8b68('0x46')][_0x8b68('0x60')]({'where':{'id':_0x4de88e[_0x8b68('0x69')]['id']},'include':[{'model':db[_0x8b68('0xa2')],'as':_0x8b68('0xbd'),'include':[{'model':db['CmContact'],'as':_0x8b68('0xa3'),'where':{'mobile':_0x5968cc},'limit':0x1,'order':[[_0x8b68('0x91'),_0x8b68('0xa4')]]}]}]})[_0x8b68('0x25')](handleEntityNotFound(_0x22aacc,null))[_0x8b68('0x25')](function(_0x3407e6){if(_0x3407e6&&_0x3407e6[_0x8b68('0xbd')]){_0x26047a=_0x3407e6[_0x8b68('0x3a')]({'plain':!![]});if(_0x26047a[_0x8b68('0xbd')]&&_0x26047a[_0x8b68('0xbd')][_0x8b68('0xa3')][_0x8b68('0x4f')]){return _0x26047a[_0x8b68('0xbd')]['Contacts'][0x0];}return db['CmContact'][_0x8b68('0x61')](_[_0x8b68('0x1c')](_0x4de88e[_0x8b68('0x62')],{'firstName':_0x5968cc,'mobile':_0x5968cc,'phone':_0x5968cc,'ListId':_0x26047a[_0x8b68('0x94')]}));}})[_0x8b68('0x25')](handleEntityNotFound(_0x22aacc,null))[_0x8b68('0x25')](function(_0x220f3b){if(_0x220f3b){_0x508455=_0x220f3b;return db[_0x8b68('0xa7')][_0x8b68('0x60')]({'where':{'ContactId':_0x508455['id'],'closed':![],'WhatsappAccountId':_0x26047a['id']}})['then'](function(_0x5406f6){if(_0x5406f6){return[_0x5406f6,![]];}return db[_0x8b68('0xa7')]['create']({'UserId':_0x4de88e[_0x8b68('0x63')]['id'],'ContactId':_0x508455['id'],'WhatsappAccountId':_0x26047a['id'],'phone':_0x5968cc,'firstMsgDirection':_0x8b68('0xbe'),'Messages':[_[_0x8b68('0x56')](_0x4de88e[_0x8b68('0x62')],{'read':![],'body':_0x4de88e[_0x8b68('0x62')][_0x8b68('0x62')],'phone':_0x5968cc,'WhatsappAccountId':_0x26047a['id'],'UserId':_0x4de88e[_0x8b68('0x63')]['id'],'ContactId':_0x508455['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x8b68('0xbf')}]})[_0x8b68('0x25')](function(_0x1273c9){return[_0x1273c9,!![]];});});}})['spread'](function(_0x1c27e5,_0x2fc6db){if(_0x2fc6db){return _0x1c27e5;}return db[_0x8b68('0xaf')][_0x8b68('0x61')](_[_0x8b68('0x56')](_0x4de88e[_0x8b68('0x62')],{'read':![],'body':_0x4de88e[_0x8b68('0x62')][_0x8b68('0x62')],'phone':_0x5968cc,'WhatsappAccountId':_0x26047a['id'],'WhatsappInteractionId':_0x1c27e5['id'],'UserId':_0x4de88e[_0x8b68('0x63')]['id'],'ContactId':_0x508455['id']}))['then'](function(_0x2a5e48){_0x1c27e5[_0x8b68('0xc0')][_0x8b68('0xbf')]=[];_0x1c27e5[_0x8b68('0xc0')][_0x8b68('0xbf')][_0x8b68('0xab')](_0x2a5e48['dataValues']);return _0x1c27e5;});})[_0x8b68('0x25')](respondWithResult(_0x22aacc,null))[_0x8b68('0x5b')](handleError(_0x22aacc,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index b68fe7d..1da4f07 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 _0x82c4=['WhatsappAccount','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x25656f,_0x4cf8be){var _0x6e703f=function(_0x334697){while(--_0x334697){_0x25656f['push'](_0x25656f['shift']());}};_0x6e703f(++_0x4cf8be);}(_0x82c4,0x1ca));var _0x482c=function(_0x25390b,_0x1771ca){_0x25390b=_0x25390b-0x0;var _0x490180=_0x82c4[_0x25390b];return _0x490180;};'use strict';var EventEmitter=require(_0x482c('0x0'));var WhatsappAccount=require(_0x482c('0x1'))['db'][_0x482c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x482c('0x3')](0x0);var events={'afterCreate':_0x482c('0x4'),'afterUpdate':_0x482c('0x5'),'afterDestroy':_0x482c('0x6')};function emitEvent(_0x56de13){return function(_0x16b0f8,_0x5f4dee,_0x4556c8){WhatsappAccountEvents['emit'](_0x56de13+':'+_0x16b0f8['id'],_0x16b0f8);WhatsappAccountEvents[_0x482c('0x7')](_0x56de13,_0x16b0f8);_0x4556c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x482c('0x8')](e,emitEvent(event));}}module[_0x482c('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x8af6=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8af6,0x76));var _0x68af=function(_0x8ef6ea,_0x325bc1){_0x8ef6ea=_0x8ef6ea-0x0;var _0x5f47a6=_0x8af6[_0x8ef6ea];return _0x5f47a6;};'use strict';var EventEmitter=require(_0x68af('0x0'));var WhatsappAccount=require(_0x68af('0x1'))['db'][_0x68af('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x68af('0x3')](0x0);var events={'afterCreate':_0x68af('0x4'),'afterUpdate':_0x68af('0x5'),'afterDestroy':_0x68af('0x6')};function emitEvent(_0xe2ba54){return function(_0x1f8b3a,_0x3d1c16,_0x52bd87){WhatsappAccountEvents[_0x68af('0x7')](_0xe2ba54+':'+_0x1f8b3a['id'],_0x1f8b3a);WhatsappAccountEvents['emit'](_0xe2ba54,_0x1f8b3a);_0x52bd87(null);};}for(var e in events){if(events[_0x68af('0x8')](e)){var event=events[e];WhatsappAccount[_0x68af('0x9')](e,emitEvent(event));}}module[_0x68af('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 f7779b8..2aedc5f 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 _0x1c1e=['util','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','whatsapp_accounts','lodash'];(function(_0x1114b1,_0x4c4343){var _0x362af8=function(_0x5d3733){while(--_0x5d3733){_0x1114b1['push'](_0x1114b1['shift']());}};_0x362af8(++_0x4c4343);}(_0x1c1e,0x95));var _0xe1c1=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x1c1e[_0x587fb5];return _0x551105;};'use strict';var _=require(_0xe1c1('0x0'));var util=require(_0xe1c1('0x1'));var logger=require('../../config/logger')(_0xe1c1('0x2'));var moment=require(_0xe1c1('0x3'));var BPromise=require(_0xe1c1('0x4'));var rp=require(_0xe1c1('0x5'));var fs=require('fs');var path=require(_0xe1c1('0x6'));var rimraf=require('rimraf');var config=require(_0xe1c1('0x7'));var attributes=require(_0xe1c1('0x8'));module['exports']=function(_0x3a244a,_0x5855cc){return _0x3a244a['define']('WhatsappAccount',attributes,{'tableName':_0xe1c1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x750d=['./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','util','api','moment','path','rimraf','../../config/environment'];(function(_0x28ff19,_0x12882e){var _0x1afa54=function(_0x5cba72){while(--_0x5cba72){_0x28ff19['push'](_0x28ff19['shift']());}};_0x1afa54(++_0x12882e);}(_0x750d,0x7c));var _0xd750=function(_0x5748ed,_0x4c3271){_0x5748ed=_0x5748ed-0x0;var _0x2cda1b=_0x750d[_0x5748ed];return _0x2cda1b;};'use strict';var _=require('lodash');var util=require(_0xd750('0x0'));var logger=require('../../config/logger')(_0xd750('0x1'));var moment=require(_0xd750('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd750('0x3'));var rimraf=require(_0xd750('0x4'));var config=require(_0xd750('0x5'));var attributes=require(_0xd750('0x6'));module['exports']=function(_0x5a2380,_0x36c027){return _0x5a2380[_0xd750('0x7')](_0xd750('0x8'),attributes,{'tableName':_0xd750('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 226c00d..d87f9f5 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 _0xc3fa=['redis','localhost','socket.io-emitter','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','include','map','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3fa,0x9f));var _0xac3f=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xc3fa[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0xac3f('0x0'));var util=require(_0xac3f('0x1'));var moment=require(_0xac3f('0x2'));var BPromise=require(_0xac3f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac3f('0x4'));var db=require(_0xac3f('0x5'))['db'];var utils=require(_0xac3f('0x6'));var logger=require(_0xac3f('0x7'))('rpc');var config=require(_0xac3f('0x8'));var jayson=require(_0xac3f('0x9'));var client=jayson['client'][_0xac3f('0xa')]({'port':0x232a});config[_0xac3f('0xb')]=_['defaults'](config[_0xac3f('0xb')],{'host':_0xac3f('0xc'),'port':0x18eb});var socket=require(_0xac3f('0xd'))(new Redis(config[_0xac3f('0xb')]));require('./whatsappAccount.socket')[_0xac3f('0xe')](socket);function respondWithRpcPromise(_0x14f555,_0x58f4f8,_0xbb93ab){return new BPromise(function(_0x4039ab,_0x1901f9){return client['request'](_0x14f555,_0xbb93ab)[_0xac3f('0xf')](function(_0x31cdbb){logger[_0xac3f('0x10')](_0xac3f('0x11'),_0x58f4f8,'request\x20sent');logger[_0xac3f('0x12')](_0xac3f('0x13'),_0x58f4f8,_0xac3f('0x14'),JSON[_0xac3f('0x15')](_0x31cdbb));if(_0x31cdbb['error']){if(_0x31cdbb['error'][_0xac3f('0x16')]===0x1f4){logger[_0xac3f('0x17')](_0xac3f('0x11'),_0x58f4f8,_0x31cdbb[_0xac3f('0x17')][_0xac3f('0x18')]);return _0x1901f9(_0x31cdbb[_0xac3f('0x17')][_0xac3f('0x18')]);}logger[_0xac3f('0x17')](_0xac3f('0x11'),_0x58f4f8,_0x31cdbb[_0xac3f('0x17')][_0xac3f('0x18')]);return _0x4039ab(_0x31cdbb[_0xac3f('0x17')][_0xac3f('0x18')]);}else{logger['info'](_0xac3f('0x11'),_0x58f4f8,_0xac3f('0x14'));_0x4039ab(_0x31cdbb['result'][_0xac3f('0x18')]);}})[_0xac3f('0x19')](function(_0xdce7c1){logger[_0xac3f('0x17')](_0xac3f('0x11'),_0x58f4f8,_0xdce7c1);_0x1901f9(_0xdce7c1);});});}exports[_0xac3f('0x1a')]=function(_0x5925e7){var _0x372cec=this;return new Promise(function(_0x326b37,_0x2b3307){return db[_0xac3f('0x1b')][_0xac3f('0x1c')]({'raw':_0x5925e7[_0xac3f('0x1d')]?_0x5925e7[_0xac3f('0x1d')][_0xac3f('0x1e')]===undefined?!![]:![]:!![],'where':_0x5925e7['options']?_0x5925e7[_0xac3f('0x1d')]['where']||null:null,'attributes':_0x5925e7[_0xac3f('0x1d')]?_0x5925e7['options']['attributes']||null:null,'include':_0x5925e7[_0xac3f('0x1d')]?_0x5925e7[_0xac3f('0x1d')][_0xac3f('0x1f')]?_[_0xac3f('0x20')](_0x5925e7[_0xac3f('0x1d')][_0xac3f('0x1f')],function(_0x23aa7b){return{'model':db[_0x23aa7b['model']],'as':_0x23aa7b['as'],'attributes':_0x23aa7b['attributes'],'include':_0x23aa7b[_0xac3f('0x1f')]?_[_0xac3f('0x20')](_0x23aa7b[_0xac3f('0x1f')],function(_0x38b42e){return{'model':db[_0x38b42e['model']],'as':_0x38b42e['as'],'attributes':_0x38b42e[_0xac3f('0x21')],'include':_0x38b42e[_0xac3f('0x1f')]?_[_0xac3f('0x20')](_0x38b42e['include'],function(_0x221549){return{'model':db[_0x221549['model']],'as':_0x221549['as'],'attributes':_0x221549['attributes']};}):[]};}):[]};}):[]:[]})[_0xac3f('0xf')](function(_0x20cf1d){logger[_0xac3f('0x10')](_0xac3f('0x1a'),_0x5925e7);logger[_0xac3f('0x12')](_0xac3f('0x1a'),_0x5925e7,JSON[_0xac3f('0x15')](_0x20cf1d));_0x326b37(_0x20cf1d);})[_0xac3f('0x19')](function(_0x5a18e0){logger[_0xac3f('0x17')](_0xac3f('0x1a'),_0x5a18e0['message'],_0x5925e7);_0x2b3307(_0x372cec['error'](0x1f4,_0x5a18e0[_0xac3f('0x18')]));});});}; \ No newline at end of file +var _0x23cf=['register','request','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','./whatsappAccount.socket'];(function(_0xd7fa6c,_0x1e8a91){var _0x15d5bf=function(_0x1fe782){while(--_0x1fe782){_0xd7fa6c['push'](_0xd7fa6c['shift']());}};_0x15d5bf(++_0x1e8a91);}(_0x23cf,0x189));var _0xf23c=function(_0x411749,_0x16886c){_0x411749=_0x411749-0x0;var _0x26c96d=_0x23cf[_0x411749];return _0x26c96d;};'use strict';var _=require(_0xf23c('0x0'));var util=require(_0xf23c('0x1'));var moment=require('moment');var BPromise=require(_0xf23c('0x2'));var rs=require(_0xf23c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf23c('0x4'))['db'];var utils=require(_0xf23c('0x5'));var logger=require(_0xf23c('0x6'))(_0xf23c('0x7'));var config=require(_0xf23c('0x8'));var jayson=require(_0xf23c('0x9'));var client=jayson['client'][_0xf23c('0xa')]({'port':0x232a});config[_0xf23c('0xb')]=_[_0xf23c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf23c('0xb')]));require(_0xf23c('0xd'))[_0xf23c('0xe')](socket);function respondWithRpcPromise(_0x2069f8,_0x11b5c2,_0x33771e){return new BPromise(function(_0x7710c7,_0x328f3b){return client[_0xf23c('0xf')](_0x2069f8,_0x33771e)[_0xf23c('0x10')](function(_0x326b69){logger[_0xf23c('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x11b5c2,'request\x20sent');logger['debug'](_0xf23c('0x12'),_0x11b5c2,_0xf23c('0x13'),JSON['stringify'](_0x326b69));if(_0x326b69[_0xf23c('0x14')]){if(_0x326b69['error'][_0xf23c('0x15')]===0x1f4){logger[_0xf23c('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x11b5c2,_0x326b69['error'][_0xf23c('0x16')]);return _0x328f3b(_0x326b69[_0xf23c('0x14')][_0xf23c('0x16')]);}logger[_0xf23c('0x14')](_0xf23c('0x17'),_0x11b5c2,_0x326b69[_0xf23c('0x14')]['message']);return _0x7710c7(_0x326b69[_0xf23c('0x14')][_0xf23c('0x16')]);}else{logger[_0xf23c('0x11')](_0xf23c('0x17'),_0x11b5c2,_0xf23c('0x13'));_0x7710c7(_0x326b69[_0xf23c('0x18')]['message']);}})[_0xf23c('0x19')](function(_0xc57284){logger[_0xf23c('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x11b5c2,_0xc57284);_0x328f3b(_0xc57284);});});}exports[_0xf23c('0x1a')]=function(_0x3e856b){var _0x1a5828=this;return new Promise(function(_0x1db7a0,_0x5e3390){return db[_0xf23c('0x1b')][_0xf23c('0x1c')]({'raw':_0x3e856b[_0xf23c('0x1d')]?_0x3e856b['options'][_0xf23c('0x1e')]===undefined?!![]:![]:!![],'where':_0x3e856b[_0xf23c('0x1d')]?_0x3e856b[_0xf23c('0x1d')][_0xf23c('0x1f')]||null:null,'attributes':_0x3e856b['options']?_0x3e856b['options'][_0xf23c('0x20')]||null:null,'include':_0x3e856b['options']?_0x3e856b[_0xf23c('0x1d')][_0xf23c('0x21')]?_[_0xf23c('0x22')](_0x3e856b[_0xf23c('0x1d')]['include'],function(_0x49f0cd){return{'model':db[_0x49f0cd[_0xf23c('0x23')]],'as':_0x49f0cd['as'],'attributes':_0x49f0cd[_0xf23c('0x20')],'include':_0x49f0cd[_0xf23c('0x21')]?_[_0xf23c('0x22')](_0x49f0cd[_0xf23c('0x21')],function(_0x3be907){return{'model':db[_0x3be907[_0xf23c('0x23')]],'as':_0x3be907['as'],'attributes':_0x3be907[_0xf23c('0x20')],'include':_0x3be907['include']?_[_0xf23c('0x22')](_0x3be907[_0xf23c('0x21')],function(_0x2377df){return{'model':db[_0x2377df[_0xf23c('0x23')]],'as':_0x2377df['as'],'attributes':_0x2377df[_0xf23c('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf23c('0x10')](function(_0x4b2002){logger[_0xf23c('0x11')](_0xf23c('0x1a'),_0x3e856b);logger[_0xf23c('0x24')]('ShowWhatsappAccount',_0x3e856b,JSON['stringify'](_0x4b2002));_0x1db7a0(_0x4b2002);})[_0xf23c('0x19')](function(_0x2ecc56){logger[_0xf23c('0x14')](_0xf23c('0x1a'),_0x2ecc56['message'],_0x3e856b);_0x5e3390(_0x1a5828[_0xf23c('0x14')](0x1f4,_0x2ecc56['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3a4fe32..44a4f97 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 _0x50ce=['update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','remove'];(function(_0x471393,_0x1776e6){var _0x143908=function(_0x22fccb){while(--_0x22fccb){_0x471393['push'](_0x471393['shift']());}};_0x143908(++_0x1776e6);}(_0x50ce,0x136));var _0xe50c=function(_0x12ba3d,_0x5eae0d){_0x12ba3d=_0x12ba3d-0x0;var _0x178544=_0x50ce[_0x12ba3d];return _0x178544;};'use strict';var WhatsappAccountEvents=require(_0xe50c('0x0'));var events=['save',_0xe50c('0x1'),_0xe50c('0x2')];function createListener(_0x3740e7,_0x2f7d6c){return function(_0x43d693){_0x2f7d6c[_0xe50c('0x3')](_0x3740e7,_0x43d693);};}function removeListener(_0x3c8de1,_0x5c2ae0){return function(){WhatsappAccountEvents[_0xe50c('0x4')](_0x3c8de1,_0x5c2ae0);};}exports[_0xe50c('0x5')]=function(_0x205397){for(var _0x51567e=0x0,_0x2803e9=events[_0xe50c('0x6')];_0x51567e<_0x2803e9;_0x51567e++){var _0x5bfadb=events[_0x51567e];var _0x327154=createListener(_0xe50c('0x7')+_0x5bfadb,_0x205397);WhatsappAccountEvents['on'](_0x5bfadb,_0x327154);}}; \ No newline at end of file +var _0x1269=['removeListener','register','./whatsappAccount.events','update','emit'];(function(_0x679510,_0x58fc0d){var _0x4da137=function(_0x3bd48a){while(--_0x3bd48a){_0x679510['push'](_0x679510['shift']());}};_0x4da137(++_0x58fc0d);}(_0x1269,0xa7));var _0x9126=function(_0xc923,_0x3c0d55){_0xc923=_0xc923-0x0;var _0x2ff917=_0x1269[_0xc923];return _0x2ff917;};'use strict';var WhatsappAccountEvents=require(_0x9126('0x0'));var events=['save','remove',_0x9126('0x1')];function createListener(_0x472446,_0x2da1a5){return function(_0x49f867){_0x2da1a5[_0x9126('0x2')](_0x472446,_0x49f867);};}function removeListener(_0xd054a1,_0x4e1bbb){return function(){WhatsappAccountEvents[_0x9126('0x3')](_0xd054a1,_0x4e1bbb);};}exports[_0x9126('0x4')]=function(_0x2db02a){for(var _0x15d903=0x0,_0x5374e1=events['length'];_0x15d903<_0x5374e1;_0x15d903++){var _0x39add4=events[_0x15d903];var _0x358d2d=createListener('whatsappAccount:'+_0x39add4,_0x2db02a);WhatsappAccountEvents['on'](_0x39add4,_0x358d2d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index eb741dd..f72219e 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 _0x13f6=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete'];(function(_0x226c11,_0x14c0a4){var _0x4dc73e=function(_0x17e242){while(--_0x17e242){_0x226c11['push'](_0x226c11['shift']());}};_0x4dc73e(++_0x14c0a4);}(_0x13f6,0x1cb));var _0x613f=function(_0x1b5fbe,_0x5b57e1){_0x1b5fbe=_0x1b5fbe-0x0;var _0x1d0f55=_0x13f6[_0x1b5fbe];return _0x1d0f55;};'use strict';var multer=require(_0x613f('0x0'));var util=require('util');var path=require(_0x613f('0x1'));var timeout=require(_0x613f('0x2'));var express=require(_0x613f('0x3'));var router=express[_0x613f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x613f('0x5'));var config=require(_0x613f('0x6'));var controller=require(_0x613f('0x7'));router[_0x613f('0x8')]('/',auth['isAuthenticated'](),controller[_0x613f('0x9')]);router['get'](_0x613f('0xa'),auth[_0x613f('0xb')](),controller[_0x613f('0xc')]);router[_0x613f('0xd')]('/',auth['isAuthenticated'](),controller[_0x613f('0xe')]);router['put']('/:id',auth[_0x613f('0xb')](),controller[_0x613f('0xf')]);router[_0x613f('0x10')]('/:id',auth[_0x613f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x33da=['connect-timeout','express','Router','../../components/auth/service','index','get','/:id','isAuthenticated','show','create','put','update','exports'];(function(_0x3e3a1a,_0x58b1d4){var _0x4cd0e=function(_0x3d2172){while(--_0x3d2172){_0x3e3a1a['push'](_0x3e3a1a['shift']());}};_0x4cd0e(++_0x58b1d4);}(_0x33da,0x145));var _0xa33d=function(_0x5f3309,_0x37871b){_0x5f3309=_0x5f3309-0x0;var _0xea65ec=_0x33da[_0x5f3309];return _0xea65ec;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa33d('0x0'));var express=require(_0xa33d('0x1'));var router=express[_0xa33d('0x2')]();var auth=require(_0xa33d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa33d('0x4')]);router[_0xa33d('0x5')](_0xa33d('0x6'),auth[_0xa33d('0x7')](),controller[_0xa33d('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa33d('0x9')]);router[_0xa33d('0xa')](_0xa33d('0x6'),auth[_0xa33d('0x7')](),controller[_0xa33d('0xb')]);router['delete'](_0xa33d('0x6'),auth[_0xa33d('0x7')](),controller['destroy']);module[_0xa33d('0xc')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 90e397e..2ea007c 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 _0x27bb=['INTEGER','STRING','TEXT','*,*,*,*','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x27bb,0x103));var _0xb27b=function(_0x32e53c,_0x2d5617){_0x32e53c=_0x32e53c-0x0;var _0xd5c18b=_0x27bb[_0x32e53c];return _0xd5c18b;};'use strict';var Sequelize=require('sequelize');module[_0xb27b('0x0')]={'priority':{'type':Sequelize[_0xb27b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb27b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb27b('0x3')]()},'description':{'type':Sequelize[_0xb27b('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb27b('0x4')}}; \ No newline at end of file +var _0x03e6=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x1bc8a2,_0x40ffc9){var _0x4e426a=function(_0xd41189){while(--_0xd41189){_0x1bc8a2['push'](_0x1bc8a2['shift']());}};_0x4e426a(++_0x40ffc9);}(_0x03e6,0x72));var _0x603e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x03e6[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x603e('0x0'));module[_0x603e('0x1')]={'priority':{'type':Sequelize[_0x603e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x603e('0x3')],'allowNull':![],'defaultValue':_0x603e('0x4')},'appdata':{'type':Sequelize[_0x603e('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x603e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 2e8c0b3..1ab3b85 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 _0x25f9=['pick','filter','VIRTUAL','options','then','includeAll','findAll','rows','show','length','include','find','catch','create','body','update','params','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','destroy','end','error','stack','name','send','map','WhatsappApplication','rawAttributes','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x541c48,_0x314e5a){var _0x18826e=function(_0x1efbd6){while(--_0x1efbd6){_0x541c48['push'](_0x541c48['shift']());}};_0x18826e(++_0x314e5a);}(_0x25f9,0x1f4));var _0x925f=function(_0x2704e4,_0x17696f){_0x2704e4=_0x2704e4-0x0;var _0x247152=_0x25f9[_0x2704e4];return _0x247152;};'use strict';var pdf=require(_0x925f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x925f('0x1'));var zipdir=require(_0x925f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x925f('0x3'));var moment=require(_0x925f('0x4'));var BPromise=require(_0x925f('0x5'));var Mustache=require(_0x925f('0x6'));var util=require('util');var path=require(_0x925f('0x7'));var sox=require(_0x925f('0x8'));var csv=require(_0x925f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x925f('0xa'));var squel=require(_0x925f('0xb'));var crypto=require(_0x925f('0xc'));var jsforce=require(_0x925f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x925f('0x9'));var querystring=require('querystring');var Papa=require(_0x925f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x925f('0xf'));var as=require(_0x925f('0x10'));var hardwareService=require(_0x925f('0x11'));var logger=require(_0x925f('0x12'))(_0x925f('0x13'));var utils=require(_0x925f('0x14'));var config=require(_0x925f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6f2eab,_0x434c14){_0x434c14=_0x434c14||0xcc;return function(_0x4828ed){if(_0x4828ed){return _0x6f2eab[_0x925f('0x16')](_0x434c14);}return _0x6f2eab[_0x925f('0x17')](_0x434c14)['end']();};}function respondWithResult(_0x35684f,_0x5f32f4){_0x5f32f4=_0x5f32f4||0xc8;return function(_0x5404ed){if(_0x5404ed){return _0x35684f[_0x925f('0x17')](_0x5f32f4)[_0x925f('0x18')](_0x5404ed);}};}function respondWithFilteredResult(_0x2fb278,_0x1d3cf8){return function(_0x4a9109){if(_0x4a9109){var _0x171b09=_0x4a9109[_0x925f('0x19')],_0x1c8c36=_0x1d3cf8[_0x925f('0x1a')],_0x1abc1f=_0x1d3cf8[_0x925f('0x1a')]+_0x1d3cf8[_0x925f('0x1b')],_0xb89f8c;if(_0x1abc1f>=_0x171b09){_0x1abc1f=_0x171b09;_0xb89f8c=0xc8;}else{_0xb89f8c=0xce;}_0x2fb278[_0x925f('0x17')](_0xb89f8c);return _0x2fb278['set'](_0x925f('0x1c'),_0x1c8c36+'-'+_0x1abc1f+'/'+_0x171b09)[_0x925f('0x18')](_0x4a9109);}return null;};}function patchUpdates(_0x82e848){return function(_0xa34945){try{jsonpatch[_0x925f('0x1d')](_0xa34945,_0x82e848,!![]);}catch(_0x248d76){return BPromise['reject'](_0x248d76);}return _0xa34945[_0x925f('0x1e')]();};}function saveUpdates(_0x2fc15d,_0x965454){return function(_0x66149e){if(_0x66149e){return _0x66149e['update'](_0x2fc15d)['then'](function(_0x33ff48){return _0x33ff48;});}return null;};}function removeEntity(_0x297a1a,_0x31a740){return function(_0x5d3da4){if(_0x5d3da4){return _0x5d3da4[_0x925f('0x1f')]()['then'](function(){_0x297a1a['status'](0xcc)[_0x925f('0x20')]();});}};}function handleEntityNotFound(_0x497d26,_0x37d0e3){return function(_0x234371){if(!_0x234371){_0x497d26['sendStatus'](0x194);}return _0x234371;};}function handleError(_0x28fc8f,_0x77a5c6){_0x77a5c6=_0x77a5c6||0x1f4;return function(_0x34125e){logger[_0x925f('0x21')](_0x34125e[_0x925f('0x22')]);if(_0x34125e[_0x925f('0x23')]){delete _0x34125e['name'];}_0x28fc8f[_0x925f('0x17')](_0x77a5c6)[_0x925f('0x24')](_0x34125e);};}exports['index']=function(_0x3f64be,_0x224ad5){var _0x515259={},_0x3b8ecb={},_0x264227={'count':0x0,'rows':[]};var _0x5bd68e=_[_0x925f('0x25')](db[_0x925f('0x26')][_0x925f('0x27')],function(_0x69eb40){return{'name':_0x69eb40['fieldName'],'type':_0x69eb40[_0x925f('0x28')]['key']};});_0x3b8ecb[_0x925f('0x29')]=_[_0x925f('0x25')](_0x5bd68e,_0x925f('0x23'));_0x3b8ecb['query']=_[_0x925f('0x2a')](_0x3f64be[_0x925f('0x2b')]);_0x3b8ecb['filters']=_[_0x925f('0x2c')](_0x3b8ecb['model'],_0x3b8ecb[_0x925f('0x2b')]);_0x515259[_0x925f('0x2d')]=_[_0x925f('0x2c')](_0x3b8ecb[_0x925f('0x29')],qs[_0x925f('0x2e')](_0x3f64be[_0x925f('0x2b')][_0x925f('0x2e')]));_0x515259[_0x925f('0x2d')]=_0x515259[_0x925f('0x2d')]['length']?_0x515259[_0x925f('0x2d')]:_0x3b8ecb[_0x925f('0x29')];if(!_0x3f64be[_0x925f('0x2b')][_0x925f('0x2f')](_0x925f('0x30'))){_0x515259[_0x925f('0x1b')]=qs[_0x925f('0x1b')](_0x3f64be[_0x925f('0x2b')][_0x925f('0x1b')]);_0x515259['offset']=qs[_0x925f('0x1a')](_0x3f64be[_0x925f('0x2b')][_0x925f('0x1a')]);}_0x515259['order']=qs[_0x925f('0x31')](_0x3f64be[_0x925f('0x2b')][_0x925f('0x31')]);_0x515259[_0x925f('0x32')]=qs[_0x925f('0x33')](_[_0x925f('0x34')](_0x3f64be[_0x925f('0x2b')],_0x3b8ecb['filters']),_0x5bd68e);if(_0x3f64be[_0x925f('0x2b')][_0x925f('0x35')]){_0x515259[_0x925f('0x32')]=_['merge'](_0x515259['where'],{'$or':_[_0x925f('0x25')](_0x5bd68e,function(_0x58e963){if(_0x58e963[_0x925f('0x28')]!==_0x925f('0x36')){var _0x17610a={};_0x17610a[_0x58e963['name']]={'$like':'%'+_0x3f64be[_0x925f('0x2b')][_0x925f('0x35')]+'%'};return _0x17610a;}})});}_0x515259=_['merge']({},_0x515259,_0x3f64be[_0x925f('0x37')]);var _0x26622c={'where':_0x515259[_0x925f('0x32')]};return db[_0x925f('0x26')]['count'](_0x26622c)[_0x925f('0x38')](function(_0x3b53f0){_0x264227[_0x925f('0x19')]=_0x3b53f0;if(_0x3f64be[_0x925f('0x2b')][_0x925f('0x39')]){_0x515259['include']=[{'all':!![]}];}return db[_0x925f('0x26')][_0x925f('0x3a')](_0x515259);})[_0x925f('0x38')](function(_0x92449){_0x264227[_0x925f('0x3b')]=_0x92449;return _0x264227;})[_0x925f('0x38')](respondWithFilteredResult(_0x224ad5,_0x515259))['catch'](handleError(_0x224ad5,null));};exports[_0x925f('0x3c')]=function(_0x1f6e30,_0x7b821c){var _0x525ebf={'raw':!![],'where':{'id':_0x1f6e30['params']['id']}},_0x38b58a={};_0x38b58a[_0x925f('0x29')]=_[_0x925f('0x2a')](db[_0x925f('0x26')][_0x925f('0x27')]);_0x38b58a[_0x925f('0x2b')]=_[_0x925f('0x2a')](_0x1f6e30['query']);_0x38b58a[_0x925f('0x33')]=_[_0x925f('0x2c')](_0x38b58a['model'],_0x38b58a[_0x925f('0x2b')]);_0x525ebf[_0x925f('0x2d')]=_['intersection'](_0x38b58a[_0x925f('0x29')],qs['fields'](_0x1f6e30['query'][_0x925f('0x2e')]));_0x525ebf['attributes']=_0x525ebf[_0x925f('0x2d')][_0x925f('0x3d')]?_0x525ebf[_0x925f('0x2d')]:_0x38b58a['model'];if(_0x1f6e30['query']['includeAll']){_0x525ebf[_0x925f('0x3e')]=[{'all':!![]}];}_0x525ebf=_['merge']({},_0x525ebf,_0x1f6e30[_0x925f('0x37')]);return db[_0x925f('0x26')][_0x925f('0x3f')](_0x525ebf)[_0x925f('0x38')](handleEntityNotFound(_0x7b821c,null))[_0x925f('0x38')](respondWithResult(_0x7b821c,null))[_0x925f('0x40')](handleError(_0x7b821c,null));};exports[_0x925f('0x41')]=function(_0x129549,_0x461c4c){return db[_0x925f('0x26')]['create'](_0x129549[_0x925f('0x42')],{})[_0x925f('0x38')](respondWithResult(_0x461c4c,0xc9))['catch'](handleError(_0x461c4c,null));};exports[_0x925f('0x43')]=function(_0x4332a2,_0x5412d6){if(_0x4332a2['body']['id']){delete _0x4332a2[_0x925f('0x42')]['id'];}return db['WhatsappApplication'][_0x925f('0x3f')]({'where':{'id':_0x4332a2[_0x925f('0x44')]['id']}})[_0x925f('0x38')](handleEntityNotFound(_0x5412d6,null))[_0x925f('0x38')](saveUpdates(_0x4332a2[_0x925f('0x42')],null))[_0x925f('0x38')](respondWithResult(_0x5412d6,null))[_0x925f('0x40')](handleError(_0x5412d6,null));};exports[_0x925f('0x1f')]=function(_0x1fc3f8,_0x435e82){return db[_0x925f('0x26')]['find']({'where':{'id':_0x1fc3f8['params']['id']}})['then'](handleEntityNotFound(_0x435e82,null))[_0x925f('0x38')](removeEntity(_0x435e82,null))[_0x925f('0x40')](handleError(_0x435e82,null));}; \ No newline at end of file +var _0x8dc4=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','count','includeAll','include','WhatsappApplication','rows','catch','show','params','keys','length','find','create','update','body','destroy','html-pdf','moment','bluebird','util','sox','to-csv','lodash'];(function(_0x139a29,_0xea21c7){var _0x4df866=function(_0x2ae8c4){while(--_0x2ae8c4){_0x139a29['push'](_0x139a29['shift']());}};_0x4df866(++_0xea21c7);}(_0x8dc4,0x1f1));var _0x48dc=function(_0x3a35ab,_0x44e716){_0x3a35ab=_0x3a35ab-0x0;var _0x3e5f09=_0x8dc4[_0x3a35ab];return _0x3e5f09;};'use strict';var pdf=require(_0x48dc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48dc('0x1'));var BPromise=require(_0x48dc('0x2'));var Mustache=require('mustache');var util=require(_0x48dc('0x3'));var path=require('path');var sox=require(_0x48dc('0x4'));var csv=require(_0x48dc('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x48dc('0x6'));var squel=require(_0x48dc('0x7'));var crypto=require(_0x48dc('0x8'));var jsforce=require(_0x48dc('0x9'));var deskjs=require(_0x48dc('0xa'));var toCsv=require(_0x48dc('0x5'));var querystring=require(_0x48dc('0xb'));var Papa=require(_0x48dc('0xc'));var Redis=require(_0x48dc('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x48dc('0xe'));var as=require(_0x48dc('0xf'));var hardwareService=require(_0x48dc('0x10'));var logger=require(_0x48dc('0x11'))(_0x48dc('0x12'));var utils=require('../../config/utils');var config=require(_0x48dc('0x13'));var db=require(_0x48dc('0x14'))['db'];function respondWithStatusCode(_0x53fb12,_0x12cfbf){_0x12cfbf=_0x12cfbf||0xcc;return function(_0x213a16){if(_0x213a16){return _0x53fb12[_0x48dc('0x15')](_0x12cfbf);}return _0x53fb12[_0x48dc('0x16')](_0x12cfbf)[_0x48dc('0x17')]();};}function respondWithResult(_0x258bea,_0x3b354c){_0x3b354c=_0x3b354c||0xc8;return function(_0xf80960){if(_0xf80960){return _0x258bea[_0x48dc('0x16')](_0x3b354c)['json'](_0xf80960);}};}function respondWithFilteredResult(_0x4a7417,_0x26e038){return function(_0x5ca683){if(_0x5ca683){var _0x59bac1=_0x5ca683['count'],_0x26edee=_0x26e038[_0x48dc('0x18')],_0x54ab5e=_0x26e038[_0x48dc('0x18')]+_0x26e038[_0x48dc('0x19')],_0x2f23dd;if(_0x54ab5e>=_0x59bac1){_0x54ab5e=_0x59bac1;_0x2f23dd=0xc8;}else{_0x2f23dd=0xce;}_0x4a7417[_0x48dc('0x16')](_0x2f23dd);return _0x4a7417[_0x48dc('0x1a')](_0x48dc('0x1b'),_0x26edee+'-'+_0x54ab5e+'/'+_0x59bac1)[_0x48dc('0x1c')](_0x5ca683);}return null;};}function patchUpdates(_0x1572c2){return function(_0x87262e){try{jsonpatch[_0x48dc('0x1d')](_0x87262e,_0x1572c2,!![]);}catch(_0x170ddc){return BPromise[_0x48dc('0x1e')](_0x170ddc);}return _0x87262e[_0x48dc('0x1f')]();};}function saveUpdates(_0x131b1f,_0x26cfa2){return function(_0x4cb5cb){if(_0x4cb5cb){return _0x4cb5cb['update'](_0x131b1f)[_0x48dc('0x20')](function(_0x186b58){return _0x186b58;});}return null;};}function removeEntity(_0x157ee0,_0x38232f){return function(_0x263bd3){if(_0x263bd3){return _0x263bd3['destroy']()[_0x48dc('0x20')](function(){_0x157ee0[_0x48dc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ef99d,_0x43a624){return function(_0x506971){if(!_0x506971){_0x5ef99d['sendStatus'](0x194);}return _0x506971;};}function handleError(_0x454ab5,_0x28566c){_0x28566c=_0x28566c||0x1f4;return function(_0x258101){logger[_0x48dc('0x21')](_0x258101[_0x48dc('0x22')]);if(_0x258101['name']){delete _0x258101[_0x48dc('0x23')];}_0x454ab5[_0x48dc('0x16')](_0x28566c)[_0x48dc('0x24')](_0x258101);};}exports['index']=function(_0x5444ce,_0xf57265){var _0x1f584f={},_0x5d4d23={},_0x9255d1={'count':0x0,'rows':[]};var _0x4d5ac9=_[_0x48dc('0x25')](db['WhatsappApplication'][_0x48dc('0x26')],function(_0x256878){return{'name':_0x256878[_0x48dc('0x27')],'type':_0x256878[_0x48dc('0x28')][_0x48dc('0x29')]};});_0x5d4d23[_0x48dc('0x2a')]=_['map'](_0x4d5ac9,_0x48dc('0x23'));_0x5d4d23['query']=_['keys'](_0x5444ce['query']);_0x5d4d23['filters']=_[_0x48dc('0x2b')](_0x5d4d23['model'],_0x5d4d23[_0x48dc('0x2c')]);_0x1f584f['attributes']=_['intersection'](_0x5d4d23['model'],qs['fields'](_0x5444ce['query'][_0x48dc('0x2d')]));_0x1f584f[_0x48dc('0x2e')]=_0x1f584f[_0x48dc('0x2e')]['length']?_0x1f584f[_0x48dc('0x2e')]:_0x5d4d23['model'];if(!_0x5444ce[_0x48dc('0x2c')][_0x48dc('0x2f')](_0x48dc('0x30'))){_0x1f584f[_0x48dc('0x19')]=qs[_0x48dc('0x19')](_0x5444ce['query'][_0x48dc('0x19')]);_0x1f584f[_0x48dc('0x18')]=qs[_0x48dc('0x18')](_0x5444ce['query'][_0x48dc('0x18')]);}_0x1f584f[_0x48dc('0x31')]=qs[_0x48dc('0x32')](_0x5444ce[_0x48dc('0x2c')][_0x48dc('0x32')]);_0x1f584f[_0x48dc('0x33')]=qs['filters'](_[_0x48dc('0x34')](_0x5444ce['query'],_0x5d4d23[_0x48dc('0x35')]),_0x4d5ac9);if(_0x5444ce[_0x48dc('0x2c')]['filter']){_0x1f584f[_0x48dc('0x33')]=_[_0x48dc('0x36')](_0x1f584f[_0x48dc('0x33')],{'$or':_[_0x48dc('0x25')](_0x4d5ac9,function(_0x4899a8){if(_0x4899a8[_0x48dc('0x28')]!==_0x48dc('0x37')){var _0x59587d={};_0x59587d[_0x4899a8[_0x48dc('0x23')]]={'$like':'%'+_0x5444ce[_0x48dc('0x2c')]['filter']+'%'};return _0x59587d;}})});}_0x1f584f=_['merge']({},_0x1f584f,_0x5444ce[_0x48dc('0x38')]);var _0x509b3d={'where':_0x1f584f[_0x48dc('0x33')]};return db['WhatsappApplication'][_0x48dc('0x39')](_0x509b3d)['then'](function(_0x50d04e){_0x9255d1[_0x48dc('0x39')]=_0x50d04e;if(_0x5444ce[_0x48dc('0x2c')][_0x48dc('0x3a')]){_0x1f584f[_0x48dc('0x3b')]=[{'all':!![]}];}return db[_0x48dc('0x3c')]['findAll'](_0x1f584f);})['then'](function(_0x2b1e51){_0x9255d1[_0x48dc('0x3d')]=_0x2b1e51;return _0x9255d1;})[_0x48dc('0x20')](respondWithFilteredResult(_0xf57265,_0x1f584f))[_0x48dc('0x3e')](handleError(_0xf57265,null));};exports[_0x48dc('0x3f')]=function(_0x499623,_0x2b0f94){var _0x337e8e={'raw':!![],'where':{'id':_0x499623[_0x48dc('0x40')]['id']}},_0x35fe6e={};_0x35fe6e[_0x48dc('0x2a')]=_[_0x48dc('0x41')](db[_0x48dc('0x3c')][_0x48dc('0x26')]);_0x35fe6e[_0x48dc('0x2c')]=_['keys'](_0x499623[_0x48dc('0x2c')]);_0x35fe6e[_0x48dc('0x35')]=_[_0x48dc('0x2b')](_0x35fe6e['model'],_0x35fe6e[_0x48dc('0x2c')]);_0x337e8e[_0x48dc('0x2e')]=_[_0x48dc('0x2b')](_0x35fe6e['model'],qs[_0x48dc('0x2d')](_0x499623['query']['fields']));_0x337e8e[_0x48dc('0x2e')]=_0x337e8e['attributes'][_0x48dc('0x42')]?_0x337e8e[_0x48dc('0x2e')]:_0x35fe6e['model'];if(_0x499623[_0x48dc('0x2c')]['includeAll']){_0x337e8e[_0x48dc('0x3b')]=[{'all':!![]}];}_0x337e8e=_[_0x48dc('0x36')]({},_0x337e8e,_0x499623['options']);return db[_0x48dc('0x3c')][_0x48dc('0x43')](_0x337e8e)['then'](handleEntityNotFound(_0x2b0f94,null))['then'](respondWithResult(_0x2b0f94,null))[_0x48dc('0x3e')](handleError(_0x2b0f94,null));};exports['create']=function(_0x580b74,_0x442c32){return db[_0x48dc('0x3c')][_0x48dc('0x44')](_0x580b74['body'],{})['then'](respondWithResult(_0x442c32,0xc9))[_0x48dc('0x3e')](handleError(_0x442c32,null));};exports[_0x48dc('0x45')]=function(_0x28ea4e,_0x1374ae){if(_0x28ea4e[_0x48dc('0x46')]['id']){delete _0x28ea4e[_0x48dc('0x46')]['id'];}return db[_0x48dc('0x3c')]['find']({'where':{'id':_0x28ea4e[_0x48dc('0x40')]['id']}})['then'](handleEntityNotFound(_0x1374ae,null))[_0x48dc('0x20')](saveUpdates(_0x28ea4e['body'],null))[_0x48dc('0x20')](respondWithResult(_0x1374ae,null))[_0x48dc('0x3e')](handleError(_0x1374ae,null));};exports[_0x48dc('0x47')]=function(_0x38ff0d,_0x162e1b){return db[_0x48dc('0x3c')][_0x48dc('0x43')]({'where':{'id':_0x38ff0d[_0x48dc('0x40')]['id']}})[_0x48dc('0x20')](handleEntityNotFound(_0x162e1b,null))['then'](removeEntity(_0x162e1b,null))[_0x48dc('0x3e')](handleError(_0x162e1b,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 2a934fd..5dfe1bc 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 _0xe98f=['whatsapp_applications','utf8mb4','lodash','../../config/logger','moment','bluebird','rimraf','./whatsappApplication.attributes','exports','WhatsappApplication'];(function(_0x15bf9d,_0x480ab7){var _0x535c4a=function(_0x1676e5){while(--_0x1676e5){_0x15bf9d['push'](_0x15bf9d['shift']());}};_0x535c4a(++_0x480ab7);}(_0xe98f,0xde));var _0xfe98=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe98f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xfe98('0x0'));var util=require('util');var logger=require(_0xfe98('0x1'))('api');var moment=require(_0xfe98('0x2'));var BPromise=require(_0xfe98('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfe98('0x4'));var config=require('../../config/environment');var attributes=require(_0xfe98('0x5'));module[_0xfe98('0x6')]=function(_0x4a2baa,_0x3aab59){return _0x4a2baa['define'](_0xfe98('0x7'),attributes,{'tableName':_0xfe98('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfe98('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7df3=['lodash','util','api','bluebird','path','../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4_unicode_ci'];(function(_0x5ba058,_0x52dabf){var _0x4fe7a6=function(_0x31c046){while(--_0x31c046){_0x5ba058['push'](_0x5ba058['shift']());}};_0x4fe7a6(++_0x52dabf);}(_0x7df3,0x1cc));var _0x37df=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7df3[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x37df('0x0'));var util=require(_0x37df('0x1'));var logger=require('../../config/logger')(_0x37df('0x2'));var moment=require('moment');var BPromise=require(_0x37df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37df('0x4'));var rimraf=require('rimraf');var config=require(_0x37df('0x5'));var attributes=require(_0x37df('0x6'));module[_0x37df('0x7')]=function(_0x368888,_0x194c89){return _0x368888[_0x37df('0x8')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x37df('0x9')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index a866896..3baaff8 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 _0x3148=['then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3d3f8e,_0x35a8ac){var _0x5932dc=function(_0x485545){while(--_0x485545){_0x3d3f8e['push'](_0x3d3f8e['shift']());}};_0x5932dc(++_0x35a8ac);}(_0x3148,0x1d3));var _0x8314=function(_0x3be20a,_0x223336){_0x3be20a=_0x3be20a-0x0;var _0x7382f6=_0x3148[_0x3be20a];return _0x7382f6;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var moment=require('moment');var BPromise=require(_0x8314('0x2'));var rs=require(_0x8314('0x3'));var fs=require('fs');var Redis=require(_0x8314('0x4'));var db=require(_0x8314('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8314('0x6'))(_0x8314('0x7'));var config=require(_0x8314('0x8'));var jayson=require(_0x8314('0x9'));var client=jayson[_0x8314('0xa')][_0x8314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bd913,_0x4dd36d,_0x837c1f){return new BPromise(function(_0x4df2b0,_0x35b464){return client[_0x8314('0xc')](_0x1bd913,_0x837c1f)[_0x8314('0xd')](function(_0x357031){logger[_0x8314('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x4dd36d,'request\x20sent');logger[_0x8314('0xf')](_0x8314('0x10'),_0x4dd36d,_0x8314('0x11'),JSON[_0x8314('0x12')](_0x357031));if(_0x357031['error']){if(_0x357031[_0x8314('0x13')][_0x8314('0x14')]===0x1f4){logger['error'](_0x8314('0x15'),_0x4dd36d,_0x357031['error']['message']);return _0x35b464(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}logger[_0x8314('0x13')](_0x8314('0x15'),_0x4dd36d,_0x357031['error'][_0x8314('0x16')]);return _0x4df2b0(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}else{logger[_0x8314('0xe')](_0x8314('0x15'),_0x4dd36d,_0x8314('0x11'));_0x4df2b0(_0x357031['result']['message']);}})[_0x8314('0x17')](function(_0xf0ad31){logger[_0x8314('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x4dd36d,_0xf0ad31);_0x35b464(_0xf0ad31);});});} \ No newline at end of file +var _0x9ab0=['debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','WhatsappApplication,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x9ab0,0x195));var _0x09ab=function(_0x5869d3,_0x6b785a){_0x5869d3=_0x5869d3-0x0;var _0x5c9275=_0x9ab0[_0x5869d3];return _0x5c9275;};'use strict';var _=require(_0x09ab('0x0'));var util=require(_0x09ab('0x1'));var moment=require(_0x09ab('0x2'));var BPromise=require(_0x09ab('0x3'));var rs=require(_0x09ab('0x4'));var fs=require('fs');var Redis=require(_0x09ab('0x5'));var db=require(_0x09ab('0x6'))['db'];var utils=require(_0x09ab('0x7'));var logger=require(_0x09ab('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x09ab('0x9')][_0x09ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x241bd1,_0x233f2a,_0x610663){return new BPromise(function(_0x464d64,_0x174a54){return client[_0x09ab('0xb')](_0x241bd1,_0x610663)[_0x09ab('0xc')](function(_0x58c23b){logger[_0x09ab('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x233f2a,_0x09ab('0xe'));logger[_0x09ab('0xf')](_0x09ab('0x10'),_0x233f2a,'request\x20sent',JSON['stringify'](_0x58c23b));if(_0x58c23b[_0x09ab('0x11')]){if(_0x58c23b[_0x09ab('0x11')]['code']===0x1f4){logger['error'](_0x09ab('0x12'),_0x233f2a,_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);return _0x174a54(_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);}logger[_0x09ab('0x11')](_0x09ab('0x12'),_0x233f2a,_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);return _0x464d64(_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);}else{logger[_0x09ab('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x233f2a,_0x09ab('0xe'));_0x464d64(_0x58c23b[_0x09ab('0x14')][_0x09ab('0x13')]);}})['catch'](function(_0x21db00){logger[_0x09ab('0x11')](_0x09ab('0x12'),_0x233f2a,_0x21db00);_0x174a54(_0x21db00);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2a9946e..77959ce 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 _0xe049=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','/:id','tracked','update','delete','whatsappinteraction:destroy','exports','path','express'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe049,0xa6));var _0x9e04=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xe049[_0x4ae6ef];return _0x3cbb4e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9e04('0x0'));var timeout=require('connect-timeout');var express=require(_0x9e04('0x1'));var router=express[_0x9e04('0x2')]();var auth=require(_0x9e04('0x3'));var interaction=require(_0x9e04('0x4'));var config=require(_0x9e04('0x5'));var controller=require(_0x9e04('0x6'));router['get']('/',auth[_0x9e04('0x7')](),controller['index']);router[_0x9e04('0x8')](_0x9e04('0x9'),auth[_0x9e04('0x7')](),controller[_0x9e04('0xa')]);router[_0x9e04('0x8')]('/:id',auth[_0x9e04('0x7')](),controller[_0x9e04('0xb')]);router[_0x9e04('0x8')](_0x9e04('0xc'),auth[_0x9e04('0x7')](),controller[_0x9e04('0xd')]);router['get'](_0x9e04('0xe'),auth[_0x9e04('0x7')](),controller['download']);router[_0x9e04('0xf')]('/',auth[_0x9e04('0x7')](),controller[_0x9e04('0x10')]);router['post']('/:id/messages',auth[_0x9e04('0x7')](),controller[_0x9e04('0x11')]);router[_0x9e04('0xf')](_0x9e04('0x12'),auth[_0x9e04('0x7')](),interaction['tracked'](_0x9e04('0x13'),_0x9e04('0x14')),controller[_0x9e04('0x15')]);router['put'](_0x9e04('0x16'),auth[_0x9e04('0x7')](),interaction[_0x9e04('0x17')](_0x9e04('0x13'),'whatsappinteraction:update'),controller[_0x9e04('0x18')]);router[_0x9e04('0x19')](_0x9e04('0x16'),auth[_0x9e04('0x7')](),interaction[_0x9e04('0x17')](_0x9e04('0x13'),_0x9e04('0x1a')),controller['destroy']);router[_0x9e04('0x19')](_0x9e04('0x12'),auth[_0x9e04('0x7')](),controller['removeTags']);module[_0x9e04('0x1b')]=router; \ No newline at end of file +var _0xb6bf=['describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x5b6a37,_0x3b8878){var _0x1dd13e=function(_0x3d5b4d){while(--_0x3d5b4d){_0x5b6a37['push'](_0x5b6a37['shift']());}};_0x1dd13e(++_0x3b8878);}(_0xb6bf,0xa9));var _0xfb6b=function(_0x70a639,_0x2c9309){_0x70a639=_0x70a639-0x0;var _0xe1787f=_0xb6bf[_0x70a639];return _0xe1787f;};'use strict';var multer=require('multer');var util=require(_0xfb6b('0x0'));var path=require('path');var timeout=require(_0xfb6b('0x1'));var express=require(_0xfb6b('0x2'));var router=express['Router']();var auth=require(_0xfb6b('0x3'));var interaction=require(_0xfb6b('0x4'));var config=require(_0xfb6b('0x5'));var controller=require(_0xfb6b('0x6'));router[_0xfb6b('0x7')]('/',auth[_0xfb6b('0x8')](),controller[_0xfb6b('0x9')]);router[_0xfb6b('0x7')](_0xfb6b('0xa'),auth['isAuthenticated'](),controller[_0xfb6b('0xb')]);router[_0xfb6b('0x7')](_0xfb6b('0xc'),auth[_0xfb6b('0x8')](),controller['show']);router['get'](_0xfb6b('0xd'),auth['isAuthenticated'](),controller[_0xfb6b('0xe')]);router[_0xfb6b('0x7')](_0xfb6b('0xf'),auth[_0xfb6b('0x8')](),controller[_0xfb6b('0x10')]);router[_0xfb6b('0x11')]('/',auth[_0xfb6b('0x8')](),controller[_0xfb6b('0x12')]);router[_0xfb6b('0x11')](_0xfb6b('0xd'),auth[_0xfb6b('0x8')](),controller[_0xfb6b('0x13')]);router['post'](_0xfb6b('0x14'),auth[_0xfb6b('0x8')](),interaction[_0xfb6b('0x15')]('whatsapp',_0xfb6b('0x16')),controller[_0xfb6b('0x17')]);router[_0xfb6b('0x18')](_0xfb6b('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xfb6b('0x19'),_0xfb6b('0x1a')),controller[_0xfb6b('0x1b')]);router[_0xfb6b('0x1c')](_0xfb6b('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xfb6b('0x19'),'whatsappinteraction:destroy'),controller[_0xfb6b('0x1d')]);router[_0xfb6b('0x1c')](_0xfb6b('0x14'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index fcbe6a9..662397c 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 _0x62cb=['DATE','STRING','out','ENUM','sequelize','exports','BOOLEAN'];(function(_0x3defae,_0x44c104){var _0x4345ab=function(_0x36ce40){while(--_0x36ce40){_0x3defae['push'](_0x3defae['shift']());}};_0x4345ab(++_0x44c104);}(_0x62cb,0x185));var _0xb62c=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0x62cb[_0xfbdff6];return _0x4cb9be;};'use strict';var Sequelize=require(_0xb62c('0x0'));var moment=require('moment');module[_0xb62c('0x1')]={'closed':{'type':Sequelize[_0xb62c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb62c('0x3')]},'disposition':{'type':Sequelize[_0xb62c('0x4')]},'note':{'type':Sequelize[_0xb62c('0x4')]},'phone':{'type':Sequelize[_0xb62c('0x4')]},'read1stAt':{'type':Sequelize[_0xb62c('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb62c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb62c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb62c('0x6')]('in',_0xb62c('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x41a8=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x41a8,0x6f));var _0x841a=function(_0x4bffbf,_0x14f455){_0x4bffbf=_0x4bffbf-0x0;var _0x288bb6=_0x41a8[_0x4bffbf];return _0x288bb6;};'use strict';var Sequelize=require(_0x841a('0x0'));var moment=require(_0x841a('0x1'));module[_0x841a('0x2')]={'closed':{'type':Sequelize[_0x841a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x841a('0x4')]},'disposition':{'type':Sequelize[_0x841a('0x5')]},'note':{'type':Sequelize[_0x841a('0x5')]},'phone':{'type':Sequelize[_0x841a('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x841a('0x6')]('in',_0x841a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x841a('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x841a('0x6')]('in',_0x841a('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 5987099..7e5f031 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 _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(_0xd9da23,_0x518693){var _0x3fbdb5=function(_0x3006f8){while(--_0x3006f8){_0xd9da23['push'](_0xd9da23['shift']());}};_0x3fbdb5(++_0x518693);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'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 +var _0xadb5=['field','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','find','UserId','buildExpression','start','body','keys','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','show','params','includeAll','include','merge','options','create','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','findAll','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','N.A.','closed','disposition','basename','createReadStream','createWriteStream','direction','out','System','renderFile','views','downloadInteraction.html','toFile','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','WhatsappInteraction','rawAttributes','type','key','query','intersection','model','attributes','fields','length','limit','order','sort','filters','pick','select'];(function(_0x3adbc0,_0x4c25b6){var _0x28ae47=function(_0x2e3ded){while(--_0x2e3ded){_0x3adbc0['push'](_0x3adbc0['shift']());}};_0x28ae47(++_0x4c25b6);}(_0xadb5,0xad));var _0x5adb=function(_0x33f35f,_0x160b87){_0x33f35f=_0x33f35f-0x0;var _0x1d9297=_0xadb5[_0x33f35f];return _0x1d9297;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var db=require(_0x5adb('0x17'))['db'];config['redis']=_[_0x5adb('0x18')](config['redis'],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config[_0x5adb('0x1b')]));require('./whatsappInteraction.socket')[_0x5adb('0x1c')](socket);function respondWithStatusCode(_0x34af2c,_0xf82f72){_0xf82f72=_0xf82f72||0xcc;return function(_0x5263ec){if(_0x5263ec){return _0x34af2c[_0x5adb('0x1d')](_0xf82f72);}return _0x34af2c['status'](_0xf82f72)[_0x5adb('0x1e')]();};}function respondWithResult(_0x42a482,_0x30614e){_0x30614e=_0x30614e||0xc8;return function(_0x304784){if(_0x304784){return _0x42a482[_0x5adb('0x1f')](_0x30614e)[_0x5adb('0x20')](_0x304784);}};}function respondWithFilteredResult(_0xa29dc,_0x42f4c6){return function(_0xb953a6){if(_0xb953a6){var _0x529b65=_0xb953a6['count'],_0x3fff62=_0x42f4c6[_0x5adb('0x21')],_0x5de028=_0x42f4c6['offset']+_0x42f4c6['limit'],_0x1d9e86;if(_0x5de028>=_0x529b65){_0x5de028=_0x529b65;_0x1d9e86=0xc8;}else{_0x1d9e86=0xce;}_0xa29dc[_0x5adb('0x1f')](_0x1d9e86);return _0xa29dc[_0x5adb('0x22')](_0x5adb('0x23'),_0x3fff62+'-'+_0x5de028+'/'+_0x529b65)[_0x5adb('0x20')](_0xb953a6);}return null;};}function patchUpdates(_0x99bc6c){return function(_0x5af69d){try{jsonpatch[_0x5adb('0x24')](_0x5af69d,_0x99bc6c,!![]);}catch(_0x5c296e){return BPromise['reject'](_0x5c296e);}return _0x5af69d[_0x5adb('0x25')]();};}function saveUpdates(_0x379b33,_0x1a38d3){return function(_0x1a8014){if(_0x1a8014){return _0x1a8014[_0x5adb('0x26')](_0x379b33)[_0x5adb('0x27')](function(_0xfd9bb9){return _0xfd9bb9;});}return null;};}function removeEntity(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(_0x373cc3){return _0x373cc3[_0x5adb('0x28')]()[_0x5adb('0x27')](function(){_0x4ca150[_0x5adb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fee18,_0x2e1e63){return function(_0x5aed76){if(!_0x5aed76){_0x2fee18[_0x5adb('0x1d')](0x194);}return _0x5aed76;};}function handleError(_0x1ded9f,_0x1a0acd){_0x1a0acd=_0x1a0acd||0x1f4;return function(_0x55b40a){logger[_0x5adb('0x29')](_0x55b40a[_0x5adb('0x2a')]);if(_0x55b40a[_0x5adb('0x2b')]){delete _0x55b40a[_0x5adb('0x2b')];}_0x1ded9f[_0x5adb('0x1f')](_0x1a0acd)[_0x5adb('0x2c')](_0x55b40a);};}function getInteractionUsers(_0x4a5d46,_0x49992e){return new BPromise(function(_0x5d457e,_0x39bddd){try{if(_0x49992e[_0x4a5d46['id']]){_0x4a5d46[_0x5adb('0x2d')]=_[_0x5adb('0x2e')](_0x49992e[_0x4a5d46['id']],function(_0x512bab){return{'id':_0x512bab['id'],'fullname':_0x512bab[_0x5adb('0x2f')]};});}}catch(_0x4de310){_0x39bddd(_0x4de310);}_0x5d457e(_0x4a5d46);});}function getInteractionTags(_0x11ec2a,_0x34b793){return new BPromise(function(_0x372da1,_0x3b1fed){try{if(_0x11ec2a[_0x5adb('0x30')]){_0x11ec2a[_0x5adb('0x31')]=[];_0x11ec2a[_0x5adb('0x30')][_0x5adb('0x32')](',')[_0x5adb('0x33')](function(_0x260295){_0x11ec2a['Tags'][_0x5adb('0x34')](_0x34b793[_0x260295]);});}delete _0x11ec2a['TagIds'];}catch(_0x12424d){_0x3b1fed(_0x12424d);}_0x372da1(_0x11ec2a);});}function updateWhatsappInteraction(_0x20cde6,_0x5d1441,_0x226390){return new BPromise(function(_0xe389ca,_0x461a39){return getInteractionUsers(_0x20cde6,_0x226390)['then'](function(_0x173789){return getInteractionTags(_0x173789,_0x5d1441);})[_0x5adb('0x27')](function(_0x4b5887){_0xe389ca(_0x4b5887);})['catch'](function(_0x1ed9ea){_0x461a39(_0x1ed9ea);});});}exports['index']=function(_0x663ea0,_0x222568){var _0x3c2b07={},_0x2da912={},_0x9bdece={'count':0x0,'rows':[]};var _0x5ece39=_[_0x5adb('0x2e')](db[_0x5adb('0x35')][_0x5adb('0x36')],function(_0x54851b){return{'name':_0x54851b['fieldName'],'type':_0x54851b[_0x5adb('0x37')][_0x5adb('0x38')]};});_0x2da912['model']=_[_0x5adb('0x2e')](_0x5ece39,'name');_0x2da912[_0x5adb('0x39')]=_['keys'](_0x663ea0[_0x5adb('0x39')]);_0x2da912['filters']=_[_0x5adb('0x3a')](_0x2da912[_0x5adb('0x3b')],_0x2da912['query']);_0x3c2b07[_0x5adb('0x3c')]=_['intersection'](_0x2da912[_0x5adb('0x3b')],qs[_0x5adb('0x3d')](_0x663ea0[_0x5adb('0x39')]['fields']));_0x3c2b07[_0x5adb('0x3c')]=_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x3c2b07[_0x5adb('0x3c')]:_0x2da912[_0x5adb('0x3b')];if(!_0x663ea0['query']['hasOwnProperty']('nolimit')){_0x3c2b07['limit']=qs[_0x5adb('0x3f')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3f')]);_0x3c2b07[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x663ea0[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x3c2b07[_0x5adb('0x40')]=qs['sort'](_0x663ea0['query'][_0x5adb('0x41')]);_0x3c2b07['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x663ea0[_0x5adb('0x39')],_0x2da912[_0x5adb('0x42')]),_0x5ece39);var _0xdfecfd=[];var _0x522ee5=squel[_0x5adb('0x44')]()[_0x5adb('0x45')]('id')['field'](_0x5adb('0x2b'))[_0x5adb('0x45')]('color')[_0x5adb('0x46')](_0x5adb('0x47'));var _0x1d6bef=squel[_0x5adb('0x44')]()[_0x5adb('0x45')](_0x5adb('0x48'))[_0x5adb('0x45')]('u.fullname')['field'](_0x5adb('0x49'))[_0x5adb('0x46')](_0x5adb('0x4a'),'ui')[_0x5adb('0x4b')]('users','u','u.id\x20=\x20ui.UserId');var _0xaa32e4=squel[_0x5adb('0x44')]()[_0x5adb('0x46')](_0x5adb('0x4c'),'i')[_0x5adb('0x4b')]('cm_contacts','c',_0x5adb('0x4d'))[_0x5adb('0x4b')]('users','o',_0x5adb('0x4e'))[_0x5adb('0x4b')](_0x5adb('0x4f'),'a',_0x5adb('0x50'))[_0x5adb('0x4b')](_0x5adb('0x51'),'me',_0x5adb('0x52'))[_0x5adb('0x4b')]('whatsapp_interaction_has_tags','it',_0x5adb('0x53'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3cd211=squel[_0x5adb('0x54')]();var _0x207a81=[];var _0x4ba0b5=squel[_0x5adb('0x54')]();var _0x5cbab5;if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x55')]){_0x5cbab5=as[_0x5adb('0x56')](_0x663ea0['query'][_0x5adb('0x55')]);var _0x560bac=_0x5cbab5[_0x5adb('0x57')];for(var _0x6dc067=0x0;_0x6dc067<_0x5cbab5['conditions'][_0x5adb('0x3e')];_0x6dc067++){var _0x1ab97b=_0x5cbab5[_0x5adb('0x58')][_0x6dc067];var _0x101008='i';var _0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x1ab97b[_0x5adb('0x45')]]);if(!_0x372734){switch(_0x1ab97b[_0x5adb('0x45')]){case _0x5adb('0x59'):if(_0x1ab97b['value']==0x1){_0xaa32e4[_0x5adb('0x5a')]('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5b'));}else{_0xaa32e4['having']('`'+_0x1ab97b[_0x5adb('0x45')]+_0x5adb('0x5c'));}break;case _0x5adb('0x5d'):if(_0x1ab97b[_0x5adb('0x5e')]==='$substring'){if(_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')]('\x20')[_0x5adb('0x3e')]>0x1){_0x3cd211[_0x560bac](_0x5adb('0x60'),qs[_0x5adb('0x61')](_0x1ab97b['value']),null);}else{var _0x378938='%'+_0x1ab97b['value']+'%';_0x3cd211[_0x560bac](_0x5adb('0x62'),_0x378938,_0x378938,_0x378938);}}else{_0x372734=_['find'](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x63')]);_0x1ab97b[_0x5adb('0x45')]=_0x5adb('0x63');_0x836b91=as['buildExpression'](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')]['start'],_0x836b91['value']['end']);}break;case _0x5adb('0x65'):var _0x31a1f9=_0x1ab97b[_0x5adb('0x5f')][_0x5adb('0x32')](',')[_0x5adb('0x2e')](function(_0xb06bee){return Number(_0xb06bee);});_0x31a1f9[_0x5adb('0x33')](function(_0x8d7810){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x8d7810+',%');});_0x207a81=_[_0x5adb('0x67')](_0x207a81,_0x31a1f9);break;case _0x5adb('0x68'):if(_0x1ab97b[_0x5adb('0x5e')]===_0x5adb('0x69')){_0x3cd211[_0x560bac]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1ab97b['value']+'%',null);}else{_0x372734=_[_0x5adb('0x6a')](_0x5ece39,[_0x5adb('0x2b'),_0x5adb('0x6b')]);_0x1ab97b[_0x5adb('0x45')]='UserId';_0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}break;case _0x5adb('0x6e'):_0x836b91=as[_0x5adb('0x6c')]('me',null,_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91[_0x5adb('0x64')],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);break;}}else{var _0x836b91=as[_0x5adb('0x6c')](_0x101008,_0x372734[_0x5adb('0x37')],_0x1ab97b);_0x3cd211[_0x560bac](_0x836b91['text'],_0x836b91[_0x5adb('0x5f')][_0x5adb('0x6d')],_0x836b91[_0x5adb('0x5f')]['end']);}}}else{var _0x7287ac=_(_0x663ea0['query'])[_0x5adb('0x6f')]()[_0x5adb('0x2e')](function(_0x24e1ab){return _['some'](_0x5ece39,[_0x5adb('0x2b'),_0x24e1ab])?_0x24e1ab:undefined;})[_0x5adb('0x70')]()['value']();if(!_[_0x5adb('0x71')](_0x7287ac)){_0x7287ac[_0x5adb('0x33')](function(_0x248739){if(_0x248739===_0x5adb('0x72')){_0xaa32e4['where'](_0x5adb('0x73'),[][_0x5adb('0x74')](_0x663ea0[_0x5adb('0x39')][_0x248739]));}else if(_0x248739===_0x5adb('0x75')){var _0x5b7556=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])['$gte'];var _0x4d635f=JSON['parse'](_0x663ea0[_0x5adb('0x39')][_0x248739])[_0x5adb('0x76')];_0xaa32e4['where'](_0x5adb('0x77'),_0x5b7556,_0x4d635f);}else{if(_0x663ea0[_0x5adb('0x39')][_0x248739]===_0x5adb('0x78')){_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7a'));}else{_0xaa32e4[_0x5adb('0x79')]('i.'+_0x248739+_0x5adb('0x7b'),_0x663ea0[_0x5adb('0x39')][_0x248739]);}}});}if(_0x663ea0['query']['read']){if(_0x663ea0['query'][_0x5adb('0x7c')]==0x1){_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7d'));}else{_0xaa32e4[_0x5adb('0x5a')](_0x5adb('0x7e'));}}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]){_0x207a81=_[_0x5adb('0x80')](_0x663ea0['query']['tag'])?_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]:new Array(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x7f')]);_0x207a81[_0x5adb('0x33')](function(_0x335de5){_0x4ba0b5['or'](_0x5adb('0x66'),'%,'+_0x335de5+',%');});}if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x81')]){var _0x3b5ecf=_0x663ea0['query'][_0x5adb('0x81')][_0x5adb('0x82')]('\x5c','\x5c\x5c')[_0x5adb('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x5adb('0x83')](_0x3b5ecf)){_0x3cd211['or'](_0x5adb('0x84'),_0x3b5ecf+'%')['or']('i.phone\x20LIKE\x20?',_0x3b5ecf+'%');}else{_0x3cd211['or'](_0x5adb('0x85'),qs['getFullTextValue'](_0x3b5ecf))['or'](_0x5adb('0x86'),_0x3b5ecf+'%');}}}_0xaa32e4[_0x5adb('0x79')](_0x3cd211);_0xaa32e4['group'](_0x5adb('0x87'));var _0x1ceb72={'type':db[_0x5adb('0x88')][_0x5adb('0x89')][_0x5adb('0x8a')],'raw':!![]};var _0x10f54a=_0xaa32e4[_0x5adb('0x8b')]();_0x10f54a[_0x5adb('0x45')]('i.id');_0x10f54a[_0x5adb('0x45')](_0x5adb('0x8c'),_0x5adb('0x59'));if(_0x3c2b07['order']){_0x3c2b07['order'][_0x5adb('0x33')](function(_0x4fd8f7){_0xaa32e4[_0x5adb('0x40')]('i.'+_0x4fd8f7[0x0],_0x4fd8f7[0x1]===_0x5adb('0x8d')?![]:!![]);});}if(!_[_0x5adb('0x71')](_0x207a81)){_0xaa32e4['having'](_0x4ba0b5);_0x10f54a[_0x5adb('0x79')](_0x5adb('0x8e'),_0x207a81);}BPromise[_0x5adb('0x8f')]()[_0x5adb('0x27')](function(){if(!_0x5cbab5){if(_0x663ea0[_0x5adb('0x39')]['WhatsappAccountId']||_0x663ea0[_0x5adb('0x39')][_0x5adb('0x90')])return;_0x10f54a[_0x5adb('0x79')](_0x5adb('0x91'));_0xaa32e4['where'](_0x5adb('0x91'));return;}return _0x663ea0[_0x5adb('0x92')][_0x5adb('0x93')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x27')](function(_0x15d4f1){if(_[_0x5adb('0x71')](_0x15d4f1)){_0x10f54a[_0x5adb('0x79')]('i.WhatsappAccountId\x20IS\x20NULL');_0xaa32e4[_0x5adb('0x79')](_0x5adb('0x94'));}else{_0x10f54a['where'](_0x5adb('0x73'),_[_0x5adb('0x2e')](_0x15d4f1,'id'));_0xaa32e4['where'](_0x5adb('0x73'),_['map'](_0x15d4f1,'id'));}});})[_0x5adb('0x27')](function(){db[_0x5adb('0x95')]['query'](_0x10f54a[_0x5adb('0x96')](),_0x1ceb72)['then'](function(_0x2f6415){_0x9bdece[_0x5adb('0x97')]=_0x2f6415[_0x5adb('0x3e')];if(_0x9bdece[_0x5adb('0x97')]===0x0)return[];return db[_0x5adb('0x95')]['query'](_0x522ee5[_0x5adb('0x96')](),_0x1ceb72)[_0x5adb('0x27')](function(_0x3f33c0){_0xdfecfd=_[_0x5adb('0x98')](_0x3f33c0,'id');_0x1ceb72=_['merge'](_0x1ceb72,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x663ea0[_0x5adb('0x39')][_0x5adb('0x3d')]){_0x3c2b07[_0x5adb('0x3c')][_0x5adb('0x33')](function(_0x277668){_0xaa32e4[_0x5adb('0x45')]('i.'+_0x277668);});}else{_0xaa32e4[_0x5adb('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5adb('0x59'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x99'),_0x5adb('0x9a'));_0xaa32e4['field'](_0x5adb('0x9b'),_0x5adb('0x9c'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9d'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0x9e'),_0x5adb('0x9f'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa0'),'Contact.lastName');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa1'),'Contact.email');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa2'),_0x5adb('0xa3'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa4'),_0x5adb('0xa5'));_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa6'),'Contact.fax');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa7'),'Owner.fullname');_0xaa32e4[_0x5adb('0x45')](_0x5adb('0xa8'),_0x5adb('0xa9'));_0xaa32e4['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5adb('0x30'));}if(_0x3c2b07[_0x5adb('0x3f')])_0xaa32e4[_0x5adb('0x3f')](_0x3c2b07['limit']);if(_0x3c2b07[_0x5adb('0x21')])_0xaa32e4[_0x5adb('0x21')](_0x3c2b07[_0x5adb('0x21')]);return db[_0x5adb('0x95')][_0x5adb('0x39')](_0xaa32e4[_0x5adb('0x96')](),_0x1ceb72);})[_0x5adb('0x27')](function(_0x463e84){_0x1d6bef[_0x5adb('0x79')](_0x5adb('0xaa'),_[_0x5adb('0x2e')](_0x463e84,'id'));return db[_0x5adb('0x95')]['query'](_0x1d6bef['toString'](),_0x1ceb72)[_0x5adb('0x27')](function(_0x44756a){var _0x5c4053=_[_0x5adb('0xab')](_0x44756a,_0x5adb('0xac'));var _0x38acde=[];_0x463e84[_0x5adb('0x33')](function(_0x13426e){_0x38acde[_0x5adb('0x34')](updateWhatsappInteraction(_0x13426e,_0xdfecfd,_0x5c4053));});return BPromise[_0x5adb('0xad')](_0x38acde);});});})[_0x5adb('0x27')](function(_0x42dddf){_0x9bdece['rows']=_0x42dddf;return _0x9bdece;})[_0x5adb('0x27')](respondWithFilteredResult(_0x222568,_0x3c2b07));})[_0x5adb('0xae')](handleError(_0x222568,null));};exports[_0x5adb('0xaf')]=function(_0x4f0261,_0x312a90){var _0x284f79={'raw':![],'where':{'id':_0x4f0261[_0x5adb('0xb0')]['id']}},_0x2b6e56={};_0x2b6e56[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db['WhatsappInteraction'][_0x5adb('0x36')]);_0x2b6e56[_0x5adb('0x39')]=_[_0x5adb('0x6f')](_0x4f0261[_0x5adb('0x39')]);_0x2b6e56[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x2b6e56[_0x5adb('0x3b')],_0x2b6e56[_0x5adb('0x39')]);_0x284f79[_0x5adb('0x3c')]=_[_0x5adb('0x3a')](_0x2b6e56['model'],qs[_0x5adb('0x3d')](_0x4f0261['query'][_0x5adb('0x3d')]));_0x284f79[_0x5adb('0x3c')]=_0x284f79[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x284f79[_0x5adb('0x3c')]:_0x2b6e56['model'];if(_0x4f0261['query'][_0x5adb('0xb1')]){_0x284f79[_0x5adb('0xb2')]=[{'all':!![]}];}_0x284f79=_[_0x5adb('0xb3')]({},_0x284f79,_0x4f0261[_0x5adb('0xb4')]);return db[_0x5adb('0x35')][_0x5adb('0x6a')](_0x284f79)['then'](handleEntityNotFound(_0x312a90,null))['then'](respondWithResult(_0x312a90,null))[_0x5adb('0xae')](handleError(_0x312a90,null));};exports[_0x5adb('0xb5')]=function(_0x9d80fd,_0x4f5721){return db['WhatsappInteraction'][_0x5adb('0xb5')](_0x9d80fd['body'],{})[_0x5adb('0x27')](respondWithResult(_0x4f5721,0xc9))[_0x5adb('0xae')](handleError(_0x4f5721,null));};exports['update']=function(_0x498ecc,_0x43b91c){if(_0x498ecc['body']['id']){delete _0x498ecc['body']['id'];}return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x498ecc[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x43b91c,null))[_0x5adb('0x27')](saveUpdates(_0x498ecc[_0x5adb('0x6e')],null))[_0x5adb('0x27')](respondWithResult(_0x43b91c,null))[_0x5adb('0xae')](handleError(_0x43b91c,null));};exports[_0x5adb('0x28')]=function(_0x31b696,_0x44cf6a){return db[_0x5adb('0x35')][_0x5adb('0x6a')]({'where':{'id':_0x31b696['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x44cf6a,null))['then'](removeEntity(_0x44cf6a,null))[_0x5adb('0xae')](handleError(_0x44cf6a,null));};exports[_0x5adb('0xb6')]=function(_0x280f30,_0xad6905){return db[_0x5adb('0x35')][_0x5adb('0xb6')]()[_0x5adb('0x27')](respondWithResult(_0xad6905,null))[_0x5adb('0xae')](handleError(_0xad6905,null));};exports[_0x5adb('0xb7')]=function(_0x36a8f0,_0x41fa3c,_0x18fc00){return db['WhatsappMessage'][_0x5adb('0x6a')]({'where':{'id':_0x36a8f0[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x41fa3c,null))[_0x5adb('0x27')](function(_0x1da6bc){if(_0x1da6bc){return _0x1da6bc[_0x5adb('0xb7')](_0x36a8f0[_0x5adb('0x6e')][_0x5adb('0xb8')],_['omit'](_0x36a8f0[_0x5adb('0x6e')],[_0x5adb('0xb8'),'id'])||{});}})[_0x5adb('0x27')](respondWithResult(_0x41fa3c,null))['catch'](handleError(_0x41fa3c,null));};exports[_0x5adb('0xb9')]=function(_0x4ae211,_0x74065,_0x50c3a3){var _0x54da7c={'raw':![],'where':{}};var _0x173ead={};var _0x3796b7={'count':0x0,'rows':[]};return db[_0x5adb('0x35')][_0x5adb('0xba')]({'where':{'id':_0x4ae211[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x74065,null))[_0x5adb('0x27')](function(_0xa1911a){if(_0xa1911a){_0x173ead[_0x5adb('0x3b')]=_[_0x5adb('0x6f')](db[_0x5adb('0xbb')][_0x5adb('0x36')]);_0x173ead['query']=_[_0x5adb('0x6f')](_0x4ae211['query']);_0x173ead[_0x5adb('0x42')]=_[_0x5adb('0x3a')](_0x173ead['model'],_0x173ead[_0x5adb('0x39')]);_0x54da7c[_0x5adb('0x3c')]=_['intersection'](_0x173ead['model'],qs[_0x5adb('0x3d')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x3d')]));_0x54da7c[_0x5adb('0x3c')]=_0x54da7c[_0x5adb('0x3c')][_0x5adb('0x3e')]?_0x54da7c['attributes']:_0x173ead[_0x5adb('0x3b')];if(!_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbc')](_0x5adb('0xbd'))){_0x54da7c[_0x5adb('0x3f')]=qs['limit'](_0x4ae211['query'][_0x5adb('0x3f')]);_0x54da7c[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x21')]);}_0x54da7c[_0x5adb('0x40')]=qs[_0x5adb('0x41')](_0x4ae211[_0x5adb('0x39')][_0x5adb('0x41')]);_0x54da7c['where']=qs[_0x5adb('0x42')](_[_0x5adb('0x43')](_0x4ae211['query'],_0x173ead['filters']));_0x54da7c['where'][_0x5adb('0xac')]=_0xa1911a['id'];if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0x81')]){_0x54da7c['where']=_['merge'](_0x54da7c[_0x5adb('0x79')],{'$or':_[_0x5adb('0x2e')](_0x54da7c[_0x5adb('0x3c')],function(_0x3d2a5b){var _0x3b367f={};_0x3b367f[_0x3d2a5b]={'$like':'%'+_0x4ae211[_0x5adb('0x39')]['filter']+'%'};return _0x3b367f;})});}if(_0x4ae211['query'][_0x5adb('0xbe')]){var _0x5a9e55=_0x4ae211[_0x5adb('0x39')][_0x5adb('0xbe')]['split'](',');var _0x7151b8={};_0x7151b8[_0x5a9e55[0x0]]={'$gte':moment(_0x5a9e55[0x1])[_0x5adb('0xbf')](_0x5adb('0xc0'))};_0x54da7c[_0x5adb('0x79')]=_['merge'](_0x54da7c[_0x5adb('0x79')],_0x7151b8);}_0x54da7c=_[_0x5adb('0xb3')]({},_0x54da7c,_0x4ae211[_0x5adb('0xb4')]);return db[_0x5adb('0xbb')]['count']({'where':_0x54da7c[_0x5adb('0x79')]})['then'](function(_0x29cc2f){_0x3796b7[_0x5adb('0x97')]=_0x29cc2f;if(_0x4ae211[_0x5adb('0x39')][_0x5adb('0xb1')]){_0x54da7c[_0x5adb('0xb2')]=[{'all':!![]}];}return db[_0x5adb('0xbb')]['findAll'](_0x54da7c);})[_0x5adb('0x27')](function(_0x49e908){_0x3796b7[_0x5adb('0xc1')]=_0x49e908;return _0x3796b7;});}})[_0x5adb('0x27')](respondWithFilteredResult(_0x74065,_0x54da7c))['catch'](handleError(_0x74065,null));};exports[_0x5adb('0xc2')]=function(_0x52e44f,_0x5a517a,_0x4d50f7){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x52e44f['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x5a517a,null))[_0x5adb('0x27')](function(_0x325f86){if(_0x325f86){return _0x325f86[_0x5adb('0xc3')](_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')],_[_0x5adb('0xc4')](_0x52e44f['body'],[_0x5adb('0xb8'),'id'])||{})[_0x5adb('0xc5')](function(){return db['Tag'][_0x5adb('0xc6')]({'attributes':['id',_0x5adb('0x2b'),_0x5adb('0xc7')],'where':{'id':_0x52e44f[_0x5adb('0x6e')][_0x5adb('0xb8')]}});})[_0x5adb('0x27')](function(_0x3a88ab){socket[_0x5adb('0xc8')](_0x5adb('0xc9'),{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]});return{'id':Number(_0x52e44f[_0x5adb('0xb0')]['id']),'tags':_0x3a88ab||[]};});}})[_0x5adb('0x27')](respondWithResult(_0x5a517a,null))['catch'](handleError(_0x5a517a,null));};exports['removeTags']=function(_0x2376a6,_0x282c11,_0x35a718){return db[_0x5adb('0x35')]['find']({'where':{'id':_0x2376a6[_0x5adb('0xb0')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x282c11,null))[_0x5adb('0x27')](function(_0xb9ac38){if(_0xb9ac38){return _0xb9ac38[_0x5adb('0xca')](_0x2376a6['query']['ids']);}})[_0x5adb('0x27')](respondWithStatusCode(_0x282c11,null))['catch'](handleError(_0x282c11,null));};exports[_0x5adb('0xcb')]=function(_0x64fae1,_0x3ad256){var _0x2b4228=moment()[_0x5adb('0xcc')]()[_0x5adb('0x96')]();var _0x5e17ea=path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xd0'),_0x5adb('0xd1'));var _0xabc1ee=path[_0x5adb('0xcd')](config['root'],'server','files',_0x5adb('0xd2'));var _0x5ae730=path[_0x5adb('0xcd')](_0x5e17ea,_0x2b4228);var _0x5983ef=util['format'](_0x5adb('0xd3'),_0x64fae1[_0x5adb('0xb0')]['id'],_0x2b4228);var _0x5e74dc=path['join'](_0x5e17ea,_0x5983ef);var _0x3612c=[];_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0x68')],'as':'User','attributes':['id',_0x5adb('0x2f')],'raw':!![]});_0x3612c['push']({'model':db['CmContact'],'as':_0x5adb('0x5d'),'attributes':['id',_0x5adb('0xd4'),_0x5adb('0xd5')],'raw':!![]});if(_0x64fae1['query']['attachments']){_0x3612c[_0x5adb('0x34')]({'model':db[_0x5adb('0xd6')],'as':'Attachment','raw':!![]});}var _0x5366d4=[{'model':db[_0x5adb('0xbb')],'as':_0x5adb('0xd7'),'attributes':['id','body',_0x5adb('0x75'),'direction',_0x5adb('0xd8'),'read'],'include':_0x3612c}];_0x5366d4[_0x5adb('0x34')]({'model':db[_0x5adb('0xd9')],'as':_0x5adb('0xda'),'attributes':['id',_0x5adb('0x2b')]});_0x5366d4[_0x5adb('0x34')]({'model':db['User'],'as':_0x5adb('0xdb'),'attributes':['id',_0x5adb('0x2f')]});return db[_0x5adb('0x35')]['find']({'where':{'id':_0x64fae1[_0x5adb('0xb0')]['id']},'include':_0x5366d4})[_0x5adb('0x27')](handleEntityNotFound(_0x3ad256,null))[_0x5adb('0x27')](function(_0x45526a){if(_0x45526a){var _0x57607e=_0x45526a[_0x5adb('0xdc')]({'plain':!![]});fs[_0x5adb('0xdd')](_0x5ae730);var _0x3bbe7c={'format':'A4','border':'10px','header':{'height':_0x5adb('0xde'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x5adb('0xdf'),'contents':{'default':util[_0x5adb('0xbf')](_0x5adb('0xe0'),util[_0x5adb('0xbf')](_0x5adb('0xe1'),'Whatsapp',_0x57607e['id']),moment()['format']('YYYY-MM-DD')[_0x5adb('0x96')]())}}};var _0x4a1b54={'channel':'Whatsapp','account':_0x57607e[_0x5adb('0xda')][_0x5adb('0x2b')],'agent':_0x57607e[_0x5adb('0xdb')]?_0x57607e[_0x5adb('0xdb')][_0x5adb('0x2f')]:_0x5adb('0xe2'),'createdAt':moment(_0x57607e[_0x5adb('0x75')])[_0x5adb('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5adb('0x96')](),'closedAt':_0x57607e[_0x5adb('0xe3')]?moment(_0x57607e['closedAt'])[_0x5adb('0xbf')](_0x5adb('0xc0'))['toString']():'','disposition':_0x57607e[_0x5adb('0xe4')],'messages':_(_0x57607e['Messages'])[_0x5adb('0x81')]({'secret':![]})[_0x5adb('0x2e')](function(_0x3d782b){if(_0x3d782b[_0x5adb('0xd6')]){var _0x651279=path[_0x5adb('0xcd')](_0xabc1ee,_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]);if(fs['existsSync'](_0x651279)){fs[_0x5adb('0xe6')](_0x651279)['pipe'](fs[_0x5adb('0xe7')](path['join'](_0x5ae730,_0x3d782b[_0x5adb('0xd6')]['basename'])));}}return{'date':moment(_0x3d782b[_0x5adb('0x75')])[_0x5adb('0xbf')](_0x5adb('0xc0'))[_0x5adb('0x96')](),'sender':_0x3d782b[_0x5adb('0xe8')]===_0x5adb('0xe9')?_0x3d782b[_0x5adb('0x68')]?_0x3d782b[_0x5adb('0x68')][_0x5adb('0x2f')]:_0x5adb('0xea'):_0x3d782b[_0x5adb('0x5d')][_0x5adb('0xd4')]+(_0x3d782b[_0x5adb('0x5d')]['lastName']?'\x20'+_0x3d782b[_0x5adb('0x5d')]['lastName']:''),'body':_0x3d782b[_0x5adb('0xd6')]?_0x3d782b[_0x5adb('0xd6')][_0x5adb('0xe5')]:_0x3d782b['body'],'direction':_0x3d782b['direction']==='out'?'A':'C','secret':_0x3d782b['secret'],'read':_0x3d782b[_0x5adb('0x7c')],'attachment':_0x3d782b[_0x5adb('0xd6')]};})[_0x5adb('0x5f')]()};return ejs[_0x5adb('0xeb')](path[_0x5adb('0xcd')](config[_0x5adb('0xce')],_0x5adb('0xcf'),_0x5adb('0xec'),_0x5adb('0xed')),{'interaction':_0x4a1b54})['then'](function(_0x39bf82){return new BPromise(function(_0x197b7f,_0x171fb9){pdf[_0x5adb('0xb5')](_0x39bf82,_0x3bbe7c)[_0x5adb('0xee')](path[_0x5adb('0xcd')](_0x5ae730,'transcript-'+_0x57607e['id']+'-'+_0x2b4228+'.pdf'),function(_0x4edb9e,_0x25f1f7){if(_0x4edb9e)return _0x171fb9(_0x4edb9e);_0x197b7f(_0x25f1f7);});});})[_0x5adb('0x27')](function(){return new BPromise(function(_0xb81dd2,_0x2b753d){zipdir(_0x5ae730,{'saveTo':_0x5e74dc},function(_0x27eb1e,_0x5eef55){if(_0x27eb1e)return _0x2b753d(_0x27eb1e);return _0xb81dd2(_0x5eef55);});})[_0x5adb('0x27')](function(){return new BPromise(function(_0x2cb713,_0x2034d7){rimraf(_0x5ae730,function(_0x3dd67b){if(_0x3dd67b)_0x2034d7(_0x3dd67b);return _0x2cb713();});});})[_0x5adb('0x27')](function(){return _0x3ad256[_0x5adb('0xcb')](_0x5e74dc,_0x5983ef,function(_0x38c24d){if(_0x38c24d){console[_0x5adb('0xef')](_0x5adb('0xf0'),_0x38c24d);}else{fs[_0x5adb('0xf1')](_0x5e74dc);}});});});}else{return _0x3ad256[_0x5adb('0x1d')](0xc8);}})[_0x5adb('0xae')](handleError(_0x3ad256,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6f85ad8..16c1065 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 _0x77eb=['Users','map','unreadMessages','emit','catch','hasOwnProperty','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue'];(function(_0x595112,_0xdeaf88){var _0x33f8a2=function(_0x28e70d){while(--_0x28e70d){_0x595112['push'](_0x595112['shift']());}};_0x33f8a2(++_0xdeaf88);}(_0x77eb,0x128));var _0xb77e=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0x77eb[_0x11b58d];return _0xc2811b;};'use strict';var EventEmitter=require(_0xb77e('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xb77e('0x1')];var WhatsappMessage=require(_0xb77e('0x2'))['db'][_0xb77e('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb77e('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb77e('0x5'),'afterDestroy':_0xb77e('0x6')};function emitEvent(_0x50b069){return function(_0x24391e,_0x5d74e0,_0x34cab2){_0x24391e[_0xb77e('0x7')]({'attributes':['id'],'raw':!![]})[_0xb77e('0x8')](function(_0x2e0eae){_0x24391e[_0xb77e('0x9')](_0xb77e('0xa'),_0x2e0eae[_0xb77e('0xb')](function(_0x1d1488){return{'id':_0x1d1488['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x24391e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb77e('0x8')](function(_0xb041b6){_0x24391e[_0xb77e('0x9')](_0xb77e('0xc'),_0xb041b6['length']);WhatsappInteractionEvents[_0xb77e('0xd')](_0x50b069+':'+_0x24391e['id'],_0x24391e);WhatsappInteractionEvents[_0xb77e('0xd')](_0x50b069,_0x24391e);_0x34cab2(null);})[_0xb77e('0xe')](_0x34cab2(null));};}for(var e in events){if(events[_0xb77e('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xb77e('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x4ffc=['then','map','findAll','unreadMessages','length','emit','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0x4ffc,0x124));var _0xc4ff=function(_0x566585,_0x54183a){_0x566585=_0x566585-0x0;var _0x3bd63f=_0x4ffc[_0x566585];return _0x3bd63f;};'use strict';var EventEmitter=require(_0xc4ff('0x0'));var WhatsappInteraction=require(_0xc4ff('0x1'))['db'][_0xc4ff('0x2')];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc4ff('0x3')](0x0);var events={'afterCreate':_0xc4ff('0x4'),'afterUpdate':_0xc4ff('0x5'),'afterDestroy':_0xc4ff('0x6')};function emitEvent(_0x59f848){return function(_0x2fac81,_0x3b073d,_0x49ec55){_0x2fac81[_0xc4ff('0x7')]({'attributes':['id'],'raw':!![]})[_0xc4ff('0x8')](function(_0x26cabe){_0x2fac81['setDataValue']('Users',_0x26cabe[_0xc4ff('0x9')](function(_0x588836){return{'id':_0x588836['id']};}));return WhatsappMessage[_0xc4ff('0xa')]({'where':{'WhatsappInteractionId':_0x2fac81['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc4ff('0x8')](function(_0x4e067b){_0x2fac81['setDataValue'](_0xc4ff('0xb'),_0x4e067b[_0xc4ff('0xc')]);WhatsappInteractionEvents[_0xc4ff('0xd')](_0x59f848+':'+_0x2fac81['id'],_0x2fac81);WhatsappInteractionEvents[_0xc4ff('0xd')](_0x59f848,_0x2fac81);_0x49ec55(null);})['catch'](_0x49ec55(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xc4ff('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index ce80df0..4aac66a 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(_0x39f027,_0x3cd724){var _0x315828=function(_0x16b0fb){while(--_0x16b0fb){_0x39f027['push'](_0x39f027['shift']());}};_0x315828(++_0x3cd724);}(_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':'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(_0x1f434b,_0x3abfce){var _0x79315f=function(_0x6a0efe){while(--_0x6a0efe){_0x1f434b['push'](_0x1f434b['shift']());}};_0x79315f(++_0x3abfce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 da3285c..89b23e7 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 _0x1b25=['./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','limit','find','addTags','body','omit','ids','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x1b25,0x152));var _0x51b2=function(_0x3d1c32,_0x2ddd4d){_0x3d1c32=_0x3d1c32-0x0;var _0x57291b=_0x1b25[_0x3d1c32];return _0x57291b;};'use strict';var _=require(_0x51b2('0x0'));var util=require(_0x51b2('0x1'));var moment=require(_0x51b2('0x2'));var BPromise=require(_0x51b2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x51b2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x51b2('0x5'));var logger=require('../../config/logger')(_0x51b2('0x6'));var config=require(_0x51b2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x51b2('0x8')][_0x51b2('0x9')]({'port':0x232a});config[_0x51b2('0xa')]=_[_0x51b2('0xb')](config[_0x51b2('0xa')],{'host':_0x51b2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51b2('0xa')]));require(_0x51b2('0xd'))[_0x51b2('0xe')](socket);function respondWithRpcPromise(_0x4c3714,_0x345456,_0x52c25c){return new BPromise(function(_0x4fbada,_0x4e0775){return client['request'](_0x4c3714,_0x52c25c)[_0x51b2('0xf')](function(_0x37ea04){logger[_0x51b2('0x10')](_0x51b2('0x11'),_0x345456,_0x51b2('0x12'));logger[_0x51b2('0x13')](_0x51b2('0x14'),_0x345456,_0x51b2('0x12'),JSON[_0x51b2('0x15')](_0x37ea04));if(_0x37ea04[_0x51b2('0x16')]){if(_0x37ea04['error']['code']===0x1f4){logger[_0x51b2('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x345456,_0x37ea04['error'][_0x51b2('0x17')]);return _0x4e0775(_0x37ea04['error']['message']);}logger[_0x51b2('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x345456,_0x37ea04['error'][_0x51b2('0x17')]);return _0x4fbada(_0x37ea04['error'][_0x51b2('0x17')]);}else{logger[_0x51b2('0x10')](_0x51b2('0x11'),_0x345456,_0x51b2('0x12'));_0x4fbada(_0x37ea04['result'][_0x51b2('0x17')]);}})[_0x51b2('0x18')](function(_0x22f020){logger[_0x51b2('0x16')](_0x51b2('0x11'),_0x345456,_0x22f020);_0x4e0775(_0x22f020);});});}exports[_0x51b2('0x19')]=function(_0xa533e0){var _0x498466=this;return new Promise(function(_0x324776,_0x1bbe57){return db[_0x51b2('0x1a')][_0x51b2('0x1b')](_0xa533e0['body'],{'raw':_0xa533e0[_0x51b2('0x1c')]?_0xa533e0[_0x51b2('0x1c')][_0x51b2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa533e0[_0x51b2('0x1c')]?_0xa533e0[_0x51b2('0x1c')][_0x51b2('0x1e')]||null:null,'attributes':_0xa533e0[_0x51b2('0x1c')]?_0xa533e0[_0x51b2('0x1c')][_0x51b2('0x1f')]||null:null,'limit':_0xa533e0[_0x51b2('0x1c')]?_0xa533e0[_0x51b2('0x1c')][_0x51b2('0x20')]||null:null})['then'](function(_0x1c3851){logger[_0x51b2('0x10')](_0x51b2('0x19'),_0xa533e0);logger[_0x51b2('0x13')](_0x51b2('0x19'),_0xa533e0,JSON['stringify'](_0x1c3851));_0x324776(_0x1c3851);})[_0x51b2('0x18')](function(_0x1028ef){logger['error'](_0x51b2('0x19'),_0x1028ef['message'],_0xa533e0);_0x1bbe57(_0x498466[_0x51b2('0x16')](0x1f4,_0x1028ef[_0x51b2('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4ab088){return new Promise(function(_0x2a2352,_0x13a680){return db[_0x51b2('0x1a')][_0x51b2('0x21')]({'where':_0x4ab088[_0x51b2('0x1c')]?_0x4ab088['options'][_0x51b2('0x1e')]||null:null})['then'](function(_0x1caf6d){if(_0x1caf6d){return _0x1caf6d[_0x51b2('0x22')](_0x4ab088[_0x51b2('0x23')]['ids'],_[_0x51b2('0x24')](_0x4ab088['body'],[_0x51b2('0x25'),'id'])||{});}})['spread'](function(_0x498881){logger[_0x51b2('0x10')]('AddTags',_0x4ab088);logger['debug'](_0x51b2('0x26'),_0x4ab088,JSON['stringify'](_0x498881));_0x2a2352(_0x498881);})['catch'](function(_0x1559ff){logger[_0x51b2('0x16')](_0x51b2('0x26'),_0x1559ff[_0x51b2('0x17')],_0x4ab088);_0x13a680(_this[_0x51b2('0x16')](0x1f4,_0x1559ff['message']));});});}; \ No newline at end of file +var _0x0dc3=['options','raw','attributes','limit','AddTagsToWhatsappInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../mysqldb','../../config/environment','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','then','info','request\x20sent','debug','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0dc3,0x192));var _0x30dc=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0x0dc3[_0x199c03];return _0x11a7d4;};'use strict';var _=require(_0x30dc('0x0'));var util=require(_0x30dc('0x1'));var moment=require(_0x30dc('0x2'));var BPromise=require(_0x30dc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30dc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x30dc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x30dc('0x6')][_0x30dc('0x7')]({'port':0x232a});config[_0x30dc('0x8')]=_[_0x30dc('0x9')](config[_0x30dc('0x8')],{'host':_0x30dc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x30dc('0x8')]));require(_0x30dc('0xb'))[_0x30dc('0xc')](socket);function respondWithRpcPromise(_0x3b8f50,_0x21d52d,_0x43ccfe){return new BPromise(function(_0x33ebed,_0x426a52){return client['request'](_0x3b8f50,_0x43ccfe)[_0x30dc('0xd')](function(_0x288b92){logger[_0x30dc('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x21d52d,_0x30dc('0xf'));logger[_0x30dc('0x10')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x21d52d,'request\x20sent',JSON[_0x30dc('0x11')](_0x288b92));if(_0x288b92[_0x30dc('0x12')]){if(_0x288b92[_0x30dc('0x12')][_0x30dc('0x13')]===0x1f4){logger['error'](_0x30dc('0x14'),_0x21d52d,_0x288b92['error'][_0x30dc('0x15')]);return _0x426a52(_0x288b92['error'][_0x30dc('0x15')]);}logger[_0x30dc('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x21d52d,_0x288b92['error'][_0x30dc('0x15')]);return _0x33ebed(_0x288b92['error']['message']);}else{logger[_0x30dc('0xe')](_0x30dc('0x14'),_0x21d52d,_0x30dc('0xf'));_0x33ebed(_0x288b92['result'][_0x30dc('0x15')]);}})[_0x30dc('0x16')](function(_0x14049a){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x21d52d,_0x14049a);_0x426a52(_0x14049a);});});}exports[_0x30dc('0x17')]=function(_0x235ad6){var _0x436a97=this;return new Promise(function(_0x3e8ff5,_0x3fda06){return db[_0x30dc('0x18')][_0x30dc('0x19')](_0x235ad6[_0x30dc('0x1a')],{'raw':_0x235ad6[_0x30dc('0x1b')]?_0x235ad6[_0x30dc('0x1b')][_0x30dc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x235ad6[_0x30dc('0x1b')]?_0x235ad6[_0x30dc('0x1b')]['where']||null:null,'attributes':_0x235ad6['options']?_0x235ad6[_0x30dc('0x1b')][_0x30dc('0x1d')]||null:null,'limit':_0x235ad6[_0x30dc('0x1b')]?_0x235ad6[_0x30dc('0x1b')][_0x30dc('0x1e')]||null:null})[_0x30dc('0xd')](function(_0x51f43e){logger['info'](_0x30dc('0x17'),_0x235ad6);logger[_0x30dc('0x10')](_0x30dc('0x17'),_0x235ad6,JSON[_0x30dc('0x11')](_0x51f43e));_0x3e8ff5(_0x51f43e);})[_0x30dc('0x16')](function(_0x563f8a){logger[_0x30dc('0x12')](_0x30dc('0x17'),_0x563f8a['message'],_0x235ad6);_0x3fda06(_0x436a97['error'](0x1f4,_0x563f8a[_0x30dc('0x15')]));});});};exports[_0x30dc('0x1f')]=function(_0x114749){return new Promise(function(_0x2e48c8,_0xa8d3ad){return db['WhatsappInteraction'][_0x30dc('0x20')]({'where':_0x114749[_0x30dc('0x1b')]?_0x114749[_0x30dc('0x1b')][_0x30dc('0x21')]||null:null})['then'](function(_0x3eea5e){if(_0x3eea5e){return _0x3eea5e[_0x30dc('0x22')](_0x114749[_0x30dc('0x1a')][_0x30dc('0x23')],_[_0x30dc('0x24')](_0x114749[_0x30dc('0x1a')],[_0x30dc('0x23'),'id'])||{});}})[_0x30dc('0x25')](function(_0x3176eb){logger['info'](_0x30dc('0x26'),_0x114749);logger['debug'](_0x30dc('0x26'),_0x114749,JSON['stringify'](_0x3176eb));_0x2e48c8(_0x3176eb);})[_0x30dc('0x16')](function(_0x481347){logger[_0x30dc('0x12')](_0x30dc('0x26'),_0x481347[_0x30dc('0x15')],_0x114749);_0xa8d3ad(_this[_0x30dc('0x12')](0x1f4,_0x481347[_0x30dc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 8af42b8..b89aa36 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 _0x99cc=['length','save','remove','update','emit','removeListener','register'];(function(_0x1879c6,_0x593e24){var _0x2f6f5f=function(_0x32d01a){while(--_0x32d01a){_0x1879c6['push'](_0x1879c6['shift']());}};_0x2f6f5f(++_0x593e24);}(_0x99cc,0x1cf));var _0xc99c=function(_0x46d425,_0x4de85f){_0x46d425=_0x46d425-0x0;var _0xd6cd1a=_0x99cc[_0x46d425];return _0xd6cd1a;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xc99c('0x0'),_0xc99c('0x1'),_0xc99c('0x2')];function createListener(_0xe1a8a2,_0x59fed5){return function(_0x128ce){_0x59fed5[_0xc99c('0x3')](_0xe1a8a2,_0x128ce);};}function removeListener(_0x3a2c8a,_0x34d60a){return function(){WhatsappInteractionEvents[_0xc99c('0x4')](_0x3a2c8a,_0x34d60a);};}exports[_0xc99c('0x5')]=function(_0x156028){for(var _0x2c4691=0x0,_0x31a196=events[_0xc99c('0x6')];_0x2c4691<_0x31a196;_0x2c4691++){var _0x1c9d03=events[_0x2c4691];var _0x2707bb=createListener('whatsappInteraction:'+_0x1c9d03,_0x156028);WhatsappInteractionEvents['on'](_0x1c9d03,_0x2707bb);}}; \ No newline at end of file +var _0x7b78=['emit','removeListener','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x7b78,0x13e));var _0x87b7=function(_0x59bc3f,_0x4f122c){_0x59bc3f=_0x59bc3f-0x0;var _0x364a26=_0x7b78[_0x59bc3f];return _0x364a26;};'use strict';var WhatsappInteractionEvents=require(_0x87b7('0x0'));var events=[_0x87b7('0x1'),'remove','update'];function createListener(_0x3be4f7,_0x2796ff){return function(_0x1108fc){_0x2796ff[_0x87b7('0x2')](_0x3be4f7,_0x1108fc);};}function removeListener(_0xc38647,_0x1af7b6){return function(){WhatsappInteractionEvents[_0x87b7('0x3')](_0xc38647,_0x1af7b6);};}exports['register']=function(_0x362231){for(var _0x231dbd=0x0,_0x152d77=events['length'];_0x231dbd<_0x152d77;_0x231dbd++){var _0x50cec0=events[_0x231dbd];var _0x3d098a=createListener(_0x87b7('0x4')+_0x50cec0,_0x362231);WhatsappInteractionEvents['on'](_0x50cec0,_0x3d098a);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index de23667..fb201d8 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 _0xda51=['isAuthenticated','index','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','accept','/:id/reject','reject','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get'];(function(_0x4de226,_0xf589ec){var _0x2fb276=function(_0x3f99ed){while(--_0x3f99ed){_0x4de226['push'](_0x4de226['shift']());}};_0x2fb276(++_0xf589ec);}(_0xda51,0x1a6));var _0x1da5=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xda51[_0x62c958];return _0x57ec61;};'use strict';var multer=require(_0x1da5('0x0'));var util=require(_0x1da5('0x1'));var path=require(_0x1da5('0x2'));var timeout=require(_0x1da5('0x3'));var express=require(_0x1da5('0x4'));var router=express[_0x1da5('0x5')]();var auth=require(_0x1da5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1da5('0x7'));var controller=require(_0x1da5('0x8'));router[_0x1da5('0x9')]('/',auth[_0x1da5('0xa')](),controller[_0x1da5('0xb')]);router['get']('/describe',auth[_0x1da5('0xa')](),controller['describe']);router['get'](_0x1da5('0xc'),auth[_0x1da5('0xa')](),controller[_0x1da5('0xd')]);router[_0x1da5('0xe')]('/',auth[_0x1da5('0xa')](),interaction[_0x1da5('0xf')](_0x1da5('0x10'),_0x1da5('0x11')),controller['create']);router['post'](_0x1da5('0x12'),controller[_0x1da5('0x13')]);router['put'](_0x1da5('0xc'),auth[_0x1da5('0xa')](),controller['update']);router[_0x1da5('0x14')]('/:id/accept',auth[_0x1da5('0xa')](),controller[_0x1da5('0x15')]);router[_0x1da5('0x14')](_0x1da5('0x16'),auth[_0x1da5('0xa')](),controller[_0x1da5('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x72b1=['show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','accept','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','/:id'];(function(_0x34855a,_0x161330){var _0x55c1b5=function(_0x2f45d1){while(--_0x2f45d1){_0x34855a['push'](_0x34855a['shift']());}};_0x55c1b5(++_0x161330);}(_0x72b1,0x138));var _0x172b=function(_0x4a64a2,_0x1fe22f){_0x4a64a2=_0x4a64a2-0x0;var _0x24c9a8=_0x72b1[_0x4a64a2];return _0x24c9a8;};'use strict';var multer=require(_0x172b('0x0'));var util=require(_0x172b('0x1'));var path=require(_0x172b('0x2'));var timeout=require('connect-timeout');var express=require(_0x172b('0x3'));var router=express[_0x172b('0x4')]();var auth=require(_0x172b('0x5'));var interaction=require(_0x172b('0x6'));var config=require(_0x172b('0x7'));var controller=require(_0x172b('0x8'));router[_0x172b('0x9')]('/',auth[_0x172b('0xa')](),controller['index']);router['get'](_0x172b('0xb'),auth[_0x172b('0xa')](),controller['describe']);router['get'](_0x172b('0xc'),auth['isAuthenticated'](),controller[_0x172b('0xd')]);router[_0x172b('0xe')]('/',auth[_0x172b('0xa')](),interaction[_0x172b('0xf')](_0x172b('0x10'),_0x172b('0x11')),controller[_0x172b('0x12')]);router['post'](_0x172b('0x13'),controller[_0x172b('0x14')]);router[_0x172b('0x15')](_0x172b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x172b('0x15')]('/:id/accept',auth[_0x172b('0xa')](),controller[_0x172b('0x16')]);router[_0x172b('0x15')]('/:id/reject',auth[_0x172b('0xa')](),controller['reject']);router[_0x172b('0x17')](_0x172b('0xc'),auth['isAuthenticated'](),controller[_0x172b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2063049..41458ce 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 _0xc507=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x31e965,_0xbd1e54){var _0x120351=function(_0x45229d){while(--_0x45229d){_0x31e965['push'](_0x31e965['shift']());}};_0x120351(++_0xbd1e54);}(_0xc507,0x8d));var _0x7c50=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0xc507[_0x5e3701];return _0x345dcf;};'use strict';var Sequelize=require(_0x7c50('0x0'));module[_0x7c50('0x1')]={'body':{'type':Sequelize[_0x7c50('0x2')](_0x7c50('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7c50('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7c50('0x5')]('in',_0x7c50('0x6')),'defaultValue':_0x7c50('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7c50('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x7c50('0x8')]},'secret':{'type':Sequelize[_0x7c50('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xd89a=['STRING','DATE','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0xb3aca8,_0x44df01){var _0x4dad8a=function(_0x1a8fc9){while(--_0x1a8fc9){_0xb3aca8['push'](_0xb3aca8['shift']());}};_0x4dad8a(++_0x44df01);}(_0xd89a,0x6b));var _0xad89=function(_0x2bcb4d,_0x1b1d96){_0x2bcb4d=_0x2bcb4d-0x0;var _0x423940=_0xd89a[_0x2bcb4d];return _0x423940;};'use strict';var Sequelize=require(_0xad89('0x0'));module['exports']={'body':{'type':Sequelize[_0xad89('0x1')](_0xad89('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xad89('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xad89('0x4')),'defaultValue':_0xad89('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xad89('0x5')]},'readAt':{'type':Sequelize[_0xad89('0x6')]},'secret':{'type':Sequelize[_0xad89('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 85138ed..f7acd57 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 _0x3b82=['bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappMessage,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','name','send','map','WhatsappMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','show','params','rawAttributes','includeAll','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','readAt','format','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','SIP/%s','channel','event','EventManager','acceptmessage','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','read','inspect','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3b82,0x102));var _0x23b8=function(_0x37e0c5,_0x46c212){_0x37e0c5=_0x37e0c5-0x0;var _0x22f40e=_0x3b82[_0x37e0c5];return _0x22f40e;};'use strict';var pdf=require(_0x23b8('0x0'));var emlformat=require(_0x23b8('0x1'));var rimraf=require(_0x23b8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23b8('0x3'));var rp=require(_0x23b8('0x4'));var moment=require(_0x23b8('0x5'));var BPromise=require(_0x23b8('0x6'));var Mustache=require('mustache');var util=require(_0x23b8('0x7'));var path=require(_0x23b8('0x8'));var sox=require(_0x23b8('0x9'));var csv=require(_0x23b8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x23b8('0xb'));var squel=require(_0x23b8('0xc'));var crypto=require(_0x23b8('0xd'));var jsforce=require(_0x23b8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x23b8('0xf'));var Papa=require('papaparse');var Redis=require(_0x23b8('0x10'));var authService=require(_0x23b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x23b8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x23b8('0x13'))(_0x23b8('0x14'));var utils=require('../../config/utils');var config=require(_0x23b8('0x15'));var db=require(_0x23b8('0x16'))['db'];config[_0x23b8('0x17')]=_[_0x23b8('0x18')](config[_0x23b8('0x17')],{'host':_0x23b8('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x23b8('0x17')]));require('./whatsappMessage.socket')[_0x23b8('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x23b8('0x1b')][_0x23b8('0x1c')]({'port':0x232c});var client9002=jayson[_0x23b8('0x1b')][_0x23b8('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x44c231,_0x2a7f2f,_0x5b31d7){if(_0x5b31d7){var _0x2b12a5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b12a5[_0x23b8('0x1d')](_0x2a7f2f)){return _0x44c231;}else{throw new db[(_0x23b8('0x1e'))]['ValidationError'](_0x23b8('0x1f'));}}else{return _0x44c231;}}function respondWithRpcPromise(_0x2c68ba,_0x42b25e,_0x2c4646,_0x9ebb1a){return new BPromise(function(_0xae62c2,_0x2ae466){var _0x5d9cf0=_0x9ebb1a||client;return _0x5d9cf0[_0x23b8('0x20')](_0x2c68ba,_0x2c4646)[_0x23b8('0x21')](function(_0x5c020d){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x42b25e,_0x23b8('0x22'));logger['debug'](_0x23b8('0x23'),_0x42b25e,_0x23b8('0x22'),JSON['stringify'](_0x5c020d));if(_0x5c020d[_0x23b8('0x24')]){if(_0x5c020d[_0x23b8('0x24')][_0x23b8('0x25')]===0x1f4){logger[_0x23b8('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x42b25e,_0x5c020d['error'][_0x23b8('0x26')]);return _0x2ae466(_0x5c020d[_0x23b8('0x24')][_0x23b8('0x26')]);}logger['error'](_0x23b8('0x27'),_0x42b25e,_0x5c020d['error'][_0x23b8('0x26')]);return _0xae62c2(_0x5c020d['error'][_0x23b8('0x26')]);}else{logger[_0x23b8('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x42b25e,_0x23b8('0x22'));_0xae62c2(_0x5c020d[_0x23b8('0x29')][_0x23b8('0x26')]);}})[_0x23b8('0x2a')](function(_0x529c2a){logger['error'](_0x23b8('0x27'),_0x42b25e,_0x529c2a);_0x2ae466(_0x529c2a);});});}function respondWithStatusCode(_0xf1f43a,_0x324d78){_0x324d78=_0x324d78||0xcc;return function(_0x2fa9c4){if(_0x2fa9c4){return _0xf1f43a[_0x23b8('0x2b')](_0x324d78);}return _0xf1f43a[_0x23b8('0x2c')](_0x324d78)[_0x23b8('0x2d')]();};}function respondWithResult(_0x55d0f8,_0xa16db4){_0xa16db4=_0xa16db4||0xc8;return function(_0x4c4785){if(_0x4c4785){return _0x55d0f8[_0x23b8('0x2c')](_0xa16db4)[_0x23b8('0x2e')](_0x4c4785);}};}function respondWithFilteredResult(_0x12e468,_0x2ba126){return function(_0x369e5b){if(_0x369e5b){var _0x1a1786=_0x369e5b[_0x23b8('0x2f')],_0x225954=_0x2ba126[_0x23b8('0x30')],_0x19fb3f=_0x2ba126[_0x23b8('0x30')]+_0x2ba126[_0x23b8('0x31')],_0x918982;if(_0x19fb3f>=_0x1a1786){_0x19fb3f=_0x1a1786;_0x918982=0xc8;}else{_0x918982=0xce;}_0x12e468[_0x23b8('0x2c')](_0x918982);return _0x12e468['set'](_0x23b8('0x32'),_0x225954+'-'+_0x19fb3f+'/'+_0x1a1786)[_0x23b8('0x2e')](_0x369e5b);}return null;};}function patchUpdates(_0x418bc1){return function(_0x57c634){try{jsonpatch[_0x23b8('0x33')](_0x57c634,_0x418bc1,!![]);}catch(_0x2cfeaa){return BPromise[_0x23b8('0x34')](_0x2cfeaa);}return _0x57c634[_0x23b8('0x35')]();};}function saveUpdates(_0x2b3f09,_0x173428){return function(_0x1c2a9b){if(_0x1c2a9b){return _0x1c2a9b[_0x23b8('0x36')](_0x2b3f09)[_0x23b8('0x21')](function(_0x462b06){return _0x462b06;});}return null;};}function removeEntity(_0x45332a,_0xd6ee31){return function(_0x49287f){if(_0x49287f){return _0x49287f['destroy']()[_0x23b8('0x21')](function(){_0x45332a[_0x23b8('0x2c')](0xcc)[_0x23b8('0x2d')]();});}};}function handleEntityNotFound(_0x14a519,_0x34e39e){return function(_0x35c7c4){if(!_0x35c7c4){_0x14a519['sendStatus'](0x194);}return _0x35c7c4;};}function handleError(_0x57e140,_0x30cf70){_0x30cf70=_0x30cf70||0x1f4;return function(_0x46f68a){logger[_0x23b8('0x24')](_0x46f68a['stack']);if(_0x46f68a[_0x23b8('0x37')]){delete _0x46f68a['name'];}_0x57e140[_0x23b8('0x2c')](_0x30cf70)[_0x23b8('0x38')](_0x46f68a);};}exports['index']=function(_0x16d56b,_0x30552d){var _0x40f1ed={},_0x2efbef={},_0x2bb35c={'count':0x0,'rows':[]};var _0x11cca4=_[_0x23b8('0x39')](db[_0x23b8('0x3a')]['rawAttributes'],function(_0x3b12a8){return{'name':_0x3b12a8[_0x23b8('0x3b')],'type':_0x3b12a8[_0x23b8('0x3c')][_0x23b8('0x3d')]};});_0x2efbef[_0x23b8('0x3e')]=_[_0x23b8('0x39')](_0x11cca4,_0x23b8('0x37'));_0x2efbef[_0x23b8('0x3f')]=_[_0x23b8('0x40')](_0x16d56b[_0x23b8('0x3f')]);_0x2efbef[_0x23b8('0x41')]=_['intersection'](_0x2efbef[_0x23b8('0x3e')],_0x2efbef[_0x23b8('0x3f')]);_0x40f1ed['attributes']=_[_0x23b8('0x42')](_0x2efbef[_0x23b8('0x3e')],qs[_0x23b8('0x43')](_0x16d56b[_0x23b8('0x3f')]['fields']));_0x40f1ed[_0x23b8('0x44')]=_0x40f1ed['attributes']['length']?_0x40f1ed['attributes']:_0x2efbef[_0x23b8('0x3e')];if(!_0x16d56b[_0x23b8('0x3f')][_0x23b8('0x45')](_0x23b8('0x46'))){_0x40f1ed['limit']=qs[_0x23b8('0x31')](_0x16d56b['query'][_0x23b8('0x31')]);_0x40f1ed[_0x23b8('0x30')]=qs[_0x23b8('0x30')](_0x16d56b[_0x23b8('0x3f')][_0x23b8('0x30')]);}_0x40f1ed[_0x23b8('0x47')]=qs[_0x23b8('0x48')](_0x16d56b[_0x23b8('0x3f')]['sort']);_0x40f1ed[_0x23b8('0x49')]=qs[_0x23b8('0x41')](_['pick'](_0x16d56b[_0x23b8('0x3f')],_0x2efbef[_0x23b8('0x41')]),_0x11cca4);if(_0x16d56b[_0x23b8('0x3f')][_0x23b8('0x4a')]){_0x40f1ed[_0x23b8('0x49')]=_[_0x23b8('0x4b')](_0x40f1ed['where'],{'$or':_[_0x23b8('0x39')](_0x11cca4,function(_0x30d9f7){if(_0x30d9f7[_0x23b8('0x3c')]!==_0x23b8('0x4c')){var _0x53e30c={};_0x53e30c[_0x30d9f7['name']]={'$like':'%'+_0x16d56b[_0x23b8('0x3f')][_0x23b8('0x4a')]+'%'};return _0x53e30c;}})});}_0x40f1ed=_[_0x23b8('0x4b')]({},_0x40f1ed,_0x16d56b[_0x23b8('0x4d')]);var _0x3b277e={'where':_0x40f1ed['where']};return db[_0x23b8('0x3a')][_0x23b8('0x2f')](_0x3b277e)[_0x23b8('0x21')](function(_0x4b3469){_0x2bb35c[_0x23b8('0x2f')]=_0x4b3469;if(_0x16d56b[_0x23b8('0x3f')]['includeAll']){_0x40f1ed[_0x23b8('0x4e')]=[{'all':!![]}];}return db[_0x23b8('0x3a')]['findAll'](_0x40f1ed);})['then'](function(_0x261ca6){_0x2bb35c[_0x23b8('0x4f')]=_0x261ca6;return _0x2bb35c;})['then'](respondWithFilteredResult(_0x30552d,_0x40f1ed))[_0x23b8('0x2a')](handleError(_0x30552d,null));};exports[_0x23b8('0x50')]=function(_0x21ea41,_0x128d45){var _0x5bb00a={'raw':!![],'where':{'id':_0x21ea41[_0x23b8('0x51')]['id']}},_0x377a55={};_0x377a55[_0x23b8('0x3e')]=_['keys'](db[_0x23b8('0x3a')][_0x23b8('0x52')]);_0x377a55['query']=_['keys'](_0x21ea41[_0x23b8('0x3f')]);_0x377a55[_0x23b8('0x41')]=_[_0x23b8('0x42')](_0x377a55[_0x23b8('0x3e')],_0x377a55[_0x23b8('0x3f')]);_0x5bb00a['attributes']=_[_0x23b8('0x42')](_0x377a55[_0x23b8('0x3e')],qs[_0x23b8('0x43')](_0x21ea41['query'][_0x23b8('0x43')]));_0x5bb00a['attributes']=_0x5bb00a[_0x23b8('0x44')]['length']?_0x5bb00a[_0x23b8('0x44')]:_0x377a55[_0x23b8('0x3e')];if(_0x21ea41[_0x23b8('0x3f')][_0x23b8('0x53')]){_0x5bb00a[_0x23b8('0x4e')]=[{'all':!![]}];}_0x5bb00a=_[_0x23b8('0x4b')]({},_0x5bb00a,_0x21ea41[_0x23b8('0x4d')]);return db['WhatsappMessage'][_0x23b8('0x54')](_0x5bb00a)[_0x23b8('0x21')](handleEntityNotFound(_0x128d45,null))[_0x23b8('0x21')](respondWithResult(_0x128d45,null))[_0x23b8('0x2a')](handleError(_0x128d45,null));};exports[_0x23b8('0x55')]=function(_0x10e46f,_0x35919a){return db['WhatsappMessage'][_0x23b8('0x55')](_0x10e46f[_0x23b8('0x56')],{})[_0x23b8('0x21')](respondWithResult(_0x35919a,0xc9))[_0x23b8('0x2a')](handleError(_0x35919a,null));};exports[_0x23b8('0x36')]=function(_0x5acaba,_0x4130dd){if(_0x5acaba[_0x23b8('0x56')]['id']){delete _0x5acaba['body']['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x5acaba[_0x23b8('0x51')]['id']}})[_0x23b8('0x21')](handleEntityNotFound(_0x4130dd,null))[_0x23b8('0x21')](saveUpdates(_0x5acaba[_0x23b8('0x56')],null))['then'](respondWithResult(_0x4130dd,null))[_0x23b8('0x2a')](handleError(_0x4130dd,null));};exports[_0x23b8('0x57')]=function(_0x2e3e2f,_0x2c4bd8){return db['WhatsappMessage'][_0x23b8('0x54')]({'where':{'id':_0x2e3e2f[_0x23b8('0x51')]['id']}})[_0x23b8('0x21')](handleEntityNotFound(_0x2c4bd8,null))[_0x23b8('0x21')](removeEntity(_0x2c4bd8,null))[_0x23b8('0x2a')](handleError(_0x2c4bd8,null));};exports['describe']=function(_0x38f431,_0x375aad){return db['WhatsappMessage'][_0x23b8('0x58')]()['then'](respondWithResult(_0x375aad,null))[_0x23b8('0x2a')](handleError(_0x375aad,null));};var interaction_log=require('../../config/logger')(_0x23b8('0x59'));exports[_0x23b8('0x5a')]=function(_0x531d06,_0x2a7a82,_0x4dd989){var _0x9253c4={'channel':_0x23b8('0x5b')};if(_0x531d06[_0x23b8('0x56')]['id']){delete _0x531d06[_0x23b8('0x56')]['id'];}_0x531d06[_0x23b8('0x56')]['read']=!![];_0x531d06[_0x23b8('0x56')][_0x23b8('0x5c')]=moment()[_0x23b8('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x531d06[_0x23b8('0x56')][_0x23b8('0x5e')]=_0x531d06['body'][_0x23b8('0x5e')]||_0x531d06[_0x23b8('0x5f')]['id'];return db[_0x23b8('0x3a')][_0x23b8('0x54')]({'where':{'id':_0x531d06[_0x23b8('0x51')]['id'],'UserId':null},'include':[{'model':db[_0x23b8('0x60')],'as':_0x23b8('0x61')}]})['then'](handleEntityNotFound(_0x2a7a82,null))[_0x23b8('0x21')](saveUpdates(_0x531d06[_0x23b8('0x56')],null))[_0x23b8('0x21')](function(_0x55031e){if(_0x55031e){_0x9253c4[_0x23b8('0x26')]=_0x55031e[_0x23b8('0x62')]({'plain':!![]});return db[_0x23b8('0x63')][_0x23b8('0x54')]({'where':{'id':_0x55031e[_0x23b8('0x64')]}});}return null;})[_0x23b8('0x21')](handleEntityNotFound(_0x2a7a82,null))['then'](function(_0x79f131){if(_0x79f131){return _0x79f131[_0x23b8('0x36')]({'UserId':_0x531d06[_0x23b8('0x56')][_0x23b8('0x5e')],'read1stAt':_[_0x23b8('0x65')](_0x79f131[_0x23b8('0x66')])?moment()['format'](_0x23b8('0x67')):undefined});}return null;})['then'](function(_0x2713e2){if(_0x2713e2){_0x9253c4['interaction']=_0x2713e2[_0x23b8('0x62')]({'plain':!![]});interaction_log[_0x23b8('0x28')](_0x23b8('0x68'),_0x531d06[_0x23b8('0x5f')]['id'],_0x531d06[_0x23b8('0x5f')]['name'],_0x531d06['user'][_0x23b8('0x69')],_0x9253c4[_0x23b8('0x6a')]['id'],_0x531d06[_0x23b8('0x56')]?JSON[_0x23b8('0x6b')](_0x531d06['body']):_0x23b8('0x6c'));return respondWithRpcPromise(_0x23b8('0x6d'),'acceptMessage',_0x9253c4);}return null;})[_0x23b8('0x21')](function(_0x5a3527){if(_0x5a3527){if(_0x531d06[_0x23b8('0x56')]['manual']){_0x9253c4[_0x23b8('0x26')]['interface']=util[_0x23b8('0x5d')](_0x23b8('0x6e'),_0x531d06[_0x23b8('0x5f')]['name']);_0x9253c4[_0x23b8('0x26')]['channel']=_0x9253c4[_0x23b8('0x6f')];_0x9253c4[_0x23b8('0x26')][_0x23b8('0x70')]=_0x23b8('0x5a');return respondWithRpcPromise(_0x23b8('0x71'),_0x23b8('0x71'),{'event':_0x23b8('0x72'),'message':_0x9253c4[_0x23b8('0x26')]},client9002)[_0x23b8('0x21')](function(){return _0x9253c4;});}return _0x9253c4;}return null;})['then'](respondWithResult(_0x2a7a82,null))[_0x23b8('0x2a')](handleError(_0x2a7a82,null));};var interaction_log=require(_0x23b8('0x13'))(_0x23b8('0x59'));exports['reject']=function(_0x3481f2,_0x405567,_0x56c98c){var _0x3d8e74={'agent':{},'channel':_0x23b8('0x5b')};if(_0x3481f2['body']['id']){delete _0x3481f2[_0x23b8('0x56')]['id'];}_0x3481f2['body']['UserId']=_0x3481f2[_0x23b8('0x56')][_0x23b8('0x5e')]||_0x3481f2[_0x23b8('0x5f')]['id'];_0x3d8e74[_0x23b8('0x73')]['id']=_0x3481f2[_0x23b8('0x56')][_0x23b8('0x5e')];return db[_0x23b8('0x3a')][_0x23b8('0x54')]({'where':{'id':_0x3481f2[_0x23b8('0x51')]['id'],'UserId':null}})[_0x23b8('0x21')](handleEntityNotFound(_0x405567,null))[_0x23b8('0x21')](function(_0x3c581d){if(_0x3c581d){_0x3d8e74['message']=_0x3c581d[_0x23b8('0x62')]({'plain':!![]});return db[_0x23b8('0x63')][_0x23b8('0x54')]({'where':{'id':_0x3c581d[_0x23b8('0x64')]}});}return null;})[_0x23b8('0x21')](handleEntityNotFound(_0x405567,null))[_0x23b8('0x21')](function(_0x1aff27){if(_0x1aff27){_0x3d8e74[_0x23b8('0x6a')]=_0x1aff27[_0x23b8('0x62')]({'plain':!![]});interaction_log['info'](_0x23b8('0x74'),_0x3481f2[_0x23b8('0x5f')]['id'],_0x3481f2[_0x23b8('0x5f')][_0x23b8('0x37')],_0x3481f2[_0x23b8('0x5f')][_0x23b8('0x69')],_0x3d8e74['interaction']['id'],_0x3481f2['body']?JSON[_0x23b8('0x6b')](_0x3481f2[_0x23b8('0x56')]):_0x23b8('0x6c'));return respondWithRpcPromise(_0x23b8('0x75'),_0x23b8('0x76'),_0x3d8e74);}return null;})['then'](function(_0x26afff){if(_0x26afff){_0x26afff[_0x23b8('0x26')][_0x23b8('0x77')]=util[_0x23b8('0x5d')](_0x23b8('0x6e'),_0x3481f2[_0x23b8('0x5f')][_0x23b8('0x37')]);_0x26afff[_0x23b8('0x26')][_0x23b8('0x6f')]=_0x3d8e74[_0x23b8('0x6f')];_0x26afff['message']['event']=_0x23b8('0x34');respondWithRpcPromise('EventManager','EventManager',{'event':_0x23b8('0x78'),'message':_0x26afff[_0x23b8('0x26')]},client9002);return _0x3d8e74;}return null;})[_0x23b8('0x21')](respondWithResult(_0x405567,null))[_0x23b8('0x2a')](handleError(_0x405567,null));};exports[_0x23b8('0x2c')]=function(_0x1c0de4,_0x484a9e,_0x4b1dd2){if(_0x1c0de4[_0x23b8('0x56')]['id']){delete _0x1c0de4[_0x23b8('0x56')]['id'];}var _0x8c3fed;return db[_0x23b8('0x3a')][_0x23b8('0x54')]({'where':{'id':_0x1c0de4[_0x23b8('0x51')]['id']}})[_0x23b8('0x21')](handleEntityNotFound(_0x484a9e,null))[_0x23b8('0x21')](function(_0x14e54d){if(_0x14e54d){_0x8c3fed=_0x14e54d;return db[_0x23b8('0x79')][_0x23b8('0x54')]({'where':{'id':_0x14e54d[_0x23b8('0x7a')]}});}})[_0x23b8('0x21')](handleEntityNotFound(_0x484a9e,null))[_0x23b8('0x21')](function(_0xa01460){if(_0xa01460){logger[_0x23b8('0x7b')](_0x23b8('0x7c'),'status',_0x23b8('0x7d'),_0xa01460[_0x23b8('0x3c')],util['inspect'](_0x1c0de4['body'],{'showHidden':![],'depth':null}));switch(_0xa01460[_0x23b8('0x3c')]){case _0x23b8('0x7e'):if(_0x1c0de4[_0x23b8('0x56')][_0x23b8('0x7f')]&&_0x1c0de4[_0x23b8('0x56')][_0x23b8('0x7f')]===_0x8c3fed[_0x23b8('0x80')]&&_0x1c0de4[_0x23b8('0x56')][_0x23b8('0x81')]&&_0x1c0de4[_0x23b8('0x56')][_0x23b8('0x81')]===_0x23b8('0x82')){return _0x8c3fed['update']({'read':!![]});}else{logger[_0x23b8('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x23b8('0x7e'),util[_0x23b8('0x83')](_0x1c0de4[_0x23b8('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x8c3fed;}})[_0x23b8('0x21')](respondWithResult(_0x484a9e,null))[_0x23b8('0x2a')](handleError(_0x484a9e,null));}; \ No newline at end of file +var _0xf06e=['count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','WhatsappMessage','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','params','rawAttributes','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','WhatsappInteraction','isNil','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','manual','interface','EventManager','reject','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','event','WhatsappAccount','WhatsappAccountId','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.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','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json'];(function(_0x6aab1f,_0x3a240d){var _0x59bd58=function(_0x403982){while(--_0x403982){_0x6aab1f['push'](_0x6aab1f['shift']());}};_0x59bd58(++_0x3a240d);}(_0xf06e,0x1dd));var _0xef06=function(_0x636433,_0xe8220c){_0x636433=_0x636433-0x0;var _0x38ecac=_0xf06e[_0x636433];return _0x38ecac;};'use strict';var pdf=require(_0xef06('0x0'));var emlformat=require(_0xef06('0x1'));var rimraf=require(_0xef06('0x2'));var zipdir=require(_0xef06('0x3'));var jsonpatch=require(_0xef06('0x4'));var rp=require('request-promise');var moment=require(_0xef06('0x5'));var BPromise=require(_0xef06('0x6'));var Mustache=require(_0xef06('0x7'));var util=require(_0xef06('0x8'));var path=require(_0xef06('0x9'));var sox=require(_0xef06('0xa'));var csv=require(_0xef06('0xb'));var ejs=require(_0xef06('0xc'));var fs=require('fs');var _=require(_0xef06('0xd'));var squel=require(_0xef06('0xe'));var crypto=require(_0xef06('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xef06('0x10'));var toCsv=require(_0xef06('0xb'));var querystring=require(_0xef06('0x11'));var Papa=require(_0xef06('0x12'));var Redis=require(_0xef06('0x13'));var authService=require(_0xef06('0x14'));var qs=require(_0xef06('0x15'));var as=require(_0xef06('0x16'));var hardwareService=require(_0xef06('0x17'));var logger=require(_0xef06('0x18'))('api');var utils=require(_0xef06('0x19'));var config=require(_0xef06('0x1a'));var db=require(_0xef06('0x1b'))['db'];config[_0xef06('0x1c')]=_[_0xef06('0x1d')](config[_0xef06('0x1c')],{'host':_0xef06('0x1e'),'port':0x18eb});var socket=require(_0xef06('0x1f'))(new Redis(config['redis']));require(_0xef06('0x20'))['register'](socket);var jayson=require(_0xef06('0x21'));var client=jayson[_0xef06('0x22')][_0xef06('0x23')]({'port':0x232c});var client9002=jayson['client'][_0xef06('0x23')]({'port':0x232a});function checkPasswordPattern(_0x1ee529,_0x4bcade,_0x42f93a){if(_0x42f93a){var _0x15a202=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x15a202[_0xef06('0x24')](_0x4bcade)){return _0x1ee529;}else{throw new db[(_0xef06('0x25'))][(_0xef06('0x26'))](_0xef06('0x27'));}}else{return _0x1ee529;}}function respondWithRpcPromise(_0x4c59b8,_0x1fdac2,_0x7c771f,_0x1d1db0){return new BPromise(function(_0xdfe44a,_0x3c6fff){var _0x1dd3bf=_0x1d1db0||client;return _0x1dd3bf[_0xef06('0x28')](_0x4c59b8,_0x7c771f)[_0xef06('0x29')](function(_0x3e8e){logger['info'](_0xef06('0x2a'),_0x1fdac2,_0xef06('0x2b'));logger[_0xef06('0x2c')](_0xef06('0x2d'),_0x1fdac2,_0xef06('0x2b'),JSON[_0xef06('0x2e')](_0x3e8e));if(_0x3e8e[_0xef06('0x2f')]){if(_0x3e8e['error']['code']===0x1f4){logger[_0xef06('0x2f')]('WhatsappMessage,\x20%s,\x20%s',_0x1fdac2,_0x3e8e[_0xef06('0x2f')][_0xef06('0x30')]);return _0x3c6fff(_0x3e8e['error']['message']);}logger[_0xef06('0x2f')](_0xef06('0x2a'),_0x1fdac2,_0x3e8e[_0xef06('0x2f')][_0xef06('0x30')]);return _0xdfe44a(_0x3e8e[_0xef06('0x2f')][_0xef06('0x30')]);}else{logger['info'](_0xef06('0x2a'),_0x1fdac2,'request\x20sent');_0xdfe44a(_0x3e8e[_0xef06('0x31')][_0xef06('0x30')]);}})[_0xef06('0x32')](function(_0x1b9b96){logger[_0xef06('0x2f')](_0xef06('0x2a'),_0x1fdac2,_0x1b9b96);_0x3c6fff(_0x1b9b96);});});}function respondWithStatusCode(_0x1086f3,_0x5ccb77){_0x5ccb77=_0x5ccb77||0xcc;return function(_0x54af77){if(_0x54af77){return _0x1086f3[_0xef06('0x33')](_0x5ccb77);}return _0x1086f3[_0xef06('0x34')](_0x5ccb77)[_0xef06('0x35')]();};}function respondWithResult(_0x290643,_0x3d5e03){_0x3d5e03=_0x3d5e03||0xc8;return function(_0x5043ea){if(_0x5043ea){return _0x290643[_0xef06('0x34')](_0x3d5e03)[_0xef06('0x36')](_0x5043ea);}};}function respondWithFilteredResult(_0x4eb2ed,_0x2a974f){return function(_0x300b68){if(_0x300b68){var _0x4a4531=_0x300b68[_0xef06('0x37')],_0x478920=_0x2a974f[_0xef06('0x38')],_0xf2b587=_0x2a974f[_0xef06('0x38')]+_0x2a974f[_0xef06('0x39')],_0x1cee92;if(_0xf2b587>=_0x4a4531){_0xf2b587=_0x4a4531;_0x1cee92=0xc8;}else{_0x1cee92=0xce;}_0x4eb2ed['status'](_0x1cee92);return _0x4eb2ed[_0xef06('0x3a')](_0xef06('0x3b'),_0x478920+'-'+_0xf2b587+'/'+_0x4a4531)[_0xef06('0x36')](_0x300b68);}return null;};}function patchUpdates(_0x55cdac){return function(_0x19f149){try{jsonpatch[_0xef06('0x3c')](_0x19f149,_0x55cdac,!![]);}catch(_0x586e1d){return BPromise['reject'](_0x586e1d);}return _0x19f149[_0xef06('0x3d')]();};}function saveUpdates(_0x55e6a3,_0x2b5ecb){return function(_0x473d05){if(_0x473d05){return _0x473d05[_0xef06('0x3e')](_0x55e6a3)['then'](function(_0x4b2517){return _0x4b2517;});}return null;};}function removeEntity(_0x12fb97,_0x580edf){return function(_0x5586b2){if(_0x5586b2){return _0x5586b2[_0xef06('0x3f')]()[_0xef06('0x29')](function(){_0x12fb97[_0xef06('0x34')](0xcc)[_0xef06('0x35')]();});}};}function handleEntityNotFound(_0x1e352d,_0x4ea532){return function(_0x39782d){if(!_0x39782d){_0x1e352d[_0xef06('0x33')](0x194);}return _0x39782d;};}function handleError(_0x3983a8,_0x47bf7f){_0x47bf7f=_0x47bf7f||0x1f4;return function(_0x580f16){logger[_0xef06('0x2f')](_0x580f16[_0xef06('0x40')]);if(_0x580f16[_0xef06('0x41')]){delete _0x580f16['name'];}_0x3983a8[_0xef06('0x34')](_0x47bf7f)[_0xef06('0x42')](_0x580f16);};}exports[_0xef06('0x43')]=function(_0x2e9000,_0x5a0b70){var _0x2a76bb={},_0x4c0644={},_0x5db22f={'count':0x0,'rows':[]};var _0xa5738b=_['map'](db[_0xef06('0x44')]['rawAttributes'],function(_0x48050f){return{'name':_0x48050f[_0xef06('0x45')],'type':_0x48050f[_0xef06('0x46')][_0xef06('0x47')]};});_0x4c0644['model']=_['map'](_0xa5738b,_0xef06('0x41'));_0x4c0644['query']=_[_0xef06('0x48')](_0x2e9000['query']);_0x4c0644[_0xef06('0x49')]=_[_0xef06('0x4a')](_0x4c0644[_0xef06('0x4b')],_0x4c0644[_0xef06('0x4c')]);_0x2a76bb[_0xef06('0x4d')]=_[_0xef06('0x4a')](_0x4c0644[_0xef06('0x4b')],qs[_0xef06('0x4e')](_0x2e9000[_0xef06('0x4c')][_0xef06('0x4e')]));_0x2a76bb[_0xef06('0x4d')]=_0x2a76bb['attributes'][_0xef06('0x4f')]?_0x2a76bb['attributes']:_0x4c0644['model'];if(!_0x2e9000[_0xef06('0x4c')][_0xef06('0x50')]('nolimit')){_0x2a76bb[_0xef06('0x39')]=qs[_0xef06('0x39')](_0x2e9000[_0xef06('0x4c')][_0xef06('0x39')]);_0x2a76bb[_0xef06('0x38')]=qs[_0xef06('0x38')](_0x2e9000[_0xef06('0x4c')][_0xef06('0x38')]);}_0x2a76bb[_0xef06('0x51')]=qs[_0xef06('0x52')](_0x2e9000[_0xef06('0x4c')][_0xef06('0x52')]);_0x2a76bb[_0xef06('0x53')]=qs[_0xef06('0x49')](_[_0xef06('0x54')](_0x2e9000[_0xef06('0x4c')],_0x4c0644[_0xef06('0x49')]),_0xa5738b);if(_0x2e9000[_0xef06('0x4c')][_0xef06('0x55')]){_0x2a76bb['where']=_[_0xef06('0x56')](_0x2a76bb[_0xef06('0x53')],{'$or':_[_0xef06('0x57')](_0xa5738b,function(_0x17476f){if(_0x17476f[_0xef06('0x46')]!==_0xef06('0x58')){var _0x105854={};_0x105854[_0x17476f[_0xef06('0x41')]]={'$like':'%'+_0x2e9000['query'][_0xef06('0x55')]+'%'};return _0x105854;}})});}_0x2a76bb=_[_0xef06('0x56')]({},_0x2a76bb,_0x2e9000[_0xef06('0x59')]);var _0x2382b2={'where':_0x2a76bb[_0xef06('0x53')]};return db[_0xef06('0x44')][_0xef06('0x37')](_0x2382b2)['then'](function(_0xc10bd3){_0x5db22f[_0xef06('0x37')]=_0xc10bd3;if(_0x2e9000[_0xef06('0x4c')][_0xef06('0x5a')]){_0x2a76bb[_0xef06('0x5b')]=[{'all':!![]}];}return db[_0xef06('0x44')]['findAll'](_0x2a76bb);})[_0xef06('0x29')](function(_0x53458e){_0x5db22f['rows']=_0x53458e;return _0x5db22f;})[_0xef06('0x29')](respondWithFilteredResult(_0x5a0b70,_0x2a76bb))['catch'](handleError(_0x5a0b70,null));};exports['show']=function(_0x22aca7,_0x6ad744){var _0x30ad4b={'raw':!![],'where':{'id':_0x22aca7[_0xef06('0x5c')]['id']}},_0x3f8a89={};_0x3f8a89['model']=_[_0xef06('0x48')](db[_0xef06('0x44')][_0xef06('0x5d')]);_0x3f8a89[_0xef06('0x4c')]=_['keys'](_0x22aca7[_0xef06('0x4c')]);_0x3f8a89[_0xef06('0x49')]=_[_0xef06('0x4a')](_0x3f8a89[_0xef06('0x4b')],_0x3f8a89['query']);_0x30ad4b[_0xef06('0x4d')]=_[_0xef06('0x4a')](_0x3f8a89[_0xef06('0x4b')],qs[_0xef06('0x4e')](_0x22aca7[_0xef06('0x4c')][_0xef06('0x4e')]));_0x30ad4b[_0xef06('0x4d')]=_0x30ad4b[_0xef06('0x4d')][_0xef06('0x4f')]?_0x30ad4b[_0xef06('0x4d')]:_0x3f8a89[_0xef06('0x4b')];if(_0x22aca7[_0xef06('0x4c')][_0xef06('0x5a')]){_0x30ad4b[_0xef06('0x5b')]=[{'all':!![]}];}_0x30ad4b=_[_0xef06('0x56')]({},_0x30ad4b,_0x22aca7['options']);return db[_0xef06('0x44')]['find'](_0x30ad4b)[_0xef06('0x29')](handleEntityNotFound(_0x6ad744,null))[_0xef06('0x29')](respondWithResult(_0x6ad744,null))[_0xef06('0x32')](handleError(_0x6ad744,null));};exports['create']=function(_0x2b0aa4,_0x4fdaf5){return db[_0xef06('0x44')][_0xef06('0x5e')](_0x2b0aa4['body'],{})['then'](respondWithResult(_0x4fdaf5,0xc9))[_0xef06('0x32')](handleError(_0x4fdaf5,null));};exports[_0xef06('0x3e')]=function(_0x27766c,_0x21ffbb){if(_0x27766c[_0xef06('0x5f')]['id']){delete _0x27766c['body']['id'];}return db['WhatsappMessage'][_0xef06('0x60')]({'where':{'id':_0x27766c[_0xef06('0x5c')]['id']}})[_0xef06('0x29')](handleEntityNotFound(_0x21ffbb,null))['then'](saveUpdates(_0x27766c[_0xef06('0x5f')],null))['then'](respondWithResult(_0x21ffbb,null))[_0xef06('0x32')](handleError(_0x21ffbb,null));};exports[_0xef06('0x3f')]=function(_0x3f1311,_0x4d71d0){return db[_0xef06('0x44')][_0xef06('0x60')]({'where':{'id':_0x3f1311[_0xef06('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4d71d0,null))['then'](removeEntity(_0x4d71d0,null))[_0xef06('0x32')](handleError(_0x4d71d0,null));};exports['describe']=function(_0x3408ff,_0x433978){return db[_0xef06('0x44')][_0xef06('0x61')]()[_0xef06('0x29')](respondWithResult(_0x433978,null))[_0xef06('0x32')](handleError(_0x433978,null));};var interaction_log=require('../../config/logger')(_0xef06('0x62'));exports[_0xef06('0x63')]=function(_0x9392db,_0xdcf03b,_0x10b4e5){var _0x3130ce={'channel':_0xef06('0x64')};if(_0x9392db['body']['id']){delete _0x9392db[_0xef06('0x5f')]['id'];}_0x9392db[_0xef06('0x5f')][_0xef06('0x65')]=!![];_0x9392db['body'][_0xef06('0x66')]=moment()[_0xef06('0x67')](_0xef06('0x68'));_0x9392db[_0xef06('0x5f')][_0xef06('0x69')]=_0x9392db['body'][_0xef06('0x69')]||_0x9392db[_0xef06('0x6a')]['id'];return db[_0xef06('0x44')]['find']({'where':{'id':_0x9392db[_0xef06('0x5c')]['id'],'UserId':null},'include':[{'model':db[_0xef06('0x6b')],'as':'Contact'}]})[_0xef06('0x29')](handleEntityNotFound(_0xdcf03b,null))[_0xef06('0x29')](saveUpdates(_0x9392db['body'],null))[_0xef06('0x29')](function(_0x2c6b71){if(_0x2c6b71){_0x3130ce['message']=_0x2c6b71[_0xef06('0x6c')]({'plain':!![]});return db[_0xef06('0x6d')][_0xef06('0x60')]({'where':{'id':_0x2c6b71['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xdcf03b,null))[_0xef06('0x29')](function(_0x3a56d){if(_0x3a56d){return _0x3a56d[_0xef06('0x3e')]({'UserId':_0x9392db[_0xef06('0x5f')]['UserId'],'read1stAt':_[_0xef06('0x6e')](_0x3a56d['read1stAt'])?moment()[_0xef06('0x67')](_0xef06('0x68')):undefined});}return null;})[_0xef06('0x29')](function(_0x939d2c){if(_0x939d2c){_0x3130ce['interaction']=_0x939d2c[_0xef06('0x6c')]({'plain':!![]});interaction_log[_0xef06('0x6f')](_0xef06('0x70'),_0x9392db[_0xef06('0x6a')]['id'],_0x9392db[_0xef06('0x6a')][_0xef06('0x41')],_0x9392db[_0xef06('0x6a')][_0xef06('0x71')],_0x3130ce[_0xef06('0x72')]['id'],_0x9392db[_0xef06('0x5f')]?JSON[_0xef06('0x2e')](_0x9392db[_0xef06('0x5f')]):'null');return respondWithRpcPromise('AcceptMessage',_0xef06('0x73'),_0x3130ce);}return null;})[_0xef06('0x29')](function(_0x4ec989){if(_0x4ec989){if(_0x9392db[_0xef06('0x5f')][_0xef06('0x74')]){_0x3130ce[_0xef06('0x30')][_0xef06('0x75')]=util[_0xef06('0x67')]('SIP/%s',_0x9392db[_0xef06('0x6a')][_0xef06('0x41')]);_0x3130ce['message']['channel']=_0x3130ce['channel'];_0x3130ce['message']['event']='accept';return respondWithRpcPromise(_0xef06('0x76'),'EventManager',{'event':'acceptmessage','message':_0x3130ce[_0xef06('0x30')]},client9002)['then'](function(){return _0x3130ce;});}return _0x3130ce;}return null;})[_0xef06('0x29')](respondWithResult(_0xdcf03b,null))[_0xef06('0x32')](handleError(_0xdcf03b,null));};var interaction_log=require('../../config/logger')(_0xef06('0x62'));exports[_0xef06('0x77')]=function(_0x41f935,_0x54e399,_0x8ce59c){var _0x2b8403={'agent':{},'channel':'whatsapp'};if(_0x41f935['body']['id']){delete _0x41f935[_0xef06('0x5f')]['id'];}_0x41f935[_0xef06('0x5f')][_0xef06('0x69')]=_0x41f935[_0xef06('0x5f')]['UserId']||_0x41f935[_0xef06('0x6a')]['id'];_0x2b8403[_0xef06('0x78')]['id']=_0x41f935['body']['UserId'];return db[_0xef06('0x44')][_0xef06('0x60')]({'where':{'id':_0x41f935[_0xef06('0x5c')]['id'],'UserId':null}})[_0xef06('0x29')](handleEntityNotFound(_0x54e399,null))[_0xef06('0x29')](function(_0x2d02dd){if(_0x2d02dd){_0x2b8403[_0xef06('0x30')]=_0x2d02dd[_0xef06('0x6c')]({'plain':!![]});return db['WhatsappInteraction'][_0xef06('0x60')]({'where':{'id':_0x2d02dd['WhatsappInteractionId']}});}return null;})[_0xef06('0x29')](handleEntityNotFound(_0x54e399,null))['then'](function(_0x1b24ec){if(_0x1b24ec){_0x2b8403['interaction']=_0x1b24ec[_0xef06('0x6c')]({'plain':!![]});interaction_log['info'](_0xef06('0x79'),_0x41f935[_0xef06('0x6a')]['id'],_0x41f935[_0xef06('0x6a')]['name'],_0x41f935[_0xef06('0x6a')][_0xef06('0x71')],_0x2b8403[_0xef06('0x72')]['id'],_0x41f935['body']?JSON['stringify'](_0x41f935[_0xef06('0x5f')]):_0xef06('0x7a'));return respondWithRpcPromise(_0xef06('0x7b'),_0xef06('0x7c'),_0x2b8403);}return null;})[_0xef06('0x29')](function(_0x26074c){if(_0x26074c){_0x26074c[_0xef06('0x30')][_0xef06('0x75')]=util['format']('SIP/%s',_0x41f935[_0xef06('0x6a')][_0xef06('0x41')]);_0x26074c[_0xef06('0x30')]['channel']=_0x2b8403['channel'];_0x26074c[_0xef06('0x30')][_0xef06('0x7d')]='reject';respondWithRpcPromise('EventManager',_0xef06('0x76'),{'event':'rejectmessage','message':_0x26074c[_0xef06('0x30')]},client9002);return _0x2b8403;}return null;})[_0xef06('0x29')](respondWithResult(_0x54e399,null))['catch'](handleError(_0x54e399,null));};exports[_0xef06('0x34')]=function(_0x2f1915,_0x563b32,_0x3f8ea1){if(_0x2f1915[_0xef06('0x5f')]['id']){delete _0x2f1915[_0xef06('0x5f')]['id'];}var _0x50f045;return db[_0xef06('0x44')][_0xef06('0x60')]({'where':{'id':_0x2f1915[_0xef06('0x5c')]['id']}})['then'](handleEntityNotFound(_0x563b32,null))[_0xef06('0x29')](function(_0x52d91b){if(_0x52d91b){_0x50f045=_0x52d91b;return db[_0xef06('0x7e')]['find']({'where':{'id':_0x52d91b[_0xef06('0x7f')]}});}})[_0xef06('0x29')](handleEntityNotFound(_0x563b32,null))[_0xef06('0x29')](function(_0x3cc2f3){if(_0x3cc2f3){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x3cc2f3[_0xef06('0x46')],util[_0xef06('0x80')](_0x2f1915['body'],{'showHidden':![],'depth':null}));switch(_0x3cc2f3[_0xef06('0x46')]){case _0xef06('0x81'):if(_0x2f1915[_0xef06('0x5f')][_0xef06('0x82')]&&_0x2f1915['body'][_0xef06('0x82')]===_0x50f045['messageId']&&_0x2f1915[_0xef06('0x5f')][_0xef06('0x83')]&&_0x2f1915[_0xef06('0x5f')]['MessageStatus']==='read'){return _0x50f045[_0xef06('0x3e')]({'read':!![]});}else{logger['error'](_0xef06('0x84'),_0xef06('0x34'),_0xef06('0x81'),util[_0xef06('0x80')](_0x2f1915['body'],{'showHidden':![],'depth':null}));}break;}return _0x50f045;}})[_0xef06('0x29')](respondWithResult(_0x563b32,null))[_0xef06('0x32')](handleError(_0x563b32,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 2f3ff07..e4bbfb1 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x114202,_0x3cbc47){var _0x7625b0=function(_0x29c543){while(--_0x29c543){_0x114202['push'](_0x114202['shift']());}};_0x7625b0(++_0x3cbc47);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0xb10b[_0x1ee62e];return _0x27c6c8;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x4ca8be,_0x89738b){var _0x250f08=function(_0x39fb79){while(--_0x39fb79){_0x4ca8be['push'](_0x4ca8be['shift']());}};_0x250f08(++_0x89738b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1f9f03,_0x56d035){_0x1f9f03=_0x1f9f03-0x0;var _0x3c7c89=_0x5f2f[_0x1f9f03];return _0x3c7c89;};'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 ac28d72..f7dfc7e 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 _0xadf8=['WhatsappInteractionId','update','createdAt','catch','error','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','body','whatsapp:','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','messageId','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xadf8,0x145));var _0x8adf=function(_0x221637,_0x42a5e0){_0x221637=_0x221637-0x0;var _0x11bf9e=_0xadf8[_0x221637];return _0x11bf9e;};'use strict';var _=require(_0x8adf('0x0'));var util=require(_0x8adf('0x1'));var logger=require('../../config/logger')(_0x8adf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8adf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8adf('0x4'));var config=require(_0x8adf('0x5'));var attributes=require(_0x8adf('0x6'));module['exports']=function(_0x11c457,_0x33d60e){return _0x11c457[_0x8adf('0x7')](_0x8adf('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8adf('0x9')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x345e5c,_0x177f8d,_0x424e8c){var _0x3151ce=_0x11c457[_0x8adf('0xa')];var _0x285828=_0x345e5c[_0x8adf('0xb')]({'plain':!![]});if(_0x285828[_0x8adf('0xc')][_0x8adf('0xd')]()==='in'||_0x285828[_0x8adf('0xc')][_0x8adf('0xd')]()===_0x8adf('0xe')&&!_0x285828[_0x8adf('0xf')]&&!_['isNil'](_0x285828[_0x8adf('0x10')])){_0x3151ce[_0x8adf('0x11')][_0x8adf('0x12')]({'where':{'id':_0x285828[_0x8adf('0x13')]}})['then'](function(_0x316148){if(_0x316148){_0x316148[_0x8adf('0x14')]({'lastMsgAt':_0x285828[_0x8adf('0x15')],'lastMsgDirection':_0x285828['direction'][_0x8adf('0xd')]()});}})[_0x8adf('0x16')](function(_0x550818){console[_0x8adf('0x17')](_0x550818);});}if(_0x285828[_0x8adf('0xc')]===_0x8adf('0xe')&&!_0x285828[_0x8adf('0xf')]){var _0x313e41;_0x3151ce['WhatsappAccount'][_0x8adf('0x18')]({'where':{'id':_0x285828[_0x8adf('0x19')]},'raw':!![]})[_0x8adf('0x1a')](function(_0x13a1bc){_0x313e41=_0x13a1bc;if(_0x313e41&&_0x313e41['type']){switch(_0x313e41[_0x8adf('0x1b')]){case _0x8adf('0x1c'):var _0x2e0af4=require('twilio');if(_0x313e41[_0x8adf('0x1d')]&&_0x313e41[_0x8adf('0x1e')]&&_0x313e41[_0x8adf('0x1f')]){var _0x41a95c=new _0x2e0af4(_0x313e41[_0x8adf('0x1d')],_0x313e41[_0x8adf('0x1e')]);_0x41a95c['messages']['create']({'body':_0x285828[_0x8adf('0x20')],'to':'whatsapp:'+_0x285828[_0x8adf('0x1f')],'from':_0x8adf('0x21')+_0x313e41[_0x8adf('0x1f')],'statusCallback':_0x313e41['remote']+_0x8adf('0x22')+_0x285828['id']+'/status?token='+_0x313e41[_0x8adf('0x23')]})[_0x8adf('0x1a')](function(_0x518ce3){if(_0x518ce3[_0x8adf('0x24')]){return _0x345e5c[_0x8adf('0x14')]({'messageId':_0x518ce3[_0x8adf('0x24')]});}})[_0x8adf('0x16')](function(_0x538f03){logger['error'](_0x8adf('0x25'),_0x8adf('0x26'),_0x8adf('0x1c'),util['inspect'](_0x538f03,{'showHidden':![],'depth':null}));});}else{logger[_0x8adf('0x17')](_0x8adf('0x25'),'afterCreate','twilio',_0x8adf('0x27'));}break;}}})[_0x8adf('0x28')](function(){_0x424e8c();});}else{_0x424e8c();}}},'charset':_0x8adf('0x29'),'collate':_0x8adf('0x2a')});}; \ No newline at end of file +var _0x0482=['whatsapp_messages','messageId','fti_whatsapp_messages','body','models','direction','toLowerCase','out','secret','findOne','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','update','error','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','finally','utf8mb4','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','WhatsappMessage'];(function(_0x12a890,_0x4f3cb5){var _0x1a79ef=function(_0x5723f4){while(--_0x5723f4){_0x12a890['push'](_0x12a890['shift']());}};_0x1a79ef(++_0x4f3cb5);}(_0x0482,0x183));var _0x2048=function(_0x35e124,_0x1d85e2){_0x35e124=_0x35e124-0x0;var _0x53c482=_0x0482[_0x35e124];return _0x53c482;};'use strict';var _=require('lodash');var util=require(_0x2048('0x0'));var logger=require('../../config/logger')(_0x2048('0x1'));var moment=require(_0x2048('0x2'));var BPromise=require(_0x2048('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2048('0x4'));var rimraf=require(_0x2048('0x5'));var config=require(_0x2048('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0x2048('0x7')]=function(_0x14a8a2,_0x567405){return _0x14a8a2['define'](_0x2048('0x8'),attributes,{'tableName':_0x2048('0x9'),'paranoid':![],'indexes':[{'name':_0x2048('0xa'),'fields':[_0x2048('0xa')]},{'name':_0x2048('0xb'),'fields':[_0x2048('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x426a21,_0xca4aa7,_0x1623b9){var _0x453d52=_0x14a8a2[_0x2048('0xd')];var _0x38ddf5=_0x426a21['get']({'plain':!![]});if(_0x38ddf5[_0x2048('0xe')]['toLowerCase']()==='in'||_0x38ddf5[_0x2048('0xe')][_0x2048('0xf')]()===_0x2048('0x10')&&!_0x38ddf5[_0x2048('0x11')]&&!_['isNil'](_0x38ddf5['UserId'])){_0x453d52['WhatsappInteraction'][_0x2048('0x12')]({'where':{'id':_0x38ddf5['WhatsappInteractionId']}})['then'](function(_0x4c64fe){if(_0x4c64fe){_0x4c64fe['update']({'lastMsgAt':_0x38ddf5[_0x2048('0x13')],'lastMsgDirection':_0x38ddf5[_0x2048('0xe')][_0x2048('0xf')]()});}})[_0x2048('0x14')](function(_0x3574b1){console['error'](_0x3574b1);});}if(_0x38ddf5['direction']===_0x2048('0x10')&&!_0x38ddf5[_0x2048('0x11')]){var _0x515471;_0x453d52[_0x2048('0x15')][_0x2048('0x16')]({'where':{'id':_0x38ddf5[_0x2048('0x17')]},'raw':!![]})[_0x2048('0x18')](function(_0x41afd6){_0x515471=_0x41afd6;if(_0x515471&&_0x515471[_0x2048('0x19')]){switch(_0x515471[_0x2048('0x19')]){case _0x2048('0x1a'):var _0x6feea2=require('twilio');if(_0x515471[_0x2048('0x1b')]&&_0x515471[_0x2048('0x1c')]&&_0x515471['phone']){var _0x261e5e=new _0x6feea2(_0x515471[_0x2048('0x1b')],_0x515471['authToken']);_0x261e5e[_0x2048('0x1d')][_0x2048('0x1e')]({'body':_0x38ddf5[_0x2048('0xc')],'to':_0x2048('0x1f')+_0x38ddf5[_0x2048('0x20')],'from':_0x2048('0x1f')+_0x515471['phone'],'statusCallback':_0x515471[_0x2048('0x21')]+_0x2048('0x22')+_0x38ddf5['id']+_0x2048('0x23')+_0x515471['token']})['then'](function(_0x74f9fb){if(_0x74f9fb[_0x2048('0x24')]){return _0x426a21[_0x2048('0x25')]({'messageId':_0x74f9fb[_0x2048('0x24')]});}})[_0x2048('0x14')](function(_0x3489d1){logger[_0x2048('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2048('0x27'),_0x2048('0x1a'),util[_0x2048('0x28')](_0x3489d1,{'showHidden':![],'depth':null}));});}else{logger[_0x2048('0x26')](_0x2048('0x29'),_0x2048('0x27'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x2048('0x2a')](function(){_0x1623b9();});}else{_0x1623b9();}}},'charset':_0x2048('0x2b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index d99cfa6..c231f3c 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 _0xf3a6=['localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','request\x20sent','debug','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','CreateWhatsappMessage','create','body','options','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','redis','defaults'];(function(_0x3d8c4d,_0x5030ef){var _0x2aff72=function(_0x59a706){while(--_0x59a706){_0x3d8c4d['push'](_0x3d8c4d['shift']());}};_0x2aff72(++_0x5030ef);}(_0xf3a6,0x135));var _0x6f3a=function(_0x7fd9e9,_0x1765d0){_0x7fd9e9=_0x7fd9e9-0x0;var _0x285d92=_0xf3a6[_0x7fd9e9];return _0x285d92;};'use strict';var _=require('lodash');var util=require(_0x6f3a('0x0'));var moment=require(_0x6f3a('0x1'));var BPromise=require(_0x6f3a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f3a('0x3'));var db=require(_0x6f3a('0x4'))['db'];var utils=require(_0x6f3a('0x5'));var logger=require('../../config/logger')(_0x6f3a('0x6'));var config=require('../../config/environment');var jayson=require(_0x6f3a('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x6f3a('0x8')]=_[_0x6f3a('0x9')](config[_0x6f3a('0x8')],{'host':_0x6f3a('0xa'),'port':0x18eb});var socket=require(_0x6f3a('0xb'))(new Redis(config['redis']));require(_0x6f3a('0xc'))[_0x6f3a('0xd')](socket);function respondWithRpcPromise(_0x575d40,_0x4f0ef6,_0x26c1f4){return new BPromise(function(_0x48ebc3,_0x46cca0){return client[_0x6f3a('0xe')](_0x575d40,_0x26c1f4)['then'](function(_0x267f99){logger[_0x6f3a('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x4f0ef6,_0x6f3a('0x10'));logger[_0x6f3a('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4f0ef6,_0x6f3a('0x10'),JSON[_0x6f3a('0x12')](_0x267f99));if(_0x267f99['error']){if(_0x267f99[_0x6f3a('0x13')][_0x6f3a('0x14')]===0x1f4){logger[_0x6f3a('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x4f0ef6,_0x267f99[_0x6f3a('0x13')][_0x6f3a('0x15')]);return _0x46cca0(_0x267f99['error'][_0x6f3a('0x15')]);}logger['error'](_0x6f3a('0x16'),_0x4f0ef6,_0x267f99['error'][_0x6f3a('0x15')]);return _0x48ebc3(_0x267f99['error'][_0x6f3a('0x15')]);}else{logger[_0x6f3a('0xf')](_0x6f3a('0x16'),_0x4f0ef6,_0x6f3a('0x10'));_0x48ebc3(_0x267f99[_0x6f3a('0x17')][_0x6f3a('0x15')]);}})['catch'](function(_0x5116ef){logger[_0x6f3a('0x13')](_0x6f3a('0x16'),_0x4f0ef6,_0x5116ef);_0x46cca0(_0x5116ef);});});}exports[_0x6f3a('0x18')]=function(_0x5b149e){var _0x1562a8=this;return new Promise(function(_0x17690b,_0x2fe717){return db['WhatsappMessage'][_0x6f3a('0x19')](_0x5b149e[_0x6f3a('0x1a')],{'raw':_0x5b149e[_0x6f3a('0x1b')]?_0x5b149e[_0x6f3a('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x6f3a('0x1c')](function(_0x68f30){logger[_0x6f3a('0xf')](_0x6f3a('0x18'),_0x5b149e);logger[_0x6f3a('0x11')](_0x6f3a('0x18'),_0x5b149e,JSON['stringify'](_0x68f30));_0x17690b(_0x68f30);})['catch'](function(_0x1de324){logger['error'](_0x6f3a('0x18'),_0x1de324[_0x6f3a('0x15')],_0x5b149e);_0x2fe717(_0x1562a8[_0x6f3a('0x13')](0x1f4,_0x1de324[_0x6f3a('0x15')]));});});}; \ No newline at end of file +var _0xc55d=['CreateWhatsappMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./whatsappMessage.socket','request','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','WhatsappMessage','create','body','options','raw','then'];(function(_0x44b4ee,_0x444cd9){var _0x5298e2=function(_0x534451){while(--_0x534451){_0x44b4ee['push'](_0x44b4ee['shift']());}};_0x5298e2(++_0x444cd9);}(_0xc55d,0xab));var _0xdc55=function(_0x192f6e,_0x519fd4){_0x192f6e=_0x192f6e-0x0;var _0x3f5b1b=_0xc55d[_0x192f6e];return _0x3f5b1b;};'use strict';var _=require(_0xdc55('0x0'));var util=require(_0xdc55('0x1'));var moment=require('moment');var BPromise=require(_0xdc55('0x2'));var rs=require(_0xdc55('0x3'));var fs=require('fs');var Redis=require(_0xdc55('0x4'));var db=require(_0xdc55('0x5'))['db'];var utils=require(_0xdc55('0x6'));var logger=require(_0xdc55('0x7'))(_0xdc55('0x8'));var config=require(_0xdc55('0x9'));var jayson=require(_0xdc55('0xa'));var client=jayson[_0xdc55('0xb')]['http']({'port':0x232a});config[_0xdc55('0xc')]=_['defaults'](config[_0xdc55('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc55('0xd'))(new Redis(config['redis']));require(_0xdc55('0xe'))['register'](socket);function respondWithRpcPromise(_0x1f3c9f,_0x456faf,_0x38a20f){return new BPromise(function(_0x42b7ea,_0x59595a){return client[_0xdc55('0xf')](_0x1f3c9f,_0x38a20f)['then'](function(_0x487ad0){logger[_0xdc55('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x456faf,'request\x20sent');logger[_0xdc55('0x11')](_0xdc55('0x12'),_0x456faf,_0xdc55('0x13'),JSON[_0xdc55('0x14')](_0x487ad0));if(_0x487ad0[_0xdc55('0x15')]){if(_0x487ad0[_0xdc55('0x15')][_0xdc55('0x16')]===0x1f4){logger[_0xdc55('0x15')](_0xdc55('0x17'),_0x456faf,_0x487ad0[_0xdc55('0x15')][_0xdc55('0x18')]);return _0x59595a(_0x487ad0[_0xdc55('0x15')][_0xdc55('0x18')]);}logger[_0xdc55('0x15')](_0xdc55('0x17'),_0x456faf,_0x487ad0[_0xdc55('0x15')][_0xdc55('0x18')]);return _0x42b7ea(_0x487ad0['error'][_0xdc55('0x18')]);}else{logger['info'](_0xdc55('0x17'),_0x456faf,_0xdc55('0x13'));_0x42b7ea(_0x487ad0[_0xdc55('0x19')]['message']);}})[_0xdc55('0x1a')](function(_0x50a6c9){logger[_0xdc55('0x15')](_0xdc55('0x17'),_0x456faf,_0x50a6c9);_0x59595a(_0x50a6c9);});});}exports['CreateWhatsappMessage']=function(_0x222f70){var _0x402cd0=this;return new Promise(function(_0x5efc89,_0x1e728c){return db[_0xdc55('0x1b')][_0xdc55('0x1c')](_0x222f70[_0xdc55('0x1d')],{'raw':_0x222f70['options']?_0x222f70[_0xdc55('0x1e')][_0xdc55('0x1f')]===undefined?!![]:![]:!![]})[_0xdc55('0x20')](function(_0x5e407c){logger[_0xdc55('0x10')](_0xdc55('0x21'),_0x222f70);logger[_0xdc55('0x11')](_0xdc55('0x21'),_0x222f70,JSON[_0xdc55('0x14')](_0x5e407c));_0x5efc89(_0x5e407c);})[_0xdc55('0x1a')](function(_0xf374f7){logger[_0xdc55('0x15')](_0xdc55('0x21'),_0xf374f7[_0xdc55('0x18')],_0x222f70);_0x1e728c(_0x402cd0[_0xdc55('0x15')](0x1f4,_0xf374f7[_0xdc55('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 01f5c21..251f169 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 _0x2383=['register','length','whatsappMessage:','./whatsappMessage.events','save','update','emit'];(function(_0x30befa,_0x417343){var _0x1db9d8=function(_0x50d0b8){while(--_0x50d0b8){_0x30befa['push'](_0x30befa['shift']());}};_0x1db9d8(++_0x417343);}(_0x2383,0xb2));var _0x3238=function(_0x518cac,_0x233c7e){_0x518cac=_0x518cac-0x0;var _0x17c7c2=_0x2383[_0x518cac];return _0x17c7c2;};'use strict';var WhatsappMessageEvents=require(_0x3238('0x0'));var events=[_0x3238('0x1'),'remove',_0x3238('0x2')];function createListener(_0x22d5b3,_0x314bac){return function(_0x199921){_0x314bac[_0x3238('0x3')](_0x22d5b3,_0x199921);};}function removeListener(_0x4bca38,_0x493657){return function(){WhatsappMessageEvents['removeListener'](_0x4bca38,_0x493657);};}exports[_0x3238('0x4')]=function(_0x4093e4){for(var _0x507e61=0x0,_0x18f178=events[_0x3238('0x5')];_0x507e61<_0x18f178;_0x507e61++){var _0x9e3868=events[_0x507e61];var _0x30987b=createListener(_0x3238('0x6')+_0x9e3868,_0x4093e4);WhatsappMessageEvents['on'](_0x9e3868,_0x30987b);}}; \ No newline at end of file +var _0x3e30=['removeListener','register','whatsappMessage:','save','remove','emit'];(function(_0x4e6452,_0x18ec40){var _0x149c26=function(_0x570558){while(--_0x570558){_0x4e6452['push'](_0x4e6452['shift']());}};_0x149c26(++_0x18ec40);}(_0x3e30,0x1cb));var _0x03e3=function(_0x1dda39,_0x221826){_0x1dda39=_0x1dda39-0x0;var _0x269408=_0x3e30[_0x1dda39];return _0x269408;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x03e3('0x0'),_0x03e3('0x1'),'update'];function createListener(_0x39a8e1,_0x227e8f){return function(_0x237082){_0x227e8f[_0x03e3('0x2')](_0x39a8e1,_0x237082);};}function removeListener(_0x118aef,_0x398433){return function(){WhatsappMessageEvents[_0x03e3('0x3')](_0x118aef,_0x398433);};}exports[_0x03e3('0x4')]=function(_0x3ea6ce){for(var _0x4f7ace=0x0,_0x2e653a=events['length'];_0x4f7ace<_0x2e653a;_0x4f7ace++){var _0x111f2a=events[_0x4f7ace];var _0x87bad1=createListener(_0x03e3('0x5')+_0x111f2a,_0x3ea6ce);WhatsappMessageEvents['on'](_0x111f2a,_0x87bad1);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index ca64a4f..1185867 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 _0xfe43=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x20f72c,_0x159470){var _0x1f0462=function(_0x1e2933){while(--_0x1e2933){_0x20f72c['push'](_0x20f72c['shift']());}};_0x1f0462(++_0x159470);}(_0xfe43,0x173));var _0x3fe4=function(_0x2371d0,_0x286b09){_0x2371d0=_0x2371d0-0x0;var _0x5f3a71=_0xfe43[_0x2371d0];return _0x5f3a71;};'use strict';var multer=require(_0x3fe4('0x0'));var util=require(_0x3fe4('0x1'));var path=require('path');var timeout=require(_0x3fe4('0x2'));var express=require(_0x3fe4('0x3'));var router=express[_0x3fe4('0x4')]();var auth=require(_0x3fe4('0x5'));var interaction=require(_0x3fe4('0x6'));var config=require(_0x3fe4('0x7'));var controller=require('./whatsappQueue.controller');router[_0x3fe4('0x8')]('/',auth[_0x3fe4('0x9')](),controller[_0x3fe4('0xa')]);router['get']('/describe',auth[_0x3fe4('0x9')](),controller[_0x3fe4('0xb')]);router[_0x3fe4('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth[_0x3fe4('0x9')](),controller[_0x3fe4('0xc')]);router['get'](_0x3fe4('0xd'),auth[_0x3fe4('0x9')](),controller[_0x3fe4('0xe')]);router[_0x3fe4('0x8')](_0x3fe4('0xf'),auth[_0x3fe4('0x9')](),controller[_0x3fe4('0x10')]);router[_0x3fe4('0x11')]('/',auth[_0x3fe4('0x9')](),controller[_0x3fe4('0x12')]);router[_0x3fe4('0x11')](_0x3fe4('0xd'),auth[_0x3fe4('0x9')](),controller[_0x3fe4('0x13')]);router[_0x3fe4('0x11')](_0x3fe4('0xf'),auth[_0x3fe4('0x9')](),controller[_0x3fe4('0x14')]);router[_0x3fe4('0x15')](_0x3fe4('0x16'),auth[_0x3fe4('0x9')](),controller[_0x3fe4('0x17')]);router[_0x3fe4('0x18')](_0x3fe4('0x16'),auth[_0x3fe4('0x9')](),controller[_0x3fe4('0x19')]);router[_0x3fe4('0x18')](_0x3fe4('0xd'),auth['isAuthenticated'](),controller[_0x3fe4('0x1a')]);router[_0x3fe4('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x3fe4('0x1b')]);module[_0x3fe4('0x1c')]=router; \ No newline at end of file +var _0x943c=['show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','/:id','destroy','removeTeams','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x460e2a,_0x522ed0){var _0x5d847c=function(_0x2af995){while(--_0x2af995){_0x460e2a['push'](_0x460e2a['shift']());}};_0x5d847c(++_0x522ed0);}(_0x943c,0xcc));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc943('0x0'));var util=require('util');var path=require(_0xc943('0x1'));var timeout=require(_0xc943('0x2'));var express=require(_0xc943('0x3'));var router=express['Router']();var auth=require(_0xc943('0x4'));var interaction=require(_0xc943('0x5'));var config=require(_0xc943('0x6'));var controller=require(_0xc943('0x7'));router['get']('/',auth[_0xc943('0x8')](),controller[_0xc943('0x9')]);router[_0xc943('0xa')](_0xc943('0xb'),auth[_0xc943('0x8')](),controller[_0xc943('0xc')]);router[_0xc943('0xa')]('/:id',auth[_0xc943('0x8')](),controller[_0xc943('0xd')]);router[_0xc943('0xa')](_0xc943('0xe'),auth[_0xc943('0x8')](),controller[_0xc943('0xf')]);router['get']('/:id/teams',auth[_0xc943('0x8')](),controller[_0xc943('0x10')]);router[_0xc943('0xa')](_0xc943('0x11'),auth[_0xc943('0x8')](),controller[_0xc943('0x12')]);router[_0xc943('0x13')]('/',auth[_0xc943('0x8')](),controller[_0xc943('0x14')]);router[_0xc943('0x13')](_0xc943('0x15'),auth[_0xc943('0x8')](),controller[_0xc943('0x16')]);router[_0xc943('0x13')](_0xc943('0x11'),auth[_0xc943('0x8')](),controller[_0xc943('0x17')]);router[_0xc943('0x18')]('/:id',auth[_0xc943('0x8')](),controller[_0xc943('0x19')]);router[_0xc943('0x1a')](_0xc943('0x1b'),auth[_0xc943('0x8')](),controller[_0xc943('0x1c')]);router[_0xc943('0x1a')]('/:id/teams',auth[_0xc943('0x8')](),controller[_0xc943('0x1d')]);router[_0xc943('0x1a')](_0xc943('0x11'),auth[_0xc943('0x8')](),controller['removeAgents']);module[_0xc943('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 a4a4bb5..494a6fd 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 _0x77fe=['exports','STRING','name','beepall','roundrobin','sequelize'];(function(_0x2bd754,_0x477b49){var _0x24f693=function(_0xea78d2){while(--_0xea78d2){_0x2bd754['push'](_0x2bd754['shift']());}};_0x24f693(++_0x477b49);}(_0x77fe,0x9b));var _0xe77f=function(_0x4021e7,_0x11ce1a){_0x4021e7=_0x4021e7-0x0;var _0xf5e37=_0x77fe[_0x4021e7];return _0xf5e37;};'use strict';var Sequelize=require(_0xe77f('0x0'));module[_0xe77f('0x1')]={'name':{'type':Sequelize[_0xe77f('0x2')],'unique':_0xe77f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xe77f('0x4'),_0xe77f('0x5'))},'description':{'type':Sequelize[_0xe77f('0x2')]}}; \ No newline at end of file +var _0xba5b=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING','exports'];(function(_0x910736,_0x1cfad2){var _0x7218ff=function(_0x2b71b0){while(--_0x2b71b0){_0x910736['push'](_0x910736['shift']());}};_0x7218ff(++_0x1cfad2);}(_0xba5b,0x1cf));var _0xbba5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xba5b[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0xbba5('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xbba5('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xbba5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbba5('0x3')](_0xbba5('0x4'),_0xbba5('0x5'),_0xbba5('0x6'))},'description':{'type':Sequelize[_0xbba5('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 693775e..e339009 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 _0x4be7=['rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','status','end','json','count','offset','Content-Range','reject','save','then','destroy','get','UserProfileResource','stack','name','index','map','WhatsappQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','show','params','length','includeAll','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','WhatsappQueueId','UserWhatsappQueue','findAll','User','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','html-pdf','eml-format'];(function(_0x2426a9,_0xd7870e){var _0x504ae7=function(_0x22c3f){while(--_0x22c3f){_0x2426a9['push'](_0x2426a9['shift']());}};_0x504ae7(++_0xd7870e);}(_0x4be7,0x114));var _0x74be=function(_0x5712cc,_0x5db7dd){_0x5712cc=_0x5712cc-0x0;var _0x15561a=_0x4be7[_0x5712cc];return _0x15561a;};'use strict';var pdf=require(_0x74be('0x0'));var emlformat=require(_0x74be('0x1'));var rimraf=require(_0x74be('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74be('0x3'));var rp=require(_0x74be('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x74be('0x5'));var util=require(_0x74be('0x6'));var path=require(_0x74be('0x7'));var sox=require(_0x74be('0x8'));var csv=require(_0x74be('0x9'));var ejs=require(_0x74be('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x74be('0xb'));var crypto=require(_0x74be('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x74be('0x9'));var querystring=require(_0x74be('0xd'));var Papa=require(_0x74be('0xe'));var Redis=require(_0x74be('0xf'));var authService=require(_0x74be('0x10'));var qs=require(_0x74be('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x74be('0x12'))(_0x74be('0x13'));var utils=require('../../config/utils');var config=require(_0x74be('0x14'));var db=require(_0x74be('0x15'))['db'];config[_0x74be('0x16')]=_[_0x74be('0x17')](config['redis'],{'host':_0x74be('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x74be('0x16')]));require(_0x74be('0x19'))[_0x74be('0x1a')](socket);function respondWithStatusCode(_0x265473,_0xaa7701){_0xaa7701=_0xaa7701||0xcc;return function(_0x5086bd){if(_0x5086bd){return _0x265473['sendStatus'](_0xaa7701);}return _0x265473[_0x74be('0x1b')](_0xaa7701)[_0x74be('0x1c')]();};}function respondWithResult(_0xbacdd4,_0x3163ee){_0x3163ee=_0x3163ee||0xc8;return function(_0x29093b){if(_0x29093b){return _0xbacdd4[_0x74be('0x1b')](_0x3163ee)[_0x74be('0x1d')](_0x29093b);}};}function respondWithFilteredResult(_0x6ed05d,_0x196149){return function(_0x14f24b){if(_0x14f24b){var _0x44572a=_0x14f24b[_0x74be('0x1e')],_0x5c8f4d=_0x196149[_0x74be('0x1f')],_0x23e7f3=_0x196149[_0x74be('0x1f')]+_0x196149['limit'],_0x58b440;if(_0x23e7f3>=_0x44572a){_0x23e7f3=_0x44572a;_0x58b440=0xc8;}else{_0x58b440=0xce;}_0x6ed05d[_0x74be('0x1b')](_0x58b440);return _0x6ed05d['set'](_0x74be('0x20'),_0x5c8f4d+'-'+_0x23e7f3+'/'+_0x44572a)['json'](_0x14f24b);}return null;};}function patchUpdates(_0x17eabb){return function(_0x2a7ab9){try{jsonpatch['apply'](_0x2a7ab9,_0x17eabb,!![]);}catch(_0x3c6e7e){return BPromise[_0x74be('0x21')](_0x3c6e7e);}return _0x2a7ab9[_0x74be('0x22')]();};}function saveUpdates(_0xef1a79,_0x1b8532){return function(_0x5dc19e){if(_0x5dc19e){return _0x5dc19e['update'](_0xef1a79)[_0x74be('0x23')](function(_0x305793){return _0x305793;});}return null;};}function removeEntity(_0x580bcc,_0x363df7){return function(_0xe3e361){if(_0xe3e361){return _0xe3e361[_0x74be('0x24')]()['then'](function(){var _0x377d3a=_0xe3e361[_0x74be('0x25')]({'plain':!![]});var _0x7efb58='WhatsappQueues';return db[_0x74be('0x26')][_0x74be('0x24')]({'where':{'type':_0x7efb58,'resourceId':_0x377d3a['id']}})[_0x74be('0x23')](function(){return _0xe3e361;});})['then'](function(){_0x580bcc[_0x74be('0x1b')](0xcc)[_0x74be('0x1c')]();});}};}function handleEntityNotFound(_0x2236f9,_0x49dca1){return function(_0x5c6c68){if(!_0x5c6c68){_0x2236f9['sendStatus'](0x194);}return _0x5c6c68;};}function handleError(_0xaaba60,_0x23d7bd){_0x23d7bd=_0x23d7bd||0x1f4;return function(_0x1539f5){logger['error'](_0x1539f5[_0x74be('0x27')]);if(_0x1539f5[_0x74be('0x28')]){delete _0x1539f5[_0x74be('0x28')];}_0xaaba60[_0x74be('0x1b')](_0x23d7bd)['send'](_0x1539f5);};}exports[_0x74be('0x29')]=function(_0x5f2498,_0x24765f){var _0x2374b8={},_0x412287={},_0x2fc5c3={'count':0x0,'rows':[]};var _0x49fcf3=_[_0x74be('0x2a')](db[_0x74be('0x2b')][_0x74be('0x2c')],function(_0x3b70ff){return{'name':_0x3b70ff['fieldName'],'type':_0x3b70ff['type'][_0x74be('0x2d')]};});_0x412287[_0x74be('0x2e')]=_[_0x74be('0x2a')](_0x49fcf3,'name');_0x412287[_0x74be('0x2f')]=_[_0x74be('0x30')](_0x5f2498[_0x74be('0x2f')]);_0x412287[_0x74be('0x31')]=_[_0x74be('0x32')](_0x412287[_0x74be('0x2e')],_0x412287[_0x74be('0x2f')]);_0x2374b8[_0x74be('0x33')]=_['intersection'](_0x412287[_0x74be('0x2e')],qs[_0x74be('0x34')](_0x5f2498[_0x74be('0x2f')][_0x74be('0x34')]));_0x2374b8[_0x74be('0x33')]=_0x2374b8[_0x74be('0x33')]['length']?_0x2374b8[_0x74be('0x33')]:_0x412287[_0x74be('0x2e')];if(!_0x5f2498[_0x74be('0x2f')][_0x74be('0x35')]('nolimit')){_0x2374b8[_0x74be('0x36')]=qs[_0x74be('0x36')](_0x5f2498[_0x74be('0x2f')][_0x74be('0x36')]);_0x2374b8[_0x74be('0x1f')]=qs[_0x74be('0x1f')](_0x5f2498[_0x74be('0x2f')][_0x74be('0x1f')]);}_0x2374b8[_0x74be('0x37')]=qs[_0x74be('0x38')](_0x5f2498[_0x74be('0x2f')]['sort']);_0x2374b8[_0x74be('0x39')]=qs[_0x74be('0x31')](_[_0x74be('0x3a')](_0x5f2498[_0x74be('0x2f')],_0x412287[_0x74be('0x31')]),_0x49fcf3);if(_0x5f2498['query'][_0x74be('0x3b')]){_0x2374b8[_0x74be('0x39')]=_[_0x74be('0x3c')](_0x2374b8[_0x74be('0x39')],{'$or':_[_0x74be('0x2a')](_0x49fcf3,function(_0x277bc1){if(_0x277bc1['type']!==_0x74be('0x3d')){var _0x500883={};_0x500883[_0x277bc1[_0x74be('0x28')]]={'$like':'%'+_0x5f2498[_0x74be('0x2f')][_0x74be('0x3b')]+'%'};return _0x500883;}})});}_0x2374b8=_[_0x74be('0x3c')]({},_0x2374b8,_0x5f2498['options']);var _0x32fadc={'where':_0x2374b8[_0x74be('0x39')]};return db['WhatsappQueue'][_0x74be('0x1e')](_0x32fadc)[_0x74be('0x23')](function(_0x3f8f60){_0x2fc5c3['count']=_0x3f8f60;if(_0x5f2498['query']['includeAll']){_0x2374b8['include']=[{'all':!![]}];}return db[_0x74be('0x2b')]['findAll'](_0x2374b8);})[_0x74be('0x23')](function(_0x196f5b){_0x2fc5c3['rows']=_0x196f5b;return _0x2fc5c3;})[_0x74be('0x23')](respondWithFilteredResult(_0x24765f,_0x2374b8))['catch'](handleError(_0x24765f,null));};exports[_0x74be('0x3e')]=function(_0x217b56,_0x4b9234){var _0x2cbbe3={'raw':!![],'where':{'id':_0x217b56[_0x74be('0x3f')]['id']}},_0x5a953b={};_0x5a953b[_0x74be('0x2e')]=_[_0x74be('0x30')](db[_0x74be('0x2b')][_0x74be('0x2c')]);_0x5a953b[_0x74be('0x2f')]=_[_0x74be('0x30')](_0x217b56[_0x74be('0x2f')]);_0x5a953b['filters']=_[_0x74be('0x32')](_0x5a953b['model'],_0x5a953b['query']);_0x2cbbe3[_0x74be('0x33')]=_[_0x74be('0x32')](_0x5a953b['model'],qs[_0x74be('0x34')](_0x217b56['query']['fields']));_0x2cbbe3[_0x74be('0x33')]=_0x2cbbe3['attributes'][_0x74be('0x40')]?_0x2cbbe3[_0x74be('0x33')]:_0x5a953b[_0x74be('0x2e')];if(_0x217b56[_0x74be('0x2f')][_0x74be('0x41')]){_0x2cbbe3[_0x74be('0x42')]=[{'all':!![]}];}_0x2cbbe3=_['merge']({},_0x2cbbe3,_0x217b56[_0x74be('0x43')]);return db[_0x74be('0x2b')][_0x74be('0x44')](_0x2cbbe3)['then'](handleEntityNotFound(_0x4b9234,null))[_0x74be('0x23')](respondWithResult(_0x4b9234,null))[_0x74be('0x45')](handleError(_0x4b9234,null));};exports[_0x74be('0x46')]=function(_0x222604,_0x3dac03){return db[_0x74be('0x2b')]['create'](_0x222604[_0x74be('0x47')],{})[_0x74be('0x23')](function(_0x5798a7){var _0x4c72d3=_0x222604[_0x74be('0x48')]['get']({'plain':!![]});if(!_0x4c72d3)throw new Error(_0x74be('0x49'));if(_0x4c72d3['role']==='user'){var _0x2f382a=_0x5798a7['get']({'plain':!![]});var _0x588040=_0x74be('0x4a');return db[_0x74be('0x4b')][_0x74be('0x44')]({'where':{'name':_0x588040,'userProfileId':_0x4c72d3[_0x74be('0x4c')]},'raw':!![]})[_0x74be('0x23')](function(_0x2403b8){if(_0x2403b8&&_0x2403b8[_0x74be('0x4d')]===0x0){return db[_0x74be('0x26')][_0x74be('0x46')]({'name':_0x2f382a[_0x74be('0x28')],'resourceId':_0x2f382a['id'],'type':_0x2403b8['name'],'sectionId':_0x2403b8['id']},{})[_0x74be('0x23')](function(){return _0x5798a7;});}else{return _0x5798a7;}})['catch'](function(_0x1c554b){logger[_0x74be('0x4e')](_0x74be('0x4f'),_0x1c554b);throw _0x1c554b;});}return _0x5798a7;})['then'](respondWithResult(_0x3dac03,0xc9))[_0x74be('0x45')](handleError(_0x3dac03,null));};exports['update']=function(_0x225aaa,_0x174551){if(_0x225aaa['body']['id']){delete _0x225aaa[_0x74be('0x47')]['id'];}return db[_0x74be('0x2b')]['find']({'where':{'id':_0x225aaa['params']['id']}})['then'](handleEntityNotFound(_0x174551,null))['then'](saveUpdates(_0x225aaa[_0x74be('0x47')],null))[_0x74be('0x23')](respondWithResult(_0x174551,null))[_0x74be('0x45')](handleError(_0x174551,null));};exports[_0x74be('0x24')]=function(_0x42e8b4,_0x47c0cd){return db[_0x74be('0x2b')][_0x74be('0x44')]({'where':{'id':_0x42e8b4['params']['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x47c0cd,null))['then'](removeEntity(_0x47c0cd,null))[_0x74be('0x45')](handleError(_0x47c0cd,null));};exports['describe']=function(_0x3f8bc2,_0x5cf90e){return db['WhatsappQueue'][_0x74be('0x50')]()['then'](respondWithResult(_0x5cf90e,null))[_0x74be('0x45')](handleError(_0x5cf90e,null));};exports[_0x74be('0x51')]=function(_0x26e5a7,_0x3f718e,_0x2fb902){var _0x852fc6={'raw':!![],'where':{}},_0x1febe6={},_0x2ad461;return db['WhatsappQueue'][_0x74be('0x52')]({'where':{'id':_0x26e5a7['params']['id']}})['then'](handleEntityNotFound(_0x3f718e,null))[_0x74be('0x23')](function(_0x417a5a){if(_0x417a5a){_0x2ad461=_0x417a5a['get']({'plain':!![]});_0x1febe6[_0x74be('0x2e')]=_[_0x74be('0x30')](db['UserWhatsappQueue']['rawAttributes']);_0x1febe6[_0x74be('0x2f')]=_[_0x74be('0x30')](_0x26e5a7[_0x74be('0x2f')]);_0x1febe6[_0x74be('0x31')]=_[_0x74be('0x32')](_0x1febe6[_0x74be('0x2e')],_0x1febe6[_0x74be('0x2f')]);_0x852fc6[_0x74be('0x33')]=_[_0x74be('0x32')](_0x1febe6[_0x74be('0x2e')],qs[_0x74be('0x34')](_0x26e5a7[_0x74be('0x2f')][_0x74be('0x34')]));_0x852fc6[_0x74be('0x33')]=_0x852fc6['attributes']['length']?_0x852fc6[_0x74be('0x33')]:_0x1febe6[_0x74be('0x2e')];if(!_0x26e5a7[_0x74be('0x2f')][_0x74be('0x35')](_0x74be('0x53'))){_0x852fc6[_0x74be('0x36')]=qs[_0x74be('0x36')](_0x26e5a7['query'][_0x74be('0x36')]);_0x852fc6[_0x74be('0x1f')]=qs[_0x74be('0x1f')](_0x26e5a7[_0x74be('0x2f')][_0x74be('0x1f')]);}_0x852fc6[_0x74be('0x37')]=qs['sort'](_0x26e5a7[_0x74be('0x2f')][_0x74be('0x38')]);_0x852fc6[_0x74be('0x39')]=qs['filters'](_['pick'](_0x26e5a7[_0x74be('0x2f')],_0x1febe6[_0x74be('0x31')]));_0x852fc6[_0x74be('0x39')][_0x74be('0x54')]=_0x417a5a['id'];if(_0x26e5a7[_0x74be('0x2f')][_0x74be('0x3b')]){_0x852fc6[_0x74be('0x39')]=_[_0x74be('0x3c')](_0x852fc6[_0x74be('0x39')],{'$or':_[_0x74be('0x2a')](_0x852fc6[_0x74be('0x33')],function(_0x5bb326){var _0x4f870f={};_0x4f870f[_0x5bb326]={'$like':'%'+_0x26e5a7[_0x74be('0x2f')][_0x74be('0x3b')]+'%'};return _0x4f870f;})});}_0x852fc6=_[_0x74be('0x3c')]({},_0x852fc6,_0x26e5a7[_0x74be('0x43')]);return db[_0x74be('0x55')][_0x74be('0x56')](_0x852fc6);}})['then'](function(_0x11f788){if(_0x11f788){return db[_0x74be('0x57')]['findAndCountAll']({'where':{'id':_[_0x74be('0x2a')](_0x11f788,_0x74be('0x58')),'role':_0x74be('0x59')},'attributes':['id',_0x74be('0x28'),_0x74be('0x5a'),_0x74be('0x5b'),_0x74be('0x5c')]});}})[_0x74be('0x23')](function(_0x49f0f0){if(_0x49f0f0){return{'count':_0x49f0f0[_0x74be('0x1e')],'rows':_[_0x74be('0x2a')](_0x49f0f0[_0x74be('0x5d')],function(_0x1158e7){return{'membername':_0x1158e7[_0x74be('0x28')],'UserId':_0x1158e7['id'],'queue_name':_0x2ad461['name'],'WhatsappQueueId':_0x2ad461['id'],'interface':util[_0x74be('0x5e')](_0x74be('0x5f'),_0x74be('0x60'),_0x1158e7[_0x74be('0x28')]),'penalty':0x0,'paused':_0x1158e7[_0x74be('0x5a')],'createdAt':_0x1158e7['createdAt'],'updatedAt':_0x1158e7[_0x74be('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3f718e,_0x852fc6))['catch'](handleError(_0x3f718e,null));};exports[_0x74be('0x61')]=function(_0x3e5757,_0x16e556,_0x473acf){var _0x3b8eac={};var _0x365971={};var _0x444d0d;var _0x41ab4b;return db['WhatsappQueue'][_0x74be('0x52')]({'where':{'id':_0x3e5757[_0x74be('0x3f')]['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x16e556,null))[_0x74be('0x23')](function(_0x3413dd){if(_0x3413dd){_0x444d0d=_0x3413dd;_0x365971[_0x74be('0x2e')]=_['keys'](db[_0x74be('0x62')][_0x74be('0x2c')]);_0x365971[_0x74be('0x2f')]=_['keys'](_0x3e5757['query']);_0x365971[_0x74be('0x31')]=_[_0x74be('0x32')](_0x365971[_0x74be('0x2e')],_0x365971[_0x74be('0x2f')]);_0x3b8eac[_0x74be('0x33')]=_[_0x74be('0x32')](_0x365971[_0x74be('0x2e')],qs[_0x74be('0x34')](_0x3e5757['query'][_0x74be('0x34')]));_0x3b8eac[_0x74be('0x33')]=_0x3b8eac[_0x74be('0x33')][_0x74be('0x40')]?_0x3b8eac[_0x74be('0x33')]:_0x365971['model'];_0x3b8eac[_0x74be('0x37')]=qs[_0x74be('0x38')](_0x3e5757[_0x74be('0x2f')][_0x74be('0x38')]);_0x3b8eac[_0x74be('0x39')]=qs['filters'](_[_0x74be('0x3a')](_0x3e5757[_0x74be('0x2f')],_0x365971['filters']));if(_0x3e5757[_0x74be('0x2f')][_0x74be('0x3b')]){_0x3b8eac[_0x74be('0x39')]=_[_0x74be('0x3c')](_0x3b8eac[_0x74be('0x39')],{'$or':_[_0x74be('0x2a')](_0x3b8eac['attributes'],function(_0x49f881){var _0x549e15={};_0x549e15[_0x49f881]={'$like':'%'+_0x3e5757[_0x74be('0x2f')]['filter']+'%'};return _0x549e15;})});}_0x3b8eac=_['merge']({},_0x3b8eac,_0x3e5757['options']);return _0x444d0d[_0x74be('0x61')](_0x3b8eac);}})[_0x74be('0x23')](function(_0xd6ee12){if(_0xd6ee12){_0x41ab4b=_0xd6ee12['length'];if(!_0x3e5757[_0x74be('0x2f')]['hasOwnProperty']('nolimit')){_0x3b8eac[_0x74be('0x36')]=qs[_0x74be('0x36')](_0x3e5757['query'][_0x74be('0x36')]);_0x3b8eac['offset']=qs[_0x74be('0x1f')](_0x3e5757[_0x74be('0x2f')][_0x74be('0x1f')]);}return _0x444d0d[_0x74be('0x61')](_0x3b8eac);}})[_0x74be('0x23')](function(_0x42fd97){if(_0x42fd97){return _0x42fd97?{'count':_0x41ab4b,'rows':_0x42fd97}:null;}})['then'](respondWithResult(_0x16e556,null))['catch'](handleError(_0x16e556,null));};exports[_0x74be('0x63')]=function(_0x544c2e,_0x209a61,_0x4a3a15){var _0x3e7576=_0x544c2e[_0x74be('0x47')][_0x74be('0x64')];return db['Team'][_0x74be('0x56')]({'where':{'id':_0x3e7576},'attributes':['id'],'include':[{'model':db[_0x74be('0x57')],'as':'Agents','attributes':['id',_0x74be('0x28'),_0x74be('0x65'),'voicePause',_0x74be('0x66')],'raw':!![]}]})[_0x74be('0x23')](function(_0x2571cb){if(_0x2571cb){var _0x18fdeb=_[_0x74be('0x67')](_0x2571cb,function(_0x5fb486){var _0x30d474=_0x5fb486[_0x74be('0x25')]({'plain':!![]});return _0x30d474[_0x74be('0x68')];});return db[_0x74be('0x2b')][_0x74be('0x44')]({'where':{'id':_0x544c2e[_0x74be('0x3f')]['id']}})['then'](function(_0xa7a7be){return db[_0x74be('0x69')][_0x74be('0x6a')](function(_0x913f41){return _0xa7a7be[_0x74be('0x63')](_0x3e7576,{'transaction':_0x913f41})[_0x74be('0x23')](function(){return BPromise[_0x74be('0x6b')](_0x18fdeb,function(_0x23255c){return db[_0x74be('0x55')][_0x74be('0x6c')]({'where':{'UserId':_0x23255c['id'],'WhatsappQueueId':_0x544c2e[_0x74be('0x3f')]['id']},'transaction':_0x913f41});});})[_0x74be('0x23')](function(){_0x18fdeb[_0x74be('0x6d')](function(_0x58383b){socket[_0x74be('0x6e')](_0x74be('0x6f'),{'UserId':_0x58383b['id'],'WhatsappQueueId':_0xa7a7be['id']});});});});});}})[_0x74be('0x23')](respondWithStatusCode(_0x209a61,null))[_0x74be('0x45')](handleError(_0x209a61,null));};exports[_0x74be('0x70')]=function(_0xd0a777,_0x3a28cf,_0x335922){return db['Team'][_0x74be('0x56')]({'where':{'id':_0xd0a777[_0x74be('0x2f')][_0x74be('0x64')]},'attributes':['id'],'include':[{'model':db[_0x74be('0x57')],'as':_0x74be('0x68'),'attributes':['id'],'raw':!![]}]})[_0x74be('0x23')](handleEntityNotFound(_0x3a28cf,null))['then'](function(_0x568656){var _0x304a9c=_[_0x74be('0x2a')](_0x568656,'id');var _0x3ac3a5=[];var _0x2231aa=[];var _0x53104e=squel[_0x74be('0x71')]();_0x53104e['field'](_0x74be('0x72'))[_0x74be('0x73')](_0x74be('0x74'),'tq')[_0x74be('0x75')](_0x74be('0x76'),'ut',_0x74be('0x77'))[_0x74be('0x39')]('WhatsappQueueId\x20=\x20?',_0xd0a777[_0x74be('0x3f')]['id']);for(var _0x5a7391=0x0;_0x5a7391<_0x568656['length'];_0x5a7391+=0x1){let _0x1515c5=_0x568656[_0x5a7391];for(var _0x1dbd84=0x0;_0x1dbd84<_0x1515c5['Agents'][_0x74be('0x40')];_0x1dbd84+=0x1){let _0x55208c=_0x1515c5['Agents'][_0x1dbd84];var _0x33d6d9=_0x53104e[_0x74be('0x78')]();_0x33d6d9[_0x74be('0x39')](_0x74be('0x79'),_0x55208c['id']);_0x2231aa[_0x74be('0x7a')](db[_0x74be('0x69')][_0x74be('0x2f')](_0x33d6d9['toString'](),{'type':db[_0x74be('0x69')][_0x74be('0x7b')][_0x74be('0x7c')]})[_0x74be('0x23')](function(_0x245aaf){if(_0x245aaf[_0x74be('0x40')]===0x1){return _0x55208c['id'];}else{var _0x36bc3f=_[_0x74be('0x7d')](_[_0x74be('0x2a')](_0x245aaf,_0x74be('0x7e')),function(_0x5dfbf9){return _[_0x74be('0x7f')](_0x304a9c,_0x5dfbf9);});if(_0x36bc3f){return _0x55208c['id'];}}}));}}return BPromise[_0x74be('0x80')](_0x2231aa)['then'](function(_0x3448de){_0x3ac3a5=_(_0x3ac3a5)['union'](_0x3448de)[_0x74be('0x81')]()[_0x74be('0x82')]();return db['WhatsappQueue'][_0x74be('0x44')]({'where':{'id':_0xd0a777[_0x74be('0x3f')]['id']}})[_0x74be('0x23')](function(_0x20008a){return db[_0x74be('0x69')]['transaction'](function(_0x299929){return _0x20008a[_0x74be('0x70')](_0xd0a777[_0x74be('0x2f')][_0x74be('0x64')],{'transaction':_0x299929})[_0x74be('0x23')](function(){if(!_[_0x74be('0x83')](_0x3ac3a5)){return _0x20008a[_0x74be('0x84')](_0x3ac3a5,{'transaction':_0x299929});}})[_0x74be('0x23')](function(){_0x3ac3a5[_0x74be('0x6d')](function(_0x10dc1e){socket[_0x74be('0x6e')]('userWhatsappQueue:remove',{'UserId':_0x10dc1e,'WhatsappQueueId':_0x20008a['id']});});});});});});})[_0x74be('0x23')](respondWithStatusCode(_0x3a28cf,null))[_0x74be('0x45')](handleError(_0x3a28cf,null));};exports[_0x74be('0x85')]=function(_0xdfbc6a,_0x149fc4,_0x26cbe5){return db[_0x74be('0x2b')][_0x74be('0x44')]({'where':{'id':_0xdfbc6a[_0x74be('0x3f')]['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x149fc4,null))[_0x74be('0x23')](function(_0x2180ca){if(_0x2180ca){return _0x2180ca[_0x74be('0x85')](_0xdfbc6a['body'][_0x74be('0x64')],_[_0x74be('0x86')](_0xdfbc6a[_0x74be('0x47')],[_0x74be('0x64'),'id'])||{})[_0x74be('0x87')](function(_0x17eaeb){for(var _0x3926c4=0x0;_0x3926c4<_0xdfbc6a[_0x74be('0x47')][_0x74be('0x64')]['length'];_0x3926c4+=0x1){socket[_0x74be('0x6e')](_0x74be('0x6f'),{'UserId':_0xdfbc6a[_0x74be('0x47')][_0x74be('0x64')][_0x3926c4],'WhatsappQueueId':_0xdfbc6a[_0x74be('0x3f')]['id']});}return _0x17eaeb;});}})[_0x74be('0x23')](respondWithResult(_0x149fc4,null))[_0x74be('0x45')](handleError(_0x149fc4,null));};exports[_0x74be('0x84')]=function(_0x3c8368,_0x1f8c6a,_0x12a231){return db['WhatsappQueue']['find']({'where':{'id':_0x3c8368[_0x74be('0x3f')]['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x1f8c6a,null))[_0x74be('0x23')](function(_0x306691){if(_0x306691){return _0x306691[_0x74be('0x84')](_0x3c8368['query'][_0x74be('0x64')])[_0x74be('0x23')](function(){if(_[_0x74be('0x88')](_0x3c8368[_0x74be('0x2f')][_0x74be('0x64')])){for(var _0x4e3f18=0x0;_0x4e3f18<_0x3c8368[_0x74be('0x2f')]['ids']['length'];_0x4e3f18+=0x1){socket[_0x74be('0x6e')]('userWhatsappQueue:remove',{'UserId':Number(_0x3c8368[_0x74be('0x2f')]['ids'][_0x4e3f18]),'WhatsappQueueId':Number(_0x3c8368['params']['id'])});}}else{socket[_0x74be('0x6e')](_0x74be('0x89'),{'UserId':Number(_0x3c8368[_0x74be('0x2f')][_0x74be('0x64')]),'WhatsappQueueId':Number(_0x3c8368['params']['id'])});}});}})[_0x74be('0x23')](respondWithStatusCode(_0x1f8c6a,null))[_0x74be('0x45')](handleError(_0x1f8c6a,null));};exports[_0x74be('0x8a')]=function(_0x1cf532,_0x5136ed,_0x50d447){var _0x232612={};var _0x10fe5a={};var _0x21596d;var _0x2c78b2;return db[_0x74be('0x2b')][_0x74be('0x52')]({'where':{'id':_0x1cf532['params']['id']}})[_0x74be('0x23')](handleEntityNotFound(_0x5136ed,null))[_0x74be('0x23')](function(_0x28b743){if(_0x28b743){_0x21596d=_0x28b743;_0x10fe5a[_0x74be('0x2e')]=_[_0x74be('0x30')](db[_0x74be('0x57')]['rawAttributes']);_0x10fe5a[_0x74be('0x2f')]=_[_0x74be('0x30')](_0x1cf532['query']);_0x10fe5a[_0x74be('0x31')]=_[_0x74be('0x32')](_0x10fe5a['model'],_0x10fe5a[_0x74be('0x2f')]);_0x232612[_0x74be('0x33')]=_[_0x74be('0x32')](_0x10fe5a[_0x74be('0x2e')],qs['fields'](_0x1cf532[_0x74be('0x2f')][_0x74be('0x34')]));_0x232612[_0x74be('0x33')]=_0x232612[_0x74be('0x33')][_0x74be('0x40')]?_0x232612[_0x74be('0x33')]:_0x10fe5a[_0x74be('0x2e')];_0x232612['order']=qs[_0x74be('0x38')](_0x1cf532[_0x74be('0x2f')][_0x74be('0x38')]);_0x232612[_0x74be('0x39')]=qs[_0x74be('0x31')](_['pick'](_0x1cf532[_0x74be('0x2f')],_0x10fe5a[_0x74be('0x31')]));if(_0x1cf532[_0x74be('0x2f')][_0x74be('0x3b')]){_0x232612['where']=_[_0x74be('0x3c')](_0x232612[_0x74be('0x39')],{'$or':_['map'](_0x232612[_0x74be('0x33')],function(_0x4a149d){var _0x5c5005={};_0x5c5005[_0x4a149d]={'$like':'%'+_0x1cf532[_0x74be('0x2f')]['filter']+'%'};return _0x5c5005;})});}_0x232612=_[_0x74be('0x3c')]({},_0x232612,_0x1cf532[_0x74be('0x43')]);return _0x21596d[_0x74be('0x8a')](_0x232612);}})['then'](function(_0x5ee893){if(_0x5ee893){_0x2c78b2=_0x5ee893['length'];if(!_0x1cf532[_0x74be('0x2f')][_0x74be('0x35')]('nolimit')){_0x232612[_0x74be('0x36')]=qs[_0x74be('0x36')](_0x1cf532['query']['limit']);_0x232612['offset']=qs[_0x74be('0x1f')](_0x1cf532[_0x74be('0x2f')]['offset']);}return _0x21596d[_0x74be('0x8a')](_0x232612);}})[_0x74be('0x23')](function(_0x174dd0){if(_0x174dd0){return _0x174dd0?{'count':_0x2c78b2,'rows':_0x174dd0}:null;}})['then'](respondWithResult(_0x5136ed,null))['catch'](handleError(_0x5136ed,null));}; \ No newline at end of file +var _0x7ed1=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','findOne','nolimit','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','sequelize','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','sendStatus','end','json','count','offset','limit','status','Content-Range','apply','reject','save','update','then','WhatsappQueues','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappQueue','includeAll','include','findAll','rows','catch','show','params','find','create','body'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x7ed1,0xca));var _0x17ed=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x7ed1[_0x1b2ff7];return _0x31656a;};'use strict';var pdf=require(_0x17ed('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x17ed('0x1'));var zipdir=require(_0x17ed('0x2'));var jsonpatch=require(_0x17ed('0x3'));var rp=require(_0x17ed('0x4'));var moment=require(_0x17ed('0x5'));var BPromise=require(_0x17ed('0x6'));var Mustache=require('mustache');var util=require(_0x17ed('0x7'));var path=require(_0x17ed('0x8'));var sox=require(_0x17ed('0x9'));var csv=require(_0x17ed('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x17ed('0xb'));var crypto=require(_0x17ed('0xc'));var jsforce=require(_0x17ed('0xd'));var deskjs=require(_0x17ed('0xe'));var toCsv=require('to-csv');var querystring=require(_0x17ed('0xf'));var Papa=require(_0x17ed('0x10'));var Redis=require(_0x17ed('0x11'));var authService=require(_0x17ed('0x12'));var qs=require(_0x17ed('0x13'));var as=require(_0x17ed('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17ed('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x17ed('0x16'));var db=require(_0x17ed('0x17'))['db'];config[_0x17ed('0x18')]=_[_0x17ed('0x19')](config[_0x17ed('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x17ed('0x1a'))(new Redis(config[_0x17ed('0x18')]));require(_0x17ed('0x1b'))['register'](socket);function respondWithStatusCode(_0x2ae9aa,_0x53ec2a){_0x53ec2a=_0x53ec2a||0xcc;return function(_0x513e5c){if(_0x513e5c){return _0x2ae9aa[_0x17ed('0x1c')](_0x53ec2a);}return _0x2ae9aa['status'](_0x53ec2a)[_0x17ed('0x1d')]();};}function respondWithResult(_0x4782c3,_0xd10a00){_0xd10a00=_0xd10a00||0xc8;return function(_0x6ccf15){if(_0x6ccf15){return _0x4782c3['status'](_0xd10a00)[_0x17ed('0x1e')](_0x6ccf15);}};}function respondWithFilteredResult(_0x172ae9,_0x20b6d2){return function(_0x5ade66){if(_0x5ade66){var _0x52518e=_0x5ade66[_0x17ed('0x1f')],_0x81e1a6=_0x20b6d2[_0x17ed('0x20')],_0x2903f3=_0x20b6d2['offset']+_0x20b6d2[_0x17ed('0x21')],_0x933215;if(_0x2903f3>=_0x52518e){_0x2903f3=_0x52518e;_0x933215=0xc8;}else{_0x933215=0xce;}_0x172ae9[_0x17ed('0x22')](_0x933215);return _0x172ae9['set'](_0x17ed('0x23'),_0x81e1a6+'-'+_0x2903f3+'/'+_0x52518e)[_0x17ed('0x1e')](_0x5ade66);}return null;};}function patchUpdates(_0x532b3a){return function(_0xc40193){try{jsonpatch[_0x17ed('0x24')](_0xc40193,_0x532b3a,!![]);}catch(_0x2298ea){return BPromise[_0x17ed('0x25')](_0x2298ea);}return _0xc40193[_0x17ed('0x26')]();};}function saveUpdates(_0x2e5f56,_0x43243e){return function(_0x50f6a3){if(_0x50f6a3){return _0x50f6a3[_0x17ed('0x27')](_0x2e5f56)[_0x17ed('0x28')](function(_0x5e1602){return _0x5e1602;});}return null;};}function removeEntity(_0x5e4f27,_0x464799){return function(_0x5d095b){if(_0x5d095b){return _0x5d095b['destroy']()['then'](function(){var _0x284c72=_0x5d095b['get']({'plain':!![]});var _0x2bbff3=_0x17ed('0x29');return db[_0x17ed('0x2a')]['destroy']({'where':{'type':_0x2bbff3,'resourceId':_0x284c72['id']}})[_0x17ed('0x28')](function(){return _0x5d095b;});})[_0x17ed('0x28')](function(){_0x5e4f27[_0x17ed('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57470d,_0x170d4f){return function(_0xb3ea65){if(!_0xb3ea65){_0x57470d[_0x17ed('0x1c')](0x194);}return _0xb3ea65;};}function handleError(_0x5a02ab,_0x38bb50){_0x38bb50=_0x38bb50||0x1f4;return function(_0x2ca36a){logger[_0x17ed('0x2b')](_0x2ca36a[_0x17ed('0x2c')]);if(_0x2ca36a['name']){delete _0x2ca36a[_0x17ed('0x2d')];}_0x5a02ab[_0x17ed('0x22')](_0x38bb50)['send'](_0x2ca36a);};}exports[_0x17ed('0x2e')]=function(_0xd0289,_0xf325ed){var _0x529966={},_0x3a9f86={},_0x4544ec={'count':0x0,'rows':[]};var _0x4087e5=_[_0x17ed('0x2f')](db['WhatsappQueue'][_0x17ed('0x30')],function(_0x508444){return{'name':_0x508444[_0x17ed('0x31')],'type':_0x508444[_0x17ed('0x32')][_0x17ed('0x33')]};});_0x3a9f86[_0x17ed('0x34')]=_['map'](_0x4087e5,_0x17ed('0x2d'));_0x3a9f86[_0x17ed('0x35')]=_[_0x17ed('0x36')](_0xd0289[_0x17ed('0x35')]);_0x3a9f86[_0x17ed('0x37')]=_[_0x17ed('0x38')](_0x3a9f86[_0x17ed('0x34')],_0x3a9f86[_0x17ed('0x35')]);_0x529966['attributes']=_[_0x17ed('0x38')](_0x3a9f86[_0x17ed('0x34')],qs[_0x17ed('0x39')](_0xd0289[_0x17ed('0x35')][_0x17ed('0x39')]));_0x529966['attributes']=_0x529966[_0x17ed('0x3a')][_0x17ed('0x3b')]?_0x529966['attributes']:_0x3a9f86['model'];if(!_0xd0289['query'][_0x17ed('0x3c')]('nolimit')){_0x529966[_0x17ed('0x21')]=qs[_0x17ed('0x21')](_0xd0289[_0x17ed('0x35')]['limit']);_0x529966[_0x17ed('0x20')]=qs[_0x17ed('0x20')](_0xd0289[_0x17ed('0x35')][_0x17ed('0x20')]);}_0x529966[_0x17ed('0x3d')]=qs['sort'](_0xd0289[_0x17ed('0x35')][_0x17ed('0x3e')]);_0x529966[_0x17ed('0x3f')]=qs[_0x17ed('0x37')](_[_0x17ed('0x40')](_0xd0289[_0x17ed('0x35')],_0x3a9f86['filters']),_0x4087e5);if(_0xd0289['query'][_0x17ed('0x41')]){_0x529966[_0x17ed('0x3f')]=_['merge'](_0x529966[_0x17ed('0x3f')],{'$or':_[_0x17ed('0x2f')](_0x4087e5,function(_0x58dcac){if(_0x58dcac[_0x17ed('0x32')]!==_0x17ed('0x42')){var _0x46b1b9={};_0x46b1b9[_0x58dcac[_0x17ed('0x2d')]]={'$like':'%'+_0xd0289[_0x17ed('0x35')][_0x17ed('0x41')]+'%'};return _0x46b1b9;}})});}_0x529966=_[_0x17ed('0x43')]({},_0x529966,_0xd0289[_0x17ed('0x44')]);var _0x483179={'where':_0x529966[_0x17ed('0x3f')]};return db[_0x17ed('0x45')][_0x17ed('0x1f')](_0x483179)[_0x17ed('0x28')](function(_0x58c19a){_0x4544ec[_0x17ed('0x1f')]=_0x58c19a;if(_0xd0289[_0x17ed('0x35')][_0x17ed('0x46')]){_0x529966[_0x17ed('0x47')]=[{'all':!![]}];}return db[_0x17ed('0x45')][_0x17ed('0x48')](_0x529966);})[_0x17ed('0x28')](function(_0x1e3b59){_0x4544ec[_0x17ed('0x49')]=_0x1e3b59;return _0x4544ec;})[_0x17ed('0x28')](respondWithFilteredResult(_0xf325ed,_0x529966))[_0x17ed('0x4a')](handleError(_0xf325ed,null));};exports[_0x17ed('0x4b')]=function(_0x110f36,_0x474d2c){var _0x47d382={'raw':!![],'where':{'id':_0x110f36[_0x17ed('0x4c')]['id']}},_0xe6e696={};_0xe6e696[_0x17ed('0x34')]=_[_0x17ed('0x36')](db[_0x17ed('0x45')]['rawAttributes']);_0xe6e696[_0x17ed('0x35')]=_[_0x17ed('0x36')](_0x110f36[_0x17ed('0x35')]);_0xe6e696[_0x17ed('0x37')]=_[_0x17ed('0x38')](_0xe6e696[_0x17ed('0x34')],_0xe6e696[_0x17ed('0x35')]);_0x47d382[_0x17ed('0x3a')]=_[_0x17ed('0x38')](_0xe6e696[_0x17ed('0x34')],qs[_0x17ed('0x39')](_0x110f36['query']['fields']));_0x47d382[_0x17ed('0x3a')]=_0x47d382[_0x17ed('0x3a')][_0x17ed('0x3b')]?_0x47d382[_0x17ed('0x3a')]:_0xe6e696[_0x17ed('0x34')];if(_0x110f36[_0x17ed('0x35')][_0x17ed('0x46')]){_0x47d382[_0x17ed('0x47')]=[{'all':!![]}];}_0x47d382=_[_0x17ed('0x43')]({},_0x47d382,_0x110f36['options']);return db[_0x17ed('0x45')][_0x17ed('0x4d')](_0x47d382)[_0x17ed('0x28')](handleEntityNotFound(_0x474d2c,null))['then'](respondWithResult(_0x474d2c,null))['catch'](handleError(_0x474d2c,null));};exports[_0x17ed('0x4e')]=function(_0xfeff75,_0x504279){return db['WhatsappQueue']['create'](_0xfeff75[_0x17ed('0x4f')],{})[_0x17ed('0x28')](function(_0x2b2db0){var _0x3888b7=_0xfeff75[_0x17ed('0x50')][_0x17ed('0x51')]({'plain':!![]});if(!_0x3888b7)throw new Error(_0x17ed('0x52'));if(_0x3888b7[_0x17ed('0x53')]===_0x17ed('0x50')){var _0x24d5f8=_0x2b2db0[_0x17ed('0x51')]({'plain':!![]});var _0xbeff00='WhatsappQueues';return db[_0x17ed('0x54')][_0x17ed('0x4d')]({'where':{'name':_0xbeff00,'userProfileId':_0x3888b7['userProfileId']},'raw':!![]})[_0x17ed('0x28')](function(_0x57139c){if(_0x57139c&&_0x57139c[_0x17ed('0x55')]===0x0){return db[_0x17ed('0x2a')][_0x17ed('0x4e')]({'name':_0x24d5f8[_0x17ed('0x2d')],'resourceId':_0x24d5f8['id'],'type':_0x57139c['name'],'sectionId':_0x57139c['id']},{})[_0x17ed('0x28')](function(){return _0x2b2db0;});}else{return _0x2b2db0;}})['catch'](function(_0x187092){logger['error'](_0x17ed('0x56'),_0x187092);throw _0x187092;});}return _0x2b2db0;})[_0x17ed('0x28')](respondWithResult(_0x504279,0xc9))[_0x17ed('0x4a')](handleError(_0x504279,null));};exports['update']=function(_0x59a987,_0x3246ab){if(_0x59a987[_0x17ed('0x4f')]['id']){delete _0x59a987[_0x17ed('0x4f')]['id'];}return db[_0x17ed('0x45')][_0x17ed('0x4d')]({'where':{'id':_0x59a987[_0x17ed('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3246ab,null))['then'](saveUpdates(_0x59a987[_0x17ed('0x4f')],null))[_0x17ed('0x28')](respondWithResult(_0x3246ab,null))[_0x17ed('0x4a')](handleError(_0x3246ab,null));};exports[_0x17ed('0x57')]=function(_0x5ec1cd,_0x4968bc){return db[_0x17ed('0x45')][_0x17ed('0x4d')]({'where':{'id':_0x5ec1cd[_0x17ed('0x4c')]['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x4968bc,null))[_0x17ed('0x28')](removeEntity(_0x4968bc,null))[_0x17ed('0x4a')](handleError(_0x4968bc,null));};exports['describe']=function(_0x5742de,_0x4211a7){return db['WhatsappQueue'][_0x17ed('0x58')]()['then'](respondWithResult(_0x4211a7,null))[_0x17ed('0x4a')](handleError(_0x4211a7,null));};exports['getMembers']=function(_0x19155b,_0x1251fb,_0x150ee6){var _0xb16079={'raw':!![],'where':{}},_0x4a3331={},_0xc5e941;return db[_0x17ed('0x45')][_0x17ed('0x59')]({'where':{'id':_0x19155b['params']['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x1251fb,null))[_0x17ed('0x28')](function(_0x20c2ac){if(_0x20c2ac){_0xc5e941=_0x20c2ac[_0x17ed('0x51')]({'plain':!![]});_0x4a3331['model']=_[_0x17ed('0x36')](db['UserWhatsappQueue'][_0x17ed('0x30')]);_0x4a3331[_0x17ed('0x35')]=_['keys'](_0x19155b['query']);_0x4a3331[_0x17ed('0x37')]=_[_0x17ed('0x38')](_0x4a3331[_0x17ed('0x34')],_0x4a3331['query']);_0xb16079[_0x17ed('0x3a')]=_[_0x17ed('0x38')](_0x4a3331['model'],qs['fields'](_0x19155b[_0x17ed('0x35')][_0x17ed('0x39')]));_0xb16079[_0x17ed('0x3a')]=_0xb16079[_0x17ed('0x3a')][_0x17ed('0x3b')]?_0xb16079[_0x17ed('0x3a')]:_0x4a3331[_0x17ed('0x34')];if(!_0x19155b['query']['hasOwnProperty'](_0x17ed('0x5a'))){_0xb16079[_0x17ed('0x21')]=qs['limit'](_0x19155b['query'][_0x17ed('0x21')]);_0xb16079['offset']=qs['offset'](_0x19155b[_0x17ed('0x35')]['offset']);}_0xb16079['order']=qs[_0x17ed('0x3e')](_0x19155b[_0x17ed('0x35')]['sort']);_0xb16079[_0x17ed('0x3f')]=qs[_0x17ed('0x37')](_[_0x17ed('0x40')](_0x19155b[_0x17ed('0x35')],_0x4a3331[_0x17ed('0x37')]));_0xb16079[_0x17ed('0x3f')][_0x17ed('0x5b')]=_0x20c2ac['id'];if(_0x19155b['query'][_0x17ed('0x41')]){_0xb16079[_0x17ed('0x3f')]=_[_0x17ed('0x43')](_0xb16079[_0x17ed('0x3f')],{'$or':_[_0x17ed('0x2f')](_0xb16079[_0x17ed('0x3a')],function(_0x162121){var _0x355214={};_0x355214[_0x162121]={'$like':'%'+_0x19155b[_0x17ed('0x35')][_0x17ed('0x41')]+'%'};return _0x355214;})});}_0xb16079=_[_0x17ed('0x43')]({},_0xb16079,_0x19155b[_0x17ed('0x44')]);return db['UserWhatsappQueue'][_0x17ed('0x48')](_0xb16079);}})['then'](function(_0x4f8f7e){if(_0x4f8f7e){return db['User'][_0x17ed('0x5c')]({'where':{'id':_[_0x17ed('0x2f')](_0x4f8f7e,_0x17ed('0x5d')),'role':_0x17ed('0x5e')},'attributes':['id','name',_0x17ed('0x5f'),_0x17ed('0x60'),_0x17ed('0x61')]});}})[_0x17ed('0x28')](function(_0x174f18){if(_0x174f18){return{'count':_0x174f18[_0x17ed('0x1f')],'rows':_[_0x17ed('0x2f')](_0x174f18[_0x17ed('0x49')],function(_0x4c7154){return{'membername':_0x4c7154['name'],'UserId':_0x4c7154['id'],'queue_name':_0xc5e941['name'],'WhatsappQueueId':_0xc5e941['id'],'interface':util['format']('%s/%s','SIP',_0x4c7154[_0x17ed('0x2d')]),'penalty':0x0,'paused':_0x4c7154[_0x17ed('0x5f')],'createdAt':_0x4c7154[_0x17ed('0x61')],'updatedAt':_0x4c7154[_0x17ed('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x17ed('0x28')](respondWithFilteredResult(_0x1251fb,_0xb16079))[_0x17ed('0x4a')](handleError(_0x1251fb,null));};exports[_0x17ed('0x62')]=function(_0x14dd2f,_0x4e4d00,_0x4b2b62){var _0x20be41={};var _0x249270={};var _0x2696e9;var _0x26277f;return db[_0x17ed('0x45')][_0x17ed('0x59')]({'where':{'id':_0x14dd2f[_0x17ed('0x4c')]['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x4e4d00,null))[_0x17ed('0x28')](function(_0x503f3e){if(_0x503f3e){_0x2696e9=_0x503f3e;_0x249270[_0x17ed('0x34')]=_[_0x17ed('0x36')](db[_0x17ed('0x63')][_0x17ed('0x30')]);_0x249270['query']=_[_0x17ed('0x36')](_0x14dd2f['query']);_0x249270['filters']=_[_0x17ed('0x38')](_0x249270['model'],_0x249270['query']);_0x20be41[_0x17ed('0x3a')]=_[_0x17ed('0x38')](_0x249270[_0x17ed('0x34')],qs[_0x17ed('0x39')](_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x39')]));_0x20be41[_0x17ed('0x3a')]=_0x20be41[_0x17ed('0x3a')][_0x17ed('0x3b')]?_0x20be41[_0x17ed('0x3a')]:_0x249270[_0x17ed('0x34')];_0x20be41[_0x17ed('0x3d')]=qs[_0x17ed('0x3e')](_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x3e')]);_0x20be41[_0x17ed('0x3f')]=qs[_0x17ed('0x37')](_[_0x17ed('0x40')](_0x14dd2f[_0x17ed('0x35')],_0x249270[_0x17ed('0x37')]));if(_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x41')]){_0x20be41[_0x17ed('0x3f')]=_['merge'](_0x20be41[_0x17ed('0x3f')],{'$or':_[_0x17ed('0x2f')](_0x20be41['attributes'],function(_0x29afd6){var _0x8dc4d8={};_0x8dc4d8[_0x29afd6]={'$like':'%'+_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x41')]+'%'};return _0x8dc4d8;})});}_0x20be41=_[_0x17ed('0x43')]({},_0x20be41,_0x14dd2f[_0x17ed('0x44')]);return _0x2696e9['getTeams'](_0x20be41);}})[_0x17ed('0x28')](function(_0x508ef1){if(_0x508ef1){_0x26277f=_0x508ef1['length'];if(!_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x3c')](_0x17ed('0x5a'))){_0x20be41[_0x17ed('0x21')]=qs[_0x17ed('0x21')](_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x21')]);_0x20be41[_0x17ed('0x20')]=qs[_0x17ed('0x20')](_0x14dd2f[_0x17ed('0x35')][_0x17ed('0x20')]);}return _0x2696e9[_0x17ed('0x62')](_0x20be41);}})[_0x17ed('0x28')](function(_0x5560e1){if(_0x5560e1){return _0x5560e1?{'count':_0x26277f,'rows':_0x5560e1}:null;}})['then'](respondWithResult(_0x4e4d00,null))[_0x17ed('0x4a')](handleError(_0x4e4d00,null));};exports[_0x17ed('0x64')]=function(_0x1358d2,_0x6157fb,_0x5c7eef){var _0x434e10=_0x1358d2[_0x17ed('0x4f')][_0x17ed('0x65')];return db[_0x17ed('0x63')][_0x17ed('0x48')]({'where':{'id':_0x434e10},'attributes':['id'],'include':[{'model':db[_0x17ed('0x66')],'as':_0x17ed('0x67'),'attributes':['id',_0x17ed('0x2d'),_0x17ed('0x68'),_0x17ed('0x69'),_0x17ed('0x6a')],'raw':!![]}]})[_0x17ed('0x28')](function(_0x2cdc6c){if(_0x2cdc6c){var _0x1bdcb6=_[_0x17ed('0x6b')](_0x2cdc6c,function(_0x5b960d){var _0x150de4=_0x5b960d[_0x17ed('0x51')]({'plain':!![]});return _0x150de4[_0x17ed('0x67')];});return db[_0x17ed('0x45')][_0x17ed('0x4d')]({'where':{'id':_0x1358d2['params']['id']}})[_0x17ed('0x28')](function(_0x390b64){return db['sequelize']['transaction'](function(_0x528684){return _0x390b64[_0x17ed('0x64')](_0x434e10,{'transaction':_0x528684})['then'](function(){return BPromise[_0x17ed('0x6c')](_0x1bdcb6,function(_0x1892bd){return db['UserWhatsappQueue'][_0x17ed('0x6d')]({'where':{'UserId':_0x1892bd['id'],'WhatsappQueueId':_0x1358d2[_0x17ed('0x4c')]['id']},'transaction':_0x528684});});})[_0x17ed('0x28')](function(){_0x1bdcb6[_0x17ed('0x6e')](function(_0x308b91){socket[_0x17ed('0x6f')](_0x17ed('0x70'),{'UserId':_0x308b91['id'],'WhatsappQueueId':_0x390b64['id']});});});});});}})[_0x17ed('0x28')](respondWithStatusCode(_0x6157fb,null))[_0x17ed('0x4a')](handleError(_0x6157fb,null));};exports[_0x17ed('0x71')]=function(_0x4b0fe8,_0x2049ef,_0x1e34e7){return db[_0x17ed('0x63')][_0x17ed('0x48')]({'where':{'id':_0x4b0fe8[_0x17ed('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x17ed('0x28')](handleEntityNotFound(_0x2049ef,null))[_0x17ed('0x28')](function(_0x319144){var _0x4702cd=_['map'](_0x319144,'id');var _0x4b2e69=[];var _0xe97d8=[];var _0x529ebb=squel[_0x17ed('0x72')]();_0x529ebb[_0x17ed('0x73')](_0x17ed('0x74'))[_0x17ed('0x75')]('team_has_whatsapp_queues','tq')[_0x17ed('0x76')](_0x17ed('0x77'),'ut',_0x17ed('0x78'))['where'](_0x17ed('0x79'),_0x4b0fe8['params']['id']);for(var _0x1e7800=0x0;_0x1e7800<_0x319144[_0x17ed('0x3b')];_0x1e7800+=0x1){let _0x36af52=_0x319144[_0x1e7800];for(var _0x44a523=0x0;_0x44a523<_0x36af52['Agents']['length'];_0x44a523+=0x1){let _0xe49ecf=_0x36af52['Agents'][_0x44a523];var _0x12845c=_0x529ebb[_0x17ed('0x7a')]();_0x12845c[_0x17ed('0x3f')]('ut.UserId\x20=\x20?',_0xe49ecf['id']);_0xe97d8[_0x17ed('0x7b')](db['sequelize'][_0x17ed('0x35')](_0x12845c[_0x17ed('0x7c')](),{'type':db[_0x17ed('0x7d')]['QueryTypes'][_0x17ed('0x7e')]})[_0x17ed('0x28')](function(_0x4a93df){if(_0x4a93df['length']===0x1){return _0xe49ecf['id'];}else{var _0x1dc079=_[_0x17ed('0x7f')](_['map'](_0x4a93df,_0x17ed('0x80')),function(_0x2e045f){return _[_0x17ed('0x81')](_0x4702cd,_0x2e045f);});if(_0x1dc079){return _0xe49ecf['id'];}}}));}}return BPromise[_0x17ed('0x82')](_0xe97d8)['then'](function(_0x58388f){_0x4b2e69=_(_0x4b2e69)[_0x17ed('0x83')](_0x58388f)[_0x17ed('0x84')]()[_0x17ed('0x85')]();return db[_0x17ed('0x45')][_0x17ed('0x4d')]({'where':{'id':_0x4b0fe8[_0x17ed('0x4c')]['id']}})['then'](function(_0x2f686b){return db[_0x17ed('0x7d')]['transaction'](function(_0x1d2b2f){return _0x2f686b[_0x17ed('0x71')](_0x4b0fe8[_0x17ed('0x35')][_0x17ed('0x65')],{'transaction':_0x1d2b2f})['then'](function(){if(!_[_0x17ed('0x86')](_0x4b2e69)){return _0x2f686b['removeAgents'](_0x4b2e69,{'transaction':_0x1d2b2f});}})[_0x17ed('0x28')](function(){_0x4b2e69['forEach'](function(_0x5bb82b){socket['emit'](_0x17ed('0x87'),{'UserId':_0x5bb82b,'WhatsappQueueId':_0x2f686b['id']});});});});});});})[_0x17ed('0x28')](respondWithStatusCode(_0x2049ef,null))[_0x17ed('0x4a')](handleError(_0x2049ef,null));};exports['addAgents']=function(_0x138056,_0x3bee4e,_0xae1617){return db['WhatsappQueue']['find']({'where':{'id':_0x138056['params']['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x3bee4e,null))[_0x17ed('0x28')](function(_0x4b1a0d){if(_0x4b1a0d){return _0x4b1a0d[_0x17ed('0x88')](_0x138056[_0x17ed('0x4f')]['ids'],_['omit'](_0x138056[_0x17ed('0x4f')],[_0x17ed('0x65'),'id'])||{})[_0x17ed('0x89')](function(_0x44b0a4){for(var _0x538669=0x0;_0x538669<_0x138056['body']['ids']['length'];_0x538669+=0x1){socket[_0x17ed('0x6f')](_0x17ed('0x70'),{'UserId':_0x138056[_0x17ed('0x4f')]['ids'][_0x538669],'WhatsappQueueId':_0x138056['params']['id']});}return _0x44b0a4;});}})[_0x17ed('0x28')](respondWithResult(_0x3bee4e,null))[_0x17ed('0x4a')](handleError(_0x3bee4e,null));};exports[_0x17ed('0x8a')]=function(_0x40b850,_0x297f24,_0x428aa6){return db['WhatsappQueue']['find']({'where':{'id':_0x40b850[_0x17ed('0x4c')]['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x297f24,null))[_0x17ed('0x28')](function(_0x5d677e){if(_0x5d677e){return _0x5d677e[_0x17ed('0x8a')](_0x40b850[_0x17ed('0x35')][_0x17ed('0x65')])[_0x17ed('0x28')](function(){if(_[_0x17ed('0x8b')](_0x40b850[_0x17ed('0x35')][_0x17ed('0x65')])){for(var _0x17c831=0x0;_0x17c831<_0x40b850[_0x17ed('0x35')][_0x17ed('0x65')][_0x17ed('0x3b')];_0x17c831+=0x1){socket[_0x17ed('0x6f')](_0x17ed('0x87'),{'UserId':Number(_0x40b850[_0x17ed('0x35')]['ids'][_0x17c831]),'WhatsappQueueId':Number(_0x40b850[_0x17ed('0x4c')]['id'])});}}else{socket[_0x17ed('0x6f')]('userWhatsappQueue:remove',{'UserId':Number(_0x40b850[_0x17ed('0x35')][_0x17ed('0x65')]),'WhatsappQueueId':Number(_0x40b850[_0x17ed('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x297f24,null))[_0x17ed('0x4a')](handleError(_0x297f24,null));};exports[_0x17ed('0x8c')]=function(_0x2a3e30,_0x529dce,_0x1445f2){var _0x1612c9={};var _0x21d4a1={};var _0x300650;var _0x1388f0;return db[_0x17ed('0x45')][_0x17ed('0x59')]({'where':{'id':_0x2a3e30[_0x17ed('0x4c')]['id']}})[_0x17ed('0x28')](handleEntityNotFound(_0x529dce,null))[_0x17ed('0x28')](function(_0x1ad22){if(_0x1ad22){_0x300650=_0x1ad22;_0x21d4a1[_0x17ed('0x34')]=_[_0x17ed('0x36')](db[_0x17ed('0x66')]['rawAttributes']);_0x21d4a1[_0x17ed('0x35')]=_[_0x17ed('0x36')](_0x2a3e30['query']);_0x21d4a1[_0x17ed('0x37')]=_[_0x17ed('0x38')](_0x21d4a1[_0x17ed('0x34')],_0x21d4a1['query']);_0x1612c9[_0x17ed('0x3a')]=_['intersection'](_0x21d4a1['model'],qs['fields'](_0x2a3e30['query']['fields']));_0x1612c9['attributes']=_0x1612c9['attributes'][_0x17ed('0x3b')]?_0x1612c9['attributes']:_0x21d4a1[_0x17ed('0x34')];_0x1612c9[_0x17ed('0x3d')]=qs['sort'](_0x2a3e30['query'][_0x17ed('0x3e')]);_0x1612c9[_0x17ed('0x3f')]=qs[_0x17ed('0x37')](_[_0x17ed('0x40')](_0x2a3e30[_0x17ed('0x35')],_0x21d4a1['filters']));if(_0x2a3e30[_0x17ed('0x35')][_0x17ed('0x41')]){_0x1612c9[_0x17ed('0x3f')]=_[_0x17ed('0x43')](_0x1612c9['where'],{'$or':_[_0x17ed('0x2f')](_0x1612c9[_0x17ed('0x3a')],function(_0x23da6b){var _0x41135f={};_0x41135f[_0x23da6b]={'$like':'%'+_0x2a3e30['query']['filter']+'%'};return _0x41135f;})});}_0x1612c9=_['merge']({},_0x1612c9,_0x2a3e30[_0x17ed('0x44')]);return _0x300650[_0x17ed('0x8c')](_0x1612c9);}})[_0x17ed('0x28')](function(_0x2ff6f5){if(_0x2ff6f5){_0x1388f0=_0x2ff6f5[_0x17ed('0x3b')];if(!_0x2a3e30[_0x17ed('0x35')][_0x17ed('0x3c')]('nolimit')){_0x1612c9[_0x17ed('0x21')]=qs[_0x17ed('0x21')](_0x2a3e30[_0x17ed('0x35')][_0x17ed('0x21')]);_0x1612c9[_0x17ed('0x20')]=qs[_0x17ed('0x20')](_0x2a3e30['query']['offset']);}return _0x300650[_0x17ed('0x8c')](_0x1612c9);}})['then'](function(_0x1b09a1){if(_0x1b09a1){return _0x1b09a1?{'count':_0x1388f0,'rows':_0x1b09a1}:null;}})[_0x17ed('0x28')](respondWithResult(_0x529dce,null))[_0x17ed('0x4a')](handleError(_0x529dce,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index e073793..cd604a5 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 _0x8348=['emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove'];(function(_0x28bfb9,_0x5b2938){var _0x3f8956=function(_0x798179){while(--_0x798179){_0x28bfb9['push'](_0x28bfb9['shift']());}};_0x3f8956(++_0x5b2938);}(_0x8348,0x159));var _0x8834=function(_0x3cd9b7,_0x38145b){_0x3cd9b7=_0x3cd9b7-0x0;var _0x590a52=_0x8348[_0x3cd9b7];return _0x590a52;};'use strict';var EventEmitter=require(_0x8834('0x0'));var WhatsappQueue=require(_0x8834('0x1'))['db'][_0x8834('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8834('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8834('0x4'),'afterDestroy':_0x8834('0x5')};function emitEvent(_0x1155fa){return function(_0x2a9ea2,_0x3d4f08,_0x55125a){WhatsappQueueEvents['emit'](_0x1155fa+':'+_0x2a9ea2['id'],_0x2a9ea2);WhatsappQueueEvents[_0x8834('0x6')](_0x1155fa,_0x2a9ea2);_0x55125a(null);};}for(var e in events){if(events[_0x8834('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x8834('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xeb07=['hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit'];(function(_0x416eed,_0x3a2a24){var _0x325487=function(_0x45656c){while(--_0x45656c){_0x416eed['push'](_0x416eed['shift']());}};_0x325487(++_0x3a2a24);}(_0xeb07,0x107));var _0x7eb0=function(_0x2d0d21,_0x37fc35){_0x2d0d21=_0x2d0d21-0x0;var _0x49fa38=_0xeb07[_0x2d0d21];return _0x49fa38;};'use strict';var EventEmitter=require(_0x7eb0('0x0'));var WhatsappQueue=require(_0x7eb0('0x1'))['db'][_0x7eb0('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7eb0('0x3')](0x0);var events={'afterCreate':_0x7eb0('0x4'),'afterUpdate':'update','afterDestroy':_0x7eb0('0x5')};function emitEvent(_0x17367a){return function(_0x86ad66,_0x575fb8,_0xf28950){WhatsappQueueEvents[_0x7eb0('0x6')](_0x17367a+':'+_0x86ad66['id'],_0x86ad66);WhatsappQueueEvents[_0x7eb0('0x6')](_0x17367a,_0x86ad66);_0xf28950(null);};}for(var e in events){if(events[_0x7eb0('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x7eb0('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 70b831d..60f9880 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 _0x2b98=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','api','moment','bluebird','path','rimraf'];(function(_0x2ac336,_0x497d9b){var _0x12ed2c=function(_0x32d148){while(--_0x32d148){_0x2ac336['push'](_0x2ac336['shift']());}};_0x12ed2c(++_0x497d9b);}(_0x2b98,0x11a));var _0x82b9=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x2b98[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x82b9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x82b9('0x1'));var moment=require(_0x82b9('0x2'));var BPromise=require(_0x82b9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82b9('0x4'));var rimraf=require(_0x82b9('0x5'));var config=require(_0x82b9('0x6'));var attributes=require(_0x82b9('0x7'));module[_0x82b9('0x8')]=function(_0x5ae9c3,_0x1289cf){return _0x5ae9c3[_0x82b9('0x9')](_0x82b9('0xa'),attributes,{'tableName':_0x82b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa14a=['whatsapp_queues','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','define','WhatsappQueue'];(function(_0xce4542,_0xd242f){var _0x3466fc=function(_0x3d24eb){while(--_0x3d24eb){_0xce4542['push'](_0xce4542['shift']());}};_0x3466fc(++_0xd242f);}(_0xa14a,0x121));var _0xaa14=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xa14a[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require('lodash');var util=require(_0xaa14('0x0'));var logger=require(_0xaa14('0x1'))('api');var moment=require(_0xaa14('0x2'));var BPromise=require('bluebird');var rp=require(_0xaa14('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa14('0x4'));var config=require(_0xaa14('0x5'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x208930,_0x552c33){return _0x208930[_0xaa14('0x6')](_0xaa14('0x7'),attributes,{'tableName':_0xaa14('0x8'),'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 e260241..75c4402 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 _0x1db2=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','map','include','model','GetWhatsappQueue','ShowWhatsappQueue','WhatsappQueue'];(function(_0x3866a0,_0x501e9a){var _0x4de61c=function(_0x581267){while(--_0x581267){_0x3866a0['push'](_0x3866a0['shift']());}};_0x4de61c(++_0x501e9a);}(_0x1db2,0x1a5));var _0x21db=function(_0x5bd30f,_0x2247cc){_0x5bd30f=_0x5bd30f-0x0;var _0x20332f=_0x1db2[_0x5bd30f];return _0x20332f;};'use strict';var _=require(_0x21db('0x0'));var util=require(_0x21db('0x1'));var moment=require(_0x21db('0x2'));var BPromise=require(_0x21db('0x3'));var rs=require(_0x21db('0x4'));var fs=require('fs');var Redis=require(_0x21db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x21db('0x6'));var logger=require('../../config/logger')(_0x21db('0x7'));var config=require(_0x21db('0x8'));var jayson=require(_0x21db('0x9'));var client=jayson[_0x21db('0xa')][_0x21db('0xb')]({'port':0x232a});config[_0x21db('0xc')]=_[_0x21db('0xd')](config[_0x21db('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x21db('0xe'))(new Redis(config['redis']));require(_0x21db('0xf'))[_0x21db('0x10')](socket);function respondWithRpcPromise(_0x147754,_0x14f82c,_0x5ccdb8){return new BPromise(function(_0x1863ea,_0x5664b0){return client[_0x21db('0x11')](_0x147754,_0x5ccdb8)[_0x21db('0x12')](function(_0x5b800e){logger[_0x21db('0x13')](_0x21db('0x14'),_0x14f82c,_0x21db('0x15'));logger[_0x21db('0x16')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x14f82c,'request\x20sent',JSON[_0x21db('0x17')](_0x5b800e));if(_0x5b800e[_0x21db('0x18')]){if(_0x5b800e[_0x21db('0x18')][_0x21db('0x19')]===0x1f4){logger[_0x21db('0x18')](_0x21db('0x14'),_0x14f82c,_0x5b800e[_0x21db('0x18')][_0x21db('0x1a')]);return _0x5664b0(_0x5b800e['error']['message']);}logger[_0x21db('0x18')](_0x21db('0x14'),_0x14f82c,_0x5b800e[_0x21db('0x18')][_0x21db('0x1a')]);return _0x1863ea(_0x5b800e[_0x21db('0x18')][_0x21db('0x1a')]);}else{logger['info'](_0x21db('0x14'),_0x14f82c,'request\x20sent');_0x1863ea(_0x5b800e[_0x21db('0x1b')][_0x21db('0x1a')]);}})[_0x21db('0x1c')](function(_0x4bc2cb){logger[_0x21db('0x18')](_0x21db('0x14'),_0x14f82c,_0x4bc2cb);_0x5664b0(_0x4bc2cb);});});}exports['GetWhatsappQueue']=function(_0x2daecc){var _0x56de00=this;return new Promise(function(_0x971246,_0x223c69){return db['WhatsappQueue'][_0x21db('0x1d')]({'raw':_0x2daecc[_0x21db('0x1e')]?_0x2daecc[_0x21db('0x1e')][_0x21db('0x1f')]===undefined?!![]:![]:!![],'where':_0x2daecc[_0x21db('0x1e')]?_0x2daecc['options'][_0x21db('0x20')]||null:null,'attributes':_0x2daecc[_0x21db('0x1e')]?_0x2daecc[_0x21db('0x1e')][_0x21db('0x21')]||null:null,'limit':_0x2daecc[_0x21db('0x1e')]?_0x2daecc[_0x21db('0x1e')][_0x21db('0x22')]||null:null,'include':_0x2daecc[_0x21db('0x1e')]?_0x2daecc[_0x21db('0x1e')]['include']?_[_0x21db('0x23')](_0x2daecc['options'][_0x21db('0x24')],function(_0x48badc){return{'model':db[_0x48badc[_0x21db('0x25')]],'as':_0x48badc['as'],'attributes':_0x48badc[_0x21db('0x21')],'include':_0x48badc[_0x21db('0x24')]?_[_0x21db('0x23')](_0x48badc[_0x21db('0x24')],function(_0x7f7d39){return{'model':db[_0x7f7d39[_0x21db('0x25')]],'as':_0x7f7d39['as'],'attributes':_0x7f7d39[_0x21db('0x21')],'include':_0x7f7d39[_0x21db('0x24')]?_[_0x21db('0x23')](_0x7f7d39[_0x21db('0x24')],function(_0x507f47){return{'model':db[_0x507f47['model']],'as':_0x507f47['as'],'attributes':_0x507f47[_0x21db('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x151a60){logger['info'](_0x21db('0x26'),_0x2daecc);logger[_0x21db('0x16')](_0x21db('0x26'),_0x2daecc,JSON[_0x21db('0x17')](_0x151a60));_0x971246(_0x151a60);})[_0x21db('0x1c')](function(_0x2ff9ce){logger[_0x21db('0x18')](_0x21db('0x26'),_0x2ff9ce[_0x21db('0x1a')],_0x2daecc);_0x223c69(_0x56de00[_0x21db('0x18')](0x1f4,_0x2ff9ce['message']));});});};exports[_0x21db('0x27')]=function(_0x40b788){var _0x4f6cd3=this;return new Promise(function(_0x1edfdd,_0x4569d5){return db[_0x21db('0x28')][_0x21db('0x29')]({'raw':_0x40b788[_0x21db('0x1e')]?_0x40b788['options']['raw']===undefined?!![]:![]:!![],'where':_0x40b788[_0x21db('0x1e')]?_0x40b788[_0x21db('0x1e')][_0x21db('0x20')]||null:null,'attributes':_0x40b788['options']?_0x40b788['options'][_0x21db('0x21')]||null:null,'include':_0x40b788[_0x21db('0x1e')]?_0x40b788[_0x21db('0x1e')]['include']?_[_0x21db('0x23')](_0x40b788[_0x21db('0x1e')][_0x21db('0x24')],function(_0x200911){return{'model':db[_0x200911['model']],'as':_0x200911['as'],'attributes':_0x200911[_0x21db('0x21')],'include':_0x200911[_0x21db('0x24')]?_[_0x21db('0x23')](_0x200911['include'],function(_0x364193){return{'model':db[_0x364193[_0x21db('0x25')]],'as':_0x364193['as'],'attributes':_0x364193['attributes'],'include':_0x364193[_0x21db('0x24')]?_[_0x21db('0x23')](_0x364193['include'],function(_0x900d63){return{'model':db[_0x900d63[_0x21db('0x25')]],'as':_0x900d63['as'],'attributes':_0x900d63[_0x21db('0x21')]};}):[]};}):[]};}):[]:[]})[_0x21db('0x12')](function(_0x2ce06c){logger['info'](_0x21db('0x27'),_0x40b788);logger[_0x21db('0x16')](_0x21db('0x27'),_0x40b788,JSON['stringify'](_0x2ce06c));_0x1edfdd(_0x2ce06c);})['catch'](function(_0x3d2963){logger[_0x21db('0x18')](_0x21db('0x27'),_0x3d2963[_0x21db('0x1a')],_0x40b788);_0x4569d5(_0x4f6cd3[_0x21db('0x18')](0x1f4,_0x3d2963[_0x21db('0x1a')]));});});}; \ No newline at end of file +var _0xed73=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','limit','include','map','model','find','ShowWhatsappQueue','lodash','util'];(function(_0x588694,_0x3ffa87){var _0x364f80=function(_0x30d4f4){while(--_0x30d4f4){_0x588694['push'](_0x588694['shift']());}};_0x364f80(++_0x3ffa87);}(_0xed73,0x11d));var _0x3ed7=function(_0x2c44a9,_0xc4b265){_0x2c44a9=_0x2c44a9-0x0;var _0x4e22d4=_0xed73[_0x2c44a9];return _0x4e22d4;};'use strict';var _=require(_0x3ed7('0x0'));var util=require(_0x3ed7('0x1'));var moment=require('moment');var BPromise=require(_0x3ed7('0x2'));var rs=require(_0x3ed7('0x3'));var fs=require('fs');var Redis=require(_0x3ed7('0x4'));var db=require(_0x3ed7('0x5'))['db'];var utils=require(_0x3ed7('0x6'));var logger=require(_0x3ed7('0x7'))(_0x3ed7('0x8'));var config=require(_0x3ed7('0x9'));var jayson=require(_0x3ed7('0xa'));var client=jayson[_0x3ed7('0xb')][_0x3ed7('0xc')]({'port':0x232a});config[_0x3ed7('0xd')]=_[_0x3ed7('0xe')](config['redis'],{'host':_0x3ed7('0xf'),'port':0x18eb});var socket=require(_0x3ed7('0x10'))(new Redis(config[_0x3ed7('0xd')]));require('./whatsappQueue.socket')[_0x3ed7('0x11')](socket);function respondWithRpcPromise(_0x5882df,_0x91c950,_0x575d8c){return new BPromise(function(_0x5147ff,_0x20f8a6){return client[_0x3ed7('0x12')](_0x5882df,_0x575d8c)[_0x3ed7('0x13')](function(_0x36e58c){logger[_0x3ed7('0x14')](_0x3ed7('0x15'),_0x91c950,_0x3ed7('0x16'));logger[_0x3ed7('0x17')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x91c950,_0x3ed7('0x16'),JSON[_0x3ed7('0x18')](_0x36e58c));if(_0x36e58c['error']){if(_0x36e58c[_0x3ed7('0x19')][_0x3ed7('0x1a')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x91c950,_0x36e58c[_0x3ed7('0x19')][_0x3ed7('0x1b')]);return _0x20f8a6(_0x36e58c['error']['message']);}logger[_0x3ed7('0x19')](_0x3ed7('0x15'),_0x91c950,_0x36e58c[_0x3ed7('0x19')][_0x3ed7('0x1b')]);return _0x5147ff(_0x36e58c['error'][_0x3ed7('0x1b')]);}else{logger[_0x3ed7('0x14')](_0x3ed7('0x15'),_0x91c950,'request\x20sent');_0x5147ff(_0x36e58c[_0x3ed7('0x1c')][_0x3ed7('0x1b')]);}})[_0x3ed7('0x1d')](function(_0x42dd98){logger[_0x3ed7('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x91c950,_0x42dd98);_0x20f8a6(_0x42dd98);});});}exports[_0x3ed7('0x1e')]=function(_0x5a544b){var _0x23837d=this;return new Promise(function(_0x2eaf1e,_0x1cede7){return db[_0x3ed7('0x1f')][_0x3ed7('0x20')]({'raw':_0x5a544b[_0x3ed7('0x21')]?_0x5a544b[_0x3ed7('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x5a544b[_0x3ed7('0x21')]?_0x5a544b[_0x3ed7('0x21')]['where']||null:null,'attributes':_0x5a544b[_0x3ed7('0x21')]?_0x5a544b['options'][_0x3ed7('0x22')]||null:null,'limit':_0x5a544b[_0x3ed7('0x21')]?_0x5a544b['options'][_0x3ed7('0x23')]||null:null,'include':_0x5a544b[_0x3ed7('0x21')]?_0x5a544b['options'][_0x3ed7('0x24')]?_[_0x3ed7('0x25')](_0x5a544b[_0x3ed7('0x21')][_0x3ed7('0x24')],function(_0x557130){return{'model':db[_0x557130[_0x3ed7('0x26')]],'as':_0x557130['as'],'attributes':_0x557130[_0x3ed7('0x22')],'include':_0x557130['include']?_[_0x3ed7('0x25')](_0x557130[_0x3ed7('0x24')],function(_0x17cd0e){return{'model':db[_0x17cd0e[_0x3ed7('0x26')]],'as':_0x17cd0e['as'],'attributes':_0x17cd0e[_0x3ed7('0x22')],'include':_0x17cd0e[_0x3ed7('0x24')]?_[_0x3ed7('0x25')](_0x17cd0e['include'],function(_0x5ab534){return{'model':db[_0x5ab534['model']],'as':_0x5ab534['as'],'attributes':_0x5ab534['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f6b93){logger[_0x3ed7('0x14')]('GetWhatsappQueue',_0x5a544b);logger['debug'](_0x3ed7('0x1e'),_0x5a544b,JSON[_0x3ed7('0x18')](_0x1f6b93));_0x2eaf1e(_0x1f6b93);})[_0x3ed7('0x1d')](function(_0x44981a){logger[_0x3ed7('0x19')](_0x3ed7('0x1e'),_0x44981a[_0x3ed7('0x1b')],_0x5a544b);_0x1cede7(_0x23837d['error'](0x1f4,_0x44981a[_0x3ed7('0x1b')]));});});};exports['ShowWhatsappQueue']=function(_0x2444c1){var _0x2eacd9=this;return new Promise(function(_0xd8ba8c,_0x5499dc){return db['WhatsappQueue'][_0x3ed7('0x27')]({'raw':_0x2444c1['options']?_0x2444c1[_0x3ed7('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x2444c1[_0x3ed7('0x21')]?_0x2444c1[_0x3ed7('0x21')]['where']||null:null,'attributes':_0x2444c1[_0x3ed7('0x21')]?_0x2444c1[_0x3ed7('0x21')][_0x3ed7('0x22')]||null:null,'include':_0x2444c1[_0x3ed7('0x21')]?_0x2444c1['options'][_0x3ed7('0x24')]?_['map'](_0x2444c1[_0x3ed7('0x21')][_0x3ed7('0x24')],function(_0x2bc71e){return{'model':db[_0x2bc71e[_0x3ed7('0x26')]],'as':_0x2bc71e['as'],'attributes':_0x2bc71e[_0x3ed7('0x22')],'include':_0x2bc71e[_0x3ed7('0x24')]?_[_0x3ed7('0x25')](_0x2bc71e[_0x3ed7('0x24')],function(_0x396590){return{'model':db[_0x396590['model']],'as':_0x396590['as'],'attributes':_0x396590[_0x3ed7('0x22')],'include':_0x396590[_0x3ed7('0x24')]?_[_0x3ed7('0x25')](_0x396590[_0x3ed7('0x24')],function(_0x11a21a){return{'model':db[_0x11a21a[_0x3ed7('0x26')]],'as':_0x11a21a['as'],'attributes':_0x11a21a[_0x3ed7('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3ed7('0x13')](function(_0x4d511c){logger[_0x3ed7('0x14')](_0x3ed7('0x28'),_0x2444c1);logger[_0x3ed7('0x17')]('ShowWhatsappQueue',_0x2444c1,JSON['stringify'](_0x4d511c));_0xd8ba8c(_0x4d511c);})[_0x3ed7('0x1d')](function(_0x503375){logger['error'](_0x3ed7('0x28'),_0x503375[_0x3ed7('0x1b')],_0x2444c1);_0x5499dc(_0x2eacd9['error'](0x1f4,_0x503375['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index bfd1773..7e93fe4 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 _0x92bb=['save','remove','emit','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x250166,_0x548ffd){var _0x18968c=function(_0x3a78ae){while(--_0x3a78ae){_0x250166['push'](_0x250166['shift']());}};_0x18968c(++_0x548ffd);}(_0x92bb,0x1cd));var _0xb92b=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0x92bb[_0x46a3ff];return _0x404bc2;};'use strict';var WhatsappQueueEvents=require(_0xb92b('0x0'));var events=[_0xb92b('0x1'),_0xb92b('0x2'),'update'];function createListener(_0x5a69cb,_0x58b9a8){return function(_0x4e990c){_0x58b9a8[_0xb92b('0x3')](_0x5a69cb,_0x4e990c);};}function removeListener(_0x33e0d1,_0x4caee0){return function(){WhatsappQueueEvents['removeListener'](_0x33e0d1,_0x4caee0);};}exports[_0xb92b('0x4')]=function(_0x385a40){for(var _0x18731a=0x0,_0x51dcea=events[_0xb92b('0x5')];_0x18731a<_0x51dcea;_0x18731a++){var _0x594fbe=events[_0x18731a];var _0x51bcc1=createListener(_0xb92b('0x6')+_0x594fbe,_0x385a40);WhatsappQueueEvents['on'](_0x594fbe,_0x51bcc1);}}; \ No newline at end of file +var _0x2ba4=['./whatsappQueue.events','save','remove','update','emit','removeListener','length','whatsappQueue:'];(function(_0x27cae4,_0x1fe454){var _0x468f66=function(_0x299ed4){while(--_0x299ed4){_0x27cae4['push'](_0x27cae4['shift']());}};_0x468f66(++_0x1fe454);}(_0x2ba4,0x148));var _0x42ba=function(_0x1b5bed,_0x4c646b){_0x1b5bed=_0x1b5bed-0x0;var _0x1169db=_0x2ba4[_0x1b5bed];return _0x1169db;};'use strict';var WhatsappQueueEvents=require(_0x42ba('0x0'));var events=[_0x42ba('0x1'),_0x42ba('0x2'),_0x42ba('0x3')];function createListener(_0xbcd3b4,_0x359511){return function(_0x12f494){_0x359511[_0x42ba('0x4')](_0xbcd3b4,_0x12f494);};}function removeListener(_0x35d159,_0x31c4ca){return function(){WhatsappQueueEvents[_0x42ba('0x5')](_0x35d159,_0x31c4ca);};}exports['register']=function(_0x132e8a){for(var _0x55a4ce=0x0,_0x352d6a=events[_0x42ba('0x6')];_0x55a4ce<_0x352d6a;_0x55a4ce++){var _0x151e38=events[_0x55a4ce];var _0xc3bd92=createListener(_0x42ba('0x7')+_0x151e38,_0x132e8a);WhatsappQueueEvents['on'](_0x151e38,_0xc3bd92);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 4c2e6d4..bdc6c57 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 _0x8d41=['create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','show','post'];(function(_0x2bf677,_0x2fc095){var _0x28a0c3=function(_0x3d8633){while(--_0x3d8633){_0x2bf677['push'](_0x2bf677['shift']());}};_0x28a0c3(++_0x2fc095);}(_0x8d41,0x1aa));var _0x18d4=function(_0x4f03ce,_0x5cb284){_0x4f03ce=_0x4f03ce-0x0;var _0x52acd1=_0x8d41[_0x4f03ce];return _0x52acd1;};'use strict';var multer=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var path=require(_0x18d4('0x2'));var timeout=require(_0x18d4('0x3'));var express=require(_0x18d4('0x4'));var router=express['Router']();var auth=require(_0x18d4('0x5'));var interaction=require(_0x18d4('0x6'));var config=require(_0x18d4('0x7'));var controller=require(_0x18d4('0x8'));router[_0x18d4('0x9')]('/',auth['isAuthenticated'](),controller[_0x18d4('0xa')]);router[_0x18d4('0x9')](_0x18d4('0xb'),auth[_0x18d4('0xc')](),controller['describe']);router[_0x18d4('0x9')]('/:id',auth[_0x18d4('0xc')](),controller[_0x18d4('0xd')]);router[_0x18d4('0xe')]('/',auth[_0x18d4('0xc')](),controller[_0x18d4('0xf')]);router[_0x18d4('0x10')](_0x18d4('0x11'),auth['isAuthenticated'](),controller[_0x18d4('0x12')]);router[_0x18d4('0x13')](_0x18d4('0x11'),auth[_0x18d4('0xc')](),controller['destroy']);module[_0x18d4('0x14')]=router; \ No newline at end of file +var _0x4649=['index','/describe','isAuthenticated','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x97bcb8,_0x42b59d){var _0x3ca270=function(_0xd0b8c1){while(--_0xd0b8c1){_0x97bcb8['push'](_0x97bcb8['shift']());}};_0x3ca270(++_0x42b59d);}(_0x4649,0x199));var _0x9464=function(_0x1f235b,_0x5a0347){_0x1f235b=_0x1f235b-0x0;var _0x2817f4=_0x4649[_0x1f235b];return _0x2817f4;};'use strict';var multer=require(_0x9464('0x0'));var util=require('util');var path=require(_0x9464('0x1'));var timeout=require(_0x9464('0x2'));var express=require(_0x9464('0x3'));var router=express[_0x9464('0x4')]();var auth=require(_0x9464('0x5'));var interaction=require(_0x9464('0x6'));var config=require(_0x9464('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x9464('0x8')]('/',auth['isAuthenticated'](),controller[_0x9464('0x9')]);router[_0x9464('0x8')](_0x9464('0xa'),auth[_0x9464('0xb')](),controller['describe']);router[_0x9464('0x8')](_0x9464('0xc'),auth[_0x9464('0xb')](),controller[_0x9464('0xd')]);router[_0x9464('0xe')]('/',auth['isAuthenticated'](),controller[_0x9464('0xf')]);router['put'](_0x9464('0xc'),auth[_0x9464('0xb')](),controller[_0x9464('0x10')]);router[_0x9464('0x11')](_0x9464('0xc'),auth[_0x9464('0xb')](),controller['destroy']);module[_0x9464('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 11f5340..c4d1825 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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x182058,_0x4346e6){var _0xe53171=function(_0x1cb2e9){while(--_0x1cb2e9){_0x182058['push'](_0x182058['shift']());}};_0xe53171(++_0x4346e6);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x008c=['sequelize','exports','STRING','DATE'];(function(_0x2aee0e,_0x4f139e){var _0x5a2d6e=function(_0x2889fe){while(--_0x2889fe){_0x2aee0e['push'](_0x2aee0e['shift']());}};_0x5a2d6e(++_0x4f139e);}(_0x008c,0x188));var _0xc008=function(_0x387b44,_0x3ad1ba){_0x387b44=_0x387b44-0x0;var _0x55ff2d=_0x008c[_0x387b44];return _0x55ff2d;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'uniqueid':{'type':Sequelize[_0xc008('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc008('0x2')]},'joinAt':{'type':Sequelize[_0xc008('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc008('0x3')]},'exitAt':{'type':Sequelize[_0xc008('0x3')]},'reason':{'type':Sequelize[_0xc008('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index a1b61fa..bfe1188 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 _0x014c=['key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x014c,0x17b));var _0xc014=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0x014c[_0x4c3070];return _0x536a44;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc014('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc014('0x1'));var jsonpatch=require(_0xc014('0x2'));var rp=require(_0xc014('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc014('0x4'));var util=require(_0xc014('0x5'));var path=require(_0xc014('0x6'));var sox=require(_0xc014('0x7'));var csv=require(_0xc014('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc014('0x9'));var squel=require(_0xc014('0xa'));var crypto=require('crypto');var jsforce=require(_0xc014('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc014('0x8'));var querystring=require(_0xc014('0xc'));var Papa=require(_0xc014('0xd'));var Redis=require('ioredis');var authService=require(_0xc014('0xe'));var qs=require(_0xc014('0xf'));var as=require(_0xc014('0x10'));var hardwareService=require(_0xc014('0x11'));var logger=require('../../config/logger')(_0xc014('0x12'));var utils=require('../../config/utils');var config=require(_0xc014('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ae990,_0xcde2d3){_0xcde2d3=_0xcde2d3||0xcc;return function(_0x2f8ac9){if(_0x2f8ac9){return _0x2ae990[_0xc014('0x14')](_0xcde2d3);}return _0x2ae990['status'](_0xcde2d3)[_0xc014('0x15')]();};}function respondWithResult(_0x300aaf,_0xe86dd){_0xe86dd=_0xe86dd||0xc8;return function(_0x5ced7d){if(_0x5ced7d){return _0x300aaf[_0xc014('0x16')](_0xe86dd)['json'](_0x5ced7d);}};}function respondWithFilteredResult(_0x458195,_0x1c4d3b){return function(_0x25fdf6){if(_0x25fdf6){var _0x26f264=_0x25fdf6[_0xc014('0x17')],_0x9f6a26=_0x1c4d3b[_0xc014('0x18')],_0x9791b9=_0x1c4d3b[_0xc014('0x18')]+_0x1c4d3b[_0xc014('0x19')],_0x4aa669;if(_0x9791b9>=_0x26f264){_0x9791b9=_0x26f264;_0x4aa669=0xc8;}else{_0x4aa669=0xce;}_0x458195['status'](_0x4aa669);return _0x458195['set'](_0xc014('0x1a'),_0x9f6a26+'-'+_0x9791b9+'/'+_0x26f264)['json'](_0x25fdf6);}return null;};}function patchUpdates(_0x5226ee){return function(_0x2261b0){try{jsonpatch[_0xc014('0x1b')](_0x2261b0,_0x5226ee,!![]);}catch(_0x4a3823){return BPromise[_0xc014('0x1c')](_0x4a3823);}return _0x2261b0[_0xc014('0x1d')]();};}function saveUpdates(_0x391a07,_0x2dac66){return function(_0x1078c4){if(_0x1078c4){return _0x1078c4['update'](_0x391a07)[_0xc014('0x1e')](function(_0x294c11){return _0x294c11;});}return null;};}function removeEntity(_0x31a349,_0x3c58cc){return function(_0x450b22){if(_0x450b22){return _0x450b22[_0xc014('0x1f')]()[_0xc014('0x1e')](function(){_0x31a349['status'](0xcc)[_0xc014('0x15')]();});}};}function handleEntityNotFound(_0x1b905d,_0x16d8f9){return function(_0x174b46){if(!_0x174b46){_0x1b905d[_0xc014('0x14')](0x194);}return _0x174b46;};}function handleError(_0x144e11,_0x204ea0){_0x204ea0=_0x204ea0||0x1f4;return function(_0x3219e7){logger[_0xc014('0x20')](_0x3219e7[_0xc014('0x21')]);if(_0x3219e7['name']){delete _0x3219e7[_0xc014('0x22')];}_0x144e11[_0xc014('0x16')](_0x204ea0)[_0xc014('0x23')](_0x3219e7);};}exports[_0xc014('0x24')]=function(_0x30fd7d,_0x5676a3){var _0x6d0d83={},_0x382a6d={},_0x433aa4={'count':0x0,'rows':[]};var _0x12bc24=_['map'](db[_0xc014('0x25')][_0xc014('0x26')],function(_0x151705){return{'name':_0x151705[_0xc014('0x27')],'type':_0x151705[_0xc014('0x28')][_0xc014('0x29')]};});_0x382a6d[_0xc014('0x2a')]=_[_0xc014('0x2b')](_0x12bc24,_0xc014('0x22'));_0x382a6d[_0xc014('0x2c')]=_[_0xc014('0x2d')](_0x30fd7d['query']);_0x382a6d[_0xc014('0x2e')]=_['intersection'](_0x382a6d['model'],_0x382a6d['query']);_0x6d0d83[_0xc014('0x2f')]=_[_0xc014('0x30')](_0x382a6d['model'],qs[_0xc014('0x31')](_0x30fd7d[_0xc014('0x2c')][_0xc014('0x31')]));_0x6d0d83[_0xc014('0x2f')]=_0x6d0d83[_0xc014('0x2f')][_0xc014('0x32')]?_0x6d0d83[_0xc014('0x2f')]:_0x382a6d[_0xc014('0x2a')];if(!_0x30fd7d[_0xc014('0x2c')][_0xc014('0x33')](_0xc014('0x34'))){_0x6d0d83[_0xc014('0x19')]=qs['limit'](_0x30fd7d[_0xc014('0x2c')]['limit']);_0x6d0d83[_0xc014('0x18')]=qs[_0xc014('0x18')](_0x30fd7d[_0xc014('0x2c')][_0xc014('0x18')]);}_0x6d0d83[_0xc014('0x35')]=qs[_0xc014('0x36')](_0x30fd7d[_0xc014('0x2c')]['sort']);_0x6d0d83[_0xc014('0x37')]=qs['filters'](_[_0xc014('0x38')](_0x30fd7d[_0xc014('0x2c')],_0x382a6d[_0xc014('0x2e')]),_0x12bc24);if(_0x30fd7d[_0xc014('0x2c')][_0xc014('0x39')]){_0x6d0d83[_0xc014('0x37')]=_[_0xc014('0x3a')](_0x6d0d83['where'],{'$or':_[_0xc014('0x2b')](_0x12bc24,function(_0xef647b){if(_0xef647b[_0xc014('0x28')]!=='VIRTUAL'){var _0x11ac76={};_0x11ac76[_0xef647b[_0xc014('0x22')]]={'$like':'%'+_0x30fd7d[_0xc014('0x2c')]['filter']+'%'};return _0x11ac76;}})});}_0x6d0d83=_[_0xc014('0x3a')]({},_0x6d0d83,_0x30fd7d['options']);var _0x2b17fe={'where':_0x6d0d83[_0xc014('0x37')]};return db[_0xc014('0x25')][_0xc014('0x17')](_0x2b17fe)[_0xc014('0x1e')](function(_0xc62c13){_0x433aa4[_0xc014('0x17')]=_0xc62c13;if(_0x30fd7d[_0xc014('0x2c')][_0xc014('0x3b')]){_0x6d0d83[_0xc014('0x3c')]=[{'all':!![]}];}return db[_0xc014('0x25')][_0xc014('0x3d')](_0x6d0d83);})['then'](function(_0x28fdce){_0x433aa4[_0xc014('0x3e')]=_0x28fdce;return _0x433aa4;})[_0xc014('0x1e')](respondWithFilteredResult(_0x5676a3,_0x6d0d83))[_0xc014('0x3f')](handleError(_0x5676a3,null));};exports['show']=function(_0x8fcec9,_0x553fb1){var _0x3a7f90={'raw':!![],'where':{'id':_0x8fcec9[_0xc014('0x40')]['id']}},_0x147d69={};_0x147d69[_0xc014('0x2a')]=_[_0xc014('0x2d')](db[_0xc014('0x25')][_0xc014('0x26')]);_0x147d69[_0xc014('0x2c')]=_[_0xc014('0x2d')](_0x8fcec9[_0xc014('0x2c')]);_0x147d69[_0xc014('0x2e')]=_['intersection'](_0x147d69[_0xc014('0x2a')],_0x147d69['query']);_0x3a7f90['attributes']=_[_0xc014('0x30')](_0x147d69[_0xc014('0x2a')],qs[_0xc014('0x31')](_0x8fcec9[_0xc014('0x2c')][_0xc014('0x31')]));_0x3a7f90['attributes']=_0x3a7f90[_0xc014('0x2f')][_0xc014('0x32')]?_0x3a7f90['attributes']:_0x147d69[_0xc014('0x2a')];if(_0x8fcec9[_0xc014('0x2c')][_0xc014('0x3b')]){_0x3a7f90[_0xc014('0x3c')]=[{'all':!![]}];}_0x3a7f90=_[_0xc014('0x3a')]({},_0x3a7f90,_0x8fcec9[_0xc014('0x41')]);return db[_0xc014('0x25')][_0xc014('0x42')](_0x3a7f90)[_0xc014('0x1e')](handleEntityNotFound(_0x553fb1,null))['then'](respondWithResult(_0x553fb1,null))[_0xc014('0x3f')](handleError(_0x553fb1,null));};exports[_0xc014('0x43')]=function(_0x3dd71b,_0x2b0b1d){return db[_0xc014('0x25')][_0xc014('0x43')](_0x3dd71b[_0xc014('0x44')],{})[_0xc014('0x1e')](respondWithResult(_0x2b0b1d,0xc9))[_0xc014('0x3f')](handleError(_0x2b0b1d,null));};exports['update']=function(_0x2ce299,_0x49fe09){if(_0x2ce299['body']['id']){delete _0x2ce299[_0xc014('0x44')]['id'];}return db['WhatsappQueueReport'][_0xc014('0x42')]({'where':{'id':_0x2ce299[_0xc014('0x40')]['id']}})['then'](handleEntityNotFound(_0x49fe09,null))[_0xc014('0x1e')](saveUpdates(_0x2ce299[_0xc014('0x44')],null))[_0xc014('0x1e')](respondWithResult(_0x49fe09,null))[_0xc014('0x3f')](handleError(_0x49fe09,null));};exports[_0xc014('0x1f')]=function(_0x2d5bfc,_0x59e63a){return db[_0xc014('0x25')][_0xc014('0x42')]({'where':{'id':_0x2d5bfc[_0xc014('0x40')]['id']}})[_0xc014('0x1e')](handleEntityNotFound(_0x59e63a,null))[_0xc014('0x1e')](removeEntity(_0x59e63a,null))[_0xc014('0x3f')](handleError(_0x59e63a,null));};exports[_0xc014('0x45')]=function(_0x14af79,_0x3ee079){return db[_0xc014('0x25')]['describe']()[_0xc014('0x1e')](respondWithResult(_0x3ee079,null))[_0xc014('0x3f')](handleError(_0x3ee079,null));}; \ No newline at end of file +var _0x7d8a=['filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','sendStatus','error','stack','name','index','WhatsappQueueReport','rawAttributes','type','key','model','query'];(function(_0x1a2ef3,_0x21186c){var _0x34f4a4=function(_0x277126){while(--_0x277126){_0x1a2ef3['push'](_0x1a2ef3['shift']());}};_0x34f4a4(++_0x21186c);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x7d8a[_0x59bcb1];return _0x4a737f;};'use strict';var pdf=require(_0xa7d8('0x0'));var emlformat=require(_0xa7d8('0x1'));var rimraf=require(_0xa7d8('0x2'));var zipdir=require(_0xa7d8('0x3'));var jsonpatch=require(_0xa7d8('0x4'));var rp=require(_0xa7d8('0x5'));var moment=require(_0xa7d8('0x6'));var BPromise=require(_0xa7d8('0x7'));var Mustache=require(_0xa7d8('0x8'));var util=require(_0xa7d8('0x9'));var path=require(_0xa7d8('0xa'));var sox=require(_0xa7d8('0xb'));var csv=require(_0xa7d8('0xc'));var ejs=require(_0xa7d8('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa7d8('0xe'));var crypto=require(_0xa7d8('0xf'));var jsforce=require(_0xa7d8('0x10'));var deskjs=require(_0xa7d8('0x11'));var toCsv=require(_0xa7d8('0xc'));var querystring=require('querystring');var Papa=require(_0xa7d8('0x12'));var Redis=require('ioredis');var authService=require(_0xa7d8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa7d8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7d8('0x15'))(_0xa7d8('0x16'));var utils=require('../../config/utils');var config=require(_0xa7d8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1d5d,_0x161829){_0x161829=_0x161829||0xcc;return function(_0x133a94){if(_0x133a94){return _0x3c1d5d['sendStatus'](_0x161829);}return _0x3c1d5d[_0xa7d8('0x18')](_0x161829)[_0xa7d8('0x19')]();};}function respondWithResult(_0x5c8151,_0x5bfb1a){_0x5bfb1a=_0x5bfb1a||0xc8;return function(_0x5080d6){if(_0x5080d6){return _0x5c8151[_0xa7d8('0x18')](_0x5bfb1a)[_0xa7d8('0x1a')](_0x5080d6);}};}function respondWithFilteredResult(_0x4835e9,_0x2d126b){return function(_0x3452d0){if(_0x3452d0){var _0x2ae530=_0x3452d0[_0xa7d8('0x1b')],_0x2bbaf4=_0x2d126b[_0xa7d8('0x1c')],_0x21bc56=_0x2d126b[_0xa7d8('0x1c')]+_0x2d126b[_0xa7d8('0x1d')],_0x42e957;if(_0x21bc56>=_0x2ae530){_0x21bc56=_0x2ae530;_0x42e957=0xc8;}else{_0x42e957=0xce;}_0x4835e9['status'](_0x42e957);return _0x4835e9[_0xa7d8('0x1e')](_0xa7d8('0x1f'),_0x2bbaf4+'-'+_0x21bc56+'/'+_0x2ae530)['json'](_0x3452d0);}return null;};}function patchUpdates(_0x7c59b4){return function(_0x4114e7){try{jsonpatch[_0xa7d8('0x20')](_0x4114e7,_0x7c59b4,!![]);}catch(_0xc299a){return BPromise['reject'](_0xc299a);}return _0x4114e7[_0xa7d8('0x21')]();};}function saveUpdates(_0x5ec4d4,_0x33f117){return function(_0xa6614a){if(_0xa6614a){return _0xa6614a['update'](_0x5ec4d4)[_0xa7d8('0x22')](function(_0x108a6d){return _0x108a6d;});}return null;};}function removeEntity(_0x34b1ba,_0x426a20){return function(_0x46d9a9){if(_0x46d9a9){return _0x46d9a9['destroy']()[_0xa7d8('0x22')](function(){_0x34b1ba[_0xa7d8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c33f8,_0x31afb8){return function(_0x4a3fd6){if(!_0x4a3fd6){_0x2c33f8[_0xa7d8('0x23')](0x194);}return _0x4a3fd6;};}function handleError(_0x3f02a5,_0xac9707){_0xac9707=_0xac9707||0x1f4;return function(_0x22a1f2){logger[_0xa7d8('0x24')](_0x22a1f2[_0xa7d8('0x25')]);if(_0x22a1f2[_0xa7d8('0x26')]){delete _0x22a1f2['name'];}_0x3f02a5[_0xa7d8('0x18')](_0xac9707)['send'](_0x22a1f2);};}exports[_0xa7d8('0x27')]=function(_0x529df7,_0x53c475){var _0x5d3fef={},_0x491fa0={},_0x45b800={'count':0x0,'rows':[]};var _0xe0d256=_['map'](db[_0xa7d8('0x28')][_0xa7d8('0x29')],function(_0x31b73d){return{'name':_0x31b73d['fieldName'],'type':_0x31b73d[_0xa7d8('0x2a')][_0xa7d8('0x2b')]};});_0x491fa0[_0xa7d8('0x2c')]=_['map'](_0xe0d256,_0xa7d8('0x26'));_0x491fa0[_0xa7d8('0x2d')]=_['keys'](_0x529df7['query']);_0x491fa0[_0xa7d8('0x2e')]=_[_0xa7d8('0x2f')](_0x491fa0[_0xa7d8('0x2c')],_0x491fa0['query']);_0x5d3fef['attributes']=_['intersection'](_0x491fa0[_0xa7d8('0x2c')],qs[_0xa7d8('0x30')](_0x529df7['query'][_0xa7d8('0x30')]));_0x5d3fef['attributes']=_0x5d3fef[_0xa7d8('0x31')]['length']?_0x5d3fef[_0xa7d8('0x31')]:_0x491fa0[_0xa7d8('0x2c')];if(!_0x529df7[_0xa7d8('0x2d')]['hasOwnProperty'](_0xa7d8('0x32'))){_0x5d3fef[_0xa7d8('0x1d')]=qs[_0xa7d8('0x1d')](_0x529df7[_0xa7d8('0x2d')][_0xa7d8('0x1d')]);_0x5d3fef[_0xa7d8('0x1c')]=qs[_0xa7d8('0x1c')](_0x529df7[_0xa7d8('0x2d')][_0xa7d8('0x1c')]);}_0x5d3fef[_0xa7d8('0x33')]=qs[_0xa7d8('0x34')](_0x529df7['query'][_0xa7d8('0x34')]);_0x5d3fef[_0xa7d8('0x35')]=qs[_0xa7d8('0x2e')](_[_0xa7d8('0x36')](_0x529df7[_0xa7d8('0x2d')],_0x491fa0['filters']),_0xe0d256);if(_0x529df7[_0xa7d8('0x2d')][_0xa7d8('0x37')]){_0x5d3fef[_0xa7d8('0x35')]=_[_0xa7d8('0x38')](_0x5d3fef[_0xa7d8('0x35')],{'$or':_[_0xa7d8('0x39')](_0xe0d256,function(_0x194d01){if(_0x194d01[_0xa7d8('0x2a')]!==_0xa7d8('0x3a')){var _0x168478={};_0x168478[_0x194d01[_0xa7d8('0x26')]]={'$like':'%'+_0x529df7[_0xa7d8('0x2d')]['filter']+'%'};return _0x168478;}})});}_0x5d3fef=_['merge']({},_0x5d3fef,_0x529df7[_0xa7d8('0x3b')]);var _0x47d15b={'where':_0x5d3fef[_0xa7d8('0x35')]};return db['WhatsappQueueReport'][_0xa7d8('0x1b')](_0x47d15b)[_0xa7d8('0x22')](function(_0xa83e3b){_0x45b800[_0xa7d8('0x1b')]=_0xa83e3b;if(_0x529df7[_0xa7d8('0x2d')]['includeAll']){_0x5d3fef[_0xa7d8('0x3c')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xa7d8('0x3d')](_0x5d3fef);})['then'](function(_0x107e80){_0x45b800[_0xa7d8('0x3e')]=_0x107e80;return _0x45b800;})[_0xa7d8('0x22')](respondWithFilteredResult(_0x53c475,_0x5d3fef))[_0xa7d8('0x3f')](handleError(_0x53c475,null));};exports[_0xa7d8('0x40')]=function(_0x13e9f2,_0x46bf3d){var _0x1b5e33={'raw':!![],'where':{'id':_0x13e9f2[_0xa7d8('0x41')]['id']}},_0x2ef2be={};_0x2ef2be[_0xa7d8('0x2c')]=_[_0xa7d8('0x42')](db[_0xa7d8('0x28')]['rawAttributes']);_0x2ef2be['query']=_[_0xa7d8('0x42')](_0x13e9f2[_0xa7d8('0x2d')]);_0x2ef2be[_0xa7d8('0x2e')]=_[_0xa7d8('0x2f')](_0x2ef2be[_0xa7d8('0x2c')],_0x2ef2be['query']);_0x1b5e33[_0xa7d8('0x31')]=_[_0xa7d8('0x2f')](_0x2ef2be[_0xa7d8('0x2c')],qs[_0xa7d8('0x30')](_0x13e9f2['query']['fields']));_0x1b5e33['attributes']=_0x1b5e33[_0xa7d8('0x31')]['length']?_0x1b5e33[_0xa7d8('0x31')]:_0x2ef2be[_0xa7d8('0x2c')];if(_0x13e9f2[_0xa7d8('0x2d')]['includeAll']){_0x1b5e33['include']=[{'all':!![]}];}_0x1b5e33=_[_0xa7d8('0x38')]({},_0x1b5e33,_0x13e9f2[_0xa7d8('0x3b')]);return db[_0xa7d8('0x28')][_0xa7d8('0x43')](_0x1b5e33)[_0xa7d8('0x22')](handleEntityNotFound(_0x46bf3d,null))[_0xa7d8('0x22')](respondWithResult(_0x46bf3d,null))[_0xa7d8('0x3f')](handleError(_0x46bf3d,null));};exports[_0xa7d8('0x44')]=function(_0x362917,_0x3ec45c){return db[_0xa7d8('0x28')][_0xa7d8('0x44')](_0x362917['body'],{})[_0xa7d8('0x22')](respondWithResult(_0x3ec45c,0xc9))['catch'](handleError(_0x3ec45c,null));};exports[_0xa7d8('0x45')]=function(_0x5666e6,_0x16321c){if(_0x5666e6[_0xa7d8('0x46')]['id']){delete _0x5666e6[_0xa7d8('0x46')]['id'];}return db[_0xa7d8('0x28')][_0xa7d8('0x43')]({'where':{'id':_0x5666e6[_0xa7d8('0x41')]['id']}})['then'](handleEntityNotFound(_0x16321c,null))[_0xa7d8('0x22')](saveUpdates(_0x5666e6[_0xa7d8('0x46')],null))['then'](respondWithResult(_0x16321c,null))['catch'](handleError(_0x16321c,null));};exports['destroy']=function(_0x4c2eae,_0x3e089c){return db['WhatsappQueueReport'][_0xa7d8('0x43')]({'where':{'id':_0x4c2eae[_0xa7d8('0x41')]['id']}})[_0xa7d8('0x22')](handleEntityNotFound(_0x3e089c,null))['then'](removeEntity(_0x3e089c,null))['catch'](handleError(_0x3e089c,null));};exports['describe']=function(_0x23e6df,_0x1688b3){return db[_0xa7d8('0x28')][_0xa7d8('0x47')]()[_0xa7d8('0x22')](respondWithResult(_0x1688b3,null))[_0xa7d8('0x3f')](handleError(_0x1688b3,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ff80428..bd52290 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 _0xde76=['util','../../config/logger','api','moment','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x5a2d95,_0xb362e5){var _0x2c3986=function(_0x5cce7c){while(--_0x5cce7c){_0x5a2d95['push'](_0x5a2d95['shift']());}};_0x2c3986(++_0xb362e5);}(_0xde76,0xe9));var _0x6de7=function(_0x5b7a24,_0x2092bd){_0x5b7a24=_0x5b7a24-0x0;var _0x4a797a=_0xde76[_0x5b7a24];return _0x4a797a;};'use strict';var _=require(_0x6de7('0x0'));var util=require(_0x6de7('0x1'));var logger=require(_0x6de7('0x2'))(_0x6de7('0x3'));var moment=require(_0x6de7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6de7('0x5'));var config=require(_0x6de7('0x6'));var attributes=require(_0x6de7('0x7'));module[_0x6de7('0x8')]=function(_0xead8fd,_0x2158fd){return _0xead8fd[_0x6de7('0x9')](_0x6de7('0xa'),attributes,{'tableName':_0x6de7('0xb'),'paranoid':![],'indexes':[{'name':_0x6de7('0xc'),'fields':[_0x6de7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe24a=['uniqueid','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue'];(function(_0x285b17,_0x502c2a){var _0xc242f8=function(_0x203e08){while(--_0x203e08){_0x285b17['push'](_0x285b17['shift']());}};_0xc242f8(++_0x502c2a);}(_0xe24a,0x151));var _0xae24=function(_0x51770e,_0x83d043){_0x51770e=_0x51770e-0x0;var _0x188d92=_0xe24a[_0x51770e];return _0x188d92;};'use strict';var _=require(_0xae24('0x0'));var util=require(_0xae24('0x1'));var logger=require(_0xae24('0x2'))(_0xae24('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae24('0x4'));var rimraf=require(_0xae24('0x5'));var config=require(_0xae24('0x6'));var attributes=require(_0xae24('0x7'));module[_0xae24('0x8')]=function(_0x153c78,_0x5a0807){return _0x153c78[_0xae24('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0xae24('0xa'),'paranoid':![],'indexes':[{'name':_0xae24('0xb'),'fields':[_0xae24('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index d54633b..280a25b 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 _0xb151=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateWhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','where','attributes','limit','lodash','util','moment'];(function(_0x24ecc9,_0x4b14b6){var _0x341dc9=function(_0x42a854){while(--_0x42a854){_0x24ecc9['push'](_0x24ecc9['shift']());}};_0x341dc9(++_0x4b14b6);}(_0xb151,0x1a1));var _0x1b15=function(_0x4e8891,_0x4667f9){_0x4e8891=_0x4e8891-0x0;var _0x448828=_0xb151[_0x4e8891];return _0x448828;};'use strict';var _=require(_0x1b15('0x0'));var util=require(_0x1b15('0x1'));var moment=require(_0x1b15('0x2'));var BPromise=require(_0x1b15('0x3'));var rs=require(_0x1b15('0x4'));var fs=require('fs');var Redis=require(_0x1b15('0x5'));var db=require(_0x1b15('0x6'))['db'];var utils=require(_0x1b15('0x7'));var logger=require(_0x1b15('0x8'))(_0x1b15('0x9'));var config=require(_0x1b15('0xa'));var jayson=require(_0x1b15('0xb'));var client=jayson['client'][_0x1b15('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x287e21,_0x547188,_0x1ab797){return new BPromise(function(_0x17452d,_0x32dc6f){return client['request'](_0x287e21,_0x1ab797)[_0x1b15('0xd')](function(_0x48b2b9){logger[_0x1b15('0xe')](_0x1b15('0xf'),_0x547188,'request\x20sent');logger[_0x1b15('0x10')](_0x1b15('0x11'),_0x547188,_0x1b15('0x12'),JSON[_0x1b15('0x13')](_0x48b2b9));if(_0x48b2b9[_0x1b15('0x14')]){if(_0x48b2b9[_0x1b15('0x14')]['code']===0x1f4){logger[_0x1b15('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x547188,_0x48b2b9[_0x1b15('0x14')][_0x1b15('0x15')]);return _0x32dc6f(_0x48b2b9[_0x1b15('0x14')][_0x1b15('0x15')]);}logger[_0x1b15('0x14')](_0x1b15('0xf'),_0x547188,_0x48b2b9['error'][_0x1b15('0x15')]);return _0x17452d(_0x48b2b9['error'][_0x1b15('0x15')]);}else{logger['info'](_0x1b15('0xf'),_0x547188,_0x1b15('0x12'));_0x17452d(_0x48b2b9[_0x1b15('0x16')][_0x1b15('0x15')]);}})[_0x1b15('0x17')](function(_0x3ae034){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x547188,_0x3ae034);_0x32dc6f(_0x3ae034);});});}exports[_0x1b15('0x18')]=function(_0x2ac63b){var _0x119832=this;return new Promise(function(_0x5cdacc,_0xda87a1){return db['WhatsappQueueReport'][_0x1b15('0x19')](_0x2ac63b[_0x1b15('0x1a')],{'raw':_0x2ac63b[_0x1b15('0x1b')]?_0x2ac63b[_0x1b15('0x1b')][_0x1b15('0x1c')]===undefined?!![]:![]:!![]})[_0x1b15('0xd')](function(_0x4cdfaa){logger['info']('CreateWhatsappQueueReport',_0x2ac63b);logger[_0x1b15('0x10')](_0x1b15('0x18'),_0x2ac63b,JSON[_0x1b15('0x13')](_0x4cdfaa));_0x5cdacc(_0x4cdfaa);})[_0x1b15('0x17')](function(_0x2c92c4){logger[_0x1b15('0x14')]('CreateWhatsappQueueReport',_0x2c92c4[_0x1b15('0x15')],_0x2ac63b);_0xda87a1(_0x119832[_0x1b15('0x14')](0x1f4,_0x2c92c4[_0x1b15('0x15')]));});});};exports[_0x1b15('0x1d')]=function(_0x2510f8){var _0x202fcd=this;return new Promise(function(_0x377ed3,_0x2b8b31){return db[_0x1b15('0x1e')][_0x1b15('0x1f')](_0x2510f8[_0x1b15('0x1a')],{'raw':_0x2510f8['options']?_0x2510f8[_0x1b15('0x1b')][_0x1b15('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2510f8[_0x1b15('0x1b')]?_0x2510f8['options'][_0x1b15('0x20')]||null:null,'attributes':_0x2510f8[_0x1b15('0x1b')]?_0x2510f8['options'][_0x1b15('0x21')]||null:null,'limit':_0x2510f8[_0x1b15('0x1b')]?_0x2510f8[_0x1b15('0x1b')][_0x1b15('0x22')]||null:null})[_0x1b15('0xd')](function(_0x5a3543){logger[_0x1b15('0xe')](_0x1b15('0x1d'),_0x2510f8);logger[_0x1b15('0x10')](_0x1b15('0x1d'),_0x2510f8,JSON[_0x1b15('0x13')](_0x5a3543));_0x377ed3(_0x5a3543);})[_0x1b15('0x17')](function(_0x3e0c2d){logger['error'](_0x1b15('0x1d'),_0x3e0c2d[_0x1b15('0x15')],_0x2510f8);_0x2b8b31(_0x202fcd['error'](0x1f4,_0x3e0c2d['message']));});});}; \ No newline at end of file +var _0xd15e=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','stringify','UpdateWhatsappQueueReport','update','where','limit','util','moment'];(function(_0x2e4a16,_0x3ed975){var _0x46d719=function(_0x42653f){while(--_0x42653f){_0x2e4a16['push'](_0x2e4a16['shift']());}};_0x46d719(++_0x3ed975);}(_0xd15e,0x130));var _0xed15=function(_0x43a847,_0x36df8a){_0x43a847=_0x43a847-0x0;var _0x1477ee=_0xd15e[_0x43a847];return _0x1477ee;};'use strict';var _=require('lodash');var util=require(_0xed15('0x0'));var moment=require(_0xed15('0x1'));var BPromise=require(_0xed15('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed15('0x3'));var db=require(_0xed15('0x4'))['db'];var utils=require(_0xed15('0x5'));var logger=require(_0xed15('0x6'))(_0xed15('0x7'));var config=require(_0xed15('0x8'));var jayson=require(_0xed15('0x9'));var client=jayson[_0xed15('0xa')][_0xed15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47aaf0,_0x3d8d2d,_0x4166a3){return new BPromise(function(_0x3436b2,_0x3a31ea){return client[_0xed15('0xc')](_0x47aaf0,_0x4166a3)[_0xed15('0xd')](function(_0x462da6){logger[_0xed15('0xe')](_0xed15('0xf'),_0x3d8d2d,_0xed15('0x10'));logger[_0xed15('0x11')](_0xed15('0x12'),_0x3d8d2d,_0xed15('0x10'),JSON['stringify'](_0x462da6));if(_0x462da6[_0xed15('0x13')]){if(_0x462da6[_0xed15('0x13')][_0xed15('0x14')]===0x1f4){logger[_0xed15('0x13')](_0xed15('0xf'),_0x3d8d2d,_0x462da6[_0xed15('0x13')]['message']);return _0x3a31ea(_0x462da6['error'][_0xed15('0x15')]);}logger[_0xed15('0x13')](_0xed15('0xf'),_0x3d8d2d,_0x462da6[_0xed15('0x13')][_0xed15('0x15')]);return _0x3436b2(_0x462da6[_0xed15('0x13')][_0xed15('0x15')]);}else{logger[_0xed15('0xe')](_0xed15('0xf'),_0x3d8d2d,'request\x20sent');_0x3436b2(_0x462da6[_0xed15('0x16')]['message']);}})[_0xed15('0x17')](function(_0x4f45a6){logger[_0xed15('0x13')](_0xed15('0xf'),_0x3d8d2d,_0x4f45a6);_0x3a31ea(_0x4f45a6);});});}exports[_0xed15('0x18')]=function(_0x114c7a){var _0x1b22bd=this;return new Promise(function(_0x3073bf,_0x30b425){return db[_0xed15('0x19')][_0xed15('0x1a')](_0x114c7a[_0xed15('0x1b')],{'raw':_0x114c7a[_0xed15('0x1c')]?_0x114c7a[_0xed15('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xed15('0xd')](function(_0x590e66){logger['info'](_0xed15('0x18'),_0x114c7a);logger['debug']('CreateWhatsappQueueReport',_0x114c7a,JSON[_0xed15('0x1d')](_0x590e66));_0x3073bf(_0x590e66);})[_0xed15('0x17')](function(_0x40322b){logger[_0xed15('0x13')](_0xed15('0x18'),_0x40322b[_0xed15('0x15')],_0x114c7a);_0x30b425(_0x1b22bd[_0xed15('0x13')](0x1f4,_0x40322b[_0xed15('0x15')]));});});};exports[_0xed15('0x1e')]=function(_0x549be){var _0x13213c=this;return new Promise(function(_0x1316f5,_0x35a986){return db['WhatsappQueueReport'][_0xed15('0x1f')](_0x549be['body'],{'raw':_0x549be[_0xed15('0x1c')]?_0x549be[_0xed15('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x549be[_0xed15('0x1c')]?_0x549be['options'][_0xed15('0x20')]||null:null,'attributes':_0x549be[_0xed15('0x1c')]?_0x549be[_0xed15('0x1c')]['attributes']||null:null,'limit':_0x549be[_0xed15('0x1c')]?_0x549be[_0xed15('0x1c')][_0xed15('0x21')]||null:null})[_0xed15('0xd')](function(_0x3bff81){logger[_0xed15('0xe')](_0xed15('0x1e'),_0x549be);logger[_0xed15('0x11')](_0xed15('0x1e'),_0x549be,JSON['stringify'](_0x3bff81));_0x1316f5(_0x3bff81);})['catch'](function(_0x58892e){logger[_0xed15('0x13')]('UpdateWhatsappQueueReport',_0x58892e[_0xed15('0x15')],_0x549be);_0x35a986(_0x13213c['error'](0x1f4,_0x58892e['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 5f69b72..89ba7a3 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 _0x0530=['update','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0530,0x72));var _0x0053=function(_0x27b5fd,_0x5a4d26){_0x27b5fd=_0x27b5fd-0x0;var _0x571e53=_0x0530[_0x27b5fd];return _0x571e53;};'use strict';var multer=require(_0x0053('0x0'));var util=require(_0x0053('0x1'));var path=require('path');var timeout=require(_0x0053('0x2'));var express=require('express');var router=express[_0x0053('0x3')]();var auth=require(_0x0053('0x4'));var interaction=require(_0x0053('0x5'));var config=require('../../config/environment');var controller=require(_0x0053('0x6'));router[_0x0053('0x7')]('/',auth[_0x0053('0x8')](),controller[_0x0053('0x9')]);router[_0x0053('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x0053('0xa')]);router['get'](_0x0053('0xb'),auth[_0x0053('0x8')](),controller[_0x0053('0xc')]);router['post']('/',auth[_0x0053('0x8')](),controller[_0x0053('0xd')]);router['put'](_0x0053('0xb'),auth[_0x0053('0x8')](),controller[_0x0053('0xe')]);router['delete'](_0x0053('0xb'),auth['isAuthenticated'](),controller[_0x0053('0xf')]);module['exports']=router; \ No newline at end of file +var _0x289e=['show','post','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3b3625,_0x10ce65){var _0x4e9f73=function(_0x2dd7c4){while(--_0x2dd7c4){_0x3b3625['push'](_0x3b3625['shift']());}};_0x4e9f73(++_0x10ce65);}(_0x289e,0xea));var _0xe289=function(_0x4b9cbe,_0x176ace){_0x4b9cbe=_0x4b9cbe-0x0;var _0x5803dc=_0x289e[_0x4b9cbe];return _0x5803dc;};'use strict';var multer=require(_0xe289('0x0'));var util=require(_0xe289('0x1'));var path=require('path');var timeout=require(_0xe289('0x2'));var express=require(_0xe289('0x3'));var router=express['Router']();var auth=require(_0xe289('0x4'));var interaction=require(_0xe289('0x5'));var config=require('../../config/environment');var controller=require(_0xe289('0x6'));router[_0xe289('0x7')]('/',auth[_0xe289('0x8')](),controller[_0xe289('0x9')]);router[_0xe289('0x7')](_0xe289('0xa'),auth[_0xe289('0x8')](),controller[_0xe289('0xb')]);router[_0xe289('0x7')](_0xe289('0xc'),auth['isAuthenticated'](),controller[_0xe289('0xd')]);router[_0xe289('0xe')]('/',auth[_0xe289('0x8')](),controller['create']);router[_0xe289('0xf')]('/:id',auth[_0xe289('0x8')](),controller[_0xe289('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe289('0x11')]);module[_0xe289('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d3563cc..c337efb 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 _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x1826a6,_0x40f9fc){var _0x8fbc3=function(_0x3230bf){while(--_0x3230bf){_0x1826a6['push'](_0x1826a6['shift']());}};_0x8fbc3(++_0x40f9fc);}(_0x2032,0xd9));var _0x2203=function(_0x310864,_0x34b2b7){_0x310864=_0x310864-0x0;var _0x364359=_0x2032[_0x310864];return _0x364359;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x564b25,_0x4dc0b4){var _0xc3646c=function(_0x102ea5){while(--_0x102ea5){_0x564b25['push'](_0x564b25['shift']());}};_0xc3646c(++_0x4dc0b4);}(_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')]={'uniqueid':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0baf('0x2')](_0x0baf('0x3'),_0x0baf('0x4'),_0x0baf('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 1b27105..3129ac8 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 _0xb714=['name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','include','rows','catch','show','includeAll','find','create','body','params','destroy','describe','html-pdf','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then'];(function(_0x2af8be,_0x2e8dff){var _0x4d2951=function(_0x3efb80){while(--_0x3efb80){_0x2af8be['push'](_0x2af8be['shift']());}};_0x4d2951(++_0x2e8dff);}(_0xb714,0xbe));var _0x4b71=function(_0x9f930a,_0x44051e){_0x9f930a=_0x9f930a-0x0;var _0x3fa0ce=_0xb714[_0x9f930a];return _0x3fa0ce;};'use strict';var pdf=require(_0x4b71('0x0'));var emlformat=require(_0x4b71('0x1'));var rimraf=require(_0x4b71('0x2'));var zipdir=require(_0x4b71('0x3'));var jsonpatch=require(_0x4b71('0x4'));var rp=require(_0x4b71('0x5'));var moment=require('moment');var BPromise=require(_0x4b71('0x6'));var Mustache=require(_0x4b71('0x7'));var util=require(_0x4b71('0x8'));var path=require(_0x4b71('0x9'));var sox=require(_0x4b71('0xa'));var csv=require(_0x4b71('0xb'));var ejs=require(_0x4b71('0xc'));var fs=require('fs');var _=require(_0x4b71('0xd'));var squel=require(_0x4b71('0xe'));var crypto=require(_0x4b71('0xf'));var jsforce=require(_0x4b71('0x10'));var deskjs=require(_0x4b71('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4b71('0x12'));var Papa=require(_0x4b71('0x13'));var Redis=require(_0x4b71('0x14'));var authService=require(_0x4b71('0x15'));var qs=require(_0x4b71('0x16'));var as=require(_0x4b71('0x17'));var hardwareService=require(_0x4b71('0x18'));var logger=require('../../config/logger')(_0x4b71('0x19'));var utils=require(_0x4b71('0x1a'));var config=require(_0x4b71('0x1b'));var db=require(_0x4b71('0x1c'))['db'];function respondWithStatusCode(_0x3c4c6b,_0x2d5723){_0x2d5723=_0x2d5723||0xcc;return function(_0x39859f){if(_0x39859f){return _0x3c4c6b[_0x4b71('0x1d')](_0x2d5723);}return _0x3c4c6b[_0x4b71('0x1e')](_0x2d5723)[_0x4b71('0x1f')]();};}function respondWithResult(_0xad791c,_0x4f69dc){_0x4f69dc=_0x4f69dc||0xc8;return function(_0xdcf5ba){if(_0xdcf5ba){return _0xad791c[_0x4b71('0x1e')](_0x4f69dc)['json'](_0xdcf5ba);}};}function respondWithFilteredResult(_0x43c0e4,_0x47dd07){return function(_0x174bde){if(_0x174bde){var _0x566159=_0x174bde[_0x4b71('0x20')],_0x39c5a2=_0x47dd07[_0x4b71('0x21')],_0x499a66=_0x47dd07[_0x4b71('0x21')]+_0x47dd07[_0x4b71('0x22')],_0x2cd6d3;if(_0x499a66>=_0x566159){_0x499a66=_0x566159;_0x2cd6d3=0xc8;}else{_0x2cd6d3=0xce;}_0x43c0e4[_0x4b71('0x1e')](_0x2cd6d3);return _0x43c0e4[_0x4b71('0x23')]('Content-Range',_0x39c5a2+'-'+_0x499a66+'/'+_0x566159)[_0x4b71('0x24')](_0x174bde);}return null;};}function patchUpdates(_0x5341e5){return function(_0x4db64c){try{jsonpatch[_0x4b71('0x25')](_0x4db64c,_0x5341e5,!![]);}catch(_0x479f57){return BPromise[_0x4b71('0x26')](_0x479f57);}return _0x4db64c['save']();};}function saveUpdates(_0x1174a9,_0x3f983e){return function(_0x5a4b50){if(_0x5a4b50){return _0x5a4b50[_0x4b71('0x27')](_0x1174a9)[_0x4b71('0x28')](function(_0x3df505){return _0x3df505;});}return null;};}function removeEntity(_0x1046bf,_0x264b94){return function(_0x29b717){if(_0x29b717){return _0x29b717['destroy']()['then'](function(){_0x1046bf[_0x4b71('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1de9c3,_0x2f21be){return function(_0x1128d1){if(!_0x1128d1){_0x1de9c3[_0x4b71('0x1d')](0x194);}return _0x1128d1;};}function handleError(_0x2e13b0,_0x1f3a63){_0x1f3a63=_0x1f3a63||0x1f4;return function(_0x20f664){logger['error'](_0x20f664['stack']);if(_0x20f664['name']){delete _0x20f664[_0x4b71('0x29')];}_0x2e13b0[_0x4b71('0x1e')](_0x1f3a63)[_0x4b71('0x2a')](_0x20f664);};}exports[_0x4b71('0x2b')]=function(_0x559bda,_0x271bdb){var _0x3a5fda={},_0x3c9e4e={},_0x473472={'count':0x0,'rows':[]};var _0x163c18=_['map'](db[_0x4b71('0x2c')][_0x4b71('0x2d')],function(_0x53684d){return{'name':_0x53684d[_0x4b71('0x2e')],'type':_0x53684d[_0x4b71('0x2f')][_0x4b71('0x30')]};});_0x3c9e4e[_0x4b71('0x31')]=_[_0x4b71('0x32')](_0x163c18,_0x4b71('0x29'));_0x3c9e4e[_0x4b71('0x33')]=_[_0x4b71('0x34')](_0x559bda[_0x4b71('0x33')]);_0x3c9e4e['filters']=_[_0x4b71('0x35')](_0x3c9e4e[_0x4b71('0x31')],_0x3c9e4e['query']);_0x3a5fda[_0x4b71('0x36')]=_[_0x4b71('0x35')](_0x3c9e4e[_0x4b71('0x31')],qs[_0x4b71('0x37')](_0x559bda[_0x4b71('0x33')]['fields']));_0x3a5fda[_0x4b71('0x36')]=_0x3a5fda[_0x4b71('0x36')][_0x4b71('0x38')]?_0x3a5fda[_0x4b71('0x36')]:_0x3c9e4e['model'];if(!_0x559bda[_0x4b71('0x33')]['hasOwnProperty'](_0x4b71('0x39'))){_0x3a5fda[_0x4b71('0x22')]=qs[_0x4b71('0x22')](_0x559bda[_0x4b71('0x33')][_0x4b71('0x22')]);_0x3a5fda[_0x4b71('0x21')]=qs[_0x4b71('0x21')](_0x559bda[_0x4b71('0x33')][_0x4b71('0x21')]);}_0x3a5fda[_0x4b71('0x3a')]=qs[_0x4b71('0x3b')](_0x559bda[_0x4b71('0x33')][_0x4b71('0x3b')]);_0x3a5fda[_0x4b71('0x3c')]=qs[_0x4b71('0x3d')](_[_0x4b71('0x3e')](_0x559bda[_0x4b71('0x33')],_0x3c9e4e[_0x4b71('0x3d')]),_0x163c18);if(_0x559bda['query']['filter']){_0x3a5fda[_0x4b71('0x3c')]=_[_0x4b71('0x3f')](_0x3a5fda['where'],{'$or':_[_0x4b71('0x32')](_0x163c18,function(_0xc91e67){if(_0xc91e67[_0x4b71('0x2f')]!=='VIRTUAL'){var _0x2ebf8e={};_0x2ebf8e[_0xc91e67[_0x4b71('0x29')]]={'$like':'%'+_0x559bda[_0x4b71('0x33')][_0x4b71('0x40')]+'%'};return _0x2ebf8e;}})});}_0x3a5fda=_['merge']({},_0x3a5fda,_0x559bda[_0x4b71('0x41')]);var _0x4e1b98={'where':_0x3a5fda[_0x4b71('0x3c')]};return db[_0x4b71('0x2c')]['count'](_0x4e1b98)[_0x4b71('0x28')](function(_0x262c17){_0x473472[_0x4b71('0x20')]=_0x262c17;if(_0x559bda[_0x4b71('0x33')]['includeAll']){_0x3a5fda[_0x4b71('0x42')]=[{'all':!![]}];}return db[_0x4b71('0x2c')]['findAll'](_0x3a5fda);})[_0x4b71('0x28')](function(_0x15e82c){_0x473472[_0x4b71('0x43')]=_0x15e82c;return _0x473472;})[_0x4b71('0x28')](respondWithFilteredResult(_0x271bdb,_0x3a5fda))[_0x4b71('0x44')](handleError(_0x271bdb,null));};exports[_0x4b71('0x45')]=function(_0x12b9b4,_0x3936ea){var _0x559025={'raw':!![],'where':{'id':_0x12b9b4['params']['id']}},_0xcc7ff6={};_0xcc7ff6['model']=_[_0x4b71('0x34')](db['WhatsappTransferReport']['rawAttributes']);_0xcc7ff6['query']=_[_0x4b71('0x34')](_0x12b9b4['query']);_0xcc7ff6[_0x4b71('0x3d')]=_['intersection'](_0xcc7ff6[_0x4b71('0x31')],_0xcc7ff6['query']);_0x559025[_0x4b71('0x36')]=_[_0x4b71('0x35')](_0xcc7ff6[_0x4b71('0x31')],qs[_0x4b71('0x37')](_0x12b9b4[_0x4b71('0x33')][_0x4b71('0x37')]));_0x559025['attributes']=_0x559025[_0x4b71('0x36')][_0x4b71('0x38')]?_0x559025['attributes']:_0xcc7ff6[_0x4b71('0x31')];if(_0x12b9b4[_0x4b71('0x33')][_0x4b71('0x46')]){_0x559025[_0x4b71('0x42')]=[{'all':!![]}];}_0x559025=_[_0x4b71('0x3f')]({},_0x559025,_0x12b9b4['options']);return db[_0x4b71('0x2c')][_0x4b71('0x47')](_0x559025)['then'](handleEntityNotFound(_0x3936ea,null))[_0x4b71('0x28')](respondWithResult(_0x3936ea,null))[_0x4b71('0x44')](handleError(_0x3936ea,null));};exports[_0x4b71('0x48')]=function(_0x55fac4,_0x28f759){return db[_0x4b71('0x2c')][_0x4b71('0x48')](_0x55fac4[_0x4b71('0x49')],{})[_0x4b71('0x28')](respondWithResult(_0x28f759,0xc9))[_0x4b71('0x44')](handleError(_0x28f759,null));};exports[_0x4b71('0x27')]=function(_0x5e9c8f,_0x129713){if(_0x5e9c8f['body']['id']){delete _0x5e9c8f[_0x4b71('0x49')]['id'];}return db[_0x4b71('0x2c')][_0x4b71('0x47')]({'where':{'id':_0x5e9c8f[_0x4b71('0x4a')]['id']}})['then'](handleEntityNotFound(_0x129713,null))[_0x4b71('0x28')](saveUpdates(_0x5e9c8f[_0x4b71('0x49')],null))[_0x4b71('0x28')](respondWithResult(_0x129713,null))[_0x4b71('0x44')](handleError(_0x129713,null));};exports[_0x4b71('0x4b')]=function(_0x4dbe83,_0x77a1eb){return db[_0x4b71('0x2c')][_0x4b71('0x47')]({'where':{'id':_0x4dbe83[_0x4b71('0x4a')]['id']}})[_0x4b71('0x28')](handleEntityNotFound(_0x77a1eb,null))[_0x4b71('0x28')](removeEntity(_0x77a1eb,null))[_0x4b71('0x44')](handleError(_0x77a1eb,null));};exports[_0x4b71('0x4c')]=function(_0x4cafd6,_0x33be74){return db[_0x4b71('0x2c')]['describe']()[_0x4b71('0x28')](respondWithResult(_0x33be74,null))[_0x4b71('0x44')](handleError(_0x33be74,null));}; \ No newline at end of file +var _0x6d88=['save','update','destroy','then','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','WhatsappTransferReport','include','findAll','catch','show','params','keys','rawAttributes','length','includeAll','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','count','offset','limit','status','Content-Range','json','reject'];(function(_0x25109d,_0x44aa91){var _0x5a3e8b=function(_0x36f580){while(--_0x36f580){_0x25109d['push'](_0x25109d['shift']());}};_0x5a3e8b(++_0x44aa91);}(_0x6d88,0x100));var _0x86d8=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0x6d88[_0x20d54d];return _0x516e8b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x86d8('0x0'));var rimraf=require(_0x86d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x86d8('0x2'));var rp=require('request-promise');var moment=require(_0x86d8('0x3'));var BPromise=require(_0x86d8('0x4'));var Mustache=require(_0x86d8('0x5'));var util=require('util');var path=require('path');var sox=require(_0x86d8('0x6'));var csv=require(_0x86d8('0x7'));var ejs=require(_0x86d8('0x8'));var fs=require('fs');var _=require(_0x86d8('0x9'));var squel=require(_0x86d8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d8('0xb'));var toCsv=require(_0x86d8('0x7'));var querystring=require(_0x86d8('0xc'));var Papa=require(_0x86d8('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x86d8('0xe'));var hardwareService=require(_0x86d8('0xf'));var logger=require(_0x86d8('0x10'))(_0x86d8('0x11'));var utils=require(_0x86d8('0x12'));var config=require('../../config/environment');var db=require(_0x86d8('0x13'))['db'];function respondWithStatusCode(_0x3f24bb,_0x42de58){_0x42de58=_0x42de58||0xcc;return function(_0x4b956d){if(_0x4b956d){return _0x3f24bb['sendStatus'](_0x42de58);}return _0x3f24bb['status'](_0x42de58)[_0x86d8('0x14')]();};}function respondWithResult(_0x119446,_0x5df7ab){_0x5df7ab=_0x5df7ab||0xc8;return function(_0x21c9ca){if(_0x21c9ca){return _0x119446['status'](_0x5df7ab)['json'](_0x21c9ca);}};}function respondWithFilteredResult(_0x47ff8c,_0x17c777){return function(_0xcc7b4d){if(_0xcc7b4d){var _0x2b7c05=_0xcc7b4d[_0x86d8('0x15')],_0x1bae83=_0x17c777['offset'],_0x277c09=_0x17c777[_0x86d8('0x16')]+_0x17c777[_0x86d8('0x17')],_0x4c5597;if(_0x277c09>=_0x2b7c05){_0x277c09=_0x2b7c05;_0x4c5597=0xc8;}else{_0x4c5597=0xce;}_0x47ff8c[_0x86d8('0x18')](_0x4c5597);return _0x47ff8c['set'](_0x86d8('0x19'),_0x1bae83+'-'+_0x277c09+'/'+_0x2b7c05)[_0x86d8('0x1a')](_0xcc7b4d);}return null;};}function patchUpdates(_0x585bc1){return function(_0x126412){try{jsonpatch['apply'](_0x126412,_0x585bc1,!![]);}catch(_0x353be8){return BPromise[_0x86d8('0x1b')](_0x353be8);}return _0x126412[_0x86d8('0x1c')]();};}function saveUpdates(_0x3d7acd,_0x492bd5){return function(_0xb5409e){if(_0xb5409e){return _0xb5409e[_0x86d8('0x1d')](_0x3d7acd)['then'](function(_0x502676){return _0x502676;});}return null;};}function removeEntity(_0x7a5069,_0x8b4da2){return function(_0x4a0279){if(_0x4a0279){return _0x4a0279[_0x86d8('0x1e')]()[_0x86d8('0x1f')](function(){_0x7a5069[_0x86d8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f47f6,_0x15bc14){return function(_0x9628fb){if(!_0x9628fb){_0x5f47f6[_0x86d8('0x20')](0x194);}return _0x9628fb;};}function handleError(_0x398d5d,_0x4632fa){_0x4632fa=_0x4632fa||0x1f4;return function(_0xc37b19){logger[_0x86d8('0x21')](_0xc37b19[_0x86d8('0x22')]);if(_0xc37b19[_0x86d8('0x23')]){delete _0xc37b19[_0x86d8('0x23')];}_0x398d5d[_0x86d8('0x18')](_0x4632fa)[_0x86d8('0x24')](_0xc37b19);};}exports[_0x86d8('0x25')]=function(_0x8c2a04,_0x4ce9d8){var _0xe434b8={},_0x2eb781={},_0xea6cba={'count':0x0,'rows':[]};var _0x4b32bc=_[_0x86d8('0x26')](db['WhatsappTransferReport']['rawAttributes'],function(_0x16c9c7){return{'name':_0x16c9c7[_0x86d8('0x27')],'type':_0x16c9c7['type'][_0x86d8('0x28')]};});_0x2eb781[_0x86d8('0x29')]=_[_0x86d8('0x26')](_0x4b32bc,_0x86d8('0x23'));_0x2eb781[_0x86d8('0x2a')]=_['keys'](_0x8c2a04[_0x86d8('0x2a')]);_0x2eb781[_0x86d8('0x2b')]=_['intersection'](_0x2eb781[_0x86d8('0x29')],_0x2eb781[_0x86d8('0x2a')]);_0xe434b8[_0x86d8('0x2c')]=_[_0x86d8('0x2d')](_0x2eb781[_0x86d8('0x29')],qs[_0x86d8('0x2e')](_0x8c2a04[_0x86d8('0x2a')][_0x86d8('0x2e')]));_0xe434b8[_0x86d8('0x2c')]=_0xe434b8[_0x86d8('0x2c')]['length']?_0xe434b8['attributes']:_0x2eb781[_0x86d8('0x29')];if(!_0x8c2a04[_0x86d8('0x2a')]['hasOwnProperty'](_0x86d8('0x2f'))){_0xe434b8[_0x86d8('0x17')]=qs[_0x86d8('0x17')](_0x8c2a04[_0x86d8('0x2a')]['limit']);_0xe434b8[_0x86d8('0x16')]=qs[_0x86d8('0x16')](_0x8c2a04[_0x86d8('0x2a')]['offset']);}_0xe434b8[_0x86d8('0x30')]=qs[_0x86d8('0x31')](_0x8c2a04['query'][_0x86d8('0x31')]);_0xe434b8['where']=qs[_0x86d8('0x2b')](_[_0x86d8('0x32')](_0x8c2a04[_0x86d8('0x2a')],_0x2eb781[_0x86d8('0x2b')]),_0x4b32bc);if(_0x8c2a04[_0x86d8('0x2a')][_0x86d8('0x33')]){_0xe434b8['where']=_[_0x86d8('0x34')](_0xe434b8[_0x86d8('0x35')],{'$or':_[_0x86d8('0x26')](_0x4b32bc,function(_0x215698){if(_0x215698[_0x86d8('0x36')]!==_0x86d8('0x37')){var _0x234c02={};_0x234c02[_0x215698[_0x86d8('0x23')]]={'$like':'%'+_0x8c2a04[_0x86d8('0x2a')][_0x86d8('0x33')]+'%'};return _0x234c02;}})});}_0xe434b8=_[_0x86d8('0x34')]({},_0xe434b8,_0x8c2a04['options']);var _0x31c539={'where':_0xe434b8[_0x86d8('0x35')]};return db[_0x86d8('0x38')][_0x86d8('0x15')](_0x31c539)[_0x86d8('0x1f')](function(_0x188894){_0xea6cba['count']=_0x188894;if(_0x8c2a04[_0x86d8('0x2a')]['includeAll']){_0xe434b8[_0x86d8('0x39')]=[{'all':!![]}];}return db[_0x86d8('0x38')][_0x86d8('0x3a')](_0xe434b8);})[_0x86d8('0x1f')](function(_0x1f7f40){_0xea6cba['rows']=_0x1f7f40;return _0xea6cba;})['then'](respondWithFilteredResult(_0x4ce9d8,_0xe434b8))[_0x86d8('0x3b')](handleError(_0x4ce9d8,null));};exports[_0x86d8('0x3c')]=function(_0x420a6a,_0x53bc78){var _0x2f0955={'raw':!![],'where':{'id':_0x420a6a[_0x86d8('0x3d')]['id']}},_0xb1e3cb={};_0xb1e3cb[_0x86d8('0x29')]=_[_0x86d8('0x3e')](db[_0x86d8('0x38')][_0x86d8('0x3f')]);_0xb1e3cb['query']=_['keys'](_0x420a6a[_0x86d8('0x2a')]);_0xb1e3cb[_0x86d8('0x2b')]=_[_0x86d8('0x2d')](_0xb1e3cb[_0x86d8('0x29')],_0xb1e3cb['query']);_0x2f0955[_0x86d8('0x2c')]=_[_0x86d8('0x2d')](_0xb1e3cb[_0x86d8('0x29')],qs['fields'](_0x420a6a[_0x86d8('0x2a')][_0x86d8('0x2e')]));_0x2f0955[_0x86d8('0x2c')]=_0x2f0955[_0x86d8('0x2c')][_0x86d8('0x40')]?_0x2f0955['attributes']:_0xb1e3cb[_0x86d8('0x29')];if(_0x420a6a[_0x86d8('0x2a')][_0x86d8('0x41')]){_0x2f0955[_0x86d8('0x39')]=[{'all':!![]}];}_0x2f0955=_[_0x86d8('0x34')]({},_0x2f0955,_0x420a6a[_0x86d8('0x42')]);return db[_0x86d8('0x38')][_0x86d8('0x43')](_0x2f0955)[_0x86d8('0x1f')](handleEntityNotFound(_0x53bc78,null))['then'](respondWithResult(_0x53bc78,null))['catch'](handleError(_0x53bc78,null));};exports['create']=function(_0x1c99ef,_0x5405ec){return db[_0x86d8('0x38')][_0x86d8('0x44')](_0x1c99ef[_0x86d8('0x45')],{})['then'](respondWithResult(_0x5405ec,0xc9))[_0x86d8('0x3b')](handleError(_0x5405ec,null));};exports[_0x86d8('0x1d')]=function(_0x54c25e,_0x56289){if(_0x54c25e['body']['id']){delete _0x54c25e[_0x86d8('0x45')]['id'];}return db[_0x86d8('0x38')][_0x86d8('0x43')]({'where':{'id':_0x54c25e[_0x86d8('0x3d')]['id']}})['then'](handleEntityNotFound(_0x56289,null))['then'](saveUpdates(_0x54c25e[_0x86d8('0x45')],null))[_0x86d8('0x1f')](respondWithResult(_0x56289,null))[_0x86d8('0x3b')](handleError(_0x56289,null));};exports['destroy']=function(_0x34f830,_0x99fcb3){return db['WhatsappTransferReport'][_0x86d8('0x43')]({'where':{'id':_0x34f830[_0x86d8('0x3d')]['id']}})[_0x86d8('0x1f')](handleEntityNotFound(_0x99fcb3,null))['then'](removeEntity(_0x99fcb3,null))[_0x86d8('0x3b')](handleError(_0x99fcb3,null));};exports[_0x86d8('0x46')]=function(_0x1c11f4,_0x552164){return db['WhatsappTransferReport'][_0x86d8('0x46')]()[_0x86d8('0x1f')](respondWithResult(_0x552164,null))[_0x86d8('0x3b')](handleError(_0x552164,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 289c4e6..511e995 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 _0x5a89=['report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappTransferReport'];(function(_0x239cd8,_0x2f70b8){var _0x174e98=function(_0x157826){while(--_0x157826){_0x239cd8['push'](_0x239cd8['shift']());}};_0x174e98(++_0x2f70b8);}(_0x5a89,0xfe));var _0x95a8=function(_0x5d8dd1,_0x2b2069){_0x5d8dd1=_0x5d8dd1-0x0;var _0x189342=_0x5a89[_0x5d8dd1];return _0x189342;};'use strict';var _=require(_0x95a8('0x0'));var util=require(_0x95a8('0x1'));var logger=require(_0x95a8('0x2'))(_0x95a8('0x3'));var moment=require(_0x95a8('0x4'));var BPromise=require(_0x95a8('0x5'));var rp=require(_0x95a8('0x6'));var fs=require('fs');var path=require(_0x95a8('0x7'));var rimraf=require(_0x95a8('0x8'));var config=require(_0x95a8('0x9'));var attributes=require('./whatsappTransferReport.attributes');module[_0x95a8('0xa')]=function(_0x3c1f21,_0x30d047){return _0x3c1f21['define'](_0x95a8('0xb'),attributes,{'tableName':_0x95a8('0xc'),'paranoid':![],'indexes':[{'name':_0x95a8('0xd'),'fields':[_0x95a8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50e1=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0xb3b179,_0x578dbd){var _0x62abcd=function(_0x3004ae){while(--_0x3004ae){_0xb3b179['push'](_0xb3b179['shift']());}};_0x62abcd(++_0x578dbd);}(_0x50e1,0x15e));var _0x150e=function(_0x1b8901,_0x4a8d0c){_0x1b8901=_0x1b8901-0x0;var _0x1d14a5=_0x50e1[_0x1b8901];return _0x1d14a5;};'use strict';var _=require('lodash');var util=require(_0x150e('0x0'));var logger=require(_0x150e('0x1'))(_0x150e('0x2'));var moment=require('moment');var BPromise=require(_0x150e('0x3'));var rp=require(_0x150e('0x4'));var fs=require('fs');var path=require(_0x150e('0x5'));var rimraf=require(_0x150e('0x6'));var config=require(_0x150e('0x7'));var attributes=require(_0x150e('0x8'));module[_0x150e('0x9')]=function(_0x1c9ec1,_0x5d4625){return _0x1c9ec1[_0x150e('0xa')](_0x150e('0xb'),attributes,{'tableName':_0x150e('0xc'),'paranoid':![],'indexes':[{'name':_0x150e('0xd'),'fields':[_0x150e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 7f29741..f1d221b 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(_0x426b34,_0x18adcb){var _0x5cfbf9=function(_0x43cc83){while(--_0x43cc83){_0x426b34['push'](_0x426b34['shift']());}};_0x5cfbf9(++_0x18adcb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x1cc708,_0x9fda0e){var _0x5c9769=function(_0x42c8e1){while(--_0x42c8e1){_0x1cc708['push'](_0x1cc708['shift']());}};_0x5c9769(++_0x9fda0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 2f9d410..8427ccc 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9770=['None','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','map','online','join','Offline\x20apps:','filter','status'];(function(_0x3130fb,_0x1fbf23){var _0x2ba85b=function(_0x48aa2d){while(--_0x48aa2d){_0x3130fb['push'](_0x3130fb['shift']());}};_0x2ba85b(++_0x1fbf23);}(_0x9770,0xd5));var _0x0977=function(_0x9f76ed,_0x6fced9){_0x9f76ed=_0x9f76ed-0x0;var _0x593e29=_0x9770[_0x9f76ed];return _0x593e29;};'use strict';var _=require(_0x0977('0x0'));var mysqldb=require('./mysqldb');var rpc=require('./rpc');var config=require(_0x0977('0x1'));var logger=require(_0x0977('0x2'))(_0x0977('0x3'));var pm2=require(_0x0977('0x4'));var pm2Config=require(_0x0977('0x5'));var schedule=require('./config/schedule');var chat=require(_0x0977('0x6'));var transcribe=require(_0x0977('0x7'));function main(){return mysqldb['db'][_0x0977('0x8')][_0x0977('0x9')]()[_0x0977('0xa')](function(){return rpc[_0x0977('0xb')]();})[_0x0977('0xa')](function(_0x143ab6){logger[_0x0977('0xc')](_0x143ab6);return chat[_0x0977('0xd')]();})[_0x0977('0xa')](function(){return schedule[_0x0977('0xd')]();})[_0x0977('0xa')](function(){return transcribe['start']();})[_0x0977('0xa')](function(_0x5c2a5c){logger[_0x0977('0xc')](_0x5c2a5c);return pm2[_0x0977('0xd')](pm2Config);})[_0x0977('0xa')](function(_0x38c08c){logger[_0x0977('0xc')](_0x0977('0xe'),_[_0x0977('0xf')](_['filter'](_0x38c08c,{'status':_0x0977('0x10')}),'name')[_0x0977('0x11')]());logger[_0x0977('0xc')](_0x0977('0x12'),_[_0x0977('0xf')](_[_0x0977('0x13')](_0x38c08c,function(_0x34a938){return _0x34a938[_0x0977('0x14')]!==_0x0977('0x10');}),'name')[_0x0977('0x11')]()||_0x0977('0x15'));config['seedDB']&&require('./config/seedDB')['default']();require('./config/license')[_0x0977('0x16')]();})[_0x0977('0x17')](function(_0x4fd27f){logger['error'](_0x0977('0x18'),_0x4fd27f);process[_0x0977('0x19')](0x1);});}main(); \ No newline at end of file +var _0x70dc=['status','seedDB','default','./config/license','catch','error','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/schedule/chat','./config/schedule/transcribe','sequelize','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:'];(function(_0xa3770d,_0x3bb3ec){var _0x1a2c6a=function(_0xefd8cf){while(--_0xefd8cf){_0xa3770d['push'](_0xa3770d['shift']());}};_0x1a2c6a(++_0x3bb3ec);}(_0x70dc,0x1b7));var _0xc70d=function(_0xc04fbd,_0x887b61){_0xc04fbd=_0xc04fbd-0x0;var _0x548fcb=_0x70dc[_0xc04fbd];return _0x548fcb;};'use strict';var _=require(_0xc70d('0x0'));var mysqldb=require(_0xc70d('0x1'));var rpc=require(_0xc70d('0x2'));var config=require(_0xc70d('0x3'));var logger=require(_0xc70d('0x4'))(_0xc70d('0x5'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0xc70d('0x6'));var transcribe=require(_0xc70d('0x7'));function main(){return mysqldb['db'][_0xc70d('0x8')]['sync']()[_0xc70d('0x9')](function(){return rpc[_0xc70d('0xa')]();})[_0xc70d('0x9')](function(_0x14e575){logger[_0xc70d('0xb')](_0x14e575);return chat['start']();})[_0xc70d('0x9')](function(){return schedule[_0xc70d('0xc')]();})[_0xc70d('0x9')](function(){return transcribe[_0xc70d('0xc')]();})[_0xc70d('0x9')](function(_0x5a95c4){logger[_0xc70d('0xb')](_0x5a95c4);return pm2[_0xc70d('0xc')](pm2Config);})['then'](function(_0x27f042){logger[_0xc70d('0xb')](_0xc70d('0xd'),_[_0xc70d('0xe')](_[_0xc70d('0xf')](_0x27f042,{'status':_0xc70d('0x10')}),_0xc70d('0x11'))[_0xc70d('0x12')]());logger['info'](_0xc70d('0x13'),_[_0xc70d('0xe')](_[_0xc70d('0xf')](_0x27f042,function(_0x25100f){return _0x25100f[_0xc70d('0x14')]!=='online';}),_0xc70d('0x11'))[_0xc70d('0x12')]()||'None');config[_0xc70d('0x15')]&&require('./config/seedDB')[_0xc70d('0x16')]();require(_0xc70d('0x17'))[_0xc70d('0x16')]();})[_0xc70d('0x18')](function(_0x17f5ba){logger[_0xc70d('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x17f5ba);process[_0xc70d('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index eb5fb37..c15e2e7 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 _0x07bc=['phoneBarEnableRecording','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','then','status','unmanaged','json','disposition','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','authenticate','Unknown\x20authorization\x20format','query','apikey','getUuid','find','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','secret','payload','options','randomBytes','toString','hex','now','HS512','../../config/environment','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','secrets','session','role','name','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x07bc,0x15c));var _0xc07b=function(_0x5d55ab,_0x13689d){_0x5d55ab=_0x5d55ab-0x0;var _0x47d219=_0x07bc[_0x5d55ab];return _0x47d219;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xc07b('0x0'));var hardwareConf=require('../../config/license/hardware');var _=require(_0xc07b('0x1'));var jwt=require(_0xc07b('0x2'));var expressJwt=require(_0xc07b('0x3'));var compose=require('composable-middleware');var basicAuth=require(_0xc07b('0x4'));var crypto=require(_0xc07b('0x5'));var BPromise=require(_0xc07b('0x6'));var validateJwt=expressJwt({'secret':config[_0xc07b('0x7')][_0xc07b('0x8')]});var userAttributes=['id',_0xc07b('0x9'),'fullname',_0xc07b('0xa'),_0xc07b('0xb'),_0xc07b('0xc'),'userpic','permissions',_0xc07b('0xd'),_0xc07b('0xe'),_0xc07b('0xf'),_0xc07b('0x10'),_0xc07b('0x11'),_0xc07b('0x12'),_0xc07b('0x13'),_0xc07b('0x14'),_0xc07b('0x15'),_0xc07b('0x16'),_0xc07b('0x17'),'crudPermissions',_0xc07b('0x18'),'passwordResetAt',_0xc07b('0x19'),_0xc07b('0x1a'),_0xc07b('0x1b'),'phoneBarDnd',_0xc07b('0x1c'),'phoneBarEnableDtmfTone','phoneBarEnableSettings',_0xc07b('0x1d'),'phoneBarPrefixRequired',_0xc07b('0x1e'),_0xc07b('0x1f'),'hotdesk',_0xc07b('0x20'),_0xc07b('0x21')];exports[_0xc07b('0x22')]=function(){return this[_0xc07b('0x23')](!![])[_0xc07b('0x24')](function(_0x63af0d,_0x575afc,_0x4de77d){if(_0x63af0d[_0xc07b('0x25')]){_0x4de77d();}else{return db[_0xc07b('0x26')][_0xc07b('0x27')]({'where':{'id':_0x63af0d[_0xc07b('0x28')]['id']},'attributes':['id',_0xc07b('0x29'),'disposition'],'raw':!![]})[_0xc07b('0x2a')](function(_0x2168ce){if(_0x2168ce&&_0x2168ce[_0xc07b('0x29')]){return _0x575afc[_0xc07b('0x2b')](_0x2168ce['disposition']===_0xc07b('0x2c')?0x195:0x193)[_0xc07b('0x2d')]({'message':_0x2168ce[_0xc07b('0x2e')]===_0xc07b('0x2c')?_0xc07b('0x2f'):_0xc07b('0x30')});}else{_0x4de77d();}})[_0xc07b('0x31')](function(_0x1cb2c6){_0x4de77d(_0x1cb2c6);});}});};exports['isAuthenticated']=function isAuthenticated(_0x2487df){return compose()[_0xc07b('0x24')](function(_0x1e3016,_0x562023,_0x544be9){if(_0x1e3016[_0xc07b('0x32')][_0xc07b('0x33')]){if(_[_0xc07b('0x34')](_0x1e3016[_0xc07b('0x32')]['authorization'],_0xc07b('0x35'))){var _0x59b11a=basicAuth(_0x1e3016);db[_0xc07b('0x36')]['find']({'where':{'name':_0x59b11a[_0xc07b('0xa')]}})[_0xc07b('0x2a')](function(_0x58638b){if(!_0x58638b||!_0x58638b[_0xc07b('0x37')](_0x59b11a['pass'])){return _0x562023[_0xc07b('0x2b')](0x191)[_0xc07b('0x2d')]({'message':'Wrong\x20credentials.'});}_0x1e3016['user']={'id':_0x58638b['id']};_0x544be9();})[_0xc07b('0x31')](function(_0x577a38){_0x544be9(_0x577a38);});}else if(_[_0xc07b('0x34')](_0x1e3016[_0xc07b('0x32')]['authorization'],'Bearer')){validateJwt(_0x1e3016,_0x562023,_0x544be9);}else{if(_0x2487df){_0x544be9();}else{return _0x562023[_0xc07b('0x2b')](0x193)[_0xc07b('0x2d')]({'message':_0xc07b('0x38')});}}}else if(_0x1e3016[_0xc07b('0x39')][_0xc07b('0x3a')]){try{var _0x1d9a57={'audience':hardwareConf[_0xc07b('0x3b')](),'issuer':hardwareConf[_0xc07b('0x3b')]()};verifyJwt(_0x1e3016[_0xc07b('0x39')][_0xc07b('0x3a')],_0x1d9a57)[_0xc07b('0x2a')](function(_0x22646b){return db[_0xc07b('0x36')][_0xc07b('0x3c')]({'where':{'id':_0x22646b['sub']}})[_0xc07b('0x2a')](function(_0x3e158a){if(!_0x3e158a||!_['isEqual'](_0x3e158a[_0xc07b('0x3d')],_0x22646b[_0xc07b('0x3e')])){return _0x562023[_0xc07b('0x2b')](0x191)[_0xc07b('0x2d')]({'message':_0xc07b('0x3f')});}_0x1e3016['user']={'id':_0x3e158a['id']};_0x544be9();});})['catch'](function(){return _0x562023[_0xc07b('0x2b')](0x191)[_0xc07b('0x2d')]({'message':_0xc07b('0x40')});});}catch(_0x3fe1ca){_0x544be9(_0x3fe1ca);}}else if(_0x2487df){_0x544be9();}else{return _0x562023[_0xc07b('0x2b')](0x193)[_0xc07b('0x2d')]({'message':_0xc07b('0x38')});}})[_0xc07b('0x24')](function(_0x2d2f36,_0x105b59,_0x35dd61){if(_0x2d2f36[_0xc07b('0x25')]){db[_0xc07b('0x36')]['find']({'where':{'id':_0x2d2f36[_0xc07b('0x25')]['id']},'attributes':userAttributes})['then'](function(_0x2e43ca){if(!_0x2e43ca){return _0x105b59['status'](0x194)[_0xc07b('0x2d')]({'message':_0xc07b('0x41')});}_0x2d2f36[_0xc07b('0x25')]=_0x2e43ca;_0x35dd61();})[_0xc07b('0x31')](function(_0x4a4c71){_0x35dd61(_0x4a4c71);});}else if(_0x2487df){_0x35dd61();}else{return _0x105b59[_0xc07b('0x2b')](0x194)[_0xc07b('0x2d')]({'message':_0xc07b('0x42')});}});};exports[_0xc07b('0x43')]=function canUpdate(){return compose()['use'](function(_0x27ee36,_0x51c524,_0x3c1969){return require(_0xc07b('0x44'))[_0xc07b('0x45')]()[_0xc07b('0x2a')](function(_0x36034b){if(_0x36034b[_0xc07b('0x46')]){_0x3c1969();}else{return _0x51c524[_0xc07b('0x2b')](0x193)[_0xc07b('0x2d')]({'message':_0xc07b('0x47')});}})['catch'](function(_0x1085b3){_0x3c1969(_0x1085b3);});});};exports[_0xc07b('0x48')]=function(_0x199887,_0x4be6ae,_0xaa0149){_0x199887['isMiddleware']=!![];return _0xaa0149();};exports[_0xc07b('0x49')]=function signToken(_0x185c94){return signJwt(_0x185c94);};exports[_0xc07b('0x4a')]=function(_0x2c9165,_0x57537e){if(!_0x2c9165[_0xc07b('0x25')]){return _0x57537e[_0xc07b('0x2b')](0x194)[_0xc07b('0x2d')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3b19af={'payload':{'id':_0x2c9165[_0xc07b('0x25')]['id'],'role':_0x2c9165['user'][_0xc07b('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3b19af)[_0xc07b('0x2a')](function(_0x7f1d91){_0x57537e[_0xc07b('0x4b')]('motion.token',_0x7f1d91);_0x57537e[_0xc07b('0x4c')](_0xc07b('0x4d'));})['catch'](function(_0x17fcd6){return _0x57537e[_0xc07b('0x2b')](0x1f4)[_0xc07b('0x4e')](_0x17fcd6);});};exports[_0xc07b('0x4f')]=function(_0x5b9ae5){if(_[_0xc07b('0x50')](_0x5b9ae5['apiKeyNonce'])||_[_0xc07b('0x50')](_0x5b9ae5['apiKeyIat'])){return null;}else{return createJwt(_0x5b9ae5);}};exports[_0xc07b('0x51')]=function(_0x5eca9d){_0x5eca9d[_0xc07b('0x3d')]=generateNonce();_0x5eca9d[_0xc07b('0x52')]=generateIssuedAt();return createJwt(_0x5eca9d);};exports[_0xc07b('0x53')]=function(_0x23e582,_0x13dd51){var _0x1db00c=_0x23e582[_0xc07b('0x39')][_0xc07b('0x3a')];if(_0x1db00c){var _0x3f67e9={'nonce':_0x13dd51[_0xc07b('0x3d')],'iat':_0x13dd51[_0xc07b('0x52')],'audience':hardwareConf[_0xc07b('0x3b')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x1db00c,_0x3f67e9)['then'](function(){return generateApiKey(_0x13dd51);});}else{throw{'message':_0xc07b('0x54')};}};function signJwt(_0x57a680){var _0x1af57e=BPromise[_0xc07b('0x55')](jwt['sign'],{'context':jwt});var _0x4af947=_0x57a680[_0xc07b('0x56')]||config[_0xc07b('0x7')][_0xc07b('0x8')];return new BPromise(function(_0x2f1d2f,_0x4da627){_0x1af57e(_0x57a680[_0xc07b('0x57')],_0x4af947,_0x57a680[_0xc07b('0x58')])[_0xc07b('0x2a')](function(_0x6953b9){_0x2f1d2f(_0x6953b9);})['catch'](function(_0xdecb1a){_0x4da627(_0xdecb1a);});});}function verifyJwt(_0x22ddf1,_0x347276,_0xa21e2){var _0x33a663=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x29570d=_0xa21e2||config[_0xc07b('0x7')][_0xc07b('0x8')];return new BPromise(function(_0x51e65c,_0x2920d1){_0x33a663(_0x22ddf1,_0x29570d,_0x347276)[_0xc07b('0x2a')](function(_0x4c980c){_0x51e65c(_0x4c980c);})['catch'](function(_0x11099f){_0x2920d1(_0x11099f);});});}function generateNonce(){return crypto[_0xc07b('0x59')](0x10)[_0xc07b('0x5a')](_0xc07b('0x5b'));}function generateIssuedAt(){return Math['floor'](Date[_0xc07b('0x5c')]()/0x3e8)[_0xc07b('0x5a')]();}function createJwt(_0x223363){var _0x13d702={'payload':{'iat':_0x223363[_0xc07b('0x52')],'nonce':_0x223363[_0xc07b('0x3d')]},'options':{'algorithm':_0xc07b('0x5d'),'subject':_0x223363['id'][_0xc07b('0x5a')](),'issuer':hardwareConf[_0xc07b('0x3b')](),'audience':hardwareConf[_0xc07b('0x3b')]()}};return signJwt(_0x13d702)[_0xc07b('0x2a')](function(_0x310c18){return{'iat':_0x223363[_0xc07b('0x52')],'nonce':_0x223363['apiKeyNonce'],'token':_0x310c18};});} \ No newline at end of file +var _0x8477=['Basic','then','authenticate','pass','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','apiKeyNonce','Invalid\x20API\x20access\x20key','find','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','secrets','session','name','userpic','permissions','md5secret','mailPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','alias','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','closed','status','unmanaged','json','Unmanaged.','catch','headers','authorization'];(function(_0x1f3591,_0x5688f1){var _0x2339f1=function(_0x2f6460){while(--_0x2f6460){_0x1f3591['push'](_0x1f3591['shift']());}};_0x2339f1(++_0x5688f1);}(_0x8477,0x8a));var _0x7847=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0x8477[_0x4fa291];return _0x506d9b;};'use strict';var db=require(_0x7847('0x0'))['db'];var config=require(_0x7847('0x1'));var hardwareConf=require(_0x7847('0x2'));var _=require(_0x7847('0x3'));var jwt=require(_0x7847('0x4'));var expressJwt=require(_0x7847('0x5'));var compose=require(_0x7847('0x6'));var basicAuth=require(_0x7847('0x7'));var crypto=require(_0x7847('0x8'));var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0x7847('0x9')][_0x7847('0xa')]});var userAttributes=['id','role','fullname',_0x7847('0xb'),'internal','email',_0x7847('0xc'),_0x7847('0xd'),_0x7847('0xe'),'voicePause','chatPause',_0x7847('0xf'),'faxPause',_0x7847('0x10'),_0x7847('0x11'),'pauseType',_0x7847('0x12'),_0x7847('0x13'),_0x7847('0x14'),_0x7847('0x15'),'allowmessenger','passwordResetAt',_0x7847('0x16'),'phoneBarAutoAnswer',_0x7847('0x17'),'phoneBarDnd',_0x7847('0x18'),_0x7847('0x19'),_0x7847('0x1a'),_0x7847('0x1b'),_0x7847('0x1c'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x7847('0x1d'),_0x7847('0x1e'),_0x7847('0x1f')];exports[_0x7847('0x20')]=function(){return this[_0x7847('0x21')](!![])[_0x7847('0x22')](function(_0x369ced,_0x4d0245,_0x18c388){if(_0x369ced[_0x7847('0x23')]){_0x18c388();}else{return db[_0x7847('0x24')][_0x7847('0x25')]({'where':{'id':_0x369ced[_0x7847('0x26')]['id']},'attributes':['id','closed',_0x7847('0x27')],'raw':!![]})['then'](function(_0x5275cc){if(_0x5275cc&&_0x5275cc[_0x7847('0x28')]){return _0x4d0245[_0x7847('0x29')](_0x5275cc[_0x7847('0x27')]===_0x7847('0x2a')?0x195:0x193)[_0x7847('0x2b')]({'message':_0x5275cc[_0x7847('0x27')]===_0x7847('0x2a')?_0x7847('0x2c'):'Forbidden.'});}else{_0x18c388();}})[_0x7847('0x2d')](function(_0xef5e97){_0x18c388(_0xef5e97);});}});};exports[_0x7847('0x21')]=function isAuthenticated(_0x563624){return compose()['use'](function(_0x572d9a,_0x9ce321,_0x5e9019){if(_0x572d9a[_0x7847('0x2e')][_0x7847('0x2f')]){if(_['startsWith'](_0x572d9a[_0x7847('0x2e')][_0x7847('0x2f')],_0x7847('0x30'))){var _0x4e61aa=basicAuth(_0x572d9a);db['User']['find']({'where':{'name':_0x4e61aa[_0x7847('0xb')]}})[_0x7847('0x31')](function(_0x34b307){if(!_0x34b307||!_0x34b307[_0x7847('0x32')](_0x4e61aa[_0x7847('0x33')])){return _0x9ce321[_0x7847('0x29')](0x191)[_0x7847('0x2b')]({'message':'Wrong\x20credentials.'});}_0x572d9a['user']={'id':_0x34b307['id']};_0x5e9019();})[_0x7847('0x2d')](function(_0xe54920){_0x5e9019(_0xe54920);});}else if(_[_0x7847('0x34')](_0x572d9a[_0x7847('0x2e')][_0x7847('0x2f')],_0x7847('0x35'))){validateJwt(_0x572d9a,_0x9ce321,_0x5e9019);}else{if(_0x563624){_0x5e9019();}else{return _0x9ce321[_0x7847('0x29')](0x193)['json']({'message':_0x7847('0x36')});}}}else if(_0x572d9a[_0x7847('0x37')][_0x7847('0x38')]){try{var _0x3446cd={'audience':hardwareConf[_0x7847('0x39')](),'issuer':hardwareConf[_0x7847('0x39')]()};verifyJwt(_0x572d9a[_0x7847('0x37')][_0x7847('0x38')],_0x3446cd)[_0x7847('0x31')](function(_0x882a40){return db[_0x7847('0x3a')]['find']({'where':{'id':_0x882a40[_0x7847('0x3b')]}})[_0x7847('0x31')](function(_0x32625e){if(!_0x32625e||!_['isEqual'](_0x32625e[_0x7847('0x3c')],_0x882a40['nonce'])){return _0x9ce321['status'](0x191)[_0x7847('0x2b')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x572d9a['user']={'id':_0x32625e['id']};_0x5e9019();});})[_0x7847('0x2d')](function(){return _0x9ce321['status'](0x191)[_0x7847('0x2b')]({'message':_0x7847('0x3d')});});}catch(_0x3dc1a2){_0x5e9019(_0x3dc1a2);}}else if(_0x563624){_0x5e9019();}else{return _0x9ce321[_0x7847('0x29')](0x193)[_0x7847('0x2b')]({'message':_0x7847('0x36')});}})['use'](function(_0xd60e9b,_0x5147c8,_0x23ae01){if(_0xd60e9b[_0x7847('0x23')]){db[_0x7847('0x3a')][_0x7847('0x3e')]({'where':{'id':_0xd60e9b[_0x7847('0x23')]['id']},'attributes':userAttributes})['then'](function(_0xab37d4){if(!_0xab37d4){return _0x5147c8[_0x7847('0x29')](0x194)['json']({'message':'User\x20not\x20found.'});}_0xd60e9b[_0x7847('0x23')]=_0xab37d4;_0x23ae01();})[_0x7847('0x2d')](function(_0x150901){_0x23ae01(_0x150901);});}else if(_0x563624){_0x23ae01();}else{return _0x5147c8[_0x7847('0x29')](0x194)[_0x7847('0x2b')]({'message':_0x7847('0x3f')});}});};exports[_0x7847('0x40')]=function canUpdate(){return compose()[_0x7847('0x22')](function(_0x666a36,_0x4cdb28,_0x5cfbaf){return require('../../config/license/util')[_0x7847('0x41')]()['then'](function(_0xa9aae2){if(_0xa9aae2[_0x7847('0x42')]){_0x5cfbaf();}else{return _0x4cdb28[_0x7847('0x29')](0x193)['json']({'message':_0x7847('0x43')});}})[_0x7847('0x2d')](function(_0x1fecc7){_0x5cfbaf(_0x1fecc7);});});};exports[_0x7847('0x44')]=function(_0x37079b,_0x40c268,_0x3acf89){_0x37079b[_0x7847('0x44')]=!![];return _0x3acf89();};exports[_0x7847('0x45')]=function signToken(_0x41cc56){return signJwt(_0x41cc56);};exports[_0x7847('0x46')]=function(_0x2b7e09,_0x3755c0){if(!_0x2b7e09[_0x7847('0x23')]){return _0x3755c0['status'](0x194)[_0x7847('0x2b')]({'message':_0x7847('0x47')});}var _0x443578={'payload':{'id':_0x2b7e09[_0x7847('0x23')]['id'],'role':_0x2b7e09[_0x7847('0x23')][_0x7847('0x48')]},'options':{'expiresIn':0x15180}};return signJwt(_0x443578)[_0x7847('0x31')](function(_0x326726){_0x3755c0[_0x7847('0x49')]('motion.token',_0x326726);_0x3755c0['redirect'](_0x7847('0x4a'));})[_0x7847('0x2d')](function(_0x58e9f7){return _0x3755c0[_0x7847('0x29')](0x1f4)[_0x7847('0x4b')](_0x58e9f7);});};exports[_0x7847('0x4c')]=function(_0x32d19e){if(_[_0x7847('0x4d')](_0x32d19e['apiKeyNonce'])||_[_0x7847('0x4d')](_0x32d19e[_0x7847('0x4e')])){return null;}else{return createJwt(_0x32d19e);}};exports[_0x7847('0x4f')]=function(_0x5ba001){_0x5ba001['apiKeyNonce']=generateNonce();_0x5ba001[_0x7847('0x4e')]=generateIssuedAt();return createJwt(_0x5ba001);};exports[_0x7847('0x50')]=function(_0x9f9c94,_0x2ec232){var _0x38d0c3=_0x9f9c94[_0x7847('0x37')][_0x7847('0x38')];if(_0x38d0c3){var _0x4b43ac={'nonce':_0x2ec232[_0x7847('0x3c')],'iat':_0x2ec232['apiKeyIat'],'audience':hardwareConf[_0x7847('0x39')](),'issuer':hardwareConf[_0x7847('0x39')]()};return verifyJwt(_0x38d0c3,_0x4b43ac)[_0x7847('0x31')](function(){return generateApiKey(_0x2ec232);});}else{throw{'message':_0x7847('0x51')};}};function signJwt(_0x1b417a){var _0x79d4cc=BPromise[_0x7847('0x52')](jwt[_0x7847('0x53')],{'context':jwt});var _0x4e3db6=_0x1b417a[_0x7847('0x54')]||config[_0x7847('0x9')][_0x7847('0xa')];return new BPromise(function(_0x4b6045,_0x26a409){_0x79d4cc(_0x1b417a[_0x7847('0x55')],_0x4e3db6,_0x1b417a[_0x7847('0x56')])[_0x7847('0x31')](function(_0x321301){_0x4b6045(_0x321301);})[_0x7847('0x2d')](function(_0x537323){_0x26a409(_0x537323);});});}function verifyJwt(_0x147b52,_0x24189d,_0x2a6537){var _0x32bfdc=BPromise[_0x7847('0x52')](jwt[_0x7847('0x57')],{'context':jwt});var _0x321a85=_0x2a6537||config[_0x7847('0x9')]['session'];return new BPromise(function(_0x500a91,_0xf67d27){_0x32bfdc(_0x147b52,_0x321a85,_0x24189d)[_0x7847('0x31')](function(_0x231841){_0x500a91(_0x231841);})[_0x7847('0x2d')](function(_0x5be06c){_0xf67d27(_0x5be06c);});});}function generateNonce(){return crypto[_0x7847('0x58')](0x10)[_0x7847('0x59')](_0x7847('0x5a'));}function generateIssuedAt(){return Math[_0x7847('0x5b')](Date[_0x7847('0x5c')]()/0x3e8)['toString']();}function createJwt(_0x4952a2){var _0xf54a7c={'payload':{'iat':_0x4952a2[_0x7847('0x4e')],'nonce':_0x4952a2['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x4952a2['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x7847('0x39')]()}};return signJwt(_0xf54a7c)[_0x7847('0x31')](function(_0x3824d3){return{'iat':_0x4952a2[_0x7847('0x4e')],'nonce':_0x4952a2[_0x7847('0x3c')],'token':_0x3824d3};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e9a45c3..e0efd22 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 _0xd8b0=['data','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','update','crypto','bluebird','hasOwnProperty','encryptFile','createWriteStream','createCipher','algorithm'];(function(_0xb0c2ac,_0x23c68a){var _0x5e726d=function(_0x1a7b5d){while(--_0x1a7b5d){_0xb0c2ac['push'](_0xb0c2ac['shift']());}};_0x5e726d(++_0x23c68a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var crypto=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var defaultOptions={'algorithm':'aes192'};function combineOptions(_0x585166){var _0x4b72b0={};for(var _0x3ff8df in defaultOptions){if(defaultOptions[_0x0d8b('0x2')](_0x3ff8df)){_0x4b72b0[_0x3ff8df]=defaultOptions[_0x3ff8df];}}if(_0x585166){for(var _0x43bca1 in _0x585166){if(_0x585166[_0x0d8b('0x2')](_0x43bca1)){_0x4b72b0[_0x43bca1]=_0x585166[_0x43bca1];}}}return _0x4b72b0;}exports[_0x0d8b('0x3')]=function(_0x577834,_0x5e15e6,_0x3f8b6f,_0x227c63){return new BPromise(function(_0x39f43a,_0x4a4470){_0x227c63=combineOptions(_0x227c63);var _0x413284=new Buffer(_0x3f8b6f);var _0x284169=fs['createReadStream'](_0x577834);var _0x129310=fs[_0x0d8b('0x4')](_0x5e15e6);var _0x3b027f=crypto[_0x0d8b('0x5')](_0x227c63[_0x0d8b('0x6')],_0x413284);_0x284169['on'](_0x0d8b('0x7'),function(_0x2c5e9e){var _0x28f87c=new Buffer(_0x3b027f['update'](_0x2c5e9e),_0x0d8b('0x8'));_0x129310['write'](_0x28f87c);});_0x284169['on'](_0x0d8b('0x9'),function(){try{var _0xc574a3=new Buffer(_0x3b027f[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x129310[_0x0d8b('0xb')](_0xc574a3);_0x129310[_0x0d8b('0x9')]();_0x129310['on'](_0x0d8b('0xc'),function(){return _0x39f43a(_0x5e15e6);});}catch(_0x1d4bbc){fs[_0x0d8b('0xd')](_0x5e15e6);return _0x4a4470(_0x1d4bbc);}});});};exports[_0x0d8b('0xe')]=function(_0xe65334,_0x1567ce,_0x2d4e1c,_0x4f6f21){return new BPromise(function(_0x23eb7b,_0xa86349){_0x4f6f21=combineOptions(_0x4f6f21);var _0x17f7df=new Buffer(_0x2d4e1c);var _0xe2e167=fs[_0x0d8b('0xf')](_0xe65334);var _0x5cd485=fs[_0x0d8b('0x4')](_0x1567ce);var _0x4586c2=crypto[_0x0d8b('0x10')](_0x4f6f21[_0x0d8b('0x6')],_0x17f7df);_0xe2e167['on'](_0x0d8b('0x7'),function(_0x18dd2d){var _0x264b39=new Buffer(_0x4586c2[_0x0d8b('0x11')](_0x18dd2d),'binary');_0x5cd485[_0x0d8b('0xb')](_0x264b39);});_0xe2e167['on'](_0x0d8b('0x9'),function(){try{var _0x196c0a=new Buffer(_0x4586c2[_0x0d8b('0xa')](_0x0d8b('0x8')),_0x0d8b('0x8'));_0x5cd485[_0x0d8b('0xb')](_0x196c0a);_0x5cd485[_0x0d8b('0x9')]();_0x5cd485['on']('close',function(){return _0x23eb7b(_0x1567ce);});}catch(_0x4f0a1a){fs[_0x0d8b('0xd')](_0x1567ce);return _0xa86349(_0x4f0a1a);}});});}; \ No newline at end of file +var _0x0713=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink'];(function(_0x7f7800,_0x3539e4){var _0x13b08b=function(_0x4b3340){while(--_0x4b3340){_0x7f7800['push'](_0x7f7800['shift']());}};_0x13b08b(++_0x3539e4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x3071('0x0')};function combineOptions(_0x2afa91){var _0x27405a={};for(var _0x305d85 in defaultOptions){if(defaultOptions[_0x3071('0x1')](_0x305d85)){_0x27405a[_0x305d85]=defaultOptions[_0x305d85];}}if(_0x2afa91){for(var _0x52b5fb in _0x2afa91){if(_0x2afa91[_0x3071('0x1')](_0x52b5fb)){_0x27405a[_0x52b5fb]=_0x2afa91[_0x52b5fb];}}}return _0x27405a;}exports[_0x3071('0x2')]=function(_0x33a70c,_0x3137c8,_0xabd7b6,_0x41cf76){return new BPromise(function(_0x1d3dd6,_0x2f1e87){_0x41cf76=combineOptions(_0x41cf76);var _0xbd737f=new Buffer(_0xabd7b6);var _0x22274c=fs[_0x3071('0x3')](_0x33a70c);var _0x2fce7a=fs[_0x3071('0x4')](_0x3137c8);var _0x4a36ec=crypto[_0x3071('0x5')](_0x41cf76[_0x3071('0x6')],_0xbd737f);_0x22274c['on'](_0x3071('0x7'),function(_0xff9a29){var _0x1ce844=new Buffer(_0x4a36ec['update'](_0xff9a29),_0x3071('0x8'));_0x2fce7a[_0x3071('0x9')](_0x1ce844);});_0x22274c['on'](_0x3071('0xa'),function(){try{var _0x3ed4a0=new Buffer(_0x4a36ec[_0x3071('0xb')]('binary'),'binary');_0x2fce7a[_0x3071('0x9')](_0x3ed4a0);_0x2fce7a['end']();_0x2fce7a['on'](_0x3071('0xc'),function(){return _0x1d3dd6(_0x3137c8);});}catch(_0x44fbae){fs['unlink'](_0x3137c8);return _0x2f1e87(_0x44fbae);}});});};exports[_0x3071('0xd')]=function(_0x4e1219,_0x2fc15d,_0x45c93b,_0x1271d0){return new BPromise(function(_0x1f14e1,_0x1caa5d){_0x1271d0=combineOptions(_0x1271d0);var _0x2a6a4b=new Buffer(_0x45c93b);var _0x157a47=fs[_0x3071('0x3')](_0x4e1219);var _0x21aad3=fs[_0x3071('0x4')](_0x2fc15d);var _0x5f3c22=crypto[_0x3071('0xe')](_0x1271d0[_0x3071('0x6')],_0x2a6a4b);_0x157a47['on'](_0x3071('0x7'),function(_0x108a83){var _0x3acf0e=new Buffer(_0x5f3c22[_0x3071('0xf')](_0x108a83),_0x3071('0x8'));_0x21aad3[_0x3071('0x9')](_0x3acf0e);});_0x157a47['on']('end',function(){try{var _0x359e66=new Buffer(_0x5f3c22[_0x3071('0xb')](_0x3071('0x8')),'binary');_0x21aad3[_0x3071('0x9')](_0x359e66);_0x21aad3['end']();_0x21aad3['on'](_0x3071('0xc'),function(){return _0x1f14e1(_0x2fc15d);});}catch(_0x43128c){fs[_0x3071('0x10')](_0x2fc15d);return _0x1caa5d(_0x43128c);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 2063e45..c32a44c 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 _0x5636=['mkdirSync','csv','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','.csv','join'];(function(_0x1bcc92,_0x4929b8){var _0x88406a=function(_0x4670f8){while(--_0x4670f8){_0x1bcc92['push'](_0x1bcc92['shift']());}};_0x88406a(++_0x4929b8);}(_0x5636,0x102));var _0x6563=function(_0x26dcb6,_0x3b1d76){_0x26dcb6=_0x26dcb6-0x0;var _0x2bb139=_0x5636[_0x26dcb6];return _0x2bb139;};'use strict';var util=require(_0x6563('0x0'));var path=require(_0x6563('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x6563('0x2'));var rimraf=require(_0x6563('0x3'));var db=require(_0x6563('0x4'))['db'];var dbH=require('../../mysqldb')[_0x6563('0x5')];var logger=require(_0x6563('0x6'))(_0x6563('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x6563('0x8')][0x2]);var QUERY=process[_0x6563('0x8')][0x3];var PATH=process[_0x6563('0x8')][0x4];function analyticExtractedReport(_0x9884a9,_0x2d57d5){var _0x2d0d5b={'status':_0x9884a9};var _0x98fcd4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d57d5){_0x2d0d5b[_0x6563('0x9')]=_0x2d57d5;}return db[_0x6563('0xa')][_0x6563('0xb')](_0x2d0d5b,_0x98fcd4);}function main(){var _0x516d1a=0x1388;var _0x51fdc2;logger[_0x6563('0xc')](util[_0x6563('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x6563('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6563('0xf'),_0x6563('0x10')]})[_0x6563('0x11')](function(_0x33816e){if(_0x33816e){_0x51fdc2=_0x33816e;_0x516d1a=_0x51fdc2[_0x6563('0x10')]||0x1388;}})[_0x6563('0x11')](function(){return dbH[_0x6563('0x12')][_0x6563('0x13')](util['format'](_0x6563('0x14'),QUERY),{'type':dbH['sequelize'][_0x6563('0x15')][_0x6563('0x16')]});})[_0x6563('0x11')](function(_0x10d08c){if(!_0x10d08c[0x0]['num']){return analyticExtractedReport(_0x6563('0x17'));}var _0x11baa2=[];var _0x477d9b=0x0;var _0xd398ce=!![];if(_0x10d08c&&_0x10d08c['length']){var _0x3563fd=_0x10d08c[0x0]['num']%(_0x477d9b+_0x516d1a);if(_0x51fdc2['split']){for(;_0xd398ce;_0x477d9b+=_0x516d1a,_0x3563fd=_0x10d08c[0x0]['num']%(_0x477d9b+_0x516d1a)){if(_0x3563fd==0x0||_0x3563fd==_0x10d08c[0x0][_0x6563('0x18')]){_0xd398ce=![];}_0x11baa2['push'](dbH['sequelize'][_0x6563('0x13')](util[_0x6563('0xd')](_0x6563('0x19'),QUERY,_0x516d1a,_0x477d9b),{'type':dbH[_0x6563('0x12')][_0x6563('0x15')][_0x6563('0x16')]}));}}else{_0x11baa2[_0x6563('0x1a')](dbH[_0x6563('0x12')][_0x6563('0x13')](QUERY,{'type':dbH['sequelize'][_0x6563('0x15')][_0x6563('0x16')]}));}}var _0x20b478=path['dirname'](PATH);var _0x293db2=path['basename'](PATH,_0x6563('0x1b'));var _0x105379=_0x51fdc2['split']&&_0x11baa2['length']>0x1;var _0x3ab7f6=[];if(!fs['existsSync'](path[_0x6563('0x1c')](_0x20b478,_0x293db2))&&_0x105379){fs[_0x6563('0x1d')](path[_0x6563('0x1c')](_0x20b478,_0x293db2));}return BPromise['each'](_0x11baa2,function(_0xd860d5){_0x3ab7f6['push'](_0xd860d5);})[_0x6563('0x11')](function(){for(var _0x1590e6=0x0;_0x1590e6<_0x3ab7f6['length'];_0x1590e6+=0x1){var _0x365b16;var _0x28252d=_0x3ab7f6[_0x1590e6];if(_0x105379){_0x365b16=path['join'](_0x20b478,_0x293db2,util[_0x6563('0xd')]('%s%d.%s',_0x293db2,_0x1590e6,_0x6563('0x1e')));}else{_0x365b16=path['join'](_0x20b478,util['format'](_0x6563('0x1f'),_0x293db2,_0x6563('0x1e')));}fs[_0x6563('0x20')](_0x365b16,csv(_0x28252d));}})[_0x6563('0x11')](function(){if(_0x105379){zipdir(path[_0x6563('0x1c')](_0x20b478,_0x293db2),{'saveTo':path['join'](_0x20b478,util[_0x6563('0xd')]('%s.%s',_0x293db2,'zip'))},function(_0x3582c9,_0x35af37){});rimraf(path[_0x6563('0x1c')](_0x20b478,_0x293db2),function(){});}})[_0x6563('0x11')](function(){logger[_0x6563('0xc')](util[_0x6563('0xd')](_0x6563('0x21'),EXTRACTED_REPORT_ID,_0x6563('0x22')));return analyticExtractedReport(_0x6563('0x23'),_0x105379?util[_0x6563('0xd')]('%s.%s',_0x293db2,_0x105379?_0x6563('0x24'):_0x6563('0x1e')):null);});})[_0x6563('0x25')](function(_0x1558fb){logger[_0x6563('0xc')](util[_0x6563('0xd')](_0x6563('0x26'),EXTRACTED_REPORT_ID,'CSV'),util[_0x6563('0x27')](_0x1558fb,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6563('0x28'));});}main(); \ No newline at end of file +var _0x4522=['Setting','find','split','splitSizeCsv','then','format','sequelize','SELECT','num','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','mkdirSync','join','each','csv','writeFileSync','Completed','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','CSV'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4522,0x1a0));var _0x2452=function(_0x29863,_0x13a7e7){_0x29863=_0x29863-0x0;var _0x530d8e=_0x4522[_0x29863];return _0x530d8e;};'use strict';var util=require('util');var path=require('path');var _=require(_0x2452('0x0'));var csv=require(_0x2452('0x1'));var fs=require('fs');var BPromise=require(_0x2452('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x2452('0x3'));var db=require(_0x2452('0x4'))['db'];var dbH=require(_0x2452('0x4'))[_0x2452('0x5')];var logger=require(_0x2452('0x6'))(_0x2452('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x2452('0x8')][0x2]);var QUERY=process[_0x2452('0x8')][0x3];var PATH=process[_0x2452('0x8')][0x4];function analyticExtractedReport(_0x149807,_0x3bc193){var _0x33b935={'status':_0x149807};var _0x24073f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3bc193){_0x33b935[_0x2452('0x9')]=_0x3bc193;}return db[_0x2452('0xa')][_0x2452('0xb')](_0x33b935,_0x24073f);}function main(){var _0x5a38e0=0x1388;var _0x5dc630;logger[_0x2452('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2452('0xd')));return db[_0x2452('0xe')][_0x2452('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2452('0x10'),_0x2452('0x11')]})[_0x2452('0x12')](function(_0x2c1e0f){if(_0x2c1e0f){_0x5dc630=_0x2c1e0f;_0x5a38e0=_0x5dc630[_0x2452('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0x2452('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x2452('0x14')]['QueryTypes'][_0x2452('0x15')]});})[_0x2452('0x12')](function(_0x5d0438){if(!_0x5d0438[0x0][_0x2452('0x16')]){return analyticExtractedReport('Empty');}var _0x3dd8cc=[];var _0x734b88=0x0;var _0x461d2b=!![];if(_0x5d0438&&_0x5d0438[_0x2452('0x17')]){var _0x4e1d20=_0x5d0438[0x0][_0x2452('0x16')]%(_0x734b88+_0x5a38e0);if(_0x5dc630[_0x2452('0x10')]){for(;_0x461d2b;_0x734b88+=_0x5a38e0,_0x4e1d20=_0x5d0438[0x0]['num']%(_0x734b88+_0x5a38e0)){if(_0x4e1d20==0x0||_0x4e1d20==_0x5d0438[0x0]['num']){_0x461d2b=![];}_0x3dd8cc[_0x2452('0x18')](dbH[_0x2452('0x14')][_0x2452('0x19')](util['format'](_0x2452('0x1a'),QUERY,_0x5a38e0,_0x734b88),{'type':dbH[_0x2452('0x14')][_0x2452('0x1b')][_0x2452('0x15')]}));}}else{_0x3dd8cc[_0x2452('0x18')](dbH[_0x2452('0x14')][_0x2452('0x19')](QUERY,{'type':dbH[_0x2452('0x14')]['QueryTypes']['SELECT']}));}}var _0x1f060d=path[_0x2452('0x1c')](PATH);var _0x4bb3ff=path[_0x2452('0x1d')](PATH,_0x2452('0x1e'));var _0x1d5720=_0x5dc630[_0x2452('0x10')]&&_0x3dd8cc[_0x2452('0x17')]>0x1;var _0x397f21=[];if(!fs[_0x2452('0x1f')](path['join'](_0x1f060d,_0x4bb3ff))&&_0x1d5720){fs[_0x2452('0x20')](path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff));}return BPromise[_0x2452('0x22')](_0x3dd8cc,function(_0x231410){_0x397f21[_0x2452('0x18')](_0x231410);})['then'](function(){for(var _0x48783a=0x0;_0x48783a<_0x397f21[_0x2452('0x17')];_0x48783a+=0x1){var _0x159ba1;var _0x46fcbb=_0x397f21[_0x48783a];if(_0x1d5720){_0x159ba1=path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff,util[_0x2452('0x13')]('%s%d.%s',_0x4bb3ff,_0x48783a,_0x2452('0x23')));}else{_0x159ba1=path[_0x2452('0x21')](_0x1f060d,util['format']('%s.%s',_0x4bb3ff,_0x2452('0x23')));}fs[_0x2452('0x24')](_0x159ba1,csv(_0x46fcbb));}})[_0x2452('0x12')](function(){if(_0x1d5720){zipdir(path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff),{'saveTo':path[_0x2452('0x21')](_0x1f060d,util[_0x2452('0x13')]('%s.%s',_0x4bb3ff,'zip'))},function(_0x46b611,_0x454e0a){});rimraf(path[_0x2452('0x21')](_0x1f060d,_0x4bb3ff),function(){});}})['then'](function(){logger[_0x2452('0xc')](util[_0x2452('0x13')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x2452('0xd')));return analyticExtractedReport(_0x2452('0x25'),_0x1d5720?util[_0x2452('0x13')](_0x2452('0x26'),_0x4bb3ff,_0x1d5720?_0x2452('0x27'):_0x2452('0x23')):null);});})[_0x2452('0x28')](function(_0x115e09){logger[_0x2452('0xc')](util[_0x2452('0x13')](_0x2452('0x29'),EXTRACTED_REPORT_ID,_0x2452('0xd')),util[_0x2452('0x2a')](_0x115e09,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 5c664ef..b8e0cdb 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x58a4b9,_0x1d4e4a){var _0x58aac5=function(_0xd4527d){while(--_0xd4527d){_0x58a4b9['push'](_0x58a4b9['shift']());}};_0x58aac5(++_0x1d4e4a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x4a298f,_0x3edefc){var _0x1703c1=function(_0x483d57){while(--_0x483d57){_0x4a298f['push'](_0x4a298f['shift']());}};_0x1703c1(++_0x3edefc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x411c4a,_0x1769a5){_0x411c4a=_0x411c4a-0x0;var _0xdca442=_0x5f2f[_0x411c4a];return _0xdca442;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 14870a5..955869b 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 _0x830b=['xlsx','%s.%s','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','.xlsx','existsSync','join','mkdirSync','each'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x830b,0xab));var _0xb830=function(_0xf17c26,_0x31b7df){_0xf17c26=_0xf17c26-0x0;var _0x23a5ae=_0x830b[_0xf17c26];return _0x23a5ae;};'use strict';var util=require('util');var path=require('path');var _=require(_0xb830('0x0'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xb830('0x1'));var zipdir=require(_0xb830('0x2'));var rimraf=require(_0xb830('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb830('0x4'))[_0xb830('0x5')];var logger=require(_0xb830('0x6'))(_0xb830('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xb830('0x8')][0x2]);var QUERY=process[_0xb830('0x8')][0x3];var PATH=process[_0xb830('0x8')][0x4];function analyticExtractedReport(_0x350230,_0x2c634b){var _0x3b95ed={'status':_0x350230};var _0x2a5298={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2c634b){_0x3b95ed[_0xb830('0x9')]=_0x2c634b;}return db['AnalyticExtractedReport'][_0xb830('0xa')](_0x3b95ed,_0x2a5298);}function main(){var _0x4571ef=0x1388;var _0x4b26ed;logger[_0xb830('0xb')](util[_0xb830('0xc')](_0xb830('0xd'),EXTRACTED_REPORT_ID,_0xb830('0xe')));return db['Setting'][_0xb830('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb830('0x10'),_0xb830('0x11')]})['then'](function(_0x527a7a){if(_0x527a7a){_0x4b26ed=_0x527a7a;_0x4571ef=_0x4b26ed['splitSizeXlsx']||0x1388;}})[_0xb830('0x12')](function(){return dbH[_0xb830('0x13')][_0xb830('0x14')](util[_0xb830('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb830('0x13')][_0xb830('0x15')][_0xb830('0x16')]});})[_0xb830('0x12')](function(_0x1c6c0a){if(!_0x1c6c0a[0x0][_0xb830('0x17')]){return analyticExtractedReport(_0xb830('0x18'));}var _0x27eede=[];var _0x2eab32=0x0;var _0x127304=!![];if(_0x4b26ed[_0xb830('0x10')]){if(_0x1c6c0a&&_0x1c6c0a[_0xb830('0x19')]){var _0x135d6e=_0x1c6c0a[0x0][_0xb830('0x17')]%(_0x2eab32+_0x4571ef);for(;_0x127304;_0x2eab32+=_0x4571ef,_0x135d6e=_0x1c6c0a[0x0][_0xb830('0x17')]%(_0x2eab32+_0x4571ef)){if(_0x135d6e==0x0||_0x135d6e==_0x1c6c0a[0x0]['num']){_0x127304=![];}_0x27eede['push'](dbH[_0xb830('0x13')]['query'](util[_0xb830('0xc')](_0xb830('0x1a'),QUERY,_0x4571ef,_0x2eab32),{'type':dbH[_0xb830('0x13')][_0xb830('0x15')][_0xb830('0x16')]}));}}}else{_0x27eede[_0xb830('0x1b')](dbH['sequelize'][_0xb830('0x14')](QUERY,{'type':dbH[_0xb830('0x13')][_0xb830('0x15')][_0xb830('0x16')]}));}var _0x48c726=path['dirname'](PATH);var _0x2611ee=path[_0xb830('0x1c')](PATH,_0xb830('0x1d'));var _0x58adb2=_0x4b26ed[_0xb830('0x10')]&&_0x27eede['length']>0x1;var _0x4a880b=[];if(!fs[_0xb830('0x1e')](path[_0xb830('0x1f')](_0x48c726,_0x2611ee))&&_0x58adb2){fs[_0xb830('0x20')](path[_0xb830('0x1f')](_0x48c726,_0x2611ee));}return BPromise[_0xb830('0x21')](_0x27eede,function(_0x490842){_0x4a880b['push'](_0x490842);})['then'](function(){for(var _0x44cac2=0x0;_0x44cac2<_0x4a880b[_0xb830('0x19')];_0x44cac2+=0x1){var _0x59ddcf;var _0x345a67=_0x4a880b[_0x44cac2];if(_0x58adb2){_0x59ddcf=path[_0xb830('0x1f')](_0x48c726,_0x2611ee,util['format']('%s%d.%s',_0x2611ee,_0x44cac2,_0xb830('0x22')));}else{_0x59ddcf=path['join'](_0x48c726,util[_0xb830('0xc')](_0xb830('0x23'),_0x2611ee,_0xb830('0x22')));}fs['writeFileSync'](_0x59ddcf,json2xls(_0x345a67),_0xb830('0x24'));}})[_0xb830('0x12')](function(){if(_0x58adb2){zipdir(path[_0xb830('0x1f')](_0x48c726,_0x2611ee),{'saveTo':path[_0xb830('0x1f')](_0x48c726,util['format']('%s.%s',_0x2611ee,'zip'))},function(_0x183ce1,_0x3a4761){});rimraf(path[_0xb830('0x1f')](_0x48c726,_0x2611ee),function(){});}})[_0xb830('0x12')](function(){logger[_0xb830('0xb')](util[_0xb830('0xc')](_0xb830('0x25'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xb830('0x26'),_0x58adb2?util[_0xb830('0xc')](_0xb830('0x23'),_0x2611ee,_0x58adb2?'zip':_0xb830('0x22')):null);});})[_0xb830('0x27')](function(_0x3371c4){logger[_0xb830('0xb')](util[_0xb830('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb830('0xe')),util['inspect'](_0x3371c4,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xb830('0x28'));});}main(); \ No newline at end of file +var _0x1bf9=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','basename','.xlsx','join','mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize'];(function(_0x397b9e,_0x58e7c9){var _0x3f3231=function(_0x2e0ce0){while(--_0x2e0ce0){_0x397b9e['push'](_0x397b9e['shift']());}};_0x3f3231(++_0x58e7c9);}(_0x1bf9,0x188));var _0x91bf=function(_0x19646c,_0x577c8f){_0x19646c=_0x19646c-0x0;var _0xee2dfc=_0x1bf9[_0x19646c];return _0xee2dfc;};'use strict';var util=require(_0x91bf('0x0'));var path=require('path');var _=require(_0x91bf('0x1'));var fs=require('fs');var json2xls=require(_0x91bf('0x2'));var BPromise=require(_0x91bf('0x3'));var zipdir=require(_0x91bf('0x4'));var rimraf=require(_0x91bf('0x5'));var db=require(_0x91bf('0x6'))['db'];var dbH=require(_0x91bf('0x6'))['dbH'];var logger=require(_0x91bf('0x7'))(_0x91bf('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x91bf('0x9')][0x3];var PATH=process[_0x91bf('0x9')][0x4];function analyticExtractedReport(_0x2cd9f3,_0x15dca8){var _0x18c45f={'status':_0x2cd9f3};var _0x55780f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15dca8){_0x18c45f[_0x91bf('0xa')]=_0x15dca8;}return db[_0x91bf('0xb')]['update'](_0x18c45f,_0x55780f);}function main(){var _0x3d27ff=0x1388;var _0x5731d2;logger[_0x91bf('0xc')](util[_0x91bf('0xd')](_0x91bf('0xe'),EXTRACTED_REPORT_ID,_0x91bf('0xf')));return db[_0x91bf('0x10')][_0x91bf('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x91bf('0x12'),_0x91bf('0x13')]})[_0x91bf('0x14')](function(_0x15d01a){if(_0x15d01a){_0x5731d2=_0x15d01a;_0x3d27ff=_0x5731d2['splitSizeXlsx']||0x1388;}})[_0x91bf('0x14')](function(){return dbH[_0x91bf('0x15')]['query'](util[_0x91bf('0xd')](_0x91bf('0x16'),QUERY),{'type':dbH['sequelize'][_0x91bf('0x17')][_0x91bf('0x18')]});})[_0x91bf('0x14')](function(_0x4ecf96){if(!_0x4ecf96[0x0][_0x91bf('0x19')]){return analyticExtractedReport('Empty');}var _0x5cee06=[];var _0x302627=0x0;var _0x5d5ae7=!![];if(_0x5731d2[_0x91bf('0x12')]){if(_0x4ecf96&&_0x4ecf96[_0x91bf('0x1a')]){var _0xf8f580=_0x4ecf96[0x0][_0x91bf('0x19')]%(_0x302627+_0x3d27ff);for(;_0x5d5ae7;_0x302627+=_0x3d27ff,_0xf8f580=_0x4ecf96[0x0][_0x91bf('0x19')]%(_0x302627+_0x3d27ff)){if(_0xf8f580==0x0||_0xf8f580==_0x4ecf96[0x0][_0x91bf('0x19')]){_0x5d5ae7=![];}_0x5cee06[_0x91bf('0x1b')](dbH[_0x91bf('0x15')]['query'](util['format'](_0x91bf('0x1c'),QUERY,_0x3d27ff,_0x302627),{'type':dbH[_0x91bf('0x15')][_0x91bf('0x17')][_0x91bf('0x18')]}));}}}else{_0x5cee06[_0x91bf('0x1b')](dbH[_0x91bf('0x15')][_0x91bf('0x1d')](QUERY,{'type':dbH[_0x91bf('0x15')][_0x91bf('0x17')][_0x91bf('0x18')]}));}var _0x5d9c6e=path[_0x91bf('0x1e')](PATH);var _0x1ddefa=path[_0x91bf('0x1f')](PATH,_0x91bf('0x20'));var _0x1a0759=_0x5731d2[_0x91bf('0x12')]&&_0x5cee06[_0x91bf('0x1a')]>0x1;var _0xd4d9d6=[];if(!fs['existsSync'](path[_0x91bf('0x21')](_0x5d9c6e,_0x1ddefa))&&_0x1a0759){fs[_0x91bf('0x22')](path[_0x91bf('0x21')](_0x5d9c6e,_0x1ddefa));}return BPromise['each'](_0x5cee06,function(_0x3551ef){_0xd4d9d6['push'](_0x3551ef);})['then'](function(){for(var _0x5db38e=0x0;_0x5db38e<_0xd4d9d6[_0x91bf('0x1a')];_0x5db38e+=0x1){var _0x42fced;var _0xb416a0=_0xd4d9d6[_0x5db38e];if(_0x1a0759){_0x42fced=path[_0x91bf('0x21')](_0x5d9c6e,_0x1ddefa,util['format'](_0x91bf('0x23'),_0x1ddefa,_0x5db38e,_0x91bf('0x24')));}else{_0x42fced=path[_0x91bf('0x21')](_0x5d9c6e,util['format'](_0x91bf('0x25'),_0x1ddefa,_0x91bf('0x24')));}fs[_0x91bf('0x26')](_0x42fced,json2xls(_0xb416a0),_0x91bf('0x27'));}})[_0x91bf('0x14')](function(){if(_0x1a0759){zipdir(path[_0x91bf('0x21')](_0x5d9c6e,_0x1ddefa),{'saveTo':path[_0x91bf('0x21')](_0x5d9c6e,util[_0x91bf('0xd')](_0x91bf('0x25'),_0x1ddefa,_0x91bf('0x28')))},function(_0x1b35e2,_0x3f1092){});rimraf(path[_0x91bf('0x21')](_0x5d9c6e,_0x1ddefa),function(){});}})[_0x91bf('0x14')](function(){logger[_0x91bf('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x91bf('0xf')));return analyticExtractedReport(_0x91bf('0x29'),_0x1a0759?util[_0x91bf('0xd')]('%s.%s',_0x1ddefa,_0x1a0759?_0x91bf('0x28'):'xlsx'):null);});})[_0x91bf('0x2a')](function(_0x391ed6){logger['info'](util[_0x91bf('0xd')](_0x91bf('0x2b'),EXTRACTED_REPORT_ID,_0x91bf('0xf')),util[_0x91bf('0x2c')](_0x391ed6,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x91bf('0x2d'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 9885291..9ae8c9d 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 _0x0f1e=['transaction','VoiceExtension','destroy','bulkCreate','sortBy','catch','error','rewrite','models','Interval','then','intervals','IntervalId','findAll','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extension','find','extensions','type','Set','CDR(type)=%s','context','VoiceExtensionId','outbound','push','CDR(destination)=','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','*,*,*,*','interval','tag','callerID','answer','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','Hangup','concat'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x0f1e,0x18e));var _0xe0f1=function(_0x2d78d7,_0x294303){_0x2d78d7=_0x2d78d7-0x0;var _0x180374=_0x0f1e[_0x2d78d7];return _0x180374;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0xc073a6,_0x5a87fc){var _0x3c76ac=this;return _0xc073a6[_0xe0f1('0x0')][_0xe0f1('0x1')]['findAll']({'raw':!![]})[_0xe0f1('0x2')](function(_0x112769){_0x3c76ac[_0xe0f1('0x3')]=_0x112769;return _0xc073a6[_0xe0f1('0x0')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x5a87fc[_0xe0f1('0x4')]},'raw':!![]});})['then'](function(_0x3d3ace){return _0xc073a6[_0xe0f1('0x0')]['VoiceExtension'][_0xe0f1('0x5')]({'where':{'exten':{'$in':_[_0xe0f1('0x6')](_[_0xe0f1('0x7')](_0x3d3ace,_0xe0f1('0x8')))}},'order':[{'raw':_0xe0f1('0x9')}],'raw':!![]});})[_0xe0f1('0x2')](function(_0x23433a){var _0x2515ab=_[_0xe0f1('0xa')](_0x23433a,{'priority':'1'});var _0x5a87fa=_['filter'](_0x23433a,{'isApp':0x1});var _0x50836d=_['groupBy'](_0x5a87fa,_0xe0f1('0x8'));var _0x1ca352=[_0xe0f1('0xb'),'playback'];var _0x2a62d0=[];var _0xf1fe38=[];for(var _0x51e540 in _0x50836d){if(_0x50836d[_0xe0f1('0xc')](_0x51e540)){_0x3c76ac[_0xe0f1('0xd')]=0x2;_0x3c76ac['extensions']=[];_0x3c76ac[_0xe0f1('0xe')]=_[_0xe0f1('0xf')](_0x2515ab,{'exten':_0x50836d[_0x51e540][0x0][_0xe0f1('0x8')]});_0x3c76ac[_0xe0f1('0x10')]['push']({'type':_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')],'app':_0xe0f1('0x12'),'appdata':util['format'](_0xe0f1('0x13'),_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')]),'context':_0x50836d[_0x51e540][0x0][_0xe0f1('0x14')],'exten':_0x50836d[_0x51e540][0x0][_0xe0f1('0x8')],'priority':_0x3c76ac['priority']++,'VoiceExtensionId':_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]});if(_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')]===_0xe0f1('0x16')){if(_0x3c76ac['extension']){_0x3c76ac['extensions'][_0xe0f1('0x17')]({'type':_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')],'app':_0xe0f1('0x12'),'appdata':_0xe0f1('0x18')+(_0x3c76ac[_0xe0f1('0xe')][_0xe0f1('0x19')]?'${EXTEN:'+_0x3c76ac[_0xe0f1('0xe')][_0xe0f1('0x19')]+'}':'${EXTEN}'),'context':_0x50836d[_0x51e540][0x0][_0xe0f1('0x14')],'exten':_0x50836d[_0x51e540][0x0][_0xe0f1('0x8')],'priority':_0x3c76ac[_0xe0f1('0xd')]++,'VoiceExtensionId':_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]});}_0x3c76ac[_0xe0f1('0x10')][_0xe0f1('0x17')]({'type':_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')],'app':_0xe0f1('0x12'),'appdata':_0xe0f1('0x1a')+_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')],'context':_0x50836d[_0x51e540][0x0][_0xe0f1('0x14')],'exten':_0x50836d[_0x51e540][0x0][_0xe0f1('0x8')],'priority':_0x3c76ac[_0xe0f1('0xd')]++,'VoiceExtensionId':_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]});var _0x5334d0=_0x3c76ac[_0xe0f1('0xd')]++;_0x3c76ac[_0xe0f1('0x10')]['push']({'type':_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')],'app':_0xe0f1('0x1b'),'appdata':_0xe0f1('0x1c')+(_0x5334d0+0x2)+_0xe0f1('0x1d')+(_0x5334d0+0x1)+')','context':_0x50836d[_0x51e540][0x0]['context'],'exten':_0x50836d[_0x51e540][0x0]['exten'],'priority':_0x5334d0,'VoiceExtensionId':_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]});if(_0x3c76ac[_0xe0f1('0xe')]){_0x3c76ac['extensions'][_0xe0f1('0x17')]({'type':_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')],'app':_0xe0f1('0x12'),'appdata':_0x3c76ac['extension'][_0xe0f1('0x19')]?_0xe0f1('0x1e')+_0x3c76ac[_0xe0f1('0xe')][_0xe0f1('0x19')]+'}':_0xe0f1('0x1f'),'context':_0x50836d[_0x51e540][0x0][_0xe0f1('0x14')],'exten':_0x50836d[_0x51e540][0x0]['exten'],'priority':_0x3c76ac[_0xe0f1('0xd')]++,'VoiceExtensionId':_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]});}_0x3c76ac[_0xe0f1('0x10')][_0xe0f1('0x17')]({'type':_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')],'app':'Set','appdata':_0xe0f1('0x20')+_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')],'context':_0x50836d[_0x51e540][0x0][_0xe0f1('0x14')],'exten':_0x50836d[_0x51e540][0x0][_0xe0f1('0x8')],'priority':_0x3c76ac[_0xe0f1('0xd')]++,'VoiceExtensionId':_0x50836d[_0x51e540][0x0]['VoiceExtensionId']});if(_0x3c76ac['extension']&&_0x3c76ac[_0xe0f1('0xe')][_0xe0f1('0xc')](_0xe0f1('0x21'))&&_0x3c76ac['extension'][_0xe0f1('0x21')]!=='none'){_0x3c76ac[_0xe0f1('0x10')][_0xe0f1('0x17')]({'type':_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x50836d[_0x51e540][0x0][_0xe0f1('0x14')],'exten':_0x50836d[_0x51e540][0x0][_0xe0f1('0x8')],'priority':_0x3c76ac['priority']++,'VoiceExtensionId':_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]});_0x3c76ac['extensions'][_0xe0f1('0x17')]({'type':_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')],'app':_0xe0f1('0x12'),'appdata':_0xe0f1('0x22')+_0x3c76ac[_0xe0f1('0xe')][_0xe0f1('0x21')]||_0xe0f1('0x23'),'context':_0x50836d[_0x51e540][0x0][_0xe0f1('0x14')],'exten':_0x50836d[_0x51e540][0x0]['exten'],'priority':_0x3c76ac['priority']++,'VoiceExtensionId':_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]});}}_0x3c76ac['extensions'][_0xe0f1('0x17')]({'type':_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')],'app':_0xe0f1('0x12'),'appdata':_0xe0f1('0x24'),'context':_0x50836d[_0x51e540][0x0][_0xe0f1('0x14')],'exten':_0x50836d[_0x51e540][0x0][_0xe0f1('0x8')],'priority':_0x3c76ac[_0xe0f1('0xd')]++,'VoiceExtensionId':_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]});_0x3c76ac['extensions'][_0xe0f1('0x17')]({'type':_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')],'app':_0xe0f1('0x12'),'appdata':_0xe0f1('0x25'),'context':_0x50836d[_0x51e540][0x0][_0xe0f1('0x14')],'exten':_0x50836d[_0x51e540][0x0][_0xe0f1('0x8')],'priority':_0x3c76ac[_0xe0f1('0xd')]++,'VoiceExtensionId':_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]});_0x3c76ac[_0xe0f1('0x10')][_0xe0f1('0x17')]({'type':_0x50836d[_0x51e540][0x0]['type'],'app':_0xe0f1('0x12'),'appdata':_0xe0f1('0x26'),'context':_0x50836d[_0x51e540][0x0][_0xe0f1('0x14')],'exten':_0x50836d[_0x51e540][0x0][_0xe0f1('0x8')],'priority':_0x3c76ac['priority']++,'VoiceExtensionId':_0x50836d[_0x51e540][0x0]['VoiceExtensionId']});for(var _0xf8c7cf=0x0,_0x45702a=0x0;_0xf8c7cf<_0x50836d[_0x51e540][_0xe0f1('0x27')];_0xf8c7cf+=0x1,_0x45702a=0x0){var _0x333194=_0x50836d[_0x51e540][_0xf8c7cf];if(_0x333194[_0xe0f1('0x11')]){_0x333194['type']=_0x333194[_0xe0f1('0x11')]['toLowerCase']();}var _0x4625f7=[];var _0x25a036=[];delete _0x333194['id'];delete _0x333194[_0xe0f1('0x28')];delete _0x333194[_0xe0f1('0x29')];var _0x5500c8=_0x333194['interval']!==_0xe0f1('0x2a')?[_0x333194[_0xe0f1('0x2b')]]:_0x333194[_0xe0f1('0x4')]?_['map'](_[_0xe0f1('0xa')](_0x3c76ac[_0xe0f1('0x3')],{'IntervalId':_0x333194[_0xe0f1('0x4')]}),_0xe0f1('0x2b')):[];if(_0x333194['hasOwnProperty']('tag')){if(_0x333194[_0xe0f1('0x2c')]&&_0x333194['tag']!=='--'){_0x4625f7[_0xe0f1('0x17')]({'type':_0x333194['type'],'app':'Set','appdata':'CDR(tag)='+_0x333194['tag'],'context':_0x333194['context'],'exten':_0x333194['exten'],'priority':_0x5500c8['length']+_0x3c76ac[_0xe0f1('0xd')]+_0x45702a++,'VoiceExtensionId':_0x333194[_0xe0f1('0x15')]});}}if(_0x333194[_0xe0f1('0x11')]===_0xe0f1('0x16')&&_0x333194[_0xe0f1('0xc')](_0xe0f1('0x2d'))){if(_0x333194[_0xe0f1('0x2d')]){_0x4625f7['push']({'type':_0x333194[_0xe0f1('0x11')],'app':_0xe0f1('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x333194[_0xe0f1('0x2d')]+')','context':_0x333194[_0xe0f1('0x14')],'exten':_0x333194[_0xe0f1('0x8')],'priority':_0x5500c8[_0xe0f1('0x27')]+_0x3c76ac[_0xe0f1('0xd')]+_0x45702a++,'VoiceExtensionId':_0x333194[_0xe0f1('0x15')]});}else{_0x4625f7['push']({'type':_0x333194[_0xe0f1('0x11')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x333194['context'],'exten':_0x333194[_0xe0f1('0x8')],'priority':_0x5500c8[_0xe0f1('0x27')]+_0x3c76ac[_0xe0f1('0xd')]+_0x45702a++,'VoiceExtensionId':_0x333194[_0xe0f1('0x15')]});}}if(_0x333194[_0xe0f1('0xc')](_0xe0f1('0x2e'))){if(_0x1ca352['indexOf'](_0x333194['app']['toLowerCase']())>=0x0&&_0x333194[_0xe0f1('0x2f')]!=='custom'){if(_0x333194['answer']){_0x4625f7[_0xe0f1('0x17')]({'type':_0x333194[_0xe0f1('0x11')],'app':_0xe0f1('0x1b'),'appdata':_0xe0f1('0x30'),'context':_0x333194['context'],'exten':_0x333194[_0xe0f1('0x8')],'priority':_0x5500c8[_0xe0f1('0x27')]+_0x3c76ac[_0xe0f1('0xd')]+_0x45702a++,'VoiceExtensionId':_0x333194['VoiceExtensionId']});_0x4625f7[_0xe0f1('0x17')]({'type':_0x333194['type'],'app':_0xe0f1('0x12'),'appdata':_0xe0f1('0x31'),'context':_0x333194['context'],'exten':_0x333194['exten'],'priority':_0x5500c8['length']+_0x3c76ac[_0xe0f1('0xd')]+_0x45702a++,'VoiceExtensionId':_0x333194['VoiceExtensionId']});}else{_0x4625f7['push']({'type':_0x333194[_0xe0f1('0x11')],'app':'ExecIf','appdata':_0xe0f1('0x32'),'context':_0x333194['context'],'exten':_0x333194[_0xe0f1('0x8')],'priority':_0x5500c8[_0xe0f1('0x27')]+_0x3c76ac[_0xe0f1('0xd')]+_0x45702a++,'VoiceExtensionId':_0x333194[_0xe0f1('0x15')]});_0x4625f7[_0xe0f1('0x17')]({'type':_0x333194['type'],'app':'Set','appdata':_0xe0f1('0x33'),'context':_0x333194[_0xe0f1('0x14')],'exten':_0x333194[_0xe0f1('0x8')],'priority':_0x5500c8[_0xe0f1('0x27')]+_0x3c76ac[_0xe0f1('0xd')]+_0x45702a++,'VoiceExtensionId':_0x333194[_0xe0f1('0x15')]});}}}for(var _0x2b02b5=0x0;_0x2b02b5<_0x5500c8['length'];_0x2b02b5+=0x1){var _0x1143c7=_0x3c76ac[_0xe0f1('0xd')]+_0x5500c8[_0xe0f1('0x27')];var _0x4b9536=_0x2b02b5===_0x5500c8[_0xe0f1('0x27')]-0x1?_0x3c76ac[_0xe0f1('0xd')]+_0x4625f7[_0xe0f1('0x27')]+_0x25a036['length']+0x2:_0x3c76ac[_0xe0f1('0xd')]+_0x2b02b5+0x1;_0x4625f7['splice'](_0x2b02b5,0x0,{'type':_0x333194[_0xe0f1('0x11')],'app':_0xe0f1('0x34'),'appdata':_0x5500c8[_0x2b02b5]+'?'+_0x333194[_0xe0f1('0x14')]+',${EXTEN},'+_0x1143c7+':'+_0x333194[_0xe0f1('0x14')]+_0xe0f1('0x35')+_0x4b9536,'exten':_0x333194['exten'],'context':_0x333194[_0xe0f1('0x14')],'priority':_0x3c76ac[_0xe0f1('0xd')]+_0x2b02b5,'VoiceExtensionId':_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]});}_0x333194[_0xe0f1('0xd')]=_0x4625f7[_0xe0f1('0x27')]?_[_0xe0f1('0x36')](_0x4625f7)[_0xe0f1('0xd')]+0x1:_0x3c76ac['priority'];_0x3c76ac[_0xe0f1('0xd')]=(_0x25a036[_0xe0f1('0x27')]?_[_0xe0f1('0x36')](_0x25a036)[_0xe0f1('0xd')]:_0x333194[_0xe0f1('0xd')])+0x1;_0x3c76ac[_0xe0f1('0x10')]=_['concat'](_0x3c76ac[_0xe0f1('0x10')],_0x4625f7,[_0x333194],_0x25a036);}_0x3c76ac['extensions'][_0xe0f1('0x17')]({'type':_0x50836d[_0x51e540][0x0][_0xe0f1('0x11')],'app':_0xe0f1('0x37'),'exten':_0x50836d[_0x51e540][0x0][_0xe0f1('0x8')],'context':_0x50836d[_0x51e540][0x0][_0xe0f1('0x14')],'priority':_0x3c76ac['priority'],'VoiceExtensionId':_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]});_0x2a62d0[_0xe0f1('0x17')](_0x50836d[_0x51e540][0x0][_0xe0f1('0x15')]);_0xf1fe38=_[_0xe0f1('0x38')](_0xf1fe38,_0x3c76ac['extensions']);}}return _0xc073a6[_0xe0f1('0x39')](function(_0x2dc40f){return _0xc073a6[_0xe0f1('0x0')][_0xe0f1('0x3a')][_0xe0f1('0x3b')]({'where':{'VoiceExtensionId':{'$in':_0x2a62d0}},'transaction':_0x2dc40f})[_0xe0f1('0x2')](function(_0x3abfe2){return _0xc073a6['models'][_0xe0f1('0x3a')][_0xe0f1('0x3c')](_[_0xe0f1('0x3d')](_0xf1fe38,'priority'),{'transaction':_0x2dc40f});});});})[_0xe0f1('0x3e')](function(_0x13e903){console[_0xe0f1('0x3f')](_0x13e903);});}exports[_0xe0f1('0x40')]=rewrite; \ No newline at end of file +var _0x336d=['outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','interval','tag','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','catch','error','rewrite','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','cutdigits','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix'];(function(_0x222288,_0x48bb2f){var _0x214ef5=function(_0x362ee6){while(--_0x362ee6){_0x222288['push'](_0x222288['shift']());}};_0x214ef5(++_0x48bb2f);}(_0x336d,0xae));var _0xd336=function(_0x58a5d1,_0x172d51){_0x58a5d1=_0x58a5d1-0x0;var _0x1b8574=_0x336d[_0x58a5d1];return _0x1b8574;};'use strict';var _=require('lodash');var util=require(_0xd336('0x0'));function rewrite(_0x183947,_0x3ab6df){var _0x12100f=this;return _0x183947[_0xd336('0x1')][_0xd336('0x2')][_0xd336('0x3')]({'raw':!![]})[_0xd336('0x4')](function(_0x20e120){_0x12100f[_0xd336('0x5')]=_0x20e120;return _0x183947['models']['VoiceExtension'][_0xd336('0x3')]({'where':{'IntervalId':_0x3ab6df[_0xd336('0x6')]},'raw':!![]});})[_0xd336('0x4')](function(_0x5debef){return _0x183947[_0xd336('0x1')][_0xd336('0x7')][_0xd336('0x3')]({'where':{'exten':{'$in':_[_0xd336('0x8')](_[_0xd336('0x9')](_0x5debef,_0xd336('0xa')))}},'order':[{'raw':_0xd336('0xb')}],'raw':!![]});})[_0xd336('0x4')](function(_0x2a8315){var _0x404030=_['filter'](_0x2a8315,{'priority':'1'});var _0x5c80bd=_[_0xd336('0xc')](_0x2a8315,{'isApp':0x1});var _0x2806ee=_[_0xd336('0xd')](_0x5c80bd,_0xd336('0xa'));var _0x29aa4a=[_0xd336('0xe'),_0xd336('0xf')];var _0x93e2c7=[];var _0x378e04=[];for(var _0x3fd7ea in _0x2806ee){if(_0x2806ee['hasOwnProperty'](_0x3fd7ea)){_0x12100f[_0xd336('0x10')]=0x2;_0x12100f['extensions']=[];_0x12100f[_0xd336('0x11')]=_[_0xd336('0x12')](_0x404030,{'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')]});_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':util[_0xd336('0x17')](_0xd336('0x18'),_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')]),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});if(_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')]===_0xd336('0x1b')){if(_0x12100f[_0xd336('0x11')]){_0x12100f['extensions'][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':'CDR(destination)='+(_0x12100f[_0xd336('0x11')][_0xd336('0x1c')]?'${EXTEN:'+_0x12100f[_0xd336('0x11')][_0xd336('0x1c')]+'}':'${EXTEN}'),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0]['exten'],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});}_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':'CDR(routeid)='+_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')],'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});var _0x2f16dd=_0x12100f['priority']++;_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0]['type'],'app':'ExecIf','appdata':_0xd336('0x1d')+(_0x2f16dd+0x2)+_0xd336('0x1e')+(_0x2f16dd+0x1)+')','context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x2f16dd,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});if(_0x12100f[_0xd336('0x11')]){_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':_0x12100f['extension']['cutdigits']?_0xd336('0x1f')+_0x12100f[_0xd336('0x11')]['cutdigits']+'}':_0xd336('0x20'),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0]['exten'],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});}_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':_0xd336('0x21')+_0x2806ee[_0x3fd7ea][0x0]['VoiceExtensionId'],'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0]['exten'],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});if(_0x12100f[_0xd336('0x11')]&&_0x12100f[_0xd336('0x11')][_0xd336('0x22')](_0xd336('0x23'))&&_0x12100f[_0xd336('0x11')][_0xd336('0x23')]!==_0xd336('0x24')){_0x12100f['extensions'][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':_0xd336('0x25'),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f['priority']++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});_0x12100f[_0xd336('0x13')]['push']({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':'Set','appdata':_0xd336('0x26')+_0x12100f[_0xd336('0x11')][_0xd336('0x23')]||_0xd336('0x27'),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});}}_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});_0x12100f[_0xd336('0x13')]['push']({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x16'),'appdata':_0xd336('0x28'),'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'priority':_0x12100f['priority']++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0]['type'],'app':_0xd336('0x16'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2806ee[_0x3fd7ea][0x0]['context'],'exten':_0x2806ee[_0x3fd7ea][0x0]['exten'],'priority':_0x12100f[_0xd336('0x10')]++,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0]['VoiceExtensionId']});for(var _0x418b28=0x0,_0x3b9ecc=0x0;_0x418b28<_0x2806ee[_0x3fd7ea]['length'];_0x418b28+=0x1,_0x3b9ecc=0x0){var _0x6f1fe1=_0x2806ee[_0x3fd7ea][_0x418b28];if(_0x6f1fe1[_0xd336('0x15')]){_0x6f1fe1[_0xd336('0x15')]=_0x6f1fe1[_0xd336('0x15')][_0xd336('0x29')]();}var _0x4706f7=[];var _0x19e9d4=[];delete _0x6f1fe1['id'];delete _0x6f1fe1[_0xd336('0x2a')];delete _0x6f1fe1[_0xd336('0x2b')];var _0x30e85f=_0x6f1fe1[_0xd336('0x2c')]!=='*,*,*,*'?[_0x6f1fe1['interval']]:_0x6f1fe1[_0xd336('0x6')]?_[_0xd336('0x9')](_[_0xd336('0xc')](_0x12100f['intervals'],{'IntervalId':_0x6f1fe1[_0xd336('0x6')]}),_0xd336('0x2c')):[];if(_0x6f1fe1[_0xd336('0x22')]('tag')){if(_0x6f1fe1[_0xd336('0x2d')]&&_0x6f1fe1[_0xd336('0x2d')]!=='--'){_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1['type'],'app':'Set','appdata':'CDR(tag)='+_0x6f1fe1[_0xd336('0x2d')],'context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1['exten'],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});}}if(_0x6f1fe1['type']==='outbound'&&_0x6f1fe1[_0xd336('0x22')](_0xd336('0x2f'))){if(_0x6f1fe1[_0xd336('0x2f')]){_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1[_0xd336('0x15')],'app':_0xd336('0x30'),'appdata':_0xd336('0x31')+_0x6f1fe1['callerID']+')','context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1[_0xd336('0xa')],'priority':_0x30e85f['length']+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});}else{_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1[_0xd336('0x15')],'app':_0xd336('0x30'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1[_0xd336('0xa')],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f['priority']+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});}}if(_0x6f1fe1[_0xd336('0x22')]('answer')){if(_0x29aa4a[_0xd336('0x32')](_0x6f1fe1[_0xd336('0x33')][_0xd336('0x29')]())>=0x0&&_0x6f1fe1[_0xd336('0x34')]!==_0xd336('0x35')){if(_0x6f1fe1['answer']){_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1[_0xd336('0x15')],'app':'ExecIf','appdata':_0xd336('0x36'),'context':_0x6f1fe1['context'],'exten':_0x6f1fe1['exten'],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1[_0xd336('0x15')],'app':'Set','appdata':_0xd336('0x37'),'context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1[_0xd336('0xa')],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1['VoiceExtensionId']});}else{_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1[_0xd336('0x15')],'app':'ExecIf','appdata':_0xd336('0x38'),'context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1[_0xd336('0xa')],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});_0x4706f7[_0xd336('0x14')]({'type':_0x6f1fe1['type'],'app':_0xd336('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x6f1fe1[_0xd336('0x19')],'exten':_0x6f1fe1['exten'],'priority':_0x30e85f[_0xd336('0x2e')]+_0x12100f[_0xd336('0x10')]+_0x3b9ecc++,'VoiceExtensionId':_0x6f1fe1[_0xd336('0x1a')]});}}}for(var _0x3f52df=0x0;_0x3f52df<_0x30e85f[_0xd336('0x2e')];_0x3f52df+=0x1){var _0x539760=_0x12100f[_0xd336('0x10')]+_0x30e85f['length'];var _0x1fd17e=_0x3f52df===_0x30e85f[_0xd336('0x2e')]-0x1?_0x12100f['priority']+_0x4706f7[_0xd336('0x2e')]+_0x19e9d4[_0xd336('0x2e')]+0x2:_0x12100f[_0xd336('0x10')]+_0x3f52df+0x1;_0x4706f7[_0xd336('0x39')](_0x3f52df,0x0,{'type':_0x6f1fe1['type'],'app':_0xd336('0x3a'),'appdata':_0x30e85f[_0x3f52df]+'?'+_0x6f1fe1[_0xd336('0x19')]+',${EXTEN},'+_0x539760+':'+_0x6f1fe1[_0xd336('0x19')]+_0xd336('0x3b')+_0x1fd17e,'exten':_0x6f1fe1[_0xd336('0xa')],'context':_0x6f1fe1['context'],'priority':_0x12100f[_0xd336('0x10')]+_0x3f52df,'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]});}_0x6f1fe1[_0xd336('0x10')]=_0x4706f7[_0xd336('0x2e')]?_[_0xd336('0x3c')](_0x4706f7)['priority']+0x1:_0x12100f[_0xd336('0x10')];_0x12100f['priority']=(_0x19e9d4[_0xd336('0x2e')]?_['last'](_0x19e9d4)[_0xd336('0x10')]:_0x6f1fe1[_0xd336('0x10')])+0x1;_0x12100f[_0xd336('0x13')]=_['concat'](_0x12100f[_0xd336('0x13')],_0x4706f7,[_0x6f1fe1],_0x19e9d4);}_0x12100f[_0xd336('0x13')][_0xd336('0x14')]({'type':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x15')],'app':_0xd336('0x3d'),'exten':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0xa')],'context':_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x19')],'priority':_0x12100f[_0xd336('0x10')],'VoiceExtensionId':_0x2806ee[_0x3fd7ea][0x0]['VoiceExtensionId']});_0x93e2c7[_0xd336('0x14')](_0x2806ee[_0x3fd7ea][0x0][_0xd336('0x1a')]);_0x378e04=_[_0xd336('0x3e')](_0x378e04,_0x12100f[_0xd336('0x13')]);}}return _0x183947[_0xd336('0x3f')](function(_0x1128d4){return _0x183947[_0xd336('0x1')]['VoiceExtension'][_0xd336('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x93e2c7}},'transaction':_0x1128d4})[_0xd336('0x4')](function(_0x524422){return _0x183947[_0xd336('0x1')][_0xd336('0x7')][_0xd336('0x41')](_['sortBy'](_0x378e04,_0xd336('0x10')),{'transaction':_0x1128d4});});});})[_0xd336('0x42')](function(_0x115d6c){console[_0xd336('0x43')](_0x115d6c);});}exports[_0xd336('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 435c929..b50f05a 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 _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x380a6b,_0x724b52){var _0x1ae7c3=function(_0x27b937){while(--_0x27b937){_0x380a6b['push'](_0x380a6b['shift']());}};_0x1ae7c3(++_0x724b52);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xcb91[_0x26b5ff];return _0x58603e;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file +var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x3893e6,_0xb0912d){var _0x3c9882=function(_0x102358){while(--_0x102358){_0x3893e6['push'](_0x3893e6['shift']());}};_0x3c9882(++_0xb0912d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e8a4010..954dd51 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','phone','fields','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.updatedAt','scheduledat','ListId','createdAt','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','length','all','then','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','dialTimezone','isNil','utcOffset','set','offset','main','stringify','start','binding','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','DROP\x20TABLE\x20','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','defaults'];(function(_0x2289eb,_0x4f1848){var _0x4e3998=function(_0x519651){while(--_0x519651){_0x2289eb['push'](_0x2289eb['shift']());}};_0x4e3998(++_0x4f1848);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var fs=require('fs');var path=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var Papa=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var BPromise=require('bluebird');var moment=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var Redis=require(_0x7995('0x6'));var db=require(_0x7995('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x7995('0x8'));var logger=require(_0x7995('0x9'))(_0x7995('0xa'));config[_0x7995('0xb')]=_[_0x7995('0xc')](config[_0x7995('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7995('0xd'))(new Redis(config[_0x7995('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x7995('0xe'));function isEmail(_0x3116fb){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7995('0xf')](_0x3116fb);}function selectNotIn(_0x35b5fe,_0x3c1d19,_0x1e400a,_0x341672,_0x524f7b){return squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')[_0x7995('0x12')](_0x341672)[_0x7995('0x13')](_0x3c1d19,null,_0x3c1d19+_0x7995('0x14')+_0x341672+'.'+_0x1e400a)[_0x7995('0x15')](_0x341672+'.'+_0x1e400a+_0x7995('0x16')+_0x35b5fe+'.'+_0x1e400a)[_0x7995('0x15')](_0x3c1d19+_0x7995('0x17')+_0x524f7b['join']()+')');}function insertCmHopper(_0x58f5ad,_0x2b4e94,_0x2233dd,_0x24b5bb,_0x321ae8){var _0x3f1d3e=[_0x7995('0x18'),_0x7995('0x19'),_0x7995('0x1a'),'cm_contacts.ListId',_0x2b4e94+'.'+_0x24b5bb,_0x7995('0x1b'),'cm_contacts.updatedAt',_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x321ae8+'\x22'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone','scheduledat',_0x7995('0x22'),'ListId',_0x24b5bb,'createdAt',_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel['select']()['fields'](_0x3f1d3e)[_0x7995('0x12')](_0x2b4e94)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x2b4e94+_0x7995('0x28'))[_0x7995('0x13')](_0x2233dd,null,_0x2233dd+'.id\x20=\x20'+_0x2b4e94+'.'+_0x24b5bb)[_0x7995('0x15')](_0x2b4e94+_0x7995('0x29'),_0x58f5ad)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))[_0x7995('0x15')](_0x7995('0x2b'),selectNotIn(_0x2b4e94,_0x2233dd,_0x24b5bb,_0x7995('0x20'),[_0x7995('0x2c')])))[_0x7995('0x2d')]();}function insertCmHopperBlack(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3){var _0x229742=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x56691a+'.'+_0x5911c3,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()['into'](_0x7995('0x2f'))[_0x7995('0x21')]([_0x7995('0x30'),'ContactId','ListId',_0x5911c3,'createdAt',_0x7995('0x23')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x229742)[_0x7995('0x12')](_0x56691a)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x56691a+'.CmListId')[_0x7995('0x13')](_0x47625f,null,_0x47625f+'.id\x20=\x20'+_0x56691a+'.'+_0x5911c3)[_0x7995('0x15')](_0x56691a+_0x7995('0x29'),_0x2a307e)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')]('phone')['from']('cm_hopper_black')[_0x7995('0x15')](_0x7995('0x32'),_0x2a307e)['where'](_0x5911c3+_0x7995('0x33'),_0x56691a+'.'+_0x5911c3)))['toString']();}function insertTzCmHopper(_0x37917b,_0x1cb058,_0x177cb4,_0x5014d2,_0x52d76d,_0x36d057){var _0x5e67fe=['cm_contacts.phone',_0x7995('0x34')+_0x36d057+_0x7995('0x35'),'cm_contacts.id',_0x7995('0x2e'),_0x1cb058+'.'+_0x5014d2,_0x7995('0x1b'),_0x7995('0x36'),_0x7995('0x1c'),_0x7995('0x1d'),'\x22'+_0x52d76d+'\x22'];var _0x53002a=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x20'))[_0x7995('0x21')](['phone',_0x7995('0x37'),_0x7995('0x22'),_0x7995('0x38'),_0x5014d2,_0x7995('0x39'),_0x7995('0x23'),_0x7995('0x24'),'UserId',_0x7995('0x25')],squel[_0x7995('0x10')]()[_0x7995('0x31')](_0x5e67fe)[_0x7995('0x12')](_0x1cb058)[_0x7995('0x13')](_0x7995('0x26'),null,_0x7995('0x27')+_0x1cb058+_0x7995('0x28'))[_0x7995('0x13')](_0x177cb4,null,_0x177cb4+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x13')](_0x36d057,null,_0x36d057+_0x7995('0x14')+_0x1cb058+'.'+_0x5014d2)[_0x7995('0x15')](_0x1cb058+'.CmListId\x20=\x20?',_0x37917b)['where'](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,'cm_hopper',[_0x7995('0x2c'),'\x22onlyIfOpen\x22']))['where'](_0x7995('0x2b'),selectNotIn(_0x1cb058,_0x177cb4,_0x5014d2,_0x7995('0x20'),[_0x7995('0x2c')])))['toString']();return _0x53002a;}function insertTzCmHopperBlack(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881){var _0x493066=[_0x7995('0x18'),_0x7995('0x1a'),_0x7995('0x2e'),_0x5e85b9+'.'+_0x5a8881,_0x7995('0x1b'),'cm_contacts.updatedAt'];return squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x7995('0x2f'))[_0x7995('0x21')](['phone','ContactId',_0x7995('0x38'),_0x5a8881,'createdAt',_0x7995('0x23')],squel['select']()[_0x7995('0x31')](_0x493066)['from'](_0x5e85b9)[_0x7995('0x13')](_0x7995('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x5e85b9+_0x7995('0x28'))[_0x7995('0x13')](_0x3993b5,null,_0x3993b5+_0x7995('0x14')+_0x5e85b9+'.'+_0x5a8881)[_0x7995('0x15')](_0x5e85b9+'.CmListId\x20=\x20?',_0x46ac4f)[_0x7995('0x15')](_0x7995('0x2a'),NOW)[_0x7995('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7995('0x10')]()[_0x7995('0x11')](_0x7995('0x30'))[_0x7995('0x12')](_0x7995('0x2f'))['where'](_0x7995('0x32'),_0x46ac4f)[_0x7995('0x15')](_0x5a8881+'\x20=\x20?',_0x5e85b9+'.'+_0x5a8881)))[_0x7995('0x2d')]();}function insertCmContact(_0x5843ba,_0x1d87f9,_0x187735,_0x1afab4){var _0x30e220=_[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x1afab4),[_0x7995('0x38'),'CompanyId',_0x7995('0x39'),_0x7995('0x23')]);return squel[_0x7995('0x1e')]()['into'](_0x7995('0x26'))[_0x7995('0x21')](_0x30e220,squel[_0x7995('0x10')]()['fields'](_0x30e220)['from'](_0x1d87f9)['where']('('+_0x187735[_0x7995('0x13')](',')+_0x7995('0x3c'),squel['select']()[_0x7995('0x31')](_0x187735)[_0x7995('0x12')](_0x7995('0x26'))[_0x7995('0x15')](_0x7995('0x32'),_0x5843ba)['where'](_0x7995('0x3d')))['where'](_0x7995('0x3e'),squel[_0x7995('0x10')]()[_0x7995('0x11')]('MIN(id)','min_id')['from'](_0x1d87f9)['group'](_0x187735[_0x7995('0x13')](','))))[_0x7995('0x2d')]();}function handleStop(){logger[_0x7995('0x3f')](_0x7995('0x40'));stopped=!![];}function handleUncaughtException(_0x1d957e){logger[_0x7995('0x41')](_0x1d957e[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}function handleError(_0x328671,_0x17ecd3){stats[_0x7995('0x44')][_0x7995('0x45')]({'name':_0x17ecd3[_0x7995('0x46')],'message':_0x17ecd3[_0x7995('0x42')],'row':_0x328671});}function handleQuery(_0x1ea1dc){logger[_0x7995('0x3f')](_0x1ea1dc);return db[_0x7995('0x47')][_0x7995('0x48')](_0x1ea1dc)[_0x7995('0x49')](function(_0x50b7c2){results[_0x7995('0x45')](_0x50b7c2);})[_0x7995('0x4a')](function(_0x3b8a54){logger[_0x7995('0x41')](_0x3b8a54['message']);});}function updateTzCampaigns(_0x53125a){return new Promise(function(_0x402fa0,_0x197b52){var _0x5b9467=squel[_0x7995('0x10')]()['fields']([_0x7995('0x4b'),_0x7995('0x4c')])[_0x7995('0x12')](_0x7995('0x4d'))['join']('campaigns_has_cm_lists',null,_0x7995('0x4e'))[_0x7995('0x15')](_0x7995('0x4f')+_0x53125a);db[_0x7995('0x47')][_0x7995('0x48')](_0x5b9467[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x1e2206){var _0x984c23=[];for(var _0x50caf5=0x0;_0x50caf5<_0x1e2206[_0x7995('0x50')];_0x50caf5++){_0x984c23[_0x7995('0x45')](getTimezoneData(_0x1e2206[_0x50caf5],tmp_campaigns));}BPromise[_0x7995('0x51')](_0x984c23)[_0x7995('0x52')](function(){_0x402fa0({'val':0x1});});})['catch'](function(_0x51bf6a){logger[_0x7995('0x41')](_0x51bf6a[_0x7995('0x42')]);_0x402fa0({'val':0x0});});});}function updateTzVoiceQueues(_0x47d5d7){return new Promise(function(_0x971a23,_0x375fc9){var _0x2e3421=squel[_0x7995('0x10')]()[_0x7995('0x31')](['voice_queues.id',_0x7995('0x53')])['from'](_0x7995('0x54'))[_0x7995('0x13')](_0x7995('0x55'),null,_0x7995('0x56'))[_0x7995('0x15')](_0x7995('0x57')+_0x47d5d7);db[_0x7995('0x47')][_0x7995('0x48')](_0x2e3421[_0x7995('0x2d')]())[_0x7995('0x49')](function(_0x2618c4){var _0x234d8d=[];for(var _0x56eb85=0x0;_0x56eb85<_0x2618c4[_0x7995('0x50')];_0x56eb85++){_0x234d8d[_0x7995('0x45')](getTimezoneData(_0x2618c4[_0x56eb85],tmp_voice_queues));}BPromise[_0x7995('0x51')](_0x234d8d)[_0x7995('0x52')](function(){_0x971a23({'val':0x1});});})[_0x7995('0x4a')](function(_0x54a2e0){logger['error'](_0x54a2e0[_0x7995('0x42')]);_0x971a23({'val':0x0});});});}function getTimezoneData(_0x87e38d,_0x221542){return new Promise(function(_0xae6166,_0x5aa2ec){var _0x22d317=shared['timezones'];var _0x5df621=_0x22d317[_0x87e38d[_0x7995('0x58')]];if(_[_0x7995('0x59')](_0x5df621)){_0xae6166({'ret':0x1});}else{var _0x3f0a71=_0x5df621[_0x7995('0x5a')];var _0x290eae=squel[_0x7995('0x1e')]()[_0x7995('0x1f')](_0x221542)[_0x7995('0x5b')]('id',_0x87e38d['id'])[_0x7995('0x5b')](_0x7995('0x5c'),_0x3f0a71)['set'](_0x7995('0x58'),_0x87e38d[_0x7995('0x58')])[_0x7995('0x2d')]();return db['sequelize'][_0x7995('0x48')](_0x290eae)[_0x7995('0x49')](function(_0x705f0){_0xae6166({'ret':0x1});})[_0x7995('0x4a')](function(_0x3b0d30){logger[_0x7995('0x41')](_0x3b0d30[_0x7995('0x42')]);_0x5aa2ec({'ret':0x1});});}});}function handleTZQuery(_0x3adfd2){logger[_0x7995('0x3f')](_0x3adfd2);return db[_0x7995('0x47')][_0x7995('0x48')](_0x3adfd2)['spread'](function(_0x5e8b4c){})[_0x7995('0x4a')](function(_0xfe1105){logger[_0x7995('0x41')](_0xfe1105[_0x7995('0x42')]);});}function main(_0x4dbab8,_0x3b45e8,_0x2c9eb6,_0x54b955){logger['info'](_0x7995('0x5d'),_0x4dbab8,JSON[_0x7995('0x5e')](_0x3b45e8));process['send'](_0x7995('0x5f'));var _0x5b1cba=_0x3b45e8[_0x7995('0x60')];var _0xea9aba=_0x3b45e8['socket_timestamp'];var _0x5d9d33=path[_0x7995('0x13')](config['root'],_0x7995('0x61'),_0xea9aba+_0x7995('0x62'));hasTZ=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x63')](_0x7995('0x58'));var _0x18cff7=_[_0x7995('0x3b')](_0x5b1cba)[_0x7995('0x13')]();logger[_0x7995('0x3f')](_0x7995('0x64'),_0x18cff7);if(hasTZ)_0x18cff7+=_0x7995('0x65');fs[_0x7995('0x66')](_0x5d9d33,_0x18cff7+'\x0a');Papa[_0x7995('0x67')](fs[_0x7995('0x68')](_0x4dbab8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e3a7,_0x3773de){try{for(var _0x6ad274=0x0,_0x251490=[];_0x6ad274<_0x36e3a7[_0x7995('0x69')][_0x7995('0x50')];_0x6ad274++){stats[_0x7995('0x6a')]+=0x1;if(_0x36e3a7[_0x7995('0x44')][_0x6ad274]){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],_0x36e3a7[_0x7995('0x44')][_0x6ad274]);}else{var _0x260ef1=[];for(var _0x33479a in _0x5b1cba){if(_0x5b1cba[_0x7995('0x6b')](_0x33479a)){if(_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]){var _0x59efff=_[_0x7995('0x6c')](_0x36e3a7[_0x7995('0x69')][_0x6ad274][_0x5b1cba[_0x33479a]]['replace'](/"/g,'\x27'));switch(_0x33479a){case'scheduledat':var _0x15e8d1=moment(_0x59efff,_0x7995('0xe'),!![]);if(_0x15e8d1[_0x7995('0x6d')]()){_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x6e'));}break;case'priority':var _0x2f8a2d=parseInt(_0x59efff);_0x59efff=_[_0x7995('0x6f')](_0x2f8a2d)||_0x2f8a2d<0x0||_0x2f8a2d>0x4?_0x54b955?0x3:0x2:_0x2f8a2d;_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');break;case _0x7995('0x70'):var _0x7d9c6e=parseInt(_0x59efff);if(_[_0x7995('0x71')](_0x7d9c6e)&&_[_0x7995('0x63')](_0x2c9eb6,_0x7d9c6e)){_0x251490[_0x7995('0x45')]('\x22'+_0x7d9c6e+'\x22');}else{_0x260ef1['push'](_0x7995('0x72'));}break;case _0x7995('0x73'):if(isEmail(_0x59efff)){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1['push'](_0x7995('0x74'));}break;case _0x7995('0x75'):var _0x18e1a2=moment(_0x59efff,_0x7995('0x76'),!![]);if(_0x18e1a2[_0x7995('0x6d')]()){_0x251490['push']('\x22'+_0x59efff+'\x22');}else{_0x260ef1[_0x7995('0x45')](_0x7995('0x77'));}break;case'dialTimezone':var _0x209977=shared[_0x7995('0x78')];var _0x489bac=_0x209977[_0x59efff];if(!_[_0x7995('0x59')](_0x489bac)){var _0x4a5bc5=_0x489bac[_0x7995('0x5a')];_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');_0x251490[_0x7995('0x45')]('\x22'+_0x4a5bc5+'\x22');}break;default:_0x251490[_0x7995('0x45')]('\x22'+_0x59efff+'\x22');}}else{switch(_0x33479a){case _0x7995('0x79'):case'phone':_0x260ef1[_0x7995('0x45')](_0x33479a+_0x7995('0x7a'));break;default:_0x251490[_0x7995('0x45')]('\x22\x22');}}}}if(_0x260ef1['length']){handleError(_0x36e3a7[_0x7995('0x69')][_0x6ad274],{'code':_0x7995('0x7b'),'message':_0x260ef1[_0x7995('0x13')]()});}else{fs[_0x7995('0x7c')](_0x5d9d33,_0x251490['join']()+'\x0a');}_0x251490=[];}if(!(stats[_0x7995('0x6a')]%0xc8)){socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x7995('0x7f'));_0x3773de[_0x7995('0x80')]();}}catch(_0x4800a8){handleError(_0x36e3a7['data'][_0x6ad274],{'code':_0x7995('0x81'),'message':_0x4800a8[_0x7995('0x42')]});logger[_0x7995('0x41')](_0x7995('0x82'),_0x4800a8[_0x7995('0x42')]);}},'complete':function(){try{var _0x551b5e=[];var _0x56003d=[];var _0x393cb7='cm_contacts';if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x393cb7=_0x7995('0x84')+_0xea9aba;_0x551b5e['push'](_0x7995('0x85')+_0x393cb7+_0x7995('0x86'));}tmp_campaigns=_0x7995('0x87')+_0xea9aba;tmp_voice_queues=_0x7995('0x88')+_0xea9aba;_0x56003d[_0x7995('0x45')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x7995('0x89'));_0x56003d[_0x7995('0x45')](_0x7995('0x85')+tmp_voice_queues+_0x7995('0x89'));BPromise['each'](_0x56003d,handleTZQuery)[_0x7995('0x52')](function(_0x38064a){updateTzCampaigns(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x20683e){updateTzVoiceQueues(_0x3b45e8['ListId'])[_0x7995('0x52')](function(_0x50efab){var _0x1b4b34=util['format'](_0x7995('0x8a'),_0x5d9d33,_0x393cb7,_0x18cff7,_0x3b45e8['ListId'],_0x3b45e8[_0x7995('0x8b')]||null,NOW,NOW);if(_[_0x7995('0x59')](_0x5b1cba['scheduledat'])){_0x1b4b34+=_0x7995('0x8c');}_0x551b5e['push'](_0x1b4b34);if(_0x3b45e8['duplicates']&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]){_0x551b5e[_0x7995('0x45')](insertCmContact(_0x3b45e8[_0x7995('0x38')],_0x393cb7,_0x3b45e8['duplicates'],_0x5b1cba));}if(hasTZ){_0x551b5e[_0x7995('0x45')](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'voice_queues_has_cm_lists','voice_queues',_0x7995('0x8d'),_0x54b955,tmp_voice_queues));_0x551b5e['push'](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],_0x7995('0x8e'),_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertTzCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists',_0x7995('0x4d'),_0x7995('0x8f'),_0x54b955,tmp_campaigns));_0x551b5e[_0x7995('0x45')](insertTzCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists','campaigns','CampaignId'));}else{_0x551b5e[_0x7995('0x45')](insertCmHopper(_0x3b45e8[_0x7995('0x38')],_0x7995('0x55'),_0x7995('0x54'),_0x7995('0x8d'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8['ListId'],'voice_queues_has_cm_blacklists',_0x7995('0x54'),'VoiceQueueId'));_0x551b5e['push'](insertCmHopper(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_lists','campaigns',_0x7995('0x8f'),_0x54b955));_0x551b5e[_0x7995('0x45')](insertCmHopperBlack(_0x3b45e8[_0x7995('0x38')],'campaigns_has_cm_blacklists',_0x7995('0x4d'),_0x7995('0x8f')));}_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_campaigns+';');_0x551b5e[_0x7995('0x45')](_0x7995('0x90')+tmp_voice_queues+';');BPromise[_0x7995('0x91')](_0x551b5e,handleQuery)[_0x7995('0x52')](function(_0x19d746){stats['finish']=!![];stats[_0x7995('0x92')]=_0x3b45e8[_0x7995('0x83')]&&_0x3b45e8[_0x7995('0x83')][_0x7995('0x50')]?results[0x2][_0x7995('0x92')]:results[0x0]['affectedRows'];socket[_0x7995('0x7d')](_0x7995('0x7e')+_0xea9aba,stats);fs[_0x7995('0x93')](_0x4dbab8);fs['unlink'](_0x5d9d33);process['exit'](0x0);})['catch'](function(_0xb28dea){logger[_0x7995('0x41')](_0xb28dea[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);});})[_0x7995('0x4a')](function(_0x3ad47c){logger['error'](_0x3ad47c[_0x7995('0x42')]);process['exit'](0x1);});});});}catch(_0x40a151){logger[_0x7995('0x41')](_0x7995('0x94'),_0x40a151[_0x7995('0x42')]);process[_0x7995('0x43')](0x1);}},'error':function(_0x24ac44,_0x4f929b,_0x24a0e6,_0x245821){throw new Error(_0x245821);}});}function validate(){if(process[_0x7995('0x95')]&&process[_0x7995('0x95')]['length']<0x4){throw new Error(_0x7995('0x96'));}var _0x57f875=path[_0x7995('0x13')](config[_0x7995('0x97')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x7995('0x98')](_0x57f875)){throw new Error(_0x7995('0x99'));}var _0x41e200={};try{_0x41e200=JSON[_0x7995('0x67')](process[_0x7995('0x95')][0x3]);if(!_0x41e200[_0x7995('0x60')]){throw new Error(_0x7995('0x9a'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x30')]){throw new Error(_0x7995('0x9b'));}if(!_0x41e200[_0x7995('0x60')][_0x7995('0x79')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5380e6=0x0;if(_0x41e200[_0x7995('0x60')][_0x7995('0x70')]){_0x5380e6=0x1;}if(!_0x41e200[_0x7995('0x38')]){throw new Error(_0x7995('0x9c'));}}catch(_0x100bde){throw new Error('body\x20id\x20mandatory');}var _0xe8c08e=[];try{_0xe8c08e=_[_0x7995('0x9d')](JSON['parse'](process[_0x7995('0x95')][0x4]),'id');}catch(_0x53d693){logger[_0x7995('0x3f')](_0x7995('0x9e'));}main(_0x57f875,_0x41e200,_0xe8c08e,_0x5380e6);}validate();process['on'](_0x7995('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x7a54,0x106));var _0x47a5=function(_0x51b2bd,_0x32581c){_0x51b2bd=_0x51b2bd-0x0;var _0x4c230c=_0x7a54[_0x51b2bd];return _0x4c230c;};'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 91a1cce..52a44ca 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 _0x96ff=['ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','push','all','then','catch','message','AdditionalPhones','split','length','filter','CmContactHasItem','update','PHONE','CmContact','CmHopper','cm_contacts.phone','cm_contacts.ListId','insert','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.updatedAt','into','cm_hopper_black','field','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','errors','error','main','stringify','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','emit','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists'];(function(_0x4adf2d,_0x371ea9){var _0x1e3260=function(_0x187ff2){while(--_0x187ff2){_0x4adf2d['push'](_0x4adf2d['shift']());}};_0x1e3260(++_0x371ea9);}(_0x96ff,0x1d2));var _0xf96f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x96ff[_0x40a045];return _0x1a687c;};'use strict';var fs=require('fs');var path=require(_0xf96f('0x0'));var _=require('lodash');var Papa=require(_0xf96f('0x1'));var util=require(_0xf96f('0x2'));var BPromise=require(_0xf96f('0x3'));var moment=require(_0xf96f('0x4'));var squel=require(_0xf96f('0x5'));var Redis=require(_0xf96f('0x6'));var db=require(_0xf96f('0x7'))['db'];var config=require(_0xf96f('0x8'));var logger=require(_0xf96f('0x9'))('import');config[_0xf96f('0xa')]=_['defaults'](config[_0xf96f('0xa')],{'host':_0xf96f('0xb'),'port':0x18eb});var socket=require(_0xf96f('0xc'))(new Redis(config[_0xf96f('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xf96f('0xd'));var tempTableName=_0xf96f('0xe')+moment()[_0xf96f('0xf')](_0xf96f('0x10'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x3d2036){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))*$/[_0xf96f('0x11')](_0x3d2036);}function selectNotIn(_0x4f7348,_0x5788f8,_0x482650,_0x269a49,_0x557f7b){return squel[_0xf96f('0x12')]()['field'](_0xf96f('0x13'))[_0xf96f('0x14')](_0x269a49)[_0xf96f('0x15')](_0x5788f8,null,_0x5788f8+_0xf96f('0x16')+_0x269a49+'.'+_0x482650)[_0xf96f('0x17')](_0x269a49+'.'+_0x482650+_0xf96f('0x18')+_0x4f7348+'.'+_0x482650)['where'](_0x5788f8+_0xf96f('0x19')+_0x557f7b[_0xf96f('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5ec5a8,_0xaa7b6c){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf96f('0x1a')][_0xf96f('0x1b')](_0xf96f('0x1c')+tempTableName)[_0xf96f('0x1d')](function(_0x5a09da){if(_0x5a09da!==null){var _0x499704=[];for(var _0x31dd82=0x0;_0x31dd82<_0x5a09da['length'];_0x31dd82++){var _0x18749b=_0x5a09da[_0x31dd82];if(!_[_0xf96f('0x1e')](_0x18749b[_0xf96f('0x13')])){if(!_[_0xf96f('0x1e')](_0x18749b['AdditionalPhones']))_0x499704[_0xf96f('0x1f')](insertAdditionalPhones(_0x18749b));promisesContact[_0xf96f('0x1f')]({'contact':_0x18749b});}}}Promise[_0xf96f('0x20')](_0x499704)[_0xf96f('0x21')](function(){_0x5ec5a8({'val':0x1});});})[_0xf96f('0x22')](function(_0x1e30ce){logger['error'](_0x1e30ce[_0xf96f('0x23')]);});});}function insertAdditionalPhones(_0x8a8942){return new Promise(function(_0x21f69,_0x822682){var _0x37b47a=_0x8a8942[_0xf96f('0x24')];if(_[_0xf96f('0x1e')](_0x37b47a))_0x822682({'val':0x0});else{var _0x406b42=_0x37b47a[_0xf96f('0x25')](';');var _0x3bb4f6=[];orderBy=0x0;for(var _0x4f1f7b=0x0;_0x4f1f7b<_0x406b42[_0xf96f('0x26')];_0x4f1f7b++){_0x3bb4f6['push'](splitAdditionalPhone(_0x8a8942['id'],_0x406b42[_0x4f1f7b]));}Promise[_0xf96f('0x20')](_0x3bb4f6)['then'](function(){_0x21f69({'val':_0x406b42[_0xf96f('0x26')]});});}});}function splitAdditionalPhone(_0x36b5bd,_0x287454){return new Promise(function(_0x31fcd4,_0x218091){var _0x1f6604=_0x287454['split'](':');var _0x5a1f3=_0x1f6604[0x0];var _0x20e072=_0x1f6604[0x1];if(_0x20e072!==''){var _0x4a35f5=_0x20e072[_0xf96f('0x25')]('|');var _0x2a73bf=[];for(var _0x5f3fad=0x0;_0x5f3fad<_0x4a35f5[_0xf96f('0x26')];_0x5f3fad++){if(_0x4a35f5[_0x5f3fad]!==''){var _0x3aa21e=_[_0xf96f('0x27')](promisesAdditionalPhones,{'contactId':_0x36b5bd,'phone':_0x4a35f5[_0x5f3fad]});if(_0x3aa21e[_0xf96f('0x26')]==0x0){orderBy++;promisesAdditionalPhones[_0xf96f('0x1f')]({'contactId':_0x36b5bd,'contactTypeId':_0x5a1f3,'phone':_0x4a35f5[_0x5f3fad],'orderBy':orderBy});}}}_0x31fcd4({'ok':0x1});}else _0x31fcd4({'res':0x0});});}function createAdditionalPhone(_0x4524e7,_0x59e40f,_0x35e103,_0x4ba0dd){return new Promise(function(_0x296919,_0x2f18e9){return db[_0xf96f('0x28')]['findOne']({'where':{'CmContactId':_0x4524e7,'item':_0x35e103}})[_0xf96f('0x21')](function(_0x33e727){if(_0x33e727){return db[_0xf96f('0x28')][_0xf96f('0x29')]({'ItemTypeId':_0x59e40f,'OrderBy':_0x4ba0dd},{'where':{'CmContactId':_0x4524e7,'item':_0x35e103}})['then'](function(_0x334e35){_0x296919({'res':'updated'});});}else{return db[_0xf96f('0x28')]['create']({'CmContactId':_0x4524e7,'item':_0x35e103,'ItemTypeId':_0x59e40f,'OrderBy':_0x4ba0dd,'ItemClass':_0xf96f('0x2a')})[_0xf96f('0x21')](function(_0x4c9c3b){_0x296919({'res':'inserted'});});}});});}function updateContact(_0x406b7f){return new Promise(function(_0x204986,_0x29396b){var _0x11a705=_0x406b7f['id'];delete _0x406b7f['id'];return db[_0xf96f('0x2b')][_0xf96f('0x29')](_0x406b7f,{'where':{'id':_0x11a705}})[_0xf96f('0x21')](function(_0x8957af){updatedRows+=0x1;return db[_0xf96f('0x2c')][_0xf96f('0x29')]({'phone':_0x406b7f[_0xf96f('0x13')]},{'where':{'ContactId':_0x11a705}})['then'](function(_0x2412b4){_0x204986({'ret':'OK'});});});});}function insertCmHopper(_0x543a01,_0x214566,_0x1e8029,_0x2bbded,_0x369cd0){var _0x5b5662=[_0xf96f('0x2d'),'cm_contacts.scheduledat','cm_contacts.id',_0xf96f('0x2e'),_0x214566+'.'+_0x2bbded,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x369cd0+'\x22'];return squel[_0xf96f('0x2f')]()['into']('cm_hopper')[_0xf96f('0x30')]([_0xf96f('0x13'),_0xf96f('0x31'),_0xf96f('0x32'),_0xf96f('0x33'),_0x2bbded,_0xf96f('0x34'),_0xf96f('0x35'),'priority',_0xf96f('0x36'),_0xf96f('0x37')],squel[_0xf96f('0x12')]()[_0xf96f('0x38')](_0x5b5662)['from'](_0x214566)[_0xf96f('0x15')](_0xf96f('0x39'),null,_0xf96f('0x3a')+_0x214566+_0xf96f('0x3b'))['join'](_0x1e8029,null,_0x1e8029+_0xf96f('0x16')+_0x214566+'.'+_0x2bbded)[_0xf96f('0x17')](_0x214566+_0xf96f('0x3c'),_0x543a01)[_0xf96f('0x17')](_0xf96f('0x3d'),NOW)[_0xf96f('0x17')](_0xf96f('0x3e'),selectNotIn(_0x214566,_0x1e8029,_0x2bbded,_0xf96f('0x3f'),[_0xf96f('0x40'),_0xf96f('0x41')]))[_0xf96f('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x214566,_0x1e8029,_0x2bbded,_0xf96f('0x3f'),[_0xf96f('0x40')])))[_0xf96f('0x42')]();}function insertCmHopperBlack(_0x3dc793,_0x22fd03,_0x3e8b15,_0x17b1b8){var _0x4bbae4=[_0xf96f('0x2d'),_0xf96f('0x43'),_0xf96f('0x2e'),_0x22fd03+'.'+_0x17b1b8,'cm_contacts.createdAt',_0xf96f('0x44')];return squel[_0xf96f('0x2f')]()[_0xf96f('0x45')](_0xf96f('0x46'))['fromQuery'](['phone',_0xf96f('0x32'),'ListId',_0x17b1b8,_0xf96f('0x34'),_0xf96f('0x35')],squel['select']()[_0xf96f('0x38')](_0x4bbae4)[_0xf96f('0x14')](_0x22fd03)[_0xf96f('0x15')](_0xf96f('0x39'),null,_0xf96f('0x3a')+_0x22fd03+'.CmListId')[_0xf96f('0x15')](_0x3e8b15,null,_0x3e8b15+_0xf96f('0x16')+_0x22fd03+'.'+_0x17b1b8)[_0xf96f('0x17')](_0x22fd03+_0xf96f('0x3c'),_0x3dc793)[_0xf96f('0x17')](_0xf96f('0x3d'),NOW)[_0xf96f('0x17')](_0xf96f('0x3e'),squel[_0xf96f('0x12')]()[_0xf96f('0x47')]('phone')[_0xf96f('0x14')](_0xf96f('0x46'))['where'](_0xf96f('0x48'),_0x3dc793)['where'](_0x17b1b8+_0xf96f('0x49'),_0x22fd03+'.'+_0x17b1b8)))['toString']();}function insertCmHopperAdditionalPhones(_0x2c6301){var _0x494afc=[_0xf96f('0x4a'),'cm_contact_has_items.item',_0xf96f('0x4b'),_0xf96f('0x4c'),_0xf96f('0x4d')];return squel[_0xf96f('0x2f')]()[_0xf96f('0x45')](_0xf96f('0x4e'))['fromQuery']([_0xf96f('0x4f'),_0xf96f('0x13'),_0xf96f('0x50'),_0xf96f('0x34'),_0xf96f('0x35')],squel[_0xf96f('0x12')]()[_0xf96f('0x38')](_0x494afc)[_0xf96f('0x14')](_0xf96f('0x3f'))[_0xf96f('0x15')](_0xf96f('0x39'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xf96f('0x15')](_0xf96f('0x51'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xf96f('0x17')](_0xf96f('0x52'),_0x2c6301)[_0xf96f('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xf96f('0x42')]();}function insertCmContact(_0x2c80d7,_0x2e35ad,_0x18d0fd,_0x46149a){var _0x1a73a1=_['concat'](_[_0xf96f('0x53')](_0x46149a),['ListId',_0xf96f('0x54'),_0xf96f('0x34'),_0xf96f('0x35')]);return squel[_0xf96f('0x2f')]()[_0xf96f('0x45')]('cm_contacts')[_0xf96f('0x30')](_0x1a73a1,squel[_0xf96f('0x12')]()[_0xf96f('0x38')](_0x1a73a1)['from'](_0x2e35ad)['where']('('+_0x18d0fd[_0xf96f('0x15')](',')+_0xf96f('0x55'),squel[_0xf96f('0x12')]()[_0xf96f('0x38')](_0x18d0fd)[_0xf96f('0x14')](_0xf96f('0x39'))[_0xf96f('0x17')](_0xf96f('0x48'),_0x2c80d7))['where']('id\x20IN\x20?',squel[_0xf96f('0x12')]()[_0xf96f('0x47')](_0xf96f('0x56'),_0xf96f('0x57'))[_0xf96f('0x14')](_0x2e35ad)[_0xf96f('0x58')](_0x18d0fd[_0xf96f('0x15')](','))))['toString']();}function handleStop(){logger[_0xf96f('0x59')](_0xf96f('0x5a'));stopped=!![];}function handleUncaughtException(_0x59152f){logger['error'](_0x59152f['message']);process['exit'](0x1);}function handleError(_0x4465d4,_0x4080d7){stats[_0xf96f('0x5b')][_0xf96f('0x1f')]({'name':_0x4080d7['code'],'message':_0x4080d7[_0xf96f('0x23')],'row':_0x4465d4});}function handleQuery(_0x39afcf){logger[_0xf96f('0x59')](_0x39afcf);return db['sequelize']['query'](_0x39afcf)[_0xf96f('0x1d')](function(_0x360c62){results['push'](_0x360c62);})[_0xf96f('0x22')](function(_0x57caf6){logger[_0xf96f('0x5c')](_0x57caf6[_0xf96f('0x23')]);});}function main(_0x5932fa,_0x46e8d0,_0x1face3,_0x33059d){logger[_0xf96f('0x59')](_0xf96f('0x5d'),_0x5932fa,JSON[_0xf96f('0x5e')](_0x46e8d0));process['send'](_0xf96f('0x5f'));var _0xb3d53a=_0x46e8d0[_0xf96f('0x60')];var _0x21557d=_[_0xf96f('0x61')](_0xb3d53a);var _0x290653=_0x46e8d0[_0xf96f('0x62')];var _0x2f22d4=path[_0xf96f('0x15')](config[_0xf96f('0x63')],_0xf96f('0x64'),_0x290653+_0xf96f('0x65'));logger[_0xf96f('0x59')](_0xf96f('0x66'),_0x46e8d0);db[_0xf96f('0x67')][_0xf96f('0x68')]({'raw':!![],'attributes':['id','name']})[_0xf96f('0x21')](function(_0x5461d0){for(var _0x5ab1c9=0x0;_0x5ab1c9<_0x5461d0['length'];_0x5ab1c9++){if(_0x5461d0[_0x5ab1c9][_0xf96f('0x69')]in _0xb3d53a){contactItemTypes[_0xf96f('0x1f')](_0x5461d0[_0x5ab1c9]);delete _0x21557d[_0x5461d0[_0x5ab1c9][_0xf96f('0x69')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x21557d[_0xf96f('0x24')]='';var _0x408b7d=_[_0xf96f('0x53')](_0x21557d)[_0xf96f('0x15')]();logger[_0xf96f('0x59')](_0xf96f('0x6a'),_0x408b7d);fs[_0xf96f('0x6b')](_0x2f22d4,_0x408b7d+'\x0a');Papa[_0xf96f('0x6c')](fs[_0xf96f('0x6d')](_0x5932fa),{'header':!![],'skipEmptyLines':!![],'step':function(_0x17c3de,_0x4b9719){try{for(var _0x19d094=0x0,_0x2bcc77=[];_0x19d094<_0x17c3de[_0xf96f('0x6e')]['length'];_0x19d094++){stats[_0xf96f('0x6f')]+=0x1;if(_0x17c3de[_0xf96f('0x5b')][_0x19d094]){handleError(_0x17c3de['data'][_0x19d094],_0x17c3de[_0xf96f('0x5b')][_0x19d094]);}else{var _0x28e700=[];var _0x12da3f=[];for(var _0xcf4507 in _0xb3d53a){let _0x2ecd44=contactItemTypes[_0xf96f('0x70')](_0x5904b7=>_0x5904b7[_0xf96f('0x69')]===_0xcf4507);if(_[_0xf96f('0x1e')](_0x2ecd44)){if(_0xb3d53a[_0xf96f('0x71')](_0xcf4507)){if(_0x17c3de[_0xf96f('0x6e')][_0x19d094][_0xb3d53a[_0xcf4507]]){var _0x13a6e6=_[_0xf96f('0x72')](_0x17c3de[_0xf96f('0x6e')][_0x19d094][_0xb3d53a[_0xcf4507]][_0xf96f('0x73')](/"/g,'\x27'));switch(_0xcf4507){case'scheduledat':var _0x1fd338=moment(_0x13a6e6,_0xf96f('0xd'),!![]);if(_0x1fd338[_0xf96f('0x74')]()){_0x2bcc77[_0xf96f('0x1f')]('\x22'+_0x13a6e6+'\x22');}else{_0x28e700[_0xf96f('0x1f')](_0xf96f('0x75'));}break;case'priority':var _0x4bb75b=parseInt(_0x13a6e6);_0x13a6e6=_[_0xf96f('0x76')](_0x4bb75b)||_0x4bb75b<0x0||_0x4bb75b>0x4?_0x33059d?0x3:0x2:_0x4bb75b;_0x2bcc77[_0xf96f('0x1f')]('\x22'+_0x13a6e6+'\x22');break;case'UserId':var _0x2385f8=parseInt(_0x13a6e6);if(_[_0xf96f('0x77')](_0x2385f8)&&_[_0xf96f('0x78')](_0x1face3,_0x2385f8)){_0x2bcc77[_0xf96f('0x1f')]('\x22'+_0x2385f8+'\x22');}else{_0x28e700[_0xf96f('0x1f')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x13a6e6)){_0x2bcc77[_0xf96f('0x1f')]('\x22'+_0x13a6e6+'\x22');}else{_0x28e700['push'](_0xf96f('0x79'));}break;case _0xf96f('0x7a'):var _0x114e53=moment(_0x13a6e6,'YYYY-MM-DD',!![]);if(_0x114e53[_0xf96f('0x74')]()){_0x2bcc77[_0xf96f('0x1f')]('\x22'+_0x13a6e6+'\x22');}else{_0x28e700['push'](_0xf96f('0x7b'));}break;default:_0x2bcc77[_0xf96f('0x1f')]('\x22'+_0x13a6e6+'\x22');}}else{switch(_0xcf4507){case'firstName':case _0xf96f('0x13'):_0x28e700[_0xf96f('0x1f')](_0xcf4507+_0xf96f('0x7c'));break;default:_0x2bcc77[_0xf96f('0x1f')]('\x22\x22');}}}}else{var _0xac2d94='';for(var _0x5f35b6=0x0;_0x5f35b6<_0xb3d53a[_0xcf4507][_0xf96f('0x26')];_0x5f35b6++){var _0x13a6e6=_['trim'](_0x17c3de[_0xf96f('0x6e')][_0x19d094][_0xb3d53a[_0xcf4507][_0x5f35b6]][_0xf96f('0x73')](/"/g,'\x27'));if(_0xac2d94=='')_0xac2d94=_0x13a6e6;else _0xac2d94+='|'+_0x13a6e6;}_0x12da3f['push'](_0x2ecd44['id']+':'+_0xac2d94);}}if(hasAdditionalPhones){_0x2bcc77['push']('\x22'+_0x12da3f[_0xf96f('0x15')](';')+'\x22');}if(_0x28e700[_0xf96f('0x26')]){handleError(_0x17c3de['data'][_0x19d094],{'code':'SystemRow','message':_0x28e700[_0xf96f('0x15')]()});}else{fs[_0xf96f('0x7d')](_0x2f22d4,_0x2bcc77[_0xf96f('0x15')]()+'\x0a');}_0x2bcc77=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xf96f('0x7e')+_0x290653,stats);stats[_0xf96f('0x5b')]=[];}}if(stopped){logger[_0xf96f('0x59')](_0xf96f('0x7f'));_0x4b9719[_0xf96f('0x80')]();}}catch(_0x5352e5){handleError(_0x17c3de[_0xf96f('0x6e')][_0x19d094],{'code':_0xf96f('0x81'),'message':_0x5352e5['message']});logger[_0xf96f('0x5c')](_0xf96f('0x82'),_0x5352e5[_0xf96f('0x23')]);}},'complete':function(){try{var _0x390aab=[];var _0x577354=tempTableName;_0x390aab[_0xf96f('0x1f')](_0xf96f('0x83')+_0x577354+_0xf96f('0x84'));logger['info'](_0xf96f('0x85'),contactItemTypes[_0xf96f('0x26')]);var _0x425dc9=util[_0xf96f('0xf')](_0xf96f('0x86'),_0x2f22d4,_0x577354,_0x408b7d,_0x46e8d0['ListId'],_0x46e8d0[_0xf96f('0x54')]||null,NOW,NOW);if(_['isNil'](_0xb3d53a['scheduledat'])){_0x425dc9+=_0xf96f('0x87');}_0x390aab[_0xf96f('0x1f')](_0x425dc9);BPromise[_0xf96f('0x88')](_0x390aab,handleQuery)['then'](function(_0x1a34c5){BPromise[_0xf96f('0x20')]([handleAdditionalPhones()])['then'](function(){_0x390aab=[];for(var _0x561923=0x0;_0x561923\x20\x20'];(function(_0x4ba351,_0x377d32){var _0x3074a4=function(_0x417231){while(--_0x417231){_0x4ba351['push'](_0x4ba351['shift']());}};_0x3074a4(++_0x377d32);}(_0xc2b5,0x9f));var _0x5c2b=function(_0x8809b4,_0x3bdc8a){_0x8809b4=_0x8809b4-0x0;var _0xc33cb7=_0xc2b5[_0x8809b4];return _0xc33cb7;};'use strict';var fs=require('fs');var path=require(_0x5c2b('0x0'));var _=require(_0x5c2b('0x1'));var Papa=require(_0x5c2b('0x2'));var util=require(_0x5c2b('0x3'));var BPromise=require('bluebird');var moment=require(_0x5c2b('0x4'));var squel=require(_0x5c2b('0x5'));var Redis=require(_0x5c2b('0x6'));var db=require(_0x5c2b('0x7'))['db'];var config=require(_0x5c2b('0x8'));var logger=require(_0x5c2b('0x9'))(_0x5c2b('0xa'));config[_0x5c2b('0xb')]=_[_0x5c2b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c2b('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x5c2b('0xd')](_0x5c2b('0xe'));var tempTableName=_0x5c2b('0xf')+moment()[_0x5c2b('0xd')](_0x5c2b('0x10'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x17e255){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))*$/[_0x5c2b('0x11')](_0x17e255);}function selectNotIn(_0x3de2c1,_0x69ff98,_0x476505,_0xe7faa0,_0x25c29f){return squel[_0x5c2b('0x12')]()[_0x5c2b('0x13')](_0x5c2b('0x14'))[_0x5c2b('0x15')](_0xe7faa0)[_0x5c2b('0x16')](_0x69ff98,null,_0x69ff98+_0x5c2b('0x17')+_0xe7faa0+'.'+_0x476505)[_0x5c2b('0x18')](_0xe7faa0+'.'+_0x476505+_0x5c2b('0x19')+_0x3de2c1+'.'+_0x476505)[_0x5c2b('0x18')](_0x69ff98+_0x5c2b('0x1a')+_0x25c29f[_0x5c2b('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x474d3a,_0x5d4055){promisesAdditionalPhones=[];promisesContact=[];return db[_0x5c2b('0x1b')][_0x5c2b('0x1c')](_0x5c2b('0x1d')+tempTableName)['spread'](function(_0x68c45b){if(_0x68c45b!==null){var _0x32b40f=[];for(var _0x5ab259=0x0;_0x5ab259<_0x68c45b[_0x5c2b('0x1e')];_0x5ab259++){var _0x2656aa=_0x68c45b[_0x5ab259];if(!_[_0x5c2b('0x1f')](_0x2656aa['phone'])){if(!_['isNil'](_0x2656aa[_0x5c2b('0x20')]))_0x32b40f[_0x5c2b('0x21')](insertAdditionalPhones(_0x2656aa));promisesContact['push']({'contact':_0x2656aa});}}}Promise[_0x5c2b('0x22')](_0x32b40f)[_0x5c2b('0x23')](function(){_0x474d3a({'val':0x1});});})['catch'](function(_0x5aaa9b){logger[_0x5c2b('0x24')](_0x5aaa9b[_0x5c2b('0x25')]);});});}function insertAdditionalPhones(_0x461f9b){return new Promise(function(_0x131d3b,_0x3c6cf7){var _0x8262e3=_0x461f9b[_0x5c2b('0x20')];if(_[_0x5c2b('0x1f')](_0x8262e3))_0x3c6cf7({'val':0x0});else{var _0x323a9a=_0x8262e3['split'](';');var _0x5b67e8=[];orderBy=0x0;for(var _0x144e00=0x0;_0x144e00<_0x323a9a['length'];_0x144e00++){_0x5b67e8[_0x5c2b('0x21')](splitAdditionalPhone(_0x461f9b['id'],_0x323a9a[_0x144e00]));}Promise['all'](_0x5b67e8)[_0x5c2b('0x23')](function(){_0x131d3b({'val':_0x323a9a[_0x5c2b('0x1e')]});});}});}function splitAdditionalPhone(_0xddd48b,_0x3b2449){return new Promise(function(_0x68aed1,_0x3f68f3){var _0x3767a9=_0x3b2449[_0x5c2b('0x26')](':');var _0x1a697c=_0x3767a9[0x0];var _0x459d66=_0x3767a9[0x1];if(_0x459d66!==''){var _0x4ff706=_0x459d66[_0x5c2b('0x26')]('|');var _0x24a179=[];for(var _0x4046a2=0x0;_0x4046a2<_0x4ff706[_0x5c2b('0x1e')];_0x4046a2++){if(_0x4ff706[_0x4046a2]!==''){var _0xa219c3=_[_0x5c2b('0x27')](promisesAdditionalPhones,{'contactId':_0xddd48b,'phone':_0x4ff706[_0x4046a2]});if(_0xa219c3[_0x5c2b('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x5c2b('0x21')]({'contactId':_0xddd48b,'contactTypeId':_0x1a697c,'phone':_0x4ff706[_0x4046a2],'orderBy':orderBy});}}}_0x68aed1({'ok':0x1});}else _0x68aed1({'res':0x0});});}function createAdditionalPhone(_0x3bb6cc,_0x1656c7,_0x2a5aec,_0x1535bd){return new Promise(function(_0x73e3b8,_0x227210){return db[_0x5c2b('0x28')][_0x5c2b('0x29')]({'where':{'CmContactId':_0x3bb6cc,'item':_0x2a5aec}})[_0x5c2b('0x23')](function(_0x394f7c){if(_0x394f7c){return db['CmContactHasItem'][_0x5c2b('0x2a')]({'ItemTypeId':_0x1656c7,'OrderBy':_0x1535bd},{'where':{'CmContactId':_0x3bb6cc,'item':_0x2a5aec}})[_0x5c2b('0x23')](function(_0x726c49){_0x73e3b8({'res':'updated'});});}else{return db['CmContactHasItem'][_0x5c2b('0x2b')]({'CmContactId':_0x3bb6cc,'item':_0x2a5aec,'ItemTypeId':_0x1656c7,'OrderBy':_0x1535bd,'ItemClass':_0x5c2b('0x2c')})[_0x5c2b('0x23')](function(_0x3a32e3){_0x73e3b8({'res':_0x5c2b('0x2d')});});}});});}function updateContact(_0x44525a){return new Promise(function(_0x18fa16,_0x579bdf){var _0x5d6fef=_0x44525a['id'];delete _0x44525a['id'];return db[_0x5c2b('0x2e')][_0x5c2b('0x2a')](_0x44525a,{'where':{'id':_0x5d6fef}})[_0x5c2b('0x23')](function(_0x16199b){updatedRows+=0x1;return db['CmHopper'][_0x5c2b('0x2a')]({'phone':_0x44525a[_0x5c2b('0x14')]},{'where':{'ContactId':_0x5d6fef}})[_0x5c2b('0x23')](function(_0xe2263d){_0x18fa16({'ret':'OK'});});});});}function insertCmHopper(_0x1d2d63,_0x28c3c7,_0x32fe58,_0x1157d2,_0x518694){var _0x30901e=[_0x5c2b('0x2f'),_0x5c2b('0x30'),'cm_contacts.id','cm_contacts.ListId',_0x28c3c7+'.'+_0x1157d2,_0x5c2b('0x31'),_0x5c2b('0x32'),_0x5c2b('0x33'),_0x5c2b('0x34'),'\x22'+_0x518694+'\x22'];return squel['insert']()[_0x5c2b('0x35')](_0x5c2b('0x36'))[_0x5c2b('0x37')]([_0x5c2b('0x14'),'scheduledat',_0x5c2b('0x38'),'ListId',_0x1157d2,_0x5c2b('0x39'),'updatedAt',_0x5c2b('0x3a'),'UserId',_0x5c2b('0x3b')],squel[_0x5c2b('0x12')]()[_0x5c2b('0x3c')](_0x30901e)[_0x5c2b('0x15')](_0x28c3c7)['join'](_0x5c2b('0x3d'),null,_0x5c2b('0x3e')+_0x28c3c7+_0x5c2b('0x3f'))[_0x5c2b('0x16')](_0x32fe58,null,_0x32fe58+'.id\x20=\x20'+_0x28c3c7+'.'+_0x1157d2)[_0x5c2b('0x18')](_0x28c3c7+_0x5c2b('0x40'),_0x1d2d63)[_0x5c2b('0x18')](_0x5c2b('0x41'),NOW)[_0x5c2b('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x28c3c7,_0x32fe58,_0x1157d2,_0x5c2b('0x36'),[_0x5c2b('0x42'),'\x22onlyIfOpen\x22']))[_0x5c2b('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x28c3c7,_0x32fe58,_0x1157d2,_0x5c2b('0x36'),['\x22always\x22'])))[_0x5c2b('0x43')]();}function insertCmHopperBlack(_0x515e1d,_0x494cd9,_0x720291,_0x207a19){var _0x2b58a6=['cm_contacts.phone',_0x5c2b('0x44'),'cm_contacts.ListId',_0x494cd9+'.'+_0x207a19,_0x5c2b('0x31'),_0x5c2b('0x32')];return squel['insert']()[_0x5c2b('0x35')](_0x5c2b('0x45'))['fromQuery']([_0x5c2b('0x14'),'ContactId',_0x5c2b('0x46'),_0x207a19,_0x5c2b('0x39'),_0x5c2b('0x47')],squel[_0x5c2b('0x12')]()[_0x5c2b('0x3c')](_0x2b58a6)['from'](_0x494cd9)[_0x5c2b('0x16')](_0x5c2b('0x3d'),null,_0x5c2b('0x3e')+_0x494cd9+'.CmListId')['join'](_0x720291,null,_0x720291+'.id\x20=\x20'+_0x494cd9+'.'+_0x207a19)['where'](_0x494cd9+'.CmListId\x20=\x20?',_0x515e1d)[_0x5c2b('0x18')](_0x5c2b('0x41'),NOW)[_0x5c2b('0x18')](_0x5c2b('0x48'),squel['select']()[_0x5c2b('0x13')](_0x5c2b('0x14'))['from'](_0x5c2b('0x45'))[_0x5c2b('0x18')](_0x5c2b('0x49'),_0x515e1d)[_0x5c2b('0x18')](_0x207a19+'\x20=\x20?',_0x494cd9+'.'+_0x207a19)))[_0x5c2b('0x43')]();}function insertCmHopperAdditionalPhones(_0x4250bd){var _0x20f5b6=[_0x5c2b('0x4a'),_0x5c2b('0x4b'),_0x5c2b('0x4c'),'cm_contact_has_items.createdAt',_0x5c2b('0x4d')];return squel['insert']()[_0x5c2b('0x35')](_0x5c2b('0x4e'))['fromQuery']([_0x5c2b('0x4f'),_0x5c2b('0x14'),_0x5c2b('0x50'),_0x5c2b('0x39'),_0x5c2b('0x47')],squel[_0x5c2b('0x12')]()[_0x5c2b('0x3c')](_0x20f5b6)['from'](_0x5c2b('0x36'))[_0x5c2b('0x16')](_0x5c2b('0x3d'),null,_0x5c2b('0x51'))[_0x5c2b('0x16')](_0x5c2b('0x52'),null,_0x5c2b('0x53'))['where'](_0x5c2b('0x54'),_0x4250bd)['where'](_0x5c2b('0x41'),NOW))[_0x5c2b('0x43')]();}function insertCmContact(_0x2ecb8e,_0x1fa808,_0x1c3d81,_0x13226f){var _0x21b33e=_[_0x5c2b('0x55')](_['keys'](_0x13226f),[_0x5c2b('0x46'),_0x5c2b('0x56'),'createdAt',_0x5c2b('0x47')]);return squel[_0x5c2b('0x57')]()[_0x5c2b('0x35')]('cm_contacts')[_0x5c2b('0x37')](_0x21b33e,squel['select']()[_0x5c2b('0x3c')](_0x21b33e)[_0x5c2b('0x15')](_0x1fa808)['where']('('+_0x1c3d81[_0x5c2b('0x16')](',')+_0x5c2b('0x58'),squel['select']()[_0x5c2b('0x3c')](_0x1c3d81)[_0x5c2b('0x15')]('cm_contacts')[_0x5c2b('0x18')](_0x5c2b('0x49'),_0x2ecb8e))[_0x5c2b('0x18')](_0x5c2b('0x59'),squel[_0x5c2b('0x12')]()[_0x5c2b('0x13')](_0x5c2b('0x5a'),_0x5c2b('0x5b'))[_0x5c2b('0x15')](_0x1fa808)['group'](_0x1c3d81['join'](','))))[_0x5c2b('0x43')]();}function handleStop(){logger[_0x5c2b('0x5c')](_0x5c2b('0x5d'));stopped=!![];}function handleUncaughtException(_0x308f60){logger[_0x5c2b('0x24')](_0x308f60[_0x5c2b('0x25')]);process[_0x5c2b('0x5e')](0x1);}function handleError(_0x10566b,_0x50918a){stats[_0x5c2b('0x5f')][_0x5c2b('0x21')]({'name':_0x50918a[_0x5c2b('0x60')],'message':_0x50918a[_0x5c2b('0x25')],'row':_0x10566b});}function handleQuery(_0x3c8351){logger[_0x5c2b('0x5c')](_0x3c8351);return db[_0x5c2b('0x1b')]['query'](_0x3c8351)['spread'](function(_0x35aebb){results['push'](_0x35aebb);})[_0x5c2b('0x61')](function(_0x197db8){logger['error'](_0x197db8[_0x5c2b('0x25')]);});}function main(_0xad8f29,_0x30a34b,_0x17f217,_0x816f8c){logger[_0x5c2b('0x5c')](_0x5c2b('0x62'),_0xad8f29,JSON['stringify'](_0x30a34b));process['send']('start');var _0x262d6e=_0x30a34b['binding'];var _0x444d49=_[_0x5c2b('0x63')](_0x262d6e);var _0x4f2d48=_0x30a34b[_0x5c2b('0x64')];var _0xb653f4=path[_0x5c2b('0x16')](config['root'],'server/files/tmp',_0x4f2d48+'.csv');logger[_0x5c2b('0x5c')](_0x5c2b('0x65'),_0x30a34b);db[_0x5c2b('0x66')][_0x5c2b('0x67')]({'raw':!![],'attributes':['id',_0x5c2b('0x68')]})['then'](function(_0xf14a45){for(var _0x52b3dc=0x0;_0x52b3dc<_0xf14a45[_0x5c2b('0x1e')];_0x52b3dc++){if(_0xf14a45[_0x52b3dc][_0x5c2b('0x68')]in _0x262d6e){contactItemTypes['push'](_0xf14a45[_0x52b3dc]);delete _0x444d49[_0xf14a45[_0x52b3dc]['name']];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x444d49[_0x5c2b('0x20')]='';var _0x5acf01=_[_0x5c2b('0x69')](_0x444d49)[_0x5c2b('0x16')]();logger[_0x5c2b('0x5c')](_0x5c2b('0x6a'),_0x5acf01);fs[_0x5c2b('0x6b')](_0xb653f4,_0x5acf01+'\x0a');Papa[_0x5c2b('0x6c')](fs[_0x5c2b('0x6d')](_0xad8f29),{'header':!![],'skipEmptyLines':!![],'step':function(_0x7685b3,_0x10cd9a){try{for(var _0x25dd08=0x0,_0xd4b199=[];_0x25dd08<_0x7685b3[_0x5c2b('0x6e')][_0x5c2b('0x1e')];_0x25dd08++){stats[_0x5c2b('0x6f')]+=0x1;if(_0x7685b3[_0x5c2b('0x5f')][_0x25dd08]){handleError(_0x7685b3[_0x5c2b('0x6e')][_0x25dd08],_0x7685b3[_0x5c2b('0x5f')][_0x25dd08]);}else{var _0x391870=[];var _0x148972=[];for(var _0x1e24fd in _0x262d6e){let _0x3ae2ab=contactItemTypes[_0x5c2b('0x70')](_0x322e17=>_0x322e17[_0x5c2b('0x68')]===_0x1e24fd);if(_['isNil'](_0x3ae2ab)){if(_0x262d6e[_0x5c2b('0x71')](_0x1e24fd)){if(_0x7685b3[_0x5c2b('0x6e')][_0x25dd08][_0x262d6e[_0x1e24fd]]){var _0x1b49bb=_[_0x5c2b('0x72')](_0x7685b3[_0x5c2b('0x6e')][_0x25dd08][_0x262d6e[_0x1e24fd]][_0x5c2b('0x73')](/"/g,'\x27'));switch(_0x1e24fd){case _0x5c2b('0x74'):var _0x103efd=moment(_0x1b49bb,_0x5c2b('0xe'),!![]);if(_0x103efd['isValid']()){_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x1b49bb+'\x22');}else{_0x391870['push'](_0x5c2b('0x75'));}break;case _0x5c2b('0x3a'):var _0x3bf828=parseInt(_0x1b49bb);_0x1b49bb=_['isNaN'](_0x3bf828)||_0x3bf828<0x0||_0x3bf828>0x4?_0x816f8c?0x3:0x2:_0x3bf828;_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x1b49bb+'\x22');break;case _0x5c2b('0x76'):var _0x3ee82d=parseInt(_0x1b49bb);if(_['isNumber'](_0x3ee82d)&&_['includes'](_0x17f217,_0x3ee82d)){_0xd4b199['push']('\x22'+_0x3ee82d+'\x22');}else{_0x391870[_0x5c2b('0x21')]('agent\x20not\x20exists');}break;case _0x5c2b('0x77'):if(isEmail(_0x1b49bb)){_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x1b49bb+'\x22');}else{_0x391870[_0x5c2b('0x21')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x27fec3=moment(_0x1b49bb,_0x5c2b('0x78'),!![]);if(_0x27fec3[_0x5c2b('0x79')]()){_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x1b49bb+'\x22');}else{_0x391870[_0x5c2b('0x21')](_0x5c2b('0x7a'));}break;default:_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x1b49bb+'\x22');}}else{switch(_0x1e24fd){case'firstName':case'phone':_0x391870[_0x5c2b('0x21')](_0x1e24fd+_0x5c2b('0x7b'));break;default:_0xd4b199[_0x5c2b('0x21')]('\x22\x22');}}}}else{var _0x28d822='';for(var _0x4a4311=0x0;_0x4a4311<_0x262d6e[_0x1e24fd][_0x5c2b('0x1e')];_0x4a4311++){var _0x1b49bb=_[_0x5c2b('0x72')](_0x7685b3[_0x5c2b('0x6e')][_0x25dd08][_0x262d6e[_0x1e24fd][_0x4a4311]][_0x5c2b('0x73')](/"/g,'\x27'));if(_0x28d822=='')_0x28d822=_0x1b49bb;else _0x28d822+='|'+_0x1b49bb;}_0x148972[_0x5c2b('0x21')](_0x3ae2ab['id']+':'+_0x28d822);}}if(hasAdditionalPhones){_0xd4b199[_0x5c2b('0x21')]('\x22'+_0x148972[_0x5c2b('0x16')](';')+'\x22');}if(_0x391870[_0x5c2b('0x1e')]){handleError(_0x7685b3[_0x5c2b('0x6e')][_0x25dd08],{'code':'SystemRow','message':_0x391870['join']()});}else{fs[_0x5c2b('0x7c')](_0xb653f4,_0xd4b199[_0x5c2b('0x16')]()+'\x0a');}_0xd4b199=[];}if(!(stats['rows']%0xc8)){socket[_0x5c2b('0x7d')](_0x5c2b('0x7e')+_0x4f2d48,stats);stats[_0x5c2b('0x5f')]=[];}}if(stopped){logger[_0x5c2b('0x5c')](_0x5c2b('0x7f'));_0x10cd9a[_0x5c2b('0x80')]();}}catch(_0x39650a){handleError(_0x7685b3[_0x5c2b('0x6e')][_0x25dd08],{'code':'SystemError','message':_0x39650a[_0x5c2b('0x25')]});logger[_0x5c2b('0x24')]('step',_0x39650a[_0x5c2b('0x25')]);}},'complete':function(){try{var _0x5a54a9=[];var _0x24d46f=tempTableName;_0x5a54a9[_0x5c2b('0x21')](_0x5c2b('0x81')+_0x24d46f+'\x20LIKE\x20cm_contacts;');logger[_0x5c2b('0x5c')](_0x5c2b('0x82'),contactItemTypes[_0x5c2b('0x1e')]);var _0x4cbe81=util['format'](_0x5c2b('0x83'),_0xb653f4,_0x24d46f,_0x5acf01,_0x30a34b[_0x5c2b('0x46')],_0x30a34b[_0x5c2b('0x56')]||null,NOW,NOW);if(_[_0x5c2b('0x1f')](_0x262d6e[_0x5c2b('0x74')])){_0x4cbe81+=_0x5c2b('0x84');}_0x5a54a9[_0x5c2b('0x21')](_0x4cbe81);BPromise['each'](_0x5a54a9,handleQuery)['then'](function(_0x139095){BPromise['all']([handleAdditionalPhones()])[_0x5c2b('0x23')](function(){_0x5a54a9=[];for(var _0x31b713=0x0;_0x31b713=_0x219b44){return _0x52c9ac[_0x55a3('0x14')](0x193)[_0x55a3('0x15')]({'message':util[_0x55a3('0xa')](_0x55a3('0x16'),_0x42fc00)});}_0x2b029a();})[_0x55a3('0x17')](function(_0x4368d0){_0x2b029a(_0x4368d0);});});}function isUserLimit(){return isLimit(_0x55a3('0x18'),0x1,db[_0x55a3('0x19')],{'where':{'$or':[{'role':'admin'},{'role':_0x55a3('0x1a')}]}});}exports[_0x55a3('0x1b')]=isUserLimit; \ No newline at end of file +var _0xed87=['catch','users','User','admin','user','isUserLimit','crypto','util','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','hasOwnProperty','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0x4ccf2b,_0x4a31af){var _0x4f4053=function(_0xdd3729){while(--_0xdd3729){_0x4ccf2b['push'](_0x4ccf2b['shift']());}};_0x4f4053(++_0x4a31af);}(_0xed87,0x83));var _0x7ed8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed87[_0x14add3];return _0x4a174f;};'use strict';var crypto=require(_0x7ed8('0x0'));var util=require(_0x7ed8('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x7ed8('0x2'));function getValueFromLicense(_0x34b510,_0x27a401){if(_0x34b510&&_0x27a401){if(_0x27a401[_0x7ed8('0x3')]&&_0x27a401[_0x7ed8('0x4')]){var _0xf7d7bf=_0x27a401[_0x7ed8('0x3')];var _0x5015bb=_0x27a401['license'];var _0x4af3b0=_0xf7d7bf[_0x7ed8('0x5')]('-')[0x4];var _0xa605c5=_0xf7d7bf[_0x7ed8('0x5')]('-')[0x0];var _0x34e9dd=crypto['createDecipher'](_0x7ed8('0x6'),util[_0x7ed8('0x7')](_0x7ed8('0x8'),_0x4af3b0,_0xf7d7bf,_0xa605c5));var _0x5bca7a=_0x34e9dd[_0x7ed8('0x9')](_0x5015bb,_0x7ed8('0xa'),_0x7ed8('0xb'));_0x5bca7a+=_0x34e9dd['final'](_0x7ed8('0xb'));var _0x126a68=JSON['parse'](_0x5bca7a);return _0x126a68[_0x7ed8('0xc')](_0x34b510)?_0x126a68[_0x34b510]:null;}}return null;}function isLimit(_0x236527,_0x123d68,_0x2b6899,_0x4f38ef){var _0x1e0dba=_0x123d68;return compose()[_0x7ed8('0xd')](function(_0x589f52,_0x2fe60a,_0x86c001){return db['License'][_0x7ed8('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x7ed8('0xf')](function(_0x59c4d3){var _0x462250=getValueFromLicense(_0x236527,_0x59c4d3);return _0x462250?_0x462250:_0x1e0dba;})['then'](function(_0x27a723){_0x1e0dba=_0x27a723;return _0x2b6899['count'](_0x4f38ef);})[_0x7ed8('0xf')](function(_0x440ed7){if(_0x440ed7>=_0x1e0dba){return _0x2fe60a[_0x7ed8('0x10')](0x193)[_0x7ed8('0x11')]({'message':util[_0x7ed8('0x7')](_0x7ed8('0x12'),_0x236527)});}_0x86c001();})[_0x7ed8('0x13')](function(_0x3ef92e){_0x86c001(_0x3ef92e);});});}function isUserLimit(){return isLimit(_0x7ed8('0x14'),0x1,db[_0x7ed8('0x15')],{'where':{'$or':[{'role':_0x7ed8('0x16')},{'role':_0x7ed8('0x17')}]}});}exports[_0x7ed8('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 20811c4..cf558f5 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 _0x1848=['parseSearch','startsWith','[$or]','replace','[$and]','split','slice','forEach','shift','map','DATE','operator','value','includes','days','format','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$eq','=\x20?','$ne','<>\x20?','$substring','LIKE\x20?','$lt','<\x20?','$gt','$lte','<=\x20?','$gte','>=\x20?','$between','$in','start','$startsWith','$endsWith','pop','utcOffset','add','hours','minutes','seconds','lodash','moment'];(function(_0x39f5ad,_0x39b70d){var _0x1aa465=function(_0x4b61c7){while(--_0x4b61c7){_0x39f5ad['push'](_0x39f5ad['shift']());}};_0x1aa465(++_0x39b70d);}(_0x1848,0xc6));var _0x8184=function(_0x5dbb5a,_0x5c8b16){_0x5dbb5a=_0x5dbb5a-0x0;var _0xfe18f3=_0x1848[_0x5dbb5a];return _0xfe18f3;};'use strict';var _=require(_0x8184('0x0'));var moment=require(_0x8184('0x1'));exports[_0x8184('0x2')]=function(_0x3046fd){var _0x2e740c={'conditions':[]};_0x2e740c['sqlOperator']=_[_0x8184('0x3')](_0x3046fd,_0x8184('0x4'))?'or':'and';var _0x2a9d3a=_0x3046fd[_0x8184('0x5')](_0x8184('0x6'),'')[_0x8184('0x5')](_0x8184('0x4'),'')[_0x8184('0x7')]('||');for(var _0x51d884=0x0;_0x51d884<_0x2a9d3a['length'];_0x51d884++){var _0x4e719a=_0x2a9d3a[_0x51d884]['split'](':=');var _0x167188=_0x4e719a[0x0];var _0x564e11=_0x4e719a[_0x8184('0x8')](0x1);_0x564e11[_0x8184('0x9')](function(_0x271332){var _0x509c75=_0x271332[_0x8184('0x7')]('[')[_0x8184('0xa')]();var _0x4dab00=_0x271332['match'](/\[(.*?)\]/g);_0x4dab00[_0x8184('0x9')](function(_0x3aa632){var _0x5abf94=_0x3aa632[_0x8184('0x7')]('[')['filter'](function(_0x3fdf58){return _0x3fdf58['indexOf'](']')>-0x1;})[_0x8184('0xb')](function(_0x293227){return _0x293227[_0x8184('0x7')](']')[0x0];})[0x0];_0x2e740c['conditions']['push']({'field':_0x167188,'operator':_0x509c75,'value':_0x5abf94});});});}return _0x2e740c;};exports['buildExpression']=function(_0x457ecb,_0x3ca0c3,_0x46f3b6){var _0x46a591={};if(_0x3ca0c3===_0x8184('0xc')){if(_0x46f3b6['operator']==='$eq'){_0x46f3b6[_0x8184('0xd')]='$between';_0x46f3b6[_0x8184('0xe')]+=','+_0x46f3b6['value'];}else if(_[_0x8184('0xf')](['$gt','$lte'],_0x46f3b6[_0x8184('0xd')])){_0x46f3b6['value']=moment(_0x46f3b6[_0x8184('0xe')])['add'](0x1,_0x8184('0x10'))[_0x8184('0x11')]('YYYY-MM-DD');}}if(_0x46f3b6[_0x8184('0x12')]){_0x3ca0c3=_0x46f3b6['castTo'];_0x46a591[_0x8184('0x13')]=_0x8184('0x14')+_0x457ecb+'.'+_0x46f3b6[_0x8184('0x15')]+_0x8184('0x16')+_0x46f3b6['castTo']+')\x20'+parseOperator(_0x46f3b6[_0x8184('0xd')]);}else{_0x46a591['text']=_0x457ecb+'.'+_0x46f3b6[_0x8184('0x15')]+'\x20'+parseOperator(_0x46f3b6['operator']);}if(_[_0x8184('0xf')](['$ne',_0x8184('0x17')],_0x46f3b6['operator']))_0x46a591[_0x8184('0x13')]='('+_0x46a591['text']+_0x8184('0x18')+_0x457ecb+'.'+_0x46f3b6[_0x8184('0x15')]+_0x8184('0x19');_0x46a591[_0x8184('0xe')]=parseValue(_0x3ca0c3,_0x46f3b6[_0x8184('0xd')],_0x46f3b6[_0x8184('0xe')]);return _0x46a591;};function parseOperator(_0x5e0c54){var _0x4c0b40;switch(_0x5e0c54){case'$in':_0x4c0b40='IN\x20?';break;case'$notIn':_0x4c0b40='NOT\x20IN\x20?';break;case _0x8184('0x1a'):_0x4c0b40=_0x8184('0x1b');break;case _0x8184('0x1c'):_0x4c0b40=_0x8184('0x1d');break;case _0x8184('0x1e'):case'$startsWith':case'$endsWith':_0x4c0b40=_0x8184('0x1f');break;case _0x8184('0x20'):_0x4c0b40=_0x8184('0x21');break;case _0x8184('0x22'):_0x4c0b40='>\x20?';break;case _0x8184('0x23'):_0x4c0b40=_0x8184('0x24');break;case _0x8184('0x25'):_0x4c0b40=_0x8184('0x26');break;case _0x8184('0x27'):_0x4c0b40='BETWEEN\x20?\x20AND\x20?';break;}return _0x4c0b40;}function parseValue(_0x399a50,_0x299f74,_0xb2fedc){var _0x1231f3={'start':undefined,'end':undefined};switch(_0x299f74){case _0x8184('0x28'):case _0x8184('0x17'):_0x1231f3['start']=_0xb2fedc['split'](',');break;case _0x8184('0x1e'):_0x1231f3[_0x8184('0x29')]='%'+_0xb2fedc+'%';break;case _0x8184('0x2a'):_0x1231f3[_0x8184('0x29')]=_0xb2fedc+'%';break;case _0x8184('0x2b'):_0x1231f3[_0x8184('0x29')]='%'+_0xb2fedc;break;case _0x8184('0x27'):var _0x8d0ade=_0xb2fedc[_0x8184('0x7')](',');var _0xb2fedc=_0x8d0ade[_0x8184('0xa')]();var _0x144bd5=_0x8d0ade[_0x8184('0x2c')]();if(_0x399a50===_0x8184('0xc')){_0xb2fedc=moment(_0xb2fedc)[_0x8184('0x2d')](0x0,!![])[_0x8184('0x11')]();_0x144bd5=moment(_0x144bd5)[_0x8184('0x2d')](0x0,!![])[_0x8184('0x2e')](0x17,_0x8184('0x2f'))[_0x8184('0x2e')](0x3b,_0x8184('0x30'))['add'](0x3b,_0x8184('0x31'))[_0x8184('0x11')]();}_0x1231f3={'start':_0xb2fedc,'end':_0x144bd5};break;default:_0x1231f3[_0x8184('0x29')]=_0xb2fedc;break;}return _0x1231f3;} \ No newline at end of file +var _0xf5c5=['match','forEach','filter','map','conditions','push','buildExpression','operator','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','CAST(','\x20AS\x20','text','field','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$eq','=\x20?','$ne','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','format','hours','minutes','lodash','moment','parseSearch','startsWith','[$or]','and','[$and]','replace','split','shift'];(function(_0x1eafda,_0x42533a){var _0x238ebc=function(_0xa57274){while(--_0xa57274){_0x1eafda['push'](_0x1eafda['shift']());}};_0x238ebc(++_0x42533a);}(_0xf5c5,0xda));var _0x5f5c=function(_0x424b6b,_0x198d98){_0x424b6b=_0x424b6b-0x0;var _0x1ee284=_0xf5c5[_0x424b6b];return _0x1ee284;};'use strict';var _=require(_0x5f5c('0x0'));var moment=require(_0x5f5c('0x1'));exports[_0x5f5c('0x2')]=function(_0x5d3035){var _0x256eaa={'conditions':[]};_0x256eaa['sqlOperator']=_[_0x5f5c('0x3')](_0x5d3035,_0x5f5c('0x4'))?'or':_0x5f5c('0x5');var _0x3814ce=_0x5d3035['replace'](_0x5f5c('0x6'),'')[_0x5f5c('0x7')](_0x5f5c('0x4'),'')['split']('||');for(var _0x428f3f=0x0;_0x428f3f<_0x3814ce['length'];_0x428f3f++){var _0x123cdc=_0x3814ce[_0x428f3f]['split'](':=');var _0x384b8f=_0x123cdc[0x0];var _0x296c23=_0x123cdc['slice'](0x1);_0x296c23['forEach'](function(_0xcbaee5){var _0x38ec9a=_0xcbaee5[_0x5f5c('0x8')]('[')[_0x5f5c('0x9')]();var _0x24087d=_0xcbaee5[_0x5f5c('0xa')](/\[(.*?)\]/g);_0x24087d[_0x5f5c('0xb')](function(_0x3bd001){var _0x5341de=_0x3bd001[_0x5f5c('0x8')]('[')[_0x5f5c('0xc')](function(_0x4def42){return _0x4def42['indexOf'](']')>-0x1;})[_0x5f5c('0xd')](function(_0x47ff1a){return _0x47ff1a[_0x5f5c('0x8')](']')[0x0];})[0x0];_0x256eaa[_0x5f5c('0xe')][_0x5f5c('0xf')]({'field':_0x384b8f,'operator':_0x38ec9a,'value':_0x5341de});});});}return _0x256eaa;};exports[_0x5f5c('0x10')]=function(_0x122cbd,_0x50237e,_0x3d3d01){var _0x1aa58c={};if(_0x50237e==='DATE'){if(_0x3d3d01[_0x5f5c('0x11')]==='$eq'){_0x3d3d01[_0x5f5c('0x11')]='$between';_0x3d3d01[_0x5f5c('0x12')]+=','+_0x3d3d01['value'];}else if(_[_0x5f5c('0x13')]([_0x5f5c('0x14'),_0x5f5c('0x15')],_0x3d3d01[_0x5f5c('0x11')])){_0x3d3d01[_0x5f5c('0x12')]=moment(_0x3d3d01[_0x5f5c('0x12')])[_0x5f5c('0x16')](0x1,_0x5f5c('0x17'))['format'](_0x5f5c('0x18'));}}if(_0x3d3d01['castTo']){_0x50237e=_0x3d3d01[_0x5f5c('0x19')];_0x1aa58c['text']=_0x5f5c('0x1a')+_0x122cbd+'.'+_0x3d3d01['field']+_0x5f5c('0x1b')+_0x3d3d01[_0x5f5c('0x19')]+')\x20'+parseOperator(_0x3d3d01[_0x5f5c('0x11')]);}else{_0x1aa58c[_0x5f5c('0x1c')]=_0x122cbd+'.'+_0x3d3d01[_0x5f5c('0x1d')]+'\x20'+parseOperator(_0x3d3d01['operator']);}if(_[_0x5f5c('0x13')](['$ne','$notIn'],_0x3d3d01[_0x5f5c('0x11')]))_0x1aa58c[_0x5f5c('0x1c')]='('+_0x1aa58c['text']+_0x5f5c('0x1e')+_0x122cbd+'.'+_0x3d3d01[_0x5f5c('0x1d')]+_0x5f5c('0x1f');_0x1aa58c[_0x5f5c('0x12')]=parseValue(_0x50237e,_0x3d3d01[_0x5f5c('0x11')],_0x3d3d01['value']);return _0x1aa58c;};function parseOperator(_0x9ec9ee){var _0x572892;switch(_0x9ec9ee){case _0x5f5c('0x20'):_0x572892=_0x5f5c('0x21');break;case _0x5f5c('0x22'):_0x572892=_0x5f5c('0x23');break;case _0x5f5c('0x24'):_0x572892=_0x5f5c('0x25');break;case _0x5f5c('0x26'):_0x572892='<>\x20?';break;case _0x5f5c('0x27'):case _0x5f5c('0x28'):case _0x5f5c('0x29'):_0x572892=_0x5f5c('0x2a');break;case'$lt':_0x572892=_0x5f5c('0x2b');break;case _0x5f5c('0x14'):_0x572892=_0x5f5c('0x2c');break;case _0x5f5c('0x15'):_0x572892=_0x5f5c('0x2d');break;case _0x5f5c('0x2e'):_0x572892=_0x5f5c('0x2f');break;case _0x5f5c('0x30'):_0x572892=_0x5f5c('0x31');break;}return _0x572892;}function parseValue(_0x400b4c,_0x487435,_0x58bcd1){var _0x54776b={'start':undefined,'end':undefined};switch(_0x487435){case _0x5f5c('0x20'):case'$notIn':_0x54776b[_0x5f5c('0x32')]=_0x58bcd1[_0x5f5c('0x8')](',');break;case _0x5f5c('0x27'):_0x54776b[_0x5f5c('0x32')]='%'+_0x58bcd1+'%';break;case'$startsWith':_0x54776b['start']=_0x58bcd1+'%';break;case _0x5f5c('0x29'):_0x54776b[_0x5f5c('0x32')]='%'+_0x58bcd1;break;case'$between':var _0x4018a0=_0x58bcd1['split'](',');var _0x58bcd1=_0x4018a0[_0x5f5c('0x9')]();var _0x13f99f=_0x4018a0[_0x5f5c('0x33')]();if(_0x400b4c===_0x5f5c('0x34')){_0x58bcd1=moment(_0x58bcd1)[_0x5f5c('0x35')](0x0,!![])[_0x5f5c('0x36')]();_0x13f99f=moment(_0x13f99f)[_0x5f5c('0x35')](0x0,!![])['add'](0x17,_0x5f5c('0x37'))[_0x5f5c('0x16')](0x3b,_0x5f5c('0x38'))[_0x5f5c('0x16')](0x3b,'seconds')['format']();}_0x54776b={'start':_0x58bcd1,'end':_0x13f99f};break;default:_0x54776b[_0x5f5c('0x32')]=_0x58bcd1;break;}return _0x54776b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index da91ad5..9880b95 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 _0x41d5=['substr','DESC','unsigned','omit','length','hasOwnProperty','isNumeric','match','isEmail','push','toString','join','moment','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit','offset','sort','map','indexOf','priority','cast','col'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41d5,0x7e));var _0x541d=function(_0x4e559f,_0x3c7238){_0x4e559f=_0x4e559f-0x0;var _0x2d1bec=_0x41d5[_0x4e559f];return _0x2d1bec;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0x541d('0x0'));var LIMIT_VALUE=0xfa;exports[_0x541d('0x1')]=function(_0x380b72){var _0x273f1f=null;if(_0x380b72){_0x273f1f=_0x380b72[_0x541d('0x2')](',');}return _0x273f1f;};exports[_0x541d('0x3')]=function(_0x283e3f,_0x1db77d){var _0x1975ca={};if(!_[_0x541d('0x4')](_0x283e3f)){_[_0x541d('0x5')](_0x283e3f,function(_0x4933a5,_0x1256fb){try{if(_0x1db77d){var _0x477d5f=_[_0x541d('0x6')](_0x1db77d,{'name':_0x1256fb})||{};if(_0x477d5f[_0x541d('0x7')]===_0x541d('0x8')&&_[_0x541d('0x9')](_0x4933a5)){var _0x5a2d17=JSON[_0x541d('0xa')](_0x4933a5);var _0x43b6ae={'$gte':moment(moment(_0x5a2d17[_0x541d('0xb')])[_0x541d('0xc')](_0x541d('0xd')))[_0x541d('0xe')]()['format'](),'$lte':moment(moment(_0x5a2d17[_0x541d('0xf')])[_0x541d('0xc')](_0x541d('0xd')))['utc']()[_0x541d('0x10')](0x1,'s')[_0x541d('0xc')]()};_0x1975ca[_0x1256fb]=_0x43b6ae;}else{_0x1975ca[_0x1256fb]=_['isArray'](_0x4933a5)?_0x4933a5:JSON[_0x541d('0xa')](_0x4933a5);}}else{_0x1975ca[_0x1256fb]=_[_0x541d('0x11')](_0x4933a5)?_0x4933a5:JSON[_0x541d('0xa')](_0x4933a5);}}catch(_0x43b1fc){_0x1975ca[_0x1256fb]=_0x4933a5[_0x541d('0x2')](',');}});}return _0x1975ca;};exports[_0x541d('0x12')]=function(_0x19909f){_0x19909f=parseInt(_0x19909f,0xa);if(!_0x19909f||_0x19909f<0x0){_0x19909f=LIMIT_VALUE;}return _0x19909f;};exports[_0x541d('0x13')]=function(_0x15d597){_0x15d597=parseInt(_0x15d597,0xa);if(!_0x15d597||_0x15d597<0x0){_0x15d597=0x0;}return _0x15d597;};exports[_0x541d('0x14')]=function(_0x49bb56){var _0x2f73a2,_0x1e05b7=null;if(_0x49bb56){_0x2f73a2=_0x49bb56['split'](',');_0x1e05b7=_[_0x541d('0x15')](_0x2f73a2,function(_0x28ea31){if(_0x28ea31[_0x541d('0x16')]('-')===0x0){return[_0x28ea31===_0x541d('0x17')?sequelize[_0x541d('0x18')](sequelize[_0x541d('0x19')]('priority'),'unsigned'):_0x28ea31[_0x541d('0x1a')](0x1),_0x541d('0x1b')];}else{return[_0x28ea31===_0x541d('0x17')?sequelize[_0x541d('0x18')](sequelize[_0x541d('0x19')](_0x541d('0x17')),_0x541d('0x1c')):_0x28ea31,'ASC'];}});}return _0x1e05b7;};exports[_0x541d('0x1d')]=function(_0x1ad78c,_0x4965c2){if(_['isEmpty'](_0x1ad78c)){return _0x1ad78c;}if(_[_0x541d('0x11')](_0x1ad78c)){for(var _0x1fd845=0x0;_0x1fd845<_0x1ad78c[_0x541d('0x1e')];_0x1fd845+=0x1){_0x1ad78c[_0x1fd845]=this[_0x541d('0x1d')](_0x1ad78c[_0x1fd845],_0x4965c2);}return _0x1ad78c;}if(!_['isObject'](_0x1ad78c)){return _0x1ad78c;}if(_['isString'](_0x4965c2)){_0x4965c2=[_0x4965c2];}if(!_[_0x541d('0x11')](_0x4965c2)){return _0x1ad78c;}for(var _0x49e607=0x0;_0x49e607<_0x4965c2[_0x541d('0x1e')];_0x49e607+=0x1){_['unset'](_0x1ad78c,_0x4965c2[_0x49e607]);}for(var _0x9c2fe in _0x1ad78c){if(_0x1ad78c[_0x541d('0x1f')](_0x9c2fe)){_0x1ad78c[_0x9c2fe]=this[_0x541d('0x1d')](_0x1ad78c[_0x9c2fe],_0x4965c2);}}return _0x1ad78c;};exports[_0x541d('0x20')]=function(_0x54173d){return _0x54173d[_0x541d('0x21')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0x541d('0x22')]=function(_0x16a11e){return _0x16a11e[_0x541d('0x21')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x2d9a7c){var _0xe920aa=[];_0x2d9a7c[_0x541d('0x2')]('\x20')['forEach'](function(_0x1e3cb7){_0xe920aa[_0x541d('0x23')]('+'+_0x1e3cb7[_0x541d('0x24')]()+'*');});return _0xe920aa[_0x541d('0x25')]('\x20');}; \ No newline at end of file +var _0xde1e=['find','type','DATE','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','subtract','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','length','omit','isObject','hasOwnProperty','match','^[0-9]*$','isEmail','getFullTextValue','forEach','push','join','lodash','sequelize','moment','fields','filters','isEmpty','forOwn'];(function(_0x19194b,_0x473881){var _0x37fb02=function(_0xcdd0f6){while(--_0xcdd0f6){_0x19194b['push'](_0x19194b['shift']());}};_0x37fb02(++_0x473881);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xede1('0x0'));var sequelize=require(_0xede1('0x1'));var moment=require(_0xede1('0x2'));var LIMIT_VALUE=0xfa;exports[_0xede1('0x3')]=function(_0x198cb7){var _0x466322=null;if(_0x198cb7){_0x466322=_0x198cb7['split'](',');}return _0x466322;};exports[_0xede1('0x4')]=function(_0x1e766f,_0x40b40c){var _0x40a726={};if(!_[_0xede1('0x5')](_0x1e766f)){_[_0xede1('0x6')](_0x1e766f,function(_0x4e9527,_0x3a4671){try{if(_0x40b40c){var _0xeeec58=_[_0xede1('0x7')](_0x40b40c,{'name':_0x3a4671})||{};if(_0xeeec58[_0xede1('0x8')]===_0xede1('0x9')&&_[_0xede1('0xa')](_0x4e9527)){var _0x5a2cd6=JSON[_0xede1('0xb')](_0x4e9527);var _0x4bc1f1={'$gte':moment(moment(_0x5a2cd6['$gte'])[_0xede1('0xc')](_0xede1('0xd')))[_0xede1('0xe')]()[_0xede1('0xc')](),'$lte':moment(moment(_0x5a2cd6[_0xede1('0xf')])[_0xede1('0xc')]('YYYY-MM-DD'))[_0xede1('0xe')]()[_0xede1('0x10')](0x1,'s')[_0xede1('0xc')]()};_0x40a726[_0x3a4671]=_0x4bc1f1;}else{_0x40a726[_0x3a4671]=_['isArray'](_0x4e9527)?_0x4e9527:JSON['parse'](_0x4e9527);}}else{_0x40a726[_0x3a4671]=_[_0xede1('0x11')](_0x4e9527)?_0x4e9527:JSON[_0xede1('0xb')](_0x4e9527);}}catch(_0x1c7cb2){_0x40a726[_0x3a4671]=_0x4e9527[_0xede1('0x12')](',');}});}return _0x40a726;};exports[_0xede1('0x13')]=function(_0x4e3575){_0x4e3575=parseInt(_0x4e3575,0xa);if(!_0x4e3575||_0x4e3575<0x0){_0x4e3575=LIMIT_VALUE;}return _0x4e3575;};exports[_0xede1('0x14')]=function(_0x110811){_0x110811=parseInt(_0x110811,0xa);if(!_0x110811||_0x110811<0x0){_0x110811=0x0;}return _0x110811;};exports[_0xede1('0x15')]=function(_0xc3dd7d){var _0x3be8dd,_0x1600ec=null;if(_0xc3dd7d){_0x3be8dd=_0xc3dd7d[_0xede1('0x12')](',');_0x1600ec=_[_0xede1('0x16')](_0x3be8dd,function(_0x5648fb){if(_0x5648fb[_0xede1('0x17')]('-')===0x0){return[_0x5648fb===_0xede1('0x18')?sequelize[_0xede1('0x19')](sequelize[_0xede1('0x1a')](_0xede1('0x18')),_0xede1('0x1b')):_0x5648fb[_0xede1('0x1c')](0x1),_0xede1('0x1d')];}else{return[_0x5648fb===_0xede1('0x18')?sequelize[_0xede1('0x19')](sequelize[_0xede1('0x1a')]('priority'),_0xede1('0x1b')):_0x5648fb,'ASC'];}});}return _0x1600ec;};exports['omit']=function(_0x3dbcdf,_0x1a9734){if(_[_0xede1('0x5')](_0x3dbcdf)){return _0x3dbcdf;}if(_[_0xede1('0x11')](_0x3dbcdf)){for(var _0x21f76b=0x0;_0x21f76b<_0x3dbcdf[_0xede1('0x1e')];_0x21f76b+=0x1){_0x3dbcdf[_0x21f76b]=this[_0xede1('0x1f')](_0x3dbcdf[_0x21f76b],_0x1a9734);}return _0x3dbcdf;}if(!_[_0xede1('0x20')](_0x3dbcdf)){return _0x3dbcdf;}if(_['isString'](_0x1a9734)){_0x1a9734=[_0x1a9734];}if(!_[_0xede1('0x11')](_0x1a9734)){return _0x3dbcdf;}for(var _0x3c13d9=0x0;_0x3c13d9<_0x1a9734['length'];_0x3c13d9+=0x1){_['unset'](_0x3dbcdf,_0x1a9734[_0x3c13d9]);}for(var _0xfff77d in _0x3dbcdf){if(_0x3dbcdf[_0xede1('0x21')](_0xfff77d)){_0x3dbcdf[_0xfff77d]=this['omit'](_0x3dbcdf[_0xfff77d],_0x1a9734);}}return _0x3dbcdf;};exports['isNumeric']=function(_0x47fff3){return _0x47fff3[_0xede1('0x22')](RegExp(_0xede1('0x23')))?!![]:![];};exports[_0xede1('0x24')]=function(_0x1a5569){return _0x1a5569[_0xede1('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0xede1('0x25')]=function(_0x2a8ebb){var _0x174ec3=[];_0x2a8ebb[_0xede1('0x12')]('\x20')[_0xede1('0x26')](function(_0x2fddb9){_0x174ec3[_0xede1('0x27')]('+'+_0x2fddb9['toString']()+'*');});return _0x174ec3[_0xede1('0x28')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6c8729e..b3bc568 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x848e=['path','cors','./environment','../mysqldb','default','get','env','production','set','appPath','root','development','test','client','toISOString','split','use','static','views','/server/views','html','ejs','renderFile','view\x20engine','urlencoded','50mb','express','method-override','errorhandler'];(function(_0x30da69,_0x119366){var _0x31a70b=function(_0x53df06){while(--_0x53df06){_0x30da69['push'](_0x30da69['shift']());}};_0x31a70b(++_0x119366);}(_0x848e,0x1cd));var _0xe848=function(_0xc95fe9,_0x36bcb1){_0xc95fe9=_0xc95fe9-0x0;var _0x3761dd=_0x848e[_0xc95fe9];return _0x3761dd;};'use strict';var express=require(_0xe848('0x0'));var favicon=require('serve-favicon');var bodyParser=require('body-parser');var methodOverride=require(_0xe848('0x1'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xe848('0x2'));var path=require(_0xe848('0x3'));var passport=require('passport');var cors=require(_0xe848('0x4'));var moment=require('moment');var config=require(_0xe848('0x5'));var db=require(_0xe848('0x6'))['db'];exports[_0xe848('0x7')]=function(_0x1439e3){var _0x2bd53e=_0x1439e3[_0xe848('0x8')](_0xe848('0x9'));if(_0x2bd53e===_0xe848('0xa')){_0x1439e3[_0xe848('0xb')](_0xe848('0xc'),path['join'](config[_0xe848('0xd')],'public'));}if(_0x2bd53e===_0xe848('0xe')||_0x2bd53e===_0xe848('0xf')){_0x1439e3[_0xe848('0xb')](_0xe848('0xc'),path['join'](config['root'],_0xe848('0x10')));_0x1439e3['use'](errorHandler());}_0x1439e3[_0xe848('0xb')]('json\x20replacer',function(_0x4fcea7,_0x148588){if(this[_0x4fcea7]instanceof Date){_0x148588=this[_0x4fcea7][_0xe848('0x11')]()[_0xe848('0x12')]('.')[0x0]+'Z';}return _0x148588;});_0x1439e3[_0xe848('0x13')](express[_0xe848('0x14')](_0x1439e3['get'](_0xe848('0xc'))));_0x1439e3[_0xe848('0xb')](_0xe848('0x15'),config[_0xe848('0xd')]+_0xe848('0x16'));_0x1439e3['engine'](_0xe848('0x17'),require(_0xe848('0x18'))[_0xe848('0x19')]);_0x1439e3[_0xe848('0xb')](_0xe848('0x1a'),'html');_0x1439e3[_0xe848('0x13')](bodyParser[_0xe848('0x1b')]({'limit':_0xe848('0x1c'),'extended':!![]}));_0x1439e3[_0xe848('0x13')](bodyParser['json']({'limit':_0xe848('0x1c')}));_0x1439e3[_0xe848('0x13')](cors());_0x1439e3[_0xe848('0x13')](methodOverride());_0x1439e3[_0xe848('0x13')](cookieParser());_0x1439e3[_0xe848('0x13')](passport['initialize']());}; \ No newline at end of file +var _0x8250=['/server/views','engine','html','ejs','renderFile','urlencoded','50mb','json','initialize','express','body-parser','method-override','path','passport','cors','moment','../mysqldb','default','get','env','set','appPath','join','root','public','development','client','use','json\x20replacer','split','static'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0x8250,0x15e));var _0x0825=function(_0x350fe1,_0x53971c){_0x350fe1=_0x350fe1-0x0;var _0x8b53d6=_0x8250[_0x350fe1];return _0x8b53d6;};'use strict';var express=require(_0x0825('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x0825('0x1'));var methodOverride=require(_0x0825('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0x0825('0x3'));var passport=require(_0x0825('0x4'));var cors=require(_0x0825('0x5'));var moment=require(_0x0825('0x6'));var config=require('./environment');var db=require(_0x0825('0x7'))['db'];exports[_0x0825('0x8')]=function(_0x1b4bfc){var _0x264fbf=_0x1b4bfc[_0x0825('0x9')](_0x0825('0xa'));if(_0x264fbf==='production'){_0x1b4bfc[_0x0825('0xb')](_0x0825('0xc'),path[_0x0825('0xd')](config[_0x0825('0xe')],_0x0825('0xf')));}if(_0x264fbf===_0x0825('0x10')||_0x264fbf==='test'){_0x1b4bfc['set'](_0x0825('0xc'),path['join'](config[_0x0825('0xe')],_0x0825('0x11')));_0x1b4bfc[_0x0825('0x12')](errorHandler());}_0x1b4bfc[_0x0825('0xb')](_0x0825('0x13'),function(_0x5825e1,_0x1b2a3c){if(this[_0x5825e1]instanceof Date){_0x1b2a3c=this[_0x5825e1]['toISOString']()[_0x0825('0x14')]('.')[0x0]+'Z';}return _0x1b2a3c;});_0x1b4bfc[_0x0825('0x12')](express[_0x0825('0x15')](_0x1b4bfc['get']('appPath')));_0x1b4bfc[_0x0825('0xb')]('views',config['root']+_0x0825('0x16'));_0x1b4bfc[_0x0825('0x17')](_0x0825('0x18'),require(_0x0825('0x19'))[_0x0825('0x1a')]);_0x1b4bfc[_0x0825('0xb')]('view\x20engine',_0x0825('0x18'));_0x1b4bfc[_0x0825('0x12')](bodyParser[_0x0825('0x1b')]({'limit':_0x0825('0x1c'),'extended':!![]}));_0x1b4bfc[_0x0825('0x12')](bodyParser[_0x0825('0x1d')]({'limit':'50mb'}));_0x1b4bfc['use'](cors());_0x1b4bfc[_0x0825('0x12')](methodOverride());_0x1b4bfc['use'](cookieParser());_0x1b4bfc[_0x0825('0x12')](passport[_0x0825('0x1e')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 5906151..e0f260b 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 _0x5292=['mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','model','join','createHash','md5','update','digest','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','hex','substring','lodash','crypto','child_process','networkInterfaces','keys','filter','internal','concat','head'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5292,0xf7));var _0x2529=function(_0x4e668b,_0x35b443){_0x4e668b=_0x4e668b-0x0;var _0xba75aa=_0x5292[_0x4e668b];return _0xba75aa;};'use strict';var _=require(_0x2529('0x0'));var os=require('os');var crypto=require(_0x2529('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x2529('0x2'))['execSync'];function getInterfaces(){var _0x1540a9=[];var _0x2b088=os[_0x2529('0x3')]();var _0x228165=_['orderBy'](_[_0x2529('0x4')](_0x2b088));for(var _0x482dba=0x0;_0x482dba<_0x228165['length'];_0x482dba++){var _0x4e7a9e=_0x2b088[_0x228165[_0x482dba]][_0x2529('0x5')](function(_0x43cbef){return _0x43cbef['family']==='IPv4'&&_0x43cbef[_0x2529('0x6')]===![];});_0x1540a9=_0x1540a9[_0x2529('0x7')](_0x4e7a9e);}return _0x1540a9;}function getFirstInterface(){var _0x5850a7=_[_0x2529('0x8')](getInterfaces());return{'macAddress':_0x5850a7&&_0x5850a7[_0x2529('0x9')]?_0x5850a7[_0x2529('0x9')]:_0x2529('0xa'),'ipAddress':_0x5850a7&&_0x5850a7[_0x2529('0xb')]?_0x5850a7[_0x2529('0xb')]:_0x2529('0xc')};}exports[_0x2529('0xd')]=getFirstInterface;function getCPUhash(){var _0x4f3cf9=_[_0x2529('0xe')](os[_0x2529('0xf')]()['map'](function(_0xe333c9){return _0xe333c9[_0x2529('0x10')];}))[_0x2529('0x11')](':');return crypto[_0x2529('0x12')](_0x2529('0x13'))[_0x2529('0x14')](_0x4f3cf9)[_0x2529('0x15')]('hex');}exports[_0x2529('0x16')]=function(){switch(os[_0x2529('0x17')]()){case _0x2529('0x18'):return exec(_0x2529('0x19'),{'encoding':_0x2529('0x1a')})[_0x2529('0x1b')]('\x0d\x0a','');default:var _0x1a1ccc=getFirstInterface();var _0xf10dfb=getCPUhash();var _0x574975=_0xf10dfb+'|'+os[_0x2529('0x1c')]()+'|'+_0x1a1ccc['macAddress']+'|'+_0x1a1ccc[_0x2529('0x1d')];var _0x3d73c4=crypto[_0x2529('0x12')]('md5')['update'](_0x574975)[_0x2529('0x15')](_0x2529('0x1e'));return _0x3d73c4[_0x2529('0x1f')](0x0,0x8)+'-'+_0x3d73c4[_0x2529('0x1f')](0x8,0xc)+'-'+_0x3d73c4[_0x2529('0x1f')](0xc,0x10)+'-'+_0x3d73c4['substring'](0x10,0x14)+'-'+_0x3d73c4[_0x2529('0x1f')](0x14);}}; \ No newline at end of file +var _0xfd7b=['macAddress','ipAddress','substring','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','IPv4','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','createHash','digest','hex','getUuid','platform','replace','hostname'];(function(_0x5e0ea8,_0x466f30){var _0x9565e1=function(_0x40d846){while(--_0x40d846){_0x5e0ea8['push'](_0x5e0ea8['shift']());}};_0x9565e1(++_0x466f30);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xfd7b[_0x37bd26];return _0xe83dc4;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xbfd7('0x0'));var machine=require(_0xbfd7('0x1'));var exec=require(_0xbfd7('0x2'))[_0xbfd7('0x3')];function getInterfaces(){var _0x1ea39e=[];var _0x1f9ae1=os[_0xbfd7('0x4')]();var _0x221ad1=_[_0xbfd7('0x5')](_[_0xbfd7('0x6')](_0x1f9ae1));for(var _0x10a705=0x0;_0x10a705<_0x221ad1[_0xbfd7('0x7')];_0x10a705++){var _0x639dd4=_0x1f9ae1[_0x221ad1[_0x10a705]]['filter'](function(_0x38b1ef){return _0x38b1ef['family']===_0xbfd7('0x8')&&_0x38b1ef['internal']===![];});_0x1ea39e=_0x1ea39e[_0xbfd7('0x9')](_0x639dd4);}return _0x1ea39e;}function getFirstInterface(){var _0x2e69a5=_[_0xbfd7('0xa')](getInterfaces());return{'macAddress':_0x2e69a5&&_0x2e69a5[_0xbfd7('0xb')]?_0x2e69a5['mac']:_0xbfd7('0xc'),'ipAddress':_0x2e69a5&&_0x2e69a5[_0xbfd7('0xd')]?_0x2e69a5['address']:'127.0.0.1'};}exports[_0xbfd7('0xe')]=getFirstInterface;function getCPUhash(){var _0x45606b=_[_0xbfd7('0x5')](os[_0xbfd7('0xf')]()[_0xbfd7('0x10')](function(_0x559eca){return _0x559eca[_0xbfd7('0x11')];}))['join'](':');return crypto[_0xbfd7('0x12')]('md5')['update'](_0x45606b)[_0xbfd7('0x13')](_0xbfd7('0x14'));}exports[_0xbfd7('0x15')]=function(){switch(os[_0xbfd7('0x16')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xbfd7('0x17')]('\x0d\x0a','');default:var _0x115a34=getFirstInterface();var _0x33d900=getCPUhash();var _0x3e8754=_0x33d900+'|'+os[_0xbfd7('0x18')]()+'|'+_0x115a34[_0xbfd7('0x19')]+'|'+_0x115a34[_0xbfd7('0x1a')];var _0x614c9d=crypto[_0xbfd7('0x12')]('md5')['update'](_0x3e8754)[_0xbfd7('0x13')](_0xbfd7('0x14'));return _0x614c9d['substring'](0x0,0x8)+'-'+_0x614c9d['substring'](0x8,0xc)+'-'+_0x614c9d[_0xbfd7('0x1b')](0xc,0x10)+'-'+_0x614c9d['substring'](0x10,0x14)+'-'+_0x614c9d['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index f8d06c7..587a4c7 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 _0x82d8=['ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','data1','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','findOrCreate','spread','default','util','moment','pkginfo','../../mysqldb','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','GET','catch','createCipher','aes-256-ctr','update','utf8','base64','final','createDecipher','secrets','session','||FIELD||VALUE||\x0a','User','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','then'];(function(_0x4afa79,_0x22c6a4){var _0x274a72=function(_0x59956c){while(--_0x59956c){_0x4afa79['push'](_0x4afa79['shift']());}};_0x274a72(++_0x22c6a4);}(_0x82d8,0xff));var _0x882d=function(_0x431501,_0x46a38c){_0x431501=_0x431501-0x0;var _0x29ac6c=_0x82d8[_0x431501];return _0x29ac6c;};'use strict';var util=require(_0x882d('0x0'));var crypto=require('crypto');var moment=require(_0x882d('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x882d('0x2'))(module,'version');var db=require(_0x882d('0x3'))['db'];var config=require('../environment');var hardware=require('./hardware');var logger=require(_0x882d('0x4'))(_0x882d('0x5'));var jira=require(_0x882d('0x6'));var HOST=_0x882d('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0xb7539b){return new BPromise(function(_0x3c8b67,_0x4067a9){var _0x4ea710=util[_0x882d('0x8')](_0x882d('0x9'),HOST,_0xb7539b,module[_0x882d('0xa')]['version']);if(oldToken){_0x4ea710=util[_0x882d('0x8')](_0x882d('0xb'),HOST,_0xb7539b,module['exports'][_0x882d('0xc')],oldToken);}var _0xa2ca7f={'uri':_0x4ea710,'method':_0x882d('0xd'),'timeout':0xea60,'json':!![]};return rp(_0xa2ca7f)['then'](function(_0x287672){_0x3c8b67(_0x287672);})[_0x882d('0xe')](function(_0x18ce3e){_0x4067a9(_0x18ce3e);});});}function encryptDate(_0x3fffe0){var _0x3bd4d9=crypto[_0x882d('0xf')](_0x882d('0x10'),config['secrets']['session']);var _0x2a7091=_0x3bd4d9[_0x882d('0x11')](_0x3fffe0,_0x882d('0x12'),_0x882d('0x13'));_0x2a7091+=_0x3bd4d9[_0x882d('0x14')]('base64');return _0x2a7091;}function decryptDate(_0x3ce2b0){var _0x2d88e5=crypto[_0x882d('0x15')](_0x882d('0x10'),config[_0x882d('0x16')][_0x882d('0x17')]);var _0x46cfcc=_0x2d88e5[_0x882d('0x11')](_0x3ce2b0,_0x882d('0x13'),'utf8');_0x46cfcc+=_0x2d88e5['final'](_0x882d('0x12'));return _0x46cfcc;}function sendJiraAlert(_0x59aaec,_0x3e4cf5,_0x47d6a0){var _0x36ecd0=_0x882d('0x18');return db[_0x882d('0x19')]['findOne']({'where':{'role':_0x882d('0x1a')},'attributes':[_0x882d('0x1b'),_0x882d('0x1c')],'raw':!![]})['then'](function(_0x3420cd){ADMIN=_0x3420cd;_0x36ecd0+=_0x882d('0x1d')+_0x47d6a0+'|\x0a';_0x36ecd0+=_0x882d('0x1e')+_0x59aaec+'|\x0a';_0x36ecd0+=_0x882d('0x1f')+_0x3e4cf5+'|\x0a';_0x36ecd0+=_0x882d('0x20')+ADMIN[_0x882d('0x1b')]+'|\x0a';_0x36ecd0+=_0x882d('0x21')+ADMIN[_0x882d('0x1c')]+'|\x0a';return _0x36ecd0;})[_0x882d('0x22')](function(_0x57f1d4){var _0x37e6fa=hardware['getFirstInterface']()[_0x882d('0x23')];return jira[_0x882d('0x24')]({'key':_0x882d('0x25'),'summary':_0x882d('0x26'),'description':_0x57f1d4,'issuetype':_0x882d('0x27'),'oldToken':_0x59aaec,'newToken':_0x3e4cf5,'email':ADMIN['email'],'name':ADMIN[_0x882d('0x1b')],'reason':GRAY_PERIOD_REASON,'ip':_0x37e6fa});});}function manageLicense(_0x58ddb2,_0xb49a3c){var _0x3cb1e2=_0xb49a3c['get']({'plain':!![]});httpRequest(_0x58ddb2)['then'](function(_0x508003){if(oldToken){oldToken=undefined;}if(_0x508003['active']){if(!_0x3cb1e2[_0x882d('0x5')]&&_0x3cb1e2[_0x882d('0x5')]!=_0x508003[_0x882d('0x5')]||_0x3cb1e2[_0x882d('0x5')]&&_0x3cb1e2['data2']){logger[_0x882d('0x28')](_0x882d('0x29'));}if(_0x3cb1e2[_0x882d('0x5')]&&!_0x3cb1e2[_0x882d('0x2a')]&&_0x3cb1e2[_0x882d('0x5')]!=_0x508003['license']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3cb1e2[_0x882d('0x5')]&&!_0x3cb1e2[_0x882d('0x2a')]&&_0x3cb1e2[_0x882d('0x5')]==_0x508003['license']){return _0xb49a3c;}return _0xb49a3c[_0x882d('0x11')]({'data1':_0x58ddb2,'data2':null,'license':_0x508003[_0x882d('0x5')]});}else{if(_0x508003[_0x882d('0x5')]||_0x3cb1e2[_0x882d('0x5')]){if(!_0x3cb1e2[_0x882d('0x2a')]){if(_0x3cb1e2[_0x882d('0x2b')]==_0x58ddb2){GRAY_PERIOD_REASON='Disabled';logger[_0x882d('0x28')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x882d('0x2c');oldToken=_0x3cb1e2['data1'];logger[_0x882d('0x28')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3cb1e2[_0x882d('0x2b')],_0x58ddb2);}sendJiraAlert(_0x3cb1e2[_0x882d('0x2b')],_0x508003[_0x882d('0x2d')],GRAY_PERIOD_REASON);logger[_0x882d('0x28')](_0x882d('0x2e'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x882d('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0xb49a3c[_0x882d('0x11')]({'data2':encryptDate(moment()[_0x882d('0x8')](_0x882d('0x2f')))});}else{if(moment()[_0x882d('0x30')](decryptDate(_0x3cb1e2[_0x882d('0x2a')]),_0x882d('0x31'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x882d('0x2f')));return _0xb49a3c[_0x882d('0x11')]({'data1':_0x58ddb2,'data2':null,'license':null});}}}else{if(_0x3cb1e2[_0x882d('0x2b')]!=_0x58ddb2){logger[_0x882d('0x28')](_0x882d('0x32'),_0x3cb1e2['data1'],_0x58ddb2);return _0xb49a3c[_0x882d('0x11')]({'data1':_0x58ddb2,'data2':null,'license':null});}}}return _0xb49a3c;})[_0x882d('0x22')](function(_0xc412ec){_0xb49a3c=_0xc412ec;})[_0x882d('0xe')](function(_0x335dc0){logger[_0x882d('0x33')](_0x335dc0[_0x882d('0x34')]);})[_0x882d('0x35')](function(){setTimeout(function(){manageLicense(hardware[_0x882d('0x36')](),_0xb49a3c);},TIME);});}function defaultLicense(){var _0x56b3fa=hardware['getUuid']();if(_0x56b3fa){return db['License'][_0x882d('0x37')]({'where':{'id':0x1},'defaults':{'data1':_0x56b3fa}})[_0x882d('0x38')](function(_0x1aec6f,_0x6d04f){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x56b3fa);manageLicense(_0x56b3fa,_0x1aec6f);})[_0x882d('0xe')](function(_0x21dd0e){logger[_0x882d('0x33')](_0x21dd0e['message']);});}}exports[_0x882d('0x39')]=defaultLicense; \ No newline at end of file +var _0xdc91=['Motion\x20License\x20Alert','Alert','get','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','uuid','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','version','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','aes-256-ctr','secrets','update','final','base64','session','utf8','||FIELD||VALUE||\x0a','User','findOne','admin','|machineUuid|','|name|','fullname','|email|','email','getFirstInterface','ipAddress','openIssue'];(function(_0x18df6a,_0x3938b6){var _0x3b154d=function(_0x31cfc2){while(--_0x31cfc2){_0x18df6a['push'](_0x18df6a['shift']());}};_0x3b154d(++_0x3938b6);}(_0xdc91,0x8b));var _0x1dc9=function(_0x3e40e0,_0x4a3332){_0x3e40e0=_0x3e40e0-0x0;var _0x3816d1=_0xdc91[_0x3e40e0];return _0x3816d1;};'use strict';var util=require(_0x1dc9('0x0'));var crypto=require(_0x1dc9('0x1'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x1dc9('0x2'));var db=require(_0x1dc9('0x3'))['db'];var config=require(_0x1dc9('0x4'));var hardware=require(_0x1dc9('0x5'));var logger=require(_0x1dc9('0x6'))(_0x1dc9('0x7'));var jira=require(_0x1dc9('0x8'));var HOST=_0x1dc9('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x5ac058){return new BPromise(function(_0x2c6e6c,_0x25a752){var _0x316995=util[_0x1dc9('0xa')](_0x1dc9('0xb'),HOST,_0x5ac058,module[_0x1dc9('0xc')][_0x1dc9('0x2')]);if(oldToken){_0x316995=util[_0x1dc9('0xa')](_0x1dc9('0xd'),HOST,_0x5ac058,module[_0x1dc9('0xc')]['version'],oldToken);}var _0x356525={'uri':_0x316995,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x356525)[_0x1dc9('0xe')](function(_0x5b29c5){_0x2c6e6c(_0x5b29c5);})[_0x1dc9('0xf')](function(_0x41f1da){_0x25a752(_0x41f1da);});});}function encryptDate(_0x4402f2){var _0x123684=crypto['createCipher'](_0x1dc9('0x10'),config[_0x1dc9('0x11')]['session']);var _0x41c335=_0x123684[_0x1dc9('0x12')](_0x4402f2,'utf8','base64');_0x41c335+=_0x123684[_0x1dc9('0x13')](_0x1dc9('0x14'));return _0x41c335;}function decryptDate(_0x38ee59){var _0x2c94b1=crypto['createDecipher']('aes-256-ctr',config[_0x1dc9('0x11')][_0x1dc9('0x15')]);var _0x5cccb9=_0x2c94b1[_0x1dc9('0x12')](_0x38ee59,_0x1dc9('0x14'),_0x1dc9('0x16'));_0x5cccb9+=_0x2c94b1[_0x1dc9('0x13')](_0x1dc9('0x16'));return _0x5cccb9;}function sendJiraAlert(_0x1e845a,_0x2442d0,_0x1e4aca){var _0x1386c9=_0x1dc9('0x17');return db[_0x1dc9('0x18')][_0x1dc9('0x19')]({'where':{'role':_0x1dc9('0x1a')},'attributes':['fullname','email'],'raw':!![]})[_0x1dc9('0xe')](function(_0x4d3818){ADMIN=_0x4d3818;_0x1386c9+='|reason|'+_0x1e4aca+'|\x0a';_0x1386c9+='|uuid|'+_0x1e845a+'|\x0a';_0x1386c9+=_0x1dc9('0x1b')+_0x2442d0+'|\x0a';_0x1386c9+=_0x1dc9('0x1c')+ADMIN[_0x1dc9('0x1d')]+'|\x0a';_0x1386c9+=_0x1dc9('0x1e')+ADMIN[_0x1dc9('0x1f')]+'|\x0a';return _0x1386c9;})[_0x1dc9('0xe')](function(_0x2b1ff8){var _0x48dd9c=hardware[_0x1dc9('0x20')]()[_0x1dc9('0x21')];return jira[_0x1dc9('0x22')]({'key':'MOTLICENSE','summary':_0x1dc9('0x23'),'description':_0x2b1ff8,'issuetype':_0x1dc9('0x24'),'oldToken':_0x1e845a,'newToken':_0x2442d0,'email':ADMIN[_0x1dc9('0x1f')],'name':ADMIN[_0x1dc9('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x48dd9c});});}function manageLicense(_0x2dfe03,_0x476111){var _0x179498=_0x476111[_0x1dc9('0x25')]({'plain':!![]});httpRequest(_0x2dfe03)[_0x1dc9('0xe')](function(_0x59f588){if(oldToken){oldToken=undefined;}if(_0x59f588['active']){if(!_0x179498[_0x1dc9('0x7')]&&_0x179498[_0x1dc9('0x7')]!=_0x59f588[_0x1dc9('0x7')]||_0x179498[_0x1dc9('0x7')]&&_0x179498[_0x1dc9('0x26')]){logger[_0x1dc9('0x27')](_0x1dc9('0x28'));}if(_0x179498[_0x1dc9('0x7')]&&!_0x179498[_0x1dc9('0x26')]&&_0x179498['license']!=_0x59f588[_0x1dc9('0x7')]){logger[_0x1dc9('0x27')](_0x1dc9('0x29'));}if(_0x179498[_0x1dc9('0x7')]&&!_0x179498[_0x1dc9('0x26')]&&_0x179498[_0x1dc9('0x7')]==_0x59f588['license']){return _0x476111;}return _0x476111['update']({'data1':_0x2dfe03,'data2':null,'license':_0x59f588[_0x1dc9('0x7')]});}else{if(_0x59f588[_0x1dc9('0x7')]||_0x179498['license']){if(!_0x179498[_0x1dc9('0x26')]){if(_0x179498[_0x1dc9('0x2a')]==_0x2dfe03){GRAY_PERIOD_REASON=_0x1dc9('0x2b');logger['info'](_0x1dc9('0x2c'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x179498[_0x1dc9('0x2a')];logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x179498[_0x1dc9('0x2a')],_0x2dfe03);}sendJiraAlert(_0x179498[_0x1dc9('0x2a')],_0x59f588[_0x1dc9('0x2d')],GRAY_PERIOD_REASON);logger[_0x1dc9('0x27')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x1dc9('0x2e')](),moment()['format'](_0x1dc9('0x2f')));return _0x476111[_0x1dc9('0x12')]({'data2':encryptDate(moment()[_0x1dc9('0xa')](_0x1dc9('0x2f')))});}else{if(moment()[_0x1dc9('0x30')](decryptDate(_0x179498[_0x1dc9('0x26')]),_0x1dc9('0x31'))>DAYS){logger[_0x1dc9('0x27')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x1dc9('0x2f')));return _0x476111[_0x1dc9('0x12')]({'data1':_0x2dfe03,'data2':null,'license':null});}}}else{if(_0x179498[_0x1dc9('0x2a')]!=_0x2dfe03){logger[_0x1dc9('0x27')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x179498[_0x1dc9('0x2a')],_0x2dfe03);return _0x476111['update']({'data1':_0x2dfe03,'data2':null,'license':null});}}}return _0x476111;})[_0x1dc9('0xe')](function(_0x19fc87){_0x476111=_0x19fc87;})[_0x1dc9('0xf')](function(_0x27e309){logger[_0x1dc9('0x32')](_0x27e309[_0x1dc9('0x33')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x1dc9('0x34')](),_0x476111);},TIME);});}function defaultLicense(){var _0x17bb3c=hardware[_0x1dc9('0x34')]();if(_0x17bb3c){return db[_0x1dc9('0x35')][_0x1dc9('0x36')]({'where':{'id':0x1},'defaults':{'data1':_0x17bb3c}})[_0x1dc9('0x37')](function(_0x4c2386,_0xff1a45){logger[_0x1dc9('0x27')](_0x1dc9('0x38'),_0x17bb3c);manageLicense(_0x17bb3c,_0x4c2386);})[_0x1dc9('0xf')](function(_0x5af473){logger[_0x1dc9('0x32')](_0x5af473[_0x1dc9('0x33')]);});}}exports[_0x1dc9('0x39')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index ed2faab..17efcdd 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 _0xcff4=['final','parse','demo','uuid','machineUuid','getUuid','secrets','session','gray','deadline','add','days','grayReason','disabled','2027-01-01T00:00:00.000Z','License','find','defaults','then','checkLicense','crypto','util','lodash','moment','./hardware','../environment','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8'];(function(_0x225e7c,_0x4f12b9){var _0x3ccc2a=function(_0x3f1cff){while(--_0x3f1cff){_0x225e7c['push'](_0x225e7c['shift']());}};_0x3ccc2a(++_0x4f12b9);}(_0xcff4,0x11e));var _0x4cff=function(_0x10c643,_0x438025){_0x10c643=_0x10c643-0x0;var _0x47596d=_0xcff4[_0x10c643];return _0x47596d;};'use strict';var crypto=require(_0x4cff('0x0'));var util=require(_0x4cff('0x1'));var _=require(_0x4cff('0x2'));var moment=require(_0x4cff('0x3'));var hardware=require(_0x4cff('0x4'));var config=require(_0x4cff('0x5'));var db=require('../../mysqldb')['db'];function checkLicense(_0x20cc97,_0x47a41f){if(_0x20cc97){try{var _0x34a2f1=_0x47a41f||_0x20cc97[_0x4cff('0x6')];if(_[_0x4cff('0x7')](_0x34a2f1)){throw new Error(_0x4cff('0x8'));}var _0x355206=_0x20cc97[_0x4cff('0x9')];var _0x4b4880=_0x20cc97[_0x4cff('0xa')];var _0x85a634=_0x355206[_0x4cff('0xb')]('-')[0x4];var _0x2f475c=_0x355206[_0x4cff('0xb')]('-')[0x0];var _0x126da4=crypto[_0x4cff('0xc')](_0x4cff('0xd'),util[_0x4cff('0xe')](_0x4cff('0xf'),_0x85a634,_0x355206,_0x2f475c));var _0x5f42a9=_0x126da4['update'](_0x34a2f1,_0x4cff('0x10'),_0x4cff('0x11'));_0x5f42a9+=_0x126da4[_0x4cff('0x12')]('utf8');var _0x21057c=JSON[_0x4cff('0x13')](_0x5f42a9);_0x21057c[_0x4cff('0x14')]=![];_0x21057c[_0x4cff('0x15')]=_0x355206;_0x21057c[_0x4cff('0x16')]=hardware[_0x4cff('0x17')]();if(_0x4b4880){var _0x3ac6be=crypto[_0x4cff('0xc')](_0x4cff('0xd'),config[_0x4cff('0x18')][_0x4cff('0x19')]);var _0x3a141d=_0x3ac6be['update'](_0x4b4880,_0x4cff('0x10'),'utf8');_0x3a141d+=_0x3ac6be[_0x4cff('0x12')](_0x4cff('0x11'));_0x21057c[_0x4cff('0x1a')]=_0x3a141d;_0x21057c[_0x4cff('0x1b')]=moment(_0x3a141d)[_0x4cff('0x1c')](0x7,_0x4cff('0x1d'))[_0x4cff('0xe')]();_0x21057c[_0x4cff('0x1e')]=_0x21057c['uuid']!=_0x21057c[_0x4cff('0x16')]?'changed':_0x4cff('0x1f');}return _0x21057c;}catch(_0xa3086c){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4cff('0x20'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x20cc97['data1'],'machineUuid':hardware[_0x4cff('0x17')](),'message':_0xa3086c['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4cff('0x20'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x20cc97[_0x4cff('0x9')],'machineUuid':hardware[_0x4cff('0x17')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x3e059b){return db[_0x4cff('0x21')][_0x4cff('0x22')](_[_0x4cff('0x23')](_0x3e059b,{'raw':!![],'where':{'id':0x1}}))[_0x4cff('0x24')](function(_0x175c80){return checkLicense(_0x175c80,null);});};exports[_0x4cff('0x25')]=checkLicense; \ No newline at end of file +var _0xd7e7=['crypto','util','lodash','moment','./hardware','../environment','license','License\x20key\x20value\x20not\x20found','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','parse','demo','uuid','machineUuid','getUuid','session','base64','gray','deadline','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','data1','message','Demo\x20license','find','then','checkLicense'];(function(_0x5813b1,_0xbeeba9){var _0x4ea5cd=function(_0x2e972c){while(--_0x2e972c){_0x5813b1['push'](_0x5813b1['shift']());}};_0x4ea5cd(++_0xbeeba9);}(_0xd7e7,0x10a));var _0x7d7e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd7e7[_0xfae23b];return _0x200640;};'use strict';var crypto=require(_0x7d7e('0x0'));var util=require(_0x7d7e('0x1'));var _=require(_0x7d7e('0x2'));var moment=require(_0x7d7e('0x3'));var hardware=require(_0x7d7e('0x4'));var config=require(_0x7d7e('0x5'));var db=require('../../mysqldb')['db'];function checkLicense(_0x5e0847,_0x4bf67a){if(_0x5e0847){try{var _0x45f153=_0x4bf67a||_0x5e0847[_0x7d7e('0x6')];if(_['isEmpty'](_0x45f153)){throw new Error(_0x7d7e('0x7'));}var _0x1b4acf=_0x5e0847['data1'];var _0x15ff0b=_0x5e0847[_0x7d7e('0x8')];var _0x184d33=_0x1b4acf[_0x7d7e('0x9')]('-')[0x4];var _0x537d89=_0x1b4acf[_0x7d7e('0x9')]('-')[0x0];var _0x568ddc=crypto[_0x7d7e('0xa')](_0x7d7e('0xb'),util[_0x7d7e('0xc')](_0x7d7e('0xd'),_0x184d33,_0x1b4acf,_0x537d89));var _0x576ceb=_0x568ddc[_0x7d7e('0xe')](_0x45f153,'base64',_0x7d7e('0xf'));_0x576ceb+=_0x568ddc[_0x7d7e('0x10')](_0x7d7e('0xf'));var _0xd1919d=JSON[_0x7d7e('0x11')](_0x576ceb);_0xd1919d[_0x7d7e('0x12')]=![];_0xd1919d[_0x7d7e('0x13')]=_0x1b4acf;_0xd1919d[_0x7d7e('0x14')]=hardware[_0x7d7e('0x15')]();if(_0x15ff0b){var _0x121f3f=crypto[_0x7d7e('0xa')]('aes-256-ctr',config['secrets'][_0x7d7e('0x16')]);var _0x35af10=_0x121f3f[_0x7d7e('0xe')](_0x15ff0b,_0x7d7e('0x17'),'utf8');_0x35af10+=_0x121f3f['final'](_0x7d7e('0xf'));_0xd1919d[_0x7d7e('0x18')]=_0x35af10;_0xd1919d[_0x7d7e('0x19')]=moment(_0x35af10)['add'](0x7,_0x7d7e('0x1a'))['format']();_0xd1919d[_0x7d7e('0x1b')]=_0xd1919d['uuid']!=_0xd1919d['machineUuid']?_0x7d7e('0x1c'):_0x7d7e('0x1d');}return _0xd1919d;}catch(_0x313507){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7d7e('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7d7e('0x1f'),'uuid':_0x5e0847[_0x7d7e('0x20')],'machineUuid':hardware[_0x7d7e('0x15')](),'message':_0x313507[_0x7d7e('0x21')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7d7e('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7d7e('0x22'),'uuid':_0x5e0847[_0x7d7e('0x20')],'machineUuid':hardware[_0x7d7e('0x15')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x285b46){return db['License'][_0x7d7e('0x23')](_['defaults'](_0x285b46,{'raw':!![],'where':{'id':0x1}}))[_0x7d7e('0x24')](function(_0x1b4806){return checkLicense(_0x1b4806,null);});};exports[_0x7d7e('0x25')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index b175c96..d72ef82 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 _0x4e24=['exports','http://localhost:9000','secret'];(function(_0x982f12,_0x2877a6){var _0x340bef=function(_0xf07c50){while(--_0xf07c50){_0x982f12['push'](_0x982f12['shift']());}};_0x340bef(++_0x2877a6);}(_0x4e24,0x1ef));var _0x44e2=function(_0x5ea137,_0x7bdeac){_0x5ea137=_0x5ea137-0x0;var _0x2621b1=_0x4e24[_0x5ea137];return _0x2621b1;};'use strict';module[_0x44e2('0x0')]={'DOMAIN':_0x44e2('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x44e2('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x1cf1=['app-id','secret','exports','myappanuglar-secret'];(function(_0x23c459,_0x323a1a){var _0x5e7e89=function(_0x52dea8){while(--_0x52dea8){_0x23c459['push'](_0x23c459['shift']());}};_0x5e7e89(++_0x323a1a);}(_0x1cf1,0x10e));var _0x11cf=function(_0x184b9d,_0x62ad25){_0x184b9d=_0x184b9d-0x0;var _0x3c7715=_0x1cf1[_0x184b9d];return _0x3c7715;};'use strict';module[_0x11cf('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x11cf('0x1'),'GOOGLE_ID':_0x11cf('0x2'),'GOOGLE_SECRET':_0x11cf('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index a2cfb95..4339de9 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc126=['transports','info','Console','debugLevel','moment','winston','util','path','INFO','/var','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','message','exports','File','%s-%s','error'];(function(_0x51904f,_0x439694){var _0x24dc27=function(_0x3046b1){while(--_0x3046b1){_0x51904f['push'](_0x51904f['shift']());}};_0x24dc27(++_0x439694);}(_0xc126,0xf4));var _0x6c12=function(_0x491198,_0x2f3a44){_0x491198=_0x491198-0x0;var _0x40bc08=_0xc126[_0x491198];return _0x40bc08;};'use strict';var moment=require(_0x6c12('0x0'));var winston=require(_0x6c12('0x1'));var util=require(_0x6c12('0x2'));var path=require(_0x6c12('0x3'));var debugLevel=_0x6c12('0x4');function filename(_0x3063bc,_0x1232c9){return path['join'](_0x6c12('0x5'),'log',_0x6c12('0x6'),util[_0x6c12('0x7')]('%s-%s.log',_0x3063bc,_0x1232c9));}function formatter(_0x40c2b4,_0x44c2ba){return util['format'](_0x6c12('0x8'),moment()[_0x6c12('0x7')](_0x6c12('0x9')),_0x44c2ba[_0x6c12('0xa')]['toUpperCase'](),_0x40c2b4,_0x44c2ba[_0x6c12('0xb')]);}module[_0x6c12('0xc')]=function(_0x18e455){return new winston['Logger']({'transports':[new winston['transports'][(_0x6c12('0xd'))]({'name':util['format'](_0x6c12('0xe'),_0x18e455,_0x6c12('0xf')),'filename':filename(_0x18e455,_0x6c12('0xf')),'level':_0x6c12('0xf'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x20e66b){return formatter(_0x18e455,_0x20e66b);}}),new winston[(_0x6c12('0x10'))][(_0x6c12('0xd'))]({'name':util[_0x6c12('0x7')]('%s-%s',_0x18e455,_0x6c12('0x11')),'filename':filename(_0x18e455,_0x6c12('0x11')),'level':_0x6c12('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x564e42){return formatter(_0x18e455,_0x564e42);}}),new winston[(_0x6c12('0x10'))][(_0x6c12('0x12'))]({'level':process['env'][_0x6c12('0x13')]||debugLevel,'json':![],'formatter':function(_0x4c067b){return formatter(_0x18e455,_0x4c067b);}})]});}; \ No newline at end of file +var _0x9de3=['exports','Logger','transports','File','%s-%s','error','Console','env','moment','winston','path','join','/var','xcally','format','%s-%s.log','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x6bf16d,_0x7c0cd1){var _0x32a608=function(_0x2222da){while(--_0x2222da){_0x6bf16d['push'](_0x6bf16d['shift']());}};_0x32a608(++_0x7c0cd1);}(_0x9de3,0x8d));var _0x39de=function(_0x30be26,_0x19b327){_0x30be26=_0x30be26-0x0;var _0x54b008=_0x9de3[_0x30be26];return _0x54b008;};'use strict';var moment=require(_0x39de('0x0'));var winston=require(_0x39de('0x1'));var util=require('util');var path=require(_0x39de('0x2'));var debugLevel='INFO';function filename(_0x44fa3a,_0x1e6f34){return path[_0x39de('0x3')](_0x39de('0x4'),'log',_0x39de('0x5'),util[_0x39de('0x6')](_0x39de('0x7'),_0x44fa3a,_0x1e6f34));}function formatter(_0x21234f,_0x528a75){return util[_0x39de('0x6')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0x39de('0x8')),_0x528a75[_0x39de('0x9')][_0x39de('0xa')](),_0x21234f,_0x528a75['message']);}module[_0x39de('0xb')]=function(_0x1d8589){return new winston[(_0x39de('0xc'))]({'transports':[new winston[(_0x39de('0xd'))][(_0x39de('0xe'))]({'name':util[_0x39de('0x6')](_0x39de('0xf'),_0x1d8589,_0x39de('0x10')),'filename':filename(_0x1d8589,_0x39de('0x10')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xa0440c){return formatter(_0x1d8589,_0xa0440c);}}),new winston[(_0x39de('0xd'))][(_0x39de('0xe'))]({'name':util[_0x39de('0x6')](_0x39de('0xf'),_0x1d8589,'info'),'filename':filename(_0x1d8589,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5ac8c7){return formatter(_0x1d8589,_0x5ac8c7);}}),new winston['transports'][(_0x39de('0x11'))]({'level':process[_0x39de('0x12')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x38a5e2){return formatter(_0x1d8589,_0x38a5e2);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index a92ee2b..8d5c4db 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 _0x4f09=['join','../../services/express/index.js','../../services/ami/index.js','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4f09,0x18b));var _0x94f0=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x4f09[_0x368fb9];return _0x4892fb;};'use strict';var path=require(_0x94f0('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x94f0('0x1')](__dirname,_0x94f0('0x2'))},{'name':'ami','script':path[_0x94f0('0x1')](__dirname,_0x94f0('0x3'))},{'name':'agi','script':path['join'](__dirname,_0x94f0('0x4'))},{'name':_0x94f0('0x5'),'script':path[_0x94f0('0x1')](__dirname,'../../services/email/index.js')},{'name':_0x94f0('0x6'),'script':path['join'](__dirname,_0x94f0('0x7'))},{'name':_0x94f0('0x8'),'script':path[_0x94f0('0x1')](__dirname,_0x94f0('0x9'))}]};module[_0x94f0('0xa')]=config; \ No newline at end of file +var _0xcf33=['express','join','../../services/express/index.js','agi','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','exports','path'];(function(_0x214104,_0x25746d){var _0x2a28a0=function(_0x1d8a58){while(--_0x1d8a58){_0x214104['push'](_0x214104['shift']());}};_0x2a28a0(++_0x25746d);}(_0xcf33,0x10d));var _0x3cf3=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xcf33[_0xaa0309];return _0x5de7ce;};'use strict';var path=require(_0x3cf3('0x0'));var os=require('os');var config={'apps':[{'name':_0x3cf3('0x1'),'script':path[_0x3cf3('0x2')](__dirname,_0x3cf3('0x3'))},{'name':'ami','script':path[_0x3cf3('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x3cf3('0x4'),'script':path[_0x3cf3('0x2')](__dirname,_0x3cf3('0x5'))},{'name':'email','script':path[_0x3cf3('0x2')](__dirname,_0x3cf3('0x6'))},{'name':'routing','script':path[_0x3cf3('0x2')](__dirname,_0x3cf3('0x7'))},{'name':'xdr','script':path[_0x3cf3('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x3cf3('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 802d045..c90c020 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 _0xaf79=['bluebird','./config','connect','start','then','disconnect','stop','restart','list','describe','delete','dump','saved'];(function(_0x40733f,_0x1e8c0c){var _0x2ba071=function(_0x138bc4){while(--_0x138bc4){_0x40733f['push'](_0x40733f['shift']());}};_0x2ba071(++_0x1e8c0c);}(_0xaf79,0x82));var _0x9af7=function(_0x1a10ec,_0x1259ee){_0x1a10ec=_0x1a10ec-0x0;var _0x3c5337=_0xaf79[_0x1a10ec];return _0x3c5337;};'use strict';var pm2=require('pm2');var BPromise=require(_0x9af7('0x0'));var config=require(_0x9af7('0x1'));function connect(){return new BPromise(function(_0x3cd2b4,_0x19a247){return pm2[_0x9af7('0x2')](function(_0x216de5){if(_0x216de5){return _0x19a247(_0x216de5);}return _0x3cd2b4('connected');});});};exports[_0x9af7('0x3')]=function(_0xfa2a43){return connect()[_0x9af7('0x4')](function(){return new BPromise(function(_0x114853,_0x52cd01){return pm2['start'](_0xfa2a43,function(_0xbe8dda,_0x1a1abb){if(_0xbe8dda){return _0x52cd01(_0xbe8dda);}pm2[_0x9af7('0x5')]();return _0x114853(_0x1a1abb);});});});};exports[_0x9af7('0x6')]=function(_0x4d7d2f){return connect()[_0x9af7('0x4')](function(){return new BPromise(function(_0xa318a5,_0x3203dd){return pm2[_0x9af7('0x6')](_0x4d7d2f,function(_0x1371cd,_0x6df97b){if(_0x1371cd){return _0x3203dd(_0x1371cd);}pm2[_0x9af7('0x5')]();return _0xa318a5(_0x6df97b);});});});};exports['restart']=function(_0x3615b8){return connect()[_0x9af7('0x4')](function(){return new BPromise(function(_0x1a9473,_0x45c53d){return pm2[_0x9af7('0x7')](_0x3615b8,function(_0x1f76b3,_0x70c042){if(_0x1f76b3){return _0x45c53d(_0x1f76b3);}pm2[_0x9af7('0x5')]();return _0x1a9473(_0x70c042);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x420931,_0x3f7b70){return pm2[_0x9af7('0x8')](function(_0x264344,_0x408492){if(_0x264344){return _0x3f7b70(_0x264344);}pm2[_0x9af7('0x5')]();return _0x420931(_0x408492);});});});};exports[_0x9af7('0x9')]=function(_0x539cd5){return connect()['then'](function(){return new BPromise(function(_0x471c1a,_0x197f67){return pm2['describe'](_0x539cd5,function(_0x229e2f,_0x19f720){if(_0x229e2f){return _0x197f67(_0x229e2f);}pm2[_0x9af7('0x5')]();return _0x471c1a(_0x19f720);});});});};exports[_0x9af7('0xa')]=function(_0x19f539){return connect()[_0x9af7('0x4')](function(){return new BPromise(function(_0x549946,_0x5dc36c){return pm2['delete'](_0x19f539,function(_0x3da4ec,_0x8b1434){if(_0x3da4ec){return _0x5dc36c(_0x3da4ec);}pm2['disconnect']();return _0x549946(_0x8b1434);});});});};exports[_0x9af7('0xb')]=function(){return connect()[_0x9af7('0x4')](function(){return new BPromise(function(_0x164cdb,_0x1302f9){return pm2['dump'](function(_0x5cf9fc){if(_0x5cf9fc){return _0x1302f9(_0x5cf9fc);}return _0x164cdb(_0x9af7('0xc'));});});});}; \ No newline at end of file +var _0x847f=['disconnect','stop','restart','then','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start'];(function(_0x42b782,_0xee8501){var _0x57ddd7=function(_0x1baed6){while(--_0x1baed6){_0x42b782['push'](_0x42b782['shift']());}};_0x57ddd7(++_0xee8501);}(_0x847f,0x182));var _0xf847=function(_0x426b63,_0x3b4c07){_0x426b63=_0x426b63-0x0;var _0x1adcc0=_0x847f[_0x426b63];return _0x1adcc0;};'use strict';var pm2=require(_0xf847('0x0'));var BPromise=require(_0xf847('0x1'));var config=require(_0xf847('0x2'));function connect(){return new BPromise(function(_0x4a346f,_0x19a000){return pm2[_0xf847('0x3')](function(_0x1496e8){if(_0x1496e8){return _0x19a000(_0x1496e8);}return _0x4a346f(_0xf847('0x4'));});});};exports[_0xf847('0x5')]=function(_0x5d5964){return connect()['then'](function(){return new BPromise(function(_0x10470f,_0x1cf273){return pm2['start'](_0x5d5964,function(_0x5e7c87,_0x491c65){if(_0x5e7c87){return _0x1cf273(_0x5e7c87);}pm2[_0xf847('0x6')]();return _0x10470f(_0x491c65);});});});};exports[_0xf847('0x7')]=function(_0x18d9a7){return connect()['then'](function(){return new BPromise(function(_0x456ad8,_0x1e5a6e){return pm2[_0xf847('0x7')](_0x18d9a7,function(_0x49bb44,_0x26acc8){if(_0x49bb44){return _0x1e5a6e(_0x49bb44);}pm2['disconnect']();return _0x456ad8(_0x26acc8);});});});};exports[_0xf847('0x8')]=function(_0x2a9424){return connect()[_0xf847('0x9')](function(){return new BPromise(function(_0x47c130,_0x1fc016){return pm2['restart'](_0x2a9424,function(_0x17c044,_0x3a29bb){if(_0x17c044){return _0x1fc016(_0x17c044);}pm2[_0xf847('0x6')]();return _0x47c130(_0x3a29bb);});});});};exports[_0xf847('0xa')]=function(){return connect()[_0xf847('0x9')](function(){return new BPromise(function(_0x10e2d1,_0x34bdfc){return pm2[_0xf847('0xa')](function(_0x2c2a7b,_0x2b2c1e){if(_0x2c2a7b){return _0x34bdfc(_0x2c2a7b);}pm2[_0xf847('0x6')]();return _0x10e2d1(_0x2b2c1e);});});});};exports[_0xf847('0xb')]=function(_0x6428e){return connect()['then'](function(){return new BPromise(function(_0x1399e8,_0x10abe3){return pm2[_0xf847('0xb')](_0x6428e,function(_0x4bd4f2,_0x4e8201){if(_0x4bd4f2){return _0x10abe3(_0x4bd4f2);}pm2[_0xf847('0x6')]();return _0x1399e8(_0x4e8201);});});});};exports[_0xf847('0xc')]=function(_0x495012){return connect()[_0xf847('0x9')](function(){return new BPromise(function(_0xa7f88d,_0x34f349){return pm2[_0xf847('0xc')](_0x495012,function(_0x4299a4,_0x240ab0){if(_0x4299a4){return _0x34f349(_0x4299a4);}pm2['disconnect']();return _0xa7f88d(_0x240ab0);});});});};exports['dump']=function(){return connect()[_0xf847('0x9')](function(){return new BPromise(function(_0x25adfc,_0x54f2cb){return pm2[_0xf847('0xd')](function(_0x59e4bf){if(_0x59e4bf){return _0x54f2cb(_0x59e4bf);}return _0x25adfc('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a029b69..f69aa12 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 _0x6f62=['then','ChatInteraction','subtract','update','system','length','chatInteraction:update','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','localhost','socket.io-emitter','find','chatTimeout'];(function(_0x1d848e,_0x3cb976){var _0x3b7ceb=function(_0x37351b){while(--_0x37351b){_0x1d848e['push'](_0x1d848e['shift']());}};_0x3b7ceb(++_0x3cb976);}(_0x6f62,0x1ee));var _0x26f6=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x6f62[_0x429948];return _0x35d5d1;};'use strict';var _=require(_0x26f6('0x0'));var moment=require(_0x26f6('0x1'));var Redis=require(_0x26f6('0x2'));var db=require(_0x26f6('0x3'))['db'];var config=require(_0x26f6('0x4'));config[_0x26f6('0x5')]=_['defaults'](config['redis'],{'host':_0x26f6('0x6'),'port':0x18eb});var io=require(_0x26f6('0x7'))(new Redis(config[_0x26f6('0x5')]));function closeInteractions(){var _0x127759=0x0;var _0x3e3ce4=[];return db['Setting'][_0x26f6('0x8')]({'raw':!![],'attributes':['id',_0x26f6('0x9')],'where':{'id':0x1}})[_0x26f6('0xa')](function(_0x3c50e5){_0x127759=_0x3c50e5['chatTimeout'];if(_0x127759){return db[_0x26f6('0xb')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x26f6('0xc')](_0x3c50e5[_0x26f6('0x9')],'minutes')}}});}else{return[];}})[_0x26f6('0xa')](function(_0x43b60d){_0x3e3ce4=_0x43b60d;if(_0x127759){return db[_0x26f6('0xb')][_0x26f6('0xd')]({'closeReason':_0x26f6('0xe'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_['map'](_0x3e3ce4||[],'id')}});}})[_0x26f6('0xa')](function(_0x21ea41){for(var _0x304564=0x0;_0x304564<_0x3e3ce4[_0x26f6('0xf')];_0x304564++){io['emit'](_0x26f6('0x10'),{'id':_0x3e3ce4[_0x304564]['id'],'closed':!![]});}})['catch'](function(_0x1601ee){console['error'](_0x1601ee);});}exports[_0x26f6('0x11')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8f22=['find','chatTimeout','then','findAll','lastMsgAt','subtract','ChatInteraction','update','system','YYYY-MM-DD\x20HH:mm:ss','emit','error','start','moment','../../mysqldb','redis','localhost','socket.io-emitter'];(function(_0x2e5917,_0x5e9fc8){var _0x3ff172=function(_0x194074){while(--_0x194074){_0x2e5917['push'](_0x2e5917['shift']());}};_0x3ff172(++_0x5e9fc8);}(_0x8f22,0x163));var _0x28f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8f22[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var moment=require(_0x28f2('0x0'));var Redis=require('ioredis');var db=require(_0x28f2('0x1'))['db'];var config=require('../../config/environment');config[_0x28f2('0x2')]=_['defaults'](config[_0x28f2('0x2')],{'host':_0x28f2('0x3'),'port':0x18eb});var io=require(_0x28f2('0x4'))(new Redis(config[_0x28f2('0x2')]));function closeInteractions(){var _0x4e6fd5=0x0;var _0x3e69c6=[];return db['Setting'][_0x28f2('0x5')]({'raw':!![],'attributes':['id',_0x28f2('0x6')],'where':{'id':0x1}})[_0x28f2('0x7')](function(_0x46526a){_0x4e6fd5=_0x46526a[_0x28f2('0x6')];if(_0x4e6fd5){return db['ChatInteraction'][_0x28f2('0x8')]({'raw':!![],'attributes':['id',_0x28f2('0x9')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x28f2('0xa')](_0x46526a[_0x28f2('0x6')],'minutes')}}});}else{return[];}})['then'](function(_0x4c498a){_0x3e69c6=_0x4c498a;if(_0x4e6fd5){return db[_0x28f2('0xb')][_0x28f2('0xc')]({'closeReason':_0x28f2('0xd'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x28f2('0xe'))},{'where':{'id':_['map'](_0x3e69c6||[],'id')}});}})[_0x28f2('0x7')](function(_0x3be0be){for(var _0x43c21d=0x0;_0x43c21d<_0x3e69c6['length'];_0x43c21d++){io[_0x28f2('0xf')]('chatInteraction:update',{'id':_0x3e69c6[_0x43c21d]['id'],'closed':!![]});}})['catch'](function(_0x513d27){console[_0x28f2('0x10')](_0x513d27);});}exports[_0x28f2('0x11')]=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 2398db3..8980bc8 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 _0xeb7e=['pass','format','\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','basename','extname','zip','status','Sent','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','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','SendMail','then','error','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','length','exists','stop','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','update\x20cron','catch','run','path','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','host','port','secure','authentication','user'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xeb7e,0x1f2));var _0xeeb7=function(_0x325834,_0x2c65ab){_0x325834=_0x325834-0x0;var _0x25f3d0=_0xeb7e[_0x325834];return _0x25f3d0;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xeeb7('0x0'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0xeeb7('0x1'));var jayson=require('jayson/promise');var BPromise=require(_0xeeb7('0x2'));var logger=require(_0xeeb7('0x3'))(_0xeeb7('0x4'));var db=require(_0xeeb7('0x5'))['db'];var analyticCustomReportController=require(_0xeeb7('0x6'));var analyticDefaultReportController=require(_0xeeb7('0x7'));var client=jayson[_0xeeb7('0x8')][_0xeeb7('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x51b684,_0x352ab5){return function(){logger['info'](_0xeeb7('0xa'),_0x51b684['email']);var _0x1ee57e=!![];var _0x444dee={'tls':{'rejectUnauthorized':![]}};if(_0x51b684[_0xeeb7('0xb')][_0xeeb7('0xc')]['service']){_0x444dee['service']=_0x51b684[_0xeeb7('0xb')][_0xeeb7('0xc')]['service'];}else{_0x444dee[_0xeeb7('0xd')]=_0x51b684[_0xeeb7('0xb')]['Smtp'][_0xeeb7('0xd')];_0x444dee['port']=_0x51b684[_0xeeb7('0xb')]['Smtp'][_0xeeb7('0xe')];_0x444dee['secure']=_0x51b684['MailAccount']['Smtp'][_0xeeb7('0xf')];}if(_0x51b684['MailAccount'][_0xeeb7('0xc')][_0xeeb7('0x10')]){_0x444dee['auth']={'user':_0x51b684['MailAccount'][_0xeeb7('0xc')][_0xeeb7('0x11')],'pass':_0x51b684[_0xeeb7('0xb')][_0xeeb7('0xc')][_0xeeb7('0x12')]};}var _0x28bdaa={'account':_0x444dee,'message':{'from':util[_0xeeb7('0x13')](_0xeeb7('0x14'),_0x51b684[_0xeeb7('0xb')][_0xeeb7('0x15')],_0x51b684[_0xeeb7('0xb')][_0xeeb7('0x16')]||_0x51b684[_0xeeb7('0xb')][_0xeeb7('0xc')][_0xeeb7('0x11')]),'to':_0x51b684[_0xeeb7('0x16')],'cc':_0x51b684['cc'],'bcc':_0x51b684[_0xeeb7('0x17')],'subject':util[_0xeeb7('0x13')](_0xeeb7('0x18'),_0x352ab5['name'],_0x51b684[_0xeeb7('0x19')],_0x51b684[_0xeeb7('0x1a')])}};var _0x11f75a=path[_0xeeb7('0x1b')](__dirname,_0xeeb7('0x1c'));var _0x31c7d5=_0x352ab5[_0xeeb7('0x1d')];var _0x22c0ab=util[_0xeeb7('0x13')]('%s.%s',path[_0xeeb7('0x1e')](_0x352ab5[_0xeeb7('0x1d')],path[_0xeeb7('0x1f')](_0x352ab5[_0xeeb7('0x1d')])),_0xeeb7('0x20'));var _0x4bae3f=path[_0xeeb7('0x1b')](_0x11f75a,_0x31c7d5);var _0x124abf=path[_0xeeb7('0x1b')](_0x11f75a,_0x22c0ab);if(fs['existsSync'](_0x4bae3f)){_0x352ab5[_0xeeb7('0x21')]=_0xeeb7('0x22');_0x28bdaa['message'][_0xeeb7('0x23')]=[{'filename':_0x31c7d5,'path':_0x4bae3f}];_0x28bdaa['message'][_0xeeb7('0x24')]=util[_0xeeb7('0x13')](_0xeeb7('0x25'),JSON[_0xeeb7('0x26')](_0x352ab5,null,0x2));}else if(fs[_0xeeb7('0x27')](_0x124abf)){_0x352ab5[_0xeeb7('0x21')]=_0xeeb7('0x22');_0x28bdaa['message'][_0xeeb7('0x23')]=[{'filename':_0x22c0ab,'path':_0x124abf}];}else{_0x28bdaa['message'][_0xeeb7('0x24')]=_0xeeb7('0x28');if(!_0x51b684[_0xeeb7('0x29')]){_0x1ee57e=![];logger[_0xeeb7('0x2a')](_0xeeb7('0x2b'));}}if(_0x1ee57e){return client['request'](_0xeeb7('0x2c'),_0x28bdaa)[_0xeeb7('0x2d')](function(_0x24136a){if(_0x24136a[_0xeeb7('0x2e')]){return logger[_0xeeb7('0x2e')]('error\x20mail',JSON[_0xeeb7('0x26')](_0x24136a));}return logger['info'](_0xeeb7('0x2f'));})['catch'](function(_0x1b2dfb){return logger['error']('error\x20mail',JSON['stringify'](_0x1b2dfb));});}};}function handleError(){return function(_0xa8cd03){return logger[_0xeeb7('0x2e')](JSON[_0xeeb7('0x26')](_0xa8cd03));};}function handleResult(_0x51edc4){return function(_0x1b469c){logger['info'](_0xeeb7('0x30'),JSON[_0xeeb7('0x26')](_0x1b469c));if(_0x51edc4['MailAccount']&&_0x51edc4[_0xeeb7('0xb')][_0xeeb7('0xc')]&&!_[_0xeeb7('0x31')](_0x51edc4[_0xeeb7('0x16')])){setTimeout(handleSendEmail(_0x51edc4,_0x1b469c),0x3c*0x3e8);}};}function handleJob(_0x1f0408){return function(){try{if(_[_0xeeb7('0x31')](_0x1f0408[_0xeeb7('0x19')])){return logger[_0xeeb7('0x2a')](_0xeeb7('0x32'));}if(_[_0xeeb7('0x31')](_0x1f0408['subtractUnit'])){return logger[_0xeeb7('0x2a')](_0xeeb7('0x33'));}var _0x546255={'startDate':moment()[_0xeeb7('0x34')](_0x1f0408[_0xeeb7('0x19')],_0x1f0408[_0xeeb7('0x1a')])[_0xeeb7('0x13')](_0xeeb7('0x35')),'endDate':moment()[_0xeeb7('0x13')](_0xeeb7('0x35')),'type':_0xeeb7('0x36'),'output':_0x1f0408[_0xeeb7('0x37')],'name':_0x1f0408[_0xeeb7('0x15')]};if(!_[_0xeeb7('0x31')](_0x1f0408[_0xeeb7('0x38')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x1f0408['DefaultReportId']);return analyticDefaultReportController[_0xeeb7('0x39')]({'id':_0x1f0408[_0xeeb7('0x38')]},_0x546255)[_0xeeb7('0x2d')](handleResult(_0x1f0408))['catch'](handleError());}if(!_[_0xeeb7('0x31')](_0x1f0408[_0xeeb7('0x3a')])){logger[_0xeeb7('0x2a')](_0xeeb7('0x3b'),_0x1f0408[_0xeeb7('0x3a')]);return analyticCustomReportController['runReport']({'id':_0x1f0408[_0xeeb7('0x3a')]},_0x546255)['then'](handleResult(_0x1f0408))['catch'](handleError());}}catch(_0x5ae157){logger['error'](JSON[_0xeeb7('0x26')](_0x5ae157));}return logger[_0xeeb7('0x2a')]('no\x20report\x20id');};}function getJobs(_0x896298){var _0x17ce24={};if(_0x896298){_0x17ce24['id']=_0x896298;}return db[_0xeeb7('0x3c')][_0xeeb7('0x3d')]({'where':_0x17ce24,'include':[{'model':db[_0xeeb7('0xb')],'attributes':['id','name',_0xeeb7('0x16')],'include':[{'model':db[_0xeeb7('0x3e')],'as':_0xeeb7('0xc')}]}]})[_0xeeb7('0x2d')](function(_0x43f30e){var _0x46afc8=_[_0xeeb7('0x3f')](manager[_0xeeb7('0x40')]);var _0x1a00ca=_[_0xeeb7('0x41')](_0x43f30e,function(_0x3d17cd){return _0x3d17cd['id'][_0xeeb7('0x42')]();});var _0x29ef4d=_[_0xeeb7('0x43')](_0x43f30e,function(_0x1368b9){return _0x1368b9['id'][_0xeeb7('0x42')]();});var _0xa70b7b=_0x896298?_0x1a00ca:_['difference'](_0x1a00ca,_0x46afc8);var _0x4e62f6=_['intersection'](_0x1a00ca,_0x46afc8);var _0x2b96a5=_['difference'](_0x46afc8,_0x1a00ca);var _0x7870b5;var _0x51e410;for(_0x7870b5=0x0;_0x7870b5<_0x2b96a5[_0xeeb7('0x44')]&&!_0x896298;_0x7870b5+=0x1){_0x51e410=_0x2b96a5[_0x7870b5][_0xeeb7('0x42')]();if(manager[_0xeeb7('0x45')](_0x51e410)){manager[_0xeeb7('0x46')](_0x51e410);manager[_0xeeb7('0x47')](_0x51e410);logger[_0xeeb7('0x2a')](_0xeeb7('0x48'),_0x51e410);}}logger[_0xeeb7('0x2a')](_0xeeb7('0x49'),JSON[_0xeeb7('0x26')](_0xa70b7b));for(_0x7870b5=0x0;_0x7870b5<_0xa70b7b['length'];_0x7870b5+=0x1){_0x51e410=_0xa70b7b[_0x7870b5]['toString']();logger[_0xeeb7('0x2a')]('index',_0x51e410);if(_0x896298){logger[_0xeeb7('0x2a')]('my\x20id',_0x896298);logger[_0xeeb7('0x2a')](JSON[_0xeeb7('0x26')](_0x29ef4d[_0x51e410]));BPromise[_0xeeb7('0x4a')]()[_0xeeb7('0x2d')](handleJob(_0x29ef4d[_0x51e410]));logger['info'](_0xeeb7('0x4b'),_0x29ef4d[_0x51e410][_0xeeb7('0x15')],_0x29ef4d[_0x51e410]['cron']);}else if(_0x29ef4d[_0x51e410][_0xeeb7('0x4c')]&&_0x29ef4d[_0x51e410][_0xeeb7('0x4d')]&&moment()['isBetween'](_0x29ef4d[_0x51e410][_0xeeb7('0x4e')],_0x29ef4d[_0x51e410][_0xeeb7('0x4f')])){manager[_0xeeb7('0x50')](_0x51e410,_0x29ef4d[_0x51e410][_0xeeb7('0x4c')],handleJob(_0x29ef4d[_0x51e410]));manager[_0xeeb7('0x51')](_0x51e410);logger[_0xeeb7('0x2a')](_0xeeb7('0x52'),_0x29ef4d[_0x51e410][_0xeeb7('0x15')],_0x29ef4d[_0x51e410]['cron']);}else if(manager[_0xeeb7('0x45')](_0x51e410)){manager[_0xeeb7('0x46')](_0x51e410);manager[_0xeeb7('0x47')](_0x51e410);logger[_0xeeb7('0x2a')]('stop\x20cron',_0x29ef4d[_0x51e410][_0xeeb7('0x15')],_0x29ef4d[_0x51e410][_0xeeb7('0x4c')]);}}for(_0x7870b5=0x0,_0x51e410;_0x7870b5<_0x4e62f6[_0xeeb7('0x44')]&&!_0x896298;_0x7870b5+=0x1){_0x51e410=_0x4e62f6[_0x7870b5][_0xeeb7('0x42')]();if(manager[_0xeeb7('0x45')](_0x51e410)){if(_0x29ef4d[_0x51e410][_0xeeb7('0x4c')]&&_0x29ef4d[_0x51e410][_0xeeb7('0x4d')]&&moment()['isBetween'](_0x29ef4d[_0x51e410][_0xeeb7('0x4e')],_0x29ef4d[_0x51e410][_0xeeb7('0x4f')])){manager['update'](_0x51e410,_0x29ef4d[_0x51e410][_0xeeb7('0x4c')],handleJob(_0x29ef4d[_0x51e410]));logger[_0xeeb7('0x2a')](_0xeeb7('0x53'),_0x29ef4d[_0x51e410]['name'],_0x29ef4d[_0x51e410]['cron']);}else{manager[_0xeeb7('0x46')](_0x51e410);manager[_0xeeb7('0x47')](_0x51e410);logger[_0xeeb7('0x2a')]('stop\x20cron',_0x29ef4d[_0x51e410]['name'],_0x29ef4d[_0x51e410]['cron']);}}}})[_0xeeb7('0x54')](function(_0x12dd6e){logger[_0xeeb7('0x2e')](JSON[_0xeeb7('0x26')](_0x12dd6e));});}exports[_0xeeb7('0x55')]=function(_0x5511ad){return getJobs(_0x5511ad);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x78d3=['my\x20id','resolve','run\x20job','cron','isBetween','startAt','add','start','add\x20cron','stop\x20cron','active','endAt','update','update\x20cron','run','util','path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','service','Smtp','MailAccount','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','toRun','index'];(function(_0x3a4c1c,_0x2409c2){var _0x3da893=function(_0x1000e1){while(--_0x1000e1){_0x3a4c1c['push'](_0x3a4c1c['shift']());}};_0x3da893(++_0x2409c2);}(_0x78d3,0x6b));var _0x378d=function(_0x5a9ab6,_0x1a97b0){_0x5a9ab6=_0x5a9ab6-0x0;var _0x54443c=_0x78d3[_0x5a9ab6];return _0x54443c;};'use strict';var fs=require('fs');var util=require(_0x378d('0x0'));var path=require(_0x378d('0x1'));var _=require(_0x378d('0x2'));var moment=require('moment');var CronJobManager=require(_0x378d('0x3'));var jayson=require(_0x378d('0x4'));var BPromise=require(_0x378d('0x5'));var logger=require(_0x378d('0x6'))(_0x378d('0x7'));var db=require(_0x378d('0x8'))['db'];var analyticCustomReportController=require(_0x378d('0x9'));var analyticDefaultReportController=require(_0x378d('0xa'));var client=jayson[_0x378d('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x32ddaa,_0x478b27){return function(){logger[_0x378d('0xc')](_0x378d('0xd'),_0x32ddaa['email']);var _0x564443=!![];var _0x418956={'tls':{'rejectUnauthorized':![]}};if(_0x32ddaa['MailAccount']['Smtp']['service']){_0x418956[_0x378d('0xe')]=_0x32ddaa['MailAccount'][_0x378d('0xf')][_0x378d('0xe')];}else{_0x418956['host']=_0x32ddaa[_0x378d('0x10')][_0x378d('0xf')]['host'];_0x418956[_0x378d('0x11')]=_0x32ddaa[_0x378d('0x10')]['Smtp'][_0x378d('0x11')];_0x418956['secure']=_0x32ddaa[_0x378d('0x10')][_0x378d('0xf')][_0x378d('0x12')];}if(_0x32ddaa[_0x378d('0x10')][_0x378d('0xf')][_0x378d('0x13')]){_0x418956['auth']={'user':_0x32ddaa['MailAccount']['Smtp'][_0x378d('0x14')],'pass':_0x32ddaa['MailAccount'][_0x378d('0xf')][_0x378d('0x15')]};}var _0x598d65={'account':_0x418956,'message':{'from':util[_0x378d('0x16')](_0x378d('0x17'),_0x32ddaa[_0x378d('0x10')][_0x378d('0x18')],_0x32ddaa[_0x378d('0x10')]['email']||_0x32ddaa[_0x378d('0x10')]['Smtp'][_0x378d('0x14')]),'to':_0x32ddaa[_0x378d('0x19')],'cc':_0x32ddaa['cc'],'bcc':_0x32ddaa[_0x378d('0x1a')],'subject':util[_0x378d('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x478b27[_0x378d('0x18')],_0x32ddaa[_0x378d('0x1b')],_0x32ddaa[_0x378d('0x1c')])}};var _0x5c4e37=path[_0x378d('0x1d')](__dirname,_0x378d('0x1e'));var _0x317429=_0x478b27[_0x378d('0x1f')];var _0x34072b=util[_0x378d('0x16')](_0x378d('0x20'),path['basename'](_0x478b27[_0x378d('0x1f')],path[_0x378d('0x21')](_0x478b27[_0x378d('0x1f')])),_0x378d('0x22'));var _0x481176=path[_0x378d('0x1d')](_0x5c4e37,_0x317429);var _0x1361df=path[_0x378d('0x1d')](_0x5c4e37,_0x34072b);if(fs[_0x378d('0x23')](_0x481176)){_0x478b27[_0x378d('0x24')]=_0x378d('0x25');_0x598d65['message'][_0x378d('0x26')]=[{'filename':_0x317429,'path':_0x481176}];_0x598d65[_0x378d('0x27')][_0x378d('0x28')]=util['format'](_0x378d('0x29'),JSON[_0x378d('0x2a')](_0x478b27,null,0x2));}else if(fs[_0x378d('0x23')](_0x1361df)){_0x478b27[_0x378d('0x24')]='Sent';_0x598d65[_0x378d('0x27')][_0x378d('0x26')]=[{'filename':_0x34072b,'path':_0x1361df}];}else{_0x598d65['message']['text']=_0x378d('0x2b');if(!_0x32ddaa[_0x378d('0x2c')]){_0x564443=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x564443){return client[_0x378d('0x2d')](_0x378d('0x2e'),_0x598d65)[_0x378d('0x2f')](function(_0x828aba){if(_0x828aba['error']){return logger[_0x378d('0x30')]('error\x20mail',JSON[_0x378d('0x2a')](_0x828aba));}return logger['info'](_0x378d('0x31'));})[_0x378d('0x32')](function(_0x7197ca){return logger[_0x378d('0x30')]('error\x20mail',JSON[_0x378d('0x2a')](_0x7197ca));});}};}function handleError(){return function(_0x66c4e7){return logger['error'](JSON['stringify'](_0x66c4e7));};}function handleResult(_0x250f2b){return function(_0x2ff047){logger['info'](_0x378d('0x33'),JSON[_0x378d('0x2a')](_0x2ff047));if(_0x250f2b[_0x378d('0x10')]&&_0x250f2b[_0x378d('0x10')][_0x378d('0xf')]&&!_[_0x378d('0x34')](_0x250f2b[_0x378d('0x19')])){setTimeout(handleSendEmail(_0x250f2b,_0x2ff047),0x3c*0x3e8);}};}function handleJob(_0x1216c1){return function(){try{if(_[_0x378d('0x34')](_0x1216c1[_0x378d('0x1b')])){return logger[_0x378d('0xc')](_0x378d('0x35'));}if(_[_0x378d('0x34')](_0x1216c1[_0x378d('0x1c')])){return logger[_0x378d('0xc')](_0x378d('0x36'));}var _0x53554e={'startDate':moment()[_0x378d('0x37')](_0x1216c1[_0x378d('0x1b')],_0x1216c1['subtractUnit'])[_0x378d('0x16')](_0x378d('0x38')),'endDate':moment()[_0x378d('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x378d('0x39'),'output':_0x1216c1['output'],'name':_0x1216c1[_0x378d('0x18')]};if(!_[_0x378d('0x34')](_0x1216c1['DefaultReportId'])){logger[_0x378d('0xc')]('exec\x20defaul\x20report\x20id:%s',_0x1216c1[_0x378d('0x3a')]);return analyticDefaultReportController[_0x378d('0x3b')]({'id':_0x1216c1[_0x378d('0x3a')]},_0x53554e)[_0x378d('0x2f')](handleResult(_0x1216c1))['catch'](handleError());}if(!_[_0x378d('0x34')](_0x1216c1['CustomReportId'])){logger[_0x378d('0xc')](_0x378d('0x3c'),_0x1216c1['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x1216c1[_0x378d('0x3d')]},_0x53554e)[_0x378d('0x2f')](handleResult(_0x1216c1))[_0x378d('0x32')](handleError());}}catch(_0x15150f){logger[_0x378d('0x30')](JSON['stringify'](_0x15150f));}return logger['info'](_0x378d('0x3e'));};}function getJobs(_0x230619){var _0xc5961c={};if(_0x230619){_0xc5961c['id']=_0x230619;}return db[_0x378d('0x3f')][_0x378d('0x40')]({'where':_0xc5961c,'include':[{'model':db[_0x378d('0x10')],'attributes':['id',_0x378d('0x18'),_0x378d('0x19')],'include':[{'model':db[_0x378d('0x41')],'as':_0x378d('0xf')}]}]})[_0x378d('0x2f')](function(_0x36773d){var _0x3b9495=_['keys'](manager[_0x378d('0x42')]);var _0x2e9f62=_['map'](_0x36773d,function(_0x39344d){return _0x39344d['id'][_0x378d('0x43')]();});var _0x4ebb43=_[_0x378d('0x44')](_0x36773d,function(_0x59d540){return _0x59d540['id'][_0x378d('0x43')]();});var _0x1568fa=_0x230619?_0x2e9f62:_['difference'](_0x2e9f62,_0x3b9495);var _0x15b467=_[_0x378d('0x45')](_0x2e9f62,_0x3b9495);var _0x35a001=_[_0x378d('0x46')](_0x3b9495,_0x2e9f62);var _0x5a9af0;var _0x5d012e;for(_0x5a9af0=0x0;_0x5a9af0<_0x35a001[_0x378d('0x47')]&&!_0x230619;_0x5a9af0+=0x1){_0x5d012e=_0x35a001[_0x5a9af0][_0x378d('0x43')]();if(manager[_0x378d('0x48')](_0x5d012e)){manager[_0x378d('0x49')](_0x5d012e);manager[_0x378d('0x4a')](_0x5d012e);logger['info']('delete\x20cron',_0x5d012e);}}logger[_0x378d('0xc')](_0x378d('0x4b'),JSON[_0x378d('0x2a')](_0x1568fa));for(_0x5a9af0=0x0;_0x5a9af0<_0x1568fa[_0x378d('0x47')];_0x5a9af0+=0x1){_0x5d012e=_0x1568fa[_0x5a9af0]['toString']();logger['info'](_0x378d('0x4c'),_0x5d012e);if(_0x230619){logger[_0x378d('0xc')](_0x378d('0x4d'),_0x230619);logger['info'](JSON[_0x378d('0x2a')](_0x4ebb43[_0x5d012e]));BPromise[_0x378d('0x4e')]()[_0x378d('0x2f')](handleJob(_0x4ebb43[_0x5d012e]));logger[_0x378d('0xc')](_0x378d('0x4f'),_0x4ebb43[_0x5d012e][_0x378d('0x18')],_0x4ebb43[_0x5d012e]['cron']);}else if(_0x4ebb43[_0x5d012e][_0x378d('0x50')]&&_0x4ebb43[_0x5d012e]['active']&&moment()[_0x378d('0x51')](_0x4ebb43[_0x5d012e][_0x378d('0x52')],_0x4ebb43[_0x5d012e]['endAt'])){manager[_0x378d('0x53')](_0x5d012e,_0x4ebb43[_0x5d012e][_0x378d('0x50')],handleJob(_0x4ebb43[_0x5d012e]));manager[_0x378d('0x54')](_0x5d012e);logger[_0x378d('0xc')](_0x378d('0x55'),_0x4ebb43[_0x5d012e][_0x378d('0x18')],_0x4ebb43[_0x5d012e][_0x378d('0x50')]);}else if(manager['exists'](_0x5d012e)){manager[_0x378d('0x49')](_0x5d012e);manager[_0x378d('0x4a')](_0x5d012e);logger[_0x378d('0xc')](_0x378d('0x56'),_0x4ebb43[_0x5d012e][_0x378d('0x18')],_0x4ebb43[_0x5d012e][_0x378d('0x50')]);}}for(_0x5a9af0=0x0,_0x5d012e;_0x5a9af0<_0x15b467[_0x378d('0x47')]&&!_0x230619;_0x5a9af0+=0x1){_0x5d012e=_0x15b467[_0x5a9af0][_0x378d('0x43')]();if(manager[_0x378d('0x48')](_0x5d012e)){if(_0x4ebb43[_0x5d012e]['cron']&&_0x4ebb43[_0x5d012e][_0x378d('0x57')]&&moment()[_0x378d('0x51')](_0x4ebb43[_0x5d012e][_0x378d('0x52')],_0x4ebb43[_0x5d012e][_0x378d('0x58')])){manager[_0x378d('0x59')](_0x5d012e,_0x4ebb43[_0x5d012e][_0x378d('0x50')],handleJob(_0x4ebb43[_0x5d012e]));logger[_0x378d('0xc')](_0x378d('0x5a'),_0x4ebb43[_0x5d012e][_0x378d('0x18')],_0x4ebb43[_0x5d012e][_0x378d('0x50')]);}else{manager[_0x378d('0x49')](_0x5d012e);manager['deleteJob'](_0x5d012e);logger['info']('stop\x20cron',_0x4ebb43[_0x5d012e][_0x378d('0x18')],_0x4ebb43[_0x5d012e]['cron']);}}}})[_0x378d('0x32')](function(_0xc612e6){logger[_0x378d('0x30')](JSON['stringify'](_0xc612e6));});}exports[_0x378d('0x5b')]=function(_0x48f2cc){return getJobs(_0x48f2cc);};exports[_0x378d('0x54')]=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 09d2b22..af31ecf 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 _0x0a67=['FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','bucket','Sentiment\x20Analysis\x20not\x20configured','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sequelize','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral'];(function(_0x2dc621,_0x5b333c){var _0x48f1d8=function(_0x35963f){while(--_0x35963f){_0x2dc621['push'](_0x2dc621['shift']());}};_0x48f1d8(++_0x5b333c);}(_0x0a67,0xa6));var _0x70a6=function(_0xcccdce,_0xf569f8){_0xcccdce=_0xcccdce-0x0;var _0x2c378d=_0x0a67[_0xcccdce];return _0x2c378d;};var _=require(_0x70a6('0x0'));var AWS=require(_0x70a6('0x1'));var rp=require(_0x70a6('0x2'));var util=require(_0x70a6('0x3'));var BPromise=require(_0x70a6('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x70a6('0x5'))(_0x70a6('0x6'));function getTranscriptionJob(_0x3a4af5,_0x57163e,_0x57643c,_0x3bb056){return new Promise(function(_0xf943ac,_0x2d903c){var _0x1cf721=new AWS['TranscribeService']({'accessKeyId':_0x57163e,'secretAccessKey':_0x3a4af5,'region':_0x57643c});_0x1cf721[_0x70a6('0x7')]({'TranscriptionJobName':_0x3bb056},function(_0x4215eb,_0x4f2a49){if(_0x4215eb){return _0x2d903c(_0x4215eb);}else{return _0xf943ac(_0x4f2a49);}});});}function sentiment(_0x444d26,_0x49b5f8,_0x297bfb,_0xe34e5b,_0x4e02d2){return new Promise(function(_0x3c7f19,_0xc27b3c){var _0x2ea6d4=new AWS[(_0x70a6('0x8'))]({'accessKeyId':_0x49b5f8,'secretAccessKey':_0x444d26,'region':_0x297bfb});_0x2ea6d4[_0x70a6('0x9')]({'Text':_0xe34e5b,'LanguageCode':_0x4e02d2['substring'](0x0,0x2)},function(_0x301202,_0xa31c66){if(_0x301202){return _0xc27b3c(_0x301202);}else{return _0x3c7f19(_0xa31c66);}});});}function checkTranscribeJob(_0x47b4b9,_0x3d8f1e,_0x387535){var _0x225f3e;return new BPromise(function(_0x335b7e,_0x546bde){logger[_0x70a6('0xa')](util[_0x70a6('0xb')](_0x70a6('0xc'),_0x47b4b9['id'],_0x47b4b9[_0x70a6('0xd')]));return getTranscriptionJob(_0x387535[_0x70a6('0xe')],_0x387535['data2'],_0x3d8f1e[_0x70a6('0xf')],_0x47b4b9[_0x70a6('0xd')])[_0x70a6('0x10')](function(_0x4e0eda){logger[_0x70a6('0xa')](util['format'](_0x70a6('0x11'),_0x47b4b9['id'],_0x47b4b9[_0x70a6('0xd')],_0x4e0eda['TranscriptionJob'][_0x70a6('0x12')]));if(!_0x47b4b9['fileText']){switch(_0x4e0eda[_0x70a6('0x13')][_0x70a6('0x12')]){case _0x70a6('0x14'):var _0x25e2e9={'transcribeStatus':_0x4e0eda[_0x70a6('0x13')][_0x70a6('0x12')],'fileUri':_0x4e0eda[_0x70a6('0x13')][_0x70a6('0x15')][_0x70a6('0x16')]};logger[_0x70a6('0xa')](util[_0x70a6('0xb')](_0x70a6('0x17'),_0x47b4b9['id']));return rp({'uri':_0x4e0eda[_0x70a6('0x13')][_0x70a6('0x15')][_0x70a6('0x16')],'json':!![]})[_0x70a6('0x10')](function(_0x1dee9a){logger['info'](util[_0x70a6('0xb')](_0x70a6('0x18'),_0x47b4b9['id']));if(_0x1dee9a&&_0x1dee9a[_0x70a6('0x19')]&&_0x1dee9a[_0x70a6('0x19')][_0x70a6('0x1a')]&&_0x1dee9a[_0x70a6('0x19')]['transcripts'][_0x70a6('0x1b')]){_0x25e2e9[_0x70a6('0x1c')]='';for(var _0x2ad201=0x0;_0x2ad201<_0x1dee9a[_0x70a6('0x19')][_0x70a6('0x1a')][_0x70a6('0x1b')];_0x2ad201++){_0x25e2e9[_0x70a6('0x1c')]+=_0x1dee9a[_0x70a6('0x19')][_0x70a6('0x1a')][_0x2ad201][_0x70a6('0x1d')]+'';}}return _0x47b4b9[_0x70a6('0x1e')](_0x25e2e9);})[_0x70a6('0x10')](function(){logger[_0x70a6('0xa')](util[_0x70a6('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x47b4b9['id']));if(!_0x47b4b9[_0x70a6('0x1f')]){throw new db['Sequelize'][(_0x70a6('0x20'))](_0x70a6('0x21'));}if(!_0x3d8f1e[_0x70a6('0x22')]||!_0x3d8f1e[_0x70a6('0x23')]||!_0x3d8f1e[_0x70a6('0x24')]||!_0x3d8f1e[_0x70a6('0x25')]||!_0x3d8f1e['bucket']){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x25e2e9[_0x70a6('0x1c')]){throw new Error(_0x70a6('0x27'));}if(_0x3d8f1e[_0x70a6('0x23')]===_0x387535['id']){return _0x387535;}else{return db[_0x70a6('0x28')][_0x70a6('0x29')]({'where':{'id':_settings[_0x70a6('0x23')]}});}})['then'](function(_0x4ebaaf){if(!_0x4ebaaf){throw new db[(_0x70a6('0x26'))]['ValidationError'](_0x70a6('0x2a'));}if(!_0x4ebaaf['data1']||!_0x4ebaaf[_0x70a6('0x2b')]){throw new db[(_0x70a6('0x26'))]['ValidationError'](_0x70a6('0x2c'));}_0x225f3e=_0x4ebaaf;logger[_0x70a6('0xa')](util[_0x70a6('0xb')](_0x70a6('0x2d'),_0x47b4b9['id']));return sentiment(_0x225f3e['data1'],_0x225f3e[_0x70a6('0x2b')],_0x3d8f1e[_0x70a6('0x24')],_0x25e2e9[_0x70a6('0x1c')],_0x3d8f1e[_0x70a6('0x25')]);})[_0x70a6('0x10')](function(_0x52fe87){logger['info'](util[_0x70a6('0xb')](_0x70a6('0x2e'),_0x47b4b9['id']));return _0x47b4b9['update']({'sentiment':_0x52fe87[_0x70a6('0x2f')],'sPositive':_0x52fe87['SentimentScore'][_0x70a6('0x30')],'sNegative':_0x52fe87[_0x70a6('0x31')][_0x70a6('0x32')],'sMixed':_0x52fe87[_0x70a6('0x31')][_0x70a6('0x33')],'sNeutral':_0x52fe87[_0x70a6('0x31')][_0x70a6('0x34')]});})[_0x70a6('0x10')](function(){logger[_0x70a6('0xa')](util[_0x70a6('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x47b4b9['id']));_0x335b7e();});case _0x70a6('0x35'):return _0x47b4b9['update']({'transcribeStatus':_0x70a6('0x35'),'failureReason':_0x4e0eda[_0x70a6('0x13')][_0x70a6('0x36')]})[_0x70a6('0x10')](function(){logger[_0x70a6('0xa')](util[_0x70a6('0xb')](_0x70a6('0x37'),_0x47b4b9['id']));_0x335b7e();});default:logger[_0x70a6('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x47b4b9['id']));break;}}else{return BPromise['resolve']()[_0x70a6('0x10')](function(){if(!_0x47b4b9[_0x70a6('0x1f')]){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3d8f1e[_0x70a6('0x22')]||!_0x3d8f1e[_0x70a6('0x23')]||!_0x3d8f1e[_0x70a6('0x24')]||!_0x3d8f1e[_0x70a6('0x25')]||!_0x3d8f1e[_0x70a6('0x38')]){throw new db['Sequelize'][(_0x70a6('0x20'))](_0x70a6('0x39'));}if(!_0x47b4b9[_0x70a6('0x1c')]){throw new Error('Transcript\x20not\x20available');}if(_0x3d8f1e[_0x70a6('0x23')]===_0x387535['id']){return _0x387535;}else{return db[_0x70a6('0x28')][_0x70a6('0x29')]({'where':{'id':_settings[_0x70a6('0x23')]}});}})['then'](function(_0x4034ec){if(!_0x4034ec){throw new db[(_0x70a6('0x26'))]['ValidationError'](_0x70a6('0x2a'));}if(!_0x4034ec[_0x70a6('0xe')]||!_0x4034ec[_0x70a6('0x2b')]){throw new db['Sequelize']['ValidationError'](_0x70a6('0x2c'));}_0x225f3e=_0x4034ec;logger[_0x70a6('0xa')](util[_0x70a6('0xb')](_0x70a6('0x2d'),_0x47b4b9['id']));return sentiment(_0x225f3e[_0x70a6('0xe')],_0x225f3e[_0x70a6('0x2b')],_0x3d8f1e[_0x70a6('0x24')],_0x47b4b9['fileText'],_0x3d8f1e[_0x70a6('0x25')]);})[_0x70a6('0x10')](function(_0x231733){logger['info'](util[_0x70a6('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x47b4b9['id']));return _0x47b4b9[_0x70a6('0x1e')]({'sentiment':_0x231733[_0x70a6('0x2f')],'sPositive':_0x231733[_0x70a6('0x31')][_0x70a6('0x30')],'sNegative':_0x231733[_0x70a6('0x31')][_0x70a6('0x32')],'sMixed':_0x231733['SentimentScore']['Mixed'],'sNeutral':_0x231733[_0x70a6('0x31')][_0x70a6('0x34')],'transcribeStatus':_0x70a6('0x14')});})[_0x70a6('0x10')](function(){logger[_0x70a6('0xa')](util['format'](_0x70a6('0x37'),_0x47b4b9['id']));_0x335b7e();});}})['catch'](function(_0x4e11e1){if(_0x4e11e1){if(!_0x4e11e1[_0x70a6('0x3a')]||_0x4e11e1[_0x70a6('0x3a')]!==_0x70a6('0x3b')){logger[_0x70a6('0x3c')](util[_0x70a6('0xb')](_0x70a6('0x3d'),_0x47b4b9['id']),util[_0x70a6('0x3e')](_0x4e11e1,{'showHidden':![],'depth':null}));}}_0x335b7e();});});}function checkTranscribe(){var _0x3af504;var _0x5c8e99;var _0x527b97;return db['VoiceRecording'][_0x70a6('0x3f')]({'where':{'transcribeStatus':_0x70a6('0x40')}})['then'](function(_0x590e45){if(!_0x590e45||!_0x590e45[_0x70a6('0x1b')]){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))]('No\x20transcribe\x20job\x20to\x20check');}_0x3af504=_0x590e45;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x70a6('0x10')](function(_0x1c0497){if(!_0x1c0497){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))](_0x70a6('0x41'));}_0x5c8e99=_0x1c0497;if(!_0x5c8e99[_0x70a6('0x6')]||!_0x5c8e99[_0x70a6('0x42')]||!_0x5c8e99[_0x70a6('0xf')]||!_0x5c8e99[_0x70a6('0x25')]||!_0x5c8e99['bucket']){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))](_0x70a6('0x43'));}return db[_0x70a6('0x28')][_0x70a6('0x29')]({'where':{'id':_0x5c8e99[_0x70a6('0x42')]}});})[_0x70a6('0x10')](function(_0x433693){if(!_0x433693){throw new db['Sequelize'][(_0x70a6('0x20'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x433693['data1']||!_0x433693[_0x70a6('0x2b')]){throw new db[(_0x70a6('0x26'))][(_0x70a6('0x20'))](_0x70a6('0x2c'));}_0x527b97=_0x433693;var _0x1061ca=[];_0x3af504[_0x70a6('0x44')](function(_0x4b8adf){_0x1061ca[_0x70a6('0x45')](checkTranscribeJob(_0x4b8adf,_0x5c8e99,_0x527b97));});return BPromise[_0x70a6('0x46')](_0x1061ca);})[_0x70a6('0x47')](function(_0x5ed9c0){if(_0x5ed9c0){if(!_0x5ed9c0[_0x70a6('0x3a')]||_0x5ed9c0['name']!==_0x70a6('0x3b')){logger['error'](util[_0x70a6('0x3e')](_0x5ed9c0,{'showHidden':![],'depth':null}));}}});}exports[_0x70a6('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xf677=['update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','forEach','push','all','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript'];(function(_0x18c8b5,_0x2a15d3){var _0x358984=function(_0xf5461){while(--_0xf5461){_0x18c8b5['push'](_0x18c8b5['shift']());}};_0x358984(++_0x2a15d3);}(_0xf677,0xb3));var _0x7f67=function(_0x4ee8f2,_0x341ceb){_0x4ee8f2=_0x4ee8f2-0x0;var _0x59d6c8=_0xf677[_0x4ee8f2];return _0x59d6c8;};var _=require('lodash');var AWS=require(_0x7f67('0x0'));var rp=require(_0x7f67('0x1'));var util=require(_0x7f67('0x2'));var BPromise=require('bluebird');var db=require(_0x7f67('0x3'))['db'];var logger=require(_0x7f67('0x4'))(_0x7f67('0x5'));function getTranscriptionJob(_0x37ff1d,_0xf4e4,_0x82ab01,_0x5d35e8){return new Promise(function(_0x285aa1,_0x5ada61){var _0x684a3a=new AWS[(_0x7f67('0x6'))]({'accessKeyId':_0xf4e4,'secretAccessKey':_0x37ff1d,'region':_0x82ab01});_0x684a3a['getTranscriptionJob']({'TranscriptionJobName':_0x5d35e8},function(_0x220695,_0x436ffc){if(_0x220695){return _0x5ada61(_0x220695);}else{return _0x285aa1(_0x436ffc);}});});}function sentiment(_0x5a018a,_0x4a9bf9,_0x28b581,_0x40933f,_0x5b090c){return new Promise(function(_0x324424,_0x85dbef){var _0x5e1e8b=new AWS['Comprehend']({'accessKeyId':_0x4a9bf9,'secretAccessKey':_0x5a018a,'region':_0x28b581});_0x5e1e8b[_0x7f67('0x7')]({'Text':_0x40933f,'LanguageCode':_0x5b090c['substring'](0x0,0x2)},function(_0x5f40b9,_0x1f91cc){if(_0x5f40b9){return _0x85dbef(_0x5f40b9);}else{return _0x324424(_0x1f91cc);}});});}function checkTranscribeJob(_0x4658d2,_0xc991f3,_0x599059){var _0x54aa57;return new BPromise(function(_0x1550a7,_0x27239f){logger[_0x7f67('0x8')](util[_0x7f67('0x9')](_0x7f67('0xa'),_0x4658d2['id'],_0x4658d2[_0x7f67('0xb')]));return getTranscriptionJob(_0x599059[_0x7f67('0xc')],_0x599059[_0x7f67('0xd')],_0xc991f3[_0x7f67('0xe')],_0x4658d2[_0x7f67('0xb')])[_0x7f67('0xf')](function(_0x5452c9){logger[_0x7f67('0x8')](util[_0x7f67('0x9')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x4658d2['id'],_0x4658d2[_0x7f67('0xb')],_0x5452c9[_0x7f67('0x10')][_0x7f67('0x11')]));if(!_0x4658d2[_0x7f67('0x12')]){switch(_0x5452c9[_0x7f67('0x10')][_0x7f67('0x11')]){case _0x7f67('0x13'):var _0x1399b5={'transcribeStatus':_0x5452c9['TranscriptionJob'][_0x7f67('0x11')],'fileUri':_0x5452c9['TranscriptionJob'][_0x7f67('0x14')]['TranscriptFileUri']};logger[_0x7f67('0x8')](util['format'](_0x7f67('0x15'),_0x4658d2['id']));return rp({'uri':_0x5452c9[_0x7f67('0x10')][_0x7f67('0x14')][_0x7f67('0x16')],'json':!![]})[_0x7f67('0xf')](function(_0x346690){logger[_0x7f67('0x8')](util['format'](_0x7f67('0x17'),_0x4658d2['id']));if(_0x346690&&_0x346690[_0x7f67('0x18')]&&_0x346690[_0x7f67('0x18')][_0x7f67('0x19')]&&_0x346690[_0x7f67('0x18')]['transcripts'][_0x7f67('0x1a')]){_0x1399b5['fileText']='';for(var _0x24dc70=0x0;_0x24dc70<_0x346690[_0x7f67('0x18')][_0x7f67('0x19')][_0x7f67('0x1a')];_0x24dc70++){_0x1399b5[_0x7f67('0x12')]+=_0x346690[_0x7f67('0x18')][_0x7f67('0x19')][_0x24dc70][_0x7f67('0x1b')]+'';}}return _0x4658d2[_0x7f67('0x1c')](_0x1399b5);})[_0x7f67('0xf')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4658d2['id']));if(!_0x4658d2[_0x7f67('0x1d')]){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x20'));}if(!_0xc991f3[_0x7f67('0x21')]||!_0xc991f3[_0x7f67('0x22')]||!_0xc991f3['sentimentRegion']||!_0xc991f3[_0x7f67('0x23')]||!_0xc991f3[_0x7f67('0x24')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1399b5[_0x7f67('0x12')]){throw new Error(_0x7f67('0x25'));}if(_0xc991f3[_0x7f67('0x22')]===_0x599059['id']){return _0x599059;}else{return db[_0x7f67('0x26')][_0x7f67('0x27')]({'where':{'id':_settings[_0x7f67('0x22')]}});}})[_0x7f67('0xf')](function(_0x28e028){if(!_0x28e028){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x28'));}if(!_0x28e028['data1']||!_0x28e028['data2']){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x29'));}_0x54aa57=_0x28e028;logger[_0x7f67('0x8')](util[_0x7f67('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4658d2['id']));return sentiment(_0x54aa57[_0x7f67('0xc')],_0x54aa57['data2'],_0xc991f3['sentimentRegion'],_0x1399b5[_0x7f67('0x12')],_0xc991f3[_0x7f67('0x23')]);})[_0x7f67('0xf')](function(_0x38dd73){logger[_0x7f67('0x8')](util['format'](_0x7f67('0x2a'),_0x4658d2['id']));return _0x4658d2['update']({'sentiment':_0x38dd73[_0x7f67('0x2b')],'sPositive':_0x38dd73[_0x7f67('0x2c')]['Positive'],'sNegative':_0x38dd73[_0x7f67('0x2c')][_0x7f67('0x2d')],'sMixed':_0x38dd73[_0x7f67('0x2c')]['Mixed'],'sNeutral':_0x38dd73[_0x7f67('0x2c')][_0x7f67('0x2e')]});})['then'](function(){logger[_0x7f67('0x8')](util[_0x7f67('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4658d2['id']));_0x1550a7();});case _0x7f67('0x2f'):return _0x4658d2[_0x7f67('0x1c')]({'transcribeStatus':_0x7f67('0x2f'),'failureReason':_0x5452c9['TranscriptionJob'][_0x7f67('0x30')]})[_0x7f67('0xf')](function(){logger[_0x7f67('0x8')](util['format'](_0x7f67('0x31'),_0x4658d2['id']));_0x1550a7();});default:logger[_0x7f67('0x8')](util[_0x7f67('0x9')](_0x7f67('0x32'),_0x4658d2['id']));break;}}else{return BPromise[_0x7f67('0x33')]()['then'](function(){if(!_0x4658d2[_0x7f67('0x1d')]){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x20'));}if(!_0xc991f3[_0x7f67('0x21')]||!_0xc991f3[_0x7f67('0x22')]||!_0xc991f3['sentimentRegion']||!_0xc991f3['language']||!_0xc991f3[_0x7f67('0x24')]){throw new db['Sequelize'][(_0x7f67('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4658d2[_0x7f67('0x12')]){throw new Error(_0x7f67('0x25'));}if(_0xc991f3['sentimentAccountId']===_0x599059['id']){return _0x599059;}else{return db['CloudProvider'][_0x7f67('0x27')]({'where':{'id':_settings[_0x7f67('0x22')]}});}})[_0x7f67('0xf')](function(_0x4fda36){if(!_0x4fda36){throw new db[(_0x7f67('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x4fda36['data1']||!_0x4fda36[_0x7f67('0xd')]){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x29'));}_0x54aa57=_0x4fda36;logger[_0x7f67('0x8')](util[_0x7f67('0x9')](_0x7f67('0x34'),_0x4658d2['id']));return sentiment(_0x54aa57[_0x7f67('0xc')],_0x54aa57[_0x7f67('0xd')],_0xc991f3[_0x7f67('0x35')],_0x4658d2['fileText'],_0xc991f3[_0x7f67('0x23')]);})[_0x7f67('0xf')](function(_0x54d58c){logger[_0x7f67('0x8')](util[_0x7f67('0x9')](_0x7f67('0x2a'),_0x4658d2['id']));return _0x4658d2[_0x7f67('0x1c')]({'sentiment':_0x54d58c[_0x7f67('0x2b')],'sPositive':_0x54d58c['SentimentScore'][_0x7f67('0x36')],'sNegative':_0x54d58c[_0x7f67('0x2c')][_0x7f67('0x2d')],'sMixed':_0x54d58c['SentimentScore']['Mixed'],'sNeutral':_0x54d58c[_0x7f67('0x2c')]['Neutral'],'transcribeStatus':'COMPLETED'});})[_0x7f67('0xf')](function(){logger[_0x7f67('0x8')](util[_0x7f67('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4658d2['id']));_0x1550a7();});}})[_0x7f67('0x37')](function(_0x1db09f){if(_0x1db09f){if(!_0x1db09f[_0x7f67('0x38')]||_0x1db09f[_0x7f67('0x38')]!==_0x7f67('0x39')){logger[_0x7f67('0x3a')](util[_0x7f67('0x9')](_0x7f67('0x3b'),_0x4658d2['id']),util[_0x7f67('0x3c')](_0x1db09f,{'showHidden':![],'depth':null}));}}_0x1550a7();});});}function checkTranscribe(){var _0x4e41fb;var _0x4680bf;var _0x396d46;return db[_0x7f67('0x3d')][_0x7f67('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x7f67('0xf')](function(_0xf22456){if(!_0xf22456||!_0xf22456[_0x7f67('0x1a')]){throw new db['Sequelize'][(_0x7f67('0x1f'))](_0x7f67('0x3f'));}_0x4e41fb=_0xf22456;return db['Setting'][_0x7f67('0x27')]({'where':{'id':0x1}});})[_0x7f67('0xf')](function(_0x1f1928){if(!_0x1f1928){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))]('Settings\x20not\x20available');}_0x4680bf=_0x1f1928;if(!_0x4680bf[_0x7f67('0x5')]||!_0x4680bf[_0x7f67('0x40')]||!_0x4680bf[_0x7f67('0xe')]||!_0x4680bf[_0x7f67('0x23')]||!_0x4680bf[_0x7f67('0x24')]){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))]('Transcribe\x20not\x20configured');}return db[_0x7f67('0x26')][_0x7f67('0x27')]({'where':{'id':_0x4680bf['transcribeAccountId']}});})[_0x7f67('0xf')](function(_0xfce8d4){if(!_0xfce8d4){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x28'));}if(!_0xfce8d4['data1']||!_0xfce8d4[_0x7f67('0xd')]){throw new db[(_0x7f67('0x1e'))][(_0x7f67('0x1f'))](_0x7f67('0x29'));}_0x396d46=_0xfce8d4;var _0x4f1dde=[];_0x4e41fb[_0x7f67('0x41')](function(_0x258061){_0x4f1dde[_0x7f67('0x42')](checkTranscribeJob(_0x258061,_0x4680bf,_0x396d46));});return BPromise[_0x7f67('0x43')](_0x4f1dde);})[_0x7f67('0x37')](function(_0x1fd17f){if(_0x1fd17f){if(!_0x1fd17f['name']||_0x1fd17f[_0x7f67('0x38')]!=='SequelizeValidationError'){logger[_0x7f67('0x3a')](util[_0x7f67('0x3c')](_0x1fd17f,{'showHidden':![],'depth':null}));}}});}exports[_0x7f67('0x44')]=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 adb1a9c..f723e75 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe202=['CmHopper','hopper1','contacts2','hopper2','catch','../mysqldb','push','Innocenzo','innocenzo.biondo','now','Biondo','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','destroy'];(function(_0x2bc09e,_0x1ae747){var _0x3f7c75=function(_0x49bed4){while(--_0x49bed4){_0x2bc09e['push'](_0x2bc09e['shift']());}};_0x3f7c75(++_0x1ae747);}(_0xe202,0x149));var _0x2e20=function(_0x4a4519,_0x30f979){_0x4a4519=_0x4a4519-0x0;var _0x1e3e9a=_0xe202[_0x4a4519];return _0x1e3e9a;};'use strict';var util=require('util');var db=require(_0x2e20('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2e20('0x1')]({'id':i,'firstName':_0x2e20('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2e20('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2e20('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x2e20('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2e20('0x4')](),'updatedAt':Date[_0x2e20('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x2e20('0x2')+i,'lastName':_0x2e20('0x5')+i,'phone':0xf879fb460+i,'email':_0x2e20('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2e20('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x2e20('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x2e20('0x4')]()});}db['CmContact']['destroy']({'where':{}})[_0x2e20('0x6')](function(){return db[_0x2e20('0x7')][_0x2e20('0x8')](contacts);})[_0x2e20('0x6')](function(){console[_0x2e20('0x9')](_0x2e20('0xa'),_0x2e20('0xb'));return db['CmHopper'][_0x2e20('0xc')]({'where':{}});})[_0x2e20('0x6')](function(){return db[_0x2e20('0xd')][_0x2e20('0x8')](hopper);})[_0x2e20('0x6')](function(){console[_0x2e20('0x9')]('finished\x20populating',_0x2e20('0xe'));return db['CmContact']['bulkCreate'](contacts2);})['then'](function(){console['log']('finished\x20populating',_0x2e20('0xf'));return db[_0x2e20('0xd')][_0x2e20('0x8')](hopper2);})[_0x2e20('0x6')](function(){console['log'](_0x2e20('0xa'),_0x2e20('0x10'));})[_0x2e20('0x11')](function(_0x482ee6){console[_0x2e20('0x9')](_0x482ee6);}); \ No newline at end of file +var _0x6a08=['push','now','Biondo','CmContact','destroy','then','bulkCreate','contacts1','CmHopper','log','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','innocenzo.biondo','@xcally.com'];(function(_0x50e10f,_0x197f36){var _0x175521=function(_0x323d56){while(--_0x323d56){_0x50e10f['push'](_0x50e10f['shift']());}};_0x175521(++_0x197f36);}(_0x6a08,0x113));var _0x86a0=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0x6a08[_0x1fb1c1];return _0x1622df;};'use strict';var util=require(_0x86a0('0x0'));var db=require(_0x86a0('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x86a0('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x86a0('0x3')+i+_0x86a0('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x86a0('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x86a0('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x86a0('0x6')](),'updatedAt':Date[_0x86a0('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x86a0('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x86a0('0x7')+i,'phone':0xf879fb460+i,'email':_0x86a0('0x3')+i+_0x86a0('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x86a0('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x86a0('0x6')](),'updatedAt':Date[_0x86a0('0x6')]()});}db[_0x86a0('0x8')][_0x86a0('0x9')]({'where':{}})[_0x86a0('0xa')](function(){return db[_0x86a0('0x8')][_0x86a0('0xb')](contacts);})['then'](function(){console['log']('finished\x20populating',_0x86a0('0xc'));return db[_0x86a0('0xd')][_0x86a0('0x9')]({'where':{}});})['then'](function(){return db[_0x86a0('0xd')][_0x86a0('0xb')](hopper);})[_0x86a0('0xa')](function(){console[_0x86a0('0xe')](_0x86a0('0xf'),_0x86a0('0x10'));return db[_0x86a0('0x8')][_0x86a0('0xb')](contacts2);})[_0x86a0('0xa')](function(){console[_0x86a0('0xe')]('finished\x20populating',_0x86a0('0x11'));return db[_0x86a0('0xd')][_0x86a0('0xb')](hopper2);})[_0x86a0('0xa')](function(){console['log'](_0x86a0('0xf'),_0x86a0('0x12'));})[_0x86a0('0x13')](function(_0x201c36){console['log'](_0x201c36);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index bb58b86..ac0d5de 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x208b=['wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','User','catch','log','util','push','agent','%s%s','format','%s%s@xcally.com','password','friend'];(function(_0xa3400,_0x3a980a){var _0x33dba2=function(_0x5e988b){while(--_0x5e988b){_0xa3400['push'](_0xa3400['shift']());}};_0x33dba2(++_0x3a980a);}(_0x208b,0x14c));var _0xb208=function(_0x5ccd12,_0x556951){_0x5ccd12=_0x5ccd12-0x0;var _0x3d6732=_0x208b[_0x5ccd12];return _0x3d6732;};'use strict';var util=require(_0xb208('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb208('0x1')]({'name':util['format']('%s%s',_0xb208('0x2'),i),'fullname':util['format'](_0xb208('0x3'),_0xb208('0x2'),i),'email':util[_0xb208('0x4')](_0xb208('0x5'),_0xb208('0x2'),i),'role':_0xb208('0x2'),'password':_0xb208('0x6'),'internal':0xfa0+i,'type':_0xb208('0x7'),'transport':['udp','ws',_0xb208('0x8')],'disallow':[_0xb208('0x9')],'allow':[_0xb208('0xa')],'defaultuser':util[_0xb208('0x4')](_0xb208('0x3'),_0xb208('0x2'),i),'encryption':'yes','avpf':_0xb208('0xb'),'force_avp':_0xb208('0xb'),'icesupport':_0xb208('0xb'),'dtlsenable':_0xb208('0xb'),'dtlsverify':'no','dtlscertfile':_0xb208('0xc'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xb208('0xd'),'callerid':util[_0xb208('0x4')]('\x22%s\x22\x20<%s>',util[_0xb208('0x4')](_0xb208('0x3'),'agent',i),0xfa0+i)});}db[_0xb208('0xe')]['bulkCreate'](users)['then'](function(){console['log']('add\x20user');})[_0xb208('0xf')](function(_0x117a75){console[_0xb208('0x10')](_0x117a75);}); \ No newline at end of file +var _0xc969=['%s%s@xcally.com','password','friend','udp','wss','all','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','catch','log','util','../mysqldb','push','format','%s%s','agent'];(function(_0x3673a8,_0x511bb0){var _0x3c2d28=function(_0x398684){while(--_0x398684){_0x3673a8['push'](_0x3673a8['shift']());}};_0x3c2d28(++_0x511bb0);}(_0xc969,0xb7));var _0x9c96=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xc969[_0x550d12];return _0x12103d;};'use strict';var util=require(_0x9c96('0x0'));var db=require(_0x9c96('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9c96('0x2')]({'name':util[_0x9c96('0x3')](_0x9c96('0x4'),_0x9c96('0x5'),i),'fullname':util[_0x9c96('0x3')](_0x9c96('0x4'),'agent',i),'email':util[_0x9c96('0x3')](_0x9c96('0x6'),_0x9c96('0x5'),i),'role':_0x9c96('0x5'),'password':_0x9c96('0x7'),'internal':0xfa0+i,'type':_0x9c96('0x8'),'transport':[_0x9c96('0x9'),'ws',_0x9c96('0xa')],'disallow':[_0x9c96('0xb')],'allow':['ulaw'],'defaultuser':util[_0x9c96('0x3')](_0x9c96('0x4'),_0x9c96('0x5'),i),'encryption':_0x9c96('0xc'),'avpf':_0x9c96('0xc'),'force_avp':_0x9c96('0xc'),'icesupport':_0x9c96('0xc'),'dtlsenable':_0x9c96('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x9c96('0xd'),'dtlssetup':_0x9c96('0xe'),'callerid':util[_0x9c96('0x3')](_0x9c96('0xf'),util[_0x9c96('0x3')](_0x9c96('0x4'),_0x9c96('0x5'),i),0xfa0+i)});}db[_0x9c96('0x10')][_0x9c96('0x11')](users)[_0x9c96('0x12')](function(){console['log']('add\x20user');})[_0x9c96('0x13')](function(_0x2697a4){console[_0x9c96('0x14')](_0x2697a4);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 2a79445..b98435b 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a37=['removeChatInteractions','emit','user_has_chat_interactions:remove','leave','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','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','setMaxListeners','address','request','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','role','agent','name','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','map','User','Campaign','where','format','%s:queue:%s','user:%s','handshake','find','userProfileId','query','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','voice:outbound','MailQueues','OpenchannelQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','sms','openchannel','whatsapp','telephone:%s','campaign:%s:%s'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0x7a37,0xdf));var _0x77a3=function(_0x188c8,_0x575060){_0x188c8=_0x188c8-0x0;var _0x565ea7=_0x7a37[_0x188c8];return _0x565ea7;};'use strict';var _=require(_0x77a3('0x0'));var util=require(_0x77a3('0x1'));var BPromise=require(_0x77a3('0x2'));var db=require(_0x77a3('0x3'))['db'];var config=require(_0x77a3('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x77a3('0x5'),'model':db['User'],'attributes':['id','name',_0x77a3('0x6')],'raw':!![],'where':{'role':_0x77a3('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x77a3('0x8')],'where':{'role':_0x77a3('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x77a3('0x8')]};var queryAgents={'raw':!![],'attributes':['id',_0x77a3('0x8')],'where':{'role':_0x77a3('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x77a3('0x8'),_0x77a3('0xa')],'where':{'type':_0x77a3('0xb')}};function getAssociatedResources(_0x17eeb2,_0xb05133,_0x3484c8){return db[_0x77a3('0xc')][_0x77a3('0xd')]({'where':{'name':_0x17eeb2,'userProfileId':_0xb05133},'raw':!![]})[_0x77a3('0xe')](function(_0x28797e){if(_0x28797e){if(_0x28797e[_0x77a3('0xf')]){switch(_0x17eeb2){case _0x77a3('0x10'):case _0x77a3('0x11'):case _0x77a3('0x12'):case'SmsQueues':case'MailQueues':case'OpenchannelQueues':case _0x77a3('0x13'):return db[_0x3484c8][_0x77a3('0x14')](queryQueues);case'Telephones':return db[_0x3484c8][_0x77a3('0x14')](queryTelephones);case'Trunks':return db[_0x3484c8][_0x77a3('0x14')](queryTrunks);case _0x77a3('0x15'):return db[_0x3484c8][_0x77a3('0x14')](queryCampaigns);}}else{return db[_0x77a3('0x16')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x28797e['id']},'raw':!![]})[_0x77a3('0xe')](function(_0x4413b5){if(_0x4413b5){var _0x1e3092={'where':{'id':_[_0x77a3('0x17')](_0x4413b5,'resourceId')},'raw':!![]};switch(_0x3484c8){case _0x77a3('0x18'):_0x1e3092['where'][_0x77a3('0x6')]=_0x77a3('0x9');break;case _0x77a3('0x19'):_0x1e3092[_0x77a3('0x1a')][_0x77a3('0xa')]=_0x77a3('0xb');break;}return db[_0x3484c8]['findAll'](_0x1e3092);}else{return[];}});}}else{return[];}})['then'](function(_0x5bc0f1){return _0x5bc0f1;});}function joinOrLeaveQueues(_0x302387,_0x4964a8,_0x1cc107,_0x4e92ea){_0x302387[_0x4964a8](util[_0x77a3('0x1b')](_0x77a3('0x1c'),_0x1cc107,_0x4e92ea[_0x77a3('0x8')]));if(_0x4e92ea[_0x77a3('0x5')]){for(var _0x71a4f=0x0;_0x71a4f<_0x4e92ea[_0x77a3('0x5')]['length'];_0x71a4f+=0x1){_0x302387[_0x4964a8](util['format'](_0x77a3('0x1d'),_0x4e92ea[_0x77a3('0x5')][_0x71a4f][_0x77a3('0x8')]));}}}function joinOrLeave(_0x18c4a6,_0x50d69e,_0x1d72c9){var _0x35ff7f;if(_0x18c4a6[_0x77a3('0x1e')]['query']['id']){db[_0x77a3('0x18')][_0x77a3('0x1f')]({'attributes':['id',_0x77a3('0x8'),_0x77a3('0x6'),_0x77a3('0x20')],'where':{'id':_0x18c4a6[_0x77a3('0x1e')][_0x77a3('0x21')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x77a3('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x77a3('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x77a3('0x24')],'as':_0x77a3('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x77a3('0x26')],'as':_0x77a3('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x77a3('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x77a3('0x29')],'as':_0x77a3('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x77a3('0xe')](function(_0x16682c){if(_0x16682c){_0x35ff7f=_0x16682c;_0x18c4a6[_0x50d69e](util[_0x77a3('0x1b')](_0x77a3('0x1d'),_0x16682c[_0x77a3('0x8')]));var _0xc9451f=[];switch(_0x16682c['role']){case _0x77a3('0x2b'):_0x18c4a6[_0x50d69e](_0x77a3('0x2c'));_0x18c4a6[_0x50d69e]('voice:outbound');if(queryQueues[_0x77a3('0x2d')]('include')){delete queryQueues[_0x77a3('0x2e')];}_0xc9451f[_0x77a3('0x2f')](db[_0x77a3('0x30')]['findAll'](queryQueues));_0xc9451f['push'](db[_0x77a3('0x31')]['findAll'](queryQueues));_0xc9451f[_0x77a3('0x2f')](db[_0x77a3('0x32')]['findAll'](queryQueues));_0xc9451f['push'](db[_0x77a3('0x33')][_0x77a3('0x14')](queryQueues));_0xc9451f[_0x77a3('0x2f')](db[_0x77a3('0x34')]['findAll'](queryQueues));_0xc9451f[_0x77a3('0x2f')](db[_0x77a3('0x35')]['findAll'](queryQueues));_0xc9451f[_0x77a3('0x2f')](db['WhatsappQueue'][_0x77a3('0x14')](queryQueues));_0xc9451f[_0x77a3('0x2f')](db[_0x77a3('0x18')][_0x77a3('0x14')](queryTelephones));_0xc9451f[_0x77a3('0x2f')](db[_0x77a3('0x36')][_0x77a3('0x14')](queryTrunks));_0xc9451f[_0x77a3('0x2f')](db[_0x77a3('0x19')]['findAll'](queryCampaigns));_0xc9451f['push'](db[_0x77a3('0x18')][_0x77a3('0x14')](queryAgents));break;case'user':_0x18c4a6[_0x50d69e](_0x77a3('0x2c'));_0x18c4a6[_0x50d69e](_0x77a3('0x37'));_0xc9451f[_0x77a3('0x2f')](getAssociatedResources(_0x77a3('0x10'),_0x16682c[_0x77a3('0x20')],_0x77a3('0x30')));_0xc9451f['push'](getAssociatedResources('ChatQueues',_0x16682c[_0x77a3('0x20')],'ChatQueue'));_0xc9451f[_0x77a3('0x2f')](getAssociatedResources('FaxQueues',_0x16682c['userProfileId'],_0x77a3('0x32')));_0xc9451f[_0x77a3('0x2f')](getAssociatedResources('SmsQueues',_0x16682c[_0x77a3('0x20')],'SmsQueue'));_0xc9451f[_0x77a3('0x2f')](getAssociatedResources(_0x77a3('0x38'),_0x16682c['userProfileId'],_0x77a3('0x34')));_0xc9451f[_0x77a3('0x2f')](getAssociatedResources(_0x77a3('0x39'),_0x16682c[_0x77a3('0x20')],_0x77a3('0x35')));_0xc9451f[_0x77a3('0x2f')](getAssociatedResources('WhatsappQueues',_0x16682c[_0x77a3('0x20')],_0x77a3('0x3a')));_0xc9451f[_0x77a3('0x2f')](getAssociatedResources('Telephones',_0x16682c['userProfileId'],_0x77a3('0x18')));_0xc9451f[_0x77a3('0x2f')](getAssociatedResources('Trunks',_0x16682c[_0x77a3('0x20')],_0x77a3('0x36')));_0xc9451f[_0x77a3('0x2f')](getAssociatedResources('IvrCampaigns',_0x16682c[_0x77a3('0x20')],_0x77a3('0x19')));_0xc9451f[_0x77a3('0x2f')](db[_0x77a3('0x18')][_0x77a3('0x14')](queryAgents));break;case _0x77a3('0x7'):_0x18c4a6[_0x50d69e]('voice:inbound');_0x18c4a6[_0x50d69e](_0x77a3('0x37'));_0xc9451f[_0x77a3('0x2f')](_0x16682c[_0x77a3('0x3b')]({'attributes':['id',_0x77a3('0x8')]}));_0xc9451f[_0x77a3('0x2f')](_0x16682c[_0x77a3('0x3c')]({'attributes':['id',_0x77a3('0x8')]}));_0xc9451f[_0x77a3('0x2f')](_0x16682c[_0x77a3('0x3d')]({'attributes':['id',_0x77a3('0x8')]}));_0xc9451f['push'](_0x16682c[_0x77a3('0x3e')]({'attributes':['id','name']}));_0xc9451f['push'](_0x16682c['getMailQueues']({'attributes':['id',_0x77a3('0x8')]}));_0xc9451f[_0x77a3('0x2f')](_0x16682c[_0x77a3('0x3f')]({'attributes':['id',_0x77a3('0x8')]}));_0xc9451f[_0x77a3('0x2f')](_0x16682c[_0x77a3('0x40')]({'attributes':['id','name']}));break;}return BPromise[_0x77a3('0x41')](_0xc9451f);}})['then'](function(_0x325e89){if(_0x325e89&&_0x325e89[_0x77a3('0x42')]){for(var _0x4610af=0x0;_0x4610af<_0x325e89['length'];_0x4610af+=0x1){for(var _0x4edab4=0x0;_0x4edab4<_0x325e89[_0x4610af][_0x77a3('0x42')];_0x4edab4+=0x1){switch(_0x4610af){case 0x0:joinOrLeaveQueues(_0x18c4a6,_0x50d69e,_0x77a3('0x43'),_0x325e89[_0x4610af][_0x4edab4]);break;case 0x1:joinOrLeaveQueues(_0x18c4a6,_0x50d69e,_0x77a3('0x44'),_0x325e89[_0x4610af][_0x4edab4]);break;case 0x2:joinOrLeaveQueues(_0x18c4a6,_0x50d69e,'fax',_0x325e89[_0x4610af][_0x4edab4]);break;case 0x3:joinOrLeaveQueues(_0x18c4a6,_0x50d69e,_0x77a3('0x45'),_0x325e89[_0x4610af][_0x4edab4]);break;case 0x4:joinOrLeaveQueues(_0x18c4a6,_0x50d69e,'mail',_0x325e89[_0x4610af][_0x4edab4]);break;case 0x5:joinOrLeaveQueues(_0x18c4a6,_0x50d69e,_0x77a3('0x46'),_0x325e89[_0x4610af][_0x4edab4]);break;case 0x6:joinOrLeaveQueues(_0x18c4a6,_0x50d69e,_0x77a3('0x47'),_0x325e89[_0x4610af][_0x4edab4]);break;case 0x7:_0x18c4a6[_0x50d69e](util[_0x77a3('0x1b')](_0x77a3('0x48'),_0x325e89[_0x4610af][_0x4edab4][_0x77a3('0x8')]));break;case 0x8:_0x18c4a6[_0x50d69e](util[_0x77a3('0x1b')]('trunk:%s',_0x325e89[_0x4610af][_0x4edab4]['name']));break;case 0x9:_0x18c4a6[_0x50d69e](util[_0x77a3('0x1b')](_0x77a3('0x49'),_0x325e89[_0x4610af][_0x4edab4][_0x77a3('0xa')],_0x325e89[_0x4610af][_0x4edab4][_0x77a3('0x8')]));break;case 0xa:_0x18c4a6[_0x50d69e](util['format'](_0x77a3('0x1d'),_0x325e89[_0x4610af][_0x4edab4][_0x77a3('0x8')]));break;}}}}})[_0x77a3('0xe')](function(){if(_0x50d69e==='leave'){var _0x28118a=_['map'](_0x35ff7f[_0x77a3('0x22')],'id');return _0x35ff7f[_0x77a3('0x4a')](_0x28118a)[_0x77a3('0xe')](function(){for(var _0x3a4f47=0x0;_0x3a4f47<_0x28118a['length'];_0x3a4f47+=0x1){_0x1d72c9[_0x77a3('0x4b')](_0x77a3('0x4c'),{'ChatInteractionId':Number(_0x28118a[_0x3a4f47]),'UserId':Number(_0x35ff7f['id'])});}});}})[_0x77a3('0xe')](function(){if(_0x50d69e===_0x77a3('0x4d')){var _0x5026e7=_[_0x77a3('0x17')](_0x35ff7f[_0x77a3('0x4e')],'id');return _0x35ff7f[_0x77a3('0x4f')](_0x5026e7)[_0x77a3('0xe')](function(){for(var _0x300683=0x0;_0x300683<_0x5026e7['length'];_0x300683+=0x1){_0x1d72c9[_0x77a3('0x4b')](_0x77a3('0x50'),{'MailInteractionId':Number(_0x5026e7[_0x300683]),'UserId':Number(_0x35ff7f['id'])});}});}})[_0x77a3('0xe')](function(){if(_0x50d69e===_0x77a3('0x4d')){var _0x2fd6a5=_[_0x77a3('0x17')](_0x35ff7f[_0x77a3('0x25')],'id');return _0x35ff7f['removeFaxInteractions'](_0x2fd6a5)[_0x77a3('0xe')](function(){for(var _0x4f945f=0x0;_0x4f945f<_0x2fd6a5[_0x77a3('0x42')];_0x4f945f+=0x1){_0x1d72c9['emit'](_0x77a3('0x51'),{'FaxInteractionId':Number(_0x2fd6a5[_0x4f945f]),'UserId':Number(_0x35ff7f['id'])});}});}})[_0x77a3('0xe')](function(){if(_0x50d69e===_0x77a3('0x4d')){var _0x191cd8=_[_0x77a3('0x17')](_0x35ff7f[_0x77a3('0x27')],'id');return _0x35ff7f[_0x77a3('0x52')](_0x191cd8)[_0x77a3('0xe')](function(){for(var _0x9bcad1=0x0;_0x9bcad1<_0x191cd8['length'];_0x9bcad1+=0x1){_0x1d72c9[_0x77a3('0x4b')](_0x77a3('0x53'),{'SmsInteractionId':Number(_0x191cd8[_0x9bcad1]),'UserId':Number(_0x35ff7f['id'])});}});}})[_0x77a3('0xe')](function(){if(_0x50d69e===_0x77a3('0x4d')){var _0x5183e8=_[_0x77a3('0x17')](_0x35ff7f[_0x77a3('0x28')],'id');return _0x35ff7f[_0x77a3('0x54')](_0x5183e8)[_0x77a3('0xe')](function(){for(var _0x27434b=0x0;_0x27434b<_0x5183e8['length'];_0x27434b+=0x1){_0x1d72c9[_0x77a3('0x4b')](_0x77a3('0x55'),{'OpenchannelInteractionId':Number(_0x5183e8[_0x27434b]),'UserId':Number(_0x35ff7f['id'])});}});}})[_0x77a3('0xe')](function(){if(_0x50d69e===_0x77a3('0x4d')){var _0x113ff8=_[_0x77a3('0x17')](_0x35ff7f['WhatsappInteractions'],'id');return _0x35ff7f[_0x77a3('0x56')](_0x113ff8)[_0x77a3('0xe')](function(){for(var _0x38621f=0x0;_0x38621f<_0x113ff8['length'];_0x38621f+=0x1){_0x1d72c9[_0x77a3('0x4b')](_0x77a3('0x57'),{'WhatsappInteractionId':Number(_0x113ff8[_0x38621f]),'UserId':Number(_0x35ff7f['id'])});}});}})[_0x77a3('0x58')](function(_0x981355){_0x18c4a6[_0x77a3('0x59')](_0x981355);});}}function onDisconnect(_0x6a68c0,_0x1555a5){joinOrLeave(_0x6a68c0,_0x77a3('0x4d'),_0x1555a5);}function onConnect(_0x12684a){joinOrLeave(_0x12684a,_0x77a3('0x5a'));}exports['default']=function(_0x563a92){_0x563a92['on'](_0x77a3('0x5b'),function(_0x18e7fb){_0x18e7fb[_0x77a3('0x5c')](0x0);_0x18e7fb[_0x77a3('0x5d')]=_0x18e7fb[_0x77a3('0x5e')][_0x77a3('0x5b')]['remoteAddress']+':'+_0x18e7fb['request'][_0x77a3('0x5b')]['remotePort'];_0x18e7fb['connectedAt']=new Date();_0x18e7fb[_0x77a3('0x59')]=function(_0x6feaf9){console[_0x77a3('0x59')](_0x77a3('0x5f')+_0x18e7fb[_0x77a3('0x60')][_0x77a3('0x8')]+'['+_0x18e7fb[_0x77a3('0x5d')]+']',_0x6feaf9);};_0x18e7fb['on'](_0x77a3('0x61'),function(){onDisconnect(_0x18e7fb,_0x563a92);_0x18e7fb['log']('DISCONNECTED');});onConnect(_0x18e7fb);_0x18e7fb['log'](_0x77a3('0x62'));});}; \ No newline at end of file +var _0x8510=['removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','setMaxListeners','address','connection','remoteAddress','request','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','Agents','name','agent','telephone','type','UserProfileSection','findOne','VoiceQueues','ChatQueues','MailQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','Campaign','where','format','%s:queue:%s','length','query','User','find','role','handshake','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','voice:inbound','userProfileId','FaxQueues','FaxQueue','SmsQueues','OpenchannelQueues','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','removeFaxInteractions'];(function(_0x55ff79,_0x3d45e7){var _0x579067=function(_0x3650e4){while(--_0x3650e4){_0x55ff79['push'](_0x55ff79['shift']());}};_0x579067(++_0x3d45e7);}(_0x8510,0xe0));var _0x0851=function(_0x139790,_0x466283){_0x139790=_0x139790-0x0;var _0x23d99d=_0x8510[_0x139790];return _0x23d99d;};'use strict';var _=require(_0x0851('0x0'));var util=require(_0x0851('0x1'));var BPromise=require('bluebird');var db=require(_0x0851('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x0851('0x3'),'model':db['User'],'attributes':['id',_0x0851('0x4'),'role'],'raw':!![],'where':{'role':_0x0851('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0851('0x4')],'where':{'role':_0x0851('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0851('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x0851('0x4')],'where':{'role':_0x0851('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x0851('0x7')],'where':{'type':'ivr'}};function getAssociatedResources(_0x2e94b4,_0x45f59e,_0x129ef2){return db[_0x0851('0x8')][_0x0851('0x9')]({'where':{'name':_0x2e94b4,'userProfileId':_0x45f59e},'raw':!![]})['then'](function(_0x4c9fe1){if(_0x4c9fe1){if(_0x4c9fe1['autoAssociation']){switch(_0x2e94b4){case _0x0851('0xa'):case _0x0851('0xb'):case'FaxQueues':case'SmsQueues':case _0x0851('0xc'):case'OpenchannelQueues':case _0x0851('0xd'):return db[_0x129ef2]['findAll'](queryQueues);case _0x0851('0xe'):return db[_0x129ef2][_0x0851('0xf')](queryTelephones);case _0x0851('0x10'):return db[_0x129ef2][_0x0851('0xf')](queryTrunks);case _0x0851('0x11'):return db[_0x129ef2]['findAll'](queryCampaigns);}}else{return db[_0x0851('0x12')][_0x0851('0xf')]({'attributes':[_0x0851('0x13')],'where':{'sectionId':_0x4c9fe1['id']},'raw':!![]})[_0x0851('0x14')](function(_0x40c87e){if(_0x40c87e){var _0x351dee={'where':{'id':_['map'](_0x40c87e,_0x0851('0x13'))},'raw':!![]};switch(_0x129ef2){case'User':_0x351dee['where']['role']=_0x0851('0x6');break;case _0x0851('0x15'):_0x351dee[_0x0851('0x16')][_0x0851('0x7')]='ivr';break;}return db[_0x129ef2][_0x0851('0xf')](_0x351dee);}else{return[];}});}}else{return[];}})[_0x0851('0x14')](function(_0x15fb6c){return _0x15fb6c;});}function joinOrLeaveQueues(_0x169625,_0x446947,_0x56f6dd,_0xa70b12){_0x169625[_0x446947](util[_0x0851('0x17')](_0x0851('0x18'),_0x56f6dd,_0xa70b12[_0x0851('0x4')]));if(_0xa70b12[_0x0851('0x3')]){for(var _0xe56eca=0x0;_0xe56eca<_0xa70b12['Agents'][_0x0851('0x19')];_0xe56eca+=0x1){_0x169625[_0x446947](util['format']('user:%s',_0xa70b12[_0x0851('0x3')][_0xe56eca][_0x0851('0x4')]));}}}function joinOrLeave(_0x409788,_0x701000,_0x15ebec){var _0x5cf0af;if(_0x409788['handshake'][_0x0851('0x1a')]['id']){db[_0x0851('0x1b')][_0x0851('0x1c')]({'attributes':['id',_0x0851('0x4'),_0x0851('0x1d'),'userProfileId'],'where':{'id':_0x409788[_0x0851('0x1e')][_0x0851('0x1a')]['id']},'include':[{'model':db[_0x0851('0x1f')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x0851('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x0851('0x21')],'as':_0x0851('0x22'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x0851('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x0851('0x24')],'as':_0x0851('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x0851('0x26')],'as':_0x0851('0x27'),'attributes':['id'],'raw':!![]}]})[_0x0851('0x14')](function(_0x325ce5){if(_0x325ce5){_0x5cf0af=_0x325ce5;_0x409788[_0x701000](util[_0x0851('0x17')](_0x0851('0x28'),_0x325ce5[_0x0851('0x4')]));var _0x5e1100=[];switch(_0x325ce5[_0x0851('0x1d')]){case _0x0851('0x29'):_0x409788[_0x701000]('voice:inbound');_0x409788[_0x701000](_0x0851('0x2a'));if(queryQueues[_0x0851('0x2b')]('include')){delete queryQueues[_0x0851('0x2c')];}_0x5e1100['push'](db[_0x0851('0x2d')]['findAll'](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x2f')][_0x0851('0xf')](queryQueues));_0x5e1100[_0x0851('0x2e')](db['FaxQueue'][_0x0851('0xf')](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x30')][_0x0851('0xf')](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x31')][_0x0851('0xf')](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x32')]['findAll'](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x33')][_0x0851('0xf')](queryQueues));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x1b')]['findAll'](queryTelephones));_0x5e1100[_0x0851('0x2e')](db['Trunk'][_0x0851('0xf')](queryTrunks));_0x5e1100[_0x0851('0x2e')](db[_0x0851('0x15')][_0x0851('0xf')](queryCampaigns));_0x5e1100[_0x0851('0x2e')](db['User'][_0x0851('0xf')](queryAgents));break;case'user':_0x409788[_0x701000](_0x0851('0x34'));_0x409788[_0x701000]('voice:outbound');_0x5e1100[_0x0851('0x2e')](getAssociatedResources('VoiceQueues',_0x325ce5[_0x0851('0x35')],_0x0851('0x2d')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0xb'),_0x325ce5[_0x0851('0x35')],_0x0851('0x2f')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0x36'),_0x325ce5[_0x0851('0x35')],_0x0851('0x37')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0x38'),_0x325ce5['userProfileId'],_0x0851('0x30')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0xc'),_0x325ce5[_0x0851('0x35')],_0x0851('0x31')));_0x5e1100['push'](getAssociatedResources(_0x0851('0x39'),_0x325ce5[_0x0851('0x35')],'OpenchannelQueue'));_0x5e1100['push'](getAssociatedResources(_0x0851('0xd'),_0x325ce5[_0x0851('0x35')],_0x0851('0x33')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0xe'),_0x325ce5[_0x0851('0x35')],'User'));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0x10'),_0x325ce5[_0x0851('0x35')],_0x0851('0x3a')));_0x5e1100[_0x0851('0x2e')](getAssociatedResources(_0x0851('0x11'),_0x325ce5[_0x0851('0x35')],'Campaign'));_0x5e1100['push'](db[_0x0851('0x1b')][_0x0851('0xf')](queryAgents));break;case'agent':_0x409788[_0x701000](_0x0851('0x34'));_0x409788[_0x701000]('voice:outbound');_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x3b')]({'attributes':['id',_0x0851('0x4')]}));_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x3c')]({'attributes':['id','name']}));_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x3d')]({'attributes':['id',_0x0851('0x4')]}));_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x3e')]({'attributes':['id',_0x0851('0x4')]}));_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x3f')]({'attributes':['id',_0x0851('0x4')]}));_0x5e1100['push'](_0x325ce5[_0x0851('0x40')]({'attributes':['id','name']}));_0x5e1100[_0x0851('0x2e')](_0x325ce5[_0x0851('0x41')]({'attributes':['id',_0x0851('0x4')]}));break;}return BPromise[_0x0851('0x42')](_0x5e1100);}})[_0x0851('0x14')](function(_0x1b0914){if(_0x1b0914&&_0x1b0914['length']){for(var _0x5b21ab=0x0;_0x5b21ab<_0x1b0914[_0x0851('0x19')];_0x5b21ab+=0x1){for(var _0x18b433=0x0;_0x18b433<_0x1b0914[_0x5b21ab][_0x0851('0x19')];_0x18b433+=0x1){switch(_0x5b21ab){case 0x0:joinOrLeaveQueues(_0x409788,_0x701000,_0x0851('0x43'),_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x1:joinOrLeaveQueues(_0x409788,_0x701000,_0x0851('0x44'),_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x2:joinOrLeaveQueues(_0x409788,_0x701000,_0x0851('0x45'),_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x3:joinOrLeaveQueues(_0x409788,_0x701000,'sms',_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x4:joinOrLeaveQueues(_0x409788,_0x701000,_0x0851('0x46'),_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x5:joinOrLeaveQueues(_0x409788,_0x701000,_0x0851('0x47'),_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x6:joinOrLeaveQueues(_0x409788,_0x701000,'whatsapp',_0x1b0914[_0x5b21ab][_0x18b433]);break;case 0x7:_0x409788[_0x701000](util[_0x0851('0x17')](_0x0851('0x48'),_0x1b0914[_0x5b21ab][_0x18b433]['name']));break;case 0x8:_0x409788[_0x701000](util[_0x0851('0x17')](_0x0851('0x49'),_0x1b0914[_0x5b21ab][_0x18b433][_0x0851('0x4')]));break;case 0x9:_0x409788[_0x701000](util[_0x0851('0x17')](_0x0851('0x4a'),_0x1b0914[_0x5b21ab][_0x18b433][_0x0851('0x7')],_0x1b0914[_0x5b21ab][_0x18b433][_0x0851('0x4')]));break;case 0xa:_0x409788[_0x701000](util[_0x0851('0x17')]('user:%s',_0x1b0914[_0x5b21ab][_0x18b433][_0x0851('0x4')]));break;}}}}})[_0x0851('0x14')](function(){if(_0x701000===_0x0851('0x4b')){var _0x477909=_[_0x0851('0x4c')](_0x5cf0af['ChatInteractions'],'id');return _0x5cf0af[_0x0851('0x4d')](_0x477909)[_0x0851('0x14')](function(){for(var _0x2e4600=0x0;_0x2e4600<_0x477909[_0x0851('0x19')];_0x2e4600+=0x1){_0x15ebec['emit'](_0x0851('0x4e'),{'ChatInteractionId':Number(_0x477909[_0x2e4600]),'UserId':Number(_0x5cf0af['id'])});}});}})[_0x0851('0x14')](function(){if(_0x701000==='leave'){var _0x20a33f=_[_0x0851('0x4c')](_0x5cf0af['MailInteractions'],'id');return _0x5cf0af['removeMailInteractions'](_0x20a33f)[_0x0851('0x14')](function(){for(var _0xb8f8f6=0x0;_0xb8f8f6<_0x20a33f[_0x0851('0x19')];_0xb8f8f6+=0x1){_0x15ebec[_0x0851('0x4f')](_0x0851('0x50'),{'MailInteractionId':Number(_0x20a33f[_0xb8f8f6]),'UserId':Number(_0x5cf0af['id'])});}});}})[_0x0851('0x14')](function(){if(_0x701000==='leave'){var _0x1b33b3=_[_0x0851('0x4c')](_0x5cf0af[_0x0851('0x22')],'id');return _0x5cf0af[_0x0851('0x51')](_0x1b33b3)[_0x0851('0x14')](function(){for(var _0x42c01c=0x0;_0x42c01c<_0x1b33b3['length'];_0x42c01c+=0x1){_0x15ebec[_0x0851('0x4f')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x1b33b3[_0x42c01c]),'UserId':Number(_0x5cf0af['id'])});}});}})['then'](function(){if(_0x701000===_0x0851('0x4b')){var _0x3e925b=_['map'](_0x5cf0af[_0x0851('0x23')],'id');return _0x5cf0af[_0x0851('0x52')](_0x3e925b)[_0x0851('0x14')](function(){for(var _0x33ac68=0x0;_0x33ac68<_0x3e925b[_0x0851('0x19')];_0x33ac68+=0x1){_0x15ebec[_0x0851('0x4f')](_0x0851('0x53'),{'SmsInteractionId':Number(_0x3e925b[_0x33ac68]),'UserId':Number(_0x5cf0af['id'])});}});}})[_0x0851('0x14')](function(){if(_0x701000==='leave'){var _0x2379ea=_['map'](_0x5cf0af['OpenchannelInteractions'],'id');return _0x5cf0af[_0x0851('0x54')](_0x2379ea)[_0x0851('0x14')](function(){for(var _0x3b1cfb=0x0;_0x3b1cfb<_0x2379ea[_0x0851('0x19')];_0x3b1cfb+=0x1){_0x15ebec['emit'](_0x0851('0x55'),{'OpenchannelInteractionId':Number(_0x2379ea[_0x3b1cfb]),'UserId':Number(_0x5cf0af['id'])});}});}})[_0x0851('0x14')](function(){if(_0x701000===_0x0851('0x4b')){var _0x410896=_[_0x0851('0x4c')](_0x5cf0af[_0x0851('0x27')],'id');return _0x5cf0af[_0x0851('0x56')](_0x410896)[_0x0851('0x14')](function(){for(var _0x94f7e3=0x0;_0x94f7e3<_0x410896['length'];_0x94f7e3+=0x1){_0x15ebec['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x410896[_0x94f7e3]),'UserId':Number(_0x5cf0af['id'])});}});}})[_0x0851('0x57')](function(_0x20bc6f){_0x409788['log'](_0x20bc6f);});}}function onDisconnect(_0x20e72e,_0x583e18){joinOrLeave(_0x20e72e,_0x0851('0x4b'),_0x583e18);}function onConnect(_0x26e983){joinOrLeave(_0x26e983,_0x0851('0x58'));}exports['default']=function(_0x5d9985){_0x5d9985['on']('connection',function(_0x9b2279){_0x9b2279[_0x0851('0x59')](0x0);_0x9b2279[_0x0851('0x5a')]=_0x9b2279['request'][_0x0851('0x5b')][_0x0851('0x5c')]+':'+_0x9b2279[_0x0851('0x5d')][_0x0851('0x5b')][_0x0851('0x5e')];_0x9b2279[_0x0851('0x5f')]=new Date();_0x9b2279[_0x0851('0x60')]=function(_0x55988c){console[_0x0851('0x60')](_0x0851('0x61')+_0x9b2279[_0x0851('0x62')][_0x0851('0x4')]+'['+_0x9b2279['address']+']',_0x55988c);};_0x9b2279['on'](_0x0851('0x63'),function(){onDisconnect(_0x9b2279,_0x5d9985);_0x9b2279['log'](_0x0851('0x64'));});onConnect(_0x9b2279);_0x9b2279[_0x0851('0x60')](_0x0851('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index bfc8c2c..a83ac2b 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 _0xe3e7=['afterUpdate','newmessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','closedinteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','catch','get','channel','direction','User','UserId','name','interface','format','SIP/%s','incomingmessage','outgoingmessage','closed','event','find','default','hasOwnProperty','model','hook','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction'];(function(_0x2f14f3,_0x2a1de2){var _0x409e04=function(_0x1a67d8){while(--_0x1a67d8){_0x2f14f3['push'](_0x2f14f3['shift']());}};_0x409e04(++_0x2a1de2);}(_0xe3e7,0x176));var _0x7e3e=function(_0x191d4e,_0x49cab7){_0x191d4e=_0x191d4e-0x0;var _0x302b5b=_0xe3e7[_0x191d4e];return _0x302b5b;};'use strict';var util=require(_0x7e3e('0x0'));var db=require(_0x7e3e('0x1'))['db'];var jayson=require(_0x7e3e('0x2'));var logger=require(_0x7e3e('0x3'))(_0x7e3e('0x4'));var client=jayson[_0x7e3e('0x5')][_0x7e3e('0x6')]({'port':0x232a});var triggers=[{'channel':_0x7e3e('0x7'),'model':_0x7e3e('0x8'),'event':_0x7e3e('0x9'),'condition':_0x7e3e('0xa'),'callback':afterCreate},{'channel':'Chat','model':_0x7e3e('0x8'),'event':_0x7e3e('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7e3e('0x7'),'model':'ChatMessage','event':_0x7e3e('0x9'),'condition':_0x7e3e('0xc'),'callback':afterCreateMessage},{'channel':_0x7e3e('0xd'),'model':_0x7e3e('0xe'),'event':_0x7e3e('0x9'),'condition':_0x7e3e('0xa'),'callback':afterCreate},{'channel':'Sms','model':'SmsInteraction','event':_0x7e3e('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x7e3e('0xf'),'event':_0x7e3e('0x9'),'condition':_0x7e3e('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x7e3e('0x10'),'event':_0x7e3e('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0x7e3e('0x10'),'event':_0x7e3e('0xb'),'condition':_0x7e3e('0x11'),'callback':afterUpdate},{'channel':_0x7e3e('0x12'),'model':_0x7e3e('0x13'),'event':_0x7e3e('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x7e3e('0x14'),'model':'FaxInteraction','event':_0x7e3e('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x7e3e('0x14'),'model':_0x7e3e('0x15'),'event':_0x7e3e('0xb'),'condition':_0x7e3e('0x11'),'callback':afterUpdate},{'channel':_0x7e3e('0x14'),'model':'FaxMessage','event':_0x7e3e('0x9'),'condition':_0x7e3e('0xc'),'callback':afterCreateMessage},{'channel':_0x7e3e('0x16'),'model':_0x7e3e('0x17'),'event':_0x7e3e('0x9'),'condition':_0x7e3e('0xa'),'callback':afterCreate},{'channel':_0x7e3e('0x16'),'model':_0x7e3e('0x17'),'event':_0x7e3e('0xb'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x7e3e('0x16'),'model':_0x7e3e('0x18'),'event':_0x7e3e('0x9'),'condition':_0x7e3e('0xc'),'callback':afterCreateMessage},{'channel':_0x7e3e('0x19'),'model':_0x7e3e('0x1a'),'event':_0x7e3e('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x7e3e('0x19'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x7e3e('0x11'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x7e3e('0x1b'),'event':_0x7e3e('0x9'),'condition':_0x7e3e('0xc'),'callback':afterCreateMessage}];function request(_0x57030f){return client[_0x7e3e('0x1c')](_0x7e3e('0x1d'),_0x57030f)[_0x7e3e('0x1e')](function(_0xefb8d0){logger[_0x7e3e('0x1f')](_0x7e3e('0x20'),_0x7e3e('0x1d'),_0xefb8d0);if(_0xefb8d0[_0x7e3e('0x21')]){if(_0xefb8d0[_0x7e3e('0x21')]['code']===0x1f4){logger[_0x7e3e('0x21')](_0x7e3e('0x20'),'EventManager',_0xefb8d0[_0x7e3e('0x21')]);}}})[_0x7e3e('0x22')](function(_0x6ae826){logger[_0x7e3e('0x21')](_0x7e3e('0x20'),'EventManager',_0x6ae826);});}function afterCreateMessage(_0x67b124,_0x3496ea){return function(_0x5d312d,_0x5ab4ba){_0x5d312d=_0x5d312d[_0x7e3e('0x23')]({'plain':!![]});_0x5d312d[_0x7e3e('0x24')]=_0x67b124;_0x5d312d['event']=_0x5d312d[_0x7e3e('0x25')];if(_0x5d312d['UserId']){return db[_0x7e3e('0x26')]['find']({'where':{'id':_0x5d312d[_0x7e3e('0x27')]},'attributes':['id',_0x7e3e('0x28')],'raw':!![]})['then'](function(_0x5ac7ad){_0x5d312d[_0x7e3e('0x29')]=util[_0x7e3e('0x2a')](_0x7e3e('0x2b'),_0x5ac7ad['name']);_0x5d312d[_0x7e3e('0x24')]=_0x67b124;return request({'event':_0x7e3e('0x2c'),'message':_0x5d312d});})[_0x7e3e('0x22')](function(_0x14e47f){console[_0x7e3e('0x21')](_0x14e47f);});}else{return request({'event':_0x7e3e('0x2d'),'message':_0x5d312d});}};}function afterCreate(_0x1a7487,_0x46e00b){return function(_0x4b6fa3,_0x11e936){_0x4b6fa3=_0x4b6fa3[_0x7e3e('0x23')]({'plain':!![]});_0x4b6fa3[_0x7e3e('0x24')]=_0x1a7487;_0x4b6fa3['event']='opened';return request({'event':_0x46e00b,'message':_0x4b6fa3});};}function afterUpdate(_0x536ca4,_0x469fe3){return function(_0x410ff6,_0x52bd4d){if(_0x410ff6['changed'](_0x7e3e('0x2e'))&&_0x410ff6[_0x7e3e('0x2e')]){_0x410ff6=_0x410ff6[_0x7e3e('0x23')]({'plain':!![]});_0x410ff6[_0x7e3e('0x24')]=_0x536ca4;_0x410ff6[_0x7e3e('0x2f')]=_0x7e3e('0x2e');if(_0x410ff6['UserId']){return db[_0x7e3e('0x26')][_0x7e3e('0x30')]({'where':{'id':_0x410ff6[_0x7e3e('0x27')]},'attributes':['id',_0x7e3e('0x28')],'raw':!![]})[_0x7e3e('0x1e')](function(_0x11c68d){_0x410ff6[_0x7e3e('0x29')]=util[_0x7e3e('0x2a')](_0x7e3e('0x2b'),_0x11c68d['name']);return request({'event':_0x469fe3,'message':_0x410ff6});})[_0x7e3e('0x22')](function(_0x4e07d2){console[_0x7e3e('0x21')](_0x4e07d2);});}else{return request({'event':_0x469fe3,'message':_0x410ff6});}}};}exports[_0x7e3e('0x31')]=function(){for(var _0x536682=0x0;_0x536682=_0x35749d['agents']){throw Error(_0xd33a('0x16'));}_0x4e1caf(_0x53d676);})[_0xd33a('0x17')](function(_0x4178e8){_0xc4519(_0x4178e8);});});}; \ No newline at end of file +var _0xe030=['whatsapp','openchannel','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','role','agent','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice','mail','chat','fax','sms'];(function(_0x80b9b7,_0x6222b){var _0x50a348=function(_0x32496a){while(--_0x32496a){_0x80b9b7['push'](_0x80b9b7['shift']());}};_0x50a348(++_0x6222b);}(_0xe030,0x142));var _0x0e03=function(_0xb83515,_0x15f73b){_0xb83515=_0xb83515-0x0;var _0x57dc1f=_0xe030[_0xb83515];return _0x57dc1f;};'use strict';var _=require(_0x0e03('0x0'));var BPromise=require('bluebird');var db=require(_0x0e03('0x1'))['db'];var util=require(_0x0e03('0x2'));var channels=[_0x0e03('0x3'),_0x0e03('0x4'),_0x0e03('0x5'),_0x0e03('0x6'),_0x0e03('0x7'),_0x0e03('0x8'),_0x0e03('0x9')];exports['getChannels']=function(){return channels;};exports[_0x0e03('0xa')]=function(_0x54a80){_0x54a80=_0x54a80['toLowerCase']();return _[_0x0e03('0xb')](channels,_0x54a80);};exports[_0x0e03('0xc')]=function(_0x1b9c09,_0x5eea55,_0x3b410b,_0x3d024e){var _0x2721f4={'loginAttempts':_0x5eea55,'blocked':_0x3b410b};if(!_[_0x0e03('0xd')](_0x3d024e)){_0x2721f4[_0x0e03('0xe')]=_0x3d024e;}return _0x1b9c09['updateAttributes'](_0x2721f4);};exports['getLicense']=function(_0x47d732){return new BPromise(function(_0x541d36,_0xb89d8c){var _0x5e4145=0x0;if(_0x47d732[_0x0e03('0xf')]!=='agent'){_0x541d36(_0x47d732);}db['User']['count']({'where':{'role':_0x0e03('0x10'),'online':!![],'id':{'$ne':_0x47d732['id']}}})[_0x0e03('0x11')](function(_0x2c90e5){_0x5e4145=_0x2c90e5;return util[_0x0e03('0x12')]();})[_0x0e03('0x11')](function(_0x3b112f){if(_0x3b112f&&_0x3b112f[_0x0e03('0x13')]&&_0x5e4145>=_0x3b112f[_0x0e03('0x13')]){throw Error(_0x0e03('0x14'));}_0x541d36(_0x47d732);})[_0x0e03('0x15')](function(_0x2430dc){_0xb89d8c(_0x2430dc);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index ab8120f..b0b78fa 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9813=['json','send','status','render'];(function(_0x488f4b,_0x2739f3){var _0x14abcc=function(_0x40f0e7){while(--_0x40f0e7){_0x488f4b['push'](_0x488f4b['shift']());}};_0x14abcc(++_0x2739f3);}(_0x9813,0xfa));var _0x3981=function(_0x54fc1f,_0x1703c2){_0x54fc1f=_0x54fc1f-0x0;var _0x53f699=_0x9813[_0x54fc1f];return _0x53f699;};'use strict';module['exports'][0x194]=function pageNotFound(_0x398f91,_0x19fcab){var _0x3ef66d='404';var _0x21e5c8=0x194;var _0x48bcb3={'status':_0x21e5c8};_0x19fcab[_0x3981('0x0')](_0x48bcb3[_0x3981('0x0')]);_0x19fcab[_0x3981('0x1')](_0x3ef66d,{},function(_0x57b9f1,_0x4bd9e8){if(_0x57b9f1){return _0x19fcab[_0x3981('0x0')](_0x48bcb3[_0x3981('0x0')])[_0x3981('0x2')](_0x48bcb3);}_0x19fcab[_0x3981('0x3')](_0x4bd9e8);});}; \ No newline at end of file +var _0x9677=['404','status','render','json','exports'];(function(_0x382697,_0x26775e){var _0x51c523=function(_0x5dc923){while(--_0x5dc923){_0x382697['push'](_0x382697['shift']());}};_0x51c523(++_0x26775e);}(_0x9677,0x12b));var _0x7967=function(_0x4cd685,_0x472697){_0x4cd685=_0x4cd685-0x0;var _0x37743e=_0x9677[_0x4cd685];return _0x37743e;};'use strict';module[_0x7967('0x0')][0x194]=function pageNotFound(_0x4c3b2d,_0x1a7efc){var _0x29de52=_0x7967('0x1');var _0xcf096=0x194;var _0x50c80f={'status':_0xcf096};_0x1a7efc['status'](_0x50c80f[_0x7967('0x2')]);_0x1a7efc[_0x7967('0x3')](_0x29de52,{},function(_0x1875dd,_0x5072b8){if(_0x1875dd){return _0x1a7efc[_0x7967('0x2')](_0x50c80f[_0x7967('0x2')])[_0x7967('0x4')](_0x50c80f);}_0x1a7efc['send'](_0x5072b8);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index fa9fa1c..062ef37 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51f2=['../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','VoiceMail','UserId','hasMany','VoiceRecording','VoiceExtension','Extensions','cascade','HopperFinals','HopperHistory','OpenchannelInteraction','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','FaxQueues','UserFaxQueue','SmsQueue','SmsQueues','OpenchannelQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','VoiceCallReport','uniqueid','ContactId','MailAccountId','hasOne','MailServerIn','Imap','Smtp','Dispositions','Interactions','List','team_has_mail_queues','MailInteractionId','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Interaction','restrict','IntervalId','TagId','ListId','Items','FaxAccountId','Answers','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CompanyId','CmHopper','CmCompany','Company','cm_user_has_contacts','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','Intervals','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Fields','MetricId','Configurations','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Variable','VariableId','SugarcrmAccount','Description','Field','int_desk_configuration_has_tags','ZohoField','Subjects','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Account','FreshsalesField','FromId','SessionId','ProjectId','MailQueues','ChatQueues','team_has_whatsapp_queues','WhatsappQueues','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','userProfileId','UserProfileSections','UserProfileResource','Resources','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','WhatsappQueueReport','ToQueueId','UserWhatsappQueue','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','motion2','name','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction'];(function(_0x160c72,_0x54a499){var _0x4a5192=function(_0x433457){while(--_0x433457){_0x160c72['push'](_0x160c72['shift']());}};_0x4a5192(++_0x54a499);}(_0x51f2,0xeb));var _0x251f=function(_0x279268,_0x3f4dd2){_0x279268=_0x279268-0x0;var _0x5e8650=_0x51f2[_0x279268];return _0x5e8650;};'use strict';var path=require(_0x251f('0x0'));var config=require(_0x251f('0x1'));var Sequelize=require(_0x251f('0x2'));var _=require(_0x251f('0x3'));var jstz=require(_0x251f('0x4'));var timezone=jstz[_0x251f('0x5')]();config[_0x251f('0x2')]=_[_0x251f('0x6')](config[_0x251f('0x2')],{'database':'motion2','username':_0x251f('0x7'),'password':_0x251f('0x8'),'options':{'host':_0x251f('0x9'),'port':0xcea,'dialect':_0x251f('0xa'),'dialectOptions':{'charset':_0x251f('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x251f('0xc'),'collate':_0x251f('0xd')}}});config[_0x251f('0xe')]=_[_0x251f('0x6')](config['sequelizeHistory'],{'database':_0x251f('0xf'),'username':_0x251f('0x7'),'password':_0x251f('0x8'),'options':{'host':_0x251f('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x251f('0xb')},'logging':![],'timezone':timezone[_0x251f('0x10')](),'define':{'charset':_0x251f('0xc'),'collate':_0x251f('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x251f('0x11')],config[_0x251f('0x2')][_0x251f('0x12')],config[_0x251f('0x2')][_0x251f('0x13')],config[_0x251f('0x2')][_0x251f('0x14')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x251f('0xe')][_0x251f('0x11')],config[_0x251f('0xe')][_0x251f('0x12')],config['sequelizeHistory'][_0x251f('0x13')],config[_0x251f('0xe')]['options'])};db[_0x251f('0x15')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x17'));db[_0x251f('0x18')]=db['sequelize']['import'](_0x251f('0x19'));db[_0x251f('0x1a')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x1b'));db['VoiceExtension']=db[_0x251f('0x2')][_0x251f('0x16')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x1c'));db[_0x251f('0x1d')]=db[_0x251f('0x2')]['import'](_0x251f('0x1e'));db['VoiceRecording']=db['sequelize'][_0x251f('0x16')](_0x251f('0x1f'));db['ScreenRecording']=db['sequelize'][_0x251f('0x16')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x20'));db['VoiceMailMessage']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x21'));db['VoiceCallReport']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x22'));db[_0x251f('0x23')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x24'));db[_0x251f('0x25')]=db[_0x251f('0x2')]['import'](_0x251f('0x26'));db[_0x251f('0x27')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x28'));db[_0x251f('0x29')]=db['sequelize']['import']('../api/memberReport/memberReport.model');db[_0x251f('0x2a')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x2b'));db['VoiceTransferReport']=db[_0x251f('0x2')][_0x251f('0x16')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x251f('0x2c')]=db[_0x251f('0x2')]['import'](_0x251f('0x2d'));db['UserVoiceQueue']=db[_0x251f('0x2')]['import'](_0x251f('0x2e'));db[_0x251f('0x2f')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x30'));db[_0x251f('0x31')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x32'));db['UserFaxQueue']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x33'));db[_0x251f('0x34')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x35'));db[_0x251f('0x36')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x37'));db['UserWhatsappQueue']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x38'));db['MailServerIn']=db[_0x251f('0x2')]['import'](_0x251f('0x39'));db[_0x251f('0x3a')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x3b'));db[_0x251f('0x3c')]=db[_0x251f('0x2')]['import'](_0x251f('0x3d'));db[_0x251f('0x3e')]=db['sequelize']['import']('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x3f'));db[_0x251f('0x40')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/mailInteraction/mailInteraction.model');db[_0x251f('0x41')]=db['sequelize'][_0x251f('0x16')]('../api/mailMessage/mailMessage.model');db[_0x251f('0x42')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x43'));db[_0x251f('0x44')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x45'));db[_0x251f('0x46')]=db['sequelize']['import'](_0x251f('0x47'));db[_0x251f('0x48')]=db['sequelize'][_0x251f('0x16')]('../api/dashboardItem/dashboardItem.model');db[_0x251f('0x49')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x4a'));db[_0x251f('0x4b')]=db[_0x251f('0x2')]['import']('../api/faxApplication/faxApplication.model');db[_0x251f('0x4c')]=db[_0x251f('0x2')]['import'](_0x251f('0x4d'));db[_0x251f('0x4e')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x4f'));db[_0x251f('0x50')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x51'));db[_0x251f('0x52')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x53'));db['SmsAccount']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x54'));db[_0x251f('0x55')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x56'));db[_0x251f('0x57')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x58'));db[_0x251f('0x59')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x5a'));db['SmsQueue']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x5b'));db[_0x251f('0x5c')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/openchannelAccount/openchannelAccount.model');db[_0x251f('0x5d')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x5e'));db['OpenchannelInteraction']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x5f'));db[_0x251f('0x60')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x61'));db[_0x251f('0x62')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/openchannelQueue/openchannelQueue.model');db[_0x251f('0x63')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/chatWebsite/chatWebsite.model');db[_0x251f('0x64')]=db[_0x251f('0x2')]['import'](_0x251f('0x65'));db[_0x251f('0x66')]=db['sequelize']['import'](_0x251f('0x67'));db['ChatInteraction']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x68'));db[_0x251f('0x69')]=db[_0x251f('0x2')]['import']('../api/chatMessage/chatMessage.model');db[_0x251f('0x6a')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x6b'));db[_0x251f('0x6c')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x6d'));db[_0x251f('0x6e')]=db[_0x251f('0x2')]['import'](_0x251f('0x6f'));db[_0x251f('0x70')]=db[_0x251f('0x2')]['import'](_0x251f('0x71'));db['CmCompany']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x72'));db[_0x251f('0x73')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x74'));db['CmHopper']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x75'));db[_0x251f('0x76')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x251f('0x77')]=db['sequelize']['import'](_0x251f('0x78'));db[_0x251f('0x79')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x7a'));db[_0x251f('0x7b')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x7c'));db[_0x251f('0x7d')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x7e'));db[_0x251f('0x7f')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x80'));db[_0x251f('0x81')]=db[_0x251f('0x2')]['import'](_0x251f('0x82'));db[_0x251f('0x83')]=db['sequelize'][_0x251f('0x16')]('../api/cannedAnswer/cannedAnswer.model');db[_0x251f('0x84')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x85'));db[_0x251f('0x86')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/condition/condition.model');db[_0x251f('0x87')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x88'));db[_0x251f('0x89')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x8a'));db[_0x251f('0x8b')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x8c'));db[_0x251f('0x8d')]=db[_0x251f('0x2')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize'][_0x251f('0x16')](_0x251f('0x8e'));db[_0x251f('0x8f')]=db[_0x251f('0x2')]['import']('../api/sound/sound.model');db[_0x251f('0x90')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x91'));db[_0x251f('0x92')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x93'));db[_0x251f('0x94')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/trigger/trigger.model');db['Variable']=db[_0x251f('0x2')]['import']('../api/variable/variable.model');db[_0x251f('0x95')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x96'));db['IntegrationReport']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x97'));db[_0x251f('0x98')]=db[_0x251f('0x2')]['import'](_0x251f('0x99'));db[_0x251f('0x9a')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x9b'));db[_0x251f('0x9c')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x9d'));db[_0x251f('0x9e')]=db['sequelize'][_0x251f('0x16')](_0x251f('0x9f'));db[_0x251f('0xa0')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db['sequelize'][_0x251f('0x16')](_0x251f('0xa1'));db[_0x251f('0xa2')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xa3'));db[_0x251f('0xa4')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xa5'));db[_0x251f('0xa6')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x251f('0x2')]['import'](_0x251f('0xa7'));db[_0x251f('0xa8')]=db['sequelize'][_0x251f('0x16')](_0x251f('0xa9'));db[_0x251f('0xaa')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xab'));db[_0x251f('0xac')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/intDeskAccount/intDeskAccount.model');db[_0x251f('0xad')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xae'));db[_0x251f('0xaf')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/intDeskField/intDeskField.model');db[_0x251f('0xb0')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xb1'));db[_0x251f('0xb2')]=db['sequelize'][_0x251f('0x16')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x251f('0x2')][_0x251f('0x16')]('../api/intZohoField/intZohoField.model');db[_0x251f('0xb3')]=db['sequelize'][_0x251f('0x16')](_0x251f('0xb4'));db[_0x251f('0xb5')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xb6'));db['ZendeskField']=db[_0x251f('0x2')]['import'](_0x251f('0xb7'));db['FreshdeskAccount']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xb8'));db[_0x251f('0xb9')]=db[_0x251f('0x2')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x251f('0xba')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xbb'));db[_0x251f('0xbc')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xbd'));db[_0x251f('0xbe')]=db[_0x251f('0x2')]['import'](_0x251f('0xbf'));db[_0x251f('0xc0')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xc1'));db['ServicenowAccount']=db['sequelize']['import'](_0x251f('0xc2'));db[_0x251f('0xc3')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x251f('0xc4')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db['sequelize'][_0x251f('0x16')](_0x251f('0xc5'));db[_0x251f('0xc6')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x251f('0xc7')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x251f('0xc8')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xc9'));db[_0x251f('0xca')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xcb'));db['FreshsalesField']=db['sequelize'][_0x251f('0x16')](_0x251f('0xcc'));db[_0x251f('0x95')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x96'));db['Network']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xcd'));db[_0x251f('0xce')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/chatQueueReport/chatQueueReport.model');db[_0x251f('0xcf')]=db[_0x251f('0x2')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x251f('0xd0')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x251f('0xd1')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xd2'));db[_0x251f('0xd3')]=db[_0x251f('0x2')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x251f('0xd4')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xd5'));db[_0x251f('0xd6')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xd7'));db[_0x251f('0xd8')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/squareReportDetail/squareReportDetail.model');db[_0x251f('0xd9')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xda'));db[_0x251f('0xdb')]=db[_0x251f('0x2')]['import'](_0x251f('0xdc'));db[_0x251f('0xdd')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xde'));db[_0x251f('0xdf')]=db['sequelize'][_0x251f('0x16')](_0x251f('0xe0'));db['SquareRecording']=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xe1'));db[_0x251f('0xe2')]=db[_0x251f('0x2')]['import'](_0x251f('0xe3'));db[_0x251f('0xe4')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/team/team.model');db[_0x251f('0xe5')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xe6'));db[_0x251f('0xe7')]=db[_0x251f('0x2')]['import'](_0x251f('0xe8'));db[_0x251f('0xe9')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xea'));db[_0x251f('0xeb')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/attachment/attachment.model');db[_0x251f('0xec')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/plugin/plugin.model');db['MailTransferReport']=db['sequelize']['import'](_0x251f('0xed'));db[_0x251f('0xee')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xef'));db[_0x251f('0xf0')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xf1'));db[_0x251f('0xf2')]=db['sequelize'][_0x251f('0x16')](_0x251f('0xf3'));db[_0x251f('0xf4')]=db[_0x251f('0x2')]['import'](_0x251f('0xf5'));db[_0x251f('0xf6')]=db[_0x251f('0x2')]['import']('../api/cmList/cmList.model');db[_0x251f('0xf7')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0xf8'));db[_0x251f('0xf9')]=db['sequelize']['import']('../api/userProfile/userProfile.model');db[_0x251f('0xfa')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db['sequelize'][_0x251f('0x16')]('../api/userProfileResource/userProfileResource.model');db[_0x251f('0xfb')]=db['sequelize'][_0x251f('0x16')](_0x251f('0xfc'));db[_0x251f('0xfd')]=db[_0x251f('0x2')]['import'](_0x251f('0xfe'));db[_0x251f('0xff')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x100'));db[_0x251f('0x101')]=db['sequelize'][_0x251f('0x16')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x251f('0x2')][_0x251f('0x16')]('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db['sequelize'][_0x251f('0x16')](_0x251f('0x102'));db[_0x251f('0x103')]=db['sequelize']['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x251f('0x104')]=db[_0x251f('0x2')][_0x251f('0x16')]('../api/whatsappQueue/whatsappQueue.model');db[_0x251f('0x105')]=db[_0x251f('0x2')][_0x251f('0x16')](_0x251f('0x106'));db[_0x251f('0x15')]['hasOne'](db[_0x251f('0x107')],{'as':_0x251f('0x107'),'onDelete':'cascade','foreignKey':_0x251f('0x108')});db[_0x251f('0x15')][_0x251f('0x109')](db[_0x251f('0x10a')],{'as':'Recordings','foreignKey':'UserId'});db[_0x251f('0x15')][_0x251f('0x109')](db[_0x251f('0x2c')],{'as':'VoiceQueuesRt','foreignKey':_0x251f('0x108')});db[_0x251f('0x15')]['hasMany'](db[_0x251f('0x10b')],{'as':_0x251f('0x10c'),'onDelete':_0x251f('0x10d'),'hooks':!![]});db[_0x251f('0x15')][_0x251f('0x109')](db[_0x251f('0x77')],{'as':_0x251f('0x10e'),'foreignKey':'UserId'});db[_0x251f('0x15')][_0x251f('0x109')](db[_0x251f('0x79')],{'as':_0x251f('0x10f'),'foreignKey':'UserId'});db['User'][_0x251f('0x109')](db['ReportAgentPreview'],{'as':_0x251f('0x7b'),'foreignKey':_0x251f('0x108')});db['User'][_0x251f('0x109')](db[_0x251f('0x110')],{'as':'OpenchannelInteractions','foreignKey':_0x251f('0x108')});db['User']['hasMany'](db[_0x251f('0x111')],{'as':_0x251f('0x112'),'foreignKey':_0x251f('0x108')});db[_0x251f('0x15')][_0x251f('0x109')](db[_0x251f('0x57')],{'as':_0x251f('0x113'),'foreignKey':_0x251f('0x108')});db[_0x251f('0x15')][_0x251f('0x109')](db[_0x251f('0x4c')],{'as':_0x251f('0x114'),'foreignKey':_0x251f('0x108')});db[_0x251f('0x15')][_0x251f('0x109')](db['MailInteraction'],{'as':_0x251f('0x115'),'foreignKey':_0x251f('0x108')});db[_0x251f('0x15')][_0x251f('0x109')](db[_0x251f('0x101')],{'as':_0x251f('0x116'),'foreignKey':_0x251f('0x108')});db[_0x251f('0x15')][_0x251f('0x109')](db['Notification'],{'as':_0x251f('0x117'),'foreignKey':'SenderId'});db[_0x251f('0x15')]['belongsTo'](db[_0x251f('0xf9')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0x6e')],{'as':_0x251f('0x119'),'through':_0x251f('0x11a')});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0x73')],{'as':_0x251f('0x11b'),'through':'cm_user_has_contacts'});db['User'][_0x251f('0x118')](db[_0x251f('0xf6')],{'as':_0x251f('0x11c'),'through':_0x251f('0x11d')});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0xe4')],{'through':_0x251f('0x11e')});db['User'][_0x251f('0x118')](db[_0x251f('0x40')],{'as':_0x251f('0x115'),'through':_0x251f('0x11f')});db[_0x251f('0x15')]['belongsToMany'](db[_0x251f('0x111')],{'as':_0x251f('0x112'),'through':_0x251f('0x120')});db[_0x251f('0x15')]['belongsToMany'](db[_0x251f('0x4c')],{'as':_0x251f('0x114'),'through':_0x251f('0x121')});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0x57')],{'as':_0x251f('0x113'),'through':_0x251f('0x122')});db[_0x251f('0x15')][_0x251f('0x118')](db['OpenchannelInteraction'],{'as':_0x251f('0x123'),'through':_0x251f('0x124')});db[_0x251f('0x15')]['belongsToMany'](db[_0x251f('0x101')],{'as':_0x251f('0x116'),'through':_0x251f('0x125')});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0x1d')],{'as':_0x251f('0x126'),'through':_0x251f('0x127'),'required':![]});db['User'][_0x251f('0x118')](db[_0x251f('0x3e')],{'as':'MailQueues','through':_0x251f('0x31'),'required':![]});db[_0x251f('0x15')][_0x251f('0x118')](db['ChatQueue'],{'as':'ChatQueues','through':_0x251f('0x2f'),'required':![],'hooks':!![]});db[_0x251f('0x15')]['belongsToMany'](db[_0x251f('0x50')],{'as':_0x251f('0x128'),'through':_0x251f('0x129'),'required':![]});db['User'][_0x251f('0x118')](db[_0x251f('0x12a')],{'as':_0x251f('0x12b'),'through':_0x251f('0x34'),'required':![]});db[_0x251f('0x15')]['belongsToMany'](db[_0x251f('0x62')],{'as':_0x251f('0x12c'),'through':'UserOpenchannelQueue','required':![]});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0x104')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x251f('0x15')]['belongsToMany'](db['CmList'],{'through':_0x251f('0x11d')});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0xf7')],{'as':_0x251f('0x12d'),'through':_0x251f('0x12e'),'required':![]});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0x63')],{'as':_0x251f('0x12f'),'through':'user_has_chat_websites'});db[_0x251f('0x15')][_0x251f('0x118')](db['FaxAccount'],{'as':_0x251f('0x130'),'through':'user_has_fax_accounts'});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0x3c')],{'as':_0x251f('0x131'),'through':_0x251f('0x132')});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0x5c')],{'as':_0x251f('0x133'),'through':_0x251f('0x134')});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0x135')],{'as':_0x251f('0x136'),'through':_0x251f('0x137')});db['User'][_0x251f('0x118')](db[_0x251f('0xfd')],{'as':_0x251f('0x138'),'through':'user_has_whatsapp_accounts'});db[_0x251f('0x15')][_0x251f('0x118')](db[_0x251f('0xdf')],{'as':_0x251f('0x139'),'through':_0x251f('0x13a')});db[_0x251f('0x18')]['hasMany'](db['VoiceExtension'],{'as':_0x251f('0x13b'),'onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x13c')});db[_0x251f('0x1a')][_0x251f('0x109')](db[_0x251f('0x10b')],{'onDelete':'cascade'});db[_0x251f('0x10b')][_0x251f('0x109')](db['VoiceExtension'],{'as':_0x251f('0x13d'),'onDelete':_0x251f('0x10d')});db[_0x251f('0x13e')][_0x251f('0x118')](db['Sound'],{'as':_0x251f('0x13f'),'through':_0x251f('0x140')});db[_0x251f('0x1d')][_0x251f('0x109')](db[_0x251f('0x2c')],{'as':_0x251f('0x141'),'foreignKey':'VoiceQueueId'});db[_0x251f('0x1d')][_0x251f('0x109')](db['CmHopper'],{'as':_0x251f('0x142'),'foreignKey':_0x251f('0x143')});db['VoiceQueue'][_0x251f('0x109')](db[_0x251f('0x77')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x251f('0x1d')][_0x251f('0x109')](db['CmHopperHistory'],{'as':_0x251f('0x144'),'foreignKey':_0x251f('0x143')});db['VoiceQueue']['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x251f('0x143')});db[_0x251f('0x1d')][_0x251f('0x109')](db[_0x251f('0x76')],{'as':_0x251f('0x145'),'foreignKey':_0x251f('0x143')});db[_0x251f('0x1d')][_0x251f('0x109')](db[_0x251f('0xd3')],{'as':_0x251f('0x146'),'foreignKey':_0x251f('0x143')});db[_0x251f('0x1d')][_0x251f('0x147')](db['Trunk'],{'as':_0x251f('0x2a'),'foreignKey':_0x251f('0x148')});db['VoiceQueue'][_0x251f('0x147')](db['Trunk'],{'as':_0x251f('0x149'),'foreignKey':_0x251f('0x14a')});db['VoiceQueue'][_0x251f('0x147')](db[_0x251f('0x87')],{'as':_0x251f('0x87'),'foreignKey':'IntervalId'});db[_0x251f('0x1d')][_0x251f('0x147')](db[_0x251f('0x89')],{'as':_0x251f('0x14b'),'foreignKey':_0x251f('0x14c')});db[_0x251f('0x1d')][_0x251f('0x118')](db[_0x251f('0xf6')],{'as':_0x251f('0x11c'),'through':_0x251f('0x14d')});db[_0x251f('0x1d')]['belongsToMany'](db[_0x251f('0x15')],{'as':_0x251f('0x14e'),'through':_0x251f('0x127')});db[_0x251f('0x1d')]['belongsToMany'](db[_0x251f('0xe4')],{'as':_0x251f('0x14f'),'through':_0x251f('0x150')});db[_0x251f('0x1d')][_0x251f('0x118')](db[_0x251f('0xf6')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x251f('0x10a')][_0x251f('0x147')](db['User'],{'as':_0x251f('0x15'),'foreignKey':_0x251f('0x108')});db['ScreenRecording'][_0x251f('0x147')](db[_0x251f('0x15')],{'as':_0x251f('0x15'),'foreignKey':_0x251f('0x108')});db[_0x251f('0x107')][_0x251f('0x109')](db[_0x251f('0x151')],{'as':_0x251f('0x152'),'onDelete':'cascade','foreignKey':_0x251f('0x153'),'sourceKey':_0x251f('0x154')});db[_0x251f('0x151')][_0x251f('0x147')](db[_0x251f('0x107')],{'foreignKey':_0x251f('0x153'),'targetKey':'mailbox'});db['VoiceCallReport'][_0x251f('0x109')](db[_0x251f('0x27')],{'as':_0x251f('0x155'),'foreignKey':'uniqueid','constraints':![]});db[_0x251f('0x156')][_0x251f('0x109')](db[_0x251f('0x25')],{'as':'AgentReports','foreignKey':_0x251f('0x157'),'constraints':![]});db[_0x251f('0x156')][_0x251f('0x147')](db[_0x251f('0x15')],{'as':_0x251f('0x15'),'foreignKey':_0x251f('0x108')});db[_0x251f('0x156')]['belongsTo'](db[_0x251f('0x73')],{'as':'Contact','foreignKey':_0x251f('0x158')});db['MailServerIn']['belongsTo'](db['MailAccount'],{'as':_0x251f('0x3c'),'foreignKey':_0x251f('0x159')});db[_0x251f('0x3a')]['belongsTo'](db['MailAccount'],{'as':_0x251f('0x3c'),'foreignKey':_0x251f('0x159')});db['MailAccount'][_0x251f('0x15a')](db[_0x251f('0x15b')],{'as':_0x251f('0x15c'),'onDelete':_0x251f('0x10d')});db[_0x251f('0x3c')][_0x251f('0x15a')](db[_0x251f('0x3a')],{'as':_0x251f('0x15d'),'onDelete':_0x251f('0x10d')});db[_0x251f('0x3c')][_0x251f('0x109')](db[_0x251f('0x84')],{'as':_0x251f('0x15e'),'foreignKey':_0x251f('0x159')});db['MailAccount'][_0x251f('0x109')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x251f('0x159')});db[_0x251f('0x3c')][_0x251f('0x109')](db[_0x251f('0x41')],{'as':_0x251f('0x152'),'foreignKey':_0x251f('0x159')});db[_0x251f('0x3c')][_0x251f('0x109')](db[_0x251f('0x40')],{'as':_0x251f('0x15f')});db[_0x251f('0x3c')]['hasMany'](db[_0x251f('0x42')],{'as':_0x251f('0x13d')});db[_0x251f('0x3c')]['belongsTo'](db[_0x251f('0xf6')],{'as':_0x251f('0x160'),'foreignKey':'ListId'});db[_0x251f('0x3c')][_0x251f('0x147')](db[_0x251f('0x92')],{'as':_0x251f('0x92'),'foreignKey':'TemplateId'});db[_0x251f('0x3c')][_0x251f('0x147')](db[_0x251f('0x89')],{'as':_0x251f('0x14b'),'foreignKey':_0x251f('0x14c')});db[_0x251f('0x3c')]['belongsToMany'](db[_0x251f('0x15')],{'as':'Agents','through':_0x251f('0x132')});db['MailQueue'][_0x251f('0x118')](db[_0x251f('0x15')],{'as':'Agents','through':'UserMailQueue'});db[_0x251f('0x3e')][_0x251f('0x118')](db[_0x251f('0xe4')],{'through':_0x251f('0x161'),'as':_0x251f('0x14f')});db[_0x251f('0x40')][_0x251f('0x109')](db['MailMessage'],{'as':_0x251f('0x152'),'onDelete':'cascade','foreignKey':_0x251f('0x162')});db[_0x251f('0x40')][_0x251f('0x147')](db[_0x251f('0x3c')],{'as':_0x251f('0x163'),'foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db[_0x251f('0x73')],{'as':_0x251f('0x164'),'foreignKey':'ContactId'});db[_0x251f('0x40')]['belongsTo'](db[_0x251f('0x15')],{'as':_0x251f('0x165'),'foreignKey':'UserId'});db[_0x251f('0x40')]['belongsToMany'](db[_0x251f('0x90')],{'through':_0x251f('0x166'),'as':_0x251f('0x167')});db[_0x251f('0x40')]['belongsToMany'](db[_0x251f('0x90')],{'through':_0x251f('0x166'),'as':_0x251f('0x168')});db['MailInteraction'][_0x251f('0x118')](db[_0x251f('0x15')],{'as':_0x251f('0x169'),'through':_0x251f('0x11f'),'foreignKey':_0x251f('0x162')});db[_0x251f('0x41')]['hasMany'](db['Attachment'],{'as':'Attachments','onDelete':_0x251f('0x10d')});db[_0x251f('0x41')][_0x251f('0x147')](db[_0x251f('0x15')],{'as':_0x251f('0x15')});db[_0x251f('0x41')][_0x251f('0x147')](db['CmContact'],{'onDelete':_0x251f('0x10d'),'as':_0x251f('0x164')});db[_0x251f('0x41')]['belongsTo'](db[_0x251f('0x40')],{'as':_0x251f('0x16a'),'foreignKey':_0x251f('0x162')});db[_0x251f('0x41')]['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':'MailAccountId'});db[_0x251f('0x42')]['belongsTo'](db[_0x251f('0x15')],{'onDelete':'restrict'});db['MailApplication'][_0x251f('0x147')](db[_0x251f('0x3e')],{'onDelete':_0x251f('0x16b')});db['MailApplication'][_0x251f('0x147')](db[_0x251f('0x3c')],{'onDelete':_0x251f('0x16b')});db[_0x251f('0x42')][_0x251f('0x147')](db[_0x251f('0x87')],{'onDelete':_0x251f('0x16b'),'foreignKey':_0x251f('0x16c')});db[_0x251f('0x42')][_0x251f('0x147')](db[_0x251f('0x90')],{'onDelete':_0x251f('0x16b'),'foreignKey':_0x251f('0x16d')});db[_0x251f('0x44')][_0x251f('0x147')](db[_0x251f('0x3c')],{});db[_0x251f('0x44')][_0x251f('0x147')](db[_0x251f('0xf6')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x16e')});db[_0x251f('0x44')][_0x251f('0x147')](db[_0x251f('0x73')],{'as':'Contact','foreignKey':_0x251f('0x158')});db[_0x251f('0x44')][_0x251f('0x147')](db['MailInteraction'],{});db[_0x251f('0x44')]['belongsTo'](db[_0x251f('0x41')],{});db['MailQueueReport'][_0x251f('0x147')](db[_0x251f('0x15')],{});db[_0x251f('0x44')]['belongsTo'](db['MailQueue'],{});db['Dashboard'][_0x251f('0x109')](db[_0x251f('0x48')],{'as':_0x251f('0x16f'),'onDelete':_0x251f('0x10d')});db[_0x251f('0x49')]['hasMany'](db['Disposition'],{'as':_0x251f('0x15e'),'foreignKey':_0x251f('0x170')});db[_0x251f('0x49')][_0x251f('0x109')](db[_0x251f('0x83')],{'as':_0x251f('0x171'),'foreignKey':'FaxAccountId'});db[_0x251f('0x49')]['hasMany'](db[_0x251f('0x4c')],{'as':'Interactions'});db[_0x251f('0x49')]['hasMany'](db[_0x251f('0x4b')],{'as':'Applications'});db[_0x251f('0x49')][_0x251f('0x109')](db[_0x251f('0x10b')],{'as':_0x251f('0x172'),'onDelete':_0x251f('0x10d')});db[_0x251f('0x49')]['hasMany'](db['FaxMessage'],{'as':_0x251f('0x152')});db[_0x251f('0x49')]['belongsTo'](db[_0x251f('0x2a')],{'as':_0x251f('0x2a')});db[_0x251f('0x49')]['belongsTo'](db['CmList'],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x16e')});db['FaxAccount'][_0x251f('0x147')](db[_0x251f('0x89')],{'as':_0x251f('0x14b'),'foreignKey':_0x251f('0x14c')});db[_0x251f('0x49')][_0x251f('0x118')](db['User'],{'as':_0x251f('0x14e'),'through':_0x251f('0x173')});db['FaxApplication'][_0x251f('0x147')](db['User'],{'onDelete':_0x251f('0x16b')});db['FaxApplication'][_0x251f('0x147')](db[_0x251f('0x50')],{'onDelete':_0x251f('0x16b')});db['FaxApplication'][_0x251f('0x147')](db[_0x251f('0x49')],{'onDelete':_0x251f('0x16b')});db[_0x251f('0x4b')][_0x251f('0x147')](db['Tag'],{'onDelete':_0x251f('0x16b'),'foreignKey':_0x251f('0x16d')});db[_0x251f('0x4c')][_0x251f('0x109')](db[_0x251f('0x4e')],{'as':_0x251f('0x152'),'onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x174')});db[_0x251f('0x4c')]['belongsTo'](db[_0x251f('0x49')],{'as':'Account','foreignKey':_0x251f('0x170')});db[_0x251f('0x4c')][_0x251f('0x147')](db[_0x251f('0x73')],{'as':_0x251f('0x164'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x251f('0x147')](db['User'],{'as':'Owner','foreignKey':_0x251f('0x108')});db[_0x251f('0x4c')]['belongsToMany'](db['Tag'],{'through':_0x251f('0x175'),'as':'Tags'});db['FaxInteraction']['belongsToMany'](db[_0x251f('0x90')],{'through':_0x251f('0x175'),'as':_0x251f('0x168')});db[_0x251f('0x4c')][_0x251f('0x118')](db[_0x251f('0x15')],{'as':_0x251f('0x169'),'through':_0x251f('0x121'),'foreignKey':_0x251f('0x174')});db['FaxMessage'][_0x251f('0x147')](db['User'],{'onDelete':_0x251f('0x10d'),'as':'User'});db['FaxMessage'][_0x251f('0x147')](db[_0x251f('0x4c')],{'as':_0x251f('0x16a'),'foreignKey':'FaxInteractionId'});db[_0x251f('0x4e')][_0x251f('0x147')](db[_0x251f('0x73')],{'onDelete':'cascade','as':'Contact'});db[_0x251f('0x4e')]['belongsTo'](db[_0x251f('0xeb')],{'as':_0x251f('0xeb'),'foreignKey':_0x251f('0x176')});db['FaxMessage'][_0x251f('0x147')](db[_0x251f('0x49')],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x170')});db[_0x251f('0x50')]['belongsToMany'](db[_0x251f('0x15')],{'as':_0x251f('0x14e'),'through':_0x251f('0x129')});db['FaxQueue']['belongsToMany'](db['Team'],{'through':_0x251f('0x177'),'as':'Teams'});db[_0x251f('0x52')]['belongsTo'](db[_0x251f('0x49')],{});db[_0x251f('0x52')]['belongsTo'](db['CmList'],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x16e')});db[_0x251f('0x52')][_0x251f('0x147')](db['CmContact'],{'as':_0x251f('0x164'),'foreignKey':'ContactId'});db[_0x251f('0x52')][_0x251f('0x147')](db['FaxInteraction'],{});db[_0x251f('0x52')][_0x251f('0x147')](db['FaxMessage'],{});db[_0x251f('0x52')][_0x251f('0x147')](db['User'],{});db[_0x251f('0x52')][_0x251f('0x147')](db[_0x251f('0x50')],{});db[_0x251f('0x135')]['hasMany'](db[_0x251f('0x84')],{'as':'Dispositions','foreignKey':'SmsAccountId'});db[_0x251f('0x135')][_0x251f('0x109')](db['CannedAnswer'],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x178')});db[_0x251f('0x135')][_0x251f('0x109')](db['SmsMessage'],{'as':'Messages','foreignKey':_0x251f('0x178')});db[_0x251f('0x135')][_0x251f('0x109')](db['SmsInteraction'],{'as':'Interactions'});db[_0x251f('0x135')][_0x251f('0x109')](db[_0x251f('0x55')],{'as':_0x251f('0x13d')});db[_0x251f('0x135')][_0x251f('0x147')](db[_0x251f('0xf6')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x16e')});db[_0x251f('0x135')]['belongsTo'](db[_0x251f('0x89')],{'as':_0x251f('0x14b'),'foreignKey':_0x251f('0x14c')});db[_0x251f('0x135')]['belongsToMany'](db[_0x251f('0x15')],{'as':'Agents','through':_0x251f('0x137')});db['SmsApplication'][_0x251f('0x147')](db['User'],{'onDelete':_0x251f('0x16b')});db[_0x251f('0x55')]['belongsTo'](db[_0x251f('0x12a')],{'onDelete':'restrict'});db[_0x251f('0x55')][_0x251f('0x147')](db[_0x251f('0x135')],{'onDelete':_0x251f('0x16b')});db['SmsApplication'][_0x251f('0x147')](db[_0x251f('0x87')],{'onDelete':_0x251f('0x16b'),'foreignKey':_0x251f('0x16c')});db['SmsApplication'][_0x251f('0x147')](db[_0x251f('0x90')],{'onDelete':_0x251f('0x16b'),'foreignKey':'TagId'});db[_0x251f('0x57')][_0x251f('0x109')](db[_0x251f('0x59')],{'as':_0x251f('0x152'),'onDelete':_0x251f('0x10d'),'foreignKey':'SmsInteractionId'});db['SmsInteraction'][_0x251f('0x147')](db[_0x251f('0x135')],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x178')});db[_0x251f('0x57')][_0x251f('0x147')](db['CmContact'],{'as':_0x251f('0x164'),'foreignKey':'ContactId'});db[_0x251f('0x57')][_0x251f('0x147')](db['User'],{'as':_0x251f('0x165'),'foreignKey':_0x251f('0x108')});db[_0x251f('0x57')][_0x251f('0x118')](db[_0x251f('0x90')],{'through':_0x251f('0x179'),'as':_0x251f('0x167')});db[_0x251f('0x57')][_0x251f('0x118')](db[_0x251f('0x90')],{'through':_0x251f('0x179'),'as':_0x251f('0x168')});db[_0x251f('0x57')][_0x251f('0x118')](db[_0x251f('0x15')],{'as':_0x251f('0x169'),'through':_0x251f('0x122'),'foreignKey':_0x251f('0x17a')});db[_0x251f('0x59')][_0x251f('0x147')](db['User'],{'as':_0x251f('0x15')});db[_0x251f('0x59')][_0x251f('0x147')](db[_0x251f('0x73')],{'onDelete':'cascade','as':_0x251f('0x164')});db[_0x251f('0x59')][_0x251f('0x147')](db['SmsInteraction'],{'onDelete':_0x251f('0x10d'),'as':'Interaction','foreignKey':_0x251f('0x17a')});db[_0x251f('0x59')][_0x251f('0x147')](db[_0x251f('0x135')],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x178')});db[_0x251f('0x12a')]['belongsToMany'](db[_0x251f('0x15')],{'as':_0x251f('0x14e'),'through':_0x251f('0x34'),'foreignKey':'SmsQueueId'});db[_0x251f('0x12a')]['belongsToMany'](db[_0x251f('0xe4')],{'through':_0x251f('0x17b'),'as':_0x251f('0x14f')});db[_0x251f('0x5c')][_0x251f('0x109')](db[_0x251f('0x84')],{'as':_0x251f('0x15e'),'foreignKey':_0x251f('0x17c')});db[_0x251f('0x5c')][_0x251f('0x109')](db['CannedAnswer'],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x17c')});db[_0x251f('0x5c')][_0x251f('0x109')](db['OpenchannelInteraction'],{'as':_0x251f('0x15f'),'foreignKey':'OpenchannelAccountId'});db[_0x251f('0x5c')][_0x251f('0x109')](db[_0x251f('0x60')],{'as':_0x251f('0x152'),'foreignKey':_0x251f('0x17c')});db[_0x251f('0x5c')][_0x251f('0x109')](db['OpenchannelApplication'],{'as':_0x251f('0x13d'),'foreignKey':_0x251f('0x17c')});db[_0x251f('0x5c')][_0x251f('0x147')](db[_0x251f('0xf6')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x16e')});db['OpenchannelAccount'][_0x251f('0x147')](db[_0x251f('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x251f('0x14c')});db[_0x251f('0x5c')][_0x251f('0x118')](db[_0x251f('0x15')],{'as':_0x251f('0x14e'),'through':_0x251f('0x134')});db[_0x251f('0x5d')][_0x251f('0x147')](db[_0x251f('0x15')],{'onDelete':'restrict'});db[_0x251f('0x5d')][_0x251f('0x147')](db[_0x251f('0x62')],{'onDelete':_0x251f('0x16b'),'foreignKey':_0x251f('0x17d')});db[_0x251f('0x5d')][_0x251f('0x147')](db[_0x251f('0x5c')],{'onDelete':_0x251f('0x16b'),'foreignKey':'OpenchannelAccountId'});db[_0x251f('0x5d')][_0x251f('0x147')](db[_0x251f('0x87')],{'onDelete':'restrict','foreignKey':_0x251f('0x16c')});db[_0x251f('0x5d')][_0x251f('0x147')](db[_0x251f('0x90')],{'onDelete':_0x251f('0x16b'),'foreignKey':_0x251f('0x16d')});db['OpenchannelInteraction'][_0x251f('0x109')](db[_0x251f('0x60')],{'as':_0x251f('0x152'),'onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x17e')});db[_0x251f('0x110')]['belongsTo'](db[_0x251f('0x5c')],{'as':'Account','foreignKey':_0x251f('0x17c')});db['OpenchannelInteraction'][_0x251f('0x147')](db[_0x251f('0x73')],{'as':'Contact','foreignKey':_0x251f('0x158')});db['OpenchannelInteraction'][_0x251f('0x147')](db[_0x251f('0x15')],{'as':'Owner','foreignKey':_0x251f('0x108')});db[_0x251f('0x110')][_0x251f('0x118')](db[_0x251f('0x90')],{'through':_0x251f('0x17f'),'as':_0x251f('0x167')});db[_0x251f('0x110')][_0x251f('0x118')](db[_0x251f('0x90')],{'through':_0x251f('0x17f'),'as':'ThroughTags'});db[_0x251f('0x110')][_0x251f('0x118')](db[_0x251f('0x15')],{'as':'Users','through':_0x251f('0x124'),'foreignKey':_0x251f('0x17e')});db['OpenchannelMessage'][_0x251f('0x147')](db[_0x251f('0x15')],{'onDelete':_0x251f('0x10d'),'as':'User'});db['OpenchannelMessage'][_0x251f('0x147')](db['CmContact'],{'onDelete':'cascade','as':_0x251f('0x164')});db[_0x251f('0x60')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x251f('0x10d'),'as':_0x251f('0x16a'),'foreignKey':'OpenchannelInteractionId'});db[_0x251f('0x60')]['belongsTo'](db[_0x251f('0xeb')],{'as':_0x251f('0xeb'),'foreignKey':'AttachmentId'});db[_0x251f('0x60')][_0x251f('0x147')](db[_0x251f('0x5c')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x251f('0x62')]['belongsToMany'](db[_0x251f('0x15')],{'as':'Agents','through':_0x251f('0x36'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue']['belongsToMany'](db[_0x251f('0xe4')],{'through':_0x251f('0x180'),'as':_0x251f('0x14f')});db[_0x251f('0x63')][_0x251f('0x109')](db[_0x251f('0x84')],{'as':'Dispositions','foreignKey':'ChatWebsiteId'});db[_0x251f('0x63')][_0x251f('0x109')](db['CannedAnswer'],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x181')});db[_0x251f('0x63')][_0x251f('0x109')](db[_0x251f('0x70')],{'as':_0x251f('0x182')});db[_0x251f('0x63')][_0x251f('0x109')](db[_0x251f('0x111')],{'as':_0x251f('0x15f')});db[_0x251f('0x63')][_0x251f('0x109')](db[_0x251f('0x66')],{'as':'Applications'});db[_0x251f('0x63')][_0x251f('0x109')](db[_0x251f('0x69')],{'as':_0x251f('0x152')});db[_0x251f('0x63')][_0x251f('0x147')](db[_0x251f('0xf6')],{'as':'List','foreignKey':_0x251f('0x16e')});db['ChatWebsite'][_0x251f('0x147')](db[_0x251f('0x87')],{'as':_0x251f('0x87'),'foreignKey':_0x251f('0x16c')});db[_0x251f('0x63')][_0x251f('0x147')](db[_0x251f('0x89')],{'as':_0x251f('0x14b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x251f('0x63')]['belongsToMany'](db[_0x251f('0x15')],{'as':'Agents','through':_0x251f('0x183')});db[_0x251f('0x64')]['belongsTo'](db[_0x251f('0x5c')],{});db[_0x251f('0x64')][_0x251f('0x147')](db[_0x251f('0xf6')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x16e')});db[_0x251f('0x64')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x251f('0x158')});db['OpenchannelQueueReport']['belongsTo'](db[_0x251f('0x110')],{});db['OpenchannelQueueReport'][_0x251f('0x147')](db['OpenchannelMessage'],{});db[_0x251f('0x64')]['belongsTo'](db[_0x251f('0x15')],{});db[_0x251f('0x64')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x251f('0x66')][_0x251f('0x147')](db[_0x251f('0x15')],{'as':_0x251f('0x184'),'foreignKey':_0x251f('0x108'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0x251f('0x6c')],{'as':_0x251f('0x185'),'foreignKey':_0x251f('0x186'),'onDelete':'restrict'});db[_0x251f('0x66')][_0x251f('0x147')](db[_0x251f('0x63')],{'as':'Website','foreignKey':_0x251f('0x181'),'onDelete':_0x251f('0x16b')});db['ChatApplication']['belongsTo'](db[_0x251f('0x90')],{'onDelete':_0x251f('0x16b'),'foreignKey':_0x251f('0x16d')});db[_0x251f('0x111')]['hasMany'](db[_0x251f('0x69')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x251f('0x187')});db[_0x251f('0x111')][_0x251f('0x147')](db[_0x251f('0x63')],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x181')});db['ChatInteraction'][_0x251f('0x147')](db[_0x251f('0x73')],{'as':_0x251f('0x164'),'foreignKey':_0x251f('0x158')});db[_0x251f('0x111')][_0x251f('0x147')](db[_0x251f('0x15')],{'as':_0x251f('0x165'),'foreignKey':_0x251f('0x108')});db[_0x251f('0x111')][_0x251f('0x118')](db[_0x251f('0x90')],{'through':_0x251f('0x188'),'as':_0x251f('0x167')});db[_0x251f('0x111')][_0x251f('0x118')](db[_0x251f('0x90')],{'through':_0x251f('0x188'),'as':_0x251f('0x168')});db[_0x251f('0x111')][_0x251f('0x118')](db[_0x251f('0x15')],{'as':_0x251f('0x169'),'through':'user_has_chat_interactions','foreignKey':_0x251f('0x187')});db[_0x251f('0x69')]['belongsTo'](db[_0x251f('0x15')],{'onDelete':_0x251f('0x10d'),'as':_0x251f('0x15')});db[_0x251f('0x69')]['belongsTo'](db['CmContact'],{'onDelete':_0x251f('0x10d'),'as':_0x251f('0x164'),'foreignKey':_0x251f('0x158')});db[_0x251f('0x69')][_0x251f('0x147')](db['ChatInteraction'],{'onDelete':_0x251f('0x10d'),'as':'Interaction','foreignKey':_0x251f('0x187')});db['ChatMessage'][_0x251f('0x147')](db[_0x251f('0xeb')],{'as':_0x251f('0xeb'),'foreignKey':_0x251f('0x176')});db[_0x251f('0x69')][_0x251f('0x147')](db[_0x251f('0x63')],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x181')});db[_0x251f('0x6a')][_0x251f('0x147')](db[_0x251f('0x73')],{'onDelete':_0x251f('0x10d'),'as':_0x251f('0x164'),'foreignKey':_0x251f('0x158')});db['ChatOfflineMessage'][_0x251f('0x147')](db[_0x251f('0x63')],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x181')});db[_0x251f('0x6c')][_0x251f('0x118')](db['User'],{'as':_0x251f('0x14e'),'through':_0x251f('0x2f'),'hooks':!![]});db[_0x251f('0x6c')][_0x251f('0x118')](db['Team'],{'through':_0x251f('0x189'),'as':'Teams'});db[_0x251f('0x6e')][_0x251f('0x109')](db[_0x251f('0xcf')],{'as':_0x251f('0x152'),'foreignKey':_0x251f('0x18a'),'onDelete':_0x251f('0x10d')});db['ChatGroup'][_0x251f('0x118')](db['User'],{'as':_0x251f('0x141'),'through':_0x251f('0x11a')});db[_0x251f('0x70')][_0x251f('0x147')](db[_0x251f('0x63')],{'as':_0x251f('0x18b'),'foreignKey':_0x251f('0x181')});db['CmCompany'][_0x251f('0x109')](db[_0x251f('0x73')],{'as':_0x251f('0x11b'),'foreignKey':_0x251f('0x18c')});db[_0x251f('0x73')][_0x251f('0x109')](db[_0x251f('0x18d')],{'as':_0x251f('0x142'),'foreignKey':_0x251f('0x158')});db['CmContact'][_0x251f('0x109')](db['CmHopperFinal'],{'as':_0x251f('0x10e'),'foreignKey':'ContactId'});db[_0x251f('0x73')][_0x251f('0x109')](db[_0x251f('0x79')],{'as':_0x251f('0x144'),'foreignKey':_0x251f('0x158')});db['CmContact'][_0x251f('0x109')](db['ReportAgentPreview'],{'as':_0x251f('0x7b'),'foreignKey':_0x251f('0x158')});db[_0x251f('0x73')][_0x251f('0x109')](db[_0x251f('0xd3')],{'as':'JscriptySessions','foreignKey':_0x251f('0x158')});db[_0x251f('0x73')][_0x251f('0x109')](db[_0x251f('0x110')],{'as':_0x251f('0x123'),'foreignKey':'ContactId','onDelete':_0x251f('0x16b')});db[_0x251f('0x73')][_0x251f('0x109')](db[_0x251f('0x111')],{'as':'ChatInteractions','foreignKey':_0x251f('0x158'),'onDelete':_0x251f('0x16b')});db['CmContact'][_0x251f('0x109')](db[_0x251f('0x57')],{'as':'SmsInteractions','foreignKey':_0x251f('0x158'),'onDelete':'restrict'});db[_0x251f('0x73')][_0x251f('0x109')](db[_0x251f('0x4c')],{'as':'FaxInteractions','foreignKey':_0x251f('0x158'),'onDelete':_0x251f('0x16b')});db[_0x251f('0x73')]['hasMany'](db[_0x251f('0x40')],{'as':'MailInteractions','foreignKey':_0x251f('0x158'),'onDelete':_0x251f('0x16b')});db[_0x251f('0x73')][_0x251f('0x147')](db[_0x251f('0x18e')],{'as':_0x251f('0x18f'),'foreignKey':_0x251f('0x18c')});db[_0x251f('0x73')][_0x251f('0x147')](db[_0x251f('0xf6')],{'as':'List','foreignKey':_0x251f('0x16e'),'onDelete':'cascade'});db[_0x251f('0x73')]['belongsToMany'](db[_0x251f('0x15')],{'as':'Users','through':_0x251f('0x190')});db[_0x251f('0x73')]['belongsToMany'](db[_0x251f('0x90')],{'as':_0x251f('0x167'),'through':_0x251f('0x191')});db[_0x251f('0x73')][_0x251f('0x118')](db['Tag'],{'through':_0x251f('0x191'),'as':'ThroughTags'});db[_0x251f('0x18d')][_0x251f('0x147')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x251f('0x10d')});db[_0x251f('0x18d')][_0x251f('0x147')](db['CmList'],{'as':'List','foreignKey':_0x251f('0x16e'),'onDelete':_0x251f('0x10d')});db['CmHopper'][_0x251f('0x147')](db[_0x251f('0x15')],{'as':_0x251f('0x184'),'foreignKey':_0x251f('0x108')});db[_0x251f('0x18d')][_0x251f('0x147')](db[_0x251f('0x1d')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x251f('0x10d')});db[_0x251f('0x18d')][_0x251f('0x147')](db[_0x251f('0xe7')],{'as':'Campaign','foreignKey':_0x251f('0x192'),'onDelete':'cascade'});db['CmHopper'][_0x251f('0x147')](db[_0x251f('0x15')],{'as':'Owner','foreignKey':_0x251f('0x193')});db[_0x251f('0x76')][_0x251f('0x147')](db[_0x251f('0x73')],{'as':_0x251f('0x164'),'foreignKey':'ContactId','onDelete':_0x251f('0x10d')});db[_0x251f('0x76')]['belongsTo'](db[_0x251f('0xf6')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x16e'),'onDelete':_0x251f('0x10d')});db[_0x251f('0x76')]['belongsTo'](db[_0x251f('0x1d')],{'as':_0x251f('0x185'),'foreignKey':_0x251f('0x143'),'onDelete':'cascade'});db[_0x251f('0x76')][_0x251f('0x147')](db[_0x251f('0xe7')],{'as':_0x251f('0xe7'),'foreignKey':_0x251f('0x192'),'onDelete':_0x251f('0x10d')});db['Automation'][_0x251f('0x109')](db[_0x251f('0x86')],{'as':{'plural':_0x251f('0x194'),'singular':_0x251f('0x195')},'foreignKey':_0x251f('0x196'),'onDelete':_0x251f('0x10d'),'hooks':!![]});db['Automation'][_0x251f('0x109')](db['Condition'],{'as':{'plural':_0x251f('0x197'),'singular':_0x251f('0x198')},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0x251f('0x81')][_0x251f('0x109')](db[_0x251f('0x7f')],{'as':_0x251f('0x199'),'foreignKey':_0x251f('0x19a'),'onDelete':'cascade','hooks':!![]});db['Interval'][_0x251f('0x109')](db['Interval'],{'as':_0x251f('0x19b'),'foreignKey':_0x251f('0x16c'),'onDelete':_0x251f('0x10d'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x251f('0x10b')],{'as':'Extensions','foreignKey':_0x251f('0x16c'),'onDelete':_0x251f('0x16b')});db['Interval'][_0x251f('0x109')](db[_0x251f('0x42')],{'as':_0x251f('0x19c'),'foreignKey':'IntervalId'});db[_0x251f('0x87')][_0x251f('0x109')](db[_0x251f('0x66')],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0x251f('0x87')]['hasMany'](db[_0x251f('0x4b')],{'as':_0x251f('0x19d'),'foreignKey':_0x251f('0x16c')});db[_0x251f('0x87')][_0x251f('0x109')](db[_0x251f('0x55')],{'as':_0x251f('0x19e'),'foreignKey':_0x251f('0x16c')});db['Schedule'][_0x251f('0x147')](db[_0x251f('0x3c')],{});db[_0x251f('0x19f')][_0x251f('0x147')](db[_0x251f('0x9a')],{'foreignKey':_0x251f('0x1a0')});db[_0x251f('0x19f')]['belongsTo'](db[_0x251f('0x98')],{'foreignKey':_0x251f('0x1a1')});db[_0x251f('0x8f')][_0x251f('0x118')](db[_0x251f('0x13e')],{'as':_0x251f('0x1a2'),'through':'moh_has_sounds','onDelete':_0x251f('0x16b')});db[_0x251f('0x90')]['belongsToMany'](db[_0x251f('0x73')],{'through':_0x251f('0x191')});db[_0x251f('0x90')]['belongsToMany'](db[_0x251f('0x111')],{'through':_0x251f('0x188')});db[_0x251f('0x90')][_0x251f('0x118')](db[_0x251f('0x40')],{'through':_0x251f('0x166')});db[_0x251f('0x90')][_0x251f('0x118')](db[_0x251f('0x57')],{'through':_0x251f('0x179')});db[_0x251f('0x90')][_0x251f('0x118')](db[_0x251f('0x4c')],{'through':'fax_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x251f('0x110')],{'through':_0x251f('0x17f')});db[_0x251f('0x90')][_0x251f('0x118')](db[_0x251f('0x101')],{'through':_0x251f('0x1a3')});db[_0x251f('0x94')][_0x251f('0x109')](db['Condition'],{'as':{'plural':_0x251f('0x1a4'),'singular':_0x251f('0x1a5')},'foreignKey':_0x251f('0x1a6'),'onDelete':_0x251f('0x10d'),'hooks':!![]});db[_0x251f('0x94')]['hasMany'](db['Condition'],{'as':{'plural':_0x251f('0x1a7'),'singular':_0x251f('0x1a8')},'foreignKey':'TriggerAnyId','onDelete':_0x251f('0x10d'),'hooks':!![]});db[_0x251f('0x94')]['hasMany'](db['Action'],{'as':_0x251f('0x199'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x251f('0x98')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x251f('0x1a9'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x251f('0x9a')][_0x251f('0x109')](db[_0x251f('0xa0')],{'as':_0x251f('0x1a9'),'onDelete':'cascade','foreignKey':_0x251f('0x1a0')});db['AnalyticMetric'][_0x251f('0x109')](db[_0x251f('0xa0')],{'as':_0x251f('0x1a9'),'onDelete':_0x251f('0x10d'),'foreignKey':'MetricId'});db[_0x251f('0xa0')][_0x251f('0x147')](db[_0x251f('0x9e')],{'foreignKey':_0x251f('0x1aa')});db[_0x251f('0xa2')][_0x251f('0x109')](db[_0x251f('0xa4')],{'as':_0x251f('0x1ab'),'onDelete':_0x251f('0x10d'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x251f('0x109')](db[_0x251f('0xa6')],{'as':'Subjects','onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xa4')]['hasMany'](db['SalesforceField'],{'as':_0x251f('0x1ad'),'onDelete':'cascade','foreignKey':_0x251f('0x1ae')});db['SalesforceConfiguration'][_0x251f('0x109')](db[_0x251f('0xa6')],{'as':_0x251f('0x1a9'),'onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1af')});db['SalesforceConfiguration'][_0x251f('0x147')](db['SalesforceAccount'],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x1b0')});db[_0x251f('0xa6')][_0x251f('0x109')](db['SalesforceField'],{'as':_0x251f('0x1b1'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xa6')][_0x251f('0x109')](db[_0x251f('0xa6')],{'as':'Description','foreignKey':_0x251f('0x1ae')});db['SalesforceField'][_0x251f('0x109')](db[_0x251f('0xa6')],{'as':'Field','foreignKey':'FieldId'});db[_0x251f('0xa6')][_0x251f('0x147')](db[_0x251f('0x1b2')],{'as':_0x251f('0x1b2'),'foreignKey':_0x251f('0x1b3')});db[_0x251f('0x1b4')][_0x251f('0x109')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1b0')});db['SugarcrmConfiguration'][_0x251f('0x109')](db[_0x251f('0xaa')],{'as':'Subjects','onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xa8')][_0x251f('0x109')](db[_0x251f('0xaa')],{'as':'Descriptions','onDelete':_0x251f('0x10d'),'foreignKey':'DescriptionId'});db[_0x251f('0xa8')][_0x251f('0x109')](db[_0x251f('0xaa')],{'as':_0x251f('0x1a9'),'onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1af')});db[_0x251f('0xa8')][_0x251f('0x147')](db[_0x251f('0x1b4')],{'as':'Account','foreignKey':_0x251f('0x1b0')});db[_0x251f('0xaa')][_0x251f('0x109')](db[_0x251f('0xaa')],{'as':_0x251f('0x1b1'),'foreignKey':'SubjectId'});db[_0x251f('0xaa')][_0x251f('0x109')](db[_0x251f('0xaa')],{'as':_0x251f('0x1b5'),'foreignKey':_0x251f('0x1ae')});db['SugarcrmField']['hasMany'](db[_0x251f('0xaa')],{'as':_0x251f('0x1b6'),'foreignKey':_0x251f('0x1af')});db[_0x251f('0xaa')]['belongsTo'](db[_0x251f('0x1b2')],{'as':_0x251f('0x1b2'),'foreignKey':_0x251f('0x1b3')});db['DeskAccount'][_0x251f('0x109')](db[_0x251f('0xad')],{'as':_0x251f('0x1ab'),'onDelete':'cascade','foreignKey':_0x251f('0x1b0')});db[_0x251f('0xad')]['hasMany'](db['DeskField'],{'as':'Subjects','onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xad')]['hasMany'](db[_0x251f('0xaf')],{'as':_0x251f('0x1ad'),'onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1ae')});db[_0x251f('0xad')][_0x251f('0x109')](db['DeskField'],{'as':_0x251f('0x1a9'),'onDelete':'cascade','foreignKey':_0x251f('0x1af')});db[_0x251f('0xad')]['belongsTo'](db[_0x251f('0xac')],{'as':'Account','foreignKey':_0x251f('0x1b0')});db[_0x251f('0xad')]['belongsToMany'](db[_0x251f('0x90')],{'through':_0x251f('0x1b7')});db['DeskField']['hasMany'](db[_0x251f('0xaf')],{'as':_0x251f('0x1b1'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xaf')][_0x251f('0x109')](db[_0x251f('0xaf')],{'as':_0x251f('0x1b5'),'foreignKey':_0x251f('0x1ae')});db[_0x251f('0xaf')][_0x251f('0x109')](db[_0x251f('0xaf')],{'as':_0x251f('0x1b6'),'foreignKey':_0x251f('0x1af')});db[_0x251f('0xaf')][_0x251f('0x147')](db[_0x251f('0x1b2')],{'as':_0x251f('0x1b2'),'foreignKey':'VariableId'});db['ZohoAccount'][_0x251f('0x109')](db[_0x251f('0xb2')],{'as':_0x251f('0x1ab'),'onDelete':_0x251f('0x10d'),'foreignKey':'AccountId'});db[_0x251f('0xb2')][_0x251f('0x109')](db[_0x251f('0x1b8')],{'as':_0x251f('0x1b9'),'onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xb2')][_0x251f('0x109')](db['ZohoField'],{'as':'Descriptions','onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1ae')});db[_0x251f('0xb2')][_0x251f('0x109')](db[_0x251f('0x1b8')],{'as':'Fields','onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1af')});db[_0x251f('0xb2')][_0x251f('0x147')](db[_0x251f('0xb0')],{'as':'Account','foreignKey':_0x251f('0x1b0')});db[_0x251f('0x1b8')][_0x251f('0x109')](db[_0x251f('0x1b8')],{'as':_0x251f('0x1b1'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0x1b8')][_0x251f('0x109')](db[_0x251f('0x1b8')],{'as':'Description','foreignKey':_0x251f('0x1ae')});db['ZohoField'][_0x251f('0x109')](db[_0x251f('0x1b8')],{'as':_0x251f('0x1b6'),'foreignKey':_0x251f('0x1af')});db[_0x251f('0x1b8')][_0x251f('0x147')](db[_0x251f('0x1b2')],{'as':_0x251f('0x1b2'),'foreignKey':_0x251f('0x1b3')});db['ZendeskAccount'][_0x251f('0x109')](db['ZendeskConfiguration'],{'as':_0x251f('0x1ab'),'onDelete':'cascade','foreignKey':_0x251f('0x1b0')});db[_0x251f('0xb5')][_0x251f('0x109')](db[_0x251f('0x1ba')],{'as':_0x251f('0x1b9'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xb5')][_0x251f('0x109')](db[_0x251f('0x1ba')],{'as':_0x251f('0x1ad'),'foreignKey':'DescriptionId'});db[_0x251f('0xb5')][_0x251f('0x109')](db[_0x251f('0x1ba')],{'as':_0x251f('0x1a9'),'foreignKey':_0x251f('0x1af')});db['ZendeskConfiguration'][_0x251f('0x147')](db[_0x251f('0xb3')],{'as':'Account','foreignKey':_0x251f('0x1b0')});db['ZendeskConfiguration'][_0x251f('0x118')](db[_0x251f('0x90')],{'through':_0x251f('0x1bb')});db[_0x251f('0x1ba')][_0x251f('0x109')](db[_0x251f('0x1ba')],{'as':'Subject','foreignKey':_0x251f('0x1ac')});db[_0x251f('0x1ba')][_0x251f('0x109')](db[_0x251f('0x1ba')],{'as':_0x251f('0x1b5'),'foreignKey':'DescriptionId'});db[_0x251f('0x1ba')][_0x251f('0x109')](db[_0x251f('0x1ba')],{'as':_0x251f('0x1b6'),'foreignKey':_0x251f('0x1af')});db['ZendeskField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x251f('0x1b3')});db[_0x251f('0x1bc')][_0x251f('0x109')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1b0')});db[_0x251f('0xb9')][_0x251f('0x109')](db['FreshdeskField'],{'as':_0x251f('0x1b9'),'onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xb9')][_0x251f('0x109')](db['FreshdeskField'],{'as':_0x251f('0x1ad'),'onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1ae')});db['FreshdeskConfiguration']['hasMany'](db[_0x251f('0xba')],{'as':_0x251f('0x1a9'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x251f('0xb9')]['belongsTo'](db[_0x251f('0x1bc')],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x1b0')});db[_0x251f('0xb9')][_0x251f('0x118')](db['Tag'],{'through':_0x251f('0x1bd')});db[_0x251f('0xba')][_0x251f('0x109')](db[_0x251f('0xba')],{'as':_0x251f('0x1b1'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xba')][_0x251f('0x109')](db[_0x251f('0xba')],{'as':'Description','foreignKey':_0x251f('0x1ae')});db[_0x251f('0xba')][_0x251f('0x109')](db[_0x251f('0xba')],{'as':_0x251f('0x1b6'),'foreignKey':'FieldId'});db[_0x251f('0xba')]['belongsTo'](db[_0x251f('0x1b2')],{'as':'Variable','foreignKey':_0x251f('0x1b3')});db[_0x251f('0xbc')]['hasMany'](db[_0x251f('0xbe')],{'as':_0x251f('0x1ab'),'onDelete':_0x251f('0x10d'),'foreignKey':'AccountId'});db[_0x251f('0xbe')]['hasMany'](db[_0x251f('0xc0')],{'as':_0x251f('0x1b9'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xbe')]['hasMany'](db['VtigerField'],{'as':_0x251f('0x1ad'),'foreignKey':_0x251f('0x1ae')});db[_0x251f('0xbe')][_0x251f('0x109')](db[_0x251f('0xc0')],{'as':'Fields','foreignKey':_0x251f('0x1af')});db['VtigerConfiguration'][_0x251f('0x147')](db[_0x251f('0xbc')],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x1b0')});db[_0x251f('0xc0')][_0x251f('0x109')](db[_0x251f('0xc0')],{'as':_0x251f('0x1b1'),'foreignKey':_0x251f('0x1ac')});db['VtigerField'][_0x251f('0x109')](db['VtigerField'],{'as':_0x251f('0x1b5'),'foreignKey':_0x251f('0x1ae')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Field','foreignKey':_0x251f('0x1af')});db[_0x251f('0xc0')][_0x251f('0x147')](db[_0x251f('0x1b2')],{'as':_0x251f('0x1b2'),'foreignKey':_0x251f('0x1b3')});db[_0x251f('0x1be')][_0x251f('0x109')](db[_0x251f('0xc3')],{'as':_0x251f('0x1ab'),'onDelete':_0x251f('0x10d'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0x251f('0x109')](db[_0x251f('0xc4')],{'as':_0x251f('0x1b9'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xc3')]['hasMany'](db[_0x251f('0xc4')],{'as':'Descriptions','foreignKey':_0x251f('0x1ae')});db[_0x251f('0xc3')]['hasMany'](db[_0x251f('0xc4')],{'as':_0x251f('0x1a9'),'foreignKey':_0x251f('0x1af')});db['ServicenowConfiguration']['belongsTo'](db[_0x251f('0x1be')],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x1b0')});db['ServicenowField'][_0x251f('0x109')](db['ServicenowField'],{'as':_0x251f('0x1b1'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xc4')][_0x251f('0x109')](db[_0x251f('0xc4')],{'as':_0x251f('0x1b5'),'foreignKey':_0x251f('0x1ae')});db['ServicenowField'][_0x251f('0x109')](db['ServicenowField'],{'as':'Field','foreignKey':_0x251f('0x1af')});db[_0x251f('0xc4')]['belongsTo'](db['Variable'],{'as':_0x251f('0x1b2'),'foreignKey':_0x251f('0x1b3')});db[_0x251f('0x1bf')]['hasMany'](db[_0x251f('0xc6')],{'as':_0x251f('0x1ab'),'onDelete':'cascade','foreignKey':_0x251f('0x1b0')});db['Dynamics365Configuration'][_0x251f('0x109')](db['Dynamics365Field'],{'as':_0x251f('0x1b9'),'onDelete':_0x251f('0x10d'),'foreignKey':'SubjectId'});db[_0x251f('0xc6')][_0x251f('0x109')](db[_0x251f('0xc7')],{'as':_0x251f('0x1ad'),'onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1ae')});db['Dynamics365Configuration'][_0x251f('0x109')](db[_0x251f('0xc7')],{'as':_0x251f('0x1a9'),'onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1af')});db[_0x251f('0xc6')][_0x251f('0x147')](db['Dynamics365Account'],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x1b0')});db[_0x251f('0xc7')][_0x251f('0x109')](db[_0x251f('0xc7')],{'as':_0x251f('0x1b1'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0xc7')][_0x251f('0x109')](db[_0x251f('0xc7')],{'as':'Description','foreignKey':'DescriptionId'});db['Dynamics365Field'][_0x251f('0x109')](db[_0x251f('0xc7')],{'as':'Field','foreignKey':'FieldId'});db['Dynamics365Field'][_0x251f('0x147')](db[_0x251f('0x1b2')],{'as':_0x251f('0x1b2'),'foreignKey':_0x251f('0x1b3')});db[_0x251f('0xc8')]['hasMany'](db[_0x251f('0xca')],{'as':'Configurations','onDelete':_0x251f('0x10d'),'foreignKey':_0x251f('0x1b0')});db[_0x251f('0xca')][_0x251f('0x109')](db[_0x251f('0x1c0')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x251f('0xca')][_0x251f('0x109')](db[_0x251f('0x1c0')],{'as':_0x251f('0x1ad'),'foreignKey':_0x251f('0x1ae')});db[_0x251f('0xca')]['hasMany'](db[_0x251f('0x1c0')],{'as':'Fields','foreignKey':'FieldId'});db[_0x251f('0xca')][_0x251f('0x147')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x251f('0x1b0')});db[_0x251f('0x1c0')][_0x251f('0x109')](db[_0x251f('0x1c0')],{'as':_0x251f('0x1b1'),'foreignKey':_0x251f('0x1ac')});db[_0x251f('0x1c0')][_0x251f('0x109')](db[_0x251f('0x1c0')],{'as':_0x251f('0x1b5'),'foreignKey':'DescriptionId'});db[_0x251f('0x1c0')][_0x251f('0x109')](db[_0x251f('0x1c0')],{'as':'Field','foreignKey':'FieldId'});db[_0x251f('0x1c0')]['belongsTo'](db[_0x251f('0x1b2')],{'as':_0x251f('0x1b2'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0x251f('0x147')](db[_0x251f('0x63')],{});db[_0x251f('0xce')][_0x251f('0x147')](db['CmList'],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x16e')});db[_0x251f('0xce')][_0x251f('0x147')](db[_0x251f('0x73')],{'as':_0x251f('0x164'),'foreignKey':'ContactId'});db[_0x251f('0xce')]['belongsTo'](db['ChatInteraction'],{});db['ChatQueueReport'][_0x251f('0x147')](db['ChatMessage'],{});db[_0x251f('0xce')][_0x251f('0x147')](db['User'],{});db[_0x251f('0xce')][_0x251f('0x147')](db['ChatQueue'],{});db[_0x251f('0xcf')][_0x251f('0x147')](db[_0x251f('0x15')],{'onDelete':'cascade','foreignKey':_0x251f('0x1c1')});db['ChatInternalMessage'][_0x251f('0x147')](db[_0x251f('0x15')],{'onDelete':_0x251f('0x10d'),'foreignKey':'ToId'});db[_0x251f('0xd3')][_0x251f('0x109')](db['JscriptyQuestionReport'],{'foreignKey':_0x251f('0x1c2'),'onDelete':'cascade'});db[_0x251f('0xd3')][_0x251f('0x109')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x251f('0x10d')});db[_0x251f('0xd4')]['belongsTo'](db['SmsAccount'],{});db[_0x251f('0xd4')][_0x251f('0x147')](db[_0x251f('0xf6')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x16e')});db['SmsQueueReport'][_0x251f('0x147')](db[_0x251f('0x73')],{'as':_0x251f('0x164'),'foreignKey':_0x251f('0x158')});db[_0x251f('0xd4')][_0x251f('0x147')](db['SmsInteraction'],{});db[_0x251f('0xd4')][_0x251f('0x147')](db[_0x251f('0x59')],{});db[_0x251f('0xd4')][_0x251f('0x147')](db[_0x251f('0x15')],{});db['SmsQueueReport'][_0x251f('0x147')](db[_0x251f('0x12a')],{});db[_0x251f('0xd9')][_0x251f('0x109')](db[_0x251f('0xd3')],{'foreignKey':_0x251f('0x1c3')});db['JscriptyProject'][_0x251f('0x109')](db['JscriptyQuestionReport'],{'foreignKey':_0x251f('0x1c3')});db[_0x251f('0xd9')][_0x251f('0x109')](db[_0x251f('0xd0')],{'foreignKey':_0x251f('0x1c3')});db[_0x251f('0xdf')][_0x251f('0x118')](db[_0x251f('0x15')],{'as':_0x251f('0x169'),'through':_0x251f('0x13a')});db[_0x251f('0xe4')]['belongsToMany'](db[_0x251f('0x15')],{'as':_0x251f('0x14e'),'through':'user_has_teams'});db['Team']['belongsToMany'](db['VoiceQueue'],{'through':_0x251f('0x150'),'as':_0x251f('0x126')});db[_0x251f('0xe4')]['belongsToMany'](db['MailQueue'],{'through':_0x251f('0x161'),'as':_0x251f('0x1c4')});db[_0x251f('0xe4')][_0x251f('0x118')](db[_0x251f('0x6c')],{'through':_0x251f('0x189'),'as':_0x251f('0x1c5')});db['Team'][_0x251f('0x118')](db[_0x251f('0x50')],{'through':_0x251f('0x177'),'as':_0x251f('0x128')});db['Team'][_0x251f('0x118')](db[_0x251f('0x12a')],{'through':_0x251f('0x17b'),'as':_0x251f('0x12b')});db['Team'][_0x251f('0x118')](db['OpenchannelQueue'],{'through':_0x251f('0x180'),'as':_0x251f('0x12c')});db[_0x251f('0xe4')][_0x251f('0x118')](db[_0x251f('0x104')],{'through':_0x251f('0x1c6'),'as':_0x251f('0x1c7')});db[_0x251f('0xe7')][_0x251f('0x109')](db[_0x251f('0x18d')],{'as':_0x251f('0x142'),'foreignKey':_0x251f('0x192')});db['Campaign'][_0x251f('0x109')](db['CmHopperFinal'],{'as':_0x251f('0x10e'),'foreignKey':'CampaignId'});db[_0x251f('0xe7')][_0x251f('0x109')](db[_0x251f('0x79')],{'as':_0x251f('0x144'),'foreignKey':_0x251f('0x192')});db[_0x251f('0xe7')][_0x251f('0x109')](db[_0x251f('0x76')],{'as':_0x251f('0x145'),'foreignKey':_0x251f('0x192')});db[_0x251f('0xe7')][_0x251f('0x147')](db['Trunk'],{'as':_0x251f('0x2a'),'foreignKey':_0x251f('0x148')});db[_0x251f('0xe7')][_0x251f('0x147')](db[_0x251f('0x2a')],{'as':_0x251f('0x149'),'foreignKey':'TrunkBackupId'});db[_0x251f('0xe7')][_0x251f('0x147')](db[_0x251f('0x87')],{'as':'Interval','foreignKey':_0x251f('0x16c')});db[_0x251f('0xe7')][_0x251f('0x147')](db[_0x251f('0xdf')],{'as':_0x251f('0xdf'),'foreignKey':_0x251f('0x1c8')});db[_0x251f('0xe7')][_0x251f('0x118')](db[_0x251f('0xf6')],{'as':_0x251f('0x11c'),'through':_0x251f('0x1c9')});db[_0x251f('0xe7')][_0x251f('0x118')](db[_0x251f('0xf6')],{'as':_0x251f('0x1ca'),'through':_0x251f('0x1cb')});db[_0x251f('0x1cc')][_0x251f('0x147')](db[_0x251f('0x41')],{});db[_0x251f('0x1cc')][_0x251f('0x147')](db[_0x251f('0x40')],{});db[_0x251f('0x1cc')]['belongsTo'](db[_0x251f('0x3c')],{'foreignKey':_0x251f('0x1cd'),'as':_0x251f('0x1ce')});db[_0x251f('0x1cc')][_0x251f('0x147')](db[_0x251f('0x15')],{'foreignKey':_0x251f('0x1cf'),'as':_0x251f('0x1d0')});db[_0x251f('0x1cc')][_0x251f('0x147')](db[_0x251f('0x15')],{'foreignKey':_0x251f('0x1d1'),'as':_0x251f('0x1d2')});db[_0x251f('0x1cc')]['belongsTo'](db[_0x251f('0x3e')],{'foreignKey':_0x251f('0x1d3'),'as':_0x251f('0x1d4')});db[_0x251f('0x1cc')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x251f('0x1d5'),'as':_0x251f('0x1d6')});db['ChatTransferReport'][_0x251f('0x147')](db['ChatMessage'],{});db['ChatTransferReport'][_0x251f('0x147')](db[_0x251f('0x111')],{});db[_0x251f('0xee')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x251f('0x1d7'),'as':_0x251f('0x1ce')});db[_0x251f('0xee')][_0x251f('0x147')](db[_0x251f('0x15')],{'foreignKey':_0x251f('0x1cf'),'as':_0x251f('0x1d0')});db['ChatTransferReport'][_0x251f('0x147')](db['User'],{'foreignKey':'ToUserId','as':_0x251f('0x1d2')});db[_0x251f('0xee')][_0x251f('0x147')](db['ChatQueue'],{'foreignKey':_0x251f('0x1d8'),'as':'ToQueue'});db[_0x251f('0xee')][_0x251f('0x147')](db['ChatWebsite'],{'foreignKey':_0x251f('0x1d9'),'as':_0x251f('0x1d6')});db[_0x251f('0xf0')][_0x251f('0x147')](db['FaxMessage'],{});db[_0x251f('0xf0')][_0x251f('0x147')](db[_0x251f('0x4c')],{});db['FaxTransferReport'][_0x251f('0x147')](db[_0x251f('0x49')],{'foreignKey':_0x251f('0x1da'),'as':_0x251f('0x1ce')});db['FaxTransferReport'][_0x251f('0x147')](db[_0x251f('0x15')],{'foreignKey':_0x251f('0x1cf'),'as':_0x251f('0x1d0')});db['FaxTransferReport']['belongsTo'](db[_0x251f('0x15')],{'foreignKey':_0x251f('0x1d1'),'as':_0x251f('0x1d2')});db['FaxTransferReport'][_0x251f('0x147')](db[_0x251f('0x50')],{'foreignKey':_0x251f('0x1db'),'as':'ToQueue'});db[_0x251f('0xf0')][_0x251f('0x147')](db[_0x251f('0x49')],{'foreignKey':_0x251f('0x1dc'),'as':'ToAccount'});db[_0x251f('0xf2')]['belongsTo'](db[_0x251f('0x60')],{});db[_0x251f('0xf2')]['belongsTo'](db[_0x251f('0x110')],{});db[_0x251f('0xf2')][_0x251f('0x147')](db[_0x251f('0x5c')],{'foreignKey':_0x251f('0x1dd'),'as':'FromAccount'});db[_0x251f('0xf2')][_0x251f('0x147')](db[_0x251f('0x15')],{'foreignKey':_0x251f('0x1cf'),'as':_0x251f('0x1d0')});db['OpenchannelTransferReport'][_0x251f('0x147')](db[_0x251f('0x15')],{'foreignKey':_0x251f('0x1d1'),'as':_0x251f('0x1d2')});db['OpenchannelTransferReport']['belongsTo'](db[_0x251f('0x62')],{'foreignKey':'ToOpenchannelQueueId','as':_0x251f('0x1d4')});db['OpenchannelTransferReport'][_0x251f('0x147')](db[_0x251f('0x5c')],{'foreignKey':_0x251f('0x1de'),'as':_0x251f('0x1d6')});db[_0x251f('0xf4')]['belongsTo'](db[_0x251f('0x59')],{});db[_0x251f('0xf4')][_0x251f('0x147')](db[_0x251f('0x57')],{});db[_0x251f('0xf4')][_0x251f('0x147')](db[_0x251f('0x135')],{'foreignKey':_0x251f('0x1df'),'as':_0x251f('0x1ce')});db[_0x251f('0xf4')][_0x251f('0x147')](db[_0x251f('0x15')],{'foreignKey':'FromUserId','as':_0x251f('0x1d0')});db[_0x251f('0xf4')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x251f('0xf4')]['belongsTo'](db[_0x251f('0x12a')],{'foreignKey':_0x251f('0x1e0'),'as':_0x251f('0x1d4')});db['SmsTransferReport'][_0x251f('0x147')](db[_0x251f('0x135')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x251f('0xf6')]['hasMany'](db[_0x251f('0x84')],{'as':_0x251f('0x15e'),'foreignKey':_0x251f('0x16e')});db[_0x251f('0xf6')][_0x251f('0x109')](db[_0x251f('0x7d')],{'as':'CustomFields','foreignKey':_0x251f('0x16e')});db['CmList'][_0x251f('0x109')](db[_0x251f('0x73')],{'as':'Contacts','onDelete':_0x251f('0x10d'),'foreignKey':'ListId'});db[_0x251f('0xf6')][_0x251f('0x109')](db[_0x251f('0x77')],{'as':_0x251f('0x10e'),'foreignKey':_0x251f('0x16e')});db[_0x251f('0xf6')][_0x251f('0x109')](db[_0x251f('0x79')],{'as':'HopperHistory','foreignKey':_0x251f('0x16e')});db['CmList']['hasMany'](db[_0x251f('0x7b')],{'as':_0x251f('0x7b'),'foreignKey':'ListId'});db['CmList'][_0x251f('0x118')](db['VoiceQueue'],{'as':'Queues','through':_0x251f('0x14d')});db[_0x251f('0xf6')][_0x251f('0x118')](db[_0x251f('0x15')],{'as':'Agents','through':'cm_user_has_lists'});db[_0x251f('0xf7')]['hasMany'](db['VoiceExtension'],{'as':_0x251f('0x10c'),'onDelete':_0x251f('0x10d')});db[_0x251f('0xf7')]['belongsToMany'](db[_0x251f('0x15')],{'as':_0x251f('0x14e'),'through':_0x251f('0x12e')});db['UserProfile'][_0x251f('0x109')](db[_0x251f('0x15')],{'as':_0x251f('0x169'),'foreignKey':_0x251f('0x1e1')});db[_0x251f('0xf9')][_0x251f('0x109')](db[_0x251f('0xfa')],{'as':_0x251f('0x1e2'),'foreignKey':_0x251f('0x1e1'),'onDelete':_0x251f('0x10d')});db[_0x251f('0xfa')][_0x251f('0x109')](db[_0x251f('0x1e3')],{'as':_0x251f('0x1e4'),'foreignKey':'sectionId','onDelete':_0x251f('0x10d')});db[_0x251f('0xfd')][_0x251f('0x109')](db[_0x251f('0x84')],{'as':'Dispositions','foreignKey':_0x251f('0x1e5')});db[_0x251f('0xfd')][_0x251f('0x109')](db[_0x251f('0x83')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x1e5')});db['WhatsappAccount'][_0x251f('0x109')](db[_0x251f('0x1e6')],{'as':_0x251f('0x152'),'foreignKey':'WhatsappAccountId'});db[_0x251f('0xfd')][_0x251f('0x109')](db['WhatsappInteraction'],{'as':_0x251f('0x15f')});db[_0x251f('0xfd')]['hasMany'](db[_0x251f('0xff')],{'as':_0x251f('0x13d')});db[_0x251f('0xfd')]['belongsTo'](db['CmList'],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x16e')});db['WhatsappAccount']['belongsTo'](db[_0x251f('0x89')],{'as':_0x251f('0x14b'),'foreignKey':_0x251f('0x14c')});db[_0x251f('0xfd')][_0x251f('0x118')](db[_0x251f('0x15')],{'as':_0x251f('0x14e'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x251f('0x147')](db['User'],{'onDelete':_0x251f('0x16b')});db[_0x251f('0xff')][_0x251f('0x147')](db[_0x251f('0x104')],{'onDelete':'restrict'});db[_0x251f('0xff')][_0x251f('0x147')](db['WhatsappAccount'],{'onDelete':_0x251f('0x16b')});db[_0x251f('0xff')]['belongsTo'](db[_0x251f('0x87')],{'onDelete':_0x251f('0x16b'),'foreignKey':'IntervalId'});db[_0x251f('0xff')][_0x251f('0x147')](db[_0x251f('0x90')],{'onDelete':_0x251f('0x16b'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0x251f('0x109')](db['WhatsappMessage'],{'as':_0x251f('0x152'),'onDelete':'cascade','foreignKey':_0x251f('0x1e7')});db[_0x251f('0x101')][_0x251f('0x147')](db[_0x251f('0xfd')],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x1e5')});db[_0x251f('0x101')]['belongsTo'](db[_0x251f('0x73')],{'as':_0x251f('0x164'),'foreignKey':_0x251f('0x158')});db[_0x251f('0x101')][_0x251f('0x147')](db[_0x251f('0x15')],{'as':_0x251f('0x165'),'foreignKey':'UserId'});db[_0x251f('0x101')][_0x251f('0x118')](db[_0x251f('0x90')],{'through':_0x251f('0x1a3'),'as':'Tags'});db[_0x251f('0x101')][_0x251f('0x118')](db['Tag'],{'through':_0x251f('0x1a3'),'as':_0x251f('0x168')});db[_0x251f('0x101')][_0x251f('0x118')](db['User'],{'as':'Users','through':_0x251f('0x125'),'foreignKey':_0x251f('0x1e7')});db[_0x251f('0x1e6')][_0x251f('0x147')](db[_0x251f('0x15')],{'as':_0x251f('0x15')});db['WhatsappMessage']['belongsTo'](db[_0x251f('0x73')],{'onDelete':_0x251f('0x10d'),'as':_0x251f('0x164')});db[_0x251f('0x1e6')][_0x251f('0x147')](db[_0x251f('0x101')],{'onDelete':_0x251f('0x10d'),'as':'Interaction','foreignKey':_0x251f('0x1e7')});db['WhatsappMessage'][_0x251f('0x147')](db[_0x251f('0xfd')],{'as':_0x251f('0x163'),'foreignKey':_0x251f('0x1e5')});db[_0x251f('0x1e8')]['belongsTo'](db[_0x251f('0xfd')],{});db['WhatsappQueueReport'][_0x251f('0x147')](db['CmList'],{'as':_0x251f('0x160'),'foreignKey':'ListId'});db[_0x251f('0x1e8')][_0x251f('0x147')](db[_0x251f('0x73')],{'as':'Contact','foreignKey':_0x251f('0x158')});db['WhatsappQueueReport']['belongsTo'](db[_0x251f('0x101')],{});db[_0x251f('0x1e8')][_0x251f('0x147')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x251f('0x147')](db[_0x251f('0x1e6')],{});db['WhatsappQueueReport'][_0x251f('0x147')](db['User'],{});db[_0x251f('0x103')][_0x251f('0x147')](db[_0x251f('0x1e6')],{});db[_0x251f('0x103')][_0x251f('0x147')](db[_0x251f('0x101')],{});db[_0x251f('0x103')][_0x251f('0x147')](db[_0x251f('0xfd')],{'foreignKey':'FromWhatsappAccountId','as':'FromAccount'});db[_0x251f('0x103')][_0x251f('0x147')](db[_0x251f('0xfd')],{'foreignKey':'ToWhatsappAccountId','as':_0x251f('0x1d6')});db[_0x251f('0x103')]['belongsTo'](db[_0x251f('0x104')],{'foreignKey':_0x251f('0x1e9'),'as':'ToQueue'});db[_0x251f('0x103')][_0x251f('0x147')](db[_0x251f('0x15')],{'foreignKey':'FromUserId','as':'FromAgent'});db['WhatsappTransferReport'][_0x251f('0x147')](db[_0x251f('0x15')],{'foreignKey':'ToUserId','as':_0x251f('0x1d2')});db[_0x251f('0x104')][_0x251f('0x118')](db[_0x251f('0x15')],{'as':_0x251f('0x14e'),'through':_0x251f('0x1ea'),'foreignKey':_0x251f('0x1eb')});db['WhatsappQueue']['belongsToMany'](db['Team'],{'through':_0x251f('0x1c6'),'as':_0x251f('0x14f')});module[_0x251f('0x1ec')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa1db=['VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','uniqueid','VoiceAgentReport','Contact','MailAccountId','Imap','Dispositions','Answers','Interactions','MailApplication','ListId','TemplateId','mandatoryDispositionPauseId','user_has_mail_accounts','team_has_mail_queues','MailMessage','ContactId','Tag','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','MailInteractionId','Account','restrict','IntervalId','TagId','MailQueueReport','List','Items','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','AttachmentId','UserFaxQueue','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsApplication','Owner','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','UserOpenchannelQueue','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatGroupId','chat_group_has_users','CompanyId','cm_user_has_contacts','cm_contact_has_tags','CampaignId','Automation','AutomationAllId','Any','AutomationAnyId','Action','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Descriptions','FieldId','Subject','SubjectId','Description','VariableId','SugarcrmAccount','Field','DeskField','Subjects','DescriptionId','DeskAccount','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZohoField','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','ServicenowConfiguration','FromId','SessionId','JscriptyAnswerReport','ProjectId','VoiceQueues','team_has_chat_queues','FromMailAccountId','FromAccount','FromUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToUserId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Contacts','HopperHistory','Queues','user_has_voice_prefixes','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','password','database','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','User','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','CmContact','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','user_has_whatsapp_interactions','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_chat_websites','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','ChanSpyId','Applications','Sounds','moh_has_sounds','Members'];(function(_0x13a842,_0x26974f){var _0xd6d41a=function(_0x37758c){while(--_0x37758c){_0x13a842['push'](_0x13a842['shift']());}};_0xd6d41a(++_0x26974f);}(_0xa1db,0xb0));var _0xba1d=function(_0x2f7270,_0x307af1){_0x2f7270=_0x2f7270-0x0;var _0xe1d89a=_0xa1db[_0x2f7270];return _0xe1d89a;};'use strict';var path=require(_0xba1d('0x0'));var config=require(_0xba1d('0x1'));var Sequelize=require(_0xba1d('0x2'));var _=require(_0xba1d('0x3'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xba1d('0x2')]=_[_0xba1d('0x4')](config['sequelize'],{'database':_0xba1d('0x5'),'username':_0xba1d('0x6'),'password':_0xba1d('0x7'),'options':{'host':_0xba1d('0x8'),'port':0xcea,'dialect':_0xba1d('0x9'),'dialectOptions':{'charset':_0xba1d('0xa')},'logging':![],'timezone':timezone[_0xba1d('0xb')](),'define':{'charset':_0xba1d('0xc'),'collate':_0xba1d('0xd')}}});config[_0xba1d('0xe')]=_[_0xba1d('0x4')](config[_0xba1d('0xe')],{'database':_0xba1d('0x5'),'username':'xcall','password':_0xba1d('0x7'),'options':{'host':_0xba1d('0x8'),'port':0xcea,'dialect':_0xba1d('0x9'),'dialectOptions':{'charset':_0xba1d('0xa')},'logging':![],'timezone':timezone[_0xba1d('0xb')](),'define':{'charset':_0xba1d('0xc'),'collate':_0xba1d('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xba1d('0x2')]['database'],config[_0xba1d('0x2')][_0xba1d('0xf')],config[_0xba1d('0x2')][_0xba1d('0x10')],config[_0xba1d('0x2')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xba1d('0x11')],config[_0xba1d('0xe')][_0xba1d('0xf')],config[_0xba1d('0xe')][_0xba1d('0x10')],config[_0xba1d('0xe')]['options'])};db['User']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x13'));db['VoiceChanSpy']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x14'));db[_0xba1d('0x15')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/voiceContext/voiceContext.model');db[_0xba1d('0x16')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x17'));db[_0xba1d('0x18')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x19'));db[_0xba1d('0x1a')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x1b'));db[_0xba1d('0x1c')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x1d'));db['ScreenRecording']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x1e'));db['VoiceMail']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x1f'));db[_0xba1d('0x20')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x21'));db[_0xba1d('0x22')]=db['sequelize']['import'](_0xba1d('0x23'));db['VoiceDialReport']=db[_0xba1d('0x2')]['import']('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x24'));db[_0xba1d('0x25')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x26'));db[_0xba1d('0x27')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x28'));db[_0xba1d('0x29')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x2a'));db[_0xba1d('0x2b')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x2c'));db[_0xba1d('0x2d')]=db['sequelize'][_0xba1d('0x12')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xba1d('0x2e')]=db[_0xba1d('0x2')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x2f'));db[_0xba1d('0x30')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x31'));db['UserFaxQueue']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0xba1d('0x32')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x33'));db['UserOpenchannelQueue']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xba1d('0x34')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x35'));db[_0xba1d('0x36')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x37'));db[_0xba1d('0x38')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x39'));db[_0xba1d('0x3a')]=db['sequelize'][_0xba1d('0x12')]('../api/mailAccount/mailAccount.model');db[_0xba1d('0x3b')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x3c'));db[_0xba1d('0x3d')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x3e'));db[_0xba1d('0x3f')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0xba1d('0x2')]['import'](_0xba1d('0x40'));db['MailApplication']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x41'));db['MailQueueReport']=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x42'));db[_0xba1d('0x43')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x44'));db[_0xba1d('0x45')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/dashboardItem/dashboardItem.model');db[_0xba1d('0x46')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x47'));db[_0xba1d('0x48')]=db['sequelize']['import'](_0xba1d('0x49'));db[_0xba1d('0x4a')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x4b'));db[_0xba1d('0x4c')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x4d'));db[_0xba1d('0x4e')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x4f'));db[_0xba1d('0x50')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x51'));db['SmsInteraction']=db['sequelize']['import'](_0xba1d('0x52'));db[_0xba1d('0x53')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x54'));db[_0xba1d('0x55')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x56'));db[_0xba1d('0x57')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x58'));db[_0xba1d('0x59')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/openchannelApplication/openchannelApplication.model');db[_0xba1d('0x5a')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xba1d('0x5b')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x5c'));db['OpenchannelQueue']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x5d'));db[_0xba1d('0x5e')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x5f'));db[_0xba1d('0x60')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x61'));db[_0xba1d('0x62')]=db[_0xba1d('0x2')]['import']('../api/chatApplication/chatApplication.model');db[_0xba1d('0x63')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x64'));db[_0xba1d('0x65')]=db['sequelize'][_0xba1d('0x12')]('../api/chatMessage/chatMessage.model');db[_0xba1d('0x66')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x67'));db[_0xba1d('0x68')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x69'));db[_0xba1d('0x6a')]=db[_0xba1d('0x2')]['import']('../api/chatGroup/chatGroup.model');db[_0xba1d('0x6b')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x6c'));db[_0xba1d('0x6d')]=db[_0xba1d('0x2')]['import']('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x6e'));db[_0xba1d('0x6f')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x70'));db[_0xba1d('0x71')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x72'));db[_0xba1d('0x73')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x74'));db[_0xba1d('0x75')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x76'));db[_0xba1d('0x77')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x78'));db[_0xba1d('0x79')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0xba1d('0x2')]['import'](_0xba1d('0x7a'));db['Automation']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x7b'));db[_0xba1d('0x7c')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x7d'));db[_0xba1d('0x7e')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x7f'));db['Condition']=db[_0xba1d('0x2')]['import']('../api/condition/condition.model');db['Interval']=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x80'));db[_0xba1d('0x81')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x82'));db['Cdr']=db[_0xba1d('0x2')]['import']('../api/cdr/cdr.model');db[_0xba1d('0x83')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xba1d('0x84')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x85'));db['Sound']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/sound/sound.model');db['Tag']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x86'));db[_0xba1d('0x87')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x88'));db[_0xba1d('0x89')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x8a'));db[_0xba1d('0x8b')]=db[_0xba1d('0x2')]['import'](_0xba1d('0x8c'));db[_0xba1d('0x8d')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x8e'));db['IntegrationReport']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x8f'));db[_0xba1d('0x90')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0x91'));db['AnalyticDefaultReport']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x92'));db[_0xba1d('0x93')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x94'));db[_0xba1d('0x95')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0xba1d('0x96')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xba1d('0x97')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x98'));db[_0xba1d('0x99')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x9a'));db[_0xba1d('0x9b')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x9c'));db[_0xba1d('0x9d')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0xba1d('0x2')]['import'](_0xba1d('0x9e'));db[_0xba1d('0x9f')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xba1d('0xa0')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xa1'));db['DeskAccount']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xa2'));db[_0xba1d('0xa3')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xa4'));db['DeskField']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xa5'));db['ZohoAccount']=db['sequelize']['import'](_0xba1d('0xa6'));db['ZohoConfiguration']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xa7'));db['ZohoField']=db['sequelize']['import']('../api/intZohoField/intZohoField.model');db[_0xba1d('0xa8')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xa9'));db[_0xba1d('0xaa')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xab'));db[_0xba1d('0xac')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xad'));db['FreshdeskAccount']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xae'));db[_0xba1d('0xaf')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xb0'));db['FreshdeskField']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xba1d('0xb1')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xb2'));db['VtigerConfiguration']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xba1d('0xb3')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xb4'));db['ServicenowAccount']=db['sequelize']['import'](_0xba1d('0xb5'));db['ServicenowConfiguration']=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xba1d('0xb6')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xb7'));db[_0xba1d('0xb8')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xba1d('0xb9')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xba1d('0xba')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xbb'));db[_0xba1d('0xbc')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xbd'));db[_0xba1d('0xbe')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xbf'));db[_0xba1d('0xc0')]=db['sequelize'][_0xba1d('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xba1d('0x8d')]=db['sequelize'][_0xba1d('0x12')]('../api/integration/integration.model');db[_0xba1d('0xc1')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xc2'));db[_0xba1d('0xc3')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xc4'));db[_0xba1d('0xc5')]=db[_0xba1d('0x2')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xc6'));db[_0xba1d('0xc7')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xc8'));db[_0xba1d('0xc9')]=db['sequelize'][_0xba1d('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xba1d('0xca')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xcb'));db[_0xba1d('0xcc')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xcd'));db[_0xba1d('0xce')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xcf'));db[_0xba1d('0xd0')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xd1'));db[_0xba1d('0xd2')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xd3'));db[_0xba1d('0xd4')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xd5'));db[_0xba1d('0xd6')]=db['sequelize']['import'](_0xba1d('0xd7'));db['SquareRecording']=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xd8'));db[_0xba1d('0xd9')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xda'));db[_0xba1d('0xdb')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xdc'));db[_0xba1d('0xdd')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xde'));db[_0xba1d('0xdf')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xe0'));db['Migration']=db[_0xba1d('0x2')]['import'](_0xba1d('0xe1'));db[_0xba1d('0xe2')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xe3'));db[_0xba1d('0xe4')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xe5'));db[_0xba1d('0xe6')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xe7'));db[_0xba1d('0xe8')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xe9'));db['FaxTransferReport']=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xea'));db['OpenchannelTransferReport']=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xeb'));db[_0xba1d('0xec')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xed'));db[_0xba1d('0xee')]=db[_0xba1d('0x2')]['import']('../api/cmList/cmList.model');db[_0xba1d('0xef')]=db['sequelize'][_0xba1d('0x12')](_0xba1d('0xf0'));db[_0xba1d('0xf1')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xf2'));db[_0xba1d('0xf3')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xf4'));db[_0xba1d('0xf5')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0xba1d('0xf6')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/notification/notification.model');db[_0xba1d('0xf7')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xf8'));db[_0xba1d('0xf9')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xfa'));db[_0xba1d('0xfb')]=db[_0xba1d('0x2')]['import'](_0xba1d('0xfc'));db[_0xba1d('0xfd')]=db[_0xba1d('0x2')][_0xba1d('0x12')]('../api/whatsappMessage/whatsappMessage.model');db[_0xba1d('0xfe')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0xff'));db[_0xba1d('0x100')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x101'));db[_0xba1d('0x102')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x103'));db[_0xba1d('0x104')]=db[_0xba1d('0x2')][_0xba1d('0x12')](_0xba1d('0x105'));db[_0xba1d('0x106')][_0xba1d('0x107')](db[_0xba1d('0x108')],{'as':_0xba1d('0x108'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x10a')});db['User'][_0xba1d('0x10b')](db['VoiceRecording'],{'as':_0xba1d('0x10c'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db['UserVoiceQueueRt'],{'as':_0xba1d('0x10d'),'foreignKey':'UserId'});db[_0xba1d('0x106')]['hasMany'](db['VoiceExtension'],{'as':_0xba1d('0x10e'),'onDelete':'cascade','hooks':!![]});db[_0xba1d('0x106')][_0xba1d('0x10b')](db[_0xba1d('0x73')],{'as':'HopperFinals','foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')]['hasMany'](db[_0xba1d('0x75')],{'as':'HopperHistory','foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db[_0xba1d('0x77')],{'as':_0xba1d('0x77'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db['OpenchannelInteraction'],{'as':_0xba1d('0x10f'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')]['hasMany'](db['ChatInteraction'],{'as':_0xba1d('0x110'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')]['hasMany'](db['SmsInteraction'],{'as':_0xba1d('0x111'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db[_0xba1d('0x4a')],{'as':'FaxInteractions','foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')]['hasMany'](db[_0xba1d('0x3f')],{'as':_0xba1d('0x112'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db[_0xba1d('0xfb')],{'as':_0xba1d('0x113'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x106')][_0xba1d('0x10b')](db[_0xba1d('0xf6')],{'as':_0xba1d('0x114'),'foreignKey':_0xba1d('0x115')});db[_0xba1d('0x106')][_0xba1d('0x116')](db[_0xba1d('0xf1')],{'as':_0xba1d('0xf1'),'foreignKey':_0xba1d('0x117')});db['User'][_0xba1d('0x118')](db[_0xba1d('0x6a')],{'as':_0xba1d('0x119'),'through':'chat_group_has_users'});db['User'][_0xba1d('0x118')](db[_0xba1d('0x11a')],{'as':'Contacts','through':'cm_user_has_contacts'});db['User']['belongsToMany'](db[_0xba1d('0xee')],{'as':_0xba1d('0x11b'),'through':_0xba1d('0x11c')});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':_0xba1d('0x11d')});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x3f')],{'as':_0xba1d('0x112'),'through':_0xba1d('0x11e')});db['User'][_0xba1d('0x118')](db[_0xba1d('0x63')],{'as':'ChatInteractions','through':_0xba1d('0x11f')});db[_0xba1d('0x106')]['belongsToMany'](db[_0xba1d('0x4a')],{'as':_0xba1d('0x120'),'through':_0xba1d('0x121')});db['User']['belongsToMany'](db[_0xba1d('0x122')],{'as':_0xba1d('0x111'),'through':_0xba1d('0x123')});db['User'][_0xba1d('0x118')](db[_0xba1d('0x5a')],{'as':_0xba1d('0x10f'),'through':'user_has_openchannel_interactions'});db[_0xba1d('0x106')]['belongsToMany'](db[_0xba1d('0xfb')],{'as':_0xba1d('0x113'),'through':_0xba1d('0x124')});db[_0xba1d('0x106')][_0xba1d('0x118')](db['VoiceQueue'],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0xba1d('0x106')][_0xba1d('0x118')](db['MailQueue'],{'as':_0xba1d('0x125'),'through':_0xba1d('0x30'),'required':![]});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x68')],{'as':_0xba1d('0x126'),'through':_0xba1d('0x127'),'required':![],'hooks':!![]});db[_0xba1d('0x106')]['belongsToMany'](db[_0xba1d('0x4e')],{'as':_0xba1d('0x128'),'through':'UserFaxQueue','required':![]});db[_0xba1d('0x106')]['belongsToMany'](db[_0xba1d('0x55')],{'as':_0xba1d('0x129'),'through':_0xba1d('0x32'),'required':![]});db[_0xba1d('0x106')]['belongsToMany'](db[_0xba1d('0x12a')],{'as':_0xba1d('0x12b'),'through':'UserOpenchannelQueue','required':![]});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x102')],{'as':_0xba1d('0x12c'),'through':'UserWhatsappQueue','required':![]});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0xee')],{'through':'cm_user_has_lists'});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0xef')],{'as':_0xba1d('0x12d'),'through':'user_has_voice_prefixes','required':![]});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x5e')],{'as':'ChatWebsites','through':_0xba1d('0x12e')});db['User'][_0xba1d('0x118')](db['FaxAccount'],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x3a')],{'as':_0xba1d('0x12f'),'through':'user_has_mail_accounts'});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x57')],{'as':_0xba1d('0x130'),'through':_0xba1d('0x131')});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0x132')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User'][_0xba1d('0x118')](db[_0xba1d('0xf7')],{'as':_0xba1d('0x133'),'through':_0xba1d('0x134')});db[_0xba1d('0x106')][_0xba1d('0x118')](db[_0xba1d('0xd6')],{'as':_0xba1d('0x135'),'through':_0xba1d('0x136')});db[_0xba1d('0x137')][_0xba1d('0x10b')](db[_0xba1d('0x16')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0xba1d('0x138')});db['VoiceContext'][_0xba1d('0x10b')](db[_0xba1d('0x16')],{'onDelete':_0xba1d('0x109')});db[_0xba1d('0x16')][_0xba1d('0x10b')](db[_0xba1d('0x16')],{'as':_0xba1d('0x139'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x18')][_0xba1d('0x118')](db['Sound'],{'as':_0xba1d('0x13a'),'through':_0xba1d('0x13b')});db[_0xba1d('0x1a')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xba1d('0x13c'),'foreignKey':_0xba1d('0x13d')});db[_0xba1d('0x1a')][_0xba1d('0x10b')](db[_0xba1d('0x6f')],{'as':_0xba1d('0x13e'),'foreignKey':_0xba1d('0x13d')});db[_0xba1d('0x1a')]['hasMany'](db[_0xba1d('0x73')],{'as':_0xba1d('0x13f'),'foreignKey':_0xba1d('0x13d')});db[_0xba1d('0x1a')][_0xba1d('0x10b')](db[_0xba1d('0x75')],{'as':_0xba1d('0x140'),'foreignKey':_0xba1d('0x13d')});db[_0xba1d('0x1a')][_0xba1d('0x10b')](db['ReportAgentPreview'],{'as':_0xba1d('0x77'),'foreignKey':'VoiceQueueId'});db[_0xba1d('0x1a')][_0xba1d('0x10b')](db[_0xba1d('0x71')],{'as':_0xba1d('0x141'),'foreignKey':'VoiceQueueId'});db[_0xba1d('0x1a')][_0xba1d('0x10b')](db[_0xba1d('0xc9')],{'as':_0xba1d('0x142'),'foreignKey':_0xba1d('0x13d')});db['VoiceQueue'][_0xba1d('0x116')](db[_0xba1d('0x29')],{'as':_0xba1d('0x29'),'foreignKey':_0xba1d('0x143')});db[_0xba1d('0x1a')]['belongsTo'](db[_0xba1d('0x29')],{'as':_0xba1d('0x144'),'foreignKey':_0xba1d('0x145')});db['VoiceQueue'][_0xba1d('0x116')](db[_0xba1d('0x146')],{'as':_0xba1d('0x146'),'foreignKey':'IntervalId'});db[_0xba1d('0x1a')]['belongsTo'](db[_0xba1d('0x81')],{'as':_0xba1d('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xba1d('0x1a')][_0xba1d('0x118')](db[_0xba1d('0xee')],{'as':_0xba1d('0x11b'),'through':_0xba1d('0x148')});db[_0xba1d('0x1a')][_0xba1d('0x118')](db['User'],{'as':_0xba1d('0x149'),'through':_0xba1d('0x2e')});db[_0xba1d('0x1a')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'as':_0xba1d('0x14a'),'through':_0xba1d('0x14b')});db[_0xba1d('0x1a')][_0xba1d('0x118')](db[_0xba1d('0xee')],{'as':_0xba1d('0x14c'),'through':_0xba1d('0x14d')});db['VoiceRecording'][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x106'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x14e')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x106'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x108')]['hasMany'](db['VoiceMailMessage'],{'as':_0xba1d('0x14f'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x150'),'sourceKey':_0xba1d('0x151')});db[_0xba1d('0x20')][_0xba1d('0x116')](db[_0xba1d('0x108')],{'foreignKey':'mailboxuser','targetKey':_0xba1d('0x151')});db['VoiceCallReport'][_0xba1d('0x10b')](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0xba1d('0x152'),'constraints':![]});db[_0xba1d('0x22')][_0xba1d('0x10b')](db[_0xba1d('0x153')],{'as':'AgentReports','foreignKey':_0xba1d('0x152'),'constraints':![]});db[_0xba1d('0x22')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x106'),'foreignKey':'UserId'});db['VoiceCallReport'][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':'ContactId'});db[_0xba1d('0x36')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{'as':_0xba1d('0x3a'),'foreignKey':_0xba1d('0x155')});db[_0xba1d('0x38')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{'as':_0xba1d('0x3a'),'foreignKey':'MailAccountId'});db[_0xba1d('0x3a')][_0xba1d('0x107')](db[_0xba1d('0x36')],{'as':_0xba1d('0x156'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x3a')][_0xba1d('0x107')](db['MailServerOut'],{'as':'Smtp','onDelete':_0xba1d('0x109')});db[_0xba1d('0x3a')][_0xba1d('0x10b')](db['Disposition'],{'as':_0xba1d('0x157'),'foreignKey':_0xba1d('0x155')});db['MailAccount'][_0xba1d('0x10b')](db['CannedAnswer'],{'as':_0xba1d('0x158'),'foreignKey':'MailAccountId'});db[_0xba1d('0x3a')][_0xba1d('0x10b')](db['MailMessage'],{'as':_0xba1d('0x14f'),'foreignKey':_0xba1d('0x155')});db[_0xba1d('0x3a')][_0xba1d('0x10b')](db['MailInteraction'],{'as':_0xba1d('0x159')});db[_0xba1d('0x3a')][_0xba1d('0x10b')](db[_0xba1d('0x15a')],{'as':_0xba1d('0x139')});db['MailAccount']['belongsTo'](db[_0xba1d('0xee')],{'as':'List','foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x3a')][_0xba1d('0x116')](db[_0xba1d('0x87')],{'as':_0xba1d('0x87'),'foreignKey':_0xba1d('0x15c')});db[_0xba1d('0x3a')][_0xba1d('0x116')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xba1d('0x15d')});db[_0xba1d('0x3a')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x15e')});db[_0xba1d('0x3b')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x30')});db[_0xba1d('0x3b')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':_0xba1d('0x15f'),'as':_0xba1d('0x14a')});db[_0xba1d('0x3f')][_0xba1d('0x10b')](db[_0xba1d('0x160')],{'as':'Messages','onDelete':_0xba1d('0x109'),'foreignKey':'MailInteractionId'});db[_0xba1d('0x3f')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{'as':'Account','foreignKey':_0xba1d('0x155')});db[_0xba1d('0x3f')][_0xba1d('0x116')](db['CmContact'],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x3f')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':'Owner','foreignKey':'UserId'});db[_0xba1d('0x3f')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':'mail_interaction_has_tags','as':_0xba1d('0x163')});db[_0xba1d('0x3f')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':_0xba1d('0x164'),'as':_0xba1d('0x165')});db[_0xba1d('0x3f')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x166'),'through':_0xba1d('0x11e'),'foreignKey':'MailInteractionId'});db[_0xba1d('0x160')][_0xba1d('0x10b')](db['Attachment'],{'as':_0xba1d('0x167'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x160')]['belongsTo'](db[_0xba1d('0x106')],{'as':_0xba1d('0x106')});db['MailMessage'][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x154')});db[_0xba1d('0x160')][_0xba1d('0x116')](db['MailInteraction'],{'as':_0xba1d('0x168'),'foreignKey':_0xba1d('0x169')});db['MailMessage'][_0xba1d('0x116')](db['MailAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x155')});db[_0xba1d('0x15a')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x15a')]['belongsTo'](db['MailQueue'],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x15a')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{'onDelete':'restrict'});db[_0xba1d('0x15a')][_0xba1d('0x116')](db['Interval'],{'onDelete':_0xba1d('0x16b'),'foreignKey':_0xba1d('0x16c')});db[_0xba1d('0x15a')][_0xba1d('0x116')](db[_0xba1d('0x162')],{'onDelete':'restrict','foreignKey':_0xba1d('0x16d')});db[_0xba1d('0x16e')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{});db['MailQueueReport'][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x16e')][_0xba1d('0x116')](db['CmContact'],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x16e')][_0xba1d('0x116')](db[_0xba1d('0x3f')],{});db[_0xba1d('0x16e')][_0xba1d('0x116')](db[_0xba1d('0x160')],{});db['MailQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{});db[_0xba1d('0x16e')][_0xba1d('0x116')](db['MailQueue'],{});db[_0xba1d('0x43')][_0xba1d('0x10b')](db[_0xba1d('0x45')],{'as':_0xba1d('0x170'),'onDelete':_0xba1d('0x109')});db['FaxAccount'][_0xba1d('0x10b')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xba1d('0x171')});db['FaxAccount'][_0xba1d('0x10b')](db[_0xba1d('0x7c')],{'as':_0xba1d('0x158'),'foreignKey':_0xba1d('0x171')});db[_0xba1d('0x46')]['hasMany'](db[_0xba1d('0x4a')],{'as':_0xba1d('0x159')});db[_0xba1d('0x46')]['hasMany'](db[_0xba1d('0x48')],{'as':_0xba1d('0x139')});db[_0xba1d('0x46')]['hasMany'](db[_0xba1d('0x16')],{'as':_0xba1d('0x172'),'onDelete':_0xba1d('0x109')});db['FaxAccount'][_0xba1d('0x10b')](db['FaxMessage'],{'as':_0xba1d('0x14f')});db[_0xba1d('0x46')][_0xba1d('0x116')](db['Trunk'],{'as':_0xba1d('0x29')});db['FaxAccount'][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x46')][_0xba1d('0x116')](db[_0xba1d('0x81')],{'as':_0xba1d('0x147'),'foreignKey':_0xba1d('0x15d')});db[_0xba1d('0x46')]['belongsToMany'](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x173')});db[_0xba1d('0x48')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x48')][_0xba1d('0x116')](db['FaxQueue'],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x48')]['belongsTo'](db['FaxAccount'],{'onDelete':'restrict'});db[_0xba1d('0x48')][_0xba1d('0x116')](db[_0xba1d('0x162')],{'onDelete':'restrict','foreignKey':_0xba1d('0x16d')});db[_0xba1d('0x4a')][_0xba1d('0x10b')](db[_0xba1d('0x4c')],{'as':_0xba1d('0x14f'),'onDelete':'cascade','foreignKey':_0xba1d('0x174')});db[_0xba1d('0x4a')]['belongsTo'](db[_0xba1d('0x46')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x171')});db['FaxInteraction']['belongsTo'](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':'ContactId'});db[_0xba1d('0x4a')][_0xba1d('0x116')](db['User'],{'as':'Owner','foreignKey':_0xba1d('0x10a')});db['FaxInteraction']['belongsToMany'](db[_0xba1d('0x162')],{'through':_0xba1d('0x175'),'as':_0xba1d('0x163')});db[_0xba1d('0x4a')][_0xba1d('0x118')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xba1d('0x165')});db['FaxInteraction'][_0xba1d('0x118')](db['User'],{'as':_0xba1d('0x166'),'through':'user_has_fax_interactions','foreignKey':_0xba1d('0x174')});db[_0xba1d('0x4c')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':'cascade','as':'User'});db['FaxMessage'][_0xba1d('0x116')](db[_0xba1d('0x4a')],{'as':'Interaction','foreignKey':_0xba1d('0x174')});db[_0xba1d('0x4c')][_0xba1d('0x116')](db['CmContact'],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x154')});db[_0xba1d('0x4c')][_0xba1d('0x116')](db[_0xba1d('0xe2')],{'as':_0xba1d('0xe2'),'foreignKey':_0xba1d('0x176')});db[_0xba1d('0x4c')][_0xba1d('0x116')](db['FaxAccount'],{'as':_0xba1d('0x16a'),'foreignKey':'FaxAccountId'});db[_0xba1d('0x4e')]['belongsToMany'](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x177')});db['FaxQueue'][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':_0xba1d('0x178'),'as':_0xba1d('0x14a')});db[_0xba1d('0x50')]['belongsTo'](db[_0xba1d('0x46')],{});db[_0xba1d('0x50')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':'List','foreignKey':_0xba1d('0x15b')});db['FaxQueueReport'][_0xba1d('0x116')](db['CmContact'],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db['FaxQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x4a')],{});db[_0xba1d('0x50')][_0xba1d('0x116')](db['FaxMessage'],{});db[_0xba1d('0x50')][_0xba1d('0x116')](db[_0xba1d('0x106')],{});db[_0xba1d('0x50')][_0xba1d('0x116')](db['FaxQueue'],{});db[_0xba1d('0x132')]['hasMany'](db[_0xba1d('0x7e')],{'as':_0xba1d('0x157'),'foreignKey':_0xba1d('0x179')});db[_0xba1d('0x132')]['hasMany'](db['CannedAnswer'],{'as':_0xba1d('0x158'),'foreignKey':'SmsAccountId'});db[_0xba1d('0x132')][_0xba1d('0x10b')](db[_0xba1d('0x53')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0xba1d('0x132')][_0xba1d('0x10b')](db['SmsInteraction'],{'as':_0xba1d('0x159')});db[_0xba1d('0x132')][_0xba1d('0x10b')](db['SmsApplication'],{'as':_0xba1d('0x139')});db[_0xba1d('0x132')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x132')]['belongsTo'](db[_0xba1d('0x81')],{'as':_0xba1d('0x147'),'foreignKey':_0xba1d('0x15d')});db[_0xba1d('0x132')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x17a')});db[_0xba1d('0x17b')]['belongsTo'](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x16b')});db['SmsApplication'][_0xba1d('0x116')](db[_0xba1d('0x55')],{'onDelete':'restrict'});db['SmsApplication'][_0xba1d('0x116')](db['SmsAccount'],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x17b')][_0xba1d('0x116')](db[_0xba1d('0x146')],{'onDelete':_0xba1d('0x16b'),'foreignKey':'IntervalId'});db['SmsApplication']['belongsTo'](db[_0xba1d('0x162')],{'onDelete':'restrict','foreignKey':_0xba1d('0x16d')});db[_0xba1d('0x122')][_0xba1d('0x10b')](db['SmsMessage'],{'as':_0xba1d('0x14f'),'onDelete':_0xba1d('0x109'),'foreignKey':'SmsInteractionId'});db[_0xba1d('0x122')]['belongsTo'](db['SmsAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x179')});db[_0xba1d('0x122')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':'ContactId'});db[_0xba1d('0x122')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x17c'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x122')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':'sms_interaction_has_tags','as':_0xba1d('0x163')});db[_0xba1d('0x122')]['belongsToMany'](db[_0xba1d('0x162')],{'through':_0xba1d('0x17d'),'as':_0xba1d('0x165')});db[_0xba1d('0x122')]['belongsToMany'](db['User'],{'as':'Users','through':_0xba1d('0x123'),'foreignKey':_0xba1d('0x17e')});db['SmsMessage']['belongsTo'](db['User'],{'as':_0xba1d('0x106')});db[_0xba1d('0x53')]['belongsTo'](db[_0xba1d('0x11a')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x154')});db['SmsMessage'][_0xba1d('0x116')](db[_0xba1d('0x122')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x168'),'foreignKey':'SmsInteractionId'});db[_0xba1d('0x53')]['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':_0xba1d('0x179')});db[_0xba1d('0x55')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x32'),'foreignKey':_0xba1d('0x17f')});db[_0xba1d('0x55')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':_0xba1d('0x180'),'as':_0xba1d('0x14a')});db[_0xba1d('0x57')][_0xba1d('0x10b')](db['Disposition'],{'as':_0xba1d('0x157'),'foreignKey':_0xba1d('0x181')});db[_0xba1d('0x57')][_0xba1d('0x10b')](db['CannedAnswer'],{'as':_0xba1d('0x158'),'foreignKey':_0xba1d('0x181')});db[_0xba1d('0x57')][_0xba1d('0x10b')](db[_0xba1d('0x5a')],{'as':'Interactions','foreignKey':_0xba1d('0x181')});db[_0xba1d('0x57')][_0xba1d('0x10b')](db[_0xba1d('0x5b')],{'as':_0xba1d('0x14f'),'foreignKey':'OpenchannelAccountId'});db[_0xba1d('0x57')][_0xba1d('0x10b')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db[_0xba1d('0x57')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x57')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xba1d('0x15d')});db['OpenchannelAccount'][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x131')});db[_0xba1d('0x59')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x59')][_0xba1d('0x116')](db[_0xba1d('0x12a')],{'onDelete':_0xba1d('0x16b'),'foreignKey':_0xba1d('0x182')});db[_0xba1d('0x59')]['belongsTo'](db[_0xba1d('0x57')],{'onDelete':'restrict','foreignKey':_0xba1d('0x181')});db[_0xba1d('0x59')]['belongsTo'](db[_0xba1d('0x146')],{'onDelete':_0xba1d('0x16b'),'foreignKey':'IntervalId'});db[_0xba1d('0x59')][_0xba1d('0x116')](db[_0xba1d('0x162')],{'onDelete':_0xba1d('0x16b'),'foreignKey':_0xba1d('0x16d')});db['OpenchannelInteraction'][_0xba1d('0x10b')](db[_0xba1d('0x5b')],{'as':_0xba1d('0x14f'),'onDelete':'cascade','foreignKey':_0xba1d('0x183')});db[_0xba1d('0x5a')][_0xba1d('0x116')](db[_0xba1d('0x57')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x181')});db[_0xba1d('0x5a')]['belongsTo'](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x5a')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x17c'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x5a')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':_0xba1d('0x184'),'as':'Tags'});db[_0xba1d('0x5a')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':'openchannel_interaction_has_tags','as':_0xba1d('0x165')});db['OpenchannelInteraction'][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x166'),'through':_0xba1d('0x185'),'foreignKey':'OpenchannelInteractionId'});db[_0xba1d('0x5b')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x109'),'as':'User'});db[_0xba1d('0x5b')]['belongsTo'](db[_0xba1d('0x11a')],{'onDelete':'cascade','as':_0xba1d('0x154')});db[_0xba1d('0x5b')][_0xba1d('0x116')](db[_0xba1d('0x5a')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x168'),'foreignKey':_0xba1d('0x183')});db[_0xba1d('0x5b')][_0xba1d('0x116')](db[_0xba1d('0xe2')],{'as':'Attachment','foreignKey':_0xba1d('0x176')});db[_0xba1d('0x5b')][_0xba1d('0x116')](db[_0xba1d('0x57')],{'as':_0xba1d('0x16a'),'foreignKey':'OpenchannelAccountId'});db[_0xba1d('0x12a')]['belongsToMany'](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x186'),'foreignKey':_0xba1d('0x182')});db[_0xba1d('0x12a')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':_0xba1d('0x187'),'as':_0xba1d('0x14a')});db['ChatWebsite']['hasMany'](db[_0xba1d('0x7e')],{'as':'Dispositions','foreignKey':_0xba1d('0x188')});db[_0xba1d('0x5e')][_0xba1d('0x10b')](db[_0xba1d('0x7c')],{'as':_0xba1d('0x158'),'foreignKey':_0xba1d('0x188')});db[_0xba1d('0x5e')][_0xba1d('0x10b')](db['ChatProactiveAction'],{'as':_0xba1d('0x189')});db[_0xba1d('0x5e')][_0xba1d('0x10b')](db[_0xba1d('0x63')],{'as':'Interactions'});db[_0xba1d('0x5e')][_0xba1d('0x10b')](db[_0xba1d('0x62')],{'as':_0xba1d('0x139')});db[_0xba1d('0x5e')][_0xba1d('0x10b')](db[_0xba1d('0x65')],{'as':_0xba1d('0x14f')});db[_0xba1d('0x5e')]['belongsTo'](db[_0xba1d('0xee')],{'as':'List','foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x5e')][_0xba1d('0x116')](db[_0xba1d('0x146')],{'as':_0xba1d('0x146'),'foreignKey':_0xba1d('0x16c')});db['ChatWebsite'][_0xba1d('0x116')](db[_0xba1d('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xba1d('0x15d')});db[_0xba1d('0x5e')]['belongsToMany'](db['User'],{'as':_0xba1d('0x149'),'through':'user_has_chat_websites'});db[_0xba1d('0x60')][_0xba1d('0x116')](db[_0xba1d('0x57')],{});db[_0xba1d('0x60')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xba1d('0x15b')});db[_0xba1d('0x60')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':'ContactId'});db[_0xba1d('0x60')][_0xba1d('0x116')](db[_0xba1d('0x5a')],{});db[_0xba1d('0x60')]['belongsTo'](db[_0xba1d('0x5b')],{});db['OpenchannelQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{});db[_0xba1d('0x60')][_0xba1d('0x116')](db[_0xba1d('0x12a')],{});db[_0xba1d('0x62')]['belongsTo'](db['User'],{'as':_0xba1d('0x18a'),'foreignKey':_0xba1d('0x10a'),'onDelete':_0xba1d('0x16b')});db['ChatApplication'][_0xba1d('0x116')](db[_0xba1d('0x68')],{'as':_0xba1d('0x18b'),'foreignKey':_0xba1d('0x18c'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x62')][_0xba1d('0x116')](db[_0xba1d('0x5e')],{'as':_0xba1d('0x18d'),'foreignKey':_0xba1d('0x188'),'onDelete':_0xba1d('0x16b')});db['ChatApplication'][_0xba1d('0x116')](db[_0xba1d('0x162')],{'onDelete':_0xba1d('0x16b'),'foreignKey':_0xba1d('0x16d')});db[_0xba1d('0x63')][_0xba1d('0x10b')](db[_0xba1d('0x65')],{'as':'Messages','onDelete':_0xba1d('0x109'),'foreignKey':'ChatInteractionId'});db[_0xba1d('0x63')]['belongsTo'](db[_0xba1d('0x5e')],{'as':'Account','foreignKey':_0xba1d('0x188')});db['ChatInteraction'][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':'Contact','foreignKey':_0xba1d('0x161')});db['ChatInteraction'][_0xba1d('0x116')](db['User'],{'as':_0xba1d('0x17c'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x63')]['belongsToMany'](db[_0xba1d('0x162')],{'through':_0xba1d('0x18e'),'as':_0xba1d('0x163')});db[_0xba1d('0x63')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':_0xba1d('0x18e'),'as':_0xba1d('0x165')});db[_0xba1d('0x63')][_0xba1d('0x118')](db['User'],{'as':_0xba1d('0x166'),'through':_0xba1d('0x11f'),'foreignKey':_0xba1d('0x18f')});db['ChatMessage']['belongsTo'](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x106')});db[_0xba1d('0x65')]['belongsTo'](db[_0xba1d('0x11a')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x65')][_0xba1d('0x116')](db[_0xba1d('0x63')],{'onDelete':'cascade','as':_0xba1d('0x168'),'foreignKey':'ChatInteractionId'});db[_0xba1d('0x65')][_0xba1d('0x116')](db[_0xba1d('0xe2')],{'as':'Attachment','foreignKey':_0xba1d('0x176')});db[_0xba1d('0x65')][_0xba1d('0x116')](db[_0xba1d('0x5e')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x188')});db[_0xba1d('0x66')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'onDelete':_0xba1d('0x109'),'as':'Contact','foreignKey':'ContactId'});db[_0xba1d('0x66')][_0xba1d('0x116')](db[_0xba1d('0x5e')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x188')});db[_0xba1d('0x68')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':'UserChatQueue','hooks':!![]});db[_0xba1d('0x68')][_0xba1d('0x118')](db[_0xba1d('0xdb')],{'through':'team_has_chat_queues','as':_0xba1d('0x14a')});db['ChatGroup']['hasMany'](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0xba1d('0x190'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x6a')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x13c'),'through':_0xba1d('0x191')});db['ChatProactiveAction']['belongsTo'](db[_0xba1d('0x5e')],{'as':_0xba1d('0x18d'),'foreignKey':_0xba1d('0x188')});db[_0xba1d('0x6d')][_0xba1d('0x10b')](db[_0xba1d('0x11a')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact'][_0xba1d('0x10b')](db[_0xba1d('0x6f')],{'as':'Hoppers','foreignKey':_0xba1d('0x161')});db[_0xba1d('0x11a')]['hasMany'](db[_0xba1d('0x73')],{'as':_0xba1d('0x13f'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db[_0xba1d('0x75')],{'as':'HopperHistories','foreignKey':_0xba1d('0x161')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db['ReportAgentPreview'],{'as':_0xba1d('0x77'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db[_0xba1d('0xc9')],{'as':_0xba1d('0x142'),'foreignKey':'ContactId'});db[_0xba1d('0x11a')]['hasMany'](db[_0xba1d('0x5a')],{'as':_0xba1d('0x10f'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db[_0xba1d('0x63')],{'as':_0xba1d('0x110'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db[_0xba1d('0x122')],{'as':_0xba1d('0x111'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x11a')][_0xba1d('0x10b')](db[_0xba1d('0x4a')],{'as':'FaxInteractions','foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x11a')]['hasMany'](db[_0xba1d('0x3f')],{'as':_0xba1d('0x112'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x11a')]['belongsTo'](db[_0xba1d('0x6d')],{'as':'Company','foreignKey':_0xba1d('0x192')});db[_0xba1d('0x11a')][_0xba1d('0x116')](db['CmList'],{'as':'List','foreignKey':_0xba1d('0x15b'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x11a')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':'Users','through':_0xba1d('0x193')});db['CmContact']['belongsToMany'](db[_0xba1d('0x162')],{'as':_0xba1d('0x163'),'through':_0xba1d('0x194')});db[_0xba1d('0x11a')][_0xba1d('0x118')](db['Tag'],{'through':_0xba1d('0x194'),'as':_0xba1d('0x165')});db[_0xba1d('0x6f')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x6f')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x6f')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x18a'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0x6f')][_0xba1d('0x116')](db[_0xba1d('0x1a')],{'as':_0xba1d('0x18b'),'foreignKey':_0xba1d('0x13d'),'onDelete':'cascade'});db[_0xba1d('0x6f')]['belongsTo'](db[_0xba1d('0xdf')],{'as':_0xba1d('0xdf'),'foreignKey':_0xba1d('0x195'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x6f')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':'Owner','foreignKey':'OwnerId'});db[_0xba1d('0x71')]['belongsTo'](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0x71')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':'List','foreignKey':_0xba1d('0x15b'),'onDelete':'cascade'});db[_0xba1d('0x71')][_0xba1d('0x116')](db[_0xba1d('0x1a')],{'as':_0xba1d('0x18b'),'foreignKey':_0xba1d('0x13d'),'onDelete':'cascade'});db[_0xba1d('0x71')][_0xba1d('0x116')](db[_0xba1d('0xdf')],{'as':_0xba1d('0xdf'),'foreignKey':'CampaignId','onDelete':_0xba1d('0x109')});db[_0xba1d('0x196')]['hasMany'](db['Condition'],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xba1d('0x197'),'onDelete':_0xba1d('0x109'),'hooks':!![]});db[_0xba1d('0x196')]['hasMany'](db['Condition'],{'as':{'plural':_0xba1d('0x198'),'singular':'OneAny'},'foreignKey':_0xba1d('0x199'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xba1d('0x10b')](db[_0xba1d('0x19a')],{'as':'Actions','foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0xba1d('0x146')]['hasMany'](db['Interval'],{'as':_0xba1d('0x19b'),'foreignKey':'IntervalId','onDelete':_0xba1d('0x109'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0xba1d('0x16')],{'as':'Extensions','foreignKey':_0xba1d('0x16c'),'onDelete':_0xba1d('0x16b')});db[_0xba1d('0x146')][_0xba1d('0x10b')](db[_0xba1d('0x15a')],{'as':_0xba1d('0x19c'),'foreignKey':_0xba1d('0x16c')});db['Interval'][_0xba1d('0x10b')](db[_0xba1d('0x62')],{'as':_0xba1d('0x19d'),'foreignKey':_0xba1d('0x16c')});db['Interval'][_0xba1d('0x10b')](db['FaxApplication'],{'as':_0xba1d('0x19e'),'foreignKey':_0xba1d('0x16c')});db[_0xba1d('0x146')][_0xba1d('0x10b')](db[_0xba1d('0x17b')],{'as':_0xba1d('0x19f'),'foreignKey':_0xba1d('0x16c')});db[_0xba1d('0x84')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{});db['Schedule']['belongsTo'](db[_0xba1d('0x1a0')],{'foreignKey':_0xba1d('0x1a1')});db[_0xba1d('0x84')][_0xba1d('0x116')](db[_0xba1d('0x90')],{'foreignKey':_0xba1d('0x1a2')});db['Sound']['belongsToMany'](db[_0xba1d('0x18')],{'as':_0xba1d('0x1a3'),'through':_0xba1d('0x13b'),'onDelete':_0xba1d('0x16b')});db['Tag']['belongsToMany'](db[_0xba1d('0x11a')],{'through':_0xba1d('0x194')});db[_0xba1d('0x162')]['belongsToMany'](db[_0xba1d('0x63')],{'through':_0xba1d('0x18e')});db[_0xba1d('0x162')]['belongsToMany'](db[_0xba1d('0x3f')],{'through':_0xba1d('0x164')});db['Tag'][_0xba1d('0x118')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0xba1d('0x162')][_0xba1d('0x118')](db[_0xba1d('0x4a')],{'through':_0xba1d('0x175')});db['Tag'][_0xba1d('0x118')](db[_0xba1d('0x5a')],{'through':'openchannel_interaction_has_tags'});db[_0xba1d('0x162')][_0xba1d('0x118')](db[_0xba1d('0xfb')],{'through':_0xba1d('0x1a4')});db[_0xba1d('0x89')][_0xba1d('0x10b')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xba1d('0x1a5')},'foreignKey':_0xba1d('0x1a6'),'onDelete':_0xba1d('0x109'),'hooks':!![]});db[_0xba1d('0x89')][_0xba1d('0x10b')](db['Condition'],{'as':{'plural':_0xba1d('0x1a7'),'singular':'AnyCondition'},'foreignKey':_0xba1d('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0xba1d('0x89')][_0xba1d('0x10b')](db['Action'],{'as':'Actions','foreignKey':_0xba1d('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0xba1d('0x90')][_0xba1d('0x10b')](db[_0xba1d('0x96')],{'as':_0xba1d('0x1aa'),'onDelete':'cascade','foreignKey':_0xba1d('0x1a2'),'hooks':!![]});db[_0xba1d('0x1a0')][_0xba1d('0x10b')](db[_0xba1d('0x96')],{'as':_0xba1d('0x1aa'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1a1')});db[_0xba1d('0x95')][_0xba1d('0x10b')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':'MetricId'});db[_0xba1d('0x96')]['belongsTo'](db[_0xba1d('0x95')],{'foreignKey':_0xba1d('0x1ab')});db[_0xba1d('0x99')][_0xba1d('0x10b')](db[_0xba1d('0x9b')],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x9b')][_0xba1d('0x10b')](db[_0xba1d('0x9d')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0xba1d('0x10b')](db[_0xba1d('0x9d')],{'as':_0xba1d('0x1ae'),'onDelete':_0xba1d('0x109'),'foreignKey':'DescriptionId'});db[_0xba1d('0x9b')][_0xba1d('0x10b')](db[_0xba1d('0x9d')],{'as':_0xba1d('0x1aa'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0x9b')]['belongsTo'](db[_0xba1d('0x99')],{'as':'Account','foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x9d')]['hasMany'](db[_0xba1d('0x9d')],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0x9d')]['hasMany'](db['SalesforceField'],{'as':_0xba1d('0x1b2'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0xba1d('0x10b')](db['SalesforceField'],{'as':'Field','foreignKey':'FieldId'});db[_0xba1d('0x9d')][_0xba1d('0x116')](db['Variable'],{'as':_0xba1d('0x8b'),'foreignKey':_0xba1d('0x1b3')});db[_0xba1d('0x1b4')][_0xba1d('0x10b')](db[_0xba1d('0x9f')],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x9f')][_0xba1d('0x10b')](db[_0xba1d('0xa0')],{'as':'Subjects','onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b1')});db['SugarcrmConfiguration'][_0xba1d('0x10b')](db['SugarcrmField'],{'as':_0xba1d('0x1ae'),'onDelete':_0xba1d('0x109'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0xba1d('0x10b')](db[_0xba1d('0xa0')],{'as':'Fields','onDelete':_0xba1d('0x109'),'foreignKey':'FieldId'});db[_0xba1d('0x9f')]['belongsTo'](db[_0xba1d('0x1b4')],{'as':'Account','foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xa0')][_0xba1d('0x10b')](db[_0xba1d('0xa0')],{'as':'Subject','foreignKey':_0xba1d('0x1b1')});db['SugarcrmField'][_0xba1d('0x10b')](db[_0xba1d('0xa0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xba1d('0xa0')][_0xba1d('0x10b')](db[_0xba1d('0xa0')],{'as':_0xba1d('0x1b5'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':'Variable','foreignKey':_0xba1d('0x1b3')});db['DeskAccount']['hasMany'](db['DeskConfiguration'],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db['DeskConfiguration'][_0xba1d('0x10b')](db[_0xba1d('0x1b6')],{'as':_0xba1d('0x1b7'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b1')});db['DeskConfiguration'][_0xba1d('0x10b')](db['DeskField'],{'as':_0xba1d('0x1ae'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xa3')][_0xba1d('0x10b')](db['DeskField'],{'as':_0xba1d('0x1aa'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xa3')]['belongsTo'](db[_0xba1d('0x1b9')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db['DeskConfiguration'][_0xba1d('0x118')](db['Tag'],{'through':_0xba1d('0x1ba')});db[_0xba1d('0x1b6')][_0xba1d('0x10b')](db['DeskField'],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0x1b6')]['hasMany'](db[_0xba1d('0x1b6')],{'as':'Description','foreignKey':_0xba1d('0x1b8')});db['DeskField'][_0xba1d('0x10b')](db['DeskField'],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0x1b6')][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':_0xba1d('0x8b'),'foreignKey':_0xba1d('0x1b3')});db[_0xba1d('0x1bb')][_0xba1d('0x10b')](db[_0xba1d('0x1bc')],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x1bc')][_0xba1d('0x10b')](db[_0xba1d('0x1bd')],{'as':_0xba1d('0x1b7'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b1')});db['ZohoConfiguration']['hasMany'](db[_0xba1d('0x1bd')],{'as':_0xba1d('0x1ae'),'onDelete':_0xba1d('0x109'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0xba1d('0x10b')](db[_0xba1d('0x1bd')],{'as':_0xba1d('0x1aa'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1af')});db['ZohoConfiguration'][_0xba1d('0x116')](db[_0xba1d('0x1bb')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x1bd')][_0xba1d('0x10b')](db[_0xba1d('0x1bd')],{'as':_0xba1d('0x1b0'),'foreignKey':'SubjectId'});db[_0xba1d('0x1bd')][_0xba1d('0x10b')](db['ZohoField'],{'as':'Description','foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0x1bd')][_0xba1d('0x10b')](db[_0xba1d('0x1bd')],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0x1bd')][_0xba1d('0x116')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db['ZendeskAccount']['hasMany'](db[_0xba1d('0xaa')],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xaa')]['hasMany'](db[_0xba1d('0xac')],{'as':_0xba1d('0x1b7'),'foreignKey':'SubjectId'});db[_0xba1d('0xaa')][_0xba1d('0x10b')](db['ZendeskField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration']['hasMany'](db[_0xba1d('0xac')],{'as':_0xba1d('0x1aa'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xaa')]['belongsTo'](db['ZendeskAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xaa')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':_0xba1d('0x1be')});db['ZendeskField']['hasMany'](db[_0xba1d('0xac')],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xac')][_0xba1d('0x10b')](db[_0xba1d('0xac')],{'as':_0xba1d('0x1b2'),'foreignKey':'DescriptionId'});db[_0xba1d('0xac')][_0xba1d('0x10b')](db['ZendeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xba1d('0xac')][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':_0xba1d('0x8b'),'foreignKey':'VariableId'});db[_0xba1d('0x1bf')]['hasMany'](db[_0xba1d('0xaf')],{'as':_0xba1d('0x1ac'),'onDelete':'cascade','foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xaf')][_0xba1d('0x10b')](db[_0xba1d('0x1c0')],{'as':_0xba1d('0x1b7'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xaf')][_0xba1d('0x10b')](db['FreshdeskField'],{'as':_0xba1d('0x1ae'),'onDelete':'cascade','foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xaf')][_0xba1d('0x10b')](db['FreshdeskField'],{'as':'Fields','onDelete':_0xba1d('0x109'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xba1d('0x116')](db['FreshdeskAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xaf')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':_0xba1d('0x1c1')});db['FreshdeskField']['hasMany'](db[_0xba1d('0x1c0')],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0x1c0')]['hasMany'](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xba1d('0x1c0')][_0xba1d('0x10b')](db[_0xba1d('0x1c0')],{'as':'Field','foreignKey':_0xba1d('0x1af')});db[_0xba1d('0x1c0')][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':_0xba1d('0x8b'),'foreignKey':'VariableId'});db[_0xba1d('0xb1')]['hasMany'](db[_0xba1d('0x1c2')],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x1c2')][_0xba1d('0x10b')](db[_0xba1d('0xb3')],{'as':_0xba1d('0x1b7'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0x1c2')]['hasMany'](db[_0xba1d('0xb3')],{'as':_0xba1d('0x1ae'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0x1c2')][_0xba1d('0x10b')](db[_0xba1d('0xb3')],{'as':_0xba1d('0x1aa'),'foreignKey':'FieldId'});db[_0xba1d('0x1c2')]['belongsTo'](db['VtigerAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db['VtigerField'][_0xba1d('0x10b')](db['VtigerField'],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xb3')][_0xba1d('0x10b')](db[_0xba1d('0xb3')],{'as':_0xba1d('0x1b2'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xb3')][_0xba1d('0x10b')](db[_0xba1d('0xb3')],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xb3')][_0xba1d('0x116')](db['Variable'],{'as':_0xba1d('0x8b'),'foreignKey':_0xba1d('0x1b3')});db[_0xba1d('0x1c3')][_0xba1d('0x10b')](db[_0xba1d('0x1c4')],{'as':_0xba1d('0x1ac'),'onDelete':'cascade','foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0x1c4')][_0xba1d('0x10b')](db['ServicenowField'],{'as':_0xba1d('0x1b7'),'foreignKey':'SubjectId'});db[_0xba1d('0x1c4')][_0xba1d('0x10b')](db[_0xba1d('0xb6')],{'as':_0xba1d('0x1ae'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0x1c4')]['hasMany'](db['ServicenowField'],{'as':'Fields','foreignKey':'FieldId'});db[_0xba1d('0x1c4')][_0xba1d('0x116')](db['ServicenowAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xb6')][_0xba1d('0x10b')](db[_0xba1d('0xb6')],{'as':_0xba1d('0x1b0'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xb6')][_0xba1d('0x10b')](db['ServicenowField'],{'as':_0xba1d('0x1b2'),'foreignKey':'DescriptionId'});db[_0xba1d('0xb6')]['hasMany'](db[_0xba1d('0xb6')],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xb6')]['belongsTo'](db['Variable'],{'as':_0xba1d('0x8b'),'foreignKey':'VariableId'});db[_0xba1d('0xb8')][_0xba1d('0x10b')](db['Dynamics365Configuration'],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db['Dynamics365Configuration']['hasMany'](db[_0xba1d('0xba')],{'as':_0xba1d('0x1b7'),'onDelete':'cascade','foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xb9')][_0xba1d('0x10b')](db['Dynamics365Field'],{'as':_0xba1d('0x1ae'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xb9')][_0xba1d('0x10b')](db[_0xba1d('0xba')],{'as':'Fields','onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xb9')][_0xba1d('0x116')](db[_0xba1d('0xb8')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xba')][_0xba1d('0x10b')](db[_0xba1d('0xba')],{'as':_0xba1d('0x1b0'),'foreignKey':'SubjectId'});db[_0xba1d('0xba')][_0xba1d('0x10b')](db['Dynamics365Field'],{'as':_0xba1d('0x1b2'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xba')]['hasMany'](db[_0xba1d('0xba')],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xba')][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':'Variable','foreignKey':_0xba1d('0x1b3')});db['FreshsalesAccount'][_0xba1d('0x10b')](db['FreshsalesConfiguration'],{'as':_0xba1d('0x1ac'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xbe')]['hasMany'](db[_0xba1d('0xc0')],{'as':_0xba1d('0x1b7'),'foreignKey':_0xba1d('0x1b1')});db[_0xba1d('0xbe')]['hasMany'](db[_0xba1d('0xc0')],{'as':_0xba1d('0x1ae'),'foreignKey':_0xba1d('0x1b8')});db[_0xba1d('0xbe')][_0xba1d('0x10b')](db[_0xba1d('0xc0')],{'as':'Fields','foreignKey':_0xba1d('0x1af')});db[_0xba1d('0xbe')][_0xba1d('0x116')](db[_0xba1d('0xbc')],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1ad')});db[_0xba1d('0xc0')][_0xba1d('0x10b')](db['FreshsalesField'],{'as':_0xba1d('0x1b0'),'foreignKey':'SubjectId'});db[_0xba1d('0xc0')][_0xba1d('0x10b')](db[_0xba1d('0xc0')],{'as':_0xba1d('0x1b2'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0xba1d('0x10b')](db[_0xba1d('0xc0')],{'as':_0xba1d('0x1b5'),'foreignKey':_0xba1d('0x1af')});db['FreshsalesField'][_0xba1d('0x116')](db[_0xba1d('0x8b')],{'as':'Variable','foreignKey':_0xba1d('0x1b3')});db[_0xba1d('0xc3')][_0xba1d('0x116')](db[_0xba1d('0x5e')],{});db[_0xba1d('0xc3')][_0xba1d('0x116')](db['CmList'],{'as':_0xba1d('0x16f'),'foreignKey':'ListId'});db['ChatQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':'Contact','foreignKey':_0xba1d('0x161')});db[_0xba1d('0xc3')][_0xba1d('0x116')](db[_0xba1d('0x63')],{});db[_0xba1d('0xc3')][_0xba1d('0x116')](db[_0xba1d('0x65')],{});db[_0xba1d('0xc3')][_0xba1d('0x116')](db['User'],{});db['ChatQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x68')],{});db[_0xba1d('0xc5')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1c5')});db[_0xba1d('0xc5')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'onDelete':_0xba1d('0x109'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0xba1d('0x10b')](db['JscriptyQuestionReport'],{'foreignKey':_0xba1d('0x1c6'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0xc9')][_0xba1d('0x10b')](db[_0xba1d('0x1c7')],{'foreignKey':'SessionId','onDelete':_0xba1d('0x109')});db[_0xba1d('0xca')]['belongsTo'](db['SmsAccount'],{});db[_0xba1d('0xca')][_0xba1d('0x116')](db['CmList'],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0xca')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db['SmsQueueReport']['belongsTo'](db[_0xba1d('0x122')],{});db[_0xba1d('0xca')][_0xba1d('0x116')](db[_0xba1d('0x53')],{});db['SmsQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{});db[_0xba1d('0xca')]['belongsTo'](db[_0xba1d('0x55')],{});db[_0xba1d('0xd0')][_0xba1d('0x10b')](db[_0xba1d('0xc9')],{'foreignKey':'ProjectId'});db[_0xba1d('0xd0')][_0xba1d('0x10b')](db[_0xba1d('0xc7')],{'foreignKey':'ProjectId'});db[_0xba1d('0xd0')][_0xba1d('0x10b')](db[_0xba1d('0x1c7')],{'foreignKey':_0xba1d('0x1c8')});db[_0xba1d('0xd6')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x166'),'through':_0xba1d('0x136')});db[_0xba1d('0xdb')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x11d')});db['Team'][_0xba1d('0x118')](db['VoiceQueue'],{'through':_0xba1d('0x14b'),'as':_0xba1d('0x1c9')});db['Team'][_0xba1d('0x118')](db[_0xba1d('0x3b')],{'through':_0xba1d('0x15f'),'as':_0xba1d('0x125')});db[_0xba1d('0xdb')][_0xba1d('0x118')](db[_0xba1d('0x68')],{'through':_0xba1d('0x1ca'),'as':_0xba1d('0x126')});db[_0xba1d('0xdb')][_0xba1d('0x118')](db[_0xba1d('0x4e')],{'through':_0xba1d('0x178'),'as':_0xba1d('0x128')});db[_0xba1d('0xdb')]['belongsToMany'](db[_0xba1d('0x55')],{'through':_0xba1d('0x180'),'as':_0xba1d('0x129')});db['Team']['belongsToMany'](db[_0xba1d('0x12a')],{'through':'team_has_openchannel_queues','as':_0xba1d('0x12b')});db[_0xba1d('0xdb')][_0xba1d('0x118')](db[_0xba1d('0x102')],{'through':'team_has_whatsapp_queues','as':_0xba1d('0x12c')});db[_0xba1d('0xdf')][_0xba1d('0x10b')](db[_0xba1d('0x6f')],{'as':_0xba1d('0x13e'),'foreignKey':_0xba1d('0x195')});db[_0xba1d('0xdf')][_0xba1d('0x10b')](db[_0xba1d('0x73')],{'as':_0xba1d('0x13f'),'foreignKey':_0xba1d('0x195')});db[_0xba1d('0xdf')][_0xba1d('0x10b')](db[_0xba1d('0x75')],{'as':_0xba1d('0x140'),'foreignKey':_0xba1d('0x195')});db['Campaign'][_0xba1d('0x10b')](db[_0xba1d('0x71')],{'as':_0xba1d('0x141'),'foreignKey':_0xba1d('0x195')});db['Campaign']['belongsTo'](db[_0xba1d('0x29')],{'as':'Trunk','foreignKey':_0xba1d('0x143')});db['Campaign'][_0xba1d('0x116')](db[_0xba1d('0x29')],{'as':_0xba1d('0x144'),'foreignKey':_0xba1d('0x145')});db[_0xba1d('0xdf')][_0xba1d('0x116')](db[_0xba1d('0x146')],{'as':'Interval','foreignKey':_0xba1d('0x16c')});db[_0xba1d('0xdf')][_0xba1d('0x116')](db['SquareProject'],{'as':_0xba1d('0xd6'),'foreignKey':'SquareProjectId'});db['Campaign'][_0xba1d('0x118')](db[_0xba1d('0xee')],{'as':_0xba1d('0x11b'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0xba1d('0x118')](db[_0xba1d('0xee')],{'as':_0xba1d('0x14c'),'through':'campaigns_has_cm_blacklists'});db[_0xba1d('0xe6')][_0xba1d('0x116')](db[_0xba1d('0x160')],{});db[_0xba1d('0xe6')][_0xba1d('0x116')](db[_0xba1d('0x3f')],{});db[_0xba1d('0xe6')]['belongsTo'](db[_0xba1d('0x3a')],{'foreignKey':_0xba1d('0x1cb'),'as':_0xba1d('0x1cc')});db['MailTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1cd'),'as':'FromAgent'});db[_0xba1d('0xe6')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':'ToUserId','as':_0xba1d('0x1ce')});db[_0xba1d('0xe6')]['belongsTo'](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0xba1d('0x1cf')});db[_0xba1d('0xe6')][_0xba1d('0x116')](db[_0xba1d('0x3a')],{'foreignKey':_0xba1d('0x1d0'),'as':_0xba1d('0x1d1')});db[_0xba1d('0xe8')]['belongsTo'](db['ChatMessage'],{});db['ChatTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x63')],{});db['ChatTransferReport'][_0xba1d('0x116')](db['ChatWebsite'],{'foreignKey':_0xba1d('0x1d2'),'as':_0xba1d('0x1cc')});db['ChatTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1cd'),'as':_0xba1d('0x1d3')});db[_0xba1d('0xe8')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1d4'),'as':_0xba1d('0x1ce')});db[_0xba1d('0xe8')]['belongsTo'](db[_0xba1d('0x68')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db['ChatTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x5e')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0xba1d('0x1d5')][_0xba1d('0x116')](db['FaxMessage'],{});db['FaxTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x4a')],{});db['FaxTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x46')],{'foreignKey':_0xba1d('0x1d6'),'as':'FromAccount'});db[_0xba1d('0x1d5')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1cd'),'as':_0xba1d('0x1d3')});db[_0xba1d('0x1d5')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1d4'),'as':'ToAgent'});db[_0xba1d('0x1d5')]['belongsTo'](db[_0xba1d('0x4e')],{'foreignKey':_0xba1d('0x1d7'),'as':_0xba1d('0x1cf')});db['FaxTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x46')],{'foreignKey':_0xba1d('0x1d8'),'as':_0xba1d('0x1d1')});db[_0xba1d('0x1d9')][_0xba1d('0x116')](db[_0xba1d('0x5b')],{});db[_0xba1d('0x1d9')][_0xba1d('0x116')](db[_0xba1d('0x5a')],{});db['OpenchannelTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x57')],{'foreignKey':_0xba1d('0x1da'),'as':_0xba1d('0x1cc')});db[_0xba1d('0x1d9')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':'FromUserId','as':_0xba1d('0x1d3')});db['OpenchannelTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1d4'),'as':_0xba1d('0x1ce')});db['OpenchannelTransferReport'][_0xba1d('0x116')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0xba1d('0x1cf')});db[_0xba1d('0x1d9')][_0xba1d('0x116')](db['OpenchannelAccount'],{'foreignKey':_0xba1d('0x1db'),'as':'ToAccount'});db[_0xba1d('0xec')][_0xba1d('0x116')](db[_0xba1d('0x53')],{});db[_0xba1d('0xec')][_0xba1d('0x116')](db[_0xba1d('0x122')],{});db['SmsTransferReport']['belongsTo'](db[_0xba1d('0x132')],{'foreignKey':_0xba1d('0x1dc'),'as':_0xba1d('0x1cc')});db[_0xba1d('0xec')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1cd'),'as':_0xba1d('0x1d3')});db[_0xba1d('0xec')][_0xba1d('0x116')](db['User'],{'foreignKey':_0xba1d('0x1d4'),'as':_0xba1d('0x1ce')});db[_0xba1d('0xec')][_0xba1d('0x116')](db[_0xba1d('0x55')],{'foreignKey':_0xba1d('0x1dd'),'as':'ToQueue'});db['SmsTransferReport'][_0xba1d('0x116')](db[_0xba1d('0x132')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0xba1d('0xee')]['hasMany'](db[_0xba1d('0x7e')],{'as':_0xba1d('0x157'),'foreignKey':'ListId'});db[_0xba1d('0xee')][_0xba1d('0x10b')](db[_0xba1d('0x79')],{'as':_0xba1d('0x1de'),'foreignKey':_0xba1d('0x15b')});db['CmList'][_0xba1d('0x10b')](db['CmContact'],{'as':_0xba1d('0x1df'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0xee')][_0xba1d('0x10b')](db[_0xba1d('0x73')],{'as':_0xba1d('0x13f'),'foreignKey':'ListId'});db['CmList'][_0xba1d('0x10b')](db[_0xba1d('0x75')],{'as':_0xba1d('0x1e0'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0xee')][_0xba1d('0x10b')](db[_0xba1d('0x77')],{'as':_0xba1d('0x77'),'foreignKey':'ListId'});db[_0xba1d('0xee')][_0xba1d('0x118')](db[_0xba1d('0x1a')],{'as':_0xba1d('0x1e1'),'through':_0xba1d('0x148')});db[_0xba1d('0xee')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':'Agents','through':'cm_user_has_lists'});db[_0xba1d('0xef')][_0xba1d('0x10b')](db[_0xba1d('0x16')],{'as':_0xba1d('0x10e'),'onDelete':'cascade'});db[_0xba1d('0xef')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x1e2')});db[_0xba1d('0xf1')][_0xba1d('0x10b')](db[_0xba1d('0x106')],{'as':_0xba1d('0x166'),'foreignKey':_0xba1d('0x117')});db[_0xba1d('0xf1')][_0xba1d('0x10b')](db[_0xba1d('0xf3')],{'as':_0xba1d('0x1e3'),'foreignKey':_0xba1d('0x117'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0xf3')][_0xba1d('0x10b')](db[_0xba1d('0xf5')],{'as':_0xba1d('0x1e4'),'foreignKey':_0xba1d('0x1e5'),'onDelete':_0xba1d('0x109')});db[_0xba1d('0xf7')][_0xba1d('0x10b')](db[_0xba1d('0x7e')],{'as':_0xba1d('0x157'),'foreignKey':_0xba1d('0x1e6')});db['WhatsappAccount'][_0xba1d('0x10b')](db[_0xba1d('0x7c')],{'as':_0xba1d('0x158'),'foreignKey':_0xba1d('0x1e6')});db[_0xba1d('0xf7')][_0xba1d('0x10b')](db['WhatsappMessage'],{'as':_0xba1d('0x14f'),'foreignKey':_0xba1d('0x1e6')});db[_0xba1d('0xf7')][_0xba1d('0x10b')](db[_0xba1d('0xfb')],{'as':_0xba1d('0x159')});db['WhatsappAccount'][_0xba1d('0x10b')](db[_0xba1d('0xf9')],{'as':_0xba1d('0x139')});db[_0xba1d('0xf7')]['belongsTo'](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':_0xba1d('0x15b')});db[_0xba1d('0xf7')][_0xba1d('0x116')](db['Pause'],{'as':_0xba1d('0x147'),'foreignKey':_0xba1d('0x15d')});db[_0xba1d('0xf7')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':_0xba1d('0x134')});db[_0xba1d('0xf9')][_0xba1d('0x116')](db['User'],{'onDelete':_0xba1d('0x16b')});db[_0xba1d('0xf9')][_0xba1d('0x116')](db[_0xba1d('0x102')],{'onDelete':_0xba1d('0x16b')});db['WhatsappApplication'][_0xba1d('0x116')](db[_0xba1d('0xf7')],{'onDelete':'restrict'});db[_0xba1d('0xf9')][_0xba1d('0x116')](db[_0xba1d('0x146')],{'onDelete':'restrict','foreignKey':_0xba1d('0x16c')});db['WhatsappApplication'][_0xba1d('0x116')](db[_0xba1d('0x162')],{'onDelete':'restrict','foreignKey':_0xba1d('0x16d')});db[_0xba1d('0xfb')]['hasMany'](db[_0xba1d('0xfd')],{'as':_0xba1d('0x14f'),'onDelete':_0xba1d('0x109'),'foreignKey':_0xba1d('0x1e7')});db[_0xba1d('0xfb')]['belongsTo'](db['WhatsappAccount'],{'as':_0xba1d('0x16a'),'foreignKey':_0xba1d('0x1e6')});db['WhatsappInteraction'][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':_0xba1d('0x161')});db[_0xba1d('0xfb')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'as':_0xba1d('0x17c'),'foreignKey':_0xba1d('0x10a')});db[_0xba1d('0xfb')]['belongsToMany'](db['Tag'],{'through':_0xba1d('0x1a4'),'as':_0xba1d('0x163')});db[_0xba1d('0xfb')][_0xba1d('0x118')](db[_0xba1d('0x162')],{'through':'whatsapp_interaction_has_tags','as':_0xba1d('0x165')});db[_0xba1d('0xfb')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':_0xba1d('0x1e7')});db['WhatsappMessage']['belongsTo'](db[_0xba1d('0x106')],{'as':'User'});db[_0xba1d('0xfd')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'onDelete':_0xba1d('0x109'),'as':_0xba1d('0x154')});db[_0xba1d('0xfd')]['belongsTo'](db[_0xba1d('0xfb')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xba1d('0x1e7')});db[_0xba1d('0xfd')]['belongsTo'](db[_0xba1d('0xf7')],{'as':_0xba1d('0x16a'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport']['belongsTo'](db[_0xba1d('0xf7')],{});db[_0xba1d('0xfe')][_0xba1d('0x116')](db[_0xba1d('0xee')],{'as':_0xba1d('0x16f'),'foreignKey':'ListId'});db[_0xba1d('0xfe')][_0xba1d('0x116')](db[_0xba1d('0x11a')],{'as':_0xba1d('0x154'),'foreignKey':'ContactId'});db[_0xba1d('0xfe')][_0xba1d('0x116')](db[_0xba1d('0xfb')],{});db['WhatsappQueueReport'][_0xba1d('0x116')](db[_0xba1d('0x102')],{});db[_0xba1d('0xfe')][_0xba1d('0x116')](db[_0xba1d('0xfd')],{});db[_0xba1d('0xfe')][_0xba1d('0x116')](db[_0xba1d('0x106')],{});db[_0xba1d('0x100')]['belongsTo'](db[_0xba1d('0xfd')],{});db['WhatsappTransferReport'][_0xba1d('0x116')](db[_0xba1d('0xfb')],{});db[_0xba1d('0x100')][_0xba1d('0x116')](db[_0xba1d('0xf7')],{'foreignKey':_0xba1d('0x1e8'),'as':_0xba1d('0x1cc')});db[_0xba1d('0x100')][_0xba1d('0x116')](db[_0xba1d('0xf7')],{'foreignKey':_0xba1d('0x1e9'),'as':_0xba1d('0x1d1')});db[_0xba1d('0x100')][_0xba1d('0x116')](db[_0xba1d('0x102')],{'foreignKey':_0xba1d('0x1ea'),'as':'ToQueue'});db[_0xba1d('0x100')][_0xba1d('0x116')](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1cd'),'as':_0xba1d('0x1d3')});db[_0xba1d('0x100')]['belongsTo'](db[_0xba1d('0x106')],{'foreignKey':_0xba1d('0x1d4'),'as':_0xba1d('0x1ce')});db[_0xba1d('0x102')][_0xba1d('0x118')](db[_0xba1d('0x106')],{'as':_0xba1d('0x149'),'through':'UserWhatsappQueue','foreignKey':_0xba1d('0x1eb')});db[_0xba1d('0x102')]['belongsToMany'](db['Team'],{'through':'team_has_whatsapp_queues','as':_0xba1d('0x14a')});module[_0xba1d('0x1ec')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 703fd83..b535ee3 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb354=['./api/variable','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/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/campaign','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express','util','./config/environment','./config/logger','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','headers','x-forwarded-for','remoteAddress','url','statusCode','user','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','connection','responseTime','name','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/mail/out_servers','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables'];(function(_0x4c71f9,_0x34cd73){var _0x427fdb=function(_0x3fd83f){while(--_0x3fd83f){_0x4c71f9['push'](_0x4c71f9['shift']());}};_0x427fdb(++_0x34cd73);}(_0xb354,0x95));var _0x4b35=function(_0x4cbe36,_0x31f174){_0x4cbe36=_0x4cbe36-0x0;var _0x1c2aa2=_0xb354[_0x4cbe36];return _0x1c2aa2;};'use strict';var path=require(_0x4b35('0x0'));var express=require(_0x4b35('0x1'));var ewinston=require('express-winston');var util=require(_0x4b35('0x2'));var errors=require('./errors');var config=require(_0x4b35('0x3'));var logger=require(_0x4b35('0x4'))('api');var authLogger=require(_0x4b35('0x4'))('auth');exports[_0x4b35('0x5')]=function(_0x318ef7){_0x318ef7[_0x4b35('0x6')](ewinston[_0x4b35('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1173fc,_0xf2db38){return util[_0x4b35('0x8')](_0x4b35('0x9'),_0x1173fc['method'],_0x1173fc[_0x4b35('0xa')][_0x4b35('0xb')]?_0x1173fc[_0x4b35('0xa')][_0x4b35('0xb')]:_0x1173fc['connection'][_0x4b35('0xc')]||_0x1173fc['ip'],_0x1173fc[_0x4b35('0xd')],_0xf2db38[_0x4b35('0xe')],_0xf2db38['responseTime'],_0x1173fc[_0x4b35('0xf')]?_0x1173fc[_0x4b35('0xf')]['id']:null,_0x1173fc[_0x4b35('0xf')]?_0x1173fc[_0x4b35('0xf')]['name']:null,_0x1173fc[_0x4b35('0xf')]?_0x1173fc[_0x4b35('0xf')][_0x4b35('0x10')]:null);}}));_0x318ef7[_0x4b35('0x6')](ewinston[_0x4b35('0x7')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1b3755,_0x1642a3){var _0x50f36c=_0x4b35('0x11');if(_0x1b3755[_0x4b35('0x12')]&&_0x1b3755[_0x4b35('0x12')]['device']&&_0x1b3755[_0x4b35('0x12')][_0x4b35('0x13')]){_0x50f36c=_0x4b35('0x14');}return util[_0x4b35('0x8')](_0x50f36c,_0x1b3755[_0x4b35('0x15')],_0x1b3755[_0x4b35('0xa')][_0x4b35('0xb')]?_0x1b3755[_0x4b35('0xa')]['x-forwarded-for']:_0x1b3755[_0x4b35('0x16')][_0x4b35('0xc')]||_0x1b3755['ip'],_0x1b3755[_0x4b35('0xd')],_0x1642a3[_0x4b35('0xe')],_0x1642a3[_0x4b35('0x17')],_0x1b3755['user']?_0x1b3755[_0x4b35('0xf')]['id']:null,_0x1b3755['user']?_0x1b3755[_0x4b35('0xf')][_0x4b35('0x18')]:null,_0x1b3755[_0x4b35('0xf')]?_0x1b3755['user'][_0x4b35('0x10')]:null,_0x1b3755['body']&&_0x1b3755[_0x4b35('0x12')][_0x4b35('0x19')]?_0x1b3755[_0x4b35('0x12')][_0x4b35('0x19')]:_0x4b35('0x1a'),_0x1b3755[_0x4b35('0x12')]&&_0x1b3755[_0x4b35('0x12')][_0x4b35('0x13')]?_0x1b3755['body'][_0x4b35('0x13')]:'',_0x1b3755['body']&&_0x1b3755[_0x4b35('0x12')][_0x4b35('0x1b')]?_0x1b3755[_0x4b35('0x12')]['agent_name']:'');},'ignoreRoute':function(_0x17666a){var _0x2e86bb=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2e86bb[_0x4b35('0x1c')](_0x17666a[_0x4b35('0xd')]);}}));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x1d'),require(_0x4b35('0x1e')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x1f'),require('./api/voiceChanSpy'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x20'),require(_0x4b35('0x21')));_0x318ef7[_0x4b35('0x6')]('/api/voice/extensions',require(_0x4b35('0x22')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x23'),require(_0x4b35('0x24')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x25'),require(_0x4b35('0x26')));_0x318ef7['use'](_0x4b35('0x27'),require(_0x4b35('0x28')));_0x318ef7['use'](_0x4b35('0x29'),require(_0x4b35('0x2a')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x2b'),require(_0x4b35('0x2c')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x2d'),require(_0x4b35('0x2e')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x2f'),require(_0x4b35('0x30')));_0x318ef7['use'](_0x4b35('0x31'),require(_0x4b35('0x32')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x33'),require('./api/voiceAgentReport'));_0x318ef7['use']('/api/voice/queues/reports',require(_0x4b35('0x34')));_0x318ef7['use']('/api/members/reports',require(_0x4b35('0x35')));_0x318ef7[_0x4b35('0x6')]('/api/trunks',require(_0x4b35('0x36')));_0x318ef7[_0x4b35('0x6')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x318ef7['use'](_0x4b35('0x37'),require('./api/mailServerOut'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x38'),require('./api/mailAccount'));_0x318ef7['use'](_0x4b35('0x39'),require(_0x4b35('0x3a')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x3b'),require(_0x4b35('0x3c')));_0x318ef7['use'](_0x4b35('0x3d'),require(_0x4b35('0x3e')));_0x318ef7['use'](_0x4b35('0x3f'),require(_0x4b35('0x40')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x41'),require('./api/mailApplication'));_0x318ef7['use'](_0x4b35('0x42'),require(_0x4b35('0x43')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x44'),require(_0x4b35('0x45')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x46'),require('./api/dashboardItem'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x47'),require(_0x4b35('0x48')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x49'),require(_0x4b35('0x4a')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x4b'),require(_0x4b35('0x4c')));_0x318ef7['use'](_0x4b35('0x4d'),require(_0x4b35('0x4e')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x4f'),require(_0x4b35('0x50')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x51'),require(_0x4b35('0x52')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x53'),require('./api/smsAccount'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x54'),require(_0x4b35('0x55')));_0x318ef7['use']('/api/sms/interactions',require(_0x4b35('0x56')));_0x318ef7['use'](_0x4b35('0x57'),require(_0x4b35('0x58')));_0x318ef7[_0x4b35('0x6')]('/api/sms/queues',require('./api/smsQueue'));_0x318ef7['use'](_0x4b35('0x59'),require(_0x4b35('0x5a')));_0x318ef7[_0x4b35('0x6')]('/api/openchannel/applications',require(_0x4b35('0x5b')));_0x318ef7['use'](_0x4b35('0x5c'),require(_0x4b35('0x5d')));_0x318ef7['use'](_0x4b35('0x5e'),require(_0x4b35('0x5f')));_0x318ef7['use'](_0x4b35('0x60'),require(_0x4b35('0x61')));_0x318ef7[_0x4b35('0x6')]('/api/chat/websites',require(_0x4b35('0x62')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x63'),require(_0x4b35('0x64')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x65'),require(_0x4b35('0x66')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x67'),require(_0x4b35('0x68')));_0x318ef7['use']('/api/chat/messages',require(_0x4b35('0x69')));_0x318ef7['use'](_0x4b35('0x6a'),require(_0x4b35('0x6b')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x6c'),require(_0x4b35('0x6d')));_0x318ef7[_0x4b35('0x6')]('/api/chat/groups',require(_0x4b35('0x6e')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x6f'),require(_0x4b35('0x70')));_0x318ef7[_0x4b35('0x6')]('/api/cm/companies',require(_0x4b35('0x71')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x72'),require('./api/cmContact'));_0x318ef7[_0x4b35('0x6')]('/api/cm/hopper',require('./api/cmHopper'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x73'),require(_0x4b35('0x74')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x75'),require('./api/cmHopperFinal'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x76'),require(_0x4b35('0x77')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x78'),require(_0x4b35('0x79')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x7a'),require(_0x4b35('0x7b')));_0x318ef7['use'](_0x4b35('0x7c'),require(_0x4b35('0x7d')));_0x318ef7[_0x4b35('0x6')]('/api/canned_answers',require(_0x4b35('0x7e')));_0x318ef7[_0x4b35('0x6')]('/api/dispositions',require(_0x4b35('0x7f')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x80'),require(_0x4b35('0x81')));_0x318ef7[_0x4b35('0x6')]('/api/intervals',require(_0x4b35('0x82')));_0x318ef7[_0x4b35('0x6')]('/api/pauses',require('./api/pause'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x83'),require(_0x4b35('0x84')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x85'),require(_0x4b35('0x86')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x87'),require('./api/schedule'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x88'),require(_0x4b35('0x89')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x8a'),require(_0x4b35('0x8b')));_0x318ef7['use'](_0x4b35('0x8c'),require(_0x4b35('0x8d')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x8e'),require(_0x4b35('0x8f')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x90'),require(_0x4b35('0x91')));_0x318ef7['use']('/api/integrations',require(_0x4b35('0x92')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x93'),require('./api/integrationReport'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x94'),require('./api/analyticCustomReport'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x95'),require(_0x4b35('0x96')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x97'),require(_0x4b35('0x98')));_0x318ef7[_0x4b35('0x6')]('/api/analytics/metrics',require(_0x4b35('0x99')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x9a'),require(_0x4b35('0x9b')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x9c'),require(_0x4b35('0x9d')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x9e'),require('./api/intSalesforceAccount'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x9f'),require('./api/intSalesforceConfiguration'));_0x318ef7[_0x4b35('0x6')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xa0'),require('./api/intSugarcrmAccount'));_0x318ef7[_0x4b35('0x6')]('/api/integrations/sugarcrm/configurations',require(_0x4b35('0xa1')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xa2'),require('./api/intSugarcrmField'));_0x318ef7[_0x4b35('0x6')]('/api/integrations/desk/accounts',require(_0x4b35('0xa3')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xa4'),require(_0x4b35('0xa5')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xa6'),require('./api/intDeskField'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xa7'),require(_0x4b35('0xa8')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xa9'),require(_0x4b35('0xaa')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xab'),require('./api/intZohoField'));_0x318ef7[_0x4b35('0x6')]('/api/integrations/zendesk/accounts',require(_0x4b35('0xac')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xad'),require('./api/intZendeskConfiguration'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xae'),require('./api/intZendeskField'));_0x318ef7['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xaf'),require(_0x4b35('0xb0')));_0x318ef7['use']('/api/integrations/freshdesk/fields',require(_0x4b35('0xb1')));_0x318ef7['use'](_0x4b35('0xb2'),require(_0x4b35('0xb3')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xb4'),require(_0x4b35('0xb5')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xb6'),require(_0x4b35('0xb7')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xb8'),require(_0x4b35('0xb9')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xba'),require(_0x4b35('0xbb')));_0x318ef7[_0x4b35('0x6')]('/api/integrations/servicenow/fields',require(_0x4b35('0xbc')));_0x318ef7['use'](_0x4b35('0xbd'),require(_0x4b35('0xbe')));_0x318ef7['use'](_0x4b35('0xbf'),require(_0x4b35('0xc0')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xc1'),require('./api/intDynamics365Field'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xc2'),require(_0x4b35('0xc3')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xc4'),require(_0x4b35('0xc5')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xc6'),require(_0x4b35('0xc7')));_0x318ef7['use']('/api/networks',require(_0x4b35('0xc8')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xc9'),require(_0x4b35('0xca')));_0x318ef7[_0x4b35('0x6')]('/api/chat/internal/messages',require(_0x4b35('0xcb')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xcc'),require(_0x4b35('0xcd')));_0x318ef7['use'](_0x4b35('0xce'),require('./api/jscriptyQuestionReport'));_0x318ef7[_0x4b35('0x6')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xcf'),require(_0x4b35('0xd0')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xd1'),require(_0x4b35('0xd2')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xd3'),require(_0x4b35('0xd4')));_0x318ef7['use']('/api/jscripty/projects',require(_0x4b35('0xd5')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xd6'),require(_0x4b35('0xd7')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xd8'),require('./api/squareOdbc'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xd9'),require(_0x4b35('0xda')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xdb'),require(_0x4b35('0xdc')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xdd'),require(_0x4b35('0xde')));_0x318ef7['use'](_0x4b35('0xdf'),require(_0x4b35('0xe0')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xe1'),require(_0x4b35('0xe2')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xe3'),require(_0x4b35('0xe4')));_0x318ef7[_0x4b35('0x6')]('/api/migrations',require('./api/migration'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xe5'),require(_0x4b35('0xe6')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xe7'),require(_0x4b35('0xe8')));_0x318ef7[_0x4b35('0x6')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xe9'),require('./api/chatTransferReport'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xea'),require('./api/faxTransferReport'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xeb'),require(_0x4b35('0xec')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xed'),require(_0x4b35('0xee')));_0x318ef7['use'](_0x4b35('0xef'),require(_0x4b35('0xf0')));_0x318ef7[_0x4b35('0x6')]('/api/voice/prefixes',require(_0x4b35('0xf1')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xf2'),require(_0x4b35('0xf3')));_0x318ef7['use'](_0x4b35('0xf4'),require('./api/userProfileSection'));_0x318ef7['use'](_0x4b35('0xf5'),require(_0x4b35('0xf6')));_0x318ef7[_0x4b35('0x6')]('/api/notifications',require('./api/notification'));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xf7'),require(_0x4b35('0xf8')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xf9'),require(_0x4b35('0xfa')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xfb'),require(_0x4b35('0xfc')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xfd'),require(_0x4b35('0xfe')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0xff'),require(_0x4b35('0x100')));_0x318ef7[_0x4b35('0x6')]('/api/whatsapp/reports/transfer',require(_0x4b35('0x101')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x102'),require(_0x4b35('0x103')));_0x318ef7['use'](_0x4b35('0x104'),require(_0x4b35('0x105')));_0x318ef7['use'](_0x4b35('0x106'),require(_0x4b35('0x107')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x108'),require(_0x4b35('0x109')));_0x318ef7[_0x4b35('0x6')]('/api/jira',require(_0x4b35('0x10a')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x10b'),require(_0x4b35('0x10c')));_0x318ef7['use'](_0x4b35('0x10d'),require(_0x4b35('0x10e')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x10f'),require(_0x4b35('0x110')));_0x318ef7['use'](_0x4b35('0x111'),require(_0x4b35('0x112')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x113'),require(_0x4b35('0x114')));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x115'),express[_0x4b35('0x116')](path[_0x4b35('0x117')](config[_0x4b35('0x118')],_0x4b35('0x115'))));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x119'),express[_0x4b35('0x116')](path[_0x4b35('0x117')](config[_0x4b35('0x118')],_0x4b35('0x119'))));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x11a'),express[_0x4b35('0x116')](path['join'](config[_0x4b35('0x118')],_0x4b35('0x11a'))));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x11b'),express['static'](path[_0x4b35('0x117')](config[_0x4b35('0x118')],_0x4b35('0x11c'),_0x4b35('0x11d'))));_0x318ef7[_0x4b35('0x6')](_0x4b35('0x11e'),express['static'](path[_0x4b35('0x117')](config['root'],_0x4b35('0x11f'))));_0x318ef7[_0x4b35('0x120')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x4b35('0x121')](errors[0x194]);_0x318ef7[_0x4b35('0x120')]('/*')[_0x4b35('0x121')](function(_0x5e0400,_0x5b2b0d){_0x5b2b0d[_0x4b35('0x122')](path[_0x4b35('0x123')](_0x318ef7[_0x4b35('0x121')](_0x4b35('0x124'))+_0x4b35('0x125')));});}; \ No newline at end of file +var _0x29b8=['./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/variable','./api/integration','/api/integrations/reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/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/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappQueue','/api/cloudProviders','./api/authLocal','/api/auth/google','./api/jira','/api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','join','root','/www','/demo','static','/snippet','snippet','1.0.16','/plugins','route','sendFile','resolve','appPath','/index.html','path','express','express-winston','util','./config/environment','./config/logger','api','auth','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','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)','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts'];(function(_0x2ad632,_0x134994){var _0x418653=function(_0x1066bd){while(--_0x1066bd){_0x2ad632['push'](_0x2ad632['shift']());}};_0x418653(++_0x134994);}(_0x29b8,0x1e0));var _0x829b=function(_0x359bbe,_0x5b7fcc){_0x359bbe=_0x359bbe-0x0;var _0x1b3353=_0x29b8[_0x359bbe];return _0x1b3353;};'use strict';var path=require(_0x829b('0x0'));var express=require(_0x829b('0x1'));var ewinston=require(_0x829b('0x2'));var util=require(_0x829b('0x3'));var errors=require('./errors');var config=require(_0x829b('0x4'));var logger=require(_0x829b('0x5'))(_0x829b('0x6'));var authLogger=require(_0x829b('0x5'))(_0x829b('0x7'));exports['default']=function(_0x43c218){_0x43c218[_0x829b('0x8')](ewinston[_0x829b('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x15cdd7,_0x44c953){return util[_0x829b('0xa')](_0x829b('0xb'),_0x15cdd7[_0x829b('0xc')],_0x15cdd7[_0x829b('0xd')][_0x829b('0xe')]?_0x15cdd7[_0x829b('0xd')]['x-forwarded-for']:_0x15cdd7[_0x829b('0xf')][_0x829b('0x10')]||_0x15cdd7['ip'],_0x15cdd7[_0x829b('0x11')],_0x44c953[_0x829b('0x12')],_0x44c953[_0x829b('0x13')],_0x15cdd7[_0x829b('0x14')]?_0x15cdd7[_0x829b('0x14')]['id']:null,_0x15cdd7['user']?_0x15cdd7[_0x829b('0x14')]['name']:null,_0x15cdd7['user']?_0x15cdd7[_0x829b('0x14')][_0x829b('0x15')]:null);}}));_0x43c218[_0x829b('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x8e5708,_0x3bcb2e){var _0x585be4=_0x829b('0x16');if(_0x8e5708['body']&&_0x8e5708[_0x829b('0x17')][_0x829b('0x18')]&&_0x8e5708[_0x829b('0x17')][_0x829b('0x19')]){_0x585be4=_0x829b('0x1a');}return util['format'](_0x585be4,_0x8e5708[_0x829b('0xc')],_0x8e5708[_0x829b('0xd')][_0x829b('0xe')]?_0x8e5708[_0x829b('0xd')][_0x829b('0xe')]:_0x8e5708[_0x829b('0xf')][_0x829b('0x10')]||_0x8e5708['ip'],_0x8e5708[_0x829b('0x11')],_0x3bcb2e[_0x829b('0x12')],_0x3bcb2e[_0x829b('0x13')],_0x8e5708[_0x829b('0x14')]?_0x8e5708['user']['id']:null,_0x8e5708[_0x829b('0x14')]?_0x8e5708[_0x829b('0x14')]['name']:null,_0x8e5708['user']?_0x8e5708[_0x829b('0x14')][_0x829b('0x15')]:null,_0x8e5708[_0x829b('0x17')]&&_0x8e5708[_0x829b('0x17')]['device']?_0x8e5708['body']['device']:'other',_0x8e5708[_0x829b('0x17')]&&_0x8e5708[_0x829b('0x17')][_0x829b('0x19')]?_0x8e5708[_0x829b('0x17')][_0x829b('0x19')]:'',_0x8e5708[_0x829b('0x17')]&&_0x8e5708[_0x829b('0x17')][_0x829b('0x1b')]?_0x8e5708[_0x829b('0x17')][_0x829b('0x1b')]:'');},'ignoreRoute':function(_0x41565e){var _0x55771d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x55771d[_0x829b('0x1c')](_0x41565e[_0x829b('0x11')]);}}));_0x43c218[_0x829b('0x8')]('/api/users',require(_0x829b('0x1d')));_0x43c218[_0x829b('0x8')](_0x829b('0x1e'),require(_0x829b('0x1f')));_0x43c218[_0x829b('0x8')](_0x829b('0x20'),require('./api/voiceContext'));_0x43c218[_0x829b('0x8')](_0x829b('0x21'),require('./api/voiceExtension'));_0x43c218['use'](_0x829b('0x22'),require('./api/voiceMusicOnHold'));_0x43c218[_0x829b('0x8')]('/api/voice/queues',require('./api/voiceQueue'));_0x43c218[_0x829b('0x8')]('/api/voice/recordings',require(_0x829b('0x23')));_0x43c218[_0x829b('0x8')]('/api/screen/recordings',require(_0x829b('0x24')));_0x43c218[_0x829b('0x8')](_0x829b('0x25'),require(_0x829b('0x26')));_0x43c218[_0x829b('0x8')]('/api/voice/mails/messages',require(_0x829b('0x27')));_0x43c218[_0x829b('0x8')]('/api/voice/calls/reports',require(_0x829b('0x28')));_0x43c218[_0x829b('0x8')](_0x829b('0x29'),require(_0x829b('0x2a')));_0x43c218['use'](_0x829b('0x2b'),require(_0x829b('0x2c')));_0x43c218['use']('/api/voice/queues/reports',require(_0x829b('0x2d')));_0x43c218[_0x829b('0x8')](_0x829b('0x2e'),require(_0x829b('0x2f')));_0x43c218[_0x829b('0x8')](_0x829b('0x30'),require(_0x829b('0x31')));_0x43c218[_0x829b('0x8')](_0x829b('0x32'),require(_0x829b('0x33')));_0x43c218[_0x829b('0x8')]('/api/mail/out_servers',require(_0x829b('0x34')));_0x43c218[_0x829b('0x8')](_0x829b('0x35'),require(_0x829b('0x36')));_0x43c218[_0x829b('0x8')](_0x829b('0x37'),require(_0x829b('0x38')));_0x43c218[_0x829b('0x8')](_0x829b('0x39'),require(_0x829b('0x3a')));_0x43c218['use'](_0x829b('0x3b'),require('./api/mailInteraction'));_0x43c218['use']('/api/mail/messages',require(_0x829b('0x3c')));_0x43c218['use'](_0x829b('0x3d'),require(_0x829b('0x3e')));_0x43c218[_0x829b('0x8')]('/api/mail/reports/queue',require(_0x829b('0x3f')));_0x43c218[_0x829b('0x8')]('/api/dashboards',require(_0x829b('0x40')));_0x43c218[_0x829b('0x8')](_0x829b('0x41'),require(_0x829b('0x42')));_0x43c218[_0x829b('0x8')](_0x829b('0x43'),require('./api/faxAccount'));_0x43c218[_0x829b('0x8')]('/api/fax/applications',require(_0x829b('0x44')));_0x43c218[_0x829b('0x8')](_0x829b('0x45'),require('./api/faxInteraction'));_0x43c218[_0x829b('0x8')](_0x829b('0x46'),require(_0x829b('0x47')));_0x43c218['use'](_0x829b('0x48'),require(_0x829b('0x49')));_0x43c218[_0x829b('0x8')](_0x829b('0x4a'),require('./api/faxQueueReport'));_0x43c218[_0x829b('0x8')](_0x829b('0x4b'),require(_0x829b('0x4c')));_0x43c218[_0x829b('0x8')](_0x829b('0x4d'),require(_0x829b('0x4e')));_0x43c218[_0x829b('0x8')](_0x829b('0x4f'),require('./api/smsInteraction'));_0x43c218['use'](_0x829b('0x50'),require('./api/smsMessage'));_0x43c218[_0x829b('0x8')]('/api/sms/queues',require(_0x829b('0x51')));_0x43c218[_0x829b('0x8')](_0x829b('0x52'),require(_0x829b('0x53')));_0x43c218['use'](_0x829b('0x54'),require(_0x829b('0x55')));_0x43c218[_0x829b('0x8')](_0x829b('0x56'),require(_0x829b('0x57')));_0x43c218[_0x829b('0x8')](_0x829b('0x58'),require(_0x829b('0x59')));_0x43c218[_0x829b('0x8')](_0x829b('0x5a'),require(_0x829b('0x5b')));_0x43c218[_0x829b('0x8')]('/api/chat/websites',require('./api/chatWebsite'));_0x43c218['use'](_0x829b('0x5c'),require('./api/openchannelQueueReport'));_0x43c218[_0x829b('0x8')](_0x829b('0x5d'),require(_0x829b('0x5e')));_0x43c218[_0x829b('0x8')](_0x829b('0x5f'),require(_0x829b('0x60')));_0x43c218[_0x829b('0x8')](_0x829b('0x61'),require('./api/chatMessage'));_0x43c218[_0x829b('0x8')](_0x829b('0x62'),require('./api/chatOfflineMessage'));_0x43c218[_0x829b('0x8')](_0x829b('0x63'),require(_0x829b('0x64')));_0x43c218[_0x829b('0x8')](_0x829b('0x65'),require('./api/chatGroup'));_0x43c218[_0x829b('0x8')](_0x829b('0x66'),require('./api/chatProactiveAction'));_0x43c218[_0x829b('0x8')](_0x829b('0x67'),require(_0x829b('0x68')));_0x43c218[_0x829b('0x8')](_0x829b('0x69'),require(_0x829b('0x6a')));_0x43c218['use'](_0x829b('0x6b'),require(_0x829b('0x6c')));_0x43c218['use'](_0x829b('0x6d'),require(_0x829b('0x6e')));_0x43c218['use'](_0x829b('0x6f'),require(_0x829b('0x70')));_0x43c218[_0x829b('0x8')](_0x829b('0x71'),require(_0x829b('0x72')));_0x43c218[_0x829b('0x8')](_0x829b('0x73'),require(_0x829b('0x74')));_0x43c218[_0x829b('0x8')]('/api/actions',require(_0x829b('0x75')));_0x43c218[_0x829b('0x8')](_0x829b('0x76'),require(_0x829b('0x77')));_0x43c218['use']('/api/canned_answers',require('./api/cannedAnswer'));_0x43c218[_0x829b('0x8')](_0x829b('0x78'),require(_0x829b('0x79')));_0x43c218['use'](_0x829b('0x7a'),require(_0x829b('0x7b')));_0x43c218[_0x829b('0x8')]('/api/intervals',require(_0x829b('0x7c')));_0x43c218[_0x829b('0x8')]('/api/pauses',require(_0x829b('0x7d')));_0x43c218[_0x829b('0x8')](_0x829b('0x7e'),require(_0x829b('0x7f')));_0x43c218[_0x829b('0x8')](_0x829b('0x80'),require(_0x829b('0x81')));_0x43c218[_0x829b('0x8')](_0x829b('0x82'),require(_0x829b('0x83')));_0x43c218[_0x829b('0x8')](_0x829b('0x84'),require(_0x829b('0x85')));_0x43c218[_0x829b('0x8')](_0x829b('0x86'),require(_0x829b('0x87')));_0x43c218['use'](_0x829b('0x88'),require(_0x829b('0x89')));_0x43c218[_0x829b('0x8')](_0x829b('0x8a'),require('./api/trigger'));_0x43c218[_0x829b('0x8')]('/api/variables',require(_0x829b('0x8b')));_0x43c218['use']('/api/integrations',require(_0x829b('0x8c')));_0x43c218[_0x829b('0x8')](_0x829b('0x8d'),require('./api/integrationReport'));_0x43c218[_0x829b('0x8')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x43c218[_0x829b('0x8')](_0x829b('0x8e'),require(_0x829b('0x8f')));_0x43c218['use']('/api/analytics/extracted_reports',require(_0x829b('0x90')));_0x43c218['use'](_0x829b('0x91'),require(_0x829b('0x92')));_0x43c218['use'](_0x829b('0x93'),require(_0x829b('0x94')));_0x43c218['use'](_0x829b('0x95'),require('./api/analyticTreeReport'));_0x43c218[_0x829b('0x8')]('/api/integrations/salesforce/accounts',require(_0x829b('0x96')));_0x43c218[_0x829b('0x8')](_0x829b('0x97'),require(_0x829b('0x98')));_0x43c218['use'](_0x829b('0x99'),require('./api/intSalesforceField'));_0x43c218[_0x829b('0x8')](_0x829b('0x9a'),require(_0x829b('0x9b')));_0x43c218['use'](_0x829b('0x9c'),require(_0x829b('0x9d')));_0x43c218[_0x829b('0x8')]('/api/integrations/sugarcrm/fields',require(_0x829b('0x9e')));_0x43c218[_0x829b('0x8')](_0x829b('0x9f'),require(_0x829b('0xa0')));_0x43c218[_0x829b('0x8')]('/api/integrations/desk/configurations',require(_0x829b('0xa1')));_0x43c218[_0x829b('0x8')](_0x829b('0xa2'),require(_0x829b('0xa3')));_0x43c218['use'](_0x829b('0xa4'),require('./api/intZohoAccount'));_0x43c218[_0x829b('0x8')]('/api/integrations/zoho/configurations',require(_0x829b('0xa5')));_0x43c218[_0x829b('0x8')](_0x829b('0xa6'),require(_0x829b('0xa7')));_0x43c218['use'](_0x829b('0xa8'),require(_0x829b('0xa9')));_0x43c218['use'](_0x829b('0xaa'),require(_0x829b('0xab')));_0x43c218['use'](_0x829b('0xac'),require(_0x829b('0xad')));_0x43c218[_0x829b('0x8')](_0x829b('0xae'),require(_0x829b('0xaf')));_0x43c218[_0x829b('0x8')](_0x829b('0xb0'),require('./api/intFreshdeskConfiguration'));_0x43c218[_0x829b('0x8')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x43c218[_0x829b('0x8')](_0x829b('0xb1'),require(_0x829b('0xb2')));_0x43c218['use']('/api/integrations/vtiger/configurations',require(_0x829b('0xb3')));_0x43c218[_0x829b('0x8')]('/api/integrations/vtiger/fields',require(_0x829b('0xb4')));_0x43c218['use'](_0x829b('0xb5'),require(_0x829b('0xb6')));_0x43c218['use'](_0x829b('0xb7'),require('./api/intServicenowConfiguration'));_0x43c218[_0x829b('0x8')](_0x829b('0xb8'),require(_0x829b('0xb9')));_0x43c218[_0x829b('0x8')](_0x829b('0xba'),require(_0x829b('0xbb')));_0x43c218['use']('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x43c218[_0x829b('0x8')](_0x829b('0xbc'),require(_0x829b('0xbd')));_0x43c218[_0x829b('0x8')]('/api/integrations/freshsales/accounts',require(_0x829b('0xbe')));_0x43c218[_0x829b('0x8')](_0x829b('0xbf'),require(_0x829b('0xc0')));_0x43c218[_0x829b('0x8')](_0x829b('0xc1'),require(_0x829b('0xc2')));_0x43c218['use'](_0x829b('0xc3'),require('./api/network'));_0x43c218['use'](_0x829b('0xc4'),require(_0x829b('0xc5')));_0x43c218['use'](_0x829b('0xc6'),require(_0x829b('0xc7')));_0x43c218['use'](_0x829b('0xc8'),require('./api/jscriptyAnswerReport'));_0x43c218[_0x829b('0x8')](_0x829b('0xc9'),require(_0x829b('0xca')));_0x43c218[_0x829b('0x8')]('/api/jscripty/sessions/reports',require(_0x829b('0xcb')));_0x43c218[_0x829b('0x8')](_0x829b('0xcc'),require('./api/smsQueueReport'));_0x43c218[_0x829b('0x8')](_0x829b('0xcd'),require('./api/squareReport'));_0x43c218[_0x829b('0x8')](_0x829b('0xce'),require(_0x829b('0xcf')));_0x43c218[_0x829b('0x8')](_0x829b('0xd0'),require(_0x829b('0xd1')));_0x43c218['use']('/api/settings',require(_0x829b('0xd2')));_0x43c218[_0x829b('0x8')](_0x829b('0xd3'),require('./api/squareOdbc'));_0x43c218[_0x829b('0x8')](_0x829b('0xd4'),require('./api/squareProject'));_0x43c218[_0x829b('0x8')](_0x829b('0xd5'),require(_0x829b('0xd6')));_0x43c218[_0x829b('0x8')]('/api/square/messages',require(_0x829b('0xd7')));_0x43c218[_0x829b('0x8')](_0x829b('0xd8'),require(_0x829b('0xd9')));_0x43c218[_0x829b('0x8')](_0x829b('0xda'),require(_0x829b('0xdb')));_0x43c218[_0x829b('0x8')](_0x829b('0xdc'),require(_0x829b('0xdd')));_0x43c218[_0x829b('0x8')]('/api/migrations',require('./api/migration'));_0x43c218[_0x829b('0x8')](_0x829b('0xde'),require('./api/attachment'));_0x43c218['use'](_0x829b('0xdf'),require(_0x829b('0xe0')));_0x43c218[_0x829b('0x8')](_0x829b('0xe1'),require(_0x829b('0xe2')));_0x43c218[_0x829b('0x8')](_0x829b('0xe3'),require(_0x829b('0xe4')));_0x43c218[_0x829b('0x8')]('/api/fax/reports/transfer',require(_0x829b('0xe5')));_0x43c218[_0x829b('0x8')](_0x829b('0xe6'),require(_0x829b('0xe7')));_0x43c218['use'](_0x829b('0xe8'),require(_0x829b('0xe9')));_0x43c218[_0x829b('0x8')](_0x829b('0xea'),require(_0x829b('0xeb')));_0x43c218['use'](_0x829b('0xec'),require(_0x829b('0xed')));_0x43c218['use'](_0x829b('0xee'),require(_0x829b('0xef')));_0x43c218[_0x829b('0x8')]('/api/userProfile/sections',require(_0x829b('0xf0')));_0x43c218['use'](_0x829b('0xf1'),require(_0x829b('0xf2')));_0x43c218[_0x829b('0x8')](_0x829b('0xf3'),require(_0x829b('0xf4')));_0x43c218[_0x829b('0x8')](_0x829b('0xf5'),require('./api/whatsappAccount'));_0x43c218[_0x829b('0x8')](_0x829b('0xf6'),require('./api/whatsappApplication'));_0x43c218[_0x829b('0x8')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x43c218[_0x829b('0x8')](_0x829b('0xf7'),require(_0x829b('0xf8')));_0x43c218[_0x829b('0x8')](_0x829b('0xf9'),require(_0x829b('0xfa')));_0x43c218[_0x829b('0x8')](_0x829b('0xfb'),require('./api/whatsappTransferReport'));_0x43c218[_0x829b('0x8')]('/api/whatsapp/queues',require(_0x829b('0xfc')));_0x43c218[_0x829b('0x8')](_0x829b('0xfd'),require('./api/cloudProvider'));_0x43c218[_0x829b('0x8')]('/api/auth/local',require(_0x829b('0xfe')));_0x43c218[_0x829b('0x8')](_0x829b('0xff'),require('./api/authGoogle'));_0x43c218[_0x829b('0x8')]('/api/jira',require(_0x829b('0x100')));_0x43c218[_0x829b('0x8')](_0x829b('0x101'),require('./api/rpc'));_0x43c218[_0x829b('0x8')]('/api/version',require(_0x829b('0x102')));_0x43c218['use'](_0x829b('0x103'),require('./api/system'));_0x43c218[_0x829b('0x8')](_0x829b('0x104'),require(_0x829b('0x105')));_0x43c218[_0x829b('0x8')]('/api/webbar',require(_0x829b('0x106')));_0x43c218[_0x829b('0x8')](_0x829b('0x107'),express['static'](path[_0x829b('0x108')](config[_0x829b('0x109')],'/apidoc')));_0x43c218['use'](_0x829b('0x10a'),express['static'](path[_0x829b('0x108')](config['root'],_0x829b('0x10a'))));_0x43c218[_0x829b('0x8')](_0x829b('0x10b'),express[_0x829b('0x10c')](path['join'](config[_0x829b('0x109')],_0x829b('0x10b'))));_0x43c218[_0x829b('0x8')](_0x829b('0x10d'),express['static'](path['join'](config['root'],_0x829b('0x10e'),_0x829b('0x10f'))));_0x43c218[_0x829b('0x8')](_0x829b('0x110'),express[_0x829b('0x10c')](path[_0x829b('0x108')](config[_0x829b('0x109')],'/server/files/plugins')));_0x43c218[_0x829b('0x111')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x43c218['route']('/*')['get'](function(_0x35fed4,_0x687e68){_0x687e68[_0x829b('0x112')](path[_0x829b('0x113')](_0x43c218['get'](_0x829b('0x114'))+_0x829b('0x115')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 4cb0949..e3bf826 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae27=['../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/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/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.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/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xae27,0xf2));var _0x7ae2=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0xae27[_0x375492];return _0x18ba5b;};'use strict';var jayson=require(_0x7ae2('0x0'));var BPromise=require(_0x7ae2('0x1'));var _=require('lodash');var config=require('../config/environment');exports[_0x7ae2('0x2')]=function(){return new BPromise(function(_0x5e3ed7,_0x2ae55a){var _0x557b76={};_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x4')));_0x557b76=_['merge'](_0x557b76,require('../api/voiceExtension/voiceExtension.rpc'));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x5')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x6')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x7')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x8')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x9')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0xa')));_0x557b76=_['merge'](_0x557b76,require(_0x7ae2('0xb')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require('../api/trunk/trunk.rpc'));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0xc')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0xd')));_0x557b76=_['merge'](_0x557b76,require('../api/mailServerIn/mailServerIn.rpc'));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0xe')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require('../api/mailQueue/mailQueue.rpc'));_0x557b76=_['merge'](_0x557b76,require(_0x7ae2('0xf')));_0x557b76=_['merge'](_0x557b76,require('../api/mailMessage/mailMessage.rpc'));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x10')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x11')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x12')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x13')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x14')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x15')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x16')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x17')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x18')));_0x557b76=_['merge'](_0x557b76,require(_0x7ae2('0x19')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x1a')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x1b')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x1c')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x1d')));_0x557b76=_['merge'](_0x557b76,require(_0x7ae2('0x1e')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x1f')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x20')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x21')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x22')));_0x557b76=_['merge'](_0x557b76,require('../api/chatQueue/chatQueue.rpc'));_0x557b76=_['merge'](_0x557b76,require(_0x7ae2('0x23')));_0x557b76=_['merge'](_0x557b76,require(_0x7ae2('0x24')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x25')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x26')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x27')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x28')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require('../api/pause/pause.rpc'));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x29')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x2a')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x2b')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x2c')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x2d')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x2e')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x2f')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x30')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x31')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x32')));_0x557b76=_['merge'](_0x557b76,require(_0x7ae2('0x33')));_0x557b76=_['merge'](_0x557b76,require(_0x7ae2('0x34')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x35')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x36')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x37')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require('../api/squareReport/squareReport.rpc'));_0x557b76=_['merge'](_0x557b76,require(_0x7ae2('0x38')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x39')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x3a')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x3b')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x3c')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require('../api/campaign/campaign.rpc'));_0x557b76=_['merge'](_0x557b76,require(_0x7ae2('0x3d')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x3e')));_0x557b76=_['merge'](_0x557b76,require(_0x7ae2('0x3f')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x40')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x41')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x42')));_0x557b76=_[_0x7ae2('0x3')](_0x557b76,require(_0x7ae2('0x43')));var _0x1e6db3=jayson[_0x7ae2('0x44')](_0x557b76)[_0x7ae2('0x45')]();var _0x483467=config[_0x7ae2('0x46')][_0x7ae2('0x47')]||config[_0x7ae2('0x47')]+0x1;var _0xe9242b=config[_0x7ae2('0x46')]['ip']||_0x7ae2('0x48');_0x1e6db3['on']('error',function(_0x544531){return _0x2ae55a(_0x544531);});_0x1e6db3['listen'](_0x483467,_0xe9242b,function(){console[_0x7ae2('0x49')](_0x7ae2('0x4a'),_0xe9242b,_0x483467);require(_0x7ae2('0x4b'))['default']();return _0x5e3ed7(_0x7ae2('0x4c')+_0xe9242b+':'+_0x483467);});});}; \ No newline at end of file +var _0x4622=['../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc'];(function(_0x5bafd3,_0x474626){var _0x4aeb83=function(_0x4ab61a){while(--_0x4ab61a){_0x5bafd3['push'](_0x5bafd3['shift']());}};_0x4aeb83(++_0x474626);}(_0x4622,0xe2));var _0x2462=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x4622[_0x3cf4d3];return _0x4e547b;};'use strict';var jayson=require(_0x2462('0x0'));var BPromise=require(_0x2462('0x1'));var _=require(_0x2462('0x2'));var config=require(_0x2462('0x3'));exports['listen']=function(){return new BPromise(function(_0x2d7933,_0x5bd819){var _0x213f61={};_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/user/user.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/voiceExtension/voiceExtension.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x5')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x6')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x7')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x8')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x9')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0xa')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/trunk/trunk.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0xb')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0xc')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0xd')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0xe')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/mailInteraction/mailInteraction.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0xf')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x10')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x11')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x12')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x13')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x14')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x15')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x16')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/smsInteraction/smsInteraction.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x17')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x18')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x19')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x1a')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x1b')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x1c')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x1d')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/chatInteraction/chatInteraction.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/chatMessage/chatMessage.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x1e')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x1f')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x20')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x21')));_0x213f61=_['merge'](_0x213f61,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x22')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x23')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x24')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x25')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/sound/sound.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x26')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/trigger/trigger.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/variable/variable.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x27')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x28')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x29')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2a')));_0x213f61=_['merge'](_0x213f61,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2b')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2c')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2d')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2e')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x2f')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x30')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x31')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x32')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x33')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x34')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require('../api/squareMessage/squareMessage.rpc'));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x35')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x36')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x37')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x38')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x39')));_0x213f61=_[_0x2462('0x4')](_0x213f61,require(_0x2462('0x3a')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x3b')));_0x213f61=_['merge'](_0x213f61,require(_0x2462('0x3c')));var _0x504374=jayson[_0x2462('0x3d')](_0x213f61)[_0x2462('0x3e')]();var _0x543c97=config[_0x2462('0x3f')]['port']||config[_0x2462('0x40')]+0x1;var _0x59a39e=config['rpc']['ip']||'localhost';_0x504374['on'](_0x2462('0x41'),function(_0x2b3c8d){return _0x5bd819(_0x2b3c8d);});_0x504374[_0x2462('0x42')](_0x543c97,_0x59a39e,function(){console[_0x2462('0x43')](_0x2462('0x44'),_0x59a39e,_0x543c97);require('../config/triggers')['default']();return _0x2d7933(_0x2462('0x45')+_0x59a39e+':'+_0x543c97);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f68be93..5dd1217 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 _0xa6bb=['sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','getVariable','getvariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','line','toLowerCase','emit','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','log','command=','write','inherits','prototype','sendRequest','sync','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s'];(function(_0x5ec142,_0x2bf63f){var _0x17e35f=function(_0x3c20bf){while(--_0x3c20bf){_0x5ec142['push'](_0x5ec142['shift']());}};_0x17e35f(++_0x2bf63f);}(_0xa6bb,0x14e));var _0xba6b=function(_0x3096d0,_0xeea5af){_0x3096d0=_0x3096d0-0x0;var _0x557d26=_0xa6bb[_0x3096d0];return _0x557d26;};'use strict';var util=require(_0xba6b('0x0'));var _=require(_0xba6b('0x1'));var EventEmitter=require(_0xba6b('0x2'))[_0xba6b('0x3')];var AGIReply=require(_0xba6b('0x4'));var AGIError=require(_0xba6b('0x5'));function AGIChannel(_0x5494c7){var _0x206af4=this,_0x28df76=new AGIReply(),_0x279245=![],_0x430fcb={};EventEmitter[_0xba6b('0x6')](_0x206af4);_0x5494c7[_0xba6b('0x7')](_0xba6b('0x8'));_0x5494c7['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x28df76[_0xba6b('0x7')](_0xba6b('0x8'));_0x28df76['on'](_0xba6b('0x9'),function(_0xda2558){for(var _0x32f183 in _0xda2558){_0x206af4[_0x32f183]=_0xda2558[_0x32f183];}_0x206af4['emit']('ready');});_0x28df76['on'](_0xba6b('0xa'),function(_0x2661fb){if(_0x2661fb[_0xba6b('0xb')]()=='hangup'){_0x206af4[_0xba6b('0xc')](_0xba6b('0xd'));return;}if(_0x2661fb[_0xba6b('0xe')](0x0,0xb)=='520-Invalid'){_0x279245=!![];}if(_0x279245){_0x430fcb['rx']+=_0x2661fb+'\x0a';if(_0x2661fb[_0xba6b('0xf')](_0xba6b('0x10'))!=-0x1){_0x279245=![];}}else{_0x430fcb['rx']=_0x2661fb;}if(_0x279245){return;}if(typeof _0x430fcb['cb']==_0xba6b('0x11')){var _0x483467=_0x430fcb['rx'][_0xba6b('0xe')](0x0,0x3),_0x7c1141=null,_0x2aee4a=null;_0x483467=parseInt(_0x483467);if(isNaN(_0x483467)){_0x430fcb['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xba6b('0x12')});return;}if(_0x483467!=0xc8){_0x430fcb['cb'](null,{'code':_0x483467,'result':-0x1,'extra':'KO'});return;}_0x7c1141=_0x430fcb['rx'][_0xba6b('0xe')](0x4)[_0xba6b('0x13')](_0xba6b('0x14'),'');if(_0x7c1141[_0xba6b('0x15')]('\x20')!=-0x1){_0x7c1141=_0x7c1141[_0xba6b('0x16')](0x0,_0x7c1141[_0xba6b('0x15')]('\x20'));}if(_[_0xba6b('0x17')](_0x7c1141,'-1')){_0x7c1141=parseInt(_0x7c1141);}_0x2aee4a=_0x430fcb['rx'][_0xba6b('0x18')]('\x20');if(_0x2aee4a[_0xba6b('0x19')]==0x3){_0x2aee4a=_0x2aee4a[0x2][_0xba6b('0xe')](0x1,_0x2aee4a[0x2][_0xba6b('0x19')]-0x1);}else if(_0x2aee4a['length']>0x3){var _0x310572=/\((.+)\)/;var _0x321791=_0x430fcb['rx'][_0xba6b('0x1a')](_0x310572);if(_0x321791){_0x2aee4a=_0x321791[0x1];}else{_0x2aee4a=null;}}else{_0x2aee4a=null;}_0x430fcb['cb'](null,{'code':_0x483467,'result':_0x7c1141,'extra':_0x2aee4a});}});_0x5494c7['on'](_0xba6b('0x1b'),function(_0x5a5795){_0x206af4[_0xba6b('0xc')](_0xba6b('0x1b'),new AGIError('E_AGI_SOCKET_ERROR',_0x5a5795[_0xba6b('0x1c')]));});_0x5494c7['on'](_0xba6b('0x1d'),function(){_0x206af4[_0xba6b('0xc')](_0xba6b('0x1d'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x5494c7['on'](_0xba6b('0x1e'),function(){_0x206af4[_0xba6b('0xc')](_0xba6b('0x1e'),new AGIError(_0xba6b('0x1f')));_0x5494c7[_0xba6b('0x20')]();});_0x5494c7[_0xba6b('0x21')](_0x28df76);this['command']=function(_0x223e72,_0x26a4e9){console[_0xba6b('0x22')](_0xba6b('0x23'),_0x223e72);var _0x223e72=_0x223e72||'',_0x26a4e9=typeof _0x26a4e9==_0xba6b('0x11')?_0x26a4e9:new Function();_0x430fcb={'tx':_0x223e72,'rx':'','cb':_0x26a4e9};_0x5494c7[_0xba6b('0x24')](_0x223e72+'\x0a');},this[_0xba6b('0x1d')]=function(){_0x5494c7[_0xba6b('0x20')]();};}util[_0xba6b('0x25')](AGIChannel,EventEmitter);AGIChannel[_0xba6b('0x26')][_0xba6b('0x27')]=function(_0x436527){return this['command'][_0xba6b('0x28')](this,_0x436527);};AGIChannel['prototype']['answer']=function(){return this['sendRequest'](_0xba6b('0x29'));};AGIChannel['prototype']['getData']=function(_0x1fd1b4,_0x5d5b2c,_0x53a617){_0x1fd1b4=_0x1fd1b4===undefined?_0xba6b('0x2a'):_0x1fd1b4;_0x5d5b2c=_0x5d5b2c===undefined?'5':_0x5d5b2c;_0x53a617=_0x53a617===undefined?'1':_0x53a617;return this[_0xba6b('0x27')](util[_0xba6b('0x2b')](_0xba6b('0x2c'),_0x1fd1b4,_0x5d5b2c*0x3e8,_0x53a617));};AGIChannel['prototype'][_0xba6b('0x2d')]=function(_0x3ad690){_0x3ad690=_0x3ad690||'NO\x20MESSAGE';return this[_0xba6b('0x27')](util['format'](_0xba6b('0x2e'),_0x3ad690));};AGIChannel[_0xba6b('0x26')][_0xba6b('0x2f')]=function(_0x568ce1,_0x4518f3){if(_[_0xba6b('0x30')](_0x4518f3)){return this['sendRequest'](util['format'](_0xba6b('0x31'),_0x568ce1,_0x4518f3[_0xba6b('0x32')](',')));}return this[_0xba6b('0x27')](util['format'](_0xba6b('0x31'),_0x568ce1,_0x4518f3));};AGIChannel['prototype'][_0xba6b('0x33')]=function(_0x35cc38){return this[_0xba6b('0x27')](util[_0xba6b('0x2b')]('SET\x20CONTEXT\x20%s',_0x35cc38));};AGIChannel[_0xba6b('0x26')][_0xba6b('0x34')]=function(_0x349af4){return this['sendRequest'](util[_0xba6b('0x2b')](_0xba6b('0x35'),_0x349af4));};AGIChannel[_0xba6b('0x26')]['setPriority']=function(_0x241812){return this[_0xba6b('0x27')](util['format'](_0xba6b('0x36'),_0x241812));};AGIChannel[_0xba6b('0x26')][_0xba6b('0xd')]=function(){return this[_0xba6b('0x27')](_0xba6b('0x37'));};AGIChannel[_0xba6b('0x26')]['setVariable']=function(_0x302783,_0x410cf2){var _0x1f01f0=_['isBoolean'](_0x410cf2)||_['isNumber'](_0x410cf2)?_0x410cf2[_0xba6b('0x38')]():_0x410cf2;return this[_0xba6b('0x27')](util[_0xba6b('0x2b')](_0xba6b('0x39'),_0x302783,_0x1f01f0?_0x1f01f0[_0xba6b('0x38')]()[_0xba6b('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xba6b('0x26')]['sayNumber']=function(_0x4c2cb6,_0x4e9a90){return this[_0xba6b('0x27')](util[_0xba6b('0x2b')](_0xba6b('0x3a'),_0x4c2cb6,_0x4e9a90));};AGIChannel['prototype'][_0xba6b('0x3b')]=function(_0x31e5e3,_0x396560){return this[_0xba6b('0x27')](util['format'](_0xba6b('0x3c'),_0x31e5e3,_0x396560));};AGIChannel[_0xba6b('0x26')][_0xba6b('0x3d')]=function(_0x4e1adc,_0x173a31){return this[_0xba6b('0x27')](util[_0xba6b('0x2b')](_0xba6b('0x3e'),_0x4e1adc,_0x173a31));};AGIChannel[_0xba6b('0x26')][_0xba6b('0x3f')]=function(_0x4526e0,_0x48ac65,_0x11c00f){_0x48ac65=_0x48ac65||this[_0xba6b('0x40')];_0x11c00f=_0x11c00f||0x1;this[_0xba6b('0x33')](_0x4526e0);this[_0xba6b('0x34')](_0x48ac65);this[_0xba6b('0x41')](_0x11c00f);return this[_0xba6b('0x2d')](util[_0xba6b('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x4526e0,_0x48ac65,_0x11c00f));};AGIChannel[_0xba6b('0x26')][_0xba6b('0x42')]=function(_0x24a060){console['log'](_0xba6b('0x43'),_0x24a060);return this[_0xba6b('0x27')](util[_0xba6b('0x2b')]('GET\x20VARIABLE\x20\x22%s\x22',_0x24a060));};AGIChannel[_0xba6b('0x26')][_0xba6b('0x44')]=function(_0x2c264d,_0x18b230,_0x42a750,_0x3d6ee1,_0x2d4ce2,_0xc60bcb){_0x18b230=_0x18b230||_0xba6b('0x45');_0x42a750=_0x42a750||'';_0x3d6ee1=_0x3d6ee1===undefined?-0x1:_0x3d6ee1==='-1'?-0x1:_0x3d6ee1*0x3e8;_0x2d4ce2=_0x2d4ce2===undefined?'':'s='+_0x2d4ce2;_0xc60bcb=_0xc60bcb?_0xba6b('0x46'):'';return this[_0xba6b('0x27')](util[_0xba6b('0x2b')](_0xba6b('0x47'),_0x2c264d,_0x18b230,_0x42a750,_0x3d6ee1,_0xc60bcb,_0x2d4ce2));};AGIChannel['prototype'][_0xba6b('0x48')]=function(_0xe7acaa,_0x2094e4){_0x2094e4=_0x2094e4||'';return this[_0xba6b('0x27')](util[_0xba6b('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xe7acaa,_0x2094e4));};AGIChannel['prototype'][_0xba6b('0x49')]=function(_0x54f399){return this[_0xba6b('0x2f')](_0xba6b('0x4a'),_0x54f399);};AGIChannel['prototype'][_0xba6b('0x4b')]=function(_0x53d3a1){return this[_0xba6b('0x2f')](_0xba6b('0x4c'),_0x53d3a1);};AGIChannel[_0xba6b('0x26')][_0xba6b('0x1b')]=function(_0x1a1712,_0xf0ce06){this[_0xba6b('0x2d')](util['format'](_0xba6b('0x4d'),_0x1a1712['id'],_0x1a1712['label'],_0xf0ce06));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xba6b('0x4e')]=AGIChannel; \ No newline at end of file +var _0x9afc=['GOTO\x20%s\x20%s\x20%s','getvariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events','./reply','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','function','no\x20code','replace','result=','indexOf','substr','split','length','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','log','command=','write','prototype','answer','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension'];(function(_0x47fca4,_0x2d6451){var _0xb0abbe=function(_0x32c1df){while(--_0x32c1df){_0x47fca4['push'](_0x47fca4['shift']());}};_0xb0abbe(++_0x2d6451);}(_0x9afc,0xa7));var _0xc9af=function(_0x3252b1,_0x54e32d){_0x3252b1=_0x3252b1-0x0;var _0x5f189d=_0x9afc[_0x3252b1];return _0x5f189d;};'use strict';var util=require(_0xc9af('0x0'));var _=require(_0xc9af('0x1'));var EventEmitter=require(_0xc9af('0x2'))['EventEmitter'];var AGIReply=require(_0xc9af('0x3'));var AGIError=require('./error');function AGIChannel(_0x552d8f){var _0x4e3d74=this,_0x1696df=new AGIReply(),_0x267de2=![],_0x5421c9={};EventEmitter['call'](_0x4e3d74);_0x552d8f[_0xc9af('0x4')](_0xc9af('0x5'));_0x552d8f['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x1696df['setEncoding'](_0xc9af('0x5'));_0x1696df['on'](_0xc9af('0x6'),function(_0x9b3d4a){for(var _0x2e1372 in _0x9b3d4a){_0x4e3d74[_0x2e1372]=_0x9b3d4a[_0x2e1372];}_0x4e3d74[_0xc9af('0x7')](_0xc9af('0x8'));});_0x1696df['on'](_0xc9af('0x9'),function(_0x538599){if(_0x538599[_0xc9af('0xa')]()==_0xc9af('0xb')){_0x4e3d74[_0xc9af('0x7')]('hangup');return;}if(_0x538599[_0xc9af('0xc')](0x0,0xb)==_0xc9af('0xd')){_0x267de2=!![];}if(_0x267de2){_0x5421c9['rx']+=_0x538599+'\x0a';if(_0x538599['search']('520\x20End\x20of\x20proper')!=-0x1){_0x267de2=![];}}else{_0x5421c9['rx']=_0x538599;}if(_0x267de2){return;}if(typeof _0x5421c9['cb']==_0xc9af('0xe')){var _0x11f99b=_0x5421c9['rx'][_0xc9af('0xc')](0x0,0x3),_0x437d69=null,_0x304f1f=null;_0x11f99b=parseInt(_0x11f99b);if(isNaN(_0x11f99b)){_0x5421c9['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xc9af('0xf')});return;}if(_0x11f99b!=0xc8){_0x5421c9['cb'](null,{'code':_0x11f99b,'result':-0x1,'extra':'KO'});return;}_0x437d69=_0x5421c9['rx']['substring'](0x4)[_0xc9af('0x10')](_0xc9af('0x11'),'');if(_0x437d69[_0xc9af('0x12')]('\x20')!=-0x1){_0x437d69=_0x437d69[_0xc9af('0x13')](0x0,_0x437d69[_0xc9af('0x12')]('\x20'));}if(_['startsWith'](_0x437d69,'-1')){_0x437d69=parseInt(_0x437d69);}_0x304f1f=_0x5421c9['rx'][_0xc9af('0x14')]('\x20');if(_0x304f1f[_0xc9af('0x15')]==0x3){_0x304f1f=_0x304f1f[0x2][_0xc9af('0xc')](0x1,_0x304f1f[0x2][_0xc9af('0x15')]-0x1);}else if(_0x304f1f[_0xc9af('0x15')]>0x3){var _0x391b92=/\((.+)\)/;var _0x2ab015=_0x5421c9['rx']['match'](_0x391b92);if(_0x2ab015){_0x304f1f=_0x2ab015[0x1];}else{_0x304f1f=null;}}else{_0x304f1f=null;}_0x5421c9['cb'](null,{'code':_0x11f99b,'result':_0x437d69,'extra':_0x304f1f});}});_0x552d8f['on'](_0xc9af('0x16'),function(_0x46a715){_0x4e3d74['emit']('error',new AGIError(_0xc9af('0x17'),_0x46a715['code']));});_0x552d8f['on'](_0xc9af('0x18'),function(){_0x4e3d74[_0xc9af('0x7')](_0xc9af('0x18'),new AGIError(_0xc9af('0x19')));});_0x552d8f['on'](_0xc9af('0x1a'),function(){_0x4e3d74[_0xc9af('0x7')](_0xc9af('0x1a'),new AGIError(_0xc9af('0x1b')));_0x552d8f[_0xc9af('0x1c')]();});_0x552d8f[_0xc9af('0x1d')](_0x1696df);this[_0xc9af('0x1e')]=function(_0x2f56f2,_0x514c23){console[_0xc9af('0x1f')](_0xc9af('0x20'),_0x2f56f2);var _0x2f56f2=_0x2f56f2||'',_0x514c23=typeof _0x514c23==_0xc9af('0xe')?_0x514c23:new Function();_0x5421c9={'tx':_0x2f56f2,'rx':'','cb':_0x514c23};_0x552d8f[_0xc9af('0x21')](_0x2f56f2+'\x0a');},this['close']=function(){_0x552d8f['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xc9af('0x22')]['sendRequest']=function(_0xaca168){return this[_0xc9af('0x1e')]['sync'](this,_0xaca168);};AGIChannel[_0xc9af('0x22')][_0xc9af('0x23')]=function(){return this[_0xc9af('0x24')](_0xc9af('0x25'));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x26')]=function(_0xa7f5a1,_0x3a6fe5,_0x15c25d){_0xa7f5a1=_0xa7f5a1===undefined?_0xc9af('0x27'):_0xa7f5a1;_0x3a6fe5=_0x3a6fe5===undefined?'5':_0x3a6fe5;_0x15c25d=_0x15c25d===undefined?'1':_0x15c25d;return this[_0xc9af('0x24')](util['format'](_0xc9af('0x28'),_0xa7f5a1,_0x3a6fe5*0x3e8,_0x15c25d));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x29')]=function(_0x470e39){_0x470e39=_0x470e39||_0xc9af('0x2a');return this[_0xc9af('0x24')](util[_0xc9af('0x2b')]('VERBOSE\x20\x22%s\x22',_0x470e39));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x2c')]=function(_0x3aa076,_0x22a265){if(_['isArray'](_0x22a265)){return this[_0xc9af('0x24')](util[_0xc9af('0x2b')]('EXEC\x20%s\x20%s',_0x3aa076,_0x22a265[_0xc9af('0x2d')](',')));}return this['sendRequest'](util[_0xc9af('0x2b')](_0xc9af('0x2e'),_0x3aa076,_0x22a265));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x2f')]=function(_0x5e88fa){return this['sendRequest'](util[_0xc9af('0x2b')](_0xc9af('0x30'),_0x5e88fa));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x31')]=function(_0x4a49d6){return this['sendRequest'](util[_0xc9af('0x2b')]('SET\x20EXTENSION\x20%s',_0x4a49d6));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x32')]=function(_0x214756){return this[_0xc9af('0x24')](util[_0xc9af('0x2b')](_0xc9af('0x33'),_0x214756));};AGIChannel[_0xc9af('0x22')]['hangup']=function(){return this[_0xc9af('0x24')](_0xc9af('0x34'));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x35')]=function(_0x3aa4db,_0xcf4776){var _0x29d3ff=_['isBoolean'](_0xcf4776)||_[_0xc9af('0x36')](_0xcf4776)?_0xcf4776[_0xc9af('0x37')]():_0xcf4776;return this[_0xc9af('0x24')](util[_0xc9af('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3aa4db,_0x29d3ff?_0x29d3ff[_0xc9af('0x37')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x38')]=function(_0x24626a,_0x4b05fb){return this[_0xc9af('0x24')](util['format'](_0xc9af('0x39'),_0x24626a,_0x4b05fb));};AGIChannel['prototype'][_0xc9af('0x3a')]=function(_0x21049f,_0x45d94e){return this[_0xc9af('0x24')](util[_0xc9af('0x2b')](_0xc9af('0x3b'),_0x21049f,_0x45d94e));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x3c')]=function(_0x3855b0,_0x2a2dc1){return this[_0xc9af('0x24')](util[_0xc9af('0x2b')](_0xc9af('0x3d'),_0x3855b0,_0x2a2dc1));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x3e')]=function(_0x57aff5,_0x1693ef,_0x5f5d28){_0x1693ef=_0x1693ef||this[_0xc9af('0x3f')];_0x5f5d28=_0x5f5d28||0x1;this[_0xc9af('0x2f')](_0x57aff5);this['setExtension'](_0x1693ef);this[_0xc9af('0x32')](_0x5f5d28);return this['noop'](util['format'](_0xc9af('0x40'),_0x57aff5,_0x1693ef,_0x5f5d28));};AGIChannel['prototype']['getVariable']=function(_0x55a215){console[_0xc9af('0x1f')](_0xc9af('0x41'),_0x55a215);return this[_0xc9af('0x24')](util['format'](_0xc9af('0x42'),_0x55a215));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x43')]=function(_0x209fa8,_0x38430c,_0x31528f,_0xd50cfe,_0x395d38,_0xe4a1c7){_0x38430c=_0x38430c||_0xc9af('0x44');_0x31528f=_0x31528f||'';_0xd50cfe=_0xd50cfe===undefined?-0x1:_0xd50cfe==='-1'?-0x1:_0xd50cfe*0x3e8;_0x395d38=_0x395d38===undefined?'':'s='+_0x395d38;_0xe4a1c7=_0xe4a1c7?_0xc9af('0x45'):'';return this[_0xc9af('0x24')](util[_0xc9af('0x2b')](_0xc9af('0x46'),_0x209fa8,_0x38430c,_0x31528f,_0xd50cfe,_0xe4a1c7,_0x395d38));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x47')]=function(_0x540975,_0x4700b4){_0x4700b4=_0x4700b4||'';return this[_0xc9af('0x24')](util[_0xc9af('0x2b')](_0xc9af('0x48'),_0x540975,_0x4700b4));};AGIChannel[_0xc9af('0x22')][_0xc9af('0x49')]=function(_0x3e23f9){return this['exec']('AGI',_0x3e23f9);};AGIChannel[_0xc9af('0x22')]['wait']=function(_0x5af153){return this[_0xc9af('0x2c')](_0xc9af('0x4a'),_0x5af153);};AGIChannel[_0xc9af('0x22')][_0xc9af('0x16')]=function(_0x3724db,_0x1c4645){this[_0xc9af('0x29')](util[_0xc9af('0x2b')](_0xc9af('0x4b'),_0x3724db['id'],_0x3724db['label'],_0x1c4645));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xc9af('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index fadb998..570f659 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 _0x6655=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports','util','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x249c64,_0x421f9a){var _0x52be10=function(_0x94a670){while(--_0x94a670){_0x249c64['push'](_0x249c64['shift']());}};_0x52be10(++_0x421f9a);}(_0x6655,0x193));var _0x5665=function(_0x506538,_0x2fe4f7){_0x506538=_0x506538-0x0;var _0x360146=_0x6655[_0x506538];return _0x360146;};'use strict';var util=require(_0x5665('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':_0x5665('0x1'),'E_AGI_SERVER_VOICE_DISABLED':_0x5665('0x2'),'E_AGI_SOCKET_ERROR':_0x5665('0x3'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x5665('0x4'),'E_AGI_IVR_ENTRY':_0x5665('0x5')};function AGIError(_0x4b3985){var _0x4b3985=_0x4b3985||null,_0x1e0c75=_0x1e0c75||[],_0x50b1f8=0x1,_0x4950db='';if(!error[_0x4b3985]){_0x4b3985=_0x5665('0x6');}_0x1e0c75[_0x5665('0x7')](error[_0x4b3985]);while(arguments[_0x50b1f8]){_0x1e0c75[_0x5665('0x7')](arguments[_0x50b1f8]);_0x50b1f8++;}_0x4950db=util[_0x5665('0x8')]['apply'](util,_0x1e0c75);this[_0x5665('0x9')]=_0x4950db;this[_0x5665('0xa')]=_0x4b3985;}module[_0x5665('0xb')]=AGIError; \ No newline at end of file +var _0xcd56=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','push','format','apply','message','name','exports','util','Undefined\x20error.'];(function(_0x53d3b0,_0x62aa42){var _0x44f608=function(_0x47f276){while(--_0x47f276){_0x53d3b0['push'](_0x53d3b0['shift']());}};_0x44f608(++_0x62aa42);}(_0xcd56,0x1c9));var _0x6cd5=function(_0x5a166f,_0x8db7d6){_0x5a166f=_0x5a166f-0x0;var _0x5befe7=_0xcd56[_0x5a166f];return _0x5befe7;};'use strict';var util=require(_0x6cd5('0x0'));var error={'E_AGI_UNDEFINED':_0x6cd5('0x1'),'E_AGI_ARGUMENT_PORT':_0x6cd5('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x6cd5('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x6cd5('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x6cd5('0x5'),'E_AGI_SOCKET_ERROR':_0x6cd5('0x6'),'E_AGI_SOCKET_CLOSE':_0x6cd5('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x6cd5('0x8'),'E_AGI_COMMAND_EMPTY':_0x6cd5('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6cd5('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0xdc5d4f){var _0xdc5d4f=_0xdc5d4f||null,_0x1c4af9=_0x1c4af9||[],_0x25e9a3=0x1,_0x589bf9='';if(!error[_0xdc5d4f]){_0xdc5d4f='E_AGI_UNDEFINED';}_0x1c4af9[_0x6cd5('0xb')](error[_0xdc5d4f]);while(arguments[_0x25e9a3]){_0x1c4af9[_0x6cd5('0xb')](arguments[_0x25e9a3]);_0x25e9a3++;}_0x589bf9=util[_0x6cd5('0xc')][_0x6cd5('0xd')](util,_0x1c4af9);this[_0x6cd5('0xe')]=_0x589bf9;this[_0x6cd5('0xf')]=_0xdc5d4f;}module[_0x6cd5('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c489fc9..5cdb6db 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 _0x5423=['length','no\x20edge/s\x20available','condition','agicommand','vswitch','target','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','menu','getdigits','vertices','edges','numberOfEdges','prototype','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse'];(function(_0x2f04bd,_0x2db22c){var _0x506d48=function(_0x194fa2){while(--_0x194fa2){_0x2f04bd['push'](_0x2f04bd['shift']());}};_0x506d48(++_0x2db22c);}(_0x5423,0xe3));var _0x3542=function(_0x580bc6,_0xa1f79b){_0x580bc6=_0x580bc6-0x0;var _0xca0497=_0x5423[_0x580bc6];return _0xca0497;};'use strict';var _=require(_0x3542('0x0'));var logger=require(_0x3542('0x1'))('agi');var verticesWithRetry=[_0x3542('0x2'),_0x3542('0x3'),'getsecretdigits'];var Graph=function(){this[_0x3542('0x4')]={};this[_0x3542('0x5')]={};this[_0x3542('0x6')]=0x0;};Graph[_0x3542('0x7')]['addVertex']=function(_0x8ba9d5){this[_0x3542('0x4')][_0x8ba9d5['id']]=_0x8ba9d5;this[_0x3542('0x5')][_0x8ba9d5['id']]=[];};Graph[_0x3542('0x7')][_0x3542('0x8')]=function(_0x55413c,_0x4cdc86,_0xbc51ab){this[_0x3542('0x5')][_0x55413c]['push']({'target':_0x4cdc86,'condition':_0xbc51ab});this[_0x3542('0x6')]+=0x1;};Graph[_0x3542('0x7')]['size']=function(){return _[_0x3542('0x9')](this[_0x3542('0x4')]);};Graph['prototype'][_0x3542('0xa')]=function(){return this[_0x3542('0x6')];};Graph[_0x3542('0x7')][_0x3542('0xb')]=function(_0x471ea0){return this[_0x3542('0x4')][_0x471ea0];};Graph[_0x3542('0x7')][_0x3542('0xc')]=function(_0x4ee86,_0x1a9062){if(!this[_0x3542('0x4')][_0x4ee86]){return logger[_0x3542('0xd')](_0x3542('0xe'));}var _0x4bac5b=_0x1a9062(this[_0x3542('0x4')][_0x4ee86]);if(!_0x4bac5b){return logger['info'](_0x3542('0xf'));}if(this[_0x3542('0x5')][_0x4ee86][_0x3542('0x10')]===0x0){return logger['info'](_0x3542('0x11'));}for(var _0x177fb9=0x0,_0x347ac8=[],_0x5726af=![];_0x177fb9\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','hangup','sync','production','SQUAREROOT','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','start','clear','vertex','gotoc','context','extension','priority','vresponse','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','traverseBFS','[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','close','Project\x20%s\x20not\x20found','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','../../config/environment','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[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','toJson','agicommand','hasOwnProperty','maxRetry','addVertex','omit','mxCell','length','source'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x4a6ff0,_0x30ba8a){_0x4a6ff0=_0x4a6ff0-0x0;var _0x4f2db0=_0x4c4d[_0x4a6ff0];return _0x4f2db0;};'use strict';var parser=require(_0xd4c4('0x0'));var _=require('lodash');var syncho=require('syncho');var util=require('util');var moment=require('moment');var config=require(_0xd4c4('0x1'));var logger=require('../../config/logger')(_0xd4c4('0x2'));var utilLicense=require(_0xd4c4('0x3'));var rpc=require(_0xd4c4('0x4'));var mailRpc=require(_0xd4c4('0x5'));var Graph=require(_0xd4c4('0x6'));var Vertices=require(_0xd4c4('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xd4c4('0x8')](config[_0xd4c4('0x2')],{'ip':_0xd4c4('0x9'),'port':0x11dd});function connectionHandler(_0xbe6e8d){process[_0xd4c4('0xa')](function(){syncho(function(){try{setChannelVariables(_0xbe6e8d);agiHandler(_0xbe6e8d);}catch(_0x512f57){logger[_0xd4c4('0xb')](_0x512f57[_0xd4c4('0xc')]);}});});}function listeningHandler(){console[_0xd4c4('0xd')](_0xd4c4('0xe'),config[_0xd4c4('0x2')][_0xd4c4('0xf')]);logger[_0xd4c4('0x10')](util[_0xd4c4('0x11')](_0xd4c4('0x12'),config['agi']['ip'],config[_0xd4c4('0x2')]['port']));}function errorHandler(_0xcb859d){if(_0xcb859d&&_0xcb859d[_0xd4c4('0x13')]&&_0xcb859d['message']){logger[_0xd4c4('0xb')](util['format']('[%s]\x20%s',_0xcb859d['name'],_0xcb859d['message']));}else{logger[_0xd4c4('0xb')](util[_0xd4c4('0x11')]('[ERROR]\x20%s',_0xcb859d[_0xd4c4('0xc')]));}}function closeHandler(){logger[_0xd4c4('0x10')](util[_0xd4c4('0x11')](_0xd4c4('0x14'),this[_0xd4c4('0x15')],this[_0xd4c4('0x16')],this[_0xd4c4('0x17')],this[_0xd4c4('0x18')],this[_0xd4c4('0x19')]));try{createSquareReport(this);}catch(_0x4d6e3b){logger['error'](_0x4d6e3b[_0xd4c4('0xc')]);}}function timeoutHandler(){logger[_0xd4c4('0x10')](util[_0xd4c4('0x11')](_0xd4c4('0x1a'),this[_0xd4c4('0x15')],this['calleridname'],this[_0xd4c4('0x17')],this['dnid'],this[_0xd4c4('0x19')]));}function hangupHandler(){logger[_0xd4c4('0x10')](util['format'](_0xd4c4('0x1b'),this[_0xd4c4('0x15')],this['calleridname'],this[_0xd4c4('0x17')],this[_0xd4c4('0x18')],this[_0xd4c4('0x19')]));this['evtHangup']=!![];}function getRoot(_0x29ea89){return parser[_0xd4c4('0x1c')](_0x29ea89,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x199011,_0x35ad56,_0x4f79b5){_0x35ad56[_0xd4c4('0x1d')]=_0x4f79b5;if(_0x35ad56[_0xd4c4('0x1e')]('retry')){_0x35ad56[_0xd4c4('0x1f')]=parseInt(_0x35ad56['retry'],0xa);}_0x199011[_0xd4c4('0x20')](_[_0xd4c4('0x21')](_0x35ad56,_0xd4c4('0x22')));}function initGraph(_0x5f48a1,_0x1c301b){var _0x5cc6fe=new Graph();for(var _0x491417 in _0x5f48a1){if(_0x5f48a1[_0xd4c4('0x1e')](_0x491417)){if(_['isArray'](_0x5f48a1[_0x491417])){for(var _0x538899=0x0;_0x538899<_0x5f48a1[_0x491417]['length'];_0x538899+=0x1){addVertex(_0x5cc6fe,_0x5f48a1[_0x491417][_0x538899],_0x491417);}}else{addVertex(_0x5cc6fe,_0x5f48a1[_0x491417],_0x491417);}}}for(var _0x5ef28e=0x0;_0x5ef28e<_0x1c301b[_0xd4c4('0x23')];_0x5ef28e+=0x1){if(_0x1c301b[_0x5ef28e][_0xd4c4('0x24')]&&_0x1c301b[_0x5ef28e][_0xd4c4('0x25')]){_0x5cc6fe['addEdge'](_0x1c301b[_0x5ef28e]['source'],_0x1c301b[_0x5ef28e][_0xd4c4('0x25')],_0x1c301b[_0x5ef28e][_0xd4c4('0x26')]);}}return _0x5cc6fe;}function getSquareProject(_0x30dfb8,_0x453399){rpc[_0xd4c4('0x27')](_0x30dfb8)['then'](function(_0x26270d){_0x453399(null,_0x26270d);})[_0xd4c4('0x28')](function(_0x4d48bb){_0x453399(null,_0x4d48bb);});}function createSquareReport(_0x5bf9eb,_0x561e41){rpc[_0xd4c4('0x29')](_0x5bf9eb)['then'](function(_0x1c6b2e){if(_0x561e41){_0x561e41(null,_0x1c6b2e);}})['catch'](function(_0x3333cb){if(_0x561e41){_0x561e41(null,_0x3333cb);}});}function setChannelVariables(_0x5da0bc){for(var _0x3d8329 in _0x5da0bc){if(_0x5da0bc[_0xd4c4('0x1e')](_0x3d8329)){if(_0x3d8329[_0xd4c4('0x2a')](_0xd4c4('0x2b'))===0x0){_0x5da0bc[_0x3d8329[_0xd4c4('0x2c')](0x4)]=_0x5da0bc[_0x3d8329];delete _0x5da0bc[_0x3d8329];}}}}function getLogFromObject(_0x230ec8){return util[_0xd4c4('0x2d')](_0x230ec8,{'showHidden':![],'depth':null});}function agiHandler(_0x4a4be1){var _0x5238e4,_0xd89ae6,_0x3fd903,_0x255b29,_0x266807;logger['debug']('variables',JSON[_0xd4c4('0x2e')](_0x4a4be1,null,0x2));logger['info'](util['format'](_0xd4c4('0x2f'),_0x4a4be1[_0xd4c4('0x15')],_0x4a4be1[_0xd4c4('0x16')],_0x4a4be1['callerid'],_0x4a4be1['dnid'],_0x4a4be1[_0xd4c4('0x19')]));_0x4a4be1['on']('error',errorHandler);_0x4a4be1['on']('close',closeHandler);_0x4a4be1['on'](_0xd4c4('0x30'),timeoutHandler);_0x4a4be1[_0xd4c4('0x31')]=![];_0x4a4be1['on'](_0xd4c4('0x32'),hangupHandler);var _0x328560=getSquareProject[_0xd4c4('0x33')](null,_0x4a4be1['arg_1']);if(_0x328560){if(_0x328560[_0xd4c4('0x34')]){_0x5238e4=getRoot(_0x328560[_0xd4c4('0x34')]);console[_0xd4c4('0xd')](_0xd4c4('0x35'),_0x5238e4);if(_0x5238e4&&_0x5238e4['start']){logger[_0xd4c4('0x36')]('root',JSON[_0xd4c4('0x2e')](_0x5238e4,null,0x2));_0x4a4be1[_0xd4c4('0x37')]=moment()['format'](_0xd4c4('0x38'));_0xd89ae6=initGraph(_['omit'](_0x5238e4,_0xd4c4('0x22')),_0x5238e4['mxCell']);_0x3fd903=new Vertices(_0x4a4be1,rpc,mailRpc);console[_0xd4c4('0xd')](_0xd4c4('0x39'),_0x3fd903);logger[_0xd4c4('0x10')](util[_0xd4c4('0x11')](_0xd4c4('0x3a'),_0x4a4be1[_0xd4c4('0x15')],_0x4a4be1[_0xd4c4('0x16')],_0x4a4be1[_0xd4c4('0x17')],_0x4a4be1['dnid'],_0x4a4be1[_0xd4c4('0x19')]));console[_0xd4c4('0xd')](_0xd4c4('0x3b'));_0xd89ae6['traverseBFS'](_0x5238e4[_0xd4c4('0x3c')]['id'],function(_0x360d7c){try{_0x360d7c=_0x3fd903[_0xd4c4('0x3d')](_0x360d7c);logger[_0xd4c4('0x36')](_0xd4c4('0x3e'),JSON[_0xd4c4('0x2e')](_0x360d7c,null,0x2));console['log']('VERTEX',_0x360d7c);if(_0x360d7c[_0xd4c4('0x1d')]===_0xd4c4('0x3f')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4a4be1[_0xd4c4('0x40')]=_0x360d7c['context']||_0x4a4be1[_0xd4c4('0x40')];_0x4a4be1['extension']=_0x360d7c[_0xd4c4('0x41')];_0x4a4be1[_0xd4c4('0x42')]=_0x360d7c[_0xd4c4('0x42')]?_0x360d7c[_0xd4c4('0x42')]-0x1:0x1;return null;}else if(_0x360d7c&&_0x3fd903[_0x360d7c[_0xd4c4('0x1d')]]){_0x266807=_0x3fd903[_0x360d7c[_0xd4c4('0x1d')]](_0x360d7c);console[_0xd4c4('0xd')](_0xd4c4('0x43'),_0x266807);logger[_0xd4c4('0x10')](_0xd4c4('0x44'),JSON[_0xd4c4('0x2e')](_0x266807,null,0x2));if(_0x266807&&_0x266807[_0xd4c4('0x45')]===AGI_CODE_SUCCESS&&_0x266807[_0xd4c4('0x46')]!==AGI_RESULT_ERROR&&!_0x4a4be1[_0xd4c4('0x31')]){logger[_0xd4c4('0x36')](_0xd4c4('0x44'),getLogFromObject(_0x266807));return _[_0xd4c4('0x47')](_0x266807[_0xd4c4('0x46')])?null:_0x266807[_0xd4c4('0x46')][_0xd4c4('0x48')]();}else{logger['error'](_0xd4c4('0x44'),getLogFromObject(_0x266807));return null;}}else{logger[_0xd4c4('0xb')](_0xd4c4('0x49'));return null;}}catch(_0x1fa421){logger[_0xd4c4('0xb')](_0x1fa421[_0xd4c4('0xc')]);return null;}});if(_0x5238e4[_0xd4c4('0x4a')]){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4a4be1[_0xd4c4('0x15')],_0x4a4be1[_0xd4c4('0x16')],_0x4a4be1[_0xd4c4('0x17')],_0x4a4be1[_0xd4c4('0x18')],_0x4a4be1[_0xd4c4('0x19')]));_0xd89ae6[_0xd4c4('0x4b')](_0x5238e4[_0xd4c4('0x4a')]['id'],function(_0x27d36b){try{_0x27d36b=_0x3fd903['clear'](_0x27d36b);logger['debug'](_0xd4c4('0x3e'),JSON[_0xd4c4('0x2e')](_0x27d36b,null,0x2));if(_0x27d36b&&_0x3fd903[_0x27d36b[_0xd4c4('0x1d')]]){_0x266807=_0x3fd903[_0x27d36b['agicommand']](_0x27d36b);if(_0x266807){logger[_0xd4c4('0x36')](_0xd4c4('0x44'),getLogFromObject(_0x266807));return _[_0xd4c4('0x47')](_0x266807[_0xd4c4('0x46')])?null:_0x266807[_0xd4c4('0x46')]['toString']();}else{logger[_0xd4c4('0xb')](_0xd4c4('0x44'),getLogFromObject(_0x266807));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x17de9d){logger['error'](_0x17de9d[_0xd4c4('0xc')]);return null;}});}logger['info'](util[_0xd4c4('0x11')](_0xd4c4('0x4c'),_0x4a4be1['arg_1'],_0x4a4be1[_0xd4c4('0x16')],_0x4a4be1[_0xd4c4('0x17')],_0x4a4be1[_0xd4c4('0x18')],_0x4a4be1[_0xd4c4('0x19')]));logger[_0xd4c4('0x10')](util[_0xd4c4('0x11')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4a4be1[_0xd4c4('0x40')],_0x4a4be1['extension'],parseInt(_0x4a4be1[_0xd4c4('0x42')],0xa)+0x1));_0x4a4be1[_0xd4c4('0x4d')](_0x4a4be1[_0xd4c4('0x40')],_0x4a4be1[_0xd4c4('0x41')],parseInt(_0x4a4be1[_0xd4c4('0x42')],0xa)+0x1);_0x4a4be1['close']();}}else{logger[_0xd4c4('0xb')](util['format'](_0xd4c4('0x4e'),_0x4a4be1[_0xd4c4('0x15')]));_0x4a4be1['continueAt'](_0x4a4be1['context'],_0x4a4be1[_0xd4c4('0x41')],parseInt(_0x4a4be1[_0xd4c4('0x42')],0xa)+0x1);_0x4a4be1[_0xd4c4('0x4f')]();}}else{logger[_0xd4c4('0xb')](util[_0xd4c4('0x11')](_0xd4c4('0x50'),_0x4a4be1[_0xd4c4('0x15')]));_0x4a4be1[_0xd4c4('0x4d')](_0x4a4be1[_0xd4c4('0x40')],_0x4a4be1[_0xd4c4('0x41')],parseInt(_0x4a4be1[_0xd4c4('0x42')],0xa)+0x1);_0x4a4be1[_0xd4c4('0x4f')]();}}function main(){var _0x15860e;return utilLicense[_0xd4c4('0x51')]()[_0xd4c4('0x52')](function(_0x1c7b1b){if(_0x1c7b1b){if(_0x1c7b1b[_0xd4c4('0x53')]){if(_0x1c7b1b[_0xd4c4('0x54')]&&_0x1c7b1b['callysquare']>0x0){logger[_0xd4c4('0x10')](util[_0xd4c4('0x11')](_0xd4c4('0x55'),_0x1c7b1b[_0xd4c4('0x54')]));_0x15860e=_0x1c7b1b[_0xd4c4('0x54')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0xd4c4('0x56'));_0x15860e=-0x1;}}})[_0xd4c4('0x28')](function(_0x30b1bc){logger['error'](_0xd4c4('0x57'),_0x30b1bc[_0xd4c4('0xc')]);})[_0xd4c4('0x4a')](function(){var _0x41e4ed=require(_0xd4c4('0x58'))(config[_0xd4c4('0x2')][_0xd4c4('0xf')],config[_0xd4c4('0x2')]['ip'],_0x15860e);_0x41e4ed['on'](_0xd4c4('0xb'),errorHandler);_0x41e4ed['on'](_0xd4c4('0x59'),listeningHandler);_0x41e4ed['on'](_0xd4c4('0x5a'),connectionHandler);_0x41e4ed['on'](_0xd4c4('0x4f'),closeHandler);});}main(); \ No newline at end of file +var _0xfb71=['[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','connection','xml2json','lodash','syncho','util','moment','agi','../../config/license/util','./rpc','./graph','./vertices','defaults','127.0.0.1','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','name','message','error','format','[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','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','hasOwnProperty','retry','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','SQUAREROOT','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','start','vertex','VERTEX','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','vresponse','code','result','response','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','[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'];(function(_0x53e725,_0x1cbc83){var _0x5de8e2=function(_0x3670fa){while(--_0x3670fa){_0x53e725['push'](_0x53e725['shift']());}};_0x5de8e2(++_0x1cbc83);}(_0xfb71,0x1ef));var _0x1fb7=function(_0xa60933,_0x3e8b86){_0xa60933=_0xa60933-0x0;var _0x4c62b7=_0xfb71[_0xa60933];return _0x4c62b7;};'use strict';var parser=require(_0x1fb7('0x0'));var _=require(_0x1fb7('0x1'));var syncho=require(_0x1fb7('0x2'));var util=require(_0x1fb7('0x3'));var moment=require(_0x1fb7('0x4'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x1fb7('0x5'));var utilLicense=require(_0x1fb7('0x6'));var rpc=require(_0x1fb7('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0x1fb7('0x8'));var Vertices=require(_0x1fb7('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1fb7('0x5')]=_[_0x1fb7('0xa')](config[_0x1fb7('0x5')],{'ip':_0x1fb7('0xb'),'port':0x11dd});function connectionHandler(_0x4abac2){process[_0x1fb7('0xc')](function(){syncho(function(){try{setChannelVariables(_0x4abac2);agiHandler(_0x4abac2);}catch(_0x1a9e9e){logger['error'](_0x1a9e9e[_0x1fb7('0xd')]);}});});}function listeningHandler(){console[_0x1fb7('0xe')](_0x1fb7('0xf'),config[_0x1fb7('0x5')][_0x1fb7('0x10')]);logger[_0x1fb7('0x11')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x1fb7('0x5')]['ip'],config[_0x1fb7('0x5')][_0x1fb7('0x10')]));}function errorHandler(_0x55f8ae){if(_0x55f8ae&&_0x55f8ae[_0x1fb7('0x12')]&&_0x55f8ae[_0x1fb7('0x13')]){logger[_0x1fb7('0x14')](util['format']('[%s]\x20%s',_0x55f8ae[_0x1fb7('0x12')],_0x55f8ae['message']));}else{logger['error'](util[_0x1fb7('0x15')]('[ERROR]\x20%s',_0x55f8ae[_0x1fb7('0xd')]));}}function closeHandler(){logger[_0x1fb7('0x11')](util[_0x1fb7('0x15')](_0x1fb7('0x16'),this[_0x1fb7('0x17')],this[_0x1fb7('0x18')],this[_0x1fb7('0x19')],this[_0x1fb7('0x1a')],this[_0x1fb7('0x1b')]));try{createSquareReport(this);}catch(_0x57387e){logger[_0x1fb7('0x14')](_0x57387e[_0x1fb7('0xd')]);}}function timeoutHandler(){logger[_0x1fb7('0x11')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1fb7('0x17')],this[_0x1fb7('0x18')],this[_0x1fb7('0x19')],this[_0x1fb7('0x1a')],this[_0x1fb7('0x1b')]));}function hangupHandler(){logger['info'](util['format'](_0x1fb7('0x1c'),this[_0x1fb7('0x17')],this['calleridname'],this[_0x1fb7('0x19')],this[_0x1fb7('0x1a')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x3c47be){return parser[_0x1fb7('0x1d')](_0x3c47be,{'object':!![]})[_0x1fb7('0x1e')][_0x1fb7('0x1f')];}function addVertex(_0x10c424,_0xf41888,_0x350384){_0xf41888['agicommand']=_0x350384;if(_0xf41888[_0x1fb7('0x20')](_0x1fb7('0x21'))){_0xf41888['maxRetry']=parseInt(_0xf41888[_0x1fb7('0x21')],0xa);}_0x10c424['addVertex'](_['omit'](_0xf41888,_0x1fb7('0x22')));}function initGraph(_0x27b957,_0x2be17f){var _0x5c1800=new Graph();for(var _0x3695b6 in _0x27b957){if(_0x27b957[_0x1fb7('0x20')](_0x3695b6)){if(_[_0x1fb7('0x23')](_0x27b957[_0x3695b6])){for(var _0x434d3a=0x0;_0x434d3a<_0x27b957[_0x3695b6][_0x1fb7('0x24')];_0x434d3a+=0x1){addVertex(_0x5c1800,_0x27b957[_0x3695b6][_0x434d3a],_0x3695b6);}}else{addVertex(_0x5c1800,_0x27b957[_0x3695b6],_0x3695b6);}}}for(var _0x8fe7f9=0x0;_0x8fe7f9<_0x2be17f[_0x1fb7('0x24')];_0x8fe7f9+=0x1){if(_0x2be17f[_0x8fe7f9][_0x1fb7('0x25')]&&_0x2be17f[_0x8fe7f9][_0x1fb7('0x26')]){_0x5c1800[_0x1fb7('0x27')](_0x2be17f[_0x8fe7f9]['source'],_0x2be17f[_0x8fe7f9][_0x1fb7('0x26')],_0x2be17f[_0x8fe7f9][_0x1fb7('0x28')]);}}return _0x5c1800;}function getSquareProject(_0x42d3ca,_0x35a6c4){rpc[_0x1fb7('0x29')](_0x42d3ca)[_0x1fb7('0x2a')](function(_0x5d2713){_0x35a6c4(null,_0x5d2713);})[_0x1fb7('0x2b')](function(_0x52c07b){_0x35a6c4(null,_0x52c07b);});}function createSquareReport(_0x5f196f,_0xf96eed){rpc[_0x1fb7('0x2c')](_0x5f196f)[_0x1fb7('0x2a')](function(_0x241573){if(_0xf96eed){_0xf96eed(null,_0x241573);}})['catch'](function(_0x3683a0){if(_0xf96eed){_0xf96eed(null,_0x3683a0);}});}function setChannelVariables(_0x468dd0){for(var _0x5c0dca in _0x468dd0){if(_0x468dd0[_0x1fb7('0x20')](_0x5c0dca)){if(_0x5c0dca[_0x1fb7('0x2d')](_0x1fb7('0x2e'))===0x0){_0x468dd0[_0x5c0dca[_0x1fb7('0x2f')](0x4)]=_0x468dd0[_0x5c0dca];delete _0x468dd0[_0x5c0dca];}}}}function getLogFromObject(_0x4a5950){return util[_0x1fb7('0x30')](_0x4a5950,{'showHidden':![],'depth':null});}function agiHandler(_0x254b3f){var _0x2d2071,_0x301e66,_0x474668,_0x1cd970,_0x2e5db7;logger[_0x1fb7('0x31')]('variables',JSON['stringify'](_0x254b3f,null,0x2));logger[_0x1fb7('0x11')](util[_0x1fb7('0x15')](_0x1fb7('0x32'),_0x254b3f[_0x1fb7('0x17')],_0x254b3f[_0x1fb7('0x18')],_0x254b3f[_0x1fb7('0x19')],_0x254b3f[_0x1fb7('0x1a')],_0x254b3f[_0x1fb7('0x1b')]));_0x254b3f['on'](_0x1fb7('0x14'),errorHandler);_0x254b3f['on'](_0x1fb7('0x33'),closeHandler);_0x254b3f['on'](_0x1fb7('0x34'),timeoutHandler);_0x254b3f[_0x1fb7('0x35')]=![];_0x254b3f['on'](_0x1fb7('0x36'),hangupHandler);var _0x35c25b=getSquareProject[_0x1fb7('0x37')](null,_0x254b3f['arg_1']);if(_0x35c25b){if(_0x35c25b[_0x1fb7('0x38')]){_0x2d2071=getRoot(_0x35c25b[_0x1fb7('0x38')]);console[_0x1fb7('0xe')](_0x1fb7('0x39'),_0x2d2071);if(_0x2d2071&&_0x2d2071['start']){logger[_0x1fb7('0x31')]('root',JSON[_0x1fb7('0x3a')](_0x2d2071,null,0x2));_0x254b3f[_0x1fb7('0x3b')]=moment()['format'](_0x1fb7('0x3c'));_0x301e66=initGraph(_[_0x1fb7('0x3d')](_0x2d2071,_0x1fb7('0x22')),_0x2d2071[_0x1fb7('0x22')]);_0x474668=new Vertices(_0x254b3f,rpc,mailRpc);console[_0x1fb7('0xe')](_0x1fb7('0x3e'),_0x474668);logger[_0x1fb7('0x11')](util[_0x1fb7('0x15')](_0x1fb7('0x3f'),_0x254b3f[_0x1fb7('0x17')],_0x254b3f[_0x1fb7('0x18')],_0x254b3f[_0x1fb7('0x19')],_0x254b3f[_0x1fb7('0x1a')],_0x254b3f[_0x1fb7('0x1b')]));console[_0x1fb7('0xe')](_0x1fb7('0x40'));_0x301e66['traverseBFS'](_0x2d2071[_0x1fb7('0x41')]['id'],function(_0x115f31){try{_0x115f31=_0x474668['clear'](_0x115f31);logger['debug'](_0x1fb7('0x42'),JSON[_0x1fb7('0x3a')](_0x115f31,null,0x2));console['log'](_0x1fb7('0x43'),_0x115f31);if(_0x115f31[_0x1fb7('0x44')]===_0x1fb7('0x45')){logger['info'](_0x1fb7('0x46'));_0x254b3f[_0x1fb7('0x47')]=_0x115f31[_0x1fb7('0x47')]||_0x254b3f[_0x1fb7('0x47')];_0x254b3f[_0x1fb7('0x48')]=_0x115f31[_0x1fb7('0x48')];_0x254b3f[_0x1fb7('0x49')]=_0x115f31[_0x1fb7('0x49')]?_0x115f31[_0x1fb7('0x49')]-0x1:0x1;return null;}else if(_0x115f31&&_0x474668[_0x115f31['agicommand']]){_0x2e5db7=_0x474668[_0x115f31[_0x1fb7('0x44')]](_0x115f31);console[_0x1fb7('0xe')](_0x1fb7('0x4a'),_0x2e5db7);logger[_0x1fb7('0x11')]('response',JSON[_0x1fb7('0x3a')](_0x2e5db7,null,0x2));if(_0x2e5db7&&_0x2e5db7[_0x1fb7('0x4b')]===AGI_CODE_SUCCESS&&_0x2e5db7[_0x1fb7('0x4c')]!==AGI_RESULT_ERROR&&!_0x254b3f[_0x1fb7('0x35')]){logger[_0x1fb7('0x31')](_0x1fb7('0x4d'),getLogFromObject(_0x2e5db7));return _[_0x1fb7('0x4e')](_0x2e5db7[_0x1fb7('0x4c')])?null:_0x2e5db7['result'][_0x1fb7('0x4f')]();}else{logger[_0x1fb7('0x14')](_0x1fb7('0x4d'),getLogFromObject(_0x2e5db7));return null;}}else{logger[_0x1fb7('0x14')](_0x1fb7('0x50'));return null;}}catch(_0xa5831a){logger[_0x1fb7('0x14')](_0xa5831a['stack']);return null;}});if(_0x2d2071[_0x1fb7('0x51')]){logger[_0x1fb7('0x11')](util['format'](_0x1fb7('0x52'),_0x254b3f[_0x1fb7('0x17')],_0x254b3f['calleridname'],_0x254b3f['callerid'],_0x254b3f['dnid'],_0x254b3f[_0x1fb7('0x1b')]));_0x301e66[_0x1fb7('0x53')](_0x2d2071['finally']['id'],function(_0x368685){try{_0x368685=_0x474668[_0x1fb7('0x54')](_0x368685);logger[_0x1fb7('0x31')](_0x1fb7('0x42'),JSON[_0x1fb7('0x3a')](_0x368685,null,0x2));if(_0x368685&&_0x474668[_0x368685[_0x1fb7('0x44')]]){_0x2e5db7=_0x474668[_0x368685[_0x1fb7('0x44')]](_0x368685);if(_0x2e5db7){logger[_0x1fb7('0x31')](_0x1fb7('0x4d'),getLogFromObject(_0x2e5db7));return _[_0x1fb7('0x4e')](_0x2e5db7['result'])?null:_0x2e5db7[_0x1fb7('0x4c')]['toString']();}else{logger['error'](_0x1fb7('0x4d'),getLogFromObject(_0x2e5db7));return null;}}else{logger[_0x1fb7('0x14')](_0x1fb7('0x50'));return null;}}catch(_0x5c6ac0){logger[_0x1fb7('0x14')](_0x5c6ac0[_0x1fb7('0xd')]);return null;}});}logger[_0x1fb7('0x11')](util['format'](_0x1fb7('0x55'),_0x254b3f[_0x1fb7('0x17')],_0x254b3f['calleridname'],_0x254b3f['callerid'],_0x254b3f[_0x1fb7('0x1a')],_0x254b3f['uniqueid']));logger['info'](util[_0x1fb7('0x15')](_0x1fb7('0x56'),_0x254b3f[_0x1fb7('0x47')],_0x254b3f[_0x1fb7('0x48')],parseInt(_0x254b3f[_0x1fb7('0x49')],0xa)+0x1));_0x254b3f[_0x1fb7('0x57')](_0x254b3f[_0x1fb7('0x47')],_0x254b3f['extension'],parseInt(_0x254b3f[_0x1fb7('0x49')],0xa)+0x1);_0x254b3f[_0x1fb7('0x33')]();}}else{logger[_0x1fb7('0x14')](util[_0x1fb7('0x15')](_0x1fb7('0x58'),_0x254b3f[_0x1fb7('0x17')]));_0x254b3f[_0x1fb7('0x57')](_0x254b3f['context'],_0x254b3f[_0x1fb7('0x48')],parseInt(_0x254b3f[_0x1fb7('0x49')],0xa)+0x1);_0x254b3f['close']();}}else{logger['error'](util[_0x1fb7('0x15')](_0x1fb7('0x59'),_0x254b3f[_0x1fb7('0x17')]));_0x254b3f[_0x1fb7('0x57')](_0x254b3f[_0x1fb7('0x47')],_0x254b3f[_0x1fb7('0x48')],parseInt(_0x254b3f[_0x1fb7('0x49')],0xa)+0x1);_0x254b3f[_0x1fb7('0x33')]();}}function main(){var _0x52f704;return utilLicense[_0x1fb7('0x5a')]()[_0x1fb7('0x2a')](function(_0x506b6a){if(_0x506b6a){if(_0x506b6a[_0x1fb7('0x5b')]){if(_0x506b6a[_0x1fb7('0x5c')]&&_0x506b6a[_0x1fb7('0x5c')]>0x0){logger[_0x1fb7('0x11')](util[_0x1fb7('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x506b6a[_0x1fb7('0x5c')]));_0x52f704=_0x506b6a[_0x1fb7('0x5c')];}else{logger[_0x1fb7('0x11')](_0x1fb7('0x5d'));}}else{logger[_0x1fb7('0x11')](_0x1fb7('0x5e'));_0x52f704=-0x1;}}})[_0x1fb7('0x2b')](function(_0x58c593){logger[_0x1fb7('0x14')]('[LICENSE]',_0x58c593[_0x1fb7('0xd')]);})[_0x1fb7('0x51')](function(){var _0x1d1343=require(_0x1fb7('0x5f'))(config[_0x1fb7('0x5')][_0x1fb7('0x10')],config[_0x1fb7('0x5')]['ip'],_0x52f704);_0x1d1343['on']('error',errorHandler);_0x1d1343['on'](_0x1fb7('0x60'),listeningHandler);_0x1d1343['on'](_0x1fb7('0x61'),connectionHandler);_0x1d1343['on'](_0x1fb7('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 c867cc0..b55c60a 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(_0xcceba1,_0x2dabb4){var _0x39d2fb=function(_0x50b43f){while(--_0x50b43f){_0xcceba1['push'](_0xcceba1['shift']());}};_0x39d2fb(++_0x2dabb4);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x4f198f,_0x518ca3){var _0x3ae1cd=function(_0x5ab2fb){while(--_0x5ab2fb){_0x4f198f['push'](_0x4f198f['shift']());}};_0x3ae1cd(++_0x518ca3);}(_0x34e8,0x12c));var _0x834e=function(_0x44b082,_0x572901){_0x44b082=_0x44b082-0x0;var _0x39255c=_0x34e8[_0x44b082];return _0x39255c;};'use strict';var BPromise=require(_0x834e('0x0'));var jayson=require(_0x834e('0x1'));var client=jayson[_0x834e('0x2')][_0x834e('0x3')]({'port':0x232b});function request(_0x530939,_0x832422){return new BPromise(function(_0x21e2e0,_0x472111){return client[_0x834e('0x4')](_0x530939,_0x832422)[_0x834e('0x5')](function(_0x19a3e0){if(_0x19a3e0[_0x834e('0x6')]){return _0x472111(_0x19a3e0['error'][_0x834e('0x7')]);}else{return _0x21e2e0(_0x19a3e0['result']);}})[_0x834e('0x8')](function(_0x3cc2e3){return _0x472111(_0x3cc2e3);});});}exports[_0x834e('0x9')]=function(_0x2e69e2,_0x33ea05){return request(_0x834e('0xa'),{'account':_0x2e69e2,'message':_0x33ea05});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 6658d5b..55c7d25 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x4b5409,_0x472b71){var _0x90b623=function(_0x596445){while(--_0x596445){_0x4b5409['push'](_0x4b5409['shift']());}};_0x90b623(++_0x472b71);}(_0xb10b,0x12a));var _0xbb10=function(_0x1aae33,_0x110a80){_0x1aae33=_0x1aae33-0x0;var _0x2e91e9=_0xb10b[_0x1aae33];return _0x2e91e9;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x8e74c4,_0x4c3b72){var _0x50e53f=function(_0x2a4eef){while(--_0x2a4eef){_0x8e74c4['push'](_0x8e74c4['shift']());}};_0x50e53f(++_0x4c3b72);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e2c1b,_0x94deaf){_0x2e2c1b=_0x2e2c1b-0x0;var _0x43a4f2=_0xb10b[_0x2e2c1b];return _0x43a4f2;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 9d00278..202daa3 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 _0x2ea9=['arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','CreateCmContact','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','UnpauseUser','bluebird','moment','lodash','util','jayson/promise','request','error','message','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','ShowUser','getContactByPhone','log','rpcreq','GetContactByPhone','phone','getTrunkById','ShowTrunk','ShowSound','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareReport','merge'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2ea9,0xc4));var _0x92ea=function(_0xf8fe4e,_0x9afe40){_0xf8fe4e=_0xf8fe4e-0x0;var _0x370bd3=_0x2ea9[_0xf8fe4e];return _0x370bd3;};'use strict';var BPromise=require(_0x92ea('0x0'));var moment=require(_0x92ea('0x1'));var _=require(_0x92ea('0x2'));var util=require(_0x92ea('0x3'));var jayson=require(_0x92ea('0x4'));var client=jayson['client']['http']({'port':0x2329});function request(_0x1785d6,_0x3fb2a1){return new BPromise(function(_0x42b23a,_0x1d9de1){return client[_0x92ea('0x5')](_0x1785d6,_0x3fb2a1)['then'](function(_0x450009){if(_0x450009[_0x92ea('0x6')]){return _0x1d9de1(_0x450009[_0x92ea('0x6')][_0x92ea('0x7')]);}else{return _0x42b23a(_0x450009['result']);}})[_0x92ea('0x8')](function(_0x16b8aa){return _0x1d9de1(_0x16b8aa);});});}exports[_0x92ea('0x9')]=function(_0x3adb71){return request(_0x92ea('0xa'),{'options':{'raw':![],'where':{'name':_0x3adb71},'attributes':[_0x92ea('0xb')]}});};exports['getMailAccountById']=function(_0x46bf5f){return request(_0x92ea('0xc'),{'options':{'raw':![],'where':{'id':_0x46bf5f},'include':[{'model':'MailServerOut','as':_0x92ea('0xd')}],'attributes':['id',_0x92ea('0xe'),_0x92ea('0xf')]}});};exports[_0x92ea('0x10')]=function(_0x3e65b9){return request(_0x92ea('0xa'),{'options':{'where':{'id':_0x3e65b9},'attributes':[_0x92ea('0xe')]}});};exports['getVoiceQueueById']=function(_0x2715d0){return request(_0x92ea('0x11'),{'options':{'where':{'id':_0x2715d0},'attributes':[_0x92ea('0xe')]}});};exports[_0x92ea('0x12')]=function(_0x143936){return request(_0x92ea('0x13'),{'options':{'where':{'id':_0x143936},'attributes':[_0x92ea('0xe')]}});};exports[_0x92ea('0x14')]=function(_0x2437f6){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2437f6},'attributes':[_0x92ea('0x15')]}});};exports['getUserById']=function(_0x96cde7){return request(_0x92ea('0x16'),{'options':{'where':{'id':_0x96cde7},'attributes':[_0x92ea('0xe')]}});};exports[_0x92ea('0x17')]=function(_0x2c1c3b){console[_0x92ea('0x18')](_0x92ea('0x19'),_0x2c1c3b);return request(_0x92ea('0x1a'),{'options':{'where':{'phone':_0x2c1c3b[_0x92ea('0x1b')]},'attributes':['id']}});};exports[_0x92ea('0x1c')]=function(_0x1034e8){return request(_0x92ea('0x1d'),{'options':{'where':{'id':_0x1034e8},'attributes':[_0x92ea('0xe')]}});};exports['getSoundById']=function(_0x5d15cf){return request(_0x92ea('0x1e'),{'options':{'where':{'id':_0x5d15cf},'attributes':['save_name']}});};exports[_0x92ea('0x1f')]=function(_0x45d562){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x45d562},'include':[{'model':_0x92ea('0x20'),'as':_0x92ea('0x21')}]}});};exports[_0x92ea('0x22')]=function(_0x336c58){return request(_0x92ea('0x23'),{'options':{'where':{'id':_0x336c58},'attributes':['id','name']}});};exports[_0x92ea('0x24')]=function(_0x503cbe){return request('CreateSmsMessage',{'body':_0x503cbe});};exports[_0x92ea('0x25')]=function(_0xc1124){return request('CreateSquareDetailsReport',{'body':_0xc1124});};exports['createSquareReport']=function(_0x3721d1){return request(_0x92ea('0x26'),{'body':_[_0x92ea('0x27')](_0x3721d1,{'project_name':_0x3721d1[_0x92ea('0x28')],'prev_project_name':_0x3721d1[_0x92ea('0x29')]||'','is_subproject':_0x3721d1[_0x92ea('0x29')]?!![]:![],'leaveAt':moment()[_0x92ea('0x2a')](_0x92ea('0x2b'))})});};exports[_0x92ea('0x2c')]=function(_0xdc05d2){return request(_0x92ea('0x2d'),{'body':_0xdc05d2});};exports[_0x92ea('0x2e')]=function(_0x286304){return request(_0x92ea('0x2f'),{'body':_0x286304});};exports[_0x92ea('0x30')]=function(_0x27b467){return request(_0x92ea('0x31'),{'options':{'raw':![],'where':{'phone':_0x27b467[_0x92ea('0x1b')],'ListId':_0x27b467[_0x92ea('0x32')]}}})[_0x92ea('0x33')](function(_0x1a0939){if(_0x1a0939){return _0x1a0939;}return request(_0x92ea('0x34'),{'body':_0x27b467});});};exports[_0x92ea('0x35')]=function(_0x17ef39){return request(_0x92ea('0x36'),{'options':{'where':{'id':_0x17ef39},'attributes':[_0x92ea('0xe')]}});};exports['agentLogin']=function(_0x45d3b6,_0x4b25c0){return request('LoginUser',{'body':{'interface':_0x4b25c0},'options':{'where':_0x45d3b6}});};exports[_0x92ea('0x37')]=function(_0x34fc10,_0x32ffac,_0x1a7aed){return request(_0x92ea('0x38'),{'body':{'type':_0x32ffac,'uniqueid':_0x1a7aed},'options':{'where':_0x34fc10}});};exports[_0x92ea('0x39')]=function(_0x47ab6f){return request(_0x92ea('0x3a'),{'body':{},'options':{'where':_0x47ab6f}});};exports['agentLogout']=function(_0x308f23){return request('LogoutUser',{'body':{},'options':{'where':_0x308f23}});}; \ No newline at end of file +var _0x9fe3=['ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','dsn','getUserById','ShowUser','log','rpcreq','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById'];(function(_0x55261e,_0x1466ae){var _0x51714e=function(_0x23f5ba){while(--_0x23f5ba){_0x55261e['push'](_0x55261e['shift']());}};_0x51714e(++_0x1466ae);}(_0x9fe3,0x70));var _0x39fe=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x9fe3[_0x455c6c];return _0x488242;};'use strict';var BPromise=require(_0x39fe('0x0'));var moment=require('moment');var _=require(_0x39fe('0x1'));var util=require(_0x39fe('0x2'));var jayson=require(_0x39fe('0x3'));var client=jayson[_0x39fe('0x4')][_0x39fe('0x5')]({'port':0x2329});function request(_0x3e1876,_0x4831fe){return new BPromise(function(_0x4e25b3,_0x324bc0){return client[_0x39fe('0x6')](_0x3e1876,_0x4831fe)[_0x39fe('0x7')](function(_0x33b3db){if(_0x33b3db[_0x39fe('0x8')]){return _0x324bc0(_0x33b3db[_0x39fe('0x8')][_0x39fe('0x9')]);}else{return _0x4e25b3(_0x33b3db[_0x39fe('0xa')]);}})[_0x39fe('0xb')](function(_0x4e1b21){return _0x324bc0(_0x4e1b21);});});}exports[_0x39fe('0xc')]=function(_0x308de4){return request(_0x39fe('0xd'),{'options':{'raw':![],'where':{'name':_0x308de4},'attributes':[_0x39fe('0xe')]}});};exports[_0x39fe('0xf')]=function(_0x5df3b5){return request(_0x39fe('0x10'),{'options':{'raw':![],'where':{'id':_0x5df3b5},'include':[{'model':_0x39fe('0x11'),'as':_0x39fe('0x12')}],'attributes':['id',_0x39fe('0x13'),_0x39fe('0x14')]}});};exports[_0x39fe('0x15')]=function(_0x33b793){return request(_0x39fe('0xd'),{'options':{'where':{'id':_0x33b793},'attributes':[_0x39fe('0x13')]}});};exports[_0x39fe('0x16')]=function(_0x2bc3e6){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x2bc3e6},'attributes':[_0x39fe('0x13')]}});};exports[_0x39fe('0x17')]=function(_0x315c25){return request(_0x39fe('0x18'),{'options':{'where':{'id':_0x315c25},'attributes':[_0x39fe('0x13')]}});};exports['getSquareOdbcById']=function(_0xb2bbc){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xb2bbc},'attributes':[_0x39fe('0x19')]}});};exports[_0x39fe('0x1a')]=function(_0x4f3cf2){return request(_0x39fe('0x1b'),{'options':{'where':{'id':_0x4f3cf2},'attributes':[_0x39fe('0x13')]}});};exports['getContactByPhone']=function(_0x470eca){console[_0x39fe('0x1c')](_0x39fe('0x1d'),_0x470eca);return request(_0x39fe('0x1e'),{'options':{'where':{'phone':_0x470eca[_0x39fe('0x1f')]},'attributes':['id']}});};exports[_0x39fe('0x20')]=function(_0x5e38b8){return request(_0x39fe('0x21'),{'options':{'where':{'id':_0x5e38b8},'attributes':['name']}});};exports[_0x39fe('0x22')]=function(_0x278d68){return request(_0x39fe('0x23'),{'options':{'where':{'id':_0x278d68},'attributes':[_0x39fe('0x24')]}});};exports[_0x39fe('0x25')]=function(_0x4bee94){return request(_0x39fe('0x26'),{'options':{'raw':![],'where':{'id':_0x4bee94},'include':[{'model':_0x39fe('0x27'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x32e3c1){return request(_0x39fe('0x28'),{'options':{'where':{'id':_0x32e3c1},'attributes':['id',_0x39fe('0x13')]}});};exports[_0x39fe('0x29')]=function(_0x3f7168){return request(_0x39fe('0x2a'),{'body':_0x3f7168});};exports[_0x39fe('0x2b')]=function(_0xbd7c2d){return request(_0x39fe('0x2c'),{'body':_0xbd7c2d});};exports['createSquareReport']=function(_0x1824e6){return request('CreateSquareReport',{'body':_['merge'](_0x1824e6,{'project_name':_0x1824e6[_0x39fe('0x2d')],'prev_project_name':_0x1824e6[_0x39fe('0x2e')]||'','is_subproject':_0x1824e6[_0x39fe('0x2e')]?!![]:![],'leaveAt':moment()[_0x39fe('0x2f')](_0x39fe('0x30'))})});};exports['createSquareRecording']=function(_0x1eeca2){return request(_0x39fe('0x31'),{'body':_0x1eeca2});};exports[_0x39fe('0x32')]=function(_0x51f3fc){return request(_0x39fe('0x33'),{'body':_0x51f3fc});};exports[_0x39fe('0x34')]=function(_0x1e4a05){return request(_0x39fe('0x35'),{'options':{'raw':![],'where':{'phone':_0x1e4a05['phone'],'ListId':_0x1e4a05[_0x39fe('0x36')]}}})[_0x39fe('0x7')](function(_0x11808c){if(_0x11808c){return _0x11808c;}return request('CreateCmContact',{'body':_0x1e4a05});});};exports[_0x39fe('0x37')]=function(_0x24970e){return request(_0x39fe('0x38'),{'options':{'where':{'id':_0x24970e},'attributes':[_0x39fe('0x13')]}});};exports[_0x39fe('0x39')]=function(_0x36eac6,_0x537932){return request(_0x39fe('0x3a'),{'body':{'interface':_0x537932},'options':{'where':_0x36eac6}});};exports[_0x39fe('0x3b')]=function(_0x19573b,_0x111945,_0x27cc0c){return request(_0x39fe('0x3c'),{'body':{'type':_0x111945,'uniqueid':_0x27cc0c},'options':{'where':_0x19573b}});};exports[_0x39fe('0x3d')]=function(_0x207645){return request(_0x39fe('0x3e'),{'body':{},'options':{'where':_0x207645}});};exports['agentLogout']=function(_0x248449){return request(_0x39fe('0x3f'),{'body':{},'options':{'where':_0x248449}});}; \ 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 3c4cf8d..32aee46 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 _0x4c6d=['./lex','exports','./polly'];(function(_0x4ef34e,_0x35319a){var _0x452509=function(_0x1dd4d3){while(--_0x1dd4d3){_0x4ef34e['push'](_0x4ef34e['shift']());}};_0x452509(++_0x35319a);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x478489,_0x3cdf57){_0x478489=_0x478489-0x0;var _0x544211=_0x4c6d[_0x478489];return _0x544211;};var polly=require(_0xd4c6('0x0'));var lex=require(_0xd4c6('0x1'));module[_0xd4c6('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x0e85=['./polly','./lex'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0x0e85,0x7c));var _0x50e8=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x0e85[_0x38537f];return _0x141e23;};var polly=require(_0x50e8('0x0'));var lex=require(_0x50e8('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index e9faafd..2ab729b 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x3a81ad,_0x555a17,_0x2411c2,_0x34de1d,_0x4d6507,_0x54d423){return lex(_0x3a81ad,_0x555a17,_0x2411c2,_0x34de1d,_0x4d6507,_0x54d423);}; \ No newline at end of file +var _0xc997=['exports'];(function(_0x1fb755,_0x43f699){var _0x484190=function(_0x20b282){while(--_0x20b282){_0x1fb755['push'](_0x1fb755['shift']());}};_0x484190(++_0x43f699);}(_0xc997,0x1ac));var _0x7c99=function(_0x598cf7,_0xe52881){_0x598cf7=_0x598cf7-0x0;var _0x4508d2=_0xc997[_0x598cf7];return _0x4508d2;};'use strict';var lex=require('./lib/api');module[_0x7c99('0x0')]=function(_0x3b4b36,_0x2032f1,_0x3997dc,_0x17f440,_0x4e5e4d,_0x2226d5){return lex(_0x3b4b36,_0x2032f1,_0x3997dc,_0x17f440,_0x4e5e4d,_0x2226d5);}; \ 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 263f431..192effd 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 _0xed84=['hasOwnProperty','slot_','exports','$LATEST','aws-sdk','postText','slots'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xed84,0x193));var _0x4ed8=function(_0xcf943f,_0xcad999){_0xcf943f=_0xcf943f-0x0;var _0x15b3e5=_0xed84[_0xcf943f];return _0x15b3e5;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x4ed8('0x0'));function lexResult(_0x42a9ef,_0x537050){return new BPromise(function(_0x44de00,_0x5f26dc){_0x42a9ef[_0x4ed8('0x1')](_0x537050,function(_0x4a67bf,_0x46319a){if(_0x4a67bf){_0x5f26dc(_0x4a67bf);}if(_0x46319a[_0x4ed8('0x2')]){for(const _0x4bb51b in _0x46319a[_0x4ed8('0x2')]){if(_0x46319a['slots'][_0x4ed8('0x3')](_0x4bb51b)){var _0x11732e=_0x46319a[_0x4ed8('0x2')][_0x4bb51b];_0x46319a[_0x4ed8('0x4')+_0x4bb51b]=_0x11732e;}}}_0x44de00(_0x46319a);});});}module[_0x4ed8('0x5')]=function(_0x5a6ad2,_0x32a4a6,_0x550295,_0x3c9fb0,_0xdcae39,_0x59aab7){var _0x432e8b=new AWS['LexRuntime']({'accessKeyId':_0x32a4a6,'secretAccessKey':_0x550295,'region':_0x3c9fb0});var _0x1d6ce2={'botAlias':_0x4ed8('0x6'),'botName':_0x59aab7,'inputText':_0xdcae39,'userId':_0x5a6ad2};return lexResult(_0x432e8b,_0x1d6ce2);}; \ No newline at end of file +var _0xe0e1=['LexRuntime','aws-sdk','postText','slots','hasOwnProperty'];(function(_0x9584a9,_0x413cec){var _0x2b3b6e=function(_0x5d4b29){while(--_0x5d4b29){_0x9584a9['push'](_0x9584a9['shift']());}};_0x2b3b6e(++_0x413cec);}(_0xe0e1,0x146));var _0x1e0e=function(_0x1e9d21,_0x3a0e3e){_0x1e9d21=_0x1e9d21-0x0;var _0x30efcb=_0xe0e1[_0x1e9d21];return _0x30efcb;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x1e0e('0x0'));function lexResult(_0x356fbb,_0x46ebea){return new BPromise(function(_0x50304e,_0x1f832e){_0x356fbb[_0x1e0e('0x1')](_0x46ebea,function(_0x2ee711,_0x5ad8c9){if(_0x2ee711){_0x1f832e(_0x2ee711);}if(_0x5ad8c9[_0x1e0e('0x2')]){for(const _0x2b8a9f in _0x5ad8c9['slots']){if(_0x5ad8c9[_0x1e0e('0x2')][_0x1e0e('0x3')](_0x2b8a9f)){var _0x153159=_0x5ad8c9[_0x1e0e('0x2')][_0x2b8a9f];_0x5ad8c9['slot_'+_0x2b8a9f]=_0x153159;}}}_0x50304e(_0x5ad8c9);});});}module['exports']=function(_0x110544,_0x10b7db,_0x4d0585,_0x2d436d,_0x1c7840,_0x1f9475){var _0xde033c=new AWS[(_0x1e0e('0x4'))]({'accessKeyId':_0x10b7db,'secretAccessKey':_0x4d0585,'region':_0x2d436d});var _0x2c9ccf={'botAlias':'$LATEST','botName':_0x1f9475,'inputText':_0x1c7840,'userId':_0x110544};return lexResult(_0xde033c,_0x2c9ccf);}; \ 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 765cb8f..a35bf27 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 _0xc337=['exports'];(function(_0xd4ec15,_0x4852af){var _0x59f78e=function(_0x3b7688){while(--_0x3b7688){_0xd4ec15['push'](_0xd4ec15['shift']());}};_0x59f78e(++_0x4852af);}(_0xc337,0x1de));var _0x7c33=function(_0x2de2f9,_0xa8a2ae){_0x2de2f9=_0x2de2f9-0x0;var _0x520598=_0xc337[_0x2de2f9];return _0x520598;};'use strict';var polly=require('./lib/api');module[_0x7c33('0x0')]=function(_0x4231f9,_0xf9742e,_0x5895cf,_0x35d75e,_0x4ed8fa,_0x205f65,_0x35960a){return polly(_0x4231f9,_0xf9742e,_0x5895cf,_0x35d75e,_0x4ed8fa,_0x205f65,_0x35960a);}; \ No newline at end of file +var _0xff59=['./lib/api','exports'];(function(_0x4d21ff,_0x19d202){var _0x22b554=function(_0x4473c5){while(--_0x4473c5){_0x4d21ff['push'](_0x4d21ff['shift']());}};_0x22b554(++_0x19d202);}(_0xff59,0x6c));var _0x9ff5=function(_0x515cd8,_0x4c78e1){_0x515cd8=_0x515cd8-0x0;var _0x23aeb3=_0xff59[_0x515cd8];return _0x23aeb3;};'use strict';var polly=require(_0x9ff5('0x0'));module[_0x9ff5('0x1')]=function(_0x219056,_0x1aa54c,_0x5351e2,_0x4b82f4,_0x1427d6,_0x3d8a17,_0x4586b3){return polly(_0x219056,_0x1aa54c,_0x5351e2,_0x4b82f4,_0x1427d6,_0x3d8a17,_0x4586b3);}; \ 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 2a79769..3dd6a39 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 _0xcfb4=['text','mp3','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x3ea022,_0x2d5328){var _0x3b97a2=function(_0x351179){while(--_0x351179){_0x3ea022['push'](_0x3ea022['shift']());}};_0x3b97a2(++_0x2d5328);}(_0xcfb4,0x120));var _0x4cfb=function(_0x2ee48,_0x3a78a9){_0x2ee48=_0x2ee48-0x0;var _0x252153=_0xcfb4[_0x2ee48];return _0x252153;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x4cfb('0x0'));var AWS=require(_0x4cfb('0x1'));function pollyResult(_0x3e7a2d,_0x21de7f,_0x1e28ec){return new BPromise(function(_0x5b0c15,_0x4747b9){_0x3e7a2d[_0x4cfb('0x2')](_0x21de7f,function(_0x361476,_0x4cc450){if(_0x361476){_0x4747b9(_0x361476);}else if(_0x4cc450){if(_0x4cc450[_0x4cfb('0x3')]instanceof Buffer){fs[_0x4cfb('0x4')](_0x1e28ec,_0x4cc450[_0x4cfb('0x3')],function(_0x205afa){if(_0x205afa){_0x4747b9(_0x205afa);}else{_0x5b0c15();}});}else{_0x4747b9(new Error(_0x4cfb('0x5')));}}else{_0x4747b9(new Error(_0x4cfb('0x6')));}});});}module[_0x4cfb('0x7')]=function(_0x25b3f6,_0x577967,_0x5acb89,_0x33aa5d,_0x55a179,_0x3dbc53,_0x4de15c){var _0x3afd8e=new AWS[(_0x4cfb('0x8'))]({'accessKeyId':_0x25b3f6,'secretAccessKey':_0x577967,'region':_0x5acb89});var _0x59989a={'Text':_0x55a179,'TextType':_0x3dbc53||_0x4cfb('0x9'),'OutputFormat':_0x4cfb('0xa'),'VoiceId':_0x33aa5d};return pollyResult(_0x3afd8e,_0x59989a,_0x4de15c);}; \ No newline at end of file +var _0xe58e=['mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0xe58e,0x10f));var _0xee58=function(_0x59379b,_0x1090b6){_0x59379b=_0x59379b-0x0;var _0xc397c7=_0xe58e[_0x59379b];return _0xc397c7;};'use strict';var fs=require('fs');var path=require(_0xee58('0x0'));var BPromise=require(_0xee58('0x1'));var rs=require(_0xee58('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x5a1eb3,_0x2bbcc3,_0x3fd2d0){return new BPromise(function(_0x312b48,_0x40a79b){_0x5a1eb3[_0xee58('0x3')](_0x2bbcc3,function(_0x4cc381,_0x7901da){if(_0x4cc381){_0x40a79b(_0x4cc381);}else if(_0x7901da){if(_0x7901da[_0xee58('0x4')]instanceof Buffer){fs[_0xee58('0x5')](_0x3fd2d0,_0x7901da[_0xee58('0x4')],function(_0x333f43){if(_0x333f43){_0x40a79b(_0x333f43);}else{_0x312b48();}});}else{_0x40a79b(new Error(_0xee58('0x6')));}}else{_0x40a79b(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x531ec8,_0x5cf98f,_0x1d84e6,_0x19a8b9,_0x38e90c,_0x55b540,_0x5913d5){var _0x89dfce=new AWS[(_0xee58('0x7'))]({'accessKeyId':_0x531ec8,'secretAccessKey':_0x5cf98f,'region':_0x1d84e6});var _0x2395ff={'Text':_0x38e90c,'TextType':_0x55b540||_0xee58('0x8'),'OutputFormat':_0xee58('0x9'),'VoiceId':_0x19a8b9};return pollyResult(_0x89dfce,_0x2395ff,_0x5913d5);}; \ 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 33f54dd..5ece50a 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 _0xa969=['./lib/api','exports'];(function(_0x255be9,_0x3345d9){var _0x34fedf=function(_0x2e198c){while(--_0x2e198c){_0x255be9['push'](_0x255be9['shift']());}};_0x34fedf(++_0x3345d9);}(_0xa969,0x13e));var _0x9a96=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0xa969[_0x1d1d09];return _0x8827e;};'use strict';var asr=require(_0x9a96('0x0'));module[_0x9a96('0x1')]=function(_0x44c0eb,_0x12f922,_0xd07dea,_0x19bb73){return asr(_0x44c0eb,_0x12f922,_0xd07dea);}; \ No newline at end of file +var _0x63ad=['./lib/api','exports'];(function(_0x519006,_0x113827){var _0x165a26=function(_0x4d5047){while(--_0x4d5047){_0x519006['push'](_0x519006['shift']());}};_0x165a26(++_0x113827);}(_0x63ad,0x66));var _0xd63a=function(_0x3b72cb,_0x15f112){_0x3b72cb=_0x3b72cb-0x0;var _0x4375ae=_0x63ad[_0x3b72cb];return _0x4375ae;};'use strict';var asr=require(_0xd63a('0x0'));module[_0xd63a('0x1')]=function(_0x307b3f,_0x5c6266,_0x54cd3c,_0x5acef8){return asr(_0x307b3f,_0x5c6266,_0x54cd3c);}; \ 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 6759ca4..adc2267 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 _0xadb6=['length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','LINEAR16','url','bluebird','exports','string'];(function(_0x57724a,_0x6f76af){var _0x410ced=function(_0x1bcb08){while(--_0x1bcb08){_0x57724a['push'](_0x57724a['shift']());}};_0x410ced(++_0x6f76af);}(_0xadb6,0xe2));var _0x6adb=function(_0x22c0ac,_0x54cbd4){_0x22c0ac=_0x22c0ac-0x0;var _0x3e1955=_0xadb6[_0x22c0ac];return _0x3e1955;};'use strict';var url=require(_0x6adb('0x0'));var BPromise=require(_0x6adb('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x6adb('0x2')]=function(_0x302506,_0x45a1f6,_0x49b456){return new BPromise(function(_0x3ee875,_0x50c671){var _0x1a39c2;if(typeof _0x302506!==_0x6adb('0x3')||_0x302506[_0x6adb('0x4')]===0x0){return _0x50c671('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x45a1f6!==_0x6adb('0x3')||_0x45a1f6[_0x6adb('0x4')]===0x0){return _0x50c671(_0x6adb('0x5'));}if(typeof _0x49b456!==_0x6adb('0x6')&&(typeof _0x49b456!==_0x6adb('0x3')||_0x49b456[_0x6adb('0x4')]===0x0)){return _0x50c671(_0x6adb('0x7'));}try{_0x1a39c2=fs[_0x6adb('0x8')](_0x302506)['toString']('base64');}catch(_0x17dfe4){return _0x50c671(_0x17dfe4);}return _0x3ee875({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0x45a1f6,'body':{'config':{'encoding':_0x6adb('0x9'),'sampleRateHertz':'8000','languageCode':_0x49b456},'audio':{'content':_0x1a39c2}},'json':!![]});});}; \ No newline at end of file +var _0xbf33=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','8000','url'];(function(_0x3cf7d6,_0x43f198){var _0x5a9604=function(_0x4b2c0c){while(--_0x4b2c0c){_0x3cf7d6['push'](_0x3cf7d6['shift']());}};_0x5a9604(++_0x43f198);}(_0xbf33,0x137));var _0x3bf3=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xbf33[_0x4d8ed9];return _0x1e2140;};'use strict';var url=require(_0x3bf3('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x3bf3('0x1');module[_0x3bf3('0x2')]=function(_0x4f9122,_0x3226a3,_0x46fe4f){return new BPromise(function(_0x6212a8,_0x2e4c0b){var _0x4392ce;if(typeof _0x4f9122!==_0x3bf3('0x3')||_0x4f9122[_0x3bf3('0x4')]===0x0){return _0x2e4c0b(_0x3bf3('0x5'));}if(typeof _0x3226a3!=='string'||_0x3226a3[_0x3bf3('0x4')]===0x0){return _0x2e4c0b('key\x20should\x20be\x20a\x20string');}if(typeof _0x46fe4f!==_0x3bf3('0x6')&&(typeof _0x46fe4f!==_0x3bf3('0x3')||_0x46fe4f[_0x3bf3('0x4')]===0x0)){return _0x2e4c0b(_0x3bf3('0x7'));}try{_0x4392ce=fs[_0x3bf3('0x8')](_0x4f9122)[_0x3bf3('0x9')](_0x3bf3('0xa'));}catch(_0x1c67b4){return _0x2e4c0b(_0x1c67b4);}return _0x6212a8({'method':'POST','uri':host+_0x3bf3('0xb')+_0x3226a3,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x3bf3('0xc'),'languageCode':_0x46fe4f},'audio':{'content':_0x4392ce}},'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 9a539ab..916e5eb 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 _0x8322=['./asr','exports'];(function(_0x51c560,_0x4e6c0e){var _0x594579=function(_0x18c6fe){while(--_0x18c6fe){_0x51c560['push'](_0x51c560['shift']());}};_0x594579(++_0x4e6c0e);}(_0x8322,0x186));var _0x2832=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0x8322[_0x3f9584];return _0x9d54c;};var asr=require(_0x2832('0x0'));module[_0x2832('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf503=['./asr','exports'];(function(_0x49bced,_0x5edf1f){var _0x41909c=function(_0xc58582){while(--_0xc58582){_0x49bced['push'](_0x49bced['shift']());}};_0x41909c(++_0x5edf1f);}(_0xf503,0x11a));var _0x3f50=function(_0x2c7626,_0x6c430e){_0x2c7626=_0x2c7626-0x0;var _0x3a2add=_0xf503[_0x2c7626];return _0x3a2add;};var asr=require(_0x3f50('0x0'));module[_0x3f50('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index ee750f9..c06026a 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 _0x05d0=['WHAT_EVER','get','statusCode','error','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','.wav','base64','then','chmodSync','777','split','toString','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','generate','.mp3','from','writeFile','tmp','googleTTS','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','stringify','source','resolvedQuery','result','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','dirName','path','http','https','url','parse','bluebird','randomstring','request-promise','util','google-tts-api','apiai-promise','./google','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x05d0,0x132));var _0x005d=function(_0x186b4d,_0x375f0c){_0x186b4d=_0x186b4d-0x0;var _0x426d99=_0x05d0[_0x186b4d];return _0x426d99;};'use strict';var fs=require('fs');var path=require(_0x005d('0x0'));var http=require(_0x005d('0x1'));var https=require(_0x005d('0x2'));var urlParse=require(_0x005d('0x3'))[_0x005d('0x4')];var BPromise=require(_0x005d('0x5'));var rs=require(_0x005d('0x6'));var sox=require('sox');var rp=require(_0x005d('0x7'));var util=require(_0x005d('0x8'));var querystring=require('querystring');var tts=require(_0x005d('0x9'));var apiai=require(_0x005d('0xa'));var md5=require('md5');var google=require(_0x005d('0xb'));var aws=require(_0x005d('0xc'));var tilde=require(_0x005d('0xd'));var sestek=require(_0x005d('0xe'));var logger=require(_0x005d('0xf'))(_0x005d('0x10'));var ISPEECH_API=_0x005d('0x11');function downloadFile(_0x5f2838,_0x22210c){return new BPromise(function(_0x2993c6,_0x502cec){var _0x4a63bc=urlParse(_0x5f2838);var _0x1c0505=_0x4a63bc[_0x005d('0x12')]===_0x005d('0x13')?https:http;var _0x3280b4={'host':_0x4a63bc[_0x005d('0x14')],'path':_0x4a63bc[_0x005d('0x0')],'headers':{'user-agent':_0x005d('0x15')}};_0x1c0505[_0x005d('0x16')](_0x3280b4,function(_0xf94d54){if(_0xf94d54[_0x005d('0x17')]!==0xc8){logger[_0x005d('0x18')]('request\x20to\x20'+_0x5f2838+'\x20failed,\x20status\x20code\x20=\x20'+_0xf94d54[_0x005d('0x17')]+'\x20('+_0xf94d54[_0x005d('0x19')]+')');_0x502cec(new Error(_0x005d('0x1a')+_0x5f2838+_0x005d('0x1b')+_0xf94d54[_0x005d('0x17')]+'\x20('+_0xf94d54['statusMessage']+')'));return;}var _0x459b8b=fs[_0x005d('0x1c')](_0x22210c);_0x459b8b['on'](_0x005d('0x1d'),function(){logger[_0x005d('0x1e')](_0x005d('0x1f'));_0x459b8b[_0x005d('0x20')](_0x2993c6);});_0x459b8b['on'](_0x005d('0x18'),function(_0x4f247e){fs[_0x005d('0x21')](_0x22210c);logger[_0x005d('0x18')](_0x005d('0x22'),_0x4f247e);_0x502cec(_0x4f247e);});_0xf94d54[_0x005d('0x23')](_0x459b8b);})['on'](_0x005d('0x18'),function(_0x5d922c){logger[_0x005d('0x18')](_0x5d922c);_0x502cec(_0x5d922c);})[_0x005d('0x24')]();});}function uploadFile(_0x51af2c){return new BPromise(function(_0x375403,_0x5358a4){var _0x57cee5=urlParse(_0x51af2c);var _0x3b17f5=_0x57cee5[_0x005d('0x12')]==='https:'?https:http;var _0x558958={'host':_0x57cee5[_0x005d('0x14')],'path':_0x57cee5[_0x005d('0x0')],'headers':{'user-agent':_0x005d('0x15')}};_0x3b17f5[_0x005d('0x16')](_0x558958,function(_0x4db8a0){if(_0x4db8a0[_0x005d('0x17')]!==0xc8){_0x5358a4(new Error(_0x005d('0x1a')+_0x51af2c+_0x005d('0x1b')+_0x4db8a0[_0x005d('0x17')]+'\x20('+_0x4db8a0['statusMessage']+')'));return;}var _0x41d351='';_0x4db8a0['on'](_0x005d('0x25'),function(_0x361fb9){_0x41d351+=_0x361fb9;});_0x4db8a0['on'](_0x005d('0x24'),function(){_0x375403(_0x41d351);});})['on'](_0x005d('0x18'),function(_0x3ac11b){_0x5358a4(_0x3ac11b);})[_0x005d('0x24')]();});}function convertFile(_0xae8f26,_0x10bd9f){return new BPromise(function(_0x143b5e,_0x432d93){var _0x1d882f=sox[_0x005d('0x26')](_0xae8f26,_0x10bd9f,{'sampleRate':0x1f40,'format':_0x005d('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1d882f['on']('error',function(_0x8faa15){logger[_0x005d('0x18')](_0x005d('0x28'),_0x8faa15);_0x432d93(_0x8faa15);});_0x1d882f['on'](_0x005d('0x24'),function(){logger[_0x005d('0x1e')](_0x005d('0x29'));_0x143b5e();});_0x1d882f[_0x005d('0x2a')]();});}function base64Decode(_0x3bbe7e,_0x1b0fa3){var _0x3b3484=path[_0x005d('0x2b')](__dirname,'tmp',rs['generate'](0x4)+_0x005d('0x2c'));fs['writeFileSync'](_0x3b3484,_0x3bbe7e,_0x005d('0x2d'));return convertFile(_0x3b3484,_0x1b0fa3)[_0x005d('0x2e')](function(){try{fs[_0x005d('0x21')](_0x3b3484);fs[_0x005d('0x2f')](_0x1b0fa3,_0x005d('0x30'));}catch(_0x610a35){logger[_0x005d('0x18')](_0x610a35);}return _0x1b0fa3[_0x005d('0x31')]('.')[0x0];});}function base64Encode(_0x49582e){var _0x6ad7d9=fs['readFileSync'](_0x49582e);return new Buffer(_0x6ad7d9)[_0x005d('0x32')](_0x005d('0x2d'));}exports['googleCloudTTS']=function(_0xb569d6,_0x4ee839,_0xad5f87,_0x461e07,_0x13217b,_0x42ee22){var _0x1e43e9,_0x48d6b0;var _0x2e65f8=_0x005d('0x33');var _0xa4dc8e='?key='+_0xb569d6;var _0x297620={};if(_0x4ee839===_0x005d('0x34')){_0x297620[_0x005d('0x35')]={'ssml':_0xad5f87};}else{_0x297620[_0x005d('0x35')]={'text':_0xad5f87};};_0x297620[_0x005d('0x36')]={'languageCode':_0x461e07,'ssmlGender':_0x13217b};_0x297620[_0x005d('0x37')]={'audioEncoding':_0x005d('0x38'),'sampleRateHertz':0x1f40};var _0x2a71aa={'url':_0x2e65f8+_0x005d('0x39')+_0xa4dc8e,'method':'POST','json':!![],'body':_0x297620};return rp(_0x2a71aa)[_0x005d('0x2e')](function(_0x8d7f82){return new BPromise(function(_0x165e4e,_0x1f8c48){_0x1e43e9=path[_0x005d('0x2b')](__dirname,'tmp',rs[_0x005d('0x3a')](0x4)+_0x005d('0x3b'));var _0x5d8e32=Buffer[_0x005d('0x3c')](_0x8d7f82['audioContent'],_0x005d('0x2d'));return fs[_0x005d('0x3d')](_0x1e43e9,_0x5d8e32,function(_0x4fc168){_0x1f8c48(_0x4fc168);},function(_0x11b2d9){fs[_0x005d('0x2f')](_0x1e43e9,_0x005d('0x30'));_0x165e4e(_0x11b2d9);});});})[_0x005d('0x2e')](function(_0x51df0a){_0x48d6b0=path[_0x005d('0x2b')](__dirname,_0x005d('0x3e'),rs[_0x005d('0x3a')](0x4)+_0x005d('0x2c'));return convertFile(_0x1e43e9,_0x48d6b0);})[_0x005d('0x2e')](function(){try{fs[_0x005d('0x21')](_0x1e43e9);fs[_0x005d('0x2f')](_0x48d6b0,_0x005d('0x30'));}catch(_0x8322ca){logger['error'](_0x8322ca);}logger[_0x005d('0x1e')]('googleCloudTTS\x20path',_0x48d6b0[_0x005d('0x31')]('.')[0x0]);return _0x48d6b0[_0x005d('0x31')]('.')[0x0];});};exports[_0x005d('0x3f')]=function(_0x592454,_0x5443f4){var _0x303005,_0x344e97;return tts(_0x592454,_0x5443f4||'en',0x1)['then'](function(_0x16b6e6){logger[_0x005d('0x1e')](_0x16b6e6);_0x303005=path['resolve'](__dirname,_0x005d('0x3e'),rs[_0x005d('0x3a')](0x4)+_0x005d('0x3b'));return downloadFile(_0x16b6e6,_0x303005);})[_0x005d('0x2e')](function(){_0x344e97=path['resolve'](__dirname,_0x005d('0x3e'),rs[_0x005d('0x3a')](0x4)+_0x005d('0x2c'));return convertFile(_0x303005,_0x344e97);})['then'](function(){try{fs[_0x005d('0x21')](_0x303005);fs[_0x005d('0x2f')](_0x344e97,_0x005d('0x30'));}catch(_0xaec53e){logger[_0x005d('0x18')](_0xaec53e);}logger[_0x005d('0x1e')](_0x005d('0x40'),_0x344e97[_0x005d('0x31')]('.')[0x0]);return _0x344e97[_0x005d('0x31')]('.')[0x0];});};exports['googleASR']=function(_0xdcece3,_0x490760,_0x3823c9){return google[_0x005d('0x41')](_0xdcece3,_0x490760,_0x3823c9)[_0x005d('0x2e')](function(_0xf232f1){logger[_0x005d('0x1e')](_0xf232f1[_0x005d('0x42')]);return rp(_0xf232f1);})['then'](function(_0x22006a){var _0x5462e9='';var _0x17087a=0x0;try{fs['unlink'](_0xdcece3);}catch(_0x4226e9){logger[_0x005d('0x18')](_0x4226e9);}if(_0x22006a&&_0x22006a['results']){_0x5462e9=_0x22006a[_0x005d('0x43')][_0x005d('0x44')](function(_0x241f8d){return _0x241f8d&&_0x241f8d[_0x005d('0x45')][0x0]&&_0x241f8d['alternatives'][0x0][_0x005d('0x46')]?_0x241f8d[_0x005d('0x45')][0x0][_0x005d('0x46')]:'';})[_0x005d('0x47')]('\x0a');_0x17087a=_0x22006a[_0x005d('0x43')][_0x005d('0x44')](function(_0x724745){return _0x724745&&_0x724745[_0x005d('0x45')][0x0]&&_0x724745['alternatives'][0x0]['confidence']?_0x724745['alternatives'][0x0][_0x005d('0x48')]:0x0;})[_0x005d('0x47')]('\x0a');}logger[_0x005d('0x1e')]('googleASR\x20transcription',_0x5462e9);logger[_0x005d('0x1e')](_0x005d('0x49'),_0x17087a);return{'transcript':_0x5462e9,'confidence':_0x17087a};})[_0x005d('0x4a')](function(_0xa0d831){logger[_0x005d('0x18')](_0x005d('0x4b'),_0xa0d831[_0x005d('0x17')],_0xa0d831['name'],_0xa0d831[_0x005d('0x4c')]);});};exports[_0x005d('0x4d')]=function(_0x2749e4,_0x193699,_0x194d0e,_0x5dc41c){var _0x2c9481=apiai(_0x193699,{'language':_0x5dc41c||'en'});return _0x2c9481['textRequest'](_0x194d0e,{'sessionId':md5(_0x2749e4)})[_0x005d('0x2e')](function(_0x229a51){logger['info'](JSON[_0x005d('0x4e')](_0x229a51));return{'source':_0x229a51['result'][_0x005d('0x4f')],'resolvedQuery':_0x229a51['result'][_0x005d('0x50')],'action':_0x229a51[_0x005d('0x51')][_0x005d('0x52')],'actionIncomplete':_0x229a51[_0x005d('0x51')][_0x005d('0x53')],'speech':_0x229a51['result'][_0x005d('0x54')][_0x005d('0x55')],'score':_0x229a51['result'][_0x005d('0x56')],'statusCode':_0x229a51['status'][_0x005d('0x57')],'endConversation':_0x229a51[_0x005d('0x51')][_0x005d('0x58')][_0x005d('0x59')]||![],'isFallbackIntent':_0x229a51[_0x005d('0x51')][_0x005d('0x58')]['isFallbackIntent']};});};exports[_0x005d('0x5a')]=function(_0x3df0ea,_0x1261e1,_0xcba01f,_0x1ebb58){return tilde[_0x005d('0x41')](_0x3df0ea,_0x1261e1,_0xcba01f,_0x1ebb58)[_0x005d('0x2e')](function(_0x2feeaf){try{fs[_0x005d('0x21')](_0x3df0ea);}catch(_0x296b46){logger[_0x005d('0x18')](_0x296b46);}logger[_0x005d('0x1e')](_0x005d('0x5b'),_0x2feeaf[_0x005d('0x46')]);logger['info'](_0x005d('0x5c'),_0x2feeaf[_0x005d('0x48')]);return _0x2feeaf;});};exports[_0x005d('0x5d')]=function(_0x309722,_0x417a12,_0x43cd92,_0x4f057b,_0x3a947f,_0xd9c9ac){var _0x2ba8a6=path['resolve'](__dirname,_0x005d('0x3e'),rs['generate'](0x4)+_0x005d('0x3b'));var _0x158468;return aws[_0x005d('0x5e')](_0x309722,_0x417a12,_0x43cd92,_0x4f057b,_0x3a947f,_0xd9c9ac,_0x2ba8a6)[_0x005d('0x2e')](function(){_0x158468=path[_0x005d('0x2b')](__dirname,_0x005d('0x3e'),rs[_0x005d('0x3a')](0x4)+_0x005d('0x2c'));return convertFile(_0x2ba8a6,_0x158468);})[_0x005d('0x2e')](function(){try{fs[_0x005d('0x21')](_0x2ba8a6);fs[_0x005d('0x2f')](_0x158468,_0x005d('0x30'));}catch(_0x198ccc){logger[_0x005d('0x18')](_0x198ccc);}return _0x158468[_0x005d('0x31')]('.')[0x0];});};exports[_0x005d('0x5f')]=function(_0x5e44e9,_0x2c612e,_0x286a2f,_0x2ebb66,_0x869405,_0x1b6510){return aws[_0x005d('0x60')](_0x5e44e9,_0x2c612e,_0x286a2f,_0x2ebb66,_0x869405,_0x1b6510)['then'](function(_0x248b52){logger[_0x005d('0x1e')](JSON[_0x005d('0x4e')](_0x248b52));return _0x248b52;});};exports[_0x005d('0x61')]=function(_0x24b5f4,_0x3e7898,_0x1b8c7b,_0x3cc157){var _0x2c9d78=util[_0x005d('0x62')](_0x005d('0x63'),ISPEECH_API,_0x24b5f4,encodeURIComponent(_0x3e7898),_0x1b8c7b,_0x3cc157);var _0x178744=path[_0x005d('0x2b')](__dirname,'tmp',rs[_0x005d('0x3a')](0x4)+_0x005d('0x3b'));var _0x159d46;return downloadFile(_0x2c9d78,_0x178744)[_0x005d('0x2e')](function(){_0x159d46=path['resolve'](__dirname,'tmp',rs[_0x005d('0x3a')](0x4)+_0x005d('0x2c'));return convertFile(_0x178744,_0x159d46);})[_0x005d('0x2e')](function(){try{fs[_0x005d('0x21')](_0x178744);fs['chmodSync'](_0x159d46,_0x005d('0x30'));}catch(_0x2d1b80){logger[_0x005d('0x18')](_0x2d1b80);}return _0x159d46[_0x005d('0x31')]('.')[0x0];});};exports[_0x005d('0x64')]=function(_0xf31efc,_0x158eb7,_0x3239dd,_0x591460){var _0x3e8220=util[_0x005d('0x62')](_0x005d('0x65'),ISPEECH_API,_0x158eb7,_0x3239dd,base64Encode(_0xf31efc),_0x591460?util[_0x005d('0x62')]('model=%s',encodeURIComponent(_0x591460)):_0x005d('0x66'));return uploadFile(_0x3e8220)['then'](function(_0x185a56){return querystring[_0x005d('0x4')](_0x185a56);});};exports[_0x005d('0x67')]=function(_0x2024f5,_0x59b9ad){return sestek['nda'](_0x2024f5,_0x59b9ad)[_0x005d('0x2e')](function(_0x865fcb){logger[_0x005d('0x1e')](JSON['stringify'](_0x865fcb));var _0x26a432={'speech':_0x865fcb['text'],'action':_0x865fcb['channelData']?_0x865fcb[_0x005d('0x68')][_0x005d('0x69')]:undefined,'actiondata':_0x865fcb[_0x005d('0x68')]?_0x865fcb[_0x005d('0x68')][_0x005d('0x6a')]:undefined};if(_0x865fcb[_0x005d('0x68')]&&_0x865fcb[_0x005d('0x68')]['AudioFromTts']){return base64Decode(_0x865fcb[_0x005d('0x68')][_0x005d('0x6b')]['Data'],path[_0x005d('0x2b')](__dirname,_0x005d('0x3e'),rs[_0x005d('0x3a')](0x4)+_0x005d('0x2c')))[_0x005d('0x2e')](function(_0x18ee83){_0x26a432['audiofile']=_0x18ee83;return _0x26a432;});}return _0x26a432;});};exports[_0x005d('0x6c')]=function(){return __dirname;}; \ No newline at end of file +var _0x47c0=['generate','.wav','writeFileSync','base64','then','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','audioContent','chmodSync','googleTTS','goggleTTS\x20path','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','asr','unlink','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','stringify','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','sestekNDA','nda','CustomAction','CustomActionData','channelData','AudioFromTts','Data','dirName','path','url','parse','sox','request-promise','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','../../../config/logger','agi','protocol','host','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','download\x20error','pipe','end','https:','WHAT_EVER','get','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve'];(function(_0xfa3c5c,_0x3f68be){var _0x5df3e2=function(_0x1c7ffc){while(--_0x1c7ffc){_0xfa3c5c['push'](_0xfa3c5c['shift']());}};_0x5df3e2(++_0x3f68be);}(_0x47c0,0xa9));var _0x047c=function(_0x4088e0,_0x3484a4){_0x4088e0=_0x4088e0-0x0;var _0x183709=_0x47c0[_0x4088e0];return _0x183709;};'use strict';var fs=require('fs');var path=require(_0x047c('0x0'));var http=require('http');var https=require('https');var urlParse=require(_0x047c('0x1'))[_0x047c('0x2')];var BPromise=require('bluebird');var rs=require('randomstring');var sox=require(_0x047c('0x3'));var rp=require(_0x047c('0x4'));var util=require('util');var querystring=require('querystring');var tts=require(_0x047c('0x5'));var apiai=require(_0x047c('0x6'));var md5=require(_0x047c('0x7'));var google=require(_0x047c('0x8'));var aws=require(_0x047c('0x9'));var tilde=require(_0x047c('0xa'));var sestek=require('./sestek');var logger=require(_0x047c('0xb'))(_0x047c('0xc'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x2427bd,_0x4a74fd){return new BPromise(function(_0x3ed46b,_0x13d1f8){var _0x2ebfab=urlParse(_0x2427bd);var _0xdae0b8=_0x2ebfab[_0x047c('0xd')]==='https:'?https:http;var _0x349f27={'host':_0x2ebfab[_0x047c('0xe')],'path':_0x2ebfab[_0x047c('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0xdae0b8['get'](_0x349f27,function(_0x13567f){if(_0x13567f[_0x047c('0xf')]!==0xc8){logger[_0x047c('0x10')](_0x047c('0x11')+_0x2427bd+_0x047c('0x12')+_0x13567f[_0x047c('0xf')]+'\x20('+_0x13567f[_0x047c('0x13')]+')');_0x13d1f8(new Error(_0x047c('0x11')+_0x2427bd+_0x047c('0x12')+_0x13567f['statusCode']+'\x20('+_0x13567f[_0x047c('0x13')]+')'));return;}var _0xa28fb=fs[_0x047c('0x14')](_0x4a74fd);_0xa28fb['on'](_0x047c('0x15'),function(){logger[_0x047c('0x16')](_0x047c('0x17'));_0xa28fb['close'](_0x3ed46b);});_0xa28fb['on'](_0x047c('0x10'),function(_0x25a72a){fs['unlink'](_0x4a74fd);logger[_0x047c('0x10')](_0x047c('0x18'),_0x25a72a);_0x13d1f8(_0x25a72a);});_0x13567f[_0x047c('0x19')](_0xa28fb);})['on']('error',function(_0x54d955){logger[_0x047c('0x10')](_0x54d955);_0x13d1f8(_0x54d955);})[_0x047c('0x1a')]();});}function uploadFile(_0x5d5051){return new BPromise(function(_0x50d586,_0x38d2d1){var _0x40f1a6=urlParse(_0x5d5051);var _0x4237a5=_0x40f1a6[_0x047c('0xd')]===_0x047c('0x1b')?https:http;var _0x5e0021={'host':_0x40f1a6[_0x047c('0xe')],'path':_0x40f1a6[_0x047c('0x0')],'headers':{'user-agent':_0x047c('0x1c')}};_0x4237a5[_0x047c('0x1d')](_0x5e0021,function(_0xc4145b){if(_0xc4145b[_0x047c('0xf')]!==0xc8){_0x38d2d1(new Error(_0x047c('0x11')+_0x5d5051+_0x047c('0x12')+_0xc4145b[_0x047c('0xf')]+'\x20('+_0xc4145b['statusMessage']+')'));return;}var _0x47db4a='';_0xc4145b['on'](_0x047c('0x1e'),function(_0x5d7667){_0x47db4a+=_0x5d7667;});_0xc4145b['on'](_0x047c('0x1a'),function(){_0x50d586(_0x47db4a);});})['on'](_0x047c('0x10'),function(_0x22796a){_0x38d2d1(_0x22796a);})[_0x047c('0x1a')]();});}function convertFile(_0x596289,_0x69ceac){return new BPromise(function(_0x4932c9,_0x40d81f){var _0x252a97=sox[_0x047c('0x1f')](_0x596289,_0x69ceac,{'sampleRate':0x1f40,'format':_0x047c('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x252a97['on'](_0x047c('0x10'),function(_0x42c857){logger[_0x047c('0x10')](_0x047c('0x21'),_0x42c857);_0x40d81f(_0x42c857);});_0x252a97['on'](_0x047c('0x1a'),function(){logger[_0x047c('0x16')](_0x047c('0x22'));_0x4932c9();});_0x252a97[_0x047c('0x23')]();});}function base64Decode(_0x57656f,_0x132f4f){var _0x288cd5=path[_0x047c('0x24')](__dirname,'tmp',rs[_0x047c('0x25')](0x4)+_0x047c('0x26'));fs[_0x047c('0x27')](_0x288cd5,_0x57656f,_0x047c('0x28'));return convertFile(_0x288cd5,_0x132f4f)[_0x047c('0x29')](function(){try{fs['unlink'](_0x288cd5);fs['chmodSync'](_0x132f4f,_0x047c('0x2a'));}catch(_0x2af63c){logger[_0x047c('0x10')](_0x2af63c);}return _0x132f4f[_0x047c('0x2b')]('.')[0x0];});}function base64Encode(_0x2a7125){var _0x352512=fs[_0x047c('0x2c')](_0x2a7125);return new Buffer(_0x352512)['toString'](_0x047c('0x28'));}exports[_0x047c('0x2d')]=function(_0x3c5ea2,_0x18cec3,_0x3e3a47,_0x560980,_0x1bac19,_0x25b38f){var _0x2ba760,_0x4922ec;var _0x41bd82=_0x047c('0x2e');var _0x3a1e5e='?key='+_0x3c5ea2;var _0x547da9={};if(_0x18cec3===_0x047c('0x2f')){_0x547da9[_0x047c('0x30')]={'ssml':_0x3e3a47};}else{_0x547da9[_0x047c('0x30')]={'text':_0x3e3a47};};_0x547da9[_0x047c('0x31')]={'languageCode':_0x560980,'ssmlGender':_0x1bac19};_0x547da9[_0x047c('0x32')]={'audioEncoding':_0x047c('0x33'),'sampleRateHertz':0x1f40};var _0x51b7d0={'url':_0x41bd82+_0x047c('0x34')+_0x3a1e5e,'method':_0x047c('0x35'),'json':!![],'body':_0x547da9};return rp(_0x51b7d0)['then'](function(_0x14c2ae){return new BPromise(function(_0x137edc,_0x26d83c){_0x2ba760=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs[_0x047c('0x25')](0x4)+_0x047c('0x37'));var _0x4d5b4a=Buffer['from'](_0x14c2ae[_0x047c('0x38')],'base64');return fs['writeFile'](_0x2ba760,_0x4d5b4a,function(_0x1b61ff){_0x26d83c(_0x1b61ff);},function(_0x3d0a9b){fs[_0x047c('0x39')](_0x2ba760,'777');_0x137edc(_0x3d0a9b);});});})[_0x047c('0x29')](function(_0x3f6a85){_0x4922ec=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs['generate'](0x4)+'.wav');return convertFile(_0x2ba760,_0x4922ec);})['then'](function(){try{fs['unlink'](_0x2ba760);fs[_0x047c('0x39')](_0x4922ec,'777');}catch(_0x1055c2){logger[_0x047c('0x10')](_0x1055c2);}logger[_0x047c('0x16')]('googleCloudTTS\x20path',_0x4922ec['split']('.')[0x0]);return _0x4922ec[_0x047c('0x2b')]('.')[0x0];});};exports[_0x047c('0x3a')]=function(_0x2b978c,_0x151721){var _0x2f7c33,_0x6dbde2;return tts(_0x2b978c,_0x151721||'en',0x1)[_0x047c('0x29')](function(_0x9dc6be){logger[_0x047c('0x16')](_0x9dc6be);_0x2f7c33=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs[_0x047c('0x25')](0x4)+_0x047c('0x37'));return downloadFile(_0x9dc6be,_0x2f7c33);})[_0x047c('0x29')](function(){_0x6dbde2=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs['generate'](0x4)+'.wav');return convertFile(_0x2f7c33,_0x6dbde2);})[_0x047c('0x29')](function(){try{fs['unlink'](_0x2f7c33);fs[_0x047c('0x39')](_0x6dbde2,_0x047c('0x2a'));}catch(_0xc776e8){logger[_0x047c('0x10')](_0xc776e8);}logger[_0x047c('0x16')](_0x047c('0x3b'),_0x6dbde2[_0x047c('0x2b')]('.')[0x0]);return _0x6dbde2[_0x047c('0x2b')]('.')[0x0];});};exports['googleASR']=function(_0x673c6b,_0x406668,_0x515fee){return google['asr'](_0x673c6b,_0x406668,_0x515fee)['then'](function(_0x58170c){logger[_0x047c('0x16')](_0x58170c['uri']);return rp(_0x58170c);})[_0x047c('0x29')](function(_0x28bfc8){var _0xf7cc89='';var _0x4cd5ad=0x0;try{fs['unlink'](_0x673c6b);}catch(_0x237494){logger['error'](_0x237494);}if(_0x28bfc8&&_0x28bfc8[_0x047c('0x3c')]){_0xf7cc89=_0x28bfc8['results'][_0x047c('0x3d')](function(_0x42e438){return _0x42e438&&_0x42e438[_0x047c('0x3e')][0x0]&&_0x42e438[_0x047c('0x3e')][0x0][_0x047c('0x3f')]?_0x42e438['alternatives'][0x0][_0x047c('0x3f')]:'';})['join']('\x0a');_0x4cd5ad=_0x28bfc8[_0x047c('0x3c')][_0x047c('0x3d')](function(_0x1f7e08){return _0x1f7e08&&_0x1f7e08[_0x047c('0x3e')][0x0]&&_0x1f7e08['alternatives'][0x0][_0x047c('0x40')]?_0x1f7e08[_0x047c('0x3e')][0x0][_0x047c('0x40')]:0x0;})[_0x047c('0x41')]('\x0a');}logger[_0x047c('0x16')](_0x047c('0x42'),_0xf7cc89);logger[_0x047c('0x16')]('googleASR\x20confidence',_0x4cd5ad);return{'transcript':_0xf7cc89,'confidence':_0x4cd5ad};})['catch'](function(_0x12f7ab){logger[_0x047c('0x10')]('[%s]\x20%s:%s',_0x12f7ab[_0x047c('0xf')],_0x12f7ab[_0x047c('0x43')],_0x12f7ab[_0x047c('0x44')]);});};exports[_0x047c('0x45')]=function(_0x4169ea,_0x374c17,_0x2181c5,_0x5cfd0f){var _0x1c6ad5=apiai(_0x374c17,{'language':_0x5cfd0f||'en'});return _0x1c6ad5[_0x047c('0x46')](_0x2181c5,{'sessionId':md5(_0x4169ea)})['then'](function(_0x515ea2){logger['info'](JSON['stringify'](_0x515ea2));return{'source':_0x515ea2[_0x047c('0x47')][_0x047c('0x48')],'resolvedQuery':_0x515ea2[_0x047c('0x47')][_0x047c('0x49')],'action':_0x515ea2[_0x047c('0x47')]['action'],'actionIncomplete':_0x515ea2[_0x047c('0x47')][_0x047c('0x4a')],'speech':_0x515ea2[_0x047c('0x47')][_0x047c('0x4b')][_0x047c('0x4c')],'score':_0x515ea2[_0x047c('0x47')][_0x047c('0x4d')],'statusCode':_0x515ea2['status'][_0x047c('0x4e')],'endConversation':_0x515ea2['result'][_0x047c('0x4f')][_0x047c('0x50')]||![],'isFallbackIntent':_0x515ea2['result'][_0x047c('0x4f')][_0x047c('0x51')]};});};exports['tildeASR']=function(_0x12260a,_0x43d4ff,_0x173165,_0x5e87f0){return tilde[_0x047c('0x52')](_0x12260a,_0x43d4ff,_0x173165,_0x5e87f0)[_0x047c('0x29')](function(_0x1aa63c){try{fs[_0x047c('0x53')](_0x12260a);}catch(_0x415aff){logger['error'](_0x415aff);}logger[_0x047c('0x16')](_0x047c('0x54'),_0x1aa63c['transcript']);logger[_0x047c('0x16')](_0x047c('0x55'),_0x1aa63c[_0x047c('0x40')]);return _0x1aa63c;});};exports[_0x047c('0x56')]=function(_0x1886c7,_0x4e0ef9,_0xa53bc6,_0x5890de,_0x476571,_0x18c068){var _0x59d23e=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs[_0x047c('0x25')](0x4)+'.mp3');var _0x403497;return aws['polly'](_0x1886c7,_0x4e0ef9,_0xa53bc6,_0x5890de,_0x476571,_0x18c068,_0x59d23e)[_0x047c('0x29')](function(){_0x403497=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs[_0x047c('0x25')](0x4)+_0x047c('0x26'));return convertFile(_0x59d23e,_0x403497);})[_0x047c('0x29')](function(){try{fs[_0x047c('0x53')](_0x59d23e);fs['chmodSync'](_0x403497,_0x047c('0x2a'));}catch(_0x1f9524){logger[_0x047c('0x10')](_0x1f9524);}return _0x403497[_0x047c('0x2b')]('.')[0x0];});};exports[_0x047c('0x57')]=function(_0x574b55,_0x31ebdd,_0x2ab862,_0x5952af,_0x49f923,_0xe7004b){return aws[_0x047c('0x58')](_0x574b55,_0x31ebdd,_0x2ab862,_0x5952af,_0x49f923,_0xe7004b)['then'](function(_0x484453){logger['info'](JSON[_0x047c('0x59')](_0x484453));return _0x484453;});};exports[_0x047c('0x5a')]=function(_0x5aed4a,_0x5323a0,_0xe7639a,_0x23b660){var _0x3ad210=util[_0x047c('0x5b')](_0x047c('0x5c'),ISPEECH_API,_0x5aed4a,encodeURIComponent(_0x5323a0),_0xe7639a,_0x23b660);var _0x140985=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs['generate'](0x4)+_0x047c('0x37'));var _0x215f3b;return downloadFile(_0x3ad210,_0x140985)[_0x047c('0x29')](function(){_0x215f3b=path[_0x047c('0x24')](__dirname,_0x047c('0x36'),rs[_0x047c('0x25')](0x4)+_0x047c('0x26'));return convertFile(_0x140985,_0x215f3b);})['then'](function(){try{fs[_0x047c('0x53')](_0x140985);fs[_0x047c('0x39')](_0x215f3b,_0x047c('0x2a'));}catch(_0x23d528){logger[_0x047c('0x10')](_0x23d528);}return _0x215f3b[_0x047c('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x4b26e7,_0x1c3a5e,_0x571539,_0x4bdf31){var _0x58020c=util[_0x047c('0x5b')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1c3a5e,_0x571539,base64Encode(_0x4b26e7),_0x4bdf31?util[_0x047c('0x5b')](_0x047c('0x5d'),encodeURIComponent(_0x4bdf31)):_0x047c('0x5e'));return uploadFile(_0x58020c)[_0x047c('0x29')](function(_0xb8dd44){return querystring['parse'](_0xb8dd44);});};exports[_0x047c('0x5f')]=function(_0x2793ce,_0x15a5fe){return sestek[_0x047c('0x60')](_0x2793ce,_0x15a5fe)[_0x047c('0x29')](function(_0x207071){logger[_0x047c('0x16')](JSON[_0x047c('0x59')](_0x207071));var _0x55cc14={'speech':_0x207071['text'],'action':_0x207071['channelData']?_0x207071['channelData'][_0x047c('0x61')]:undefined,'actiondata':_0x207071['channelData']?_0x207071['channelData'][_0x047c('0x62')]:undefined};if(_0x207071[_0x047c('0x63')]&&_0x207071[_0x047c('0x63')][_0x047c('0x64')]){return base64Decode(_0x207071[_0x047c('0x63')]['AudioFromTts'][_0x047c('0x65')],path[_0x047c('0x24')](__dirname,'tmp',rs[_0x047c('0x25')](0x4)+_0x047c('0x26')))[_0x047c('0x29')](function(_0x509910){_0x55cc14['audiofile']=_0x509910;return _0x55cc14;});}return _0x55cc14;});};exports[_0x047c('0x66')]=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 e2c9580..3bd147f 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 _0x7d04=['./nda','exports'];(function(_0x47340a,_0x2abfc4){var _0x41967f=function(_0x5d095f){while(--_0x5d095f){_0x47340a['push'](_0x47340a['shift']());}};_0x41967f(++_0x2abfc4);}(_0x7d04,0x15c));var _0x47d0=function(_0x45dadc,_0x4b145d){_0x45dadc=_0x45dadc-0x0;var _0x293cf9=_0x7d04[_0x45dadc];return _0x293cf9;};var nda=require(_0x47d0('0x0'));module[_0x47d0('0x1')]={'nda':nda}; \ No newline at end of file +var _0xf3ff=['./nda'];(function(_0x37cd87,_0x125544){var _0x2f93b2=function(_0xf2888e){while(--_0xf2888e){_0x37cd87['push'](_0x37cd87['shift']());}};_0x2f93b2(++_0x125544);}(_0xf3ff,0xae));var _0xff3f=function(_0x3227ad,_0x2e193e){_0x3227ad=_0x3227ad-0x0;var _0x24ac0a=_0xf3ff[_0x3227ad];return _0x24ac0a;};var nda=require(_0xff3f('0x0'));module['exports']={'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 a16d852..9075615 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 _0xbe87=['channelData','audio/wav','CustomAction','custom_action','custom_action_data','stringify','request-promise','../../../../../config/logger','agi','exports','ndauth_url','/token','password','POST','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','text','access_token','project','body','ProjectName','ndagenerate_audio'];(function(_0x13aa7e,_0x775d0e){var _0x387b57=function(_0x42ac52){while(--_0x42ac52){_0x13aa7e['push'](_0x13aa7e['shift']());}};_0x387b57(++_0x775d0e);}(_0xbe87,0x7e));var _0x7be8=function(_0x57bd0a,_0x2977b9){_0x57bd0a=_0x57bd0a-0x0;var _0x4e994a=_0xbe87[_0x57bd0a];return _0x4e994a;};'use strict';var rp=require(_0x7be8('0x0'));var url=require('url');var logger=require(_0x7be8('0x1'))(_0x7be8('0x2'));module[_0x7be8('0x3')]=function(_0x2b342d,_0x1565a8){var _0x35a413={'method':'POST','uri':url['resolve'](_0x1565a8[_0x7be8('0x4')],_0x7be8('0x5')),'form':{'grant_type':_0x7be8('0x6'),'username':_0x1565a8['username'],'password':_0x1565a8[_0x7be8('0x6')]},'json':!![]};return rp(_0x35a413)['then'](function(_0x27ba42){var _0x1f7293={'method':_0x7be8('0x7'),'uri':url[_0x7be8('0x8')](_0x1565a8[_0x7be8('0x9')],_0x7be8('0xa')),'body':{'type':_0x1565a8[_0x7be8('0xb')]||_0x7be8('0xc'),'channelId':_0x7be8('0xd'),'conversation':{'id':_0x2b342d[_0x7be8('0xe')]},'from':{'id':_0x2b342d[_0x7be8('0xf')],'name':_0x2b342d['calleridname']},'recipient':{'id':_0x2b342d[_0x7be8('0x10')],'name':_0x2b342d[_0x7be8('0x11')]},'text':_0x1565a8[_0x7be8('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x27ba42[_0x7be8('0x13')]},'json':!![]};if(_0x1565a8[_0x7be8('0x14')]){_0x1f7293[_0x7be8('0x15')]['channelData'][_0x7be8('0x16')]=_0x1565a8[_0x7be8('0x14')];}if(_0x1565a8[_0x7be8('0x17')]=='1'){_0x1f7293['body'][_0x7be8('0x18')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7be8('0x19')};}if(_0x1565a8['custom_action']){_0x1f7293[_0x7be8('0x15')][_0x7be8('0x18')][_0x7be8('0x1a')]=_0x1565a8[_0x7be8('0x1b')];if(_0x1565a8[_0x7be8('0x1c')]){_0x1f7293[_0x7be8('0x15')][_0x7be8('0x18')]['CustomActionData']=_0x1565a8[_0x7be8('0x1c')];}}logger['info'](JSON[_0x7be8('0x1d')](_0x1f7293));return rp(_0x1f7293);});}; \ No newline at end of file +var _0xed3d=['ndagenerate_audio','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','agi','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0xed3d,0xbb));var _0xded3=function(_0x16b0c6,_0x1dc29e){_0x16b0c6=_0x16b0c6-0x0;var _0x559d36=_0xed3d[_0x16b0c6];return _0x559d36;};'use strict';var rp=require(_0xded3('0x0'));var url=require(_0xded3('0x1'));var logger=require('../../../../../config/logger')(_0xded3('0x2'));module['exports']=function(_0x497955,_0x3c2632){var _0x34bd75={'method':'POST','uri':url[_0xded3('0x3')](_0x3c2632[_0xded3('0x4')],_0xded3('0x5')),'form':{'grant_type':_0xded3('0x6'),'username':_0x3c2632[_0xded3('0x7')],'password':_0x3c2632[_0xded3('0x6')]},'json':!![]};return rp(_0x34bd75)['then'](function(_0x1e93f1){var _0x432962={'method':'POST','uri':url[_0xded3('0x3')](_0x3c2632[_0xded3('0x8')],_0xded3('0x9')),'body':{'type':_0x3c2632['ndaactivity_type']||_0xded3('0xa'),'channelId':_0xded3('0xb'),'conversation':{'id':_0x497955[_0xded3('0xc')]},'from':{'id':_0x497955[_0xded3('0xd')],'name':_0x497955['calleridname']},'recipient':{'id':_0x497955[_0xded3('0xe')],'name':_0x497955[_0xded3('0xf')]},'text':_0x3c2632[_0xded3('0x10')],'channelData':{}},'headers':{'Authorization':_0xded3('0x11')+_0x1e93f1[_0xded3('0x12')]},'json':!![]};if(_0x3c2632['project']){_0x432962[_0xded3('0x13')][_0xded3('0x14')][_0xded3('0x15')]=_0x3c2632[_0xded3('0x16')];}if(_0x3c2632[_0xded3('0x17')]=='1'){_0x432962[_0xded3('0x13')][_0xded3('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xded3('0x18')};}if(_0x3c2632[_0xded3('0x19')]){_0x432962[_0xded3('0x13')]['channelData']['CustomAction']=_0x3c2632['custom_action'];if(_0x3c2632[_0xded3('0x1a')]){_0x432962[_0xded3('0x13')][_0xded3('0x14')][_0xded3('0x1b')]=_0x3c2632[_0xded3('0x1a')];}}logger[_0xded3('0x1c')](JSON[_0xded3('0x1d')](_0x432962));return rp(_0x432962);});}; \ 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 08b0f6e..da25bca 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 _0x5557=['./lib/api','exports'];(function(_0x4c6d08,_0x3ed890){var _0x4d7854=function(_0x3eea59){while(--_0x3eea59){_0x4c6d08['push'](_0x4c6d08['shift']());}};_0x4d7854(++_0x3ed890);}(_0x5557,0xa0));var _0x7555=function(_0x2075fa,_0x18958d){_0x2075fa=_0x2075fa-0x0;var _0x5e065d=_0x5557[_0x2075fa];return _0x5e065d;};'use strict';var asr=require(_0x7555('0x0'));module[_0x7555('0x1')]=function(_0x404208,_0x19e8e9,_0x10e678,_0x397ba4){return asr(_0x404208,_0x19e8e9,_0x10e678,_0x397ba4);}; \ No newline at end of file +var _0x87d7=['./lib/api'];(function(_0x668dfe,_0x49c31b){var _0x32d759=function(_0x5622ff){while(--_0x5622ff){_0x668dfe['push'](_0x668dfe['shift']());}};_0x32d759(++_0x49c31b);}(_0x87d7,0xb4));var _0x787d=function(_0x5ddec9,_0x209a36){_0x5ddec9=_0x5ddec9-0x0;var _0x5abb94=_0x87d7[_0x5ddec9];return _0x5abb94;};'use strict';var asr=require(_0x787d('0x0'));module['exports']=function(_0x4d5ce5,_0x2993c4,_0x5729cd,_0x38fedd){return asr(_0x4d5ce5,_0x2993c4,_0x5729cd,_0x38fedd);}; \ 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 a5c9292..d5f9bf5 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 _0xedb0=['message','close','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','digest','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','Tilde\x20ASR\x20send\x20error','parse','status','result','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open'];(function(_0x5b3ed1,_0x4e00c4){var _0x2caed4=function(_0x2172f6){while(--_0x2172f6){_0x5b3ed1['push'](_0x5b3ed1['shift']());}};_0x2caed4(++_0x4e00c4);}(_0xedb0,0x160));var _0x0edb=function(_0x51e527,_0x343634){_0x51e527=_0x51e527-0x0;var _0x4de98e=_0xedb0[_0x51e527];return _0x4de98e;};'use strict';var BPromise=require(_0x0edb('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0edb('0x1'));var crypto=require(_0x0edb('0x2'));var logger=require(_0x0edb('0x3'))(_0x0edb('0x4'));module[_0x0edb('0x5')]=function(_0x8dae15,_0x2f066d,_0x2a04ac,_0x4c41da){return new BPromise(function(_0x3d402e,_0x153a6d){logger[_0x0edb('0x6')]('Tilde\x20URI',_0x4c41da||_0x0edb('0x7'));var _0xfa0e51=new WebSocket(_0x4c41da||_0x0edb('0x7'),{'perMessageDeflate':![]});var _0x345a0d='';var _0xeebfd0='0';var _0x50b43b='1';var _0x40dc82=_0x0edb('0x8');function _0x3460e0(_0x55fa74){var _0x4c8391=crypto['createHash']('sha1');_0x4c8391[_0x0edb('0x9')](_0x55fa74);return _0x4c8391[_0x0edb('0xa')]('hex');}function _0x2d48a0(){try{logger[_0x0edb('0x6')](_0x0edb('0xb'));var _0x799a25=moment()['unix']();var _0xff600f=_0x3460e0(_0x799a25+_0x2f066d+_0x2a04ac);_0xfa0e51[_0x0edb('0xc')](JSON[_0x0edb('0xd')]({'appID':_0x2f066d,'timestamp':_0x799a25,'appKey':_0xff600f}));var _0x1461bd=fs[_0x0edb('0xe')](_0x8dae15);_0x1461bd['on'](_0x0edb('0xf'),function(_0x5f1ee6){_0xfa0e51[_0x0edb('0xc')](_0x5f1ee6);});_0x1461bd['on']('close',function(){_0xfa0e51[_0x0edb('0xc')]('EOS');});}catch(_0x497f05){logger['error'](_0x0edb('0x10'),JSON[_0x0edb('0xd')](_0x497f05));_0xfa0e51['terminate']();}}function _0x1e01a8(_0x3e2f9a){try{if(_0x3e2f9a){var _0x149d57=JSON[_0x0edb('0x11')](_0x3e2f9a);switch(_0x149d57[_0x0edb('0x12')]){case 0x0:if(_0x149d57[_0x0edb('0x13')]){if(_0x149d57['result']['final']){logger[_0x0edb('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x149d57[_0x0edb('0x13')][_0x0edb('0x14')]));_0x345a0d=_0x149d57[_0x0edb('0x13')][_0x0edb('0x14')][0x0][_0x0edb('0x15')];_0xeebfd0=_0x149d57[_0x0edb('0x13')][_0x0edb('0x14')][0x0][_0x0edb('0x16')];_0x50b43b='0';_0x40dc82=_0x0edb('0x17');_0xfa0e51['terminate']();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x50b43b='1';_0x40dc82=_0x0edb('0x8');break;case 0x2:logger[_0x0edb('0x6')](_0x0edb('0x18'));_0x50b43b='2';_0x40dc82=_0x0edb('0x18');break;case 0x9:logger['info'](_0x0edb('0x19'));_0x50b43b='9';_0x40dc82=_0x0edb('0x19');break;case 0xa:logger[_0x0edb('0x6')]('Authentication\x20failed.');_0x50b43b='10';_0x40dc82=_0x0edb('0x1a');break;case 0xb:logger[_0x0edb('0x6')](_0x0edb('0x1b'));_0x50b43b='11';_0x40dc82=_0x0edb('0x1b');}}}catch(_0x1a81c6){logger[_0x0edb('0x1c')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x0edb('0xd')](_0x1a81c6));_0xfa0e51[_0x0edb('0x1d')]();}}function _0x2f403e(){logger[_0x0edb('0x6')](_0x0edb('0x1e'));_0x3d402e({'transcript':_0x345a0d,'confidence':_0xeebfd0,'status':_0x50b43b,'status_message':_0x40dc82});}function _0x1384ed(_0x5a3c58){logger['error'](_0x0edb('0x1f'));if(!_['isNil'](_0x5a3c58)){logger[_0x0edb('0x1c')](_['isObject'](_0x5a3c58)?JSON[_0x0edb('0xd')](_0x5a3c58):_0x5a3c58);}}_0xfa0e51['on'](_0x0edb('0x20'),_0x2d48a0);_0xfa0e51['on'](_0x0edb('0x21'),_0x1e01a8);_0xfa0e51['on'](_0x0edb('0x22'),_0x2f403e);_0xfa0e51['on'](_0x0edb('0x1c'),_0x1384ed);});}; \ No newline at end of file +var _0x56ed=['EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close'];(function(_0x53710d,_0x1a0eab){var _0x3a38c3=function(_0x15288d){while(--_0x15288d){_0x53710d['push'](_0x53710d['shift']());}};_0x3a38c3(++_0x1a0eab);}(_0x56ed,0x1f1));var _0xd56e=function(_0x4d729f,_0x52bf8b){_0x4d729f=_0x4d729f-0x0;var _0x5ce12a=_0x56ed[_0x4d729f];return _0x5ce12a;};'use strict';var BPromise=require(_0xd56e('0x0'));var _=require(_0xd56e('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xd56e('0x2'));var crypto=require(_0xd56e('0x3'));var logger=require('../../../../../../config/logger')(_0xd56e('0x4'));module['exports']=function(_0x547695,_0x2962c3,_0x16bb0b,_0x15f88a){return new BPromise(function(_0x2e8a2e,_0x38343a){logger[_0xd56e('0x5')](_0xd56e('0x6'),_0x15f88a||_0xd56e('0x7'));var _0x530647=new WebSocket(_0x15f88a||_0xd56e('0x7'),{'perMessageDeflate':![]});var _0x210425='';var _0x48a765='0';var _0x13cb79='1';var _0x588b50=_0xd56e('0x8');function _0x22caea(_0x32ea9b){var _0x4a4186=crypto['createHash'](_0xd56e('0x9'));_0x4a4186[_0xd56e('0xa')](_0x32ea9b);return _0x4a4186['digest'](_0xd56e('0xb'));}function _0x3934c5(){try{logger[_0xd56e('0x5')](_0xd56e('0xc'));var _0x115c50=moment()[_0xd56e('0xd')]();var _0xc6b718=_0x22caea(_0x115c50+_0x2962c3+_0x16bb0b);_0x530647[_0xd56e('0xe')](JSON[_0xd56e('0xf')]({'appID':_0x2962c3,'timestamp':_0x115c50,'appKey':_0xc6b718}));var _0x6e72d1=fs[_0xd56e('0x10')](_0x547695);_0x6e72d1['on'](_0xd56e('0x11'),function(_0x552c6a){_0x530647[_0xd56e('0xe')](_0x552c6a);});_0x6e72d1['on'](_0xd56e('0x12'),function(){_0x530647[_0xd56e('0xe')](_0xd56e('0x13'));});}catch(_0x1af703){logger[_0xd56e('0x14')](_0xd56e('0x15'),JSON[_0xd56e('0xf')](_0x1af703));_0x530647[_0xd56e('0x16')]();}}function _0x4f5b38(_0x275ce5){try{if(_0x275ce5){var _0x4cabd9=JSON[_0xd56e('0x17')](_0x275ce5);switch(_0x4cabd9[_0xd56e('0x18')]){case 0x0:if(_0x4cabd9[_0xd56e('0x19')]){if(_0x4cabd9[_0xd56e('0x19')][_0xd56e('0x1a')]){logger['info'](_0xd56e('0x1b'),JSON['stringify'](_0x4cabd9[_0xd56e('0x19')]['hypotheses']));_0x210425=_0x4cabd9['result'][_0xd56e('0x1c')][0x0][_0xd56e('0x1d')];_0x48a765=_0x4cabd9['result'][_0xd56e('0x1c')][0x0][_0xd56e('0x1e')];_0x13cb79='0';_0x588b50=_0xd56e('0x1f');_0x530647['terminate']();}}break;case 0x1:logger[_0xd56e('0x5')](_0xd56e('0x8'));_0x13cb79='1';_0x588b50=_0xd56e('0x8');break;case 0x2:logger[_0xd56e('0x5')](_0xd56e('0x20'));_0x13cb79='2';_0x588b50=_0xd56e('0x20');break;case 0x9:logger[_0xd56e('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x13cb79='9';_0x588b50=_0xd56e('0x21');break;case 0xa:logger[_0xd56e('0x5')]('Authentication\x20failed.');_0x13cb79='10';_0x588b50=_0xd56e('0x22');break;case 0xb:logger[_0xd56e('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x13cb79='11';_0x588b50=_0xd56e('0x23');}}}catch(_0x6e23e){logger[_0xd56e('0x14')](_0xd56e('0x24'),JSON[_0xd56e('0xf')](_0x6e23e));_0x530647['terminate']();}}function _0xd89d6d(){logger[_0xd56e('0x5')](_0xd56e('0x25'));_0x2e8a2e({'transcript':_0x210425,'confidence':_0x48a765,'status':_0x13cb79,'status_message':_0x588b50});}function _0x5a5cd5(_0x46f187){logger[_0xd56e('0x14')](_0xd56e('0x26'));if(!_[_0xd56e('0x27')](_0x46f187)){logger[_0xd56e('0x14')](_[_0xd56e('0x28')](_0x46f187)?JSON['stringify'](_0x46f187):_0x46f187);}}_0x530647['on'](_0xd56e('0x29'),_0x3934c5);_0x530647['on'](_0xd56e('0x2a'),_0x4f5b38);_0x530647['on'](_0xd56e('0x12'),_0xd89d6d);_0x530647['on'](_0xd56e('0x14'),_0x5a5cd5);});}; \ 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 0caa3ad..20a2dcf 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 _0x7257=['exports','./asr'];(function(_0x3594bb,_0x2758c4){var _0x783930=function(_0x3dd55c){while(--_0x3dd55c){_0x3594bb['push'](_0x3594bb['shift']());}};_0x783930(++_0x2758c4);}(_0x7257,0x7b));var _0x7725=function(_0x4186c3,_0x1c0521){_0x4186c3=_0x4186c3-0x0;var _0x23ff6c=_0x7257[_0x4186c3];return _0x23ff6c;};var asr=require(_0x7725('0x0'));module[_0x7725('0x1')]={'asr':asr}; \ No newline at end of file +var _0xd6bc=['./asr','exports'];(function(_0x40a29b,_0x275b30){var _0x56e29d=function(_0x572a8f){while(--_0x572a8f){_0x40a29b['push'](_0x40a29b['shift']());}};_0x56e29d(++_0x275b30);}(_0xd6bc,0x1a0));var _0xcd6b=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xd6bc[_0x525c7b];return _0x27b33e;};var asr=require(_0xcd6b('0x0'));module[_0xcd6b('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 9b25bff..df42389 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 _0x9bde=['error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','net','EventEmitter','./channel','127.0.0.1','call','emit'];(function(_0x26cb28,_0x17e7e7){var _0x10061a=function(_0xf77cab){while(--_0xf77cab){_0x26cb28['push'](_0x26cb28['shift']());}};_0x10061a(++_0x17e7e7);}(_0x9bde,0xe1));var _0xe9bd=function(_0x232326,_0x453414){_0x232326=_0x232326-0x0;var _0x18c4a2=_0x9bde[_0x232326];return _0x18c4a2;};'use strict';var util=require('util');var net=require(_0xe9bd('0x0'));var EventEmitter=require('events')[_0xe9bd('0x1')];var AGIError=require('./error');var AGIChannel=require(_0xe9bd('0x2'));var AGIServer=function(_0x3005aa,_0x131f6a,_0x1c1b34){var _0x10822d=this,_0x3005aa=_0x3005aa||0x11dd,_0x131f6a=_0x131f6a||_0xe9bd('0x3'),_0x4fd7b8=null,_0x4763e9=0x0;EventEmitter[_0xe9bd('0x4')](_0x10822d);function _0xa66ae2(){if(!_0x3005aa){_0x10822d[_0xe9bd('0x5')](_0xe9bd('0x6'),new AGIError(_0xe9bd('0x7')));return![];}_0x4fd7b8=net[_0xe9bd('0x8')]();_0x4fd7b8[_0xe9bd('0x9')](_0x3005aa,_0x131f6a);_0x4fd7b8['on'](_0xe9bd('0xa'),function(){_0x10822d['emit']('listening');});_0x4fd7b8['on'](_0xe9bd('0xb'),function(_0x145521){_0x4fd7b8[_0xe9bd('0xc')](function(_0x581ab9,_0x12c96e){if(_0x581ab9){_0x10822d[_0xe9bd('0x5')](_0xe9bd('0x6'),new AGIError(_0xe9bd('0xd'),_0x581ab9));}else if(_0x1c1b34&&_0x1c1b34<0x0){_0x10822d['emit'](_0xe9bd('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x145521[_0xe9bd('0xe')]();}else if(_0x1c1b34&&_0x1c1b34>0x0&&_0x1c1b34<_0x12c96e){_0x4763e9+=0x1;_0x10822d[_0xe9bd('0x5')](_0xe9bd('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x4763e9));_0x145521['destroy']();}else{var _0x46a95e=new AGIChannel(_0x145521);_0x46a95e['on'](_0xe9bd('0xf'),function(){_0x10822d[_0xe9bd('0x5')](_0xe9bd('0xb'),_0x46a95e);});}});});_0x4fd7b8['on'](_0xe9bd('0x6'),function(_0x389e7b){_0x10822d[_0xe9bd('0x5')]('error',new AGIError(_0xe9bd('0xd'),_0x389e7b[_0xe9bd('0x10')]));});_0x4fd7b8['on'](_0xe9bd('0x11'),function(){_0x10822d['emit'](_0xe9bd('0x11'),new AGIError(_0xe9bd('0x12')));});}process[_0xe9bd('0x13')](function(){_0xa66ae2();});};util[_0xe9bd('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x20ec32,_0x50a5e8,_0xc6b661){return new AGIServer(_0x20ec32,_0x50a5e8,_0xc6b661);}; \ No newline at end of file +var _0xca8d=['getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','exports','util','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection'];(function(_0x40736a,_0x4ed684){var _0x4a47aa=function(_0x4c2144){while(--_0x4c2144){_0x40736a['push'](_0x40736a['shift']());}};_0x4a47aa(++_0x4ed684);}(_0xca8d,0x172));var _0xdca8=function(_0x3576c0,_0x196351){_0x3576c0=_0x3576c0-0x0;var _0x310e7d=_0xca8d[_0x3576c0];return _0x310e7d;};'use strict';var util=require(_0xdca8('0x0'));var net=require(_0xdca8('0x1'));var EventEmitter=require(_0xdca8('0x2'))[_0xdca8('0x3')];var AGIError=require(_0xdca8('0x4'));var AGIChannel=require(_0xdca8('0x5'));var AGIServer=function(_0x1685a4,_0x4cfc92,_0x9e965e){var _0x3bae79=this,_0x1685a4=_0x1685a4||0x11dd,_0x4cfc92=_0x4cfc92||_0xdca8('0x6'),_0x4d6383=null,_0x3366d5=0x0;EventEmitter[_0xdca8('0x7')](_0x3bae79);function _0x2f034e(){if(!_0x1685a4){_0x3bae79[_0xdca8('0x8')]('error',new AGIError(_0xdca8('0x9')));return![];}_0x4d6383=net[_0xdca8('0xa')]();_0x4d6383[_0xdca8('0xb')](_0x1685a4,_0x4cfc92);_0x4d6383['on']('listening',function(){_0x3bae79[_0xdca8('0x8')](_0xdca8('0xc'));});_0x4d6383['on'](_0xdca8('0xd'),function(_0x4712c4){_0x4d6383[_0xdca8('0xe')](function(_0x349f88,_0x3dc3e3){if(_0x349f88){_0x3bae79[_0xdca8('0x8')](_0xdca8('0xf'),new AGIError('E_AGI_SERVER_ERROR',_0x349f88));}else if(_0x9e965e&&_0x9e965e<0x0){_0x3bae79['emit'](_0xdca8('0xf'),new AGIError(_0xdca8('0x10')));_0x4712c4[_0xdca8('0x11')]();}else if(_0x9e965e&&_0x9e965e>0x0&&_0x9e965e<_0x3dc3e3){_0x3366d5+=0x1;_0x3bae79[_0xdca8('0x8')](_0xdca8('0xf'),new AGIError(_0xdca8('0x12'),_0x3366d5));_0x4712c4[_0xdca8('0x11')]();}else{var _0x198148=new AGIChannel(_0x4712c4);_0x198148['on'](_0xdca8('0x13'),function(){_0x3bae79[_0xdca8('0x8')](_0xdca8('0xd'),_0x198148);});}});});_0x4d6383['on']('error',function(_0x571809){_0x3bae79[_0xdca8('0x8')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x571809[_0xdca8('0x14')]));});_0x4d6383['on']('close',function(){_0x3bae79[_0xdca8('0x8')](_0xdca8('0x15'),new AGIError(_0xdca8('0x16')));});}process['nextTick'](function(){_0x2f034e();});};util['inherits'](AGIServer,EventEmitter);module[_0xdca8('0x17')]=function(_0x17efc8,_0x30acb9,_0x2ae928){return new AGIServer(_0x17efc8,_0x30acb9,_0x2ae928);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index f7beb68..80f2ab4 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 _0x1678=['timezones','getPause','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','number','includes','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','speed','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','length','saveRestApiResult','isArray','%s.%s','replaceall\x20init','split','nextbracket','replaceAll','extra','toString','replaceall\x20end','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','noop','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','callback_priority','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','LUMENVOX_ASR_CONFIDENCE','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','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','setVariable','%s[%s][%s]','%s_ROWS_COUNT','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','getUser','DIAL','SIP/%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','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\x20ready\x20for\x20fulfillment','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','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechASR','ISPEECH_ASR_%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','no\x20key\x20configured','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','opts','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','record','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','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','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','user','bcc','service','host','port','secure','authentication','auth','pass','debug','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','odbc','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','rawHeaders','rawBody','menu','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','error','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','label','agicommand','arg_1','createSquareRecording','callerid','context','extension','priority','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','dialTimezone','VALUE\x20TZ','CALLERID(dialTimezone)','RES1','dialtimezone','utcOffset','minutestoadd','scheduledat\x20before','scheduledat','add','minutes','scheduledat\x20after','insertContact'];(function(_0x4257b6,_0x2348c7){var _0x4ad68c=function(_0x33a6e8){while(--_0x33a6e8){_0x4257b6['push'](_0x4257b6['shift']());}};_0x4ad68c(++_0x2348c7);}(_0x1678,0x17b));var _0x8167=function(_0x138cd8,_0x571956){_0x138cd8=_0x138cd8-0x0;var _0x17d006=_0x1678[_0x138cd8];return _0x17d006;};'use strict';var fs=require('fs');var path=require(_0x8167('0x0'));var util=require(_0x8167('0x1'));var _=require(_0x8167('0x2'));var sh=require(_0x8167('0x3'));var odbc=require(_0x8167('0x4'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0x8167('0x5'));var rp=require(_0x8167('0x6'));var logger=require(_0x8167('0x7'))(_0x8167('0x8'));var config=require(_0x8167('0x9'));var shared=require(_0x8167('0xa'));var scripts=require(_0x8167('0xb'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x8167('0xc'),_0x8167('0xd')];var verticesWithRetry=[_0x8167('0xe'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x210d5c,_0x381a87,_0x59d897){this[_0x8167('0xf')]=_0x210d5c;this[_0x8167('0x10')]=_0x381a87;this[_0x8167('0x11')]=_0x59d897;};AGIVertices[_0x8167('0x12')][_0x8167('0x13')]=function(_0x2dbfd4,_0x3c21a0){this['rpc']['getVariableById'](_0x2dbfd4)[_0x8167('0x14')](function(_0x4b5b3c){_0x3c21a0(null,_0x4b5b3c?_0x4b5b3c[_0x8167('0x15')]:![]);})[_0x8167('0x16')](function(_0x57753c){_0x3c21a0(_0x57753c);});};AGIVertices[_0x8167('0x12')][_0x8167('0x17')]=function(_0x4abe96,_0x438ee8){this['rpc']['getVoiceQueueById'](_0x4abe96)['then'](function(_0x491703){_0x438ee8(null,_0x491703?_0x491703[_0x8167('0x15')]:![]);})[_0x8167('0x16')](function(_0x2aab53){_0x438ee8(_0x2aab53);});};AGIVertices[_0x8167('0x12')][_0x8167('0x18')]=function(_0x3927ad,_0x271638){this[_0x8167('0x10')][_0x8167('0x19')](_0x3927ad)[_0x8167('0x14')](function(_0x5f4569){_0x271638(null,_0x5f4569?_0x5f4569[_0x8167('0x15')]:![]);})['catch'](function(_0x2c6255){_0x271638(_0x2c6255);});};AGIVertices['prototype'][_0x8167('0x1a')]=function(_0x383763,_0x4a67d2){this[_0x8167('0x10')][_0x8167('0x1b')](_0x383763)[_0x8167('0x14')](function(_0xdec74){_0x4a67d2(null,_0xdec74?_0xdec74[_0x8167('0x1c')]:![]);})[_0x8167('0x16')](function(_0x448cf8){_0x4a67d2(_0x448cf8);});};AGIVertices[_0x8167('0x12')]['getUser']=function(_0x21ac2f,_0x51e7bc){this['rpc'][_0x8167('0x1d')](_0x21ac2f)['then'](function(_0x5024a6){_0x51e7bc(null,_0x5024a6?_0x5024a6[_0x8167('0x15')]:![]);})[_0x8167('0x16')](function(_0xbf60c3){_0x51e7bc(_0xbf60c3);});};AGIVertices['prototype'][_0x8167('0x1e')]=function(_0x4aa682,_0x44e579){this['rpc'][_0x8167('0x1f')](_0x4aa682)[_0x8167('0x14')](function(_0x330883){_0x44e579(null,_0x330883?_0x330883['name']:![]);})[_0x8167('0x16')](function(_0x1cb49c){_0x44e579(_0x1cb49c);});};AGIVertices[_0x8167('0x12')][_0x8167('0x20')]=function(_0x643d1b,_0x10fb6c){var _0x3307ed=this;this['rpc'][_0x8167('0x21')](_0x643d1b)[_0x8167('0x14')](function(_0x5519e6){_0x10fb6c(null,_0x5519e6?_0x3307ed[_0x8167('0x22')](_0x5519e6[_0x8167('0x23')]):![]);})[_0x8167('0x16')](function(_0x23650d){_0x10fb6c(_0x23650d);});};AGIVertices[_0x8167('0x12')][_0x8167('0x24')]=function(_0x1c9968,_0x587f84){this[_0x8167('0x10')][_0x8167('0x25')](_0x1c9968)['then'](function(_0x147fb2){_0x587f84(null,_0x147fb2?_0x147fb2:![]);})[_0x8167('0x16')](function(_0x286aa3){_0x587f84(_0x286aa3);});};AGIVertices[_0x8167('0x12')][_0x8167('0x26')]=function(_0x4850ad,_0x13c927,_0x536f53){this[_0x8167('0x11')][_0x8167('0x26')](_0x4850ad,_0x13c927)[_0x8167('0x14')](function(){_0x536f53(null);})[_0x8167('0x16')](function(_0x423edb){_0x536f53(_0x423edb);});};AGIVertices['prototype']['getIntervals']=function(_0x4c5475,_0x5d936b){this[_0x8167('0x10')][_0x8167('0x27')](_0x4c5475)[_0x8167('0x14')](function(_0x26b22d){if(_0x26b22d){if(_0x26b22d[_0x8167('0x28')]){_0x5d936b(null,[_0x26b22d[_0x8167('0x29')]]);}else{_0x5d936b(null,_['map'](_0x26b22d[_0x8167('0x2a')],'interval'));}}else{_0x5d936b(null,![]);}})[_0x8167('0x16')](function(_0x43e21f){_0x5d936b(_0x43e21f);});};AGIVertices['prototype']['getSoundPath']=function(_0x105e1b){return util[_0x8167('0x2b')](_0x8167('0x2c'),FILES_PATH,_0x105e1b);};AGIVertices[_0x8167('0x12')][_0x8167('0x2d')]=function(_0x5df1d4,_0x4a6665,_0x69742f){odbc['open'](_0x5df1d4,function(_0x10d17b){if(_0x10d17b){logger[_0x8167('0x2e')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x10d17b);_0x69742f(_0x10d17b);}else{logger[_0x8167('0x2f')](_0x8167('0x30'));odbc[_0x8167('0x31')](_0x4a6665,function(_0x3fe248,_0x445c4d){if(_0x3fe248){logger[_0x8167('0x2f')](_0x8167('0x32'),_0x4a6665);_0x69742f(_0x3fe248);}else{logger[_0x8167('0x2f')](_0x8167('0x33'),_0x4a6665);odbc[_0x8167('0x34')](function(_0x1f5a30){if(_0x1f5a30){logger[_0x8167('0x2e')](_0x8167('0x35'),_0x1f5a30);}_0x69742f(null,_0x445c4d);});}});}});};AGIVertices[_0x8167('0x12')][_0x8167('0x36')]=function(_0x59a194,_0x146ea8){this['rpc'][_0x8167('0x37')](_0x59a194)['then'](function(_0x8de8ab){_0x146ea8(null,_0x8de8ab?_0x8de8ab:![]);})[_0x8167('0x16')](function(_0x5b6d09){_0x146ea8(_0x5b6d09);});};AGIVertices[_0x8167('0x12')]['createSmsMessage']=function(_0x5ed948,_0x40982e){this['rpc'][_0x8167('0x38')](_0x5ed948)['then'](function(_0x3ed87e){_0x40982e(null,_0x3ed87e);})[_0x8167('0x16')](function(_0x5eb774){_0x40982e(_0x5eb774);});};AGIVertices[_0x8167('0x12')][_0x8167('0x39')]=function(_0x2526a4,_0xd321bd,_0x296bcc){this[_0x8167('0x10')][_0x8167('0x39')]({'uniqueid':this[_0x8167('0xf')][_0x8167('0x3a')],'node':_0x2526a4[_0x8167('0x3b')],'application':_0x2526a4[_0x8167('0x3c')],'data':_0xd321bd||null,'project_name':this[_0x8167('0xf')][_0x8167('0x3d')],'callerid':this[_0x8167('0xf')]['callerid']})[_0x8167('0x14')](function(_0x1afcf5){if(_0x296bcc){_0x296bcc(null,_0x1afcf5);}})[_0x8167('0x16')](function(_0x5638c4){if(_0x296bcc){_0x296bcc(_0x5638c4);}});};AGIVertices[_0x8167('0x12')][_0x8167('0x3e')]=function(_0x18371b,_0x444eed,_0x46dec5,_0x214aa1){this[_0x8167('0x10')][_0x8167('0x3e')]({'uniqueid':this[_0x8167('0xf')][_0x8167('0x3a')],'callerid':this[_0x8167('0xf')][_0x8167('0x3f')],'calleridname':this[_0x8167('0xf')]['calleridname'],'context':this[_0x8167('0xf')][_0x8167('0x40')],'extension':this[_0x8167('0xf')][_0x8167('0x41')],'priority':this[_0x8167('0xf')][_0x8167('0x42')],'accountcode':this[_0x8167('0xf')]['accountcode'],'dnid':this[_0x8167('0xf')]['dnid'],'projectName':this[_0x8167('0xf')][_0x8167('0x3d')],'saveName':_0x444eed,'filename':_0x18371b[_0x8167('0x43')]||_0x444eed,'savePath':_0x46dec5})[_0x8167('0x14')](function(_0x46e666){_0x214aa1(null,_0x46e666);})['catch'](function(_0x374e43){_0x214aa1(_0x374e43);});};AGIVertices[_0x8167('0x12')][_0x8167('0x44')]=function(_0x96305,_0x28b70c,_0x50783b){this[_0x8167('0x10')][_0x8167('0x44')]({'uniqueid':this[_0x8167('0xf')][_0x8167('0x3a')],'body':_0x96305,'direction':_0x28b70c})[_0x8167('0x14')](function(_0x1227cd){if(_0x50783b){_0x50783b(null,_0x1227cd);}})[_0x8167('0x16')](function(_0x2bc3af){if(_0x50783b){_0x50783b(_0x2bc3af);}});};AGIVertices[_0x8167('0x12')][_0x8167('0x45')]=function(_0x2a38ef,_0x5b9f7d){console[_0x8167('0x46')](_0x8167('0x47'),_0x2a38ef);console[_0x8167('0x46')](_0x8167('0x48'),_0x5b9f7d);var _0x57126b=this;var _0x472cb2=0x0;var _0x2230b9={'firstName':_[_0x8167('0x49')](_0x2a38ef[_0x8167('0x15')])||_[_0x8167('0x4a')](_0x2a38ef[_0x8167('0x15')])?_0x8167('0x4b')+Math[_0x8167('0x4c')]():_0x2a38ef[_0x8167('0x15')],'lastName':_['isEmpty'](_0x2a38ef[_0x8167('0x4d')])||_['isNil'](_0x2a38ef[_0x8167('0x4d')])?null:_0x2a38ef[_0x8167('0x4d')],'phone':_0x2a38ef[_0x8167('0x4e')],'ListId':_0x2a38ef[_0x8167('0x4f')],'scheduledat':_0x2a38ef[_0x8167('0x50')],'callbackUniqueid':this[_0x8167('0xf')]['uniqueid'],'tags':_0x8167('0x51'),'description':'Callback\x20scheduled\x20at\x20'+_0x2a38ef[_0x8167('0x50')]['toString'](),'priority':_0x2a38ef['callback_priority']};if(_['has'](_0x2a38ef,_0x8167('0x52'))){if(!_['isNil'](_0x2a38ef[_0x8167('0x52')])){var _0x160460=_0x2a38ef['dialTimezone'];console[_0x8167('0x46')](_0x8167('0x53'),_0x160460);if(_0x2a38ef[_0x8167('0x52')]==_0x8167('0x54')){this[_0x8167('0x10')]['getContactByPhone']({'phone':_0x2a38ef['phone']})[_0x8167('0x14')](function(_0x59c776){console['log'](_0x8167('0x55'),_0x59c776);var _0x1efa3d=_0x59c776[_0x8167('0x52')];console[_0x8167('0x46')](_0x8167('0x56'),_0x1efa3d);if(!_[_0x8167('0x4a')](_0x1efa3d)){var _0x2087a4=shared['timezones'][_0x1efa3d];console['log']('tz',_0x2087a4);if(!_[_0x8167('0x4a')](_0x2087a4)){var _0x3c43a7=_0x2087a4[_0x8167('0x57')];console['log'](_0x8167('0x58'),_0x3c43a7);console[_0x8167('0x46')](_0x8167('0x59'),_0x2230b9[_0x8167('0x5a')]);_0x2230b9[_0x8167('0x5a')]=moment(_0x2a38ef[_0x8167('0x5a')])[_0x8167('0x5b')](_0x3c43a7,_0x8167('0x5c'));console[_0x8167('0x46')](_0x8167('0x5d'),_0x2230b9[_0x8167('0x5a')]);_0x57126b[_0x8167('0x10')][_0x8167('0x5e')](_0x2230b9,_0x2a38ef,_0x5b9f7d)[_0x8167('0x14')](function(_0x13338c){_0x5b9f7d(null,_0x13338c);})['catch'](function(_0x3e2f68){_0x5b9f7d(_0x3e2f68);});}else{_0x57126b[_0x8167('0x10')]['insertContact'](_0x2230b9,_0x2a38ef,_0x5b9f7d)[_0x8167('0x14')](function(_0x1c59d0){_0x5b9f7d(null,_0x1c59d0);})['catch'](function(_0xfaf8d1){_0x5b9f7d(_0xfaf8d1);});}}else{_0x57126b['rpc'][_0x8167('0x5e')](_0x2230b9,_0x2a38ef,_0x5b9f7d)[_0x8167('0x14')](function(_0x37b641){_0x5b9f7d(null,_0x37b641);})[_0x8167('0x16')](function(_0x16e5bc){_0x5b9f7d(_0x16e5bc);});}});}else{var _0x472cb2=shared[_0x8167('0x5f')][_0x160460];if(!_[_0x8167('0x4a')](_0x472cb2)){var _0x2e4e07=-0x1*_0x472cb2[_0x8167('0x57')];_0x2230b9[_0x8167('0x5a')]=moment(_0x2a38ef['scheduledat'])[_0x8167('0x5b')](_0x2e4e07,_0x8167('0x5c'));_0x57126b[_0x8167('0x10')][_0x8167('0x5e')](_0x2230b9,_0x2a38ef,_0x5b9f7d)[_0x8167('0x14')](function(_0x3eb887){_0x5b9f7d(null,_0x3eb887);})[_0x8167('0x16')](function(_0x3b6cdd){_0x5b9f7d(_0x3b6cdd);});}else{_0x57126b['rpc'][_0x8167('0x5e')](_0x2230b9,_0x2a38ef,_0x5b9f7d)[_0x8167('0x14')](function(_0x50c706){_0x5b9f7d(null,_0x50c706);})[_0x8167('0x16')](function(_0x3e48fa){_0x5b9f7d(_0x3e48fa);});}}}else{_0x57126b[_0x8167('0x10')][_0x8167('0x5e')](_0x2230b9,_0x2a38ef,_0x5b9f7d)[_0x8167('0x14')](function(_0x54ec97){_0x5b9f7d(null,_0x54ec97);})[_0x8167('0x16')](function(_0x2d9324){_0x5b9f7d(_0x2d9324);});}}else{_0x57126b['rpc'][_0x8167('0x5e')](_0x2230b9,_0x2a38ef,_0x5b9f7d)[_0x8167('0x14')](function(_0x4f944f){_0x5b9f7d(null,_0x4f944f);})[_0x8167('0x16')](function(_0x18a1b2){_0x5b9f7d(_0x18a1b2);});}};AGIVertices[_0x8167('0x12')][_0x8167('0x5e')]=function(_0x412cfe,_0x146a7b,_0x49de94){this[_0x8167('0x10')][_0x8167('0x45')](_0x412cfe)[_0x8167('0x14')](function(_0x26d141){_0x49de94(null,_0x26d141);})['catch'](function(_0x2935fe){_0x49de94(_0x2935fe);});};AGIVertices[_0x8167('0x12')][_0x8167('0x60')]=function(_0x4e1281,_0x16efb4){this[_0x8167('0x10')]['getPauseById'](_0x4e1281)[_0x8167('0x14')](function(_0x28beb1){_0x16efb4(null,_0x28beb1?_0x28beb1['name']:![]);})[_0x8167('0x16')](function(_0x63bd63){_0x16efb4(_0x63bd63);});};AGIVertices['prototype'][_0x8167('0x61')]=function(_0x205f4a,_0x12a83b,_0x37fb6e){var _0x12c2a7={'role':'agent'};_0x12c2a7[_0x205f4a]=this[_0x8167('0xf')]['callerid'];this[_0x8167('0x10')][_0x8167('0x61')](_0x12c2a7,_0x12a83b,this['channel'][_0x8167('0x3a')])[_0x8167('0x14')](function(_0x21c69b){_0x37fb6e(null,_[_0x8167('0x4a')](_0x21c69b)?![]:!![]);})[_0x8167('0x16')](function(_0xfc95fb){logger['error'](_0xfc95fb);_0x37fb6e(null,![]);});};AGIVertices[_0x8167('0x12')][_0x8167('0x62')]=function(_0x3b0456,_0x46accf){var _0x355661={'role':_0x8167('0x63')};_0x355661[_0x3b0456]=this[_0x8167('0xf')][_0x8167('0x3f')];this[_0x8167('0x10')][_0x8167('0x62')](_0x355661)[_0x8167('0x14')](function(_0x2feae6){_0x46accf(null,_[_0x8167('0x4a')](_0x2feae6)?![]:!![]);})[_0x8167('0x16')](function(_0x19e22d){logger[_0x8167('0x2e')](_0x19e22d);_0x46accf(null,![]);});};AGIVertices[_0x8167('0x12')][_0x8167('0x64')]=function(_0x393907,_0x3b2a03){var _0x30ba80={'role':'agent'};_0x30ba80[_0x393907]=this[_0x8167('0xf')][_0x8167('0x3f')];this[_0x8167('0x10')][_0x8167('0x64')](_0x30ba80)['then'](function(_0x15e7c6){_0x3b2a03(null,_[_0x8167('0x4a')](_0x15e7c6)?![]:!![]);})[_0x8167('0x16')](function(_0x498f33){logger[_0x8167('0x2e')](_0x498f33);_0x3b2a03(null,![]);});};AGIVertices[_0x8167('0x12')][_0x8167('0x65')]=function(_0x4544b3,_0x4d5075){var _0x4a5897={'role':_0x8167('0x63')};_0x4a5897[_0x4544b3]=this[_0x8167('0xf')]['callerid'];var _0xc35e78=_0x4544b3!=_0x8167('0x66')?util['format'](_0x8167('0x67'),_0x8167('0x68'),this[_0x8167('0xf')][_0x8167('0x3f')]):undefined;this[_0x8167('0x10')][_0x8167('0x65')](_0x4a5897,_0xc35e78)[_0x8167('0x14')](function(_0x1f5db4){_0x4d5075(null,_[_0x8167('0x4a')](_0x1f5db4)?![]:!![]);})[_0x8167('0x16')](function(_0x4097f4){logger[_0x8167('0x2e')](_0x4097f4);_0x4d5075(null,![]);});};AGIVertices[_0x8167('0x12')][_0x8167('0x69')]=function(_0x14a601,_0x517ed7){sh[_0x8167('0x6a')](_[_0x8167('0x6b')](_0x14a601),function(_0x371a46,_0x2b592c){var _0x5dd04c=_0x2b592c[_0x8167('0x6c')](/(\r\n|\n|\r)/gm,'');_0x517ed7(null,_0x5dd04c);});};AGIVertices[_0x8167('0x12')]['googleCloudTTS']=function(_0x25432d,_0x7d44fa){scripts['googleCloudTTS'](_0x25432d[_0x8167('0x6d')],_0x25432d[_0x8167('0x6e')]||_0x8167('0x6f'),_0x25432d[_0x8167('0x6f')],_0x25432d[_0x8167('0x70')]||_0x8167('0x71'),_0x25432d[_0x8167('0x72')]||_0x8167('0x73'),_0x25432d[_0x8167('0x74')]||_0x8167('0x75'))[_0x8167('0x14')](function(_0xb6017e){_0x7d44fa(null,_0xb6017e);})['catch'](function(_0x1c93ce){_0x7d44fa(_0x1c93ce);});};AGIVertices['prototype'][_0x8167('0x76')]=function(_0x5126dc,_0x213ad3){scripts[_0x8167('0x76')](_0x5126dc[_0x8167('0x6f')],_0x5126dc[_0x8167('0x77')]||'en',0x1)['then'](function(_0x471a96){_0x213ad3(null,_0x471a96);})['catch'](function(_0x44f6f9){_0x213ad3(_0x44f6f9);});};AGIVertices[_0x8167('0x12')][_0x8167('0x78')]=function(_0x5d98cb,_0x279c51){var _0x54fc0e={'uri':_0x5d98cb['url'],'method':_0x5d98cb[_0x8167('0x79')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5d98cb[_0x8167('0x7a')])===_0x8167('0x7b')&&parseInt(_0x5d98cb[_0x8167('0x7a')])>=0x1?parseInt(_0x5d98cb[_0x8167('0x7a')])*0x3e8:0x5*0x3e8};if(_[_0x8167('0x7c')](['POST',_0x8167('0x7d')],_0x54fc0e['method'][_0x8167('0x7e')]())){try{_0x54fc0e[_0x8167('0x7f')]=_0x5d98cb[_0x8167('0xd')]?JSON[_0x8167('0x80')](_0x5d98cb[_0x8167('0xd')]):{};}catch(_0x105a0c){logger[_0x8167('0x2e')](_0x8167('0x81'),_0x105a0c);}}try{_0x54fc0e[_0x8167('0x82')]=_0x5d98cb['rawHeaders']?JSON['parse'](_0x5d98cb[_0x8167('0xc')]):{};}catch(_0x140456){logger[_0x8167('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x140456);}if(_0x5d98cb[_0x8167('0x83')]){try{var _0x6deb0=require(_0x5d98cb[_0x8167('0x83')])[_0x8167('0x84')](this,_0x54fc0e);_0x54fc0e[_0x8167('0x85')]=Mustache[_0x8167('0x86')](_0x5d98cb[_0x8167('0x87')],_0x6deb0,{},['$$','$$']);if(_0x54fc0e[_0x8167('0x82')]){_0x54fc0e['headers']=JSON[_0x8167('0x80')](Mustache['render'](JSON[_0x8167('0x88')](_0x54fc0e[_0x8167('0x82')]),_0x6deb0,{},['$$','$$']));}if(_0x54fc0e['body']){_0x54fc0e['body']=JSON['parse'](Mustache[_0x8167('0x86')](JSON[_0x8167('0x88')](_0x54fc0e[_0x8167('0x7f')]),_0x6deb0,{},['$$','$$']));}}catch(_0x253130){logger[_0x8167('0x2e')](_0x8167('0x89'),_0x253130);}}rp(_0x54fc0e)[_0x8167('0x14')](function(_0x28a945){var _0x5e6229={'statusCode':_0x28a945[_0x8167('0x8a')]||0xc8,'statusMessage':_0x28a945[_0x8167('0x8b')]||'OK','headers':_0x28a945[_0x8167('0x82')]||{},'body':_0x28a945[_0x8167('0x7f')]||{}};_0x279c51(null,_0x5e6229);})[_0x8167('0x16')](function(_0x37573d){var _0x57fbda={'statusCode':_0x37573d[_0x8167('0x8a')]||0x1f4,'statusMessage':_0x37573d[_0x8167('0x8c')]||_0x8167('0x8d'),'headers':_0x37573d[_0x8167('0x8e')][_0x8167('0x82')]||{},'body':_0x37573d[_0x8167('0x8e')][_0x8167('0x7f')]||{}};_0x279c51(null,_0x57fbda);});};AGIVertices['prototype'][_0x8167('0x8f')]=function(_0x267b39,_0x395948){scripts[_0x8167('0x8f')](this['channel'][_0x8167('0x3a')],_0x267b39[_0x8167('0x90')],_0x267b39['text'],_0x267b39[_0x8167('0x91')]||'en')[_0x8167('0x14')](function(_0x440e45){_0x395948(null,_0x440e45);})[_0x8167('0x16')](function(_0x1d797c){_0x395948(_0x1d797c);});};AGIVertices[_0x8167('0x12')][_0x8167('0x92')]=function(_0x3fb461,_0xe2b139){scripts[_0x8167('0x92')](this['channel'],_0x3fb461)[_0x8167('0x14')](function(_0x206c9a){_0xe2b139(null,_0x206c9a);})['catch'](function(_0x36526f){_0xe2b139(_0x36526f);});};AGIVertices['prototype']['ispeechTTS']=function(_0x44b310,_0x366bf6){scripts[_0x8167('0x93')](_0x44b310[_0x8167('0x90')],_0x44b310[_0x8167('0x6f')],_0x44b310['ispeech_tts_language']||_0x8167('0x71'),_0x44b310[_0x8167('0x94')])[_0x8167('0x14')](function(_0x3cc953){_0x366bf6(null,_0x3cc953);})['catch'](function(_0x3cc6c3){_0x366bf6(_0x3cc6c3);});};AGIVertices[_0x8167('0x12')]['ispeechASR']=function(_0x4367f2,_0x5021f2,_0x22e342){scripts['ispeechASR'](_0x5021f2,_0x4367f2[_0x8167('0x90')],_0x4367f2['ispeech_asr_language']||_0x8167('0x71'),this['isConfigured'](_0x4367f2[_0x8167('0x95')])?_0x4367f2['model']:undefined)['then'](function(_0x229ff1){_0x22e342(null,_0x229ff1);})[_0x8167('0x16')](function(_0x40bcf6){_0x22e342(_0x40bcf6);});};AGIVertices['prototype'][_0x8167('0x96')]=function(_0x2c7050,_0x25858e){scripts['awsPolly'](_0x2c7050['aws_access_key_id'],_0x2c7050[_0x8167('0x97')],_0x2c7050[_0x8167('0x98')],_0x2c7050[_0x8167('0x99')]||'Amy',_0x2c7050[_0x8167('0x6f')],_0x2c7050[_0x8167('0x9a')]||'text')[_0x8167('0x14')](function(_0x57387f){_0x25858e(null,_0x57387f);})[_0x8167('0x16')](function(_0x4196ba){_0x25858e(_0x4196ba);});};AGIVertices[_0x8167('0x12')]['awsLex']=function(_0x4ff56e,_0x5ca783){scripts['awsLex'](this['channel'][_0x8167('0x3a')],_0x4ff56e['aws_access_key_id'],_0x4ff56e[_0x8167('0x97')],_0x4ff56e[_0x8167('0x9b')],_0x4ff56e[_0x8167('0x6f')],_0x4ff56e[_0x8167('0x9c')])[_0x8167('0x14')](function(_0x164de7){_0x5ca783(null,_0x164de7);})['catch'](function(_0x3d3e2b){_0x5ca783(_0x3d3e2b);});};AGIVertices['prototype'][_0x8167('0x9d')]=function(_0x3f9bd2,_0x46751a,_0x514ea9){scripts['googleASR'](_0x46751a,_0x3f9bd2[_0x8167('0x90')],_0x3f9bd2[_0x8167('0x9e')]||_0x8167('0x71'))[_0x8167('0x14')](function(_0x503e3b){_0x514ea9(null,_0x503e3b);})['catch'](function(_0x5ae74b){_0x514ea9(_0x5ae74b);});};AGIVertices[_0x8167('0x12')][_0x8167('0x9f')]=function(_0x888250,_0x568b4b,_0x520eb4){scripts['tildeASR'](_0x568b4b,_0x888250[_0x8167('0xa0')],_0x888250[_0x8167('0xa1')],_0x888250['uri'])[_0x8167('0x14')](function(_0x319807){_0x520eb4(null,_0x319807);})[_0x8167('0x16')](function(_0x5d2f37){_0x520eb4(_0x5d2f37);});};AGIVertices[_0x8167('0x12')][_0x8167('0xa2')]=function(_0xb84a9d){var _0x3f858f=_[_0x8167('0x7c')](verticesWithRetry,_0xb84a9d[_0x8167('0x3c')])?_0xb84a9d:_['clone'](_0xb84a9d);for(var _0x154f71 in _0x3f858f){if(_0x3f858f[_0x8167('0xa3')](_0x154f71)){if(_0x3f858f[_0x154f71]&&_[_0x8167('0xa4')](_0x3f858f[_0x154f71])){if(_['includes'](recursiveMapAttributes,_0x154f71)){_0x3f858f[_0x154f71]=this[_0x8167('0xa5')](_0x3f858f[_0x154f71]);}else{_0x3f858f[_0x154f71]=this[_0x8167('0xa6')](_0x3f858f[_0x154f71]);}}}}return _0x3f858f;};AGIVertices[_0x8167('0x12')]['recursiveNodeIndex']=function(_0x1a482c){for(var _0x242971 in _0x1a482c){if(_0x1a482c[_0x8167('0xa3')](_0x242971)){if(_['isPlainObject'](_0x1a482c[_0x242971])){this[_0x8167('0xa7')](_0x1a482c[_0x242971]);}else if(_['isArray'](_0x1a482c[_0x242971])){for(var _0xed2762=0x0;_0xed2762<_0x1a482c[_0x242971][_0x8167('0xa8')];_0xed2762++){this[_0x8167('0xa7')](_0x1a482c[_0x242971][_0xed2762]);}}else if(_[_0x8167('0xa4')](_0x1a482c[_0x242971])){_0x1a482c[_0x242971]=this['replaceAllVariables'](_0x1a482c[_0x242971]);}}}};AGIVertices[_0x8167('0x12')][_0x8167('0xa9')]=function(_0x171c5c,_0x329d4c){for(var _0x153461 in _0x171c5c){if(_0x171c5c[_0x8167('0xa3')](_0x153461)){if(_['isPlainObject'](_0x171c5c[_0x153461])){if(!_[_0x8167('0x49')](_0x171c5c[_0x153461])){this[_0x8167('0xa9')](_0x171c5c[_0x153461],util[_0x8167('0x2b')]('%s.%s',_0x329d4c,_0x153461));}}else if(_[_0x8167('0xaa')](_0x171c5c[_0x153461])){for(var _0x2ddffd=0x0;_0x2ddffd<_0x171c5c[_0x153461]['length'];_0x2ddffd++){this[_0x8167('0xa9')](_0x171c5c[_0x153461][_0x2ddffd],util[_0x8167('0x2b')](_0x8167('0xab'),_0x329d4c,_0x153461+'['+_0x2ddffd+']'));}}else{if(!_[_0x8167('0x4a')](_0x171c5c[_0x153461])){this[_0x8167('0xf')]['setVariable'](util['format'](_0x8167('0xab'),_0x329d4c,_0x153461),_0x171c5c[_0x153461]);}}}}};AGIVertices['prototype'][_0x8167('0xa5')]=function(_0x2abe55){try{var _0x2fd89f=JSON[_0x8167('0x80')](_0x2abe55);this[_0x8167('0xa7')](_0x2fd89f);return JSON[_0x8167('0x88')](_0x2fd89f);}catch(_0x2cdfcf){return this[_0x8167('0xa6')](_0x2abe55);}};AGIVertices[_0x8167('0x12')][_0x8167('0xa6')]=function(_0x454c16){console[_0x8167('0x46')](_0x8167('0xac'),_0x454c16);var _0x6b1791=_0x454c16[_0x8167('0xad')]('{');for(var _0x13b816=0x1;_0x13b816<_0x6b1791['length'];_0x13b816+=0x1){var _0x12971e=_0x6b1791[_0x13b816][_0x8167('0xad')]('}');console[_0x8167('0x46')](_0x8167('0xae'),_0x12971e);if(_0x12971e[_0x8167('0xa8')]>0x1){_0x454c16=_0x454c16[_0x8167('0xaf')]('{'+_0x12971e[0x0]+'}',this[_0x8167('0xf')][_0x8167('0x13')](_0x12971e[0x0])[_0x8167('0xb0')]||_0x12971e[0x0]);}}if(_0x6b1791[_0x8167('0xa8')]===0x1){return _0x454c16[_0x8167('0xb1')]();}console['log'](_0x8167('0xb2'),_0x454c16);return this[_0x8167('0xa6')](_0x454c16);};AGIVertices[_0x8167('0x12')][_0x8167('0xb3')]=function(_0x374ced,_0x532c1e){var _0x29974a=this['channel']['getVariable'](_0x374ced);if(_0x29974a['result']===-0x1){return _0x29974a;}logger[_0x8167('0x2f')](util['format'](_0x8167('0xb4'),_0x532c1e,_0x29974a[_0x8167('0xb0')]));return this['channel']['setVariable'](_0x532c1e,_0x29974a[_0x8167('0xb0')]);};AGIVertices[_0x8167('0x12')][_0x8167('0xb5')]=function(_0x2b6a72){return _0x2b6a72&&_0x2b6a72!=='0'&&_0x2b6a72!=='-1'&&_0x2b6a72!=='';};AGIVertices['prototype'][_0x8167('0xb6')]=function(_0x5d942c){this[_0x8167('0x39')][_0x8167('0x84')](this,_0x5d942c,'-');_0x5d942c['retry']=_0x5d942c[_0x8167('0xb6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8167('0x12')]['mrcpsynth']=function(_0x321c04){logger['info'](util[_0x8167('0x2b')](_0x8167('0xb7'),_0x321c04['label']));if(!this[_0x8167('0xb5')](_0x321c04[_0x8167('0x6f')])){return this[_0x8167('0xf')]['noop'](_0x8167('0xb8'));}var _0x3c8952='\x22'+_0x321c04[_0x8167('0x6f')]+'\x22';if(this[_0x8167('0xb5')](_0x321c04[_0x8167('0x8e')])){_0x3c8952+=','+_0x321c04['options'];}var _0x2250d3=this[_0x8167('0xf')][_0x8167('0x6a')](_0x8167('0xb9'),_0x3c8952);if(_0x2250d3[_0x8167('0xba')]===-0x1){return _0x2250d3;}return this[_0x8167('0xf')]['noop'](util[_0x8167('0x2b')](_0x8167('0xbb'),_0x3c8952));};AGIVertices[_0x8167('0x12')][_0x8167('0xbc')]=function(_0x106cc1){logger['info'](util[_0x8167('0x2b')](_0x8167('0xbd'),_0x106cc1[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x106cc1[_0x8167('0xbe')])){return this['channel'][_0x8167('0xbf')](_0x8167('0xc0'));}var _0x2706f8=_0x106cc1[_0x8167('0xbe')];if(this[_0x8167('0xb5')](_0x106cc1[_0x8167('0x8e')])){_0x2706f8+=','+_0x106cc1['options'];}var _0x3dd9d9=this['channel'][_0x8167('0x6a')](_0x8167('0xc1'),_0x2706f8);if(_0x3dd9d9[_0x8167('0xba')]===-0x1){return _0x3dd9d9;}var _0x4f1de0=this['getAndSetVariable'](_0x8167('0xc2'),_0x8167('0xc3'));if(_0x4f1de0[_0x8167('0xba')]===-0x1){return _0x4f1de0;}var _0x2c73f3=this['getAndSetVariable'](_0x8167('0xc4'),'MRCP_RECOG_TRANSCRIPT');if(_0x2c73f3[_0x8167('0xba')]===-0x1){return _0x2c73f3;}var _0x3806af=this[_0x8167('0xb3')]('RECOG_INSTANCE()',_0x8167('0xc5'));if(_0x3806af[_0x8167('0xba')]===-0x1){return _0x3806af;}return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0xc6'),_0x2706f8));};AGIVertices[_0x8167('0x12')]['agi']=function(_0x29fea7){logger[_0x8167('0x2f')](util[_0x8167('0x2b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x29fea7[_0x8167('0x3b')]));return this[_0x8167('0xf')][_0x8167('0x8')]([_0x29fea7[_0x8167('0xc7')],_0x29fea7[_0x8167('0xc8')]]);};AGIVertices['prototype'][_0x8167('0xc9')]=function(_0x5ee4ee){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0xca'),_0x5ee4ee['label']));if(this[_0x8167('0xb5')](_0x5ee4ee['timeout'])){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0xcb'),_0x5ee4ee[_0x8167('0x7a')]));var _0x21d86c=this['channel'][_0x8167('0xcc')](_0x5ee4ee['timeout']);if(_0x21d86c['result']===-0x1){return _0x21d86c;}}return this[_0x8167('0xf')]['answer']();};AGIVertices[_0x8167('0x12')]['callback']=function(_0x6303e4){console['log']('enter\x20in\x20callbackblock',_0x6303e4);logger['info'](util[_0x8167('0x2b')](_0x8167('0xcd'),_0x6303e4[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x6303e4[_0x8167('0x4f')])){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x6303e4,_0x8167('0xce'));}_0x6303e4[_0x8167('0x50')]=moment();if(this[_0x8167('0xb5')](_0x6303e4[_0x8167('0xcf')])){_0x6303e4[_0x8167('0x50')]=moment()[_0x8167('0x5b')](_0x6303e4[_0x8167('0xcf')],_0x8167('0x5c'));}if(!this[_0x8167('0xb5')](_0x6303e4[_0x8167('0xd0')])){_0x6303e4['callback_priority']=0x2;}console[_0x8167('0x46')](_0x8167('0xd1'),_0x6303e4);this[_0x8167('0x45')]['sync'](this,_0x6303e4);return this['channel'][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0xd2'),_0x6303e4[_0x8167('0x4e')],_0x6303e4[_0x8167('0x4f')],_0x6303e4[_0x8167('0x50')]));};AGIVertices[_0x8167('0x12')][_0x8167('0xd3')]=function(_0x38ff65){logger[_0x8167('0x2f')](util[_0x8167('0x2b')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x38ff65[_0x8167('0x3b')]));var _0x4bffd5=this[_0x8167('0xf')][_0x8167('0x6a')](_0x38ff65[_0x8167('0xd4')],_0x38ff65[_0x8167('0x8e')]);if(_0x4bffd5[_0x8167('0xba')]===-0x1){return _0x4bffd5;}return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0xd5'),_0x38ff65['application'],_0x38ff65[_0x8167('0x8e')]));};AGIVertices['prototype'][_0x8167('0xd6')]=function(_0x16bd3f){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0xd7'),_0x16bd3f[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x16bd3f['text'])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0xb8'));}var _0x13f5b5='\x22'+_0x16bd3f[_0x8167('0x6f')]+'\x22';if(this['isConfigured'](_0x16bd3f['options'])){_0x13f5b5+=','+_0x16bd3f[_0x8167('0x8e')];}var _0x56e32f=this[_0x8167('0xf')][_0x8167('0x6a')]('MRCPSynth',_0x13f5b5);if(_0x56e32f[_0x8167('0xba')]===-0x1){return _0x56e32f;}return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0xbb'),_0x13f5b5));};AGIVertices[_0x8167('0x12')][_0x8167('0xd8')]=function(_0x194625){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0xd9'),_0x194625[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x194625[_0x8167('0x6f')])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0xb8'));}var _0x32570e='\x22'+_0x194625[_0x8167('0x6f')]+'\x22';if(this[_0x8167('0xb5')](_0x194625[_0x8167('0x8e')])){_0x32570e+=','+_0x194625['options'];}var _0x2a2c0a=this[_0x8167('0xf')][_0x8167('0x6a')](_0x8167('0xb9'),_0x32570e);if(_0x2a2c0a[_0x8167('0xba')]===-0x1){return _0x2a2c0a;}return this[_0x8167('0xf')]['noop'](util[_0x8167('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x32570e));};AGIVertices[_0x8167('0x12')][_0x8167('0xda')]=function(_0x19f2b1){logger['info'](util[_0x8167('0x2b')](_0x8167('0xdb'),_0x19f2b1['label']));if(!this[_0x8167('0xb5')](_0x19f2b1[_0x8167('0xbe')])){return this['channel'][_0x8167('0xbf')](_0x8167('0xc0'));}var _0x34130a=_0x19f2b1[_0x8167('0xbe')];if(this[_0x8167('0xb5')](_0x19f2b1[_0x8167('0x8e')])){_0x34130a+=','+_0x19f2b1[_0x8167('0x8e')];}var _0x3e4b19=this[_0x8167('0xf')][_0x8167('0x6a')]('MRCPRecog',_0x34130a);if(_0x3e4b19[_0x8167('0xba')]===-0x1){return _0x3e4b19;}var _0x505478=this['getAndSetVariable'](_0x8167('0xc2'),_0x8167('0xdc'));if(_0x505478[_0x8167('0xba')]===-0x1){return _0x505478;}var _0x1bd09c=this[_0x8167('0xb3')]('RECOG_INPUT()',_0x8167('0xdd'));if(_0x1bd09c[_0x8167('0xba')]===-0x1){return _0x1bd09c;}var _0x3a57b7=this[_0x8167('0xb3')](_0x8167('0xde'),_0x8167('0xdf'));if(_0x3a57b7[_0x8167('0xba')]===-0x1){return _0x3a57b7;}return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0xc6'),_0x34130a));};AGIVertices[_0x8167('0x12')][_0x8167('0xe0')]=function(_0x175052){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0xe1'),_0x175052[_0x8167('0x3b')]));if(!this['isConfigured'](_0x175052['grammar'])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0xc0'));}var _0x1dd1f0=_0x175052['grammar'];if(this[_0x8167('0xb5')](_0x175052[_0x8167('0x8e')])){_0x1dd1f0+=','+_0x175052['options'];}var _0x47f952=this[_0x8167('0xf')][_0x8167('0x6a')]('MRCPRecog',_0x1dd1f0);if(_0x47f952[_0x8167('0xba')]===-0x1){return _0x47f952;}var _0x227156=this[_0x8167('0xb3')](_0x8167('0xc2'),'SESTEK_ASR_CONFIDENCE');if(_0x227156['result']===-0x1){return _0x227156;}var _0x743b1c=this[_0x8167('0xb3')](_0x8167('0xc4'),_0x8167('0xe2'));if(_0x743b1c[_0x8167('0xba')]===-0x1){return _0x743b1c;}var _0x359438=this[_0x8167('0xb3')](_0x8167('0xde'),_0x8167('0xe3'));if(_0x359438[_0x8167('0xba')]===-0x1){return _0x359438;}return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0xc6'),_0x1dd1f0));};AGIVertices[_0x8167('0x12')][_0x8167('0xe4')]=function(_0x4c02fa){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0xe5'),_0x4c02fa[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x4c02fa[_0x8167('0xe6')])){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x4c02fa,_0x8167('0xe7'));}var _0x446c63=this[_0x8167('0x1a')][_0x8167('0x84')](this,_0x4c02fa[_0x8167('0xe6')]);if(!_0x446c63){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x4c02fa,_0x8167('0xe8'));}if(!this[_0x8167('0xb5')](_0x4c02fa['query'])){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x4c02fa,_0x8167('0xe9'));}var _0x189a61=_0x4c02fa[_0x8167('0x31')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util['format'](_0x8167('0xea'),_0x189a61));var _0x303420=this[_0x8167('0x2d')][_0x8167('0x84')](this,_0x446c63,_0x189a61);this[_0x8167('0x39')]['sync'](this,_0x4c02fa,_0x189a61);if(!this['isConfigured'](_0x4c02fa[_0x8167('0xeb')])){return this[_0x8167('0xf')]['noop'](_0x8167('0xec'));}var _0x5475bd=this[_0x8167('0x13')][_0x8167('0x84')](this,_0x4c02fa[_0x8167('0xeb')]);if(!_0x5475bd){return this['channel'][_0x8167('0x2e')](_0x4c02fa,_0x8167('0xed'));}var _0x314b33=this;_0x303420[_0x8167('0xee')](function(_0x50f66a,_0xc30a27){Object[_0x8167('0xef')](_0x50f66a)[_0x8167('0xee')](function(_0x45fe83){_0x314b33[_0x8167('0xf')][_0x8167('0xf0')](util[_0x8167('0x2b')](_0x8167('0xf1'),_0x5475bd,_0xc30a27,_0x45fe83),_0x50f66a[_0x45fe83]);});});this[_0x8167('0xf')]['setVariable'](util['format'](_0x8167('0xf2'),_0x5475bd),_0x303420['length']);return this[_0x8167('0xf')]['noop'](util[_0x8167('0x2b')]('variable\x20%s\x20set',_0x5475bd));};AGIVertices[_0x8167('0x12')][_0x8167('0xf3')]=function(_0x439a47){logger['debug'](util[_0x8167('0x2b')](_0x8167('0xf4'),_0x439a47[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x439a47['sip_id'])){return this[_0x8167('0xf')]['error'](_0x439a47,_0x8167('0xf5'));}var _0x53863f=this[_0x8167('0xf6')][_0x8167('0x84')](this,_0x439a47['sip_id']);if(!_0x53863f){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x439a47,'no\x20user\x20found');}var _0x388078=this[_0x8167('0xf')][_0x8167('0x6a')](_0x8167('0xf7'),[util[_0x8167('0x2b')](_0x8167('0xf8'),_0x53863f),_0x439a47[_0x8167('0x7a')],_0x439a47['opts'],_0x439a47[_0x8167('0x87')]]);if(_0x388078[_0x8167('0xba')]===-0x1){return _0x388078;}return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')]('Executed\x20command\x20%s',_0x8167('0xf7')));};AGIVertices[_0x8167('0x12')][_0x8167('0xf9')]=function(_0x5f201d){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0xfa'),_0x5f201d[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x5f201d[_0x8167('0x90')])){return this['channel'][_0x8167('0xbf')]('no\x20key\x20configured');}if(!this[_0x8167('0xb5')](_0x5f201d['text'])){return this[_0x8167('0xf')][_0x8167('0xbf')]('no\x20text\x20configured');}this[_0x8167('0xf')][_0x8167('0xfb')]=!![];this[_0x8167('0x39')](_0x5f201d);this[_0x8167('0x44')](_0x5f201d[_0x8167('0x6f')],'in');this[_0x8167('0xf')][_0x8167('0xbf')](util['format'](_0x8167('0xfc'),_0x5f201d['text']));var _0xbdcf79=this[_0x8167('0x8f')][_0x8167('0x84')](this,_0x5f201d);if(_0xbdcf79){for(var _0x58ba5d in _0xbdcf79){if(_0xbdcf79['hasOwnProperty'](_0x58ba5d)){this[_0x8167('0xf')][_0x8167('0xf0')](util['format'](_0x8167('0xfd'),_0x58ba5d[_0x8167('0x7e')]()),_0xbdcf79[_0x58ba5d]);}}this[_0x8167('0x44')](_0xbdcf79[_0x8167('0xfe')],_0x8167('0xff'));return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x100'),_0xbdcf79[_0x8167('0xfe')]));}return this[_0x8167('0xf')][_0x8167('0x2e')](_0x5f201d,_0x8167('0x101'));};AGIVertices[_0x8167('0x12')][_0x8167('0x102')]=function(_0x4ccb77){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x103'),_0x4ccb77[_0x8167('0x3b')]));if(!this['isConfigured'](_0x4ccb77[_0x8167('0x104')])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0x105'));}if(!this[_0x8167('0xb5')](_0x4ccb77['username'])){return this['channel'][_0x8167('0xbf')]('no\x20username\x20configured');}if(!this[_0x8167('0xb5')](_0x4ccb77['password'])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0x106'));}if(!this[_0x8167('0xb5')](_0x4ccb77[_0x8167('0x107')])){return this['channel'][_0x8167('0xbf')]('no\x20text\x20configured');}this[_0x8167('0xf')][_0x8167('0xfb')]=!![];this[_0x8167('0x39')](_0x4ccb77);this[_0x8167('0x44')](_0x4ccb77['text'],'in');this['channel']['noop'](util[_0x8167('0x2b')]('Trying\x20SestekNDA:\x20%s',_0x4ccb77[_0x8167('0x6f')]));var _0x486aa5=this[_0x8167('0x92')][_0x8167('0x84')](this,_0x4ccb77);if(_0x486aa5){for(var _0x51b596 in _0x486aa5){if(_0x486aa5[_0x8167('0xa3')](_0x51b596)){this[_0x8167('0xf')][_0x8167('0xf0')](util[_0x8167('0x2b')](_0x8167('0x108'),_0x51b596['toUpperCase']()),_0x486aa5[_0x51b596]);}}this[_0x8167('0x44')](_0x486aa5[_0x8167('0xfe')],_0x8167('0xff'));if(_0x486aa5[_0x8167('0x109')]){this[_0x8167('0xf')][_0x8167('0xbf')](util['format'](_0x8167('0x10a'),_0x486aa5[_0x8167('0x109')]));var _0x2c2474=this[_0x8167('0xf')][_0x8167('0x10b')](_0x486aa5[_0x8167('0x109')]);try{fs[_0x8167('0x10c')](_0x486aa5[_0x8167('0x109')]+_0x8167('0x10d'));}catch(_0x2bc935){logger[_0x8167('0x2e')](_0x2bc935);}return _0x2c2474;}else{return this['channel']['noop'](util['format'](_0x8167('0x10e'),_0x486aa5[_0x8167('0xfe')]));}}return this[_0x8167('0xf')]['error'](_0x4ccb77,_0x8167('0x10f'));};AGIVertices[_0x8167('0x12')][_0x8167('0x110')]=function(_0x3b33fa){logger['info'](util[_0x8167('0x2b')](_0x8167('0x111'),_0x3b33fa[_0x8167('0x3b')]));return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0x110'));};AGIVertices['prototype'][_0x8167('0x112')]=function(_0x5f2f98){logger[_0x8167('0x2f')](util['format'](_0x8167('0x113'),_0x5f2f98[_0x8167('0x3b')]));var _0x453203='';if(_0x5f2f98[_0x8167('0x114')]){if(!this[_0x8167('0xb5')](_0x5f2f98[_0x8167('0x114')])){return this[_0x8167('0xf')]['error'](_0x5f2f98,_0x8167('0x115'));}else{var _0x26c74e=parseInt(_0x5f2f98[_0x8167('0x114')],0xa);if(isNaN(_0x26c74e)){_0x453203=_0x5f2f98[_0x8167('0x114')];}else{_0x453203=this[_0x8167('0x1e')][_0x8167('0x84')](this,_0x5f2f98[_0x8167('0x114')]);if(!_0x453203){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x5f2f98,_0x8167('0x116'));}}}}else if(_0x5f2f98['trunk_name']){_0x453203=_0x5f2f98[_0x8167('0x117')];}else{return this['channel'][_0x8167('0x2e')](_0x5f2f98,'no\x20trunk\x20selected');}var _0x3be4b0=this[_0x8167('0xf')][_0x8167('0x6a')]('DIAL',[util['format']('SIP/%s/%s',_0x453203,_0x5f2f98[_0x8167('0x4e')]),_0x5f2f98[_0x8167('0x7a')],_0x5f2f98['opts'],_0x5f2f98[_0x8167('0x87')]]);if(_0x3be4b0[_0x8167('0xba')]===-0x1){return _0x3be4b0;}return this[_0x8167('0xf')]['noop'](util[_0x8167('0x2b')]('Executed\x20command\x20%s',_0x8167('0xf7')));};AGIVertices['prototype'][_0x8167('0x118')]=function(_0x2803c5){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x119'),_0x2803c5[_0x8167('0x3b')]));return this[_0x8167('0xf')]['noop'](_0x8167('0x118'));};AGIVertices['prototype'][_0x8167('0x11a')]=function(_0x1794a2){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x11b'),_0x1794a2[_0x8167('0x3b')]));if(_0x1794a2[_0x8167('0x11c')]===0x0){return this[_0x8167('0xb6')](_0x1794a2);}_0x1794a2[_0x8167('0x11c')]-=0x1;if(!this[_0x8167('0xb5')](_0x1794a2[_0x8167('0x11d')])){return this[_0x8167('0xf')]['error'](_0x1794a2,_0x8167('0x11e'));}var _0x19bda4=this['getSound'][_0x8167('0x84')](this,_0x1794a2['file_id']);if(!_0x19bda4){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x1794a2,_0x8167('0x11f'));}if(!this[_0x8167('0xb5')](_0x1794a2[_0x8167('0xeb')])){return this[_0x8167('0xf')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x10b6c4=this[_0x8167('0xf')][_0x8167('0x120')](_0x19bda4,_0x1794a2[_0x8167('0x121')],_0x1794a2[_0x8167('0x122')]);var _0x569ed0=_0x10b6c4[_0x8167('0xba')]?_0x10b6c4[_0x8167('0xba')][_0x8167('0xb1')]():'';logger[_0x8167('0x2f')]('test',JSON[_0x8167('0x88')](_0x10b6c4));if(_0x10b6c4[_0x8167('0xba')]===-0x1){this[_0x8167('0x39')]['sync'](this,_0x1794a2,_0x569ed0);return _0x10b6c4;}else if(_0x10b6c4['extra']==='timeout'){_0x10b6c4[_0x8167('0xba')]=_0x569ed0['length']>=parseInt(_0x1794a2[_0x8167('0x123')])?'x':'i';}else{_0x10b6c4['result']=_0x569ed0['length']>=parseInt(_0x1794a2['mindigit'])&&_0x569ed0[_0x8167('0xa8')]<=parseInt(_0x1794a2['maxdigit'])?'x':'i';}var _0x15c851=this[_0x8167('0x13')]['sync'](this,_0x1794a2[_0x8167('0xeb')]);if(!_0x15c851){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x1794a2,'no\x20variable\x20found');}this[_0x8167('0xf')][_0x8167('0xf0')](_0x15c851,_0x569ed0);if(this['isConfigured'](_0x1794a2[_0x8167('0x124')])){var _0x4675d9=parseInt(_0x1794a2[_0x8167('0x124')],0xa);var _0x274b20=rs[_0x8167('0x125')]({'charset':'*','length':_0x4675d9});var _0x412e33=_0x569ed0[_0x8167('0xa8')];if(_0x412e33>0x0){if(_0x412e33>_0x4675d9){this[_0x8167('0x39')][_0x8167('0x84')](this,_0x1794a2,_0x1794a2[_0x8167('0x126')]===_0x8167('0x127')?_0x274b20+_0x569ed0['substr'](_0x4675d9):_0x569ed0[_0x8167('0x128')](0x0,_0x412e33-_0x4675d9)+_0x274b20);}else{this[_0x8167('0x39')][_0x8167('0x84')](this,_0x1794a2,rs[_0x8167('0x125')]({'charset':'*','length':_0x412e33}));}}else{this[_0x8167('0x39')][_0x8167('0x84')](this,_0x1794a2,'');}}else{this[_0x8167('0x39')][_0x8167('0x84')](this,_0x1794a2,_0x569ed0);}return _0x10b6c4;};AGIVertices[_0x8167('0x12')]['getsecretdigits']=function(_0x59c937){logger[_0x8167('0x2f')](util['format'](_0x8167('0x129'),_0x59c937[_0x8167('0x3b')]));return this[_0x8167('0x11a')](_0x59c937);};AGIVertices['prototype'][_0x8167('0x12a')]=function(_0x5a4605){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x12b'),_0x5a4605[_0x8167('0x3b')]));this['createSquareDetailsReport'][_0x8167('0x84')](this,_0x5a4605,_0x5a4605[_0x8167('0x12c')]);return this[_0x8167('0xf')]['noop'](util['format'](_0x8167('0x12d'),_0x5a4605[_0x8167('0x12c')]));};AGIVertices[_0x8167('0x12')][_0x8167('0x12e')]=function(_0x2b24ea){logger['info'](util[_0x8167('0x2b')](_0x8167('0x12f'),_0x2b24ea[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x2b24ea[_0x8167('0x130')])||!this[_0x8167('0xb5')](_0x2b24ea[_0x8167('0x97')])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0x131'));}if(!this['isConfigured'](_0x2b24ea[_0x8167('0x6f')])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0xb8'));}this['channel'][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x132'),_0x2b24ea['text']));var _0x289f0a=this[_0x8167('0x96')][_0x8167('0x84')](this,_0x2b24ea);if(_0x289f0a){this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')]('aws\x20Polly\x20%s\x20file\x20created',_0x289f0a));var _0x1706b8=this[_0x8167('0xf')][_0x8167('0x10b')](_0x289f0a);try{fs[_0x8167('0x10c')](_0x289f0a+_0x8167('0x10d'));}catch(_0x729b79){logger['error'](_0x729b79);}return _0x1706b8;}return this[_0x8167('0xf')]['error'](_0x2b24ea,_0x8167('0x133'));};AGIVertices['prototype']['awslex']=function(_0x23d1ad){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x134'),_0x23d1ad[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x23d1ad[_0x8167('0x130')])||!this[_0x8167('0xb5')](_0x23d1ad['aws_secret_access_key'])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0x131'));}if(!this[_0x8167('0xb5')](_0x23d1ad[_0x8167('0x9c')])){return this['channel'][_0x8167('0xbf')](_0x8167('0x135'));}if(!this[_0x8167('0xb5')](_0x23d1ad[_0x8167('0x6f')])){return this['channel']['noop'](_0x8167('0xb8'));}this[_0x8167('0xf')][_0x8167('0xfb')]=!![];this['createSquareDetailsReport'](_0x23d1ad);this[_0x8167('0x44')](_0x23d1ad[_0x8167('0x6f')],'in');this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x136'),_0x23d1ad[_0x8167('0x6f')]));var _0x34b8d3=this['awsLex'][_0x8167('0x84')](this,_0x23d1ad);if(_0x34b8d3){for(var _0x1879b9 in _0x34b8d3){if(_0x34b8d3[_0x8167('0xa3')](_0x1879b9)&&_[_0x8167('0xa4')](_0x34b8d3[_0x1879b9])){this[_0x8167('0xf')][_0x8167('0xf0')](util[_0x8167('0x2b')](_0x8167('0x137'),_0x1879b9[_0x8167('0x7e')]()),_0x34b8d3[_0x1879b9]);}}if(_['isNil'](_0x34b8d3[_0x8167('0x8c')])){return this['channel'][_0x8167('0xbf')](_0x8167('0x138'));}else{this['createSquareMessage'](_0x34b8d3[_0x8167('0x8c')],_0x8167('0xff'));return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')]('Amazon\x20Lex\x20Result\x20%s',_0x34b8d3['message']));}}return this['channel'][_0x8167('0x2e')](_0x23d1ad,_0x8167('0x139'));};AGIVertices[_0x8167('0x12')][_0x8167('0x13a')]=function(_0x5e67f8){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x13b'),_0x5e67f8['label'],_0x5e67f8[_0x8167('0x7a')]));if(!this[_0x8167('0xb5')](_0x5e67f8[_0x8167('0x90')])){return this[_0x8167('0xf')][_0x8167('0xbf')]('no\x20key\x20configured');}var _0x2b6bc8=_0x8167('0x13c');var _0x25070f=util[_0x8167('0x2b')](_0x8167('0x13d'),FILES_PATH,rs[_0x8167('0x125')](0x4));var _0x1185d5=util[_0x8167('0x2b')](_0x8167('0xab'),_0x25070f,_0x2b6bc8);var _0x577412=!![];if(_0x5e67f8[_0x8167('0x13e')]===_0x8167('0x13f')){_0x577412=![];}var _0x158097=this[_0x8167('0xf')][_0x8167('0x140')](_0x25070f,_0x2b6bc8,_0x5e67f8[_0x8167('0x141')],_0x5e67f8[_0x8167('0x7a')],undefined,_0x577412);if(_0x158097['result']!==-0x1){this['channel'][_0x8167('0xbf')](util['format'](_0x8167('0x142'),_0x1185d5));var _0x824976=this[_0x8167('0x9d')][_0x8167('0x84')](this,_0x5e67f8,_0x1185d5);if(_0x824976){for(var _0x301f3d in _0x824976){if(_0x824976[_0x8167('0xa3')](_0x301f3d)){this[_0x8167('0xf')][_0x8167('0xf0')](util[_0x8167('0x2b')](_0x8167('0x143'),_0x301f3d[_0x8167('0x7e')]()),_0x824976[_0x301f3d]);}}return this[_0x8167('0xf')][_0x8167('0xbf')](util['format'](_0x8167('0x144'),JSON[_0x8167('0x88')](_0x824976)));}}return _0x158097;};AGIVertices['prototype'][_0x8167('0x145')]=function(_0x5a325c){logger['info'](util[_0x8167('0x2b')](_0x8167('0x146'),_0x5a325c[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x5a325c['appid'])){return this['channel']['noop'](_0x8167('0x147'));}if(!this[_0x8167('0xb5')](_0x5a325c['appsecret'])){return this[_0x8167('0xf')]['noop'](_0x8167('0x148'));}var _0x5874a6=_0x8167('0x13c');var _0x1ec104=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x8167('0x125')](0x4));var _0x541360=util[_0x8167('0x2b')](_0x8167('0xab'),_0x1ec104,_0x5874a6);var _0x2f31af=!![];if(_0x5a325c[_0x8167('0x13e')]===_0x8167('0x13f')){_0x2f31af=![];}var _0x4c7b4e=this[_0x8167('0xf')]['recordFile'](_0x1ec104,_0x5874a6,_0x5a325c['intKey'],_0x5a325c[_0x8167('0x7a')],undefined,_0x2f31af);if(_0x4c7b4e[_0x8167('0xba')]!==-0x1){this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x149'),_0x541360));var _0x517688=this[_0x8167('0x9f')]['sync'](this,_0x5a325c,_0x541360);if(_0x517688){for(var _0x11663b in _0x517688){if(_0x517688[_0x8167('0xa3')](_0x11663b)){this[_0x8167('0xf')][_0x8167('0xf0')](util[_0x8167('0x2b')](_0x8167('0x14a'),_0x11663b[_0x8167('0x7e')]()),_0x517688[_0x11663b]);}}return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x14b'),JSON[_0x8167('0x88')](_0x517688)));}}return _0x4c7b4e;};AGIVertices['prototype']['gotoc']=function(_0x42d8fe){logger['info'](util['format'](_0x8167('0x14c'),_0x42d8fe['label']));return this['channel'][_0x8167('0x14d')](_0x42d8fe[_0x8167('0x40')],_0x42d8fe[_0x8167('0x41')],_0x42d8fe[_0x8167('0x42')]);};AGIVertices[_0x8167('0x12')][_0x8167('0x14e')]=function(_0x70cdab){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x14f'),_0x70cdab[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x70cdab[_0x8167('0x150')])){return this['channel']['error'](_0x70cdab,'no\x20condition\x20configured');}try{var _0xcd6cff=eval(_0x70cdab[_0x8167('0x150')])?'true':_0x8167('0x151');this[_0x8167('0xf')][_0x8167('0xbf')](util['format'](_0x8167('0x152'),_0x70cdab[_0x8167('0x150')],_0xcd6cff));return{'code':0xc8,'result':_0xcd6cff};}catch(_0x2213d0){return{'code':0xc8,'result':_0x8167('0x151')};}};AGIVertices[_0x8167('0x12')][_0x8167('0x153')]=function(_0x13fefa){logger[_0x8167('0x2f')](util['format'](_0x8167('0x154'),_0x13fefa[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x13fefa[_0x8167('0x155')])){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x13fefa,'no\x20interval\x20configured');}var _0x52d9ff=this['getIntervals'][_0x8167('0x84')](this,_0x13fefa[_0x8167('0x155')]);if(!_0x52d9ff){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x13fefa,_0x8167('0x156'));}for(var _0x56cb51=0x0;_0x56cb51<_0x52d9ff[_0x8167('0xa8')];_0x56cb51+=0x1){var _0x4a1133=this[_0x8167('0xf')][_0x8167('0x13')](util['format'](_0x8167('0x157'),_0x52d9ff[_0x56cb51]));if(_0x4a1133[_0x8167('0xba')]===-0x1){return _0x4a1133;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x52d9ff[_0x56cb51],_0x4a1133['extra']));if(_0x4a1133[_0x8167('0xb0')]===_0x8167('0x158')){logger['info'](util[_0x8167('0x2b')](_0x8167('0x159'),_0x52d9ff[_0x56cb51],_0x8167('0x158')));this[_0x8167('0xf')]['noop'](util['format'](_0x8167('0x159'),_0x52d9ff[_0x56cb51],_0x8167('0x158')));return{'code':0xc8,'result':_0x8167('0x158')};}else{logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x159'),_0x52d9ff[_0x56cb51],_0x8167('0x151')));this['channel'][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x159'),_0x52d9ff[_0x56cb51],_0x8167('0x151')));}}return{'code':0xc8,'result':_0x8167('0x151')};};AGIVertices[_0x8167('0x12')][_0x8167('0x15a')]=function(_0x417f6c){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x15b'),_0x417f6c['label']));return this['channel'][_0x8167('0x15a')]();};AGIVertices[_0x8167('0x12')]['ispeechasr']=function(_0x5a8a87){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x15c'),_0x5a8a87[_0x8167('0x3b')]));if(!this['isConfigured'](_0x5a8a87['key'])){return this[_0x8167('0xf')][_0x8167('0xbf')]('no\x20key\x20configured');}var _0x19f749=_0x8167('0x13c');var _0x40f653=util[_0x8167('0x2b')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0xbeac5=util[_0x8167('0x2b')](_0x8167('0xab'),_0x40f653,_0x19f749);var _0x37544c=!![];if(_0x5a8a87[_0x8167('0x13e')]==='NOBEEP'){_0x37544c=![];}var _0x556224=this[_0x8167('0xf')]['recordFile'](_0x40f653,_0x19f749,_0x5a8a87[_0x8167('0x141')],_0x5a8a87['timeout'],undefined,_0x37544c);if(_0x556224[_0x8167('0xba')]!==-0x1){this['channel'][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x15d'),_0xbeac5));var _0x1d650a=this[_0x8167('0x15e')][_0x8167('0x84')](this,_0x5a8a87,_0xbeac5);if(_0x1d650a){for(var _0xf2e3b0 in _0x1d650a){if(_0x1d650a['hasOwnProperty'](_0xf2e3b0)){this[_0x8167('0xf')]['setVariable'](util[_0x8167('0x2b')](_0x8167('0x15f'),_0xf2e3b0[_0x8167('0x7e')]()),_0x1d650a[_0xf2e3b0]);}}return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')]('IspeechASR\x20Result\x20%s',JSON[_0x8167('0x88')](_0x1d650a)));}}return _0x556224;};AGIVertices[_0x8167('0x12')]['ispeechtts']=function(_0x2de94f){logger['info'](util['format'](_0x8167('0x160'),_0x2de94f[_0x8167('0x3b')]));if(!this['isConfigured'](_0x2de94f['key'])){return this[_0x8167('0xf')]['noop'](_0x8167('0x161'));}if(!this['isConfigured'](_0x2de94f['text'])){return this[_0x8167('0xf')]['noop'](_0x8167('0xb8'));}this[_0x8167('0xf')]['noop'](util[_0x8167('0x2b')]('Trying\x20ispeech\x20TTS\x20%s',_0x2de94f[_0x8167('0x6f')]));var _0x45a3f9=this[_0x8167('0x93')]['sync'](this,_0x2de94f);if(_0x45a3f9){this['channel'][_0x8167('0xbf')](util['format'](_0x8167('0x15d'),_0x45a3f9));var _0x28d3c3=this['channel']['streamFile'](_0x45a3f9,_0x2de94f[_0x8167('0x141')]);try{fs[_0x8167('0x10c')](_0x45a3f9+_0x8167('0x10d'));}catch(_0x4b97b1){logger[_0x8167('0x2e')](_0x4b97b1);}return _0x28d3c3;}return this['channel'][_0x8167('0x2e')](_0x2de94f,_0x8167('0x162'));};AGIVertices[_0x8167('0x12')][_0x8167('0x163')]=function(_0x5c5387){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x164'),_0x5c5387[_0x8167('0x3b')]));if(!this['isConfigured'](_0x5c5387[_0x8167('0x165')])){return this['channel'][_0x8167('0x2e')](_0x5c5387,'no\x20find\x20by\x20configured');}logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x166'),this['channel']['callerid'],_0x5c5387['findBy']));var _0x5606e7=this['agentLogin'][_0x8167('0x84')](this,_0x5c5387[_0x8167('0x165')]);if(_0x5606e7){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x167'),this[_0x8167('0xf')][_0x8167('0x3f')],_0x5c5387[_0x8167('0x165')]));this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8167('0xf')][_0x8167('0x3f')],_0x5c5387[_0x8167('0x165')]));return{'code':0xc8,'result':_0x8167('0x168')};}else{logger[_0x8167('0x2f')](util[_0x8167('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8167('0xf')][_0x8167('0x3f')],_0x5c5387['findBy']));this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x169'),this[_0x8167('0xf')][_0x8167('0x3f')],_0x5c5387[_0x8167('0x165')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8167('0x12')][_0x8167('0x16a')]=function(_0x3ecc89){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x16b'),_0x3ecc89['label']));if(!this[_0x8167('0xb5')](_0x3ecc89[_0x8167('0x165')])){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x3ecc89,'no\x20find\x20by\x20configured');}logger['info'](util['format'](_0x8167('0x166'),this[_0x8167('0xf')][_0x8167('0x3f')],_0x3ecc89[_0x8167('0x165')]));var _0x58d962=this[_0x8167('0x64')]['sync'](this,_0x3ecc89[_0x8167('0x165')]);if(_0x58d962){logger['info'](util[_0x8167('0x2b')](_0x8167('0x167'),this[_0x8167('0xf')][_0x8167('0x3f')],_0x3ecc89['findBy']));this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x167'),this[_0x8167('0xf')][_0x8167('0x3f')],_0x3ecc89[_0x8167('0x165')]));return{'code':0xc8,'result':_0x8167('0x168')};}else{logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x169'),this[_0x8167('0xf')]['callerid'],_0x3ecc89['findBy']));this[_0x8167('0xf')][_0x8167('0xbf')](util['format'](_0x8167('0x169'),this['channel'][_0x8167('0x3f')],_0x3ecc89[_0x8167('0x165')]));return{'code':0xc8,'result':_0x8167('0x16c')};}};AGIVertices[_0x8167('0x12')][_0x8167('0x16d')]=function(_0x63bc0a){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x16e'),_0x63bc0a[_0x8167('0x3b')]));if(!this['isConfigured'](_0x63bc0a[_0x8167('0x16f')])){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x63bc0a,_0x8167('0x170'));}this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x171'),_0x63bc0a[_0x8167('0x16f')]));var _0x3c970a=eval(_0x63bc0a['operation']);if(!this[_0x8167('0xb5')](_0x63bc0a[_0x8167('0xeb')])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0xec'));}var _0x1b33b9=this[_0x8167('0x13')][_0x8167('0x84')](this,_0x63bc0a['variable_id']);if(!_0x1b33b9){return this[_0x8167('0xf')]['error'](_0x63bc0a,'no\x20variable\x20found');}if(_[_0x8167('0xaa')](_0x3c970a)){var _0x23ddd9=this;_0x3c970a['forEach'](function(_0x3dcd5a,_0x2a535d){_0x23ddd9[_0x8167('0xf')][_0x8167('0xf0')](util[_0x8167('0x2b')]('%s[%s]',_0x1b33b9,_0x2a535d),_0x3dcd5a);});return this['channel']['noop'](util[_0x8167('0x2b')]('variable\x20%s[key]\x20set',_0x1b33b9));}else{return this[_0x8167('0xf')][_0x8167('0xf0')](_0x1b33b9,_0x3c970a);}};AGIVertices['prototype'][_0x8167('0xe')]=function(_0x567a8b){logger['info'](util['format'](_0x8167('0x172'),_0x567a8b[_0x8167('0x3b')]));if(_0x567a8b[_0x8167('0x11c')]===0x0){return this[_0x8167('0xb6')](_0x567a8b);}_0x567a8b[_0x8167('0x11c')]-=0x1;if(!this[_0x8167('0xb5')](_0x567a8b[_0x8167('0x11d')])){return this[_0x8167('0xf')]['error'](_0x567a8b,_0x8167('0x11e'));}var _0x38d676=this['getSound']['sync'](this,_0x567a8b[_0x8167('0x11d')]);if(!_0x38d676){return this[_0x8167('0xf')]['error'](_0x567a8b,_0x8167('0x11f'));}var _0x355209=this[_0x8167('0xf')][_0x8167('0x120')](_0x38d676,_0x567a8b['response'],_0x567a8b['digit']);var _0x28c909=_0x355209[_0x8167('0xba')];if(_0x355209['result']===-0x1){this[_0x8167('0x39')][_0x8167('0x84')](this,_0x567a8b,'-1');return _0x355209;}else if(_0x355209[_0x8167('0xb0')]===_0x8167('0x7a')){_0x355209[_0x8167('0xba')]=_0x355209[_0x8167('0xba')][_0x8167('0xa8')]>0x0?_0x355209[_0x8167('0xba')]:'t';}else if(_['isEmpty'](_0x355209[_0x8167('0xba')])){_0x355209['result']='#';_0x28c909='#';}if(!this[_0x8167('0xb5')](_0x567a8b[_0x8167('0xeb')])){this['channel'][_0x8167('0xbf')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x236ab5=this[_0x8167('0x13')][_0x8167('0x84')](this,_0x567a8b[_0x8167('0xeb')]);if(!_0x236ab5){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x567a8b,_0x8167('0xed'));}this[_0x8167('0xf')][_0x8167('0xf0')](_0x236ab5,_0x28c909);}this['createSquareDetailsReport']['sync'](this,_0x567a8b,_0x28c909);return _0x355209;};AGIVertices['prototype']['noop']=function(_0x1a1f29){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x173'),_0x1a1f29['label']));return this[_0x8167('0xf')][_0x8167('0xbf')](_0x1a1f29[_0x8167('0x174')]||_0x1a1f29[_0x8167('0x3b')]);};AGIVertices['prototype'][_0x8167('0x175')]=function(_0x1ab5a4){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x176'),_0x1ab5a4[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x1ab5a4[_0x8167('0x165')])){return this['channel'][_0x8167('0x2e')](_0x1ab5a4,_0x8167('0x177'));}logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x166'),this['channel']['callerid'],_0x1ab5a4['findBy']));var _0x29b91b=this[_0x8167('0x60')][_0x8167('0x84')](this,_0x1ab5a4['pause_id']);var _0x147bd7=this[_0x8167('0x61')][_0x8167('0x84')](this,_0x1ab5a4[_0x8167('0x165')],_0x29b91b);if(_0x147bd7){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x167'),this[_0x8167('0xf')][_0x8167('0x3f')],_0x1ab5a4[_0x8167('0x165')]));this['channel'][_0x8167('0xbf')](util[_0x8167('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8167('0xf')][_0x8167('0x3f')],_0x1ab5a4[_0x8167('0x165')]));return{'code':0xc8,'result':_0x8167('0x168')};}else{logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x169'),this[_0x8167('0xf')]['callerid'],_0x1ab5a4[_0x8167('0x165')]));this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8167('0xf')][_0x8167('0x3f')],_0x1ab5a4[_0x8167('0x165')]));return{'code':0xc8,'result':_0x8167('0x16c')};}};AGIVertices[_0x8167('0x12')]['playback']=function(_0x5a5ae8){logger['info'](util[_0x8167('0x2b')](_0x8167('0x178'),_0x5a5ae8[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x5a5ae8[_0x8167('0x11d')])){return this['channel'][_0x8167('0x2e')](_0x5a5ae8,'no\x20file\x20audio\x20selected');}var _0x373f91=this[_0x8167('0x20')][_0x8167('0x84')](this,_0x5a5ae8[_0x8167('0x11d')]);if(!_0x373f91){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x5a5ae8,_0x8167('0x11f'));}var _0x3a05fc=this[_0x8167('0xf')]['exec'](_0x8167('0x179'),[_0x373f91,_0x5a5ae8[_0x8167('0x17a')]]);if(_0x3a05fc[_0x8167('0xba')]===-0x1){return _0x3a05fc;}return this[_0x8167('0xf')]['noop'](util['format'](_0x8167('0xd5'),_0x8167('0x179'),_0x373f91));};AGIVertices[_0x8167('0x12')][_0x8167('0x17b')]=function(_0x2efb76){logger[_0x8167('0x2f')](util['format'](_0x8167('0x17c'),_0x2efb76['label']));if(!this[_0x8167('0xb5')](_0x2efb76[_0x8167('0x17d')])){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x2efb76,'no\x20queue\x20selected');}var _0x44d178='';var _0x4cff4c=parseInt(_0x2efb76[_0x8167('0x17d')],0xa);if(isNaN(_0x4cff4c)){_0x44d178=_0x2efb76[_0x8167('0x17d')];}else{_0x44d178=this[_0x8167('0x17')][_0x8167('0x84')](this,_0x2efb76[_0x8167('0x17d')]);if(!_0x44d178){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x2efb76,_0x8167('0x17e'));}}var _0x15c33e='';if(this[_0x8167('0xb5')](_0x2efb76[_0x8167('0x11d')])){var _0x261b18=this['getSound'][_0x8167('0x84')](this,_0x2efb76[_0x8167('0x11d')]);if(_0x261b18){_0x15c33e=_0x261b18;}}this[_0x8167('0x39')][_0x8167('0x84')](this,_0x2efb76,_0x44d178);if(_0x2efb76[_0x8167('0x17a')][_0x8167('0x17f')]('x')<0x0){_0x2efb76[_0x8167('0x17a')]+='x';}if(_0x2efb76['opts']['indexOf']('X')<0x0){_0x2efb76[_0x8167('0x17a')]+='X';}this[_0x8167('0xf')][_0x8167('0xf0')](_0x8167('0x180'),_0x44d178?_0x44d178[_0x8167('0x181')]():'');var _0x322568=this[_0x8167('0xf')][_0x8167('0x6a')]('QUEUE',[_0x44d178,_0x2efb76[_0x8167('0x17a')],_0x2efb76[_0x8167('0x87')],_0x15c33e,_0x2efb76[_0x8167('0x7a')],_0x2efb76[_0x8167('0x8')],_0x2efb76[_0x8167('0x182')],_0x2efb76[_0x8167('0x183')],'',_0x2efb76[_0x8167('0x184')]]);if(_0x322568['result']===-0x1){return _0x322568;}return this['channel']['noop'](util['format'](_0x8167('0xd5'),_0x8167('0x185'),_0x44d178));};AGIVertices['prototype'][_0x8167('0x186')]=function(_0x2e3b3e){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x187'),_0x2e3b3e[_0x8167('0x3b')]));var _0x58b744=_0x2e3b3e[_0x8167('0x188')]||_0x8167('0x13c');var _0x2b23a5=util['format']('%s_%s',this[_0x8167('0xf')]['uniqueid'],rs[_0x8167('0x125')](0x5));var _0x4fc51b=util[_0x8167('0x2b')](_0x8167('0x189'),FILES_PATH,_0x2b23a5,_0x58b744);var _0x49c118=util['format'](_0x8167('0x13d'),FILES_PATH,_0x2b23a5);this[_0x8167('0x3e')][_0x8167('0x84')](this,_0x2e3b3e,_0x2b23a5,_0x4fc51b);this[_0x8167('0xf')][_0x8167('0xf0')](_0x8167('0x18a'),_0x2b23a5);logger['info'](_0x8167('0x18b'),_0x49c118,_0x58b744,_0x2e3b3e[_0x8167('0x18c')],_0x2e3b3e['timeout']);return this[_0x8167('0xf')]['recordFile'](_0x49c118,_0x58b744,_0x2e3b3e[_0x8167('0x18c')],_0x2e3b3e[_0x8167('0x7a')],undefined,!![]);};AGIVertices['prototype'][_0x8167('0x18d')]=function(_0x20aa38){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x18e'),_0x20aa38[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x20aa38['url'])){return this['channel']['noop'](_0x8167('0x18f'));}var _0x3a90f1=this[_0x8167('0x78')][_0x8167('0x84')](this,_0x20aa38);logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x190'),util['inspect'](_0x3a90f1,{'showHidden':![],'depth':null})));if(!this[_0x8167('0xb5')](_0x20aa38[_0x8167('0xeb')])){return this[_0x8167('0xf')]['noop'](_0x8167('0x191'));}var _0x2b4810=this[_0x8167('0x13')]['sync'](this,_0x20aa38['variable_id']);if(!_0x2b4810){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x20aa38,'no\x20variable\x20found');}this['channel']['setVariable'](util[_0x8167('0x2b')]('%s_STATUS_CODE',_0x2b4810),_0x3a90f1[_0x8167('0x8a')]?_0x3a90f1[_0x8167('0x8a')]:_0x8167('0x192'));this['channel'][_0x8167('0xf0')](util[_0x8167('0x2b')](_0x8167('0x193'),_0x2b4810),_0x3a90f1[_0x8167('0x8b')]?_0x3a90f1['statusMessage']:'OK');if(_0x3a90f1[_0x8167('0x7f')]){try{this[_0x8167('0xa9')](_0x3a90f1[_0x8167('0x7f')],_0x2b4810);}catch(_0x177ce1){logger[_0x8167('0x2e')](util[_0x8167('0x2b')](_0x8167('0x194'),_0x2b4810));}}return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')]('variable\x20%s\x20set',_0x2b4810));};AGIVertices[_0x8167('0x12')]['saydigits']=function(_0xcaf7cc){logger[_0x8167('0x2f')](util['format'](_0x8167('0x195'),_0xcaf7cc[_0x8167('0x3b')]));return this[_0x8167('0xf')][_0x8167('0x196')](_0xcaf7cc[_0x8167('0x197')][_0x8167('0x6c')](/\s+/g,''),_0xcaf7cc[_0x8167('0x18c')]);};AGIVertices['prototype'][_0x8167('0x198')]=function(_0x3c5a79){logger['info'](util[_0x8167('0x2b')](_0x8167('0x199'),_0x3c5a79['label']));return this['channel']['sayNumber'](_0x3c5a79[_0x8167('0x7b')][_0x8167('0x6c')](/\s+/g,''),_0x3c5a79[_0x8167('0x18c')]);};AGIVertices[_0x8167('0x12')][_0x8167('0x19a')]=function(_0x1945d1){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x19b'),_0x1945d1['label']));return this['channel'][_0x8167('0x19c')](_0x1945d1['text'],_0x1945d1['escape_digits']);};AGIVertices[_0x8167('0x12')][_0x8167('0x19d')]=function(_0x29bcf6){logger[_0x8167('0x2f')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x29bcf6[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x29bcf6[_0x8167('0x19e')])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0x19f'));}var _0x2bcf51=this[_0x8167('0x24')][_0x8167('0x84')](this,_0x29bcf6[_0x8167('0x19e')]);if(!_0x2bcf51||!_0x2bcf51[_0x8167('0x1a0')]){return this['channel'][_0x8167('0x2e')](_0x29bcf6,_0x8167('0x1a1'));}var _0x29fb91={'from':util[_0x8167('0x2b')](_0x8167('0x1a2'),_0x2bcf51[_0x8167('0x15')],_0x2bcf51[_0x8167('0x1a3')]||_0x2bcf51[_0x8167('0x1a0')][_0x8167('0x1a4')]),'to':_0x29bcf6['to']||'','cc':_0x29bcf6['cc']||'','bcc':_0x29bcf6[_0x8167('0x1a5')]||'','subject':_0x29bcf6['subject'],'html':_0x29bcf6[_0x8167('0x6f')],'text':_0x29bcf6[_0x8167('0x6f')]};var _0x5254bc={'tls':{'rejectUnauthorized':![]}};if(_0x2bcf51[_0x8167('0x1a0')][_0x8167('0x1a6')]){_0x5254bc['service']=_0x2bcf51[_0x8167('0x1a0')][_0x8167('0x1a6')];}else{_0x5254bc['host']=_0x2bcf51[_0x8167('0x1a0')][_0x8167('0x1a7')];_0x5254bc['port']=_0x2bcf51['Smtp'][_0x8167('0x1a8')];_0x5254bc[_0x8167('0x1a9')]=_0x2bcf51[_0x8167('0x1a0')][_0x8167('0x1a9')];}if(_0x2bcf51[_0x8167('0x1a0')][_0x8167('0x1aa')]){_0x5254bc[_0x8167('0x1ab')]={'user':_0x2bcf51['Smtp'][_0x8167('0x1a4')],'pass':_0x2bcf51[_0x8167('0x1a0')][_0x8167('0x1ac')]};}if(this[_0x8167('0xb5')](_0x29bcf6['template_id'])){}logger[_0x8167('0x1ad')](_0x8167('0x1ae'),JSON[_0x8167('0x88')](_0x29fb91));this['createSquareDetailsReport']['sync'](this,_0x29bcf6,_0x29bcf6[_0x8167('0x19e')]);this[_0x8167('0xf')][_0x8167('0xbf')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x2bcf51['name']));this[_0x8167('0x26')][_0x8167('0x84')](this,_0x5254bc,_0x29fb91);return this['channel']['noop'](_0x8167('0x1af'));};AGIVertices[_0x8167('0x12')]['sendFax']=function(_0x37baa7){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x1b0'),_0x37baa7['label']));return this['channel'][_0x8167('0xbf')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0x8167('0x1b1')]=function(_0x2a6460){logger[_0x8167('0x2f')](util['format'](_0x8167('0x1b2'),_0x2a6460[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x2a6460[_0x8167('0x1b3')])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0x1b4'));}var _0x2b4a6d=this[_0x8167('0x36')][_0x8167('0x84')](this,_0x2a6460[_0x8167('0x1b3')]);if(!_0x2b4a6d){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x2a6460,'no\x20sms\x20account\x20found');}var _0x477c97={'body':_0x2a6460[_0x8167('0x1b5')],'phone':_0x2a6460['to']||'','SmsAccountId':_0x2b4a6d['id']};logger[_0x8167('0x1ad')]('sendSMS\x20message',JSON['stringify'](_0x477c97));this[_0x8167('0x39')][_0x8167('0x84')](this,_0x2a6460,_0x2a6460[_0x8167('0x1b3')]);this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x1b6'),_0x2b4a6d[_0x8167('0x15')]));this['createSmsMessage'][_0x8167('0x84')](this,_0x477c97);return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0x1b7'));};AGIVertices['prototype'][_0x8167('0x1b8')]=function(_0x27448a){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x1b9'),_0x27448a[_0x8167('0x3b')]));if(!this['isConfigured'](_0x27448a[_0x8167('0xeb')])){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x27448a,_0x8167('0x1ba'));}var _0x49dab6=this[_0x8167('0x13')][_0x8167('0x84')](this,_0x27448a[_0x8167('0xeb')]);if(!_0x49dab6){return this['channel'][_0x8167('0x2e')](_0x27448a,_0x8167('0xed'));}return this[_0x8167('0xf')][_0x8167('0xf0')](_0x49dab6,_0x27448a['variable_value']);};AGIVertices[_0x8167('0x12')]['start']=function(_0x17d607){logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x1bb'),_0x17d607[_0x8167('0x3b')]));this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0x1bc'));if(_0x17d607['answer']===_0x8167('0x1bd')){this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0x1be'));return this['channel'][_0x8167('0xc9')]();}return this['channel'][_0x8167('0xbf')](_0x8167('0x1bf'));};AGIVertices['prototype'][_0x8167('0x1c0')]=function(_0x33990c){logger['info'](util[_0x8167('0x2b')](_0x8167('0x1c1'),_0x33990c['label']));if(!this[_0x8167('0xb5')](_0x33990c[_0x8167('0x1c2')])){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x33990c,'no\x20subproject\x20selected');}var _0x3f4fbd=this['getSquareProject']['sync'](this,_0x33990c[_0x8167('0x1c2')]);if(!this[_0x8167('0xb5')](_0x3f4fbd)){return this[_0x8167('0xf')]['error'](_0x33990c,util['format'](_0x8167('0x1c3'),_0x33990c[_0x8167('0x1c2')]));}if(_0x3f4fbd===this['channel'][_0x8167('0x3d')]){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x33990c,_0x8167('0x1c4'));}this[_0x8167('0x39')][_0x8167('0x84')](this,_0x33990c,_0x3f4fbd);var _0x8cd2c7=this['channel'][_0x8167('0x6a')](_0x8167('0x1c5'),util[_0x8167('0x2b')](_0x8167('0x1c6'),config[_0x8167('0x8')][_0x8167('0x1a7')]||_0x8167('0x1c7'),_0x3f4fbd,this['channel'][_0x8167('0x3d')]));if(_0x8cd2c7[_0x8167('0xba')]===-0x1){return _0x8cd2c7;}return this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')]('Executed\x20command\x20%s\x20%s',_0x8167('0x1c5'),_0x3f4fbd));};AGIVertices['prototype']['system']=function(_0x2cf71b){logger['info'](util[_0x8167('0x2b')](_0x8167('0x1c8'),_0x2cf71b[_0x8167('0x3b')]));var _0x480091=this[_0x8167('0x69')]['sync'](this,_0x2cf71b[_0x8167('0xc7')]);this[_0x8167('0x39')][_0x8167('0x84')](this,_0x2cf71b,_0x2cf71b[_0x8167('0xc7')]);if(this[_0x8167('0xb5')](_0x2cf71b[_0x8167('0xeb')])){var _0x5b2e6c=this[_0x8167('0x13')][_0x8167('0x84')](this,_0x2cf71b[_0x8167('0xeb')]);if(_0x5b2e6c){this[_0x8167('0xf')]['setVariable'](_0x5b2e6c,_0x480091);return this['channel'][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x1c9'),_0x2cf71b[_0x8167('0xc7')],_0x5b2e6c));}}return this['channel'][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x1ca'),_0x2cf71b[_0x8167('0xc7')]));};AGIVertices[_0x8167('0x12')]['google_cloud_tts']=function(_0x3ab0f6){logger['info'](util[_0x8167('0x2b')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3ab0f6['label']));_0x3ab0f6[_0x8167('0x6f')]=_0x3ab0f6['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3ab0f6[_0x8167('0x6d')])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0x1cb'));}if(!this['isConfigured'](_0x3ab0f6[_0x8167('0x6f')])){return this['channel']['noop'](_0x8167('0xb8'));}this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x1cc'),_0x3ab0f6[_0x8167('0x6f')]));var _0x2c9f01=this[_0x8167('0x1cd')][_0x8167('0x84')](this,_0x3ab0f6);if(_0x2c9f01){this['channel']['noop'](util['format'](_0x8167('0x1ce'),_0x2c9f01));var _0x51919e=this[_0x8167('0xf')][_0x8167('0x10b')](_0x2c9f01);try{fs[_0x8167('0x10c')](_0x2c9f01+_0x8167('0x10d'));}catch(_0x31bb07){logger[_0x8167('0x2e')](_0x31bb07);}return _0x51919e;}return this[_0x8167('0xf')][_0x8167('0x2e')](_0x3ab0f6,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8167('0x12')][_0x8167('0x1cf')]=function(_0x43de07){logger['info'](util[_0x8167('0x2b')](_0x8167('0x1d0'),_0x43de07[_0x8167('0x3b')]));_0x43de07[_0x8167('0x6f')]=_0x43de07['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8167('0xb5')](_0x43de07[_0x8167('0x6f')])){return this[_0x8167('0xf')][_0x8167('0xbf')](_0x8167('0xb8'));}this['channel']['noop'](util[_0x8167('0x2b')]('Trying\x20Google\x20TTS\x20%s',_0x43de07[_0x8167('0x6f')]));var _0x40f69d=this[_0x8167('0x76')]['sync'](this,_0x43de07);if(_0x40f69d){this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x1d1'),_0x40f69d));var _0x2c9af1=this[_0x8167('0xf')][_0x8167('0x10b')](_0x40f69d);try{fs[_0x8167('0x10c')](_0x40f69d+_0x8167('0x10d'));}catch(_0x568be7){logger[_0x8167('0x2e')](_0x568be7);}return _0x2c9af1;}return this[_0x8167('0xf')][_0x8167('0x2e')](_0x43de07,_0x8167('0x1d2'));};AGIVertices[_0x8167('0x12')][_0x8167('0x1d3')]=function(_0x4807c1){logger['info'](util[_0x8167('0x2b')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x4807c1[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x4807c1[_0x8167('0x165')])){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x4807c1,_0x8167('0x177'));}logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x166'),this[_0x8167('0xf')][_0x8167('0x3f')],_0x4807c1[_0x8167('0x165')]));var _0x1d12df=this[_0x8167('0x62')]['sync'](this,_0x4807c1[_0x8167('0x165')]);if(_0x1d12df){logger[_0x8167('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x8167('0x3f')],_0x4807c1['findBy']));this[_0x8167('0xf')][_0x8167('0xbf')](util['format'](_0x8167('0x167'),this[_0x8167('0xf')][_0x8167('0x3f')],_0x4807c1['findBy']));return{'code':0xc8,'result':_0x8167('0x168')};}else{logger[_0x8167('0x2f')](util[_0x8167('0x2b')](_0x8167('0x169'),this[_0x8167('0xf')][_0x8167('0x3f')],_0x4807c1['findBy']));this[_0x8167('0xf')][_0x8167('0xbf')](util[_0x8167('0x2b')](_0x8167('0x169'),this[_0x8167('0xf')][_0x8167('0x3f')],_0x4807c1[_0x8167('0x165')]));return{'code':0xc8,'result':_0x8167('0x16c')};}};AGIVertices[_0x8167('0x12')][_0x8167('0x1d4')]=function(_0x1db757){logger[_0x8167('0x2f')](util[_0x8167('0x2b')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x1db757[_0x8167('0x3b')]));var _0x385430=this[_0x8167('0xf')][_0x8167('0x6a')](_0x8167('0x1d5'),[_0x1db757[_0x8167('0x1d6')],_0x1db757['options']]);if(_0x385430[_0x8167('0xba')]===-0x1){return _0x385430;}return this[_0x8167('0xf')]['noop'](util[_0x8167('0x2b')]('Executed\x20command\x20%s\x20%s',_0x8167('0x1d5'),_0x1db757['mailbox']));};AGIVertices[_0x8167('0x12')][_0x8167('0x1d7')]=function(_0x4ffb35){logger[_0x8167('0x2f')](util['format'](_0x8167('0x1d8'),_0x4ffb35[_0x8167('0x3b')]));if(!this[_0x8167('0xb5')](_0x4ffb35[_0x8167('0xeb')])){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x4ffb35,_0x8167('0x1ba'));}var _0x383e50=this[_0x8167('0x13')][_0x8167('0x84')](this,_0x4ffb35[_0x8167('0xeb')]);if(!_0x383e50){return this[_0x8167('0xf')][_0x8167('0x2e')](_0x4ffb35,_0x8167('0xed'));}var _0x1429c3=this[_0x8167('0xf')][_0x8167('0x13')](_0x383e50);return{'code':0xc8,'result':_0x1429c3['extra']?_0x1429c3[_0x8167('0xb0')]:'-'};};String[_0x8167('0x12')]['replaceAll']=function(_0x128b1d,_0x198984){return this['split'](_0x128b1d)['join'](_0x198984);};module[_0x8167('0x1d9')]=AGIVertices; \ No newline at end of file +var _0x1db2=['Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','true','false','EVAL\x20CONDITION\x20%s\x20%s','condition','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','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','indexOf','toLowerCase','macro','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','join','exports','path','util','lodash','shelljs','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','getVoiceQueue','then','catch','getSquareProject','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','interval','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','createSmsMessage','createSquareDetailsReport','uniqueid','arg_1','callerid','createSquareRecording','context','priority','accountcode','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','in\x20createcmcontact\x20callback','isEmpty','isNil','callback_','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','has','dialTimezone','VALUE\x20TZ','CALLERID(dialTimezone)','getContactByPhone','RES1','dialtimezone','minutestoadd','scheduledat\x20before','scheduledat','add','minutes','scheduledat\x20after','insertContact','timezones','utcOffset','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','format','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','method','timeout','includes','POST','toUpperCase','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','Amy','aws_text_type','awsLex','aws_secret_access_key','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','%s.%s','split','replaceAll','toString','replaceall\x20end','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','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','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','setVariable','%s_ROWS_COUNT','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s'];(function(_0x3a61cd,_0x37c866){var _0x3c72be=function(_0x26cc76){while(--_0x26cc76){_0x3a61cd['push'](_0x3a61cd['shift']());}};_0x3c72be(++_0x37c866);}(_0x1db2,0xd9));var _0x21db=function(_0x523152,_0x1404f5){_0x523152=_0x523152-0x0;var _0x450ff2=_0x1db2[_0x523152];return _0x450ff2;};'use strict';var fs=require('fs');var path=require(_0x21db('0x0'));var util=require(_0x21db('0x1'));var _=require(_0x21db('0x2'));var sh=require(_0x21db('0x3'));var odbc=require('odbc')();var rs=require(_0x21db('0x4'));var moment=require(_0x21db('0x5'));var Mustache=require(_0x21db('0x6'));var rp=require(_0x21db('0x7'));var logger=require('../../config/logger')(_0x21db('0x8'));var config=require(_0x21db('0x9'));var shared=require(_0x21db('0xa'));var scripts=require(_0x21db('0xb'));var FILES_PATH=_0x21db('0xc');var recursiveMapAttributes=[_0x21db('0xd'),_0x21db('0xe')];var verticesWithRetry=['menu',_0x21db('0xf'),_0x21db('0x10')];var AGIVertices=function(_0x359e15,_0x186938,_0x2e16b8){this[_0x21db('0x11')]=_0x359e15;this[_0x21db('0x12')]=_0x186938;this[_0x21db('0x13')]=_0x2e16b8;};AGIVertices[_0x21db('0x14')][_0x21db('0x15')]=function(_0x3afd90,_0x2bf9fb){this[_0x21db('0x12')][_0x21db('0x16')](_0x3afd90)['then'](function(_0x10b31e){_0x2bf9fb(null,_0x10b31e?_0x10b31e[_0x21db('0x17')]:![]);})['catch'](function(_0x2dccac){_0x2bf9fb(_0x2dccac);});};AGIVertices[_0x21db('0x14')][_0x21db('0x18')]=function(_0x2f542a,_0x4b6aa5){this['rpc']['getVoiceQueueById'](_0x2f542a)[_0x21db('0x19')](function(_0x1c717c){_0x4b6aa5(null,_0x1c717c?_0x1c717c[_0x21db('0x17')]:![]);})[_0x21db('0x1a')](function(_0x4793c7){_0x4b6aa5(_0x4793c7);});};AGIVertices[_0x21db('0x14')][_0x21db('0x1b')]=function(_0x2211e7,_0x26ec54){this['rpc']['getSquareProjectById'](_0x2211e7)['then'](function(_0x5db2b6){_0x26ec54(null,_0x5db2b6?_0x5db2b6[_0x21db('0x17')]:![]);})[_0x21db('0x1a')](function(_0x471aac){_0x26ec54(_0x471aac);});};AGIVertices[_0x21db('0x14')]['getSquareOdbc']=function(_0x3cf731,_0x53a2ff){this[_0x21db('0x12')]['getSquareOdbcById'](_0x3cf731)[_0x21db('0x19')](function(_0x51371b){_0x53a2ff(null,_0x51371b?_0x51371b[_0x21db('0x1c')]:![]);})[_0x21db('0x1a')](function(_0x3eb460){_0x53a2ff(_0x3eb460);});};AGIVertices['prototype'][_0x21db('0x1d')]=function(_0x3ca554,_0x1d614f){this['rpc']['getUserById'](_0x3ca554)['then'](function(_0x1bbfd6){_0x1d614f(null,_0x1bbfd6?_0x1bbfd6['name']:![]);})[_0x21db('0x1a')](function(_0x160f5d){_0x1d614f(_0x160f5d);});};AGIVertices[_0x21db('0x14')][_0x21db('0x1e')]=function(_0x1a1e94,_0x46b4ec){this[_0x21db('0x12')][_0x21db('0x1f')](_0x1a1e94)[_0x21db('0x19')](function(_0x282db2){_0x46b4ec(null,_0x282db2?_0x282db2['name']:![]);})[_0x21db('0x1a')](function(_0x257714){_0x46b4ec(_0x257714);});};AGIVertices['prototype'][_0x21db('0x20')]=function(_0x44d0d0,_0x3390c2){var _0x1f7d0f=this;this[_0x21db('0x12')][_0x21db('0x21')](_0x44d0d0)['then'](function(_0x46e9c2){_0x3390c2(null,_0x46e9c2?_0x1f7d0f[_0x21db('0x22')](_0x46e9c2[_0x21db('0x23')]):![]);})['catch'](function(_0x4991c2){_0x3390c2(_0x4991c2);});};AGIVertices['prototype'][_0x21db('0x24')]=function(_0x19a53c,_0x1dbb2f){this[_0x21db('0x12')]['getMailAccountById'](_0x19a53c)[_0x21db('0x19')](function(_0x467c8b){_0x1dbb2f(null,_0x467c8b?_0x467c8b:![]);})[_0x21db('0x1a')](function(_0x1795e6){_0x1dbb2f(_0x1795e6);});};AGIVertices['prototype']['sendMailMessage']=function(_0x163014,_0x164ec6,_0x1a7aba){this[_0x21db('0x13')][_0x21db('0x25')](_0x163014,_0x164ec6)[_0x21db('0x19')](function(){_0x1a7aba(null);})[_0x21db('0x1a')](function(_0xf883ad){_0x1a7aba(_0xf883ad);});};AGIVertices[_0x21db('0x14')][_0x21db('0x26')]=function(_0x52c013,_0x287fc9){this['rpc']['getIntervalById'](_0x52c013)[_0x21db('0x19')](function(_0x321ae4){if(_0x321ae4){if(_0x321ae4[_0x21db('0x27')]){_0x287fc9(null,[_0x321ae4[_0x21db('0x28')]]);}else{_0x287fc9(null,_['map'](_0x321ae4[_0x21db('0x29')],_0x21db('0x28')));}}else{_0x287fc9(null,![]);}})[_0x21db('0x1a')](function(_0x5a476b){_0x287fc9(_0x5a476b);});};AGIVertices['prototype']['getSoundPath']=function(_0x12eb24){return util['format'](_0x21db('0x2a'),FILES_PATH,_0x12eb24);};AGIVertices[_0x21db('0x14')][_0x21db('0x2b')]=function(_0x382314,_0x271f69,_0x25a43f){odbc['open'](_0x382314,function(_0x521d46){if(_0x521d46){logger[_0x21db('0x2c')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x521d46);_0x25a43f(_0x521d46);}else{logger[_0x21db('0x2d')](_0x21db('0x2e'));odbc[_0x21db('0x2f')](_0x271f69,function(_0x364152,_0x14fe9b){if(_0x364152){logger[_0x21db('0x2d')](_0x21db('0x30'),_0x271f69);_0x25a43f(_0x364152);}else{logger[_0x21db('0x2d')]('Query\x20executed\x20correctly\x20%s',_0x271f69);odbc[_0x21db('0x31')](function(_0x22211b){if(_0x22211b){logger[_0x21db('0x2c')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x22211b);}_0x25a43f(null,_0x14fe9b);});}});}});};AGIVertices[_0x21db('0x14')]['getSmsAccount']=function(_0xd0468a,_0x12db0c){this['rpc']['getSmsAccountById'](_0xd0468a)['then'](function(_0x1a725e){_0x12db0c(null,_0x1a725e?_0x1a725e:![]);})[_0x21db('0x1a')](function(_0x1f0b6f){_0x12db0c(_0x1f0b6f);});};AGIVertices[_0x21db('0x14')][_0x21db('0x32')]=function(_0x12788f,_0x4bcb23){this[_0x21db('0x12')]['createSmsMessage'](_0x12788f)['then'](function(_0x58f298){_0x4bcb23(null,_0x58f298);})['catch'](function(_0x8de7f8){_0x4bcb23(_0x8de7f8);});};AGIVertices[_0x21db('0x14')]['createSquareDetailsReport']=function(_0x1ab1e1,_0x35a464,_0x2a508e){this[_0x21db('0x12')][_0x21db('0x33')]({'uniqueid':this['channel'][_0x21db('0x34')],'node':_0x1ab1e1['label'],'application':_0x1ab1e1['agicommand'],'data':_0x35a464||null,'project_name':this[_0x21db('0x11')][_0x21db('0x35')],'callerid':this[_0x21db('0x11')][_0x21db('0x36')]})[_0x21db('0x19')](function(_0x45cd84){if(_0x2a508e){_0x2a508e(null,_0x45cd84);}})[_0x21db('0x1a')](function(_0x4171e6){if(_0x2a508e){_0x2a508e(_0x4171e6);}});};AGIVertices[_0x21db('0x14')][_0x21db('0x37')]=function(_0x29fab0,_0x3d4428,_0x4c99c3,_0x27c86e){this[_0x21db('0x12')][_0x21db('0x37')]({'uniqueid':this[_0x21db('0x11')][_0x21db('0x34')],'callerid':this[_0x21db('0x11')][_0x21db('0x36')],'calleridname':this[_0x21db('0x11')]['calleridname'],'context':this[_0x21db('0x11')][_0x21db('0x38')],'extension':this[_0x21db('0x11')]['extension'],'priority':this[_0x21db('0x11')][_0x21db('0x39')],'accountcode':this[_0x21db('0x11')][_0x21db('0x3a')],'dnid':this['channel']['dnid'],'projectName':this[_0x21db('0x11')][_0x21db('0x35')],'saveName':_0x3d4428,'filename':_0x29fab0[_0x21db('0x3b')]||_0x3d4428,'savePath':_0x4c99c3})[_0x21db('0x19')](function(_0x29106e){_0x27c86e(null,_0x29106e);})[_0x21db('0x1a')](function(_0x5cad47){_0x27c86e(_0x5cad47);});};AGIVertices[_0x21db('0x14')]['createSquareMessage']=function(_0x2530aa,_0x31f658,_0x30fce0){this[_0x21db('0x12')][_0x21db('0x3c')]({'uniqueid':this['channel'][_0x21db('0x34')],'body':_0x2530aa,'direction':_0x31f658})[_0x21db('0x19')](function(_0x549610){if(_0x30fce0){_0x30fce0(null,_0x549610);}})[_0x21db('0x1a')](function(_0x51499a){if(_0x30fce0){_0x30fce0(_0x51499a);}});};AGIVertices['prototype'][_0x21db('0x3d')]=function(_0x1889b1,_0x2d1c45){console[_0x21db('0x3e')](_0x21db('0x3f'),_0x1889b1);console[_0x21db('0x3e')](_0x21db('0x40'),_0x2d1c45);var _0x4b7957=this;var _0xdd54a6=0x0;var _0x572043={'firstName':_[_0x21db('0x41')](_0x1889b1[_0x21db('0x17')])||_[_0x21db('0x42')](_0x1889b1['name'])?_0x21db('0x43')+Math['random']():_0x1889b1[_0x21db('0x17')],'lastName':_[_0x21db('0x41')](_0x1889b1[_0x21db('0x44')])||_[_0x21db('0x42')](_0x1889b1[_0x21db('0x44')])?null:_0x1889b1[_0x21db('0x44')],'phone':_0x1889b1[_0x21db('0x45')],'ListId':_0x1889b1['list_id'],'scheduledat':_0x1889b1[_0x21db('0x46')],'callbackUniqueid':this['channel'][_0x21db('0x34')],'tags':_0x21db('0x47'),'description':_0x21db('0x48')+_0x1889b1[_0x21db('0x46')]['toString'](),'priority':_0x1889b1['callback_priority']};if(_[_0x21db('0x49')](_0x1889b1,_0x21db('0x4a'))){if(!_[_0x21db('0x42')](_0x1889b1['dialTimezone'])){var _0x16445c=_0x1889b1['dialTimezone'];console['log'](_0x21db('0x4b'),_0x16445c);if(_0x1889b1[_0x21db('0x4a')]==_0x21db('0x4c')){this[_0x21db('0x12')][_0x21db('0x4d')]({'phone':_0x1889b1[_0x21db('0x45')]})[_0x21db('0x19')](function(_0x416c92){console[_0x21db('0x3e')](_0x21db('0x4e'),_0x416c92);var _0x28758f=_0x416c92[_0x21db('0x4a')];console['log'](_0x21db('0x4f'),_0x28758f);if(!_[_0x21db('0x42')](_0x28758f)){var _0x10bcdc=shared['timezones'][_0x28758f];console['log']('tz',_0x10bcdc);if(!_['isNil'](_0x10bcdc)){var _0x44e8c2=-0x1*_0x10bcdc['utcOffset'];console['log'](_0x21db('0x50'),_0x44e8c2);console[_0x21db('0x3e')](_0x21db('0x51'),_0x572043['scheduledat']);_0x572043[_0x21db('0x52')]=moment(_0x1889b1[_0x21db('0x52')])[_0x21db('0x53')](_0x44e8c2,_0x21db('0x54'));console[_0x21db('0x3e')](_0x21db('0x55'),_0x572043[_0x21db('0x52')]);_0x4b7957['insertContact'](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0x1ad187){_0x2d1c45(null,_0x1ad187);})[_0x21db('0x1a')](function(_0x55663a){_0x2d1c45(_0x55663a);});}else{_0x4b7957[_0x21db('0x56')](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0x32ac53){_0x2d1c45(null,_0x32ac53);})[_0x21db('0x1a')](function(_0x2045ac){_0x2d1c45(_0x2045ac);});}}else{_0x4b7957['insertContact'](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0x5ab999){_0x2d1c45(null,_0x5ab999);})[_0x21db('0x1a')](function(_0x3965ff){_0x2d1c45(_0x3965ff);});}});}else{var _0xdd54a6=shared[_0x21db('0x57')][_0x16445c];if(!_['isNil'](_0xdd54a6)){var _0x1c48bb=-0x1*_0xdd54a6[_0x21db('0x58')];_0x572043['scheduledat']=moment(_0x1889b1[_0x21db('0x52')])['add'](_0x1c48bb,_0x21db('0x54'));_0x4b7957[_0x21db('0x56')](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0xf30f7c){_0x2d1c45(null,_0xf30f7c);})['catch'](function(_0x30d857){_0x2d1c45(_0x30d857);});}else{_0x4b7957['insertContact'](_0x572043,_0x1889b1,_0x2d1c45)['then'](function(_0x58e179){_0x2d1c45(null,_0x58e179);})['catch'](function(_0x1f87e0){_0x2d1c45(_0x1f87e0);});}}}else{_0x4b7957[_0x21db('0x56')](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0x27f809){_0x2d1c45(null,_0x27f809);})[_0x21db('0x1a')](function(_0xe07756){_0x2d1c45(_0xe07756);});}}else{_0x4b7957[_0x21db('0x56')](_0x572043,_0x1889b1,_0x2d1c45)[_0x21db('0x19')](function(_0x54de36){_0x2d1c45(null,_0x54de36);})[_0x21db('0x1a')](function(_0x52e7a4){_0x2d1c45(_0x52e7a4);});}};AGIVertices[_0x21db('0x14')]['insertContact']=function(_0x1d407d,_0x34e5d6,_0x4faf5f){this[_0x21db('0x12')][_0x21db('0x3d')](_0x1d407d)[_0x21db('0x19')](function(_0x5376a5){_0x4faf5f(null,_0x5376a5);})[_0x21db('0x1a')](function(_0xd27363){_0x4faf5f(_0xd27363);});};AGIVertices[_0x21db('0x14')][_0x21db('0x59')]=function(_0x42554b,_0x22a1ee){this[_0x21db('0x12')][_0x21db('0x5a')](_0x42554b)[_0x21db('0x19')](function(_0xa2ba37){_0x22a1ee(null,_0xa2ba37?_0xa2ba37[_0x21db('0x17')]:![]);})['catch'](function(_0x16e0c7){_0x22a1ee(_0x16e0c7);});};AGIVertices[_0x21db('0x14')]['agentPause']=function(_0x245271,_0x4f568e,_0x379a8b){var _0x4fef9b={'role':_0x21db('0x5b')};_0x4fef9b[_0x245271]=this[_0x21db('0x11')]['callerid'];this[_0x21db('0x12')][_0x21db('0x5c')](_0x4fef9b,_0x4f568e,this[_0x21db('0x11')][_0x21db('0x34')])[_0x21db('0x19')](function(_0x1e0bd1){_0x379a8b(null,_['isNil'](_0x1e0bd1)?![]:!![]);})[_0x21db('0x1a')](function(_0x569535){logger[_0x21db('0x2c')](_0x569535);_0x379a8b(null,![]);});};AGIVertices[_0x21db('0x14')][_0x21db('0x5d')]=function(_0x1cf6de,_0x62bde8){var _0xc93b5a={'role':_0x21db('0x5b')};_0xc93b5a[_0x1cf6de]=this[_0x21db('0x11')][_0x21db('0x36')];this[_0x21db('0x12')][_0x21db('0x5d')](_0xc93b5a)[_0x21db('0x19')](function(_0x1d171a){_0x62bde8(null,_[_0x21db('0x42')](_0x1d171a)?![]:!![]);})['catch'](function(_0x325c87){logger[_0x21db('0x2c')](_0x325c87);_0x62bde8(null,![]);});};AGIVertices[_0x21db('0x14')][_0x21db('0x5e')]=function(_0x412548,_0x271b75){var _0x4a0beb={'role':_0x21db('0x5b')};_0x4a0beb[_0x412548]=this['channel'][_0x21db('0x36')];this[_0x21db('0x12')][_0x21db('0x5e')](_0x4a0beb)['then'](function(_0x1079f3){_0x271b75(null,_[_0x21db('0x42')](_0x1079f3)?![]:!![]);})[_0x21db('0x1a')](function(_0x359b99){logger[_0x21db('0x2c')](_0x359b99);_0x271b75(null,![]);});};AGIVertices[_0x21db('0x14')]['agentLogin']=function(_0x22e38f,_0x48c27e){var _0x5e2ee8={'role':_0x21db('0x5b')};_0x5e2ee8[_0x22e38f]=this[_0x21db('0x11')][_0x21db('0x36')];var _0x77666f=_0x22e38f!='internal'?util[_0x21db('0x5f')]('%s/%s@from-sip/n',_0x21db('0x60'),this[_0x21db('0x11')][_0x21db('0x36')]):undefined;this[_0x21db('0x12')][_0x21db('0x61')](_0x5e2ee8,_0x77666f)['then'](function(_0x53ac17){_0x48c27e(null,_[_0x21db('0x42')](_0x53ac17)?![]:!![]);})[_0x21db('0x1a')](function(_0x82a342){logger[_0x21db('0x2c')](_0x82a342);_0x48c27e(null,![]);});};AGIVertices['prototype'][_0x21db('0x62')]=function(_0x327dd0,_0x357207){sh[_0x21db('0x63')](_[_0x21db('0x64')](_0x327dd0),function(_0xff110e,_0x2659ce){var _0x2b0db8=_0x2659ce[_0x21db('0x65')](/(\r\n|\n|\r)/gm,'');_0x357207(null,_0x2b0db8);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x54d593,_0x3ef79b){scripts[_0x21db('0x66')](_0x54d593[_0x21db('0x67')],_0x54d593[_0x21db('0x68')]||_0x21db('0x69'),_0x54d593[_0x21db('0x69')],_0x54d593[_0x21db('0x6a')]||'en-US',_0x54d593[_0x21db('0x6b')]||_0x21db('0x6c'),_0x54d593[_0x21db('0x6d')]||_0x21db('0x6e'))['then'](function(_0x34a17b){_0x3ef79b(null,_0x34a17b);})['catch'](function(_0x50782e){_0x3ef79b(_0x50782e);});};AGIVertices[_0x21db('0x14')][_0x21db('0x6f')]=function(_0xe93798,_0x53a31e){scripts[_0x21db('0x6f')](_0xe93798[_0x21db('0x69')],_0xe93798[_0x21db('0x70')]||'en',0x1)['then'](function(_0x4a93f1){_0x53a31e(null,_0x4a93f1);})[_0x21db('0x1a')](function(_0xaa5f18){_0x53a31e(_0xaa5f18);});};AGIVertices[_0x21db('0x14')]['restAPI']=function(_0x2dc51e,_0x522fb4){var _0x1d7034={'uri':_0x2dc51e['url'],'method':_0x2dc51e[_0x21db('0x71')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2dc51e[_0x21db('0x72')])==='number'&&parseInt(_0x2dc51e[_0x21db('0x72')])>=0x1?parseInt(_0x2dc51e[_0x21db('0x72')])*0x3e8:0x5*0x3e8};if(_[_0x21db('0x73')]([_0x21db('0x74'),'PUT'],_0x1d7034[_0x21db('0x71')][_0x21db('0x75')]())){try{_0x1d7034['body']=_0x2dc51e['rawBody']?JSON['parse'](_0x2dc51e[_0x21db('0xe')]):{};}catch(_0x110fc8){logger[_0x21db('0x2c')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x110fc8);}}try{_0x1d7034[_0x21db('0x76')]=_0x2dc51e[_0x21db('0xd')]?JSON[_0x21db('0x77')](_0x2dc51e[_0x21db('0xd')]):{};}catch(_0x480138){logger[_0x21db('0x2c')](_0x21db('0x78'),_0x480138);}if(_0x2dc51e['computedVariables']){try{var _0x291941=require(_0x2dc51e[_0x21db('0x79')])[_0x21db('0x7a')](this,_0x1d7034);_0x1d7034[_0x21db('0x7b')]=Mustache[_0x21db('0x7c')](_0x2dc51e[_0x21db('0x7d')],_0x291941,{},['$$','$$']);if(_0x1d7034[_0x21db('0x76')]){_0x1d7034[_0x21db('0x76')]=JSON[_0x21db('0x77')](Mustache[_0x21db('0x7c')](JSON[_0x21db('0x7e')](_0x1d7034[_0x21db('0x76')]),_0x291941,{},['$$','$$']));}if(_0x1d7034[_0x21db('0x7f')]){_0x1d7034[_0x21db('0x7f')]=JSON[_0x21db('0x77')](Mustache[_0x21db('0x7c')](JSON[_0x21db('0x7e')](_0x1d7034[_0x21db('0x7f')]),_0x291941,{},['$$','$$']));}}catch(_0x5629e8){logger[_0x21db('0x2c')](_0x21db('0x80'),_0x5629e8);}}rp(_0x1d7034)[_0x21db('0x19')](function(_0x515c51){var _0x354e3f={'statusCode':_0x515c51[_0x21db('0x81')]||0xc8,'statusMessage':_0x515c51['statusMessage']||'OK','headers':_0x515c51[_0x21db('0x76')]||{},'body':_0x515c51[_0x21db('0x7f')]||{}};_0x522fb4(null,_0x354e3f);})[_0x21db('0x1a')](function(_0x480c3a){var _0x5d526e={'statusCode':_0x480c3a[_0x21db('0x81')]||0x1f4,'statusMessage':_0x480c3a[_0x21db('0x82')]||_0x21db('0x83'),'headers':_0x480c3a[_0x21db('0x84')]['headers']||{},'body':_0x480c3a[_0x21db('0x84')][_0x21db('0x7f')]||{}};_0x522fb4(null,_0x5d526e);});};AGIVertices['prototype'][_0x21db('0x85')]=function(_0x26a775,_0x39132b){scripts[_0x21db('0x85')](this[_0x21db('0x11')][_0x21db('0x34')],_0x26a775[_0x21db('0x86')],_0x26a775[_0x21db('0x69')],_0x26a775[_0x21db('0x87')]||'en')[_0x21db('0x19')](function(_0x21c094){_0x39132b(null,_0x21c094);})[_0x21db('0x1a')](function(_0x3a74e3){_0x39132b(_0x3a74e3);});};AGIVertices['prototype'][_0x21db('0x88')]=function(_0x24e918,_0x191ec){scripts[_0x21db('0x88')](this[_0x21db('0x11')],_0x24e918)[_0x21db('0x19')](function(_0x491fa2){_0x191ec(null,_0x491fa2);})[_0x21db('0x1a')](function(_0x2d787d){_0x191ec(_0x2d787d);});};AGIVertices[_0x21db('0x14')]['ispeechTTS']=function(_0x495248,_0x24a5fa){scripts[_0x21db('0x89')](_0x495248['key'],_0x495248[_0x21db('0x69')],_0x495248[_0x21db('0x8a')]||_0x21db('0x8b'),_0x495248[_0x21db('0x8c')])[_0x21db('0x19')](function(_0x503440){_0x24a5fa(null,_0x503440);})[_0x21db('0x1a')](function(_0x56f823){_0x24a5fa(_0x56f823);});};AGIVertices[_0x21db('0x14')][_0x21db('0x8d')]=function(_0x17b5ed,_0x46f646,_0x323982){scripts['ispeechASR'](_0x46f646,_0x17b5ed[_0x21db('0x86')],_0x17b5ed['ispeech_asr_language']||_0x21db('0x8b'),this[_0x21db('0x8e')](_0x17b5ed[_0x21db('0x8f')])?_0x17b5ed[_0x21db('0x8f')]:undefined)[_0x21db('0x19')](function(_0x50ca0d){_0x323982(null,_0x50ca0d);})['catch'](function(_0x329db6){_0x323982(_0x329db6);});};AGIVertices['prototype'][_0x21db('0x90')]=function(_0x3f6be3,_0xcc6835){scripts[_0x21db('0x90')](_0x3f6be3['aws_access_key_id'],_0x3f6be3['aws_secret_access_key'],_0x3f6be3['aws_polly_region'],_0x3f6be3['aws_polly_voice']||_0x21db('0x91'),_0x3f6be3[_0x21db('0x69')],_0x3f6be3[_0x21db('0x92')]||_0x21db('0x69'))[_0x21db('0x19')](function(_0x122a96){_0xcc6835(null,_0x122a96);})[_0x21db('0x1a')](function(_0x30b714){_0xcc6835(_0x30b714);});};AGIVertices['prototype']['awsLex']=function(_0x100fe3,_0x1e5009){scripts[_0x21db('0x93')](this['channel'][_0x21db('0x34')],_0x100fe3['aws_access_key_id'],_0x100fe3[_0x21db('0x94')],_0x100fe3['aws_lex_region'],_0x100fe3[_0x21db('0x69')],_0x100fe3['aws_bot_name'])[_0x21db('0x19')](function(_0x4c5b8d){_0x1e5009(null,_0x4c5b8d);})[_0x21db('0x1a')](function(_0x451400){_0x1e5009(_0x451400);});};AGIVertices[_0x21db('0x14')][_0x21db('0x95')]=function(_0x34c54d,_0x4cf68f,_0x319636){scripts[_0x21db('0x95')](_0x4cf68f,_0x34c54d[_0x21db('0x86')],_0x34c54d[_0x21db('0x96')]||'en-US')[_0x21db('0x19')](function(_0x11a744){_0x319636(null,_0x11a744);})['catch'](function(_0x4a5c66){_0x319636(_0x4a5c66);});};AGIVertices['prototype'][_0x21db('0x97')]=function(_0x3293ef,_0x210666,_0x553de7){scripts['tildeASR'](_0x210666,_0x3293ef[_0x21db('0x98')],_0x3293ef[_0x21db('0x99')],_0x3293ef[_0x21db('0x7b')])['then'](function(_0x28be15){_0x553de7(null,_0x28be15);})[_0x21db('0x1a')](function(_0xa3db21){_0x553de7(_0xa3db21);});};AGIVertices[_0x21db('0x14')][_0x21db('0x9a')]=function(_0x6c6b2a){var _0x57896=_['includes'](verticesWithRetry,_0x6c6b2a[_0x21db('0x9b')])?_0x6c6b2a:_[_0x21db('0x9c')](_0x6c6b2a);for(var _0x207915 in _0x57896){if(_0x57896[_0x21db('0x9d')](_0x207915)){if(_0x57896[_0x207915]&&_[_0x21db('0x9e')](_0x57896[_0x207915])){if(_[_0x21db('0x73')](recursiveMapAttributes,_0x207915)){_0x57896[_0x207915]=this[_0x21db('0x9f')](_0x57896[_0x207915]);}else{_0x57896[_0x207915]=this['replaceAllVariables'](_0x57896[_0x207915]);}}}}return _0x57896;};AGIVertices['prototype'][_0x21db('0xa0')]=function(_0x628f15){for(var _0x4a3925 in _0x628f15){if(_0x628f15[_0x21db('0x9d')](_0x4a3925)){if(_[_0x21db('0xa1')](_0x628f15[_0x4a3925])){this[_0x21db('0xa0')](_0x628f15[_0x4a3925]);}else if(_['isArray'](_0x628f15[_0x4a3925])){for(var _0x9799aa=0x0;_0x9799aa<_0x628f15[_0x4a3925][_0x21db('0xa2')];_0x9799aa++){this[_0x21db('0xa0')](_0x628f15[_0x4a3925][_0x9799aa]);}}else if(_[_0x21db('0x9e')](_0x628f15[_0x4a3925])){_0x628f15[_0x4a3925]=this[_0x21db('0xa3')](_0x628f15[_0x4a3925]);}}}};AGIVertices[_0x21db('0x14')][_0x21db('0xa4')]=function(_0x565314,_0x490686){for(var _0xaa98f4 in _0x565314){if(_0x565314[_0x21db('0x9d')](_0xaa98f4)){if(_[_0x21db('0xa1')](_0x565314[_0xaa98f4])){if(!_[_0x21db('0x41')](_0x565314[_0xaa98f4])){this[_0x21db('0xa4')](_0x565314[_0xaa98f4],util[_0x21db('0x5f')](_0x21db('0xa5'),_0x490686,_0xaa98f4));}}else if(_['isArray'](_0x565314[_0xaa98f4])){for(var _0x4558ae=0x0;_0x4558ae<_0x565314[_0xaa98f4][_0x21db('0xa2')];_0x4558ae++){this[_0x21db('0xa4')](_0x565314[_0xaa98f4][_0x4558ae],util[_0x21db('0x5f')](_0x21db('0xa5'),_0x490686,_0xaa98f4+'['+_0x4558ae+']'));}}else{if(!_[_0x21db('0x42')](_0x565314[_0xaa98f4])){this[_0x21db('0x11')]['setVariable'](util[_0x21db('0x5f')](_0x21db('0xa5'),_0x490686,_0xaa98f4),_0x565314[_0xaa98f4]);}}}}};AGIVertices[_0x21db('0x14')][_0x21db('0x9f')]=function(_0x2d8b21){try{var _0x54f17b=JSON['parse'](_0x2d8b21);this[_0x21db('0xa0')](_0x54f17b);return JSON[_0x21db('0x7e')](_0x54f17b);}catch(_0x27bfa9){return this[_0x21db('0xa3')](_0x2d8b21);}};AGIVertices[_0x21db('0x14')][_0x21db('0xa3')]=function(_0x26ff89){console['log']('replaceall\x20init',_0x26ff89);var _0x35116=_0x26ff89['split']('{');for(var _0x1794e6=0x1;_0x1794e6<_0x35116[_0x21db('0xa2')];_0x1794e6+=0x1){var _0x5d7bd5=_0x35116[_0x1794e6][_0x21db('0xa6')]('}');console[_0x21db('0x3e')]('nextbracket',_0x5d7bd5);if(_0x5d7bd5[_0x21db('0xa2')]>0x1){_0x26ff89=_0x26ff89[_0x21db('0xa7')]('{'+_0x5d7bd5[0x0]+'}',this['channel'][_0x21db('0x15')](_0x5d7bd5[0x0])['extra']||_0x5d7bd5[0x0]);}}if(_0x35116[_0x21db('0xa2')]===0x1){return _0x26ff89[_0x21db('0xa8')]();}console['log'](_0x21db('0xa9'),_0x26ff89);return this[_0x21db('0xa3')](_0x26ff89);};AGIVertices[_0x21db('0x14')][_0x21db('0xaa')]=function(_0x5c78ee,_0x24dfde){var _0xa7729f=this[_0x21db('0x11')][_0x21db('0x15')](_0x5c78ee);if(_0xa7729f[_0x21db('0xab')]===-0x1){return _0xa7729f;}logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xac'),_0x24dfde,_0xa7729f['extra']));return this[_0x21db('0x11')]['setVariable'](_0x24dfde,_0xa7729f[_0x21db('0xad')]);};AGIVertices[_0x21db('0x14')]['isConfigured']=function(_0x367ce4){return _0x367ce4&&_0x367ce4!=='0'&&_0x367ce4!=='-1'&&_0x367ce4!=='';};AGIVertices[_0x21db('0x14')][_0x21db('0xae')]=function(_0x1cb0fa){this[_0x21db('0x33')]['sync'](this,_0x1cb0fa,'-');_0x1cb0fa[_0x21db('0xaf')]=_0x1cb0fa[_0x21db('0xae')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x21db('0x14')][_0x21db('0xb0')]=function(_0x87ed1c){logger['info'](util[_0x21db('0x5f')](_0x21db('0xb1'),_0x87ed1c[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x87ed1c[_0x21db('0x69')])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0xb4'));}var _0x4ccd72='\x22'+_0x87ed1c[_0x21db('0x69')]+'\x22';if(this[_0x21db('0x8e')](_0x87ed1c[_0x21db('0x84')])){_0x4ccd72+=','+_0x87ed1c[_0x21db('0x84')];}var _0x3c3061=this['channel'][_0x21db('0x63')](_0x21db('0xb5'),_0x4ccd72);if(_0x3c3061[_0x21db('0xab')]===-0x1){return _0x3c3061;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4ccd72));};AGIVertices['prototype'][_0x21db('0xb6')]=function(_0x38e845){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xb7'),_0x38e845[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x38e845[_0x21db('0xb8')])){return this['channel'][_0x21db('0xb3')]('no\x20grammar\x20configured');}var _0x4b069e=_0x38e845[_0x21db('0xb8')];if(this[_0x21db('0x8e')](_0x38e845[_0x21db('0x84')])){_0x4b069e+=','+_0x38e845['options'];}var _0x43f562=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0xb9'),_0x4b069e);if(_0x43f562['result']===-0x1){return _0x43f562;}var _0xdee744=this[_0x21db('0xaa')](_0x21db('0xba'),'MRCP_RECOG_CONFIDENCE');if(_0xdee744['result']===-0x1){return _0xdee744;}var _0x28b57c=this[_0x21db('0xaa')](_0x21db('0xbb'),_0x21db('0xbc'));if(_0x28b57c[_0x21db('0xab')]===-0x1){return _0x28b57c;}var _0x4ef961=this[_0x21db('0xaa')](_0x21db('0xbd'),_0x21db('0xbe'));if(_0x4ef961['result']===-0x1){return _0x4ef961;}return this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0xbf'),_0x4b069e));};AGIVertices[_0x21db('0x14')][_0x21db('0x8')]=function(_0x37b52b){logger['info'](util[_0x21db('0x5f')](_0x21db('0xc0'),_0x37b52b[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0x8')]([_0x37b52b[_0x21db('0xc1')],_0x37b52b[_0x21db('0xc2')]]);};AGIVertices['prototype'][_0x21db('0xc3')]=function(_0x93ec1){logger['info'](util[_0x21db('0x5f')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x93ec1[_0x21db('0xb2')]));if(this['isConfigured'](_0x93ec1['timeout'])){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x93ec1['timeout']));var _0x5ec83a=this[_0x21db('0x11')][_0x21db('0xc4')](_0x93ec1[_0x21db('0x72')]);if(_0x5ec83a[_0x21db('0xab')]===-0x1){return _0x5ec83a;}}return this[_0x21db('0x11')][_0x21db('0xc3')]();};AGIVertices[_0x21db('0x14')]['callback']=function(_0x828f18){console[_0x21db('0x3e')]('enter\x20in\x20callbackblock',_0x828f18);logger['info'](util[_0x21db('0x5f')](_0x21db('0xc5'),_0x828f18[_0x21db('0xb2')]));if(!this['isConfigured'](_0x828f18['list_id'])){return this['channel'][_0x21db('0x2c')](_0x828f18,_0x21db('0xc6'));}_0x828f18[_0x21db('0x46')]=moment();if(this[_0x21db('0x8e')](_0x828f18[_0x21db('0xc7')])){_0x828f18[_0x21db('0x46')]=moment()['add'](_0x828f18['delay'],_0x21db('0x54'));}if(!this['isConfigured'](_0x828f18[_0x21db('0xc8')])){_0x828f18[_0x21db('0xc8')]=0x2;}console[_0x21db('0x3e')](_0x21db('0xc9'),_0x828f18);this['createCmContact']['sync'](this,_0x828f18);return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xca'),_0x828f18[_0x21db('0x45')],_0x828f18['list_id'],_0x828f18[_0x21db('0x46')]));};AGIVertices[_0x21db('0x14')][_0x21db('0xcb')]=function(_0x43a4f9){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xcc'),_0x43a4f9['label']));var _0x28eaa=this[_0x21db('0x11')][_0x21db('0x63')](_0x43a4f9[_0x21db('0xcd')],_0x43a4f9[_0x21db('0x84')]);if(_0x28eaa[_0x21db('0xab')]===-0x1){return _0x28eaa;}return this[_0x21db('0x11')]['noop'](util[_0x21db('0x5f')](_0x21db('0xce'),_0x43a4f9[_0x21db('0xcd')],_0x43a4f9['options']));};AGIVertices[_0x21db('0x14')][_0x21db('0xcf')]=function(_0x594779){logger['info'](util[_0x21db('0x5f')](_0x21db('0xd0'),_0x594779[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x594779[_0x21db('0x69')])){return this[_0x21db('0x11')][_0x21db('0xb3')]('no\x20text\x20configured');}var _0x2366d7='\x22'+_0x594779[_0x21db('0x69')]+'\x22';if(this['isConfigured'](_0x594779[_0x21db('0x84')])){_0x2366d7+=','+_0x594779[_0x21db('0x84')];}var _0x1566b5=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0xb5'),_0x2366d7);if(_0x1566b5[_0x21db('0xab')]===-0x1){return _0x1566b5;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xd1'),_0x2366d7));};AGIVertices[_0x21db('0x14')][_0x21db('0xd2')]=function(_0x51f3e2){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xd3'),_0x51f3e2['label']));if(!this[_0x21db('0x8e')](_0x51f3e2[_0x21db('0x69')])){return this['channel']['noop'](_0x21db('0xb4'));}var _0x3ac3ba='\x22'+_0x51f3e2['text']+'\x22';if(this['isConfigured'](_0x51f3e2[_0x21db('0x84')])){_0x3ac3ba+=','+_0x51f3e2[_0x21db('0x84')];}var _0x56f718=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0xb5'),_0x3ac3ba);if(_0x56f718[_0x21db('0xab')]===-0x1){return _0x56f718;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xd1'),_0x3ac3ba));};AGIVertices[_0x21db('0x14')][_0x21db('0xd4')]=function(_0x20537a){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xd5'),_0x20537a['label']));if(!this['isConfigured'](_0x20537a[_0x21db('0xb8')])){return this['channel'][_0x21db('0xb3')](_0x21db('0xd6'));}var _0x142179=_0x20537a[_0x21db('0xb8')];if(this[_0x21db('0x8e')](_0x20537a[_0x21db('0x84')])){_0x142179+=','+_0x20537a[_0x21db('0x84')];}var _0x578c01=this['channel'][_0x21db('0x63')](_0x21db('0xb9'),_0x142179);if(_0x578c01[_0x21db('0xab')]===-0x1){return _0x578c01;}var _0x31792b=this['getAndSetVariable'](_0x21db('0xba'),'LUMENVOX_ASR_CONFIDENCE');if(_0x31792b['result']===-0x1){return _0x31792b;}var _0x1c3ea5=this[_0x21db('0xaa')](_0x21db('0xbb'),_0x21db('0xd7'));if(_0x1c3ea5['result']===-0x1){return _0x1c3ea5;}var _0x345292=this[_0x21db('0xaa')](_0x21db('0xbd'),_0x21db('0xd8'));if(_0x345292[_0x21db('0xab')]===-0x1){return _0x345292;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xbf'),_0x142179));};AGIVertices['prototype']['sestekasr']=function(_0x202afd){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xd9'),_0x202afd[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x202afd['grammar'])){return this[_0x21db('0x11')]['noop'](_0x21db('0xd6'));}var _0x2825d7=_0x202afd[_0x21db('0xb8')];if(this['isConfigured'](_0x202afd[_0x21db('0x84')])){_0x2825d7+=','+_0x202afd[_0x21db('0x84')];}var _0x3c1f08=this[_0x21db('0x11')][_0x21db('0x63')]('MRCPRecog',_0x2825d7);if(_0x3c1f08['result']===-0x1){return _0x3c1f08;}var _0x4f026d=this[_0x21db('0xaa')](_0x21db('0xba'),_0x21db('0xda'));if(_0x4f026d[_0x21db('0xab')]===-0x1){return _0x4f026d;}var _0x2c14c2=this[_0x21db('0xaa')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x2c14c2[_0x21db('0xab')]===-0x1){return _0x2c14c2;}var _0x2d6047=this[_0x21db('0xaa')]('RECOG_INSTANCE()',_0x21db('0xdb'));if(_0x2d6047[_0x21db('0xab')]===-0x1){return _0x2d6047;}return this[_0x21db('0x11')]['noop'](util[_0x21db('0x5f')](_0x21db('0xbf'),_0x2825d7));};AGIVertices[_0x21db('0x14')]['database']=function(_0x54042a){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0xdc'),_0x54042a[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x54042a[_0x21db('0xdd')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x54042a,_0x21db('0xde'));}var _0x2f81c4=this[_0x21db('0xdf')][_0x21db('0x7a')](this,_0x54042a[_0x21db('0xdd')]);if(!_0x2f81c4){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x54042a,_0x21db('0xe0'));}if(!this[_0x21db('0x8e')](_0x54042a['query'])){return this['channel'][_0x21db('0x2c')](_0x54042a,_0x21db('0xe1'));}var _0x44e3c5=_0x54042a[_0x21db('0x2f')][_0x21db('0x65')](/(\r\n|\n|\r)/gm,'\x20');this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xe2'),_0x44e3c5));var _0x11a904=this[_0x21db('0x2b')]['sync'](this,_0x2f81c4,_0x44e3c5);this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x54042a,_0x44e3c5);if(!this['isConfigured'](_0x54042a[_0x21db('0xe3')])){return this[_0x21db('0x11')]['noop'](_0x21db('0xe4'));}var _0x2b0d5e=this['getVariable'][_0x21db('0x7a')](this,_0x54042a[_0x21db('0xe3')]);if(!_0x2b0d5e){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x54042a,_0x21db('0xe5'));}var _0x25c7ae=this;_0x11a904[_0x21db('0xe6')](function(_0x22edff,_0x2b6d63){Object[_0x21db('0xe7')](_0x22edff)[_0x21db('0xe6')](function(_0xb9e1a9){_0x25c7ae[_0x21db('0x11')]['setVariable'](util['format']('%s[%s][%s]',_0x2b0d5e,_0x2b6d63,_0xb9e1a9),_0x22edff[_0xb9e1a9]);});});this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')](_0x21db('0xe9'),_0x2b0d5e),_0x11a904[_0x21db('0xa2')]);return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('variable\x20%s\x20set',_0x2b0d5e));};AGIVertices[_0x21db('0x14')]['dial']=function(_0x3da429){logger[_0x21db('0xea')](util[_0x21db('0x5f')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x3da429['label']));if(!this[_0x21db('0x8e')](_0x3da429[_0x21db('0xeb')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x3da429,_0x21db('0xec'));}var _0x1717d5=this[_0x21db('0x1d')][_0x21db('0x7a')](this,_0x3da429['sip_id']);if(!_0x1717d5){return this['channel'][_0x21db('0x2c')](_0x3da429,_0x21db('0xed'));}var _0x1f4209=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0xee'),[util['format'](_0x21db('0xef'),_0x1717d5),_0x3da429[_0x21db('0x72')],_0x3da429['opts'],_0x3da429['url']]);if(_0x1f4209['result']===-0x1){return _0x1f4209;}return this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0xf0'),_0x21db('0xee')));};AGIVertices['prototype'][_0x21db('0xf1')]=function(_0x4126b4){logger['info'](util[_0x21db('0x5f')](_0x21db('0xf2'),_0x4126b4[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x4126b4['key'])){return this[_0x21db('0x11')][_0x21db('0xb3')]('no\x20key\x20configured');}if(!this[_0x21db('0x8e')](_0x4126b4[_0x21db('0x69')])){return this['channel'][_0x21db('0xb3')](_0x21db('0xb4'));}this['channel'][_0x21db('0xf3')]=!![];this['createSquareDetailsReport'](_0x4126b4);this[_0x21db('0x3c')](_0x4126b4[_0x21db('0x69')],'in');this['channel'][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xf4'),_0x4126b4['text']));var _0x51dd9f=this[_0x21db('0x85')]['sync'](this,_0x4126b4);if(_0x51dd9f){for(var _0x332674 in _0x51dd9f){if(_0x51dd9f[_0x21db('0x9d')](_0x332674)){this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')](_0x21db('0xf5'),_0x332674['toUpperCase']()),_0x51dd9f[_0x332674]);}}this[_0x21db('0x3c')](_0x51dd9f[_0x21db('0xf6')],_0x21db('0xf7'));return this[_0x21db('0x11')]['noop'](util['format'](_0x21db('0xf8'),_0x51dd9f[_0x21db('0xf6')]));}return this[_0x21db('0x11')][_0x21db('0x2c')](_0x4126b4,_0x21db('0xf9'));};AGIVertices[_0x21db('0x14')][_0x21db('0xfa')]=function(_0x1476d8){logger[_0x21db('0x2d')](util['format'](_0x21db('0xfb'),_0x1476d8[_0x21db('0xb2')]));if(!this['isConfigured'](_0x1476d8[_0x21db('0xfc')])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0xfd'));}if(!this[_0x21db('0x8e')](_0x1476d8[_0x21db('0xfe')])){return this['channel'][_0x21db('0xb3')](_0x21db('0xff'));}if(!this['isConfigured'](_0x1476d8[_0x21db('0x100')])){return this[_0x21db('0x11')]['noop']('no\x20password\x20configured');}if(!this[_0x21db('0x8e')](_0x1476d8['ndassistant_url'])){return this[_0x21db('0x11')]['noop'](_0x21db('0xb4'));}this[_0x21db('0x11')]['bot']=!![];this[_0x21db('0x33')](_0x1476d8);this[_0x21db('0x3c')](_0x1476d8[_0x21db('0x69')],'in');this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x101'),_0x1476d8[_0x21db('0x69')]));var _0x3e5c06=this['sestekNDA'][_0x21db('0x7a')](this,_0x1476d8);if(_0x3e5c06){for(var _0x5aaa85 in _0x3e5c06){if(_0x3e5c06[_0x21db('0x9d')](_0x5aaa85)){this['channel'][_0x21db('0xe8')](util[_0x21db('0x5f')]('SESTEK_NDA_%s',_0x5aaa85[_0x21db('0x75')]()),_0x3e5c06[_0x5aaa85]);}}this['createSquareMessage'](_0x3e5c06[_0x21db('0xf6')],_0x21db('0xf7'));if(_0x3e5c06['audiofile']){this['channel']['noop'](util[_0x21db('0x5f')](_0x21db('0x102'),_0x3e5c06[_0x21db('0x103')]));var _0xaa7903=this[_0x21db('0x11')][_0x21db('0x104')](_0x3e5c06[_0x21db('0x103')]);try{fs[_0x21db('0x105')](_0x3e5c06[_0x21db('0x103')]+'.wav');}catch(_0x462797){logger[_0x21db('0x2c')](_0x462797);}return _0xaa7903;}else{return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x106'),_0x3e5c06[_0x21db('0xf6')]));}}return this[_0x21db('0x11')][_0x21db('0x2c')](_0x1476d8,_0x21db('0x107'));};AGIVertices[_0x21db('0x14')]['end']=function(_0x49e73e){logger[_0x21db('0x2d')](util['format'](_0x21db('0x108'),_0x49e73e[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0x109'));};AGIVertices[_0x21db('0x14')][_0x21db('0x10a')]=function(_0x236799){logger['info'](util['format'](_0x21db('0x10b'),_0x236799[_0x21db('0xb2')]));var _0xa402f1='';if(_0x236799['trunk_id']){if(!this[_0x21db('0x8e')](_0x236799[_0x21db('0x10c')])){return this['channel'][_0x21db('0x2c')](_0x236799,_0x21db('0x10d'));}else{var _0x251686=parseInt(_0x236799[_0x21db('0x10c')],0xa);if(isNaN(_0x251686)){_0xa402f1=_0x236799[_0x21db('0x10c')];}else{_0xa402f1=this['getTrunk'][_0x21db('0x7a')](this,_0x236799[_0x21db('0x10c')]);if(!_0xa402f1){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x236799,_0x21db('0x10e'));}}}}else if(_0x236799[_0x21db('0x10f')]){_0xa402f1=_0x236799[_0x21db('0x10f')];}else{return this[_0x21db('0x11')]['error'](_0x236799,_0x21db('0x10d'));}var _0x5069b3=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0xee'),[util['format'](_0x21db('0x110'),_0xa402f1,_0x236799['phone']),_0x236799[_0x21db('0x72')],_0x236799[_0x21db('0x111')],_0x236799['url']]);if(_0x5069b3[_0x21db('0xab')]===-0x1){return _0x5069b3;}return this['channel'][_0x21db('0xb3')](util['format'](_0x21db('0xf0'),_0x21db('0xee')));};AGIVertices[_0x21db('0x14')][_0x21db('0x112')]=function(_0x592ca7){logger[_0x21db('0x2d')](util['format'](_0x21db('0x113'),_0x592ca7[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0xb3')]('finally');};AGIVertices[_0x21db('0x14')][_0x21db('0xf')]=function(_0x260265){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x260265[_0x21db('0xb2')]));if(_0x260265[_0x21db('0xaf')]===0x0){return this[_0x21db('0xae')](_0x260265);}_0x260265['retry']-=0x1;if(!this['isConfigured'](_0x260265[_0x21db('0x114')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x260265,_0x21db('0x115'));}var _0x2e9a82=this['getSound'][_0x21db('0x7a')](this,_0x260265['file_id']);if(!_0x2e9a82){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x260265,_0x21db('0x116'));}if(!this[_0x21db('0x8e')](_0x260265[_0x21db('0xe3')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x21db('0xe4'));}var _0x52712f=this[_0x21db('0x11')][_0x21db('0x117')](_0x2e9a82,_0x260265[_0x21db('0x118')],_0x260265[_0x21db('0x119')]);var _0x117d97=_0x52712f[_0x21db('0xab')]?_0x52712f['result'][_0x21db('0xa8')]():'';logger[_0x21db('0x2d')]('test',JSON[_0x21db('0x7e')](_0x52712f));if(_0x52712f[_0x21db('0xab')]===-0x1){this[_0x21db('0x33')]['sync'](this,_0x260265,_0x117d97);return _0x52712f;}else if(_0x52712f[_0x21db('0xad')]===_0x21db('0x72')){_0x52712f['result']=_0x117d97['length']>=parseInt(_0x260265[_0x21db('0x11a')])?'x':'i';}else{_0x52712f[_0x21db('0xab')]=_0x117d97['length']>=parseInt(_0x260265[_0x21db('0x11a')])&&_0x117d97[_0x21db('0xa2')]<=parseInt(_0x260265[_0x21db('0x119')])?'x':'i';}var _0x1cf053=this[_0x21db('0x15')][_0x21db('0x7a')](this,_0x260265[_0x21db('0xe3')]);if(!_0x1cf053){return this[_0x21db('0x11')]['error'](_0x260265,'no\x20variable\x20found');}this['channel'][_0x21db('0xe8')](_0x1cf053,_0x117d97);if(this[_0x21db('0x8e')](_0x260265[_0x21db('0x11b')])){var _0x172d5b=parseInt(_0x260265[_0x21db('0x11b')],0xa);var _0x44bd43=rs[_0x21db('0x11c')]({'charset':'*','length':_0x172d5b});var _0x4bbb4c=_0x117d97[_0x21db('0xa2')];if(_0x4bbb4c>0x0){if(_0x4bbb4c>_0x172d5b){this['createSquareDetailsReport'][_0x21db('0x7a')](this,_0x260265,_0x260265[_0x21db('0x11d')]===_0x21db('0x11e')?_0x44bd43+_0x117d97['substr'](_0x172d5b):_0x117d97[_0x21db('0x11f')](0x0,_0x4bbb4c-_0x172d5b)+_0x44bd43);}else{this['createSquareDetailsReport']['sync'](this,_0x260265,rs[_0x21db('0x11c')]({'charset':'*','length':_0x4bbb4c}));}}else{this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x260265,'');}}else{this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x260265,_0x117d97);}return _0x52712f;};AGIVertices['prototype'][_0x21db('0x10')]=function(_0x5924ee){logger[_0x21db('0x2d')](util['format'](_0x21db('0x120'),_0x5924ee[_0x21db('0xb2')]));return this[_0x21db('0xf')](_0x5924ee);};AGIVertices[_0x21db('0x14')][_0x21db('0x121')]=function(_0x40720c){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x122'),_0x40720c[_0x21db('0xb2')]));this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x40720c,_0x40720c['goalname']);return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('GOAL\x20%s',_0x40720c[_0x21db('0x123')]));};AGIVertices[_0x21db('0x14')][_0x21db('0x124')]=function(_0x22203e){logger['info'](util[_0x21db('0x5f')](_0x21db('0x125'),_0x22203e[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x22203e[_0x21db('0x126')])||!this[_0x21db('0x8e')](_0x22203e['aws_secret_access_key'])){return this['channel'][_0x21db('0xb3')](_0x21db('0x127'));}if(!this[_0x21db('0x8e')](_0x22203e['text'])){return this['channel']['noop'](_0x21db('0xb4'));}this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x128'),_0x22203e[_0x21db('0x69')]));var _0x52fa65=this['awsPolly']['sync'](this,_0x22203e);if(_0x52fa65){this[_0x21db('0x11')]['noop'](util[_0x21db('0x5f')](_0x21db('0x129'),_0x52fa65));var _0x55814c=this[_0x21db('0x11')]['streamFile'](_0x52fa65);try{fs['unlink'](_0x52fa65+_0x21db('0x12a'));}catch(_0x10c637){logger[_0x21db('0x2c')](_0x10c637);}return _0x55814c;}return this['channel'][_0x21db('0x2c')](_0x22203e,_0x21db('0x12b'));};AGIVertices[_0x21db('0x14')][_0x21db('0x12c')]=function(_0x1bd7ac){logger['info'](util[_0x21db('0x5f')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x1bd7ac['label']));if(!this[_0x21db('0x8e')](_0x1bd7ac[_0x21db('0x126')])||!this[_0x21db('0x8e')](_0x1bd7ac['aws_secret_access_key'])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0x127'));}if(!this[_0x21db('0x8e')](_0x1bd7ac['aws_bot_name'])){return this[_0x21db('0x11')]['noop'](_0x21db('0x12d'));}if(!this[_0x21db('0x8e')](_0x1bd7ac['text'])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0xb4'));}this['channel'][_0x21db('0xf3')]=!![];this[_0x21db('0x33')](_0x1bd7ac);this[_0x21db('0x3c')](_0x1bd7ac[_0x21db('0x69')],'in');this['channel']['noop'](util[_0x21db('0x5f')](_0x21db('0x12e'),_0x1bd7ac[_0x21db('0x69')]));var _0x40caf6=this[_0x21db('0x93')][_0x21db('0x7a')](this,_0x1bd7ac);if(_0x40caf6){for(var _0x51e43e in _0x40caf6){if(_0x40caf6[_0x21db('0x9d')](_0x51e43e)&&_[_0x21db('0x9e')](_0x40caf6[_0x51e43e])){this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')]('AWS_LEX_%s',_0x51e43e[_0x21db('0x75')]()),_0x40caf6[_0x51e43e]);}}if(_[_0x21db('0x42')](_0x40caf6[_0x21db('0x82')])){return this[_0x21db('0x11')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x21db('0x3c')](_0x40caf6['message'],_0x21db('0xf7'));return this['channel'][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x12f'),_0x40caf6['message']));}}return this[_0x21db('0x11')]['error'](_0x1bd7ac,_0x21db('0x130'));};AGIVertices[_0x21db('0x14')][_0x21db('0x131')]=function(_0x33ed3f){logger[_0x21db('0x2d')](util['format'](_0x21db('0x132'),_0x33ed3f['label'],_0x33ed3f[_0x21db('0x72')]));if(!this['isConfigured'](_0x33ed3f[_0x21db('0x86')])){return this['channel'][_0x21db('0xb3')]('no\x20key\x20configured');}var _0x3cffd1=_0x21db('0x133');var _0x3d654a=util[_0x21db('0x5f')](_0x21db('0x134'),FILES_PATH,rs[_0x21db('0x11c')](0x4));var _0x292b0e=util[_0x21db('0x5f')](_0x21db('0xa5'),_0x3d654a,_0x3cffd1);var _0x196251=!![];if(_0x33ed3f[_0x21db('0x135')]==='NOBEEP'){_0x196251=![];}var _0x285958=this[_0x21db('0x11')][_0x21db('0x136')](_0x3d654a,_0x3cffd1,_0x33ed3f['intKey'],_0x33ed3f[_0x21db('0x72')],undefined,_0x196251);if(_0x285958['result']!==-0x1){this[_0x21db('0x11')][_0x21db('0xb3')](util['format']('google\x20%s\x20file\x20created',_0x292b0e));var _0x4a9bda=this['googleASR'][_0x21db('0x7a')](this,_0x33ed3f,_0x292b0e);if(_0x4a9bda){for(var _0x293460 in _0x4a9bda){if(_0x4a9bda[_0x21db('0x9d')](_0x293460)){this[_0x21db('0x11')][_0x21db('0xe8')](util['format'](_0x21db('0x137'),_0x293460[_0x21db('0x75')]()),_0x4a9bda[_0x293460]);}}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x4a9bda)));}}return _0x285958;};AGIVertices[_0x21db('0x14')]['tildeasr']=function(_0xca9130){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x138'),_0xca9130[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0xca9130[_0x21db('0x98')])){return this[_0x21db('0x11')]['noop'](_0x21db('0x139'));}if(!this[_0x21db('0x8e')](_0xca9130['appsecret'])){return this[_0x21db('0x11')]['noop'](_0x21db('0x13a'));}var _0x23b392=_0x21db('0x133');var _0x4d83e8=util[_0x21db('0x5f')](_0x21db('0x134'),FILES_PATH,rs['generate'](0x4));var _0x5e0a1e=util['format'](_0x21db('0xa5'),_0x4d83e8,_0x23b392);var _0x2cea47=!![];if(_0xca9130[_0x21db('0x135')]===_0x21db('0x13b')){_0x2cea47=![];}var _0x3d64cd=this[_0x21db('0x11')][_0x21db('0x136')](_0x4d83e8,_0x23b392,_0xca9130[_0x21db('0x13c')],_0xca9130['timeout'],undefined,_0x2cea47);if(_0x3d64cd['result']!==-0x1){this['channel'][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x13d'),_0x5e0a1e));var _0x80dc9=this[_0x21db('0x97')][_0x21db('0x7a')](this,_0xca9130,_0x5e0a1e);if(_0x80dc9){for(var _0x28335d in _0x80dc9){if(_0x80dc9[_0x21db('0x9d')](_0x28335d)){this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')](_0x21db('0x13e'),_0x28335d['toUpperCase']()),_0x80dc9[_0x28335d]);}}return this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0x13f'),JSON['stringify'](_0x80dc9)));}}return _0x3d64cd;};AGIVertices['prototype'][_0x21db('0x140')]=function(_0x33ceb7){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x141'),_0x33ceb7[_0x21db('0xb2')]));return this['channel'][_0x21db('0x142')](_0x33ceb7['context'],_0x33ceb7[_0x21db('0x143')],_0x33ceb7[_0x21db('0x39')]);};AGIVertices[_0x21db('0x14')]['gotoif']=function(_0xf3055a){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0xf3055a[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0xf3055a['condition'])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0xf3055a,'no\x20condition\x20configured');}try{var _0x18ebb5=eval(_0xf3055a['condition'])?_0x21db('0x144'):_0x21db('0x145');this['channel'][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x146'),_0xf3055a[_0x21db('0x147')],_0x18ebb5));return{'code':0xc8,'result':_0x18ebb5};}catch(_0xc0cecc){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype']['gotoiftime']=function(_0x40160b){logger['info'](util[_0x21db('0x5f')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x40160b[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x40160b[_0x21db('0x148')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x40160b,'no\x20interval\x20configured');}var _0x2daa2a=this[_0x21db('0x26')][_0x21db('0x7a')](this,_0x40160b[_0x21db('0x148')]);if(!_0x2daa2a){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x40160b,_0x21db('0x149'));}for(var _0x5c6c08=0x0;_0x5c6c08<_0x2daa2a[_0x21db('0xa2')];_0x5c6c08+=0x1){var _0x3b6c3b=this[_0x21db('0x11')]['getVariable'](util['format'](_0x21db('0x14a'),_0x2daa2a[_0x5c6c08]));if(_0x3b6c3b['result']===-0x1){return _0x3b6c3b;}logger[_0x21db('0x2d')](util['format'](_0x21db('0x14b'),_0x2daa2a[_0x5c6c08],_0x3b6c3b[_0x21db('0xad')]));if(_0x3b6c3b[_0x21db('0xad')]==='true'){logger['info'](util[_0x21db('0x5f')](_0x21db('0x14b'),_0x2daa2a[_0x5c6c08],_0x21db('0x144')));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x14b'),_0x2daa2a[_0x5c6c08],_0x21db('0x144')));return{'code':0xc8,'result':_0x21db('0x144')};}else{logger[_0x21db('0x2d')](util['format'](_0x21db('0x14b'),_0x2daa2a[_0x5c6c08],'false'));this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0x14b'),_0x2daa2a[_0x5c6c08],'false'));}}return{'code':0xc8,'result':_0x21db('0x145')};};AGIVertices[_0x21db('0x14')][_0x21db('0x14c')]=function(_0x2b262a){logger[_0x21db('0x2d')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2b262a[_0x21db('0xb2')]));return this['channel']['hangup']();};AGIVertices[_0x21db('0x14')][_0x21db('0x14d')]=function(_0x2ea5c8){logger['info'](util[_0x21db('0x5f')](_0x21db('0x14e'),_0x2ea5c8[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x2ea5c8[_0x21db('0x86')])){return this[_0x21db('0x11')]['noop'](_0x21db('0x14f'));}var _0x5f194a=_0x21db('0x133');var _0x2ada45=util[_0x21db('0x5f')]('%s/recordings/%s',FILES_PATH,rs[_0x21db('0x11c')](0x4));var _0x2dc7ed=util[_0x21db('0x5f')](_0x21db('0xa5'),_0x2ada45,_0x5f194a);var _0x53834b=!![];if(_0x2ea5c8[_0x21db('0x135')]===_0x21db('0x13b')){_0x53834b=![];}var _0x2a6089=this[_0x21db('0x11')][_0x21db('0x136')](_0x2ada45,_0x5f194a,_0x2ea5c8[_0x21db('0x13c')],_0x2ea5c8[_0x21db('0x72')],undefined,_0x53834b);if(_0x2a6089[_0x21db('0xab')]!==-0x1){this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x150'),_0x2dc7ed));var _0x31fe76=this[_0x21db('0x8d')][_0x21db('0x7a')](this,_0x2ea5c8,_0x2dc7ed);if(_0x31fe76){for(var _0x29aec3 in _0x31fe76){if(_0x31fe76[_0x21db('0x9d')](_0x29aec3)){this[_0x21db('0x11')]['setVariable'](util[_0x21db('0x5f')]('ISPEECH_ASR_%s',_0x29aec3['toUpperCase']()),_0x31fe76[_0x29aec3]);}}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('IspeechASR\x20Result\x20%s',JSON[_0x21db('0x7e')](_0x31fe76)));}}return _0x2a6089;};AGIVertices[_0x21db('0x14')][_0x21db('0x151')]=function(_0x1826c5){logger['info'](util[_0x21db('0x5f')](_0x21db('0x152'),_0x1826c5[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x1826c5['key'])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0x14f'));}if(!this['isConfigured'](_0x1826c5['text'])){return this['channel'][_0x21db('0xb3')](_0x21db('0xb4'));}this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0x153'),_0x1826c5[_0x21db('0x69')]));var _0x38b84b=this['ispeechTTS'][_0x21db('0x7a')](this,_0x1826c5);if(_0x38b84b){this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x150'),_0x38b84b));var _0x935ee6=this[_0x21db('0x11')]['streamFile'](_0x38b84b,_0x1826c5['intKey']);try{fs['unlink'](_0x38b84b+_0x21db('0x12a'));}catch(_0x48d3e1){logger[_0x21db('0x2c')](_0x48d3e1);}return _0x935ee6;}return this[_0x21db('0x11')][_0x21db('0x2c')](_0x1826c5,_0x21db('0x154'));};AGIVertices[_0x21db('0x14')][_0x21db('0x155')]=function(_0xa0baef){logger['info'](util[_0x21db('0x5f')](_0x21db('0x156'),_0xa0baef[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0xa0baef[_0x21db('0x157')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0xa0baef,_0x21db('0x158'));}logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x159'),this[_0x21db('0x11')][_0x21db('0x36')],_0xa0baef[_0x21db('0x157')]));var _0x2a7cd5=this[_0x21db('0x61')][_0x21db('0x7a')](this,_0xa0baef['findBy']);if(_0x2a7cd5){logger[_0x21db('0x2d')](util['format'](_0x21db('0x15a'),this['channel'][_0x21db('0x36')],_0xa0baef[_0x21db('0x157')]));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x21db('0x11')][_0x21db('0x36')],_0xa0baef[_0x21db('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0x21db('0x2d')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x21db('0x36')],_0xa0baef[_0x21db('0x157')]));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x15b'),this[_0x21db('0x11')]['callerid'],_0xa0baef[_0x21db('0x157')]));return{'code':0xc8,'result':_0x21db('0x15c')};}};AGIVertices[_0x21db('0x14')]['logout']=function(_0x3bd897){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x15d'),_0x3bd897[_0x21db('0xb2')]));if(!this['isConfigured'](_0x3bd897['findBy'])){return this['channel']['error'](_0x3bd897,_0x21db('0x158'));}logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x159'),this[_0x21db('0x11')]['callerid'],_0x3bd897[_0x21db('0x157')]));var _0x3f226b=this[_0x21db('0x5e')][_0x21db('0x7a')](this,_0x3bd897['findBy']);if(_0x3f226b){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x15a'),this[_0x21db('0x11')][_0x21db('0x36')],_0x3bd897[_0x21db('0x157')]));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x21db('0x11')][_0x21db('0x36')],_0x3bd897['findBy']));return{'code':0xc8,'result':_0x21db('0x15e')};}else{logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x15b'),this[_0x21db('0x11')][_0x21db('0x36')],_0x3bd897[_0x21db('0x157')]));this[_0x21db('0x11')]['noop'](util[_0x21db('0x5f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x21db('0x11')]['callerid'],_0x3bd897[_0x21db('0x157')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x21db('0x14')][_0x21db('0x15f')]=function(_0x130c3){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x160'),_0x130c3[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x130c3[_0x21db('0x161')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x130c3,_0x21db('0x162'));}this['channel']['noop'](util['format'](_0x21db('0x163'),_0x130c3[_0x21db('0x161')]));var _0x4e86c4=eval(_0x130c3[_0x21db('0x161')]);if(!this[_0x21db('0x8e')](_0x130c3['variable_id'])){return this['channel'][_0x21db('0xb3')](_0x21db('0xe4'));}var _0x4fa01f=this['getVariable'][_0x21db('0x7a')](this,_0x130c3[_0x21db('0xe3')]);if(!_0x4fa01f){return this[_0x21db('0x11')]['error'](_0x130c3,_0x21db('0xe5'));}if(_[_0x21db('0x164')](_0x4e86c4)){var _0x4c6342=this;_0x4e86c4['forEach'](function(_0x4caf8e,_0x2c580c){_0x4c6342[_0x21db('0x11')][_0x21db('0xe8')](util['format'](_0x21db('0x165'),_0x4fa01f,_0x2c580c),_0x4caf8e);});return this[_0x21db('0x11')]['noop'](util[_0x21db('0x5f')]('variable\x20%s[key]\x20set',_0x4fa01f));}else{return this[_0x21db('0x11')][_0x21db('0xe8')](_0x4fa01f,_0x4e86c4);}};AGIVertices[_0x21db('0x14')][_0x21db('0x166')]=function(_0x308059){logger['info'](util[_0x21db('0x5f')](_0x21db('0x167'),_0x308059['label']));if(_0x308059[_0x21db('0xaf')]===0x0){return this[_0x21db('0xae')](_0x308059);}_0x308059[_0x21db('0xaf')]-=0x1;if(!this[_0x21db('0x8e')](_0x308059[_0x21db('0x114')])){return this['channel'][_0x21db('0x2c')](_0x308059,_0x21db('0x115'));}var _0x5cc99e=this[_0x21db('0x20')][_0x21db('0x7a')](this,_0x308059[_0x21db('0x114')]);if(!_0x5cc99e){return this[_0x21db('0x11')]['error'](_0x308059,_0x21db('0x116'));}var _0x2f5ae2=this[_0x21db('0x11')][_0x21db('0x117')](_0x5cc99e,_0x308059[_0x21db('0x118')],_0x308059[_0x21db('0x168')]);var _0x1e80a7=_0x2f5ae2[_0x21db('0xab')];if(_0x2f5ae2[_0x21db('0xab')]===-0x1){this[_0x21db('0x33')]['sync'](this,_0x308059,'-1');return _0x2f5ae2;}else if(_0x2f5ae2[_0x21db('0xad')]==='timeout'){_0x2f5ae2['result']=_0x2f5ae2['result']['length']>0x0?_0x2f5ae2[_0x21db('0xab')]:'t';}else if(_['isEmpty'](_0x2f5ae2[_0x21db('0xab')])){_0x2f5ae2[_0x21db('0xab')]='#';_0x1e80a7='#';}if(!this[_0x21db('0x8e')](_0x308059['variable_id'])){this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0xe4'));}else{var _0x3f9460=this[_0x21db('0x15')][_0x21db('0x7a')](this,_0x308059[_0x21db('0xe3')]);if(!_0x3f9460){return this['channel'][_0x21db('0x2c')](_0x308059,_0x21db('0xe5'));}this[_0x21db('0x11')]['setVariable'](_0x3f9460,_0x1e80a7);}this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x308059,_0x1e80a7);return _0x2f5ae2;};AGIVertices[_0x21db('0x14')][_0x21db('0xb3')]=function(_0xc6af2a){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0xc6af2a[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0xb3')](_0xc6af2a[_0x21db('0x169')]||_0xc6af2a[_0x21db('0xb2')]);};AGIVertices[_0x21db('0x14')][_0x21db('0x16a')]=function(_0x3df800){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x16b'),_0x3df800[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x3df800['findBy'])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x3df800,_0x21db('0x158'));}logger[_0x21db('0x2d')](util['format'](_0x21db('0x159'),this['channel']['callerid'],_0x3df800[_0x21db('0x157')]));var _0x20547f=this[_0x21db('0x59')][_0x21db('0x7a')](this,_0x3df800[_0x21db('0x16c')]);var _0x5e84e0=this[_0x21db('0x5c')][_0x21db('0x7a')](this,_0x3df800[_0x21db('0x157')],_0x20547f);if(_0x5e84e0){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x15a'),this[_0x21db('0x11')]['callerid'],_0x3df800['findBy']));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x15a'),this['channel']['callerid'],_0x3df800['findBy']));return{'code':0xc8,'result':_0x21db('0x15e')};}else{logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x21db('0x11')][_0x21db('0x36')],_0x3df800[_0x21db('0x157')]));this['channel'][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x15a'),this[_0x21db('0x11')]['callerid'],_0x3df800[_0x21db('0x157')]));return{'code':0xc8,'result':_0x21db('0x15c')};}};AGIVertices['prototype'][_0x21db('0x16d')]=function(_0xaa99c){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x16e'),_0xaa99c[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0xaa99c[_0x21db('0x114')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0xaa99c,_0x21db('0x115'));}var _0x396b81=this[_0x21db('0x20')][_0x21db('0x7a')](this,_0xaa99c[_0x21db('0x114')]);if(!_0x396b81){return this[_0x21db('0x11')][_0x21db('0x2c')](_0xaa99c,'no\x20file\x20audio\x20found');}var _0x30bb26=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0x16f'),[_0x396b81,_0xaa99c[_0x21db('0x111')]]);if(_0x30bb26[_0x21db('0xab')]===-0x1){return _0x30bb26;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xce'),_0x21db('0x16f'),_0x396b81));};AGIVertices[_0x21db('0x14')][_0x21db('0x170')]=function(_0x2d3906){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x171'),_0x2d3906['label']));if(!this[_0x21db('0x8e')](_0x2d3906[_0x21db('0x172')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x2d3906,_0x21db('0x173'));}var _0x492238='';var _0x8b0e78=parseInt(_0x2d3906[_0x21db('0x172')],0xa);if(isNaN(_0x8b0e78)){_0x492238=_0x2d3906[_0x21db('0x172')];}else{_0x492238=this[_0x21db('0x18')][_0x21db('0x7a')](this,_0x2d3906[_0x21db('0x172')]);if(!_0x492238){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x2d3906,'no\x20queue\x20found');}}var _0x39a259='';if(this['isConfigured'](_0x2d3906[_0x21db('0x114')])){var _0x2ad090=this[_0x21db('0x20')][_0x21db('0x7a')](this,_0x2d3906['file_id']);if(_0x2ad090){_0x39a259=_0x2ad090;}}this[_0x21db('0x33')]['sync'](this,_0x2d3906,_0x492238);if(_0x2d3906[_0x21db('0x111')][_0x21db('0x174')]('x')<0x0){_0x2d3906['opts']+='x';}if(_0x2d3906[_0x21db('0x111')]['indexOf']('X')<0x0){_0x2d3906[_0x21db('0x111')]+='X';}this[_0x21db('0x11')][_0x21db('0xe8')]('XMCS-QUEUE',_0x492238?_0x492238[_0x21db('0x175')]():'');var _0x35c75b=this[_0x21db('0x11')][_0x21db('0x63')]('QUEUE',[_0x492238,_0x2d3906['opts'],_0x2d3906[_0x21db('0x7d')],_0x39a259,_0x2d3906[_0x21db('0x72')],_0x2d3906['agi'],_0x2d3906[_0x21db('0x176')],_0x2d3906['gosub'],'',_0x2d3906[_0x21db('0x177')]]);if(_0x35c75b[_0x21db('0xab')]===-0x1){return _0x35c75b;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xce'),_0x21db('0x178'),_0x492238));};AGIVertices['prototype'][_0x21db('0x179')]=function(_0x20f572){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x17a'),_0x20f572[_0x21db('0xb2')]));var _0x4d242a=_0x20f572[_0x21db('0x17b')]||'wav';var _0x37002d=util[_0x21db('0x5f')](_0x21db('0x17c'),this['channel'][_0x21db('0x34')],rs[_0x21db('0x11c')](0x5));var _0x4026d2=util[_0x21db('0x5f')](_0x21db('0x17d'),FILES_PATH,_0x37002d,_0x4d242a);var _0x2579e9=util[_0x21db('0x5f')](_0x21db('0x134'),FILES_PATH,_0x37002d);this[_0x21db('0x37')][_0x21db('0x7a')](this,_0x20f572,_0x37002d,_0x4026d2);this[_0x21db('0x11')][_0x21db('0xe8')]('RECORDING_SAVENAME',_0x37002d);logger['info'](_0x21db('0x17e'),_0x2579e9,_0x4d242a,_0x20f572['escape_digits'],_0x20f572[_0x21db('0x72')]);return this[_0x21db('0x11')][_0x21db('0x136')](_0x2579e9,_0x4d242a,_0x20f572[_0x21db('0x17f')],_0x20f572[_0x21db('0x72')],undefined,!![]);};AGIVertices[_0x21db('0x14')][_0x21db('0x180')]=function(_0x3c7368){logger['info'](util['format'](_0x21db('0x181'),_0x3c7368[_0x21db('0xb2')]));if(!this['isConfigured'](_0x3c7368[_0x21db('0x7d')])){return this[_0x21db('0x11')][_0x21db('0xb3')]('no\x20url\x20configured');}var _0x17b9ca=this[_0x21db('0x182')][_0x21db('0x7a')](this,_0x3c7368);logger['info'](util[_0x21db('0x5f')](_0x21db('0x183'),util[_0x21db('0x184')](_0x17b9ca,{'showHidden':![],'depth':null})));if(!this[_0x21db('0x8e')](_0x3c7368[_0x21db('0xe3')])){return this[_0x21db('0x11')]['noop'](_0x21db('0x185'));}var _0x92c51f=this[_0x21db('0x15')][_0x21db('0x7a')](this,_0x3c7368[_0x21db('0xe3')]);if(!_0x92c51f){return this['channel'][_0x21db('0x2c')](_0x3c7368,'no\x20variable\x20found');}this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')](_0x21db('0x186'),_0x92c51f),_0x17b9ca[_0x21db('0x81')]?_0x17b9ca[_0x21db('0x81')]:_0x21db('0x187'));this[_0x21db('0x11')][_0x21db('0xe8')](util[_0x21db('0x5f')](_0x21db('0x188'),_0x92c51f),_0x17b9ca[_0x21db('0x189')]?_0x17b9ca['statusMessage']:'OK');if(_0x17b9ca[_0x21db('0x7f')]){try{this[_0x21db('0xa4')](_0x17b9ca[_0x21db('0x7f')],_0x92c51f);}catch(_0x4a353c){logger[_0x21db('0x2c')](util[_0x21db('0x5f')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x92c51f));}}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x18a'),_0x92c51f));};AGIVertices['prototype'][_0x21db('0x18b')]=function(_0x5512c9){logger[_0x21db('0x2d')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5512c9[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0x18c')](_0x5512c9[_0x21db('0x18d')][_0x21db('0x65')](/\s+/g,''),_0x5512c9['escape_digits']);};AGIVertices[_0x21db('0x14')][_0x21db('0x18e')]=function(_0xa7631a){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x18f'),_0xa7631a[_0x21db('0xb2')]));return this[_0x21db('0x11')][_0x21db('0x190')](_0xa7631a[_0x21db('0x191')][_0x21db('0x65')](/\s+/g,''),_0xa7631a[_0x21db('0x17f')]);};AGIVertices[_0x21db('0x14')][_0x21db('0x192')]=function(_0x3dc874){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x193'),_0x3dc874['label']));return this[_0x21db('0x11')][_0x21db('0x194')](_0x3dc874[_0x21db('0x69')],_0x3dc874[_0x21db('0x17f')]);};AGIVertices[_0x21db('0x14')][_0x21db('0x195')]=function(_0x44c532){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x196'),_0x44c532[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x44c532[_0x21db('0x197')])){return this[_0x21db('0x11')]['noop'](_0x21db('0x198'));}var _0x2085fd=this['getMailAccount'][_0x21db('0x7a')](this,_0x44c532[_0x21db('0x197')]);if(!_0x2085fd||!_0x2085fd[_0x21db('0x199')]){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x44c532,_0x21db('0x19a'));}var _0x12ca4a={'from':util[_0x21db('0x5f')](_0x21db('0x19b'),_0x2085fd['name'],_0x2085fd['email']||_0x2085fd[_0x21db('0x199')][_0x21db('0x19c')]),'to':_0x44c532['to']||'','cc':_0x44c532['cc']||'','bcc':_0x44c532[_0x21db('0x19d')]||'','subject':_0x44c532[_0x21db('0x19e')],'html':_0x44c532[_0x21db('0x69')],'text':_0x44c532['text']};var _0x4d2fec={'tls':{'rejectUnauthorized':![]}};if(_0x2085fd['Smtp'][_0x21db('0x19f')]){_0x4d2fec[_0x21db('0x19f')]=_0x2085fd[_0x21db('0x199')][_0x21db('0x19f')];}else{_0x4d2fec[_0x21db('0x1a0')]=_0x2085fd[_0x21db('0x199')][_0x21db('0x1a0')];_0x4d2fec[_0x21db('0x1a1')]=_0x2085fd[_0x21db('0x199')]['port'];_0x4d2fec['secure']=_0x2085fd[_0x21db('0x199')][_0x21db('0x1a2')];}if(_0x2085fd['Smtp'][_0x21db('0x1a3')]){_0x4d2fec[_0x21db('0x1a4')]={'user':_0x2085fd['Smtp'][_0x21db('0x19c')],'pass':_0x2085fd[_0x21db('0x199')][_0x21db('0x1a5')]};}if(this[_0x21db('0x8e')](_0x44c532[_0x21db('0x1a6')])){}logger[_0x21db('0xea')](_0x21db('0x1a7'),JSON[_0x21db('0x7e')](_0x12ca4a));this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x44c532,_0x44c532['account_id']);this[_0x21db('0x11')][_0x21db('0xb3')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x2085fd['name']));this[_0x21db('0x25')]['sync'](this,_0x4d2fec,_0x12ca4a);return this[_0x21db('0x11')]['noop'](_0x21db('0x1a8'));};AGIVertices['prototype'][_0x21db('0x1a9')]=function(_0x5d6b66){logger['info'](util['format'](_0x21db('0x1aa'),_0x5d6b66[_0x21db('0xb2')]));return this[_0x21db('0x11')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x21db('0x14')]['sendSMS']=function(_0x2c131b){logger['info'](util[_0x21db('0x5f')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2c131b[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x2c131b['sms_account_id'])){return this[_0x21db('0x11')]['noop']('no\x20sms\x20account\x20configured');}var _0xbb02ec=this[_0x21db('0x1ab')][_0x21db('0x7a')](this,_0x2c131b[_0x21db('0x1ac')]);if(!_0xbb02ec){return this['channel']['error'](_0x2c131b,_0x21db('0x1ad'));}var _0x2771ae={'body':_0x2c131b['sms_text'],'phone':_0x2c131b['to']||'','SmsAccountId':_0xbb02ec['id']};logger[_0x21db('0xea')]('sendSMS\x20message',JSON[_0x21db('0x7e')](_0x2771ae));this[_0x21db('0x33')][_0x21db('0x7a')](this,_0x2c131b,_0x2c131b[_0x21db('0x1ac')]);this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x1ae'),_0xbb02ec['name']));this[_0x21db('0x32')][_0x21db('0x7a')](this,_0x2771ae);return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0x1af'));};AGIVertices['prototype'][_0x21db('0x1b0')]=function(_0x4781ea){logger['info'](util[_0x21db('0x5f')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x4781ea[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x4781ea['variable_id'])){return this[_0x21db('0x11')]['error'](_0x4781ea,_0x21db('0x1b1'));}var _0x40e958=this['getVariable'][_0x21db('0x7a')](this,_0x4781ea[_0x21db('0xe3')]);if(!_0x40e958){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x4781ea,_0x21db('0xe5'));}return this['channel']['setVariable'](_0x40e958,_0x4781ea['variable_value']);};AGIVertices[_0x21db('0x14')][_0x21db('0x1b2')]=function(_0xf2111c){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x1b3'),_0xf2111c[_0x21db('0xb2')]));this['channel']['noop'](_0x21db('0x1b4'));if(_0xf2111c[_0x21db('0xc3')]==='yes'){this[_0x21db('0x11')][_0x21db('0xb3')]('Answer');return this[_0x21db('0x11')][_0x21db('0xc3')]();}return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0x1b5'));};AGIVertices[_0x21db('0x14')][_0x21db('0x1b6')]=function(_0x1e8b37){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x1b7'),_0x1e8b37[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x1e8b37['project_id'])){return this['channel']['error'](_0x1e8b37,_0x21db('0x1b8'));}var _0xedec31=this['getSquareProject'][_0x21db('0x7a')](this,_0x1e8b37[_0x21db('0x1b9')]);if(!this[_0x21db('0x8e')](_0xedec31)){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x1e8b37,util[_0x21db('0x5f')](_0x21db('0x1ba'),_0x1e8b37['project_id']));}if(_0xedec31===this['channel'][_0x21db('0x35')]){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x1e8b37,_0x21db('0x1bb'));}this['createSquareDetailsReport']['sync'](this,_0x1e8b37,_0xedec31);var _0x58a747=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0x1bc'),util['format'](_0x21db('0x1bd'),config[_0x21db('0x8')]['host']||'127.0.0.1',_0xedec31,this[_0x21db('0x11')][_0x21db('0x35')]));if(_0x58a747[_0x21db('0xab')]===-0x1){return _0x58a747;}return this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0xce'),'AGI',_0xedec31));};AGIVertices['prototype'][_0x21db('0x1be')]=function(_0x83f5bb){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x1bf'),_0x83f5bb['label']));var _0x47eec8=this[_0x21db('0x62')]['sync'](this,_0x83f5bb[_0x21db('0xc1')]);this['createSquareDetailsReport'][_0x21db('0x7a')](this,_0x83f5bb,_0x83f5bb[_0x21db('0xc1')]);if(this['isConfigured'](_0x83f5bb[_0x21db('0xe3')])){var _0x59a141=this['getVariable']['sync'](this,_0x83f5bb[_0x21db('0xe3')]);if(_0x59a141){this['channel']['setVariable'](_0x59a141,_0x47eec8);return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x1c0'),_0x83f5bb[_0x21db('0xc1')],_0x59a141));}}return this['channel']['noop'](util['format'](_0x21db('0x1c1'),_0x83f5bb['command']));};AGIVertices[_0x21db('0x14')][_0x21db('0x1c2')]=function(_0x27cda2){logger[_0x21db('0x2d')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x27cda2[_0x21db('0xb2')]));_0x27cda2[_0x21db('0x69')]=_0x27cda2[_0x21db('0x69')][_0x21db('0x65')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x27cda2[_0x21db('0x67')])){return this[_0x21db('0x11')][_0x21db('0xb3')]('no\x20apiKey\x20configured');}if(!this[_0x21db('0x8e')](_0x27cda2[_0x21db('0x69')])){return this['channel']['noop'](_0x21db('0xb4'));}this[_0x21db('0x11')][_0x21db('0xb3')](util['format'](_0x21db('0x1c3'),_0x27cda2[_0x21db('0x69')]));var _0x53a615=this['googleCloudTTS'][_0x21db('0x7a')](this,_0x27cda2);if(_0x53a615){this['channel']['noop'](util[_0x21db('0x5f')](_0x21db('0x1c4'),_0x53a615));var _0x3d04ef=this['channel'][_0x21db('0x104')](_0x53a615);try{fs[_0x21db('0x105')](_0x53a615+_0x21db('0x12a'));}catch(_0x213c73){logger[_0x21db('0x2c')](_0x213c73);}return _0x3d04ef;}return this[_0x21db('0x11')][_0x21db('0x2c')](_0x27cda2,_0x21db('0x1c5'));};AGIVertices[_0x21db('0x14')][_0x21db('0x1c6')]=function(_0x2d2b07){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2d2b07[_0x21db('0xb2')]));_0x2d2b07[_0x21db('0x69')]=_0x2d2b07['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x21db('0x8e')](_0x2d2b07[_0x21db('0x69')])){return this[_0x21db('0x11')][_0x21db('0xb3')](_0x21db('0xb4'));}this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x1c7'),_0x2d2b07[_0x21db('0x69')]));var _0x475011=this[_0x21db('0x6f')][_0x21db('0x7a')](this,_0x2d2b07);if(_0x475011){this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x1c8'),_0x475011));var _0x4037d5=this['channel'][_0x21db('0x104')](_0x475011);try{fs['unlink'](_0x475011+_0x21db('0x12a'));}catch(_0x1a5f12){logger[_0x21db('0x2c')](_0x1a5f12);}return _0x4037d5;}return this[_0x21db('0x11')][_0x21db('0x2c')](_0x2d2b07,_0x21db('0x1c9'));};AGIVertices[_0x21db('0x14')][_0x21db('0x1ca')]=function(_0x11f431){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x1cb'),_0x11f431[_0x21db('0xb2')]));if(!this['isConfigured'](_0x11f431[_0x21db('0x157')])){return this['channel'][_0x21db('0x2c')](_0x11f431,'no\x20find\x20by\x20configured');}logger['info'](util[_0x21db('0x5f')](_0x21db('0x159'),this[_0x21db('0x11')][_0x21db('0x36')],_0x11f431[_0x21db('0x157')]));var _0x135efe=this[_0x21db('0x5d')]['sync'](this,_0x11f431[_0x21db('0x157')]);if(_0x135efe){logger['info'](util[_0x21db('0x5f')](_0x21db('0x15a'),this[_0x21db('0x11')][_0x21db('0x36')],_0x11f431[_0x21db('0x157')]));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x15a'),this[_0x21db('0x11')][_0x21db('0x36')],_0x11f431[_0x21db('0x157')]));return{'code':0xc8,'result':_0x21db('0x15e')};}else{logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x15b'),this[_0x21db('0x11')][_0x21db('0x36')],_0x11f431[_0x21db('0x157')]));this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0x15b'),this[_0x21db('0x11')]['callerid'],_0x11f431['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x21db('0x14')][_0x21db('0x1cc')]=function(_0xe6d511){logger[_0x21db('0x2d')](util[_0x21db('0x5f')](_0x21db('0x1cd'),_0xe6d511[_0x21db('0xb2')]));var _0x3574e7=this[_0x21db('0x11')][_0x21db('0x63')](_0x21db('0x1ce'),[_0xe6d511[_0x21db('0x1cf')],_0xe6d511[_0x21db('0x84')]]);if(_0x3574e7[_0x21db('0xab')]===-0x1){return _0x3574e7;}return this[_0x21db('0x11')][_0x21db('0xb3')](util[_0x21db('0x5f')](_0x21db('0xce'),'VOICEMAIL',_0xe6d511['mailbox']));};AGIVertices[_0x21db('0x14')]['vswitch']=function(_0x3cd169){logger[_0x21db('0x2d')](util[_0x21db('0x5f')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3cd169[_0x21db('0xb2')]));if(!this[_0x21db('0x8e')](_0x3cd169[_0x21db('0xe3')])){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x3cd169,_0x21db('0x1b1'));}var _0x70149d=this[_0x21db('0x15')][_0x21db('0x7a')](this,_0x3cd169[_0x21db('0xe3')]);if(!_0x70149d){return this[_0x21db('0x11')][_0x21db('0x2c')](_0x3cd169,_0x21db('0xe5'));}var _0x41aa04=this[_0x21db('0x11')]['getVariable'](_0x70149d);return{'code':0xc8,'result':_0x41aa04['extra']?_0x41aa04[_0x21db('0xad')]:'-'};};String['prototype']['replaceAll']=function(_0x4cc11d,_0x49b658){return this[_0x21db('0xa6')](_0x4cc11d)[_0x21db('0x1d0')](_0x49b658);};module[_0x21db('0x1d1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 6909aba..a2801cf 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 _0xd0bb=['name','mandatoryDispositionPause','Action','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','prototype','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','startAcw','queue','mandatoryDisposition'];(function(_0xd2c1db,_0x45c577){var _0x163f15=function(_0x1713c5){while(--_0x1713c5){_0xd2c1db['push'](_0xd2c1db['shift']());}};_0x163f15(++_0x45c577);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x2b1bb9,_0x3f85cc){_0x2b1bb9=_0x2b1bb9-0x0;var _0x59f401=_0xd0bb[_0x2b1bb9];return _0x59f401;};'use strict';var util=require(_0xbd0b('0x0'));var _=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var ami=require('../ami');var logger=require(_0xbd0b('0x3'))('acw');var RpcUser=require(_0xbd0b('0x4'));var RpcVoiceAgentReport=require(_0xbd0b('0x5'));function Acw(_0x53e6ce){this[_0xbd0b('0x6')]=_0x53e6ce['voiceQueues'];this[_0xbd0b('0x7')]=_0x53e6ce[_0xbd0b('0x7')];this[_0xbd0b('0x8')]=_0x53e6ce[_0xbd0b('0x8')];this[_0xbd0b('0x9')]={};ami['on']('agentconnect',this[_0xbd0b('0xa')][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xc'),this[_0xbd0b('0xd')][_0xbd0b('0xb')](this));ami['on']('hangup',this['syncHangup'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xe'),this['syncAgentRingNoAnswer'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0xf'),this['syncAttendedTransfer'][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0x10'),this[_0xbd0b('0x11')][_0xbd0b('0xb')](this));ami['on'](_0xbd0b('0x12'),this[_0xbd0b('0x13')][_0xbd0b('0xb')](this));}function getDiff(_0x1f25b6){var _0x1a55ab=moment()[_0xbd0b('0x14')](0x0);var _0x2d4664=moment(_0x1f25b6)['milliseconds'](0x0);return _0x1a55ab[_0xbd0b('0x15')](_0x2d4664,'seconds');}Acw['prototype'][_0xbd0b('0x16')]=function(_0x4c0e52){try{var _0x3183cf=this;var _0x40b075=this[_0xbd0b('0x9')][_0x4c0e52]['interface'];var _0x55e0a1=this[_0xbd0b('0x9')][_0x4c0e52][_0xbd0b('0x17')];var _0x1f2a6e=this[_0xbd0b('0x6')][_0x55e0a1];var _0x1c0a7c=![];var _0x40b798='ACW';if(_0x1f2a6e[_0xbd0b('0x18')]){if(_0x1f2a6e['mandatoryDispositionPause'][_0xbd0b('0x19')]){_0x1c0a7c=!![];_0x40b798=_0x1f2a6e[_0xbd0b('0x1a')][_0xbd0b('0x19')];}}ami[_0xbd0b('0x1b')]({'action':'QueuePause','interface':_0x40b075,'paused':!![],'reason':_0x40b798})[_0xbd0b('0x1c')](function(_0x38c27f){if(_0x3183cf[_0xbd0b('0x7')][_0x40b075]){return RpcUser['getAgent'](_0x3183cf[_0xbd0b('0x7')][_0x40b075]['id'])['then'](function(_0xc66b8){if(_0xc66b8&&!_0xc66b8[_0xbd0b('0x1d')]){logger[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x4c0e52,_0x40b075,_0x55e0a1);var _0x297c85=_0x3183cf['channels'][_0x4c0e52][_0xbd0b('0x20')]&&_0x3183cf['channels'][_0x4c0e52][_0xbd0b('0x21')]?_0x3183cf[_0xbd0b('0x9')][_0x4c0e52][_0xbd0b('0x21')]:_0x4c0e52;return RpcUser[_0xbd0b('0x22')](_0x3183cf[_0xbd0b('0x7')][_0x40b075],_0x40b798,_0x297c85)[_0xbd0b('0x1c')](function(_0x4fe9ed){if(!_0x1c0a7c){_0x3183cf[_0xbd0b('0x8')][_0x40b075]={};logger[_0xbd0b('0x1e')](_0xbd0b('0x23'),_0x4c0e52,_0x3183cf[_0xbd0b('0x6')][_0x55e0a1][_0xbd0b('0x24')],_0x40b075,_0x55e0a1);_0x3183cf[_0xbd0b('0x8')][_0x40b075]['timer']=setTimeout(_0x3183cf[_0xbd0b('0x25')][_0xbd0b('0xb')](_0x3183cf,_0x40b075),_0x3183cf[_0xbd0b('0x6')][_0x55e0a1]['acwTimeout']*0x3e8);_0x3183cf['timers'][_0x40b075][_0xbd0b('0x26')]=moment()[_0xbd0b('0x27')](_0xbd0b('0x28'));_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x29')]=_0x4c0e52;_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x17')]=_0x55e0a1;_0x3183cf['timers'][_0x40b075][_0xbd0b('0x2a')]=function(){var _0x3b70b4=getDiff(_0x3183cf['timers'][_0x40b075]['lastPauseAt']);clearTimeout(_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x2b')]);_0x3183cf['timers'][_0x40b075][_0xbd0b('0x2b')]=![];RpcVoiceAgentReport[_0xbd0b('0x2c')]({'acwtime':_0x3b70b4},_0x3183cf[_0xbd0b('0x8')][_0x40b075][_0xbd0b('0x29')],_0x40b075)[_0xbd0b('0x1c')](function(_0x27c478){logger['info'](_0xbd0b('0x2d'),_0x4c0e52,_0x3b70b4,_0x27c478);})[_0xbd0b('0x2e')](function(_0x32572e){logger[_0xbd0b('0x2f')](_0xbd0b('0x30'),_0x4c0e52,_0x32572e);});delete _0x3183cf[_0xbd0b('0x8')][_0x40b075];};}});}else{logger[_0xbd0b('0x1e')](_0xbd0b('0x31'),_0x4c0e52,_0x40b075,_0x55e0a1);}});}})[_0xbd0b('0x2e')](function(_0x3ac75f){logger[_0xbd0b('0x2f')](_0xbd0b('0x23'),_0x4c0e52,_0x3183cf[_0xbd0b('0x6')][_0x55e0a1][_0xbd0b('0x24')],_0x40b075,_0x55e0a1);})['finally'](function(){delete _0x3183cf[_0xbd0b('0x9')][_0x4c0e52];});}catch(_0x23b0fa){logger['error'](_0xbd0b('0x32'),_0x23b0fa[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x25')]=function(_0x27ad8b){try{var _0x288715=this;if(_0x288715['timers'][_0x27ad8b]){_0x288715[_0xbd0b('0x8')][_0x27ad8b][_0xbd0b('0x2b')]=![];var _0x3b5098=_0x288715[_0xbd0b('0x8')][_0x27ad8b][_0xbd0b('0x29')];var _0x47c961=_0x288715['timers'][_0x27ad8b][_0xbd0b('0x17')];var _0x8db305=_0x288715[_0xbd0b('0x6')][_0x47c961][_0xbd0b('0x24')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x27ad8b);RpcUser[_0xbd0b('0x35')](this['agents'][_0x27ad8b]);RpcVoiceAgentReport[_0xbd0b('0x2c')]({'acwtime':_0x8db305,'agentacw':!![]},_0x3b5098,_0x27ad8b)[_0xbd0b('0x1c')](function(_0x3f34dc){logger[_0xbd0b('0x1e')](_0xbd0b('0x2d'),_0x3b5098,_0x8db305,_0x3f34dc);})[_0xbd0b('0x2e')](function(_0x43115e){logger[_0xbd0b('0x2f')](_0xbd0b('0x30'),_0x3b5098,_0x43115e);});}else{logger[_0xbd0b('0x2f')](_0xbd0b('0x36'),_0x27ad8b);if(_0x288715[_0xbd0b('0x8')]){logger[_0xbd0b('0x1e')](_0xbd0b('0x37'),JSON[_0xbd0b('0x38')](_0x288715[_0xbd0b('0x8')]));}}}catch(_0x16c77c){logger[_0xbd0b('0x2f')]('[ACW][STOP]\x20%s',_0x16c77c[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0xa')]=function(_0x3f4d9b){try{if(this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]]&&(this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]][_0xbd0b('0x39')]||this[_0xbd0b('0x6')][_0x3f4d9b[_0xbd0b('0x17')]][_0xbd0b('0x18')])){if(this['agents'][_0x3f4d9b[_0xbd0b('0x3a')]]){this['channels'][_0x3f4d9b['uniqueid']]={'queue':_0x3f4d9b[_0xbd0b('0x17')],'interface':_0x3f4d9b[_0xbd0b('0x3a')],'destlinkedid':_0x3f4d9b[_0xbd0b('0x21')]};}}}catch(_0x580fa2){logger[_0xbd0b('0x2f')](_0xbd0b('0x3b'),_0x580fa2[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x13')]=function(_0x4f1e3a){try{if(this[_0xbd0b('0x6')][_0x4f1e3a[_0xbd0b('0x17')]]&&(this[_0xbd0b('0x6')][_0x4f1e3a[_0xbd0b('0x17')]][_0xbd0b('0x39')]||this[_0xbd0b('0x6')][_0x4f1e3a['queue']][_0xbd0b('0x18')])){if(this[_0xbd0b('0x7')][_0x4f1e3a[_0xbd0b('0x3a')]]){this[_0xbd0b('0x9')][_0x4f1e3a[_0xbd0b('0x29')]]={'queue':_0x4f1e3a[_0xbd0b('0x17')],'interface':_0x4f1e3a[_0xbd0b('0x3a')]};}}}catch(_0x563c64){logger[_0xbd0b('0x2f')](_0xbd0b('0x3c'),_0x563c64[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0xd')]=function(_0x30f77e){try{if(this[_0xbd0b('0x9')][_0x30f77e[_0xbd0b('0x29')]]&&_[_0xbd0b('0x3d')](this[_0xbd0b('0x9')][_0x30f77e[_0xbd0b('0x29')]][_0xbd0b('0x20')])){logger[_0xbd0b('0x1e')](_0xbd0b('0x3e'),_0x30f77e[_0xbd0b('0x29')]);this['startAcw'](_0x30f77e[_0xbd0b('0x29')]);}else if(this[_0xbd0b('0x9')][_0x30f77e['linkedid']]&&_['isUndefined'](this['channels'][_0x30f77e[_0xbd0b('0x3f')]]['attended'])){logger[_0xbd0b('0x1e')](_0xbd0b('0x40'),_0x30f77e[_0xbd0b('0x3f')]);this[_0xbd0b('0x16')](_0x30f77e['linkedid']);}}catch(_0x2d2e58){logger['error'](_0xbd0b('0x41'),_0x2d2e58['message']);}};Acw['prototype'][_0xbd0b('0x42')]=function(_0x22f741){try{if(this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x29')]]&&this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x29')]][_0xbd0b('0x20')]){logger[_0xbd0b('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x22f741['uniqueid']);this[_0xbd0b('0x16')](_0x22f741[_0xbd0b('0x29')]);}else if(this['channels'][_0x22f741['linkedid']]&&this[_0xbd0b('0x9')][_0x22f741[_0xbd0b('0x3f')]][_0xbd0b('0x20')]){logger[_0xbd0b('0x1e')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x22f741[_0xbd0b('0x3f')]);this[_0xbd0b('0x16')](_0x22f741[_0xbd0b('0x3f')]);}}catch(_0x183029){logger['error'](_0xbd0b('0x43'),_0x183029[_0xbd0b('0x33')]);}};Acw['prototype'][_0xbd0b('0x44')]=function(_0x1ea443){try{if(!_[_0xbd0b('0x45')](this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x46')]])){this[_0xbd0b('0x16')](_0x1ea443[_0xbd0b('0x46')]);if(this[_0xbd0b('0x9')][_0x1ea443['secondtransfereruniqueid']]){this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x47')]][_0xbd0b('0x20')]=!![];this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x48')]]=this[_0xbd0b('0x9')][_0x1ea443['secondtransfereruniqueid']];delete this['channels'][_0x1ea443[_0xbd0b('0x47')]];}}else if(!_[_0xbd0b('0x45')](this['channels'][_0x1ea443[_0xbd0b('0x48')]])){this[_0xbd0b('0x16')](_0x1ea443[_0xbd0b('0x48')]);if(this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]]){this['channels'][_0x1ea443[_0xbd0b('0x49')]][_0xbd0b('0x20')]=!![];this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x46')]]=this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]];delete this[_0xbd0b('0x9')][_0x1ea443[_0xbd0b('0x49')]];}}}catch(_0x429534){logger[_0xbd0b('0x2f')](_0xbd0b('0x4a'),_0x429534[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x11')]=function(_0x164a2e){try{if(this[_0xbd0b('0x9')][_0x164a2e[_0xbd0b('0x4b')]]){logger['info'](_0xbd0b('0x4c'),JSON[_0xbd0b('0x38')](_0x164a2e[_0xbd0b('0x4b')]));this[_0xbd0b('0x16')](_0x164a2e['transfereruniqueid']);}else if(this['channels'][_0x164a2e[_0xbd0b('0x4d')]]){logger[_0xbd0b('0x1e')](_0xbd0b('0x4e'),JSON[_0xbd0b('0x38')](_0x164a2e[_0xbd0b('0x4d')]));this['startAcw'](_0x164a2e[_0xbd0b('0x4d')]);}}catch(_0x4d3664){logger[_0xbd0b('0x2f')](_0xbd0b('0x4f'),_0x4d3664[_0xbd0b('0x33')]);}};Acw[_0xbd0b('0x34')][_0xbd0b('0x50')]=function(_0x463db8){try{if(this['voiceQueues'][_0x463db8[_0xbd0b('0x17')]]&&this[_0xbd0b('0x6')][_0x463db8[_0xbd0b('0x17')]][_0xbd0b('0x51')]==='all'){if(this[_0xbd0b('0x7')][_0x463db8[_0xbd0b('0x3a')]]){logger[_0xbd0b('0x1e')](_0xbd0b('0x52'),_0x463db8[_0xbd0b('0x29')],_0x463db8['interface'],_0x463db8['queue']);return RpcUser[_0xbd0b('0x22')](this['agents'][_0x463db8[_0xbd0b('0x3a')]],_0xbd0b('0x53'),_0x463db8[_0xbd0b('0x29')]);}}}catch(_0x1876ae){logger[_0xbd0b('0x2f')](_0xbd0b('0x54'),_0x1876ae['message']);}};module[_0xbd0b('0x55')]=Acw; \ No newline at end of file +var _0x2d17=['catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','queue','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','channels','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid'];(function(_0x37542e,_0x3a9480){var _0x2e61c3=function(_0x20316b){while(--_0x20316b){_0x37542e['push'](_0x37542e['shift']());}};_0x2e61c3(++_0x3a9480);}(_0x2d17,0x17e));var _0x72d1=function(_0x4ed8aa,_0x2b57ec){_0x4ed8aa=_0x4ed8aa-0x0;var _0xf4987a=_0x2d17[_0x4ed8aa];return _0xf4987a;};'use strict';var util=require(_0x72d1('0x0'));var _=require(_0x72d1('0x1'));var moment=require('moment');var ami=require(_0x72d1('0x2'));var logger=require(_0x72d1('0x3'))('acw');var RpcUser=require(_0x72d1('0x4'));var RpcVoiceAgentReport=require(_0x72d1('0x5'));function Acw(_0x55b722){this[_0x72d1('0x6')]=_0x55b722['voiceQueues'];this[_0x72d1('0x7')]=_0x55b722['agents'];this[_0x72d1('0x8')]=_0x55b722[_0x72d1('0x8')];this['channels']={};ami['on'](_0x72d1('0x9'),this[_0x72d1('0xa')][_0x72d1('0xb')](this));ami['on']('hanguprequest',this[_0x72d1('0xc')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xd'),this['syncHangup'][_0x72d1('0xb')](this));ami['on'](_0x72d1('0xe'),this[_0x72d1('0xf')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x10'),this[_0x72d1('0x11')][_0x72d1('0xb')](this));ami['on'](_0x72d1('0x12'),this[_0x72d1('0x13')][_0x72d1('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x72d1('0x14')][_0x72d1('0xb')](this));}function getDiff(_0x4c1038){var _0x115cd7=moment()[_0x72d1('0x15')](0x0);var _0x685a27=moment(_0x4c1038)[_0x72d1('0x15')](0x0);return _0x115cd7[_0x72d1('0x16')](_0x685a27,_0x72d1('0x17'));}Acw[_0x72d1('0x18')][_0x72d1('0x19')]=function(_0x23a238){try{var _0x8d458=this;var _0x491af4=this[_0x72d1('0x1a')][_0x23a238]['interface'];var _0x3885b2=this[_0x72d1('0x1a')][_0x23a238]['queue'];var _0x1061b7=this[_0x72d1('0x6')][_0x3885b2];var _0x1ca18d=![];var _0x49caf4='ACW';if(_0x1061b7[_0x72d1('0x1b')]){if(_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')]){_0x1ca18d=!![];_0x49caf4=_0x1061b7[_0x72d1('0x1c')][_0x72d1('0x1d')];}}ami[_0x72d1('0x1e')]({'action':_0x72d1('0x1f'),'interface':_0x491af4,'paused':!![],'reason':_0x49caf4})['then'](function(_0x1c695c){if(_0x8d458['agents'][_0x491af4]){return RpcUser['getAgent'](_0x8d458['agents'][_0x491af4]['id'])['then'](function(_0x445985){if(_0x445985&&!_0x445985[_0x72d1('0x20')]){logger['info'](_0x72d1('0x21'),_0x23a238,_0x491af4,_0x3885b2);var _0x256dc1=_0x8d458[_0x72d1('0x1a')][_0x23a238][_0x72d1('0x22')]&&_0x8d458[_0x72d1('0x1a')][_0x23a238]['destlinkedid']?_0x8d458['channels'][_0x23a238][_0x72d1('0x23')]:_0x23a238;return RpcUser[_0x72d1('0x24')](_0x8d458[_0x72d1('0x7')][_0x491af4],_0x49caf4,_0x256dc1)[_0x72d1('0x25')](function(_0xdf6a69){if(!_0x1ca18d){_0x8d458[_0x72d1('0x8')][_0x491af4]={};logger[_0x72d1('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x23a238,_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);_0x8d458['timers'][_0x491af4][_0x72d1('0x28')]=setTimeout(_0x8d458[_0x72d1('0x29')][_0x72d1('0xb')](_0x8d458,_0x491af4),_0x8d458['voiceQueues'][_0x3885b2][_0x72d1('0x27')]*0x3e8);_0x8d458['timers'][_0x491af4][_0x72d1('0x2a')]=moment()[_0x72d1('0x2b')](_0x72d1('0x2c'));_0x8d458[_0x72d1('0x8')][_0x491af4]['uniqueid']=_0x23a238;_0x8d458[_0x72d1('0x8')][_0x491af4]['queue']=_0x3885b2;_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2d')]=function(){var _0x5cec3f=getDiff(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2a')]);clearTimeout(_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x28')]);_0x8d458[_0x72d1('0x8')][_0x491af4]['timer']=![];RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x5cec3f},_0x8d458[_0x72d1('0x8')][_0x491af4][_0x72d1('0x2f')],_0x491af4)['then'](function(_0x244f4a){logger[_0x72d1('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x23a238,_0x5cec3f,_0x244f4a);})[_0x72d1('0x30')](function(_0x750de6){logger[_0x72d1('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x23a238,_0x750de6);});delete _0x8d458[_0x72d1('0x8')][_0x491af4];};}});}else{logger['info'](_0x72d1('0x32'),_0x23a238,_0x491af4,_0x3885b2);}});}})[_0x72d1('0x30')](function(_0x23418d){logger[_0x72d1('0x31')](_0x72d1('0x33'),_0x23a238,_0x8d458[_0x72d1('0x6')][_0x3885b2][_0x72d1('0x27')],_0x491af4,_0x3885b2);})[_0x72d1('0x34')](function(){delete _0x8d458[_0x72d1('0x1a')][_0x23a238];});}catch(_0x24be04){logger[_0x72d1('0x31')]('[ACW][START]\x20%s',_0x24be04[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x29')]=function(_0x325209){try{var _0x49e074=this;if(_0x49e074[_0x72d1('0x8')][_0x325209]){_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x28')]=![];var _0x4fb07b=_0x49e074[_0x72d1('0x8')][_0x325209][_0x72d1('0x2f')];var _0x163538=_0x49e074['timers'][_0x325209][_0x72d1('0x36')];var _0x117440=_0x49e074[_0x72d1('0x6')][_0x163538]['acwTimeout'];logger[_0x72d1('0x26')](_0x72d1('0x37'),_0x325209);RpcUser[_0x72d1('0x38')](this[_0x72d1('0x7')][_0x325209]);RpcVoiceAgentReport[_0x72d1('0x2e')]({'acwtime':_0x117440,'agentacw':!![]},_0x4fb07b,_0x325209)[_0x72d1('0x25')](function(_0xd7ec0f){logger['info'](_0x72d1('0x39'),_0x4fb07b,_0x117440,_0xd7ec0f);})[_0x72d1('0x30')](function(_0x440ac5){logger[_0x72d1('0x31')](_0x72d1('0x3a'),_0x4fb07b,_0x440ac5);});}else{logger[_0x72d1('0x31')](_0x72d1('0x3b'),_0x325209);if(_0x49e074[_0x72d1('0x8')]){logger['info'](_0x72d1('0x3c'),JSON[_0x72d1('0x3d')](_0x49e074[_0x72d1('0x8')]));}}}catch(_0x1d6704){logger[_0x72d1('0x31')](_0x72d1('0x3e'),_0x1d6704[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')]['syncAgentConnect']=function(_0x563c5a){try{if(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]&&(this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['acw']||this[_0x72d1('0x6')][_0x563c5a[_0x72d1('0x36')]]['mandatoryDisposition'])){if(this[_0x72d1('0x7')][_0x563c5a['interface']]){this[_0x72d1('0x1a')][_0x563c5a[_0x72d1('0x2f')]]={'queue':_0x563c5a['queue'],'interface':_0x563c5a[_0x72d1('0x3f')],'destlinkedid':_0x563c5a['destlinkedid']};}}}catch(_0x527223){logger['error'](_0x72d1('0x40'),_0x527223['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x14')]=function(_0x28332b){try{if(this['voiceQueues'][_0x28332b['queue']]&&(this[_0x72d1('0x6')][_0x28332b['queue']]['acw']||this[_0x72d1('0x6')][_0x28332b[_0x72d1('0x36')]][_0x72d1('0x1b')])){if(this['agents'][_0x28332b['interface']]){this['channels'][_0x28332b['uniqueid']]={'queue':_0x28332b[_0x72d1('0x36')],'interface':_0x28332b[_0x72d1('0x3f')]};}}}catch(_0x197483){logger[_0x72d1('0x31')](_0x72d1('0x41'),_0x197483[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xc')]=function(_0x1e2c11){try{if(this['channels'][_0x1e2c11[_0x72d1('0x2f')]]&&_[_0x72d1('0x42')](this[_0x72d1('0x1a')][_0x1e2c11['uniqueid']][_0x72d1('0x22')])){logger[_0x72d1('0x26')](_0x72d1('0x43'),_0x1e2c11['uniqueid']);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x1e2c11[_0x72d1('0x44')]]&&_['isUndefined'](this['channels'][_0x1e2c11[_0x72d1('0x44')]][_0x72d1('0x22')])){logger[_0x72d1('0x26')]('[%s][HANGUP:LINKEDID]',_0x1e2c11[_0x72d1('0x44')]);this[_0x72d1('0x19')](_0x1e2c11[_0x72d1('0x44')]);}}catch(_0x463670){logger[_0x72d1('0x31')](_0x72d1('0x45'),_0x463670[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0x46')]=function(_0x18f986){try{if(this[_0x72d1('0x1a')][_0x18f986['uniqueid']]&&this[_0x72d1('0x1a')][_0x18f986['uniqueid']]['attended']){logger[_0x72d1('0x26')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x18f986[_0x72d1('0x2f')]);this[_0x72d1('0x19')](_0x18f986[_0x72d1('0x2f')]);}else if(this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]]&&this[_0x72d1('0x1a')][_0x18f986[_0x72d1('0x44')]][_0x72d1('0x22')]){logger[_0x72d1('0x26')](_0x72d1('0x47'),_0x18f986[_0x72d1('0x44')]);this['startAcw'](_0x18f986[_0x72d1('0x44')]);}}catch(_0x3da39a){logger[_0x72d1('0x31')]('[ACW][syncHangup]\x20%s',_0x3da39a['message']);}};Acw[_0x72d1('0x18')][_0x72d1('0x11')]=function(_0x16e9e7){try{if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7['transfereeuniqueid']])){this[_0x72d1('0x19')](_0x16e9e7['transfereeuniqueid']);if(this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]]=this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x49')]];}}else if(!_[_0x72d1('0x48')](this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4a')]])){this[_0x72d1('0x19')](_0x16e9e7[_0x72d1('0x4a')]);if(this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']]){this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]][_0x72d1('0x22')]=!![];this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4c')]]=this[_0x72d1('0x1a')][_0x16e9e7['origtransfereruniqueid']];delete this[_0x72d1('0x1a')][_0x16e9e7[_0x72d1('0x4b')]];}}}catch(_0xb05cd9){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0xb05cd9[_0x72d1('0x35')]);}};Acw['prototype'][_0x72d1('0x13')]=function(_0x359176){try{if(this[_0x72d1('0x1a')][_0x359176[_0x72d1('0x4d')]]){logger[_0x72d1('0x26')](_0x72d1('0x4e'),JSON[_0x72d1('0x3d')](_0x359176[_0x72d1('0x4d')]));this[_0x72d1('0x19')](_0x359176['transfereruniqueid']);}else if(this['channels'][_0x359176[_0x72d1('0x4f')]]){logger[_0x72d1('0x26')](_0x72d1('0x50'),JSON['stringify'](_0x359176[_0x72d1('0x4f')]));this[_0x72d1('0x19')](_0x359176['transfererlinkedid']);}}catch(_0x39d7f9){logger[_0x72d1('0x31')](_0x72d1('0x51'),_0x39d7f9[_0x72d1('0x35')]);}};Acw[_0x72d1('0x18')][_0x72d1('0xf')]=function(_0x102574){try{if(this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]]&&this[_0x72d1('0x6')][_0x102574[_0x72d1('0x36')]][_0x72d1('0x52')]==='all'){if(this['agents'][_0x102574[_0x72d1('0x3f')]]){logger[_0x72d1('0x26')](_0x72d1('0x53'),_0x102574[_0x72d1('0x2f')],_0x102574[_0x72d1('0x3f')],_0x102574[_0x72d1('0x36')]);return RpcUser[_0x72d1('0x24')](this[_0x72d1('0x7')][_0x102574['interface']],_0x72d1('0x54'),_0x102574['uniqueid']);}}}catch(_0x475016){logger[_0x72d1('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x475016['message']);}};module[_0x72d1('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 95a698d..33590c7 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 _0x8b6a=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','catch','asterisk-manager','bluebird','moment','util','../../config/logger','../../config/environment','asterisk','username','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus'];(function(_0x1ed742,_0x50ede7){var _0xb08df8=function(_0x5459b9){while(--_0x5459b9){_0x1ed742['push'](_0x1ed742['shift']());}};_0xb08df8(++_0x50ede7);}(_0x8b6a,0x9d));var _0xa8b6=function(_0x103480,_0x8f48fc){_0x103480=_0x103480-0x0;var _0x5d23f6=_0x8b6a[_0x103480];return _0x5d23f6;};'use strict';var Manager=require(_0xa8b6('0x0'));var BPromise=require(_0xa8b6('0x1'));var moment=require(_0xa8b6('0x2'));var util=require(_0xa8b6('0x3'));var _=require('lodash');var logger=require(_0xa8b6('0x4'))('ami');var config=require(_0xa8b6('0x5'));var ami=new Manager(config[_0xa8b6('0x6')]['port'],config[_0xa8b6('0x6')]['ip'],config[_0xa8b6('0x6')][_0xa8b6('0x7')],config['asterisk']['password'],!![]);ami[_0xa8b6('0x8')]();ami[_0xa8b6('0x9')]=BPromise[_0xa8b6('0xa')](ami[_0xa8b6('0xb')]);function error(_0x4ad1e2){logger[_0xa8b6('0xc')](util[_0xa8b6('0xd')](_0xa8b6('0xe'),config['asterisk']['username'],config[_0xa8b6('0x6')]['ip'],config[_0xa8b6('0x6')][_0xa8b6('0xf')],util[_0xa8b6('0x10')](_0x4ad1e2,![],null)));}function close(){logger[_0xa8b6('0xc')](util['format'](_0xa8b6('0x11'),config['asterisk'][_0xa8b6('0x7')],config[_0xa8b6('0x6')]['ip'],config[_0xa8b6('0x6')][_0xa8b6('0xf')]));}ami[_0xa8b6('0x12')]=function(){return function(){return ami[_0xa8b6('0x9')]({'action':_0xa8b6('0x13')});};};ami[_0xa8b6('0x14')]=function(){return function(){return ami[_0xa8b6('0x9')]({'action':_0xa8b6('0x15')});};};ami[_0xa8b6('0x16')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xa8b6('0x17')]=function(){return function(){return ami[_0xa8b6('0x9')]({'action':_0xa8b6('0x18')});};};ami[_0xa8b6('0x19')]=function(){return function(){return ami[_0xa8b6('0x9')]({'action':_0xa8b6('0x1a')});};};function connect(_0x110476){logger['info'](util[_0xa8b6('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa8b6('0x6')]['ip'],config[_0xa8b6('0x6')][_0xa8b6('0xf')]));ami[_0xa8b6('0x1b')](_0xa8b6('0xc'),error);ami[_0xa8b6('0x1b')](_0xa8b6('0x1c'),close);}ami['on'](_0xa8b6('0x1d'),connect);ami['on']('shutdown',function(_0x318437){logger[_0xa8b6('0x1e')](util[_0xa8b6('0xd')](_0xa8b6('0x1f'),config[_0xa8b6('0x6')]['username'],config[_0xa8b6('0x6')]['ip'],config['asterisk'][_0xa8b6('0xf')],util[_0xa8b6('0x10')](_0x318437,![],null)));});ami['on'](_0xa8b6('0x20'),function(_0x422762){logger[_0xa8b6('0x1e')](util[_0xa8b6('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xa8b6('0x6')][_0xa8b6('0x7')],config[_0xa8b6('0x6')]['ip'],config[_0xa8b6('0x6')][_0xa8b6('0xf')]));return BPromise[_0xa8b6('0x21')]()[_0xa8b6('0x22')](ami[_0xa8b6('0x12')]())['then'](ami[_0xa8b6('0x14')]())[_0xa8b6('0x22')](ami[_0xa8b6('0x16')]())['then'](ami[_0xa8b6('0x17')]())[_0xa8b6('0x22')](ami[_0xa8b6('0x19')]())[_0xa8b6('0x23')](function(_0x4bcf42){console['log'](_0x4bcf42);});});ami['once']('error',error);ami[_0xa8b6('0x1b')](_0xa8b6('0x1c'),close);module['exports']=ami; \ No newline at end of file +var _0xb961=['devicestatelist','sippeerstatus','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','exports','asterisk-manager','bluebird','moment','lodash','ami','../../config/environment','port','asterisk','password','keepConnected','Action','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList'];(function(_0x3818c2,_0x341eae){var _0x7950d9=function(_0x4df6f0){while(--_0x4df6f0){_0x3818c2['push'](_0x3818c2['shift']());}};_0x7950d9(++_0x341eae);}(_0xb961,0x138));var _0x1b96=function(_0x182fa6,_0x3270a6){_0x182fa6=_0x182fa6-0x0;var _0x288dac=_0xb961[_0x182fa6];return _0x288dac;};'use strict';var Manager=require(_0x1b96('0x0'));var BPromise=require(_0x1b96('0x1'));var moment=require(_0x1b96('0x2'));var util=require('util');var _=require(_0x1b96('0x3'));var logger=require('../../config/logger')(_0x1b96('0x4'));var config=require(_0x1b96('0x5'));var ami=new Manager(config['asterisk'][_0x1b96('0x6')],config[_0x1b96('0x7')]['ip'],config[_0x1b96('0x7')]['username'],config[_0x1b96('0x7')][_0x1b96('0x8')],!![]);ami[_0x1b96('0x9')]();ami[_0x1b96('0xa')]=BPromise['promisify'](ami[_0x1b96('0xb')]);function error(_0x2890a3){logger[_0x1b96('0xc')](util['format'](_0x1b96('0xd'),config[_0x1b96('0x7')][_0x1b96('0xe')],config[_0x1b96('0x7')]['ip'],config[_0x1b96('0x7')][_0x1b96('0x6')],util[_0x1b96('0xf')](_0x2890a3,![],null)));}function close(){logger[_0x1b96('0xc')](util[_0x1b96('0x10')](_0x1b96('0x11'),config[_0x1b96('0x7')][_0x1b96('0xe')],config[_0x1b96('0x7')]['ip'],config[_0x1b96('0x7')]['port']));}ami[_0x1b96('0x12')]=function(){return function(){return ami[_0x1b96('0xa')]({'action':_0x1b96('0x13')});};};ami[_0x1b96('0x14')]=function(){return function(){return ami[_0x1b96('0xa')]({'action':_0x1b96('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x1b96('0xa')]({'action':_0x1b96('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x1b96('0x17')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x1d8e02){logger[_0x1b96('0x18')](util[_0x1b96('0x10')](_0x1b96('0x19'),config[_0x1b96('0x7')][_0x1b96('0xe')],config[_0x1b96('0x7')]['ip'],config[_0x1b96('0x7')]['port']));ami[_0x1b96('0x1a')](_0x1b96('0xc'),error);ami[_0x1b96('0x1a')](_0x1b96('0x1b'),close);}ami['on'](_0x1b96('0x1c'),connect);ami['on'](_0x1b96('0x1d'),function(_0x45acbe){logger[_0x1b96('0x18')](util[_0x1b96('0x10')](_0x1b96('0x1e'),config[_0x1b96('0x7')][_0x1b96('0xe')],config[_0x1b96('0x7')]['ip'],config['asterisk']['port'],util[_0x1b96('0xf')](_0x45acbe,![],null)));});ami['on'](_0x1b96('0x1f'),function(_0x132a9a){logger[_0x1b96('0x18')](util[_0x1b96('0x10')](_0x1b96('0x20'),config['asterisk'][_0x1b96('0xe')],config[_0x1b96('0x7')]['ip'],config[_0x1b96('0x7')][_0x1b96('0x6')]));return BPromise[_0x1b96('0x21')]()[_0x1b96('0x22')](ami[_0x1b96('0x12')]())[_0x1b96('0x22')](ami[_0x1b96('0x14')]())[_0x1b96('0x22')](ami['actionSipPeerStatus']())['then'](ami[_0x1b96('0x23')]())['then'](ami['actionCoreShowChannels']())['catch'](function(_0x3af94c){console['log'](_0x3af94c);});});ami[_0x1b96('0x1a')](_0x1b96('0xc'),error);ami[_0x1b96('0x1a')]('close',close);module[_0x1b96('0x24')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index cd5654a..5ccfe94 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 _0x412b=['catch','../../config/logger','client','http','Request','request','rpc','memberReport','error','message','result'];(function(_0x5ebacc,_0x24d8fe){var _0xf55b4e=function(_0x419259){while(--_0x419259){_0x5ebacc['push'](_0x5ebacc['shift']());}};_0xf55b4e(++_0x24d8fe);}(_0x412b,0x1ae));var _0xb412=function(_0x41bf04,_0x293040){_0x41bf04=_0x41bf04-0x0;var _0x665e75=_0x412b[_0x41bf04];return _0x665e75;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xb412('0x0'))('ami');var client=jayson[_0xb412('0x1')][_0xb412('0x2')]({'port':0x2329});client[_0xb412('0x3')]=function(_0x3612d5,_0x2a62b9){return new BPromise(function(_0x1905fb,_0x1a80f4){return client[_0xb412('0x4')](_0x3612d5,_0x2a62b9)['then'](function(_0x1795a5){logger['debug'](_0xb412('0x5'),_0xb412('0x6'),_0x3612d5,_0x2a62b9,_0x1795a5);if(_0x1795a5[_0xb412('0x7')]){logger['error'](_0xb412('0x5'),_0xb412('0x6'),_0x3612d5,_0x1795a5['error'][_0xb412('0x8')],_0x2a62b9);return _0x1a80f4(_0x1795a5[_0xb412('0x7')]['message']);}else{return _0x1905fb(_0x1795a5[_0xb412('0x9')]);}})[_0xb412('0xa')](function(_0xdbccdd){logger['error'](_0xb412('0x5'),_0xb412('0x6'),_0x3612d5,_0xdbccdd,_0x2a62b9);return _0x1a80f4(_0xdbccdd);});});};module['exports']=client; \ No newline at end of file +var _0x635e=['jayson/promise','bluebird','../../config/logger','client','http','debug','rpc','error','memberReport','message','result'];(function(_0x43d457,_0x1ab41a){var _0x5e24d5=function(_0x15b5bf){while(--_0x15b5bf){_0x43d457['push'](_0x43d457['shift']());}};_0x5e24d5(++_0x1ab41a);}(_0x635e,0x1d9));var _0xe635=function(_0x213996,_0x1f78aa){_0x213996=_0x213996-0x0;var _0x5c9ac2=_0x635e[_0x213996];return _0x5c9ac2;};'use strict';var jayson=require(_0xe635('0x0'));var BPromise=require(_0xe635('0x1'));var logger=require(_0xe635('0x2'))('ami');var client=jayson[_0xe635('0x3')][_0xe635('0x4')]({'port':0x2329});client['Request']=function(_0x349749,_0x4afc09){return new BPromise(function(_0xa70ab6,_0x42f510){return client['request'](_0x349749,_0x4afc09)['then'](function(_0x1fdcfa){logger[_0xe635('0x5')](_0xe635('0x6'),'memberReport',_0x349749,_0x4afc09,_0x1fdcfa);if(_0x1fdcfa[_0xe635('0x7')]){logger[_0xe635('0x7')](_0xe635('0x6'),_0xe635('0x8'),_0x349749,_0x1fdcfa[_0xe635('0x7')][_0xe635('0x9')],_0x4afc09);return _0x42f510(_0x1fdcfa[_0xe635('0x7')][_0xe635('0x9')]);}else{return _0xa70ab6(_0x1fdcfa[_0xe635('0xa')]);}})['catch'](function(_0xae951b){logger[_0xe635('0x7')](_0xe635('0x6'),_0xe635('0x8'),_0x349749,_0xae951b,_0x4afc09);return _0x42f510(_0xae951b);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index e5f3fd5..9b0b961 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 _0xaac0=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','prototype','getCaller','format','\x22%s\x22\x20<%s>','substring','dialCutDigit','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xaac0,0x10c));var _0x0aac=function(_0x5ade35,_0x35cec6){_0x5ade35=_0x5ade35-0x0;var _0x21d317=_0xaac0[_0x5ade35];return _0x21d317;};'use strict';var util=require(_0x0aac('0x0'));var _=require(_0x0aac('0x1'));var moment=require('moment');function checkNameSurname(_0x42ad46,_0x1aa866,_0x348570){var _0x5bfdc7='';if(!_[_0x0aac('0x2')](_0x1aa866)&&'string'===typeof _0x1aa866){_0x5bfdc7+=_0x1aa866;}if(!_[_0x0aac('0x2')](_0x348570)&&_0x0aac('0x3')===typeof _0x348570){_0x5bfdc7+='\x20'+_0x348570;}if(_0x5bfdc7!==''){return _0x5bfdc7;}return _0x42ad46;}function Action(_0x524c40,_0x31c5f4,_0x45c2e0){this[_0x0aac('0x4')]=_0x524c40;this[_0x0aac('0x5')]=_0x45c2e0||undefined;this[_0x0aac('0x6')]=checkNameSurname(_0x31c5f4[_0x0aac('0x7')][_0x0aac('0x8')],_0x31c5f4['Contact']['firstName'],_0x31c5f4['Contact'][_0x0aac('0x9')]);this[_0x0aac('0xa')]=_0x31c5f4[_0x0aac('0x7')]['phone'];this[_0x0aac('0xb')]=_0x524c40[_0x0aac('0x6')];this[_0x0aac('0xc')]=_0x31c5f4['active']||![];this['type']=_0x524c40['type'];this[_0x0aac('0xd')]=_0x524c40['dialQueueTimeout']||0x3;this['scheduledat']=_0x31c5f4[_0x0aac('0xe')];this[_0x0aac('0xf')]=_0x31c5f4['countbusyretry'];this[_0x0aac('0x10')]=_0x31c5f4[_0x0aac('0x10')];this[_0x0aac('0x11')]=_0x31c5f4[_0x0aac('0x11')];this[_0x0aac('0x12')]=_0x31c5f4[_0x0aac('0x12')];this[_0x0aac('0x13')]=_0x31c5f4[_0x0aac('0x13')];this[_0x0aac('0x14')]=_0x31c5f4[_0x0aac('0x14')];this[_0x0aac('0x15')]=_0x31c5f4[_0x0aac('0x15')];this[_0x0aac('0x16')]=_0x31c5f4[_0x0aac('0x16')];this['ContactId']=_0x31c5f4['ContactId'];this[_0x0aac('0x17')]=_0x31c5f4['ListId'];this[_0x0aac('0x18')]=_0x31c5f4[_0x0aac('0x18')];this[_0x0aac('0x19')]=_0x31c5f4[_0x0aac('0x19')];this['CampaignId']=_0x31c5f4[_0x0aac('0x1a')];this[_0x0aac('0x1b')]=_0x31c5f4['id'];this[_0x0aac('0x1c')]=_0x31c5f4['Contact'][_0x0aac('0x1d')]||'';this[_0x0aac('0x1e')]=moment()['format'](_0x0aac('0x1f'));this['callback']=_0x31c5f4['callback'];this[_0x0aac('0x20')]=_0x31c5f4[_0x0aac('0x20')];this[_0x0aac('0x21')]=_0x31c5f4[_0x0aac('0x21')];this['recallme']=_0x31c5f4[_0x0aac('0x22')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x0aac('0x23')][_0x0aac('0x24')]=function(){return util[_0x0aac('0x25')](_0x0aac('0x26'),this[_0x0aac('0x6')],this[_0x0aac('0x4')]['dialCutDigit']>0x0?this[_0x0aac('0xa')][_0x0aac('0x27')](this['voiceQueue'][_0x0aac('0x28')]):this[_0x0aac('0xa')]);};Action['prototype']['getQueue']=function(){return this[_0x0aac('0xb')];};module['exports']=Action; \ No newline at end of file +var _0x6a14=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6a14,0x13c));var _0x46a1=function(_0x6b6b78,_0x1173dc){_0x6b6b78=_0x6b6b78-0x0;var _0x1d1fd7=_0x6a14[_0x6b6b78];return _0x1d1fd7;};'use strict';var util=require(_0x46a1('0x0'));var _=require(_0x46a1('0x1'));var moment=require(_0x46a1('0x2'));function checkNameSurname(_0x3cec1e,_0x3fe559,_0x5035aa){var _0x2430bb='';if(!_[_0x46a1('0x3')](_0x3fe559)&&_0x46a1('0x4')===typeof _0x3fe559){_0x2430bb+=_0x3fe559;}if(!_[_0x46a1('0x3')](_0x5035aa)&&_0x46a1('0x4')===typeof _0x5035aa){_0x2430bb+='\x20'+_0x5035aa;}if(_0x2430bb!==''){return _0x2430bb;}return _0x3cec1e;}function Action(_0x88c193,_0x5ab979,_0x4acc83){this[_0x46a1('0x5')]=_0x88c193;this[_0x46a1('0x6')]=_0x4acc83||undefined;this[_0x46a1('0x7')]=checkNameSurname(_0x5ab979[_0x46a1('0x8')][_0x46a1('0x9')],_0x5ab979[_0x46a1('0x8')][_0x46a1('0xa')],_0x5ab979[_0x46a1('0x8')][_0x46a1('0xb')]);this[_0x46a1('0xc')]=_0x5ab979['Contact'][_0x46a1('0x9')];this['queue']=_0x88c193[_0x46a1('0x7')];this[_0x46a1('0xd')]=_0x5ab979[_0x46a1('0xd')]||![];this['type']=_0x88c193[_0x46a1('0xe')];this['dialQueueTimeout']=_0x88c193[_0x46a1('0xf')]||0x3;this[_0x46a1('0x10')]=_0x5ab979[_0x46a1('0x10')];this[_0x46a1('0x11')]=_0x5ab979[_0x46a1('0x11')];this[_0x46a1('0x12')]=_0x5ab979[_0x46a1('0x12')];this[_0x46a1('0x13')]=_0x5ab979[_0x46a1('0x13')];this[_0x46a1('0x14')]=_0x5ab979[_0x46a1('0x14')];this[_0x46a1('0x15')]=_0x5ab979['countdropretry'];this[_0x46a1('0x16')]=_0x5ab979[_0x46a1('0x16')];this[_0x46a1('0x17')]=_0x5ab979[_0x46a1('0x17')];this['countagentrejectretry']=_0x5ab979[_0x46a1('0x18')];this[_0x46a1('0x19')]=_0x5ab979[_0x46a1('0x19')];this['ListId']=_0x5ab979[_0x46a1('0x1a')];this[_0x46a1('0x1b')]=_0x5ab979[_0x46a1('0x1b')];this['VoiceQueueId']=_0x5ab979[_0x46a1('0x1c')];this['CampaignId']=_0x5ab979['CampaignId'];this[_0x46a1('0x1d')]=_0x5ab979['id'];this[_0x46a1('0x1e')]=_0x5ab979[_0x46a1('0x8')][_0x46a1('0xa')]||'';this[_0x46a1('0x1f')]=moment()[_0x46a1('0x20')](_0x46a1('0x21'));this[_0x46a1('0x22')]=_0x5ab979['callback'];this[_0x46a1('0x23')]=_0x5ab979['callbackuniqueid'];this[_0x46a1('0x24')]=_0x5ab979[_0x46a1('0x24')];this[_0x46a1('0x25')]=_0x5ab979[_0x46a1('0x25')];this[_0x46a1('0x26')]='';this[_0x46a1('0x27')]='';}Action[_0x46a1('0x28')][_0x46a1('0x29')]=function(){return util[_0x46a1('0x20')](_0x46a1('0x2a'),this[_0x46a1('0x7')],this[_0x46a1('0x5')][_0x46a1('0x2b')]>0x0?this[_0x46a1('0xc')][_0x46a1('0x2c')](this[_0x46a1('0x5')][_0x46a1('0x2b')]):this[_0x46a1('0xc')]);};Action[_0x46a1('0x28')][_0x46a1('0x2d')]=function(){return this[_0x46a1('0x2e')];};module[_0x46a1('0x2f')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 56fec63..50ab542 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 _0x8f9e=['callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countdropretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x322d30,_0x1c20f5){var _0x129079=function(_0x2a98f1){while(--_0x2a98f1){_0x322d30['push'](_0x322d30['shift']());}};_0x129079(++_0x1c20f5);}(_0x8f9e,0xb7));var _0xe8f9=function(_0x26297c,_0x25e593){_0x26297c=_0x26297c-0x0;var _0x47c4c1=_0x8f9e[_0x26297c];return _0x47c4c1;};'use strict';var util=require(_0xe8f9('0x0'));var _=require(_0xe8f9('0x1'));var moment=require('moment');function getSeconds(_0x54d39c,_0x314e63){var _0x5bf3aa=moment(_0x54d39c)['milliseconds'](0x0);var _0x3b3688=moment(_0x314e63)[_0xe8f9('0x2')](0x0);return _0x5bf3aa[_0xe8f9('0x3')](_0x3b3688,_0xe8f9('0x4'));}function AdditionalPhone(_0x231a5f){this[_0xe8f9('0x5')]=_0x231a5f[_0xe8f9('0x5')];this[_0xe8f9('0x6')]=_0x231a5f[_0xe8f9('0x6')]||undefined;this[_0xe8f9('0x7')]=_0x231a5f[_0xe8f9('0x7')];this['campaigntype']=_0x231a5f[_0xe8f9('0x7')]===_0xe8f9('0x8')?_0xe8f9('0x9'):_0x231a5f['type'];this[_0xe8f9('0xa')]=_0x231a5f[_0xe8f9('0xa')];this[_0xe8f9('0xb')]=_0x231a5f[_0xe8f9('0xb')];this['countnoanswerretry']=_0x231a5f['countnoanswerretry'];this[_0xe8f9('0xc')]=_0x231a5f[_0xe8f9('0xa')]+_0x231a5f[_0xe8f9('0xb')]+_0x231a5f['countnoanswerretry']+_0x231a5f['countnosuchnumberretry']+_0x231a5f[_0xe8f9('0xd')]+_0x231a5f[_0xe8f9('0xe')]+_0x231a5f[_0xe8f9('0xf')]+_0x231a5f['countagentrejectretry'];this['countnosuchnumberretry']=_0x231a5f['countnosuchnumberretry'];this[_0xe8f9('0xd')]=_0x231a5f[_0xe8f9('0xd')];this[_0xe8f9('0xe')]=_0x231a5f[_0xe8f9('0xe')];this[_0xe8f9('0xf')]=_0x231a5f[_0xe8f9('0xf')];this['countagentrejectretry']=_0x231a5f['countagentrejectretry'];this[_0xe8f9('0x9')]=_0x231a5f[_0xe8f9('0x9')];this[_0xe8f9('0x10')]=_0x231a5f[_0xe8f9('0x11')];this[_0xe8f9('0x12')]=_0x231a5f['number'];this[_0xe8f9('0x13')]=_0x231a5f['starttime'];this['responsetime']=_0x231a5f[_0xe8f9('0x14')];this[_0xe8f9('0x15')]=_0x231a5f[_0xe8f9('0x14')];this[_0xe8f9('0x16')]=getSeconds(_0x231a5f['responsetime'],_0x231a5f[_0xe8f9('0x13')]);this[_0xe8f9('0x17')]=0x0;this[_0xe8f9('0x18')]=0x0;this[_0xe8f9('0x19')]=_0x231a5f['callback'];this[_0xe8f9('0x1a')]=_0x231a5f[_0xe8f9('0x1a')];this[_0xe8f9('0x1b')]=_0x231a5f[_0xe8f9('0x1b')];this['recallme']=_0x231a5f[_0xe8f9('0x1c')];this[_0xe8f9('0x1d')]=_0x231a5f['ContactId'];this['ListId']=_0x231a5f['ListId'];this[_0xe8f9('0x1e')]=_0x231a5f['UserId'];this['VoiceQueueId']=_0x231a5f['VoiceQueueId'];this[_0xe8f9('0x1f')]=_0x231a5f[_0xe8f9('0x1f')];this[_0xe8f9('0x20')]=_0x231a5f['originatecalleridnum']||'';this['originatecalleridname']=_0x231a5f[_0xe8f9('0x21')]||'';}module[_0xe8f9('0x22')]=History; \ No newline at end of file +var _0xe9ea=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x2b2426,_0xf90cc){var _0x5ec929=function(_0x347412){while(--_0x347412){_0x2b2426['push'](_0x2b2426['shift']());}};_0x5ec929(++_0xf90cc);}(_0xe9ea,0x151));var _0xae9e=function(_0xf67638,_0x2b75b6){_0xf67638=_0xf67638-0x0;var _0x23e03a=_0xe9ea[_0xf67638];return _0x23e03a;};'use strict';var util=require(_0xae9e('0x0'));var _=require('lodash');var moment=require(_0xae9e('0x1'));function getSeconds(_0x5202ca,_0x492ab4){var _0x2f5cd3=moment(_0x5202ca)[_0xae9e('0x2')](0x0);var _0x171491=moment(_0x492ab4)['milliseconds'](0x0);return _0x2f5cd3[_0xae9e('0x3')](_0x171491,_0xae9e('0x4'));}function AdditionalPhone(_0x546e73){this[_0xae9e('0x5')]=_0x546e73['uniqueid'];this[_0xae9e('0x6')]=_0x546e73['scheduledat']||undefined;this[_0xae9e('0x7')]=_0x546e73[_0xae9e('0x7')];this[_0xae9e('0x8')]=_0x546e73[_0xae9e('0x7')]===_0xae9e('0x9')?_0xae9e('0xa'):_0x546e73[_0xae9e('0x7')];this[_0xae9e('0xb')]=_0x546e73['countbusyretry'];this[_0xae9e('0xc')]=_0x546e73[_0xae9e('0xc')];this[_0xae9e('0xd')]=_0x546e73[_0xae9e('0xd')];this[_0xae9e('0xe')]=_0x546e73['countbusyretry']+_0x546e73[_0xae9e('0xc')]+_0x546e73[_0xae9e('0xd')]+_0x546e73[_0xae9e('0xf')]+_0x546e73[_0xae9e('0x10')]+_0x546e73[_0xae9e('0x11')]+_0x546e73[_0xae9e('0x12')]+_0x546e73['countagentrejectretry'];this[_0xae9e('0xf')]=_0x546e73[_0xae9e('0xf')];this[_0xae9e('0x10')]=_0x546e73[_0xae9e('0x10')];this[_0xae9e('0x11')]=_0x546e73['countabandonedretry'];this[_0xae9e('0x12')]=_0x546e73[_0xae9e('0x12')];this[_0xae9e('0x13')]=_0x546e73[_0xae9e('0x13')];this['queue']=_0x546e73['queue'];this[_0xae9e('0x14')]=_0x546e73[_0xae9e('0x15')];this[_0xae9e('0x16')]=_0x546e73['number'];this[_0xae9e('0x17')]=_0x546e73['starttime'];this[_0xae9e('0x18')]=_0x546e73['responsetime'];this['endtime']=_0x546e73['responsetime'];this[_0xae9e('0x19')]=getSeconds(_0x546e73[_0xae9e('0x18')],_0x546e73['starttime']);this[_0xae9e('0x1a')]=0x0;this['talktime']=0x0;this[_0xae9e('0x1b')]=_0x546e73[_0xae9e('0x1b')];this[_0xae9e('0x1c')]=_0x546e73[_0xae9e('0x1c')];this[_0xae9e('0x1d')]=_0x546e73[_0xae9e('0x1d')];this[_0xae9e('0x1e')]=_0x546e73[_0xae9e('0x1e')];this[_0xae9e('0x1f')]=_0x546e73[_0xae9e('0x1f')];this[_0xae9e('0x20')]=_0x546e73[_0xae9e('0x20')];this[_0xae9e('0x21')]=_0x546e73[_0xae9e('0x21')];this[_0xae9e('0x22')]=_0x546e73[_0xae9e('0x22')];this[_0xae9e('0x23')]=_0x546e73['CampaignId'];this[_0xae9e('0x24')]=_0x546e73[_0xae9e('0x24')]||'';this[_0xae9e('0x25')]=_0x546e73[_0xae9e('0x25')]||'';}module[_0xae9e('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 1891dd3..38ced04 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 _0x911e=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','milliseconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x911e,0x8f));var _0xe911=function(_0x275f3a,_0x59f599){_0x275f3a=_0x275f3a-0x0;var _0xe3c45d=_0x911e[_0x275f3a];return _0xe3c45d;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x4d3134,_0x59c2e6){var _0x34efd9=moment(_0x4d3134)[_0xe911('0x0')](0x0);var _0x2dbd37=moment(_0x59c2e6)[_0xe911('0x0')](0x0);return _0x34efd9['diff'](_0x2dbd37,'seconds');}function AgentComplete(_0x4dd970,_0x140706){this[_0xe911('0x1')]=0x4;this[_0xe911('0x2')]=_0xe911('0x3');this[_0xe911('0x4')]=_0x4dd970[_0xe911('0x4')];this[_0xe911('0x5')]=_0x4dd970[_0xe911('0x5')];this['campaigntype']=_0x4dd970[_0xe911('0x5')]===_0xe911('0x6')?_0xe911('0x7'):_0x4dd970[_0xe911('0x5')];this['countbusyretry']=_0x4dd970[_0xe911('0x8')];this[_0xe911('0x9')]=_0x4dd970[_0xe911('0x9')];this[_0xe911('0xa')]=_0x4dd970[_0xe911('0xa')];this[_0xe911('0xb')]=_0x4dd970[_0xe911('0x8')]+_0x4dd970[_0xe911('0x9')]+_0x4dd970[_0xe911('0xa')]+_0x4dd970[_0xe911('0xc')]+_0x4dd970['countdropretry']+_0x4dd970[_0xe911('0xd')]+_0x4dd970[_0xe911('0xe')]+_0x4dd970['countagentrejectretry'];this[_0xe911('0xc')]=_0x4dd970[_0xe911('0xc')];this[_0xe911('0xf')]=_0x4dd970[_0xe911('0xf')];this[_0xe911('0xd')]=_0x4dd970[_0xe911('0xd')];this[_0xe911('0xe')]=_0x4dd970[_0xe911('0xe')];this[_0xe911('0x10')]=_0x4dd970[_0xe911('0x10')];this[_0xe911('0x11')]=_0x140706[_0xe911('0x11')];this[_0xe911('0x12')]=_0x4dd970[_0xe911('0x13')];this[_0xe911('0x14')]=_0x4dd970[_0xe911('0x15')];this[_0xe911('0x16')]=_0x4dd970[_0xe911('0x16')];this[_0xe911('0x17')]=_0x4dd970['responsetime'];this[_0xe911('0x18')]=_0x4dd970['answertime'];this[_0xe911('0x19')]=moment()[_0xe911('0x1a')](_0xe911('0x1b'));this[_0xe911('0x1c')]=getSeconds(_0x4dd970[_0xe911('0x17')],_0x4dd970[_0xe911('0x16')]);this[_0xe911('0x1d')]=getSeconds(_0x4dd970[_0xe911('0x18')],_0x4dd970[_0xe911('0x17')]);this[_0xe911('0x1e')]=getSeconds(this[_0xe911('0x19')],_0x4dd970[_0xe911('0x18')]);this[_0xe911('0x7')]=_0x140706[_0xe911('0x7')];this[_0xe911('0x1f')]=_0x140706[_0xe911('0x1f')];this[_0xe911('0x20')]=_0x140706[_0xe911('0x20')];this[_0xe911('0x21')]=_0x4dd970[_0xe911('0x21')];this['callbackuniqueid']=_0x4dd970[_0xe911('0x22')];this[_0xe911('0x23')]=_0x4dd970[_0xe911('0x23')];this[_0xe911('0x24')]=_0x4dd970[_0xe911('0x24')];this[_0xe911('0x25')]=_0x4dd970[_0xe911('0x25')];this[_0xe911('0x26')]=_0x4dd970[_0xe911('0x26')];this['UserId']=_0x4dd970[_0xe911('0x27')];this['VoiceQueueId']=_0x4dd970[_0xe911('0x28')];this['CampaignId']=_0x4dd970[_0xe911('0x29')];this[_0xe911('0x2a')]=_0x4dd970[_0xe911('0x2a')]||'';this[_0xe911('0x2b')]=_0x4dd970['originatecalleridname']||'';}module[_0xe911('0x2c')]=AgentComplete; \ No newline at end of file +var _0xe76c=['responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe76c,0x6e));var _0xce76=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xe76c[_0x5c9307];return _0x373e29;};'use strict';var util=require('util');var _=require(_0xce76('0x0'));var moment=require('moment');function getSeconds(_0x147b7d,_0x6aebba){var _0x3674b3=moment(_0x147b7d)[_0xce76('0x1')](0x0);var _0x48dd7a=moment(_0x6aebba)[_0xce76('0x1')](0x0);return _0x3674b3[_0xce76('0x2')](_0x48dd7a,_0xce76('0x3'));}function AgentComplete(_0x335258,_0x40189a){this[_0xce76('0x4')]=0x4;this[_0xce76('0x5')]='Answer';this['scheduledat']=_0x335258[_0xce76('0x6')];this['type']=_0x335258[_0xce76('0x7')];this[_0xce76('0x8')]=_0x335258[_0xce76('0x7')]==='outbound'?_0xce76('0x9'):_0x335258['type'];this[_0xce76('0xa')]=_0x335258[_0xce76('0xa')];this[_0xce76('0xb')]=_0x335258[_0xce76('0xb')];this[_0xce76('0xc')]=_0x335258['countnoanswerretry'];this[_0xce76('0xd')]=_0x335258['countbusyretry']+_0x335258['countcongestionretry']+_0x335258[_0xce76('0xc')]+_0x335258[_0xce76('0xe')]+_0x335258[_0xce76('0xf')]+_0x335258[_0xce76('0x10')]+_0x335258[_0xce76('0x11')]+_0x335258[_0xce76('0x12')];this[_0xce76('0xe')]=_0x335258['countnosuchnumberretry'];this[_0xce76('0xf')]=_0x335258[_0xce76('0xf')];this['countabandonedretry']=_0x335258[_0xce76('0x10')];this['countmachineretry']=_0x335258[_0xce76('0x11')];this[_0xce76('0x12')]=_0x335258[_0xce76('0x12')];this[_0xce76('0x13')]=_0x40189a[_0xce76('0x13')];this[_0xce76('0x14')]=_0x335258[_0xce76('0x15')];this[_0xce76('0x16')]=_0x335258[_0xce76('0x17')];this[_0xce76('0x18')]=_0x335258[_0xce76('0x18')];this[_0xce76('0x19')]=_0x335258['responsetime'];this[_0xce76('0x1a')]=_0x335258[_0xce76('0x1a')];this[_0xce76('0x1b')]=moment()[_0xce76('0x1c')](_0xce76('0x1d'));this['ringtime']=getSeconds(_0x335258['responsetime'],_0x335258[_0xce76('0x18')]);this[_0xce76('0x1e')]=getSeconds(_0x335258[_0xce76('0x1a')],_0x335258['responsetime']);this[_0xce76('0x1f')]=getSeconds(this['endtime'],_0x335258[_0xce76('0x1a')]);this['queue']=_0x40189a[_0xce76('0x9')];this['membername']=_0x40189a[_0xce76('0x20')];this[_0xce76('0x21')]=_0x40189a[_0xce76('0x21')];this['callback']=_0x335258['callback'];this[_0xce76('0x22')]=_0x335258[_0xce76('0x22')];this[_0xce76('0x23')]=_0x335258[_0xce76('0x23')];this[_0xce76('0x24')]=_0x335258[_0xce76('0x24')];this[_0xce76('0x25')]=_0x335258['ContactId'];this[_0xce76('0x26')]=_0x335258['ListId'];this['UserId']=_0x335258[_0xce76('0x27')];this[_0xce76('0x28')]=_0x335258[_0xce76('0x28')];this[_0xce76('0x29')]=_0x335258[_0xce76('0x29')];this['originatecalleridnum']=_0x335258[_0xce76('0x2a')]||'';this[_0xce76('0x2b')]=_0x335258[_0xce76('0x2b')]||'';}module[_0xce76('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 29fd57e..2bbb151 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 _0x19d0=['endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime'];(function(_0x1200e9,_0x1a23a4){var _0x2c1ac4=function(_0x1e87e4){while(--_0x1e87e4){_0x1200e9['push'](_0x1200e9['shift']());}};_0x2c1ac4(++_0x1a23a4);}(_0x19d0,0xc1));var _0x019d=function(_0x43efb5,_0x47b68f){_0x43efb5=_0x43efb5-0x0;var _0xfd7d37=_0x19d0[_0x43efb5];return _0xfd7d37;};'use strict';var util=require(_0x019d('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x5633a5,_0x3d38bf){var _0x12620b=moment(_0x5633a5)[_0x019d('0x1')](0x0);var _0x3a60b8=moment(_0x3d38bf)['milliseconds'](0x0);return _0x12620b[_0x019d('0x2')](_0x3a60b8,_0x019d('0x3'));}function Final(_0x5c5a81){this[_0x019d('0x4')]=_0x5c5a81['uniqueid'];this[_0x019d('0x5')]=_0x5c5a81['scheduledat'];this[_0x019d('0x6')]=_0x5c5a81[_0x019d('0x6')];this[_0x019d('0x7')]=_0x5c5a81[_0x019d('0x6')]===_0x019d('0x8')?'queue':_0x5c5a81[_0x019d('0x6')];this[_0x019d('0x9')]=_0x5c5a81[_0x019d('0x9')];this[_0x019d('0xa')]=_0x5c5a81[_0x019d('0xa')];this['countnoanswerretry']=_0x5c5a81[_0x019d('0xb')];this[_0x019d('0xc')]=_0x5c5a81['countbusyretry']+_0x5c5a81[_0x019d('0xa')]+_0x5c5a81['countnoanswerretry']+_0x5c5a81['countnosuchnumberretry']+_0x5c5a81[_0x019d('0xd')]+_0x5c5a81['countabandonedretry']+_0x5c5a81[_0x019d('0xe')]+_0x5c5a81[_0x019d('0xf')];this[_0x019d('0x10')]=_0x5c5a81['countnosuchnumberretry'];this[_0x019d('0xd')]=_0x5c5a81['countdropretry'];this[_0x019d('0x11')]=_0x5c5a81[_0x019d('0x11')];this[_0x019d('0xe')]=_0x5c5a81[_0x019d('0xe')];this[_0x019d('0xf')]=_0x5c5a81['countagentrejectretry'];this[_0x019d('0x12')]=_0x5c5a81['queue'];this['calleridname']=_0x5c5a81[_0x019d('0x13')];this[_0x019d('0x14')]=_0x5c5a81[_0x019d('0x14')];this[_0x019d('0x15')]=_0x5c5a81[_0x019d('0x15')];this[_0x019d('0x16')]=_0x5c5a81[_0x019d('0x16')];this[_0x019d('0x17')]=_0x5c5a81[_0x019d('0x16')];this[_0x019d('0x18')]=_0x5c5a81[_0x019d('0x18')]||0x0;this[_0x019d('0x19')]=_0x5c5a81['holdtime']||0x0;this[_0x019d('0x1a')]=_0x5c5a81[_0x019d('0x1a')]||0x0;this[_0x019d('0x1b')]=_0x5c5a81[_0x019d('0x1b')];this['callbackuniqueid']=_0x5c5a81['callbackuniqueid'];this[_0x019d('0x1c')]=_0x5c5a81[_0x019d('0x1c')];this[_0x019d('0x1d')]=_0x5c5a81[_0x019d('0x1d')];this[_0x019d('0x1e')]=_0x5c5a81[_0x019d('0x1e')];this['ListId']=_0x5c5a81['ListId'];this['UserId']=_0x5c5a81['UserId'];this[_0x019d('0x1f')]=_0x5c5a81['VoiceQueueId'];this[_0x019d('0x20')]=_0x5c5a81['CampaignId'];this[_0x019d('0x21')]=_0x5c5a81[_0x019d('0x21')]||'';this['originatecalleridname']=_0x5c5a81[_0x019d('0x22')]||'';}module[_0x019d('0x23')]=Final; \ No newline at end of file +var _0x06f3=['countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x12d925,_0x682297){var _0x433ab0=function(_0xba55b4){while(--_0xba55b4){_0x12d925['push'](_0x12d925['shift']());}};_0x433ab0(++_0x682297);}(_0x06f3,0x16c));var _0x306f=function(_0x391df0,_0x51b2dc){_0x391df0=_0x391df0-0x0;var _0x30bec6=_0x06f3[_0x391df0];return _0x30bec6;};'use strict';var util=require(_0x306f('0x0'));var _=require(_0x306f('0x1'));var moment=require(_0x306f('0x2'));function getSeconds(_0x205fde,_0x48dfab){var _0x2f53d7=moment(_0x205fde)['milliseconds'](0x0);var _0x56a9c0=moment(_0x48dfab)[_0x306f('0x3')](0x0);return _0x2f53d7['diff'](_0x56a9c0,'seconds');}function Final(_0x26706c){this[_0x306f('0x4')]=_0x26706c['uniqueid'];this[_0x306f('0x5')]=_0x26706c[_0x306f('0x5')];this[_0x306f('0x6')]=_0x26706c[_0x306f('0x6')];this[_0x306f('0x7')]=_0x26706c[_0x306f('0x6')]==='outbound'?_0x306f('0x8'):_0x26706c['type'];this[_0x306f('0x9')]=_0x26706c['countbusyretry'];this[_0x306f('0xa')]=_0x26706c[_0x306f('0xa')];this[_0x306f('0xb')]=_0x26706c[_0x306f('0xb')];this[_0x306f('0xc')]=_0x26706c[_0x306f('0x9')]+_0x26706c[_0x306f('0xa')]+_0x26706c[_0x306f('0xb')]+_0x26706c[_0x306f('0xd')]+_0x26706c[_0x306f('0xe')]+_0x26706c[_0x306f('0xf')]+_0x26706c[_0x306f('0x10')]+_0x26706c['countagentrejectretry'];this['countnosuchnumberretry']=_0x26706c[_0x306f('0xd')];this[_0x306f('0xe')]=_0x26706c[_0x306f('0xe')];this['countabandonedretry']=_0x26706c[_0x306f('0xf')];this[_0x306f('0x10')]=_0x26706c[_0x306f('0x10')];this[_0x306f('0x11')]=_0x26706c[_0x306f('0x11')];this[_0x306f('0x8')]=_0x26706c[_0x306f('0x8')];this[_0x306f('0x12')]=_0x26706c[_0x306f('0x12')];this[_0x306f('0x13')]=_0x26706c[_0x306f('0x13')];this['starttime']=_0x26706c[_0x306f('0x14')];this[_0x306f('0x15')]=_0x26706c[_0x306f('0x15')];this[_0x306f('0x16')]=_0x26706c[_0x306f('0x15')];this[_0x306f('0x17')]=_0x26706c[_0x306f('0x17')]||0x0;this[_0x306f('0x18')]=_0x26706c[_0x306f('0x18')]||0x0;this[_0x306f('0x19')]=_0x26706c[_0x306f('0x19')]||0x0;this['callback']=_0x26706c[_0x306f('0x1a')];this[_0x306f('0x1b')]=_0x26706c['callbackuniqueid'];this[_0x306f('0x1c')]=_0x26706c['callbackat'];this[_0x306f('0x1d')]=_0x26706c['recallme'];this['ContactId']=_0x26706c[_0x306f('0x1e')];this[_0x306f('0x1f')]=_0x26706c[_0x306f('0x1f')];this['UserId']=_0x26706c[_0x306f('0x20')];this[_0x306f('0x21')]=_0x26706c[_0x306f('0x21')];this[_0x306f('0x22')]=_0x26706c['CampaignId'];this['originatecalleridnum']=_0x26706c[_0x306f('0x23')]||'';this[_0x306f('0x24')]=_0x26706c['originatecalleridname']||'';}module[_0x306f('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 2eaf450..7cc343d 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 _0x0f90=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','talktime','membername','IVR','reason','cause-txt'];(function(_0x2503f2,_0x305c53){var _0x13ab2c=function(_0x3a9383){while(--_0x3a9383){_0x2503f2['push'](_0x2503f2['shift']());}};_0x13ab2c(++_0x305c53);}(_0x0f90,0xc6));var _0x00f9=function(_0x25f7b7,_0xfe33e){_0x25f7b7=_0x25f7b7-0x0;var _0x4c4432=_0x0f90[_0x25f7b7];return _0x4c4432;};'use strict';var util=require(_0x00f9('0x0'));var _=require(_0x00f9('0x1'));var moment=require(_0x00f9('0x2'));function getSeconds(_0x13d7a7,_0xbe9bca){var _0x13edb9=moment(_0x13d7a7)['milliseconds'](0x0);var _0x4590d3=moment(_0xbe9bca)[_0x00f9('0x3')](0x0);return _0x13edb9['diff'](_0x4590d3,_0x00f9('0x4'));}function Hangup(_0x1d01d6,_0x504de0){this[_0x00f9('0x5')]=0x4;this[_0x00f9('0x6')]='Answer';this[_0x00f9('0x7')]=_0x1d01d6['scheduledat'];this[_0x00f9('0x8')]=_0x1d01d6[_0x00f9('0x8')];this['campaigntype']=_0x1d01d6['type']===_0x00f9('0x9')?_0x00f9('0xa'):_0x1d01d6[_0x00f9('0x8')];this[_0x00f9('0xb')]=_0x1d01d6[_0x00f9('0xb')];this[_0x00f9('0xc')]=_0x1d01d6[_0x00f9('0xc')];this[_0x00f9('0xd')]=_0x1d01d6[_0x00f9('0xd')];this[_0x00f9('0xe')]=_0x1d01d6['countbusyretry']+_0x1d01d6[_0x00f9('0xc')]+_0x1d01d6['countnoanswerretry']+_0x1d01d6[_0x00f9('0xf')]+_0x1d01d6[_0x00f9('0x10')]+_0x1d01d6['countabandonedretry']+_0x1d01d6[_0x00f9('0x11')]+_0x1d01d6[_0x00f9('0x12')];this[_0x00f9('0xf')]=_0x1d01d6[_0x00f9('0xf')];this[_0x00f9('0x10')]=_0x1d01d6['countdropretry'];this[_0x00f9('0x13')]=_0x1d01d6[_0x00f9('0x13')];this['countmachineretry']=_0x1d01d6[_0x00f9('0x11')];this[_0x00f9('0x12')]=_0x1d01d6[_0x00f9('0x12')];this[_0x00f9('0x14')]=_0x504de0[_0x00f9('0x14')];this[_0x00f9('0x15')]=_0x1d01d6[_0x00f9('0x16')];this[_0x00f9('0x17')]=_0x1d01d6[_0x00f9('0x18')];this['starttime']=_0x1d01d6['starttime'];this[_0x00f9('0x19')]=_0x1d01d6[_0x00f9('0x19')];this[_0x00f9('0x1a')]=moment()[_0x00f9('0x1b')](_0x00f9('0x1c'));this[_0x00f9('0x1d')]=getSeconds(_0x1d01d6['responsetime'],_0x1d01d6[_0x00f9('0x1e')]);this[_0x00f9('0x1f')]=0x0;this[_0x00f9('0x20')]=getSeconds(this[_0x00f9('0x1a')],_0x1d01d6[_0x00f9('0x19')]);this[_0x00f9('0xa')]=_0x1d01d6[_0x00f9('0xa')];this[_0x00f9('0x21')]=_0x00f9('0x22');this[_0x00f9('0x23')]=_0x504de0[_0x00f9('0x24')];this[_0x00f9('0x25')]=_0x1d01d6[_0x00f9('0x25')];this[_0x00f9('0x26')]=_0x1d01d6[_0x00f9('0x26')];this['callbackat']=_0x1d01d6[_0x00f9('0x27')];this[_0x00f9('0x28')]=_0x1d01d6[_0x00f9('0x28')];this['ContactId']=_0x1d01d6[_0x00f9('0x29')];this[_0x00f9('0x2a')]=_0x1d01d6[_0x00f9('0x2a')];this[_0x00f9('0x2b')]=_0x1d01d6[_0x00f9('0x2b')];this[_0x00f9('0x2c')]=_0x1d01d6[_0x00f9('0x2c')];this['CampaignId']=_0x1d01d6[_0x00f9('0x2d')];}module[_0x00f9('0x2e')]=Hangup; \ No newline at end of file +var _0xcf17=['membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','talktime'];(function(_0x1b7948,_0x29fee4){var _0x3fee06=function(_0x48fd97){while(--_0x48fd97){_0x1b7948['push'](_0x1b7948['shift']());}};_0x3fee06(++_0x29fee4);}(_0xcf17,0x199));var _0x7cf1=function(_0x4b847c,_0x277dc5){_0x4b847c=_0x4b847c-0x0;var _0x519b29=_0xcf17[_0x4b847c];return _0x519b29;};'use strict';var util=require('util');var _=require(_0x7cf1('0x0'));var moment=require(_0x7cf1('0x1'));function getSeconds(_0x33d60d,_0x5380cd){var _0x13dbfb=moment(_0x33d60d)[_0x7cf1('0x2')](0x0);var _0x2d74e1=moment(_0x5380cd)[_0x7cf1('0x2')](0x0);return _0x13dbfb[_0x7cf1('0x3')](_0x2d74e1,_0x7cf1('0x4'));}function Hangup(_0x1b6d4c,_0x32084e){this[_0x7cf1('0x5')]=0x4;this['statedesc']=_0x7cf1('0x6');this[_0x7cf1('0x7')]=_0x1b6d4c[_0x7cf1('0x7')];this['type']=_0x1b6d4c[_0x7cf1('0x8')];this[_0x7cf1('0x9')]=_0x1b6d4c['type']===_0x7cf1('0xa')?_0x7cf1('0xb'):_0x1b6d4c['type'];this[_0x7cf1('0xc')]=_0x1b6d4c['countbusyretry'];this[_0x7cf1('0xd')]=_0x1b6d4c[_0x7cf1('0xd')];this[_0x7cf1('0xe')]=_0x1b6d4c['countnoanswerretry'];this['countglobal']=_0x1b6d4c['countbusyretry']+_0x1b6d4c['countcongestionretry']+_0x1b6d4c['countnoanswerretry']+_0x1b6d4c[_0x7cf1('0xf')]+_0x1b6d4c[_0x7cf1('0x10')]+_0x1b6d4c['countabandonedretry']+_0x1b6d4c[_0x7cf1('0x11')]+_0x1b6d4c[_0x7cf1('0x12')];this[_0x7cf1('0xf')]=_0x1b6d4c[_0x7cf1('0xf')];this['countdropretry']=_0x1b6d4c[_0x7cf1('0x10')];this[_0x7cf1('0x13')]=_0x1b6d4c[_0x7cf1('0x13')];this[_0x7cf1('0x11')]=_0x1b6d4c[_0x7cf1('0x11')];this[_0x7cf1('0x12')]=_0x1b6d4c[_0x7cf1('0x12')];this['uniqueid']=_0x32084e[_0x7cf1('0x14')];this[_0x7cf1('0x15')]=_0x1b6d4c[_0x7cf1('0x16')];this[_0x7cf1('0x17')]=_0x1b6d4c[_0x7cf1('0x18')];this[_0x7cf1('0x19')]=_0x1b6d4c[_0x7cf1('0x19')];this[_0x7cf1('0x1a')]=_0x1b6d4c[_0x7cf1('0x1a')];this[_0x7cf1('0x1b')]=moment()[_0x7cf1('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7cf1('0x1d')]=getSeconds(_0x1b6d4c['responsetime'],_0x1b6d4c[_0x7cf1('0x19')]);this['holdtime']=0x0;this[_0x7cf1('0x1e')]=getSeconds(this['endtime'],_0x1b6d4c[_0x7cf1('0x1a')]);this[_0x7cf1('0xb')]=_0x1b6d4c[_0x7cf1('0xb')];this[_0x7cf1('0x1f')]='IVR';this[_0x7cf1('0x20')]=_0x32084e[_0x7cf1('0x21')];this['callback']=_0x1b6d4c[_0x7cf1('0x22')];this[_0x7cf1('0x23')]=_0x1b6d4c[_0x7cf1('0x23')];this[_0x7cf1('0x24')]=_0x1b6d4c[_0x7cf1('0x24')];this['recallme']=_0x1b6d4c[_0x7cf1('0x25')];this[_0x7cf1('0x26')]=_0x1b6d4c[_0x7cf1('0x26')];this[_0x7cf1('0x27')]=_0x1b6d4c[_0x7cf1('0x27')];this[_0x7cf1('0x28')]=_0x1b6d4c[_0x7cf1('0x28')];this[_0x7cf1('0x29')]=_0x1b6d4c['VoiceQueueId'];this[_0x7cf1('0x2a')]=_0x1b6d4c[_0x7cf1('0x2a')];}module[_0x7cf1('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 1a97fb3..eafbb34 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 _0x9446=['countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x25b3d5,_0x4f0a26){var _0x130bd9=function(_0x4ddb14){while(--_0x4ddb14){_0x25b3d5['push'](_0x25b3d5['shift']());}};_0x130bd9(++_0x4f0a26);}(_0x9446,0x170));var _0x6944=function(_0x5be8f8,_0x4e6602){_0x5be8f8=_0x5be8f8-0x0;var _0x5d72ba=_0x9446[_0x5be8f8];return _0x5d72ba;};'use strict';var util=require(_0x6944('0x0'));var _=require(_0x6944('0x1'));var moment=require(_0x6944('0x2'));function getSeconds(_0x5114f5,_0x1de4b0){var _0x46c372=moment(_0x5114f5)[_0x6944('0x3')](0x0);var _0x46f26e=moment(_0x1de4b0)[_0x6944('0x3')](0x0);return _0x46c372[_0x6944('0x4')](_0x46f26e,_0x6944('0x5'));}function History(_0x35f33b){this['uniqueid']=_0x35f33b['uniqueid'];this[_0x6944('0x6')]=_0x35f33b['scheduledat']||undefined;this[_0x6944('0x7')]=_0x35f33b[_0x6944('0x7')];this['campaigntype']=_0x35f33b[_0x6944('0x7')]===_0x6944('0x8')?_0x6944('0x9'):_0x35f33b['type'];this[_0x6944('0xa')]=_0x35f33b[_0x6944('0xa')];this[_0x6944('0xb')]=_0x35f33b['countcongestionretry'];this['countnoanswerretry']=_0x35f33b[_0x6944('0xc')];this[_0x6944('0xd')]=_0x35f33b[_0x6944('0xa')]+_0x35f33b[_0x6944('0xb')]+_0x35f33b[_0x6944('0xc')]+_0x35f33b['countnosuchnumberretry']+_0x35f33b[_0x6944('0xe')]+_0x35f33b[_0x6944('0xf')]+_0x35f33b[_0x6944('0x10')]+_0x35f33b[_0x6944('0x11')];this[_0x6944('0x12')]=_0x35f33b[_0x6944('0x12')];this[_0x6944('0xe')]=_0x35f33b[_0x6944('0xe')];this[_0x6944('0xf')]=_0x35f33b[_0x6944('0xf')];this[_0x6944('0x10')]=_0x35f33b[_0x6944('0x10')];this[_0x6944('0x11')]=_0x35f33b[_0x6944('0x11')];this['queue']=_0x35f33b[_0x6944('0x9')];this[_0x6944('0x13')]=_0x35f33b[_0x6944('0x14')];this[_0x6944('0x15')]=_0x35f33b[_0x6944('0x16')];this[_0x6944('0x17')]=_0x35f33b[_0x6944('0x17')];this[_0x6944('0x18')]=_0x35f33b[_0x6944('0x18')];this['endtime']=_0x35f33b[_0x6944('0x18')];this[_0x6944('0x19')]=getSeconds(_0x35f33b[_0x6944('0x18')],_0x35f33b[_0x6944('0x17')]);this[_0x6944('0x1a')]=0x0;this[_0x6944('0x1b')]=0x0;this[_0x6944('0x1c')]=_0x35f33b['callback'];this[_0x6944('0x1d')]=_0x35f33b[_0x6944('0x1d')];this['callbackat']=_0x35f33b['callbackat'];this[_0x6944('0x1e')]=_0x35f33b[_0x6944('0x1e')];this[_0x6944('0x1f')]=_0x35f33b['ContactId'];this[_0x6944('0x20')]=_0x35f33b[_0x6944('0x20')];this[_0x6944('0x21')]=_0x35f33b[_0x6944('0x21')];this[_0x6944('0x22')]=_0x35f33b[_0x6944('0x22')];this[_0x6944('0x23')]=_0x35f33b[_0x6944('0x23')];this[_0x6944('0x24')]=_0x35f33b[_0x6944('0x24')]||'';this['originatecalleridname']=_0x35f33b[_0x6944('0x25')]||'';}module['exports']=History; \ No newline at end of file +var _0x63e1=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x25e522,_0x1f036b){var _0x3dd697=function(_0x2b3967){while(--_0x2b3967){_0x25e522['push'](_0x25e522['shift']());}};_0x3dd697(++_0x1f036b);}(_0x63e1,0x6d));var _0x163e=function(_0x487d00,_0x180f3a){_0x487d00=_0x487d00-0x0;var _0x38af42=_0x63e1[_0x487d00];return _0x38af42;};'use strict';var util=require(_0x163e('0x0'));var _=require(_0x163e('0x1'));var moment=require('moment');function getSeconds(_0x15ab4a,_0x454878){var _0x3c7542=moment(_0x15ab4a)['milliseconds'](0x0);var _0x101b55=moment(_0x454878)[_0x163e('0x2')](0x0);return _0x3c7542['diff'](_0x101b55,_0x163e('0x3'));}function History(_0x1ab2fa){this[_0x163e('0x4')]=_0x1ab2fa['uniqueid'];this[_0x163e('0x5')]=_0x1ab2fa[_0x163e('0x5')]||undefined;this['type']=_0x1ab2fa['type'];this[_0x163e('0x6')]=_0x1ab2fa['type']===_0x163e('0x7')?_0x163e('0x8'):_0x1ab2fa['type'];this[_0x163e('0x9')]=_0x1ab2fa['countbusyretry'];this[_0x163e('0xa')]=_0x1ab2fa[_0x163e('0xa')];this[_0x163e('0xb')]=_0x1ab2fa[_0x163e('0xb')];this['countglobal']=_0x1ab2fa[_0x163e('0x9')]+_0x1ab2fa[_0x163e('0xa')]+_0x1ab2fa[_0x163e('0xb')]+_0x1ab2fa[_0x163e('0xc')]+_0x1ab2fa['countdropretry']+_0x1ab2fa[_0x163e('0xd')]+_0x1ab2fa[_0x163e('0xe')]+_0x1ab2fa['countagentrejectretry'];this[_0x163e('0xc')]=_0x1ab2fa['countnosuchnumberretry'];this['countdropretry']=_0x1ab2fa['countdropretry'];this[_0x163e('0xd')]=_0x1ab2fa[_0x163e('0xd')];this[_0x163e('0xe')]=_0x1ab2fa[_0x163e('0xe')];this[_0x163e('0xf')]=_0x1ab2fa['countagentrejectretry'];this['queue']=_0x1ab2fa[_0x163e('0x8')];this[_0x163e('0x10')]=_0x1ab2fa[_0x163e('0x11')];this['calleridnum']=_0x1ab2fa[_0x163e('0x12')];this['starttime']=_0x1ab2fa[_0x163e('0x13')];this['responsetime']=_0x1ab2fa[_0x163e('0x14')];this['endtime']=_0x1ab2fa[_0x163e('0x14')];this['ringtime']=getSeconds(_0x1ab2fa[_0x163e('0x14')],_0x1ab2fa[_0x163e('0x13')]);this['holdtime']=0x0;this[_0x163e('0x15')]=0x0;this[_0x163e('0x16')]=_0x1ab2fa[_0x163e('0x16')];this[_0x163e('0x17')]=_0x1ab2fa['callbackuniqueid'];this[_0x163e('0x18')]=_0x1ab2fa[_0x163e('0x18')];this['recallme']=_0x1ab2fa[_0x163e('0x19')];this[_0x163e('0x1a')]=_0x1ab2fa[_0x163e('0x1a')];this['ListId']=_0x1ab2fa[_0x163e('0x1b')];this[_0x163e('0x1c')]=_0x1ab2fa[_0x163e('0x1c')];this[_0x163e('0x1d')]=_0x1ab2fa[_0x163e('0x1d')];this[_0x163e('0x1e')]=_0x1ab2fa[_0x163e('0x1e')];this[_0x163e('0x1f')]=_0x1ab2fa[_0x163e('0x1f')]||'';this['originatecalleridname']=_0x1ab2fa[_0x163e('0x20')]||'';}module[_0x163e('0x21')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index e1bd215..ca85f14 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 _0x50d2=['History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','hasOwnProperty','originated','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','NOT_ACTIVE','is\x20not\x20active','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','saveInDb','pick','ListId','UserId','[emptyContact]','isSuccess','Success','SIP/%s','reachable','unmonitored','uniqueid','variable','exten','dialAMDActive','value','HANGUP','HangupInAMD','[syncHangupInAMD]','MACHINE','AMD','countmachineretry','countglobal','amd','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','CampaignId','[rescheduleContact][Machine]','membername','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','rescheduleContact','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','cause-txt','Unknow','syncAgentComplete','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','push','[unlockQueueStatus][undefined]','queueStatusComplete','run','idHopper','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','[Catch][Preview][syncQueueStatusComplete]','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','command','iftime\x20%s,%s','interval','content','true','indexOf','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','NONE','dialer','getCaller','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','[originateError]:\x20%s','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','buildObj','[syncAgentComplete][createHistory][0]','checkRetriveMax','dialNoSuchNumberMaxRetry','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','outboundUnknownCallsDay','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','averageHandleTime','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','merge','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','dialRecallMeTimeout','Agent','voicePause','finally','Contact\x20updated','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','loggerHandler','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','moment','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','roundrobin','prototype','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncQueueSummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','available','loggedIn','pTalking','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalTotalCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------'];(function(_0xc00d7c,_0x420406){var _0x44a1b6=function(_0x5ab1bb){while(--_0x5ab1bb){_0xc00d7c['push'](_0xc00d7c['shift']());}};_0x44a1b6(++_0x420406);}(_0x50d2,0x198));var _0x250d=function(_0x4d54b7,_0x46bc80){_0x4d54b7=_0x4d54b7-0x0;var _0x2d6f25=_0x50d2[_0x4d54b7];return _0x2d6f25;};'use strict';var util=require(_0x250d('0x0'));var _=require(_0x250d('0x1'));var BPromise=require(_0x250d('0x2'));var uuid=require('uuid');var moment=require(_0x250d('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x250d('0x4'));var config=require(_0x250d('0x5'));var logger=require(_0x250d('0x6'))('dialer');var loggerBooked=require(_0x250d('0x6'))(_0x250d('0x7'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require('../../../config/logger')(_0x250d('0x8'));var loggerSyncQueueSummary=require(_0x250d('0x6'))('syncQueueSummary');var ami=require(_0x250d('0x9'));config[_0x250d('0xa')]=_[_0x250d('0xb')](config[_0x250d('0xa')],{'host':_0x250d('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x250d('0xa')]));var cmHopper=require(_0x250d('0xd'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x250d('0xe'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x250d('0xf'));var Action=require('./action');var History=require('./history');var Final=require('./final');var AgentComplete=require(_0x250d('0x10'));var QueueCallerAbandon=require(_0x250d('0x11'));var Hangup=require('./hangup');var ipAgi=process[_0x250d('0x12')][_0x250d('0x13')]||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x250d('0x14')};var Sequence=function(){};Sequence[_0x250d('0x15')]['enqueue']=function(_0xdd01b4){this['tail']=this['tail']?this[_0x250d('0x16')]['finally'](_0xdd01b4):_0xdd01b4();};function Dialer(_0x16e484,_0x38fc21){this['sequence']=new Sequence();this[_0x250d('0x17')]=_0x38fc21;this[_0x250d('0x18')]=_0x16e484[_0x250d('0x18')];this[_0x250d('0x19')]=_0x16e484[_0x250d('0x19')];this[_0x250d('0x1a')]=_0x16e484['agents'];this[_0x250d('0x1b')]=_0x16e484[_0x250d('0x1b')];this[_0x250d('0x1c')]=config[_0x250d('0x1c')]||0x2;this[_0x250d('0x1d')]={};this[_0x250d('0x1e')]={};this['contactsId']={};this[_0x250d('0x1f')]={};this[_0x250d('0x20')]={};this[_0x250d('0x21')]={};this[_0x250d('0x22')]={};this[_0x250d('0x23')]={};this[_0x250d('0x24')]={};this[_0x250d('0x25')]={};ami['on'](_0x250d('0x26'),this['syncAgentConnect'][_0x250d('0x27')](this));ami['on'](_0x250d('0x28'),this[_0x250d('0x29')][_0x250d('0x27')](this));ami['on']('originateresponse',this[_0x250d('0x2a')][_0x250d('0x27')](this));ami['on'](_0x250d('0x2b'),this['syncAgentComplete'][_0x250d('0x27')](this));ami['on']('custom:queuesummary',this[_0x250d('0x2c')]['bind'](this));ami['on']('hangup',this[_0x250d('0x2d')][_0x250d('0x27')](this));ami['on'](_0x250d('0x2e'),this[_0x250d('0x2f')][_0x250d('0x27')](this));ami['on'](_0x250d('0x30'),this[_0x250d('0x31')][_0x250d('0x27')](this));ami['on'](_0x250d('0x32'),this[_0x250d('0x33')][_0x250d('0x27')](this));ami['on'](_0x250d('0x34'),this[_0x250d('0x35')][_0x250d('0x27')](this));this['loopCampaigns']();this[_0x250d('0x36')]();}function isNotNull(_0x2d433e){return _0x2d433e!==null&&!_[_0x250d('0x37')](_0x2d433e);}function checkIsLoggedIn(_0x22afdb,_0x508956){return function(){if(_0x508956<=0x0){_0x22afdb[_0x250d('0x38')]=_0x250d('0x39');throw _0x22afdb[_0x250d('0x3a')]+_0x250d('0x3b');}};}function isActive(_0x308dc9){return _0x308dc9;}function checkIsActive(_0x6afb69,_0x489922){return function(){if(!isActive(_0x489922)){_0x6afb69[_0x250d('0x38')]='NOT_ACTIVE';throw _0x6afb69[_0x250d('0x3a')]+'\x20NOT\x20Active';}};}function checkInterval(_0x78962f){return function(){if(!isNotNull(_0x78962f[_0x250d('0x3c')])){_0x78962f[_0x250d('0x38')]=_0x250d('0x3d');throw _0x78962f['name']+_0x250d('0x3e');}if(!isNotNull(_0x78962f[_0x250d('0x3c')][_0x250d('0x3f')])){_0x78962f[_0x250d('0x38')]='INTERVAL_IS_NULL';throw _0x78962f[_0x250d('0x3a')]+_0x250d('0x3e');}if(!isNotNull(_[_0x250d('0x40')](_0x78962f[_0x250d('0x3c')][_0x250d('0x3f')]))){_0x78962f[_0x250d('0x38')]=_0x250d('0x3d');throw _0x78962f['name']+_0x250d('0x3e');}};}function msgResponse(_0x3a80f7,_0x2c962d,_0x248bb0){return{'action':_0x3a80f7,'response':_0x2c962d,'message':_0x248bb0,'stack':_0x248bb0};}function myreject(_0x121e63){return function(_0x60bd3d){return _0x121e63(msgResponse('[ifTime][Action]','Error',JSON[_0x250d('0x41')](_0x60bd3d)));};}function getSeconds(_0x5642a6,_0x4b3efb){var _0x5e2d4b=moment(_0x5642a6)[_0x250d('0x42')](0x0);var _0x35075a=moment(_0x4b3efb)[_0x250d('0x42')](0x0);return _0x5e2d4b[_0x250d('0x43')](_0x35075a,_0x250d('0x44'));}function emit(_0xafd630,_0x2e9a51,_0xeab904){io['to'](_0xafd630)[_0x250d('0x45')](_0x2e9a51,_0xeab904);}function emitVoiceQueueSummary(_0x3028ca){if(_0x3028ca[_0x250d('0x46')]===_0x250d('0x47')){var _0x19d62c={'id':_0x3028ca['id'],'name':_0x3028ca['name'],'strategy':_0x3028ca[_0x250d('0x48')],'answered':_0x3028ca['answered'],'available':_0x3028ca[_0x250d('0x49')],'loggedIn':_0x3028ca[_0x250d('0x4a')],'pTalking':_0x3028ca[_0x250d('0x4b')],'sumBillable':_0x3028ca['sumBillable'],'sumDuration':_0x3028ca[_0x250d('0x4c')],'sumHoldTime':_0x3028ca['sumHoldTime']||0x0,'talking':_0x3028ca[_0x250d('0x4d')],'total':_0x3028ca[_0x250d('0x4e')],'type':_0x3028ca[_0x250d('0x46')],'unmanaged':_0x3028ca[_0x250d('0x4f')],'abandoned':_0x3028ca[_0x250d('0x50')],'waiting':_0x3028ca[_0x250d('0x51')],'loggedInDb':_0x3028ca[_0x250d('0x52')],'dialActive':_0x3028ca[_0x250d('0x53')],'dialMethod':_0x3028ca[_0x250d('0x54')],'dialOriginateCallerIdName':_0x3028ca[_0x250d('0x55')],'dialOriginateCallerIdNumber':_0x3028ca[_0x250d('0x56')],'dialOriginateTimeout':_0x3028ca[_0x250d('0x57')],'dialPrefix':_0x3028ca['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3028ca[_0x250d('0x58')],'outboundAnswerCallsDay':_0x3028ca[_0x250d('0x59')],'outboundBlacklistCallsDay':_0x3028ca['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3028ca[_0x250d('0x5a')],'outboundCongestionCallsDay':_0x3028ca[_0x250d('0x5b')],'outboundDropCallsDayACS':_0x3028ca[_0x250d('0x5c')],'outboundDropCallsDayCallersExit':_0x3028ca[_0x250d('0x5d')],'outboundDropCallsDayTimeout':_0x3028ca[_0x250d('0x5e')],'outboundNoAnswerCallsDay':_0x3028ca[_0x250d('0x5f')],'outboundNoSuchCallsDay':_0x3028ca['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3028ca[_0x250d('0x60')],'outboundReCallsDay':_0x3028ca['outboundReCallsDay'],'outboundRejectCallsDay':_0x3028ca['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3028ca['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x3028ca[_0x250d('0x61')],'predictiveIntervalAvgHoldtime':_0x3028ca[_0x250d('0x62')],'predictiveIntervalAvgTalktime':_0x3028ca[_0x250d('0x63')],'predictiveIntervalDroppedCallsCallersExit':_0x3028ca[_0x250d('0x64')],'predictiveIntervalDroppedCallsTimeout':_0x3028ca[_0x250d('0x65')],'predictiveIntervalErlangCalls':_0x3028ca[_0x250d('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x3028ca['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3028ca['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3028ca['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3028ca['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3028ca['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3028ca[_0x250d('0x67')],'message':_0x3028ca[_0x250d('0x38')],'originated':_0x3028ca['originated'],'erlangCalls':_0x3028ca['erlangCalls'],'erlangCallToSecond':_0x3028ca['erlangCallToSecond'],'erlangAbandonmentRate':_0x3028ca[_0x250d('0x68')],'erlangBusyFactor':_0x3028ca[_0x250d('0x69')],'startPredictive':_0x3028ca[_0x250d('0x21')],'startProgressive':_0x3028ca[_0x250d('0x22')]};if(_0x3028ca[_0x250d('0x6a')]){_0x19d62c[_0x250d('0x6a')]={'id':_0x3028ca['Trunk']['id'],'name':_0x3028ca[_0x250d('0x6a')][_0x250d('0x3a')],'active':_0x3028ca[_0x250d('0x6a')][_0x250d('0x6b')],'callerid':_0x3028ca[_0x250d('0x6a')][_0x250d('0x6c')]};}if(_0x3028ca['Interval']){_0x19d62c[_0x250d('0x3c')]={'id':_0x3028ca[_0x250d('0x3c')]['id'],'name':_0x3028ca[_0x250d('0x3c')]['name']};}var _0x2a9542=md5(JSON[_0x250d('0x41')](_0x19d62c));if(_0x3028ca[_0x250d('0x6d')]!==_0x2a9542){_0x3028ca[_0x250d('0x6d')]=_0x2a9542;emit(util[_0x250d('0x6e')](_0x250d('0x6f'),_0x19d62c[_0x250d('0x3a')]),_0x250d('0x70'),_0x19d62c);}}}function emitCampaignSummary(_0x52872e){if(_0x52872e['type']==='ivr'){emit(util[_0x250d('0x6e')](_0x250d('0x71'),_0x52872e['name']),_0x250d('0x72'),_0x52872e);}}function checkGetDataPredictive(_0xd7cadb){if(isNotNull(_0xd7cadb)){if(!_[_0x250d('0x40')](_0xd7cadb)){loggerPredictive[_0x250d('0x73')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xd7cadb[_0x250d('0x67')]);loggerPredictive[_0x250d('0x73')](_0x250d('0x74'),_0xd7cadb[_0x250d('0x61')]);loggerPredictive['info'](_0x250d('0x75'),_0xd7cadb[_0x250d('0x65')]);loggerPredictive[_0x250d('0x73')](_0x250d('0x76'),_0xd7cadb[_0x250d('0x64')]);loggerPredictive[_0x250d('0x73')](_0x250d('0x77'),_0xd7cadb[_0x250d('0x62')]);loggerPredictive[_0x250d('0x73')](_0x250d('0x78'),_0xd7cadb[_0x250d('0x63')]);loggerPredictive[_0x250d('0x73')](_0x250d('0x79'));if(_0xd7cadb[_0x250d('0x67')]>0x0){if(!_[_0x250d('0x37')](_0xd7cadb[_0x250d('0x63')])&&_0xd7cadb[_0x250d('0x63')]>0x0){return!![];}else{loggerPredictive[_0x250d('0x73')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0x250d('0x37')](_0xd7cadb[_0x250d('0x62')])&&_0xd7cadb[_0x250d('0x62')]>0x0){return!![];}else{loggerPredictive[_0x250d('0x73')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x250d('0x73')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x250d('0x73')](_0x250d('0x7a'));}}else{loggerPredictive[_0x250d('0x73')](_0x250d('0x7a'));}return![];}function mergeDataErlangB(_0x151560){return function(_0x5f597f){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x250d('0x7b'),_0x5f597f[_0x250d('0x7c')]);loggerPredictive[_0x250d('0x73')](_0x250d('0x7d'),_0x5f597f['erlangCallToSecond']);loggerPredictive[_0x250d('0x73')](_0x250d('0x7e'),_0x5f597f[_0x250d('0x68')]);loggerPredictive['info'](_0x250d('0x7f'),_0x5f597f[_0x250d('0x69')]);loggerPredictive['info'](_0x250d('0x7e'),_0x5f597f[_0x250d('0x68')]);loggerPredictive[_0x250d('0x73')](_0x250d('0x79'));_['merge'](_0x151560,_0x5f597f);};}function getDiff(_0x421ff6){var _0x3f0c8a=moment()[_0x250d('0x42')](0x0);var _0x431350=moment(_0x421ff6)[_0x250d('0x42')](0x0);return _0x3f0c8a[_0x250d('0x43')](_0x431350,_0x250d('0x44'));}function ifInterval(_0x11a58b,_0x52e3b1){if(_['isUndefined'](_0x52e3b1)){return![];}if(getDiff(_0x52e3b1)<_0x11a58b*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0xbbf07a){if(isNotNull(_0xbbf07a)){if(!_['isUndefined'](_0xbbf07a['startProgressive'])){_0xbbf07a['startProgressive']=undefined;loggerPredictive[_0x250d('0x73')](_0xbbf07a[_0x250d('0x3a')],_0x250d('0x80'));}if(!_['isUndefined'](_0xbbf07a[_0x250d('0x21')])){_0xbbf07a['startPredictive']=undefined;loggerPredictive[_0x250d('0x73')](_0xbbf07a[_0x250d('0x3a')],_0x250d('0x81'));}if(!_[_0x250d('0x37')](_0xbbf07a[_0x250d('0x82')])){clearInterval(_0xbbf07a[_0x250d('0x82')]);_0xbbf07a[_0x250d('0x82')]=undefined;loggerPredictive[_0x250d('0x73')](_0xbbf07a['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x3acb76,_0x501808){if(_0x501808===0x0){return 0x0;}var _0x24b5eb=0x1;for(var _0xb04fb9=0x1;_0xb04fb9<=_0x501808;_0xb04fb9+=0x1){_0x24b5eb=0x1+_0x24b5eb*_0xb04fb9/_0x3acb76;}return 0x1/_0x24b5eb;}function isVoiceQueueOutbound(_0xc7c2e4){return _0xc7c2e4===_0x250d('0x47');}function isNotPreview(_0x2394ee){return _0x2394ee!==_0x250d('0x17');}function isCampaignIvr(_0x430283){return _0x430283===_0x250d('0x83');}function getCallerId(_0x553258,_0x5993f8,_0x1c91ac){if(!_['isUndefined'](_0x1c91ac)&&_0x250d('0x84')===typeof _0x1c91ac&&!_[_0x250d('0x40')](_0x1c91ac)){if(!_[_0x250d('0x37')](_0x5993f8)&&_0x250d('0x84')===typeof _0x5993f8&&!_['isEmpty'](_0x5993f8)){return util['format']('\x22%s\x22\x20<%s>',_0x5993f8,_0x1c91ac);}return util[_0x250d('0x6e')](_0x250d('0x85'),_0x1c91ac,_0x1c91ac);}if(!_[_0x250d('0x37')](_0x553258)&&_0x250d('0x84')===typeof _0x553258&&!_['isEmpty'](_0x553258)){return _0x553258;}return _0x250d('0x86');}function loggerCatchQueueSummary(_0x471af9,_0x420053){return function(_0x2e1583){freeVariablesPredictive(_0x420053);emitVoiceQueueSummary(_0x420053);emitCampaignSummary(_0x420053);loggerSyncQueueSummary[_0x250d('0x87')](_0x471af9,util[_0x250d('0x88')](_0x2e1583,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5e382f,_0x1a70bb){return function(_0x1e20de){loggerPredictive[_0x250d('0x87')](_0x1a70bb[_0x250d('0x3a')],_0x5e382f);loggerPredictive[_0x250d('0x87')](_0x1e20de[_0x250d('0x89')]);freeVariablesPredictive(_0x1a70bb);};}function loggerCatch(_0xf2e4f1){return function(_0x152ec4){logger[_0x250d('0x87')](_0xf2e4f1,util['inspect'](_0x152ec4,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3573de){return _0x3573de&&!_[_0x250d('0x37')](_0x3573de)&&_0x3573de['length']>0x0;}function decremetOriginate(_0x2730ea){if(!_[_0x250d('0x37')](_0x2730ea)&&_0x2730ea!==null){if(_0x2730ea[_0x250d('0x8a')]('originated')){if(_0x2730ea[_0x250d('0x8b')]>0x0){_0x2730ea[_0x250d('0x8b')]-=0x1;}else{logger[_0x250d('0x87')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x250d('0x87')](_0x250d('0x8c'));}}function checkContactLowerLimitOriginate(_0x10ef67,_0x4bb6f1,_0x42d46f){if(_0x4bb6f1>_0x42d46f){for(var _0x81c2b8=0x0;_0x81c2b8<_0x4bb6f1-_0x42d46f;_0x81c2b8+=0x1){decremetOriginate(_0x10ef67);}}}function loggerGetContactDialer(_0xf14fae,_0x17caf9,_0x4ee300){return function(_0x55213c){checkContactLowerLimitOriginate(_0x17caf9,_0x4ee300,0x0);logger[_0x250d('0x87')](_0xf14fae,util[_0x250d('0x88')](_0x55213c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x89ed80){return function(_0x516581){if(isNotNull(_0x516581)&&isNotNull(_0x516581[0x0])){if(_0x516581[0x0][_0x250d('0x8d')]>0x0){_0x89ed80[_0x250d('0x38')]=_0x250d('0x8e');logger[_0x250d('0x73')](_0x250d('0x8f')+_0x89ed80['name'],_0x516581[0x0][_0x250d('0x8d')],_0x250d('0x90'));}else{_0x89ed80[_0x250d('0x38')]=_0x250d('0x91');logger['info'](_0x250d('0x92')+_0x89ed80[_0x250d('0x3a')]);}}};}function notSendMessagesQueue(_0x56be37){if(_0x56be37[_0x250d('0x93')]){freeVariablesPredictive(_0x56be37);if(_0x56be37['originated']===0x0&&_0x56be37[_0x250d('0x4d')]===0x0&&_0x56be37[_0x250d('0x51')]===0x0&&(_0x56be37[_0x250d('0x4b')]||0x0)===0x0){_0x56be37['sendMessageOneNotActive']=![];_0x56be37[_0x250d('0x49')]=0x0;_0x56be37[_0x250d('0x38')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x250d('0x87')](_0x250d('0x94'),_0x56be37[_0x250d('0x3a')],'is\x20not\x20active');}else{_0x56be37[_0x250d('0x38')]=_0x250d('0x95');loggerSyncQueueSummary[_0x250d('0x87')](_0x250d('0x94'),_0x56be37[_0x250d('0x3a')],_0x250d('0x96'));}emitVoiceQueueSummary(_0x56be37);}}function notSendMessagesCampaign(_0x36fece){if(_0x36fece['sendMessageOneNotActive']){if(_0x36fece[_0x250d('0x8b')]===0x0){_0x36fece[_0x250d('0x93')]=![];_0x36fece[_0x250d('0x38')]=_0x250d('0x97');loggerSyncQueueSummary[_0x250d('0x87')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x36fece[_0x250d('0x3a')],_0x250d('0x98'));}else{_0x36fece[_0x250d('0x38')]=_0x250d('0x95');loggerSyncQueueSummary[_0x250d('0x87')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x36fece['name'],_0x250d('0x96'));}emitCampaignSummary(_0x36fece);}}function createObjHistory(_0x195e05,_0x5c8afe,_0x129fea,_0x186f75,_0x4ed1fb){_0x195e05[_0x250d('0x38')]=_0x129fea;var _0x28940d=new Action(_0x195e05,_0x5c8afe);var _0x37f34e=new History(_0x28940d);_0x37f34e[_0x250d('0x99')]=_0x186f75;_0x37f34e[_0x250d('0x9a')]=_0x4ed1fb;_0x37f34e[_0x250d('0x9b')]=_0x28940d[_0x250d('0x9c')];return _0x37f34e;}Dialer[_0x250d('0x15')][_0x250d('0x36')]=function(){var _0x27035d=this;setInterval(function(){_0x27035d[_0x250d('0x9d')](_0x27035d[_0x250d('0x1f')],_0x250d('0x9e'));_0x27035d[_0x250d('0x9d')](_0x27035d[_0x250d('0x1e')],'[actions]');},0x32c8);};Dialer[_0x250d('0x15')][_0x250d('0x9d')]=function(_0x1c5167,_0x2c4dfa){var _0x39cfa2=this;for(var _0x2f038e in _0x1c5167){if(_0x1c5167['hasOwnProperty'](_0x2f038e)){this[_0x250d('0x9f')]['enqueue'](function(){if(!_[_0x250d('0xa0')](_0x1c5167[_0x2f038e])){return ami[_0x250d('0xa1')]({'action':_0x250d('0xa2'),'channel':_0x1c5167[_0x2f038e][_0x250d('0xa3')]})[_0x250d('0xa4')](function(_0x37c727){if(_0x37c727[_0x250d('0x38')]===_0x250d('0xa5')){setTimeout(function(){if(_0x1c5167[_0x2f038e]&&_0x1c5167[_0x2f038e][_0x250d('0x46')]!=='ivr'){_0x39cfa2['updateOriginated'](_0x39cfa2[_0x250d('0x18')][_0x1c5167[_0x2f038e][_0x250d('0xa6')]]);logger[_0x250d('0x87')](_0x250d('0xa7'),_0x2c4dfa,_0x2f038e,_0x1c5167[_0x2f038e]['queue']);delete _0x1c5167[_0x2f038e];}if(_0x1c5167[_0x2f038e]&&_0x1c5167[_0x2f038e][_0x250d('0x46')]===_0x250d('0x83')){_0x39cfa2[_0x250d('0xa8')](_0x39cfa2['campaigns'][_0x1c5167[_0x2f038e]['queue']]);logger['error'](_0x250d('0xa9'),_0x2c4dfa,_0x2f038e,_0x1c5167[_0x2f038e]['queue']);delete _0x1c5167[_0x2f038e];}},0x2328);}});}});}}};Dialer[_0x250d('0x15')]['countReScheduled']=function(_0x431e8d){return BPromise[_0x250d('0xaa')]()[_0x250d('0xab')](cmHopper[_0x250d('0xac')](_0x431e8d))[_0x250d('0xa4')](loggerCatch(_0x250d('0xad')));};Dialer[_0x250d('0x15')][_0x250d('0xae')]=function(_0x380d4b){return BPromise[_0x250d('0xaa')]()[_0x250d('0xab')](cmHopperBlack[_0x250d('0xae')](_0x380d4b))['catch'](loggerCatch(_0x250d('0xaf')));};Dialer[_0x250d('0x15')][_0x250d('0xb0')]=function(_0x51f9fa){return BPromise[_0x250d('0xaa')]()[_0x250d('0xab')](cmHopperBlack[_0x250d('0xb0')](_0x51f9fa))['catch'](loggerCatch(_0x250d('0xb1')));};Dialer[_0x250d('0x15')]['averageHandleTime']=function(_0x4fe1ab){return BPromise['resolve']()[_0x250d('0xab')](cmHopperHistory[_0x250d('0xb2')](_0x4fe1ab))[_0x250d('0xa4')](loggerCatch(_0x250d('0xb3')));};Dialer['prototype']['rescheduleContact']=function(_0x4de53c){return BPromise[_0x250d('0xaa')]()['then'](cmHopper['rescheduleContact'](_0x4de53c))[_0x250d('0xa4')](loggerCatch(_0x250d('0xb4')));};Dialer[_0x250d('0x15')]['unlockContact']=function(_0x3c7e0d,_0x1d8d94,_0x1caa02){return BPromise['resolve']()[_0x250d('0xab')](cmHopper[_0x250d('0xb5')](_0x3c7e0d,_0x1d8d94,_0x1caa02))['catch'](loggerCatch(_0x250d('0xb6')));};Dialer[_0x250d('0x15')]['getContactDialer']=function(_0x32e466,_0x4fdd45,_0x3b1f82,_0x4e64a9){return BPromise[_0x250d('0xaa')]()[_0x250d('0xab')](cmHopper[_0x250d('0xb7')](_0x32e466,_0x4fdd45,_0x3b1f82,_0x4e64a9))['catch'](loggerCatch(_0x250d('0xb8')));};Dialer[_0x250d('0x15')][_0x250d('0xb9')]=function(_0x2d3a05,_0x35fa5c,_0x2e2bdb){return BPromise['resolve']()[_0x250d('0xab')](cmHopper[_0x250d('0xb9')](_0x2d3a05,_0x35fa5c,_0x2e2bdb))[_0x250d('0xa4')](loggerCatch(_0x250d('0xb8')));};Dialer[_0x250d('0x15')][_0x250d('0xba')]=function(_0x461f6b){return BPromise['resolve']()[_0x250d('0xab')](voiceQueueRt[_0x250d('0xba')](_0x461f6b))[_0x250d('0xa4')](loggerCatch(_0x250d('0xbb')));};Dialer[_0x250d('0x15')][_0x250d('0xbc')]=function(_0x1ac68a){return BPromise[_0x250d('0xaa')]()['then'](cmHopper['moveContactManagedDialer'](_0x1ac68a))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x250d('0x15')][_0x250d('0xbd')]=function(_0x1cc986){return BPromise[_0x250d('0xaa')]()[_0x250d('0xab')](cmHopperHistory[_0x250d('0xbd')](_0x1cc986))['catch'](loggerCatch(_0x250d('0xbe')));};Dialer[_0x250d('0x15')][_0x250d('0xa8')]=function(_0x38c27a){if(!_[_0x250d('0x37')](_0x38c27a)&&_0x38c27a!==null){if(_0x38c27a[_0x250d('0x8a')](_0x250d('0x8b'))){if(_0x38c27a[_0x250d('0x8b')]>0x0){_0x38c27a['originated']-=0x1;}else{logger[_0x250d('0x87')](_0x250d('0xbf'));}}}else{logger[_0x250d('0x87')](_0x250d('0xc0'));}};Dialer[_0x250d('0x15')]['loggerHandler']=function(_0x54134a,_0xf11c11){var _0x4ab5ab=this;return function(_0xc61285){_0x4ab5ab[_0x250d('0xa8')](_0xf11c11);logger[_0x250d('0x87')](_0x54134a,util[_0x250d('0x88')](_0xc61285,{'showHidden':![],'depth':null}));};};Dialer[_0x250d('0x15')][_0x250d('0xc1')]=function(_0x98f638,_0xab0f98,_0x4ab909){var _0x414089={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0xab0f98);this[_0x250d('0xc2')](_['merge'](_0x414089,_[_0x250d('0xc3')](_0x4ab909,['ContactId',_0x250d('0xc4'),_0x250d('0xc5'),'VoiceQueueId','CampaignId'])),'[emptyContact][createHistory]',_0x250d('0xc6'));logger[_0x250d('0x87')](_0x98f638);};Dialer[_0x250d('0x15')][_0x250d('0xc7')]=function(_0x7fdaf9){return _0x7fdaf9===_0x250d('0xc8');};Dialer['prototype']['isTrunkReachable']=function(_0x316f94){return!_['isUndefined'](_0x316f94)&&_0x316f94&&!_[_0x250d('0x37')](_0x316f94[_0x250d('0x3a')])&&!_['isUndefined'](_0x316f94[_0x250d('0x6b')])&&_0x316f94['active']&&(this[_0x250d('0x1b')][util[_0x250d('0x6e')](_0x250d('0xc9'),_0x316f94[_0x250d('0x3a')])][_0x250d('0xa2')]===_0x250d('0xca')||this['trunks'][util[_0x250d('0x6e')](_0x250d('0xc9'),_0x316f94['name'])][_0x250d('0xa2')]===_0x250d('0xcb'));};Dialer[_0x250d('0x15')][_0x250d('0xc2')]=function(_0x3ea0f0,_0x31d079,_0x8fd218){this[_0x250d('0xbd')](_0x3ea0f0)[_0x250d('0xa4')](loggerCatch(_0x31d079));this['moveContactManagedDialer'](_0x3ea0f0)[_0x250d('0xa4')](loggerCatch(_0x8fd218));};Dialer[_0x250d('0x15')][_0x250d('0x31')]=function(_0x1acd8b){var _0x3c2a45=this[_0x250d('0x1f')][_0x1acd8b[_0x250d('0xcc')]];var _0x1e8059;if(!_['isNil'](_0x1acd8b)&&!_[_0x250d('0xa0')](_0x1acd8b[_0x250d('0xcd')])&&!_[_0x250d('0xa0')](_0x1acd8b[_0x250d('0xcd')]['amdstatus'])&&_0x1acd8b[_0x250d('0xce')]==='xcally-motion-dialer'&&_0x3c2a45){if(_0x3c2a45[_0x250d('0x46')]!==_0x250d('0x83')&&this['voiceQueues'][_0x3c2a45['queue']][_0x250d('0xcf')]&&_0x1acd8b[_0x250d('0xd0')]===_0x250d('0xd1')){delete this[_0x250d('0x1f')][_0x1acd8b[_0x250d('0xcc')]];this[_0x250d('0xa8')](this[_0x250d('0x18')][_0x3c2a45[_0x250d('0xa6')]]);this[_0x250d('0x18')][_0x3c2a45[_0x250d('0xa6')]][_0x250d('0x59')]+=0x1;this[_0x250d('0x18')][_0x3c2a45['queue']][_0x250d('0x58')]+=0x1;_0x1e8059=new Hangup(_0x3c2a45,_0x1acd8b);_0x1e8059['state']=0x12;_0x1e8059[_0x250d('0x9a')]=_0x250d('0xd2');_0x1e8059['membername']='AMD';this[_0x250d('0xc2')](_0x1e8059,'[syncHangupInAMD][createHistory]',_0x250d('0xd3'));}if(_0x3c2a45['type']!==_0x250d('0x83')&&this[_0x250d('0x18')][_0x3c2a45[_0x250d('0xa6')]]['dialAMDActive']&&_0x1acd8b['value']===_0x250d('0xd4')){var _0x5f11e4=this;return new BPromise(function(_0x278780,_0xcb0f33){delete _0x5f11e4[_0x250d('0x1f')][_0x1acd8b[_0x250d('0xcc')]];_0x5f11e4[_0x250d('0xa8')](_0x5f11e4[_0x250d('0x18')][_0x3c2a45[_0x250d('0xa6')]]);_0x5f11e4['voiceQueues'][_0x3c2a45[_0x250d('0xa6')]][_0x250d('0x59')]+=0x1;_0x5f11e4[_0x250d('0x18')][_0x3c2a45[_0x250d('0xa6')]][_0x250d('0x58')]+=0x1;var _0x36faa1=_0x5f11e4['voiceQueues'][_0x3c2a45[_0x250d('0xa6')]];var _0x1979b0=new Hangup(_0x3c2a45,_0x1acd8b);_0x1979b0[_0x250d('0x99')]=0x13;_0x1979b0['statedesc']='Machine';_0x1979b0['membername']=_0x250d('0xd5');_0x1979b0[_0x250d('0xd6')]+=0x1;_0x1979b0[_0x250d('0xd7')]+=0x1;_0x1979b0[_0x250d('0xd8')]=!![];_0x5f11e4['createHistory'](_0x1979b0)[_0x250d('0xa4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1979b0[_0x250d('0xd9')]+_0x1979b0['countcongestionretry']+_0x1979b0[_0x250d('0xda')]+_0x1979b0[_0x250d('0xdb')]+_0x1979b0[_0x250d('0xdc')]+_0x1979b0[_0x250d('0xdd')]+_0x1979b0[_0x250d('0xd6')]+_0x1979b0[_0x250d('0xde')]>=_0x36faa1[_0x250d('0xdf')]){_0x5f11e4[_0x250d('0xe0')](_0x1979b0,_0x278780,_0xcb0f33,_0x250d('0xe1'));}else{if(_0x1979b0[_0x250d('0xd6')]>=_0x36faa1[_0x250d('0xe2')]){_0x5f11e4['createStateFinal'](_0x1979b0,_0x278780,_0xcb0f33,_0x250d('0xe3'));}else{_0x5f11e4['rescheduleContact']({'active':![],'countmachineretry':_0x1979b0['countmachineretry'],'scheduledat':moment()[_0x250d('0xe4')](_0x36faa1[_0x250d('0xe5')],_0x250d('0xe6'))[_0x250d('0x6e')](_0x250d('0xe7')),'ContactId':_0x1979b0[_0x250d('0xe8')],'ListId':_0x1979b0['ListId'],'VoiceQueueId':_0x1979b0[_0x250d('0xe9')]||undefined,'CampaignId':_0x1979b0[_0x250d('0xea')]||undefined})[_0x250d('0xa4')](loggerCatch(_0x250d('0xeb')));_0x278780({'reschedule':0x1});}}});}if(_0x3c2a45[_0x250d('0x46')]===_0x250d('0x83')&&this[_0x250d('0x19')][_0x3c2a45[_0x250d('0xa6')]][_0x250d('0xcf')]&&_0x1acd8b['value']===_0x250d('0xd1')){delete this[_0x250d('0x1f')][_0x1acd8b[_0x250d('0xcc')]];this[_0x250d('0xa8')](this[_0x250d('0x19')][_0x3c2a45['queue']]);_0x1e8059=new Hangup(_0x3c2a45,_0x1acd8b);_0x1e8059[_0x250d('0x99')]=0x12;_0x1e8059['statedesc']=_0x250d('0xd2');_0x1e8059[_0x250d('0xec')]=_0x250d('0xd5');this[_0x250d('0xc2')](_0x1e8059,_0x250d('0xed'),_0x250d('0xee'));}if(_0x3c2a45['type']==='ivr'&&this[_0x250d('0x19')][_0x3c2a45['queue']][_0x250d('0xcf')]&&_0x1acd8b[_0x250d('0xd0')]===_0x250d('0xd4')){var _0x5f11e4=this;return new BPromise(function(_0x65685,_0x534b7a){delete _0x5f11e4[_0x250d('0x1f')][_0x1acd8b[_0x250d('0xcc')]];_0x5f11e4[_0x250d('0xa8')](_0x5f11e4[_0x250d('0x19')][_0x3c2a45[_0x250d('0xa6')]]);_0x5f11e4['campaigns'][_0x3c2a45[_0x250d('0xa6')]][_0x250d('0x59')]+=0x1;_0x5f11e4[_0x250d('0x19')][_0x3c2a45[_0x250d('0xa6')]][_0x250d('0x58')]+=0x1;var _0x46f93b=_0x5f11e4[_0x250d('0x19')][_0x3c2a45[_0x250d('0xa6')]];var _0x123c0e=new Hangup(_0x3c2a45,_0x1acd8b);_0x123c0e[_0x250d('0x99')]=0x13;_0x123c0e['statedesc']='Machine';_0x123c0e[_0x250d('0xec')]=_0x250d('0xd5');_0x123c0e[_0x250d('0xd6')]+=0x1;_0x123c0e[_0x250d('0xd7')]+=0x1;_0x123c0e['amd']=!![];_0x5f11e4[_0x250d('0xbd')](_0x123c0e)[_0x250d('0xa4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x123c0e[_0x250d('0xd9')]+_0x123c0e[_0x250d('0xef')]+_0x123c0e['countnoanswerretry']+_0x123c0e['countnosuchnumberretry']+_0x123c0e['countdropretry']+_0x123c0e[_0x250d('0xdd')]+_0x123c0e[_0x250d('0xd6')]+_0x123c0e['countagentrejectretry']>=_0x46f93b[_0x250d('0xdf')]){_0x5f11e4[_0x250d('0xe0')](_0x123c0e,_0x65685,_0x534b7a,'reason19\x20machine....');}else{if(_0x123c0e[_0x250d('0xd6')]>=_0x46f93b[_0x250d('0xe2')]){_0x5f11e4['createStateFinal'](_0x123c0e,_0x65685,_0x534b7a,_0x250d('0xe3'));}else{_0x5f11e4[_0x250d('0xf0')]({'active':![],'countmachineretry':_0x123c0e[_0x250d('0xd6')],'scheduledat':moment()[_0x250d('0xe4')](_0x46f93b[_0x250d('0xe5')],_0x250d('0xe6'))[_0x250d('0x6e')](_0x250d('0xe7')),'ContactId':_0x123c0e[_0x250d('0xe8')],'ListId':_0x123c0e[_0x250d('0xc4')],'VoiceQueueId':_0x123c0e[_0x250d('0xe9')]||undefined,'CampaignId':_0x123c0e['CampaignId']||undefined})[_0x250d('0xa4')](loggerCatch('[rescheduleContact][Machine]'));_0x65685({'reschedule':0x1});}}});}}};Dialer[_0x250d('0x15')][_0x250d('0x2d')]=function(_0x3a34b4){var _0x327ee0=this['uniqueId'][_0x3a34b4['uniqueid']];var _0x544713=this;var _0x15417b;if(_0x327ee0&&_0x327ee0['type']==='ivr'){delete this[_0x250d('0x1f')][_0x3a34b4[_0x250d('0xcc')]];this[_0x250d('0xa8')](this[_0x250d('0x19')][_0x327ee0[_0x250d('0xa6')]]);this[_0x250d('0x19')][_0x327ee0[_0x250d('0xa6')]][_0x250d('0xf1')]+=0x1;_0x15417b=new Hangup(_0x327ee0,_0x3a34b4);this[_0x250d('0xbd')](_0x15417b)[_0x250d('0xa4')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x250d('0xbc')](_0x15417b)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x327ee0&&_0x327ee0[_0x250d('0x46')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x327ee0['queue']][_0x250d('0xf2')])){delete this['uniqueId'][_0x3a34b4[_0x250d('0xcc')]];this[_0x250d('0xa8')](this[_0x250d('0x18')][_0x327ee0[_0x250d('0xa6')]]);this[_0x250d('0x18')][_0x327ee0[_0x250d('0xa6')]]['outboundAnswerCallsDay']+=0x1;this[_0x250d('0x18')][_0x327ee0['queue']][_0x250d('0x58')]+=0x1;_0x15417b=new Hangup(_0x327ee0,_0x3a34b4);_0x15417b[_0x250d('0x99')]=0x10;_0x15417b['statedesc']=_0x250d('0xf3');_0x15417b[_0x250d('0xec')]=_0x250d('0xf4');this[_0x250d('0xbd')](_0x15417b)[_0x250d('0xa4')](loggerCatch(_0x250d('0xf5')));this['moveContactManagedDialer'](_0x15417b)[_0x250d('0xa4')](loggerCatch(_0x250d('0xf6')));}if(_0x327ee0&&_0x327ee0[_0x250d('0x46')]!=='ivr'&&!isNotNull(this[_0x250d('0x18')][_0x327ee0[_0x250d('0xa6')]][_0x250d('0xf2')])){delete this['uniqueId'][_0x3a34b4[_0x250d('0xcc')]];this[_0x250d('0xa8')](this['voiceQueues'][_0x327ee0[_0x250d('0xa6')]]);this[_0x250d('0x18')][_0x327ee0[_0x250d('0xa6')]]['outboundUnknownCallsDay']+=0x1;_0x15417b=new Hangup(_0x327ee0,_0x3a34b4);_0x15417b[_0x250d('0x99')]=0xc;_0x15417b[_0x250d('0x9a')]=_0x3a34b4[_0x250d('0xf7')];_0x15417b[_0x250d('0xec')]=_0x250d('0xf8');this[_0x250d('0xbd')](_0x15417b)[_0x250d('0xa4')](loggerCatch(_0x250d('0xf5')));this[_0x250d('0xbc')](_0x15417b)[_0x250d('0xa4')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x250d('0x15')][_0x250d('0xf9')]=function(_0x29a88c){var _0x31559c=this[_0x250d('0x1f')][_0x29a88c[_0x250d('0xcc')]];var _0x260f42=this;if(this[_0x250d('0x18')][_0x29a88c[_0x250d('0xa6')]]){if(_0x31559c&&_0x31559c[_0x250d('0x46')]!=='ivr'){delete this[_0x250d('0x1f')][_0x29a88c[_0x250d('0xcc')]];this[_0x250d('0x18')][_0x29a88c['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3e7386=new AgentComplete(_0x31559c,_0x29a88c);if(_0x29a88c['reason']===_0x250d('0xfa')){_0x3e7386[_0x250d('0xfb')]=this[_0x250d('0x18')][_0x29a88c[_0x250d('0xa6')]]['dialQueueProject2']&&this[_0x250d('0x18')][_0x29a88c[_0x250d('0xa6')]][_0x250d('0xfc')]?moment()[_0x250d('0x6e')](_0x250d('0xe7')):undefined;}this[_0x250d('0xbd')](_0x3e7386)[_0x250d('0xa4')](loggerCatch(_0x250d('0xfd')));this['moveContactManagedDialer'](_0x3e7386)[_0x250d('0xa4')](loggerCatch(_0x250d('0xfe')));}}};Dialer[_0x250d('0x15')][_0x250d('0xff')]=function(_0x17d5dd){if(this[_0x250d('0x18')][_0x17d5dd[_0x250d('0xa6')]]){if(this[_0x250d('0x1f')][_0x17d5dd['uniqueid']]&&this[_0x250d('0x1f')][_0x17d5dd[_0x250d('0xcc')]][_0x250d('0x46')]!==_0x250d('0x83')){this[_0x250d('0xa8')](this[_0x250d('0x18')][_0x17d5dd[_0x250d('0xa6')]]);this[_0x250d('0x1f')][_0x17d5dd[_0x250d('0xcc')]][_0x250d('0x100')]=moment()[_0x250d('0x6e')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x250d('0x15')][_0x250d('0x101')]=function(_0x1aa4d1){this['createHistory'](_0x1aa4d1)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x250d('0xbc')](_0x1aa4d1)[_0x250d('0xa4')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype'][_0x250d('0x29')]=function(_0x225570){var _0xe2a230=this[_0x250d('0x1f')][_0x225570[_0x250d('0xcc')]];var _0x261fe3=this;if(this['voiceQueues'][_0x225570[_0x250d('0xa6')]]){if(_0xe2a230&&_0xe2a230[_0x250d('0x46')]!==_0x250d('0x83')){delete this['uniqueId'][_0x225570[_0x250d('0xcc')]];this[_0x250d('0xa8')](this[_0x250d('0x18')][_0x225570[_0x250d('0xa6')]]);_0xe2a230['droptime']=moment()[_0x250d('0x6e')](_0x250d('0xe7'));var _0x31ea89=new QueueCallerAbandon(_0xe2a230,_0x225570);if(getSeconds(_0xe2a230[_0x250d('0x102')],_0xe2a230[_0x250d('0x103')])>=_0xe2a230[_0x250d('0x104')]){this[_0x250d('0x18')][_0x225570[_0x250d('0xa6')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x225570[_0x250d('0xa6')]][_0x250d('0x5e')]+=0x1;this[_0x250d('0x18')][_0x225570[_0x250d('0xa6')]][_0x250d('0x105')]+=0x1;_0x31ea89['state']=0xa;_0x31ea89[_0x250d('0x9a')]=_0x250d('0x106');_0x31ea89[_0x250d('0x107')]=_0x250d('0x108');_0x31ea89[_0x250d('0xfb')]=this[_0x250d('0x18')][_0x225570['queue']][_0x250d('0x109')]?moment()[_0x250d('0x6e')](_0x250d('0xe7')):undefined;_0x31ea89[_0x250d('0xdc')]+=0x1;_0x31ea89[_0x250d('0xd7')]+=0x1;if(_0x31ea89['countdropretry']>=this[_0x250d('0x18')][_0x225570['queue']]['dialDropMaxRetry']){this[_0x250d('0x101')](_0x31ea89);}else{this[_0x250d('0xf0')]({'active':![],'countdropretry':_0x31ea89[_0x250d('0xdc')],'scheduledat':moment()[_0x250d('0xe4')](this[_0x250d('0x18')][_0x225570[_0x250d('0xa6')]][_0x250d('0x10a')],_0x250d('0xe6'))[_0x250d('0x6e')](_0x250d('0xe7')),'ContactId':_0xe2a230[_0x250d('0xe8')],'ListId':_0xe2a230[_0x250d('0xc4')],'VoiceQueueId':_0xe2a230[_0x250d('0xe9')]||undefined,'CampaignId':_0xe2a230[_0x250d('0xea')]||undefined})[_0x250d('0xa4')](loggerCatch('[rescheduleContact][Drop]'));var _0x5d70e5=new History(_0x31ea89);_0x5d70e5[_0x250d('0x99')]=0xa;_0x5d70e5['statedesc']=_0x250d('0x106');_0x5d70e5[_0x250d('0x9c')]=moment()[_0x250d('0x6e')](_0x250d('0xe7'));_0x5d70e5[_0x250d('0x9b')]=_0x5d70e5[_0x250d('0x9c')];_0x5d70e5[_0x250d('0x10b')]=_0x31ea89[_0x250d('0x10b')];_0x5d70e5[_0x250d('0x10c')]=_0x31ea89[_0x250d('0x10c')];this[_0x250d('0xbd')](_0x5d70e5)[_0x250d('0xa4')](loggerCatch(_0x250d('0x10d')));}}else{this[_0x250d('0x18')][_0x225570['queue']][_0x250d('0x64')]+=0x1;this[_0x250d('0x18')][_0x225570[_0x250d('0xa6')]][_0x250d('0x5d')]+=0x1;_0x31ea89[_0x250d('0x99')]=0xb;_0x31ea89[_0x250d('0x9a')]='Abandoned';_0x31ea89[_0x250d('0x107')]=_0x250d('0x10e');_0x31ea89[_0x250d('0xdd')]+=0x1;_0x31ea89[_0x250d('0xd7')]+=0x1;if(_0x31ea89['countabandonedretry']>=this[_0x250d('0x18')][_0x225570['queue']][_0x250d('0x10f')]){this[_0x250d('0x101')](_0x31ea89);}else{this[_0x250d('0xf0')]({'active':![],'countabandonedretry':_0x31ea89['countabandonedretry'],'scheduledat':moment()[_0x250d('0xe4')](this[_0x250d('0x18')][_0x225570[_0x250d('0xa6')]]['dialAbandonedRetryFrequency'],_0x250d('0xe6'))[_0x250d('0x6e')](_0x250d('0xe7')),'ContactId':_0xe2a230['ContactId'],'ListId':_0xe2a230[_0x250d('0xc4')],'VoiceQueueId':_0xe2a230[_0x250d('0xe9')]||undefined,'CampaignId':_0xe2a230[_0x250d('0xea')]||undefined})['catch'](loggerCatch(_0x250d('0x110')));var _0x5d70e5=new History(_0x31ea89);_0x5d70e5['state']=0xb;_0x5d70e5['statedesc']=_0x250d('0x111');_0x5d70e5[_0x250d('0x9c')]=moment()[_0x250d('0x6e')](_0x250d('0xe7'));_0x5d70e5['endtime']=_0x5d70e5['starttime'];_0x5d70e5[_0x250d('0x10b')]=_0x31ea89[_0x250d('0x10b')];_0x5d70e5['calleridnum']=_0x31ea89[_0x250d('0x10c')];this[_0x250d('0xbd')](_0x5d70e5)[_0x250d('0xa4')](loggerCatch(_0x250d('0x112')));}}}}};Dialer[_0x250d('0x15')][_0x250d('0x2f')]=function(_0x4af600){if(this[_0x250d('0x1e')][_0x4af600[_0x250d('0xcc')]]){this[_0x250d('0x1e')][_0x4af600['uniqueid']]['channel']=_0x4af600[_0x250d('0xa3')];}if(this[_0x250d('0x1f')][_0x4af600[_0x250d('0xcc')]]){this[_0x250d('0x1f')][_0x4af600[_0x250d('0xcc')]][_0x250d('0xa3')]=_0x4af600[_0x250d('0xa3')];}};Dialer['prototype'][_0x250d('0x33')]=function(_0x3caaff){if(strategy[this[_0x250d('0x18')][this['actions'][_0x3caaff[_0x250d('0x113')]][_0x250d('0xa6')]]['strategy']]===_0x250d('0x14')){if(this[_0x250d('0x1e')][_0x3caaff[_0x250d('0x113')]]&&_[_0x250d('0xa0')](this[_0x250d('0x1e')][_0x3caaff['actionid']][_0x250d('0x114')])&&_0x3caaff[_0x250d('0xa2')]==='1'&&_0x3caaff[_0x250d('0x115')]==='0'){if(this[_0x250d('0x1a')][_0x3caaff['stateinterface']]){if(!this[_0x250d('0x1a')][_0x3caaff[_0x250d('0x116')]][_0x250d('0x114')]){this['agents'][_0x3caaff[_0x250d('0x116')]][_0x250d('0x114')]=!![];this[_0x250d('0x1e')][_0x3caaff[_0x250d('0x113')]][_0x250d('0x114')]=!![];this[_0x250d('0x1e')][_0x3caaff[_0x250d('0x113')]][_0x250d('0x116')]=_0x3caaff[_0x250d('0x116')];}}}}else if((strategy[this[_0x250d('0x18')][this[_0x250d('0x1e')][_0x3caaff[_0x250d('0x113')]][_0x250d('0xa6')]]['strategy']]||_0x250d('0x117'))===_0x250d('0x117')){if(this['actions'][_0x3caaff[_0x250d('0x113')]]){if(this[_0x250d('0x1a')][_0x3caaff[_0x250d('0x116')]]){this[_0x250d('0x1e')][_0x3caaff[_0x250d('0x113')]][_0x250d('0x116')]=_0x3caaff[_0x250d('0x116')];if(_['isNil'](this['queueBooked'][this[_0x250d('0x1e')][_0x3caaff[_0x250d('0x113')]][_0x250d('0xa6')]])){this[_0x250d('0x24')][this['actions'][_0x3caaff['actionid']][_0x250d('0xa6')]]=[];}this[_0x250d('0x24')][this['actions'][_0x3caaff[_0x250d('0x113')]]['queue']][_0x250d('0x118')](_['merge'](_['pick'](this[_0x250d('0x1e')][_0x3caaff[_0x250d('0x113')]],['idHopper',_0x250d('0x116')]),{'status':_0x3caaff[_0x250d('0xa2')],'paused':_0x3caaff[_0x250d('0x115')]}));}}}};function unlockQueueStatus(_0x5a88f4,_0xb6e011){setTimeout(function(){if(_['isUndefined'](_0x5a88f4['queueStatusComplete'])){loggerBooked[_0x250d('0x87')](_0x250d('0x119'),_0xb6e011);}_0x5a88f4[_0x250d('0x11a')]=!![];loggerBooked[_0x250d('0x73')]('[booked][unlockQueueStatus]',_0xb6e011,JSON[_0x250d('0x41')](_[_0x250d('0xc3')](_0x5a88f4,[_0x250d('0x3a'),_0x250d('0x11a')])));},0x1f3);}Dialer[_0x250d('0x15')]['syncQueueStatusComplete']=function(_0x1e974b){var _0x315591=this;var _0x574785=_0x315591['voiceQueues'][_0x315591[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0xa6')]];if(strategy[this[_0x250d('0x18')][this[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0xa6')]][_0x250d('0x48')]]==='roundrobin'){if(this[_0x250d('0x1e')][_0x1e974b['actionid']]&&this['actions'][_0x1e974b[_0x250d('0x113')]][_0x250d('0x116')]){this[_0x250d('0x17')][_0x250d('0x11b')](this[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0x11c')],this[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0x116')])['catch'](function(_0x16da63){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x250d('0x88')](_0x16da63,{'showHidden':![],'depth':null}));})['finally'](function(){_0x315591[_0x250d('0xa8')](_0x315591[_0x250d('0x18')][_0x315591[_0x250d('0x1e')][_0x1e974b['actionid']][_0x250d('0xa6')]]);_0x315591[_0x250d('0x1a')][_0x315591[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0x116')]][_0x250d('0x114')]=![];delete _0x315591[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]];unlockQueueStatus(_0x574785);});}else{this[_0x250d('0xa8')](this[_0x250d('0x18')][this[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0xa6')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0xe8')],'ListId':this['actions'][_0x1e974b[_0x250d('0x113')]][_0x250d('0xc4')],'VoiceQueueId':this['actions'][_0x1e974b['actionid']][_0x250d('0xe9')]||undefined,'CampaignId':this['actions'][_0x1e974b[_0x250d('0x113')]][_0x250d('0xea')]||undefined})[_0x250d('0xa4')](loggerCatch(_0x250d('0x11d')));delete this[_0x250d('0x1e')][_0x1e974b['actionid']];unlockQueueStatus(_0x574785);}}else if((strategy[this[_0x250d('0x18')][this[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0xa6')]][_0x250d('0x48')]]||_0x250d('0x117'))===_0x250d('0x117')){var _0x24e393;if(this[_0x250d('0x1e')][_0x1e974b['actionid']]&&!_[_0x250d('0x40')](this['queueBooked'][this[_0x250d('0x1e')][_0x1e974b['actionid']][_0x250d('0xa6')]])){if(this[_0x250d('0x25')][_0x315591[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0xa6')]]){this[_0x250d('0x25')][_0x315591[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]]['queue']]=this[_0x250d('0x25')][this[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0xa6')]]?this[_0x250d('0x25')][this['actions'][_0x1e974b[_0x250d('0x113')]]['queue']]:this['queueBooked'][this[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0xa6')]]?this['queueBooked'][this[_0x250d('0x1e')][_0x1e974b[_0x250d('0x113')]][_0x250d('0xa6')]][_0x250d('0x11e')]||0x0:0x0;}this[_0x250d('0x24')][this['actions'][_0x1e974b[_0x250d('0x113')]][_0x250d('0xa6')]][_0x250d('0x11e')]=this[_0x250d('0x25')][this[_0x250d('0x1e')][_0x1e974b['actionid']]['queue']];for(var _0x1ac90c=0x0;_0x1ac90c=0x0?!![]:![];})[_0x250d('0xa4')](myreject(_0x2e1114)));}}else{_0x1200f0[_0x250d('0x118')](ami[_0x250d('0xa1')]({'action':'command','command':util[_0x250d('0x6e')](_0x250d('0x136'),_0x126692,!_['isUndefined'](config[_0x250d('0x133')][_0xf0414f])?_0xf0414f:'')})['then'](function(_0x21ff95){return _0x21ff95[_0x250d('0x138')][_0x250d('0x13a')]('true')>=0x0?!![]:![];})[_0x250d('0xa4')](myreject(_0x2e1114)));}BPromise['all'](_0x1200f0)['then'](function(_0x25de60){var _0x343964=_[_0x250d('0x13b')](_0x25de60);if(_0x343964){return _0x1744ef(_0x343964);}else{_0xefef16[_0x250d('0x38')]=_0x20799d?'GLOBAL_INTERVAL_IS_OVERTIME':_0x250d('0x13c');return _0x2e1114(msgResponse(_0x250d('0x13d'),_0x250d('0x130'),_0x250d('0x13e')+_0x20799d+'\x20'+_0x1c12b7+_0x250d('0x13f')+util[_0x250d('0x88')](_0x126692,{'showHidden':![],'depth':null})+_0x250d('0x140')+_0xf0414f));}})[_0x250d('0xa4')](function(_0x20f3d1){return _0x2e1114(msgResponse(_0x250d('0x12e'),_0x250d('0x130'),JSON[_0x250d('0x41')](_0x20f3d1)));});});};Dialer['prototype'][_0x250d('0x141')]=function(_0x34d1b2){var _0x2acbb5=this;return function(){switch(_0x34d1b2['dialMethod']){case _0x250d('0x142'):freeVariablesPredictive(_0x34d1b2);_0x2acbb5[_0x250d('0x143')](_0x34d1b2,0x1);break;case'power':freeVariablesPredictive(_0x34d1b2);_0x2acbb5[_0x250d('0x143')](_0x34d1b2,_0x34d1b2[_0x250d('0x144')]);break;case _0x250d('0x145'):_0x2acbb5['predictive'](_0x34d1b2);break;case _0x250d('0x7'):freeVariablesPredictive(_0x34d1b2);_0x2acbb5['handlePower'](_0x34d1b2,0x1);break;default:freeVariablesPredictive(_0x34d1b2);logger['error'](_0x250d('0x146'),_0x34d1b2[_0x250d('0x3a')],_0x250d('0x147'));}};};Dialer[_0x250d('0x15')]['launchHandleIvr']=function(_0x5b5455){var _0x28ad91=this;return function(){_0x28ad91[_0x250d('0x148')](_0x5b5455);};};Dialer['prototype'][_0x250d('0x2c')]=function(_0x13657b){var _0x1c8806=this;if(isNotPreview(_0x13657b[_0x250d('0x54')])){if(isVoiceQueueOutbound(_0x13657b[_0x250d('0x46')])&&isActive(_0x13657b[_0x250d('0x53')])){_0x13657b[_0x250d('0x93')]=!![];BPromise[_0x250d('0xaa')]()['then'](checkIsLoggedIn(_0x13657b,_0x13657b[_0x250d('0x4a')]))[_0x250d('0xab')](checkIsActive(_0x13657b,_0x13657b[_0x250d('0x53')]))[_0x250d('0xab')](checkInterval(_0x13657b))[_0x250d('0xab')](_0x1c8806[_0x250d('0x128')](_0x13657b))[_0x250d('0xab')](_0x1c8806[_0x250d('0x12d')](_0x13657b[_0x250d('0x149')],_0x13657b[_0x250d('0x14a')],_0x13657b[_0x250d('0x3a')],_0x13657b))[_0x250d('0xab')](_0x1c8806[_0x250d('0x12f')](_0x13657b[_0x250d('0x3c')],_0x13657b[_0x250d('0x14a')],_0x13657b[_0x250d('0x3a')],_0x13657b))[_0x250d('0xab')](_0x1c8806['checkDialMethod'](_0x13657b))[_0x250d('0xa4')](loggerCatchQueueSummary('[syncQueueSummary]',_0x13657b));}else{notSendMessagesQueue(_0x13657b);}}else{freeVariablesPredictive(_0x13657b);}};Dialer['prototype'][_0x250d('0x127')]=function(){var _0x31928c=this;var _0xfdece8;for(var _0xad3f8 in this[_0x250d('0x19')]){if(this[_0x250d('0x19')][_0x250d('0x8a')](_0xad3f8)){_0xfdece8=this['campaigns'][_0xad3f8];if(isCampaignIvr(_0xfdece8[_0x250d('0x46')])&&isActive(_0xfdece8[_0x250d('0x6b')])){_0xfdece8[_0x250d('0x93')]=!![];BPromise['resolve']()['then'](checkIsActive(_0xfdece8,_0xfdece8['active']))[_0x250d('0xab')](checkInterval(_0xfdece8))[_0x250d('0xab')](_0x31928c['checkIsTrunkReachable'](_0xfdece8))[_0x250d('0xab')](_0x31928c[_0x250d('0x12d')](_0xfdece8[_0x250d('0x149')],_0xfdece8[_0x250d('0x14a')],_0xfdece8[_0x250d('0x3a')],_0xfdece8))[_0x250d('0xab')](_0x31928c[_0x250d('0x12f')](_0xfdece8[_0x250d('0x3c')],_0xfdece8[_0x250d('0x14a')],_0xfdece8[_0x250d('0x3a')],_0xfdece8))[_0x250d('0xab')](_0x31928c[_0x250d('0x14b')](_0xfdece8))[_0x250d('0xa4')](loggerCatchQueueSummary(_0x250d('0x14c'),_0xfdece8));}else{notSendMessagesCampaign(_0xfdece8);}}}};function getCallerIdRandom(_0x5d447d,_0x8fce2){var _0x11cdb3,_0x3ce48f,_0x1f05c9;if(_0x8fce2<=0x0){_0x8fce2=0x1;}_0x11cdb3=new RegExp('\x5cw{0,'+_0x8fce2+'}$');_0x3ce48f=Math[_0x250d('0x14d')](0xa,_0x8fce2-0x1);_0x1f05c9=Math[_0x250d('0x14d')](0xa,_0x8fce2)-0x1;return util[_0x250d('0x6e')]('%s',_[_0x250d('0x14e')](_0x5d447d,_0x11cdb3,_[_0x250d('0x14f')](_0x3ce48f,_0x1f05c9)));}function extractCalleridName(_0x4c08ae){var _0x39f98f=_0x4c08ae['match'](/"(.*?)"/);return _0x39f98f?_0x39f98f[0x1]:_0x4c08ae;}function extractCalleridNumber(_0x17e723){var _0x596711=_0x17e723[_0x250d('0x150')](/<(.*?)>/);return _0x596711?_0x596711[0x1]:_0x17e723;}Dialer[_0x250d('0x15')]['actionOriginate']=function(_0x1f8e6c,_0x20ec67){var _0x14d4aa=this;var _0x8ea9d2=uuid['v4']();this[_0x250d('0x1e')][_0x8ea9d2]=new Action(_0x1f8e6c,_0x20ec67,_0x8ea9d2);return new BPromise(function(_0x2ec028,_0x456c0d){if(_[_0x250d('0x37')](_0x1f8e6c)&&_0x250d('0x151')!==typeof _0x1f8e6c){return _0x456c0d(msgResponse(_0x250d('0x152'),_0x250d('0x130'),_0x250d('0x153')));}if(_[_0x250d('0x37')](_0x20ec67[_0x250d('0x154')]['phone'])||_0x20ec67[_0x250d('0x154')][_0x250d('0x155')]===null){return _0x456c0d(msgResponse(_0x250d('0x152'),_0x250d('0x130'),'contact\x20is\x20undefine'));}var _0x4a6003={'XMD-CALLERID':_0x14d4aa[_0x250d('0x1e')][_0x8ea9d2]['getCaller'](),'XMD-AGI':_0x1f8e6c[_0x250d('0xf2')]?util['format'](_0x250d('0x156'),ipAgi,_0x1f8e6c[_0x250d('0xf2')]):'NONE','XMD-AGIAFTER':_0x1f8e6c['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x1f8e6c[_0x250d('0x109')]):'NONE','XMD-QUEUE':_0x1f8e6c[_0x250d('0x46')]===_0x250d('0x47')?util[_0x250d('0x6e')](_0x250d('0x157'),_0x1f8e6c[_0x250d('0x3a')],_0x1f8e6c[_0x250d('0x158')]||'',_0x1f8e6c['dialAgiAfterHangupAgent']?'c':'',_0x1f8e6c[_0x250d('0x104')]||0x3):_0x250d('0x159'),'XMD-CONTACTID':_0x20ec67[_0x250d('0xe8')],'XMD-CDRTYPE':_0x250d('0x15a'),'CALLERID(all)':_0x14d4aa['actions'][_0x8ea9d2][_0x250d('0x15b')](),'XMD-AMD':_0x1f8e6c['dialAMDActive']?_0x250d('0x15c'):'NONE','XMD-DESTINATION':_0x250d('0x15d')};if(_0x1f8e6c[_0x250d('0xcf')]){_0x4a6003['XMD-AMDINITIALSILENCE']=_0x1f8e6c[_0x250d('0x15e')]||0x9c4;_0x4a6003[_0x250d('0x15f')]=_0x1f8e6c[_0x250d('0x160')]||0x5dc;_0x4a6003['XMD-AMDAFTERGREETINGSILENCE']=_0x1f8e6c[_0x250d('0x161')]||0x320;_0x4a6003[_0x250d('0x162')]=_0x1f8e6c[_0x250d('0x163')]||0x1388;_0x4a6003['XMD-AMDMINWORDLENGTH']=_0x1f8e6c['dialAMDMinWordLength']||0x64;_0x4a6003['XMD-AMDBETWEENWORDSSILENCE']=_0x1f8e6c[_0x250d('0x164')]||0x32;_0x4a6003[_0x250d('0x165')]=_0x1f8e6c[_0x250d('0x166')]||0x3;_0x4a6003[_0x250d('0x167')]=_0x1f8e6c['dialAMDSilenceThreshold']||0x100;_0x4a6003['XMD-AMDMAXIMUMWORDLENGTH']=_0x1f8e6c[_0x250d('0x168')]||0x1388;}if(_0x1f8e6c['type']===_0x250d('0x47')){_0x4a6003[_0x250d('0x169')]=_0x20ec67[_0x250d('0xe9')];}else{_0x4a6003[_0x250d('0x16a')]=_0x20ec67[_0x250d('0xea')];}for(var _0x1813b3 in _0x20ec67['Contact']){if(_0x20ec67[_0x250d('0x154')]['hasOwnProperty'](_0x1813b3)){if(isNotNull(_0x20ec67[_0x250d('0x154')][_0x1813b3])&&_0x1813b3!=='id'&&_0x1813b3!==_0x250d('0x16b')&&_0x1813b3!==_0x250d('0x16c')&&_0x1813b3!==_0x250d('0x16d')){_0x4a6003[util[_0x250d('0x6e')]('%s%s',_0x250d('0x16e'),_[_0x250d('0x16f')](_0x1813b3))]=_0x20ec67[_0x250d('0x154')][_0x1813b3];}}}var _0x47fb1b=_0x14d4aa['isTrunkReachable'](_0x1f8e6c[_0x250d('0x6a')])?getCallerId(_0x1f8e6c[_0x250d('0x6a')][_0x250d('0x6c')],_0x1f8e6c[_0x250d('0x55')],_0x1f8e6c['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x1f8e6c[_0x250d('0x56')],_0x1f8e6c[_0x250d('0x170')]):_0x1f8e6c[_0x250d('0x56')]):getCallerId(_[_0x250d('0xa0')](_0x1f8e6c[_0x250d('0x12a')])?_0x1f8e6c['Trunk']['callerid']:_0x1f8e6c[_0x250d('0x12a')][_0x250d('0x6c')],_0x1f8e6c[_0x250d('0x55')],_0x1f8e6c[_0x250d('0x170')]>0x0?getCallerIdRandom(_0x1f8e6c[_0x250d('0x56')],_0x1f8e6c['dialRandomLastDigitCallerIdNumber']):_0x1f8e6c[_0x250d('0x56')]);if(_0x47fb1b){_0x4a6003[_0x250d('0x171')]=_0x14d4aa[_0x250d('0x1e')][_0x8ea9d2][_0x250d('0x172')]=extractCalleridName(_0x47fb1b);_0x4a6003[_0x250d('0x173')]=_0x14d4aa[_0x250d('0x1e')][_0x8ea9d2]['originatecalleridnum']=extractCalleridNumber(_0x47fb1b);}return ami[_0x250d('0xa1')]({'actionid':_0x8ea9d2,'action':_0x250d('0x152'),'channel':_0x14d4aa[_0x250d('0x129')](_0x1f8e6c[_0x250d('0x6a')])?util[_0x250d('0x6e')]('SIP/%s/%s%s',_0x1f8e6c[_0x250d('0x6a')][_0x250d('0x3a')],isNotNull(_0x1f8e6c[_0x250d('0x174')])?_0x1f8e6c[_0x250d('0x174')][_0x250d('0x175')]()||'':'',_0x1f8e6c[_0x250d('0x176')]>0x0?_0x20ec67[_0x250d('0x154')][_0x250d('0x155')][_0x250d('0x177')](_0x1f8e6c[_0x250d('0x176')]):_0x20ec67['Contact'][_0x250d('0x155')]):util[_0x250d('0x6e')](_0x250d('0x178'),_[_0x250d('0xa0')](_0x1f8e6c[_0x250d('0x12a')])?_0x1f8e6c[_0x250d('0x6a')][_0x250d('0x3a')]:_0x1f8e6c[_0x250d('0x12a')][_0x250d('0x3a')],isNotNull(_0x1f8e6c['dialPrefix'])?_0x1f8e6c[_0x250d('0x174')]['trim']()||'':'',_0x1f8e6c[_0x250d('0x176')]>0x0?_0x20ec67['Contact'][_0x250d('0x155')][_0x250d('0x177')](_0x1f8e6c['dialCutDigit']):_0x20ec67[_0x250d('0x154')][_0x250d('0x155')]),'callerid':_0x47fb1b,'Exten':'xcally-motion-dialer','Context':_0x250d('0x179'),'Priority':'1','variable':_0x4a6003,'timeout':(_0x1f8e6c[_0x250d('0x57')]||0x1e)*0x3e8,'async':!![],'channelid':_0x8ea9d2})[_0x250d('0xab')](function(_0xf4dade){return _0x2ec028(_0xf4dade);})[_0x250d('0xa4')](function(_0x31809a){_0x1f8e6c[_0x250d('0x60')]+=0x1;var _0x5d6d8d=new History(_0x14d4aa['actions'][_0x8ea9d2]);logger[_0x250d('0x87')](util[_0x250d('0x6e')](_0x250d('0x17a'),JSON[_0x250d('0x41')](_0x31809a)));_0x5d6d8d[_0x250d('0x99')]=0xe;_0x5d6d8d[_0x250d('0x9a')]='OriginateError';_0x5d6d8d['starttime']=moment()[_0x250d('0x6e')](_0x250d('0xe7'));_0x5d6d8d[_0x250d('0x9b')]=_0x5d6d8d[_0x250d('0x9c')];_0x14d4aa['createHistory'](_0x5d6d8d)[_0x250d('0xa4')](loggerCatch(_0x250d('0x17b')));_0x14d4aa['moveContactManagedDialer'](_0x5d6d8d)[_0x250d('0xa4')](loggerCatch(_0x250d('0x17b')))['finally'](function(){delete _0x14d4aa[_0x250d('0x1e')][_0x8ea9d2];return _0x456c0d(msgResponse(_0x250d('0x152'),_0x250d('0x17c'),_0x250d('0x17d')));});});});};Dialer[_0x250d('0x15')][_0x250d('0x2a')]=function(_0x57285b){var _0xbecc58=this[_0x250d('0x1e')][_0x57285b['actionid']];var _0x347cfa=this;if(_0xbecc58){delete this[_0x250d('0x1e')][_0x57285b[_0x250d('0x113')]];_0xbecc58[_0x250d('0x103')]=moment()[_0x250d('0x6e')](_0x250d('0xe7'));var _0x16dc50=_0xbecc58[_0x250d('0x46')]===_0x250d('0x83')?this['campaigns'][_0xbecc58[_0x250d('0xa6')]]:this[_0x250d('0x18')][_0xbecc58[_0x250d('0x17e')]()];if(!this[_0x250d('0xc7')](_0x57285b[_0x250d('0x17f')])){this[_0x250d('0xa8')](_0x16dc50);return this[_0x250d('0x180')](_0xbecc58,_0x16dc50,_0x57285b)[_0x250d('0xab')](function(_0x1ed546){})[_0x250d('0xa4')](loggerCatch(_0x250d('0x181')));}else{this[_0x250d('0x1f')][_0x57285b['uniqueid']]=_0xbecc58;}}};Dialer[_0x250d('0x15')]['checkRetriveMax']=function(_0x459e81,_0x30c3d3,_0xabd813){var _0x2a54e0=new History(_0x30c3d3);if(_0x2a54e0[_0x250d('0xd9')]+_0x2a54e0[_0x250d('0xef')]+_0x2a54e0['countnoanswerretry']+_0x2a54e0[_0x250d('0xdb')]+_0x2a54e0['countdropretry']+_0x2a54e0['countabandonedretry']+_0x2a54e0[_0x250d('0xd6')]+_0x2a54e0[_0x250d('0xde')]>=_0xabd813[_0x250d('0xdf')]-0x1){return!![];}switch(_0x459e81){case 0x3:if(_0x2a54e0['countnoanswerretry']>=_0xabd813[_0x250d('0x182')]-0x1){return!![];}else{this[_0x250d('0xf0')]({'active':![],'countnoanswerretry':_0x2a54e0[_0x250d('0xda')]+=0x1,'scheduledat':moment()[_0x250d('0xe4')](_0xabd813[_0x250d('0x183')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2a54e0[_0x250d('0xe8')],'ListId':_0x2a54e0['ListId'],'VoiceQueueId':_0x2a54e0[_0x250d('0xe9')]||undefined,'CampaignId':_0x2a54e0[_0x250d('0xea')]||undefined})[_0x250d('0xa4')](loggerCatch(_0x250d('0x184')));}break;case 0x5:if(_0x2a54e0[_0x250d('0xd9')]>=_0xabd813[_0x250d('0x185')]-0x1){return!![];}else{this[_0x250d('0xf0')]({'active':![],'countbusyretry':_0x2a54e0['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0xabd813[_0x250d('0x186')],'minutes')[_0x250d('0x6e')](_0x250d('0xe7')),'ContactId':_0x2a54e0[_0x250d('0xe8')],'ListId':_0x2a54e0['ListId'],'VoiceQueueId':_0x2a54e0[_0x250d('0xe9')]||undefined,'CampaignId':_0x2a54e0[_0x250d('0xea')]||undefined})['catch'](loggerCatch(_0x250d('0x187')));}break;case 0x8:if(_0x2a54e0[_0x250d('0xef')]>=_0xabd813[_0x250d('0x188')]-0x1){return!![];}else{this[_0x250d('0xf0')]({'active':![],'countcongestionretry':_0x2a54e0[_0x250d('0xef')]+=0x1,'scheduledat':moment()[_0x250d('0xe4')](_0xabd813[_0x250d('0x189')],_0x250d('0xe6'))['format'](_0x250d('0xe7')),'ContactId':_0x2a54e0[_0x250d('0xe8')],'ListId':_0x2a54e0[_0x250d('0xc4')],'VoiceQueueId':_0x2a54e0['VoiceQueueId']||undefined,'CampaignId':_0x2a54e0[_0x250d('0xea')]||undefined})[_0x250d('0xa4')](loggerCatch(_0x250d('0x18a')));}break;case 0x0:if(_0x2a54e0[_0x250d('0xdb')]>=_0xabd813['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x250d('0xf0')]({'active':![],'countnosuchnumberretry':_0x2a54e0[_0x250d('0xdb')]+=0x1,'scheduledat':moment()[_0x250d('0xe4')](_0xabd813[_0x250d('0x18b')],_0x250d('0xe6'))['format'](_0x250d('0xe7')),'ContactId':_0x2a54e0['ContactId'],'ListId':_0x2a54e0[_0x250d('0xc4')],'VoiceQueueId':_0x2a54e0['VoiceQueueId']||undefined,'CampaignId':_0x2a54e0[_0x250d('0xea')]||undefined})[_0x250d('0xa4')](loggerCatch(_0x250d('0x18c')));}break;case 0xa:if(_0x2a54e0[_0x250d('0xdc')]>=_0xabd813['dialDropMaxRetry']-0x1){return!![];}else{this[_0x250d('0xf0')]({'active':![],'countdropretry':_0x2a54e0[_0x250d('0xdc')]+=0x1,'scheduledat':moment()['add'](_0xabd813[_0x250d('0x10a')],_0x250d('0xe6'))['format'](_0x250d('0xe7')),'ContactId':_0x2a54e0[_0x250d('0xe8')],'ListId':_0x2a54e0[_0x250d('0xc4')],'VoiceQueueId':_0x2a54e0[_0x250d('0xe9')]||undefined,'CampaignId':_0x2a54e0[_0x250d('0xea')]||undefined})[_0x250d('0xa4')](loggerCatch(_0x250d('0x18d')));}break;case 0xb:if(_0x2a54e0[_0x250d('0xdd')]>=_0xabd813[_0x250d('0x10f')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x2a54e0[_0x250d('0xdd')]+=0x1,'scheduledat':moment()[_0x250d('0xe4')](_0xabd813[_0x250d('0x18e')],_0x250d('0xe6'))[_0x250d('0x6e')](_0x250d('0xe7')),'ContactId':_0x2a54e0['ContactId'],'ListId':_0x2a54e0[_0x250d('0xc4')],'VoiceQueueId':_0x2a54e0['VoiceQueueId']||undefined,'CampaignId':_0x2a54e0[_0x250d('0xea')]||undefined})[_0x250d('0xa4')](loggerCatch(_0x250d('0x110')));}break;case 0x13:if(_0x2a54e0[_0x250d('0xd6')]>=_0xabd813[_0x250d('0xe2')]-0x1){return!![];}else{this[_0x250d('0xf0')]({'active':![],'countmachineretry':_0x2a54e0[_0x250d('0xd6')]+=0x1,'scheduledat':moment()[_0x250d('0xe4')](_0xabd813[_0x250d('0xe5')],_0x250d('0xe6'))['format'](_0x250d('0xe7')),'ContactId':_0x2a54e0[_0x250d('0xe8')],'ListId':_0x2a54e0[_0x250d('0xc4')],'VoiceQueueId':_0x2a54e0[_0x250d('0xe9')]||undefined,'CampaignId':_0x2a54e0[_0x250d('0xea')]||undefined})[_0x250d('0xa4')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x2a54e0[_0x250d('0xde')]>=_0xabd813[_0x250d('0x18f')]-0x1){return!![];}else{this[_0x250d('0xf0')]({'active':![],'countagentrejectretry':_0x2a54e0[_0x250d('0xde')]+=0x1,'scheduledat':moment()['add'](_0xabd813[_0x250d('0x190')],'minutes')[_0x250d('0x6e')](_0x250d('0xe7')),'ContactId':_0x2a54e0[_0x250d('0xe8')],'ListId':_0x2a54e0[_0x250d('0xc4')],'VoiceQueueId':_0x2a54e0[_0x250d('0xe9')]||undefined,'CampaignId':_0x2a54e0[_0x250d('0xea')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x250d('0x15')][_0x250d('0x180')]=function(_0x4f0a84,_0x98fc0e,_0x2deb76){var _0x3ac9ec=this;var _0x207f80=new History(_0x4f0a84);return new BPromise(function(_0xba9a42,_0x396b7d){if(_[_0x250d('0x37')](_0x98fc0e)&&'object'!==typeof _0x98fc0e){return _0x396b7d(msgResponse(_0x250d('0x191'),'Failure',_0x250d('0x192')));}if(_[_0x250d('0x37')](_0x2deb76)&&'object'!==typeof _0x2deb76){return _0x396b7d(msgResponse(_0x250d('0x191'),_0x250d('0x130'),_0x250d('0x193')));}switch(_0x2deb76['reason']){case'0':_0x98fc0e[_0x250d('0x194')]+=0x1;_0x207f80[_0x250d('0x99')]=0x0;_0x207f80[_0x250d('0x9a')]='NoSuchNumber';_0x207f80[_0x250d('0xdb')]+=0x1;_0x207f80[_0x250d('0xd7')]+=0x1;ami[_0x250d('0x45')](_0x250d('0x195'),ut[_0x250d('0x196')](_0x4f0a84,'nosuchnumber'));_0x3ac9ec[_0x250d('0xbd')](_0x207f80)['catch'](loggerCatch(_0x250d('0x197')));if(_0x3ac9ec[_0x250d('0x198')](0x0,_0x4f0a84,_0x98fc0e)){if(_0x207f80[_0x250d('0xdb')]>=_0x98fc0e[_0x250d('0x199')]){_0x3ac9ec[_0x250d('0x19a')](_0x207f80,_0xba9a42,_0x396b7d,_0x250d('0x19b'));}else{_0x3ac9ec[_0x250d('0xe0')](_0x207f80,_0xba9a42,_0x396b7d,_0x250d('0x19b'));}}break;case'3':_0x98fc0e[_0x250d('0x5f')]+=0x1;_0x207f80[_0x250d('0x99')]=0x3;_0x207f80['statedesc']=_0x250d('0x19c');_0x207f80[_0x250d('0xda')]+=0x1;_0x207f80[_0x250d('0xd7')]+=0x1;ami[_0x250d('0x45')]('custom:agentnoanswer',ut['buildObj'](_0x4f0a84,_0x250d('0x19d')));_0x3ac9ec[_0x250d('0xbd')](_0x207f80)[_0x250d('0xa4')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x3ac9ec[_0x250d('0x198')](0x3,_0x4f0a84,_0x98fc0e)){if(_0x207f80[_0x250d('0xda')]>=_0x98fc0e[_0x250d('0x182')]){_0x3ac9ec[_0x250d('0x19a')](_0x207f80,_0xba9a42,_0x396b7d,'reason\x203\x20ringing\x20no\x20answer');}else{_0x3ac9ec[_0x250d('0xe0')](_0x207f80,_0xba9a42,_0x396b7d,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x98fc0e['outboundBusyCallsDay']+=0x1;_0x207f80[_0x250d('0x99')]=0x5;_0x207f80['statedesc']='Busy';_0x207f80[_0x250d('0xd9')]+=0x1;_0x207f80[_0x250d('0xd7')]+=0x1;ami[_0x250d('0x45')](_0x250d('0x19e'),ut[_0x250d('0x196')](_0x4f0a84,_0x250d('0x19f')));_0x3ac9ec[_0x250d('0xbd')](_0x207f80)[_0x250d('0xa4')](loggerCatch(_0x250d('0x1a0')));if(_0x3ac9ec[_0x250d('0x198')](0x5,_0x4f0a84,_0x98fc0e)){if(_0x207f80[_0x250d('0xd9')]>=_0x98fc0e[_0x250d('0x185')]){_0x3ac9ec['createStateFinal'](_0x207f80,_0xba9a42,_0x396b7d,_0x250d('0x1a1'));}else{_0x3ac9ec['stateGlobal'](_0x207f80,_0xba9a42,_0x396b7d,_0x250d('0x1a1'));}}break;case'8':_0x98fc0e[_0x250d('0x5b')]+=0x1;_0x207f80[_0x250d('0x99')]=0x8;_0x207f80['statedesc']='Congestion';_0x207f80[_0x250d('0xef')]+=0x1;_0x207f80[_0x250d('0xd7')]+=0x1;ami[_0x250d('0x45')](_0x250d('0x1a2'),ut[_0x250d('0x196')](_0x4f0a84,_0x250d('0x1a3')));_0x3ac9ec[_0x250d('0xbd')](_0x207f80)[_0x250d('0xa4')](loggerCatch(_0x250d('0x1a4')));if(_0x3ac9ec['checkRetriveMax'](0x8,_0x4f0a84,_0x98fc0e)){if(_0x207f80['countcongestionretry']>=_0x98fc0e['dialCongestionMaxRetry']){_0x3ac9ec['createStateFinal'](_0x207f80,_0xba9a42,_0x396b7d,_0x250d('0x1a5'));}else{_0x3ac9ec[_0x250d('0xe0')](_0x207f80,_0xba9a42,_0x396b7d,_0x250d('0x1a5'));}}break;case'11':_0x98fc0e[_0x250d('0x1a6')]+=0x1;_0x207f80[_0x250d('0x99')]=0xb;_0x207f80[_0x250d('0x9a')]=_0x250d('0x111');_0x207f80['countabandonedretry']+=0x1;_0x207f80[_0x250d('0xd7')]+=0x1;_0x3ac9ec['createHistory'](_0x207f80)[_0x250d('0xa4')](loggerCatch(_0x250d('0x112')));if(_0x3ac9ec[_0x250d('0x198')](0xb,_0x4f0a84,_0x98fc0e)){if(_0x207f80[_0x250d('0xdd')]>=_0x98fc0e['dialAbandonedMaxRetry']){_0x3ac9ec[_0x250d('0x19a')](_0x207f80,_0xba9a42,_0x396b7d,_0x250d('0x1a7'));}else{_0x3ac9ec['stateGlobal'](_0x207f80,_0xba9a42,_0x396b7d,_0x250d('0x1a7'));}}break;case'20':_0x98fc0e[_0x250d('0x1a8')]+=0x1;_0x207f80[_0x250d('0x99')]=0x14;_0x207f80['statedesc']=_0x250d('0x1a9');_0x207f80[_0x250d('0xde')]+=0x1;_0x207f80[_0x250d('0xd7')]+=0x1;ami['emit'](_0x250d('0x1aa'),ut[_0x250d('0x196')](_0x4f0a84,'agentreject'));_0x3ac9ec[_0x250d('0xbd')](_0x207f80)[_0x250d('0xa4')](loggerCatch(_0x250d('0x1ab')));if(_0x3ac9ec['checkRetriveMax'](0x14,_0x4f0a84,_0x98fc0e)){if(_0x207f80['countagentrejectretry']>=_0x98fc0e[_0x250d('0x18f')]){_0x3ac9ec['createStateFinal'](_0x207f80,_0xba9a42,_0x396b7d,'reason\x2020\x20agentreject');}else{_0x3ac9ec[_0x250d('0xe0')](_0x207f80,_0xba9a42,_0x396b7d,'reason\x2020\x20agentreject');}}break;default:_0x98fc0e[_0x250d('0x1ac')]+=0x1;_0x207f80[_0x250d('0x99')]=0xc;_0x207f80['statedesc']=_0x2deb76[_0x250d('0x1ad')];_0x3ac9ec[_0x250d('0xbd')](_0x207f80)[_0x250d('0xa4')](loggerCatch(_0x250d('0x1ae')));if(_0x3ac9ec['checkRetriveMax'](_0x2deb76['reason'],_0x4f0a84,_0x98fc0e)){if(_0x207f80['countbusyretry']+_0x207f80[_0x250d('0xef')]+_0x207f80[_0x250d('0xda')]+_0x207f80[_0x250d('0xdb')]+_0x207f80['countdropretry']+_0x207f80['countabandonedretry']+_0x207f80[_0x250d('0xd6')]+_0x207f80['countagentrejectretry']>=_0x98fc0e[_0x250d('0xdf')]){_0x3ac9ec[_0x250d('0xe0')](_0x207f80,_0xba9a42,_0x396b7d,_0x2deb76['reason']);}else{_0x3ac9ec[_0x250d('0x19a')](_0x207f80,_0xba9a42,_0x396b7d,_0x2deb76[_0x250d('0x1ad')]);}}}});};Dialer[_0x250d('0x15')][_0x250d('0xe0')]=function(_0xdd07d0,_0x286e39,_0x3555f9,_0x11cca9){var _0x2af909=new Final(_0xdd07d0);_0x2af909[_0x250d('0x99')]=0xf;_0x2af909['statedesc']=_0x250d('0x1af');this['createStateFinal'](_0x2af909,_0x286e39,_0x3555f9,_0x11cca9);};Dialer[_0x250d('0x15')][_0x250d('0x19a')]=function(_0x1c89cf,_0x1ab9f0,_0x455260,_0x40d99b){this[_0x250d('0xbc')](_0x1c89cf)[_0x250d('0xab')](function(_0x1ccf78){return _0x1ab9f0(msgResponse(_0x250d('0x191'),_0x250d('0xc8'),_0x40d99b));})[_0x250d('0xa4')](function(_0x15abcb){return _0x455260(msgResponse(_0x250d('0x1b0'),_0x250d('0x130'),'contact\x20not\x20moved'));});};Dialer[_0x250d('0x15')]['predictive']=function(_0x51f371){var _0x21de70=this;var _0x5c2827=_0x51f371[_0x250d('0x1b1')]/0x64;var _0x1c4c71=_0x51f371[_0x250d('0x5e')]/(_0x51f371[_0x250d('0x5e')]+_0x51f371['outboundAnswerCallsDay']);var _0x5799df=Math[_0x250d('0x1b2')](_0x51f371[_0x250d('0x1b3')]*(_0x51f371[_0x250d('0x1b4')]/0x64));var _0xc36a8c=Math[_0x250d('0x1b2')](_0x51f371['predictiveIntervalAvailable']*(_0x51f371[_0x250d('0x1b5')]/0x64));var _0xb514e0=_0x51f371['available']+_0x51f371[_0x250d('0x4d')];var _0x1f91c9=Math[_0x250d('0x1b6')](_0x51f371['erlangCalls']*_0x51f371[_0x250d('0x68')]*_0x51f371[_0x250d('0x1b7')]*_0x51f371[_0x250d('0x1b8')]);if(_[_0x250d('0x37')](_0x51f371[_0x250d('0x22')])){if(!_[_0x250d('0x37')](_0x51f371[_0x250d('0x21')])){_0x51f371[_0x250d('0x21')]=undefined;loggerPredictive['error'](_0x250d('0x1b9'),_0x250d('0x1ba'));}if(!_['isUndefined'](_0x51f371['handlePredictive'])){loggerPredictive[_0x250d('0x87')](_0x250d('0x1b9'),_0x250d('0x1bb'));clearInterval(_0x51f371[_0x250d('0x82')]);_0x51f371[_0x250d('0x82')]=undefined;}_0x51f371[_0x250d('0x22')]=moment()[_0x250d('0x6e')](_0x250d('0xe7'));loggerPredictive['info'](_0x51f371[_0x250d('0x3a')],'collection\x20data\x20in\x20progressive\x20at',_0x51f371[_0x250d('0x22')]);this[_0x250d('0x143')](_0x51f371,0x1);}else if(ifInterval(_0x51f371[_0x250d('0x1bc')],_0x51f371[_0x250d('0x22')])){this['handlePower'](_0x51f371,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x51f371[_0x250d('0x22')],_0x51f371['name']);_0x51f371[_0x250d('0x7c')]=0x0;_0x51f371[_0x250d('0x105')]=0x0;}else if(_0x5c2827<_0x1c4c71&&_0x51f371[_0x250d('0x1bd')]===_0x250d('0x1be')){freeVariablesPredictive(_0x51f371);loggerPredictive[_0x250d('0x73')](_0x250d('0x1bf'),_0x250d('0x1c0'),_0x1c4c71,_0x250d('0x22'),_0x51f371[_0x250d('0x3a')]);}else if(_0x1f91c9<_0x51f371[_0x250d('0x105')]&&_0x51f371[_0x250d('0x1bd')]===_0x250d('0x1be')){freeVariablesPredictive(_0x51f371);loggerPredictive[_0x250d('0x73')](_0x250d('0x1c1'),_0x250d('0x1c2'),_0x1f91c9,'Drop\x20in\x20this\x20interval',_0x51f371[_0x250d('0x105')],_0x250d('0x22'),_0x51f371[_0x250d('0x3a')]);}else if(!ifInterval(_0x51f371[_0x250d('0x1bc')],_0x51f371['startProgressive'])&&_[_0x250d('0x37')](_0x51f371['startPredictive'])&&!_[_0x250d('0x37')](_0x51f371[_0x250d('0x22')])){_0x51f371[_0x250d('0x21')]=moment()[_0x250d('0x6e')](_0x250d('0xe7'));loggerPredictive['info'](_0x51f371[_0x250d('0x3a')],_0x250d('0x1c3'),_0x51f371['startPredictive']);this['averageHandleTime'](_0x51f371[_0x250d('0x1bc')])[_0x250d('0xab')](this[_0x250d('0x1c4')](_0x51f371))[_0x250d('0xab')](mergeDataErlangB(_0x51f371))[_0x250d('0xab')](this[_0x250d('0x1c5')](_0x51f371))[_0x250d('0xa4')](loggerCatchPredictive(_0x250d('0x1c6'),_0x51f371));}else if(!ifInterval(_0x51f371[_0x250d('0x1bc')],_0x51f371[_0x250d('0x21')])){_0x51f371['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x51f371['startPredictive']=moment()['format'](_0x250d('0xe7'));loggerPredictive[_0x250d('0x73')](_0x51f371[_0x250d('0x3a')],'recalculate\x20predictive\x20at',_0x51f371[_0x250d('0x21')]);clearInterval(_0x51f371['handlePredictive']);_0x51f371[_0x250d('0x82')]=undefined;this[_0x250d('0x1c7')](_0x51f371['dialPredictiveInterval'])[_0x250d('0xab')](this[_0x250d('0x1c4')](_0x51f371))['then'](mergeDataErlangB(_0x51f371))[_0x250d('0xab')](this[_0x250d('0x1c5')](_0x51f371))['catch'](loggerCatchPredictive(_0x250d('0x1c8'),_0x51f371));}else if(_0x51f371[_0x250d('0x1b3')]&&_0xb514e0<_0x51f371[_0x250d('0x1b3')]-_0xc36a8c){freeVariablesPredictive(_0x51f371);loggerPredictive['info'](_0x51f371[_0x250d('0x3a')],_0x250d('0x1c9'),_0xb514e0,_0x250d('0x1ca'),_0x51f371[_0x250d('0x1b3')],'-',_0xc36a8c,'=',_0x51f371['predictiveIntervalAvailable']-_0xc36a8c,')');}else if(_0x51f371[_0x250d('0x1b3')]&&_0xb514e0>_0x51f371[_0x250d('0x1b3')]+_0x5799df){freeVariablesPredictive(_0x51f371);loggerPredictive['info'](_0x51f371[_0x250d('0x3a')],_0x250d('0x1c9'),_0xb514e0,_0x250d('0x1cb'),_0x51f371[_0x250d('0x1b3')],'+',_0x5799df,'=',_0x51f371[_0x250d('0x1b3')]+_0x5799df,')');}};Dialer[_0x250d('0x15')]['getDataPredictive']=function(_0x469b8f){var _0x3ea3d4=this;return function(_0x28f8fc){return new BPromise(function(_0x467091,_0x131e8d){_['merge'](_0x469b8f,_0x28f8fc[0x0]);if(checkGetDataPredictive(_0x28f8fc[0x0])){var _0x3910ab=_0x469b8f['predictiveIntervalAvailable']=_0x469b8f[_0x250d('0x4d')]+_0x469b8f[_0x250d('0x49')];var _0x48f2f2=_0x469b8f[_0x250d('0x1bc')]*0x3c;var _0x2b48ca=_0x28f8fc[0x0][_0x250d('0x63')]+_0x28f8fc[0x0][_0x250d('0x62')];var _0x3a5396=(_0x28f8fc[0x0][_0x250d('0x61')]+_0x28f8fc[0x0][_0x250d('0x65')]+_0x28f8fc[0x0][_0x250d('0x64')])/_0x28f8fc[0x0]['predictiveIntervalTotalCalls'];_0x469b8f[_0x250d('0x1b7')]=_0x3a5396>0x0?_0x3a5396:0x1;switch(_0x469b8f[_0x250d('0x1bd')]){case _0x250d('0x1be'):var _0x381507=_0x469b8f['dialPredictiveOptimizationPercentage']/0x64;return _0x3ea3d4[_0x250d('0x1cc')](_0x3910ab,_0x48f2f2,_0x2b48ca,_0x3a5396,_0x381507)[_0x250d('0xab')](function(_0xecd6d7){return _0x467091(_0xecd6d7);});case _0x250d('0x1cd'):var _0x58f82a=_0x469b8f[_0x250d('0x1b1')]/0x64;return _0x3ea3d4['busyFactor'](_0x3910ab,_0x48f2f2,_0x2b48ca,_0x3a5396,_0x58f82a)[_0x250d('0xab')](function(_0x354d8a){return _0x467091(_0x354d8a);});default:return _0x131e8d(msgResponse(_0x250d('0x1ce'),_0x250d('0x130'),'Unknown\x20Predictive'));}}else{return _0x131e8d(msgResponse(_0x250d('0x1ce'),_0x250d('0x130'),_0x250d('0x1cf')));}});};};Dialer[_0x250d('0x15')][_0x250d('0x1d0')]=function(_0x1e9b6d){var _0x5246d6=this;return function(_0x57d567){return new BPromise(function(_0x5c26fd,_0x47028f){_[_0x250d('0x1d1')](_0x1e9b6d,_0x57d567[0x0]);if(checkGetDataPredictive(_0x57d567[0x0])){loggerPredictive[_0x250d('0x73')](JSON[_0x250d('0x41')](_0x57d567[0x0]));if(_0x1e9b6d[_0x250d('0x1bd')]===_0x250d('0x1be')){return _0x5246d6[_0x250d('0xba')](_0x1e9b6d['id'])['then'](function(_0x337e0a){var _0x56bbec=_0x1e9b6d[_0x250d('0x4a')]-_0x337e0a[0x0][_0x250d('0x1d2')];var _0x4cb01e=_0x1e9b6d[_0x250d('0x1bc')]*0x3c;var _0x255340=_0x57d567[0x0][_0x250d('0x63')]+_0x57d567[0x0][_0x250d('0x62')];var _0x52b724=(_0x57d567[0x0][_0x250d('0x61')]+_0x57d567[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x57d567[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x57d567[0x0][_0x250d('0x67')];var _0x1cca98=_0x1e9b6d[_0x250d('0x1b1')]/0x64;_0x1e9b6d[_0x250d('0x1d3')]=_0x337e0a[0x0][_0x250d('0x1d2')]||0x0;_0x1e9b6d[_0x250d('0x1b7')]=_0x52b724>0x0?_0x52b724:0x1;return _0x5246d6[_0x250d('0x1cc')](_0x56bbec,_0x4cb01e,_0x255340,_0x52b724,_0x1cca98);})[_0x250d('0xab')](function(_0x1372ab){return _0x5c26fd(_0x1372ab);})['catch'](function(_0xc13307){return _0x47028f(msgResponse(_0x250d('0x1d4'),_0x250d('0x130'),JSON[_0x250d('0x41')](_0xc13307)));});}if(_0x1e9b6d[_0x250d('0x1bd')]===_0x250d('0x1cd')){return _0x5246d6[_0x250d('0xba')](_0x1e9b6d['id'])[_0x250d('0xab')](function(_0x3b8e69){var _0x2811ab=_0x1e9b6d[_0x250d('0x4a')]-_0x3b8e69[0x0][_0x250d('0x1d2')];var _0x4d61e6=_0x1e9b6d['dialPredictiveInterval']*0x3c;var _0xab1df7=_0x57d567[0x0]['predictiveIntervalAvgTalktime']+_0x57d567[0x0][_0x250d('0x62')];var _0x42648d=(_0x57d567[0x0][_0x250d('0x61')]+_0x57d567[0x0][_0x250d('0x65')]+_0x57d567[0x0][_0x250d('0x64')])/_0x57d567[0x0][_0x250d('0x67')];var _0x3cf720=_0x1e9b6d[_0x250d('0x1b1')]/0x64;_0x1e9b6d[_0x250d('0x1d3')]=_0x3b8e69[0x0]['outboundQueuePauses']||0x0;_0x1e9b6d[_0x250d('0x1b7')]=_0x42648d>0x0?_0x42648d:0x1;return _0x5246d6['busyFactor'](_0x2811ab,_0x4d61e6,_0xab1df7,_0x42648d,_0x3cf720);})[_0x250d('0xab')](function(_0x384bb9){return _0x5c26fd(_0x384bb9);})[_0x250d('0xa4')](function(_0x22d4d4){return _0x47028f(msgResponse(_0x250d('0x1d4'),_0x250d('0x130'),JSON[_0x250d('0x41')](_0x22d4d4)));});}}else{return _0x47028f(msgResponse(_0x250d('0x1ce'),_0x250d('0x130'),'check\x20failure'));}});};};Dialer[_0x250d('0x15')]['startMethodPredictive']=function(_0x52b088){var _0x1b4458=this;return function(){var _0x39b872=0x0;var _0x44110e=Math[_0x250d('0x1b6')](_0x52b088[_0x250d('0x1d5')]*0x3e8);if(_0x44110e>0x0){_0x44110e=_0x44110e<0x64?0x64:_0x44110e;loggerPredictive[_0x250d('0x73')](_0x52b088['name'],_0x250d('0x1d6'),_0x44110e,_0x250d('0x42'));_0x52b088[_0x250d('0x82')]=setInterval(function(){_0x1b4458[_0x250d('0x82')](_0x52b088);loggerPredictiveCalls[_0x250d('0x73')](_0x250d('0x1d7'),_0x39b872+=0x1);},_0x44110e);}else{loggerPredictive[_0x250d('0x73')](_0x52b088[_0x250d('0x3a')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x250d('0x15')]['checkContactBlack']=function(_0x1e6826,_0x408421){var _0x3b2dac=this;return function(_0x28b3c9){if(_['isEmpty'](_0x28b3c9)){if(_['isNil'](_0x408421['UserId'])||!_0x408421['recallme']){if(_0x1e6826[_0x250d('0x54')]===_0x250d('0x7')){_0x1e6826[_0x250d('0x11a')]=_[_0x250d('0x37')](_0x1e6826['queueStatusComplete'])?!![]:_0x1e6826['queueStatusComplete'];var _0x97de62=uuid['v4']();_0x3b2dac[_0x250d('0x1e')][_0x97de62]=new Action(_0x1e6826,_0x408421,_0x97de62);loggerBooked[_0x250d('0x73')](_0x250d('0x1d8'),_0x97de62,_0x250d('0x1d9'),JSON[_0x250d('0x41')](_0x1e6826['queueStatusComplete']),_0x250d('0x1da'),_0x1e6826[_0x250d('0x3a')]);if(_0x1e6826['queueStatusComplete']){_0x1e6826[_0x250d('0x11a')]=![];_0x3b2dac[_0x250d('0x24')][_0x3b2dac[_0x250d('0x1e')][_0x97de62][_0x250d('0xa6')]]=[];ami[_0x250d('0xa1')]({'actionid':_0x97de62,'action':_0x250d('0x1db'),'queue':_0x1e6826[_0x250d('0x3a')]})[_0x250d('0xa4')](function(_0x5450ae){_0x3b2dac[_0x250d('0xa8')](_0x1e6826);_0x3b2dac[_0x250d('0xf0')]({'active':![],'ContactId':_0x3b2dac[_0x250d('0x1e')][_0x97de62][_0x250d('0xe8')],'ListId':_0x3b2dac[_0x250d('0x1e')][_0x97de62][_0x250d('0xc4')],'VoiceQueueId':_0x3b2dac[_0x250d('0x1e')][_0x97de62]['VoiceQueueId']||undefined,'CampaignId':_0x3b2dac[_0x250d('0x1e')][_0x97de62]['CampaignId']||undefined})[_0x250d('0xa4')](loggerCatch(_0x250d('0x1dc')));delete _0x3b2dac[_0x250d('0x1e')][_0x97de62];});}else{loggerBooked[_0x250d('0x73')](_0x250d('0x1dd'),JSON[_0x250d('0x41')](_0x1e6826[_0x250d('0x11a')]),_0x250d('0x1da'),_0x1e6826[_0x250d('0x3a')]);_0x3b2dac[_0x250d('0xa8')](_0x1e6826);_0x3b2dac[_0x250d('0xf0')]({'active':![],'ContactId':_0x3b2dac['actions'][_0x97de62][_0x250d('0xe8')],'ListId':_0x3b2dac[_0x250d('0x1e')][_0x97de62][_0x250d('0xc4')],'VoiceQueueId':_0x3b2dac[_0x250d('0x1e')][_0x97de62][_0x250d('0xe9')]||undefined,'CampaignId':_0x3b2dac[_0x250d('0x1e')][_0x97de62]['CampaignId']||undefined})[_0x250d('0xa4')](loggerCatch(_0x250d('0x1dc')));delete _0x3b2dac['actions'][_0x97de62];}}else{return _0x3b2dac[_0x250d('0x1de')](_0x1e6826,_0x408421);}}else{if(getDiff(_0x408421['scheduledat'])<_0x1e6826[_0x250d('0x1df')]*0x3c){if(_0x408421[_0x250d('0x1e0')]&&!_0x408421[_0x250d('0x1e0')][_0x250d('0x1e1')]){_0x3b2dac[_0x250d('0x17')][_0x250d('0x11b')](_0x408421['id'])[_0x250d('0x1e2')](function(){_0x3b2dac['updateOriginated'](_0x1e6826);});}else{_0x3b2dac[_0x250d('0xb5')]({'active':![]},_0x408421['id'],0x1)[_0x250d('0x1e2')](function(){console['log'](_0x250d('0x1e3'));_0x3b2dac[_0x250d('0xa8')](_0x1e6826);});}}else{_0x1e6826[_0x250d('0x1e4')]+=0x1;_0x3b2dac[_0x250d('0xa8')](_0x1e6826);if(_0x1e6826[_0x250d('0x1e5')]){_0x3b2dac[_0x250d('0xf0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x408421[_0x250d('0xe8')],'ListId':_0x408421[_0x250d('0xc4')],'VoiceQueueId':_0x408421[_0x250d('0xe9')]||undefined,'CampaignId':_0x408421[_0x250d('0xea')]||undefined})[_0x250d('0xa4')](loggerCatch(_0x250d('0x1e6')));_0x3b2dac['createHistory'](createObjHistory(_0x1e6826,_0x408421,_0x250d('0x1e7'),0x17,_0x250d('0x1e8')))[_0x250d('0xa4')](loggerCatch(_0x250d('0x1e9')));}else{_0x3b2dac['saveInDb'](createObjHistory(_0x1e6826,_0x408421,_0x250d('0x1ea'),0x16,_0x250d('0x1eb')),'[Originate][HistoryRecallClose][historyCatch]',_0x250d('0x1ec'));}}}}else{_0x1e6826[_0x250d('0x1ed')]+=0x1;_0x3b2dac['saveInDb'](createObjHistory(_0x1e6826,_0x408421,_0x250d('0x1ee'),0xd,_0x250d('0x1ef')),_0x250d('0x1f0'),'[Originate][MoveBlacklist]');throw _0x250d('0x1f1');}};};Dialer[_0x250d('0x15')]['handleIvr']=function(_0x4768ba){var _0x240b65=this;var _0x476002=[];var _0x1d18de=_0x4768ba[_0x250d('0x1f2')]-_0x4768ba[_0x250d('0x8b')]-_0x4768ba[_0x250d('0x1f3')];emitCampaignSummary(_0x4768ba);if(_0x1d18de>0x0){if(_0x1d18de>this[_0x250d('0x1c')]){_0x1d18de=this[_0x250d('0x1c')];}_0x4768ba['temp']+=_0x1d18de;this[_0x250d('0xb9')](_0x4768ba['id'],_0x1d18de,_0x4768ba['dialOrderByScheduledAt'])[_0x250d('0xab')](function(_0x2935ea){_0x4768ba[_0x250d('0x1f3')]-=_0x1d18de;_0x4768ba[_0x250d('0x1f3')]=_0x4768ba[_0x250d('0x1f3')]>0x0?_0x4768ba['temp']:0x0;if(!checkContactEmpty(_0x2935ea)){_0x4768ba[_0x250d('0x38')]=_0x250d('0x91');logger[_0x250d('0x73')](_0x250d('0x1f4')+_0x4768ba[_0x250d('0x3a')]);}else{_0x4768ba[_0x250d('0x8b')]+=_0x2935ea[_0x250d('0x11f')];_0x4768ba[_0x250d('0x38')]=_0x250d('0x1f5');for(var _0x548a47=0x0;_0x548a47<_0x2935ea['length'];_0x548a47+=0x1){_0x4768ba[_0x250d('0x1f6')]+=0x1;if(_[_0x250d('0xa0')](_0x2935ea[_0x548a47])||_[_0x250d('0xa0')](_0x2935ea[_0x548a47]['Contact'])||_[_0x250d('0xa0')](_0x2935ea[_0x548a47]['Contact'][_0x250d('0x155')])){_0x240b65[_0x250d('0xc1')](_0x250d('0x1f7'),_0x4768ba,_0x2935ea[_0x548a47]);}else{_0x240b65[_0x250d('0xb0')](_[_0x250d('0xc3')](_0x2935ea[_0x548a47],[_0x250d('0xea'),_0x250d('0x1f8')]))[_0x250d('0xab')](_0x240b65[_0x250d('0x1f9')](_0x4768ba,_0x2935ea[_0x548a47]))[_0x250d('0xa4')](_0x240b65['loggerHandler']('[actionOriginateIvr]\x20',_0x4768ba));}}}})['catch'](loggerGetContactDialer(_0x250d('0x1fa'),_0x4768ba,_0x1d18de));}};Dialer[_0x250d('0x15')]['handlePower']=function(_0xa3e52e,_0xc44a5b){var _0xf93a28=this;var _0x49be67=[];var _0x1fcbec=_0xc44a5b>=0x1?_0xc44a5b:0x1;var _0x4538d8=[];if(_0xa3e52e[_0x250d('0x54')]===_0x250d('0x7')){_0x1fcbec=0x1;}var _0x54a28b=Math[_0x250d('0x1b6')](_0xa3e52e[_0x250d('0x49')]*_0x1fcbec)-_0xa3e52e[_0x250d('0x8b')]-_0xa3e52e[_0x250d('0x1f3')];emitVoiceQueueSummary(_0xa3e52e);if(_0xa3e52e[_0x250d('0x1fb')]>0x0){var _0x1a8e80=_0xa3e52e['dialLimitQueue']-_0xa3e52e[_0x250d('0x8b')]-_0xa3e52e['talking']-_0xa3e52e['temp']-_0xa3e52e['pTalking'];if(_0x54a28b>_0x1a8e80){_0x54a28b=_0x1a8e80;}}if(_0x54a28b>0x0){if(_0xa3e52e[_0x250d('0x54')]===_0x250d('0x7')){_0x54a28b=0x1;}if(_0x54a28b>this[_0x250d('0x1c')]){_0x54a28b=this[_0x250d('0x1c')];}_0xa3e52e['temp']+=_0x54a28b;for(var _0x113239 in this[_0x250d('0x1a')]){if(this['agents']['hasOwnProperty'](_0x113239)){if(this['agents'][_0x113239][_0x250d('0x99')]===_0x250d('0x1fc')&&this[_0x250d('0x1a')][_0x113239][_0x250d('0xa2')]===_0x250d('0xca')){_0x49be67['push'](this['agents'][_0x113239]['id']);}}}this[_0x250d('0xb7')](_0xa3e52e['id'],_0x49be67,_0x54a28b,_0xa3e52e[_0x250d('0x1fd')])[_0x250d('0xab')](function(_0x111baf){_0xa3e52e[_0x250d('0x1f3')]-=_0x54a28b;_0xa3e52e[_0x250d('0x1f3')]=_0xa3e52e['temp']>0x0?_0xa3e52e[_0x250d('0x1f3')]:0x0;if(!checkContactEmpty(_0x111baf)){_0xf93a28['countReScheduled'](_0xa3e52e)[_0x250d('0xab')](sendMessageReschedule(_0xa3e52e))[_0x250d('0xa4')](loggerCatch(_0x250d('0xad')));}else{_0xa3e52e['originated']+=_0x111baf[_0x250d('0x11f')];_0xa3e52e[_0x250d('0x38')]=_0xa3e52e['dialMethod']===_0x250d('0x7')?_0x250d('0x15c'):_0x250d('0x1f5');for(var _0x3f2b8d=0x0;_0x3f2b8d<_0x111baf[_0x250d('0x11f')];_0x3f2b8d+=0x1){if(_[_0x250d('0xa0')](_0x111baf[_0x3f2b8d])||_[_0x250d('0xa0')](_0x111baf[_0x3f2b8d][_0x250d('0x154')])||_[_0x250d('0xa0')](_0x111baf[_0x3f2b8d][_0x250d('0x154')][_0x250d('0x155')])){_0xf93a28[_0x250d('0xc1')](_0x250d('0x1f7'),_0xa3e52e,_0x111baf[_0x3f2b8d]);}else{_0xf93a28[_0x250d('0xae')](_[_0x250d('0xc3')](_0x111baf[_0x3f2b8d],[_0x250d('0xe9'),_0x250d('0x1f8')]))[_0x250d('0xab')](_0xf93a28[_0x250d('0x1f9')](_0xa3e52e,_0x111baf[_0x3f2b8d]))[_0x250d('0xa4')](_0xf93a28[_0x250d('0x1fe')](_0x250d('0x1f7'),_0xa3e52e));}}}})[_0x250d('0xa4')](loggerGetContactDialer('[getContactDialer2]',_0xa3e52e,_0x54a28b));}};Dialer[_0x250d('0x15')][_0x250d('0x82')]=function(_0x38df57){var _0x3b5c27=this;if(_0x38df57[_0x250d('0x1fb')]>0x0){var _0x53b822=_0x38df57[_0x250d('0x1fb')]-_0x38df57[_0x250d('0x8b')]-_0x38df57['talking'];if(_0x53b822>0x0){this[_0x250d('0x1ff')](_0x38df57);}else{loggerPredictiveCalls['info'](_0x250d('0x200'));}}else{this[_0x250d('0x1ff')](_0x38df57);}};Dialer[_0x250d('0x15')][_0x250d('0x1ff')]=function(_0x16505d){var _0x13b210=this;var _0x5db0a5=[];_0x16505d['originated']+=0x1;for(var _0x4c0a77 in this[_0x250d('0x1a')]){if(this[_0x250d('0x1a')][_0x250d('0x8a')](_0x4c0a77)){if(this[_0x250d('0x1a')][_0x4c0a77][_0x250d('0x99')]===_0x250d('0x1fc')&&this[_0x250d('0x1a')][_0x4c0a77]['status']===_0x250d('0xca')){_0x5db0a5[_0x250d('0x118')](this['agents'][_0x4c0a77]['id']);}}}this['getContactDialer'](_0x16505d['id'],_0x5db0a5,0x1,_0x16505d[_0x250d('0x1fd')])[_0x250d('0xab')](function(_0x2227db){if(!checkContactEmpty(_0x2227db)){checkContactLowerLimitOriginate(_0x16505d,0x1,0x0);_0x13b210[_0x250d('0xac')](_0x16505d)[_0x250d('0xab')](sendMessageReschedule(_0x16505d))[_0x250d('0xa4')](loggerCatch(_0x250d('0xad')));}else{_0x16505d[_0x250d('0x38')]=_0x250d('0x1f5');if(_['isNil'](_0x2227db[0x0])||_['isNil'](_0x2227db[0x0][_0x250d('0x154')])||_[_0x250d('0xa0')](_0x2227db[0x0][_0x250d('0x154')]['phone'])){_0x13b210[_0x250d('0xc1')]('[actionOriginate]\x20',_0x16505d,_0x2227db[0x0]);}else{_0x13b210[_0x250d('0xae')](_[_0x250d('0xc3')](_0x2227db[0x0],[_0x250d('0xe9'),'Contact.phone']))[_0x250d('0xab')](_0x13b210[_0x250d('0x1f9')](_0x16505d,_0x2227db[0x0]))[_0x250d('0xa4')](_0x13b210[_0x250d('0x1fe')]('[actionOriginatePredictive]\x20',_0x16505d));}}})['catch'](loggerGetContactDialer(_0x250d('0x201'),_0x16505d,0x1));emitVoiceQueueSummary(_0x16505d);};Dialer[_0x250d('0x15')][_0x250d('0x1cc')]=function(_0x3fbecd,_0x45043d,_0x23d5c9,_0x87e427,_0x2ba8f6,_0x200d76){loggerPredictive[_0x250d('0x73')](_0x250d('0x202'));loggerPredictive[_0x250d('0x73')](_0x250d('0x203'),_0x3fbecd);loggerPredictive[_0x250d('0x73')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x45043d);loggerPredictive['info'](_0x250d('0x204'),_0x23d5c9);loggerPredictive[_0x250d('0x73')](_0x250d('0x205'),_0x87e427);loggerPredictive[_0x250d('0x73')](_0x250d('0x206'),_0x2ba8f6);loggerPredictive[_0x250d('0x73')]('---------------------------');return new BPromise(function(_0x2b77d6,_0x48e59e){if(_0x3fbecd<=0x0||isNaN(_0x3fbecd)){return _0x48e59e(msgResponse(_0x250d('0x207'),_0x250d('0x17c'),'m\x20=\x20'+_0x3fbecd));}if(_0x23d5c9<=0x0||isNaN(_0x23d5c9)){return _0x48e59e(msgResponse(_0x250d('0x207'),'Error',_0x250d('0x208')+_0x23d5c9));}if(_0x87e427<=0x0||isNaN(_0x87e427)){return _0x48e59e(msgResponse(_0x250d('0x207'),_0x250d('0x17c'),'p\x20=\x20'+_0x87e427));}if(_0x45043d<=0x0||isNaN(_0x45043d)){return _0x48e59e(msgResponse(_0x250d('0x207'),_0x250d('0x17c'),_0x250d('0x209')+_0x45043d));}if(_0x2ba8f6<=0x0||isNaN(_0x2ba8f6)){return _0x48e59e(msgResponse(_0x250d('0x207'),'Error',_0x250d('0x20a')+_0x2ba8f6));}_0x200d76=_0x200d76||0x0;var _0x5bb5b6=0x1/_0x23d5c9;var _0xb9cb43=0x0;var _0x3a322e=0x0;var _0x145d97=0x0;var _0x23bd2b=0x0;for(var _0x2b498f=0x0;_0x145d97<_0x2ba8f6;_0x2b498f+=0x1){_0x3a322e=_0x2b498f/_0x45043d;_0xb9cb43=(_0x87e427*_0x3a322e+_0x200d76)/_0x5bb5b6;_0x145d97=erlangb(_0xb9cb43,_0x3fbecd);_0x23bd2b=_0xb9cb43/_0x3fbecd*(0x1-erlangb(_0xb9cb43,_0x3fbecd));}return _0x2b77d6({'erlangCalls':_0x2b498f,'erlangCallToSecond':_0x45043d/_0x2b498f,'erlangAbandonmentRate':_0x145d97,'erlangBusyFactor':_0x23bd2b});});};Dialer[_0x250d('0x15')]['busyFactor']=function(_0x19a6d1,_0x40d41b,_0x5574ef,_0x50fc5b,_0xa92cf,_0x2cfc47){loggerPredictive[_0x250d('0x73')](_0x250d('0x20b'));loggerPredictive[_0x250d('0x73')]('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',_0x19a6d1);loggerPredictive['info'](_0x250d('0x20c'),_0x40d41b);loggerPredictive[_0x250d('0x73')]('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',_0x5574ef);loggerPredictive['info'](_0x250d('0x205'),_0x50fc5b);loggerPredictive[_0x250d('0x73')](_0x250d('0x20d'),_0xa92cf);loggerPredictive[_0x250d('0x73')](_0x250d('0x79'));return new BPromise(function(_0x14d264,_0x2755e7){if(_0x19a6d1<=0x0||isNaN(_0x19a6d1)){return _0x2755e7(msgResponse(_0x250d('0x20e'),_0x250d('0x17c'),_0x250d('0x20f')+_0x19a6d1));}if(_0x5574ef<=0x0||isNaN(_0x5574ef)){return _0x2755e7(msgResponse(_0x250d('0x20e'),_0x250d('0x17c'),_0x250d('0x208')+_0x5574ef));}if(_0x50fc5b<=0x0||isNaN(_0x50fc5b)){return _0x2755e7(msgResponse(_0x250d('0x20e'),'Error','p\x20=\x20'+_0x50fc5b));}if(_0x40d41b<=0x0||isNaN(_0x40d41b)){return _0x2755e7(msgResponse(_0x250d('0x20e'),_0x250d('0x17c'),_0x250d('0x209')+_0x40d41b));}if(_0xa92cf<=0x0||isNaN(_0xa92cf)){return _0x2755e7(msgResponse('[busyFactor]',_0x250d('0x17c'),_0x250d('0x210')+_0xa92cf));}_0x2cfc47=_0x2cfc47||0x0;var _0x3577bd=0x1/_0x5574ef;var _0x45976d=0x0;var _0x2b70b1=0x0;var _0x4fe315=0x0;var _0x4c726d=0x0;for(var _0x4a4e10=0x0;_0x4c726d<_0xa92cf;_0x4a4e10+=0x1){_0x2b70b1=_0x4a4e10/_0x40d41b;_0x45976d=(_0x50fc5b*_0x2b70b1+_0x2cfc47)/_0x3577bd;_0x4fe315=erlangb(_0x45976d,_0x19a6d1);_0x4c726d=_0x45976d/_0x19a6d1*(0x1-erlangb(_0x45976d,_0x19a6d1));}return _0x14d264({'erlangCalls':_0x4a4e10,'erlangCallToSecond':_0x40d41b/_0x4a4e10,'erlangAbandonmentRate':_0x4fe315,'erlangBusyFactor':_0x4c726d});});};module[_0x250d('0x211')]=Dialer; \ No newline at end of file +var _0x1048=['NOT_ACTIVE','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','sequence','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','[countReScheduled]\x20','checkIsBlackList','resolve','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','reachable','SIP/%s','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','state','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','membername','AMD','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr]','stateGlobal','ContactId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','add','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridnum','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','stateinterface','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','timezones','content','indexOf','iftime\x20%s,%s','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','predictive','booked','Queue','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','checkIfTimeIntervals','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','updatedAt','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialPrefix','dialCutDigit','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','custom:agentnosuchnumber','buildObj','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','emit','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','dialPredictiveOptimizationPercentage','predictiveIntervalPauses','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','[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','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','p\x20=\x20','util','lodash','bluebird','uuid','../../../config/logger','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','message','name','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','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','clearing\x20variable\x20start\x20predictive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive'];(function(_0x4d5d6b,_0x1740ec){var _0x307c7f=function(_0x2fcf9e){while(--_0x2fcf9e){_0x4d5d6b['push'](_0x4d5d6b['shift']());}};_0x307c7f(++_0x1740ec);}(_0x1048,0x186));var _0x8104=function(_0x99d73b,_0x1b0bb5){_0x99d73b=_0x99d73b-0x0;var _0x1f3138=_0x1048[_0x99d73b];return _0x1f3138;};'use strict';var util=require(_0x8104('0x0'));var _=require(_0x8104('0x1'));var BPromise=require(_0x8104('0x2'));var uuid=require(_0x8104('0x3'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x8104('0x4'))('dialer');var loggerBooked=require(_0x8104('0x4'))('booked');var loggerPredictive=require(_0x8104('0x4'))('predictive');var loggerPredictiveCalls=require(_0x8104('0x4'))(_0x8104('0x5'));var loggerSyncQueueSummary=require(_0x8104('0x4'))(_0x8104('0x6'));var ami=require(_0x8104('0x7'));config[_0x8104('0x8')]=_['defaults'](config[_0x8104('0x8')],{'host':_0x8104('0x9'),'port':0x18eb});var io=require(_0x8104('0xa'))(new Redis(config[_0x8104('0x8')]));var cmHopper=require(_0x8104('0xb'));var cmHopperFinal=require(_0x8104('0xc'));var cmHopperHistory=require(_0x8104('0xd'));var cmHopperBlack=require(_0x8104('0xe'));var voiceQueueRt=require(_0x8104('0xf'));var Action=require(_0x8104('0x10'));var History=require(_0x8104('0x11'));var Final=require('./final');var AgentComplete=require(_0x8104('0x12'));var QueueCallerAbandon=require(_0x8104('0x13'));var Hangup=require(_0x8104('0x14'));var ipAgi=process[_0x8104('0x15')][_0x8104('0x16')]||_0x8104('0x17');var strategy={'rrmemory':_0x8104('0x18'),'roundrobin':_0x8104('0x19')};var Sequence=function(){};Sequence[_0x8104('0x1a')][_0x8104('0x1b')]=function(_0x3fb5f6){this['tail']=this['tail']?this[_0x8104('0x1c')][_0x8104('0x1d')](_0x3fb5f6):_0x3fb5f6();};function Dialer(_0x2dd7a8,_0x112ae2){this['sequence']=new Sequence();this[_0x8104('0x1e')]=_0x112ae2;this[_0x8104('0x1f')]=_0x2dd7a8['voiceQueues'];this[_0x8104('0x20')]=_0x2dd7a8[_0x8104('0x20')];this[_0x8104('0x21')]=_0x2dd7a8[_0x8104('0x21')];this[_0x8104('0x22')]=_0x2dd7a8[_0x8104('0x22')];this[_0x8104('0x23')]=config[_0x8104('0x23')]||0x2;this[_0x8104('0x24')]={};this['actions']={};this[_0x8104('0x25')]={};this[_0x8104('0x26')]={};this[_0x8104('0x27')]={};this[_0x8104('0x28')]={};this[_0x8104('0x29')]={};this[_0x8104('0x2a')]={};this[_0x8104('0x2b')]={};this[_0x8104('0x2c')]={};ami['on'](_0x8104('0x2d'),this[_0x8104('0x2e')][_0x8104('0x2f')](this));ami['on'](_0x8104('0x30'),this['syncQueueCallerAbandon'][_0x8104('0x2f')](this));ami['on']('originateresponse',this[_0x8104('0x31')][_0x8104('0x2f')](this));ami['on'](_0x8104('0x32'),this[_0x8104('0x33')][_0x8104('0x2f')](this));ami['on']('custom:queuesummary',this[_0x8104('0x6')]['bind'](this));ami['on'](_0x8104('0x34'),this[_0x8104('0x35')][_0x8104('0x2f')](this));ami['on'](_0x8104('0x36'),this[_0x8104('0x37')][_0x8104('0x2f')](this));ami['on'](_0x8104('0x38'),this[_0x8104('0x39')][_0x8104('0x2f')](this));ami['on'](_0x8104('0x3a'),this['syncQueueMember']['bind'](this));ami['on'](_0x8104('0x3b'),this['syncQueueStatusComplete'][_0x8104('0x2f')](this));this[_0x8104('0x3c')]();this[_0x8104('0x3d')]();}function isNotNull(_0x21efa3){return _0x21efa3!==null&&!_[_0x8104('0x3e')](_0x21efa3);}function checkIsLoggedIn(_0x288720,_0x4d171b){return function(){if(_0x4d171b<=0x0){_0x288720['message']=_0x8104('0x3f');throw _0x288720['name']+_0x8104('0x40');}};}function isActive(_0x9986c2){return _0x9986c2;}function checkIsActive(_0x22096a,_0x31ddd4){return function(){if(!isActive(_0x31ddd4)){_0x22096a[_0x8104('0x41')]='NOT_ACTIVE';throw _0x22096a[_0x8104('0x42')]+_0x8104('0x43');}};}function checkInterval(_0x392650){return function(){if(!isNotNull(_0x392650[_0x8104('0x44')])){_0x392650[_0x8104('0x41')]='INTERVAL_IS_NULL';throw _0x392650[_0x8104('0x42')]+_0x8104('0x45');}if(!isNotNull(_0x392650[_0x8104('0x44')][_0x8104('0x46')])){_0x392650[_0x8104('0x41')]=_0x8104('0x47');throw _0x392650[_0x8104('0x42')]+_0x8104('0x45');}if(!isNotNull(_['isEmpty'](_0x392650[_0x8104('0x44')][_0x8104('0x46')]))){_0x392650[_0x8104('0x41')]=_0x8104('0x47');throw _0x392650['name']+_0x8104('0x45');}};}function msgResponse(_0x2844f7,_0x23c045,_0x51c7ee){return{'action':_0x2844f7,'response':_0x23c045,'message':_0x51c7ee,'stack':_0x51c7ee};}function myreject(_0x14a16e){return function(_0x2fecc8){return _0x14a16e(msgResponse(_0x8104('0x48'),_0x8104('0x49'),JSON[_0x8104('0x4a')](_0x2fecc8)));};}function getSeconds(_0x2d4d82,_0xf700fa){var _0x40f6b8=moment(_0x2d4d82)[_0x8104('0x4b')](0x0);var _0x5d4f7d=moment(_0xf700fa)['milliseconds'](0x0);return _0x40f6b8[_0x8104('0x4c')](_0x5d4f7d,_0x8104('0x4d'));}function emit(_0x4a63c1,_0x5d089f,_0x52341a){io['to'](_0x4a63c1)['emit'](_0x5d089f,_0x52341a);}function emitVoiceQueueSummary(_0x34136f){if(_0x34136f[_0x8104('0x4e')]===_0x8104('0x4f')){var _0x5ea16e={'id':_0x34136f['id'],'name':_0x34136f[_0x8104('0x42')],'strategy':_0x34136f[_0x8104('0x50')],'answered':_0x34136f['answered'],'available':_0x34136f[_0x8104('0x51')],'loggedIn':_0x34136f[_0x8104('0x52')],'pTalking':_0x34136f[_0x8104('0x53')],'sumBillable':_0x34136f[_0x8104('0x54')],'sumDuration':_0x34136f['sumDuration'],'sumHoldTime':_0x34136f[_0x8104('0x55')]||0x0,'talking':_0x34136f[_0x8104('0x56')],'total':_0x34136f[_0x8104('0x57')],'type':_0x34136f[_0x8104('0x4e')],'unmanaged':_0x34136f[_0x8104('0x58')],'abandoned':_0x34136f[_0x8104('0x59')],'waiting':_0x34136f[_0x8104('0x5a')],'loggedInDb':_0x34136f['loggedInDb'],'dialActive':_0x34136f[_0x8104('0x5b')],'dialMethod':_0x34136f[_0x8104('0x5c')],'dialOriginateCallerIdName':_0x34136f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x34136f[_0x8104('0x5d')],'dialOriginateTimeout':_0x34136f[_0x8104('0x5e')],'dialPrefix':_0x34136f['dialPrefix'],'outboundAnswerAgiCallsDay':_0x34136f[_0x8104('0x5f')],'outboundAnswerCallsDay':_0x34136f['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x34136f['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x34136f['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x34136f[_0x8104('0x60')],'outboundDropCallsDayACS':_0x34136f['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x34136f[_0x8104('0x61')],'outboundDropCallsDayTimeout':_0x34136f['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x34136f[_0x8104('0x62')],'outboundNoSuchCallsDay':_0x34136f[_0x8104('0x63')],'outboundOriginateFailureCallsDay':_0x34136f['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x34136f['outboundReCallsDay'],'outboundRejectCallsDay':_0x34136f['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x34136f[_0x8104('0x64')],'predictiveIntervalAnsweredCalls':_0x34136f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x34136f[_0x8104('0x65')],'predictiveIntervalAvgTalktime':_0x34136f[_0x8104('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x34136f[_0x8104('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x34136f['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x34136f[_0x8104('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x34136f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x34136f[_0x8104('0x69')],'predictiveIntervalMultiplicativeFactor':_0x34136f[_0x8104('0x6a')],'predictiveIntervalPauses':_0x34136f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x34136f[_0x8104('0x6b')],'predictiveIntervalTotalCalls':_0x34136f[_0x8104('0x6c')],'message':_0x34136f[_0x8104('0x41')],'originated':_0x34136f[_0x8104('0x6d')],'erlangCalls':_0x34136f[_0x8104('0x6e')],'erlangCallToSecond':_0x34136f[_0x8104('0x6f')],'erlangAbandonmentRate':_0x34136f['erlangAbandonmentRate'],'erlangBusyFactor':_0x34136f[_0x8104('0x70')],'startPredictive':_0x34136f['startPredictive'],'startProgressive':_0x34136f[_0x8104('0x29')]};if(_0x34136f[_0x8104('0x71')]){_0x5ea16e['Trunk']={'id':_0x34136f['Trunk']['id'],'name':_0x34136f[_0x8104('0x71')][_0x8104('0x42')],'active':_0x34136f['Trunk'][_0x8104('0x72')],'callerid':_0x34136f[_0x8104('0x71')][_0x8104('0x73')]};}if(_0x34136f[_0x8104('0x44')]){_0x5ea16e['Interval']={'id':_0x34136f[_0x8104('0x44')]['id'],'name':_0x34136f[_0x8104('0x44')][_0x8104('0x42')]};}var _0x333bfe=md5(JSON[_0x8104('0x4a')](_0x5ea16e));if(_0x34136f[_0x8104('0x74')]!==_0x333bfe){_0x34136f['md5']=_0x333bfe;emit(util[_0x8104('0x75')](_0x8104('0x76'),_0x5ea16e[_0x8104('0x42')]),_0x8104('0x77'),_0x5ea16e);}}}function emitCampaignSummary(_0x3ceb35){if(_0x3ceb35[_0x8104('0x4e')]==='ivr'){emit(util[_0x8104('0x75')](_0x8104('0x78'),_0x3ceb35[_0x8104('0x42')]),_0x8104('0x79'),_0x3ceb35);}}function checkGetDataPredictive(_0x281a48){if(isNotNull(_0x281a48)){if(!_[_0x8104('0x7a')](_0x281a48)){loggerPredictive['info'](_0x8104('0x7b'));loggerPredictive[_0x8104('0x7c')](_0x8104('0x7d'),_0x281a48['predictiveIntervalTotalCalls']);loggerPredictive[_0x8104('0x7c')](_0x8104('0x7e'),_0x281a48[_0x8104('0x7f')]);loggerPredictive['info'](_0x8104('0x80'),_0x281a48['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x8104('0x81'),_0x281a48['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x281a48[_0x8104('0x65')]);loggerPredictive[_0x8104('0x7c')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x281a48['predictiveIntervalAvgTalktime']);loggerPredictive[_0x8104('0x7c')](_0x8104('0x82'));if(_0x281a48[_0x8104('0x6c')]>0x0){if(!_[_0x8104('0x3e')](_0x281a48[_0x8104('0x66')])&&_0x281a48[_0x8104('0x66')]>0x0){return!![];}else{loggerPredictive[_0x8104('0x7c')](_0x8104('0x83'));}if(!_[_0x8104('0x3e')](_0x281a48[_0x8104('0x65')])&&_0x281a48['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x8104('0x7c')](_0x8104('0x84'));}}else{loggerPredictive[_0x8104('0x7c')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x8104('0x7c')](_0x8104('0x85'));}}else{loggerPredictive[_0x8104('0x7c')](_0x8104('0x85'));}return![];}function mergeDataErlangB(_0x144590){return function(_0x26d173){loggerPredictive[_0x8104('0x7c')](_0x8104('0x86'));loggerPredictive[_0x8104('0x7c')](_0x8104('0x87'),_0x26d173[_0x8104('0x6e')]);loggerPredictive[_0x8104('0x7c')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x26d173[_0x8104('0x6f')]);loggerPredictive[_0x8104('0x7c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x26d173[_0x8104('0x88')]);loggerPredictive['info'](_0x8104('0x89'),_0x26d173['erlangBusyFactor']);loggerPredictive[_0x8104('0x7c')](_0x8104('0x8a'),_0x26d173[_0x8104('0x88')]);loggerPredictive[_0x8104('0x7c')](_0x8104('0x82'));_[_0x8104('0x8b')](_0x144590,_0x26d173);};}function getDiff(_0x30d292){var _0x3e03e7=moment()['milliseconds'](0x0);var _0x41a44f=moment(_0x30d292)['milliseconds'](0x0);return _0x3e03e7[_0x8104('0x4c')](_0x41a44f,_0x8104('0x4d'));}function ifInterval(_0x489578,_0x1860ba){if(_[_0x8104('0x3e')](_0x1860ba)){return![];}if(getDiff(_0x1860ba)<_0x489578*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x185c80){if(isNotNull(_0x185c80)){if(!_[_0x8104('0x3e')](_0x185c80[_0x8104('0x29')])){_0x185c80[_0x8104('0x29')]=undefined;loggerPredictive[_0x8104('0x7c')](_0x185c80[_0x8104('0x42')],_0x8104('0x8c'));}if(!_['isUndefined'](_0x185c80[_0x8104('0x28')])){_0x185c80['startPredictive']=undefined;loggerPredictive[_0x8104('0x7c')](_0x185c80['name'],_0x8104('0x8d'));}if(!_[_0x8104('0x3e')](_0x185c80[_0x8104('0x8e')])){clearInterval(_0x185c80[_0x8104('0x8e')]);_0x185c80[_0x8104('0x8e')]=undefined;loggerPredictive[_0x8104('0x7c')](_0x185c80[_0x8104('0x42')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0xaf36b3,_0x4ee59f){if(_0x4ee59f===0x0){return 0x0;}var _0x4cd7d2=0x1;for(var _0x1be545=0x1;_0x1be545<=_0x4ee59f;_0x1be545+=0x1){_0x4cd7d2=0x1+_0x4cd7d2*_0x1be545/_0xaf36b3;}return 0x1/_0x4cd7d2;}function isVoiceQueueOutbound(_0x946217){return _0x946217===_0x8104('0x4f');}function isNotPreview(_0x3f2bb0){return _0x3f2bb0!==_0x8104('0x1e');}function isCampaignIvr(_0x233a8f){return _0x233a8f===_0x8104('0x8f');}function getCallerId(_0x15431d,_0x397bfd,_0x418ff0){if(!_['isUndefined'](_0x418ff0)&&_0x8104('0x90')===typeof _0x418ff0&&!_['isEmpty'](_0x418ff0)){if(!_[_0x8104('0x3e')](_0x397bfd)&&_0x8104('0x90')===typeof _0x397bfd&&!_[_0x8104('0x7a')](_0x397bfd)){return util[_0x8104('0x75')]('\x22%s\x22\x20<%s>',_0x397bfd,_0x418ff0);}return util[_0x8104('0x75')](_0x8104('0x91'),_0x418ff0,_0x418ff0);}if(!_[_0x8104('0x3e')](_0x15431d)&&_0x8104('0x90')===typeof _0x15431d&&!_[_0x8104('0x7a')](_0x15431d)){return _0x15431d;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x2fbb39,_0x949220){return function(_0x93876c){freeVariablesPredictive(_0x949220);emitVoiceQueueSummary(_0x949220);emitCampaignSummary(_0x949220);loggerSyncQueueSummary[_0x8104('0x92')](_0x2fbb39,util[_0x8104('0x93')](_0x93876c,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3ed1d4,_0x3c5b47){return function(_0x27fe57){loggerPredictive[_0x8104('0x92')](_0x3c5b47[_0x8104('0x42')],_0x3ed1d4);loggerPredictive[_0x8104('0x92')](_0x27fe57[_0x8104('0x94')]);freeVariablesPredictive(_0x3c5b47);};}function loggerCatch(_0x58e84a){return function(_0x451f12){logger[_0x8104('0x92')](_0x58e84a,util['inspect'](_0x451f12,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4539a7){return _0x4539a7&&!_[_0x8104('0x3e')](_0x4539a7)&&_0x4539a7[_0x8104('0x95')]>0x0;}function decremetOriginate(_0xdbd8e8){if(!_['isUndefined'](_0xdbd8e8)&&_0xdbd8e8!==null){if(_0xdbd8e8[_0x8104('0x96')](_0x8104('0x6d'))){if(_0xdbd8e8['originated']>0x0){_0xdbd8e8[_0x8104('0x6d')]-=0x1;}else{logger[_0x8104('0x92')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x8104('0x92')](_0x8104('0x97'));}}function checkContactLowerLimitOriginate(_0x15ce0b,_0x18bb88,_0x1adb9d){if(_0x18bb88>_0x1adb9d){for(var _0x26a7ae=0x0;_0x26a7ae<_0x18bb88-_0x1adb9d;_0x26a7ae+=0x1){decremetOriginate(_0x15ce0b);}}}function loggerGetContactDialer(_0x12307f,_0x4fd010,_0x40c003){return function(_0x4c8b82){checkContactLowerLimitOriginate(_0x4fd010,_0x40c003,0x0);logger[_0x8104('0x92')](_0x12307f,util[_0x8104('0x93')](_0x4c8b82,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x196b4){return function(_0x4cec95){if(isNotNull(_0x4cec95)&&isNotNull(_0x4cec95[0x0])){if(_0x4cec95[0x0][_0x8104('0x98')]>0x0){_0x196b4[_0x8104('0x41')]=_0x8104('0x99');logger[_0x8104('0x7c')](_0x8104('0x9a')+_0x196b4[_0x8104('0x42')],_0x4cec95[0x0][_0x8104('0x98')],_0x8104('0x9b'));}else{_0x196b4[_0x8104('0x41')]=_0x8104('0x9c');logger['info'](_0x8104('0x9d')+_0x196b4[_0x8104('0x42')]);}}};}function notSendMessagesQueue(_0x4a8171){if(_0x4a8171['sendMessageOneNotActive']){freeVariablesPredictive(_0x4a8171);if(_0x4a8171['originated']===0x0&&_0x4a8171[_0x8104('0x56')]===0x0&&_0x4a8171[_0x8104('0x5a')]===0x0&&(_0x4a8171[_0x8104('0x53')]||0x0)===0x0){_0x4a8171[_0x8104('0x9e')]=![];_0x4a8171['available']=0x0;_0x4a8171[_0x8104('0x41')]=_0x8104('0x9f');loggerSyncQueueSummary[_0x8104('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4a8171[_0x8104('0x42')],_0x8104('0xa0'));}else{_0x4a8171[_0x8104('0x41')]=_0x8104('0xa1');loggerSyncQueueSummary[_0x8104('0x92')](_0x8104('0xa2'),_0x4a8171[_0x8104('0x42')],_0x8104('0xa3'));}emitVoiceQueueSummary(_0x4a8171);}}function notSendMessagesCampaign(_0x108c69){if(_0x108c69[_0x8104('0x9e')]){if(_0x108c69[_0x8104('0x6d')]===0x0){_0x108c69[_0x8104('0x9e')]=![];_0x108c69[_0x8104('0x41')]=_0x8104('0x9f');loggerSyncQueueSummary['error'](_0x8104('0xa4'),_0x108c69['name'],'is\x20not\x20active');}else{_0x108c69[_0x8104('0x41')]=_0x8104('0xa1');loggerSyncQueueSummary[_0x8104('0x92')](_0x8104('0xa4'),_0x108c69['name'],'is\x20disactive');}emitCampaignSummary(_0x108c69);}}function createObjHistory(_0x3e488d,_0x348d40,_0x34d37c,_0x3eec60,_0x26e693){_0x3e488d[_0x8104('0x41')]=_0x34d37c;var _0x252fbe=new Action(_0x3e488d,_0x348d40);var _0x2aceb5=new History(_0x252fbe);_0x2aceb5['state']=_0x3eec60;_0x2aceb5[_0x8104('0xa5')]=_0x26e693;_0x2aceb5[_0x8104('0xa6')]=_0x252fbe[_0x8104('0xa7')];return _0x2aceb5;}Dialer[_0x8104('0x1a')][_0x8104('0x3d')]=function(){var _0xd6d28b=this;setInterval(function(){_0xd6d28b[_0x8104('0xa8')](_0xd6d28b[_0x8104('0x26')],_0x8104('0xa9'));_0xd6d28b['clearZombieChannels'](_0xd6d28b[_0x8104('0xaa')],'[actions]');},0x32c8);};Dialer[_0x8104('0x1a')][_0x8104('0xa8')]=function(_0x97113d,_0x5bd2e2){var _0x18e6f4=this;for(var _0x50ba49 in _0x97113d){if(_0x97113d[_0x8104('0x96')](_0x50ba49)){this[_0x8104('0xab')][_0x8104('0x1b')](function(){if(!_[_0x8104('0xac')](_0x97113d[_0x50ba49])){return ami[_0x8104('0xad')]({'action':_0x8104('0xae'),'channel':_0x97113d[_0x50ba49][_0x8104('0xaf')]})['catch'](function(_0x4c78cd){if(_0x4c78cd['message']===_0x8104('0xb0')){setTimeout(function(){if(_0x97113d[_0x50ba49]&&_0x97113d[_0x50ba49][_0x8104('0x4e')]!==_0x8104('0x8f')){_0x18e6f4[_0x8104('0xb1')](_0x18e6f4[_0x8104('0x1f')][_0x97113d[_0x50ba49][_0x8104('0xb2')]]);logger[_0x8104('0x92')](_0x8104('0xb3'),_0x5bd2e2,_0x50ba49,_0x97113d[_0x50ba49]['queue']);delete _0x97113d[_0x50ba49];}if(_0x97113d[_0x50ba49]&&_0x97113d[_0x50ba49]['type']===_0x8104('0x8f')){_0x18e6f4[_0x8104('0xb1')](_0x18e6f4[_0x8104('0x20')][_0x97113d[_0x50ba49][_0x8104('0xb2')]]);logger[_0x8104('0x92')](_0x8104('0xb4'),_0x5bd2e2,_0x50ba49,_0x97113d[_0x50ba49][_0x8104('0xb2')]);delete _0x97113d[_0x50ba49];}},0x2328);}});}});}}};Dialer['prototype'][_0x8104('0xb5')]=function(_0x221b33){return BPromise['resolve']()[_0x8104('0xb6')](cmHopper['countReScheduled'](_0x221b33))[_0x8104('0xb7')](loggerCatch(_0x8104('0xb8')));};Dialer[_0x8104('0x1a')][_0x8104('0xb9')]=function(_0x571143){return BPromise[_0x8104('0xba')]()['then'](cmHopperBlack[_0x8104('0xb9')](_0x571143))[_0x8104('0xb7')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x8104('0xbb')]=function(_0x997609){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopperBlack[_0x8104('0xbb')](_0x997609))[_0x8104('0xb7')](loggerCatch(_0x8104('0xbc')));};Dialer[_0x8104('0x1a')]['averageHandleTime']=function(_0x55da38){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopperHistory[_0x8104('0xbd')](_0x55da38))[_0x8104('0xb7')](loggerCatch(_0x8104('0xbe')));};Dialer[_0x8104('0x1a')][_0x8104('0xbf')]=function(_0x146460){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopper[_0x8104('0xbf')](_0x146460))['catch'](loggerCatch(_0x8104('0xc0')));};Dialer[_0x8104('0x1a')]['unlockContact']=function(_0x41010a,_0x1d5bfa,_0x3e28da){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopper[_0x8104('0xc1')](_0x41010a,_0x1d5bfa,_0x3e28da))['catch'](loggerCatch(_0x8104('0xc2')));};Dialer[_0x8104('0x1a')][_0x8104('0xc3')]=function(_0x5b4622,_0x37f40c,_0x1a2016,_0x4ca9d1){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopper['getContactDialer'](_0x5b4622,_0x37f40c,_0x1a2016,_0x4ca9d1))[_0x8104('0xb7')](loggerCatch(_0x8104('0xc4')));};Dialer['prototype']['getContactDialerIvr']=function(_0x4ac4a1,_0x2a91bb,_0x161d6b){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopper['getContactDialerIvr'](_0x4ac4a1,_0x2a91bb,_0x161d6b))[_0x8104('0xb7')](loggerCatch('[getContactDialer]\x20'));};Dialer['prototype'][_0x8104('0xc5')]=function(_0x5ce8d6){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5ce8d6))[_0x8104('0xb7')](loggerCatch(_0x8104('0xc6')));};Dialer[_0x8104('0x1a')][_0x8104('0xc7')]=function(_0x8e7d77){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopper[_0x8104('0xc7')](_0x8e7d77))[_0x8104('0xb7')](loggerCatch(_0x8104('0xc8')));};Dialer['prototype']['createHistory']=function(_0x14b431){return BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](cmHopperHistory[_0x8104('0xc9')](_0x14b431))[_0x8104('0xb7')](loggerCatch(_0x8104('0xca')));};Dialer[_0x8104('0x1a')][_0x8104('0xb1')]=function(_0x569c3d){if(!_[_0x8104('0x3e')](_0x569c3d)&&_0x569c3d!==null){if(_0x569c3d[_0x8104('0x96')](_0x8104('0x6d'))){if(_0x569c3d[_0x8104('0x6d')]>0x0){_0x569c3d['originated']-=0x1;}else{logger[_0x8104('0x92')](_0x8104('0xcb'));}}}else{logger[_0x8104('0x92')](_0x8104('0xcc'));}};Dialer[_0x8104('0x1a')][_0x8104('0xcd')]=function(_0x5988b2,_0x1f5cc4){var _0x4a5f31=this;return function(_0x4d4b40){_0x4a5f31[_0x8104('0xb1')](_0x1f5cc4);logger[_0x8104('0x92')](_0x5988b2,util[_0x8104('0x93')](_0x4d4b40,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x8104('0xce')]=function(_0x4cbbe0,_0xe0e8ea,_0x3a99ea){var _0x3cbeb3={'state':0x19,'statedesc':_0x8104('0xcf')};this['updateOriginated'](_0xe0e8ea);this[_0x8104('0xd0')](_[_0x8104('0x8b')](_0x3cbeb3,_[_0x8104('0xd1')](_0x3a99ea,['ContactId',_0x8104('0xd2'),_0x8104('0xd3'),_0x8104('0xd4'),_0x8104('0xd5')])),'[emptyContact][createHistory]',_0x8104('0xd6'));logger[_0x8104('0x92')](_0x4cbbe0);};Dialer[_0x8104('0x1a')][_0x8104('0xd7')]=function(_0x3ccbb8){return _0x3ccbb8===_0x8104('0xd8');};Dialer['prototype']['isTrunkReachable']=function(_0x57c66c){return!_['isUndefined'](_0x57c66c)&&_0x57c66c&&!_['isUndefined'](_0x57c66c[_0x8104('0x42')])&&!_[_0x8104('0x3e')](_0x57c66c[_0x8104('0x72')])&&_0x57c66c['active']&&(this[_0x8104('0x22')][util[_0x8104('0x75')]('SIP/%s',_0x57c66c[_0x8104('0x42')])][_0x8104('0xae')]===_0x8104('0xd9')||this[_0x8104('0x22')][util[_0x8104('0x75')](_0x8104('0xda'),_0x57c66c['name'])][_0x8104('0xae')]==='unmonitored');};Dialer[_0x8104('0x1a')]['saveInDb']=function(_0x3e5c37,_0x498e28,_0x4d9b5e){this[_0x8104('0xc9')](_0x3e5c37)[_0x8104('0xb7')](loggerCatch(_0x498e28));this[_0x8104('0xc7')](_0x3e5c37)[_0x8104('0xb7')](loggerCatch(_0x4d9b5e));};Dialer[_0x8104('0x1a')][_0x8104('0x39')]=function(_0x2b5f86){var _0x56827d=this[_0x8104('0x26')][_0x2b5f86[_0x8104('0xdb')]];var _0x4b51cf;if(!_[_0x8104('0xac')](_0x2b5f86)&&!_[_0x8104('0xac')](_0x2b5f86[_0x8104('0xdc')])&&!_[_0x8104('0xac')](_0x2b5f86[_0x8104('0xdc')][_0x8104('0xdd')])&&_0x2b5f86['exten']===_0x8104('0xde')&&_0x56827d){if(_0x56827d[_0x8104('0x4e')]!=='ivr'&&this['voiceQueues'][_0x56827d[_0x8104('0xb2')]][_0x8104('0xdf')]&&_0x2b5f86['value']===_0x8104('0xe0')){delete this[_0x8104('0x26')][_0x2b5f86['uniqueid']];this[_0x8104('0xb1')](this[_0x8104('0x1f')][_0x56827d[_0x8104('0xb2')]]);this[_0x8104('0x1f')][_0x56827d[_0x8104('0xb2')]][_0x8104('0xe1')]+=0x1;this[_0x8104('0x1f')][_0x56827d[_0x8104('0xb2')]][_0x8104('0x5f')]+=0x1;_0x4b51cf=new Hangup(_0x56827d,_0x2b5f86);_0x4b51cf[_0x8104('0xe2')]=0x12;_0x4b51cf[_0x8104('0xa5')]='HangupInAMD';_0x4b51cf['membername']='AMD';this['saveInDb'](_0x4b51cf,_0x8104('0xe3'),_0x8104('0xe4'));}if(_0x56827d['type']!=='ivr'&&this[_0x8104('0x1f')][_0x56827d[_0x8104('0xb2')]][_0x8104('0xdf')]&&_0x2b5f86[_0x8104('0xe5')]===_0x8104('0xe6')){var _0x569442=this;return new BPromise(function(_0x3db4e5,_0x1d681e){delete _0x569442[_0x8104('0x26')][_0x2b5f86[_0x8104('0xdb')]];_0x569442['updateOriginated'](_0x569442[_0x8104('0x1f')][_0x56827d['queue']]);_0x569442[_0x8104('0x1f')][_0x56827d['queue']][_0x8104('0xe1')]+=0x1;_0x569442[_0x8104('0x1f')][_0x56827d[_0x8104('0xb2')]][_0x8104('0x5f')]+=0x1;var _0x4c3c0c=_0x569442['voiceQueues'][_0x56827d[_0x8104('0xb2')]];var _0x2f6c56=new Hangup(_0x56827d,_0x2b5f86);_0x2f6c56[_0x8104('0xe2')]=0x13;_0x2f6c56[_0x8104('0xa5')]=_0x8104('0xe7');_0x2f6c56[_0x8104('0xe8')]=_0x8104('0xe9');_0x2f6c56[_0x8104('0xea')]+=0x1;_0x2f6c56[_0x8104('0xeb')]+=0x1;_0x2f6c56[_0x8104('0xec')]=!![];_0x569442[_0x8104('0xc9')](_0x2f6c56)[_0x8104('0xb7')](loggerCatch(_0x8104('0xed')));if(_0x2f6c56[_0x8104('0xee')]+_0x2f6c56[_0x8104('0xef')]+_0x2f6c56[_0x8104('0xf0')]+_0x2f6c56[_0x8104('0xf1')]+_0x2f6c56[_0x8104('0xf2')]+_0x2f6c56[_0x8104('0xf3')]+_0x2f6c56[_0x8104('0xea')]+_0x2f6c56[_0x8104('0xf4')]>=_0x4c3c0c[_0x8104('0xf5')]){_0x569442['stateGlobal'](_0x2f6c56,_0x3db4e5,_0x1d681e,_0x8104('0xf6'));}else{if(_0x2f6c56[_0x8104('0xea')]>=_0x4c3c0c[_0x8104('0xf7')]){_0x569442[_0x8104('0xf8')](_0x2f6c56,_0x3db4e5,_0x1d681e,_0x8104('0xf9'));}else{_0x569442[_0x8104('0xbf')]({'active':![],'countmachineretry':_0x2f6c56['countmachineretry'],'scheduledat':moment()['add'](_0x4c3c0c[_0x8104('0xfa')],_0x8104('0xfb'))[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x2f6c56['ContactId'],'ListId':_0x2f6c56[_0x8104('0xd2')],'VoiceQueueId':_0x2f6c56[_0x8104('0xd4')]||undefined,'CampaignId':_0x2f6c56[_0x8104('0xd5')]||undefined})['catch'](loggerCatch(_0x8104('0xfd')));_0x3db4e5({'reschedule':0x1});}}});}if(_0x56827d['type']===_0x8104('0x8f')&&this[_0x8104('0x20')][_0x56827d['queue']]['dialAMDActive']&&_0x2b5f86[_0x8104('0xe5')]==='HANGUP'){delete this[_0x8104('0x26')][_0x2b5f86['uniqueid']];this['updateOriginated'](this['campaigns'][_0x56827d[_0x8104('0xb2')]]);_0x4b51cf=new Hangup(_0x56827d,_0x2b5f86);_0x4b51cf[_0x8104('0xe2')]=0x12;_0x4b51cf[_0x8104('0xa5')]=_0x8104('0xfe');_0x4b51cf[_0x8104('0xe8')]=_0x8104('0xe9');this[_0x8104('0xd0')](_0x4b51cf,'[syncHangupInAMDIvr][createHistory]',_0x8104('0xff'));}if(_0x56827d[_0x8104('0x4e')]===_0x8104('0x8f')&&this[_0x8104('0x20')][_0x56827d[_0x8104('0xb2')]][_0x8104('0xdf')]&&_0x2b5f86[_0x8104('0xe5')]===_0x8104('0xe6')){var _0x569442=this;return new BPromise(function(_0x198718,_0x165d78){delete _0x569442[_0x8104('0x26')][_0x2b5f86[_0x8104('0xdb')]];_0x569442[_0x8104('0xb1')](_0x569442['campaigns'][_0x56827d[_0x8104('0xb2')]]);_0x569442['campaigns'][_0x56827d['queue']][_0x8104('0xe1')]+=0x1;_0x569442[_0x8104('0x20')][_0x56827d[_0x8104('0xb2')]][_0x8104('0x5f')]+=0x1;var _0x357e56=_0x569442[_0x8104('0x20')][_0x56827d['queue']];var _0x42182c=new Hangup(_0x56827d,_0x2b5f86);_0x42182c[_0x8104('0xe2')]=0x13;_0x42182c['statedesc']=_0x8104('0xe7');_0x42182c['membername']=_0x8104('0xe9');_0x42182c[_0x8104('0xea')]+=0x1;_0x42182c[_0x8104('0xeb')]+=0x1;_0x42182c[_0x8104('0xec')]=!![];_0x569442[_0x8104('0xc9')](_0x42182c)['catch'](loggerCatch(_0x8104('0xed')));if(_0x42182c[_0x8104('0xee')]+_0x42182c[_0x8104('0xef')]+_0x42182c[_0x8104('0xf0')]+_0x42182c['countnosuchnumberretry']+_0x42182c[_0x8104('0xf2')]+_0x42182c[_0x8104('0xf3')]+_0x42182c[_0x8104('0xea')]+_0x42182c[_0x8104('0xf4')]>=_0x357e56[_0x8104('0xf5')]){_0x569442[_0x8104('0x100')](_0x42182c,_0x198718,_0x165d78,'reason19\x20machine....');}else{if(_0x42182c[_0x8104('0xea')]>=_0x357e56[_0x8104('0xf7')]){_0x569442['createStateFinal'](_0x42182c,_0x198718,_0x165d78,_0x8104('0xf9'));}else{_0x569442[_0x8104('0xbf')]({'active':![],'countmachineretry':_0x42182c['countmachineretry'],'scheduledat':moment()['add'](_0x357e56[_0x8104('0xfa')],_0x8104('0xfb'))[_0x8104('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x42182c[_0x8104('0x101')],'ListId':_0x42182c['ListId'],'VoiceQueueId':_0x42182c[_0x8104('0xd4')]||undefined,'CampaignId':_0x42182c[_0x8104('0xd5')]||undefined})['catch'](loggerCatch(_0x8104('0xfd')));_0x198718({'reschedule':0x1});}}});}}};Dialer[_0x8104('0x1a')][_0x8104('0x35')]=function(_0x46615b){var _0x561895=this[_0x8104('0x26')][_0x46615b[_0x8104('0xdb')]];var _0x590eb4=this;var _0xb3d090;if(_0x561895&&_0x561895[_0x8104('0x4e')]===_0x8104('0x8f')){delete this[_0x8104('0x26')][_0x46615b[_0x8104('0xdb')]];this[_0x8104('0xb1')](this['campaigns'][_0x561895[_0x8104('0xb2')]]);this[_0x8104('0x20')][_0x561895[_0x8104('0xb2')]][_0x8104('0x102')]+=0x1;_0xb3d090=new Hangup(_0x561895,_0x46615b);this[_0x8104('0xc9')](_0xb3d090)[_0x8104('0xb7')](loggerCatch(_0x8104('0x103')));this[_0x8104('0xc7')](_0xb3d090)['catch'](loggerCatch(_0x8104('0x104')));}if(_0x561895&&_0x561895[_0x8104('0x4e')]!==_0x8104('0x8f')&&isNotNull(this[_0x8104('0x1f')][_0x561895[_0x8104('0xb2')]][_0x8104('0x105')])){delete this[_0x8104('0x26')][_0x46615b[_0x8104('0xdb')]];this[_0x8104('0xb1')](this[_0x8104('0x1f')][_0x561895[_0x8104('0xb2')]]);this[_0x8104('0x1f')][_0x561895[_0x8104('0xb2')]][_0x8104('0xe1')]+=0x1;this[_0x8104('0x1f')][_0x561895[_0x8104('0xb2')]][_0x8104('0x5f')]+=0x1;_0xb3d090=new Hangup(_0x561895,_0x46615b);_0xb3d090['state']=0x10;_0xb3d090[_0x8104('0xa5')]=_0x8104('0x106');_0xb3d090['membername']=_0x8104('0x107');this[_0x8104('0xc9')](_0xb3d090)['catch'](loggerCatch(_0x8104('0x103')));this[_0x8104('0xc7')](_0xb3d090)[_0x8104('0xb7')](loggerCatch(_0x8104('0x104')));}if(_0x561895&&_0x561895[_0x8104('0x4e')]!==_0x8104('0x8f')&&!isNotNull(this['voiceQueues'][_0x561895[_0x8104('0xb2')]]['dialQueueProject'])){delete this[_0x8104('0x26')][_0x46615b[_0x8104('0xdb')]];this[_0x8104('0xb1')](this[_0x8104('0x1f')][_0x561895['queue']]);this[_0x8104('0x1f')][_0x561895['queue']][_0x8104('0x64')]+=0x1;_0xb3d090=new Hangup(_0x561895,_0x46615b);_0xb3d090['state']=0xc;_0xb3d090[_0x8104('0xa5')]=_0x46615b[_0x8104('0x108')];_0xb3d090[_0x8104('0xe8')]=_0x8104('0x109');this[_0x8104('0xc9')](_0xb3d090)[_0x8104('0xb7')](loggerCatch(_0x8104('0x103')));this[_0x8104('0xc7')](_0xb3d090)[_0x8104('0xb7')](loggerCatch(_0x8104('0x104')));}};Dialer[_0x8104('0x1a')]['syncAgentComplete']=function(_0x40530e){var _0x4f8d3a=this['uniqueId'][_0x40530e[_0x8104('0xdb')]];var _0x54f8e6=this;if(this['voiceQueues'][_0x40530e[_0x8104('0xb2')]]){if(_0x4f8d3a&&_0x4f8d3a['type']!==_0x8104('0x8f')){delete this[_0x8104('0x26')][_0x40530e[_0x8104('0xdb')]];this[_0x8104('0x1f')][_0x40530e[_0x8104('0xb2')]]['outboundAnswerCallsDay']+=0x1;var _0x105b5a=new AgentComplete(_0x4f8d3a,_0x40530e);if(_0x40530e[_0x8104('0x10a')]==='agent'){_0x105b5a['agiafterat']=this[_0x8104('0x1f')][_0x40530e[_0x8104('0xb2')]][_0x8104('0x10b')]&&this[_0x8104('0x1f')][_0x40530e[_0x8104('0xb2')]][_0x8104('0x10c')]?moment()[_0x8104('0x75')](_0x8104('0xfc')):undefined;}this[_0x8104('0xc9')](_0x105b5a)[_0x8104('0xb7')](loggerCatch(_0x8104('0x10d')));this[_0x8104('0xc7')](_0x105b5a)['catch'](loggerCatch(_0x8104('0x10e')));}}};Dialer['prototype'][_0x8104('0x2e')]=function(_0x3dd1c1){if(this[_0x8104('0x1f')][_0x3dd1c1[_0x8104('0xb2')]]){if(this[_0x8104('0x26')][_0x3dd1c1['uniqueid']]&&this[_0x8104('0x26')][_0x3dd1c1[_0x8104('0xdb')]][_0x8104('0x4e')]!==_0x8104('0x8f')){this['updateOriginated'](this['voiceQueues'][_0x3dd1c1[_0x8104('0xb2')]]);this[_0x8104('0x26')][_0x3dd1c1['uniqueid']][_0x8104('0x10f')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));}}};Dialer[_0x8104('0x1a')][_0x8104('0x110')]=function(_0x44a63){this[_0x8104('0xc9')](_0x44a63)['catch'](loggerCatch(_0x8104('0x10d')));this[_0x8104('0xc7')](_0x44a63)[_0x8104('0xb7')](loggerCatch(_0x8104('0x111')));};Dialer[_0x8104('0x1a')][_0x8104('0x112')]=function(_0x375ed1){var _0x5a79a1=this[_0x8104('0x26')][_0x375ed1['uniqueid']];var _0x2b288d=this;if(this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]]){if(_0x5a79a1&&_0x5a79a1[_0x8104('0x4e')]!==_0x8104('0x8f')){delete this[_0x8104('0x26')][_0x375ed1[_0x8104('0xdb')]];this[_0x8104('0xb1')](this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]]);_0x5a79a1['droptime']=moment()['format'](_0x8104('0xfc'));var _0x112ddb=new QueueCallerAbandon(_0x5a79a1,_0x375ed1);if(getSeconds(_0x5a79a1[_0x8104('0x113')],_0x5a79a1[_0x8104('0x114')])>=_0x5a79a1[_0x8104('0x115')]){this['voiceQueues'][_0x375ed1['queue']][_0x8104('0x116')]+=0x1;this[_0x8104('0x1f')][_0x375ed1['queue']][_0x8104('0x117')]+=0x1;this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x112ddb[_0x8104('0xe2')]=0xa;_0x112ddb[_0x8104('0xa5')]=_0x8104('0x118');_0x112ddb[_0x8104('0x119')]=_0x8104('0x11a');_0x112ddb[_0x8104('0x11b')]=this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]]['dialQueueProject2']?moment()[_0x8104('0x75')](_0x8104('0xfc')):undefined;_0x112ddb[_0x8104('0xf2')]+=0x1;_0x112ddb[_0x8104('0xeb')]+=0x1;if(_0x112ddb[_0x8104('0xf2')]>=this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]][_0x8104('0x11c')]){this[_0x8104('0x110')](_0x112ddb);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x112ddb[_0x8104('0xf2')],'scheduledat':moment()[_0x8104('0x11d')](this[_0x8104('0x1f')][_0x375ed1['queue']][_0x8104('0x11e')],'minutes')[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x5a79a1[_0x8104('0x101')],'ListId':_0x5a79a1[_0x8104('0xd2')],'VoiceQueueId':_0x5a79a1[_0x8104('0xd4')]||undefined,'CampaignId':_0x5a79a1[_0x8104('0xd5')]||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0x11f')));var _0x39eaee=new History(_0x112ddb);_0x39eaee[_0x8104('0xe2')]=0xa;_0x39eaee['statedesc']=_0x8104('0x118');_0x39eaee[_0x8104('0xa7')]=moment()['format'](_0x8104('0xfc'));_0x39eaee[_0x8104('0xa6')]=_0x39eaee[_0x8104('0xa7')];_0x39eaee[_0x8104('0x120')]=_0x112ddb[_0x8104('0x120')];_0x39eaee['calleridnum']=_0x112ddb['calleridnum'];this[_0x8104('0xc9')](_0x39eaee)[_0x8104('0xb7')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]][_0x8104('0x67')]+=0x1;this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]][_0x8104('0x61')]+=0x1;_0x112ddb[_0x8104('0xe2')]=0xb;_0x112ddb['statedesc']=_0x8104('0x121');_0x112ddb[_0x8104('0x119')]=_0x8104('0x122');_0x112ddb[_0x8104('0xf3')]+=0x1;_0x112ddb[_0x8104('0xeb')]+=0x1;if(_0x112ddb['countabandonedretry']>=this[_0x8104('0x1f')][_0x375ed1[_0x8104('0xb2')]][_0x8104('0x123')]){this['queueCallerAbandonCreateState'](_0x112ddb);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x112ddb['countabandonedretry'],'scheduledat':moment()[_0x8104('0x11d')](this['voiceQueues'][_0x375ed1['queue']][_0x8104('0x124')],_0x8104('0xfb'))['format'](_0x8104('0xfc')),'ContactId':_0x5a79a1[_0x8104('0x101')],'ListId':_0x5a79a1[_0x8104('0xd2')],'VoiceQueueId':_0x5a79a1[_0x8104('0xd4')]||undefined,'CampaignId':_0x5a79a1['CampaignId']||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0x125')));var _0x39eaee=new History(_0x112ddb);_0x39eaee['state']=0xb;_0x39eaee[_0x8104('0xa5')]=_0x8104('0x121');_0x39eaee[_0x8104('0xa7')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));_0x39eaee[_0x8104('0xa6')]=_0x39eaee[_0x8104('0xa7')];_0x39eaee['calleridname']=_0x112ddb[_0x8104('0x120')];_0x39eaee[_0x8104('0x126')]=_0x112ddb[_0x8104('0x126')];this['createHistory'](_0x39eaee)[_0x8104('0xb7')](loggerCatch(_0x8104('0x127')));}}}}};Dialer[_0x8104('0x1a')][_0x8104('0x37')]=function(_0x80cf93){if(this[_0x8104('0xaa')][_0x80cf93[_0x8104('0xdb')]]){this[_0x8104('0xaa')][_0x80cf93['uniqueid']][_0x8104('0xaf')]=_0x80cf93[_0x8104('0xaf')];}if(this[_0x8104('0x26')][_0x80cf93[_0x8104('0xdb')]]){this[_0x8104('0x26')][_0x80cf93['uniqueid']][_0x8104('0xaf')]=_0x80cf93[_0x8104('0xaf')];}};Dialer[_0x8104('0x1a')][_0x8104('0x128')]=function(_0xc170d6){if(strategy[this[_0x8104('0x1f')][this['actions'][_0xc170d6['actionid']]['queue']][_0x8104('0x50')]]===_0x8104('0x19')){if(this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]]&&_[_0x8104('0xac')](this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]][_0x8104('0x12a')])&&_0xc170d6[_0x8104('0xae')]==='1'&&_0xc170d6['paused']==='0'){if(this[_0x8104('0x21')][_0xc170d6[_0x8104('0x12b')]]){if(!this[_0x8104('0x21')][_0xc170d6['stateinterface']]['locked']){this[_0x8104('0x21')][_0xc170d6[_0x8104('0x12b')]][_0x8104('0x12a')]=!![];this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]][_0x8104('0x12a')]=!![];this[_0x8104('0xaa')][_0xc170d6['actionid']]['stateinterface']=_0xc170d6[_0x8104('0x12b')];}}}}else if((strategy[this[_0x8104('0x1f')][this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]][_0x8104('0xb2')]][_0x8104('0x50')]]||_0x8104('0x18'))===_0x8104('0x18')){if(this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]]){if(this['agents'][_0xc170d6[_0x8104('0x12b')]]){this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]][_0x8104('0x12b')]=_0xc170d6[_0x8104('0x12b')];if(_[_0x8104('0xac')](this[_0x8104('0x2b')][this[_0x8104('0xaa')][_0xc170d6['actionid']][_0x8104('0xb2')]])){this[_0x8104('0x2b')][this[_0x8104('0xaa')][_0xc170d6[_0x8104('0x129')]][_0x8104('0xb2')]]=[];}this['queueBooked'][this['actions'][_0xc170d6['actionid']][_0x8104('0xb2')]][_0x8104('0x12c')](_[_0x8104('0x8b')](_['pick'](this[_0x8104('0xaa')][_0xc170d6['actionid']],[_0x8104('0x12d'),'stateinterface']),{'status':_0xc170d6['status'],'paused':_0xc170d6[_0x8104('0x12e')]}));}}}};function unlockQueueStatus(_0x2ed761,_0x4af215){setTimeout(function(){if(_[_0x8104('0x3e')](_0x2ed761[_0x8104('0x12f')])){loggerBooked[_0x8104('0x92')](_0x8104('0x130'),_0x4af215);}_0x2ed761[_0x8104('0x12f')]=!![];loggerBooked[_0x8104('0x7c')](_0x8104('0x131'),_0x4af215,JSON[_0x8104('0x4a')](_[_0x8104('0xd1')](_0x2ed761,['name',_0x8104('0x12f')])));},0x1f3);}Dialer[_0x8104('0x1a')][_0x8104('0x132')]=function(_0x29d971){var _0x317886=this;var _0x392f88=_0x317886[_0x8104('0x1f')][_0x317886[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]];if(strategy[this[_0x8104('0x1f')][this['actions'][_0x29d971['actionid']][_0x8104('0xb2')]]['strategy']]===_0x8104('0x19')){if(this['actions'][_0x29d971[_0x8104('0x129')]]&&this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0x12b')]){this[_0x8104('0x1e')]['run'](this['actions'][_0x29d971['actionid']][_0x8104('0x12d')],this[_0x8104('0xaa')][_0x29d971['actionid']]['stateinterface'])[_0x8104('0xb7')](function(_0xf2d7f){logger[_0x8104('0x92')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x8104('0x93')](_0xf2d7f,{'showHidden':![],'depth':null}));})[_0x8104('0x1d')](function(){_0x317886[_0x8104('0xb1')](_0x317886[_0x8104('0x1f')][_0x317886['actions'][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]]);_0x317886[_0x8104('0x21')][_0x317886[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]]['stateinterface']][_0x8104('0x12a')]=![];delete _0x317886['actions'][_0x29d971[_0x8104('0x129')]];unlockQueueStatus(_0x392f88);});}else{this[_0x8104('0xb1')](this[_0x8104('0x1f')][this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0x101')],'ListId':this['actions'][_0x29d971[_0x8104('0x129')]]['ListId'],'VoiceQueueId':this[_0x8104('0xaa')][_0x29d971['actionid']]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x29d971[_0x8104('0x129')]][_0x8104('0xd5')]||undefined})['catch'](loggerCatch(_0x8104('0x133')));delete this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]];unlockQueueStatus(_0x392f88);}}else if((strategy[this[_0x8104('0x1f')][this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]]['queue']][_0x8104('0x50')]]||'rrmemory')===_0x8104('0x18')){var _0x8fd90f;if(this['actions'][_0x29d971['actionid']]&&!_['isEmpty'](this[_0x8104('0x2b')][this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]])){if(this[_0x8104('0x2c')][_0x317886[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]]){this[_0x8104('0x2c')][_0x317886[_0x8104('0xaa')][_0x29d971['actionid']][_0x8104('0xb2')]]=this[_0x8104('0x2c')][this['actions'][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]]?this[_0x8104('0x2c')][this[_0x8104('0xaa')][_0x29d971['actionid']][_0x8104('0xb2')]]:this[_0x8104('0x2b')][this['actions'][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]]?this[_0x8104('0x2b')][this['actions'][_0x29d971[_0x8104('0x129')]]['queue']][_0x8104('0x134')]||0x0:0x0;}this[_0x8104('0x2b')][this['actions'][_0x29d971[_0x8104('0x129')]][_0x8104('0xb2')]][_0x8104('0x134')]=this['queueBookedRR'][this[_0x8104('0xaa')][_0x29d971[_0x8104('0x129')]]['queue']];for(var _0x3fea07=0x0;_0x3fea07=0x0?!![]:![];})['catch'](myreject(_0xbe3934)));}}else{_0x592f2f[_0x8104('0x12c')](ami['Action']({'action':'command','command':util[_0x8104('0x75')](_0x8104('0x150'),_0x2e90e6,!_['isUndefined'](config[_0x8104('0x14d')][_0x5b3777])?_0x5b3777:'')})[_0x8104('0xb6')](function(_0x2efa07){return _0x2efa07[_0x8104('0x14e')]['indexOf'](_0x8104('0x151'))>=0x0?!![]:![];})['catch'](myreject(_0xbe3934)));}BPromise[_0x8104('0x152')](_0x592f2f)[_0x8104('0xb6')](function(_0x5a4ae7){var _0x38d18a=_[_0x8104('0x153')](_0x5a4ae7);if(_0x38d18a){return _0x31e189(_0x38d18a);}else{_0x345274[_0x8104('0x41')]=_0x33df64?_0x8104('0x154'):_0x8104('0x155');return _0xbe3934(msgResponse(_0x8104('0x156'),_0x8104('0x146'),'Global:\x20'+_0x33df64+'\x20'+_0x4acfba+'\x20Interval\x20is\x20overtime:\x20'+util[_0x8104('0x93')](_0x2e90e6,{'showHidden':![],'depth':null})+_0x8104('0x157')+_0x5b3777));}})[_0x8104('0xb7')](function(_0x32154f){return _0xbe3934(msgResponse(_0x8104('0x145'),_0x8104('0x146'),JSON[_0x8104('0x4a')](_0x32154f)));});});};Dialer['prototype']['checkDialMethod']=function(_0x544310){var _0x5b018a=this;return function(){switch(_0x544310[_0x8104('0x5c')]){case _0x8104('0x158'):freeVariablesPredictive(_0x544310);_0x5b018a[_0x8104('0x159')](_0x544310,0x1);break;case _0x8104('0x15a'):freeVariablesPredictive(_0x544310);_0x5b018a[_0x8104('0x159')](_0x544310,_0x544310[_0x8104('0x15b')]);break;case _0x8104('0x15c'):_0x5b018a[_0x8104('0x15c')](_0x544310);break;case _0x8104('0x15d'):freeVariablesPredictive(_0x544310);_0x5b018a['handlePower'](_0x544310,0x1);break;default:freeVariablesPredictive(_0x544310);logger[_0x8104('0x92')](_0x8104('0x15e'),_0x544310[_0x8104('0x42')],'method\x20not\x20recognized');}};};Dialer[_0x8104('0x1a')][_0x8104('0x15f')]=function(_0x25b8a6){var _0x2d1bf9=this;return function(){_0x2d1bf9[_0x8104('0x160')](_0x25b8a6);};};Dialer[_0x8104('0x1a')][_0x8104('0x6')]=function(_0x3811ca){var _0x4dd57c=this;if(isNotPreview(_0x3811ca['dialMethod'])){if(isVoiceQueueOutbound(_0x3811ca[_0x8104('0x4e')])&&isActive(_0x3811ca[_0x8104('0x5b')])){_0x3811ca[_0x8104('0x9e')]=!![];BPromise[_0x8104('0xba')]()['then'](checkIsLoggedIn(_0x3811ca,_0x3811ca[_0x8104('0x52')]))[_0x8104('0xb6')](checkIsActive(_0x3811ca,_0x3811ca[_0x8104('0x5b')]))[_0x8104('0xb6')](checkInterval(_0x3811ca))[_0x8104('0xb6')](_0x4dd57c['checkIsTrunkReachable'](_0x3811ca))[_0x8104('0xb6')](_0x4dd57c[_0x8104('0x144')](_0x3811ca[_0x8104('0x161')],_0x3811ca[_0x8104('0x162')],_0x3811ca[_0x8104('0x42')],_0x3811ca))[_0x8104('0xb6')](_0x4dd57c['checkIfTimeIntervals'](_0x3811ca['Interval'],_0x3811ca[_0x8104('0x162')],_0x3811ca[_0x8104('0x42')],_0x3811ca))[_0x8104('0xb6')](_0x4dd57c[_0x8104('0x163')](_0x3811ca))[_0x8104('0xb7')](loggerCatchQueueSummary(_0x8104('0x164'),_0x3811ca));}else{notSendMessagesQueue(_0x3811ca);}}else{freeVariablesPredictive(_0x3811ca);}};Dialer[_0x8104('0x1a')]['syncCampaigns']=function(){var _0x2a0ad4=this;var _0x1a2bc1;for(var _0x59a1ce in this[_0x8104('0x20')]){if(this[_0x8104('0x20')][_0x8104('0x96')](_0x59a1ce)){_0x1a2bc1=this['campaigns'][_0x59a1ce];if(isCampaignIvr(_0x1a2bc1[_0x8104('0x4e')])&&isActive(_0x1a2bc1[_0x8104('0x72')])){_0x1a2bc1[_0x8104('0x9e')]=!![];BPromise[_0x8104('0xba')]()[_0x8104('0xb6')](checkIsActive(_0x1a2bc1,_0x1a2bc1[_0x8104('0x72')]))[_0x8104('0xb6')](checkInterval(_0x1a2bc1))[_0x8104('0xb6')](_0x2a0ad4['checkIsTrunkReachable'](_0x1a2bc1))[_0x8104('0xb6')](_0x2a0ad4[_0x8104('0x144')](_0x1a2bc1[_0x8104('0x161')],_0x1a2bc1[_0x8104('0x162')],_0x1a2bc1[_0x8104('0x42')],_0x1a2bc1))[_0x8104('0xb6')](_0x2a0ad4[_0x8104('0x165')](_0x1a2bc1[_0x8104('0x44')],_0x1a2bc1[_0x8104('0x162')],_0x1a2bc1[_0x8104('0x42')],_0x1a2bc1))[_0x8104('0xb6')](_0x2a0ad4['launchHandleIvr'](_0x1a2bc1))[_0x8104('0xb7')](loggerCatchQueueSummary(_0x8104('0x166'),_0x1a2bc1));}else{notSendMessagesCampaign(_0x1a2bc1);}}}};function getCallerIdRandom(_0x5f2aaa,_0x28c4fc){var _0x31d087,_0x43e6e3,_0x34d06a;if(_0x28c4fc<=0x0){_0x28c4fc=0x1;}_0x31d087=new RegExp(_0x8104('0x167')+_0x28c4fc+'}$');_0x43e6e3=Math[_0x8104('0x168')](0xa,_0x28c4fc-0x1);_0x34d06a=Math[_0x8104('0x168')](0xa,_0x28c4fc)-0x1;return util[_0x8104('0x75')]('%s',_[_0x8104('0x169')](_0x5f2aaa,_0x31d087,_[_0x8104('0x16a')](_0x43e6e3,_0x34d06a)));}function extractCalleridName(_0x405560){var _0x2c51fa=_0x405560['match'](/"(.*?)"/);return _0x2c51fa?_0x2c51fa[0x1]:_0x405560;}function extractCalleridNumber(_0x356d01){var _0x3c172e=_0x356d01['match'](/<(.*?)>/);return _0x3c172e?_0x3c172e[0x1]:_0x356d01;}Dialer[_0x8104('0x1a')][_0x8104('0x16b')]=function(_0x22f92a,_0x22bb2a){var _0x1a7c8b=this;var _0x1db1a2=uuid['v4']();this['actions'][_0x1db1a2]=new Action(_0x22f92a,_0x22bb2a,_0x1db1a2);return new BPromise(function(_0x7311ce,_0x2e40d5){if(_[_0x8104('0x3e')](_0x22f92a)&&_0x8104('0x16c')!==typeof _0x22f92a){return _0x2e40d5(msgResponse('originate','Failure',_0x8104('0x16d')));}if(_[_0x8104('0x3e')](_0x22bb2a[_0x8104('0x16e')][_0x8104('0x16f')])||_0x22bb2a[_0x8104('0x16e')]['phone']===null){return _0x2e40d5(msgResponse(_0x8104('0x170'),_0x8104('0x146'),_0x8104('0x171')));}var _0x45a739={'XMD-CALLERID':_0x1a7c8b[_0x8104('0xaa')][_0x1db1a2][_0x8104('0x172')](),'XMD-AGI':_0x22f92a['dialQueueProject']?util[_0x8104('0x75')](_0x8104('0x173'),ipAgi,_0x22f92a[_0x8104('0x105')]):'NONE','XMD-AGIAFTER':_0x22f92a[_0x8104('0x10b')]?util[_0x8104('0x75')](_0x8104('0x173'),ipAgi,_0x22f92a['dialQueueProject2']):_0x8104('0x174'),'XMD-QUEUE':_0x22f92a[_0x8104('0x4e')]===_0x8104('0x4f')?util['format'](_0x8104('0x175'),_0x22f92a[_0x8104('0x42')],_0x22f92a['dialQueueOptions']||'',_0x22f92a[_0x8104('0x10c')]?'c':'',_0x22f92a['dialQueueTimeout']||0x3):_0x8104('0x174'),'XMD-CONTACTID':_0x22bb2a[_0x8104('0x101')],'XMD-CDRTYPE':_0x8104('0x176'),'CALLERID(all)':_0x1a7c8b[_0x8104('0xaa')][_0x1db1a2][_0x8104('0x172')](),'XMD-AMD':_0x22f92a['dialAMDActive']?_0x8104('0x177'):_0x8104('0x174'),'XMD-DESTINATION':_0x8104('0xde')};if(_0x22f92a[_0x8104('0xdf')]){_0x45a739[_0x8104('0x178')]=_0x22f92a['dialAMDInitialSilence']||0x9c4;_0x45a739[_0x8104('0x179')]=_0x22f92a[_0x8104('0x17a')]||0x5dc;_0x45a739[_0x8104('0x17b')]=_0x22f92a[_0x8104('0x17c')]||0x320;_0x45a739[_0x8104('0x17d')]=_0x22f92a[_0x8104('0x17e')]||0x1388;_0x45a739[_0x8104('0x17f')]=_0x22f92a[_0x8104('0x180')]||0x64;_0x45a739[_0x8104('0x181')]=_0x22f92a[_0x8104('0x182')]||0x32;_0x45a739[_0x8104('0x183')]=_0x22f92a[_0x8104('0x184')]||0x3;_0x45a739[_0x8104('0x185')]=_0x22f92a[_0x8104('0x186')]||0x100;_0x45a739[_0x8104('0x187')]=_0x22f92a[_0x8104('0x188')]||0x1388;}if(_0x22f92a[_0x8104('0x4e')]===_0x8104('0x4f')){_0x45a739['XMD-VOICEQUEUEID']=_0x22bb2a[_0x8104('0xd4')];}else{_0x45a739[_0x8104('0x189')]=_0x22bb2a['CampaignId'];}for(var _0x327d3f in _0x22bb2a[_0x8104('0x16e')]){if(_0x22bb2a[_0x8104('0x16e')][_0x8104('0x96')](_0x327d3f)){if(isNotNull(_0x22bb2a[_0x8104('0x16e')][_0x327d3f])&&_0x327d3f!=='id'&&_0x327d3f!==_0x8104('0x18a')&&_0x327d3f!=='createdAt'&&_0x327d3f!==_0x8104('0x18b')){_0x45a739[util['format']('%s%s',_0x8104('0x18c'),_[_0x8104('0x18d')](_0x327d3f))]=_0x22bb2a[_0x8104('0x16e')][_0x327d3f];}}}var _0x310329=_0x1a7c8b['isTrunkReachable'](_0x22f92a[_0x8104('0x71')])?getCallerId(_0x22f92a['Trunk'][_0x8104('0x73')],_0x22f92a[_0x8104('0x18e')],_0x22f92a[_0x8104('0x18f')]>0x0?getCallerIdRandom(_0x22f92a['dialOriginateCallerIdNumber'],_0x22f92a[_0x8104('0x18f')]):_0x22f92a[_0x8104('0x5d')]):getCallerId(_[_0x8104('0xac')](_0x22f92a['TrunkBackup'])?_0x22f92a[_0x8104('0x71')]['callerid']:_0x22f92a[_0x8104('0x141')]['callerid'],_0x22f92a[_0x8104('0x18e')],_0x22f92a[_0x8104('0x18f')]>0x0?getCallerIdRandom(_0x22f92a[_0x8104('0x5d')],_0x22f92a['dialRandomLastDigitCallerIdNumber']):_0x22f92a[_0x8104('0x5d')]);if(_0x310329){_0x45a739[_0x8104('0x190')]=_0x1a7c8b[_0x8104('0xaa')][_0x1db1a2]['originatecalleridname']=extractCalleridName(_0x310329);_0x45a739[_0x8104('0x191')]=_0x1a7c8b[_0x8104('0xaa')][_0x1db1a2][_0x8104('0x192')]=extractCalleridNumber(_0x310329);}return ami[_0x8104('0xad')]({'actionid':_0x1db1a2,'action':_0x8104('0x170'),'channel':_0x1a7c8b[_0x8104('0x140')](_0x22f92a[_0x8104('0x71')])?util[_0x8104('0x75')](_0x8104('0x193'),_0x22f92a[_0x8104('0x71')][_0x8104('0x42')],isNotNull(_0x22f92a['dialPrefix'])?_0x22f92a['dialPrefix'][_0x8104('0x194')]()||'':'',_0x22f92a['dialCutDigit']>0x0?_0x22bb2a[_0x8104('0x16e')][_0x8104('0x16f')][_0x8104('0x195')](_0x22f92a['dialCutDigit']):_0x22bb2a[_0x8104('0x16e')][_0x8104('0x16f')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x22f92a['TrunkBackup'])?_0x22f92a[_0x8104('0x71')][_0x8104('0x42')]:_0x22f92a['TrunkBackup'][_0x8104('0x42')],isNotNull(_0x22f92a[_0x8104('0x196')])?_0x22f92a[_0x8104('0x196')][_0x8104('0x194')]()||'':'',_0x22f92a['dialCutDigit']>0x0?_0x22bb2a['Contact'][_0x8104('0x16f')][_0x8104('0x195')](_0x22f92a[_0x8104('0x197')]):_0x22bb2a[_0x8104('0x16e')][_0x8104('0x16f')]),'callerid':_0x310329,'Exten':_0x8104('0xde'),'Context':_0x8104('0x198'),'Priority':'1','variable':_0x45a739,'timeout':(_0x22f92a[_0x8104('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1db1a2})['then'](function(_0x23c726){return _0x7311ce(_0x23c726);})[_0x8104('0xb7')](function(_0x1b3542){_0x22f92a[_0x8104('0x199')]+=0x1;var _0x40fb3a=new History(_0x1a7c8b['actions'][_0x1db1a2]);logger[_0x8104('0x92')](util[_0x8104('0x75')](_0x8104('0x19a'),JSON[_0x8104('0x4a')](_0x1b3542)));_0x40fb3a[_0x8104('0xe2')]=0xe;_0x40fb3a[_0x8104('0xa5')]=_0x8104('0x19b');_0x40fb3a[_0x8104('0xa7')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));_0x40fb3a['endtime']=_0x40fb3a[_0x8104('0xa7')];_0x1a7c8b[_0x8104('0xc9')](_0x40fb3a)['catch'](loggerCatch(_0x8104('0x19c')));_0x1a7c8b[_0x8104('0xc7')](_0x40fb3a)[_0x8104('0xb7')](loggerCatch(_0x8104('0x19c')))[_0x8104('0x1d')](function(){delete _0x1a7c8b[_0x8104('0xaa')][_0x1db1a2];return _0x2e40d5(msgResponse('originate',_0x8104('0x49'),_0x8104('0x19d')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x96e9ba){var _0x47ab59=this['actions'][_0x96e9ba['actionid']];var _0x38b75e=this;if(_0x47ab59){delete this[_0x8104('0xaa')][_0x96e9ba['actionid']];_0x47ab59[_0x8104('0x114')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));var _0x3a0e82=_0x47ab59[_0x8104('0x4e')]===_0x8104('0x8f')?this[_0x8104('0x20')][_0x47ab59[_0x8104('0xb2')]]:this[_0x8104('0x1f')][_0x47ab59[_0x8104('0x19e')]()];if(!this[_0x8104('0xd7')](_0x96e9ba[_0x8104('0x19f')])){this[_0x8104('0xb1')](_0x3a0e82);return this[_0x8104('0x1a0')](_0x47ab59,_0x3a0e82,_0x96e9ba)[_0x8104('0xb6')](function(_0x2e110d){})[_0x8104('0xb7')](loggerCatch('[callProgressDetecting]\x20'));}else{this[_0x8104('0x26')][_0x96e9ba[_0x8104('0xdb')]]=_0x47ab59;}}};Dialer[_0x8104('0x1a')][_0x8104('0x1a1')]=function(_0x4a1951,_0x4d86ab,_0x13ca0b){var _0x12f0f5=new History(_0x4d86ab);if(_0x12f0f5[_0x8104('0xee')]+_0x12f0f5[_0x8104('0xef')]+_0x12f0f5['countnoanswerretry']+_0x12f0f5['countnosuchnumberretry']+_0x12f0f5[_0x8104('0xf2')]+_0x12f0f5[_0x8104('0xf3')]+_0x12f0f5[_0x8104('0xea')]+_0x12f0f5[_0x8104('0xf4')]>=_0x13ca0b['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4a1951){case 0x3:if(_0x12f0f5[_0x8104('0xf0')]>=_0x13ca0b['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countnoanswerretry':_0x12f0f5[_0x8104('0xf0')]+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b['dialNoAnswerRetryFrequency'],_0x8104('0xfb'))[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x12f0f5[_0x8104('0x101')],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5['VoiceQueueId']||undefined,'CampaignId':_0x12f0f5['CampaignId']||undefined})['catch'](loggerCatch(_0x8104('0x1a2')));}break;case 0x5:if(_0x12f0f5[_0x8104('0xee')]>=_0x13ca0b[_0x8104('0x1a3')]-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countbusyretry':_0x12f0f5[_0x8104('0xee')]+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b[_0x8104('0x1a4')],'minutes')[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x12f0f5[_0x8104('0x101')],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5['VoiceQueueId']||undefined,'CampaignId':_0x12f0f5[_0x8104('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x12f0f5['countcongestionretry']>=_0x13ca0b[_0x8104('0x1a5')]-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countcongestionretry':_0x12f0f5[_0x8104('0xef')]+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b[_0x8104('0x1a6')],_0x8104('0xfb'))['format'](_0x8104('0xfc')),'ContactId':_0x12f0f5[_0x8104('0x101')],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5['VoiceQueueId']||undefined,'CampaignId':_0x12f0f5['CampaignId']||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0x1a7')));}break;case 0x0:if(_0x12f0f5[_0x8104('0xf1')]>=_0x13ca0b[_0x8104('0x1a8')]-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countnosuchnumberretry':_0x12f0f5['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b['dialNoSuchNumberRetryFrequency'],_0x8104('0xfb'))['format'](_0x8104('0xfc')),'ContactId':_0x12f0f5[_0x8104('0x101')],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5[_0x8104('0xd4')]||undefined,'CampaignId':_0x12f0f5[_0x8104('0xd5')]||undefined})[_0x8104('0xb7')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x12f0f5[_0x8104('0xf2')]>=_0x13ca0b[_0x8104('0x11c')]-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countdropretry':_0x12f0f5[_0x8104('0xf2')]+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b[_0x8104('0x11e')],_0x8104('0xfb'))[_0x8104('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x12f0f5['ContactId'],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5['VoiceQueueId']||undefined,'CampaignId':_0x12f0f5['CampaignId']||undefined})[_0x8104('0xb7')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x12f0f5[_0x8104('0xf3')]>=_0x13ca0b['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x8104('0xbf')]({'active':![],'countabandonedretry':_0x12f0f5['countabandonedretry']+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b[_0x8104('0x124')],_0x8104('0xfb'))[_0x8104('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x12f0f5[_0x8104('0x101')],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5['VoiceQueueId']||undefined,'CampaignId':_0x12f0f5[_0x8104('0xd5')]||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0x125')));}break;case 0x13:if(_0x12f0f5[_0x8104('0xea')]>=_0x13ca0b[_0x8104('0xf7')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x12f0f5[_0x8104('0xea')]+=0x1,'scheduledat':moment()[_0x8104('0x11d')](_0x13ca0b[_0x8104('0xfa')],_0x8104('0xfb'))[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x12f0f5['ContactId'],'ListId':_0x12f0f5[_0x8104('0xd2')],'VoiceQueueId':_0x12f0f5[_0x8104('0xd4')]||undefined,'CampaignId':_0x12f0f5['CampaignId']||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0xfd')));}break;case 0x14:if(_0x12f0f5[_0x8104('0xf4')]>=_0x13ca0b[_0x8104('0x1a9')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countagentrejectretry':_0x12f0f5['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x13ca0b[_0x8104('0x1aa')],_0x8104('0xfb'))[_0x8104('0x75')](_0x8104('0xfc')),'ContactId':_0x12f0f5['ContactId'],'ListId':_0x12f0f5['ListId'],'VoiceQueueId':_0x12f0f5[_0x8104('0xd4')]||undefined,'CampaignId':_0x12f0f5[_0x8104('0xd5')]||undefined})['catch'](loggerCatch(_0x8104('0x1ab')));}break;default:return!![];}};Dialer[_0x8104('0x1a')][_0x8104('0x1a0')]=function(_0x368eb0,_0x4860ac,_0x5ab544){var _0x3ecdd7=this;var _0x3c0548=new History(_0x368eb0);return new BPromise(function(_0x3a972b,_0x3c6dfe){if(_[_0x8104('0x3e')](_0x4860ac)&&'object'!==typeof _0x4860ac){return _0x3c6dfe(msgResponse(_0x8104('0x1ac'),'Failure',_0x8104('0x1ad')));}if(_[_0x8104('0x3e')](_0x5ab544)&&_0x8104('0x16c')!==typeof _0x5ab544){return _0x3c6dfe(msgResponse(_0x8104('0x1ac'),_0x8104('0x146'),_0x8104('0x1ae')));}switch(_0x5ab544[_0x8104('0x10a')]){case'0':_0x4860ac['outboundNoSuchCallsDay']+=0x1;_0x3c0548['state']=0x0;_0x3c0548[_0x8104('0xa5')]='NoSuchNumber';_0x3c0548[_0x8104('0xf1')]+=0x1;_0x3c0548[_0x8104('0xeb')]+=0x1;ami['emit'](_0x8104('0x1af'),ut[_0x8104('0x1b0')](_0x368eb0,'nosuchnumber'));_0x3ecdd7['createHistory'](_0x3c0548)[_0x8104('0xb7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3ecdd7[_0x8104('0x1a1')](0x0,_0x368eb0,_0x4860ac)){if(_0x3c0548['countnosuchnumberretry']>=_0x4860ac[_0x8104('0x1a8')]){_0x3ecdd7[_0x8104('0xf8')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1b1'));}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1b1'));}}break;case'3':_0x4860ac['outboundNoAnswerCallsDay']+=0x1;_0x3c0548[_0x8104('0xe2')]=0x3;_0x3c0548['statedesc']=_0x8104('0x1b2');_0x3c0548[_0x8104('0xf0')]+=0x1;_0x3c0548[_0x8104('0xeb')]+=0x1;ami['emit'](_0x8104('0x1b3'),ut[_0x8104('0x1b0')](_0x368eb0,'noanswer'));_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch(_0x8104('0x1b4')));if(_0x3ecdd7[_0x8104('0x1a1')](0x3,_0x368eb0,_0x4860ac)){if(_0x3c0548['countnoanswerretry']>=_0x4860ac[_0x8104('0x1b5')]){_0x3ecdd7[_0x8104('0xf8')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1b6'));}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1b6'));}}break;case'5':_0x4860ac[_0x8104('0x1b7')]+=0x1;_0x3c0548['state']=0x5;_0x3c0548[_0x8104('0xa5')]=_0x8104('0x1b8');_0x3c0548[_0x8104('0xee')]+=0x1;_0x3c0548['countglobal']+=0x1;ami[_0x8104('0x1b9')]('custom:agentbusy',ut[_0x8104('0x1b0')](_0x368eb0,_0x8104('0x1ba')));_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch(_0x8104('0x1bb')));if(_0x3ecdd7['checkRetriveMax'](0x5,_0x368eb0,_0x4860ac)){if(_0x3c0548['countbusyretry']>=_0x4860ac['dialBusyMaxRetry']){_0x3ecdd7[_0x8104('0xf8')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1bc'));}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,'reason\x205\x20busy');}}break;case'8':_0x4860ac['outboundCongestionCallsDay']+=0x1;_0x3c0548['state']=0x8;_0x3c0548[_0x8104('0xa5')]=_0x8104('0x1bd');_0x3c0548[_0x8104('0xef')]+=0x1;_0x3c0548[_0x8104('0xeb')]+=0x1;ami[_0x8104('0x1b9')](_0x8104('0x1be'),ut[_0x8104('0x1b0')](_0x368eb0,_0x8104('0x1bf')));_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch(_0x8104('0x1c0')));if(_0x3ecdd7[_0x8104('0x1a1')](0x8,_0x368eb0,_0x4860ac)){if(_0x3c0548[_0x8104('0xef')]>=_0x4860ac[_0x8104('0x1a5')]){_0x3ecdd7[_0x8104('0xf8')](_0x3c0548,_0x3a972b,_0x3c6dfe,'reason\x208\x20congestion');}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1c1'));}}break;case'11':_0x4860ac['outboundAbandonedCallsDay']+=0x1;_0x3c0548['state']=0xb;_0x3c0548['statedesc']='Abandoned';_0x3c0548['countabandonedretry']+=0x1;_0x3c0548[_0x8104('0xeb')]+=0x1;_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch(_0x8104('0x127')));if(_0x3ecdd7[_0x8104('0x1a1')](0xb,_0x368eb0,_0x4860ac)){if(_0x3c0548[_0x8104('0xf3')]>=_0x4860ac[_0x8104('0x123')]){_0x3ecdd7['createStateFinal'](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1c2'));}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1c2'));}}break;case'20':_0x4860ac[_0x8104('0x1c3')]+=0x1;_0x3c0548[_0x8104('0xe2')]=0x14;_0x3c0548['statedesc']=_0x8104('0x1c4');_0x3c0548[_0x8104('0xf4')]+=0x1;_0x3c0548['countglobal']+=0x1;ami[_0x8104('0x1b9')]('custom:agentreject',ut[_0x8104('0x1b0')](_0x368eb0,_0x8104('0x1c5')));_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch(_0x8104('0x1c6')));if(_0x3ecdd7[_0x8104('0x1a1')](0x14,_0x368eb0,_0x4860ac)){if(_0x3c0548[_0x8104('0xf4')]>=_0x4860ac[_0x8104('0x1a9')]){_0x3ecdd7[_0x8104('0xf8')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x8104('0x1c7'));}else{_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,'reason\x2020\x20agentreject');}}break;default:_0x4860ac['outboundUnknownCallsDay']+=0x1;_0x3c0548[_0x8104('0xe2')]=0xc;_0x3c0548[_0x8104('0xa5')]=_0x5ab544[_0x8104('0x10a')];_0x3ecdd7[_0x8104('0xc9')](_0x3c0548)[_0x8104('0xb7')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x3ecdd7[_0x8104('0x1a1')](_0x5ab544[_0x8104('0x10a')],_0x368eb0,_0x4860ac)){if(_0x3c0548['countbusyretry']+_0x3c0548['countcongestionretry']+_0x3c0548[_0x8104('0xf0')]+_0x3c0548['countnosuchnumberretry']+_0x3c0548['countdropretry']+_0x3c0548[_0x8104('0xf3')]+_0x3c0548[_0x8104('0xea')]+_0x3c0548[_0x8104('0xf4')]>=_0x4860ac['dialGlobalMaxRetry']){_0x3ecdd7[_0x8104('0x100')](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x5ab544[_0x8104('0x10a')]);}else{_0x3ecdd7['createStateFinal'](_0x3c0548,_0x3a972b,_0x3c6dfe,_0x5ab544[_0x8104('0x10a')]);}}}});};Dialer[_0x8104('0x1a')][_0x8104('0x100')]=function(_0x1b7f09,_0x273431,_0x235193,_0x14529){var _0xd1f53=new Final(_0x1b7f09);_0xd1f53[_0x8104('0xe2')]=0xf;_0xd1f53[_0x8104('0xa5')]=_0x8104('0x1c8');this[_0x8104('0xf8')](_0xd1f53,_0x273431,_0x235193,_0x14529);};Dialer[_0x8104('0x1a')][_0x8104('0xf8')]=function(_0x128edb,_0x251329,_0x2ae8b5,_0x546bf0){this[_0x8104('0xc7')](_0x128edb)[_0x8104('0xb6')](function(_0x309b97){return _0x251329(msgResponse('[callProgressDetecting]',_0x8104('0xd8'),_0x546bf0));})[_0x8104('0xb7')](function(_0x3f21c7){return _0x2ae8b5(msgResponse(_0x8104('0x1c9'),_0x8104('0x146'),_0x8104('0x1ca')));});};Dialer[_0x8104('0x1a')][_0x8104('0x15c')]=function(_0x6bdf7e){var _0x41bee6=this;var _0xc49970=_0x6bdf7e['dialPredictiveOptimizationPercentage']/0x64;var _0x3de1c2=_0x6bdf7e['outboundDropCallsDayTimeout']/(_0x6bdf7e[_0x8104('0x117')]+_0x6bdf7e[_0x8104('0xe1')]);var _0x32b5c5=Math[_0x8104('0x1cb')](_0x6bdf7e[_0x8104('0x6b')]*(_0x6bdf7e['predictiveIntervalMaxThreshold']/0x64));var _0x3c264d=Math[_0x8104('0x1cb')](_0x6bdf7e[_0x8104('0x6b')]*(_0x6bdf7e[_0x8104('0x1cc')]/0x64));var _0x40ed33=_0x6bdf7e[_0x8104('0x51')]+_0x6bdf7e[_0x8104('0x56')];var _0x397f3f=Math[_0x8104('0x1cd')](_0x6bdf7e['erlangCalls']*_0x6bdf7e['erlangAbandonmentRate']*_0x6bdf7e[_0x8104('0x69')]*_0x6bdf7e[_0x8104('0x6a')]);if(_[_0x8104('0x3e')](_0x6bdf7e['startProgressive'])){if(!_[_0x8104('0x3e')](_0x6bdf7e['startPredictive'])){_0x6bdf7e['startPredictive']=undefined;loggerPredictive[_0x8104('0x92')](_0x8104('0x1ce'),_0x8104('0x1cf'));}if(!_[_0x8104('0x3e')](_0x6bdf7e[_0x8104('0x8e')])){loggerPredictive['error'](_0x8104('0x1ce'),_0x8104('0x1d0'));clearInterval(_0x6bdf7e['handlePredictive']);_0x6bdf7e['handlePredictive']=undefined;}_0x6bdf7e[_0x8104('0x29')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));loggerPredictive[_0x8104('0x7c')](_0x6bdf7e[_0x8104('0x42')],_0x8104('0x1d1'),_0x6bdf7e[_0x8104('0x29')]);this[_0x8104('0x159')](_0x6bdf7e,0x1);}else if(ifInterval(_0x6bdf7e[_0x8104('0x1d2')],_0x6bdf7e['startProgressive'])){this['handlePower'](_0x6bdf7e,0x1);loggerPredictiveCalls['info'](_0x8104('0x1d3'),_0x6bdf7e[_0x8104('0x29')],_0x6bdf7e[_0x8104('0x42')]);_0x6bdf7e['erlangCalls']=0x0;_0x6bdf7e[_0x8104('0x1d4')]=0x0;}else if(_0xc49970<_0x3de1c2&&_0x6bdf7e[_0x8104('0x1d5')]===_0x8104('0x1d6')){freeVariablesPredictive(_0x6bdf7e);loggerPredictive['info'](_0x8104('0x1d7'),_0x8104('0x1d8'),_0x3de1c2,_0x8104('0x29'),_0x6bdf7e[_0x8104('0x42')]);}else if(_0x397f3f<_0x6bdf7e['predictiveIntervalErlangCallsDroppedCalls']&&_0x6bdf7e[_0x8104('0x1d5')]==='dropRate'){freeVariablesPredictive(_0x6bdf7e);loggerPredictive[_0x8104('0x7c')](_0x8104('0x1d9'),_0x8104('0x1da'),_0x397f3f,_0x8104('0x1db'),_0x6bdf7e[_0x8104('0x1d4')],_0x8104('0x29'),_0x6bdf7e['name']);}else if(!ifInterval(_0x6bdf7e[_0x8104('0x1d2')],_0x6bdf7e[_0x8104('0x29')])&&_[_0x8104('0x3e')](_0x6bdf7e[_0x8104('0x28')])&&!_['isUndefined'](_0x6bdf7e['startProgressive'])){_0x6bdf7e[_0x8104('0x28')]=moment()[_0x8104('0x75')](_0x8104('0xfc'));loggerPredictive[_0x8104('0x7c')](_0x6bdf7e[_0x8104('0x42')],_0x8104('0x1dc'),_0x6bdf7e[_0x8104('0x28')]);this[_0x8104('0x1dd')](_0x6bdf7e[_0x8104('0x1d2')])[_0x8104('0xb6')](this['getDataPredictive'](_0x6bdf7e))[_0x8104('0xb6')](mergeDataErlangB(_0x6bdf7e))['then'](this[_0x8104('0x1de')](_0x6bdf7e))[_0x8104('0xb7')](loggerCatchPredictive(_0x8104('0x1df'),_0x6bdf7e));}else if(!ifInterval(_0x6bdf7e[_0x8104('0x1d2')],_0x6bdf7e['startPredictive'])){_0x6bdf7e[_0x8104('0x1d4')]=0x0;_0x6bdf7e[_0x8104('0x28')]=moment()[_0x8104('0x75')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8104('0x7c')](_0x6bdf7e[_0x8104('0x42')],_0x8104('0x1e0'),_0x6bdf7e[_0x8104('0x28')]);clearInterval(_0x6bdf7e['handlePredictive']);_0x6bdf7e[_0x8104('0x8e')]=undefined;this[_0x8104('0x1dd')](_0x6bdf7e[_0x8104('0x1d2')])['then'](this[_0x8104('0x1e1')](_0x6bdf7e))[_0x8104('0xb6')](mergeDataErlangB(_0x6bdf7e))[_0x8104('0xb6')](this['startMethodPredictive'](_0x6bdf7e))[_0x8104('0xb7')](loggerCatchPredictive(_0x8104('0x1e2'),_0x6bdf7e));}else if(_0x6bdf7e['predictiveIntervalAvailable']&&_0x40ed33<_0x6bdf7e['predictiveIntervalAvailable']-_0x3c264d){freeVariablesPredictive(_0x6bdf7e);loggerPredictive[_0x8104('0x7c')](_0x6bdf7e[_0x8104('0x42')],_0x8104('0x1e3'),_0x40ed33,')\x20are\x20less\x20than\x20threshold\x20(',_0x6bdf7e[_0x8104('0x6b')],'-',_0x3c264d,'=',_0x6bdf7e['predictiveIntervalAvailable']-_0x3c264d,')');}else if(_0x6bdf7e[_0x8104('0x6b')]&&_0x40ed33>_0x6bdf7e[_0x8104('0x6b')]+_0x32b5c5){freeVariablesPredictive(_0x6bdf7e);loggerPredictive[_0x8104('0x7c')](_0x6bdf7e['name'],_0x8104('0x1e3'),_0x40ed33,')\x20are\x20more\x20than\x20threshold\x20(',_0x6bdf7e[_0x8104('0x6b')],'+',_0x32b5c5,'=',_0x6bdf7e['predictiveIntervalAvailable']+_0x32b5c5,')');}};Dialer[_0x8104('0x1a')][_0x8104('0x1e1')]=function(_0x2a5349){var _0x4343c2=this;return function(_0x43a777){return new BPromise(function(_0x5dac41,_0x2bc7cd){_[_0x8104('0x8b')](_0x2a5349,_0x43a777[0x0]);if(checkGetDataPredictive(_0x43a777[0x0])){var _0x1b4771=_0x2a5349[_0x8104('0x6b')]=_0x2a5349[_0x8104('0x56')]+_0x2a5349[_0x8104('0x51')];var _0x390a05=_0x2a5349[_0x8104('0x1d2')]*0x3c;var _0x524381=_0x43a777[0x0][_0x8104('0x66')]+_0x43a777[0x0]['predictiveIntervalAvgHoldtime'];var _0x57f3c5=(_0x43a777[0x0][_0x8104('0x7f')]+_0x43a777[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x43a777[0x0][_0x8104('0x67')])/_0x43a777[0x0][_0x8104('0x6c')];_0x2a5349[_0x8104('0x69')]=_0x57f3c5>0x0?_0x57f3c5:0x1;switch(_0x2a5349[_0x8104('0x1d5')]){case _0x8104('0x1d6'):var _0xe77ae1=_0x2a5349['dialPredictiveOptimizationPercentage']/0x64;return _0x4343c2[_0x8104('0x1e4')](_0x1b4771,_0x390a05,_0x524381,_0x57f3c5,_0xe77ae1)[_0x8104('0xb6')](function(_0x51a33e){return _0x5dac41(_0x51a33e);});case _0x8104('0x1e5'):var _0xa54db5=_0x2a5349['dialPredictiveOptimizationPercentage']/0x64;return _0x4343c2[_0x8104('0x1e6')](_0x1b4771,_0x390a05,_0x524381,_0x57f3c5,_0xa54db5)[_0x8104('0xb6')](function(_0x22db7e){return _0x5dac41(_0x22db7e);});default:return _0x2bc7cd(msgResponse('[getDataPredictive]','Failure',_0x8104('0x1e7')));}}else{return _0x2bc7cd(msgResponse(_0x8104('0x1e8'),_0x8104('0x146'),_0x8104('0x1e9')));}});};};Dialer['prototype'][_0x8104('0x1ea')]=function(_0x2b16ab){var _0x19b8da=this;return function(_0x52b0fd){return new BPromise(function(_0x58b8a4,_0x533c30){_[_0x8104('0x8b')](_0x2b16ab,_0x52b0fd[0x0]);if(checkGetDataPredictive(_0x52b0fd[0x0])){loggerPredictive['info'](JSON[_0x8104('0x4a')](_0x52b0fd[0x0]));if(_0x2b16ab['dialPredictiveOptimization']===_0x8104('0x1d6')){return _0x19b8da['getVoiceQueueRtPauses'](_0x2b16ab['id'])[_0x8104('0xb6')](function(_0x20d5f7){var _0x4bf966=_0x2b16ab['loggedIn']-_0x20d5f7[0x0][_0x8104('0x1eb')];var _0xbdd320=_0x2b16ab['dialPredictiveInterval']*0x3c;var _0x277292=_0x52b0fd[0x0][_0x8104('0x66')]+_0x52b0fd[0x0]['predictiveIntervalAvgHoldtime'];var _0x5d8095=(_0x52b0fd[0x0]['predictiveIntervalAnsweredCalls']+_0x52b0fd[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x52b0fd[0x0][_0x8104('0x67')])/_0x52b0fd[0x0][_0x8104('0x6c')];var _0x4c9a8c=_0x2b16ab[_0x8104('0x1ec')]/0x64;_0x2b16ab[_0x8104('0x1ed')]=_0x20d5f7[0x0][_0x8104('0x1eb')]||0x0;_0x2b16ab['predictiveIntervalHitRate']=_0x5d8095>0x0?_0x5d8095:0x1;return _0x19b8da[_0x8104('0x1e4')](_0x4bf966,_0xbdd320,_0x277292,_0x5d8095,_0x4c9a8c);})[_0x8104('0xb6')](function(_0x3f5017){return _0x58b8a4(_0x3f5017);})['catch'](function(_0x4215dc){return _0x533c30(msgResponse('[CatchErlangB]','Failure',JSON[_0x8104('0x4a')](_0x4215dc)));});}if(_0x2b16ab[_0x8104('0x1d5')]===_0x8104('0x1e5')){return _0x19b8da[_0x8104('0xc5')](_0x2b16ab['id'])[_0x8104('0xb6')](function(_0x173f4b){var _0x4f5265=_0x2b16ab['loggedIn']-_0x173f4b[0x0][_0x8104('0x1eb')];var _0x10f93e=_0x2b16ab[_0x8104('0x1d2')]*0x3c;var _0x2ea9db=_0x52b0fd[0x0]['predictiveIntervalAvgTalktime']+_0x52b0fd[0x0]['predictiveIntervalAvgHoldtime'];var _0x5f40f0=(_0x52b0fd[0x0]['predictiveIntervalAnsweredCalls']+_0x52b0fd[0x0][_0x8104('0x116')]+_0x52b0fd[0x0][_0x8104('0x67')])/_0x52b0fd[0x0]['predictiveIntervalTotalCalls'];var _0x3c8b33=_0x2b16ab[_0x8104('0x1ec')]/0x64;_0x2b16ab[_0x8104('0x1ed')]=_0x173f4b[0x0]['outboundQueuePauses']||0x0;_0x2b16ab[_0x8104('0x69')]=_0x5f40f0>0x0?_0x5f40f0:0x1;return _0x19b8da[_0x8104('0x1e6')](_0x4f5265,_0x10f93e,_0x2ea9db,_0x5f40f0,_0x3c8b33);})[_0x8104('0xb6')](function(_0x217d5b){return _0x58b8a4(_0x217d5b);})[_0x8104('0xb7')](function(_0x410886){return _0x533c30(msgResponse(_0x8104('0x1ee'),_0x8104('0x146'),JSON[_0x8104('0x4a')](_0x410886)));});}}else{return _0x533c30(msgResponse(_0x8104('0x1e8'),_0x8104('0x146'),_0x8104('0x1e9')));}});};};Dialer[_0x8104('0x1a')][_0x8104('0x1de')]=function(_0x5d2087){var _0xc6c767=this;return function(){var _0x2c118a=0x0;var _0x45b3b3=Math[_0x8104('0x1cd')](_0x5d2087[_0x8104('0x6f')]*0x3e8);if(_0x45b3b3>0x0){_0x45b3b3=_0x45b3b3<0x64?0x64:_0x45b3b3;loggerPredictive[_0x8104('0x7c')](_0x5d2087[_0x8104('0x42')],'one\x20call\x20every:',_0x45b3b3,_0x8104('0x4b'));_0x5d2087[_0x8104('0x8e')]=setInterval(function(){_0xc6c767[_0x8104('0x8e')](_0x5d2087);loggerPredictiveCalls[_0x8104('0x7c')](_0x8104('0x1ef'),_0x2c118a+=0x1);},_0x45b3b3);}else{loggerPredictive[_0x8104('0x7c')](_0x5d2087[_0x8104('0x42')],_0x8104('0x1f0'));}};};Dialer[_0x8104('0x1a')][_0x8104('0x1f1')]=function(_0x327057,_0x4d2507){var _0x2610f9=this;return function(_0x6ca5b8){if(_[_0x8104('0x7a')](_0x6ca5b8)){if(_[_0x8104('0xac')](_0x4d2507[_0x8104('0xd3')])||!_0x4d2507['recallme']){if(_0x327057[_0x8104('0x5c')]===_0x8104('0x15d')){_0x327057[_0x8104('0x12f')]=_['isUndefined'](_0x327057[_0x8104('0x12f')])?!![]:_0x327057[_0x8104('0x12f')];var _0x370797=uuid['v4']();_0x2610f9[_0x8104('0xaa')][_0x370797]=new Action(_0x327057,_0x4d2507,_0x370797);loggerBooked['info'](_0x8104('0x1f2'),_0x370797,_0x8104('0x1f3'),JSON[_0x8104('0x4a')](_0x327057['queueStatusComplete']),_0x8104('0x1f4'),_0x327057['name']);if(_0x327057[_0x8104('0x12f')]){_0x327057[_0x8104('0x12f')]=![];_0x2610f9[_0x8104('0x2b')][_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0xb2')]]=[];ami[_0x8104('0xad')]({'actionid':_0x370797,'action':_0x8104('0x1f5'),'queue':_0x327057['name']})[_0x8104('0xb7')](function(_0x55f169){_0x2610f9[_0x8104('0xb1')](_0x327057);_0x2610f9['rescheduleContact']({'active':![],'ContactId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0x101')],'ListId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0xd2')],'VoiceQueueId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0xd4')]||undefined,'CampaignId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0xd5')]||undefined})[_0x8104('0xb7')](loggerCatch(_0x8104('0x1f6')));delete _0x2610f9[_0x8104('0xaa')][_0x370797];});}else{loggerBooked[_0x8104('0x7c')](_0x8104('0x1f7'),JSON['stringify'](_0x327057[_0x8104('0x12f')]),_0x8104('0x1f4'),_0x327057[_0x8104('0x42')]);_0x2610f9[_0x8104('0xb1')](_0x327057);_0x2610f9[_0x8104('0xbf')]({'active':![],'ContactId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0x101')],'ListId':_0x2610f9['actions'][_0x370797]['ListId'],'VoiceQueueId':_0x2610f9[_0x8104('0xaa')][_0x370797]['VoiceQueueId']||undefined,'CampaignId':_0x2610f9[_0x8104('0xaa')][_0x370797][_0x8104('0xd5')]||undefined})['catch'](loggerCatch(_0x8104('0x1f6')));delete _0x2610f9[_0x8104('0xaa')][_0x370797];}}else{return _0x2610f9[_0x8104('0x16b')](_0x327057,_0x4d2507);}}else{if(getDiff(_0x4d2507[_0x8104('0x1f8')])<_0x327057[_0x8104('0x1f9')]*0x3c){if(_0x4d2507[_0x8104('0x1fa')]&&!_0x4d2507[_0x8104('0x1fa')][_0x8104('0x1fb')]){_0x2610f9['preview'][_0x8104('0x138')](_0x4d2507['id'])[_0x8104('0x1d')](function(){_0x2610f9[_0x8104('0xb1')](_0x327057);});}else{_0x2610f9[_0x8104('0xc1')]({'active':![]},_0x4d2507['id'],0x1)[_0x8104('0x1d')](function(){console[_0x8104('0x1fc')](_0x8104('0x1fd'));_0x2610f9[_0x8104('0xb1')](_0x327057);});}}else{_0x327057['outboundReCallsDay']+=0x1;_0x2610f9[_0x8104('0xb1')](_0x327057);if(_0x327057[_0x8104('0x1fe')]){_0x2610f9[_0x8104('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4d2507[_0x8104('0x101')],'ListId':_0x4d2507['ListId'],'VoiceQueueId':_0x4d2507[_0x8104('0xd4')]||undefined,'CampaignId':_0x4d2507[_0x8104('0xd5')]||undefined})[_0x8104('0xb7')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x2610f9[_0x8104('0xc9')](createObjHistory(_0x327057,_0x4d2507,'RECALLINQUEUE',0x17,_0x8104('0x1ff')))['catch'](loggerCatch(_0x8104('0x200')));}else{_0x2610f9[_0x8104('0xd0')](createObjHistory(_0x327057,_0x4d2507,_0x8104('0x201'),0x16,_0x8104('0x202')),_0x8104('0x203'),_0x8104('0x204'));}}}}else{_0x327057[_0x8104('0x205')]+=0x1;_0x2610f9['saveInDb'](createObjHistory(_0x327057,_0x4d2507,_0x8104('0x206'),0xd,_0x8104('0x207')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x8104('0x208');}};};Dialer[_0x8104('0x1a')][_0x8104('0x160')]=function(_0x5b57b1){var _0x23e560=this;var _0xabd0e3=[];var _0x272427=_0x5b57b1[_0x8104('0x209')]-_0x5b57b1[_0x8104('0x6d')]-_0x5b57b1[_0x8104('0x20a')];emitCampaignSummary(_0x5b57b1);if(_0x272427>0x0){if(_0x272427>this[_0x8104('0x23')]){_0x272427=this['maxNumberOriginate'];}_0x5b57b1[_0x8104('0x20a')]+=_0x272427;this['getContactDialerIvr'](_0x5b57b1['id'],_0x272427,_0x5b57b1[_0x8104('0x20b')])[_0x8104('0xb6')](function(_0xe53ee5){_0x5b57b1['temp']-=_0x272427;_0x5b57b1['temp']=_0x5b57b1[_0x8104('0x20a')]>0x0?_0x5b57b1[_0x8104('0x20a')]:0x0;if(!checkContactEmpty(_0xe53ee5)){_0x5b57b1[_0x8104('0x41')]=_0x8104('0x9c');logger[_0x8104('0x7c')](_0x8104('0x20c')+_0x5b57b1[_0x8104('0x42')]);}else{_0x5b57b1['originated']+=_0xe53ee5[_0x8104('0x95')];_0x5b57b1[_0x8104('0x41')]=_0x8104('0x20d');for(var _0x5edf4d=0x0;_0x5edf4d<_0xe53ee5[_0x8104('0x95')];_0x5edf4d+=0x1){_0x5b57b1[_0x8104('0x20e')]+=0x1;if(_[_0x8104('0xac')](_0xe53ee5[_0x5edf4d])||_[_0x8104('0xac')](_0xe53ee5[_0x5edf4d][_0x8104('0x16e')])||_[_0x8104('0xac')](_0xe53ee5[_0x5edf4d][_0x8104('0x16e')][_0x8104('0x16f')])){_0x23e560['emptyContact'](_0x8104('0x20f'),_0x5b57b1,_0xe53ee5[_0x5edf4d]);}else{_0x23e560[_0x8104('0xbb')](_['pick'](_0xe53ee5[_0x5edf4d],[_0x8104('0xd5'),_0x8104('0x210')]))[_0x8104('0xb6')](_0x23e560[_0x8104('0x1f1')](_0x5b57b1,_0xe53ee5[_0x5edf4d]))['catch'](_0x23e560[_0x8104('0xcd')](_0x8104('0x211'),_0x5b57b1));}}}})[_0x8104('0xb7')](loggerGetContactDialer(_0x8104('0x212'),_0x5b57b1,_0x272427));}};Dialer[_0x8104('0x1a')][_0x8104('0x159')]=function(_0x36d35c,_0x5438ab){var _0x9aebb9=this;var _0xf6c3ec=[];var _0x2ccceb=_0x5438ab>=0x1?_0x5438ab:0x1;var _0x1db91d=[];if(_0x36d35c['dialMethod']===_0x8104('0x15d')){_0x2ccceb=0x1;}var _0x48f833=Math['floor'](_0x36d35c['available']*_0x2ccceb)-_0x36d35c[_0x8104('0x6d')]-_0x36d35c[_0x8104('0x20a')];emitVoiceQueueSummary(_0x36d35c);if(_0x36d35c[_0x8104('0x213')]>0x0){var _0x13dbcf=_0x36d35c['dialLimitQueue']-_0x36d35c[_0x8104('0x6d')]-_0x36d35c[_0x8104('0x56')]-_0x36d35c[_0x8104('0x20a')]-_0x36d35c[_0x8104('0x53')];if(_0x48f833>_0x13dbcf){_0x48f833=_0x13dbcf;}}if(_0x48f833>0x0){if(_0x36d35c[_0x8104('0x5c')]===_0x8104('0x15d')){_0x48f833=0x1;}if(_0x48f833>this[_0x8104('0x23')]){_0x48f833=this[_0x8104('0x23')];}_0x36d35c[_0x8104('0x20a')]+=_0x48f833;for(var _0x483d94 in this[_0x8104('0x21')]){if(this[_0x8104('0x21')]['hasOwnProperty'](_0x483d94)){if(this[_0x8104('0x21')][_0x483d94][_0x8104('0xe2')]==='not_inuse'&&this[_0x8104('0x21')][_0x483d94][_0x8104('0xae')]==='reachable'){_0xf6c3ec[_0x8104('0x12c')](this[_0x8104('0x21')][_0x483d94]['id']);}}}this['getContactDialer'](_0x36d35c['id'],_0xf6c3ec,_0x48f833,_0x36d35c[_0x8104('0x20b')])[_0x8104('0xb6')](function(_0x516c19){_0x36d35c[_0x8104('0x20a')]-=_0x48f833;_0x36d35c[_0x8104('0x20a')]=_0x36d35c[_0x8104('0x20a')]>0x0?_0x36d35c['temp']:0x0;if(!checkContactEmpty(_0x516c19)){_0x9aebb9['countReScheduled'](_0x36d35c)['then'](sendMessageReschedule(_0x36d35c))[_0x8104('0xb7')](loggerCatch(_0x8104('0xb8')));}else{_0x36d35c[_0x8104('0x6d')]+=_0x516c19[_0x8104('0x95')];_0x36d35c[_0x8104('0x41')]=_0x36d35c[_0x8104('0x5c')]===_0x8104('0x15d')?'ACTIVE':_0x8104('0x20d');for(var _0x53bfcd=0x0;_0x53bfcd<_0x516c19[_0x8104('0x95')];_0x53bfcd+=0x1){if(_[_0x8104('0xac')](_0x516c19[_0x53bfcd])||_[_0x8104('0xac')](_0x516c19[_0x53bfcd][_0x8104('0x16e')])||_[_0x8104('0xac')](_0x516c19[_0x53bfcd]['Contact'][_0x8104('0x16f')])){_0x9aebb9['emptyContact'](_0x8104('0x20f'),_0x36d35c,_0x516c19[_0x53bfcd]);}else{_0x9aebb9[_0x8104('0xb9')](_[_0x8104('0xd1')](_0x516c19[_0x53bfcd],[_0x8104('0xd4'),_0x8104('0x210')]))['then'](_0x9aebb9[_0x8104('0x1f1')](_0x36d35c,_0x516c19[_0x53bfcd]))[_0x8104('0xb7')](_0x9aebb9[_0x8104('0xcd')](_0x8104('0x20f'),_0x36d35c));}}}})[_0x8104('0xb7')](loggerGetContactDialer(_0x8104('0x214'),_0x36d35c,_0x48f833));}};Dialer['prototype'][_0x8104('0x8e')]=function(_0x4aaca2){var _0xd6655=this;if(_0x4aaca2[_0x8104('0x213')]>0x0){var _0x1d0bd7=_0x4aaca2[_0x8104('0x213')]-_0x4aaca2[_0x8104('0x6d')]-_0x4aaca2['talking'];if(_0x1d0bd7>0x0){this['tryOriginatePredictive'](_0x4aaca2);}else{loggerPredictiveCalls[_0x8104('0x7c')](_0x8104('0x215'));}}else{this[_0x8104('0x216')](_0x4aaca2);}};Dialer[_0x8104('0x1a')][_0x8104('0x216')]=function(_0x4e82cf){var _0x1e3f0a=this;var _0x17682f=[];_0x4e82cf['originated']+=0x1;for(var _0x11cc4c in this[_0x8104('0x21')]){if(this[_0x8104('0x21')][_0x8104('0x96')](_0x11cc4c)){if(this[_0x8104('0x21')][_0x11cc4c]['state']===_0x8104('0x217')&&this['agents'][_0x11cc4c][_0x8104('0xae')]===_0x8104('0xd9')){_0x17682f[_0x8104('0x12c')](this[_0x8104('0x21')][_0x11cc4c]['id']);}}}this[_0x8104('0xc3')](_0x4e82cf['id'],_0x17682f,0x1,_0x4e82cf[_0x8104('0x20b')])['then'](function(_0xca3a37){if(!checkContactEmpty(_0xca3a37)){checkContactLowerLimitOriginate(_0x4e82cf,0x1,0x0);_0x1e3f0a[_0x8104('0xb5')](_0x4e82cf)[_0x8104('0xb6')](sendMessageReschedule(_0x4e82cf))['catch'](loggerCatch(_0x8104('0xb8')));}else{_0x4e82cf['message']=_0x8104('0x20d');if(_[_0x8104('0xac')](_0xca3a37[0x0])||_[_0x8104('0xac')](_0xca3a37[0x0]['Contact'])||_[_0x8104('0xac')](_0xca3a37[0x0]['Contact'][_0x8104('0x16f')])){_0x1e3f0a[_0x8104('0xce')](_0x8104('0x20f'),_0x4e82cf,_0xca3a37[0x0]);}else{_0x1e3f0a[_0x8104('0xb9')](_[_0x8104('0xd1')](_0xca3a37[0x0],[_0x8104('0xd4'),'Contact.phone']))[_0x8104('0xb6')](_0x1e3f0a[_0x8104('0x1f1')](_0x4e82cf,_0xca3a37[0x0]))[_0x8104('0xb7')](_0x1e3f0a[_0x8104('0xcd')](_0x8104('0x218'),_0x4e82cf));}}})[_0x8104('0xb7')](loggerGetContactDialer(_0x8104('0x219'),_0x4e82cf,0x1));emitVoiceQueueSummary(_0x4e82cf);};Dialer[_0x8104('0x1a')]['abandonmentRate']=function(_0x6823e6,_0x7f5f9a,_0x80e8aa,_0x3f2bf5,_0x3be33c,_0x1f2ca2){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x8104('0x7c')](_0x8104('0x21a'),_0x6823e6);loggerPredictive[_0x8104('0x7c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x7f5f9a);loggerPredictive[_0x8104('0x7c')](_0x8104('0x21b'),_0x80e8aa);loggerPredictive['info'](_0x8104('0x21c'),_0x3f2bf5);loggerPredictive[_0x8104('0x7c')](_0x8104('0x21d'),_0x3be33c);loggerPredictive[_0x8104('0x7c')]('---------------------------');return new BPromise(function(_0x10d436,_0x2012a3){if(_0x6823e6<=0x0||isNaN(_0x6823e6)){return _0x2012a3(msgResponse('[abandonmentRate]',_0x8104('0x49'),'m\x20=\x20'+_0x6823e6));}if(_0x80e8aa<=0x0||isNaN(_0x80e8aa)){return _0x2012a3(msgResponse(_0x8104('0x21e'),'Error',_0x8104('0x21f')+_0x80e8aa));}if(_0x3f2bf5<=0x0||isNaN(_0x3f2bf5)){return _0x2012a3(msgResponse(_0x8104('0x21e'),_0x8104('0x49'),'p\x20=\x20'+_0x3f2bf5));}if(_0x7f5f9a<=0x0||isNaN(_0x7f5f9a)){return _0x2012a3(msgResponse(_0x8104('0x21e'),_0x8104('0x49'),_0x8104('0x220')+_0x7f5f9a));}if(_0x3be33c<=0x0||isNaN(_0x3be33c)){return _0x2012a3(msgResponse(_0x8104('0x21e'),'Error','Amax\x20=\x20'+_0x3be33c));}_0x1f2ca2=_0x1f2ca2||0x0;var _0x706293=0x1/_0x80e8aa;var _0x321e2d=0x0;var _0x3cb79f=0x0;var _0x242aef=0x0;var _0x39d8e4=0x0;for(var _0x2c7fa3=0x0;_0x242aef<_0x3be33c;_0x2c7fa3+=0x1){_0x3cb79f=_0x2c7fa3/_0x7f5f9a;_0x321e2d=(_0x3f2bf5*_0x3cb79f+_0x1f2ca2)/_0x706293;_0x242aef=erlangb(_0x321e2d,_0x6823e6);_0x39d8e4=_0x321e2d/_0x6823e6*(0x1-erlangb(_0x321e2d,_0x6823e6));}return _0x10d436({'erlangCalls':_0x2c7fa3,'erlangCallToSecond':_0x7f5f9a/_0x2c7fa3,'erlangAbandonmentRate':_0x242aef,'erlangBusyFactor':_0x39d8e4});});};Dialer['prototype']['busyFactor']=function(_0x1f943a,_0xd103fd,_0x15ad81,_0x393c32,_0x4d293f,_0x5df9d2){loggerPredictive[_0x8104('0x7c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x8104('0x7c')](_0x8104('0x21a'),_0x1f943a);loggerPredictive[_0x8104('0x7c')](_0x8104('0x221'),_0xd103fd);loggerPredictive[_0x8104('0x7c')](_0x8104('0x21b'),_0x15ad81);loggerPredictive[_0x8104('0x7c')](_0x8104('0x21c'),_0x393c32);loggerPredictive[_0x8104('0x7c')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4d293f);loggerPredictive[_0x8104('0x7c')](_0x8104('0x82'));return new BPromise(function(_0x2e85ff,_0x4b4410){if(_0x1f943a<=0x0||isNaN(_0x1f943a)){return _0x4b4410(msgResponse(_0x8104('0x222'),_0x8104('0x49'),_0x8104('0x223')+_0x1f943a));}if(_0x15ad81<=0x0||isNaN(_0x15ad81)){return _0x4b4410(msgResponse('[busyFactor]',_0x8104('0x49'),_0x8104('0x21f')+_0x15ad81));}if(_0x393c32<=0x0||isNaN(_0x393c32)){return _0x4b4410(msgResponse(_0x8104('0x222'),_0x8104('0x49'),_0x8104('0x224')+_0x393c32));}if(_0xd103fd<=0x0||isNaN(_0xd103fd)){return _0x4b4410(msgResponse(_0x8104('0x222'),_0x8104('0x49'),'interval\x20=\x20'+_0xd103fd));}if(_0x4d293f<=0x0||isNaN(_0x4d293f)){return _0x4b4410(msgResponse('[busyFactor]','Error','Umin\x20=\x20'+_0x4d293f));}_0x5df9d2=_0x5df9d2||0x0;var _0x19ecae=0x1/_0x15ad81;var _0x190ba0=0x0;var _0x4eea8e=0x0;var _0xf9ce13=0x0;var _0x181aa0=0x0;for(var _0x33a1bc=0x0;_0x181aa0<_0x4d293f;_0x33a1bc+=0x1){_0x4eea8e=_0x33a1bc/_0xd103fd;_0x190ba0=(_0x393c32*_0x4eea8e+_0x5df9d2)/_0x19ecae;_0xf9ce13=erlangb(_0x190ba0,_0x1f943a);_0x181aa0=_0x190ba0/_0x1f943a*(0x1-erlangb(_0x190ba0,_0x1f943a));}return _0x2e85ff({'erlangCalls':_0x33a1bc,'erlangCallToSecond':_0xd103fd/_0x33a1bc,'erlangAbandonmentRate':_0xf9ce13,'erlangBusyFactor':_0x181aa0});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 7df6fa5..7103186 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 _0x2d23=['lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','number','starttime','droptime','endtime','ringtime','responsetime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x4fff7b,_0x43d15c){var _0x52b1b2=function(_0x1fd726){while(--_0x1fd726){_0x4fff7b['push'](_0x4fff7b['shift']());}};_0x52b1b2(++_0x43d15c);}(_0x2d23,0xcc));var _0x32d2=function(_0x1969f1,_0x33c13c){_0x1969f1=_0x1969f1-0x0;var _0x30db65=_0x2d23[_0x1969f1];return _0x30db65;};'use strict';var util=require(_0x32d2('0x0'));var _=require(_0x32d2('0x1'));var moment=require('moment');function getSeconds(_0x4a5273,_0x48e401){var _0xee5c82=moment(_0x4a5273)['milliseconds'](0x0);var _0x32de79=moment(_0x48e401)[_0x32d2('0x2')](0x0);return _0xee5c82[_0x32d2('0x3')](_0x32de79,_0x32d2('0x4'));}function QueueCallerAbandon(_0x5eb02f,_0x5269e5){this[_0x32d2('0x5')]=_0x5eb02f[_0x32d2('0x5')];this[_0x32d2('0x6')]=_0x5eb02f['type'];this[_0x32d2('0x7')]=_0x5eb02f[_0x32d2('0x6')]==='outbound'?_0x32d2('0x8'):_0x5eb02f[_0x32d2('0x6')];this[_0x32d2('0x9')]=_0x5eb02f['countbusyretry'];this['countcongestionretry']=_0x5eb02f['countcongestionretry'];this[_0x32d2('0xa')]=_0x5eb02f['countnoanswerretry'];this[_0x32d2('0xb')]=_0x5eb02f[_0x32d2('0x9')]+_0x5eb02f['countcongestionretry']+_0x5eb02f[_0x32d2('0xa')]+_0x5eb02f['countnosuchnumberretry']+_0x5eb02f['countdropretry']+_0x5eb02f[_0x32d2('0xc')]+_0x5eb02f[_0x32d2('0xd')]+_0x5eb02f[_0x32d2('0xe')];this[_0x32d2('0xf')]=_0x5eb02f[_0x32d2('0xf')];this['countdropretry']=_0x5eb02f['countdropretry'];this['countabandonedretry']=_0x5eb02f[_0x32d2('0xc')];this[_0x32d2('0xd')]=_0x5eb02f['countmachineretry'];this[_0x32d2('0xe')]=_0x5eb02f[_0x32d2('0xe')];this[_0x32d2('0x10')]=_0x5269e5['uniqueid'];this[_0x32d2('0x11')]=_0x5eb02f['name'];this[_0x32d2('0x12')]=_0x5eb02f[_0x32d2('0x13')];this['starttime']=_0x5eb02f[_0x32d2('0x14')];this['responsetime']=_0x5eb02f['responsetime'];this['droptime']=_0x5eb02f[_0x32d2('0x15')];this[_0x32d2('0x16')]=this['droptime'];this[_0x32d2('0x17')]=getSeconds(_0x5eb02f[_0x32d2('0x18')],_0x5eb02f['starttime']);this[_0x32d2('0x19')]=getSeconds(this['droptime'],_0x5eb02f[_0x32d2('0x18')]);this[_0x32d2('0x1a')]=0x0;this[_0x32d2('0x8')]=_0x5269e5[_0x32d2('0x8')];this[_0x32d2('0x1b')]=_0x5269e5[_0x32d2('0x1c')];this[_0x32d2('0x1d')]=_0x5269e5[_0x32d2('0x1d')];this[_0x32d2('0x1e')]=_0x5eb02f[_0x32d2('0x1e')];this[_0x32d2('0x1f')]=_0x5eb02f[_0x32d2('0x1f')];this[_0x32d2('0x20')]=_0x5eb02f[_0x32d2('0x20')];this[_0x32d2('0x21')]=_0x5eb02f[_0x32d2('0x21')];this[_0x32d2('0x22')]=_0x5eb02f[_0x32d2('0x22')];this[_0x32d2('0x23')]=_0x5eb02f[_0x32d2('0x23')];this[_0x32d2('0x24')]=_0x5eb02f['UserId'];this['VoiceQueueId']=_0x5eb02f['VoiceQueueId'];this[_0x32d2('0x25')]=_0x5eb02f[_0x32d2('0x25')];this['originatecalleridnum']=_0x5eb02f[_0x32d2('0x26')]||'';this[_0x32d2('0x27')]=_0x5eb02f['originatecalleridname']||'';}module[_0x32d2('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x3838=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback'];(function(_0x2afc7b,_0x33dda7){var _0x391ef4=function(_0x3d906d){while(--_0x3d906d){_0x2afc7b['push'](_0x2afc7b['shift']());}};_0x391ef4(++_0x33dda7);}(_0x3838,0xe1));var _0x8383=function(_0x4fbf1d,_0x5c8ba2){_0x4fbf1d=_0x4fbf1d-0x0;var _0x2b4689=_0x3838[_0x4fbf1d];return _0x2b4689;};'use strict';var util=require(_0x8383('0x0'));var _=require(_0x8383('0x1'));var moment=require(_0x8383('0x2'));function getSeconds(_0x3d0c0a,_0x330e74){var _0x39cbec=moment(_0x3d0c0a)[_0x8383('0x3')](0x0);var _0x1c07ad=moment(_0x330e74)[_0x8383('0x3')](0x0);return _0x39cbec[_0x8383('0x4')](_0x1c07ad,_0x8383('0x5'));}function QueueCallerAbandon(_0x284e30,_0x47cb9e){this[_0x8383('0x6')]=_0x284e30[_0x8383('0x6')];this['type']=_0x284e30[_0x8383('0x7')];this['campaigntype']=_0x284e30['type']===_0x8383('0x8')?'queue':_0x284e30[_0x8383('0x7')];this[_0x8383('0x9')]=_0x284e30['countbusyretry'];this[_0x8383('0xa')]=_0x284e30['countcongestionretry'];this[_0x8383('0xb')]=_0x284e30[_0x8383('0xb')];this[_0x8383('0xc')]=_0x284e30[_0x8383('0x9')]+_0x284e30[_0x8383('0xa')]+_0x284e30[_0x8383('0xb')]+_0x284e30[_0x8383('0xd')]+_0x284e30['countdropretry']+_0x284e30[_0x8383('0xe')]+_0x284e30[_0x8383('0xf')]+_0x284e30[_0x8383('0x10')];this[_0x8383('0xd')]=_0x284e30[_0x8383('0xd')];this[_0x8383('0x11')]=_0x284e30[_0x8383('0x11')];this['countabandonedretry']=_0x284e30[_0x8383('0xe')];this['countmachineretry']=_0x284e30[_0x8383('0xf')];this[_0x8383('0x10')]=_0x284e30['countagentrejectretry'];this[_0x8383('0x12')]=_0x47cb9e[_0x8383('0x12')];this[_0x8383('0x13')]=_0x284e30['name'];this[_0x8383('0x14')]=_0x284e30['number'];this[_0x8383('0x15')]=_0x284e30[_0x8383('0x15')];this[_0x8383('0x16')]=_0x284e30[_0x8383('0x16')];this[_0x8383('0x17')]=_0x284e30[_0x8383('0x17')];this[_0x8383('0x18')]=this['droptime'];this[_0x8383('0x19')]=getSeconds(_0x284e30['responsetime'],_0x284e30['starttime']);this[_0x8383('0x1a')]=getSeconds(this[_0x8383('0x17')],_0x284e30['responsetime']);this[_0x8383('0x1b')]=0x0;this[_0x8383('0x1c')]=_0x47cb9e[_0x8383('0x1c')];this[_0x8383('0x1d')]=_0x47cb9e[_0x8383('0x1e')];this[_0x8383('0x1f')]=_0x47cb9e[_0x8383('0x1f')];this[_0x8383('0x20')]=_0x284e30['callback'];this[_0x8383('0x21')]=_0x284e30[_0x8383('0x21')];this[_0x8383('0x22')]=_0x284e30[_0x8383('0x22')];this[_0x8383('0x23')]=_0x284e30[_0x8383('0x23')];this[_0x8383('0x24')]=_0x284e30[_0x8383('0x24')];this[_0x8383('0x25')]=_0x284e30[_0x8383('0x25')];this[_0x8383('0x26')]=_0x284e30[_0x8383('0x26')];this[_0x8383('0x27')]=_0x284e30[_0x8383('0x27')];this[_0x8383('0x28')]=_0x284e30[_0x8383('0x28')];this[_0x8383('0x29')]=_0x284e30[_0x8383('0x29')]||'';this[_0x8383('0x2a')]=_0x284e30['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 131fa69..15d714b 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 _0xaa28=['lodash','uniqueid','channel','format','%s/%s/%s','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0xaa28,0x1c7));var _0x8aa2=function(_0x470f63,_0x48d80b){_0x470f63=_0x470f63-0x0;var _0x4f09e2=_0xaa28[_0x470f63];return _0x4f09e2;};'use strict';var util=require('util');var _=require(_0x8aa2('0x0'));var moment=require('moment');function Action(_0x3977c2,_0xfb5a7,_0x91eb10){this[_0x8aa2('0x1')]=_0x3977c2||undefined;this[_0x8aa2('0x2')]=util[_0x8aa2('0x3')](_0x8aa2('0x4'),_0xfb5a7['tech'],_0xfb5a7[_0x8aa2('0x5')][_0x8aa2('0x6')],_0x91eb10[_0x8aa2('0x7')]);this['localstationid']=_0xfb5a7[_0x8aa2('0x8')];this[_0x8aa2('0x9')]=_0xfb5a7[_0x8aa2('0x9')];this[_0x8aa2('0xa')]=_0x91eb10['path'];this[_0x8aa2('0xb')]=_0x91eb10[_0x8aa2('0xb')];}module[_0x8aa2('0xc')]=Action; \ No newline at end of file +var _0xe69f=['lodash','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId'];(function(_0x23dc93,_0x5860ca){var _0x16458e=function(_0x1c864a){while(--_0x1c864a){_0x23dc93['push'](_0x23dc93['shift']());}};_0x16458e(++_0x5860ca);}(_0xe69f,0x1d4));var _0xfe69=function(_0x4fbc74,_0x30d5c4){_0x4fbc74=_0x4fbc74-0x0;var _0x37b30e=_0xe69f[_0x4fbc74];return _0x37b30e;};'use strict';var util=require('util');var _=require(_0xfe69('0x0'));var moment=require('moment');function Action(_0x166430,_0xc76381,_0x5c9ce3){this[_0xfe69('0x1')]=_0x166430||undefined;this[_0xfe69('0x2')]=util[_0xfe69('0x3')](_0xfe69('0x4'),_0xc76381[_0xfe69('0x5')],_0xc76381[_0xfe69('0x6')][_0xfe69('0x7')],_0x5c9ce3[_0xfe69('0x8')]);this['localstationid']=_0xc76381[_0xfe69('0x9')];this[_0xfe69('0xa')]=_0xc76381['headerinfo'];this[_0xfe69('0xb')]=_0x5c9ce3['path'];this[_0xfe69('0xc')]=_0x5c9ce3['AttachmentId'];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 1474ad8..f12ec01 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 _0xd1b7=['[Fax][execOriginate][success]','message','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','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','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','status','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId'];(function(_0x101ef2,_0x54d76b){var _0x539471=function(_0x2cf208){while(--_0x2cf208){_0x101ef2['push'](_0x101ef2['shift']());}};_0x539471(++_0x54d76b);}(_0xd1b7,0x10f));var _0x7d1b=function(_0x4d58d7,_0x538a07){_0x4d58d7=_0x4d58d7-0x0;var _0x59e312=_0xd1b7[_0x4d58d7];return _0x59e312;};'use strict';var util=require(_0x7d1b('0x0'));var _=require(_0x7d1b('0x1'));var BPromise=require(_0x7d1b('0x2'));var uuid=require('uuid');var moment=require(_0x7d1b('0x3'));var path=require(_0x7d1b('0x4'));var tiff2pdf=require(_0x7d1b('0x5'));var gs=require(_0x7d1b('0x6'));var logger=require('../../../config/logger')(_0x7d1b('0x7'));var ami=require('../ami');var rpcDb=require(_0x7d1b('0x8'));var Channel=require(_0x7d1b('0x9'));var ut=require(_0x7d1b('0xa'));var Action=require('./action');var faxAccount=require(_0x7d1b('0xb'));var attachment=require(_0x7d1b('0xc'));var faxMessage=require(_0x7d1b('0xd'));function Fax(_0x5ede1b){this[_0x7d1b('0xe')]={};this[_0x7d1b('0xf')]=_0x5ede1b[_0x7d1b('0xf')];this['trunks']=_0x5ede1b[_0x7d1b('0x10')];this[_0x7d1b('0x11')]={};ami['on'](_0x7d1b('0x12'),this[_0x7d1b('0x13')][_0x7d1b('0x14')](this));ami['on'](_0x7d1b('0x15'),this['syncVarSet'][_0x7d1b('0x14')](this));ami['on'](_0x7d1b('0x16'),this[_0x7d1b('0x17')]['bind'](this));ami['on'](_0x7d1b('0x18'),this[_0x7d1b('0x19')][_0x7d1b('0x14')](this));ami['on'](_0x7d1b('0x1a'),this[_0x7d1b('0x1b')]['bind'](this));ami['on'](_0x7d1b('0x1c'),this['syncReceiveFax']['bind'](this));ami['on'](_0x7d1b('0x1d'),this[_0x7d1b('0x1e')]['bind'](this));ami['on'](_0x7d1b('0x1f'),this[_0x7d1b('0x20')][_0x7d1b('0x14')](this));}Fax[_0x7d1b('0x21')][_0x7d1b('0x13')]=function(_0x46a9a1){if(_0x46a9a1[_0x7d1b('0x22')]==='from-voip-provider'){for(var _0x13b8a6 in this[_0x7d1b('0xf')]){if(this[_0x7d1b('0xf')][_0x7d1b('0x23')](_0x13b8a6)){if(_0x46a9a1[_0x7d1b('0x24')]===this[_0x7d1b('0xf')][_0x13b8a6][_0x7d1b('0x25')]){this[_0x7d1b('0xe')][_0x46a9a1[_0x7d1b('0x26')]]={};this[_0x7d1b('0xe')][_0x46a9a1[_0x7d1b('0x26')]][_0x7d1b('0x27')]=_0x46a9a1['channel'];this[_0x7d1b('0xe')][_0x46a9a1[_0x7d1b('0x26')]]['id']=this[_0x7d1b('0xf')][_0x13b8a6]['id'];this['channels'][_0x46a9a1[_0x7d1b('0x26')]][_0x7d1b('0x28')]=this[_0x7d1b('0xf')][_0x13b8a6]['name'];logger[_0x7d1b('0x29')](_0x46a9a1[_0x7d1b('0x26')],_0x7d1b('0x2a'));}}}}if(this['actions'][_0x46a9a1[_0x7d1b('0x26')]]){this['channels'][_0x46a9a1['uniqueid']]={};this[_0x7d1b('0xe')][_0x46a9a1[_0x7d1b('0x26')]]['channel']=_0x46a9a1['channel'];logger['info'](_0x46a9a1[_0x7d1b('0x26')],_0x7d1b('0x2a'));}};Fax['prototype'][_0x7d1b('0x2b')]=function(_0x3b2963){if(this[_0x7d1b('0xe')][_0x3b2963[_0x7d1b('0x26')]]){for(var _0x4fc4f8 in _0x3b2963['variable']){if(_0x3b2963[_0x7d1b('0x2c')][_0x7d1b('0x23')](_0x4fc4f8)){this[_0x7d1b('0xe')][_0x3b2963['uniqueid']][_0x4fc4f8]=_0x3b2963[_0x7d1b('0x2d')];}}}};Fax[_0x7d1b('0x21')]['syncNewState']=function(_0x260479){if(this[_0x7d1b('0xe')][_0x260479['uniqueid']]){this[_0x7d1b('0xe')][_0x260479[_0x7d1b('0x26')]]['channelstate']=_0x260479[_0x7d1b('0x2e')];this[_0x7d1b('0xe')][_0x260479[_0x7d1b('0x26')]][_0x7d1b('0x2f')]=_0x260479[_0x7d1b('0x2f')];}};Fax[_0x7d1b('0x21')]['syncNewExten']=function(_0x46b0f7){if(this[_0x7d1b('0xe')][_0x46b0f7[_0x7d1b('0x26')]]){for(var _0x449dc3 in _0x46b0f7[_0x7d1b('0x2c')]){if(_0x46b0f7['variable'][_0x7d1b('0x23')](_0x449dc3)){this[_0x7d1b('0xe')][_0x46b0f7['uniqueid']][_0x449dc3]=_0x46b0f7[_0x7d1b('0x2d')];}}}};Fax[_0x7d1b('0x21')]['syncFaxStatus']=function(_0x214a7f){if(this[_0x7d1b('0xe')][_0x214a7f[_0x7d1b('0x26')]]){this[_0x7d1b('0xe')][_0x214a7f[_0x7d1b('0x26')]]['operation']=_0x214a7f[_0x7d1b('0x30')];this[_0x7d1b('0xe')][_0x214a7f[_0x7d1b('0x26')]]['status']=_0x214a7f['status'];this[_0x7d1b('0xe')][_0x214a7f['uniqueid']][_0x7d1b('0x25')]=_0x214a7f[_0x7d1b('0x25')];this[_0x7d1b('0xe')][_0x214a7f[_0x7d1b('0x26')]][_0x7d1b('0x31')]=_0x214a7f[_0x7d1b('0x31')];logger['info'](_0x214a7f['uniqueid'],_0x7d1b('0x32'));}};Fax[_0x7d1b('0x21')][_0x7d1b('0x33')]=function(_0x3973bc){var _0x445e52=this;if(this['channels'][_0x3973bc[_0x7d1b('0x26')]]){var _0x3487bc=this[_0x7d1b('0xe')][_0x3973bc[_0x7d1b('0x26')]]['id'];this[_0x7d1b('0xe')][_0x3973bc[_0x7d1b('0x26')]][_0x7d1b('0x34')]=_0x3973bc[_0x7d1b('0x34')];this[_0x7d1b('0xe')][_0x3973bc['uniqueid']]['pagestransferred']=_0x3973bc['pagestransferred'];this['channels'][_0x3973bc[_0x7d1b('0x26')]]['localstationid']=_0x3973bc['localstationid'];this[_0x7d1b('0xe')][_0x3973bc[_0x7d1b('0x26')]][_0x7d1b('0x35')]=_0x3973bc[_0x7d1b('0x35')];this[_0x7d1b('0xe')][_0x3973bc[_0x7d1b('0x26')]][_0x7d1b('0x36')]=_0x3973bc[_0x7d1b('0x36')];this[_0x7d1b('0xe')][_0x3973bc[_0x7d1b('0x26')]][_0x7d1b('0x31')]=_0x3973bc[_0x7d1b('0x31')];this[_0x7d1b('0xe')][_0x3973bc[_0x7d1b('0x26')]][_0x7d1b('0x37')]=_0x3973bc[_0x7d1b('0x37')];if(this[_0x7d1b('0xe')][_0x3973bc[_0x7d1b('0x26')]][_0x7d1b('0x38')]>0x0){tiff2pdf(_0x3973bc[_0x7d1b('0x31')],_0x7d1b('0x39'),function(_0x2cf16e){logger['info'](_0x3973bc[_0x7d1b('0x26')],_0x7d1b('0x3a'),_0x2cf16e['message']);attachment[_0x7d1b('0x3b')]({'name':path[_0x7d1b('0x3c')](_0x3973bc['filename'])[_0x7d1b('0x28')],'basename':path[_0x7d1b('0x3c')](_0x3973bc[_0x7d1b('0x31')])['name']+_0x7d1b('0x3d'),'type':_0x7d1b('0x3e')})[_0x7d1b('0x3f')](function(_0x2c075f){faxAccount[_0x7d1b('0x40')](_0x3487bc,{'from':_0x3973bc['calleridnum'],'mapKey':_0x7d1b('0x7'),'body':path[_0x7d1b('0x3c')](_0x3973bc[_0x7d1b('0x31')])[_0x7d1b('0x28')]+'.pdf','AttachmentId':_0x2c075f['id']})['catch'](function(_0x54d9d5){logger[_0x7d1b('0x41')](_0x3973bc[_0x7d1b('0x26')],_0x7d1b('0x42'),JSON[_0x7d1b('0x43')](_0x54d9d5));});})[_0x7d1b('0x44')](function(_0x2a544e){logger[_0x7d1b('0x41')](_0x3973bc[_0x7d1b('0x26')],_0x7d1b('0x45'),JSON[_0x7d1b('0x43')](_0x2a544e));});});}logger[_0x7d1b('0x29')](_0x3973bc[_0x7d1b('0x26')],_0x7d1b('0x45'));}};Fax[_0x7d1b('0x21')][_0x7d1b('0x20')]=function(_0x20c255){if(this[_0x7d1b('0x11')][_0x20c255[_0x7d1b('0x26')]]){_['merge'](this['channels'][_0x20c255[_0x7d1b('0x26')]],_[_0x7d1b('0x46')](_0x20c255,[_0x7d1b('0x47'),_0x7d1b('0x48')]));}};function updateStatus(_0x5c0eba){if(_0x5c0eba[_0x7d1b('0x49')]){faxMessage['update'](_0x5c0eba[_0x7d1b('0x49')],{'failMessage':_0x7d1b('0x4a')})['then'](function(_0x1b6e14){ut[_0x7d1b('0x4b')]('[Fax][Message][Error][Updated]',_0x1b6e14);})[_0x7d1b('0x44')](function(_0x570476){ut[_0x7d1b('0x4b')](_0x7d1b('0x4c'),_0x570476);});}else{ut['logger'](_0x7d1b('0x4d'));}}Fax[_0x7d1b('0x21')][_0x7d1b('0x4e')]=function(_0x30ed70,_0x4c9c13,_0x5ad9ec){var _0x567a49=this;var _0x22c73a={};if(_0x4c9c13){_0x22c73a={'read':_0x4c9c13};}else{_0x22c73a={'failMessage':_0x5ad9ec};}if(this[_0x7d1b('0x11')][_0x30ed70]['AttachmentId']){faxMessage[_0x7d1b('0x4f')](this[_0x7d1b('0x11')][_0x30ed70][_0x7d1b('0x49')],_0x22c73a)['then'](function(_0xc988fb){ut[_0x7d1b('0x4b')](_0x7d1b('0x50'),_0xc988fb);})[_0x7d1b('0x44')](function(_0xe10818){ut['logger'](_0x7d1b('0x51'),_0xe10818);})[_0x7d1b('0x52')](function(){delete _0x567a49[_0x7d1b('0xe')][_0x30ed70];delete _0x567a49[_0x7d1b('0x11')][_0x30ed70];});}else{ut[_0x7d1b('0x4b')](_0x7d1b('0x53'));delete this[_0x7d1b('0xe')][_0x30ed70];delete this['actions'][_0x30ed70];}};Fax[_0x7d1b('0x21')][_0x7d1b('0x1e')]=function(_0x3b8e53){var _0x524234=this;if(this[_0x7d1b('0xe')][_0x3b8e53[_0x7d1b('0x26')]]){if(this['actions'][_0x3b8e53[_0x7d1b('0x26')]]){this[_0x7d1b('0xe')][_0x3b8e53[_0x7d1b('0x26')]]['id']=this[_0x7d1b('0x11')][_0x3b8e53[_0x7d1b('0x26')]]['id'];this['channels'][_0x3b8e53['uniqueid']][_0x7d1b('0x28')]=this[_0x7d1b('0x11')][_0x3b8e53[_0x7d1b('0x26')]][_0x7d1b('0x28')];}logger[_0x7d1b('0x29')](_0x3b8e53['uniqueid'],this[_0x7d1b('0x11')][_0x3b8e53[_0x7d1b('0x26')]]?_0x7d1b('0x54'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this['channels'][_0x3b8e53['uniqueid']]));if(this[_0x7d1b('0x11')][_0x3b8e53[_0x7d1b('0x26')]]){if(this[_0x7d1b('0xe')][_0x3b8e53['uniqueid']][_0x7d1b('0x55')]>0x0&&this[_0x7d1b('0xe')][_0x3b8e53[_0x7d1b('0x26')]][_0x7d1b('0x1a')]===_0x7d1b('0x56')){this[_0x7d1b('0x4e')](_0x3b8e53['uniqueid'],!![]);}else{this[_0x7d1b('0x4e')](_0x3b8e53[_0x7d1b('0x26')],![],this[_0x7d1b('0xe')][_0x3b8e53['uniqueid']][_0x7d1b('0x57')]?_0x7d1b('0x58')+this[_0x7d1b('0xe')][_0x3b8e53[_0x7d1b('0x26')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x7d1b('0x59')]=function(_0x4f32a9){var _0x16df37=this;return new BPromise(function(_0x496a6e,_0x344ca4){_0x16df37[_0x7d1b('0x5a')](_0x4f32a9,_0x16df37[_0x7d1b('0xf')][_0x4f32a9[_0x7d1b('0x5b')]])[_0x7d1b('0x3f')](function(_0x387158){ut[_0x7d1b('0x4b')](_0x7d1b('0x5c'),_0x387158);_0x496a6e(ut[_0x7d1b('0x5d')]('Fax\x20received'));})[_0x7d1b('0x44')](function(_0x17b31a){ut['logger'](_0x7d1b('0x5e'),_0x17b31a);updateStatus(_0x4f32a9);_0x344ca4(ut[_0x7d1b('0x5d')](_0x7d1b('0x5f')));});});};Fax[_0x7d1b('0x21')][_0x7d1b('0x60')]=function(_0x403751){var _0x372bc3=this;return new BPromise(function(_0x1bbbcc,_0x55cd08){var _0x1c1500=_0x372bc3[_0x7d1b('0x61')](_0x372bc3[_0x7d1b('0xf')][_0x403751[_0x7d1b('0x5b')]]['Trunk'],_0x403751);if(_0x1c1500[_0x7d1b('0x62')]){_0x1bbbcc(ut['message'](_0x7d1b('0x63')));}else{_0x55cd08(ut[_0x7d1b('0x5d')](_0x1c1500['message']));}});};function originate(_0x4bc826,_0x5f0aca,_0x320fc6){return new BPromise(function(_0x377e8c,_0x49081e){if(_0x320fc6){var _0x25a247=util['format'](_0x7d1b('0x64'),path[_0x7d1b('0x3c')](_0x4bc826[_0x7d1b('0x4')])[_0x7d1b('0x28')],_0x4bc826[_0x7d1b('0x4')]);gs['execute'](_0x25a247)[_0x7d1b('0x3f')](function(){_0x4bc826[_0x7d1b('0x4')]=util[_0x7d1b('0x65')](_0x7d1b('0x66'),path[_0x7d1b('0x3c')](_0x4bc826[_0x7d1b('0x4')])['dir'],path[_0x7d1b('0x3c')](_0x4bc826['path'])[_0x7d1b('0x28')]);_0x5f0aca[_0x7d1b('0x67')]=_0x4bc826['path'];ut[_0x7d1b('0x4b')](_0x7d1b('0x68'),'');ami[_0x7d1b('0x69')](ut[_0x7d1b('0x6a')](_0x4bc826,_0x5f0aca))['then'](function(_0x49d433){_0x377e8c(_0x49d433);})['catch'](function(_0x4f57a8){_0x49081e(_0x4f57a8);});})['catch'](function(_0x5ea1df){_0x49081e(_0x5ea1df);});}else{ami[_0x7d1b('0x69')](ut[_0x7d1b('0x6a')](_0x4bc826,_0x5f0aca))[_0x7d1b('0x3f')](function(_0x1da6fe){_0x377e8c(_0x1da6fe);})['catch'](function(_0x513160){_0x49081e(_0x513160);});}});}Fax[_0x7d1b('0x21')][_0x7d1b('0x5a')]=function(_0xc12f8a,_0x126850){var _0x21cf31=this;return new BPromise(function(_0x58e07e,_0x3814d6){var _0x991524=uuid['v4']();var _0x5506e6=ut[_0x7d1b('0x6b')](_0xc12f8a,_0x126850);_0x21cf31[_0x7d1b('0x11')][_0x991524]=new Action(_0x991524,_0x126850,_0xc12f8a);var _0x48ae9f=_0x21cf31[_0x7d1b('0x11')][_0x991524];if(path[_0x7d1b('0x3c')](_0xc12f8a[_0x7d1b('0x4')])[_0x7d1b('0x6c')]===_0x7d1b('0x3d')){originate(_0x48ae9f,_0x5506e6,!![])[_0x7d1b('0x3f')](function(_0x54a3d8){_0x58e07e(_0x54a3d8);})[_0x7d1b('0x44')](function(_0x638642){_0x3814d6(_0x638642);});}else{originate(_0x48ae9f,_0x5506e6,![])[_0x7d1b('0x3f')](function(_0x5f0713){_0x58e07e(_0x5f0713);})[_0x7d1b('0x44')](function(_0x54f719){_0x3814d6(_0x54f719);});}});};Fax[_0x7d1b('0x21')][_0x7d1b('0x6d')]=function(_0x592ed0){return!_['isNil'](_0x592ed0)&&!_[_0x7d1b('0x6e')](_0x592ed0[_0x7d1b('0x28')])&&!_['isNil'](_0x592ed0['active'])&&_0x592ed0[_0x7d1b('0x6f')]&&!_[_0x7d1b('0x6e')](this[_0x7d1b('0x10')][util['format'](_0x7d1b('0x70'),_0x592ed0['name'])])&&!_['isNil'](this['trunks'][util[_0x7d1b('0x65')](_0x7d1b('0x70'),_0x592ed0[_0x7d1b('0x28')])][_0x7d1b('0x71')])&&(this[_0x7d1b('0x10')][util[_0x7d1b('0x65')](_0x7d1b('0x70'),_0x592ed0[_0x7d1b('0x28')])][_0x7d1b('0x71')]==='reachable'||this['trunks'][util[_0x7d1b('0x65')]('SIP/%s',_0x592ed0[_0x7d1b('0x28')])][_0x7d1b('0x71')]==='unmonitored');};Fax[_0x7d1b('0x21')][_0x7d1b('0x61')]=function(_0x235b16,_0x32aa03){if(!this[_0x7d1b('0x6d')](_0x235b16)){ut['logger'](_0x7d1b('0x72'),_['isNil'](_0x235b16)?'':_0x235b16['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x7d1b('0x6e')](_0x32aa03[_0x7d1b('0x7')])){ut[_0x7d1b('0x4b')](_0x7d1b('0x73'),JSON[_0x7d1b('0x43')](_0x32aa03));return{'isValid':![],'message':_0x7d1b('0x74')};}if(_[_0x7d1b('0x6e')](_0x32aa03[_0x7d1b('0x4')])){ut[_0x7d1b('0x4b')](_0x7d1b('0x75'),JSON[_0x7d1b('0x43')](_0x32aa03));return{'isValid':![],'message':_0x7d1b('0x76')};}return{'isValid':!![],'message':_0x7d1b('0x77')};};module[_0x7d1b('0x78')]=Fax; \ No newline at end of file +var _0x6a13=['parse','.pdf','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','update','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','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','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','bind','varset','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','name','info','\x20syncNewchannel\x20','channel','prototype','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','create'];(function(_0x2d694e,_0x3c6146){var _0x498118=function(_0x203422){while(--_0x203422){_0x2d694e['push'](_0x2d694e['shift']());}};_0x498118(++_0x3c6146);}(_0x6a13,0xb6));var _0x36a1=function(_0x36eb40,_0x497c09){_0x36eb40=_0x36eb40-0x0;var _0x29fb99=_0x6a13[_0x36eb40];return _0x29fb99;};'use strict';var util=require(_0x36a1('0x0'));var _=require(_0x36a1('0x1'));var BPromise=require(_0x36a1('0x2'));var uuid=require(_0x36a1('0x3'));var moment=require(_0x36a1('0x4'));var path=require(_0x36a1('0x5'));var tiff2pdf=require(_0x36a1('0x6'));var gs=require(_0x36a1('0x7'));var logger=require('../../../config/logger')(_0x36a1('0x8'));var ami=require(_0x36a1('0x9'));var rpcDb=require(_0x36a1('0xa'));var Channel=require(_0x36a1('0xb'));var ut=require(_0x36a1('0xc'));var Action=require(_0x36a1('0xd'));var faxAccount=require(_0x36a1('0xe'));var attachment=require(_0x36a1('0xf'));var faxMessage=require(_0x36a1('0x10'));function Fax(_0x2d85d9){this['channels']={};this[_0x36a1('0x11')]=_0x2d85d9[_0x36a1('0x11')];this[_0x36a1('0x12')]=_0x2d85d9[_0x36a1('0x12')];this[_0x36a1('0x13')]={};ami['on']('newchannel',this['syncNewchannel'][_0x36a1('0x14')](this));ami['on'](_0x36a1('0x15'),this['syncVarSet'][_0x36a1('0x14')](this));ami['on'](_0x36a1('0x16'),this['syncNewState'][_0x36a1('0x14')](this));ami['on']('newexten',this[_0x36a1('0x17')]['bind'](this));ami['on'](_0x36a1('0x18'),this[_0x36a1('0x19')]['bind'](this));ami['on'](_0x36a1('0x1a'),this['syncReceiveFax'][_0x36a1('0x14')](this));ami['on'](_0x36a1('0x1b'),this[_0x36a1('0x1c')][_0x36a1('0x14')](this));ami['on'](_0x36a1('0x1d'),this[_0x36a1('0x1e')]['bind'](this));}Fax['prototype'][_0x36a1('0x1f')]=function(_0x44b181){if(_0x44b181[_0x36a1('0x20')]===_0x36a1('0x21')){for(var _0x2ba764 in this['faxAccounts']){if(this[_0x36a1('0x11')][_0x36a1('0x22')](_0x2ba764)){if(_0x44b181[_0x36a1('0x23')]===this['faxAccounts'][_0x2ba764][_0x36a1('0x24')]){this[_0x36a1('0x25')][_0x44b181['uniqueid']]={};this[_0x36a1('0x25')][_0x44b181['uniqueid']]['channel']=_0x44b181['channel'];this['channels'][_0x44b181[_0x36a1('0x26')]]['id']=this[_0x36a1('0x11')][_0x2ba764]['id'];this[_0x36a1('0x25')][_0x44b181[_0x36a1('0x26')]][_0x36a1('0x27')]=this['faxAccounts'][_0x2ba764][_0x36a1('0x27')];logger[_0x36a1('0x28')](_0x44b181['uniqueid'],_0x36a1('0x29'));}}}}if(this['actions'][_0x44b181[_0x36a1('0x26')]]){this['channels'][_0x44b181['uniqueid']]={};this[_0x36a1('0x25')][_0x44b181['uniqueid']][_0x36a1('0x2a')]=_0x44b181['channel'];logger[_0x36a1('0x28')](_0x44b181[_0x36a1('0x26')],_0x36a1('0x29'));}};Fax[_0x36a1('0x2b')]['syncVarSet']=function(_0x3f01b2){if(this[_0x36a1('0x25')][_0x3f01b2[_0x36a1('0x26')]]){for(var _0x4988e4 in _0x3f01b2[_0x36a1('0x2c')]){if(_0x3f01b2[_0x36a1('0x2c')][_0x36a1('0x22')](_0x4988e4)){this[_0x36a1('0x25')][_0x3f01b2[_0x36a1('0x26')]][_0x4988e4]=_0x3f01b2[_0x36a1('0x2d')];}}}};Fax[_0x36a1('0x2b')][_0x36a1('0x2e')]=function(_0x237a82){if(this[_0x36a1('0x25')][_0x237a82['uniqueid']]){this['channels'][_0x237a82[_0x36a1('0x26')]][_0x36a1('0x2f')]=_0x237a82['channelstate'];this[_0x36a1('0x25')][_0x237a82[_0x36a1('0x26')]][_0x36a1('0x30')]=_0x237a82[_0x36a1('0x30')];}};Fax[_0x36a1('0x2b')][_0x36a1('0x17')]=function(_0xfb89be){if(this[_0x36a1('0x25')][_0xfb89be[_0x36a1('0x26')]]){for(var _0x508610 in _0xfb89be[_0x36a1('0x2c')]){if(_0xfb89be[_0x36a1('0x2c')][_0x36a1('0x22')](_0x508610)){this['channels'][_0xfb89be[_0x36a1('0x26')]][_0x508610]=_0xfb89be[_0x36a1('0x2d')];}}}};Fax[_0x36a1('0x2b')][_0x36a1('0x19')]=function(_0x250ba3){if(this[_0x36a1('0x25')][_0x250ba3[_0x36a1('0x26')]]){this[_0x36a1('0x25')][_0x250ba3[_0x36a1('0x26')]][_0x36a1('0x31')]=_0x250ba3['operation'];this[_0x36a1('0x25')][_0x250ba3[_0x36a1('0x26')]]['status']=_0x250ba3[_0x36a1('0x32')];this[_0x36a1('0x25')][_0x250ba3[_0x36a1('0x26')]][_0x36a1('0x24')]=_0x250ba3[_0x36a1('0x24')];this[_0x36a1('0x25')][_0x250ba3['uniqueid']][_0x36a1('0x33')]=_0x250ba3['filename'];logger['info'](_0x250ba3[_0x36a1('0x26')],_0x36a1('0x34'));}};Fax[_0x36a1('0x2b')]['syncReceiveFax']=function(_0xd2333){var _0x10ffe6=this;if(this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]]){var _0x817028=this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]]['id'];this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]][_0x36a1('0x35')]=_0xd2333[_0x36a1('0x35')];this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]][_0x36a1('0x36')]=_0xd2333['pagestransferred'];this['channels'][_0xd2333[_0x36a1('0x26')]][_0x36a1('0x24')]=_0xd2333[_0x36a1('0x24')];this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]]['resolution']=_0xd2333[_0x36a1('0x37')];this['channels'][_0xd2333[_0x36a1('0x26')]][_0x36a1('0x38')]=_0xd2333[_0x36a1('0x38')];this['channels'][_0xd2333['uniqueid']][_0x36a1('0x33')]=_0xd2333[_0x36a1('0x33')];this[_0x36a1('0x25')][_0xd2333[_0x36a1('0x26')]]['calleridnum']=_0xd2333[_0x36a1('0x39')];if(this['channels'][_0xd2333[_0x36a1('0x26')]][_0x36a1('0x36')]>0x0){tiff2pdf(_0xd2333[_0x36a1('0x33')],'/var/opt/motion2/server/files/attachments/',function(_0x48bc82){logger[_0x36a1('0x28')](_0xd2333[_0x36a1('0x26')],_0x36a1('0x3a'),_0x48bc82['message']);attachment[_0x36a1('0x3b')]({'name':path[_0x36a1('0x3c')](_0xd2333[_0x36a1('0x33')])['name'],'basename':path[_0x36a1('0x3c')](_0xd2333[_0x36a1('0x33')])[_0x36a1('0x27')]+_0x36a1('0x3d'),'type':_0x36a1('0x3e')})[_0x36a1('0x3f')](function(_0x2cf361){faxAccount['notify'](_0x817028,{'from':_0xd2333[_0x36a1('0x39')],'mapKey':_0x36a1('0x8'),'body':path[_0x36a1('0x3c')](_0xd2333[_0x36a1('0x33')])[_0x36a1('0x27')]+_0x36a1('0x3d'),'AttachmentId':_0x2cf361['id']})[_0x36a1('0x40')](function(_0x21ffae){logger[_0x36a1('0x41')](_0xd2333[_0x36a1('0x26')],_0x36a1('0x42'),JSON[_0x36a1('0x43')](_0x21ffae));});})[_0x36a1('0x40')](function(_0x4d8829){logger[_0x36a1('0x41')](_0xd2333[_0x36a1('0x26')],_0x36a1('0x44'),JSON[_0x36a1('0x43')](_0x4d8829));});});}logger[_0x36a1('0x28')](_0xd2333['uniqueid'],_0x36a1('0x44'));}};Fax['prototype']['syncOriginateResponse']=function(_0x3e4d1c){if(this[_0x36a1('0x13')][_0x3e4d1c['uniqueid']]){_['merge'](this[_0x36a1('0x25')][_0x3e4d1c[_0x36a1('0x26')]],_[_0x36a1('0x45')](_0x3e4d1c,[_0x36a1('0x46'),'reason']));}};function updateStatus(_0x56b2fa){if(_0x56b2fa['AttachmentId']){faxMessage[_0x36a1('0x47')](_0x56b2fa[_0x36a1('0x48')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x36a1('0x3f')](function(_0x2a8bca){ut[_0x36a1('0x49')]('[Fax][Message][Error][Updated]',_0x2a8bca);})[_0x36a1('0x40')](function(_0x433a1f){ut[_0x36a1('0x49')](_0x36a1('0x4a'),_0x433a1f);});}else{ut[_0x36a1('0x49')](_0x36a1('0x4b'));}}Fax['prototype'][_0x36a1('0x4c')]=function(_0x5827f9,_0x78cbda,_0xeec51){var _0x481918=this;var _0x4b0bd7={};if(_0x78cbda){_0x4b0bd7={'read':_0x78cbda};}else{_0x4b0bd7={'failMessage':_0xeec51};}if(this['actions'][_0x5827f9][_0x36a1('0x48')]){faxMessage[_0x36a1('0x47')](this[_0x36a1('0x13')][_0x5827f9][_0x36a1('0x48')],_0x4b0bd7)[_0x36a1('0x3f')](function(_0x1dc4d8){ut[_0x36a1('0x49')](_0x36a1('0x4d'),_0x1dc4d8);})[_0x36a1('0x40')](function(_0xed440a){ut[_0x36a1('0x49')](_0x36a1('0x4e'),_0xed440a);})[_0x36a1('0x4f')](function(){delete _0x481918[_0x36a1('0x25')][_0x5827f9];delete _0x481918['actions'][_0x5827f9];});}else{ut[_0x36a1('0x49')](_0x36a1('0x50'));delete this[_0x36a1('0x25')][_0x5827f9];delete this['actions'][_0x5827f9];}};Fax['prototype']['syncHangup']=function(_0x217215){var _0x44ffd5=this;if(this['channels'][_0x217215[_0x36a1('0x26')]]){if(this[_0x36a1('0x13')][_0x217215['uniqueid']]){this[_0x36a1('0x25')][_0x217215[_0x36a1('0x26')]]['id']=this[_0x36a1('0x13')][_0x217215[_0x36a1('0x26')]]['id'];this['channels'][_0x217215['uniqueid']][_0x36a1('0x27')]=this[_0x36a1('0x13')][_0x217215[_0x36a1('0x26')]][_0x36a1('0x27')];}logger[_0x36a1('0x28')](_0x217215[_0x36a1('0x26')],this[_0x36a1('0x13')][_0x217215[_0x36a1('0x26')]]?_0x36a1('0x51'):_0x36a1('0x52'),JSON[_0x36a1('0x43')](this[_0x36a1('0x25')][_0x217215[_0x36a1('0x26')]]));if(this[_0x36a1('0x13')][_0x217215[_0x36a1('0x26')]]){if(this[_0x36a1('0x25')][_0x217215[_0x36a1('0x26')]]['faxpages']>0x0&&this[_0x36a1('0x25')][_0x217215[_0x36a1('0x26')]]['faxstatus']===_0x36a1('0x53')){this[_0x36a1('0x4c')](_0x217215[_0x36a1('0x26')],!![]);}else{this['updateStatus'](_0x217215[_0x36a1('0x26')],![],this['channels'][_0x217215[_0x36a1('0x26')]][_0x36a1('0x54')]?_0x36a1('0x55')+this[_0x36a1('0x25')][_0x217215['uniqueid']][_0x36a1('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0x36a1('0x2b')]['send']=function(_0x387a5e){var _0x576079=this;return new BPromise(function(_0x2d062b,_0x4a99d3){_0x576079[_0x36a1('0x56')](_0x387a5e,_0x576079['faxAccounts'][_0x387a5e[_0x36a1('0x57')]])[_0x36a1('0x3f')](function(_0x1fb6dc){ut[_0x36a1('0x49')](_0x36a1('0x58'),_0x1fb6dc);_0x2d062b(ut[_0x36a1('0x59')](_0x36a1('0x5a')));})[_0x36a1('0x40')](function(_0x2f2829){ut['logger'](_0x36a1('0x5b'),_0x2f2829);updateStatus(_0x387a5e);_0x4a99d3(ut[_0x36a1('0x59')](_0x36a1('0x5c')));});});};Fax[_0x36a1('0x2b')]['checkAfterSend']=function(_0x158e54){var _0x24abbf=this;return new BPromise(function(_0x1a94a7,_0xcdb033){var _0x1d81bd=_0x24abbf[_0x36a1('0x5d')](_0x24abbf['faxAccounts'][_0x158e54['FaxAccountId']][_0x36a1('0x5e')],_0x158e54);if(_0x1d81bd[_0x36a1('0x5f')]){_0x1a94a7(ut['message'](_0x36a1('0x60')));}else{_0xcdb033(ut[_0x36a1('0x59')](_0x1d81bd['message']));}});};function originate(_0x3e10c3,_0x4739b4,_0x407dc5){return new BPromise(function(_0x495e1b,_0x1844a5){if(_0x407dc5){var _0x2bde9e=util[_0x36a1('0x61')](_0x36a1('0x62'),path[_0x36a1('0x3c')](_0x3e10c3[_0x36a1('0x5')])['name'],_0x3e10c3[_0x36a1('0x5')]);gs['execute'](_0x2bde9e)[_0x36a1('0x3f')](function(){_0x3e10c3[_0x36a1('0x5')]=util['format'](_0x36a1('0x63'),path[_0x36a1('0x3c')](_0x3e10c3[_0x36a1('0x5')])[_0x36a1('0x64')],path[_0x36a1('0x3c')](_0x3e10c3[_0x36a1('0x5')])[_0x36a1('0x27')]);_0x4739b4[_0x36a1('0x65')]=_0x3e10c3['path'];ut[_0x36a1('0x49')](_0x36a1('0x66'),'');ami[_0x36a1('0x67')](ut[_0x36a1('0x68')](_0x3e10c3,_0x4739b4))[_0x36a1('0x3f')](function(_0x18698b){_0x495e1b(_0x18698b);})[_0x36a1('0x40')](function(_0x584dd5){_0x1844a5(_0x584dd5);});})[_0x36a1('0x40')](function(_0x27ea35){_0x1844a5(_0x27ea35);});}else{ami[_0x36a1('0x67')](ut[_0x36a1('0x68')](_0x3e10c3,_0x4739b4))[_0x36a1('0x3f')](function(_0x3ea8dd){_0x495e1b(_0x3ea8dd);})[_0x36a1('0x40')](function(_0x1b1bf0){_0x1844a5(_0x1b1bf0);});}});}Fax[_0x36a1('0x2b')][_0x36a1('0x56')]=function(_0x251bcc,_0x41baf9){var _0x1d62c1=this;return new BPromise(function(_0x110c6f,_0x479be6){var _0xd0cf94=uuid['v4']();var _0x13a23d=ut[_0x36a1('0x69')](_0x251bcc,_0x41baf9);_0x1d62c1[_0x36a1('0x13')][_0xd0cf94]=new Action(_0xd0cf94,_0x41baf9,_0x251bcc);var _0x42db7e=_0x1d62c1[_0x36a1('0x13')][_0xd0cf94];if(path[_0x36a1('0x3c')](_0x251bcc[_0x36a1('0x5')])['ext']===_0x36a1('0x3d')){originate(_0x42db7e,_0x13a23d,!![])[_0x36a1('0x3f')](function(_0x17f214){_0x110c6f(_0x17f214);})['catch'](function(_0x42777e){_0x479be6(_0x42777e);});}else{originate(_0x42db7e,_0x13a23d,![])['then'](function(_0x1926b1){_0x110c6f(_0x1926b1);})[_0x36a1('0x40')](function(_0x3c2c7c){_0x479be6(_0x3c2c7c);});}});};Fax[_0x36a1('0x2b')]['isTrunkReachable']=function(_0x3bc47e){return!_['isNil'](_0x3bc47e)&&!_[_0x36a1('0x6a')](_0x3bc47e[_0x36a1('0x27')])&&!_[_0x36a1('0x6a')](_0x3bc47e[_0x36a1('0x6b')])&&_0x3bc47e[_0x36a1('0x6b')]&&!_[_0x36a1('0x6a')](this[_0x36a1('0x12')][util[_0x36a1('0x61')](_0x36a1('0x6c'),_0x3bc47e[_0x36a1('0x27')])])&&!_[_0x36a1('0x6a')](this[_0x36a1('0x12')][util['format'](_0x36a1('0x6c'),_0x3bc47e[_0x36a1('0x27')])][_0x36a1('0x32')])&&(this['trunks'][util[_0x36a1('0x61')]('SIP/%s',_0x3bc47e[_0x36a1('0x27')])]['status']===_0x36a1('0x6d')||this[_0x36a1('0x12')][util['format'](_0x36a1('0x6c'),_0x3bc47e[_0x36a1('0x27')])][_0x36a1('0x32')]===_0x36a1('0x6e'));};Fax[_0x36a1('0x2b')][_0x36a1('0x5d')]=function(_0x1030c8,_0x5d42ce){if(!this[_0x36a1('0x6f')](_0x1030c8)){ut[_0x36a1('0x49')](_0x36a1('0x70'),_[_0x36a1('0x6a')](_0x1030c8)?'':_0x1030c8[_0x36a1('0x27')]+_0x36a1('0x71'));return{'isValid':![],'message':_0x36a1('0x72')};}if(_['isNil'](_0x5d42ce[_0x36a1('0x8')])){ut[_0x36a1('0x49')](_0x36a1('0x73'),JSON[_0x36a1('0x43')](_0x5d42ce));return{'isValid':![],'message':_0x36a1('0x74')};}if(_['isNil'](_0x5d42ce['path'])){ut['logger'](_0x36a1('0x75'),JSON[_0x36a1('0x43')](_0x5d42ce));return{'isValid':![],'message':_0x36a1('0x76')};}return{'isValid':!![],'message':_0x36a1('0x77')};};module[_0x36a1('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index bea2297..bcab75a 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 _0x6bf5=['error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','../rpc/faxAccount'];(function(_0x5b47bf,_0x2469de){var _0x11b291=function(_0x38132d){while(--_0x38132d){_0x5b47bf['push'](_0x5b47bf['shift']());}};_0x11b291(++_0x2469de);}(_0x6bf5,0x193));var _0x56bf=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x6bf5[_0x400322];return _0xfdd597;};'use strict';var util=require(_0x56bf('0x0'));var BPromise=require(_0x56bf('0x1'));var logger=require(_0x56bf('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0x56bf('0x3'));function loggerCatch(_0x25a3dd){return function(_0x398b94){logger[_0x56bf('0x4')](_0x25a3dd,util[_0x56bf('0x5')](_0x398b94,{'showHidden':![],'depth':null}));};}exports[_0x56bf('0x6')]=function(_0x54b5f0,_0x4a3ddb){return BPromise[_0x56bf('0x7')]()[_0x56bf('0x8')](faxAccount[_0x56bf('0x6')](_0x54b5f0,_0x4a3ddb))[_0x56bf('0x9')](loggerCatch(_0x56bf('0xa')));}; \ No newline at end of file +var _0xf958=['notify','resolve','then','[Notify]\x20','util','../../../config/logger','preview','lodash','error','inspect'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0xf958,0x7c));var _0x8f95=function(_0x16d7a6,_0x4dac64){_0x16d7a6=_0x16d7a6-0x0;var _0x397bc1=_0xf958[_0x16d7a6];return _0x397bc1;};'use strict';var util=require(_0x8f95('0x0'));var BPromise=require('bluebird');var logger=require(_0x8f95('0x1'))(_0x8f95('0x2'));var _=require(_0x8f95('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x347514){return function(_0x1e2494){logger[_0x8f95('0x4')](_0x347514,util[_0x8f95('0x5')](_0x1e2494,{'showHidden':![],'depth':null}));};}exports[_0x8f95('0x6')]=function(_0xf37597,_0x5a15f6){return BPromise[_0x8f95('0x7')]()[_0x8f95('0x8')](faxAccount[_0x8f95('0x6')](_0xf37597,_0x5a15f6))['catch'](loggerCatch(_0x8f95('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 90f5a2b..23a9b0b 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 _0xc4f2=['inspect','util','../../../../config/logger','fax','bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0xc4f2,0x119));var _0x2c4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4f2[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x2c4f('0x0'));var logger=require(_0x2c4f('0x1'))(_0x2c4f('0x2'));var BPromise=require(_0x2c4f('0x3'));var exec=require(_0x2c4f('0x4'))['exec'];exports[_0x2c4f('0x5')]=function(_0x93abe9){return new BPromise(function(_0x57c194,_0x1eaa36){exec(_0x93abe9,function(_0x2528e0,_0x5394b5,_0x76932c){logger[_0x2c4f('0x6')](_0x2c4f('0x7'),_0x5394b5);if(_0x2528e0){logger[_0x2c4f('0x6')](_0x2c4f('0x7'),_0x2c4f('0x8'),util[_0x2c4f('0x9')](_0x2528e0,{'showHidden':![],'depth':null}),_0x5394b5,_0x76932c);_0x1eaa36(_0x2528e0);}_0x57c194(_0x5394b5);});});}; \ No newline at end of file +var _0x9936=['info','Exec\x20gs','\x20Error\x20:','inspect','fax','bluebird','child_process','execute'];(function(_0x180af9,_0x165ec5){var _0x19d764=function(_0x3a1086){while(--_0x3a1086){_0x180af9['push'](_0x180af9['shift']());}};_0x19d764(++_0x165ec5);}(_0x9936,0x9c));var _0x6993=function(_0x567703,_0x4b1cfa){_0x567703=_0x567703-0x0;var _0x1cd94a=_0x9936[_0x567703];return _0x1cd94a;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x6993('0x0'));var BPromise=require(_0x6993('0x1'));var exec=require(_0x6993('0x2'))['exec'];exports[_0x6993('0x3')]=function(_0x13f446){return new BPromise(function(_0x22c822,_0x146563){exec(_0x13f446,function(_0x894b1b,_0x5728fc,_0x140ca8){logger[_0x6993('0x4')]('Exec\x20gs',_0x5728fc);if(_0x894b1b){logger[_0x6993('0x4')](_0x6993('0x5'),_0x6993('0x6'),util[_0x6993('0x7')](_0x894b1b,{'showHidden':![],'depth':null}),_0x5728fc,_0x140ca8);_0x146563(_0x894b1b);}_0x22c822(_0x5728fc);});});}; \ 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 e846ee2..dc401a5 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 _0x2dae=['\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment','../../../../config/logger','fax','message','info','inspect','ecm','headerinfo','minrate','maxrate','format'];(function(_0x808042,_0x3d2f89){var _0x17b09d=function(_0x2dd69c){while(--_0x2dd69c){_0x808042['push'](_0x808042['shift']());}};_0x17b09d(++_0x3d2f89);}(_0x2dae,0xc3));var _0xe2da=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x2dae[_0x247fa1];return _0x244f35;};'use strict';var util=require(_0xe2da('0x0'));var _=require('lodash');var moment=require(_0xe2da('0x1'));var logger=require(_0xe2da('0x2'))(_0xe2da('0x3'));exports[_0xe2da('0x4')]=function(_0x99b46f){return{'message':_0x99b46f};};exports['logger']=function(_0x25b9f2,_0x439b5d){logger[_0xe2da('0x5')](_0x25b9f2,util[_0xe2da('0x6')](_0x439b5d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3e3e25,_0x89c70b){var _0x34cc98={'XMF-ECM':_0x89c70b[_0xe2da('0x7')],'XMF-HEADERINFO':_0x89c70b[_0xe2da('0x8')],'XMF-MINRATE':_0x89c70b[_0xe2da('0x9')],'XMF-MAXRATE':_0x89c70b[_0xe2da('0xa')],'XMF-MODEM':util[_0xe2da('0xb')](_0xe2da('0xc'),_0x89c70b['modem']),'XMF-GATEWAY':_0x89c70b[_0xe2da('0xd')],'XMF-FAXDETECT':_0x89c70b[_0xe2da('0xe')],'XMF-T38TIMEOUT':_0x89c70b[_0xe2da('0xf')],'XMF-LOCALSTATIONID':_0x89c70b[_0xe2da('0x10')],'XMF-PATH':_0x3e3e25[_0xe2da('0x11')]};return _0x34cc98;};exports[_0xe2da('0x12')]=function(_0x1a29b9,_0x173244){return{'actionid':_0x1a29b9['uniqueid'],'action':_0xe2da('0x13'),'channel':_0x1a29b9['channel'],'Exten':_0xe2da('0x14'),'Context':_0xe2da('0x15'),'Priority':'1','callerid':util[_0xe2da('0xb')](_0xe2da('0x16'),_0x1a29b9[_0xe2da('0x8')]?_0x1a29b9[_0xe2da('0x8')]:'',_0x1a29b9[_0xe2da('0x10')]),'variable':_0x173244,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1a29b9['uniqueid']};}; \ No newline at end of file +var _0xedd9=['\x22%s\x22\x20<%s>','localstationid','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','modem','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip'];(function(_0x1a5016,_0x3ee8de){var _0x23b4fe=function(_0x9d89f9){while(--_0x9d89f9){_0x1a5016['push'](_0x1a5016['shift']());}};_0x23b4fe(++_0x3ee8de);}(_0xedd9,0xfc));var _0x9edd=function(_0x4f7492,_0x129dbe){_0x4f7492=_0x4f7492-0x0;var _0x2f8eff=_0xedd9[_0x4f7492];return _0x2f8eff;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var logger=require(_0x9edd('0x2'))(_0x9edd('0x3'));exports[_0x9edd('0x4')]=function(_0x127cbe){return{'message':_0x127cbe};};exports[_0x9edd('0x5')]=function(_0x36b53f,_0x5943b3){logger[_0x9edd('0x6')](_0x36b53f,util[_0x9edd('0x7')](_0x5943b3,{'showHidden':![],'depth':null}));};exports[_0x9edd('0x8')]=function(_0x34c1a7,_0x5319f7){var _0xf0b2d8={'XMF-ECM':_0x5319f7['ecm'],'XMF-HEADERINFO':_0x5319f7[_0x9edd('0x9')],'XMF-MINRATE':_0x5319f7[_0x9edd('0xa')],'XMF-MAXRATE':_0x5319f7[_0x9edd('0xb')],'XMF-MODEM':util[_0x9edd('0xc')]('\x22%s\x22',_0x5319f7[_0x9edd('0xd')]),'XMF-GATEWAY':_0x5319f7['gateway'],'XMF-FAXDETECT':_0x5319f7[_0x9edd('0xe')],'XMF-T38TIMEOUT':_0x5319f7[_0x9edd('0xf')],'XMF-LOCALSTATIONID':_0x5319f7['localstationid'],'XMF-PATH':_0x34c1a7[_0x9edd('0x10')]};return _0xf0b2d8;};exports[_0x9edd('0x11')]=function(_0x5b6c00,_0x30c0d7){return{'actionid':_0x5b6c00[_0x9edd('0x12')],'action':_0x9edd('0x13'),'channel':_0x5b6c00[_0x9edd('0x14')],'Exten':_0x9edd('0x15'),'Context':_0x9edd('0x16'),'Priority':'1','callerid':util[_0x9edd('0xc')](_0x9edd('0x17'),_0x5b6c00['headerinfo']?_0x5b6c00[_0x9edd('0x9')]:'',_0x5b6c00[_0x9edd('0x18')]),'variable':_0x30c0d7,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5b6c00[_0x9edd('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 6887c19..4fcce49 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 _0x00d9=['initVtigerAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','sync','log','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','resolve','then','getAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts'];(function(_0x591d76,_0x907e9b){var _0x549d7c=function(_0x3e841e){while(--_0x3e841e){_0x591d76['push'](_0x591d76['shift']());}};_0x549d7c(++_0x907e9b);}(_0x00d9,0x10d));var _0x900d=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x00d9[_0x513aa5];return _0x1a1a7c;};'use strict';var BPromise=require(_0x900d('0x0'));var util=require(_0x900d('0x1'));var moment=require(_0x900d('0x2'));var server=require(_0x900d('0x3'));var Realtime=require(_0x900d('0x4'));var Report=require(_0x900d('0x5'));var Acw=require(_0x900d('0x6'));var Trigger=require(_0x900d('0x7'));var Dialer=require(_0x900d('0x8'));var Preview=require(_0x900d('0x9'));var Fax=require(_0x900d('0xa'));var user=require(_0x900d('0xb'));var voiceQueue=require(_0x900d('0xc'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x900d('0xd'));var trunk=require(_0x900d('0xe'));var trigger=require(_0x900d('0xf'));var template=require(_0x900d('0x10'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x900d('0x11'));var voiceExtension=require(_0x900d('0x12'));var faxAccount=require(_0x900d('0x13'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x900d('0x14'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x900d('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x900d('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x900d('0x17'));var dynamics365=require(_0x900d('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x900d('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x900d('0x1a')]()[_0x900d('0x1b')](user[_0x900d('0x1c')]())[_0x900d('0x1b')](realtime['initAgents']())['then'](user[_0x900d('0x1d')]())['then'](realtime['initTelephones']())['then'](trunk[_0x900d('0x1e')]())[_0x900d('0x1b')](realtime[_0x900d('0x1f')]())[_0x900d('0x1b')](voiceQueue[_0x900d('0x20')]())[_0x900d('0x1b')](realtime['initVoiceQueues']())[_0x900d('0x1b')](trigger[_0x900d('0x21')]())[_0x900d('0x1b')](realtime[_0x900d('0x22')]())[_0x900d('0x1b')](template[_0x900d('0x23')]())[_0x900d('0x1b')](realtime[_0x900d('0x24')]())[_0x900d('0x1b')](zendesk['getZendeskAccounts']())['then'](realtime[_0x900d('0x25')]())[_0x900d('0x1b')](salesforce[_0x900d('0x26')]())[_0x900d('0x1b')](realtime[_0x900d('0x27')]())['then'](sugarcrm[_0x900d('0x28')]())['then'](realtime[_0x900d('0x29')]())['then'](freshdesk[_0x900d('0x2a')]())[_0x900d('0x1b')](realtime['initFreshdeskAccounts']())[_0x900d('0x1b')](desk['getDeskAccounts']())[_0x900d('0x1b')](realtime[_0x900d('0x2b')]())[_0x900d('0x1b')](zoho['getZohoAccounts']())[_0x900d('0x1b')](realtime[_0x900d('0x2c')]())[_0x900d('0x1b')](vtiger[_0x900d('0x2d')]())[_0x900d('0x1b')](realtime[_0x900d('0x2e')]())[_0x900d('0x1b')](freshsales['getFreshsalesAccounts']())[_0x900d('0x1b')](realtime['initFreshsalesAccounts']())[_0x900d('0x1b')](servicenow[_0x900d('0x2f')]())[_0x900d('0x1b')](realtime['initServicenowAccounts']())[_0x900d('0x1b')](dynamics365[_0x900d('0x30')]())[_0x900d('0x1b')](realtime[_0x900d('0x31')]())['then'](campaign[_0x900d('0x32')]())[_0x900d('0x1b')](realtime[_0x900d('0x33')]())[_0x900d('0x1b')](voiceExtension[_0x900d('0x34')]())[_0x900d('0x1b')](realtime[_0x900d('0x35')]())['then'](faxAccount[_0x900d('0x36')]())[_0x900d('0x1b')](realtime[_0x900d('0x37')]())[_0x900d('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0x900d('0x1a')]()['then'](voiceQueueReport[_0x900d('0x38')]())[_0x900d('0x1b')](realtime['initVoiceQueueReports']())[_0x900d('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x900d('0x1b')](realtime[_0x900d('0x39')]())[_0x900d('0x1b')](cmHopperHistory[_0x900d('0x3a')]())['then'](realtime['initCampaignHopperHistory']())[_0x900d('0x1b')](voiceCallReport[_0x900d('0x3b')]())[_0x900d('0x1b')](realtime[_0x900d('0x3c')]())[_0x900d('0x1b')](function(_0x15e5e5){})['catch'](function(_0x20b7e3){console['log'](_0x20b7e3);});}function main(){return server['listen'](realtime,preview,fax)[_0x900d('0x1b')](function(_0x2e46c0){return initRealtime();})[_0x900d('0x1b')](function(){return initParams();})[_0x900d('0x1b')](function(){report[_0x900d('0x3d')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x2a5d62){console[_0x900d('0x3e')](_0x2a5d62);});}main(); \ No newline at end of file +var _0xe7f2=['getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','moment','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0xe7f2,0x175));var _0x2e7f=function(_0x5e513a,_0xa81de6){_0x5e513a=_0x5e513a-0x0;var _0x1025cd=_0xe7f2[_0x5e513a];return _0x1025cd;};'use strict';var BPromise=require(_0x2e7f('0x0'));var util=require('util');var moment=require(_0x2e7f('0x1'));var server=require('./server');var Realtime=require(_0x2e7f('0x2'));var Report=require(_0x2e7f('0x3'));var Acw=require(_0x2e7f('0x4'));var Trigger=require(_0x2e7f('0x5'));var Dialer=require(_0x2e7f('0x6'));var Preview=require('./preview');var Fax=require(_0x2e7f('0x7'));var user=require(_0x2e7f('0x8'));var voiceQueue=require(_0x2e7f('0x9'));var voiceQueueReport=require(_0x2e7f('0xa'));var voiceCallReport=require(_0x2e7f('0xb'));var trunk=require(_0x2e7f('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x2e7f('0xd'));var cmHopperHistory=require(_0x2e7f('0xe'));var campaign=require(_0x2e7f('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x2e7f('0x10'));var zendesk=require(_0x2e7f('0x11'));var salesforce=require(_0x2e7f('0x12'));var sugarcrm=require(_0x2e7f('0x13'));var freshdesk=require(_0x2e7f('0x14'));var desk=require(_0x2e7f('0x15'));var zoho=require(_0x2e7f('0x16'));var vtiger=require(_0x2e7f('0x17'));var freshsales=require(_0x2e7f('0x18'));var servicenow=require(_0x2e7f('0x19'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2e7f('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2e7f('0x1a')](_0x2e7f('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x2e7f('0x1c')](user[_0x2e7f('0x1d')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x1e')]())[_0x2e7f('0x1c')](user[_0x2e7f('0x1f')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x20')]())[_0x2e7f('0x1c')](trunk[_0x2e7f('0x21')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x22')]())['then'](voiceQueue[_0x2e7f('0x23')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x24')]())['then'](trigger[_0x2e7f('0x25')]())[_0x2e7f('0x1c')](realtime['initTriggers']())[_0x2e7f('0x1c')](template[_0x2e7f('0x26')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x27')]())[_0x2e7f('0x1c')](zendesk[_0x2e7f('0x28')]())['then'](realtime['initZendeskAccounts']())['then'](salesforce[_0x2e7f('0x29')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x2a')]())[_0x2e7f('0x1c')](sugarcrm[_0x2e7f('0x2b')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x2c')]())[_0x2e7f('0x1c')](freshdesk[_0x2e7f('0x2d')]())[_0x2e7f('0x1c')](realtime['initFreshdeskAccounts']())[_0x2e7f('0x1c')](desk['getDeskAccounts']())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x2e')]())[_0x2e7f('0x1c')](zoho[_0x2e7f('0x2f')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x30')]())[_0x2e7f('0x1c')](vtiger[_0x2e7f('0x31')]())[_0x2e7f('0x1c')](realtime['initVtigerAccounts']())[_0x2e7f('0x1c')](freshsales[_0x2e7f('0x32')]())[_0x2e7f('0x1c')](realtime['initFreshsalesAccounts']())[_0x2e7f('0x1c')](servicenow[_0x2e7f('0x33')]())['then'](realtime[_0x2e7f('0x34')]())[_0x2e7f('0x1c')](dynamics365[_0x2e7f('0x35')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x36')]())['then'](campaign[_0x2e7f('0x37')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x38')]())[_0x2e7f('0x1c')](voiceExtension['getVoiceExtensions']())[_0x2e7f('0x1c')](realtime['initVoiceExtensions']())[_0x2e7f('0x1c')](faxAccount[_0x2e7f('0x39')]())['then'](realtime[_0x2e7f('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x2e7f('0x3b')]()[_0x2e7f('0x1c')](voiceQueueReport[_0x2e7f('0x3c')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x3d')]())[_0x2e7f('0x1c')](cmHopperHistory[_0x2e7f('0x3e')]())[_0x2e7f('0x1c')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x2e7f('0x3f')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x40')]())[_0x2e7f('0x1c')](voiceCallReport[_0x2e7f('0x41')]())[_0x2e7f('0x1c')](realtime[_0x2e7f('0x42')]())[_0x2e7f('0x1c')](function(_0x2c709f){})[_0x2e7f('0x43')](function(_0x15b7d7){console[_0x2e7f('0x44')](_0x15b7d7);});}function main(){return server[_0x2e7f('0x45')](realtime,preview,fax)['then'](function(_0x1290d){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x2e7f('0x46')]();setInterval(initRealtime,0x1388);})[_0x2e7f('0x43')](function(_0x152fa3){console[_0x2e7f('0x44')](_0x152fa3);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 21ae4b6..ade13ea 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 _0x733d=['lodash','util','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','accountcode','fullname','state','unknown','stateTime','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','toLowerCase','idle','inuse','talking','voiceStatus','statePause','toNumber','email','status','stringify','format','user:%s','emit'];(function(_0x43316e,_0x318677){var _0x5b2881=function(_0x2612bb){while(--_0x2612bb){_0x43316e['push'](_0x43316e['shift']());}};_0x5b2881(++_0x318677);}(_0x733d,0x1a2));var _0xd733=function(_0x5b00cc,_0x1831e5){_0x5b00cc=_0x5b00cc-0x0;var _0x889dc9=_0x733d[_0x5b00cc];return _0x889dc9;};'use strict';var _=require(_0xd733('0x0'));var util=require(_0xd733('0x1'));var moment=require(_0xd733('0x2'));var md5=require('md5');var Redis=require(_0xd733('0x3'));var config=require('../../../config/environment');config[_0xd733('0x4')]=_[_0xd733('0x5')](config['redis'],{'host':_0xd733('0x6'),'port':0x18eb});var io=require(_0xd733('0x7'))(new Redis(config[_0xd733('0x4')]));function Agent(_0x2876bf){this['id']=_0x2876bf['id']||0x0;this[_0xd733('0x8')]=_0x2876bf['name']||'';this['email']=_0x2876bf['email']||'';this[_0xd733('0x9')]=_0x2876bf[_0xd733('0x9')]||'';this[_0xd733('0xa')]=_0x2876bf[_0xd733('0xa')]||'';this[_0xd733('0xb')]=_0xd733('0xc');this[_0xd733('0xd')]=0x0;this['status']=_0xd733('0xc');this[_0xd733('0xe')]='';this[_0xd733('0xf')]='';this[_0xd733('0x10')]='';this[_0xd733('0x11')]='';this['online']=_0x2876bf[_0xd733('0x12')]||![];this['voiceStatus']=_0xd733('0xc');this[_0xd733('0x13')]=0x0;this[_0xd733('0x14')]='';this[_0xd733('0x15')]='';this[_0xd733('0x16')]=![];this['local']=![];this[_0xd733('0x17')]='';}Agent[_0xd733('0x18')]['updateStatusRealtime']=function(_0x28d74b){var _0x79a4e;if(_0x28d74b&&_0x28d74b[_0xd733('0xb')]){_0x79a4e=_0x28d74b[_0xd733('0xb')][_0xd733('0x19')]();switch(_0x79a4e){case'not_inuse':_0x79a4e=_0xd733('0x1a');break;case _0xd733('0x1b'):_0x79a4e=_0xd733('0x1c');break;}}if(_0x79a4e&&this[_0xd733('0x1d')]!==_0x79a4e||_0x28d74b[_0xd733('0x1e')]){this[_0xd733('0x13')]=_[_0xd733('0x1f')](moment()['format']('x'));}if(_0x79a4e){this[_0xd733('0x1d')]=_0x79a4e;}var _0x5942f={'id':this['id'],'name':this[_0xd733('0x8')],'email':this[_0xd733('0x20')],'accountcode':this[_0xd733('0x9')],'fullname':this[_0xd733('0xa')],'state':this[_0xd733('0xb')],'stateTime':this['stateTime'],'status':this[_0xd733('0x21')],'address':this[_0xd733('0xe')],'online':this['online'],'voiceStatus':this[_0xd733('0x1d')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xd733('0x14')],'voiceStatusQueue':this[_0xd733('0x15')],'interface':this[_0xd733('0x11')],'onhold':this['onhold']};var _0x327939=md5(JSON[_0xd733('0x22')](_0x5942f));if(this[_0xd733('0x17')]!==_0x327939){this['md5']=_0x327939;io['to'](util[_0xd733('0x23')](_0xd733('0x24'),_0x5942f[_0xd733('0x8')]))[_0xd733('0x25')]('user:save',_0x5942f);}};module['exports']=Agent; \ No newline at end of file +var _0x8be7=['statePause','voiceStatusTime','toNumber','format','address','user:%s','emit','exports','util','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','phone','mobile','interface','online','voiceStatus','unknown','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','inuse'];(function(_0x5bff0,_0x20716d){var _0x3ead2e=function(_0x14f592){while(--_0x14f592){_0x5bff0['push'](_0x5bff0['shift']());}};_0x3ead2e(++_0x20716d);}(_0x8be7,0x98));var _0x78be=function(_0x2947d1,_0x5e70b0){_0x2947d1=_0x2947d1-0x0;var _0x2b36a5=_0x8be7[_0x2947d1];return _0x2b36a5;};'use strict';var _=require('lodash');var util=require(_0x78be('0x0'));var moment=require('moment');var md5=require(_0x78be('0x1'));var Redis=require(_0x78be('0x2'));var config=require(_0x78be('0x3'));config[_0x78be('0x4')]=_[_0x78be('0x5')](config[_0x78be('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x78be('0x6'))(new Redis(config[_0x78be('0x4')]));function Agent(_0x2f67e8){this['id']=_0x2f67e8['id']||0x0;this[_0x78be('0x7')]=_0x2f67e8['name']||'';this[_0x78be('0x8')]=_0x2f67e8['email']||'';this['accountcode']=_0x2f67e8[_0x78be('0x9')]||'';this[_0x78be('0xa')]=_0x2f67e8['fullname']||'';this[_0x78be('0xb')]='unknown';this[_0x78be('0xc')]=0x0;this[_0x78be('0xd')]='unknown';this['address']='';this[_0x78be('0xe')]='';this[_0x78be('0xf')]='';this[_0x78be('0x10')]='';this[_0x78be('0x11')]=_0x2f67e8[_0x78be('0x11')]||![];this[_0x78be('0x12')]=_0x78be('0x13');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x78be('0x14')]='';this[_0x78be('0x15')]=![];this[_0x78be('0x16')]=![];this[_0x78be('0x1')]='';}Agent[_0x78be('0x17')][_0x78be('0x18')]=function(_0x3484f0){var _0x4204d9;if(_0x3484f0&&_0x3484f0[_0x78be('0xb')]){_0x4204d9=_0x3484f0[_0x78be('0xb')][_0x78be('0x19')]();switch(_0x4204d9){case'not_inuse':_0x4204d9=_0x78be('0x1a');break;case _0x78be('0x1b'):_0x4204d9='talking';break;}}if(_0x4204d9&&this[_0x78be('0x12')]!==_0x4204d9||_0x3484f0[_0x78be('0x1c')]){this[_0x78be('0x1d')]=_[_0x78be('0x1e')](moment()[_0x78be('0x1f')]('x'));}if(_0x4204d9){this[_0x78be('0x12')]=_0x4204d9;}var _0x53f12c={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x78be('0x9')],'fullname':this['fullname'],'state':this[_0x78be('0xb')],'stateTime':this[_0x78be('0xc')],'status':this[_0x78be('0xd')],'address':this[_0x78be('0x20')],'online':this[_0x78be('0x11')],'voiceStatus':this[_0x78be('0x12')],'voiceStatusTime':this[_0x78be('0x1d')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x78be('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x4c90ff=md5(JSON['stringify'](_0x53f12c));if(this[_0x78be('0x1')]!==_0x4c90ff){this[_0x78be('0x1')]=_0x4c90ff;io['to'](util[_0x78be('0x1f')](_0x78be('0x21'),_0x53f12c[_0x78be('0x7')]))[_0x78be('0x22')]('user:save',_0x53f12c);}};module[_0x78be('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6567123..b096636 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 _0xde29=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','campaign','originated','temp','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xde29,0xe9));var _0x9de2=function(_0x46b413,_0x5ec5aa){_0x46b413=_0x46b413-0x0;var _0x4eed19=_0xde29[_0x46b413];return _0x4eed19;};'use strict';function Campaign(_0x20c7e8){this['id']=_0x20c7e8['id']||0x0;this['name']=_0x20c7e8['name']||'';this['type']=_0x20c7e8['type']||_0x9de2('0x0');this[_0x9de2('0x1')]=0x0;this[_0x9de2('0x2')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x9de2('0x3')]='';this[_0x9de2('0x4')]=!![];this[_0x9de2('0x5')]=_0x20c7e8[_0x9de2('0x5')];this[_0x9de2('0x6')]=_0x20c7e8[_0x9de2('0x6')];this[_0x9de2('0x7')]=_0x20c7e8[_0x9de2('0x7')]||null;this[_0x9de2('0x8')]=_0x20c7e8['dialGlobalInterval']?_0x20c7e8['dialGlobalInterval']:null;this[_0x9de2('0x9')]=_0x20c7e8[_0x9de2('0x9')];this[_0x9de2('0xa')]=_0x20c7e8[_0x9de2('0xa')];this[_0x9de2('0xb')]=_0x20c7e8['dialOriginateTimeout']||0x1e;this[_0x9de2('0xc')]=_0x20c7e8[_0x9de2('0xc')];this['dialCongestionRetryFrequency']=_0x20c7e8[_0x9de2('0xd')];this[_0x9de2('0xe')]=_0x20c7e8['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x20c7e8[_0x9de2('0xf')];this[_0x9de2('0x10')]=_0x20c7e8[_0x9de2('0x10')];this[_0x9de2('0x11')]=_0x20c7e8[_0x9de2('0x11')];this[_0x9de2('0x12')]=_0x20c7e8[_0x9de2('0x12')];this[_0x9de2('0x13')]=_0x20c7e8[_0x9de2('0x13')]||0x3;this[_0x9de2('0x14')]=_0x20c7e8[_0x9de2('0x14')]||0x96;this[_0x9de2('0x15')]=_0x20c7e8[_0x9de2('0x15')]||0x3;this[_0x9de2('0x16')]=_0x20c7e8[_0x9de2('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x20c7e8[_0x9de2('0x17')]||0x3;this[_0x9de2('0x18')]=_0x20c7e8[_0x9de2('0x18')]||0x96;this[_0x9de2('0x19')]=_0x20c7e8[_0x9de2('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x20c7e8[_0x9de2('0x1a')]||0x96;this[_0x9de2('0x1b')]=_0x20c7e8[_0x9de2('0x1b')]||0x3;this[_0x9de2('0x1c')]=_0x20c7e8[_0x9de2('0x1c')]||0x96;this[_0x9de2('0x1d')]=_0x20c7e8['dialOrderByScheduledAt']||_0x9de2('0x1e');this['dialPrefix']=_0x20c7e8['dialPrefix']||undefined;this[_0x9de2('0x1f')]=_0x20c7e8[_0x9de2('0x1f')]||undefined;this[_0x9de2('0x20')]=_0x20c7e8[_0x9de2('0x20')]||undefined;this[_0x9de2('0x21')]=_0x20c7e8[_0x9de2('0x21')]?_0x20c7e8['TrunkBackup']:undefined;this[_0x9de2('0x22')]=_0x20c7e8[_0x9de2('0x22')]?_0x20c7e8[_0x9de2('0x22')]:undefined;this[_0x9de2('0x23')]=_0x20c7e8[_0x9de2('0x23')]?_0x20c7e8[_0x9de2('0x23')]:undefined;this[_0x9de2('0x24')]=_0x20c7e8[_0x9de2('0x24')]?_0x20c7e8[_0x9de2('0x24')]:undefined;this[_0x9de2('0x25')]=_0x20c7e8[_0x9de2('0x24')]?_0x20c7e8[_0x9de2('0x24')]['name']:undefined;this[_0x9de2('0x26')]=_0x20c7e8['dialAMDActive']||![];this[_0x9de2('0x27')]=_0x20c7e8[_0x9de2('0x27')];this[_0x9de2('0x28')]=_0x20c7e8[_0x9de2('0x28')];this[_0x9de2('0x29')]=_0x20c7e8['dialAMDAfterGreetingSilence'];this[_0x9de2('0x2a')]=_0x20c7e8[_0x9de2('0x2a')];this[_0x9de2('0x2b')]=_0x20c7e8[_0x9de2('0x2b')];this[_0x9de2('0x2c')]=_0x20c7e8['dialAMDBetweenWordsSilence'];this[_0x9de2('0x2d')]=_0x20c7e8[_0x9de2('0x2d')];this[_0x9de2('0x2e')]=_0x20c7e8[_0x9de2('0x2e')];this[_0x9de2('0x2f')]=_0x20c7e8[_0x9de2('0x2f')];}module[_0x9de2('0x30')]=Campaign; \ No newline at end of file +var _0xcd60=['dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xcd60,0xf0));var _0x0cd6=function(_0x83208b,_0x5d8d6a){_0x83208b=_0x83208b-0x0;var _0x36049a=_0xcd60[_0x83208b];return _0x36049a;};'use strict';function Campaign(_0x4c4335){this['id']=_0x4c4335['id']||0x0;this[_0x0cd6('0x0')]=_0x4c4335[_0x0cd6('0x0')]||'';this[_0x0cd6('0x1')]=_0x4c4335[_0x0cd6('0x1')]||_0x0cd6('0x2');this[_0x0cd6('0x3')]=0x0;this['temp']=0x0;this[_0x0cd6('0x4')]=0x0;this[_0x0cd6('0x5')]=0x0;this[_0x0cd6('0x6')]='';this[_0x0cd6('0x7')]=!![];this[_0x0cd6('0x8')]=_0x4c4335['active'];this[_0x0cd6('0x9')]=_0x4c4335[_0x0cd6('0x9')];this['dialTimezone']=_0x4c4335[_0x0cd6('0xa')]||null;this['dialGlobalInterval']=_0x4c4335[_0x0cd6('0xb')]?_0x4c4335[_0x0cd6('0xb')]:null;this[_0x0cd6('0xc')]=_0x4c4335[_0x0cd6('0xc')];this[_0x0cd6('0xd')]=_0x4c4335['dialOriginateCallerIdNumber'];this[_0x0cd6('0xe')]=_0x4c4335[_0x0cd6('0xe')]||0x1e;this[_0x0cd6('0xf')]=_0x4c4335[_0x0cd6('0xf')];this[_0x0cd6('0x10')]=_0x4c4335['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x4c4335[_0x0cd6('0x11')];this[_0x0cd6('0x12')]=_0x4c4335[_0x0cd6('0x12')];this['dialNoAnswerMaxRetry']=_0x4c4335[_0x0cd6('0x13')];this['dialNoAnswerRetryFrequency']=_0x4c4335[_0x0cd6('0x14')];this[_0x0cd6('0x15')]=_0x4c4335[_0x0cd6('0x15')];this[_0x0cd6('0x16')]=_0x4c4335[_0x0cd6('0x16')]||0x3;this[_0x0cd6('0x17')]=_0x4c4335[_0x0cd6('0x17')]||0x96;this[_0x0cd6('0x18')]=_0x4c4335[_0x0cd6('0x18')]||0x3;this[_0x0cd6('0x19')]=_0x4c4335[_0x0cd6('0x19')]||0x96;this[_0x0cd6('0x1a')]=_0x4c4335[_0x0cd6('0x1a')]||0x3;this[_0x0cd6('0x1b')]=_0x4c4335['dialAbandonedRetryFrequency']||0x96;this[_0x0cd6('0x1c')]=_0x4c4335[_0x0cd6('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x4c4335['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x4c4335[_0x0cd6('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4c4335['dialAgentRejectRetryFrequency']||0x96;this[_0x0cd6('0x1e')]=_0x4c4335['dialOrderByScheduledAt']||_0x0cd6('0x1f');this[_0x0cd6('0x20')]=_0x4c4335[_0x0cd6('0x20')]||undefined;this[_0x0cd6('0x21')]=_0x4c4335[_0x0cd6('0x21')]||undefined;this[_0x0cd6('0x22')]=_0x4c4335[_0x0cd6('0x22')]||undefined;this[_0x0cd6('0x23')]=_0x4c4335['TrunkBackup']?_0x4c4335[_0x0cd6('0x23')]:undefined;this[_0x0cd6('0x24')]=_0x4c4335[_0x0cd6('0x24')]?_0x4c4335['Trunk']:undefined;this['Interval']=_0x4c4335['Interval']?_0x4c4335[_0x0cd6('0x25')]:undefined;this['SquareProject']=_0x4c4335['SquareProject']?_0x4c4335['SquareProject']:undefined;this['dialQueueProject']=_0x4c4335[_0x0cd6('0x26')]?_0x4c4335[_0x0cd6('0x26')][_0x0cd6('0x0')]:undefined;this[_0x0cd6('0x27')]=_0x4c4335['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x4c4335[_0x0cd6('0x28')];this['dialAMDGreeting']=_0x4c4335[_0x0cd6('0x29')];this[_0x0cd6('0x2a')]=_0x4c4335[_0x0cd6('0x2a')];this[_0x0cd6('0x2b')]=_0x4c4335[_0x0cd6('0x2b')];this[_0x0cd6('0x2c')]=_0x4c4335[_0x0cd6('0x2c')];this[_0x0cd6('0x2d')]=_0x4c4335[_0x0cd6('0x2d')];this[_0x0cd6('0x2e')]=_0x4c4335[_0x0cd6('0x2e')];this[_0x0cd6('0x2f')]=_0x4c4335[_0x0cd6('0x2f')];this[_0x0cd6('0x30')]=_0x4c4335[_0x0cd6('0x30')];}module[_0x0cd6('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c05fc92..a407acd 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 _0xd9b4=['unmanaged','abandoned','lastapplication','duration','holdtime','disposition','monitorFilename','queue','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','linkedid','answered','answertime','endtime'];(function(_0x100d5d,_0x14a6dd){var _0x5a0b5a=function(_0x24ebb8){while(--_0x24ebb8){_0x100d5d['push'](_0x100d5d['shift']());}};_0x5a0b5a(++_0x14a6dd);}(_0xd9b4,0x1c0));var _0x4d9b=function(_0x89c6ce,_0x41dbf7){_0x89c6ce=_0x89c6ce-0x0;var _0x564ec1=_0xd9b4[_0x89c6ce];return _0x564ec1;};'use strict';function Channel(){this[_0x4d9b('0x0')]=null;this[_0x4d9b('0x1')]='';this[_0x4d9b('0x2')]='';this[_0x4d9b('0x3')]=0x0;this[_0x4d9b('0x4')]='';this[_0x4d9b('0x5')]=undefined;this[_0x4d9b('0x6')]=undefined;this[_0x4d9b('0x7')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x4d9b('0x8')]=0x0;this['exten']=0x0;this[_0x4d9b('0x9')]=![];this[_0x4d9b('0xa')]=null;this[_0x4d9b('0xb')]=null;this[_0x4d9b('0xc')]=![];this[_0x4d9b('0xd')]=![];this[_0x4d9b('0xe')]='';this['lastdata']='';this[_0x4d9b('0xf')]=0x0;this['billableseconds']=0x0;this[_0x4d9b('0x10')]=0x0;this['type']=null;this['tag']=null;this[_0x4d9b('0x11')]=null;this['monitor']=![];this[_0x4d9b('0x12')]=null;this[_0x4d9b('0x13')]=null;this['monitors']=[];this[_0x4d9b('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x4d9b('0x15')]=0x0;}module[_0x4d9b('0x16')]=Channel; \ No newline at end of file +var _0x391f=['context','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','monitor','monitorFilename','transfercalleridnum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x391f,0x10c));var _0xf391=function(_0x2b794,_0x841795){_0x2b794=_0x2b794-0x0;var _0x4b7ed0=_0x391f[_0x2b794];return _0x4b7ed0;};'use strict';function Channel(){this[_0xf391('0x0')]=null;this[_0xf391('0x1')]='';this[_0xf391('0x2')]='';this[_0xf391('0x3')]=0x0;this[_0xf391('0x4')]='';this[_0xf391('0x5')]=undefined;this[_0xf391('0x6')]=undefined;this['accountcode']=0x0;this[_0xf391('0x7')]='';this[_0xf391('0x8')]=0x0;this[_0xf391('0x9')]=0x0;this[_0xf391('0xa')]=0x0;this[_0xf391('0xb')]=![];this['answertime']=null;this[_0xf391('0xc')]=null;this[_0xf391('0xd')]=![];this[_0xf391('0xe')]=![];this[_0xf391('0xf')]='';this[_0xf391('0x10')]='';this['duration']=0x0;this[_0xf391('0x11')]=0x0;this[_0xf391('0x12')]=0x0;this[_0xf391('0x13')]=null;this['tag']=null;this['disposition']=null;this[_0xf391('0x14')]=![];this[_0xf391('0x15')]=null;this['queue']=null;this['monitors']=[];this[_0xf391('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xf391('0x17')]=0x0;}module[_0xf391('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 8f867fe..870780e 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 _0xdc03=['token','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdc03,0x65));var _0x3dc0=function(_0x249a58,_0x4558ba){_0x249a58=_0x249a58-0x0;var _0x2c00fb=_0xdc03[_0x249a58];return _0x2c00fb;};'use strict';function DeskAccount(_0x3e6545){this['id']=_0x3e6545['id']||0x0;this['name']=_0x3e6545[_0x3dc0('0x0')]||'';this[_0x3dc0('0x1')]=_0x3e6545['username']||'';this[_0x3dc0('0x2')]=_0x3e6545[_0x3dc0('0x2')]||'';this[_0x3dc0('0x3')]=_0x3e6545[_0x3dc0('0x3')]||'';this[_0x3dc0('0x4')]=_0x3e6545[_0x3dc0('0x4')]||'';this['consumerKey']=_0x3e6545[_0x3dc0('0x5')]||'';this[_0x3dc0('0x6')]=_0x3e6545[_0x3dc0('0x6')]||'';this['token']=_0x3e6545[_0x3dc0('0x7')]||'';this['tokenSecret']=_0x3e6545['tokenSecret']||'';this['type']=_0x3e6545[_0x3dc0('0x8')]||'';this[_0x3dc0('0x9')]=_0x3e6545[_0x3dc0('0x9')]||'';this[_0x3dc0('0xa')]=_0x3e6545[_0x3dc0('0xa')]||{};}module[_0x3dc0('0xb')]=DeskAccount; \ No newline at end of file +var _0xed1f=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0xed1f,0x6a));var _0xfed1=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xed1f[_0x2be8c2];return _0x97f531;};'use strict';function DeskAccount(_0x47d976){this['id']=_0x47d976['id']||0x0;this[_0xfed1('0x0')]=_0x47d976[_0xfed1('0x0')]||'';this[_0xfed1('0x1')]=_0x47d976[_0xfed1('0x1')]||'';this[_0xfed1('0x2')]=_0x47d976[_0xfed1('0x2')]||'';this[_0xfed1('0x3')]=_0x47d976[_0xfed1('0x3')]||'';this[_0xfed1('0x4')]=_0x47d976[_0xfed1('0x4')]||'';this[_0xfed1('0x5')]=_0x47d976[_0xfed1('0x5')]||'';this[_0xfed1('0x6')]=_0x47d976[_0xfed1('0x6')]||'';this[_0xfed1('0x7')]=_0x47d976[_0xfed1('0x7')]||'';this[_0xfed1('0x8')]=_0x47d976['tokenSecret']||'';this[_0xfed1('0x9')]=_0x47d976[_0xfed1('0x9')]||'';this['serverUrl']=_0x47d976[_0xfed1('0xa')]||'';this[_0xfed1('0xb')]=_0x47d976['Configurations']||{};}module[_0xfed1('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index c436e65..bf5f489 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 _0x1edb=['exports','name','username','remoteUri','tenantId','clientId','serverUrl','Configurations'];(function(_0x5599b4,_0x496915){var _0xc28015=function(_0x35f720){while(--_0x35f720){_0x5599b4['push'](_0x5599b4['shift']());}};_0xc28015(++_0x496915);}(_0x1edb,0x189));var _0xb1ed=function(_0x59258c,_0xea283){_0x59258c=_0x59258c-0x0;var _0x21a95c=_0x1edb[_0x59258c];return _0x21a95c;};'use strict';function Dynamics365Account(_0x333754){this['id']=_0x333754['id']||0x0;this[_0xb1ed('0x0')]=_0x333754[_0xb1ed('0x0')]||'';this['username']=_0x333754[_0xb1ed('0x1')]||'';this['password']=_0x333754['password']||'';this[_0xb1ed('0x2')]=_0x333754[_0xb1ed('0x2')]||'';this[_0xb1ed('0x3')]=_0x333754[_0xb1ed('0x3')]||'';this[_0xb1ed('0x4')]=_0x333754[_0xb1ed('0x4')]||'';this['clientSecret']=_0x333754['clientSecret']||{};this[_0xb1ed('0x5')]=_0x333754[_0xb1ed('0x5')]||'';this[_0xb1ed('0x6')]=_0x333754[_0xb1ed('0x6')]||{};}module[_0xb1ed('0x7')]=Dynamics365Account; \ No newline at end of file +var _0xa225=['name','username','password','remoteUri','tenantId','clientId','clientSecret','Configurations','exports'];(function(_0x313dea,_0x3a9e77){var _0x3ad44f=function(_0x2e64e0){while(--_0x2e64e0){_0x313dea['push'](_0x313dea['shift']());}};_0x3ad44f(++_0x3a9e77);}(_0xa225,0x195));var _0x5a22=function(_0x20bcb0,_0xb5cbdd){_0x20bcb0=_0x20bcb0-0x0;var _0xdc4f5b=_0xa225[_0x20bcb0];return _0xdc4f5b;};'use strict';function Dynamics365Account(_0x15f714){this['id']=_0x15f714['id']||0x0;this[_0x5a22('0x0')]=_0x15f714[_0x5a22('0x0')]||'';this['username']=_0x15f714[_0x5a22('0x1')]||'';this[_0x5a22('0x2')]=_0x15f714[_0x5a22('0x2')]||'';this[_0x5a22('0x3')]=_0x15f714[_0x5a22('0x3')]||'';this[_0x5a22('0x4')]=_0x15f714['tenantId']||'';this['clientId']=_0x15f714[_0x5a22('0x5')]||'';this[_0x5a22('0x6')]=_0x15f714[_0x5a22('0x6')]||{};this['serverUrl']=_0x15f714['serverUrl']||'';this[_0x5a22('0x7')]=_0x15f714['Configurations']||{};}module[_0x5a22('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index e3f9f31..ab631eb 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 _0x6df9=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x5e9c85,_0x461674){var _0xcbdcf7=function(_0x2680d9){while(--_0x2680d9){_0x5e9c85['push'](_0x5e9c85['shift']());}};_0xcbdcf7(++_0x461674);}(_0x6df9,0x84));var _0x96df=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6df9[_0x4b369d];return _0x571a98;};'use strict';function FaxAccount(_0x3e612e){this['id']=_0x3e612e['id']||0x0;this[_0x96df('0x0')]=_0x3e612e['name']||'';this[_0x96df('0x1')]=_0x3e612e['description'];this['ecm']=_0x3e612e[_0x96df('0x2')];this['headerinfo']=_0x3e612e[_0x96df('0x3')];this['localstationid']=_0x3e612e[_0x96df('0x4')];this['minrate']=_0x3e612e[_0x96df('0x5')]||0x960;this[_0x96df('0x6')]=_0x3e612e['maxrate']||0x3840;this[_0x96df('0x7')]=_0x3e612e[_0x96df('0x7')]||_0x96df('0x8');this[_0x96df('0x9')]=_0x3e612e['gateway']||'no';this[_0x96df('0xa')]=_0x3e612e[_0x96df('0xa')]||'no';this['t38timeout']=_0x3e612e[_0x96df('0xb')]||0x1388;this['tech']=_0x3e612e[_0x96df('0xc')]||'SIP';this['Trunk']=_0x3e612e['Trunk']?_0x3e612e[_0x96df('0xd')]:undefined;this[_0x96df('0xe')]=_0x3e612e[_0x96df('0xe')];this[_0x96df('0xf')]=_0x3e612e[_0x96df('0xf')];}module[_0x96df('0x10')]=FaxAccount; \ No newline at end of file +var _0x6d0c=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','description','ecm','headerinfo','localstationid','minrate'];(function(_0x3157c2,_0x312472){var _0x57af73=function(_0x5edc32){while(--_0x5edc32){_0x3157c2['push'](_0x3157c2['shift']());}};_0x57af73(++_0x312472);}(_0x6d0c,0x171));var _0xc6d0=function(_0x51a063,_0x675fc5){_0x51a063=_0x51a063-0x0;var _0x16f2cc=_0x6d0c[_0x51a063];return _0x16f2cc;};'use strict';function FaxAccount(_0x17113e){this['id']=_0x17113e['id']||0x0;this['name']=_0x17113e['name']||'';this[_0xc6d0('0x0')]=_0x17113e[_0xc6d0('0x0')];this[_0xc6d0('0x1')]=_0x17113e[_0xc6d0('0x1')];this[_0xc6d0('0x2')]=_0x17113e[_0xc6d0('0x2')];this[_0xc6d0('0x3')]=_0x17113e[_0xc6d0('0x3')];this[_0xc6d0('0x4')]=_0x17113e[_0xc6d0('0x4')]||0x960;this[_0xc6d0('0x5')]=_0x17113e[_0xc6d0('0x5')]||0x3840;this[_0xc6d0('0x6')]=_0x17113e[_0xc6d0('0x6')]||_0xc6d0('0x7');this[_0xc6d0('0x8')]=_0x17113e[_0xc6d0('0x8')]||'no';this['faxdetect']=_0x17113e[_0xc6d0('0x9')]||'no';this[_0xc6d0('0xa')]=_0x17113e['t38timeout']||0x1388;this[_0xc6d0('0xb')]=_0x17113e[_0xc6d0('0xb')]||_0xc6d0('0xc');this[_0xc6d0('0xd')]=_0x17113e[_0xc6d0('0xd')]?_0x17113e[_0xc6d0('0xd')]:undefined;this[_0xc6d0('0xe')]=_0x17113e[_0xc6d0('0xe')];this[_0xc6d0('0xf')]=_0x17113e[_0xc6d0('0xf')];}module[_0xc6d0('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 516d12f..9f13593 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 _0xf838=['token','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xf838,0xcf));var _0x8f83=function(_0x1d35c0,_0x33ae83){_0x1d35c0=_0x1d35c0-0x0;var _0x2380da=_0xf838[_0x1d35c0];return _0x2380da;};'use strict';function FreshdeskAccount(_0x11fa2b){this['id']=_0x11fa2b['id']||0x0;this[_0x8f83('0x0')]=_0x11fa2b[_0x8f83('0x0')]||'';this[_0x8f83('0x1')]=_0x11fa2b[_0x8f83('0x1')]||'';this[_0x8f83('0x2')]=_0x11fa2b[_0x8f83('0x3')]||'';this['remoteUri']=_0x11fa2b['remoteUri']||'';this[_0x8f83('0x4')]=_0x11fa2b[_0x8f83('0x4')]||'';this[_0x8f83('0x5')]=_0x11fa2b[_0x8f83('0x5')]||{};}module[_0x8f83('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x536c=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x172d7d,_0x199fe4){var _0x2c9b49=function(_0x864b2d){while(--_0x864b2d){_0x172d7d['push'](_0x172d7d['shift']());}};_0x2c9b49(++_0x199fe4);}(_0x536c,0x152));var _0xc536=function(_0x372590,_0x1ebb65){_0x372590=_0x372590-0x0;var _0x21abe6=_0x536c[_0x372590];return _0x21abe6;};'use strict';function FreshdeskAccount(_0x5211b9){this['id']=_0x5211b9['id']||0x0;this[_0xc536('0x0')]=_0x5211b9[_0xc536('0x0')]||'';this[_0xc536('0x1')]=_0x5211b9[_0xc536('0x1')]||'';this[_0xc536('0x2')]=_0x5211b9[_0xc536('0x3')]||'';this[_0xc536('0x4')]=_0x5211b9[_0xc536('0x4')]||'';this[_0xc536('0x5')]=_0x5211b9['serverUrl']||'';this[_0xc536('0x6')]=_0x5211b9[_0xc536('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 3345079..214666b 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 _0x3cda=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x387551,_0x5883a6){var _0x4b5c97=function(_0x15c094){while(--_0x15c094){_0x387551['push'](_0x387551['shift']());}};_0x4b5c97(++_0x5883a6);}(_0x3cda,0x15e));var _0xa3cd=function(_0x3cb5f1,_0x48c50e){_0x3cb5f1=_0x3cb5f1-0x0;var _0x31d0c9=_0x3cda[_0x3cb5f1];return _0x31d0c9;};'use strict';function FreshsalesAccount(_0x10f5cd){this['id']=_0x10f5cd['id']||0x0;this['name']=_0x10f5cd[_0xa3cd('0x0')]||'';this[_0xa3cd('0x1')]=_0x10f5cd[_0xa3cd('0x1')]||'';this[_0xa3cd('0x2')]=_0x10f5cd[_0xa3cd('0x3')]||'';this[_0xa3cd('0x4')]=_0x10f5cd[_0xa3cd('0x4')]||'';this[_0xa3cd('0x5')]=_0x10f5cd[_0xa3cd('0x5')]||'';this[_0xa3cd('0x6')]=_0x10f5cd[_0xa3cd('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x48a5=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x2f7cc0,_0xa7ddc9){var _0x42ac73=function(_0x4d41d7){while(--_0x4d41d7){_0x2f7cc0['push'](_0x2f7cc0['shift']());}};_0x42ac73(++_0xa7ddc9);}(_0x48a5,0xeb));var _0x548a=function(_0x1d513a,_0x24b300){_0x1d513a=_0x1d513a-0x0;var _0x44c9ef=_0x48a5[_0x1d513a];return _0x44c9ef;};'use strict';function FreshsalesAccount(_0x3f49aa){this['id']=_0x3f49aa['id']||0x0;this[_0x548a('0x0')]=_0x3f49aa[_0x548a('0x0')]||'';this[_0x548a('0x1')]=_0x3f49aa[_0x548a('0x1')]||'';this[_0x548a('0x2')]=_0x3f49aa[_0x548a('0x3')]||'';this[_0x548a('0x4')]=_0x3f49aa[_0x548a('0x4')]||'';this[_0x548a('0x5')]=_0x3f49aa[_0x548a('0x5')]||'';this[_0x548a('0x6')]=_0x3f49aa[_0x548a('0x6')]||{};}module[_0x548a('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9e88e0b..df2ddeb 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 _0x69fc=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','priority','assigned','lastAssignedTo','mohtime','variables','exports','uniqueid','queuecallerjoinAt','queuecallerabandonAt','queuecallercomplete'];(function(_0x22a409,_0x1e7083){var _0x4ffcf0=function(_0x41b9b7){while(--_0x41b9b7){_0x22a409['push'](_0x22a409['shift']());}};_0x4ffcf0(++_0x1e7083);}(_0x69fc,0x1be));var _0xc69f=function(_0xc5aba7,_0x5147bc){_0xc5aba7=_0xc5aba7-0x0;var _0x364acf=_0x69fc[_0xc5aba7];return _0x364acf;};'use strict';function QueueReport(){this['type']='inbound';this[_0xc69f('0x0')]='';this['calleridnum']='';this['calleridname']='';this['queue']='';this[_0xc69f('0x1')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0xc69f('0x2')]=null;this[_0xc69f('0x3')]=![];this[_0xc69f('0x4')]=null;this[_0xc69f('0x5')]=![];this[_0xc69f('0x6')]=null;this['originalposition']=0x1;this[_0xc69f('0x7')]='';this[_0xc69f('0x8')]='';this[_0xc69f('0x9')]='';this['accountcode']='';this[_0xc69f('0xa')]='';this[_0xc69f('0xb')]='';this[_0xc69f('0xc')]='';this['holdtime']=0x0;this[_0xc69f('0xd')]=![];this[_0xc69f('0xe')]='';this[_0xc69f('0xf')]=0x0;this[_0xc69f('0x10')]={};}module[_0xc69f('0x11')]=QueueReport; \ No newline at end of file +var _0x3fcf=['accountcode','context','priority','assigned','lastAssignedTo','mohtime','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x1880b8,_0x57084e){var _0xeb338c=function(_0x3370d2){while(--_0x3370d2){_0x1880b8['push'](_0x1880b8['shift']());}};_0xeb338c(++_0x57084e);}(_0x3fcf,0x84));var _0xf3fc=function(_0x1ff15e,_0x4f5e38){_0x1ff15e=_0x1ff15e-0x0;var _0x407b3d=_0x3fcf[_0x1ff15e];return _0x407b3d;};'use strict';function QueueReport(){this['type']=_0xf3fc('0x0');this[_0xf3fc('0x1')]='';this[_0xf3fc('0x2')]='';this[_0xf3fc('0x3')]='';this[_0xf3fc('0x4')]='';this[_0xf3fc('0x5')]=null;this[_0xf3fc('0x6')]=null;this[_0xf3fc('0x7')]=0x1;this[_0xf3fc('0x8')]=0x1;this[_0xf3fc('0x9')]=![];this[_0xf3fc('0xa')]=null;this['queuecallercomplete']=![];this[_0xf3fc('0xb')]=null;this[_0xf3fc('0xc')]=![];this[_0xf3fc('0xd')]=null;this[_0xf3fc('0xe')]=0x1;this[_0xf3fc('0xf')]='';this[_0xf3fc('0x10')]='';this[_0xf3fc('0x11')]='';this[_0xf3fc('0x12')]='';this[_0xf3fc('0x13')]='';this['exten']='';this[_0xf3fc('0x14')]='';this['holdtime']=0x0;this[_0xf3fc('0x15')]=![];this[_0xf3fc('0x16')]='';this[_0xf3fc('0x17')]=0x0;this['variables']={};}module[_0xf3fc('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index bbb5f3d..96f4017 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 _0xdeb3=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','username'];(function(_0x1c4183,_0x33fca6){var _0x52dba9=function(_0x43dc43){while(--_0x43dc43){_0x1c4183['push'](_0x1c4183['shift']());}};_0x52dba9(++_0x33fca6);}(_0xdeb3,0x15f));var _0x3deb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdeb3[_0x19950b];return _0x3c6b41;};'use strict';function SalesforceAccount(_0x1ddbc1){this['id']=_0x1ddbc1['id']||0x0;this['name']=_0x1ddbc1['name']||'';this[_0x3deb('0x0')]=_0x1ddbc1['username']||'';this[_0x3deb('0x1')]=_0x1ddbc1[_0x3deb('0x1')]||'';this[_0x3deb('0x2')]=_0x1ddbc1[_0x3deb('0x2')]||'';this[_0x3deb('0x3')]=_0x1ddbc1[_0x3deb('0x3')]||'';this['clientSecret']=_0x1ddbc1[_0x3deb('0x4')]||'';this[_0x3deb('0x5')]=_0x1ddbc1[_0x3deb('0x5')]||'';this[_0x3deb('0x6')]=_0x1ddbc1[_0x3deb('0x6')]||_0x3deb('0x7');this['serverUrl']=_0x1ddbc1[_0x3deb('0x8')]||'';this[_0x3deb('0x9')]=_0x1ddbc1[_0x3deb('0x9')]||{};}module[_0x3deb('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x2db4=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0x2db4,0x12a));var _0x42db=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2db4[_0x55f8b4];return _0x2475f9;};'use strict';function SalesforceAccount(_0x90a3b0){this['id']=_0x90a3b0['id']||0x0;this[_0x42db('0x0')]=_0x90a3b0[_0x42db('0x0')]||'';this[_0x42db('0x1')]=_0x90a3b0[_0x42db('0x1')]||'';this['remoteUri']=_0x90a3b0[_0x42db('0x2')]||'';this[_0x42db('0x3')]=_0x90a3b0[_0x42db('0x3')]||'';this[_0x42db('0x4')]=_0x90a3b0[_0x42db('0x4')]||'';this[_0x42db('0x5')]=_0x90a3b0[_0x42db('0x5')]||'';this[_0x42db('0x6')]=_0x90a3b0['securityToken']||'';this[_0x42db('0x7')]=_0x90a3b0[_0x42db('0x7')]||'integrationTab';this[_0x42db('0x8')]=_0x90a3b0[_0x42db('0x8')]||'';this[_0x42db('0x9')]=_0x90a3b0[_0x42db('0x9')]||{};}module[_0x42db('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ae3e63a..d9d5a6c 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 _0x006e=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x39640f,_0x167d4a){var _0x39c60c=function(_0x26f9b4){while(--_0x26f9b4){_0x39640f['push'](_0x39640f['shift']());}};_0x39c60c(++_0x167d4a);}(_0x006e,0x183));var _0xe006=function(_0x4a8fea,_0x4603f4){_0x4a8fea=_0x4a8fea-0x0;var _0x5e23a4=_0x006e[_0x4a8fea];return _0x5e23a4;};'use strict';function ServicenowAccount(_0x59e01e){this['id']=_0x59e01e['id']||0x0;this[_0xe006('0x0')]=_0x59e01e[_0xe006('0x0')]||'';this[_0xe006('0x1')]=_0x59e01e[_0xe006('0x1')]||'';this[_0xe006('0x2')]=_0x59e01e[_0xe006('0x2')]||'';this[_0xe006('0x3')]=_0x59e01e[_0xe006('0x3')]||'';this[_0xe006('0x4')]=_0x59e01e[_0xe006('0x4')]||'';this[_0xe006('0x5')]=_0x59e01e[_0xe006('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x6f34=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x21b5e4,_0x45e128){var _0x478953=function(_0x488b18){while(--_0x488b18){_0x21b5e4['push'](_0x21b5e4['shift']());}};_0x478953(++_0x45e128);}(_0x6f34,0x199));var _0x46f3=function(_0x7afd2e,_0x5a9f67){_0x7afd2e=_0x7afd2e-0x0;var _0x2a8485=_0x6f34[_0x7afd2e];return _0x2a8485;};'use strict';function ServicenowAccount(_0x133e13){this['id']=_0x133e13['id']||0x0;this[_0x46f3('0x0')]=_0x133e13[_0x46f3('0x0')]||'';this['username']=_0x133e13[_0x46f3('0x1')]||'';this['password']=_0x133e13[_0x46f3('0x2')]||'';this['remoteUri']=_0x133e13[_0x46f3('0x3')]||'';this[_0x46f3('0x4')]=_0x133e13['serverUrl']||'';this['Configurations']=_0x133e13[_0x46f3('0x5')]||{};}module[_0x46f3('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index fbb98d1..a955059 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 _0x0581=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x0581,0x1ef));var _0x1058=function(_0x5448a9,_0x4764da){_0x5448a9=_0x5448a9-0x0;var _0x1924af=_0x0581[_0x5448a9];return _0x1924af;};'use strict';function SugarcrmAccount(_0x43e9ec){this['id']=_0x43e9ec['id']||0x0;this[_0x1058('0x0')]=_0x43e9ec[_0x1058('0x0')]||'';this[_0x1058('0x1')]=_0x43e9ec[_0x1058('0x1')]||'';this['password']=_0x43e9ec[_0x1058('0x2')]||'';this[_0x1058('0x3')]=_0x43e9ec[_0x1058('0x3')]||'';this[_0x1058('0x4')]=_0x43e9ec[_0x1058('0x4')]||'';this['Configurations']=_0x43e9ec[_0x1058('0x5')]||{};}module[_0x1058('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xc427=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x137a46,_0x4c5534){var _0x5bd9d9=function(_0x2a910f){while(--_0x2a910f){_0x137a46['push'](_0x137a46['shift']());}};_0x5bd9d9(++_0x4c5534);}(_0xc427,0xa8));var _0x7c42=function(_0x2bfab9,_0x26a152){_0x2bfab9=_0x2bfab9-0x0;var _0x235dee=_0xc427[_0x2bfab9];return _0x235dee;};'use strict';function SugarcrmAccount(_0x30a6cb){this['id']=_0x30a6cb['id']||0x0;this[_0x7c42('0x0')]=_0x30a6cb['name']||'';this[_0x7c42('0x1')]=_0x30a6cb[_0x7c42('0x1')]||'';this[_0x7c42('0x2')]=_0x30a6cb[_0x7c42('0x2')]||'';this[_0x7c42('0x3')]=_0x30a6cb[_0x7c42('0x3')]||'';this[_0x7c42('0x4')]=_0x30a6cb['serverUrl']||'';this[_0x7c42('0x5')]=_0x30a6cb[_0x7c42('0x5')]||{};}module[_0x7c42('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 6dbb720..62b98be 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 _0xccf6=['state','unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xccf6,0xa6));var _0x6ccf=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xccf6[_0xbd08b4];return _0x314f1e;};'use strict';function Telephone(_0x495534){this['id']=_0x495534['id']||0x0;this[_0x6ccf('0x0')]=_0x495534['name']||'';this[_0x6ccf('0x1')]=_0x495534[_0x6ccf('0x1')]||'';this[_0x6ccf('0x2')]=_0x6ccf('0x3');this[_0x6ccf('0x4')]=0x0;this[_0x6ccf('0x5')]='unknown';this[_0x6ccf('0x6')]='';}module[_0x6ccf('0x7')]=Telephone; \ No newline at end of file +var _0xb1d1=['unknown','stateTime','status','address','exports','name','accountcode','state'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0xb1d1,0xa5));var _0x1b1d=function(_0x53d906,_0x50e4c4){_0x53d906=_0x53d906-0x0;var _0x3d8748=_0xb1d1[_0x53d906];return _0x3d8748;};'use strict';function Telephone(_0x4faf52){this['id']=_0x4faf52['id']||0x0;this[_0x1b1d('0x0')]=_0x4faf52[_0x1b1d('0x0')]||'';this['accountcode']=_0x4faf52[_0x1b1d('0x1')]||'';this[_0x1b1d('0x2')]=_0x1b1d('0x3');this[_0x1b1d('0x4')]=0x0;this[_0x1b1d('0x5')]='unknown';this[_0x1b1d('0x6')]='';}module[_0x1b1d('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 d349c1a..dfb719a 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 _0x791d=['html','exports','name'];(function(_0x1ea5c5,_0x487bbb){var _0x3c085e=function(_0x933525){while(--_0x933525){_0x1ea5c5['push'](_0x1ea5c5['shift']());}};_0x3c085e(++_0x487bbb);}(_0x791d,0xe9));var _0xd791=function(_0x580720,_0x400faa){_0x580720=_0x580720-0x0;var _0x4bafcc=_0x791d[_0x580720];return _0x4bafcc;};'use strict';function template(_0x2676da){this['id']=_0x2676da['id']||0x0;this[_0xd791('0x0')]=_0x2676da[_0xd791('0x0')]||'';this[_0xd791('0x1')]=_0x2676da['html']||'';}module[_0xd791('0x2')]=template; \ No newline at end of file +var _0x7b51=['exports','name','html'];(function(_0x4fcd42,_0x3e4c7c){var _0x45f44f=function(_0x1222ee){while(--_0x1222ee){_0x4fcd42['push'](_0x4fcd42['shift']());}};_0x45f44f(++_0x3e4c7c);}(_0x7b51,0x1bd));var _0x17b5=function(_0x55bf96,_0x7267a7){_0x55bf96=_0x55bf96-0x0;var _0x5092ef=_0x7b51[_0x55bf96];return _0x5092ef;};'use strict';function template(_0x463b69){this['id']=_0x463b69['id']||0x0;this[_0x17b5('0x0')]=_0x463b69[_0x17b5('0x0')]||'';this[_0x17b5('0x1')]=_0x463b69['html']||'';}module[_0x17b5('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 6d8d3ec..d630b3c 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 _0x6aa7=['voice','status','AllConditions','Actions','exports','name','channel'];(function(_0x73536b,_0x17e09a){var _0xfd965f=function(_0x5486ea){while(--_0x5486ea){_0x73536b['push'](_0x73536b['shift']());}};_0xfd965f(++_0x17e09a);}(_0x6aa7,0x178));var _0x76aa=function(_0x43a387,_0x448932){_0x43a387=_0x43a387-0x0;var _0x1b8839=_0x6aa7[_0x43a387];return _0x1b8839;};'use strict';function Trigger(_0x8de1e4){this['id']=_0x8de1e4['id']||0x0;this['name']=_0x8de1e4[_0x76aa('0x0')]||'';this[_0x76aa('0x1')]=_0x8de1e4[_0x76aa('0x1')]||_0x76aa('0x2');this['status']=_0x8de1e4[_0x76aa('0x3')]||![];this[_0x76aa('0x4')]=_0x8de1e4[_0x76aa('0x4')]||[];this['AnyConditions']=_0x8de1e4['AnyConditions']||[];this[_0x76aa('0x5')]=_0x8de1e4['Actions']||[];}module[_0x76aa('0x6')]=Trigger; \ No newline at end of file +var _0x6aa7=['voice','status','AllConditions','Actions','exports','name','channel'];(function(_0x2d0094,_0x167a61){var _0x4cc4ca=function(_0x352542){while(--_0x352542){_0x2d0094['push'](_0x2d0094['shift']());}};_0x4cc4ca(++_0x167a61);}(_0x6aa7,0x178));var _0x76aa=function(_0x543a45,_0x46ae0b){_0x543a45=_0x543a45-0x0;var _0x54094a=_0x6aa7[_0x543a45];return _0x54094a;};'use strict';function Trigger(_0x8de1e4){this['id']=_0x8de1e4['id']||0x0;this['name']=_0x8de1e4[_0x76aa('0x0')]||'';this[_0x76aa('0x1')]=_0x8de1e4[_0x76aa('0x1')]||_0x76aa('0x2');this['status']=_0x8de1e4[_0x76aa('0x3')]||![];this[_0x76aa('0x4')]=_0x8de1e4[_0x76aa('0x4')]||[];this['AnyConditions']=_0x8de1e4['AnyConditions']||[];this[_0x76aa('0x5')]=_0x8de1e4['Actions']||[];}module[_0x76aa('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 21ce719..5238fcf 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 _0x8b7a=['indexOf','split','host','port','domainport','refresh','stateRegistry','unknown','exports','active','name','stateTime','status','registry'];(function(_0x50fc27,_0x1b82f6){var _0x3503d2=function(_0xeeab34){while(--_0xeeab34){_0x50fc27['push'](_0x50fc27['shift']());}};_0x3503d2(++_0x1b82f6);}(_0x8b7a,0x1f3));var _0xa8b7=function(_0x1929cd,_0x8b0d6a){_0x1929cd=_0x1929cd-0x0;var _0x48c29f=_0x8b7a[_0x1929cd];return _0x48c29f;};'use strict';function Trunk(_0x331cbd){this['id']=_0x331cbd['id']||0x0;this[_0xa8b7('0x0')]=_0x331cbd['active']||![];this[_0xa8b7('0x1')]=_0x331cbd['name']||'';this['state']='unknown';this[_0xa8b7('0x2')]=0x0;this[_0xa8b7('0x3')]='unknown';this[_0xa8b7('0x4')]=_0x331cbd[_0xa8b7('0x4')]&&_0x331cbd[_0xa8b7('0x4')][_0xa8b7('0x5')](':')?_0x331cbd[_0xa8b7('0x4')][_0xa8b7('0x6')](':')[0x0]:'';this[_0xa8b7('0x7')]='';this[_0xa8b7('0x8')]='';this['domain']='';this[_0xa8b7('0x9')]='';this[_0xa8b7('0xa')]='';this[_0xa8b7('0xb')]=_0xa8b7('0xc');this['registrationtime']='';this['address']='';}module[_0xa8b7('0xd')]=Trunk; \ No newline at end of file +var _0x46d1=['split','host','domain','refresh','stateRegistry','registrationtime','address','exports','active','name','state','unknown','status','registry'];(function(_0x1c85d5,_0x1e6c4e){var _0x33f0a7=function(_0x23e047){while(--_0x23e047){_0x1c85d5['push'](_0x1c85d5['shift']());}};_0x33f0a7(++_0x1e6c4e);}(_0x46d1,0xbe));var _0x146d=function(_0x3cba8d,_0x464c17){_0x3cba8d=_0x3cba8d-0x0;var _0x2a6110=_0x46d1[_0x3cba8d];return _0x2a6110;};'use strict';function Trunk(_0x38302c){this['id']=_0x38302c['id']||0x0;this[_0x146d('0x0')]=_0x38302c[_0x146d('0x0')]||![];this[_0x146d('0x1')]=_0x38302c[_0x146d('0x1')]||'';this[_0x146d('0x2')]=_0x146d('0x3');this['stateTime']=0x0;this[_0x146d('0x4')]=_0x146d('0x3');this[_0x146d('0x5')]=_0x38302c['registry']&&_0x38302c[_0x146d('0x5')]['indexOf'](':')?_0x38302c[_0x146d('0x5')][_0x146d('0x6')](':')[0x0]:'';this[_0x146d('0x7')]='';this['port']='';this[_0x146d('0x8')]='';this['domainport']='';this[_0x146d('0x9')]='';this[_0x146d('0xa')]=_0x146d('0x3');this[_0x146d('0xb')]='';this[_0x146d('0xc')]='';}module[_0x146d('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9daf012..9124587 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 _0xed66=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x570716,_0x23569e){var _0x1b3125=function(_0x196f84){while(--_0x196f84){_0x570716['push'](_0x570716['shift']());}};_0x1b3125(++_0x23569e);}(_0xed66,0x184));var _0x6ed6=function(_0x4bd950,_0x184ed5){_0x4bd950=_0x4bd950-0x0;var _0x5dc59a=_0xed66[_0x4bd950];return _0x5dc59a;};'use strict';function voiceExtension(_0x22fbf4){this['id']=_0x22fbf4['id']||0x0;this[_0x6ed6('0x0')]=_0x22fbf4[_0x6ed6('0x0')]||'';this[_0x6ed6('0x1')]=_0x22fbf4[_0x6ed6('0x1')]||'none';this['mandatoryDisposition']=_0x22fbf4[_0x6ed6('0x2')]||![];}module[_0x6ed6('0x3')]=voiceExtension; \ No newline at end of file +var _0x6c9a=['exten','none','mandatoryDisposition','exports'];(function(_0x118aa,_0x36110f){var _0x133bd6=function(_0x4e16a0){while(--_0x4e16a0){_0x118aa['push'](_0x118aa['shift']());}};_0x133bd6(++_0x36110f);}(_0x6c9a,0x108));var _0xa6c9=function(_0x864cc8,_0x8d492){_0x864cc8=_0x864cc8-0x0;var _0x5983c3=_0x6c9a[_0x864cc8];return _0x5983c3;};'use strict';function voiceExtension(_0xba772f){this['id']=_0xba772f['id']||0x0;this[_0xa6c9('0x0')]=_0xba772f[_0xa6c9('0x0')]||'';this['recordingFormat']=_0xba772f['recordingFormat']||_0xa6c9('0x1');this[_0xa6c9('0x2')]=_0xba772f[_0xa6c9('0x2')]||![];}module[_0xa6c9('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 801def5..4f0fd95 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 _0x7d75=['dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','wav','wav49','gsm','roundrobin','name','monitor_format','type','talking','total','sumHoldTime','sumBillable','unmanaged','acw','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate'];(function(_0x2c3142,_0x109e26){var _0x132a81=function(_0x54077c){while(--_0x54077c){_0x2c3142['push'](_0x2c3142['shift']());}};_0x132a81(++_0x109e26);}(_0x7d75,0xe3));var _0x57d7=function(_0x104667,_0x242e41){_0x104667=_0x104667-0x0;var _0x55ba6=_0x7d75[_0x104667];return _0x55ba6;};'use strict';var statusDesc=[_0x57d7('0x0'),_0x57d7('0x1'),_0x57d7('0x2'),_0x57d7('0x3'),_0x57d7('0x4'),_0x57d7('0x5'),_0x57d7('0x6'),'ringinuse','onhold'];var monitorFormat={'wav':_0x57d7('0x7'),'wav49':_0x57d7('0x8'),'gsm':_0x57d7('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x57d7('0xa')};function VoiceQueue(_0x22455f){this['id']=_0x22455f['id']||0x0;this[_0x57d7('0xb')]=_0x22455f[_0x57d7('0xb')]||'';this['monitor_format']=_0x22455f[_0x57d7('0xc')]||'';this[_0x57d7('0xd')]=_0x22455f[_0x57d7('0xd')]||'inbound';this['waiting']=0x0;this[_0x57d7('0xe')]=0x0;this[_0x57d7('0xf')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x57d7('0x10')]=0x0;this[_0x57d7('0x11')]=0x0;this[_0x57d7('0x12')]=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this['available']=0x0;this[_0x57d7('0x13')]=_0x22455f[_0x57d7('0x13')]||![];this['acwTimeout']=_0x22455f['acwTimeout']||0xa;this['autopause']=_0x22455f[_0x57d7('0x14')]||'no';this[_0x57d7('0x15')]=!![];this[_0x57d7('0x16')]='';this[_0x57d7('0x17')]=0x0;this['temp']=0x0;this[_0x57d7('0x18')]=_0x22455f[_0x57d7('0x18')]||null;this['dialGlobalInterval']=_0x22455f[_0x57d7('0x19')]?_0x22455f[_0x57d7('0x19')]:null;this[_0x57d7('0x1a')]=_0x22455f[_0x57d7('0x1a')];this[_0x57d7('0x1b')]=_0x22455f[_0x57d7('0x1b')]||_0x57d7('0x1c');this[_0x57d7('0x1d')]=_0x22455f['dialLimitChannel']||0x0;this[_0x57d7('0x1e')]=_0x22455f['dialLimitQueue']||0x0;this[_0x57d7('0x1f')]=_0x22455f[_0x57d7('0x1f')]||0x1;this[_0x57d7('0x20')]=_0x22455f[_0x57d7('0x20')]||'dropRate';this[_0x57d7('0x21')]=_0x22455f[_0x57d7('0x21')]||0.03;this[_0x57d7('0x22')]=_0x22455f[_0x57d7('0x22')]||0x258;this[_0x57d7('0x23')]=_0x22455f[_0x57d7('0x23')]||_0x57d7('0x24');this[_0x57d7('0x25')]=_0x22455f[_0x57d7('0x25')]||'anonymous';this['dialOriginateTimeout']=_0x22455f[_0x57d7('0x26')]||0x1e;this[_0x57d7('0x27')]=_0x22455f[_0x57d7('0x27')]||_0x57d7('0x28');this[_0x57d7('0x29')]=_0x22455f['dialQueueTimeout']||0x3;this[_0x57d7('0x2a')]=_0x22455f[_0x57d7('0x2a')]||undefined;this[_0x57d7('0x2b')]=_0x22455f[_0x57d7('0x2b')]||0x3;this['dialCongestionRetryFrequency']=_0x22455f[_0x57d7('0x2c')]||0x96;this[_0x57d7('0x2d')]=_0x22455f[_0x57d7('0x2d')]||0x3;this[_0x57d7('0x2e')]=_0x22455f[_0x57d7('0x2e')]||0x96;this[_0x57d7('0x2f')]=_0x22455f[_0x57d7('0x2f')]||0x3;this['dialNoAnswerRetryFrequency']=_0x22455f['dialNoAnswerRetryFrequency']||0x96;this[_0x57d7('0x30')]=_0x22455f['dialNoSuchNumberMaxRetry']||0x3;this[_0x57d7('0x31')]=_0x22455f[_0x57d7('0x31')]||0x96;this[_0x57d7('0x32')]=_0x22455f[_0x57d7('0x32')]||0x3;this[_0x57d7('0x33')]=_0x22455f['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x22455f[_0x57d7('0x34')]||0x3;this[_0x57d7('0x35')]=_0x22455f[_0x57d7('0x35')]||0x96;this[_0x57d7('0x36')]=_0x22455f['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x22455f[_0x57d7('0x37')]||0x96;this[_0x57d7('0x38')]=_0x22455f['dialAgentRejectMaxRetry']||0x3;this[_0x57d7('0x39')]=_0x22455f[_0x57d7('0x39')]||0x96;this[_0x57d7('0x3a')]=_0x22455f[_0x57d7('0x3a')]||0x4;this[_0x57d7('0x3b')]=_0x22455f[_0x57d7('0x3b')]?_0x22455f['Trunk']:undefined;this['TrunkBackup']=_0x22455f[_0x57d7('0x3c')]?_0x22455f[_0x57d7('0x3c')]:undefined;this[_0x57d7('0x3d')]=_0x22455f['dialPrefix']||undefined;this['Interval']=_0x22455f['Interval']?_0x22455f['Interval']:undefined;this[_0x57d7('0x3e')]=_0x22455f['dialOrderByScheduledAt']||'DESC';this[_0x57d7('0x3f')]=_0x22455f[_0x57d7('0x3f')]||undefined;this['dialCutDigit']=_0x22455f[_0x57d7('0x40')]||undefined;this[_0x57d7('0x41')]=strategy[_0x22455f['strategy']]||_0x57d7('0x42');this[_0x57d7('0x43')]=!![];this[_0x57d7('0x44')]=_0x22455f[_0x57d7('0x44')]||![];this['dialAMDInitialSilence']=_0x22455f['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x22455f[_0x57d7('0x45')];this[_0x57d7('0x46')]=_0x22455f[_0x57d7('0x46')];this[_0x57d7('0x47')]=_0x22455f['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x22455f[_0x57d7('0x48')];this[_0x57d7('0x49')]=_0x22455f[_0x57d7('0x49')];this[_0x57d7('0x4a')]=_0x22455f[_0x57d7('0x4a')];this[_0x57d7('0x4b')]=_0x22455f[_0x57d7('0x4b')];this['dialAMDMaximumWordLength']=_0x22455f['dialAMDMaximumWordLength'];this[_0x57d7('0x4c')]=0x0;this[_0x57d7('0x4d')]=0x0;this['timeout']=_0x22455f[_0x57d7('0x4e')];this[_0x57d7('0x4f')]=0x0;this[_0x57d7('0x50')]=0x0;this[_0x57d7('0x51')]=0x0;this[_0x57d7('0x52')]=0x0;this[_0x57d7('0x53')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x57d7('0x54')]=0x0;this[_0x57d7('0x55')]=0x0;this[_0x57d7('0x56')]=0x0;this[_0x57d7('0x57')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0x57d7('0x58')]=undefined;this[_0x57d7('0x59')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x57d7('0x5a')]=0x0;this[_0x57d7('0x5b')]=0x0;this[_0x57d7('0x5c')]=0x0;this[_0x57d7('0x5d')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x57d7('0x5e')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x57d7('0x5f')]=0x0;this[_0x57d7('0x60')]=_0x22455f[_0x57d7('0x61')]||0x14;this[_0x57d7('0x62')]=_0x22455f[_0x57d7('0x61')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x57d7('0x63')]=0x0;this[_0x57d7('0x64')]=0x1;this['erlangCalls']=0x0;this[_0x57d7('0x65')]=0x0;this[_0x57d7('0x66')]=0x0;this['erlangBusyFactor']=0x0;this[_0x57d7('0x67')]=_0x22455f[_0x57d7('0x67')]||0x1e;this['dialRecallInQueue']=_0x22455f[_0x57d7('0x68')]||![];this[_0x57d7('0x69')]=_0x22455f['dialQueueProject2']||undefined;this[_0x57d7('0x6a')]=_0x22455f[_0x57d7('0x6a')]||![];this[_0x57d7('0x6b')]=_0x22455f['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x22455f[_0x57d7('0xc')]]?monitorFormat[_0x22455f[_0x57d7('0xc')]]:undefined;this[_0x57d7('0x6c')]=_0x22455f['mandatoryDisposition']||![];this[_0x57d7('0x6d')]=_0x22455f[_0x57d7('0x6d')]?_0x22455f[_0x57d7('0x6d')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xd8fc=['dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','inuse','busy','unavailable','ringing','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','total','answered','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','message','originated','temp'];(function(_0x1fa635,_0xbede8b){var _0x4779de=function(_0x1df7d1){while(--_0x1df7d1){_0x1fa635['push'](_0x1fa635['shift']());}};_0x4779de(++_0xbede8b);}(_0xd8fc,0x14b));var _0xcd8f=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0xd8fc[_0x2e3545];return _0xcf18f;};'use strict';var statusDesc=[_0xcd8f('0x0'),'not_inuse',_0xcd8f('0x1'),_0xcd8f('0x2'),'invalid',_0xcd8f('0x3'),_0xcd8f('0x4'),'ringinuse','onhold'];var monitorFormat={'wav':_0xcd8f('0x5'),'wav49':_0xcd8f('0x6'),'gsm':_0xcd8f('0x7')};var strategy={'rrmemory':_0xcd8f('0x8'),'roundrobin':'roundrobin'};function VoiceQueue(_0x40def7){this['id']=_0x40def7['id']||0x0;this[_0xcd8f('0x9')]=_0x40def7[_0xcd8f('0x9')]||'';this[_0xcd8f('0xa')]=_0x40def7[_0xcd8f('0xa')]||'';this['type']=_0x40def7[_0xcd8f('0xb')]||_0xcd8f('0xc');this['waiting']=0x0;this['talking']=0x0;this[_0xcd8f('0xd')]=0x0;this[_0xcd8f('0xe')]=0x0;this['sumDuration']=0x0;this[_0xcd8f('0xf')]=0x0;this[_0xcd8f('0x10')]=0x0;this[_0xcd8f('0x11')]=0x0;this['abandoned']=0x0;this[_0xcd8f('0x12')]=0x0;this[_0xcd8f('0x13')]=0x0;this[_0xcd8f('0x14')]=_0x40def7['acw']||![];this['acwTimeout']=_0x40def7[_0xcd8f('0x15')]||0xa;this[_0xcd8f('0x16')]=_0x40def7[_0xcd8f('0x16')]||'no';this['sendMessageOneNotActive']=!![];this[_0xcd8f('0x17')]='';this[_0xcd8f('0x18')]=0x0;this[_0xcd8f('0x19')]=0x0;this['dialTimezone']=_0x40def7[_0xcd8f('0x1a')]||null;this['dialGlobalInterval']=_0x40def7[_0xcd8f('0x1b')]?_0x40def7[_0xcd8f('0x1b')]:null;this[_0xcd8f('0x1c')]=_0x40def7['dialActive'];this['dialMethod']=_0x40def7['dialMethod']||_0xcd8f('0x1d');this['dialLimitChannel']=_0x40def7[_0xcd8f('0x1e')]||0x0;this[_0xcd8f('0x1f')]=_0x40def7[_0xcd8f('0x1f')]||0x0;this['dialPowerLevel']=_0x40def7[_0xcd8f('0x20')]||0x1;this['dialPredictiveOptimization']=_0x40def7[_0xcd8f('0x21')]||_0xcd8f('0x22');this['dialPredictiveOptimizationPercentage']=_0x40def7[_0xcd8f('0x23')]||0.03;this[_0xcd8f('0x24')]=_0x40def7[_0xcd8f('0x24')]||0x258;this[_0xcd8f('0x25')]=_0x40def7[_0xcd8f('0x25')]||_0xcd8f('0x26');this[_0xcd8f('0x27')]=_0x40def7[_0xcd8f('0x27')]||_0xcd8f('0x26');this[_0xcd8f('0x28')]=_0x40def7[_0xcd8f('0x28')]||0x1e;this['dialQueueOptions']=_0x40def7['dialQueueOptions']||_0xcd8f('0x29');this['dialQueueTimeout']=_0x40def7[_0xcd8f('0x2a')]||0x3;this[_0xcd8f('0x2b')]=_0x40def7[_0xcd8f('0x2b')]||undefined;this[_0xcd8f('0x2c')]=_0x40def7[_0xcd8f('0x2c')]||0x3;this[_0xcd8f('0x2d')]=_0x40def7[_0xcd8f('0x2d')]||0x96;this[_0xcd8f('0x2e')]=_0x40def7[_0xcd8f('0x2e')]||0x3;this['dialBusyRetryFrequency']=_0x40def7[_0xcd8f('0x2f')]||0x96;this[_0xcd8f('0x30')]=_0x40def7[_0xcd8f('0x30')]||0x3;this[_0xcd8f('0x31')]=_0x40def7['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x40def7[_0xcd8f('0x32')]||0x3;this[_0xcd8f('0x33')]=_0x40def7[_0xcd8f('0x33')]||0x96;this[_0xcd8f('0x34')]=_0x40def7[_0xcd8f('0x34')]||0x3;this['dialDropRetryFrequency']=_0x40def7['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x40def7['dialAbandonedMaxRetry']||0x3;this[_0xcd8f('0x35')]=_0x40def7[_0xcd8f('0x35')]||0x96;this[_0xcd8f('0x36')]=_0x40def7['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x40def7[_0xcd8f('0x37')]||0x96;this['dialAgentRejectMaxRetry']=_0x40def7[_0xcd8f('0x38')]||0x3;this[_0xcd8f('0x39')]=_0x40def7[_0xcd8f('0x39')]||0x96;this['dialGlobalMaxRetry']=_0x40def7[_0xcd8f('0x3a')]||0x4;this[_0xcd8f('0x3b')]=_0x40def7[_0xcd8f('0x3b')]?_0x40def7[_0xcd8f('0x3b')]:undefined;this[_0xcd8f('0x3c')]=_0x40def7[_0xcd8f('0x3c')]?_0x40def7[_0xcd8f('0x3c')]:undefined;this['dialPrefix']=_0x40def7[_0xcd8f('0x3d')]||undefined;this[_0xcd8f('0x3e')]=_0x40def7[_0xcd8f('0x3e')]?_0x40def7[_0xcd8f('0x3e')]:undefined;this[_0xcd8f('0x3f')]=_0x40def7[_0xcd8f('0x3f')]||'DESC';this[_0xcd8f('0x40')]=_0x40def7[_0xcd8f('0x40')]||undefined;this[_0xcd8f('0x41')]=_0x40def7[_0xcd8f('0x41')]||undefined;this[_0xcd8f('0x42')]=strategy[_0x40def7[_0xcd8f('0x42')]]||_0xcd8f('0x8');this['queueStatusComplete']=!![];this[_0xcd8f('0x43')]=_0x40def7[_0xcd8f('0x43')]||![];this['dialAMDInitialSilence']=_0x40def7[_0xcd8f('0x44')];this[_0xcd8f('0x45')]=_0x40def7[_0xcd8f('0x45')];this[_0xcd8f('0x46')]=_0x40def7[_0xcd8f('0x46')];this['dialAMDTotalAnalysisTime']=_0x40def7[_0xcd8f('0x47')];this[_0xcd8f('0x48')]=_0x40def7['dialAMDMinWordLength'];this[_0xcd8f('0x49')]=_0x40def7[_0xcd8f('0x49')];this[_0xcd8f('0x4a')]=_0x40def7[_0xcd8f('0x4a')];this[_0xcd8f('0x4b')]=_0x40def7[_0xcd8f('0x4b')];this[_0xcd8f('0x4c')]=_0x40def7[_0xcd8f('0x4c')];this[_0xcd8f('0x4d')]=0x0;this[_0xcd8f('0x4e')]=0x0;this['timeout']=_0x40def7[_0xcd8f('0x4f')];this['outboundAnswerCallsDay']=0x0;this[_0xcd8f('0x50')]=0x0;this[_0xcd8f('0x51')]=0x0;this[_0xcd8f('0x52')]=0x0;this[_0xcd8f('0x53')]=0x0;this[_0xcd8f('0x54')]=0x0;this[_0xcd8f('0x55')]=0x0;this[_0xcd8f('0x56')]=0x0;this[_0xcd8f('0x57')]=0x0;this[_0xcd8f('0x58')]=0x0;this[_0xcd8f('0x59')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xcd8f('0x5a')]=0x0;this[_0xcd8f('0x5b')]=0x0;this[_0xcd8f('0x5c')]=undefined;this[_0xcd8f('0x5d')]=undefined;this[_0xcd8f('0x5e')]=undefined;this[_0xcd8f('0x5f')]=1.05;this[_0xcd8f('0x60')]=0x0;this[_0xcd8f('0x61')]=0x0;this[_0xcd8f('0x62')]=0x0;this[_0xcd8f('0x63')]=0x0;this[_0xcd8f('0x64')]=0x0;this[_0xcd8f('0x65')]=0x0;this[_0xcd8f('0x66')]=0x0;this[_0xcd8f('0x67')]=0x0;this[_0xcd8f('0x68')]=_0x40def7[_0xcd8f('0x69')]||0x14;this[_0xcd8f('0x6a')]=_0x40def7[_0xcd8f('0x69')]||0xa;this[_0xcd8f('0x6b')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xcd8f('0x6c')]=0x1;this['erlangCalls']=0x0;this[_0xcd8f('0x6d')]=0x0;this[_0xcd8f('0x6e')]=0x0;this[_0xcd8f('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x40def7[_0xcd8f('0x70')]||0x1e;this[_0xcd8f('0x71')]=_0x40def7['dialRecallInQueue']||![];this[_0xcd8f('0x72')]=_0x40def7[_0xcd8f('0x72')]||undefined;this[_0xcd8f('0x73')]=_0x40def7['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x40def7[_0xcd8f('0x74')]||![];this['monitor_format']=monitorFormat[_0x40def7['monitor_format']]?monitorFormat[_0x40def7[_0xcd8f('0xa')]]:undefined;this['mandatoryDisposition']=_0x40def7['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x40def7[_0xcd8f('0x75')]?_0x40def7[_0xcd8f('0x75')]:undefined;}module[_0xcd8f('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 91642a3..51010fe 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 _0x8663=['accessKey','serverUrl','Configurations','name','username'];(function(_0x5104c9,_0x5d03c6){var _0x23e9e9=function(_0x5a7cd2){while(--_0x5a7cd2){_0x5104c9['push'](_0x5104c9['shift']());}};_0x23e9e9(++_0x5d03c6);}(_0x8663,0x1b1));var _0x3866=function(_0x1d849e,_0x30bfb9){_0x1d849e=_0x1d849e-0x0;var _0x491ee0=_0x8663[_0x1d849e];return _0x491ee0;};'use strict';function VtigerAccount(_0xecec59){this['id']=_0xecec59['id']||0x0;this[_0x3866('0x0')]=_0xecec59['name']||'';this[_0x3866('0x1')]=_0xecec59[_0x3866('0x1')]||'';this[_0x3866('0x2')]=_0xecec59[_0x3866('0x2')]||'';this['remoteUri']=_0xecec59['remoteUri']||'';this[_0x3866('0x3')]=_0xecec59['serverUrl']||'';this[_0x3866('0x4')]=_0xecec59['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x0f6f=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x0f6f,0xd0));var _0xf0f6=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x0f6f[_0x582274];return _0x8f14d3;};'use strict';function VtigerAccount(_0x2312e4){this['id']=_0x2312e4['id']||0x0;this[_0xf0f6('0x0')]=_0x2312e4['name']||'';this['username']=_0x2312e4[_0xf0f6('0x1')]||'';this[_0xf0f6('0x2')]=_0x2312e4[_0xf0f6('0x2')]||'';this['remoteUri']=_0x2312e4[_0xf0f6('0x3')]||'';this[_0xf0f6('0x4')]=_0x2312e4[_0xf0f6('0x4')]||'';this[_0xf0f6('0x5')]=_0x2312e4[_0xf0f6('0x5')]||{};}module[_0xf0f6('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 254bb60..5b15ded 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x15d4db,_0x289184){var _0x10147e=function(_0xed73c0){while(--_0xed73c0){_0x15d4db['push'](_0x15d4db['shift']());}};_0x10147e(++_0x289184);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1d3892,_0x47d5fe){_0x1d3892=_0x1d3892-0x0;var _0x574ff2=_0x0b0e[_0x1d3892];return _0x574ff2;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('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 62a52e7..9785890 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 _0x5a1c=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x71892,_0xf1b533){var _0x13a120=function(_0x1cf3f5){while(--_0x1cf3f5){_0x71892['push'](_0x71892['shift']());}};_0x13a120(++_0xf1b533);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x1681aa,_0x56d5ed){_0x1681aa=_0x1681aa-0x0;var _0x1ec3b8=_0x5a1c[_0x1681aa];return _0x1ec3b8;};'use strict';function ZohoAccount(_0x44ce43){this['id']=_0x44ce43['id']||0x0;this[_0xc5a1('0x0')]=_0x44ce43['name']||'';this['description']=_0x44ce43[_0xc5a1('0x1')]||'';this['host']=_0x44ce43[_0xc5a1('0x2')]||'';this[_0xc5a1('0x3')]=_0x44ce43[_0xc5a1('0x3')]||'';this[_0xc5a1('0x4')]=_0x44ce43['clientId']||'';this[_0xc5a1('0x5')]=_0x44ce43[_0xc5a1('0x5')]||'';this[_0xc5a1('0x6')]=_0x44ce43['serverUrl']||'';this[_0xc5a1('0x7')]=_0x44ce43[_0xc5a1('0x7')]||'';this[_0xc5a1('0x8')]=_0x44ce43[_0xc5a1('0x8')]||'';this[_0xc5a1('0x9')]=_0x44ce43[_0xc5a1('0x9')]||{};}module[_0xc5a1('0xa')]=ZohoAccount; \ No newline at end of file +var _0x2d93=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x2d93,0xf3));var _0x32d9=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x2d93[_0x34843e];return _0x598f7f;};'use strict';function ZohoAccount(_0x16d017){this['id']=_0x16d017['id']||0x0;this[_0x32d9('0x0')]=_0x16d017[_0x32d9('0x0')]||'';this[_0x32d9('0x1')]=_0x16d017[_0x32d9('0x1')]||'';this[_0x32d9('0x2')]=_0x16d017[_0x32d9('0x2')]||'';this[_0x32d9('0x3')]=_0x16d017[_0x32d9('0x3')]||'';this[_0x32d9('0x4')]=_0x16d017[_0x32d9('0x4')]||'';this[_0x32d9('0x5')]=_0x16d017[_0x32d9('0x5')]||'';this[_0x32d9('0x6')]=_0x16d017['serverUrl']||'';this[_0x32d9('0x7')]=_0x16d017[_0x32d9('0x7')]||'';this[_0x32d9('0x8')]=_0x16d017[_0x32d9('0x8')]||'';this[_0x32d9('0x9')]=_0x16d017['Configurations']||{};}module[_0x32d9('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 1da6da4..142e033 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 _0xe4b5=['VoiceQueueId','originatecalleridnum','\x22%s\x22\x20<%s>','exports','lodash','moment','isNil','string','queue','type','campaigntype','membername','Agent','name','channelAgent','format','SIP/%s','Contact','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ListId'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xe4b5,0x13f));var _0x5e4b=function(_0x54871a,_0x11ccee){_0x54871a=_0x54871a-0x0;var _0x29d2bb=_0xe4b5[_0x54871a];return _0x29d2bb;};'use strict';var util=require('util');var _=require(_0x5e4b('0x0'));var moment=require(_0x5e4b('0x1'));function checkNameSurname(_0x450846,_0x1722be,_0x46b0d0){var _0x1d97f9='';if(!_[_0x5e4b('0x2')](_0x1722be)&&_0x5e4b('0x3')===typeof _0x1722be){_0x1d97f9+=_0x1722be;}if(!_[_0x5e4b('0x2')](_0x46b0d0)&&_0x5e4b('0x3')===typeof _0x46b0d0){_0x1d97f9+='\x20'+_0x46b0d0;}if(_0x1d97f9!==''){return _0x1d97f9;}return _0x450846;}function Action(_0x193957,_0x3f91d3,_0x3eb13c,_0x353079,_0x37b96b){this['uniqueid']=_0x3eb13c||undefined;this['idContact']=_0x193957['id'];this[_0x5e4b('0x4')]=_0x3f91d3['name'];this[_0x5e4b('0x5')]=_0x3f91d3[_0x5e4b('0x5')];this[_0x5e4b('0x6')]=_0x5e4b('0x4');this['dialAnswer']=![];this[_0x5e4b('0x7')]=_[_0x5e4b('0x2')](_0x193957[_0x5e4b('0x8')])?undefined:_0x193957['Agent'][_0x5e4b('0x9')];this[_0x5e4b('0xa')]=this['membername']?util[_0x5e4b('0xb')](_0x5e4b('0xc'),this[_0x5e4b('0x7')]):_0x353079||undefined;this['calleridname']=checkNameSurname(_0x193957['Contact']['phone'],_0x193957[_0x5e4b('0xd')][_0x5e4b('0xe')],_0x193957[_0x5e4b('0xd')][_0x5e4b('0xf')]);this[_0x5e4b('0x10')]=_0x193957[_0x5e4b('0x10')]||![];this['calleridnum']=_0x193957['Contact']['phone'];this[_0x5e4b('0x11')]=_0x193957[_0x5e4b('0x11')];this[_0x5e4b('0x12')]=_0x193957[_0x5e4b('0x12')]||0x0;this[_0x5e4b('0x13')]=_0x193957[_0x5e4b('0x13')]||0x0;this[_0x5e4b('0x14')]=_0x193957[_0x5e4b('0x14')]||0x0;this['countglobal']=(_0x193957['countbusyretry']||0x0)+(_0x193957[_0x5e4b('0x13')]||0x0)+(_0x193957[_0x5e4b('0x14')]||0x0)+(_0x193957[_0x5e4b('0x15')]||0x0)+(_0x193957['countdropretry']||0x0)+(_0x193957[_0x5e4b('0x16')]||0x0)+(_0x193957[_0x5e4b('0x17')]||0x0)+(_0x193957[_0x5e4b('0x18')]||0x0);this[_0x5e4b('0x15')]=_0x193957[_0x5e4b('0x15')]||0x0;this[_0x5e4b('0x19')]=_0x193957[_0x5e4b('0x19')]||0x0;this['countabandonedretry']=_0x193957[_0x5e4b('0x16')]||0x0;this[_0x5e4b('0x17')]=_0x193957[_0x5e4b('0x17')]||0x0;this[_0x5e4b('0x18')]=_0x193957[_0x5e4b('0x18')]||0x0;this[_0x5e4b('0x1a')]=_0x193957[_0x5e4b('0x1a')];this[_0x5e4b('0x1b')]=_0x193957['callbackuniqueid'];this['callbackat']=_0x193957[_0x5e4b('0x1c')];this[_0x5e4b('0x1d')]=_0x193957['recallme'];this['ContactId']=_0x193957['ContactId'];this[_0x5e4b('0x1e')]=_0x193957['ListId'];this['UserId']=_[_0x5e4b('0x2')](_0x193957[_0x5e4b('0x8')])?_0x193957['UserId']:_0x193957[_0x5e4b('0x8')]['id'];this[_0x5e4b('0x1f')]=_0x193957[_0x5e4b('0x1f')];this[_0x5e4b('0x20')]='';this['originatecalleridname']='';}Action['prototype']['getCaller']=function(){return util[_0x5e4b('0xb')](_0x5e4b('0x21'),this['calleridname'],this['number']);};module[_0x5e4b('0x22')]=Action; \ No newline at end of file +var _0x8b4c=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','calleridnum','scheduledat','countbusyretry'];(function(_0x323c60,_0x219b72){var _0x103f23=function(_0x7695b3){while(--_0x7695b3){_0x323c60['push'](_0x323c60['shift']());}};_0x103f23(++_0x219b72);}(_0x8b4c,0xc9));var _0xc8b4=function(_0x4c93cd,_0x40a89a){_0x4c93cd=_0x4c93cd-0x0;var _0x56e308=_0x8b4c[_0x4c93cd];return _0x56e308;};'use strict';var util=require(_0xc8b4('0x0'));var _=require(_0xc8b4('0x1'));var moment=require(_0xc8b4('0x2'));function checkNameSurname(_0x591416,_0x3117ec,_0x3086d7){var _0x3727be='';if(!_['isNil'](_0x3117ec)&&'string'===typeof _0x3117ec){_0x3727be+=_0x3117ec;}if(!_[_0xc8b4('0x3')](_0x3086d7)&&_0xc8b4('0x4')===typeof _0x3086d7){_0x3727be+='\x20'+_0x3086d7;}if(_0x3727be!==''){return _0x3727be;}return _0x591416;}function Action(_0x1f6759,_0x1bc2b9,_0x383bd3,_0x10668d,_0x134ace){this[_0xc8b4('0x5')]=_0x383bd3||undefined;this[_0xc8b4('0x6')]=_0x1f6759['id'];this[_0xc8b4('0x7')]=_0x1bc2b9[_0xc8b4('0x8')];this[_0xc8b4('0x9')]=_0x1bc2b9['type'];this[_0xc8b4('0xa')]=_0xc8b4('0x7');this[_0xc8b4('0xb')]=![];this['membername']=_[_0xc8b4('0x3')](_0x1f6759[_0xc8b4('0xc')])?undefined:_0x1f6759[_0xc8b4('0xc')][_0xc8b4('0x8')];this[_0xc8b4('0xd')]=this[_0xc8b4('0xe')]?util[_0xc8b4('0xf')](_0xc8b4('0x10'),this[_0xc8b4('0xe')]):_0x10668d||undefined;this[_0xc8b4('0x11')]=checkNameSurname(_0x1f6759[_0xc8b4('0x12')][_0xc8b4('0x13')],_0x1f6759[_0xc8b4('0x12')][_0xc8b4('0x14')],_0x1f6759[_0xc8b4('0x12')]['lastName']);this['active']=_0x1f6759['active']||![];this[_0xc8b4('0x15')]=_0x1f6759[_0xc8b4('0x12')][_0xc8b4('0x13')];this[_0xc8b4('0x16')]=_0x1f6759['scheduledat'];this[_0xc8b4('0x17')]=_0x1f6759[_0xc8b4('0x17')]||0x0;this[_0xc8b4('0x18')]=_0x1f6759['countcongestionretry']||0x0;this['countnoanswerretry']=_0x1f6759[_0xc8b4('0x19')]||0x0;this[_0xc8b4('0x1a')]=(_0x1f6759[_0xc8b4('0x17')]||0x0)+(_0x1f6759[_0xc8b4('0x18')]||0x0)+(_0x1f6759[_0xc8b4('0x19')]||0x0)+(_0x1f6759['countnosuchnumberretry']||0x0)+(_0x1f6759[_0xc8b4('0x1b')]||0x0)+(_0x1f6759['countabandonedretry']||0x0)+(_0x1f6759[_0xc8b4('0x1c')]||0x0)+(_0x1f6759[_0xc8b4('0x1d')]||0x0);this[_0xc8b4('0x1e')]=_0x1f6759[_0xc8b4('0x1e')]||0x0;this[_0xc8b4('0x1b')]=_0x1f6759[_0xc8b4('0x1b')]||0x0;this['countabandonedretry']=_0x1f6759['countabandonedretry']||0x0;this[_0xc8b4('0x1c')]=_0x1f6759[_0xc8b4('0x1c')]||0x0;this[_0xc8b4('0x1d')]=_0x1f6759['countagentrejectretry']||0x0;this[_0xc8b4('0x1f')]=_0x1f6759[_0xc8b4('0x1f')];this['callbackuniqueid']=_0x1f6759[_0xc8b4('0x20')];this[_0xc8b4('0x21')]=_0x1f6759['callbackat'];this[_0xc8b4('0x22')]=_0x1f6759['recallme'];this[_0xc8b4('0x23')]=_0x1f6759['ContactId'];this[_0xc8b4('0x24')]=_0x1f6759['ListId'];this[_0xc8b4('0x25')]=_['isNil'](_0x1f6759[_0xc8b4('0xc')])?_0x1f6759[_0xc8b4('0x25')]:_0x1f6759[_0xc8b4('0xc')]['id'];this[_0xc8b4('0x26')]=_0x1f6759[_0xc8b4('0x26')];this['originatecalleridnum']='';this[_0xc8b4('0x27')]='';}Action[_0xc8b4('0x28')][_0xc8b4('0x29')]=function(){return util[_0xc8b4('0xf')](_0xc8b4('0x2a'),this[_0xc8b4('0x11')],this[_0xc8b4('0x2b')]);};module[_0xc8b4('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 7ab3de4..d3f4ffe 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 _0x9f8b=['[syncHangupRequest][logAgentReject]','AgentReject','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','campaign\x20Name:\x20','\x20Not\x20Active','SIP/%s/%s%s','dialCutDigit','substring','trim','phone','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','toLowerVariables','starttime','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','channelstate','transfer','disableContact','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','syncHangupRequest','addVariable','variables','keys','variable','error','[syncVarSet][Preview]','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./action','redis','localhost','prototype','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','hanguprequest','dialend','syncNewExten','varset','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','loggedIn','pTalking','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','dialMethod','clearZombieChannels','hasOwnProperty','outbound','setMessage','recallMe','clearZombieChannel','enqueue','isNil','actions','Queue','queue','originated:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','sendMessageOneNotActive','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','Answer','[callProgressDetectingCustomer][logAnswer]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','pTalking:\x20','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','dialBusyMaxRetry','rescheduleContact','scheduledAt','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','custom:agentreject','agentreject'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x9f8b,0x77));var _0xb9f8=function(_0x33bad8,_0xa77a59){_0x33bad8=_0x33bad8-0x0;var _0xed1658=_0x9f8b[_0x33bad8];return _0xed1658;};'use strict';var util=require(_0xb9f8('0x0'));var _=require(_0xb9f8('0x1'));var BPromise=require(_0xb9f8('0x2'));var uuid=require(_0xb9f8('0x3'));var moment=require(_0xb9f8('0x4'));var md5=require(_0xb9f8('0x5'));var Redis=require(_0xb9f8('0x6'));var config=require(_0xb9f8('0x7'));var logger=require(_0xb9f8('0x8'))(_0xb9f8('0x9'));var loggerAction=require(_0xb9f8('0x8'))(_0xb9f8('0xa'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xb9f8('0xb'));var ut=require('./util/util');config[_0xb9f8('0xc')]=_['defaults'](config[_0xb9f8('0xc')],{'host':_0xb9f8('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xb9f8('0xe')]['enqueue']=function(_0x29402e){this[_0xb9f8('0xf')]=this[_0xb9f8('0xf')]?this[_0xb9f8('0xf')]['finally'](_0x29402e):_0x29402e();};function Preview(_0x125d99){this[_0xb9f8('0x10')]=new Sequence();this[_0xb9f8('0x11')]=_0x125d99[_0xb9f8('0x12')];this[_0xb9f8('0x13')]=_0x125d99[_0xb9f8('0x13')];this['actions']={};this[_0xb9f8('0x14')]=_0x125d99[_0xb9f8('0x14')];this[_0xb9f8('0x15')]=0x0;ami['on']('originateresponse',this[_0xb9f8('0x16')][_0xb9f8('0x17')](this));ami['on'](_0xb9f8('0x18'),this['syncHangup']['bind'](this));ami['on'](_0xb9f8('0x19'),this['syncHangupRequest']['bind'](this));ami['on'](_0xb9f8('0x1a'),this['syncDialEnd'][_0xb9f8('0x17')](this));ami['on']('newexten',this[_0xb9f8('0x1b')][_0xb9f8('0x17')](this));ami['on'](_0xb9f8('0x1c'),this['syncVarSet'][_0xb9f8('0x17')](this));ami['on'](_0xb9f8('0x1d'),this['syncAttendedTransfer'][_0xb9f8('0x17')](this));ami['on'](_0xb9f8('0x1e'),this[_0xb9f8('0x1f')][_0xb9f8('0x17')](this));this[_0xb9f8('0x20')](this[_0xb9f8('0x11')]);}function emit(_0x13730c,_0x4109d4,_0x94f5a7){io['to'](_0x13730c)[_0xb9f8('0x21')](_0x4109d4,_0x94f5a7);}function emitCampaignPreview(_0x1d31b4){if(_0x1d31b4[_0xb9f8('0x22')]==='outbound'){var _0x5117f7={'id':_0x1d31b4['id'],'name':_0x1d31b4[_0xb9f8('0x23')],'strategy':_0x1d31b4[_0xb9f8('0x24')],'answered':_0x1d31b4[_0xb9f8('0x25')],'available':_0x1d31b4[_0xb9f8('0x26')],'loggedIn':_0x1d31b4[_0xb9f8('0x27')],'pTalking':_0x1d31b4[_0xb9f8('0x28')],'sumBillable':_0x1d31b4['sumBillable'],'sumDuration':_0x1d31b4['sumDuration'],'sumHoldTime':_0x1d31b4[_0xb9f8('0x29')]||0x0,'talking':_0x1d31b4['talking'],'total':_0x1d31b4[_0xb9f8('0x2a')],'type':_0x1d31b4[_0xb9f8('0x22')],'unmanaged':_0x1d31b4[_0xb9f8('0x2b')],'abandoned':_0x1d31b4[_0xb9f8('0x2c')],'waiting':_0x1d31b4[_0xb9f8('0x2d')],'loggedInDb':_0x1d31b4[_0xb9f8('0x2e')],'dialActive':_0x1d31b4[_0xb9f8('0x2f')],'dialMethod':_0x1d31b4['dialMethod'],'dialOriginateCallerIdName':_0x1d31b4['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1d31b4['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x1d31b4['dialOriginateTimeout'],'dialPrefix':_0x1d31b4[_0xb9f8('0x30')],'outboundAnswerAgiCallsDay':_0x1d31b4[_0xb9f8('0x31')],'outboundAnswerCallsDay':_0x1d31b4[_0xb9f8('0x32')],'outboundBlacklistCallsDay':_0x1d31b4[_0xb9f8('0x33')],'outboundBusyCallsDay':_0x1d31b4['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1d31b4['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1d31b4[_0xb9f8('0x34')],'outboundDropCallsDayCallersExit':_0x1d31b4['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x1d31b4[_0xb9f8('0x35')],'outboundNoAnswerCallsDay':_0x1d31b4[_0xb9f8('0x36')],'outboundNoSuchCallsDay':_0x1d31b4[_0xb9f8('0x37')],'outboundOriginateFailureCallsDay':_0x1d31b4[_0xb9f8('0x38')],'outboundReCallsDay':_0x1d31b4[_0xb9f8('0x39')],'outboundRejectCallsDay':_0x1d31b4[_0xb9f8('0x3a')],'outboundUnknownCallsDay':_0x1d31b4[_0xb9f8('0x3b')],'outboundAbandonedCallsDay':_0x1d31b4[_0xb9f8('0x3c')],'predictiveIntervalAnsweredCalls':_0x1d31b4[_0xb9f8('0x3d')],'predictiveIntervalAvgHoldtime':_0x1d31b4[_0xb9f8('0x3e')],'predictiveIntervalAvgTalktime':_0x1d31b4[_0xb9f8('0x3f')],'predictiveIntervalDroppedCallsCallersExit':_0x1d31b4[_0xb9f8('0x40')],'predictiveIntervalDroppedCallsTimeout':_0x1d31b4[_0xb9f8('0x41')],'predictiveIntervalErlangCalls':_0x1d31b4[_0xb9f8('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x1d31b4[_0xb9f8('0x43')],'predictiveIntervalHitRate':_0x1d31b4['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x1d31b4[_0xb9f8('0x44')],'predictiveIntervalPauses':_0x1d31b4[_0xb9f8('0x45')],'predictiveIntervalAvailable':_0x1d31b4[_0xb9f8('0x46')],'predictiveIntervalTotalCalls':_0x1d31b4[_0xb9f8('0x47')],'message':_0x1d31b4[_0xb9f8('0x48')],'originated':_0x1d31b4[_0xb9f8('0x49')],'erlangCalls':_0x1d31b4[_0xb9f8('0x4a')],'erlangCallToSecond':_0x1d31b4['erlangCallToSecond'],'erlangAbandonmentRate':_0x1d31b4[_0xb9f8('0x4b')],'erlangBusyFactor':_0x1d31b4[_0xb9f8('0x4c')],'startPredictive':_0x1d31b4[_0xb9f8('0x4d')],'startProgressive':_0x1d31b4[_0xb9f8('0x4e')]};if(_0x1d31b4[_0xb9f8('0x4f')]){_0x5117f7[_0xb9f8('0x4f')]={'id':_0x1d31b4['Trunk']['id'],'name':_0x1d31b4['Trunk'][_0xb9f8('0x23')],'active':_0x1d31b4['Trunk'][_0xb9f8('0x50')],'callerid':_0x1d31b4[_0xb9f8('0x4f')]['callerid']};}if(_0x1d31b4[_0xb9f8('0x51')]){_0x5117f7[_0xb9f8('0x51')]={'id':_0x1d31b4[_0xb9f8('0x51')]['id'],'name':_0x1d31b4[_0xb9f8('0x51')][_0xb9f8('0x23')]};}var _0x5576d8=md5(JSON[_0xb9f8('0x52')](_0x5117f7));if(_0x1d31b4[_0xb9f8('0x5')]!==_0x5576d8){_0x1d31b4[_0xb9f8('0x5')]=_0x5576d8;emit(util['format'](_0xb9f8('0x53'),_0x5117f7[_0xb9f8('0x23')]),_0xb9f8('0x54'),_0x5117f7);}}}function emitVoiceQueueChannelRemove(_0x1cdb8c){logger[_0xb9f8('0x55')](_0xb9f8('0x56'),JSON['stringify'](_0x1cdb8c));emit(util[_0xb9f8('0x57')](_0xb9f8('0x53'),_0x1cdb8c['name']),_0xb9f8('0x58'),_0x1cdb8c);}function notSendMessagesQueue(_0x323887){if(_0x323887['sendMessageOneNotActive']){if(_0x323887[_0xb9f8('0x49')]===0x0&&_0x323887[_0xb9f8('0x28')]===0x0){_0x323887['sendMessageOneNotActive']=![];_0x323887[_0xb9f8('0x26')]=0x0;_0x323887['paused']=0x0;_0x323887[_0xb9f8('0x48')]=_0xb9f8('0x59');ut[_0xb9f8('0x5a')](_0xb9f8('0x5b'),_0x323887['name']+_0xb9f8('0x5c'));}else{_0x323887[_0xb9f8('0x48')]='IS_DISACTIVED';ut[_0xb9f8('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x323887[_0xb9f8('0x23')]+_0xb9f8('0x5d'));}emitCampaignPreview(_0x323887);}}Preview['prototype'][_0xb9f8('0x20')]=function(){var _0x4f9e05=this;setInterval(function(){_0x4f9e05[_0xb9f8('0x5e')]();},0x7cf);};Preview[_0xb9f8('0xe')][_0xb9f8('0x5e')]=function(){var _0x31969c=this['campaignsPreview'];this[_0xb9f8('0x15')]+=0x1;for(var _0x2f4878 in _0x31969c){if(_0x31969c['hasOwnProperty'](_0x2f4878)&&(_0x31969c[_0x2f4878][_0xb9f8('0x5f')]===_0xb9f8('0x9')||_0x31969c[_0x2f4878][_0xb9f8('0x5f')]==='booked')&&_0x31969c[_0x2f4878][_0xb9f8('0x22')]==='outbound'){if(this[_0xb9f8('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0xb9f8('0x60')]();}}if(_0x31969c[_0xb9f8('0x61')](_0x2f4878)&&_0x31969c[_0x2f4878][_0xb9f8('0x5f')]===_0xb9f8('0x9')&&_0x31969c[_0x2f4878]['type']===_0xb9f8('0x62')){if(_0x31969c[_0x2f4878]['dialActive']){this[_0xb9f8('0x63')](_0x31969c[_0x2f4878]);this[_0xb9f8('0x64')](_0x31969c[_0x2f4878]);}else{notSendMessagesQueue(_0x31969c[_0x2f4878]);}}}};Preview[_0xb9f8('0xe')][_0xb9f8('0x65')]=function(_0x1582c1){var _0x4a50d3=this;this[_0xb9f8('0x10')][_0xb9f8('0x66')](function(){if(!_[_0xb9f8('0x67')](_0x4a50d3[_0xb9f8('0x68')][_0x1582c1])){loggerAction['info']('[clearZombieChannels][talking]',_0x1582c1,_0xb9f8('0x69'),_0x4a50d3[_0xb9f8('0x68')][_0x1582c1][_0xb9f8('0x6a')],_0xb9f8('0x6b'),JSON[_0xb9f8('0x52')](_0x4a50d3[_0xb9f8('0x11')][_0x4a50d3[_0xb9f8('0x68')][_0x1582c1][_0xb9f8('0x6a')]][_0xb9f8('0x49')]),'pTalking:\x20',JSON['stringify'](_0x4a50d3['campaignsPreview'][_0x4a50d3[_0xb9f8('0x68')][_0x1582c1]['queue']]['pTalking']),JSON[_0xb9f8('0x52')](_0x4a50d3[_0xb9f8('0x68')][_0x1582c1][_0xb9f8('0x6c')]),JSON[_0xb9f8('0x52')](_[_0xb9f8('0x6d')](_0x4a50d3[_0xb9f8('0x68')][_0x1582c1],[_0xb9f8('0x6e'),_0xb9f8('0x6f'),_0xb9f8('0x70'),'ListId'])));return ami[_0xb9f8('0x71')]({'action':'status','channel':_0x4a50d3[_0xb9f8('0x68')][_0x1582c1][_0xb9f8('0x72')]})[_0xb9f8('0x73')](function(_0x1701f3){if(_0x1701f3[_0xb9f8('0x48')]===_0xb9f8('0x74')){setTimeout(function(){if(_0x4a50d3[_0xb9f8('0x68')][_0x1582c1]){ut['updateOriginated'](_0x4a50d3['campaignsPreview'][_0x4a50d3[_0xb9f8('0x68')][_0x1582c1][_0xb9f8('0x6a')]],_0xb9f8('0x75'));if(_0x4a50d3[_0xb9f8('0x68')][_0x1582c1][_0xb9f8('0x6c')]===!![]){ut[_0xb9f8('0x76')](_0x4a50d3['campaignsPreview'][_0x4a50d3[_0xb9f8('0x68')][_0x1582c1]['queue']],_0xb9f8('0x75'));ut[_0xb9f8('0x77')]('[Dialer][checkChannel][pTalking][Preview]'+_0x1582c1,_0x4a50d3['actions'][_0x1582c1]['queue']);}ut[_0xb9f8('0x77')](_0xb9f8('0x78')+_0x1582c1,_0x4a50d3[_0xb9f8('0x68')][_0x1582c1][_0xb9f8('0x6a')]);delete _0x4a50d3[_0xb9f8('0x68')][_0x1582c1];}},0x2328);}});}});};Preview[_0xb9f8('0xe')]['clearZombieChannels']=function(){var _0x164dc9=this;loggerAction[_0xb9f8('0x55')](_0xb9f8('0x79'),_[_0xb9f8('0x7a')](this[_0xb9f8('0x68')]));for(var _0x17ab68 in this[_0xb9f8('0x68')]){if(_0x164dc9[_0xb9f8('0x68')][_0xb9f8('0x61')](_0x17ab68)){_0x164dc9[_0xb9f8('0x65')](_0x17ab68);}}};Preview[_0xb9f8('0xe')][_0xb9f8('0x64')]=function(_0x541d13){var _0x2c203c=this;rpcDb[_0xb9f8('0x7b')](_0x541d13['id'],ut[_0xb9f8('0x7c')](this[_0xb9f8('0x14')]))[_0xb9f8('0x7d')](function(_0x187506){if(!_[_0xb9f8('0x67')](_0x187506)){for(var _0x5f19ea=0x0;_0x5f19ea<_0x187506['length'];_0x5f19ea+=0x1){if(ut[_0xb9f8('0x7e')](_0x187506[_0x5f19ea][_0xb9f8('0x7f')])<_0x541d13[_0xb9f8('0x80')]*0x3c){if(_0x187506[_0x5f19ea][_0xb9f8('0x81')]&&!_0x187506[_0x5f19ea]['Agent'][_0xb9f8('0x82')]){_0x2c203c['run'](_0x187506[_0x5f19ea]['id'])[_0xb9f8('0x7d')](ut[_0xb9f8('0x83')](_0xb9f8('0x84')))['catch'](ut[_0xb9f8('0x83')](_0xb9f8('0x84')));}else{rpcDb['disableContact'](_0x187506[_0x5f19ea]['id']);}}else{var _0x383076=new Action(_0x187506[_0x5f19ea],_0x541d13);_0x383076['starttime']=moment()[_0xb9f8('0x57')](_0xb9f8('0x85'));_0x541d13[_0xb9f8('0x39')]+=0x1;ut[_0xb9f8('0x86')](_0x383076,0x17,_0xb9f8('0x87'));if(_0x541d13[_0xb9f8('0x88')]){rpcDb[_0xb9f8('0x89')](ut['createBody'](_0x187506[_0x5f19ea]));rpcDb['createCustomerHistory'](_0x383076,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xb9f8('0x86')](_0x383076,0x16,_0xb9f8('0x8a'));rpcDb[_0xb9f8('0x8b')](_0x383076,_0xb9f8('0x8c'));rpcDb['createCustomerFinal'](_0x383076,'[HistoryRecallClose]');}}}}})[_0xb9f8('0x73')](ut['logger2']('[getContactRecallMe]'));};Preview[_0xb9f8('0xe')]['setMessage']=function(_0x2daf95){_0x2daf95[_0xb9f8('0x8d')]=!![];if(ut['IsNotLoggedIn'](_0x2daf95[_0xb9f8('0x27')])){_0x2daf95[_0xb9f8('0x48')]=_0xb9f8('0x8e');}else if(!ut[_0xb9f8('0x8f')](_0x2daf95['dialActive'])){_0x2daf95[_0xb9f8('0x48')]=_0xb9f8('0x59');}else if(!this[_0xb9f8('0x90')](_0x2daf95[_0xb9f8('0x4f')])){if(!this['isTrunkReachable'](_0x2daf95[_0xb9f8('0x91')])){_0x2daf95[_0xb9f8('0x48')]='TRUNK_IS_NOT_REACHABLE';}else{_0x2daf95['message']=_0xb9f8('0x92');}}else{_0x2daf95['message']=_0xb9f8('0x92');}emitCampaignPreview(_0x2daf95);};Preview[_0xb9f8('0xe')][_0xb9f8('0x93')]=function(_0x1353b7,_0x280563,_0x23dddd){var _0x5e79b3=this;var _0x5784f4=this[_0xb9f8('0x68')][_0x280563];var _0x39f1f5=this[_0xb9f8('0x11')][_0x5784f4[_0xb9f8('0x6a')]];var _0xf3417d;if(_0x39f1f5){switch(_0x23dddd){case'1':_0x39f1f5[_0xb9f8('0x37')]+=0x1;_0x5784f4[_0xb9f8('0x94')]+=0x1;_0x5784f4[_0xb9f8('0x95')]=ut[_0xb9f8('0x96')](_0x5784f4);ut[_0xb9f8('0x86')](_0x5784f4,0x0,_0xb9f8('0x97'));ami[_0xb9f8('0x21')](_0xb9f8('0x98'),ut[_0xb9f8('0x99')](_0x5784f4,'nosuchnumber'));rpcDb[_0xb9f8('0x8b')](_0x5784f4,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xb9f8('0x96')](_0x5784f4)>=_0x39f1f5['dialGlobalMaxRetry']){_0xf3417d=ut[_0xb9f8('0x9a')](_0x5784f4,0xf,'Global');rpcDb[_0xb9f8('0x9b')](_0xf3417d,_0xb9f8('0x9c'));}else{if(_0x5784f4['countnosuchnumberretry']>=_0x39f1f5[_0xb9f8('0x9d')]){rpcDb[_0xb9f8('0x9b')](_0x5784f4,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5784f4,_0xb9f8('0x94'),_0x39f1f5['dialNoSuchNumberRetryFrequency']),_0x5784f4['unlockAgent'],_0x5784f4[_0xb9f8('0x9e')]);}}delete this[_0xb9f8('0x68')][_0x1353b7[_0xb9f8('0x9f')]];break;case _0xb9f8('0xa0'):var _0x5389ca=moment()[_0xb9f8('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x5784f4[_0xb9f8('0xa1')]=_0x5389ca;_0x5784f4[_0xb9f8('0xa2')]=_0x5389ca;_0x5784f4['dialAnswer']=!![];_0x39f1f5[_0xb9f8('0x28')]+=0x1;logger[_0xb9f8('0x55')](_0xb9f8('0xa3'),_0x5784f4['uniqueid'],_0xb9f8('0xa4'),_0x39f1f5[_0xb9f8('0x23')],'pTalking:\x20',_0x39f1f5['pTalking']);ami['emit'](_0xb9f8('0xa5'),ut['buildObj'](_0x5784f4,_0xb9f8('0xa6')));if(_0x39f1f5[_0xb9f8('0xa7')]){ami[_0xb9f8('0x21')](_0xb9f8('0xa8'),ut[_0xb9f8('0xa9')](_0x5784f4));}break;case'16':ami[_0xb9f8('0x21')](_0xb9f8('0xaa'),ut['buildObj'](_0x5784f4,'complete'));emitVoiceQueueChannelRemove(ut['buildObj'](_0x5784f4,'complete'));_0x39f1f5[_0xb9f8('0x32')]+=0x1;_0x39f1f5[_0xb9f8('0x2a')]+=0x1;_0x39f1f5['answered']+=0x1;ut[_0xb9f8('0x76')](_0x39f1f5,'[16]');_0x5784f4[_0xb9f8('0x95')]=ut[_0xb9f8('0x96')](_0x5784f4);ut[_0xb9f8('0x86')](_0x5784f4,0x4,_0xb9f8('0xab'));rpcDb[_0xb9f8('0x8b')](_0x5784f4,_0xb9f8('0xac'));rpcDb[_0xb9f8('0x9b')](_0x5784f4,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x5784f4);_0x39f1f5[_0xb9f8('0xad')]+=_0x5784f4[_0xb9f8('0xae')];_0x39f1f5[_0xb9f8('0xaf')]+=_0x5784f4[_0xb9f8('0xae')];logger['info'](_0xb9f8('0xb0'),_0x5784f4[_0xb9f8('0xb1')],_0xb9f8('0xa4'),_0x39f1f5[_0xb9f8('0x23')],_0xb9f8('0xb2'),_0x39f1f5[_0xb9f8('0x28')]);delete this[_0xb9f8('0x68')][_0x1353b7[_0xb9f8('0x9f')]];break;case _0xb9f8('0xb3'):_0x39f1f5['outboundBusyCallsDay']+=0x1;_0x5784f4[_0xb9f8('0xb4')]+=0x1;_0x5784f4[_0xb9f8('0x95')]=ut[_0xb9f8('0x96')](_0x5784f4);ut[_0xb9f8('0x86')](_0x5784f4,0x5,_0xb9f8('0xb5'));ami['emit'](_0xb9f8('0xb6'),ut['buildObj'](_0x5784f4,_0xb9f8('0xb7')));rpcDb['createCustomerHistory'](_0x5784f4,_0xb9f8('0xb8'));if(ut['totalGlobal'](_0x5784f4)>=_0x39f1f5[_0xb9f8('0xb9')]){_0xf3417d=ut[_0xb9f8('0x9a')](_0x5784f4,0xf,_0xb9f8('0xba'));rpcDb[_0xb9f8('0x9b')](_0xf3417d,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x5784f4[_0xb9f8('0xb4')]>=_0x39f1f5[_0xb9f8('0xbb')]){rpcDb['createCustomerFinal'](_0x5784f4,_0xb9f8('0xb8'));}else{rpcDb[_0xb9f8('0xbc')](ut[_0xb9f8('0xbd')](_0x5784f4,'countbusyretry',_0x39f1f5['dialBusyRetryFrequency']),_0x5784f4[_0xb9f8('0xbe')],_0x5784f4['activeContact']);}}break;case _0xb9f8('0xbf'):_0x39f1f5[_0xb9f8('0x36')]+=0x1;_0x5784f4[_0xb9f8('0xc0')]+=0x1;_0x5784f4[_0xb9f8('0x95')]=ut[_0xb9f8('0x96')](_0x5784f4);ut[_0xb9f8('0x86')](_0x5784f4,0x3,_0xb9f8('0xc1'));ami[_0xb9f8('0x21')](_0xb9f8('0xc2'),ut[_0xb9f8('0x99')](_0x5784f4,_0xb9f8('0xc3')));rpcDb['createCustomerHistory'](_0x5784f4,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xb9f8('0x96')](_0x5784f4)>=_0x39f1f5[_0xb9f8('0xb9')]){_0xf3417d=ut['cloneAction'](_0x5784f4,0xf,'Global');rpcDb[_0xb9f8('0x9b')](_0xf3417d,_0xb9f8('0xc4'));}else{if(_0x5784f4[_0xb9f8('0xc0')]>=_0x39f1f5['dialNoAnswerMaxRetry']){rpcDb[_0xb9f8('0x9b')](_0x5784f4,_0xb9f8('0xc5'));}else{rpcDb[_0xb9f8('0xbc')](ut[_0xb9f8('0xbd')](_0x5784f4,_0xb9f8('0xc0'),_0x39f1f5[_0xb9f8('0xc6')]),_0x5784f4[_0xb9f8('0xbe')],_0x5784f4[_0xb9f8('0x9e')]);}}break;case _0xb9f8('0xc7'):_0x39f1f5[_0xb9f8('0xc8')]+=0x1;_0x5784f4['countcongestionretry']+=0x1;_0x5784f4[_0xb9f8('0x95')]=ut['totalGlobal'](_0x5784f4);ut[_0xb9f8('0x86')](_0x5784f4,0x8,'Congestion');ami[_0xb9f8('0x21')]('custom:agentcongestion',ut[_0xb9f8('0x99')](_0x5784f4,_0xb9f8('0xc9')));rpcDb[_0xb9f8('0x8b')](_0x5784f4,_0xb9f8('0xca'));if(ut[_0xb9f8('0x96')](_0x5784f4)>=_0x39f1f5[_0xb9f8('0xb9')]){_0xf3417d=ut[_0xb9f8('0x9a')](_0x5784f4,0xf,_0xb9f8('0xba'));rpcDb[_0xb9f8('0x9b')](_0xf3417d,_0xb9f8('0xcb'));}else{if(_0x5784f4[_0xb9f8('0xcc')]>=_0x39f1f5[_0xb9f8('0xcd')]){rpcDb[_0xb9f8('0x9b')](_0x5784f4,_0xb9f8('0xca'));}else{rpcDb[_0xb9f8('0xbc')](ut[_0xb9f8('0xbd')](_0x5784f4,_0xb9f8('0xcc'),_0x39f1f5[_0xb9f8('0xce')]),_0x5784f4[_0xb9f8('0xbe')],_0x5784f4[_0xb9f8('0x9e')]);}}break;case _0xb9f8('0xcf'):_0x39f1f5[_0xb9f8('0x3a')]+=0x1;_0x5784f4[_0xb9f8('0xd0')]+=0x1;_0x5784f4[_0xb9f8('0x95')]=ut[_0xb9f8('0x96')](_0x5784f4);ut[_0xb9f8('0x86')](_0x5784f4,0x14,'AgentReject');ami[_0xb9f8('0x21')](_0xb9f8('0xd1'),ut['buildObj'](_0x5784f4,_0xb9f8('0xd2')));rpcDb[_0xb9f8('0x8b')](_0x5784f4,_0xb9f8('0xd3'));if(ut[_0xb9f8('0x96')](_0x5784f4)>=_0x39f1f5['dialGlobalMaxRetry']){_0xf3417d=ut[_0xb9f8('0x9a')](_0x5784f4,0x14,_0xb9f8('0xd4'));rpcDb[_0xb9f8('0x9b')](_0xf3417d,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x5784f4['countagentrejectretry']>=_0x39f1f5[_0xb9f8('0xd5')]){rpcDb[_0xb9f8('0x9b')](_0x5784f4,_0xb9f8('0xd6'));}else{rpcDb['rescheduleContact'](ut[_0xb9f8('0xbd')](_0x5784f4,_0xb9f8('0xd0'),_0x39f1f5['dialAgentRejectRetryFrequency']),_0x5784f4[_0xb9f8('0xbe')],_0x5784f4['activeContact']);}}break;case _0xb9f8('0xd7'):_0x39f1f5[_0xb9f8('0x3c')]+=0x1;_0x5784f4[_0xb9f8('0xd8')]+=0x1;_0x5784f4[_0xb9f8('0x95')]=ut[_0xb9f8('0x96')](_0x5784f4);ut[_0xb9f8('0x86')](_0x5784f4,0xb,'Abandoned');rpcDb[_0xb9f8('0x8b')](_0x5784f4,_0xb9f8('0xd9'));if(ut[_0xb9f8('0x96')](_0x5784f4)>=_0x39f1f5['dialGlobalMaxRetry']){_0xf3417d=ut[_0xb9f8('0x9a')](_0x5784f4,0xf,_0xb9f8('0xba'));rpcDb[_0xb9f8('0x9b')](_0xf3417d,_0xb9f8('0xd9'));}else{if(_0x5784f4[_0xb9f8('0xda')]>=_0x39f1f5[_0xb9f8('0xdb')]){rpcDb['createCustomerFinal'](_0x5784f4,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xb9f8('0xbc')](ut[_0xb9f8('0xbd')](_0x5784f4,_0xb9f8('0xd8'),_0x39f1f5[_0xb9f8('0xdc')]),_0x5784f4[_0xb9f8('0xbe')],_0x5784f4[_0xb9f8('0x9e')]);}}break;default:if(_0x5784f4['dialAnswer']){ut['decrementTalkink'](_0x39f1f5,_0xb9f8('0xdd'));ut['loggerError'](_0xb9f8('0xde')+_0x39f1f5[_0xb9f8('0x23')],_0x1353b7);}_0x39f1f5[_0xb9f8('0x3b')]+=0x1;_0x5784f4[_0xb9f8('0x95')]=ut['totalGlobal'](_0x5784f4);ut[_0xb9f8('0x86')](_0x5784f4,0xc,_0x1353b7[_0xb9f8('0xdf')]||_0x1353b7[_0xb9f8('0xe0')]);rpcDb[_0xb9f8('0x8b')](_0x5784f4,_0xb9f8('0xe1'));if(ut[_0xb9f8('0x96')](_0x5784f4)>=_0x39f1f5[_0xb9f8('0xb9')]){_0xf3417d=ut['cloneAction'](_0x5784f4,0xf,_0xb9f8('0xba'));rpcDb[_0xb9f8('0x9b')](_0xf3417d,_0xb9f8('0xe2'));}else{rpcDb[_0xb9f8('0x9b')](_0x5784f4,_0xb9f8('0xe2'));}delete this[_0xb9f8('0x68')][_0x1353b7[_0xb9f8('0x9f')]];}if(!(_0x5784f4[_0xb9f8('0x6c')]&&_0x23dddd==='16')){ut[_0xb9f8('0xe3')](_0x39f1f5,_0xb9f8('0xe4'));logger['info'](_0xb9f8('0xe5'),_0x5784f4[_0xb9f8('0xb1')],_0xb9f8('0xa4'),_0x39f1f5['name'],_0xb9f8('0x6b'),_0x39f1f5['originated']);}if(_0x23dddd!=='ANSWER'){delete this[_0xb9f8('0x68')][_0x1353b7[_0xb9f8('0x9f')]];delete this['actions'][_0x1353b7[_0xb9f8('0xe6')]];}}};Preview['prototype'][_0xb9f8('0xe7')]=function(_0x44a7b1,_0x1801fd,_0x26bc37){if(_['isUndefined'](_0x1801fd)&&'object'!==typeof _0x1801fd){return;}if(_[_0xb9f8('0xe8')](_0x26bc37)&&_0xb9f8('0xe9')!==typeof _0x26bc37){return;}switch(_0x26bc37[_0xb9f8('0xea')]){case'0':ut[_0xb9f8('0xeb')](_0x44a7b1,0x0,_0xb9f8('0x97'));rpcDb[_0xb9f8('0xec')](_0x44a7b1,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x44a7b1,0x3,'NoAnswer');rpcDb[_0xb9f8('0xec')](_0x44a7b1,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x44a7b1,0x5,'Busy');rpcDb[_0xb9f8('0xec')](_0x44a7b1,_0xb9f8('0xed'));break;case'8':ut[_0xb9f8('0xeb')](_0x44a7b1,0x8,_0xb9f8('0xee'));rpcDb['createAgentHistory'](_0x44a7b1,_0xb9f8('0xef'));break;case'22':ut['logAgent'](_0x44a7b1,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x44a7b1,_0xb9f8('0xf0'));break;default:ut[_0xb9f8('0xeb')](_0x44a7b1,0xc,_0x26bc37[_0xb9f8('0xea')]);rpcDb[_0xb9f8('0xec')](_0x44a7b1,_0xb9f8('0xef'));}ut[_0xb9f8('0xe3')](_0x1801fd,'[callProgressDetectingAgent]');logger[_0xb9f8('0x55')]('[originated][decrement][callProgressDetectingAgent]',_0x44a7b1[_0xb9f8('0xb1')],'\x20Queue',_0x1801fd[_0xb9f8('0x23')],_0xb9f8('0x6b'),_0x1801fd[_0xb9f8('0x49')]);delete this[_0xb9f8('0x68')][_0x44a7b1[_0xb9f8('0xb1')]];};Preview[_0xb9f8('0xe')][_0xb9f8('0xf1')]=function(_0x6ad902,_0x31c163,_0x164c38,_0x319455,_0x114206){var _0x30919e=this;return new BPromise(function(_0x162e6a,_0x2b64cf){if(_[_0xb9f8('0x67')](_0x31c163)||_[_0xb9f8('0x67')](_0x31c163['Contact'])||_[_0xb9f8('0x67')](_0x31c163[_0xb9f8('0xf2')]['phone'])||_[_0xb9f8('0x67')](_0x31c163[_0xb9f8('0x70')])){_0x2b64cf(ut[_0xb9f8('0x48')](_0xb9f8('0xf3'),_0x319455,_0x114206));return;}var _0xb4e6cb=uuid['v4']();var _0x11c51b=_0x30919e['campaignsPreview'][_0x31c163['Queue'][_0xb9f8('0x23')]];var _0x5bb2cb=_0x164c38?_0x30919e[_0xb9f8('0x14')][_0x164c38]['id']:undefined;_0x30919e[_0xb9f8('0x68')][_0xb4e6cb]=new Action(_0x31c163,_0x11c51b,_0xb4e6cb,_0x164c38,_0x5bb2cb);var _0x1226a2=_0x30919e['actions'][_0xb4e6cb];_0x1226a2[_0xb9f8('0xbe')]=_0x319455;_0x1226a2[_0xb9f8('0x9e')]=_0x114206;_0x1226a2[_0xb9f8('0xf4')]=_0x164c38;if(_[_0xb9f8('0xf5')](_0x6ad902)){_0x30919e[_0xb9f8('0xf6')](_0x1226a2,_0x11c51b,_0x31c163,_0x164c38)['then'](function(_0x2af519){logger[_0xb9f8('0x55')](_0xb9f8('0xf7'),_0xb9f8('0xf8')+_0x1226a2['queue']+'\x20IdHopper:\x20'+_0x1226a2[_0xb9f8('0xf9')],JSON['stringify'](_0x2af519));ami['emit'](_0xb9f8('0xfa'),ut[_0xb9f8('0x99')](_0x1226a2,_0xb9f8('0xfb')));_0x162e6a(ut[_0xb9f8('0x48')](_0xb9f8('0xfc')));})[_0xb9f8('0x73')](function(_0x6801b8){ut['logger'](_0xb9f8('0xfd'),_0x6801b8);_0x2b64cf(ut[_0xb9f8('0x48')]('Call\x20failed',_0x319455,_0x114206));});}else{_0x11c51b[_0xb9f8('0x33')]+=0x1;ut[_0xb9f8('0xfe')](_0x1226a2);rpcDb['createHistory'](_0x1226a2,'[Blacklist][error]');delete _0x30919e['actions'][_0xb4e6cb];_0x2b64cf(ut['message'](_0xb9f8('0xff'),_0x319455,_0x114206));}});};Preview['prototype'][_0xb9f8('0x90')]=function(_0x1f015){return!_['isNil'](_0x1f015)&&!_['isNil'](_0x1f015[_0xb9f8('0x23')])&&!_[_0xb9f8('0x67')](_0x1f015[_0xb9f8('0x50')])&&_0x1f015[_0xb9f8('0x50')]&&!_[_0xb9f8('0x67')](this['trunks'][util['format'](_0xb9f8('0x100'),_0x1f015[_0xb9f8('0x23')])])&&!_[_0xb9f8('0x67')](this[_0xb9f8('0x13')][util[_0xb9f8('0x57')]('SIP/%s',_0x1f015[_0xb9f8('0x23')])][_0xb9f8('0x101')])&&(this[_0xb9f8('0x13')][util[_0xb9f8('0x57')](_0xb9f8('0x100'),_0x1f015[_0xb9f8('0x23')])][_0xb9f8('0x101')]===_0xb9f8('0x102')||this[_0xb9f8('0x13')][util[_0xb9f8('0x57')]('SIP/%s',_0x1f015[_0xb9f8('0x23')])][_0xb9f8('0x101')]===_0xb9f8('0x103'));};Preview[_0xb9f8('0xe')]['run']=function(_0x114055,_0x398d43){var _0xc85df5=this;return new BPromise(function(_0xb798b5,_0x33d608){_0xc85df5[_0xb9f8('0x104')](_0x114055,_0x398d43)[_0xb9f8('0x7d')](function(_0x4956c8){_0xb798b5(_[_0xb9f8('0x6d')](_0x4956c8,['message']));})[_0xb9f8('0x73')](function(_0x149a24){if(_0x149a24[_0xb9f8('0x105')]){rpcDb[_0xb9f8('0x106')](_0x114055);}if(_0x149a24[_0xb9f8('0x50')]){rpcDb['disableContact'](_0x114055);}_0x33d608(_['pick'](_0x149a24,[_0xb9f8('0x48')]));});});};Preview[_0xb9f8('0xe')][_0xb9f8('0x104')]=function(_0x1eccc9,_0x17c5ae){var _0xa51e91=this;return new BPromise(function(_0xd21b29,_0x5af9d3){var _0xc0a1b,_0x2d2c07;rpcDb[_0xb9f8('0x107')](_0x1eccc9)[_0xb9f8('0x7d')](function(_0x45cf81){if(!_[_0xb9f8('0x67')](_0x45cf81[0x0])){_0x2d2c07=_0x45cf81[0x0][_0xb9f8('0x108')]?![]:!![];_0xc0a1b=_0x45cf81[0x0][_0xb9f8('0x108')]?!![]:![];_0xc0a1b=_0x17c5ae?!![]:_0xc0a1b;}var _0x27c42f=_0xa51e91['validateContact'](_0x45cf81);if(_0x27c42f[_0xb9f8('0x109')]){rpcDb[_0xb9f8('0x10a')](_[_0xb9f8('0x6d')](_0x45cf81[0x0],['VoiceQueueId',_0xb9f8('0x10b')]))[_0xb9f8('0x7d')](function(_0x42c471){_0xa51e91[_0xb9f8('0xf1')](_0x42c471,_0x45cf81[0x0],_0x17c5ae,_0x2d2c07,_0xc0a1b)[_0xb9f8('0x7d')](function(_0x16c043){_0xd21b29(_0x16c043);})[_0xb9f8('0x73')](function(_0x43c31b){_0x5af9d3(_0x43c31b);});})[_0xb9f8('0x73')](function(_0x4a6c92){ut['logger'](_0xb9f8('0x10c'),_0x4a6c92);_0x5af9d3(ut[_0xb9f8('0x48')]('Call\x20unsuccessful',_0x2d2c07,_0xc0a1b));});}else{_0x5af9d3(ut[_0xb9f8('0x48')](_0x27c42f[_0xb9f8('0x48')],_0x2d2c07,_0xc0a1b));}})[_0xb9f8('0x73')](function(_0x36fd53){ut[_0xb9f8('0x5a')](_0xb9f8('0x10d'),_0x36fd53);_0x5af9d3(ut[_0xb9f8('0x48')](_0xb9f8('0x10e'),![],!![]));});});};Preview[_0xb9f8('0xe')]['validateContact']=function(_0x4b69c1){if(_[_0xb9f8('0x67')](_0x4b69c1)||_[_0xb9f8('0xf5')](_0x4b69c1)||!_[_0xb9f8('0x67')](_0x4b69c1[0x0][_0xb9f8('0x81')])&&_[_0xb9f8('0x67')](_0x4b69c1[0x0][_0xb9f8('0x81')][_0xb9f8('0x23')])){ut['logger'](_0xb9f8('0x10f'),_0x4b69c1);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x24e900=this[_0xb9f8('0x11')][_0x4b69c1[0x0]['Queue'][_0xb9f8('0x23')]];_0x24e900[_0xb9f8('0x48')]=_0xb9f8('0x92');if(_[_0xb9f8('0x67')](_0x24e900)){ut[_0xb9f8('0x5a')](_0xb9f8('0x110'),_0x24e900);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xb9f8('0x90')](_0x24e900[_0xb9f8('0x4f')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x24e900[_0xb9f8('0x23')]+_0xb9f8('0x111'));if(!this['isTrunkReachable'](_0x24e900[_0xb9f8('0x91')])){ut[_0xb9f8('0x5a')](_0xb9f8('0x112'),_0x24e900['name']+_0xb9f8('0x113'));return{'isValid':![],'message':_0xb9f8('0x114')};}}if(!ut[_0xb9f8('0x8f')](_0x24e900[_0xb9f8('0x2f')])){ut[_0xb9f8('0x5a')](_0xb9f8('0x115'),_0x24e900[_0xb9f8('0x23')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xb9f8('0x116')+_0x24e900[_0xb9f8('0x23')]+_0xb9f8('0x117')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0xb9f8('0xf6')]=function(_0x48a195,_0x29273e,_0xab0492,_0x454f62){var _0x1164a6=this;return new BPromise(function(_0x25d346,_0x32b04f){var _0x932d1=_0x48a195['uniqueid'];var _0x5efd62=_0x1164a6[_0xb9f8('0x90')](_0x29273e[_0xb9f8('0x4f')])?util[_0xb9f8('0x57')](_0xb9f8('0x118'),_0x29273e[_0xb9f8('0x4f')][_0xb9f8('0x23')],_['isNil'](_0x29273e['dialPrefix'])?'':_0x29273e[_0xb9f8('0x30')]['trim']()||'',_0x29273e[_0xb9f8('0x119')]>0x0?_0xab0492['Contact']['phone'][_0xb9f8('0x11a')](_0x29273e['dialCutDigit']):_0xab0492[_0xb9f8('0xf2')]['phone']):util[_0xb9f8('0x57')]('SIP/%s/%s%s',_[_0xb9f8('0x67')](_0x29273e[_0xb9f8('0x91')])?_0x29273e[_0xb9f8('0x4f')][_0xb9f8('0x23')]:_0x29273e['TrunkBackup'][_0xb9f8('0x23')],_[_0xb9f8('0x67')](_0x29273e[_0xb9f8('0x30')])?'':_0x29273e[_0xb9f8('0x30')][_0xb9f8('0x11b')]()||'',_0x29273e[_0xb9f8('0x119')]>0x0?_0xab0492[_0xb9f8('0xf2')][_0xb9f8('0x11c')][_0xb9f8('0x11a')](_0x29273e[_0xb9f8('0x119')]):_0xab0492['Contact']['phone']);var _0x15b4c5=_0x1164a6[_0xb9f8('0x90')](_0x29273e[_0xb9f8('0x4f')])?ut['getCallerId'](_0x29273e[_0xb9f8('0x4f')][_0xb9f8('0x11d')],_0x29273e[_0xb9f8('0x11e')],_0x29273e[_0xb9f8('0x11f')]>0x0?ut[_0xb9f8('0x120')](_0x29273e[_0xb9f8('0x121')],_0x29273e[_0xb9f8('0x11f')]):_0x29273e[_0xb9f8('0x121')]):ut[_0xb9f8('0x122')](_[_0xb9f8('0x67')](_0x29273e[_0xb9f8('0x91')])?_0x29273e['Trunk']['callerid']:_0x29273e[_0xb9f8('0x91')][_0xb9f8('0x11d')],_0x29273e[_0xb9f8('0x11e')],_0x29273e[_0xb9f8('0x11f')]>0x0?ut[_0xb9f8('0x120')](_0x29273e['dialOriginateCallerIdNumber'],_0x29273e[_0xb9f8('0x11f')]):_0x29273e[_0xb9f8('0x121')]);if(_0x15b4c5){_0x48a195[_0xb9f8('0x123')]=ut[_0xb9f8('0x124')](_0x15b4c5);_0x48a195[_0xb9f8('0x125')]=ut[_0xb9f8('0x126')](_0x15b4c5);}var _0x48e3dd=ut['addVariables'](_0x29273e,_0xab0492,_0x5efd62,_0x15b4c5,_0x932d1,_0x48a195);_[_0xb9f8('0x127')](_0x48a195,ut[_0xb9f8('0x128')](_0x48e3dd));_0x48a195[_0xb9f8('0x129')]=moment()[_0xb9f8('0x57')](_0xb9f8('0x85'));ami[_0xb9f8('0x71')](ut[_0xb9f8('0x12a')](_0x48a195,_0x29273e,_0x48e3dd,_0x48a195[_0xb9f8('0x9e')],_0x454f62))[_0xb9f8('0x7d')](function(_0x54d952){_0x29273e[_0xb9f8('0x49')]+=0x1;logger[_0xb9f8('0x55')](_0xb9f8('0x12b'),_0x932d1,_0xb9f8('0xa4'),_0x29273e[_0xb9f8('0x23')],_0xb9f8('0x6b'),_0x29273e['originated']);_0x25d346(_0x54d952);})[_0xb9f8('0x73')](function(_0x4974d2){ut[_0xb9f8('0xeb')](_0x48a195,0xe,_0xb9f8('0x12c'));rpcDb[_0xb9f8('0xec')](_0x48a195,_0xb9f8('0x12d'));_0x32b04f(_0x4974d2);});});};Preview[_0xb9f8('0xe')][_0xb9f8('0x1b')]=function(_0x3a1c15){if(this[_0xb9f8('0x68')][_0x3a1c15[_0xb9f8('0x9f')]]){this[_0xb9f8('0x68')][_0x3a1c15['linkedid']][_0xb9f8('0x72')]=_0x3a1c15[_0xb9f8('0x72')];}};Preview['prototype'][_0xb9f8('0x16')]=function(_0x5e93e5){var _0x42f9d3=this;var _0x407a8d=this['actions'][_0x5e93e5[_0xb9f8('0x12e')]];if(_0x407a8d){if(_0x407a8d['lookAgent']&&this[_0xb9f8('0x14')][_0x407a8d[_0xb9f8('0xf4')]]){ut[_0xb9f8('0x12f')](_0x407a8d,this[_0xb9f8('0x14')][_0x407a8d[_0xb9f8('0xf4')]][_0xb9f8('0x23')],this[_0xb9f8('0x14')][_0x407a8d['lookAgent']]['id']);}var _0x512374=_[_0xb9f8('0x130')](_0x407a8d);_0x512374['responsetime']=moment()[_0xb9f8('0x57')](_0xb9f8('0x85'));var _0x3eb0cb=_0x42f9d3[_0xb9f8('0x11')][_0x407a8d[_0xb9f8('0x6a')]];if(ut['isFailure'](_0x5e93e5[_0xb9f8('0x131')])){if(_0x407a8d[_0xb9f8('0xbe')]){rpcDb[_0xb9f8('0x106')](_0x407a8d[_0xb9f8('0xf9')]);}if(_0x407a8d['activeContact']){rpcDb['disableContact'](_0x407a8d[_0xb9f8('0xf9')]);}ami[_0xb9f8('0x21')](_0xb9f8('0x132'),ut['buildObj'](_0x407a8d,_0xb9f8('0x133')));this[_0xb9f8('0xe7')](_0x512374,_0x3eb0cb,_0x5e93e5);}else{_0x407a8d[_0xb9f8('0x129')]=moment()[_0xb9f8('0x57')](_0xb9f8('0x85'));ut[_0xb9f8('0xeb')](_0x512374,0x4,'Answer');rpcDb['createAgentHistory'](_0x512374,_0xb9f8('0x134'));}}};Preview['prototype'][_0xb9f8('0x135')]=function(_0x32af63){var _0x12bca0=this;var _0x88b610=this['actions'][_0x32af63[_0xb9f8('0x9f')]];var _0x9dfaf7;if(_0x88b610){_0x9dfaf7=this[_0xb9f8('0x11')][_0x88b610['queue']];logger[_0xb9f8('0x55')](_0xb9f8('0x136'),_0x32af63[_0xb9f8('0x9f')],_0xb9f8('0xa4'),_0x9dfaf7['name'],'pTalking:\x20',_0x9dfaf7[_0xb9f8('0x28')]);}if(this[_0xb9f8('0x68')][_0x32af63[_0xb9f8('0x9f')]]&&_0x32af63['linkedid']!==_0x32af63[_0xb9f8('0xb1')]){if(_0x32af63[_0xb9f8('0x137')]==='16'&&this[_0xb9f8('0x68')][_0x32af63[_0xb9f8('0x9f')]][_0xb9f8('0x6c')]){this[_0xb9f8('0x93')](_0x32af63,_0x32af63[_0xb9f8('0x9f')],_0x32af63[_0xb9f8('0x137')]);}else if(this[_0xb9f8('0x68')][_0x32af63['linkedid']][_0xb9f8('0x6c')]){logger['info'](_0xb9f8('0x138'),_0x32af63[_0xb9f8('0x9f')],_0x32af63[_0xb9f8('0x137')],_0xb9f8('0xa4'),_0x9dfaf7['name'],_0xb9f8('0xb2'),_0x9dfaf7[_0xb9f8('0x28')]);this[_0xb9f8('0x93')](_0x32af63,_0x32af63[_0xb9f8('0x9f')],_0x32af63[_0xb9f8('0x137')]);}}else if(_0x88b610&&_[_0xb9f8('0x67')](_0x88b610['statedesc'])&&_0x9dfaf7['dialQueueProject']&&_0x32af63[_0xb9f8('0x9f')]===_0x32af63[_0xb9f8('0xb1')]&&_[_0xb9f8('0x67')](_0x32af63[_0xb9f8('0xea')])&&_0x32af63[_0xb9f8('0x137')]==='16'&&_0x32af63[_0xb9f8('0x139')]==='6'&&_[_0xb9f8('0xe8')](_0x88b610[_0xb9f8('0x13a')])){if(_0x88b610[_0xb9f8('0xbe')]){rpcDb[_0xb9f8('0x106')](_0x88b610['idContact']);}if(_0x88b610[_0xb9f8('0x9e')]){rpcDb[_0xb9f8('0x13b')](_0x88b610[_0xb9f8('0xf9')]);}_0x32af63[_0xb9f8('0xea')]='22';this[_0xb9f8('0xe7')](_0x88b610,_0x9dfaf7,_0x32af63);}else if(_0x88b610&&_0x88b610[_0xb9f8('0x13a')]){if(_0x32af63['cause']==='16'&&this[_0xb9f8('0x68')][_0x32af63[_0xb9f8('0x9f')]]['dialAnswer']){logger[_0xb9f8('0x55')](_0xb9f8('0x13c'),_0x32af63[_0xb9f8('0x9f')],_0x32af63[_0xb9f8('0x137')],'\x20Queue',_0x9dfaf7[_0xb9f8('0x23')],_0xb9f8('0xb2'),_0x9dfaf7[_0xb9f8('0x28')]);this[_0xb9f8('0x93')](_0x32af63,_0x32af63[_0xb9f8('0x9f')],_0x32af63['cause']);}else if(this[_0xb9f8('0x68')][_0x32af63['linkedid']]['dialAnswer']){logger[_0xb9f8('0x55')](_0xb9f8('0x138'),_0x32af63[_0xb9f8('0x9f')],_0x32af63[_0xb9f8('0x137')],_0xb9f8('0xa4'),_0x9dfaf7[_0xb9f8('0x23')],_0xb9f8('0xb2'),_0x9dfaf7[_0xb9f8('0x28')]);this[_0xb9f8('0x93')](_0x32af63,_0x32af63[_0xb9f8('0x9f')],_0x32af63[_0xb9f8('0x137')]);}}};Preview[_0xb9f8('0xe')][_0xb9f8('0x13d')]=function(_0x8328ff){if(this[_0xb9f8('0x68')][_0x8328ff[_0xb9f8('0xe6')]]&&_0x8328ff[_0xb9f8('0xe6')]!==_0x8328ff[_0xb9f8('0x13e')]){this[_0xb9f8('0x93')](_0x8328ff,_0x8328ff[_0xb9f8('0xe6')],_0x8328ff[_0xb9f8('0xe0')]);}};Preview[_0xb9f8('0xe')][_0xb9f8('0x13f')]=function(_0x26389c){if(this[_0xb9f8('0x68')][_0x26389c[_0xb9f8('0x9f')]]&&_0x26389c['linkedid']!==_0x26389c['uniqueid']&&!this['actions'][_0x26389c[_0xb9f8('0x9f')]][_0xb9f8('0x6c')]){if(_0x26389c[_0xb9f8('0x137')]==='1'){this[_0xb9f8('0x93')](_0x26389c,_0x26389c['linkedid'],_0x26389c[_0xb9f8('0x137')]);}}};Preview[_0xb9f8('0xe')][_0xb9f8('0x140')]=function(_0x20baa1,_0x4835b2,_0x348961){if(this['actions'][_0x20baa1]){if(_[_0xb9f8('0x67')](this[_0xb9f8('0x68')][_0x20baa1][_0xb9f8('0x141')])){this[_0xb9f8('0x68')][_0x20baa1][_0xb9f8('0x141')]={};}this[_0xb9f8('0x68')][_0x20baa1][_0xb9f8('0x141')][_0x4835b2]=_0x348961;}};Preview[_0xb9f8('0xe')]['syncVarSet']=function(_0x387b96){try{if(!_[_0xb9f8('0x67')](_0x387b96)){if(ut['filterKey'](_[_0xb9f8('0x142')](_0x387b96[_0xb9f8('0x143')])[0x0])){this['addVariable'](_0x387b96[_0xb9f8('0xb1')],_[_0xb9f8('0x142')](_0x387b96[_0xb9f8('0x143')])[0x0],_0x387b96['value']);}}}catch(_0x1d2630){logger[_0xb9f8('0x144')](_0xb9f8('0x145'),util['inspect'](_0x1d2630,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xb9f8('0x146')]=function(_0x4f13c1){if(_0x4f13c1){if(this[_0xb9f8('0x68')][_0x4f13c1[_0xb9f8('0x147')]]){this[_0xb9f8('0x68')][_0x4f13c1[_0xb9f8('0x147')]][_0xb9f8('0x13a')]=!![];}}};Preview[_0xb9f8('0xe')]['syncBlindTransfer']=function(_0x279d95){if(_0x279d95){if(this[_0xb9f8('0x68')][_0x279d95[_0xb9f8('0x148')]]){this[_0xb9f8('0x68')][_0x279d95[_0xb9f8('0x148')]][_0xb9f8('0x13a')]=!![];}}};module[_0xb9f8('0x149')]=Preview; \ No newline at end of file +var _0x6fc8=['callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','setMessage','recallMe','isNil','actions','queue','originated:\x20','pTalking','dialAnswer','contactId','Action','channel','catch','message','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','clearZombieChannel','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','ANSWER','responsetime','answertime','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','pTalking:\x20','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','linkedid','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','unmonitored','run','unlock','pick','execRun','recallme','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','merge','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','clone','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','unlockContact','transfer','[syncHangup][talking][transfer]','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','blindtransfer','syncBlindTransfer','emit','type','outbound','name','strategy','available','sumDuration','talking','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active'];(function(_0x509e99,_0x159237){var _0xd06ccb=function(_0x511b25){while(--_0x511b25){_0x509e99['push'](_0x509e99['shift']());}};_0xd06ccb(++_0x159237);}(_0x6fc8,0x107));var _0x86fc=function(_0x3d5a07,_0x4b333f){_0x3d5a07=_0x3d5a07-0x0;var _0x13ecbc=_0x6fc8[_0x3d5a07];return _0x13ecbc;};'use strict';var util=require(_0x86fc('0x0'));var _=require(_0x86fc('0x1'));var BPromise=require(_0x86fc('0x2'));var uuid=require(_0x86fc('0x3'));var moment=require(_0x86fc('0x4'));var md5=require(_0x86fc('0x5'));var Redis=require(_0x86fc('0x6'));var config=require(_0x86fc('0x7'));var logger=require(_0x86fc('0x8'))(_0x86fc('0x9'));var loggerAction=require(_0x86fc('0x8'))(_0x86fc('0xa'));var ami=require(_0x86fc('0xb'));var rpcDb=require(_0x86fc('0xc'));var Action=require(_0x86fc('0xd'));var ut=require('./util/util');config[_0x86fc('0xe')]=_[_0x86fc('0xf')](config[_0x86fc('0xe')],{'host':_0x86fc('0x10'),'port':0x18eb});var io=require(_0x86fc('0x11'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x86fc('0x12')][_0x86fc('0x13')]=function(_0x3b2df8){this[_0x86fc('0x14')]=this[_0x86fc('0x14')]?this[_0x86fc('0x14')][_0x86fc('0x15')](_0x3b2df8):_0x3b2df8();};function Preview(_0x2a3e5c){this[_0x86fc('0x16')]=new Sequence();this[_0x86fc('0x17')]=_0x2a3e5c[_0x86fc('0x18')];this[_0x86fc('0x19')]=_0x2a3e5c[_0x86fc('0x19')];this['actions']={};this['agents']=_0x2a3e5c[_0x86fc('0x1a')];this[_0x86fc('0x1b')]=0x0;ami['on'](_0x86fc('0x1c'),this['syncOriginateResponse'][_0x86fc('0x1d')](this));ami['on'](_0x86fc('0x1e'),this[_0x86fc('0x1f')][_0x86fc('0x1d')](this));ami['on'](_0x86fc('0x20'),this[_0x86fc('0x21')][_0x86fc('0x1d')](this));ami['on'](_0x86fc('0x22'),this['syncDialEnd'][_0x86fc('0x1d')](this));ami['on'](_0x86fc('0x23'),this[_0x86fc('0x24')][_0x86fc('0x1d')](this));ami['on'](_0x86fc('0x25'),this['syncVarSet']['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x86fc('0x26'),this[_0x86fc('0x27')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x22c1af,_0x13ee59,_0x1501f1){io['to'](_0x22c1af)[_0x86fc('0x28')](_0x13ee59,_0x1501f1);}function emitCampaignPreview(_0x4c3ed2){if(_0x4c3ed2[_0x86fc('0x29')]===_0x86fc('0x2a')){var _0xf11be9={'id':_0x4c3ed2['id'],'name':_0x4c3ed2[_0x86fc('0x2b')],'strategy':_0x4c3ed2[_0x86fc('0x2c')],'answered':_0x4c3ed2['answered'],'available':_0x4c3ed2[_0x86fc('0x2d')],'loggedIn':_0x4c3ed2['loggedIn'],'pTalking':_0x4c3ed2['pTalking'],'sumBillable':_0x4c3ed2['sumBillable'],'sumDuration':_0x4c3ed2[_0x86fc('0x2e')],'sumHoldTime':_0x4c3ed2['sumHoldTime']||0x0,'talking':_0x4c3ed2[_0x86fc('0x2f')],'total':_0x4c3ed2[_0x86fc('0x30')],'type':_0x4c3ed2[_0x86fc('0x29')],'unmanaged':_0x4c3ed2[_0x86fc('0x31')],'abandoned':_0x4c3ed2[_0x86fc('0x32')],'waiting':_0x4c3ed2[_0x86fc('0x33')],'loggedInDb':_0x4c3ed2['loggedInDb'],'dialActive':_0x4c3ed2[_0x86fc('0x34')],'dialMethod':_0x4c3ed2[_0x86fc('0x35')],'dialOriginateCallerIdName':_0x4c3ed2['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4c3ed2[_0x86fc('0x36')],'dialOriginateTimeout':_0x4c3ed2[_0x86fc('0x37')],'dialPrefix':_0x4c3ed2['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4c3ed2[_0x86fc('0x38')],'outboundAnswerCallsDay':_0x4c3ed2[_0x86fc('0x39')],'outboundBlacklistCallsDay':_0x4c3ed2[_0x86fc('0x3a')],'outboundBusyCallsDay':_0x4c3ed2['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4c3ed2['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x4c3ed2[_0x86fc('0x3b')],'outboundDropCallsDayCallersExit':_0x4c3ed2[_0x86fc('0x3c')],'outboundDropCallsDayTimeout':_0x4c3ed2[_0x86fc('0x3d')],'outboundNoAnswerCallsDay':_0x4c3ed2[_0x86fc('0x3e')],'outboundNoSuchCallsDay':_0x4c3ed2[_0x86fc('0x3f')],'outboundOriginateFailureCallsDay':_0x4c3ed2[_0x86fc('0x40')],'outboundReCallsDay':_0x4c3ed2[_0x86fc('0x41')],'outboundRejectCallsDay':_0x4c3ed2[_0x86fc('0x42')],'outboundUnknownCallsDay':_0x4c3ed2['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x4c3ed2[_0x86fc('0x43')],'predictiveIntervalAnsweredCalls':_0x4c3ed2[_0x86fc('0x44')],'predictiveIntervalAvgHoldtime':_0x4c3ed2['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4c3ed2['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4c3ed2[_0x86fc('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x4c3ed2[_0x86fc('0x46')],'predictiveIntervalErlangCalls':_0x4c3ed2[_0x86fc('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x4c3ed2[_0x86fc('0x48')],'predictiveIntervalHitRate':_0x4c3ed2[_0x86fc('0x49')],'predictiveIntervalMultiplicativeFactor':_0x4c3ed2[_0x86fc('0x4a')],'predictiveIntervalPauses':_0x4c3ed2[_0x86fc('0x4b')],'predictiveIntervalAvailable':_0x4c3ed2[_0x86fc('0x4c')],'predictiveIntervalTotalCalls':_0x4c3ed2['predictiveIntervalTotalCalls'],'message':_0x4c3ed2['message'],'originated':_0x4c3ed2['originated'],'erlangCalls':_0x4c3ed2['erlangCalls'],'erlangCallToSecond':_0x4c3ed2['erlangCallToSecond'],'erlangAbandonmentRate':_0x4c3ed2[_0x86fc('0x4d')],'erlangBusyFactor':_0x4c3ed2[_0x86fc('0x4e')],'startPredictive':_0x4c3ed2['startPredictive'],'startProgressive':_0x4c3ed2[_0x86fc('0x4f')]};if(_0x4c3ed2[_0x86fc('0x50')]){_0xf11be9['Trunk']={'id':_0x4c3ed2[_0x86fc('0x50')]['id'],'name':_0x4c3ed2[_0x86fc('0x50')][_0x86fc('0x2b')],'active':_0x4c3ed2[_0x86fc('0x50')][_0x86fc('0x51')],'callerid':_0x4c3ed2[_0x86fc('0x50')][_0x86fc('0x52')]};}if(_0x4c3ed2['Interval']){_0xf11be9[_0x86fc('0x53')]={'id':_0x4c3ed2[_0x86fc('0x53')]['id'],'name':_0x4c3ed2[_0x86fc('0x53')]['name']};}var _0x305d03=md5(JSON[_0x86fc('0x54')](_0xf11be9));if(_0x4c3ed2['md5']!==_0x305d03){_0x4c3ed2[_0x86fc('0x5')]=_0x305d03;emit(util[_0x86fc('0x55')]('voice:queue:%s',_0xf11be9[_0x86fc('0x2b')]),_0x86fc('0x56'),_0xf11be9);}}}function emitVoiceQueueChannelRemove(_0x4cd853){logger[_0x86fc('0x57')](_0x86fc('0x58'),JSON[_0x86fc('0x54')](_0x4cd853));emit(util[_0x86fc('0x55')](_0x86fc('0x59'),_0x4cd853[_0x86fc('0x2b')]),'voice_queue_channel:remove',_0x4cd853);}function notSendMessagesQueue(_0x4b85ac){if(_0x4b85ac[_0x86fc('0x5a')]){if(_0x4b85ac[_0x86fc('0x5b')]===0x0&&_0x4b85ac['pTalking']===0x0){_0x4b85ac['sendMessageOneNotActive']=![];_0x4b85ac['available']=0x0;_0x4b85ac[_0x86fc('0x5c')]=0x0;_0x4b85ac['message']=_0x86fc('0x5d');ut[_0x86fc('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4b85ac[_0x86fc('0x2b')]+_0x86fc('0x5f'));}else{_0x4b85ac['message']=_0x86fc('0x60');ut[_0x86fc('0x5e')](_0x86fc('0x61'),_0x4b85ac[_0x86fc('0x2b')]+_0x86fc('0x62'));}emitCampaignPreview(_0x4b85ac);}}Preview[_0x86fc('0x12')][_0x86fc('0x63')]=function(){var _0x312c18=this;setInterval(function(){_0x312c18[_0x86fc('0x64')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x4c0e6e=this[_0x86fc('0x17')];this['clockClearZombieChannels']+=0x1;for(var _0xb01c1 in _0x4c0e6e){if(_0x4c0e6e[_0x86fc('0x65')](_0xb01c1)&&(_0x4c0e6e[_0xb01c1]['dialMethod']===_0x86fc('0x9')||_0x4c0e6e[_0xb01c1]['dialMethod']===_0x86fc('0x66'))&&_0x4c0e6e[_0xb01c1][_0x86fc('0x29')]===_0x86fc('0x2a')){if(this['clockClearZombieChannels']>0x7){this[_0x86fc('0x1b')]=0x0;this['clearZombieChannels']();}}if(_0x4c0e6e[_0x86fc('0x65')](_0xb01c1)&&_0x4c0e6e[_0xb01c1][_0x86fc('0x35')]==='preview'&&_0x4c0e6e[_0xb01c1]['type']==='outbound'){if(_0x4c0e6e[_0xb01c1]['dialActive']){this[_0x86fc('0x67')](_0x4c0e6e[_0xb01c1]);this[_0x86fc('0x68')](_0x4c0e6e[_0xb01c1]);}else{notSendMessagesQueue(_0x4c0e6e[_0xb01c1]);}}}};Preview[_0x86fc('0x12')]['clearZombieChannel']=function(_0x8c1580){var _0x1d6544=this;this[_0x86fc('0x16')][_0x86fc('0x13')](function(){if(!_[_0x86fc('0x69')](_0x1d6544[_0x86fc('0x6a')][_0x8c1580])){loggerAction[_0x86fc('0x57')]('[clearZombieChannels][talking]',_0x8c1580,'Queue',_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6b')],_0x86fc('0x6c'),JSON[_0x86fc('0x54')](_0x1d6544[_0x86fc('0x17')][_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6b')]][_0x86fc('0x5b')]),'pTalking:\x20',JSON[_0x86fc('0x54')](_0x1d6544[_0x86fc('0x17')][_0x1d6544[_0x86fc('0x6a')][_0x8c1580]['queue']][_0x86fc('0x6d')]),JSON[_0x86fc('0x54')](_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6e')]),JSON[_0x86fc('0x54')](_['pick'](_0x1d6544[_0x86fc('0x6a')][_0x8c1580],[_0x86fc('0x6f'),'UserId','VoiceQueueId','ListId'])));return ami[_0x86fc('0x70')]({'action':'status','channel':_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x71')]})[_0x86fc('0x72')](function(_0x11881f){if(_0x11881f[_0x86fc('0x73')]===_0x86fc('0x74')){setTimeout(function(){if(_0x1d6544['actions'][_0x8c1580]){ut[_0x86fc('0x75')](_0x1d6544[_0x86fc('0x17')][_0x1d6544['actions'][_0x8c1580]['queue']],'[clearZombieChannel]');if(_0x1d6544['actions'][_0x8c1580][_0x86fc('0x6e')]===!![]){ut[_0x86fc('0x76')](_0x1d6544[_0x86fc('0x17')][_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6b')]],_0x86fc('0x77'));ut[_0x86fc('0x78')]('[Dialer][checkChannel][pTalking][Preview]'+_0x8c1580,_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6b')]);}ut[_0x86fc('0x78')](_0x86fc('0x79')+_0x8c1580,_0x1d6544[_0x86fc('0x6a')][_0x8c1580][_0x86fc('0x6b')]);delete _0x1d6544[_0x86fc('0x6a')][_0x8c1580];}},0x2328);}});}});};Preview[_0x86fc('0x12')][_0x86fc('0x7a')]=function(){var _0x56a444=this;loggerAction['info'](_0x86fc('0x7b'),_[_0x86fc('0x7c')](this['actions']));for(var _0x179a08 in this['actions']){if(_0x56a444[_0x86fc('0x6a')][_0x86fc('0x65')](_0x179a08)){_0x56a444[_0x86fc('0x7d')](_0x179a08);}}};Preview[_0x86fc('0x12')][_0x86fc('0x68')]=function(_0x4f56f3){var _0x5e184f=this;rpcDb[_0x86fc('0x7e')](_0x4f56f3['id'],ut['agentReadyId'](this['agents']))[_0x86fc('0x7f')](function(_0x1694b9){if(!_['isNil'](_0x1694b9)){for(var _0x537821=0x0;_0x537821<_0x1694b9[_0x86fc('0x80')];_0x537821+=0x1){if(ut[_0x86fc('0x81')](_0x1694b9[_0x537821][_0x86fc('0x82')])<_0x4f56f3[_0x86fc('0x83')]*0x3c){if(_0x1694b9[_0x537821]['Agent']&&!_0x1694b9[_0x537821][_0x86fc('0x84')][_0x86fc('0x85')]){_0x5e184f['run'](_0x1694b9[_0x537821]['id'])[_0x86fc('0x7f')](ut[_0x86fc('0x86')](_0x86fc('0x87')))[_0x86fc('0x72')](ut[_0x86fc('0x86')](_0x86fc('0x87')));}else{rpcDb[_0x86fc('0x88')](_0x1694b9[_0x537821]['id']);}}else{var _0xf7d9a=new Action(_0x1694b9[_0x537821],_0x4f56f3);_0xf7d9a[_0x86fc('0x89')]=moment()['format'](_0x86fc('0x8a'));_0x4f56f3[_0x86fc('0x41')]+=0x1;ut[_0x86fc('0x8b')](_0xf7d9a,0x17,_0x86fc('0x8c'));if(_0x4f56f3[_0x86fc('0x8d')]){rpcDb[_0x86fc('0x8e')](ut[_0x86fc('0x8f')](_0x1694b9[_0x537821]));rpcDb[_0x86fc('0x90')](_0xf7d9a,_0x86fc('0x91'));}else{ut[_0x86fc('0x8b')](_0xf7d9a,0x16,'RecallFailedTimeout');rpcDb[_0x86fc('0x90')](_0xf7d9a,_0x86fc('0x92'));rpcDb[_0x86fc('0x93')](_0xf7d9a,_0x86fc('0x92'));}}}}})[_0x86fc('0x72')](ut[_0x86fc('0x86')](_0x86fc('0x94')));};Preview[_0x86fc('0x12')]['setMessage']=function(_0x5f065c){_0x5f065c['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x5f065c[_0x86fc('0x95')])){_0x5f065c['message']=_0x86fc('0x96');}else if(!ut['isActive'](_0x5f065c[_0x86fc('0x34')])){_0x5f065c[_0x86fc('0x73')]=_0x86fc('0x5d');}else if(!this[_0x86fc('0x97')](_0x5f065c[_0x86fc('0x50')])){if(!this[_0x86fc('0x97')](_0x5f065c[_0x86fc('0x98')])){_0x5f065c[_0x86fc('0x73')]=_0x86fc('0x99');}else{_0x5f065c[_0x86fc('0x73')]=_0x86fc('0x9a');}}else{_0x5f065c[_0x86fc('0x73')]=_0x86fc('0x9a');}emitCampaignPreview(_0x5f065c);};Preview[_0x86fc('0x12')]['callProgressDetectingCustomer']=function(_0x6751ae,_0x369dad,_0x42695c){var _0x5d95d2=this;var _0x2e3d1a=this[_0x86fc('0x6a')][_0x369dad];var _0x1b9c01=this[_0x86fc('0x17')][_0x2e3d1a[_0x86fc('0x6b')]];var _0x3c4583;if(_0x1b9c01){switch(_0x42695c){case'1':_0x1b9c01[_0x86fc('0x3f')]+=0x1;_0x2e3d1a['countnosuchnumberretry']+=0x1;_0x2e3d1a[_0x86fc('0x9b')]=ut[_0x86fc('0x9c')](_0x2e3d1a);ut['logCustomer'](_0x2e3d1a,0x0,'NoSuchNumber');ami[_0x86fc('0x28')](_0x86fc('0x9d'),ut['buildObj'](_0x2e3d1a,_0x86fc('0x9e')));rpcDb['createCustomerHistory'](_0x2e3d1a,_0x86fc('0x9f'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01[_0x86fc('0xa0')]){_0x3c4583=ut['cloneAction'](_0x2e3d1a,0xf,_0x86fc('0xa1'));rpcDb[_0x86fc('0x93')](_0x3c4583,_0x86fc('0xa2'));}else{if(_0x2e3d1a[_0x86fc('0xa3')]>=_0x1b9c01['dialNoSuchNumberMaxRetry']){rpcDb[_0x86fc('0x93')](_0x2e3d1a,_0x86fc('0xa2'));}else{rpcDb[_0x86fc('0xa4')](ut[_0x86fc('0xa5')](_0x2e3d1a,_0x86fc('0xa3'),_0x1b9c01[_0x86fc('0xa6')]),_0x2e3d1a['unlockAgent'],_0x2e3d1a[_0x86fc('0xa7')]);}}delete this[_0x86fc('0x6a')][_0x6751ae['linkedid']];break;case _0x86fc('0xa8'):var _0x580369=moment()[_0x86fc('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e3d1a[_0x86fc('0xa9')]=_0x580369;_0x2e3d1a[_0x86fc('0xaa')]=_0x580369;_0x2e3d1a['dialAnswer']=!![];_0x1b9c01['pTalking']+=0x1;logger[_0x86fc('0x57')]('[syncHangup][talking][increment]',_0x2e3d1a['uniqueid'],_0x86fc('0xab'),_0x1b9c01[_0x86fc('0x2b')],'pTalking:\x20',_0x1b9c01['pTalking']);ami[_0x86fc('0x28')](_0x86fc('0xac'),ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xae')));if(_0x1b9c01[_0x86fc('0xaf')]){ami[_0x86fc('0x28')](_0x86fc('0xb0'),ut[_0x86fc('0xb1')](_0x2e3d1a));}break;case'16':ami[_0x86fc('0x28')](_0x86fc('0xb2'),ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xb3')));emitVoiceQueueChannelRemove(ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xb3')));_0x1b9c01['outboundAnswerCallsDay']+=0x1;_0x1b9c01[_0x86fc('0x30')]+=0x1;_0x1b9c01['answered']+=0x1;ut[_0x86fc('0x76')](_0x1b9c01,_0x86fc('0xb4'));_0x2e3d1a['countglobal']=ut[_0x86fc('0x9c')](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0x4,_0x86fc('0xb5'));rpcDb['createCustomerHistory'](_0x2e3d1a,_0x86fc('0xb6'));rpcDb['createCustomerFinal'](_0x2e3d1a,_0x86fc('0xb7'));rpcDb[_0x86fc('0xb8')](_0x2e3d1a);_0x1b9c01[_0x86fc('0x2e')]+=_0x2e3d1a[_0x86fc('0xb9')];_0x1b9c01[_0x86fc('0xba')]+=_0x2e3d1a[_0x86fc('0xb9')];logger[_0x86fc('0x57')](_0x86fc('0xbb'),_0x2e3d1a[_0x86fc('0xbc')],'\x20Queue',_0x1b9c01[_0x86fc('0x2b')],_0x86fc('0xbd'),_0x1b9c01[_0x86fc('0x6d')]);delete this['actions'][_0x6751ae['linkedid']];break;case _0x86fc('0xbe'):_0x1b9c01['outboundBusyCallsDay']+=0x1;_0x2e3d1a[_0x86fc('0xbf')]+=0x1;_0x2e3d1a['countglobal']=ut[_0x86fc('0x9c')](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0x5,_0x86fc('0xc0'));ami[_0x86fc('0x28')]('custom:agentbusy',ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xc1')));rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xc2'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01['dialGlobalMaxRetry']){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0xf,_0x86fc('0xa1'));rpcDb[_0x86fc('0x93')](_0x3c4583,_0x86fc('0xc4'));}else{if(_0x2e3d1a[_0x86fc('0xbf')]>=_0x1b9c01[_0x86fc('0xc5')]){rpcDb[_0x86fc('0x93')](_0x2e3d1a,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x86fc('0xa5')](_0x2e3d1a,'countbusyretry',_0x1b9c01[_0x86fc('0xc6')]),_0x2e3d1a[_0x86fc('0xc7')],_0x2e3d1a[_0x86fc('0xa7')]);}}break;case _0x86fc('0xc8'):_0x1b9c01[_0x86fc('0x3e')]+=0x1;_0x2e3d1a[_0x86fc('0xc9')]+=0x1;_0x2e3d1a['countglobal']=ut[_0x86fc('0x9c')](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0x3,_0x86fc('0xca'));ami[_0x86fc('0x28')](_0x86fc('0xcb'),ut['buildObj'](_0x2e3d1a,'noanswer'));rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xcc'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01[_0x86fc('0xa0')]){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0xf,_0x86fc('0xa1'));rpcDb[_0x86fc('0x93')](_0x3c4583,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2e3d1a['countnoanswerretry']>=_0x1b9c01[_0x86fc('0xcd')]){rpcDb['createCustomerFinal'](_0x2e3d1a,_0x86fc('0xcc'));}else{rpcDb[_0x86fc('0xa4')](ut['scheduledAt'](_0x2e3d1a,'countnoanswerretry',_0x1b9c01[_0x86fc('0xce')]),_0x2e3d1a[_0x86fc('0xc7')],_0x2e3d1a[_0x86fc('0xa7')]);}}break;case _0x86fc('0xcf'):_0x1b9c01[_0x86fc('0xd0')]+=0x1;_0x2e3d1a[_0x86fc('0xd1')]+=0x1;_0x2e3d1a['countglobal']=ut['totalGlobal'](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0x8,_0x86fc('0xd2'));ami[_0x86fc('0x28')](_0x86fc('0xd3'),ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xd4')));rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xd5'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01['dialGlobalMaxRetry']){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0xf,_0x86fc('0xa1'));rpcDb[_0x86fc('0x93')](_0x3c4583,_0x86fc('0xd6'));}else{if(_0x2e3d1a[_0x86fc('0xd1')]>=_0x1b9c01[_0x86fc('0xd7')]){rpcDb[_0x86fc('0x93')](_0x2e3d1a,_0x86fc('0xd5'));}else{rpcDb[_0x86fc('0xa4')](ut[_0x86fc('0xa5')](_0x2e3d1a,_0x86fc('0xd1'),_0x1b9c01[_0x86fc('0xc6')]),_0x2e3d1a['unlockAgent'],_0x2e3d1a['activeContact']);}}break;case _0x86fc('0xd8'):_0x1b9c01[_0x86fc('0x42')]+=0x1;_0x2e3d1a[_0x86fc('0xd9')]+=0x1;_0x2e3d1a[_0x86fc('0x9b')]=ut[_0x86fc('0x9c')](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0x14,_0x86fc('0xda'));ami[_0x86fc('0x28')]('custom:agentreject',ut[_0x86fc('0xad')](_0x2e3d1a,_0x86fc('0xdb')));rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xdc'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01[_0x86fc('0xa0')]){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0x14,_0x86fc('0xda'));rpcDb[_0x86fc('0x93')](_0x3c4583,_0x86fc('0xdd'));}else{if(_0x2e3d1a['countagentrejectretry']>=_0x1b9c01[_0x86fc('0xde')]){rpcDb[_0x86fc('0x93')](_0x2e3d1a,_0x86fc('0xdd'));}else{rpcDb[_0x86fc('0xa4')](ut[_0x86fc('0xa5')](_0x2e3d1a,_0x86fc('0xd9'),_0x1b9c01[_0x86fc('0xdf')]),_0x2e3d1a[_0x86fc('0xc7')],_0x2e3d1a[_0x86fc('0xa7')]);}}break;case _0x86fc('0xe0'):_0x1b9c01['outboundAbandonedCallsDay']+=0x1;_0x2e3d1a[_0x86fc('0xe1')]+=0x1;_0x2e3d1a[_0x86fc('0x9b')]=ut['totalGlobal'](_0x2e3d1a);ut['logCustomer'](_0x2e3d1a,0xb,_0x86fc('0xe2'));rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xe3'));if(ut[_0x86fc('0x9c')](_0x2e3d1a)>=_0x1b9c01[_0x86fc('0xa0')]){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0xf,_0x86fc('0xa1'));rpcDb['createCustomerFinal'](_0x3c4583,_0x86fc('0xe3'));}else{if(_0x2e3d1a[_0x86fc('0xe4')]>=_0x1b9c01[_0x86fc('0xe5')]){rpcDb['createCustomerFinal'](_0x2e3d1a,_0x86fc('0xe3'));}else{rpcDb['rescheduleContact'](ut[_0x86fc('0xa5')](_0x2e3d1a,'countabandonedretry',_0x1b9c01['dialAbandonedRetryFrequency']),_0x2e3d1a[_0x86fc('0xc7')],_0x2e3d1a[_0x86fc('0xa7')]);}}break;default:if(_0x2e3d1a[_0x86fc('0x6e')]){ut['decrementTalkink'](_0x1b9c01,_0x86fc('0xe6'));ut[_0x86fc('0x78')](_0x86fc('0xe7')+_0x1b9c01[_0x86fc('0x2b')],_0x6751ae);}_0x1b9c01[_0x86fc('0xe8')]+=0x1;_0x2e3d1a[_0x86fc('0x9b')]=ut[_0x86fc('0x9c')](_0x2e3d1a);ut[_0x86fc('0x8b')](_0x2e3d1a,0xc,_0x6751ae[_0x86fc('0xe9')]||_0x6751ae['dialstatus']);rpcDb[_0x86fc('0x90')](_0x2e3d1a,_0x86fc('0xea'));if(ut['totalGlobal'](_0x2e3d1a)>=_0x1b9c01[_0x86fc('0xa0')]){_0x3c4583=ut[_0x86fc('0xc3')](_0x2e3d1a,0xf,'Global');rpcDb[_0x86fc('0x93')](_0x3c4583,_0x86fc('0xeb'));}else{rpcDb['createCustomerFinal'](_0x2e3d1a,_0x86fc('0xeb'));}delete this[_0x86fc('0x6a')][_0x6751ae[_0x86fc('0xec')]];}if(!(_0x2e3d1a['dialAnswer']&&_0x42695c==='16')){ut[_0x86fc('0x75')](_0x1b9c01,_0x86fc('0xed'));logger[_0x86fc('0x57')](_0x86fc('0xee'),_0x2e3d1a[_0x86fc('0xbc')],'\x20Queue',_0x1b9c01['name'],_0x86fc('0x6c'),_0x1b9c01[_0x86fc('0x5b')]);}if(_0x42695c!==_0x86fc('0xa8')){delete this[_0x86fc('0x6a')][_0x6751ae[_0x86fc('0xec')]];delete this[_0x86fc('0x6a')][_0x6751ae[_0x86fc('0xef')]];}}};Preview['prototype'][_0x86fc('0xf0')]=function(_0x4b794d,_0x423401,_0x15e0bf){if(_[_0x86fc('0xf1')](_0x423401)&&_0x86fc('0xf2')!==typeof _0x423401){return;}if(_[_0x86fc('0xf1')](_0x15e0bf)&&'object'!==typeof _0x15e0bf){return;}switch(_0x15e0bf[_0x86fc('0xf3')]){case'0':ut[_0x86fc('0xf4')](_0x4b794d,0x0,'NoSuchNumber');rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xf6'));break;case'3':ut[_0x86fc('0xf4')](_0x4b794d,0x3,'NoAnswer');rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xf7'));break;case'5':ut['logAgent'](_0x4b794d,0x5,'Busy');rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xf8'));break;case'8':ut[_0x86fc('0xf4')](_0x4b794d,0x8,_0x86fc('0xd2'));rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xf9'));break;case'22':ut[_0x86fc('0xf4')](_0x4b794d,0x16,'AnswerAGI');rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xfa'));break;default:ut[_0x86fc('0xf4')](_0x4b794d,0xc,_0x15e0bf[_0x86fc('0xf3')]);rpcDb[_0x86fc('0xf5')](_0x4b794d,_0x86fc('0xf9'));}ut[_0x86fc('0x75')](_0x423401,_0x86fc('0xfb'));logger[_0x86fc('0x57')](_0x86fc('0xfc'),_0x4b794d['uniqueid'],_0x86fc('0xab'),_0x423401['name'],_0x86fc('0x6c'),_0x423401['originated']);delete this[_0x86fc('0x6a')][_0x4b794d['uniqueid']];};Preview[_0x86fc('0x12')][_0x86fc('0xfd')]=function(_0x558da0,_0x20cd83,_0x4cf133,_0x1cf098,_0x46bcc4){var _0x57ec38=this;return new BPromise(function(_0x4b9219,_0x17219b){if(_[_0x86fc('0x69')](_0x20cd83)||_[_0x86fc('0x69')](_0x20cd83[_0x86fc('0xfe')])||_['isNil'](_0x20cd83['Contact'][_0x86fc('0xff')])||_['isNil'](_0x20cd83[_0x86fc('0x100')])){_0x17219b(ut[_0x86fc('0x73')](_0x86fc('0x101'),_0x1cf098,_0x46bcc4));return;}var _0x172012=uuid['v4']();var _0x40e2ad=_0x57ec38['campaignsPreview'][_0x20cd83[_0x86fc('0x102')]['name']];var _0x2d621f=_0x4cf133?_0x57ec38['agents'][_0x4cf133]['id']:undefined;_0x57ec38['actions'][_0x172012]=new Action(_0x20cd83,_0x40e2ad,_0x172012,_0x4cf133,_0x2d621f);var _0x27535c=_0x57ec38[_0x86fc('0x6a')][_0x172012];_0x27535c[_0x86fc('0xc7')]=_0x1cf098;_0x27535c[_0x86fc('0xa7')]=_0x46bcc4;_0x27535c[_0x86fc('0x103')]=_0x4cf133;if(_[_0x86fc('0x104')](_0x558da0)){_0x57ec38[_0x86fc('0x105')](_0x27535c,_0x40e2ad,_0x20cd83,_0x4cf133)['then'](function(_0x74bd1d){logger[_0x86fc('0x57')](_0x86fc('0x106'),_0x86fc('0x107')+_0x27535c[_0x86fc('0x6b')]+'\x20IdHopper:\x20'+_0x27535c[_0x86fc('0x108')],JSON[_0x86fc('0x54')](_0x74bd1d));ami[_0x86fc('0x28')](_0x86fc('0x109'),ut[_0x86fc('0xad')](_0x27535c,_0x86fc('0x10a')));_0x4b9219(ut[_0x86fc('0x73')](_0x86fc('0x10b')));})[_0x86fc('0x72')](function(_0x28c63c){ut[_0x86fc('0x5e')](_0x86fc('0x10c'),_0x28c63c);_0x17219b(ut['message'](_0x86fc('0x10d'),_0x1cf098,_0x46bcc4));});}else{_0x40e2ad['outboundBlacklistCallsDay']+=0x1;ut[_0x86fc('0x10e')](_0x27535c);rpcDb[_0x86fc('0x10f')](_0x27535c,_0x86fc('0x110'));delete _0x57ec38['actions'][_0x172012];_0x17219b(ut[_0x86fc('0x73')](_0x86fc('0x111'),_0x1cf098,_0x46bcc4));}});};Preview['prototype']['isTrunkReachable']=function(_0x344a27){return!_[_0x86fc('0x69')](_0x344a27)&&!_[_0x86fc('0x69')](_0x344a27[_0x86fc('0x2b')])&&!_[_0x86fc('0x69')](_0x344a27['active'])&&_0x344a27[_0x86fc('0x51')]&&!_[_0x86fc('0x69')](this[_0x86fc('0x19')][util['format'](_0x86fc('0x112'),_0x344a27[_0x86fc('0x2b')])])&&!_[_0x86fc('0x69')](this[_0x86fc('0x19')][util[_0x86fc('0x55')](_0x86fc('0x112'),_0x344a27[_0x86fc('0x2b')])]['status'])&&(this[_0x86fc('0x19')][util[_0x86fc('0x55')]('SIP/%s',_0x344a27[_0x86fc('0x2b')])]['status']==='reachable'||this[_0x86fc('0x19')][util['format'](_0x86fc('0x112'),_0x344a27['name'])][_0x86fc('0x113')]===_0x86fc('0x114'));};Preview[_0x86fc('0x12')][_0x86fc('0x115')]=function(_0x1e6984,_0x5f5a14){var _0x5dbdab=this;return new BPromise(function(_0x40269e,_0x24b933){_0x5dbdab['execRun'](_0x1e6984,_0x5f5a14)[_0x86fc('0x7f')](function(_0x3b3c17){_0x40269e(_['pick'](_0x3b3c17,[_0x86fc('0x73')]));})[_0x86fc('0x72')](function(_0x1832ea){if(_0x1832ea[_0x86fc('0x116')]){rpcDb['unlockContact'](_0x1e6984);}if(_0x1832ea[_0x86fc('0x51')]){rpcDb[_0x86fc('0x88')](_0x1e6984);}_0x24b933(_[_0x86fc('0x117')](_0x1832ea,['message']));});});};Preview[_0x86fc('0x12')][_0x86fc('0x118')]=function(_0x4c9191,_0x32df48){var _0x58d7b9=this;return new BPromise(function(_0x3efb4b,_0x15fc5d){var _0x49537c,_0x463458;rpcDb['getContactPreview'](_0x4c9191)[_0x86fc('0x7f')](function(_0x29bf43){if(!_[_0x86fc('0x69')](_0x29bf43[0x0])){_0x463458=_0x29bf43[0x0][_0x86fc('0x119')]?![]:!![];_0x49537c=_0x29bf43[0x0][_0x86fc('0x119')]?!![]:![];_0x49537c=_0x32df48?!![]:_0x49537c;}var _0x5e009c=_0x58d7b9['validateContact'](_0x29bf43);if(_0x5e009c['isValid']){rpcDb[_0x86fc('0x11a')](_['pick'](_0x29bf43[0x0],[_0x86fc('0x100'),_0x86fc('0x11b')]))['then'](function(_0x8c8342){_0x58d7b9[_0x86fc('0xfd')](_0x8c8342,_0x29bf43[0x0],_0x32df48,_0x463458,_0x49537c)[_0x86fc('0x7f')](function(_0x382cc8){_0x3efb4b(_0x382cc8);})[_0x86fc('0x72')](function(_0x30fae7){_0x15fc5d(_0x30fae7);});})[_0x86fc('0x72')](function(_0x2089eb){ut[_0x86fc('0x5e')](_0x86fc('0x11c'),_0x2089eb);_0x15fc5d(ut['message'](_0x86fc('0x11d'),_0x463458,_0x49537c));});}else{_0x15fc5d(ut[_0x86fc('0x73')](_0x5e009c[_0x86fc('0x73')],_0x463458,_0x49537c));}})[_0x86fc('0x72')](function(_0x234479){ut[_0x86fc('0x5e')](_0x86fc('0x11e'),_0x234479);_0x15fc5d(ut[_0x86fc('0x73')](_0x86fc('0x11d'),![],!![]));});});};Preview[_0x86fc('0x12')][_0x86fc('0x11f')]=function(_0x1bd833){if(_['isNil'](_0x1bd833)||_[_0x86fc('0x104')](_0x1bd833)||!_[_0x86fc('0x69')](_0x1bd833[0x0][_0x86fc('0x84')])&&_[_0x86fc('0x69')](_0x1bd833[0x0][_0x86fc('0x84')][_0x86fc('0x2b')])){ut['logger'](_0x86fc('0x120'),_0x1bd833);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1f2125=this['campaignsPreview'][_0x1bd833[0x0][_0x86fc('0x102')][_0x86fc('0x2b')]];_0x1f2125['message']=_0x86fc('0x9a');if(_['isNil'](_0x1f2125)){ut[_0x86fc('0x5e')](_0x86fc('0x121'),_0x1f2125);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x1f2125[_0x86fc('0x50')])){ut[_0x86fc('0x5e')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x86fc('0x122')+_0x1f2125['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x86fc('0x97')](_0x1f2125[_0x86fc('0x98')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x1f2125[_0x86fc('0x2b')]+_0x86fc('0x123'));return{'isValid':![],'message':_0x86fc('0x124')};}}if(!ut[_0x86fc('0x125')](_0x1f2125[_0x86fc('0x34')])){ut['logger'](_0x86fc('0x126'),_0x1f2125[_0x86fc('0x2b')]+_0x86fc('0x127'));return{'isValid':![],'message':_0x86fc('0x122')+_0x1f2125[_0x86fc('0x2b')]+_0x86fc('0x127')};}return{'isValid':!![],'message':_0x86fc('0x128')};};Preview['prototype']['execCall']=function(_0x13e5a6,_0x6badd,_0x8ef3ba,_0xdf202b){var _0x14559c=this;return new BPromise(function(_0x1b7c9c,_0x11c648){var _0x36ef84=_0x13e5a6[_0x86fc('0xbc')];var _0x4147ab=_0x14559c[_0x86fc('0x97')](_0x6badd['Trunk'])?util[_0x86fc('0x55')](_0x86fc('0x129'),_0x6badd[_0x86fc('0x50')][_0x86fc('0x2b')],_[_0x86fc('0x69')](_0x6badd[_0x86fc('0x12a')])?'':_0x6badd[_0x86fc('0x12a')][_0x86fc('0x12b')]()||'',_0x6badd[_0x86fc('0x12c')]>0x0?_0x8ef3ba['Contact'][_0x86fc('0xff')]['substring'](_0x6badd[_0x86fc('0x12c')]):_0x8ef3ba['Contact']['phone']):util[_0x86fc('0x55')](_0x86fc('0x129'),_[_0x86fc('0x69')](_0x6badd[_0x86fc('0x98')])?_0x6badd[_0x86fc('0x50')]['name']:_0x6badd[_0x86fc('0x98')][_0x86fc('0x2b')],_['isNil'](_0x6badd[_0x86fc('0x12a')])?'':_0x6badd[_0x86fc('0x12a')][_0x86fc('0x12b')]()||'',_0x6badd['dialCutDigit']>0x0?_0x8ef3ba[_0x86fc('0xfe')][_0x86fc('0xff')][_0x86fc('0x12d')](_0x6badd[_0x86fc('0x12c')]):_0x8ef3ba['Contact'][_0x86fc('0xff')]);var _0x2fa25d=_0x14559c[_0x86fc('0x97')](_0x6badd[_0x86fc('0x50')])?ut[_0x86fc('0x12e')](_0x6badd['Trunk'][_0x86fc('0x52')],_0x6badd[_0x86fc('0x12f')],_0x6badd[_0x86fc('0x130')]>0x0?ut[_0x86fc('0x131')](_0x6badd[_0x86fc('0x36')],_0x6badd['dialRandomLastDigitCallerIdNumber']):_0x6badd[_0x86fc('0x36')]):ut[_0x86fc('0x12e')](_[_0x86fc('0x69')](_0x6badd[_0x86fc('0x98')])?_0x6badd[_0x86fc('0x50')][_0x86fc('0x52')]:_0x6badd['TrunkBackup'][_0x86fc('0x52')],_0x6badd[_0x86fc('0x12f')],_0x6badd[_0x86fc('0x130')]>0x0?ut[_0x86fc('0x131')](_0x6badd['dialOriginateCallerIdNumber'],_0x6badd[_0x86fc('0x130')]):_0x6badd[_0x86fc('0x36')]);if(_0x2fa25d){_0x13e5a6[_0x86fc('0x132')]=ut[_0x86fc('0x133')](_0x2fa25d);_0x13e5a6[_0x86fc('0x134')]=ut[_0x86fc('0x135')](_0x2fa25d);}var _0x453d21=ut['addVariables'](_0x6badd,_0x8ef3ba,_0x4147ab,_0x2fa25d,_0x36ef84,_0x13e5a6);_[_0x86fc('0x136')](_0x13e5a6,ut['toLowerVariables'](_0x453d21));_0x13e5a6['starttime']=moment()['format'](_0x86fc('0x8a'));ami['Action'](ut[_0x86fc('0x137')](_0x13e5a6,_0x6badd,_0x453d21,_0x13e5a6[_0x86fc('0xa7')],_0xdf202b))['then'](function(_0x109ac8){_0x6badd['originated']+=0x1;logger[_0x86fc('0x57')](_0x86fc('0x138'),_0x36ef84,_0x86fc('0xab'),_0x6badd[_0x86fc('0x2b')],'originated:\x20',_0x6badd[_0x86fc('0x5b')]);_0x1b7c9c(_0x109ac8);})[_0x86fc('0x72')](function(_0x37cc0b){ut['logAgent'](_0x13e5a6,0xe,_0x86fc('0x139'));rpcDb[_0x86fc('0xf5')](_0x13e5a6,_0x86fc('0x13a'));_0x11c648(_0x37cc0b);});});};Preview[_0x86fc('0x12')][_0x86fc('0x24')]=function(_0x5c67f2){if(this[_0x86fc('0x6a')][_0x5c67f2[_0x86fc('0xec')]]){this[_0x86fc('0x6a')][_0x5c67f2[_0x86fc('0xec')]]['channel']=_0x5c67f2['channel'];}};Preview[_0x86fc('0x12')][_0x86fc('0x13b')]=function(_0x382bea){var _0x2e3307=this;var _0x1e52c2=this[_0x86fc('0x6a')][_0x382bea[_0x86fc('0x13c')]];if(_0x1e52c2){if(_0x1e52c2[_0x86fc('0x103')]&&this[_0x86fc('0x1a')][_0x1e52c2[_0x86fc('0x103')]]){ut['logLookAgent'](_0x1e52c2,this[_0x86fc('0x1a')][_0x1e52c2[_0x86fc('0x103')]][_0x86fc('0x2b')],this['agents'][_0x1e52c2[_0x86fc('0x103')]]['id']);}var _0x5d9d8a=_[_0x86fc('0x13d')](_0x1e52c2);_0x5d9d8a['responsetime']=moment()['format'](_0x86fc('0x8a'));var _0x363675=_0x2e3307[_0x86fc('0x17')][_0x1e52c2[_0x86fc('0x6b')]];if(ut['isFailure'](_0x382bea[_0x86fc('0x13e')])){if(_0x1e52c2[_0x86fc('0xc7')]){rpcDb['unlockContact'](_0x1e52c2[_0x86fc('0x108')]);}if(_0x1e52c2['activeContact']){rpcDb['disableContact'](_0x1e52c2[_0x86fc('0x108')]);}ami[_0x86fc('0x28')](_0x86fc('0x13f'),ut['buildObj'](_0x1e52c2,_0x86fc('0x140')));this[_0x86fc('0xf0')](_0x5d9d8a,_0x363675,_0x382bea);}else{_0x1e52c2[_0x86fc('0x89')]=moment()['format'](_0x86fc('0x8a'));ut[_0x86fc('0xf4')](_0x5d9d8a,0x4,_0x86fc('0xb5'));rpcDb[_0x86fc('0xf5')](_0x5d9d8a,_0x86fc('0x141'));}}};Preview[_0x86fc('0x12')][_0x86fc('0x1f')]=function(_0x3f9e78){var _0x456230=this;var _0x21cc9b=this[_0x86fc('0x6a')][_0x3f9e78[_0x86fc('0xec')]];var _0x2de89c;if(_0x21cc9b){_0x2de89c=this[_0x86fc('0x17')][_0x21cc9b[_0x86fc('0x6b')]];logger['info']('[syncHangup][talking]',_0x3f9e78[_0x86fc('0xec')],_0x86fc('0xab'),_0x2de89c[_0x86fc('0x2b')],_0x86fc('0xbd'),_0x2de89c['pTalking']);}if(this[_0x86fc('0x6a')][_0x3f9e78['linkedid']]&&_0x3f9e78[_0x86fc('0xec')]!==_0x3f9e78[_0x86fc('0xbc')]){if(_0x3f9e78[_0x86fc('0x142')]==='16'&&this[_0x86fc('0x6a')][_0x3f9e78['linkedid']][_0x86fc('0x6e')]){this[_0x86fc('0x143')](_0x3f9e78,_0x3f9e78[_0x86fc('0xec')],_0x3f9e78[_0x86fc('0x142')]);}else if(this[_0x86fc('0x6a')][_0x3f9e78[_0x86fc('0xec')]][_0x86fc('0x6e')]){logger[_0x86fc('0x57')](_0x86fc('0x144'),_0x3f9e78['linkedid'],_0x3f9e78[_0x86fc('0x142')],_0x86fc('0xab'),_0x2de89c[_0x86fc('0x2b')],_0x86fc('0xbd'),_0x2de89c['pTalking']);this[_0x86fc('0x143')](_0x3f9e78,_0x3f9e78['linkedid'],_0x3f9e78['cause']);}}else if(_0x21cc9b&&_[_0x86fc('0x69')](_0x21cc9b[_0x86fc('0x145')])&&_0x2de89c[_0x86fc('0x146')]&&_0x3f9e78[_0x86fc('0xec')]===_0x3f9e78['uniqueid']&&_[_0x86fc('0x69')](_0x3f9e78[_0x86fc('0xf3')])&&_0x3f9e78[_0x86fc('0x142')]==='16'&&_0x3f9e78[_0x86fc('0x147')]==='6'&&_[_0x86fc('0xf1')](_0x21cc9b['transfer'])){if(_0x21cc9b[_0x86fc('0xc7')]){rpcDb[_0x86fc('0x148')](_0x21cc9b[_0x86fc('0x108')]);}if(_0x21cc9b[_0x86fc('0xa7')]){rpcDb[_0x86fc('0x88')](_0x21cc9b[_0x86fc('0x108')]);}_0x3f9e78[_0x86fc('0xf3')]='22';this[_0x86fc('0xf0')](_0x21cc9b,_0x2de89c,_0x3f9e78);}else if(_0x21cc9b&&_0x21cc9b[_0x86fc('0x149')]){if(_0x3f9e78[_0x86fc('0x142')]==='16'&&this[_0x86fc('0x6a')][_0x3f9e78[_0x86fc('0xec')]][_0x86fc('0x6e')]){logger[_0x86fc('0x57')](_0x86fc('0x14a'),_0x3f9e78[_0x86fc('0xec')],_0x3f9e78[_0x86fc('0x142')],_0x86fc('0xab'),_0x2de89c[_0x86fc('0x2b')],_0x86fc('0xbd'),_0x2de89c[_0x86fc('0x6d')]);this[_0x86fc('0x143')](_0x3f9e78,_0x3f9e78['linkedid'],_0x3f9e78[_0x86fc('0x142')]);}else if(this[_0x86fc('0x6a')][_0x3f9e78['linkedid']][_0x86fc('0x6e')]){logger['info'](_0x86fc('0x144'),_0x3f9e78[_0x86fc('0xec')],_0x3f9e78['cause'],_0x86fc('0xab'),_0x2de89c['name'],'pTalking:\x20',_0x2de89c[_0x86fc('0x6d')]);this['callProgressDetectingCustomer'](_0x3f9e78,_0x3f9e78[_0x86fc('0xec')],_0x3f9e78[_0x86fc('0x142')]);}}};Preview[_0x86fc('0x12')]['syncDialEnd']=function(_0x19211b){if(this[_0x86fc('0x6a')][_0x19211b[_0x86fc('0xef')]]&&_0x19211b[_0x86fc('0xef')]!==_0x19211b['destuniqueid']){this[_0x86fc('0x143')](_0x19211b,_0x19211b[_0x86fc('0xef')],_0x19211b['dialstatus']);}};Preview[_0x86fc('0x12')][_0x86fc('0x21')]=function(_0x4fafe9){if(this[_0x86fc('0x6a')][_0x4fafe9[_0x86fc('0xec')]]&&_0x4fafe9['linkedid']!==_0x4fafe9[_0x86fc('0xbc')]&&!this[_0x86fc('0x6a')][_0x4fafe9[_0x86fc('0xec')]]['dialAnswer']){if(_0x4fafe9[_0x86fc('0x142')]==='1'){this[_0x86fc('0x143')](_0x4fafe9,_0x4fafe9[_0x86fc('0xec')],_0x4fafe9[_0x86fc('0x142')]);}}};Preview[_0x86fc('0x12')][_0x86fc('0x14b')]=function(_0xf63661,_0x4b8769,_0x1e2415){if(this[_0x86fc('0x6a')][_0xf63661]){if(_['isNil'](this[_0x86fc('0x6a')][_0xf63661][_0x86fc('0x14c')])){this[_0x86fc('0x6a')][_0xf63661][_0x86fc('0x14c')]={};}this['actions'][_0xf63661][_0x86fc('0x14c')][_0x4b8769]=_0x1e2415;}};Preview[_0x86fc('0x12')][_0x86fc('0x14d')]=function(_0x1ac919){try{if(!_[_0x86fc('0x69')](_0x1ac919)){if(ut[_0x86fc('0x14e')](_[_0x86fc('0x14f')](_0x1ac919['variable'])[0x0])){this[_0x86fc('0x14b')](_0x1ac919['uniqueid'],_[_0x86fc('0x14f')](_0x1ac919[_0x86fc('0x150')])[0x0],_0x1ac919[_0x86fc('0x151')]);}}}catch(_0x34a270){logger[_0x86fc('0x152')](_0x86fc('0x153'),util[_0x86fc('0x154')](_0x34a270,{'showHidden':![],'depth':null}));}};Preview[_0x86fc('0x12')][_0x86fc('0x155')]=function(_0x33839b){if(_0x33839b){if(this['actions'][_0x33839b[_0x86fc('0x156')]]){this[_0x86fc('0x6a')][_0x33839b[_0x86fc('0x156')]][_0x86fc('0x149')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0xdc40f2){if(_0xdc40f2){if(this[_0x86fc('0x6a')][_0xdc40f2[_0x86fc('0x157')]]){this[_0x86fc('0x6a')][_0xdc40f2[_0x86fc('0x157')]][_0x86fc('0x149')]=!![];}}};module[_0x86fc('0x158')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index d4cdc17..0944bb8 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 _0xf69d=['../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0xf69d,0xd3));var _0xdf69=function(_0x1436c8,_0x481609){_0x1436c8=_0x1436c8-0x0;var _0x30bb8b=_0xf69d[_0x1436c8];return _0x30bb8b;};'use strict';var util=require(_0xdf69('0x0'));var BPromise=require(_0xdf69('0x1'));var logger=require(_0xdf69('0x2'))(_0xdf69('0x3'));var _=require(_0xdf69('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xdf69('0x5'));var cmHopperHistory=require(_0xdf69('0x6'));var cmHopperBlack=require(_0xdf69('0x7'));var voiceQueueRt=require(_0xdf69('0x8'));var agentReportPreview=require(_0xdf69('0x9'));var voiceQueueReport=require(_0xdf69('0xa'));function loggerCatch(_0x2d456f){return function(_0x465b1b){logger[_0xdf69('0xb')](_0x2d456f,util[_0xdf69('0xc')](_0x465b1b,{'showHidden':![],'depth':null}));};}function create(_0x18a08e){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopperHistory[_0xdf69('0xf')](_0x18a08e))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x11')));}function createAgent(_0x1e0e8d){return BPromise['resolve']()[_0xdf69('0xe')](agentReportPreview[_0xdf69('0xf')](_0x1e0e8d))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x11')));}function moveContact(_0x43ce3d){return BPromise[_0xdf69('0xd')]()['then'](cmHopper['moveContactManagedDialer'](_0x43ce3d,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xdf69('0x12')]=function(_0xbacdc6){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopperBlack[_0xdf69('0x12')](_0xbacdc6))[_0xdf69('0x10')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xdf69('0x13')]=function(_0x42d448){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopper['getContactPreview'](_0x42d448))[_0xdf69('0x10')](loggerCatch('[getContactPreview]\x20'));};exports[_0xdf69('0xf')]=function(_0x1899a2,_0x5263a4){create(_0x1899a2)[_0xdf69('0x10')](loggerCatch(_0x5263a4));moveContact(_0x1899a2)[_0xdf69('0x10')](loggerCatch(_0x5263a4));};exports[_0xdf69('0x14')]=function(_0x85d1d,_0x59bfd2){createAgent(_0x85d1d)['catch'](loggerCatch(_0x59bfd2));};exports[_0xdf69('0x15')]=function(_0x15e73a,_0x54df73){create(_0x15e73a)[_0xdf69('0x10')](loggerCatch(_0x54df73));};exports[_0xdf69('0x16')]=function(_0x68fa80,_0x526cbc){moveContact(_0x68fa80)[_0xdf69('0x10')](loggerCatch(_0x526cbc));};exports[_0xdf69('0x17')]=function(_0x4d09d5,_0x56647c,_0x32505a){if(_0x56647c){_0x4d09d5[_0xdf69('0x18')]=null;}if(_0x32505a){_0x4d09d5[_0xdf69('0x19')]=![];}return BPromise['resolve']()['then'](cmHopper['rescheduleContact'](_0x4d09d5))[_0xdf69('0x10')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xdf69('0x1a')]=function(_0x311534){return BPromise[_0xdf69('0xd')]()['then'](cmHopper['countReScheduled'](_0x311534))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x1b')));};exports[_0xdf69('0x1c')]=function(_0x3fd933){return BPromise['resolve']()[_0xdf69('0xe')](cmHopper[_0xdf69('0x1c')]({'UserId':null},_0x3fd933,0x1))[_0xdf69('0x10')](loggerCatch('[unlockContact]\x20'));};exports[_0xdf69('0x1d')]=function(_0x5cfba9){return BPromise['resolve']()['then'](cmHopper['unlockContact']({'active':![]},_0x5cfba9,0x1))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x1e')));};exports['crateCustomerReportQueue']=function(_0x301bd2){var _0xd81d0a={};_0xd81d0a[_0xdf69('0x1f')]=_0x301bd2[_0xdf69('0x1f')];_0xd81d0a[_0xdf69('0x20')]=_0x301bd2[_0xdf69('0x20')];_0xd81d0a[_0xdf69('0x21')]=_0x301bd2[_0xdf69('0x21')];_0xd81d0a[_0xdf69('0x22')]=_0x301bd2[_0xdf69('0x22')];_0xd81d0a[_0xdf69('0x23')]=_0x301bd2[_0xdf69('0x23')];_0xd81d0a[_0xdf69('0x24')]=_0x301bd2[_0xdf69('0x25')];_0xd81d0a[_0xdf69('0x26')]=_0x301bd2[_0xdf69('0x25')];_0xd81d0a[_0xdf69('0x27')]=0x1;_0xd81d0a['queuecallercompleteAt']=_0x301bd2[_0xdf69('0x28')];_0xd81d0a[_0xdf69('0x29')]=_0x301bd2[_0xdf69('0x2a')];_0xd81d0a[_0xdf69('0x2b')]=_0xdf69('0x2c');_0xd81d0a['exten']=_0xdf69('0x2d');_0xd81d0a['holdtime']=0x0;_0xd81d0a[_0xdf69('0x2e')]=0x1;_0xd81d0a[_0xdf69('0x2f')]=_0x301bd2['membername'];_0xd81d0a[_0xdf69('0x30')]='COMPLETED';return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](voiceQueueReport[_0xdf69('0x31')](_0xd81d0a))[_0xdf69('0x10')](loggerCatch(_0xdf69('0x32')));};exports['getContactRecallMe']=function(_0x175d5a,_0x50250a){return BPromise[_0xdf69('0xd')]()[_0xdf69('0xe')](cmHopper[_0xdf69('0x33')](_0x175d5a,_0x50250a))[_0xdf69('0x10')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xdf69('0x34')]=function(_0x51f996){return BPromise[_0xdf69('0xd')]()['then'](cmHopper[_0xdf69('0x17')](_0x51f996,!![],!![]))['catch'](loggerCatch(_0xdf69('0x35')));}; \ No newline at end of file +var _0x2d17=['getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','xcally-motion-preview','holdtime','assigned','membername','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20'];(function(_0x2f54b6,_0x3cc6cb){var _0x169f21=function(_0x4dac27){while(--_0x4dac27){_0x2f54b6['push'](_0x2f54b6['shift']());}};_0x169f21(++_0x3cc6cb);}(_0x2d17,0x17e));var _0x72d1=function(_0x5e04a9,_0x32d083){_0x5e04a9=_0x5e04a9-0x0;var _0x1c0b59=_0x2d17[_0x5e04a9];return _0x1c0b59;};'use strict';var util=require(_0x72d1('0x0'));var BPromise=require(_0x72d1('0x1'));var logger=require('../../../config/logger')(_0x72d1('0x2'));var _=require(_0x72d1('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x72d1('0x4'));var cmHopperHistory=require(_0x72d1('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x72d1('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x72d1('0x7'));function loggerCatch(_0x50f551){return function(_0x139ba0){logger[_0x72d1('0x8')](_0x50f551,util['inspect'](_0x139ba0,{'showHidden':![],'depth':null}));};}function create(_0x477264){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopperHistory['createHistory'](_0x477264))[_0x72d1('0xb')](loggerCatch(_0x72d1('0xc')));}function createAgent(_0x283775){return BPromise['resolve']()[_0x72d1('0xa')](agentReportPreview[_0x72d1('0xd')](_0x283775))[_0x72d1('0xb')](loggerCatch(_0x72d1('0xc')));}function moveContact(_0x3cb9c2){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopper[_0x72d1('0xe')](_0x3cb9c2,!![]))[_0x72d1('0xb')](loggerCatch(_0x72d1('0xf')));}exports['checkIsBlackList']=function(_0x3cd1ae){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopperBlack[_0x72d1('0x10')](_0x3cd1ae))[_0x72d1('0xb')](loggerCatch(_0x72d1('0x11')));};exports[_0x72d1('0x12')]=function(_0x383bb){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopper[_0x72d1('0x12')](_0x383bb))[_0x72d1('0xb')](loggerCatch(_0x72d1('0x13')));};exports['createHistory']=function(_0x46fa3d,_0x5262b0){create(_0x46fa3d)[_0x72d1('0xb')](loggerCatch(_0x5262b0));moveContact(_0x46fa3d)[_0x72d1('0xb')](loggerCatch(_0x5262b0));};exports['createAgentHistory']=function(_0x1061b7,_0x1cbb45){createAgent(_0x1061b7)[_0x72d1('0xb')](loggerCatch(_0x1cbb45));};exports['createCustomerHistory']=function(_0x4925f6,_0x313d7b){create(_0x4925f6)[_0x72d1('0xb')](loggerCatch(_0x313d7b));};exports[_0x72d1('0x14')]=function(_0x1865c1,_0x8d6890){moveContact(_0x1865c1)[_0x72d1('0xb')](loggerCatch(_0x8d6890));};exports[_0x72d1('0x15')]=function(_0x5c7982,_0x1c695c,_0x56e8d3){if(_0x1c695c){_0x5c7982['UserId']=null;}if(_0x56e8d3){_0x5c7982['active']=![];}return BPromise['resolve']()[_0x72d1('0xa')](cmHopper[_0x72d1('0x15')](_0x5c7982))['catch'](loggerCatch(_0x72d1('0x16')));};exports[_0x72d1('0x17')]=function(_0x492086){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopper['countReScheduled'](_0x492086))['catch'](loggerCatch(_0x72d1('0x18')));};exports[_0x72d1('0x19')]=function(_0x2f661){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopper[_0x72d1('0x19')]({'UserId':null},_0x2f661,0x1))[_0x72d1('0xb')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x1ba258){return BPromise['resolve']()[_0x72d1('0xa')](cmHopper[_0x72d1('0x19')]({'active':![]},_0x1ba258,0x1))[_0x72d1('0xb')](loggerCatch('[activeContact]\x20'));};exports[_0x72d1('0x1a')]=function(_0x4c4c41){var _0x707cd0={};_0x707cd0[_0x72d1('0x1b')]=_0x4c4c41[_0x72d1('0x1b')];_0x707cd0[_0x72d1('0x1c')]=_0x4c4c41['uniqueid'];_0x707cd0[_0x72d1('0x1d')]=_0x4c4c41['calleridnum'];_0x707cd0[_0x72d1('0x1e')]=_0x4c4c41[_0x72d1('0x1e')];_0x707cd0['queue']=_0x4c4c41[_0x72d1('0x1f')];_0x707cd0[_0x72d1('0x20')]=_0x4c4c41[_0x72d1('0x21')];_0x707cd0[_0x72d1('0x22')]=_0x4c4c41[_0x72d1('0x21')];_0x707cd0['queuecallercomplete']=0x1;_0x707cd0[_0x72d1('0x23')]=_0x4c4c41[_0x72d1('0x24')];_0x707cd0[_0x72d1('0x25')]=_0x4c4c41['membername'];_0x707cd0[_0x72d1('0x26')]=_0x72d1('0x27');_0x707cd0['exten']=_0x72d1('0x28');_0x707cd0[_0x72d1('0x29')]=0x0;_0x707cd0[_0x72d1('0x2a')]=0x1;_0x707cd0['lastAssignedTo']=_0x4c4c41[_0x72d1('0x2b')];_0x707cd0['queuecallerexitreason']=_0x72d1('0x2c');return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](voiceQueueReport[_0x72d1('0x2d')](_0x707cd0))[_0x72d1('0xb')](loggerCatch(_0x72d1('0x2e')));};exports[_0x72d1('0x2f')]=function(_0xb32ca6,_0x4006b9){return BPromise[_0x72d1('0x9')]()[_0x72d1('0xa')](cmHopper['getContactRecallMe'](_0xb32ca6,_0x4006b9))[_0x72d1('0xb')](loggerCatch(_0x72d1('0x30')));};exports[_0x72d1('0x31')]=function(_0x325209){return BPromise['resolve']()[_0x72d1('0xa')](cmHopper[_0x72d1('0x15')](_0x325209,!![],!![]))[_0x72d1('0xb')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index c24cde4..0511610 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 _0x762e=['addVariables','Queue','name','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','originate','channelAgent','calleridnum','timeout','uniqueid','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','queue','interface','buildAcw','agentReadyId','not_inuse','status','push','CampaignId','idContact','type','campaigntype','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-phone','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>'];(function(_0x1e4c84,_0x154e15){var _0x1161af=function(_0x3f9483){while(--_0x3f9483){_0x1e4c84['push'](_0x1e4c84['shift']());}};_0x1161af(++_0x154e15);}(_0x762e,0xea));var _0xe762=function(_0x6a474,_0x3b8732){_0x6a474=_0x6a474-0x0;var _0x4c65a6=_0x762e[_0x6a474];return _0x4c65a6;};'use strict';var util=require(_0xe762('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xe762('0x1'))('preview');var ipAgi=process['env'][_0xe762('0x2')]||_0xe762('0x3');function getSeconds(_0x2a390a,_0x59723c){var _0xe78ccf=moment(_0x2a390a)[_0xe762('0x4')](0x0);var _0x48995a=moment(_0x59723c)['milliseconds'](0x0);return _0xe78ccf[_0xe762('0x5')](_0x48995a,_0xe762('0x6'));}exports[_0xe762('0x7')]=function(_0xf20548){return function(_0x26a4fc){logger[_0xe762('0x8')](_0xf20548,util['inspect'](_0x26a4fc,{'showHidden':![],'depth':null}));};};exports[_0xe762('0x9')]=function(_0x2c0793,_0x177ad9){logger[_0xe762('0xa')](_0x2c0793,util[_0xe762('0xb')](_0x177ad9,{'showHidden':![],'depth':null}));};exports[_0xe762('0xc')]=function(_0x224a19,_0x4938e5){logger[_0xe762('0x8')](_0x224a19,util[_0xe762('0xb')](_0x4938e5,{'showHidden':![],'depth':null}));};exports[_0xe762('0xd')]=function(_0x4a7d2f){return function(_0x340573){logger['info'](_0x4a7d2f,util[_0xe762('0xb')](_0x340573,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x12d8d8,_0x25a6cf,_0x1ebf3d){return{'message':_0x12d8d8,'unlock':_0x25a6cf,'active':_0x1ebf3d};};exports['getCallerId']=function(_0x50aa09,_0x35be11,_0x417be3){if(!_[_0xe762('0xe')](_0x417be3)&&_0xe762('0xf')===typeof _0x417be3&&!_[_0xe762('0x10')](_0x417be3)){if(!_[_0xe762('0xe')](_0x35be11)&&_0xe762('0xf')===typeof _0x35be11&&!_[_0xe762('0x10')](_0x35be11)){return util['format'](_0xe762('0x11'),_0x35be11,_0x417be3);}return util[_0xe762('0x12')](_0xe762('0x11'),_0x417be3,_0x417be3);}if(!_[_0xe762('0xe')](_0x50aa09)&&'string'===typeof _0x50aa09&&!_[_0xe762('0x10')](_0x50aa09)){return _0x50aa09;}return _0xe762('0x13');};exports['isActive']=function(_0x5c6350){if(_['isNil'](_0x5c6350)){return![];}return _0x5c6350;};exports[_0xe762('0x14')]=function(_0x5505b1,_0x428a59,_0x5bd84e,_0x8775aa,_0x57ad0d,_0x11ad31){var _0x190aa3={'XMD-QUEUE':_0x428a59[_0xe762('0x15')]?_0x428a59[_0xe762('0x15')][_0xe762('0x16')]:'','XMD-CALLERID':_0x8775aa,'XMD-CALLERID-PREVIEW':_0x11ad31?util['format']('\x22%s\x22\x20<%s>',_0x11ad31['calleridname'],_0x11ad31['calleridnum']):_0x8775aa,'XMD-DIALID':_0x57ad0d,'XMD-CONTACTID':_0x428a59[_0xe762('0x17')],'XMD-CDRTYPE':_0xe762('0x18'),'CALLERID(all)':_0x8775aa,'XMD-VOICEQUEUEID':_0x428a59[_0xe762('0x19')],'XMD-DIALCHANNEL':_0x5bd84e,'XMD-DIALTIMEOUT':_0x5505b1[_0xe762('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0xe762('0x12')]('\x22rtTxX%s%s\x22',_0x5505b1[_0xe762('0x1b')]?'g':'',_[_0xe762('0x10')](_0x5505b1[_0xe762('0x1c')])?'':_0xe762('0x1d')),'XMD-DIALURL':_0x5505b1[_0xe762('0x1e')]||'','XMD-AGI':_0x5505b1[_0xe762('0x1f')]?util[_0xe762('0x12')](_0xe762('0x20'),ipAgi,_0x5505b1[_0xe762('0x1f')]):_0xe762('0x21'),'XMD-AGIAFTER':_0x5505b1[_0xe762('0x1b')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x5505b1[_0xe762('0x1b')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x11ad31?_0x11ad31[_0xe762('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x11ad31?_0x11ad31[_0xe762('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xe762('0x10')](_0x5505b1[_0xe762('0x1c')])){_0x190aa3[util[_0xe762('0x12')]('%s',_0xe762('0x24'))]=_0x5505b1[_0xe762('0x1c')];_0x190aa3[util[_0xe762('0x12')]('%s',_0xe762('0x25'))]=_0x57ad0d;}if(_0x428a59&&_0x428a59[_0xe762('0x26')]){for(var _0x26dbd3 in _0x428a59[_0xe762('0x26')]){if(_0x428a59['Contact'][_0xe762('0x27')](_0x26dbd3)){if(!_[_0xe762('0x28')](_0x428a59[_0xe762('0x26')][_0x26dbd3])&&_0x26dbd3!=='id'&&_0x26dbd3!==_0xe762('0x29')&&_0x26dbd3!==_0xe762('0x2a')&&_0x26dbd3!==_0xe762('0x2b')){_0x190aa3[util[_0xe762('0x12')](_0xe762('0x2c'),'XMD-',_['toUpper'](_0x26dbd3))]=_0x428a59[_0xe762('0x26')][_0x26dbd3];}}}}return _0x190aa3;};exports[_0xe762('0x2d')]=function(_0x105941){var _0x31a9d9={};for(var _0x1e8c3f in _0x105941){if(_0x105941[_0xe762('0x27')](_0x1e8c3f)){_0x31a9d9[util[_0xe762('0x12')]('%s',_['toLower'](_0x1e8c3f))]=_0x105941[_0x1e8c3f];}}return{'variables':_0x31a9d9};};exports[_0xe762('0x2e')]=function(_0x1c0821,_0xc4f64e){if(!_['isNil'](_0x1c0821)){if(_0x1c0821[_0xe762('0x27')](_0xe762('0x2f'))){if(_0x1c0821[_0xe762('0x2f')]>0x0){_0x1c0821[_0xe762('0x2f')]-=0x1;}else{logger[_0xe762('0x8')](_0xe762('0x30'),_0xc4f64e);}}}else{logger[_0xe762('0x8')](_0xe762('0x31'),_0xc4f64e);}};exports[_0xe762('0x32')]=function(_0x46f7cd){var _0x4e6fa9=moment()[_0xe762('0x12')](_0xe762('0x33'));_0x46f7cd[_0xe762('0x34')]=0xd;_0x46f7cd[_0xe762('0x35')]=_0xe762('0x36');_0x46f7cd[_0xe762('0x37')]=_0x4e6fa9;_0x46f7cd[_0xe762('0x38')]=_0x4e6fa9;_0x46f7cd[_0xe762('0x39')]=_0x4e6fa9;};exports[_0xe762('0x3a')]=function(_0x45872b,_0xafa2d6,_0x45c131){var _0xa7cb9c=moment()[_0xe762('0x12')](_0xe762('0x33'));_0x45872b[_0xe762('0x34')]=_0xafa2d6;_0x45872b[_0xe762('0x35')]=_0x45c131;_0x45872b[_0xe762('0x38')]=_0xa7cb9c;_0x45872b[_0xe762('0x3b')]=getSeconds(_0x45872b[_0xe762('0x38')],_0x45872b[_0xe762('0x37')]);};exports['logLookAgent']=function(_0x5abccb,_0x19cfb0,_0xfafbf3){_0x5abccb[_0xe762('0x3c')]=_0x19cfb0;_0x5abccb[_0xe762('0x3d')]=_0xfafbf3;};exports[_0xe762('0x3e')]=function(_0x2a5b71,_0x3c7755,_0x43fe46){var _0x394f46=moment()[_0xe762('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a5b71['state']=_0x3c7755;_0x2a5b71[_0xe762('0x35')]=_0x43fe46;_0x2a5b71[_0xe762('0x38')]=_0x2a5b71['responsetime']?_0x2a5b71[_0xe762('0x38')]:_0x394f46;_0x2a5b71[_0xe762('0x39')]=_0x2a5b71[_0xe762('0x39')]?_0x2a5b71[_0xe762('0x39')]:_0x394f46;_0x2a5b71['ringtime']=getSeconds(_0x2a5b71['responsetime']||0x0,_0x2a5b71[_0xe762('0x37')]||0x0);_0x2a5b71[_0xe762('0x3f')]=_0x2a5b71['answertime']?getSeconds(_0x2a5b71[_0xe762('0x39')],_0x2a5b71[_0xe762('0x40')]):0x0;};exports[_0xe762('0x41')]=function(_0x3f6848){return _0x3f6848===_0xe762('0x42');};exports[_0xe762('0x43')]=function(_0x435005,_0x163bd4,_0x281398,_0x3efbad,_0x15a9ea){var _0xcaf61f=_0x3efbad?_0xe762('0x44'):_0x435005['calleridname'];_0xcaf61f=_0x15a9ea?'BOOKED':_0xcaf61f;return{'actionid':_0x435005['uniqueid'],'action':_0xe762('0x45'),'channel':_0x435005[_0xe762('0x46')],'callerid':util[_0xe762('0x12')](_0xe762('0x11'),_0xcaf61f,_0x435005[_0xe762('0x47')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x281398,'timeout':(_0x163bd4[_0xe762('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x435005[_0xe762('0x49')]};};exports['totalGlobal']=function(_0xec8de2){return _0xec8de2['countbusyretry']+_0xec8de2['countcongestionretry']+_0xec8de2[_0xe762('0x4a')]+_0xec8de2[_0xe762('0x4b')]+_0xec8de2['countnosuchnumberretry'];};exports[_0xe762('0x4c')]=function(_0x2b3b1d){var _0x26d591=_[_0xe762('0x4d')](_0x2b3b1d);_0x26d591['state']=0xf;_0x26d591[_0xe762('0x35')]=_0xe762('0x4e');return _0x26d591;};exports['scheduledAt']=function(_0x2eb2fb,_0x8be01b,_0x101db6){var _0x23447d={};_0x23447d[_0x8be01b]=_0x2eb2fb[_0x8be01b];_0x23447d[_0xe762('0x4f')]=![];_0x23447d[_0xe762('0x50')]=moment()['add'](_0x101db6,_0xe762('0x51'))[_0xe762('0x12')](_0xe762('0x33'));_0x23447d[_0xe762('0x17')]=_0x2eb2fb['ContactId'];_0x23447d[_0xe762('0x52')]=_0x2eb2fb['ListId'];_0x23447d[_0xe762('0x19')]=_0x2eb2fb[_0xe762('0x19')]||undefined;return _0x23447d;};exports[_0xe762('0x53')]=function(_0x39c92d,_0x142c08){if(!_[_0xe762('0x28')](_0x39c92d)){if(_0x39c92d[_0xe762('0x54')]>0x0){_0x39c92d[_0xe762('0x54')]-=0x1;}else{logger[_0xe762('0x8')](_0x142c08,_0xe762('0x55'));}}else{logger[_0xe762('0x8')](_0x142c08,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xe762('0x56')]=function(_0x253bb6){if(_0x253bb6<=0x0){return!![];}return![];};exports[_0xe762('0x57')]=function(_0xa82691,_0x4f1fea){_0xa82691[_0xe762('0x58')]=_0x4f1fea;_0xa82691[_0xe762('0x16')]=_0xa82691[_0xe762('0x59')];_0xa82691[_0xe762('0x5a')]=_0xa82691[_0xe762('0x46')];return _0xa82691;};exports[_0xe762('0x5b')]=function(_0x3346dd){var _0x206b11={};_0x206b11[_0xe762('0x59')]=_0x3346dd[_0xe762('0x59')];_0x206b11['interface']=_0x3346dd[_0xe762('0x46')];_0x206b11[_0xe762('0x49')]=_0x3346dd[_0xe762('0x49')];return _0x206b11;};exports[_0xe762('0x5c')]=function(_0xfbc228){var _0x4168e7=[];for(var _0x3de12d in _0xfbc228){if(_0xfbc228[_0xe762('0x27')](_0x3de12d)){if(!_['isNil'](_0xfbc228[_0x3de12d])&&_0xfbc228[_0x3de12d]['state']===_0xe762('0x5d')&&_0xfbc228[_0x3de12d][_0xe762('0x5e')]==='reachable'){_0x4168e7[_0xe762('0x5f')](_0xfbc228[_0x3de12d]['id']);}}}return _0x4168e7;};exports['getDiff']=function(_0x195572){var _0x9a3925=moment()[_0xe762('0x4')](0x0);var _0x1de7f4=moment(_0x195572)[_0xe762('0x4')](0x0);return _0x9a3925[_0xe762('0x5')](_0x1de7f4,_0xe762('0x6'));};exports['createBody']=function(_0x5b4bf7){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5b4bf7[_0xe762('0x17')],'ListId':_0x5b4bf7['ListId'],'VoiceQueueId':_0x5b4bf7[_0xe762('0x19')]||undefined,'CampaignId':_0x5b4bf7[_0xe762('0x60')]||undefined};};exports['filterKey']=function(_0x2b8575){if(_0x2b8575===_0xe762('0x49')||_0x2b8575===_0xe762('0x61')||_0x2b8575===_0xe762('0x59')||_0x2b8575===_0xe762('0x62')||_0x2b8575===_0xe762('0x63')||_0x2b8575==='dialAnswer'||_0x2b8575===_0xe762('0x3c')||_0x2b8575===_0xe762('0x46')||_0x2b8575==='calleridname'||_0x2b8575===_0xe762('0x4f')||_0x2b8575===_0xe762('0x47')||_0x2b8575===_0xe762('0x50')||_0x2b8575==='countbusyretry'||_0x2b8575==='countcongestionretry'||_0x2b8575===_0xe762('0x4a')||_0x2b8575==='countglobal'||_0x2b8575===_0xe762('0x64')||_0x2b8575===_0xe762('0x65')||_0x2b8575===_0xe762('0x66')||_0x2b8575==='recallme'||_0x2b8575===_0xe762('0x17')||_0x2b8575==='ListId'||_0x2b8575==='UserId'||_0x2b8575===_0xe762('0x19')||_0x2b8575===_0xe762('0x67')||_0x2b8575==='xmd-voicequeueid'||_0x2b8575===_0xe762('0x68')||_0x2b8575===_0xe762('0x69')||_0x2b8575==='xmd-listid'||_0x2b8575==='xmd-dialurl'||_0x2b8575==='xmd-dialtimeout'||_0x2b8575==='xmd-dialoptions'||_0x2b8575===_0xe762('0x6a')||_0x2b8575==='xmd-dialchannel'||_0x2b8575===_0xe762('0x6b')||_0x2b8575===_0xe762('0x6c')||_0x2b8575===_0xe762('0x6d')||_0x2b8575===_0xe762('0x6e')||_0x2b8575===_0xe762('0x6f')||_0x2b8575===_0xe762('0x70')||_0x2b8575===_0xe762('0x71')||_0x2b8575===_0xe762('0x72')||_0x2b8575===_0xe762('0x73')||_0x2b8575==='rtpaudioqosloss'||_0x2b8575===_0xe762('0x74')||_0x2b8575==='rtpaudioqosrtt'||_0x2b8575===_0xe762('0x75')||_0x2b8575===_0xe762('0x70')||_0x2b8575===_0xe762('0x71')||_0x2b8575===_0xe762('0x72')||_0x2b8575===_0xe762('0x73')||_0x2b8575==='rtpaudioqosloss'||_0x2b8575===_0xe762('0x74')||_0x2b8575===_0xe762('0x76')||_0x2b8575===_0xe762('0x75')||_0x2b8575==='bridgepeer'||_0x2b8575===_0xe762('0x77')||_0x2b8575===_0xe762('0x34')||_0x2b8575==='statedesc'){return![];}return!![];};exports[_0xe762('0x78')]=function(_0x376d59,_0x47ae3e){var _0x5bd363,_0x4da689,_0x2ac902;if(_0x47ae3e<=0x0){_0x47ae3e=0x1;}_0x5bd363=new RegExp('\x5cw{0,'+_0x47ae3e+'}$');_0x4da689=Math[_0xe762('0x79')](0xa,_0x47ae3e-0x1);_0x2ac902=Math[_0xe762('0x79')](0xa,_0x47ae3e)-0x1;return util[_0xe762('0x12')]('%s',_[_0xe762('0x7a')](_0x376d59,_0x5bd363,_[_0xe762('0x7b')](_0x4da689,_0x2ac902)));};exports[_0xe762('0x7c')]=function(_0x730b1d){var _0x226180=_0x730b1d[_0xe762('0x7d')](/"(.*?)"/);return _0x226180?_0x226180[0x1]:_0x730b1d;};exports[_0xe762('0x7e')]=function(_0x370da0){var _0x5597d7=_0x370da0[_0xe762('0x7d')](/<(.*?)>/);return _0x5597d7?_0x5597d7[0x1]:_0x370da0;}; \ No newline at end of file +var _0xa1c5=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','random','match','extractCalleridNumber','util','lodash','moment','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','info','loggerError','message','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','endtime','state','ringtime','starttime','logLookAgent','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','queue','buildAcw','not_inuse','status','reachable','seconds','CampaignId','filterKey','idContact','dialAnswer','membername','countcongestionretry','callback','callbackuniqueid','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi'];(function(_0x2c85fc,_0x423f2b){var _0x2699f5=function(_0x274e22){while(--_0x274e22){_0x2c85fc['push'](_0x2c85fc['shift']());}};_0x2699f5(++_0x423f2b);}(_0xa1c5,0x96));var _0x5a1c=function(_0x2d8401,_0x14e32a){_0x2d8401=_0x2d8401-0x0;var _0x20bf25=_0xa1c5[_0x2d8401];return _0x20bf25;};'use strict';var util=require(_0x5a1c('0x0'));var _=require(_0x5a1c('0x1'));var moment=require(_0x5a1c('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x5a1c('0x3')][_0x5a1c('0x4')]||_0x5a1c('0x5');function getSeconds(_0x4e7fcd,_0xc4a79e){var _0x2e62cc=moment(_0x4e7fcd)[_0x5a1c('0x6')](0x0);var _0x5a16d2=moment(_0xc4a79e)[_0x5a1c('0x6')](0x0);return _0x2e62cc[_0x5a1c('0x7')](_0x5a16d2,'seconds');}exports[_0x5a1c('0x8')]=function(_0x5c3668){return function(_0x33a532){logger[_0x5a1c('0x9')](_0x5c3668,util[_0x5a1c('0xa')](_0x33a532,{'showHidden':![],'depth':null}));};};exports[_0x5a1c('0xb')]=function(_0x263cd8,_0x5e6568){logger[_0x5a1c('0xc')](_0x263cd8,util['inspect'](_0x5e6568,{'showHidden':![],'depth':null}));};exports[_0x5a1c('0xd')]=function(_0x25a201,_0x497e53){logger[_0x5a1c('0x9')](_0x25a201,util[_0x5a1c('0xa')](_0x497e53,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0xa94ed5){return function(_0x307279){logger['info'](_0xa94ed5,util[_0x5a1c('0xa')](_0x307279,{'showHidden':![],'depth':null}));};};exports[_0x5a1c('0xe')]=function(_0x53bbde,_0x5acb82,_0x31025d){return{'message':_0x53bbde,'unlock':_0x5acb82,'active':_0x31025d};};exports['getCallerId']=function(_0x3318c2,_0x3491c5,_0x133368){if(!_['isUndefined'](_0x133368)&&'string'===typeof _0x133368&&!_[_0x5a1c('0xf')](_0x133368)){if(!_[_0x5a1c('0x10')](_0x3491c5)&&_0x5a1c('0x11')===typeof _0x3491c5&&!_[_0x5a1c('0xf')](_0x3491c5)){return util[_0x5a1c('0x12')]('\x22%s\x22\x20<%s>',_0x3491c5,_0x133368);}return util[_0x5a1c('0x12')](_0x5a1c('0x13'),_0x133368,_0x133368);}if(!_[_0x5a1c('0x10')](_0x3318c2)&&_0x5a1c('0x11')===typeof _0x3318c2&&!_[_0x5a1c('0xf')](_0x3318c2)){return _0x3318c2;}return'\x22\x22\x20<>';};exports[_0x5a1c('0x14')]=function(_0x3e2a9f){if(_[_0x5a1c('0x15')](_0x3e2a9f)){return![];}return _0x3e2a9f;};exports[_0x5a1c('0x16')]=function(_0x493073,_0xfeb722,_0x341d40,_0x12d565,_0x1ecea4,_0x5161d4){var _0x29eb79={'XMD-QUEUE':_0xfeb722[_0x5a1c('0x17')]?_0xfeb722[_0x5a1c('0x17')][_0x5a1c('0x18')]:'','XMD-CALLERID':_0x12d565,'XMD-CALLERID-PREVIEW':_0x5161d4?util[_0x5a1c('0x12')]('\x22%s\x22\x20<%s>',_0x5161d4[_0x5a1c('0x19')],_0x5161d4[_0x5a1c('0x1a')]):_0x12d565,'XMD-DIALID':_0x1ecea4,'XMD-CONTACTID':_0xfeb722[_0x5a1c('0x1b')],'XMD-CDRTYPE':_0x5a1c('0x1c'),'CALLERID(all)':_0x12d565,'XMD-VOICEQUEUEID':_0xfeb722[_0x5a1c('0x1d')],'XMD-DIALCHANNEL':_0x341d40,'XMD-DIALTIMEOUT':_0x493073[_0x5a1c('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x5a1c('0x12')](_0x5a1c('0x1f'),_0x493073[_0x5a1c('0x20')]?'g':'',_['isEmpty'](_0x493073[_0x5a1c('0x21')])?'':_0x5a1c('0x22')),'XMD-DIALURL':_0x493073[_0x5a1c('0x23')]||'','XMD-AGI':_0x493073[_0x5a1c('0x24')]?util[_0x5a1c('0x12')](_0x5a1c('0x25'),ipAgi,_0x493073[_0x5a1c('0x24')]):_0x5a1c('0x26'),'XMD-AGIAFTER':_0x493073[_0x5a1c('0x20')]?util[_0x5a1c('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x493073[_0x5a1c('0x20')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x5161d4?_0x5161d4[_0x5a1c('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x5161d4?_0x5161d4[_0x5a1c('0x28')]:'','XMD-DESTINATION':_0x5a1c('0x29')};if(!_['isEmpty'](_0x493073[_0x5a1c('0x21')])){_0x29eb79[util[_0x5a1c('0x12')]('%s',_0x5a1c('0x2a'))]=_0x493073['monitor_format'];_0x29eb79[util['format']('%s',_0x5a1c('0x2b'))]=_0x1ecea4;}if(_0xfeb722&&_0xfeb722[_0x5a1c('0x2c')]){for(var _0x5a6490 in _0xfeb722[_0x5a1c('0x2c')]){if(_0xfeb722[_0x5a1c('0x2c')][_0x5a1c('0x2d')](_0x5a6490)){if(!_[_0x5a1c('0x15')](_0xfeb722[_0x5a1c('0x2c')][_0x5a6490])&&_0x5a6490!=='id'&&_0x5a6490!==_0x5a1c('0x2e')&&_0x5a6490!==_0x5a1c('0x2f')&&_0x5a6490!==_0x5a1c('0x30')){_0x29eb79[util[_0x5a1c('0x12')](_0x5a1c('0x31'),_0x5a1c('0x32'),_[_0x5a1c('0x33')](_0x5a6490))]=_0xfeb722[_0x5a1c('0x2c')][_0x5a6490];}}}}return _0x29eb79;};exports[_0x5a1c('0x34')]=function(_0x211616){var _0xe1f1d8={};for(var _0x1e471c in _0x211616){if(_0x211616[_0x5a1c('0x2d')](_0x1e471c)){_0xe1f1d8[util[_0x5a1c('0x12')]('%s',_['toLower'](_0x1e471c))]=_0x211616[_0x1e471c];}}return{'variables':_0xe1f1d8};};exports[_0x5a1c('0x35')]=function(_0x2fbe3d,_0x9f25f7){if(!_[_0x5a1c('0x15')](_0x2fbe3d)){if(_0x2fbe3d[_0x5a1c('0x2d')](_0x5a1c('0x36'))){if(_0x2fbe3d['originated']>0x0){_0x2fbe3d[_0x5a1c('0x36')]-=0x1;}else{logger[_0x5a1c('0x9')](_0x5a1c('0x37'),_0x9f25f7);}}}else{logger[_0x5a1c('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x9f25f7);}};exports['logBlacklist']=function(_0x568d84){var _0x283594=moment()[_0x5a1c('0x12')](_0x5a1c('0x38'));_0x568d84['state']=0xd;_0x568d84[_0x5a1c('0x39')]=_0x5a1c('0x3a');_0x568d84['starttime']=_0x283594;_0x568d84[_0x5a1c('0x3b')]=_0x283594;_0x568d84[_0x5a1c('0x3c')]=_0x283594;};exports['logAgent']=function(_0x1d892f,_0x455388,_0x56e1bc){var _0x36ecda=moment()[_0x5a1c('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d892f[_0x5a1c('0x3d')]=_0x455388;_0x1d892f[_0x5a1c('0x39')]=_0x56e1bc;_0x1d892f[_0x5a1c('0x3b')]=_0x36ecda;_0x1d892f[_0x5a1c('0x3e')]=getSeconds(_0x1d892f[_0x5a1c('0x3b')],_0x1d892f[_0x5a1c('0x3f')]);};exports[_0x5a1c('0x40')]=function(_0x57936f,_0x5bc833,_0x5214b2){_0x57936f['membername']=_0x5bc833;_0x57936f['UserId']=_0x5214b2;};exports[_0x5a1c('0x41')]=function(_0x525089,_0x1b6fa2,_0x149890){var _0xaca53b=moment()[_0x5a1c('0x12')](_0x5a1c('0x38'));_0x525089[_0x5a1c('0x3d')]=_0x1b6fa2;_0x525089['statedesc']=_0x149890;_0x525089[_0x5a1c('0x3b')]=_0x525089[_0x5a1c('0x3b')]?_0x525089[_0x5a1c('0x3b')]:_0xaca53b;_0x525089[_0x5a1c('0x3c')]=_0x525089[_0x5a1c('0x3c')]?_0x525089[_0x5a1c('0x3c')]:_0xaca53b;_0x525089[_0x5a1c('0x3e')]=getSeconds(_0x525089[_0x5a1c('0x3b')]||0x0,_0x525089['starttime']||0x0);_0x525089[_0x5a1c('0x42')]=_0x525089[_0x5a1c('0x43')]?getSeconds(_0x525089['endtime'],_0x525089[_0x5a1c('0x43')]):0x0;};exports['isFailure']=function(_0x2ee685){return _0x2ee685===_0x5a1c('0x44');};exports[_0x5a1c('0x45')]=function(_0x4ec68d,_0xa8f3f6,_0x3f3294,_0x233de0,_0x1f999d){var _0x4f1271=_0x233de0?_0x5a1c('0x46'):_0x4ec68d[_0x5a1c('0x19')];_0x4f1271=_0x1f999d?_0x5a1c('0x47'):_0x4f1271;return{'actionid':_0x4ec68d[_0x5a1c('0x48')],'action':_0x5a1c('0x49'),'channel':_0x4ec68d[_0x5a1c('0x4a')],'callerid':util[_0x5a1c('0x12')](_0x5a1c('0x13'),_0x4f1271,_0x4ec68d[_0x5a1c('0x1a')]),'Exten':_0x5a1c('0x29'),'Context':_0x5a1c('0x4b'),'Priority':'1','variable':_0x3f3294,'timeout':(_0xa8f3f6['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4ec68d['uniqueid']};};exports[_0x5a1c('0x4c')]=function(_0x1450f8){return _0x1450f8['countbusyretry']+_0x1450f8['countcongestionretry']+_0x1450f8['countnoanswerretry']+_0x1450f8[_0x5a1c('0x4d')]+_0x1450f8['countnosuchnumberretry'];};exports[_0x5a1c('0x4e')]=function(_0x2be50d){var _0x4c5809=_[_0x5a1c('0x4f')](_0x2be50d);_0x4c5809[_0x5a1c('0x3d')]=0xf;_0x4c5809[_0x5a1c('0x39')]=_0x5a1c('0x50');return _0x4c5809;};exports[_0x5a1c('0x51')]=function(_0x4a9ae4,_0x593b0b,_0x2c7fee){var _0x43d38f={};_0x43d38f[_0x593b0b]=_0x4a9ae4[_0x593b0b];_0x43d38f[_0x5a1c('0x52')]=![];_0x43d38f[_0x5a1c('0x53')]=moment()[_0x5a1c('0x54')](_0x2c7fee,_0x5a1c('0x55'))[_0x5a1c('0x12')](_0x5a1c('0x38'));_0x43d38f[_0x5a1c('0x1b')]=_0x4a9ae4['ContactId'];_0x43d38f[_0x5a1c('0x56')]=_0x4a9ae4[_0x5a1c('0x56')];_0x43d38f[_0x5a1c('0x1d')]=_0x4a9ae4[_0x5a1c('0x1d')]||undefined;return _0x43d38f;};exports[_0x5a1c('0x57')]=function(_0x3dec47,_0x22089a){if(!_['isNil'](_0x3dec47)){if(_0x3dec47[_0x5a1c('0x58')]>0x0){_0x3dec47[_0x5a1c('0x58')]-=0x1;}else{logger['error'](_0x22089a,_0x5a1c('0x59'));}}else{logger[_0x5a1c('0x9')](_0x22089a,_0x5a1c('0x5a'));}};exports['IsNotLoggedIn']=function(_0x3c000f){if(_0x3c000f<=0x0){return!![];}return![];};exports[_0x5a1c('0x5b')]=function(_0x46ead5,_0x56c2f4){_0x46ead5[_0x5a1c('0x5c')]=_0x56c2f4;_0x46ead5[_0x5a1c('0x18')]=_0x46ead5[_0x5a1c('0x5d')];_0x46ead5['interface']=_0x46ead5[_0x5a1c('0x4a')];return _0x46ead5;};exports[_0x5a1c('0x5e')]=function(_0x58bc4e){var _0x279849={};_0x279849[_0x5a1c('0x5d')]=_0x58bc4e['queue'];_0x279849['interface']=_0x58bc4e[_0x5a1c('0x4a')];_0x279849['uniqueid']=_0x58bc4e[_0x5a1c('0x48')];return _0x279849;};exports['agentReadyId']=function(_0x20d8bd){var _0x379f88=[];for(var _0x2215d2 in _0x20d8bd){if(_0x20d8bd[_0x5a1c('0x2d')](_0x2215d2)){if(!_[_0x5a1c('0x15')](_0x20d8bd[_0x2215d2])&&_0x20d8bd[_0x2215d2][_0x5a1c('0x3d')]===_0x5a1c('0x5f')&&_0x20d8bd[_0x2215d2][_0x5a1c('0x60')]===_0x5a1c('0x61')){_0x379f88['push'](_0x20d8bd[_0x2215d2]['id']);}}}return _0x379f88;};exports['getDiff']=function(_0x5ce8ba){var _0x3a8566=moment()[_0x5a1c('0x6')](0x0);var _0x4cb0fe=moment(_0x5ce8ba)[_0x5a1c('0x6')](0x0);return _0x3a8566[_0x5a1c('0x7')](_0x4cb0fe,_0x5a1c('0x62'));};exports['createBody']=function(_0x58e474){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x58e474[_0x5a1c('0x1b')],'ListId':_0x58e474[_0x5a1c('0x56')],'VoiceQueueId':_0x58e474['VoiceQueueId']||undefined,'CampaignId':_0x58e474[_0x5a1c('0x63')]||undefined};};exports[_0x5a1c('0x64')]=function(_0x503f49){if(_0x503f49===_0x5a1c('0x48')||_0x503f49===_0x5a1c('0x65')||_0x503f49==='queue'||_0x503f49==='type'||_0x503f49==='campaigntype'||_0x503f49===_0x5a1c('0x66')||_0x503f49===_0x5a1c('0x67')||_0x503f49===_0x5a1c('0x4a')||_0x503f49===_0x5a1c('0x19')||_0x503f49===_0x5a1c('0x52')||_0x503f49===_0x5a1c('0x1a')||_0x503f49==='scheduledat'||_0x503f49==='countbusyretry'||_0x503f49===_0x5a1c('0x68')||_0x503f49==='countnoanswerretry'||_0x503f49==='countglobal'||_0x503f49===_0x5a1c('0x69')||_0x503f49===_0x5a1c('0x6a')||_0x503f49==='callbackat'||_0x503f49==='recallme'||_0x503f49===_0x5a1c('0x1b')||_0x503f49===_0x5a1c('0x56')||_0x503f49==='UserId'||_0x503f49==='VoiceQueueId'||_0x503f49===_0x5a1c('0x6b')||_0x503f49==='xmd-voicequeueid'||_0x503f49===_0x5a1c('0x6c')||_0x503f49===_0x5a1c('0x6d')||_0x503f49===_0x5a1c('0x6e')||_0x503f49===_0x5a1c('0x6f')||_0x503f49===_0x5a1c('0x70')||_0x503f49===_0x5a1c('0x71')||_0x503f49==='xmd-dialid'||_0x503f49==='xmd-dialchannel'||_0x503f49===_0x5a1c('0x72')||_0x503f49==='xmd-cdrtype'||_0x503f49===_0x5a1c('0x73')||_0x503f49===_0x5a1c('0x74')||_0x503f49===_0x5a1c('0x75')||_0x503f49===_0x5a1c('0x76')||_0x503f49===_0x5a1c('0x77')||_0x503f49===_0x5a1c('0x78')||_0x503f49===_0x5a1c('0x79')||_0x503f49===_0x5a1c('0x7a')||_0x503f49==='rtpaudioqoslossbridged'||_0x503f49===_0x5a1c('0x7b')||_0x503f49===_0x5a1c('0x7c')||_0x503f49===_0x5a1c('0x76')||_0x503f49===_0x5a1c('0x77')||_0x503f49==='rtpaudioqosjitter'||_0x503f49==='rtpaudioqosjitterbridged'||_0x503f49===_0x5a1c('0x7a')||_0x503f49===_0x5a1c('0x7d')||_0x503f49===_0x5a1c('0x7b')||_0x503f49==='rtpaudioqosrttbridged'||_0x503f49===_0x5a1c('0x7e')||_0x503f49===_0x5a1c('0x7f')||_0x503f49===_0x5a1c('0x3d')||_0x503f49===_0x5a1c('0x39')){return![];}return!![];};exports[_0x5a1c('0x80')]=function(_0x5f26e7,_0x2d47d7){var _0x484d49,_0x42c924,_0x1ee00d;if(_0x2d47d7<=0x0){_0x2d47d7=0x1;}_0x484d49=new RegExp(_0x5a1c('0x81')+_0x2d47d7+'}$');_0x42c924=Math['pow'](0xa,_0x2d47d7-0x1);_0x1ee00d=Math['pow'](0xa,_0x2d47d7)-0x1;return util[_0x5a1c('0x12')]('%s',_[_0x5a1c('0x82')](_0x5f26e7,_0x484d49,_[_0x5a1c('0x83')](_0x42c924,_0x1ee00d)));};exports['extractCalleridName']=function(_0x59c902){var _0x1f6427=_0x59c902[_0x5a1c('0x84')](/"(.*?)"/);return _0x1f6427?_0x1f6427[0x1]:_0x59c902;};exports[_0x5a1c('0x85')]=function(_0x213ce8){var _0x14f8d4=_0x213ce8['match'](/<(.*?)>/);return _0x14f8d4?_0x14f8d4[0x1]:_0x213ce8;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8ffe811..f76d0ee 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x35374e,_0x4d17f5){var _0x136a5f=function(_0x660998){while(--_0x660998){_0x35374e['push'](_0x35374e['shift']());}};_0x136a5f(++_0x4d17f5);}(_0x7a54,0x106));var _0x47a5=function(_0x1218d3,_0x17092c){_0x1218d3=_0x1218d3-0x0;var _0x4765cb=_0x7a54[_0x1218d3];return _0x4765cb;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x10e278,_0x463dbc){var _0x2aab43=function(_0x3299a1){while(--_0x3299a1){_0x10e278['push'](_0x10e278['shift']());}};_0x2aab43(++_0x463dbc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20d72e,_0x534501){_0x20d72e=_0x20d72e-0x0;var _0x2580d6=_0x5f2f[_0x20d72e];return _0x2580d6;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 0ee0caf..7057a44 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 _0xc882=['triggers','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','timers','zendeskAccounts','salesforceAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','mapKeys','isNil','interface','name','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','abandoned','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','mergeFromDatabase','initTelephones','length','isUndefined','initTrunks','initVoiceQueues','initTriggers'];(function(_0x2b1563,_0x247bae){var _0x5e156a=function(_0x17d5ec){while(--_0x17d5ec){_0x2b1563['push'](_0x2b1563['shift']());}};_0x5e156a(++_0x247bae);}(_0xc882,0xff));var _0x2c88=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc882[_0x432682];return _0x463d05;};'use strict';var BPromise=require(_0x2c88('0x0'));var util=require(_0x2c88('0x1'));var _=require(_0x2c88('0x2'));var moment=require(_0x2c88('0x3'));var Agent=require(_0x2c88('0x4'));var Telephone=require(_0x2c88('0x5'));var Trunk=require(_0x2c88('0x6'));var VoiceQueue=require(_0x2c88('0x7'));var Trigger=require(_0x2c88('0x8'));var Template=require(_0x2c88('0x9'));var Campaign=require(_0x2c88('0xa'));var VoiceExtension=require(_0x2c88('0xb'));var ZendeskAccount=require(_0x2c88('0xc'));var SalesforceAccount=require(_0x2c88('0xd'));var FreshdeskAccount=require(_0x2c88('0xe'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x2c88('0xf'));var ServicenowAccount=require(_0x2c88('0x10'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x2c88('0x11'));var FaxAccount=require(_0x2c88('0x12'));var Realtime=function(){this['agents']={};this[_0x2c88('0x13')]={};this[_0x2c88('0x14')]={};this[_0x2c88('0x15')]={};this['triggers']={};this[_0x2c88('0x16')]={};this[_0x2c88('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x2c88('0x18')]={};this[_0x2c88('0x19')]={};this['queueChannels']={};this['outboundChannels']={};this[_0x2c88('0x1a')]={};this[_0x2c88('0x1b')]={};this[_0x2c88('0x1c')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0x2c88('0x1d')]={};this['deskAccounts']={};this[_0x2c88('0x1e')]={};this[_0x2c88('0x1f')]={};this[_0x2c88('0x20')]={};this[_0x2c88('0x21')]={};this[_0x2c88('0x22')]={};};function freeIsNotKey(_0xa3f02,_0x5039d8,_0x4e13dc){var _0x37b8fe=_['mapKeys'](_0xa3f02,function(_0x5d77d8,_0x332896){return _0x5d77d8[_0x4e13dc];});for(var _0xa4cf77 in _0x5039d8){if(_0x5039d8[_0x2c88('0x23')](_0xa4cf77)){if(!_0x37b8fe[_0xa4cf77]){delete _0x5039d8[_0xa4cf77];}}}}function freeIsNotKeySip(_0x31d543,_0x3a4690){var _0x26a9b5=_['mapKeys'](_0x31d543,function(_0x1125ef,_0x1ca00f){return util[_0x2c88('0x24')](_0x2c88('0x25'),_0x1125ef['name']);});for(var _0x1b0260 in _0x3a4690){if(_0x3a4690[_0x2c88('0x23')](_0x1b0260)){if(!_0x26a9b5[_0x1b0260]){delete _0x3a4690[_0x1b0260];}}}}function freeIsNotKeyAgent(_0x201cb6,_0x414d9a){var _0x57c057=_[_0x2c88('0x26')](_0x201cb6,function(_0x5743a5,_0x14449b){var _0x598b4a=_[_0x2c88('0x27')](_0x5743a5[_0x2c88('0x28')])?util[_0x2c88('0x24')](_0x2c88('0x25'),_0x5743a5[_0x2c88('0x29')]):_0x5743a5['interface'];return _0x598b4a;});for(var _0x51f30b in _0x414d9a){if(_0x414d9a[_0x2c88('0x23')](_0x51f30b)){if(!_0x57c057[_0x51f30b]){delete _0x414d9a[_0x51f30b];}}}}function clearVoiceCallReports(_0x36df18){_0x36df18['total']=0x0;_0x36df18['answered']=0x0;_0x36df18[_0x2c88('0x2a')]=0x0;_0x36df18[_0x2c88('0x2b')]=0x0;_0x36df18[_0x2c88('0x2c')]=0x0;}function clearCampaigns(_0xa00955){if(!_[_0x2c88('0x2d')](_0xa00955)){for(var _0x323f32 in _0xa00955){if(_0xa00955[_0x2c88('0x23')](_0x323f32)){_0xa00955[_0x323f32][_0x2c88('0x2e')]=0x0;_0xa00955[_0x323f32][_0x2c88('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x49a144){if(!_['isEmpty'](_0x49a144)){for(var _0x5d2a2a in _0x49a144){if(_0x49a144[_0x2c88('0x23')](_0x5d2a2a)){_0x49a144[_0x5d2a2a][_0x2c88('0x30')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x31')]=0x0;_0x49a144[_0x5d2a2a]['unmanaged']=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x32')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x2a')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x2b')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x2c')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x33')]=0x0;_0x49a144[_0x5d2a2a]['outboundNoAnswerCallsDay']=0x0;_0x49a144[_0x5d2a2a]['outboundBusyCallsDay']=0x0;_0x49a144[_0x5d2a2a]['outboundCongestionCallsDay']=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x34')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x35')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x36')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x37')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x38')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x39')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x3a')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x3b')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x33')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x3c')]=0x0;_0x49a144[_0x5d2a2a][_0x2c88('0x3d')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x4dacf6,_0x18d08b){for(var _0x5a91b0 in _0x18d08b){if(_0x4dacf6['hasOwnProperty'](_0x5a91b0)){_0x4dacf6[_0x5a91b0]=_0x18d08b[_0x5a91b0];}}};Realtime[_0x2c88('0x3e')][_0x2c88('0x3f')]=function(){var _0x15df5d=this;return function(_0x12559b){if(_0x12559b){freeIsNotKeyAgent(_0x12559b,_0x15df5d['agents']);for(var _0x59086f=0x0,_0x633639={},_0x5e17d0={};_0x59086f<_0x12559b['length'];_0x59086f+=0x1){_0x633639=_0x12559b[_0x59086f];var _0x227115=_[_0x2c88('0x27')](_0x633639[_0x2c88('0x28')])?util[_0x2c88('0x24')](_0x2c88('0x25'),_0x633639['name']):_0x633639[_0x2c88('0x28')];if(_['isUndefined'](_0x15df5d['agents'][_0x227115])){_0x15df5d[_0x2c88('0x40')][_0x227115]=new Agent(_0x633639);}else{_0x15df5d[_0x2c88('0x41')](_0x15df5d[_0x2c88('0x40')][_0x227115],_0x633639);}}}return _0x15df5d[_0x2c88('0x40')];};};Realtime[_0x2c88('0x3e')][_0x2c88('0x42')]=function(){var _0x4332d4=this;return function(_0x2450ee){if(_0x2450ee){freeIsNotKeySip(_0x2450ee,_0x4332d4[_0x2c88('0x13')]);for(var _0x553134=0x0,_0xfcc297={},_0x138255={};_0x553134<_0x2450ee[_0x2c88('0x43')];_0x553134+=0x1){_0xfcc297=_0x2450ee[_0x553134];if(_[_0x2c88('0x44')](_0x4332d4[_0x2c88('0x13')][util['format']('SIP/%s',_0xfcc297[_0x2c88('0x29')])])){_0x4332d4[_0x2c88('0x13')][util[_0x2c88('0x24')](_0x2c88('0x25'),_0xfcc297['name'])]=new Telephone(_0xfcc297);}else{_0x4332d4[_0x2c88('0x41')](_0x4332d4[_0x2c88('0x13')][util[_0x2c88('0x24')](_0x2c88('0x25'),_0xfcc297[_0x2c88('0x29')])],_0xfcc297);}}}return _0x4332d4[_0x2c88('0x13')];};};Realtime[_0x2c88('0x3e')][_0x2c88('0x45')]=function(){var _0x429661=this;return function(_0x25a0ad){if(_0x25a0ad){freeIsNotKeySip(_0x25a0ad,_0x429661[_0x2c88('0x14')]);for(var _0x19da26=0x0,_0x32db4a={},_0x543932={};_0x19da26<_0x25a0ad[_0x2c88('0x43')];_0x19da26+=0x1){_0x32db4a=_0x25a0ad[_0x19da26];if(_[_0x2c88('0x44')](_0x429661[_0x2c88('0x14')][util['format'](_0x2c88('0x25'),_0x32db4a[_0x2c88('0x29')])])){_0x429661[_0x2c88('0x14')][util[_0x2c88('0x24')](_0x2c88('0x25'),_0x32db4a[_0x2c88('0x29')])]=new Trunk(_0x32db4a);}else{_0x429661[_0x2c88('0x41')](_0x429661['trunks'][util[_0x2c88('0x24')](_0x2c88('0x25'),_0x32db4a['name'])],_0x32db4a);}}}return _0x429661['trunks'];};};Realtime[_0x2c88('0x3e')][_0x2c88('0x46')]=function(){var _0x493076=this;return function(_0x3e5ade){if(_0x3e5ade){freeIsNotKey(_0x3e5ade,_0x493076[_0x2c88('0x15')],'name');for(var _0x53569d=0x0,_0x4af687={},_0x163ee0={};_0x53569d<_0x3e5ade[_0x2c88('0x43')];_0x53569d+=0x1){_0x4af687=_0x3e5ade[_0x53569d];if(_['isUndefined'](_0x493076[_0x2c88('0x15')][_0x4af687['name']])){_0x493076[_0x2c88('0x15')][_0x4af687[_0x2c88('0x29')]]=new VoiceQueue(_0x4af687);}else{_0x493076[_0x2c88('0x41')](_0x493076[_0x2c88('0x15')][_0x4af687['name']],_0x4af687);}}}return _0x493076[_0x2c88('0x15')];};};Realtime[_0x2c88('0x3e')][_0x2c88('0x47')]=function(){var _0x452f77=this;return function(_0x27bd1d){if(_0x27bd1d){freeIsNotKey(_0x27bd1d,_0x452f77[_0x2c88('0x48')],'id');for(var _0xc49b77=0x0,_0xb92033={},_0x371f5e={};_0xc49b77<_0x27bd1d[_0x2c88('0x43')];_0xc49b77+=0x1){_0xb92033=_0x27bd1d[_0xc49b77];if(_[_0x2c88('0x44')](_0x452f77[_0x2c88('0x48')][_0xb92033['id']])){_0x452f77[_0x2c88('0x48')][_0xb92033['id']]=new Trigger(_0xb92033);}else{_0x452f77[_0x2c88('0x41')](_0x452f77[_0x2c88('0x48')][_0xb92033['id']],_0xb92033);}}}return _0x452f77[_0x2c88('0x48')];};};Realtime[_0x2c88('0x3e')]['initTemplates']=function(){var _0x393d0a=this;return function(_0x103666){if(_0x103666){freeIsNotKey(_0x103666,_0x393d0a['templates'],'id');for(var _0x6d15bc=0x0,_0xb2970a={},_0x20655e={};_0x6d15bc<_0x103666[_0x2c88('0x43')];_0x6d15bc+=0x1){_0xb2970a=_0x103666[_0x6d15bc];if(_['isUndefined'](_0x393d0a[_0x2c88('0x17')][_0xb2970a['id']])){_0x393d0a[_0x2c88('0x17')][_0xb2970a['id']]=new Template(_0xb2970a);}else{_0x393d0a[_0x2c88('0x41')](_0x393d0a[_0x2c88('0x17')][_0xb2970a['id']],_0xb2970a);}}}return _0x393d0a[_0x2c88('0x17')];};};Realtime[_0x2c88('0x3e')]['initZendeskAccounts']=function(){var _0x5acf4e=this;return function(_0x353299){if(_0x353299){freeIsNotKey(_0x353299,_0x5acf4e[_0x2c88('0x1b')],'id');for(var _0x5e6a2a=0x0,_0x537f81={},_0x4dd4e4={};_0x5e6a2a<_0x353299['length'];_0x5e6a2a+=0x1){_0x537f81=_0x353299[_0x5e6a2a];if(_['isUndefined'](_0x5acf4e[_0x2c88('0x1b')][_0x537f81['id']])){_0x5acf4e[_0x2c88('0x1b')][_0x537f81['id']]=new ZendeskAccount(_0x537f81);}else{_0x5acf4e[_0x2c88('0x41')](_0x5acf4e['zendeskAccounts'][_0x537f81['id']],_0x537f81);}}}return _0x5acf4e[_0x2c88('0x1b')];};};Realtime['prototype'][_0x2c88('0x49')]=function(){var _0x3f8c9a=this;return function(_0x47abdb){if(_0x47abdb){freeIsNotKey(_0x47abdb,_0x3f8c9a['salesforceAccounts'],'id');for(var _0x2e224c=0x0,_0x387ede={},_0x2145ec={};_0x2e224c<_0x47abdb['length'];_0x2e224c+=0x1){_0x387ede=_0x47abdb[_0x2e224c];if(_['isUndefined'](_0x3f8c9a[_0x2c88('0x1c')][_0x387ede['id']])){_0x3f8c9a['salesforceAccounts'][_0x387ede['id']]=new SalesforceAccount(_0x387ede);}else{_0x3f8c9a[_0x2c88('0x41')](_0x3f8c9a[_0x2c88('0x1c')][_0x387ede['id']],_0x387ede);}}}return _0x3f8c9a[_0x2c88('0x1c')];};};Realtime['prototype'][_0x2c88('0x4a')]=function(){var _0x34796e=this;return function(_0x1bb5ad){if(_0x1bb5ad){freeIsNotKey(_0x1bb5ad,_0x34796e[_0x2c88('0x4b')],'id');for(var _0x29a19c=0x0,_0x45a9c9={},_0x7f416c={};_0x29a19c<_0x1bb5ad[_0x2c88('0x43')];_0x29a19c+=0x1){_0x45a9c9=_0x1bb5ad[_0x29a19c];if(_[_0x2c88('0x44')](_0x34796e['freshdeskAccounts'][_0x45a9c9['id']])){_0x34796e[_0x2c88('0x4b')][_0x45a9c9['id']]=new FreshdeskAccount(_0x45a9c9);}else{_0x34796e[_0x2c88('0x41')](_0x34796e[_0x2c88('0x4b')][_0x45a9c9['id']],_0x45a9c9);}}}return _0x34796e[_0x2c88('0x4b')];};};Realtime[_0x2c88('0x3e')][_0x2c88('0x4c')]=function(){var _0x55f87e=this;return function(_0x5cde71){if(_0x5cde71){freeIsNotKey(_0x5cde71,_0x55f87e[_0x2c88('0x1d')],'id');for(var _0x40595f=0x0,_0x190a71={},_0x245c47={};_0x40595f<_0x5cde71[_0x2c88('0x43')];_0x40595f+=0x1){_0x190a71=_0x5cde71[_0x40595f];if(_[_0x2c88('0x44')](_0x55f87e[_0x2c88('0x1d')][_0x190a71['id']])){_0x55f87e[_0x2c88('0x1d')][_0x190a71['id']]=new ZohoAccount(_0x190a71);}else{_0x55f87e[_0x2c88('0x41')](_0x55f87e[_0x2c88('0x1d')][_0x190a71['id']],_0x190a71);}}}return _0x55f87e[_0x2c88('0x1d')];};};Realtime[_0x2c88('0x3e')][_0x2c88('0x4d')]=function(){var _0x2b33a4=this;return function(_0xc35b43){if(_0xc35b43){freeIsNotKey(_0xc35b43,_0x2b33a4[_0x2c88('0x4e')],'id');for(var _0x913bff=0x0,_0x52503e={},_0x46a063={};_0x913bff<_0xc35b43['length'];_0x913bff+=0x1){_0x52503e=_0xc35b43[_0x913bff];if(_['isUndefined'](_0x2b33a4[_0x2c88('0x4e')][_0x52503e['id']])){_0x2b33a4[_0x2c88('0x4e')][_0x52503e['id']]=new DeskAccount(_0x52503e);}else{_0x2b33a4[_0x2c88('0x41')](_0x2b33a4[_0x2c88('0x4e')][_0x52503e['id']],_0x52503e);}}}return _0x2b33a4[_0x2c88('0x4e')];};};Realtime[_0x2c88('0x3e')]['initSugarcrmAccounts']=function(){var _0x1a02ed=this;return function(_0x55173a){if(_0x55173a){freeIsNotKey(_0x55173a,_0x1a02ed['sugarcrmAccounts'],'id');for(var _0x1d396e=0x0,_0xf36221={},_0x2f9be6={};_0x1d396e<_0x55173a[_0x2c88('0x43')];_0x1d396e+=0x1){_0xf36221=_0x55173a[_0x1d396e];if(_[_0x2c88('0x44')](_0x1a02ed['sugarcrmAccounts'][_0xf36221['id']])){_0x1a02ed[_0x2c88('0x4f')][_0xf36221['id']]=new SugarcrmAccount(_0xf36221);}else{_0x1a02ed['mergeFromDatabase'](_0x1a02ed[_0x2c88('0x4f')][_0xf36221['id']],_0xf36221);}}}return _0x1a02ed[_0x2c88('0x4f')];};};Realtime['prototype'][_0x2c88('0x50')]=function(){var _0x8855c=this;return function(_0x30a642){if(_0x30a642){freeIsNotKey(_0x30a642,_0x8855c[_0x2c88('0x1e')],'id');for(var _0x5a9da2=0x0,_0x125711={},_0x8baa73={};_0x5a9da2<_0x30a642[_0x2c88('0x43')];_0x5a9da2+=0x1){_0x125711=_0x30a642[_0x5a9da2];if(_[_0x2c88('0x44')](_0x8855c[_0x2c88('0x1e')][_0x125711['id']])){_0x8855c[_0x2c88('0x1e')][_0x125711['id']]=new VtigerAccount(_0x125711);}else{_0x8855c['mergeFromDatabase'](_0x8855c[_0x2c88('0x1e')][_0x125711['id']],_0x125711);}}}return _0x8855c[_0x2c88('0x1e')];};};Realtime[_0x2c88('0x3e')][_0x2c88('0x51')]=function(){var _0x13fac0=this;return function(_0x56fb86){if(_0x56fb86){freeIsNotKey(_0x56fb86,_0x13fac0[_0x2c88('0x1f')],'id');for(var _0x412347=0x0,_0x2bfc9d={},_0x2cc74d={};_0x412347<_0x56fb86['length'];_0x412347+=0x1){_0x2bfc9d=_0x56fb86[_0x412347];if(_[_0x2c88('0x44')](_0x13fac0['servicenowAccounts'][_0x2bfc9d['id']])){_0x13fac0[_0x2c88('0x1f')][_0x2bfc9d['id']]=new ServicenowAccount(_0x2bfc9d);}else{_0x13fac0[_0x2c88('0x41')](_0x13fac0[_0x2c88('0x1f')][_0x2bfc9d['id']],_0x2bfc9d);}}}return _0x13fac0[_0x2c88('0x1f')];};};Realtime['prototype'][_0x2c88('0x52')]=function(){var _0x2b2887=this;return function(_0x5257be){if(_0x5257be){freeIsNotKey(_0x5257be,_0x2b2887[_0x2c88('0x20')],'id');for(var _0x30fe81=0x0,_0x5b0e37={},_0x43dc62={};_0x30fe81<_0x5257be[_0x2c88('0x43')];_0x30fe81+=0x1){_0x5b0e37=_0x5257be[_0x30fe81];if(_[_0x2c88('0x44')](_0x2b2887[_0x2c88('0x20')][_0x5b0e37['id']])){_0x2b2887[_0x2c88('0x20')][_0x5b0e37['id']]=new Dynamics365Account(_0x5b0e37);}else{_0x2b2887['mergeFromDatabase'](_0x2b2887['dynamics365Accounts'][_0x5b0e37['id']],_0x5b0e37);}}}return _0x2b2887[_0x2c88('0x20')];};};Realtime[_0x2c88('0x3e')]['initFreshsalesAccounts']=function(){var _0x2e5bd2=this;return function(_0x1e038d){if(_0x1e038d){freeIsNotKey(_0x1e038d,_0x2e5bd2[_0x2c88('0x21')],'id');for(var _0x56858f=0x0,_0x9c3de9={},_0x51b12d={};_0x56858f<_0x1e038d[_0x2c88('0x43')];_0x56858f+=0x1){_0x9c3de9=_0x1e038d[_0x56858f];if(_['isUndefined'](_0x2e5bd2[_0x2c88('0x21')][_0x9c3de9['id']])){_0x2e5bd2[_0x2c88('0x21')][_0x9c3de9['id']]=new FreshsalesAccount(_0x9c3de9);}else{_0x2e5bd2[_0x2c88('0x41')](_0x2e5bd2[_0x2c88('0x21')][_0x9c3de9['id']],_0x9c3de9);}}}return _0x2e5bd2[_0x2c88('0x21')];};};Realtime[_0x2c88('0x3e')][_0x2c88('0x53')]=function(){var _0x377d54=this;return function(_0xe05a2f){for(var _0x3a569c=0x0;_0x3a569c<_0xe05a2f[_0x2c88('0x43')];_0x3a569c+=0x1){_[_0x2c88('0x54')](_0x377d54['voiceQueues'][_0xe05a2f[_0x3a569c][_0x2c88('0x29')]],_0xe05a2f[_0x3a569c]);}return _0x377d54[_0x2c88('0x15')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3aa5e2=this;return function(_0x1020de){clearVoiceQueues(_0x3aa5e2[_0x2c88('0x15')]);if(_0x1020de){_0x1020de=_[_0x2c88('0x55')](_0x1020de,'uniqueid');for(var _0xd1a949 in _0x1020de){if(_0x1020de[_0x2c88('0x23')](_0xd1a949)){var _0x59fcdb={};for(var _0x483bd4=0x0;_0x483bd4<_0x1020de[_0xd1a949][_0x2c88('0x43')];_0x483bd4+=0x1){var _0x569c46=_0x1020de[_0xd1a949][_0x483bd4][_0x2c88('0x56')];if(_0x3aa5e2[_0x2c88('0x15')][_0x569c46]){if(_0x1020de[_0xd1a949][_0x483bd4][_0x2c88('0x57')]){_0x3aa5e2[_0x2c88('0x15')][_0x569c46][_0x2c88('0x58')]+=0x1;}if(_0x1020de[_0xd1a949][_0x483bd4][_0x2c88('0x59')]){_0x3aa5e2[_0x2c88('0x15')][_0x569c46][_0x2c88('0x32')]+=0x1;}_0x3aa5e2['voiceQueues'][_0x569c46]['sumHoldTime']+=moment(_0x1020de[_0xd1a949][_0x483bd4][_0x2c88('0x5a')])[_0x2c88('0x5b')](moment(_0x1020de[_0xd1a949][_0x483bd4][_0x2c88('0x5c')]),_0x2c88('0x5d'))||0x0;if(_0x483bd4===_0x1020de[_0xd1a949][_0x2c88('0x43')]-0x1){_0x3aa5e2[_0x2c88('0x15')][_0x569c46][_0x2c88('0x2b')]+=moment(_0x1020de[_0xd1a949][_0x483bd4]['queuecallercompleteAt']||_0x1020de[_0xd1a949][_0x483bd4][_0x2c88('0x5e')]||_0x1020de[_0xd1a949][_0x483bd4][_0x2c88('0x5f')])['diff'](moment(_0x1020de[_0xd1a949][_0x483bd4][_0x2c88('0x5c')]),_0x2c88('0x5d'))||0x0;_0x3aa5e2[_0x2c88('0x15')][_0x569c46][_0x2c88('0x30')]+=0x1;if(_0x1020de[_0xd1a949][_0x483bd4][_0x2c88('0x60')]){_0x3aa5e2[_0x2c88('0x15')][_0x569c46][_0x2c88('0x31')]+=0x1;_0x3aa5e2[_0x2c88('0x15')][_0x569c46][_0x2c88('0x2c')]+=moment(_0x1020de[_0xd1a949][_0x483bd4][_0x2c88('0x61')])[_0x2c88('0x5b')](moment(_0x1020de[_0xd1a949][_0x483bd4][_0x2c88('0x5a')]),_0x2c88('0x5d'))||0x0;}}else{_0x3aa5e2[_0x2c88('0x15')][_0x569c46]['sumDuration']+=_0x3aa5e2[_0x2c88('0x15')][_0x569c46][_0x2c88('0x2a')]||0x0;}}}}}}return _0x3aa5e2[_0x2c88('0x15')];};};Realtime[_0x2c88('0x3e')]['initVoiceCallReports']=function(){var _0x31b1fd=this;return function(_0x37d9ca){clearVoiceCallReports(_0x31b1fd['outbound']);if(_0x37d9ca){for(var _0x1250a7=0x0;_0x1250a7<_0x37d9ca[_0x2c88('0x43')];_0x1250a7+=0x1){_0x31b1fd[_0x2c88('0x62')]['total']+=0x1;_0x31b1fd[_0x2c88('0x62')][_0x2c88('0x2b')]+=_0x37d9ca[_0x1250a7][_0x2c88('0x63')];if(_0x37d9ca[_0x1250a7][_0x2c88('0x64')]===_0x2c88('0x65')){_0x31b1fd['outbound']['answered']+=0x1;_0x31b1fd[_0x2c88('0x62')]['sumHoldTime']+=_0x37d9ca[_0x1250a7][_0x2c88('0x63')]-_0x37d9ca[_0x1250a7][_0x2c88('0x66')]||0x0;_0x31b1fd['outbound'][_0x2c88('0x2c')]+=_0x37d9ca[_0x1250a7][_0x2c88('0x66')];}}}return _0x31b1fd[_0x2c88('0x62')];};};Realtime[_0x2c88('0x3e')][_0x2c88('0x67')]=function(){var _0x415de5=this;return function(_0x2a6125){if(_0x2a6125){freeIsNotKey(_0x2a6125,_0x415de5[_0x2c88('0x16')],'name');for(var _0x2c7600=0x0,_0x5b0dbe={};_0x2c7600<_0x2a6125[_0x2c88('0x43')];_0x2c7600+=0x1){_0x5b0dbe=_0x2a6125[_0x2c7600];if(_[_0x2c88('0x44')](_0x415de5['campaigns'][_0x5b0dbe[_0x2c88('0x29')]])){_0x415de5[_0x2c88('0x16')][_0x5b0dbe[_0x2c88('0x29')]]=new Campaign(_0x5b0dbe);}else{_0x415de5[_0x2c88('0x41')](_0x415de5[_0x2c88('0x16')][_0x5b0dbe['name']],_0x5b0dbe);_0x415de5[_0x2c88('0x16')][_0x5b0dbe[_0x2c88('0x29')]][_0x2c88('0x68')]=_0x5b0dbe['SquareProject']?_0x5b0dbe[_0x2c88('0x69')][_0x2c88('0x29')]:undefined;}}}return _0x415de5['campaigns'];};};Realtime[_0x2c88('0x3e')]['initVoiceExtensions']=function(){var _0x4eb04e=this;return function(_0x1d31aa){if(_0x1d31aa){freeIsNotKey(_0x1d31aa,_0x4eb04e['voiceExtensions'],'id');for(var _0xe8eb7c=0x0,_0x47b7ac={};_0xe8eb7c<_0x1d31aa[_0x2c88('0x43')];_0xe8eb7c+=0x1){_0x47b7ac=_0x1d31aa[_0xe8eb7c];if(_[_0x2c88('0x44')](_0x4eb04e[_0x2c88('0x18')][_0x47b7ac['id']])){_0x4eb04e['voiceExtensions'][_0x47b7ac['id']]=new VoiceExtension(_0x47b7ac);}else{_0x4eb04e[_0x2c88('0x41')](_0x4eb04e[_0x2c88('0x18')][_0x47b7ac['id']],_0x47b7ac);}}}return _0x4eb04e['voiceExtensions'];};};Realtime['prototype'][_0x2c88('0x6a')]=function(){var _0x36751=this;return function(_0x320109){clearCampaigns(_0x36751[_0x2c88('0x16')]);for(var _0x3642a8=0x0;_0x3642a8<_0x320109[_0x2c88('0x43')];_0x3642a8+=0x1){_['merge'](_0x36751[_0x2c88('0x16')][_0x320109[_0x3642a8][_0x2c88('0x29')]],_0x320109[_0x3642a8]);}return _0x36751[_0x2c88('0x16')];};};Realtime[_0x2c88('0x3e')][_0x2c88('0x6b')]=function(){var _0x35b531=this;return function(_0x33293a){if(_0x33293a){freeIsNotKey(_0x33293a,_0x35b531[_0x2c88('0x22')],'id');for(var _0x57c4a3=0x0,_0x1689c2={},_0x34cc2e={};_0x57c4a3<_0x33293a[_0x2c88('0x43')];_0x57c4a3+=0x1){_0x1689c2=_0x33293a[_0x57c4a3];if(_[_0x2c88('0x44')](_0x35b531[_0x2c88('0x22')][_0x1689c2['id']])){_0x35b531['faxAccounts'][_0x1689c2['id']]=new FaxAccount(_0x1689c2);}else{_0x35b531['mergeFromDatabase'](_0x35b531[_0x2c88('0x22')][_0x1689c2['id']],_0x1689c2);}}}return _0x35b531[_0x2c88('0x22')];};};module[_0x2c88('0x6c')]=Realtime; \ No newline at end of file +var _0xef36=['sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','total','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','initTriggers','initTemplates','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered'];(function(_0x1ca65d,_0x53fbc3){var _0x31cc85=function(_0x35b3bf){while(--_0x35b3bf){_0x1ca65d['push'](_0x1ca65d['shift']());}};_0x31cc85(++_0x53fbc3);}(_0xef36,0x18c));var _0x6ef3=function(_0x216544,_0x53c788){_0x216544=_0x216544-0x0;var _0xa25add=_0xef36[_0x216544];return _0xa25add;};'use strict';var BPromise=require(_0x6ef3('0x0'));var util=require(_0x6ef3('0x1'));var _=require(_0x6ef3('0x2'));var moment=require(_0x6ef3('0x3'));var Agent=require(_0x6ef3('0x4'));var Telephone=require(_0x6ef3('0x5'));var Trunk=require(_0x6ef3('0x6'));var VoiceQueue=require(_0x6ef3('0x7'));var Trigger=require('../model/trigger');var Template=require(_0x6ef3('0x8'));var Campaign=require(_0x6ef3('0x9'));var VoiceExtension=require(_0x6ef3('0xa'));var ZendeskAccount=require(_0x6ef3('0xb'));var SalesforceAccount=require(_0x6ef3('0xc'));var FreshdeskAccount=require(_0x6ef3('0xd'));var SugarcrmAccount=require(_0x6ef3('0xe'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x6ef3('0xf'));var VtigerAccount=require(_0x6ef3('0x10'));var ServicenowAccount=require(_0x6ef3('0x11'));var Dynamics365Account=require(_0x6ef3('0x12'));var FreshsalesAccount=require(_0x6ef3('0x13'));var FaxAccount=require(_0x6ef3('0x14'));var Realtime=function(){this[_0x6ef3('0x15')]={};this[_0x6ef3('0x16')]={};this[_0x6ef3('0x17')]={};this[_0x6ef3('0x18')]={};this[_0x6ef3('0x19')]={};this[_0x6ef3('0x1a')]={};this[_0x6ef3('0x1b')]={};this[_0x6ef3('0x1c')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x6ef3('0x1d')]={};this[_0x6ef3('0x1e')]={};this[_0x6ef3('0x1f')]={};this[_0x6ef3('0x20')]={};this['zendeskAccounts']={};this[_0x6ef3('0x21')]={};this[_0x6ef3('0x22')]={};this[_0x6ef3('0x23')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x6ef3('0x24')]={};this[_0x6ef3('0x25')]={};this[_0x6ef3('0x26')]={};this['freshsalesAccounts']={};this[_0x6ef3('0x27')]={};};function freeIsNotKey(_0x28d22c,_0x2ae649,_0x4f0125){var _0x4a1234=_[_0x6ef3('0x28')](_0x28d22c,function(_0x5db525,_0x391da1){return _0x5db525[_0x4f0125];});for(var _0x363912 in _0x2ae649){if(_0x2ae649[_0x6ef3('0x29')](_0x363912)){if(!_0x4a1234[_0x363912]){delete _0x2ae649[_0x363912];}}}}function freeIsNotKeySip(_0x3d2ca3,_0x457843){var _0xe51bf1=_['mapKeys'](_0x3d2ca3,function(_0x3068ee,_0x2254cb){return util[_0x6ef3('0x2a')](_0x6ef3('0x2b'),_0x3068ee[_0x6ef3('0x2c')]);});for(var _0x46e476 in _0x457843){if(_0x457843[_0x6ef3('0x29')](_0x46e476)){if(!_0xe51bf1[_0x46e476]){delete _0x457843[_0x46e476];}}}}function freeIsNotKeyAgent(_0x56a743,_0x61939f){var _0x4690e1=_[_0x6ef3('0x28')](_0x56a743,function(_0x27e049,_0x1f0b62){var _0x3b1a24=_[_0x6ef3('0x2d')](_0x27e049[_0x6ef3('0x2e')])?util['format'](_0x6ef3('0x2b'),_0x27e049[_0x6ef3('0x2c')]):_0x27e049['interface'];return _0x3b1a24;});for(var _0x5abbfd in _0x61939f){if(_0x61939f['hasOwnProperty'](_0x5abbfd)){if(!_0x4690e1[_0x5abbfd]){delete _0x61939f[_0x5abbfd];}}}}function clearVoiceCallReports(_0x42b28f){_0x42b28f['total']=0x0;_0x42b28f[_0x6ef3('0x2f')]=0x0;_0x42b28f[_0x6ef3('0x30')]=0x0;_0x42b28f[_0x6ef3('0x31')]=0x0;_0x42b28f['sumBillable']=0x0;}function clearCampaigns(_0x5e4a68){if(!_[_0x6ef3('0x32')](_0x5e4a68)){for(var _0x22f69d in _0x5e4a68){if(_0x5e4a68[_0x6ef3('0x29')](_0x22f69d)){_0x5e4a68[_0x22f69d][_0x6ef3('0x33')]=0x0;_0x5e4a68[_0x22f69d]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x26c8bf){if(!_[_0x6ef3('0x32')](_0x26c8bf)){for(var _0x333bb4 in _0x26c8bf){if(_0x26c8bf['hasOwnProperty'](_0x333bb4)){_0x26c8bf[_0x333bb4][_0x6ef3('0x34')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x2f')]=0x0;_0x26c8bf[_0x333bb4]['unmanaged']=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x35')]=0x0;_0x26c8bf[_0x333bb4]['sumHoldTime']=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x31')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x36')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x37')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x38')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x39')]=0x0;_0x26c8bf[_0x333bb4]['outboundCongestionCallsDay']=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3a')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3b')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3c')]=0x0;_0x26c8bf[_0x333bb4]['outboundDropCallsDayCallersExit']=0x0;_0x26c8bf[_0x333bb4]['outboundBlacklistCallsDay']=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3d')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3e')]=0x0;_0x26c8bf[_0x333bb4]['outboundReCallsDay']=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x37')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x3f')]=0x0;_0x26c8bf[_0x333bb4][_0x6ef3('0x40')]=!![];}}}}Realtime['prototype'][_0x6ef3('0x41')]=function(_0x1f2ea7,_0x5328e5){for(var _0x55476c in _0x5328e5){if(_0x1f2ea7['hasOwnProperty'](_0x55476c)){_0x1f2ea7[_0x55476c]=_0x5328e5[_0x55476c];}}};Realtime[_0x6ef3('0x42')]['initAgents']=function(){var _0x2658bc=this;return function(_0x363331){if(_0x363331){freeIsNotKeyAgent(_0x363331,_0x2658bc[_0x6ef3('0x15')]);for(var _0x3167d1=0x0,_0x2893f0={},_0x137f46={};_0x3167d1<_0x363331['length'];_0x3167d1+=0x1){_0x2893f0=_0x363331[_0x3167d1];var _0x259eac=_['isNil'](_0x2893f0['interface'])?util['format'](_0x6ef3('0x2b'),_0x2893f0['name']):_0x2893f0['interface'];if(_[_0x6ef3('0x43')](_0x2658bc[_0x6ef3('0x15')][_0x259eac])){_0x2658bc[_0x6ef3('0x15')][_0x259eac]=new Agent(_0x2893f0);}else{_0x2658bc['mergeFromDatabase'](_0x2658bc[_0x6ef3('0x15')][_0x259eac],_0x2893f0);}}}return _0x2658bc[_0x6ef3('0x15')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x44')]=function(){var _0xddabbe=this;return function(_0x3c8eb5){if(_0x3c8eb5){freeIsNotKeySip(_0x3c8eb5,_0xddabbe['telephones']);for(var _0x2996f2=0x0,_0x4e5856={},_0x3933f7={};_0x2996f2<_0x3c8eb5[_0x6ef3('0x45')];_0x2996f2+=0x1){_0x4e5856=_0x3c8eb5[_0x2996f2];if(_[_0x6ef3('0x43')](_0xddabbe['telephones'][util[_0x6ef3('0x2a')]('SIP/%s',_0x4e5856[_0x6ef3('0x2c')])])){_0xddabbe['telephones'][util[_0x6ef3('0x2a')](_0x6ef3('0x2b'),_0x4e5856[_0x6ef3('0x2c')])]=new Telephone(_0x4e5856);}else{_0xddabbe[_0x6ef3('0x41')](_0xddabbe[_0x6ef3('0x16')][util['format'](_0x6ef3('0x2b'),_0x4e5856[_0x6ef3('0x2c')])],_0x4e5856);}}}return _0xddabbe[_0x6ef3('0x16')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x46')]=function(){var _0x39dc7a=this;return function(_0x46e4b2){if(_0x46e4b2){freeIsNotKeySip(_0x46e4b2,_0x39dc7a[_0x6ef3('0x17')]);for(var _0x3a76e2=0x0,_0x3ff750={},_0x32e917={};_0x3a76e2<_0x46e4b2[_0x6ef3('0x45')];_0x3a76e2+=0x1){_0x3ff750=_0x46e4b2[_0x3a76e2];if(_[_0x6ef3('0x43')](_0x39dc7a[_0x6ef3('0x17')][util['format']('SIP/%s',_0x3ff750[_0x6ef3('0x2c')])])){_0x39dc7a[_0x6ef3('0x17')][util['format'](_0x6ef3('0x2b'),_0x3ff750[_0x6ef3('0x2c')])]=new Trunk(_0x3ff750);}else{_0x39dc7a[_0x6ef3('0x41')](_0x39dc7a[_0x6ef3('0x17')][util[_0x6ef3('0x2a')](_0x6ef3('0x2b'),_0x3ff750['name'])],_0x3ff750);}}}return _0x39dc7a[_0x6ef3('0x17')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x47')]=function(){var _0x1bff38=this;return function(_0x56e190){if(_0x56e190){freeIsNotKey(_0x56e190,_0x1bff38['voiceQueues'],_0x6ef3('0x2c'));for(var _0x525f52=0x0,_0x3236ab={},_0x430092={};_0x525f52<_0x56e190['length'];_0x525f52+=0x1){_0x3236ab=_0x56e190[_0x525f52];if(_['isUndefined'](_0x1bff38[_0x6ef3('0x18')][_0x3236ab['name']])){_0x1bff38[_0x6ef3('0x18')][_0x3236ab[_0x6ef3('0x2c')]]=new VoiceQueue(_0x3236ab);}else{_0x1bff38['mergeFromDatabase'](_0x1bff38[_0x6ef3('0x18')][_0x3236ab[_0x6ef3('0x2c')]],_0x3236ab);}}}return _0x1bff38[_0x6ef3('0x18')];};};Realtime['prototype'][_0x6ef3('0x48')]=function(){var _0x449d7c=this;return function(_0x2dd844){if(_0x2dd844){freeIsNotKey(_0x2dd844,_0x449d7c[_0x6ef3('0x19')],'id');for(var _0x1420b8=0x0,_0xb429b9={},_0x537006={};_0x1420b8<_0x2dd844[_0x6ef3('0x45')];_0x1420b8+=0x1){_0xb429b9=_0x2dd844[_0x1420b8];if(_[_0x6ef3('0x43')](_0x449d7c[_0x6ef3('0x19')][_0xb429b9['id']])){_0x449d7c[_0x6ef3('0x19')][_0xb429b9['id']]=new Trigger(_0xb429b9);}else{_0x449d7c[_0x6ef3('0x41')](_0x449d7c[_0x6ef3('0x19')][_0xb429b9['id']],_0xb429b9);}}}return _0x449d7c[_0x6ef3('0x19')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x49')]=function(){var _0x5cb275=this;return function(_0x1f4eab){if(_0x1f4eab){freeIsNotKey(_0x1f4eab,_0x5cb275[_0x6ef3('0x1b')],'id');for(var _0x137a38=0x0,_0x4f7051={},_0x12655a={};_0x137a38<_0x1f4eab[_0x6ef3('0x45')];_0x137a38+=0x1){_0x4f7051=_0x1f4eab[_0x137a38];if(_[_0x6ef3('0x43')](_0x5cb275['templates'][_0x4f7051['id']])){_0x5cb275['templates'][_0x4f7051['id']]=new Template(_0x4f7051);}else{_0x5cb275[_0x6ef3('0x41')](_0x5cb275['templates'][_0x4f7051['id']],_0x4f7051);}}}return _0x5cb275[_0x6ef3('0x1b')];};};Realtime[_0x6ef3('0x42')]['initZendeskAccounts']=function(){var _0x463e1f=this;return function(_0x2bacf8){if(_0x2bacf8){freeIsNotKey(_0x2bacf8,_0x463e1f[_0x6ef3('0x4a')],'id');for(var _0x1ef0d2=0x0,_0x301ddb={},_0x2fdbf8={};_0x1ef0d2<_0x2bacf8[_0x6ef3('0x45')];_0x1ef0d2+=0x1){_0x301ddb=_0x2bacf8[_0x1ef0d2];if(_[_0x6ef3('0x43')](_0x463e1f['zendeskAccounts'][_0x301ddb['id']])){_0x463e1f['zendeskAccounts'][_0x301ddb['id']]=new ZendeskAccount(_0x301ddb);}else{_0x463e1f[_0x6ef3('0x41')](_0x463e1f['zendeskAccounts'][_0x301ddb['id']],_0x301ddb);}}}return _0x463e1f['zendeskAccounts'];};};Realtime[_0x6ef3('0x42')]['initSalesforceAccounts']=function(){var _0x9b8dde=this;return function(_0x44d637){if(_0x44d637){freeIsNotKey(_0x44d637,_0x9b8dde[_0x6ef3('0x21')],'id');for(var _0x349d2=0x0,_0x2039fd={},_0xe8bf24={};_0x349d2<_0x44d637[_0x6ef3('0x45')];_0x349d2+=0x1){_0x2039fd=_0x44d637[_0x349d2];if(_['isUndefined'](_0x9b8dde[_0x6ef3('0x21')][_0x2039fd['id']])){_0x9b8dde['salesforceAccounts'][_0x2039fd['id']]=new SalesforceAccount(_0x2039fd);}else{_0x9b8dde[_0x6ef3('0x41')](_0x9b8dde[_0x6ef3('0x21')][_0x2039fd['id']],_0x2039fd);}}}return _0x9b8dde['salesforceAccounts'];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x4b')]=function(){var _0x34ae04=this;return function(_0x4bde8b){if(_0x4bde8b){freeIsNotKey(_0x4bde8b,_0x34ae04[_0x6ef3('0x23')],'id');for(var _0x404c15=0x0,_0x5e3d66={},_0x590861={};_0x404c15<_0x4bde8b[_0x6ef3('0x45')];_0x404c15+=0x1){_0x5e3d66=_0x4bde8b[_0x404c15];if(_[_0x6ef3('0x43')](_0x34ae04[_0x6ef3('0x23')][_0x5e3d66['id']])){_0x34ae04['freshdeskAccounts'][_0x5e3d66['id']]=new FreshdeskAccount(_0x5e3d66);}else{_0x34ae04[_0x6ef3('0x41')](_0x34ae04[_0x6ef3('0x23')][_0x5e3d66['id']],_0x5e3d66);}}}return _0x34ae04[_0x6ef3('0x23')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x4c')]=function(){var _0x23d8dc=this;return function(_0x2f8a5c){if(_0x2f8a5c){freeIsNotKey(_0x2f8a5c,_0x23d8dc[_0x6ef3('0x4d')],'id');for(var _0x38f6d4=0x0,_0x152fc6={},_0x23ffde={};_0x38f6d4<_0x2f8a5c['length'];_0x38f6d4+=0x1){_0x152fc6=_0x2f8a5c[_0x38f6d4];if(_['isUndefined'](_0x23d8dc[_0x6ef3('0x4d')][_0x152fc6['id']])){_0x23d8dc[_0x6ef3('0x4d')][_0x152fc6['id']]=new ZohoAccount(_0x152fc6);}else{_0x23d8dc['mergeFromDatabase'](_0x23d8dc[_0x6ef3('0x4d')][_0x152fc6['id']],_0x152fc6);}}}return _0x23d8dc[_0x6ef3('0x4d')];};};Realtime[_0x6ef3('0x42')]['initDeskAccounts']=function(){var _0x490982=this;return function(_0x590a25){if(_0x590a25){freeIsNotKey(_0x590a25,_0x490982[_0x6ef3('0x4e')],'id');for(var _0x41fb29=0x0,_0x6d2a50={},_0x641f1c={};_0x41fb29<_0x590a25['length'];_0x41fb29+=0x1){_0x6d2a50=_0x590a25[_0x41fb29];if(_[_0x6ef3('0x43')](_0x490982[_0x6ef3('0x4e')][_0x6d2a50['id']])){_0x490982[_0x6ef3('0x4e')][_0x6d2a50['id']]=new DeskAccount(_0x6d2a50);}else{_0x490982[_0x6ef3('0x41')](_0x490982['deskAccounts'][_0x6d2a50['id']],_0x6d2a50);}}}return _0x490982[_0x6ef3('0x4e')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x4f')]=function(){var _0x302422=this;return function(_0x2d2fe0){if(_0x2d2fe0){freeIsNotKey(_0x2d2fe0,_0x302422[_0x6ef3('0x22')],'id');for(var _0x30a406=0x0,_0x5290e3={},_0x3eb2ad={};_0x30a406<_0x2d2fe0[_0x6ef3('0x45')];_0x30a406+=0x1){_0x5290e3=_0x2d2fe0[_0x30a406];if(_[_0x6ef3('0x43')](_0x302422[_0x6ef3('0x22')][_0x5290e3['id']])){_0x302422[_0x6ef3('0x22')][_0x5290e3['id']]=new SugarcrmAccount(_0x5290e3);}else{_0x302422[_0x6ef3('0x41')](_0x302422[_0x6ef3('0x22')][_0x5290e3['id']],_0x5290e3);}}}return _0x302422[_0x6ef3('0x22')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x50')]=function(){var _0x370973=this;return function(_0x49b06e){if(_0x49b06e){freeIsNotKey(_0x49b06e,_0x370973[_0x6ef3('0x24')],'id');for(var _0x70b84f=0x0,_0x614efc={},_0x5b1bf8={};_0x70b84f<_0x49b06e[_0x6ef3('0x45')];_0x70b84f+=0x1){_0x614efc=_0x49b06e[_0x70b84f];if(_[_0x6ef3('0x43')](_0x370973[_0x6ef3('0x24')][_0x614efc['id']])){_0x370973[_0x6ef3('0x24')][_0x614efc['id']]=new VtigerAccount(_0x614efc);}else{_0x370973[_0x6ef3('0x41')](_0x370973[_0x6ef3('0x24')][_0x614efc['id']],_0x614efc);}}}return _0x370973[_0x6ef3('0x24')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x51')]=function(){var _0x591f57=this;return function(_0x13d61a){if(_0x13d61a){freeIsNotKey(_0x13d61a,_0x591f57[_0x6ef3('0x25')],'id');for(var _0x309dad=0x0,_0x534ea9={},_0x2d7617={};_0x309dad<_0x13d61a[_0x6ef3('0x45')];_0x309dad+=0x1){_0x534ea9=_0x13d61a[_0x309dad];if(_[_0x6ef3('0x43')](_0x591f57[_0x6ef3('0x25')][_0x534ea9['id']])){_0x591f57[_0x6ef3('0x25')][_0x534ea9['id']]=new ServicenowAccount(_0x534ea9);}else{_0x591f57[_0x6ef3('0x41')](_0x591f57[_0x6ef3('0x25')][_0x534ea9['id']],_0x534ea9);}}}return _0x591f57[_0x6ef3('0x25')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x52')]=function(){var _0x324448=this;return function(_0x28da4e){if(_0x28da4e){freeIsNotKey(_0x28da4e,_0x324448[_0x6ef3('0x26')],'id');for(var _0x3222e4=0x0,_0x199521={},_0x5a5e52={};_0x3222e4<_0x28da4e['length'];_0x3222e4+=0x1){_0x199521=_0x28da4e[_0x3222e4];if(_['isUndefined'](_0x324448[_0x6ef3('0x26')][_0x199521['id']])){_0x324448[_0x6ef3('0x26')][_0x199521['id']]=new Dynamics365Account(_0x199521);}else{_0x324448[_0x6ef3('0x41')](_0x324448['dynamics365Accounts'][_0x199521['id']],_0x199521);}}}return _0x324448[_0x6ef3('0x26')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x53')]=function(){var _0x4278c0=this;return function(_0x469c69){if(_0x469c69){freeIsNotKey(_0x469c69,_0x4278c0[_0x6ef3('0x54')],'id');for(var _0x42eedb=0x0,_0x19858d={},_0x19a44d={};_0x42eedb<_0x469c69[_0x6ef3('0x45')];_0x42eedb+=0x1){_0x19858d=_0x469c69[_0x42eedb];if(_[_0x6ef3('0x43')](_0x4278c0[_0x6ef3('0x54')][_0x19858d['id']])){_0x4278c0[_0x6ef3('0x54')][_0x19858d['id']]=new FreshsalesAccount(_0x19858d);}else{_0x4278c0[_0x6ef3('0x41')](_0x4278c0[_0x6ef3('0x54')][_0x19858d['id']],_0x19858d);}}}return _0x4278c0[_0x6ef3('0x54')];};};Realtime['prototype'][_0x6ef3('0x55')]=function(){var _0x4859e3=this;return function(_0x55abd8){for(var _0x48ca39=0x0;_0x48ca39<_0x55abd8[_0x6ef3('0x45')];_0x48ca39+=0x1){_[_0x6ef3('0x56')](_0x4859e3[_0x6ef3('0x18')][_0x55abd8[_0x48ca39][_0x6ef3('0x2c')]],_0x55abd8[_0x48ca39]);}return _0x4859e3[_0x6ef3('0x18')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x57')]=function(){var _0x288313=this;return function(_0x282306){clearVoiceQueues(_0x288313[_0x6ef3('0x18')]);if(_0x282306){_0x282306=_[_0x6ef3('0x58')](_0x282306,_0x6ef3('0x59'));for(var _0x27d33c in _0x282306){if(_0x282306['hasOwnProperty'](_0x27d33c)){var _0x278429={};for(var _0x3f24e7=0x0;_0x3f24e7<_0x282306[_0x27d33c][_0x6ef3('0x45')];_0x3f24e7+=0x1){var _0x6f6b19=_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x5a')];if(_0x288313[_0x6ef3('0x18')][_0x6f6b19]){if(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x5b')]){_0x288313[_0x6ef3('0x18')][_0x6f6b19][_0x6ef3('0x5c')]+=0x1;}if(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x5d')]){_0x288313[_0x6ef3('0x18')][_0x6f6b19][_0x6ef3('0x35')]+=0x1;}_0x288313[_0x6ef3('0x18')][_0x6f6b19]['sumHoldTime']+=moment(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x5e')])[_0x6ef3('0x5f')](moment(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x60')]),'seconds')||0x0;if(_0x3f24e7===_0x282306[_0x27d33c][_0x6ef3('0x45')]-0x1){_0x288313[_0x6ef3('0x18')][_0x6f6b19][_0x6ef3('0x31')]+=moment(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x61')]||_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x62')]||_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x63')])[_0x6ef3('0x5f')](moment(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x60')]),'seconds')||0x0;_0x288313[_0x6ef3('0x18')][_0x6f6b19][_0x6ef3('0x34')]+=0x1;if(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x64')]){_0x288313[_0x6ef3('0x18')][_0x6f6b19]['answered']+=0x1;_0x288313['voiceQueues'][_0x6f6b19][_0x6ef3('0x36')]+=moment(_0x282306[_0x27d33c][_0x3f24e7][_0x6ef3('0x61')])['diff'](moment(_0x282306[_0x27d33c][_0x3f24e7]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x288313[_0x6ef3('0x18')][_0x6f6b19][_0x6ef3('0x31')]+=_0x288313[_0x6ef3('0x18')][_0x6f6b19]['sumHoldTime']||0x0;}}}}}}return _0x288313[_0x6ef3('0x18')];};};Realtime[_0x6ef3('0x42')]['initVoiceCallReports']=function(){var _0x2447e2=this;return function(_0x33680c){clearVoiceCallReports(_0x2447e2[_0x6ef3('0x1c')]);if(_0x33680c){for(var _0x540069=0x0;_0x540069<_0x33680c[_0x6ef3('0x45')];_0x540069+=0x1){_0x2447e2[_0x6ef3('0x1c')][_0x6ef3('0x34')]+=0x1;_0x2447e2[_0x6ef3('0x1c')]['sumDuration']+=_0x33680c[_0x540069][_0x6ef3('0x65')];if(_0x33680c[_0x540069][_0x6ef3('0x66')]===_0x6ef3('0x67')){_0x2447e2[_0x6ef3('0x1c')][_0x6ef3('0x2f')]+=0x1;_0x2447e2[_0x6ef3('0x1c')][_0x6ef3('0x30')]+=_0x33680c[_0x540069][_0x6ef3('0x65')]-_0x33680c[_0x540069][_0x6ef3('0x68')]||0x0;_0x2447e2[_0x6ef3('0x1c')][_0x6ef3('0x36')]+=_0x33680c[_0x540069][_0x6ef3('0x68')];}}}return _0x2447e2[_0x6ef3('0x1c')];};};Realtime[_0x6ef3('0x42')][_0x6ef3('0x69')]=function(){var _0x5e14fe=this;return function(_0x138e3f){if(_0x138e3f){freeIsNotKey(_0x138e3f,_0x5e14fe[_0x6ef3('0x1a')],_0x6ef3('0x2c'));for(var _0x2697d4=0x0,_0x5468f0={};_0x2697d4<_0x138e3f[_0x6ef3('0x45')];_0x2697d4+=0x1){_0x5468f0=_0x138e3f[_0x2697d4];if(_['isUndefined'](_0x5e14fe[_0x6ef3('0x1a')][_0x5468f0[_0x6ef3('0x2c')]])){_0x5e14fe[_0x6ef3('0x1a')][_0x5468f0[_0x6ef3('0x2c')]]=new Campaign(_0x5468f0);}else{_0x5e14fe['mergeFromDatabase'](_0x5e14fe[_0x6ef3('0x1a')][_0x5468f0[_0x6ef3('0x2c')]],_0x5468f0);_0x5e14fe[_0x6ef3('0x1a')][_0x5468f0[_0x6ef3('0x2c')]][_0x6ef3('0x6a')]=_0x5468f0[_0x6ef3('0x6b')]?_0x5468f0[_0x6ef3('0x6b')][_0x6ef3('0x2c')]:undefined;}}}return _0x5e14fe[_0x6ef3('0x1a')];};};Realtime['prototype'][_0x6ef3('0x6c')]=function(){var _0x24004c=this;return function(_0x10b766){if(_0x10b766){freeIsNotKey(_0x10b766,_0x24004c[_0x6ef3('0x6d')],'id');for(var _0x330589=0x0,_0x3efbad={};_0x330589<_0x10b766[_0x6ef3('0x45')];_0x330589+=0x1){_0x3efbad=_0x10b766[_0x330589];if(_['isUndefined'](_0x24004c[_0x6ef3('0x6d')][_0x3efbad['id']])){_0x24004c[_0x6ef3('0x6d')][_0x3efbad['id']]=new VoiceExtension(_0x3efbad);}else{_0x24004c[_0x6ef3('0x41')](_0x24004c[_0x6ef3('0x6d')][_0x3efbad['id']],_0x3efbad);}}}return _0x24004c[_0x6ef3('0x6d')];};};Realtime[_0x6ef3('0x42')]['initCampaignHopperHistory']=function(){var _0x794fcd=this;return function(_0x1f84e9){clearCampaigns(_0x794fcd[_0x6ef3('0x1a')]);for(var _0x4d3530=0x0;_0x4d3530<_0x1f84e9[_0x6ef3('0x45')];_0x4d3530+=0x1){_[_0x6ef3('0x56')](_0x794fcd[_0x6ef3('0x1a')][_0x1f84e9[_0x4d3530][_0x6ef3('0x2c')]],_0x1f84e9[_0x4d3530]);}return _0x794fcd['campaigns'];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x5729ab=this;return function(_0x44089a){if(_0x44089a){freeIsNotKey(_0x44089a,_0x5729ab[_0x6ef3('0x27')],'id');for(var _0xdf9649=0x0,_0x31ca21={},_0x3f0132={};_0xdf9649<_0x44089a['length'];_0xdf9649+=0x1){_0x31ca21=_0x44089a[_0xdf9649];if(_['isUndefined'](_0x5729ab[_0x6ef3('0x27')][_0x31ca21['id']])){_0x5729ab[_0x6ef3('0x27')][_0x31ca21['id']]=new FaxAccount(_0x31ca21);}else{_0x5729ab['mergeFromDatabase'](_0x5729ab['faxAccounts'][_0x31ca21['id']],_0x31ca21);}}}return _0x5729ab['faxAccounts'];};};module[_0x6ef3('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 9604842..0fd65d0 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 _0xc901=['dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','\x22%s\x22\x20<%s>','monitor','monitors','length','monitorFilename','filename','createdAt','exten','connectedlinenum','calleridname','connectedlinename','membername','create','voiceAgentReport','isArray','startsWith','Local','substring','indexOf','interface','exports','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedTransfer','prototype','findAgent','find','isNil','name','format','SIP/%s','accountcode','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc901,0x129));var _0x1c90=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc901[_0x19950b];return _0x3c6b41;};'use strict';var BPromise=require(_0x1c90('0x0'));var _=require(_0x1c90('0x1'));var moment=require(_0x1c90('0x2'));var util=require(_0x1c90('0x3'));var config=require(_0x1c90('0x4'));var logger=require(_0x1c90('0x5'))(_0x1c90('0x6'));var ami=require(_0x1c90('0x7'));var RpcVoiceAgentReport=require(_0x1c90('0x8'));var RpcVoiceCallReport=require(_0x1c90('0x9'));var RpcVoiceDialReport=require(_0x1c90('0xa'));var RpcMemberReport=require(_0x1c90('0xb'));var RpcVoiceQueueReport=require(_0x1c90('0xc'));var RpcVoiceRecording=require(_0x1c90('0xd'));var RpcVoiceTransferReport=require(_0x1c90('0xe'));var VoiceQueueReport=require(_0x1c90('0xf'));var VoiceCallReport=require(_0x1c90('0x10'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x1c90('0x11'));var UserReport=require(_0x1c90('0x12'));function Report(_0x1ce379){this[_0x1c90('0x13')]=_0x1ce379;this[_0x1c90('0x14')]=_0x1ce379['agents'];this[_0x1c90('0x15')]=_0x1ce379[_0x1c90('0x15')];}Report['prototype'][_0x1c90('0x16')]=function(_0x45e96a){var _0x261665=new VoiceQueueReport(this[_0x1c90('0x13')]);var _0x548f14=new VoiceAgentReport(this['realtime']);var _0x2ed9f7=new VoiceDialReport(this[_0x1c90('0x13')]);var _0x57a9a6=new VoiceCallReport(this[_0x1c90('0x13')]);var _0x514cb3=new UserReport(this[_0x1c90('0x13')]);if(config[_0x1c90('0x17')]&&config[_0x1c90('0x17')][_0x1c90('0x18')]){ami['on'](_0x1c90('0x19'),this[_0x1c90('0x1a')][_0x1c90('0x1b')](this));ami['on'](_0x1c90('0x1c'),this[_0x1c90('0x1d')]['bind'](this));ami['on'](_0x1c90('0x1e'),this['voiceAgentReport'][_0x1c90('0x1b')](this));ami['on'](_0x1c90('0x1f'),this[_0x1c90('0x20')]['bind'](this));ami['on']('blindtransfer',this[_0x1c90('0x21')][_0x1c90('0x1b')](this));ami['on']('attendedtransfer',this[_0x1c90('0x22')]['bind'](this));}};Report[_0x1c90('0x23')][_0x1c90('0x24')]=function(_0x5095d2){var _0x2c6ad2=undefined;_0x2c6ad2=_[_0x1c90('0x25')](this[_0x1c90('0x14')],function(_0x55b89f){return _0x55b89f['accountcode']==_0x5095d2||_0x55b89f['name']==_0x5095d2;});if(_[_0x1c90('0x26')](_0x2c6ad2)){var _0x2c1e8e=_[_0x1c90('0x25')](this[_0x1c90('0x15')],function(_0x10ac07){return _0x10ac07['accountcode']==_0x5095d2||_0x10ac07[_0x1c90('0x27')]==_0x5095d2;});if(_0x2c1e8e){_0x2c6ad2=_['find'](this[_0x1c90('0x14')],function(_0x2e84eb){return _0x2e84eb['interface']==util[_0x1c90('0x28')](_0x1c90('0x29'),_0x2c1e8e[_0x1c90('0x27')]);});}}return _0x2c6ad2;};Report[_0x1c90('0x23')][_0x1c90('0x1a')]=function(_0x363b7b){for(var _0x4a19a9=0x0;_0x4a19a9<_0x363b7b['length'];_0x4a19a9+=0x1){var _0x1e274f=this['findAgent'](_0x363b7b[_0x4a19a9]['connectedlinenum']);if(_0x1e274f){_0x363b7b[_0x4a19a9][_0x1c90('0x2a')]=_0x1e274f[_0x1c90('0x2a')];_0x363b7b[_0x4a19a9][_0x1c90('0x2b')]=!![];_0x363b7b[_0x4a19a9][_0x1c90('0x2c')]=_0x1e274f['name'];_0x363b7b[_0x4a19a9]['interface']=_['isNil'](_0x1e274f['interface'])?util[_0x1c90('0x28')]('SIP/%s',_0x1e274f[_0x1c90('0x27')]):_0x1e274f['interface'];if(_0x363b7b[_0x4a19a9][_0x1c90('0x2d')]){_0x363b7b[_0x4a19a9]['queuecallercompleteAt']=moment()[_0x1c90('0x28')](_0x1c90('0x2e'));}if(_0x363b7b[_0x4a19a9][_0x1c90('0x2f')]){_0x363b7b[_0x4a19a9][_0x1c90('0x30')]=moment()['format'](_0x1c90('0x2e'));}RpcMemberReport[_0x1c90('0x1a')](_0x363b7b[_0x4a19a9]);}RpcVoiceQueueReport['create'](_0x363b7b[_0x4a19a9]);}};function extractCalleridNumber(_0x1eab93){var _0x451b82=_0x1eab93[_0x1c90('0x31')](/<(.*?)>/);return _0x451b82?_0x451b82[0x1]:_0x1eab93;}Report[_0x1c90('0x23')][_0x1c90('0x1d')]=function(_0x321848){_0x321848[_0x1c90('0x32')]=_0x321848[_0x1c90('0x32')]||_0x321848['exten'];if(_0x321848['type']==_0x1c90('0x33')){_0x321848[_0x1c90('0x34')]='queue';_0x321848[_0x1c90('0x35')]=_0x321848[_0x1c90('0x36')];if(_0x321848[_0x1c90('0x37')]==_0x1c90('0x38')){_0x321848[_0x1c90('0x2a')]='';_0x321848[_0x1c90('0x32')]=extractCalleridNumber(_0x321848[_0x1c90('0x39')]);}else if(_0x321848[_0x1c90('0x37')]==_0x1c90('0x3a')){if(_0x321848[_0x1c90('0x32')]==_0x1c90('0x3b')){_0x321848[_0x1c90('0x32')]=extractCalleridNumber(_0x321848[_0x1c90('0x3c')]);_0x321848[_0x1c90('0x3d')]=_0x321848[_0x1c90('0x3e')];_0x321848[_0x1c90('0x3f')]=[_0x321848[_0x1c90('0x40')],_0x321848['channel']=_0x321848['destinationchannel']][0x0];_0x321848['callerid']=_0x321848['calleridpreview'];}else{_0x321848[_0x1c90('0x32')]=_0x321848[_0x1c90('0x3d')];_0x321848[_0x1c90('0x3d')]=_0x321848[_0x1c90('0x3e')];if(_0x321848['disposition']==_0x1c90('0x41')){_0x321848[_0x1c90('0x2a')]=_0x321848['connectedlinenum'];}else{_0x321848[_0x1c90('0x2a')]='';}}}}else{_0x321848[_0x1c90('0x39')]=util[_0x1c90('0x28')](_0x1c90('0x42'),_0x321848['calleridname'],_0x321848[_0x1c90('0x3d')]);}RpcVoiceCallReport['create'](_0x321848);if(_0x321848[_0x1c90('0x43')]){for(var _0x3af777=0x0;_0x3af777<_0x321848[_0x1c90('0x44')][_0x1c90('0x45')];_0x3af777+=0x1){_0x321848[_0x1c90('0x46')]=_0x321848[_0x1c90('0x44')][_0x3af777][_0x1c90('0x47')];_0x321848['createdAt']=_0x321848[_0x1c90('0x44')][_0x3af777][_0x1c90('0x48')];if(_0x321848[_0x1c90('0x49')]==_0x1c90('0x3b')){_0x321848[_0x1c90('0x3d')]=_0x321848[_0x1c90('0x4a')];_0x321848[_0x1c90('0x4b')]=_0x321848[_0x1c90('0x4c')];_0x321848[_0x1c90('0x4a')]=_0x321848[_0x1c90('0x2a')];_0x321848[_0x1c90('0x4c')]=_0x321848[_0x1c90('0x4d')];_0x321848[_0x1c90('0x49')]=_0x321848[_0x1c90('0x3e')];}else if(_0x321848[_0x1c90('0x49')]=='xcally-motion-dialer'){_0x321848['calleridnum']=_0x321848[_0x1c90('0x32')];_0x321848[_0x1c90('0x49')]=_0x321848[_0x1c90('0x3e')];}RpcVoiceRecording[_0x1c90('0x4e')](_0x321848);}}};Report['prototype'][_0x1c90('0x4f')]=function(_0xcc0377){if(_[_0x1c90('0x50')](_0xcc0377)){_0xcc0377['forEach'](function(_0x32a16d){RpcVoiceAgentReport['create'](_0x32a16d);});}else{RpcVoiceAgentReport[_0x1c90('0x4e')](_0xcc0377);}};Report[_0x1c90('0x23')][_0x1c90('0x20')]=function(_0x45a1d5){RpcVoiceDialReport[_0x1c90('0x4e')](_0x45a1d5);var _0x3c913e=undefined;var _0x2b31de=_0x45a1d5['channel'];if(_[_0x1c90('0x51')](_0x2b31de,_0x1c90('0x52'))){var _0x354d80=_0x2b31de[_0x1c90('0x53')](_0x2b31de[_0x1c90('0x54')]('/')+0x1,_0x2b31de[_0x1c90('0x54')]('@'));_0x3c913e=_[_0x1c90('0x25')](this[_0x1c90('0x14')],function(_0x2dd7be){return _0x2dd7be['mobile']==_0x354d80||_0x2dd7be['phone']==_0x354d80||_0x2dd7be[_0x1c90('0x2a')]==_0x354d80;});}else{var _0x354d80=_0x2b31de['substring'](_0x2b31de['indexOf']('/')+0x1,_0x2b31de['lastIndexOf']('-'));_0x3c913e=this[_0x1c90('0x24')](_0x354d80);}if(_0x3c913e){_0x45a1d5['interface']=_[_0x1c90('0x26')](_0x3c913e[_0x1c90('0x55')])?util['format'](_0x1c90('0x29'),_0x3c913e['name']):_0x3c913e['interface'];_0x45a1d5[_0x1c90('0x4d')]=_0x3c913e['name'];_0x45a1d5[_0x1c90('0x2a')]=_0x3c913e[_0x1c90('0x2a')];RpcMemberReport[_0x1c90('0x20')](_0x45a1d5);}};Report[_0x1c90('0x23')][_0x1c90('0x21')]=function(_0x521845){RpcVoiceTransferReport['blindTransfer'](_0x521845);};Report[_0x1c90('0x23')][_0x1c90('0x22')]=function(_0x14b770){RpcVoiceTransferReport['attendedTransfer'](_0x14b770);};module[_0x1c90('0x56')]=Report; \ No newline at end of file +var _0xdaeb=['telephones','prototype','sync','xdr','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','format','SIP/%s','length','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','voiceQueueReport','create','destination','exten','type','dialer','lastapplication','queue','lastdata','context','calleridpreview','originatecalleridnum','destinationchannel','channel','callerid','calleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','monitor','monitors','filename','createdAt','xcally-motion-preview','connectedlinename','connectedlinenum','membername','xcally-motion-dialer','isArray','forEach','Local','indexOf','mobile','lastIndexOf','blindTransfer','exports','bluebird','lodash','util','../../../config/logger','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents'];(function(_0x5537e8,_0x51968b){var _0x4b8b33=function(_0x4dcc75){while(--_0x4dcc75){_0x5537e8['push'](_0x5537e8['shift']());}};_0x4b8b33(++_0x51968b);}(_0xdaeb,0x92));var _0xbdae=function(_0x29d2ac,_0x30d2d3){_0x29d2ac=_0x29d2ac-0x0;var _0x3d5f2f=_0xdaeb[_0x29d2ac];return _0x3d5f2f;};'use strict';var BPromise=require(_0xbdae('0x0'));var _=require(_0xbdae('0x1'));var moment=require('moment');var util=require(_0xbdae('0x2'));var config=require('../../../config/environment');var logger=require(_0xbdae('0x3'))('ami');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xbdae('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xbdae('0x5'));var RpcMemberReport=require(_0xbdae('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xbdae('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xbdae('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xbdae('0x9'));var VoiceDialReport=require(_0xbdae('0xa'));var UserReport=require(_0xbdae('0xb'));function Report(_0x285456){this[_0xbdae('0xc')]=_0x285456;this[_0xbdae('0xd')]=_0x285456[_0xbdae('0xd')];this[_0xbdae('0xe')]=_0x285456[_0xbdae('0xe')];}Report[_0xbdae('0xf')][_0xbdae('0x10')]=function(_0x554459){var _0x18c34f=new VoiceQueueReport(this[_0xbdae('0xc')]);var _0x3415ee=new VoiceAgentReport(this[_0xbdae('0xc')]);var _0x100f13=new VoiceDialReport(this[_0xbdae('0xc')]);var _0x547e51=new VoiceCallReport(this['realtime']);var _0x218d9d=new UserReport(this[_0xbdae('0xc')]);if(config[_0xbdae('0x11')]&&config[_0xbdae('0x11')]['disabled']){ami['on'](_0xbdae('0x12'),this['voiceQueueReport'][_0xbdae('0x13')](this));ami['on'](_0xbdae('0x14'),this[_0xbdae('0x15')]['bind'](this));ami['on'](_0xbdae('0x16'),this[_0xbdae('0x17')][_0xbdae('0x13')](this));ami['on'](_0xbdae('0x18'),this[_0xbdae('0x19')][_0xbdae('0x13')](this));ami['on'](_0xbdae('0x1a'),this['blindTransfer'][_0xbdae('0x13')](this));ami['on'](_0xbdae('0x1b'),this[_0xbdae('0x1c')][_0xbdae('0x13')](this));}};Report[_0xbdae('0xf')][_0xbdae('0x1d')]=function(_0x4d60c1){var _0x2c3daf=undefined;_0x2c3daf=_[_0xbdae('0x1e')](this['agents'],function(_0x467771){return _0x467771[_0xbdae('0x1f')]==_0x4d60c1||_0x467771[_0xbdae('0x20')]==_0x4d60c1;});if(_['isNil'](_0x2c3daf)){var _0x39d10a=_['find'](this[_0xbdae('0xe')],function(_0x126ace){return _0x126ace[_0xbdae('0x1f')]==_0x4d60c1||_0x126ace[_0xbdae('0x20')]==_0x4d60c1;});if(_0x39d10a){_0x2c3daf=_[_0xbdae('0x1e')](this[_0xbdae('0xd')],function(_0x3fe8bb){return _0x3fe8bb[_0xbdae('0x21')]==util[_0xbdae('0x22')](_0xbdae('0x23'),_0x39d10a['name']);});}}return _0x2c3daf;};Report['prototype']['voiceQueueReport']=function(_0x149f5a){for(var _0x14a160=0x0;_0x14a160<_0x149f5a[_0xbdae('0x24')];_0x14a160+=0x1){var _0xe35118=this[_0xbdae('0x1d')](_0x149f5a[_0x14a160]['connectedlinenum']);if(_0xe35118){_0x149f5a[_0x14a160][_0xbdae('0x1f')]=_0xe35118[_0xbdae('0x1f')];_0x149f5a[_0x14a160][_0xbdae('0x25')]=!![];_0x149f5a[_0x14a160][_0xbdae('0x26')]=_0xe35118['name'];_0x149f5a[_0x14a160][_0xbdae('0x21')]=_[_0xbdae('0x27')](_0xe35118['interface'])?util['format'](_0xbdae('0x23'),_0xe35118[_0xbdae('0x20')]):_0xe35118[_0xbdae('0x21')];if(_0x149f5a[_0x14a160][_0xbdae('0x28')]){_0x149f5a[_0x14a160][_0xbdae('0x29')]=moment()[_0xbdae('0x22')](_0xbdae('0x2a'));}if(_0x149f5a[_0x14a160]['queuecallerexit']){_0x149f5a[_0x14a160][_0xbdae('0x2b')]=moment()[_0xbdae('0x22')](_0xbdae('0x2a'));}RpcMemberReport[_0xbdae('0x2c')](_0x149f5a[_0x14a160]);}RpcVoiceQueueReport[_0xbdae('0x2d')](_0x149f5a[_0x14a160]);}};function extractCalleridNumber(_0x25f4e3){var _0x256bcb=_0x25f4e3['match'](/<(.*?)>/);return _0x256bcb?_0x256bcb[0x1]:_0x25f4e3;}Report['prototype'][_0xbdae('0x15')]=function(_0x140615){_0x140615[_0xbdae('0x2e')]=_0x140615['destination']||_0x140615[_0xbdae('0x2f')];if(_0x140615[_0xbdae('0x30')]==_0xbdae('0x31')){_0x140615[_0xbdae('0x32')]=_0xbdae('0x33');_0x140615[_0xbdae('0x34')]=_0x140615['queue'];if(_0x140615['context']=='from-voip-provider'){_0x140615[_0xbdae('0x1f')]='';_0x140615[_0xbdae('0x2e')]=extractCalleridNumber(_0x140615['callerid']);}else if(_0x140615[_0xbdae('0x35')]=='from-sip'){if(_0x140615[_0xbdae('0x2e')]=='xcally-motion-preview'){_0x140615[_0xbdae('0x2e')]=extractCalleridNumber(_0x140615[_0xbdae('0x36')]);_0x140615['calleridnum']=_0x140615[_0xbdae('0x37')];_0x140615[_0xbdae('0x38')]=[_0x140615[_0xbdae('0x39')],_0x140615['channel']=_0x140615[_0xbdae('0x38')]][0x0];_0x140615[_0xbdae('0x3a')]=_0x140615['calleridpreview'];}else{_0x140615[_0xbdae('0x2e')]=_0x140615[_0xbdae('0x3b')];_0x140615['calleridnum']=_0x140615[_0xbdae('0x37')];if(_0x140615[_0xbdae('0x3c')]==_0xbdae('0x3d')){_0x140615[_0xbdae('0x1f')]=_0x140615['connectedlinenum'];}else{_0x140615['accountcode']='';}}}}else{_0x140615[_0xbdae('0x3a')]=util[_0xbdae('0x22')](_0xbdae('0x3e'),_0x140615['calleridname'],_0x140615[_0xbdae('0x3b')]);}RpcVoiceCallReport[_0xbdae('0x2d')](_0x140615);if(_0x140615[_0xbdae('0x3f')]){for(var _0x2946a9=0x0;_0x2946a9<_0x140615[_0xbdae('0x40')]['length'];_0x2946a9+=0x1){_0x140615['monitorFilename']=_0x140615[_0xbdae('0x40')][_0x2946a9][_0xbdae('0x41')];_0x140615[_0xbdae('0x42')]=_0x140615['monitors'][_0x2946a9][_0xbdae('0x42')];if(_0x140615[_0xbdae('0x2f')]==_0xbdae('0x43')){_0x140615[_0xbdae('0x3b')]=_0x140615['connectedlinenum'];_0x140615['calleridname']=_0x140615[_0xbdae('0x44')];_0x140615[_0xbdae('0x45')]=_0x140615[_0xbdae('0x1f')];_0x140615['connectedlinename']=_0x140615[_0xbdae('0x46')];_0x140615[_0xbdae('0x2f')]=_0x140615[_0xbdae('0x37')];}else if(_0x140615[_0xbdae('0x2f')]==_0xbdae('0x47')){_0x140615[_0xbdae('0x3b')]=_0x140615[_0xbdae('0x2e')];_0x140615[_0xbdae('0x2f')]=_0x140615[_0xbdae('0x37')];}RpcVoiceRecording[_0xbdae('0x2d')](_0x140615);}}};Report['prototype'][_0xbdae('0x17')]=function(_0x4dc126){if(_[_0xbdae('0x48')](_0x4dc126)){_0x4dc126[_0xbdae('0x49')](function(_0x58964f){RpcVoiceAgentReport[_0xbdae('0x2d')](_0x58964f);});}else{RpcVoiceAgentReport[_0xbdae('0x2d')](_0x4dc126);}};Report['prototype'][_0xbdae('0x19')]=function(_0x5b1b66){RpcVoiceDialReport[_0xbdae('0x2d')](_0x5b1b66);var _0x188005=undefined;var _0x1bdcd1=_0x5b1b66[_0xbdae('0x39')];if(_['startsWith'](_0x1bdcd1,_0xbdae('0x4a'))){var _0x285a76=_0x1bdcd1['substring'](_0x1bdcd1[_0xbdae('0x4b')]('/')+0x1,_0x1bdcd1[_0xbdae('0x4b')]('@'));_0x188005=_[_0xbdae('0x1e')](this['agents'],function(_0x1425de){return _0x1425de[_0xbdae('0x4c')]==_0x285a76||_0x1425de['phone']==_0x285a76||_0x1425de[_0xbdae('0x1f')]==_0x285a76;});}else{var _0x285a76=_0x1bdcd1['substring'](_0x1bdcd1[_0xbdae('0x4b')]('/')+0x1,_0x1bdcd1[_0xbdae('0x4d')]('-'));_0x188005=this['findAgent'](_0x285a76);}if(_0x188005){_0x5b1b66[_0xbdae('0x21')]=_[_0xbdae('0x27')](_0x188005[_0xbdae('0x21')])?util[_0xbdae('0x22')](_0xbdae('0x23'),_0x188005[_0xbdae('0x20')]):_0x188005[_0xbdae('0x21')];_0x5b1b66[_0xbdae('0x46')]=_0x188005['name'];_0x5b1b66[_0xbdae('0x1f')]=_0x188005[_0xbdae('0x1f')];RpcMemberReport['voiceDialReport'](_0x5b1b66);}};Report[_0xbdae('0xf')][_0xbdae('0x4e')]=function(_0x34f15f){RpcVoiceTransferReport[_0xbdae('0x4e')](_0x34f15f);};Report[_0xbdae('0xf')][_0xbdae('0x1c')]=function(_0x59a5c5){RpcVoiceTransferReport['attendedTransfer'](_0x59a5c5);};module[_0xbdae('0x4f')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 733f62a..1f8303d 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 _0xb271=['loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','error','inspect','catch','prototype','isNotNull','isUndefined','emit','find','stateRegistry','state','event','actionid','format','trunk:%s','[syncRegistry][UserReport]','syncDeviceState','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephones','name','telephone:save','trunk:save','startsWith','Local','mobile','phone','accountcode','[syncDeviceState][UserReport]','syncPeerStatus','peerstatus','peer','registered','address','status','telephone:%s','[syncPeerStatus][UserReport]','exports','lodash','bluebird','util','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','registryentry','syncRegistry','registry','bind','devicestatechange'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0xb271,0x1b6));var _0x1b27=function(_0x7ab248,_0x46a6a0){_0x7ab248=_0x7ab248-0x0;var _0xc03622=_0xb271[_0x7ab248];return _0xc03622;};'use strict';var _=require(_0x1b27('0x0'));var moment=require('moment');var BPromise=require(_0x1b27('0x1'));var util=require(_0x1b27('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x1b27('0x3'))(_0x1b27('0x4'));var ami=require(_0x1b27('0x5'));config[_0x1b27('0x6')]=_[_0x1b27('0x7')](config['redis'],{'host':_0x1b27('0x8'),'port':0x18eb});var io=require(_0x1b27('0x9'))(new Redis(config[_0x1b27('0x6')]));function UserReport(_0x2977f3){this[_0x1b27('0xa')]=_0x2977f3[_0x1b27('0xa')];this[_0x1b27('0xb')]=_0x2977f3[_0x1b27('0xb')];this['telephones']=_0x2977f3['telephones'];ami['on'](_0x1b27('0xc'),this[_0x1b27('0xd')]['bind'](this));ami['on'](_0x1b27('0xe'),this[_0x1b27('0xd')][_0x1b27('0xf')](this));ami['on'](_0x1b27('0x10'),this['syncDeviceState'][_0x1b27('0xf')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0x1b27('0xf')](this));this[_0x1b27('0x11')]();return BPromise[_0x1b27('0x12')]()[_0x1b27('0x13')](ami[_0x1b27('0x14')]())['then'](ami[_0x1b27('0x15')]())[_0x1b27('0x13')](ami[_0x1b27('0x16')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x5d068a){return function(_0x14f8a1){logger[_0x1b27('0x17')](_0x5d068a,util[_0x1b27('0x18')](_0x14f8a1,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0x1b27('0x11')]=function(){setInterval(function(){BPromise[_0x1b27('0x12')]()[_0x1b27('0x13')](ami[_0x1b27('0x14')]())[_0x1b27('0x13')](ami[_0x1b27('0x15')]())[_0x1b27('0x13')](ami['actionSipPeerStatus']())[_0x1b27('0x19')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0x1b27('0x1a')][_0x1b27('0x1b')]=function(_0x3e3dde){return _0x3e3dde!==null&&!_[_0x1b27('0x1c')](_0x3e3dde);};UserReport[_0x1b27('0x1a')]['emit']=function(_0x21d21f,_0x5b7b5e,_0x35afb1){io['to'](_0x21d21f)[_0x1b27('0x1d')](_0x5b7b5e,_0x35afb1);};UserReport['prototype'][_0x1b27('0xd')]=function(_0x31a2e7){try{if(this[_0x1b27('0x1b')](_0x31a2e7)){var _0x15be04=_[_0x1b27('0x1e')](this[_0x1b27('0xa')],{'registry':_0x31a2e7['username']});if(_0x15be04){_0x31a2e7[_0x1b27('0x1f')]=_0x31a2e7[_0x1b27('0x20')];_['merge'](_0x15be04,_['omit'](_0x31a2e7,[_0x1b27('0x21'),_0x1b27('0x22'),'username',_0x1b27('0x20')]));this[_0x1b27('0x1d')](util[_0x1b27('0x23')](_0x1b27('0x24'),_0x15be04['name']),'trunk:save',_0x15be04);}}}catch(_0x4783c4){logger[_0x1b27('0x17')](_0x1b27('0x25'),util[_0x1b27('0x18')](_0x4783c4,{'showHidden':![],'depth':null}));}};UserReport[_0x1b27('0x1a')][_0x1b27('0x26')]=function(_0x36e122){try{if(this[_0x1b27('0x1b')](_0x36e122)){if(this['agents'][_0x36e122[_0x1b27('0x27')]]){if(!this['agents'][_0x36e122[_0x1b27('0x27')]][_0x1b27('0x28')]||_0x36e122[_0x1b27('0x20')][_0x1b27('0x29')]()==_0x1b27('0x2a')){this[_0x1b27('0xb')][_0x36e122[_0x1b27('0x27')]]['local']=![];if(this[_0x1b27('0xb')][_0x36e122[_0x1b27('0x27')]][_0x1b27('0x20')]!==_0x36e122[_0x1b27('0x20')][_0x1b27('0x29')]()){this[_0x1b27('0xb')][_0x36e122[_0x1b27('0x27')]][_0x1b27('0x2b')]=_[_0x1b27('0x2c')](moment()['format']('x'));}this[_0x1b27('0xb')][_0x36e122[_0x1b27('0x27')]][_0x1b27('0x20')]=_0x36e122['state'][_0x1b27('0x29')]();this[_0x1b27('0xb')][_0x36e122[_0x1b27('0x27')]][_0x1b27('0x2d')](_0x36e122);}}else if(this[_0x1b27('0x2e')][_0x36e122[_0x1b27('0x27')]]){if(this[_0x1b27('0x2e')][_0x36e122[_0x1b27('0x27')]][_0x1b27('0x20')]!==_0x36e122[_0x1b27('0x20')][_0x1b27('0x29')]()){this['telephones'][_0x36e122[_0x1b27('0x27')]][_0x1b27('0x2b')]=_['toNumber'](moment()[_0x1b27('0x23')]('x'));}this['telephones'][_0x36e122[_0x1b27('0x27')]]['state']=_0x36e122[_0x1b27('0x20')]['toLowerCase']();this[_0x1b27('0x1d')](util[_0x1b27('0x23')]('telephone:%s',this[_0x1b27('0x2e')][_0x36e122['device']][_0x1b27('0x2f')]),_0x1b27('0x30'),this[_0x1b27('0x2e')][_0x36e122[_0x1b27('0x27')]]);}else if(this['trunks'][_0x36e122[_0x1b27('0x27')]]){if(this[_0x1b27('0xa')][_0x36e122[_0x1b27('0x27')]]['state']!==_0x36e122['state'][_0x1b27('0x29')]()){this['trunks'][_0x36e122['device']][_0x1b27('0x2b')]=_['toNumber'](moment()[_0x1b27('0x23')]('x'));}this['trunks'][_0x36e122[_0x1b27('0x27')]][_0x1b27('0x20')]=_0x36e122[_0x1b27('0x20')]['toLowerCase']();this[_0x1b27('0x1d')](util[_0x1b27('0x23')](_0x1b27('0x24'),this[_0x1b27('0xa')][_0x36e122[_0x1b27('0x27')]]['name']),_0x1b27('0x31'),this[_0x1b27('0xa')][_0x36e122['device']]);}else if(_[_0x1b27('0x32')](_0x36e122[_0x1b27('0x27')],'Queue')){}else if(_[_0x1b27('0x32')](_0x36e122[_0x1b27('0x27')],_0x1b27('0x33'))){var _0xcd17ae=_0x36e122[_0x1b27('0x27')];var _0x4c93a2=_0xcd17ae['substring'](_0xcd17ae['indexOf']('/')+0x1,_0xcd17ae['indexOf']('@'));var _0x36eaa0=_['find'](this['agents'],function(_0xb660f1){return _0xb660f1[_0x1b27('0x34')]==_0x4c93a2||_0xb660f1[_0x1b27('0x35')]==_0x4c93a2||_0xb660f1[_0x1b27('0x36')]==_0x4c93a2;});if(_0x36eaa0){if(_0x36eaa0[_0x1b27('0x20')]!==_0x36e122[_0x1b27('0x20')][_0x1b27('0x29')]()){_0x36eaa0[_0x1b27('0x2b')]=_[_0x1b27('0x2c')](moment()[_0x1b27('0x23')]('x'));}_0x36eaa0[_0x1b27('0x20')]=_0x36e122[_0x1b27('0x20')][_0x1b27('0x29')]();_0x36eaa0[_0x1b27('0x28')]=!![];_0x36eaa0[_0x1b27('0x2d')](_0x36e122);}}else{}}}catch(_0x59c8b6){logger[_0x1b27('0x17')](_0x1b27('0x37'),util[_0x1b27('0x18')](_0x59c8b6,{'showHidden':![],'depth':null}));}};UserReport[_0x1b27('0x1a')][_0x1b27('0x38')]=function(_0x17fb6b){try{if(this[_0x1b27('0x1b')](_0x17fb6b)&&this[_0x1b27('0x1b')](_0x17fb6b[_0x1b27('0x39')])){if(this[_0x1b27('0xb')][_0x17fb6b[_0x1b27('0x3a')]]){if(!this['agents'][_0x17fb6b[_0x1b27('0x3a')]][_0x1b27('0x28')]||_0x17fb6b[_0x1b27('0x39')][_0x1b27('0x29')]()==_0x1b27('0x3b')){this['agents'][_0x17fb6b[_0x1b27('0x3a')]][_0x1b27('0x28')]=![];this[_0x1b27('0xb')][_0x17fb6b[_0x1b27('0x3a')]]['status']=_0x17fb6b['peerstatus'][_0x1b27('0x29')]();this[_0x1b27('0xb')][_0x17fb6b[_0x1b27('0x3a')]][_0x1b27('0x3c')]=_0x17fb6b[_0x1b27('0x3c')];this[_0x1b27('0xb')][_0x17fb6b['peer']]['updateStatusRealtime'](_0x17fb6b);}}else if(this['telephones'][_0x17fb6b[_0x1b27('0x3a')]]){this[_0x1b27('0x2e')][_0x17fb6b[_0x1b27('0x3a')]][_0x1b27('0x3d')]=_0x17fb6b[_0x1b27('0x39')]['toLowerCase']();this['telephones'][_0x17fb6b[_0x1b27('0x3a')]][_0x1b27('0x3c')]=_0x17fb6b['address'];this['emit'](util[_0x1b27('0x23')](_0x1b27('0x3e'),this[_0x1b27('0x2e')][_0x17fb6b[_0x1b27('0x3a')]][_0x1b27('0x2f')]),'telephone:save',this[_0x1b27('0x2e')][_0x17fb6b[_0x1b27('0x3a')]]);}else if(this[_0x1b27('0xa')][_0x17fb6b[_0x1b27('0x3a')]]){this[_0x1b27('0xa')][_0x17fb6b[_0x1b27('0x3a')]]['status']=_0x17fb6b[_0x1b27('0x39')][_0x1b27('0x29')]();this['trunks'][_0x17fb6b[_0x1b27('0x3a')]]['address']=_0x17fb6b[_0x1b27('0x3c')];this[_0x1b27('0x1d')](util[_0x1b27('0x23')](_0x1b27('0x24'),this[_0x1b27('0xa')][_0x17fb6b[_0x1b27('0x3a')]]['name']),_0x1b27('0x31'),this[_0x1b27('0xa')][_0x17fb6b['peer']]);}else{}}}catch(_0x4ced70){logger[_0x1b27('0x17')](_0x1b27('0x3f'),util[_0x1b27('0x18')](_0x4ced70,{'showHidden':![],'depth':null}));}};module[_0x1b27('0x40')]=UserReport; \ No newline at end of file +var _0x4444=['emit','username','stateRegistry','state','merge','omit','event','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','agents','local','toLowerCase','toNumber','updateStatusRealtime','stateTime','telephone:%s','telephone:save','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','trunks','telephones','registryentry','registry','syncRegistry','bind','devicestatechange','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','error','inspect','prototype','actionDeviceStateList','isNotNull'];(function(_0x3179e1,_0x26a724){var _0x6c8122=function(_0x3037a1){while(--_0x3037a1){_0x3179e1['push'](_0x3179e1['shift']());}};_0x6c8122(++_0x26a724);}(_0x4444,0x1f1));var _0x4444=function(_0x1c9326,_0x4f65bd){_0x1c9326=_0x1c9326-0x0;var _0x33e2e4=_0x4444[_0x1c9326];return _0x33e2e4;};'use strict';var _=require(_0x4444('0x0'));var moment=require(_0x4444('0x1'));var BPromise=require(_0x4444('0x2'));var util=require('util');var Redis=require('ioredis');var config=require(_0x4444('0x3'));var logger=require(_0x4444('0x4'))(_0x4444('0x5'));var ami=require(_0x4444('0x6'));config[_0x4444('0x7')]=_[_0x4444('0x8')](config[_0x4444('0x7')],{'host':_0x4444('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4444('0x7')]));function UserReport(_0x17c623){this[_0x4444('0xa')]=_0x17c623['trunks'];this['agents']=_0x17c623['agents'];this[_0x4444('0xb')]=_0x17c623[_0x4444('0xb')];ami['on'](_0x4444('0xc'),this['syncRegistry']['bind'](this));ami['on'](_0x4444('0xd'),this[_0x4444('0xe')][_0x4444('0xf')](this));ami['on'](_0x4444('0x10'),this['syncDeviceState'][_0x4444('0xf')](this));ami['on'](_0x4444('0x11'),this[_0x4444('0x12')][_0x4444('0xf')](this));this[_0x4444('0x13')]();return BPromise[_0x4444('0x14')]()['then'](ami[_0x4444('0x15')]())[_0x4444('0x16')](ami['actionDeviceStateList']())[_0x4444('0x16')](ami[_0x4444('0x17')]())[_0x4444('0x18')](loggerCatch(_0x4444('0x19')));}function loggerCatch(_0xce5647){return function(_0x73e2a1){logger[_0x4444('0x1a')](_0xce5647,util[_0x4444('0x1b')](_0x73e2a1,{'showHidden':![],'depth':null}));};}UserReport[_0x4444('0x1c')][_0x4444('0x13')]=function(){setInterval(function(){BPromise[_0x4444('0x14')]()[_0x4444('0x16')](ami[_0x4444('0x15')]())['then'](ami[_0x4444('0x1d')]())[_0x4444('0x16')](ami[_0x4444('0x17')]())[_0x4444('0x18')](loggerCatch(_0x4444('0x19')));},0x32c8);};UserReport[_0x4444('0x1c')][_0x4444('0x1e')]=function(_0x561360){return _0x561360!==null&&!_['isUndefined'](_0x561360);};UserReport['prototype'][_0x4444('0x1f')]=function(_0x5cd526,_0x478498,_0x187f99){io['to'](_0x5cd526)['emit'](_0x478498,_0x187f99);};UserReport[_0x4444('0x1c')][_0x4444('0xe')]=function(_0x57e99c){try{if(this[_0x4444('0x1e')](_0x57e99c)){var _0x5f016a=_['find'](this[_0x4444('0xa')],{'registry':_0x57e99c[_0x4444('0x20')]});if(_0x5f016a){_0x57e99c[_0x4444('0x21')]=_0x57e99c[_0x4444('0x22')];_[_0x4444('0x23')](_0x5f016a,_[_0x4444('0x24')](_0x57e99c,[_0x4444('0x25'),'actionid',_0x4444('0x20'),_0x4444('0x22')]));this[_0x4444('0x1f')](util[_0x4444('0x26')](_0x4444('0x27'),_0x5f016a[_0x4444('0x28')]),_0x4444('0x29'),_0x5f016a);}}}catch(_0x1f7134){logger[_0x4444('0x1a')](_0x4444('0x2a'),util[_0x4444('0x1b')](_0x1f7134,{'showHidden':![],'depth':null}));}};UserReport[_0x4444('0x1c')]['syncDeviceState']=function(_0x300076){try{if(this[_0x4444('0x1e')](_0x300076)){if(this['agents'][_0x300076[_0x4444('0x2b')]]){if(!this[_0x4444('0x2c')][_0x300076['device']]['local']||_0x300076['state']['toLowerCase']()=='inuse'){this[_0x4444('0x2c')][_0x300076[_0x4444('0x2b')]][_0x4444('0x2d')]=![];if(this['agents'][_0x300076[_0x4444('0x2b')]][_0x4444('0x22')]!==_0x300076['state'][_0x4444('0x2e')]()){this[_0x4444('0x2c')][_0x300076[_0x4444('0x2b')]]['stateTime']=_[_0x4444('0x2f')](moment()[_0x4444('0x26')]('x'));}this[_0x4444('0x2c')][_0x300076[_0x4444('0x2b')]][_0x4444('0x22')]=_0x300076[_0x4444('0x22')][_0x4444('0x2e')]();this[_0x4444('0x2c')][_0x300076[_0x4444('0x2b')]][_0x4444('0x30')](_0x300076);}}else if(this[_0x4444('0xb')][_0x300076[_0x4444('0x2b')]]){if(this[_0x4444('0xb')][_0x300076[_0x4444('0x2b')]]['state']!==_0x300076[_0x4444('0x22')]['toLowerCase']()){this[_0x4444('0xb')][_0x300076[_0x4444('0x2b')]][_0x4444('0x31')]=_['toNumber'](moment()[_0x4444('0x26')]('x'));}this[_0x4444('0xb')][_0x300076['device']][_0x4444('0x22')]=_0x300076[_0x4444('0x22')][_0x4444('0x2e')]();this['emit'](util[_0x4444('0x26')](_0x4444('0x32'),this[_0x4444('0xb')][_0x300076[_0x4444('0x2b')]][_0x4444('0x28')]),_0x4444('0x33'),this[_0x4444('0xb')][_0x300076['device']]);}else if(this[_0x4444('0xa')][_0x300076[_0x4444('0x2b')]]){if(this[_0x4444('0xa')][_0x300076[_0x4444('0x2b')]][_0x4444('0x22')]!==_0x300076[_0x4444('0x22')]['toLowerCase']()){this['trunks'][_0x300076[_0x4444('0x2b')]][_0x4444('0x31')]=_[_0x4444('0x2f')](moment()['format']('x'));}this['trunks'][_0x300076['device']][_0x4444('0x22')]=_0x300076['state']['toLowerCase']();this[_0x4444('0x1f')](util[_0x4444('0x26')]('trunk:%s',this[_0x4444('0xa')][_0x300076[_0x4444('0x2b')]]['name']),_0x4444('0x29'),this[_0x4444('0xa')][_0x300076['device']]);}else if(_[_0x4444('0x34')](_0x300076[_0x4444('0x2b')],'Queue')){}else if(_[_0x4444('0x34')](_0x300076['device'],_0x4444('0x35'))){var _0x450764=_0x300076[_0x4444('0x2b')];var _0x5efb7c=_0x450764[_0x4444('0x36')](_0x450764['indexOf']('/')+0x1,_0x450764[_0x4444('0x37')]('@'));var _0x4237ec=_['find'](this[_0x4444('0x2c')],function(_0x40b5f2){return _0x40b5f2[_0x4444('0x38')]==_0x5efb7c||_0x40b5f2[_0x4444('0x39')]==_0x5efb7c||_0x40b5f2[_0x4444('0x3a')]==_0x5efb7c;});if(_0x4237ec){if(_0x4237ec[_0x4444('0x22')]!==_0x300076['state'][_0x4444('0x2e')]()){_0x4237ec[_0x4444('0x31')]=_[_0x4444('0x2f')](moment()[_0x4444('0x26')]('x'));}_0x4237ec[_0x4444('0x22')]=_0x300076[_0x4444('0x22')][_0x4444('0x2e')]();_0x4237ec[_0x4444('0x2d')]=!![];_0x4237ec[_0x4444('0x30')](_0x300076);}}else{}}}catch(_0x33405e){logger[_0x4444('0x1a')](_0x4444('0x3b'),util['inspect'](_0x33405e,{'showHidden':![],'depth':null}));}};UserReport[_0x4444('0x1c')][_0x4444('0x12')]=function(_0x58d536){try{if(this['isNotNull'](_0x58d536)&&this[_0x4444('0x1e')](_0x58d536[_0x4444('0x11')])){if(this['agents'][_0x58d536[_0x4444('0x3c')]]){if(!this[_0x4444('0x2c')][_0x58d536['peer']]['local']||_0x58d536[_0x4444('0x11')]['toLowerCase']()==_0x4444('0x3d')){this[_0x4444('0x2c')][_0x58d536[_0x4444('0x3c')]][_0x4444('0x2d')]=![];this[_0x4444('0x2c')][_0x58d536[_0x4444('0x3c')]][_0x4444('0x3e')]=_0x58d536[_0x4444('0x11')]['toLowerCase']();this['agents'][_0x58d536[_0x4444('0x3c')]][_0x4444('0x3f')]=_0x58d536['address'];this['agents'][_0x58d536[_0x4444('0x3c')]][_0x4444('0x30')](_0x58d536);}}else if(this[_0x4444('0xb')][_0x58d536[_0x4444('0x3c')]]){this[_0x4444('0xb')][_0x58d536[_0x4444('0x3c')]][_0x4444('0x3e')]=_0x58d536[_0x4444('0x11')]['toLowerCase']();this[_0x4444('0xb')][_0x58d536['peer']][_0x4444('0x3f')]=_0x58d536[_0x4444('0x3f')];this['emit'](util[_0x4444('0x26')](_0x4444('0x32'),this[_0x4444('0xb')][_0x58d536['peer']][_0x4444('0x28')]),'telephone:save',this[_0x4444('0xb')][_0x58d536['peer']]);}else if(this[_0x4444('0xa')][_0x58d536['peer']]){this[_0x4444('0xa')][_0x58d536[_0x4444('0x3c')]][_0x4444('0x3e')]=_0x58d536[_0x4444('0x11')][_0x4444('0x2e')]();this[_0x4444('0xa')][_0x58d536[_0x4444('0x3c')]][_0x4444('0x3f')]=_0x58d536[_0x4444('0x3f')];this[_0x4444('0x1f')](util[_0x4444('0x26')](_0x4444('0x27'),this[_0x4444('0xa')][_0x58d536['peer']][_0x4444('0x28')]),_0x4444('0x29'),this['trunks'][_0x58d536[_0x4444('0x3c')]]);}else{}}}catch(_0x3062ef){logger[_0x4444('0x1a')](_0x4444('0x40'),util['inspect'](_0x3062ef,{'showHidden':![],'depth':null}));}};module[_0x4444('0x41')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 2504889..9082ca1 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 _0x157b=['destchannelstatedesc','interface','pick','destconnectedlinenum','user:%s','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','hasOwnProperty','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','agent','acw','acwTimeout','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceAgentReport]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','localhost','socket.io-emitter','redis','channels','voiceQueues','agents','variables','agentcalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','privilege','custom:agentcalled','membername','user:called','error','inspect','agentconnectAt','lastevent','holdtime','connectedlinenum','connectedlinename','destchannelstate'];(function(_0x2b34df,_0x3dd0b5){var _0x225802=function(_0x4965ab){while(--_0x4965ab){_0x2b34df['push'](_0x2b34df['shift']());}};_0x225802(++_0x3dd0b5);}(_0x157b,0x1b5));var _0xb157=function(_0x1db0e7,_0x1fc9fe){_0x1db0e7=_0x1db0e7-0x0;var _0x56a60c=_0x157b[_0x1db0e7];return _0x56a60c;};'use strict';var _=require('lodash');var moment=require(_0xb157('0x0'));var util=require(_0xb157('0x1'));var Redis=require(_0xb157('0x2'));var config=require(_0xb157('0x3'));var logger=require(_0xb157('0x4'))(_0xb157('0x5'));var ami=require(_0xb157('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0xb157('0x7'),'port':0x18eb});var io=require(_0xb157('0x8'))(new Redis(config[_0xb157('0x9')]));function VoiceAgentReport(_0x512d58){this[_0xb157('0xa')]={};this['voiceQueues']=_0x512d58[_0xb157('0xb')];this[_0xb157('0xc')]=_0x512d58[_0xb157('0xc')];this[_0xb157('0xd')]={};ami['on'](_0xb157('0xe'),this['syncAgentCalled'][_0xb157('0xf')](this));ami['on']('agentconnect',this[_0xb157('0x10')][_0xb157('0xf')](this));ami['on'](_0xb157('0x11'),this[_0xb157('0x12')][_0xb157('0xf')](this));ami['on'](_0xb157('0x13'),this[_0xb157('0x14')][_0xb157('0xf')](this));ami['on'](_0xb157('0x15'),this[_0xb157('0x16')][_0xb157('0xf')](this));ami['on'](_0xb157('0x17'),this[_0xb157('0x18')][_0xb157('0xf')](this));ami['on'](_0xb157('0x19'),this['syncHangup'][_0xb157('0xf')](this));ami['on'](_0xb157('0x1a'),this[_0xb157('0x1b')]['bind'](this));ami['on'](_0xb157('0x1c'),this['syncMusicOnHoldStop'][_0xb157('0xf')](this));ami['on'](_0xb157('0x1d'),this[_0xb157('0x1e')][_0xb157('0xf')](this));ami['on']('blindtransfer',this[_0xb157('0x1f')][_0xb157('0xf')](this));}VoiceAgentReport[_0xb157('0x20')]['emit']=function(_0x2dd048,_0x1d9065,_0x3ebd74){io['to'](_0x2dd048)[_0xb157('0x21')](_0x1d9065,_0x3ebd74);};VoiceAgentReport[_0xb157('0x20')][_0xb157('0x22')]=function(_0x453e98){return _0x453e98!==null&&!_[_0xb157('0x23')](_0x453e98);};VoiceAgentReport['prototype'][_0xb157('0x24')]=function(_0xc9fdac){try{if(this['isNotNull'](_0xc9fdac)){if(_[_0xb157('0x23')](this[_0xb157('0xa')][_0xc9fdac[_0xb157('0x25')]])){this[_0xb157('0xa')][_0xc9fdac['uniqueid']]={};}if(_[_0xb157('0x23')](this[_0xb157('0xa')][_0xc9fdac[_0xb157('0x25')]][_0xc9fdac[_0xb157('0x26')]])){this['channels'][_0xc9fdac[_0xb157('0x25')]][_0xc9fdac[_0xb157('0x26')]]={'agentcalledAt':moment()[_0xb157('0x27')](_0xb157('0x28')),'lastevent':_0xb157('0x29'),'variables':this[_0xb157('0xd')][_0xc9fdac[_0xb157('0x25')]],'type':this[_0xb157('0xb')][_0xc9fdac['queue']]?this['voiceQueues'][_0xc9fdac[_0xb157('0x2a')]][_0xb157('0x2b')]||'inbound':_0xb157('0x2c')};}_[_0xb157('0x2d')](this[_0xb157('0xa')][_0xc9fdac[_0xb157('0x25')]][_0xc9fdac[_0xb157('0x26')]],_[_0xb157('0x2e')](_0xc9fdac,['event',_0xb157('0x2f')]));ami[_0xb157('0x21')](_0xb157('0x30'),this[_0xb157('0xa')][_0xc9fdac['uniqueid']][_0xc9fdac[_0xb157('0x26')]]);this['emit'](util[_0xb157('0x27')]('user:%s',_0xc9fdac[_0xb157('0x31')]),_0xb157('0x32'),this['channels'][_0xc9fdac[_0xb157('0x25')]][_0xc9fdac[_0xb157('0x26')]]);}}catch(_0x311f5f){logger[_0xb157('0x33')]('[syncAgentCalled][VoiceAgentReport]',util[_0xb157('0x34')](_0x311f5f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb157('0x20')][_0xb157('0x10')]=function(_0x1b8ca5){try{if(this[_0xb157('0x22')](_0x1b8ca5)){if(this[_0xb157('0xa')][_0x1b8ca5['uniqueid']]){for(var _0x529909 in this['channels'][_0x1b8ca5[_0xb157('0x25')]]){if(this[_0xb157('0xa')][_0x1b8ca5['uniqueid']]['hasOwnProperty'](_0x529909)){if(_0x1b8ca5[_0xb157('0x26')]===_0x529909){this['channels'][_0x1b8ca5['uniqueid']][_0x529909][_0xb157('0x35')]=moment()[_0xb157('0x27')](_0xb157('0x28'));this[_0xb157('0xa')][_0x1b8ca5[_0xb157('0x25')]][_0x529909][_0xb157('0x36')]='connect';this['channels'][_0x1b8ca5[_0xb157('0x25')]][_0x529909][_0xb157('0x37')]=_0x1b8ca5[_0xb157('0x37')];this[_0xb157('0xa')][_0x1b8ca5[_0xb157('0x25')]][_0x529909][_0xb157('0x38')]=_0x1b8ca5[_0xb157('0x38')];this[_0xb157('0xa')][_0x1b8ca5[_0xb157('0x25')]][_0x529909][_0xb157('0x39')]=_0x1b8ca5[_0xb157('0x39')];this[_0xb157('0xa')][_0x1b8ca5['uniqueid']][_0x529909][_0xb157('0x3a')]=_0x1b8ca5[_0xb157('0x3a')];this[_0xb157('0xa')][_0x1b8ca5['uniqueid']][_0x529909][_0xb157('0x3b')]=_0x1b8ca5['destchannelstatedesc'];_[_0xb157('0x2d')](this[_0xb157('0xc')][_0x1b8ca5[_0xb157('0x3c')]],_[_0xb157('0x3d')](_0x1b8ca5,[_0xb157('0x2a'),_0xb157('0x3e')]));this[_0xb157('0x21')](util[_0xb157('0x27')](_0xb157('0x3f'),_0x1b8ca5[_0xb157('0x31')]),'user:agentconnect',this[_0xb157('0xa')][_0x1b8ca5[_0xb157('0x25')]][_0x1b8ca5[_0xb157('0x26')]]);ami['emit'](_0xb157('0x40'),this[_0xb157('0xa')][_0x1b8ca5['uniqueid']][_0x529909]);}else if(!this[_0xb157('0xa')][_0x1b8ca5[_0xb157('0x25')]][_0x529909][_0xb157('0x11')]&&!this['channels'][_0x1b8ca5['uniqueid']][_0x529909][_0xb157('0x15')]){this['channels'][_0x1b8ca5['uniqueid']][_0x529909]['agentringnoanswer']=!![];this[_0xb157('0xa')][_0x1b8ca5[_0xb157('0x25')]][_0x529909][_0xb157('0x41')]=moment()[_0xb157('0x27')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb157('0xa')][_0x1b8ca5['uniqueid']][_0x529909][_0xb157('0x42')]=_0xb157('0x43');this[_0xb157('0xa')][_0x1b8ca5[_0xb157('0x25')]][_0x529909][_0xb157('0x36')]=_0xb157('0x43');this['channels'][_0x1b8ca5[_0xb157('0x25')]][_0x529909][_0xb157('0x44')]=_0x1b8ca5['destuniqueid'];this[_0xb157('0xa')][_0x1b8ca5[_0xb157('0x25')]][_0x529909]['answeredelsewheremembername']=_0x1b8ca5[_0xb157('0x31')];ami[_0xb157('0x21')]('custom:agentansweredelsewhere',this[_0xb157('0xa')][_0x1b8ca5[_0xb157('0x25')]][_0x529909]);}}}}}}catch(_0xfb0072){logger[_0xb157('0x33')](_0xb157('0x45'),util[_0xb157('0x34')](_0xfb0072,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb157('0x20')][_0xb157('0x12')]=function(_0x34e1fd){try{if(this['isNotNull'](_0x34e1fd)){if(this[_0xb157('0xa')][_0x34e1fd[_0xb157('0x25')]]&&this['channels'][_0x34e1fd[_0xb157('0x25')]][_0x34e1fd[_0xb157('0x26')]]){this[_0xb157('0xa')][_0x34e1fd[_0xb157('0x25')]][_0x34e1fd['destuniqueid']][_0xb157('0x11')]=!![];this[_0xb157('0xa')][_0x34e1fd['uniqueid']][_0x34e1fd[_0xb157('0x26')]][_0xb157('0x41')]=moment()[_0xb157('0x27')](_0xb157('0x28'));this['channels'][_0x34e1fd['uniqueid']][_0x34e1fd[_0xb157('0x26')]][_0xb157('0x42')]=_0xb157('0x46');this['channels'][_0x34e1fd[_0xb157('0x25')]][_0x34e1fd[_0xb157('0x26')]]['lastevent']=_0xb157('0x46');ami[_0xb157('0x21')](_0xb157('0x47'),this[_0xb157('0xa')][_0x34e1fd[_0xb157('0x25')]][_0x34e1fd[_0xb157('0x26')]]);}}}catch(_0x505e22){logger[_0xb157('0x33')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util['inspect'](_0x505e22,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb157('0x14')]=function(_0x32f736){try{if(this[_0xb157('0x22')](_0x32f736)){if(this[_0xb157('0xa')][_0x32f736[_0xb157('0x25')]]){for(var _0x56e852 in this[_0xb157('0xa')][_0x32f736[_0xb157('0x25')]]){if(this[_0xb157('0xa')][_0x32f736['uniqueid']][_0xb157('0x48')](_0x56e852)&&!this[_0xb157('0xa')][_0x32f736[_0xb157('0x25')]][_0x56e852][_0xb157('0x11')]&&!this[_0xb157('0xa')][_0x32f736[_0xb157('0x25')]][_0x56e852][_0xb157('0x15')]){this['channels'][_0x32f736['uniqueid']][_0x56e852]['agentringnoanswer']=!![];this[_0xb157('0xa')][_0x32f736['uniqueid']][_0x56e852][_0xb157('0x41')]=moment()[_0xb157('0x27')](_0xb157('0x28'));this['channels'][_0x32f736['uniqueid']][_0x56e852]['reason']=_0xb157('0x49');this[_0xb157('0xa')][_0x32f736[_0xb157('0x25')]][_0x56e852]['lastevent']=_0xb157('0x49');ami['emit'](_0xb157('0x4a'),this[_0xb157('0xa')][_0x32f736[_0xb157('0x25')]][_0x56e852]);}}}}}catch(_0x50eb30){logger[_0xb157('0x33')](_0xb157('0x4b'),util['inspect'](_0x50eb30,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb157('0x20')][_0xb157('0x16')]=function(_0x233d36){try{if(this[_0xb157('0x22')](_0x233d36)){if(this[_0xb157('0xa')][_0x233d36[_0xb157('0x25')]]){for(var _0x22b295 in this[_0xb157('0xa')][_0x233d36[_0xb157('0x25')]]){if(this[_0xb157('0xa')][_0x233d36[_0xb157('0x25')]]['hasOwnProperty'](_0x22b295)){if(this[_0xb157('0xa')][_0x233d36[_0xb157('0x25')]][_0x22b295][_0xb157('0x35')]&&!this[_0xb157('0xa')][_0x233d36[_0xb157('0x25')]][_0x22b295][_0xb157('0x15')]){this[_0xb157('0xa')][_0x233d36[_0xb157('0x25')]][_0x22b295][_0xb157('0x15')]=!![];this[_0xb157('0xa')][_0x233d36['uniqueid']][_0x22b295][_0xb157('0x4c')]=moment()['format'](_0xb157('0x28'));this['channels'][_0x233d36['uniqueid']][_0x22b295][_0xb157('0x36')]=_0xb157('0x4d');this[_0xb157('0xa')][_0x233d36[_0xb157('0x25')]][_0x22b295][_0xb157('0x4e')]=_0x233d36['talktime'];this['channels'][_0x233d36[_0xb157('0x25')]][_0x22b295]['reason']=_0x233d36['reason']==_0xb157('0x4f')?_0xb157('0x50'):_0x233d36[_0xb157('0x42')];if(this[_0xb157('0xb')][_0x233d36[_0xb157('0x2a')]]&&this[_0xb157('0xb')][_0x233d36[_0xb157('0x2a')]][_0xb157('0x51')]){this[_0xb157('0xa')][_0x233d36[_0xb157('0x25')]][_0x22b295]['agentacw']=!![];this[_0xb157('0xa')][_0x233d36[_0xb157('0x25')]][_0x22b295]['acwtime']=this['voiceQueues'][_0x233d36[_0xb157('0x2a')]][_0xb157('0x52')];}this[_0xb157('0xc')][_0x233d36[_0xb157('0x3c')]]=_[_0xb157('0x2e')](this['agents'][_0x233d36[_0xb157('0x3c')]],[_0xb157('0x2a'),_0xb157('0x3e')]);this['emit'](util['format']('user:%s',_0x233d36[_0xb157('0x31')]),'user:agentcomplete',this[_0xb157('0xa')][_0x233d36['uniqueid']][_0x22b295]);ami['emit'](_0xb157('0x53'),this[_0xb157('0xa')][_0x233d36['uniqueid']][_0x22b295]);}}}}}}catch(_0x3701d2){logger[_0xb157('0x33')](_0xb157('0x54'),util[_0xb157('0x34')](_0x3701d2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb157('0x20')][_0xb157('0x18')]=function(_0x487dc4){try{if(this[_0xb157('0x22')](_0x487dc4)){this[_0xb157('0x55')](_0x487dc4[_0xb157('0x25')],_[_0xb157('0x56')](_0x487dc4[_0xb157('0x57')])[0x0],_0x487dc4[_0xb157('0x58')]);if(this[_0xb157('0xa')][_0x487dc4[_0xb157('0x25')]]){for(var _0x2eb511 in this[_0xb157('0xa')][_0x487dc4[_0xb157('0x25')]]){if(this[_0xb157('0xa')][_0x487dc4[_0xb157('0x25')]][_0xb157('0x48')](_0x2eb511)){if(_['isUndefined'](this[_0xb157('0xa')][_0x487dc4['uniqueid']][_0x2eb511]['variables'])){this[_0xb157('0xa')][_0x487dc4[_0xb157('0x25')]][_0x2eb511][_0xb157('0xd')]={};}this[_0xb157('0xa')][_0x487dc4[_0xb157('0x25')]][_0x2eb511]['variables']=this[_0xb157('0xd')][_0x487dc4[_0xb157('0x25')]];}}}}}catch(_0x37b325){logger[_0xb157('0x33')](_0xb157('0x59'),util[_0xb157('0x34')](_0x37b325,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb157('0x55')]=function(_0x7adef3,_0x6fa077,_0x4bb76b){var _0x5a0500=[_0xb157('0x5a'),_0xb157('0x5b'),_0xb157('0x5c'),_0xb157('0x5d'),'rtpaudioqosloss',_0xb157('0x5e'),_0xb157('0x5f'),_0xb157('0x60'),_0xb157('0x61'),_0xb157('0x62'),_0xb157('0x63'),_0xb157('0x64'),_0xb157('0x65'),_0xb157('0x66'),'memberinterface','memberlastcall',_0xb157('0x31'),_0xb157('0x67'),_0xb157('0x68')];if(!_[_0xb157('0x69')](_0x6fa077)&&!_[_0xb157('0x6a')](_0x5a0500,_0x6fa077)){if(_[_0xb157('0x23')](this[_0xb157('0xd')][_0x7adef3])){this[_0xb157('0xd')][_0x7adef3]={};}this[_0xb157('0xd')][_0x7adef3][_0x6fa077]=_0x4bb76b;}};VoiceAgentReport[_0xb157('0x20')]['syncHangup']=function(_0x305c75){try{if(this[_0xb157('0x22')](_0x305c75)){if(this[_0xb157('0xa')][_0x305c75[_0xb157('0x25')]]){for(var _0x35b182 in this['channels'][_0x305c75[_0xb157('0x25')]]){if(this[_0xb157('0xa')][_0x305c75['uniqueid']]['hasOwnProperty'](_0x35b182)){if(this['channels'][_0x305c75['uniqueid']][_0x35b182][_0xb157('0x42')]==_0xb157('0x4f')&&this[_0xb157('0xa')][_0x305c75['uniqueid']][_0x35b182]['agentcomplete']){this[_0xb157('0xa')][_0x305c75['uniqueid']][_0x35b182][_0xb157('0x4c')]=moment()[_0xb157('0x27')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami['emit'](_0xb157('0x6b'),_[_0xb157('0x6c')](this[_0xb157('0xa')][_0x305c75['uniqueid']]));delete this['channels'][_0x305c75[_0xb157('0x25')]];}if(this[_0xb157('0xd')][_0x305c75[_0xb157('0x25')]]){delete this[_0xb157('0xd')][_0x305c75[_0xb157('0x25')]];}}}catch(_0x44b43f){logger[_0xb157('0x33')](_0xb157('0x6d'),util[_0xb157('0x34')](_0x44b43f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb157('0x20')][_0xb157('0x1e')]=function(_0x4fa6af){try{if(this['isNotNull'](_0x4fa6af)){if(this[_0xb157('0xa')][_0x4fa6af['transfereeuniqueid']]){for(var _0x44db52 in this[_0xb157('0xa')][_0x4fa6af[_0xb157('0x6e')]]){if(this[_0xb157('0xa')][_0x4fa6af[_0xb157('0x6e')]]['hasOwnProperty'](_0x44db52)){if(_0x4fa6af[_0xb157('0x6f')]===_0x44db52){var _0x54b9b4=moment();this[_0xb157('0xa')][_0x4fa6af['transfereeuniqueid']][_0x44db52][_0xb157('0x15')]=!![];this['channels'][_0x4fa6af[_0xb157('0x6e')]][_0x44db52][_0xb157('0x4c')]=moment()[_0xb157('0x27')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb157('0xa')][_0x4fa6af[_0xb157('0x6e')]][_0x44db52]['reason']=_0xb157('0x4f');this[_0xb157('0xa')][_0x4fa6af['transfereeuniqueid']][_0x44db52][_0xb157('0x36')]=_0xb157('0x4d');this['channels'][_0x4fa6af[_0xb157('0x6e')]][_0x44db52]['talktime']=_0x54b9b4[_0xb157('0x70')](this['channels'][_0x4fa6af[_0xb157('0x6e')]][_0x44db52]['agentconnectAt'],_0xb157('0x71'));}}}}if(this[_0xb157('0xa')][_0x4fa6af['secondtransfereruniqueid']]){var _0x327322=this[_0xb157('0xa')][_0x4fa6af[_0xb157('0x72')]];this[_0xb157('0xa')][_0x4fa6af['secondtransfereruniqueid']]=this[_0xb157('0xa')][_0x4fa6af[_0xb157('0x6e')]];this[_0xb157('0xa')][_0x4fa6af[_0xb157('0x6e')]]=_0x327322;}}}catch(_0x47da56){logger['error'](_0xb157('0x73'),util[_0xb157('0x34')](_0x47da56,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb157('0x20')][_0xb157('0x1f')]=function(_0x3dca2b){try{if(this[_0xb157('0x22')](_0x3dca2b)){if(this['channels'][_0x3dca2b['transfereeuniqueid']]){for(var _0x341330 in this[_0xb157('0xa')][_0x3dca2b[_0xb157('0x6e')]]){if(this['channels'][_0x3dca2b[_0xb157('0x6e')]][_0xb157('0x48')](_0x341330)){if(_0x3dca2b['transfereruniqueid']===_0x341330){var _0x39e90f=moment();this['channels'][_0x3dca2b[_0xb157('0x6e')]][_0x341330]['agentcomplete']=!![];this[_0xb157('0xa')][_0x3dca2b[_0xb157('0x6e')]][_0x341330][_0xb157('0x4c')]=_0x39e90f;this[_0xb157('0xa')][_0x3dca2b[_0xb157('0x6e')]][_0x341330][_0xb157('0x42')]=_0xb157('0x4f');this[_0xb157('0xa')][_0x3dca2b['transfereeuniqueid']][_0x341330][_0xb157('0x36')]=_0xb157('0x4d');this[_0xb157('0xa')][_0x3dca2b[_0xb157('0x6e')]][_0x341330][_0xb157('0x4e')]=_0x39e90f['diff'](this[_0xb157('0xa')][_0x3dca2b[_0xb157('0x6e')]][_0x341330][_0xb157('0x35')],_0xb157('0x71'));}}}}}}catch(_0x32b143){logger[_0xb157('0x33')](_0xb157('0x74'),util[_0xb157('0x34')](_0x32b143,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb157('0x20')][_0xb157('0x1b')]=function(_0x4d86f6){var _0x5e2a03='';try{if(this[_0xb157('0x22')](_0x4d86f6)){if(_0x4d86f6['channel']){_0x5e2a03=_0x4d86f6[_0xb157('0x75')][_0xb157('0x76')](0x0,_0x4d86f6[_0xb157('0x75')][_0xb157('0x77')]('-'));if(this[_0xb157('0xc')][_0x5e2a03]){this[_0xb157('0xc')][_0x5e2a03][_0xb157('0x78')]=!![];}}}}catch(_0x4944a7){logger['error']('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0xb157('0x34')](_0x4944a7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb157('0x20')][_0xb157('0x79')]=function(_0x44bba1){var _0x29e5dd='';try{if(this[_0xb157('0x22')](_0x44bba1)){if(_0x44bba1['channel']){_0x29e5dd=_0x44bba1[_0xb157('0x75')][_0xb157('0x76')](0x0,_0x44bba1['channel'][_0xb157('0x77')]('-'));if(this[_0xb157('0xc')][_0x29e5dd]){this[_0xb157('0xc')][_0x29e5dd][_0xb157('0x78')]=![];}}}}catch(_0xaa01c8){logger['error'](_0xb157('0x7a'),util[_0xb157('0x34')](_0xaa01c8,{'showHidden':![],'depth':null}));}};module[_0xb157('0x7b')]=VoiceAgentReport; \ No newline at end of file +var _0x4df4=['isUndefined','syncAgentCalled','isNotNull','channels','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','emit','user:%s','membername','user:called','[syncAgentCalled][VoiceAgentReport]','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','destconnectedlinenum','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','error','[syncAgentConnect][VoiceAgentReport]','inspect','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','complete','talktime','transfer','acw','acwtime','acwTimeout','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberlastcall','memberpenalty','memberrealtime','isNil','syncHangup','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','channel','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','moment','ioredis','../../../config/environment','ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','agents','variables','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x4df4,0x142));var _0x44df=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0x4df4[_0x6173fc];return _0x965fbe;};'use strict';var _=require('lodash');var moment=require(_0x44df('0x0'));var util=require('util');var Redis=require(_0x44df('0x1'));var config=require(_0x44df('0x2'));var logger=require('../../../config/logger')(_0x44df('0x3'));var ami=require('../ami');config[_0x44df('0x4')]=_[_0x44df('0x5')](config[_0x44df('0x4')],{'host':_0x44df('0x6'),'port':0x18eb});var io=require(_0x44df('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x570554){this['channels']={};this['voiceQueues']=_0x570554[_0x44df('0x8')];this[_0x44df('0x9')]=_0x570554[_0x44df('0x9')];this[_0x44df('0xa')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x44df('0xb')](this));ami['on'](_0x44df('0xc'),this['syncAgentConnect']['bind'](this));ami['on'](_0x44df('0xd'),this[_0x44df('0xe')][_0x44df('0xb')](this));ami['on'](_0x44df('0xf'),this[_0x44df('0x10')][_0x44df('0xb')](this));ami['on'](_0x44df('0x11'),this[_0x44df('0x12')][_0x44df('0xb')](this));ami['on'](_0x44df('0x13'),this['syncVarSet'][_0x44df('0xb')](this));ami['on'](_0x44df('0x14'),this['syncHangup'][_0x44df('0xb')](this));ami['on'](_0x44df('0x15'),this[_0x44df('0x16')]['bind'](this));ami['on'](_0x44df('0x17'),this[_0x44df('0x18')][_0x44df('0xb')](this));ami['on'](_0x44df('0x19'),this[_0x44df('0x1a')][_0x44df('0xb')](this));ami['on']('blindtransfer',this[_0x44df('0x1b')][_0x44df('0xb')](this));}VoiceAgentReport[_0x44df('0x1c')]['emit']=function(_0x66595f,_0x2eeff3,_0x2f94df){io['to'](_0x66595f)['emit'](_0x2eeff3,_0x2f94df);};VoiceAgentReport[_0x44df('0x1c')]['isNotNull']=function(_0x25c8a4){return _0x25c8a4!==null&&!_[_0x44df('0x1d')](_0x25c8a4);};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0x1e')]=function(_0x5891ae){try{if(this[_0x44df('0x1f')](_0x5891ae)){if(_[_0x44df('0x1d')](this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]])){this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]]={};}if(_[_0x44df('0x1d')](this[_0x44df('0x20')][_0x5891ae['uniqueid']][_0x5891ae['destuniqueid']])){this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]][_0x5891ae[_0x44df('0x22')]]={'agentcalledAt':moment()[_0x44df('0x23')](_0x44df('0x24')),'lastevent':_0x44df('0x25'),'variables':this[_0x44df('0xa')][_0x5891ae['uniqueid']],'type':this[_0x44df('0x8')][_0x5891ae[_0x44df('0x26')]]?this['voiceQueues'][_0x5891ae[_0x44df('0x26')]][_0x44df('0x27')]||_0x44df('0x28'):_0x44df('0x28')};}_[_0x44df('0x29')](this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]][_0x5891ae[_0x44df('0x22')]],_[_0x44df('0x2a')](_0x5891ae,['event','privilege']));ami[_0x44df('0x2b')]('custom:agentcalled',this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]][_0x5891ae['destuniqueid']]);this[_0x44df('0x2b')](util[_0x44df('0x23')](_0x44df('0x2c'),_0x5891ae[_0x44df('0x2d')]),_0x44df('0x2e'),this[_0x44df('0x20')][_0x5891ae[_0x44df('0x21')]][_0x5891ae[_0x44df('0x22')]]);}}catch(_0x371bcd){logger['error'](_0x44df('0x2f'),util['inspect'](_0x371bcd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')]['syncAgentConnect']=function(_0x125507){try{if(this[_0x44df('0x1f')](_0x125507)){if(this['channels'][_0x125507['uniqueid']]){for(var _0x16a1d2 in this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]]){if(this['channels'][_0x125507['uniqueid']][_0x44df('0x30')](_0x16a1d2)){if(_0x125507[_0x44df('0x22')]===_0x16a1d2){this[_0x44df('0x20')][_0x125507['uniqueid']][_0x16a1d2][_0x44df('0x31')]=moment()[_0x44df('0x23')](_0x44df('0x24'));this[_0x44df('0x20')][_0x125507['uniqueid']][_0x16a1d2][_0x44df('0x32')]=_0x44df('0x33');this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x34')]=_0x125507['holdtime'];this['channels'][_0x125507[_0x44df('0x21')]][_0x16a1d2]['connectedlinenum']=_0x125507[_0x44df('0x35')];this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x36')]=_0x125507[_0x44df('0x36')];this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x37')]=_0x125507[_0x44df('0x37')];this[_0x44df('0x20')][_0x125507['uniqueid']][_0x16a1d2]['destchannelstatedesc']=_0x125507[_0x44df('0x38')];_[_0x44df('0x29')](this['agents'][_0x125507[_0x44df('0x39')]],_['pick'](_0x125507,[_0x44df('0x26'),_0x44df('0x3a')]));this[_0x44df('0x2b')](util[_0x44df('0x23')](_0x44df('0x2c'),_0x125507[_0x44df('0x2d')]),_0x44df('0x3b'),this[_0x44df('0x20')][_0x125507['uniqueid']][_0x125507[_0x44df('0x22')]]);ami[_0x44df('0x2b')]('custom:agentconnect',this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2]);}else if(!this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2]['agentringnoanswer']&&!this['channels'][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x11')]){this['channels'][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0xd')]=!![];this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x3c')]=moment()[_0x44df('0x23')](_0x44df('0x24'));this[_0x44df('0x20')][_0x125507['uniqueid']][_0x16a1d2][_0x44df('0x3d')]=_0x44df('0x3e');this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x32')]='answered_elsewhere';this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x3f')]=_0x125507['destuniqueid'];this['channels'][_0x125507[_0x44df('0x21')]][_0x16a1d2][_0x44df('0x40')]=_0x125507['membername'];ami['emit'](_0x44df('0x41'),this[_0x44df('0x20')][_0x125507[_0x44df('0x21')]][_0x16a1d2]);}}}}}}catch(_0xbb73d7){logger[_0x44df('0x42')](_0x44df('0x43'),util[_0x44df('0x44')](_0xbb73d7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0xe')]=function(_0x1ddf22){try{if(this['isNotNull'](_0x1ddf22)){if(this[_0x44df('0x20')][_0x1ddf22[_0x44df('0x21')]]&&this[_0x44df('0x20')][_0x1ddf22[_0x44df('0x21')]][_0x1ddf22[_0x44df('0x22')]]){this[_0x44df('0x20')][_0x1ddf22[_0x44df('0x21')]][_0x1ddf22[_0x44df('0x22')]][_0x44df('0xd')]=!![];this[_0x44df('0x20')][_0x1ddf22['uniqueid']][_0x1ddf22[_0x44df('0x22')]]['agentringnoanswerAt']=moment()[_0x44df('0x23')](_0x44df('0x24'));this[_0x44df('0x20')][_0x1ddf22['uniqueid']][_0x1ddf22[_0x44df('0x22')]][_0x44df('0x3d')]=_0x44df('0x45');this['channels'][_0x1ddf22[_0x44df('0x21')]][_0x1ddf22[_0x44df('0x22')]][_0x44df('0x32')]=_0x44df('0x45');ami[_0x44df('0x2b')]('custom:agentringnoanswer',this[_0x44df('0x20')][_0x1ddf22[_0x44df('0x21')]][_0x1ddf22['destuniqueid']]);}}}catch(_0xc2d2f1){logger[_0x44df('0x42')](_0x44df('0x46'),util['inspect'](_0xc2d2f1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0x10')]=function(_0x3c5e35){try{if(this[_0x44df('0x1f')](_0x3c5e35)){if(this[_0x44df('0x20')][_0x3c5e35['uniqueid']]){for(var _0xaab1a9 in this[_0x44df('0x20')][_0x3c5e35[_0x44df('0x21')]]){if(this['channels'][_0x3c5e35[_0x44df('0x21')]]['hasOwnProperty'](_0xaab1a9)&&!this[_0x44df('0x20')][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9]['agentringnoanswer']&&!this['channels'][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9][_0x44df('0x11')]){this[_0x44df('0x20')][_0x3c5e35['uniqueid']][_0xaab1a9][_0x44df('0xd')]=!![];this['channels'][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9][_0x44df('0x3c')]=moment()[_0x44df('0x23')](_0x44df('0x24'));this[_0x44df('0x20')][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9][_0x44df('0x3d')]=_0x44df('0x47');this['channels'][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9]['lastevent']=_0x44df('0x47');ami[_0x44df('0x2b')](_0x44df('0x48'),this['channels'][_0x3c5e35[_0x44df('0x21')]][_0xaab1a9]);}}}}}catch(_0x3f879a){logger[_0x44df('0x42')]('[syncQueueCallerAbandon][VoiceAgentReport]',util['inspect'](_0x3f879a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')]['syncAgentComplete']=function(_0x29562e){try{if(this[_0x44df('0x1f')](_0x29562e)){if(this[_0x44df('0x20')][_0x29562e['uniqueid']]){for(var _0x2929f0 in this[_0x44df('0x20')][_0x29562e['uniqueid']]){if(this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x44df('0x30')](_0x2929f0)){if(this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x31')]&&!this[_0x44df('0x20')][_0x29562e['uniqueid']][_0x2929f0]['agentcomplete']){this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x11')]=!![];this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x49')]=moment()[_0x44df('0x23')](_0x44df('0x24'));this['channels'][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x32')]=_0x44df('0x4a');this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x4b')]=_0x29562e['talktime'];this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x3d')]=_0x29562e[_0x44df('0x3d')]==_0x44df('0x4c')?'agent':_0x29562e[_0x44df('0x3d')];if(this[_0x44df('0x8')][_0x29562e[_0x44df('0x26')]]&&this['voiceQueues'][_0x29562e[_0x44df('0x26')]][_0x44df('0x4d')]){this['channels'][_0x29562e[_0x44df('0x21')]][_0x2929f0]['agentacw']=!![];this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0][_0x44df('0x4e')]=this['voiceQueues'][_0x29562e[_0x44df('0x26')]][_0x44df('0x4f')];}this[_0x44df('0x9')][_0x29562e[_0x44df('0x39')]]=_[_0x44df('0x2a')](this[_0x44df('0x9')][_0x29562e[_0x44df('0x39')]],[_0x44df('0x26'),_0x44df('0x3a')]);this[_0x44df('0x2b')](util[_0x44df('0x23')]('user:%s',_0x29562e[_0x44df('0x2d')]),_0x44df('0x50'),this[_0x44df('0x20')][_0x29562e[_0x44df('0x21')]][_0x2929f0]);ami[_0x44df('0x2b')]('custom:agentcomplete',this['channels'][_0x29562e['uniqueid']][_0x2929f0]);}}}}}}catch(_0x5c93e6){logger[_0x44df('0x42')](_0x44df('0x51'),util[_0x44df('0x44')](_0x5c93e6,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x44df('0x52')]=function(_0x527a57){try{if(this[_0x44df('0x1f')](_0x527a57)){this[_0x44df('0x53')](_0x527a57['uniqueid'],_[_0x44df('0x54')](_0x527a57['variable'])[0x0],_0x527a57['value']);if(this['channels'][_0x527a57['uniqueid']]){for(var _0x250c9f in this[_0x44df('0x20')][_0x527a57[_0x44df('0x21')]]){if(this[_0x44df('0x20')][_0x527a57[_0x44df('0x21')]]['hasOwnProperty'](_0x250c9f)){if(_['isUndefined'](this[_0x44df('0x20')][_0x527a57['uniqueid']][_0x250c9f][_0x44df('0xa')])){this[_0x44df('0x20')][_0x527a57[_0x44df('0x21')]][_0x250c9f][_0x44df('0xa')]={};}this[_0x44df('0x20')][_0x527a57[_0x44df('0x21')]][_0x250c9f][_0x44df('0xa')]=this[_0x44df('0xa')][_0x527a57['uniqueid']];}}}}}catch(_0x2dba0a){logger[_0x44df('0x42')](_0x44df('0x55'),util[_0x44df('0x44')](_0x2dba0a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0x53')]=function(_0x38527e,_0x5ed436,_0x45c4f4){var _0x5df55c=[_0x44df('0x56'),_0x44df('0x57'),_0x44df('0x58'),_0x44df('0x59'),_0x44df('0x5a'),_0x44df('0x5b'),_0x44df('0x5c'),_0x44df('0x5d'),_0x44df('0x5e'),'sipuri',_0x44df('0x5f'),_0x44df('0x60'),'membercalls','memberdynamic','memberinterface',_0x44df('0x61'),_0x44df('0x2d'),_0x44df('0x62'),_0x44df('0x63')];if(!_[_0x44df('0x64')](_0x5ed436)&&!_['includes'](_0x5df55c,_0x5ed436)){if(_[_0x44df('0x1d')](this[_0x44df('0xa')][_0x38527e])){this['variables'][_0x38527e]={};}this['variables'][_0x38527e][_0x5ed436]=_0x45c4f4;}};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0x65')]=function(_0x2a534a){try{if(this[_0x44df('0x1f')](_0x2a534a)){if(this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]]){for(var _0x5e1e6d in this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]]){if(this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]][_0x44df('0x30')](_0x5e1e6d)){if(this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]][_0x5e1e6d]['reason']==_0x44df('0x4c')&&this[_0x44df('0x20')][_0x2a534a['uniqueid']][_0x5e1e6d][_0x44df('0x11')]){this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]][_0x5e1e6d][_0x44df('0x49')]=moment()[_0x44df('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}}}ami[_0x44df('0x2b')](_0x44df('0x66'),_[_0x44df('0x67')](this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]]));delete this[_0x44df('0x20')][_0x2a534a[_0x44df('0x21')]];}if(this[_0x44df('0xa')][_0x2a534a['uniqueid']]){delete this[_0x44df('0xa')][_0x2a534a[_0x44df('0x21')]];}}}catch(_0x542d51){logger['error'](_0x44df('0x68'),util['inspect'](_0x542d51,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')]['syncAttendedTransfer']=function(_0x41f5b7){try{if(this['isNotNull'](_0x41f5b7)){if(this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x69')]]){for(var _0x4de61b in this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x69')]]){if(this[_0x44df('0x20')][_0x41f5b7['transfereeuniqueid']][_0x44df('0x30')](_0x4de61b)){if(_0x41f5b7['origtransfereruniqueid']===_0x4de61b){var _0xb9077e=moment();this[_0x44df('0x20')][_0x41f5b7['transfereeuniqueid']][_0x4de61b][_0x44df('0x11')]=!![];this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x69')]][_0x4de61b]['agentcompleteAt']=moment()[_0x44df('0x23')](_0x44df('0x24'));this['channels'][_0x41f5b7[_0x44df('0x69')]][_0x4de61b][_0x44df('0x3d')]=_0x44df('0x4c');this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x69')]][_0x4de61b]['lastevent']=_0x44df('0x4a');this[_0x44df('0x20')][_0x41f5b7['transfereeuniqueid']][_0x4de61b][_0x44df('0x4b')]=_0xb9077e[_0x44df('0x6a')](this['channels'][_0x41f5b7[_0x44df('0x69')]][_0x4de61b][_0x44df('0x31')],_0x44df('0x6b'));}}}}if(this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x6c')]]){var _0x41a1b2=this[_0x44df('0x20')][_0x41f5b7['secondtransfereruniqueid']];this['channels'][_0x41f5b7[_0x44df('0x6c')]]=this[_0x44df('0x20')][_0x41f5b7[_0x44df('0x69')]];this[_0x44df('0x20')][_0x41f5b7['transfereeuniqueid']]=_0x41a1b2;}}}catch(_0x59275a){logger['error'](_0x44df('0x6d'),util['inspect'](_0x59275a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')]['syncBlindTransfer']=function(_0x519e84){try{if(this[_0x44df('0x1f')](_0x519e84)){if(this['channels'][_0x519e84['transfereeuniqueid']]){for(var _0x3859fd in this[_0x44df('0x20')][_0x519e84[_0x44df('0x69')]]){if(this[_0x44df('0x20')][_0x519e84[_0x44df('0x69')]][_0x44df('0x30')](_0x3859fd)){if(_0x519e84[_0x44df('0x6e')]===_0x3859fd){var _0x5f4f30=moment();this['channels'][_0x519e84[_0x44df('0x69')]][_0x3859fd][_0x44df('0x11')]=!![];this[_0x44df('0x20')][_0x519e84[_0x44df('0x69')]][_0x3859fd][_0x44df('0x49')]=_0x5f4f30;this[_0x44df('0x20')][_0x519e84['transfereeuniqueid']][_0x3859fd][_0x44df('0x3d')]=_0x44df('0x4c');this[_0x44df('0x20')][_0x519e84[_0x44df('0x69')]][_0x3859fd][_0x44df('0x32')]=_0x44df('0x4a');this['channels'][_0x519e84['transfereeuniqueid']][_0x3859fd][_0x44df('0x4b')]=_0x5f4f30[_0x44df('0x6a')](this['channels'][_0x519e84[_0x44df('0x69')]][_0x3859fd][_0x44df('0x31')],_0x44df('0x6b'));}}}}}}catch(_0x1b75f6){logger[_0x44df('0x42')]('[syncBlindTransfer][VoiceAgentReport]',util[_0x44df('0x44')](_0x1b75f6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x44df('0x1c')][_0x44df('0x16')]=function(_0x54e563){var _0x864224='';try{if(this['isNotNull'](_0x54e563)){if(_0x54e563[_0x44df('0x6f')]){_0x864224=_0x54e563[_0x44df('0x6f')]['substring'](0x0,_0x54e563['channel'][_0x44df('0x70')]('-'));if(this[_0x44df('0x9')][_0x864224]){this['agents'][_0x864224][_0x44df('0x71')]=!![];}}}}catch(_0x562511){logger[_0x44df('0x42')](_0x44df('0x72'),util[_0x44df('0x44')](_0x562511,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x2758c4){var _0x2f224c='';try{if(this[_0x44df('0x1f')](_0x2758c4)){if(_0x2758c4[_0x44df('0x6f')]){_0x2f224c=_0x2758c4[_0x44df('0x6f')]['substring'](0x0,_0x2758c4[_0x44df('0x6f')]['lastIndexOf']('-'));if(this['agents'][_0x2f224c]){this['agents'][_0x2f224c][_0x44df('0x71')]=![];}}}}catch(_0xc6cf64){logger[_0x44df('0x42')](_0x44df('0x73'),util[_0x44df('0x44')](_0xc6cf64,{'showHidden':![],'depth':null}));}};module[_0x44df('0x74')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index a74c663..1b80ea6 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 _0x8075=['transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransferercalleridnum','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','transfererchannel','[syncBlindTransfer][VoiceCallReport]','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','util','ioredis','../../../config/environment','ami','../ami','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','log','prototype','isNotNull','linkedid','uniqueid','merge','pick','keys','inspect','channel','OutgoingSpoolFailed','isUndefined','starttime','format','disposition','toNumber','channelstate','context','split','exten','emit','user:%s','name','user:agentconnect','accountcode','error','[syncNewChannel][VoiceCallReport]','toLowerCase','applicationdata','appdata','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','application','lastapplication','lastdata','startsWith','cdr(','queue','[syncNewExten][VoiceCallReport]','answered','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','membername','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','endsWith','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','sipcallid','sipcalluniqueid','parse','[syncVarSet][VoiceCallReport]','endtime','billableseconds','answertime','from-sip','omit','destconnectedlinenum','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum'];(function(_0x3a1b13,_0x196daa){var _0xd620ca=function(_0x25909b){while(--_0x25909b){_0x3a1b13['push'](_0x3a1b13['shift']());}};_0xd620ca(++_0x196daa);}(_0x8075,0xab));var _0x5807=function(_0x5f419f,_0xe9b7fd){_0x5f419f=_0x5f419f-0x0;var _0x4c37f0=_0x8075[_0x5f419f];return _0x4c37f0;};'use strict';var BPromise=require(_0x5807('0x0'));var _=require(_0x5807('0x1'));var moment=require('moment');var util=require(_0x5807('0x2'));var path=require('path');var Redis=require(_0x5807('0x3'));var config=require(_0x5807('0x4'));var logger=require('../../../config/logger')(_0x5807('0x5'));var ami=require(_0x5807('0x6'));var Channel=require('../model/channel');var statusDesc=['unknown',_0x5807('0x7'),'inuse',_0x5807('0x8'),_0x5807('0x9'),_0x5807('0xa'),_0x5807('0xb'),_0x5807('0xc'),_0x5807('0xd')];var applications=['set','queue',_0x5807('0xe'),_0x5807('0xf'),_0x5807('0x10'),_0x5807('0x11')];var dispositions=[_0x5807('0x12'),_0x5807('0x13'),_0x5807('0x13'),_0x5807('0x12'),_0x5807('0x12'),_0x5807('0x12'),_0x5807('0x14'),'BUSY',_0x5807('0x13'),_0x5807('0x13'),_0x5807('0x13')];var actions={};config[_0x5807('0x15')]=_[_0x5807('0x16')](config[_0x5807('0x15')],{'host':_0x5807('0x17'),'port':0x18eb});var io=require(_0x5807('0x18'))(new Redis(config[_0x5807('0x15')]));function VoiceCallReport(_0x3d5972){this[_0x5807('0x19')]=_0x3d5972[_0x5807('0x19')];this[_0x5807('0x1a')]=_0x3d5972[_0x5807('0x1a')];ami['on'](_0x5807('0x1b'),this[_0x5807('0x1c')][_0x5807('0x1d')](this));ami['on'](_0x5807('0x1e'),this['syncNewExten'][_0x5807('0x1d')](this));ami['on'](_0x5807('0x1f'),this[_0x5807('0x20')][_0x5807('0x1d')](this));ami['on'](_0x5807('0x21'),this['syncNewState'][_0x5807('0x1d')](this));ami['on'](_0x5807('0x22'),this[_0x5807('0x23')][_0x5807('0x1d')](this));ami['on']('hangup',this[_0x5807('0x24')][_0x5807('0x1d')](this));ami['on'](_0x5807('0x25'),this[_0x5807('0x26')][_0x5807('0x1d')](this));ami['on'](_0x5807('0x27'),this[_0x5807('0x28')][_0x5807('0x1d')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x5807('0x1d')](this));ami['on'](_0x5807('0x29'),this[_0x5807('0x2a')]['bind'](this));ami['on'](_0x5807('0x2b'),this[_0x5807('0x2c')]['bind'](this));return BPromise[_0x5807('0x2d')]()[_0x5807('0x2e')](ami[_0x5807('0x2f')]())['catch'](function(_0x4410ca){console[_0x5807('0x30')](_0x4410ca);});}VoiceCallReport[_0x5807('0x31')][_0x5807('0x32')]=function(_0x5a42b9){return _0x5a42b9!==null&&!_['isUndefined'](_0x5a42b9);};VoiceCallReport[_0x5807('0x31')]['emit']=function(_0x6c3519,_0x73ac38,_0x2532e2){io['to'](_0x6c3519)['emit'](_0x73ac38,_0x2532e2);};VoiceCallReport[_0x5807('0x31')]['syncNewCallerId']=function(_0x4c7550){try{if(this[_0x5807('0x32')](_0x4c7550)){if(_0x4c7550['uniqueid']===_0x4c7550[_0x5807('0x33')]){if(!_['isUndefined'](this[_0x5807('0x19')][_0x4c7550[_0x5807('0x34')]])){_[_0x5807('0x35')](this[_0x5807('0x19')][_0x4c7550[_0x5807('0x34')]],_[_0x5807('0x36')](_0x4c7550,_[_0x5807('0x37')](this['channels'][_0x4c7550[_0x5807('0x34')]])));}}}}catch(_0xbd762c){logger['error']('[syncNewCallerId][VoiceCallReport]',util[_0x5807('0x38')](_0xbd762c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5807('0x31')][_0x5807('0x20')]=function(_0x1bb0cf){try{if(this[_0x5807('0x32')](_0x1bb0cf)){if(_0x1bb0cf[_0x5807('0x34')]===_0x1bb0cf['linkedid']&&_0x1bb0cf[_0x5807('0x39')]!=_0x5807('0x3a')){if(_[_0x5807('0x3b')](this[_0x5807('0x19')][_0x1bb0cf['uniqueid']])){this[_0x5807('0x19')][_0x1bb0cf[_0x5807('0x34')]]=new Channel();this[_0x5807('0x19')][_0x1bb0cf[_0x5807('0x34')]][_0x5807('0x3c')]=moment()[_0x5807('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5807('0x19')][_0x1bb0cf[_0x5807('0x34')]][_0x5807('0x3e')]=dispositions[_[_0x5807('0x3f')](_0x1bb0cf[_0x5807('0x40')])];_[_0x5807('0x35')](this[_0x5807('0x19')][_0x1bb0cf['uniqueid']],_[_0x5807('0x36')](_0x1bb0cf,_[_0x5807('0x37')](this['channels'][_0x1bb0cf[_0x5807('0x34')]])));if(_0x1bb0cf[_0x5807('0x41')]==='from-sip'){if(this[_0x5807('0x1a')][_0x1bb0cf[_0x5807('0x39')][_0x5807('0x42')]('-')[0x0]]){this['agents'][_0x1bb0cf['channel']['split']('-')[0x0]]['destconnectedlinenum']=_0x1bb0cf[_0x5807('0x43')];this[_0x5807('0x44')](util[_0x5807('0x3d')](_0x5807('0x45'),this[_0x5807('0x1a')][_0x1bb0cf[_0x5807('0x39')][_0x5807('0x42')]('-')[0x0]][_0x5807('0x46')]),_0x5807('0x47'),{'destaccountcode':this[_0x5807('0x1a')][_0x1bb0cf[_0x5807('0x39')]['split']('-')[0x0]][_0x5807('0x48')],'destconnectedlinenum':_0x1bb0cf[_0x5807('0x43')]});}}}}}}catch(_0x32769e){logger[_0x5807('0x49')](_0x5807('0x4a'),util[_0x5807('0x38')](_0x32769e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5807('0x31')][_0x5807('0x1c')]=function(_0x116bab){try{if(this['isNotNull'](_0x116bab)){if(_0x116bab[_0x5807('0x34')]===_0x116bab[_0x5807('0x33')]&&_0x116bab['exten']!='h'&&_0x116bab[_0x5807('0x39')]!=_0x5807('0x3a')){_0x116bab['application']=_0x116bab['application'][_0x5807('0x4b')]();_0x116bab[_0x5807('0x4c')]=(_0x116bab[_0x5807('0x4d')]||_0x116bab[_0x5807('0x4c')])[_0x5807('0x4b')]();if(_[_0x5807('0x3b')](this[_0x5807('0x19')][_0x116bab[_0x5807('0x34')]])){this['channels'][_0x116bab[_0x5807('0x34')]]=new Channel();this[_0x5807('0x19')][_0x116bab[_0x5807('0x34')]][_0x5807('0x3c')]=_0x116bab[_0x5807('0x4e')]?moment()[_0x5807('0x4f')](moment['duration'](_0x116bab['duration'])[_0x5807('0x50')](),_0x5807('0x50'))[_0x5807('0x3d')](_0x5807('0x51')):moment()['format'](_0x5807('0x51'));this['channels'][_0x116bab[_0x5807('0x34')]]['disposition']=_0x5807('0x12');}_[_0x5807('0x35')](this[_0x5807('0x19')][_0x116bab[_0x5807('0x34')]],_[_0x5807('0x36')](_0x116bab,_[_0x5807('0x37')](this[_0x5807('0x19')][_0x116bab['uniqueid']])));if(_[_0x5807('0x52')](applications,_0x116bab[_0x5807('0x53')])){this['channels'][_0x116bab[_0x5807('0x34')]][_0x5807('0x54')]=_0x116bab[_0x5807('0x53')];this[_0x5807('0x19')][_0x116bab[_0x5807('0x34')]][_0x5807('0x55')]=_0x116bab[_0x5807('0x4c')];if(_0x116bab[_0x5807('0x53')]==='set'&&_[_0x5807('0x56')](_0x116bab[_0x5807('0x4c')],_0x5807('0x57'))){var _0x4b086b=_0x116bab['applicationdata']['split']('=');var _0x538435=_0x4b086b[0x0]['match'](/cdr\((.*)\)/);if(_0x538435){this[_0x5807('0x19')][_0x116bab[_0x5807('0x34')]][_0x538435[0x1]]=_0x4b086b[0x1];}}else if(_0x116bab['application']===_0x5807('0x58')){this[_0x5807('0x19')][_0x116bab[_0x5807('0x34')]][_0x5807('0x58')]=_0x116bab[_0x5807('0x4c')]['split'](',')[0x0];}}}}}catch(_0x5e54fd){logger[_0x5807('0x49')](_0x5807('0x59'),util[_0x5807('0x38')](_0x5e54fd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5807('0x31')]['syncNewState']=function(_0x16cee4){try{if(this[_0x5807('0x32')](_0x16cee4)){if(_0x16cee4[_0x5807('0x34')]!==_0x16cee4[_0x5807('0x33')]){if(this['channels'][_0x16cee4['linkedid']]){if(_0x16cee4['channelstate']==='6'){if(!this[_0x5807('0x19')][_0x16cee4[_0x5807('0x33')]][_0x5807('0x5a')]){var _0x5cff22=moment();this['channels'][_0x16cee4[_0x5807('0x33')]][_0x5807('0x5a')]=!![];this[_0x5807('0x19')][_0x16cee4[_0x5807('0x33')]]['answertime']=_0x5cff22[_0x5807('0x3d')](_0x5807('0x51'));if(this['channels'][_0x16cee4[_0x5807('0x33')]][_0x5807('0x3c')]){this[_0x5807('0x19')][_0x16cee4['linkedid']][_0x5807('0x5b')]=_0x5cff22[_0x5807('0x5c')](this[_0x5807('0x19')][_0x16cee4[_0x5807('0x33')]][_0x5807('0x3c')],_0x5807('0x50'));}}this[_0x5807('0x19')][_0x16cee4[_0x5807('0x33')]]['linkedid']=_0x16cee4[_0x5807('0x34')];if(_0x16cee4[_0x5807('0x5d')]!==_0x5807('0x5e')){this[_0x5807('0x19')][_0x16cee4[_0x5807('0x33')]][_0x5807('0x5f')]=_0x16cee4[_0x5807('0x5d')];}this[_0x5807('0x19')][_0x16cee4[_0x5807('0x33')]][_0x5807('0x60')]=_0x16cee4['calleridname'];this[_0x5807('0x19')][_0x16cee4[_0x5807('0x33')]][_0x5807('0x61')]=_0x16cee4['channel'];this[_0x5807('0x19')][_0x16cee4[_0x5807('0x33')]][_0x5807('0x3e')]=dispositions[_[_0x5807('0x3f')](_0x16cee4[_0x5807('0x40')])];if(this[_0x5807('0x1a')][_0x16cee4[_0x5807('0x39')][_0x5807('0x42')]('-')[0x0]]){this[_0x5807('0x19')][_0x16cee4[_0x5807('0x33')]]['UserId']=this[_0x5807('0x1a')][_0x16cee4[_0x5807('0x39')][_0x5807('0x42')]('-')[0x0]]['id'];this['channels'][_0x16cee4[_0x5807('0x33')]][_0x5807('0x62')]=this[_0x5807('0x1a')][_0x16cee4['channel']['split']('-')[0x0]]['name'];}}}}else{if(this[_0x5807('0x19')][_0x16cee4['uniqueid']]){if(_0x16cee4[_0x5807('0x40')]==='6'){if(this[_0x5807('0x1a')][_0x16cee4[_0x5807('0x39')][_0x5807('0x42')]('-')[0x0]]){this[_0x5807('0x19')][_0x16cee4[_0x5807('0x34')]][_0x5807('0x63')]=this[_0x5807('0x1a')][_0x16cee4[_0x5807('0x39')][_0x5807('0x42')]('-')[0x0]]['id'];this[_0x5807('0x19')][_0x16cee4[_0x5807('0x34')]][_0x5807('0x62')]=this[_0x5807('0x1a')][_0x16cee4[_0x5807('0x39')]['split']('-')[0x0]]['name'];}}}}}}catch(_0x1af270){logger[_0x5807('0x49')](_0x5807('0x64'),util[_0x5807('0x38')](_0x1af270,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5807('0x65')]=function(_0x17124a,_0x371a0f){if(this[_0x5807('0x19')][_0x17124a]){this[_0x5807('0x19')][_0x17124a]['monitor']=!![];if(_[_0x5807('0x66')](_0x371a0f,'.wav49')){_0x371a0f=_0x371a0f[_0x5807('0x67')]('.wav49',_0x5807('0x68'));}this[_0x5807('0x19')][_0x17124a][_0x5807('0x69')]=_0x371a0f;var _0x94d186=_[_0x5807('0x6a')](this['channels'][_0x17124a][_0x5807('0x6b')],{'filename':_0x371a0f});if(_[_0x5807('0x6c')](_0x94d186)){this[_0x5807('0x19')][_0x17124a][_0x5807('0x6b')][_0x5807('0x6d')]({'filename':_0x371a0f,'createdAt':moment()[_0x5807('0x3d')](_0x5807('0x51')),'mixmonitorid':'','status':_0x5807('0x6e')});}}};VoiceCallReport[_0x5807('0x31')][_0x5807('0x23')]=function(_0x1d6626){try{if(this['isNotNull'](_0x1d6626)){if(this[_0x5807('0x19')][_0x1d6626[_0x5807('0x34')]]&&_0x1d6626[_0x5807('0x39')]!=_0x5807('0x3a')){if(this[_0x5807('0x32')](_0x1d6626[_0x5807('0x6f')])){if(this[_0x5807('0x32')](_0x1d6626[_0x5807('0x6f')][_0x5807('0x70')])){this[_0x5807('0x65')](_0x1d6626[_0x5807('0x34')],_0x1d6626[_0x5807('0x71')]);}else if(this[_0x5807('0x32')](_0x1d6626[_0x5807('0x6f')]['xmd-phone'])){this[_0x5807('0x19')][_0x1d6626['uniqueid']][_0x5807('0x5d')]=_0x1d6626[_0x5807('0x71')];}else if(this['isNotNull'](_0x1d6626[_0x5807('0x6f')][_0x5807('0x72')])){this[_0x5807('0x19')][_0x1d6626['uniqueid']][_0x5807('0x73')]=_0x1d6626[_0x5807('0x71')];}else if(this[_0x5807('0x32')](_0x1d6626['variable'][_0x5807('0x74')])){this['channels'][_0x1d6626['uniqueid']][_0x5807('0x75')]=_0x1d6626['value'];}else if(this[_0x5807('0x32')](_0x1d6626[_0x5807('0x6f')][_0x5807('0x76')])){this[_0x5807('0x19')][_0x1d6626[_0x5807('0x34')]]['queue']=_0x1d6626[_0x5807('0x71')][_0x5807('0x42')](',')[0x0];}else if(this['isNotNull'](_0x1d6626[_0x5807('0x6f')][_0x5807('0x77')])){this[_0x5807('0x19')][_0x1d6626['uniqueid']][_0x5807('0x78')]=_0x1d6626[_0x5807('0x71')];}else if(this[_0x5807('0x32')](_0x1d6626[_0x5807('0x6f')][_0x5807('0x79')])){this[_0x5807('0x19')][_0x1d6626['uniqueid']][_0x5807('0x7a')]=_0x1d6626['value'];}else if(this[_0x5807('0x32')](_0x1d6626['variable'][_0x5807('0x7b')])){this[_0x5807('0x19')][_0x1d6626['uniqueid']]['calleridpreview']=_0x1d6626['value'];}else if(this[_0x5807('0x32')](_0x1d6626[_0x5807('0x6f')]['xmcs-queue'])){this[_0x5807('0x19')][_0x1d6626['uniqueid']][_0x5807('0x58')]=_0x1d6626[_0x5807('0x71')];}else if(this[_0x5807('0x32')](_0x1d6626['variable'][_0x5807('0x7c')])){this[_0x5807('0x19')][_0x1d6626[_0x5807('0x34')]][_0x5807('0x7d')]=_0x1d6626[_0x5807('0x71')];}}}else if(this[_0x5807('0x32')](_0x1d6626[_0x5807('0x6f')]['mixmonitor_filename'])){if(_0x1d6626[_0x5807('0x71')]){var _0x18a957=path[_0x5807('0x7e')](_0x1d6626[_0x5807('0x71')])[_0x5807('0x46')];this[_0x5807('0x65')](_0x18a957,_0x1d6626[_0x5807('0x71')]);}}else if(this[_0x5807('0x19')][_0x1d6626[_0x5807('0x33')]]){if(this[_0x5807('0x32')](_0x1d6626['variable'])){if(this[_0x5807('0x32')](_0x1d6626[_0x5807('0x6f')][_0x5807('0x7c')])){this[_0x5807('0x19')][_0x1d6626['linkedid']]['sipcalllinkedid']=_0x1d6626[_0x5807('0x71')];}}}}}catch(_0x30798a){logger[_0x5807('0x49')](_0x5807('0x7f'),util[_0x5807('0x38')](_0x30798a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5807('0x31')][_0x5807('0x24')]=function(_0x6992ef){try{if(this[_0x5807('0x32')](_0x6992ef)){if(this[_0x5807('0x19')][_0x6992ef[_0x5807('0x34')]]){var _0x5cf35f=moment();this[_0x5807('0x19')][_0x6992ef['uniqueid']][_0x5807('0x80')]=_0x5cf35f[_0x5807('0x3d')](_0x5807('0x51'));this[_0x5807('0x19')][_0x6992ef[_0x5807('0x34')]][_0x5807('0x4e')]=_0x5cf35f[_0x5807('0x5c')](this[_0x5807('0x19')][_0x6992ef[_0x5807('0x34')]][_0x5807('0x3c')],_0x5807('0x50'));if(this[_0x5807('0x19')][_0x6992ef[_0x5807('0x34')]][_0x5807('0x5a')]){this[_0x5807('0x19')][_0x6992ef[_0x5807('0x34')]][_0x5807('0x81')]=_0x5cf35f[_0x5807('0x5c')](this[_0x5807('0x19')][_0x6992ef[_0x5807('0x34')]][_0x5807('0x82')],_0x5807('0x50'));this[_0x5807('0x19')][_0x6992ef['uniqueid']]['holdtime']=this[_0x5807('0x19')][_0x6992ef['uniqueid']]['duration']-this[_0x5807('0x19')][_0x6992ef[_0x5807('0x34')]][_0x5807('0x81')];}if(_0x6992ef[_0x5807('0x41')]===_0x5807('0x83')){if(this[_0x5807('0x1a')][_0x6992ef[_0x5807('0x39')][_0x5807('0x42')]('-')[0x0]]){this[_0x5807('0x1a')][_0x6992ef[_0x5807('0x39')][_0x5807('0x42')]('-')[0x0]]=_[_0x5807('0x84')](this[_0x5807('0x1a')][_0x6992ef[_0x5807('0x39')][_0x5807('0x42')]('-')[0x0]],[_0x5807('0x85')]);this['emit'](util[_0x5807('0x3d')]('user:%s',this['agents'][_0x6992ef[_0x5807('0x39')][_0x5807('0x42')]('-')[0x0]][_0x5807('0x46')]),_0x5807('0x86'),{'destaccountcode':this[_0x5807('0x1a')][_0x6992ef[_0x5807('0x39')][_0x5807('0x42')]('-')[0x0]][_0x5807('0x48')]});}}ami[_0x5807('0x44')](_0x5807('0x87'),this['channels'][_0x6992ef[_0x5807('0x34')]]);delete this[_0x5807('0x19')][_0x6992ef[_0x5807('0x34')]];}}}catch(_0x46537b){logger[_0x5807('0x49')](_0x5807('0x88'),util[_0x5807('0x38')](_0x46537b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5807('0x31')]['syncAttendedTransfer']=function(_0x36083b){try{if(this['isNotNull'](_0x36083b)){if(this['channels'][_0x36083b[_0x5807('0x89')]]){this[_0x5807('0x19')][_0x36083b[_0x5807('0x89')]][_0x5807('0x8a')]=_0x36083b['origtransferercalleridnum'];this[_0x5807('0x19')][_0x36083b['transfereeuniqueid']][_0x5807('0x8b')]=_0x36083b['transfertargetcalleridnum'];if(this[_0x5807('0x19')][_0x36083b['secondtransfereruniqueid']]){var _0x5ab20e=this[_0x5807('0x19')][_0x36083b[_0x5807('0x8c')]];this[_0x5807('0x19')][_0x36083b['secondtransfereruniqueid']]=this[_0x5807('0x19')][_0x36083b[_0x5807('0x89')]];this['channels'][_0x36083b[_0x5807('0x89')]]=_0x5ab20e;}}else if(this[_0x5807('0x19')][_0x36083b[_0x5807('0x8d')]]){this['channels'][_0x36083b['transfertargetuniqueid']][_0x5807('0x8a')]=_0x36083b[_0x5807('0x8e')];this[_0x5807('0x19')][_0x36083b[_0x5807('0x8d')]][_0x5807('0x8b')]=_0x36083b[_0x5807('0x8f')];if(this[_0x5807('0x19')][_0x36083b[_0x5807('0x90')]]){var _0x5ab20e=this[_0x5807('0x19')][_0x36083b[_0x5807('0x90')]];this[_0x5807('0x19')][_0x36083b[_0x5807('0x90')]]=this['channels'][_0x36083b[_0x5807('0x8d')]];this['channels'][_0x36083b['transfertargetuniqueid']]=_0x5ab20e;}}}}catch(_0x436b68){logger[_0x5807('0x49')](_0x5807('0x91'),util['inspect'](_0x436b68,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5807('0x31')]['syncBlindTransfer']=function(_0x17e696){try{if(this['isNotNull'](_0x17e696)){if(this['channels'][_0x17e696[_0x5807('0x89')]]){this['channels'][_0x17e696['transfereeuniqueid']][_0x5807('0x8a')]=_0x17e696[_0x5807('0x92')];this[_0x5807('0x19')][_0x17e696[_0x5807('0x89')]]['transferconnectedlinenum']=_0x17e696[_0x5807('0x93')];this[_0x5807('0x24')]({'event':'BlindTransfer','uniqueid':_0x17e696[_0x5807('0x89')],'context':_0x17e696[_0x5807('0x41')],'channel':_0x17e696[_0x5807('0x94')]});}}}catch(_0x5386a8){logger[_0x5807('0x49')](_0x5807('0x95'),util[_0x5807('0x38')](_0x5386a8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5807('0x31')][_0x5807('0x2a')]=function(_0x32b843){try{if(this[_0x5807('0x32')](_0x32b843)){if(this[_0x5807('0x19')][_0x32b843[_0x5807('0x34')]]){if(!_['isNil'](this[_0x5807('0x19')][_0x32b843[_0x5807('0x34')]][_0x5807('0x82')])){this[_0x5807('0x19')][_0x32b843[_0x5807('0x34')]]['mohstarttime']=moment()['format'](_0x5807('0x51'));}}}}catch(_0x2fc4af){logger[_0x5807('0x49')](_0x5807('0x96'),util[_0x5807('0x38')](_0x2fc4af,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5807('0x31')][_0x5807('0x2c')]=function(_0x3c0519){try{if(this['isNotNull'](_0x3c0519)){if(this[_0x5807('0x19')][_0x3c0519[_0x5807('0x34')]]){if(!_[_0x5807('0x6c')](this[_0x5807('0x19')][_0x3c0519[_0x5807('0x34')]][_0x5807('0x97')])){this['channels'][_0x3c0519[_0x5807('0x34')]][_0x5807('0x98')]+=moment()['milliseconds'](0x0)[_0x5807('0x5c')](this[_0x5807('0x19')][_0x3c0519['uniqueid']][_0x5807('0x97')],_0x5807('0x50'));delete this['channels'][_0x3c0519['uniqueid']][_0x5807('0x97')];}}}}catch(_0x505ee1){logger[_0x5807('0x49')](_0x5807('0x99'),util[_0x5807('0x38')](_0x505ee1,{'showHidden':![],'depth':null}));}};module[_0x5807('0x9a')]=VoiceCallReport; \ No newline at end of file +var _0xbcba=['syncMusicOnHoldStop','resolve','then','catch','log','prototype','isUndefined','emit','syncNewCallerId','isNotNull','uniqueid','pick','keys','error','[syncNewCallerId][VoiceCallReport]','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','merge','context','from-sip','split','channel','destconnectedlinenum','exten','format','user:%s','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','inspect','application','appdata','duration','subtract','includes','lastapplication','lastdata','applicationdata','set','startsWith','cdr(','linkedid','channelstate','answered','answertime','holdtime','diff','seconds','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','syncMixMonitorFilename','.wav49','replace','.WAV','find','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','parse','sipcalllinkedid','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','unknown','not_inuse','invalid','unavailable','onhold','queue','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart'];(function(_0x1235b9,_0x42c5d8){var _0x190f27=function(_0x334b5f){while(--_0x334b5f){_0x1235b9['push'](_0x1235b9['shift']());}};_0x190f27(++_0x42c5d8);}(_0xbcba,0x6d));var _0xabcb=function(_0x32795d,_0x19020c){_0x32795d=_0x32795d-0x0;var _0x4248c2=_0xbcba[_0x32795d];return _0x4248c2;};'use strict';var BPromise=require(_0xabcb('0x0'));var _=require(_0xabcb('0x1'));var moment=require('moment');var util=require(_0xabcb('0x2'));var path=require(_0xabcb('0x3'));var Redis=require(_0xabcb('0x4'));var config=require(_0xabcb('0x5'));var logger=require(_0xabcb('0x6'))(_0xabcb('0x7'));var ami=require('../ami');var Channel=require('../model/channel');var statusDesc=[_0xabcb('0x8'),_0xabcb('0x9'),'inuse','busy',_0xabcb('0xa'),_0xabcb('0xb'),'ringing','ringinuse',_0xabcb('0xc')];var applications=['set',_0xabcb('0xd'),_0xabcb('0xe'),_0xabcb('0xf'),_0xabcb('0x10'),'voicemail'];var dispositions=[_0xabcb('0x11'),_0xabcb('0x12'),_0xabcb('0x12'),_0xabcb('0x11'),_0xabcb('0x11'),_0xabcb('0x11'),_0xabcb('0x13'),_0xabcb('0x14'),'FAILED',_0xabcb('0x12'),_0xabcb('0x12')];var actions={};config[_0xabcb('0x15')]=_[_0xabcb('0x16')](config[_0xabcb('0x15')],{'host':_0xabcb('0x17'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xabcb('0x15')]));function VoiceCallReport(_0xac23e){this[_0xabcb('0x18')]=_0xac23e[_0xabcb('0x18')];this[_0xabcb('0x19')]=_0xac23e[_0xabcb('0x19')];ami['on'](_0xabcb('0x1a'),this[_0xabcb('0x1b')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x1d'),this['syncNewExten'][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x1e'),this[_0xabcb('0x1f')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x20'),this[_0xabcb('0x21')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x22'),this[_0xabcb('0x23')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x24'),this[_0xabcb('0x25')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x26'),this['syncNewCallerId']['bind'](this));ami['on']('attendedtransfer',this[_0xabcb('0x27')][_0xabcb('0x1c')](this));ami['on'](_0xabcb('0x28'),this[_0xabcb('0x29')][_0xabcb('0x1c')](this));ami['on']('musiconholdstart',this[_0xabcb('0x2a')]['bind'](this));ami['on']('musiconholdstop',this[_0xabcb('0x2b')][_0xabcb('0x1c')](this));return BPromise[_0xabcb('0x2c')]()[_0xabcb('0x2d')](ami['actionCoreShowChannels']())[_0xabcb('0x2e')](function(_0x1b972c){console[_0xabcb('0x2f')](_0x1b972c);});}VoiceCallReport[_0xabcb('0x30')]['isNotNull']=function(_0x461866){return _0x461866!==null&&!_[_0xabcb('0x31')](_0x461866);};VoiceCallReport['prototype']['emit']=function(_0x1b0938,_0x5e5533,_0x1bbf15){io['to'](_0x1b0938)[_0xabcb('0x32')](_0x5e5533,_0x1bbf15);};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x33')]=function(_0x342383){try{if(this[_0xabcb('0x34')](_0x342383)){if(_0x342383[_0xabcb('0x35')]===_0x342383['linkedid']){if(!_['isUndefined'](this[_0xabcb('0x18')][_0x342383[_0xabcb('0x35')]])){_['merge'](this[_0xabcb('0x18')][_0x342383[_0xabcb('0x35')]],_[_0xabcb('0x36')](_0x342383,_[_0xabcb('0x37')](this[_0xabcb('0x18')][_0x342383[_0xabcb('0x35')]])));}}}}catch(_0x4f2223){logger[_0xabcb('0x38')](_0xabcb('0x39'),util['inspect'](_0x4f2223,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x1f')]=function(_0x49aff7){try{if(this[_0xabcb('0x34')](_0x49aff7)){if(_0x49aff7[_0xabcb('0x35')]===_0x49aff7['linkedid']&&_0x49aff7['channel']!=_0xabcb('0x3a')){if(_['isUndefined'](this[_0xabcb('0x18')][_0x49aff7['uniqueid']])){this['channels'][_0x49aff7['uniqueid']]=new Channel();this[_0xabcb('0x18')][_0x49aff7[_0xabcb('0x35')]][_0xabcb('0x3b')]=moment()['format'](_0xabcb('0x3c'));this[_0xabcb('0x18')][_0x49aff7[_0xabcb('0x35')]][_0xabcb('0x3d')]=dispositions[_['toNumber'](_0x49aff7['channelstate'])];_[_0xabcb('0x3e')](this[_0xabcb('0x18')][_0x49aff7['uniqueid']],_[_0xabcb('0x36')](_0x49aff7,_[_0xabcb('0x37')](this[_0xabcb('0x18')][_0x49aff7['uniqueid']])));if(_0x49aff7[_0xabcb('0x3f')]===_0xabcb('0x40')){if(this[_0xabcb('0x19')][_0x49aff7['channel'][_0xabcb('0x41')]('-')[0x0]]){this[_0xabcb('0x19')][_0x49aff7[_0xabcb('0x42')]['split']('-')[0x0]][_0xabcb('0x43')]=_0x49aff7[_0xabcb('0x44')];this[_0xabcb('0x32')](util[_0xabcb('0x45')](_0xabcb('0x46'),this['agents'][_0x49aff7[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]][_0xabcb('0x47')]),_0xabcb('0x48'),{'destaccountcode':this[_0xabcb('0x19')][_0x49aff7['channel'][_0xabcb('0x41')]('-')[0x0]][_0xabcb('0x49')],'destconnectedlinenum':_0x49aff7[_0xabcb('0x44')]});}}}}}}catch(_0x228837){logger[_0xabcb('0x38')](_0xabcb('0x4a'),util[_0xabcb('0x4b')](_0x228837,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x1b')]=function(_0xb4e681){try{if(this[_0xabcb('0x34')](_0xb4e681)){if(_0xb4e681[_0xabcb('0x35')]===_0xb4e681['linkedid']&&_0xb4e681['exten']!='h'&&_0xb4e681[_0xabcb('0x42')]!='OutgoingSpoolFailed'){_0xb4e681[_0xabcb('0x4c')]=_0xb4e681['application']['toLowerCase']();_0xb4e681['applicationdata']=(_0xb4e681[_0xabcb('0x4d')]||_0xb4e681['applicationdata'])['toLowerCase']();if(_[_0xabcb('0x31')](this[_0xabcb('0x18')][_0xb4e681['uniqueid']])){this[_0xabcb('0x18')][_0xb4e681[_0xabcb('0x35')]]=new Channel();this[_0xabcb('0x18')][_0xb4e681['uniqueid']]['starttime']=_0xb4e681[_0xabcb('0x4e')]?moment()[_0xabcb('0x4f')](moment[_0xabcb('0x4e')](_0xb4e681['duration'])['seconds'](),'seconds')[_0xabcb('0x45')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xabcb('0x45')](_0xabcb('0x3c'));this[_0xabcb('0x18')][_0xb4e681['uniqueid']][_0xabcb('0x3d')]='NO\x20ANSWER';}_[_0xabcb('0x3e')](this['channels'][_0xb4e681['uniqueid']],_[_0xabcb('0x36')](_0xb4e681,_[_0xabcb('0x37')](this[_0xabcb('0x18')][_0xb4e681['uniqueid']])));if(_[_0xabcb('0x50')](applications,_0xb4e681[_0xabcb('0x4c')])){this['channels'][_0xb4e681['uniqueid']][_0xabcb('0x51')]=_0xb4e681[_0xabcb('0x4c')];this[_0xabcb('0x18')][_0xb4e681['uniqueid']][_0xabcb('0x52')]=_0xb4e681[_0xabcb('0x53')];if(_0xb4e681[_0xabcb('0x4c')]===_0xabcb('0x54')&&_[_0xabcb('0x55')](_0xb4e681[_0xabcb('0x53')],_0xabcb('0x56'))){var _0x4e0a33=_0xb4e681['applicationdata']['split']('=');var _0x12036c=_0x4e0a33[0x0]['match'](/cdr\((.*)\)/);if(_0x12036c){this['channels'][_0xb4e681[_0xabcb('0x35')]][_0x12036c[0x1]]=_0x4e0a33[0x1];}}else if(_0xb4e681[_0xabcb('0x4c')]===_0xabcb('0xd')){this[_0xabcb('0x18')][_0xb4e681['uniqueid']][_0xabcb('0xd')]=_0xb4e681[_0xabcb('0x53')][_0xabcb('0x41')](',')[0x0];}}}}}catch(_0x3e41e3){logger[_0xabcb('0x38')]('[syncNewExten][VoiceCallReport]',util[_0xabcb('0x4b')](_0x3e41e3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xabcb('0x21')]=function(_0x216c38){try{if(this[_0xabcb('0x34')](_0x216c38)){if(_0x216c38[_0xabcb('0x35')]!==_0x216c38[_0xabcb('0x57')]){if(this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]]){if(_0x216c38[_0xabcb('0x58')]==='6'){if(!this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x59')]){var _0x59aedd=moment();this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]]['answered']=!![];this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x5a')]=_0x59aedd[_0xabcb('0x45')](_0xabcb('0x3c'));if(this['channels'][_0x216c38['linkedid']][_0xabcb('0x3b')]){this[_0xabcb('0x18')][_0x216c38['linkedid']][_0xabcb('0x5b')]=_0x59aedd[_0xabcb('0x5c')](this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]]['starttime'],_0xabcb('0x5d'));}}this[_0xabcb('0x18')][_0x216c38['linkedid']][_0xabcb('0x57')]=_0x216c38[_0xabcb('0x35')];if(_0x216c38[_0xabcb('0x5e')]!==_0xabcb('0x5f')){this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x60')]=_0x216c38[_0xabcb('0x5e')];}this['channels'][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x61')]=_0x216c38['calleridname'];this['channels'][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x62')]=_0x216c38[_0xabcb('0x42')];this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]]['disposition']=dispositions[_['toNumber'](_0x216c38[_0xabcb('0x58')])];if(this[_0xabcb('0x19')][_0x216c38[_0xabcb('0x42')]['split']('-')[0x0]]){this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x63')]=this[_0xabcb('0x19')][_0x216c38['channel'][_0xabcb('0x41')]('-')[0x0]]['id'];this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x57')]][_0xabcb('0x64')]=this[_0xabcb('0x19')][_0x216c38[_0xabcb('0x42')]['split']('-')[0x0]][_0xabcb('0x47')];}}}}else{if(this[_0xabcb('0x18')][_0x216c38[_0xabcb('0x35')]]){if(_0x216c38[_0xabcb('0x58')]==='6'){if(this[_0xabcb('0x19')][_0x216c38[_0xabcb('0x42')]['split']('-')[0x0]]){this['channels'][_0x216c38[_0xabcb('0x35')]]['UserId']=this[_0xabcb('0x19')][_0x216c38[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]]['id'];this['channels'][_0x216c38[_0xabcb('0x35')]][_0xabcb('0x64')]=this[_0xabcb('0x19')][_0x216c38['channel']['split']('-')[0x0]]['name'];}}}}}}catch(_0x1793d6){logger[_0xabcb('0x38')]('[syncNewState][VoiceCallReport]',util[_0xabcb('0x4b')](_0x1793d6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x65')]=function(_0xa6bc2e,_0x3b9bbc){if(this[_0xabcb('0x18')][_0xa6bc2e]){this['channels'][_0xa6bc2e]['monitor']=!![];if(_['endsWith'](_0x3b9bbc,_0xabcb('0x66'))){_0x3b9bbc=_0x3b9bbc[_0xabcb('0x67')](_0xabcb('0x66'),_0xabcb('0x68'));}this[_0xabcb('0x18')][_0xa6bc2e]['monitorFilename']=_0x3b9bbc;var _0x474c0f=_[_0xabcb('0x69')](this[_0xabcb('0x18')][_0xa6bc2e][_0xabcb('0x6a')],{'filename':_0x3b9bbc});if(_[_0xabcb('0x6b')](_0x474c0f)){this['channels'][_0xa6bc2e][_0xabcb('0x6a')][_0xabcb('0x6c')]({'filename':_0x3b9bbc,'createdAt':moment()[_0xabcb('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xabcb('0x6d')});}}};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x23')]=function(_0xc7aa8b){try{if(this[_0xabcb('0x34')](_0xc7aa8b)){if(this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]]&&_0xc7aa8b[_0xabcb('0x42')]!=_0xabcb('0x3a')){if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')])){if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x6f')])){this[_0xabcb('0x65')](_0xc7aa8b['uniqueid'],_0xc7aa8b[_0xabcb('0x70')]);}else if(this[_0xabcb('0x34')](_0xc7aa8b['variable'][_0xabcb('0x71')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]]['calleridnum']=_0xc7aa8b[_0xabcb('0x70')];}else if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x72')])){this['channels'][_0xc7aa8b[_0xabcb('0x35')]][_0xabcb('0x73')]=_0xc7aa8b[_0xabcb('0x70')];}else if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x74')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]][_0xabcb('0x75')]=_0xc7aa8b[_0xabcb('0x70')];}else if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x76')])){this['channels'][_0xc7aa8b[_0xabcb('0x35')]]['queue']=_0xc7aa8b[_0xabcb('0x70')][_0xabcb('0x41')](',')[0x0];}else if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x77')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]][_0xabcb('0x78')]=_0xc7aa8b['value'];}else if(this['isNotNull'](_0xc7aa8b['variable'][_0xabcb('0x79')])){this['channels'][_0xc7aa8b[_0xabcb('0x35')]][_0xabcb('0x7a')]=_0xc7aa8b[_0xabcb('0x70')];}else if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x7b')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]][_0xabcb('0x7c')]=_0xc7aa8b[_0xabcb('0x70')];}else if(this['isNotNull'](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x7d')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]]['queue']=_0xc7aa8b[_0xabcb('0x70')];}else if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x7e')])){this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x35')]]['sipcalluniqueid']=_0xc7aa8b[_0xabcb('0x70')];}}}else if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')][_0xabcb('0x6f')])){if(_0xc7aa8b[_0xabcb('0x70')]){var _0x2181c4=path[_0xabcb('0x7f')](_0xc7aa8b[_0xabcb('0x70')])[_0xabcb('0x47')];this[_0xabcb('0x65')](_0x2181c4,_0xc7aa8b['value']);}}else if(this[_0xabcb('0x18')][_0xc7aa8b[_0xabcb('0x57')]]){if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')])){if(this[_0xabcb('0x34')](_0xc7aa8b[_0xabcb('0x6e')]['sipcallid'])){this[_0xabcb('0x18')][_0xc7aa8b['linkedid']][_0xabcb('0x80')]=_0xc7aa8b[_0xabcb('0x70')];}}}}}catch(_0x2ae36b){logger[_0xabcb('0x38')]('[syncVarSet][VoiceCallReport]',util[_0xabcb('0x4b')](_0x2ae36b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x2adac1){try{if(this[_0xabcb('0x34')](_0x2adac1)){if(this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]]){var _0x36d5a7=moment();this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]]['endtime']=_0x36d5a7['format'](_0xabcb('0x3c'));this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x4e')]=_0x36d5a7['diff'](this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x3b')],'seconds');if(this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x59')]){this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x81')]=_0x36d5a7[_0xabcb('0x5c')](this[_0xabcb('0x18')][_0x2adac1['uniqueid']][_0xabcb('0x5a')],_0xabcb('0x5d'));this[_0xabcb('0x18')][_0x2adac1['uniqueid']][_0xabcb('0x5b')]=this['channels'][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x4e')]-this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]][_0xabcb('0x81')];}if(_0x2adac1[_0xabcb('0x3f')]==='from-sip'){if(this['agents'][_0x2adac1[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]]){this[_0xabcb('0x19')][_0x2adac1[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]]=_[_0xabcb('0x82')](this[_0xabcb('0x19')][_0x2adac1[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]],['destconnectedlinenum']);this[_0xabcb('0x32')](util['format'](_0xabcb('0x46'),this[_0xabcb('0x19')][_0x2adac1[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]][_0xabcb('0x47')]),_0xabcb('0x83'),{'destaccountcode':this[_0xabcb('0x19')][_0x2adac1[_0xabcb('0x42')][_0xabcb('0x41')]('-')[0x0]]['accountcode']});}}ami[_0xabcb('0x32')](_0xabcb('0x84'),this['channels'][_0x2adac1[_0xabcb('0x35')]]);delete this[_0xabcb('0x18')][_0x2adac1[_0xabcb('0x35')]];}}}catch(_0x44e4e4){logger['error'](_0xabcb('0x85'),util[_0xabcb('0x4b')](_0x44e4e4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabcb('0x30')][_0xabcb('0x27')]=function(_0x1e6a99){try{if(this[_0xabcb('0x34')](_0x1e6a99)){if(this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x86')]]){this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x86')]][_0xabcb('0x87')]=_0x1e6a99[_0xabcb('0x88')];this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x86')]][_0xabcb('0x89')]=_0x1e6a99['transfertargetcalleridnum'];if(this['channels'][_0x1e6a99[_0xabcb('0x8a')]]){var _0x320faa=this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x8a')]];this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x8a')]]=this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x86')]];this['channels'][_0x1e6a99['transfereeuniqueid']]=_0x320faa;}}else if(this['channels'][_0x1e6a99[_0xabcb('0x8b')]]){this[_0xabcb('0x18')][_0x1e6a99['transfertargetuniqueid']][_0xabcb('0x87')]=_0x1e6a99[_0xabcb('0x88')];this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x8b')]][_0xabcb('0x89')]=_0x1e6a99[_0xabcb('0x8c')];if(this['channels'][_0x1e6a99[_0xabcb('0x8d')]]){var _0x320faa=this['channels'][_0x1e6a99['origtransfereruniqueid']];this[_0xabcb('0x18')][_0x1e6a99['origtransfereruniqueid']]=this[_0xabcb('0x18')][_0x1e6a99['transfertargetuniqueid']];this[_0xabcb('0x18')][_0x1e6a99[_0xabcb('0x8b')]]=_0x320faa;}}}}catch(_0x214e6b){logger[_0xabcb('0x38')](_0xabcb('0x8e'),util['inspect'](_0x214e6b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xabcb('0x29')]=function(_0x51738c){try{if(this[_0xabcb('0x34')](_0x51738c)){if(this[_0xabcb('0x18')][_0x51738c['transfereeuniqueid']]){this['channels'][_0x51738c[_0xabcb('0x86')]][_0xabcb('0x87')]=_0x51738c[_0xabcb('0x8f')];this[_0xabcb('0x18')][_0x51738c[_0xabcb('0x86')]]['transferconnectedlinenum']=_0x51738c[_0xabcb('0x90')];this[_0xabcb('0x25')]({'event':'BlindTransfer','uniqueid':_0x51738c[_0xabcb('0x86')],'context':_0x51738c[_0xabcb('0x3f')],'channel':_0x51738c[_0xabcb('0x91')]});}}}catch(_0x18b74d){logger[_0xabcb('0x38')](_0xabcb('0x92'),util[_0xabcb('0x4b')](_0x18b74d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabcb('0x30')]['syncMusicOnHoldStart']=function(_0x5470bb){try{if(this[_0xabcb('0x34')](_0x5470bb)){if(this[_0xabcb('0x18')][_0x5470bb[_0xabcb('0x35')]]){if(!_['isNil'](this['channels'][_0x5470bb[_0xabcb('0x35')]][_0xabcb('0x5a')])){this[_0xabcb('0x18')][_0x5470bb['uniqueid']][_0xabcb('0x93')]=moment()['format'](_0xabcb('0x3c'));}}}}catch(_0x300411){logger['error'](_0xabcb('0x94'),util[_0xabcb('0x4b')](_0x300411,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xabcb('0x2b')]=function(_0x48be34){try{if(this['isNotNull'](_0x48be34)){if(this[_0xabcb('0x18')][_0x48be34[_0xabcb('0x35')]]){if(!_[_0xabcb('0x6b')](this[_0xabcb('0x18')][_0x48be34[_0xabcb('0x35')]][_0xabcb('0x93')])){this['channels'][_0x48be34[_0xabcb('0x35')]][_0xabcb('0x95')]+=moment()[_0xabcb('0x96')](0x0)[_0xabcb('0x5c')](this[_0xabcb('0x18')][_0x48be34[_0xabcb('0x35')]][_0xabcb('0x93')],_0xabcb('0x5d'));delete this['channels'][_0x48be34[_0xabcb('0x35')]][_0xabcb('0x93')];}}}}catch(_0x55e83c){logger[_0xabcb('0x38')](_0xabcb('0x97'),util[_0xabcb('0x4b')](_0x55e83c,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index f8f13b4..78bb8d9 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 _0xfef5=['memberpenalty','memberrealtime','isNil','includes','endtime','duration','seconds','complete','total','answertime','answered','holdtime','diff','starttime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:dialend','voice_outbound:save','info','stringify','voice_outbound_channel:remove','lodash','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','syncDialBegin','syncDialEnd','bind','varset','syncVarSet','hangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','channels','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','voice:outbound','voice_outbound_channel:save','custom:dialbegin','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','format','lastevent','connect','custom:dialconnect','error','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','memberdynamic','memberlastcall','membername'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xfef5,0x6d));var _0x5fef=function(_0xab7dec,_0x1a9c27){_0xab7dec=_0xab7dec-0x0;var _0x42b3da=_0xfef5[_0xab7dec];return _0x42b3da;};'use strict';var _=require(_0x5fef('0x0'));var moment=require('moment');var util=require(_0x5fef('0x1'));var Redis=require(_0x5fef('0x2'));var config=require(_0x5fef('0x3'));var logger=require(_0x5fef('0x4'))('ami');var ami=require(_0x5fef('0x5'));config[_0x5fef('0x6')]=_[_0x5fef('0x7')](config[_0x5fef('0x6')],{'host':_0x5fef('0x8'),'port':0x18eb});var io=require(_0x5fef('0x9'))(new Redis(config[_0x5fef('0x6')]));function VoiceDialReport(_0x5e550b){this['channels']=_0x5e550b[_0x5fef('0xa')];this[_0x5fef('0xb')]=_0x5e550b[_0x5fef('0xb')];this[_0x5fef('0xc')]={};ami['on'](_0x5fef('0xd'),this[_0x5fef('0xe')]['bind'](this));ami['on']('dialend',this[_0x5fef('0xf')][_0x5fef('0x10')](this));ami['on'](_0x5fef('0x11'),this[_0x5fef('0x12')][_0x5fef('0x10')](this));ami['on'](_0x5fef('0x13'),this['syncHangup'][_0x5fef('0x10')](this));}VoiceDialReport[_0x5fef('0x14')][_0x5fef('0x15')]=function(_0x317a76){return _0x317a76!==null&&!_[_0x5fef('0x16')](_0x317a76);};VoiceDialReport[_0x5fef('0x14')][_0x5fef('0x17')]=function(_0x42d67b,_0x564ca1,_0x596998){io['to'](_0x42d67b)[_0x5fef('0x17')](_0x564ca1,_0x596998);};VoiceDialReport['prototype'][_0x5fef('0xe')]=function(_0x42c7a5){try{if(this['isNotNull'](_0x42c7a5)){if(this['channels'][_0x42c7a5[_0x5fef('0x18')]]){_[_0x5fef('0x19')](this[_0x5fef('0x1a')][_0x42c7a5[_0x5fef('0x18')]],{'starttime':moment()['format'](_0x5fef('0x1b')),'lastevent':_0x5fef('0x1c'),'interface':_0x42c7a5['channel'][_0x5fef('0x1d')](0x0,_0x42c7a5[_0x5fef('0x1e')][_0x5fef('0x1f')]('-')),'membername':_0x42c7a5['channel'][_0x5fef('0x1d')](_0x42c7a5[_0x5fef('0x1e')][_0x5fef('0x1f')]('/')+0x1,_0x42c7a5[_0x5fef('0x1e')][_0x5fef('0x1f')]('-'))},_[_0x5fef('0x20')](_0x42c7a5,['event','privilege']));this[_0x5fef('0x17')](_0x5fef('0x21'),_0x5fef('0x22'),this[_0x5fef('0x1a')][_0x42c7a5[_0x5fef('0x18')]]);ami[_0x5fef('0x17')](_0x5fef('0x23'),this['channels'][_0x42c7a5[_0x5fef('0x18')]]);}}}catch(_0xfb2331){logger['error'](_0x5fef('0x24'),util[_0x5fef('0x25')](_0xfb2331,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5fef('0x14')][_0x5fef('0xf')]=function(_0x533c71){try{if(this['isNotNull'](_0x533c71)){if(this[_0x5fef('0x1a')][_0x533c71[_0x5fef('0x18')]]){this[_0x5fef('0x1a')][_0x533c71[_0x5fef('0x18')]]['dialstatus']=_0x533c71[_0x5fef('0x26')];if(_0x533c71['dialstatus']===_0x5fef('0x27')){this[_0x5fef('0x1a')][_0x533c71[_0x5fef('0x18')]][_0x5fef('0x28')]=_0x533c71['connectedlinenum'];this[_0x5fef('0x1a')][_0x533c71[_0x5fef('0x18')]][_0x5fef('0x29')]=_0x533c71[_0x5fef('0x29')];this[_0x5fef('0x1a')][_0x533c71[_0x5fef('0x18')]]['answertime']=moment()[_0x5fef('0x2a')](_0x5fef('0x1b'));this[_0x5fef('0x1a')][_0x533c71[_0x5fef('0x18')]][_0x5fef('0x2b')]=_0x5fef('0x2c');ami[_0x5fef('0x17')](_0x5fef('0x2d'),this[_0x5fef('0x1a')][_0x533c71['uniqueid']]);}this[_0x5fef('0x17')](_0x5fef('0x21'),'voice_outbound_channel:save',this[_0x5fef('0x1a')][_0x533c71['uniqueid']]);}}}catch(_0x47794e){logger[_0x5fef('0x2e')](_0x5fef('0x2f'),util[_0x5fef('0x25')](_0x47794e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5fef('0x14')]['syncVarSet']=function(_0x5ab28a){try{if(this['isNotNull'](_0x5ab28a)){this[_0x5fef('0x30')](_0x5ab28a[_0x5fef('0x18')],_[_0x5fef('0x31')](_0x5ab28a[_0x5fef('0x32')])[0x0],_0x5ab28a[_0x5fef('0x33')]);if(this[_0x5fef('0x15')](_0x5ab28a[_0x5fef('0x32')])&&this[_0x5fef('0x15')](_0x5ab28a[_0x5fef('0x32')][_0x5fef('0x34')])){if(_['isUndefined'](this[_0x5fef('0x1a')][_0x5ab28a[_0x5fef('0x18')]])){this['channels'][_0x5ab28a[_0x5fef('0x18')]]={'routeId':_0x5ab28a[_0x5fef('0x33')],'variables':this[_0x5fef('0xc')][_0x5ab28a[_0x5fef('0x18')]]};this[_0x5fef('0x17')]('voice:outbound',_0x5fef('0x22'),this[_0x5fef('0x1a')][_0x5ab28a['uniqueid']]);}}}}catch(_0x2a727c){logger['error'](_0x5fef('0x35'),util[_0x5fef('0x25')](_0x2a727c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5fef('0x14')][_0x5fef('0x30')]=function(_0x523a76,_0x4cde7d,_0x15fcad){var _0x3e3ad1=['rtpaudioqos',_0x5fef('0x36'),_0x5fef('0x37'),_0x5fef('0x38'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x5fef('0x39'),_0x5fef('0x3a'),_0x5fef('0x3b'),'sipuri','bridgepeer','bridgepvtcallid','membercalls',_0x5fef('0x3c'),'memberinterface',_0x5fef('0x3d'),_0x5fef('0x3e'),_0x5fef('0x3f'),_0x5fef('0x40')];if(!_[_0x5fef('0x41')](_0x4cde7d)&&!_[_0x5fef('0x42')](_0x3e3ad1,_0x4cde7d)){if(_[_0x5fef('0x16')](this['variables'][_0x523a76])){this[_0x5fef('0xc')][_0x523a76]={};}this[_0x5fef('0xc')][_0x523a76][_0x4cde7d]=_0x15fcad;}};VoiceDialReport[_0x5fef('0x14')]['syncHangup']=function(_0xfb4ec1){try{if(this[_0x5fef('0x15')](_0xfb4ec1)){if(this[_0x5fef('0x1a')][_0xfb4ec1['uniqueid']]){this[_0x5fef('0x1a')][_0xfb4ec1['uniqueid']][_0x5fef('0x43')]=moment()[_0x5fef('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xfb4ec1[_0x5fef('0x18')]][_0x5fef('0x44')]=moment(this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]][_0x5fef('0x43')])['diff'](this[_0x5fef('0x1a')][_0xfb4ec1['uniqueid']]['starttime'],_0x5fef('0x45'));this[_0x5fef('0x1a')][_0xfb4ec1['uniqueid']][_0x5fef('0x2b')]=_0x5fef('0x46');this['outbound'][_0x5fef('0x47')]+=0x1;if(this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]][_0x5fef('0x48')]){this[_0x5fef('0xb')][_0x5fef('0x49')]+=0x1;this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]][_0x5fef('0x4a')]=moment(this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]][_0x5fef('0x48')])[_0x5fef('0x4b')](this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]][_0x5fef('0x4c')],_0x5fef('0x45'));this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]][_0x5fef('0x4d')]=moment(this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]][_0x5fef('0x43')])[_0x5fef('0x4b')](this['channels'][_0xfb4ec1[_0x5fef('0x18')]][_0x5fef('0x48')],_0x5fef('0x45'));this[_0x5fef('0xb')][_0x5fef('0x4e')]+=this['channels'][_0xfb4ec1['uniqueid']]['holdtime']||0x0;this[_0x5fef('0xb')][_0x5fef('0x4f')]+=this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]]['billableseconds'];}this[_0x5fef('0xb')][_0x5fef('0x50')]+=this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]][_0x5fef('0x44')];ami[_0x5fef('0x17')]('custom:voiceDialReport',this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]]);ami[_0x5fef('0x17')](_0x5fef('0x51'),this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]]);this[_0x5fef('0x17')](_0x5fef('0x21'),_0x5fef('0x52'),this[_0x5fef('0xb')]);logger[_0x5fef('0x53')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x5fef('0x54')](this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]]));this[_0x5fef('0x17')](_0x5fef('0x21'),_0x5fef('0x55'),this[_0x5fef('0x1a')][_0xfb4ec1[_0x5fef('0x18')]]);delete this['channels'][_0xfb4ec1['uniqueid']];}if(this['variables'][_0xfb4ec1[_0x5fef('0x18')]]){delete this['variables'][_0xfb4ec1[_0x5fef('0x18')]];}}}catch(_0x11b638){logger[_0x5fef('0x2e')]('[syncHangup][VoiceDialReport]',util['inspect'](_0x11b638,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x130b=['billableseconds','sumHoldTime','sumDuration','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','exports','lodash','moment','util','ioredis','../../../config/logger','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','prototype','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','emit','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','custom:dialconnect','voice:outbound','voice_outbound_channel:save','[syncDialEnd][VoiceDialReport]','inspect','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','endtime','duration','seconds','complete','total','holdtime','diff','starttime'];(function(_0xf2bad3,_0x47da4f){var _0x174027=function(_0x360c45){while(--_0x360c45){_0xf2bad3['push'](_0xf2bad3['shift']());}};_0x174027(++_0x47da4f);}(_0x130b,0x1b6));var _0xb130=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x130b[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xb130('0x0'));var moment=require(_0xb130('0x1'));var util=require(_0xb130('0x2'));var Redis=require(_0xb130('0x3'));var config=require('../../../config/environment');var logger=require(_0xb130('0x4'))('ami');var ami=require(_0xb130('0x5'));config[_0xb130('0x6')]=_[_0xb130('0x7')](config[_0xb130('0x6')],{'host':_0xb130('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x162cf4){this[_0xb130('0x9')]=_0x162cf4[_0xb130('0xa')];this['outbound']=_0x162cf4[_0xb130('0xb')];this[_0xb130('0xc')]={};ami['on'](_0xb130('0xd'),this[_0xb130('0xe')][_0xb130('0xf')](this));ami['on'](_0xb130('0x10'),this['syncDialEnd'][_0xb130('0xf')](this));ami['on']('varset',this[_0xb130('0x11')][_0xb130('0xf')](this));ami['on'](_0xb130('0x12'),this[_0xb130('0x13')]['bind'](this));}VoiceDialReport['prototype'][_0xb130('0x14')]=function(_0x42d30a){return _0x42d30a!==null&&!_[_0xb130('0x15')](_0x42d30a);};VoiceDialReport[_0xb130('0x16')]['emit']=function(_0x119061,_0x5c395a,_0x789520){io['to'](_0x119061)['emit'](_0x5c395a,_0x789520);};VoiceDialReport[_0xb130('0x16')][_0xb130('0xe')]=function(_0xf712d2){try{if(this['isNotNull'](_0xf712d2)){if(this[_0xb130('0x9')][_0xf712d2[_0xb130('0x17')]]){_[_0xb130('0x18')](this[_0xb130('0x9')][_0xf712d2[_0xb130('0x17')]],{'starttime':moment()[_0xb130('0x19')](_0xb130('0x1a')),'lastevent':'called','interface':_0xf712d2[_0xb130('0x1b')][_0xb130('0x1c')](0x0,_0xf712d2[_0xb130('0x1b')][_0xb130('0x1d')]('-')),'membername':_0xf712d2['channel'][_0xb130('0x1c')](_0xf712d2[_0xb130('0x1b')][_0xb130('0x1d')]('/')+0x1,_0xf712d2[_0xb130('0x1b')]['lastIndexOf']('-'))},_[_0xb130('0x1e')](_0xf712d2,[_0xb130('0x1f'),_0xb130('0x20')]));this[_0xb130('0x21')]('voice:outbound','voice_outbound_channel:save',this[_0xb130('0x9')][_0xf712d2[_0xb130('0x17')]]);ami[_0xb130('0x21')](_0xb130('0x22'),this[_0xb130('0x9')][_0xf712d2[_0xb130('0x17')]]);}}}catch(_0x1a01c4){logger[_0xb130('0x23')](_0xb130('0x24'),util['inspect'](_0x1a01c4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb130('0x16')]['syncDialEnd']=function(_0x47f15e){try{if(this[_0xb130('0x14')](_0x47f15e)){if(this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]]){this['channels'][_0x47f15e[_0xb130('0x17')]][_0xb130('0x25')]=_0x47f15e[_0xb130('0x25')];if(_0x47f15e[_0xb130('0x25')]===_0xb130('0x26')){this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]][_0xb130('0x27')]=_0x47f15e[_0xb130('0x27')];this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]]['connectedlinename']=_0x47f15e[_0xb130('0x28')];this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]][_0xb130('0x29')]=moment()[_0xb130('0x19')](_0xb130('0x1a'));this[_0xb130('0x9')][_0x47f15e['uniqueid']]['lastevent']=_0xb130('0x2a');ami[_0xb130('0x21')](_0xb130('0x2b'),this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]]);}this[_0xb130('0x21')](_0xb130('0x2c'),_0xb130('0x2d'),this[_0xb130('0x9')][_0x47f15e[_0xb130('0x17')]]);}}}catch(_0x3a35b9){logger[_0xb130('0x23')](_0xb130('0x2e'),util[_0xb130('0x2f')](_0x3a35b9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb130('0x16')][_0xb130('0x11')]=function(_0x10c77c){try{if(this[_0xb130('0x14')](_0x10c77c)){this[_0xb130('0x30')](_0x10c77c[_0xb130('0x17')],_[_0xb130('0x31')](_0x10c77c[_0xb130('0x32')])[0x0],_0x10c77c[_0xb130('0x33')]);if(this[_0xb130('0x14')](_0x10c77c[_0xb130('0x32')])&&this[_0xb130('0x14')](_0x10c77c[_0xb130('0x32')][_0xb130('0x34')])){if(_[_0xb130('0x15')](this['channels'][_0x10c77c['uniqueid']])){this[_0xb130('0x9')][_0x10c77c[_0xb130('0x17')]]={'routeId':_0x10c77c['value'],'variables':this['variables'][_0x10c77c[_0xb130('0x17')]]};this[_0xb130('0x21')](_0xb130('0x2c'),'voice_outbound_channel:save',this[_0xb130('0x9')][_0x10c77c[_0xb130('0x17')]]);}}}}catch(_0x2733b5){logger[_0xb130('0x23')](_0xb130('0x35'),util[_0xb130('0x2f')](_0x2733b5,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['addVariable']=function(_0x2d85d6,_0x5090c0,_0x24f34d){var _0x154811=[_0xb130('0x36'),'rtpaudioqosbridged',_0xb130('0x37'),_0xb130('0x38'),_0xb130('0x39'),'rtpaudioqoslossbridged',_0xb130('0x3a'),_0xb130('0x3b'),_0xb130('0x3c'),_0xb130('0x3d'),'bridgepeer',_0xb130('0x3e'),_0xb130('0x3f'),_0xb130('0x40'),'memberinterface',_0xb130('0x41'),'membername',_0xb130('0x42'),_0xb130('0x43')];if(!_[_0xb130('0x44')](_0x5090c0)&&!_[_0xb130('0x45')](_0x154811,_0x5090c0)){if(_[_0xb130('0x15')](this[_0xb130('0xc')][_0x2d85d6])){this[_0xb130('0xc')][_0x2d85d6]={};}this['variables'][_0x2d85d6][_0x5090c0]=_0x24f34d;}};VoiceDialReport['prototype'][_0xb130('0x13')]=function(_0xce2229){try{if(this['isNotNull'](_0xce2229)){if(this['channels'][_0xce2229[_0xb130('0x17')]]){this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x46')]=moment()['format'](_0xb130('0x1a'));this['channels'][_0xce2229['uniqueid']][_0xb130('0x47')]=moment(this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x46')])['diff'](this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]]['starttime'],_0xb130('0x48'));this[_0xb130('0x9')][_0xce2229['uniqueid']]['lastevent']=_0xb130('0x49');this[_0xb130('0xb')][_0xb130('0x4a')]+=0x1;if(this['channels'][_0xce2229[_0xb130('0x17')]][_0xb130('0x29')]){this[_0xb130('0xb')]['answered']+=0x1;this['channels'][_0xce2229[_0xb130('0x17')]][_0xb130('0x4b')]=moment(this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x29')])[_0xb130('0x4c')](this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x4d')],'seconds');this[_0xb130('0x9')][_0xce2229['uniqueid']][_0xb130('0x4e')]=moment(this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x46')])['diff'](this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x29')],'seconds');this['outbound'][_0xb130('0x4f')]+=this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x4b')]||0x0;this[_0xb130('0xb')]['sumBillable']+=this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x4e')];}this['outbound'][_0xb130('0x50')]+=this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]][_0xb130('0x47')];ami[_0xb130('0x21')]('custom:voiceDialReport',this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]]);ami[_0xb130('0x21')]('custom:dialend',this['channels'][_0xce2229[_0xb130('0x17')]]);this['emit'](_0xb130('0x2c'),_0xb130('0x51'),this['outbound']);logger[_0xb130('0x52')](_0xb130('0x53'),JSON[_0xb130('0x54')](this['channels'][_0xce2229['uniqueid']]));this[_0xb130('0x21')]('voice:outbound','voice_outbound_channel:remove',this['channels'][_0xce2229[_0xb130('0x17')]]);delete this[_0xb130('0x9')][_0xce2229[_0xb130('0x17')]];}if(this[_0xb130('0xc')][_0xce2229[_0xb130('0x17')]]){delete this['variables'][_0xce2229[_0xb130('0x17')]];}}}catch(_0x333eb0){logger[_0xb130('0x23')]('[syncHangup][VoiceDialReport]',util[_0xb130('0x2f')](_0x333eb0,{'showHidden':![],'depth':null}));}};module[_0xb130('0x55')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index f06b5d9..0c5ea61 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 _0xbd2f=['[syncQueueCallerJoin][VoiceQueueReport]','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','queuecallercomplete','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','syncAgentComplete','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','variable','queuestatus','value','TIMEOUT','lastevent','timeout','custom:timeout','queueposition','[syncVarSet][VoiceQueueReport]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','length','diff','sumDuration','answered','sumBillable','milliseconds','queuecallercompleteAt','custom:queuecallerunmanaged','custom:queuecallerabandon','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','transferuniqueid','ATTENDEDTRANSFER','secondtransfereruniqueid','origtransfereruniqueid','ATTENDED','transfertargetuniqueid','BLIND','extension','BlindTransfer','context','[syncBlindTransfer][VoiceQueueReport]','[syncMusicOnHoldStart][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','bluebird','util','md5','ioredis','../../../config/environment','../../../config/logger','redis','socket.io-emitter','prototype','enqueue','tail','finally','sequence','agents','channels','queueChannels','voiceQueues','campaigns','queuesummary','bind','queuesummarycomplete','syncQueueSummaryComplete','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentConnect','syncVarSet','hangup','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','isUndefined','isEmpty','hasOwnProperty','originated','pTalking','queueStatusComplete','unlockRR','clearZombieChannels','switch','isNil','message','No\x20such\x20channel','queueReports','error','[voiceQueueReport][checkQueueReport]','variables','[voiceQueueReport][checkVariables]','syncFullyBooted','clearQueueReport','inspect','emit','emitVoiceQueueChannelSave','format','voice_queue_channel:save','emitVoiceQueueChannelRemove','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','emitVoiceQueueSummary','available','loggedIn','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','Trunk','active','callerid','Interval','voice_queue:save','isNotNull','loopQueueShow','Action','queues','catch','[queues]','flagQueueSummary','then','[queuesummary]','syncQueueSummary','queue','countBy','callers','toNumber','loggedin','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','inbound','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','push'];(function(_0x33b259,_0x2036be){var _0xf95548=function(_0x5b3424){while(--_0x5b3424){_0x33b259['push'](_0x33b259['shift']());}};_0xf95548(++_0x2036be);}(_0xbd2f,0x11d));var _0xfbd2=function(_0x53f8a1,_0x1d0a3d){_0x53f8a1=_0x53f8a1-0x0;var _0x1e3698=_0xbd2f[_0x53f8a1];return _0x1e3698;};'use strict';var _=require(_0xfbd2('0x0'));var moment=require('moment');var BPromise=require(_0xfbd2('0x1'));var util=require(_0xfbd2('0x2'));var md5=require(_0xfbd2('0x3'));var Redis=require(_0xfbd2('0x4'));var config=require(_0xfbd2('0x5'));var logger=require(_0xfbd2('0x6'))('ami');var ami=require('../ami');var QueueReport=require('../model/queueReport');config[_0xfbd2('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfbd2('0x8'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xfbd2('0x9')][_0xfbd2('0xa')]=function(_0x5a028e){this[_0xfbd2('0xb')]=this[_0xfbd2('0xb')]?this[_0xfbd2('0xb')][_0xfbd2('0xc')](_0x5a028e):_0x5a028e();};function VoiceQueueReport(_0x2f6472){this[_0xfbd2('0xd')]=new Sequence();this['queueReports']={};this[_0xfbd2('0xe')]=_0x2f6472[_0xfbd2('0xe')];this[_0xfbd2('0xf')]=_0x2f6472[_0xfbd2('0x10')];this[_0xfbd2('0x11')]=_0x2f6472['voiceQueues'];this['flagQueueSummary']=!![];this['campaigns']=_0x2f6472[_0xfbd2('0x12')];this['variables']={};ami['on'](_0xfbd2('0x13'),this['syncQueueSummary'][_0xfbd2('0x14')](this));ami['on'](_0xfbd2('0x15'),this[_0xfbd2('0x16')]['bind'](this));ami['on']('queuecallerjoin',this[_0xfbd2('0x17')]['bind'](this));ami['on'](_0xfbd2('0x18'),this['syncQueueCallerAbandon'][_0xfbd2('0x14')](this));ami['on'](_0xfbd2('0x19'),this[_0xfbd2('0x1a')][_0xfbd2('0x14')](this));ami['on'](_0xfbd2('0x1b'),this['syncAgentComplete'][_0xfbd2('0x14')](this));ami['on']('agentconnect',this[_0xfbd2('0x1c')]['bind'](this));ami['on']('varset',this[_0xfbd2('0x1d')][_0xfbd2('0x14')](this));ami['on'](_0xfbd2('0x1e'),this[_0xfbd2('0x1f')][_0xfbd2('0x14')](this));ami['on'](_0xfbd2('0x20'),this['syncFullyBooted'][_0xfbd2('0x14')](this));ami['on'](_0xfbd2('0x21'),this[_0xfbd2('0x22')]['bind'](this));ami['on'](_0xfbd2('0x23'),this[_0xfbd2('0x24')][_0xfbd2('0x14')](this));ami['on'](_0xfbd2('0x25'),this[_0xfbd2('0x26')][_0xfbd2('0x14')](this));ami['on']('blindtransfer',this[_0xfbd2('0x27')]['bind'](this));this[_0xfbd2('0x28')]();this['loopQueueShow']();}function isNotNull(_0x29f9a9){return _0x29f9a9!==null&&!_[_0xfbd2('0x29')](_0x29f9a9);}function clearChannels(_0x47eb89){if(!_[_0xfbd2('0x2a')](_0x47eb89)){for(var _0x2f81ec in _0x47eb89){if(_0x47eb89[_0xfbd2('0x2b')](_0x2f81ec)){delete _0x47eb89[_0x2f81ec];}}}}function clearCampaigns(_0x5f4537){if(!_[_0xfbd2('0x2a')](_0x5f4537)){for(var _0x3d91fd in _0x5f4537){if(_0x5f4537[_0xfbd2('0x2b')](_0x3d91fd)){_0x5f4537[_0x3d91fd][_0xfbd2('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x25a1a7){if(!_[_0xfbd2('0x2a')](_0x25a1a7)){for(var _0x1a25c2 in _0x25a1a7){if(_0x25a1a7[_0xfbd2('0x2b')](_0x1a25c2)){_0x25a1a7[_0x1a25c2][_0xfbd2('0x2c')]=0x0;_0x25a1a7[_0x1a25c2]['talking']=0x0;_0x25a1a7[_0x1a25c2][_0xfbd2('0x2d')]=0x0;_0x25a1a7[_0x1a25c2]['waiting']=0x0;_0x25a1a7[_0x1a25c2][_0xfbd2('0x2e')]=!![];}}}}function clearAgentBooked(_0x371342){if(!_['isEmpty'](_0x371342)){for(var _0x42149f in _0x371342){if(_0x371342[_0xfbd2('0x2b')](_0x42149f)){_0x371342[_0x42149f][_0xfbd2('0x2f')]=!![];}}}}VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x30')]=function(){var _0x288e1f=this;for(var _0x5ca9ec in this[_0xfbd2('0xf')]){if(this[_0xfbd2('0xf')][_0xfbd2('0x2b')](_0x5ca9ec)&&!this[_0xfbd2('0xf')][_0x5ca9ec][_0xfbd2('0x31')]){this[_0xfbd2('0xd')][_0xfbd2('0xa')](function(){if(!_[_0xfbd2('0x32')](_0x288e1f[_0xfbd2('0xf')][_0x5ca9ec])){return ami['Action']({'action':'status','channel':_0x288e1f['channels'][_0x5ca9ec]['channel']})['catch'](function(_0xaffc63){if(_0xaffc63[_0xfbd2('0x33')]===_0xfbd2('0x34')){setTimeout(function(){if(_0x288e1f[_0xfbd2('0xf')][_0x5ca9ec]){delete _0x288e1f[_0xfbd2('0xf')][_0x5ca9ec];logger['error']('[voiceQueueReport][checkChannel]',_0x5ca9ec);}if(_0x288e1f[_0xfbd2('0x35')][_0x5ca9ec]){delete _0x288e1f[_0xfbd2('0x35')][_0x5ca9ec];logger[_0xfbd2('0x36')](_0xfbd2('0x37'),_0x5ca9ec);}if(_0x288e1f[_0xfbd2('0x38')][_0x5ca9ec]){delete _0x288e1f[_0xfbd2('0x38')][_0x5ca9ec];logger['error'](_0xfbd2('0x39'),_0x5ca9ec);}},0x1f40);}});}});}}};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x3a')]=function(){logger[_0xfbd2('0x36')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xfbd2('0xf')]);this[_0xfbd2('0x3b')](this[_0xfbd2('0x35')]);clearAgentBooked(this[_0xfbd2('0xe')]);clearVoiceQueues(this[_0xfbd2('0x11')]);clearCampaigns(this[_0xfbd2('0x12')]);};VoiceQueueReport['prototype'][_0xfbd2('0x3b')]=function(_0x1c7b03){var _0x5e10b5=this;if(!_[_0xfbd2('0x2a')](_0x1c7b03)){for(var _0x50ee49 in _0x1c7b03){if(_0x1c7b03[_0xfbd2('0x2b')](_0x50ee49)){_0x5e10b5['emitVoiceQueueChannelRemove'](_0x1c7b03[_0x50ee49]);delete _0x1c7b03[_0x50ee49];}}}};function loggerCatch(_0x281e9e){return function(_0x46edae){logger[_0xfbd2('0x36')](_0x281e9e,util[_0xfbd2('0x3c')](_0x46edae,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x3d')]=function(_0x2ff15f,_0x1d0e59,_0x2051b9){io['to'](_0x2ff15f)[_0xfbd2('0x3d')](_0x1d0e59,_0x2051b9);};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x3e')]=function(_0x26bcf8){this[_0xfbd2('0x3d')](util[_0xfbd2('0x3f')]('voice:queue:%s',_0x26bcf8['name']),_0xfbd2('0x40'),_0x26bcf8);};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x41')]=function(_0x22799d){logger[_0xfbd2('0x42')](_0xfbd2('0x43'),JSON[_0xfbd2('0x44')](_0x22799d));this['emit'](util[_0xfbd2('0x3f')](_0xfbd2('0x45'),_0x22799d[_0xfbd2('0x46')]),_0xfbd2('0x47'),_0x22799d);};VoiceQueueReport['prototype'][_0xfbd2('0x48')]=function(_0x3a7674){if(_0x3a7674['type']==='inbound'){var _0x57833b={'id':_0x3a7674['id'],'name':_0x3a7674[_0xfbd2('0x46')],'strategy':_0x3a7674['strategy'],'answered':_0x3a7674['answered'],'available':_0x3a7674[_0xfbd2('0x49')],'loggedIn':_0x3a7674[_0xfbd2('0x4a')],'pTalking':_0x3a7674[_0xfbd2('0x2d')],'sumBillable':_0x3a7674['sumBillable'],'sumDuration':_0x3a7674['sumDuration'],'sumHoldTime':_0x3a7674[_0xfbd2('0x4b')]||0x0,'talking':_0x3a7674[_0xfbd2('0x4c')],'total':_0x3a7674[_0xfbd2('0x4d')],'type':_0x3a7674[_0xfbd2('0x4e')],'unmanaged':_0x3a7674[_0xfbd2('0x4f')],'abandoned':_0x3a7674[_0xfbd2('0x50')],'waiting':_0x3a7674[_0xfbd2('0x51')]};if(_0x3a7674['Trunk']){_0x57833b[_0xfbd2('0x52')]={'id':_0x3a7674[_0xfbd2('0x52')]['id'],'name':_0x3a7674[_0xfbd2('0x52')]['name'],'active':_0x3a7674[_0xfbd2('0x52')][_0xfbd2('0x53')],'callerid':_0x3a7674[_0xfbd2('0x52')][_0xfbd2('0x54')]};}if(_0x3a7674['Interval']){_0x57833b[_0xfbd2('0x55')]={'id':_0x3a7674[_0xfbd2('0x55')]['id'],'name':_0x3a7674['Interval'][_0xfbd2('0x46')]};}var _0x32f41a=md5(JSON[_0xfbd2('0x44')](_0x57833b));if(_0x3a7674[_0xfbd2('0x3')]!==_0x32f41a){_0x3a7674[_0xfbd2('0x3')]=_0x32f41a;this[_0xfbd2('0x3d')](util[_0xfbd2('0x3f')](_0xfbd2('0x45'),_0x57833b[_0xfbd2('0x46')]),_0xfbd2('0x56'),_0x57833b);}}};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x57')]=function(_0x580cfe){return _0x580cfe!==null&&!_[_0xfbd2('0x29')](_0x580cfe);};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x58')]=function(){var _0x3619b1=this;setInterval(function(){_0x3619b1[_0xfbd2('0x30')]();ami[_0xfbd2('0x59')]({'action':_0xfbd2('0x5a')})[_0xfbd2('0x5b')](loggerCatch(_0xfbd2('0x5c')));},0x2710);};VoiceQueueReport['prototype'][_0xfbd2('0x28')]=function(){var _0x563bd0=this;setInterval(function(){if(_0x563bd0[_0xfbd2('0x5d')]){return ami[_0xfbd2('0x59')]({'action':_0xfbd2('0x13')})[_0xfbd2('0x5e')](function(_0xba2129){_0x563bd0[_0xfbd2('0x5d')]=![];})['catch'](loggerCatch(_0xfbd2('0x5f')));}},0x3e8);};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x60')]=function(_0x20cda5){try{if(this['isNotNull'](_0x20cda5)&&this[_0xfbd2('0x57')](_0x20cda5[_0xfbd2('0x61')])){if(this[_0xfbd2('0x11')][_0x20cda5[_0xfbd2('0x61')]]){var _0x35e378=_[_0xfbd2('0x62')](this[_0xfbd2('0xf')],_0xfbd2('0x61'))[_0x20cda5[_0xfbd2('0x61')]]||0x0;var _0xeede3d=_0x35e378-_0x20cda5[_0xfbd2('0x63')];if(this[_0xfbd2('0x11')][_0x20cda5[_0xfbd2('0x61')]][_0xfbd2('0x51')]!==_[_0xfbd2('0x64')](_0x20cda5[_0xfbd2('0x63')])||this[_0xfbd2('0x11')][_0x20cda5[_0xfbd2('0x61')]]['loggedIn']!==_[_0xfbd2('0x64')](_0x20cda5[_0xfbd2('0x65')])||this['voiceQueues'][_0x20cda5[_0xfbd2('0x61')]][_0xfbd2('0x49')]!==_[_0xfbd2('0x64')](_0x20cda5[_0xfbd2('0x49')])||this['voiceQueues'][_0x20cda5[_0xfbd2('0x61')]][_0xfbd2('0x4c')]!==_0xeede3d){this[_0xfbd2('0x11')][_0x20cda5[_0xfbd2('0x61')]][_0xfbd2('0x51')]=_[_0xfbd2('0x64')](_0x20cda5[_0xfbd2('0x63')]);this['voiceQueues'][_0x20cda5[_0xfbd2('0x61')]][_0xfbd2('0x4a')]=_['toNumber'](_0x20cda5[_0xfbd2('0x65')]);this[_0xfbd2('0x11')][_0x20cda5['queue']][_0xfbd2('0x49')]=_[_0xfbd2('0x64')](_0x20cda5['available']);this['voiceQueues'][_0x20cda5['queue']][_0xfbd2('0x4c')]=_0xeede3d>0x0?_0xeede3d:0x0;this[_0xfbd2('0x11')][_0x20cda5[_0xfbd2('0x61')]][_0xfbd2('0x4c')]=this[_0xfbd2('0x11')][_0x20cda5[_0xfbd2('0x61')]]['talking']>_[_0xfbd2('0x64')](_0x20cda5[_0xfbd2('0x65')])?_[_0xfbd2('0x64')](_0x20cda5[_0xfbd2('0x65')]):this['voiceQueues'][_0x20cda5['queue']][_0xfbd2('0x4c')];this[_0xfbd2('0x48')](this['voiceQueues'][_0x20cda5[_0xfbd2('0x61')]]);}ami['emit'](_0xfbd2('0x66'),this[_0xfbd2('0x11')][_0x20cda5['queue']]);}}}catch(_0x32448d){logger[_0xfbd2('0x36')](_0xfbd2('0x67'),util[_0xfbd2('0x3c')](_0x32448d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbd2('0x9')]['syncQueueSummaryComplete']=function(_0x53b174){this[_0xfbd2('0x5d')]=!![];};VoiceQueueReport['prototype'][_0xfbd2('0x68')]=function(_0x320b13){};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x17')]=function(_0x56623d){try{if(this[_0xfbd2('0x57')](_0x56623d)){if(_['isUndefined'](this[_0xfbd2('0x35')][_0x56623d[_0xfbd2('0x69')]])){this[_0xfbd2('0x35')][_0x56623d['uniqueid']]=[];this[_0xfbd2('0xf')][_0x56623d[_0xfbd2('0x69')]]={};}var _0x274bf9=new QueueReport();_0x274bf9[_0xfbd2('0x46')]=_0x56623d[_0xfbd2('0x61')];_0x274bf9[_0xfbd2('0x4e')]=this['voiceQueues'][_0x274bf9[_0xfbd2('0x46')]]&&this['voiceQueues'][_0x274bf9[_0xfbd2('0x46')]][_0xfbd2('0x4e')]?this['voiceQueues'][_0x274bf9[_0xfbd2('0x46')]][_0xfbd2('0x4e')]||_0xfbd2('0x6a'):_0xfbd2('0x6a');_0x274bf9[_0xfbd2('0x61')]=_0x56623d[_0xfbd2('0x61')];_0x274bf9[_0xfbd2('0x6b')]=moment()[_0xfbd2('0x3f')](_0xfbd2('0x6c'));_0x274bf9[_0xfbd2('0x6d')]=_0x56623d[_0xfbd2('0x6d')];_0x274bf9['count']=_0x56623d[_0xfbd2('0x6e')];_[_0xfbd2('0x6f')](_0x274bf9,_[_0xfbd2('0x70')](_0x56623d,_[_0xfbd2('0x71')](_0x274bf9)));this['queueReports'][_0x56623d[_0xfbd2('0x69')]][_0xfbd2('0x72')](_0x274bf9);this['channels'][_0x56623d['uniqueid']]=_0x274bf9;this[_0xfbd2('0x3e')](_0x274bf9);}}catch(_0x44866a){logger['error'](_0xfbd2('0x73'),util[_0xfbd2('0x3c')](_0x44866a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbd2('0x9')]['syncQueueCallerAbandon']=function(_0x571928){try{if(this[_0xfbd2('0x57')](_0x571928)){if(this[_0xfbd2('0x35')][_0x571928[_0xfbd2('0x69')]]){var _0x176c2=_['last'](this[_0xfbd2('0x35')][_0x571928[_0xfbd2('0x69')]]);_0x176c2['queuecallercomplete']=![];_0x176c2['queuecallercompleteAt']=null;_0x176c2['holdtime']=_0x571928[_0xfbd2('0x74')];_0x176c2['originalposition']=_0x571928[_0xfbd2('0x75')];_0x176c2[_0xfbd2('0x18')]=!![];_0x176c2[_0xfbd2('0x76')]=moment()[_0xfbd2('0x3f')](_0xfbd2('0x6c'));_0x176c2[_0xfbd2('0x77')]=_0xfbd2('0x78');_0x176c2['lastAssignedTo']=null;this[_0xfbd2('0xf')][_0x571928[_0xfbd2('0x69')]]=_0x176c2;this[_0xfbd2('0x41')](_0x176c2);}}}catch(_0x1a807a){logger[_0xfbd2('0x36')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0xfbd2('0x3c')](_0x1a807a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x1a')]=function(_0x1b124d){try{if(this['isNotNull'](_0x1b124d)){if(this[_0xfbd2('0x35')][_0x1b124d['uniqueid']]){var _0x3a46f5=_[_0xfbd2('0x79')](this[_0xfbd2('0x35')][_0x1b124d['uniqueid']]);_0x3a46f5[_0xfbd2('0x7a')]=moment()[_0xfbd2('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a46f5[_0xfbd2('0x7b')]=_0x1b124d['connectedlinenum'];_0x3a46f5[_0xfbd2('0x7c')]=_0x1b124d[_0xfbd2('0x7c')];this[_0xfbd2('0xf')][_0x1b124d[_0xfbd2('0x69')]]=_0x3a46f5;this[_0xfbd2('0x3e')](_0x3a46f5);}}}catch(_0x19198b){logger[_0xfbd2('0x36')](_0xfbd2('0x7d'),util[_0xfbd2('0x3c')](_0x19198b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x3fd50f){try{if(this[_0xfbd2('0x57')](_0x3fd50f)){if(this[_0xfbd2('0x35')][_0x3fd50f[_0xfbd2('0x69')]]){var _0x4bfbe2=_[_0xfbd2('0x79')](this['queueReports'][_0x3fd50f['uniqueid']]);_0x4bfbe2[_0xfbd2('0x7e')]=!![];_0x4bfbe2[_0xfbd2('0x77')]=_0xfbd2('0x7f');}}}catch(_0x511f2c){logger[_0xfbd2('0x36')](_0xfbd2('0x80'),util[_0xfbd2('0x3c')](_0x511f2c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x81')]=function(_0x4f5688){try{if(this[_0xfbd2('0x57')](_0x4f5688)){if(this[_0xfbd2('0x35')][_0x4f5688['uniqueid']]){var _0x436f77=_['last'](this[_0xfbd2('0x35')][_0x4f5688[_0xfbd2('0x69')]]);_0x436f77[_0xfbd2('0x18')]=![];_0x436f77[_0xfbd2('0x76')]=null;_0x436f77['assigned']=!![];_0x436f77['lastAssignedTo']=_0x4f5688[_0xfbd2('0x82')];_0x436f77[_0xfbd2('0x74')]=_0x4f5688[_0xfbd2('0x74')];_0x436f77[_0xfbd2('0x7e')]=!![];_0x436f77[_0xfbd2('0x83')]=![];_0x436f77[_0xfbd2('0x84')]=null;if(!_0x436f77[_0xfbd2('0x85')]){if(_0x4f5688[_0xfbd2('0x86')]=='transfer'){_0x436f77[_0xfbd2('0x77')]=_0xfbd2('0x87');}else{if(_[_0xfbd2('0x88')](_0x4f5688['channel']['toLowerCase'](),_0xfbd2('0x89'))){if(this['queueReports'][_0x4f5688[_0xfbd2('0x8a')]]){var _0x5a10c3=_['last'](this[_0xfbd2('0x35')][_0x4f5688[_0xfbd2('0x8a')]]);_0x5a10c3[_0xfbd2('0x7e')]=![];_0x5a10c3[_0xfbd2('0x83')]=!![];_0x5a10c3[_0xfbd2('0x84')]=moment(_0x436f77['queuecallerjoinAt'])[_0xfbd2('0x8b')](_0x4f5688[_0xfbd2('0x74')],_0xfbd2('0x8c'))[_0xfbd2('0x3f')](_0xfbd2('0x6c'));_0x5a10c3[_0xfbd2('0x77')]=_0xfbd2('0x8d');_0x5a10c3[_0xfbd2('0x85')]=!![];_0x5a10c3[_0xfbd2('0x8e')]=_0xfbd2('0x8f');_0x5a10c3[_0xfbd2('0x90')]=_0x4f5688[_0xfbd2('0x91')];_0x5a10c3['transferuniqueid']=_0x4f5688[_0xfbd2('0x69')];var _0xfe6b57=this[_0xfbd2('0x35')][_0x4f5688[_0xfbd2('0x8a')]];this[_0xfbd2('0x35')][_0x4f5688[_0xfbd2('0x8a')]]=this['queueReports'][_0x4f5688[_0xfbd2('0x69')]];this[_0xfbd2('0x35')][_0x4f5688[_0xfbd2('0x69')]]=_0xfe6b57;}}else{_0x436f77[_0xfbd2('0x77')]=_0xfbd2('0x92')+_0x4f5688[_0xfbd2('0x86')][_0xfbd2('0x93')]();}}}this[_0xfbd2('0xf')][_0x4f5688[_0xfbd2('0x69')]]=_0x436f77;this['emitVoiceQueueChannelRemove'](_0x436f77);}}}catch(_0x9d39d5){logger['error'](_0xfbd2('0x94'),util[_0xfbd2('0x3c')](_0x9d39d5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x1d')]=function(_0x28f316){try{if(this['isNotNull'](_0x28f316)){this['addVariable'](_0x28f316[_0xfbd2('0x69')],_[_0xfbd2('0x71')](_0x28f316[_0xfbd2('0x95')])[0x0],_0x28f316['value']);if(this[_0xfbd2('0x35')][_0x28f316[_0xfbd2('0x69')]]){var _0x9c2ad6=_[_0xfbd2('0x79')](this[_0xfbd2('0x35')][_0x28f316[_0xfbd2('0x69')]]);if(_0x9c2ad6){if(this[_0xfbd2('0x57')](_0x28f316['variable'])&&this[_0xfbd2('0x57')](_0x28f316[_0xfbd2('0x95')][_0xfbd2('0x96')])){switch(_0x28f316[_0xfbd2('0x97')]){case'CONTINUE':_0x9c2ad6[_0xfbd2('0x83')]=![];_0x9c2ad6[_0xfbd2('0x84')]=null;break;case _0xfbd2('0x98'):_0x9c2ad6[_0xfbd2('0x99')]=_0xfbd2('0x9a');ami['emit'](_0xfbd2('0x9b'),_0x9c2ad6);break;default:_0x9c2ad6[_0xfbd2('0x83')]=!![];_0x9c2ad6[_0xfbd2('0x84')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x9c2ad6[_0xfbd2('0x7a')]=moment()[_0xfbd2('0x3f')](_0xfbd2('0x6c'));}_0x9c2ad6['queuecallerabandon']=![];_0x9c2ad6['queuecallerabandonAt']=null;_0x9c2ad6[_0xfbd2('0x77')]=_0x28f316['value'];this[_0xfbd2('0xf')][_0x28f316['uniqueid']]=_0x9c2ad6;this[_0xfbd2('0x41')](_0x9c2ad6);}else if(this[_0xfbd2('0x57')](_0x28f316[_0xfbd2('0x95')])&&this[_0xfbd2('0x57')](_0x28f316[_0xfbd2('0x95')][_0xfbd2('0x9c')])){if(!_0x9c2ad6[_0xfbd2('0x18')]){_0x9c2ad6[_0xfbd2('0x83')]=!![];_0x9c2ad6[_0xfbd2('0x84')]=moment()[_0xfbd2('0x3f')](_0xfbd2('0x6c'));_0x9c2ad6[_0xfbd2('0x77')]='EXITWITHKEY';_0x9c2ad6[_0xfbd2('0x7a')]=moment()['format'](_0xfbd2('0x6c'));this['channels'][_0x28f316[_0xfbd2('0x69')]]=_0x9c2ad6;}}_0x9c2ad6['variables']=this[_0xfbd2('0x38')][_0x28f316[_0xfbd2('0x69')]];}}}}catch(_0xc5d4b1){logger[_0xfbd2('0x36')](_0xfbd2('0x9d'),util['inspect'](_0xc5d4b1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x9e')]=function(_0x1e1759,_0x20dad,_0xcd062d){var _0x4f04c5=[_0xfbd2('0x9f'),_0xfbd2('0xa0'),_0xfbd2('0xa1'),'rtpaudioqosjitterbridged',_0xfbd2('0xa2'),'rtpaudioqoslossbridged',_0xfbd2('0xa3'),'rtpaudioqosrttbridged',_0xfbd2('0xa4'),'sipuri',_0xfbd2('0xa5'),_0xfbd2('0xa6'),_0xfbd2('0xa7'),_0xfbd2('0xa8'),_0xfbd2('0xa9'),_0xfbd2('0xaa'),_0xfbd2('0x82'),_0xfbd2('0xab'),'memberrealtime'];if(!_[_0xfbd2('0x32')](_0x20dad)&&!_[_0xfbd2('0xac')](_0x4f04c5,_0x20dad)){if(_[_0xfbd2('0x29')](this[_0xfbd2('0x38')][_0x1e1759])){this[_0xfbd2('0x38')][_0x1e1759]={};}this[_0xfbd2('0x38')][_0x1e1759][_0x20dad]=_0xcd062d;}};VoiceQueueReport[_0xfbd2('0x9')][_0xfbd2('0x1f')]=function(_0x40f09c){try{if(this[_0xfbd2('0x57')](_0x40f09c)){if(this[_0xfbd2('0x35')][_0x40f09c[_0xfbd2('0x69')]]){for(var _0x36a0aa=0x0,_0x201221={};_0x36a0aa0x0?_0x531e66:0x0;this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]][_0x316e('0x31')]=this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]][_0x316e('0x31')]>_[_0x316e('0x65')](_0x15df52[_0x316e('0x67')])?_[_0x316e('0x65')](_0x15df52[_0x316e('0x67')]):this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]][_0x316e('0x31')];this[_0x316e('0x4a')](this['voiceQueues'][_0x15df52['queue']]);}ami['emit'](_0x316e('0x69'),this[_0x316e('0x12')][_0x15df52[_0x316e('0x63')]]);}}}catch(_0x1a2932){logger[_0x316e('0x3d')](_0x316e('0x6a'),util[_0x316e('0x41')](_0x1a2932,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')]['syncQueueSummaryComplete']=function(_0x2a2823){this['flagQueueSummary']=!![];};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x6b')]=function(_0x5353a1){};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x1b')]=function(_0x4529fc){try{if(this[_0x316e('0x5a')](_0x4529fc)){if(_[_0x316e('0x5b')](this[_0x316e('0xe')][_0x4529fc[_0x316e('0x6c')]])){this[_0x316e('0xe')][_0x4529fc[_0x316e('0x6c')]]=[];this[_0x316e('0x10')][_0x4529fc[_0x316e('0x6c')]]={};}var _0xd81fec=new QueueReport();_0xd81fec[_0x316e('0x45')]=_0x4529fc[_0x316e('0x63')];_0xd81fec[_0x316e('0x4b')]=this[_0x316e('0x12')][_0xd81fec['name']]&&this[_0x316e('0x12')][_0xd81fec[_0x316e('0x45')]]['type']?this[_0x316e('0x12')][_0xd81fec[_0x316e('0x45')]][_0x316e('0x4b')]||'inbound':'inbound';_0xd81fec['queue']=_0x4529fc[_0x316e('0x63')];_0xd81fec['queuecallerjoinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xd81fec[_0x316e('0x6d')]=_0x4529fc['position'];_0xd81fec['count']=_0x4529fc[_0x316e('0x6e')];_[_0x316e('0x6f')](_0xd81fec,_['pick'](_0x4529fc,_[_0x316e('0x70')](_0xd81fec)));this['queueReports'][_0x4529fc[_0x316e('0x6c')]]['push'](_0xd81fec);this['channels'][_0x4529fc[_0x316e('0x6c')]]=_0xd81fec;this[_0x316e('0x43')](_0xd81fec);}}catch(_0x3595be){logger[_0x316e('0x3d')](_0x316e('0x71'),util[_0x316e('0x41')](_0x3595be,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x1d')]=function(_0x5ec548){try{if(this[_0x316e('0x5a')](_0x5ec548)){if(this[_0x316e('0xe')][_0x5ec548[_0x316e('0x6c')]]){var _0xf53a00=_[_0x316e('0x72')](this[_0x316e('0xe')][_0x5ec548['uniqueid']]);_0xf53a00[_0x316e('0x73')]=![];_0xf53a00['queuecallercompleteAt']=null;_0xf53a00[_0x316e('0x74')]=_0x5ec548[_0x316e('0x74')];_0xf53a00[_0x316e('0x75')]=_0x5ec548[_0x316e('0x75')];_0xf53a00[_0x316e('0x1c')]=!![];_0xf53a00[_0x316e('0x76')]=moment()[_0x316e('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0xf53a00[_0x316e('0x77')]='ABANDONED';_0xf53a00['lastAssignedTo']=null;this[_0x316e('0x10')][_0x5ec548['uniqueid']]=_0xf53a00;this[_0x316e('0x40')](_0xf53a00);}}}catch(_0x5ab1df){logger[_0x316e('0x3d')](_0x316e('0x78'),util[_0x316e('0x41')](_0x5ab1df,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x316e('0x1f')]=function(_0x41238a){try{if(this[_0x316e('0x5a')](_0x41238a)){if(this[_0x316e('0xe')][_0x41238a['uniqueid']]){var _0x33851b=_[_0x316e('0x72')](this['queueReports'][_0x41238a[_0x316e('0x6c')]]);_0x33851b[_0x316e('0x79')]=moment()[_0x316e('0x44')](_0x316e('0x7a'));_0x33851b['connectedlinenum']=_0x41238a[_0x316e('0x7b')];_0x33851b[_0x316e('0x7c')]=_0x41238a[_0x316e('0x7c')];this[_0x316e('0x10')][_0x41238a[_0x316e('0x6c')]]=_0x33851b;this[_0x316e('0x43')](_0x33851b);}}}catch(_0x14cdc2){logger[_0x316e('0x3d')]('[syncQueueCallerLeave][VoiceQueueReport]',util[_0x316e('0x41')](_0x14cdc2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x7d')]=function(_0x22bbc2){try{if(this['isNotNull'](_0x22bbc2)){if(this[_0x316e('0xe')][_0x22bbc2[_0x316e('0x6c')]]){var _0x39c982=_[_0x316e('0x72')](this['queueReports'][_0x22bbc2['uniqueid']]);_0x39c982['queuecallercomplete']=!![];_0x39c982[_0x316e('0x77')]=_0x316e('0x7e');}}}catch(_0x151e96){logger[_0x316e('0x3d')](_0x316e('0x7f'),util[_0x316e('0x41')](_0x151e96,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x20')]=function(_0x4fd513){try{if(this[_0x316e('0x5a')](_0x4fd513)){if(this['queueReports'][_0x4fd513[_0x316e('0x6c')]]){var _0x1b426e=_[_0x316e('0x72')](this['queueReports'][_0x4fd513[_0x316e('0x6c')]]);_0x1b426e['queuecallerabandon']=![];_0x1b426e['queuecallerabandonAt']=null;_0x1b426e[_0x316e('0x80')]=!![];_0x1b426e['lastAssignedTo']=_0x4fd513[_0x316e('0x81')];_0x1b426e[_0x316e('0x74')]=_0x4fd513[_0x316e('0x74')];_0x1b426e[_0x316e('0x73')]=!![];_0x1b426e[_0x316e('0x82')]=![];_0x1b426e['queuecallerexitAt']=null;if(!_0x1b426e[_0x316e('0x83')]){if(_0x4fd513[_0x316e('0x84')]==_0x316e('0x83')){_0x1b426e[_0x316e('0x77')]='COMPLETED';}else{if(_[_0x316e('0x85')](_0x4fd513[_0x316e('0x39')][_0x316e('0x86')](),_0x316e('0x87'))){if(this[_0x316e('0xe')][_0x4fd513[_0x316e('0x88')]]){var _0x25aa51=_['last'](this[_0x316e('0xe')][_0x4fd513[_0x316e('0x88')]]);_0x25aa51[_0x316e('0x73')]=![];_0x25aa51['queuecallerexit']=!![];_0x25aa51[_0x316e('0x89')]=moment(_0x1b426e[_0x316e('0x8a')])[_0x316e('0x8b')](_0x4fd513[_0x316e('0x74')],_0x316e('0x8c'))[_0x316e('0x44')](_0x316e('0x7a'));_0x25aa51[_0x316e('0x77')]=_0x316e('0x8d');_0x25aa51['transfer']=!![];_0x25aa51[_0x316e('0x8e')]=_0x316e('0x8f');_0x25aa51[_0x316e('0x90')]=_0x4fd513[_0x316e('0x91')];_0x25aa51[_0x316e('0x92')]=_0x4fd513[_0x316e('0x6c')];var _0x3d69af=this[_0x316e('0xe')][_0x4fd513[_0x316e('0x88')]];this[_0x316e('0xe')][_0x4fd513[_0x316e('0x88')]]=this[_0x316e('0xe')][_0x4fd513[_0x316e('0x6c')]];this[_0x316e('0xe')][_0x4fd513[_0x316e('0x6c')]]=_0x3d69af;}}else{_0x1b426e[_0x316e('0x77')]=_0x316e('0x93')+_0x4fd513[_0x316e('0x84')][_0x316e('0x94')]();}}}this['channels'][_0x4fd513['uniqueid']]=_0x1b426e;this[_0x316e('0x40')](_0x1b426e);}}}catch(_0x51963d){logger[_0x316e('0x3d')]('[syncAgentComplete][VoiceQueueReport]',util['inspect'](_0x51963d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x22')]=function(_0x59e20d){try{if(this[_0x316e('0x5a')](_0x59e20d)){this[_0x316e('0x95')](_0x59e20d[_0x316e('0x6c')],_['keys'](_0x59e20d[_0x316e('0x96')])[0x0],_0x59e20d[_0x316e('0x97')]);if(this[_0x316e('0xe')][_0x59e20d[_0x316e('0x6c')]]){var _0x2194a5=_['last'](this[_0x316e('0xe')][_0x59e20d[_0x316e('0x6c')]]);if(_0x2194a5){if(this[_0x316e('0x5a')](_0x59e20d['variable'])&&this['isNotNull'](_0x59e20d[_0x316e('0x96')][_0x316e('0x98')])){switch(_0x59e20d[_0x316e('0x97')]){case _0x316e('0x99'):_0x2194a5[_0x316e('0x82')]=![];_0x2194a5[_0x316e('0x89')]=null;break;case _0x316e('0x9a'):_0x2194a5[_0x316e('0x9b')]=_0x316e('0x9c');ami[_0x316e('0x42')](_0x316e('0x9d'),_0x2194a5);break;default:_0x2194a5[_0x316e('0x82')]=!![];_0x2194a5[_0x316e('0x89')]=moment()['format'](_0x316e('0x7a'));_0x2194a5['queuecallerleaveAt']=moment()[_0x316e('0x44')](_0x316e('0x7a'));}_0x2194a5[_0x316e('0x1c')]=![];_0x2194a5[_0x316e('0x76')]=null;_0x2194a5[_0x316e('0x77')]=_0x59e20d['value'];this['channels'][_0x59e20d[_0x316e('0x6c')]]=_0x2194a5;this[_0x316e('0x40')](_0x2194a5);}else if(this[_0x316e('0x5a')](_0x59e20d[_0x316e('0x96')])&&this[_0x316e('0x5a')](_0x59e20d['variable'][_0x316e('0x9e')])){if(!_0x2194a5[_0x316e('0x1c')]){_0x2194a5[_0x316e('0x82')]=!![];_0x2194a5['queuecallerexitAt']=moment()[_0x316e('0x44')](_0x316e('0x7a'));_0x2194a5['queuecallerexitreason']=_0x316e('0x9f');_0x2194a5[_0x316e('0x79')]=moment()[_0x316e('0x44')](_0x316e('0x7a'));this[_0x316e('0x10')][_0x59e20d['uniqueid']]=_0x2194a5;}}_0x2194a5[_0x316e('0x15')]=this[_0x316e('0x15')][_0x59e20d[_0x316e('0x6c')]];}}}}catch(_0xaf0440){logger[_0x316e('0x3d')](_0x316e('0xa0'),util[_0x316e('0x41')](_0xaf0440,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x95')]=function(_0x27659b,_0x2852e7,_0x6179a1){var _0x31864c=['rtpaudioqos','rtpaudioqosbridged',_0x316e('0xa1'),'rtpaudioqosjitterbridged',_0x316e('0xa2'),_0x316e('0xa3'),_0x316e('0xa4'),_0x316e('0xa5'),'sipcallid',_0x316e('0xa6'),_0x316e('0xa7'),_0x316e('0xa8'),_0x316e('0xa9'),_0x316e('0xaa'),_0x316e('0xab'),_0x316e('0xac'),_0x316e('0x81'),_0x316e('0xad'),'memberrealtime'];if(!_[_0x316e('0x37')](_0x2852e7)&&!_[_0x316e('0xae')](_0x31864c,_0x2852e7)){if(_['isUndefined'](this[_0x316e('0x15')][_0x27659b])){this[_0x316e('0x15')][_0x27659b]={};}this[_0x316e('0x15')][_0x27659b][_0x2852e7]=_0x6179a1;}};VoiceQueueReport[_0x316e('0x9')][_0x316e('0x24')]=function(_0x1cacc3){try{if(this['isNotNull'](_0x1cacc3)){if(this[_0x316e('0xe')][_0x1cacc3[_0x316e('0x6c')]]){for(var _0x449c1e=0x0,_0x5d225a={};_0x449c1e=0x0?moment(_0x14da3e[_0x826e('0x19')])['diff'](_0x14da3e[_0x826e('0x18')],_0x826e('0x1a')):null,'data1':_0x826e('0x1b'),'data2':_0x14da3e[_0x826e('0x14')],'data3':_0x14da3e[_0x826e('0x12')],'data4':_0x14da3e[_0x826e('0x1c')]||null,'role':_0x826e('0x13'),'internal':_0x14da3e[_0x826e('0x14')]?_[_0x826e('0x1d')](_0x14da3e['accountcode']):undefined,'uniqueid':_0x14da3e['uniqueid']},'log':_0x826e('0x15')});}; \ No newline at end of file +var _0xa091=['queue','agent','accountcode','toNumber','voiceDialReport','membername','starttime','endtime','outbound','dialstring','uniqueid','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa091,0x191));var _0x1a09=function(_0x549b82,_0x273890){_0x549b82=_0x549b82-0x0;var _0x41d75c=_0xa091[_0x549b82];return _0x41d75c;};'use strict';var moment=require(_0x1a09('0x0'));var _=require(_0x1a09('0x1'));var util=require(_0x1a09('0x2'));var client=require(_0x1a09('0x3'));exports['voiceQueueReport']=function(_0x344f2b){var _0x29eece=_0x344f2b[_0x1a09('0x4')]||_0x344f2b[_0x1a09('0x5')];return client['Request'](_0x1a09('0x6'),{'body':{'channel':_0x1a09('0x7'),'membername':_0x344f2b[_0x1a09('0x8')],'interface':_[_0x1a09('0x9')](_0x344f2b[_0x1a09('0xa')])?util[_0x1a09('0xb')]('SIP/%s',_0x344f2b['lastAssignedTo']):_0x344f2b[_0x1a09('0xa')],'type':_0x1a09('0xc'),'enterAt':_0x344f2b[_0x1a09('0xd')],'exitAt':_0x29eece,'duration':moment(_0x29eece)[_0x1a09('0xe')](_0x344f2b[_0x1a09('0xd')],_0x1a09('0xf')),'data1':_0x1a09('0x10'),'data2':_0x344f2b[_0x1a09('0x11')],'data3':_0x344f2b[_0x1a09('0x12')],'data4':null,'data5':_0x344f2b[_0x1a09('0x13')],'role':_0x1a09('0x14'),'internal':_0x344f2b[_0x1a09('0x15')]?_[_0x1a09('0x16')](_0x344f2b['accountcode']):undefined,'uniqueid':_0x344f2b['uniqueid']},'log':'CreateMemberReport'});};exports[_0x1a09('0x17')]=function(_0x9de4d3){return client['Request'](_0x1a09('0x6'),{'body':{'channel':_0x1a09('0x7'),'membername':_0x9de4d3[_0x1a09('0x18')],'interface':_0x9de4d3[_0x1a09('0xa')],'type':_0x1a09('0xc'),'enterAt':_0x9de4d3[_0x1a09('0x19')],'exitAt':_0x9de4d3['endtime'],'duration':moment(_0x9de4d3[_0x1a09('0x1a')])[_0x1a09('0xe')](_0x9de4d3[_0x1a09('0x19')],_0x1a09('0xf'))>=0x0?moment(_0x9de4d3['endtime'])['diff'](_0x9de4d3[_0x1a09('0x19')],'seconds'):null,'data1':_0x1a09('0x1b'),'data2':_0x9de4d3[_0x1a09('0x15')],'data3':_0x9de4d3['exten'],'data4':_0x9de4d3[_0x1a09('0x1c')]||null,'role':_0x1a09('0x14'),'internal':_0x9de4d3[_0x1a09('0x15')]?_[_0x1a09('0x16')](_0x9de4d3['accountcode']):undefined,'uniqueid':_0x9de4d3[_0x1a09('0x1d')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 1a539f6..9223fbb 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 _0xc29b=['html','../client','getTemplates','Request','GetTemplate'];(function(_0x568fce,_0x17ffd5){var _0x489b7d=function(_0x3e5c3b){while(--_0x3e5c3b){_0x568fce['push'](_0x568fce['shift']());}};_0x489b7d(++_0x17ffd5);}(_0xc29b,0x12d));var _0xbc29=function(_0x38466f,_0x501279){_0x38466f=_0x38466f-0x0;var _0x4c57d3=_0xc29b[_0x38466f];return _0x4c57d3;};'use strict';var client=require(_0xbc29('0x0'));exports[_0xbc29('0x1')]=function(_0x45edb6){return function(_0x5d2fef){return client[_0xbc29('0x2')](_0xbc29('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xbc29('0x4')]},'log':_0xbc29('0x3')});};}; \ No newline at end of file +var _0x2bc6=['html','../client','getTemplates'];(function(_0x909dc1,_0x1a659b){var _0x111418=function(_0x1c15a1){while(--_0x1c15a1){_0x909dc1['push'](_0x909dc1['shift']());}};_0x111418(++_0x1a659b);}(_0x2bc6,0x163));var _0x62bc=function(_0x545663,_0x514ffb){_0x545663=_0x545663-0x0;var _0x26add7=_0x2bc6[_0x545663];return _0x26add7;};'use strict';var client=require(_0x62bc('0x0'));exports[_0x62bc('0x1')]=function(_0x3b71d5){return function(_0x56939b){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0x62bc('0x2')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 4411072..4269533 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 _0x89c1=['name','channel','Condition','field','operator','value','AnyConditions','Action','Actions','action','data2','data3','data5','data6','data7','../client','getTriggers','Request','GetTrigger'];(function(_0x122c58,_0xc9eaaa){var _0x4a1463=function(_0x60abb7){while(--_0x60abb7){_0x122c58['push'](_0x122c58['shift']());}};_0x4a1463(++_0xc9eaaa);}(_0x89c1,0x94));var _0x189c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x89c1[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x189c('0x0'));exports[_0x189c('0x1')]=function(_0x507401){return function(_0x52104f){return client[_0x189c('0x2')](_0x189c('0x3'),{'options':{'raw':![],'attributes':['id',_0x189c('0x4'),_0x189c('0x5'),'status'],'include':[{'model':_0x189c('0x6'),'as':'AllConditions','attributes':['id',_0x189c('0x7'),_0x189c('0x8'),_0x189c('0x9')]},{'model':_0x189c('0x6'),'as':_0x189c('0xa'),'attributes':['id',_0x189c('0x7'),_0x189c('0x8'),_0x189c('0x9')]},{'model':_0x189c('0xb'),'as':_0x189c('0xc'),'attributes':['id',_0x189c('0xd'),'data1',_0x189c('0xe'),_0x189c('0xf'),'data4',_0x189c('0x10'),_0x189c('0x11'),_0x189c('0x12')]}]},'log':_0x189c('0x3')});};}; \ No newline at end of file +var _0x14d5=['AnyConditions','Action','Actions','action','data3','data4','data7','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14d5,0x1f4));var _0x514d=function(_0x2ed1a0,_0x36acd9){_0x2ed1a0=_0x2ed1a0-0x0;var _0x3d272e=_0x14d5[_0x2ed1a0];return _0x3d272e;};'use strict';var client=require('../client');exports[_0x514d('0x0')]=function(_0xe3525d){return function(_0x2199e0){return client[_0x514d('0x1')](_0x514d('0x2'),{'options':{'raw':![],'attributes':['id',_0x514d('0x3'),_0x514d('0x4'),'status'],'include':[{'model':_0x514d('0x5'),'as':_0x514d('0x6'),'attributes':['id',_0x514d('0x7'),_0x514d('0x8'),_0x514d('0x9')]},{'model':'Condition','as':_0x514d('0xa'),'attributes':['id',_0x514d('0x7'),_0x514d('0x8'),_0x514d('0x9')]},{'model':_0x514d('0xb'),'as':_0x514d('0xc'),'attributes':['id',_0x514d('0xd'),'data1','data2',_0x514d('0xe'),_0x514d('0xf'),'data5','data6',_0x514d('0x10')]}]},'log':_0x514d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 29cf043..6e374d5 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 _0xaf4c=['getTrunks','Request','GetTrunk','name','registry','../client'];(function(_0x22182f,_0x4b985e){var _0x2e4536=function(_0x304b67){while(--_0x304b67){_0x22182f['push'](_0x22182f['shift']());}};_0x2e4536(++_0x4b985e);}(_0xaf4c,0x17f));var _0xcaf4=function(_0x51422f,_0x5d884a){_0x51422f=_0x51422f-0x0;var _0x2ce606=_0xaf4c[_0x51422f];return _0x2ce606;};'use strict';var client=require(_0xcaf4('0x0'));exports[_0xcaf4('0x1')]=function(_0x3a9a54){return function(_0x36287c){return client[_0xcaf4('0x2')](_0xcaf4('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xcaf4('0x4'),_0xcaf4('0x5')]},'log':_0xcaf4('0x3')});};}; \ No newline at end of file +var _0x8487=['../client','getTrunks','Request','GetTrunk','registry'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8487,0xb4));var _0x7848=function(_0x129bb8,_0x5eade6){_0x129bb8=_0x129bb8-0x0;var _0x275d29=_0x8487[_0x129bb8];return _0x275d29;};'use strict';var client=require(_0x7848('0x0'));exports[_0x7848('0x1')]=function(_0x1d730f){return function(_0x413dd1){return client[_0x7848('0x2')](_0x7848('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x7848('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index cd4d383..8210b18 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 _0x2277=['Request','GetUser','agent','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','UnpauseUser','getAgent','email','lastPauseAt','../client','getAgents'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0x2277,0xb6));var _0x7227=function(_0x335564,_0x4a2cd1){_0x335564=_0x335564-0x0;var _0x4aeb30=_0x2277[_0x335564];return _0x4aeb30;};'use strict';var client=require(_0x7227('0x0'));exports[_0x7227('0x1')]=function(){return function(){return client[_0x7227('0x2')](_0x7227('0x3'),{'options':{'raw':![],'where':{'role':_0x7227('0x4')},'attributes':['id',_0x7227('0x5'),'email',_0x7227('0x6'),_0x7227('0x7'),_0x7227('0x8'),_0x7227('0x9'),_0x7227('0xa'),'lastPauseAt',_0x7227('0xb'),'phone',_0x7227('0xc'),_0x7227('0xd')]},'log':_0x7227('0x1')});};};exports[_0x7227('0xe')]=function(){return function(){return client[_0x7227('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x7227('0xf')},'attributes':['id',_0x7227('0x5'),'accountcode',_0x7227('0x10')]},'log':_0x7227('0xe')});};};exports[_0x7227('0x11')]=function(_0x13b771,_0x55e156,_0xbae23d){return client[_0x7227('0x2')](_0x7227('0x12'),{'body':{'type':_0x55e156,'uniqueid':_0xbae23d},'options':{'where':{'id':_0x13b771['id']}},'log':'savePause'});};exports['saveUnpause']=function(_0x21e605){return client['Request'](_0x7227('0x13'),{'body':{},'options':{'where':{'id':_0x21e605['id']}},'log':_0x7227('0x11')});};exports[_0x7227('0x14')]=function(_0x50067c){return client[_0x7227('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x7227('0x4'),'id':_0x50067c},'attributes':['id',_0x7227('0x5'),_0x7227('0x15'),'accountcode',_0x7227('0x7'),'online',_0x7227('0x9'),'pauseType',_0x7227('0x16'),'voicePause',_0x7227('0xd')]},'log':'getAgent'});}; \ No newline at end of file +var _0x0b48=['accountcode','fullname','online','lastLoginAt','lastPauseAt','phone','mobile','GetUser','internal','getTelephones','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','agent','pauseType','voicePause','interface','getAgents','Request','name','email'];(function(_0x4513e8,_0x16f480){var _0x1e8758=function(_0x5c2038){while(--_0x5c2038){_0x4513e8['push'](_0x4513e8['shift']());}};_0x1e8758(++_0x16f480);}(_0x0b48,0x13e));var _0x80b4=function(_0x7bfd87,_0x72597a){_0x7bfd87=_0x7bfd87-0x0;var _0x1d9702=_0x0b48[_0x7bfd87];return _0x1d9702;};'use strict';var client=require('../client');exports[_0x80b4('0x0')]=function(){return function(){return client[_0x80b4('0x1')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x80b4('0x2'),_0x80b4('0x3'),_0x80b4('0x4'),_0x80b4('0x5'),_0x80b4('0x6'),_0x80b4('0x7'),'pauseType',_0x80b4('0x8'),'voicePause',_0x80b4('0x9'),_0x80b4('0xa'),'interface']},'log':_0x80b4('0x0')});};};exports['getTelephones']=function(){return function(){return client[_0x80b4('0x1')](_0x80b4('0xb'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x80b4('0x2'),_0x80b4('0x4'),_0x80b4('0xc')]},'log':_0x80b4('0xd')});};};exports[_0x80b4('0xe')]=function(_0x218be7,_0x41f76b,_0x3fae94){return client[_0x80b4('0x1')](_0x80b4('0xf'),{'body':{'type':_0x41f76b,'uniqueid':_0x3fae94},'options':{'where':{'id':_0x218be7['id']}},'log':_0x80b4('0xe')});};exports[_0x80b4('0x10')]=function(_0x2bdd06){return client[_0x80b4('0x1')](_0x80b4('0x11'),{'body':{},'options':{'where':{'id':_0x2bdd06['id']}},'log':'savePause'});};exports['getAgent']=function(_0x4e8da4){return client[_0x80b4('0x1')](_0x80b4('0x12'),{'options':{'raw':![],'where':{'role':_0x80b4('0x13'),'id':_0x4e8da4},'attributes':['id',_0x80b4('0x2'),_0x80b4('0x3'),_0x80b4('0x4'),'fullname',_0x80b4('0x6'),_0x80b4('0x7'),_0x80b4('0x14'),_0x80b4('0x8'),_0x80b4('0x15'),_0x80b4('0x16')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 957af2e..daac9f9 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 _0xe5af=['CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','create'];(function(_0x1e0543,_0x4e200d){var _0x21a58e=function(_0x15eba6){while(--_0x15eba6){_0x1e0543['push'](_0x1e0543['shift']());}};_0x21a58e(++_0x4e200d);}(_0xe5af,0xff));var _0xfe5a=function(_0x5c9d6f,_0x5d0b11){_0x5c9d6f=_0x5c9d6f-0x0;var _0x1cdff8=_0xe5af[_0x5c9d6f];return _0x1cdff8;};'use strict';var client=require('../client');exports[_0xfe5a('0x0')]=function(_0x2007b1){return client['Request']('CreateVoiceAgentReport',{'body':_0x2007b1,'log':_0xfe5a('0x1')});};exports['update']=function(_0x5a1f5b,_0x353533,_0x408168){return client[_0xfe5a('0x2')](_0xfe5a('0x3'),{'body':_0x5a1f5b,'options':{'where':{'uniqueid':_0x353533,'interface':_0x408168,'agentcomplete':!![]}},'log':_0xfe5a('0x3')});}; \ No newline at end of file +var _0xaa81=['CreateVoiceAgentReport','UpdateVoiceAgentReport','create','Request'];(function(_0x244817,_0x25d04d){var _0x427f1f=function(_0x57f802){while(--_0x57f802){_0x244817['push'](_0x244817['shift']());}};_0x427f1f(++_0x25d04d);}(_0xaa81,0x136));var _0x1aa8=function(_0x4bf206,_0x36aaf3){_0x4bf206=_0x4bf206-0x0;var _0xca4b25=_0xaa81[_0x4bf206];return _0xca4b25;};'use strict';var client=require('../client');exports[_0x1aa8('0x0')]=function(_0x2b2eec){return client[_0x1aa8('0x1')](_0x1aa8('0x2'),{'body':_0x2b2eec,'log':_0x1aa8('0x2')});};exports['update']=function(_0xb03b6b,_0x205b08,_0x413784){return client[_0x1aa8('0x1')](_0x1aa8('0x3'),{'body':_0xb03b6b,'options':{'where':{'uniqueid':_0x205b08,'interface':_0x413784,'agentcomplete':!![]}},'log':_0x1aa8('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index a075454..81485cf 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 _0x6e29=['moment','util','lodash','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','GetVoiceCallReports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6e29,0x10a));var _0x96e2=function(_0x3c60f7,_0x3ad048){_0x3c60f7=_0x3c60f7-0x0;var _0x46f167=_0x6e29[_0x3c60f7];return _0x46f167;};'use strict';var moment=require(_0x96e2('0x0'));var util=require(_0x96e2('0x1'));var _=require(_0x96e2('0x2'));var client=require('../client');exports['create']=function(_0x2e4b06){return client[_0x96e2('0x3')](_0x96e2('0x4'),{'body':_[_0x96e2('0x5')](_0x2e4b06,{'source':_0x2e4b06[_0x96e2('0x6')],'destinationcontext':_0x2e4b06['context'],'callerid':_0x2e4b06[_0x96e2('0x7')],'amaflags':_0x96e2('0x8')}),'log':_0x96e2('0x4')});};exports[_0x96e2('0x9')]=function(){return function(){return client[_0x96e2('0x3')](_0x96e2('0xa'),{'options':{'where':{'type':[_0x96e2('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x96e2('0xc'))['format'](_0x96e2('0xd')),moment()[_0x96e2('0xe')](_0x96e2('0xc'))[_0x96e2('0xf')](_0x96e2('0xd'))]}},'attributes':[_0x96e2('0x10'),_0x96e2('0x11'),'duration','billableseconds']},'log':_0x96e2('0x12')});};}; \ No newline at end of file +var _0xc471=['GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xc471,0xd3));var _0x1c47=function(_0x1407af,_0x4b09e5){_0x1407af=_0x1407af-0x0;var _0xd7c4b4=_0xc471[_0x1407af];return _0xd7c4b4;};'use strict';var moment=require(_0x1c47('0x0'));var util=require(_0x1c47('0x1'));var _=require(_0x1c47('0x2'));var client=require(_0x1c47('0x3'));exports[_0x1c47('0x4')]=function(_0x374376){return client[_0x1c47('0x5')](_0x1c47('0x6'),{'body':_[_0x1c47('0x7')](_0x374376,{'source':_0x374376['calleridnum'],'destinationcontext':_0x374376[_0x1c47('0x8')],'callerid':_0x374376[_0x1c47('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x1c47('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x1c47('0xa'),{'options':{'where':{'type':[_0x1c47('0xb')],'createdAt':{'$between':[moment()[_0x1c47('0xc')](_0x1c47('0xd'))[_0x1c47('0xe')](_0x1c47('0xf')),moment()[_0x1c47('0x10')](_0x1c47('0xd'))[_0x1c47('0xe')](_0x1c47('0xf'))]}},'attributes':['type',_0x1c47('0x11'),_0x1c47('0x12'),_0x1c47('0x13')]},'log':_0x1c47('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 26de8b3..5489474 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 _0x5cc6=['CreateVoiceDialReport','../client','create','Request'];(function(_0x461546,_0x152a89){var _0xf9e527=function(_0x3ff0e5){while(--_0x3ff0e5){_0x461546['push'](_0x461546['shift']());}};_0xf9e527(++_0x152a89);}(_0x5cc6,0x12d));var _0x65cc=function(_0x2142c8,_0x3001eb){_0x2142c8=_0x2142c8-0x0;var _0x4286e9=_0x5cc6[_0x2142c8];return _0x4286e9;};'use strict';var client=require(_0x65cc('0x0'));exports[_0x65cc('0x1')]=function(_0x5bae03){return client[_0x65cc('0x2')](_0x65cc('0x3'),{'body':_0x5bae03,'log':_0x65cc('0x3')});}; \ No newline at end of file +var _0x5f9a=['../client','create','CreateVoiceDialReport'];(function(_0x59eca4,_0xec28a5){var _0x30d5fe=function(_0x3fa4bb){while(--_0x3fa4bb){_0x59eca4['push'](_0x59eca4['shift']());}};_0x30d5fe(++_0xec28a5);}(_0x5f9a,0x192));var _0xa5f9=function(_0x8d660,_0x3b2ec9){_0x8d660=_0x8d660-0x0;var _0x4bc154=_0x5f9a[_0x8d660];return _0x4bc154;};'use strict';var client=require(_0xa5f9('0x0'));exports[_0xa5f9('0x1')]=function(_0x1f854f){return client['Request'](_0xa5f9('0x2'),{'body':_0x1f854f,'log':_0xa5f9('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index a8efa26..2a1c0c4 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 _0xc2da=['../client','Request','exten','getVoiceExtensions'];(function(_0x17fbd5,_0x3e8bba){var _0x1aa294=function(_0x173c08){while(--_0x173c08){_0x17fbd5['push'](_0x17fbd5['shift']());}};_0x1aa294(++_0x3e8bba);}(_0xc2da,0x124));var _0xac2d=function(_0x2430de,_0x40394d){_0x2430de=_0x2430de-0x0;var _0x30d356=_0xc2da[_0x2430de];return _0x30d356;};'use strict';var client=require(_0xac2d('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xac2d('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xac2d('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xac2d('0x3')});};}; \ No newline at end of file +var _0xed3c=['GetVoiceExtension','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x3145f6,_0x34a96e){var _0x291e00=function(_0x313a86){while(--_0x313a86){_0x3145f6['push'](_0x3145f6['shift']());}};_0x291e00(++_0x34a96e);}(_0xed3c,0x1a6));var _0xced3=function(_0x59cdd0,_0x56af37){_0x59cdd0=_0x59cdd0-0x0;var _0x41bf3d=_0xed3c[_0x59cdd0];return _0x41bf3d;};'use strict';var client=require(_0xced3('0x0'));exports[_0xced3('0x1')]=function(){return function(){return client[_0xced3('0x2')](_0xced3('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xced3('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xced3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 80a4682..83f113b 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 _0xd882=['type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','Request','GetVoiceQueue','name','acw','monitor_format'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0xd882,0x113));var _0x2d88=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0xd882[_0x561f25];return _0x150e4c;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0x2d88('0x0')](_0x2d88('0x1'),{'options':{'raw':![],'attributes':['id',_0x2d88('0x2'),_0x2d88('0x3'),'acwTimeout','autopause',_0x2d88('0x4'),_0x2d88('0x5'),'dialActive',_0x2d88('0x6'),_0x2d88('0x7'),_0x2d88('0x8'),_0x2d88('0x9'),_0x2d88('0xa'),'dialPredictiveOptimizationPercentage',_0x2d88('0xb'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x2d88('0xc'),'dialQueueOptions',_0x2d88('0xd'),_0x2d88('0xe'),'dialCongestionMaxRetry',_0x2d88('0xf'),'dialBusyMaxRetry',_0x2d88('0x10'),_0x2d88('0x11'),_0x2d88('0x12'),'dialGlobalMaxRetry',_0x2d88('0x13'),_0x2d88('0x14'),'dialPrefix',_0x2d88('0x15'),'dialAMDActive',_0x2d88('0x16'),_0x2d88('0x17'),_0x2d88('0x18'),_0x2d88('0x19'),_0x2d88('0x1a'),'dialAMDBetweenWordsSilence',_0x2d88('0x1b'),_0x2d88('0x1c'),'dialAMDMaximumWordLength',_0x2d88('0x1d'),_0x2d88('0x1e'),'dialRecallInQueue',_0x2d88('0x1f'),_0x2d88('0x20'),_0x2d88('0x21'),_0x2d88('0x22'),_0x2d88('0x4'),'strategy',_0x2d88('0x23'),_0x2d88('0x24'),_0x2d88('0x25'),_0x2d88('0x26'),_0x2d88('0x27'),_0x2d88('0x28'),_0x2d88('0x29'),_0x2d88('0x2a'),_0x2d88('0x2b'),'dialMachineRetryFrequency',_0x2d88('0x2c'),'dialAgentRejectRetryFrequency',_0x2d88('0x2d'),_0x2d88('0x2e'),_0x2d88('0x2f')],'include':[{'model':'Trunk','as':_0x2d88('0x30'),'attributes':['id',_0x2d88('0x2'),_0x2d88('0x31'),'active']},{'model':_0x2d88('0x32'),'as':_0x2d88('0x33'),'attributes':['id',_0x2d88('0x2')]},{'model':_0x2d88('0x30'),'as':_0x2d88('0x34'),'attributes':['id',_0x2d88('0x2'),_0x2d88('0x31'),'active']},{'model':'Interval','as':_0x2d88('0x35'),'attributes':['id',_0x2d88('0x2')],'include':[{'model':_0x2d88('0x35'),'as':_0x2d88('0x36'),'attributes':['id',_0x2d88('0x2'),_0x2d88('0x37')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x21f1=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x21f1,0x98));var _0x121f=function(_0x279642,_0x1be5b1){_0x279642=_0x279642-0x0;var _0x3e9e51=_0x21f1[_0x279642];return _0x3e9e51;};'use strict';var client=require(_0x121f('0x0'));exports[_0x121f('0x1')]=function(){return function(){return client[_0x121f('0x2')](_0x121f('0x3'),{'options':{'raw':![],'attributes':['id',_0x121f('0x4'),_0x121f('0x5'),_0x121f('0x6'),_0x121f('0x7'),_0x121f('0x8'),'type',_0x121f('0x9'),_0x121f('0xa'),_0x121f('0xb'),_0x121f('0xc'),_0x121f('0xd'),_0x121f('0xe'),_0x121f('0xf'),_0x121f('0x10'),_0x121f('0x11'),_0x121f('0x12'),_0x121f('0x13'),_0x121f('0x14'),_0x121f('0x15'),_0x121f('0x16'),_0x121f('0x17'),_0x121f('0x18'),'dialBusyMaxRetry',_0x121f('0x19'),_0x121f('0x1a'),_0x121f('0x1b'),_0x121f('0x1c'),'dialTimezone','dialGlobalInterval',_0x121f('0x1d'),_0x121f('0x1e'),'dialAMDActive',_0x121f('0x1f'),'dialAMDGreeting',_0x121f('0x20'),_0x121f('0x21'),_0x121f('0x22'),_0x121f('0x23'),'dialAMDMaximumNumberOfWords',_0x121f('0x24'),'dialAMDMaximumWordLength','timeout',_0x121f('0x25'),'dialRecallInQueue',_0x121f('0x26'),_0x121f('0x27'),_0x121f('0x28'),_0x121f('0x29'),'monitor_format','strategy',_0x121f('0x2a'),_0x121f('0x2b'),_0x121f('0x2c'),_0x121f('0x2d'),_0x121f('0x2e'),_0x121f('0x2f'),'dialAbandonedMaxRetry',_0x121f('0x30'),_0x121f('0x31'),_0x121f('0x32'),'dialAgentRejectMaxRetry',_0x121f('0x33'),_0x121f('0x34'),'dialPredictiveIntervalMaxThreshold',_0x121f('0x35')],'include':[{'model':_0x121f('0x36'),'as':'Trunk','attributes':['id','name',_0x121f('0x37'),_0x121f('0x38')]},{'model':_0x121f('0x39'),'as':'mandatoryDispositionPause','attributes':['id',_0x121f('0x4')]},{'model':_0x121f('0x36'),'as':_0x121f('0x3a'),'attributes':['id',_0x121f('0x4'),_0x121f('0x37'),_0x121f('0x38')]},{'model':'Interval','as':_0x121f('0x3b'),'attributes':['id',_0x121f('0x4')],'include':[{'model':_0x121f('0x3b'),'as':_0x121f('0x3c'),'attributes':['id','name',_0x121f('0x3d')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4f13a0c..c67080c 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 _0xf70f=['lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt'];(function(_0x5b1003,_0x4bfeb9){var _0x4a3ca8=function(_0x4f5bde){while(--_0x4f5bde){_0x5b1003['push'](_0x5b1003['shift']());}};_0x4a3ca8(++_0x4bfeb9);}(_0xf70f,0x1b5));var _0xff70=function(_0x110230,_0x9327b4){_0x110230=_0x110230-0x0;var _0xef860f=_0xf70f[_0x110230];return _0xef860f;};'use strict';var moment=require('moment');var _=require(_0xff70('0x0'));var client=require(_0xff70('0x1'));exports[_0xff70('0x2')]=function(_0x1b9e43){return client[_0xff70('0x3')](_0xff70('0x4'),{'body':_0x1b9e43,'log':_0xff70('0x4')});};exports[_0xff70('0x5')]=function(){return function(){return client['Request'](_0xff70('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xff70('0x7')](_0xff70('0x8'))[_0xff70('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xff70('0xa')]('day')['format'](_0xff70('0xb'))]}},'attributes':[_0xff70('0xc'),_0xff70('0xd'),_0xff70('0xe'),'queuecallerleaveAt','queuecallercomplete',_0xff70('0xf'),_0xff70('0x10'),_0xff70('0x11'),'queuecallerabandon',_0xff70('0x12')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0x6837=['GetVoiceQueueReports','moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerexit','queuecallerexitAt','queuecallerabandon'];(function(_0x1154fb,_0x231daa){var _0x43b1a6=function(_0x5799b1){while(--_0x5799b1){_0x1154fb['push'](_0x1154fb['shift']());}};_0x43b1a6(++_0x231daa);}(_0x6837,0x1a3));var _0x7683=function(_0xa60333,_0x44506a){_0xa60333=_0xa60333-0x0;var _0x13e2c0=_0x6837[_0xa60333];return _0x13e2c0;};'use strict';var moment=require(_0x7683('0x0'));var _=require(_0x7683('0x1'));var client=require(_0x7683('0x2'));exports[_0x7683('0x3')]=function(_0x538eb6){return client[_0x7683('0x4')](_0x7683('0x5'),{'body':_0x538eb6,'log':_0x7683('0x5')});};exports[_0x7683('0x6')]=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x7683('0x7')](_0x7683('0x8'))[_0x7683('0x9')](_0x7683('0xa')),moment()['endOf'](_0x7683('0x8'))[_0x7683('0x9')](_0x7683('0xa'))]}},'attributes':[_0x7683('0xb'),_0x7683('0xc'),_0x7683('0xd'),_0x7683('0xe'),'queuecallercomplete','queuecallercompleteAt',_0x7683('0xf'),_0x7683('0x10'),_0x7683('0x11'),'queuecallerabandonAt']},'log':_0x7683('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index a73c0dc..6a34b21 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 _0x2fc2=['Request','getVoiceQueueRtPauses'];(function(_0x473fde,_0x4bc212){var _0x1f34b2=function(_0x3bda4c){while(--_0x3bda4c){_0x473fde['push'](_0x473fde['shift']());}};_0x1f34b2(++_0x4bc212);}(_0x2fc2,0xa7));var _0x22fc=function(_0x4c46de,_0x19f7d5){_0x4c46de=_0x4c46de-0x0;var _0x52b083=_0x2fc2[_0x4c46de];return _0x52b083;};'use strict';var client=require('../client');exports[_0x22fc('0x0')]=function(_0x1426fb){return function(){return client[_0x22fc('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x1426fb,'paused':!![]},'raw':!![]},'log':_0x22fc('0x0')});};}; \ No newline at end of file +var _0xf55c=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x2f0057,_0x448b27){var _0x17f2c3=function(_0x12efc3){while(--_0x12efc3){_0x2f0057['push'](_0x2f0057['shift']());}};_0x17f2c3(++_0x448b27);}(_0xf55c,0x1e7));var _0xcf55=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xf55c[_0x9aada2];return _0x196dff;};'use strict';var client=require(_0xcf55('0x0'));exports['getVoiceQueueRtPauses']=function(_0x183039){return function(){return client[_0xcf55('0x1')](_0xcf55('0x2'),{'options':{'where':{'VoiceQueueId':_0x183039,'paused':!![]},'raw':!![]},'log':_0xcf55('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index be92b30..272f850 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 _0x2ec3=['merge','lodash','../client','CreateVoiceRecording'];(function(_0x4f41fe,_0x452d4){var _0x1d34ee=function(_0x5a077c){while(--_0x5a077c){_0x4f41fe['push'](_0x4f41fe['shift']());}};_0x1d34ee(++_0x452d4);}(_0x2ec3,0x1c9));var _0x32ec=function(_0x3cd56f,_0x4aed1e){_0x3cd56f=_0x3cd56f-0x0;var _0x37ad71=_0x2ec3[_0x3cd56f];return _0x37ad71;};'use strict';var _=require(_0x32ec('0x0'));var client=require(_0x32ec('0x1'));exports['create']=function(_0x510c6c){return client['Request'](_0x32ec('0x2'),{'body':_[_0x32ec('0x3')](_0x510c6c,{'value':_0x510c6c['monitorFilename']}),'log':_0x32ec('0x2')});}; \ No newline at end of file +var _0x6cc4=['Request','CreateVoiceRecording','merge','lodash','../client','create'];(function(_0x1b6aa7,_0x43dd01){var _0x5e83ca=function(_0x3db567){while(--_0x3db567){_0x1b6aa7['push'](_0x1b6aa7['shift']());}};_0x5e83ca(++_0x43dd01);}(_0x6cc4,0x1b3));var _0x46cc=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6cc4[_0x432682];return _0x463d05;};'use strict';var _=require(_0x46cc('0x0'));var client=require(_0x46cc('0x1'));exports[_0x46cc('0x2')]=function(_0x47ea21){return client[_0x46cc('0x3')](_0x46cc('0x4'),{'body':_[_0x46cc('0x5')](_0x47ea21,{'value':_0x47ea21['monitorFilename']}),'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 e773d96..73d1480 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 _0xf21f=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','blind','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x18ea66,_0x2a6ddc){var _0x10f636=function(_0x1c5b43){while(--_0x1c5b43){_0x18ea66['push'](_0x18ea66['shift']());}};_0x10f636(++_0x2a6ddc);}(_0xf21f,0x102));var _0xff21=function(_0x51f632,_0x5a14d5){_0x51f632=_0x51f632-0x0;var _0x24cf36=_0xf21f[_0x51f632];return _0x24cf36;};'use strict';var client=require(_0xff21('0x0'));exports[_0xff21('0x1')]=function(_0x273a04){return client['Request'](_0xff21('0x2'),{'body':{'result':_0x273a04['result'],'transfererchannel':_0x273a04[_0xff21('0x3')],'transferercalleridnum':_0x273a04['transferercalleridnum'],'transferercalleridname':_0x273a04[_0xff21('0x4')],'transfererconnectedlinenum':_0x273a04['transfererconnectedlinenum'],'transfererconnectedlinename':_0x273a04[_0xff21('0x5')],'transfereraccountcode':_0x273a04[_0xff21('0x6')],'transferercontext':_0x273a04[_0xff21('0x7')],'transfererexten':_0x273a04[_0xff21('0x8')],'transfererlinkedid':_0x273a04['transfererlinkedid'],'transfereechannel':_0x273a04[_0xff21('0x9')],'transfereecalleridnum':_0x273a04[_0xff21('0xa')],'transfereecalleridname':_0x273a04[_0xff21('0xb')],'transfereeconnectedlinenum':_0x273a04[_0xff21('0xc')],'transfereeconnectedlinename':_0x273a04[_0xff21('0xd')],'transfereeaccountcode':_0x273a04['transfereeaccountcode'],'transfereecontext':_0x273a04[_0xff21('0xe')],'transfereeexten':_0x273a04['transfereeexten'],'transfereelinkedid':_0x273a04['transfereelinkedid'],'isexternal':_0x273a04['isexternal'],'context':_0x273a04['context'],'extension':_0x273a04['extension'],'type':_0xff21('0xf')},'log':_0xff21('0x2')});};exports[_0xff21('0x10')]=function(_0x1f577e){return client[_0xff21('0x11')](_0xff21('0x2'),{'body':{'result':_0x1f577e[_0xff21('0x12')],'transfererchannel':_0x1f577e[_0xff21('0x13')],'transferercalleridnum':_0x1f577e['origtransferercalleridnum'],'transferercalleridname':_0x1f577e[_0xff21('0x14')],'transfererconnectedlinenum':_0x1f577e[_0xff21('0x15')],'transfererconnectedlinename':_0x1f577e[_0xff21('0x16')],'transfereraccountcode':_0x1f577e[_0xff21('0x17')],'transferercontext':_0x1f577e[_0xff21('0x18')],'transfererexten':_0x1f577e[_0xff21('0x19')],'transfererlinkedid':_0x1f577e[_0xff21('0x1a')],'transfereechannel':_0x1f577e[_0xff21('0x1b')],'transfereecalleridnum':_0x1f577e[_0xff21('0x1c')],'transfereecalleridname':_0x1f577e[_0xff21('0x1d')],'transfereeconnectedlinenum':_0x1f577e[_0xff21('0x1e')],'transfereeconnectedlinename':_0x1f577e[_0xff21('0x1f')],'transfereeaccountcode':_0x1f577e['transfertargetaccountcode'],'transfereecontext':_0x1f577e[_0xff21('0x20')],'transfereeexten':_0x1f577e['transfertargetexten'],'transfereelinkedid':_0x1f577e['transfertargetlinkedid'],'isexternal':_0x1f577e['isexternal'],'context':_0x1f577e[_0xff21('0x21')],'extension':_0x1f577e[_0xff21('0x22')],'type':_0xff21('0x23')},'log':_0xff21('0x2')});}; \ No newline at end of file +var _0x5aa8=['transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum'];(function(_0x29c01b,_0x24f9ee){var _0x53ed88=function(_0x30b901){while(--_0x30b901){_0x29c01b['push'](_0x29c01b['shift']());}};_0x53ed88(++_0x24f9ee);}(_0x5aa8,0x13a));var _0x85aa=function(_0x2c3da8,_0x1c2099){_0x2c3da8=_0x2c3da8-0x0;var _0x177cf9=_0x5aa8[_0x2c3da8];return _0x177cf9;};'use strict';var client=require(_0x85aa('0x0'));exports['blindTransfer']=function(_0x21774b){return client[_0x85aa('0x1')](_0x85aa('0x2'),{'body':{'result':_0x21774b[_0x85aa('0x3')],'transfererchannel':_0x21774b[_0x85aa('0x4')],'transferercalleridnum':_0x21774b[_0x85aa('0x5')],'transferercalleridname':_0x21774b[_0x85aa('0x6')],'transfererconnectedlinenum':_0x21774b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x21774b[_0x85aa('0x7')],'transfereraccountcode':_0x21774b[_0x85aa('0x8')],'transferercontext':_0x21774b[_0x85aa('0x9')],'transfererexten':_0x21774b[_0x85aa('0xa')],'transfererlinkedid':_0x21774b[_0x85aa('0xb')],'transfereechannel':_0x21774b['transfereechannel'],'transfereecalleridnum':_0x21774b[_0x85aa('0xc')],'transfereecalleridname':_0x21774b[_0x85aa('0xd')],'transfereeconnectedlinenum':_0x21774b[_0x85aa('0xe')],'transfereeconnectedlinename':_0x21774b[_0x85aa('0xf')],'transfereeaccountcode':_0x21774b[_0x85aa('0x10')],'transfereecontext':_0x21774b['transfereecontext'],'transfereeexten':_0x21774b[_0x85aa('0x11')],'transfereelinkedid':_0x21774b[_0x85aa('0x12')],'isexternal':_0x21774b[_0x85aa('0x13')],'context':_0x21774b[_0x85aa('0x14')],'extension':_0x21774b[_0x85aa('0x15')],'type':_0x85aa('0x16')},'log':_0x85aa('0x2')});};exports[_0x85aa('0x17')]=function(_0x44db82){return client[_0x85aa('0x1')](_0x85aa('0x2'),{'body':{'result':_0x44db82[_0x85aa('0x3')],'transfererchannel':_0x44db82[_0x85aa('0x18')],'transferercalleridnum':_0x44db82[_0x85aa('0x19')],'transferercalleridname':_0x44db82['origtransferercalleridname'],'transfererconnectedlinenum':_0x44db82['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x44db82[_0x85aa('0x1a')],'transfereraccountcode':_0x44db82[_0x85aa('0x1b')],'transferercontext':_0x44db82['secondtransferercontext'],'transfererexten':_0x44db82['secondtransfererexten'],'transfererlinkedid':_0x44db82[_0x85aa('0x1c')],'transfereechannel':_0x44db82[_0x85aa('0x1d')],'transfereecalleridnum':_0x44db82[_0x85aa('0x1e')],'transfereecalleridname':_0x44db82[_0x85aa('0x1f')],'transfereeconnectedlinenum':_0x44db82[_0x85aa('0x20')],'transfereeconnectedlinename':_0x44db82[_0x85aa('0x21')],'transfereeaccountcode':_0x44db82[_0x85aa('0x22')],'transfereecontext':_0x44db82[_0x85aa('0x23')],'transfereeexten':_0x44db82[_0x85aa('0x24')],'transfereelinkedid':_0x44db82['transfertargetlinkedid'],'isexternal':_0x44db82['isexternal'],'context':_0x44db82[_0x85aa('0x25')],'extension':_0x44db82[_0x85aa('0x26')],'type':_0x85aa('0x27')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index e8d6c45..308c5b0 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 _0xb0d4=['monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','voicechannel','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','campaigns','run','Event\x20name\x20mandatory','emit','event','checkAfterSend','server','http','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','../ami','format','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','join','keys','module','action','Reload','Action','then','message','error','username','pick','command','Command','catch','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','unmanaged','abandoned','waiting','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','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','Trunk','active','callerid','Interval','push','values','channels','length','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)'];(function(_0x48f1db,_0x554c57){var _0x27de48=function(_0x3cd347){while(--_0x3cd347){_0x48f1db['push'](_0x48f1db['shift']());}};_0x27de48(++_0x554c57);}(_0xb0d4,0x1ba));var _0x4b0d=function(_0x2d48a2,_0x34ffa6){_0x2d48a2=_0x2d48a2-0x0;var _0x2ba1cb=_0xb0d4[_0x2d48a2];return _0x2ba1cb;};'use strict';var _=require(_0x4b0d('0x0'));var util=require(_0x4b0d('0x1'));var jayson=require('jayson/promise');var schema=require(_0x4b0d('0x2'));var BPromise=require(_0x4b0d('0x3'));var moment=require(_0x4b0d('0x4'));var config=require(_0x4b0d('0x5'));var properties=require(_0x4b0d('0x6'));var ami=require(_0x4b0d('0x7'));exports['listen']=function(_0xd9e767,_0x49eb9f,_0x49ab42){return new BPromise(function(_0x57186c,_0x368fb5){var _0x10977e={'QueuePause':function(_0x15a0ea){return new Promise(function(_0x4efef1,_0xbc67f7){var _0x6ba00=util[_0x4b0d('0x8')]('%s/%s','SIP',_0x15a0ea[_0x4b0d('0x9')]);if(_0xd9e767[_0x4b0d('0xa')]&&_0xd9e767[_0x4b0d('0xa')][_0x6ba00]&&_0xd9e767[_0x4b0d('0xa')][_0x6ba00][_0x4b0d('0xb')]){_0xd9e767[_0x4b0d('0xa')][_0x6ba00][_0x4b0d('0xc')]();}if(_0xd9e767[_0x4b0d('0xd')][_0x6ba00]){_0xd9e767[_0x4b0d('0xd')][_0x6ba00][_0x4b0d('0xe')]({'statePause':_0x15a0ea[_0x4b0d('0xf')]?!![]:![]});}_0x4efef1({'code':0xc8,'message':_0x4b0d('0x10')});});},'Reload':function(_0x4314c0){var _0x31044c=this;return new Promise(function(_0xf60338,_0x355595){if(ami[_0x4b0d('0x11')]()==![]){return _0x355595(_0x31044c['error'](0x1f4,[config[_0x4b0d('0x12')]['ip'],config[_0x4b0d('0x12')]['username'],_0x4b0d('0x13')][_0x4b0d('0x14')]('\x20')));}_0x4314c0=_['pick'](_0x4314c0,_[_0x4b0d('0x15')](properties[_0x4b0d('0x16')]));_0x4314c0[_0x4b0d('0x17')]=_0x4b0d('0x18');return ami[_0x4b0d('0x19')](_0x4314c0)[_0x4b0d('0x1a')](function(_0x293238){_0xf60338({'code':0xc8,'message':_0x293238[_0x4b0d('0x1b')]});})['catch'](function(_0x48deff){_0x355595(_0x31044c[_0x4b0d('0x1c')](0x1f5,_0x48deff[_0x4b0d('0x1b')]));});});},'Command':function(_0x370811){var _0xd35d20=this;return new Promise(function(_0x58d803,_0x4e5ae8){if(ami[_0x4b0d('0x11')]()==![]){return _0x4e5ae8(_0xd35d20[_0x4b0d('0x1c')](0x1f4,[config[_0x4b0d('0x12')]['ip'],config[_0x4b0d('0x12')][_0x4b0d('0x1d')],_0x4b0d('0x13')]['join']('\x20')));}_0x370811=_[_0x4b0d('0x1e')](_0x370811,_0x4b0d('0x1f'));_0x370811['action']=_0x4b0d('0x20');return ami[_0x4b0d('0x19')](_0x370811)[_0x4b0d('0x1a')](function(_0x2513d4){_0x58d803({'code':0xc8,'message':_0x2513d4['content']});})[_0x4b0d('0x21')](function(_0x5f18c6){_0x4e5ae8(_0xd35d20[_0x4b0d('0x1c')](0x1f5,_0x5f18c6[_0x4b0d('0x1b')]));});});},'VoiceQueues':function(_0x100b6d){return new Promise(function(_0x9bc6b0,_0x2d9a08){var _0x9a9415=[];for(var _0x4ebaf2 in _0xd9e767[_0x4b0d('0x22')]){if(_0xd9e767[_0x4b0d('0x22')][_0x4b0d('0x23')](_0x4ebaf2)){var _0xe4059d=_0xd9e767[_0x4b0d('0x22')][_0x4ebaf2];var _0x2b8b66={'id':_0xe4059d['id'],'name':_0xe4059d['name'],'strategy':_0xe4059d[_0x4b0d('0x24')],'answered':_0xe4059d[_0x4b0d('0x25')],'available':_0xe4059d[_0x4b0d('0x26')],'loggedIn':_0xe4059d[_0x4b0d('0x27')],'pTalking':_0xe4059d[_0x4b0d('0x28')],'sumBillable':_0xe4059d['sumBillable'],'sumDuration':_0xe4059d['sumDuration'],'sumHoldTime':_0xe4059d[_0x4b0d('0x29')]||0x0,'talking':_0xe4059d[_0x4b0d('0x2a')],'total':_0xe4059d['total'],'type':_0xe4059d['type'],'unmanaged':_0xe4059d[_0x4b0d('0x2b')],'abandoned':_0xe4059d[_0x4b0d('0x2c')],'waiting':_0xe4059d[_0x4b0d('0x2d')],'loggedInDb':_0xe4059d['loggedInDb']};if(_0xe4059d[_0x4b0d('0x2e')]==='outbound'){_0x2b8b66[_0x4b0d('0x2f')]=_0xe4059d[_0x4b0d('0x2f')];_0x2b8b66[_0x4b0d('0x30')]=_0xe4059d['dialMethod'];_0x2b8b66[_0x4b0d('0x31')]=_0xe4059d['dialOriginateCallerIdName'];_0x2b8b66[_0x4b0d('0x32')]=_0xe4059d[_0x4b0d('0x32')];_0x2b8b66[_0x4b0d('0x33')]=_0xe4059d[_0x4b0d('0x33')];_0x2b8b66[_0x4b0d('0x34')]=_0xe4059d[_0x4b0d('0x34')];_0x2b8b66[_0x4b0d('0x35')]=_0xe4059d[_0x4b0d('0x35')];_0x2b8b66[_0x4b0d('0x36')]=_0xe4059d[_0x4b0d('0x36')];_0x2b8b66[_0x4b0d('0x37')]=_0xe4059d[_0x4b0d('0x37')];_0x2b8b66[_0x4b0d('0x38')]=_0xe4059d['outboundBusyCallsDay'];_0x2b8b66['outboundCongestionCallsDay']=_0xe4059d[_0x4b0d('0x39')];_0x2b8b66[_0x4b0d('0x3a')]=_0xe4059d['outboundDropCallsDayACS'];_0x2b8b66[_0x4b0d('0x3b')]=_0xe4059d['outboundDropCallsDayCallersExit'];_0x2b8b66['outboundDropCallsDayTimeout']=_0xe4059d[_0x4b0d('0x3c')];_0x2b8b66[_0x4b0d('0x3d')]=_0xe4059d[_0x4b0d('0x3d')];_0x2b8b66[_0x4b0d('0x3e')]=_0xe4059d[_0x4b0d('0x3e')];_0x2b8b66[_0x4b0d('0x3f')]=_0xe4059d[_0x4b0d('0x3f')];_0x2b8b66[_0x4b0d('0x40')]=_0xe4059d[_0x4b0d('0x40')];_0x2b8b66[_0x4b0d('0x41')]=_0xe4059d['outboundRejectCallsDay'];_0x2b8b66['outboundUnknownCallsDay']=_0xe4059d[_0x4b0d('0x42')];_0x2b8b66['predictiveIntervalAnsweredCalls']=_0xe4059d[_0x4b0d('0x43')];_0x2b8b66['predictiveIntervalAvgHoldtime']=_0xe4059d[_0x4b0d('0x44')];_0x2b8b66[_0x4b0d('0x45')]=_0xe4059d[_0x4b0d('0x45')];_0x2b8b66[_0x4b0d('0x46')]=_0xe4059d['predictiveIntervalDroppedCallsCallersExit'];_0x2b8b66['predictiveIntervalDroppedCallsTimeout']=_0xe4059d[_0x4b0d('0x47')];_0x2b8b66[_0x4b0d('0x48')]=_0xe4059d[_0x4b0d('0x48')];_0x2b8b66[_0x4b0d('0x49')]=_0xe4059d['predictiveIntervalErlangCallsDroppedCalls'];_0x2b8b66[_0x4b0d('0x4a')]=_0xe4059d[_0x4b0d('0x4a')];_0x2b8b66[_0x4b0d('0x4b')]=_0xe4059d[_0x4b0d('0x4b')];_0x2b8b66[_0x4b0d('0x4c')]=_0xe4059d[_0x4b0d('0x4c')];_0x2b8b66[_0x4b0d('0x4d')]=_0xe4059d[_0x4b0d('0x4d')];_0x2b8b66['predictiveIntervalTotalCalls']=_0xe4059d[_0x4b0d('0x4e')];_0x2b8b66[_0x4b0d('0x1b')]=_0xe4059d[_0x4b0d('0x1b')];_0x2b8b66[_0x4b0d('0x4f')]=_0xe4059d[_0x4b0d('0x4f')];_0x2b8b66[_0x4b0d('0x50')]=_0xe4059d[_0x4b0d('0x50')];_0x2b8b66[_0x4b0d('0x51')]=_0xe4059d[_0x4b0d('0x51')];_0x2b8b66[_0x4b0d('0x52')]=_0xe4059d[_0x4b0d('0x52')];_0x2b8b66[_0x4b0d('0x53')]=_0xe4059d[_0x4b0d('0x53')];_0x2b8b66[_0x4b0d('0x54')]=_0xe4059d['startPredictive'];_0x2b8b66['startProgressive']=_0xe4059d['startProgressive'];}if(_0xe4059d['Trunk']){_0x2b8b66[_0x4b0d('0x55')]={'id':_0xe4059d['Trunk']['id'],'name':_0xe4059d[_0x4b0d('0x55')][_0x4b0d('0x9')],'active':_0xe4059d[_0x4b0d('0x55')][_0x4b0d('0x56')],'callerid':_0xe4059d[_0x4b0d('0x55')][_0x4b0d('0x57')]};}if(_0xe4059d[_0x4b0d('0x58')]){_0x2b8b66[_0x4b0d('0x58')]={'id':_0xe4059d['Interval']['id'],'name':_0xe4059d[_0x4b0d('0x58')][_0x4b0d('0x9')]};}_0x9a9415[_0x4b0d('0x59')](_0x2b8b66);}}_0x9bc6b0({'count':_0x9a9415['length'],'rows':_0x9a9415});});},'VoiceChannels':function(_0x186b7e){return new Promise(function(_0x2e71b9,_0x50f422){var _0x2b8e15=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x5b')]);_0x2e71b9({'count':_0x2b8e15[_0x4b0d('0x5c')],'rows':_0x2b8e15});});},'VoiceChannelMixMonitor':function(_0x6f4ab4){var _0x46cec1=this;return new Promise(function(_0x53e4c1,_0x353e98){if(ami['isConnected']()==![]){return _0x353e98(_0x46cec1['error'](0x1f4,[config['asterisk']['ip'],config[_0x4b0d('0x12')][_0x4b0d('0x1d')],'ami\x20disconnected'][_0x4b0d('0x14')]('\x20')));}var _0x424870=schema(properties['voicechannel'])['validate'](_0x6f4ab4);if(_0x424870[_0x4b0d('0x5c')]>0x0){return _0x353e98(_0x46cec1['error'](0x1f4,_[_0x4b0d('0x5d')](_0x424870,_0x4b0d('0x1b'))[_0x4b0d('0x14')](',\x20')));}var _0x2be2bb=_[_0x4b0d('0x5e')](_0xd9e767[_0x4b0d('0x5b')],{'uniqueid':_0x6f4ab4[_0x4b0d('0x5f')]});if(_0x2be2bb&&_0x2be2bb[_0x4b0d('0x60')]){var _0x437f3d=util[_0x4b0d('0x8')](_0x4b0d('0x61'),_0x6f4ab4[_0x4b0d('0x62')]||_0x6f4ab4[_0x4b0d('0x5f')],_0x6f4ab4[_0x4b0d('0x8')]||_0x4b0d('0x63'));return ami[_0x4b0d('0x19')]({'action':_0x4b0d('0x64'),'channel':_0x2be2bb[_0x4b0d('0x60')],'file':_0x437f3d,'options':_0x4b0d('0x65')})[_0x4b0d('0x1a')](function(_0x170fc5){var _0x5d24d0=_[_0x4b0d('0x5e')](_0x2be2bb[_0x4b0d('0x66')],{'filename':_0x4b0d('0x67')+_0x437f3d[_0x4b0d('0x68')]()});if(_[_0x4b0d('0x69')](_0x5d24d0)){_0x2be2bb[_0x4b0d('0x66')][_0x4b0d('0x59')]({'filename':'/var/spool/asterisk/monitor/'+_0x437f3d[_0x4b0d('0x68')](),'createdAt':moment()[_0x4b0d('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x170fc5[_0x4b0d('0x6a')],'status':_0x4b0d('0x6b')});}else{_0x5d24d0[_0x4b0d('0x6a')]=_0x170fc5['mixmonitorid'];_0x5d24d0[_0x4b0d('0x6c')]=_0x4b0d('0x6b');}_0x53e4c1({'code':0xc8,'message':[_0x6f4ab4['uniqueid'],'MixMonitor\x20Success',_0x170fc5['mixmonitorid']][_0x4b0d('0x14')]('\x20'),'mixmonitorid':_0x170fc5[_0x4b0d('0x6a')]});})[_0x4b0d('0x21')](function(_0x405718){_0x353e98(_0x46cec1['error'](0x1f5,[_0x6f4ab4[_0x4b0d('0x5f')],_0x405718['message'][_0x4b0d('0x68')]()][_0x4b0d('0x14')]('\x20')));});}else{return _0x353e98(_0x46cec1[_0x4b0d('0x1c')](0x1f5,_0x4b0d('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x189ccb){var _0x3d9b43=this;return new Promise(function(_0x5a6301,_0x308afe){if(ami[_0x4b0d('0x11')]()==![]){return _0x308afe(_0x3d9b43[_0x4b0d('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0x4b0d('0x12')][_0x4b0d('0x1d')],'ami\x20disconnected']['join']('\x20')));}var _0x451213=schema(properties[_0x4b0d('0x6e')])[_0x4b0d('0x2')](_0x189ccb);if(_0x451213[_0x4b0d('0x5c')]>0x0){return _0x308afe(_0x3d9b43[_0x4b0d('0x1c')](0x1f4,_[_0x4b0d('0x5d')](_0x451213,_0x4b0d('0x1b'))[_0x4b0d('0x14')](',\x20')));}var _0x3af08a=_['find'](_0xd9e767['channels'],{'uniqueid':_0x189ccb[_0x4b0d('0x5f')]});if(_0x3af08a){return BPromise['resolve']()['then'](function(){if(_0x3af08a[_0x4b0d('0x60')]){return ami[_0x4b0d('0x19')]({'action':_0x4b0d('0x6f'),'channel':_0x3af08a[_0x4b0d('0x60')],'mixmonitorid':_0x189ccb['mixmonitorid']})[_0x4b0d('0x21')](function(_0x3037e8){});}})[_0x4b0d('0x1a')](function(){if(_0x3af08a[_0x4b0d('0x70')]){return ami[_0x4b0d('0x19')]({'action':_0x4b0d('0x6f'),'channel':_0x3af08a[_0x4b0d('0x70')],'mixmonitorid':_0x189ccb[_0x4b0d('0x6a')]})[_0x4b0d('0x21')](function(_0x19bf35){});}})['then'](function(_0x56d501){var _0x1ece7d=_[_0x4b0d('0x5e')](_0x3af08a[_0x4b0d('0x66')],{'mixmonitorid':_0x189ccb['mixmonitorid']});if(_0x1ece7d){_0x1ece7d[_0x4b0d('0x6c')]=_0x4b0d('0x71');}})[_0x4b0d('0x1a')](function(){var _0x5e00f5=util[_0x4b0d('0x8')](_0x4b0d('0x61'),_0x189ccb['filename']||_0x189ccb['uniqueid'],_0x189ccb[_0x4b0d('0x8')]||_0x4b0d('0x63'));var _0x464172=_[_0x4b0d('0x5e')](_0x3af08a[_0x4b0d('0x66')],{'filename':_0x4b0d('0x67')+_0x5e00f5[_0x4b0d('0x68')]()});if(_0x464172){_0x464172[_0x4b0d('0x6c')]='stop';}})[_0x4b0d('0x1a')](function(){_0x5a6301({'code':0xc8,'message':[_0x189ccb['uniqueid'],_0x4b0d('0x72')][_0x4b0d('0x14')]('\x20')});})[_0x4b0d('0x21')](function(_0x4c2901){_0x308afe(_0x3d9b43[_0x4b0d('0x1c')](0x1f5,[_0x189ccb[_0x4b0d('0x5f')],_0x4c2901[_0x4b0d('0x1b')][_0x4b0d('0x68')]()]['join']('\x20')));});}else{return _0x308afe(_0x3d9b43[_0x4b0d('0x1c')](0x1f5,_0x4b0d('0x6d')));}});},'VoiceQueuesChannels':function(_0x318cca){return new Promise(function(_0xc1a052,_0x4f18c2){var _0x5e31c8=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x73')]);_0xc1a052({'count':_0x5e31c8[_0x4b0d('0x5c')],'rows':_0x5e31c8});});},'VoiceQueuesChannel':function(_0x2916a8){var _0x317886=this;return new Promise(function(_0x4917fd,_0x58c9a6){var _0x3e7615=schema(properties['voicequeuechannel'])['validate'](_0x2916a8);if(_0x3e7615[_0x4b0d('0x5c')]>0x0){return _0x58c9a6(_0x317886['error'](0x1f4,_[_0x4b0d('0x5d')](_0x3e7615,_0x4b0d('0x1b'))['join'](',\x20')));}var _0x4be489=_['find'](_0xd9e767[_0x4b0d('0x73')],{'uniqueid':_0x2916a8[_0x4b0d('0x5f')]});if(_0x4be489){_0x4917fd(_0x4be489);}else{return _0x58c9a6(_0x317886['error'](0x1f5,_0x4b0d('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0xf795b1){var _0x4ec1a2=this;return new Promise(function(_0x29f562,_0x5c142e){if(ami[_0x4b0d('0x11')]()==![]){return _0x5c142e(_0x4ec1a2[_0x4b0d('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0x4b0d('0x12')][_0x4b0d('0x1d')],_0x4b0d('0x13')][_0x4b0d('0x14')]('\x20')));}var _0x515d6b=schema(properties['voicequeuechannelhangup'])['validate'](_0xf795b1);if(_0x515d6b[_0x4b0d('0x5c')]>0x0){return _0x5c142e(_0x4ec1a2[_0x4b0d('0x1c')](0x1f4,_[_0x4b0d('0x5d')](_0x515d6b,'message')[_0x4b0d('0x14')](',\x20')));}var _0x15c58d=_[_0x4b0d('0x5e')](_0xd9e767[_0x4b0d('0x73')],{'uniqueid':_0xf795b1[_0x4b0d('0x5f')]});if(_0x15c58d&&_0x15c58d[_0x4b0d('0x60')]){return ami[_0x4b0d('0x19')]({'action':'Hangup','channel':_0x15c58d['channel']})['then'](function(_0x4a271c){_0x29f562({'code':0xc8,'message':[_0xf795b1['uniqueid'],_0x4a271c['message'][_0x4b0d('0x68')]()][_0x4b0d('0x14')]('\x20')});})[_0x4b0d('0x21')](function(_0x3affe3){_0x5c142e(_0x4ec1a2[_0x4b0d('0x1c')](0x1f5,[_0xf795b1[_0x4b0d('0x5f')],_0x3affe3[_0x4b0d('0x1b')][_0x4b0d('0x68')]()][_0x4b0d('0x14')]('\x20')));});}else{return _0x5c142e(_0x4ec1a2[_0x4b0d('0x1c')](0x1f5,_0x4b0d('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x2c18f6){var _0x7fc769=this;return new Promise(function(_0x5689dc,_0x39a6e8){if(ami['isConnected']()==![]){return _0x39a6e8(_0x7fc769[_0x4b0d('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0x4b0d('0x12')][_0x4b0d('0x1d')],_0x4b0d('0x13')][_0x4b0d('0x14')]('\x20')));}var _0x3c6d29=schema(properties[_0x4b0d('0x74')])[_0x4b0d('0x2')](_0x2c18f6);if(_0x3c6d29[_0x4b0d('0x5c')]>0x0){return _0x39a6e8(_0x7fc769[_0x4b0d('0x1c')](0x1f4,_[_0x4b0d('0x5d')](_0x3c6d29,_0x4b0d('0x1b'))[_0x4b0d('0x14')](',\x20')));}var _0x5f53b4=_[_0x4b0d('0x5e')](_0xd9e767['queueChannels'],{'uniqueid':_0x2c18f6[_0x4b0d('0x5f')]});if(_0x5f53b4&&_0x5f53b4[_0x4b0d('0x60')]){return ami[_0x4b0d('0x19')]({'action':_0x4b0d('0x75'),'channel':_0x5f53b4[_0x4b0d('0x60')],'exten':_0x2c18f6[_0x4b0d('0x76')],'context':_0x2c18f6[_0x4b0d('0x77')]||_0x5f53b4[_0x4b0d('0x77')],'priority':0x1})[_0x4b0d('0x1a')](function(_0x26d11e){_0x5689dc({'code':0xc8,'message':[_0x2c18f6[_0x4b0d('0x5f')],_0x26d11e[_0x4b0d('0x1b')]['toLowerCase']()][_0x4b0d('0x14')]('\x20')});})['catch'](function(_0x25032e){_0x39a6e8(_0x7fc769[_0x4b0d('0x1c')](0x1f5,[_0x2c18f6[_0x4b0d('0x5f')],_0x25032e['message'][_0x4b0d('0x68')]()][_0x4b0d('0x14')]('\x20')));});}else{return _0x39a6e8(_0x7fc769[_0x4b0d('0x1c')](0x1f5,_0x4b0d('0x6d')));}});},'Agents':function(_0x14d9fa){return new Promise(function(_0x1a7307,_0x55a516){var _0x8ad47d=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0xd')]);_0x1a7307({'count':_0x8ad47d[_0x4b0d('0x5c')],'rows':_0x8ad47d});});},'Telephones':function(_0x18651f){return new Promise(function(_0x4f16b0,_0x45b14e){var _0x5dcd58=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x78')]);_0x4f16b0({'count':_0x5dcd58['length'],'rows':_0x5dcd58});});},'Trunks':function(_0x50bc6a){return new Promise(function(_0x1fcf5d,_0xab49e0){var _0x183fdd=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x79')]);_0x1fcf5d({'count':_0x183fdd['length'],'rows':_0x183fdd});});},'OutboundChannels':function(_0x3407e8){return new Promise(function(_0x50f76a,_0x5d9be3){var _0x2d3a45=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x7a')]);_0x50f76a({'count':_0x2d3a45[_0x4b0d('0x5c')],'rows':_0x2d3a45});});},'Outbound':function(_0x59eca3){return new Promise(function(_0x43f333,_0x1f1882){_0x43f333(_0xd9e767[_0x4b0d('0x7b')]);});},'Campaigns':function(_0x27ccc4){return new Promise(function(_0x64debc,_0x32a806){var _0x5a5ef0=_[_0x4b0d('0x5a')](_0xd9e767[_0x4b0d('0x7c')]);_0x64debc({'count':_0x5a5ef0[_0x4b0d('0x5c')],'rows':_0x5a5ef0});});},'VoiceQueuesPreview':function(_0x58d2bf){var _0x3173f6=this;return new Promise(function(_0x4d0b47,_0x33b520){_0x49eb9f[_0x4b0d('0x7d')](_0x58d2bf['id'])[_0x4b0d('0x1a')](function(_0x4069fe){_0x4d0b47({'code':0xc8,'message':_0x4069fe[_0x4b0d('0x1b')]});})[_0x4b0d('0x21')](function(_0x1eb660){_0x33b520(_0x3173f6[_0x4b0d('0x1c')](0x1f4,_0x1eb660[_0x4b0d('0x1b')]));});});},'EventManager':function(_0x5d89e4){var _0x7adb0e=this;return new Promise(function(_0x34d76f,_0x1310d9){if(!_0x5d89e4['event']){return _0x1310d9(_0x7adb0e[_0x4b0d('0x1c')](0x1f4,_0x4b0d('0x7e')));}ami[_0x4b0d('0x7f')]('custom:'+_0x5d89e4[_0x4b0d('0x80')],_0x5d89e4['message']);_0x34d76f({'code':0xc8,'message':_0x5d89e4});});},'FaxAccounts':function(_0x5484a6){return new Promise(function(_0x8d98c4,_0x4456fb){var _0x2b45c6=_[_0x4b0d('0x5a')](_0xd9e767['faxAccounts']);_0x8d98c4({'count':_0x2b45c6[_0x4b0d('0x5c')],'rows':_0x2b45c6});});},'SendFax':function(_0x57a8a5){var _0x5a7711=this;return new Promise(function(_0x4478fc,_0x3ab5f0){_0x49ab42['send'](_0x57a8a5)[_0x4b0d('0x1a')](function(_0x2a0051){_0x4478fc({'code':0xc8,'message':_0x2a0051[_0x4b0d('0x1b')]});})[_0x4b0d('0x21')](function(_0x4b5494){_0x3ab5f0(_0x5a7711['error'](0x1f4,_0x4b5494[_0x4b0d('0x1b')]));});});},'CheckAfterSend':function(_0x185624){var _0x3af5d9=this;return new Promise(function(_0x3396f8,_0xb8614e){_0x49ab42[_0x4b0d('0x81')](_0x185624)[_0x4b0d('0x1a')](function(_0x5add17){_0x3396f8({'code':0xc8,'message':_0x5add17['message']});})[_0x4b0d('0x21')](function(_0x1285c6){_0xb8614e(_0x3af5d9['error'](0x1f4,_0x1285c6[_0x4b0d('0x1b')]));});});}};var _0x314f36=jayson[_0x4b0d('0x82')](_0x10977e)[_0x4b0d('0x83')]();_0x314f36['on'](_0x4b0d('0x1c'),function(_0xda7a28){return _0x368fb5(_0xda7a28);});_0x314f36[_0x4b0d('0x84')](0x232a,_0x4b0d('0x85'),function(){console[_0x4b0d('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x57186c(_0x4b0d('0x87')+0x232a);});});}; \ No newline at end of file +var _0x51b8=['../ami','listen','format','%s/%s','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','action','then','catch','message','command','Command','content','voiceQueues','hasOwnProperty','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','find','uniqueid','channel','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','map','resolve','Action','StopMixMonitor','destinationchannel','stop','%s.%s','filename','status','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','validate','bluebird','moment','../../../config/environment','../properties'];(function(_0x4dc20f,_0x44850a){var _0x1a292a=function(_0x5f479c){while(--_0x5f479c){_0x4dc20f['push'](_0x4dc20f['shift']());}};_0x1a292a(++_0x44850a);}(_0x51b8,0x118));var _0x851b=function(_0x3b6ac7,_0x58da01){_0x3b6ac7=_0x3b6ac7-0x0;var _0x3da755=_0x51b8[_0x3b6ac7];return _0x3da755;};'use strict';var _=require('lodash');var util=require(_0x851b('0x0'));var jayson=require('jayson/promise');var schema=require(_0x851b('0x1'));var BPromise=require(_0x851b('0x2'));var moment=require(_0x851b('0x3'));var config=require(_0x851b('0x4'));var properties=require(_0x851b('0x5'));var ami=require(_0x851b('0x6'));exports[_0x851b('0x7')]=function(_0x2d5d7c,_0x2eefe7,_0x5e3ab8){return new BPromise(function(_0x3dc303,_0x16e3e5){var _0x40e5da={'QueuePause':function(_0x3a735d){return new Promise(function(_0x12d98d,_0x5346d6){var _0x224578=util[_0x851b('0x8')](_0x851b('0x9'),'SIP',_0x3a735d['name']);if(_0x2d5d7c['timers']&&_0x2d5d7c[_0x851b('0xa')][_0x224578]&&_0x2d5d7c[_0x851b('0xa')][_0x224578][_0x851b('0xb')]){_0x2d5d7c['timers'][_0x224578][_0x851b('0xc')]();}if(_0x2d5d7c[_0x851b('0xd')][_0x224578]){_0x2d5d7c[_0x851b('0xd')][_0x224578][_0x851b('0xe')]({'statePause':_0x3a735d[_0x851b('0xf')]?!![]:![]});}_0x12d98d({'code':0xc8,'message':_0x851b('0x10')});});},'Reload':function(_0x10c1b1){var _0x13b311=this;return new Promise(function(_0x568824,_0x4032c1){if(ami[_0x851b('0x11')]()==![]){return _0x4032c1(_0x13b311[_0x851b('0x12')](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')][_0x851b('0x14')],_0x851b('0x15')][_0x851b('0x16')]('\x20')));}_0x10c1b1=_[_0x851b('0x17')](_0x10c1b1,_['keys'](properties[_0x851b('0x18')]));_0x10c1b1[_0x851b('0x19')]='Reload';return ami['Action'](_0x10c1b1)[_0x851b('0x1a')](function(_0x20f248){_0x568824({'code':0xc8,'message':_0x20f248['message']});})[_0x851b('0x1b')](function(_0x475084){_0x4032c1(_0x13b311['error'](0x1f5,_0x475084[_0x851b('0x1c')]));});});},'Command':function(_0x117d71){var _0x4bd7b8=this;return new Promise(function(_0x42ad58,_0x452481){if(ami[_0x851b('0x11')]()==![]){return _0x452481(_0x4bd7b8['error'](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')][_0x851b('0x14')],_0x851b('0x15')]['join']('\x20')));}_0x117d71=_[_0x851b('0x17')](_0x117d71,_0x851b('0x1d'));_0x117d71[_0x851b('0x19')]=_0x851b('0x1e');return ami['Action'](_0x117d71)[_0x851b('0x1a')](function(_0x3084ad){_0x42ad58({'code':0xc8,'message':_0x3084ad[_0x851b('0x1f')]});})['catch'](function(_0x2bdf47){_0x452481(_0x4bd7b8[_0x851b('0x12')](0x1f5,_0x2bdf47[_0x851b('0x1c')]));});});},'VoiceQueues':function(_0x432f03){return new Promise(function(_0x34dedd,_0x17df96){var _0x472251=[];for(var _0x109972 in _0x2d5d7c[_0x851b('0x20')]){if(_0x2d5d7c[_0x851b('0x20')][_0x851b('0x21')](_0x109972)){var _0x1f506d=_0x2d5d7c[_0x851b('0x20')][_0x109972];var _0x4f68dd={'id':_0x1f506d['id'],'name':_0x1f506d[_0x851b('0x22')],'strategy':_0x1f506d[_0x851b('0x23')],'answered':_0x1f506d[_0x851b('0x24')],'available':_0x1f506d['available'],'loggedIn':_0x1f506d[_0x851b('0x25')],'pTalking':_0x1f506d[_0x851b('0x26')],'sumBillable':_0x1f506d[_0x851b('0x27')],'sumDuration':_0x1f506d[_0x851b('0x28')],'sumHoldTime':_0x1f506d[_0x851b('0x29')]||0x0,'talking':_0x1f506d[_0x851b('0x2a')],'total':_0x1f506d['total'],'type':_0x1f506d[_0x851b('0x2b')],'unmanaged':_0x1f506d[_0x851b('0x2c')],'abandoned':_0x1f506d[_0x851b('0x2d')],'waiting':_0x1f506d[_0x851b('0x2e')],'loggedInDb':_0x1f506d[_0x851b('0x2f')]};if(_0x1f506d[_0x851b('0x2b')]===_0x851b('0x30')){_0x4f68dd[_0x851b('0x31')]=_0x1f506d['dialActive'];_0x4f68dd['dialMethod']=_0x1f506d[_0x851b('0x32')];_0x4f68dd[_0x851b('0x33')]=_0x1f506d['dialOriginateCallerIdName'];_0x4f68dd[_0x851b('0x34')]=_0x1f506d[_0x851b('0x34')];_0x4f68dd[_0x851b('0x35')]=_0x1f506d[_0x851b('0x35')];_0x4f68dd[_0x851b('0x36')]=_0x1f506d[_0x851b('0x36')];_0x4f68dd[_0x851b('0x37')]=_0x1f506d[_0x851b('0x37')];_0x4f68dd[_0x851b('0x38')]=_0x1f506d[_0x851b('0x38')];_0x4f68dd[_0x851b('0x39')]=_0x1f506d[_0x851b('0x39')];_0x4f68dd[_0x851b('0x3a')]=_0x1f506d[_0x851b('0x3a')];_0x4f68dd[_0x851b('0x3b')]=_0x1f506d[_0x851b('0x3b')];_0x4f68dd[_0x851b('0x3c')]=_0x1f506d[_0x851b('0x3c')];_0x4f68dd['outboundDropCallsDayCallersExit']=_0x1f506d[_0x851b('0x3d')];_0x4f68dd[_0x851b('0x3e')]=_0x1f506d[_0x851b('0x3e')];_0x4f68dd[_0x851b('0x3f')]=_0x1f506d['outboundNoAnswerCallsDay'];_0x4f68dd['outboundNoSuchCallsDay']=_0x1f506d[_0x851b('0x40')];_0x4f68dd['outboundOriginateFailureCallsDay']=_0x1f506d[_0x851b('0x41')];_0x4f68dd[_0x851b('0x42')]=_0x1f506d[_0x851b('0x42')];_0x4f68dd[_0x851b('0x43')]=_0x1f506d['outboundRejectCallsDay'];_0x4f68dd[_0x851b('0x44')]=_0x1f506d[_0x851b('0x44')];_0x4f68dd[_0x851b('0x45')]=_0x1f506d[_0x851b('0x45')];_0x4f68dd[_0x851b('0x46')]=_0x1f506d[_0x851b('0x46')];_0x4f68dd[_0x851b('0x47')]=_0x1f506d[_0x851b('0x47')];_0x4f68dd[_0x851b('0x48')]=_0x1f506d[_0x851b('0x48')];_0x4f68dd['predictiveIntervalDroppedCallsTimeout']=_0x1f506d[_0x851b('0x49')];_0x4f68dd[_0x851b('0x4a')]=_0x1f506d[_0x851b('0x4a')];_0x4f68dd[_0x851b('0x4b')]=_0x1f506d[_0x851b('0x4b')];_0x4f68dd[_0x851b('0x4c')]=_0x1f506d[_0x851b('0x4c')];_0x4f68dd[_0x851b('0x4d')]=_0x1f506d[_0x851b('0x4d')];_0x4f68dd['predictiveIntervalPauses']=_0x1f506d['predictiveIntervalPauses'];_0x4f68dd[_0x851b('0x4e')]=_0x1f506d[_0x851b('0x4e')];_0x4f68dd[_0x851b('0x4f')]=_0x1f506d['predictiveIntervalTotalCalls'];_0x4f68dd[_0x851b('0x1c')]=_0x1f506d['message'];_0x4f68dd[_0x851b('0x50')]=_0x1f506d[_0x851b('0x50')];_0x4f68dd[_0x851b('0x51')]=_0x1f506d[_0x851b('0x51')];_0x4f68dd[_0x851b('0x52')]=_0x1f506d[_0x851b('0x52')];_0x4f68dd[_0x851b('0x53')]=_0x1f506d[_0x851b('0x53')];_0x4f68dd[_0x851b('0x54')]=_0x1f506d[_0x851b('0x54')];_0x4f68dd[_0x851b('0x55')]=_0x1f506d[_0x851b('0x55')];_0x4f68dd['startProgressive']=_0x1f506d[_0x851b('0x56')];}if(_0x1f506d[_0x851b('0x57')]){_0x4f68dd[_0x851b('0x57')]={'id':_0x1f506d[_0x851b('0x57')]['id'],'name':_0x1f506d['Trunk'][_0x851b('0x22')],'active':_0x1f506d['Trunk'][_0x851b('0x58')],'callerid':_0x1f506d[_0x851b('0x57')][_0x851b('0x59')]};}if(_0x1f506d[_0x851b('0x5a')]){_0x4f68dd[_0x851b('0x5a')]={'id':_0x1f506d[_0x851b('0x5a')]['id'],'name':_0x1f506d[_0x851b('0x5a')][_0x851b('0x22')]};}_0x472251[_0x851b('0x5b')](_0x4f68dd);}}_0x34dedd({'count':_0x472251[_0x851b('0x5c')],'rows':_0x472251});});},'VoiceChannels':function(_0x258fee){return new Promise(function(_0x121c1b,_0x4380a7){var _0x2b4799=_[_0x851b('0x5d')](_0x2d5d7c[_0x851b('0x5e')]);_0x121c1b({'count':_0x2b4799[_0x851b('0x5c')],'rows':_0x2b4799});});},'VoiceChannelMixMonitor':function(_0x2b355a){var _0x30ba9c=this;return new Promise(function(_0x27c139,_0x24a5ca){if(ami[_0x851b('0x11')]()==![]){return _0x24a5ca(_0x30ba9c[_0x851b('0x12')](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')][_0x851b('0x14')],_0x851b('0x15')]['join']('\x20')));}var _0x7f5644=schema(properties[_0x851b('0x5f')])[_0x851b('0x1')](_0x2b355a);if(_0x7f5644[_0x851b('0x5c')]>0x0){return _0x24a5ca(_0x30ba9c['error'](0x1f4,_['map'](_0x7f5644,'message')[_0x851b('0x16')](',\x20')));}var _0x1cfaba=_[_0x851b('0x60')](_0x2d5d7c[_0x851b('0x5e')],{'uniqueid':_0x2b355a[_0x851b('0x61')]});if(_0x1cfaba&&_0x1cfaba[_0x851b('0x62')]){var _0x1e2fc1=util[_0x851b('0x8')]('%s.%s',_0x2b355a['filename']||_0x2b355a[_0x851b('0x61')],_0x2b355a[_0x851b('0x8')]||_0x851b('0x63'));return ami['Action']({'action':_0x851b('0x64'),'channel':_0x1cfaba[_0x851b('0x62')],'file':_0x1e2fc1,'options':_0x851b('0x65')})[_0x851b('0x1a')](function(_0x5a3302){var _0x34959c=_[_0x851b('0x60')](_0x1cfaba[_0x851b('0x66')],{'filename':_0x851b('0x67')+_0x1e2fc1[_0x851b('0x68')]()});if(_[_0x851b('0x69')](_0x34959c)){_0x1cfaba['monitors'][_0x851b('0x5b')]({'filename':_0x851b('0x67')+_0x1e2fc1['toLowerCase'](),'createdAt':moment()[_0x851b('0x8')](_0x851b('0x6a')),'mixmonitorid':_0x5a3302['mixmonitorid'],'status':'rec'});}else{_0x34959c['mixmonitorid']=_0x5a3302[_0x851b('0x6b')];_0x34959c['status']=_0x851b('0x6c');}_0x27c139({'code':0xc8,'message':[_0x2b355a[_0x851b('0x61')],_0x851b('0x6d'),_0x5a3302[_0x851b('0x6b')]][_0x851b('0x16')]('\x20'),'mixmonitorid':_0x5a3302[_0x851b('0x6b')]});})[_0x851b('0x1b')](function(_0x380262){_0x24a5ca(_0x30ba9c[_0x851b('0x12')](0x1f5,[_0x2b355a[_0x851b('0x61')],_0x380262[_0x851b('0x1c')][_0x851b('0x68')]()][_0x851b('0x16')]('\x20')));});}else{return _0x24a5ca(_0x30ba9c[_0x851b('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x3d5661){var _0x36673d=this;return new Promise(function(_0xfdf721,_0x3e903e){if(ami[_0x851b('0x11')]()==![]){return _0x3e903e(_0x36673d[_0x851b('0x12')](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')]['username'],_0x851b('0x15')][_0x851b('0x16')]('\x20')));}var _0x175192=schema(properties[_0x851b('0x5f')])['validate'](_0x3d5661);if(_0x175192[_0x851b('0x5c')]>0x0){return _0x3e903e(_0x36673d['error'](0x1f4,_[_0x851b('0x6e')](_0x175192,'message')[_0x851b('0x16')](',\x20')));}var _0x236aef=_[_0x851b('0x60')](_0x2d5d7c[_0x851b('0x5e')],{'uniqueid':_0x3d5661[_0x851b('0x61')]});if(_0x236aef){return BPromise[_0x851b('0x6f')]()[_0x851b('0x1a')](function(){if(_0x236aef[_0x851b('0x62')]){return ami[_0x851b('0x70')]({'action':_0x851b('0x71'),'channel':_0x236aef[_0x851b('0x62')],'mixmonitorid':_0x3d5661['mixmonitorid']})['catch'](function(_0x170c5c){});}})[_0x851b('0x1a')](function(){if(_0x236aef[_0x851b('0x72')]){return ami[_0x851b('0x70')]({'action':'StopMixMonitor','channel':_0x236aef['destinationchannel'],'mixmonitorid':_0x3d5661[_0x851b('0x6b')]})[_0x851b('0x1b')](function(_0x143bee){});}})['then'](function(_0x2fa594){var _0x59f5ab=_[_0x851b('0x60')](_0x236aef[_0x851b('0x66')],{'mixmonitorid':_0x3d5661['mixmonitorid']});if(_0x59f5ab){_0x59f5ab['status']=_0x851b('0x73');}})[_0x851b('0x1a')](function(){var _0x2b07db=util[_0x851b('0x8')](_0x851b('0x74'),_0x3d5661[_0x851b('0x75')]||_0x3d5661[_0x851b('0x61')],_0x3d5661[_0x851b('0x8')]||'wav');var _0x520543=_[_0x851b('0x60')](_0x236aef[_0x851b('0x66')],{'filename':_0x851b('0x67')+_0x2b07db[_0x851b('0x68')]()});if(_0x520543){_0x520543[_0x851b('0x76')]=_0x851b('0x73');}})[_0x851b('0x1a')](function(){_0xfdf721({'code':0xc8,'message':[_0x3d5661['uniqueid'],_0x851b('0x77')][_0x851b('0x16')]('\x20')});})[_0x851b('0x1b')](function(_0xa3c235){_0x3e903e(_0x36673d[_0x851b('0x12')](0x1f5,[_0x3d5661[_0x851b('0x61')],_0xa3c235[_0x851b('0x1c')][_0x851b('0x68')]()][_0x851b('0x16')]('\x20')));});}else{return _0x3e903e(_0x36673d[_0x851b('0x12')](0x1f5,_0x851b('0x78')));}});},'VoiceQueuesChannels':function(_0x5b9b3f){return new Promise(function(_0x29e050,_0x12c2a2){var _0x5c5ff9=_['values'](_0x2d5d7c[_0x851b('0x79')]);_0x29e050({'count':_0x5c5ff9['length'],'rows':_0x5c5ff9});});},'VoiceQueuesChannel':function(_0x3f64e4){var _0x4e1d8d=this;return new Promise(function(_0x32a1b9,_0x2bd54f){var _0xe22f57=schema(properties[_0x851b('0x7a')])[_0x851b('0x1')](_0x3f64e4);if(_0xe22f57[_0x851b('0x5c')]>0x0){return _0x2bd54f(_0x4e1d8d[_0x851b('0x12')](0x1f4,_[_0x851b('0x6e')](_0xe22f57,'message')['join'](',\x20')));}var _0x41b131=_[_0x851b('0x60')](_0x2d5d7c[_0x851b('0x79')],{'uniqueid':_0x3f64e4[_0x851b('0x61')]});if(_0x41b131){_0x32a1b9(_0x41b131);}else{return _0x2bd54f(_0x4e1d8d['error'](0x1f5,_0x851b('0x78')));}});},'VoiceQueuesChannelHangup':function(_0x29ee50){var _0xb1f085=this;return new Promise(function(_0x305431,_0x1bbccb){if(ami['isConnected']()==![]){return _0x1bbccb(_0xb1f085[_0x851b('0x12')](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')][_0x851b('0x14')],_0x851b('0x15')][_0x851b('0x16')]('\x20')));}var _0xb2a14a=schema(properties['voicequeuechannelhangup'])[_0x851b('0x1')](_0x29ee50);if(_0xb2a14a[_0x851b('0x5c')]>0x0){return _0x1bbccb(_0xb1f085['error'](0x1f4,_[_0x851b('0x6e')](_0xb2a14a,_0x851b('0x1c'))[_0x851b('0x16')](',\x20')));}var _0x57f2bc=_[_0x851b('0x60')](_0x2d5d7c[_0x851b('0x79')],{'uniqueid':_0x29ee50[_0x851b('0x61')]});if(_0x57f2bc&&_0x57f2bc[_0x851b('0x62')]){return ami[_0x851b('0x70')]({'action':'Hangup','channel':_0x57f2bc[_0x851b('0x62')]})[_0x851b('0x1a')](function(_0x12a82b){_0x305431({'code':0xc8,'message':[_0x29ee50[_0x851b('0x61')],_0x12a82b[_0x851b('0x1c')][_0x851b('0x68')]()][_0x851b('0x16')]('\x20')});})[_0x851b('0x1b')](function(_0x26a4cc){_0x1bbccb(_0xb1f085[_0x851b('0x12')](0x1f5,[_0x29ee50['uniqueid'],_0x26a4cc[_0x851b('0x1c')][_0x851b('0x68')]()][_0x851b('0x16')]('\x20')));});}else{return _0x1bbccb(_0xb1f085['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x147f77){var _0x1c8336=this;return new Promise(function(_0x3f8a8f,_0x557e07){if(ami[_0x851b('0x11')]()==![]){return _0x557e07(_0x1c8336['error'](0x1f4,[config[_0x851b('0x13')]['ip'],config[_0x851b('0x13')][_0x851b('0x14')],_0x851b('0x15')][_0x851b('0x16')]('\x20')));}var _0x17fa38=schema(properties[_0x851b('0x7b')])[_0x851b('0x1')](_0x147f77);if(_0x17fa38[_0x851b('0x5c')]>0x0){return _0x557e07(_0x1c8336[_0x851b('0x12')](0x1f4,_['map'](_0x17fa38,'message')[_0x851b('0x16')](',\x20')));}var _0x33229c=_[_0x851b('0x60')](_0x2d5d7c[_0x851b('0x79')],{'uniqueid':_0x147f77[_0x851b('0x61')]});if(_0x33229c&&_0x33229c[_0x851b('0x62')]){return ami[_0x851b('0x70')]({'action':_0x851b('0x7c'),'channel':_0x33229c['channel'],'exten':_0x147f77[_0x851b('0x7d')],'context':_0x147f77[_0x851b('0x7e')]||_0x33229c['context'],'priority':0x1})['then'](function(_0x378807){_0x3f8a8f({'code':0xc8,'message':[_0x147f77[_0x851b('0x61')],_0x378807[_0x851b('0x1c')]['toLowerCase']()][_0x851b('0x16')]('\x20')});})[_0x851b('0x1b')](function(_0x2a26e4){_0x557e07(_0x1c8336[_0x851b('0x12')](0x1f5,[_0x147f77[_0x851b('0x61')],_0x2a26e4[_0x851b('0x1c')]['toLowerCase']()][_0x851b('0x16')]('\x20')));});}else{return _0x557e07(_0x1c8336[_0x851b('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x34711d){return new Promise(function(_0xa6115e,_0x2e8cd7){var _0x5a8997=_[_0x851b('0x5d')](_0x2d5d7c[_0x851b('0xd')]);_0xa6115e({'count':_0x5a8997[_0x851b('0x5c')],'rows':_0x5a8997});});},'Telephones':function(_0x190de9){return new Promise(function(_0x599052,_0x5d3abe){var _0x380c38=_[_0x851b('0x5d')](_0x2d5d7c[_0x851b('0x7f')]);_0x599052({'count':_0x380c38[_0x851b('0x5c')],'rows':_0x380c38});});},'Trunks':function(_0x2c7482){return new Promise(function(_0x2988be,_0x4595ae){var _0x283f0d=_[_0x851b('0x5d')](_0x2d5d7c['trunks']);_0x2988be({'count':_0x283f0d[_0x851b('0x5c')],'rows':_0x283f0d});});},'OutboundChannels':function(_0x587a11){return new Promise(function(_0x296239,_0x4e88c8){var _0x2d8c2f=_['values'](_0x2d5d7c[_0x851b('0x80')]);_0x296239({'count':_0x2d8c2f[_0x851b('0x5c')],'rows':_0x2d8c2f});});},'Outbound':function(_0x3c61e6){return new Promise(function(_0x4c7d19,_0x33e0d9){_0x4c7d19(_0x2d5d7c[_0x851b('0x30')]);});},'Campaigns':function(_0x4a8c2a){return new Promise(function(_0x240092,_0xe8a6c0){var _0x22bfb6=_[_0x851b('0x5d')](_0x2d5d7c[_0x851b('0x81')]);_0x240092({'count':_0x22bfb6[_0x851b('0x5c')],'rows':_0x22bfb6});});},'VoiceQueuesPreview':function(_0x392264){var _0x2ab3cc=this;return new Promise(function(_0x3c1dd4,_0x4df877){_0x2eefe7[_0x851b('0x82')](_0x392264['id'])[_0x851b('0x1a')](function(_0x33549a){_0x3c1dd4({'code':0xc8,'message':_0x33549a['message']});})['catch'](function(_0x260263){_0x4df877(_0x2ab3cc[_0x851b('0x12')](0x1f4,_0x260263[_0x851b('0x1c')]));});});},'EventManager':function(_0x14a4f4){var _0x1e82dc=this;return new Promise(function(_0x48a49c,_0x33ee93){if(!_0x14a4f4[_0x851b('0x83')]){return _0x33ee93(_0x1e82dc[_0x851b('0x12')](0x1f4,_0x851b('0x84')));}ami[_0x851b('0x85')](_0x851b('0x86')+_0x14a4f4[_0x851b('0x83')],_0x14a4f4['message']);_0x48a49c({'code':0xc8,'message':_0x14a4f4});});},'FaxAccounts':function(_0x2d34ff){return new Promise(function(_0x45d949,_0x2f5953){var _0x323d64=_[_0x851b('0x5d')](_0x2d5d7c[_0x851b('0x87')]);_0x45d949({'count':_0x323d64['length'],'rows':_0x323d64});});},'SendFax':function(_0x29cf64){var _0x1f7165=this;return new Promise(function(_0x182f66,_0x38ec95){_0x5e3ab8[_0x851b('0x88')](_0x29cf64)['then'](function(_0xfee1ec){_0x182f66({'code':0xc8,'message':_0xfee1ec[_0x851b('0x1c')]});})['catch'](function(_0x3e868d){_0x38ec95(_0x1f7165['error'](0x1f4,_0x3e868d[_0x851b('0x1c')]));});});},'CheckAfterSend':function(_0x5131b2){var _0x1e5913=this;return new Promise(function(_0x4a64cf,_0x239a6c){_0x5e3ab8[_0x851b('0x89')](_0x5131b2)[_0x851b('0x1a')](function(_0x92f556){_0x4a64cf({'code':0xc8,'message':_0x92f556['message']});})[_0x851b('0x1b')](function(_0x4cf5c1){_0x239a6c(_0x1e5913[_0x851b('0x12')](0x1f4,_0x4cf5c1['message']));});});}};var _0x12bb27=jayson[_0x851b('0x8a')](_0x40e5da)[_0x851b('0x8b')]();_0x12bb27['on'](_0x851b('0x12'),function(_0x346b8b){return _0x16e3e5(_0x346b8b);});_0x12bb27[_0x851b('0x7')](0x232a,_0x851b('0x8c'),function(){console[_0x851b('0x8d')](_0x851b('0x8e'),0x232a);return _0x3dc303('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index db34e59..f7e7988 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 _0x1798=['../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[%s][%s]','stringify','emit','exec','autoCreate','data2','calleridnum','routeId','calleridname','','destcalleridname','destcalleridnum','uniqueid','phone','then','showContact','omit','firstName','xmd-contactid2','format','action','toLowerCase','merge','data1','[%s][%s]\x20Contact\x20not\x20found','resolve','createContact','name','trigger:%s','catch','[%s][%s]\x20Error\x20creating\x20contact','user:%s','bluebird','util','lodash','../../../../config/logger','trigger'];(function(_0x323fbe,_0x49950e){var _0xf491ed=function(_0x3a6169){while(--_0x3a6169){_0x323fbe['push'](_0x323fbe['shift']());}};_0xf491ed(++_0x49950e);}(_0x1798,0xa7));var _0x8179=function(_0x47668e,_0x4e33da){_0x47668e=_0x47668e-0x0;var _0x1b8abf=_0x1798[_0x47668e];return _0x1b8abf;};'use strict';var BPromise=require(_0x8179('0x0'));var util=require(_0x8179('0x1'));var _=require(_0x8179('0x2'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x8179('0x3'))(_0x8179('0x4'));var cmContactRpc=require(_0x8179('0x5'));config[_0x8179('0x6')]=_[_0x8179('0x7')](config[_0x8179('0x6')],{'host':_0x8179('0x8'),'port':0x18eb});var io=require(_0x8179('0x9'))(new Redis(config[_0x8179('0x6')]));function emit(_0x35335b,_0x3d5eaf,_0x1ab939,_0x13e69e){logger[_0x8179('0xa')](_0x8179('0xb'),_0x35335b,'',_0x3d5eaf,_0x1ab939,JSON[_0x8179('0xc')](_0x13e69e));io['to'](_0x3d5eaf)[_0x8179('0xd')](_0x1ab939,_0x13e69e);}exports[_0x8179('0xe')]=function(_0x21b973,_0x3b1ecd,_0x577ce5){_0x577ce5[_0x8179('0xf')]=0x0;if(_0x3b1ecd['data2']&&parseInt(_0x3b1ecd[_0x8179('0x10')],0xa)){var _0xd5c09e={'ListId':parseInt(_0x3b1ecd['data1'],0xa),'phone':_0x577ce5[_0x8179('0x11')]};if(_['isNil'](_0x577ce5[_0x8179('0x12')])){_0xd5c09e['firstName']=_0x577ce5[_0x8179('0x13')]&&_0x577ce5[_0x8179('0x13')]!==_0x8179('0x14')?_0x577ce5[_0x8179('0x13')]:_0x577ce5[_0x8179('0x11')]||_0x577ce5['uniqueid'];}else{_0xd5c09e['firstName']=_0x577ce5['destcalleridname']&&_0x577ce5[_0x8179('0x15')]!==_0x8179('0x14')?_0x577ce5[_0x8179('0x15')]:_0x577ce5[_0x8179('0x16')]||_0x577ce5[_0x8179('0x17')];_0xd5c09e[_0x8179('0x18')]=_0x577ce5[_0x8179('0x15')]&&_0x577ce5['destcalleridname']!==_0x8179('0x14')?_0x577ce5['destcalleridname']:_0x577ce5[_0x8179('0x16')]||_0x577ce5[_0x8179('0x17')];}BPromise['resolve']()[_0x8179('0x19')](cmContactRpc[_0x8179('0x1a')]({'where':_[_0x8179('0x1b')](_0xd5c09e,[_0x8179('0x1c')])}))['then'](function(_0x56a038){if(_0x56a038){logger[_0x8179('0xa')]('[%s][%s]\x20Contact\x20found:%s',_0x577ce5[_0x8179('0x17')],'',_0x56a038['id']);if(_0x21b973){_0x577ce5[_0x8179('0x1d')]=_0x56a038['id'];emit(_0x577ce5[_0x8179('0x17')],util[_0x8179('0x1e')]('user:%s',_0x21b973['name']),util['format']('trigger:%s',_0x3b1ecd[_0x8179('0x1f')][_0x8179('0x20')]()),_[_0x8179('0x21')](_0x577ce5,{'ListId':parseInt(_0x3b1ecd[_0x8179('0x22')],0xa)}));}return;}else{logger[_0x8179('0xa')](_0x8179('0x23'),_0x577ce5['uniqueid'],'');return BPromise[_0x8179('0x24')]()[_0x8179('0x19')](cmContactRpc[_0x8179('0x25')](_0xd5c09e));}})[_0x8179('0x19')](function(_0x56c027){if(_0x56c027){logger[_0x8179('0xa')]('[%s][%s]\x20Contact\x20created:%s',_0x577ce5[_0x8179('0x17')],'',_0x56c027['id']);if(_0x21b973){_0x577ce5[_0x8179('0x1d')]=_0x56c027['id'];emit(_0x577ce5[_0x8179('0x17')],util['format']('user:%s',_0x21b973[_0x8179('0x26')]),util[_0x8179('0x1e')](_0x8179('0x27'),_0x3b1ecd['action']['toLowerCase']()),_['merge'](_0x577ce5,{'ListId':parseInt(_0x3b1ecd[_0x8179('0x22')],0xa)}));}}})[_0x8179('0x28')](function(_0x5db153){logger['error'](_0x8179('0x29'),_0x577ce5[_0x8179('0x17')],'',JSON[_0x8179('0xc')](_0x5db153));});}else{if(_0x21b973){logger[_0x8179('0xa')]('[%s][%s]\x20Autocreate\x20disabled',_0x577ce5['uniqueid'],'');emit(_0x577ce5[_0x8179('0x17')],util[_0x8179('0x1e')](_0x8179('0x2a'),_0x21b973[_0x8179('0x26')]),util[_0x8179('0x1e')](_0x8179('0x27'),_0x3b1ecd[_0x8179('0x1f')][_0x8179('0x20')]()),_[_0x8179('0x21')]({'ListId':parseInt(_0x3b1ecd[_0x8179('0x22')],0xa)},_0x577ce5));}}}; \ No newline at end of file +var _0xe742=['user:%s','name','trigger:%s','action','merge','info','createContact','[%s][%s]\x20Contact\x20created:%s','catch','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','toLowerCase','lodash','ioredis','../../../../config/logger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[%s][%s]','stringify','emit','exec','autoCreate','data2','data1','firstName','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','resolve','then','showContact','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0xe742,0x14d));var _0x2e74=function(_0x3f65b8,_0x2290e4){_0x3f65b8=_0x3f65b8-0x0;var _0x48567e=_0xe742[_0x3f65b8];return _0x48567e;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x2e74('0x0'));var Redis=require(_0x2e74('0x1'));var config=require('../../../../config/environment');var logger=require(_0x2e74('0x2'))('trigger');var cmContactRpc=require(_0x2e74('0x3'));config['redis']=_['defaults'](config[_0x2e74('0x4')],{'host':_0x2e74('0x5'),'port':0x18eb});var io=require(_0x2e74('0x6'))(new Redis(config[_0x2e74('0x4')]));function emit(_0x429140,_0x275bf2,_0x49e2e5,_0x2d20ea){logger['info'](_0x2e74('0x7'),_0x429140,'',_0x275bf2,_0x49e2e5,JSON[_0x2e74('0x8')](_0x2d20ea));io['to'](_0x275bf2)[_0x2e74('0x9')](_0x49e2e5,_0x2d20ea);}exports[_0x2e74('0xa')]=function(_0x59ec93,_0x574c84,_0x503ec0){_0x503ec0[_0x2e74('0xb')]=0x0;if(_0x574c84[_0x2e74('0xc')]&&parseInt(_0x574c84[_0x2e74('0xc')],0xa)){var _0x55b855={'ListId':parseInt(_0x574c84[_0x2e74('0xd')],0xa),'phone':_0x503ec0['calleridnum']};if(_['isNil'](_0x503ec0['routeId'])){_0x55b855[_0x2e74('0xe')]=_0x503ec0[_0x2e74('0xf')]&&_0x503ec0[_0x2e74('0xf')]!==_0x2e74('0x10')?_0x503ec0[_0x2e74('0xf')]:_0x503ec0['calleridnum']||_0x503ec0[_0x2e74('0x11')];}else{_0x55b855['firstName']=_0x503ec0['destcalleridname']&&_0x503ec0['destcalleridname']!==''?_0x503ec0[_0x2e74('0x12')]:_0x503ec0[_0x2e74('0x13')]||_0x503ec0[_0x2e74('0x11')];_0x55b855[_0x2e74('0x14')]=_0x503ec0[_0x2e74('0x12')]&&_0x503ec0[_0x2e74('0x12')]!==''?_0x503ec0[_0x2e74('0x12')]:_0x503ec0[_0x2e74('0x13')]||_0x503ec0[_0x2e74('0x11')];}BPromise[_0x2e74('0x15')]()[_0x2e74('0x16')](cmContactRpc[_0x2e74('0x17')]({'where':_['omit'](_0x55b855,['firstName'])}))[_0x2e74('0x16')](function(_0x201e5b){if(_0x201e5b){logger['info'](_0x2e74('0x18'),_0x503ec0['uniqueid'],'',_0x201e5b['id']);if(_0x59ec93){_0x503ec0[_0x2e74('0x19')]=_0x201e5b['id'];emit(_0x503ec0[_0x2e74('0x11')],util[_0x2e74('0x1a')](_0x2e74('0x1b'),_0x59ec93[_0x2e74('0x1c')]),util[_0x2e74('0x1a')](_0x2e74('0x1d'),_0x574c84[_0x2e74('0x1e')]['toLowerCase']()),_[_0x2e74('0x1f')](_0x503ec0,{'ListId':parseInt(_0x574c84[_0x2e74('0xd')],0xa)}));}return;}else{logger[_0x2e74('0x20')]('[%s][%s]\x20Contact\x20not\x20found',_0x503ec0[_0x2e74('0x11')],'');return BPromise['resolve']()[_0x2e74('0x16')](cmContactRpc[_0x2e74('0x21')](_0x55b855));}})[_0x2e74('0x16')](function(_0x12a377){if(_0x12a377){logger[_0x2e74('0x20')](_0x2e74('0x22'),_0x503ec0[_0x2e74('0x11')],'',_0x12a377['id']);if(_0x59ec93){_0x503ec0[_0x2e74('0x19')]=_0x12a377['id'];emit(_0x503ec0['uniqueid'],util[_0x2e74('0x1a')](_0x2e74('0x1b'),_0x59ec93[_0x2e74('0x1c')]),util[_0x2e74('0x1a')](_0x2e74('0x1d'),_0x574c84[_0x2e74('0x1e')]['toLowerCase']()),_[_0x2e74('0x1f')](_0x503ec0,{'ListId':parseInt(_0x574c84[_0x2e74('0xd')],0xa)}));}}})[_0x2e74('0x23')](function(_0x210ab4){logger[_0x2e74('0x24')](_0x2e74('0x25'),_0x503ec0[_0x2e74('0x11')],'',JSON[_0x2e74('0x8')](_0x210ab4));});}else{if(_0x59ec93){logger[_0x2e74('0x20')](_0x2e74('0x26'),_0x503ec0[_0x2e74('0x11')],'');emit(_0x503ec0[_0x2e74('0x11')],util[_0x2e74('0x1a')](_0x2e74('0x1b'),_0x59ec93[_0x2e74('0x1c')]),util['format'](_0x2e74('0x1d'),_0x574c84[_0x2e74('0x1e')][_0x2e74('0x27')]()),_[_0x2e74('0x1f')]({'ListId':parseInt(_0x574c84[_0x2e74('0xd')],0xa)},_0x503ec0));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 940c9b1..fc5db3d 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 _0x9779=['../rpc/cmContact','trigger','redis','defaults','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentcongestion','custom:agentreject','custom:timeout','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','clone','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','interface','action','contactmanager','motionbar','popup','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','location','uriLocation','data4','windowWidth','data5','800','windowHeight','data6','600','winArguments','format','name','trigger:%s:%s','toLowerCase','data1','jscripty','trigger:%s','exec','script','parse','query','search','AllConditions','every','checkConditions','channel','AnyConditions','some','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','event','queue','membername','lastevent','routeId','exports','util','lodash','url','mustache','ioredis','./integration','./script'];(function(_0x1d4007,_0x456572){var _0x37daab=function(_0x552471){while(--_0x552471){_0x1d4007['push'](_0x1d4007['shift']());}};_0x37daab(++_0x456572);}(_0x9779,0x69));var _0x9977=function(_0x51bd07,_0x18b802){_0x51bd07=_0x51bd07-0x0;var _0x181060=_0x9779[_0x51bd07];return _0x181060;};'use strict';var util=require(_0x9977('0x0'));var _=require(_0x9977('0x1'));var url=require(_0x9977('0x2'));var Mustache=require(_0x9977('0x3'));var Redis=require(_0x9977('0x4'));var urlforward=require('./urlforward');var integration=require(_0x9977('0x5'));var cmContact=require('./cmContact');var script=require(_0x9977('0x6'));var cmContactRpc=require(_0x9977('0x7'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x9977('0x8'));var ami=require('../ami');config[_0x9977('0x9')]=_[_0x9977('0xa')](config[_0x9977('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x9977('0xb'))(new Redis(config['redis']));var operators={'equals':function(_0xfce254,_0x2bb78e){return _0xfce254==_0x2bb78e;},'not_equals':function(_0x27e766,_0x37f4da){return _0x27e766!=_0x37f4da;}};var barAndWebActions=['popup',_0x9977('0x2'),_0x9977('0xc')];function Trigger(_0x330201){this[_0x9977('0xd')]=_0x330201[_0x9977('0xd')];this[_0x9977('0xe')]=_0x330201[_0x9977('0xe')];this[_0x9977('0xf')]=_0x330201['voiceQueues'];this[_0x9977('0x10')]=_0x330201['templates'];this[_0x9977('0x11')]=_0x330201[_0x9977('0x11')];this[_0x9977('0x12')]=_0x330201[_0x9977('0x12')];this[_0x9977('0x13')]=_0x330201[_0x9977('0x13')];this['salesforceAccounts']=_0x330201[_0x9977('0x14')];this[_0x9977('0x15')]=_0x330201[_0x9977('0x15')];this[_0x9977('0x16')]=_0x330201[_0x9977('0x16')];this['deskAccounts']=_0x330201[_0x9977('0x17')];this[_0x9977('0x18')]=_0x330201[_0x9977('0x18')];this['servicenowAccounts']=_0x330201['servicenowAccounts'];this[_0x9977('0x19')]=_0x330201[_0x9977('0x19')];this['freshsalesAccounts']=_0x330201[_0x9977('0x1a')];this[_0x9977('0x1b')]={'zendesk':this[_0x9977('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x9977('0x13')],'sugarcrm':this[_0x9977('0x15')],'zoho':this[_0x9977('0x16')],'desk':this['deskAccounts'],'vtiger':this[_0x9977('0x18')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x9977('0x1a')],'servicenow':this[_0x9977('0x1c')]};ami['on'](_0x9977('0x1d'),this[_0x9977('0x1e')][_0x9977('0x1f')](this));ami['on']('custom:agentconnect',this[_0x9977('0x1e')][_0x9977('0x1f')](this));ami['on'](_0x9977('0x20'),this['syncCustomEvent'][_0x9977('0x1f')](this));ami['on']('custom:agentcomplete',this[_0x9977('0x1e')]['bind'](this));ami['on'](_0x9977('0x21'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentnoanswer',this[_0x9977('0x1e')][_0x9977('0x1f')](this));ami['on']('custom:agentbusy',this[_0x9977('0x1e')]['bind'](this));ami['on'](_0x9977('0x22'),this['syncCustomEvent']['bind'](this));ami['on'](_0x9977('0x23'),this[_0x9977('0x1e')]['bind'](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0x9977('0x1f')](this));ami['on'](_0x9977('0x24'),this[_0x9977('0x1e')][_0x9977('0x1f')](this));ami['on']('custom:dialbegin',this['syncAgentDial'][_0x9977('0x1f')](this));ami['on']('custom:dialconnect',this[_0x9977('0x25')][_0x9977('0x1f')](this));ami['on'](_0x9977('0x26'),this[_0x9977('0x25')][_0x9977('0x1f')](this));ami['on'](_0x9977('0x27'),this[_0x9977('0x1e')]['bind'](this));ami['on'](_0x9977('0x28'),this[_0x9977('0x1e')][_0x9977('0x1f')](this));ami['on'](_0x9977('0x29'),this[_0x9977('0x1e')][_0x9977('0x1f')](this));ami['on'](_0x9977('0x2a'),this[_0x9977('0x1e')][_0x9977('0x1f')](this));ami['on'](_0x9977('0x2b'),this[_0x9977('0x1e')][_0x9977('0x1f')](this));ami['on'](_0x9977('0x2c'),this[_0x9977('0x1e')][_0x9977('0x1f')](this));}Trigger[_0x9977('0x2d')][_0x9977('0x2e')]=function(_0x48b198,_0x1fa3bc,_0x158fc2){logger[_0x9977('0x2f')](_0x48b198,_0x1fa3bc,JSON['stringify'](_0x158fc2));io['to'](_0x48b198)[_0x9977('0x2e')](_0x1fa3bc,_0x158fc2);};Trigger[_0x9977('0x2d')]['syncCustomEvent']=function(_0x21662b){var _0x5d05a7=_[_0x9977('0x30')](_0x21662b);this[_0x9977('0x31')](_0x5d05a7);};Trigger[_0x9977('0x2d')][_0x9977('0x25')]=function(_0x567254){if(this[_0x9977('0xe')][_0x567254['interface']]){this['syncCustomEvent'](_0x567254);}};Trigger['prototype'][_0x9977('0x31')]=function(_0x218225){var _0x34fae7;for(var _0x2d9124 in this[_0x9977('0xd')]){if(this['triggers'][_0x9977('0x32')](_0x2d9124)){if(this[_0x9977('0xd')][_0x2d9124][_0x9977('0x33')]){_0x34fae7=this[_0x9977('0x34')](this['triggers'][_0x2d9124],_0x218225);if(_0x34fae7){_[_0x9977('0x35')](_0x218225,_0x218225[_0x9977('0x36')]);for(var _0x427b5e=0x0,_0x432fb2,_0x404e92,_0x3e027f;_0x427b5e0x0){_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(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 f1b0934..f8e44f8 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 _0xea45=['userEmail','length','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info','toLowerCase','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','catch','outbound','destcalleridnum','telephone1',']\x20Enduser\x20created!','string','customField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','callDirection','queue','ticketId','format','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email'];(function(_0x3cee22,_0x54ad32){var _0x286fa5=function(_0x3026e5){while(--_0x3026e5){_0x3cee22['push'](_0x3cee22['shift']());}};_0x286fa5(++_0x54ad32);}(_0xea45,0x14f));var _0x5ea4=function(_0x36f641,_0x1a3063){_0x36f641=_0x36f641-0x0;var _0x39b299=_0xea45[_0x36f641];return _0x39b299;};'use strict';var _=require(_0x5ea4('0x0'));var BPromise=require(_0x5ea4('0x1'));var rp=require(_0x5ea4('0x2'));var util=require('util');var intUtil=require(_0x5ea4('0x3'));var md5=require(_0x5ea4('0x4'));var Redis=require(_0x5ea4('0x5'));var logger=require(_0x5ea4('0x6'))('dynamics365');var config=require(_0x5ea4('0x7'));config[_0x5ea4('0x8')]=_[_0x5ea4('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5ea4('0xa'))(new Redis(config['redis']));function getAuthToken(_0x1a8d67,_0x3365ea,_0x24c440){var _0x157e77={'method':_0x5ea4('0xb'),'uri':_0x3365ea,'form':{'client_id':_0x1a8d67[_0x5ea4('0xc')],'resource':_0x1a8d67[_0x5ea4('0xd')],'username':_0x1a8d67[_0x5ea4('0xe')],'password':_0x1a8d67[_0x5ea4('0xf')],'grant_type':_0x5ea4('0xf'),'client_secret':_0x1a8d67[_0x5ea4('0x10')]},'json':!![]};return rp(_0x157e77)[_0x5ea4('0x11')](function(_0xb83098){return _0xb83098['access_token'];})['catch'](function(_0x5b28e8){logger[_0x5ea4('0x12')]('['+[_0x24c440[_0x5ea4('0x13')]()]+_0x5ea4('0x14'));return _0x5b28e8[_0x5ea4('0x15')];});}function getUser(_0x2a63a0,_0x320126,_0x2ffb81,_0x2bafa7,_0x14c9e3,_0x12b4e2){return new BPromise(function(_0x326683,_0x1ed78d){return getAuthToken(_0x320126,_0x2bafa7,_0x12b4e2)[_0x5ea4('0x11')](function(_0x7b6003){var _0x764f3c={'method':'GET','uri':_0x14c9e3+_0x5ea4('0x16'),'headers':{'Authorization':_0x5ea4('0x17')+_0x7b6003,'OData-Version':_0x5ea4('0x18')},'json':!![]};return rp(_0x764f3c);})[_0x5ea4('0x11')](function(_0x3dbf0e){var _0x518590=_0x3dbf0e[_0x5ea4('0x19')];var _0xe9e09e=![];var _0x2bd85e=null;if(!_[_0x5ea4('0x1a')](_0x2ffb81)){if(intUtil[_0x5ea4('0x1b')](_0x2ffb81[_0x5ea4('0x1c')])){_0x2a63a0[_0x5ea4('0x1d')]=_0x2ffb81[_0x5ea4('0x1c')];for(_0x2bd85e=0x0;_0x2bd85e<_0x518590[_0x5ea4('0x1e')];_0x2bd85e++){if(_0x518590[_0x2bd85e]['internalemailaddress']===_0x2ffb81[_0x5ea4('0x1c')]&&!_0x518590[_0x2bd85e][_0x5ea4('0x1f')]){_0xe9e09e=!![];logger['info']('['+[_0x12b4e2[_0x5ea4('0x13')]()]+_0x5ea4('0x20')+_0x518590[_0x2bd85e][_0x5ea4('0x21')]+'!');_0x2a63a0[_0x5ea4('0x22')]=_0x518590[_0x2bd85e]['systemuserid'];}}}}if(!_0xe9e09e){logger[_0x5ea4('0x23')]('['+[_0x12b4e2[_0x5ea4('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x2a63a0[_0x5ea4('0x1d')]=_0x320126[_0x5ea4('0xe')];for(_0x2bd85e=0x0;_0x2bd85e<_0x518590[_0x5ea4('0x1e')];_0x2bd85e++){if(_0x518590[_0x2bd85e]['internalemailaddress']===_0x320126[_0x5ea4('0xe')]){_0x2a63a0[_0x5ea4('0x22')]=_0x518590[_0x2bd85e][_0x5ea4('0x21')];}}}_0x326683(_0x2a63a0);})['catch'](function(_0x1c6e39){_0x1ed78d(_0x1c6e39['message']);});});}function createEndUser(_0xf54ae6,_0x512a2a,_0x54c67d,_0xac4ccc,_0x74a722,_0x483652){return new BPromise(function(_0x2e3576,_0x556f51){return getAuthToken(_0x512a2a,_0x54c67d,_0x483652)[_0x5ea4('0x11')](function(_0x4466bd){var _0x237258=_0x483652[_0x5ea4('0x24')]()==='outbound'?_0x74a722['destcalleridnum']:_0x74a722[_0x5ea4('0x25')];var _0xf45459={'method':_0x5ea4('0xb'),'uri':_0xac4ccc+_0x5ea4('0x26'),'body':{'telephone1':_0x237258,'fullname':_0x237258,'firstname':_0x237258,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5ea4('0x27')+_0xf54ae6['userId']+')'},'headers':{'Authorization':_0x5ea4('0x17')+_0x4466bd,'OData-Version':_0x5ea4('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xf45459);})['then'](function(_0x38d03c){var _0x4c51c6=_0x38d03c[_0x5ea4('0x28')][_0x5ea4('0x29')];var _0x1063c5=_0x4c51c6[_0x5ea4('0x2a')](_0x4c51c6[_0x5ea4('0x2b')]('(')+0x1,_0x4c51c6[_0x5ea4('0x2b')](')'));_0xf54ae6[_0x5ea4('0x2c')]=_0x1063c5;_0x2e3576(_0xf54ae6);})[_0x5ea4('0x2d')](function(_0x20e309){_0x556f51(_0x20e309[_0x5ea4('0x15')]);});});}function getEndUser(_0x4819f5,_0x70088e,_0x2ff198,_0x416be4,_0x121c90,_0x1a256b){return new BPromise(function(_0x2f3ca6,_0x3150f6){return getAuthToken(_0x70088e,_0x2ff198,_0x1a256b)[_0x5ea4('0x11')](function(_0x353d14){var _0x243e6d={'method':'GET','uri':_0x416be4+'contacts?$select=telephone1','headers':{'Authorization':_0x5ea4('0x17')+_0x353d14,'If-None-Match':null,'OData-Version':_0x5ea4('0x18')},'json':!![]};return rp(_0x243e6d);})[_0x5ea4('0x11')](function(_0x48cd34){var _0x5c1c68=null;if(_0x48cd34){var _0x58e435=_0x48cd34[_0x5ea4('0x19')];var _0x5bc7e0=![];for(_0x5c1c68=0x0;_0x5c1c68<_0x58e435[_0x5ea4('0x1e')];_0x5c1c68++){var _0xa7310c=_0x1a256b[_0x5ea4('0x24')]()===_0x5ea4('0x2e')?_0x121c90[_0x5ea4('0x2f')]:_0x121c90[_0x5ea4('0x25')];if(_0x58e435[_0x5c1c68][_0x5ea4('0x30')]===_0xa7310c){_0x5bc7e0=!![];_0x4819f5[_0x5ea4('0x2c')]=_0x58e435[_0x5c1c68]['contactid'];}}if(_0x5bc7e0){_0x2f3ca6(_0x4819f5);}else{return createEndUser(_0x4819f5,_0x70088e,_0x2ff198,_0x416be4,_0x121c90,_0x1a256b)[_0x5ea4('0x11')](function(_0x589ee2){logger[_0x5ea4('0x23')]('['+[_0x1a256b[_0x5ea4('0x13')]()]+_0x5ea4('0x31'),_0x589ee2[_0x5ea4('0x2c')]);_0x2f3ca6(_0x589ee2);});}}else{return createEndUser(_0x4819f5,_0x70088e,_0x2ff198,_0x416be4,_0x121c90,_0x1a256b)[_0x5ea4('0x11')](function(_0x107ea8){logger[_0x5ea4('0x23')]('['+[_0x1a256b[_0x5ea4('0x13')]()]+']\x20Enduser\x20Created!',_0x107ea8[_0x5ea4('0x2c')]);_0x2f3ca6(_0x107ea8);});}});});}function getCustomFields(_0x5cf3cc,_0x407755,_0x55c737){var _0x2421ec={};if(_0x5cf3cc[_0x5ea4('0x1e')]>0x0){_['forEach'](_0x5cf3cc,function(_0x4cc9ab){if(_0x4cc9ab['type']===_0x5ea4('0x32')&&_0x4cc9ab['nameField']&&!_0x4cc9ab[_0x5ea4('0x33')]){var _0x221c5f=_0x4cc9ab[_0x5ea4('0x34')]['toLowerCase']();var _0x4b73b3=_0x221c5f[_0x5ea4('0x2a')](0x0,_0x221c5f[_0x5ea4('0x35')]('_'));var _0x28b2b4=_0x221c5f[_0x5ea4('0x2a')](_0x221c5f['indexOf']('_')+0x1);if(_0x4b73b3===_0x55c737){_0x2421ec[_0x28b2b4]=_0x4cc9ab[_0x5ea4('0x36')];}}});}return _0x2421ec;}function getTicket(_0x302e39,_0x59958e,_0x3f27be,_0x4332ca,_0x51ab22,_0x212e66,_0x15b31d){return new BPromise(function(_0x5e29c7,_0x37ec25){var _0x52d341;return getAuthToken(_0x59958e,_0x3f27be,_0x15b31d)[_0x5ea4('0x11')](function(_0x5a450b){if(_0x212e66[_0x5ea4('0x37')]===_0x5ea4('0x38')){_0x52d341={'method':_0x5ea4('0xb'),'uri':_0x4332ca+_0x5ea4('0x39'),'body':Object['assign']({},{'title':intUtil[_0x5ea4('0x3a')](_0x212e66[_0x5ea4('0x3b')],_0x51ab22,'\x20'),'description':intUtil['getString'](_0x212e66[_0x5ea4('0x3c')],_0x51ab22,'\x0a'),'customerid_contact@odata.bind':_0x5ea4('0x3d')+_0x302e39['enduserId']+')','ownerid@odata.bind':_0x5ea4('0x27')+_0x302e39[_0x5ea4('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x212e66[_0x5ea4('0x3e')],_0x51ab22,_0x212e66[_0x5ea4('0x37')])),'headers':{'Authorization':'Bearer\x20'+_0x5a450b,'OData-Version':_0x5ea4('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x212e66['ticketType']==='phonecall'){_0x52d341={'method':'POST','uri':_0x4332ca+_0x5ea4('0x3f'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x212e66[_0x5ea4('0x3b')],_0x51ab22,'\x20'),'phonenumber':String(_0x51ab22[_0x5ea4('0x25')]),'description':intUtil['getString'](_0x212e66[_0x5ea4('0x3c')],_0x51ab22,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5ea4('0x3d')+_0x302e39[_0x5ea4('0x2c')]+')','ownerid@odata.bind':_0x5ea4('0x27')+_0x302e39[_0x5ea4('0x22')]+')','directioncode':_0x302e39[_0x5ea4('0x40')]===_0x5ea4('0x41')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x5ea4('0x27')+_0x302e39['userId']+')','participationtypemask':_0x302e39[_0x5ea4('0x40')]===_0x5ea4('0x41')?0x2:0x1},{'partyid_contact@odata.bind':_0x5ea4('0x3d')+_0x302e39[_0x5ea4('0x2c')]+')','participationtypemask':_0x302e39['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x212e66[_0x5ea4('0x3e')],_0x51ab22,_0x212e66[_0x5ea4('0x37')])),'headers':{'Authorization':_0x5ea4('0x17')+_0x5a450b,'OData-Version':_0x5ea4('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x52d341);})[_0x5ea4('0x11')](function(_0x33ec6f){var _0x1b985b=_0x33ec6f[_0x5ea4('0x28')]['odata-entityid'];var _0x17904a=_0x1b985b[_0x5ea4('0x2a')](_0x1b985b[_0x5ea4('0x2b')]('(')+0x1,_0x1b985b['lastIndexOf'](')'));_0x302e39[_0x5ea4('0x42')]=_0x17904a;_0x5e29c7(_0x302e39);})[_0x5ea4('0x2d')](function(_0x279d2f){_0x37ec25(_0x279d2f[_0x5ea4('0x15')]);});});}function emit(_0x171ec0,_0xf8fcff,_0x323f1b,_0x4d0c08){var _0x103f64={'uri':util[_0x5ea4('0x43')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x171ec0,_0x323f1b,_0x4d0c08)};io['to'](util[_0x5ea4('0x43')]('user:%s',_0xf8fcff))[_0x5ea4('0x44')]('trigger:browser:url',_0x103f64);}exports['cs']=function(_0x4c0ce6,_0xd00572,_0x36da01,_0xb23e95,_0x33bcbd,_0x1013f4,_0x5d5121,_0x32a5e3){var _0x4bd384={};_0x1013f4[_0x5ea4('0xd')]=intUtil['stripTrailingSlash'](_0x1013f4[_0x5ea4('0xd')]);_0x1013f4['serverUrl']=intUtil[_0x5ea4('0x45')](_0x1013f4[_0x5ea4('0x46')]);_0x4bd384[_0x5ea4('0x40')]=_0x32a5e3===_0x5ea4('0x41')||_0x32a5e3===_0x5ea4('0x47')?_0x5ea4('0x41'):_0x5ea4('0x2e');var _0x720e0c=util[_0x5ea4('0x43')](_0x5ea4('0x48'),_0x1013f4[_0x5ea4('0xd')]);var _0x3fad1c=util[_0x5ea4('0x43')]('https://login.microsoftonline.com/%s/oauth2/token',_0x1013f4[_0x5ea4('0x49')]);var _0x2989c7=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1013f4[_0x5ea4('0x46')],_0xd00572[_0x5ea4('0x4a')],md5(_0xd00572['uniqueid']));if(_0x33bcbd&&_0x33bcbd[_0x5ea4('0x4b')]){logger['info'](_0x5ea4('0x4c'),'Recording\x20is\x20enabled!');_0xd00572[_0x5ea4('0x4d')]=_0x2989c7;}else if(_0x5d5121&&_0x5d5121['recordingFormat']&&_0x5d5121[_0x5ea4('0x4e')]!==_0x5ea4('0x4f')){logger[_0x5ea4('0x23')](_0x5ea4('0x50'),_0x5ea4('0x51'));_0xd00572['recordingURL']=_0x2989c7;}else{_0xd00572[_0x5ea4('0x4d')]='';}return getUser(_0x4bd384,_0x1013f4,_0xb23e95,_0x3fad1c,_0x720e0c,_0x32a5e3)[_0x5ea4('0x11')](function(_0x230edd){logger[_0x5ea4('0x23')]('['+_0x32a5e3[_0x5ea4('0x13')]()+_0x5ea4('0x52'),_0x230edd[_0x5ea4('0x22')]);logger[_0x5ea4('0x23')]('['+_0x32a5e3['toUpperCase']()+_0x5ea4('0x53'),_0x230edd[_0x5ea4('0x1d')]);return getEndUser(_0x230edd,_0x1013f4,_0x3fad1c,_0x720e0c,_0xd00572,_0x32a5e3);})['then'](function(_0x241112){logger[_0x5ea4('0x23')]('['+_0x32a5e3[_0x5ea4('0x13')]()+_0x5ea4('0x54'),_0x241112['enduserId']);logger[_0x5ea4('0x23')]('['+_0x32a5e3[_0x5ea4('0x13')]()+_0x5ea4('0x55'),_0xd00572[_0x5ea4('0x25')]);return getTicket(_0x241112,_0x1013f4,_0x3fad1c,_0x720e0c,_0xd00572,_0x36da01,_0x32a5e3);})[_0x5ea4('0x11')](function(_0x5be6f7){logger[_0x5ea4('0x23')](util['format']('['+_0x32a5e3[_0x5ea4('0x13')]()+_0x5ea4('0x56'),_0x36da01[_0x5ea4('0x37')],_0x5be6f7[_0x5ea4('0x42')]));logger[_0x5ea4('0x23')](util[_0x5ea4('0x43')]('['+_0x32a5e3['toUpperCase']()+_0x5ea4('0x57'),_0x32a5e3));if(_0x32a5e3!==_0x5ea4('0x47')){logger[_0x5ea4('0x23')]('['+_0x32a5e3[_0x5ea4('0x13')]()+']',_0x5ea4('0x58'));emit(_0x1013f4[_0x5ea4('0xd')],_0xb23e95[_0x5ea4('0x59')],_0x36da01[_0x5ea4('0x37')],_0x5be6f7[_0x5ea4('0x42')]);}})[_0x5ea4('0x2d')](function(_0x4f7d14){logger[_0x5ea4('0x12')]('['+_0x32a5e3[_0x5ea4('0x13')]()+_0x5ea4('0x5a'),util['inspect'](_0x4f7d14,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6288=['emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','request-promise','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','remoteUri','username','password','then','access_token','catch','error','toUpperCase','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid','forEach','type','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecalls','callDirection','queue','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s'];(function(_0x4d7e96,_0x2900c7){var _0x206646=function(_0x44be66){while(--_0x44be66){_0x4d7e96['push'](_0x4d7e96['shift']());}};_0x206646(++_0x2900c7);}(_0x6288,0x1dc));var _0x8628=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0x6288[_0x48b5e0];return _0x4287ea;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var rp=require(_0x8628('0x0'));var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x8628('0x1'));var logger=require('../../../../config/logger')(_0x8628('0x2'));var config=require(_0x8628('0x3'));config[_0x8628('0x4')]=_[_0x8628('0x5')](config[_0x8628('0x4')],{'host':_0x8628('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x4566a5,_0x194926,_0x213cee){var _0x4d189b={'method':_0x8628('0x7'),'uri':_0x194926,'form':{'client_id':_0x4566a5['clientId'],'resource':_0x4566a5[_0x8628('0x8')],'username':_0x4566a5[_0x8628('0x9')],'password':_0x4566a5[_0x8628('0xa')],'grant_type':_0x8628('0xa'),'client_secret':_0x4566a5['clientSecret']},'json':!![]};return rp(_0x4d189b)[_0x8628('0xb')](function(_0x43a5a9){return _0x43a5a9[_0x8628('0xc')];})[_0x8628('0xd')](function(_0x1fe1b9){logger[_0x8628('0xe')]('['+[_0x213cee[_0x8628('0xf')]()]+']\x20Wrong\x20credentials!');return _0x1fe1b9['message'];});}function getUser(_0x7965b,_0x1ce4b4,_0x3bec81,_0x47e9ab,_0x4e4b19,_0x42ce89){return new BPromise(function(_0x150401,_0xa8d8d2){return getAuthToken(_0x1ce4b4,_0x47e9ab,_0x42ce89)['then'](function(_0x314603){var _0x4ede9b={'method':'GET','uri':_0x4e4b19+_0x8628('0x10'),'headers':{'Authorization':_0x8628('0x11')+_0x314603,'OData-Version':'4.0'},'json':!![]};return rp(_0x4ede9b);})[_0x8628('0xb')](function(_0x21a4ae){var _0x16b1d7=_0x21a4ae[_0x8628('0x12')];var _0x2674d8=![];var _0x4061b8=null;if(!_[_0x8628('0x13')](_0x3bec81)){if(intUtil[_0x8628('0x14')](_0x3bec81[_0x8628('0x15')])){_0x7965b[_0x8628('0x16')]=_0x3bec81[_0x8628('0x15')];for(_0x4061b8=0x0;_0x4061b8<_0x16b1d7[_0x8628('0x17')];_0x4061b8++){if(_0x16b1d7[_0x4061b8][_0x8628('0x18')]===_0x3bec81[_0x8628('0x15')]&&!_0x16b1d7[_0x4061b8][_0x8628('0x19')]){_0x2674d8=!![];logger[_0x8628('0x1a')]('['+[_0x42ce89[_0x8628('0xf')]()]+_0x8628('0x1b')+_0x16b1d7[_0x4061b8][_0x8628('0x1c')]+'!');_0x7965b[_0x8628('0x1d')]=_0x16b1d7[_0x4061b8][_0x8628('0x1c')];}}}}if(!_0x2674d8){logger[_0x8628('0x1a')]('['+[_0x42ce89[_0x8628('0xf')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x7965b[_0x8628('0x16')]=_0x1ce4b4[_0x8628('0x9')];for(_0x4061b8=0x0;_0x4061b8<_0x16b1d7[_0x8628('0x17')];_0x4061b8++){if(_0x16b1d7[_0x4061b8]['internalemailaddress']===_0x1ce4b4['username']){_0x7965b[_0x8628('0x1d')]=_0x16b1d7[_0x4061b8][_0x8628('0x1c')];}}}_0x150401(_0x7965b);})['catch'](function(_0x1e09f9){_0xa8d8d2(_0x1e09f9[_0x8628('0x1e')]);});});}function createEndUser(_0x71445f,_0x598da6,_0x1cf661,_0x4fddeb,_0x5c7afa,_0x5aaebe){return new BPromise(function(_0x359f42,_0x1333d5){return getAuthToken(_0x598da6,_0x1cf661,_0x5aaebe)[_0x8628('0xb')](function(_0x5608f0){var _0x15cd54=_0x5aaebe[_0x8628('0x1f')]()===_0x8628('0x20')?_0x5c7afa[_0x8628('0x21')]:_0x5c7afa[_0x8628('0x22')];var _0x2cbae8={'method':_0x8628('0x7'),'uri':_0x4fddeb+_0x8628('0x23'),'body':{'telephone1':_0x15cd54,'fullname':_0x15cd54,'firstname':_0x15cd54,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8628('0x24')+_0x71445f[_0x8628('0x1d')]+')'},'headers':{'Authorization':_0x8628('0x11')+_0x5608f0,'OData-Version':_0x8628('0x25')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2cbae8);})[_0x8628('0xb')](function(_0x35ed81){var _0x564b91=_0x35ed81[_0x8628('0x26')][_0x8628('0x27')];var _0x555b53=_0x564b91[_0x8628('0x28')](_0x564b91[_0x8628('0x29')]('(')+0x1,_0x564b91['lastIndexOf'](')'));_0x71445f[_0x8628('0x2a')]=_0x555b53;_0x359f42(_0x71445f);})[_0x8628('0xd')](function(_0x527419){_0x1333d5(_0x527419[_0x8628('0x1e')]);});});}function getEndUser(_0x6516c9,_0x358133,_0x2242bc,_0x36c13f,_0x35bbab,_0x11d86e){return new BPromise(function(_0x30dd51,_0x55efd0){return getAuthToken(_0x358133,_0x2242bc,_0x11d86e)[_0x8628('0xb')](function(_0x3e665e){var _0x5ba6d4={'method':'GET','uri':_0x36c13f+_0x8628('0x2b'),'headers':{'Authorization':_0x8628('0x11')+_0x3e665e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5ba6d4);})[_0x8628('0xb')](function(_0x4fe314){var _0xeede09=null;if(_0x4fe314){var _0x291629=_0x4fe314['value'];var _0x31db1e=![];for(_0xeede09=0x0;_0xeede09<_0x291629[_0x8628('0x17')];_0xeede09++){var _0x16e87d=_0x11d86e[_0x8628('0x1f')]()===_0x8628('0x20')?_0x35bbab['destcalleridnum']:_0x35bbab[_0x8628('0x22')];if(_0x291629[_0xeede09][_0x8628('0x2c')]===_0x16e87d){_0x31db1e=!![];_0x6516c9[_0x8628('0x2a')]=_0x291629[_0xeede09][_0x8628('0x2d')];}}if(_0x31db1e){_0x30dd51(_0x6516c9);}else{return createEndUser(_0x6516c9,_0x358133,_0x2242bc,_0x36c13f,_0x35bbab,_0x11d86e)['then'](function(_0x35a1e9){logger[_0x8628('0x1a')]('['+[_0x11d86e[_0x8628('0xf')]()]+']\x20Enduser\x20created!',_0x35a1e9[_0x8628('0x2a')]);_0x30dd51(_0x35a1e9);});}}else{return createEndUser(_0x6516c9,_0x358133,_0x2242bc,_0x36c13f,_0x35bbab,_0x11d86e)[_0x8628('0xb')](function(_0x367099){logger[_0x8628('0x1a')]('['+[_0x11d86e[_0x8628('0xf')]()]+']\x20Enduser\x20Created!',_0x367099[_0x8628('0x2a')]);_0x30dd51(_0x367099);});}});});}function getCustomFields(_0xe0a45a,_0x388d6d,_0x185f6e){var _0x238c3c={};if(_0xe0a45a['length']>0x0){_[_0x8628('0x2e')](_0xe0a45a,function(_0x1fe733){if(_0x1fe733[_0x8628('0x2f')]===_0x8628('0x30')&&_0x1fe733[_0x8628('0x31')]&&!_0x1fe733[_0x8628('0x32')]){var _0x2dc3f4=_0x1fe733[_0x8628('0x33')][_0x8628('0x1f')]();var _0x193316=_0x2dc3f4['substring'](0x0,_0x2dc3f4[_0x8628('0x34')]('_'));var _0x371fd1=_0x2dc3f4[_0x8628('0x28')](_0x2dc3f4[_0x8628('0x34')]('_')+0x1);if(_0x193316===_0x185f6e){_0x238c3c[_0x371fd1]=_0x1fe733[_0x8628('0x35')];}}});}return _0x238c3c;}function getTicket(_0x3723f9,_0x199a60,_0x250391,_0xeae93e,_0x40bdd2,_0x18cd0c,_0x24a8f9){return new BPromise(function(_0x55cb3a,_0x9bb77e){var _0x5659f4;return getAuthToken(_0x199a60,_0x250391,_0x24a8f9)[_0x8628('0xb')](function(_0x216b41){if(_0x18cd0c[_0x8628('0x36')]===_0x8628('0x37')){_0x5659f4={'method':'POST','uri':_0xeae93e+_0x8628('0x38'),'body':Object[_0x8628('0x39')]({},{'title':intUtil[_0x8628('0x3a')](_0x18cd0c[_0x8628('0x3b')],_0x40bdd2,'\x20'),'description':intUtil[_0x8628('0x3a')](_0x18cd0c[_0x8628('0x3c')],_0x40bdd2,'\x0a'),'customerid_contact@odata.bind':_0x8628('0x3d')+_0x3723f9[_0x8628('0x2a')]+')','ownerid@odata.bind':'/systemusers('+_0x3723f9[_0x8628('0x1d')]+')','caseorigincode':'1'},getCustomFields(_0x18cd0c[_0x8628('0x3e')],_0x40bdd2,_0x18cd0c['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x216b41,'OData-Version':_0x8628('0x25')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x18cd0c[_0x8628('0x36')]==='phonecall'){_0x5659f4={'method':_0x8628('0x7'),'uri':_0xeae93e+_0x8628('0x3f'),'body':Object[_0x8628('0x39')]({},{'subject':intUtil[_0x8628('0x3a')](_0x18cd0c[_0x8628('0x3b')],_0x40bdd2,'\x20'),'phonenumber':String(_0x40bdd2[_0x8628('0x22')]),'description':intUtil[_0x8628('0x3a')](_0x18cd0c[_0x8628('0x3c')],_0x40bdd2,'\x0a'),'regardingobjectid_contact@odata.bind':_0x8628('0x3d')+_0x3723f9[_0x8628('0x2a')]+')','ownerid@odata.bind':_0x8628('0x24')+_0x3723f9[_0x8628('0x1d')]+')','directioncode':_0x3723f9[_0x8628('0x40')]==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x8628('0x24')+_0x3723f9[_0x8628('0x1d')]+')','participationtypemask':_0x3723f9[_0x8628('0x40')]===_0x8628('0x41')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x3723f9[_0x8628('0x2a')]+')','participationtypemask':_0x3723f9[_0x8628('0x40')]===_0x8628('0x41')?0x1:0x2}]},getCustomFields(_0x18cd0c[_0x8628('0x3e')],_0x40bdd2,_0x18cd0c['ticketType'])),'headers':{'Authorization':_0x8628('0x11')+_0x216b41,'OData-Version':_0x8628('0x25')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5659f4);})[_0x8628('0xb')](function(_0x56085a){var _0x53b47e=_0x56085a[_0x8628('0x26')][_0x8628('0x27')];var _0x1beceb=_0x53b47e[_0x8628('0x28')](_0x53b47e[_0x8628('0x29')]('(')+0x1,_0x53b47e[_0x8628('0x29')](')'));_0x3723f9[_0x8628('0x42')]=_0x1beceb;_0x55cb3a(_0x3723f9);})[_0x8628('0xd')](function(_0x3d958a){_0x9bb77e(_0x3d958a[_0x8628('0x1e')]);});});}function emit(_0x28d6ee,_0x1daa3f,_0x30e6be,_0x564474){var _0x4892ee={'uri':util['format'](_0x8628('0x43'),_0x28d6ee,_0x30e6be,_0x564474)};io['to'](util[_0x8628('0x44')](_0x8628('0x45'),_0x1daa3f))[_0x8628('0x46')](_0x8628('0x47'),_0x4892ee);}exports['cs']=function(_0x33dfe0,_0x1019b5,_0x570975,_0x2b1c6a,_0x1eb33a,_0x53718b,_0x4b600a,_0x35e429){var _0x356e22={};_0x53718b[_0x8628('0x8')]=intUtil[_0x8628('0x48')](_0x53718b[_0x8628('0x8')]);_0x53718b[_0x8628('0x49')]=intUtil[_0x8628('0x48')](_0x53718b['serverUrl']);_0x356e22[_0x8628('0x40')]=_0x35e429==='queue'||_0x35e429===_0x8628('0x4a')?_0x8628('0x41'):_0x8628('0x20');var _0x4d4441=util['format']('%s/api/data/v9.0/',_0x53718b[_0x8628('0x8')]);var _0x567ec2=util[_0x8628('0x44')]('https://login.microsoftonline.com/%s/oauth2/token',_0x53718b[_0x8628('0x4b')]);var _0x5e0e5b=util['format'](_0x8628('0x4c'),_0x53718b[_0x8628('0x49')],_0x1019b5[_0x8628('0x4d')],md5(_0x1019b5[_0x8628('0x4d')]));if(_0x1eb33a&&_0x1eb33a['monitor_format']){logger[_0x8628('0x1a')](_0x8628('0x4e'),'Recording\x20is\x20enabled!');_0x1019b5[_0x8628('0x4f')]=_0x5e0e5b;}else if(_0x4b600a&&_0x4b600a[_0x8628('0x50')]&&_0x4b600a['recordingFormat']!==_0x8628('0x51')){logger[_0x8628('0x1a')](_0x8628('0x52'),_0x8628('0x53'));_0x1019b5[_0x8628('0x4f')]=_0x5e0e5b;}else{_0x1019b5['recordingURL']='';}return getUser(_0x356e22,_0x53718b,_0x2b1c6a,_0x567ec2,_0x4d4441,_0x35e429)[_0x8628('0xb')](function(_0x1476d1){logger['info']('['+_0x35e429[_0x8628('0xf')]()+_0x8628('0x54'),_0x1476d1['userId']);logger[_0x8628('0x1a')]('['+_0x35e429['toUpperCase']()+_0x8628('0x55'),_0x1476d1[_0x8628('0x16')]);return getEndUser(_0x1476d1,_0x53718b,_0x567ec2,_0x4d4441,_0x1019b5,_0x35e429);})[_0x8628('0xb')](function(_0x131d7e){logger['info']('['+_0x35e429[_0x8628('0xf')]()+_0x8628('0x56'),_0x131d7e[_0x8628('0x2a')]);logger['info']('['+_0x35e429[_0x8628('0xf')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1019b5[_0x8628('0x22')]);return getTicket(_0x131d7e,_0x53718b,_0x567ec2,_0x4d4441,_0x1019b5,_0x570975,_0x35e429);})[_0x8628('0xb')](function(_0x4e74a3){logger['info'](util[_0x8628('0x44')]('['+_0x35e429['toUpperCase']()+_0x8628('0x57'),_0x570975['ticketType'],_0x4e74a3[_0x8628('0x42')]));logger[_0x8628('0x1a')](util[_0x8628('0x44')]('['+_0x35e429[_0x8628('0xf')]()+_0x8628('0x58'),_0x35e429));if(_0x35e429!==_0x8628('0x4a')){logger[_0x8628('0x1a')]('['+_0x35e429[_0x8628('0xf')]()+']',_0x8628('0x59'));emit(_0x53718b['remoteUri'],_0x2b1c6a['name'],_0x570975[_0x8628('0x36')],_0x4e74a3[_0x8628('0x42')]);}})['catch'](function(_0x1ef4cc){logger[_0x8628('0xe')]('['+_0x35e429[_0x8628('0xf')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x8628('0x5a')](_0x1ef4cc,{'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 7508739..c5242b8 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 _0x25c9=['queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','calleridname','catch','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','mapValues','custom_fields','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','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','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','apiKey','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','customField','toLowerCase','toString','push','idField','content','variable','variableName','customVariable','Variable'];(function(_0x2c51fc,_0x50c85f){var _0x454949=function(_0x156218){while(--_0x156218){_0x2c51fc['push'](_0x2c51fc['shift']());}};_0x454949(++_0x50c85f);}(_0x25c9,0x18a));var _0x925c=function(_0x4a4071,_0x27ba64){_0x4a4071=_0x4a4071-0x0;var _0xb7270a=_0x25c9[_0x4a4071];return _0xb7270a;};'use strict';var _=require(_0x925c('0x0'));var rp=require('request-promise');var md5=require(_0x925c('0x1'));var util=require(_0x925c('0x2'));var Redis=require(_0x925c('0x3'));var intUtil=require(_0x925c('0x4'));var config=require(_0x925c('0x5'));var logger=require(_0x925c('0x6'))(_0x925c('0x7'));config[_0x925c('0x8')]=_[_0x925c('0x9')](config[_0x925c('0x8')],{'host':_0x925c('0xa'),'port':0x18eb});var io=require(_0x925c('0xb'))(new Redis(config[_0x925c('0x8')]));var headers={'Content-Type':_0x925c('0xc'),'Accept':_0x925c('0xc')};function emit(_0x292627,_0x219dc1,_0x16baf2){io['to'](_0x292627)[_0x925c('0xd')](_0x219dc1,_0x16baf2);}function getTicket(_0x55dc96,_0x5405aa,_0x157f3c,_0x32bc7b,_0x173061){logger[_0x925c('0xe')]('Creating\x20new\x20ticket...');var _0xbf3218=_[_0x925c('0xf')]({'responder_id':_0x5405aa['id'],'requester_id':_0x157f3c['id'],'name':util[_0x925c('0x10')](_0x925c('0x11'),_0x173061['calleridname']),'phone':_0x173061[_0x925c('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x925c('0x13')](_0x32bc7b[_0x925c('0x14')],_0x173061,'\x20'),'description':intUtil[_0x925c('0x13')](_0x32bc7b[_0x925c('0x15')],_0x173061,_0x925c('0x16')),'tags':getTags(_0x32bc7b[_0x925c('0x17')],_0x925c('0x18'))},getCustomFields(_0x32bc7b[_0x925c('0x19')],_0x173061));_0xbf3218['custom_fields']=_[_0x925c('0x1a')](_['keyBy'](_0xbf3218[_0x925c('0x1b')],'id'),'value');return request({'uri':util[_0x925c('0x10')]('%s/api/v2/tickets',_0x55dc96[_0x925c('0x1c')]),'method':_0x925c('0x1d'),'body':_0xbf3218})[_0x925c('0x1e')](function(_0x5e7c0a){logger[_0x925c('0xe')](_0x925c('0x1f'));return _0x5e7c0a;});}function getUser(_0x17a2f5,_0x11252a){if(intUtil[_0x925c('0x20')](_0x11252a)){return request({'uri':util[_0x925c('0x10')](_0x925c('0x21'),_0x17a2f5[_0x925c('0x1c')]),'qs':{'email':_0x11252a}})['then'](function(_0x45089f){if(_0x45089f['length']){logger[_0x925c('0xe')](_0x925c('0x22'));return _[_0x925c('0x23')](_0x45089f,function(_0x2274b7){return _0x2274b7[_0x925c('0x24')][_0x925c('0x25')]===_0x11252a;});}else{logger[_0x925c('0xe')](_0x925c('0x26'));return request({'uri':util['format'](_0x925c('0x27'),_0x17a2f5[_0x925c('0x1c')])})[_0x925c('0x1e')](function(_0x3807e5){logger['info']('Admin\x20account\x20selected.');return _0x3807e5;});}});}else{logger[_0x925c('0xe')](_0x925c('0x28'));return request({'uri':util[_0x925c('0x10')](_0x925c('0x27'),_0x17a2f5[_0x925c('0x1c')])})['then'](function(_0x2f1c7d){logger[_0x925c('0xe')](_0x925c('0x29'));return _0x2f1c7d;});}}function getEndUser(_0x34183a,_0x25f4ad,_0x17f7b2){logger['info'](_0x925c('0x2a'),_0x17f7b2);return request({'uri':util[_0x925c('0x10')](_0x925c('0x2b'),_0x34183a[_0x925c('0x1c')]),'qs':{'phone':_0x17f7b2}})['then'](function(_0x1c3b55){if(_0x1c3b55[_0x925c('0x2c')]){logger['info']('Enduser\x20found!');return _[_0x925c('0x23')](_0x1c3b55,{'phone':_0x17f7b2});}else{logger['info'](_0x925c('0x2d'));return request({'uri':util[_0x925c('0x10')]('%s/api/v2/contacts',_0x34183a[_0x925c('0x1c')]),'method':_0x925c('0x1d'),'body':{'name':_0x25f4ad,'phone':_0x17f7b2}})[_0x925c('0x1e')](function(_0x4ca865){logger[_0x925c('0xe')]('Enduser\x20created.');return _0x4ca865;});}});}function getAuth(_0x315648){return util[_0x925c('0x10')]('Basic\x20%s',new Buffer(_0x315648[_0x925c('0x2e')]+':X')['toString']('base64'));}function request(_0x3c75f9){logger[_0x925c('0x2f')](_0x925c('0x30'),JSON[_0x925c('0x31')](_0x3c75f9));return rp(_[_0x925c('0x9')](_0x3c75f9,{'method':_0x925c('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x21abba,_0x3b22ca){var _0x227b25=[];if(_0x21abba&&_0x21abba[_0x925c('0x2c')]>0x0){_0x227b25=_[_0x925c('0x33')](_0x21abba,_0x3b22ca);}return _0x227b25;}function getCustomFields(_0x2476fd,_0x55b28d){var _0x463fac=[];var _0x3dcd11={'custom_fields':[]};if(_0x2476fd[_0x925c('0x2c')]>0x0){_[_0x925c('0x34')](_0x2476fd,function(_0x4ec00e){if(_0x4ec00e[_0x925c('0x35')]===_0x925c('0x36')&&_0x4ec00e[_0x925c('0x37')]&&!_0x4ec00e[_0x925c('0x38')]){_0x3dcd11[_0x4ec00e[_0x925c('0x37')][_0x925c('0x39')]()]=_0x4ec00e['content'][_0x925c('0x3a')]();}else if(_0x4ec00e['type']===_0x925c('0x36')&&_0x4ec00e['idField']&&_0x4ec00e['customField']){_0x3dcd11[_0x925c('0x1b')][_0x925c('0x3b')]({'id':_0x4ec00e[_0x925c('0x3c')],'value':_0x4ec00e[_0x925c('0x3d')][_0x925c('0x3a')]()});}else if(_0x4ec00e['type']===_0x925c('0x3e')&&_0x4ec00e[_0x925c('0x3f')]&&_0x4ec00e[_0x925c('0x3c')]&&_0x4ec00e[_0x925c('0x38')]){_0x55b28d[_0x4ec00e[_0x925c('0x3f')]]&&_0x3dcd11['custom_fields'][_0x925c('0x3b')]({'id':_0x4ec00e[_0x925c('0x3c')],'value':_0x55b28d[_0x4ec00e[_0x925c('0x3f')]]['toString']()});}else if(_0x4ec00e[_0x925c('0x35')]===_0x925c('0x40')&&_0x4ec00e[_0x925c('0x41')]&&_0x4ec00e['Variable'][_0x925c('0x18')]&&_0x4ec00e[_0x925c('0x3c')]&&_0x4ec00e[_0x925c('0x38')]){_0x55b28d[_0x4ec00e[_0x925c('0x41')]['name'][_0x925c('0x39')]()]&&_0x3dcd11[_0x925c('0x1b')][_0x925c('0x3b')]({'id':_0x4ec00e[_0x925c('0x3c')],'value':_0x55b28d[_0x4ec00e[_0x925c('0x41')]['name']['toLowerCase']()][_0x925c('0x3a')]()});}});}return _0x3dcd11;}exports[_0x925c('0x42')]=function(_0x3d9996,_0xf15b86,_0x3f8928,_0x4d2fb1,_0x51f4b3,_0x1a3324){var _0x1ece6c,_0x38feec;_0x1a3324[_0x925c('0x1c')]=intUtil[_0x925c('0x43')](_0x1a3324[_0x925c('0x1c')]);_0x1a3324[_0x925c('0x44')]=intUtil['stripTrailingSlash'](_0x1a3324[_0x925c('0x44')]);if(_0x51f4b3&&_0x51f4b3[_0x925c('0x45')]){logger[_0x925c('0xe')]('[QUEUE]',_0x925c('0x46'));_0xf15b86[_0x925c('0x47')]=util[_0x925c('0x10')](_0x925c('0x48'),_0x1a3324[_0x925c('0x44')],_0xf15b86[_0x925c('0x49')],md5(_0xf15b86[_0x925c('0x49')]));}else{_0xf15b86[_0x925c('0x47')]='';}headers[_0x925c('0x4a')]=getAuth(_0x1a3324);return getUser(_0x1a3324,_0x4d2fb1['email'])['then'](function(_0x6091dd){_0x1ece6c=_0x6091dd;logger[_0x925c('0xe')](_0x925c('0x4b'),_0x1ece6c['id']);return getEndUser(_0x1a3324,_0xf15b86['calleridname'],_0xf15b86['calleridnum']);})[_0x925c('0x1e')](function(_0x25fe5e){_0x38feec=_0x25fe5e;logger['info'](_0x925c('0x4c'),_0x38feec['id']);return getTicket(_0x1a3324,_0x1ece6c,_0x38feec,_0x3f8928,_0xf15b86);})[_0x925c('0x1e')](function(_0x57caad){if(_0x57caad&&_0x57caad['id']){logger[_0x925c('0xe')](_0x925c('0x1f'));logger[_0x925c('0xe')](_0x925c('0x4d'),_0x57caad['id']);logger[_0x925c('0xe')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x925c('0x10')](_0x925c('0x4e'),_0x4d2fb1[_0x925c('0x18')]),_0x925c('0x4f'),{'uri':util[_0x925c('0x10')](_0x925c('0x50'),_0x1a3324['remoteUri'],_0x57caad['id'])});}})['catch'](function(_0x250d7b){logger[_0x925c('0x51')]('[QUEUE]',JSON[_0x925c('0x31')](_0x250d7b));});};exports['outbound']=function(_0x5e3631,_0x21e1ad,_0x22b4d0,_0x28e0a0,_0x5dc24a,_0xde6063,_0x123b41){var _0x3c60a6,_0x5a187b;_0xde6063['remoteUri']=intUtil[_0x925c('0x43')](_0xde6063[_0x925c('0x1c')]);_0xde6063[_0x925c('0x44')]=intUtil['stripTrailingSlash'](_0xde6063['serverUrl']);if(_0x123b41&&_0x123b41[_0x925c('0x52')]&&_0x123b41[_0x925c('0x52')]!==_0x925c('0x53')){logger[_0x925c('0xe')](_0x925c('0x54'),'Recording\x20is\x20enabled!');_0x21e1ad[_0x925c('0x47')]=util[_0x925c('0x10')](_0x925c('0x48'),_0xde6063[_0x925c('0x44')],_0x21e1ad[_0x925c('0x49')],md5(_0x21e1ad[_0x925c('0x49')]));}headers[_0x925c('0x4a')]=getAuth(_0xde6063);return getUser(_0xde6063,_0x28e0a0[_0x925c('0x25')])[_0x925c('0x1e')](function(_0x582729){_0x3c60a6=_0x582729;logger['info'](_0x925c('0x4b'),_0x3c60a6['id']);return getEndUser(_0xde6063,_0x21e1ad['destcalleridname'],_0x21e1ad[_0x925c('0x55')]);})[_0x925c('0x1e')](function(_0x412517){_0x5a187b=_0x412517;logger['info'](_0x925c('0x4c'),_0x5a187b['id']);return getTicket(_0xde6063,_0x3c60a6,_0x5a187b,_0x22b4d0,_0x21e1ad);})[_0x925c('0x1e')](function(_0xe059a1){if(_0xe059a1&&_0xe059a1['id']){logger[_0x925c('0xe')](_0x925c('0x1f'));logger[_0x925c('0xe')]('The\x20Ticket\x20ID\x20is:',_0xe059a1['id']);logger['info'](_0x925c('0x54'),_0x925c('0x56'));emit(util['format'](_0x925c('0x4e'),_0x28e0a0[_0x925c('0x18')]),_0x925c('0x4f'),{'uri':util[_0x925c('0x10')](_0x925c('0x50'),_0xde6063[_0x925c('0x1c')],_0xe059a1['id'])});}})['catch'](function(_0x1602a9){logger[_0x925c('0x51')](_0x925c('0x54'),JSON[_0x925c('0x31')](_0x1602a9));});};exports[_0x925c('0x57')]=function(_0x46a09f,_0x10501e,_0x5693be,_0x4a1690,_0x35aac5,_0x5afaf7){var _0x4efae4,_0x44b3a2;_0x5afaf7[_0x925c('0x1c')]=intUtil[_0x925c('0x43')](_0x5afaf7['remoteUri']);_0x5afaf7[_0x925c('0x44')]=intUtil['stripTrailingSlash'](_0x5afaf7[_0x925c('0x44')]);if(_0x35aac5&&_0x35aac5[_0x925c('0x45')]){logger['info']('['+_0x10501e[_0x925c('0x58')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x10501e[_0x925c('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5afaf7[_0x925c('0x44')],_0x10501e[_0x925c('0x49')],md5(_0x10501e['uniqueid']));}else{_0x10501e[_0x925c('0x47')]='';}headers[_0x925c('0x4a')]=getAuth(_0x5afaf7);return getUser(_0x5afaf7,'')[_0x925c('0x1e')](function(_0x36370d){_0x4efae4=_0x36370d;logger['info'](_0x925c('0x4b'),_0x4efae4['id']);return getEndUser(_0x5afaf7,_0x10501e[_0x925c('0x59')],_0x10501e[_0x925c('0x12')]);})['then'](function(_0x156508){_0x44b3a2=_0x156508;logger[_0x925c('0xe')](_0x925c('0x4c'),_0x44b3a2['id']);return getTicket(_0x5afaf7,_0x4efae4,_0x44b3a2,_0x5693be,_0x10501e);})[_0x925c('0x1e')](function(_0x4552a6){if(_0x4552a6){logger[_0x925c('0xe')](_0x925c('0x1f'));logger[_0x925c('0xe')](_0x925c('0x4d'),_0x4552a6['id']);}})[_0x925c('0x5a')](function(_0x4df38f){logger[_0x925c('0x51')]('['+_0x10501e[_0x925c('0x58')][_0x925c('0x5b')]()+']',JSON['stringify'](_0x4df38f));});}; \ No newline at end of file +var _0x3a7b=['Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','GET','map','forEach','type','nameField','customField','toLowerCase','string','idField','push','content','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridname','destcalleridnum','monitor_format','lastevent','toUpperCase','lodash','md5','util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length'];(function(_0xa4793b,_0x1d330e){var _0x7e21f7=function(_0x442375){while(--_0x442375){_0xa4793b['push'](_0xa4793b['shift']());}};_0x7e21f7(++_0x1d330e);}(_0x3a7b,0x8c));var _0xb3a7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a7b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb3a7('0x0'));var rp=require('request-promise');var md5=require(_0xb3a7('0x1'));var util=require(_0xb3a7('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xb3a7('0x3'))(_0xb3a7('0x4'));config[_0xb3a7('0x5')]=_[_0xb3a7('0x6')](config[_0xb3a7('0x5')],{'host':_0xb3a7('0x7'),'port':0x18eb});var io=require(_0xb3a7('0x8'))(new Redis(config[_0xb3a7('0x5')]));var headers={'Content-Type':'application/json','Accept':_0xb3a7('0x9')};function emit(_0x1c5b1b,_0x4b7851,_0x264455){io['to'](_0x1c5b1b)[_0xb3a7('0xa')](_0x4b7851,_0x264455);}function getTicket(_0x6c23b5,_0x1612b4,_0x35b03c,_0x349376,_0xf3a80e){logger['info']('Creating\x20new\x20ticket...');var _0x2af734=_[_0xb3a7('0xb')]({'responder_id':_0x1612b4['id'],'requester_id':_0x35b03c['id'],'name':util[_0xb3a7('0xc')](_0xb3a7('0xd'),_0xf3a80e[_0xb3a7('0xe')]),'phone':_0xf3a80e[_0xb3a7('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb3a7('0x10')](_0x349376['Subjects'],_0xf3a80e,'\x20'),'description':intUtil[_0xb3a7('0x10')](_0x349376[_0xb3a7('0x11')],_0xf3a80e,_0xb3a7('0x12')),'tags':getTags(_0x349376['Tags'],_0xb3a7('0x13'))},getCustomFields(_0x349376[_0xb3a7('0x14')],_0xf3a80e));_0x2af734[_0xb3a7('0x15')]=_[_0xb3a7('0x16')](_[_0xb3a7('0x17')](_0x2af734[_0xb3a7('0x15')],'id'),'value');return request({'uri':util[_0xb3a7('0xc')](_0xb3a7('0x18'),_0x6c23b5[_0xb3a7('0x19')]),'method':'POST','body':_0x2af734})[_0xb3a7('0x1a')](function(_0x1380d2){logger[_0xb3a7('0x1b')](_0xb3a7('0x1c'));return _0x1380d2;});}function getUser(_0x3e9242,_0x326fd7){if(intUtil[_0xb3a7('0x1d')](_0x326fd7)){return request({'uri':util[_0xb3a7('0xc')](_0xb3a7('0x1e'),_0x3e9242[_0xb3a7('0x19')]),'qs':{'email':_0x326fd7}})['then'](function(_0x10b742){if(_0x10b742[_0xb3a7('0x1f')]){logger[_0xb3a7('0x1b')](_0xb3a7('0x20'));return _[_0xb3a7('0x21')](_0x10b742,function(_0x14d12a){return _0x14d12a[_0xb3a7('0x22')]['email']===_0x326fd7;});}else{logger[_0xb3a7('0x1b')](_0xb3a7('0x23'));return request({'uri':util[_0xb3a7('0xc')]('%s/api/v2/agents/me',_0x3e9242['remoteUri'])})['then'](function(_0xa2e4e7){logger[_0xb3a7('0x1b')](_0xb3a7('0x24'));return _0xa2e4e7;});}});}else{logger[_0xb3a7('0x1b')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb3a7('0xc')](_0xb3a7('0x25'),_0x3e9242[_0xb3a7('0x19')])})[_0xb3a7('0x1a')](function(_0x15d40d){logger[_0xb3a7('0x1b')](_0xb3a7('0x24'));return _0x15d40d;});}}function getEndUser(_0x30b2f2,_0x51178c,_0x4b1f31){logger[_0xb3a7('0x1b')](_0xb3a7('0x26'),_0x4b1f31);return request({'uri':util['format'](_0xb3a7('0x27'),_0x30b2f2['remoteUri']),'qs':{'phone':_0x4b1f31}})['then'](function(_0x4f8bc1){if(_0x4f8bc1[_0xb3a7('0x1f')]){logger[_0xb3a7('0x1b')]('Enduser\x20found!');return _[_0xb3a7('0x21')](_0x4f8bc1,{'phone':_0x4b1f31});}else{logger['info'](_0xb3a7('0x28'));return request({'uri':util[_0xb3a7('0xc')]('%s/api/v2/contacts',_0x30b2f2[_0xb3a7('0x19')]),'method':'POST','body':{'name':_0x51178c,'phone':_0x4b1f31}})[_0xb3a7('0x1a')](function(_0x3b29ab){logger[_0xb3a7('0x1b')]('Enduser\x20created.');return _0x3b29ab;});}});}function getAuth(_0x5c3f5e){return util[_0xb3a7('0xc')](_0xb3a7('0x29'),new Buffer(_0x5c3f5e[_0xb3a7('0x2a')]+':X')[_0xb3a7('0x2b')]('base64'));}function request(_0x4f82ce){logger['debug']('[HTTP]',JSON['stringify'](_0x4f82ce));return rp(_[_0xb3a7('0x6')](_0x4f82ce,{'method':_0xb3a7('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0xae2b65,_0x11f953){var _0x34c867=[];if(_0xae2b65&&_0xae2b65[_0xb3a7('0x1f')]>0x0){_0x34c867=_[_0xb3a7('0x2d')](_0xae2b65,_0x11f953);}return _0x34c867;}function getCustomFields(_0x909c9d,_0x29e133){var _0x30f99d=[];var _0x45597f={'custom_fields':[]};if(_0x909c9d[_0xb3a7('0x1f')]>0x0){_[_0xb3a7('0x2e')](_0x909c9d,function(_0x555e00){if(_0x555e00[_0xb3a7('0x2f')]==='string'&&_0x555e00[_0xb3a7('0x30')]&&!_0x555e00[_0xb3a7('0x31')]){_0x45597f[_0x555e00[_0xb3a7('0x30')][_0xb3a7('0x32')]()]=_0x555e00['content'][_0xb3a7('0x2b')]();}else if(_0x555e00['type']===_0xb3a7('0x33')&&_0x555e00[_0xb3a7('0x34')]&&_0x555e00[_0xb3a7('0x31')]){_0x45597f['custom_fields'][_0xb3a7('0x35')]({'id':_0x555e00[_0xb3a7('0x34')],'value':_0x555e00[_0xb3a7('0x36')][_0xb3a7('0x2b')]()});}else if(_0x555e00[_0xb3a7('0x2f')]===_0xb3a7('0x37')&&_0x555e00[_0xb3a7('0x38')]&&_0x555e00[_0xb3a7('0x34')]&&_0x555e00['customField']){_0x29e133[_0x555e00[_0xb3a7('0x38')]]&&_0x45597f[_0xb3a7('0x15')][_0xb3a7('0x35')]({'id':_0x555e00[_0xb3a7('0x34')],'value':_0x29e133[_0x555e00[_0xb3a7('0x38')]]['toString']()});}else if(_0x555e00[_0xb3a7('0x2f')]==='customVariable'&&_0x555e00[_0xb3a7('0x39')]&&_0x555e00[_0xb3a7('0x39')]['name']&&_0x555e00[_0xb3a7('0x34')]&&_0x555e00[_0xb3a7('0x31')]){_0x29e133[_0x555e00[_0xb3a7('0x39')][_0xb3a7('0x13')][_0xb3a7('0x32')]()]&&_0x45597f[_0xb3a7('0x15')][_0xb3a7('0x35')]({'id':_0x555e00['idField'],'value':_0x29e133[_0x555e00[_0xb3a7('0x39')][_0xb3a7('0x13')]['toLowerCase']()][_0xb3a7('0x2b')]()});}});}return _0x45597f;}exports[_0xb3a7('0x3a')]=function(_0x2450e1,_0x41d680,_0x915ee8,_0x51517d,_0x5da013,_0x616671){var _0x27dc31,_0x29a3b8;_0x616671[_0xb3a7('0x19')]=intUtil[_0xb3a7('0x3b')](_0x616671['remoteUri']);_0x616671[_0xb3a7('0x3c')]=intUtil[_0xb3a7('0x3b')](_0x616671[_0xb3a7('0x3c')]);if(_0x5da013&&_0x5da013['monitor_format']){logger[_0xb3a7('0x1b')](_0xb3a7('0x3d'),_0xb3a7('0x3e'));_0x41d680['recordingURL']=util['format'](_0xb3a7('0x3f'),_0x616671[_0xb3a7('0x3c')],_0x41d680[_0xb3a7('0x40')],md5(_0x41d680[_0xb3a7('0x40')]));}else{_0x41d680[_0xb3a7('0x41')]='';}headers['Authorization']=getAuth(_0x616671);return getUser(_0x616671,_0x51517d['email'])[_0xb3a7('0x1a')](function(_0x169c64){_0x27dc31=_0x169c64;logger[_0xb3a7('0x1b')](_0xb3a7('0x42'),_0x27dc31['id']);return getEndUser(_0x616671,_0x41d680[_0xb3a7('0xe')],_0x41d680[_0xb3a7('0xf')]);})[_0xb3a7('0x1a')](function(_0x251a79){_0x29a3b8=_0x251a79;logger[_0xb3a7('0x1b')](_0xb3a7('0x43'),_0x29a3b8['id']);return getTicket(_0x616671,_0x27dc31,_0x29a3b8,_0x915ee8,_0x41d680);})['then'](function(_0x27b777){if(_0x27b777&&_0x27b777['id']){logger['info'](_0xb3a7('0x1c'));logger[_0xb3a7('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x27b777['id']);logger[_0xb3a7('0x1b')]('[QUEUE]',_0xb3a7('0x44'));emit(util['format'](_0xb3a7('0x45'),_0x51517d[_0xb3a7('0x13')]),_0xb3a7('0x46'),{'uri':util[_0xb3a7('0xc')](_0xb3a7('0x47'),_0x616671[_0xb3a7('0x19')],_0x27b777['id'])});}})[_0xb3a7('0x48')](function(_0x23ca97){logger[_0xb3a7('0x49')](_0xb3a7('0x3d'),JSON[_0xb3a7('0x4a')](_0x23ca97));});};exports[_0xb3a7('0x4b')]=function(_0x311c67,_0x168429,_0x40a4b0,_0x5ec59a,_0x15e1bd,_0xbe6ae6,_0xcec31c){var _0x1d2606,_0x1ba8ea;_0xbe6ae6[_0xb3a7('0x19')]=intUtil['stripTrailingSlash'](_0xbe6ae6[_0xb3a7('0x19')]);_0xbe6ae6[_0xb3a7('0x3c')]=intUtil[_0xb3a7('0x3b')](_0xbe6ae6['serverUrl']);if(_0xcec31c&&_0xcec31c[_0xb3a7('0x4c')]&&_0xcec31c[_0xb3a7('0x4c')]!==_0xb3a7('0x4d')){logger[_0xb3a7('0x1b')](_0xb3a7('0x4e'),_0xb3a7('0x3e'));_0x168429[_0xb3a7('0x41')]=util['format'](_0xb3a7('0x3f'),_0xbe6ae6['serverUrl'],_0x168429['uniqueid'],md5(_0x168429[_0xb3a7('0x40')]));}headers[_0xb3a7('0x4f')]=getAuth(_0xbe6ae6);return getUser(_0xbe6ae6,_0x5ec59a[_0xb3a7('0x50')])[_0xb3a7('0x1a')](function(_0x4e9e3e){_0x1d2606=_0x4e9e3e;logger[_0xb3a7('0x1b')](_0xb3a7('0x42'),_0x1d2606['id']);return getEndUser(_0xbe6ae6,_0x168429[_0xb3a7('0x51')],_0x168429[_0xb3a7('0x52')]);})[_0xb3a7('0x1a')](function(_0x2cd23e){_0x1ba8ea=_0x2cd23e;logger[_0xb3a7('0x1b')](_0xb3a7('0x43'),_0x1ba8ea['id']);return getTicket(_0xbe6ae6,_0x1d2606,_0x1ba8ea,_0x40a4b0,_0x168429);})[_0xb3a7('0x1a')](function(_0x4f7d91){if(_0x4f7d91&&_0x4f7d91['id']){logger[_0xb3a7('0x1b')]('Ticket\x20created!');logger[_0xb3a7('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x4f7d91['id']);logger[_0xb3a7('0x1b')](_0xb3a7('0x4e'),_0xb3a7('0x44'));emit(util[_0xb3a7('0xc')](_0xb3a7('0x45'),_0x5ec59a[_0xb3a7('0x13')]),_0xb3a7('0x46'),{'uri':util[_0xb3a7('0xc')]('%s/helpdesk/tickets/%d',_0xbe6ae6[_0xb3a7('0x19')],_0x4f7d91['id'])});}})[_0xb3a7('0x48')](function(_0x338c98){logger['error'](_0xb3a7('0x4e'),JSON[_0xb3a7('0x4a')](_0x338c98));});};exports['unmanaged']=function(_0x7a87bc,_0x4efcd8,_0x1f45f3,_0x20d61f,_0x58db89,_0xeb7f02){var _0x76a5ea,_0x5961f2;_0xeb7f02['remoteUri']=intUtil['stripTrailingSlash'](_0xeb7f02[_0xb3a7('0x19')]);_0xeb7f02[_0xb3a7('0x3c')]=intUtil[_0xb3a7('0x3b')](_0xeb7f02['serverUrl']);if(_0x58db89&&_0x58db89[_0xb3a7('0x53')]){logger['info']('['+_0x4efcd8[_0xb3a7('0x54')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4efcd8[_0xb3a7('0x41')]=util[_0xb3a7('0xc')](_0xb3a7('0x3f'),_0xeb7f02[_0xb3a7('0x3c')],_0x4efcd8[_0xb3a7('0x40')],md5(_0x4efcd8['uniqueid']));}else{_0x4efcd8[_0xb3a7('0x41')]='';}headers[_0xb3a7('0x4f')]=getAuth(_0xeb7f02);return getUser(_0xeb7f02,'')[_0xb3a7('0x1a')](function(_0x482e75){_0x76a5ea=_0x482e75;logger[_0xb3a7('0x1b')](_0xb3a7('0x42'),_0x76a5ea['id']);return getEndUser(_0xeb7f02,_0x4efcd8[_0xb3a7('0xe')],_0x4efcd8[_0xb3a7('0xf')]);})[_0xb3a7('0x1a')](function(_0x403de9){_0x5961f2=_0x403de9;logger[_0xb3a7('0x1b')](_0xb3a7('0x43'),_0x5961f2['id']);return getTicket(_0xeb7f02,_0x76a5ea,_0x5961f2,_0x1f45f3,_0x4efcd8);})[_0xb3a7('0x1a')](function(_0x214f11){if(_0x214f11){logger[_0xb3a7('0x1b')]('Ticket\x20created!');logger[_0xb3a7('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x214f11['id']);}})[_0xb3a7('0x48')](function(_0xdc9f3a){logger[_0xb3a7('0x49')]('['+_0x4efcd8[_0xb3a7('0x54')][_0xb3a7('0x55')]()+']',JSON[_0xb3a7('0x4a')](_0xdc9f3a));});}; \ 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 0bfeb2c..6054d99 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 _0x3118=['callDirection','queue','%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','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','socket.io-emitter','redis','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','headers','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','adminEmail','error','message','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','mobile_number','Contact\x20created:','endUserId','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','getString','Subjects','Contact','format','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','calleridnum'];(function(_0x558f80,_0x26c352){var _0xb0794f=function(_0x484d85){while(--_0x484d85){_0x558f80['push'](_0x558f80['shift']());}};_0xb0794f(++_0x26c352);}(_0x3118,0x1da));var _0x8311=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x3118[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x8311('0x0'));var rp=require(_0x8311('0x1'));var md5=require(_0x8311('0x2'));var util=require(_0x8311('0x3'));var moment=require(_0x8311('0x4'));var Promise=require('bluebird');var Redis=require(_0x8311('0x5'));var intUtil=require(_0x8311('0x6'));var config=require(_0x8311('0x7'));var logger=require(_0x8311('0x8'))(_0x8311('0x9'));config['redis']=_[_0x8311('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8311('0xb'))(new Redis(config[_0x8311('0xc')]));function getAdminId(_0x2c0efa,_0x5bfb78,_0x58c08c,_0x8d10dc){return new Promise(function(_0x3df7c7,_0x3de019){var _0x46b83f=![];var _0x158968={'method':_0x8311('0xd'),'uri':_0x8d10dc+_0x8311('0xe'),'json':!![]};_0x158968['headers']=_0x58c08c;logger[_0x8311('0xf')](_0x8311('0x10'));return rp(_0x158968)[_0x8311('0x11')](function(_0x193d38){if(_0x193d38){var _0x301540=_0x193d38['users'];var _0x3aab12=null;for(_0x3aab12=0x0;_0x3aab12<_0x301540[_0x8311('0x12')];_0x3aab12++){if(_0x301540[_0x3aab12][_0x8311('0x13')]===_0x2c0efa['adminEmail']){_0x2c0efa[_0x8311('0x14')]=_0x301540[_0x3aab12]['id'];_0x46b83f=!![];}}if(_0x46b83f){logger[_0x8311('0xf')](_0x8311('0x15'),_0x2c0efa[_0x8311('0x14')]);_0x3df7c7(_0x2c0efa);}else{_0x3de019({'statusCode':0x194,'message':_0x8311('0x16')});}}else{_0x3de019({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x8311('0x17')](function(_0x37ad84){logger['error']('['+[_0x5bfb78[_0x8311('0x18')]()]+']',_0x37ad84['message']);_0x3de019(_0x37ad84);});});}function getUser(_0x1db798,_0x42ac7e,_0x594f45){return function(_0x35c7be){return new Promise(function(_0x2bd8e6,_0x291d2c){var _0x234c68={'method':_0x8311('0xd'),'uri':_0x594f45+'/api/selector/owners','json':!![]};_0x234c68[_0x8311('0x19')]=_0x42ac7e;logger['info'](_0x8311('0x1a'));return rp(_0x234c68)[_0x8311('0x11')](function(_0x32467f){if(_0x32467f){var _0x5c1c0b=_0x32467f[_0x8311('0x1b')];var _0x4b39ef=![];var _0x51cb17=null;if(_0x35c7be[_0x8311('0x1c')]!==null){logger[_0x8311('0xf')](_0x8311('0x1d'),_0x35c7be['agentEmail']);_0x35c7be[_0x8311('0x1e')]=_0x35c7be[_0x8311('0x1c')];for(_0x51cb17=0x0;_0x51cb17<_0x5c1c0b[_0x8311('0x12')];_0x51cb17++){if(_0x5c1c0b[_0x51cb17][_0x8311('0x13')]===_0x35c7be[_0x8311('0x1c')]){_0x4b39ef=!![];_0x35c7be['userId']=_0x5c1c0b[_0x51cb17]['id'];logger['info']('User\x20found:',_0x35c7be[_0x8311('0x1f')]);}}}if(!_0x4b39ef){logger['info'](_0x8311('0x20'));_0x35c7be[_0x8311('0x1e')]=_0x35c7be[_0x8311('0x21')];_0x35c7be[_0x8311('0x1f')]=_0x35c7be['adminId'];_0x4b39ef=!![];}if(_0x4b39ef){_0x2bd8e6(_0x35c7be);}else{_0x291d2c({'statusCode':0x194,'message':_0x8311('0x16')});}}else{_0x291d2c({'statusCode':0x194,'message':_0x8311('0x16')});}})[_0x8311('0x17')](function(_0xb69337){logger[_0x8311('0x22')]('['+[_0x1db798[_0x8311('0x18')]()]+']',_0xb69337[_0x8311('0x23')]);_0x291d2c(_0xb69337);});});};}function getEndUser(_0x343abf,_0x1a1be4,_0x32b01c){return function(_0x4e6556){return new Promise(function(_0x3fffc2,_0x5a7b74){var _0x632d9f=0x0;var _0x506828={'method':_0x8311('0xd'),'uri':_0x32b01c+_0x8311('0x24'),'json':!![]};_0x506828[_0x8311('0x19')]=_0x1a1be4;logger[_0x8311('0xf')](_0x8311('0x25'));return rp(_0x506828)['then'](function(_0x118d0f){_0x118d0f[_0x8311('0x26')][_0x8311('0x27')](function(_0x2a7f01){if(_0x2a7f01[_0x8311('0x28')]===_0x8311('0x29')){_0x632d9f=_0x2a7f01['id'];}});})[_0x8311('0x11')](function(){logger[_0x8311('0xf')]('Getting\x20contact\x20list');var _0x222cd4={'method':_0x8311('0xd'),'uri':_0x32b01c+_0x8311('0x2a')+_0x632d9f,'json':!![]};_0x222cd4['headers']=_0x1a1be4;return rp(_0x222cd4);})['then'](function(_0x12f503){logger['info'](_0x8311('0x2b'),_0x4e6556[_0x8311('0x2c')]);if(_0x12f503[_0x8311('0x2d')][_0x8311('0x12')]>0x0){var _0x40594e=_[_0x8311('0x2e')](_0x12f503['contacts'],function(_0x4cc759){if(_0x4cc759[_0x8311('0x2f')]===_0x4e6556[_0x8311('0x2c')]||_0x4cc759[_0x8311('0x30')]===_0x4e6556[_0x8311('0x2c')]){return _0x4cc759;}});if(_0x40594e){_0x4e6556['endUserId']=_0x40594e['id'];logger['info']('Contact\x20found:',_0x4e6556['endUserId']);_0x3fffc2(_0x4e6556);}else{return createEndUser(_0x4e6556,_0x343abf,_0x1a1be4,_0x32b01c)[_0x8311('0x11')](function(_0x4d3221){logger[_0x8311('0xf')](_0x8311('0x31'),_0x4e6556[_0x8311('0x32')]);_0x3fffc2(_0x4d3221);});}}else{return createEndUser(_0x4e6556,_0x343abf,_0x1a1be4,_0x32b01c)[_0x8311('0x11')](function(_0x57e344){logger['info'](_0x8311('0x31'),_0x4e6556['endUserId']);_0x3fffc2(_0x57e344);});}})[_0x8311('0x17')](function(_0x52e365){throw new Error(_0x52e365[_0x8311('0x23')]);});});};}function createEndUser(_0xc15f8a,_0x38d715,_0x1b38fe,_0x208a54){return new Promise(function(_0x19bf80,_0x4fd2c1){var _0xcc7d5f=moment();var _0x1755da={'method':'POST','uri':_0x208a54+_0x8311('0x33'),'body':{'contact':{'last_name':_0xc15f8a[_0x8311('0x2c')],'work_number':_0xc15f8a['contactNumber'],'mobile_number':_0xc15f8a[_0x8311('0x2c')],'owner_id':_0xc15f8a[_0x8311('0x1f')],'created_at':_0xcc7d5f['format'](_0x8311('0x34'))}},'json':!![]};_0x1755da['headers']=_0x1b38fe;logger[_0x8311('0xf')](_0x8311('0x35'));return rp(_0x1755da)[_0x8311('0x11')](function(_0x28d36d){_0xc15f8a[_0x8311('0x32')]=_0x28d36d[_0x8311('0x36')]['id'];_0x19bf80(_0xc15f8a);})['catch'](function(_0x3c7b52){logger[_0x8311('0x22')]('['+[_0x38d715[_0x8311('0x18')]()]+']',_0x3c7b52[_0x8311('0x23')]);_0x4fd2c1(_0x3c7b52[_0x8311('0x23')]);});});}function getTicket(_0x27186b,_0x34f73e,_0x45dccf,_0x247879,_0x289971){return function(_0x897a86){logger[_0x8311('0xf')](_0x8311('0x37'));return new Promise(function(_0x133de1,_0x1b850f){var _0x421d95=moment();var _0x4b3ebb={'method':_0x8311('0x38'),'uri':_0x45dccf+'/api/tasks','body':{'title':intUtil[_0x8311('0x39')](_0x247879[_0x8311('0x3a')],_0x289971,'\x20'),'description':intUtil['getString'](_0x247879['Descriptions'],_0x289971,'\x0a'),'owner_id':_0x897a86['userId'],'creater_id':_0x897a86['adminId'],'targetable_id':_0x897a86[_0x8311('0x32')],'targetable_type':_0x8311('0x3b'),'created_at':_0x421d95[_0x8311('0x3c')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x421d95[_0x8311('0x3d')](0x1e,'m')['format'](_0x8311('0x34'))},'json':!![]};_0x4b3ebb[_0x8311('0x19')]=_0x34f73e;return rp(_0x4b3ebb)[_0x8311('0x11')](function(_0x32c4a7){_0x897a86[_0x8311('0x3e')]=_0x32c4a7[_0x8311('0x3f')]['id'];logger[_0x8311('0xf')](_0x8311('0x40'),_0x897a86[_0x8311('0x3e')]);_0x133de1(_0x897a86);})[_0x8311('0x17')](function(_0x436387){logger['error']('['+[_0x27186b['toUpperCase']()]+']',_0x436387[_0x8311('0x23')]);_0x1b850f(_0x436387[_0x8311('0x23')]);});});};}function emit(_0x50ac52,_0x1fee6e,_0xa90741){var _0x4e351f={'uri':_0x50ac52+_0x8311('0x41')+_0xa90741};io['to'](util['format'](_0x8311('0x42'),_0x1fee6e))[_0x8311('0x43')](_0x8311('0x44'),_0x4e351f);}exports['cs']=function(_0x4ad4d4,_0x49a106,_0x50d25b,_0x32d234,_0x4cb126,_0x3223c7,_0x55dd64,_0x288b60){var _0x2de56f={};var _0x2f8cd2={'Authorization':_0x8311('0x45')+_0x3223c7[_0x8311('0x46')]};_0x3223c7['remoteUri']=intUtil['stripTrailingSlash'](_0x3223c7[_0x8311('0x47')]);_0x3223c7[_0x8311('0x48')]=intUtil[_0x8311('0x49')](_0x3223c7[_0x8311('0x48')]);var _0x56dcf5=_0x3223c7[_0x8311('0x47')];_0x2de56f[_0x8311('0x21')]=_0x3223c7['username'];_0x2de56f['contactNumber']=_0x288b60[_0x8311('0x4a')]()===_0x8311('0x4b')?_0x49a106[_0x8311('0x4c')]:_0x49a106[_0x8311('0x4d')];_0x2de56f[_0x8311('0x4e')]=_0x288b60===_0x8311('0x4f')||_0x288b60==='unmanaged'?_0x8311('0x4f'):_0x8311('0x4b');if(_0x32d234){_0x2de56f[_0x8311('0x1c')]=_0x32d234[_0x8311('0x13')];}var _0x30989b=util['format'](_0x8311('0x50'),_0x3223c7['serverUrl'],_0x49a106[_0x8311('0x51')],md5(_0x49a106[_0x8311('0x51')]));if(_0x4cb126&&_0x4cb126[_0x8311('0x52')]){logger[_0x8311('0xf')](_0x8311('0x53'),_0x8311('0x54'));_0x49a106[_0x8311('0x55')]=_0x30989b;}else if(_0x55dd64&&_0x55dd64[_0x8311('0x56')]&&_0x55dd64[_0x8311('0x56')]!==_0x8311('0x57')){logger[_0x8311('0xf')](_0x8311('0x58'),_0x8311('0x54'));_0x49a106['recordingURL']=_0x30989b;}else{_0x49a106[_0x8311('0x55')]='';}return getAdminId(_0x2de56f,_0x288b60,_0x2f8cd2,_0x56dcf5)['then'](getUser(_0x288b60,_0x2f8cd2,_0x56dcf5))[_0x8311('0x11')](getEndUser(_0x288b60,_0x2f8cd2,_0x56dcf5))[_0x8311('0x11')](getTicket(_0x288b60,_0x2f8cd2,_0x56dcf5,_0x50d25b,_0x49a106))[_0x8311('0x11')](function(_0x324f71){logger[_0x8311('0xf')](util['format'](_0x8311('0x59'),_0x324f71[_0x8311('0x3e')]));if(_0x288b60!=='unmanaged'){logger[_0x8311('0xf')]('['+[_0x288b60[_0x8311('0x18')]()]+']',_0x8311('0x5a'));emit(_0x56dcf5,_0x32d234[_0x8311('0x28')],_0x324f71[_0x8311('0x32')]);}})[_0x8311('0x17')](function(_0x37fe3b){logger[_0x8311('0x22')]('['+[_0x288b60[_0x8311('0x18')]()]+_0x8311('0x5b'),util['inspect'](_0x37fe3b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa0f6=['lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/logger','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','email','adminEmail','adminId','Admin\x20found:','catch','message','GET','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','Requested\x20Resource\x20not\x20Found','error','toUpperCase','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','endUserId','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','format','YYYY-MM-DDTHH:mm:ss','ticketId','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration'];(function(_0x2d850f,_0x228bf7){var _0xf2df20=function(_0x3a1c3a){while(--_0x3a1c3a){_0x2d850f['push'](_0x2d850f['shift']());}};_0xf2df20(++_0x228bf7);}(_0xa0f6,0x164));var _0x6a0f=function(_0x3bd23c,_0x32aeac){_0x3bd23c=_0x3bd23c-0x0;var _0x599e6f=_0xa0f6[_0x3bd23c];return _0x599e6f;};'use strict';var _=require(_0x6a0f('0x0'));var rp=require(_0x6a0f('0x1'));var md5=require('md5');var util=require(_0x6a0f('0x2'));var moment=require(_0x6a0f('0x3'));var Promise=require(_0x6a0f('0x4'));var Redis=require(_0x6a0f('0x5'));var intUtil=require(_0x6a0f('0x6'));var config=require('../../../../config/environment');var logger=require(_0x6a0f('0x7'))('freshsales');config[_0x6a0f('0x8')]=_['defaults'](config['redis'],{'host':_0x6a0f('0x9'),'port':0x18eb});var io=require(_0x6a0f('0xa'))(new Redis(config[_0x6a0f('0x8')]));function getAdminId(_0x590b55,_0x39bbca,_0x24be4d,_0xbc76c9){return new Promise(function(_0x540e6f,_0x50e0e3){var _0x42e5ac=![];var _0x2a874e={'method':'GET','uri':_0xbc76c9+_0x6a0f('0xb'),'json':!![]};_0x2a874e[_0x6a0f('0xc')]=_0x24be4d;logger[_0x6a0f('0xd')](_0x6a0f('0xe'));return rp(_0x2a874e)[_0x6a0f('0xf')](function(_0x16f644){if(_0x16f644){var _0x3fd245=_0x16f644['users'];var _0x3e2ac5=null;for(_0x3e2ac5=0x0;_0x3e2ac5<_0x3fd245['length'];_0x3e2ac5++){if(_0x3fd245[_0x3e2ac5][_0x6a0f('0x10')]===_0x590b55[_0x6a0f('0x11')]){_0x590b55[_0x6a0f('0x12')]=_0x3fd245[_0x3e2ac5]['id'];_0x42e5ac=!![];}}if(_0x42e5ac){logger[_0x6a0f('0xd')](_0x6a0f('0x13'),_0x590b55[_0x6a0f('0x12')]);_0x540e6f(_0x590b55);}else{_0x50e0e3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x50e0e3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x6a0f('0x14')](function(_0x1bb682){logger['error']('['+[_0x39bbca['toUpperCase']()]+']',_0x1bb682[_0x6a0f('0x15')]);_0x50e0e3(_0x1bb682);});});}function getUser(_0x34a793,_0x16e5c4,_0x5a7c01){return function(_0x162ae4){return new Promise(function(_0x291a35,_0x5bf4c9){var _0x2c638f={'method':_0x6a0f('0x16'),'uri':_0x5a7c01+'/api/selector/owners','json':!![]};_0x2c638f[_0x6a0f('0xc')]=_0x16e5c4;logger[_0x6a0f('0xd')](_0x6a0f('0x17'));return rp(_0x2c638f)['then'](function(_0x34e6ef){if(_0x34e6ef){var _0x580bde=_0x34e6ef['users'];var _0x45fc64=![];var _0x30c718=null;if(_0x162ae4[_0x6a0f('0x18')]!==null){logger[_0x6a0f('0xd')](_0x6a0f('0x19'),_0x162ae4['agentEmail']);_0x162ae4[_0x6a0f('0x1a')]=_0x162ae4[_0x6a0f('0x18')];for(_0x30c718=0x0;_0x30c718<_0x580bde[_0x6a0f('0x1b')];_0x30c718++){if(_0x580bde[_0x30c718][_0x6a0f('0x10')]===_0x162ae4['agentEmail']){_0x45fc64=!![];_0x162ae4[_0x6a0f('0x1c')]=_0x580bde[_0x30c718]['id'];logger[_0x6a0f('0xd')](_0x6a0f('0x1d'),_0x162ae4['userId']);}}}if(!_0x45fc64){logger['info'](_0x6a0f('0x1e'));_0x162ae4[_0x6a0f('0x1a')]=_0x162ae4['adminEmail'];_0x162ae4[_0x6a0f('0x1c')]=_0x162ae4[_0x6a0f('0x12')];_0x45fc64=!![];}if(_0x45fc64){_0x291a35(_0x162ae4);}else{_0x5bf4c9({'statusCode':0x194,'message':_0x6a0f('0x1f')});}}else{_0x5bf4c9({'statusCode':0x194,'message':_0x6a0f('0x1f')});}})[_0x6a0f('0x14')](function(_0x5bce42){logger[_0x6a0f('0x20')]('['+[_0x34a793[_0x6a0f('0x21')]()]+']',_0x5bce42[_0x6a0f('0x15')]);_0x5bf4c9(_0x5bce42);});});};}function getEndUser(_0x2049b4,_0x30819d,_0x53b07c){return function(_0x4e7118){return new Promise(function(_0x31ae10,_0x17e546){var _0x2ccea7=0x0;var _0x4788be={'method':_0x6a0f('0x16'),'uri':_0x53b07c+_0x6a0f('0x22'),'json':!![]};_0x4788be[_0x6a0f('0xc')]=_0x30819d;logger[_0x6a0f('0xd')](_0x6a0f('0x23'));return rp(_0x4788be)['then'](function(_0x57c5b3){_0x57c5b3[_0x6a0f('0x24')][_0x6a0f('0x25')](function(_0x5d91dd){if(_0x5d91dd[_0x6a0f('0x26')]===_0x6a0f('0x27')){_0x2ccea7=_0x5d91dd['id'];}});})[_0x6a0f('0xf')](function(){logger[_0x6a0f('0xd')](_0x6a0f('0x28'));var _0x136c11={'method':_0x6a0f('0x16'),'uri':_0x53b07c+_0x6a0f('0x29')+_0x2ccea7,'json':!![]};_0x136c11[_0x6a0f('0xc')]=_0x30819d;return rp(_0x136c11);})[_0x6a0f('0xf')](function(_0x4b53f8){logger['info'](_0x6a0f('0x2a'),_0x4e7118[_0x6a0f('0x2b')]);if(_0x4b53f8[_0x6a0f('0x2c')][_0x6a0f('0x1b')]>0x0){var _0x466c7a=_['find'](_0x4b53f8['contacts'],function(_0x11d27c){if(_0x11d27c['work_number']===_0x4e7118[_0x6a0f('0x2b')]||_0x11d27c['mobile_number']===_0x4e7118['contactNumber']){return _0x11d27c;}});if(_0x466c7a){_0x4e7118[_0x6a0f('0x2d')]=_0x466c7a['id'];logger[_0x6a0f('0xd')]('Contact\x20found:',_0x4e7118[_0x6a0f('0x2d')]);_0x31ae10(_0x4e7118);}else{return createEndUser(_0x4e7118,_0x2049b4,_0x30819d,_0x53b07c)[_0x6a0f('0xf')](function(_0x33209e){logger[_0x6a0f('0xd')](_0x6a0f('0x2e'),_0x4e7118[_0x6a0f('0x2d')]);_0x31ae10(_0x33209e);});}}else{return createEndUser(_0x4e7118,_0x2049b4,_0x30819d,_0x53b07c)['then'](function(_0xd560e4){logger['info'](_0x6a0f('0x2e'),_0x4e7118[_0x6a0f('0x2d')]);_0x31ae10(_0xd560e4);});}})['catch'](function(_0x298db1){throw new Error(_0x298db1[_0x6a0f('0x15')]);});});};}function createEndUser(_0x48b10d,_0x39f559,_0x4e6695,_0x663c9b){return new Promise(function(_0x14d321,_0x1705b7){var _0x553def=moment();var _0x527028={'method':_0x6a0f('0x2f'),'uri':_0x663c9b+_0x6a0f('0x30'),'body':{'contact':{'last_name':_0x48b10d[_0x6a0f('0x2b')],'work_number':_0x48b10d[_0x6a0f('0x2b')],'mobile_number':_0x48b10d[_0x6a0f('0x2b')],'owner_id':_0x48b10d['userId'],'created_at':_0x553def['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x527028[_0x6a0f('0xc')]=_0x4e6695;logger[_0x6a0f('0xd')](_0x6a0f('0x31'));return rp(_0x527028)['then'](function(_0x5c86f6){_0x48b10d[_0x6a0f('0x2d')]=_0x5c86f6[_0x6a0f('0x32')]['id'];_0x14d321(_0x48b10d);})[_0x6a0f('0x14')](function(_0x58694f){logger[_0x6a0f('0x20')]('['+[_0x39f559[_0x6a0f('0x21')]()]+']',_0x58694f[_0x6a0f('0x15')]);_0x1705b7(_0x58694f[_0x6a0f('0x15')]);});});}function getTicket(_0x374508,_0x415cbd,_0xc4671,_0x54a76e,_0x4d59f9){return function(_0x195ecd){logger[_0x6a0f('0xd')](_0x6a0f('0x33'));return new Promise(function(_0x251487,_0x4bee80){var _0x50c3fb=moment();var _0x33c0ea={'method':_0x6a0f('0x2f'),'uri':_0xc4671+_0x6a0f('0x34'),'body':{'title':intUtil[_0x6a0f('0x35')](_0x54a76e[_0x6a0f('0x36')],_0x4d59f9,'\x20'),'description':intUtil[_0x6a0f('0x35')](_0x54a76e[_0x6a0f('0x37')],_0x4d59f9,'\x0a'),'owner_id':_0x195ecd[_0x6a0f('0x1c')],'creater_id':_0x195ecd[_0x6a0f('0x12')],'targetable_id':_0x195ecd[_0x6a0f('0x2d')],'targetable_type':_0x6a0f('0x38'),'created_at':_0x50c3fb['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x50c3fb[_0x6a0f('0x39')](0x1e,'m')[_0x6a0f('0x3a')](_0x6a0f('0x3b'))},'json':!![]};_0x33c0ea[_0x6a0f('0xc')]=_0x415cbd;return rp(_0x33c0ea)[_0x6a0f('0xf')](function(_0x42af38){_0x195ecd[_0x6a0f('0x3c')]=_0x42af38['task']['id'];logger['info'](_0x6a0f('0x3d'),_0x195ecd[_0x6a0f('0x3c')]);_0x251487(_0x195ecd);})[_0x6a0f('0x14')](function(_0x5a821f){logger[_0x6a0f('0x20')]('['+[_0x374508[_0x6a0f('0x21')]()]+']',_0x5a821f[_0x6a0f('0x15')]);_0x4bee80(_0x5a821f[_0x6a0f('0x15')]);});});};}function emit(_0x2ab31b,_0x502e99,_0x1e490b){var _0x53fde5={'uri':_0x2ab31b+_0x6a0f('0x3e')+_0x1e490b};io['to'](util['format']('user:%s',_0x502e99))[_0x6a0f('0x3f')](_0x6a0f('0x40'),_0x53fde5);}exports['cs']=function(_0x3827b6,_0x3ec386,_0x1a2466,_0x5959a4,_0x1a6de8,_0x5e472a,_0x1e9e90,_0x59ae38){var _0x2cab99={};var _0x935a6e={'Authorization':_0x6a0f('0x41')+_0x5e472a[_0x6a0f('0x42')]};_0x5e472a['remoteUri']=intUtil[_0x6a0f('0x43')](_0x5e472a[_0x6a0f('0x44')]);_0x5e472a[_0x6a0f('0x45')]=intUtil[_0x6a0f('0x43')](_0x5e472a[_0x6a0f('0x45')]);var _0x46d8f7=_0x5e472a[_0x6a0f('0x44')];_0x2cab99['adminEmail']=_0x5e472a[_0x6a0f('0x46')];_0x2cab99[_0x6a0f('0x2b')]=_0x59ae38['toLowerCase']()===_0x6a0f('0x47')?_0x3ec386[_0x6a0f('0x48')]:_0x3ec386[_0x6a0f('0x49')];_0x2cab99[_0x6a0f('0x4a')]=_0x59ae38===_0x6a0f('0x4b')||_0x59ae38===_0x6a0f('0x4c')?_0x6a0f('0x4b'):'outbound';if(_0x5959a4){_0x2cab99[_0x6a0f('0x18')]=_0x5959a4[_0x6a0f('0x10')];}var _0x363285=util[_0x6a0f('0x3a')](_0x6a0f('0x4d'),_0x5e472a[_0x6a0f('0x45')],_0x3ec386[_0x6a0f('0x4e')],md5(_0x3ec386[_0x6a0f('0x4e')]));if(_0x1a6de8&&_0x1a6de8[_0x6a0f('0x4f')]){logger[_0x6a0f('0xd')](_0x6a0f('0x50'),_0x6a0f('0x51'));_0x3ec386[_0x6a0f('0x52')]=_0x363285;}else if(_0x1e9e90&&_0x1e9e90['recordingFormat']&&_0x1e9e90[_0x6a0f('0x53')]!==_0x6a0f('0x54')){logger['info'](_0x6a0f('0x55'),'Recording\x20is\x20enabled!');_0x3ec386['recordingURL']=_0x363285;}else{_0x3ec386[_0x6a0f('0x52')]='';}return getAdminId(_0x2cab99,_0x59ae38,_0x935a6e,_0x46d8f7)['then'](getUser(_0x59ae38,_0x935a6e,_0x46d8f7))[_0x6a0f('0xf')](getEndUser(_0x59ae38,_0x935a6e,_0x46d8f7))[_0x6a0f('0xf')](getTicket(_0x59ae38,_0x935a6e,_0x46d8f7,_0x1a2466,_0x3ec386))[_0x6a0f('0xf')](function(_0x352dc6){logger[_0x6a0f('0xd')](util[_0x6a0f('0x3a')](_0x6a0f('0x56'),_0x352dc6['ticketId']));if(_0x59ae38!==_0x6a0f('0x4c')){logger[_0x6a0f('0xd')]('['+[_0x59ae38[_0x6a0f('0x21')]()]+']',_0x6a0f('0x57'));emit(_0x46d8f7,_0x5959a4['name'],_0x352dc6[_0x6a0f('0x2d')]);}})['catch'](function(_0x136db5){logger[_0x6a0f('0x20')]('['+[_0x59ae38[_0x6a0f('0x21')]()]+_0x6a0f('0x58'),util['inspect'](_0x136db5,{'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 d37793e..96fa42c 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 _0x087b=['format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','error','[EXEC]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x087b,0x11a));var _0xb087=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x087b[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0xb087('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0xb087('0x3'));var desk=require(_0xb087('0x4'));var vtiger=require(_0xb087('0x5'));var servicenow=require(_0xb087('0x6'));var dynamics365=require(_0xb087('0x7'));var freshsales=require(_0xb087('0x8'));var integrations=[_0xb087('0x9'),_0xb087('0xa'),_0xb087('0xb'),_0xb087('0xc'),_0xb087('0xd'),_0xb087('0xe'),_0xb087('0xf'),_0xb087('0x10'),_0xb087('0x11'),_0xb087('0x12')];exports[_0xb087('0x13')]=function(_0x583d25,_0x244abc,_0x108451,_0x903a16,_0x3bce7a,_0x3b45c1){if(_0x108451){if(_[_0xb087('0x14')](integrations,_0x583d25[_0xb087('0x15')]['toLowerCase']())){try{var _0x189e2b=null;var _0x31f977='';var _0x323656=_0x108451[_0x583d25['data1'][_0xb087('0x16')]()];if(_0x323656){var _0x3f145e=_0x323656[_0x583d25[_0xb087('0x17')]];if(_0x3f145e){var _0x46410b=_[_0xb087('0x18')](_0x3f145e[_0xb087('0x19')],{'id':parseInt(_0x583d25[_0xb087('0x1a')],0xa)});if(_0x46410b){if(_0x903a16){if(_0x3bce7a&&_0x244abc[_0xb087('0x1b')]){_0x31f977=_0xb087('0x1b');}else if(_0x244abc[_0xb087('0x1c')]){_0x31f977='outbound';}else{console[_0xb087('0x1d')](_0xb087('0x1e'),_0x244abc);}}else{_0x31f977='unmanaged';}switch(_0x583d25[_0xb087('0x15')][_0xb087('0x16')]()){case _0xb087('0x9'):zendesk[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case'salesforce':salesforce[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case _0xb087('0xb'):sugarcrm[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case _0xb087('0xc'):freshdesk[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case _0xb087('0xd'):zoho[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case _0xb087('0xe'):desk[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case'vtiger':vtiger[_0x31f977](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1);break;case _0xb087('0x11'):freshsales['cs'](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1,_0x31f977);break;case _0xb087('0x12'):servicenow['cs'](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1,_0x31f977);break;case _0xb087('0x10'):dynamics365['cs'](_0x583d25,_0x244abc,_0x46410b,_0x903a16,_0x3bce7a,_0x3f145e,_0x3b45c1,_0x31f977);break;default:console[_0xb087('0x1d')]('unknown\x20integration');}}else{_0x189e2b=require('../../../../config/logger')(_0x583d25['data1']['toLowerCase']());_0x189e2b[_0xb087('0x1f')](_0xb087('0x20'),util[_0xb087('0x21')](_0xb087('0x22'),_0x583d25[_0xb087('0x15')][_0xb087('0x16')](),_0x583d25[_0xb087('0x1a')]));}}else{_0x189e2b=require('../../../../config/logger')(_0x583d25[_0xb087('0x15')][_0xb087('0x16')]());_0x189e2b[_0xb087('0x1f')](_0xb087('0x20'),util[_0xb087('0x21')]('%s\x20account\x20#%s\x20not\x20found',_0x583d25[_0xb087('0x15')][_0xb087('0x16')](),_0x583d25['data2']));}}else{}}catch(_0x5a2dc6){console['error'](_0x5a2dc6);}}}}; \ No newline at end of file +var _0x5eb8=['data1','data2','find','Configurations','data3','queue','outbound','EVENT\x20UNKNOWN','unmanaged','toLowerCase','vtiger','freshsales','log','unknown\x20integration','../../../../config/logger','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','error','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','dynamics365','servicenow','exec','includes'];(function(_0x18b50e,_0x147270){var _0x24446a=function(_0x58c585){while(--_0x58c585){_0x18b50e['push'](_0x18b50e['shift']());}};_0x24446a(++_0x147270);}(_0x5eb8,0xb0));var _0x85eb=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x5eb8[_0x100e36];return _0x1df0c9;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x85eb('0x0'));var salesforce=require(_0x85eb('0x1'));var sugarcrm=require(_0x85eb('0x2'));var freshdesk=require(_0x85eb('0x3'));var zoho=require(_0x85eb('0x4'));var desk=require(_0x85eb('0x5'));var vtiger=require(_0x85eb('0x6'));var servicenow=require(_0x85eb('0x7'));var dynamics365=require(_0x85eb('0x8'));var freshsales=require(_0x85eb('0x9'));var integrations=[_0x85eb('0xa'),_0x85eb('0xb'),'sugarcrm',_0x85eb('0xc'),_0x85eb('0xd'),_0x85eb('0xe'),'vtiger',_0x85eb('0xf'),'freshsales',_0x85eb('0x10')];exports[_0x85eb('0x11')]=function(_0x673228,_0x29030b,_0x1dacf2,_0x73e6d0,_0x2c7fd3,_0x50ef6f){if(_0x1dacf2){if(_[_0x85eb('0x12')](integrations,_0x673228[_0x85eb('0x13')]['toLowerCase']())){try{var _0x2af376=null;var _0x784583='';var _0x2f42ba=_0x1dacf2[_0x673228[_0x85eb('0x13')]['toLowerCase']()];if(_0x2f42ba){var _0x548628=_0x2f42ba[_0x673228[_0x85eb('0x14')]];if(_0x548628){var _0x5c760a=_[_0x85eb('0x15')](_0x548628[_0x85eb('0x16')],{'id':parseInt(_0x673228[_0x85eb('0x17')],0xa)});if(_0x5c760a){if(_0x73e6d0){if(_0x2c7fd3&&_0x29030b[_0x85eb('0x18')]){_0x784583=_0x85eb('0x18');}else if(_0x29030b['routeId']){_0x784583=_0x85eb('0x19');}else{console['log'](_0x85eb('0x1a'),_0x29030b);}}else{_0x784583=_0x85eb('0x1b');}switch(_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')]()){case'zendesk':zendesk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case'salesforce':salesforce[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case'sugarcrm':sugarcrm[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xc'):freshdesk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xd'):zoho[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0xe'):desk[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0x1d'):vtiger[_0x784583](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f);break;case _0x85eb('0x1e'):freshsales['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;case _0x85eb('0x10'):servicenow['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;case'dynamics365':dynamics365['cs'](_0x673228,_0x29030b,_0x5c760a,_0x73e6d0,_0x2c7fd3,_0x548628,_0x50ef6f,_0x784583);break;default:console[_0x85eb('0x1f')](_0x85eb('0x20'));}}else{_0x2af376=require(_0x85eb('0x21'))(_0x673228['data1']['toLowerCase']());_0x2af376['error']('[EXEC]',util[_0x85eb('0x22')](_0x85eb('0x23'),_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')](),_0x673228[_0x85eb('0x17')]));}}else{_0x2af376=require(_0x85eb('0x21'))(_0x673228['data1']['toLowerCase']());_0x2af376['error'](_0x85eb('0x24'),util[_0x85eb('0x22')](_0x85eb('0x25'),_0x673228[_0x85eb('0x13')][_0x85eb('0x1c')](),_0x673228[_0x85eb('0x14')]));}}else{}}catch(_0x5dfc96){console[_0x85eb('0x26')](_0x5dfc96);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 5b04051..5c367f2 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 _0xbc40=['calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','stringify','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','Task','assign','getString','Subjects','Descriptions','WhoId','ticketType','Case','create','isNil','validateEmail','sobject','User','find','then','length','Email','info','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','string','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','password','securityToken','Connection','https://login.salesforce.com','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','recordingURL','uniqueid','email','calleridname'];(function(_0x411be6,_0x9b926){var _0xf61a3a=function(_0x4930a8){while(--_0x4930a8){_0x411be6['push'](_0x411be6['shift']());}};_0xf61a3a(++_0x9b926);}(_0xbc40,0x162));var _0x0bc4=function(_0x20d2e9,_0x49664e){_0x20d2e9=_0x20d2e9-0x0;var _0x56d870=_0xbc40[_0x20d2e9];return _0x56d870;};'use strict';var _=require(_0x0bc4('0x0'));var rp=require(_0x0bc4('0x1'));var moment=require(_0x0bc4('0x2'));var BPromise=require(_0x0bc4('0x3'));var md5=require('md5');var jsforce=require(_0x0bc4('0x4'));var util=require(_0x0bc4('0x5'));var Redis=require(_0x0bc4('0x6'));var intUtil=require(_0x0bc4('0x7'));var config=require('../../../../config/environment');var logger=require(_0x0bc4('0x8'))(_0x0bc4('0x9'));config['redis']=_['defaults'](config[_0x0bc4('0xa')],{'host':_0x0bc4('0xb'),'port':0x18eb});var io=require(_0x0bc4('0xc'))(new Redis(config[_0x0bc4('0xa')]));function emit(_0x19077e,_0x189675,_0x565058){io['to'](_0x19077e)[_0x0bc4('0xd')](_0x189675,_0x565058);}function getTicket(_0x184076,_0xa3174c,_0x3deb63,_0x15e184,_0x3d7adb,_0x43bf66,_0x21a46f,_0x44ee05){var _0x1b1845={};if(_0x15e184['ticketType']===_0x0bc4('0xe')){_0x1b1845=Object[_0x0bc4('0xf')]({},{'OwnerId':_0xa3174c['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x0bc4('0x10')](_0x15e184[_0x0bc4('0x11')],_0x3d7adb,'\x20'),'Description':intUtil[_0x0bc4('0x10')](_0x15e184[_0x0bc4('0x12')],_0x3d7adb,'\x0a')},getCustomFields(_0x43bf66,_0x3d7adb));if(_0x3deb63){_0x1b1845[_0x0bc4('0x13')]=_0x3deb63['id'];}}else if(_0x15e184[_0x0bc4('0x14')]===_0x0bc4('0x15')){_0x1b1845=Object['assign']({},{'OwnerId':_0xa3174c['id'],'Subject':intUtil[_0x0bc4('0x10')](_0x15e184['Subjects'],_0x3d7adb,'\x20'),'Description':intUtil[_0x0bc4('0x10')](_0x15e184[_0x0bc4('0x12')],_0x3d7adb,'\x0a')},getCustomFields(_0x43bf66,_0x3d7adb));if(_0x3deb63){_0x1b1845['ContactId']=_0x3deb63['id'];}}return _0x21a46f['sobject'](_0x15e184['ticketType'])[_0x0bc4('0x16')](_0x1b1845);}function getUser(_0x478bd4,_0x2e611e,_0x54c400){if(!_[_0x0bc4('0x17')](_0x2e611e)&&intUtil[_0x0bc4('0x18')](_0x2e611e)){var _0x20fa30={'Email':_0x2e611e};var _0x4b81a9={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x54c400[_0x0bc4('0x19')](_0x0bc4('0x1a'))[_0x0bc4('0x1b')](_0x20fa30,_0x4b81a9)['execute']()[_0x0bc4('0x1c')](function(_0x4f881a){if(_0x4f881a[_0x0bc4('0x1d')]){var _0xfd1895=_[_0x0bc4('0x1b')](_0x4f881a,function(_0x4cf688){return _0x4cf688[_0x0bc4('0x1e')]===_0x2e611e;});if(_0xfd1895){logger[_0x0bc4('0x1f')]('Agent\x20%s\x20found.',_0x2e611e);return BPromise[_0x0bc4('0x20')]({'id':_0xfd1895['Id'],'name':_0xfd1895[_0x0bc4('0x21')]});}}else{logger[_0x0bc4('0x1f')](_0x0bc4('0x22'),_0x2e611e);return _0x54c400[_0x0bc4('0x23')]()[_0x0bc4('0x1c')](function(_0x1d9323){return BPromise['resolve']({'id':_0x1d9323[_0x0bc4('0x24')],'name':_0x1d9323['display_name']});});}});}else{logger[_0x0bc4('0x1f')](_0x0bc4('0x22'),_0x2e611e);return _0x54c400[_0x0bc4('0x23')]()[_0x0bc4('0x1c')](function(_0x1777c4){return BPromise[_0x0bc4('0x20')]({'id':_0x1777c4['user_id'],'name':_0x1777c4[_0x0bc4('0x25')]});});}}function getEndUser(_0x2f2033,_0x20187d,_0x497389,_0x47cf14,_0x1f5efa){var _0x13f878={'Phone':_0x47cf14};var _0x3ecead={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x0bc4('0x20')]()['then'](function(){if(_0x20187d[_0x0bc4('0x14')]===_0x0bc4('0xe')){logger[_0x0bc4('0x1f')](_0x0bc4('0x26'),_0x47cf14,_0x20187d[_0x0bc4('0x27')]);switch(_0x20187d[_0x0bc4('0x27')]){case _0x0bc4('0x28'):return _0x1f5efa['sobject'](_0x0bc4('0x29'))['find'](_0x13f878,_0x3ecead)[_0x0bc4('0x2a')]()[_0x0bc4('0x1c')](function(_0x2869bc){if(_0x2869bc&&_0x2869bc[_0x0bc4('0x1d')]){return _0x2869bc;}else{return _0x1f5efa[_0x0bc4('0x19')](_0x0bc4('0x2b'))['find'](_0x13f878,_0x3ecead);}});case _0x0bc4('0x2c'):return _0x1f5efa[_0x0bc4('0x19')](_0x0bc4('0x29'))[_0x0bc4('0x1b')](_0x13f878,_0x3ecead)[_0x0bc4('0x2a')]();case _0x0bc4('0x2d'):return _0x1f5efa[_0x0bc4('0x19')]('Lead')[_0x0bc4('0x1b')](_0x13f878,_0x3ecead);default:return null;}}else if(_0x20187d['ticketType']===_0x0bc4('0x15')){logger[_0x0bc4('0x1f')](_0x0bc4('0x26'),_0x47cf14,_0x0bc4('0x2c'));return _0x1f5efa[_0x0bc4('0x19')](_0x0bc4('0x29'))[_0x0bc4('0x1b')](_0x13f878,_0x3ecead)[_0x0bc4('0x2a')]();}})[_0x0bc4('0x1c')](function(_0x100dd1){if(_0x100dd1&&_0x100dd1['length']){var _0x404896=_[_0x0bc4('0x1b')](_0x100dd1,function(_0x87142a){return _0x87142a['Phone']===_0x47cf14;});if(_0x404896){return BPromise[_0x0bc4('0x20')]({'id':_0x404896['Id'],'name':_0x404896[_0x0bc4('0x21')],'phone':_0x404896[_0x0bc4('0x2e')]});}}})[_0x0bc4('0x1c')](function(_0x464929){if(_0x464929){logger[_0x0bc4('0x1f')](_0x0bc4('0x2f'),_0x47cf14);return BPromise[_0x0bc4('0x20')](_0x464929);}else{logger[_0x0bc4('0x1f')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x47cf14);var _0x254de6={'LastName':_0x497389!==_0x0bc4('0x30')?_0x497389:util[_0x0bc4('0x31')](_0x0bc4('0x32'),_0x47cf14),'Phone':_0x47cf14};if(_0x20187d[_0x0bc4('0x33')]){if(_0x20187d[_0x0bc4('0x33')]===_0x0bc4('0x2c')){logger[_0x0bc4('0x1f')](_0x0bc4('0x34'),_0x47cf14,_0x20187d[_0x0bc4('0x33')]);}else if(_0x20187d['moduleCreate']===_0x0bc4('0x2d')&&_0x20187d[_0x0bc4('0x14')]===_0x0bc4('0xe')){logger[_0x0bc4('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x47cf14,_0x20187d[_0x0bc4('0x33')]);_0x254de6[_0x0bc4('0x35')]=_0x0bc4('0x36');}else{return null;}}return _0x1f5efa['sobject'](_[_0x0bc4('0x37')](_0x20187d[_0x0bc4('0x33')]))[_0x0bc4('0x16')](_0x254de6);}});}function getCustomFields(_0x458fc6,_0x2a6a05){var _0x1f69de={};if(_0x458fc6[_0x0bc4('0x1d')]>0x0){_[_0x0bc4('0x38')](_0x458fc6,function(_0x16bdb6){if(_0x16bdb6['type']===_0x0bc4('0x39')&&_0x16bdb6[_0x0bc4('0x3a')]){_0x1f69de[_0x16bdb6[_0x0bc4('0x3a')]]=_0x16bdb6[_0x0bc4('0x3b')][_0x0bc4('0x3c')]();}else if(_0x16bdb6[_0x0bc4('0x3d')]==='variable'&&_0x16bdb6[_0x0bc4('0x3e')]&&_0x16bdb6[_0x0bc4('0x3a')]){_0x2a6a05[_0x16bdb6['variableName']]&&(_0x1f69de[_0x16bdb6[_0x0bc4('0x3a')]]=_0x2a6a05[_0x16bdb6[_0x0bc4('0x3e')]][_0x0bc4('0x3c')]());}else if(_0x16bdb6[_0x0bc4('0x3d')]===_0x0bc4('0x3f')&&_0x16bdb6[_0x0bc4('0x40')]&&_0x16bdb6[_0x0bc4('0x40')][_0x0bc4('0x41')]&&_0x16bdb6[_0x0bc4('0x3a')]){_0x2a6a05[_0x16bdb6[_0x0bc4('0x40')][_0x0bc4('0x41')][_0x0bc4('0x42')]()]&&(_0x1f69de[_0x16bdb6[_0x0bc4('0x3a')]]=_0x2a6a05[_0x16bdb6['Variable'][_0x0bc4('0x41')][_0x0bc4('0x42')]()][_0x0bc4('0x3c')]());}});}return _0x1f69de;}function getConnection(_0x65aed1){var _0x41c8ea=_0x65aed1[_0x0bc4('0x43')]['concat'](_0x65aed1[_0x0bc4('0x44')]);var _0xd9b7a0=new jsforce[(_0x0bc4('0x45'))]({'oauth2':{'loginUrl':_0x65aed1['remoteUri']||_0x0bc4('0x46'),'clientId':_0x65aed1['clientId'],'clientSecret':_0x65aed1[_0x0bc4('0x47')]}});return _0xd9b7a0[_0x0bc4('0x48')](_0x65aed1['username'],_0x41c8ea)[_0x0bc4('0x1c')](function(){logger[_0x0bc4('0x1f')](_0x0bc4('0x49'));return _0xd9b7a0;});}exports[_0x0bc4('0x4a')]=function(_0xbf54f1,_0x365276,_0x57bf1e,_0x3141e6,_0x5f1b34,_0x2b9723){var _0xe178bf,_0x2fb631,_0x236582,_0x5689fd;_0x2b9723[_0x0bc4('0x4b')]=intUtil[_0x0bc4('0x4c')](_0x2b9723[_0x0bc4('0x4b')]);_0x2b9723[_0x0bc4('0x4d')]=intUtil['stripTrailingSlash'](_0x2b9723[_0x0bc4('0x4d')]);if(_0x5f1b34&&_0x5f1b34['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x365276[_0x0bc4('0x4e')]=util[_0x0bc4('0x31')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b9723[_0x0bc4('0x4b')],_0x365276[_0x0bc4('0x4f')],md5(_0x365276[_0x0bc4('0x4f')]));}else{_0x365276[_0x0bc4('0x4e')]='';}return getConnection(_0x2b9723)[_0x0bc4('0x1c')](function(_0xcf81e3){_0x5689fd=_0xcf81e3;return getUser(_0x2b9723,_0x3141e6[_0x0bc4('0x50')],_0x5689fd);})[_0x0bc4('0x1c')](function(_0x2a6e62){_0xe178bf=_0x2a6e62;return getEndUser(_0x2b9723,_0x57bf1e,_0x365276[_0x0bc4('0x51')],_0x365276[_0x0bc4('0x52')],_0x5689fd);})[_0x0bc4('0x1c')](function(_0x2eb6c9){_0x2fb631=_0x2eb6c9;return getTicket(_0x2b9723,_0xe178bf,_0x2fb631,_0x57bf1e,_0x365276,_0x57bf1e[_0x0bc4('0x53')],_0x5689fd,_0x0bc4('0x4a'));})[_0x0bc4('0x1c')](function(_0x27b7a5){_0x236582=_0x27b7a5;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x236582['id']);logger[_0x0bc4('0x1f')](_0x0bc4('0x54'),_0x236582['id'],_0x3141e6['name'],_0x2b9723[_0x0bc4('0x3d')]);switch(_0x2b9723[_0x0bc4('0x3d')]){case _0x0bc4('0x55'):emit(util[_0x0bc4('0x31')]('user:%s',_0x3141e6[_0x0bc4('0x41')]),_0x0bc4('0x56'),{'recordId':_0x236582['id']});break;case'newTab':emit(util[_0x0bc4('0x31')]('user:%s',_0x3141e6[_0x0bc4('0x41')]),_0x0bc4('0x57'),{'uri':util[_0x0bc4('0x31')]('%s/%s/e',_0x5689fd[_0x0bc4('0x58')],_0x236582['id'])});break;default:logger[_0x0bc4('0x59')](_0x0bc4('0x5a'));}})[_0x0bc4('0x5b')](function(_0x2dfddb){logger['error'](_0x0bc4('0x5c'),JSON[_0x0bc4('0x5d')](_0x2dfddb));});};exports['outbound']=function(_0x117b3c,_0x5f3a96,_0x23e884,_0xe0b901,_0x27edd1,_0x2e5947,_0x4856b5){var _0x1f45b4,_0x1cd726,_0xdab1d0,_0x383bef;_0x2e5947[_0x0bc4('0x4b')]=intUtil[_0x0bc4('0x4c')](_0x2e5947[_0x0bc4('0x4b')]);_0x2e5947[_0x0bc4('0x4d')]=intUtil['stripTrailingSlash'](_0x2e5947[_0x0bc4('0x4d')]);if(_0x4856b5&&_0x4856b5[_0x0bc4('0x5e')]&&_0x4856b5[_0x0bc4('0x5e')]!==_0x0bc4('0x5f')){logger[_0x0bc4('0x1f')]('[OUTBOUND]',_0x0bc4('0x60'));_0x5f3a96['recordingURL']=util[_0x0bc4('0x31')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e5947[_0x0bc4('0x4b')],_0x5f3a96[_0x0bc4('0x4f')],md5(_0x5f3a96[_0x0bc4('0x4f')]));}return getConnection(_0x2e5947)['then'](function(_0x1985c0){_0x383bef=_0x1985c0;return getUser(_0x2e5947,_0xe0b901['email'],_0x383bef);})[_0x0bc4('0x1c')](function(_0x354454){_0x1f45b4=_0x354454;return getEndUser(_0x2e5947,_0x23e884,_0x5f3a96['destcalleridname'],_0x5f3a96[_0x0bc4('0x61')],_0x383bef);})['then'](function(_0x2dd720){_0x1cd726=_0x2dd720;return getTicket(_0x2e5947,_0x1f45b4,_0x1cd726,_0x23e884,_0x5f3a96,_0x23e884[_0x0bc4('0x53')],_0x383bef,'outbound');})[_0x0bc4('0x1c')](function(_0xc53a12){_0xdab1d0=_0xc53a12;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0xdab1d0['id']);logger[_0x0bc4('0x1f')](_0x0bc4('0x62'),_0xdab1d0['id'],_0xe0b901[_0x0bc4('0x41')],_0x2e5947['type']);switch(_0x2e5947['type']){case'integrationTab':emit(util[_0x0bc4('0x31')](_0x0bc4('0x63'),_0xe0b901[_0x0bc4('0x41')]),'trigger:salesforce:display',{'recordId':_0xdab1d0['id']});break;case'newTab':emit(util[_0x0bc4('0x31')]('user:%s',_0xe0b901[_0x0bc4('0x41')]),_0x0bc4('0x57'),{'uri':util[_0x0bc4('0x31')](_0x0bc4('0x64'),_0x383bef[_0x0bc4('0x58')],_0xdab1d0['id'])});break;default:logger[_0x0bc4('0x59')](_0x0bc4('0x65'),_0x0bc4('0x66'));}})[_0x0bc4('0x5b')](function(_0xe2863f){logger[_0x0bc4('0x59')](_0x0bc4('0x65'),JSON[_0x0bc4('0x5d')](_0xe2863f));});};exports[_0x0bc4('0x67')]=function(_0x59870b,_0x92cf09,_0xed2078,_0x41f08a,_0x441393,_0x4be1ea){var _0x2cd882,_0x2124e4,_0x443ca9,_0x1851dd;_0x4be1ea[_0x0bc4('0x4b')]=intUtil[_0x0bc4('0x4c')](_0x4be1ea['serverUrl']);_0x4be1ea[_0x0bc4('0x4d')]=intUtil[_0x0bc4('0x4c')](_0x4be1ea[_0x0bc4('0x4d')]);if(_0x441393&&_0x441393['monitor_format']){logger[_0x0bc4('0x1f')]('['+_0x92cf09['lastevent'][_0x0bc4('0x68')]()+']','Recording\x20is\x20enabled!');_0x92cf09[_0x0bc4('0x4e')]=util[_0x0bc4('0x31')](_0x0bc4('0x69'),_0x4be1ea['serverUrl'],_0x92cf09['uniqueid'],md5(_0x92cf09['uniqueid']));}else{_0x92cf09[_0x0bc4('0x4e')]='';}return getConnection(_0x4be1ea)[_0x0bc4('0x1c')](function(_0x32336d){_0x1851dd=_0x32336d;if(!_[_0x0bc4('0x17')](_0x41f08a)){return getUser(_0x4be1ea,_0x41f08a[_0x0bc4('0x41')],_0x1851dd);}else{return getUser(_0x4be1ea,null,_0x1851dd);}})[_0x0bc4('0x1c')](function(_0x16b1b2){_0x2cd882=_0x16b1b2;return getEndUser(_0x4be1ea,_0xed2078,_0x92cf09[_0x0bc4('0x51')],_0x92cf09['calleridnum'],_0x1851dd);})[_0x0bc4('0x1c')](function(_0x3b6c87){_0x2124e4=_0x3b6c87;return getTicket(_0x4be1ea,_0x2cd882,_0x2124e4,_0xed2078,_0x92cf09,_0xed2078[_0x0bc4('0x53')],_0x1851dd);})['then'](function(_0x321313){_0x443ca9=_0x321313;logger[_0x0bc4('0x1f')]('['+_0x92cf09[_0x0bc4('0x6a')][_0x0bc4('0x68')]()+_0x0bc4('0x6b'),_0x443ca9['id']);logger[_0x0bc4('0x1f')]('['+_0x92cf09[_0x0bc4('0x6a')][_0x0bc4('0x68')]()+_0x0bc4('0x6c'),_0x4be1ea[_0x0bc4('0x3d')]);})[_0x0bc4('0x5b')](function(_0x17f98d){logger[_0x0bc4('0x59')]('['+_0x92cf09[_0x0bc4('0x6a')]['toUpperCase']()+']',JSON['stringify'](_0x17f98d));});}; \ No newline at end of file +var _0x2e14=['Lead','contact','Contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','string','idField','toString','type','Variable','name','toLowerCase','concat','securityToken','Connection','remoteUri','clientSecret','login','username','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','[QUEUE]','stringify','recordingFormat','none','email','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','ticketType','Task','utc','getString','Descriptions','WhoId','assign','create','validateEmail','sobject','find','execute','then','Email','info','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','length'];(function(_0x1b341a,_0x727338){var _0x411f06=function(_0x4eb8c8){while(--_0x4eb8c8){_0x1b341a['push'](_0x1b341a['shift']());}};_0x411f06(++_0x727338);}(_0x2e14,0xae));var _0x42e1=function(_0x323bf6,_0x19aed6){_0x323bf6=_0x323bf6-0x0;var _0x18da88=_0x2e14[_0x323bf6];return _0x18da88;};'use strict';var _=require(_0x42e1('0x0'));var rp=require(_0x42e1('0x1'));var moment=require('moment');var BPromise=require(_0x42e1('0x2'));var md5=require('md5');var jsforce=require(_0x42e1('0x3'));var util=require(_0x42e1('0x4'));var Redis=require(_0x42e1('0x5'));var intUtil=require(_0x42e1('0x6'));var config=require(_0x42e1('0x7'));var logger=require(_0x42e1('0x8'))('salesforce');config[_0x42e1('0x9')]=_[_0x42e1('0xa')](config[_0x42e1('0x9')],{'host':_0x42e1('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x42e1('0x9')]));function emit(_0x19d42b,_0x53839f,_0x526007){io['to'](_0x19d42b)[_0x42e1('0xc')](_0x53839f,_0x526007);}function getTicket(_0x5292ee,_0x478678,_0x580160,_0xf2d0b1,_0x30b49b,_0x36c0e3,_0x48c063,_0x45d6df){var _0x293fb3={};if(_0xf2d0b1[_0x42e1('0xd')]===_0x42e1('0xe')){_0x293fb3=Object['assign']({},{'OwnerId':_0x478678['id'],'ActivityDate':moment[_0x42e1('0xf')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x42e1('0x10')](_0xf2d0b1['Subjects'],_0x30b49b,'\x20'),'Description':intUtil['getString'](_0xf2d0b1[_0x42e1('0x11')],_0x30b49b,'\x0a')},getCustomFields(_0x36c0e3,_0x30b49b));if(_0x580160){_0x293fb3[_0x42e1('0x12')]=_0x580160['id'];}}else if(_0xf2d0b1[_0x42e1('0xd')]==='Case'){_0x293fb3=Object[_0x42e1('0x13')]({},{'OwnerId':_0x478678['id'],'Subject':intUtil[_0x42e1('0x10')](_0xf2d0b1['Subjects'],_0x30b49b,'\x20'),'Description':intUtil[_0x42e1('0x10')](_0xf2d0b1[_0x42e1('0x11')],_0x30b49b,'\x0a')},getCustomFields(_0x36c0e3,_0x30b49b));if(_0x580160){_0x293fb3['ContactId']=_0x580160['id'];}}return _0x48c063['sobject'](_0xf2d0b1[_0x42e1('0xd')])[_0x42e1('0x14')](_0x293fb3);}function getUser(_0x4264fd,_0x3a70ab,_0x8476ee){if(!_['isNil'](_0x3a70ab)&&intUtil[_0x42e1('0x15')](_0x3a70ab)){var _0x57e7cb={'Email':_0x3a70ab};var _0x2e35f4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x8476ee[_0x42e1('0x16')]('User')[_0x42e1('0x17')](_0x57e7cb,_0x2e35f4)[_0x42e1('0x18')]()[_0x42e1('0x19')](function(_0x115f6b){if(_0x115f6b['length']){var _0x4d3c3c=_[_0x42e1('0x17')](_0x115f6b,function(_0x1e8b6d){return _0x1e8b6d[_0x42e1('0x1a')]===_0x3a70ab;});if(_0x4d3c3c){logger[_0x42e1('0x1b')]('Agent\x20%s\x20found.',_0x3a70ab);return BPromise[_0x42e1('0x1c')]({'id':_0x4d3c3c['Id'],'name':_0x4d3c3c[_0x42e1('0x1d')]});}}else{logger[_0x42e1('0x1b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3a70ab);return _0x8476ee[_0x42e1('0x1e')]()['then'](function(_0x299d8b){return BPromise[_0x42e1('0x1c')]({'id':_0x299d8b[_0x42e1('0x1f')],'name':_0x299d8b[_0x42e1('0x20')]});});}});}else{logger[_0x42e1('0x1b')](_0x42e1('0x21'),_0x3a70ab);return _0x8476ee[_0x42e1('0x1e')]()['then'](function(_0x185c85){return BPromise[_0x42e1('0x1c')]({'id':_0x185c85[_0x42e1('0x1f')],'name':_0x185c85[_0x42e1('0x20')]});});}}function getEndUser(_0x9adc6d,_0x1e39c5,_0x507752,_0x4e2572,_0x329bb8){var _0x2b72ec={'Phone':_0x4e2572};var _0xa1422c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x42e1('0x19')](function(){if(_0x1e39c5['ticketType']===_0x42e1('0xe')){logger[_0x42e1('0x1b')](_0x42e1('0x22'),_0x4e2572,_0x1e39c5[_0x42e1('0x23')]);switch(_0x1e39c5['moduleSearch']){case _0x42e1('0x24'):return _0x329bb8[_0x42e1('0x16')]('Contact')[_0x42e1('0x17')](_0x2b72ec,_0xa1422c)['execute']()[_0x42e1('0x19')](function(_0x406e68){if(_0x406e68&&_0x406e68[_0x42e1('0x25')]){return _0x406e68;}else{return _0x329bb8[_0x42e1('0x16')](_0x42e1('0x26'))['find'](_0x2b72ec,_0xa1422c);}});case _0x42e1('0x27'):return _0x329bb8[_0x42e1('0x16')](_0x42e1('0x28'))[_0x42e1('0x17')](_0x2b72ec,_0xa1422c)['execute']();case _0x42e1('0x29'):return _0x329bb8[_0x42e1('0x16')](_0x42e1('0x26'))[_0x42e1('0x17')](_0x2b72ec,_0xa1422c);default:return null;}}else if(_0x1e39c5[_0x42e1('0xd')]==='Case'){logger[_0x42e1('0x1b')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x4e2572,_0x42e1('0x27'));return _0x329bb8[_0x42e1('0x16')](_0x42e1('0x28'))[_0x42e1('0x17')](_0x2b72ec,_0xa1422c)[_0x42e1('0x18')]();}})[_0x42e1('0x19')](function(_0xbe87b5){if(_0xbe87b5&&_0xbe87b5[_0x42e1('0x25')]){var _0x25d6de=_[_0x42e1('0x17')](_0xbe87b5,function(_0x2761b6){return _0x2761b6[_0x42e1('0x2a')]===_0x4e2572;});if(_0x25d6de){return BPromise[_0x42e1('0x1c')]({'id':_0x25d6de['Id'],'name':_0x25d6de[_0x42e1('0x1d')],'phone':_0x25d6de['Phone']});}}})[_0x42e1('0x19')](function(_0x207ead){if(_0x207ead){logger['info'](_0x42e1('0x2b'),_0x4e2572);return BPromise[_0x42e1('0x1c')](_0x207ead);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x4e2572);var _0x1ca02d={'LastName':_0x507752!==_0x42e1('0x2c')?_0x507752:util[_0x42e1('0x2d')](_0x42e1('0x2e'),_0x4e2572),'Phone':_0x4e2572};if(_0x1e39c5[_0x42e1('0x2f')]){if(_0x1e39c5['moduleCreate']==='contact'){logger[_0x42e1('0x1b')](_0x42e1('0x30'),_0x4e2572,_0x1e39c5[_0x42e1('0x2f')]);}else if(_0x1e39c5[_0x42e1('0x2f')]==='lead'&&_0x1e39c5[_0x42e1('0xd')]===_0x42e1('0xe')){logger[_0x42e1('0x1b')](_0x42e1('0x30'),_0x4e2572,_0x1e39c5[_0x42e1('0x2f')]);_0x1ca02d[_0x42e1('0x31')]=_0x42e1('0x32');}else{return null;}}return _0x329bb8[_0x42e1('0x16')](_[_0x42e1('0x33')](_0x1e39c5['moduleCreate']))[_0x42e1('0x14')](_0x1ca02d);}});}function getCustomFields(_0x2874f5,_0x3a95ae){var _0x5592b8={};if(_0x2874f5['length']>0x0){_[_0x42e1('0x34')](_0x2874f5,function(_0x309bbe){if(_0x309bbe['type']===_0x42e1('0x35')&&_0x309bbe[_0x42e1('0x36')]){_0x5592b8[_0x309bbe[_0x42e1('0x36')]]=_0x309bbe['content'][_0x42e1('0x37')]();}else if(_0x309bbe[_0x42e1('0x38')]==='variable'&&_0x309bbe['variableName']&&_0x309bbe[_0x42e1('0x36')]){_0x3a95ae[_0x309bbe['variableName']]&&(_0x5592b8[_0x309bbe[_0x42e1('0x36')]]=_0x3a95ae[_0x309bbe['variableName']]['toString']());}else if(_0x309bbe[_0x42e1('0x38')]==='customVariable'&&_0x309bbe[_0x42e1('0x39')]&&_0x309bbe[_0x42e1('0x39')][_0x42e1('0x3a')]&&_0x309bbe[_0x42e1('0x36')]){_0x3a95ae[_0x309bbe[_0x42e1('0x39')][_0x42e1('0x3a')]['toLowerCase']()]&&(_0x5592b8[_0x309bbe[_0x42e1('0x36')]]=_0x3a95ae[_0x309bbe[_0x42e1('0x39')][_0x42e1('0x3a')][_0x42e1('0x3b')]()]['toString']());}});}return _0x5592b8;}function getConnection(_0x52ff59){var _0x41b2ad=_0x52ff59['password'][_0x42e1('0x3c')](_0x52ff59[_0x42e1('0x3d')]);var _0x52ae9a=new jsforce[(_0x42e1('0x3e'))]({'oauth2':{'loginUrl':_0x52ff59[_0x42e1('0x3f')]||'https://login.salesforce.com','clientId':_0x52ff59['clientId'],'clientSecret':_0x52ff59[_0x42e1('0x40')]}});return _0x52ae9a[_0x42e1('0x41')](_0x52ff59[_0x42e1('0x42')],_0x41b2ad)[_0x42e1('0x19')](function(){logger[_0x42e1('0x1b')]('Connection\x20established.');return _0x52ae9a;});}exports['queue']=function(_0x8a0bf5,_0x125248,_0x3f8c77,_0x16b7c2,_0x3d4ae3,_0x2a4d88){var _0x4f228e,_0x3af466,_0x58f88b,_0x55dc02;_0x2a4d88[_0x42e1('0x43')]=intUtil[_0x42e1('0x44')](_0x2a4d88[_0x42e1('0x43')]);_0x2a4d88[_0x42e1('0x3f')]=intUtil[_0x42e1('0x44')](_0x2a4d88['remoteUri']);if(_0x3d4ae3&&_0x3d4ae3[_0x42e1('0x45')]){logger[_0x42e1('0x1b')]('[QUEUE]',_0x42e1('0x46'));_0x125248[_0x42e1('0x47')]=util[_0x42e1('0x2d')](_0x42e1('0x48'),_0x2a4d88[_0x42e1('0x43')],_0x125248[_0x42e1('0x49')],md5(_0x125248[_0x42e1('0x49')]));}else{_0x125248['recordingURL']='';}return getConnection(_0x2a4d88)[_0x42e1('0x19')](function(_0x3ad3e0){_0x55dc02=_0x3ad3e0;return getUser(_0x2a4d88,_0x16b7c2['email'],_0x55dc02);})[_0x42e1('0x19')](function(_0x1ac437){_0x4f228e=_0x1ac437;return getEndUser(_0x2a4d88,_0x3f8c77,_0x125248[_0x42e1('0x4a')],_0x125248[_0x42e1('0x4b')],_0x55dc02);})[_0x42e1('0x19')](function(_0x179584){_0x3af466=_0x179584;return getTicket(_0x2a4d88,_0x4f228e,_0x3af466,_0x3f8c77,_0x125248,_0x3f8c77[_0x42e1('0x4c')],_0x55dc02,_0x42e1('0x4d'));})[_0x42e1('0x19')](function(_0xf88570){_0x58f88b=_0xf88570;logger['info'](_0x42e1('0x4e'),_0x58f88b['id']);logger['info'](_0x42e1('0x4f'),_0x58f88b['id'],_0x16b7c2[_0x42e1('0x3a')],_0x2a4d88[_0x42e1('0x38')]);switch(_0x2a4d88[_0x42e1('0x38')]){case'integrationTab':emit(util[_0x42e1('0x2d')](_0x42e1('0x50'),_0x16b7c2[_0x42e1('0x3a')]),_0x42e1('0x51'),{'recordId':_0x58f88b['id']});break;case _0x42e1('0x52'):emit(util[_0x42e1('0x2d')]('user:%s',_0x16b7c2[_0x42e1('0x3a')]),'trigger:browser:url',{'uri':util[_0x42e1('0x2d')](_0x42e1('0x53'),_0x55dc02[_0x42e1('0x54')],_0x58f88b['id'])});break;default:logger['error'](_0x42e1('0x55'));}})[_0x42e1('0x56')](function(_0x946764){logger[_0x42e1('0x57')](_0x42e1('0x58'),JSON[_0x42e1('0x59')](_0x946764));});};exports['outbound']=function(_0x57b218,_0x511a56,_0x7a231a,_0x3cf893,_0x6c9a71,_0x5def34,_0x2d3987){var _0x5740fb,_0x2547d5,_0x2f4000,_0x47d56b;_0x5def34['serverUrl']=intUtil[_0x42e1('0x44')](_0x5def34[_0x42e1('0x43')]);_0x5def34['remoteUri']=intUtil[_0x42e1('0x44')](_0x5def34[_0x42e1('0x3f')]);if(_0x2d3987&&_0x2d3987[_0x42e1('0x5a')]&&_0x2d3987[_0x42e1('0x5a')]!==_0x42e1('0x5b')){logger[_0x42e1('0x1b')]('[OUTBOUND]',_0x42e1('0x46'));_0x511a56['recordingURL']=util[_0x42e1('0x2d')](_0x42e1('0x48'),_0x5def34[_0x42e1('0x43')],_0x511a56[_0x42e1('0x49')],md5(_0x511a56['uniqueid']));}return getConnection(_0x5def34)[_0x42e1('0x19')](function(_0x5bb94d){_0x47d56b=_0x5bb94d;return getUser(_0x5def34,_0x3cf893[_0x42e1('0x5c')],_0x47d56b);})[_0x42e1('0x19')](function(_0x36d32f){_0x5740fb=_0x36d32f;return getEndUser(_0x5def34,_0x7a231a,_0x511a56[_0x42e1('0x5d')],_0x511a56['destcalleridnum'],_0x47d56b);})[_0x42e1('0x19')](function(_0x582472){_0x2547d5=_0x582472;return getTicket(_0x5def34,_0x5740fb,_0x2547d5,_0x7a231a,_0x511a56,_0x7a231a['Fields'],_0x47d56b,_0x42e1('0x5e'));})[_0x42e1('0x19')](function(_0x4aa494){_0x2f4000=_0x4aa494;logger[_0x42e1('0x1b')](_0x42e1('0x5f'),_0x2f4000['id']);logger[_0x42e1('0x1b')](_0x42e1('0x60'),_0x2f4000['id'],_0x3cf893[_0x42e1('0x3a')],_0x5def34[_0x42e1('0x38')]);switch(_0x5def34['type']){case'integrationTab':emit(util['format']('user:%s',_0x3cf893[_0x42e1('0x3a')]),'trigger:salesforce:display',{'recordId':_0x2f4000['id']});break;case _0x42e1('0x52'):emit(util[_0x42e1('0x2d')]('user:%s',_0x3cf893[_0x42e1('0x3a')]),_0x42e1('0x61'),{'uri':util[_0x42e1('0x2d')](_0x42e1('0x53'),_0x47d56b[_0x42e1('0x54')],_0x2f4000['id'])});break;default:logger[_0x42e1('0x57')](_0x42e1('0x62'),_0x42e1('0x63'));}})[_0x42e1('0x56')](function(_0x54a26d){logger[_0x42e1('0x57')]('[OUTBOUND]',JSON[_0x42e1('0x59')](_0x54a26d));});};exports[_0x42e1('0x64')]=function(_0x218d35,_0x5c2847,_0x23b642,_0xf20911,_0x22cfc1,_0x515ef9){var _0x3b1536,_0x1016cc,_0x55e42b,_0xf16ec1;_0x515ef9[_0x42e1('0x43')]=intUtil[_0x42e1('0x44')](_0x515ef9['serverUrl']);_0x515ef9[_0x42e1('0x3f')]=intUtil['stripTrailingSlash'](_0x515ef9[_0x42e1('0x3f')]);if(_0x22cfc1&&_0x22cfc1[_0x42e1('0x45')]){logger[_0x42e1('0x1b')]('['+_0x5c2847[_0x42e1('0x65')][_0x42e1('0x66')]()+']',_0x42e1('0x46'));_0x5c2847[_0x42e1('0x47')]=util[_0x42e1('0x2d')](_0x42e1('0x48'),_0x515ef9['serverUrl'],_0x5c2847[_0x42e1('0x49')],md5(_0x5c2847[_0x42e1('0x49')]));}else{_0x5c2847[_0x42e1('0x47')]='';}return getConnection(_0x515ef9)[_0x42e1('0x19')](function(_0x46e9ae){_0xf16ec1=_0x46e9ae;if(!_[_0x42e1('0x67')](_0xf20911)){return getUser(_0x515ef9,_0xf20911[_0x42e1('0x3a')],_0xf16ec1);}else{return getUser(_0x515ef9,null,_0xf16ec1);}})[_0x42e1('0x19')](function(_0x433643){_0x3b1536=_0x433643;return getEndUser(_0x515ef9,_0x23b642,_0x5c2847[_0x42e1('0x4a')],_0x5c2847[_0x42e1('0x4b')],_0xf16ec1);})[_0x42e1('0x19')](function(_0x450a3a){_0x1016cc=_0x450a3a;return getTicket(_0x515ef9,_0x3b1536,_0x1016cc,_0x23b642,_0x5c2847,_0x23b642['Fields'],_0xf16ec1);})[_0x42e1('0x19')](function(_0xc8535b){_0x55e42b=_0xc8535b;logger[_0x42e1('0x1b')]('['+_0x5c2847[_0x42e1('0x65')]['toUpperCase']()+_0x42e1('0x68'),_0x55e42b['id']);logger[_0x42e1('0x1b')]('['+_0x5c2847[_0x42e1('0x65')]['toUpperCase']()+_0x42e1('0x69'),_0x515ef9[_0x42e1('0x38')]);})['catch'](function(_0x56743c){logger[_0x42e1('0x57')]('['+_0x5c2847['lastevent'][_0x42e1('0x66')]()+']',JSON[_0x42e1('0x59')](_0x56743c));});}; \ 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 5ad8b7c..9602896 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 _0xadb5=['endUserNumber','user','System','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','forEach','push','length','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','userEmail','GET','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xadb5,0xad));var _0x5adb=function(_0x32e611,_0x509ce6){_0x32e611=_0x32e611-0x0;var _0x542aec=_0xadb5[_0x32e611];return _0x542aec;};'use strict';var _=require('lodash');var Promise=require(_0x5adb('0x0'));var rp=require('request-promise');var util=require(_0x5adb('0x1'));var md5=require(_0x5adb('0x2'));var Redis=require(_0x5adb('0x3'));var intUtil=require('./util');var config=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var io=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));function getAdminUser(_0x353885,_0x47228a,_0x6d1b45,_0x41261c,_0x7293ab,_0x34f59d){return new Promise(function(_0x336bad,_0x129f5a){var _0x275428={'method':'GET','uri':_0x41261c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x7293ab+'&'+_0x34f59d,'auth':_0x47228a,'json':!![]};return rp(_0x275428)[_0x5adb('0xb')](function(_0x1ea238){if(_0x1ea238[_0x5adb('0xc')]['length']>0x0){_0x6d1b45[_0x5adb('0xd')]=_0x1ea238['result'][0x0][_0x5adb('0xe')];}logger['info']('['+[_0x353885[_0x5adb('0xf')]()]+_0x5adb('0x10'),_0x6d1b45);_0x336bad(_0x6d1b45);})[_0x5adb('0x11')](function(_0x5c929a){logger[_0x5adb('0x12')]('['+[_0x353885[_0x5adb('0xf')]()]+']',_0x5c929a[_0x5adb('0x13')]);_0x129f5a(_0x5c929a['message']);});});}function getUser(_0x2312de,_0x518823,_0x367d82,_0x42a482,_0x30614e){return function(_0x304784){logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+_0x5adb('0x15'),_0x304784);return new Promise(function(_0x42f4c6,_0xb953a6){if(intUtil['validateEmail'](_0x304784[_0x5adb('0x16')])){var _0x5de028={'method':_0x5adb('0x17'),'uri':_0x367d82+'sys_user?sysparm_query=email%3D'+_0x304784[_0x5adb('0x16')]+'&'+_0x42a482+'&'+_0x30614e,'auth':_0x518823,'json':!![]};logger['info']('['+[_0x2312de['toUpperCase']()]+_0x5adb('0x18'),_0x5de028);return rp(_0x5de028)[_0x5adb('0xb')](function(_0x438671){logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+'],\x20getUser\x20entity',_0x438671);if(_0x438671[_0x5adb('0xc')]['length']>0x0&&String(_0x438671['result'][0x0][_0x5adb('0x19')])===_0x5adb('0x1a')){_0x304784[_0x5adb('0x1b')]=_0x438671[_0x5adb('0xc')][0x0][_0x5adb('0xe')];}else{_0x304784[_0x5adb('0x1b')]=_0x304784[_0x5adb('0xd')];_0x304784['userEmail']=_0x304784[_0x5adb('0x1c')];}logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+_0x5adb('0x1d'),_0x304784);_0x42f4c6(_0x304784);})[_0x5adb('0x11')](function(_0x49f203){logger[_0x5adb('0x12')]('['+[_0x2312de[_0x5adb('0xf')]()]+']',_0x49f203['message']);_0xb953a6(_0x49f203[_0x5adb('0x13')]);});}else{logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+']\x20using\x20admin\x20profile');_0x304784[_0x5adb('0x1b')]=_0x304784[_0x5adb('0xd')];_0x304784[_0x5adb('0x16')]=_0x304784[_0x5adb('0x1c')];_0x42f4c6(_0x304784);}});};}function createEndUser(_0x36459b,_0x1c06c4,_0x4a5d46,_0x49992e,_0x5d457e){logger[_0x5adb('0x14')]('['+[_0x36459b[_0x5adb('0xf')]()]+_0x5adb('0x1e'),_0x4a5d46);return new Promise(function(_0x512bab,_0x137a5c){var _0x4de310={'method':_0x5adb('0x1f'),'uri':_0x49992e+_0x5adb('0x20')+_0x5d457e,'body':{'user_name':_0x4a5d46[_0x5adb('0x21')],'roles':_0x5adb('0x22'),'first_name':_0x4a5d46[_0x5adb('0x21')],'active':_0x5adb('0x1a'),'date_format':_0x5adb('0x23'),'phone':_0x4a5d46[_0x5adb('0x21')]},'auth':_0x1c06c4,'json':!![]};return rp(_0x4de310)[_0x5adb('0xb')](function(_0x260295){logger['info']('['+[_0x36459b[_0x5adb('0xf')]()]+'],\x20EndUser\x20schema',_0x260295[_0x5adb('0xc')]);_0x4a5d46[_0x5adb('0x24')]=_0x260295['result'][_0x5adb('0xe')];_0x512bab(_0x4a5d46);})[_0x5adb('0x11')](function(_0x461a39){logger['error']('['+[_0x36459b[_0x5adb('0xf')]()]+']',_0x461a39[_0x5adb('0x13')]);_0x137a5c(_0x461a39['message']);});});}function getEndUser(_0x5bb227,_0x1ed9ea,_0x49dd03,_0x663ea0,_0x222568){return function(_0x3c2b07){logger[_0x5adb('0x14')]('['+[_0x5bb227[_0x5adb('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x3c2b07);return new Promise(function(_0x2f7abe,_0x215b88){var _0x1c3a5c={'method':'GET','uri':_0x49dd03+'sys_user?sysparm_query=phone%3D'+_0x3c2b07[_0x5adb('0x21')]+'&'+_0x663ea0+'&'+_0x222568,'auth':_0x1ed9ea,'json':!![]};return rp(_0x1c3a5c)[_0x5adb('0xb')](function(_0x586820){if(_0x586820[_0x5adb('0xc')]['length']>0x0){_0x3c2b07[_0x5adb('0x24')]=_0x586820['result'][0x0][_0x5adb('0xe')];logger['info']('['+[_0x5bb227[_0x5adb('0xf')]()]+_0x5adb('0x25'),_0x3c2b07);_0x2f7abe(_0x3c2b07);}else{return createEndUser(_0x5bb227,_0x1ed9ea,_0x3c2b07,_0x49dd03,_0x663ea0)['then'](function(_0x4761e3){logger['info']('['+[_0x5bb227[_0x5adb('0xf')]()]+_0x5adb('0x26'),_0x4761e3);_0x2f7abe(_0x4761e3);});}})[_0x5adb('0x11')](function(_0x50edd1){logger[_0x5adb('0x12')]('['+[_0x5bb227[_0x5adb('0xf')]()]+']',_0x50edd1[_0x5adb('0x13')]);_0x215b88(_0x50edd1[_0x5adb('0x13')]);});});};}function getCustomFields(_0x22aa95,_0x52d74f){var _0x50fe99={};if(_0x22aa95['length']>0x0){_['forEach'](_0x22aa95,function(_0x427c71){if(_0x427c71[_0x5adb('0x27')]===_0x5adb('0x28')&&_0x427c71[_0x5adb('0x29')]&&!_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x427c71[_0x5adb('0x2d')]['toString']();}else if(_0x427c71['type']===_0x5adb('0x28')&&_0x427c71['idField']&&_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x427c71[_0x5adb('0x2d')][_0x5adb('0x2e')]();}else if(_0x427c71['type']===_0x5adb('0x2f')&&_0x427c71[_0x5adb('0x30')]&&_0x427c71['idField']&&_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')]['toLowerCase']()]=_0x52d74f[_0x427c71[_0x5adb('0x30')]][_0x5adb('0x2e')]();}else if(_0x427c71[_0x5adb('0x27')]===_0x5adb('0x31')&&_0x427c71[_0x5adb('0x32')]&&_0x427c71[_0x5adb('0x32')][_0x5adb('0x33')]&&_0x427c71['idField']&&_0x427c71['customField']){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x52d74f[_0x427c71[_0x5adb('0x32')][_0x5adb('0x33')]['toLowerCase']()]['toString']();}});}return _0x50fe99;}function getTicket(_0xaa32e4,_0x4d7d86,_0x264dfd,_0x72218,_0x1713bc,_0x5358c0){return function(_0x182cbc){logger[_0x5adb('0x14')]('['+[_0xaa32e4['toUpperCase']()]+_0x5adb('0x34'),_0x182cbc);return new Promise(function(_0x251f45,_0x1cdb03){var _0x24758f=_0xaa32e4[_0x5adb('0x2c')]()===_0x5adb('0x35')?_0x182cbc[_0x5adb('0x1b')]:_0x182cbc[_0x5adb('0x24')];var _0x49e1a1={'method':_0x5adb('0x1f'),'uri':_0x264dfd+'incident'+'?'+_0x5358c0,'body':Object['assign']({},{'active':'true','caller_id':_0x24758f,'assigned_to':_0x182cbc[_0x5adb('0x1b')],'short_description':intUtil[_0x5adb('0x36')](_0x72218[_0x5adb('0x37')],_0x1713bc,'\x20'),'description':intUtil['getString'](_0x72218[_0x5adb('0x38')],_0x1713bc,'\x0a')},getCustomFields(_0x72218['Fields'],_0x1713bc)),'auth':_0x4d7d86,'json':!![]};return rp(_0x49e1a1)[_0x5adb('0xb')](function(_0x2c3f21){logger[_0x5adb('0x14')]('['+[_0xaa32e4['toUpperCase']()]+_0x5adb('0x39'),_0x2c3f21['result']);_0x182cbc[_0x5adb('0x3a')]=_0x2c3f21[_0x5adb('0xc')]['sys_id'];_0x182cbc[_0x5adb('0x3b')]=_0x2c3f21[_0x5adb('0xc')][_0x5adb('0x3c')];logger[_0x5adb('0x14')]('['+[_0xaa32e4[_0x5adb('0xf')]()]+']\x20getTicket\x20crm',_0x182cbc);_0x251f45(_0x182cbc);})[_0x5adb('0x11')](function(_0x3a5703){logger[_0x5adb('0x12')]('['+[_0xaa32e4[_0x5adb('0xf')]()]+']',_0x3a5703['message']);_0x1cdb03(_0x3a5703[_0x5adb('0x13')]);});});};}function createRemoteTag(_0x14a46f,_0x3b4794,_0x4d98d0,_0x2b34a8){return new Promise(function(_0xd0e5b7,_0x444a6c){var _0xfd3471={'method':'POST','uri':_0x4d98d0+_0x5adb('0x3d')+'?'+_0x2b34a8,'body':{'short_description':_0x14a46f,'global':!![],'active':!![],'name':_0x14a46f},'auth':_0x3b4794,'json':!![]};return rp(_0xfd3471)[_0x5adb('0xb')](function(_0x28b291){var _0x2cee37=_0x28b291[_0x5adb('0xc')]['sys_id'];_0xd0e5b7(_0x2cee37);});});}function getRemoteTag(_0x378938,_0x4b8d28,_0x2b790d,_0x4f7227,_0x31ae72){return new Promise(function(_0x35df22,_0x1a9358){var _0x42f6d9={'method':'GET','uri':_0x2b790d+_0x5adb('0x3d')+_0x5adb('0x3e')+_0x378938+'&'+_0x4f7227,'auth':_0x4b8d28,'json':!![]};return rp(_0x42f6d9)[_0x5adb('0xb')](function(_0x53d262){if(_0x53d262['result']['length']>0x0){var _0x18ee9a=_0x53d262[_0x5adb('0xc')][0x0][_0x5adb('0xe')];_0x35df22(_0x18ee9a);}else{return createRemoteTag(_0x378938,_0x4b8d28,_0x2b790d,_0x4f7227)[_0x5adb('0xb')](function(_0xa833f4){_0x35df22(_0xa833f4);});}});});}function assignTagToIncident(_0xb06bee,_0x204b9b,_0x8d7810,_0xc880af,_0x380d76){return new Promise(function(_0x452767,_0x1df439){var _0x2c2357={'method':'POST','uri':_0x8d7810+'label_entry'+'?'+_0x380d76,'body':{'label':_0xb06bee,'table':_0x5adb('0x3f'),'id_type':_0x5adb('0x40'),'table_key':_0xc880af[_0x5adb('0x3a')],'title':_0x5adb('0x41')+_0xc880af['ticketNumber'],'id_display':_0xc880af[_0x5adb('0x3b')]},'auth':_0x204b9b,'json':!![]};return rp(_0x2c2357)[_0x5adb('0xb')](function(_0x5d2d2f){_0x452767();})[_0x5adb('0x11')](function(){_0x452767();});});}function manageTags(_0x476e62,_0x1505f7,_0x5edd60,_0x30d185,_0x409357,_0x19df2f,_0x30c92c){return new Promise(function(_0x330290,_0x428019){var _0x513f26=[];_0x1505f7[_0x5adb('0x42')](function(_0x1f042f){_0x513f26[_0x5adb('0x43')](getRemoteTag(_0x1f042f,_0x5edd60,_0x30d185,_0x19df2f,_0x30c92c));});return Promise['all'](_0x513f26)[_0x5adb('0xb')](function(_0x239862){if(_0x239862[_0x5adb('0x44')]){logger['info']('['+[_0x476e62[_0x5adb('0xf')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x239862);var _0xa8ff64=[];_0x239862[_0x5adb('0x42')](function(_0x24e1ab){_0xa8ff64['push'](assignTagToIncident(_0x24e1ab,_0x5edd60,_0x30d185,_0x409357,_0x19df2f));});return Promise[_0x5adb('0x45')](_0xa8ff64)[_0x5adb('0xb')](function(){_0x330290();})['catch'](function(){_0x330290();});}else{_0x330290();}});});}function getTags(_0x12711e,_0x432a3e,_0x248739,_0x3fcad5,_0x55cd0a,_0x4290bb){return function(_0x2b8298){return new Promise(function(_0x307f07,_0x16716e){var _0x5b7556=[];var _0x53a4bc=_0x3fcad5[_0x5adb('0x46')];if(_0x53a4bc&&_0x53a4bc['length']>0x0){_0x5b7556=_['map'](_0x53a4bc,'name');}if(_0x5b7556[_0x5adb('0x44')]>0x0){return manageTags(_0x12711e,_0x5b7556,_0x432a3e,_0x248739,_0x2b8298,_0x55cd0a,_0x4290bb)[_0x5adb('0xb')](function(){_0x307f07(_0x2b8298);});}else{_0x307f07(_0x2b8298);}});};}function emit(_0x48bb5c,_0x395350,_0x91e023){var _0xcdde17=_0x5adb('0x47')+_0x5adb('0x48')+_0x5adb('0x49')+_0x5adb('0x4a');var _0x1ffcd3={'uri':_0x48bb5c+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x91e023+_0xcdde17};io['to'](util['format']('user:%s',_0x395350))[_0x5adb('0x4b')](_0x5adb('0x4c'),_0x1ffcd3);}exports['cs']=function(_0x3a0d1b,_0x2a55a3,_0x1f59bb,_0x2f6ef7,_0x386c76,_0x25f761,_0x58455b,_0x5e55c2){var _0x1fc73b={};var _0x56df90={'user':_0x25f761[_0x5adb('0x4d')],'pass':_0x25f761[_0x5adb('0x4e')]};var _0x2146f0=_0x5adb('0x4f');var _0x40140f=_0x5adb('0x50');_0x25f761[_0x5adb('0x51')]=intUtil[_0x5adb('0x52')](_0x25f761['remoteUri']);_0x25f761[_0x5adb('0x53')]=intUtil[_0x5adb('0x52')](_0x25f761[_0x5adb('0x53')]);var _0x5d3aa4=util[_0x5adb('0x54')](_0x5adb('0x55'),_0x25f761['remoteUri']);_0x1fc73b[_0x5adb('0x16')]=!_['isNil'](_0x2f6ef7)?_0x2f6ef7[_0x5adb('0x56')]:null;_0x1fc73b[_0x5adb('0x1c')]=_0x25f761['email'];_0x1fc73b[_0x5adb('0x21')]=_0x5e55c2[_0x5adb('0x2c')]()===_0x5adb('0x35')?_0x2a55a3[_0x5adb('0x57')]:_0x2a55a3[_0x5adb('0x58')];_0x1fc73b[_0x5adb('0x59')]=_0x5e55c2===_0x5adb('0x5a')||_0x5e55c2===_0x5adb('0x5b')?'queue':_0x5adb('0x35');var _0x31345d=util[_0x5adb('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25f761['serverUrl'],_0x2a55a3[_0x5adb('0x5c')],md5(_0x2a55a3['uniqueid']));if(_0x386c76&&_0x386c76[_0x5adb('0x5d')]){logger[_0x5adb('0x14')](_0x5adb('0x5e'),'Recording\x20is\x20enabled!');_0x2a55a3[_0x5adb('0x5f')]=_0x31345d;}else if(_0x58455b&&_0x58455b[_0x5adb('0x60')]&&_0x58455b[_0x5adb('0x60')]!==_0x5adb('0x61')){logger[_0x5adb('0x14')]('[OUTBOUND]',_0x5adb('0x62'));_0x2a55a3[_0x5adb('0x5f')]=_0x31345d;}else{_0x2a55a3[_0x5adb('0x5f')]='';}return getAdminUser(_0x5e55c2,_0x56df90,_0x1fc73b,_0x5d3aa4,_0x40140f,_0x2146f0)[_0x5adb('0xb')](getUser(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x40140f,_0x2146f0))['then'](getEndUser(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x40140f,_0x2146f0))[_0x5adb('0xb')](getTicket(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x1f59bb,_0x2a55a3,_0x40140f))[_0x5adb('0xb')](function(_0x182873){logger[_0x5adb('0x14')](util[_0x5adb('0x54')](_0x5adb('0x63'),_0x182873[_0x5adb('0x3a')]));logger['info'](util[_0x5adb('0x54')](_0x5adb('0x64'),_0x5e55c2));if(_0x5e55c2!=='unmanaged'){logger[_0x5adb('0x14')]('['+[_0x5e55c2[_0x5adb('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x25f761[_0x5adb('0x51')],_0x2f6ef7['name'],_0x182873[_0x5adb('0x3a')]);}})[_0x5adb('0x11')](function(_0x4a2ebc){logger[_0x5adb('0x12')]('['+[_0x5e55c2['toUpperCase']()]+_0x5adb('0x65'),util[_0x5adb('0x66')](_0x4a2ebc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x326f=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','nameField','customField','idField','toLowerCase','toString','string','content','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','forEach','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','email','destcalleridnum','callDirection','queue','unmanaged'];(function(_0x494659,_0x1b8e75){var _0x36a11d=function(_0x1b4e77){while(--_0x1b4e77){_0x494659['push'](_0x494659['shift']());}};_0x36a11d(++_0x1b8e75);}(_0x326f,0xd1));var _0xf326=function(_0x5c3370,_0x35d85a){_0x5c3370=_0x5c3370-0x0;var _0x551e8c=_0x326f[_0x5c3370];return _0x551e8c;};'use strict';var _=require(_0xf326('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xf326('0x1'));var md5=require(_0xf326('0x2'));var Redis=require(_0xf326('0x3'));var intUtil=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));config[_0xf326('0x8')]=_[_0xf326('0x9')](config[_0xf326('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf326('0xa'))(new Redis(config[_0xf326('0x8')]));function getAdminUser(_0x165f95,_0x1e7b8a,_0x515bfa,_0x4c206c,_0x592975,_0x3bacf2){return new Promise(function(_0x1fc80e,_0x163416){var _0x2686e1={'method':_0xf326('0xb'),'uri':_0x4c206c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x592975+'&'+_0x3bacf2,'auth':_0x1e7b8a,'json':!![]};return rp(_0x2686e1)[_0xf326('0xc')](function(_0x53cbcd){if(_0x53cbcd[_0xf326('0xd')]['length']>0x0){_0x515bfa[_0xf326('0xe')]=_0x53cbcd['result'][0x0][_0xf326('0xf')];}logger[_0xf326('0x10')]('['+[_0x165f95['toUpperCase']()]+_0xf326('0x11'),_0x515bfa);_0x1fc80e(_0x515bfa);})[_0xf326('0x12')](function(_0x3504eb){logger[_0xf326('0x13')]('['+[_0x165f95['toUpperCase']()]+']',_0x3504eb[_0xf326('0x14')]);_0x163416(_0x3504eb['message']);});});}function getUser(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+_0xf326('0x16'),_0x292f4b);return new Promise(function(_0x5a682a,_0x3ad7da){if(intUtil[_0xf326('0x17')](_0x292f4b[_0xf326('0x18')])){var _0x31ffb9={'method':_0xf326('0xb'),'uri':_0x11f6d2+_0xf326('0x19')+_0x292f4b['userEmail']+'&'+_0x1f2e5a+'&'+_0xa63d1a,'auth':_0xdf21d9,'json':!![]};logger['info']('['+[_0x54bd1a['toUpperCase']()]+_0xf326('0x1a'),_0x31ffb9);return rp(_0x31ffb9)[_0xf326('0xc')](function(_0x484cbe){logger['info']('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20entity',_0x484cbe);if(_0x484cbe['result'][_0xf326('0x1b')]>0x0&&String(_0x484cbe[_0xf326('0xd')][0x0]['active'])==='true'){_0x292f4b[_0xf326('0x1c')]=_0x484cbe[_0xf326('0xd')][0x0]['sys_id'];}else{_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b[_0xf326('0x1d')];}logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+'],\x20getUser\x20crm',_0x292f4b);_0x5a682a(_0x292f4b);})['catch'](function(_0x4f31f6){logger[_0xf326('0x13')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']',_0x4f31f6[_0xf326('0x14')]);_0x3ad7da(_0x4f31f6[_0xf326('0x14')]);});}else{logger[_0xf326('0x10')]('['+[_0x54bd1a[_0xf326('0x15')]()]+']\x20using\x20admin\x20profile');_0x292f4b[_0xf326('0x1c')]=_0x292f4b[_0xf326('0xe')];_0x292f4b[_0xf326('0x18')]=_0x292f4b['adminEmail'];_0x5a682a(_0x292f4b);}});};}function createEndUser(_0x1617d2,_0x55ad0f,_0x4a9abf,_0x6a8e89,_0x1ae23a){logger[_0xf326('0x10')]('['+[_0x1617d2['toUpperCase']()]+_0xf326('0x1e'),_0x4a9abf);return new Promise(function(_0x292500,_0x55790d){var _0x225776={'method':_0xf326('0x1f'),'uri':_0x6a8e89+_0xf326('0x20')+_0x1ae23a,'body':{'user_name':_0x4a9abf[_0xf326('0x21')],'roles':_0xf326('0x22'),'first_name':_0x4a9abf[_0xf326('0x21')],'active':_0xf326('0x23'),'date_format':_0xf326('0x24'),'phone':_0x4a9abf[_0xf326('0x21')]},'auth':_0x55ad0f,'json':!![]};return rp(_0x225776)[_0xf326('0xc')](function(_0x4b52f2){logger[_0xf326('0x10')]('['+[_0x1617d2[_0xf326('0x15')]()]+_0xf326('0x25'),_0x4b52f2['result']);_0x4a9abf[_0xf326('0x26')]=_0x4b52f2[_0xf326('0xd')][_0xf326('0xf')];_0x292500(_0x4a9abf);})['catch'](function(_0x5b101d){logger[_0xf326('0x13')]('['+[_0x1617d2[_0xf326('0x15')]()]+']',_0x5b101d[_0xf326('0x14')]);_0x55790d(_0x5b101d[_0xf326('0x14')]);});});}function getEndUser(_0x30694f,_0x2e8a64,_0x62585a,_0x2d5f20,_0x580374){return function(_0x461e93){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x27'),_0x461e93);return new Promise(function(_0x4e5d7c,_0xce1cbb){var _0x481b64={'method':'GET','uri':_0x62585a+_0xf326('0x28')+_0x461e93['endUserNumber']+'&'+_0x2d5f20+'&'+_0x580374,'auth':_0x2e8a64,'json':!![]};return rp(_0x481b64)[_0xf326('0xc')](function(_0x57aa27){if(_0x57aa27[_0xf326('0xd')][_0xf326('0x1b')]>0x0){_0x461e93[_0xf326('0x26')]=_0x57aa27['result'][0x0][_0xf326('0xf')];logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x29'),_0x461e93);_0x4e5d7c(_0x461e93);}else{return createEndUser(_0x30694f,_0x2e8a64,_0x461e93,_0x62585a,_0x2d5f20)[_0xf326('0xc')](function(_0x40fa7a){logger[_0xf326('0x10')]('['+[_0x30694f['toUpperCase']()]+_0xf326('0x2a'),_0x40fa7a);_0x4e5d7c(_0x40fa7a);});}})[_0xf326('0x12')](function(_0x1e69b1){logger[_0xf326('0x13')]('['+[_0x30694f[_0xf326('0x15')]()]+']',_0x1e69b1['message']);_0xce1cbb(_0x1e69b1[_0xf326('0x14')]);});});};}function getCustomFields(_0x1b7bf6,_0x5cfb97){var _0x4dd361={};if(_0x1b7bf6[_0xf326('0x1b')]>0x0){_['forEach'](_0x1b7bf6,function(_0x55dfa8){if(_0x55dfa8[_0xf326('0x2b')]==='string'&&_0x55dfa8[_0xf326('0x2c')]&&!_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8['content'][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x31')&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x55dfa8[_0xf326('0x32')][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]===_0xf326('0x33')&&_0x55dfa8[_0xf326('0x34')]&&_0x55dfa8['idField']&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x34')]][_0xf326('0x30')]();}else if(_0x55dfa8[_0xf326('0x2b')]==='customVariable'&&_0x55dfa8[_0xf326('0x35')]&&_0x55dfa8[_0xf326('0x35')]['name']&&_0x55dfa8[_0xf326('0x2e')]&&_0x55dfa8[_0xf326('0x2d')]){_0x4dd361[_0x55dfa8[_0xf326('0x2e')][_0xf326('0x2f')]()]=_0x5cfb97[_0x55dfa8[_0xf326('0x35')]['name']['toLowerCase']()][_0xf326('0x30')]();}});}return _0x4dd361;}function getTicket(_0x44e101,_0x5ed62e,_0x4bd865,_0x8e318d,_0x269e89,_0x21c98e){return function(_0x5b3705){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x36'),_0x5b3705);return new Promise(function(_0xc43507,_0xc99be){var _0x2d9bba=_0x44e101[_0xf326('0x2f')]()===_0xf326('0x37')?_0x5b3705[_0xf326('0x1c')]:_0x5b3705[_0xf326('0x26')];var _0x1c76c8={'method':_0xf326('0x1f'),'uri':_0x4bd865+_0xf326('0x38')+'?'+_0x21c98e,'body':Object[_0xf326('0x39')]({},{'active':_0xf326('0x23'),'caller_id':_0x2d9bba,'assigned_to':_0x5b3705['userId'],'short_description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3b')],_0x269e89,'\x20'),'description':intUtil[_0xf326('0x3a')](_0x8e318d[_0xf326('0x3c')],_0x269e89,'\x0a')},getCustomFields(_0x8e318d['Fields'],_0x269e89)),'auth':_0x5ed62e,'json':!![]};return rp(_0x1c76c8)[_0xf326('0xc')](function(_0x2f5511){logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x2f5511[_0xf326('0xd')]);_0x5b3705[_0xf326('0x3d')]=_0x2f5511[_0xf326('0xd')][_0xf326('0xf')];_0x5b3705[_0xf326('0x3e')]=_0x2f5511['result']['number'];logger[_0xf326('0x10')]('['+[_0x44e101[_0xf326('0x15')]()]+_0xf326('0x3f'),_0x5b3705);_0xc43507(_0x5b3705);})['catch'](function(_0x102fba){logger[_0xf326('0x13')]('['+[_0x44e101[_0xf326('0x15')]()]+']',_0x102fba['message']);_0xc99be(_0x102fba['message']);});});};}function createRemoteTag(_0x36ef89,_0x5b4832,_0x1cf58f,_0x554277){return new Promise(function(_0x458e5f,_0x7ee57){var _0x28c959={'method':_0xf326('0x1f'),'uri':_0x1cf58f+_0xf326('0x40')+'?'+_0x554277,'body':{'short_description':_0x36ef89,'global':!![],'active':!![],'name':_0x36ef89},'auth':_0x5b4832,'json':!![]};return rp(_0x28c959)[_0xf326('0xc')](function(_0x7f7ece){var _0x495a16=_0x7f7ece[_0xf326('0xd')][_0xf326('0xf')];_0x458e5f(_0x495a16);});});}function getRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f,_0x3b8635){return new Promise(function(_0x16c578,_0x1159e){var _0x58fcf0={'method':_0xf326('0xb'),'uri':_0x208ba4+_0xf326('0x40')+_0xf326('0x41')+_0x424d24+'&'+_0x3a832f,'auth':_0x4b0d8e,'json':!![]};return rp(_0x58fcf0)[_0xf326('0xc')](function(_0x50690e){if(_0x50690e[_0xf326('0xd')][_0xf326('0x1b')]>0x0){var _0x227850=_0x50690e[_0xf326('0xd')][0x0]['sys_id'];_0x16c578(_0x227850);}else{return createRemoteTag(_0x424d24,_0x4b0d8e,_0x208ba4,_0x3a832f)['then'](function(_0x18b46e){_0x16c578(_0x18b46e);});}});});}function assignTagToIncident(_0x44d2ed,_0x55ca96,_0x3cf6fa,_0x29de71,_0x316609){return new Promise(function(_0x1258d1,_0x5765b0){var _0xb1c18c={'method':'POST','uri':_0x3cf6fa+'label_entry'+'?'+_0x316609,'body':{'label':_0x44d2ed,'table':_0xf326('0x38'),'id_type':'Incident','table_key':_0x29de71[_0xf326('0x3d')],'title':_0xf326('0x42')+_0x29de71[_0xf326('0x3e')],'id_display':_0x29de71['ticketNumber']},'auth':_0x55ca96,'json':!![]};return rp(_0xb1c18c)['then'](function(_0x1fd9c9){_0x1258d1();})[_0xf326('0x12')](function(){_0x1258d1();});});}function manageTags(_0x33b259,_0x5d0177,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c,_0x131184){return new Promise(function(_0x217897,_0xbd3a01){var _0x18dbfc=[];_0x5d0177[_0xf326('0x43')](function(_0x3aeb20){_0x18dbfc[_0xf326('0x44')](getRemoteTag(_0x3aeb20,_0x2759d7,_0x487020,_0x40929c,_0x131184));});return Promise[_0xf326('0x45')](_0x18dbfc)[_0xf326('0xc')](function(_0x1e56fb){if(_0x1e56fb[_0xf326('0x1b')]){logger['info']('['+[_0x33b259[_0xf326('0x15')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1e56fb);var _0x6ac6=[];_0x1e56fb[_0xf326('0x43')](function(_0x5e858d){_0x6ac6[_0xf326('0x44')](assignTagToIncident(_0x5e858d,_0x2759d7,_0x487020,_0xe4a00d,_0x40929c));});return Promise['all'](_0x6ac6)[_0xf326('0xc')](function(){_0x217897();})[_0xf326('0x12')](function(){_0x217897();});}else{_0x217897();}});});}function getTags(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x51ff5e,_0x4ec099,_0x1209ca){return function(_0x32fe3a){return new Promise(function(_0x15a538,_0x21b3cc){var _0x1fc586=[];var _0x579d2c=_0x51ff5e[_0xf326('0x46')];if(_0x579d2c&&_0x579d2c[_0xf326('0x1b')]>0x0){_0x1fc586=_['map'](_0x579d2c,'name');}if(_0x1fc586['length']>0x0){return manageTags(_0x28f3cb,_0x1fc586,_0x2d45c9,_0x31b6dd,_0x32fe3a,_0x4ec099,_0x1209ca)[_0xf326('0xc')](function(){_0x15a538(_0x32fe3a);});}else{_0x15a538(_0x32fe3a);}});};}function emit(_0x7edf5,_0x4150fa,_0x235525){var _0x240ce5=_0xf326('0x47')+_0xf326('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xf326('0x49');var _0x588d26={'uri':_0x7edf5+_0xf326('0x4a')+_0x235525+_0x240ce5};io['to'](util[_0xf326('0x4b')]('user:%s',_0x4150fa))[_0xf326('0x4c')]('trigger:browser:url',_0x588d26);}exports['cs']=function(_0x499b59,_0x2dd9e4,_0x540fa0,_0x78ba34,_0x3411a4,_0x461059,_0x2ea5a2,_0x17cd36){var _0x541491={};var _0x4a053c={'user':_0x461059['username'],'pass':_0x461059[_0xf326('0x4d')]};var _0x307441=_0xf326('0x4e');var _0x180616=_0xf326('0x4f');_0x461059['remoteUri']=intUtil[_0xf326('0x50')](_0x461059[_0xf326('0x51')]);_0x461059[_0xf326('0x52')]=intUtil['stripTrailingSlash'](_0x461059['serverUrl']);var _0x830c9f=util[_0xf326('0x4b')]('%s/api/now/table/',_0x461059['remoteUri']);_0x541491[_0xf326('0x18')]=!_['isNil'](_0x78ba34)?_0x78ba34[_0xf326('0x53')]:null;_0x541491['adminEmail']=_0x461059['email'];_0x541491['endUserNumber']=_0x17cd36[_0xf326('0x2f')]()===_0xf326('0x37')?_0x2dd9e4[_0xf326('0x54')]:_0x2dd9e4['calleridnum'];_0x541491[_0xf326('0x55')]=_0x17cd36===_0xf326('0x56')||_0x17cd36===_0xf326('0x57')?_0xf326('0x56'):_0xf326('0x37');var _0x39e73d=util[_0xf326('0x4b')](_0xf326('0x58'),_0x461059[_0xf326('0x52')],_0x2dd9e4['uniqueid'],md5(_0x2dd9e4[_0xf326('0x59')]));if(_0x3411a4&&_0x3411a4['monitor_format']){logger[_0xf326('0x10')](_0xf326('0x5a'),_0xf326('0x5b'));_0x2dd9e4['recordingURL']=_0x39e73d;}else if(_0x2ea5a2&&_0x2ea5a2[_0xf326('0x5c')]&&_0x2ea5a2[_0xf326('0x5c')]!==_0xf326('0x5d')){logger['info'](_0xf326('0x5e'),_0xf326('0x5b'));_0x2dd9e4[_0xf326('0x5f')]=_0x39e73d;}else{_0x2dd9e4[_0xf326('0x5f')]='';}return getAdminUser(_0x17cd36,_0x4a053c,_0x541491,_0x830c9f,_0x180616,_0x307441)['then'](getUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))[_0xf326('0xc')](getEndUser(_0x17cd36,_0x4a053c,_0x830c9f,_0x180616,_0x307441))['then'](getTicket(_0x17cd36,_0x4a053c,_0x830c9f,_0x540fa0,_0x2dd9e4,_0x180616))['then'](function(_0x32d9c5){logger[_0xf326('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x32d9c5['ticketId']));logger[_0xf326('0x10')](util['format'](_0xf326('0x60'),_0x17cd36));if(_0x17cd36!==_0xf326('0x57')){logger[_0xf326('0x10')]('['+[_0x17cd36[_0xf326('0x15')]()]+']',_0xf326('0x61'));emit(_0x461059[_0xf326('0x51')],_0x78ba34['name'],_0x32d9c5[_0xf326('0x3d')]);}})[_0xf326('0x12')](function(_0x5f1724){logger['error']('['+[_0x17cd36[_0xf326('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xf326('0x62')](_0x5f1724,{'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 26bba6c..e38a0ad 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 _0x5a5a=['variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','find','entry_list','name_value_list','user_name','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','[HTTP]','map','string','nameField','customField','toLowerCase','type','custom_fields','content','toString','variable','push','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','uri','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','isNil','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','POST','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','name','direction','length','forEach'];(function(_0x356776,_0x1e4931){var _0x40f2b5=function(_0x49c26a){while(--_0x49c26a){_0x356776['push'](_0x356776['shift']());}};_0x40f2b5(++_0x1e4931);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x505df9,_0x14138e){_0x505df9=_0x505df9-0x0;var _0x1cc025=_0x5a5a[_0x505df9];return _0x1cc025;};'use strict';var _=require('lodash');var rp=require(_0xa5a5('0x0'));var BPromise=require(_0xa5a5('0x1'));var md5=require(_0xa5a5('0x2'));var util=require(_0xa5a5('0x3'));var Redis=require(_0xa5a5('0x4'));var intUtil=require('./util');var config=require(_0xa5a5('0x5'));var logger=require(_0xa5a5('0x6'))(_0xa5a5('0x7'));config['redis']=_['defaults'](config[_0xa5a5('0x8')],{'host':_0xa5a5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa5a5('0x8')]));var def={'method':_0xa5a5('0xa'),'json':!![]};function emit(_0x1234c2,_0x3a23f4,_0x458bbd){io['to'](_0x1234c2)['emit'](_0x3a23f4,_0x458bbd);}function getTicket(_0x158a80,_0x15ab15,_0x18f261,_0x2dace1,_0xed7e19,_0x1b4247,_0x2b1098,_0x27bd72){logger[_0xa5a5('0xb')](_0xa5a5('0xc'));var _0x457da1=new Date();var _0x36b56c=[{'name':'name','value':intUtil[_0xa5a5('0xd')](_0x2dace1[_0xa5a5('0xe')],_0xed7e19,'\x20')},{'name':_0xa5a5('0xf'),'value':_0x15ab15['id']},{'name':_0xa5a5('0x10'),'value':_0x15ab15['id']},{'name':_0xa5a5('0x11'),'value':intUtil[_0xa5a5('0xd')](_0x2dace1['Descriptions'],_0xed7e19,'\x0a')},{'name':_0xa5a5('0x12'),'value':_0x457da1[_0xa5a5('0x13')]()[_0xa5a5('0x14')](0x0,0x13)[_0xa5a5('0x15')]('T','\x20')},{'name':_0xa5a5('0x16'),'value':'0'},{'name':_0xa5a5('0x17'),'value':'15'},{'name':_0xa5a5('0x18'),'value':_0x18f261['id']},{'name':_0xa5a5('0x19'),'value':'Contacts'},{'name':_0xa5a5('0x1a'),'value':_0x18f261[_0xa5a5('0x1b')]},{'name':_0xa5a5('0x1c'),'value':_0x27bd72}];if(_0x1b4247[_0xa5a5('0x1d')]){_[_0xa5a5('0x1e')](_0x1b4247,function(_0x12e2f2){if(_0xed7e19[_0x12e2f2[_0xa5a5('0x1f')]]){_0x36b56c['push']({'name':_0x12e2f2[_0xa5a5('0x20')],'value':_0xed7e19[_0x12e2f2[_0xa5a5('0x1f')]]});}});}return request({'form':{'method':_0xa5a5('0x21'),'input_type':_0xa5a5('0x22'),'response_type':'JSON','rest_data':JSON[_0xa5a5('0x23')]({'session':_0x2b1098['id'],'module_name':'Calls','name_value_list':_0x36b56c})}});}function getAuth(_0x2554c0){return util[_0xa5a5('0x24')](_0xa5a5('0x25'),new Buffer(_0x2554c0[_0xa5a5('0x26')]+':X')['toString']('base64'));}function getServerInfo(_0x2001ed){return request({'form':{'method':_0xa5a5('0x27'),'input_type':_0xa5a5('0x22'),'response_type':'JSON','rest_data':JSON[_0xa5a5('0x23')]({'session':_0x2001ed['id']})}});}function getUser(_0x4b4613,_0x337e52,_0x4996b3){if(!_['isNil'](_0x337e52)){logger[_0xa5a5('0xb')](_0xa5a5('0x28'),_0x337e52);return request({'form':{'method':_0xa5a5('0x29'),'input_type':_0xa5a5('0x22'),'response_type':'JSON','rest_data':JSON[_0xa5a5('0x23')]({'session':_0x4996b3['id'],'module_name':'Employees','query':util[_0xa5a5('0x24')](_0xa5a5('0x2a'),_0x337e52),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa5a5('0x2b')](function(_0xdfa813){if(_0xdfa813['entry_list']['length']){var _0x36d2a5=_[_0xa5a5('0x2c')](_0xdfa813[_0xa5a5('0x2d')],function(_0x4d1201){return _0x4d1201[_0xa5a5('0x2e')][_0xa5a5('0x2f')]['value']===_0x337e52;});if(_0x36d2a5){logger[_0xa5a5('0xb')]('Agent\x20found!');return BPromise[_0xa5a5('0x30')]({'id':_0x36d2a5['name_value_list']['id'][_0xa5a5('0x31')],'name':_0x36d2a5[_0xa5a5('0x2e')]['name']['value']});}}logger['info'](_0xa5a5('0x32'));return BPromise['resolve']({'id':_0x4996b3[_0xa5a5('0x2e')][_0xa5a5('0x33')]['value'],'name':_0x4996b3[_0xa5a5('0x2e')][_0xa5a5('0x2f')]['value']});});}else{logger[_0xa5a5('0xb')](_0xa5a5('0x34'));return BPromise[_0xa5a5('0x30')]({'id':_0x4996b3[_0xa5a5('0x2e')][_0xa5a5('0x33')][_0xa5a5('0x31')],'name':_0x4996b3[_0xa5a5('0x2e')]['user_name'][_0xa5a5('0x31')]});}}function getEndUser(_0xa3c416,_0x1a34cd,_0x1507b7,_0x18c61e){logger[_0xa5a5('0xb')](_0xa5a5('0x35'),_0x1507b7);return request({'form':{'method':_0xa5a5('0x29'),'input_type':_0xa5a5('0x22'),'response_type':_0xa5a5('0x22'),'rest_data':JSON[_0xa5a5('0x23')]({'session':_0x18c61e['id'],'module_name':_0xa5a5('0x36'),'query':util[_0xa5a5('0x24')](_0xa5a5('0x37'),_0x1507b7),'order_by':'','offset':'0','select_fields':['id',_0xa5a5('0x1b'),_0xa5a5('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa5a5('0x2b')](function(_0x4b538c){if(_0x4b538c[_0xa5a5('0x2d')]['length']){var _0x49c55d=_['find'](_0x4b538c[_0xa5a5('0x2d')],function(_0x5625bd){return _0x5625bd[_0xa5a5('0x2e')][_0xa5a5('0x38')][_0xa5a5('0x31')]===_0x1507b7;});if(_0x49c55d){logger['info'](_0xa5a5('0x39'));return BPromise['resolve']({'id':_0x49c55d['name_value_list']['id'][_0xa5a5('0x31')],'name':_0x49c55d[_0xa5a5('0x2e')]['name'][_0xa5a5('0x31')],'phone':_0x49c55d['name_value_list']['phone_home'][_0xa5a5('0x31')]});}}else{logger['info'](_0xa5a5('0x3a'));return request({'form':{'method':'set_entry','input_type':_0xa5a5('0x22'),'response_type':_0xa5a5('0x22'),'rest_data':JSON[_0xa5a5('0x23')]({'session':_0x18c61e['id'],'module_name':_0xa5a5('0x36'),'name_value_list':[{'name':_0xa5a5('0x3b'),'value':_0x1a34cd!==_0xa5a5('0x3c')?_0x1a34cd:util[_0xa5a5('0x24')](_0xa5a5('0x3d'),_0x1507b7)},{'name':_0xa5a5('0x38'),'value':_0x1507b7}]})}})[_0xa5a5('0x2b')](function(_0x569e8d){logger[_0xa5a5('0xb')]('Enduser\x20created.');return BPromise[_0xa5a5('0x30')]({'id':_0x569e8d['id'],'name':_0x569e8d[_0xa5a5('0x2d')]['first_name'][_0xa5a5('0x31')],'phone':_0x569e8d[_0xa5a5('0x2d')][_0xa5a5('0x38')][_0xa5a5('0x31')]});});}});}function request(_0x4780b9){logger['debug'](_0xa5a5('0x3e'),JSON[_0xa5a5('0x23')](_0x4780b9));return rp(_['merge'](def,_0x4780b9));}function getTags(_0xc630e8,_0x24a96d){var _0x283f2e=[];if(_0xc630e8&&_0xc630e8[_0xa5a5('0x1d')]>0x0){_0x283f2e=_[_0xa5a5('0x3f')](_0xc630e8,_0x24a96d);}return _0x283f2e;}function getCustomFields(_0x408006,_0xfa3609){var _0x5a9a7f=[];var _0x16c579={'custom_fields':[]};if(_0x408006['length']>0x0){_[_0xa5a5('0x1e')](_0x408006,function(_0x5b476d){if(_0x5b476d['type']===_0xa5a5('0x40')&&_0x5b476d[_0xa5a5('0x41')]&&!_0x5b476d[_0xa5a5('0x42')]){_0x16c579[_0x5b476d['nameField'][_0xa5a5('0x43')]()]=_0x5b476d['content']['toString']();}else if(_0x5b476d[_0xa5a5('0x44')]===_0xa5a5('0x40')&&_0x5b476d[_0xa5a5('0x20')]&&_0x5b476d['customField']){_0x16c579[_0xa5a5('0x45')]['push']({'id':_0x5b476d['idField'],'value':_0x5b476d[_0xa5a5('0x46')][_0xa5a5('0x47')]()});}else if(_0x5b476d[_0xa5a5('0x44')]===_0xa5a5('0x48')&&_0x5b476d[_0xa5a5('0x1f')]&&_0x5b476d[_0xa5a5('0x20')]&&_0x5b476d[_0xa5a5('0x42')]){_0xfa3609[_0x5b476d[_0xa5a5('0x1f')]]&&_0x16c579['custom_fields'][_0xa5a5('0x49')]({'id':_0x5b476d[_0xa5a5('0x20')],'value':_0xfa3609[_0x5b476d[_0xa5a5('0x1f')]][_0xa5a5('0x47')]()});}else if(_0x5b476d[_0xa5a5('0x44')]===_0xa5a5('0x4a')&&_0x5b476d['Variable']&&_0x5b476d[_0xa5a5('0x4b')][_0xa5a5('0x1b')]&&_0x5b476d['idField']&&_0x5b476d[_0xa5a5('0x42')]){_0xfa3609[_0x5b476d[_0xa5a5('0x4b')][_0xa5a5('0x1b')]['toLowerCase']()]&&_0x16c579[_0xa5a5('0x45')][_0xa5a5('0x49')]({'id':_0x5b476d[_0xa5a5('0x20')],'value':_0xfa3609[_0x5b476d[_0xa5a5('0x4b')]['name']['toLowerCase']()][_0xa5a5('0x47')]()});}});}return _0x16c579;}function getConnection(_0x2811ae){return request({'method':_0xa5a5('0xa'),'form':{'method':'login','input_type':_0xa5a5('0x22'),'response_type':_0xa5a5('0x22'),'rest_data':JSON[_0xa5a5('0x23')]({'user_auth':{'user_name':_0x2811ae[_0xa5a5('0x4c')],'password':_0x2811ae[_0xa5a5('0x4d')],'encryption':_0xa5a5('0x4e')},'application':_0xa5a5('0x4f')})}})['then'](function(_0x33e128){var _0x22776f=_0x33e128;if(_0x22776f['id']){def[_0xa5a5('0x50')]=_0x22776f['id'];return BPromise[_0xa5a5('0x30')](_0x22776f);}else{throw new Error(util[_0xa5a5('0x24')](_0xa5a5('0x51'),_0x2811ae['id']));}});}function setRelationship(_0x54b422,_0x3dcf1f,_0x5f72b4,_0x12d24e){return request({'form':{'method':'set_relationship','input_type':_0xa5a5('0x22'),'response_type':_0xa5a5('0x22'),'rest_data':JSON['stringify']({'session':_0x54b422['id'],'module_name':_0xa5a5('0x52'),'module_id':_0x5f72b4['id'],'link_field_name':_0x12d24e,'related_ids':[_0x3dcf1f['id']]})}});}exports[_0xa5a5('0x53')]=function(_0x148ab0,_0xd22d24,_0x4d9b44,_0x488276,_0x20187c,_0x3b5a7a){var _0x21d940,_0x1cb977,_0x227337,_0x140256;_0x3b5a7a['remoteUri']=intUtil['stripTrailingSlash'](_0x3b5a7a[_0xa5a5('0x54')]);_0x3b5a7a[_0xa5a5('0x55')]=intUtil[_0xa5a5('0x56')](_0x3b5a7a['serverUrl']);def['uri']=util['format'](_0xa5a5('0x57'),_0x3b5a7a[_0xa5a5('0x54')]);if(_0x20187c&&_0x20187c[_0xa5a5('0x58')]){logger[_0xa5a5('0xb')](_0xa5a5('0x59'),_0xa5a5('0x5a'));_0xd22d24[_0xa5a5('0x5b')]=util[_0xa5a5('0x24')](_0xa5a5('0x5c'),_0x3b5a7a[_0xa5a5('0x55')],_0xd22d24['uniqueid'],md5(_0xd22d24[_0xa5a5('0x5d')]));}else{_0xd22d24['recordingURL']='';}return getConnection(_0x3b5a7a)[_0xa5a5('0x2b')](function(_0x1a78ed){_0x140256=_0x1a78ed;return getUser(_0x3b5a7a,_0x488276[_0xa5a5('0x1b')],_0x140256);})['then'](function(_0x3abbb7){_0x21d940=_0x3abbb7;logger[_0xa5a5('0xb')]('The\x20User\x20ID\x20is:',_0x21d940['id']);return getEndUser(_0x3b5a7a,_0xd22d24[_0xa5a5('0x5e')],_0xd22d24[_0xa5a5('0x5f')],_0x140256);})[_0xa5a5('0x2b')](function(_0x19910c){_0x1cb977=_0x19910c;logger[_0xa5a5('0xb')](_0xa5a5('0x60'),_0x1cb977['id']);return getTicket(_0x3b5a7a,_0x21d940,_0x1cb977,_0x4d9b44,_0xd22d24,_0x4d9b44[_0xa5a5('0x61')],_0x140256,_0xa5a5('0x62'));})[_0xa5a5('0x2b')](function(_0x13a2c2){_0x227337=_0x13a2c2;logger['info'](_0xa5a5('0x63'));logger[_0xa5a5('0xb')](_0xa5a5('0x64'),_0x227337['id']);return setRelationship(_0x140256,_0x21d940,_0x227337,'users');})[_0xa5a5('0x2b')](function(){return setRelationship(_0x140256,_0x1cb977,_0x227337,_0xa5a5('0x65'));})[_0xa5a5('0x2b')](function(){return getServerInfo(_0x140256);})[_0xa5a5('0x2b')](function(_0x2e732a){var _0x2ad297=parseInt(_0x2e732a[_0xa5a5('0x66')][_0xa5a5('0x67')](0x0));var _0x111728=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3b5a7a[_0xa5a5('0x54')],_0x227337['id']);if(_0x2ad297>0x6){_0x111728=util[_0xa5a5('0x24')](_0xa5a5('0x68'),_0x3b5a7a['remoteUri'],_0x227337['id']);}logger[_0xa5a5('0xb')]('[QUEUE]',_0xa5a5('0x69'));emit(util[_0xa5a5('0x24')](_0xa5a5('0x6a'),_0x488276[_0xa5a5('0x1b')]),'trigger:browser:url',{'uri':_0x111728});})['catch'](function(_0x1d4878){logger[_0xa5a5('0x6b')]('[QUEUE]',JSON[_0xa5a5('0x23')](_0x1d4878));});};exports[_0xa5a5('0x6c')]=function(_0xfb357b,_0x284888,_0x56157e,_0x5b8e94,_0x24a270,_0x5266e5,_0x2a5277){var _0x425eb2,_0x6c7c28,_0x1fd1d2,_0x48a14b;_0x5266e5[_0xa5a5('0x54')]=intUtil['stripTrailingSlash'](_0x5266e5[_0xa5a5('0x54')]);_0x5266e5[_0xa5a5('0x55')]=intUtil[_0xa5a5('0x56')](_0x5266e5[_0xa5a5('0x55')]);def[_0xa5a5('0x6d')]=util[_0xa5a5('0x24')](_0xa5a5('0x57'),_0x5266e5['remoteUri']);if(_0x2a5277&&_0x2a5277[_0xa5a5('0x6e')]&&_0x2a5277['recordingFormat']!==_0xa5a5('0x6f')){logger[_0xa5a5('0xb')](_0xa5a5('0x70'),_0xa5a5('0x5a'));_0x284888[_0xa5a5('0x5b')]=util[_0xa5a5('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5266e5[_0xa5a5('0x55')],_0x284888[_0xa5a5('0x5d')],md5(_0x284888['uniqueid']));}return getConnection(_0x5266e5)[_0xa5a5('0x2b')](function(_0x2f39f1){_0x48a14b=_0x2f39f1;return getUser(_0x5266e5,_0x5b8e94[_0xa5a5('0x1b')],_0x48a14b);})[_0xa5a5('0x2b')](function(_0x49e6c1){_0x425eb2=_0x49e6c1;logger[_0xa5a5('0xb')](_0xa5a5('0x71'),_0x425eb2['id']);return getEndUser(_0x5266e5,_0x284888[_0xa5a5('0x72')],_0x284888[_0xa5a5('0x73')],_0x48a14b);})['then'](function(_0x13540c){_0x6c7c28=_0x13540c;logger[_0xa5a5('0xb')]('The\x20Enduser\x20ID\x20is:',_0x6c7c28['id']);return getTicket(_0x5266e5,_0x425eb2,_0x6c7c28,_0x56157e,_0x284888,_0x56157e[_0xa5a5('0x61')],_0x48a14b,_0xa5a5('0x74'));})['then'](function(_0x4a032e){_0x1fd1d2=_0x4a032e;logger[_0xa5a5('0xb')]('Ticket\x20created!');logger[_0xa5a5('0xb')](_0xa5a5('0x64'),_0x1fd1d2['id']);return setRelationship(_0x48a14b,_0x425eb2,_0x1fd1d2,_0xa5a5('0x75'));})['then'](function(){return setRelationship(_0x48a14b,_0x6c7c28,_0x1fd1d2,_0xa5a5('0x65'));})[_0xa5a5('0x2b')](function(){return getServerInfo(_0x48a14b);})[_0xa5a5('0x2b')](function(_0x3fb819){var _0x3fb90e=parseInt(_0x3fb819[_0xa5a5('0x66')]['charAt'](0x0));var _0x503cca=util[_0xa5a5('0x24')](_0xa5a5('0x76'),_0x5266e5[_0xa5a5('0x54')],_0x1fd1d2['id']);if(_0x3fb90e>0x6){_0x503cca=util[_0xa5a5('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x5266e5[_0xa5a5('0x54')],_0x1fd1d2['id']);}logger[_0xa5a5('0xb')]('[OUTBOUND]',_0xa5a5('0x69'));emit(util[_0xa5a5('0x24')](_0xa5a5('0x6a'),_0x5b8e94[_0xa5a5('0x1b')]),_0xa5a5('0x77'),{'uri':_0x503cca});})['catch'](function(_0x28de32){logger[_0xa5a5('0x6b')]('[OUTBOUND]',JSON['stringify'](_0x28de32));});};exports[_0xa5a5('0x78')]=function(_0x4832a8,_0x1eac19,_0x12d529,_0x17f683,_0x1227b9,_0x387676){var _0x1573e0,_0x4bf339,_0x32ef99,_0x2ac7a6;_0x387676[_0xa5a5('0x54')]=intUtil[_0xa5a5('0x56')](_0x387676[_0xa5a5('0x54')]);_0x387676[_0xa5a5('0x55')]=intUtil[_0xa5a5('0x56')](_0x387676[_0xa5a5('0x55')]);def[_0xa5a5('0x6d')]=util[_0xa5a5('0x24')](_0xa5a5('0x57'),_0x387676[_0xa5a5('0x54')]);if(_0x1227b9&&_0x1227b9['monitor_format']){logger['info']('['+_0x1eac19[_0xa5a5('0x79')][_0xa5a5('0x7a')]()+']',_0xa5a5('0x5a'));_0x1eac19[_0xa5a5('0x5b')]=util[_0xa5a5('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x387676[_0xa5a5('0x55')],_0x1eac19['uniqueid'],md5(_0x1eac19[_0xa5a5('0x5d')]));}else{_0x1eac19[_0xa5a5('0x5b')]='';}return getConnection(_0x387676)[_0xa5a5('0x2b')](function(_0x2f72ee){_0x2ac7a6=_0x2f72ee;if(!_[_0xa5a5('0x7b')](_0x17f683)){return getUser(_0x387676,_0x17f683[_0xa5a5('0x1b')],_0x2ac7a6);}else{return getUser(_0x387676,null,_0x2ac7a6);}})['then'](function(_0x30550e){_0x1573e0=_0x30550e;logger[_0xa5a5('0xb')](_0xa5a5('0x71'),_0x1573e0['id']);return getEndUser(_0x387676,_0x1eac19[_0xa5a5('0x5e')],_0x1eac19[_0xa5a5('0x5f')],_0x2ac7a6);})[_0xa5a5('0x2b')](function(_0x27a667){_0x4bf339=_0x27a667;logger[_0xa5a5('0xb')](_0xa5a5('0x60'),_0x4bf339['id']);return getTicket(_0x387676,_0x1573e0,_0x4bf339,_0x12d529,_0x1eac19,_0x12d529[_0xa5a5('0x61')],_0x2ac7a6,'Inbound');})['then'](function(_0x45358a){_0x32ef99=_0x45358a;logger['info']('Ticket\x20created!');logger[_0xa5a5('0xb')](_0xa5a5('0x64'),_0x32ef99['id']);return setRelationship(_0x2ac7a6,_0x1573e0,_0x32ef99,_0xa5a5('0x75'));})[_0xa5a5('0x2b')](function(){return setRelationship(_0x2ac7a6,_0x4bf339,_0x32ef99,_0xa5a5('0x65'));})[_0xa5a5('0x2b')](function(){return getServerInfo(_0x2ac7a6);})['catch'](function(_0x1abc89){logger[_0xa5a5('0x6b')]('['+_0x1eac19[_0xa5a5('0x79')]['toUpperCase']()+']',JSON[_0xa5a5('0x23')](_0x1abc89));});}; \ No newline at end of file +var _0xc599=['Calls','Basic\x20%s','toString','base64','get_server_info','isNil','info','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','customVariable','Variable','login','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','contacts','charAt','monitor_format','lastevent','toUpperCase','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','Descriptions','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','direction','length','forEach','variableName','push','idField','JSON','stringify'];(function(_0x13a4a2,_0x41870a){var _0xf13bd8=function(_0x34a66b){while(--_0x34a66b){_0x13a4a2['push'](_0x13a4a2['shift']());}};_0xf13bd8(++_0x41870a);}(_0xc599,0x1b2));var _0x9c59=function(_0x2071cc,_0x5d728e){_0x2071cc=_0x2071cc-0x0;var _0x31aa5d=_0xc599[_0x2071cc];return _0x31aa5d;};'use strict';var _=require('lodash');var rp=require(_0x9c59('0x0'));var BPromise=require('bluebird');var md5=require(_0x9c59('0x1'));var util=require(_0x9c59('0x2'));var Redis=require(_0x9c59('0x3'));var intUtil=require('./util');var config=require(_0x9c59('0x4'));var logger=require(_0x9c59('0x5'))(_0x9c59('0x6'));config[_0x9c59('0x7')]=_[_0x9c59('0x8')](config[_0x9c59('0x7')],{'host':_0x9c59('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0x9c59('0xa'),'json':!![]};function emit(_0x5ae4ab,_0x1220ad,_0x4b87f2){io['to'](_0x5ae4ab)[_0x9c59('0xb')](_0x1220ad,_0x4b87f2);}function getTicket(_0x458903,_0x881b58,_0x120151,_0x4c13fd,_0x5e5bd8,_0x22a8cb,_0x4b8b43,_0x3f7ce2){logger['info'](_0x9c59('0xc'));var _0x49e217=new Date();var _0x55f952=[{'name':_0x9c59('0xd'),'value':intUtil[_0x9c59('0xe')](_0x4c13fd['Subjects'],_0x5e5bd8,'\x20')},{'name':'assigned_user_id','value':_0x881b58['id']},{'name':'created_by','value':_0x881b58['id']},{'name':'description','value':intUtil['getString'](_0x4c13fd[_0x9c59('0xf')],_0x5e5bd8,'\x0a')},{'name':_0x9c59('0x10'),'value':_0x49e217[_0x9c59('0x11')]()[_0x9c59('0x12')](0x0,0x13)['replace']('T','\x20')},{'name':_0x9c59('0x13'),'value':'0'},{'name':_0x9c59('0x14'),'value':'15'},{'name':_0x9c59('0x15'),'value':_0x120151['id']},{'name':'parent_type','value':'Contacts'},{'name':'parent_name','value':_0x120151[_0x9c59('0xd')]},{'name':_0x9c59('0x16'),'value':_0x3f7ce2}];if(_0x22a8cb[_0x9c59('0x17')]){_[_0x9c59('0x18')](_0x22a8cb,function(_0x3faae5){if(_0x5e5bd8[_0x3faae5[_0x9c59('0x19')]]){_0x55f952[_0x9c59('0x1a')]({'name':_0x3faae5[_0x9c59('0x1b')],'value':_0x5e5bd8[_0x3faae5['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x9c59('0x1c'),'rest_data':JSON[_0x9c59('0x1d')]({'session':_0x4b8b43['id'],'module_name':_0x9c59('0x1e'),'name_value_list':_0x55f952})}});}function getAuth(_0x1925a1){return util['format'](_0x9c59('0x1f'),new Buffer(_0x1925a1['apiKey']+':X')[_0x9c59('0x20')](_0x9c59('0x21')));}function getServerInfo(_0x4dcc88){return request({'form':{'method':_0x9c59('0x22'),'input_type':_0x9c59('0x1c'),'response_type':_0x9c59('0x1c'),'rest_data':JSON[_0x9c59('0x1d')]({'session':_0x4dcc88['id']})}});}function getUser(_0x1e5853,_0x58dadf,_0x7ffcdd){if(!_[_0x9c59('0x23')](_0x58dadf)){logger[_0x9c59('0x24')]('Getting\x20agent\x20with\x20name',_0x58dadf);return request({'form':{'method':_0x9c59('0x25'),'input_type':_0x9c59('0x1c'),'response_type':_0x9c59('0x1c'),'rest_data':JSON[_0x9c59('0x1d')]({'session':_0x7ffcdd['id'],'module_name':'Employees','query':util[_0x9c59('0x26')](_0x9c59('0x27'),_0x58dadf),'order_by':'','offset':'0','select_fields':['id',_0x9c59('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9c59('0x28')](function(_0x27e6b2){if(_0x27e6b2[_0x9c59('0x29')][_0x9c59('0x17')]){var _0x190793=_['find'](_0x27e6b2[_0x9c59('0x29')],function(_0x9e8833){return _0x9e8833['name_value_list']['user_name'][_0x9c59('0x2a')]===_0x58dadf;});if(_0x190793){logger[_0x9c59('0x24')](_0x9c59('0x2b'));return BPromise[_0x9c59('0x2c')]({'id':_0x190793['name_value_list']['id'][_0x9c59('0x2a')],'name':_0x190793[_0x9c59('0x2d')][_0x9c59('0xd')][_0x9c59('0x2a')]});}}logger['info'](_0x9c59('0x2e'));return BPromise[_0x9c59('0x2c')]({'id':_0x7ffcdd[_0x9c59('0x2d')][_0x9c59('0x2f')][_0x9c59('0x2a')],'name':_0x7ffcdd[_0x9c59('0x2d')][_0x9c59('0x30')][_0x9c59('0x2a')]});});}else{logger[_0x9c59('0x24')](_0x9c59('0x31'));return BPromise[_0x9c59('0x2c')]({'id':_0x7ffcdd[_0x9c59('0x2d')][_0x9c59('0x2f')]['value'],'name':_0x7ffcdd[_0x9c59('0x2d')][_0x9c59('0x30')]['value']});}}function getEndUser(_0x4f42f7,_0x2e26cc,_0x288f12,_0x2c4d54){logger[_0x9c59('0x24')]('Searching\x20enduser\x20with\x20phone',_0x288f12);return request({'form':{'method':_0x9c59('0x25'),'input_type':_0x9c59('0x1c'),'response_type':'JSON','rest_data':JSON[_0x9c59('0x1d')]({'session':_0x2c4d54['id'],'module_name':_0x9c59('0x32'),'query':util['format'](_0x9c59('0x33'),_0x288f12),'order_by':'','offset':'0','select_fields':['id','name',_0x9c59('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9c59('0x28')](function(_0x4b8eca){if(_0x4b8eca[_0x9c59('0x29')]['length']){var _0x5079be=_[_0x9c59('0x35')](_0x4b8eca['entry_list'],function(_0x293818){return _0x293818['name_value_list']['phone_home']['value']===_0x288f12;});if(_0x5079be){logger[_0x9c59('0x24')](_0x9c59('0x36'));return BPromise[_0x9c59('0x2c')]({'id':_0x5079be[_0x9c59('0x2d')]['id'][_0x9c59('0x2a')],'name':_0x5079be[_0x9c59('0x2d')]['name'][_0x9c59('0x2a')],'phone':_0x5079be['name_value_list'][_0x9c59('0x34')][_0x9c59('0x2a')]});}}else{logger[_0x9c59('0x24')](_0x9c59('0x37'));return request({'form':{'method':_0x9c59('0x38'),'input_type':_0x9c59('0x1c'),'response_type':'JSON','rest_data':JSON[_0x9c59('0x1d')]({'session':_0x2c4d54['id'],'module_name':_0x9c59('0x32'),'name_value_list':[{'name':_0x9c59('0x39'),'value':_0x2e26cc!==_0x9c59('0x3a')?_0x2e26cc:util[_0x9c59('0x26')](_0x9c59('0x3b'),_0x288f12)},{'name':'phone_home','value':_0x288f12}]})}})[_0x9c59('0x28')](function(_0x2933c0){logger[_0x9c59('0x24')]('Enduser\x20created.');return BPromise[_0x9c59('0x2c')]({'id':_0x2933c0['id'],'name':_0x2933c0[_0x9c59('0x29')][_0x9c59('0x39')][_0x9c59('0x2a')],'phone':_0x2933c0['entry_list'][_0x9c59('0x34')][_0x9c59('0x2a')]});});}});}function request(_0x767e10){logger[_0x9c59('0x3c')](_0x9c59('0x3d'),JSON[_0x9c59('0x1d')](_0x767e10));return rp(_['merge'](def,_0x767e10));}function getTags(_0x593ccf,_0x4cd587){var _0x54cfec=[];if(_0x593ccf&&_0x593ccf[_0x9c59('0x17')]>0x0){_0x54cfec=_[_0x9c59('0x3e')](_0x593ccf,_0x4cd587);}return _0x54cfec;}function getCustomFields(_0x424113,_0x470c5e){var _0x242351=[];var _0x4ccbfe={'custom_fields':[]};if(_0x424113['length']>0x0){_[_0x9c59('0x18')](_0x424113,function(_0x1fd06b){if(_0x1fd06b[_0x9c59('0x3f')]===_0x9c59('0x40')&&_0x1fd06b[_0x9c59('0x41')]&&!_0x1fd06b[_0x9c59('0x42')]){_0x4ccbfe[_0x1fd06b[_0x9c59('0x41')][_0x9c59('0x43')]()]=_0x1fd06b[_0x9c59('0x44')][_0x9c59('0x20')]();}else if(_0x1fd06b[_0x9c59('0x3f')]===_0x9c59('0x40')&&_0x1fd06b['idField']&&_0x1fd06b[_0x9c59('0x42')]){_0x4ccbfe[_0x9c59('0x45')]['push']({'id':_0x1fd06b[_0x9c59('0x1b')],'value':_0x1fd06b[_0x9c59('0x44')][_0x9c59('0x20')]()});}else if(_0x1fd06b[_0x9c59('0x3f')]===_0x9c59('0x46')&&_0x1fd06b[_0x9c59('0x19')]&&_0x1fd06b[_0x9c59('0x1b')]&&_0x1fd06b[_0x9c59('0x42')]){_0x470c5e[_0x1fd06b['variableName']]&&_0x4ccbfe[_0x9c59('0x45')]['push']({'id':_0x1fd06b[_0x9c59('0x1b')],'value':_0x470c5e[_0x1fd06b[_0x9c59('0x19')]][_0x9c59('0x20')]()});}else if(_0x1fd06b[_0x9c59('0x3f')]===_0x9c59('0x47')&&_0x1fd06b[_0x9c59('0x48')]&&_0x1fd06b[_0x9c59('0x48')][_0x9c59('0xd')]&&_0x1fd06b['idField']&&_0x1fd06b[_0x9c59('0x42')]){_0x470c5e[_0x1fd06b[_0x9c59('0x48')][_0x9c59('0xd')][_0x9c59('0x43')]()]&&_0x4ccbfe[_0x9c59('0x45')][_0x9c59('0x1a')]({'id':_0x1fd06b[_0x9c59('0x1b')],'value':_0x470c5e[_0x1fd06b[_0x9c59('0x48')][_0x9c59('0xd')]['toLowerCase']()][_0x9c59('0x20')]()});}});}return _0x4ccbfe;}function getConnection(_0x44fe69){return request({'method':_0x9c59('0xa'),'form':{'method':_0x9c59('0x49'),'input_type':'JSON','response_type':_0x9c59('0x1c'),'rest_data':JSON[_0x9c59('0x1d')]({'user_auth':{'user_name':_0x44fe69['username'],'password':_0x44fe69[_0x9c59('0x4a')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x9c59('0x28')](function(_0x8e2b39){var _0x3ecc91=_0x8e2b39;if(_0x3ecc91['id']){def[_0x9c59('0x4b')]=_0x3ecc91['id'];return BPromise[_0x9c59('0x2c')](_0x3ecc91);}else{throw new Error(util['format'](_0x9c59('0x4c'),_0x44fe69['id']));}});}function setRelationship(_0x38cf23,_0x36f6ef,_0x173523,_0x422fb0){return request({'form':{'method':_0x9c59('0x4d'),'input_type':_0x9c59('0x1c'),'response_type':'JSON','rest_data':JSON[_0x9c59('0x1d')]({'session':_0x38cf23['id'],'module_name':_0x9c59('0x1e'),'module_id':_0x173523['id'],'link_field_name':_0x422fb0,'related_ids':[_0x36f6ef['id']]})}});}exports['queue']=function(_0x280300,_0x373712,_0x226db6,_0x3581ba,_0xed2fe6,_0x55f0d8){var _0xd91886,_0x19cd40,_0xf31c4,_0xbf6918;_0x55f0d8[_0x9c59('0x4e')]=intUtil[_0x9c59('0x4f')](_0x55f0d8[_0x9c59('0x4e')]);_0x55f0d8['serverUrl']=intUtil['stripTrailingSlash'](_0x55f0d8[_0x9c59('0x50')]);def[_0x9c59('0x51')]=util[_0x9c59('0x26')](_0x9c59('0x52'),_0x55f0d8[_0x9c59('0x4e')]);if(_0xed2fe6&&_0xed2fe6['monitor_format']){logger[_0x9c59('0x24')]('[QUEUE]',_0x9c59('0x53'));_0x373712['recordingURL']=util[_0x9c59('0x26')](_0x9c59('0x54'),_0x55f0d8[_0x9c59('0x50')],_0x373712[_0x9c59('0x55')],md5(_0x373712[_0x9c59('0x55')]));}else{_0x373712[_0x9c59('0x56')]='';}return getConnection(_0x55f0d8)['then'](function(_0x4ca570){_0xbf6918=_0x4ca570;return getUser(_0x55f0d8,_0x3581ba[_0x9c59('0xd')],_0xbf6918);})[_0x9c59('0x28')](function(_0x2d167d){_0xd91886=_0x2d167d;logger[_0x9c59('0x24')]('The\x20User\x20ID\x20is:',_0xd91886['id']);return getEndUser(_0x55f0d8,_0x373712[_0x9c59('0x57')],_0x373712[_0x9c59('0x58')],_0xbf6918);})['then'](function(_0x13aa5a){_0x19cd40=_0x13aa5a;logger[_0x9c59('0x24')](_0x9c59('0x59'),_0x19cd40['id']);return getTicket(_0x55f0d8,_0xd91886,_0x19cd40,_0x226db6,_0x373712,_0x226db6[_0x9c59('0x5a')],_0xbf6918,_0x9c59('0x5b'));})[_0x9c59('0x28')](function(_0xfe27b9){_0xf31c4=_0xfe27b9;logger[_0x9c59('0x24')](_0x9c59('0x5c'));logger[_0x9c59('0x24')](_0x9c59('0x5d'),_0xf31c4['id']);return setRelationship(_0xbf6918,_0xd91886,_0xf31c4,_0x9c59('0x5e'));})['then'](function(){return setRelationship(_0xbf6918,_0x19cd40,_0xf31c4,'contacts');})[_0x9c59('0x28')](function(){return getServerInfo(_0xbf6918);})['then'](function(_0x1cb7f1){var _0x2bb4c3=parseInt(_0x1cb7f1[_0x9c59('0x5f')]['charAt'](0x0));var _0x2d7984=util[_0x9c59('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x55f0d8[_0x9c59('0x4e')],_0xf31c4['id']);if(_0x2bb4c3>0x6){_0x2d7984=util[_0x9c59('0x26')](_0x9c59('0x60'),_0x55f0d8[_0x9c59('0x4e')],_0xf31c4['id']);}logger[_0x9c59('0x24')](_0x9c59('0x61'),_0x9c59('0x62'));emit(util['format'](_0x9c59('0x63'),_0x3581ba[_0x9c59('0xd')]),_0x9c59('0x64'),{'uri':_0x2d7984});})[_0x9c59('0x65')](function(_0x32e560){logger[_0x9c59('0x66')](_0x9c59('0x61'),JSON[_0x9c59('0x1d')](_0x32e560));});};exports[_0x9c59('0x67')]=function(_0x4bd723,_0x30dc57,_0x13d148,_0x143a81,_0x555843,_0x45747a,_0x483ac5){var _0x293d05,_0x110027,_0x877b0a,_0x574ad2;_0x45747a[_0x9c59('0x4e')]=intUtil[_0x9c59('0x4f')](_0x45747a[_0x9c59('0x4e')]);_0x45747a['serverUrl']=intUtil[_0x9c59('0x4f')](_0x45747a['serverUrl']);def[_0x9c59('0x51')]=util[_0x9c59('0x26')](_0x9c59('0x52'),_0x45747a[_0x9c59('0x4e')]);if(_0x483ac5&&_0x483ac5[_0x9c59('0x68')]&&_0x483ac5['recordingFormat']!==_0x9c59('0x69')){logger[_0x9c59('0x24')](_0x9c59('0x6a'),_0x9c59('0x53'));_0x30dc57['recordingURL']=util[_0x9c59('0x26')](_0x9c59('0x54'),_0x45747a[_0x9c59('0x50')],_0x30dc57[_0x9c59('0x55')],md5(_0x30dc57[_0x9c59('0x55')]));}return getConnection(_0x45747a)[_0x9c59('0x28')](function(_0x240b13){_0x574ad2=_0x240b13;return getUser(_0x45747a,_0x143a81[_0x9c59('0xd')],_0x574ad2);})['then'](function(_0x5a86b7){_0x293d05=_0x5a86b7;logger[_0x9c59('0x24')](_0x9c59('0x6b'),_0x293d05['id']);return getEndUser(_0x45747a,_0x30dc57[_0x9c59('0x6c')],_0x30dc57[_0x9c59('0x6d')],_0x574ad2);})[_0x9c59('0x28')](function(_0x4b5e26){_0x110027=_0x4b5e26;logger[_0x9c59('0x24')](_0x9c59('0x59'),_0x110027['id']);return getTicket(_0x45747a,_0x293d05,_0x110027,_0x13d148,_0x30dc57,_0x13d148[_0x9c59('0x5a')],_0x574ad2,_0x9c59('0x6e'));})[_0x9c59('0x28')](function(_0x3a920b){_0x877b0a=_0x3a920b;logger[_0x9c59('0x24')](_0x9c59('0x5c'));logger[_0x9c59('0x24')](_0x9c59('0x5d'),_0x877b0a['id']);return setRelationship(_0x574ad2,_0x293d05,_0x877b0a,'users');})[_0x9c59('0x28')](function(){return setRelationship(_0x574ad2,_0x110027,_0x877b0a,_0x9c59('0x6f'));})[_0x9c59('0x28')](function(){return getServerInfo(_0x574ad2);})['then'](function(_0xd598d5){var _0x2f16fa=parseInt(_0xd598d5[_0x9c59('0x5f')][_0x9c59('0x70')](0x0));var _0x5f4616=util[_0x9c59('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x45747a[_0x9c59('0x4e')],_0x877b0a['id']);if(_0x2f16fa>0x6){_0x5f4616=util[_0x9c59('0x26')](_0x9c59('0x60'),_0x45747a[_0x9c59('0x4e')],_0x877b0a['id']);}logger[_0x9c59('0x24')](_0x9c59('0x6a'),_0x9c59('0x62'));emit(util[_0x9c59('0x26')]('user:%s',_0x143a81['name']),'trigger:browser:url',{'uri':_0x5f4616});})[_0x9c59('0x65')](function(_0x17dc1a){logger[_0x9c59('0x66')](_0x9c59('0x6a'),JSON[_0x9c59('0x1d')](_0x17dc1a));});};exports['unmanaged']=function(_0xeb6cd3,_0x2ca6be,_0x47bee7,_0x38d0f7,_0x440ec4,_0x100e31){var _0x1ed660,_0x2acb79,_0x390dc1,_0x19e975;_0x100e31[_0x9c59('0x4e')]=intUtil[_0x9c59('0x4f')](_0x100e31[_0x9c59('0x4e')]);_0x100e31[_0x9c59('0x50')]=intUtil[_0x9c59('0x4f')](_0x100e31[_0x9c59('0x50')]);def[_0x9c59('0x51')]=util['format'](_0x9c59('0x52'),_0x100e31[_0x9c59('0x4e')]);if(_0x440ec4&&_0x440ec4[_0x9c59('0x71')]){logger[_0x9c59('0x24')]('['+_0x2ca6be[_0x9c59('0x72')][_0x9c59('0x73')]()+']','Recording\x20is\x20enabled!');_0x2ca6be['recordingURL']=util[_0x9c59('0x26')](_0x9c59('0x54'),_0x100e31[_0x9c59('0x50')],_0x2ca6be[_0x9c59('0x55')],md5(_0x2ca6be[_0x9c59('0x55')]));}else{_0x2ca6be[_0x9c59('0x56')]='';}return getConnection(_0x100e31)[_0x9c59('0x28')](function(_0x40a419){_0x19e975=_0x40a419;if(!_[_0x9c59('0x23')](_0x38d0f7)){return getUser(_0x100e31,_0x38d0f7[_0x9c59('0xd')],_0x19e975);}else{return getUser(_0x100e31,null,_0x19e975);}})[_0x9c59('0x28')](function(_0x49feea){_0x1ed660=_0x49feea;logger['info'](_0x9c59('0x6b'),_0x1ed660['id']);return getEndUser(_0x100e31,_0x2ca6be['calleridname'],_0x2ca6be[_0x9c59('0x58')],_0x19e975);})[_0x9c59('0x28')](function(_0x379d79){_0x2acb79=_0x379d79;logger[_0x9c59('0x24')](_0x9c59('0x59'),_0x2acb79['id']);return getTicket(_0x100e31,_0x1ed660,_0x2acb79,_0x47bee7,_0x2ca6be,_0x47bee7[_0x9c59('0x5a')],_0x19e975,_0x9c59('0x5b'));})['then'](function(_0x4cee27){_0x390dc1=_0x4cee27;logger['info'](_0x9c59('0x5c'));logger[_0x9c59('0x24')](_0x9c59('0x5d'),_0x390dc1['id']);return setRelationship(_0x19e975,_0x1ed660,_0x390dc1,'users');})[_0x9c59('0x28')](function(){return setRelationship(_0x19e975,_0x2acb79,_0x390dc1,_0x9c59('0x6f'));})[_0x9c59('0x28')](function(){return getServerInfo(_0x19e975);})[_0x9c59('0x65')](function(_0x26b7d1){logger[_0x9c59('0x66')]('['+_0x2ca6be[_0x9c59('0x72')]['toUpperCase']()+']',JSON[_0x9c59('0x1d')](_0x26b7d1));});}; \ 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 7afe377..72695fc 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 _0x07ad=['test','util','length','sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil'];(function(_0x8fd06,_0x33eea1){var _0x429e9b=function(_0x5072ac){while(--_0x5072ac){_0x8fd06['push'](_0x8fd06['shift']());}};_0x429e9b(++_0x33eea1);}(_0x07ad,0x1e7));var _0xd07a=function(_0x184681,_0x29846f){_0x184681=_0x184681-0x0;var _0x41bf68=_0x07ad[_0x184681];return _0x41bf68;};'use strict';var _=require('lodash');var util=require(_0xd07a('0x0'));exports['getString']=function(_0x308e09,_0x4a5460,_0x591db8){var _0x404448=[];if(_0x308e09[_0xd07a('0x1')]>0x0){var _0x14a74d=_[_0xd07a('0x2')](_0x308e09,['id']);for(var _0x292547=0x0;_0x292547<_0x14a74d[_0xd07a('0x1')];_0x292547++){var _0x4eb011=_0x14a74d[_0x292547];if(_0x4eb011[_0xd07a('0x3')]===_0xd07a('0x4')){_0x404448[_0xd07a('0x5')](_0x4eb011[_0xd07a('0x6')]);}else if(_0x4eb011[_0xd07a('0x3')]===_0xd07a('0x7')&&_0x4eb011[_0xd07a('0x8')]){_0x4a5460[_0x4eb011[_0xd07a('0x8')]]&&_0x404448[_0xd07a('0x5')](_0x4a5460[_0x4eb011[_0xd07a('0x8')]][_0xd07a('0x9')]());}else if(_0x4eb011[_0xd07a('0x3')]===_0xd07a('0xa')&&_0x4eb011[_0xd07a('0xb')]&&_0x4eb011[_0xd07a('0xb')][_0xd07a('0xc')]){_0x4a5460[_0x4eb011[_0xd07a('0xb')][_0xd07a('0xc')][_0xd07a('0xd')]()]&&_0x404448['push'](_0x4a5460[_0x4eb011[_0xd07a('0xb')]['name'][_0xd07a('0xd')]()][_0xd07a('0x9')]());}else if(_0x4eb011[_0xd07a('0x3')]===_0xd07a('0xe')){if(_0x4eb011[_0xd07a('0xf')]==='string'&&_0x4eb011[_0xd07a('0x10')]){_0x404448[_0xd07a('0x5')](util[_0xd07a('0x11')]('%s:\x20%s',_0x4eb011[_0xd07a('0x10')],_0x4eb011[_0xd07a('0x12')]));}else if(_0x4eb011['keyType']===_0xd07a('0x7')&&_0x4eb011[_0xd07a('0x8')]&&_0x4eb011[_0xd07a('0x10')]){_0x4a5460[_0x4eb011[_0xd07a('0x8')]]&&_0x404448['push'](util['format']('%s:\x20%s',_0x4eb011['key'],_0x4a5460[_0x4eb011[_0xd07a('0x8')]]));}else if(_0x4eb011[_0xd07a('0xf')]===_0xd07a('0xa')&&_0x4eb011[_0xd07a('0xb')]&&_0x4eb011[_0xd07a('0xb')]['name']&&_0x4eb011[_0xd07a('0x10')]){_0x4a5460[_0x4eb011[_0xd07a('0xb')][_0xd07a('0xc')]['toLowerCase']()]&&_0x404448[_0xd07a('0x5')](util[_0xd07a('0x11')](_0xd07a('0x13'),_0x4eb011[_0xd07a('0x10')],_0x4a5460[_0x4eb011[_0xd07a('0xb')][_0xd07a('0xc')]['toLowerCase']()]));}}}}return _0x404448[_0xd07a('0x14')](_0x591db8);};exports[_0xd07a('0x15')]=function(_0x4001f2){var _0x1adba6=_0x4001f2[_0xd07a('0x16')](-0x1);if(_0x1adba6==='/'){_0x4001f2=_0x4001f2['substring'](0x0,_0x4001f2[_0xd07a('0x17')](_0x1adba6));}return _0x4001f2;};exports[_0xd07a('0x18')]=function(_0x50ba31){if(!_[_0xd07a('0x19')](_0x50ba31)&&_0x50ba31!==''){var _0x4561db=/^(([^<>()\[\]\\.,;:\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 _0x4561db[_0xd07a('0x1a')](String(_0x50ba31)[_0xd07a('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xd4c6=['isNil','test','lodash','util','getString','length','string','content','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','type','keyValue','keyType','keyContent','key','%s:\x20%s','slice','substring','validateEmail'];(function(_0x17d2bd,_0x3c6d60){var _0x1f377c=function(_0x166f21){while(--_0x166f21){_0x17d2bd['push'](_0x17d2bd['shift']());}};_0x1f377c(++_0x3c6d60);}(_0xd4c6,0x66));var _0x6d4c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4c6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6d4c('0x0'));var util=require(_0x6d4c('0x1'));exports[_0x6d4c('0x2')]=function(_0x5c4eb9,_0x269d44,_0x2e13bd){var _0x411b23=[];if(_0x5c4eb9[_0x6d4c('0x3')]>0x0){var _0x16ec5=_['sortBy'](_0x5c4eb9,['id']);for(var _0xdfce2b=0x0;_0xdfce2b<_0x16ec5[_0x6d4c('0x3')];_0xdfce2b++){var _0x5624ed=_0x16ec5[_0xdfce2b];if(_0x5624ed['type']===_0x6d4c('0x4')){_0x411b23['push'](_0x5624ed[_0x6d4c('0x5')]);}else if(_0x5624ed['type']===_0x6d4c('0x6')&&_0x5624ed[_0x6d4c('0x7')]){_0x269d44[_0x5624ed['variableName']]&&_0x411b23[_0x6d4c('0x8')](_0x269d44[_0x5624ed[_0x6d4c('0x7')]][_0x6d4c('0x9')]());}else if(_0x5624ed['type']===_0x6d4c('0xa')&&_0x5624ed[_0x6d4c('0xb')]&&_0x5624ed[_0x6d4c('0xb')]['name']){_0x269d44[_0x5624ed[_0x6d4c('0xb')][_0x6d4c('0xc')][_0x6d4c('0xd')]()]&&_0x411b23['push'](_0x269d44[_0x5624ed['Variable']['name'][_0x6d4c('0xd')]()][_0x6d4c('0x9')]());}else if(_0x5624ed[_0x6d4c('0xe')]===_0x6d4c('0xf')){if(_0x5624ed[_0x6d4c('0x10')]===_0x6d4c('0x4')&&_0x5624ed['key']){_0x411b23[_0x6d4c('0x8')](util['format']('%s:\x20%s',_0x5624ed['key'],_0x5624ed[_0x6d4c('0x11')]));}else if(_0x5624ed[_0x6d4c('0x10')]===_0x6d4c('0x6')&&_0x5624ed[_0x6d4c('0x7')]&&_0x5624ed[_0x6d4c('0x12')]){_0x269d44[_0x5624ed[_0x6d4c('0x7')]]&&_0x411b23[_0x6d4c('0x8')](util['format'](_0x6d4c('0x13'),_0x5624ed[_0x6d4c('0x12')],_0x269d44[_0x5624ed[_0x6d4c('0x7')]]));}else if(_0x5624ed['keyType']===_0x6d4c('0xa')&&_0x5624ed[_0x6d4c('0xb')]&&_0x5624ed['Variable'][_0x6d4c('0xc')]&&_0x5624ed[_0x6d4c('0x12')]){_0x269d44[_0x5624ed[_0x6d4c('0xb')][_0x6d4c('0xc')][_0x6d4c('0xd')]()]&&_0x411b23[_0x6d4c('0x8')](util['format'](_0x6d4c('0x13'),_0x5624ed['key'],_0x269d44[_0x5624ed[_0x6d4c('0xb')][_0x6d4c('0xc')][_0x6d4c('0xd')]()]));}}}}return _0x411b23['join'](_0x2e13bd);};exports['stripTrailingSlash']=function(_0x195959){var _0x1a8431=_0x195959[_0x6d4c('0x14')](-0x1);if(_0x1a8431==='/'){_0x195959=_0x195959[_0x6d4c('0x15')](0x0,_0x195959['lastIndexOf'](_0x1a8431));}return _0x195959;};exports[_0x6d4c('0x16')]=function(_0x5a4bf0){if(!_[_0x6d4c('0x17')](_0x5a4bf0)&&_0x5a4bf0!==''){var _0x3a73b8=/^(([^<>()\[\]\\.,;:\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 _0x3a73b8[_0x6d4c('0x18')](String(_0x5a4bf0)[_0x6d4c('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index b393078..2c263fa 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 _0x2ce9=['calleridname','lastevent','request-promise','bluebird','./util','../../../../config/environment','vTiger','defaults','redis','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','variable','variableName','toString','customVariable','name','Variable','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Descriptions','remoteUri','create','username','HelpDesk','stringify','then','success','resolve','result','format','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','getUser','userId','Searching\x20end\x20user\x20with\x20phone','query','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/webservice.php','Enduser\x20created.','lastname','phone','getEndUser','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridnum','trigger:browser:url','unmanaged','toUpperCase'];(function(_0x186aea,_0x531a10){var _0x946abc=function(_0x10e3bc){while(--_0x10e3bc){_0x186aea['push'](_0x186aea['shift']());}};_0x946abc(++_0x531a10);}(_0x2ce9,0x19a));var _0x92ce=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0x2ce9[_0x470e67];return _0x28bbde;};'use strict';var _=require('lodash');var rp=require(_0x92ce('0x0'));var BPromise=require(_0x92ce('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x92ce('0x2'));var config=require(_0x92ce('0x3'));var logger=require('../../../../config/logger')(_0x92ce('0x4'));config['redis']=_[_0x92ce('0x5')](config[_0x92ce('0x6')],{'host':_0x92ce('0x7'),'port':0x18eb});var io=require(_0x92ce('0x8'))(new Redis(config[_0x92ce('0x6')]));function emit(_0xd27d06,_0x440509,_0x3d87f9){io['to'](_0xd27d06)[_0x92ce('0x9')](_0x440509,_0x3d87f9);}function getCustomFields(_0x1217d5,_0x5e0684){var _0x7827e9={};if(_0x1217d5[_0x92ce('0xa')]>0x0){_[_0x92ce('0xb')](_0x1217d5,function(_0x269b6b){if(_0x269b6b[_0x92ce('0xc')]===_0x92ce('0xd')&&_0x269b6b[_0x92ce('0xe')]){_0x7827e9[_0x269b6b[_0x92ce('0xe')]]=_0x269b6b[_0x92ce('0xf')]['toString']();}else if(_0x269b6b['type']===_0x92ce('0x10')&&_0x269b6b[_0x92ce('0x11')]&&_0x269b6b[_0x92ce('0xe')]&&_0x5e0684[_0x269b6b['variableName']]){_0x7827e9[_0x269b6b[_0x92ce('0xe')]]=_0x5e0684[_0x269b6b[_0x92ce('0x11')]][_0x92ce('0x12')]();}else if(_0x269b6b[_0x92ce('0xc')]===_0x92ce('0x13')&&_0x269b6b['Variable']&&_0x269b6b['Variable'][_0x92ce('0x14')]&&_0x269b6b[_0x92ce('0xe')]&&_0x5e0684[_0x269b6b[_0x92ce('0x15')][_0x92ce('0x14')][_0x92ce('0x16')]()]){_0x7827e9[_0x269b6b[_0x92ce('0xe')]]=_0x5e0684[_0x269b6b[_0x92ce('0x15')][_0x92ce('0x14')]['toLowerCase']()][_0x92ce('0x12')]();}});}return _0x7827e9;}function createTicket(_0x479701,_0x10b67d,_0x31e675,_0x89296e,_0x10c3db,_0x118206,_0x305293){logger[_0x92ce('0x17')](_0x92ce('0x18'));var _0x4d11fe=_[_0x92ce('0x19')]({'parent_id':'','assigned_user_id':_0x10b67d['id'],'ticketpriorities':_0x92ce('0x1a'),'ticketstatus':_0x92ce('0x1b'),'ticket_title':intUtil[_0x92ce('0x1c')](_0x89296e['Subjects'],_0x10c3db,'\x20'),'description':intUtil[_0x92ce('0x1c')](_0x89296e[_0x92ce('0x1d')],_0x10c3db,'\x0a'),'contact_id':_0x31e675['id']},getCustomFields(_0x118206,_0x10c3db));var _0x3a78c8={'method':'POST','uri':util['format']('%s/webservice.php',_0x479701[_0x92ce('0x1e')]),'form':{'operation':_0x92ce('0x1f'),'username':_0x479701[_0x92ce('0x20')],'sessionName':_0x305293['sessionName'],'elementType':_0x92ce('0x21'),'element':JSON[_0x92ce('0x22')](_0x4d11fe)},'json':!![]};return request(_0x3a78c8)[_0x92ce('0x23')](function(_0x358522){if(_0x358522[_0x92ce('0x24')]){return BPromise[_0x92ce('0x25')]({'id':_0x358522[_0x92ce('0x26')]['id']});}else{throw new Error(util[_0x92ce('0x27')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x92ce('0x22')](_0x358522[_0x92ce('0x28')])));}})['catch'](function(_0x497c00){var _0x3503e6=_0x497c00[_0x92ce('0x29')]||0x1f4;logger[_0x92ce('0x28')](_0x92ce('0x2a'),_0x92ce('0x2b'),_0x3503e6,JSON[_0x92ce('0x22')](_0x497c00));});}function getUser(_0x21bd39,_0x1f23f2,_0x532221){if(intUtil[_0x92ce('0x2c')](_0x1f23f2)){logger[_0x92ce('0x17')](_0x92ce('0x2d'),_0x1f23f2);return request({'method':_0x92ce('0x2e'),'uri':util[_0x92ce('0x27')]('%s/webservice.php',_0x21bd39[_0x92ce('0x1e')]),'qs':{'operation':'query','username':_0x21bd39[_0x92ce('0x20')],'sessionName':_0x532221[_0x92ce('0x2f')],'query':util['format'](_0x92ce('0x30'),_0x1f23f2)},'json':!![]})['then'](function(_0x10af86){if(_0x10af86[_0x92ce('0x24')]&&_0x10af86[_0x92ce('0x26')]['length']){logger['info']('Agent\x20found!');return BPromise['resolve']({'id':_0x10af86[_0x92ce('0x26')][0x0]['id'],'email':_0x10af86['result'][0x0][_0x92ce('0x31')],'name':_0x10af86['result'][0x0][_0x92ce('0x32')]+'\x20'+_0x10af86[_0x92ce('0x26')][_0x92ce('0x33')]});}else{logger[_0x92ce('0x17')](_0x92ce('0x34'));return BPromise[_0x92ce('0x25')]({'id':_0x532221['userId'],'email':_0x21bd39['username'],'name':_0x92ce('0x35')});}})[_0x92ce('0x36')](function(_0x3c86ed){var _0x2b557b=_0x3c86ed['statusCode']||0x1f4;logger[_0x92ce('0x28')](_0x92ce('0x2a'),_0x92ce('0x37'),_0x2b557b,JSON['stringify'](_0x3c86ed));});}else{logger[_0x92ce('0x17')](_0x92ce('0x34'));return BPromise[_0x92ce('0x25')]({'id':_0x532221[_0x92ce('0x38')],'email':_0x21bd39['username'],'name':_0x92ce('0x35')})[_0x92ce('0x36')](function(_0x4d0934){var _0x67e2ae=_0x4d0934[_0x92ce('0x29')]||0x1f4;logger[_0x92ce('0x28')](_0x92ce('0x2a'),_0x92ce('0x37'),_0x67e2ae,JSON[_0x92ce('0x22')](_0x4d0934));});}}function getEndUser(_0x5f53d5,_0x5cecb0,_0x2e47d5,_0x1d03d0){logger[_0x92ce('0x17')](_0x92ce('0x39'),_0x2e47d5);return request({'method':_0x92ce('0x2e'),'uri':util[_0x92ce('0x27')]('%s/webservice.php',_0x5f53d5[_0x92ce('0x1e')]),'qs':{'operation':_0x92ce('0x3a'),'username':_0x5f53d5['username'],'sessionName':_0x1d03d0['sessionName'],'query':util[_0x92ce('0x27')](_0x92ce('0x3b'),_0x2e47d5,_0x2e47d5,_0x2e47d5,_0x2e47d5,_0x2e47d5)},'json':!![]})['then'](function(_0x498c8a){if(_0x498c8a[_0x92ce('0x24')]&&_0x498c8a[_0x92ce('0x26')][_0x92ce('0xa')]){logger[_0x92ce('0x17')](_0x92ce('0x3c'));return BPromise[_0x92ce('0x25')]({'id':_0x498c8a[_0x92ce('0x26')][0x0]['id'],'name':_0x498c8a[_0x92ce('0x26')][0x0][_0x92ce('0x3d')]+'\x20'+_0x498c8a[_0x92ce('0x26')][0x0]['lastname'],'phone':_0x2e47d5});}else{logger[_0x92ce('0x17')](_0x92ce('0x3e'));return request({'method':'POST','uri':util['format'](_0x92ce('0x3f'),_0x5f53d5[_0x92ce('0x1e')]),'form':{'operation':_0x92ce('0x1f'),'sessionName':_0x1d03d0[_0x92ce('0x2f')],'elementType':'Contacts','element':JSON[_0x92ce('0x22')]({'lastname':_0x5cecb0,'phone':_0x2e47d5,'assigned_user_id':'\x20'})},'json':!![]})[_0x92ce('0x23')](function(_0x51a14c){logger[_0x92ce('0x17')](_0x92ce('0x40'));return BPromise[_0x92ce('0x25')]({'id':_0x51a14c[_0x92ce('0x26')]['id'],'name':_0x51a14c['result'][_0x92ce('0x41')],'phone':_0x51a14c[_0x92ce('0x26')][_0x92ce('0x42')]});})[_0x92ce('0x36')](function(_0x17b86e){var _0x22fe24=_0x17b86e[_0x92ce('0x29')]||0x1f4;logger['error'](_0x92ce('0x2a'),_0x92ce('0x43'),_0x22fe24,JSON[_0x92ce('0x22')](_0x17b86e));});}});}function getConnection(_0x4beb5c){var _0x445cb6=_0x4beb5c[_0x92ce('0x20')];var _0x1b64b9=_0x4beb5c['accessKey'];return request({'method':_0x92ce('0x2e'),'uri':util[_0x92ce('0x27')]('%s/webservice.php',_0x4beb5c['remoteUri']),'qs':{'operation':_0x92ce('0x44'),'username':_0x445cb6},'json':!![]})[_0x92ce('0x23')](function(_0x453e20){if(_0x453e20[_0x92ce('0x24')]){return request({'method':'POST','uri':util[_0x92ce('0x27')](_0x92ce('0x3f'),_0x4beb5c['remoteUri']),'form':{'operation':_0x92ce('0x45'),'username':_0x445cb6,'accessKey':md5(_0x453e20[_0x92ce('0x26')][_0x92ce('0x46')]+_0x1b64b9)},'json':!![]});}})[_0x92ce('0x23')](function(_0x2044bb){if(_0x2044bb[_0x92ce('0x24')]){return BPromise[_0x92ce('0x25')](_0x2044bb[_0x92ce('0x26')]);}else{throw new Error(util[_0x92ce('0x27')](_0x92ce('0x47'),_0x4beb5c['id']));}})[_0x92ce('0x36')](function(_0x208407){var _0x560876=_0x208407['statusCode']||0x1f4;logger[_0x92ce('0x28')](_0x92ce('0x2a'),_0x92ce('0x48'),_0x560876,JSON[_0x92ce('0x22')](_0x208407));});}function request(_0x19c403){logger[_0x92ce('0x17')]('[HTTP]',JSON[_0x92ce('0x22')](_0x19c403));return rp(_0x19c403);}exports[_0x92ce('0x49')]=function(_0x557679,_0x1b0220,_0x548a96,_0x44810d,_0x154aa8,_0xc3d44c){var _0x3af9c3,_0x5729ae,_0x2d135d,_0x109012;_0xc3d44c[_0x92ce('0x1e')]=intUtil['stripTrailingSlash'](_0xc3d44c[_0x92ce('0x1e')]);if(_0x154aa8&&_0x154aa8[_0x92ce('0x4a')]){logger[_0x92ce('0x17')](_0x92ce('0x4b'),_0x92ce('0x4c'));_0x1b0220[_0x92ce('0x4d')]=util[_0x92ce('0x27')](_0x92ce('0x4e'),_0xc3d44c[_0x92ce('0x4f')],_0x1b0220[_0x92ce('0x50')],md5(_0x1b0220[_0x92ce('0x50')]));}else{_0x1b0220[_0x92ce('0x4d')]='';}return getConnection(_0xc3d44c)['then'](function(_0x15e726){_0x109012=_0x15e726;return getUser(_0xc3d44c,_0x44810d[_0x92ce('0x51')],_0x109012);})[_0x92ce('0x23')](function(_0xa21c04){_0x3af9c3=_0xa21c04;logger[_0x92ce('0x17')](_0x92ce('0x52'),_0x3af9c3['id']);return getEndUser(_0xc3d44c,_0x1b0220['calleridname'],_0x1b0220[_0x92ce('0x53')],_0x109012);})[_0x92ce('0x23')](function(_0x2610af){_0x5729ae=_0x2610af;logger[_0x92ce('0x17')](_0x92ce('0x54'),_0x5729ae['id']);return createTicket(_0xc3d44c,_0x3af9c3,_0x5729ae,_0x548a96,_0x1b0220,_0x548a96[_0x92ce('0x55')],_0x109012);})[_0x92ce('0x23')](function(_0x537cb7){_0x2d135d=_0x537cb7;logger[_0x92ce('0x17')](_0x92ce('0x56'));logger[_0x92ce('0x17')](_0x92ce('0x57'),_0x2d135d['id']);var _0x21e898=util[_0x92ce('0x27')](_0x92ce('0x58'),_0xc3d44c[_0x92ce('0x1e')],_[_0x92ce('0x59')](_0x2d135d['id'],'x')[0x1]);logger[_0x92ce('0x17')](_0x92ce('0x4b'),_0x92ce('0x5a'));emit(util['format'](_0x92ce('0x5b'),_0x44810d[_0x92ce('0x14')]),'trigger:browser:url',{'uri':_0x21e898});})['catch'](function(_0x31cb1f){logger[_0x92ce('0x28')](_0x92ce('0x4b'),JSON[_0x92ce('0x22')](_0x31cb1f));});};exports['outbound']=function(_0x1fa40a,_0x30b8e9,_0x4d42b1,_0x871151,_0x33593f,_0x1ba9fb,_0xb3930e){var _0x26ba4c,_0x40651b,_0x78d13f,_0x811f04;_0x1ba9fb['remoteUri']=intUtil[_0x92ce('0x5c')](_0x1ba9fb[_0x92ce('0x1e')]);_0x1ba9fb[_0x92ce('0x4f')]=intUtil[_0x92ce('0x5c')](_0x1ba9fb['serverUrl']);if(_0xb3930e&&_0xb3930e[_0x92ce('0x5d')]&&_0xb3930e[_0x92ce('0x5d')]!==_0x92ce('0x5e')){logger[_0x92ce('0x17')](_0x92ce('0x5f'),_0x92ce('0x4c'));_0x30b8e9[_0x92ce('0x4d')]=util[_0x92ce('0x27')](_0x92ce('0x4e'),_0x1ba9fb[_0x92ce('0x4f')],_0x30b8e9[_0x92ce('0x50')],md5(_0x30b8e9[_0x92ce('0x50')]));}return getConnection(_0x1ba9fb)['then'](function(_0x3959c3){_0x811f04=_0x3959c3;return getUser(_0x1ba9fb,_0x871151[_0x92ce('0x51')],_0x811f04);})[_0x92ce('0x23')](function(_0x5c04f5){_0x26ba4c=_0x5c04f5;logger['info'](_0x92ce('0x52'),_0x26ba4c['id']);return getEndUser(_0x1ba9fb,_0x30b8e9['destcalleridname'],_0x30b8e9[_0x92ce('0x60')],_0x811f04);})[_0x92ce('0x23')](function(_0x33841b){_0x40651b=_0x33841b;logger['info'](_0x92ce('0x54'),_0x40651b['id']);return createTicket(_0x1ba9fb,_0x26ba4c,_0x40651b,_0x4d42b1,_0x30b8e9,_0x4d42b1[_0x92ce('0x55')],_0x811f04);})[_0x92ce('0x23')](function(_0x3b188a){_0x78d13f=_0x3b188a;logger[_0x92ce('0x17')](_0x92ce('0x56'));logger['info'](_0x92ce('0x57'),_0x78d13f['id']);var _0x35fabe=util[_0x92ce('0x27')](_0x92ce('0x58'),_0x1ba9fb[_0x92ce('0x1e')],_['split'](_0x78d13f['id'],'x')[0x1]);logger[_0x92ce('0x17')](_0x92ce('0x5f'),_0x92ce('0x5a'));emit(util['format'](_0x92ce('0x5b'),_0x871151[_0x92ce('0x14')]),_0x92ce('0x61'),{'uri':_0x35fabe});})[_0x92ce('0x36')](function(_0x5f25c1){logger[_0x92ce('0x28')](_0x92ce('0x5f'),JSON[_0x92ce('0x22')](_0x5f25c1));});};exports[_0x92ce('0x62')]=function(_0x37b1ba,_0x36bf2a,_0x40a11d,_0x1e1e28,_0x163dd4,_0x4fa5b5){var _0x120537,_0x5e8b50,_0x84fc46,_0x2c87f6;_0x4fa5b5['remoteUri']=intUtil[_0x92ce('0x5c')](_0x4fa5b5['remoteUri']);_0x4fa5b5[_0x92ce('0x4f')]=intUtil[_0x92ce('0x5c')](_0x4fa5b5[_0x92ce('0x4f')]);if(_0x163dd4&&_0x163dd4['monitor_format']){logger[_0x92ce('0x17')]('['+_0x36bf2a['lastevent'][_0x92ce('0x63')]()+']',_0x92ce('0x4c'));_0x36bf2a['recordingURL']=util[_0x92ce('0x27')](_0x92ce('0x4e'),_0x4fa5b5[_0x92ce('0x4f')],_0x36bf2a[_0x92ce('0x50')],md5(_0x36bf2a[_0x92ce('0x50')]));}else{_0x36bf2a[_0x92ce('0x4d')]='';}return getConnection(_0x4fa5b5)['then'](function(_0x508839){_0x2c87f6=_0x508839;return getUser(_0x4fa5b5,'',_0x2c87f6);})[_0x92ce('0x23')](function(_0x3793a2){_0x120537=_0x3793a2;logger['info']('The\x20User\x20ID\x20is:',_0x120537['id']);return getEndUser(_0x4fa5b5,_0x36bf2a[_0x92ce('0x64')],_0x36bf2a[_0x92ce('0x53')],_0x2c87f6);})[_0x92ce('0x23')](function(_0x1efe68){_0x5e8b50=_0x1efe68;logger['info'](_0x92ce('0x54'),_0x5e8b50['id']);return createTicket(_0x4fa5b5,_0x120537,_0x5e8b50,_0x40a11d,_0x36bf2a,_0x40a11d[_0x92ce('0x55')],_0x2c87f6);})[_0x92ce('0x23')](function(_0x552f08){_0x84fc46=_0x552f08;logger[_0x92ce('0x17')](_0x92ce('0x56'));logger[_0x92ce('0x17')](_0x92ce('0x57'),_0x84fc46['id']);})['catch'](function(_0x11afb6){logger['error']('['+_0x36bf2a[_0x92ce('0x65')][_0x92ce('0x63')]()+']',JSON[_0x92ce('0x22')](_0x11afb6));});}; \ No newline at end of file +var _0xd94a=['Agent\x20found!','result','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Searching\x20end\x20user\x20with\x20phone','%s/webservice.php','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','accessKey','token','[HTTP]','queue','monitor_format','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Open','getString','Descriptions','POST','format','create','username','sessionName','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','createTicket','validateEmail','remoteUri','query'];(function(_0xc991af,_0x37b88f){var _0x272c77=function(_0x3f4664){while(--_0x3f4664){_0xc991af['push'](_0xc991af['shift']());}};_0x272c77(++_0x37b88f);}(_0xd94a,0xed));var _0xad94=function(_0x2cee15,_0x497a8b){_0x2cee15=_0x2cee15-0x0;var _0xd0c9f7=_0xd94a[_0x2cee15];return _0xd0c9f7;};'use strict';var _=require('lodash');var rp=require(_0xad94('0x0'));var BPromise=require('bluebird');var md5=require(_0xad94('0x1'));var util=require(_0xad94('0x2'));var Redis=require(_0xad94('0x3'));var intUtil=require('./util');var config=require(_0xad94('0x4'));var logger=require(_0xad94('0x5'))(_0xad94('0x6'));config[_0xad94('0x7')]=_[_0xad94('0x8')](config[_0xad94('0x7')],{'host':_0xad94('0x9'),'port':0x18eb});var io=require(_0xad94('0xa'))(new Redis(config[_0xad94('0x7')]));function emit(_0x13ea44,_0x37d085,_0xa37ed5){io['to'](_0x13ea44)['emit'](_0x37d085,_0xa37ed5);}function getCustomFields(_0x2ceee9,_0x27321b){var _0x227f48={};if(_0x2ceee9[_0xad94('0xb')]>0x0){_['forEach'](_0x2ceee9,function(_0x30bf57){if(_0x30bf57[_0xad94('0xc')]===_0xad94('0xd')&&_0x30bf57[_0xad94('0xe')]){_0x227f48[_0x30bf57[_0xad94('0xe')]]=_0x30bf57[_0xad94('0xf')]['toString']();}else if(_0x30bf57[_0xad94('0xc')]===_0xad94('0x10')&&_0x30bf57[_0xad94('0x11')]&&_0x30bf57[_0xad94('0xe')]&&_0x27321b[_0x30bf57['variableName']]){_0x227f48[_0x30bf57[_0xad94('0xe')]]=_0x27321b[_0x30bf57[_0xad94('0x11')]][_0xad94('0x12')]();}else if(_0x30bf57[_0xad94('0xc')]===_0xad94('0x13')&&_0x30bf57[_0xad94('0x14')]&&_0x30bf57[_0xad94('0x14')]['name']&&_0x30bf57[_0xad94('0xe')]&&_0x27321b[_0x30bf57[_0xad94('0x14')][_0xad94('0x15')]['toLowerCase']()]){_0x227f48[_0x30bf57[_0xad94('0xe')]]=_0x27321b[_0x30bf57[_0xad94('0x14')]['name'][_0xad94('0x16')]()][_0xad94('0x12')]();}});}return _0x227f48;}function createTicket(_0x116ef3,_0x30c537,_0x2e4393,_0xbe8608,_0x1afee0,_0x59f4ac,_0x4b478c){logger[_0xad94('0x17')](_0xad94('0x18'));var _0x14bac8=_['merge']({'parent_id':'','assigned_user_id':_0x30c537['id'],'ticketpriorities':'Normal','ticketstatus':_0xad94('0x19'),'ticket_title':intUtil[_0xad94('0x1a')](_0xbe8608['Subjects'],_0x1afee0,'\x20'),'description':intUtil[_0xad94('0x1a')](_0xbe8608[_0xad94('0x1b')],_0x1afee0,'\x0a'),'contact_id':_0x2e4393['id']},getCustomFields(_0x59f4ac,_0x1afee0));var _0x175a9b={'method':_0xad94('0x1c'),'uri':util[_0xad94('0x1d')]('%s/webservice.php',_0x116ef3['remoteUri']),'form':{'operation':_0xad94('0x1e'),'username':_0x116ef3[_0xad94('0x1f')],'sessionName':_0x4b478c[_0xad94('0x20')],'elementType':'HelpDesk','element':JSON[_0xad94('0x21')](_0x14bac8)},'json':!![]};return request(_0x175a9b)[_0xad94('0x22')](function(_0x18c34f){if(_0x18c34f[_0xad94('0x23')]){return BPromise[_0xad94('0x24')]({'id':_0x18c34f['result']['id']});}else{throw new Error(util['format'](_0xad94('0x25'),JSON[_0xad94('0x21')](_0x18c34f[_0xad94('0x26')])));}})[_0xad94('0x27')](function(_0x726d4e){var _0x1cbbc8=_0x726d4e[_0xad94('0x28')]||0x1f4;logger[_0xad94('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xad94('0x29'),_0x1cbbc8,JSON[_0xad94('0x21')](_0x726d4e));});}function getUser(_0x37ea31,_0x36e9a1,_0x2aa051){if(intUtil[_0xad94('0x2a')](_0x36e9a1)){logger['info']('Getting\x20agent\x20with\x20email',_0x36e9a1);return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x37ea31[_0xad94('0x2b')]),'qs':{'operation':_0xad94('0x2c'),'username':_0x37ea31[_0xad94('0x1f')],'sessionName':_0x2aa051['sessionName'],'query':util['format']('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x36e9a1)},'json':!![]})[_0xad94('0x22')](function(_0x4a2adb){if(_0x4a2adb[_0xad94('0x23')]&&_0x4a2adb['result'][_0xad94('0xb')]){logger[_0xad94('0x17')](_0xad94('0x2d'));return BPromise['resolve']({'id':_0x4a2adb[_0xad94('0x2e')][0x0]['id'],'email':_0x4a2adb[_0xad94('0x2e')][0x0][_0xad94('0x2f')],'name':_0x4a2adb[_0xad94('0x2e')][0x0][_0xad94('0x30')]+'\x20'+_0x4a2adb[_0xad94('0x2e')][_0xad94('0x31')]});}else{logger[_0xad94('0x17')](_0xad94('0x32'));return BPromise[_0xad94('0x24')]({'id':_0x2aa051[_0xad94('0x33')],'email':_0x37ea31[_0xad94('0x1f')],'name':_0xad94('0x34')});}})[_0xad94('0x27')](function(_0x33c3fc){var _0xa9265=_0x33c3fc[_0xad94('0x28')]||0x1f4;logger[_0xad94('0x26')](_0xad94('0x35'),_0xad94('0x36'),_0xa9265,JSON[_0xad94('0x21')](_0x33c3fc));});}else{logger[_0xad94('0x17')](_0xad94('0x32'));return BPromise[_0xad94('0x24')]({'id':_0x2aa051[_0xad94('0x33')],'email':_0x37ea31[_0xad94('0x1f')],'name':_0xad94('0x34')})[_0xad94('0x27')](function(_0x58bad0){var _0xb1a24d=_0x58bad0[_0xad94('0x28')]||0x1f4;logger[_0xad94('0x26')](_0xad94('0x35'),_0xad94('0x36'),_0xb1a24d,JSON['stringify'](_0x58bad0));});}}function getEndUser(_0x42078b,_0x3d33fd,_0x224d1a,_0x46931e){logger[_0xad94('0x17')](_0xad94('0x37'),_0x224d1a);return request({'method':'GET','uri':util[_0xad94('0x1d')](_0xad94('0x38'),_0x42078b[_0xad94('0x2b')]),'qs':{'operation':_0xad94('0x2c'),'username':_0x42078b['username'],'sessionName':_0x46931e[_0xad94('0x20')],'query':util[_0xad94('0x1d')](_0xad94('0x39'),_0x224d1a,_0x224d1a,_0x224d1a,_0x224d1a,_0x224d1a)},'json':!![]})[_0xad94('0x22')](function(_0x3b9abe){if(_0x3b9abe[_0xad94('0x23')]&&_0x3b9abe[_0xad94('0x2e')][_0xad94('0xb')]){logger[_0xad94('0x17')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x3b9abe[_0xad94('0x2e')][0x0]['id'],'name':_0x3b9abe[_0xad94('0x2e')][0x0][_0xad94('0x3a')]+'\x20'+_0x3b9abe[_0xad94('0x2e')][0x0][_0xad94('0x3b')],'phone':_0x224d1a});}else{logger['info'](_0xad94('0x3c'));return request({'method':'POST','uri':util[_0xad94('0x1d')](_0xad94('0x38'),_0x42078b[_0xad94('0x2b')]),'form':{'operation':_0xad94('0x1e'),'sessionName':_0x46931e[_0xad94('0x20')],'elementType':_0xad94('0x3d'),'element':JSON[_0xad94('0x21')]({'lastname':_0x3d33fd,'phone':_0x224d1a,'assigned_user_id':'\x20'})},'json':!![]})[_0xad94('0x22')](function(_0x1ef92f){logger['info']('Enduser\x20created.');return BPromise[_0xad94('0x24')]({'id':_0x1ef92f[_0xad94('0x2e')]['id'],'name':_0x1ef92f[_0xad94('0x2e')][_0xad94('0x3b')],'phone':_0x1ef92f[_0xad94('0x2e')][_0xad94('0x3e')]});})[_0xad94('0x27')](function(_0x5dd9e1){var _0x5aa68f=_0x5dd9e1[_0xad94('0x28')]||0x1f4;logger[_0xad94('0x26')]('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x5aa68f,JSON[_0xad94('0x21')](_0x5dd9e1));});}});}function getConnection(_0x299d0c){var _0x32aaa1=_0x299d0c[_0xad94('0x1f')];var _0x1af06e=_0x299d0c[_0xad94('0x3f')];return request({'method':'GET','uri':util[_0xad94('0x1d')](_0xad94('0x38'),_0x299d0c['remoteUri']),'qs':{'operation':'getchallenge','username':_0x32aaa1},'json':!![]})[_0xad94('0x22')](function(_0x23e696){if(_0x23e696[_0xad94('0x23')]){return request({'method':'POST','uri':util[_0xad94('0x1d')](_0xad94('0x38'),_0x299d0c[_0xad94('0x2b')]),'form':{'operation':'login','username':_0x32aaa1,'accessKey':md5(_0x23e696[_0xad94('0x2e')][_0xad94('0x40')]+_0x1af06e)},'json':!![]});}})[_0xad94('0x22')](function(_0x2555ed){if(_0x2555ed[_0xad94('0x23')]){return BPromise['resolve'](_0x2555ed['result']);}else{throw new Error(util[_0xad94('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x299d0c['id']));}})[_0xad94('0x27')](function(_0x266478){var _0x12fab1=_0x266478['statusCode']||0x1f4;logger[_0xad94('0x26')](_0xad94('0x35'),'getConnection',_0x12fab1,JSON['stringify'](_0x266478));});}function request(_0x4346f1){logger[_0xad94('0x17')](_0xad94('0x41'),JSON[_0xad94('0x21')](_0x4346f1));return rp(_0x4346f1);}exports[_0xad94('0x42')]=function(_0x1c554d,_0x59bc6b,_0x1c0240,_0x30a4d8,_0x4b8d30,_0x25366f){var _0x2a72d6,_0x29a629,_0xb56cb8,_0x440c91;_0x25366f[_0xad94('0x2b')]=intUtil['stripTrailingSlash'](_0x25366f['remoteUri']);if(_0x4b8d30&&_0x4b8d30[_0xad94('0x43')]){logger[_0xad94('0x17')]('[QUEUE]','Recording\x20is\x20enabled!');_0x59bc6b[_0xad94('0x44')]=util[_0xad94('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25366f['serverUrl'],_0x59bc6b['uniqueid'],md5(_0x59bc6b[_0xad94('0x45')]));}else{_0x59bc6b['recordingURL']='';}return getConnection(_0x25366f)[_0xad94('0x22')](function(_0x1c91c1){_0x440c91=_0x1c91c1;return getUser(_0x25366f,_0x30a4d8['email'],_0x440c91);})['then'](function(_0x114854){_0x2a72d6=_0x114854;logger[_0xad94('0x17')](_0xad94('0x46'),_0x2a72d6['id']);return getEndUser(_0x25366f,_0x59bc6b[_0xad94('0x47')],_0x59bc6b['calleridnum'],_0x440c91);})['then'](function(_0x52fdd9){_0x29a629=_0x52fdd9;logger[_0xad94('0x17')](_0xad94('0x48'),_0x29a629['id']);return createTicket(_0x25366f,_0x2a72d6,_0x29a629,_0x1c0240,_0x59bc6b,_0x1c0240[_0xad94('0x49')],_0x440c91);})[_0xad94('0x22')](function(_0x3a75f2){_0xb56cb8=_0x3a75f2;logger[_0xad94('0x17')](_0xad94('0x4a'));logger[_0xad94('0x17')](_0xad94('0x4b'),_0xb56cb8['id']);var _0x40e73d=util[_0xad94('0x1d')](_0xad94('0x4c'),_0x25366f[_0xad94('0x2b')],_[_0xad94('0x4d')](_0xb56cb8['id'],'x')[0x1]);logger[_0xad94('0x17')](_0xad94('0x4e'),_0xad94('0x4f'));emit(util[_0xad94('0x1d')](_0xad94('0x50'),_0x30a4d8[_0xad94('0x15')]),_0xad94('0x51'),{'uri':_0x40e73d});})[_0xad94('0x27')](function(_0x46c4e1){logger['error'](_0xad94('0x4e'),JSON[_0xad94('0x21')](_0x46c4e1));});};exports['outbound']=function(_0x597974,_0x35240c,_0x3a61cf,_0x560e76,_0x3845d2,_0x99bcd1,_0x2268b0){var _0xb9d61c,_0x3d61ad,_0x5794db,_0x30e4ab;_0x99bcd1[_0xad94('0x2b')]=intUtil[_0xad94('0x52')](_0x99bcd1['remoteUri']);_0x99bcd1[_0xad94('0x53')]=intUtil[_0xad94('0x52')](_0x99bcd1[_0xad94('0x53')]);if(_0x2268b0&&_0x2268b0[_0xad94('0x54')]&&_0x2268b0[_0xad94('0x54')]!==_0xad94('0x55')){logger[_0xad94('0x17')]('[OUTBOUND]',_0xad94('0x56'));_0x35240c[_0xad94('0x44')]=util[_0xad94('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x99bcd1[_0xad94('0x53')],_0x35240c[_0xad94('0x45')],md5(_0x35240c[_0xad94('0x45')]));}return getConnection(_0x99bcd1)[_0xad94('0x22')](function(_0x406323){_0x30e4ab=_0x406323;return getUser(_0x99bcd1,_0x560e76['email'],_0x30e4ab);})[_0xad94('0x22')](function(_0x342a91){_0xb9d61c=_0x342a91;logger['info'](_0xad94('0x46'),_0xb9d61c['id']);return getEndUser(_0x99bcd1,_0x35240c[_0xad94('0x57')],_0x35240c[_0xad94('0x58')],_0x30e4ab);})[_0xad94('0x22')](function(_0x3ce081){_0x3d61ad=_0x3ce081;logger[_0xad94('0x17')](_0xad94('0x48'),_0x3d61ad['id']);return createTicket(_0x99bcd1,_0xb9d61c,_0x3d61ad,_0x3a61cf,_0x35240c,_0x3a61cf[_0xad94('0x49')],_0x30e4ab);})[_0xad94('0x22')](function(_0x3b24a5){_0x5794db=_0x3b24a5;logger['info'](_0xad94('0x4a'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5794db['id']);var _0x4cd5bd=util['format'](_0xad94('0x4c'),_0x99bcd1[_0xad94('0x2b')],_[_0xad94('0x4d')](_0x5794db['id'],'x')[0x1]);logger[_0xad94('0x17')](_0xad94('0x59'),_0xad94('0x4f'));emit(util[_0xad94('0x1d')](_0xad94('0x50'),_0x560e76[_0xad94('0x15')]),_0xad94('0x51'),{'uri':_0x4cd5bd});})[_0xad94('0x27')](function(_0x4bdbff){logger['error'](_0xad94('0x59'),JSON[_0xad94('0x21')](_0x4bdbff));});};exports['unmanaged']=function(_0x1bd739,_0x5987cd,_0x5a6460,_0x5f0fc3,_0x5bb3bc,_0x2db661){var _0x5b544f,_0x33b37a,_0x51967d,_0x528196;_0x2db661[_0xad94('0x2b')]=intUtil[_0xad94('0x52')](_0x2db661[_0xad94('0x2b')]);_0x2db661[_0xad94('0x53')]=intUtil[_0xad94('0x52')](_0x2db661[_0xad94('0x53')]);if(_0x5bb3bc&&_0x5bb3bc[_0xad94('0x43')]){logger[_0xad94('0x17')]('['+_0x5987cd[_0xad94('0x5a')][_0xad94('0x5b')]()+']',_0xad94('0x56'));_0x5987cd['recordingURL']=util[_0xad94('0x1d')](_0xad94('0x5c'),_0x2db661['serverUrl'],_0x5987cd[_0xad94('0x45')],md5(_0x5987cd[_0xad94('0x45')]));}else{_0x5987cd[_0xad94('0x44')]='';}return getConnection(_0x2db661)[_0xad94('0x22')](function(_0x57cca4){_0x528196=_0x57cca4;return getUser(_0x2db661,'',_0x528196);})['then'](function(_0x515e64){_0x5b544f=_0x515e64;logger[_0xad94('0x17')](_0xad94('0x46'),_0x5b544f['id']);return getEndUser(_0x2db661,_0x5987cd[_0xad94('0x47')],_0x5987cd[_0xad94('0x5d')],_0x528196);})['then'](function(_0x4d941c){_0x33b37a=_0x4d941c;logger['info'](_0xad94('0x48'),_0x33b37a['id']);return createTicket(_0x2db661,_0x5b544f,_0x33b37a,_0x5a6460,_0x5987cd,_0x5a6460[_0xad94('0x49')],_0x528196);})['then'](function(_0x27b1fd){_0x51967d=_0x27b1fd;logger[_0xad94('0x17')](_0xad94('0x4a'));logger[_0xad94('0x17')](_0xad94('0x4b'),_0x51967d['id']);})[_0xad94('0x27')](function(_0x156aff){logger[_0xad94('0x26')]('['+_0x5987cd[_0xad94('0x5a')][_0xad94('0x5b')]()+']',JSON[_0xad94('0x21')](_0x156aff));});}; \ 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 1986941..27df0c9 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 _0xaa88=['remoteUri','merge','Tags','name','Subjects','getString','Descriptions','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','then','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','results','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','user','password','%s:%s','username','authType','%s/token:%s','token','Basic\x20%s','base64','debug','GET','map','forEach','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','push','toString','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','outbound','recordingFormat','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xaa88,0x137));var _0x8aa8=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xaa88[_0xa990b7];return _0x52c99c;};'use strict';var _=require(_0x8aa8('0x0'));var rp=require(_0x8aa8('0x1'));var md5=require(_0x8aa8('0x2'));var util=require(_0x8aa8('0x3'));var Redis=require('ioredis');var intUtil=require(_0x8aa8('0x4'));var config=require(_0x8aa8('0x5'));var logger=require(_0x8aa8('0x6'))(_0x8aa8('0x7'));config[_0x8aa8('0x8')]=_[_0x8aa8('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8aa8('0xa'))(new Redis(config['redis']));function emit(_0x449d2d,_0x1ed84d,_0x27c08d){io['to'](_0x449d2d)[_0x8aa8('0xb')](_0x1ed84d,_0x27c08d);}var headers={'Content-Type':'application/json','Accept':_0x8aa8('0xc')};function getTicket(_0x2d974c,_0x224f25,_0x5c94d4,_0x4702ab,_0x9f78f5){logger[_0x8aa8('0xd')](_0x8aa8('0xe'));return request({'uri':util['format'](_0x8aa8('0xf'),_0x2d974c[_0x8aa8('0x10')]),'method':'POST','body':{'ticket':_[_0x8aa8('0x11')]({'requester_id':_0x5c94d4['id'],'submitter_id':_0x224f25?_0x224f25['id']:undefined,'assignee_id':_0x224f25?_0x224f25['id']:undefined,'tags':getTags(_0x4702ab[_0x8aa8('0x12')],_0x8aa8('0x13')),'subject':intUtil['getString'](_0x4702ab[_0x8aa8('0x14')],_0x9f78f5,'\x20'),'description':intUtil[_0x8aa8('0x15')](_0x4702ab[_0x8aa8('0x16')],_0x9f78f5,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4702ab[_0x8aa8('0x16')],_0x9f78f5,'\x0a')}},getCustomFields(_0x4702ab['Fields'],_0x9f78f5))}})['then'](function(_0x433e95){logger[_0x8aa8('0xd')](_0x8aa8('0x17'));return _0x433e95[_0x8aa8('0x18')];});}function getUser(_0x42a6a4,_0x3778f4){if(intUtil[_0x8aa8('0x19')](_0x3778f4)){logger[_0x8aa8('0xd')](_0x8aa8('0x1a'),_0x3778f4);return request({'uri':util['format']('%s/search.json',_0x42a6a4[_0x8aa8('0x10')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x3778f4)}})[_0x8aa8('0x1b')](function(_0x5ac0d9){if(_0x5ac0d9[_0x8aa8('0x1c')]){logger[_0x8aa8('0xd')](_0x8aa8('0x1d'));return _[_0x8aa8('0x1e')](_0x5ac0d9['results'],{'email':_0x3778f4,'role':_0x8aa8('0x1f')});}else{logger[_0x8aa8('0xd')](_0x8aa8('0x20'));return request({'uri':util[_0x8aa8('0x21')](_0x8aa8('0x22'),_0x42a6a4[_0x8aa8('0x10')])})['then'](function(_0x26cf63){logger['info'](_0x8aa8('0x23'));return _0x26cf63['user'];});}});}else{logger[_0x8aa8('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8aa8('0x21')](_0x8aa8('0x22'),_0x42a6a4[_0x8aa8('0x10')])})['then'](function(_0x24f428){logger[_0x8aa8('0xd')](_0x8aa8('0x23'));return _0x24f428['user'];});}}function getEndUser(_0x57acd2,_0x2d1508,_0x44e2d8){logger[_0x8aa8('0xd')](_0x8aa8('0x24'),_0x44e2d8);return request({'uri':util[_0x8aa8('0x21')]('%s/search.json',_0x57acd2[_0x8aa8('0x10')]),'qs':{'query':util['format'](_0x8aa8('0x25'),_0x44e2d8)}})[_0x8aa8('0x1b')](function(_0x15ff33){var _0x519ac0;if(_0x15ff33['results'][_0x8aa8('0x26')]){_0x15ff33['results']=_[_0x8aa8('0x27')](_0x15ff33[_0x8aa8('0x28')],{'suspended':![],'role':_0x8aa8('0x29')});if(_0x15ff33[_0x8aa8('0x28')][_0x8aa8('0x26')]){_0x519ac0=_['first'](_0x15ff33[_0x8aa8('0x28')]);}}if(_0x519ac0){logger[_0x8aa8('0xd')]('Enduser\x20found!');return _0x519ac0;}else{logger[_0x8aa8('0xd')](_0x8aa8('0x2a'));return request({'uri':util[_0x8aa8('0x21')]('%s/users.json',_0x57acd2[_0x8aa8('0x10')]),'method':_0x8aa8('0x2b'),'body':{'user':{'role':_0x8aa8('0x29'),'name':util[_0x8aa8('0x21')](_0x8aa8('0x2c'),_0x2d1508||_0x44e2d8),'phone':_0x44e2d8}}})[_0x8aa8('0x1b')](function(_0x370401){logger[_0x8aa8('0xd')](_0x8aa8('0x2d'));return _0x370401[_0x8aa8('0x2e')];});}});}function getAuth(_0x3e069a){var _0x5bf1a7;if(_0x3e069a['authType']===_0x8aa8('0x2f')){_0x5bf1a7=util[_0x8aa8('0x21')](_0x8aa8('0x30'),_0x3e069a[_0x8aa8('0x31')],_0x3e069a[_0x8aa8('0x2f')]);}else if(_0x3e069a[_0x8aa8('0x32')]==='token'){_0x5bf1a7=util['format'](_0x8aa8('0x33'),_0x3e069a['username'],_0x3e069a[_0x8aa8('0x34')]);}return util[_0x8aa8('0x21')](_0x8aa8('0x35'),new Buffer(_0x5bf1a7)['toString'](_0x8aa8('0x36')));}function request(_0x38b8d4){logger[_0x8aa8('0x37')]('[HTTP]',JSON['stringify'](_0x38b8d4));return rp(_[_0x8aa8('0x9')](_0x38b8d4,{'method':_0x8aa8('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x52f87d,_0x24eb18){var _0x2e1f52=[];if(_0x52f87d&&_0x52f87d['length']>0x0){_0x2e1f52=_[_0x8aa8('0x39')](_0x52f87d,_0x24eb18);}return _0x2e1f52;}function getCustomFields(_0x48c3ba,_0x530a66){var _0x2f8f19=[];var _0x5537ff={'custom_fields':[]};if(_0x48c3ba[_0x8aa8('0x26')]>0x0){_[_0x8aa8('0x3a')](_0x48c3ba,function(_0x926ff2){if(_0x926ff2[_0x8aa8('0x3b')]==='string'&&_0x926ff2[_0x8aa8('0x3c')]&&!_0x926ff2[_0x8aa8('0x3d')]){_0x5537ff[_0x926ff2['nameField'][_0x8aa8('0x3e')]()]=_0x926ff2[_0x8aa8('0x3f')]['toString']();}else if(_0x926ff2[_0x8aa8('0x3b')]===_0x8aa8('0x40')&&_0x926ff2[_0x8aa8('0x41')]&&_0x926ff2[_0x8aa8('0x3d')]){_0x5537ff[_0x8aa8('0x42')][_0x8aa8('0x43')]({'id':_0x926ff2[_0x8aa8('0x41')],'value':_0x926ff2[_0x8aa8('0x3f')][_0x8aa8('0x44')]()});}else if(_0x926ff2[_0x8aa8('0x3b')]===_0x8aa8('0x45')&&_0x926ff2[_0x8aa8('0x46')]&&_0x926ff2[_0x8aa8('0x41')]&&_0x926ff2[_0x8aa8('0x3d')]){_0x530a66[_0x926ff2[_0x8aa8('0x46')]]&&_0x5537ff[_0x8aa8('0x42')]['push']({'id':_0x926ff2[_0x8aa8('0x41')],'value':_0x530a66[_0x926ff2['variableName']]['toString']()});}else if(_0x926ff2['type']===_0x8aa8('0x47')&&_0x926ff2['Variable']&&_0x926ff2['Variable'][_0x8aa8('0x13')]&&_0x926ff2['idField']&&_0x926ff2[_0x8aa8('0x3d')]){_0x530a66[_0x926ff2['Variable']['name'][_0x8aa8('0x3e')]()]&&_0x5537ff[_0x8aa8('0x42')][_0x8aa8('0x43')]({'id':_0x926ff2[_0x8aa8('0x41')],'value':_0x530a66[_0x926ff2[_0x8aa8('0x48')][_0x8aa8('0x13')][_0x8aa8('0x3e')]()]['toString']()});}});}return _0x5537ff;}exports[_0x8aa8('0x49')]=function(_0x53a7a4,_0x2aec13,_0x1367db,_0x44ba22,_0x2bc6d3,_0x2a0a14){var _0x44f2b4,_0x5adcda;_0x2a0a14['remoteUri']=intUtil[_0x8aa8('0x4a')](_0x2a0a14[_0x8aa8('0x10')]);_0x2a0a14['serverUrl']=intUtil[_0x8aa8('0x4a')](_0x2a0a14[_0x8aa8('0x4b')]);if(_0x2bc6d3&&_0x2bc6d3[_0x8aa8('0x4c')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x2aec13['recordingURL']=util[_0x8aa8('0x21')](_0x8aa8('0x4d'),_0x2a0a14['serverUrl'],_0x2aec13[_0x8aa8('0x4e')],md5(_0x2aec13[_0x8aa8('0x4e')]));}else{_0x2aec13[_0x8aa8('0x4f')]='';}headers[_0x8aa8('0x50')]=getAuth(_0x2a0a14);return getUser(_0x2a0a14,_0x44ba22[_0x8aa8('0x51')])[_0x8aa8('0x1b')](function(_0x4e6b80){_0x44f2b4=_0x4e6b80;logger['info'](_0x8aa8('0x52'),_0x44f2b4['id']);return getEndUser(_0x2a0a14,_0x2aec13['calleridname'],_0x2aec13[_0x8aa8('0x53')]);})['then'](function(_0x1b4843){_0x5adcda=_0x1b4843;logger[_0x8aa8('0xd')](_0x8aa8('0x54'),_0x5adcda['id']);return getTicket(_0x2a0a14,_0x44f2b4,_0x5adcda,_0x1367db,_0x2aec13);})[_0x8aa8('0x1b')](function(_0x36de37){if(_0x36de37){logger[_0x8aa8('0xd')](_0x8aa8('0x55'),_0x36de37['id']);switch(_0x2a0a14[_0x8aa8('0x3b')]){case _0x8aa8('0x56'):logger[_0x8aa8('0xd')](_0x8aa8('0x57'),_0x8aa8('0x58'));return request({'uri':util['format'](_0x8aa8('0x59'),_0x2a0a14['remoteUri'],_0x44f2b4['id'],_0x36de37['id']),'method':'POST'});case'newTab':logger[_0x8aa8('0xd')]('[QUEUE]',_0x8aa8('0x5a'));emit(util[_0x8aa8('0x21')](_0x8aa8('0x5b'),_0x44ba22['name']),_0x8aa8('0x5c'),{'uri':util[_0x8aa8('0x21')](_0x8aa8('0x5d'),_0x2a0a14[_0x8aa8('0x10')],_0x36de37['id'])});break;default:logger['error']('[QUEUE]',_0x8aa8('0x5e'));}}})[_0x8aa8('0x5f')](function(_0x45ef2d){logger[_0x8aa8('0x60')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x45ef2d,{'showHidden':!![],'depth':null}));});};exports[_0x8aa8('0x61')]=function(_0x1bd389,_0x26eb56,_0x4bf6bc,_0x33e9ae,_0x3a814f,_0x501805,_0x5aa8a5){var _0x4b6fd7,_0x55e186;_0x501805[_0x8aa8('0x10')]=intUtil['stripTrailingSlash'](_0x501805[_0x8aa8('0x10')]);_0x501805[_0x8aa8('0x4b')]=intUtil['stripTrailingSlash'](_0x501805['serverUrl']);if(_0x5aa8a5&&_0x5aa8a5[_0x8aa8('0x62')]&&_0x5aa8a5[_0x8aa8('0x62')]!=='none'){logger['info']('[OUTBOUND]',_0x8aa8('0x63'));_0x26eb56[_0x8aa8('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x501805[_0x8aa8('0x4b')],_0x26eb56[_0x8aa8('0x4e')],md5(_0x26eb56['uniqueid']));}headers[_0x8aa8('0x50')]=getAuth(_0x501805);return getUser(_0x501805,_0x33e9ae[_0x8aa8('0x51')])['then'](function(_0x4c8431){_0x4b6fd7=_0x4c8431;logger['info'](_0x8aa8('0x52'),_0x4b6fd7['id']);return getEndUser(_0x501805,_0x26eb56['destcalleridname'],_0x26eb56[_0x8aa8('0x64')]);})[_0x8aa8('0x1b')](function(_0x3e105e){_0x55e186=_0x3e105e;logger[_0x8aa8('0xd')](_0x8aa8('0x54'),_0x55e186['id']);return getTicket(_0x501805,_0x4b6fd7,_0x55e186,_0x4bf6bc,_0x26eb56);})['then'](function(_0x379c66){if(_0x379c66){logger[_0x8aa8('0xd')](_0x8aa8('0x55'),_0x379c66['id']);switch(_0x501805[_0x8aa8('0x3b')]){case'integrationTab':logger[_0x8aa8('0xd')](_0x8aa8('0x65'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8aa8('0x21')](_0x8aa8('0x59'),_0x501805[_0x8aa8('0x10')],_0x4b6fd7['id'],_0x379c66['id']),'method':_0x8aa8('0x2b')});case _0x8aa8('0x66'):logger[_0x8aa8('0xd')](_0x8aa8('0x65'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x33e9ae[_0x8aa8('0x13')]),_0x8aa8('0x5c'),{'uri':util[_0x8aa8('0x21')](_0x8aa8('0x5d'),_0x501805[_0x8aa8('0x10')],_0x379c66['id'])});break;default:logger[_0x8aa8('0x60')](_0x8aa8('0x65'),_0x8aa8('0x5e'));}}})[_0x8aa8('0x5f')](function(_0x3cc282){logger[_0x8aa8('0x60')](_0x8aa8('0x67'),util[_0x8aa8('0x68')](_0x3cc282,{'showHidden':!![],'depth':null}));});};exports[_0x8aa8('0x69')]=function(_0x3e80ac,_0x36523a,_0x84c520,_0x2f561d,_0x28cf8a,_0x57c6f5){var _0x3b0e4d,_0x233169;_0x57c6f5[_0x8aa8('0x10')]=intUtil[_0x8aa8('0x4a')](_0x57c6f5[_0x8aa8('0x10')]);_0x57c6f5[_0x8aa8('0x4b')]=intUtil[_0x8aa8('0x4a')](_0x57c6f5[_0x8aa8('0x4b')]);if(_0x28cf8a&&_0x28cf8a[_0x8aa8('0x4c')]){logger['info']('['+_0x36523a[_0x8aa8('0x6a')][_0x8aa8('0x6b')]()+']','Recording\x20is\x20enabled!');_0x36523a[_0x8aa8('0x4f')]=util['format'](_0x8aa8('0x4d'),_0x57c6f5[_0x8aa8('0x4b')],_0x36523a['uniqueid'],md5(_0x36523a[_0x8aa8('0x4e')]));}else{_0x36523a[_0x8aa8('0x4f')]='';}headers[_0x8aa8('0x50')]=getAuth(_0x57c6f5);return getUser(_0x57c6f5)[_0x8aa8('0x1b')](function(_0xd136db){_0x3b0e4d=_0xd136db;logger[_0x8aa8('0xd')](_0x8aa8('0x52'),_0x3b0e4d['id']);return getEndUser(_0x57c6f5,_0x36523a['calleridname'],_0x36523a[_0x8aa8('0x53')]);})[_0x8aa8('0x1b')](function(_0x300ab8){_0x233169=_0x300ab8;logger[_0x8aa8('0xd')]('The\x20Enduser\x20ID\x20is:',_0x233169['id']);return getTicket(_0x57c6f5,_0x3b0e4d,_0x233169,_0x84c520,_0x36523a);})['then'](function(_0x284600){if(_0x284600){logger[_0x8aa8('0xd')](_0x8aa8('0x55'),_0x284600['id']);}})[_0x8aa8('0x5f')](function(_0x486e83){logger['error']('['+_0x36523a['lastevent'][_0x8aa8('0x6b')]()+']'+_0x8aa8('0x6c'),util[_0x8aa8('0x68')](_0x486e83,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5ff3=['then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','count','results','agent','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','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','authType','password','%s:%s','username','token','%s/token:%s','toString','debug','[HTTP]','stringify','map','type','string','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','catch','inspect','outbound','recordingFormat','[OUTBOUND]','email','destcalleridname','The\x20Ticket\x20ID\x20is:','integrationTab','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','util','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','format','merge','Tags','name','getString','Descriptions','Fields'];(function(_0x264f7e,_0x2a93cf){var _0xb78d85=function(_0x5c1141){while(--_0x5c1141){_0x264f7e['push'](_0x264f7e['shift']());}};_0xb78d85(++_0x2a93cf);}(_0x5ff3,0x17d));var _0x35ff=function(_0x5771f1,_0x3474f5){_0x5771f1=_0x5771f1-0x0;var _0x365664=_0x5ff3[_0x5771f1];return _0x365664;};'use strict';var _=require('lodash');var rp=require(_0x35ff('0x0'));var md5=require('md5');var util=require(_0x35ff('0x1'));var Redis=require('ioredis');var intUtil=require(_0x35ff('0x2'));var config=require(_0x35ff('0x3'));var logger=require(_0x35ff('0x4'))(_0x35ff('0x5'));config['redis']=_[_0x35ff('0x6')](config[_0x35ff('0x7')],{'host':_0x35ff('0x8'),'port':0x18eb});var io=require(_0x35ff('0x9'))(new Redis(config[_0x35ff('0x7')]));function emit(_0x495c31,_0x92b403,_0x4c9fab){io['to'](_0x495c31)[_0x35ff('0xa')](_0x92b403,_0x4c9fab);}var headers={'Content-Type':_0x35ff('0xb'),'Accept':_0x35ff('0xb')};function getTicket(_0x51967a,_0x20647e,_0x59ec4f,_0x1cd2c6,_0x228fea){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x35ff('0xc')]('%s/tickets.json',_0x51967a['remoteUri']),'method':'POST','body':{'ticket':_[_0x35ff('0xd')]({'requester_id':_0x59ec4f['id'],'submitter_id':_0x20647e?_0x20647e['id']:undefined,'assignee_id':_0x20647e?_0x20647e['id']:undefined,'tags':getTags(_0x1cd2c6[_0x35ff('0xe')],_0x35ff('0xf')),'subject':intUtil[_0x35ff('0x10')](_0x1cd2c6['Subjects'],_0x228fea,'\x20'),'description':intUtil[_0x35ff('0x10')](_0x1cd2c6[_0x35ff('0x11')],_0x228fea,'\x0a'),'comment':{'public':![],'body':intUtil[_0x35ff('0x10')](_0x1cd2c6['Descriptions'],_0x228fea,'\x0a')}},getCustomFields(_0x1cd2c6[_0x35ff('0x12')],_0x228fea))}})[_0x35ff('0x13')](function(_0x254975){logger[_0x35ff('0x14')](_0x35ff('0x15'));return _0x254975[_0x35ff('0x16')];});}function getUser(_0x2d4a88,_0x28def2){if(intUtil[_0x35ff('0x17')](_0x28def2)){logger[_0x35ff('0x14')](_0x35ff('0x18'),_0x28def2);return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x19'),_0x2d4a88[_0x35ff('0x1a')]),'qs':{'query':util[_0x35ff('0xc')]('type:user\x20role:agent\x20email:%s',_0x28def2)}})[_0x35ff('0x13')](function(_0x1fc4b7){if(_0x1fc4b7[_0x35ff('0x1b')]){logger[_0x35ff('0x14')]('Agent\x20found!');return _['find'](_0x1fc4b7[_0x35ff('0x1c')],{'email':_0x28def2,'role':_0x35ff('0x1d')});}else{logger['info'](_0x35ff('0x1e'));return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x1f'),_0x2d4a88[_0x35ff('0x1a')])})['then'](function(_0x3d60b4){logger['info'](_0x35ff('0x20'));return _0x3d60b4[_0x35ff('0x21')];});}});}else{logger[_0x35ff('0x14')](_0x35ff('0x1e'));return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x1f'),_0x2d4a88[_0x35ff('0x1a')])})['then'](function(_0x284f39){logger[_0x35ff('0x14')]('Admin\x20account\x20selected.');return _0x284f39[_0x35ff('0x21')];});}}function getEndUser(_0x5ad0c6,_0x4c46b7,_0x186768){logger[_0x35ff('0x14')](_0x35ff('0x22'),_0x186768);return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x19'),_0x5ad0c6['remoteUri']),'qs':{'query':util[_0x35ff('0xc')](_0x35ff('0x23'),_0x186768)}})[_0x35ff('0x13')](function(_0x5e191b){var _0x3357a;if(_0x5e191b[_0x35ff('0x1c')][_0x35ff('0x24')]){_0x5e191b[_0x35ff('0x1c')]=_[_0x35ff('0x25')](_0x5e191b[_0x35ff('0x1c')],{'suspended':![],'role':_0x35ff('0x26')});if(_0x5e191b[_0x35ff('0x1c')][_0x35ff('0x24')]){_0x3357a=_['first'](_0x5e191b[_0x35ff('0x1c')]);}}if(_0x3357a){logger['info'](_0x35ff('0x27'));return _0x3357a;}else{logger[_0x35ff('0x14')](_0x35ff('0x28'));return request({'uri':util[_0x35ff('0xc')]('%s/users.json',_0x5ad0c6[_0x35ff('0x1a')]),'method':'POST','body':{'user':{'role':_0x35ff('0x26'),'name':util[_0x35ff('0xc')]('Caller\x20-\x20%s',_0x4c46b7||_0x186768),'phone':_0x186768}}})['then'](function(_0x3a39e5){logger[_0x35ff('0x14')]('Enduser\x20created.');return _0x3a39e5[_0x35ff('0x21')];});}});}function getAuth(_0x2fd48d){var _0x4d194c;if(_0x2fd48d[_0x35ff('0x29')]===_0x35ff('0x2a')){_0x4d194c=util[_0x35ff('0xc')](_0x35ff('0x2b'),_0x2fd48d[_0x35ff('0x2c')],_0x2fd48d[_0x35ff('0x2a')]);}else if(_0x2fd48d[_0x35ff('0x29')]===_0x35ff('0x2d')){_0x4d194c=util[_0x35ff('0xc')](_0x35ff('0x2e'),_0x2fd48d[_0x35ff('0x2c')],_0x2fd48d[_0x35ff('0x2d')]);}return util[_0x35ff('0xc')]('Basic\x20%s',new Buffer(_0x4d194c)[_0x35ff('0x2f')]('base64'));}function request(_0x173b64){logger[_0x35ff('0x30')](_0x35ff('0x31'),JSON[_0x35ff('0x32')](_0x173b64));return rp(_[_0x35ff('0x6')](_0x173b64,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x272ef5,_0x29a01a){var _0x309c0d=[];if(_0x272ef5&&_0x272ef5[_0x35ff('0x24')]>0x0){_0x309c0d=_[_0x35ff('0x33')](_0x272ef5,_0x29a01a);}return _0x309c0d;}function getCustomFields(_0x51d18d,_0x2d6add){var _0x36e104=[];var _0x1640b5={'custom_fields':[]};if(_0x51d18d['length']>0x0){_['forEach'](_0x51d18d,function(_0x471857){if(_0x471857[_0x35ff('0x34')]===_0x35ff('0x35')&&_0x471857[_0x35ff('0x36')]&&!_0x471857[_0x35ff('0x37')]){_0x1640b5[_0x471857[_0x35ff('0x36')][_0x35ff('0x38')]()]=_0x471857[_0x35ff('0x39')]['toString']();}else if(_0x471857['type']==='string'&&_0x471857[_0x35ff('0x3a')]&&_0x471857[_0x35ff('0x37')]){_0x1640b5[_0x35ff('0x3b')][_0x35ff('0x3c')]({'id':_0x471857[_0x35ff('0x3a')],'value':_0x471857['content'][_0x35ff('0x2f')]()});}else if(_0x471857[_0x35ff('0x34')]===_0x35ff('0x3d')&&_0x471857[_0x35ff('0x3e')]&&_0x471857[_0x35ff('0x3a')]&&_0x471857[_0x35ff('0x37')]){_0x2d6add[_0x471857['variableName']]&&_0x1640b5['custom_fields'][_0x35ff('0x3c')]({'id':_0x471857[_0x35ff('0x3a')],'value':_0x2d6add[_0x471857[_0x35ff('0x3e')]][_0x35ff('0x2f')]()});}else if(_0x471857['type']==='customVariable'&&_0x471857[_0x35ff('0x3f')]&&_0x471857[_0x35ff('0x3f')][_0x35ff('0xf')]&&_0x471857[_0x35ff('0x3a')]&&_0x471857[_0x35ff('0x37')]){_0x2d6add[_0x471857[_0x35ff('0x3f')][_0x35ff('0xf')]['toLowerCase']()]&&_0x1640b5['custom_fields'][_0x35ff('0x3c')]({'id':_0x471857[_0x35ff('0x3a')],'value':_0x2d6add[_0x471857[_0x35ff('0x3f')]['name'][_0x35ff('0x38')]()][_0x35ff('0x2f')]()});}});}return _0x1640b5;}exports['queue']=function(_0x4f3983,_0x14a44f,_0x4ab78e,_0x2d026b,_0x20806d,_0x5e95ad){var _0x2ecbb8,_0x4b1b86;_0x5e95ad['remoteUri']=intUtil[_0x35ff('0x40')](_0x5e95ad[_0x35ff('0x1a')]);_0x5e95ad[_0x35ff('0x41')]=intUtil[_0x35ff('0x40')](_0x5e95ad[_0x35ff('0x41')]);if(_0x20806d&&_0x20806d[_0x35ff('0x42')]){logger[_0x35ff('0x14')](_0x35ff('0x43'),_0x35ff('0x44'));_0x14a44f[_0x35ff('0x45')]=util[_0x35ff('0xc')](_0x35ff('0x46'),_0x5e95ad['serverUrl'],_0x14a44f[_0x35ff('0x47')],md5(_0x14a44f[_0x35ff('0x47')]));}else{_0x14a44f[_0x35ff('0x45')]='';}headers[_0x35ff('0x48')]=getAuth(_0x5e95ad);return getUser(_0x5e95ad,_0x2d026b['email'])['then'](function(_0x672938){_0x2ecbb8=_0x672938;logger['info'](_0x35ff('0x49'),_0x2ecbb8['id']);return getEndUser(_0x5e95ad,_0x14a44f[_0x35ff('0x4a')],_0x14a44f[_0x35ff('0x4b')]);})[_0x35ff('0x13')](function(_0x25854b){_0x4b1b86=_0x25854b;logger[_0x35ff('0x14')](_0x35ff('0x4c'),_0x4b1b86['id']);return getTicket(_0x5e95ad,_0x2ecbb8,_0x4b1b86,_0x4ab78e,_0x14a44f);})[_0x35ff('0x13')](function(_0x3be5fc){if(_0x3be5fc){logger['info']('The\x20Ticket\x20ID\x20is:',_0x3be5fc['id']);switch(_0x5e95ad[_0x35ff('0x34')]){case'integrationTab':logger[_0x35ff('0x14')](_0x35ff('0x43'),_0x35ff('0x4d'));return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x4e'),_0x5e95ad[_0x35ff('0x1a')],_0x2ecbb8['id'],_0x3be5fc['id']),'method':_0x35ff('0x4f')});case _0x35ff('0x50'):logger[_0x35ff('0x14')]('[QUEUE]',_0x35ff('0x51'));emit(util[_0x35ff('0xc')](_0x35ff('0x52'),_0x2d026b[_0x35ff('0xf')]),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x5e95ad[_0x35ff('0x1a')],_0x3be5fc['id'])});break;default:logger[_0x35ff('0x53')](_0x35ff('0x43'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x35ff('0x54')](function(_0x5943fc){logger[_0x35ff('0x53')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x35ff('0x55')](_0x5943fc,{'showHidden':!![],'depth':null}));});};exports[_0x35ff('0x56')]=function(_0x681d2b,_0x3a7261,_0x50f820,_0x497b38,_0x2be86b,_0x52e0b7,_0x241263){var _0x3948cb,_0x52802a;_0x52e0b7[_0x35ff('0x1a')]=intUtil['stripTrailingSlash'](_0x52e0b7[_0x35ff('0x1a')]);_0x52e0b7[_0x35ff('0x41')]=intUtil[_0x35ff('0x40')](_0x52e0b7[_0x35ff('0x41')]);if(_0x241263&&_0x241263[_0x35ff('0x57')]&&_0x241263[_0x35ff('0x57')]!=='none'){logger['info'](_0x35ff('0x58'),_0x35ff('0x44'));_0x3a7261['recordingURL']=util[_0x35ff('0xc')](_0x35ff('0x46'),_0x52e0b7['serverUrl'],_0x3a7261[_0x35ff('0x47')],md5(_0x3a7261[_0x35ff('0x47')]));}headers[_0x35ff('0x48')]=getAuth(_0x52e0b7);return getUser(_0x52e0b7,_0x497b38[_0x35ff('0x59')])[_0x35ff('0x13')](function(_0x585941){_0x3948cb=_0x585941;logger['info']('The\x20User\x20ID\x20is:',_0x3948cb['id']);return getEndUser(_0x52e0b7,_0x3a7261[_0x35ff('0x5a')],_0x3a7261['destcalleridnum']);})[_0x35ff('0x13')](function(_0x55ff13){_0x52802a=_0x55ff13;logger[_0x35ff('0x14')](_0x35ff('0x4c'),_0x52802a['id']);return getTicket(_0x52e0b7,_0x3948cb,_0x52802a,_0x50f820,_0x3a7261);})[_0x35ff('0x13')](function(_0x5b282){if(_0x5b282){logger[_0x35ff('0x14')](_0x35ff('0x5b'),_0x5b282['id']);switch(_0x52e0b7['type']){case _0x35ff('0x5c'):logger[_0x35ff('0x14')]('[OUTBOUND]',_0x35ff('0x4d'));return request({'uri':util[_0x35ff('0xc')](_0x35ff('0x4e'),_0x52e0b7[_0x35ff('0x1a')],_0x3948cb['id'],_0x5b282['id']),'method':_0x35ff('0x4f')});case _0x35ff('0x50'):logger[_0x35ff('0x14')](_0x35ff('0x58'),_0x35ff('0x51'));emit(util['format'](_0x35ff('0x52'),_0x497b38[_0x35ff('0xf')]),_0x35ff('0x5d'),{'uri':util[_0x35ff('0xc')](_0x35ff('0x5e'),_0x52e0b7[_0x35ff('0x1a')],_0x5b282['id'])});break;default:logger['error'](_0x35ff('0x58'),_0x35ff('0x5f'));}}})[_0x35ff('0x54')](function(_0x5a561a){logger[_0x35ff('0x53')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x5a561a,{'showHidden':!![],'depth':null}));});};exports[_0x35ff('0x60')]=function(_0x378b40,_0x4a8907,_0x42c1e3,_0x305f15,_0x36e334,_0x974edb){var _0x3a8026,_0x2b0064;_0x974edb[_0x35ff('0x1a')]=intUtil[_0x35ff('0x40')](_0x974edb[_0x35ff('0x1a')]);_0x974edb[_0x35ff('0x41')]=intUtil[_0x35ff('0x40')](_0x974edb[_0x35ff('0x41')]);if(_0x36e334&&_0x36e334[_0x35ff('0x42')]){logger[_0x35ff('0x14')]('['+_0x4a8907[_0x35ff('0x61')][_0x35ff('0x62')]()+']','Recording\x20is\x20enabled!');_0x4a8907[_0x35ff('0x45')]=util[_0x35ff('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x974edb[_0x35ff('0x41')],_0x4a8907[_0x35ff('0x47')],md5(_0x4a8907['uniqueid']));}else{_0x4a8907['recordingURL']='';}headers[_0x35ff('0x48')]=getAuth(_0x974edb);return getUser(_0x974edb)['then'](function(_0x3f87a6){_0x3a8026=_0x3f87a6;logger[_0x35ff('0x14')](_0x35ff('0x49'),_0x3a8026['id']);return getEndUser(_0x974edb,_0x4a8907[_0x35ff('0x4a')],_0x4a8907[_0x35ff('0x4b')]);})[_0x35ff('0x13')](function(_0x1f2f58){_0x2b0064=_0x1f2f58;logger[_0x35ff('0x14')](_0x35ff('0x4c'),_0x2b0064['id']);return getTicket(_0x974edb,_0x3a8026,_0x2b0064,_0x42c1e3,_0x4a8907);})['then'](function(_0x33d816){if(_0x33d816){logger['info'](_0x35ff('0x5b'),_0x33d816['id']);}})['catch'](function(_0x461c90){logger[_0x35ff('0x53')]('['+_0x4a8907[_0x35ff('0x61')][_0x35ff('0x62')]()+']'+_0x35ff('0x63'),util['inspect'](_0x461c90,{'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 3d575fb..fd50dce 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 _0x2cf5=['length','type','string','idField','content','variable','variableName','toString','Variable','name','toLowerCase','indexOf','isNil','expires_in','access_token','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','add','seconds','catch','error','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','then','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','details','log','CREATE\x20ERROR','moduleSearch','contact_lead','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','getString','Description','Who_Id','Full_Name','First_Name','Last_Name','enduserType','What_Id','$se_module','Call_Duration','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','connect','Answered','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Fields','err','stack','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','host','zoho.eu','The\x20User\x20ID\x20is:','calleridname','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','com','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','[OUTBOUND]','toUpperCase','calleridnum','lodash','request-promise','util','moment','ioredis','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify'];(function(_0x142669,_0xc273d8){var _0x13dac5=function(_0x4b6fef){while(--_0x4b6fef){_0x142669['push'](_0x142669['shift']());}};_0x13dac5(++_0xc273d8);}(_0x2cf5,0x19f));var _0x52cf=function(_0x1943be,_0x4d8990){_0x1943be=_0x1943be-0x0;var _0x1b0e3b=_0x2cf5[_0x1943be];return _0x1b0e3b;};'use strict';var _=require(_0x52cf('0x0'));var rp=require(_0x52cf('0x1'));var md5=require('md5');var util=require(_0x52cf('0x2'));var intUtil=require('./util');var moment=require(_0x52cf('0x3'));var Redis=require(_0x52cf('0x4'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x52cf('0x5'))(_0x52cf('0x6'));config[_0x52cf('0x7')]=_[_0x52cf('0x8')](config[_0x52cf('0x7')],{'host':_0x52cf('0x9'),'port':0x18eb});var io=require(_0x52cf('0xa'))(new Redis(config[_0x52cf('0x7')]));function emit(_0x41d874,_0x23b2ab,_0x17e1b0){io['to'](_0x41d874)['emit'](_0x23b2ab,_0x17e1b0);}function request(_0x46d7ac){logger[_0x52cf('0xb')](_0x52cf('0xc'),JSON[_0x52cf('0xd')](_0x46d7ac));return rp(_0x46d7ac);}function getCustomFields(_0x4e5b19,_0xadb2a6){var _0x154197={};if(_0x4e5b19[_0x52cf('0xe')]>0x0){_['forEach'](_0x4e5b19,function(_0x18167b){if(_0x18167b[_0x52cf('0xf')]===_0x52cf('0x10')&&_0x18167b[_0x52cf('0x11')]){_0x154197[_0x18167b[_0x52cf('0x11')]]=_0x18167b[_0x52cf('0x12')]['toString']();}else if(_0x18167b['type']===_0x52cf('0x13')&&_0x18167b[_0x52cf('0x14')]&&_0x18167b[_0x52cf('0x11')]&&_0xadb2a6[_0x18167b[_0x52cf('0x14')]]){_0x154197[_0x18167b[_0x52cf('0x11')]]=_0xadb2a6[_0x18167b[_0x52cf('0x14')]][_0x52cf('0x15')]();}else if(_0x18167b[_0x52cf('0xf')]==='customVariable'&&_0x18167b[_0x52cf('0x16')]&&_0x18167b[_0x52cf('0x16')][_0x52cf('0x17')]&&_0x18167b['idField']&&_0xadb2a6[_0x18167b[_0x52cf('0x16')]['name'][_0x52cf('0x18')]()]){_0x154197[_0x18167b[_0x52cf('0x11')]]=_0xadb2a6[_0x18167b[_0x52cf('0x16')][_0x52cf('0x17')]['toLowerCase']()][_0x52cf('0x15')]();}});}return _0x154197;}function getName(_0x1ce14a){if(_0x1ce14a[_0x52cf('0x19')]('\x20')>0x0){var _0x180df8=_0x1ce14a['split'](/ (.+)/);if(_0x180df8[0x1]){return _0x180df8;}}return[_0x1ce14a,_0x1ce14a];}var accountsTokens={};function getAccessToken(_0x326311){return new Promise(function(_0x5f5200,_0x1d9fdd){if(!_[_0x52cf('0x1a')](accountsTokens[_0x326311['id']])&&!_[_0x52cf('0x1a')](accountsTokens[_0x326311['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x326311['id']][_0x52cf('0x1b')])){_0x5f5200(accountsTokens[_0x326311['id']][_0x52cf('0x1c')]);}}var _0x1676e6;switch(_0x326311[_0x52cf('0x1d')]){case'US':_0x1676e6=_0x52cf('0x1e');break;case'AU':_0x1676e6=_0x52cf('0x1f');break;case'EU':_0x1676e6=_0x52cf('0x20');break;case'IN':_0x1676e6=_0x52cf('0x21');break;case'CN':_0x1676e6=_0x52cf('0x22');break;default:_0x1676e6=_0x52cf('0x20');break;}var _0x57e910={'method':'POST','uri':_0x1676e6+_0x52cf('0x23'),'qs':{'refresh_token':_0x326311[_0x52cf('0x24')],'client_id':_0x326311[_0x52cf('0x25')],'client_secret':_0x326311[_0x52cf('0x26')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x57e910)['then'](function(_0x40eec3){accountsTokens[_0x326311['id']]={'access_token':_0x40eec3[_0x52cf('0x1c')],'expires_in':moment()[_0x52cf('0x27')](_0x40eec3[_0x52cf('0x1b')],_0x52cf('0x28'))};_0x5f5200(_0x40eec3[_0x52cf('0x1c')]);})[_0x52cf('0x29')](function(_0x1f6b75){logger[_0x52cf('0x2a')]('Failing\x20creating\x20the\x20access_token',_0x1f6b75['stack']);_0x1d9fdd(_0x1f6b75);});});}function getUser(_0x3dee68,_0x8b859d,_0x38ad05,_0x1e1318){logger['info'](_0x52cf('0x2b'));return request({'method':_0x52cf('0x2c'),'uri':util[_0x52cf('0x2d')](_0x52cf('0x2e'),_0x8b859d),'qs':{'type':_0x52cf('0x2f')},'headers':{'Authorization':_0x52cf('0x30')+_0x3dee68},'json':!![]})['then'](function(_0x30bf56){if(_0x30bf56[_0x52cf('0x31')]){var _0x386fef=-0x1;if(_[_0x52cf('0x32')](_0x30bf56['users'])){if(!_[_0x52cf('0x1a')](_0x1e1318)){_0x386fef=_[_0x52cf('0x33')](_0x30bf56[_0x52cf('0x31')],function(_0x141871){return _0x141871[_0x52cf('0x34')]===_0x1e1318;});}if(_0x386fef>=0x0){logger[_0x52cf('0x35')](_0x52cf('0x36'));}else{logger[_0x52cf('0x35')](_0x52cf('0x37'));_0x386fef=_[_0x52cf('0x33')](_0x30bf56['users'],function(_0x5f2c33){return _0x5f2c33[_0x52cf('0x38')][_0x52cf('0x17')]===_0x52cf('0x39');});}return _0x30bf56[_0x52cf('0x31')][_0x386fef];}else{if(_0x30bf56['user']['profile'][_0x52cf('0x17')]===_0x52cf('0x39')){logger[_0x52cf('0x35')](_0x52cf('0x37'));user=_0x30bf56[_0x52cf('0x3a')];return user;}else{logger[_0x52cf('0x2a')](_0x52cf('0x3b'),JSON[_0x52cf('0xd')](_0x30bf56));throw new Error(_0x52cf('0x3c')+JSON[_0x52cf('0xd')](_0x30bf56));}}}else{logger[_0x52cf('0x2a')](_0x52cf('0x3b'),JSON[_0x52cf('0xd')](_0x30bf56));throw new Error(_0x52cf('0x3c')+JSON[_0x52cf('0xd')](_0x30bf56));}})['catch'](function(_0x3f8420){console[_0x52cf('0x2a')](_0x3f8420);});}function getZohoUser(_0x3424d0,_0x2f9a0a){return new BPromise(function(_0x46e014,_0x158f7d){request(_0x3424d0)[_0x52cf('0x3d')](function(_0x57895a){var _0x3f04dd=null;if(_0x57895a){_0x3f04dd=_0x57895a[_0x52cf('0x3e')][0x0];_0x3f04dd['enduserType']=_0x2f9a0a;}_0x46e014(_0x3f04dd);})['catch'](function(_0x1e1303){_0x158f7d(_0x1e1303);});});}function createEndUser(_0x4fccf2,_0x50d45f,_0x12f43d,_0x32be3a,_0x180fe5,_0x8853ed){var _0x12f43d=getName(_0x12f43d);return request({'method':_0x52cf('0x3f'),'uri':_0x52cf('0x40')+_0x50d45f+_0x52cf('0x41')+_[_0x52cf('0x42')](_0x8853ed[_0x52cf('0x43')])+'s','body':{'data':[{'Last_Name':_0x12f43d[0x1],'First_Name':_0x12f43d[0x0],'Phone':_0x32be3a,'Owner':{'name':!_[_0x52cf('0x1a')](_0x180fe5[_0x52cf('0x44')][_0x52cf('0x17')])?_0x180fe5[_0x52cf('0x44')][_0x52cf('0x17')]:!_[_0x52cf('0x1a')](_0x180fe5['first_name'])?_0x180fe5[_0x52cf('0x45')]+'\x20'+_0x180fe5['last_name']:_0x180fe5[_0x52cf('0x46')],'id':_0x180fe5['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4fccf2},'json':!![]})[_0x52cf('0x3d')](function(_0x160d32){if(_0x160d32&&_0x160d32['data'][0x0][_0x52cf('0x47')]==='SUCCESS'){var _0xaab554=_0x160d32[_0x52cf('0x3e')][0x0][_0x52cf('0x48')];_0xaab554['enduserType']=_[_0x52cf('0x42')](_0x8853ed['moduleCreate'])+'s';return _0xaab554;}logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x52cf('0xd')](data));})[_0x52cf('0x29')](function(_0x516ca1){console[_0x52cf('0x49')](_0x52cf('0x4a'),_0x516ca1);});}function getEndUser(_0x39b56a,_0x2bd68c,_0x2fa1c9,_0x4e765b,_0x297887,_0x1094da,_0x303759){var _0x3dff2d={'method':_0x52cf('0x2c'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x39b56a},'json':!![]};switch(_0x303759[_0x52cf('0x4b')]){case _0x52cf('0x4c'):_0x3dff2d['uri']=_0x52cf('0x40')+_0x2bd68c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x297887+'))';return getZohoUser(_0x3dff2d,_0x52cf('0x4d'))[_0x52cf('0x3d')](function(_0x3f8e85){if(_0x3f8e85)return _0x3f8e85;_0x3dff2d[_0x52cf('0x4e')]=_0x52cf('0x40')+_0x2bd68c+_0x52cf('0x4f')+_0x297887+'))';return getZohoUser(_0x3dff2d,_0x52cf('0x50'))['then'](function(_0x4a60d6){if(_0x4a60d6)return _0x4a60d6;if(_0x303759['moduleCreate']!=_0x52cf('0x51')){return createEndUser(_0x39b56a,_0x2bd68c,_0x4e765b,_0x297887,_0x1094da,_0x303759);}else{return{};}});});break;case'contact':_0x3dff2d['uri']=_0x52cf('0x40')+_0x2bd68c+_0x52cf('0x52')+_0x297887+'))';return getZohoUser(_0x3dff2d,'Contacts')['then'](function(_0x30f142){if(_0x30f142)return _0x30f142;if(_0x303759[_0x52cf('0x43')]!=_0x52cf('0x51')){return createEndUser(_0x39b56a,_0x2bd68c,_0x4e765b,_0x297887,_0x1094da,_0x303759);}else{return{};}});break;case'lead':_0x3dff2d[_0x52cf('0x4e')]=_0x52cf('0x40')+_0x2bd68c+_0x52cf('0x4f')+_0x297887+'))';return getZohoUser(_0x3dff2d,_0x52cf('0x50'))[_0x52cf('0x3d')](function(_0x4eef8f){if(_0x4eef8f)return _0x4eef8f;if(_0x303759[_0x52cf('0x43')]!=_0x52cf('0x51')){return createEndUser(_0x39b56a,_0x2bd68c,_0x4e765b,_0x297887,_0x1094da,_0x303759);}else{return{};}});break;}}function getCall(_0x2f6310,_0x3b4114,_0x59fb6d,_0x56289c,_0x302510,_0x4c526d,_0x153fe3,_0x38e6d2){logger[_0x52cf('0x35')]('Creating\x20new\x20call...');var _0x45a3a9={};_0x45a3a9['Owner']={'name':!_[_0x52cf('0x1a')](_0x56289c[_0x52cf('0x44')][_0x52cf('0x17')])&&!_['isNil'](_0x56289c[_0x52cf('0x38')][_0x52cf('0x17')])&&_0x56289c[_0x52cf('0x38')]['name']==='administrator'?_0x56289c[_0x52cf('0x44')][_0x52cf('0x17')]:!_[_0x52cf('0x1a')](_0x56289c[_0x52cf('0x45')])?_0x56289c['first_name']+'\x20'+_0x56289c['last_name']:_0x56289c[_0x52cf('0x46')],'id':_0x56289c['id']};_0x45a3a9['Subject']=intUtil[_0x52cf('0x53')](_0x4c526d['Subjects'],_0x153fe3,'\x20');_0x45a3a9[_0x52cf('0x54')]=intUtil[_0x52cf('0x53')](_0x4c526d['Descriptions'],_0x153fe3,'\x0a');if(_0x302510['enduserType']===_0x52cf('0x4d')){_0x45a3a9[_0x52cf('0x55')]={'name':!_[_0x52cf('0x1a')](_0x302510[_0x52cf('0x56')])?_0x302510[_0x52cf('0x56')]:!_['isNil'](_0x302510[_0x52cf('0x57')])?_0x302510[_0x52cf('0x57')]+'\x20'+_0x302510[_0x52cf('0x58')]:_0x302510[_0x52cf('0x58')],'id':_0x302510['id']};}if(_0x302510[_0x52cf('0x59')]===_0x52cf('0x50')){_0x45a3a9[_0x52cf('0x5a')]={'name':!_[_0x52cf('0x1a')](_0x302510[_0x52cf('0x56')])?_0x302510[_0x52cf('0x56')]:!_[_0x52cf('0x1a')](_0x302510[_0x52cf('0x57')])?_0x302510[_0x52cf('0x57')]+'\x20'+_0x302510[_0x52cf('0x58')]:_0x302510[_0x52cf('0x58')],'id':_0x302510['id']};_0x45a3a9[_0x52cf('0x5b')]=_[_0x52cf('0x42')](_0x302510['enduserType']);}if(_0x153fe3['talktime']){_0x45a3a9[_0x52cf('0x5c')]=moment['utc'](parseInt(_0x153fe3['talktime'])*0x3e8)[_0x52cf('0x2d')](_0x52cf('0x5d'));}else if(_0x153fe3[_0x52cf('0x5e')]&&_0x153fe3[_0x52cf('0x5f')]){_0x45a3a9[_0x52cf('0x5c')]=moment['utc'](moment(_0x153fe3[_0x52cf('0x5f')],_0x52cf('0x60'))[_0x52cf('0x61')](moment(_0x153fe3[_0x52cf('0x62')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x52cf('0x5d'));}switch(_0x153fe3[_0x52cf('0x63')]){case'called':_0x45a3a9[_0x52cf('0x64')]=_0x52cf('0x65');break;case'complete':case _0x52cf('0x66'):_0x45a3a9[_0x52cf('0x64')]=_0x52cf('0x67');break;case'rejected':_0x45a3a9[_0x52cf('0x64')]=_0x52cf('0x68');break;case'abandoned':_0x45a3a9[_0x52cf('0x64')]=_0x52cf('0x69');break;case _0x52cf('0x6a'):_0x45a3a9[_0x52cf('0x64')]=_0x52cf('0x6b');default:}_0x45a3a9[_0x52cf('0x6c')]=(_0x38e6d2===_0x52cf('0x6d')?moment(_0x153fe3[_0x52cf('0x62')])[_0x52cf('0x2d')](_0x52cf('0x60')):moment(_0x153fe3[_0x52cf('0x6e')])[_0x52cf('0x2d')](_0x52cf('0x60')))||moment()['format'](_0x52cf('0x60'));_0x45a3a9['Call_Type']=_0x38e6d2||'Inbound';_0x45a3a9=_['merge'](_0x45a3a9,getCustomFields(_0x4c526d[_0x52cf('0x6f')],_0x153fe3));return request({'method':'POST','uri':_0x52cf('0x40')+_0x3b4114+'/crm/v2/Calls','headers':{'Authorization':_0x52cf('0x30')+_0x2f6310},'body':{'data':[_0x45a3a9]},'json':!![]})[_0x52cf('0x3d')](function(_0x21f3b5){if(_0x21f3b5&&_0x21f3b5[_0x52cf('0x3e')][0x0][_0x52cf('0x47')]==='SUCCESS'){logger['info']('Call\x20created!');return{'id':_0x21f3b5['data'][0x0][_0x52cf('0x48')]['id']};}})[_0x52cf('0x29')](function(_0x17bf31){logger[_0x52cf('0x35')](_0x52cf('0x70'),_0x17bf31[_0x52cf('0x71')]);console[_0x52cf('0x49')](_0x52cf('0x70'),_0x17bf31);});}exports[_0x52cf('0x72')]=function(_0x3eff6a,_0x23649a,_0x5b51b3,_0x249bda,_0x5b54cf,_0x14d5fc){var _0x1cd38a,_0x166b0f,_0x1a6789;_0x14d5fc['host']=intUtil[_0x52cf('0x73')](_0x14d5fc['host']);_0x14d5fc[_0x52cf('0x74')]=intUtil[_0x52cf('0x73')](_0x14d5fc[_0x52cf('0x74')]);if(_0x5b54cf&&_0x5b54cf[_0x52cf('0x75')]){logger[_0x52cf('0x35')](_0x52cf('0x76'),_0x52cf('0x77'));_0x23649a[_0x52cf('0x78')]=_0x14d5fc[_0x52cf('0x74')]+_0x52cf('0x79')+_0x23649a[_0x52cf('0x7a')]+_0x52cf('0x7b')+md5(_0x23649a['uniqueid']);}else{_0x23649a['recordingURL']='';}var _0x80f692=_0x14d5fc[_0x52cf('0x7c')]===_0x52cf('0x7d')?'eu':'com';return getAccessToken(_0x14d5fc)[_0x52cf('0x3d')](function(_0x530dae){_0x1a6789=_0x530dae;return getUser(_0x1a6789,_0x80f692,_0x14d5fc,_0x249bda[_0x52cf('0x34')]);})[_0x52cf('0x3d')](function(_0x32dc36){_0x1cd38a=_0x32dc36;logger['info'](_0x52cf('0x7e'),_0x1cd38a['id']);return getEndUser(_0x1a6789,_0x80f692,_0x14d5fc,_0x23649a[_0x52cf('0x7f')],_0x23649a['calleridnum'],_0x1cd38a,_0x5b51b3);})[_0x52cf('0x3d')](function(_0x1fe3fc){_0x166b0f=_0x1fe3fc;return getCall(_0x1a6789,_0x80f692,_0x14d5fc,_0x1cd38a,_0x166b0f,_0x5b51b3,_0x23649a,_0x52cf('0x80'));})[_0x52cf('0x3d')](function(_0x576e1f){if(_0x576e1f){logger[_0x52cf('0x35')]('The\x20Call\x20ID\x20is:',_0x576e1f['id']);logger[_0x52cf('0x35')](_0x52cf('0x76'),_0x52cf('0x81'));emit(util[_0x52cf('0x2d')](_0x52cf('0x82'),_0x249bda[_0x52cf('0x17')]),_0x52cf('0x83'),{'uri':_0x52cf('0x84')+_0x14d5fc['host']+_0x52cf('0x85')+_0x576e1f['id']});}})[_0x52cf('0x29')](function(_0x29ee77){logger['error']('[QUEUE]',JSON[_0x52cf('0xd')](_0x29ee77));});};exports['outbound']=function(_0x497326,_0x12d9ca,_0x54efc2,_0x418ffb,_0x46b916,_0x46e6e6,_0x36de0e){var _0x1eb1fc,_0x45cecf,_0x45e3be;_0x46e6e6['host']=intUtil[_0x52cf('0x73')](_0x46e6e6['host']);_0x46e6e6[_0x52cf('0x74')]=intUtil[_0x52cf('0x73')](_0x46e6e6[_0x52cf('0x74')]);if(_0x36de0e&&_0x36de0e['recordingFormat']&&_0x36de0e[_0x52cf('0x86')]!==_0x52cf('0x87')){logger[_0x52cf('0x35')]('[OUTBOUND]',_0x52cf('0x77'));_0x12d9ca['recordingURL']=_0x46e6e6[_0x52cf('0x74')]+_0x52cf('0x79')+_0x12d9ca[_0x52cf('0x7a')]+_0x52cf('0x7b')+md5(_0x12d9ca['uniqueid']);}var _0x688ee0=_0x46e6e6[_0x52cf('0x7c')]===_0x52cf('0x7d')?'eu':_0x52cf('0x88');return getAccessToken(_0x46e6e6)['then'](function(_0x14acd1){_0x45e3be=_0x14acd1;return getUser(_0x45e3be,_0x688ee0,_0x46e6e6,_0x418ffb['email']);})[_0x52cf('0x3d')](function(_0x2956dd){_0x1eb1fc=_0x2956dd;logger[_0x52cf('0x35')](_0x52cf('0x7e'),_0x1eb1fc['id']);return getEndUser(_0x45e3be,_0x688ee0,_0x46e6e6,_0x12d9ca[_0x52cf('0x89')],_0x12d9ca[_0x52cf('0x8a')],_0x1eb1fc,_0x54efc2);})[_0x52cf('0x3d')](function(_0x5572df){_0x45cecf=_0x5572df;return getCall(_0x45e3be,_0x688ee0,_0x46e6e6,_0x1eb1fc,_0x45cecf,_0x54efc2,_0x12d9ca,'Outbound');})[_0x52cf('0x3d')](function(_0x28d1b4){if(_0x28d1b4){logger['info'](_0x52cf('0x8b'),_0x28d1b4['id']);logger[_0x52cf('0x35')](_0x52cf('0x8c'),_0x52cf('0x81'));emit(util[_0x52cf('0x2d')]('user:%s',_0x418ffb[_0x52cf('0x17')]),_0x52cf('0x83'),{'uri':_0x52cf('0x84')+_0x46e6e6[_0x52cf('0x7c')]+_0x52cf('0x85')+_0x28d1b4['id']});}})['catch'](function(_0xc38732){logger[_0x52cf('0x2a')](_0x52cf('0x8c'),JSON[_0x52cf('0xd')](_0xc38732));});};exports['unmanaged']=function(_0x581a03,_0x3b2427,_0x4b2d05,_0x28bf80,_0x5c5663,_0x218db8){var _0x33427c,_0x4c3fde,_0x19201d;_0x218db8[_0x52cf('0x7c')]=intUtil['stripTrailingSlash'](_0x218db8['host']);_0x218db8[_0x52cf('0x74')]=intUtil[_0x52cf('0x73')](_0x218db8[_0x52cf('0x74')]);if(_0x5c5663&&_0x5c5663[_0x52cf('0x75')]){logger[_0x52cf('0x35')]('['+_0x3b2427[_0x52cf('0x63')][_0x52cf('0x8d')]()+']',_0x52cf('0x77'));_0x3b2427['recordingURL']=_0x218db8[_0x52cf('0x74')]+_0x52cf('0x79')+_0x3b2427[_0x52cf('0x7a')]+_0x52cf('0x7b')+md5(_0x3b2427[_0x52cf('0x7a')]);}else{_0x3b2427[_0x52cf('0x78')]='';}var _0x1e09ca=_0x218db8[_0x52cf('0x7c')]===_0x52cf('0x7d')?'eu':_0x52cf('0x88');return getAccessToken(_0x218db8)[_0x52cf('0x3d')](function(_0x11b556){_0x19201d=_0x11b556;return getUser(_0x19201d,_0x1e09ca,_0x218db8);})[_0x52cf('0x3d')](function(_0x25e065){_0x33427c=_0x25e065;logger[_0x52cf('0x35')]('The\x20User\x20ID\x20is:',_0x33427c['id']);return getEndUser(_0x19201d,_0x1e09ca,_0x218db8,_0x3b2427[_0x52cf('0x7f')],_0x3b2427[_0x52cf('0x8e')],_0x33427c,_0x4b2d05);})[_0x52cf('0x3d')](function(_0x27361e){_0x4c3fde=_0x27361e;return getCall(_0x19201d,_0x1e09ca,_0x218db8,_0x33427c,_0x4c3fde,_0x4b2d05,_0x3b2427,_0x52cf('0x80'));})[_0x52cf('0x3d')](function(_0x4b3a51){if(_0x4b3a51){logger[_0x52cf('0x35')](_0x52cf('0x8b'),_0x4b3a51['id']);}})[_0x52cf('0x29')](function(_0x4c141e){logger[_0x52cf('0x2a')]('['+_0x3b2427[_0x52cf('0x63')]['toUpperCase']()+']',JSON['stringify'](_0x4c141e));});}; \ No newline at end of file +var _0xda2d=['stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','findIndex','Using\x20the\x20admin\x20account!','users','profile','Administrator','user','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','Contacts','then','Leads','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','startCase','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','Abandoned','timeout','Timeout','outbound','agentcalledAt','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','email','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','zoho.eu','destcalleridname','destcalleridnum','Outbound','unmanaged','calleridnum','toUpperCase','request-promise','md5','util','./util','moment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','idField','content','toString','type','variable','variableName','customVariable','Variable','toLowerCase','name','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','add','catch','error','Failing\x20creating\x20the\x20access_token'];(function(_0x1bc0b8,_0x5efc5e){var _0x4a2ae0=function(_0x5e8e50){while(--_0x5e8e50){_0x1bc0b8['push'](_0x1bc0b8['shift']());}};_0x4a2ae0(++_0x5efc5e);}(_0xda2d,0x102));var _0xdda2=function(_0xbc1ce5,_0x59c276){_0xbc1ce5=_0xbc1ce5-0x0;var _0x5a8449=_0xda2d[_0xbc1ce5];return _0x5a8449;};'use strict';var _=require('lodash');var rp=require(_0xdda2('0x0'));var md5=require(_0xdda2('0x1'));var util=require(_0xdda2('0x2'));var intUtil=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0xdda2('0x5'))(_0xdda2('0x6'));config[_0xdda2('0x7')]=_[_0xdda2('0x8')](config[_0xdda2('0x7')],{'host':_0xdda2('0x9'),'port':0x18eb});var io=require(_0xdda2('0xa'))(new Redis(config[_0xdda2('0x7')]));function emit(_0x2e2523,_0x341c7b,_0x4a97f3){io['to'](_0x2e2523)[_0xdda2('0xb')](_0x341c7b,_0x4a97f3);}function request(_0x22c6e5){logger['debug'](_0xdda2('0xc'),JSON[_0xdda2('0xd')](_0x22c6e5));return rp(_0x22c6e5);}function getCustomFields(_0x42d990,_0x346119){var _0x171123={};if(_0x42d990[_0xdda2('0xe')]>0x0){_[_0xdda2('0xf')](_0x42d990,function(_0x1dac9a){if(_0x1dac9a['type']==='string'&&_0x1dac9a['idField']){_0x171123[_0x1dac9a[_0xdda2('0x10')]]=_0x1dac9a[_0xdda2('0x11')][_0xdda2('0x12')]();}else if(_0x1dac9a[_0xdda2('0x13')]===_0xdda2('0x14')&&_0x1dac9a[_0xdda2('0x15')]&&_0x1dac9a[_0xdda2('0x10')]&&_0x346119[_0x1dac9a['variableName']]){_0x171123[_0x1dac9a[_0xdda2('0x10')]]=_0x346119[_0x1dac9a['variableName']][_0xdda2('0x12')]();}else if(_0x1dac9a[_0xdda2('0x13')]===_0xdda2('0x16')&&_0x1dac9a[_0xdda2('0x17')]&&_0x1dac9a[_0xdda2('0x17')]['name']&&_0x1dac9a['idField']&&_0x346119[_0x1dac9a[_0xdda2('0x17')]['name'][_0xdda2('0x18')]()]){_0x171123[_0x1dac9a[_0xdda2('0x10')]]=_0x346119[_0x1dac9a[_0xdda2('0x17')][_0xdda2('0x19')][_0xdda2('0x18')]()][_0xdda2('0x12')]();}});}return _0x171123;}function getName(_0x3ca127){if(_0x3ca127[_0xdda2('0x1a')]('\x20')>0x0){var _0x3c02a4=_0x3ca127[_0xdda2('0x1b')](/ (.+)/);if(_0x3c02a4[0x1]){return _0x3c02a4;}}return[_0x3ca127,_0x3ca127];}var accountsTokens={};function getAccessToken(_0x312ef1){return new Promise(function(_0x6fdede,_0x4eed30){if(!_[_0xdda2('0x1c')](accountsTokens[_0x312ef1['id']])&&!_['isNil'](accountsTokens[_0x312ef1['id']][_0xdda2('0x1d')])){if(moment()[_0xdda2('0x1e')](accountsTokens[_0x312ef1['id']][_0xdda2('0x1f')])){_0x6fdede(accountsTokens[_0x312ef1['id']]['access_token']);}}var _0x347ee6;switch(_0x312ef1['zone']){case'US':_0x347ee6=_0xdda2('0x20');break;case'AU':_0x347ee6=_0xdda2('0x21');break;case'EU':_0x347ee6='https://accounts.zoho.eu';break;case'IN':_0x347ee6=_0xdda2('0x22');break;case'CN':_0x347ee6=_0xdda2('0x23');break;default:_0x347ee6=_0xdda2('0x24');break;}var _0x13b0f3={'method':_0xdda2('0x25'),'uri':_0x347ee6+'/oauth/v2/token','qs':{'refresh_token':_0x312ef1[_0xdda2('0x26')],'client_id':_0x312ef1[_0xdda2('0x27')],'client_secret':_0x312ef1[_0xdda2('0x28')],'grant_type':_0xdda2('0x29')},'json':!![]};return rp(_0x13b0f3)['then'](function(_0x4e97dc){accountsTokens[_0x312ef1['id']]={'access_token':_0x4e97dc[_0xdda2('0x1d')],'expires_in':moment()[_0xdda2('0x2a')](_0x4e97dc[_0xdda2('0x1f')],'seconds')};_0x6fdede(_0x4e97dc[_0xdda2('0x1d')]);})[_0xdda2('0x2b')](function(_0x2e755b){logger[_0xdda2('0x2c')](_0xdda2('0x2d'),_0x2e755b[_0xdda2('0x2e')]);_0x4eed30(_0x2e755b);});});}function getUser(_0x4bb8a4,_0x24c37d,_0x255bbc,_0x53acb5){logger[_0xdda2('0x2f')](_0xdda2('0x30'));return request({'method':_0xdda2('0x31'),'uri':util[_0xdda2('0x32')]('https://www.zohoapis.%s/crm/v2/users',_0x24c37d),'qs':{'type':_0xdda2('0x33')},'headers':{'Authorization':_0xdda2('0x34')+_0x4bb8a4},'json':!![]})['then'](function(_0x1ca9f3){if(_0x1ca9f3['users']){var _0x2b8cd6=-0x1;if(_['isArrayLikeObject'](_0x1ca9f3['users'])){if(!_['isNil'](_0x53acb5)){_0x2b8cd6=_[_0xdda2('0x35')](_0x1ca9f3['users'],function(_0x1b13f4){return _0x1b13f4['email']===_0x53acb5;});}if(_0x2b8cd6>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xdda2('0x2f')](_0xdda2('0x36'));_0x2b8cd6=_[_0xdda2('0x35')](_0x1ca9f3[_0xdda2('0x37')],function(_0x12e96d){return _0x12e96d[_0xdda2('0x38')][_0xdda2('0x19')]===_0xdda2('0x39');});}return _0x1ca9f3[_0xdda2('0x37')][_0x2b8cd6];}else{if(_0x1ca9f3[_0xdda2('0x3a')]['profile'][_0xdda2('0x19')]===_0xdda2('0x39')){logger[_0xdda2('0x2f')](_0xdda2('0x36'));user=_0x1ca9f3[_0xdda2('0x3a')];return user;}else{logger[_0xdda2('0x2c')](_0xdda2('0x3b'),JSON['stringify'](_0x1ca9f3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xdda2('0xd')](_0x1ca9f3));}}}else{logger[_0xdda2('0x2c')](_0xdda2('0x3b'),JSON['stringify'](_0x1ca9f3));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xdda2('0xd')](_0x1ca9f3));}})[_0xdda2('0x2b')](function(_0x2d7a21){console[_0xdda2('0x2c')](_0x2d7a21);});}function getZohoUser(_0x246001,_0x5ab419){return new BPromise(function(_0x1e7b94,_0x21fc6d){request(_0x246001)['then'](function(_0x5bcf99){var _0x98bf47=null;if(_0x5bcf99){_0x98bf47=_0x5bcf99[_0xdda2('0x3c')][0x0];_0x98bf47[_0xdda2('0x3d')]=_0x5ab419;}_0x1e7b94(_0x98bf47);})[_0xdda2('0x2b')](function(_0x20969d){_0x21fc6d(_0x20969d);});});}function createEndUser(_0x585eba,_0x2e7847,_0x226de2,_0x7dac2c,_0x1a7262,_0x50c4ae){var _0x226de2=getName(_0x226de2);return request({'method':_0xdda2('0x25'),'uri':_0xdda2('0x3e')+_0x2e7847+_0xdda2('0x3f')+_['startCase'](_0x50c4ae[_0xdda2('0x40')])+'s','body':{'data':[{'Last_Name':_0x226de2[0x1],'First_Name':_0x226de2[0x0],'Phone':_0x7dac2c,'Owner':{'name':!_['isNil'](_0x1a7262[_0xdda2('0x41')]['name'])?_0x1a7262[_0xdda2('0x41')][_0xdda2('0x19')]:!_[_0xdda2('0x1c')](_0x1a7262[_0xdda2('0x42')])?_0x1a7262['first_name']+'\x20'+_0x1a7262[_0xdda2('0x43')]:_0x1a7262['last_name'],'id':_0x1a7262['id']}}]},'headers':{'Authorization':_0xdda2('0x34')+_0x585eba},'json':!![]})['then'](function(_0x1d1678){if(_0x1d1678&&_0x1d1678[_0xdda2('0x3c')][0x0][_0xdda2('0x44')]===_0xdda2('0x45')){var _0x38dc03=_0x1d1678['data'][0x0][_0xdda2('0x46')];_0x38dc03[_0xdda2('0x3d')]=_['startCase'](_0x50c4ae[_0xdda2('0x40')])+'s';return _0x38dc03;}logger['error'](_0xdda2('0x3b'),JSON[_0xdda2('0xd')](data));throw new Error(_0xdda2('0x47')+JSON[_0xdda2('0xd')](data));})[_0xdda2('0x2b')](function(_0x6718ea){console[_0xdda2('0x48')](_0xdda2('0x49'),_0x6718ea);});}function getEndUser(_0xff55,_0x104a60,_0x15a86c,_0x224eac,_0x7a2dbc,_0x4d22b3,_0x5cb8b5){var _0x4fe8e8={'method':_0xdda2('0x31'),'uri':'','headers':{'Authorization':_0xdda2('0x34')+_0xff55},'json':!![]};switch(_0x5cb8b5['moduleSearch']){case _0xdda2('0x4a'):_0x4fe8e8[_0xdda2('0x4b')]=_0xdda2('0x3e')+_0x104a60+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x7a2dbc+'))';return getZohoUser(_0x4fe8e8,_0xdda2('0x4c'))[_0xdda2('0x4d')](function(_0x4eada0){if(_0x4eada0)return _0x4eada0;_0x4fe8e8['uri']=_0xdda2('0x3e')+_0x104a60+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x7a2dbc+'))';return getZohoUser(_0x4fe8e8,_0xdda2('0x4e'))['then'](function(_0x306596){if(_0x306596)return _0x306596;if(_0x5cb8b5[_0xdda2('0x40')]!='nothing'){return createEndUser(_0xff55,_0x104a60,_0x224eac,_0x7a2dbc,_0x4d22b3,_0x5cb8b5);}else{return{};}});});break;case'contact':_0x4fe8e8[_0xdda2('0x4b')]=_0xdda2('0x3e')+_0x104a60+_0xdda2('0x4f')+_0x7a2dbc+'))';return getZohoUser(_0x4fe8e8,_0xdda2('0x4c'))['then'](function(_0x1edbc6){if(_0x1edbc6)return _0x1edbc6;if(_0x5cb8b5[_0xdda2('0x40')]!=_0xdda2('0x50')){return createEndUser(_0xff55,_0x104a60,_0x224eac,_0x7a2dbc,_0x4d22b3,_0x5cb8b5);}else{return{};}});break;case _0xdda2('0x51'):_0x4fe8e8[_0xdda2('0x4b')]='https://www.zohoapis.'+_0x104a60+_0xdda2('0x52')+_0x7a2dbc+'))';return getZohoUser(_0x4fe8e8,_0xdda2('0x4e'))['then'](function(_0x3eb3c1){if(_0x3eb3c1)return _0x3eb3c1;if(_0x5cb8b5[_0xdda2('0x40')]!=_0xdda2('0x50')){return createEndUser(_0xff55,_0x104a60,_0x224eac,_0x7a2dbc,_0x4d22b3,_0x5cb8b5);}else{return{};}});break;}}function getCall(_0x2c2a4a,_0x161d7b,_0x265169,_0x4b6519,_0x2c58c7,_0x4a9814,_0x361038,_0x4a70ff){logger[_0xdda2('0x2f')]('Creating\x20new\x20call...');var _0x3b5bbf={};_0x3b5bbf[_0xdda2('0x53')]={'name':!_[_0xdda2('0x1c')](_0x4b6519[_0xdda2('0x41')][_0xdda2('0x19')])&&!_[_0xdda2('0x1c')](_0x4b6519[_0xdda2('0x38')][_0xdda2('0x19')])&&_0x4b6519['profile'][_0xdda2('0x19')]===_0xdda2('0x54')?_0x4b6519[_0xdda2('0x41')]['name']:!_[_0xdda2('0x1c')](_0x4b6519[_0xdda2('0x42')])?_0x4b6519['first_name']+'\x20'+_0x4b6519[_0xdda2('0x43')]:_0x4b6519['last_name'],'id':_0x4b6519['id']};_0x3b5bbf[_0xdda2('0x55')]=intUtil[_0xdda2('0x56')](_0x4a9814[_0xdda2('0x57')],_0x361038,'\x20');_0x3b5bbf[_0xdda2('0x58')]=intUtil[_0xdda2('0x56')](_0x4a9814['Descriptions'],_0x361038,'\x0a');if(_0x2c58c7['enduserType']==='Contacts'){_0x3b5bbf[_0xdda2('0x59')]={'name':!_[_0xdda2('0x1c')](_0x2c58c7['Full_Name'])?_0x2c58c7[_0xdda2('0x5a')]:!_[_0xdda2('0x1c')](_0x2c58c7[_0xdda2('0x5b')])?_0x2c58c7['First_Name']+'\x20'+_0x2c58c7[_0xdda2('0x5c')]:_0x2c58c7[_0xdda2('0x5c')],'id':_0x2c58c7['id']};}if(_0x2c58c7[_0xdda2('0x3d')]==='Leads'){_0x3b5bbf[_0xdda2('0x5d')]={'name':!_[_0xdda2('0x1c')](_0x2c58c7[_0xdda2('0x5a')])?_0x2c58c7[_0xdda2('0x5a')]:!_['isNil'](_0x2c58c7[_0xdda2('0x5b')])?_0x2c58c7['First_Name']+'\x20'+_0x2c58c7['Last_Name']:_0x2c58c7['Last_Name'],'id':_0x2c58c7['id']};_0x3b5bbf[_0xdda2('0x5e')]=_[_0xdda2('0x5f')](_0x2c58c7[_0xdda2('0x3d')]);}if(_0x361038[_0xdda2('0x60')]){_0x3b5bbf[_0xdda2('0x61')]=moment[_0xdda2('0x62')](parseInt(_0x361038[_0xdda2('0x60')])*0x3e8)[_0xdda2('0x32')](_0xdda2('0x63'));}else if(_0x361038[_0xdda2('0x64')]&&_0x361038[_0xdda2('0x65')]){_0x3b5bbf['Call_Duration']=moment[_0xdda2('0x62')](moment(_0x361038[_0xdda2('0x65')],_0xdda2('0x66'))[_0xdda2('0x67')](moment(_0x361038[_0xdda2('0x68')],_0xdda2('0x66'))))[_0xdda2('0x32')]('mm:ss');}switch(_0x361038[_0xdda2('0x69')]){case _0xdda2('0x6a'):_0x3b5bbf[_0xdda2('0x6b')]=_0xdda2('0x6c');break;case _0xdda2('0x6d'):case'connect':_0x3b5bbf[_0xdda2('0x6b')]=_0xdda2('0x6e');break;case _0xdda2('0x6f'):_0x3b5bbf[_0xdda2('0x6b')]=_0xdda2('0x70');break;case'abandoned':_0x3b5bbf[_0xdda2('0x6b')]=_0xdda2('0x71');break;case _0xdda2('0x72'):_0x3b5bbf[_0xdda2('0x6b')]=_0xdda2('0x73');default:}_0x3b5bbf['Call_Start_Time']=(_0x4a70ff===_0xdda2('0x74')?moment(_0x361038[_0xdda2('0x68')])[_0xdda2('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x361038[_0xdda2('0x75')])['format'](_0xdda2('0x66')))||moment()[_0xdda2('0x32')](_0xdda2('0x66'));_0x3b5bbf['Call_Type']=_0x4a70ff||_0xdda2('0x76');_0x3b5bbf=_[_0xdda2('0x77')](_0x3b5bbf,getCustomFields(_0x4a9814['Fields'],_0x361038));return request({'method':_0xdda2('0x25'),'uri':'https://www.zohoapis.'+_0x161d7b+_0xdda2('0x78'),'headers':{'Authorization':_0xdda2('0x34')+_0x2c2a4a},'body':{'data':[_0x3b5bbf]},'json':!![]})[_0xdda2('0x4d')](function(_0x29cf1a){if(_0x29cf1a&&_0x29cf1a[_0xdda2('0x3c')][0x0]['code']==='SUCCESS'){logger[_0xdda2('0x2f')](_0xdda2('0x79'));return{'id':_0x29cf1a['data'][0x0]['details']['id']};}})[_0xdda2('0x2b')](function(_0x501336){logger[_0xdda2('0x2f')](_0xdda2('0x7a'),_0x501336['stack']);console[_0xdda2('0x48')](_0xdda2('0x7a'),_0x501336);});}exports[_0xdda2('0x7b')]=function(_0x4739c4,_0x694386,_0x37f5cd,_0x4eebb0,_0x7764df,_0x22de37){var _0x2dbaad,_0x533880,_0x27780e;_0x22de37[_0xdda2('0x7c')]=intUtil['stripTrailingSlash'](_0x22de37['host']);_0x22de37[_0xdda2('0x7d')]=intUtil[_0xdda2('0x7e')](_0x22de37[_0xdda2('0x7d')]);if(_0x7764df&&_0x7764df['monitor_format']){logger['info'](_0xdda2('0x7f'),'Recording\x20is\x20enabled!');_0x694386[_0xdda2('0x80')]=_0x22de37[_0xdda2('0x7d')]+_0xdda2('0x81')+_0x694386[_0xdda2('0x82')]+_0xdda2('0x83')+md5(_0x694386[_0xdda2('0x82')]);}else{_0x694386['recordingURL']='';}var _0x5170b7=_0x22de37[_0xdda2('0x7c')]==='zoho.eu'?'eu':_0xdda2('0x84');return getAccessToken(_0x22de37)[_0xdda2('0x4d')](function(_0x15f581){_0x27780e=_0x15f581;return getUser(_0x27780e,_0x5170b7,_0x22de37,_0x4eebb0[_0xdda2('0x85')]);})[_0xdda2('0x4d')](function(_0x104024){_0x2dbaad=_0x104024;logger[_0xdda2('0x2f')](_0xdda2('0x86'),_0x2dbaad['id']);return getEndUser(_0x27780e,_0x5170b7,_0x22de37,_0x694386[_0xdda2('0x87')],_0x694386['calleridnum'],_0x2dbaad,_0x37f5cd);})[_0xdda2('0x4d')](function(_0x40d931){_0x533880=_0x40d931;return getCall(_0x27780e,_0x5170b7,_0x22de37,_0x2dbaad,_0x533880,_0x37f5cd,_0x694386,_0xdda2('0x76'));})[_0xdda2('0x4d')](function(_0x4990fe){if(_0x4990fe){logger[_0xdda2('0x2f')](_0xdda2('0x88'),_0x4990fe['id']);logger[_0xdda2('0x2f')](_0xdda2('0x7f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xdda2('0x89'),_0x4eebb0[_0xdda2('0x19')]),_0xdda2('0x8a'),{'uri':_0xdda2('0x8b')+_0x22de37['host']+_0xdda2('0x8c')+_0x4990fe['id']});}})[_0xdda2('0x2b')](function(_0x17656d){logger[_0xdda2('0x2c')](_0xdda2('0x7f'),JSON[_0xdda2('0xd')](_0x17656d));});};exports[_0xdda2('0x74')]=function(_0x103e37,_0x333cec,_0x10bc49,_0x12ff97,_0x23a80a,_0x285cb2,_0x3ac576){var _0x2411e8,_0x4b9481,_0x221f72;_0x285cb2[_0xdda2('0x7c')]=intUtil['stripTrailingSlash'](_0x285cb2['host']);_0x285cb2[_0xdda2('0x7d')]=intUtil[_0xdda2('0x7e')](_0x285cb2[_0xdda2('0x7d')]);if(_0x3ac576&&_0x3ac576[_0xdda2('0x8d')]&&_0x3ac576[_0xdda2('0x8d')]!==_0xdda2('0x8e')){logger['info'](_0xdda2('0x8f'),_0xdda2('0x90'));_0x333cec[_0xdda2('0x80')]=_0x285cb2[_0xdda2('0x7d')]+'/api/voice/recordings/'+_0x333cec[_0xdda2('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x333cec[_0xdda2('0x82')]);}var _0x6b6dad=_0x285cb2['host']===_0xdda2('0x91')?'eu':_0xdda2('0x84');return getAccessToken(_0x285cb2)[_0xdda2('0x4d')](function(_0x1dfe6d){_0x221f72=_0x1dfe6d;return getUser(_0x221f72,_0x6b6dad,_0x285cb2,_0x12ff97[_0xdda2('0x85')]);})[_0xdda2('0x4d')](function(_0x1c6ef1){_0x2411e8=_0x1c6ef1;logger[_0xdda2('0x2f')](_0xdda2('0x86'),_0x2411e8['id']);return getEndUser(_0x221f72,_0x6b6dad,_0x285cb2,_0x333cec[_0xdda2('0x92')],_0x333cec[_0xdda2('0x93')],_0x2411e8,_0x10bc49);})['then'](function(_0x574680){_0x4b9481=_0x574680;return getCall(_0x221f72,_0x6b6dad,_0x285cb2,_0x2411e8,_0x4b9481,_0x10bc49,_0x333cec,_0xdda2('0x94'));})[_0xdda2('0x4d')](function(_0x3baaf8){if(_0x3baaf8){logger[_0xdda2('0x2f')]('The\x20Call\x20ID\x20is:',_0x3baaf8['id']);logger[_0xdda2('0x2f')](_0xdda2('0x8f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdda2('0x32')](_0xdda2('0x89'),_0x12ff97['name']),'trigger:browser:url',{'uri':_0xdda2('0x8b')+_0x285cb2[_0xdda2('0x7c')]+_0xdda2('0x8c')+_0x3baaf8['id']});}})[_0xdda2('0x2b')](function(_0x14d8fa){logger[_0xdda2('0x2c')]('[OUTBOUND]',JSON[_0xdda2('0xd')](_0x14d8fa));});};exports[_0xdda2('0x95')]=function(_0x5cca40,_0x4bd37d,_0x22deb9,_0x4b57df,_0x2da4a7,_0x3e1c69){var _0x159d54,_0x500333,_0xe6f37b;_0x3e1c69['host']=intUtil[_0xdda2('0x7e')](_0x3e1c69[_0xdda2('0x7c')]);_0x3e1c69[_0xdda2('0x7d')]=intUtil[_0xdda2('0x7e')](_0x3e1c69['serverUrl']);if(_0x2da4a7&&_0x2da4a7['monitor_format']){logger[_0xdda2('0x2f')]('['+_0x4bd37d[_0xdda2('0x69')]['toUpperCase']()+']',_0xdda2('0x90'));_0x4bd37d[_0xdda2('0x80')]=_0x3e1c69[_0xdda2('0x7d')]+_0xdda2('0x81')+_0x4bd37d[_0xdda2('0x82')]+_0xdda2('0x83')+md5(_0x4bd37d[_0xdda2('0x82')]);}else{_0x4bd37d[_0xdda2('0x80')]='';}var _0x3046c1=_0x3e1c69[_0xdda2('0x7c')]===_0xdda2('0x91')?'eu':_0xdda2('0x84');return getAccessToken(_0x3e1c69)['then'](function(_0x5a28b0){_0xe6f37b=_0x5a28b0;return getUser(_0xe6f37b,_0x3046c1,_0x3e1c69);})['then'](function(_0x3f265f){_0x159d54=_0x3f265f;logger['info'](_0xdda2('0x86'),_0x159d54['id']);return getEndUser(_0xe6f37b,_0x3046c1,_0x3e1c69,_0x4bd37d[_0xdda2('0x87')],_0x4bd37d[_0xdda2('0x96')],_0x159d54,_0x22deb9);})[_0xdda2('0x4d')](function(_0x558ab6){_0x500333=_0x558ab6;return getCall(_0xe6f37b,_0x3046c1,_0x3e1c69,_0x159d54,_0x500333,_0x22deb9,_0x4bd37d,_0xdda2('0x76'));})[_0xdda2('0x4d')](function(_0x403a68){if(_0x403a68){logger['info'](_0xdda2('0x88'),_0x403a68['id']);}})[_0xdda2('0x2b')](function(_0x2588f5){logger['error']('['+_0x4bd37d['lastevent'][_0xdda2('0x97')]()+']',JSON[_0xdda2('0xd')](_0x2588f5));});}; \ 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 781164f..1c4676a 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(_0x325fa2,_0x4d446d){var _0x7ca4b8=function(_0xa945ed){while(--_0xa945ed){_0x325fa2['push'](_0x325fa2['shift']());}};_0x7ca4b8(++_0x4d446d);}(_0x7a54,0x106));var _0x47a5=function(_0x81907e,_0x3b4ef8){_0x81907e=_0x81907e-0x0;var _0x1d14b3=_0x7a54[_0x81907e];return _0x1d14b3;};'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(_0x868ef0,_0x32a82b){var _0x3a1bee=function(_0x1e69e3){while(--_0x1e69e3){_0x868ef0['push'](_0x868ef0['shift']());}};_0x3a1bee(++_0x32a82b);}(_0x7a54,0x106));var _0x47a5=function(_0x5f89c0,_0x25d67b){_0x5f89c0=_0x5f89c0-0x0;var _0x465253=_0x7a54[_0x5f89c0];return _0x465253;};'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 8f2bcd7..8e128e2 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(_0x2842df,_0x2f33a2){var _0x2db88=function(_0x263bc5){while(--_0x263bc5){_0x2842df['push'](_0x2842df['shift']());}};_0x2db88(++_0x2f33a2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3039e0,_0x155469){_0x3039e0=_0x3039e0-0x0;var _0x3d817f=_0x5f2f[_0x3039e0];return _0x3d817f;};'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 _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(_0x5b1bf6,_0x2c37cc){var _0x121006=function(_0x2333bc){while(--_0x2333bc){_0x5b1bf6['push'](_0x5b1bf6['shift']());}};_0x121006(++_0x2c37cc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ed7b6,_0x556ad4){_0x4ed7b6=_0x4ed7b6-0x0;var _0xbde562=_0x5f2f[_0x4ed7b6];return _0xbde562;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index d7fa4dd..b115876 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 _0xf698=['rpc','error','message','result','catch','jayson/promise','bluebird','routing','client','Request','request'];(function(_0x470487,_0x100b7a){var _0xa54074=function(_0xfb0736){while(--_0xfb0736){_0x470487['push'](_0x470487['shift']());}};_0xa54074(++_0x100b7a);}(_0xf698,0x1de));var _0x8f69=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0xf698[_0x148c09];return _0x18e613;};'use strict';var jayson=require(_0x8f69('0x0'));var BPromise=require(_0x8f69('0x1'));var logger=require('../../config/logger')(_0x8f69('0x2'));var client=jayson[_0x8f69('0x3')]['http']({'port':0x2329});client[_0x8f69('0x4')]=function(_0x220362,_0x83c2db){return new BPromise(function(_0x355676,_0x51d187){return client[_0x8f69('0x5')](_0x220362,_0x83c2db)['then'](function(_0x56df1b){logger['debug'](_0x8f69('0x6'),_0x8f69('0x2'),_0x220362,_0x83c2db,_0x56df1b);if(_0x56df1b[_0x8f69('0x7')]){logger[_0x8f69('0x7')](_0x8f69('0x6'),_0x8f69('0x2'),_0x220362,_0x56df1b[_0x8f69('0x7')][_0x8f69('0x8')],_0x83c2db);return _0x51d187(_0x56df1b[_0x8f69('0x7')][_0x8f69('0x8')]);}else{return _0x355676(_0x56df1b[_0x8f69('0x9')]);}})[_0x8f69('0xa')](function(_0x5ba793){logger[_0x8f69('0x7')]('rpc',_0x8f69('0x2'),_0x220362,_0x5ba793,_0x83c2db);return _0x51d187(_0x5ba793);});});};module['exports']=client; \ No newline at end of file +var _0x6898=['client','http','Request','request','then','debug','rpc','error','result','catch','jayson/promise','../../config/logger','routing'];(function(_0x4dbdda,_0x11f07c){var _0x1acbf1=function(_0x1a9fc8){while(--_0x1a9fc8){_0x4dbdda['push'](_0x4dbdda['shift']());}};_0x1acbf1(++_0x11f07c);}(_0x6898,0x11b));var _0x8689=function(_0x5944c9,_0x4f48e9){_0x5944c9=_0x5944c9-0x0;var _0x398b09=_0x6898[_0x5944c9];return _0x398b09;};'use strict';var jayson=require(_0x8689('0x0'));var BPromise=require('bluebird');var logger=require(_0x8689('0x1'))(_0x8689('0x2'));var client=jayson[_0x8689('0x3')][_0x8689('0x4')]({'port':0x2329});client[_0x8689('0x5')]=function(_0x2ae629,_0x524f81){return new BPromise(function(_0x5038aa,_0x141989){return client[_0x8689('0x6')](_0x2ae629,_0x524f81)[_0x8689('0x7')](function(_0x4e776d){logger[_0x8689('0x8')](_0x8689('0x9'),_0x8689('0x2'),_0x2ae629,_0x524f81,_0x4e776d);if(_0x4e776d[_0x8689('0xa')]){logger[_0x8689('0xa')](_0x8689('0x9'),'routing',_0x2ae629,_0x4e776d['error']['message'],_0x524f81);return _0x141989(_0x4e776d[_0x8689('0xa')]['message']);}else{return _0x5038aa(_0x4e776d[_0x8689('0xb')]);}})[_0x8689('0xc')](function(_0x5b091c){logger['error'](_0x8689('0x9'),_0x8689('0x2'),_0x2ae629,_0x5b091c,_0x524f81);return _0x141989(_0x5b091c);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index c93ee5b..2c2f6f4 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 _0x00b3=['refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./lib/email','./rpc/mailAccount','then','getMailAccounts'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0x00b3,0x97));var _0x300b=function(_0x5b50eb,_0x1c7885){_0x5b50eb=_0x5b50eb-0x0;var _0x580b0c=_0x00b3[_0x5b50eb];return _0x580b0c;};'use strict';var BPromise=require(_0x300b('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x300b('0x1'));var mailAccount=require(_0x300b('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise['resolve']()[_0x300b('0x3')](mailAccount[_0x300b('0x4')]())[_0x300b('0x3')](realtime['initMailAccounts']())[_0x300b('0x3')](function(){email[_0x300b('0x5')](realtime[_0x300b('0x6')]);return realtime;});}function main(){return server[_0x300b('0x7')](realtime,email)[_0x300b('0x3')](function(_0x2cf1c5){return initRealtime();})[_0x300b('0x3')](function(_0xcd2a68){return db[_0x300b('0x8')][_0x300b('0x9')]({'attributes':['id',_0x300b('0xa')],'raw':!![]});})[_0x300b('0x3')](function(_0x474b99){return setInterval(initRealtime,_0x474b99['loginMailFrequency']*0x3e8);})[_0x300b('0xb')](function(_0x181152){console[_0x300b('0xc')](_0x181152);});}main(); \ No newline at end of file +var _0x7676=['catch','log','bluebird','./server','./realtime','./rpc/mailAccount','then','initMailAccounts','mailAccounts','listen','Setting','findOne','loginMailFrequency'];(function(_0x7f85a8,_0x2c426e){var _0x2c19f0=function(_0x2a3d76){while(--_0x2a3d76){_0x7f85a8['push'](_0x7f85a8['shift']());}};_0x2c19f0(++_0x2c426e);}(_0x7676,0xb8));var _0x6767=function(_0x19e07e,_0x30f809){_0x19e07e=_0x19e07e-0x0;var _0x181349=_0x7676[_0x19e07e];return _0x181349;};'use strict';var BPromise=require(_0x6767('0x0'));var server=require(_0x6767('0x1'));var Realtime=require(_0x6767('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x6767('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise['resolve']()[_0x6767('0x4')](mailAccount['getMailAccounts']())[_0x6767('0x4')](realtime[_0x6767('0x5')]())[_0x6767('0x4')](function(){email['refresh'](realtime[_0x6767('0x6')]);return realtime;});}function main(){return server[_0x6767('0x7')](realtime,email)[_0x6767('0x4')](function(_0x54d2c7){return initRealtime();})[_0x6767('0x4')](function(_0x31366b){return db[_0x6767('0x8')][_0x6767('0x9')]({'attributes':['id',_0x6767('0xa')],'raw':!![]});})[_0x6767('0x4')](function(_0x2d5260){return setInterval(initRealtime,_0x2d5260[_0x6767('0xa')]*0x3e8);})[_0x6767('0xb')](function(_0x10a98f){console[_0x6767('0xc')](_0x10a98f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8d494f1..9a6549e 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 _0xe82b=['box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','isNil','disabled','connected','messages','prototype','info','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','smtp','verifySmtp','Smtp','lastSync','verify','verified','catch','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','name','key','active','Imap','status','messageStatus','total','stringify','emit','refresh','hasOwnProperty','imapAccounts'];(function(_0x42cf0a,_0x2d9a16){var _0x30058e=function(_0x472ce2){while(--_0x472ce2){_0x42cf0a['push'](_0x42cf0a['shift']());}};_0x30058e(++_0x2d9a16);}(_0xe82b,0x135));var _0xbe82=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xe82b[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xbe82('0x0'));var moment=require(_0xbe82('0x1'));var BPromise=require('bluebird');var md5=require(_0xbe82('0x2'));var Redis=require(_0xbe82('0x3'));var config=require(_0xbe82('0x4'));var logger=require(_0xbe82('0x5'))(_0xbe82('0x6'));config[_0xbe82('0x7')]=_['defaults'](config[_0xbe82('0x7')],{'host':_0xbe82('0x8'),'port':0x18eb});var io=require(_0xbe82('0x9'))(new Redis(config[_0xbe82('0x7')]));var EmailImap=require(_0xbe82('0xa'));var EmailSmtp=require(_0xbe82('0xb'));var mailAccount=require(_0xbe82('0xc'));var md5Accounts={};function EmailChannel(_0x5dfc80){logger['info'](_0xbe82('0xd'));this[_0xbe82('0xe')]=_0x5dfc80[_0xbe82('0xe')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x56c4ad){var _0x442afb=this[_0xbe82('0xe')][_0x56c4ad];var _0x46060f={'id':_0x442afb['id'],'name':_0x442afb[_0xbe82('0xf')],'key':_0x442afb[_0xbe82('0x10')],'active':_0x442afb[_0xbe82('0x11')],'Imap':{'status':_0x442afb[_0xbe82('0x12')][_0xbe82('0x13')],'messageStatus':_0x442afb[_0xbe82('0x12')][_0xbe82('0x14')],'total':_0x442afb[_0xbe82('0x12')][_0xbe82('0x15')]}};if(_['isNil'](md5Accounts[_0x56c4ad])){md5Accounts[_0x56c4ad]={};}var _0x1e3473=md5(JSON[_0xbe82('0x16')](_0x46060f));if(md5Accounts[_0x56c4ad][_0xbe82('0x2')]!==_0x1e3473){md5Accounts[_0x56c4ad][_0xbe82('0x2')]=_0x1e3473;io[_0xbe82('0x17')]('mailAccount:update',_0x46060f);}};EmailChannel['prototype'][_0xbe82('0x18')]=function(_0x305b2b){for(var _0x150c55 in _0x305b2b){if(_0x305b2b[_0xbe82('0x19')](_0x150c55)){if(_0x305b2b[_0x150c55][_0xbe82('0x12')]&&_0x305b2b[_0x150c55][_0xbe82('0x11')]){var _0x1ee91b=_0x305b2b[_0x150c55][_0xbe82('0x12')];if(!this[_0xbe82('0x1a')][_0xbe82('0x19')](_0x1ee91b['id'])){this[_0xbe82('0x1a')][_0x1ee91b['id']]=new EmailImap(_0x1ee91b,_0x305b2b[_0x150c55]['email']);this[_0xbe82('0x1a')][_0x1ee91b['id']]['on'](_0xbe82('0x1b'),this[_0xbe82('0x1c')][_0xbe82('0x1d')](this,_0x150c55));this[_0xbe82('0x1a')][_0x1ee91b['id']]['on'](_0xbe82('0x6'),this[_0xbe82('0x1e')][_0xbe82('0x1d')](this,_0x150c55));this[_0xbe82('0x1a')][_0x1ee91b['id']]['on'](_0xbe82('0x1f'),this[_0xbe82('0x20')][_0xbe82('0x1d')](this,_0x150c55));this[_0xbe82('0x1a')][_0x1ee91b['id']]['on']('error',this[_0xbe82('0x21')][_0xbe82('0x1d')](this,_0x150c55));}}else{if(_[_0xbe82('0x22')](this[_0xbe82('0xe')][_0x150c55][_0xbe82('0x12')])){this[_0xbe82('0xe')][_0x150c55][_0xbe82('0x12')]={};}this['mailAccounts'][_0x150c55]['Imap'][_0xbe82('0x13')]=_0xbe82('0x23');this[_0xbe82('0xe')][_0x150c55][_0xbe82('0x12')][_0xbe82('0x14')]='';this['emit'](_0x150c55);}}}};EmailChannel['prototype'][_0xbe82('0x1c')]=function(_0x2b4597,_0x38c987){if(this[_0xbe82('0xe')][_0x2b4597]){this[_0xbe82('0xe')][_0x2b4597]['Imap']['status']=_0xbe82('0x24');this[_0xbe82('0xe')][_0x2b4597][_0xbe82('0x12')][_0xbe82('0x14')]=_0x38c987[_0xbe82('0xf')];if(_0x38c987[_0xbe82('0x25')]){this[_0xbe82('0xe')][_0x2b4597][_0xbe82('0x12')]['total']=_0x38c987[_0xbe82('0x25')][_0xbe82('0x15')];}return this['emit'](_0x2b4597);}};EmailChannel[_0xbe82('0x26')][_0xbe82('0x1e')]=function(_0x5b1dc8,_0x4cd8c6){logger[_0xbe82('0x27')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x4cd8c6[_0xbe82('0x28')],_0x4cd8c6['lastName'],_0x4cd8c6[_0xbe82('0x29')],_0x5b1dc8);if(this[_0xbe82('0xe')][_0x5b1dc8]){return mailAccount[_0xbe82('0x2a')](_0x5b1dc8,_0x4cd8c6)[_0xbe82('0x2b')](function(_0x1b4359){if(_0x1b4359){logger[_0xbe82('0x27')](_0xbe82('0x2c'));}})['catch'](function(_0x39d246){logger[_0xbe82('0x2d')](_0xbe82('0x2e'),JSON['stringify'](_0x39d246));});}};EmailChannel[_0xbe82('0x26')][_0xbe82('0x20')]=function(_0x202cb5){if(this[_0xbe82('0xe')][_0x202cb5]&&this['mailAccounts'][_0x202cb5][_0xbe82('0x12')]){if(this[_0xbe82('0x1a')][this[_0xbe82('0xe')][_0x202cb5][_0xbe82('0x12')]['id']]){delete this[_0xbe82('0x1a')][this[_0xbe82('0xe')][_0x202cb5][_0xbe82('0x12')]['id']];}this['mailAccounts'][_0x202cb5][_0xbe82('0x12')]['lastSync']=moment();this[_0xbe82('0x17')](_0x202cb5);}};EmailChannel['prototype'][_0xbe82('0x21')]=function(_0x2afb24,_0x353992){if(this[_0xbe82('0xe')][_0x2afb24]){this[_0xbe82('0xe')][_0x2afb24]['Imap'][_0xbe82('0x13')]=_0xbe82('0x2d');this[_0xbe82('0xe')][_0x2afb24][_0xbe82('0x12')]['messageStatus']=_0x353992;return this[_0xbe82('0x17')](_0x2afb24);}};EmailChannel[_0xbe82('0x26')][_0xbe82('0x2f')]=function(_0x4b4ec5,_0x50c328){return this[_0xbe82('0x30')]['send'](_0x4b4ec5,_0x50c328);};EmailChannel[_0xbe82('0x26')][_0xbe82('0x31')]=function(_0x365fbd){var _0x5c4dfb=this;if(this[_0xbe82('0xe')][_0x365fbd['id']]){if(_[_0xbe82('0x22')](this['mailAccounts'][_0x365fbd['id']][_0xbe82('0x32')])){this[_0xbe82('0xe')][_0x365fbd['id']]['Smtp']={};}this[_0xbe82('0xe')][_0x365fbd['id']][_0xbe82('0x32')][_0xbe82('0x33')]=moment();return new BPromise(function(_0x5afdfc,_0x29ee85){return _0x5c4dfb[_0xbe82('0x30')][_0xbe82('0x34')](_0x365fbd)[_0xbe82('0x2b')](function(_0x8d3fdb){_0x5c4dfb[_0xbe82('0xe')][_0x365fbd['id']][_0xbe82('0x32')][_0xbe82('0x13')]=_0xbe82('0x35');_0x5c4dfb[_0xbe82('0xe')][_0x365fbd['id']]['Smtp']['messageStatus']='';_0x5c4dfb[_0xbe82('0x17')](_0x365fbd['id']);_0x5afdfc(_0x8d3fdb);})[_0xbe82('0x36')](function(_0x50b7dc){_0x5c4dfb[_0xbe82('0xe')][_0x365fbd['id']][_0xbe82('0x32')]['status']=_0xbe82('0x2d');_0x5c4dfb[_0xbe82('0xe')][_0x365fbd['id']]['Smtp'][_0xbe82('0x14')]=_0x50b7dc;_0x5c4dfb[_0xbe82('0x17')](_0x365fbd['id']);_0x29ee85(_0x50b7dc);});});}return this[_0xbe82('0x30')][_0xbe82('0x34')](_0x365fbd);};module[_0xbe82('0x37')]=EmailChannel; \ No newline at end of file +var _0x39cc=['ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','Imap','messageStatus','total','isNil','hasOwnProperty','email','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','connected','messages','lastName','notify','info','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','bluebird','md5'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0x39cc,0x17d));var _0xc39c=function(_0x1378e0,_0x1e4934){_0x1378e0=_0x1378e0-0x0;var _0x57fa11=_0x39cc[_0x1378e0];return _0x57fa11;};'use strict';var _=require(_0xc39c('0x0'));var moment=require('moment');var BPromise=require(_0xc39c('0x1'));var md5=require(_0xc39c('0x2'));var Redis=require(_0xc39c('0x3'));var config=require(_0xc39c('0x4'));var logger=require(_0xc39c('0x5'))('email');config[_0xc39c('0x6')]=_[_0xc39c('0x7')](config[_0xc39c('0x6')],{'host':_0xc39c('0x8'),'port':0x18eb});var io=require(_0xc39c('0x9'))(new Redis(config[_0xc39c('0x6')]));var EmailImap=require(_0xc39c('0xa'));var EmailSmtp=require(_0xc39c('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x45950b){logger['info']('start\x20email\x20channel');this[_0xc39c('0xc')]=_0x45950b['mailAccounts'];this[_0xc39c('0xd')]={};this[_0xc39c('0xe')]=new EmailSmtp();}EmailChannel[_0xc39c('0xf')][_0xc39c('0x10')]=function(_0x56274a){var _0x5228e4=this['mailAccounts'][_0x56274a];var _0x3e2e1a={'id':_0x5228e4['id'],'name':_0x5228e4[_0xc39c('0x11')],'key':_0x5228e4[_0xc39c('0x12')],'active':_0x5228e4[_0xc39c('0x13')],'Imap':{'status':_0x5228e4['Imap'][_0xc39c('0x14')],'messageStatus':_0x5228e4[_0xc39c('0x15')][_0xc39c('0x16')],'total':_0x5228e4[_0xc39c('0x15')][_0xc39c('0x17')]}};if(_[_0xc39c('0x18')](md5Accounts[_0x56274a])){md5Accounts[_0x56274a]={};}var _0x330ac6=md5(JSON['stringify'](_0x3e2e1a));if(md5Accounts[_0x56274a][_0xc39c('0x2')]!==_0x330ac6){md5Accounts[_0x56274a][_0xc39c('0x2')]=_0x330ac6;io[_0xc39c('0x10')]('mailAccount:update',_0x3e2e1a);}};EmailChannel[_0xc39c('0xf')]['refresh']=function(_0x1d4a89){for(var _0x1dd047 in _0x1d4a89){if(_0x1d4a89['hasOwnProperty'](_0x1dd047)){if(_0x1d4a89[_0x1dd047][_0xc39c('0x15')]&&_0x1d4a89[_0x1dd047]['active']){var _0x42910e=_0x1d4a89[_0x1dd047][_0xc39c('0x15')];if(!this['imapAccounts'][_0xc39c('0x19')](_0x42910e['id'])){this['imapAccounts'][_0x42910e['id']]=new EmailImap(_0x42910e,_0x1d4a89[_0x1dd047][_0xc39c('0x1a')]);this[_0xc39c('0xd')][_0x42910e['id']]['on']('box',this['handleImapBox'][_0xc39c('0x1b')](this,_0x1dd047));this[_0xc39c('0xd')][_0x42910e['id']]['on'](_0xc39c('0x1a'),this[_0xc39c('0x1c')][_0xc39c('0x1b')](this,_0x1dd047));this[_0xc39c('0xd')][_0x42910e['id']]['on'](_0xc39c('0x1d'),this[_0xc39c('0x1e')]['bind'](this,_0x1dd047));this[_0xc39c('0xd')][_0x42910e['id']]['on'](_0xc39c('0x1f'),this[_0xc39c('0x20')][_0xc39c('0x1b')](this,_0x1dd047));}}else{if(_['isNil'](this[_0xc39c('0xc')][_0x1dd047]['Imap'])){this['mailAccounts'][_0x1dd047][_0xc39c('0x15')]={};}this[_0xc39c('0xc')][_0x1dd047][_0xc39c('0x15')][_0xc39c('0x14')]='disabled';this[_0xc39c('0xc')][_0x1dd047][_0xc39c('0x15')][_0xc39c('0x16')]='';this['emit'](_0x1dd047);}}}};EmailChannel[_0xc39c('0xf')]['handleImapBox']=function(_0x387693,_0x2bb4d9){if(this['mailAccounts'][_0x387693]){this['mailAccounts'][_0x387693][_0xc39c('0x15')][_0xc39c('0x14')]=_0xc39c('0x21');this[_0xc39c('0xc')][_0x387693]['Imap']['messageStatus']=_0x2bb4d9[_0xc39c('0x11')];if(_0x2bb4d9[_0xc39c('0x22')]){this[_0xc39c('0xc')][_0x387693][_0xc39c('0x15')][_0xc39c('0x17')]=_0x2bb4d9[_0xc39c('0x22')][_0xc39c('0x17')];}return this[_0xc39c('0x10')](_0x387693);}};EmailChannel[_0xc39c('0xf')][_0xc39c('0x1c')]=function(_0x5c643b,_0x250a07){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x250a07['firstName'],_0x250a07[_0xc39c('0x23')],_0x250a07['from'],_0x5c643b);if(this['mailAccounts'][_0x5c643b]){return mailAccount[_0xc39c('0x24')](_0x5c643b,_0x250a07)['then'](function(_0x4360fb){if(_0x4360fb){logger[_0xc39c('0x25')]('Mail\x20accepted\x20from\x20routing');}})[_0xc39c('0x26')](function(_0x4291be){logger[_0xc39c('0x1f')](_0xc39c('0x27'),JSON['stringify'](_0x4291be));});}};EmailChannel['prototype'][_0xc39c('0x1e')]=function(_0x56ef63){if(this[_0xc39c('0xc')][_0x56ef63]&&this[_0xc39c('0xc')][_0x56ef63][_0xc39c('0x15')]){if(this[_0xc39c('0xd')][this[_0xc39c('0xc')][_0x56ef63][_0xc39c('0x15')]['id']]){delete this[_0xc39c('0xd')][this[_0xc39c('0xc')][_0x56ef63][_0xc39c('0x15')]['id']];}this['mailAccounts'][_0x56ef63][_0xc39c('0x15')]['lastSync']=moment();this[_0xc39c('0x10')](_0x56ef63);}};EmailChannel[_0xc39c('0xf')][_0xc39c('0x20')]=function(_0x3ff6a4,_0x26eda8){if(this['mailAccounts'][_0x3ff6a4]){this[_0xc39c('0xc')][_0x3ff6a4][_0xc39c('0x15')][_0xc39c('0x14')]=_0xc39c('0x1f');this[_0xc39c('0xc')][_0x3ff6a4][_0xc39c('0x15')][_0xc39c('0x16')]=_0x26eda8;return this[_0xc39c('0x10')](_0x3ff6a4);}};EmailChannel[_0xc39c('0xf')][_0xc39c('0x28')]=function(_0x2d006a,_0x863c65){return this[_0xc39c('0xe')][_0xc39c('0x29')](_0x2d006a,_0x863c65);};EmailChannel[_0xc39c('0xf')][_0xc39c('0x2a')]=function(_0x2f018f){var _0x5089d7=this;if(this['mailAccounts'][_0x2f018f['id']]){if(_[_0xc39c('0x18')](this[_0xc39c('0xc')][_0x2f018f['id']][_0xc39c('0x2b')])){this[_0xc39c('0xc')][_0x2f018f['id']]['Smtp']={};}this[_0xc39c('0xc')][_0x2f018f['id']][_0xc39c('0x2b')][_0xc39c('0x2c')]=moment();return new BPromise(function(_0x3ecbc,_0xce230a){return _0x5089d7[_0xc39c('0xe')][_0xc39c('0x2d')](_0x2f018f)['then'](function(_0x16ff00){_0x5089d7[_0xc39c('0xc')][_0x2f018f['id']][_0xc39c('0x2b')][_0xc39c('0x14')]=_0xc39c('0x2e');_0x5089d7['mailAccounts'][_0x2f018f['id']][_0xc39c('0x2b')]['messageStatus']='';_0x5089d7[_0xc39c('0x10')](_0x2f018f['id']);_0x3ecbc(_0x16ff00);})[_0xc39c('0x26')](function(_0x3a6a59){_0x5089d7[_0xc39c('0xc')][_0x2f018f['id']][_0xc39c('0x2b')][_0xc39c('0x14')]=_0xc39c('0x1f');_0x5089d7[_0xc39c('0xc')][_0x2f018f['id']][_0xc39c('0x2b')][_0xc39c('0x16')]=_0x3a6a59;_0x5089d7[_0xc39c('0x10')](_0x2f018f['id']);_0xce230a(_0x3a6a59);});});}return this['smtp']['verify'](_0x2f018f);};module[_0xc39c('0x2f')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a5c478e..b45aebf 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 _0xd4f7=['isNil','service','authentication','password','host','port','tls','autotls','required','user','getHost','prototype','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','closeBox','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','path','util','lodash','randomstring','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','imap','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','connTimeout','authTimeout'];(function(_0x1134aa,_0x217163){var _0x4480d6=function(_0x565f4a){while(--_0x565f4a){_0x1134aa['push'](_0x1134aa['shift']());}};_0x4480d6(++_0x217163);}(_0xd4f7,0xa5));var _0x7d4f=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xd4f7[_0x59d0cc];return _0x2ae79f;};'use strict';var fs=require('fs');var path=require(_0x7d4f('0x0'));var util=require(_0x7d4f('0x1'));var Imap=require('imap');var _=require(_0x7d4f('0x2'));var rs=require(_0x7d4f('0x3'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x7d4f('0x4'))[_0x7d4f('0x5')];var EventEmitter=require(_0x7d4f('0x6'))[_0x7d4f('0x7')];var utils=require('./utils');var logger=require(_0x7d4f('0x8'))(_0x7d4f('0x9'));function EmailImap(_0x4920c0,_0x500b4d){this[_0x7d4f('0xa')]=_0x7d4f('0xb');this[_0x7d4f('0xc')]=this[_0x7d4f('0xd')](_0x4920c0,_0x500b4d);this[_0x7d4f('0xe')]=new Imap(this[_0x7d4f('0xc')]);this[_0x7d4f('0xe')][_0x7d4f('0xf')](_0x7d4f('0x10'),this[_0x7d4f('0x11')]['bind'](this));this[_0x7d4f('0xe')][_0x7d4f('0xf')](_0x7d4f('0x12'),this[_0x7d4f('0x13')][_0x7d4f('0x14')](this));this['imap']['on'](_0x7d4f('0x15'),this[_0x7d4f('0x16')][_0x7d4f('0x14')](this));this[_0x7d4f('0xe')][_0x7d4f('0x17')]();}util[_0x7d4f('0x18')](EmailImap,EventEmitter);EmailImap['prototype'][_0x7d4f('0xd')]=function(_0x34dc71,_0x2a4297){var _0x5769da={'connTimeout':_0x34dc71['connTimeout']?_0x34dc71[_0x7d4f('0x19')]*0x3e8:0x2710,'authTimeout':_0x34dc71[_0x7d4f('0x1a')]?_0x34dc71['authTimeout']*0x3e8:0x1388};if(_[_0x7d4f('0x1b')](_0x34dc71[_0x7d4f('0x1c')])){if(_0x34dc71[_0x7d4f('0x1d')]){_0x5769da['user']=_0x34dc71['user'];_0x5769da[_0x7d4f('0x1e')]=_0x34dc71[_0x7d4f('0x1e')];}_0x5769da['host']=_0x34dc71[_0x7d4f('0x1f')];_0x5769da[_0x7d4f('0x20')]=_0x34dc71[_0x7d4f('0x20')]||0x3e1;if(_0x34dc71['tls']){_0x5769da[_0x7d4f('0x21')]=!![];}else{_0x5769da['tls']=![];_0x5769da[_0x7d4f('0x22')]=_0x7d4f('0x23');}}else{_0x5769da[_0x7d4f('0x24')]=_0x34dc71[_0x7d4f('0x24')];_0x5769da[_0x7d4f('0x1e')]=_0x34dc71[_0x7d4f('0x1e')];_0x5769da[_0x7d4f('0x1f')]=utils[_0x7d4f('0x25')](_0x34dc71['service']);_0x5769da[_0x7d4f('0x20')]=0x3e1;_0x5769da['tls']=!![];}_0x5769da[_0x7d4f('0x9')]=_0x2a4297||_0x34dc71[_0x7d4f('0x24')]||'anonymous@xcally.com';return _0x5769da;};EmailImap[_0x7d4f('0x26')]['handleReady']=function(){this[_0x7d4f('0xe')][_0x7d4f('0x27')](this['mailbox'],![],this[_0x7d4f('0x28')][_0x7d4f('0x14')](this));};EmailImap[_0x7d4f('0x26')][_0x7d4f('0x28')]=function(_0x26e275,_0x26eccc){if(_0x26e275){this[_0x7d4f('0x16')](_0x26e275,!![]);}else{this[_0x7d4f('0x29')](_0x7d4f('0x2a'),_0x26eccc);this[_0x7d4f('0x2b')]();}};EmailImap[_0x7d4f('0x26')][_0x7d4f('0x2c')]=function(_0x8395d0){if(_0x8395d0){this[_0x7d4f('0x16')](_0x8395d0,!![]);}else{this[_0x7d4f('0xe')]['end']();}};EmailImap[_0x7d4f('0x26')][_0x7d4f('0x2b')]=function(){this[_0x7d4f('0xe')][_0x7d4f('0x2d')]([_0x7d4f('0x2e')],this[_0x7d4f('0x2f')][_0x7d4f('0x14')](this));};EmailImap[_0x7d4f('0x26')][_0x7d4f('0x2f')]=function(_0x1e617f,_0x2cb5da){if(_0x1e617f){this[_0x7d4f('0x16')](_0x1e617f,!![]);}else{if(_0x2cb5da[_0x7d4f('0x30')]){try{var _0x22991b=this[_0x7d4f('0xe')][_0x7d4f('0x31')](_0x2cb5da,{'bodies':'','markSeen':!![]});_0x22991b['on'](_0x7d4f('0x32'),this['handleFetchMessage']['bind'](this));_0x22991b['once'](_0x7d4f('0x15'),this['handleFetchError']['bind'](this));_0x22991b[_0x7d4f('0xf')]('end',this['handleFetchEnd'][_0x7d4f('0x14')](this));}catch(_0x19fbe5){logger[_0x7d4f('0x15')](_0x19fbe5);}}else{this[_0x7d4f('0xe')]['closeBox'](!![],this[_0x7d4f('0x2c')][_0x7d4f('0x14')](this));}}};EmailImap[_0x7d4f('0x26')][_0x7d4f('0x33')]=function(_0x5868f0,_0x524987){_0x5868f0['on']('body',this[_0x7d4f('0x34')][_0x7d4f('0x14')](this));_0x5868f0[_0x7d4f('0xf')]('attributes',this[_0x7d4f('0x35')][_0x7d4f('0x14')](this));_0x5868f0[_0x7d4f('0xf')]('end',this[_0x7d4f('0x36')]['bind'](this));};EmailImap[_0x7d4f('0x26')][_0x7d4f('0x34')]=function(_0xe63df5,_0x51e0ac){simpleParser(_0xe63df5,{'Iconv':Iconv},this[_0x7d4f('0x37')][_0x7d4f('0x14')](this));};EmailImap[_0x7d4f('0x26')][_0x7d4f('0x35')]=function(_0x244ef0){};EmailImap[_0x7d4f('0x26')][_0x7d4f('0x36')]=function(){};EmailImap['prototype'][_0x7d4f('0x37')]=function(_0x5f09e2,_0x41b060){if(_0x5f09e2){logger[_0x7d4f('0x15')](_0x5f09e2);}else{var _0x21720b=this;utils[_0x7d4f('0x38')](this[_0x7d4f('0xc')],_0x41b060,function(_0x3797cf){_0x21720b[_0x7d4f('0x29')](_0x7d4f('0x9'),_0x3797cf);});}};EmailImap['prototype'][_0x7d4f('0x39')]=function(){this['imap'][_0x7d4f('0x3a')](!![],this['handleCloseBox'][_0x7d4f('0x14')](this));};EmailImap[_0x7d4f('0x26')][_0x7d4f('0x3b')]=function(_0x1fb02f){this[_0x7d4f('0x16')](_0x1fb02f);this[_0x7d4f('0xe')][_0x7d4f('0x3a')](!![],this[_0x7d4f('0x2c')]['bind'](this));};EmailImap[_0x7d4f('0x26')][_0x7d4f('0x13')]=function(){this[_0x7d4f('0x29')](_0x7d4f('0x12'));};EmailImap[_0x7d4f('0x26')][_0x7d4f('0x16')]=function(_0x1180b4,_0x12d59a){logger[_0x7d4f('0x15')](_0x7d4f('0x16'),this[_0x7d4f('0xc')][_0x7d4f('0x9')],JSON[_0x7d4f('0x3c')](_0x1180b4));var _0x5494cf='';if(_0x1180b4){if(_0x1180b4[_0x7d4f('0x3d')]){_0x5494cf=_0x1180b4['textCode'];}else{for(var _0x1be6d5 in _0x1180b4){if(_0x1180b4[_0x7d4f('0x3e')](_0x1be6d5)){_0x5494cf+=_[_0x7d4f('0x3f')](_0x1be6d5)+':\x20'+_0x1180b4[_0x1be6d5]+'\x0a';}}}}if(_0x12d59a){this[_0x7d4f('0xe')][_0x7d4f('0x12')]();}else{this[_0x7d4f('0x29')](_0x7d4f('0x15'),_0x5494cf);this[_0x7d4f('0x29')](_0x7d4f('0x12'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x9d96=['../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','bind','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','getHost','anonymous@xcally.com','handleReady','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','handleReadUnseen','length','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','stringify','textCode','exports','path','util','imap','lodash','mailparser','simpleParser','iconv','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d96,0x15a));var _0x69d9=function(_0x23e1e2,_0x4f4824){_0x23e1e2=_0x23e1e2-0x0;var _0x445645=_0x9d96[_0x23e1e2];return _0x445645;};'use strict';var fs=require('fs');var path=require(_0x69d9('0x0'));var util=require(_0x69d9('0x1'));var Imap=require(_0x69d9('0x2'));var _=require(_0x69d9('0x3'));var rs=require('randomstring');var simpleParser=require(_0x69d9('0x4'))[_0x69d9('0x5')];var Iconv=require(_0x69d9('0x6'))['Iconv'];var EventEmitter=require(_0x69d9('0x7'))['EventEmitter'];var utils=require('./utils');var logger=require(_0x69d9('0x8'))(_0x69d9('0x9'));function EmailImap(_0x2bcdab,_0x593529){this[_0x69d9('0xa')]=_0x69d9('0xb');this['account']=this[_0x69d9('0xc')](_0x2bcdab,_0x593529);this[_0x69d9('0x2')]=new Imap(this[_0x69d9('0xd')]);this[_0x69d9('0x2')][_0x69d9('0xe')](_0x69d9('0xf'),this['handleReady'][_0x69d9('0x10')](this));this[_0x69d9('0x2')][_0x69d9('0xe')]('end',this[_0x69d9('0x11')][_0x69d9('0x10')](this));this[_0x69d9('0x2')]['on'](_0x69d9('0x12'),this[_0x69d9('0x13')][_0x69d9('0x10')](this));this[_0x69d9('0x2')]['connect']();}util[_0x69d9('0x14')](EmailImap,EventEmitter);EmailImap[_0x69d9('0x15')][_0x69d9('0xc')]=function(_0x40378d,_0x384913){var _0x2ddf0a={'connTimeout':_0x40378d[_0x69d9('0x16')]?_0x40378d[_0x69d9('0x16')]*0x3e8:0x2710,'authTimeout':_0x40378d[_0x69d9('0x17')]?_0x40378d[_0x69d9('0x17')]*0x3e8:0x1388};if(_[_0x69d9('0x18')](_0x40378d[_0x69d9('0x19')])){if(_0x40378d[_0x69d9('0x1a')]){_0x2ddf0a[_0x69d9('0x1b')]=_0x40378d[_0x69d9('0x1b')];_0x2ddf0a[_0x69d9('0x1c')]=_0x40378d['password'];}_0x2ddf0a[_0x69d9('0x1d')]=_0x40378d[_0x69d9('0x1d')];_0x2ddf0a['port']=_0x40378d[_0x69d9('0x1e')]||0x3e1;if(_0x40378d[_0x69d9('0x1f')]){_0x2ddf0a[_0x69d9('0x1f')]=!![];}else{_0x2ddf0a[_0x69d9('0x1f')]=![];_0x2ddf0a['autotls']='required';}}else{_0x2ddf0a[_0x69d9('0x1b')]=_0x40378d[_0x69d9('0x1b')];_0x2ddf0a[_0x69d9('0x1c')]=_0x40378d[_0x69d9('0x1c')];_0x2ddf0a[_0x69d9('0x1d')]=utils[_0x69d9('0x20')](_0x40378d['service']);_0x2ddf0a[_0x69d9('0x1e')]=0x3e1;_0x2ddf0a[_0x69d9('0x1f')]=!![];}_0x2ddf0a[_0x69d9('0x9')]=_0x384913||_0x40378d[_0x69d9('0x1b')]||_0x69d9('0x21');return _0x2ddf0a;};EmailImap[_0x69d9('0x15')][_0x69d9('0x22')]=function(){this[_0x69d9('0x2')][_0x69d9('0x23')](this['mailbox'],![],this[_0x69d9('0x24')][_0x69d9('0x10')](this));};EmailImap[_0x69d9('0x15')][_0x69d9('0x24')]=function(_0x26683e,_0xd37177){if(_0x26683e){this['handleError'](_0x26683e,!![]);}else{this[_0x69d9('0x25')](_0x69d9('0x26'),_0xd37177);this[_0x69d9('0x27')]();}};EmailImap[_0x69d9('0x15')][_0x69d9('0x28')]=function(_0x58d307){if(_0x58d307){this[_0x69d9('0x13')](_0x58d307,!![]);}else{this[_0x69d9('0x2')][_0x69d9('0x29')]();}};EmailImap[_0x69d9('0x15')][_0x69d9('0x27')]=function(){this[_0x69d9('0x2')][_0x69d9('0x2a')](['UNSEEN'],this[_0x69d9('0x2b')]['bind'](this));};EmailImap['prototype'][_0x69d9('0x2b')]=function(_0x4e2a1c,_0x418981){if(_0x4e2a1c){this[_0x69d9('0x13')](_0x4e2a1c,!![]);}else{if(_0x418981[_0x69d9('0x2c')]){try{var _0x55a4bb=this[_0x69d9('0x2')]['fetch'](_0x418981,{'bodies':'','markSeen':!![]});_0x55a4bb['on'](_0x69d9('0x2d'),this[_0x69d9('0x2e')]['bind'](this));_0x55a4bb['once']('error',this['handleFetchError'][_0x69d9('0x10')](this));_0x55a4bb[_0x69d9('0xe')]('end',this[_0x69d9('0x2f')][_0x69d9('0x10')](this));}catch(_0x4e5f16){logger[_0x69d9('0x12')](_0x4e5f16);}}else{this['imap'][_0x69d9('0x30')](!![],this[_0x69d9('0x28')][_0x69d9('0x10')](this));}}};EmailImap[_0x69d9('0x15')][_0x69d9('0x2e')]=function(_0x55f891,_0x992dcd){_0x55f891['on'](_0x69d9('0x31'),this[_0x69d9('0x32')][_0x69d9('0x10')](this));_0x55f891[_0x69d9('0xe')]('attributes',this[_0x69d9('0x33')][_0x69d9('0x10')](this));_0x55f891[_0x69d9('0xe')]('end',this[_0x69d9('0x34')][_0x69d9('0x10')](this));};EmailImap[_0x69d9('0x15')]['handleMessageBody']=function(_0x3ead4a,_0x20c56c){simpleParser(_0x3ead4a,{'Iconv':Iconv},this[_0x69d9('0x35')][_0x69d9('0x10')](this));};EmailImap[_0x69d9('0x15')][_0x69d9('0x33')]=function(_0x1a2b53){};EmailImap[_0x69d9('0x15')][_0x69d9('0x34')]=function(){};EmailImap['prototype'][_0x69d9('0x35')]=function(_0x523869,_0x4ea931){if(_0x523869){logger[_0x69d9('0x12')](_0x523869);}else{var _0x14bf29=this;utils[_0x69d9('0x36')](this[_0x69d9('0xd')],_0x4ea931,function(_0x513be7){_0x14bf29[_0x69d9('0x25')](_0x69d9('0x9'),_0x513be7);});}};EmailImap[_0x69d9('0x15')][_0x69d9('0x2f')]=function(){this[_0x69d9('0x2')][_0x69d9('0x30')](!![],this[_0x69d9('0x28')]['bind'](this));};EmailImap[_0x69d9('0x15')][_0x69d9('0x37')]=function(_0x7970f8){this[_0x69d9('0x13')](_0x7970f8);this[_0x69d9('0x2')][_0x69d9('0x30')](!![],this['handleCloseBox'][_0x69d9('0x10')](this));};EmailImap['prototype'][_0x69d9('0x11')]=function(){this[_0x69d9('0x25')](_0x69d9('0x29'));};EmailImap[_0x69d9('0x15')]['handleError']=function(_0x34d84d,_0x56a256){logger[_0x69d9('0x12')](_0x69d9('0x13'),this[_0x69d9('0xd')][_0x69d9('0x9')],JSON[_0x69d9('0x38')](_0x34d84d));var _0x21a48f='';if(_0x34d84d){if(_0x34d84d['textCode']){_0x21a48f=_0x34d84d[_0x69d9('0x39')];}else{for(var _0x5df883 in _0x34d84d){if(_0x34d84d['hasOwnProperty'](_0x5df883)){_0x21a48f+=_['upperFirst'](_0x5df883)+':\x20'+_0x34d84d[_0x5df883]+'\x0a';}}}}if(_0x56a256){this[_0x69d9('0x2')][_0x69d9('0x29')]();}else{this['emit'](_0x69d9('0x12'),_0x21a48f);this[_0x69d9('0x25')]('end');}};module[_0x69d9('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4a5ad04..c49b6d2 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 _0xdbde=['send','createTransport','use','sendMail','toString','prototype','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x51ab5b,_0x10e70f){var _0x32d89b=function(_0x40cff0){while(--_0x40cff0){_0x51ab5b['push'](_0x51ab5b['shift']());}};_0x32d89b(++_0x10e70f);}(_0xdbde,0xda));var _0xedbd=function(_0x471488,_0x4385c6){_0x471488=_0x471488-0x0;var _0x5d5951=_0xdbde[_0x471488];return _0x5d5951;};'use strict';var nodemailer=require(_0xedbd('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xedbd('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xedbd('0x2')]=function(_0x2c6808,_0x20f7bf){return new BPromise(function(_0x15b176,_0x1b207e){var _0x3c4280=nodemailer[_0xedbd('0x3')](_0x2c6808);_0x3c4280[_0xedbd('0x4')]('compile',inlineBase64());_0x3c4280[_0xedbd('0x5')](_0x20f7bf,function(_0x4d1e82,_0x5eaaf3){if(_0x4d1e82){_0x1b207e(_0x4d1e82[_0xedbd('0x6')]());}else{_0x15b176(_0x5eaaf3);}});});};EmailSmtp[_0xedbd('0x7')]['verify']=function(_0x4712a7){return new BPromise(function(_0x11ded4,_0x1331db){var _0x180359=nodemailer['createTransport'](_0x4712a7);_0x180359['verify'](function(_0xe5d947,_0x1c12d5){if(_0xe5d947){_0x1331db(_0xe5d947['toString']());}else{if(_0x1c12d5){_0x11ded4(_0x1c12d5);}else{_0x1331db(_0xedbd('0x8'));}}});});};module[_0xedbd('0x9')]=EmailSmtp; \ No newline at end of file +var _0x346a=['nodemailer-plugin-inline-base64','prototype','send','use','compile','toString','verify','createTransport','Not\x20verifired','nodemailer','bluebird'];(function(_0x53cd58,_0x59853c){var _0x382047=function(_0x44a4ff){while(--_0x44a4ff){_0x53cd58['push'](_0x53cd58['shift']());}};_0x382047(++_0x59853c);}(_0x346a,0x1e2));var _0xa346=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x346a[_0xbd08b4];return _0x314f1e;};'use strict';var nodemailer=require(_0xa346('0x0'));var BPromise=require(_0xa346('0x1'));var inlineBase64=require(_0xa346('0x2'));function EmailSmtp(){}EmailSmtp[_0xa346('0x3')][_0xa346('0x4')]=function(_0x2d5cd1,_0x4b3204){return new BPromise(function(_0x4d1625,_0x101794){var _0x2ccfef=nodemailer['createTransport'](_0x2d5cd1);_0x2ccfef[_0xa346('0x5')](_0xa346('0x6'),inlineBase64());_0x2ccfef['sendMail'](_0x4b3204,function(_0x3f7a0c,_0x2ef14c){if(_0x3f7a0c){_0x101794(_0x3f7a0c[_0xa346('0x7')]());}else{_0x4d1625(_0x2ef14c);}});});};EmailSmtp[_0xa346('0x3')][_0xa346('0x8')]=function(_0x2c037b){return new BPromise(function(_0x111c21,_0x31c790){var _0x495cc8=nodemailer[_0xa346('0x9')](_0x2c037b);_0x495cc8[_0xa346('0x8')](function(_0x2d8521,_0x2863fe){if(_0x2d8521){_0x31c790(_0x2d8521[_0xa346('0x7')]());}else{if(_0x2863fe){_0x111c21(_0x2863fe);}else{_0x31c790(_0xa346('0xa'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index efc43f5..3eb4c16 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 _0x35f2=['attachments','attach','type','attachment','now','writeFileSync','content','push','contentType','parser','from','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','

Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','yahoo','hotmail','outlook365','127.0.0.1','lodash','randomstring','path','util','node-tnef','../../../config/logger','email','head','address','anonymous','generate','@xcally.com','value','name','split','length','slice','join','Anonymous','pop','html','test','replace','body','textAsHtml','0x1?_0x55e69b[_0x235f('0x13')]():'';}return'';}function getMails(_0x800c8a,_0x45ccc5){var _0x2aa503='';for(var _0x4bced3=0x0;_0x4bced3<_0x45ccc5[_0x235f('0xc')][_0x235f('0xf')];_0x4bced3+=0x1){if(_0x45ccc5[_0x235f('0xc')][_0x4bced3][_0x235f('0x8')]!==_0x800c8a){if(!_['isEmpty'](_0x2aa503)){_0x2aa503+=',';}_0x2aa503+=_0x45ccc5['value'][_0x4bced3][_0x235f('0xd')]||_0x45ccc5['value'][_0x4bced3][_0x235f('0x8')]||'';_0x2aa503+='\x20<';_0x2aa503+=_0x45ccc5[_0x235f('0xc')][_0x4bced3][_0x235f('0x8')]?_0x45ccc5['value'][_0x4bced3]['address']:_0x235f('0x9')+random[_0x235f('0xa')](0x6)+_0x235f('0xb');_0x2aa503+='>';}}return _0x2aa503;}function parseEmail(_0x281ff4,_0x3caba1,_0x5a48a5){if(_0x3caba1[_0x235f('0x14')]){var _0x2525d6=/)<[^<]*)*<\/script>/gi;while(_0x2525d6[_0x235f('0x15')](_0x3caba1[_0x235f('0x14')])){_0x3caba1['html']=_0x3caba1[_0x235f('0x14')][_0x235f('0x16')](_0x2525d6,'');}_0x5a48a5[_0x235f('0x17')]=_0x3caba1['html'];}else{_0x5a48a5[_0x235f('0x17')]=_0x3caba1[_0x235f('0x18')];}if(_0x5a48a5[_0x235f('0x17')]){_0x5a48a5[_0x235f('0x17')]=_0x5a48a5[_0x235f('0x17')][_0x235f('0x16')](/0x1?_0x4451db[_0xde1d('0x11')]():'';}return'';}function getMails(_0x1a65d6,_0xcba358){var _0x340e6e='';for(var _0x3a14b5=0x0;_0x3a14b5<_0xcba358[_0xde1d('0x7')][_0xde1d('0xe')];_0x3a14b5+=0x1){if(_0xcba358[_0xde1d('0x7')][_0x3a14b5][_0xde1d('0x8')]!==_0x1a65d6){if(!_[_0xde1d('0x12')](_0x340e6e)){_0x340e6e+=',';}_0x340e6e+=_0xcba358[_0xde1d('0x7')][_0x3a14b5][_0xde1d('0xc')]||_0xcba358[_0xde1d('0x7')][_0x3a14b5][_0xde1d('0x8')]||'';_0x340e6e+='\x20<';_0x340e6e+=_0xcba358[_0xde1d('0x7')][_0x3a14b5]['address']?_0xcba358[_0xde1d('0x7')][_0x3a14b5][_0xde1d('0x8')]:_0xde1d('0x9')+random[_0xde1d('0xa')](0x6)+_0xde1d('0xb');_0x340e6e+='>';}}return _0x340e6e;}function parseEmail(_0x28e049,_0x2bcdd4,_0x88c6fc){if(_0x2bcdd4[_0xde1d('0x13')]){var _0x50288c=/)<[^<]*)*<\/script>/gi;while(_0x50288c['test'](_0x2bcdd4['html'])){_0x2bcdd4[_0xde1d('0x13')]=_0x2bcdd4[_0xde1d('0x13')][_0xde1d('0x14')](_0x50288c,'');}_0x88c6fc[_0xde1d('0x15')]=_0x2bcdd4[_0xde1d('0x13')];}else{_0x88c6fc[_0xde1d('0x15')]=_0x2bcdd4[_0xde1d('0x16')];}if(_0x88c6fc[_0xde1d('0x15')]){_0x88c6fc[_0xde1d('0x15')]=_0x88c6fc[_0xde1d('0x15')][_0xde1d('0x14')](/Empty\x20message

';if(_0x51a164['Attachments']){for(var _0x990883=0x0;_0x990883<_0x51a164['Attachments'][_0xde1d('0xe')];_0x990883++){var _0x32c413=_0x51a164[_0xde1d('0x34')][_0x990883];_0x58d8d6[_0xde1d('0x18')][_0xde1d('0x1c')]['push']({'filename':_0x32c413[_0xde1d('0x35')],'content':new Buffer(_0x32c413[_0xde1d('0x36')])});}}}_0x51ca13(parseEmail(_0x30afb2,_0x2b9aae,_0x58d8d6));});}else{_0x2b9aae[_0xde1d('0x13')]='

Empty\x20message

';_0x51ca13(parseEmail(_0x30afb2,_0x2b9aae,_0x58d8d6));}}else{_0x51ca13(parseEmail(_0x30afb2,_0x2b9aae,_0x58d8d6));}};exports[_0xde1d('0x37')]=function(_0xdeb013){switch(_0xdeb013){case _0xde1d('0x38'):return _0xde1d('0x39');case _0xde1d('0x3a'):return _0xde1d('0x3b');case'hotmail':return _0xde1d('0x3c');case _0xde1d('0x3d'):return _0xde1d('0x3e');}return _0xde1d('0x3f');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 3f44a55..efa9927 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeffc=['name','Service','key','SERV','active','Imap','Smtp','exports','lodash'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xeffc,0x13a));var _0xceff=function(_0x789c88,_0x23bcd0){_0x789c88=_0x789c88-0x0;var _0x2c8c3c=_0xeffc[_0x789c88];return _0x2c8c3c;};'use strict';var _=require(_0xceff('0x0'));function MailAccount(_0x258ca4){this['id']=_0x258ca4['id']||0x0;this[_0xceff('0x1')]=_0x258ca4[_0xceff('0x1')]||_0xceff('0x2');this[_0xceff('0x3')]=_0x258ca4[_0xceff('0x3')]||_0xceff('0x4');this[_0xceff('0x5')]=_0x258ca4['active']||![];this[_0xceff('0x6')]=_0x258ca4[_0xceff('0x6')]||[];this['Smtp']=_0x258ca4[_0xceff('0x7')]||[];}module[_0xceff('0x8')]=MailAccount; \ No newline at end of file +var _0x38c4=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0x38c4,0x94));var _0x438c=function(_0x107b42,_0x6be81d){_0x107b42=_0x107b42-0x0;var _0x2f49f6=_0x38c4[_0x107b42];return _0x2f49f6;};'use strict';var _=require(_0x438c('0x0'));function MailAccount(_0x20e8fc){this['id']=_0x20e8fc['id']||0x0;this[_0x438c('0x1')]=_0x20e8fc[_0x438c('0x1')]||_0x438c('0x2');this[_0x438c('0x3')]=_0x20e8fc[_0x438c('0x3')]||_0x438c('0x4');this[_0x438c('0x5')]=_0x20e8fc[_0x438c('0x5')]||![];this[_0x438c('0x6')]=_0x20e8fc[_0x438c('0x6')]||[];this[_0x438c('0x7')]=_0x20e8fc[_0x438c('0x7')]||[];}module[_0x438c('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 903ff66..f583a0e 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2abd=['initMailAccounts','length','isUndefined','mailAccounts','merge','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x14b217,_0x3296d3){var _0x3866b8=function(_0x846c60){while(--_0x846c60){_0x14b217['push'](_0x14b217['shift']());}};_0x3866b8(++_0x3296d3);}(_0x2abd,0x72));var _0xd2ab=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x2abd[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xd2ab('0x0'));var MailAccount=require(_0xd2ab('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x10e8fd,_0x67e540,_0x43a50e){var _0x26f386=_[_0xd2ab('0x2')](_0x10e8fd,function(_0x2f2952,_0x2f73ac){return _0x2f2952[_0x43a50e];});for(var _0x3f4ba4 in _0x67e540){if(_0x67e540[_0xd2ab('0x3')](_0x3f4ba4)){if(!_0x26f386[_0x3f4ba4]){delete _0x67e540[_0x3f4ba4];}}}}Realtime[_0xd2ab('0x4')][_0xd2ab('0x5')]=function(_0x2e82e2,_0x4b559f){for(var _0x1b0826 in _0x4b559f){if(_0x2e82e2[_0xd2ab('0x3')](_0x1b0826)){_0x2e82e2[_0x1b0826]=_0x4b559f[_0x1b0826];}}};Realtime[_0xd2ab('0x4')][_0xd2ab('0x6')]=function(){var _0x4968f4=this;return function(_0x13fbdd){if(_0x13fbdd){freeIsNotKey(_0x13fbdd,_0x4968f4['mailAccounts'],'id');for(var _0x5b3c6f=0x0,_0x46a65c={},_0x2bacbc={};_0x5b3c6f<_0x13fbdd[_0xd2ab('0x7')];_0x5b3c6f+=0x1){_0x46a65c=_0x13fbdd[_0x5b3c6f];if(_[_0xd2ab('0x8')](_0x4968f4[_0xd2ab('0x9')][_0x46a65c['id']])){_0x4968f4[_0xd2ab('0x9')][_0x46a65c['id']]=new MailAccount(_0x46a65c);}else{_[_0xd2ab('0xa')](_0x4968f4[_0xd2ab('0x9')][_0x46a65c['id']],_0x46a65c);}}}return _0x4968f4[_0xd2ab('0x9')];};};module[_0xd2ab('0xb')]=Realtime; \ No newline at end of file +var _0xc3fe=['prototype','mergeFromDatabase','hasOwnProperty','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x4d32d4,_0x3f1306){var _0x26ae5c=function(_0x420cbd){while(--_0x420cbd){_0x4d32d4['push'](_0x4d32d4['shift']());}};_0x26ae5c(++_0x3f1306);}(_0xc3fe,0x16e));var _0xec3f=function(_0x4c59ee,_0x5ef67a){_0x4c59ee=_0x4c59ee-0x0;var _0x43912a=_0xc3fe[_0x4c59ee];return _0x43912a;};'use strict';var _=require(_0xec3f('0x0'));var MailAccount=require(_0xec3f('0x1'));var Realtime=function(){this[_0xec3f('0x2')]={};};function freeIsNotKey(_0xd92ca8,_0xbaf4aa,_0x4e1d87){var _0xcec56c=_[_0xec3f('0x3')](_0xd92ca8,function(_0x5e78f3,_0x4ebf1b){return _0x5e78f3[_0x4e1d87];});for(var _0xa31873 in _0xbaf4aa){if(_0xbaf4aa['hasOwnProperty'](_0xa31873)){if(!_0xcec56c[_0xa31873]){delete _0xbaf4aa[_0xa31873];}}}}Realtime[_0xec3f('0x4')][_0xec3f('0x5')]=function(_0x2a43d7,_0x1777bf){for(var _0x42ca7d in _0x1777bf){if(_0x2a43d7[_0xec3f('0x6')](_0x42ca7d)){_0x2a43d7[_0x42ca7d]=_0x1777bf[_0x42ca7d];}}};Realtime[_0xec3f('0x4')]['initMailAccounts']=function(){var _0x205b25=this;return function(_0x2cbcc3){if(_0x2cbcc3){freeIsNotKey(_0x2cbcc3,_0x205b25[_0xec3f('0x2')],'id');for(var _0x41ca3d=0x0,_0x981127={},_0xe1f349={};_0x41ca3d<_0x2cbcc3['length'];_0x41ca3d+=0x1){_0x981127=_0x2cbcc3[_0x41ca3d];if(_[_0xec3f('0x7')](_0x205b25[_0xec3f('0x2')][_0x981127['id']])){_0x205b25[_0xec3f('0x2')][_0x981127['id']]=new MailAccount(_0x981127);}else{_[_0xec3f('0x8')](_0x205b25['mailAccounts'][_0x981127['id']],_0x981127);}}}return _0x205b25[_0xec3f('0x2')];};};module[_0xec3f('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index b9578d7..3a6d6a1 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb2a=['Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request','service','email','key','TemplateId','MailServerIn','Imap','MailServerOut'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0xdb2a,0x16f));var _0xadb2=function(_0x52198e,_0x35c273){_0x52198e=_0x52198e-0x0;var _0x3c5dc6=_0xdb2a[_0x52198e];return _0x3c5dc6;};'use strict';var client=require(_0xadb2('0x0'));exports[_0xadb2('0x1')]=function(){return function(){return client[_0xadb2('0x2')]('GetMailAccount',{'options':{'attributes':['id','name',_0xadb2('0x3'),_0xadb2('0x4'),'active',_0xadb2('0x5'),'ListId',_0xadb2('0x6')],'raw':![],'include':[{'model':_0xadb2('0x7'),'as':_0xadb2('0x8')},{'model':_0xadb2('0x9'),'as':_0xadb2('0xa')}]},'log':'getMailAccount'});};};exports[_0xadb2('0xb')]=function(_0x51453d,_0x173ed2){return client[_0xadb2('0x2')](_0xadb2('0xc'),{'account':{'id':_0x51453d},'body':_0x173ed2,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x9efe=['GetMailAccount','name','service','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','getMailAccounts','Request'];(function(_0x53a456,_0x1c3d73){var _0x19bf77=function(_0x252263){while(--_0x252263){_0x53a456['push'](_0x53a456['shift']());}};_0x19bf77(++_0x1c3d73);}(_0x9efe,0xca));var _0xe9ef=function(_0x1de841,_0x278c7c){_0x1de841=_0x1de841-0x0;var _0x19bce4=_0x9efe[_0x1de841];return _0x19bce4;};'use strict';var client=require('../client');exports[_0xe9ef('0x0')]=function(){return function(){return client[_0xe9ef('0x1')](_0xe9ef('0x2'),{'options':{'attributes':['id',_0xe9ef('0x3'),_0xe9ef('0x4'),'email',_0xe9ef('0x5'),_0xe9ef('0x6'),_0xe9ef('0x7'),_0xe9ef('0x8')],'raw':![],'include':[{'model':_0xe9ef('0x9'),'as':_0xe9ef('0xa')},{'model':_0xe9ef('0xb'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports['notify']=function(_0x40ffdc,_0x2f7280){return client[_0xe9ef('0x1')]('NotifyMailAccount',{'account':{'id':_0x40ffdc},'body':_0x2f7280,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 0778998..fcb4f76 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd521=['lodash','../../../config/logger','email','sendMail','account','message','then','error','Verified','catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','listen','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise'];(function(_0x49dd98,_0x8dc77f){var _0x590ce3=function(_0x4826d3){while(--_0x4826d3){_0x49dd98['push'](_0x49dd98['shift']());}};_0x590ce3(++_0x8dc77f);}(_0xd521,0x7c));var _0x1d52=function(_0x5520c7,_0xbee449){_0x5520c7=_0x5520c7-0x0;var _0x3b0590=_0xd521[_0x5520c7];return _0x3b0590;};'use strict';var jayson=require(_0x1d52('0x0'));var BPromise=require('bluebird');var _=require(_0x1d52('0x1'));var logger=require(_0x1d52('0x2'))(_0x1d52('0x3'));exports['listen']=function(_0x2f0c12,_0x3037af){return new BPromise(function(_0x56418e,_0x118ca5){var _0x560dff={'SendMail':function(_0x270e08){var _0x35dce2=this;return new Promise(function(_0x3f781f,_0xfb9994){_0x3037af[_0x1d52('0x4')](_0x270e08[_0x1d52('0x5')],_0x270e08[_0x1d52('0x6')])[_0x1d52('0x7')](function(_0x3050c1){_0x3f781f({'code':0xc8,'message':_0x3050c1});})['catch'](function(_0x4ea6e3){_0xfb9994(_0x35dce2[_0x1d52('0x8')](0x1f4,_0x4ea6e3));});});},'VerifySmtp':function(_0x37dc50){var _0x248204=this;return new Promise(function(_0x32a146,_0x43e9f0){_0x3037af['verifySmtp'](_0x37dc50[_0x1d52('0x5')])[_0x1d52('0x7')](function(_0x5a459a){_0x32a146({'code':0xc8,'message':_0x1d52('0x9')});})[_0x1d52('0xa')](function(_0x35e24c){_0x43e9f0(_0x248204['error'](0x1f4,_0x35e24c));});});},'MailAccounts':function(_0x18808e){return new Promise(function(_0x2dbe55,_0x36f293){var _0x4ad068=_[_0x1d52('0xb')](_0x2f0c12[_0x1d52('0xc')]);for(var _0xc61b3=0x0;_0xc61b3<_0x4ad068[_0x1d52('0xd')];_0xc61b3+=0x1){if(_0x4ad068[_0xc61b3][_0x1d52('0xe')]&&_0x4ad068[_0xc61b3][_0x1d52('0xe')]['password']){delete _0x4ad068[_0xc61b3]['Imap'][_0x1d52('0xf')];}if(_0x4ad068[_0xc61b3][_0x1d52('0x10')]&&_0x4ad068[_0xc61b3][_0x1d52('0x10')][_0x1d52('0x11')]){delete _0x4ad068[_0xc61b3][_0x1d52('0x10')][_0x1d52('0x11')];}}_0x2dbe55({'count':_0x4ad068[_0x1d52('0xd')],'rows':_0x4ad068});});}};var _0x4bc9e5=jayson[_0x1d52('0x12')](_0x560dff)[_0x1d52('0x13')]();_0x4bc9e5['on']('error',function(_0x53c5d8){logger[_0x1d52('0x8')](JSON[_0x1d52('0x14')](_0x53c5d8));return _0x118ca5(_0x53c5d8);});_0x4bc9e5[_0x1d52('0x15')](0x232b,'127.0.0.1',function(){console[_0x1d52('0x16')](_0x1d52('0x17'),0x232b);return _0x56418e(_0x1d52('0x18')+0x232b);});});}; \ No newline at end of file +var _0xd7d1=['log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','jayson/promise','bluebird','lodash','../../../config/logger','listen','sendMail','account','message','then','catch','verifySmtp','Verified','error','mailAccounts','length','Imap','password','Smtp','server','http','stringify','127.0.0.1'];(function(_0x3d3908,_0x58827e){var _0x212aae=function(_0x2a7cd0){while(--_0x2a7cd0){_0x3d3908['push'](_0x3d3908['shift']());}};_0x212aae(++_0x58827e);}(_0xd7d1,0x7a));var _0x1d7d=function(_0x4600a7,_0x1b0ac9){_0x4600a7=_0x4600a7-0x0;var _0x1c046c=_0xd7d1[_0x4600a7];return _0x1c046c;};'use strict';var jayson=require(_0x1d7d('0x0'));var BPromise=require(_0x1d7d('0x1'));var _=require(_0x1d7d('0x2'));var logger=require(_0x1d7d('0x3'))('email');exports[_0x1d7d('0x4')]=function(_0x137dca,_0x2a26dd){return new BPromise(function(_0x2cc56d,_0x243528){var _0x5987b4={'SendMail':function(_0x21a410){var _0x113a23=this;return new Promise(function(_0x102bf2,_0x3e1d5c){_0x2a26dd[_0x1d7d('0x5')](_0x21a410[_0x1d7d('0x6')],_0x21a410[_0x1d7d('0x7')])[_0x1d7d('0x8')](function(_0x3435a3){_0x102bf2({'code':0xc8,'message':_0x3435a3});})[_0x1d7d('0x9')](function(_0x4c25b8){_0x3e1d5c(_0x113a23['error'](0x1f4,_0x4c25b8));});});},'VerifySmtp':function(_0x4fd078){var _0x373ab3=this;return new Promise(function(_0x1dcaad,_0x44b3de){_0x2a26dd[_0x1d7d('0xa')](_0x4fd078['account'])[_0x1d7d('0x8')](function(_0x1427e7){_0x1dcaad({'code':0xc8,'message':_0x1d7d('0xb')});})[_0x1d7d('0x9')](function(_0x32b5b0){_0x44b3de(_0x373ab3[_0x1d7d('0xc')](0x1f4,_0x32b5b0));});});},'MailAccounts':function(_0x352773){return new Promise(function(_0x197c00,_0x1b3384){var _0x35ec21=_['values'](_0x137dca[_0x1d7d('0xd')]);for(var _0x1f0148=0x0;_0x1f0148<_0x35ec21[_0x1d7d('0xe')];_0x1f0148+=0x1){if(_0x35ec21[_0x1f0148][_0x1d7d('0xf')]&&_0x35ec21[_0x1f0148]['Imap'][_0x1d7d('0x10')]){delete _0x35ec21[_0x1f0148][_0x1d7d('0xf')][_0x1d7d('0x10')];}if(_0x35ec21[_0x1f0148][_0x1d7d('0x11')]&&_0x35ec21[_0x1f0148][_0x1d7d('0x11')]['pass']){delete _0x35ec21[_0x1f0148][_0x1d7d('0x11')]['pass'];}}_0x197c00({'count':_0x35ec21[_0x1d7d('0xe')],'rows':_0x35ec21});});}};var _0x2430a5=jayson[_0x1d7d('0x12')](_0x5987b4)[_0x1d7d('0x13')]();_0x2430a5['on'](_0x1d7d('0xc'),function(_0x513a59){logger[_0x1d7d('0xc')](JSON[_0x1d7d('0x14')](_0x513a59));return _0x243528(_0x513a59);});_0x2430a5[_0x1d7d('0x4')](0x232b,_0x1d7d('0x15'),function(){console[_0x1d7d('0x16')](_0x1d7d('0x17'),0x232b);return _0x2cc56d('RPC\x20listening\x20on\x20port:'+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 261c994..6887c73 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae18=['adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','sticky-session','createServer','timeout','listen','websocket','polling','defaults','redis','localhost'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xae18,0x1d4));var _0x8ae1=function(_0x469046,_0x32e935){_0x469046=_0x469046-0x0;var _0x301721=_0xae18[_0x469046];return _0x301721;};'use strict';var _=require(_0x8ae1('0x0'));var http=require(_0x8ae1('0x1'));var express=require(_0x8ae1('0x2'));var sticky=require(_0x8ae1('0x3'));var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x8ae1('0x4')](app);server[_0x8ae1('0x5')]=0xdbba0;if(sticky[_0x8ae1('0x6')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0x8ae1('0x7'),_0x8ae1('0x8')]});config['redis']=_[_0x8ae1('0x9')](config[_0x8ae1('0xa')],{'host':_0x8ae1('0xb'),'port':0x18eb});socketio[_0x8ae1('0xc')](require(_0x8ae1('0xd'))({'pubClient':new Redis(config[_0x8ae1('0xa')]),'subClient':new Redis(config[_0x8ae1('0xa')])}));require('../../config/triggers')[_0x8ae1('0xe')]();require(_0x8ae1('0xf'))['default'](socketio);require(_0x8ae1('0x10'))['default'](app);require(_0x8ae1('0x11'))[_0x8ae1('0xe')](app);}else{server[_0x8ae1('0x12')](_0x8ae1('0x13'),function(){console[_0x8ae1('0x14')](_0x8ae1('0x15'),config[_0x8ae1('0x16')]);});}exports=module[_0x8ae1('0x17')]=app; \ No newline at end of file +var _0xb6ce=['sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express'];(function(_0x2e3e40,_0x37e698){var _0x2d1b5c=function(_0x694f76){while(--_0x694f76){_0x2e3e40['push'](_0x2e3e40['shift']());}};_0x2d1b5c(++_0x37e698);}(_0xb6ce,0xd6));var _0xeb6c=function(_0x354222,_0x1cc7be){_0x354222=_0x354222-0x0;var _0x207300=_0xb6ce[_0x354222];return _0x207300;};'use strict';var _=require(_0xeb6c('0x0'));var http=require('http');var express=require(_0xeb6c('0x1'));var sticky=require(_0xeb6c('0x2'));var Redis=require(_0xeb6c('0x3'));var config=require(_0xeb6c('0x4'));var app=express();var server=http[_0xeb6c('0x5')](app);server[_0xeb6c('0x6')]=0xdbba0;if(sticky[_0xeb6c('0x7')](server,config[_0xeb6c('0x8')])){var socketio=require(_0xeb6c('0x9'))(server,{'transports':['websocket',_0xeb6c('0xa')]});config[_0xeb6c('0xb')]=_[_0xeb6c('0xc')](config[_0xeb6c('0xb')],{'host':'localhost','port':0x18eb});socketio[_0xeb6c('0xd')](require(_0xeb6c('0xe'))({'pubClient':new Redis(config[_0xeb6c('0xb')]),'subClient':new Redis(config[_0xeb6c('0xb')])}));require(_0xeb6c('0xf'))['default']();require(_0xeb6c('0x10'))[_0xeb6c('0x11')](socketio);require(_0xeb6c('0x12'))['default'](app);require('../../routes')[_0xeb6c('0x11')](app);}else{server[_0xeb6c('0x13')](_0xeb6c('0x14'),function(){console[_0xeb6c('0x15')](_0xeb6c('0x16'),config[_0xeb6c('0x8')]);});}exports=module[_0xeb6c('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 196792a..12b8c31 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2ca=['request','then','debug','routing','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request'];(function(_0x124c71,_0x1e8bfd){var _0x4b21ac=function(_0x3f2ccb){while(--_0x3f2ccb){_0x124c71['push'](_0x124c71['shift']());}};_0x4b21ac(++_0x1e8bfd);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf2ca[_0x4ae6ef];return _0x3cbb4e;};'use strict';var jayson=require(_0xaf2c('0x0'));var BPromise=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('routing');var client=jayson[_0xaf2c('0x3')][_0xaf2c('0x4')]({'port':0x2329});client[_0xaf2c('0x5')]=function(_0x219511,_0x3a724c){return new BPromise(function(_0x10c910,_0x5b8c81){return client[_0xaf2c('0x6')](_0x219511,_0x3a724c)[_0xaf2c('0x7')](function(_0x297740){logger[_0xaf2c('0x8')]('rpc',_0xaf2c('0x9'),_0x219511,_0x3a724c,_0x297740);if(_0x297740[_0xaf2c('0xa')]){logger['error'](_0xaf2c('0xb'),'routing',_0x219511,_0x297740[_0xaf2c('0xa')]['message'],_0x3a724c);return _0x5b8c81(_0x297740[_0xaf2c('0xa')][_0xaf2c('0xc')]);}else{return _0x10c910(_0x297740[_0xaf2c('0xd')]);}})[_0xaf2c('0xe')](function(_0x5ad9b0){logger['error'](_0xaf2c('0xb'),_0xaf2c('0x9'),_0x219511,_0x5ad9b0,_0x3a724c);return _0x5b8c81(_0x5ad9b0);});});};module[_0xaf2c('0xf')]=client; \ No newline at end of file +var _0x3a0f=['catch','../../config/logger','http','Request','request','then','debug','rpc','routing','error','message','result'];(function(_0x2ae995,_0x580336){var _0x5ea781=function(_0x318bfc){while(--_0x318bfc){_0x2ae995['push'](_0x2ae995['shift']());}};_0x5ea781(++_0x580336);}(_0x3a0f,0x145));var _0xf3a0=function(_0x2258e3,_0x2dd800){_0x2258e3=_0x2258e3-0x0;var _0x22bd99=_0x3a0f[_0x2258e3];return _0x22bd99;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xf3a0('0x0'))('routing');var client=jayson['client'][_0xf3a0('0x1')]({'port':0x2329});client[_0xf3a0('0x2')]=function(_0x154115,_0x31a1b4){return new BPromise(function(_0x3d0886,_0xa3ed18){return client[_0xf3a0('0x3')](_0x154115,_0x31a1b4)[_0xf3a0('0x4')](function(_0x48e423){logger[_0xf3a0('0x5')](_0xf3a0('0x6'),_0xf3a0('0x7'),_0x154115,_0x31a1b4,_0x48e423);if(_0x48e423[_0xf3a0('0x8')]){logger['error'](_0xf3a0('0x6'),_0xf3a0('0x7'),_0x154115,_0x48e423[_0xf3a0('0x8')][_0xf3a0('0x9')],_0x31a1b4);return _0xa3ed18(_0x48e423[_0xf3a0('0x8')][_0xf3a0('0x9')]);}else{return _0x3d0886(_0x48e423[_0xf3a0('0xa')]);}})[_0xf3a0('0xb')](function(_0x5a1165){logger[_0xf3a0('0x8')](_0xf3a0('0x6'),_0xf3a0('0x7'),_0x154115,_0x5a1165,_0x31a1b4);return _0xa3ed18(_0x5a1165);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 3a6cefe..910cd48 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2fda=['getSmsQueues','initSmsQueues','getFaxQueues','initFaxQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','getAgents','then','initAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues'];(function(_0x442357,_0x1baaf7){var _0x31e254=function(_0x5aee55){while(--_0x5aee55){_0x442357['push'](_0x442357['shift']());}};_0x31e254(++_0x1baaf7);}(_0x2fda,0x1d3));var _0xa2fd=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2fda[_0x5783f4];return _0x28e380;};'use strict';var BPromise=require('bluebird');var server=require(_0xa2fd('0x0'));var Realtime=require(_0xa2fd('0x1'));var user=require(_0xa2fd('0x2'));var interval=require(_0xa2fd('0x3'));var openchannelQueue=require(_0xa2fd('0x4'));var chatQueue=require(_0xa2fd('0x5'));var smsQueue=require(_0xa2fd('0x6'));var mailQueue=require(_0xa2fd('0x7'));var faxQueue=require(_0xa2fd('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xa2fd('0x9')]()['then'](user[_0xa2fd('0xa')]())[_0xa2fd('0xb')](realtime[_0xa2fd('0xc')]())[_0xa2fd('0xb')](interval[_0xa2fd('0xd')]())[_0xa2fd('0xb')](realtime['initIntervals']())['then'](openchannelQueue[_0xa2fd('0xe')]())[_0xa2fd('0xb')](realtime[_0xa2fd('0xf')]())[_0xa2fd('0xb')](chatQueue['getChatQueues']())[_0xa2fd('0xb')](realtime['initChatQueues']())[_0xa2fd('0xb')](smsQueue[_0xa2fd('0x10')]())[_0xa2fd('0xb')](realtime[_0xa2fd('0x11')]())[_0xa2fd('0xb')](mailQueue['getMailQueues']())['then'](realtime['initMailQueues']())['then'](faxQueue[_0xa2fd('0x12')]())[_0xa2fd('0xb')](realtime[_0xa2fd('0x13')]())[_0xa2fd('0xb')](whatsappQueue['getWhatsappQueues']())['then'](realtime['initWhatsappQueues']())[_0xa2fd('0xb')](function(){return realtime;});}function main(){return server[_0xa2fd('0x14')](realtime)['then'](function(_0x3e4e3e){return initRealtime();})[_0xa2fd('0xb')](function(_0x4097aa){return setInterval(initRealtime,0x1388);})[_0xa2fd('0x15')](function(_0x524bd2){console[_0xa2fd('0x16')](_0x524bd2);});}main(); \ No newline at end of file +var _0xe45b=['initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals'];(function(_0x90db95,_0x5b5da7){var _0x3dfd93=function(_0x514c5d){while(--_0x514c5d){_0x90db95['push'](_0x90db95['shift']());}};_0x3dfd93(++_0x5b5da7);}(_0xe45b,0x1c2));var _0xbe45=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0xe45b[_0x42d1f8];return _0x40d234;};'use strict';var BPromise=require('bluebird');var server=require(_0xbe45('0x0'));var Realtime=require(_0xbe45('0x1'));var user=require(_0xbe45('0x2'));var interval=require(_0xbe45('0x3'));var openchannelQueue=require(_0xbe45('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xbe45('0x5'));var mailQueue=require(_0xbe45('0x6'));var faxQueue=require(_0xbe45('0x7'));var whatsappQueue=require(_0xbe45('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xbe45('0x9')]()[_0xbe45('0xa')](user[_0xbe45('0xb')]())['then'](realtime[_0xbe45('0xc')]())[_0xbe45('0xa')](interval[_0xbe45('0xd')]())['then'](realtime[_0xbe45('0xe')]())[_0xbe45('0xa')](openchannelQueue[_0xbe45('0xf')]())[_0xbe45('0xa')](realtime[_0xbe45('0x10')]())['then'](chatQueue[_0xbe45('0x11')]())[_0xbe45('0xa')](realtime[_0xbe45('0x12')]())[_0xbe45('0xa')](smsQueue['getSmsQueues']())[_0xbe45('0xa')](realtime[_0xbe45('0x13')]())['then'](mailQueue[_0xbe45('0x14')]())[_0xbe45('0xa')](realtime[_0xbe45('0x15')]())['then'](faxQueue[_0xbe45('0x16')]())[_0xbe45('0xa')](realtime[_0xbe45('0x17')]())['then'](whatsappQueue[_0xbe45('0x18')]())[_0xbe45('0xa')](realtime[_0xbe45('0x19')]())[_0xbe45('0xa')](function(){return realtime;});}function main(){return server[_0xbe45('0x1a')](realtime)[_0xbe45('0xa')](function(_0x345cf9){return initRealtime();})[_0xbe45('0xa')](function(_0x572140){return setInterval(initRealtime,0x1388);})[_0xbe45('0x1b')](function(_0x41510e){console[_0xbe45('0x1c')](_0x41510e);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 89f9474..1f3848d 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91ed=['exports','lodash','util','events','EventEmitter','init','register','ignoreFactChanges','inherits','prototype','isArray','concat','isObject','push','sync','activeRules','filter','isNil','orderBy','asc','result','consequence','ruleRef','name','nextTick','isEqual','restart','matchPath','findRules','rules','matches','turn','length','priority','toJSON','map','condition','toString','isString','parse','object'];(function(_0x351a5c,_0xf2e6bd){var _0x257a3b=function(_0xb478f0){while(--_0xb478f0){_0x351a5c['push'](_0x351a5c['shift']());}};_0x257a3b(++_0xf2e6bd);}(_0x91ed,0x149));var _0xd91e=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x91ed[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0xd91e('0x0'));var util=require(_0xd91e('0x1'));var EventEmitter=require(_0xd91e('0x2'))[_0xd91e('0x3')];function RuleEngine(_0x461cb6,_0x3ea929){this[_0xd91e('0x4')]();if(!_['isNil'](_0x461cb6)){this[_0xd91e('0x5')](_0x461cb6);}if(_0x3ea929){this[_0xd91e('0x6')]=_0x3ea929[_0xd91e('0x6')];}return this;}util[_0xd91e('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xd91e('0x8')][_0xd91e('0x4')]=function(_0x29de9c){this['rules']=[];this['activeRules']=[];};RuleEngine[_0xd91e('0x8')][_0xd91e('0x5')]=function(_0x5371be){if(Array[_0xd91e('0x9')](_0x5371be)){this['rules']=this['rules'][_0xd91e('0xa')](_0x5371be);}else if(_0x5371be!==null&&_[_0xd91e('0xb')](_0x5371be)){this['rules'][_0xd91e('0xc')](_0x5371be);}this[_0xd91e('0xd')]();};RuleEngine[_0xd91e('0x8')][_0xd91e('0xd')]=function(){this[_0xd91e('0xe')]=this['rules'][_0xd91e('0xf')](function(_0x304696){if(_[_0xd91e('0x10')](_0x304696['on'])){_0x304696['on']=!![];}if(_0x304696['on']===!![]){return _0x304696;}});this['activeRules']=_[_0xd91e('0x11')](this[_0xd91e('0xe')],['p'],[_0xd91e('0x12')]);};RuleEngine['prototype']['execute']=function(_0x1441c0,_0x5716ea){var _0x24fe6d=![];_0x1441c0[_0xd91e('0x13')]=!![];var _0x2bf0fe=_['clone'](_0x1441c0);var _0x4755f8=_['clone'](_0x1441c0);var _0x4571df=this[_0xd91e('0xe')];var _0x38dd98=[];var _0x3e8f47=this[_0xd91e('0x6')];(function FnRuleLoop(_0x523d2e){var _0x5f21da={'rules':function(){return _0x4571df;},'rule':function(){return _0x4571df[_0x523d2e];},'when':function(_0x2c9fe3){if(_0x2c9fe3){var _0x33ac86=_0x4571df[_0x523d2e][_0xd91e('0x14')];_0x33ac86[_0xd91e('0x15')]=_0x4571df[_0x523d2e]['id']||_0x4571df[_0x523d2e][_0xd91e('0x16')]||'index_'+_0x523d2e;process[_0xd91e('0x17')](function(){_0x38dd98[_0xd91e('0xc')](_0x33ac86['ruleRef']);_0x33ac86['call'](_0x2bf0fe,_0x5f21da);});}else{process[_0xd91e('0x17')](function(){_0x5f21da['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x24fe6d=!![];return FnRuleLoop(0x0);},'next':function(_0x4169d9){if(!_0x3e8f47&&!_[_0xd91e('0x18')](_0x4755f8,_0x2bf0fe)){_0x4755f8=_['clone'](_0x2bf0fe);process['nextTick'](function(){_0x5f21da[_0xd91e('0x19')]();});}else{process[_0xd91e('0x17')](function(){if(_[_0xd91e('0x10')](_0x4169d9)){return FnRuleLoop(_0x523d2e+0x1);}else{return FnRuleLoop(_0x4169d9);}});}}};if(_0x523d2e<_0x4571df['length']&&_0x24fe6d===![]){var _0x22f6b5=_0x4571df[_0x523d2e]['condition'];_0x22f6b5['call'](_0x2bf0fe,_0x5f21da);}else{process[_0xd91e('0x17')](function(){_0x2bf0fe[_0xd91e('0x1a')]=_0x38dd98;return _0x5716ea?_0x5716ea(_0x2bf0fe):_['noop']();});}}(0x0));};RuleEngine[_0xd91e('0x8')][_0xd91e('0x1b')]=function(_0x393e97){if(_[_0xd91e('0x10')](_0x393e97)){return this[_0xd91e('0x1c')];}else{var _0x412361=_[_0xd91e('0x1d')](_0x393e97);return _[_0xd91e('0xf')](this['rules'],_0x412361);}};RuleEngine[_0xd91e('0x8')][_0xd91e('0x1e')]=function(_0x20de85,_0x109990){var _0x5ca81b=_0x20de85==='on'||_0x20de85==='ON'?!![]:![];var _0x335ab4=this[_0xd91e('0x1b')](_0x109990);for(var _0x34f174=0x0,_0x13752e=_0x335ab4[_0xd91e('0x1f')];_0x34f174<_0x13752e;_0x34f174+=0x1){_0x335ab4[_0x34f174]['on']=_0x5ca81b;}this[_0xd91e('0xd')]();};RuleEngine[_0xd91e('0x8')]['prioritize']=function(_0x3a37c6,_0x45bd52){_0x3a37c6=parseInt(_0x3a37c6,0xa);var _0x13bb0c=this[_0xd91e('0x1b')](_0x45bd52);for(var _0x100b1b=0x0,_0x12e2d7=_0x13bb0c[_0xd91e('0x1f')];_0x100b1b<_0x12e2d7;_0x100b1b+=0x1){_0x13bb0c[_0x100b1b][_0xd91e('0x20')]=_0x3a37c6;}this['sync']();};RuleEngine[_0xd91e('0x8')][_0xd91e('0x21')]=function(){var _0x5b5527=this[_0xd91e('0x1c')];if(_0x5b5527 instanceof Array){_0x5b5527=_0x5b5527[_0xd91e('0x22')](function(_0x213416){_0x213416['condition']=_0x213416[_0xd91e('0x23')][_0xd91e('0x24')]();_0x213416[_0xd91e('0x14')]=_0x213416[_0xd91e('0x14')]['toString']();return _0x213416;});}else if(!_[_0xd91e('0x10')](_0x5b5527)){_0x5b5527['condition']=_0x5b5527[_0xd91e('0x23')][_0xd91e('0x24')]();_0x5b5527[_0xd91e('0x14')]=_0x5b5527[_0xd91e('0x14')]['toString']();}return _0x5b5527;};RuleEngine['prototype']['fromJSON']=function(_0x15c490){this['init']();if(_[_0xd91e('0x25')](_0x15c490)){_0x15c490=JSON[_0xd91e('0x26')](_0x15c490);}if(_0x15c490 instanceof Array){_0x15c490=_0x15c490[_0xd91e('0x22')](function(_0x2fc8d6){_0x2fc8d6['condition']=eval('('+_0x2fc8d6[_0xd91e('0x23')]+')');_0x2fc8d6['consequence']=eval('('+_0x2fc8d6[_0xd91e('0x14')]+')');return _0x2fc8d6;});}else if(_0x15c490!==null&&typeof _0x15c490==_0xd91e('0x27')){_0x15c490[_0xd91e('0x23')]=eval('('+_0x15c490['condition']+')');_0x15c490[_0xd91e('0x14')]=eval('('+_0x15c490['consequence']+')');}this[_0xd91e('0x5')](_0x15c490);};module[_0xd91e('0x28')]=RuleEngine; \ No newline at end of file +var _0xcb7c=['object','events','init','ignoreFactChanges','inherits','prototype','rules','register','isArray','concat','isObject','push','sync','activeRules','filter','isNil','orderBy','asc','result','clone','ruleRef','name','index_','call','isEqual','nextTick','restart','length','turn','findRules','toJSON','map','condition','toString','consequence','fromJSON','parse'];(function(_0x441912,_0x46e1f2){var _0x4923e2=function(_0x1c6711){while(--_0x1c6711){_0x441912['push'](_0x441912['shift']());}};_0x4923e2(++_0x46e1f2);}(_0xcb7c,0x104));var _0xccb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb7c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var EventEmitter=require(_0xccb7('0x0'))['EventEmitter'];function RuleEngine(_0x5f458d,_0x3ac903){this[_0xccb7('0x1')]();if(!_['isNil'](_0x5f458d)){this['register'](_0x5f458d);}if(_0x3ac903){this[_0xccb7('0x2')]=_0x3ac903[_0xccb7('0x2')];}return this;}util[_0xccb7('0x3')](RuleEngine,EventEmitter);RuleEngine[_0xccb7('0x4')][_0xccb7('0x1')]=function(_0x38f71d){this[_0xccb7('0x5')]=[];this['activeRules']=[];};RuleEngine['prototype'][_0xccb7('0x6')]=function(_0x14a8f9){if(Array[_0xccb7('0x7')](_0x14a8f9)){this[_0xccb7('0x5')]=this[_0xccb7('0x5')][_0xccb7('0x8')](_0x14a8f9);}else if(_0x14a8f9!==null&&_[_0xccb7('0x9')](_0x14a8f9)){this['rules'][_0xccb7('0xa')](_0x14a8f9);}this[_0xccb7('0xb')]();};RuleEngine[_0xccb7('0x4')][_0xccb7('0xb')]=function(){this[_0xccb7('0xc')]=this[_0xccb7('0x5')][_0xccb7('0xd')](function(_0x480074){if(_[_0xccb7('0xe')](_0x480074['on'])){_0x480074['on']=!![];}if(_0x480074['on']===!![]){return _0x480074;}});this[_0xccb7('0xc')]=_[_0xccb7('0xf')](this['activeRules'],['p'],[_0xccb7('0x10')]);};RuleEngine[_0xccb7('0x4')]['execute']=function(_0x1324a2,_0x49b700){var _0x2ddf06=![];_0x1324a2[_0xccb7('0x11')]=!![];var _0x3a7f59=_[_0xccb7('0x12')](_0x1324a2);var _0x579894=_[_0xccb7('0x12')](_0x1324a2);var _0x390e65=this['activeRules'];var _0x27e9dd=[];var _0x2bb0d4=this[_0xccb7('0x2')];(function FnRuleLoop(_0x2c6881){var _0x464492={'rules':function(){return _0x390e65;},'rule':function(){return _0x390e65[_0x2c6881];},'when':function(_0x2d525c){if(_0x2d525c){var _0x1cfc58=_0x390e65[_0x2c6881]['consequence'];_0x1cfc58[_0xccb7('0x13')]=_0x390e65[_0x2c6881]['id']||_0x390e65[_0x2c6881][_0xccb7('0x14')]||_0xccb7('0x15')+_0x2c6881;process['nextTick'](function(){_0x27e9dd[_0xccb7('0xa')](_0x1cfc58[_0xccb7('0x13')]);_0x1cfc58[_0xccb7('0x16')](_0x3a7f59,_0x464492);});}else{process['nextTick'](function(){_0x464492['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2ddf06=!![];return FnRuleLoop(0x0);},'next':function(_0x20b75e){if(!_0x2bb0d4&&!_[_0xccb7('0x17')](_0x579894,_0x3a7f59)){_0x579894=_['clone'](_0x3a7f59);process[_0xccb7('0x18')](function(){_0x464492[_0xccb7('0x19')]();});}else{process[_0xccb7('0x18')](function(){if(_[_0xccb7('0xe')](_0x20b75e)){return FnRuleLoop(_0x2c6881+0x1);}else{return FnRuleLoop(_0x20b75e);}});}}};if(_0x2c6881<_0x390e65[_0xccb7('0x1a')]&&_0x2ddf06===![]){var _0x43b044=_0x390e65[_0x2c6881]['condition'];_0x43b044[_0xccb7('0x16')](_0x3a7f59,_0x464492);}else{process[_0xccb7('0x18')](function(){_0x3a7f59['matchPath']=_0x27e9dd;return _0x49b700?_0x49b700(_0x3a7f59):_['noop']();});}}(0x0));};RuleEngine[_0xccb7('0x4')]['findRules']=function(_0x1846d8){if(_['isNil'](_0x1846d8)){return this[_0xccb7('0x5')];}else{var _0xf581b4=_['matches'](_0x1846d8);return _[_0xccb7('0xd')](this[_0xccb7('0x5')],_0xf581b4);}};RuleEngine[_0xccb7('0x4')][_0xccb7('0x1b')]=function(_0x38f18f,_0x2ad731){var _0x53e863=_0x38f18f==='on'||_0x38f18f==='ON'?!![]:![];var _0x40d6e9=this[_0xccb7('0x1c')](_0x2ad731);for(var _0x1cfd42=0x0,_0x2b9b8c=_0x40d6e9[_0xccb7('0x1a')];_0x1cfd42<_0x2b9b8c;_0x1cfd42+=0x1){_0x40d6e9[_0x1cfd42]['on']=_0x53e863;}this[_0xccb7('0xb')]();};RuleEngine['prototype']['prioritize']=function(_0x58499e,_0x3e8bb3){_0x58499e=parseInt(_0x58499e,0xa);var _0x53629c=this['findRules'](_0x3e8bb3);for(var _0x136248=0x0,_0x522e5e=_0x53629c[_0xccb7('0x1a')];_0x136248<_0x522e5e;_0x136248+=0x1){_0x53629c[_0x136248]['priority']=_0x58499e;}this['sync']();};RuleEngine[_0xccb7('0x4')][_0xccb7('0x1d')]=function(){var _0x310019=this[_0xccb7('0x5')];if(_0x310019 instanceof Array){_0x310019=_0x310019[_0xccb7('0x1e')](function(_0x1d13ab){_0x1d13ab[_0xccb7('0x1f')]=_0x1d13ab['condition'][_0xccb7('0x20')]();_0x1d13ab[_0xccb7('0x21')]=_0x1d13ab[_0xccb7('0x21')][_0xccb7('0x20')]();return _0x1d13ab;});}else if(!_['isNil'](_0x310019)){_0x310019[_0xccb7('0x1f')]=_0x310019[_0xccb7('0x1f')]['toString']();_0x310019[_0xccb7('0x21')]=_0x310019['consequence'][_0xccb7('0x20')]();}return _0x310019;};RuleEngine[_0xccb7('0x4')][_0xccb7('0x22')]=function(_0x4b29df){this[_0xccb7('0x1')]();if(_['isString'](_0x4b29df)){_0x4b29df=JSON[_0xccb7('0x23')](_0x4b29df);}if(_0x4b29df instanceof Array){_0x4b29df=_0x4b29df[_0xccb7('0x1e')](function(_0x1fcd6d){_0x1fcd6d[_0xccb7('0x1f')]=eval('('+_0x1fcd6d[_0xccb7('0x1f')]+')');_0x1fcd6d[_0xccb7('0x21')]=eval('('+_0x1fcd6d[_0xccb7('0x21')]+')');return _0x1fcd6d;});}else if(_0x4b29df!==null&&typeof _0x4b29df==_0xccb7('0x24')){_0x4b29df[_0xccb7('0x1f')]=eval('('+_0x4b29df[_0xccb7('0x1f')]+')');_0x4b29df[_0xccb7('0x21')]=eval('('+_0x4b29df[_0xccb7('0x21')]+')');}this[_0xccb7('0x6')](_0x4b29df);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index a60da7a..f44897e 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x489d65,_0x57dc1c){var _0x2beda1=function(_0x7855c1){while(--_0x7855c1){_0x489d65['push'](_0x489d65['shift']());}};_0x2beda1(++_0x57dc1c);}(_0x814b,0x1a2));var _0xb814=function(_0x3fd50c,_0x1b41ed){_0x3fd50c=_0x3fd50c-0x0;var _0x4cebb2=_0x814b[_0x3fd50c];return _0x4cebb2;};'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 +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x334410,_0x4dc41f){var _0x949548=function(_0x58e3c2){while(--_0x58e3c2){_0x334410['push'](_0x334410['shift']());}};_0x949548(++_0x4dc41f);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b9f0bef..1f8f22b 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x19e1=['format','faxPause','busy','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','defaults','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','working','chat','fax','length','getChannelStatus','Status','StatusTime'];(function(_0x1d106c,_0xa3fbea){var _0x3d77c5=function(_0x26fe0e){while(--_0x26fe0e){_0x1d106c['push'](_0x1d106c['shift']());}};_0x3d77c5(++_0xa3fbea);}(_0x19e1,0x163));var _0x119e=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x19e1[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x119e('0x0'));var moment=require(_0x119e('0x1'));var md5=require(_0x119e('0x2'));var Redis=require(_0x119e('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x119e('0x4')](config[_0x119e('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x119e('0x6'))(new Redis(config[_0x119e('0x5')]));function Agent(_0x4e2d98){this['id']=_0x4e2d98['id']||0x0;this[_0x119e('0x7')]=_0x4e2d98['name']||'';this[_0x119e('0x8')]=_0x4e2d98[_0x119e('0x8')]||!![];this[_0x119e('0x9')]=_0x4e2d98[_0x119e('0x9')]||![];this['chatPause']=_0x4e2d98[_0x119e('0xa')]||![];this[_0x119e('0xb')]=_0x4e2d98[_0x119e('0xb')]||![];this['faxPause']=_0x4e2d98['faxPause']||![];this[_0x119e('0xc')]=_0x4e2d98[_0x119e('0xc')]||![];this[_0x119e('0xd')]=_0x4e2d98[_0x119e('0xd')]||![];this[_0x119e('0xe')]=_0x119e('0xf');this[_0x119e('0x10')]=0x0;this['chatCapacity']=_0x4e2d98[_0x119e('0x11')]||0x0;this[_0x119e('0x12')]=0x0;this[_0x119e('0x13')]=_0x119e('0xf');this[_0x119e('0x14')]=0x0;this[_0x119e('0x15')]=_0x4e2d98['mailCapacity']||0x0;this[_0x119e('0x16')]=0x0;this[_0x119e('0x17')]=_0x119e('0xf');this[_0x119e('0x18')]=0x0;this[_0x119e('0x19')]=_0x4e2d98[_0x119e('0x19')]||0x0;this[_0x119e('0x1a')]=0x0;this[_0x119e('0x1b')]=_0x119e('0xf');this[_0x119e('0x1c')]=0x0;this[_0x119e('0x1d')]=_0x4e2d98['smsCapacity']||0x0;this[_0x119e('0x1e')]=0x0;this[_0x119e('0x1f')]=_0x119e('0xf');this[_0x119e('0x20')]=0x0;this[_0x119e('0x21')]=_0x4e2d98[_0x119e('0x21')]||0x0;this[_0x119e('0x22')]=0x0;this[_0x119e('0x23')]=_0x119e('0xf');this[_0x119e('0x24')]=0x0;this[_0x119e('0x25')]=_0x4e2d98['openchannelCapacity']||0x0;this[_0x119e('0x26')]=0x0;this['busy']=![];this[_0x119e('0x27')]=undefined;this['md5']='';this[_0x119e('0x28')]();}Agent[_0x119e('0x29')]['getChannelStatus']=function(_0x4d41f0){if(this[_0x4d41f0+_0x119e('0x2a')]>0x0){if(this[_0x4d41f0+_0x119e('0x2b')]>0x0&&this[_0x4d41f0+_0x119e('0x2a')]>=this[_0x4d41f0+'Capacity']){return'maxcapacity';}else{return _0x119e('0x2c');}}else{return'idle';}};Agent[_0x119e('0x29')][_0x119e('0x28')]=function(){var _0x198f7b=['mail',_0x119e('0x2d'),'openchannel',_0x119e('0x2e'),'sms','whatsapp'];for(var _0xdc170f=0x0;_0xdc170f<_0x198f7b[_0x119e('0x2f')];_0xdc170f+=0x1){var _0x1a7dea=this[_0x119e('0x30')](_0x198f7b[_0xdc170f]);if(this[_0x198f7b[_0xdc170f]+_0x119e('0x31')]!==_0x1a7dea){this[_0x198f7b[_0xdc170f]+_0x119e('0x32')]=_['toNumber'](moment()[_0x119e('0x33')]('x'));}this[_0x198f7b[_0xdc170f]+_0x119e('0x31')]=_0x1a7dea;}var _0x58aa83={'id':this['id'],'name':this[_0x119e('0x7')],'online':this[_0x119e('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x119e('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x119e('0xc')],'faxPause':this[_0x119e('0x34')],'openchannelPause':this[_0x119e('0xd')],'chatStatus':this[_0x119e('0xe')],'chatStatusTime':this[_0x119e('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x119e('0x12')],'mailStatus':this[_0x119e('0x13')],'mailStatusTime':this[_0x119e('0x14')],'mailCapacity':this[_0x119e('0x15')],'mailCurrentCapacity':this[_0x119e('0x16')],'faxStatus':this[_0x119e('0x17')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x119e('0x1c')],'smsCapacity':this[_0x119e('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x119e('0x20')],'whatsappCapacity':this[_0x119e('0x21')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x119e('0x23')],'openchannelStatusTime':this[_0x119e('0x24')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x119e('0x26')],'busy':this[_0x119e('0x35')],'busyQueue':this[_0x119e('0x27')]};var _0x1b4458=md5(JSON[_0x119e('0x36')](_0x58aa83));if(this[_0x119e('0x2')]!==_0x1b4458){this[_0x119e('0x2')]=_0x1b4458;io[_0x119e('0x37')](_0x119e('0x38'),_0x58aa83);}};module[_0x119e('0x39')]=Agent; \ No newline at end of file +var _0xb5fb=['stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','maxcapacity','idle','prototype','mail','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','online','mailStatus','smsStatus','whatsappStatus','whatsappStatusTime','openchannelStatus'];(function(_0x5fdcee,_0x43769b){var _0x2df3b5=function(_0x4467d6){while(--_0x4467d6){_0x5fdcee['push'](_0x5fdcee['shift']());}};_0x2df3b5(++_0x43769b);}(_0xb5fb,0x172));var _0xbb5f=function(_0x2eae09,_0x327aa5){_0x2eae09=_0x2eae09-0x0;var _0x2408b0=_0xb5fb[_0x2eae09];return _0x2408b0;};'use strict';var _=require(_0xbb5f('0x0'));var moment=require(_0xbb5f('0x1'));var md5=require(_0xbb5f('0x2'));var Redis=require(_0xbb5f('0x3'));var config=require(_0xbb5f('0x4'));config[_0xbb5f('0x5')]=_[_0xbb5f('0x6')](config[_0xbb5f('0x5')],{'host':_0xbb5f('0x7'),'port':0x18eb});var io=require(_0xbb5f('0x8'))(new Redis(config[_0xbb5f('0x5')]));function Agent(_0x4707bf){this['id']=_0x4707bf['id']||0x0;this[_0xbb5f('0x9')]=_0x4707bf[_0xbb5f('0x9')]||'';this['online']=_0x4707bf['online']||!![];this[_0xbb5f('0xa')]=_0x4707bf['voicePause']||![];this[_0xbb5f('0xb')]=_0x4707bf[_0xbb5f('0xb')]||![];this['mailPause']=_0x4707bf['mailPause']||![];this[_0xbb5f('0xc')]=_0x4707bf['faxPause']||![];this[_0xbb5f('0xd')]=_0x4707bf[_0xbb5f('0xd')]||![];this[_0xbb5f('0xe')]=_0x4707bf[_0xbb5f('0xe')]||![];this[_0xbb5f('0xf')]=_0xbb5f('0x10');this[_0xbb5f('0x11')]=0x0;this[_0xbb5f('0x12')]=_0x4707bf['chatCapacity']||0x0;this[_0xbb5f('0x13')]=0x0;this['mailStatus']=_0xbb5f('0x10');this[_0xbb5f('0x14')]=0x0;this[_0xbb5f('0x15')]=_0x4707bf['mailCapacity']||0x0;this[_0xbb5f('0x16')]=0x0;this[_0xbb5f('0x17')]='unknown';this[_0xbb5f('0x18')]=0x0;this[_0xbb5f('0x19')]=_0x4707bf[_0xbb5f('0x19')]||0x0;this[_0xbb5f('0x1a')]=0x0;this['smsStatus']='unknown';this[_0xbb5f('0x1b')]=0x0;this['smsCapacity']=_0x4707bf[_0xbb5f('0x1c')]||0x0;this[_0xbb5f('0x1d')]=0x0;this['whatsappStatus']=_0xbb5f('0x10');this['whatsappStatusTime']=0x0;this[_0xbb5f('0x1e')]=_0x4707bf[_0xbb5f('0x1e')]||0x0;this[_0xbb5f('0x1f')]=0x0;this['openchannelStatus']=_0xbb5f('0x10');this[_0xbb5f('0x20')]=0x0;this[_0xbb5f('0x21')]=_0x4707bf['openchannelCapacity']||0x0;this[_0xbb5f('0x22')]=0x0;this['busy']=![];this[_0xbb5f('0x23')]=undefined;this[_0xbb5f('0x2')]='';this[_0xbb5f('0x24')]();}Agent['prototype'][_0xbb5f('0x25')]=function(_0x583110){if(this[_0x583110+_0xbb5f('0x26')]>0x0){if(this[_0x583110+'Capacity']>0x0&&this[_0x583110+_0xbb5f('0x26')]>=this[_0x583110+'Capacity']){return _0xbb5f('0x27');}else{return'working';}}else{return _0xbb5f('0x28');}};Agent[_0xbb5f('0x29')][_0xbb5f('0x24')]=function(){var _0x4d7233=[_0xbb5f('0x2a'),'chat','openchannel',_0xbb5f('0x2b'),_0xbb5f('0x2c'),_0xbb5f('0x2d')];for(var _0x39ab2=0x0;_0x39ab2<_0x4d7233[_0xbb5f('0x2e')];_0x39ab2+=0x1){var _0x3c65cd=this[_0xbb5f('0x25')](_0x4d7233[_0x39ab2]);if(this[_0x4d7233[_0x39ab2]+_0xbb5f('0x2f')]!==_0x3c65cd){this[_0x4d7233[_0x39ab2]+_0xbb5f('0x30')]=_[_0xbb5f('0x31')](moment()[_0xbb5f('0x32')]('x'));}this[_0x4d7233[_0x39ab2]+_0xbb5f('0x2f')]=_0x3c65cd;}var _0x187477={'id':this['id'],'name':this[_0xbb5f('0x9')],'online':this[_0xbb5f('0x33')],'voicePause':this[_0xbb5f('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xbb5f('0xd')],'faxPause':this[_0xbb5f('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xbb5f('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xbb5f('0x12')],'chatCurrentCapacity':this[_0xbb5f('0x13')],'mailStatus':this[_0xbb5f('0x34')],'mailStatusTime':this[_0xbb5f('0x14')],'mailCapacity':this[_0xbb5f('0x15')],'mailCurrentCapacity':this[_0xbb5f('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xbb5f('0x18')],'faxCapacity':this[_0xbb5f('0x19')],'faxCurrentCapacity':this[_0xbb5f('0x1a')],'smsStatus':this[_0xbb5f('0x35')],'smsStatusTime':this[_0xbb5f('0x1b')],'smsCapacity':this[_0xbb5f('0x1c')],'smsCurrentCapacity':this[_0xbb5f('0x1d')],'whatsappStatus':this[_0xbb5f('0x36')],'whatsappStatusTime':this[_0xbb5f('0x37')],'whatsappCapacity':this[_0xbb5f('0x1e')],'whatsappCurrentCapacity':this[_0xbb5f('0x1f')],'openchannelStatus':this[_0xbb5f('0x38')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xbb5f('0x21')],'openchannelCurrentCapacity':this[_0xbb5f('0x22')],'busy':this['busy'],'busyQueue':this[_0xbb5f('0x23')]};var _0x58130f=md5(JSON[_0xbb5f('0x39')](_0x187477));if(this['md5']!==_0x58130f){this['md5']=_0x58130f;io[_0xbb5f('0x3a')](_0xbb5f('0x3b'),_0x187477);}};module[_0xbb5f('0x3c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index c32973c..a2b9c37 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 _0xa333=['loggedIn','chatPause','paused','available','waiting','stringify','emit','chat_queue:save','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype'];(function(_0x3e7451,_0x42ce79){var _0x4032d8=function(_0x453437){while(--_0x453437){_0x3e7451['push'](_0x3e7451['shift']());}};_0x4032d8(++_0x42ce79);}(_0xa333,0x128));var _0x3a33=function(_0x450233,_0x2e77d9){_0x450233=_0x450233-0x0;var _0x1dc4f4=_0xa333[_0x450233];return _0x1dc4f4;};'use strict';var _=require(_0x3a33('0x0'));var md5=require(_0x3a33('0x1'));var util=require(_0x3a33('0x2'));var Redis=require(_0x3a33('0x3'));var config=require('../../../config/environment');config[_0x3a33('0x4')]=_[_0x3a33('0x5')](config[_0x3a33('0x4')],{'host':_0x3a33('0x6'),'port':0x18eb});var io=require(_0x3a33('0x7'))(new Redis(config['redis']));function ChatQueue(_0x1d9c5f){this['id']=_0x1d9c5f['id']||0x0;this[_0x3a33('0x8')]=_0x1d9c5f[_0x3a33('0x8')]||'';this['timeout']=_0x1d9c5f['timeout']||0xa;this['strategy']=_0x1d9c5f[_0x3a33('0x9')]||'beepall';this[_0x3a33('0xa')]=_0x1d9c5f[_0x3a33('0xa')];this[_0x3a33('0xb')]={};this['waiting']=0x0;this[_0x3a33('0x1')]='';this[_0x3a33('0xc')]();this[_0x3a33('0xd')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x3353d3=this[_0x3a33('0xb')][_0x3a33('0xe')];this[_0x3a33('0xb')]=_['map'](this['Agents'],'id');this[_0x3a33('0xb')][_0x3a33('0xe')]=_0x3353d3;};ChatQueue[_0x3a33('0xf')][_0x3a33('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x1beff1=0x0;_0x1beff1=0x0?this[_0x3a33('0x13')]:0x0;var _0x558aa3={'id':this['id'],'available':this[_0x3a33('0x13')],'loggedIn':this[_0x3a33('0x10')],'name':this[_0x3a33('0x8')],'paused':this[_0x3a33('0x12')],'waiting':this[_0x3a33('0x14')]};var _0xcf726b=md5(JSON[_0x3a33('0x15')](_0x558aa3));if(this['md5']!==_0xcf726b){this[_0x3a33('0x1')]=_0xcf726b;io['to'](util['format']('chat:queue:%s',_0x558aa3[_0x3a33('0x8')]))[_0x3a33('0x16')](_0x3a33('0x17'),_0x558aa3);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xab43=['stringify','format','chat:queue:%s','emit','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','paused','online','loggedIn','available'];(function(_0x468230,_0x487aef){var _0x509774=function(_0x4a9f56){while(--_0x4a9f56){_0x468230['push'](_0x468230['shift']());}};_0x509774(++_0x487aef);}(_0xab43,0xdd));var _0x3ab4=function(_0x1101aa,_0x20cfb3){_0x1101aa=_0x1101aa-0x0;var _0x8ffff1=_0xab43[_0x1101aa];return _0x8ffff1;};'use strict';var _=require('lodash');var md5=require(_0x3ab4('0x0'));var util=require(_0x3ab4('0x1'));var Redis=require(_0x3ab4('0x2'));var config=require(_0x3ab4('0x3'));config['redis']=_[_0x3ab4('0x4')](config[_0x3ab4('0x5')],{'host':_0x3ab4('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3ab4('0x5')]));function ChatQueue(_0x28f639){this['id']=_0x28f639['id']||0x0;this[_0x3ab4('0x7')]=_0x28f639[_0x3ab4('0x7')]||'';this[_0x3ab4('0x8')]=_0x28f639[_0x3ab4('0x8')]||0xa;this[_0x3ab4('0x9')]=_0x28f639[_0x3ab4('0x9')]||_0x3ab4('0xa');this[_0x3ab4('0xb')]=_0x28f639[_0x3ab4('0xb')];this[_0x3ab4('0xc')]={};this[_0x3ab4('0xd')]=0x0;this['md5']='';this[_0x3ab4('0xe')]();this[_0x3ab4('0xf')]();}ChatQueue[_0x3ab4('0x10')][_0x3ab4('0xe')]=function(){var _0x436e4d=this['mapAgentsId']['_rr'];this[_0x3ab4('0xc')]=_['map'](this[_0x3ab4('0xb')],'id');this[_0x3ab4('0xc')][_0x3ab4('0x11')]=_0x436e4d;};ChatQueue['prototype'][_0x3ab4('0xf')]=function(){this['loggedIn']=0x0;this[_0x3ab4('0x12')]=0x0;for(var _0x35a636=0x0;_0x35a636=0x0?this[_0x3ab4('0x15')]:0x0;var _0x40de25={'id':this['id'],'available':this[_0x3ab4('0x15')],'loggedIn':this[_0x3ab4('0x14')],'name':this[_0x3ab4('0x7')],'paused':this[_0x3ab4('0x12')],'waiting':this[_0x3ab4('0xd')]};var _0x4f9034=md5(JSON[_0x3ab4('0x16')](_0x40de25));if(this['md5']!==_0x4f9034){this[_0x3ab4('0x0')]=_0x4f9034;io['to'](util[_0x3ab4('0x17')](_0x3ab4('0x18'),_0x40de25[_0x3ab4('0x7')]))[_0x3ab4('0x19')]('chat_queue:save',_0x40de25);}};module[_0x3ab4('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 d9749f0..28a3819 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(_0x5e4b03,_0x56eb9d){var _0x14db80=function(_0x18440b){while(--_0x18440b){_0x5e4b03['push'](_0x5e4b03['shift']());}};_0x14db80(++_0x56eb9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +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(_0x1671c0,_0x5d885a){var _0x1d776c=function(_0x47a263){while(--_0x47a263){_0x1671c0['push'](_0x1671c0['shift']());}};_0x1d776c(++_0x5d885a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 17b77ed..e8306b5 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 _0x93c0=['Intervals','name'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0x93c0,0xc1));var _0x093c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x93c0[_0x19e35c];return _0x3e1fe8;};'use strict';function Interval(_0x13ed17){this['id']=_0x13ed17['id']||0x0;this[_0x093c('0x0')]=_0x13ed17['name']||'';this[_0x093c('0x1')]=_0x13ed17[_0x093c('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xb071=['name','Intervals'];(function(_0x5ca544,_0x5a278){var _0x237ce4=function(_0x109b79){while(--_0x109b79){_0x5ca544['push'](_0x5ca544['shift']());}};_0x237ce4(++_0x5a278);}(_0xb071,0xea));var _0x1b07=function(_0x179170,_0x414a7a){_0x179170=_0x179170-0x0;var _0x2e0aac=_0xb071[_0x179170];return _0x2e0aac;};'use strict';function Interval(_0xca4af1){this['id']=_0xca4af1['id']||0x0;this[_0x1b07('0x0')]=_0xca4af1[_0x1b07('0x0')]||'';this[_0x1b07('0x1')]=_0xca4af1['Intervals']||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 556ce79..cca72da 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 _0xeae7=['strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','paused','available','name','format','mail:queue:%s','mail_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','timeout'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0xeae7,0x1a1));var _0x7eae=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0xeae7[_0x259d17];return _0x407535;};'use strict';var _=require('lodash');var md5=require(_0x7eae('0x0'));var util=require(_0x7eae('0x1'));var Redis=require(_0x7eae('0x2'));var config=require('../../../config/environment');config[_0x7eae('0x3')]=_[_0x7eae('0x4')](config[_0x7eae('0x3')],{'host':_0x7eae('0x5'),'port':0x18eb});var io=require(_0x7eae('0x6'))(new Redis(config[_0x7eae('0x3')]));function MailQueue(_0x353de6){this['id']=_0x353de6['id']||0x0;this['name']=_0x353de6['name']||'';this[_0x7eae('0x7')]=_0x353de6[_0x7eae('0x7')]||0xa;this['strategy']=_0x353de6[_0x7eae('0x8')]||'beepall';this[_0x7eae('0x9')]=_0x353de6[_0x7eae('0x9')];this[_0x7eae('0xa')]={};this[_0x7eae('0xb')]=0x0;this[_0x7eae('0x0')]='';this[_0x7eae('0xc')]();this[_0x7eae('0xd')]();}MailQueue[_0x7eae('0xe')][_0x7eae('0xc')]=function(){var _0x3758e4=this[_0x7eae('0xa')][_0x7eae('0xf')];this[_0x7eae('0xa')]=_['map'](this[_0x7eae('0x9')],'id');this[_0x7eae('0xa')][_0x7eae('0xf')]=_0x3758e4;};MailQueue[_0x7eae('0xe')][_0x7eae('0xd')]=function(){this[_0x7eae('0x10')]=0x0;this['paused']=0x0;for(var _0x658a7c=0x0;_0x658a7c=0x0?this[_0x7eae('0x13')]:0x0;var _0x5635be={'id':this['id'],'available':this[_0x7eae('0x13')],'loggedIn':this[_0x7eae('0x10')],'name':this[_0x7eae('0x14')],'paused':this['paused'],'waiting':this[_0x7eae('0xb')]};var _0xc2ebbe=md5(JSON['stringify'](_0x5635be));if(this[_0x7eae('0x0')]!==_0xc2ebbe){this['md5']=_0xc2ebbe;io['to'](util[_0x7eae('0x15')](_0x7eae('0x16'),_0x5635be[_0x7eae('0x14')]))['emit'](_0x7eae('0x17'),_0x5635be);}};module[_0x7eae('0x18')]=MailQueue; \ No newline at end of file +var _0xb9a7=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','available','stringify','format','mail:queue:%s','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x344a43,_0x34bead){var _0x41bfb7=function(_0x2ad561){while(--_0x2ad561){_0x344a43['push'](_0x344a43['shift']());}};_0x41bfb7(++_0x34bead);}(_0xb9a7,0x172));var _0x7b9a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb9a7[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x7b9a('0x0'));var md5=require('md5');var util=require(_0x7b9a('0x1'));var Redis=require(_0x7b9a('0x2'));var config=require(_0x7b9a('0x3'));config[_0x7b9a('0x4')]=_[_0x7b9a('0x5')](config[_0x7b9a('0x4')],{'host':_0x7b9a('0x6'),'port':0x18eb});var io=require(_0x7b9a('0x7'))(new Redis(config[_0x7b9a('0x4')]));function MailQueue(_0xca814b){this['id']=_0xca814b['id']||0x0;this[_0x7b9a('0x8')]=_0xca814b[_0x7b9a('0x8')]||'';this[_0x7b9a('0x9')]=_0xca814b[_0x7b9a('0x9')]||0xa;this[_0x7b9a('0xa')]=_0xca814b[_0x7b9a('0xa')]||'beepall';this[_0x7b9a('0xb')]=_0xca814b[_0x7b9a('0xb')];this[_0x7b9a('0xc')]={};this[_0x7b9a('0xd')]=0x0;this[_0x7b9a('0xe')]='';this[_0x7b9a('0xf')]();this[_0x7b9a('0x10')]();}MailQueue[_0x7b9a('0x11')][_0x7b9a('0xf')]=function(){var _0x59e46f=this[_0x7b9a('0xc')]['_rr'];this['mapAgentsId']=_[_0x7b9a('0x12')](this[_0x7b9a('0xb')],'id');this[_0x7b9a('0xc')][_0x7b9a('0x13')]=_0x59e46f;};MailQueue[_0x7b9a('0x11')][_0x7b9a('0x10')]=function(){this[_0x7b9a('0x14')]=0x0;this[_0x7b9a('0x15')]=0x0;for(var _0x4bf183=0x0;_0x4bf183=0x0?this[_0x7b9a('0x17')]:0x0;var _0x3c610d={'id':this['id'],'available':this[_0x7b9a('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x7b9a('0x8')],'paused':this[_0x7b9a('0x15')],'waiting':this['waiting']};var _0x59b6d4=md5(JSON[_0x7b9a('0x18')](_0x3c610d));if(this[_0x7b9a('0xe')]!==_0x59b6d4){this[_0x7b9a('0xe')]=_0x59b6d4;io['to'](util[_0x7b9a('0x19')](_0x7b9a('0x1a'),_0x3c610d['name']))[_0x7b9a('0x1b')]('mail_queue:save',_0x3c610d);}};module[_0x7b9a('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 6899c56..b8817e9 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 _0x288c=['length','online','openchannelPause','available','stringify','md5','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','updateRealtime','_rr','prototype','loggedIn','paused'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0x288c,0x129));var _0xc288=function(_0x406fbb,_0x1093e5){_0x406fbb=_0x406fbb-0x0;var _0x8e921d=_0x288c[_0x406fbb];return _0x8e921d;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xc288('0x0'));var Redis=require(_0xc288('0x1'));var config=require(_0xc288('0x2'));config[_0xc288('0x3')]=_['defaults'](config['redis'],{'host':_0xc288('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0x5b004f){this['id']=_0x5b004f['id']||0x0;this[_0xc288('0x5')]=_0x5b004f[_0xc288('0x5')]||'';this['timeout']=_0x5b004f[_0xc288('0x6')]||0xa;this['strategy']=_0x5b004f[_0xc288('0x7')]||'beepall';this[_0xc288('0x8')]=_0x5b004f['Agents'];this[_0xc288('0x9')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0xc288('0xa')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0xa857d1=this[_0xc288('0x9')][_0xc288('0xb')];this[_0xc288('0x9')]=_['map'](this[_0xc288('0x8')],'id');this[_0xc288('0x9')]['_rr']=_0xa857d1;};OpenchannelQueue[_0xc288('0xc')][_0xc288('0xa')]=function(){this[_0xc288('0xd')]=0x0;this[_0xc288('0xe')]=0x0;for(var _0x352d42=0x0;_0x352d42=0x0?this[_0xc288('0x12')]:0x0;var _0xf38cc7={'id':this['id'],'available':this[_0xc288('0x12')],'loggedIn':this[_0xc288('0xd')],'name':this[_0xc288('0x5')],'paused':this['paused'],'waiting':this['waiting']};var _0x2c197a=md5(JSON[_0xc288('0x13')](_0xf38cc7));if(this[_0xc288('0x14')]!==_0x2c197a){this[_0xc288('0x14')]=_0x2c197a;io['to'](util[_0xc288('0x15')](_0xc288('0x16'),_0xf38cc7['name']))[_0xc288('0x17')](_0xc288('0x18'),_0xf38cc7);}};module[_0xc288('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xedf7=['defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','openchannelPause','available','stringify','emit','openchannel_queue:save','lodash','util','ioredis','../../../config/environment','redis'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xedf7,0x1bd));var _0x7edf=function(_0x5d2477,_0x3672cb){_0x5d2477=_0x5d2477-0x0;var _0x46f68a=_0xedf7[_0x5d2477];return _0x46f68a;};'use strict';var _=require(_0x7edf('0x0'));var md5=require('md5');var util=require(_0x7edf('0x1'));var Redis=require(_0x7edf('0x2'));var config=require(_0x7edf('0x3'));config[_0x7edf('0x4')]=_[_0x7edf('0x5')](config[_0x7edf('0x4')],{'host':_0x7edf('0x6'),'port':0x18eb});var io=require(_0x7edf('0x7'))(new Redis(config[_0x7edf('0x4')]));function OpenchannelQueue(_0x5b1adc){this['id']=_0x5b1adc['id']||0x0;this['name']=_0x5b1adc[_0x7edf('0x8')]||'';this['timeout']=_0x5b1adc[_0x7edf('0x9')]||0xa;this[_0x7edf('0xa')]=_0x5b1adc[_0x7edf('0xa')]||_0x7edf('0xb');this[_0x7edf('0xc')]=_0x5b1adc[_0x7edf('0xc')];this[_0x7edf('0xd')]={};this[_0x7edf('0xe')]=0x0;this[_0x7edf('0xf')]='';this[_0x7edf('0x10')]();this[_0x7edf('0x11')]();}OpenchannelQueue[_0x7edf('0x12')][_0x7edf('0x10')]=function(){var _0x403183=this['mapAgentsId'][_0x7edf('0x13')];this[_0x7edf('0xd')]=_[_0x7edf('0x14')](this[_0x7edf('0xc')],'id');this[_0x7edf('0xd')][_0x7edf('0x13')]=_0x403183;};OpenchannelQueue[_0x7edf('0x12')][_0x7edf('0x11')]=function(){this[_0x7edf('0x15')]=0x0;this[_0x7edf('0x16')]=0x0;for(var _0x3a135c=0x0;_0x3a135c=0x0?this['available']:0x0;var _0x54a605={'id':this['id'],'available':this[_0x7edf('0x1a')],'loggedIn':this[_0x7edf('0x15')],'name':this['name'],'paused':this[_0x7edf('0x16')],'waiting':this[_0x7edf('0xe')]};var _0x1818a7=md5(JSON[_0x7edf('0x1b')](_0x54a605));if(this[_0x7edf('0xf')]!==_0x1818a7){this[_0x7edf('0xf')]=_0x1818a7;io['to'](util['format']('openchannel:queue:%s',_0x54a605[_0x7edf('0x8')]))[_0x7edf('0x1c')](_0x7edf('0x1d'),_0x54a605);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index b77866c..2fd3a9a 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x48301a,_0x5a0ddc){var _0x350723=function(_0x1268e2){while(--_0x1268e2){_0x48301a['push'](_0x48301a['shift']());}};_0x350723(++_0x5a0ddc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xb7e7[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x336d6b,_0x2ce9b7){var _0x3ee6bf=function(_0xb55211){while(--_0xb55211){_0x336d6b['push'](_0x336d6b['shift']());}};_0x3ee6bf(++_0x2ce9b7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb7e7[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7a499a1..ff30e55 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 _0x54e5=['paused','length','online','whatsappPause','available','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn'];(function(_0x4e7544,_0x17891b){var _0x1c20ee=function(_0x2c068b){while(--_0x2c068b){_0x4e7544['push'](_0x4e7544['shift']());}};_0x1c20ee(++_0x17891b);}(_0x54e5,0x7e));var _0x554e=function(_0x1652b7,_0xcd7dd5){_0x1652b7=_0x1652b7-0x0;var _0x54632e=_0x54e5[_0x1652b7];return _0x54632e;};'use strict';var _=require(_0x554e('0x0'));var md5=require(_0x554e('0x1'));var util=require(_0x554e('0x2'));var Redis=require('ioredis');var config=require(_0x554e('0x3'));config[_0x554e('0x4')]=_[_0x554e('0x5')](config[_0x554e('0x4')],{'host':_0x554e('0x6'),'port':0x18eb});var io=require(_0x554e('0x7'))(new Redis(config[_0x554e('0x4')]));function WhatsappQueue(_0x5d152f){this['id']=_0x5d152f['id']||0x0;this[_0x554e('0x8')]=_0x5d152f['name']||'';this['timeout']=_0x5d152f[_0x554e('0x9')]||0xa;this[_0x554e('0xa')]=_0x5d152f[_0x554e('0xa')]||'beepall';this['Agents']=_0x5d152f[_0x554e('0xb')];this[_0x554e('0xc')]={};this[_0x554e('0xd')]=0x0;this[_0x554e('0x1')]='';this[_0x554e('0xe')]();this[_0x554e('0xf')]();}WhatsappQueue[_0x554e('0x10')]['updateRouting']=function(){var _0x1d624b=this['mapAgentsId'][_0x554e('0x11')];this[_0x554e('0xc')]=_['map'](this[_0x554e('0xb')],'id');this['mapAgentsId'][_0x554e('0x11')]=_0x1d624b;};WhatsappQueue['prototype'][_0x554e('0xf')]=function(){this[_0x554e('0x12')]=0x0;this[_0x554e('0x13')]=0x0;for(var _0x37f63c=0x0;_0x37f63c=0x0?this['available']:0x0;var _0x1b4cc2={'id':this['id'],'available':this[_0x554e('0x17')],'loggedIn':this[_0x554e('0x12')],'name':this['name'],'paused':this[_0x554e('0x13')],'waiting':this['waiting']};var _0x2a5191=md5(JSON[_0x554e('0x18')](_0x1b4cc2));if(this['md5']!==_0x2a5191){this[_0x554e('0x1')]=_0x2a5191;io['to'](util[_0x554e('0x19')]('whatsapp:queue:%s',_0x1b4cc2[_0x554e('0x8')]))[_0x554e('0x1a')](_0x554e('0x1b'),_0x1b4cc2);}};module[_0x554e('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x8270=['md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash'];(function(_0x1928dd,_0x4e4a6a){var _0x32de52=function(_0xe6aa91){while(--_0xe6aa91){_0x1928dd['push'](_0x1928dd['shift']());}};_0x32de52(++_0x4e4a6a);}(_0x8270,0x185));var _0x0827=function(_0xc6f2df,_0x222595){_0xc6f2df=_0xc6f2df-0x0;var _0x1c853b=_0x8270[_0xc6f2df];return _0x1c853b;};'use strict';var _=require(_0x0827('0x0'));var md5=require(_0x0827('0x1'));var util=require(_0x0827('0x2'));var Redis=require(_0x0827('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x0827('0x4')](config[_0x0827('0x5')],{'host':_0x0827('0x6'),'port':0x18eb});var io=require(_0x0827('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x36b275){this['id']=_0x36b275['id']||0x0;this[_0x0827('0x8')]=_0x36b275['name']||'';this[_0x0827('0x9')]=_0x36b275[_0x0827('0x9')]||0xa;this[_0x0827('0xa')]=_0x36b275[_0x0827('0xa')]||_0x0827('0xb');this[_0x0827('0xc')]=_0x36b275['Agents'];this[_0x0827('0xd')]={};this[_0x0827('0xe')]=0x0;this[_0x0827('0x1')]='';this[_0x0827('0xf')]();this[_0x0827('0x10')]();}WhatsappQueue[_0x0827('0x11')][_0x0827('0xf')]=function(){var _0x32285d=this[_0x0827('0xd')][_0x0827('0x12')];this[_0x0827('0xd')]=_['map'](this[_0x0827('0xc')],'id');this[_0x0827('0xd')][_0x0827('0x12')]=_0x32285d;};WhatsappQueue[_0x0827('0x11')][_0x0827('0x10')]=function(){this[_0x0827('0x13')]=0x0;this[_0x0827('0x14')]=0x0;for(var _0x2f61bf=0x0;_0x2f61bf=0x0?this[_0x0827('0x18')]:0x0;var _0x378fec={'id':this['id'],'available':this[_0x0827('0x18')],'loggedIn':this[_0x0827('0x13')],'name':this[_0x0827('0x8')],'paused':this['paused'],'waiting':this[_0x0827('0xe')]};var _0x225aa8=md5(JSON[_0x0827('0x19')](_0x378fec));if(this[_0x0827('0x1')]!==_0x225aa8){this['md5']=_0x225aa8;io['to'](util['format'](_0x0827('0x1a'),_0x378fec[_0x0827('0x8')]))[_0x0827('0x1b')](_0x0827('0x1c'),_0x378fec);}};module[_0x0827('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b49928f..fa066f3 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(_0x22f77b,_0x24343a){var _0x12f047=function(_0x228469){while(--_0x228469){_0x22f77b['push'](_0x22f77b['shift']());}};_0x12f047(++_0x24343a);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7217,0x19e));var _0x7721=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7217[_0x56482c];return _0x5aae7a;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 5bc3119..c7ed2fe 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 _0xea48=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x373222,_0x5a4d08){var _0x10f86e=function(_0x49f448){while(--_0x49f448){_0x373222['push'](_0x373222['shift']());}};_0x10f86e(++_0x5a4d08);}(_0xea48,0x1d7));var _0x8ea4=function(_0x305ba2,_0x197701){_0x305ba2=_0x305ba2-0x0;var _0x3e797f=_0xea48[_0x305ba2];return _0x3e797f;};'use strict';var client=require(_0x8ea4('0x0'));exports[_0x8ea4('0x1')]=function(_0x266a93,_0x3046c3){return client[_0x8ea4('0x2')](_0x8ea4('0x3'),{'body':_0x3046c3,'options':{'where':{'id':_0x266a93}},'log':_0x8ea4('0x4')});};exports[_0x8ea4('0x5')]=function(_0xbf6b44,_0x58f66b){return client[_0x8ea4('0x2')]('AddTagsToChatInteraction',{'body':_0x58f66b,'options':{'where':{'id':_0xbf6b44}},'log':_0x8ea4('0x6')});}; \ No newline at end of file +var _0x1c6b=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0x1c6b,0x76));var _0xb1c6=function(_0x5e38a4,_0x333514){_0x5e38a4=_0x5e38a4-0x0;var _0x401332=_0x1c6b[_0x5e38a4];return _0x401332;};'use strict';var client=require(_0xb1c6('0x0'));exports['update']=function(_0x5f4343,_0x583852){return client[_0xb1c6('0x1')](_0xb1c6('0x2'),{'body':_0x583852,'options':{'where':{'id':_0x5f4343}},'log':_0xb1c6('0x3')});};exports[_0xb1c6('0x4')]=function(_0x2aee32,_0x5cdf69){return client[_0xb1c6('0x1')](_0xb1c6('0x5'),{'body':_0x5cdf69,'options':{'where':{'id':_0x2aee32}},'log':_0xb1c6('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 4a6a173..080c54c 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 _0xd7c2=['createChatMessage','create','CreateChatMessage'];(function(_0xbab353,_0x37e159){var _0x56871e=function(_0x474f77){while(--_0x474f77){_0xbab353['push'](_0xbab353['shift']());}};_0x56871e(++_0x37e159);}(_0xd7c2,0x190));var _0x2d7c=function(_0x5a9461,_0x30e8dc){_0x5a9461=_0x5a9461-0x0;var _0x39a3be=_0xd7c2[_0x5a9461];return _0x39a3be;};'use strict';var client=require('../client');exports[_0x2d7c('0x0')]=function(_0x42d714){return client['Request'](_0x2d7c('0x1'),{'body':_0x42d714,'log':_0x2d7c('0x2')});}; \ No newline at end of file +var _0xcf84=['../client','CreateChatMessage','createChatMessage'];(function(_0x416840,_0x59a299){var _0x118276=function(_0x2cda8b){while(--_0x2cda8b){_0x416840['push'](_0x416840['shift']());}};_0x118276(++_0x59a299);}(_0xcf84,0x171));var _0x4cf8=function(_0x57c078,_0x3e1799){_0x57c078=_0x57c078-0x0;var _0x5f0e8e=_0xcf84[_0x57c078];return _0x5f0e8e;};'use strict';var client=require(_0x4cf8('0x0'));exports['create']=function(_0x27caea){return client['Request'](_0x4cf8('0x1'),{'body':_0x27caea,'log':_0x4cf8('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 4208728..ca788a9 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 _0x3fa9=['User','Agents','name','../client','getChatQueues','Request','GetChatQueue','strategy'];(function(_0xa646c,_0x6c0ef1){var _0x4f5719=function(_0x3c894a){while(--_0x3c894a){_0xa646c['push'](_0xa646c['shift']());}};_0x4f5719(++_0x6c0ef1);}(_0x3fa9,0x163));var _0x93fa=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x3fa9[_0x513aa5];return _0x1a1a7c;};'use strict';var client=require(_0x93fa('0x0'));exports[_0x93fa('0x1')]=function(){return function(){return client[_0x93fa('0x2')](_0x93fa('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x93fa('0x4')],'include':[{'model':_0x93fa('0x5'),'as':_0x93fa('0x6'),'attributes':['id',_0x93fa('0x7'),'online','chatPause']}]},'log':_0x93fa('0x1')});};}; \ No newline at end of file +var _0xd8cc=['GetChatQueue','name','timeout','strategy','Agents','chatPause','../client','getChatQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8cc,0xe6));var _0xcd8c=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xd8cc[_0x1f1e31];return _0x229b56;};'use strict';var client=require(_0xcd8c('0x0'));exports[_0xcd8c('0x1')]=function(){return function(){return client['Request'](_0xcd8c('0x2'),{'options':{'raw':![],'attributes':['id',_0xcd8c('0x3'),_0xcd8c('0x4'),_0xcd8c('0x5')],'include':[{'model':'User','as':_0xcd8c('0x6'),'attributes':['id',_0xcd8c('0x3'),'online',_0xcd8c('0x7')]}]},'log':_0xcd8c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 7e6d527..7676f25 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 _0xb4e6=['../client','create','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC'];(function(_0x52fcc8,_0x2864c5){var _0x5736d0=function(_0x2f5a4c){while(--_0x2f5a4c){_0x52fcc8['push'](_0x52fcc8['shift']());}};_0x5736d0(++_0x2864c5);}(_0xb4e6,0xd8));var _0x6b4e=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xb4e6[_0x29e35f];return _0x266b74;};'use strict';var client=require(_0x6b4e('0x0'));exports[_0x6b4e('0x1')]=function(_0x3c385b){return client[_0x6b4e('0x2')](_0x6b4e('0x3'),{'body':_0x3c385b,'log':_0x6b4e('0x3')});};exports['update']=function(_0x3f36b2,_0x55df8c){return client[_0x6b4e('0x2')](_0x6b4e('0x4'),{'body':_0x55df8c,'options':{'where':{'uniqueid':_0x3f36b2},'order':[['id',_0x6b4e('0x5')]],'limit':0x1},'log':_0x6b4e('0x4')});}; \ No newline at end of file +var _0xf6c1=['update','UpdateChatQueueReport','DESC','Request','CreateChatQueueReport'];(function(_0x4103ba,_0x261f7d){var _0x25af60=function(_0x235419){while(--_0x235419){_0x4103ba['push'](_0x4103ba['shift']());}};_0x25af60(++_0x261f7d);}(_0xf6c1,0x99));var _0x1f6c=function(_0x292611,_0x5a7642){_0x292611=_0x292611-0x0;var _0x1c9388=_0xf6c1[_0x292611];return _0x1c9388;};'use strict';var client=require('../client');exports['create']=function(_0x14a784){return client[_0x1f6c('0x0')](_0x1f6c('0x1'),{'body':_0x14a784,'log':'CreateChatQueueReport'});};exports[_0x1f6c('0x2')]=function(_0x4f2a6f,_0x115493){return client[_0x1f6c('0x0')](_0x1f6c('0x3'),{'body':_0x115493,'options':{'where':{'uniqueid':_0x4f2a6f},'order':[['id',_0x1f6c('0x4')]],'limit':0x1},'log':_0x1f6c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index a35683c..5c894ec 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 _0xc3b9=['update','Request','updateFaxInteraction','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0x1ccb6b,_0x4e91e6){var _0x4c316=function(_0x324f8c){while(--_0x324f8c){_0x1ccb6b['push'](_0x1ccb6b['shift']());}};_0x4c316(++_0x4e91e6);}(_0xc3b9,0xef));var _0x9c3b=function(_0x4f22fe,_0x23f451){_0x4f22fe=_0x4f22fe-0x0;var _0x12adca=_0xc3b9[_0x4f22fe];return _0x12adca;};'use strict';var client=require(_0x9c3b('0x0'));exports[_0x9c3b('0x1')]=function(_0x17c71c,_0x359032){return client[_0x9c3b('0x2')]('UpdateFaxInteraction',{'body':_0x359032,'options':{'where':{'id':_0x17c71c}},'log':_0x9c3b('0x3')});};exports['addTags']=function(_0x20c61a,_0x10385b){return client[_0x9c3b('0x2')](_0x9c3b('0x4'),{'body':_0x10385b,'options':{'where':{'id':_0x20c61a}},'log':_0x9c3b('0x5')});}; \ No newline at end of file +var _0x19ac=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client'];(function(_0x529dfc,_0x2a0033){var _0x1cf620=function(_0x5dceba){while(--_0x5dceba){_0x529dfc['push'](_0x529dfc['shift']());}};_0x1cf620(++_0x2a0033);}(_0x19ac,0x185));var _0xc19a=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x19ac[_0x1b6c6d];return _0x290d9d;};'use strict';var client=require(_0xc19a('0x0'));exports['update']=function(_0x6a457,_0x3a88a0){return client[_0xc19a('0x1')](_0xc19a('0x2'),{'body':_0x3a88a0,'options':{'where':{'id':_0x6a457}},'log':'updateFaxInteraction'});};exports[_0xc19a('0x3')]=function(_0x3befd2,_0x3b636e){return client[_0xc19a('0x1')](_0xc19a('0x4'),{'body':_0x3b636e,'options':{'where':{'id':_0x3befd2}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2ed983a..0b51607 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 _0x2f0d=['../client','create','Request','createFaxMessage'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2f0d,0xd8));var _0xd2f0=function(_0x32c1ba,_0xa53c77){_0x32c1ba=_0x32c1ba-0x0;var _0x1ae6ca=_0x2f0d[_0x32c1ba];return _0x1ae6ca;};'use strict';var client=require(_0xd2f0('0x0'));exports[_0xd2f0('0x1')]=function(_0x3a01b9){return client[_0xd2f0('0x2')]('CreateFaxMessage',{'body':_0x3a01b9,'log':_0xd2f0('0x3')});}; \ No newline at end of file +var _0x313d=['Request','../client'];(function(_0x182a0a,_0x204009){var _0x1d8309=function(_0x3b10c8){while(--_0x3b10c8){_0x182a0a['push'](_0x182a0a['shift']());}};_0x1d8309(++_0x204009);}(_0x313d,0xed));var _0xd313=function(_0xe22236,_0x3100e3){_0xe22236=_0xe22236-0x0;var _0x75f12c=_0x313d[_0xe22236];return _0x75f12c;};'use strict';var client=require(_0xd313('0x0'));exports['create']=function(_0x3629f3){return client[_0xd313('0x1')]('CreateFaxMessage',{'body':_0x3629f3,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 1fd2bde..9460f5e 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 _0xe99c=['name','timeout','strategy','User','online','faxPause','getFaxQueues','../client'];(function(_0x3de7e0,_0x28cbff){var _0x11d0b3=function(_0xd95412){while(--_0xd95412){_0x3de7e0['push'](_0x3de7e0['shift']());}};_0x11d0b3(++_0x28cbff);}(_0xe99c,0x87));var _0xce99=function(_0x1a2bd6,_0x482a90){_0x1a2bd6=_0x1a2bd6-0x0;var _0x4096d1=_0xe99c[_0x1a2bd6];return _0x4096d1;};'use strict';var client=require(_0xce99('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xce99('0x1'),_0xce99('0x2'),_0xce99('0x3')],'include':[{'model':_0xce99('0x4'),'as':'Agents','attributes':['id',_0xce99('0x1'),_0xce99('0x5'),_0xce99('0x6')]}]},'log':_0xce99('0x7')});};}; \ No newline at end of file +var _0xd3b9=['online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xd3b9,0x157));var _0x9d3b=function(_0x1ad02c,_0x30b041){_0x1ad02c=_0x1ad02c-0x0;var _0x15f833=_0xd3b9[_0x1ad02c];return _0x15f833;};'use strict';var client=require(_0x9d3b('0x0'));exports[_0x9d3b('0x1')]=function(){return function(){return client[_0x9d3b('0x2')](_0x9d3b('0x3'),{'options':{'raw':![],'attributes':['id',_0x9d3b('0x4'),_0x9d3b('0x5'),_0x9d3b('0x6')],'include':[{'model':_0x9d3b('0x7'),'as':_0x9d3b('0x8'),'attributes':['id',_0x9d3b('0x4'),_0x9d3b('0x9'),_0x9d3b('0xa')]}]},'log':_0x9d3b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 516e405..07cf4c6 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 _0x43fd=['UpdateFaxQueueReport','DESC','create','CreateFaxQueueReport','Request'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x43fd,0x1ec));var _0xd43f=function(_0x483a7d,_0x53784e){_0x483a7d=_0x483a7d-0x0;var _0xb4e520=_0x43fd[_0x483a7d];return _0xb4e520;};'use strict';var client=require('../client');exports[_0xd43f('0x0')]=function(_0x4c8461){return client['Request'](_0xd43f('0x1'),{'body':_0x4c8461,'log':_0xd43f('0x1')});};exports['update']=function(_0x3df2bd,_0x48f953){return client[_0xd43f('0x2')](_0xd43f('0x3'),{'body':_0x48f953,'options':{'where':{'uniqueid':_0x3df2bd},'order':[['id',_0xd43f('0x4')]],'limit':0x1},'log':_0xd43f('0x3')});}; \ No newline at end of file +var _0x99a3=['DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0x99a3,0x14b));var _0x399a=function(_0x3942da,_0x49b37b){_0x3942da=_0x3942da-0x0;var _0x4cfe1b=_0x99a3[_0x3942da];return _0x4cfe1b;};'use strict';var client=require(_0x399a('0x0'));exports[_0x399a('0x1')]=function(_0x37ac62){return client[_0x399a('0x2')]('CreateFaxQueueReport',{'body':_0x37ac62,'log':_0x399a('0x3')});};exports[_0x399a('0x4')]=function(_0x2e355f,_0x4bf134){return client[_0x399a('0x2')]('UpdateFaxQueueReport',{'body':_0x4bf134,'options':{'where':{'uniqueid':_0x2e355f},'order':[['id',_0x399a('0x5')]],'limit':0x1},'log':_0x399a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d67f0d4..6e1fefc 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 _0x9e0d=['getIntervals','Request','GetInterval','Interval','Intervals','name','interval','../client'];(function(_0x453222,_0xd17a0e){var _0x236ed6=function(_0x35bb82){while(--_0x35bb82){_0x453222['push'](_0x453222['shift']());}};_0x236ed6(++_0xd17a0e);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x572743,_0x2cc13c){_0x572743=_0x572743-0x0;var _0x3abb61=_0x9e0d[_0x572743];return _0x3abb61;};'use strict';var client=require(_0xd9e0('0x0'));exports[_0xd9e0('0x1')]=function(){return function(){return client[_0xd9e0('0x2')](_0xd9e0('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xd9e0('0x4'),'as':_0xd9e0('0x5'),'attributes':['id',_0xd9e0('0x6'),_0xd9e0('0x7')]}]},'log':_0xd9e0('0x1')});};}; \ No newline at end of file +var _0x02a7=['Intervals','interval','getIntervals','Request','GetInterval','name','Interval'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x02a7,0x1a6));var _0x702a=function(_0x2422df,_0x4cdac4){_0x2422df=_0x2422df-0x0;var _0x1695c6=_0x02a7[_0x2422df];return _0x1695c6;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return function(){return client[_0x702a('0x1')](_0x702a('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x702a('0x3')],'include':[{'model':_0x702a('0x4'),'as':_0x702a('0x5'),'attributes':['id',_0x702a('0x3'),_0x702a('0x6')]}]},'log':_0x702a('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 9c72ad3..07ed8f9 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 _0x242b=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x1df787,_0x24e8df){var _0x25a24b=function(_0x2e961d){while(--_0x2e961d){_0x1df787['push'](_0x1df787['shift']());}};_0x25a24b(++_0x24e8df);}(_0x242b,0x132));var _0xb242=function(_0x27e6c4,_0x5c26dd){_0x27e6c4=_0x27e6c4-0x0;var _0x33011c=_0x242b[_0x27e6c4];return _0x33011c;};'use strict';var client=require('../client');exports[_0xb242('0x0')]=function(_0x42c874,_0x35712e){return client[_0xb242('0x1')](_0xb242('0x2'),{'body':_0x35712e,'options':{'where':{'id':_0x42c874}},'log':_0xb242('0x3')});};exports['addTags']=function(_0x3de8f3,_0xcecf30){return client[_0xb242('0x1')](_0xb242('0x4'),{'body':_0xcecf30,'options':{'where':{'id':_0x3de8f3}},'log':_0xb242('0x5')});}; \ No newline at end of file +var _0x4538=['addTags','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4538,0x134));var _0x8453=function(_0x1962f9,_0x3ebd65){_0x1962f9=_0x1962f9-0x0;var _0x129756=_0x4538[_0x1962f9];return _0x129756;};'use strict';var client=require('../client');exports[_0x8453('0x0')]=function(_0x262994,_0x539219){return client[_0x8453('0x1')](_0x8453('0x2'),{'body':_0x539219,'options':{'where':{'id':_0x262994}},'log':_0x8453('0x3')});};exports[_0x8453('0x4')]=function(_0x180401,_0x25f813){return client[_0x8453('0x1')]('AddTagsToMailInteraction',{'body':_0x25f813,'options':{'where':{'id':_0x180401}},'log':_0x8453('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 05ff584..43f7807 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 _0xdf3d=['CreateMailMessage','createMailMessage','../client','Request'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xdf3d,0x96));var _0xddf3=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xdf3d[_0x9df060];return _0x338dfe;};'use strict';var client=require(_0xddf3('0x0'));exports['create']=function(_0x5cf156){return client[_0xddf3('0x1')](_0xddf3('0x2'),{'body':_0x5cf156,'log':_0xddf3('0x3')});}; \ No newline at end of file +var _0xa14a=['create','Request','createMailMessage','../client'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xa14a,0x123));var _0xaa14=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xa14a[_0x1beef3];return _0x5af964;};'use strict';var client=require(_0xaa14('0x0'));exports[_0xaa14('0x1')]=function(_0xf8fdc8){return client[_0xaa14('0x2')]('CreateMailMessage',{'body':_0xf8fdc8,'log':_0xaa14('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 7d20511..830f511 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 _0x7c78=['getMailQueues','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','../client'];(function(_0x23ce41,_0x12c0f7){var _0x2212a1=function(_0x332a62){while(--_0x332a62){_0x23ce41['push'](_0x23ce41['shift']());}};_0x2212a1(++_0x12c0f7);}(_0x7c78,0x1f3));var _0x87c7=function(_0x5111a9,_0x353fa5){_0x5111a9=_0x5111a9-0x0;var _0x59a15a=_0x7c78[_0x5111a9];return _0x59a15a;};'use strict';var client=require(_0x87c7('0x0'));exports[_0x87c7('0x1')]=function(){return function(){return client['Request'](_0x87c7('0x2'),{'options':{'raw':![],'attributes':['id',_0x87c7('0x3'),_0x87c7('0x4'),_0x87c7('0x5')],'include':[{'model':_0x87c7('0x6'),'as':_0x87c7('0x7'),'attributes':['id',_0x87c7('0x3'),_0x87c7('0x8'),_0x87c7('0x9')]}]},'log':_0x87c7('0x1')});};}; \ No newline at end of file +var _0x04a1=['mailPause','getMailQueues','GetMailQueue','timeout','strategy','Agents','online'];(function(_0x45536b,_0x445dd1){var _0x20e63d=function(_0x420f79){while(--_0x420f79){_0x45536b['push'](_0x45536b['shift']());}};_0x20e63d(++_0x445dd1);}(_0x04a1,0x9b));var _0x104a=function(_0xd4fa7f,_0x141094){_0xd4fa7f=_0xd4fa7f-0x0;var _0x4c1cd3=_0x04a1[_0xd4fa7f];return _0x4c1cd3;};'use strict';var client=require('../client');exports[_0x104a('0x0')]=function(){return function(){return client['Request'](_0x104a('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x104a('0x2'),_0x104a('0x3')],'include':[{'model':'User','as':_0x104a('0x4'),'attributes':['id','name',_0x104a('0x5'),_0x104a('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 1f1f021..413e3c9 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 _0x2a4a=['UpdateMailQueueReport','../client','CreateMailQueueReport','Request','DESC'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x2a4a,0x141));var _0xa2a4=function(_0x43d081,_0x2952ed){_0x43d081=_0x43d081-0x0;var _0x473771=_0x2a4a[_0x43d081];return _0x473771;};'use strict';var client=require(_0xa2a4('0x0'));exports['create']=function(_0x2f5b58){return client['Request'](_0xa2a4('0x1'),{'body':_0x2f5b58,'log':'CreateMailQueueReport'});};exports['update']=function(_0x254fef,_0x555520){return client[_0xa2a4('0x2')]('UpdateMailQueueReport',{'body':_0x555520,'options':{'where':{'uniqueid':_0x254fef},'order':[['id',_0xa2a4('0x3')]],'limit':0x1},'log':_0xa2a4('0x4')});}; \ No newline at end of file +var _0x2905=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2905,0x108));var _0x5290=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2905[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0x5290('0x0'));exports['create']=function(_0x536492){return client[_0x5290('0x1')](_0x5290('0x2'),{'body':_0x536492,'log':_0x5290('0x2')});};exports[_0x5290('0x3')]=function(_0x321fb0,_0x405a5b){return client[_0x5290('0x1')](_0x5290('0x4'),{'body':_0x405a5b,'options':{'where':{'uniqueid':_0x321fb0},'order':[['id','DESC']],'limit':0x1},'log':_0x5290('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d5e9bf9..5b7a311 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 _0xb04d=['addTagsToChatInteraction','../client','update','Request','AddTagsToOpenchannelInteraction'];(function(_0x39ddd8,_0x378f5c){var _0x150db0=function(_0x4d2990){while(--_0x4d2990){_0x39ddd8['push'](_0x39ddd8['shift']());}};_0x150db0(++_0x378f5c);}(_0xb04d,0x150));var _0xdb04=function(_0x51d678,_0x1a2f97){_0x51d678=_0x51d678-0x0;var _0x4d31cb=_0xb04d[_0x51d678];return _0x4d31cb;};'use strict';var client=require(_0xdb04('0x0'));exports[_0xdb04('0x1')]=function(_0x3bacbd,_0x52c21){return client[_0xdb04('0x2')]('UpdateOpenchannelInteraction',{'body':_0x52c21,'options':{'where':{'id':_0x3bacbd}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x3299a8,_0x22e6d7){return client[_0xdb04('0x2')](_0xdb04('0x3'),{'body':_0x22e6d7,'options':{'where':{'id':_0x3299a8}},'log':_0xdb04('0x4')});}; \ No newline at end of file +var _0xfff3=['addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x399d8b,_0x156706){var _0x30483d=function(_0x9262ba){while(--_0x9262ba){_0x399d8b['push'](_0x399d8b['shift']());}};_0x30483d(++_0x156706);}(_0xfff3,0xc1));var _0x3fff=function(_0x29b737,_0x4fa3d5){_0x29b737=_0x29b737-0x0;var _0x43e643=_0xfff3[_0x29b737];return _0x43e643;};'use strict';var client=require(_0x3fff('0x0'));exports[_0x3fff('0x1')]=function(_0x4c792d,_0xdfd9ef){return client['Request'](_0x3fff('0x2'),{'body':_0xdfd9ef,'options':{'where':{'id':_0x4c792d}},'log':_0x3fff('0x3')});};exports[_0x3fff('0x4')]=function(_0x25d72f,_0x9ae0fb){return client[_0x3fff('0x5')](_0x3fff('0x6'),{'body':_0x9ae0fb,'options':{'where':{'id':_0x25d72f}},'log':_0x3fff('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index fe0b432..2d9d265 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 _0x9bde=['create','Request','createOpenchannelMessage'];(function(_0x481159,_0x14f64e){var _0x5a7ba7=function(_0x184948){while(--_0x184948){_0x481159['push'](_0x481159['shift']());}};_0x5a7ba7(++_0x14f64e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5bfb40,_0x184b43){_0x5bfb40=_0x5bfb40-0x0;var _0x393065=_0x9bde[_0x5bfb40];return _0x393065;};'use strict';var client=require('../client');exports[_0xe9bd('0x0')]=function(_0x4defda){return client[_0xe9bd('0x1')]('CreateOpenchannelMessage',{'body':_0x4defda,'log':_0xe9bd('0x2')});}; \ No newline at end of file +var _0x0bb5=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x2717eb,_0x39ea39){var _0xc7342c=function(_0x251eb8){while(--_0x251eb8){_0x2717eb['push'](_0x2717eb['shift']());}};_0xc7342c(++_0x39ea39);}(_0x0bb5,0x148));var _0x50bb=function(_0xde73b3,_0x2c3aed){_0xde73b3=_0xde73b3-0x0;var _0xb05736=_0x0bb5[_0xde73b3];return _0xb05736;};'use strict';var client=require(_0x50bb('0x0'));exports[_0x50bb('0x1')]=function(_0x5e61cf){return client['Request'](_0x50bb('0x2'),{'body':_0x5e61cf,'log':_0x50bb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d3e1f02..056066f 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 _0x3a27=['name','online','openchannelPause','../client','getOpenchannelQueues','strategy','Agents'];(function(_0x349d54,_0xcbb074){var _0x3fbb79=function(_0x4c157a){while(--_0x4c157a){_0x349d54['push'](_0x349d54['shift']());}};_0x3fbb79(++_0xcbb074);}(_0x3a27,0x96));var _0x73a2=function(_0x1bd3b8,_0x5dacb3){_0x1bd3b8=_0x1bd3b8-0x0;var _0x3ffb5d=_0x3a27[_0x1bd3b8];return _0x3ffb5d;};'use strict';var client=require(_0x73a2('0x0'));exports[_0x73a2('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x73a2('0x2')],'include':[{'model':'User','as':_0x73a2('0x3'),'attributes':['id',_0x73a2('0x4'),_0x73a2('0x5'),_0x73a2('0x6')]}]},'log':_0x73a2('0x1')});};}; \ No newline at end of file +var _0x87c4=['strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x482381,_0x54aad7){var _0x43d707=function(_0x167b88){while(--_0x167b88){_0x482381['push'](_0x482381['shift']());}};_0x43d707(++_0x54aad7);}(_0x87c4,0x112));var _0x487c=function(_0xbc87a1,_0x136ac2){_0xbc87a1=_0xbc87a1-0x0;var _0x3f6208=_0x87c4[_0xbc87a1];return _0x3f6208;};'use strict';var client=require(_0x487c('0x0'));exports[_0x487c('0x1')]=function(){return function(){return client[_0x487c('0x2')](_0x487c('0x3'),{'options':{'raw':![],'attributes':['id',_0x487c('0x4'),_0x487c('0x5'),_0x487c('0x6')],'include':[{'model':'User','as':_0x487c('0x7'),'attributes':['id',_0x487c('0x4'),_0x487c('0x8'),_0x487c('0x9')]}]},'log':_0x487c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3e0d882..453e429 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 _0xbf1b=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','Request'];(function(_0x81f000,_0x15df85){var _0x337aa2=function(_0x37f6a4){while(--_0x37f6a4){_0x81f000['push'](_0x81f000['shift']());}};_0x337aa2(++_0x15df85);}(_0xbf1b,0x6b));var _0xbbf1=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xbf1b[_0x5f3f88];return _0xd08119;};'use strict';var client=require('../client');exports['create']=function(_0x15811b){return client[_0xbbf1('0x0')](_0xbbf1('0x1'),{'body':_0x15811b,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x5e2b84,_0x4fbc82){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x4fbc82,'options':{'where':{'uniqueid':_0x5e2b84},'order':[['id','DESC']],'limit':0x1},'log':_0xbbf1('0x2')});}; \ No newline at end of file +var _0x6685=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x4e6338,_0x362914){var _0x23393a=function(_0x38a68c){while(--_0x38a68c){_0x4e6338['push'](_0x4e6338['shift']());}};_0x23393a(++_0x362914);}(_0x6685,0x10a));var _0x5668=function(_0x44b138,_0x48d508){_0x44b138=_0x44b138-0x0;var _0x47094d=_0x6685[_0x44b138];return _0x47094d;};'use strict';var client=require(_0x5668('0x0'));exports[_0x5668('0x1')]=function(_0x9b2c6e){return client[_0x5668('0x2')](_0x5668('0x3'),{'body':_0x9b2c6e,'log':_0x5668('0x3')});};exports[_0x5668('0x4')]=function(_0x4ea3c4,_0x1e19fe){return client[_0x5668('0x2')](_0x5668('0x5'),{'body':_0x1e19fe,'options':{'where':{'uniqueid':_0x4ea3c4},'order':[['id',_0x5668('0x6')]],'limit':0x1},'log':_0x5668('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 00de064..cf7c8ab 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 _0xad3d=['addTagsToSmsInteraction','../client','update','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction'];(function(_0x3bcf9e,_0x148a5d){var _0x1bb37c=function(_0xcaf5da){while(--_0xcaf5da){_0x3bcf9e['push'](_0x3bcf9e['shift']());}};_0x1bb37c(++_0x148a5d);}(_0xad3d,0xb7));var _0xdad3=function(_0x1c4670,_0x5676d4){_0x1c4670=_0x1c4670-0x0;var _0x5ee67f=_0xad3d[_0x1c4670];return _0x5ee67f;};'use strict';var client=require(_0xdad3('0x0'));exports[_0xdad3('0x1')]=function(_0x228735,_0xbd25be){return client['Request']('UpdateSmsInteraction',{'body':_0xbd25be,'options':{'where':{'id':_0x228735}},'log':_0xdad3('0x2')});};exports[_0xdad3('0x3')]=function(_0x4baf72,_0xc3a665){return client[_0xdad3('0x4')](_0xdad3('0x5'),{'body':_0xc3a665,'options':{'where':{'id':_0x4baf72}},'log':_0xdad3('0x6')});}; \ No newline at end of file +var _0x1a44=['../client','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x1a44,0xc4));var _0x41a4=function(_0x26a558,_0x42580f){_0x26a558=_0x26a558-0x0;var _0x3a0220=_0x1a44[_0x26a558];return _0x3a0220;};'use strict';var client=require(_0x41a4('0x0'));exports['update']=function(_0x46c2e8,_0x4750b3){return client[_0x41a4('0x1')](_0x41a4('0x2'),{'body':_0x4750b3,'options':{'where':{'id':_0x46c2e8}},'log':_0x41a4('0x3')});};exports[_0x41a4('0x4')]=function(_0x397cb2,_0x529244){return client[_0x41a4('0x1')](_0x41a4('0x5'),{'body':_0x529244,'options':{'where':{'id':_0x397cb2}},'log':_0x41a4('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d389dad..81d0bc9 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 _0xf0b7=['create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0b7,0xec));var _0x7f0b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xf0b7[_0x4565bf];return _0x5610ba;};'use strict';var client=require('../client');exports[_0x7f0b('0x0')]=function(_0x38e77e){return client[_0x7f0b('0x1')](_0x7f0b('0x2'),{'body':_0x38e77e,'log':_0x7f0b('0x3')});}; \ No newline at end of file +var _0xd625=['create','Request','CreateSmsMessage','../client'];(function(_0x584a03,_0x59e0c8){var _0x29d9c9=function(_0x27ea6f){while(--_0x27ea6f){_0x584a03['push'](_0x584a03['shift']());}};_0x29d9c9(++_0x59e0c8);}(_0xd625,0xbb));var _0x5d62=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xd625[_0x376b45];return _0x2341b3;};'use strict';var client=require(_0x5d62('0x0'));exports[_0x5d62('0x1')]=function(_0x1257dd){return client[_0x5d62('0x2')](_0x5d62('0x3'),{'body':_0x1257dd,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 28c5ced..d34af40 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 _0x4c50=['Request','GetSmsQueue','strategy','User','Agents','name','smsPause','getSmsQueues'];(function(_0x357cf,_0x210512){var _0x41dc97=function(_0x4f6627){while(--_0x4f6627){_0x357cf['push'](_0x357cf['shift']());}};_0x41dc97(++_0x210512);}(_0x4c50,0xf7));var _0x04c5=function(_0x2b8362,_0x3dc061){_0x2b8362=_0x2b8362-0x0;var _0x257e17=_0x4c50[_0x2b8362];return _0x257e17;};'use strict';var client=require('../client');exports[_0x04c5('0x0')]=function(){return function(){return client[_0x04c5('0x1')](_0x04c5('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x04c5('0x3')],'include':[{'model':_0x04c5('0x4'),'as':_0x04c5('0x5'),'attributes':['id',_0x04c5('0x6'),'online',_0x04c5('0x7')]}]},'log':_0x04c5('0x0')});};}; \ No newline at end of file +var _0x421f=['../client','getSmsQueues','Request','GetSmsQueue','name','timeout','online','smsPause'];(function(_0x245690,_0x3bf938){var _0x3fb9a4=function(_0x3354b3){while(--_0x3354b3){_0x245690['push'](_0x245690['shift']());}};_0x3fb9a4(++_0x3bf938);}(_0x421f,0x160));var _0xf421=function(_0x137d2f,_0x3b714c){_0x137d2f=_0x137d2f-0x0;var _0x21664a=_0x421f[_0x137d2f];return _0x21664a;};'use strict';var client=require(_0xf421('0x0'));exports[_0xf421('0x1')]=function(){return function(){return client[_0xf421('0x2')](_0xf421('0x3'),{'options':{'raw':![],'attributes':['id',_0xf421('0x4'),_0xf421('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xf421('0x4'),_0xf421('0x6'),_0xf421('0x7')]}]},'log':_0xf421('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 586d474..7e90d05 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 _0x3ec5=['Request','CreateSmsQueueReport','DESC','UpdateSmsQueueReport','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ec5,0x176));var _0x53ec=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3ec5[_0x432682];return _0x463d05;};'use strict';var client=require('../client');exports[_0x53ec('0x0')]=function(_0x5ef2dc){return client[_0x53ec('0x1')](_0x53ec('0x2'),{'body':_0x5ef2dc,'log':_0x53ec('0x2')});};exports['update']=function(_0x3c89a8,_0x2424c7){return client[_0x53ec('0x1')]('UpdateSmsQueueReport',{'body':_0x2424c7,'options':{'where':{'uniqueid':_0x3c89a8},'order':[['id',_0x53ec('0x3')]],'limit':0x1},'log':_0x53ec('0x4')});}; \ No newline at end of file +var _0x13be=['UpdateSmsQueueReport','create','CreateSmsQueueReport','update','Request','DESC'];(function(_0x289c3e,_0x3614b5){var _0x25a4b3=function(_0x1ea94b){while(--_0x1ea94b){_0x289c3e['push'](_0x289c3e['shift']());}};_0x25a4b3(++_0x3614b5);}(_0x13be,0x175));var _0xe13b=function(_0x56aea5,_0x60ac09){_0x56aea5=_0x56aea5-0x0;var _0x320b38=_0x13be[_0x56aea5];return _0x320b38;};'use strict';var client=require('../client');exports[_0xe13b('0x0')]=function(_0x4d92d7){return client['Request'](_0xe13b('0x1'),{'body':_0x4d92d7,'log':_0xe13b('0x1')});};exports[_0xe13b('0x2')]=function(_0x45e71c,_0x443dac){return client[_0xe13b('0x3')]('UpdateSmsQueueReport',{'body':_0x443dac,'options':{'where':{'uniqueid':_0x45e71c},'order':[['id',_0xe13b('0x4')]],'limit':0x1},'log':_0xe13b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 80e57d1..4f0fdc8 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 _0x8a09=['faxPause','smsPause','whatsappPause','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','GetUser','agent','name','pauseType','lastPauseAt','voicePause','chatPause'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0x8a09,0xf6));var _0x98a0=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8a09[_0x199572];return _0x13cfa3;};'use strict';var client=require(_0x98a0('0x0'));exports[_0x98a0('0x1')]=function(){return function(){return client['Request'](_0x98a0('0x2'),{'options':{'raw':!![],'where':{'role':_0x98a0('0x3')},'attributes':['id',_0x98a0('0x4'),'online',_0x98a0('0x5'),_0x98a0('0x6'),_0x98a0('0x7'),_0x98a0('0x8'),'mailPause',_0x98a0('0x9'),_0x98a0('0xa'),_0x98a0('0xb'),'openchannelPause','chatCapacity',_0x98a0('0xc'),_0x98a0('0xd'),_0x98a0('0xe'),_0x98a0('0xf'),_0x98a0('0x10')]},'log':_0x98a0('0x1')});};}; \ No newline at end of file +var _0x7d81=['online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7d81,0x126));var _0x17d8=function(_0x148dff,_0x4d4a74){_0x148dff=_0x148dff-0x0;var _0x1019f5=_0x7d81[_0x148dff];return _0x1019f5;};'use strict';var client=require(_0x17d8('0x0'));exports[_0x17d8('0x1')]=function(){return function(){return client[_0x17d8('0x2')](_0x17d8('0x3'),{'options':{'raw':!![],'where':{'role':_0x17d8('0x4')},'attributes':['id',_0x17d8('0x5'),_0x17d8('0x6'),_0x17d8('0x7'),_0x17d8('0x8'),_0x17d8('0x9'),_0x17d8('0xa'),_0x17d8('0xb'),_0x17d8('0xc'),_0x17d8('0xd'),_0x17d8('0xe'),_0x17d8('0xf'),_0x17d8('0x10'),'mailCapacity',_0x17d8('0x11'),_0x17d8('0x12'),'whatsappCapacity',_0x17d8('0x13')]},'log':_0x17d8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 2085644..364250c 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 _0x5a8c=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x26f956,_0x4421c1){_0x26f956=_0x26f956-0x0;var _0x468c52=_0x5a8c[_0x26f956];return _0x468c52;};'use strict';var client=require(_0xc5a8('0x0'));exports[_0xc5a8('0x1')]=function(_0x4de0b0,_0x38dc02){return client[_0xc5a8('0x2')](_0xc5a8('0x3'),{'body':_0x38dc02,'options':{'where':{'id':_0x4de0b0}},'log':_0xc5a8('0x4')});};exports['addTags']=function(_0x2d862c,_0x4310e4){return client['Request'](_0xc5a8('0x5'),{'body':_0x4310e4,'options':{'where':{'id':_0x2d862c}},'log':_0xc5a8('0x6')});}; \ No newline at end of file +var _0x3667=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction','addTags'];(function(_0x4dab58,_0x78bb16){var _0x552cec=function(_0x3f2611){while(--_0x3f2611){_0x4dab58['push'](_0x4dab58['shift']());}};_0x552cec(++_0x78bb16);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7366('0x0'));exports[_0x7366('0x1')]=function(_0x33dd4e,_0x1288c1){return client[_0x7366('0x2')]('UpdateWhatsappInteraction',{'body':_0x1288c1,'options':{'where':{'id':_0x33dd4e}},'log':_0x7366('0x3')});};exports[_0x7366('0x4')]=function(_0x4b32a7,_0x27726b){return client[_0x7366('0x2')](_0x7366('0x5'),{'body':_0x27726b,'options':{'where':{'id':_0x4b32a7}},'log':_0x7366('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index fff6388..103c168 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 _0xc927=['CreateWhatsappMessage','createWhatsappMessage','../client','Request'];(function(_0x1d30a3,_0x5f428c){var _0x32bba1=function(_0x5a60cc){while(--_0x5a60cc){_0x1d30a3['push'](_0x1d30a3['shift']());}};_0x32bba1(++_0x5f428c);}(_0xc927,0x14e));var _0x7c92=function(_0x50925f,_0x2d01b1){_0x50925f=_0x50925f-0x0;var _0x59ad78=_0xc927[_0x50925f];return _0x59ad78;};'use strict';var client=require(_0x7c92('0x0'));exports['create']=function(_0x3c22c9){return client[_0x7c92('0x1')](_0x7c92('0x2'),{'body':_0x3c22c9,'log':_0x7c92('0x3')});}; \ No newline at end of file +var _0x46a8=['create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0x46a8,0x90));var _0x846a=function(_0x5e38e0,_0x1514b8){_0x5e38e0=_0x5e38e0-0x0;var _0x5b1c0b=_0x46a8[_0x5e38e0];return _0x5b1c0b;};'use strict';var client=require('../client');exports[_0x846a('0x0')]=function(_0xab0212){return client[_0x846a('0x1')](_0x846a('0x2'),{'body':_0xab0212,'log':_0x846a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 1744697..75b89d0 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 _0x823c=['online','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x524130,_0x261843){var _0x12496f=function(_0x9442c0){while(--_0x9442c0){_0x524130['push'](_0x524130['shift']());}};_0x12496f(++_0x261843);}(_0x823c,0x143));var _0xc823=function(_0x4913bf,_0x3137c7){_0x4913bf=_0x4913bf-0x0;var _0x134be3=_0x823c[_0x4913bf];return _0x134be3;};'use strict';var client=require(_0xc823('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xc823('0x1')](_0xc823('0x2'),{'options':{'raw':![],'attributes':['id',_0xc823('0x3'),_0xc823('0x4'),_0xc823('0x5')],'include':[{'model':_0xc823('0x6'),'as':'Agents','attributes':['id',_0xc823('0x3'),_0xc823('0x7'),_0xc823('0x8')]}]},'log':_0xc823('0x9')});};}; \ No newline at end of file +var _0x93e6=['timeout','User','Agents','name','whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue'];(function(_0x2f6cb4,_0xe0821){var _0x5b1b80=function(_0x32cc2a){while(--_0x32cc2a){_0x2f6cb4['push'](_0x2f6cb4['shift']());}};_0x5b1b80(++_0xe0821);}(_0x93e6,0x11e));var _0x693e=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x93e6[_0x2aecb2];return _0x3ebb80;};'use strict';var client=require(_0x693e('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x693e('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x693e('0x2'),'strategy'],'include':[{'model':_0x693e('0x3'),'as':_0x693e('0x4'),'attributes':['id',_0x693e('0x5'),'online',_0x693e('0x6')]}]},'log':_0x693e('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index d1fb8b5..f4a6fe3 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 _0x0b9b=['DESC','../client','Request','update','UpdateWhatsappQueueReport'];(function(_0x128a4c,_0x246df6){var _0x514d6c=function(_0xb0387b){while(--_0xb0387b){_0x128a4c['push'](_0x128a4c['shift']());}};_0x514d6c(++_0x246df6);}(_0x0b9b,0x6a));var _0xb0b9=function(_0x36e48d,_0x367d95){_0x36e48d=_0x36e48d-0x0;var _0x3bcc55=_0x0b9b[_0x36e48d];return _0x3bcc55;};'use strict';var client=require(_0xb0b9('0x0'));exports['create']=function(_0x471dbf){return client[_0xb0b9('0x1')]('CreateWhatsappQueueReport',{'body':_0x471dbf,'log':'CreateWhatsappQueueReport'});};exports[_0xb0b9('0x2')]=function(_0x1d33ad,_0x4517e2){return client[_0xb0b9('0x1')](_0xb0b9('0x3'),{'body':_0x4517e2,'options':{'where':{'uniqueid':_0x1d33ad},'order':[['id',_0xb0b9('0x4')]],'limit':0x1},'log':_0xb0b9('0x3')});}; \ No newline at end of file +var _0x7bbd=['UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport','update'];(function(_0x4a311c,_0x5ea54b){var _0x3a4ef5=function(_0xd23bc9){while(--_0xd23bc9){_0x4a311c['push'](_0x4a311c['shift']());}};_0x3a4ef5(++_0x5ea54b);}(_0x7bbd,0x105));var _0xd7bb=function(_0x1aaa00,_0x448f7a){_0x1aaa00=_0x1aaa00-0x0;var _0x3b7cea=_0x7bbd[_0x1aaa00];return _0x3b7cea;};'use strict';var client=require(_0xd7bb('0x0'));exports['create']=function(_0x5f2343){return client[_0xd7bb('0x1')](_0xd7bb('0x2'),{'body':_0x5f2343,'log':_0xd7bb('0x2')});};exports[_0xd7bb('0x3')]=function(_0xdcb668,_0x3f4fcd){return client[_0xd7bb('0x1')](_0xd7bb('0x4'),{'body':_0x3f4fcd,'options':{'where':{'uniqueid':_0xdcb668},'order':[['id','DESC']],'limit':0x1},'log':_0xd7bb('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 9f928bc..5063104 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 _0xc535=['atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','./strategy','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','map','join','stop','find','timeout','createQueue'];(function(_0x570bfa,_0x44a280){var _0x5d7348=function(_0x4c6fab){while(--_0x4c6fab){_0x570bfa['push'](_0x570bfa['shift']());}};_0x5d7348(++_0x44a280);}(_0xc535,0x1e4));var _0x5c53=function(_0x30c373,_0x3805c6){_0x30c373=_0x30c373-0x0;var _0x2d0763=_0xc535[_0x30c373];return _0x2d0763;};'use strict';var schema=require(_0x5c53('0x0'));var _=require(_0x5c53('0x1'));var util=require('util');var seqqueue=require(_0x5c53('0x2'));var logger=require(_0x5c53('0x3'))(_0x5c53('0x4'));var strategy=require(_0x5c53('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x5c53('0x6')}});function writeLog(_0xa39c3b,_0x29e1ba,_0x52e0de){return logger[_0x5c53('0x7')](util[_0x5c53('0x8')](_0x5c53('0x9'),_0xa39c3b,_0x29e1ba[_0x5c53('0xa')],_0x52e0de));}function handleFindAgent(_0x2c602a){return function(_0x59bfb3){return _0x59bfb3[_0x5c53('0xa')]['toLowerCase']()===_0x2c602a[_0x5c53('0xb')]();};}exports[_0x5c53('0xc')]=function(_0xd39c1,_0x2c55d2,_0xde673d,_0x3468d0){return function(_0x1e14c2){try{var _0x446d95={'name':_0x2c55d2[0x0],'timeout':_0x2c55d2[0x1]};var _0x280ccd=queue['validate'](_0x446d95,{'typecast':!![]});if(_0x280ccd[_0x5c53('0xd')]){logger['error']('[%s][AGENT]\x20%s',_0xd39c1,_[_0x5c53('0xe')](_0x280ccd,'message')[_0x5c53('0xf')](',\x20'));_0x1e14c2[_0x5c53('0x10')]();}else{var _0x161110=_[_0x5c53('0x11')](_0xde673d['agents'],handleFindAgent(_0x446d95[_0x5c53('0xa')]));if(_0x161110){var _0x1a0a4e=(_0x446d95[_0x5c53('0x12')]||0xa)*0x3e8;var _0x3315b0,_0x3b0a01;var _0x3f0cbc=seqqueue[_0x5c53('0x13')](_0x1a0a4e);_0x3f0cbc['id']=_0xd39c1;_0x3f0cbc[_0x5c53('0x14')]=_0x1a0a4e;_0x3f0cbc[_0x5c53('0x15')]=_0x3468d0[_0x5c53('0x15')];writeLog(_0xd39c1,_0x161110,util[_0x5c53('0x8')](_0x5c53('0x16'),_0x1a0a4e));_0xde673d[_0x5c53('0x17')][_0xd39c1]['on'](_0x5c53('0x18'),function(){logger[_0x5c53('0x7')](_0x5c53('0x19'),_0xd39c1);clearTimeout(_0x3b0a01);_0x3b0a01=undefined;_0x3f0cbc['close']();if(_0xde673d[_0x5c53('0x17')][_0xd39c1]){delete _0xde673d[_0x5c53('0x17')][_0xd39c1];}_0x1e14c2[_0x5c53('0x10')]();});_0xde673d[_0x5c53('0x17')][_0xd39c1]['on'](_0x5c53('0x1a'),function(){if(_0xde673d[_0x5c53('0x17')][_0xd39c1]){delete _0xde673d[_0x5c53('0x17')][_0xd39c1];}});_0x3b0a01=setTimeout(function(){logger[_0x5c53('0x7')](_0x5c53('0x1b'),_0xd39c1);clearTimeout(_0x3b0a01);_0x3f0cbc[_0x5c53('0x1c')]();_0x1e14c2[_0x5c53('0x1d')]();},_0x1a0a4e);strategy[_0x5c53('0x1e')](_0x3f0cbc,_0x161110,_0xde673d,_0x3468d0);}else{logger[_0x5c53('0x1f')](_0x5c53('0x20'),_0xd39c1,_0x446d95[_0x5c53('0xa')]);_0x1e14c2[_0x5c53('0x10')]();}}}catch(_0x5f4303){console[_0x5c53('0x21')](_0x5f4303);logger[_0x5c53('0x1f')](_0x5c53('0x22'),_0xd39c1,_0x5f4303[_0x5c53('0x23')]);_0x1e14c2['stop']();}};}; \ No newline at end of file +var _0x9db3=['[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','close','agent','error','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','length'];(function(_0x4cc47f,_0x4cb0b1){var _0xdd747e=function(_0x1a6e57){while(--_0x1a6e57){_0x4cc47f['push'](_0x4cc47f['shift']());}};_0xdd747e(++_0x4cb0b1);}(_0x9db3,0x194));var _0x39db=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9db3[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0x39db('0x0'));var _=require(_0x39db('0x1'));var util=require(_0x39db('0x2'));var seqqueue=require(_0x39db('0x3'));var logger=require(_0x39db('0x4'))(_0x39db('0x5'));var strategy=require(_0x39db('0x6'));var queue=schema({'name':{'type':_0x39db('0x7'),'required':!![],'message':_0x39db('0x8')},'timeout':{'type':_0x39db('0x9'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x12e799,_0x324bcb,_0x178dd7){return logger[_0x39db('0xa')](util[_0x39db('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x12e799,_0x324bcb[_0x39db('0xc')],_0x178dd7));}function handleFindAgent(_0x34f5fa){return function(_0x1fc672){return _0x1fc672[_0x39db('0xc')][_0x39db('0xd')]()===_0x34f5fa[_0x39db('0xd')]();};}exports[_0x39db('0xe')]=function(_0x26ba81,_0x4da079,_0x2192d0,_0x3e8fc3){return function(_0x4af0cd){try{var _0x1a794c={'name':_0x4da079[0x0],'timeout':_0x4da079[0x1]};var _0x57f729=queue[_0x39db('0x0')](_0x1a794c,{'typecast':!![]});if(_0x57f729[_0x39db('0xf')]){logger['error'](_0x39db('0x10'),_0x26ba81,_[_0x39db('0x11')](_0x57f729,_0x39db('0x12'))['join'](',\x20'));_0x4af0cd[_0x39db('0x13')]();}else{var _0x31bb7e=_[_0x39db('0x14')](_0x2192d0[_0x39db('0x15')],handleFindAgent(_0x1a794c[_0x39db('0xc')]));if(_0x31bb7e){var _0x2ca75d=(_0x1a794c[_0x39db('0x16')]||0xa)*0x3e8;var _0x4a34f5,_0x2e3d98;var _0x471e2b=seqqueue['createQueue'](_0x2ca75d);_0x471e2b['id']=_0x26ba81;_0x471e2b[_0x39db('0x17')]=_0x2ca75d;_0x471e2b[_0x39db('0x18')]=_0x3e8fc3['channel'];writeLog(_0x26ba81,_0x31bb7e,util[_0x39db('0xb')]('START:%s',_0x2ca75d));_0x2192d0[_0x39db('0x19')][_0x26ba81]['on'](_0x39db('0x1a'),function(){logger['info'](_0x39db('0x1b'),_0x26ba81);clearTimeout(_0x2e3d98);_0x2e3d98=undefined;_0x471e2b['close']();if(_0x2192d0[_0x39db('0x19')][_0x26ba81]){delete _0x2192d0[_0x39db('0x19')][_0x26ba81];}_0x4af0cd['stop']();});_0x2192d0[_0x39db('0x19')][_0x26ba81]['on']('complete',function(){if(_0x2192d0['rules'][_0x26ba81]){delete _0x2192d0[_0x39db('0x19')][_0x26ba81];}});_0x2e3d98=setTimeout(function(){logger['info'](_0x39db('0x1c'),_0x26ba81);clearTimeout(_0x2e3d98);_0x471e2b[_0x39db('0x1d')]();_0x4af0cd['next']();},_0x2ca75d);strategy[_0x39db('0x1e')](_0x471e2b,_0x31bb7e,_0x2192d0,_0x3e8fc3);}else{logger[_0x39db('0x1f')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x26ba81,_0x1a794c['name']);_0x4af0cd[_0x39db('0x13')]();}}}catch(_0x23cc73){console[_0x39db('0x20')](_0x23cc73);logger[_0x39db('0x1f')](_0x39db('0x21'),_0x26ba81,_0x23cc73[_0x39db('0x22')]);_0x4af0cd[_0x39db('0x13')]();}};}; \ 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 75a48f0..a8799ec 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 _0x1261=['error','amazonlex','Message','then','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','catch','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','postText'];(function(_0x101152,_0x397ab0){var _0xe1c465=function(_0x25de02){while(--_0x25de02){_0x101152['push'](_0x101152['shift']());}};_0xe1c465(++_0x397ab0);}(_0x1261,0x144));var _0x1126=function(_0x3e6647,_0x2c0d09){_0x3e6647=_0x3e6647-0x0;var _0x46bddd=_0x1261[_0x3e6647];return _0x46bddd;};'use strict';var _=require('lodash');var moment=require(_0x1126('0x0'));var AWS=require(_0x1126('0x1'));var utils=require(_0x1126('0x2'));var logger=require(_0x1126('0x3'))(_0x1126('0x4'));var rpc={'chatMessage':require(_0x1126('0x5')),'openchannelMessage':require(_0x1126('0x6')),'mailMessage':require(_0x1126('0x7')),'smsMessage':require(_0x1126('0x8')),'faxMessage':require(_0x1126('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x40ba58,_0x907180){return function(_0x4f239c){try{if(!_[_0x1126('0xa')](this[_0x1126('0xb')][_0x1126('0xc')])){logger[_0x1126('0xd')](_0x1126('0xe'),_0x40ba58,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4f239c[_0x1126('0xf')]();}var _0x18dbe6={'ContactId':this[_0x1126('0x10')]['id'],'sentAt':moment()['format'](_0x1126('0x11')),'direction':'out'};var _0x52ef15=this[_0x1126('0x12')];if(_0x52ef15==='chat'){_0x18dbe6[_0x1126('0x13')]=this[_0x1126('0x14')]['id'];}else{_0x18dbe6[_[_0x1126('0x15')](_0x52ef15)+_0x1126('0x16')]=this[_0x1126('0x14')]['id'];}_0x18dbe6[_[_0x1126('0x15')](_0x52ef15)+_0x1126('0x17')]=this[_0x1126('0xb')]['id'];if(this[_0x1126('0xb')]['created']){var _0x5de9a7=_0x907180[0x4];if(!_[_0x1126('0x18')](_0x5de9a7)){_0x18dbe6[_0x1126('0x19')]=utils[_0x1126('0x1a')](_0x5de9a7,this);return rpc[_0x52ef15+'Message'][_0x1126('0x1b')](_0x18dbe6)['then'](function(_0x35fe9f){logger[_0x1126('0xd')](_0x1126('0xe'),_0x40ba58,_0x18dbe6['body']);})[_0x1126('0x1c')](function(_0x1695f6){logger['error']('[%s][AMAZONLEX]\x20%s',_0x40ba58,JSON[_0x1126('0x1d')](_0x1695f6));})[_0x1126('0x1e')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x40ba58);_0x4f239c[_0x1126('0x1f')]();});}else{logger['info'](_0x1126('0x20'),_0x40ba58);_0x4f239c[_0x1126('0x1f')]();}}else{var _0x2f70ac=this;var _0x54400a=new AWS[(_0x1126('0x21'))]({'accessKeyId':_0x907180[0x0],'secretAccessKey':_0x907180[0x1],'region':_0x907180[0x2]});var _0x49d209={'botAlias':'$LATEST','botName':_0x907180[0x3],'inputText':this[_0x1126('0x22')][_0x1126('0x19')],'userId':this[_0x1126('0x12')]+':'+this[_0x1126('0xb')]['id']['toString']()};_0x54400a[_0x1126('0x23')](_0x49d209,function(_0x477e6a,_0x48a08d){if(_0x477e6a){logger[_0x1126('0x24')]('[%s][AMAZONLEX]\x20%s',_0x40ba58,_0x477e6a['message']);_0x4f239c['next']();}else if(_0x48a08d&&_0x48a08d[_0x1126('0x22')]){_0x2f70ac[_0x1126('0x19')][_0x1126('0x25')]=_0x48a08d;_0x18dbe6[_0x1126('0x19')]=_0x48a08d[_0x1126('0x22')];return rpc[_0x52ef15+_0x1126('0x26')][_0x1126('0x1b')](_0x18dbe6)[_0x1126('0x27')](function(_0x589725){logger[_0x1126('0xd')](_0x1126('0xe'),_0x40ba58,_0x18dbe6[_0x1126('0x19')]);if(_0x48a08d['dialogState']=='Failed'){_0x4f239c[_0x1126('0xf')]();}else{_0x4f239c[_0x1126('0x1f')]();}})['catch'](function(_0x2fb797){logger[_0x1126('0x24')]('[%s][AMAZONLEX]\x20%s',_0x40ba58,JSON[_0x1126('0x1d')](_0x2fb797));_0x4f239c['next']();});}else{_0x4f239c[_0x1126('0xf')]();}});}}catch(_0x4bd50b){logger[_0x1126('0x24')]('[%s][AMAZONLEX]\x20%s',_0x40ba58,JSON[_0x1126('0x1d')](_0x4bd50b));_0x4f239c['stop']();}};}; \ No newline at end of file +var _0x814b=['Message','create','then','stringify','stop','message','toString','postText','error','amazonlex','dialogState','Failed','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender'];(function(_0x2ad63e,_0x471b18){var _0xbd8942=function(_0x4b312c){while(--_0x4b312c){_0x2ad63e['push'](_0x2ad63e['shift']());}};_0xbd8942(++_0x471b18);}(_0x814b,0x1a2));var _0xb814=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0x814b[_0x324e86];return _0x592846;};'use strict';var _=require(_0xb814('0x0'));var moment=require(_0xb814('0x1'));var AWS=require(_0xb814('0x2'));var utils=require(_0xb814('0x3'));var logger=require(_0xb814('0x4'))(_0xb814('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xb814('0x6')),'mailMessage':require(_0xb814('0x7')),'smsMessage':require(_0xb814('0x8')),'faxMessage':require(_0xb814('0x9')),'whatsappMessage':require(_0xb814('0xa'))};exports[_0xb814('0xb')]=function(_0x53e507,_0x3b0829){return function(_0x2e6272){try{if(!_['isNil'](this[_0xb814('0xc')][_0xb814('0xd')])){logger[_0xb814('0xe')](_0xb814('0xf'),_0x53e507,_0xb814('0x10'));return _0x2e6272[_0xb814('0x11')]();}var _0x1086f8={'ContactId':this[_0xb814('0x12')]['id'],'sentAt':moment()[_0xb814('0x13')](_0xb814('0x14')),'direction':_0xb814('0x15')};var _0x4b5f14=this[_0xb814('0x16')];if(_0x4b5f14==='chat'){_0x1086f8[_0xb814('0x17')]=this[_0xb814('0x18')]['id'];}else{_0x1086f8[_[_0xb814('0x19')](_0x4b5f14)+_0xb814('0x1a')]=this[_0xb814('0x18')]['id'];}_0x1086f8[_[_0xb814('0x19')](_0x4b5f14)+_0xb814('0x1b')]=this[_0xb814('0xc')]['id'];if(this[_0xb814('0xc')][_0xb814('0x1c')]){var _0x3f4881=_0x3b0829[0x4];if(!_[_0xb814('0x1d')](_0x3f4881)){_0x1086f8[_0xb814('0x1e')]=utils[_0xb814('0x1f')](_0x3f4881,this);return rpc[_0x4b5f14+_0xb814('0x20')][_0xb814('0x21')](_0x1086f8)[_0xb814('0x22')](function(_0x265a83){logger[_0xb814('0xe')](_0xb814('0xf'),_0x53e507,_0x1086f8[_0xb814('0x1e')]);})['catch'](function(_0x168a48){logger['error'](_0xb814('0xf'),_0x53e507,JSON[_0xb814('0x23')](_0x168a48));})['finally'](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x53e507);_0x2e6272[_0xb814('0x24')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x53e507);_0x2e6272[_0xb814('0x24')]();}}else{var _0x24211d=this;var _0x25b6b6=new AWS['LexRuntime']({'accessKeyId':_0x3b0829[0x0],'secretAccessKey':_0x3b0829[0x1],'region':_0x3b0829[0x2]});var _0xf5b8aa={'botAlias':'$LATEST','botName':_0x3b0829[0x3],'inputText':this[_0xb814('0x25')][_0xb814('0x1e')],'userId':this[_0xb814('0x16')]+':'+this[_0xb814('0xc')]['id'][_0xb814('0x26')]()};_0x25b6b6[_0xb814('0x27')](_0xf5b8aa,function(_0x1f5d40,_0x594470){if(_0x1f5d40){logger[_0xb814('0x28')]('[%s][AMAZONLEX]\x20%s',_0x53e507,_0x1f5d40[_0xb814('0x25')]);_0x2e6272[_0xb814('0x11')]();}else if(_0x594470&&_0x594470[_0xb814('0x25')]){_0x24211d[_0xb814('0x1e')][_0xb814('0x29')]=_0x594470;_0x1086f8[_0xb814('0x1e')]=_0x594470[_0xb814('0x25')];return rpc[_0x4b5f14+'Message'][_0xb814('0x21')](_0x1086f8)[_0xb814('0x22')](function(_0x1c2625){logger[_0xb814('0xe')](_0xb814('0xf'),_0x53e507,_0x1086f8[_0xb814('0x1e')]);if(_0x594470[_0xb814('0x2a')]==_0xb814('0x2b')){_0x2e6272['next']();}else{_0x2e6272[_0xb814('0x24')]();}})[_0xb814('0x2c')](function(_0x52ed64){logger[_0xb814('0x28')](_0xb814('0xf'),_0x53e507,JSON[_0xb814('0x23')](_0x52ed64));_0x2e6272['next']();});}else{_0x2e6272[_0xb814('0x11')]();}});}}catch(_0x2051d0){logger['error'](_0xb814('0xf'),_0x53e507,JSON['stringify'](_0x2051d0));_0x2e6272[_0xb814('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 3dd29fd..74bed64 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 _0xeee4=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','next','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','inReplyTo','messageId','html','','replace','body','';return mailRpc['sendMailMessage'](_0x59eb07,_0x1844de)['then'](function(_0x34f5b4){logger[_0x4eee('0x10')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x551154);_0x1844de['messageId']=_0x34f5b4[_0x4eee('0x17')][_0x4eee('0x30')];return rpc[_0x3a7139+'Message'][_0x4eee('0x37')](_0x1844de);})[_0x4eee('0x38')](function(_0x5651de){logger[_0x4eee('0x10')](_0x4eee('0x39'),_0x551154,JSON[_0x4eee('0x3a')](_0x5651de));})[_0x4eee('0x3b')](function(_0x2370dc){logger[_0x4eee('0x3c')](_0x4eee('0x3d'),_0x551154,JSON[_0x4eee('0x3a')](_0x2370dc));})[_0x4eee('0x3e')](function(){_0xa874ef[_0x4eee('0x11')]();});}else{return rpc[this[_0x4eee('0x12')]+'Message']['create'](_0x1844de)[_0x4eee('0x38')](function(_0x4dbca9){logger['info'](_0x4eee('0x39'),_0x551154,_0x1844de[_0x4eee('0x34')]);})[_0x4eee('0x3b')](function(_0x3c8a80){logger['error'](_0x4eee('0x39'),_0x551154,JSON[_0x4eee('0x3a')](_0x3c8a80));})['finally'](function(){_0xa874ef[_0x4eee('0x11')]();});}}}catch(_0xde236d){logger['error'](_0x4eee('0x39'),_0x551154,JSON[_0x4eee('0x3a')](_0xde236d));_0xa874ef[_0x4eee('0x3f')]();}};}; \ No newline at end of file +var _0x99b1=['format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','','replace','';return mailRpc[_0x199b('0x32')](_0x346f79,_0x22faa4)['then'](function(_0x21bde1){logger[_0x199b('0xd')](_0x199b('0x33'),_0xa84792);_0x22faa4['messageId']=_0x21bde1['message']['messageId'];return rpc[_0x34b98f+_0x199b('0x22')][_0x199b('0x34')](_0x22faa4);})[_0x199b('0x35')](function(_0x556bdb){logger['info']('[%s][AUTOREPLY]\x20%s',_0xa84792,JSON[_0x199b('0x36')](_0x556bdb));})[_0x199b('0x37')](function(_0x21a193){logger[_0x199b('0x38')](_0x199b('0x39'),_0xa84792,JSON[_0x199b('0x36')](_0x21a193));})['finally'](function(){_0x37dc77[_0x199b('0x3a')]();});}else{return rpc[this[_0x199b('0xf')]+'Message']['create'](_0x22faa4)[_0x199b('0x35')](function(_0x67f72f){logger[_0x199b('0xd')](_0x199b('0x3b'),_0xa84792,_0x22faa4[_0x199b('0x3c')]);})['catch'](function(_0x448c61){logger['error'](_0x199b('0x3b'),_0xa84792,JSON[_0x199b('0x36')](_0x448c61));})[_0x199b('0x3d')](function(){_0x37dc77[_0x199b('0x3a')]();});}}}catch(_0xb0fb0){logger[_0x199b('0x38')](_0x199b('0x3b'),_0xa84792,JSON[_0x199b('0x36')](_0xb0fb0));_0x37dc77[_0x199b('0x3e')]();}};}; \ 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 45ce2f5..0b2cfea 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 _0x8b52=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','system','channel','Interaction','interaction','then','error','stringify','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x4f457c,_0x15cdeb){var _0x3046a0=function(_0x314c65){while(--_0x314c65){_0x4f457c['push'](_0x4f457c['shift']());}};_0x3046a0(++_0x15cdeb);}(_0x8b52,0x151));var _0x28b5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8b52[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0x28b5('0x0'));var logger=require(_0x28b5('0x1'))(_0x28b5('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x28b5('0x3')),'smsInteraction':require(_0x28b5('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x28b5('0x5')),'whatsappInteraction':require(_0x28b5('0x6'))};exports[_0x28b5('0x7')]=function(_0x226981,_0x2f9c42,_0x17c21a,_0x42573d){return function(_0xca79de){try{logger[_0x28b5('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x226981,_0x2f9c42[0x0]);var _0x1fc3a0={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x28b5('0x9'),'disposition':_0x2f9c42[0x0]};if(rpc[_0x42573d[_0x28b5('0xa')]+'Interaction']){rpc[_0x42573d[_0x28b5('0xa')]+_0x28b5('0xb')]['update'](_0x42573d[_0x28b5('0xc')]['id'],_0x1fc3a0)[_0x28b5('0xd')](function(_0x3e6ef){logger[_0x28b5('0x8')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x226981,_0x42573d[_0x28b5('0xc')]['id']);})['catch'](function(_0xc18108){logger[_0x28b5('0xe')]('[%s][CLOSE]\x20%s',_0x226981,JSON[_0x28b5('0xf')](_0xc18108));})['finally'](function(){_0xca79de[_0x28b5('0x10')]();});}}catch(_0x4a684e){logger['error'](_0x28b5('0x11'),_0x226981,JSON[_0x28b5('0xf')](_0x4a684e));_0xca79de['stop']();}};}; \ No newline at end of file +var _0xc1fa=['../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction'];(function(_0x1c1075,_0x184a6d){var _0x3545a3=function(_0x31d646){while(--_0x31d646){_0x1c1075['push'](_0x1c1075['shift']());}};_0x3545a3(++_0x184a6d);}(_0xc1fa,0x83));var _0xac1f=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0xc1fa[_0x53b8e0];return _0x10630c;};'use strict';var moment=require(_0xac1f('0x0'));var logger=require(_0xac1f('0x1'))(_0xac1f('0x2'));var rpc={'chatInteraction':require(_0xac1f('0x3')),'openchannelInteraction':require(_0xac1f('0x4')),'smsInteraction':require(_0xac1f('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xac1f('0x6')),'whatsappInteraction':require(_0xac1f('0x7'))};exports[_0xac1f('0x8')]=function(_0x271b4b,_0x2af76e,_0x4342a5,_0x38bd1d){return function(_0x406495){try{logger[_0xac1f('0x9')](_0xac1f('0xa'),_0x271b4b,_0x2af76e[0x0]);var _0x33d385={'closed':0x1,'closedAt':moment()[_0xac1f('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xac1f('0xc'),'disposition':_0x2af76e[0x0]};if(rpc[_0x38bd1d[_0xac1f('0xd')]+_0xac1f('0xe')]){rpc[_0x38bd1d[_0xac1f('0xd')]+_0xac1f('0xe')]['update'](_0x38bd1d['interaction']['id'],_0x33d385)[_0xac1f('0xf')](function(_0x5a1bad){logger['info'](_0xac1f('0x10'),_0x271b4b,_0x38bd1d[_0xac1f('0x11')]['id']);})['catch'](function(_0x1be117){logger[_0xac1f('0x12')](_0xac1f('0x13'),_0x271b4b,JSON[_0xac1f('0x14')](_0x1be117));})[_0xac1f('0x15')](function(){_0x406495[_0xac1f('0x16')]();});}}catch(_0x3b9790){logger[_0xac1f('0x12')](_0xac1f('0x13'),_0x271b4b,JSON[_0xac1f('0x14')](_0x3b9790));_0x406495[_0xac1f('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 680791f..1f2b0e7 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 _0xb15d=['finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','chat','upperFirst','AccountId','account','InteractionId','interaction','created','body','Message','then','catch','error','stringify'];(function(_0x54fcca,_0x440202){var _0x152ece=function(_0x1480a){while(--_0x1480a){_0x54fcca['push'](_0x54fcca['shift']());}};_0x152ece(++_0x440202);}(_0xb15d,0x1a2));var _0xdb15=function(_0x42c967,_0x3d0a7c){_0x42c967=_0x42c967-0x0;var _0x150a97=_0xb15d[_0x42c967];return _0x150a97;};'use strict';var _=require(_0xdb15('0x0'));var moment=require(_0xdb15('0x1'));var apiai=require(_0xdb15('0x2'));var md5=require(_0xdb15('0x3'));var utils=require(_0xdb15('0x4'));var logger=require(_0xdb15('0x5'))(_0xdb15('0x6'));var rpc={'chatMessage':require(_0xdb15('0x7')),'openchannelMessage':require(_0xdb15('0x8')),'mailMessage':require(_0xdb15('0x9')),'smsMessage':require(_0xdb15('0xa')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xdb15('0xb')]=function(_0x4ba61f,_0x329a50){return function(_0x1f687e){try{if(!_[_0xdb15('0xc')](this['interaction'][_0xdb15('0xd')])){logger[_0xdb15('0xe')](_0xdb15('0xf'),_0x4ba61f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1f687e[_0xdb15('0x10')]();}var _0x10705d={'ContactId':this[_0xdb15('0x11')]['id'],'sentAt':moment()[_0xdb15('0x12')](_0xdb15('0x13')),'direction':'out'};var _0x3346ed=this['channel'];if(_0x3346ed===_0xdb15('0x14')){_0x10705d['ChatWebsiteId']=this['account']['id'];}else{_0x10705d[_[_0xdb15('0x15')](_0x3346ed)+_0xdb15('0x16')]=this[_0xdb15('0x17')]['id'];}_0x10705d[_[_0xdb15('0x15')](_0x3346ed)+_0xdb15('0x18')]=this[_0xdb15('0x19')]['id'];if(this[_0xdb15('0x19')][_0xdb15('0x1a')]){var _0x2c37a8=_0x329a50[0x2];if(!_['isEmpty'](_0x2c37a8)){_0x10705d[_0xdb15('0x1b')]=utils['getMustacheRender'](_0x2c37a8,this);return rpc[_0x3346ed+_0xdb15('0x1c')]['create'](_0x10705d)[_0xdb15('0x1d')](function(_0x1a52d4){logger[_0xdb15('0xe')](_0xdb15('0xf'),_0x4ba61f,_0x10705d[_0xdb15('0x1b')]);})[_0xdb15('0x1e')](function(_0x2be951){logger[_0xdb15('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x4ba61f,JSON[_0xdb15('0x20')](_0x2be951));})[_0xdb15('0x21')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4ba61f);_0x1f687e[_0xdb15('0x22')]();});}else{logger['info'](_0xdb15('0x23'),_0x4ba61f);_0x1f687e[_0xdb15('0x22')]();}}else{var _0x326aa9=this;var _0x24626c=apiai(_0x329a50[0x0],{'language':_0x329a50[0x1]||'en'});return _0x24626c[_0xdb15('0x24')](this[_0xdb15('0x25')]['body'],{'sessionId':md5(this['interaction']['id'])})[_0xdb15('0x1d')](function(_0x4f837e){_0x326aa9['body'][_0xdb15('0x26')]=_0x4f837e;_0x10705d[_0xdb15('0x1b')]=_0x4f837e['result'][_0xdb15('0x27')]['speech'];return rpc[_0x3346ed+'Message']['create'](_0x10705d)[_0xdb15('0x1d')](function(_0x1df16a){logger[_0xdb15('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x4ba61f,_0x10705d[_0xdb15('0x1b')]);if(_0x4f837e['result']['metadata'][_0xdb15('0x28')]){_0x1f687e['next']();}else{_0x1f687e['stop']();}})[_0xdb15('0x1e')](function(_0x4f4e2b){logger[_0xdb15('0x1f')](_0xdb15('0xf'),_0x4ba61f,JSON[_0xdb15('0x20')](_0x4f4e2b));_0x1f687e[_0xdb15('0x10')]();});})[_0xdb15('0x1e')](function(_0x4c29d2){logger[_0xdb15('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x4ba61f,_0x4c29d2[_0xdb15('0x25')]);_0x1f687e[_0xdb15('0x10')]();});}}catch(_0x4f14b2){logger['error'](_0xdb15('0xf'),_0x4ba61f,JSON[_0xdb15('0x20')](_0x4f14b2));_0x1f687e[_0xdb15('0x22')]();}};}; \ No newline at end of file +var _0xbcfd=['stop','textRequest','dialogflow','speech','result','metadata','endConversation','message','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x5e6e23,_0x521b60){var _0x3d328c=function(_0x36552e){while(--_0x36552e){_0x5e6e23['push'](_0x5e6e23['shift']());}};_0x3d328c(++_0x521b60);}(_0xbcfd,0x1a6));var _0xdbcf=function(_0x4a2fde,_0xfb92ae){_0x4a2fde=_0x4a2fde-0x0;var _0x1042c3=_0xbcfd[_0x4a2fde];return _0x1042c3;};'use strict';var _=require(_0xdbcf('0x0'));var moment=require('moment');var apiai=require(_0xdbcf('0x1'));var md5=require(_0xdbcf('0x2'));var utils=require(_0xdbcf('0x3'));var logger=require(_0xdbcf('0x4'))(_0xdbcf('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xdbcf('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xdbcf('0x7')),'faxMessage':require(_0xdbcf('0x8')),'whatsappMessage':require(_0xdbcf('0x9'))};exports[_0xdbcf('0xa')]=function(_0x5ef3f7,_0x4e0fc8){return function(_0x46896c){try{if(!_['isNil'](this[_0xdbcf('0xb')][_0xdbcf('0xc')])){logger[_0xdbcf('0xd')](_0xdbcf('0xe'),_0x5ef3f7,_0xdbcf('0xf'));return _0x46896c[_0xdbcf('0x10')]();}var _0x2d30f9={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xdbcf('0x11')),'direction':'out'};var _0x3c77c0=this[_0xdbcf('0x12')];if(_0x3c77c0===_0xdbcf('0x13')){_0x2d30f9[_0xdbcf('0x14')]=this['account']['id'];}else{_0x2d30f9[_[_0xdbcf('0x15')](_0x3c77c0)+_0xdbcf('0x16')]=this[_0xdbcf('0x17')]['id'];}_0x2d30f9[_[_0xdbcf('0x15')](_0x3c77c0)+_0xdbcf('0x18')]=this[_0xdbcf('0xb')]['id'];if(this[_0xdbcf('0xb')][_0xdbcf('0x19')]){var _0x4a32e3=_0x4e0fc8[0x2];if(!_[_0xdbcf('0x1a')](_0x4a32e3)){_0x2d30f9['body']=utils[_0xdbcf('0x1b')](_0x4a32e3,this);return rpc[_0x3c77c0+_0xdbcf('0x1c')][_0xdbcf('0x1d')](_0x2d30f9)[_0xdbcf('0x1e')](function(_0x4d059a){logger['info'](_0xdbcf('0xe'),_0x5ef3f7,_0x2d30f9[_0xdbcf('0x1f')]);})[_0xdbcf('0x20')](function(_0x185119){logger[_0xdbcf('0x21')](_0xdbcf('0xe'),_0x5ef3f7,JSON[_0xdbcf('0x22')](_0x185119));})[_0xdbcf('0x23')](function(){logger['info'](_0xdbcf('0x24'),_0x5ef3f7);_0x46896c['stop']();});}else{logger['info'](_0xdbcf('0x25'),_0x5ef3f7);_0x46896c[_0xdbcf('0x26')]();}}else{var _0x8376f9=this;var _0x5f3488=apiai(_0x4e0fc8[0x0],{'language':_0x4e0fc8[0x1]||'en'});return _0x5f3488[_0xdbcf('0x27')](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})[_0xdbcf('0x1e')](function(_0x409569){_0x8376f9[_0xdbcf('0x1f')][_0xdbcf('0x28')]=_0x409569;_0x2d30f9[_0xdbcf('0x1f')]=_0x409569['result']['fulfillment'][_0xdbcf('0x29')];return rpc[_0x3c77c0+_0xdbcf('0x1c')]['create'](_0x2d30f9)[_0xdbcf('0x1e')](function(_0x390f77){logger[_0xdbcf('0xd')](_0xdbcf('0xe'),_0x5ef3f7,_0x2d30f9[_0xdbcf('0x1f')]);if(_0x409569[_0xdbcf('0x2a')][_0xdbcf('0x2b')][_0xdbcf('0x2c')]){_0x46896c[_0xdbcf('0x10')]();}else{_0x46896c['stop']();}})[_0xdbcf('0x20')](function(_0x245bcc){logger[_0xdbcf('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x5ef3f7,JSON[_0xdbcf('0x22')](_0x245bcc));_0x46896c['next']();});})[_0xdbcf('0x20')](function(_0x140169){logger[_0xdbcf('0x21')](_0xdbcf('0xe'),_0x5ef3f7,_0x140169[_0xdbcf('0x2d')]);_0x46896c[_0xdbcf('0x10')]();});}}catch(_0x4ab240){logger[_0xdbcf('0x21')](_0xdbcf('0xe'),_0x5ef3f7,JSON[_0xdbcf('0x22')](_0x4ab240));_0x46896c[_0xdbcf('0x26')]();}};}; \ 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 d58f83a..0ca54a3 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 _0x5675=['consequence','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','info','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','lodash','html-to-text','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number'];(function(_0x2d851a,_0x4c581f){var _0x50fccc=function(_0x789f6f){while(--_0x789f6f){_0x2d851a['push'](_0x2d851a['shift']());}};_0x50fccc(++_0x4c581f);}(_0x5675,0xe9));var _0x5567=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x5675[_0x15bc81];return _0x59440e;};'use strict';var schema=require('validate');var _=require(_0x5567('0x0'));var htmlToText=require(_0x5567('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0x5567('0x2'),'required':!![],'message':_0x5567('0x3')},'priorityTrue':{'type':_0x5567('0x4'),'message':_0x5567('0x5')},'priorityFalse':{'type':_0x5567('0x4'),'message':_0x5567('0x6')}});exports[_0x5567('0x7')]=function(_0x81fbbc,_0x24e7e7){return function(_0x3f9cb3){try{var _0x354b33={'condition':htmlToText[_0x5567('0x8')](utils[_0x5567('0x9')](_0x24e7e7[0x0],this),{'wordwrap':![]})[_0x5567('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x24e7e7[0x1],'priorityFalse':_0x24e7e7[0x2]};var _0x490971=gotoif[_0x5567('0xb')](_0x354b33,{'typecast':!![]});if(_0x490971[_0x5567('0xc')]){logger[_0x5567('0xd')](_0x5567('0xe'),_0x81fbbc,_[_0x5567('0xf')](_0x490971,'message')[_0x5567('0x10')](',\x20'));_0x3f9cb3[_0x5567('0x11')]();}else{try{var _0x1a118a=eval('('+_0x354b33['condition']+')');var _0x1aef49=_0x1a118a?_0x354b33[_0x5567('0x12')]:_0x354b33[_0x5567('0x13')];logger[_0x5567('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x81fbbc,_0x354b33[_0x5567('0x15')],_0x1a118a,_0x1aef49||_0x5567('0x16'));if(_0x1aef49){var _0x2083f9=_[_0x5567('0x17')](_0x3f9cb3[_0x5567('0x18')](),{'p':_0x1aef49});if(_0x2083f9>=0x0){logger['info'](_0x5567('0x19'),_0x81fbbc,_0x1aef49||_0x5567('0x16'),_0x2083f9);_0x3f9cb3[_0x5567('0x16')](_0x2083f9);}else{logger[_0x5567('0x14')](_0x5567('0x1a'),_0x81fbbc,_0x1aef49||'next');_0x3f9cb3[_0x5567('0x11')]();}}else{_0x3f9cb3[_0x5567('0x16')]();}}catch(_0x53a963){logger[_0x5567('0xd')](_0x5567('0x1b'),_0x81fbbc,_0x53a963[_0x5567('0x1c')]);_0x3f9cb3[_0x5567('0x11')]();}}}catch(_0x589285){logger[_0x5567('0xd')](_0x5567('0xe'),_0x81fbbc,JSON[_0x5567('0x1d')](_0x589285));_0x3f9cb3[_0x5567('0x11')]();}};}; \ No newline at end of file +var _0xe680=['map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','replace','error','[%s][GOTOIF]\x20%s'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0xe680,0x196));var _0x0e68=function(_0x24b852,_0x2bad67){_0x24b852=_0x24b852-0x0;var _0x180ad2=_0xe680[_0x24b852];return _0x180ad2;};'use strict';var schema=require(_0x0e68('0x0'));var _=require(_0x0e68('0x1'));var htmlToText=require(_0x0e68('0x2'));var utils=require(_0x0e68('0x3'));var logger=require(_0x0e68('0x4'))(_0x0e68('0x5'));var gotoif=schema({'condition':{'type':_0x0e68('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x0e68('0x7'),'message':_0x0e68('0x8')},'priorityFalse':{'type':_0x0e68('0x7'),'message':_0x0e68('0x9')}});exports['consequence']=function(_0x3327b8,_0x95fa40){return function(_0x288db3){try{var _0x49ad76={'condition':htmlToText[_0x0e68('0xa')](utils['getMustacheRender'](_0x95fa40[0x0],this),{'wordwrap':![]})[_0x0e68('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x95fa40[0x1],'priorityFalse':_0x95fa40[0x2]};var _0x15da1a=gotoif[_0x0e68('0x0')](_0x49ad76,{'typecast':!![]});if(_0x15da1a['length']){logger[_0x0e68('0xc')](_0x0e68('0xd'),_0x3327b8,_[_0x0e68('0xe')](_0x15da1a,_0x0e68('0xf'))[_0x0e68('0x10')](',\x20'));_0x288db3[_0x0e68('0x11')]();}else{try{var _0x22c0d7=eval('('+_0x49ad76[_0x0e68('0x12')]+')');var _0x30152=_0x22c0d7?_0x49ad76[_0x0e68('0x13')]:_0x49ad76[_0x0e68('0x14')];logger[_0x0e68('0x15')](_0x0e68('0x16'),_0x3327b8,_0x49ad76[_0x0e68('0x12')],_0x22c0d7,_0x30152||_0x0e68('0x17'));if(_0x30152){var _0x1cbeb6=_[_0x0e68('0x18')](_0x288db3[_0x0e68('0x19')](),{'p':_0x30152});if(_0x1cbeb6>=0x0){logger['info'](_0x0e68('0x1a'),_0x3327b8,_0x30152||_0x0e68('0x17'),_0x1cbeb6);_0x288db3[_0x0e68('0x17')](_0x1cbeb6);}else{logger[_0x0e68('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3327b8,_0x30152||'next');_0x288db3[_0x0e68('0x11')]();}}else{_0x288db3[_0x0e68('0x17')]();}}catch(_0x582863){logger[_0x0e68('0xc')](_0x0e68('0x1b'),_0x3327b8,_0x582863[_0x0e68('0xf')]);_0x288db3['stop']();}}}catch(_0x571d53){logger[_0x0e68('0xc')]('[%s][GOTOIF]\x20%s',_0x3327b8,JSON['stringify'](_0x571d53));_0x288db3['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 68e9518..9005bb0 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 _0x2493=['lodash','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2493,0x1cb));var _0x3249=function(_0x528851,_0x2ef14a){_0x528851=_0x528851-0x0;var _0x1fac65=_0x2493[_0x528851];return _0x1fac65;};'use strict';var schema=require(_0x3249('0x0'));var _=require(_0x3249('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':_0x3249('0x2'),'required':!![],'message':_0x3249('0x3')}});exports[_0x3249('0x4')]=function(_0x484fc8,_0x1b1962){return function(_0x20dce1){try{var _0x2a97a2={'priority':_0x1b1962[0x0]};var _0x593fcb=gotop[_0x3249('0x0')](_0x2a97a2,{'typecast':!![]});if(_0x593fcb[_0x3249('0x5')]){logger[_0x3249('0x6')](_0x3249('0x7'),_0x484fc8,_[_0x3249('0x8')](_0x593fcb,_0x3249('0x9'))[_0x3249('0xa')](',\x20'));_0x20dce1[_0x3249('0xb')]();}else{logger[_0x3249('0xc')](_0x3249('0xd'),_0x484fc8,_0x2a97a2['priority']);if(_0x2a97a2[_0x3249('0xe')]){var _0x42571c=_[_0x3249('0xf')](_0x20dce1[_0x3249('0x10')](),{'p':_0x2a97a2[_0x3249('0xe')]});if(_0x42571c>=0x0){logger[_0x3249('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x484fc8,_0x2a97a2['priority']||_0x3249('0x11'),_0x42571c);_0x20dce1['next'](_0x42571c);}else{logger[_0x3249('0xc')](_0x3249('0x12'),_0x484fc8,_0x2a97a2[_0x3249('0xe')]||_0x3249('0x11'));_0x20dce1['stop']();}}else{_0x20dce1['next']();}}}catch(_0x32c8dc){logger[_0x3249('0x6')](_0x3249('0x7'),_0x484fc8,JSON[_0x3249('0x13')](_0x32c8dc));_0x20dce1[_0x3249('0xb')]();}};}; \ No newline at end of file +var _0xed34=['rules','priority','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex'];(function(_0x221fbe,_0x16bc47){var _0x51c3eb=function(_0x1dc3c3){while(--_0x1dc3c3){_0x221fbe['push'](_0x221fbe['shift']());}};_0x51c3eb(++_0x16bc47);}(_0xed34,0x100));var _0x4ed3=function(_0x209951,_0xb059cf){_0x209951=_0x209951-0x0;var _0x3ec869=_0xed34[_0x209951];return _0x3ec869;};'use strict';var schema=require(_0x4ed3('0x0'));var _=require(_0x4ed3('0x1'));var logger=require('../../../../config/logger')(_0x4ed3('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x4ed3('0x3')}});exports['consequence']=function(_0x2fbddb,_0x30588b){return function(_0x1de940){try{var _0x18fdfb={'priority':_0x30588b[0x0]};var _0x412446=gotop[_0x4ed3('0x0')](_0x18fdfb,{'typecast':!![]});if(_0x412446[_0x4ed3('0x4')]){logger[_0x4ed3('0x5')](_0x4ed3('0x6'),_0x2fbddb,_[_0x4ed3('0x7')](_0x412446,_0x4ed3('0x8'))[_0x4ed3('0x9')](',\x20'));_0x1de940[_0x4ed3('0xa')]();}else{logger[_0x4ed3('0xb')](_0x4ed3('0xc'),_0x2fbddb,_0x18fdfb['priority']);if(_0x18fdfb['priority']){var _0x404b21=_[_0x4ed3('0xd')](_0x1de940[_0x4ed3('0xe')](),{'p':_0x18fdfb[_0x4ed3('0xf')]});if(_0x404b21>=0x0){logger[_0x4ed3('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x2fbddb,_0x18fdfb[_0x4ed3('0xf')]||_0x4ed3('0x10'),_0x404b21);_0x1de940[_0x4ed3('0x10')](_0x404b21);}else{logger['info'](_0x4ed3('0x11'),_0x2fbddb,_0x18fdfb[_0x4ed3('0xf')]||_0x4ed3('0x10'));_0x1de940[_0x4ed3('0xa')]();}}else{_0x1de940[_0x4ed3('0x10')]();}}}catch(_0x829fcc){logger[_0x4ed3('0x5')](_0x4ed3('0x6'),_0x2fbddb,JSON['stringify'](_0x829fcc));_0x1de940[_0x4ed3('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index eadcb33..ae4c65c 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 _0x9b93=['../../rpc/whatsappMessage','getMustacheRender','channel','chat','account','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage'];(function(_0x56a020,_0x3065c6){var _0xc4220c=function(_0x2c15d6){while(--_0x2c15d6){_0x56a020['push'](_0x56a020['shift']());}};_0xc4220c(++_0x3065c6);}(_0x9b93,0xfd));var _0x39b9=function(_0xc694ff,_0x1498ad){_0xc694ff=_0xc694ff-0x0;var _0x59dba2=_0x9b93[_0xc694ff];return _0x59dba2;};'use strict';var _=require(_0x39b9('0x0'));var utils=require(_0x39b9('0x1'));var logger=require(_0x39b9('0x2'))('routing');var rpc={'chatMessage':require(_0x39b9('0x3')),'openchannelMessage':require(_0x39b9('0x4')),'mailMessage':require(_0x39b9('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x39b9('0x6')),'whatsappMessage':require(_0x39b9('0x7'))};exports['consequence']=function(_0xc460f7,_0x541aed){return function(_0x9b1724){try{var _0x57001e={'body':utils[_0x39b9('0x8')](_0x541aed[0x0],this),'ContactId':this['contact']['id']};if(this[_0x39b9('0x9')]===_0x39b9('0xa')){_0x57001e['ChatWebsiteId']=this[_0x39b9('0xb')]['id'];}else{_0x57001e[_['upperFirst'](this[_0x39b9('0x9')])+_0x39b9('0xc')]=this[_0x39b9('0xb')]['id'];}_0x57001e[_['upperFirst'](this['channel'])+_0x39b9('0xd')]=this[_0x39b9('0xe')]['id'];if(rpc[this[_0x39b9('0x9')]+_0x39b9('0xf')]){return rpc[this[_0x39b9('0x9')]+_0x39b9('0xf')][_0x39b9('0x10')](_0x57001e)[_0x39b9('0x11')](function(_0x430441){logger[_0x39b9('0x12')](_0x39b9('0x13'),_0xc460f7,_0x57001e[_0x39b9('0x14')]);_0x9b1724[_0x39b9('0x15')]();})[_0x39b9('0x16')](function(_0x233524){logger[_0x39b9('0x17')](_0x39b9('0x13'),_0xc460f7,JSON[_0x39b9('0x18')](_0x233524));_0x9b1724[_0x39b9('0x19')]();});}}catch(_0xa949f6){logger[_0x39b9('0x17')]('[%s][MESSAGE]\x20%s',_0xc460f7,JSON[_0x39b9('0x18')](_0xa949f6));_0x9b1724[_0x39b9('0x19')]();}};}; \ No newline at end of file +var _0x902e=['AccountId','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst'];(function(_0xf3faf0,_0x5c54af){var _0x3578d9=function(_0x582d24){while(--_0x582d24){_0xf3faf0['push'](_0xf3faf0['shift']());}};_0x3578d9(++_0x5c54af);}(_0x902e,0xed));var _0xe902=function(_0x1098fd,_0x4fe58b){_0x1098fd=_0x1098fd-0x0;var _0x5aba3b=_0x902e[_0x1098fd];return _0x5aba3b;};'use strict';var _=require('lodash');var utils=require(_0xe902('0x0'));var logger=require(_0xe902('0x1'))(_0xe902('0x2'));var rpc={'chatMessage':require(_0xe902('0x3')),'openchannelMessage':require(_0xe902('0x4')),'mailMessage':require(_0xe902('0x5')),'smsMessage':require(_0xe902('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe902('0x7'))};exports[_0xe902('0x8')]=function(_0x27121f,_0x22dd7e){return function(_0x480d8d){try{var _0x2cd12a={'body':utils[_0xe902('0x9')](_0x22dd7e[0x0],this),'ContactId':this[_0xe902('0xa')]['id']};if(this[_0xe902('0xb')]===_0xe902('0xc')){_0x2cd12a[_0xe902('0xd')]=this['account']['id'];}else{_0x2cd12a[_[_0xe902('0xe')](this[_0xe902('0xb')])+_0xe902('0xf')]=this['account']['id'];}_0x2cd12a[_[_0xe902('0xe')](this[_0xe902('0xb')])+_0xe902('0x10')]=this[_0xe902('0x11')]['id'];if(rpc[this[_0xe902('0xb')]+_0xe902('0x12')]){return rpc[this[_0xe902('0xb')]+_0xe902('0x12')]['create'](_0x2cd12a)[_0xe902('0x13')](function(_0x2c3581){logger[_0xe902('0x14')](_0xe902('0x15'),_0x27121f,_0x2cd12a[_0xe902('0x16')]);_0x480d8d[_0xe902('0x17')]();})[_0xe902('0x18')](function(_0x56ea1d){logger[_0xe902('0x19')]('[%s][MESSAGE]\x20%s',_0x27121f,JSON['stringify'](_0x56ea1d));_0x480d8d[_0xe902('0x1a')]();});}}catch(_0x109c48){logger[_0xe902('0x19')](_0xe902('0x15'),_0x27121f,JSON[_0xe902('0x1b')](_0x109c48));_0x480d8d[_0xe902('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 1692586..bc5c82f 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 _0x41dd=['getMustacheRender','next','error','stringify','stop','./utils','routing','info','[%s][NOOP]\x20%s'];(function(_0x118355,_0x201311){var _0x32f7ea=function(_0x4fd55b){while(--_0x4fd55b){_0x118355['push'](_0x118355['shift']());}};_0x32f7ea(++_0x201311);}(_0x41dd,0x11c));var _0xd41d=function(_0x1d0e52,_0x369837){_0x1d0e52=_0x1d0e52-0x0;var _0x4c5800=_0x41dd[_0x1d0e52];return _0x4c5800;};'use strict';var utils=require(_0xd41d('0x0'));var logger=require('../../../../config/logger')(_0xd41d('0x1'));exports['consequence']=function(_0x52200e,_0x3baec2){return function(_0x24b0c8){try{logger[_0xd41d('0x2')](_0xd41d('0x3'),_0x52200e,utils[_0xd41d('0x4')](_0x3baec2[0x0],this));_0x24b0c8[_0xd41d('0x5')]();}catch(_0x49af7f){logger[_0xd41d('0x6')](_0xd41d('0x3'),_0x52200e,JSON[_0xd41d('0x7')](_0x49af7f));_0x24b0c8[_0xd41d('0x8')]();}};}; \ No newline at end of file +var _0x62c6=['getMustacheRender','next','error','stop','./utils','../../../../config/logger','info','[%s][NOOP]\x20%s'];(function(_0x656c05,_0x1d4b18){var _0x28475a=function(_0x21ef6a){while(--_0x21ef6a){_0x656c05['push'](_0x656c05['shift']());}};_0x28475a(++_0x1d4b18);}(_0x62c6,0xe4));var _0x662c=function(_0x13203b,_0x5c28c9){_0x13203b=_0x13203b-0x0;var _0x33c1b0=_0x62c6[_0x13203b];return _0x33c1b0;};'use strict';var utils=require(_0x662c('0x0'));var logger=require(_0x662c('0x1'))('routing');exports['consequence']=function(_0x5c77ec,_0x37ff87){return function(_0x48a251){try{logger[_0x662c('0x2')](_0x662c('0x3'),_0x5c77ec,utils[_0x662c('0x4')](_0x37ff87[0x0],this));_0x48a251[_0x662c('0x5')]();}catch(_0x49b95c){logger[_0x662c('0x6')](_0x662c('0x3'),_0x5c77ec,JSON['stringify'](_0x49b95c));_0x48a251[_0x662c('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index b392052..1fc4345 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 _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(_0x6af11c,_0x3b9497){var _0x394134=function(_0x2489d3){while(--_0x2489d3){_0x6af11c['push'](_0x6af11c['shift']());}};_0x394134(++_0x3b9497);}(_0x34e8,0x12c));var _0x834e=function(_0x184645,_0x2100fe){_0x184645=_0x184645-0x0;var _0x162308=_0x34e8[_0x184645];return _0x162308;};'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 +var _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3e74,0x175));var _0x43e7=function(_0x5b454f,_0xf2ae47){_0x5b454f=_0x5b454f-0x0;var _0x211398=_0x3e74[_0x5b454f];return _0x211398;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index df76c73..1ca0f65 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 _0xf0a4=['handleTimeout','bind','drained','push','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','busyQueue','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','TIMEOUT','exports','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','handleRun'];(function(_0x7b69cf,_0x7096c1){var _0x78b929=function(_0x4cf89a){while(--_0x4cf89a){_0x7b69cf['push'](_0x7b69cf['shift']());}};_0x78b929(++_0x7096c1);}(_0xf0a4,0x1c4));var _0x4f0a=function(_0x39f06b,_0x1aa75b){_0x39f06b=_0x39f06b-0x0;var _0x44e986=_0xf0a4[_0x39f06b];return _0x44e986;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require('./util');var logger=require(_0x4f0a('0x0'))(_0x4f0a('0x1'));var Agent=function(_0x2ea730,_0x309ebf,_0x45b1d6,_0x4d4231){this[_0x4f0a('0x2')]=uuid['v4']();this['squeue']=_0x2ea730;this[_0x4f0a('0x3')]=_0x309ebf;this[_0x4f0a('0x4')]=_0x45b1d6;this['routing']=_0x4d4231;this[_0x4f0a('0x5')]['push'](this[_0x4f0a('0x6')]['bind'](this),this[_0x4f0a('0x7')]['bind'](this));this['squeue']['on']('timeout',this['handleTimeout'][_0x4f0a('0x8')](this));this[_0x4f0a('0x5')]['on'](_0x4f0a('0x9'),this['handleDrained'][_0x4f0a('0x8')](this));};Agent['prototype'][_0x4f0a('0xa')]=function(){this['squeue'][_0x4f0a('0xa')](this[_0x4f0a('0x6')]['bind'](this),this[_0x4f0a('0x7')]['bind'](this));};Agent[_0x4f0a('0xb')]['handleDrained']=function(){this[_0x4f0a('0x7')](!![]);};Agent[_0x4f0a('0xb')][_0x4f0a('0x6')]=function(_0x4cde74){logger[_0x4f0a('0xc')](_0x4f0a('0xd'),this[_0x4f0a('0x5')]['id'],this[_0x4f0a('0x3')]['id']);if(_[_0x4f0a('0xe')](this['realtime'][_0x4f0a('0xf')][this['agent']['id']])){logger[_0x4f0a('0xc')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x4f0a('0x5')]['id'],this[_0x4f0a('0x3')]['id']);setTimeout(this['push'][_0x4f0a('0x8')](this),0x3e8);}else{if(this[_0x4f0a('0x1')][_0x4f0a('0x10')]||util[_0x4f0a('0x11')](this['squeue']['id'],this[_0x4f0a('0x4')]['agents'][this[_0x4f0a('0x3')]['id']],this[_0x4f0a('0x5')]['channel'],![])){this['realtime'][_0x4f0a('0xf')][this['agent']['id']]['busy']=!![];this[_0x4f0a('0x4')]['agents'][this['agent']['id']][_0x4f0a('0x12')]=undefined;util['showNotification'](this[_0x4f0a('0x2')],this[_0x4f0a('0x5')]['id'],this[_0x4f0a('0x4')]['agents'][this[_0x4f0a('0x3')]['id']],null,this[_0x4f0a('0x1')]);util['writeLog'](this[_0x4f0a('0x5')]['id'],this[_0x4f0a('0x4')]['agents'][this[_0x4f0a('0x3')]['id']],_0x4f0a('0x13')+(this['routing'][_0x4f0a('0x10')]?':FORCED':''));}else{logger[_0x4f0a('0xc')](_0x4f0a('0x14'),this[_0x4f0a('0x5')]['id'],this[_0x4f0a('0x3')]['id']);setTimeout(this[_0x4f0a('0xa')][_0x4f0a('0x8')](this),0x3e8);}}};Agent['prototype'][_0x4f0a('0x7')]=function(_0x5a6d25){if(_[_0x4f0a('0xe')](this[_0x4f0a('0x4')][_0x4f0a('0xf')][this[_0x4f0a('0x3')]['id']])){return logger[_0x4f0a('0xc')](_0x4f0a('0x15'),this[_0x4f0a('0x5')]['id'],this['agent']['id']);}else{logger['info'](_0x4f0a('0x16'),this[_0x4f0a('0x5')]['id'],this[_0x4f0a('0x3')]['id']);util[_0x4f0a('0x17')](this['notificationId'],this[_0x4f0a('0x5')]['id'],this[_0x4f0a('0x4')]['agents'][this[_0x4f0a('0x3')]['id']],null,this[_0x4f0a('0x1')]);this[_0x4f0a('0x4')][_0x4f0a('0xf')][this[_0x4f0a('0x3')]['id']]['busy']=![];this[_0x4f0a('0x4')][_0x4f0a('0xf')][this['agent']['id']][_0x4f0a('0x12')]=undefined;util[_0x4f0a('0x18')](this[_0x4f0a('0x5')]['id'],this['realtime']['agents'][this[_0x4f0a('0x3')]['id']],_0x5a6d25?'STOP':_0x4f0a('0x19'));}if(!_0x5a6d25){setTimeout(this[_0x4f0a('0xa')][_0x4f0a('0x8')](this),0x3e8);}};function agent(_0x11fbc9,_0x56ae1,_0x5850aa,_0xe40310){return new Agent(_0x11fbc9,_0x56ae1,_0x5850aa,_0xe40310);}module[_0x4f0a('0x1a')]=agent; \ No newline at end of file +var _0xabdb=['channel','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','TIMEOUT','uuid','./util','../../../../../config/logger','notificationId','agent','realtime','routing','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info','isNil','agents','forcedOwnership','isAgentAvailable'];(function(_0x3e6309,_0x1506da){var _0x22a3d8=function(_0x5d6327){while(--_0x5d6327){_0x3e6309['push'](_0x3e6309['shift']());}};_0x22a3d8(++_0x1506da);}(_0xabdb,0xbe));var _0xbabd=function(_0x44c284,_0x87ff00){_0x44c284=_0x44c284-0x0;var _0x4dc7b9=_0xabdb[_0x44c284];return _0x4dc7b9;};'use strict';var _=require('lodash');var uuid=require(_0xbabd('0x0'));var util=require(_0xbabd('0x1'));var logger=require(_0xbabd('0x2'))('routing');var Agent=function(_0xa63442,_0x33da77,_0x14b77c,_0x74d3ba){this[_0xbabd('0x3')]=uuid['v4']();this['squeue']=_0xa63442;this[_0xbabd('0x4')]=_0x33da77;this[_0xbabd('0x5')]=_0x14b77c;this[_0xbabd('0x6')]=_0x74d3ba;this[_0xbabd('0x7')][_0xbabd('0x8')](this[_0xbabd('0x9')][_0xbabd('0xa')](this),this['handleTimeout']['bind'](this));this[_0xbabd('0x7')]['on']('timeout',this[_0xbabd('0xb')][_0xbabd('0xa')](this));this[_0xbabd('0x7')]['on'](_0xbabd('0xc'),this[_0xbabd('0xd')]['bind'](this));};Agent[_0xbabd('0xe')][_0xbabd('0x8')]=function(){this[_0xbabd('0x7')][_0xbabd('0x8')](this[_0xbabd('0x9')][_0xbabd('0xa')](this),this[_0xbabd('0xb')][_0xbabd('0xa')](this));};Agent['prototype'][_0xbabd('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0xbabd('0xe')][_0xbabd('0x9')]=function(_0x12e27c){logger[_0xbabd('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xbabd('0x7')]['id'],this[_0xbabd('0x4')]['id']);if(_[_0xbabd('0x10')](this[_0xbabd('0x5')][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']])){logger[_0xbabd('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbabd('0x7')]['id'],this[_0xbabd('0x4')]['id']);setTimeout(this[_0xbabd('0x8')]['bind'](this),0x3e8);}else{if(this[_0xbabd('0x6')][_0xbabd('0x12')]||util[_0xbabd('0x13')](this[_0xbabd('0x7')]['id'],this[_0xbabd('0x5')][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']],this[_0xbabd('0x7')][_0xbabd('0x14')],![])){this['realtime'][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']]['busy']=!![];this['realtime']['agents'][this[_0xbabd('0x4')]['id']][_0xbabd('0x15')]=undefined;util[_0xbabd('0x16')](this[_0xbabd('0x3')],this[_0xbabd('0x7')]['id'],this['realtime'][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']],null,this['routing']);util[_0xbabd('0x17')](this[_0xbabd('0x7')]['id'],this[_0xbabd('0x5')][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']],'RINGING'+(this['routing']['forcedOwnership']?_0xbabd('0x18'):''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xbabd('0x7')]['id'],this[_0xbabd('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent['prototype'][_0xbabd('0xb')]=function(_0x2299f7){if(_[_0xbabd('0x10')](this[_0xbabd('0x5')]['agents'][this[_0xbabd('0x4')]['id']])){return logger[_0xbabd('0xf')](_0xbabd('0x19'),this[_0xbabd('0x7')]['id'],this['agent']['id']);}else{logger[_0xbabd('0xf')](_0xbabd('0x1a'),this['squeue']['id'],this[_0xbabd('0x4')]['id']);util[_0xbabd('0x1b')](this[_0xbabd('0x3')],this[_0xbabd('0x7')]['id'],this[_0xbabd('0x5')]['agents'][this[_0xbabd('0x4')]['id']],null,this[_0xbabd('0x6')]);this['realtime'][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']][_0xbabd('0x1c')]=![];this[_0xbabd('0x5')]['agents'][this['agent']['id']][_0xbabd('0x15')]=undefined;util['writeLog'](this[_0xbabd('0x7')]['id'],this[_0xbabd('0x5')][_0xbabd('0x11')][this[_0xbabd('0x4')]['id']],_0x2299f7?'STOP':_0xbabd('0x1d'));}if(!_0x2299f7){setTimeout(this[_0xbabd('0x8')]['bind'](this),0x3e8);}};function agent(_0x35fdea,_0x2a8c2f,_0x3df7e5,_0x2f3451){return new Agent(_0x35fdea,_0x2a8c2f,_0x3df7e5,_0x2f3451);}module['exports']=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 aa9bac9..a57c0fa 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 _0xc8f1=['uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','isNil','queue','length','Agents','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','busy','busyQueue','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','exports','lodash'];(function(_0x5560b8,_0x2e0533){var _0x49d0b8=function(_0x47daf8){while(--_0x47daf8){_0x5560b8['push'](_0x5560b8['shift']());}};_0x49d0b8(++_0x2e0533);}(_0xc8f1,0x1cd));var _0x1c8f=function(_0x3b4243,_0x2977ab){_0x3b4243=_0x3b4243-0x0;var _0x1c3f90=_0xc8f1[_0x3b4243];return _0x1c3f90;};'use strict';var _=require(_0x1c8f('0x0'));var uuid=require(_0x1c8f('0x1'));var util=require(_0x1c8f('0x2'));var logger=require(_0x1c8f('0x3'))(_0x1c8f('0x4'));var Beepall=function(_0x24eab4,_0x1b8c95,_0x150ca1,_0x251834){this[_0x1c8f('0x5')]=uuid['v4']();this[_0x1c8f('0x6')]=_0x24eab4;this['queue']=_0x1b8c95;this[_0x1c8f('0x7')]=_0x150ca1;this[_0x1c8f('0x4')]=_0x251834;this[_0x1c8f('0x6')][_0x1c8f('0x8')](this[_0x1c8f('0x9')][_0x1c8f('0xa')](this),this[_0x1c8f('0xb')][_0x1c8f('0xa')](this));this[_0x1c8f('0x6')]['on'](_0x1c8f('0xc'),this[_0x1c8f('0xb')][_0x1c8f('0xa')](this));this[_0x1c8f('0x6')]['on'](_0x1c8f('0xd'),this['handleDrained']['bind'](this));};Beepall[_0x1c8f('0xe')][_0x1c8f('0x8')]=function(){this[_0x1c8f('0x6')]['push'](this[_0x1c8f('0x9')][_0x1c8f('0xa')](this),this[_0x1c8f('0xb')]['bind'](this));};Beepall[_0x1c8f('0xe')][_0x1c8f('0xf')]=function(_0x59236d){this[_0x1c8f('0xb')](!![]);};Beepall[_0x1c8f('0xe')][_0x1c8f('0x9')]=function(_0x788233){var _0x543a24=!![];if(!_[_0x1c8f('0x10')](this[_0x1c8f('0x11')])&&!_[_0x1c8f('0x10')](this[_0x1c8f('0x11')]['Agents'])&&this['queue']['Agents'][_0x1c8f('0x12')]>0x0){for(var _0x280b7e=0x0,_0x2a8264;_0x280b7e0x0){for(var _0x21c567=0x0,_0x52941e;_0x21c5670x0&&_0x40acf7[_0x125933+_0x5e49('0x25')]>=_0x40acf7[_0x125933+'Capacity']){writeLog(_0x4bb544,_0x40acf7,_0x125933[_0x5e49('0x26')]()+_0x5e49('0x27'));return![];}}return!![];};exports[_0x5e49('0x28')]=function(_0x2014d7,_0x1daf4f,_0x154092,_0x59e78d,_0x446dee){return sendNotification(!![],_0x2014d7,_0x1daf4f,_0x154092,_0x59e78d,_0x446dee);};exports[_0x5e49('0x29')]=function(_0x4d3846,_0x40a4e1,_0x215a9d,_0x487e1d,_0x3756ab){return sendNotification(![],_0x4d3846,_0x40a4e1,_0x215a9d,_0x487e1d,_0x3756ab);};exports[_0x5e49('0x2a')]=writeLog; \ No newline at end of file +var _0x9649=['save','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','lodash','util','mustache','ioredis','../../../../../config/environment','routing','redis','defaults','emit','user:%s','user:save','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','format','name'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x9649,0x118));var _0x9964=function(_0x2695a6,_0x40231b){_0x2695a6=_0x2695a6-0x0;var _0x24bc7a=_0x9649[_0x2695a6];return _0x24bc7a;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var utils=require('../utils');var Mustache=require(_0x9964('0x2'));var Redis=require(_0x9964('0x3'));var config=require(_0x9964('0x4'));var logger=require('../../../../../config/logger')(_0x9964('0x5'));config[_0x9964('0x6')]=_[_0x9964('0x7')](config[_0x9964('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9964('0x6')]));function emit(_0x4c3262,_0x535a60,_0x5a6790){io['to'](_0x4c3262)[_0x9964('0x8')](_0x535a60,_0x5a6790);}function sendNotification(_0x4f8858,_0x499ec7,_0x3ac7f6,_0x1ece24,_0x29dd6b,_0xc15ae4){io['to'](util['format'](_0x9964('0x9'),_0x1ece24['name']))[_0x9964('0x8')](_0x9964('0xa'),_0x1ece24);var _0x4e1807=_0xc15ae4||{};var _0x3b4070=_0x3ac7f6[_0x9964('0xb')]('.');var _0x5d7939={'uniqueid':_0x499ec7,'channel':_0x3b4070[0x0],'id':_0x3b4070[0x1],'title':_0x3b4070[0x0]+_0x9964('0xc'),'interactionId':_0x3b4070[0x2],'queue':_0x29dd6b?_0x29dd6b['name']:null,'sound':_0x4e1807[_0x9964('0xd')][_0x9964('0xe')],'shake':_0x4e1807[_0x9964('0xd')][_0x9964('0xf')]};try{if(!_0x4e1807[_0x9964('0x10')]){_0x4e1807[_0x9964('0x10')]={};}if(_0x29dd6b){_0x4e1807[_0x9964('0x10')]['queue']=_0x29dd6b;}else if(_0x4e1807['body'][_0x9964('0x11')]){delete _0x4e1807[_0x9964('0x10')]['queue'];}_0x5d7939[_0x9964('0x12')]=utils[_0x9964('0x13')](_0x4e1807[_0x9964('0xd')][_0x9964('0x14')],_0x4e1807);}catch(_0x46a191){_0x5d7939[_0x9964('0x12')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x9964('0x15')](util[_0x9964('0x16')]('[%s][QUEUE]\x20%s',_0x499ec7,_0x46a191['message']));}io['to'](util['format'](_0x9964('0x9'),_0x1ece24[_0x9964('0x17')]))[_0x9964('0x8')](util[_0x9964('0x16')]('notification:%s',_0x4f8858?_0x9964('0x18'):'remove'),_0x5d7939);}function writeLog(_0x470a8d,_0x2d2f07,_0x209929){return logger[_0x9964('0x19')](util[_0x9964('0x16')](_0x9964('0x1a'),_0x470a8d,_0x2d2f07[_0x9964('0x17')],_0x209929));}exports[_0x9964('0x1b')]=function(_0x5c52af,_0x40a786,_0x3069d7,_0x1629f9){if(_0x40a786[_0x9964('0x1c')]){writeLog(_0x5c52af,_0x40a786,'BUSY');return![];}if(!_0x40a786[_0x9964('0x1d')]){writeLog(_0x5c52af,_0x40a786,_0x9964('0x1e'));return![];}if(_0x40a786[_0x3069d7+_0x9964('0x1f')]){writeLog(_0x5c52af,_0x40a786,_0x9964('0x20'));return![];}if(_0x1629f9&&_0x40a786['hasOwnProperty'](_0x3069d7+_0x9964('0x21'))&&_0x40a786[_0x9964('0x22')](_0x3069d7+_0x9964('0x23'))){if(_0x40a786[_0x3069d7+_0x9964('0x21')]>0x0&&_0x40a786[_0x3069d7+_0x9964('0x23')]>=_0x40a786[_0x3069d7+_0x9964('0x21')]){writeLog(_0x5c52af,_0x40a786,_0x3069d7[_0x9964('0x24')]()+_0x9964('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x524564,_0x194dc6,_0x2c1fad,_0x108c0a,_0x16ec83){return sendNotification(!![],_0x524564,_0x194dc6,_0x2c1fad,_0x108c0a,_0x16ec83);};exports['hideNotification']=function(_0x201656,_0x3a59df,_0x396054,_0x34d835,_0x178089){return sendNotification(![],_0x201656,_0x3a59df,_0x396054,_0x34d835,_0x178089);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 08d6bcd..351aee9 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 _0xb1fc=['lodash','./utils','routing','consequence','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','exec','isEmpty','body','error','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs'];(function(_0x10cc40,_0x191a2e){var _0x2631a8=function(_0x3e8ee9){while(--_0x3e8ee9){_0x10cc40['push'](_0x10cc40['shift']());}};_0x2631a8(++_0x191a2e);}(_0xb1fc,0x154));var _0xcb1f=function(_0x1f3d12,_0x1ff5b8){_0x1f3d12=_0x1f3d12-0x0;var _0x31d169=_0xb1fc[_0x1f3d12];return _0x31d169;};'use strict';var schema=require(_0xcb1f('0x0'));var sh=require(_0xcb1f('0x1'));var _=require(_0xcb1f('0x2'));var utils=require(_0xcb1f('0x3'));var logger=require('../../../../config/logger')(_0xcb1f('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xcb1f('0x5')]=function(_0x216437,_0x43b95c){return function(_0x122c2e){try{var _0x3ed0ea={'command':_0x43b95c[0x0]};var _0x412f1e=system[_0xcb1f('0x0')](_0x3ed0ea,{'typecast':!![]});if(_0x412f1e['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x216437,_[_0xcb1f('0x6')](_0x412f1e,'message')[_0xcb1f('0x7')](',\x20'));logger[_0xcb1f('0x8')](_0xcb1f('0x9'),_0x216437);_0x122c2e['next']();}else{var _0x187575=this;var _0x3ccafa=utils[_0xcb1f('0xa')](_0x43b95c[0x0],this);logger[_0xcb1f('0x8')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x216437,_0x3ccafa);sh[_0xcb1f('0xb')](_['trim'](_0x3ccafa),function(_0x101837,_0x825538){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x216437,_0x101837);if(_0x101837==0x0){var _0x31b806=_0x825538['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x43b95c[0x1])||_[_0xcb1f('0xc')](_0x43b95c[0x1])){logger[_0xcb1f('0x8')]('[%s][SYSTEM]\x20no\x20variable',_0x216437);_0x187575[_0xcb1f('0xd')][_0x43b95c[0x1]]=_0x31b806;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x216437,_0x43b95c[0x1],_0x31b806);_0x187575['body'][_0x43b95c[0x1]]=_0x31b806;}}_0x122c2e['next']();});}}catch(_0x564ef9){logger[_0xcb1f('0xe')](_0xcb1f('0xf'),_0x216437,_[_0xcb1f('0x10')](_0x564ef9)?JSON[_0xcb1f('0x11')](_0x564ef9):_0x564ef9);logger[_0xcb1f('0x8')](_0xcb1f('0x9'),_0x216437);_0x122c2e['next']();}};}; \ No newline at end of file +var _0xe416=['isNil','[%s][SYSTEM]\x20no\x20variable','body','next','error','[%s][SYSTEM]\x20%s','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','map','message','join','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x1a8a79,_0x57182d){var _0x436f4c=function(_0x4cc5c2){while(--_0x4cc5c2){_0x1a8a79['push'](_0x1a8a79['shift']());}};_0x436f4c(++_0x57182d);}(_0xe416,0x18e));var _0x6e41=function(_0x19d694,_0x5d5329){_0x19d694=_0x19d694-0x0;var _0x82ba4d=_0xe416[_0x19d694];return _0x82ba4d;};'use strict';var schema=require(_0x6e41('0x0'));var sh=require(_0x6e41('0x1'));var _=require(_0x6e41('0x2'));var utils=require('./utils');var logger=require(_0x6e41('0x3'))(_0x6e41('0x4'));var system=schema({'command':{'type':_0x6e41('0x5'),'required':!![],'message':_0x6e41('0x6')}});exports[_0x6e41('0x7')]=function(_0x25c129,_0x5d8af5){return function(_0x2e2ef5){try{var _0x4dacde={'command':_0x5d8af5[0x0]};var _0xfdda0c=system['validate'](_0x4dacde,{'typecast':!![]});if(_0xfdda0c['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x25c129,_[_0x6e41('0x8')](_0xfdda0c,_0x6e41('0x9'))[_0x6e41('0xa')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x25c129);_0x2e2ef5['next']();}else{var _0x2031de=this;var _0x30fdd4=utils[_0x6e41('0xb')](_0x5d8af5[0x0],this);logger[_0x6e41('0xc')](_0x6e41('0xd'),_0x25c129,_0x30fdd4);sh[_0x6e41('0xe')](_[_0x6e41('0xf')](_0x30fdd4),function(_0x201784,_0x47a8e8){logger[_0x6e41('0xc')](_0x6e41('0x10'),_0x25c129,_0x201784);if(_0x201784==0x0){var _0x759667=_0x47a8e8[_0x6e41('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x6e41('0x12')](_0x5d8af5[0x1])||_['isEmpty'](_0x5d8af5[0x1])){logger['info'](_0x6e41('0x13'),_0x25c129);_0x2031de[_0x6e41('0x14')][_0x5d8af5[0x1]]=_0x759667;}else{logger[_0x6e41('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x25c129,_0x5d8af5[0x1],_0x759667);_0x2031de[_0x6e41('0x14')][_0x5d8af5[0x1]]=_0x759667;}}_0x2e2ef5[_0x6e41('0x15')]();});}}catch(_0x14ed63){logger[_0x6e41('0x16')](_0x6e41('0x17'),_0x25c129,_[_0x6e41('0x18')](_0x14ed63)?JSON['stringify'](_0x14ed63):_0x14ed63);logger[_0x6e41('0xc')](_0x6e41('0x19'),_0x25c129);_0x2e2ef5[_0x6e41('0x15')]();}};}; \ 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 b91bf31..5db12c9 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 _0xdd1b=['Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next'];(function(_0x56da20,_0x480281){var _0x2cadb9=function(_0x44776e){while(--_0x44776e){_0x56da20['push'](_0x56da20['shift']());}};_0x2cadb9(++_0x480281);}(_0xdd1b,0x6c));var _0xbdd1=function(_0x1b8ad9,_0x301373){_0x1b8ad9=_0x1b8ad9-0x0;var _0x279227=_0xdd1b[_0x1b8ad9];return _0x279227;};'use strict';var schema=require('validate');var _=require(_0xbdd1('0x0'));var rpc={'chatInteraction':require(_0xbdd1('0x1')),'openchannelInteraction':require(_0xbdd1('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xbdd1('0x3')),'faxInteraction':require(_0xbdd1('0x4')),'whatsappInteraction':require(_0xbdd1('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xbdd1('0x6'),'required':!![],'message':_0xbdd1('0x7')}});exports[_0xbdd1('0x8')]=function(_0x1d3ebc,_0xdd0fd5,_0x3ebaa8,_0xd06cd5){return function(_0x298d74){try{var _0x56fa05={'tag':_0xdd0fd5[0x0]};var _0x6c6af1=tag['validate'](_0x56fa05,{'typecast':!![]});if(_0x6c6af1[_0xbdd1('0x9')]){logger[_0xbdd1('0xa')](_0xbdd1('0xb'),_0x1d3ebc,_[_0xbdd1('0xc')](_0x6c6af1,'message')[_0xbdd1('0xd')](',\x20'));logger[_0xbdd1('0xe')](_0xbdd1('0xf'),_0x1d3ebc);_0x298d74[_0xbdd1('0x10')]();}else{var _0xa780f2={'ids':[_0xdd0fd5[0x0]]};if(rpc[_0xd06cd5['channel']+_0xbdd1('0x11')]){rpc[_0xd06cd5[_0xbdd1('0x12')]+'Interaction'][_0xbdd1('0x13')](_0xd06cd5[_0xbdd1('0x14')]['id'],_0xa780f2)[_0xbdd1('0x15')](function(_0x3f6d79){logger[_0xbdd1('0xe')](_0xbdd1('0x16'),_0x1d3ebc,_0xdd0fd5[0x1],_0xd06cd5[_0xbdd1('0x12')],_0xd06cd5[_0xbdd1('0x14')]['id']);})['catch'](function(_0x49903b){logger[_0xbdd1('0xa')](_0xbdd1('0xb'),_0x1d3ebc,JSON[_0xbdd1('0x17')](_0x49903b));logger[_0xbdd1('0xe')](_0xbdd1('0xf'),_0x1d3ebc);})['finally'](function(){_0x298d74[_0xbdd1('0x10')]();});}}}catch(_0x24f21d){logger[_0xbdd1('0xa')](_0xbdd1('0xb'),_0x1d3ebc,_[_0xbdd1('0x18')](_0x24f21d)?JSON['stringify'](_0x24f21d):_0x24f21d);logger[_0xbdd1('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1d3ebc);_0x298d74[_0xbdd1('0x10')]();}};}; \ No newline at end of file +var _0x1660=['next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x13e550,_0x39340c){var _0xaa7027=function(_0x58f1bf){while(--_0x58f1bf){_0x13e550['push'](_0x13e550['shift']());}};_0xaa7027(++_0x39340c);}(_0x1660,0xac));var _0x0166=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1660[_0x178e48];return _0x440d7e;};'use strict';var schema=require(_0x0166('0x0'));var _=require(_0x0166('0x1'));var rpc={'chatInteraction':require(_0x0166('0x2')),'openchannelInteraction':require(_0x0166('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x0166('0x4')),'whatsappInteraction':require(_0x0166('0x5'))};var logger=require(_0x0166('0x6'))(_0x0166('0x7'));var tag=schema({'tag':{'type':_0x0166('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x0166('0x9')]=function(_0x325ac3,_0x1ca89b,_0x3eb520,_0x5a9cc5){return function(_0xd2ee3f){try{var _0xe8f5d4={'tag':_0x1ca89b[0x0]};var _0x347e87=tag['validate'](_0xe8f5d4,{'typecast':!![]});if(_0x347e87[_0x0166('0xa')]){logger[_0x0166('0xb')](_0x0166('0xc'),_0x325ac3,_[_0x0166('0xd')](_0x347e87,_0x0166('0xe'))['join'](',\x20'));logger[_0x0166('0xf')](_0x0166('0x10'),_0x325ac3);_0xd2ee3f[_0x0166('0x11')]();}else{var _0x147758={'ids':[_0x1ca89b[0x0]]};if(rpc[_0x5a9cc5[_0x0166('0x12')]+'Interaction']){rpc[_0x5a9cc5[_0x0166('0x12')]+_0x0166('0x13')][_0x0166('0x14')](_0x5a9cc5['interaction']['id'],_0x147758)[_0x0166('0x15')](function(_0x52567e){logger[_0x0166('0xf')](_0x0166('0x16'),_0x325ac3,_0x1ca89b[0x1],_0x5a9cc5[_0x0166('0x12')],_0x5a9cc5[_0x0166('0x17')]['id']);})['catch'](function(_0x47289c){logger[_0x0166('0xb')]('[%s][TAG]\x20%s',_0x325ac3,JSON['stringify'](_0x47289c));logger['info'](_0x0166('0x10'),_0x325ac3);})[_0x0166('0x18')](function(){_0xd2ee3f[_0x0166('0x11')]();});}}}catch(_0x48cbe4){logger[_0x0166('0xb')]('[%s][TAG]\x20%s',_0x325ac3,_[_0x0166('0x19')](_0x48cbe4)?JSON[_0x0166('0x1a')](_0x48cbe4):_0x48cbe4);logger['info'](_0x0166('0x10'),_0x325ac3);_0xd2ee3f[_0x0166('0x11')]();}};}; \ 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 5a216aa..4a03f51 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 _0x167e=['list','mustache','lodash','exports','render','merge','body','message','interaction'];(function(_0x2a0346,_0x2c1300){var _0x1f5232=function(_0x345c8e){while(--_0x345c8e){_0x2a0346['push'](_0x2a0346['shift']());}};_0x1f5232(++_0x2c1300);}(_0x167e,0xa3));var _0xe167=function(_0x3c673c,_0x748bb6){_0x3c673c=_0x3c673c-0x0;var _0x5d9fe8=_0x167e[_0x3c673c];return _0x5d9fe8;};'use strict';var Mustache=require(_0xe167('0x0'));var _=require(_0xe167('0x1'));module[_0xe167('0x2')]={'getMustacheRender':function(_0x38b912,_0x14457a){return Mustache[_0xe167('0x3')](_0x38b912,_[_0xe167('0x4')](_0x14457a[_0xe167('0x5')],{'contact':_0x14457a['contact'],'message':_0x14457a[_0xe167('0x6')],'account':_0x14457a['account'],'interaction':_0x14457a[_0xe167('0x7')],'list':_0x14457a[_0xe167('0x8')]}))||'';}}; \ No newline at end of file +var _0x1061=['body','contact','message','account','interaction','mustache','render','merge'];(function(_0x4f5033,_0x289213){var _0x14a669=function(_0x42f50a){while(--_0x42f50a){_0x4f5033['push'](_0x4f5033['shift']());}};_0x14a669(++_0x289213);}(_0x1061,0x1b5));var _0x1106=function(_0x5d8c8f,_0xd1fbf7){_0x5d8c8f=_0x5d8c8f-0x0;var _0x1bc7bc=_0x1061[_0x5d8c8f];return _0x1bc7bc;};'use strict';var Mustache=require(_0x1106('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x592486,_0x986553){return Mustache[_0x1106('0x1')](_0x592486,_[_0x1106('0x2')](_0x986553[_0x1106('0x3')],{'contact':_0x986553[_0x1106('0x4')],'message':_0x986553[_0x1106('0x5')],'account':_0x986553[_0x1106('0x6')],'interaction':_0x986553[_0x1106('0x7')],'list':_0x986553['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index e9cb617..55cbaf5 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 _0x096f=['stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','bluebird','uuid','../../../config/environment','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','app','toLowerCase','autoreply','appdata','push','join','dialogflow','slice','split','tag','TagId','format','%s:%s:%s','./interval','intervals','consequence','priority','info','on\x20interval','error','.js','Applications\x20executed'];(function(_0x18542f,_0x44d4ea){var _0x570f24=function(_0x3957e9){while(--_0x3957e9){_0x18542f['push'](_0x18542f['shift']());}};_0x570f24(++_0x44d4ea);}(_0x096f,0xe5));var _0xf096=function(_0x516ead,_0x3614a0){_0x516ead=_0x516ead-0x0;var _0x59c622=_0x096f[_0x516ead];return _0x59c622;};'use strict';var _=require(_0xf096('0x0'));var util=require('util');var path=require(_0xf096('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xf096('0x2'));var uuid=require(_0xf096('0x3'));var config=require(_0xf096('0x4'));var logger=require('../../../config/logger')(_0xf096('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xf096('0x6')),'chatQueueReport':require(_0xf096('0x7')),'smsQueueReport':require(_0xf096('0x8')),'faxQueueReport':require(_0xf096('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xf096('0xa'));function getId(_0x2036ac,_0x27aa87,_0x524cb3){return util['format']('%s.%s.%s',_0x2036ac,_0x27aa87||0x0,_0x524cb3||0x0);}function getIntervals(_0x4c2b91,_0x541a16){var _0x2eb460=[];if(!_[_0xf096('0xb')](_0x541a16[_0xf096('0xc')])&&!_[_0xf096('0xb')](_0x4c2b91[_0x541a16[_0xf096('0xc')]])&&!_[_0xf096('0xb')](_0x4c2b91[_0x541a16['IntervalId']][_0xf096('0xd')])){_0x2eb460=_[_0xf096('0xe')](_0x4c2b91[_0x541a16[_0xf096('0xc')]][_0xf096('0xd')],_0xf096('0xf'));}else if(!_[_0xf096('0xb')](_0x541a16[_0xf096('0xf')])){_0x2eb460=[_0x541a16[_0xf096('0xf')]];}return _0x2eb460;}exports[_0xf096('0x10')]=function(_0x212575){_0x212575[_0xf096('0x11')]={};return new BPromise(function(_0x25101a,_0x36ba27){var _0x3994dc={'Start':function(_0xdcec64){var _0x8587e8=this;return new Promise(function(_0x3ec8ed,_0x1a5c91){if(_0xdcec64){try{var _0x242b13=[];var _0x3907b0=getId(_0xdcec64[_0xf096('0x12')],_0xdcec64[_0xf096('0x13')]?_0xdcec64[_0xf096('0x13')]['id']:0x0,_0xdcec64[_0xf096('0x14')]?_0xdcec64[_0xf096('0x14')]['id']:0x0);if(_0xdcec64[_0xf096('0x15')]&&_[_0xf096('0x16')](_0xdcec64['applications'])&&_0xdcec64['applications'][_0xf096('0x17')]){for(var _0x1ea74f=0x0;_0x1ea74f<_0xdcec64[_0xf096('0x15')][_0xf096('0x17')];_0x1ea74f+=0x1){var _0x3d64ff=_0xdcec64[_0xf096('0x15')][_0x1ea74f];if(fs[_0xf096('0x18')](path['join'](__dirname,_0xf096('0x15'),_0x3d64ff['app']+'.js'))){var _0x817839=[];switch(_0x3d64ff[_0xf096('0x19')][_0xf096('0x1a')]()){case _0xf096('0x1b'):var _0x93e228=_0x3d64ff[_0xf096('0x1c')]['split'](',');_0x817839['push'](_0x93e228[0x0]);_0x817839[_0xf096('0x1d')](_0x93e228['slice'](0x1,_0x93e228[_0xf096('0x17')])[_0xf096('0x1e')](','));break;case _0xf096('0x1f'):var _0x34d08a=_0x3d64ff[_0xf096('0x1c')]['split'](',');_0x817839[_0xf096('0x1d')](_0x34d08a[0x0]);_0x817839['push'](_0x34d08a[0x1]);_0x817839['push'](_0x34d08a[_0xf096('0x20')](0x2,_0x34d08a[_0xf096('0x17')])[_0xf096('0x1e')](','));break;case'amazonlex':var _0x84289c=_0x3d64ff[_0xf096('0x1c')][_0xf096('0x21')](',');_0x817839['push'](_0x84289c[0x0]);_0x817839[_0xf096('0x1d')](_0x84289c[0x1]);_0x817839[_0xf096('0x1d')](_0x84289c[0x2]);_0x817839[_0xf096('0x1d')](_0x84289c[0x3]);_0x817839[_0xf096('0x1d')](_0x84289c[_0xf096('0x20')](0x4,_0x84289c[_0xf096('0x17')])[_0xf096('0x1e')](','));break;case _0xf096('0x13'):_0x817839[_0xf096('0x1d')](_0x3d64ff[_0xf096('0x1c')]);break;case _0xf096('0x22'):_0x817839[_0xf096('0x1d')](_0x3d64ff[_0xf096('0x23')]);_0x817839[_0xf096('0x1d')](_0x3d64ff[_0xf096('0x1c')]);break;default:_0x817839=_['isNil'](_0x3d64ff[_0xf096('0x1c')])?[]:_0x3d64ff[_0xf096('0x1c')][_0xf096('0x21')](',');}var _0x2912d9={'id':util[_0xf096('0x24')](_0xf096('0x25'),_0x3907b0,_0x3d64ff['id'],_0x3d64ff['app']),'condition':require(_0xf096('0x26'))['condition'](_0x3907b0,getIntervals(_0x212575[_0xf096('0x27')],_0x3d64ff),_0x212575),'consequence':require('./applications/'+_0x3d64ff[_0xf096('0x19')])[_0xf096('0x28')](_0x3907b0,_0x817839,_0x212575,_0xdcec64),'p':_0x3d64ff[_0xf096('0x29')]||0x0};logger[_0xf096('0x2a')]('Push\x20new\x20rule',_0x2912d9['id'],_0xf096('0x2b'),getIntervals(_0x212575['intervals'],_0x3d64ff)[_0xf096('0x1e')]('\x20|\x20'));_0x242b13[_0xf096('0x1d')](_0x2912d9);}else{logger[_0xf096('0x2c')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xf096('0x1e')](__dirname,'applications',_0x3d64ff[_0xf096('0x19')]+_0xf096('0x2d')));}}_0x212575[_0xf096('0x11')][_0x3907b0]=new RuleEngine(_0x242b13);_0x212575[_0xf096('0x11')][_0x3907b0]['execute'](_0xdcec64,function(_0x5e8150){logger[_0xf096('0x2a')](_0xf096('0x2e'),JSON[_0xf096('0x2f')](_0x5e8150[_0xf096('0x30')]));if(_0x212575[_0xf096('0x11')][_0x3907b0]){_0x212575['rules'][_0x3907b0][_0xf096('0x31')](_0xf096('0x32'));}});return _0x3ec8ed({'code':0xc8,'message':_0xdcec64});}else{logger[_0xf096('0x2a')](_0xf096('0x33'));return _0x3ec8ed({'code':0xc8,'message':_0xdcec64});}}catch(_0x25a005){logger['error'](_0x25a005['stack']);return _0x1a5c91(_0x8587e8['error'](0x1f4,_0x25a005));}}return _0x1a5c91(_0xf096('0x34'));});},'AcceptMessage':function(_0x13dfba){var _0x124807=this;return new Promise(function(_0x309cbd,_0x1aedca){if(_0x13dfba[_0xf096('0x13')]&&_0x13dfba[_0xf096('0x13')]['id']){try{var _0x4ce611=getId(_0x13dfba['channel'],_0x13dfba['message']?_0x13dfba[_0xf096('0x13')]['id']:0x0,_0x13dfba[_0xf096('0x14')]?_0x13dfba[_0xf096('0x14')]['id']:0x0);if(_0x212575[_0xf096('0x11')][_0x4ce611]){_0x212575[_0xf096('0x11')][_0x4ce611][_0xf096('0x31')](_0xf096('0x35'));if(rpc[_0x13dfba[_0xf096('0x12')]+_0xf096('0x36')]){rpc[_0x13dfba[_0xf096('0x12')]+_0xf096('0x36')][_0xf096('0x37')](_0x4ce611,{'UserId':_0x13dfba[_0xf096('0x13')][_0xf096('0x38')]})[_0xf096('0x39')](function(_0x4704d3){logger[_0xf096('0x2c')](_0xf096('0x3a'));});}}return _0x309cbd({'code':0xc8,'message':_0x13dfba});}catch(_0x327d49){logger[_0xf096('0x2c')](_0x327d49[_0xf096('0x3b')]);return _0x1aedca(_0x124807[_0xf096('0x2c')](0x1f4,_0x327d49));}}logger['error'](_0xf096('0x3c'));return _0x1aedca(_0x124807['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x27ceb0){var _0x1c649a=this;return new Promise(function(_0x52fe4f,_0x284f2e){if(_0x27ceb0[_0xf096('0x3d')]&&_0x27ceb0[_0xf096('0x3d')]['id']){try{if(_0x212575[_0xf096('0x3e')][_0x27ceb0[_0xf096('0x3d')]['id']]){_0x212575['agents'][_0x27ceb0[_0xf096('0x3d')]['id']][_0xf096('0x3f')]=![];_0x212575[_0xf096('0x3e')][_0x27ceb0[_0xf096('0x3d')]['id']][_0xf096('0x40')]=undefined;}return _0x52fe4f({'code':0xc8,'message':_0x27ceb0});}catch(_0x3b1288){logger[_0xf096('0x2c')](_0x3b1288['stack']);return _0x284f2e(_0x1c649a[_0xf096('0x2c')](0x1f4,_0x3b1288));}}logger[_0xf096('0x2c')](_0xf096('0x3c'));return _0x284f2e(_0x1c649a[_0xf096('0x2c')](0x1f4,_0xf096('0x3c')));});},'AbandonInteraction':function(_0x49618e){var _0x5dcce8=this;return new Promise(function(_0xc375ff,_0x5e6040){if(_0x49618e[_0xf096('0x12')]&&_0x49618e[_0xf096('0x14')]&&_0x49618e[_0xf096('0x14')]['id']){try{var _0x459532=getId(_0x49618e[_0xf096('0x12')],_0x49618e[_0xf096('0x13')]?_0x49618e[_0xf096('0x13')]['id']:0x0,_0x49618e[_0xf096('0x14')]?_0x49618e[_0xf096('0x14')]['id']:0x0);if(_0x212575[_0xf096('0x11')][_0x459532]){_0x212575[_0xf096('0x11')][_0x459532]['emit'](_0xf096('0x35'));}return _0xc375ff({'code':0xc8,'message':_0x49618e});}catch(_0x1152d2){logger[_0xf096('0x2c')](_0x1152d2[_0xf096('0x3b')]);return _0x5e6040(_0x5dcce8['error'](0x1f4,_0x1152d2));}}logger[_0xf096('0x2c')]('message\x20is\x20empty');return _0x5e6040(_0x5dcce8[_0xf096('0x2c')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x4ab213){var _0x2ee034=this;return new Promise(function(_0x1cf5e3,_0x4be402){if(_0x212575['agents'][_0xf096('0x41')](_0x4ab213['id'])){for(var _0x4567df in _0x4ab213[_0xf096('0x42')]){if(_0x4ab213[_0xf096('0x42')][_0xf096('0x41')](_0x4567df)){if(_0x212575[_0xf096('0x3e')][_0x4ab213['id']][_0xf096('0x41')](_0x4567df+_0xf096('0x43'))){_0x212575['agents'][_0x4ab213['id']][_0x4567df+_0xf096('0x43')]=parseInt(_0x4ab213['capacity'][_0x4567df],0xa);}}}_0x212575[_0xf096('0x3e')][_0x4ab213['id']][_0xf096('0x44')]();return _0x1cf5e3({'code':0xc8,'message':_0x212575['agents'][_0x4ab213['id']]});}else{return _0x4be402(_0x2ee034[_0xf096('0x2c')](0x1f4,_0xf096('0x45')));}});},'Agents':function(_0x5794c2){return new Promise(function(_0x4b0c7a,_0x39726f){var _0x120c73=_[_0xf096('0x46')](_0x212575['agents']);_0x4b0c7a({'count':_0x120c73[_0xf096('0x17')],'rows':_0x120c73});});},'ChatQueues':function(_0x3750e0){return new Promise(function(_0x20feab,_0x1e9f37){var _0x2bafe0=[];for(var _0x3a5ad8 in _0x212575[_0xf096('0x47')]){if(_0x212575['chatQueues']['hasOwnProperty'](_0x3a5ad8)){var _0x3bba17=_0x212575[_0xf096('0x47')][_0x3a5ad8];var _0x4bbe08={'id':_0x3bba17['id'],'available':_0x3bba17[_0xf096('0x48')],'loggedIn':_0x3bba17[_0xf096('0x49')],'name':_0x3bba17[_0xf096('0x4a')],'paused':_0x3bba17[_0xf096('0x4b')],'waiting':_0x3bba17[_0xf096('0x4c')]};_0x2bafe0[_0xf096('0x1d')](_0x4bbe08);}}_0x20feab({'count':_0x2bafe0[_0xf096('0x17')],'rows':_0x2bafe0});});},'MailQueues':function(_0x4c44a6){return new Promise(function(_0x106413,_0x31b967){var _0x460ee4=[];for(var _0x44076c in _0x212575['mailQueues']){if(_0x212575['mailQueues']['hasOwnProperty'](_0x44076c)){var _0x2ebee6=_0x212575[_0xf096('0x4d')][_0x44076c];var _0x582751={'id':_0x2ebee6['id'],'available':_0x2ebee6[_0xf096('0x48')],'loggedIn':_0x2ebee6[_0xf096('0x49')],'name':_0x2ebee6[_0xf096('0x4a')],'paused':_0x2ebee6[_0xf096('0x4b')],'waiting':_0x2ebee6[_0xf096('0x4c')]};_0x460ee4[_0xf096('0x1d')](_0x582751);}}_0x106413({'count':_0x460ee4[_0xf096('0x17')],'rows':_0x460ee4});});},'OpenchannelQueues':function(_0x546243){return new Promise(function(_0x4f79b2,_0x33de2f){var _0x8897c8=[];for(var _0x31c31a in _0x212575[_0xf096('0x4e')]){if(_0x212575[_0xf096('0x4e')]['hasOwnProperty'](_0x31c31a)){var _0xb40f76=_0x212575[_0xf096('0x4e')][_0x31c31a];var _0x3d9019={'id':_0xb40f76['id'],'available':_0xb40f76['available'],'loggedIn':_0xb40f76['loggedIn'],'name':_0xb40f76['name'],'paused':_0xb40f76[_0xf096('0x4b')],'waiting':_0xb40f76['waiting']};_0x8897c8['push'](_0x3d9019);}}_0x4f79b2({'count':_0x8897c8[_0xf096('0x17')],'rows':_0x8897c8});});},'SmsQueues':function(_0x150e69){return new Promise(function(_0x5e9b34,_0xce81a6){var _0xb4a2f7=[];for(var _0x25eb53 in _0x212575[_0xf096('0x4f')]){if(_0x212575[_0xf096('0x4f')][_0xf096('0x41')](_0x25eb53)){var _0x47ec19=_0x212575[_0xf096('0x4f')][_0x25eb53];var _0x477cf2={'id':_0x47ec19['id'],'available':_0x47ec19[_0xf096('0x48')],'loggedIn':_0x47ec19[_0xf096('0x49')],'name':_0x47ec19[_0xf096('0x4a')],'paused':_0x47ec19['paused'],'waiting':_0x47ec19['waiting']};_0xb4a2f7[_0xf096('0x1d')](_0x477cf2);}}_0x5e9b34({'count':_0xb4a2f7[_0xf096('0x17')],'rows':_0xb4a2f7});});},'FaxQueues':function(_0x48fe9e){return new Promise(function(_0x211dca,_0xe565fa){var _0x3bb95f=[];for(var _0x2d7cab in _0x212575[_0xf096('0x50')]){if(_0x212575[_0xf096('0x50')][_0xf096('0x41')](_0x2d7cab)){var _0x28324b=_0x212575[_0xf096('0x50')][_0x2d7cab];var _0x4bdebc={'id':_0x28324b['id'],'available':_0x28324b['available'],'loggedIn':_0x28324b[_0xf096('0x49')],'name':_0x28324b[_0xf096('0x4a')],'paused':_0x28324b['paused'],'waiting':_0x28324b['waiting']};_0x3bb95f['push'](_0x4bdebc);}}_0x211dca({'count':_0x3bb95f[_0xf096('0x17')],'rows':_0x3bb95f});});},'WhatsappQueues':function(_0x450c8c){return new Promise(function(_0x4d55fa,_0x1db6ba){var _0x1a60ea=[];for(var _0x172de8 in _0x212575[_0xf096('0x51')]){if(_0x212575[_0xf096('0x51')]['hasOwnProperty'](_0x172de8)){var _0x9febd8=_0x212575[_0xf096('0x51')][_0x172de8];var _0x4bcfe0={'id':_0x9febd8['id'],'available':_0x9febd8['available'],'loggedIn':_0x9febd8[_0xf096('0x49')],'name':_0x9febd8[_0xf096('0x4a')],'paused':_0x9febd8[_0xf096('0x4b')],'waiting':_0x9febd8[_0xf096('0x4c')]};_0x1a60ea['push'](_0x4bcfe0);}}_0x4d55fa({'count':_0x1a60ea[_0xf096('0x17')],'rows':_0x1a60ea});});},'ChatQueuesWaitingInteractions':function(_0x540442){return new Promise(function(_0x2310ef,_0x3eef2c){var _0x204c0c=_['values'](_0x212575[_0xf096('0x52')]);_0x2310ef({'count':_0x204c0c[_0xf096('0x17')],'rows':_0x204c0c});});},'MailQueuesWaitingInteractions':function(_0x118be5){return new Promise(function(_0x21a677,_0x394df7){var _0x3b4959=_[_0xf096('0x46')](_0x212575['mailQueuesWaitingInteractions']);_0x21a677({'count':_0x3b4959[_0xf096('0x17')],'rows':_0x3b4959});});},'OpenchannelQueuesWaitingInteractions':function(_0x72b63e){return new Promise(function(_0x3eef8f,_0x3a9ac0){var _0x17fcd2=_[_0xf096('0x46')](_0x212575[_0xf096('0x53')]);_0x3eef8f({'count':_0x17fcd2['length'],'rows':_0x17fcd2});});},'SmsQueuesWaitingInteractions':function(_0x6e2a56){return new Promise(function(_0x355a66,_0x2daa25){var _0x32e428=_['values'](_0x212575[_0xf096('0x54')]);_0x355a66({'count':_0x32e428[_0xf096('0x17')],'rows':_0x32e428});});},'FaxQueuesWaitingInteractions':function(_0x19dd42){return new Promise(function(_0x19da3f,_0x5675c6){var _0x23d992=_[_0xf096('0x46')](_0x212575[_0xf096('0x55')]);_0x19da3f({'count':_0x23d992[_0xf096('0x17')],'rows':_0x23d992});});},'WhatsappQueuesWaitingInteractions':function(_0x7271fb){return new Promise(function(_0x235175,_0x3924b6){var _0x29c89a=_[_0xf096('0x46')](_0x212575[_0xf096('0x56')]);_0x235175({'count':_0x29c89a[_0xf096('0x17')],'rows':_0x29c89a});});}};var _0x5543b3=jayson[_0xf096('0x57')](_0x3994dc)[_0xf096('0x58')]();_0x5543b3['on']('error',function(_0x359b4b){logger['error'](JSON[_0xf096('0x2f')](_0x359b4b));return _0x36ba27(_0x359b4b);});_0x5543b3[_0xf096('0x10')](0x232c,_0xf096('0x59'),function(){console[_0xf096('0x5a')](_0xf096('0x5b'),0x232c);return _0x25101a('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xefc6=['update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','../../../config/environment','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','message','interaction','applications','length','existsSync','join','app','autoreply','appdata','split','push','slice','dialogflow','tag','TagId','format','%s:%s:%s','./interval','condition','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','end','channel','QueueReport'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xefc6,0x148));var _0x6efc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xefc6[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x6efc('0x0'));var util=require(_0x6efc('0x1'));var path=require(_0x6efc('0x2'));var fs=require('fs');var jayson=require(_0x6efc('0x3'));var BPromise=require('bluebird');var uuid=require(_0x6efc('0x4'));var config=require(_0x6efc('0x5'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x6efc('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x6efc('0x7')),'smsQueueReport':require(_0x6efc('0x8')),'faxQueueReport':require(_0x6efc('0x9')),'whatsappQueueReport':require(_0x6efc('0xa'))};var RuleEngine=require(_0x6efc('0xb'));function getId(_0x53b03d,_0x6c37e6,_0x601a33){return util['format'](_0x6efc('0xc'),_0x53b03d,_0x6c37e6||0x0,_0x601a33||0x0);}function getIntervals(_0x34527f,_0x301886){var _0x389ebe=[];if(!_[_0x6efc('0xd')](_0x301886[_0x6efc('0xe')])&&!_[_0x6efc('0xd')](_0x34527f[_0x301886[_0x6efc('0xe')]])&&!_['isNil'](_0x34527f[_0x301886[_0x6efc('0xe')]]['Intervals'])){_0x389ebe=_[_0x6efc('0xf')](_0x34527f[_0x301886['IntervalId']][_0x6efc('0x10')],_0x6efc('0x11'));}else if(!_[_0x6efc('0xd')](_0x301886[_0x6efc('0x11')])){_0x389ebe=[_0x301886[_0x6efc('0x11')]];}return _0x389ebe;}exports[_0x6efc('0x12')]=function(_0x187d71){_0x187d71[_0x6efc('0x13')]={};return new BPromise(function(_0x21d4fd,_0x585580){var _0xadd1fd={'Start':function(_0x15d210){var _0x22badc=this;return new Promise(function(_0x434054,_0x3557a6){if(_0x15d210){try{var _0xc892e6=[];var _0xa668a7=getId(_0x15d210['channel'],_0x15d210[_0x6efc('0x14')]?_0x15d210[_0x6efc('0x14')]['id']:0x0,_0x15d210[_0x6efc('0x15')]?_0x15d210['interaction']['id']:0x0);if(_0x15d210[_0x6efc('0x16')]&&_['isArray'](_0x15d210[_0x6efc('0x16')])&&_0x15d210['applications']['length']){for(var _0x5428ea=0x0;_0x5428ea<_0x15d210[_0x6efc('0x16')][_0x6efc('0x17')];_0x5428ea+=0x1){var _0x51e089=_0x15d210[_0x6efc('0x16')][_0x5428ea];if(fs[_0x6efc('0x18')](path[_0x6efc('0x19')](__dirname,_0x6efc('0x16'),_0x51e089[_0x6efc('0x1a')]+'.js'))){var _0x5d682e=[];switch(_0x51e089[_0x6efc('0x1a')]['toLowerCase']()){case _0x6efc('0x1b'):var _0x14c60b=_0x51e089[_0x6efc('0x1c')][_0x6efc('0x1d')](',');_0x5d682e[_0x6efc('0x1e')](_0x14c60b[0x0]);_0x5d682e[_0x6efc('0x1e')](_0x14c60b[_0x6efc('0x1f')](0x1,_0x14c60b[_0x6efc('0x17')])[_0x6efc('0x19')](','));break;case _0x6efc('0x20'):var _0x3e2d39=_0x51e089[_0x6efc('0x1c')][_0x6efc('0x1d')](',');_0x5d682e[_0x6efc('0x1e')](_0x3e2d39[0x0]);_0x5d682e[_0x6efc('0x1e')](_0x3e2d39[0x1]);_0x5d682e[_0x6efc('0x1e')](_0x3e2d39[_0x6efc('0x1f')](0x2,_0x3e2d39['length'])[_0x6efc('0x19')](','));break;case'amazonlex':var _0x39434e=_0x51e089[_0x6efc('0x1c')][_0x6efc('0x1d')](',');_0x5d682e[_0x6efc('0x1e')](_0x39434e[0x0]);_0x5d682e[_0x6efc('0x1e')](_0x39434e[0x1]);_0x5d682e[_0x6efc('0x1e')](_0x39434e[0x2]);_0x5d682e[_0x6efc('0x1e')](_0x39434e[0x3]);_0x5d682e[_0x6efc('0x1e')](_0x39434e['slice'](0x4,_0x39434e[_0x6efc('0x17')])['join'](','));break;case'message':_0x5d682e['push'](_0x51e089[_0x6efc('0x1c')]);break;case _0x6efc('0x21'):_0x5d682e[_0x6efc('0x1e')](_0x51e089[_0x6efc('0x22')]);_0x5d682e[_0x6efc('0x1e')](_0x51e089['appdata']);break;default:_0x5d682e=_['isNil'](_0x51e089['appdata'])?[]:_0x51e089['appdata'][_0x6efc('0x1d')](',');}var _0x20f259={'id':util[_0x6efc('0x23')](_0x6efc('0x24'),_0xa668a7,_0x51e089['id'],_0x51e089[_0x6efc('0x1a')]),'condition':require(_0x6efc('0x25'))[_0x6efc('0x26')](_0xa668a7,getIntervals(_0x187d71['intervals'],_0x51e089),_0x187d71),'consequence':require('./applications/'+_0x51e089[_0x6efc('0x1a')])[_0x6efc('0x27')](_0xa668a7,_0x5d682e,_0x187d71,_0x15d210),'p':_0x51e089[_0x6efc('0x28')]||0x0};logger[_0x6efc('0x29')](_0x6efc('0x2a'),_0x20f259['id'],_0x6efc('0x2b'),getIntervals(_0x187d71[_0x6efc('0x2c')],_0x51e089)[_0x6efc('0x19')](_0x6efc('0x2d')));_0xc892e6[_0x6efc('0x1e')](_0x20f259);}else{logger['error'](_0x6efc('0x2e'),path[_0x6efc('0x19')](__dirname,_0x6efc('0x16'),_0x51e089[_0x6efc('0x1a')]+_0x6efc('0x2f')));}}_0x187d71[_0x6efc('0x13')][_0xa668a7]=new RuleEngine(_0xc892e6);_0x187d71[_0x6efc('0x13')][_0xa668a7][_0x6efc('0x30')](_0x15d210,function(_0x2bdb23){logger[_0x6efc('0x29')](_0x6efc('0x31'),JSON[_0x6efc('0x32')](_0x2bdb23[_0x6efc('0x33')]));if(_0x187d71[_0x6efc('0x13')][_0xa668a7]){_0x187d71[_0x6efc('0x13')][_0xa668a7][_0x6efc('0x34')](_0x6efc('0x35'));}});return _0x434054({'code':0xc8,'message':_0x15d210});}else{logger[_0x6efc('0x29')](_0x6efc('0x36'));return _0x434054({'code':0xc8,'message':_0x15d210});}}catch(_0x3719f3){logger[_0x6efc('0x37')](_0x3719f3['stack']);return _0x3557a6(_0x22badc['error'](0x1f4,_0x3719f3));}}return _0x3557a6(_0x6efc('0x38'));});},'AcceptMessage':function(_0x1503e8){var _0x3d5646=this;return new Promise(function(_0x1bc2ea,_0x37ef1f){if(_0x1503e8['message']&&_0x1503e8['message']['id']){try{var _0x77c2cc=getId(_0x1503e8['channel'],_0x1503e8[_0x6efc('0x14')]?_0x1503e8[_0x6efc('0x14')]['id']:0x0,_0x1503e8[_0x6efc('0x15')]?_0x1503e8['interaction']['id']:0x0);if(_0x187d71[_0x6efc('0x13')][_0x77c2cc]){_0x187d71[_0x6efc('0x13')][_0x77c2cc][_0x6efc('0x34')](_0x6efc('0x39'));if(rpc[_0x1503e8[_0x6efc('0x3a')]+'QueueReport']){rpc[_0x1503e8['channel']+_0x6efc('0x3b')][_0x6efc('0x3c')](_0x77c2cc,{'UserId':_0x1503e8[_0x6efc('0x14')][_0x6efc('0x3d')]})[_0x6efc('0x3e')](function(_0xde21c0){logger[_0x6efc('0x37')](_0x6efc('0x3f'));});}}return _0x1bc2ea({'code':0xc8,'message':_0x1503e8});}catch(_0x2930d4){logger[_0x6efc('0x37')](_0x2930d4[_0x6efc('0x40')]);return _0x37ef1f(_0x3d5646[_0x6efc('0x37')](0x1f4,_0x2930d4));}}logger[_0x6efc('0x37')](_0x6efc('0x41'));return _0x37ef1f(_0x3d5646[_0x6efc('0x37')](0x1f4,_0x6efc('0x41')));});},'RejectMessage':function(_0x4f142f){var _0x39e77a=this;return new Promise(function(_0x1e6d60,_0x58f193){if(_0x4f142f[_0x6efc('0x42')]&&_0x4f142f['agent']['id']){try{if(_0x187d71['agents'][_0x4f142f[_0x6efc('0x42')]['id']]){_0x187d71[_0x6efc('0x43')][_0x4f142f[_0x6efc('0x42')]['id']][_0x6efc('0x44')]=![];_0x187d71['agents'][_0x4f142f[_0x6efc('0x42')]['id']][_0x6efc('0x45')]=undefined;}return _0x1e6d60({'code':0xc8,'message':_0x4f142f});}catch(_0xd2aae6){logger[_0x6efc('0x37')](_0xd2aae6[_0x6efc('0x40')]);return _0x58f193(_0x39e77a[_0x6efc('0x37')](0x1f4,_0xd2aae6));}}logger[_0x6efc('0x37')](_0x6efc('0x41'));return _0x58f193(_0x39e77a[_0x6efc('0x37')](0x1f4,_0x6efc('0x41')));});},'AbandonInteraction':function(_0x600629){var _0xe27f1=this;return new Promise(function(_0x43c313,_0x3d72d7){if(_0x600629[_0x6efc('0x3a')]&&_0x600629[_0x6efc('0x15')]&&_0x600629[_0x6efc('0x15')]['id']){try{var _0x2f2f62=getId(_0x600629[_0x6efc('0x3a')],_0x600629['message']?_0x600629['message']['id']:0x0,_0x600629[_0x6efc('0x15')]?_0x600629['interaction']['id']:0x0);if(_0x187d71['rules'][_0x2f2f62]){_0x187d71[_0x6efc('0x13')][_0x2f2f62][_0x6efc('0x34')](_0x6efc('0x39'));}return _0x43c313({'code':0xc8,'message':_0x600629});}catch(_0x5022a5){logger[_0x6efc('0x37')](_0x5022a5[_0x6efc('0x40')]);return _0x3d72d7(_0xe27f1[_0x6efc('0x37')](0x1f4,_0x5022a5));}}logger['error']('message\x20is\x20empty');return _0x3d72d7(_0xe27f1[_0x6efc('0x37')](0x1f4,_0x6efc('0x41')));});},'AgentCapacity':function(_0x141ecb){var _0x100a23=this;return new Promise(function(_0x3d9be2,_0x51f211){if(_0x187d71[_0x6efc('0x43')][_0x6efc('0x46')](_0x141ecb['id'])){for(var _0x2d5955 in _0x141ecb[_0x6efc('0x47')]){if(_0x141ecb[_0x6efc('0x47')][_0x6efc('0x46')](_0x2d5955)){if(_0x187d71[_0x6efc('0x43')][_0x141ecb['id']][_0x6efc('0x46')](_0x2d5955+'CurrentCapacity')){_0x187d71[_0x6efc('0x43')][_0x141ecb['id']][_0x2d5955+_0x6efc('0x48')]=parseInt(_0x141ecb[_0x6efc('0x47')][_0x2d5955],0xa);}}}_0x187d71[_0x6efc('0x43')][_0x141ecb['id']][_0x6efc('0x49')]();return _0x3d9be2({'code':0xc8,'message':_0x187d71[_0x6efc('0x43')][_0x141ecb['id']]});}else{return _0x51f211(_0x100a23[_0x6efc('0x37')](0x1f4,_0x6efc('0x4a')));}});},'Agents':function(_0x21a210){return new Promise(function(_0x181b90,_0x3b5d65){var _0x44d3d4=_[_0x6efc('0x4b')](_0x187d71[_0x6efc('0x43')]);_0x181b90({'count':_0x44d3d4['length'],'rows':_0x44d3d4});});},'ChatQueues':function(_0x3b8a9d){return new Promise(function(_0x2845ee,_0x50f639){var _0x54d1dc=[];for(var _0x5b4dfa in _0x187d71[_0x6efc('0x4c')]){if(_0x187d71['chatQueues']['hasOwnProperty'](_0x5b4dfa)){var _0x1f3a72=_0x187d71['chatQueues'][_0x5b4dfa];var _0x4b22a2={'id':_0x1f3a72['id'],'available':_0x1f3a72[_0x6efc('0x4d')],'loggedIn':_0x1f3a72[_0x6efc('0x4e')],'name':_0x1f3a72[_0x6efc('0x4f')],'paused':_0x1f3a72['paused'],'waiting':_0x1f3a72[_0x6efc('0x50')]};_0x54d1dc[_0x6efc('0x1e')](_0x4b22a2);}}_0x2845ee({'count':_0x54d1dc[_0x6efc('0x17')],'rows':_0x54d1dc});});},'MailQueues':function(_0x32e45a){return new Promise(function(_0x440f64,_0x4d4880){var _0xf80c9c=[];for(var _0x4a84ed in _0x187d71[_0x6efc('0x51')]){if(_0x187d71[_0x6efc('0x51')][_0x6efc('0x46')](_0x4a84ed)){var _0x2043d9=_0x187d71[_0x6efc('0x51')][_0x4a84ed];var _0x256014={'id':_0x2043d9['id'],'available':_0x2043d9[_0x6efc('0x4d')],'loggedIn':_0x2043d9['loggedIn'],'name':_0x2043d9[_0x6efc('0x4f')],'paused':_0x2043d9[_0x6efc('0x52')],'waiting':_0x2043d9[_0x6efc('0x50')]};_0xf80c9c[_0x6efc('0x1e')](_0x256014);}}_0x440f64({'count':_0xf80c9c[_0x6efc('0x17')],'rows':_0xf80c9c});});},'OpenchannelQueues':function(_0x4e84f6){return new Promise(function(_0x5b0226,_0x3855c2){var _0x30ae46=[];for(var _0x975843 in _0x187d71['openchannelQueues']){if(_0x187d71[_0x6efc('0x53')][_0x6efc('0x46')](_0x975843)){var _0x139e39=_0x187d71[_0x6efc('0x53')][_0x975843];var _0x3cd3f1={'id':_0x139e39['id'],'available':_0x139e39['available'],'loggedIn':_0x139e39[_0x6efc('0x4e')],'name':_0x139e39[_0x6efc('0x4f')],'paused':_0x139e39[_0x6efc('0x52')],'waiting':_0x139e39[_0x6efc('0x50')]};_0x30ae46['push'](_0x3cd3f1);}}_0x5b0226({'count':_0x30ae46[_0x6efc('0x17')],'rows':_0x30ae46});});},'SmsQueues':function(_0x3ad1eb){return new Promise(function(_0x40447c,_0x56f112){var _0x1594c3=[];for(var _0x7a73ed in _0x187d71[_0x6efc('0x54')]){if(_0x187d71['smsQueues'][_0x6efc('0x46')](_0x7a73ed)){var _0x4ff9ae=_0x187d71['smsQueues'][_0x7a73ed];var _0x1f08d8={'id':_0x4ff9ae['id'],'available':_0x4ff9ae[_0x6efc('0x4d')],'loggedIn':_0x4ff9ae[_0x6efc('0x4e')],'name':_0x4ff9ae[_0x6efc('0x4f')],'paused':_0x4ff9ae[_0x6efc('0x52')],'waiting':_0x4ff9ae['waiting']};_0x1594c3[_0x6efc('0x1e')](_0x1f08d8);}}_0x40447c({'count':_0x1594c3[_0x6efc('0x17')],'rows':_0x1594c3});});},'FaxQueues':function(_0x429eb2){return new Promise(function(_0x42b573,_0x23987e){var _0x11e87e=[];for(var _0x15c183 in _0x187d71[_0x6efc('0x55')]){if(_0x187d71[_0x6efc('0x55')][_0x6efc('0x46')](_0x15c183)){var _0x2767bf=_0x187d71['faxQueues'][_0x15c183];var _0x583269={'id':_0x2767bf['id'],'available':_0x2767bf['available'],'loggedIn':_0x2767bf[_0x6efc('0x4e')],'name':_0x2767bf[_0x6efc('0x4f')],'paused':_0x2767bf['paused'],'waiting':_0x2767bf[_0x6efc('0x50')]};_0x11e87e['push'](_0x583269);}}_0x42b573({'count':_0x11e87e[_0x6efc('0x17')],'rows':_0x11e87e});});},'WhatsappQueues':function(_0x4e79d2){return new Promise(function(_0x3ce6c0,_0x5b9c93){var _0xf3d478=[];for(var _0x4e805f in _0x187d71[_0x6efc('0x56')]){if(_0x187d71['whatsappQueues'][_0x6efc('0x46')](_0x4e805f)){var _0x530d12=_0x187d71[_0x6efc('0x56')][_0x4e805f];var _0x498756={'id':_0x530d12['id'],'available':_0x530d12[_0x6efc('0x4d')],'loggedIn':_0x530d12['loggedIn'],'name':_0x530d12['name'],'paused':_0x530d12[_0x6efc('0x52')],'waiting':_0x530d12[_0x6efc('0x50')]};_0xf3d478[_0x6efc('0x1e')](_0x498756);}}_0x3ce6c0({'count':_0xf3d478[_0x6efc('0x17')],'rows':_0xf3d478});});},'ChatQueuesWaitingInteractions':function(_0x33e5b7){return new Promise(function(_0x590304,_0x4b1ea1){var _0x2570ee=_[_0x6efc('0x4b')](_0x187d71[_0x6efc('0x57')]);_0x590304({'count':_0x2570ee['length'],'rows':_0x2570ee});});},'MailQueuesWaitingInteractions':function(_0x158e86){return new Promise(function(_0x17fe27,_0x1eb46a){var _0x3a57cb=_['values'](_0x187d71[_0x6efc('0x58')]);_0x17fe27({'count':_0x3a57cb[_0x6efc('0x17')],'rows':_0x3a57cb});});},'OpenchannelQueuesWaitingInteractions':function(_0x397839){return new Promise(function(_0x4dde60,_0x5b0857){var _0xe20e62=_[_0x6efc('0x4b')](_0x187d71[_0x6efc('0x59')]);_0x4dde60({'count':_0xe20e62[_0x6efc('0x17')],'rows':_0xe20e62});});},'SmsQueuesWaitingInteractions':function(_0x1df85a){return new Promise(function(_0xac0230,_0x3c484c){var _0x39dd76=_[_0x6efc('0x4b')](_0x187d71[_0x6efc('0x5a')]);_0xac0230({'count':_0x39dd76[_0x6efc('0x17')],'rows':_0x39dd76});});},'FaxQueuesWaitingInteractions':function(_0x36c4c3){return new Promise(function(_0x5301a3,_0x2c110e){var _0x13a4ee=_[_0x6efc('0x4b')](_0x187d71[_0x6efc('0x5b')]);_0x5301a3({'count':_0x13a4ee[_0x6efc('0x17')],'rows':_0x13a4ee});});},'WhatsappQueuesWaitingInteractions':function(_0x28a54f){return new Promise(function(_0xae0c1a,_0x5a9852){var _0x4c3a64=_[_0x6efc('0x4b')](_0x187d71['whatsappQueuesWaitingInteractions']);_0xae0c1a({'count':_0x4c3a64['length'],'rows':_0x4c3a64});});}};var _0x22950b=jayson[_0x6efc('0x5c')](_0xadd1fd)['http']();_0x22950b['on']('error',function(_0x539ed7){logger[_0x6efc('0x37')](JSON[_0x6efc('0x32')](_0x539ed7));return _0x585580(_0x539ed7);});_0x22950b[_0x6efc('0x12')](0x232c,_0x6efc('0x5d'),function(){console[_0x6efc('0x5e')](_0x6efc('0x5f'),0x232c);return _0x21d4fd(_0x6efc('0x60')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index b9b0aca..72e05d2 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 _0x1a71=['when','util','bluebird','jayson/promise','../../../config/logger','routing','http','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20'];(function(_0xdd7a7b,_0x254b3a){var _0x40ca7d=function(_0x4c2744){while(--_0x4c2744){_0xdd7a7b['push'](_0xdd7a7b['shift']());}};_0x40ca7d(++_0x254b3a);}(_0x1a71,0x8d));var _0x11a7=function(_0x526786,_0x105cbf){_0x526786=_0x526786-0x0;var _0x3a512d=_0x1a71[_0x526786];return _0x3a512d;};'use strict';var util=require(_0x11a7('0x0'));var BPromise=require(_0x11a7('0x1'));var jayson=require(_0x11a7('0x2'));var _=require('lodash');var logger=require(_0x11a7('0x3'))(_0x11a7('0x4'));var client=jayson['client'][_0x11a7('0x5')]({'port':0x232a});function request(_0x5f38c4,_0x248739){return new BPromise(function(_0x10c9d5,_0x2e3b7d){return client['request'](_0x5f38c4,_0x248739)[_0x11a7('0x6')](function(_0x5df8e0){if(_0x5df8e0[_0x11a7('0x7')]){return _0x2e3b7d(_0x5df8e0['error'][_0x11a7('0x8')]);}else{return _0x10c9d5(_0x5df8e0[_0x11a7('0x9')]);}})[_0x11a7('0xa')](function(_0x18f86c){return _0x2e3b7d(_0x18f86c);});});}exports[_0x11a7('0xb')]=function(_0x39b37c,_0x15818c,_0x1f6187){return function(_0xcaab2a){if(_0x1f6187[_0x11a7('0xc')]&&!_0x1f6187[_0x11a7('0xc')][_0x39b37c]){logger['info'](_0x11a7('0xd'),_0x39b37c);return _0xcaab2a[_0x11a7('0xe')]();}var _0x15d5dd=[];for(var _0x277a7e=0x0;_0x277a7e<_0x15818c['length'];_0x277a7e+=0x1){_0x15d5dd[_0x11a7('0xf')](request(_0x11a7('0x10'),{'command':util[_0x11a7('0x11')](_0x11a7('0x12'),_0x15818c[_0x277a7e])})[_0x11a7('0x6')](function(_0x5b2aac){return _0x5b2aac&&_0x5b2aac[_0x11a7('0x8')]&&_0x5b2aac[_0x11a7('0x8')][_0x11a7('0x13')](_0x11a7('0x14'))>=0x0?!![]:![];})[_0x11a7('0xa')](function(_0x1e5899){logger[_0x11a7('0x7')](_0x11a7('0x15'),_0x39b37c,_0x15818c[_0x277a7e]);}));}BPromise[_0x11a7('0x16')](_0x15d5dd)[_0x11a7('0x6')](function(_0x12d9e8){var _0x3f6c04=_[_0x11a7('0x17')](_0x12d9e8);logger['info'](_0x11a7('0x18'),_0x39b37c,_0x15818c[_0x11a7('0x19')](_0x11a7('0x1a')),_0x3f6c04);_0xcaab2a[_0x11a7('0x1b')](_0x3f6c04);})[_0x11a7('0xa')](function(_0x1eddc3){console['log'](_0x1eddc3);logger[_0x11a7('0x7')](_0x11a7('0x18'),_0x39b37c,_0x15818c[_0x11a7('0x19')](_0x11a7('0x1a')),_0x1eddc3['stack']);_0xcaab2a[_0x11a7('0xe')]();});};}; \ No newline at end of file +var _0x3be8=['then','error','result','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','some','\x20|\x20','when','log','stop','util','bluebird','jayson/promise','routing','client','http','request'];(function(_0x1b44cf,_0x4aaa5e){var _0x4620f9=function(_0x7e06e1){while(--_0x7e06e1){_0x1b44cf['push'](_0x1b44cf['shift']());}};_0x4620f9(++_0x4aaa5e);}(_0x3be8,0x1b9));var _0x83be=function(_0x5ea7e0,_0x2f46f2){_0x5ea7e0=_0x5ea7e0-0x0;var _0x1c49c7=_0x3be8[_0x5ea7e0];return _0x1c49c7;};'use strict';var util=require(_0x83be('0x0'));var BPromise=require(_0x83be('0x1'));var jayson=require(_0x83be('0x2'));var _=require('lodash');var logger=require('../../../config/logger')(_0x83be('0x3'));var client=jayson[_0x83be('0x4')][_0x83be('0x5')]({'port':0x232a});function request(_0x1252f5,_0x2f07f1){return new BPromise(function(_0x2cc38,_0x39b566){return client[_0x83be('0x6')](_0x1252f5,_0x2f07f1)[_0x83be('0x7')](function(_0x14ef0a){if(_0x14ef0a['error']){return _0x39b566(_0x14ef0a[_0x83be('0x8')]['message']);}else{return _0x2cc38(_0x14ef0a[_0x83be('0x9')]);}})[_0x83be('0xa')](function(_0x3e9357){return _0x39b566(_0x3e9357);});});}exports['condition']=function(_0x49fc27,_0x2bcc78,_0x11d452){return function(_0x4ce562){if(_0x11d452[_0x83be('0xb')]&&!_0x11d452[_0x83be('0xb')][_0x49fc27]){logger[_0x83be('0xc')](_0x83be('0xd'),_0x49fc27);return _0x4ce562['stop']();}var _0x49694f=[];for(var _0x50d6e9=0x0;_0x50d6e9<_0x2bcc78[_0x83be('0xe')];_0x50d6e9+=0x1){_0x49694f[_0x83be('0xf')](request(_0x83be('0x10'),{'command':util[_0x83be('0x11')](_0x83be('0x12'),_0x2bcc78[_0x50d6e9])})[_0x83be('0x7')](function(_0x35e02a){return _0x35e02a&&_0x35e02a[_0x83be('0x13')]&&_0x35e02a['message'][_0x83be('0x14')](_0x83be('0x15'))>=0x0?!![]:![];})[_0x83be('0xa')](function(_0x285da0){logger[_0x83be('0x8')](_0x83be('0x16'),_0x49fc27,_0x2bcc78[_0x50d6e9]);}));}BPromise['all'](_0x49694f)[_0x83be('0x7')](function(_0x5ba20a){var _0x2a17ca=_[_0x83be('0x17')](_0x5ba20a);logger[_0x83be('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x49fc27,_0x2bcc78['join'](_0x83be('0x18')),_0x2a17ca);_0x4ce562[_0x83be('0x19')](_0x2a17ca);})[_0x83be('0xa')](function(_0x5054d6){console[_0x83be('0x1a')](_0x5054d6);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x49fc27,_0x2bcc78['join']('\x20|\x20'),_0x5054d6['stack']);_0x4ce562[_0x83be('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 488d7fb..8057a8a 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 _0x377a=['complete','blindtransfer','transfereruniqueid','transfer','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','origtransfererexten','transfereeuniqueid','clone','calleridname','agentcalledAt','agententerreason','secondtransfererexten','transfertargetuniqueid','hangup','rejected','util','./utils','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','now','called','connectedlinename','error','stack','isNil','agentringnoanswer','agentringnoanswerAt','timeout','reason','ringtime','push','queuecallerabandon','includes','abandoned','holdtime','agentconnect','agentconnectAt','forIn','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcompleteAt','diffTime'];(function(_0x37f66a,_0x43d36c){var _0x3478a1=function(_0x4386e5){while(--_0x4386e5){_0x37f66a['push'](_0x37f66a['shift']());}};_0x3478a1(++_0x43d36c);}(_0x377a,0xe4));var _0xa377=function(_0x2fba2b,_0x4977bf){_0x2fba2b=_0x2fba2b-0x0;var _0x438896=_0x377a[_0x2fba2b];return _0x438896;};'use strict';var _=require('lodash');var util=require(_0xa377('0x0'));var utils=require(_0xa377('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x409dcb,_0x15dffe){utils[_0xa377('0x2')](util['format'](_0xa377('0x3'),_0x409dcb[_0xa377('0x4')],_0x409dcb[_0xa377('0x5')],_0x409dcb[_0xa377('0x6')],_0x409dcb[_0xa377('0x7')],_0x409dcb[_0xa377('0x8')],_0x409dcb[_0xa377('0x9')],_0x409dcb[_0xa377('0xa')],_0x409dcb[_0xa377('0xb')]));if(_0x409dcb['queue']){utils[_0xa377('0xc')](_0x409dcb[_0xa377('0x6')])['then'](function(_0x3d2b83){if(_0x3d2b83){_0x409dcb[_0xa377('0xd')]=_0x3d2b83[_0xa377('0xd')];_0x409dcb[_0xa377('0xe')]=_0x409dcb[_0xa377('0xf')]?_0x3d2b83[_0xa377('0x10')]:![];_0x409dcb[_0xa377('0x11')]=_0x409dcb['agentacw']?_0x3d2b83[_0xa377('0x12')]:0x0;}utils[_0xa377('0x13')]('CreateVoiceAgentReport',_0x409dcb);});}else{utils[_0xa377('0x13')](_0xa377('0x14'),_0x409dcb);}if(_0x15dffe){delete transfers[_0x409dcb[_0xa377('0x4')]];}else{delete agents[_0x409dcb['destuniqueid']];}}exports[_0xa377('0x15')]=function(_0x2e0cd9){try{agents[_0x2e0cd9['destuniqueid']]=_0x2e0cd9;agents[_0x2e0cd9[_0xa377('0x16')]]['agentcalledAt']=utils[_0xa377('0x17')]();agents[_0x2e0cd9[_0xa377('0x16')]]['lastevent']=_0xa377('0x18');agents[_0x2e0cd9[_0xa377('0x16')]][_0xa377('0xa')]=null;agents[_0x2e0cd9[_0xa377('0x16')]][_0xa377('0x19')]=null;}catch(_0x18a1fa){utils[_0xa377('0x1a')](_0x18a1fa[_0xa377('0x1b')]);}};exports['agentringnoanswer']=function(_0x249ca3){try{if(!_[_0xa377('0x1c')](agents[_0x249ca3[_0xa377('0x16')]])){agents[_0x249ca3[_0xa377('0x16')]][_0xa377('0x1d')]=!![];agents[_0x249ca3['destuniqueid']][_0xa377('0x1e')]=utils[_0xa377('0x17')]();agents[_0x249ca3[_0xa377('0x16')]][_0xa377('0xb')]=_0xa377('0x1f');agents[_0x249ca3[_0xa377('0x16')]][_0xa377('0x20')]='timeout';agents[_0x249ca3['destuniqueid']]['holdtime']=_0x249ca3['ringtime']?parseInt(_0x249ca3[_0xa377('0x21')])/0x3e8:0x0;agents[_0x249ca3[_0xa377('0x16')]]['talktime']=0x0;unanswered[_0xa377('0x22')](_0x249ca3['destuniqueid']);}}catch(_0x1b78c2){utils['error'](_0x1b78c2[_0xa377('0x1b')]);}};exports[_0xa377('0x23')]=function(_0xddab84){try{_['forIn'](agents,function(_0x16f5a0,_0x871c0f){if(_0x16f5a0['uniqueid']==_0xddab84[_0xa377('0x4')]&&!_[_0xa377('0x24')](unanswered,_0x16f5a0['destuniqueid'])){_0x16f5a0[_0xa377('0x1d')]=!![];_0x16f5a0[_0xa377('0x1e')]=utils['now']();_0x16f5a0[_0xa377('0xb')]=_0xa377('0x25');_0x16f5a0['reason']=_0xa377('0x25');_0x16f5a0[_0xa377('0x26')]=_0xddab84[_0xa377('0x26')];_0x16f5a0['talktime']=0x0;writeDB(_0x16f5a0);}});}catch(_0x199bde){utils[_0xa377('0x1a')](_0x199bde[_0xa377('0x1b')]);}};exports[_0xa377('0x27')]=function(_0x4163c0){try{if(agents[_0x4163c0[_0xa377('0x16')]]){agents[_0x4163c0['destuniqueid']][_0xa377('0x28')]=utils['now']();agents[_0x4163c0[_0xa377('0x16')]]['connectedlinenum']=_0x4163c0[_0xa377('0xa')];agents[_0x4163c0[_0xa377('0x16')]][_0xa377('0x19')]=_0x4163c0[_0xa377('0x19')];agents[_0x4163c0[_0xa377('0x16')]][_0xa377('0x26')]=_0x4163c0[_0xa377('0x21')];agents[_0x4163c0[_0xa377('0x16')]]['lastevent']='connect';_[_0xa377('0x29')](agents,function(_0x55328f,_0x48cf53){if(_0x55328f[_0xa377('0x16')]!=_0x4163c0[_0xa377('0x16')]&&_0x55328f[_0xa377('0x4')]==_0x4163c0[_0xa377('0x4')]){_0x55328f[_0xa377('0x2a')]=0x0;_0x55328f[_0xa377('0x26')]=_0x4163c0['ringtime'];_0x55328f[_0xa377('0x1d')]=!![];_0x55328f[_0xa377('0x1e')]=utils[_0xa377('0x17')]();_0x55328f[_0xa377('0xb')]=_0xa377('0x2b');_0x55328f[_0xa377('0x20')]=_0xa377('0x2b');_0x55328f[_0xa377('0x2c')]=_0x4163c0['destuniqueid'];_0x55328f[_0xa377('0x2d')]=_0x4163c0[_0xa377('0x7')];writeDB(_0x55328f);}});}}catch(_0xd18d82){utils[_0xa377('0x1a')](_0xd18d82[_0xa377('0x1b')]);}};exports[_0xa377('0xf')]=function(_0x23d6dc){try{if(!_[_0xa377('0x1c')](agents[_0x23d6dc[_0xa377('0x16')]])){agents[_0x23d6dc['destuniqueid']][_0xa377('0xf')]=!![];agents[_0x23d6dc[_0xa377('0x16')]][_0xa377('0x2e')]=utils[_0xa377('0x17')]();agents[_0x23d6dc['destuniqueid']][_0xa377('0x2a')]=utils[_0xa377('0x2f')](agents[_0x23d6dc[_0xa377('0x16')]][_0xa377('0x2e')],agents[_0x23d6dc[_0xa377('0x16')]][_0xa377('0x28')]);agents[_0x23d6dc['destuniqueid']][_0xa377('0x20')]=_0x23d6dc[_0xa377('0x20')];agents[_0x23d6dc[_0xa377('0x16')]][_0xa377('0xb')]=_0xa377('0x30');writeDB(agents[_0x23d6dc[_0xa377('0x16')]]);}}catch(_0x325a71){utils[_0xa377('0x1a')](_0x325a71['stack']);}};exports[_0xa377('0x31')]=function(_0x58d73b){try{if(!_['isNil'](agents[_0x58d73b['transfereruniqueid']])){agents[_0x58d73b[_0xa377('0x32')]][_0xa377('0x33')]=!![];agents[_0x58d73b[_0xa377('0x32')]]['transfertype']='blind';agents[_0x58d73b[_0xa377('0x32')]][_0xa377('0x34')]=_0x58d73b[_0xa377('0x35')];agents[_0x58d73b['transfereruniqueid']][_0xa377('0x36')]=agents[_0x58d73b['transfereruniqueid']]['uniqueid'];}}catch(_0x51a704){utils[_0xa377('0x1a')](_0x51a704[_0xa377('0x1b')]);}};exports['attendedtransfer']=function(_0x233ec2){try{if(_0x233ec2[_0xa377('0x37')]==_0x233ec2[_0xa377('0x38')]){if(!_[_0xa377('0x1c')](agents[_0x233ec2['secondtransfereruniqueid']])){agents[_0x233ec2[_0xa377('0x39')]][_0xa377('0x33')]=!![];agents[_0x233ec2['secondtransfereruniqueid']][_0xa377('0x3a')]='ATTENDED';agents[_0x233ec2[_0xa377('0x39')]]['transferexten']=_0x233ec2[_0xa377('0x3b')];agents[_0x233ec2[_0xa377('0x39')]][_0xa377('0x36')]=_0x233ec2['origtransfereruniqueid'];}if(_0x233ec2[_0xa377('0x3c')]&&agents[_0x233ec2['transfereeuniqueid']]){agents[_0x233ec2['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x233ec2['transfereeuniqueid']]=_[_0xa377('0x3d')](agents[_0x233ec2[_0xa377('0x3c')]]);transfers[_0x233ec2[_0xa377('0x3c')]][_0xa377('0x9')]=agents[_0x233ec2[_0xa377('0x39')]][_0xa377('0x9')];transfers[_0x233ec2[_0xa377('0x3c')]][_0xa377('0x3e')]=agents[_0x233ec2[_0xa377('0x39')]][_0xa377('0x3e')];transfers[_0x233ec2['transfereeuniqueid']][_0xa377('0x3f')]=utils[_0xa377('0x17')]();transfers[_0x233ec2[_0xa377('0x3c')]][_0xa377('0x28')]=utils[_0xa377('0x17')]();transfers[_0x233ec2[_0xa377('0x3c')]]['holdtime']=0x0;transfers[_0x233ec2[_0xa377('0x3c')]][_0xa377('0x40')]=0x2;}}else if(_0x233ec2['secondtransfereruniqueid']==_0x233ec2['secondtransfererlinkedid']){if(!_[_0xa377('0x1c')](agents[_0x233ec2[_0xa377('0x37')]])){agents[_0x233ec2[_0xa377('0x37')]]['transfer']=!![];agents[_0x233ec2[_0xa377('0x37')]][_0xa377('0x3a')]='ATTENDED';agents[_0x233ec2['origtransfereruniqueid']][_0xa377('0x34')]=_0x233ec2[_0xa377('0x41')];agents[_0x233ec2['origtransfereruniqueid']][_0xa377('0x36')]=_0x233ec2[_0xa377('0x39')];}if(_0x233ec2['transfertargetuniqueid']&&agents[_0x233ec2[_0xa377('0x42')]]){agents[_0x233ec2['transfertargetuniqueid']][_0xa377('0x40')]=0x1;transfers[_0x233ec2[_0xa377('0x42')]]=_[_0xa377('0x3d')](agents[_0x233ec2[_0xa377('0x42')]]);transfers[_0x233ec2[_0xa377('0x42')]][_0xa377('0x9')]=agents[_0x233ec2[_0xa377('0x37')]][_0xa377('0x9')];transfers[_0x233ec2[_0xa377('0x42')]][_0xa377('0x3e')]=agents[_0x233ec2['origtransfereruniqueid']][_0xa377('0x3e')];transfers[_0x233ec2['transfertargetuniqueid']][_0xa377('0x3f')]=utils[_0xa377('0x17')]();transfers[_0x233ec2[_0xa377('0x42')]]['agentconnectAt']=utils[_0xa377('0x17')]();transfers[_0x233ec2['transfertargetuniqueid']][_0xa377('0x26')]=0x0;transfers[_0x233ec2['transfertargetuniqueid']][_0xa377('0x40')]=0x2;}}}catch(_0x172c61){utils[_0xa377('0x1a')](_0x172c61[_0xa377('0x1b')]);}};exports[_0xa377('0x43')]=function(_0x2b71a3){try{if(agents[_0x2b71a3[_0xa377('0x4')]]&&agents[_0x2b71a3[_0xa377('0x4')]]['reason']===_0xa377('0x1f')){if(_0x2b71a3['cause']==='21'){agents[_0x2b71a3[_0xa377('0x4')]][_0xa377('0x20')]=_0xa377('0x44');agents[_0x2b71a3[_0xa377('0x4')]][_0xa377('0xb')]=_0xa377('0x44');}writeDB(agents[_0x2b71a3[_0xa377('0x4')]]);var _0x10bc03=unanswered['indexOf'](_0x2b71a3[_0xa377('0x4')]);if(_0x10bc03>-0x1)unanswered['splice'](_0x10bc03,0x1);}if(transfers[_0x2b71a3['uniqueid']]){transfers[_0x2b71a3[_0xa377('0x4')]]['agentcomplete']=!![];transfers[_0x2b71a3['uniqueid']][_0xa377('0x2e')]=utils[_0xa377('0x17')]();transfers[_0x2b71a3[_0xa377('0x4')]]['talktime']=utils['diffTime'](transfers[_0x2b71a3['uniqueid']][_0xa377('0x2e')],transfers[_0x2b71a3[_0xa377('0x4')]][_0xa377('0x28')]);transfers[_0x2b71a3[_0xa377('0x4')]][_0xa377('0x20')]='agent';transfers[_0x2b71a3[_0xa377('0x4')]][_0xa377('0xb')]='complete';writeDB(transfers[_0x2b71a3[_0xa377('0x4')]],!![]);}if(agents[_0x2b71a3['uniqueid']]&&agents[_0x2b71a3[_0xa377('0x4')]]['agentconnectAt']){agents[_0x2b71a3['uniqueid']][_0xa377('0xf')]=!![];agents[_0x2b71a3[_0xa377('0x4')]]['agentcompleteAt']=utils[_0xa377('0x17')]();agents[_0x2b71a3['uniqueid']][_0xa377('0x2a')]=utils[_0xa377('0x2f')](agents[_0x2b71a3['uniqueid']][_0xa377('0x2e')],agents[_0x2b71a3['uniqueid']]['agentconnectAt']);agents[_0x2b71a3[_0xa377('0x4')]]['reason']=agents[_0x2b71a3[_0xa377('0x4')]][_0xa377('0x33')]?_0xa377('0x33'):'agent';agents[_0x2b71a3[_0xa377('0x4')]][_0xa377('0xb')]=_0xa377('0x30');writeDB(agents[_0x2b71a3[_0xa377('0x4')]]);}}catch(_0x57586b){utils[_0xa377('0x1a')](_0x57586b[_0xa377('0x1b')]);}}; \ No newline at end of file +var _0xce13=['origtransfereruniqueid','transfer','secondtransfereruniqueid','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','rejected','indexOf','splice','agent','lodash','util','info','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','channel','membername','interface','calleridnum','connectedlinenum','queue','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','agentcalled','destuniqueid','agentcalledAt','now','lastevent','connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','push','queuecallerabandon','forIn','uniqueid','includes','abandoned','holdtime','talktime','agentconnectAt','ringtime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','diffTime','agentcompleteAt','complete','blindtransfer','transfereruniqueid','blind','extension','transferuniqueid','attendedtransfer'];(function(_0x76e8a,_0x35dd32){var _0x37dd9c=function(_0x1d8a13){while(--_0x1d8a13){_0x76e8a['push'](_0x76e8a['shift']());}};_0x37dd9c(++_0x35dd32);}(_0xce13,0xe3));var _0x3ce1=function(_0x34f286,_0x175816){_0x34f286=_0x34f286-0x0;var _0xd7be31=_0xce13[_0x34f286];return _0xd7be31;};'use strict';var _=require(_0x3ce1('0x0'));var util=require(_0x3ce1('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x217b08,_0x73a969){utils[_0x3ce1('0x2')](util[_0x3ce1('0x3')](_0x3ce1('0x4'),_0x217b08['uniqueid'],_0x217b08[_0x3ce1('0x5')],_0x217b08['queue'],_0x217b08[_0x3ce1('0x6')],_0x217b08[_0x3ce1('0x7')],_0x217b08[_0x3ce1('0x8')],_0x217b08[_0x3ce1('0x9')],_0x217b08['lastevent']));if(_0x217b08[_0x3ce1('0xa')]){utils['getVoiceQueueByName'](_0x217b08[_0x3ce1('0xa')])[_0x3ce1('0xb')](function(_0x5e8fbf){if(_0x5e8fbf){_0x217b08[_0x3ce1('0xc')]=_0x5e8fbf[_0x3ce1('0xc')];_0x217b08[_0x3ce1('0xd')]=_0x217b08[_0x3ce1('0xe')]?_0x5e8fbf['acw']:![];_0x217b08[_0x3ce1('0xf')]=_0x217b08[_0x3ce1('0xd')]?_0x5e8fbf[_0x3ce1('0x10')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x217b08);});}else{utils[_0x3ce1('0x11')]('CreateVoiceAgentReport',_0x217b08);}if(_0x73a969){delete transfers[_0x217b08['uniqueid']];}else{delete agents[_0x217b08['destuniqueid']];}}exports[_0x3ce1('0x12')]=function(_0x4b5d38){try{agents[_0x4b5d38[_0x3ce1('0x13')]]=_0x4b5d38;agents[_0x4b5d38[_0x3ce1('0x13')]][_0x3ce1('0x14')]=utils[_0x3ce1('0x15')]();agents[_0x4b5d38[_0x3ce1('0x13')]][_0x3ce1('0x16')]='called';agents[_0x4b5d38[_0x3ce1('0x13')]][_0x3ce1('0x9')]=null;agents[_0x4b5d38[_0x3ce1('0x13')]][_0x3ce1('0x17')]=null;}catch(_0xcb2096){utils[_0x3ce1('0x18')](_0xcb2096[_0x3ce1('0x19')]);}};exports[_0x3ce1('0x1a')]=function(_0x47b9b2){try{if(!_[_0x3ce1('0x1b')](agents[_0x47b9b2[_0x3ce1('0x13')]])){agents[_0x47b9b2['destuniqueid']][_0x3ce1('0x1a')]=!![];agents[_0x47b9b2['destuniqueid']][_0x3ce1('0x1c')]=utils[_0x3ce1('0x15')]();agents[_0x47b9b2[_0x3ce1('0x13')]][_0x3ce1('0x16')]=_0x3ce1('0x1d');agents[_0x47b9b2[_0x3ce1('0x13')]][_0x3ce1('0x1e')]='timeout';agents[_0x47b9b2['destuniqueid']]['holdtime']=_0x47b9b2['ringtime']?parseInt(_0x47b9b2['ringtime'])/0x3e8:0x0;agents[_0x47b9b2['destuniqueid']]['talktime']=0x0;unanswered[_0x3ce1('0x1f')](_0x47b9b2[_0x3ce1('0x13')]);}}catch(_0x2a36da){utils[_0x3ce1('0x18')](_0x2a36da[_0x3ce1('0x19')]);}};exports[_0x3ce1('0x20')]=function(_0x237667){try{_[_0x3ce1('0x21')](agents,function(_0x478382,_0x37f6a8){if(_0x478382['uniqueid']==_0x237667[_0x3ce1('0x22')]&&!_[_0x3ce1('0x23')](unanswered,_0x478382['destuniqueid'])){_0x478382[_0x3ce1('0x1a')]=!![];_0x478382[_0x3ce1('0x1c')]=utils[_0x3ce1('0x15')]();_0x478382[_0x3ce1('0x16')]=_0x3ce1('0x24');_0x478382[_0x3ce1('0x1e')]='abandoned';_0x478382['holdtime']=_0x237667[_0x3ce1('0x25')];_0x478382[_0x3ce1('0x26')]=0x0;writeDB(_0x478382);}});}catch(_0x583eec){utils['error'](_0x583eec[_0x3ce1('0x19')]);}};exports['agentconnect']=function(_0x3e2dba){try{if(agents[_0x3e2dba[_0x3ce1('0x13')]]){agents[_0x3e2dba[_0x3ce1('0x13')]][_0x3ce1('0x27')]=utils['now']();agents[_0x3e2dba[_0x3ce1('0x13')]]['connectedlinenum']=_0x3e2dba[_0x3ce1('0x9')];agents[_0x3e2dba['destuniqueid']]['connectedlinename']=_0x3e2dba[_0x3ce1('0x17')];agents[_0x3e2dba[_0x3ce1('0x13')]][_0x3ce1('0x25')]=_0x3e2dba[_0x3ce1('0x28')];agents[_0x3e2dba['destuniqueid']]['lastevent']='connect';_[_0x3ce1('0x21')](agents,function(_0x2702e0,_0x2bf4e5){if(_0x2702e0['destuniqueid']!=_0x3e2dba[_0x3ce1('0x13')]&&_0x2702e0[_0x3ce1('0x22')]==_0x3e2dba[_0x3ce1('0x22')]){_0x2702e0[_0x3ce1('0x26')]=0x0;_0x2702e0[_0x3ce1('0x25')]=_0x3e2dba[_0x3ce1('0x28')];_0x2702e0[_0x3ce1('0x1a')]=!![];_0x2702e0[_0x3ce1('0x1c')]=utils[_0x3ce1('0x15')]();_0x2702e0['lastevent']='answered_elsewhere';_0x2702e0[_0x3ce1('0x1e')]=_0x3ce1('0x29');_0x2702e0[_0x3ce1('0x2a')]=_0x3e2dba[_0x3ce1('0x13')];_0x2702e0[_0x3ce1('0x2b')]=_0x3e2dba['membername'];writeDB(_0x2702e0);}});}}catch(_0x532ef7){utils[_0x3ce1('0x18')](_0x532ef7[_0x3ce1('0x19')]);}};exports[_0x3ce1('0xe')]=function(_0xb87344){try{if(!_[_0x3ce1('0x1b')](agents[_0xb87344[_0x3ce1('0x13')]])){agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0xe')]=!![];agents[_0xb87344['destuniqueid']]['agentcompleteAt']=utils[_0x3ce1('0x15')]();agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0x26')]=utils[_0x3ce1('0x2c')](agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0x2d')],agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0x27')]);agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0x1e')]=_0xb87344[_0x3ce1('0x1e')];agents[_0xb87344[_0x3ce1('0x13')]][_0x3ce1('0x16')]=_0x3ce1('0x2e');writeDB(agents[_0xb87344[_0x3ce1('0x13')]]);}}catch(_0x37bf8a){utils[_0x3ce1('0x18')](_0x37bf8a[_0x3ce1('0x19')]);}};exports[_0x3ce1('0x2f')]=function(_0x3c4815){try{if(!_[_0x3ce1('0x1b')](agents[_0x3c4815['transfereruniqueid']])){agents[_0x3c4815[_0x3ce1('0x30')]]['transfer']=!![];agents[_0x3c4815[_0x3ce1('0x30')]]['transfertype']=_0x3ce1('0x31');agents[_0x3c4815[_0x3ce1('0x30')]]['transferexten']=_0x3c4815[_0x3ce1('0x32')];agents[_0x3c4815[_0x3ce1('0x30')]][_0x3ce1('0x33')]=agents[_0x3c4815[_0x3ce1('0x30')]][_0x3ce1('0x22')];}}catch(_0x57035e){utils['error'](_0x57035e[_0x3ce1('0x19')]);}};exports[_0x3ce1('0x34')]=function(_0x1ce4c7){try{if(_0x1ce4c7[_0x3ce1('0x35')]==_0x1ce4c7['origtransfererlinkedid']){if(!_['isNil'](agents[_0x1ce4c7['secondtransfereruniqueid']])){agents[_0x1ce4c7['secondtransfereruniqueid']][_0x3ce1('0x36')]=!![];agents[_0x1ce4c7[_0x3ce1('0x37')]][_0x3ce1('0x38')]='ATTENDED';agents[_0x1ce4c7[_0x3ce1('0x37')]]['transferexten']=_0x1ce4c7[_0x3ce1('0x39')];agents[_0x1ce4c7[_0x3ce1('0x37')]][_0x3ce1('0x33')]=_0x1ce4c7['origtransfereruniqueid'];}if(_0x1ce4c7['transfereeuniqueid']&&agents[_0x1ce4c7[_0x3ce1('0x3a')]]){agents[_0x1ce4c7[_0x3ce1('0x3a')]][_0x3ce1('0x3b')]=0x1;transfers[_0x1ce4c7[_0x3ce1('0x3a')]]=_['clone'](agents[_0x1ce4c7[_0x3ce1('0x3a')]]);transfers[_0x1ce4c7['transfereeuniqueid']][_0x3ce1('0x8')]=agents[_0x1ce4c7['secondtransfereruniqueid']][_0x3ce1('0x8')];transfers[_0x1ce4c7[_0x3ce1('0x3a')]]['calleridname']=agents[_0x1ce4c7[_0x3ce1('0x37')]][_0x3ce1('0x3c')];transfers[_0x1ce4c7[_0x3ce1('0x3a')]]['agentcalledAt']=utils[_0x3ce1('0x15')]();transfers[_0x1ce4c7[_0x3ce1('0x3a')]][_0x3ce1('0x27')]=utils[_0x3ce1('0x15')]();transfers[_0x1ce4c7[_0x3ce1('0x3a')]][_0x3ce1('0x25')]=0x0;transfers[_0x1ce4c7[_0x3ce1('0x3a')]][_0x3ce1('0x3b')]=0x2;}}else if(_0x1ce4c7['secondtransfereruniqueid']==_0x1ce4c7[_0x3ce1('0x3d')]){if(!_[_0x3ce1('0x1b')](agents[_0x1ce4c7[_0x3ce1('0x35')]])){agents[_0x1ce4c7[_0x3ce1('0x35')]][_0x3ce1('0x36')]=!![];agents[_0x1ce4c7['origtransfereruniqueid']]['transfertype']=_0x3ce1('0x3e');agents[_0x1ce4c7[_0x3ce1('0x35')]]['transferexten']=_0x1ce4c7[_0x3ce1('0x3f')];agents[_0x1ce4c7['origtransfereruniqueid']][_0x3ce1('0x33')]=_0x1ce4c7[_0x3ce1('0x37')];}if(_0x1ce4c7[_0x3ce1('0x40')]&&agents[_0x1ce4c7[_0x3ce1('0x40')]]){agents[_0x1ce4c7['transfertargetuniqueid']][_0x3ce1('0x3b')]=0x1;transfers[_0x1ce4c7[_0x3ce1('0x40')]]=_[_0x3ce1('0x41')](agents[_0x1ce4c7[_0x3ce1('0x40')]]);transfers[_0x1ce4c7['transfertargetuniqueid']][_0x3ce1('0x8')]=agents[_0x1ce4c7['origtransfereruniqueid']][_0x3ce1('0x8')];transfers[_0x1ce4c7['transfertargetuniqueid']][_0x3ce1('0x3c')]=agents[_0x1ce4c7[_0x3ce1('0x35')]][_0x3ce1('0x3c')];transfers[_0x1ce4c7['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x1ce4c7[_0x3ce1('0x40')]]['agentconnectAt']=utils[_0x3ce1('0x15')]();transfers[_0x1ce4c7[_0x3ce1('0x40')]]['holdtime']=0x0;transfers[_0x1ce4c7[_0x3ce1('0x40')]]['agententerreason']=0x2;}}}catch(_0xe998a7){utils[_0x3ce1('0x18')](_0xe998a7[_0x3ce1('0x19')]);}};exports['hangup']=function(_0x4b218d){try{if(agents[_0x4b218d[_0x3ce1('0x22')]]&&agents[_0x4b218d[_0x3ce1('0x22')]]['reason']===_0x3ce1('0x1d')){if(_0x4b218d['cause']==='21'){agents[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x1e')]=_0x3ce1('0x42');agents[_0x4b218d['uniqueid']][_0x3ce1('0x16')]=_0x3ce1('0x42');}writeDB(agents[_0x4b218d['uniqueid']]);var _0x47ac87=unanswered[_0x3ce1('0x43')](_0x4b218d['uniqueid']);if(_0x47ac87>-0x1)unanswered[_0x3ce1('0x44')](_0x47ac87,0x1);}if(transfers[_0x4b218d[_0x3ce1('0x22')]]){transfers[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0xe')]=!![];transfers[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x2d')]=utils['now']();transfers[_0x4b218d['uniqueid']][_0x3ce1('0x26')]=utils[_0x3ce1('0x2c')](transfers[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x2d')],transfers[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x27')]);transfers[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x1e')]=_0x3ce1('0x45');transfers[_0x4b218d['uniqueid']][_0x3ce1('0x16')]=_0x3ce1('0x2e');writeDB(transfers[_0x4b218d[_0x3ce1('0x22')]],!![]);}if(agents[_0x4b218d['uniqueid']]&&agents[_0x4b218d['uniqueid']][_0x3ce1('0x27')]){agents[_0x4b218d['uniqueid']][_0x3ce1('0xe')]=!![];agents[_0x4b218d['uniqueid']]['agentcompleteAt']=utils[_0x3ce1('0x15')]();agents[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x26')]=utils['diffTime'](agents[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x2d')],agents[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x27')]);agents[_0x4b218d[_0x3ce1('0x22')]][_0x3ce1('0x1e')]=agents[_0x4b218d['uniqueid']]['transfer']?_0x3ce1('0x36'):'agent';agents[_0x4b218d['uniqueid']][_0x3ce1('0x16')]=_0x3ce1('0x2e');writeDB(agents[_0x4b218d[_0x3ce1('0x22')]]);}}catch(_0x21b4d0){utils['error'](_0x21b4d0[_0x3ce1('0x19')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 6b5efad..835138d 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 _0x2821=['starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','musiconholdstart','musiconholdstartAt','stack','mohtime','varset','variable','xmd-originatecalleridnum','value','xmd-phone','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','sipcallid','newexten','application','set','startsWith','appdata','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastapplication','lodash','NO\x20ANSWER','FAILED','BUSY','info','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','accountcode','source','callerid','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','context','now','DOCUMENTATION','error','newstate','isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','toNumber','ANSWERED','hangup','calleridname','duration','endtime'];(function(_0x486e7a,_0x43144d){var _0x56e2ff=function(_0x46464e){while(--_0x46464e){_0x486e7a['push'](_0x486e7a['shift']());}};_0x56e2ff(++_0x43144d);}(_0x2821,0x81));var _0x1282=function(_0x31b89c,_0x598284){_0x31b89c=_0x31b89c-0x0;var _0x46d3c0=_0x2821[_0x31b89c];return _0x46d3c0;};'use strict';var _=require(_0x1282('0x0'));var util=require('util');var utils=require('./utils');var dispositions=[_0x1282('0x1'),'FAILED',_0x1282('0x2'),_0x1282('0x1'),'NO\x20ANSWER','NO\x20ANSWER','ANSWERED',_0x1282('0x3'),_0x1282('0x2'),_0x1282('0x2'),_0x1282('0x2')];var channels={};function writeDB(_0x52393a){utils[_0x1282('0x4')](util['format'](_0x1282('0x5'),_0x52393a[_0x1282('0x6')],_0x52393a[_0x1282('0x7')],_0x52393a['type'],_0x52393a[_0x1282('0x8')],_0x52393a[_0x1282('0x9')],_0x52393a['destination'],_0x52393a[_0x1282('0xa')],_0x52393a['disposition']));if(_0x52393a[_0x1282('0x8')]){utils[_0x1282('0xb')](_0x52393a[_0x1282('0x8')])[_0x1282('0xc')](function(_0x32f5d7){if(_0x32f5d7){_0x52393a[_0x1282('0xd')]=_0x32f5d7['id'];}utils[_0x1282('0xe')](_0x1282('0xf'),_0x52393a);});}else{utils[_0x1282('0xe')](_0x1282('0xf'),_0x52393a);}if(channels[_0x52393a[_0x1282('0x6')]]){delete channels[_0x52393a[_0x1282('0x6')]];}}exports[_0x1282('0x10')]=function(_0x3bccc6){try{if(_0x3bccc6[_0x1282('0x6')]==_0x3bccc6[_0x1282('0x11')]&&_0x3bccc6['channel']!=_0x1282('0x12')){channels[_0x3bccc6['uniqueid']]={'uniqueid':_0x3bccc6[_0x1282('0x6')],'accountcode':_0x3bccc6[_0x1282('0x8')],'source':_0x3bccc6[_0x1282('0x13')],'destination':_0x3bccc6['exten'],'destinationcontext':_0x3bccc6[_0x1282('0x14')],'channel':_0x3bccc6['channel'],'starttime':utils[_0x1282('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1282('0x1'),'amaflags':_0x1282('0x16')};}}catch(_0x487e2c){utils[_0x1282('0x17')](_0x487e2c['stack']);}};exports[_0x1282('0x18')]=function(_0x1588c4){try{if(!_[_0x1282('0x19')](channels[_0x1588c4[_0x1282('0x6')]])&&_0x1588c4[_0x1282('0x1a')]==0x6){if(_[_0x1282('0x19')](channels[_0x1588c4[_0x1282('0x6')]][_0x1282('0x1b')])){channels[_0x1588c4[_0x1282('0x6')]][_0x1282('0x1b')]=utils['now']();}}else if(!_[_0x1282('0x19')](channels[_0x1588c4[_0x1282('0x11')]])&&_0x1588c4[_0x1282('0x1a')]==0x6&&_0x1588c4[_0x1282('0x14')]!=_0x1282('0x1c')){channels[_0x1588c4[_0x1282('0x11')]][_0x1282('0x8')]=_0x1588c4['accountcode'];channels[_0x1588c4[_0x1282('0x11')]][_0x1282('0x1d')]=_0x1588c4['channel'];if(_['isNil'](channels[_0x1588c4[_0x1282('0x11')]][_0x1282('0x1e')])){channels[_0x1588c4['linkedid']][_0x1282('0x1e')]=utils[_0x1282('0x15')]();}channels[_0x1588c4['linkedid']]['disposition']=dispositions[_[_0x1282('0x1f')](_0x1588c4[_0x1282('0x1a')])]||_0x1282('0x20');}}catch(_0x8a94d6){utils['error'](_0x8a94d6['stack']);}};exports[_0x1282('0x21')]=function(_0x408b81){try{if(!_[_0x1282('0x19')](channels[_0x408b81[_0x1282('0x6')]])){if(_[_0x1282('0x19')](channels[_0x408b81['uniqueid']][_0x1282('0xa')])){channels[_0x408b81[_0x1282('0x6')]][_0x1282('0xa')]=_0x408b81[_0x1282('0x22')]+'\x20<'+_0x408b81[_0x1282('0x13')]+'>';}channels[_0x408b81[_0x1282('0x6')]]['endtime']=utils[_0x1282('0x15')]();channels[_0x408b81[_0x1282('0x6')]][_0x1282('0x23')]=utils['diffTime'](channels[_0x408b81[_0x1282('0x6')]][_0x1282('0x24')],channels[_0x408b81[_0x1282('0x6')]][_0x1282('0x25')]);channels[_0x408b81['uniqueid']][_0x1282('0x26')]=channels[_0x408b81[_0x1282('0x6')]][_0x1282('0x1e')]?utils[_0x1282('0x27')](channels[_0x408b81[_0x1282('0x6')]][_0x1282('0x24')],channels[_0x408b81[_0x1282('0x6')]][_0x1282('0x1e')]):0x0;writeDB(channels[_0x408b81[_0x1282('0x6')]]);}}catch(_0xe91373){utils[_0x1282('0x17')](_0xe91373['stack']);}};exports[_0x1282('0x28')]=function(_0x11e4fe){try{if(!_[_0x1282('0x19')](channels[_0x11e4fe[_0x1282('0x29')]])){if(channels[_0x11e4fe['localtwolinkedid']]['channel']==_0x11e4fe[_0x1282('0x2a')]){channels[_0x11e4fe[_0x1282('0x29')]][_0x1282('0x1d')]=_0x11e4fe[_0x1282('0x2b')];channels[_0x11e4fe[_0x1282('0x29')]][_0x1282('0x2c')]=_0x1282('0x2d');}else if(channels[_0x11e4fe[_0x1282('0x29')]][_0x1282('0x7')]=_0x11e4fe[_0x1282('0x2e')]){channels[_0x11e4fe[_0x1282('0x29')]][_0x1282('0x1d')]=_0x11e4fe['origtransfererchannel'];channels[_0x11e4fe['localtwolinkedid']][_0x1282('0x2c')]=_0x1282('0x2d');}}}catch(_0x137181){utils[_0x1282('0x17')](_0x137181['stack']);}};exports[_0x1282('0x2f')]=function(_0x5df192){try{if(!_[_0x1282('0x19')](channels[_0x5df192[_0x1282('0x6')]])){channels[_0x5df192[_0x1282('0x6')]][_0x1282('0x30')]=utils[_0x1282('0x15')]();}}catch(_0x234972){utils['error'](_0x234972[_0x1282('0x31')]);}};exports['musiconholdstop']=function(_0x464ec6){try{if(!_[_0x1282('0x19')](channels[_0x464ec6[_0x1282('0x6')]])){if(!_[_0x1282('0x19')](channels[_0x464ec6[_0x1282('0x6')]]['musiconholdstartAt'])){channels[_0x464ec6['uniqueid']][_0x1282('0x32')]+=utils['diffTime'](utils['now'](),channels[_0x464ec6[_0x1282('0x6')]][_0x1282('0x30')]);delete channels[_0x464ec6[_0x1282('0x6')]][_0x1282('0x30')];}}}catch(_0xe589b5){utils[_0x1282('0x17')](_0xe589b5[_0x1282('0x31')]);}};exports[_0x1282('0x33')]=function(_0xd1d192){try{if(!_[_0x1282('0x19')](channels[_0xd1d192[_0x1282('0x6')]])){if(!_[_0x1282('0x19')](_0xd1d192[_0x1282('0x34')][_0x1282('0x35')])){channels[_0xd1d192['uniqueid']][_0x1282('0x9')]=_0xd1d192[_0x1282('0x36')];}if(!_[_0x1282('0x19')](_0xd1d192['variable'][_0x1282('0x37')])){channels[_0xd1d192[_0x1282('0x6')]][_0x1282('0x38')]=_0xd1d192[_0x1282('0x36')];channels[_0xd1d192[_0x1282('0x6')]][_0x1282('0xa')]='\x22'+_0xd1d192[_0x1282('0x36')]+'\x22\x20<'+_0xd1d192[_0x1282('0x36')]+'>';}if(!_['isNil'](_0xd1d192[_0x1282('0x34')][_0x1282('0x39')])||!_[_0x1282('0x19')](_0xd1d192['variable'][_0x1282('0x3a')])){channels[_0xd1d192[_0x1282('0x6')]]['callerid']=_0xd1d192[_0x1282('0x36')];}if(!_[_0x1282('0x19')](_0xd1d192[_0x1282('0x34')][_0x1282('0x3b')])||!_[_0x1282('0x19')](_0xd1d192[_0x1282('0x34')][_0x1282('0x3c')])){channels[_0xd1d192[_0x1282('0x6')]]['lastapplication']=_0x1282('0x3d');channels[_0xd1d192['uniqueid']][_0x1282('0x3e')]=_0xd1d192[_0x1282('0x36')];channels[_0xd1d192[_0x1282('0x6')]]['queue']=!![];}if(!_[_0x1282('0x19')](_0xd1d192['variable'][_0x1282('0x3f')])){channels[_0xd1d192['uniqueid']][_0x1282('0x40')]=_0xd1d192['value'];}if(!_['isNil'](_0xd1d192[_0x1282('0x34')][_0x1282('0x41')])){channels[_0xd1d192[_0x1282('0x6')]]['type']=_0xd1d192[_0x1282('0x36')];}if(!_[_0x1282('0x19')](_0xd1d192[_0x1282('0x34')][_0x1282('0x42')])){channels[_0xd1d192[_0x1282('0x6')]]['routeid']=_0xd1d192['value'];}if(!_[_0x1282('0x19')](_0xd1d192[_0x1282('0x34')][_0x1282('0x43')])){channels[_0xd1d192['uniqueid']][_0x1282('0x43')]=_0xd1d192[_0x1282('0x36')];}}}catch(_0x4e0d6f){utils[_0x1282('0x17')](_0x4e0d6f[_0x1282('0x31')]);}};exports[_0x1282('0x44')]=function(_0x16e2ee){try{if(!_[_0x1282('0x19')](channels[_0x16e2ee[_0x1282('0x6')]])){if(_0x16e2ee[_0x1282('0x45')]['toLowerCase']()==_0x1282('0x46')&&_[_0x1282('0x47')](_0x16e2ee[_0x1282('0x48')][_0x1282('0x49')](),_0x1282('0x4a'))){var _0x297950=_0x16e2ee[_0x1282('0x48')][_0x1282('0x4b')]('=');var _0x19b0a1=_0x297950[0x0][_0x1282('0x4c')](_0x297950[0x0][_0x1282('0x4d')]('(')+0x1,_0x297950[0x0][_0x1282('0x4d')](')'));var _0x19db94=_0x297950[0x1];channels[_0x16e2ee[_0x1282('0x6')]][_0x19b0a1]=_0x19db94;}if(!_[_0x1282('0x4e')](['hangup',_0x1282('0x4f'),_0x1282('0x50'),'set',_0x1282('0x51')],_0x16e2ee[_0x1282('0x45')]['toLowerCase']())){channels[_0x16e2ee[_0x1282('0x6')]][_0x1282('0x52')]=_0x16e2ee[_0x1282('0x45')];channels[_0x16e2ee['uniqueid']]['lastdata']=_0x16e2ee[_0x1282('0x48')];}}}catch(_0x39b914){utils[_0x1282('0x17')](_0x39b914[_0x1282('0x31')]);}}; \ No newline at end of file +var _0x2b2c=['sipcallid','newexten','application','toLowerCase','startsWith','appdata','substring','lastIndexOf','includes','noop','set','gotoif','lastapplication','lodash','util','./utils','FAILED','NO\x20ANSWER','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','source','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','linkedid','OutgoingSpoolFailed','now','DOCUMENTATION','error','channelstate','systemanswertime','context','transfer','destinationchannel','isNil','answertime','toNumber','ANSWERED','stack','endtime','duration','diffTime','billableseconds','attendedtransfer','secondtransfererchannel','localtwolinkedid','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','mohtime','varset','xmd-originatecalleridnum','variable','destination','value','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','Queue','lastdata','queue','xmd-contactid','xmd-cdrtype','outboundrouteid','routeid'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x2b2c,0x149));var _0xc2b2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2b2c[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xc2b2('0x0'));var util=require(_0xc2b2('0x1'));var utils=require(_0xc2b2('0x2'));var dispositions=['NO\x20ANSWER',_0xc2b2('0x3'),_0xc2b2('0x3'),_0xc2b2('0x4'),_0xc2b2('0x4'),_0xc2b2('0x4'),'ANSWERED',_0xc2b2('0x5'),_0xc2b2('0x3'),_0xc2b2('0x3'),'FAILED'];var channels={};function writeDB(_0x1740c2){utils[_0xc2b2('0x6')](util[_0xc2b2('0x7')](_0xc2b2('0x8'),_0x1740c2[_0xc2b2('0x9')],_0x1740c2[_0xc2b2('0xa')],_0x1740c2[_0xc2b2('0xb')],_0x1740c2[_0xc2b2('0xc')],_0x1740c2[_0xc2b2('0xd')],_0x1740c2['destination'],_0x1740c2[_0xc2b2('0xe')],_0x1740c2[_0xc2b2('0xf')]));if(_0x1740c2[_0xc2b2('0xc')]){utils[_0xc2b2('0x10')](_0x1740c2[_0xc2b2('0xc')])[_0xc2b2('0x11')](function(_0x10e140){if(_0x10e140){_0x1740c2[_0xc2b2('0x12')]=_0x10e140['id'];}utils[_0xc2b2('0x13')](_0xc2b2('0x14'),_0x1740c2);});}else{utils[_0xc2b2('0x13')](_0xc2b2('0x14'),_0x1740c2);}if(channels[_0x1740c2[_0xc2b2('0x9')]]){delete channels[_0x1740c2[_0xc2b2('0x9')]];}}exports['newchannel']=function(_0x4e2d66){try{if(_0x4e2d66[_0xc2b2('0x9')]==_0x4e2d66[_0xc2b2('0x15')]&&_0x4e2d66['channel']!=_0xc2b2('0x16')){channels[_0x4e2d66[_0xc2b2('0x9')]]={'uniqueid':_0x4e2d66[_0xc2b2('0x9')],'accountcode':_0x4e2d66[_0xc2b2('0xc')],'source':_0x4e2d66['calleridnum'],'destination':_0x4e2d66['exten'],'destinationcontext':_0x4e2d66['context'],'channel':_0x4e2d66[_0xc2b2('0xa')],'starttime':utils[_0xc2b2('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc2b2('0x4'),'amaflags':_0xc2b2('0x18')};}}catch(_0x3e97da){utils[_0xc2b2('0x19')](_0x3e97da['stack']);}};exports['newstate']=function(_0x54dfbd){try{if(!_['isNil'](channels[_0x54dfbd['uniqueid']])&&_0x54dfbd[_0xc2b2('0x1a')]==0x6){if(_['isNil'](channels[_0x54dfbd[_0xc2b2('0x9')]]['systemanswertime'])){channels[_0x54dfbd[_0xc2b2('0x9')]][_0xc2b2('0x1b')]=utils[_0xc2b2('0x17')]();}}else if(!_['isNil'](channels[_0x54dfbd['linkedid']])&&_0x54dfbd['channelstate']==0x6&&_0x54dfbd[_0xc2b2('0x1c')]!=_0xc2b2('0x1d')){channels[_0x54dfbd[_0xc2b2('0x15')]][_0xc2b2('0xc')]=_0x54dfbd[_0xc2b2('0xc')];channels[_0x54dfbd[_0xc2b2('0x15')]][_0xc2b2('0x1e')]=_0x54dfbd['channel'];if(_[_0xc2b2('0x1f')](channels[_0x54dfbd[_0xc2b2('0x15')]][_0xc2b2('0x20')])){channels[_0x54dfbd[_0xc2b2('0x15')]][_0xc2b2('0x20')]=utils[_0xc2b2('0x17')]();}channels[_0x54dfbd[_0xc2b2('0x15')]][_0xc2b2('0xf')]=dispositions[_[_0xc2b2('0x21')](_0x54dfbd[_0xc2b2('0x1a')])]||_0xc2b2('0x22');}}catch(_0x1ea913){utils[_0xc2b2('0x19')](_0x1ea913[_0xc2b2('0x23')]);}};exports['hangup']=function(_0x35ac44){try{if(!_[_0xc2b2('0x1f')](channels[_0x35ac44[_0xc2b2('0x9')]])){if(_[_0xc2b2('0x1f')](channels[_0x35ac44[_0xc2b2('0x9')]][_0xc2b2('0xe')])){channels[_0x35ac44[_0xc2b2('0x9')]][_0xc2b2('0xe')]=_0x35ac44['calleridname']+'\x20<'+_0x35ac44['calleridnum']+'>';}channels[_0x35ac44['uniqueid']][_0xc2b2('0x24')]=utils[_0xc2b2('0x17')]();channels[_0x35ac44['uniqueid']][_0xc2b2('0x25')]=utils[_0xc2b2('0x26')](channels[_0x35ac44[_0xc2b2('0x9')]][_0xc2b2('0x24')],channels[_0x35ac44[_0xc2b2('0x9')]]['starttime']);channels[_0x35ac44['uniqueid']][_0xc2b2('0x27')]=channels[_0x35ac44['uniqueid']][_0xc2b2('0x20')]?utils[_0xc2b2('0x26')](channels[_0x35ac44[_0xc2b2('0x9')]][_0xc2b2('0x24')],channels[_0x35ac44[_0xc2b2('0x9')]][_0xc2b2('0x20')]):0x0;writeDB(channels[_0x35ac44[_0xc2b2('0x9')]]);}}catch(_0x5b5fbc){utils[_0xc2b2('0x19')](_0x5b5fbc[_0xc2b2('0x23')]);}};exports[_0xc2b2('0x28')]=function(_0x4c949b){try{if(!_[_0xc2b2('0x1f')](channels[_0x4c949b['localtwolinkedid']])){if(channels[_0x4c949b['localtwolinkedid']][_0xc2b2('0xa')]==_0x4c949b['transfereechannel']){channels[_0x4c949b['localtwolinkedid']]['destinationchannel']=_0x4c949b[_0xc2b2('0x29')];channels[_0x4c949b[_0xc2b2('0x2a')]][_0xc2b2('0x2b')]=_0xc2b2('0x2c');}else if(channels[_0x4c949b[_0xc2b2('0x2a')]]['channel']=_0x4c949b[_0xc2b2('0x2d')]){channels[_0x4c949b[_0xc2b2('0x2a')]][_0xc2b2('0x1e')]=_0x4c949b[_0xc2b2('0x2e')];channels[_0x4c949b['localtwolinkedid']][_0xc2b2('0x2b')]=_0xc2b2('0x2c');}}}catch(_0x2b24cb){utils[_0xc2b2('0x19')](_0x2b24cb[_0xc2b2('0x23')]);}};exports[_0xc2b2('0x2f')]=function(_0x4152cc){try{if(!_[_0xc2b2('0x1f')](channels[_0x4152cc['uniqueid']])){channels[_0x4152cc['uniqueid']][_0xc2b2('0x30')]=utils[_0xc2b2('0x17')]();}}catch(_0x24c843){utils[_0xc2b2('0x19')](_0x24c843[_0xc2b2('0x23')]);}};exports['musiconholdstop']=function(_0x542f77){try{if(!_['isNil'](channels[_0x542f77[_0xc2b2('0x9')]])){if(!_[_0xc2b2('0x1f')](channels[_0x542f77[_0xc2b2('0x9')]][_0xc2b2('0x30')])){channels[_0x542f77['uniqueid']][_0xc2b2('0x31')]+=utils['diffTime'](utils[_0xc2b2('0x17')](),channels[_0x542f77[_0xc2b2('0x9')]][_0xc2b2('0x30')]);delete channels[_0x542f77[_0xc2b2('0x9')]][_0xc2b2('0x30')];}}}catch(_0x144fd4){utils[_0xc2b2('0x19')](_0x144fd4[_0xc2b2('0x23')]);}};exports[_0xc2b2('0x32')]=function(_0x3817e5){try{if(!_[_0xc2b2('0x1f')](channels[_0x3817e5[_0xc2b2('0x9')]])){if(!_[_0xc2b2('0x1f')](_0x3817e5['variable'][_0xc2b2('0x33')])){channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0xd')]=_0x3817e5['value'];}if(!_[_0xc2b2('0x1f')](_0x3817e5[_0xc2b2('0x34')]['xmd-phone'])){channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0x35')]=_0x3817e5[_0xc2b2('0x36')];channels[_0x3817e5['uniqueid']][_0xc2b2('0xe')]='\x22'+_0x3817e5[_0xc2b2('0x36')]+_0xc2b2('0x37')+_0x3817e5[_0xc2b2('0x36')]+'>';}if(!_[_0xc2b2('0x1f')](_0x3817e5[_0xc2b2('0x34')][_0xc2b2('0x38')])||!_['isNil'](_0x3817e5['variable'][_0xc2b2('0x39')])){channels[_0x3817e5['uniqueid']][_0xc2b2('0xe')]=_0x3817e5[_0xc2b2('0x36')];}if(!_[_0xc2b2('0x1f')](_0x3817e5[_0xc2b2('0x34')][_0xc2b2('0x3a')])||!_[_0xc2b2('0x1f')](_0x3817e5['variable']['xmcs-queue'])){channels[_0x3817e5[_0xc2b2('0x9')]]['lastapplication']=_0xc2b2('0x3b');channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0x3c')]=_0x3817e5[_0xc2b2('0x36')];channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0x3d')]=!![];}if(!_[_0xc2b2('0x1f')](_0x3817e5['variable'][_0xc2b2('0x3e')])){channels[_0x3817e5[_0xc2b2('0x9')]]['ContactId']=_0x3817e5[_0xc2b2('0x36')];}if(!_[_0xc2b2('0x1f')](_0x3817e5[_0xc2b2('0x34')][_0xc2b2('0x3f')])){channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0xb')]=_0x3817e5[_0xc2b2('0x36')];}if(!_[_0xc2b2('0x1f')](_0x3817e5[_0xc2b2('0x34')][_0xc2b2('0x40')])){channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0x41')]=_0x3817e5['value'];}if(!_['isNil'](_0x3817e5[_0xc2b2('0x34')][_0xc2b2('0x42')])){channels[_0x3817e5[_0xc2b2('0x9')]][_0xc2b2('0x42')]=_0x3817e5[_0xc2b2('0x36')];}}}catch(_0x25ad2d){utils[_0xc2b2('0x19')](_0x25ad2d[_0xc2b2('0x23')]);}};exports[_0xc2b2('0x43')]=function(_0x3aadaa){try{if(!_[_0xc2b2('0x1f')](channels[_0x3aadaa['uniqueid']])){if(_0x3aadaa[_0xc2b2('0x44')][_0xc2b2('0x45')]()=='set'&&_[_0xc2b2('0x46')](_0x3aadaa[_0xc2b2('0x47')][_0xc2b2('0x45')](),'cdr')){var _0x3af11e=_0x3aadaa[_0xc2b2('0x47')]['split']('=');var _0x4a3206=_0x3af11e[0x0][_0xc2b2('0x48')](_0x3af11e[0x0][_0xc2b2('0x49')]('(')+0x1,_0x3af11e[0x0]['lastIndexOf'](')'));var _0x4fc502=_0x3af11e[0x1];channels[_0x3aadaa[_0xc2b2('0x9')]][_0x4a3206]=_0x4fc502;}if(!_[_0xc2b2('0x4a')](['hangup',_0xc2b2('0x4b'),'execif',_0xc2b2('0x4c'),_0xc2b2('0x4d')],_0x3aadaa[_0xc2b2('0x44')][_0xc2b2('0x45')]())){channels[_0x3aadaa[_0xc2b2('0x9')]][_0xc2b2('0x4e')]=_0x3aadaa[_0xc2b2('0x44')];channels[_0x3aadaa[_0xc2b2('0x9')]][_0xc2b2('0x3c')]=_0x3aadaa[_0xc2b2('0x47')];}}}catch(_0x1c4ff2){utils['error'](_0x1c4ff2[_0xc2b2('0x23')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d4b0502..6b8c3b0 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 _0x5075=['shutdown','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent','./utils','lodash','connect','info','CONNECTED'];(function(_0x347498,_0x332242){var _0x334f2b=function(_0x4156d1){while(--_0x4156d1){_0x347498['push'](_0x347498['shift']());}};_0x334f2b(++_0x332242);}(_0x5075,0x73));var _0x5507=function(_0x27787d,_0x3c832a){_0x27787d=_0x27787d-0x0;var _0x2ec19c=_0x5075[_0x27787d];return _0x2ec19c;};'use strict';var utils=require(_0x5507('0x0'));var _=require(_0x5507('0x1'));exports[_0x5507('0x2')]=function(){utils[_0x5507('0x3')](_0x5507('0x4'));};exports[_0x5507('0x5')]=function(){utils[_0x5507('0x3')]('SHUTDOWN');};exports[_0x5507('0x6')]=function(){utils[_0x5507('0x3')](_0x5507('0x7'));};exports['error']=function(_0x5b6d7f){utils[_0x5507('0x8')](_0x5b6d7f);};exports[_0x5507('0x9')]=function(){utils['info'](_0x5507('0xa'));};exports[_0x5507('0xb')]=function(_0xbf4b50){}; \ No newline at end of file +var _0xa6b0=['lodash','CONNECTED','shutdown','info','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent','./utils'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x46b958,_0x1e77f6){_0x46b958=_0x46b958-0x0;var _0x2be5e6=_0xa6b0[_0x46b958];return _0x2be5e6;};'use strict';var utils=require(_0x0a6b('0x0'));var _=require(_0x0a6b('0x1'));exports['connect']=function(){utils['info'](_0x0a6b('0x2'));};exports[_0x0a6b('0x3')]=function(){utils[_0x0a6b('0x4')]('SHUTDOWN');};exports[_0x0a6b('0x5')]=function(){utils[_0x0a6b('0x4')](_0x0a6b('0x6'));};exports[_0x0a6b('0x7')]=function(_0x3dc2b0){utils[_0x0a6b('0x7')](_0x3dc2b0);};exports[_0x0a6b('0x8')]=function(){utils[_0x0a6b('0x4')](_0x0a6b('0x9'));};exports[_0x0a6b('0xa')]=function(_0x8e89f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 295d001..b20cd05 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 _0x2700=['value','stack','assign','now','lastevent','called','dialend','dialstatus','answertime','connect','complete','duration','diffTime','endtime','starttime','holdtime','billableseconds','lodash','util','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','dialstring','request','CreateVoiceDialReport','newexten','set','startsWith','cdr(routeid)','appdata','error','varset','isNil','variable'];(function(_0x967d1a,_0x48dd36){var _0x21dd69=function(_0x512c43){while(--_0x512c43){_0x967d1a['push'](_0x967d1a['shift']());}};_0x21dd69(++_0x48dd36);}(_0x2700,0xc0));var _0x0270=function(_0xc1861d,_0x45aebb){_0xc1861d=_0xc1861d-0x0;var _0x41376a=_0x2700[_0xc1861d];return _0x41376a;};'use strict';var _=require(_0x0270('0x0'));var util=require(_0x0270('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x433261){utils[_0x0270('0x2')](util[_0x0270('0x3')](_0x0270('0x4'),_0x433261[_0x0270('0x5')],_0x433261['channel'],_0x433261[_0x0270('0x6')],_0x433261['calleridnum'],_0x433261['connectedlinenum'],_0x433261['dialstatus']));utils[_0x0270('0x7')](_0x0270('0x8'),_0x433261);delete dials[_0x433261[_0x0270('0x5')]];}exports[_0x0270('0x9')]=function(_0x5b8cd6){try{if(_0x5b8cd6['application']['toLowerCase']()==_0x0270('0xa')&&_[_0x0270('0xb')](_0x5b8cd6['appdata']['toLowerCase'](),_0x0270('0xc'))){var _0x211dfb=_0x5b8cd6[_0x0270('0xd')]['split']('=');dials[_0x5b8cd6[_0x0270('0x5')]]={'routeId':_0x211dfb[0x1]};}}catch(_0xd393a){utils[_0x0270('0xe')](_0xd393a['stack']);}};exports[_0x0270('0xf')]=function(_0x4c870e){try{if(!_[_0x0270('0x10')](_0x4c870e[_0x0270('0x11')]['outboundrouteid'])){dials[_0x4c870e['uniqueid']]={'routeId':_0x4c870e[_0x0270('0x12')]};}}catch(_0x36df1e){utils[_0x0270('0xe')](_0x36df1e[_0x0270('0x13')]);}};exports['dialbegin']=function(_0xf85974){try{if(!_['isNil'](dials[_0xf85974['uniqueid']])){dials[_0xf85974[_0x0270('0x5')]]=_[_0x0270('0x14')](dials[_0xf85974[_0x0270('0x5')]],_0xf85974);dials[_0xf85974[_0x0270('0x5')]]['starttime']=utils[_0x0270('0x15')]();dials[_0xf85974[_0x0270('0x5')]][_0x0270('0x16')]=_0x0270('0x17');}}catch(_0x3550ab){utils['error'](_0x3550ab['stack']);}};exports[_0x0270('0x18')]=function(_0x45e27d){try{if(!_[_0x0270('0x10')](dials[_0x45e27d[_0x0270('0x5')]])){dials[_0x45e27d[_0x0270('0x5')]]['dialstatus']=_0x45e27d[_0x0270('0x19')];if(_0x45e27d[_0x0270('0x19')]=='ANSWER'){dials[_0x45e27d[_0x0270('0x5')]]=_[_0x0270('0x14')](dials[_0x45e27d['uniqueid']],_0x45e27d);dials[_0x45e27d[_0x0270('0x5')]][_0x0270('0x1a')]=utils['now']();dials[_0x45e27d[_0x0270('0x5')]][_0x0270('0x16')]=_0x0270('0x1b');}}}catch(_0x2beaf9){utils['error'](_0x2beaf9['stack']);}};exports['hangup']=function(_0x2ce605){try{if(!_[_0x0270('0x10')](dials[_0x2ce605[_0x0270('0x5')]])){dials[_0x2ce605[_0x0270('0x5')]]=_['assign'](dials[_0x2ce605[_0x0270('0x5')]],{'endtime':utils['now'](),'lastevent':_0x0270('0x1c')});dials[_0x2ce605[_0x0270('0x5')]][_0x0270('0x1d')]=utils[_0x0270('0x1e')](dials[_0x2ce605[_0x0270('0x5')]][_0x0270('0x1f')],dials[_0x2ce605[_0x0270('0x5')]][_0x0270('0x20')]);dials[_0x2ce605[_0x0270('0x5')]][_0x0270('0x21')]=utils[_0x0270('0x1e')](dials[_0x2ce605[_0x0270('0x5')]][_0x0270('0x1a')]||dials[_0x2ce605[_0x0270('0x5')]][_0x0270('0x1f')],dials[_0x2ce605[_0x0270('0x5')]][_0x0270('0x20')]);dials[_0x2ce605[_0x0270('0x5')]][_0x0270('0x22')]=dials[_0x2ce605[_0x0270('0x5')]][_0x0270('0x1a')]?utils[_0x0270('0x1e')](dials[_0x2ce605['uniqueid']][_0x0270('0x1f')],dials[_0x2ce605['uniqueid']][_0x0270('0x1a')]):0x0;writeDB(dials[_0x2ce605['uniqueid']]);}}catch(_0x1d5524){utils[_0x0270('0xe')](_0x1d5524['stack']);}}; \ No newline at end of file +var _0xf84a=['hangup','duration','diffTime','endtime','holdtime','billableseconds','answertime','./utils','info','format','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','request','newexten','application','set','startsWith','appdata','toLowerCase','cdr(routeid)','error','stack','varset','isNil','variable','outboundrouteid','dialbegin','assign','starttime','now','lastevent','dialend','connect'];(function(_0x291ee6,_0x474ca5){var _0x2f1dc2=function(_0xb293e){while(--_0xb293e){_0x291ee6['push'](_0x291ee6['shift']());}};_0x2f1dc2(++_0x474ca5);}(_0xf84a,0x97));var _0xaf84=function(_0x51e1aa,_0x453383){_0x51e1aa=_0x51e1aa-0x0;var _0x2fd1c8=_0xf84a[_0x51e1aa];return _0x2fd1c8;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xaf84('0x0'));var dials={};function writeDB(_0x205c20){utils[_0xaf84('0x1')](util[_0xaf84('0x2')]('DIAL|%s|%s|%s|%s|%s|%s',_0x205c20[_0xaf84('0x3')],_0x205c20[_0xaf84('0x4')],_0x205c20['dialstring'],_0x205c20[_0xaf84('0x5')],_0x205c20[_0xaf84('0x6')],_0x205c20[_0xaf84('0x7')]));utils[_0xaf84('0x8')]('CreateVoiceDialReport',_0x205c20);delete dials[_0x205c20[_0xaf84('0x3')]];}exports[_0xaf84('0x9')]=function(_0x30e31c){try{if(_0x30e31c[_0xaf84('0xa')]['toLowerCase']()==_0xaf84('0xb')&&_[_0xaf84('0xc')](_0x30e31c[_0xaf84('0xd')][_0xaf84('0xe')](),_0xaf84('0xf'))){var _0x222ccb=_0x30e31c['appdata']['split']('=');dials[_0x30e31c['uniqueid']]={'routeId':_0x222ccb[0x1]};}}catch(_0x5b654f){utils[_0xaf84('0x10')](_0x5b654f[_0xaf84('0x11')]);}};exports[_0xaf84('0x12')]=function(_0x4124c4){try{if(!_[_0xaf84('0x13')](_0x4124c4[_0xaf84('0x14')][_0xaf84('0x15')])){dials[_0x4124c4[_0xaf84('0x3')]]={'routeId':_0x4124c4['value']};}}catch(_0x26673f){utils[_0xaf84('0x10')](_0x26673f['stack']);}};exports[_0xaf84('0x16')]=function(_0x26200c){try{if(!_['isNil'](dials[_0x26200c[_0xaf84('0x3')]])){dials[_0x26200c[_0xaf84('0x3')]]=_[_0xaf84('0x17')](dials[_0x26200c[_0xaf84('0x3')]],_0x26200c);dials[_0x26200c[_0xaf84('0x3')]][_0xaf84('0x18')]=utils[_0xaf84('0x19')]();dials[_0x26200c[_0xaf84('0x3')]][_0xaf84('0x1a')]='called';}}catch(_0x2a11de){utils[_0xaf84('0x10')](_0x2a11de[_0xaf84('0x11')]);}};exports[_0xaf84('0x1b')]=function(_0x1e70e5){try{if(!_[_0xaf84('0x13')](dials[_0x1e70e5[_0xaf84('0x3')]])){dials[_0x1e70e5['uniqueid']]['dialstatus']=_0x1e70e5['dialstatus'];if(_0x1e70e5['dialstatus']=='ANSWER'){dials[_0x1e70e5['uniqueid']]=_[_0xaf84('0x17')](dials[_0x1e70e5[_0xaf84('0x3')]],_0x1e70e5);dials[_0x1e70e5[_0xaf84('0x3')]]['answertime']=utils[_0xaf84('0x19')]();dials[_0x1e70e5[_0xaf84('0x3')]]['lastevent']=_0xaf84('0x1c');}}}catch(_0x1c797c){utils[_0xaf84('0x10')](_0x1c797c[_0xaf84('0x11')]);}};exports[_0xaf84('0x1d')]=function(_0x577fb3){try{if(!_[_0xaf84('0x13')](dials[_0x577fb3[_0xaf84('0x3')]])){dials[_0x577fb3[_0xaf84('0x3')]]=_['assign'](dials[_0x577fb3[_0xaf84('0x3')]],{'endtime':utils[_0xaf84('0x19')](),'lastevent':'complete'});dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x1e')]=utils[_0xaf84('0x1f')](dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x20')],dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x18')]);dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x21')]=utils[_0xaf84('0x1f')](dials[_0x577fb3[_0xaf84('0x3')]]['answertime']||dials[_0x577fb3['uniqueid']][_0xaf84('0x20')],dials[_0x577fb3['uniqueid']][_0xaf84('0x18')]);dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x22')]=dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x23')]?utils[_0xaf84('0x1f')](dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x20')],dials[_0x577fb3[_0xaf84('0x3')]][_0xaf84('0x23')]):0x0;writeDB(dials[_0x577fb3['uniqueid']]);}}catch(_0x26beb1){utils[_0xaf84('0x10')](_0x26beb1[_0xaf84('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 6165edc..56daf86 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 _0x0983=['dialend','asterisk-manager','./utils','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin'];(function(_0x4ad553,_0x586c5a){var _0x136750=function(_0x11dfbc){while(--_0x11dfbc){_0x4ad553['push'](_0x4ad553['shift']());}};_0x136750(++_0x586c5a);}(_0x0983,0x151));var _0x3098=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x0983[_0xbd08b4];return _0x314f1e;};var AsteriskManager=require(_0x3098('0x0'));var config=require('../../config/environment');var utils=require(_0x3098('0x1'));var ami=new AsteriskManager(config[_0x3098('0x2')][_0x3098('0x3')],config[_0x3098('0x2')]['ip'],config[_0x3098('0x2')][_0x3098('0x4')],config['asterisk'][_0x3098('0x5')],!![]);ami[_0x3098('0x6')]();if(config[_0x3098('0x7')]&&config[_0x3098('0x7')][_0x3098('0x8')]){utils[_0x3098('0x9')](_0x3098('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0x3098('0xb'));var queues=require('./queues.controller');var recordings=require(_0x3098('0xc'));var members=require(_0x3098('0xd'));var dials=require('./dials.controller');var transfers=require(_0x3098('0xe'));var core=require(_0x3098('0xf'));ami['on'](_0x3098('0x10'),core[_0x3098('0x10')]);ami['on']('shutdown',core[_0x3098('0x11')]);ami['on']('fullybooted',core[_0x3098('0x12')]);ami['on'](_0x3098('0x13'),core['error']);ami['on'](_0x3098('0x14'),core['close']);ami['on'](_0x3098('0x15'),core['managerevent']);ami['on']('devicestatechange',function(_0x3a12db){try{members[_0x3098('0x16')](_0x3a12db);}catch(_0x2530b0){utils[_0x3098('0x13')](_0x2530b0);}});ami['on'](_0x3098('0x17'),function(_0x58a6fe){try{agents[_0x3098('0x17')](_0x58a6fe);}catch(_0x526a84){utils[_0x3098('0x13')](_0x526a84);}});ami['on'](_0x3098('0x18'),function(_0x50fbf7){try{agents['agentringnoanswer'](_0x50fbf7);}catch(_0x3c9766){utils[_0x3098('0x13')](_0x3c9766);}});ami['on'](_0x3098('0x19'),function(_0x869728){try{agents[_0x3098('0x19')](_0x869728);queues[_0x3098('0x19')](_0x869728);}catch(_0x28e6bc){utils[_0x3098('0x13')](_0x28e6bc);}});ami['on'](_0x3098('0x1a'),function(_0x4e15dc){try{agents['agentcomplete'](_0x4e15dc);queues['agentcomplete'](_0x4e15dc);members[_0x3098('0x1a')](_0x4e15dc);}catch(_0x174a6b){utils[_0x3098('0x13')](_0x174a6b);}});ami['on'](_0x3098('0x1b'),function(_0x435a26){try{agents['queuecallerabandon'](_0x435a26);queues[_0x3098('0x1b')](_0x435a26);}catch(_0x545ff2){utils[_0x3098('0x13')](_0x545ff2);}});ami['on']('queuecallerjoin',function(_0x1d6e56){try{queues[_0x3098('0x1c')](_0x1d6e56);recordings[_0x3098('0x1c')](_0x1d6e56);}catch(_0xedf698){utils['error'](_0xedf698);}});ami['on'](_0x3098('0x1d'),function(_0x39ab49){try{queues[_0x3098('0x1d')](_0x39ab49);}catch(_0x621042){utils[_0x3098('0x13')](_0x621042);}});ami['on'](_0x3098('0x1e'),function(_0xbfbde5){try{queues[_0x3098('0x1e')](_0xbfbde5);calls['musiconholdstart'](_0xbfbde5);}catch(_0x52f573){utils[_0x3098('0x13')](_0x52f573);}});ami['on'](_0x3098('0x1f'),function(_0x31897c){try{queues['musiconholdstop'](_0x31897c);calls[_0x3098('0x1f')](_0x31897c);}catch(_0xa3cc28){utils[_0x3098('0x13')](_0xa3cc28);}});ami['on'](_0x3098('0x20'),function(_0x5396af){try{calls[_0x3098('0x20')](_0x5396af);recordings[_0x3098('0x20')](_0x5396af);}catch(_0x29877d){utils[_0x3098('0x13')](_0x29877d);}});ami['on'](_0x3098('0x21'),function(_0x21f216){try{calls[_0x3098('0x21')](_0x21f216);recordings[_0x3098('0x21')](_0x21f216);dials[_0x3098('0x21')](_0x21f216);agents[_0x3098('0x21')](_0x21f216);queues[_0x3098('0x21')](_0x21f216);}catch(_0x554f6c){utils[_0x3098('0x13')](_0x554f6c);}});ami['on'](_0x3098('0x22'),function(_0x50436d){try{members[_0x3098('0x22')](_0x50436d);}catch(_0x46d2aa){utils[_0x3098('0x13')](_0x46d2aa);}});ami['on'](_0x3098('0x23'),function(_0x36d4e0){try{queues[_0x3098('0x23')](_0x36d4e0);agents['blindtransfer'](_0x36d4e0);transfers[_0x3098('0x23')](_0x36d4e0);}catch(_0x4c81e8){utils[_0x3098('0x13')](_0x4c81e8);}});ami['on'](_0x3098('0x24'),function(_0x3c69f9){try{queues[_0x3098('0x24')](_0x3c69f9);transfers[_0x3098('0x24')](_0x3c69f9);agents[_0x3098('0x24')](_0x3c69f9);calls[_0x3098('0x24')](_0x3c69f9);}catch(_0x44e7c9){utils['error'](_0x44e7c9);}});ami['on'](_0x3098('0x25'),function(_0x299c68){try{queues[_0x3098('0x25')](_0x299c68);recordings[_0x3098('0x25')](_0x299c68);calls[_0x3098('0x25')](_0x299c68);dials['varset'](_0x299c68);}catch(_0x5dd2f2){utils[_0x3098('0x13')](_0x5dd2f2);}});ami['on'](_0x3098('0x26'),function(_0x4953a0){try{calls[_0x3098('0x26')](_0x4953a0);recordings[_0x3098('0x26')](_0x4953a0);dials['newexten'](_0x4953a0);}catch(_0x4e2713){utils[_0x3098('0x13')](_0x4e2713);}});ami['on'](_0x3098('0x27'),function(_0x151b35){try{calls[_0x3098('0x27')](_0x151b35);recordings['newchannel'](_0x151b35);}catch(_0x10cf44){utils[_0x3098('0x13')](_0x10cf44);}});ami['on'](_0x3098('0x28'),function(_0x5848ff){try{dials[_0x3098('0x28')](_0x5848ff);}catch(_0x1345f8){utils[_0x3098('0x13')](_0x1345f8);}});ami['on']('dialend',function(_0x32a895){try{dials[_0x3098('0x29')](_0x32a895);}catch(_0x5c3b40){utils[_0x3098('0x13')](_0x5c3b40);}});} \ No newline at end of file +var _0x22e8=['./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller'];(function(_0x54bdce,_0x2d85b1){var _0x258e37=function(_0x5009bd){while(--_0x5009bd){_0x54bdce['push'](_0x54bdce['shift']());}};_0x258e37(++_0x2d85b1);}(_0x22e8,0x9e));var _0x822e=function(_0x174ccc,_0x3e4257){_0x174ccc=_0x174ccc-0x0;var _0x438b18=_0x22e8[_0x174ccc];return _0x438b18;};var AsteriskManager=require(_0x822e('0x0'));var config=require(_0x822e('0x1'));var utils=require(_0x822e('0x2'));var ami=new AsteriskManager(config['asterisk']['port'],config[_0x822e('0x3')]['ip'],config['asterisk']['username'],config[_0x822e('0x3')]['password'],!![]);ami[_0x822e('0x4')]();if(config[_0x822e('0x5')]&&config[_0x822e('0x5')][_0x822e('0x6')]){utils[_0x822e('0x7')](_0x822e('0x8'));}else{var agents=require(_0x822e('0x9'));var calls=require(_0x822e('0xa'));var queues=require(_0x822e('0xb'));var recordings=require(_0x822e('0xc'));var members=require(_0x822e('0xd'));var dials=require(_0x822e('0xe'));var transfers=require(_0x822e('0xf'));var core=require(_0x822e('0x10'));ami['on'](_0x822e('0x11'),core[_0x822e('0x11')]);ami['on'](_0x822e('0x12'),core[_0x822e('0x12')]);ami['on'](_0x822e('0x13'),core['fullybooted']);ami['on'](_0x822e('0x14'),core[_0x822e('0x14')]);ami['on'](_0x822e('0x15'),core[_0x822e('0x15')]);ami['on'](_0x822e('0x16'),core[_0x822e('0x16')]);ami['on'](_0x822e('0x17'),function(_0x4e0e17){try{members[_0x822e('0x17')](_0x4e0e17);}catch(_0x5b616b){utils[_0x822e('0x14')](_0x5b616b);}});ami['on'](_0x822e('0x18'),function(_0x389465){try{agents[_0x822e('0x18')](_0x389465);}catch(_0x5785ff){utils[_0x822e('0x14')](_0x5785ff);}});ami['on'](_0x822e('0x19'),function(_0x464d0b){try{agents[_0x822e('0x19')](_0x464d0b);}catch(_0x1fb429){utils[_0x822e('0x14')](_0x1fb429);}});ami['on'](_0x822e('0x1a'),function(_0x1cce18){try{agents[_0x822e('0x1a')](_0x1cce18);queues[_0x822e('0x1a')](_0x1cce18);}catch(_0x369371){utils[_0x822e('0x14')](_0x369371);}});ami['on'](_0x822e('0x1b'),function(_0xd19367){try{agents[_0x822e('0x1b')](_0xd19367);queues[_0x822e('0x1b')](_0xd19367);members[_0x822e('0x1b')](_0xd19367);}catch(_0x5f3fa1){utils[_0x822e('0x14')](_0x5f3fa1);}});ami['on'](_0x822e('0x1c'),function(_0x5c5ad5){try{agents[_0x822e('0x1c')](_0x5c5ad5);queues[_0x822e('0x1c')](_0x5c5ad5);}catch(_0xcff1d6){utils[_0x822e('0x14')](_0xcff1d6);}});ami['on'](_0x822e('0x1d'),function(_0x44e547){try{queues[_0x822e('0x1d')](_0x44e547);recordings[_0x822e('0x1d')](_0x44e547);}catch(_0x36db6b){utils[_0x822e('0x14')](_0x36db6b);}});ami['on']('queuecallerleave',function(_0x5af4d8){try{queues[_0x822e('0x1e')](_0x5af4d8);}catch(_0xd38fa5){utils[_0x822e('0x14')](_0xd38fa5);}});ami['on'](_0x822e('0x1f'),function(_0x49c198){try{queues['musiconholdstart'](_0x49c198);calls[_0x822e('0x1f')](_0x49c198);}catch(_0x242ad0){utils['error'](_0x242ad0);}});ami['on'](_0x822e('0x20'),function(_0x436e0b){try{queues[_0x822e('0x20')](_0x436e0b);calls[_0x822e('0x20')](_0x436e0b);}catch(_0x5a4ca5){utils[_0x822e('0x14')](_0x5a4ca5);}});ami['on'](_0x822e('0x21'),function(_0x398d76){try{calls[_0x822e('0x21')](_0x398d76);recordings[_0x822e('0x21')](_0x398d76);}catch(_0x4d93d8){utils[_0x822e('0x14')](_0x4d93d8);}});ami['on'](_0x822e('0x22'),function(_0x40a99c){try{calls[_0x822e('0x22')](_0x40a99c);recordings['hangup'](_0x40a99c);dials[_0x822e('0x22')](_0x40a99c);agents[_0x822e('0x22')](_0x40a99c);queues['hangup'](_0x40a99c);}catch(_0x176edc){utils[_0x822e('0x14')](_0x176edc);}});ami['on'](_0x822e('0x23'),function(_0x4cbf50){try{members[_0x822e('0x23')](_0x4cbf50);}catch(_0x20eb1d){utils[_0x822e('0x14')](_0x20eb1d);}});ami['on'](_0x822e('0x24'),function(_0xb112e3){try{queues['blindtransfer'](_0xb112e3);agents[_0x822e('0x24')](_0xb112e3);transfers[_0x822e('0x24')](_0xb112e3);}catch(_0x1f7a0e){utils[_0x822e('0x14')](_0x1f7a0e);}});ami['on'](_0x822e('0x25'),function(_0xcf0b76){try{queues[_0x822e('0x25')](_0xcf0b76);transfers['attendedtransfer'](_0xcf0b76);agents[_0x822e('0x25')](_0xcf0b76);calls[_0x822e('0x25')](_0xcf0b76);}catch(_0x1ce7b6){utils[_0x822e('0x14')](_0x1ce7b6);}});ami['on'](_0x822e('0x26'),function(_0x25de73){try{queues['varset'](_0x25de73);recordings[_0x822e('0x26')](_0x25de73);calls[_0x822e('0x26')](_0x25de73);dials['varset'](_0x25de73);}catch(_0x1bcd2b){utils[_0x822e('0x14')](_0x1bcd2b);}});ami['on'](_0x822e('0x27'),function(_0x1b89f5){try{calls[_0x822e('0x27')](_0x1b89f5);recordings[_0x822e('0x27')](_0x1b89f5);dials['newexten'](_0x1b89f5);}catch(_0x30686a){utils[_0x822e('0x14')](_0x30686a);}});ami['on'](_0x822e('0x28'),function(_0x3e9060){try{calls[_0x822e('0x28')](_0x3e9060);recordings[_0x822e('0x28')](_0x3e9060);}catch(_0x5535c7){utils[_0x822e('0x14')](_0x5535c7);}});ami['on'](_0x822e('0x29'),function(_0x860bd9){try{dials[_0x822e('0x29')](_0x860bd9);}catch(_0x5de2ac){utils['error'](_0x5de2ac);}});ami['on'](_0x822e('0x2a'),function(_0x3e3421){try{dials[_0x822e('0x2a')](_0x3e3421);}catch(_0x3fe31e){utils[_0x822e('0x14')](_0x3fe31e);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 67603c4..b6a0cef 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 _0xf124=['then','name','CreateMemberReport','split','internal','request','catch','error','some','startsWith','devicestatechange','state','BUSY','device','voice','TALKING','isNil','exitAt','enterAt','cdr','assign','data1','source','data3','destination','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','channel','data2','membername','type','getUserByInterface','interface'];(function(_0x43f32c,_0x2a941d){var _0xafa630=function(_0x2a9c04){while(--_0x2a9c04){_0x43f32c['push'](_0x43f32c['shift']());}};_0xafa630(++_0x2a941d);}(_0xf124,0xba));var _0x4f12=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0xf124[_0xe30e17];return _0x2342c9;};'use strict';var _=require(_0x4f12('0x0'));var util=require(_0x4f12('0x1'));var utils=require(_0x4f12('0x2'));var members={};var exclude=[_0x4f12('0x3'),_0x4f12('0x4')];function writeDB(_0x122d37){utils[_0x4f12('0x5')](util[_0x4f12('0x6')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x122d37[_0x4f12('0x7')],_0x122d37['interface'],_0x122d37[_0x4f12('0x8')],_0x122d37[_0x4f12('0x9')],_0x122d37[_0x4f12('0xa')],_0x122d37[_0x4f12('0xb')]));if(_0x122d37['interface']){utils[_0x4f12('0xc')](_0x122d37[_0x4f12('0xd')])[_0x4f12('0xe')](function(_0x58a0b0){if(_0x58a0b0){_0x122d37[_0x4f12('0xa')]=_0x58a0b0[_0x4f12('0xf')];_0x122d37['internal']=_0x58a0b0['internal'];utils['request'](_0x4f12('0x10'),_0x122d37);}else{utils['getUserByName'](_0x122d37[_0x4f12('0xd')][_0x4f12('0x11')]('/')[0x1])[_0x4f12('0xe')](function(_0x1a7fef){if(_0x1a7fef){_0x122d37[_0x4f12('0xa')]=_0x1a7fef['name'];_0x122d37[_0x4f12('0x12')]=_0x1a7fef[_0x4f12('0x12')];utils[_0x4f12('0x13')](_0x4f12('0x10'),_0x122d37);}});}})[_0x4f12('0x14')](function(_0x36edac){utils[_0x4f12('0x15')](_0x36edac);});}delete members[_0x122d37[_0x4f12('0xd')]];}function startsWith(_0x1f665a,_0x1be0e8){return _[_0x4f12('0x16')](_0x1f665a,function(_0x343ce0){return _[_0x4f12('0x17')](_0x1be0e8,_0x343ce0);});}exports[_0x4f12('0x18')]=function(_0x5ddbe8){switch(_0x5ddbe8[_0x4f12('0x19')]){case'INUSE':case _0x4f12('0x1a'):if(!startsWith(exclude,_0x5ddbe8['device'])){members[_0x5ddbe8[_0x4f12('0x1b')]]={'channel':_0x4f12('0x1c'),'interface':_0x5ddbe8['device'],'type':_0x4f12('0x1d'),'enterAt':utils['now'](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x4f12('0x1e')](members[_0x5ddbe8[_0x4f12('0x1b')]])){members[_0x5ddbe8[_0x4f12('0x1b')]][_0x4f12('0x1f')]=utils['now']();members[_0x5ddbe8[_0x4f12('0x1b')]]['duration']=utils['diffTime'](members[_0x5ddbe8[_0x4f12('0x1b')]][_0x4f12('0x1f')],members[_0x5ddbe8[_0x4f12('0x1b')]][_0x4f12('0x20')]);if(members[_0x5ddbe8['device']][_0x4f12('0x7')]){writeDB(members[_0x5ddbe8[_0x4f12('0x1b')]]);}}default:break;}};exports['agentcomplete']=function(_0x4305e5){if(!_[_0x4f12('0x1e')](members[_0x4305e5[_0x4f12('0xd')]])){members[_0x4305e5[_0x4f12('0xd')]]=_['assign'](members[_0x4305e5[_0x4f12('0xd')]],{'data4':_0x4305e5['queue'],'uniqueid':_0x4305e5[_0x4f12('0x7')]});}};exports[_0x4f12('0x21')]=function(_0x11446c){if(_0x11446c[_0x4f12('0x8')]){var _0x570a57=_0x11446c[_0x4f12('0x8')][_0x4f12('0x11')]('-')[0x0];if(!_['isNil'](members[_0x570a57])){members[_0x570a57]=_[_0x4f12('0x22')](members[_0x570a57],{'data1':members[_0x570a57][_0x4f12('0x23')]||_0x11446c['type'],'data2':members[_0x570a57][_0x4f12('0x9')]||_0x11446c[_0x4f12('0x24')],'data3':members[_0x570a57][_0x4f12('0x25')]||_0x11446c[_0x4f12('0x26')],'uniqueid':members[_0x570a57][_0x4f12('0x7')]||_0x11446c[_0x4f12('0x7')]});if(members[_0x570a57][_0x4f12('0x1f')]){writeDB(members[_0x570a57]);}}}if(_0x11446c[_0x4f12('0x27')]){var _0x4356f8=_0x11446c[_0x4f12('0x27')][_0x4f12('0x11')]('-')[0x0];if(!_['isNil'](members[_0x4356f8])){members[_0x4356f8]=_[_0x4f12('0x22')](members[_0x4356f8],{'data1':members[_0x4356f8][_0x4f12('0x23')]||_0x11446c[_0x4f12('0xb')],'data2':members[_0x4356f8][_0x4f12('0x9')]||_0x11446c[_0x4f12('0x24')],'data3':members[_0x4356f8][_0x4f12('0x25')]||_0x11446c[_0x4f12('0x26')],'uniqueid':members[_0x4356f8]['uniqueid']||_0x11446c['uniqueid']});if(members[_0x4356f8][_0x4f12('0x1f')]){writeDB(members[_0x4356f8]);}}}}; \ No newline at end of file +var _0x69b9=['type','data3','destination','destinationchannel','source','lodash','./utils','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','data2','membername','getUserByInterface','then','name','internal','request','split','CreateMemberReport','some','startsWith','devicestatechange','state','INUSE','BUSY','device','now','agent','NOT_INUSE','exitAt','diffTime','enterAt','agentcomplete','assign','queue','cdr','channel','isNil','data1'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0x69b9,0xb1));var _0x969b=function(_0x49e8a8,_0x416645){_0x49e8a8=_0x49e8a8-0x0;var _0x55a0aa=_0x69b9[_0x49e8a8];return _0x55a0aa;};'use strict';var _=require(_0x969b('0x0'));var util=require('util');var utils=require(_0x969b('0x1'));var members={};var exclude=[_0x969b('0x2'),_0x969b('0x3')];function writeDB(_0x72d910){utils[_0x969b('0x4')](util[_0x969b('0x5')](_0x969b('0x6'),_0x72d910[_0x969b('0x7')],_0x72d910[_0x969b('0x8')],_0x72d910['channel'],_0x72d910[_0x969b('0x9')],_0x72d910[_0x969b('0xa')],_0x72d910['type']));if(_0x72d910[_0x969b('0x8')]){utils[_0x969b('0xb')](_0x72d910[_0x969b('0x8')])[_0x969b('0xc')](function(_0x60482){if(_0x60482){_0x72d910[_0x969b('0xa')]=_0x60482[_0x969b('0xd')];_0x72d910[_0x969b('0xe')]=_0x60482[_0x969b('0xe')];utils[_0x969b('0xf')]('CreateMemberReport',_0x72d910);}else{utils['getUserByName'](_0x72d910[_0x969b('0x8')][_0x969b('0x10')]('/')[0x1])[_0x969b('0xc')](function(_0x5d9e87){if(_0x5d9e87){_0x72d910[_0x969b('0xa')]=_0x5d9e87[_0x969b('0xd')];_0x72d910[_0x969b('0xe')]=_0x5d9e87[_0x969b('0xe')];utils[_0x969b('0xf')](_0x969b('0x11'),_0x72d910);}});}})['catch'](function(_0x1723fc){utils['error'](_0x1723fc);});}delete members[_0x72d910[_0x969b('0x8')]];}function startsWith(_0x4293da,_0x3e9585){return _[_0x969b('0x12')](_0x4293da,function(_0x5b6c3b){return _[_0x969b('0x13')](_0x3e9585,_0x5b6c3b);});}exports[_0x969b('0x14')]=function(_0x14cb99){switch(_0x14cb99[_0x969b('0x15')]){case _0x969b('0x16'):case _0x969b('0x17'):if(!startsWith(exclude,_0x14cb99[_0x969b('0x18')])){members[_0x14cb99[_0x969b('0x18')]]={'channel':'voice','interface':_0x14cb99[_0x969b('0x18')],'type':'TALKING','enterAt':utils[_0x969b('0x19')](),'role':_0x969b('0x1a')};}break;case _0x969b('0x1b'):if(!_['isNil'](members[_0x14cb99[_0x969b('0x18')]])){members[_0x14cb99['device']][_0x969b('0x1c')]=utils[_0x969b('0x19')]();members[_0x14cb99[_0x969b('0x18')]]['duration']=utils[_0x969b('0x1d')](members[_0x14cb99[_0x969b('0x18')]][_0x969b('0x1c')],members[_0x14cb99[_0x969b('0x18')]][_0x969b('0x1e')]);if(members[_0x14cb99[_0x969b('0x18')]][_0x969b('0x7')]){writeDB(members[_0x14cb99[_0x969b('0x18')]]);}}default:break;}};exports[_0x969b('0x1f')]=function(_0x205659){if(!_['isNil'](members[_0x205659['interface']])){members[_0x205659[_0x969b('0x8')]]=_[_0x969b('0x20')](members[_0x205659[_0x969b('0x8')]],{'data4':_0x205659[_0x969b('0x21')],'uniqueid':_0x205659[_0x969b('0x7')]});}};exports[_0x969b('0x22')]=function(_0x27c6ef){if(_0x27c6ef[_0x969b('0x23')]){var _0x1b8ca2=_0x27c6ef[_0x969b('0x23')][_0x969b('0x10')]('-')[0x0];if(!_[_0x969b('0x24')](members[_0x1b8ca2])){members[_0x1b8ca2]=_['assign'](members[_0x1b8ca2],{'data1':members[_0x1b8ca2][_0x969b('0x25')]||_0x27c6ef[_0x969b('0x26')],'data2':members[_0x1b8ca2][_0x969b('0x9')]||_0x27c6ef['source'],'data3':members[_0x1b8ca2][_0x969b('0x27')]||_0x27c6ef[_0x969b('0x28')],'uniqueid':members[_0x1b8ca2][_0x969b('0x7')]||_0x27c6ef[_0x969b('0x7')]});if(members[_0x1b8ca2][_0x969b('0x1c')]){writeDB(members[_0x1b8ca2]);}}}if(_0x27c6ef['destinationchannel']){var _0x4eb5fb=_0x27c6ef[_0x969b('0x29')][_0x969b('0x10')]('-')[0x0];if(!_[_0x969b('0x24')](members[_0x4eb5fb])){members[_0x4eb5fb]=_[_0x969b('0x20')](members[_0x4eb5fb],{'data1':members[_0x4eb5fb][_0x969b('0x25')]||_0x27c6ef[_0x969b('0x26')],'data2':members[_0x4eb5fb][_0x969b('0x9')]||_0x27c6ef[_0x969b('0x2a')],'data3':members[_0x4eb5fb]['data3']||_0x27c6ef['destination'],'uniqueid':members[_0x4eb5fb][_0x969b('0x7')]||_0x27c6ef[_0x969b('0x7')]});if(members[_0x4eb5fb][_0x969b('0x1c')]){writeDB(members[_0x4eb5fb]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index e23a13c..1f69995 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 _0x5cf9=['ATTENDED','transferexten','origtransfereruniqueid','ATTENDEDTRANSFER','transfereelinkedid','calleridname','secondtransfereruniqueid','transfertargetlinkedid','transfertargetuniqueid','clone','mohtime','error','stack','musiconholdstart','musiconholdstartAt','util','./utils','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','lastAssignedTo','calleridnum','accountcode','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','assign','position','hangup','queuecallercomplete','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','isNil','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerexitAt','variable','queueposition','queuecallerexit','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','queuecallerabandonAt','assigned','destaccountcode','membername','agentcomplete','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','extension','transferuniqueid','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid'];(function(_0x2cd2f0,_0x2c1a55){var _0x137160=function(_0x62979c){while(--_0x62979c){_0x2cd2f0['push'](_0x2cd2f0['shift']());}};_0x137160(++_0x2c1a55);}(_0x5cf9,0x13f));var _0x95cf=function(_0x3af4e5,_0x3009b0){_0x3af4e5=_0x3af4e5-0x0;var _0x31d2be=_0x5cf9[_0x3af4e5];return _0x31d2be;};'use strict';var _=require('lodash');var util=require(_0x95cf('0x0'));var utils=require(_0x95cf('0x1'));var queues={};function writeDB(_0x2d25eb){utils['info'](util[_0x95cf('0x2')](_0x95cf('0x3'),_0x2d25eb['uniqueid'],_0x2d25eb['channel'],_0x2d25eb['queue'],_0x2d25eb[_0x95cf('0x4')],_0x2d25eb[_0x95cf('0x5')],_0x2d25eb[_0x95cf('0x6')],_0x2d25eb['queuecallerexitreason']));if(_0x2d25eb[_0x95cf('0x7')]){utils[_0x95cf('0x8')](_0x2d25eb[_0x95cf('0x7')])[_0x95cf('0x9')](function(_0xcd1ed8){if(_0xcd1ed8){_0x2d25eb['type']=_0xcd1ed8[_0x95cf('0xa')];}utils[_0x95cf('0xb')](_0x95cf('0xc'),_0x2d25eb);});}else{utils[_0x95cf('0xb')](_0x95cf('0xc'),_0x2d25eb);}if(_0x2d25eb[_0x95cf('0xd')]){delete queues[_0x2d25eb['transfereduniqueid']];}else{delete queues[_0x2d25eb[_0x95cf('0xe')]];}}exports['queuecallerjoin']=function(_0x129235){queues[_0x129235[_0x95cf('0xe')]]=_[_0x95cf('0xf')](_0x129235,{'originalposition':_0x129235[_0x95cf('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0x95cf('0x11')]=function(_0x399fc2){if(!_['isNil'](queues[_0x399fc2[_0x95cf('0xe')]])){if(queues[_0x399fc2[_0x95cf('0xe')]]['queuecallerleaveAt']){if(!queues[_0x399fc2[_0x95cf('0xe')]]['queuecallerabandon']&&!queues[_0x399fc2[_0x95cf('0xe')]]['queuecallerexit']){queues[_0x399fc2['uniqueid']][_0x95cf('0x12')]=!![];queues[_0x399fc2[_0x95cf('0xe')]][_0x95cf('0x13')]=utils[_0x95cf('0x14')]();queues[_0x399fc2['uniqueid']][_0x95cf('0x15')]=_0x95cf('0x16');}writeDB(queues[_0x399fc2[_0x95cf('0xe')]]);}else{if(queues[_0x399fc2[_0x95cf('0xe')]][_0x95cf('0xd')]){queues[queues[_0x399fc2[_0x95cf('0xe')]][_0x95cf('0xd')]]=queues[_0x399fc2[_0x95cf('0xe')]];queues[queues[_0x399fc2['uniqueid']][_0x95cf('0xd')]][_0x95cf('0x17')]=0x2;delete queues[_0x399fc2['uniqueid']];}}}};exports['varset']=function(_0x1fb22d){if(!_[_0x95cf('0x18')](_0x1fb22d['variable'][_0x95cf('0x19')])&&_0x1fb22d[_0x95cf('0x1a')][_0x95cf('0x1b')]()!==_0x95cf('0x1c')){if(!_[_0x95cf('0x18')](queues[_0x1fb22d[_0x95cf('0xe')]])){queues[_0x1fb22d[_0x95cf('0xe')]][_0x95cf('0x1d')]=![];queues[_0x1fb22d[_0x95cf('0xe')]]['queuecallerabandonAt']=null;queues[_0x1fb22d['uniqueid']]['queuecallerexit']=!![];queues[_0x1fb22d['uniqueid']][_0x95cf('0x1e')]=utils[_0x95cf('0x14')]();queues[_0x1fb22d[_0x95cf('0xe')]][_0x95cf('0x15')]=_0x1fb22d['value'][_0x95cf('0x1b')]();writeDB(queues[_0x1fb22d['uniqueid']]);}}else if(!_[_0x95cf('0x18')](_0x1fb22d[_0x95cf('0x1f')][_0x95cf('0x20')])){if(!_[_0x95cf('0x18')](queues[_0x1fb22d['uniqueid']])&&!queues[_0x1fb22d[_0x95cf('0xe')]][_0x95cf('0x1d')]){queues[_0x1fb22d[_0x95cf('0xe')]][_0x95cf('0x1d')]=![];queues[_0x1fb22d['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1fb22d['uniqueid']][_0x95cf('0x21')]=!![];queues[_0x1fb22d[_0x95cf('0xe')]][_0x95cf('0x1e')]=utils[_0x95cf('0x14')]();queues[_0x1fb22d[_0x95cf('0xe')]]['queuecallerexitreason']=_0x95cf('0x22');}}};exports['queuecallerabandon']=function(_0x4d349e){if(!_[_0x95cf('0x18')](queues[_0x4d349e[_0x95cf('0xe')]])){queues[_0x4d349e[_0x95cf('0xe')]][_0x95cf('0x21')]=![];queues[_0x4d349e[_0x95cf('0xe')]][_0x95cf('0x1e')]=null;queues[_0x4d349e[_0x95cf('0xe')]]['queuecallerabandon']=!![];queues[_0x4d349e[_0x95cf('0xe')]]['queuecallerabandonAt']=utils['now']();queues[_0x4d349e[_0x95cf('0xe')]][_0x95cf('0x15')]=_0x95cf('0x23');}};exports[_0x95cf('0x24')]=function(_0x258336){if(!_[_0x95cf('0x18')](queues[_0x258336[_0x95cf('0xe')]])){queues[_0x258336['uniqueid']][_0x95cf('0x24')]=!![];queues[_0x258336[_0x95cf('0xe')]][_0x95cf('0x25')]=utils[_0x95cf('0x14')]();queues[_0x258336[_0x95cf('0xe')]][_0x95cf('0x26')]=utils[_0x95cf('0x27')](queues[_0x258336['uniqueid']][_0x95cf('0x25')],queues[_0x258336[_0x95cf('0xe')]][_0x95cf('0x28')]);queues[_0x258336[_0x95cf('0xe')]][_0x95cf('0x10')]=_0x258336[_0x95cf('0x10')];queues[_0x258336[_0x95cf('0xe')]][_0x95cf('0x29')]=_0x258336['count'];queues[_0x258336[_0x95cf('0xe')]][_0x95cf('0x2a')]=_0x258336[_0x95cf('0x2a')];queues[_0x258336[_0x95cf('0xe')]]['connectedlinename']=_0x258336[_0x95cf('0x2b')];}};exports[_0x95cf('0x2c')]=function(_0x477c17){if(!_[_0x95cf('0x18')](queues[_0x477c17[_0x95cf('0xe')]])){queues[_0x477c17[_0x95cf('0xe')]][_0x95cf('0x1d')]=![];queues[_0x477c17[_0x95cf('0xe')]][_0x95cf('0x1d')]=![];queues[_0x477c17[_0x95cf('0xe')]][_0x95cf('0x2d')]=null;queues[_0x477c17[_0x95cf('0xe')]][_0x95cf('0x21')]=![];queues[_0x477c17[_0x95cf('0xe')]][_0x95cf('0x15')]=null;queues[_0x477c17[_0x95cf('0xe')]]['queuecallerexitAt']=null;queues[_0x477c17[_0x95cf('0xe')]][_0x95cf('0x2e')]=!![];queues[_0x477c17['uniqueid']]['accountcode']=_0x477c17[_0x95cf('0x2f')];queues[_0x477c17['uniqueid']][_0x95cf('0x4')]=_0x477c17[_0x95cf('0x30')];}};exports[_0x95cf('0x31')]=function(_0x24c79d){if(!_[_0x95cf('0x18')](queues[_0x24c79d[_0x95cf('0xe')]])){if(queues[_0x24c79d[_0x95cf('0xe')]][_0x95cf('0x25')]){queues[_0x24c79d[_0x95cf('0xe')]]['queuecallerabandon']=![];queues[_0x24c79d[_0x95cf('0xe')]][_0x95cf('0x1d')]=![];queues[_0x24c79d[_0x95cf('0xe')]]['queuecallerabandonAt']=null;queues[_0x24c79d['uniqueid']][_0x95cf('0x21')]=![];queues[_0x24c79d[_0x95cf('0xe')]]['queuecallerexitAt']=null;queues[_0x24c79d['uniqueid']][_0x95cf('0x2e')]=!![];queues[_0x24c79d[_0x95cf('0xe')]][_0x95cf('0x4')]=_0x24c79d[_0x95cf('0x30')];queues[_0x24c79d[_0x95cf('0xe')]]['queuecallercomplete']=!![];queues[_0x24c79d[_0x95cf('0xe')]]['queuecallercompleteAt']=utils[_0x95cf('0x14')]();if(_0x24c79d[_0x95cf('0x32')]==_0x95cf('0x33')){if(!queues[_0x24c79d[_0x95cf('0xe')]][_0x95cf('0x33')]){queues[_0x24c79d[_0x95cf('0xe')]][_0x95cf('0x15')]='TRANSFER';}}else{queues[_0x24c79d[_0x95cf('0xe')]][_0x95cf('0x15')]=_0x95cf('0x34')+_0x24c79d[_0x95cf('0x32')][_0x95cf('0x1b')]();}writeDB(queues[_0x24c79d[_0x95cf('0xe')]]);}}};exports[_0x95cf('0x35')]=function(_0x1cd06f){if(!_[_0x95cf('0x18')](queues[_0x1cd06f[_0x95cf('0x36')]])){queues[_0x1cd06f[_0x95cf('0x36')]]['transfer']=!![];queues[_0x1cd06f['transfereeuniqueid']][_0x95cf('0x37')]='BLIND';queues[_0x1cd06f[_0x95cf('0x36')]]['transferexten']=_0x1cd06f[_0x95cf('0x38')];queues[_0x1cd06f['transfereeuniqueid']][_0x95cf('0x39')]=_0x1cd06f[_0x95cf('0x36')];queues[_0x1cd06f['transfereeuniqueid']][_0x95cf('0x15')]='BLINDTRANSFER';}};exports[_0x95cf('0x3a')]=function(_0x115e36){try{if(_0x115e36['origtransfereruniqueid']==_0x115e36[_0x95cf('0x3b')]){if(!_[_0x95cf('0x18')](queues[_0x115e36[_0x95cf('0x3c')]])){queues[_0x115e36[_0x95cf('0x3c')]][_0x95cf('0x33')]=!![];queues[_0x115e36['secondtransfererlinkedid']]['transfertype']=_0x95cf('0x3d');queues[_0x115e36[_0x95cf('0x3c')]][_0x95cf('0x3e')]=_0x115e36['origtransfererexten'];queues[_0x115e36['secondtransfererlinkedid']][_0x95cf('0x39')]=_0x115e36[_0x95cf('0x3f')];queues[_0x115e36[_0x95cf('0x3c')]][_0x95cf('0x15')]=_0x95cf('0x40');}if(!_['isNil'](queues[_0x115e36[_0x95cf('0x3b')]])){if(_0x115e36[_0x95cf('0x41')]&&queues[_0x115e36['transfereelinkedid']]){queues[_0x115e36[_0x95cf('0x41')]][_0x95cf('0x17')]=0x1;queues[_0x115e36[_0x95cf('0x36')]]=_['clone'](queues[_0x115e36[_0x95cf('0x41')]]);queues[_0x115e36[_0x95cf('0x36')]][_0x95cf('0xd')]=_0x115e36['transfertargetuniqueid'];queues[_0x115e36[_0x95cf('0x36')]][_0x95cf('0x17')]=0x2;queues[_0x115e36[_0x95cf('0x36')]][_0x95cf('0x5')]=queues[_0x115e36[_0x95cf('0x3c')]]['calleridnum'];queues[_0x115e36['transfereeuniqueid']][_0x95cf('0x42')]=queues[_0x115e36[_0x95cf('0x3c')]][_0x95cf('0x42')];queues[_0x115e36[_0x95cf('0x36')]]['queuecallerjoinAt']=utils[_0x95cf('0x14')]();queues[_0x115e36[_0x95cf('0x36')]][_0x95cf('0x25')]=utils['now']();queues[_0x115e36[_0x95cf('0x36')]][_0x95cf('0x26')]=0x0;queues[_0x115e36['transfereeuniqueid']]['mohtime']=0x0;}else{queues[_0x115e36[_0x95cf('0x3b')]][_0x95cf('0xd')]=_0x115e36['secondtransfererlinkedid'];}}}else if(_0x115e36[_0x95cf('0x43')]==_0x115e36[_0x95cf('0x3c')]){if(!_[_0x95cf('0x18')](queues[_0x115e36['origtransfererlinkedid']])){queues[_0x115e36[_0x95cf('0x3b')]][_0x95cf('0x33')]=!![];queues[_0x115e36[_0x95cf('0x3b')]][_0x95cf('0x37')]='ATTENDED';queues[_0x115e36[_0x95cf('0x3b')]][_0x95cf('0x3e')]=_0x115e36['secondtransfererexten'];queues[_0x115e36['origtransfererlinkedid']]['transferuniqueid']=_0x115e36[_0x95cf('0x43')];queues[_0x115e36['origtransfererlinkedid']][_0x95cf('0x15')]=_0x95cf('0x40');}if(!_[_0x95cf('0x18')](queues[_0x115e36['secondtransfererlinkedid']])){if(_0x115e36[_0x95cf('0x44')]&&queues[_0x115e36[_0x95cf('0x44')]]){queues[_0x115e36[_0x95cf('0x44')]]['queuecallerenterreason']=0x1;queues[_0x115e36[_0x95cf('0x45')]]=_[_0x95cf('0x46')](queues[_0x115e36[_0x95cf('0x44')]]);queues[_0x115e36['transfertargetuniqueid']]['transfereduniqueid']=_0x115e36[_0x95cf('0x45')];queues[_0x115e36['transfertargetuniqueid']][_0x95cf('0x17')]=0x2;queues[_0x115e36[_0x95cf('0x45')]]['calleridnum']=queues[_0x115e36[_0x95cf('0x3b')]][_0x95cf('0x5')];queues[_0x115e36[_0x95cf('0x45')]][_0x95cf('0x42')]=queues[_0x115e36[_0x95cf('0x3b')]]['calleridname'];queues[_0x115e36['transfertargetuniqueid']][_0x95cf('0x28')]=utils[_0x95cf('0x14')]();queues[_0x115e36[_0x95cf('0x45')]][_0x95cf('0x25')]=utils['now']();queues[_0x115e36[_0x95cf('0x45')]][_0x95cf('0x26')]=0x0;queues[_0x115e36['transfertargetuniqueid']][_0x95cf('0x47')]=0x0;}else{queues[_0x115e36['secondtransfererlinkedid']]['transfereduniqueid']=_0x115e36[_0x95cf('0x3b')];}}}}catch(_0x3d894f){utils[_0x95cf('0x48')](_0x3d894f[_0x95cf('0x49')]);}};exports[_0x95cf('0x4a')]=function(_0x534e73){if(!_[_0x95cf('0x18')](queues[_0x534e73['uniqueid']])){queues[_0x534e73[_0x95cf('0xe')]][_0x95cf('0x4b')]=utils[_0x95cf('0x14')]();}};exports['musiconholdstop']=function(_0x3e1867){if(!_['isNil'](queues[_0x3e1867[_0x95cf('0xe')]])){if(!_[_0x95cf('0x18')](queues[_0x3e1867[_0x95cf('0xe')]]['musiconholdstartAt'])){queues[_0x3e1867[_0x95cf('0xe')]][_0x95cf('0x47')]+=utils[_0x95cf('0x27')](utils['now'](),queues[_0x3e1867[_0x95cf('0xe')]]['musiconholdstartAt']);delete queues[_0x3e1867[_0x95cf('0xe')]][_0x95cf('0x4b')];}}}; \ No newline at end of file +var _0x6d31=['calleridnum','calleridname','queuecallerjoinAt','mohtime','secondtransfereruniqueid','transfertype','secondtransfererexten','transfertargetlinkedid','error','musiconholdstart','musiconholdstartAt','musiconholdstop','diffTime','lodash','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','transfereduniqueid','assign','position','now','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','queueposition','EXITWITHKEY','queuecallerabandonAt','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','count','connectedlinenum','connectedlinename','assigned','destaccountcode','lastAssignedTo','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid'];(function(_0x155506,_0x202f81){var _0x14b973=function(_0x560bd2){while(--_0x560bd2){_0x155506['push'](_0x155506['shift']());}};_0x14b973(++_0x202f81);}(_0x6d31,0x193));var _0x16d3=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x6d31[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x16d3('0x0'));var util=require('util');var utils=require(_0x16d3('0x1'));var queues={};function writeDB(_0x341f7d){utils[_0x16d3('0x2')](util[_0x16d3('0x3')](_0x16d3('0x4'),_0x341f7d[_0x16d3('0x5')],_0x341f7d[_0x16d3('0x6')],_0x341f7d['queue'],_0x341f7d['lastAssignedTo'],_0x341f7d['calleridnum'],_0x341f7d[_0x16d3('0x7')],_0x341f7d[_0x16d3('0x8')]));if(_0x341f7d[_0x16d3('0x9')]){utils[_0x16d3('0xa')](_0x341f7d[_0x16d3('0x9')])[_0x16d3('0xb')](function(_0x25f1bf){if(_0x25f1bf){_0x341f7d[_0x16d3('0xc')]=_0x25f1bf['type'];}utils['request'](_0x16d3('0xd'),_0x341f7d);});}else{utils['request'](_0x16d3('0xd'),_0x341f7d);}if(_0x341f7d[_0x16d3('0xe')]){delete queues[_0x341f7d[_0x16d3('0xe')]];}else{delete queues[_0x341f7d['uniqueid']];}}exports['queuecallerjoin']=function(_0x4761b5){queues[_0x4761b5[_0x16d3('0x5')]]=_[_0x16d3('0xf')](_0x4761b5,{'originalposition':_0x4761b5[_0x16d3('0x10')],'queuecallerjoinAt':utils[_0x16d3('0x11')](),'mohtime':0x0});};exports['hangup']=function(_0x3a96dc){if(!_[_0x16d3('0x12')](queues[_0x3a96dc['uniqueid']])){if(queues[_0x3a96dc[_0x16d3('0x5')]]['queuecallerleaveAt']){if(!queues[_0x3a96dc[_0x16d3('0x5')]][_0x16d3('0x13')]&&!queues[_0x3a96dc[_0x16d3('0x5')]][_0x16d3('0x14')]){queues[_0x3a96dc[_0x16d3('0x5')]][_0x16d3('0x15')]=!![];queues[_0x3a96dc[_0x16d3('0x5')]][_0x16d3('0x16')]=utils[_0x16d3('0x11')]();queues[_0x3a96dc[_0x16d3('0x5')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}writeDB(queues[_0x3a96dc[_0x16d3('0x5')]]);}else{if(queues[_0x3a96dc['uniqueid']][_0x16d3('0xe')]){queues[queues[_0x3a96dc[_0x16d3('0x5')]]['transfereduniqueid']]=queues[_0x3a96dc[_0x16d3('0x5')]];queues[queues[_0x3a96dc[_0x16d3('0x5')]][_0x16d3('0xe')]][_0x16d3('0x17')]=0x2;delete queues[_0x3a96dc['uniqueid']];}}}};exports[_0x16d3('0x18')]=function(_0x5e6a82){if(!_['isNil'](_0x5e6a82[_0x16d3('0x19')][_0x16d3('0x1a')])&&_0x5e6a82[_0x16d3('0x1b')][_0x16d3('0x1c')]()!==_0x16d3('0x1d')){if(!_[_0x16d3('0x12')](queues[_0x5e6a82['uniqueid']])){queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x13')]=![];queues[_0x5e6a82[_0x16d3('0x5')]]['queuecallerabandonAt']=null;queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x14')]=!![];queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x1e')]=utils[_0x16d3('0x11')]();queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x8')]=_0x5e6a82[_0x16d3('0x1b')][_0x16d3('0x1c')]();writeDB(queues[_0x5e6a82[_0x16d3('0x5')]]);}}else if(!_['isNil'](_0x5e6a82[_0x16d3('0x19')][_0x16d3('0x1f')])){if(!_['isNil'](queues[_0x5e6a82[_0x16d3('0x5')]])&&!queues[_0x5e6a82[_0x16d3('0x5')]]['queuecallerabandon']){queues[_0x5e6a82[_0x16d3('0x5')]]['queuecallerabandon']=![];queues[_0x5e6a82[_0x16d3('0x5')]]['queuecallerabandonAt']=null;queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x14')]=!![];queues[_0x5e6a82[_0x16d3('0x5')]][_0x16d3('0x1e')]=utils[_0x16d3('0x11')]();queues[_0x5e6a82[_0x16d3('0x5')]]['queuecallerexitreason']=_0x16d3('0x20');}}};exports[_0x16d3('0x13')]=function(_0x4d080a){if(!_[_0x16d3('0x12')](queues[_0x4d080a[_0x16d3('0x5')]])){queues[_0x4d080a['uniqueid']]['queuecallerexit']=![];queues[_0x4d080a['uniqueid']][_0x16d3('0x1e')]=null;queues[_0x4d080a[_0x16d3('0x5')]][_0x16d3('0x13')]=!![];queues[_0x4d080a['uniqueid']][_0x16d3('0x21')]=utils[_0x16d3('0x11')]();queues[_0x4d080a[_0x16d3('0x5')]][_0x16d3('0x8')]=_0x16d3('0x22');}};exports[_0x16d3('0x23')]=function(_0x5d211c){if(!_[_0x16d3('0x12')](queues[_0x5d211c[_0x16d3('0x5')]])){queues[_0x5d211c[_0x16d3('0x5')]]['queuecallerleave']=!![];queues[_0x5d211c[_0x16d3('0x5')]][_0x16d3('0x24')]=utils[_0x16d3('0x11')]();queues[_0x5d211c[_0x16d3('0x5')]][_0x16d3('0x25')]=utils['diffTime'](queues[_0x5d211c[_0x16d3('0x5')]]['queuecallerleaveAt'],queues[_0x5d211c[_0x16d3('0x5')]]['queuecallerjoinAt']);queues[_0x5d211c[_0x16d3('0x5')]]['position']=_0x5d211c[_0x16d3('0x10')];queues[_0x5d211c[_0x16d3('0x5')]][_0x16d3('0x26')]=_0x5d211c[_0x16d3('0x26')];queues[_0x5d211c['uniqueid']][_0x16d3('0x27')]=_0x5d211c[_0x16d3('0x27')];queues[_0x5d211c[_0x16d3('0x5')]][_0x16d3('0x28')]=_0x5d211c['connectedlinename'];}};exports['agentconnect']=function(_0x2606e4){if(!_[_0x16d3('0x12')](queues[_0x2606e4[_0x16d3('0x5')]])){queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x13')]=![];queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x13')]=![];queues[_0x2606e4[_0x16d3('0x5')]]['queuecallerabandonAt']=null;queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x14')]=![];queues[_0x2606e4['uniqueid']][_0x16d3('0x8')]=null;queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x1e')]=null;queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x29')]=!![];queues[_0x2606e4['uniqueid']][_0x16d3('0x7')]=_0x2606e4[_0x16d3('0x2a')];queues[_0x2606e4[_0x16d3('0x5')]][_0x16d3('0x2b')]=_0x2606e4['membername'];}};exports[_0x16d3('0x2c')]=function(_0x3a7f05){if(!_[_0x16d3('0x12')](queues[_0x3a7f05[_0x16d3('0x5')]])){if(queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x24')]){queues[_0x3a7f05['uniqueid']][_0x16d3('0x13')]=![];queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x13')]=![];queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x21')]=null;queues[_0x3a7f05[_0x16d3('0x5')]]['queuecallerexit']=![];queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x1e')]=null;queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x29')]=!![];queues[_0x3a7f05[_0x16d3('0x5')]]['lastAssignedTo']=_0x3a7f05['membername'];queues[_0x3a7f05['uniqueid']][_0x16d3('0x15')]=!![];queues[_0x3a7f05['uniqueid']][_0x16d3('0x16')]=utils[_0x16d3('0x11')]();if(_0x3a7f05[_0x16d3('0x2d')]==_0x16d3('0x2e')){if(!queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x2e')]){queues[_0x3a7f05[_0x16d3('0x5')]]['queuecallerexitreason']=_0x16d3('0x2f');}}else{queues[_0x3a7f05[_0x16d3('0x5')]][_0x16d3('0x8')]=_0x16d3('0x30')+_0x3a7f05[_0x16d3('0x2d')]['toUpperCase']();}writeDB(queues[_0x3a7f05[_0x16d3('0x5')]]);}}};exports['blindtransfer']=function(_0x6d6c9c){if(!_['isNil'](queues[_0x6d6c9c[_0x16d3('0x31')]])){queues[_0x6d6c9c[_0x16d3('0x31')]][_0x16d3('0x2e')]=!![];queues[_0x6d6c9c['transfereeuniqueid']]['transfertype']=_0x16d3('0x32');queues[_0x6d6c9c[_0x16d3('0x31')]][_0x16d3('0x33')]=_0x6d6c9c[_0x16d3('0x34')];queues[_0x6d6c9c[_0x16d3('0x31')]][_0x16d3('0x35')]=_0x6d6c9c[_0x16d3('0x31')];queues[_0x6d6c9c['transfereeuniqueid']][_0x16d3('0x8')]=_0x16d3('0x36');}};exports[_0x16d3('0x37')]=function(_0xd70ba5){try{if(_0xd70ba5[_0x16d3('0x38')]==_0xd70ba5[_0x16d3('0x39')]){if(!_[_0x16d3('0x12')](queues[_0xd70ba5['secondtransfererlinkedid']])){queues[_0xd70ba5[_0x16d3('0x3a')]][_0x16d3('0x2e')]=!![];queues[_0xd70ba5[_0x16d3('0x3a')]]['transfertype']=_0x16d3('0x3b');queues[_0xd70ba5['secondtransfererlinkedid']][_0x16d3('0x33')]=_0xd70ba5[_0x16d3('0x3c')];queues[_0xd70ba5[_0x16d3('0x3a')]][_0x16d3('0x35')]=_0xd70ba5[_0x16d3('0x38')];queues[_0xd70ba5[_0x16d3('0x3a')]][_0x16d3('0x8')]=_0x16d3('0x3d');}if(!_[_0x16d3('0x12')](queues[_0xd70ba5[_0x16d3('0x39')]])){if(_0xd70ba5['transfereelinkedid']&&queues[_0xd70ba5[_0x16d3('0x3e')]]){queues[_0xd70ba5[_0x16d3('0x3e')]][_0x16d3('0x17')]=0x1;queues[_0xd70ba5[_0x16d3('0x31')]]=_[_0x16d3('0x3f')](queues[_0xd70ba5[_0x16d3('0x3e')]]);queues[_0xd70ba5['transfereeuniqueid']]['transfereduniqueid']=_0xd70ba5[_0x16d3('0x40')];queues[_0xd70ba5[_0x16d3('0x31')]][_0x16d3('0x17')]=0x2;queues[_0xd70ba5[_0x16d3('0x31')]]['calleridnum']=queues[_0xd70ba5[_0x16d3('0x3a')]][_0x16d3('0x41')];queues[_0xd70ba5['transfereeuniqueid']][_0x16d3('0x42')]=queues[_0xd70ba5['secondtransfererlinkedid']][_0x16d3('0x42')];queues[_0xd70ba5[_0x16d3('0x31')]][_0x16d3('0x43')]=utils[_0x16d3('0x11')]();queues[_0xd70ba5['transfereeuniqueid']][_0x16d3('0x24')]=utils[_0x16d3('0x11')]();queues[_0xd70ba5[_0x16d3('0x31')]][_0x16d3('0x25')]=0x0;queues[_0xd70ba5[_0x16d3('0x31')]][_0x16d3('0x44')]=0x0;}else{queues[_0xd70ba5['origtransfererlinkedid']][_0x16d3('0xe')]=_0xd70ba5[_0x16d3('0x3a')];}}}else if(_0xd70ba5[_0x16d3('0x45')]==_0xd70ba5['secondtransfererlinkedid']){if(!_['isNil'](queues[_0xd70ba5[_0x16d3('0x39')]])){queues[_0xd70ba5['origtransfererlinkedid']][_0x16d3('0x2e')]=!![];queues[_0xd70ba5[_0x16d3('0x39')]][_0x16d3('0x46')]='ATTENDED';queues[_0xd70ba5[_0x16d3('0x39')]][_0x16d3('0x33')]=_0xd70ba5[_0x16d3('0x47')];queues[_0xd70ba5[_0x16d3('0x39')]][_0x16d3('0x35')]=_0xd70ba5['secondtransfereruniqueid'];queues[_0xd70ba5['origtransfererlinkedid']][_0x16d3('0x8')]=_0x16d3('0x3d');}if(!_[_0x16d3('0x12')](queues[_0xd70ba5[_0x16d3('0x3a')]])){if(_0xd70ba5['transfertargetlinkedid']&&queues[_0xd70ba5[_0x16d3('0x48')]]){queues[_0xd70ba5[_0x16d3('0x48')]][_0x16d3('0x17')]=0x1;queues[_0xd70ba5['transfertargetuniqueid']]=_[_0x16d3('0x3f')](queues[_0xd70ba5[_0x16d3('0x48')]]);queues[_0xd70ba5[_0x16d3('0x40')]]['transfereduniqueid']=_0xd70ba5['transfertargetuniqueid'];queues[_0xd70ba5['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0xd70ba5[_0x16d3('0x40')]][_0x16d3('0x41')]=queues[_0xd70ba5['origtransfererlinkedid']]['calleridnum'];queues[_0xd70ba5['transfertargetuniqueid']][_0x16d3('0x42')]=queues[_0xd70ba5[_0x16d3('0x39')]]['calleridname'];queues[_0xd70ba5['transfertargetuniqueid']][_0x16d3('0x43')]=utils[_0x16d3('0x11')]();queues[_0xd70ba5[_0x16d3('0x40')]][_0x16d3('0x24')]=utils[_0x16d3('0x11')]();queues[_0xd70ba5['transfertargetuniqueid']][_0x16d3('0x25')]=0x0;queues[_0xd70ba5['transfertargetuniqueid']][_0x16d3('0x44')]=0x0;}else{queues[_0xd70ba5[_0x16d3('0x3a')]][_0x16d3('0xe')]=_0xd70ba5[_0x16d3('0x39')];}}}}catch(_0x545443){utils[_0x16d3('0x49')](_0x545443['stack']);}};exports[_0x16d3('0x4a')]=function(_0x30750d){if(!_[_0x16d3('0x12')](queues[_0x30750d[_0x16d3('0x5')]])){queues[_0x30750d[_0x16d3('0x5')]][_0x16d3('0x4b')]=utils[_0x16d3('0x11')]();}};exports[_0x16d3('0x4c')]=function(_0x5e8d5d){if(!_[_0x16d3('0x12')](queues[_0x5e8d5d['uniqueid']])){if(!_['isNil'](queues[_0x5e8d5d['uniqueid']][_0x16d3('0x4b')])){queues[_0x5e8d5d[_0x16d3('0x5')]][_0x16d3('0x44')]+=utils[_0x16d3('0x4d')](utils['now'](),queues[_0x5e8d5d[_0x16d3('0x5')]][_0x16d3('0x4b')]);delete queues[_0x5e8d5d[_0x16d3('0x5')]][_0x16d3('0x4b')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 62067a8..dcbc187 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 _0xcb91=['uniqueid','channelstate','transfer','error','varset','variable','mixmonitor_filename','endsWith','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode','getUserByInternal','then','name','UserId','CreateVoiceRecording','request','newchannel','linkedid','exten','context','channel','stack','newstate','isNil'];(function(_0x2d167b,_0x43578c){var _0x57810e=function(_0x32e32a){while(--_0x32e32a){_0x2d167b['push'](_0x2d167b['shift']());}};_0x57810e(++_0x43578c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xcb91[_0x24061a];return _0x82054e;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x26fe42){utils[_0x1cb9('0x0')](_0x26fe42);if(_0x26fe42[_0x1cb9('0x1')]){utils[_0x1cb9('0x2')](_0x26fe42['accountcode'])[_0x1cb9('0x3')](function(_0x2c17b8){if(_0x2c17b8){_0x26fe42['membername']=_0x2c17b8[_0x1cb9('0x4')];_0x26fe42[_0x1cb9('0x5')]=_0x2c17b8['id'];}utils['request'](_0x1cb9('0x6'),_0x26fe42);});}else{utils[_0x1cb9('0x7')]('CreateVoiceRecording',_0x26fe42);}}exports[_0x1cb9('0x8')]=function(_0x12567c){try{if(_0x12567c['uniqueid']==_0x12567c[_0x1cb9('0x9')]){recordings[_0x12567c['uniqueid']]={'uniqueid':_0x12567c['uniqueid'],'accountcode':_0x12567c[_0x1cb9('0x1')],'exten':_0x12567c[_0x1cb9('0xa')],'context':_0x12567c[_0x1cb9('0xb')],'channel':_0x12567c[_0x1cb9('0xc')],'monitors':[]};}}catch(_0x2fc627){utils['error'](_0x2fc627[_0x1cb9('0xd')]);}};exports[_0x1cb9('0xe')]=function(_0x3af35f){try{if(!_[_0x1cb9('0xf')](recordings[_0x3af35f[_0x1cb9('0x10')]])&&_0x3af35f['channelstate']==0x6){}else if(!_['isNil'](recordings[_0x3af35f['linkedid']])&&_0x3af35f[_0x1cb9('0x11')]==0x6&&_0x3af35f[_0x1cb9('0xb')]!=_0x1cb9('0x12')){recordings[_0x3af35f[_0x1cb9('0x9')]]['accountcode']=_0x3af35f[_0x1cb9('0x1')];}}catch(_0x6ef389){utils[_0x1cb9('0x13')](_0x6ef389[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x14')]=function(_0x5806d8){try{if(!_['isNil'](_0x5806d8[_0x1cb9('0x15')])&&!_[_0x1cb9('0xf')](_0x5806d8[_0x1cb9('0x15')][_0x1cb9('0x16')])){if(_[_0x1cb9('0x17')](_0x5806d8[_0x1cb9('0x18')],_0x1cb9('0x19'))){_0x5806d8['value']=_0x5806d8['value'][_0x1cb9('0x1a')](_0x1cb9('0x19'),_0x1cb9('0x1b'));}if(recordings[_0x5806d8[_0x1cb9('0x9')]]){var _0x280a84=_[_0x1cb9('0x1c')](recordings[_0x5806d8[_0x1cb9('0x9')]]['monitors'],{'value':_0x5806d8['value']});if(_[_0x1cb9('0xf')](_0x280a84)){recordings[_0x5806d8['linkedid']][_0x1cb9('0x1d')][_0x1cb9('0x1e')]({'value':_0x5806d8['value']});}}}}catch(_0x599275){utils[_0x1cb9('0x13')](_0x599275[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x1f')]=function(_0x4601b8){try{if(!_[_0x1cb9('0xf')](recordings[_0x4601b8[_0x1cb9('0x10')]])){recordings[_0x4601b8['uniqueid']]['calleridnum']=_0x4601b8[_0x1cb9('0x20')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x21')]=_0x4601b8[_0x1cb9('0x21')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=_0x4601b8[_0x1cb9('0x22')];recordings[_0x4601b8['uniqueid']][_0x1cb9('0x23')]=_0x4601b8[_0x1cb9('0x23')];if(recordings[_0x4601b8['uniqueid']][_0x1cb9('0x24')]==_0x1cb9('0x25')&&recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')]){recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x22')]=recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x1')];recordings[_0x4601b8[_0x1cb9('0x10')]][_0x1cb9('0x23')]='';}recordings[_0x4601b8['uniqueid']][_0x1cb9('0x1d')]['forEach'](_0x110282=>{var _0x4efebc=_[_0x1cb9('0x26')](recordings[_0x4601b8[_0x1cb9('0x10')]]);_0x4efebc[_0x1cb9('0x18')]=_0x110282[_0x1cb9('0x18')];writeDB(_0x4efebc);});delete recordings[_0x4601b8['uniqueid']];}}catch(_0x1c701f){utils['error'](_0x1c701f[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x27')]=function(_0x4220d7){try{if(!_['isNil'](recordings[_0x4220d7[_0x1cb9('0x10')]])){if(_0x4220d7['application'][_0x1cb9('0x28')]()=='set'&&_[_0x1cb9('0x29')](_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x28')](),_0x1cb9('0x2b'))){var _0x56c3e0=_0x4220d7[_0x1cb9('0x2a')][_0x1cb9('0x2c')]('=');var _0x3467d5=_0x56c3e0[0x0][_0x1cb9('0x2d')](_0x56c3e0[0x0][_0x1cb9('0x2e')]('(')+0x1,_0x56c3e0[0x0][_0x1cb9('0x2e')](')'));var _0xc6d5fd=_0x56c3e0[0x1];recordings[_0x4220d7[_0x1cb9('0x10')]][_0x3467d5]=_0xc6d5fd;}}}catch(_0x386e8b){utils[_0x1cb9('0x13')](_0x386e8b[_0x1cb9('0xd')]);}};exports[_0x1cb9('0x2f')]=function(_0x29f149){try{if(!_['isNil'](recordings[_0x29f149['uniqueid']])){recordings[_0x29f149[_0x1cb9('0x10')]][_0x1cb9('0x30')]=_0x29f149[_0x1cb9('0x30')];}}catch(_0x29f451){utils[_0x1cb9('0x13')](_0x29f451[_0x1cb9('0xd')]);}}; \ No newline at end of file +var _0xa9e0=['application','set','appdata','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','uniqueid','accountcode','exten','context','channel','isNil','channelstate','linkedid','transfer','error','varset','variable','endsWith','.wav49','value','replace','.WAV','find','monitors','stack','hangup','calleridnum','calleridname','connectedlinename','outbound','connectedlinenum','forEach','clone','newexten'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0a9e('0x0'));var utils=require(_0x0a9e('0x1'));var recordings={};function writeDB(_0x29929c){utils['debug'](_0x29929c);if(_0x29929c['accountcode']){utils[_0x0a9e('0x2')](_0x29929c['accountcode'])[_0x0a9e('0x3')](function(_0x432180){if(_0x432180){_0x29929c[_0x0a9e('0x4')]=_0x432180[_0x0a9e('0x5')];_0x29929c[_0x0a9e('0x6')]=_0x432180['id'];}utils['request'](_0x0a9e('0x7'),_0x29929c);});}else{utils[_0x0a9e('0x8')](_0x0a9e('0x7'),_0x29929c);}}exports['newchannel']=function(_0x503809){try{if(_0x503809[_0x0a9e('0x9')]==_0x503809['linkedid']){recordings[_0x503809['uniqueid']]={'uniqueid':_0x503809[_0x0a9e('0x9')],'accountcode':_0x503809[_0x0a9e('0xa')],'exten':_0x503809[_0x0a9e('0xb')],'context':_0x503809[_0x0a9e('0xc')],'channel':_0x503809[_0x0a9e('0xd')],'monitors':[]};}}catch(_0xbd1168){utils['error'](_0xbd1168['stack']);}};exports['newstate']=function(_0x4cfe67){try{if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x9')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6){}else if(!_[_0x0a9e('0xe')](recordings[_0x4cfe67[_0x0a9e('0x10')]])&&_0x4cfe67[_0x0a9e('0xf')]==0x6&&_0x4cfe67['context']!=_0x0a9e('0x11')){recordings[_0x4cfe67[_0x0a9e('0x10')]][_0x0a9e('0xa')]=_0x4cfe67[_0x0a9e('0xa')];}}catch(_0x44dcfd){utils[_0x0a9e('0x12')](_0x44dcfd['stack']);}};exports[_0x0a9e('0x13')]=function(_0x5d0880){try{if(!_[_0x0a9e('0xe')](_0x5d0880['variable'])&&!_[_0x0a9e('0xe')](_0x5d0880[_0x0a9e('0x14')]['mixmonitor_filename'])){if(_[_0x0a9e('0x15')](_0x5d0880['value'],_0x0a9e('0x16'))){_0x5d0880[_0x0a9e('0x17')]=_0x5d0880[_0x0a9e('0x17')][_0x0a9e('0x18')](_0x0a9e('0x16'),_0x0a9e('0x19'));}if(recordings[_0x5d0880[_0x0a9e('0x10')]]){var _0x20559e=_[_0x0a9e('0x1a')](recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')],{'value':_0x5d0880[_0x0a9e('0x17')]});if(_['isNil'](_0x20559e)){recordings[_0x5d0880[_0x0a9e('0x10')]][_0x0a9e('0x1b')]['push']({'value':_0x5d0880[_0x0a9e('0x17')]});}}}}catch(_0x5a09ef){utils['error'](_0x5a09ef[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x1d')]=function(_0x38e7c4){try{if(!_[_0x0a9e('0xe')](recordings[_0x38e7c4['uniqueid']])){recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1e')]=_0x38e7c4[_0x0a9e('0x1e')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1f')]=_0x38e7c4[_0x0a9e('0x1f')];recordings[_0x38e7c4[_0x0a9e('0x9')]]['connectedlinenum']=_0x38e7c4['connectedlinenum'];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]=_0x38e7c4[_0x0a9e('0x20')];if(recordings[_0x38e7c4[_0x0a9e('0x9')]]['type']==_0x0a9e('0x21')&&recordings[_0x38e7c4['uniqueid']][_0x0a9e('0xa')]){recordings[_0x38e7c4['uniqueid']][_0x0a9e('0x22')]=recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0xa')];recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x20')]='';}recordings[_0x38e7c4[_0x0a9e('0x9')]][_0x0a9e('0x1b')][_0x0a9e('0x23')](_0x5a101a=>{var _0x3652a7=_[_0x0a9e('0x24')](recordings[_0x38e7c4[_0x0a9e('0x9')]]);_0x3652a7[_0x0a9e('0x17')]=_0x5a101a['value'];writeDB(_0x3652a7);});delete recordings[_0x38e7c4[_0x0a9e('0x9')]];}}catch(_0x40e7a3){utils[_0x0a9e('0x12')](_0x40e7a3[_0x0a9e('0x1c')]);}};exports[_0x0a9e('0x25')]=function(_0x563b45){try{if(!_[_0x0a9e('0xe')](recordings[_0x563b45[_0x0a9e('0x9')]])){if(_0x563b45[_0x0a9e('0x26')]['toLowerCase']()==_0x0a9e('0x27')&&_['startsWith'](_0x563b45[_0x0a9e('0x28')][_0x0a9e('0x29')](),_0x0a9e('0x2a'))){var _0x33bdb7=_0x563b45[_0x0a9e('0x28')]['split']('=');var _0x66c1d2=_0x33bdb7[0x0][_0x0a9e('0x2b')](_0x33bdb7[0x0][_0x0a9e('0x2c')]('(')+0x1,_0x33bdb7[0x0][_0x0a9e('0x2c')](')'));var _0x2b45ea=_0x33bdb7[0x1];recordings[_0x563b45[_0x0a9e('0x9')]][_0x66c1d2]=_0x2b45ea;}}}catch(_0x332d35){utils[_0x0a9e('0x12')](_0x332d35['stack']);}};exports[_0x0a9e('0x2d')]=function(_0x5e7238){try{if(!_[_0x0a9e('0xe')](recordings[_0x5e7238[_0x0a9e('0x9')]])){recordings[_0x5e7238[_0x0a9e('0x9')]][_0x0a9e('0x2e')]=_0x5e7238['queue'];}}catch(_0x191e91){utils[_0x0a9e('0x12')](_0x191e91[_0x0a9e('0x1c')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 4e7f817..f5daf97 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 _0x2e3b=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','util','./utils','info','format','TRANSFER|%s','type','request','blindtransfer','blind','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum'];(function(_0x4b2341,_0x2e2f20){var _0x59eed4=function(_0x17f887){while(--_0x17f887){_0x4b2341['push'](_0x4b2341['shift']());}};_0x59eed4(++_0x2e2f20);}(_0x2e3b,0x81));var _0xb2e3=function(_0x5664aa,_0x1d8fdd){_0x5664aa=_0x5664aa-0x0;var _0x31cd6a=_0x2e3b[_0x5664aa];return _0x31cd6a;};'use strict';var _=require('lodash');var util=require(_0xb2e3('0x0'));var utils=require(_0xb2e3('0x1'));function writeDB(_0x236bdb){utils[_0xb2e3('0x2')](util[_0xb2e3('0x3')](_0xb2e3('0x4'),_0x236bdb[_0xb2e3('0x5')]));utils[_0xb2e3('0x6')]('CreateVoiceTransferReport',_0x236bdb);}exports[_0xb2e3('0x7')]=function(_0x1e2afd){try{_0x1e2afd['type']=_0xb2e3('0x8');writeDB(_0x1e2afd);}catch(_0x108b1c){utils['error'](_0x108b1c[_0xb2e3('0x9')]);}};exports[_0xb2e3('0xa')]=function(_0x4fbc94){try{_0x4fbc94=_[_0xb2e3('0xb')](_0x4fbc94,{'transfererchannel':_0x4fbc94[_0xb2e3('0xc')],'transferercalleridnum':_0x4fbc94[_0xb2e3('0xd')],'transferercalleridname':_0x4fbc94[_0xb2e3('0xe')],'transfererconnectedlinenum':_0x4fbc94[_0xb2e3('0xf')],'transfererconnectedlinename':_0x4fbc94['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4fbc94[_0xb2e3('0x10')],'transferercontext':_0x4fbc94['secondtransferercontext'],'transfererexten':_0x4fbc94[_0xb2e3('0x11')],'transfererlinkedid':_0x4fbc94[_0xb2e3('0x12')],'context':_0x4fbc94[_0xb2e3('0x13')],'extension':_0x4fbc94[_0xb2e3('0x14')],'type':_0xb2e3('0x15')});if(_[_0xb2e3('0x16')](_0x4fbc94[_0xb2e3('0x17')])){_0x4fbc94=_['assign'](_0x4fbc94,{'transfereechannel':_0x4fbc94['transfertargetchannel'],'transfereecalleridnum':_0x4fbc94['transfertargetcalleridnum'],'transfereecalleridname':_0x4fbc94[_0xb2e3('0x18')],'transfereeconnectedlinenum':_0x4fbc94[_0xb2e3('0x19')],'transfereeconnectedlinename':_0x4fbc94[_0xb2e3('0x1a')],'transfereeaccountcode':_0x4fbc94[_0xb2e3('0x1b')],'transfereecontext':_0x4fbc94['transfertargetcontext'],'transfereeexten':_0x4fbc94[_0xb2e3('0x1c')],'transfereelinkedid':_0x4fbc94[_0xb2e3('0x1d')]});}writeDB(_0x4fbc94);}catch(_0x2f40ed){utils[_0xb2e3('0x1e')](_0x2f40ed[_0xb2e3('0x9')]);}}; \ No newline at end of file +var _0x8ebf=['info','format','type','request','CreateVoiceTransferReport','error','stack','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetlinkedid','lodash','util','./utils'];(function(_0x29b879,_0x1e899e){var _0x4b065c=function(_0x37e4dc){while(--_0x37e4dc){_0x29b879['push'](_0x29b879['shift']());}};_0x4b065c(++_0x1e899e);}(_0x8ebf,0x15c));var _0xf8eb=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x8ebf[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require(_0xf8eb('0x0'));var util=require(_0xf8eb('0x1'));var utils=require(_0xf8eb('0x2'));function writeDB(_0x4e42d0){utils[_0xf8eb('0x3')](util[_0xf8eb('0x4')]('TRANSFER|%s',_0x4e42d0[_0xf8eb('0x5')]));utils[_0xf8eb('0x6')](_0xf8eb('0x7'),_0x4e42d0);}exports['blindtransfer']=function(_0xfce9b){try{_0xfce9b[_0xf8eb('0x5')]='blind';writeDB(_0xfce9b);}catch(_0x30c91c){utils[_0xf8eb('0x8')](_0x30c91c[_0xf8eb('0x9')]);}};exports['attendedtransfer']=function(_0x959b95){try{_0x959b95=_['assign'](_0x959b95,{'transfererchannel':_0x959b95[_0xf8eb('0xa')],'transferercalleridnum':_0x959b95['origtransferercalleridnum'],'transferercalleridname':_0x959b95[_0xf8eb('0xb')],'transfererconnectedlinenum':_0x959b95[_0xf8eb('0xc')],'transfererconnectedlinename':_0x959b95[_0xf8eb('0xd')],'transfereraccountcode':_0x959b95['origtransfereraccountcode'],'transferercontext':_0x959b95[_0xf8eb('0xe')],'transfererexten':_0x959b95[_0xf8eb('0xf')],'transfererlinkedid':_0x959b95[_0xf8eb('0x10')],'context':_0x959b95[_0xf8eb('0x11')],'extension':_0x959b95[_0xf8eb('0x12')],'type':_0xf8eb('0x13')});if(_[_0xf8eb('0x14')](_0x959b95[_0xf8eb('0x15')])){_0x959b95=_['assign'](_0x959b95,{'transfereechannel':_0x959b95[_0xf8eb('0x16')],'transfereecalleridnum':_0x959b95[_0xf8eb('0x17')],'transfereecalleridname':_0x959b95[_0xf8eb('0x18')],'transfereeconnectedlinenum':_0x959b95[_0xf8eb('0x19')],'transfereeconnectedlinename':_0x959b95['transfertargetconnectedlinename'],'transfereeaccountcode':_0x959b95['transfertargetaccountcode'],'transfereecontext':_0x959b95['transfertargetcontext'],'transfereeexten':_0x959b95['transfertargetexten'],'transfereelinkedid':_0x959b95[_0xf8eb('0x1a')]});}writeDB(_0x959b95);}catch(_0x22af2e){utils['error'](_0x22af2e[_0xf8eb('0x9')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b8a1411..9237a57 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 _0x6102=['stack','request','then','GetUser','internal','name','interface','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','catch','getUserByInterface','getUserByName','getVoiceQueueByName','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','isAfter','isBefore','jayson/promise','bluebird','client','../../config/logger','xdr','info','debug','stringify','error'];(function(_0x360063,_0x33554b){var _0x1e6be2=function(_0x58e464){while(--_0x58e464){_0x360063['push'](_0x360063['shift']());}};_0x1e6be2(++_0x33554b);}(_0x6102,0x199));var _0x2610=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x6102[_0x2d34d6];return _0x1d3d12;};'use strict';var jayson=require(_0x2610('0x0'));var moment=require('moment');var BPromise=require(_0x2610('0x1'));var client=jayson[_0x2610('0x2')]['http']({'port':0x2329});var logger=require(_0x2610('0x3'))(_0x2610('0x4'));exports[_0x2610('0x5')]=function(_0x45f10a){logger[_0x2610('0x5')](_0x45f10a);};exports['debug']=function(_0x5c3f0d){logger[_0x2610('0x6')](JSON[_0x2610('0x7')](_0x5c3f0d));};exports[_0x2610('0x8')]=function(_0x5bea45){logger[_0x2610('0x8')](_0x5bea45[_0x2610('0x9')]);};exports['request']=function(_0x5c2984,_0x38aa88){return client[_0x2610('0xa')](_0x5c2984,{'body':_0x38aa88})[_0x2610('0xb')](function(_0x4735ce){logger[_0x2610('0x6')](JSON[_0x2610('0x7')](_0x4735ce));})['catch'](function(_0x56c596){logger['error'](_0x56c596[_0x2610('0x9')]);});};function getUser(_0x5ef288){return client['request'](_0x2610('0xc'),{'options':{'raw':!![],'attributes':['id',_0x2610('0xd'),_0x2610('0xe'),_0x2610('0xf')],'where':_0x5ef288,'limit':0x1}})['then'](function(_0x432e28){logger['info'](_0x2610('0x10')+JSON[_0x2610('0x7')](_0x5ef288)+'|'+(_0x432e28[_0x2610('0x11')][_0x2610('0x12')]?_0x2610('0x13'):_0x2610('0x14')));return _0x432e28[_0x2610('0x11')][_0x2610('0x12')]?_0x432e28['result'][0x0]:null;});}exports[_0x2610('0x15')]=function(_0x149ed5){return new BPromise(function(_0x138283,_0x2c2ea9){if(_0x149ed5){return getUser({'internal':_0x149ed5})[_0x2610('0xb')](function(_0xfabf16){return _0x138283(_0xfabf16);})[_0x2610('0x16')](function(_0x591583){logger[_0x2610('0x8')](_0x591583[_0x2610('0x9')]);return _0x138283(null);});}else{return _0x138283(null);}});};exports[_0x2610('0x17')]=function(_0x4ffdc6){return new BPromise(function(_0x1bbfeb,_0x98f979){if(_0x4ffdc6){return getUser({'interface':_0x4ffdc6})['then'](function(_0x3ca63a){return _0x1bbfeb(_0x3ca63a);})[_0x2610('0x16')](function(_0x539e15){logger['error'](_0x539e15[_0x2610('0x9')]);return _0x1bbfeb(null);});}else{return _0x1bbfeb(null);}});};exports[_0x2610('0x18')]=function(_0x256002){return new BPromise(function(_0x30990d,_0x472885){if(_0x256002){return getUser({'name':_0x256002})[_0x2610('0xb')](function(_0x25fda1){return _0x30990d(_0x25fda1);})['catch'](function(_0x5e6337){logger['error'](_0x5e6337[_0x2610('0x9')]);return _0x30990d(null);});}else{return _0x30990d(null);}});};exports[_0x2610('0x19')]=function(_0x36112a){return new BPromise(function(_0x552638,_0x4d631b){if(_0x36112a){return client[_0x2610('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x2610('0x1a'),_0x2610('0x1b'),_0x2610('0x1c')],'where':{'name':_0x36112a},'limit':0x1}})['then'](function(_0x75de53){logger[_0x2610('0x5')](_0x2610('0x1d')+_0x36112a+'|'+(_0x75de53[_0x2610('0x11')]['length']?_0x2610('0x13'):'NOTFOUND'));return _0x552638(_0x75de53[_0x2610('0x11')]['length']?_0x75de53[_0x2610('0x11')][0x0]:null);})[_0x2610('0x16')](function(_0x1aaf68){logger[_0x2610('0x8')](_0x1aaf68[_0x2610('0x9')]);return _0x552638(null);});}else{return _0x552638(null);}});};exports['addTime']=function(_0x2f34c5,_0x323f84){return moment(_0x2f34c5)['add'](_0x323f84,_0x2610('0x1e'))[_0x2610('0x1f')](_0x2610('0x20'));};exports[_0x2610('0x21')]=function(_0xde1708,_0x16ed9a){return moment(_0xde1708)['subtract'](_0x16ed9a,_0x2610('0x1e'))[_0x2610('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2610('0x22')]=function(_0x3b7d9e,_0x17636a){return moment(_0x3b7d9e)[_0x2610('0x23')](moment(_0x17636a),_0x2610('0x1e'));};exports['sumTime']=function(_0x5a04e8,_0x39aa22){return parseInt(_0x5a04e8,0xa)+parseInt(_0x39aa22,0xa);};exports['now']=function(){return moment()[_0x2610('0x1f')](_0x2610('0x20'));};exports[_0x2610('0x24')]=function(_0x1629a5,_0x427e02){if(_0x427e02){return moment(_0x1629a5)['isAfter'](_0x427e02);}else{return!![];}};exports[_0x2610('0x25')]=function(_0x1570b9,_0xf9fbcf){if(_0xf9fbcf){return moment(_0x1570b9)[_0x2610('0x25')](_0xf9fbcf);}else if(_0x1570b9){return!![];}else{return![];}}; \ No newline at end of file +var _0x120f=['sumTime','now','isBefore','client','../../config/logger','xdr','info','debug','stringify','error','request','catch','stack','GetUser','internal','interface','then','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','getVoiceQueueByName','name','acw','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x120f,0x12b));var _0xf120=function(_0xf382d,_0x185322){_0xf382d=_0xf382d-0x0;var _0x24d522=_0x120f[_0xf382d];return _0x24d522;};'use strict';var jayson=require('jayson/promise');var moment=require('moment');var BPromise=require('bluebird');var client=jayson[_0xf120('0x0')]['http']({'port':0x2329});var logger=require(_0xf120('0x1'))(_0xf120('0x2'));exports['info']=function(_0x5dd615){logger[_0xf120('0x3')](_0x5dd615);};exports[_0xf120('0x4')]=function(_0x1ec1c0){logger[_0xf120('0x4')](JSON[_0xf120('0x5')](_0x1ec1c0));};exports[_0xf120('0x6')]=function(_0x4da1e9){logger['error'](_0x4da1e9['stack']);};exports[_0xf120('0x7')]=function(_0x3fae7f,_0x1d87dc){return client[_0xf120('0x7')](_0x3fae7f,{'body':_0x1d87dc})['then'](function(_0x41bd63){logger[_0xf120('0x4')](JSON[_0xf120('0x5')](_0x41bd63));})[_0xf120('0x8')](function(_0x267b02){logger[_0xf120('0x6')](_0x267b02[_0xf120('0x9')]);});};function getUser(_0x80ce0){return client[_0xf120('0x7')](_0xf120('0xa'),{'options':{'raw':!![],'attributes':['id',_0xf120('0xb'),'name',_0xf120('0xc')],'where':_0x80ce0,'limit':0x1}})[_0xf120('0xd')](function(_0xa5c05b){logger[_0xf120('0x3')](_0xf120('0xe')+JSON[_0xf120('0x5')](_0x80ce0)+'|'+(_0xa5c05b[_0xf120('0xf')][_0xf120('0x10')]?_0xf120('0x11'):_0xf120('0x12')));return _0xa5c05b['result'][_0xf120('0x10')]?_0xa5c05b[_0xf120('0xf')][0x0]:null;});}exports[_0xf120('0x13')]=function(_0x2a29f7){return new BPromise(function(_0x15dadf,_0x28d81e){if(_0x2a29f7){return getUser({'internal':_0x2a29f7})['then'](function(_0x52ca36){return _0x15dadf(_0x52ca36);})['catch'](function(_0x46c6fa){logger[_0xf120('0x6')](_0x46c6fa[_0xf120('0x9')]);return _0x15dadf(null);});}else{return _0x15dadf(null);}});};exports[_0xf120('0x14')]=function(_0xea0760){return new BPromise(function(_0x269d4c,_0x58cc70){if(_0xea0760){return getUser({'interface':_0xea0760})[_0xf120('0xd')](function(_0x4e45a2){return _0x269d4c(_0x4e45a2);})[_0xf120('0x8')](function(_0x2b6a8a){logger[_0xf120('0x6')](_0x2b6a8a[_0xf120('0x9')]);return _0x269d4c(null);});}else{return _0x269d4c(null);}});};exports['getUserByName']=function(_0x55c7cc){return new BPromise(function(_0x2aff81,_0x273b99){if(_0x55c7cc){return getUser({'name':_0x55c7cc})[_0xf120('0xd')](function(_0x3840a8){return _0x2aff81(_0x3840a8);})[_0xf120('0x8')](function(_0x431b22){logger[_0xf120('0x6')](_0x431b22[_0xf120('0x9')]);return _0x2aff81(null);});}else{return _0x2aff81(null);}});};exports[_0xf120('0x15')]=function(_0x359156){return new BPromise(function(_0x138ac7,_0x5ee300){if(_0x359156){return client[_0xf120('0x7')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xf120('0x16'),'type',_0xf120('0x17'),_0xf120('0x18')],'where':{'name':_0x359156},'limit':0x1}})[_0xf120('0xd')](function(_0x50865e){logger['info'](_0xf120('0x19')+_0x359156+'|'+(_0x50865e['result']['length']?_0xf120('0x11'):_0xf120('0x12')));return _0x138ac7(_0x50865e[_0xf120('0xf')]['length']?_0x50865e[_0xf120('0xf')][0x0]:null);})[_0xf120('0x8')](function(_0x42f63b){logger['error'](_0x42f63b[_0xf120('0x9')]);return _0x138ac7(null);});}else{return _0x138ac7(null);}});};exports[_0xf120('0x1a')]=function(_0x4e507c,_0x26d787){return moment(_0x4e507c)['add'](_0x26d787,'seconds')[_0xf120('0x1b')](_0xf120('0x1c'));};exports[_0xf120('0x1d')]=function(_0x25d519,_0x11540b){return moment(_0x25d519)[_0xf120('0x1e')](_0x11540b,_0xf120('0x1f'))[_0xf120('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf120('0x20')]=function(_0xe7becb,_0x56dcc6){return moment(_0xe7becb)[_0xf120('0x21')](moment(_0x56dcc6),_0xf120('0x1f'));};exports[_0xf120('0x22')]=function(_0x880528,_0x326e9f){return parseInt(_0x880528,0xa)+parseInt(_0x326e9f,0xa);};exports[_0xf120('0x23')]=function(){return moment()['format'](_0xf120('0x1c'));};exports['isAfter']=function(_0x471265,_0x4a3def){if(_0x4a3def){return moment(_0x471265)['isAfter'](_0x4a3def);}else{return!![];}};exports[_0xf120('0x24')]=function(_0x62d94b,_0x198b04){if(_0x198b04){return moment(_0x62d94b)[_0xf120('0x24')](_0x198b04);}else if(_0x62d94b){return!![];}else{return![];}}; \ No newline at end of file